Built motion from commit (unavailable).|2.3.2 2.3.2
authorAndrea Bianco <andrea.bianco@xcally.com>
Thu, 12 Sep 2019 21:40:26 +0000 (23:40 +0200)
committerAndrea Bianco <andrea.bianco@xcally.com>
Thu, 12 Sep 2019 21:40:26 +0000 (23:40 +0200)
1141 files changed:
apidoc/api_project.js
apidoc/api_project.json
package.json
public/app/forgot/i18n/he.json
public/app/login/i18n/he.json
public/app/main/apps/callysquare/i18n/he.json
public/app/main/apps/chat/i18n/he.json
public/app/main/apps/contactmanager/i18n/he.json
public/app/main/apps/dashboards/i18n/ar.json
public/app/main/apps/dashboards/i18n/da.json
public/app/main/apps/dashboards/i18n/de.json
public/app/main/apps/dashboards/i18n/en.json
public/app/main/apps/dashboards/i18n/es.json
public/app/main/apps/dashboards/i18n/fa.json
public/app/main/apps/dashboards/i18n/fi.json
public/app/main/apps/dashboards/i18n/fr.json
public/app/main/apps/dashboards/i18n/he.json
public/app/main/apps/dashboards/i18n/hi.json
public/app/main/apps/dashboards/i18n/id.json
public/app/main/apps/dashboards/i18n/it.json
public/app/main/apps/dashboards/i18n/ja.json
public/app/main/apps/dashboards/i18n/ko.json
public/app/main/apps/dashboards/i18n/lv.json
public/app/main/apps/dashboards/i18n/nl.json
public/app/main/apps/dashboards/i18n/no.json
public/app/main/apps/dashboards/i18n/pl.json
public/app/main/apps/dashboards/i18n/pt-BR.json
public/app/main/apps/dashboards/i18n/pt-PT.json
public/app/main/apps/dashboards/i18n/ru.json
public/app/main/apps/dashboards/i18n/sv.json
public/app/main/apps/dashboards/i18n/tr.json
public/app/main/apps/dashboards/i18n/zh-CN.json
public/app/main/apps/dashboards/i18n/zh-TW.json
public/app/main/apps/fax/i18n/he.json
public/app/main/apps/integrations/i18n/he.json
public/app/main/apps/jscripty/i18n/he.json
public/app/main/apps/mail/i18n/he.json
public/app/main/apps/motiondialer/i18n/he.json
public/app/main/apps/openchannel/i18n/he.json
public/app/main/apps/settings/i18n/ar.json
public/app/main/apps/settings/i18n/da.json
public/app/main/apps/settings/i18n/de.json
public/app/main/apps/settings/i18n/en.json
public/app/main/apps/settings/i18n/es.json
public/app/main/apps/settings/i18n/fa.json
public/app/main/apps/settings/i18n/fi.json
public/app/main/apps/settings/i18n/fr.json
public/app/main/apps/settings/i18n/he.json
public/app/main/apps/settings/i18n/hi.json
public/app/main/apps/settings/i18n/id.json
public/app/main/apps/settings/i18n/it.json
public/app/main/apps/settings/i18n/ja.json
public/app/main/apps/settings/i18n/ko.json
public/app/main/apps/settings/i18n/lv.json
public/app/main/apps/settings/i18n/nl.json
public/app/main/apps/settings/i18n/no.json
public/app/main/apps/settings/i18n/pl.json
public/app/main/apps/settings/i18n/pt-BR.json
public/app/main/apps/settings/i18n/pt-PT.json
public/app/main/apps/settings/i18n/ru.json
public/app/main/apps/settings/i18n/sv.json
public/app/main/apps/settings/i18n/tr.json
public/app/main/apps/settings/i18n/zh-CN.json
public/app/main/apps/settings/i18n/zh-TW.json
public/app/main/apps/sms/i18n/he.json
public/app/main/apps/staff/i18n/he.json
public/app/main/apps/tools/i18n/he.json
public/app/main/apps/voice/i18n/he.json
public/app/quick-panel/i18n/he.json
public/app/reset/i18n/he.json
public/app/toolbar/i18n/ar.json
public/app/toolbar/i18n/da.json
public/app/toolbar/i18n/de.json
public/app/toolbar/i18n/en.json
public/app/toolbar/i18n/es.json
public/app/toolbar/i18n/fa.json
public/app/toolbar/i18n/fi.json
public/app/toolbar/i18n/fr.json
public/app/toolbar/i18n/he.json
public/app/toolbar/i18n/hi.json
public/app/toolbar/i18n/id.json
public/app/toolbar/i18n/it.json
public/app/toolbar/i18n/ja.json
public/app/toolbar/i18n/ko.json
public/app/toolbar/i18n/lv.json
public/app/toolbar/i18n/nl.json
public/app/toolbar/i18n/no.json
public/app/toolbar/i18n/pl.json
public/app/toolbar/i18n/pt-BR.json
public/app/toolbar/i18n/pt-PT.json
public/app/toolbar/i18n/ru.json
public/app/toolbar/i18n/sv.json
public/app/toolbar/i18n/tr.json
public/app/toolbar/i18n/zh-CN.json
public/app/toolbar/i18n/zh-TW.json
public/index.html
public/scripts/app.241ff46a.js [moved from public/scripts/app.4b43d586.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/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.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/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/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/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/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/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.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/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/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/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/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/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/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/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/app.js
server/components/auth/service.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/integrations/configuration.js
server/components/interaction/service.js
server/components/license/service.js
server/components/parsers/qs.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/index.js
server/config/seedContact.js
server/config/seedUsers.js
server/config/socketio.js
server/config/triggers/index.js
server/config/utils.js
server/errors/index.js
server/migrations/2.3.2.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/graph/index.js
server/services/agi/index.js
server/services/agi/mailRpc/index.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/action.js
server/services/ami/dialer/agentComplete.js
server/services/ami/dialer/final.js
server/services/ami/dialer/hangup.js
server/services/ami/dialer/history.js
server/services/ami/dialer/index.js
server/services/ami/dialer/queueCallerAbandon.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/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/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/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/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/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/memberReport.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/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/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/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/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/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/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/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

index 7f253ba..a9297ad 100644 (file)
@@ -1 +1 @@
-define({\r  "name": "xCALLY Motion API",\r  "version": "2.3.1",\r  "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.",\r  "title": "xCALLY MOTION API",\r  "header": {\r    "title": "Introduction",\r    "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><code class=\"language-sh\">GET /api/users\n</code></pre>\n<p>Prepend your xCALLY URL to the resource identifier to get the full endpoint URL:</p>\n<pre><code class=\"language-sh\">https://motion.xcally.com/api/users\n</code></pre>\n<p>Curly braces, <code>{}</code>, indicate values you have to supply. Example:</p>\n<pre><code class=\"language-sh\">GET  /api/users/{id}\n</code></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><code class=\"language-sh\">curl -u admin:password https://motion.xcally.com/api/users\n</code></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><code class=\"language-sh\">curl -H &quot;Authorization: Bearer gErypPlm4dOVgGRvA1ZzMH5MQ3nLo8bo&quot; https://motion.xcally.com/api/users\n</code></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><code class=\"language-sh\">curl -u admin:password https://motion.xcally.com/api/users?apikey=eyJhbGciOiJIUzUxMiIsInR5cC...\n</code></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"\r  },\r  "template": {\r    "withGenerator": false,\r    "withCompare": false,\r    "forceLanguage": "en"\r  },\r  "sampleUrl": false,\r  "defaultVersion": "0.0.0",\r  "apidoc": "0.3.0",\r  "generator": {\r    "name": "apidoc",\r    "time": "2019-09-09T17:46:49.812Z",\r    "url": "http://apidocjs.com",\r    "version": "0.17.7"\r  }\r});
+define({\r  "name": "xCALLY Motion API",\r  "version": "2.3.2",\r  "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.",\r  "title": "xCALLY MOTION API",\r  "header": {\r    "title": "Introduction",\r    "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><code class=\"language-sh\">GET /api/users\n</code></pre>\n<p>Prepend your xCALLY URL to the resource identifier to get the full endpoint URL:</p>\n<pre><code class=\"language-sh\">https://motion.xcally.com/api/users\n</code></pre>\n<p>Curly braces, <code>{}</code>, indicate values you have to supply. Example:</p>\n<pre><code class=\"language-sh\">GET  /api/users/{id}\n</code></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><code class=\"language-sh\">curl -u admin:password https://motion.xcally.com/api/users\n</code></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><code class=\"language-sh\">curl -H &quot;Authorization: Bearer gErypPlm4dOVgGRvA1ZzMH5MQ3nLo8bo&quot; https://motion.xcally.com/api/users\n</code></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><code class=\"language-sh\">curl -u admin:password https://motion.xcally.com/api/users?apikey=eyJhbGciOiJIUzUxMiIsInR5cC...\n</code></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"\r  },\r  "template": {\r    "withGenerator": false,\r    "withCompare": false,\r    "forceLanguage": "en"\r  },\r  "sampleUrl": false,\r  "defaultVersion": "0.0.0",\r  "apidoc": "0.3.0",\r  "generator": {\r    "name": "apidoc",\r    "time": "2019-09-12T21:33:53.809Z",\r    "url": "http://apidocjs.com",\r    "version": "0.17.7"\r  }\r});
index 5072439..50cbcdd 100644 (file)
@@ -1 +1 @@
-{\r  "name": "xCALLY Motion API",\r  "version": "2.3.1",\r  "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.",\r  "title": "xCALLY MOTION API",\r  "header": {\r    "title": "Introduction",\r    "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><code class=\"language-sh\">GET /api/users\n</code></pre>\n<p>Prepend your xCALLY URL to the resource identifier to get the full endpoint URL:</p>\n<pre><code class=\"language-sh\">https://motion.xcally.com/api/users\n</code></pre>\n<p>Curly braces, <code>{}</code>, indicate values you have to supply. Example:</p>\n<pre><code class=\"language-sh\">GET  /api/users/{id}\n</code></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><code class=\"language-sh\">curl -u admin:password https://motion.xcally.com/api/users\n</code></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><code class=\"language-sh\">curl -H &quot;Authorization: Bearer gErypPlm4dOVgGRvA1ZzMH5MQ3nLo8bo&quot; https://motion.xcally.com/api/users\n</code></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><code class=\"language-sh\">curl -u admin:password https://motion.xcally.com/api/users?apikey=eyJhbGciOiJIUzUxMiIsInR5cC...\n</code></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"\r  },\r  "template": {\r    "withGenerator": false,\r    "withCompare": false,\r    "forceLanguage": "en"\r  },\r  "sampleUrl": false,\r  "defaultVersion": "0.0.0",\r  "apidoc": "0.3.0",\r  "generator": {\r    "name": "apidoc",\r    "time": "2019-09-09T17:46:49.812Z",\r    "url": "http://apidocjs.com",\r    "version": "0.17.7"\r  }\r}
+{\r  "name": "xCALLY Motion API",\r  "version": "2.3.2",\r  "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.",\r  "title": "xCALLY MOTION API",\r  "header": {\r    "title": "Introduction",\r    "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><code class=\"language-sh\">GET /api/users\n</code></pre>\n<p>Prepend your xCALLY URL to the resource identifier to get the full endpoint URL:</p>\n<pre><code class=\"language-sh\">https://motion.xcally.com/api/users\n</code></pre>\n<p>Curly braces, <code>{}</code>, indicate values you have to supply. Example:</p>\n<pre><code class=\"language-sh\">GET  /api/users/{id}\n</code></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><code class=\"language-sh\">curl -u admin:password https://motion.xcally.com/api/users\n</code></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><code class=\"language-sh\">curl -H &quot;Authorization: Bearer gErypPlm4dOVgGRvA1ZzMH5MQ3nLo8bo&quot; https://motion.xcally.com/api/users\n</code></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><code class=\"language-sh\">curl -u admin:password https://motion.xcally.com/api/users?apikey=eyJhbGciOiJIUzUxMiIsInR5cC...\n</code></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"\r  },\r  "template": {\r    "withGenerator": false,\r    "withCompare": false,\r    "forceLanguage": "en"\r  },\r  "sampleUrl": false,\r  "defaultVersion": "0.0.0",\r  "apidoc": "0.3.0",\r  "generator": {\r    "name": "apidoc",\r    "time": "2019-09-12T21:33:53.809Z",\r    "url": "http://apidocjs.com",\r    "version": "0.17.7"\r  }\r}
index 4cd0270..a37a44d 100644 (file)
@@ -1,6 +1,6 @@
 {
     "name": "motion",
-    "version": "2.3.1",
+    "version": "2.3.2",
     "description": "xCALLY Motion is the new Realtime asynchronous solution for your multichannel contact center over Asterisk.",
     "main": "server/app.js",
     "engines": {
index 9f23b81..9663eb4 100644 (file)
@@ -1,9 +1,9 @@
 {
     "FORGOTPASSWORD": {
-        "TITLE": "כותרת",
+        "TITLE": "שחזר סיסמה",
         "EMAIL_ADRESS": "כתובת דוא\"ל",
         "SEND_RESET_LINK": "שלח קישור לאיפוס",
-        "GO_BACK": "חזור אחורה",
+        "GO_BACK": "חזור לדף הכניסה",
         "LINK_SENT": "הקישור נשלח",
         "LINNK_SENT_MESSAGE": "הודעת דוא\"ל ובה קישור לאיפוס הסיסמה נשלחה אל הכתובת שלך!",
         "PASSWORD_RESET_ERROR": "שגיאה באיפוס סיסמה",
index 5a9462f..ebe6775 100644 (file)
@@ -3,7 +3,7 @@
         "TELEPHONES": "טלפונים",
         "SELECT": "בחר",
         "CANCEL": "ביטול",
-        "TITLE": "כותרת",
+        "TITLE": "כניסה לחשבון",
         "EMAIL": "דוא\"ל",
         "USERNAME": "שם משתמש",
         "PASSWORD": "סיסמה",
index 0210574..ca3e9f3 100644 (file)
@@ -7,7 +7,7 @@
         "AWS_LEX_REGION": "אזור",
         "AWS_BOT_NAME": "שם הבוט",
         "ADDUSER_PROJECTS": "הוסף משתמשים לפרויקט",
-        "PERMISSIONADD_PROJECTS": "הוסף הרשאות לפרויקט",
+        "PERMISSIONADD_PROJECTS": "הוסף משתמשים לפרויקט",
         "ALL_USERS": "כל המשתמשים",
         "SELECTED_USERS": "משתמשים נבחרים",
         "DIALOGFLOW": "ערוך פריט Dialogflow",
         "UNIQUEID": "מזהה ייחודי",
         "PHONE": "טלפון",
         "EXTEN": "שלוחה",
-        "AUDIO": "אודיו",
+        "AUDIO": "שמע",
         "CREATED_AT": "נוצר ב-",
         "NOTES": "רשימות",
         "NEW_PROJECT": "פרויקט חדש",
         "EDIT": "ערוך",
         "LABEL": "תווית",
         "ANSWER": "תשובה",
-        "TIMEOUT": "זמן קצוב",
+        "TIMEOUT": "סוף זמן קצוב",
         "SIP_ID": "SIP",
         "OPTS": "אפשרויות",
         "URL": "כתובת URL",
@@ -72,8 +72,8 @@
         "DIAL": "חייג",
         "EXT_DIAL": "חיוג חיצוני",
         "QUEUE": "תור",
-        "QUEUE_ID": " מזהה תור",
-        "FILE_ID": "מזהה קובץ",
+        "QUEUE_ID": "תור",
+        "FILE_ID": "שמע",
         "AGI": "AGI",
         "MACRO": "מאקרו",
         "GOSUB": "GoSub",
         "MAILBOX": "תיבת דואר",
         "OPTIONS": "אפשרויות",
         "SET": "קבוע",
-        "VARIABLE_ID": "זיהוי משתנה",
-        "VARIABLE_VALUE": "ערך משתנה",
+        "VARIABLE_ID": " משתנה",
+        "VARIABLE_VALUE": "ערך ",
         "MATH": "מתמטי",
         "OPERATION": "פעולה",
         "PLAYBACK": "השמעה",
-        "RESPONSE": "לתשובה",
-        "DIGIT": "ספרות",
+        "RESPONSE": "סוף זמן קצוב לתשובה",
+        "DIGIT": "מקסימום ספרות",
         "RETRY": "ניסיונות חוזרים",
         "DIGITS": "ספרות",
         "ESCAPE_DIGITS": "ספרות ביטול",
         "SPEED": "מהירות",
         "INTKEY": "מפתח עצירה",
         "GETDIGITS": "קבל ספרות",
-        "MINDIGIT": "מינ' ספרות",
-        "MAXDIGIT": "מקס' ספרות",
+        "MINDIGIT": "מינימום ספרות",
+        "MAXDIGIT": "מקסימום ספרות",
         "HIDDENDIGITSNUM": "מספר ספרות מוסתרות",
         "HIDDENDIGITSPOS": "מיקום ספרות מוסתרות",
-        "GETSECRETDIGITS": "קבל ספרות סודיות",
-        "RECORD": "הקלט",
+        "GETSECRETDIGITS": "קבל קוד סודי",
+        "RECORD": "רשומה",
         "FILE": "שם קובץ",
         "RECORDINGFORMAT": "תבנית הקלטה",
         "DATABASE": "מסד נתונים",
         "ODBC_ID": "חיבור ODBC",
         "QUERY": "שאילתה",
-        "MODEL": "מודל",
+        "MODEL": "סוג",
         "ISPEECH_ASR_LANGUAGE": "שפה",
         "BEEP": "צפצוף",
         "ISPEECHASR": "iSpeech ASR",
         "TO": "אל",
         "SMS_TEXT": "טקסט",
         "SENDMAIL": "שלח הודעת דוא\"ל",
-        "TEMPLATE_ID": "מזהה תבנית",
+        "TEMPLATE_ID": "תבנית",
         "CC": "עותק",
         "BCC": "עותק עיוור",
         "SUBJECT": "נושא",
         "COMMAND": "פקודה",
         "ARGS": "ארגומנטים",
         "SUBPROJECT": "פרויקט משני",
-        "PROJECT_ID": "מזההפרויקט",
+        "PROJECT_ID": "פרויקט",
         "CUSTOM_APP": "יישום מותאם אישית",
         "APPLICATION": "יישום",
         "CALLBACK": "החזרת שיחה",
         "LASTNAME": "שם משפחה",
-        "LIST_ID": "מזהה רשימה",
+        "LIST_ID": "רשימה",
         "DELAY": "השהיה [דק']",
         "OPEN_NEW_WINDOW": "פתח בחלון חדש",
         "OPEN_PROJECT": "פתח פרויקט",
         "EDIT_XML": "ערוך XML",
         "IMPORT_XML": "יבא XML",
         "IMPORT": "יבא",
-        "DROP_TO_UPLOAD": "שחרר כדי להעלות",
-        "DROP_TO_UPLOAD_MESSAGE": "אפשר גם לשחרר קבצים כאן כדי להעלות אותם. XML בלבד – מקס' 5MB",
+        "DROP_TO_UPLOAD": "גרור כדי להעלות",
+        "DROP_TO_UPLOAD_MESSAGE": "אפשר גם לגרור קבצים לכאן כדי להעלות אותם. XML בלבד – מקס' 5MB",
         "CLOSE": "סגור",
-        "NO_AVAILABLE_INFO": "אין פרטים",
+        "NO_AVAILABLE_INFO": "אין פרטים זמינים",
         "GO_TO_PROJECTS": "עבור לפרויקטים",
         "UPDATE_INFO": "עדכן פרטים",
         "AGENTS": "נציגים",
             "BCC": "ניתן להוסיף מספר כתובות ולהפריד ביניהן בפסיקים (לדוגמה, john.doe@xcally.com, jane.miller@xcally.com)"
         },
         "CHOOSE_ATTACHMENT": "בחר קובץ מצורף",
-        "ATTACHMENT_NAME": "שם קובץ מצורף",
-        "ATTACHMENT_TYPE": "סוג קובץ מצורף",
-        "ATTACHMENT_PATH": "הנתיב אל הקובץ המצורף",
+        "ATTACHMENT_NAME": "שם הקובץ המצורף",
+        "ATTACHMENT_TYPE": "סוג הקובץ המצורף",
+        "ATTACHMENT_PATH": "נתיב הקובץ המצורף",
         "SENDFAX": "שלח פקס",
         "DELETE_SQUARERECORDING": "מחק הקלטת Square",
         "DOWNLOAD_SQUARERECORDING": "הורד הקלטת Square",
         "PAGE": "דף",
         "ROWSPERPAGE": "שורות בדף",
         "OF": "מתוך",
-        "CALLBACK_PRIORITY": "עדיפות לשיחה חוזרת",
+        "CALLBACK_PRIORITY": "עדיפות",
         "GOOGLE_ASR_LANGUAGE": "שפה",
         "GOOGLEASR": "GoogleASR",
         "AWSPOLLY": "AWS Polly",
         "AWS_ACCESS_KEY_ID": "מזהה מפתח גישה",
-        "AWS_SECRET_ACCESS_KEY": "מפתח גישה סודי",
+        "AWS_SECRET_ACCESS_KEY": "צופן מפתח הגישה",
         "AWS_POLLY_REGION": "אזור",
         "AWS_POLLY_VOICE": "קול",
         "LUMENVOXTTS": "טקסט-לדיבור של Lumenvox",
         "GRAMMAR": "דקדוק",
         "TILDEASR": "Tilde ASR",
         "APPID": "מזהה יישום",
-        "APPSECRET": "סוד של יישום",
+        "APPSECRET": "צופן היישום",
         "NDASSISTANT_URL": "כתובת נסתרת",
         "NDAUTH_URL": "כתובת אתר של NDAUTH",
         "PASSWORD": "סיסמה",
index 03311f9..268c234 100644 (file)
@@ -3,13 +3,13 @@
         "EDIT_AMAZONLEX": "ערוך את Amazon Lex",
         "AMAZONLEX": "Amazon Lex",
         "ACCESSKEYID": "מזהה מפתח גישה",
-        "SECRETACCESSKEY": "מפתח גישה סודי",
+        "SECRETACCESSKEY": "קוד סודי",
         "LEXREGION": "אזור",
         "BOTNAME": "שם הבוט",
         "LOGIN_TIME": "שעת כניסה",
         "PAUSE_TIME": "שעת השהיה",
-        "DOWNLOAD_INTERACTION": "הורד יחסי גומלין ",
-        "ENABLECUSTOMERCHECKMARKS": "אפשר הודעות מסירה/קריאה של לקוח",
+        "DOWNLOAD_INTERACTION": "הורד ",
+        "ENABLECUSTOMERCHECKMARKS": "אפשר ללקוח לקבל הודעות מסירה/קריאה",
         "TRANSFER": "העבר",
         "QUEUETRANSFER": "העברת תור",
         "QUEUETRANSFERTIMEOUT": "סוף זמן קצוב להעברת תור",
         "RIGHT": "ימין",
         "LEFT": "שמאל",
         "WAITFORTHEASSIGNEDAGENT": "המתן לנציג שהוקצה",
-        "AGENTIDENTIFIER": "מזהה נציג",
+        "AGENTIDENTIFIER": "מזהה",
         "WEBSITEALIAS": "כינוי אתר האינטרנט",
         "AGENTALIAS": "כינוי הנציג",
         "AGENTFULLNAME": "שם מלא של הנציג",
         "INSERT_MESSAGE_HERE": "הוסף כאן את הודעת הטקסט",
         "HIDEWHENOFFLINE": "הסתר",
         "NOTIFICATION": "הודעה",
-        "NOTIFICATIONSOUND": "צליל הודעה",
-        "NOTIFICATIONSHAKE": "הודעת לחיצה",
-        "NOTIFICATIONTEMPLATE": "תבנית הודעה",
+        "NOTIFICATIONSOUND": "צליל",
+        "NOTIFICATIONSHAKE": "לחיצה",
+        "NOTIFICATIONTEMPLATE": "תבנית",
         "SYSTEM": "מערכת",
         "EDIT_SYSTEM": "ערוך מערכת",
         "COMMAND": "פקודה",
         "ADD_CHATCANNEDANSWER": "הוסף תשובה מוכנה",
         "EDIT_CHATCANNEDANSWER": "ערוך",
         "DELETE_CHATCANNEDANSWER": "מחק",
-        "OFFLINEMESSAGESUBJECT": "נושא הודעה לא מקוונת",
-        "OFFLINEMESSAGEBODY": "גוף הודעה לא מקוונת",
+        "OFFLINEMESSAGESUBJECT": "נושא ההודעה ",
+        "OFFLINEMESSAGEBODY": "גוף ההודעה",
         "FORMSUBMITSUCCESSMESSAGE": "הודעת הצלחה במשלוח טופס",
         "FORMSUBMITFAILUREMESSAGE": "הודעת כישלון במשלוח טופס",
         "PLACEHOLDERMESSAGE": "שומר מקום של הודעה",
-        "NOTETITLE": "כותרת פתק/הערה",
+        "NOTETITLE": "כותרת הערה",
         "CLOSINGQUESTION": "שאלת סגירה",
         "TAGS": "תגים",
         "SHOWAGENTAVATAR": "הצג דמות נציג אישי",
         "AGENTAVATAR": "דמות הנציג",
         "SPYINTERACTION": "רגל",
         "NO_AGENT_ONLINE": "אין נציג מקוון",
-        "GOTOREALTIME_CHATQUEUE": "עבור אל תור צ'אט ",
+        "GOTOREALTIME_CHATQUEUE": "עבור אל תור צ'אט Realtime",
         "PARTIALPAUSE": "השהיה חלקית",
         "BUSY": "תפוס",
         "TIMER": "טיימר",
         "OPENCHANNEL": "ערוץ פתוח",
         "FAX": "פקס",
         "PAUSE": "השהה",
-        "REALTIME": "זמן אמת",
+        "REALTIME": "Realtime",
         "AGENTS": "נציגים",
         "FULLNAME": "שם מלא",
-        "INTERNAL": "פנימי",
+        "INTERNAL": "מרוו זמן",
         "PHONE_STATE": "מצב הטלפון",
         "PHONE_STATUS": "סטטוס הטלפון",
         "LOGOUT": "יציאה",
         "UNPAUSE": "סיים השהיה",
         "AGENTADD_QUEUE": "הוסף נציג לתור הצ'אט",
         "TEXT": "טקסט",
-        "TIMES": "זמנים",
+        "TIMES": "מספר הפעמים בכל אינטראקציה",
         "EDIT_AUTOREPLY": "ערוך תשובה אוטומטית",
         "AUTOREPLY": "תשובה אוטומטית",
         "NEW_CHATDISPOSITION": "פריסת צ'אט חדשה",
-        "ENABLECUSTOMERATTACHMENT": "אפשר קבצים מצורפים של לקוחות",
+        "ENABLECUSTOMERATTACHMENT": "אפשר ללקוח לצרף קבצים",
         "OFFLINE_CHAT_BUTTON": "לחצן צ'אט לא מקוון",
-        "OFFLINESTATUS": "מצב חיבור לא מקוון",
+        "OFFLINESTATUS": "סטטוס לא מקוון",
         "NAME": "שם",
         "CHATQUEUES": "תורי צ'אט",
         "SEARCH_FOR_ANYONE": "חיפוש",
         "FORWARDTRANSCRIPTMESSAGE": "הודעת 'העבר תעתיק'",
         "SKIPMESSAGEBUTTON": "לחצן 'דלג על הודעה'",
         "EDIT_MESSAGE": "ערוך הודעה",
-        "CONDITION_AGREEMENT": "הסכמה על תנאים",
+        "CONDITION_AGREEMENT": "הסכם התנאים",
         "NONE": "ללא",
         "PRIORITY": "עדיפות",
-        "ONLINESTATUS": "סטטוס חיבור לאינטרנט",
-        "UNMANAGEDSTATUS": "סטטוס 'לא מנוהלות'",
-        "AUTOCLOSE": "סגירה אוטומטית",
+        "ONLINESTATUS": "סטטוס מקוון",
+        "UNMANAGEDSTATUS": "סטטוס 'לא מנוהל'",
+        "AUTOCLOSE": "אפשר סגירה אוטומטית",
         "ENABLEUNMANAGEDNOTE": "אפשר הערה לא מנוהלת",
-        "UNMANAGEDMESSAGE": "הודעה לא מנוהלת",
-        "SKIPUNMANAGED": "דילוג לא מנוהל",
-        "SENDUNMANAGED": "שליחה לא מנוהלת",
-        "WEBSITESCRIPT": "סקריפט של אתר אינטרנט",
-        "DELETE_OFFLINEMESSAGE": "מחק הודעה לא מקוונת",
+        "UNMANAGEDMESSAGE": "הודעה",
+        "SKIPUNMANAGED": "דלג על הועה",
+        "SENDUNMANAGED": "שלח הודעה",
+        "WEBSITESCRIPT": "סקריפט של אתר האינטרנט",
+        "DELETE_OFFLINEMESSAGE": "מחק",
         "OFFLINEMESSAGES": "הודעות לא מקוונות",
-        "FORWARD_OFFLINE": "העבר פריט לא מקוון",
-        "SHOW_OFFLINEMESSAGE": "הצג הודעה לא מקוונת",
+        "FORWARD_OFFLINE": "העברה למצב לא מקוון",
+        "SHOW_OFFLINEMESSAGE": "הצג",
         "FORWARD_OFFLINE_ADDRESS": "העבר כתובת לא מקוונת",
         "CLOSINGFORM": "טופס סגירה",
         "ENABLERATING": "אפשר דירוג",
-        "ENABLECUSTOMERWRITING": "אפשר ללקוח לכתוב",
+        "ENABLECUSTOMERWRITING": "אפשר ללקוח לקרוא לפני קבלה על ידי הנציג",
         "ENABLEFEEDBACK": "אפשר משוב",
         "RATINGTYPE": "סוג דירוג",
         "CLOSINGMESSAGE": "הודעת סגירה",
         "RATINGSTARSNUMBER": "מספר דירוג בכוכבים",
         "EDIT_GOTOIF": "ערוך פריט GotoIf",
         "CONDITION": "תנאי",
-        "TRUEPRIORITY": "עדיפות TRUE",
-        "FALSEPRIORITY": "עדיפות FALSE",
+        "TRUEPRIORITY": "עדיפות חיובי",
+        "FALSEPRIORITY": "עדיפות שלילי",
         "VALUE": "ערך",
         "ERRORS": {
             "BOTNAME_REQUIRED": "שדה חובה",
             "MANDATORYDISPOSITIONPAUSEID_REQUIRED": "שדה חובה"
         },
         "CM_FIELD": "שדה 'מנהל אנשי הקשר'",
-        "CHATPROACTIVEACTIONS": "פעולות צ'אט יזומות",
-        "NEW_CHATPROACTIVEACTION": "פעולת צ'אט יזומה חדשה",
-        "EDIT_CHATPROACTIVEACTION": "ערוך פעולת צ'אט יזומה",
-        "DELETE_CHATPROACTIVEACTION": "מחק פעולת צ'אט יזומה",
-        "ADD_CHATPROACTIVEACTION": "הוסף פעולת צ'אט יזומה",
-        "NO_CHATPROACTIVEACTION_AVAILABLE": "אין פעולות צ'אט יזומות זמינות",
+        "CHATPROACTIVEACTIONS": "פעולות יזומות",
+        "NEW_CHATPROACTIVEACTION": "פעולה יזומה חדשה",
+        "EDIT_CHATPROACTIVEACTION": "ערוך פעולה יזומה",
+        "DELETE_CHATPROACTIVEACTION": "מחק פעולה יזומה",
+        "ADD_CHATPROACTIVEACTION": "הוסף פעולה יזומה",
+        "NO_CHATPROACTIVEACTION_AVAILABLE": "אין פעולות יזומות זמינות",
         "NO_OFFLINEMESSAGE_AVAILABLE": "אין הודעות לא מקוונות זמינות",
         "MOUSEOVER": "מעבר מעל עם העכבר",
         "TIMEOUT": "זמן קצוב",
         "LIST": "רשימה",
         "SNIPPET": "גזיר",
         "FORMS": "טפסים",
-        "UP": "מעלה",
-        "DOWN": "מטה",
+        "UP": "למעלה",
+        "DOWN": "למטה",
         "COLLAPSE": "כווץ",
         "PROACTIVEACTIONS": "פעולות יזומות",
         "DISPOSITIONS": "פריסות",
         "LABELS": "תוויות",
         "HEADER_ONLINE": "כותרת עליונה מקוונת",
         "ONLINE_MESSAGE": "הודעה מקוונת",
-        "NAME_TITLE": "כותרת",
+        "NAME_TITLE": "שם הכותרת",
         "USERNAME_PLACEHOLDER": "שומר מקום של שם המשתמש",
         "EMAIL_TITLE": "כותרת דוא\"ל",
         "EMAIL_PLACEHOLDER": "שומר מקום של קלט דוא\"ל",
         "ACCEPTMETHOD": "שיטת קבלה",
         "ACCEPTURL": "קבל כתובת URL",
         "REJECT": "דחה",
-        "REJECTMETHOD": "שיטת דחייה",
+        "REJECTMETHOD": "דחה את השיטה",
         "REJECTURL": "דחה כתובת URL",
         "CLOSE": "סגור",
         "CLOSEMETHOD": "שיטת סגירה",
         "CLOSEURL": "סגור כתובת URL",
-        "EMBEDDING": "מוטב",
+        "EMBEDDING": "מוטמע",
         "GENERAL": "כללי",
         "SELECTED": "נבחר/ו",
         "SELECT_ALL": "בחר הכול",
             "ENABLERATING": "הפעל פריט זה כדי לאפשר לגולש לדרג את האינטראקציה בסופה",
             "ENABLEFEEDBACK": "הפעל פריט זה כדי לאפשר לגולש לשלוח משוב (עד 150 תווים) בסיום האינטראקציה",
             "FORWARDTRANSCRIPT": "הפעל פריט זה כדי לאפשר לגולש לקבל בדוא\"ל תעתיק של הצ'אט",
-            "AUTOCLOSE": "הפעל פריט זה כדי לסגור הפעלות צ'אט במצב לא מנוהל כאשר אין נציג זמין. פרטים נוספים בנושא זה: https://wiki.xcallymotion.com/display/XMV/Chat+Websites#ChatWebsites-Snippet",
+            "AUTOCLOSE": "הפעל פריט זה כדי לסגור הפעלות צ'אט כמצב לא מנוהל כאשר אין נציג זמין. פרטים נוספים בנושא זה: https://wiki.xcallymotion.com/display/XMV/Chat+Websites#ChatWebsites-Snippet",
             "ENABLEUNMANAGEDNOTE": "הפעל פריט זה כדי להציג בפני הגולש הודעה כאשר כל הנציגים תפוסים והצ'אט במצב לא מנוהל",
             "WEBSITEALIAS": "קידומת המשמשת ליצירת שם הנציג (קידומת+מזהה נציג) כפי שהוא מוצג לגולש במהלך הפעלת הצ'אט",
             "ENABLECUSTOMERWRITING": " הפעל פריט זה כדי לאפשר לצ'אט להתחיל בלי להמתין לנציג זמין (שים לב: אם פריט זה יופעל, אף צ'אט לא יגיע למצב לא מנוהל). פרטים נוספים בנושא זה: https://wiki.xcallymotion.com/display/XMV/Chat+Websites#ChatWebsites-Snippet",
             "LIST": "רשימת 'מנהל אנשי הקשר' המשמשת לשיוך אנשי קשר",
             "INTERVAL": "בחר פריט אחד מהרשימה",
             "WELCOMEMESSAGE": "השאר ריק אם אינך מעוניין לשלוח הודעת ברכה",
-            "MANDATORYDISPOSITION": "נטייה חובה",
-            "MANDATORYDISPOSITIONPAUSEID": "השהה לשימוש אם יש נטייה לחובה"
+            "MANDATORYDISPOSITION": "סיכום",
+            "MANDATORYDISPOSITIONPAUSEID": "השהה לשימוש אם הסיכום מופעל"
         },
         "ADDRESS": "כתובת",
-        "ONLINESTATE": "סטטוס חיבור לאינטרנט",
-        "OFFLINESTATE": "סטטוס לא מקוון",
+        "ONLINESTATE": "מצב מקוון",
+        "OFFLINESTATE": "מצב לא מקוון",
         "RATINGSTATE": "מצב הדירוג",
         "ENQUIRY": "שאילתה",
         "OFFLINETEMPLATE": "תבנית לא מקוונת",
         "STARTEDAT": "החל ב-",
         "STATUS": "סטטוס",
         "CLOSED": "סגור",
-        "OPENED": "פתח",
+        "OPENED": "פתוח",
         "OPEN": "פתח",
         "ACCOUNT": "חשבון",
         "INTERACTION": "אינטראקציה",
         "CLOSEDAT": "נסגר ב-",
         "DISPOSITION": "פריסה",
         "CREATEDAT": "נוצר ב-",
-        "NOTES": "פתקים ורשימות",
+        "NOTES": "הערות",
         "NO_INTERACTION_AVAILABLE": "אין אינטראקציות זמינות",
         "SELECTED_WEBSITE": "בחר אתר אינטרנט",
         "GOTOP": "Gotop",
         "EDIT_GOTOP": "ערוך פריט Gotop",
         "SELECT_WEBSITE": "בחר אתר אינטרנט",
         "INFO": "מידע",
-        "OFFLINEMESSAGES_CHATWEBSITE": "אתר צ'אט להודעות לא מקוונות",
-        "WAITINGTITLE": "כותרת ממתין",
-        "WAITINGMESSAGE": "הודעת ממתין",
+        "OFFLINEMESSAGES_CHATWEBSITE": "גש להודעות לא מקוונות",
+        "WAITINGTITLE": "כותרת המתנה",
+        "WAITINGMESSAGE": "הודעת המתנה",
         "RATING": "דירוג",
         "NO_RATINGVALUE": "אין דירוג",
         "DEFAULT_PAUSE": "השהיית ברירת המחדל",
         "REACHABLE": "נגיש",
         "IN_USE": "בשימוש",
         "VOICE": "קול",
-        "INTERACTIONS_CHATWEBSITE": "אתר צ'אט לאינטראקציות",
+        "INTERACTIONS_CHATWEBSITE": "עבור לאינטראקציות",
         "REFRESH_INTERACTIONS": "רענן אינטראקציות",
-        "DELETE_INTERACTION": "מחק אינטראקציות",
+        "DELETE_INTERACTION": "מחק אינטראקציה",
         "AGENTADD_CHATWEBSITE": "הוסף נציג לאתר צ'אט",
         "TEAMS_ASSOCIATION": "איגוד הצוותים",
-        "MANDATORYDISPOSITION": "נטייה חובה",
-        "MANDATORYDISPOSITIONPAUSEID": "השהה לשימוש אם יש נטייה לחובה"
+        "MANDATORYDISPOSITION": "סיכום",
+        "MANDATORYDISPOSITIONPAUSEID": "השהה לשימוש אם הסיכום מופעל"
     }
 }
\ No newline at end of file
index aae426e..929eddd 100644 (file)
@@ -1,10 +1,10 @@
 {
     "CONTACTMANAGER": {
-        "SELECT_TAG": "בחר תגים",
+        "SELECT_TAG": "בחר תג",
         "CUSTOMER_JOURNEY": "מסע הלקוח",
-        "USERID": "מזהה לקוח",
+        "USERID": "השב את מזהה הנציג",
         "PRIORITY": "עדיפות",
-        "MOTIONDIALER": "Motion Bull",
+        "MOTIONDIALER": "חייגן אוטומטי",
         "IMPORT_CONTACTS": "יבא אנשי קשר",
         "PREFIX": "קידומת חיוג",
         "VOICEQUEUEID": "מזהה תור קול",
         "STATUS": "סטטוס",
         "STARTTIME": "שעת התחלה",
         "ENDTIME": "שעת סיום",
-        "MOTION_BULL": "Motion Bull",
-        "HOPPER": "משפך",
-        "FINAL": "סופי",
-        "HISTORY": "היסטוריה",
+        "MOTION_BULL": "חייגן אוטומטי",
+        "HOPPER": "משפך שיחות",
+        "FINAL": "משפך סופי",
+        "HISTORY": "הסטוריית משפך שיחות",
         "SCHEDULEDAT": "מתוזמן ל-",
         "SEARCH_FOR_ANYONE": "חיפוש",
         "EDIT_LIST": "ערוך רשימה",
-        "EDIT_HOPPER": "ערוך משפך",
+        "EDIT_HOPPER": "ערוך משפך שיחות",
         "DELETE_LIST": "מחק רשימה",
-        "DELETE_HOPPER": "מחק משפך",
+        "DELETE_HOPPER": "מחק משפך שיחות",
         "RELOAD": "טען מחדש",
         "NO_COMPANIES": "אין חברה",
         "NO_AVAILABLE_ITEMS": "אין פריטים זמינים",
             "ALIAS_REQUIRED": "שדה חובה",
             "VALUE_REQUIRED": "שדה חובה",
             "EMAIL_MUST_VALID": "תבנית שגויה",
-            "PHONEBAR_API": "ודא כי Motionbar פועל וכי מתג השלט רחוק של הנציג מופעל"
+            "PHONEBAR_API": "ודא כי החייגן האוטומטי פועל וכי מתג השלט רחוק של הנציג מופעל"
         },
         "DESCRIPTION": "תיאור",
         "DISPOSITION": "פריסה",
         "DISPOSITIONS": "פריסות",
         "VOICEDISPOSITIONS": "פריסות קול",
         "NEW_VOICEDISPOSITION": "פריסת קול חדשה",
-        "CUSTOM_FIELDS": "שדות מאופיינים אישית",
+        "CUSTOM_FIELDS": "שדות מותאמים אישית",
         "ADD_LIST": "הוסף רשימה",
         "BACK": "חזרה",
         "SELECTED": "נבחר/ו",
         "ADD_CONTACT": "הוסף איש קשר",
         "EDIT_CONTACT": "ערוך איש קשר",
         "MERGE_CONTACT": "מזג אנשי קשר",
-        "DUPLICATE_CONTACT": "כפילות באיש קשר",
+        "DUPLICATE_CONTACT": "העתק איש קשר",
         "DELETE_CONTACT": "מחק איש קשר",
         "CREATED_AT": "נוצר ב-",
         "SAVE": "שמור",
-        "DETAIL": "פרט",
+        "DETAIL": "פרטים",
         "PERSONAL_INFO": "פרטים אישיים",
         "MOBILE": "נייד",
         "FAX": "פקס",
@@ -86,7 +86,7 @@
         "ID": "מזהה",
         "SETTINGS": "הגדרות",
         "GENERAL": "כללי",
-        "CUSTOMFIELDS": "שדות חובה",
+        "CUSTOMFIELDS": "שדות מותאמים אישית",
         "NO_CUSTOMFIELD_AVAILABLE": "אין שדות מותאמים אישית זמינים",
         "ADD_TAG": "הוסף תג",
         "NO_TAG": "אין תגים",
         "POSTAL_CODE": "מיקוד",
         "SHIPMENTADDRESS": "כתובת למשלוח",
         "COPY_CONTACT": "העתק איש קשר",
-        "GOTOCONTACTS_LIST": "הצג את רשימת אנשי הקשר",
-        "GOTOCONTACTS_COMPANY": "הצג את אנשי הקשר בחברה",
+        "GOTOCONTACTS_LIST": "הצג את אנשי הקשר",
+        "GOTOCONTACTS_COMPANY": "הצג את אנשי הקשר",
         "ADD_AGENT_TO_LIST": "הוסף נציג לרשימה",
         "AGENTADD_LIST": "הוסף נציגים לרשימה",
         "NO_AVAILABLE_INFO": "אין פרטים זמינים",
         "DATEOFBIRTH": "תאריך לידה",
         "NOTES": "פתקים ורשימות",
         "EXPORTCSVCONTACTS_LIST": "ייצא את רשימת אנשי הקשר לקובץ CSV",
-        "GOTO_LIST": "הצג אנשי קשר",
-        "GOTO_COMPANY": "הצג אנשי קשר בחברה",
+        "GOTO_LIST": "הצג את אנשי הקשר",
+        "GOTO_COMPANY": "הצג את אנשי הקשר",
         "REQUIRED": "חובה",
         "GLOBALCUSTOMFIELDS": "שדות גלובליים מותאמים אישית",
-        "NEW_GLOBALCUSTOMFIELD": "שדות גלובליים חדשים מותאמים אישית ",
-        "ADD_GLOBALCUSTOMFIELD": "הוסף שדה גלובלי מותאם אישית",
-        "EDIT_GLOBALCUSTOMFIELD": "ערוך שדה גלובלי מותאם אישית",
-        "DELETE_GLOBALCUSTOMFIELD": "מחק שדה גלובלי מותאם אישית",
+        "NEW_GLOBALCUSTOMFIELD": "שדה מותאם אישי חדש ",
+        "ADD_GLOBALCUSTOMFIELD": "הוסף שדה מותאם אישית",
+        "EDIT_GLOBALCUSTOMFIELD": "ערוך שדה מותאם אישית",
+        "DELETE_GLOBALCUSTOMFIELD": "מחק שדה מותאם אישית",
         "JSCRIPTY": "Jscripty",
-        "SESSIONS": "משך זמן פעילות",
+        "SESSIONS": "משך פעילות",
         "AGENT": "נציג",
         "PROJECT": "פרויקט",
         "SELECT_LIST": "בחר רשימה",
         "SELECT_COMPANY": "בחר חברה",
-        "SELECT_TAGS": "בחר תגים",
+        "SELECT_TAGS": "בחר תג אחד או יותר",
         "HELP": {
             "PHONEBAR_API_MESSAGE": "כדי להפעיל 'לחץ כדי לחייג', הוסף מספר טלפון וודא כי מתג השלט רחוק של הנציג הועבר למצב מופעל",
             "PHONEBAR_API": "כדי להפעיל 'לחץ כדי לחייג', הוסף מספר טלפון וודא כי מתג השלט רחוק של הנציג הועבר למצב מופעל"
index 100b856..0d1fc2b 100644 (file)
         "PRIVATE": "نشر",
         "PUBLIC": "عامة",
         "PUBLIC_INTERACTION": "التفاعل عام",
-        "VISIBILITY": "رؤية"
+        "VISIBILITY": "رؤية",
+        "INTERACTION_CLOSED": "التفاعل مغلقة بشكل صحيح",
+        "INTERACTION_CLOSED_DISPOSED": "التفاعل مغلقة بشكل صحيح والتخلص منها",
+        "INTERACTION_DISPOSED": "التفاعل التخلص بشكل صحيح"
     }
 }
\ No newline at end of file
index 55dd0cf..13c3884 100644 (file)
         "PRIVATE": "Privat",
         "PUBLIC": "Offentlig",
         "PUBLIC_INTERACTION": "Samspillet er offentligt",
-        "VISIBILITY": "Sigtbarhed"
+        "VISIBILITY": "Sigtbarhed",
+        "INTERACTION_CLOSED": "Interaktion korrekt lukket",
+        "INTERACTION_CLOSED_DISPOSED": "Interaktion korrekt lukket og bortskaffet",
+        "INTERACTION_DISPOSED": "Interaktion bortskaffes korrekt"
     }
 }
\ No newline at end of file
index 7340cea..02c3e90 100644 (file)
         "PRIVATE": "Privatgelände",
         "PUBLIC": "Öffentlichkeit",
         "PUBLIC_INTERACTION": "Die Interaktion ist öffentlich",
-        "VISIBILITY": "Sichtweite"
+        "VISIBILITY": "Sichtweite",
+        "INTERACTION_CLOSED": "Interaktion ordnungsgemäß geschlossen",
+        "INTERACTION_CLOSED_DISPOSED": "Wechselwirkung ordnungsgemäß geschlossen und entsorgt",
+        "INTERACTION_DISPOSED": "Interaktion ordnungsgemäß entsorgt"
     }
 }
\ No newline at end of file
index c6dfc8d..89bc77f 100644 (file)
         "CALL_NUMBER": "Call",
         "TRANSFER_NUMBER": "Transfer",
         "CALL_SAVED": "Call properly saved",
-        "CALL_DISPOSED": "Call properly disposed"
+        "CALL_DISPOSED": "Call properly disposed",
+        "INTERACTION_CLOSED": "Interaction properly closed",
+        "INTERACTION_DISPOSED": "Interaction properly disposed",
+        "INTERACTION_CLOSED_DISPOSED": "Interaction properly closed and disposed"
     }
 }
\ No newline at end of file
index bdec01b..264f4be 100644 (file)
         "PRIVATE": "Privado",
         "PUBLIC": "Público",
         "PUBLIC_INTERACTION": "La interacción es pública.",
-        "VISIBILITY": "Visibilidad"
+        "VISIBILITY": "Visibilidad",
+        "INTERACTION_CLOSED": "Interacción correctamente cerrada",
+        "INTERACTION_CLOSED_DISPOSED": "Interacción debidamente cerrada y desechada",
+        "INTERACTION_DISPOSED": "Interacción adecuadamente eliminada"
     }
 }
\ No newline at end of file
index fc086fe..86b253e 100644 (file)
         "PRIVATE": "خصوصی",
         "PUBLIC": "عمومی",
         "PUBLIC_INTERACTION": "تعامل عمومی است",
-        "VISIBILITY": "دید"
+        "VISIBILITY": "دید",
+        "INTERACTION_CLOSED": "تعامل به درستی بسته شد",
+        "INTERACTION_CLOSED_DISPOSED": "تعامل به درستی بسته و دفع شده است",
+        "INTERACTION_DISPOSED": "تعامل به درستی دفع می شود"
     }
 }
\ No newline at end of file
index af9f5da..ce14bf9 100644 (file)
         "PRIVATE": "yksityinen",
         "PUBLIC": "Julkinen",
         "PUBLIC_INTERACTION": "Vuorovaikutus on julkinen",
-        "VISIBILITY": "näkyvyys"
+        "VISIBILITY": "näkyvyys",
+        "INTERACTION_CLOSED": "Vuorovaikutus on kunnolla kiinni",
+        "INTERACTION_CLOSED_DISPOSED": "Vuorovaikutus on kunnolla kiinni ja hävitetty",
+        "INTERACTION_DISPOSED": "Vuorovaikutus on järjestetty oikein"
     }
 }
\ No newline at end of file
index e7a5d10..10d1637 100644 (file)
         "PRIVATE": "Privé",
         "PUBLIC": "Publique",
         "PUBLIC_INTERACTION": "L'interaction est publique",
-        "VISIBILITY": "Visibilité"
+        "VISIBILITY": "Visibilité",
+        "INTERACTION_CLOSED": "Interaction correctement fermée",
+        "INTERACTION_CLOSED_DISPOSED": "Interaction correctement fermée et éliminée",
+        "INTERACTION_DISPOSED": "Interaction correctement éliminée"
     }
 }
\ No newline at end of file
index 0c11992..d5da150 100644 (file)
@@ -2,42 +2,42 @@
     "DASHBOARDS": {
         "DOWNLOAD": "הורד",
         "UNMANAGED_RATE": "שיעור לא מנוהל",
-        "UNMANAGED_RATE_TEXT": "תמליל שיעור לא מנוהל",
-        "VOICE_WAITING": "שיחות ממתינות",
-        "VOICE_WAITING_TEXT": "תמליל שיחות ממתינות ",
-        "VOICE_TALKING": "דיבור בשיחות",
-        "VOICE_TALKING_TEXT": "תמליל דיבור בשיחות",
-        "VOICE_ANSWERED": "שיחות שנענו",
-        "VOICE_ANSWERED_TEXT": "תמליל שיחות שנענו",
-        "VOICE_ABANDONED": "שיחות שננטשו",
-        "VOICE_ABANDONED_TEXT": "תמליל שיחות שננטשו",
-        "VOICE_TOTAL_OFFERED": "סה\"כ שיחות שהוצעו",
-        "VOICE_TOTAL_OFFERED_TEXT": "תמליל סה\"כ שיחות שהוצעו",
-        "TODAY_INTERACTIONS_STATS": "סטטיסטיקות של אינטראקציות מהיום",
-        "VOICE_AVG_HOLD_TIME": "זמן המתנה ממוצע בשיחה",
-        "VOICE_AVG_HOLD_TIME_TEXT": "תמליל זמן המתנה ממוצע בשיחה",
+        "UNMANAGED_RATE_TEXT": "שיעור אינטראקציות לא מנוהלות",
+        "VOICE_WAITING": "ממתין",
+        "VOICE_WAITING_TEXT": "תור שיחות ממתינות ",
+        "VOICE_TALKING": "דיבור",
+        "VOICE_TALKING_TEXT": "שיחות פעילות בתור",
+        "VOICE_ANSWERED": "נענו",
+        "VOICE_ANSWERED_TEXT": "שיחות שנענו בתור",
+        "VOICE_ABANDONED": "ננטשו",
+        "VOICE_ABANDONED_TEXT": "שיחות שננטשו בתור",
+        "VOICE_TOTAL_OFFERED": "סה\"כ שהוצעו",
+        "VOICE_TOTAL_OFFERED_TEXT": "סה\"כ שיחות בתור",
+        "TODAY_INTERACTIONS_STATS": "סטטיסטיקה יומית של אינטראקציות",
+        "VOICE_AVG_HOLD_TIME": "זמן המתנה ממוצע",
+        "VOICE_AVG_HOLD_TIME_TEXT": "זמן המתנה ממוצע של שיחות בתור",
         "VOICE_AVG_TALK_TIME": "זמן שיחה ממוצע ",
-        "VOICE_AVG_TALK_TIME_TEXT": "תמליל זמן שיחה ממוצע",
-        "VOICE_ANSWER_RATE": "שיעור מענה בשיחה",
-        "VOICE_ANSWER_RATE_TEXT": "תמליל שיעור מענה בשיחה",
-        "VOICE_ABANDON_RATE": "שיעור נטישה בשיחה",
-        "VOICE_ABANDON_RATE_TEXT": "תמליל שיעור נטישה בשיחה",
-        "VOICE_UNMANAGED": "שיחה לא מנוהלת",
-        "VOICE_UNMANAGED_TEXT": "תמליל שיחה לא מנוהלת",
-        "OPENED_TEXT": "תמליל נפתח",
+        "VOICE_AVG_TALK_TIME_TEXT": "זמן שיחה של שיחות בתור",
+        "VOICE_ANSWER_RATE": "שיעור מענה",
+        "VOICE_ANSWER_RATE_TEXT": "שיעור מענה של שיחות בתור",
+        "VOICE_ABANDON_RATE": "שיעור נטישה",
+        "VOICE_ABANDON_RATE_TEXT": "שיעור נטישה בתור",
+        "VOICE_UNMANAGED": "לא מנוהל",
+        "VOICE_UNMANAGED_TEXT": "תור שיחות לא מנוהלות",
+        "OPENED_TEXT": "אינטראקציה פתוחה",
         "MANAGED": "מנוהל",
-        "MANAGED_TEXT": "תמליל מנוהל",
+        "MANAGED_TEXT": "אינטראקציות מנוהלות",
         "ABANDONED": "ננטש",
-        "ABANDONED_TEXT": "תמליל ננטש",
+        "ABANDONED_TEXT": "אינטראקציית נטישה",
         "ABANDONED_RATE": "שיעור נטישה",
-        "ABANDONED_RATE_TEXT": "תמליל שיעור נטישה",
+        "ABANDONED_RATE_TEXT": "שיעור אינטראקציית נטישה",
         "TOTAL_OFFERED": "סה\"כ הוצעו",
-        "TOTAL_OFFERED_TEXT": "תמליל סה\"כ הוצעו ",
-        "AVG_HOLD_TIME_TEXT": "תמליל ממוצע זמן המתנה",
-        "MANAGED_RATE": "שיעור אינטראקציות מנוהלות",
-        "MANAGED_RATE_TEXT": "תמליל שיעור אינטראקציות מנוהלות",
+        "TOTAL_OFFERED_TEXT": "אינטראקציות שהוצעו ",
+        "AVG_HOLD_TIME_TEXT": "אינטראקצית זמן המתנה ממוצע",
+        "MANAGED_RATE": "שיעור ניהול",
+        "MANAGED_RATE_TEXT": "שיעור אינטראקציות מנוהלות",
         "AVG_MANAGED_TIME": "ממוצע זמן ניהול",
-        "AVG_MANAGED_TIME_TEXT": "תמליל ממוצע זמן ניהול",
+        "AVG_MANAGED_TIME_TEXT": "אינטראקצית זמן ניהול ממוצע",
         "NO_DISPOSITION_SET": "לא הוגדרה פריסה",
         "AGENTS": "נציגים",
         "TRANSFER": "העבר",
         "ME": "אני",
         "CURRENTLY_IN_USE_BY": "כרגע בשימוש של",
         "NOTAVAILABLE": "לא זמין",
-        "CLICKRELOAD": " טען מחדש",
+        "CLICKRELOAD": "שיחות ננטשות חדשות! טען בבקשה",
         "ASSIGNTO": "הקצה ל-",
         "SELECT_CAMPAIGN": "בחר תור",
         "FREE": "במצב פנוי",
         "RESERVED": "שמור",
-        "QUEUECALLEREXITREASON": "סיבת יציאת המתקשר מהתור",
-        "QUEUECALLEREXITAT": "המתקשר יצא מהתור ב-",
+        "QUEUECALLEREXITREASON": "סיבה",
+        "QUEUECALLEREXITAT": "נותק",
         "LASTASSIGNEDTO": "הקצאה אחרונה ל-",
-        "ABANDONEDQUEUECALLS": "שיחות בתור שננטשו",
+        "ABANDONEDQUEUECALLS": "שיחות שננטשו בתור",
         "ABANDONAT": "ננטש",
         "QUEUE": "תור",
         "SELECT_SUBSTATUS": "בחר סטטוס משני",
         "SELECT_READ_UNREAD": "בחר נקרא/לא נקרא",
         "SELECT_AGENT": "בחר נציג",
         "MARK_AS_UNREAD": "סמן כ'לא נקרא'",
-        "FILTER_VOICE_QUEUES": "סנן תורי קול",
-        "CHANNEL_WAITING_TEXT": "תמליל המתנה בערוץ",
-        "CHANNEL_QUEUE": "תור בערוץ",
-        "CHANNEL_FROM": "ערוץ מ",
-        "LOADING_INTERACTION": "אינטראקציה בטעינה...",
+        "FILTER_VOICE_QUEUES": "סנן תורי שיחות",
+        "CHANNEL_WAITING_TEXT": "אינטראקיית המתנה בתור",
+        "CHANNEL_QUEUE": "תור",
+        "CHANNEL_FROM": "מ",
+        "LOADING_INTERACTION": "אנו טוענים את האינטראקציה...",
         "JANUARY": "ינואר",
         "FEBRUARY": "פברואר",
         "MARCH": "מרץ",
         "DELETE": "מחק",
         "LAST_3_DAYS": "שלושה ימים אחרונים",
         "LAST_YEAR": "שנה שעברה",
-        "THIS_YEAR": "שנה נוכחית",
+        "THIS_YEAR": "השנה הנוכחית",
         "LAST_MONTH": "החודש שעבר",
         "THIS_MONTH": "החודש הנוכחי",
         "LAST_WEEK": "שבוע שעבר",
         "THIS_WEEK": "השבוע הנוכחי",
         "YESTERDAY": "אתמול",
         "TODAY": "היום",
-        "SELECT_DATE": "בחר תאריך ",
+        "SELECT_DATE": "בחר תאריך התחלה",
         "HOME": "בית",
         "SET_AS": "הגדר כ-",
         "PENDING": "בהמתנה",
         "CANNED_ANSWER_NOT_FOUND": "לא נמצאו תשובות מוכנות",
-        "CANNED_ANSWER_SEARCH": "חפש תשובה מוכנה",
+        "CANNED_ANSWER_SEARCH": "הכנס טקטס לחיפוש תשובה מוכנה",
         "TAGS": "תגים",
         "SELECT_TAG": "בחר תג",
         "TYPE": "סוג",
         "RECALLME": "בצע חיוג חוזר אליי",
         "DROP_RATE": "שיעור ניתוקים",
         "DROPPED": "נותק",
-        "DROPPED_TEXT": "תמליל שיחות שנותקו",
-        "DETAIL": "פרט",
-        "MOTION_BULL": "Motion Bull",
+        "DROPPED_TEXT": "שיחות מהתור שנותקו",
+        "DETAIL": "פרטים",
+        "MOTION_BULL": "חייגן אוטומטי",
         "LIMITED": "מוגבל",
-        "LIMITED_TEXT": "תמלול מוגבל",
+        "LIMITED_TEXT": "שיחות שיזמו מבצעי IVR/גבול",
         "DASHBOARDS": "לוחות מחוונים",
         "RECORDINGS": "הקלטות",
-        "TODAY_MOTION_BULL_STATS": "סטטיסטיקות יומיות על מבצעי תורים",
+        "TODAY_MOTION_BULL_STATS": "סטטיסטיקה יומית של מבצעי תורים",
         "ORIGINATED": "מקור",
-        "ORIGINATED_TEXT": "תמלול מקור",
+        "ORIGINATED_TEXT": "תור שיחות במקור",
         "UPDATE": "עדכן",
         "MORE": "עוד",
-        "MOTIONDIALER": "Motion Bull",
-        "DISPOSE": "בצע פריסה",
+        "MOTIONDIALER": "חייגן אוטומטי",
+        "DISPOSE": "פרוס",
         "QUEUES": "תורים",
-        "DIALER_CALL": "שיחת חייגן",
+        "DIALER_CALL": "שיחה אוטומטית",
         "ELAPSED_TIME": "משך הזמן שעבר",
         "EDIT": "ערוך",
         "MERGE": "מזג",
         "CUSTOM_FIELDS": "שדות מותאמים אישית",
         "GENERAL": "כללי",
         "VOICE": "קול",
-        "TODAY_IVR_CAMPAIGNS_STATS": "סטטיסטיקות מבצעי מהיום IVR",
-        "TODAY_INBOUND_STATS": "סטטיסטיקות שיחות נכנסות מהיום",
-        "TODAY_OUTBOUND_STATS": "סטטיסטיקות שיחות יוצאות מהיום",
-        "WAITING": "בהמתנה",
-        "TALKING": "משוחח",
-        "INBOUND_ANSWERED": "שיחות נכנסות שנענו",
-        "OUTBOUND_ANSWERED": "שיחות יוצאות שנענו",
+        "TODAY_IVR_CAMPAIGNS_STATS": "סטטיסטיקה יומית של מבצעי IVR",
+        "TODAY_INBOUND_STATS": "סטטיסטיקה יומית של תור נכנס",
+        "TODAY_OUTBOUND_STATS": "סטטיסטיקה יומית של שיחות יוצאות",
+        "WAITING": "ממתין",
+        "TALKING": "מדבר",
+        "INBOUND_ANSWERED": "נענו",
+        "OUTBOUND_ANSWERED": "נענו",
         "AVG_HOLD_TIME": "ממוצע זמן המתנה",
-        "INBOUND_ANSWER_RATE": "שיעור שיחות נכנסות שנענו ",
-        "OUTBOUND_ANSWER_RATE": "שיעור שיחות יוצאות שנענו",
+        "INBOUND_ANSWER_RATE": "שיעור השיחות שנענו ",
+        "OUTBOUND_ANSWER_RATE": "שיעור מענה",
         "ABANDON_RATE": "שיעור נטישה",
-        "UNMANAGED": "לא מנוהלות",
+        "UNMANAGED": "לא מנוהל",
         "TOTAL": "סה\"כ",
-        "TOT_DURATION": "משך כולל",
+        "TOT_DURATION": "סה\"כ משך",
         "AVG_DURATION": "משך ממוצע",
         "HELP": {
             "UNMANAGED_RATE": "השיעור הכולל של אינטראקציות לא מנוהלות",
         },
         "NO_AVAILABLE_INFO": "אין פרטים זמינים",
         "WELCOME_TO_MOTION": "ברוך הבא אל Motion",
-        "WELCOME_MESSAGE": "הודעת ברוך הבא",
+        "WELCOME_MESSAGE": "השתמש במסגרת השמאלית כדי לנווט בחלקים הזמינים",
         "ADD": "הוסף",
         "CONTACTMANAGER": "מנהל אנשי הקשר",
         "DASHBOARD": "לוח מחוונים",
         "MYCONTACTS": "אנשי הקשר שלי",
         "ADD_CONTACT": "הוסף איש קשר",
         "RELOAD": "טען מחדש",
-        "WAITING_TEXT": "תמליל המתנה",
-        "TALKING_TEXT": "תמליל שיחה",
-        "INBOUND_ANSWERED_TEXT": "תמליל שיחות נכנסות שנענו",
-        "DROP_RATE_TEXT": "תמלי שיעור ניתוקים",
-        "AVG_TALK_TIME_TEXT": "תמליל זמן שיחה ממוצע",
-        "INBOUND_ANSWER_RATE_TEXT": "תמליל שיעור שיחות נכנסות שנענו",
-        "UNMANAGED_TEXT": "תמליל אינטראקיות לא מנוהלות",
-        "TOTAL_TEXT": "תמליל סה\"כ",
-        "OUTBOUND_ANSWERED_TEXT": "תמליל שיחות יוצאות שנענו",
-        "TOT_DURATION_TEXT": "תמליל משך כולל של שיחות יוצאות",
-        "AVG_DURATION_TEXT": "תמליל משך ממוצע של שיחות יוצאות",
-        "OUTBOUND_ANSWER_RATE_TEXT": "תמליל שיעור מענה לשיחות יוצאות",
+        "WAITING_TEXT": "אינטראקציות המתנה",
+        "TALKING_TEXT": "תור שיחות פעילות",
+        "INBOUND_ANSWERED_TEXT": "תור השיחות שנענו",
+        "DROP_RATE_TEXT": "שיעור ניתוקים של שיחות מהתור",
+        "AVG_TALK_TIME_TEXT": "זמן דיבור של שיחות בתור",
+        "INBOUND_ANSWER_RATE_TEXT": "שיעור השיחות שנענו בתור",
+        "UNMANAGED_TEXT": "אינטראקיות לא מנוהלות",
+        "TOTAL_TEXT": "סה\"כ שיחות יוצאות",
+        "OUTBOUND_ANSWERED_TEXT": "שיחות יוצאות שנענו",
+        "TOT_DURATION_TEXT": "סה\"כ משך של שיחות יוצאות",
+        "AVG_DURATION_TEXT": "משך ממוצע של שיחות יוצאות",
+        "OUTBOUND_ANSWER_RATE_TEXT": "שיעור שיחות יוצאות שנענו",
         "PAGE": "דף",
         "ROWSPERPAGE": "שורות בדף",
         "OF": "מתוך",
-        "REPLY_PLACEHOLDER": "בצע מחדש שומר מקום",
+        "REPLY_PLACEHOLDER": "הקלד ולחץ Enter לשליחת ההודעה",
         "CONTACT_INFO": "פרטי איש הקשר",
         "CLOSE_AND_DISPOSE": "סגור ופרוס",
         "DISPOSITIONS": "פריסות",
         "CLOSED": "סגור",
         "INFO": "מידע",
         "NOTE": "פתק/הערה",
-        "ACCEPT_ELSEWHERE": "התקבלה במקום אחר",
+        "ACCEPT_ELSEWHERE": "התקבל במקום אחר",
         "ATTENTION": "לתשומת לב",
         "SOCIAL": "חברתי",
         "NO_JSCRIPTY_PROJECTS_AVAILABLE": "אין פרויקטים זמינים של Jscripty",
         "NO_SMS_ACCOUNTS_AVAILABLE": "אין חשבונות SMS זמינים",
         "SELECT_DATE_RANGE": "בחר טווח תאריכים",
         "CLEAR": "נקה",
-        "CALL_NUMBER": "מספר שיחה",
-        "TRANSFER_NUMBER": "העבר מספר",
+        "CALL_NUMBER": "שיחה",
+        "TRANSFER_NUMBER": "העבר",
         "CALL_SAVED": "השיחה נשמרה בהצלחה",
         "CALL_DISPOSED": "השיחה נפרסה בהצלחה",
         "SCHEDULED_CALLS": "שיחות מתוזמנות",
         "PRIVATE": "פרטי",
         "PUBLIC": "ציבורי",
-        "PUBLIC_INTERACTION": "אינטראקציה ציבורית",
-        "VISIBILITY": "חשיפה"
+        "PUBLIC_INTERACTION": "האינטראקציה ציבורית",
+        "VISIBILITY": "חשיפה",
+        "INTERACTION_CLOSED": "האינטראקציה נסגרה כראוי",
+        "INTERACTION_CLOSED_DISPOSED": "האינטראקציה סגורה ונכונה כראוי",
+        "INTERACTION_DISPOSED": "אינטראקציה מסולקת כראוי"
     }
 }
\ No newline at end of file
index 9b3a55f..1910cfc 100644 (file)
         "PRIVATE": "निजी",
         "PUBLIC": "जनता",
         "PUBLIC_INTERACTION": "बातचीत सार्वजनिक है",
-        "VISIBILITY": "दृश्यता"
+        "VISIBILITY": "दृश्यता",
+        "INTERACTION_CLOSED": "सहभागिता ठीक से बंद हो गई",
+        "INTERACTION_CLOSED_DISPOSED": "बातचीत ठीक से बंद और निपट गई",
+        "INTERACTION_DISPOSED": "बातचीत ठीक से निपट गई"
     }
 }
\ No newline at end of file
index 33e2617..07202c3 100644 (file)
         "PRIVATE": "Pribadi",
         "PUBLIC": "Publik",
         "PUBLIC_INTERACTION": "Interaksi bersifat publik",
-        "VISIBILITY": "Visibilitas"
+        "VISIBILITY": "Visibilitas",
+        "INTERACTION_CLOSED": "Interaksi ditutup dengan benar",
+        "INTERACTION_CLOSED_DISPOSED": "Interaksi ditutup dan dibuang dengan benar",
+        "INTERACTION_DISPOSED": "Interaksi dibuang dengan benar"
     }
 }
\ No newline at end of file
index c6efb1b..e7d5ff2 100644 (file)
         "TRANSFER_NUMBER": "Trasferisci",
         "CALL_SAVED": "Chiamata salvata correttamente",
         "CALL_DISPOSED": "Chiamata disposta correttamente",
-        "AGENTS": "Agents"
+        "AGENTS": "Agents",
+        "INTERACTION_CLOSED": "Interazione chiusa correttamente",
+        "INTERACTION_DISPOSED": "Interazione disposta correttamente",
+        "INTERACTION_CLOSED_DISPOSED": "Interazione chiusa e disposta correttamente"
     }
 }
\ No newline at end of file
index e9ce545..9c3b57a 100644 (file)
         "PRIVATE": "非公開",
         "PUBLIC": "パブリック",
         "PUBLIC_INTERACTION": "相互作用は公開されています",
-        "VISIBILITY": "視認性"
+        "VISIBILITY": "視認性",
+        "INTERACTION_CLOSED": "相互作用は適切に閉じられた",
+        "INTERACTION_CLOSED_DISPOSED": "相互作用が適切に閉じられ、破棄された",
+        "INTERACTION_DISPOSED": "相互作用が適切に処理された"
     }
 }
\ No newline at end of file
index bd60b8c..1aa7829 100644 (file)
         "PRIVATE": "은밀한",
         "PUBLIC": "공공의",
         "PUBLIC_INTERACTION": "상호 작용이 공개되었습니다.",
-        "VISIBILITY": "시계"
+        "VISIBILITY": "시계",
+        "INTERACTION_CLOSED": "상호 작용이 제대로 종료되었습니다",
+        "INTERACTION_CLOSED_DISPOSED": "상호 작용이 올바르게 닫히고 폐기 됨",
+        "INTERACTION_DISPOSED": "적절히 배치 된 상호 작용"
     }
 }
\ No newline at end of file
index 37f7de4..f057de0 100644 (file)
         "PRIVATE": "Privāts",
         "PUBLIC": "Publiska",
         "PUBLIC_INTERACTION": "Mijiedarbība ir publiska",
-        "VISIBILITY": "Redzamība"
+        "VISIBILITY": "Redzamība",
+        "INTERACTION_CLOSED": "Mijiedarbība ir pareizi slēgta",
+        "INTERACTION_CLOSED_DISPOSED": "Mijiedarbība ir pareizi noslēgta un atbrīvota",
+        "INTERACTION_DISPOSED": "Mijiedarbība ir pareizi novietota"
     }
 }
\ No newline at end of file
index c1da071..f2d047b 100644 (file)
         "PRIVATE": "Privaat",
         "PUBLIC": "Openbaar",
         "PUBLIC_INTERACTION": "De interactie is openbaar",
-        "VISIBILITY": "Zichtbaarheid"
+        "VISIBILITY": "Zichtbaarheid",
+        "INTERACTION_CLOSED": "Interactie correct gesloten",
+        "INTERACTION_CLOSED_DISPOSED": "Interactie correct gesloten en weggegooid",
+        "INTERACTION_DISPOSED": "Interactie correct verwijderd"
     }
 }
\ No newline at end of file
index 0337185..c2662dc 100644 (file)
         "PRIVATE": "Privat",
         "PUBLIC": "Offentlig",
         "PUBLIC_INTERACTION": "Samspillet er offentlig",
-        "VISIBILITY": "Synlighet"
+        "VISIBILITY": "Synlighet",
+        "INTERACTION_CLOSED": "Samspillet er ordentlig lukket",
+        "INTERACTION_CLOSED_DISPOSED": "Samspillet er lukket og kastet på riktig måte",
+        "INTERACTION_DISPOSED": "Interaksjon er riktig avhendet"
     }
 }
\ No newline at end of file
index 4fa9a00..fe5dbb3 100644 (file)
         "PRIVATE": "Prywatny",
         "PUBLIC": "Publiczny",
         "PUBLIC_INTERACTION": "Interakcja jest publiczna",
-        "VISIBILITY": "Widoczność"
+        "VISIBILITY": "Widoczność",
+        "INTERACTION_CLOSED": "Interakcja poprawnie zamknięta",
+        "INTERACTION_CLOSED_DISPOSED": "Interakcja odpowiednio zamknięta i usunięta",
+        "INTERACTION_DISPOSED": "Interakcja właściwie rozmieszczona"
     }
 }
\ No newline at end of file
index 75182cb..43cf250 100644 (file)
         "PRIVATE": "Privado",
         "PUBLIC": "Público",
         "PUBLIC_INTERACTION": "A interação é pública",
-        "VISIBILITY": "Visibilidade"
+        "VISIBILITY": "Visibilidade",
+        "INTERACTION_CLOSED": "Interação devidamente fechada",
+        "INTERACTION_CLOSED_DISPOSED": "Interação devidamente fechada e descartada",
+        "INTERACTION_DISPOSED": "Interação devidamente descartada"
     }
 }
\ No newline at end of file
index cf7601c..1ea698f 100644 (file)
         "PRIVATE": "Privado",
         "PUBLIC": "Público",
         "PUBLIC_INTERACTION": "A interação é pública",
-        "VISIBILITY": "Visibilidade"
+        "VISIBILITY": "Visibilidade",
+        "INTERACTION_CLOSED": "Interação devidamente fechada",
+        "INTERACTION_CLOSED_DISPOSED": "Interação devidamente fechada e descartada",
+        "INTERACTION_DISPOSED": "Interação devidamente descartada"
     }
 }
\ No newline at end of file
index a606a13..c6375d8 100644 (file)
         "PRIVATE": "Частный",
         "PUBLIC": "общественного",
         "PUBLIC_INTERACTION": "Взаимодействие публично",
-        "VISIBILITY": "видимость"
+        "VISIBILITY": "видимость",
+        "INTERACTION_CLOSED": "Взаимодействие правильно закрыто",
+        "INTERACTION_CLOSED_DISPOSED": "Взаимодействие правильно закрыто и расположено",
+        "INTERACTION_DISPOSED": "Взаимодействие правильно расположено"
     }
 }
\ No newline at end of file
index 35158c2..7a26b63 100644 (file)
         "PRIVATE": "Privat",
         "PUBLIC": "offentlig",
         "PUBLIC_INTERACTION": "Samspelet är offentligt",
-        "VISIBILITY": "Synlighet"
+        "VISIBILITY": "Synlighet",
+        "INTERACTION_CLOSED": "Interaktion ordentligt stängd",
+        "INTERACTION_CLOSED_DISPOSED": "Interaktion korrekt stängd och bortskaffad",
+        "INTERACTION_DISPOSED": "Interaktion korrekt bortskaffad"
     }
 }
\ No newline at end of file
index d5072db..b00669b 100644 (file)
         "PRIVATE": "Özel",
         "PUBLIC": "halka açık",
         "PUBLIC_INTERACTION": "Etkileşim halka açıktır",
-        "VISIBILITY": "görünürlük"
+        "VISIBILITY": "görünürlük",
+        "INTERACTION_CLOSED": "Etkileşim düzgün kapalı",
+        "INTERACTION_CLOSED_DISPOSED": "Etkileşim düzgün kapatıldı ve atıldı",
+        "INTERACTION_DISPOSED": "Etkileşim uygun şekilde bertaraf edildi"
     }
 }
\ No newline at end of file
index 4b5d87b..a072c2a 100644 (file)
         "PRIVATE": "私人的",
         "PUBLIC": "上市",
         "PUBLIC_INTERACTION": "互动是公开的",
-        "VISIBILITY": "能见度"
+        "VISIBILITY": "能见度",
+        "INTERACTION_CLOSED": "交互正确关闭",
+        "INTERACTION_CLOSED_DISPOSED": "交互正确关闭和处置",
+        "INTERACTION_DISPOSED": "互动妥善处置"
     }
 }
\ No newline at end of file
index 568b8e3..779d3ca 100644 (file)
         "PRIVATE": "私人的",
         "PUBLIC": "上市",
         "PUBLIC_INTERACTION": "互動是公開的",
-        "VISIBILITY": "能見度"
+        "VISIBILITY": "能見度",
+        "INTERACTION_CLOSED": "交互正確關閉",
+        "INTERACTION_CLOSED_DISPOSED": "交互正確關閉和處置",
+        "INTERACTION_DISPOSED": "互動妥善處置"
     }
 }
\ No newline at end of file
index 712d75e..2fccde4 100644 (file)
@@ -2,7 +2,7 @@
     "FAX": {
         "LOGIN_TIME": "שעת כניסה",
         "PAUSE_TIME": "שעת השהיה",
-        "DOWNLOAD_INTERACTION": "הורד אינטראקציה",
+        "DOWNLOAD_INTERACTION": "הורד",
         "TRANSFER": "העבר",
         "QUEUETRANSFER": "העברת תור",
         "QUEUETRANSFERTIMEOUT": "סוף זמן קצוב להעברת תור",
         "EDIT_TAG": "ערוך תג",
         "WAITFORTHEASSIGNEDAGENT": "המתן לנציג שהוקצה",
         "NOTIFICATION": "הודעה",
-        "NOTIFICATIONSOUND": "צליל הודעה",
-        "NOTIFICATIONSHAKE": "הודעת לחיצה",
-        "NOTIFICATIONTEMPLATE": "תבנית הודעה",
+        "NOTIFICATIONSOUND": "צליל",
+        "NOTIFICATIONSHAKE": "לחיצה",
+        "NOTIFICATIONTEMPLATE": "תבנית",
         "SYSTEM": "מערכת",
         "EDIT_SYSTEM": "ערוך מערכת",
         "COMMAND": "פקודה",
         "VARIABLE": "משתנה",
         "CANNEDANSWERS": "תשובות מוכנות",
-        "FAXCANNEDANSWERS": "תשובות מוכנות לפקס",
-        "NO_FAXCANNEDANSWER_AVAILABLE": "אין תשובות מוכנות זמינות לפקס",
-        "NEW_FAXCANNEDANSWER": "תשובה מוכנה חדשה לפקס",
-        "ADD_FAXCANNEDANSWER": "הוסף תשובה מוכנה לפקס",
-        "EDIT_CHATCANNEDANSWER": "ערוך תשובה מוכנה לצ'אט",
-        "DELETE_CHATCANNEDANSWER": "מחק תשובה מוכנה לצ'אט",
-        "SPYINTERACTION": "אינטראקצית ריגול",
+        "FAXCANNEDANSWERS": "תשובות מוכנות",
+        "NO_FAXCANNEDANSWER_AVAILABLE": "אין תשובות מוכנות זמינות",
+        "NEW_FAXCANNEDANSWER": "תשובה מוכנה חדשה",
+        "ADD_FAXCANNEDANSWER": "הוסף תשובה מוכנה",
+        "EDIT_CHATCANNEDANSWER": "ערוך תשובה מוכנה",
+        "DELETE_CHATCANNEDANSWER": "מחק תשובה מוכנה",
+        "SPYINTERACTION": "רגל",
         "TAGS": "תגים",
         "REPLY": "השב",
         "SEND": "שלח",
         "TO": "אל",
         "FROM": "מאת",
         "NO_AGENT_ONLINE": "אין נציג מקוון",
-        "GOTOREALTIME_FAXQUEUE": "עבור אל תור הפקס המחובר ",
+        "GOTOREALTIME_FAXQUEUE": "עבור אל תור פקס Realtime ",
         "EDIT_TRUNK": "ערוך קו ראשי",
         "REGISTERED": "רשום",
         "UNREGISTERED": "לא רשום",
-        "EDIT_ACCOUNT": "ערוך חשבון",
+        "EDIT_ACCOUNT": "ערוך חשבון פקס",
         "PARTIALPAUSE": "השהיה חלקית",
         "BUSY": "תפוס",
         "TIMER": "קוצב זמן",
         "IDLE": "במצב סרק",
         "CAPACITY": "קיבולת",
-        "GOTO_FAXACCOUNT": "עבור אל חשבון הפקס",
+        "GOTO_FAXACCOUNT": "עבור אל פקס זמן אמת",
         "ACCOUNTS": "חשבונות",
-        "GOTOREALTIME_FAXACCOUNT": "עבור אל חשבון הפקס המחובר",
+        "GOTOREALTIME_FAXACCOUNT": "עבור אל פקס Realtime",
         "TRUNK_STATUS": "סטטוס קו ראשי",
         "TRUNKS": "קווים ראשיים",
         "REGISTRY": "רישום",
@@ -58,8 +58,8 @@
         "PHONE_STATUS": "סטטוס הטלפון",
         "LOGOUT": "יציאה",
         "DEFAULT_PAUSE": "השהיית ברירת המחדל",
-        "AGENTADD_QUEUE": "הוסף נציג לתור ",
-        "AGENTSADD_QUEUE": "הוסף נציגים לתור ",
+        "AGENTADD_QUEUE": "הוסף נציג לתור הפקס",
+        "AGENTSADD_QUEUE": "הוסף נציגים לתור הפקס",
         "UNPAUSE": "סיים השהיה",
         "AGENTS": "נציגים",
         "QUEUES": "תורים",
@@ -69,8 +69,8 @@
         "WAITING": "בהמתנה",
         "PRIORITY": "עדיפות",
         "CONDITION": "תנאי",
-        "TRUEPRIORITY": "עדיפות TRUE",
-        "FALSEPRIORITY": "עדיפות FALSE",
+        "TRUEPRIORITY": "עדיפות חיובי",
+        "FALSEPRIORITY": "עדיפות שלילי",
         "VALUE": "ערך",
         "EDIT_FAXQUEUE": "ערוך תור פקס",
         "EDIT_AGENT": "ערוך נציג",
@@ -78,7 +78,7 @@
         "EDIT_NOOP": "ערוך פריט Noop",
         "EDIT_GOTOP": "ערוך פריט GotoP",
         "EDIT_GOTOIF": "ערוך פריט GotoIf",
-        "EDIT_QUEUE": "ערוך תור",
+        "EDIT_QUEUE": "ערוך תור פקס",
         "EDIT_CLOSE": "ערוך סגירה",
         "QUEUE": "תור",
         "GOTOIF": "GotoIf",
@@ -88,7 +88,7 @@
         "NOTES": "פתקים ורשימות",
         "CLOSEDAT": "נסגר ב-",
         "DISPOSITION": "פריסה",
-        "REALTIME": "מחובר",
+        "REALTIME": "Realtime",
         "TEAMADD_FAXQUEUE": "הוסף צוות לתור הפקס",
         "AGENTADD_FAXQUEUE": "הוסף נציג לתור הפקס",
         "NAME": "שם",
             "LIST_REQUIRED": "שדה חובה",
             "KEY_MAX_LENGTH": "האורך המרבי המותר של הערך הוא {{max}}",
             "KEY_REQUIRED": "שדה חובה",
-            "MANDATORYDISPOSITIONPAUSEID_REQUIRED": "עליך לציין סטטוס להשהיה כאשר אתה נמצא במצב חובה"
+            "MANDATORYDISPOSITIONPAUSEID_REQUIRED": "עליך לעבור לסטטוס השהיה כאשר אתה נמצא במצב סיכום"
         },
         "STRATEGY": "אסטרטגיה",
         "AGENT_TIMEOUT": "סוף זמן קצוב לנציג",
         "LIST": "רשימה",
         "FIDELITY": "מהימנות",
         "ACCEPT": "קבל",
-        "ACCEPTMETHOD": "שיטת קבלה",
+        "ACCEPTMETHOD": "קבל שיטה",
         "ACCEPTURL": "קבל כתובת URL",
         "REJECT": "דחה",
-        "REJECTMETHOD": "שיטת דחייה",
+        "REJECTMETHOD": "דחה שיטה",
         "REJECTURL": "דחה כתובת URL",
         "CLOSE": "סגור",
         "CLOSEMETHOD": "שיטת סגירה",
             "MINRATE": "קצב העברה מינימלי נקבע לפני השידור",
             "MAXRATE": "קצב העברה מרבי נקבע לפני השידור",
             "NAME": "מותר לכלול רק ספרות, אותיות ותווים ספציפיים (._)",
-            "MANDATORYDISPOSITION": "נטייה חובה",
-            "MANDATORYDISPOSITIONPAUSEID": "השהה סטטוס למצב חובה"
+            "MANDATORYDISPOSITION": "סיכום",
+            "MANDATORYDISPOSITIONPAUSEID": "השהה סטטוס לסיכום"
         },
         "ADVANCED": "מתקדם",
         "ECM": "ECM",
         "BACK": "חזרה",
         "FAX": "פקס",
         "ID": "מזהה",
-        "TIMEOUT": "זמן קצוב",
+        "TIMEOUT": "סוף זמן קצוב",
         "FAXDISPOSITIONS": "פריסות פקס",
         "NO_FAXDISPOSITION_AVAILABLE": "אין פריסות פקס זמינות",
         "NEW_FAXDISPOSITION": "פריסת פקס חדשה",
         "IN": "נכנס",
         "OUT": "יוצא",
         "NO_INTERACTION_AVAILABLE": "אין אינטראקציות זמינות",
-        "INTERACTIONS_FAXACCOUNT": "חשבון אינטראקציות לפקס",
+        "INTERACTIONS_FAXACCOUNT": "עבור לאינטראקציות",
         "REFRESH_INTERACTIONS": "רענן אינטראקציות",
         "DELETE_INTERACTION": "מחק אינטראקציה",
         "AGENTADD_FAXACCOUNT": "הוסף נציג לחשבון הפקס",
         "TEAMS_ASSOCIATION": "איגוד הצוותים",
-        "MANDATORYDISPOSITION": "נטייה חובה",
-        "MANDATORYDISPOSITIONPAUSEID": "השהה סטטוס במצב חובה"
+        "MANDATORYDISPOSITION": "סיכום",
+        "MANDATORYDISPOSITIONPAUSEID": "השהה סטטוס לסיכום"
     }
 }
\ No newline at end of file
index 7ec1de9..6cb727d 100644 (file)
@@ -16,7 +16,7 @@
         "EDIT_ZENDESKACCOUNT": "ערוך חשבון Zendesk",
         "DELETE_ZENDESKACCOUNT": "מחק חשבון Zendesk",
         "NEW_ZENDESKACCOUNT": "חשבון Zendesk חדש",
-        "AUTHTYPE": "סוג אימות",
+        "AUTHTYPE": "סוג הרשאה",
         "PASSWORD": "סיסמה",
         "CONFIRM_PASSWORD": "אשר סיסמה",
         "TOKEN": "אסימון",
@@ -89,7 +89,7 @@
         "NEW_SALESFORCEACCOUNT": "חשבון Salesforce חדש",
         "ADD_SALESFORCEACCOUNT": "הוסף חשבון Salesforce",
         "CLIENTID": "מזהה לקוח",
-        "CLIENTSECRET": "סוד הלקוח",
+        "CLIENTSECRET": "קוד הלקוח",
         "SECURITYTOKEN": "אסימון אבטחה",
         "SEARCH_FOR_ANYONE": "חיפוש",
         "APIKEY": "מפתח API",
         "TEST_DESKACCOUNT": "בדוק חשבון Desk",
         "DELETE_DESKACCOUNT": "מחק חשבון Desk",
         "CONSUMERKEY": "מפתח צרכן",
-        "CONSUMERSECRET": "סוד הצרכן",
-        "TOKENSECRET": "סוד האסימון",
+        "CONSUMERSECRET": "קוד צרכן",
+        "TOKENSECRET": "קוד אסימון",
         "ADD_DESKACCOUNT": "הוסף חשבון Desk",
         "NEW_DESKACCOUNT": "חשבון Desk חדש",
         "ADD_DESKCONFIGURATION": "הוסף תצורת Desk",
index da0d5ae..c36a474 100644 (file)
@@ -44,8 +44,8 @@
         "MEMBERNAME": "שם הנציג",
         "CALLERIDNUM": "מספר המתקשר",
         "NO_SESSION_AVAILABLE": "אין הפעלות זמינות",
-        "SESSION_RESULTS": "תוצאות ההפעלה",
-        "SHOW_QUESTIONS_SESSION": "הצג שאלות הפעלה",
+        "SESSION_RESULTS": "תוצאות הפעלה",
+        "SHOW_QUESTIONS_SESSION": "הצג תוצאות הפעלה",
         "ANSWERS": "תשובות",
         "NO_RESULTS_AVAILABLE": "אין תוצאות זמינות",
         "TOTAL": "סה\"כ",
@@ -60,9 +60,9 @@
         "ALL_SURVEY_DATA_WILL_BE_LOST": "כל התשובות לשאלות הסקר יימחקו!",
         "ENABLEUNCOMPLETESAVE": "אפשר שמירת תשובות חלקיות",
         "SUBMIT": "שלח",
-        "PROJECT_NOT_AVAILABLE": "הפרויקט לא זמין",
+        "PROJECT_NOT_AVAILABLE": "הפרויקט לא זמין. נא ליצור קשר עם מנהל המערכת.",
         "COMPLETE": "הושלם",
-        "SESSIONS_PROJECT": "פרויקט הפעלות"
+        "SESSIONS_PROJECT": "עבור להפעלות"
     },
     "mwForm": {
         "form": {
@@ -85,7 +85,7 @@
             "fold": "קפל",
             "unfold": "פתח קיפול",
             "edit": "ערוך",
-            "clone": "שבט",
+            "clone": "שכפל",
             "view": "הצג"
         },
         "page": {
index c3938e8..113e293 100644 (file)
@@ -35,7 +35,7 @@
         "ACCEPTED": "התקבל",
         "CANNEDANSWERS": "תשובות מוכנות",
         "MAILCANNEDANSWERS": "תשובות מוכנות",
-        "NO_MAILCANNEDANSWER_AVAILABLE": "אין תשובות מוכנות זמינות",
+        "NO_MAILCANNEDANSWER_AVAILABLE": "אין תשובות דוא\"ל מוכנות זמינות",
         "NEW_MAILCANNEDANSWER": "תשובה מוכנה חדשה",
         "ADD_MAILCANNEDANSWER": "הוסף תשובה מוכנה",
         "EDIT_MAILCANNEDANSWER": "ערוך תשובה מוכנה",
@@ -60,7 +60,7 @@
         "UNPAUSE": "סיים השהיה",
         "DEFAULT_PAUSE": "השהיית ברירת המחדל",
         "LOGOUT": "יציאה",
-        "AGENTADD_QUEUE": "הוסף נציג לתור הדוא\"ל",
+        "AGENTADD_QUEUE": "הוסף נציג לתור הדוא\"ל ",
         "VOICE": "קול",
         "CHAT": "צ'אט",
         "SMS": "SMS",
@@ -95,7 +95,7 @@
         "GOTOREALTIME_MAILACCOUNT": "עבור אל חשבון דוא\"ל Realtime",
         "GOTO_MAILACCOUNT": "עבור אל חשבון דוא\"ל Realtime",
         "TEXT": "טקסט",
-        "TIMES": "מספר הפעמים בכל אינטראקציה",
+        "TIMES": "מספר הפעמים לכל אינטראקצייה",
         "EDIT_AUTOREPLY": "ערוך תשובה אוטומטית",
         "AUTOREPLY": "תשובה אוטומטית",
         "SHOW_AUTOREPLY": "הצג תשובה אוטומטית",
         "SAVE": "שמור",
         "MAILACCOUNTS": "חשבונות דוא\"ל",
         "EMAIL_ADDRESS": "כתובת דוא\"ל",
-        "ADD_MAILACCOUNT": "הוסף כתובת דוא\"ל",
-        "EDIT_MAILACCOUNT": "ערוך כתובת דוא\"ל",
-        "DELETE_MAILACCOUNT": "מחק כתובת דוא\"ל",
+        "ADD_MAILACCOUNT": "הוסף חשבון דוא\"ל",
+        "EDIT_MAILACCOUNT": "ערוך חשבון דוא\"ל",
+        "DELETE_MAILACCOUNT": "מחק חשבונות דוא\"ל",
         "DISPOSITIONS": "פריסות",
         "WEBHOOKS": "רכיבי WebHook",
         "ACTIONS": "פעולות",
         "SERVICE": "שירות",
         "CREATED_AT": "נוצר ב-",
         "ACCEPT": "קבל",
-        "ACCEPTMETHOD": "שיטת קבלה",
+        "ACCEPTMETHOD": "קבל שיטה",
         "ACCEPTURL": "קבל כתובת URL",
         "REJECT": "דחה",
         "REJECTMETHOD": "שיטת דחייה",
         "FILTER": "מסנן",
         "CONNTIMEOUT": "זמן קצוב להתחברות [שניות]",
         "AUTHTIMEOUT": "זמן קצוב לאימות [שניות]",
-        "DELETE": "מחק הודעות דוא\"ל בשרת",
+        "DELETE": "מחק דוא\"ל מהשרת ",
         "SSL": "SSL",
         "KEEPALIVE": "השאר מחובר",
         "POLLING": "תשאול",
         "BACK": "חזרה",
         "MAIL": "דוא\"ל",
         "ID": "מזהה",
-        "TIMEOUT": "זמן קצוב",
+        "TIMEOUT": "סוף זמן קצוב",
         "PASSWORD": "סיסמה",
         "NO_MAILDISPOSITION_AVAILABLE": "אין פריסות דוא\"ל זמינות",
         "ADD_MAILDISPOSITION": "הוסף פריסת דוא\"ל",
             "NAME": "מותר לכלול רק ספרות, אותיות ותווים ספציפיים (._)",
             "USERNAME": "האימות מבוסס על שם משתמש",
             "PASSWORD": "האימות מבוסס על סיסמה",
-            "SECURE": "אם TRUE, החיבור לשרת יתבסס על TLS",
+            "SECURE": "אם כן, החיבור לשרת יתבסס על TLS",
             "MARK_AS_UNREAD": "הפעל/השבת נציג כדי לסמן כ'לא נקרא' את ההודעה האחרונה באינטראקציה",
-            "MANDATORYDISPOSITION": "נטייה חובה",
-            "MANDATORYDISPOSITIONPAUSEID": "השהה לשימוש כאשר פעולת התנהגות חובה מופעלת"
+            "MANDATORYDISPOSITION": "סיכום",
+            "MANDATORYDISPOSITIONPAUSEID": "השהה שימוש כאשר הסיכום מופעל"
         },
         "PAGE": "דף",
         "ROWSPERPAGE": "שורות בדף",
         "GOTOIF": "GotoIf",
         "EDIT_GOTOIF": "ערוך פריט GotoIf",
         "CONDITION": "תנאי",
-        "TRUEPRIORITY": "עדיפות TRUE",
-        "FALSEPRIORITY": "עדיפות FALSE",
+        "TRUEPRIORITY": "עדיפות חיובי",
+        "FALSEPRIORITY": "עדיפות שלילי",
         "GOTOP": "GotoP",
         "EDIT_GOTOP": "ערוך פריט GotoP",
         "PRIORITY": "עדיפות",
         "IN_USE": "בשימוש",
         "AGENTSADD_QUEUE": "הוסף נציגים לתור הדוא\"ל",
         "INFO": "מידע",
-        "INTERACTIONS_MAILACCOUNT": "עבור אל אינטראקציות",
+        "INTERACTIONS_MAILACCOUNT": "עבור לאינטראקציות",
         "REFRESH_INTERACTIONS": "רענן אינטראקציות",
         "DELETE_INTERACTION": "מחק אינטראקציה",
         "AGENTADD_MAILACCOUNT": "הוסף נציג לחשבון הדוא\"ל",
         "TEAMS_ASSOCIATION": "איגוד הצוותים",
-        "MANDATORYDISPOSITION": "נטייה חובה",
-        "MANDATORYDISPOSITIONPAUSEID": "השהה לשימוש אם יש נטייה לחובה",
+        "MANDATORYDISPOSITION": "סטיכום",
+        "MANDATORYDISPOSITIONPAUSEID": "השהה שימוש כשהסיכום מופעל",
         "ADVANCED": "מתקדם"
     }
 }
\ No newline at end of file
index 5554175..610d5dc 100644 (file)
@@ -2,10 +2,10 @@
     "MOTIONDIALER": {
         "LOGIN_TIME": "שעת כניסה",
         "PAUSE_TIME": "שעת השהיה",
-        "CUTDIGIT": "קצץ ספרות",
-        "RANDOMLASTDIGITCALLERIDNUMBER": "מזהה מחייג אקראי לשיחות יוצאות",
-        "CLONE_IVRCAMPAIGN": "שבט מבצע",
-        "CLONE_QUEUECAMPAIGN": "שבט מבצע תורים",
+        "CUTDIGIT": "קצץ ספרה",
+        "RANDOMLASTDIGITCALLERIDNUMBER": "מספר של שיחה יוצאת אקראית",
+        "CLONE_IVRCAMPAIGN": "שכפל מבצע",
+        "CLONE_QUEUECAMPAIGN": "שכפל מבצע תורים",
         "ABANDONEDCALLS": "שיחות בתור שננטשו",
         "HOPPERWIDGET": "סיכום",
         "RESETLIST_IVRCAMPAIGN": "אפס רשימות",
@@ -40,7 +40,7 @@
         "PREVIEW_CAMPAIGNS": "הצג מבצעים",
         "AMD": "זיהוי משיבונים (AMD) של Asterisk",
         "AMDTOTALANALYSISTIME": "זמן ניתוח כולל",
-        "AMDACTIVE": "AMD",
+        "AMDACTIVE": "פעיל",
         "AMDINITIALSILENCE": "דממה ראשונית",
         "AMDGREETING": "ברכה",
         "AMDAFTERGREETINGSILENCE": "דממה לאחר הברכה",
@@ -68,7 +68,7 @@
         "NO_HOPPERBLACK_AVAILABLE": "אין פריטים זמינים",
         "HOPPERFINALS": "משפך סופי",
         "NO_HOPPERFINAL_AVAILABLE": "אין פריטים זמינים",
-        "HOPPERHISTORIES": "היסטוריית שיחות",
+        "HOPPERHISTORIES": "היסטוריית שיחה",
         "NO_HOPPERHISTORY_AVAILABLE": "אין פריטים זמינים",
         "DELETE_HOPPERHISTORY": "מחק",
         "DELETE_HOPPERFINAL": "מחק",
         "AGENTBUSYFACTOR": "גורם 'נציג תפוס'",
         "PREDICTIVEOPTIMIZATION": "מיטוב מנבא",
         "PREDICTIVEOPTIMIZATIONPERCENTAGE": "שיעור מיטוב מנבא",
-        "PREDICTIVEINTERVAL": "מרווח זמן מנבא",
+        "PREDICTIVEINTERVAL": "מנבא מרווח זמן",
         "ADD_QUEUECAMPAIGN": "הוסף מבצע תורים",
         "CAMPAIGN": "מבצע",
         "MAXCONCURRENTCALLS": "מקס' שיחות במקביל",
         "ANNOUNCEFREQUENCY": "תדירות הודעה",
         "MINANNOUNCEFREQUENCY": "תדירות הודעה מינימלית",
         "PERIODICANNOUNCEFREQUENCY": "תדירות הודעה מחזורית",
-        "RANDOMPERIODICANNOUNCE": "הודעה מחזורית בסדר אקראי",
+        "RANDOMPERIODICANNOUNCE": "הודעה מחזורית אקראית",
         "ANNOUNCEHOLDTIME": "זמן המתנה להודעה",
         "ANNOUNCECALLERPOSITION": "הכרזת מיקום המתקשר בתור",
         "ANNOUNCEPOSITIONLIMIT": "הכרזת מגבלת מקומות בתור",
         "RINGINUSE": "הצלצול שבשימוש",
         "MEMBERDELAY": "השהיית הנציג",
         "TIMEOUTRESTART": "זמן קצוב להפעלה מחדש",
-        "MONITORFORMAT": "תבנית הקלטה",
+        "MONITORFORMAT": "מבנה הקלטה",
         "SETINTERFACEVARIABLES": "קבע משתני ממשק",
         "SETQUEUEVARIABLES": "קבע משתני תור",
         "SETQUEUEENTRYVARIABLES": "קבע משתני כניסה לתור",
         "EDIT_MUSICONHOLD": "ערוך מוזיקה להמתנה",
         "DELETE_MUSICONHOLD": "מחק מוזיקה להמתנה",
         "DIRECTORY": "ספרייה",
-        "AUDIOFILES": "קובצי אודיו",
+        "AUDIOFILES": "קובצי שמע",
         "RECORDINGS": "הקלטות",
         "CHANSPY": "ChanSpy",
         "PREFIX": "קידומת",
         "USER": "משתמש",
         "TRUNK": "קו ראשי",
         "PHONE": "טלפון",
-        "AUDIO_FILES": "קובצי אודיו",
+        "AUDIO_FILES": "קובצי שמע",
         "ANNOUNCE_OVERRIDES": "עקיפת הודעות",
         "MACRO": "מאקרו",
         "GOSUB": "GoSub",
         "REALTIME": "Realtime",
         "ID": "מזהה",
         "VOICEMAIL_CONTEXT": "הקשר",
-        "NO_MOHSOUND_AVAILABLE": "אין מוסיקה זמינה להמתנה",
+        "NO_MOHSOUND_AVAILABLE": "אין מוסיקת המתנה זמינה",
         "FILE": "קובץ",
         "ADD_MOHSOUND": "הוסף צליל מוזיקה בהמתנה",
         "DOWNLOAD_MOHSOUND": "הורד צליל מוזיקה בהמתנה",
         "AGENT": "נציג",
         "TYPE": "סוג",
         "RATING": "דירוג",
-        "AUDIO": "אודיו",
+        "AUDIO": "שמע",
         "DATE": "תאריך",
         "NEW_VOICEQUEUE": "תור קול חדש",
         "NEW_INBOUNDROUTE": "נתיב נכנס חדש",
         "NEW_INTERNALROUTE": "נתיב פנימי חדש",
         "NEW_CONTEXT": "הקשר חדש",
         "NEW_VOICEMAIL": "הודעה קולית חדשה",
-        "NEW_MUSICONHOLD": "מוזיקה בהמתנה חדשה",
+        "NEW_MUSICONHOLD": "מוזיקת המתנה חדשה",
         "NEW_CHANSPY": "ChanSpy חדש",
         "PENALTY": "חסימה",
-        "ADD_TEAM_TO_VOICEQUEUE": "הוסף צוות לתור קול",
-        "ADD_AGENT_TO_VOICEQUEUE": "הוסף נציג לתור קול",
+        "ADD_TEAM_TO_VOICEQUEUE": "הוסף צוות לתור הקול",
+        "ADD_AGENT_TO_VOICEQUEUE": "הוסף נציג לתור השיחות",
         "EDIT_DIAL": "ערוך חיוג",
         "EDIT_AGI": "ערוך AGI",
         "EDIT_INTERNALDIAL": "ערוך חיוג פנימי",
         "TOTAL": "סה\"כ",
         "ANSWERED": "נענה",
         "ABANDONED": "ננטש",
-        "UNMANAGED": "לא מנוהלות",
+        "UNMANAGED": "לא מנוהל",
         "REDIRECT_TO_NUMBER": "הפנה למספר",
         "REDIRECT_TO_AGENT": "הפנה לנציג",
         "CLOSING": "סגירה",
         "RESCHEDULED_CONTACTS": "אנשי קשר ששובצו מחדש",
         "INTERVAL_IS_OVERTIME": "חריגה ממרווח זמן",
         "GLOBAL_INTERVAL_IS_OVERTIME": "חריגה ממרווח זמן (גלובלי)",
-        "INTERVAL_IS_NULL": "מרווח הזמן Null",
+        "INTERVAL_IS_NULL": "מרווח הזמן הוא NULL ",
         "TIMEZONE_UNKNOW": "אזור זמן לא ידוע",
         "INTERVAL_IS_EMPTY": "מרווח הזמן ריק",
         "TOTAL_MANAGED": "סה\"כ נוהלו",
         "SMS": "SMS",
         "OPENCHANNEL": "פתח ערוץ",
         "FAX": "פקס",
-        "RECALLINQUEUE": "כזכור בתור",
+        "RECALLINQUEUE": "חיוג חוזר בתור",
         "REFRESH_SCHEDULED_CALLS": "רענן שיחות מתוזמנות",
         "SCHEDULED_CALLS": "שיחות מתוזמנות",
         "SELECT_CAMPAIGN": "בחר קמפיין",
         "SELECT_TYPE": "בחר סוג",
         "TEAMS_ASSOCIATION": "איגוד הצוותים",
         "ANSWERING_MACHINE": "משיבון",
-        "MANDATORYDISPOSITION": "נטייה חובה",
-        "MANDATORYDISPOSITIONPAUSEID": "מצב השהיית חובה"
+        "MANDATORYDISPOSITION": "סיכום",
+        "MANDATORYDISPOSITIONPAUSEID": "מצב השהיית סיכום"
     }
 }
\ No newline at end of file
index a14832f..f4a8205 100644 (file)
@@ -35,7 +35,7 @@
         "TAGS": "תגים",
         "SPYINTERACTION": "רגל",
         "NO_AGENT_ONLINE": "אין נציג מקוון",
-        "GOTOREALTIME_OPENCHANNELQUEUE": "עבור אל תור ערוצים פתוחים ב-Realtime",
+        "GOTOREALTIME_OPENCHANNELQUEUE": "עבור אל תור ערוץ פתוח Realtime ",
         "PARTIALPAUSE": "השהיה חלקית",
         "BUSY": "תפוס",
         "TIMER": "טיימר",
@@ -47,7 +47,7 @@
         "EDIT_AUTOREPLY": "ערוך תשובה אוטומטית",
         "AUTOREPLY": "תשובה אוטומטית",
         "NAME": "שם",
-        "OPENCHANNELQUEUES": "פתח תורי ערוצים",
+        "OPENCHANNELQUEUES": "תורי ערוץ פתוח",
         "SEARCH_FOR_ANYONE": "חיפוש",
         "ERRORS": {
             "QUEUETRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO": "הערך חייב להיות קטן או שווה ל-",
         "EDIT_GOTOIF": "ערוך פריט GotoIf",
         "EDIT_QUEUE": "ערוך תור",
         "CONDITION": "תנאי",
-        "TRUEPRIORITY": "עדיפות TRUE",
-        "FALSEPRIORITY": "עדיפות FALSE",
+        "TRUEPRIORITY": "עדיפות חיובי",
+        "FALSEPRIORITY": "עדיפות שלילי",
         "VALUE": "ערך",
         "PRIORITY": "עדיפות",
         "AGENT_TIMEOUT": "סוף זמן קצוב לנציג",
         "DESCRIPTION": "תיאור",
-        "ADD_OPENCHANNELQUEUE": "הוסף תור ערוצים פתוחים",
-        "EDIT_OPENCHANNELQUEUE": "ערוך תור ערוצים פתוחים",
-        "DELETE_OPENCHANNELQUEUE": "מחק תור ערוצים פתוחים",
+        "ADD_OPENCHANNELQUEUE": "הוסף תור ערוץ פתוח",
+        "EDIT_OPENCHANNELQUEUE": "ערוך תור ערוץ פתוח",
+        "DELETE_OPENCHANNELQUEUE": "מחק תור ערוץ פתוח",
         "PENALTY": "חסימה",
-        "TEAMADD_OPENCHANNELQUEUE": "הוסף צוות לתור ערוצים פתוחים",
-        "AGENTADD_OPENCHANNELQUEUE": "הוסף נציג לתור ערוצים פתוחים",
+        "TEAMADD_OPENCHANNELQUEUE": "הוסף צוות לתור ערוץ פתוח",
+        "AGENTADD_OPENCHANNELQUEUE": "הוסף נציג לתור ערוצ פתוח",
         "ALL_AGENTS": "כל הנציגים",
         "SELECTED_AGENTS": "נציגים נבחרים",
-        "CREATED_AT": "נוצר ב-",
+        "CREATED_AT": "נוצר ב",
         "SAVE": "שמור",
         "SETTINGS": "הגדרות",
         "GENERAL": "כללי",
         "OPENCHANNELACCOUNTS": "חשבונות ערוצים פתוחים",
         "MOTIONADDRESS": "כתובת Motion",
-        "ADD_OPENCHANNELACCOUNT": "הוסף חשבון ערוצים פתוחים",
-        "EDIT_OPENCHANNELACCOUNT": "ערוך חשבון ערוצים פתוחים",
-        "DELETE_OPENCHANNELACCOUNT": "מחק חשבון ערוצים פתוחים",
+        "ADD_OPENCHANNELACCOUNT": "הוסף חשבון ערוץ פתוח",
+        "EDIT_OPENCHANNELACCOUNT": "ערוך חשבון ערוץ פתוח",
+        "DELETE_OPENCHANNELACCOUNT": "מחק חשבון ערוץ פתוח",
         "API": "ממשק API",
         "DISPOSITIONS": "פריסות",
         "WEBHOOKS": "רכיבי WebHook",
         "LIST": "רשימה",
         "FIDELITY": "מהימנות",
         "ACCEPT": "קבל",
-        "ACCEPTMETHOD": "שיטת קבלה",
+        "ACCEPTMETHOD": "קבל שיטה",
         "ACCEPTURL": "קבל כתובת URL",
         "REJECT": "דחה",
-        "REJECTMETHOD": "שיטת דחייה",
+        "REJECTMETHOD": "דחה שיטה",
         "REJECTURL": "דחה כתובת URL",
         "CLOSE": "סגור",
         "CLOSEMETHOD": "שיטת סגירה",
         "SELECT_ALL": "בחר הכול",
         "SELECT_NONE": "אל תבחר אף פריט",
         "BACK": "חזרה",
-        "OPENCHANNEL": "פתח ערוץ",
+        "OPENCHANNEL": "ערוץ פתוח",
         "ID": "מזהה",
-        "TIMEOUT": "זמן קצוב",
-        "OPENCHANNELDISPOSITIONS": "פריסות ערוצים פתוחים",
+        "TIMEOUT": "סוף זמן קצוב",
+        "OPENCHANNELDISPOSITIONS": "פריסות ערוץ פתוח",
         "NO_OPENCHANNELDISPOSITION_AVAILABLE": "אין פריסות ערוצים פתוחים זמינות",
-        "NEW_OPENCHANNELDISPOSITION": "פריסת ערוצים פתוחים חדשה",
-        "ADD_OPENCHANNELDISPOSITION": "הוסף פריסת ערוצים פתוחים",
-        "EDIT_OPENCHANNELDISPOSITION": "ערוך פריסת ערוצים פתוחים",
-        "DELETE_OPENCHANNELDISPOSITION": "מחק פריסת ערוצים פתוחים",
-        "NEW_OPENCHANNELQUEUE": "תור ערוצים פתוחים חדש",
-        "NEW_OPENCHANNELACCOUNT": "חשבון ערוצים פתוחים חדש",
+        "NEW_OPENCHANNELDISPOSITION": "פריסת ערוץ פתוח חדש",
+        "ADD_OPENCHANNELDISPOSITION": "הוסף פריסת ערוץ פתוח",
+        "EDIT_OPENCHANNELDISPOSITION": "ערוך פריסת ערוץ פתוח",
+        "DELETE_OPENCHANNELDISPOSITION": "מחק פריסת ערוץ פתוח",
+        "NEW_OPENCHANNELQUEUE": "תור ערוץ פתוח חדש",
+        "NEW_OPENCHANNELACCOUNT": "חשבון ערוץ פתוח חדש",
         "NO_AVAILABLE_INFO": "אין פרטים זמינים",
         "ALL_TEAMS": "כל הצוותים",
         "SELECTED_TEAMS": "צוותים נבחרים",
             "REPLYURI": "כתובת ה-URL שהערוץ הפתוח יתקשר אליה בעת שליחת הודעה או תשובה על הודעה. לפרטים נוספים, עיין במסמך <a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/New+Channels+Configuration+Steps#NewChannelsConfigurationSteps-BuildyourownChannelservice\">כאן</a>",
             "NAME": "מותר לכלול רק ספרות, אותיות ותווים ספציפיים (._)",
             "LIST": "רשימת 'מנהל אנשי הקשר' המשמשת לשיוך אנשי קשר",
-            "MANDATORYDISPOSITION": "נטייה חובה",
-            "MANDATORYDISPOSITIONPAUSEID": "השהה לשימוש אם יש נטייה לחובה"
+            "MANDATORYDISPOSITION": "סיכום",
+            "MANDATORYDISPOSITIONPAUSEID": "השהה לשימוש אם הסיכום מופעל"
         },
         "PAGE": "דף",
         "ROWSPERPAGE": "שורות בדף",
         "SELECT_STATUS": "בחר סטטוס",
         "FILTER": "מסנן",
         "FILTERS": "מסננים",
-        "CLOSEDAT": "נסגר ב-",
+        "CLOSEDAT": "נסגר ב",
         "DISPOSITION": "פריסה",
         "NOTES": "פתקים ורשימות",
         "NO_INTERACTION_AVAILABLE": "אין אינטראקציות זמינות",
         "PHONE_STATUS": "סטטוס הטלפון",
         "PAUSE": "השהה",
         "LOGOUT": "יציאה",
-        "AGENTADD_QUEUE": "הוסף נציג לתור ערוצים פתוחים",
+        "AGENTADD_QUEUE": "הוסף נציג לתור ערוץ פתוח",
         "UNPAUSE": "סיים השהיה",
         "DEFAULT_PAUSE": "השהיית ברירת המחדל",
         "LOGGED_IN": "מחובר",
         "MAIL": "דוא\"ל",
         "SMS": "SMS",
         "FAX": "פקס",
-        "AGENTSADD_QUEUE": "הוסף נציגים לתור ערוצים פתוחים",
+        "AGENTSADD_QUEUE": "הוסף נציגים לתור ערוץ פתוח",
         "INTERACTIONS_OPENCHANNELACCOUNT": "עבור אל אינטראקציות",
         "REFRESH_INTERACTIONS": "רענן אינטראקציות",
         "DELETE_INTERACTION": "מחק אינטראקציה",
-        "AGENTADD_OPENCHANNELACCOUNT": "הוסף נציג לחשבון ערוצים פתוחים",
+        "AGENTADD_OPENCHANNELACCOUNT": "הוסף נציג לחשבון ערוץ פתוח",
         "CANNED_ANSWER_SEARCH": "הזן טקסט כדי לחפש תשובה מוכנה",
         "CANNED_ANSWER_NOT_FOUND": "לא נמצאו תשובות מוכנות",
         "SEND": "שלח",
         "TO": "אל",
         "MAPKEY": "מפתח מפה",
         "TEAMS_ASSOCIATION": "איגוד הצוותים",
-        "MANDATORYDISPOSITION": "נטייה חובה",
-        "MANDATORYDISPOSITIONPAUSEID": "השהה לשימוש אם יש נטייה לחובה"
+        "MANDATORYDISPOSITION": "סיכום",
+        "MANDATORYDISPOSITIONPAUSEID": "השהה לשימוש כשהסיכום מופעל"
     }
 }
\ No newline at end of file
index afef0ff..9cf2e10 100644 (file)
@@ -36,7 +36,8 @@
             "SMTP_PASSWORD": "كلمة المرور المستخدمة للمصادقة",
             "SMTP_SECURE": "إذا كان هذا صحيحًا ، فسيستخدم الاتصال بالخادم TLS",
             "SMTP_USERNAME": "اسم المستخدم المستخدم للمصادقة",
-            "MOTIONBARREMEMBERME": "تمكين / تعطيل ميزة تذكر البيانات في شريط الحركة"
+            "MOTIONBARREMEMBERME": "تمكين / تعطيل ميزة تذكر البيانات في شريط الحركة",
+            "RTLSUPPORT": "لتمكين دعم RTL للغات العربية والفارسية والعبرية"
         },
         "AGENTS": "عملاء",
         "AVG_LOAD": "متوسط التحميل",
         "VIRTUAL": "دردشة",
         "VOICE": "صوت",
         "CHATTIMEOUT": "دردشة انتهاء مهلة التفاعل",
-        "MOTIONBARREMEMBERME": "تذكرنى"
+        "MOTIONBARREMEMBERME": "تذكرنى",
+        "RTLSUPPORT": "دعم RTL"
     }
 }
\ No newline at end of file
index 7059e23..23dcd6c 100644 (file)
@@ -76,7 +76,8 @@
             "SMTP_PASSWORD": "Adgangskoden bruges til godkendelse",
             "EMAILADDRESS": "Angive de oprindelige e-mail-adresse Besked (fra)",
             "SECURITY_SUITE": "Aktiverer det sikre adgangskodeformat, den obligatoriske adgangskode nulstilles efter den første login og adgangskoden udløbet efter 90 dage",
-            "MOTIONBARREMEMBERME": "Aktivér / deaktiver funktionen Husk mig i Motion Phonebar"
+            "MOTIONBARREMEMBERME": "Aktivér / deaktiver funktionen Husk mig i Motion Phonebar",
+            "RTLSUPPORT": "Aktiverer RTL-support til arabisk, persisk og hebraisk"
         },
         "ERRORS": {
             "ADDRESS_REQUIRED": "Adressen er påkrævet",
         "VIRTUAL": "Snak",
         "VOICE": "Stemme",
         "CHATTIMEOUT": "Chat afsluttende interaktion timeout",
-        "MOTIONBARREMEMBERME": "Husk mig"
+        "MOTIONBARREMEMBERME": "Husk mig",
+        "RTLSUPPORT": "RTL Support"
     }
 }
\ No newline at end of file
index b075aae..0ef8885 100644 (file)
@@ -76,7 +76,8 @@
             "SMTP_PASSWORD": "Kennwort für die Authentifizierung verwendet werden",
             "EMAILADDRESS": "Geben Sie die E-Mail-Adresse der Nachricht (von)",
             "SECURITY_SUITE": "Aktiviert das sichere Passwort-Format, das obligatorische Zurücksetzen des Passworts nach der ersten Anmeldung und den Ablauf des Passworts nach 90 Tagen",
-            "MOTIONBARREMEMBERME": "Aktivieren / Deaktivieren der Funktion \"Merken\" in Motion Phonebar"
+            "MOTIONBARREMEMBERME": "Aktivieren / Deaktivieren der Funktion \"Merken\" in Motion Phonebar",
+            "RTLSUPPORT": "Aktiviert die RTL-Unterstützung für Arabisch, Persisch und Hebräisch"
         },
         "ERRORS": {
             "ADDRESS_REQUIRED": "Die Adresse ist erforderlich",
         "VIRTUAL": "Plaudern",
         "VOICE": "Stimme",
         "CHATTIMEOUT": "Chat schließt Interaktionszeitlimit",
-        "MOTIONBARREMEMBERME": "Erinnere dich an mich"
+        "MOTIONBARREMEMBERME": "Erinnere dich an mich",
+        "RTLSUPPORT": "RTL-Unterstützung"
     }
 }
\ No newline at end of file
index cfdb1d0..aead3dd 100644 (file)
@@ -1,5 +1,6 @@
 {
     "SETTINGS": {
+        "RTLSUPPORT": "RTL Support",
         "PREFERRED": "Preferred Logo",
         "DEFAULT_PREFERRED": "Default Preferred Logo",
         "MOTIONBARREMEMBERME": "Remember Me",
@@ -95,6 +96,7 @@
         "NEW_NETWORK": "New Network",
         "ADD_NETWORK": "Add Network",
         "HELP": {
+            "RTLSUPPORT": "Enables the RTL Support for Arabic, Persian and Hebrew languages",
             "ADDRESS": "External (public) ip address",
             "LOCALNETADDRESS": "Local ip address/subnet",
             "SMTP_SECURE": "If true, the connection to the server will use TLS",
index 229037f..0f2448a 100644 (file)
@@ -10,7 +10,8 @@
             "SMTP_PASSWORD": "Contraseña utilizada para autenticación",
             "SMTP_SECURE": "Si es verdadero, la conexión al servidor usará TLS",
             "SMTP_USERNAME": "Nombre de usuario utilizado para autenticación",
-            "MOTIONBARREMEMBERME": "Habilitar / deshabilitar la función Recordarme en Motion Phonebar"
+            "MOTIONBARREMEMBERME": "Habilitar / deshabilitar la función Recordarme en Motion Phonebar",
+            "RTLSUPPORT": "Habilita el soporte RTL para los idiomas árabe, persa y hebreo."
         },
         "ERRORS": {
             "ACCOUNTNAME_REQUIRED": "Campo obligatorio",
         "VIRTUAL": "Charla",
         "VOICE": "Voz",
         "CHATTIMEOUT": "Tiempo de espera de interacción de cierre de chat",
-        "MOTIONBARREMEMBERME": "Recuérdame"
+        "MOTIONBARREMEMBERME": "Recuérdame",
+        "RTLSUPPORT": "Soporte RTL"
     }
 }
\ No newline at end of file
index d0ce295..0e931d7 100644 (file)
@@ -76,7 +76,8 @@
             "SMTP_PASSWORD": "رمز عبور استفاده شده برای تأیید اعتبار",
             "EMAILADDRESS": "آدرس ایمیل مبدا را مشخص می کند اين پيام (از)",
             "SECURITY_SUITE": "قالب رمز عبور امن را فعال می کند، رمز عبور مجدد ضروری پس از اولین ورود و بعد از گذشت 90 روز از رمز عبور حذف می شود",
-            "MOTIONBARREMEMBERME": "فعال / غیر فعال کردن ویژگی به یاد ماندنی من در Phone Phone Motion"
+            "MOTIONBARREMEMBERME": "فعال / غیر فعال کردن ویژگی به یاد ماندنی من در Phone Phone Motion",
+            "RTLSUPPORT": "پشتیبانی RTL را برای زبانهای عربی ، فارسی و عبری فعال می کند"
         },
         "ERRORS": {
             "ADDRESS_REQUIRED": "آدرس مورد نیاز است.",
         "VIRTUAL": "چت",
         "VOICE": "صدای",
         "CHATTIMEOUT": "تعطیلات چت بسته شدن تعطیلات",
-        "MOTIONBARREMEMBERME": "مرا به خاطر بسپار"
+        "MOTIONBARREMEMBERME": "مرا به خاطر بسپار",
+        "RTLSUPPORT": "پشتیبانی RTL"
     }
 }
\ No newline at end of file
index 2b8ba07..48be781 100644 (file)
@@ -75,7 +75,8 @@
             "SMTP_PASSWORD": "Salasana todennukseen käytettävä",
             "EMAILADDRESS": "Valitse lähtö sähköpostiosoite viesti (poistetaan)",
             "SECURITY_SUITE": "Ottaa käyttöön suojatun salasanamuodon, pakollisen salasanan palauttamisen ensimmäisen sisäänkirjautumisen ja salasanan päättymisen jälkeen 90 päivän kuluttua",
-            "MOTIONBARREMEMBERME": "Ota käyttöön / poista käytöstä Muistuta -ominaisuus -toiminto Motion-puhelinpalkissa"
+            "MOTIONBARREMEMBERME": "Ota käyttöön / poista käytöstä Muistuta -ominaisuus -toiminto Motion-puhelinpalkissa",
+            "RTLSUPPORT": "Mahdollistaa arabian, persian ja heprealaisten kielten RTL-tuen"
         },
         "ERRORS": {
             "ADDRESS_REQUIRED": "Osoite on pakollinen",
         "VIRTUAL": "jutella",
         "VOICE": "Ääni",
         "CHATTIMEOUT": "Chat sulkeutuva vuorovaikutus aikakatkaisu",
-        "MOTIONBARREMEMBERME": "Muista minut"
+        "MOTIONBARREMEMBERME": "Muista minut",
+        "RTLSUPPORT": "RTL-tuki"
     }
 }
\ No newline at end of file
index 5097041..8a66b53 100644 (file)
@@ -76,7 +76,8 @@
             "SMTP_PASSWORD": "utilisé pour l'authentification",
             "EMAILADDRESS": "Adresse e-mail Indiquez l'origine du message (de)",
             "SECURITY_SUITE": "Active la gestion de mot de passe sécurisé, la réinitialisation du mot de passe est obligatoire après la première connexion et l'expiration après 90 jours",
-            "MOTIONBARREMEMBERME": "Activer / désactiver la fonction Mémoriser mes informations dans Motion Phonebar"
+            "MOTIONBARREMEMBERME": "Activer / désactiver la fonction Mémoriser mes informations dans Motion Phonebar",
+            "RTLSUPPORT": "Active le support RTL pour l'arabe, le persan et l'hébreu"
         },
         "ERRORS": {
             "ADDRESS_REQUIRED": "Adresse nécessaire",
         "VIRTUAL": "Bavarder",
         "VOICE": "Voix",
         "CHATTIMEOUT": "Expiration de l'interaction de la discussion",
-        "MOTIONBARREMEMBERME": "Souviens-toi de moi"
+        "MOTIONBARREMEMBERME": "Souviens-toi de moi",
+        "RTLSUPPORT": "Support RTL"
     }
 }
\ No newline at end of file
index 357e92e..8601a0c 100644 (file)
@@ -1,7 +1,7 @@
 {
     "SETTINGS": {
         "MOTIONBARREMEMBERME": "זכור אותי",
-        "CHATTIMEOUT": "נגמר הזמן הקצוב לאינטראקציית סגירת צ'אט",
+        "CHATTIMEOUT": "סוף הזמן הקצוב לאינטראקציית סגירת צ'אט",
         "VIRTUAL": "צ'אט",
         "VOICE": "קול",
         "SESSIONS": "הפעלות",
@@ -29,7 +29,7 @@
         "RELOAD": "טען מחדש",
         "VERIFY": "בצע אימות",
         "INTERFACE": "ממשק",
-        "UPDATING": "עדכון",
+        "UPDATING": "מעדכן",
         "REMOTE_VERSION": "גרסה מרוחקת",
         "NO_NEW_VERSION_AVAILABLE": "אין גרסה חדשה זמינה",
         "TOP_N_PROCESSES": "{{value}} התהליכים המובילים",
@@ -39,8 +39,8 @@
         "MOUNT_POINT": "הרכב",
         "AVG_LOAD": "עומס AVG",
         "TOTAL": "סה\"כ",
-        "USED": "במצב שימוש",
-        "FREE": "במצב פנוי",
+        "USED": "בשימוש",
+        "FREE": "פנוי",
         "NAME": "שם",
         "STATE": "מדינה",
         "CHAT": "צ'אט",
         "HELP": {
             "ADDRESS": "כתובת IP חיצונית (ציבורית)",
             "LOCALNETADDRESS": "כתובת IP/רשת משנית מקומית",
-            "SMTP_SECURE": "אם TRUE, החיבור לשרת יתבסס על TLS",
+            "SMTP_SECURE": "אם חיובי, החיבור לשרת יתבסס על TLS",
             "SMTP_USERNAME": "האימות מבוסס על שם משתמש",
             "SMTP_PASSWORD": "האימות מבוסס על סיסמה",
             "EMAILADDRESS": "כתובת הדוא\"ל המקורית של ההודעה (מאת)",
             "SECURITY_SUITE": "מפעיל את תבנית הסיסמה המאובטחת, את איפוס סיסמת החובה לאחר הכניסה הראשונה ואת פקיעת תוקף הסיסמה כעבור 90 יום",
-            "MOTIONBARREMEMBERME": "הפעל/השבת את התכונה 'זכור אותי' ב-Motion Phonebar"
+            "MOTIONBARREMEMBERME": "הפעל/השבת את התכונה 'זכור אותי' ב-Motion Phonebar",
+            "RTLSUPPORT": "מאפשר תמיכה ב- RTL לשפות ערבית, פרסית ועברית"
         },
         "ERRORS": {
             "CHATTIMEOUT_REQUIRED": "שדה חובה",
         "ANNUALLY": "שנתי",
         "AGENTOMNIDESKTOPINTERFACE": "ממשק נציג Omni Desktop Interface",
         "MESSAGESALIGNMENT": "יישור הודעות",
-        "ENTER_LICENSE": "הזן פרטי רישיון",
+        "ENTER_LICENSE": "הזן רישיון",
         "UPDATE_LICENSE_MANUALLY": "האם ברצונך לעדכן את הרישיון באופן ידני?",
         "DEFAULT_PREFERRED": "לוגו מועדף המוגדר כברירת מחדל",
-        "PREFERRED": "לוגו מועדף"
+        "PREFERRED": "לוגו מועדף",
+        "RTLSUPPORT": "תמיכה ב- RTL"
     }
 }
\ No newline at end of file
index b84272e..65c06bb 100644 (file)
@@ -76,7 +76,8 @@
             "SMTP_PASSWORD": "पासवर्ड का प्रयोग करने के लिए प्रमाणीकरण",
             "EMAILADDRESS": "निर्दिष्ट ईमेल पते का उद्भव का संदेश ()",
             "SECURITY_SUITE": "सुरक्षित पासवर्ड प्रारूप को सक्षम करता है, पहले लॉगिन के बाद अनिवार्य पासवर्ड रीसेट और 90 दिनों के बाद पासवर्ड की समाप्ति",
-            "MOTIONBARREMEMBERME": "मोशन फोनबार में मुझे याद रखें सुविधा को सक्षम / अक्षम करें"
+            "MOTIONBARREMEMBERME": "मोशन फोनबार में मुझे याद रखें सुविधा को सक्षम / अक्षम करें",
+            "RTLSUPPORT": "अरबी, फारसी और हिब्रू भाषाओं के लिए RTL समर्थन सक्षम करता है"
         },
         "ERRORS": {
             "ADDRESS_REQUIRED": "इस अभिभाषण की आवश्यकता है।",
         "VIRTUAL": "बातचीत",
         "VOICE": "आवाज़",
         "CHATTIMEOUT": "चैट बंद इंटरैक्शन टाइमआउट",
-        "MOTIONBARREMEMBERME": "मुझे याद रखना"
+        "MOTIONBARREMEMBERME": "मुझे याद रखना",
+        "RTLSUPPORT": "RTL सपोर्ट"
     }
 }
\ No newline at end of file
index ce63f3b..397ae0e 100644 (file)
@@ -36,7 +36,8 @@
             "SMTP_PASSWORD": "Kata sandi digunakan untuk otentikasi",
             "SMTP_SECURE": "Jika benar, koneksi ke server akan menggunakan TLS",
             "SMTP_USERNAME": "Nama pengguna digunakan untuk otentikasi",
-            "MOTIONBARREMEMBERME": "Aktifkan / Nonaktifkan fitur Remember Me di Motion Phonebar"
+            "MOTIONBARREMEMBERME": "Aktifkan / Nonaktifkan fitur Remember Me di Motion Phonebar",
+            "RTLSUPPORT": "Mengaktifkan Dukungan RTL untuk bahasa Arab, Persia, dan Ibrani"
         },
         "ACCOUNTNAME": "Nama akun",
         "ADDRESS": "Alamat",
         "VIRTUAL": "Obrolan",
         "VOICE": "Suara",
         "CHATTIMEOUT": "Obrolan menutup batas waktu interaksi",
-        "MOTIONBARREMEMBERME": "Ingat saya"
+        "MOTIONBARREMEMBERME": "Ingat saya",
+        "RTLSUPPORT": "Dukungan RTL"
     }
 }
\ No newline at end of file
index 93072a9..8df40a7 100644 (file)
@@ -1,5 +1,6 @@
 {
     "SETTINGS": {
+        "RTLSUPPORT": "Supporto RTL",
         "PREFERRED": "Preferred Logo",
         "DEFAULT_PREFERRED": "Default Preferred Logo",
         "MOTIONBARREMEMBERME": "Remember Me",
@@ -92,7 +93,8 @@
             "SMTP_PASSWORD": "Password usata per l'autenticazione",
             "EMAILADDRESS": "Specifica l'indirizzo di provenienza del messaggio (da)",
             "SECURITY_SUITE": "Abilita il formato sicuro per le password, il reset della password obbligatorio al primo login e la scadenza della password dopo 90 giorni",
-            "MOTIONBARREMEMBERME": "Abilita/Disabilita la funzione Remember Me della Motion Phonebar"
+            "MOTIONBARREMEMBERME": "Abilita/Disabilita la funzione Remember Me della Motion Phonebar",
+            "RTLSUPPORT": "Abilita il supporto RTL per le lingue araba, persiana ed ebraica"
         },
         "ERRORS": {
             "CHATTIMEOUT_REQUIRED": "Campo obbligatorio",
index 59794af..2d9934f 100644 (file)
@@ -36,7 +36,8 @@
             "SMTP_PASSWORD": "認証に使用されるパスワード",
             "SMTP_SECURE": "trueの場合、TLS を使用してサーバーに接続します",
             "SMTP_USERNAME": "認証に使用されるユーザー名",
-            "MOTIONBARREMEMBERME": "モーションPhonebarのRemember Me機能を有効/無効にする"
+            "MOTIONBARREMEMBERME": "モーションPhonebarのRemember Me機能を有効/無効にする",
+            "RTLSUPPORT": "アラビア語、ペルシャ語、ヘブライ語のRTLサポートを有効にします"
         },
         "ACCOUNTNAME": "アカウント名",
         "ADDRESS": "アドレス",
         "VIRTUAL": "チャット",
         "VOICE": "音声",
         "CHATTIMEOUT": "チャットクローズのインタラクションタイムアウト",
-        "MOTIONBARREMEMBERME": "私を覚えてますか"
+        "MOTIONBARREMEMBERME": "私を覚えてますか",
+        "RTLSUPPORT": "RTLサポート"
     }
 }
\ No newline at end of file
index 88cc70a..093daf4 100644 (file)
@@ -76,7 +76,8 @@
             "SMTP_PASSWORD": "SMTP 비밀번호",
             "EMAILADDRESS": "이메일 주소",
             "SECURITY_SUITE": "적절한 보안",
-            "MOTIONBARREMEMBERME": "Motion Phonebar의 Remember Me 기능 활성화 / 비활성화"
+            "MOTIONBARREMEMBERME": "Motion Phonebar의 Remember Me 기능 활성화 / 비활성화",
+            "RTLSUPPORT": "아랍어, 페르시아어 및 히브리어에 대한 RTL 지원 가능"
         },
         "ERRORS": {
             "ADDRESS_REQUIRED": "주소는 필수입니다.",
         "VIRTUAL": "잡담",
         "VOICE": "목소리",
         "CHATTIMEOUT": "채팅 종료 상호 작용 시간 제한",
-        "MOTIONBARREMEMBERME": "날 기억해"
+        "MOTIONBARREMEMBERME": "날 기억해",
+        "RTLSUPPORT": "RTL 지원"
     }
 }
\ No newline at end of file
index 96f9e05..863b9ef 100644 (file)
@@ -37,7 +37,8 @@
             "SMTP_PASSWORD": "Parole, ko izmanto autentifikācijai",
             "EMAILADDRESS": "Ziņojuma izcelsme \"E-pasta adrese (no)\"",
             "SECURITY_SUITE": "Iespējo drošās paroles formātu, obligāto paroles atiestatīšanu pēc pirmās pieteikšanās un paroles termiņa beigas pēc 90 dienām",
-            "MOTIONBARREMEMBERME": "Aktivizēt/atspējot \"Atcerēties mani\" iespēju Motion tālruņa joslā."
+            "MOTIONBARREMEMBERME": "Aktivizēt/atspējot \"Atcerēties mani\" iespēju Motion tālruņa joslā.",
+            "RTLSUPPORT": "Iespējo RTL atbalstu arābu, persiešu un ebreju valodām"
         },
         "SMTP_SSL": "Protokola SMTP standarts SSL",
         "CALL_RECORDING_ENCRYPTION": "Balss ieraksta šifrēšana",
         "VIRTUAL": "Tērzēšana",
         "VOICE": "Balss",
         "CHATTIMEOUT": "Tērzēšanas slēgšanas mijiedarbības noildze",
-        "MOTIONBARREMEMBERME": "Atcerēties mani"
+        "MOTIONBARREMEMBERME": "Atcerēties mani",
+        "RTLSUPPORT": "RTL atbalsts"
     }
 }
\ No newline at end of file
index edd0a48..bf35edd 100644 (file)
@@ -75,7 +75,8 @@
             "SMTP_PASSWORD": "Het wachtwoord dat wordt gebruikt voor verificatie",
             "EMAILADDRESS": "Geef de oorsprong email adres van het bericht (uit)",
             "SECURITY_SUITE": "Schakelt het veilige wachtwoordformaat in, het verplichte wachtwoord resetten na de eerste keer inloggen en het verlopen van het wachtwoord na 90 dagen",
-            "MOTIONBARREMEMBERME": "Schakel de Remember Me-functie in / uit in Motion Phonebar"
+            "MOTIONBARREMEMBERME": "Schakel de Remember Me-functie in / uit in Motion Phonebar",
+            "RTLSUPPORT": "Schakelt de RTL-ondersteuning in voor Arabische, Perzische en Hebreeuwse talen"
         },
         "ERRORS": {
             "ADDRESS_REQUIRED": "Het adres is vereist.",
         "VIRTUAL": "babbelen",
         "VOICE": "Stem",
         "CHATTIMEOUT": "Time-out voor chat-sluiting",
-        "MOTIONBARREMEMBERME": "Onthoud mij"
+        "MOTIONBARREMEMBERME": "Onthoud mij",
+        "RTLSUPPORT": "RTL-ondersteuning"
     }
 }
\ No newline at end of file
index 90de048..a709e5b 100644 (file)
@@ -76,7 +76,8 @@
             "SMTP_PASSWORD": "Passordet som brukes til godkjenning",
             "EMAILADDRESS": "Angi opprinnelse e-postadresse til meldingen (fra)",
             "SECURITY_SUITE": "Aktiverer sikker passordformat, obligatorisk tilbakestilling av passord etter første innlogging og passordets utløp etter 90 dager",
-            "MOTIONBARREMEMBERME": "Aktiver / deaktiver funksjonen Husk meg i Motion Phonebar"
+            "MOTIONBARREMEMBERME": "Aktiver / deaktiver funksjonen Husk meg i Motion Phonebar",
+            "RTLSUPPORT": "Aktiverer RTL-støtte for arabisk, persisk og hebraisk"
         },
         "ERRORS": {
             "ADDRESS_REQUIRED": "Adressen er nødvendig",
         "VIRTUAL": "Chat",
         "VOICE": "Stemme",
         "CHATTIMEOUT": "Chat avsluttende interaksjon timeout",
-        "MOTIONBARREMEMBERME": "Husk meg"
+        "MOTIONBARREMEMBERME": "Husk meg",
+        "RTLSUPPORT": "RTL Support"
     }
 }
\ No newline at end of file
index c7c4ab8..240b9ec 100644 (file)
@@ -76,7 +76,8 @@
             "SMTP_PASSWORD": "Hasło używane do uwierzytelniania",
             "EMAILADDRESS": "Wiadomość pochodzenie adres email (z)",
             "SECURITY_SUITE": "Włącza bezpieczny format hasła, obowiązkowe resetowanie hasła po pierwszym zalogowaniu i wygaśnięcie hasła po 90 dniach",
-            "MOTIONBARREMEMBERME": "Włącz / wyłącz funkcję Zapamiętaj mnie w Ruchomy pasek telefonu"
+            "MOTIONBARREMEMBERME": "Włącz / wyłącz funkcję Zapamiętaj mnie w Ruchomy pasek telefonu",
+            "RTLSUPPORT": "Włącza obsługę RTL dla języków arabskiego, perskiego i hebrajskiego"
         },
         "ERRORS": {
             "ADDRESS_REQUIRED": "Pole obowiązkowe",
         "VIRTUAL": "Czat",
         "VOICE": "Głos",
         "CHATTIMEOUT": "Czas zamknięcia interakcji z czatem",
-        "MOTIONBARREMEMBERME": "Zapamiętaj mnie"
+        "MOTIONBARREMEMBERME": "Zapamiętaj mnie",
+        "RTLSUPPORT": "Wsparcie RTL"
     }
 }
\ No newline at end of file
index e25ed32..c420a69 100644 (file)
             "SMTP_PASSWORD": "Senha usada para autenticação",
             "EMAILADDRESS": "A origem da mensagem Endereço de email (de)",
             "SECURITY_SUITE": "Habilita o formato de senha segura, a redefinição obrigatória da senha após o primeiro login e a expiração da senha após 90 dias",
-            "MOTIONBARREMEMBERME": "Ativar / desativar o recurso Lembrar-me no Motion Phonebar"
+            "MOTIONBARREMEMBERME": "Ativar / desativar o recurso Lembrar-me no Motion Phonebar",
+            "RTLSUPPORT": "Ativa o suporte RTL para os idiomas árabe, persa e hebraico"
         },
         "ERRORS": {
             "CHATTIMEOUT_REQUIRED": "Campo obrigatório",
         "AGENTOMNIDESKTOPINTERFACE": "Interface do Omni Desktop do agente",
         "MESSAGESALIGNMENT": "Alinhamento de Mensagens",
         "ENTER_LICENSE": "Digite sua licença",
-        "UPDATE_LICENSE_MANUALLY": "Você quer atualizar sua licença manualmente?"
+        "UPDATE_LICENSE_MANUALLY": "Você quer atualizar sua licença manualmente?",
+        "RTLSUPPORT": "Suporte RTL"
     }
 }
\ No newline at end of file
index 49853b8..81a1dc7 100644 (file)
@@ -76,7 +76,8 @@
             "SMTP_PASSWORD": "Senha usada para a autenticação",
             "EMAILADDRESS": "Especifique o endereço de correio electrónico de origem da mensagem (de)",
             "SECURITY_SUITE": "Ativa o formato de senha segura, a redefinição obrigatória da senha após o primeiro login e a expiração da senha após 90 dias",
-            "MOTIONBARREMEMBERME": "Ativar / desativar o recurso Lembrar-me no Motion Phonebar"
+            "MOTIONBARREMEMBERME": "Ativar / desativar o recurso Lembrar-me no Motion Phonebar",
+            "RTLSUPPORT": "Ativa o suporte RTL para os idiomas árabe, persa e hebraico"
         },
         "ERRORS": {
             "ADDRESS_REQUIRED": "O endereço é obrigatório",
         "VIRTUAL": "Bate-papo",
         "VOICE": "Voz",
         "CHATTIMEOUT": "Tempo limite de interação de fechamento de bate-papo",
-        "MOTIONBARREMEMBERME": "Lembre de mim"
+        "MOTIONBARREMEMBERME": "Lembre de mim",
+        "RTLSUPPORT": "Suporte RTL"
     }
 }
\ No newline at end of file
index 35e3dbc..4a7201d 100644 (file)
@@ -76,7 +76,8 @@
             "SMTP_PASSWORD": "Пароль используется для проверки подлинности",
             "EMAILADDRESS": "Укажите происхождения адрес электронной почты сообщение (С).",
             "SECURITY_SUITE": "Включает безопасный формат пароля, обязательный сброс пароля после первого входа и истечения срока действия пароля через 90 дней",
-            "MOTIONBARREMEMBERME": "Включить / отключить функцию «Запомнить меня» в телефонной панели Motion"
+            "MOTIONBARREMEMBERME": "Включить / отключить функцию «Запомнить меня» в телефонной панели Motion",
+            "RTLSUPPORT": "Включает поддержку RTL для арабского, персидского и иврита"
         },
         "ERRORS": {
             "ADDRESS_REQUIRED": "Адрес не требуется",
         "VIRTUAL": "чат",
         "VOICE": "голос",
         "CHATTIMEOUT": "Тайм-аут при закрытии чата",
-        "MOTIONBARREMEMBERME": "Запомни меня"
+        "MOTIONBARREMEMBERME": "Запомни меня",
+        "RTLSUPPORT": "Поддержка RTL"
     }
 }
\ No newline at end of file
index 0b70451..98e33ae 100644 (file)
@@ -76,7 +76,8 @@
             "SMTP_PASSWORD": "Lösenord används för autentisering",
             "EMAILADDRESS": "Ange ursprunget e-postadress meddelande (från)",
             "SECURITY_SUITE": "Aktiverar det säkra lösenordsformatet, den obligatoriska lösenordsåterställning efter den första inloggningen och lösenordsförloppet efter 90 dagar",
-            "MOTIONBARREMEMBERME": "Aktivera / inaktivera funktionen Kom ihåg mig i Motion Phonebar"
+            "MOTIONBARREMEMBERME": "Aktivera / inaktivera funktionen Kom ihåg mig i Motion Phonebar",
+            "RTLSUPPORT": "Aktiverar RTL-stödet för arabiska, persiska och hebreiska språk"
         },
         "ERRORS": {
             "ADDRESS_REQUIRED": "Adressen är obligatoriskt",
         "VIRTUAL": "Chatt",
         "VOICE": "Röst",
         "CHATTIMEOUT": "Chatt stänger interaktion timeout",
-        "MOTIONBARREMEMBERME": "Kom ihåg mig"
+        "MOTIONBARREMEMBERME": "Kom ihåg mig",
+        "RTLSUPPORT": "RTL Support"
     }
 }
\ No newline at end of file
index c935245..ca3f8c2 100644 (file)
@@ -76,7 +76,8 @@
             "SMTP_PASSWORD": "Parola kimlik doğrulaması için kullanılan",
             "EMAILADDRESS": "Belirleyin, kaynak e-posta adresi mesaj (en)",
             "SECURITY_SUITE": "Güvenli şifre formatını, ilk girişten sonra zorunlu şifre sıfırlama işlemini ve 90 gün sonra şifre geçerliliğini etkinleştirir.",
-            "MOTIONBARREMEMBERME": "Motion Phonebar'daki Beni Hatırla özelliğini etkinleştir / devre dışı bırak"
+            "MOTIONBARREMEMBERME": "Motion Phonebar'daki Beni Hatırla özelliğini etkinleştir / devre dışı bırak",
+            "RTLSUPPORT": "Arapça, Farsça ve İbranice dilleri için RTL Desteğini etkinleştirir"
         },
         "ERRORS": {
             "ADDRESS_REQUIRED": "Bu Adresi gerekli",
         "VIRTUAL": "Sohbet",
         "VOICE": "ses",
         "CHATTIMEOUT": "Sohbet kapanış etkileşim zaman aşımı",
-        "MOTIONBARREMEMBERME": "Beni Hatırla"
+        "MOTIONBARREMEMBERME": "Beni Hatırla",
+        "RTLSUPPORT": "RTL Desteği"
     }
 }
\ No newline at end of file
index 03fa3a3..34dce48 100644 (file)
@@ -76,7 +76,8 @@
             "SMTP_PASSWORD": "用于验证的密码",
             "EMAILADDRESS": "指定原始电子邮件地址的信息(从)",
             "SECURITY_SUITE": "启用安全密码格式,第一次登录后强制密码重置,90天后密码过期",
-            "MOTIONBARREMEMBERME": "在Motion Phonebar中启用/禁用“记住我”功能"
+            "MOTIONBARREMEMBERME": "在Motion Phonebar中启用/禁用“记住我”功能",
+            "RTLSUPPORT": "支持阿拉伯语,波斯语和希伯来语的RTL支持"
         },
         "ERRORS": {
             "ADDRESS_REQUIRED": "该地址是必填项",
         "VIRTUAL": "聊",
         "VOICE": "语音",
         "CHATTIMEOUT": "聊天关闭交互超时",
-        "MOTIONBARREMEMBERME": "记住账号"
+        "MOTIONBARREMEMBERME": "记住账号",
+        "RTLSUPPORT": "RTL支持"
     }
 }
\ No newline at end of file
index 186992a..de71cf8 100644 (file)
@@ -76,7 +76,8 @@
             "SMTP_PASSWORD": "使用密碼進行驗證",
             "EMAILADDRESS": "指定電子郵件地址的訊息的來源 ( 自 )",
             "SECURITY_SUITE": "啟用安全密碼格式,第一次登錄後強制密碼重置以及90天后密碼過期",
-            "MOTIONBARREMEMBERME": "在Motion Phonebar中啟用/禁用“記住我”功能"
+            "MOTIONBARREMEMBERME": "在Motion Phonebar中啟用/禁用“記住我”功能",
+            "RTLSUPPORT": "支持阿拉伯語,波斯語和希伯來語的RTL支持"
         },
         "ERRORS": {
             "ADDRESS_REQUIRED": "地址為必填欄位",
         "VIRTUAL": "聊",
         "VOICE": "語音",
         "CHATTIMEOUT": "聊天關閉交互超時",
-        "MOTIONBARREMEMBERME": "記住賬號"
+        "MOTIONBARREMEMBERME": "記住賬號",
+        "RTLSUPPORT": "RTL支持"
     }
 }
\ No newline at end of file
index 42edbdf..114d565 100644 (file)
         "ACCEPTMETHOD": "שיטת קבלה",
         "ACCEPTURL": "קבל כתובת URL",
         "REJECT": "דחה",
-        "REJECTMETHOD": "שיטת דחייה",
+        "REJECTMETHOD": "דחה שיטה",
         "REJECTURL": "דחה כתובת URL",
         "CLOSE": "סגור",
         "CLOSEMETHOD": "שיטת סגירה",
             "LIST": "רשימת 'מנהל אנשי הקשר' המשמשת לשיוך אנשי קשר",
             "RECEIVEURL": "מחרוזת ה-API המופקת באופן אוטומטי שדרושה לך כדי לקבל מספק ה-SMS את ההודעות שבחשבונך (חובה להשתמש בשיטת POST): לחץ על לחצן הלוח כדי להעתיק אותה",
             "DELIVERYREPORTURL": "מחרוזת ה-API המופקת באופן אוטומטי שדרושה לך כדי לקבל מספק ה-SMS את דוח המסירה על הודעות שנשלחו (חובה להשתמש בשיטת POST): לחץ על לחצן הלוח כדי להעתיק אותה",
-            "MANDATORYDISPOSITION": "נטייה חובה",
-            "MANDATORYDISPOSITIONPAUSEID": "השהה לשימוש כאשר פעולת התנהגות חובה מופעלת"
+            "MANDATORYDISPOSITION": "סיכום",
+            "MANDATORYDISPOSITIONPAUSEID": "השהה לשימוש כאשר הסיכום מופעל"
         },
         "PAGE": "דף",
         "ROWSPERPAGE": "שורות בדף",
         "GOTOIF": "GotoIf",
         "NOOP": "Noop",
         "QUEUE": "תור",
-        "TIMEOUT": "זמן קצוב",
+        "TIMEOUT": "סוף זמן קצוב",
         "VALUE": "ערך",
         "EDIT_AGENT": "ערוך נציג",
         "EDIT_GOTO": "ערוך פריט Goto",
         "EDIT_GOTOIF": "ערוך פריט GotoIf",
         "EDIT_QUEUE": "ערוך תור",
         "CONDITION": "תנאי",
-        "TRUEPRIORITY": "עדיפות TRUE",
-        "FALSEPRIORITY": "עדיפות FALSE",
+        "TRUEPRIORITY": "עדיפות חיובי",
+        "FALSEPRIORITY": "עדיפות שלילי",
         "PRIORITY": "עדיפות",
         "GOTOP": "Gotop",
         "EDIT_GOTOP": "ערוך פריט Gotop",
         "APIKEY": "ApiKey",
         "BASEURL": "כתובת אתר בסיסית",
         "TEAMS_ASSOCIATION": "איגוד הצוותים",
-        "MANDATORYDISPOSITION": "נטייה חובה",
-        "MANDATORYDISPOSITIONPAUSEID": "השהה לשימוש כאשר פעולת התנהגות חובה מופעלת"
+        "MANDATORYDISPOSITION": "סיכום",
+        "MANDATORYDISPOSITIONPAUSEID": "השהה לשימוש כאשר הסיכום מופעל"
     }
 }
\ No newline at end of file
index 8ee4f36..fd010ad 100644 (file)
         "ADD_TELEPHONE": "הוסף טלפון",
         "EDIT_TELEPHONE": "ערוך טלפון",
         "DELETE_TELEPHONE": "מחק טלפון",
-        "TEAMS": "הצוותים",
+        "TEAMS": "צוותים",
         "DELETE_TEAM": "מחק צוות",
         "AGENTADD_TEAM": "הוסף נציגים לצוות",
         "EDIT_TEAM": "ערוך צוות",
         "ADD_AGENT_TO_QUEUE": "הוסף נציג לתור",
         "ALL_MODULES_AVAILABLE": "כל המודולים זמינים",
         "CALLGROUP": "קבוצת שיחה",
-        "PICKUPGROUP": "בחר קבוצה",
+        "PICKUPGROUP": "בחירת קבוצה",
         "QUEUEADD_AGENT_VOICE_OUTBOUND": "הוסף נציג למבצעי תורים",
         "QUEUEADD_AGENT_VOICE_INBOUND": "הוסף נציג לתורי קול",
         "QUEUEADD_AGENT_CHAT_INBOUND": "הוסף נציג לתורי צ'אט",
         "SELECTED_QUEUES_MAIL_INBOUND": "תורי דוא\"ל נבחרים",
         "ALL_QUEUES_SMS_INBOUND": "כל תורי ה-SMS",
         "SELECTED_QUEUES_SMS_INBOUND": "תורי SMS נבחרים",
-        "ALL_QUEUES_OPENCHANNEL_INBOUND": "כל תורי ערוצים פתוחים",
+        "ALL_QUEUES_OPENCHANNEL_INBOUND": "כל תורי הערוצים הפתוחים",
         "SELECTED_QUEUES_OPENCHANNEL_INBOUND": "תורי ערוצים פתוחים נבחרים",
         "ALL_QUEUES_FAX_INBOUND": "כל תורי הפקס",
         "SELECTED_QUEUES_FAX_INBOUND": "תורי פקס נבחרים",
         "ALL_FAXQUEUES": "כל תורי הפקס",
         "SELECTED_FAXQUEUES": "תורי פקס נבחרים",
         "USERADD_OPENCHANNELQUEUES": "הוסף תור ערוצים פתוחים למשתמש",
-        "ALL_OPENCHANNELQUEUES": "כל תורי ערוצים פתוחים",
+        "ALL_OPENCHANNELQUEUES": "כל תורי הערוצים הפתוחים",
         "SELECTED_OPENCHANNELQUEUES": "תורי ערוצים פתוחים נבחרים",
         "USERADD_PROJECTS": "הוסף פרויקט Cally Square למשתמש",
         "ALL_PROJECTS": "כל הפרויקטים של Cally Square",
         "ALL_SMSACCOUNTS": "כל חשבונות ה-SMS",
         "SELECTED_SMSACCOUNTS": "חשבונות SMS נבחרים",
         "USERADD_OPENCHANNELACCOUNTS": "הוסף חשבון ערוצים פתוחים למשתמש",
-        "ALL_OPENCHANNELACCOUNTS": "כל חשבונות ערוצים פתוחים",
+        "ALL_OPENCHANNELACCOUNTS": "כל חשבונות הערוצים הפתוחים",
         "SELECTED_OPENCHANNELACCOUNTS": "חשבונות ערוצים פתוחים נבחרים",
         "ADD_USERPROFILE": "הוסף פרופיל משתמש",
         "CANCEL": "בטל",
-        "CLONE_USERPROFILE": "פרופיל משתמש משובט",
-        "CLOSE": "קרוב",
+        "CLONE_USERPROFILE": "פרופיל משתמש משוכפל",
+        "CLOSE": "סגור",
         "CONFIRM": "אשר",
         "CRUDPERMISSIONS": "סוג הרשאה",
         "DELETE_PERMISSION": "מחק",
index 26ef364..dea0de2 100644 (file)
@@ -1,19 +1,19 @@
 {
     "TOOLS": {
         "BOT": "בוט קולי",
-        "CLONE_TRUNK": "שבט קו ראשי",
+        "CLONE_TRUNK": "שכפל קו ראשי",
         "DISPOSITIONS": "פריסות",
         "NEW_DISPOSITION": "פריסה חדשה",
         "ADD_DISPOSITION": "הוסף פריסה",
         "EDIT_DISPOSITION": "ערוך פריסה",
         "DELETE_DISPOSITION": "מחק פריסה",
-        "RUN_SCHEDULE": "הרץ לוח זמנים",
+        "RUN_SCHEDULE": "הרץ  לפי לוח הזמנים",
         "SENDIFEMPTY": "שלח אם ריק",
         "NEXTCONTACT": "הבא",
         "OUTBOUND_ROUTE": "נתיב יוצא",
         "EDIT_DASHBOARDITEM": "ערוך יישומון לוח מחוונים",
         "FONTSIZE": "גודל גופן",
-        "CLONE_CUSTOMDASHBOARD": "שבט לוח מחוונים מותאם",
+        "CLONE_CUSTOMDASHBOARD": "שכפל לוח מחוונים מותאם",
         "LINK": "קישור [\200ehttps://]",
         "BACKGROUND": "רקע",
         "FOREGROUND": "קדמה",
         "OUTBOUNDPROXY": "פרוקסי יוצא",
         "ADD_PHONE_TO_URI": "הוסף טלפון לכתובת URL",
         "TRUST_REMOTE_PARTY_ID": "תן אמון במזהה צד מרוחק",
-        "SEND_REMOTE_PARTY_ID_HEADER": "שלח כותרת ראשית של מזהה צד מרוחק",
+        "SEND_REMOTE_PARTY_ID_HEADER": "שלח כותרת של מזהה צד מרוחק",
         "ENCRYPTION": "הצפנה",
         "PORT": "יציאה",
         "TRANSPORT": "העברה",
         "ADD_INTERVAL": "הוסף מרווח זמן",
         "TOOLS": "כלים",
         "ID": "מזהה",
-        "AUDIO": "אודיו",
+        "AUDIO": "שמע",
         "DOWNLOAD_SOUND": "הורד צליל",
         "UPLOAD_SOUND": "כלים",
         "CHANNEL": "ערוץ",
         "WEEK_DAYS": "ימות השבוע",
         "MONTH_DAYS": "ימים בחודש",
         "MONTHS": "חודשים",
-        "DROP_TO_UPLOAD_MESSAGE": "שחרר קובצי אודיו כאן כדי להעלות אתם. רק MP3\200f, WAV\200f, GSM \200f– מקס' 15MB",
+        "DROP_TO_UPLOAD_MESSAGE": "שחרר קובצי שמע כאן כדי להעלות אתם. רק MP3\200f, WAV\200f, GSM \200f– מקס' 15MB",
         "POLLING_INTERVAL": "מרווח תשאול (שניות)",
         "DASHBOARD": "לוח מחוונים",
         "NEW_DASHBOARDITEM": "יישומון לוח מחוונים חדש",
         "WINDOWWIDTH": "רוחב חלון (פיקסלים)",
         "WINDOWHEIGHT": "גובה חלון (פיקסלים)",
         "BODY": "גוף",
-        "REPORTFOLDER": "דווח על תיקייה",
-        "REPORTSUBFOLDER": "דווח על תיקיית משנה",
+        "REPORTFOLDER": "תיקיית דוח",
+        "REPORTSUBFOLDER": "תיקיית משנה של הדוח",
         "PREVIOUSCONTACT": "קודם",
         "VIDEOSUPPORT": "תמיכה בווידיאו"
     }
index bec2e17..8ce9d83 100644 (file)
@@ -2,7 +2,7 @@
     "VOICE": {
         "LOGIN_TIME": "שעת כניסה",
         "PAUSE_TIME": "שעת השהיה",
-        "ABANDONEDCALLS": "שיחות שננטשו",
+        "ABANDONEDCALLS": "תור שיחות שננטשו",
         "WAITING_FOR_AGENTS": "בהמתנה לנציגים",
         "ACTIVE": "פעיל",
         "NO_AGENT_ONLINE": "אין נציג מקוון",
@@ -83,7 +83,7 @@
             "MANDATORYDISPOSITIONPAUSEID_REQUIRED": "שדה חובה"
         },
         "GENERAL": "כללי",
-        "TIMEOUT": "זמן קצוב",
+        "TIMEOUT": "סוף זמן קצוב",
         "MAXLENGTH": "אורך מרבי",
         "RETRY": "נסה שוב",
         "WRAPUPTIME": "משך סיכום",
         "THANKYOUANNOUNCE": "הכרזת 'תודה רבה'",
         "AUTOPAUSE": "השהיה אוטומטית",
         "AFTERCALLWORK": "עבודה לאחר שיחה",
-        "AFTERCALLWORKDURATION": "משך עבודה לאחר שיחה",
+        "AFTERCALLWORKDURATION": "משך זמן עבודה לאחר שיחה",
         "RINGINUSE": "הצלצול שבשימוש",
         "MEMBERDELAY": "השהיית הנציג",
         "TIMEOUTRESTART": "זמן קצוב להפעלה מחדש",
         "EDIT_MUSICONHOLD": "ערוך מוזיקה להמתנה",
         "DELETE_MUSICONHOLD": "מחק מוזיקה להמתנה",
         "DIRECTORY": "ספרייה",
-        "AUDIOFILES": "קובצי אודיו",
+        "AUDIOFILES": "קובצי שמע",
         "RECORDINGS": "הקלטות",
         "CHANSPY": "ChanSpy",
         "PREFIX": "קידומת",
         "USER": "משתמש",
         "TRUNK": "קו ראשי",
         "PHONE": "טלפון",
-        "AUDIO_FILES": "קובצי אודיו",
+        "AUDIO_FILES": "קובצי שמע",
         "ANNOUNCE_OVERRIDES": "עקיפת הודעות",
         "MACRO": "מאקרו",
         "GOSUB": "GoSub",
         "AGENT": "נציג",
         "TYPE": "סוג",
         "RATING": "דירוג",
-        "AUDIO": "אודיו",
+        "AUDIO": "שמע",
         "DATE": "תאריך",
         "NEW_VOICEQUEUE": "תור קול חדש",
         "NEW_INBOUNDROUTE": "נתיב נכנס חדש",
         "CALLER": "מתקשר",
         "TOTAL": "סה\"כ",
         "ANSWERED": "נענה",
-        "ABANDONED": "ננטש",
+        "ABANDONED": "ננטשו",
         "UNMANAGED": "לא מנוהלות",
         "AVG_HOLD_TIME": "ממוצע זמן המתנה",
         "AVG_DURATION": "משך ממוצע",
         "DIALER": "חייגן",
         "INBOUND": "נכנס",
         "OUTBOUND": "יוצא",
-        "MANDATORYDISPOSITION": "נטייה חובה",
-        "MANDATORYDISPOSITIONPAUSEID": "מצב השהיית חובה"
+        "MANDATORYDISPOSITION": "סיכום",
+        "MANDATORYDISPOSITIONPAUSEID": "מצב השהייה בסיכום"
     }
 }
\ No newline at end of file
index 1f85fc2..7092a60 100644 (file)
         "ACTIVITY": "פעילות",
         "FRIENDS": "חברים",
         "APP_SERVERS": "שרתי יישומים",
-        "USER_STATS": "נתונים סטטיסטיים אחרים",
+        "USER_STATS": "נתונים סטטיסטיים של המשתמש",
         "EVENTS": "אירועים",
         "NOTES": "פתקים ורשימות",
         "QUICK_SETTINGS": "הגדרות מהירות",
         "NOTIFICATIONS": "הודעות",
         "CLOUD_SYNC": "סנכרון עם הענן",
-        "RETRO_THRUSTERS": "מנועי דחיפה",
+        "RETRO_THRUSTERS": "מדחפים",
         "RECENT": "אחרונים",
         "START_NEW_CHAT": "התחל צ'אט חדש",
         "BACK": "חזרה",
index 80b3d8a..fd55f6e 100644 (file)
@@ -1,14 +1,14 @@
 {
     "RESETPASSWORD": {
-        "TITLE": "כותרת",
+        "TITLE": "אפס סיסמה",
         "EMAIL_ADRESS": "כתובת דוא\"ל",
         "PASSWORD": "סיסמה",
-        "PASSWORD_CONFIRM": "אישור סיסמא",
-        "UPDATE_PASSWORD": "עדכון סיסמא",
-        "GO_BACK": "חזור אחורה",
+        "PASSWORD_CONFIRM": "סיסמה (אישור)",
+        "UPDATE_PASSWORD": "אפס סיסמה",
+        "GO_BACK": "חזור לדף הכניסה",
         "PASSWORD_RESET": "איפוס סיסמה",
-        "PASSWORD_RESET_MESSAGE": "הודעת איפוס סיסמא",
-        "PASSWORD_RESET_ERROR": "שגיאה באיפוס סיסמה",
+        "PASSWORD_RESET_MESSAGE": "סיסמתך אופסה בהצלחה. ניתן להכנס עכשיו!",
+        "PASSWORD_RESET_ERROR": "שגיאה באיפוס הסיסמה",
         "ERRORS": {
             "EMAIL_REQUIRED": "דוא\"ל הוא שדה חובה",
             "EMAIL_MUST_VALID": "חובה לציין כתובת דוא\"ל חוקית",
index 262a564..24440fc 100644 (file)
@@ -91,6 +91,8 @@
         "ESTONIAN": "الإستونية",
         "CZECH": "تشيكي",
         "BRAZILIAN": "برازيلي",
-        "CONFERENCE": "المؤتمر مع 2 جلسات نشطة"
+        "CONFERENCE": "المؤتمر مع 2 جلسات نشطة",
+        "CHANGE_LANGUAGE_MESSAGE": "تذكر أن تقوم بتحديث الصفحة لتطبيق دعم RTL (في حالة التمكين)",
+        "CHANGE_LANGUAGE_TITLE": "غير اللغة"
     }
 }
\ No newline at end of file
index f75e7e7..202df64 100644 (file)
@@ -91,6 +91,8 @@
         "ESTONIAN": "estisk",
         "CZECH": "tjekkisk",
         "BRAZILIAN": "brasiliansk",
-        "CONFERENCE": "Konference med 2 aktive sessioner"
+        "CONFERENCE": "Konference med 2 aktive sessioner",
+        "CHANGE_LANGUAGE_MESSAGE": "Husk at opdatere siden for at anvende RTL Support (hvis aktiveret)",
+        "CHANGE_LANGUAGE_TITLE": "Skift sprog"
     }
 }
\ No newline at end of file
index 4e1cbcb..265b912 100644 (file)
@@ -91,6 +91,8 @@
         "ESTONIAN": "estnisch",
         "CZECH": "Tschechisch",
         "BRAZILIAN": "Brasilianer",
-        "CONFERENCE": "Konferenz mit 2 aktiven Sessions"
+        "CONFERENCE": "Konferenz mit 2 aktiven Sessions",
+        "CHANGE_LANGUAGE_MESSAGE": "Denken Sie daran, die Seite zu aktualisieren, um die RTL-Unterstützung anzuwenden (falls aktiviert).",
+        "CHANGE_LANGUAGE_TITLE": "Sprache ändern"
     }
 }
\ No newline at end of file
index d666df6..92525d7 100644 (file)
@@ -1,5 +1,7 @@
 {
     "TOOLBAR": {
+        "CHANGE_LANGUAGE_TITLE": "Change language",
+        "CHANGE_LANGUAGE_MESSAGE": "Remember to refresh the page to apply RTL Support (if enabled)",
         "HEBREW": "Hebrew",
         "PREFIXES": "Prefixes",
         "CALL": "Call",
index f487d9e..a16561d 100644 (file)
@@ -91,6 +91,8 @@
         "ESTONIAN": "Estonio",
         "CZECH": "checo",
         "BRAZILIAN": "brasileño",
-        "CONFERENCE": "Conferencia con 2 sesiones activas."
+        "CONFERENCE": "Conferencia con 2 sesiones activas.",
+        "CHANGE_LANGUAGE_MESSAGE": "Recuerde actualizar la página para aplicar el soporte RTL (si está habilitado)",
+        "CHANGE_LANGUAGE_TITLE": "Cambiar idioma"
     }
 }
\ No newline at end of file
index c0c0dc3..6339469 100644 (file)
@@ -91,6 +91,8 @@
         "ESTONIAN": "استونیایی",
         "CZECH": "کشور چک",
         "BRAZILIAN": "برزیلی",
-        "CONFERENCE": "همایش با 2 جلسه فعال"
+        "CONFERENCE": "همایش با 2 جلسه فعال",
+        "CHANGE_LANGUAGE_MESSAGE": "به یاد داشته باشید که صفحه را برای استفاده از پشتیبانی RTL تازه کنید (در صورت فعال بودن)",
+        "CHANGE_LANGUAGE_TITLE": "تغییر زبان"
     }
 }
\ No newline at end of file
index 24f0c3b..6b8b27f 100644 (file)
@@ -91,6 +91,8 @@
         "ESTONIAN": "Virolainen",
         "CZECH": "czech",
         "BRAZILIAN": "brasilialainen",
-        "CONFERENCE": "Konferenssi, 2 aktiivista istuntoa"
+        "CONFERENCE": "Konferenssi, 2 aktiivista istuntoa",
+        "CHANGE_LANGUAGE_MESSAGE": "Muista päivittää sivu soveltaaksesi RTL-tukea (jos käytössä)",
+        "CHANGE_LANGUAGE_TITLE": "Vaihda kieltä"
     }
 }
\ No newline at end of file
index 963edaa..3db5021 100644 (file)
@@ -91,6 +91,8 @@
         "ESTONIAN": "estonien",
         "CZECH": "tchèque",
         "BRAZILIAN": "brésilien",
-        "CONFERENCE": "Conférence avec 2 sessions actives"
+        "CONFERENCE": "Conférence avec 2 sessions actives",
+        "CHANGE_LANGUAGE_MESSAGE": "N'oubliez pas d'actualiser la page pour appliquer le support RTL (si activé)",
+        "CHANGE_LANGUAGE_TITLE": "Changer de langue"
     }
 }
\ No newline at end of file
index 146e2ae..10edaa1 100644 (file)
@@ -1,6 +1,6 @@
 {
     "TOOLBAR": {
-        "HEBREW": "Hebrew",
+        "HEBREW": "עברית",
         "PREFIXES": "קידומות",
         "CALL": "שיחה",
         "ARABIC": "ערבית",
@@ -36,8 +36,8 @@
         "NAME": "שם",
         "INTERNAL": "פנימי",
         "RINGINGDEVICE": "המכשיר המצלצל",
-        "SPEAKERDEVICE": "המכשיר עם הרמקול",
-        "MICROPHONEDEVICE": "המכשיר עם המיקרופון",
+        "SPEAKERDEVICE": "מכשיר עם רמקול",
+        "MICROPHONEDEVICE": "מכשיר עם מיקרופון",
         "CHANGEPASSWORD": "החלף סיסמה",
         "SETTINGS": "הגדרות",
         "AUTOANSWER": "מענה אוטומטי",
@@ -91,6 +91,8 @@
         "BRAZILIAN": "ברזילאית",
         "CZECH": "צ'כית",
         "ESTONIAN": "אסטונית",
-        "CONFERENCE": "כנס עם 2 מפגשים פעילים"
+        "CONFERENCE": "כנס עם 2 מפגשים פעילים",
+        "CHANGE_LANGUAGE_MESSAGE": "זכור לרענן את הדף ליישום תמיכה ב- RTL (אם מופעל)",
+        "CHANGE_LANGUAGE_TITLE": "שנה שפה"
     }
 }
\ No newline at end of file
index a398a9e..798d55f 100644 (file)
@@ -91,6 +91,8 @@
         "ESTONIAN": "एस्तोनियावासी",
         "CZECH": "चेक",
         "BRAZILIAN": "ब्राजील",
-        "CONFERENCE": "2 सक्रिय सत्रों के साथ सम्मेलन"
+        "CONFERENCE": "2 सक्रिय सत्रों के साथ सम्मेलन",
+        "CHANGE_LANGUAGE_MESSAGE": "RTL समर्थन लागू करने के लिए पृष्ठ को रीफ्रेश करना याद रखें (यदि सक्षम है)",
+        "CHANGE_LANGUAGE_TITLE": "भाषा बदलो"
     }
 }
\ No newline at end of file
index dd17b7b..dbf215a 100644 (file)
@@ -91,6 +91,8 @@
         "ESTONIAN": "Estonia",
         "CZECH": "Ceko",
         "BRAZILIAN": "Brazil",
-        "CONFERENCE": "Konferensi dengan 2 sesi aktif"
+        "CONFERENCE": "Konferensi dengan 2 sesi aktif",
+        "CHANGE_LANGUAGE_MESSAGE": "Ingatlah untuk menyegarkan halaman untuk menerapkan Dukungan RTL (jika diaktifkan)",
+        "CHANGE_LANGUAGE_TITLE": "Ganti BAHASA"
     }
 }
\ No newline at end of file
index 5feaafa..efb182e 100644 (file)
@@ -91,6 +91,8 @@
         "BRAZILIAN": "Brasiliano",
         "ESTONIAN": "Estone",
         "CZECH": "Ceco",
-        "CONFERENCE": "Conferenza con 2 sessioni attive"
+        "CONFERENCE": "Conferenza con 2 sessioni attive",
+        "CHANGE_LANGUAGE_MESSAGE": "Ricorda di aggiornare la pagina per applicare il supporto RTL (se abilitato)",
+        "CHANGE_LANGUAGE_TITLE": "Cambia lingua"
     }
 }
\ No newline at end of file
index d81b05c..3df240a 100644 (file)
@@ -91,6 +91,8 @@
         "ESTONIAN": "エストニア語",
         "CZECH": "チェコ語",
         "BRAZILIAN": "ブラジル人",
-        "CONFERENCE": "2つのアクティブセッションでの会議"
+        "CONFERENCE": "2つのアクティブセッションでの会議",
+        "CHANGE_LANGUAGE_MESSAGE": "RTLサポートを適用するには、ページを更新してください(有効な場合)",
+        "CHANGE_LANGUAGE_TITLE": "言語を変えてください"
     }
 }
\ No newline at end of file
index b547bf3..a23135b 100644 (file)
@@ -91,6 +91,8 @@
         "ESTONIAN": "에스토니아 사람",
         "CZECH": "체코 사람",
         "BRAZILIAN": "브라질 사람",
-        "CONFERENCE": "2 개의 활성 세션이있는 회의"
+        "CONFERENCE": "2 개의 활성 세션이있는 회의",
+        "CHANGE_LANGUAGE_MESSAGE": "RTL 지원을 적용하려면 페이지를 새로 고쳐야합니다 (활성화 된 경우)",
+        "CHANGE_LANGUAGE_TITLE": "언어 변경"
     }
 }
\ No newline at end of file
index 80c2e3b..ee3823a 100644 (file)
@@ -91,6 +91,8 @@
         "ESTONIAN": "Igauņu",
         "CZECH": "Čehu valodā",
         "BRAZILIAN": "Brazīlijas",
-        "CONFERENCE": "Konference ar 2 aktīvām sesijām"
+        "CONFERENCE": "Konference ar 2 aktīvām sesijām",
+        "CHANGE_LANGUAGE_MESSAGE": "Atcerieties atsvaidzināt lapu, lai lietotu RTL atbalstu (ja iespējots)",
+        "CHANGE_LANGUAGE_TITLE": "Mainīt VALODU"
     }
 }
\ No newline at end of file
index 0478b0c..08e9e41 100644 (file)
@@ -91,6 +91,8 @@
         "ESTONIAN": "Estlands",
         "CZECH": "Tsjechisch",
         "BRAZILIAN": "Braziliaans",
-        "CONFERENCE": "Conferentie met 2 actieve sessies"
+        "CONFERENCE": "Conferentie met 2 actieve sessies",
+        "CHANGE_LANGUAGE_MESSAGE": "Vergeet niet de pagina te vernieuwen om RTL-ondersteuning toe te passen (indien ingeschakeld)",
+        "CHANGE_LANGUAGE_TITLE": "Verander de taal"
     }
 }
\ No newline at end of file
index 7448c1d..b8c8892 100644 (file)
@@ -91,6 +91,8 @@
         "ESTONIAN": "estonian",
         "CZECH": "Czech",
         "BRAZILIAN": "brasilianske",
-        "CONFERENCE": "Konferanse med 2 aktive økter"
+        "CONFERENCE": "Konferanse med 2 aktive økter",
+        "CHANGE_LANGUAGE_MESSAGE": "Husk å oppdatere siden for å bruke RTL Support (hvis aktivert)",
+        "CHANGE_LANGUAGE_TITLE": "Skifte språk"
     }
 }
\ No newline at end of file
index 0dbadac..e868d45 100644 (file)
@@ -91,6 +91,8 @@
         "ESTONIAN": "estoński",
         "CZECH": "Czech",
         "BRAZILIAN": "brazylijski",
-        "CONFERENCE": "Konferencja z 2 aktywnymi sesjami"
+        "CONFERENCE": "Konferencja z 2 aktywnymi sesjami",
+        "CHANGE_LANGUAGE_MESSAGE": "Pamiętaj, aby odświeżyć stronę, aby zastosować obsługę RTL (jeśli jest włączona)",
+        "CHANGE_LANGUAGE_TITLE": "Zmień język"
     }
 }
\ No newline at end of file
index 18af16d..946f0fe 100644 (file)
@@ -91,6 +91,8 @@
         "BRAZILIAN": "Brasileiro",
         "CZECH": "Tcheco",
         "ESTONIAN": "estoniano",
-        "CONFERENCE": "Conferência com 2 sessões ativas"
+        "CONFERENCE": "Conferência com 2 sessões ativas",
+        "CHANGE_LANGUAGE_MESSAGE": "Lembre-se de atualizar a página para aplicar o suporte RTL (se ativado)",
+        "CHANGE_LANGUAGE_TITLE": "Mudar idioma"
     }
 }
\ No newline at end of file
index cf0e89d..681ecc0 100644 (file)
@@ -91,6 +91,8 @@
         "ESTONIAN": "estoniano",
         "CZECH": "Tcheco",
         "BRAZILIAN": "brasileiro",
-        "CONFERENCE": "Conferência com 2 sessões ativas"
+        "CONFERENCE": "Conferência com 2 sessões ativas",
+        "CHANGE_LANGUAGE_MESSAGE": "Lembre-se de atualizar a página para aplicar o suporte RTL (se ativado)",
+        "CHANGE_LANGUAGE_TITLE": "Mudar idioma"
     }
 }
\ No newline at end of file
index b126868..6c81aaf 100644 (file)
@@ -91,6 +91,8 @@
         "ESTONIAN": "эстонский",
         "CZECH": "чешский язык",
         "BRAZILIAN": "бразильский",
-        "CONFERENCE": "Конференция с 2 активными сессиями"
+        "CONFERENCE": "Конференция с 2 активными сессиями",
+        "CHANGE_LANGUAGE_MESSAGE": "Не забудьте обновить страницу, чтобы применить поддержку RTL (если она включена)",
+        "CHANGE_LANGUAGE_TITLE": "изменение языка"
     }
 }
\ No newline at end of file
index bdc048e..255b585 100644 (file)
@@ -91,6 +91,8 @@
         "ESTONIAN": "estniska",
         "CZECH": "tjeck",
         "BRAZILIAN": "brasiliansk",
-        "CONFERENCE": "Konferens med 2 aktiva sessioner"
+        "CONFERENCE": "Konferens med 2 aktiva sessioner",
+        "CHANGE_LANGUAGE_MESSAGE": "Kom ihåg att uppdatera sidan för att tillämpa RTL-support (om aktiverat)",
+        "CHANGE_LANGUAGE_TITLE": "Ändra språk"
     }
 }
\ No newline at end of file
index 43040a9..cf89caf 100644 (file)
@@ -91,6 +91,8 @@
         "ESTONIAN": "Estonyalı",
         "CZECH": "Çek",
         "BRAZILIAN": "Brezilya",
-        "CONFERENCE": "2 aktif oturumlu konferans"
+        "CONFERENCE": "2 aktif oturumlu konferans",
+        "CHANGE_LANGUAGE_MESSAGE": "RTL Desteği uygulamak için sayfayı yenilemeyi unutmayın (etkinse)",
+        "CHANGE_LANGUAGE_TITLE": "Dili değiştir"
     }
 }
\ No newline at end of file
index d90c493..521c1c7 100644 (file)
@@ -91,6 +91,8 @@
         "ESTONIAN": "爱沙尼亚语",
         "CZECH": "捷克",
         "BRAZILIAN": "巴西人",
-        "CONFERENCE": "会议有2个活动会议"
+        "CONFERENCE": "会议有2个活动会议",
+        "CHANGE_LANGUAGE_MESSAGE": "请记住刷新页面以应用RTL支持(如果已启用)",
+        "CHANGE_LANGUAGE_TITLE": "改变语言"
     }
 }
\ No newline at end of file
index 76807b9..55893da 100644 (file)
@@ -91,6 +91,8 @@
         "ESTONIAN": "愛沙尼亞語",
         "CZECH": "捷克",
         "BRAZILIAN": "巴西人",
-        "CONFERENCE": "會議有2個活動會議"
+        "CONFERENCE": "會議有2個活動會議",
+        "CHANGE_LANGUAGE_MESSAGE": "請記住刷新頁面以應用RTL支持(如果已啟用)",
+        "CHANGE_LANGUAGE_TITLE": "改變語言"
     }
 }
\ No newline at end of file
index 84f09b4..9fd0693 100644 (file)
@@ -23,7 +23,7 @@
         your browser</a> to improve your experience.</p>
     <![endif]-->
 
-<body md-theme="{{vm.themes.active.name}}" md-theme-watch ng-controller="IndexController as vm" class="{{state.current.bodyClass || ''}}">
+<body md-theme="{{vm.themes.active.name}}" md-theme-watch ng-controller="IndexController as vm" class="{{state.current.bodyClass || ''}}" dir="{{vm.direction}}">
 
     <!-- SPLASH SCREEN -->
     <ms-splash-screen id="splash-screen">
@@ -58,7 +58,7 @@
 
     <script src="scripts/vendor.d7c1518f.js"></script>
 
-    <script src="scripts/app.4b43d586.js"></script>
+    <script src="scripts/app.241ff46a.js"></script>
 
     <!-- CKEDITOR -->
     <script src="assets/plugins/ckeditor/ckeditor.js"></script>
similarity index 53%
rename from public/scripts/app.4b43d586.js
rename to public/scripts/app.241ff46a.js
index 7ee9ffe..3a6de56 100644 (file)
@@ -1 +1 @@
-!function(){"use strict";angular.module("app.auth",[])}(),function(){"use strict";angular.module("app.core",["ngAnimate","ngAria","ngCookies","ngMessages","ngResource","ngSanitize","ngMaterial","pascalprecht.translate","ui.router","gridster","ds.clock","angucomplete-alt"])}(),function(){"use strict";function e(e,t){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"}),t.addPart("app/errors/404")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.errors.error-404",[]).config(e)}(),function(){"use strict";function e(e,t){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"}),t.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,t){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"}),t.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.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.login","app.forgot","app.reset","app.errors"])}(),function(){"use strict";function e(e,t){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"}),t.addPart("app/login")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.login",[]).config(e)}(),function(){"use strict";function e(e,t,n,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,t){return t.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:t.getCurrentUser().userProfileId,section:"Metrics",fields:"createdAt,updatedAt,id,name,table,metric,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.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:t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1202})}]},authenticate:!0,permissionId:1202,bodyClass:"analytics"}),t.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,t){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t,a,i){var s;return e.resolve("analyticCustomReport@get",{fields:"createdAt,updatedAt,id,name,description,table,conditions,joins",id:t.id}).then(function(e){var t=[];if((s=e).joins)try{s.joins=JSON.parse(s.joins);for(var n=0;n<s.joins.length;n+=1)t.push(i.getColumns(s.joins[n].foreignTable))}catch(e){console.log(e)}return a.all(t)}).then(function(e){for(var t=0;t<e.length;t+=1)s.joins[t].foreignTableFields=_.difference(_.keys(e[t]),["$promise","$resolved"]);return s})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t,n,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,t){return t.hasRole("admin")?e.resolve("squareOdbc@get",{fields:"createdAt,updatedAt,id,name,dsn,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"ODBC",fields:"createdAt,updatedAt,id,name,dsn,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("squareRecording@get",{fields:"createdAt,updatedAt,id,filename,projectName,uniqueid,callerid,extension,audio",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"SquareRecordings",fields:"createdAt,updatedAt,id,filename,projectName,uniqueid,callerid,extension,audio",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1102})}]},authenticate:!0,permissionId:1102,bodyClass:"callysquare"}),t.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,t){return t.hasRole("admin")?e.resolve("squareProject@get",{fields:"id,name,description,notes",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"SquareProjects",fields:"id,name,description,notes",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("squareProject@get",{id:t.id})}],users:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("user@get",{fields:"id,fullname,role",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Users",mergeResources:!0,fields:"id,fullname,role",sort:"name",nolimit:!0})}],trunks:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("trunk@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Trunks",fields:"id,name",sort:"name",nolimit:!0})}],queues:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("voiceQueue@get",{type:"inbound",fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"VoiceQueues",type:"inbound",fields:"id,name",sort:"name",nolimit:!0})}],sounds:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("sound@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Sounds",fields:"id,name",sort:"name",nolimit:!0})}],variables:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("variable@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Variables",fields:"id,name",sort:"name",nolimit:!0})}],databases:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("squareOdbc@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"ODBC",fields:"id,name",sort:"name",nolimit:!0})}],projects:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("squareProject@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"SquareProjects",fields:"id,name",sort:"name",nolimit:!0})}],contexts:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("voiceContext@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Contexts",fields:"id,name",sort:"name",nolimit:!0})}],intervals:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("interval@get",{fields:"id,name,IntervalId",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Intervals",fields:"id,name,IntervalId",sort:"name",nolimit:!0})}],mailAccounts:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("mailAccount@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"MailAccounts",fields:"id,name",sort:"name",nolimit:!0})}],templates:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("template@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Templates",fields:"id,name",sort:"name",nolimit:!0})}],lists:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",sort:"name",nolimit:!0})}],smsAccounts:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("smsAccount@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"SmsAccounts",fields:"id,name",sort:"name",nolimit:!0})}],pauses:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("pause@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Pauses",fields:"id,name",sort:"name",nolimit:!0})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t,n,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,t){return t.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:t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("chatQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.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,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,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,forwardOfflineAddress,IntervalId,timezone,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.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,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,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,forwardOfflineAddress,IntervalId,timezone,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){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,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,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,forwardOfflineAddress,IntervalId,timezone,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:502})}]},authenticate:!0,permissionId:502,bodyClass:"chat"}),t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:510})}]},authenticate:!0,permissionId:510}).state("app.chat.realtime.agents",{url:"/agents",controller:"AgentsChatRealtimeController as vm",templateUrl:"app/main/apps/chat/views/realtime/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{nolimit:!0})}],agents:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("user@get",{fields:"id,name,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,mailPause,pauseType,lastPauseAt,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity",role:"agent",sort:"fullname",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Agents",fields:"id,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,mailPause,pauseType,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity",role:"agent",sort:"fullname",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:202})}],rpcAgents:["apiResolver",function(e){return e.resolve("rpc@getAgents")}]},authenticate:!0,permissionId:510}).state("app.chat.realtime.queues",{url:"/queues",controller:"QueuesChatRealtimeController as vm",templateUrl:"app/main/apps/chat/views/realtime/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("chatQueue@get",{type:"inbound",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"ChatQueues",channel:"chat",type:"inbound",sort:"-updatedAt",limit:10,page:1})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:501})}],rpcQueues:["apiResolver",function(e){return e.resolve("rpc@getChatQueues")}]},authenticate:!0,permissionId:510})}e.$inject=["$stateProvider"],angular.module("app.chat.realtime",[]).config(e)}(),function(){"use strict";function e(e,t,n,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,t){return t.hasRole("admin")?e.resolve("cmList@get",{fields:"createdAt,updatedAt,id,name,description,dialPrefix",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Lists",fields:"createdAt,updatedAt,id,name,description,dialPrefix",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("cmList@get",{fields:"createdAt,updatedAt,id,name,description,dialPrefix",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.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:t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){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:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("cmCustomField@get",{fields:"createdAt,updatedAt,id,alias,type,values,required",sort:"-updatedAt",ListId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:304})}]},authenticate:!0,permissionId:304,bodyClass:"contactmanager"}),t.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,t,n){return t.hasRole("admin")?e.resolve("cmContact@get",_.merge({includeAll:!0,sort:"-updatedAt",limit:10,offset:0},n)):e.resolve("userProfile@getResources",_.merge({id:t.getCurrentUser().userProfileId,section:"Contacts",includeAll:!0,sort:"-updatedAt",limit:10,offset:0},n))}],lists:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",sort:"-updatedAt",limit:10,offset:0})}],listsMap:["lists",function(e){for(var t={},n=0;n<e.rows.length;n++)t[e.rows[n].id]=e.rows[n].name;return t}],companies:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("cmCompany@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Companies",fields:"id,name",sort:"name",nolimit:!0})}],companiesMap:["companies",function(e){for(var t={},n=0;n<e.rows.length;n++)t[e.rows[n].id]=e.rows[n].name;return t}],tags:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("tag@get",{fields:"id,name",sort:"name",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Tags",fields:"id,name",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("cmContact@get",{id:t.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,t){return e.resolve("cmContact@getHoppers",{id:t.id,fields:"id,phone,scheduledat,priority,recallme,VoiceQueueId,CampaignId,UserId",sort:"-updatedAt",limit:10,offset:0})}],finals:["apiResolver","$stateParams",function(e,t){return e.resolve("cmContact@getHopperFinals",{id:t.id,fields:"id,uniqueid,calleridnum,statedesc,starttime,disposition",sort:"-updatedAt",limit:10,offset:0})}],histories:["apiResolver","$stateParams",function(e,t){return e.resolve("cmContact@getHopperHistories",{id:t.id,fields:"id,uniqueid,calleridnum,statedesc,scheduledat,starttime,endtime",sort:"-updatedAt",limit:10,offset:0})}],jscriptySessions:["apiResolver","$stateParams",function(e,t){return e.resolve("cmContact@getJscriptySessions",{id:t.id,fields:"id,starttime,endtime,membername,projectname",sort:"-starttime",limit:10,offset:0})}],companies:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("cmCompany@get"):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Companies"})}],lists:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",sort:"-updatedAt",nolimit:!0})}],customFields:["apiResolver","contact",function(e,t){return t.ListId?e.resolve("cmList@getCustomFields",{id:t.ListId}):null}],tags:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("tag@get"):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Tags"})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t,n,a){e.state("app.dashboards",{abstract:!0,url:"/dashboards"}),t.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(t,e){var a;return(e.hasRole("admin")?t.resolve("voiceQueue@get",{fields:"id,name",nolimit:!0}):t.resolve("userProfile@getResources",{id:e.getCurrentUser().userProfileId,section:"VoiceQueues",mergeResources:!0,fields:"id,name",channel:"voice",nolimit:!0})).then(function(e){return a=e,t.resolve("rpc@getVoiceQueues")}).then(function(e){if(e)for(var t,n=0;n<e.rows.length;n+=1)(t=_.find(a.rows,{id:e.rows[n].id}))&&_.merge(t,_.pick(e.rows[n],["waiting","total","talking","answered","unmanaged","abandoned"]));return a})}],userProfile:["apiResolver","Auth",function(e,t){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:100})}]},authenticate:!0,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",data:{selectedTab:0},views:{"content@app":{templateProvider:["$stateParams","$templateFactory","Auth",function(e,t,n){var a=n.getCurrentUser();return a&&"agent"===a.role?t.fromUrl("app/main/apps/dashboards/views/general/agent/agent.general.html",e):t.fromUrl("app/main/apps/dashboards/views/general/user/user.general.html",e)}],controllerProvider:["Auth",function(e){var t=e.getCurrentUser();return t&&"agent"===t.role?"AgentDashboardGeneralController as vm":"UserDashboardGeneralController as vm"}]}},resolve:{globalUserLists:["apiResolver","Auth",function(e,t){return e.resolve("user@getLists",{id:t.getCurrentUser().id,sort:"name",nolimit:!0})}],globalLists:["apiResolver","Auth",function(e,t){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,t){return t.hasRole("admin")?e.resolve("voiceQueue@get",{fields:"id,name",type:"inbound",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.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,t){return t.hasRole("admin")?e.resolve("voiceQueue@get",{fields:"id,name",type:"outbound",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.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",{dateStart:moment().startOf("day").toString(),dateEnd:moment().endOf("day").toString()})}],chatWebsites:["apiResolver","Auth",function(e,t){return t.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,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,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,header_offline,offline_message,message_title,enquiry_message_placeholder,enquiry_button,rating_message,rating_send,rating_skip,acceptMethod,acceptUrl,rejectMethod,rejectUrl,closeMethod,closeUrl,onlineForm,offlineForm,mapKey,mapKeyOffline,forwardTranscript,forwardOffline,forwardOfflineAddress,IntervalId,timezone,waitForTheAssignedAgent,description,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.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,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,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,header_offline,offline_message,message_title,enquiry_message_placeholder,enquiry_button,rating_message,rating_send,rating_skip,acceptMethod,acceptUrl,rejectMethod,rejectUrl,closeMethod,closeUrl,onlineForm,offlineForm,mapKey,mapKeyOffline,forwardTranscript,forwardOffline,forwardOfflineAddress,IntervalId,timezone,waitForTheAssignedAgent,description,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",limit:10,offset: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",{dateStart:moment().startOf("day").toString(),dateEnd:moment().endOf("day").toString()})}],mailAccounts:["apiResolver","Auth",function(e,t){return t.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,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.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,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset: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",{dateStart:moment().startOf("day").toString(),dateEnd:moment().endOf("day").toString()})}],smsAccounts:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("smsAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,phone,type,accountSid,authId,authToken,smsMethod,username,password,senderString,deliveryReport,waitForTheAssignedAgent,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"SmsAccounts",fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,phone,type,accountSid,authId,authToken,smsMethod,username,password,senderString,deliveryReport,waitForTheAssignedAgent,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",limit:10,offset: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",{dateStart:moment().startOf("day").toString(),dateEnd:moment().endOf("day").toString()})}],openchannelAccounts:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("openchannelAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,mapKey,description,receiveUri,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"OpenchannelAccounts",fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,mapKey,description,receiveUri,notificationSound,notificationShake,notificationTemplate",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",{dateStart:moment().startOf("day").toString(),dateEnd:moment().endOf("day").toString()})}],faxAccounts:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("faxAccount@get",{fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,description,ecm,minrate,maxrate,modem,gateway,faxdetect,t38timeout,tech,acceptMethod,acceptUrl,rejectMethod,rejectUrl,closeMethod,closeUrl,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"FaxAccounts",fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,description,ecm,minrate,maxrate,modem,gateway,faxdetect,t38timeout,tech,acceptMethod,acceptUrl,rejectMethod,rejectUrl,closeMethod,closeUrl,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",limit:10,offset:0})}]},authenticate:!0,bodyClass:"dashboards"})}e.$inject=["$stateProvider"],angular.module("app.dashboards.general.user",[]).config(e)}(),function(){"use strict";function e(e,t,n,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,t){return t.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:t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("faxQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("faxAccount@get",{fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,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:t.getCurrentUser().userProfileId,section:"FaxAccounts",fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("faxAccount@get",{fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,ecm,minrate,maxrate,modem,gateway,faxdetect,t38timeout,tech,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:902})}]},authenticate:!0,permissionId:902,bodyClass:"fax"}),t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:910})}]},authenticate:!0,permissionId:910}).state("app.fax.realtime.agents",{url:"/agents",controller:"AgentsFaxRealtimeController as vm",templateUrl:"app/main/apps/fax/views/realtime/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{nolimit:!0})}],agents:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("user@get",{fields:"id,name,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,mailPause,pauseType,lastPauseAt,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity",role:"agent",sort:"fullname",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Agents",fields:"id,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,mailPause,pauseType,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity",role:"agent",sort:"fullname",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:202})}],rpcAgents:["apiResolver",function(e){return e.resolve("rpc@getAgents")}]},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,t){return t.hasRole("admin")?e.resolve("trunk@get",{fields:"id,name",active:!0,sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Trunks",fields:"id,name",active:!0,sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1011})}],rpcTrunks:["apiResolver",function(e){return e.resolve("rpc@getTrunks")}]},authenticate:!0,permissionId:910}).state("app.fax.realtime.queues",{url:"/queues",controller:"QueuesFaxRealtimeController as vm",templateUrl:"app/main/apps/fax/views/realtime/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("faxQueue@get",{type:"inbound",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"FaxQueues",channel:"fax",type:"inbound",sort:"-updatedAt",limit:10,page:1})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:901})}],rpcQueues:["apiResolver",function(e){return e.resolve("rpc@getFaxQueues")}]},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,t){return t.hasRole("admin")?e.resolve("faxAccount@get",{sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"FaxAccounts",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t,n,a){e.state("app.help",{abstract:!0,url:"/help"}),t.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,t,n,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,t){return t.hasRole("admin")?e.resolve("intZendeskAccount@get",{fields:"createdAt,updatedAt,id,name,type,username,remoteUri,authType,password,token,serverUrl,description",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"ZendeskAccounts",fields:"createdAt,updatedAt,id,name,type,username,remoteUri,authType,password,token,serverUrl,description",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("intZendeskAccount@get",{fields:"createdAt,updatedAt,id,name,type,username,remoteUri,authType,password,token,serverUrl,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("intSalesforceAccount@get",{fields:"createdAt,updatedAt,id,name,type,username,remoteUri,password,clientId,clientSecret,securityToken,serverUrl,description",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"SalesforceAccounts",fields:"createdAt,updatedAt,id,name,type,username,remoteUri,password,clientId,clientSecret,securityToken,serverUrl,description",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("intSalesforceAccount@get",{fields:"createdAt,updatedAt,id,name,type,username,remoteUri,password,clientId,clientSecret,securityToken,serverUrl,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("intFreshdeskAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"FreshdeskAccounts",fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("intFreshdeskAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("intSugarcrmAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,password,serverUrl,description",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"SugarcrmAccounts",fields:"createdAt,updatedAt,id,name,username,remoteUri,password,serverUrl,description",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("intSugarcrmAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,password,serverUrl,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("intDeskAccount@get",{fields:"createdAt,updatedAt,id,name,type,remoteUri,authType,username,password,serverUrl,description",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"DeskAccounts",fields:"createdAt,updatedAt,id,name,type,remoteUri,authType,username,password,serverUrl,description",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("intDeskAccount@get",{fields:"createdAt,updatedAt,id,name,type,remoteUri,authType,username,password,serverUrl,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("intZohoAccount@get",{fields:"createdAt,updatedAt,id,name,host,authToken,serverUrl,description",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"ZohoAccounts",fields:"createdAt,updatedAt,id,name,host,authToken,serverUrl,description",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("intZohoAccount@get",{fields:"createdAt,updatedAt,id,name,host,authToken,serverUrl,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("intVtigerAccount@get",{fields:"createdAt,updatedAt,id,name,description,username,accessKey,remoteUri,serverUrl",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"VtigerAccounts",fields:"createdAt,updatedAt,id,name,description,username,accessKey,remoteUri,serverUrl",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("intVtigerAccount@get",{fields:"createdAt,updatedAt,id,name,description,username,accessKey,remoteUri,serverUrl",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("intDynamics365Account@get",{fields:"createdAt,updatedAt,id,name,username,password,remoteUri,tenantId,clientId,clientSecret,serverUrl,description",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Dynamics365Accounts",fields:"createdAt,updatedAt,id,name,username,password,remoteUri,tenantId,clientId,clientSecret,serverUrl,description",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("intDynamics365Account@get",{fields:"createdAt,updatedAt,id,name,username,password,remoteUri,tenantId,clientId,clientSecret,serverUrl,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("intServicenowAccount@get",{fields:"createdAt,updatedAt,id,name,username,password,email,remoteUri,serverUrl,description",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"ServicenowAccounts",fields:"createdAt,updatedAt,id,name,username,password,email,remoteUri,serverUrl,description",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("intServicenowAccount@get",{fields:"createdAt,updatedAt,id,name,username,password,email,remoteUri,serverUrl,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1310})}]},authenticate:!0,permissionId:1310,bodyClass:"integrations"}),t.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,t,n,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,t){return t.hasRole("admin")?e.resolve("jscriptyProject@get",{fields:"createdAt,updatedAt,id,name,enableUncompleteSave,description,formData",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Projects",fields:"createdAt,updatedAt,id,name,enableUncompleteSave,description,formData",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("jscriptyProject@get",{fields:"createdAt,updatedAt,id,name,enableUncompleteSave,description,formData",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1701})}]},authenticate:!0,permissionId:1701,bodyClass:"jscripty"}),t.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,t,n,a){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,t){return t.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:t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("mailQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.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,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.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,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){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,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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","Auth",function(e,t){return e.resolve("mailSubstatus@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:603})}]},authenticate:!0,permissionId:603,bodyClass:"mail"}),t.addPart("app/main/apps/mail")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:610})}]},authenticate:!0,permissionId:610}).state("app.mail.realtime.agents",{url:"/agents",controller:"AgentsMailRealtimeController as vm",templateUrl:"app/main/apps/mail/views/realtime/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{nolimit:!0})}],agents:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("user@get",{fields:"id,name,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,mailPause,pauseType,lastPauseAt,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity",role:"agent",sort:"fullname",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Agents",fields:"id,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,mailPause,pauseType,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity",role:"agent",sort:"fullname",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:202})}],rpcAgents:["apiResolver",function(e){return e.resolve("rpc@getAgents")}]},authenticate:!0,permissionId:610}).state("app.mail.realtime.queues",{url:"/queues",controller:"QueuesMailRealtimeController as vm",templateUrl:"app/main/apps/mail/views/realtime/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("mailQueue@get",{type:"inbound",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"MailQueues",channel:"mail",type:"inbound",sort:"-updatedAt",limit:10,page:1})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:601})}],rpcQueues:["apiResolver",function(e){return e.resolve("rpc@getMailQueues")}]},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,t){return t.hasRole("admin")?e.resolve("mailAccount@get",{sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"MailAccounts",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t,n,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,t){return t.hasRole("admin")?e.resolve("plugin@get",{fields:"createdAt,updatedAt,id,name,type,active,description,icon,sidebar,path,adminUrl,agentUrl,scriptName,scriptPath,version",sort:"name",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Plugins",fields:"createdAt,updatedAt,id,name,type,active,description,icon,sidebar,path,adminUrl,agentUrl,scriptName,scriptPath,version",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("plugin@get",{fields:"createdAt,updatedAt,id,name,type,active,description,icon,sidebar,path,adminUrl,agentUrl,scriptName,scriptPath,version",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1801})}]},authenticate:!0,permissionId:1801,bodyClass:"marketplace"}),t.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,t,n,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,t){return t.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,description,mandatoryDisposition,mandatoryDispositionPauseId",type:"outbound",sort:"-updatedAt",channel:"voice",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.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,description,mandatoryDisposition,mandatoryDispositionPauseId",type:"outbound",sort:"-updatedAt",channel:"voice",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){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,description,mandatoryDisposition,mandatoryDispositionPauseId",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.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,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:t.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,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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){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,dialOrderByScheduledAt,dialGlobalInterval,dialTimezone,dialPrefix,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1502})}]},authenticate:!0,permissionId:1502,bodyClass:"motiondialer"}),t.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.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1510})}]},authenticate:!0,permissionId:1510}).state("app.motiondialer.realtime.agents",{url:"/agents",controller:"AgentsMotionDialerRealtimeController as vm",templateUrl:"app/main/apps/motiondialer/views/realtime/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{nolimit:!0})}],agents:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("user@get",{fields:"id,name,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,mailPause,pauseType,lastPauseAt,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity",role:"agent",sort:"fullname",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Agents",fields:"id,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,mailPause,pauseType,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity",role:"agent",sort:"fullname",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:202})}],rpcAgents:["apiResolver",function(e){return e.resolve("rpc@getAgents")}]},authenticate:!0,permissionId:1510}).state("app.motiondialer.realtime.queues",{url:"/queues",controller:"QueuesMotionDialerRealtimeController as vm",templateUrl:"app/main/apps/motiondialer/views/realtime/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("voiceQueue@get",{type:"outbound",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"QueueCampaigns",channel:"voice",type:"outbound",sort:"-updatedAt",limit:10,page:1})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1501})}],rpcQueues:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueues")}]},authenticate:!0,permissionId:1510}).state("app.motiondialer.realtime.queue_calls",{url:"/queue_calls",controller:"QueueCallsMotionDialerRealtimeController as vm",templateUrl:"app/main/apps/motiondialer/views/realtime/queue_calls/view.html",resolve:{agents:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("user@get",{fields:"id,name,role,context",role:"agent",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Agents",fields:"id,name,role,context",role:"agent",nolimit:!0})}],queues:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("voiceQueue@get",{type:"outbound",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"QueueCampaigns",channel:"voice",type:"outbound",sort:"-updatedAt",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1501})}],rpcVoiceQueuesChannels:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueuesChannels")}]},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,t){return t.hasRole("admin")?e.resolve("user@get",{fields:"id,name,role,context",role:"agent",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Agents",fields:"id,name,role,context",role:"agent",nolimit:!0})}],queues:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("voiceQueue@get",{type:"outbound",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"QueueCampaigns",channel:"voice",type:"outbound",sort:"-updatedAt",nolimit:!0})}],dispositions:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("disposition@get",{fields:"createdAt,updatedAt,id,name",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Dispositions",fields:"createdAt,updatedAt,id,name",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("voiceQueue@get",{type:"outbound",fields:"id,name",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"QueueCampaigns",channel:"voice",type:"outbound",sort:"-updatedAt",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("campaign@get",{sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"IvrCampaigns",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t,n,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,t){return t.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:t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("openchannelQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("openchannelAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,mapKey,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUri,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"OpenchannelAccounts",fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,mapKey,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUri,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("openchannelAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,mapKey,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUri,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:802})}]},authenticate:!0,permissionId:802,bodyClass:"openchannel"}),t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:810})}]},authenticate:!0,permissionId:810}).state("app.openchannel.realtime.agents",{url:"/agents",controller:"AgentsOpenchannelRealtimeController as vm",templateUrl:"app/main/apps/openchannel/views/realtime/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{nolimit:!0})}],agents:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("user@get",{fields:"id,name,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,mailPause,pauseType,lastPauseAt,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity",role:"agent",sort:"fullname",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Agents",fields:"id,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,mailPause,pauseType,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity",role:"agent",sort:"fullname",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:202})}],rpcAgents:["apiResolver",function(e){return e.resolve("rpc@getAgents")}]},authenticate:!0,permissionId:810}).state("app.openchannel.realtime.queues",{url:"/queues",controller:"QueuesOpenchannelRealtimeController as vm",templateUrl:"app/main/apps/openchannel/views/realtime/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("openchannelQueue@get",{type:"inbound",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"OpenchannelQueues",channel:"openchannel",type:"inbound",sort:"-updatedAt",limit:10,page:1})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:801})}],rpcQueues:["apiResolver",function(e){return e.resolve("rpc@getOpenchannelQueues")}]},authenticate:!0,permissionId:810})}e.$inject=["$stateProvider"],angular.module("app.openchannel.realtime",[]).config(e)}(),function(){"use strict";function e(e,t,n,a){e.state("app.plugins",{abstract:!0,url:"/plugins"}),t.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";function e(e,t,n,a){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,stunaddr,turnaddr,turnusername,turnpassword,phoneBarAutoUpdater,phoneBarAutoUpdaterUrl,enableEmailPreview,split,splitSizeCsv,splitSizePdf,splitSizeXlsx,messagesAlignment,phoneBarRememberMeEnabled",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:{smtps:["apiResolver",function(e){return e.resolve("mailAccount@get",{fields:"createdAt,updatedAt,id,service,name,email,Smtp.service,Smtp.host,Smtp.port,Smtp.secure,Smtp.authentication,Smtp.user,Smtp.pass,description",service:"1",limit:10,offset:0})}]},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",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,defaultHeaderWhiteLabel,headerWhiteLabel,defaultPageTitle,pageTitle,defaultPreferred",limit:10,offset:0})}]},authenticate:!0,permissionId:1400,bodyClass:"settings"}),t.addPart("app/main/apps/settings")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],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,t){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t,n,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,t){return t.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:t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("smsQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.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,senderString,deliveryReport,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"SmsAccounts",fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,type,phone,accountSid,authId,authToken,smsMethod,username,password,baseUrl,apiKey,senderString,deliveryReport,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("smsAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,type,phone,accountSid,authId,authToken,smsMethod,username,password,baseUrl,apiKey,senderString,deliveryReport,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:702})}]},authenticate:!0,permissionId:702,bodyClass:"sms"}),t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:710})}]},authenticate:!0,permissionId:710}).state("app.sms.realtime.agents",{url:"/agents",controller:"AgentsSmsRealtimeController as vm",templateUrl:"app/main/apps/sms/views/realtime/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{nolimit:!0})}],agents:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("user@get",{fields:"id,name,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,mailPause,pauseType,lastPauseAt,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity",role:"agent",sort:"fullname",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Agents",fields:"id,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,mailPause,pauseType,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity",role:"agent",sort:"fullname",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:202})}],rpcAgents:["apiResolver",function(e){return e.resolve("rpc@getAgents")}]},authenticate:!0,permissionId:710}).state("app.sms.realtime.queues",{url:"/queues",controller:"QueuesSmsRealtimeController as vm",templateUrl:"app/main/apps/sms/views/realtime/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("smsQueue@get",{type:"inbound",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"SmsQueues",channel:"sms",type:"inbound",sort:"-updatedAt",limit:10,page:1})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:701})}],rpcQueues:["apiResolver",function(e){return e.resolve("rpc@getSmsQueues")}]},authenticate:!0,permissionId:710})}e.$inject=["$stateProvider"],angular.module("app.sms.realtime",[]).config(e)}(),function(){"use strict";function e(e,t,n,a){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","Auth",function(e,t){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",role:"admin,user",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){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",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.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,voicemail,transport,host,nat,type,allow,callerid,context,callgroup,pickupgroup,chanspy,videosupport,extensionMonitor,chatCapacity,mailCapacity,faxCapacity,smsCapacity,openchannelCapacity,phoneBarEnableSettings,phoneBarAutoAnswer,phoneBarAutoAnswerDelay,phoneBarRingInUse,phoneBarEnableRecording,phoneBarEnableDtmfTone,phoneBarDnd,phoneBarUnansweredCallBadge,phoneBarEnableJaws,phoneBarOutboundProxy,phoneBarUnconditional,phoneBarUnconditionalNumber,phoneBarRemoteControl,phoneBarRemoteControlPort,phoneBarExpires,phoneBarListenPort,permissions,allowmessenger,phoneBarPrefixRequired,passwordResetAt,phoneBarEnableVideoRecording",role:"agent",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.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,voicemail,transport,host,nat,type,allow,callerid,context,callgroup,pickupgroup,chanspy,videosupport,extensionMonitor,chatCapacity,mailCapacity,faxCapacity,smsCapacity,openchannelCapacity,phoneBarEnableSettings,phoneBarAutoAnswer,phoneBarAutoAnswerDelay,phoneBarRingInUse,phoneBarEnableRecording,phoneBarEnableDtmfTone,phoneBarDnd,phoneBarUnansweredCallBadge,phoneBarEnableJaws,phoneBarOutboundProxy,phoneBarUnconditional,phoneBarUnconditionalNumber,phoneBarRemoteControl,phoneBarRemoteControlPort,phoneBarExpires,phoneBarListenPort,permissions,allowmessenger,phoneBarPrefixRequired,passwordResetAt,phoneBarEnableVideoRecording",role:"agent",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){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,voicemail,transport,host,nat,type,allow,callerid,context,callgroup,pickupgroup,chanspy,videosupport,extensionMonitor,chatCapacity,mailCapacity,faxCapacity,smsCapacity,openchannelCapacity,phoneBarEnableSettings,phoneBarAutoAnswer,phoneBarAutoAnswerDelay,phoneBarRingInUse,phoneBarEnableRecording,phoneBarEnableDtmfTone,phoneBarDnd,phoneBarUnansweredCallBadge,phoneBarEnableJaws,phoneBarOutboundProxy,phoneBarUnconditional,phoneBarUnconditionalNumber,phoneBarRemoteControl,phoneBarRemoteControlPort,phoneBarExpires,phoneBarListenPort,permissions,allowmessenger,phoneBarPrefixRequired,passwordResetAt,phoneBarEnableVideoRecording",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.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:t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){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:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("team@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Teams",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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","Auth",function(e,t){return e.resolve("userProfile@get",{fields:"createdAt,updatedAt,id,name,description,crudPermissions",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("userProfile@get",{fields:"createdAt,updatedAt,id,name,description,crudPermissions",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:205})}]},authenticate:!0,permissionId:205,bodyClass:"staff"}),t.addPart("app/main/apps/staff")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],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,t,n,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,t){return t.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:t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1001})}]},authenticate:!0,permissionId:1001,bodyClass:"tools"}).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,t){return t.hasRole("admin")?e.resolve("disposition@get",{fields:"createdAt,updatedAt,id,name",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Dispositions",fields:"createdAt,updatedAt,id,name",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1002})}]},authenticate:!0,permissionId:1002,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,t){return t.hasRole("admin")?e.resolve("dashboard@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"CustomDashboards",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("dashboard@get",{fields:"createdAt,updatedAt,id,name,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.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:t.getCurrentUser().userProfileId,section:"Intervals",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",IntervalId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("interval@get",{fields:"createdAt,updatedAt,id,name,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("pause@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Pauses",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.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:t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.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:t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("tag@get",{fields:"createdAt,updatedAt,id,name,description,color",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Tags",fields:"createdAt,updatedAt,id,name,description,color",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("template@get",{fields:"createdAt,updatedAt,id,name,html,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Templates",fields:"createdAt,updatedAt,id,name,html,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1009})}]},authenticate:!0,permissionId:1009,bodyClass:"tools"}).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,t){return t.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:t.getCurrentUser().userProfileId,section:"Triggers",fields:"createdAt,updatedAt,id,name,channel,status,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("trigger@get",{fields:"createdAt,updatedAt,id,name,channel,status,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1010})}]},authenticate:!0,permissionId:1010,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,t){return t.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:t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){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:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("variable@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Variables",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1012})}]},authenticate:!0,permissionId:1012,bodyClass:"tools"}),t.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"]).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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:411})}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.agents",{url:"/agents",controller:"AgentsVoiceRealtimeController as vm",templateUrl:"app/main/apps/voice/views/realtime/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{nolimit:!0})}],agents:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("user@get",{fields:"id,name,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,mailPause,pauseType,lastPauseAt,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity",role:"agent",sort:"fullname",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Agents",fields:"id,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,mailPause,pauseType,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity",role:"agent",sort:"fullname",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:202})}],rpcAgents:["apiResolver",function(e){return e.resolve("rpc@getAgents")}]},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,t){return t.hasRole("admin")?e.resolve("user@get",{fields:"id,fullname,userpic,internal",role:"telephone",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Telephones",fields:"id,fullname,userpic,internal",role:"telephone",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("trunk@get",{fields:"id,name",active:!0,sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Trunks",fields:"id,name",active:!0,sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1011})}],rpcTrunks:["apiResolver",function(e){return e.resolve("rpc@getTrunks")}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.queues",{url:"/queues",controller:"QueuesVoiceRealtimeController as vm",templateUrl:"app/main/apps/voice/views/realtime/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("voiceQueue@get",{type:"inbound",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"VoiceQueues",channel:"voice",type:"inbound",sort:"-updatedAt",limit:10,page:1})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:401})}],rpcQueues:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueues")}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.queue_calls",{url:"/queue_calls",controller:"QueueCallsVoiceRealtimeController as vm",templateUrl:"app/main/apps/voice/views/realtime/queue_calls/view.html",resolve:{agents:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("user@get",{fields:"id,name,role,context",role:"agent",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Agents",fields:"id,name,role,context",role:"agent",nolimit:!0})}],queues:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("voiceQueue@get",{type:"inbound",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"VoiceQueues",channel:"voice",type:"inbound",sort:"-updatedAt",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:401})}],rpcVoiceQueuesChannels:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueuesChannels")}]},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,t){return t.hasRole("admin")?e.resolve("user@get",{fields:"id,name,role,context",role:"agent",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Agents",fields:"id,name,role,context",role:"agent",nolimit:!0})}],queues:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("voiceQueue@get",{type:"inbound",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"VoiceQueues",channel:"voice",type:"inbound",sort:"-updatedAt",nolimit:!0})}],dispositions:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("disposition@get",{fields:"createdAt,updatedAt,id,name",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Dispositions",fields:"createdAt,updatedAt,id,name",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("voiceQueue@get",{type:"inbound",fields:"id,name",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"VoiceQueues",channel:"voice",type:"inbound",sort:"-updatedAt",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t,n,a){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,t){return t.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,mandatoryDisposition,mandatoryDispositionPauseId",type:"inbound",sort:"-updatedAt",channel:"voice",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.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,mandatoryDisposition,mandatoryDispositionPauseId",type:"inbound",sort:"-updatedAt",channel:"voice",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){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,mandatoryDisposition,mandatoryDispositionPauseId",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:401})}]},authenticate:!0,permissionId:401,bodyClass:"voice"}).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,t){return t.hasRole("admin")?e.resolve("voiceExtension@get",{fields:"createdAt,updatedAt,id,appdata,type,exten,context,description",type:"inbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"InboundRoutes",fields:"createdAt,updatedAt,id,appdata,type,exten,context,description",type:"inbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("voiceExtension@get",{fields:"createdAt,updatedAt,id,appdata,type,exten,context,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:402})}]},authenticate:!0,permissionId:402,bodyClass:"voice"}).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,t){return t.hasRole("admin")?e.resolve("voiceExtension@get",{fields:"createdAt,updatedAt,id,appdata,type,exten,context,recordingFormat,cutdigits,description",type:"outbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"OutboundRoutes",fields:"createdAt,updatedAt,id,appdata,type,exten,context,recordingFormat,cutdigits,description",type:"outbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("voiceExtension@get",{fields:"createdAt,updatedAt,id,appdata,type,exten,context,recordingFormat,cutdigits,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:403})}]},authenticate:!0,permissionId:403,bodyClass:"voice"}).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,t){return t.hasRole("admin")?e.resolve("voiceExtension@get",{fields:"createdAt,updatedAt,id,appdata,type,exten,context,description",type:"internal",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"InternalRoutes",fields:"createdAt,updatedAt,id,appdata,type,exten,context,description",type:"internal",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("voiceExtension@get",{fields:"createdAt,updatedAt,id,appdata,type,exten,context,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:404})}]},authenticate:!0,permissionId:404,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,t){return t.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:t.getCurrentUser().userProfileId,section:"Contexts",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",defaultEntry:"false",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.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:t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){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:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.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:t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("voiceMusicOnHold@get",{fields:"createdAt,updatedAt,id,name,mode,directory,application,format,sort",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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",function(e,t){return t.hasRole("admin")?e.resolve("voiceRecording@get",{fields:"createdAt,updatedAt,id,format,value,type,uniqueid,calleridnum,exten,connectedlinenum,queue,membername,rating,audio,userDisposition",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"VoiceRecordings",fields:"createdAt,updatedAt,id,format,value,type,uniqueid,calleridnum,exten,connectedlinenum,queue,membername,rating,audio,userDisposition",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.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:t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("voicePrefix@get",{fields:"createdAt,updatedAt,id,name,VoiceExtensionId,callerIdAll,description",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"VoicePrefixes",fields:"createdAt,updatedAt,id,name,VoiceExtensionId,callerIdAll,description",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:410})}]},authenticate:!0,permissionId:410,bodyClass:"voice"}),t.addPart("app/main/apps/voice")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],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.realtime"]).config(e)}(),function(){"use strict";angular.module("app.navigation",[]).config(function(){})}(),function(){"use strict";function e(e,t){e.addPart("app/quick-panel")}e.$inject=["$translatePartialLoaderProvider","msApiProvider"],angular.module("app.quick-panel",[]).config(e)}(),function(){"use strict";function e(e,t){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"}),t.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";function e(e){e.interceptors.push("authInterceptor")}e.$inject=["$httpProvider"],angular.module("app.auth").config(e)}(),function(){"use strict";function e(e,n,t,a){e.$on("$stateChangeStart",function(e,t){return t.hasOwnProperty("authenticate")&&t.authenticate&&!a.isLoggedIn()?(e.preventDefault(),n.go("app.login",{},{reload:!0,notify:!0})):a.isLoggedIn()&&t.hasOwnProperty("permissionId")&&t.permissionId&&!a.hasRole("admin")?a.reloadPermissions().then(function(){if(!a.hasPermission(t.permissionId))return e.preventDefault(),n.go("app.dashboards.general",{},{reload:!0,notify:!0})}).catch(function(){return e.preventDefault(),n.go("app.dashboards.general",{},{reload:!0,notify:!0})}):void 0})}e.$inject=["$rootScope","$state","$window","Auth"],angular.module("app.auth").run(e)}(),function(){"use strict";function e(a,i,s,o,t,r){var l,d=["id","role","fullname","name","internal","email","userpic","permissions","md5secret","phoneBarAutoAnswer","phoneBarAutoAnswerDelay","phoneBarEnableRecording","phoneBarEnableDtmfTone","voicePause","chatPause","mailPause","faxPause","smsPause","openchannelPause","phoneBarEnableSettings","phoneBarExpires","pauseType","showWebBar","phoneBarRemoteControlPort","phoneBarRemoteControl","lastLoginAt","lastPauseAt","crudPermissions","allowmessenger","passwordResetAt","alias","phoneBarPrefixRequired","hotdesk","userProfileId"];function c(e){var t=s.defer();return m("agent")&&0!==l.showWebBar?o.user.login({id:l.id,device:"web",intrf:e}).$promise.then(function(){console.log("AGENT LOGGED IN"),t.resolve()}).catch(function(e){console.error(e),t.reject(e)}):m("admin")||m("user")?o.user.update({id:l.id},{online:!0,lastLoginAt:moment().format("YYYY-MM-DD HH:mm:ss")}).$promise.catch(function(e){console.error(e)}).finally(function(){t.resolve()}):t.resolve(),t.promise}function n(){if(i.remove("motion.user"),i.remove("motion.token"),l&&l.id){var e=l.id;l=null,t.localStorage.removeItem("motion.user:"+e)}}function m(e){return!!l&&l.role===e}function u(e){return!!l&&_.includes(l.permissions,e)}function e(){return i.get("motion.token")}function p(e){return l=_.assign(l,_.pick(e,d)),i.put("motion.user",JSON.stringify(l)),m("user")&&g().then(function(e){l.permissions=e}),l}function g(){var i=[];return s(function(t,n){var a=[];return l||t(a),o.userProfileSection.get({userProfileId:l.userProfileId}).$promise.then(function(e){return i=e&&e.rows?e.rows:[],_.isEmpty(i)||(a=_.map(_.filter(i,function(e){return e.enabled}),function(e){return e.sectionId})),a}).then(function(t){if(_.includes(t,100)){var e=_.find(i,{sectionId:100});return e.autoAssociation?(t.push(101),t):o.userProfileResource.get({sectionId:e.id}).$promise.then(function(e){return(e&&e.rows?e.rows[0]:null)&&t.push(101),t})}return t}).then(function(t){if(_.includes(t,1003)||_.some(i,{enabled:!1,sectionId:1003})){var e=_.find(i,{sectionId:1003});return e.autoAssociation?o.dashboard.get().$promise.then(function(e){return(e&&e.rows?e.rows:[]).forEach(function(e){t.push(e.id+99999)}),t}):o.userProfileResource.get({sectionId:e.id}).$promise.then(function(e){return(e&&e.rows?e.rows:[]).forEach(function(e){t.push(e.resourceId+99999)}),t})}return t}).then(function(t){if(_.includes(t,1801)||_.some(i,{enabled:!1,sectionId:1801})){var e=_.find(i,{sectionId:1801});return e.autoAssociation?o.plugin.get().$promise.then(function(e){return(e&&e.rows?e.rows:[]).forEach(function(e){t.push(e.id+88888)}),t}):o.userProfileResource.get({sectionId:e.id}).$promise.then(function(e){return(e&&e.rows?e.rows:[]).forEach(function(e){t.push(e.resourceId+88888)}),t})}return t}).then(function(e){t(e)}).catch(function(e){n("Error retrieving user profile permissions",e)})})}function v(){return s(function(t,n){g().then(function(e){l.permissions=e,t()}).catch(function(e){n(e)})})}return function(){if(i.get("motion.user"))l=JSON.parse(i.get("motion.user")),o.user.get({id:l.id,fields:d.join(",")}).$promise.then(function(e){if(e)return p(e)}).catch(function(e){console.log("Error retrieving user",e)})}(),{login:function(e){var t,n=s.defer();return o.auth.local(e).$promise.then(function(e){return t=e,i.put("motion.token",e.token),o.user.get({id:e.id,fields:d.join(",")}).$promise}).then(function(e){(l=e).lastLoginAt=moment(),i.put("motion.user",JSON.stringify(e))}).then(function(){if(m("agent")&&1==l.showWebBar&&l.hotdesk)return a.show({controller:"HotDeskDialogController",controllerAs:"vm",templateUrl:"app/auth/services/hotdesk/dialog.html",parent:angular.element(r.body),clickOutsideToClose:!1,resolve:{telephones:["apiResolver","Auth",function(e,t){return e.resolve("user@get",{fields:"id,fullname,name,internal",role:"telephone",nolimit:!0})}]}})}).then(function(e){return c(e)}).catch(function(e){n.reject(e.data)}).finally(function(){o.user.get({id:t.id,fields:d.join(",")}).$promise.then(function(e){l=e,m("user")&&g().then(function(e){l.permissions=e}),n.resolve()}).catch(function(e){console.log("Error update user login",e),n.reject(e.data)})}),n.promise},logout:function(e){var t;return s.defer(),e?(n(),s.resolve()):(t=s.defer(),m("agent")&&0!==l.showWebBar?o.user.logout({id:l.id,device:"web"}).$promise.then(function(){console.log("AGENT LOGGED OUT")}).catch(function(e){console.error(e)}).finally(function(){t.resolve()}):m("admin")||m("user")?o.user.update({id:l.id},{online:!1}).$promise.catch(function(e){console.error(e)}).finally(function(){t.resolve()}):t.resolve(),t.promise).then(n).catch(function(e){console.error(e)})},queueLogin:c,isLoggedIn:function(){return!(!l||!e())},getPermissions:g,reloadPermissions:v,hasChildrenPermissions:function(e){return!!e&&_.some(e,function(e){return u(e)})},hasModulePermissions:function(i){return s(function(a,t){m("admin")?a(!0):o.userProfileSection.get({userProfileId:l.userProfileId}).$promise.then(function(e){var t=e&&e.rows?e.rows:[];if(_.isEmpty(t))a(!1);else{var n=_.filter(t,function(e){return e.enabled});a(_.some(n,["category",i]))}}).catch(function(e){t(e)})})},hasModulesPermissions:function(i){return s(function(n,t){var a={};m("admin")?(i.forEach(function(e){a[e]=!0}),n(a)):o.userProfileSection.get({userProfileId:l.userProfileId}).$promise.then(function(e){var t=e&&e.rows?e.rows:[];_.isEmpty(t)?n({}):(_(t).filter(function(e){return e.enabled&&_.includes(i,e.category)}).uniqBy(function(e){return e.category}).map(function(e){return e.category}).value().forEach(function(e){a[e]=!0}),n(a))}).catch(function(e){t(e)})})},hasRole:m,hasPermission:u,hasSectionPermissions:function(a){return s(function(e,t){var n={};return v().then(function(){_.includes(l.permissions,a)&&(n[a]=!0),e(n)}).catch(function(e){t(e)})})},hasSectionsPermissions:function(a){return s(function(e,t){var n={};if(!m("admin"))return v().then(function(){a.forEach(function(e){_.includes(l.permissions,e)&&(n[e]=!0)}),e(n)}).catch(function(e){t(e)});a.forEach(function(e){n[e]=!0}),e(n)})},getToken:e,getCurrentUser:function(){return l},parseCrudPermissions:function(e){return m("admin")?{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}},updateCurrentUser:p,removeCookies:n}}e.$inject=["$mdDialog","$cookies","$q","api","$window","$document"],angular.module("app.auth").factory("Auth",e)}(),function(){"use strict";function e(t,e){this.telephones=e,this.closeDialog=function(e){t.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(e,t,n,a,i){var s;return{request:function(e){var t=n.get("motion.token");return e.headers=e.headers||{},i.isSameOrigin(e.url)&&t&&(e.headers.Authorization="Bearer "+t),e},responseError:function(e){switch(e.status){case 401:n.remove("motion.user"),n.remove("motion.token"),(s||(s=a.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(t){var n={safeCb:function(e){return angular.isFunction(e)?e:angular.noop},urlParse:function(e){var t=document.createElement("a");return t.href=e,""===t.host&&(t.href=t.href),t},isSameOrigin:function(i,e){return i=n.urlParse(i),(e=(e=e&&[].concat(e)||[]).map(n.urlParse)).push(t.location),1<=(e=e.filter(function(e){var t=i.hostname===e.hostname,n=i.protocol===e.protocol,a=i.port===e.port||""===e.port&&("80"===i.port||"443"===i.port);return t&&n&&a})).length}};return n}e.$inject=["$window"],angular.module("app.auth").factory("Util",e)}(),function(){"use strict";angular.module("app.core").provider("motionConfig",function(){var n={disableCustomScrollbars:!1,disableMdInkRippleOnMobile:!0,disableCustomScrollbarsOnMobile:!0};this.config=function(e){n=angular.extend({},n,e)},this.$get=function(){var e={getConfig:function(e){if(angular.isUndefined(n[e]))return!1;return n[e]},setConfig:function(e,t){n[e]=t}};return e}})}(),function(){"use strict";function e(e,t,n,a){t.debugEnabled(!0),e.config({tabindex:!1}),a.config({disableCustomScrollbars:!1,disableCustomScrollbarsOnMobile:!0,disableMdInkRippleOnMobile:!0}),n.config({wheelPropagation:!0})}e.$inject=["$ariaProvider","$logProvider","msScrollConfigProvider","motionConfigProvider"],angular.module("app.core").config(e)}(),function(){"use strict";function e(e,t,n){(t.generate(),n.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(o,l,d){return{restrict:"E",compile:function(e,t){var s;return t.code||(s=e.html(),e.empty()),function(n,a,r){r.code&&(s=n.$eval(r.code));var i=n.$eval(r.shouldInterpolate);l.when(s).then(function(e){if(e){i&&(e=d(e)(n));var t=angular.element('<pre><code class="highlight" ng-non-bindable></code></pre>');a.append(t),o(function(){!function(e,t){var n=t.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/>",""),n.append(o.value).addClass("highlight")}(e,t)},34,!1)}})}}}}e.$inject=["$timeout","$q","$interpolate"],angular.module("app.core").directive("hljs",e)}(),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,t){e.cardTemplateLoaded=function(){e.$emit("msCard::cardTemplateLoaded",t)}}}}})}(),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(n,t,a,i,s,o,e,r,l){function d(e){switch(n.currentUser.showWebBar){case 0:return m("http://127.0.0.1:"+(n.currentUser.phoneBarRemoteControlPort||"9888")+"/api/originate/"+c(e));case 2:return t.$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")})})}n.currentUser=e.getCurrentUser(),n.showMenu=function(){return n.target&&n.target.indexOf("@")<0&&n.target!=n.currentUser.internal&&n.target!=n.currentUser.name&&(0==n.currentUser.showWebBar&&n.currentUser.phoneBarRemoteControl||2==n.currentUser.showWebBar&&n.license.webrtc)&&!n.disabled},n.call=function(e){return 2!==n.currentUser.showWebBar?(t=e,l.user.getVoicePrefixes({id:n.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:n.currentUser.phoneBarPrefixRequired}})}).then(function(e){n.currentUser.phoneBarPrefixRequired?e&&-1!==e&&d(e+t):e&&-1!==e?d(e+t):e||d(t)})):d(e);var t},n.transfer=function(e){switch(n.currentUser.showWebBar){case 0:return m("http://127.0.0.1:"+(n.currentUser.phoneBarRemoteControlPort||"9888")+"/api/transfer?number="+c(e));case 2:t.$broadcast("webrtc::transfer",{target:c(e)})}}}],templateUrl:"app/core/directives/ms-click-to-call/ms-click-to-call.html"}})}(),function(){"use strict";function e(i){return{require:"ngModel",priority:1,link:function(e,t,n,a){a.$formatters.push(i.formatter),a.$parsers.push(i.parser)}}}e.$inject=["msDatepickerFixConfig"],angular.module("app.core").provider("msDatepickerFixConfig",function(){var t={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){t=angular.extend({},t,e)},this.$get=function(){return t}}).directive("msDatepickerFix",e)}(),function(){"use strict";angular.module("app.core").directive("msDualMultiselect",function(){return{restrict:"E",scope:{options:"="},controller:["$scope",function(o){o.canTransfer=function(e,t,n){if(!t.readOnly)return void 0!==e.isValid&&e.isValid?n?o.transfer(t.selectedItems,t.items,t.selectedItems.indexOf(e),n):o.transfer(t.items,t.selectedItems,t.items.indexOf(e),n):void 0},o.transfer=function(e,t,n,a){var i=[];if(0<=n)i.push(e[n]),t.push(e[n]),e.splice(n,1);else{for(var s=0;s<e.length;s++)void 0!==e[s].isValid&&e[s].isValid&&t.push(e[s]);for(var s=e.length-1;0<=s;s--)e[s].isValid&&e.splice(s,1);i=t}o.options.transferCallback&&o.options.transferCallback(i,a)},o.getLine=function(e,t){var n="";if(_.isNil(t))return n;if(_.isArray(t)){for(var a=0;a<t.length;a++)n+=" "+(e[t[a]]?e[t[a]]:"");return n}return e[t]?e[t]:""}}],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(n,e){var t=e.emojioneArea({pickerPosition:n.pickerPosition,search:n.search,recentEmojis:n.recentEmojis,placeholder:a.instant(n.placeholder||"Type a message"),attributes:{spellcheck:!0},events:{keyup:function(e,t){n.ngModel=this.getText(),n.onReply({event:t,body:this.getText()})},emojibtn_click:function(){n.ngModel=this.getText()}}});n.ngModel&&t[0].emojioneArea.setText(n.ngModel),n.internalControl=n.ctrlMethods||{},n.internalControl.setText=function(e){t[0].emojioneArea.setText(e)},n.internalControl.getText=function(){return t[0].emojioneArea.getText()},n.$watch("ngModel",function(e){e||t[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:"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 t=this;function e(){return t.forms.length}function n(){return 0===t.selectedIndex}function a(){return t.selectedIndex===e()-1}t.forms=[],t.selectedIndex=0,t.registerForm=function(e){t.forms.push(e)},t.previousStep=function(){if(n())return;t.selectedIndex--},t.nextStep=function(){if(a())return;t.selectedIndex++},t.firstStep=function(){t.selectedIndex=0},t.lastStep=function(){t.selectedIndex=e()-1},t.totalSteps=e,t.isFirstStep=n,t.isLastStep=a,t.currentStepInvalid=function(){return angular.isDefined(t.forms[t.selectedIndex])&&t.forms[t.selectedIndex].$invalid},t.previousStepInvalid=function(){return 0<t.selectedIndex&&angular.isDefined(t.forms[t.selectedIndex-1])&&t.forms[t.selectedIndex-1].$invalid},t.formsIncomplete=function(){for(var e=0;e<t.forms.length;e++)if(t.forms[e].$invalid)return!0;return!1},t.resetForm=function(){for(var e=t.selectedIndex=0;e<t.forms.length;e++)t.forms[e].$setPristine(),t.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,t,n,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,t){var n=i.find("ms-info-bar-active"),a="ms-info-bar-active";n.addClass(a),e.removeInfoBar=function(){n.removeClass(a),t.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,t={columnCount:5,respectItemOrder:!1,reLayoutDebounce:400,responsive:{md:3,sm:2,xs:1}},n=!0;function i(){n&&e.cancel(n),n=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}),t=0;t<d.items.length;t++){var n,a,i,s,o=d.items[t];(o=angular.element(o)).scope()&&o.scope().$broadcast("msMasonryItem:startReLayout"),o.css({width:d.columnWidth}),d.options.respectItemOrder?(i=t%d.columnCount,s=e[i]):(s=Math.min.apply(Math,e),i=e.indexOf(s)),e[i]=s+o[0].getBoundingClientRect().height,n=Math.round(i*d.columnWidth),a=s,o.css({transform:"translate3d("+n+"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(t,d.options):t,r.$watch(function(){return d.container.width()},function(e,t){e!==t&&i()})},d.waitImagesLoaded=function(e,t){if("undefined"!=typeof imagesLoaded){var n=a.imagesLoaded(e);n.on("done",function(){t()})}else t()},r.$on("msMasonry:relayout",function(){i()})}function t(o){return{restrict:"AEC",controller:"msMasonryController",compile:function(i,s){return{pre:function(e,t,n,a){a.options=angular.fromJson(s.options||"{}"),a.container=i},post:function(e,t,n,a){o(function(){a.initialize()})}}}}}e.$inject=["$scope","$window","$mdMedia","$timeout"],t.$inject=["$timeout"],angular.module("app.core").controller("msMasonryController",e).directive("msMasonry",t).directive("msMasonryItem",function(){return{restrict:"AEC",require:"^msMasonry",priority:1,link:function(e,t,n,a){a.waitImagesLoaded(t,function(){a.reLayout()}),e.$on("msMasonryItem:finishReLayout",function(){e.$watch(function(){return t.height()},function(e,t){e!==t&&a.reLayout()})}),t.on("$destroy",function(){a.reLayout()})}}})}(),function(){"use strict";function e(n,e,a,i){var s=this;function o(e,t){s.selectedPalette=e,s.selectedHues=t}function r(){o(!(s.selectedColor={palette:"",hue:"",class:""}),!1),d()}function l(e,t){s.selectedColor={palette:e,hue:t,class:"md-"+e+"-"+t+"-bg",bgColorValue:i.rgba(s.palettes[e][t].value),fgColorValue:i.rgba(s.palettes[e][t].contrast)},"obj"!==s.msModelType||angular.equals(s.selectedColor,s.modelCtrl.$viewValue)||d(),o(e,s.palettes[e]),n.$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,n.$selectedColor={},s.activateHueSelection=o,s.selectColor=function(e,t){l(e,t),d(),a.hide()},s.removeColor=r,n.$watch("ngModel",function(){if(!s.modelCtrl.$viewValue||""===s.modelCtrl.$viewValue)return void r();var e,t;if("class"===s.msModelType){var n=s.modelCtrl.$viewValue.split("-");t=5<=n.length?(e=n[1]+"-"+n[2],n[3]):(e=n[1],n[2])}else"obj"===s.msModelType&&(e=s.modelCtrl.$viewValue.palette,t=s.modelCtrl.$viewValue.hue||500);l(e,t)})}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,t,n,a,i){var s=a[0];s.modelCtrl=a[1],s.msModelType=e.msModelType||"class",i(e,function(e){(e=e.filter(function(e,t){return 1===t.nodeType})).length&&t.find("ms-color-picker-button").replaceWith(e)})}}})}(),function(){"use strict";function e(p,g,v){return{restrict:"A",link:function(e,t,n){var a="true"===n.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=t.parent();function d(){s.addClass("ms-nav-folded"),g.$broadcast("msNav::forceCollapse"),t.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"),t.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"),t.off("mouseenter mouseleave")}v.setFoldable(e,t,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"),t.off("mouseenter mouseleave")})}}}function t(n,a,i){return{restrict:"E",scope:{},controller:"MsNavController",compile:function(e){return e.addClass("ms-nav"),function(e){n.$broadcast("msNav::expandMatchingToggles");var t=n.$on("$stateChangeSuccess",function(){n.$broadcast("msNav::expandMatchingToggles"),a.when("navigation").then(function(e){e.close(),i.isNavFoldedOpen()&&i.closeFolded()})});e.$on("$destroy",function(){t()})}}}}function n(m,u,p,g){return{restrict:"A",require:"^msNav",scope:!0,compile:function(e,t){return e.addClass("ms-nav-toggle"),angular.isUndefined(t.collapsed)&&(t.collapsed=!0),e.attr("collapsed",t.collapsed),function(a,i,e,n){var s={expanded:"expanded",expandAnimation:"expand-animation",collapseAnimation:"collapse-animation"},t=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 t=angular.element(i.find("ms-nav-toggle-items")[0]);t.css({position:"absolute",visibility:"hidden",display:"block",height:"auto"});var n=t[0].offsetHeight;return t.css({position:"",visibility:"",display:"",height:""}),a.$evalAsync(function(){p.animate(t,{display:"block",height:"0px"},{height:n+"px"},s.expandAnimation).then(function(){t.addClass(s.expanded),t.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 t=angular.element(i.find("ms-nav-toggle-items")[0]),n=t[0].offsetHeight;return a.$evalAsync(function(){p.animate(t,{height:n+"px"},{height:"0px"},s.collapseAnimation).then(function(){t.removeClass(s.expanded),t.css({display:"",height:""}),e.resolve({success:!0})})}),e.promise}angular.forEach(t,function(e){var t=angular.element(e).attr("ui-sref");angular.isUndefined(t)||(t=t.replace(r,""),o.push(t))}),n.setToggleItem(i,a),i.children(".ms-nav-button").on("click",function(){if(n.isDisabled())return;n.disable(),l()?(n.clearLockedItems(),a.$emit("msNav::pushToLockedList"),m.$broadcast("msNav::collapse"),d().then(function(){n.enable()})):a.$broadcast("msNav::forceCollapse")}),a.$on("$destroy",function(){i.children(".ms-nav-button").off("click")}),a.$on("msNav::collapse",function(){var e=n.getLockedItems(),t=!1;angular.forEach(e,function(e){angular.equals(e.scope,a)&&(t=!0)}),t||c().then(function(){n.enable()})}),a.$on("msNav::forceCollapse",function(){c().then(function(){n.enable()})}),a.$on("msNav::expandMatchingToggles",function(){var t=g.current.name,n=!1;angular.forEach(o,function(e){t===e&&(n=!0)}),n?d():c()}),a.$on("msNav::pushToLockedList",function(){n.setLockedItem(i,a)})}}}}e.$inject=["$document","$rootScope","msNavFoldService"],t.$inject=["$rootScope","$mdComponentRegistry","msNavFoldService"],n.$inject=["$rootScope","$q","$animate","$state"],angular.module("app.core").factory("msNavFoldService",function(){var n={};return{setFoldable:function(e,t){n={scope:e,element:t}},isNavFoldedOpen:function(){return n.scope.isNavFoldedOpen()},toggleFold:function(){n.scope.toggleFold()},openFolded:function(){n.scope.openFolded()},closeFolded:function(){n.scope.closeFolded()}}}).directive("msNavIsFolded",e).controller("MsNavController",function(){var e=this,t=!1,n=[],a=[];e.isDisabled=function(){return t},e.enable=function(){t=!1},e.disable=function(){t=!0},e.setToggleItem=function(e,t){n.push({element:e,scope:t})},e.getLockedItems=function(){return a},e.setLockedItem=function(e,t){a.push({element:e,scope:t})},e.clearLockedItems=function(){a=[]}}).directive("msNav",t).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",n)}(),function(){"use strict";function e(e,t){e.root?this.navigation=t.getNavigation(e.root):this.navigation=t.getNavigation(),this.toggleHorizontalMobileMenu=function(){angular.element("body").toggleClass("ms-navigation-horizontal-mobile-menu-active")},t.sort()}function t(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,t){var n=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"),n.addClass("ms-navigation-folded"),r();else{var t=p.getActiveItem();t&&t.scope.$emit("msNavigation::stateMatched"),n.removeClass("ms-navigation-folded ms-navigation-folded-open"),i.remove()}}function r(){t.parent().append(a),m(function(){a.on("mouseenter touchstart",l)})}function l(e){e&&e.preventDefault(),p.setFoldedOpen(!0);var t=p.getActiveItem();t&&t.scope.$emit("msNavigation::stateMatched"),n.addClass("ms-navigation-folded-open"),a.remove(),n.find("#main").append(i),i.on("mouseenter touchstart",d)}function d(e){e&&e.preventDefault(),p.setFoldedOpen(!1),c.$broadcast("msNavigation::collapse"),n.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")}),n.addClass("ms-navigation-folded"),r())}(),e.$watch(function(){return s.isLockedOpen()},function(e,t){if(!angular.isUndefined(e)&&!angular.equals(e,t)&&p.getFolded())if(e)c.$broadcast("msNavigation::collapse");else{var n=p.getActiveItem();n&&n.scope.$emit("msNavigation::stateMatched")}}),e.$watch("folded",function(e,t){angular.isUndefined(e)||angular.equals(e,t)||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 n(n,e,a,i,t,s){var o=this;o.element=e,o.node=n.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"),t=e[0].offsetHeight;n.$evalAsync(function(){o.collapsed=!0,o.element.addClass("collapsing"),i.animate(e,{display:"block",height:t+"px"},{height:"0px"},o.animateHeightClass).then(function(){e.css({display:"",height:""}),o.element.removeClass("collapsing")}),n.$broadcast("msNavigation::collapse")})},o.expand=function(){var e=o.element.children("ul");e.css({position:"absolute",visibility:"hidden",display:"block",height:"auto"});var t=e[0].offsetHeight;e.css({position:"",visibility:"",display:"",height:""}),n.$evalAsync(function(){o.collapsed=!1,o.element.addClass("expanding"),i.animate(e,{display:"block",height:"0px"},{height:t+"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===t.current.name||t.includes(o.node.state)){if(angular.isDefined(o.node.stateParams)&&angular.isDefined(t.params)&&!angular.equals(o.node.stateParams,t.params))return;n.$emit("msNavigation::stateMatched"),s.setActiveItem(o.node,n)}n.$on("msNavigation::stateMatched",function(){o.collapsable&&o.collapsed&&n.$evalAsync(function(){o.collapsed=!1})}),n.$on("msNavigation::collapse",function(e,t){if(!o.collapsed&&o.collapsable)if(angular.isUndefined(t))o.collapse();else{var n=t.split("."),a=[],i=s.getActiveItem();if(i&&(a=i.node._path.split(".")),-1<n.indexOf(o.node._id))return;if(-1<a.indexOf(o.node._id))return;o.collapse()}}),n.$on("$stateChangeSuccess",function(){if(o.node.state===t.current.name){if(angular.isDefined(o.node.stateParams)&&angular.isDefined(t.params)&&!angular.equals(o.node.stateParams,t.params))return;s.setActiveItem(o.node,n),a.$broadcast("msNavigation::collapse",o.node._path)}if(t.includes(o.node.state)){if(angular.isDefined(o.node.stateParams)&&angular.isDefined(t.params)&&!angular.equals(o.node.stateParams,t.params))return;n.$emit("msNavigation::stateMatched")}})}()}function a(t){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){t.setNavigationScope(e)}}}}function i(n,e,t,a,i){var s=this;s.element=e,s.node=n.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;n.$emit("msNavigation::stateMatched"),i.setActiveItem(s.node,n)}n.$on("msNavigation::stateMatched",function(){s.hasChildren&&n.$evalAsync(function(){s.isActive=!0})}),n.$on("msNavigation::clearActive",function(){if(s.hasChildren){var e=[],t=i.getActiveItem();t&&(e=t.node._path.split(".")),-1<e.indexOf(s.node._id)?n.$evalAsync(function(){s.isActive=!0}):n.$evalAsync(function(){s.isActive=!1})}}),n.$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,n),t.$broadcast("msNavigation::clearActive")}})}()}function s(i){return{restrict:"A",require:"^msNavigationHorizontalNode",compile:function(e){return e.addClass("ms-navigation-horizontal-item"),function(e,t,n,a){t.on("click",function(){if(!a.hasChildren||i("gt-md"))return;t.toggleClass("expanded")}),e.$on("$destroy",function(){t.off("click")})}}}}e.$inject=["$scope","msNavigationService"],t.$inject=["$rootScope","$timeout","$mdSidenav","msNavigationService"],n.$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 o(e,t){if(angular.isString(e)){for(var n=e.split("."),a=n[n.length-1],i=function(e){var t=l;if(1===e.length)return t;e.pop();for(var n=0;n<e.length;n++){for(var a=e[n],i=!0,s=0;s<t.length;s++)if(t[s]._id===a){t=t[s].children,i=!1;break}if(i){var o={_id:a,_path:e.join("."),title:a,weight:1,children:[]};t.push(o),t=o.children}}return t}(n),s=!1,o=0;o<i.length;o++)if(i[o]._id===a){s=i[o];break}s?(angular.extend(s,t),s.uisref=m(s)):(t.children=[],!angular.isUndefined(t.weight)&&angular.isNumber(t.weight)||(t.weight=1),t._id=a,t._path=e,t.uisref=m(t),i.push(t))}else r.error("path must be a string (eg. `dashboard.project`)")}function d(e){if(angular.isString(e)){for(var t=l,n=e.split("."),a=0;a<n.length;a++)for(var i=n[a],s=0;s<t.length;s++)if(t[s]._id===i){if(t[s]._path===e)return t.splice(s,1),!0;t=t[s].children;break}return!1}r.error("path must be a string (eg. `dashboard.project`)")}function c(e){e||(e=l).sort(a);for(var t=0;t<e.length;t++){var n=e[t].children;1<n.length&&n.sort(a),0<n.length&&c(n)}}function a(e,t){return parseInt(e.weight)-parseInt(t.weight)}function m(e){var t="";return angular.isDefined(e.state)&&(t=e.state,angular.isDefined(e.stateParams)&&angular.isObject(e.stateParams)&&(t=t+"("+angular.toJson(e.stateParams)+")")),t}this.saveItem=o,this.deleteItem=d,this.sortByWeight=c,this.$get=function(){var n=null,t=null,a=null,i=null,e={saveItem:o,deleteItem:d,sort:c,clearNavigation:function(){l=[],t&&(t.vm.navigation=l)},setActiveItem:function(e,t){n={node:e,scope:t}},getActiveItem:function(){return n},getNavigation:s,getFlatNavigation:function(e){return function e(t){var n=[];for(var a=0;a<t.length;a++){var i=angular.copy(t[a]);i.children=[],n.push(i),0<t[a].children.length&&(n=n.concat(e(t[a].children)))}return n}(s(e))},setNavigationScope:function(e){t=e},setFolded:function(e){a=e},getFolded:function(){return a},setFoldedOpen:function(e){i=e},getFoldedOpen:function(){return i},toggleFolded:function(){t.toggleFolded()}};return e;function s(e){if(e){for(var t=0;t<l.length;t++)if(l[t]._id===e)return[l[t]];return null}return l}}}).controller("MsNavigationController",e).directive("msNavigation",t).controller("MsNavigationNodeController",n).directive("msNavigationNode",function(){return{restrict:"A",bindToController:{node:"=msNavigationNode"},controller:"MsNavigationNodeController as vm",compile:function(e){return e.addClass("ms-navigation-node"),function(e,t,n,a){t.addClass(a.getClass()),a.group&&t.addClass("group")}}}}).directive("msNavigationItem",function(){return{restrict:"A",require:"^msNavigationNode",compile:function(e){return e.addClass("ms-navigation-item"),function(e,t,n,a){a.collapsable&&t.on("click",a.toggleCollapsed),e.$on("$destroy",function(){t.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,t,n,a){t.addClass(a.getClass()),a.group&&t.addClass("group")}}}}).directive("msNavigationHorizontalItem",s)}(),function(){"use strict";function e(i,n,s,e,a,o,t,r,l,d,c){var m=this,u=["ringingId","speakerId","microphoneId","ringingVolume","speakerVolume","microphoneVolume","ringingMute","speakerMute","microphoneMute"],p=JSON.parse(t.localStorage.getItem("motion2.user:"+m.conf.id))||{webrtc:{ringingVolume:.5,speakerVolume:.5,microphoneVolume:1,ringingMute:!1,speakerMute:!1,microphoneMute:!1}};function g(e){switch(e){case"ringing":m.conf.ringingMute?m.soundPlayer.muted=!0:m.soundPlayer.muted=!1,m.conf.ringingId&&m.soundPlayer.setSinkId(m.conf.ringingId).then(function(){m.soundPlayer.volume=m.conf.ringingVolume}).then(f).catch(function(e){console.info(e.message,m.conf.ringingId)});break;case"speaker":m.conf.speakerMute?m.remotePlayer.muted=!0:m.remotePlayer.muted=!1,m.conf.speakerId&&m.remotePlayer.setSinkId(m.conf.speakerId).then(function(){m.remotePlayer.volume=m.conf.speakerVolume}).then(f).catch(function(e){console.info(e.message,m.conf.speakerId)});break;case"microphone":for(var t=0;t<m.sessions.length;t+=1)m.conf.microphoneMute?m.sessions[t].mute():m.sessions[t].unmute();f();break;default:console.log("unknown device")}}function v(e,t,n){m.calls.unshift({target:e,fullname:n||e,inbound:t,time:moment().format("HH:mm")}),50<m.calls.length&&m.calls.pop()}function h(){return m.conf.license&&m.conf.isWebRTCSupported&&m.conf.hasMicrophone&&m.conf.hasSpeakers&&"https"===m.conf.protocol&&("chrome"===m.conf.browserName.toLowerCase()||"opera"===m.conf.browserName.toLowerCase()||"safari"===m.conf.browserName.toLowerCase())}function f(){p.webrtc=_.pick(m.conf,u),t.localStorage.setItem("motion2.user:"+m.conf.id,JSON.stringify(p))}function b(e){this.remotePlayer.srcObject=e.stream}function E(e){var t,n,a=e.session;switch(e.originator){case"local":a.outgoing=!0,a.name=e.request.ruri.user,a.user=e.request.ruri.user,v(a.user,!1);break;case"remote":a.incoming=!0,a.name=e.request.from.display_name,a.user=e.request.from.uri.user,t=e.session,n=t.name?t.name+" <"+t.user+">":t.user,c.create("Incoming call from: ",n,null,function(){t.answer(m.sessionConf)},function(){t.terminate()}).then(function(e){t.notification=e}).catch(function(e){console.error(e)}),v(e.session.user,!0),m.conf.autoAnswer&&s(function(){a.isInProgress()&&(a.autoAnswer=!0,m.conf.microphoneId?m.sessionConf.mediaConstraints.audio={deviceId:m.conf.microphoneId}:m.sessionConf.mediaConstraints.audio=!0,a.answer(m.sessionConf))},m.conf.autoAnswerDelay?1e3*m.conf.autoAnswerDelay:0)}a.call_id=e.request.call_id,a.connection&&(a.connection.onaddstream=b.bind(this)),a.on("progress",function(e,t){var n=!1;switch(t.originator){case"local":this.conf.ringingMute||(this.soundPlayer.setAttribute("src","assets/ms-phonebar/sounds/incoming-call.ogg"),n=!0);break;case"remote":this.putOtherCallsOnHold(e),this.soundPlayer.setAttribute("src","assets/ms-phonebar/sounds/outgoing-call.ogg"),n=!0}n&&(this.soundPlayer.loop="loop",this.soundPlayer.play().catch(function(e){console.log(e.message)}))}.bind(this,a)),a.on("confirmed",function(n,e){return n.confirmed=!0,"remote"===e.originator&&n.connection&&(n.connection.onaddstream=b.bind(this),_.head(n.connection.getRemoteStreams())&&(this.remotePlayer.srcObject=_.head(n.connection.getRemoteStreams()))),this.soundPlayer.pause(),this.soundPlayer.loop=null,this.putOtherCallsOnHold(n),g("speaker"),g("microphone"),n.autoAnswer&&(this.soundPlayer.setAttribute("src","assets/ms-phonebar/sounds/beep.ogg"),this.soundPlayer.play().catch(function(e){console.log(e.message)})),2==m.sessions.length?m.canGoInConference=!0:m.canGoInConference=!1,d.rpc.getVoiceChannels().$promise.then(function(e){var t=_.find(e.rows,function(e){return e.sipcalllinkedid===n.call_id?e:e.sipcalluniqueid===n.call_id?e:null});t&&(n.monitor=t.monitor,n.uniqueid=t.uniqueid,n.monitors=t.monitors)}).catch(function(e){console.error(e)})}.bind(this,a)),a.on("hold",function(e,t){"local"===t.originator&&(e.localHold=!0)}.bind(this,a)),a.on("unhold",function(e,t){"local"===t.originator&&(e.localHold=!1)}.bind(this,a)),a.on("ended",function(e,t){_.includes(m.currentConferenceSessions,e.id)&&T(),_.remove(this.sessions,{id:e.id})}.bind(this,a)),a.on("failed",function(e,t){this.soundPlayer.pause(),this.soundPlayer.loop=null,e.notification&&e.notification.close(),_.includes(m.currentConferenceSessions,e.id)&&T(),_.remove(this.sessions,{id:e.id})}.bind(this,a)),this.sessions.push(a)}function A(){m.target="",document.getElementById("ms-target").blur(),document.getElementById("ms-target").value="",i.$broadcast("angucomplete-alt:clearInput","ms-target-wrap")}function y(e,t,n,a){return function(){o.show(o.simple().textContent(t).position(n).hideDelay(a)),e.terminate()}}function S(t){return d.user.getVoicePrefixes({id:m.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(n.body),clickOutsideToClose:!0,locals:{prefixes:e,required:m.conf.phoneBarPrefixRequired}})}).then(function(e){if(m.conf.phoneBarPrefixRequired){if(e&&-1!==e)return e+t}else{if(e&&-1!==e)return e+t;if(!e)return t}})}function T(){m.canGoInConference=!1,m.isInConference=!1,m.currentconferenceSessions=[]}e(function(){},999),m.direction="right",m.selectedMode="md-scale",m.target="",m.showDialpad=!1,m.soundPlayer=document.createElement("audio"),m.remotePlayer=document.getElementById(m.conf.remotePlayerId),m.soundPlayer.volume=1,m.sessionConf={mediaConstraints:{audio:!0,video:!1}},m.sessions=[],m.calls=[],m.canGoInConference=!1,m.isInConference=!1,m.currentConferenceSessions=[],m.ua=new JsSIP.UA({sockets:[new JsSIP.WebSocketInterface("wss://"+m.conf.host+":8089/ws")],uri:new JsSIP.URI("sip",m.conf.name,m.conf.host,5060,null,null).toString(),authorization_user:m.conf.name,ha1:m.conf.ha1,realm:m.conf.realm,user_agent:m.conf.ua,session_timers_refresh_method:"invite",register_expires:m.conf.phoneBarExpires||60,register:!0}),m.conf=_.merge(p.webrtc,m.conf),n.bind("keyup",function(e){switch(e.keyCode){case 27:s(function(){m.showDialpad=!1})}}),m.$onInit=function(){g("ringing"),g("speaker"),this.ua.on("registered",function(){console.log("registered"),this.registered=!0}.bind(this)),this.ua.on("unregistered",function(){console.log("unregistered"),this.registered=!1}.bind(this)),this.ua.on("newRTCSession",E.bind(this)),DetectRTC.load(function(){this.conf.hasMicrophone=DetectRTC.hasMicrophone,this.conf.hasSpeakers="Chrome"!==DetectRTC.browser.name&&"Edge"!==DetectRTC.browser.name&&"Opera"!==DetectRTC.browser.name||DetectRTC.hasSpeakers,this.conf.isWebRTCSupported=DetectRTC.isWebRTCSupported,this.conf.osName=DetectRTC.osName,this.conf.osVersion=DetectRTC.osVersion,this.conf.browserName=DetectRTC.browser.name,this.conf.browserVersion=DetectRTC.browser.version,h()?this.ua.start():this.conf.license||l.warning({title:r.instant("TOOLBAR.WARNING"),msg:r.instant("TOOLBAR.WEBRTC_LICENSE_NOT_ENABELD"),clickToClose:!0,showClose:!0,shake:!1,timeout:!1,position:"bottom-right"})}.bind(this))}.bind(this),m.type=function(e,t){var n=e;switch(m.target||(m.target=""),t&&(m.target+=e,i.$broadcast("angucomplete-alt:changeInput","ms-target-wrap",m.target)),e){case"*":n="asterisk";break;case"#":n="pound"}m.conf.enableDtmfTone&&(m.soundPlayer.setAttribute("src","assets/ms-phonebar/sounds/dialpad/"+n+".ogg"),m.soundPlayer.play().catch(function(e){console.log(e.message)}));for(var a=0;a<m.sessions.length;a+=1)m.sessions[a].isEstablished()&&!m.sessions[a].isOnHold().local&&m.sessions[a].sendDTMF(e)},m.call=function(){if(m.target&&m.target!==m.conf.name&&m.target!==m.conf.internal){m.conf.microphoneId?m.sessionConf.mediaConstraints.audio={deviceId:m.conf.microphoneId}:m.sessionConf.mediaConstraints.audio=!0;var e=m.target.replace(/ /g,"");return S(e=(e=e.replace(/\(/g,"")).replace(/\)/g,"")).then(function(e){e&&m.ua.call(e,m.sessionConf)}).then(function(){A()})}},m.hold=function(e){e.hold({useUpdate:!1})},m.refer=function(t){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 S(e)}).then(function(e){t.refer(e,{eventHandlers:{requestSucceeded:y(t,"requestSucceeded","top right",3e3),requestFailed:y(t,"requestFailed","top right",3e3)}})})},m.record=function(e){a.show({controller:"RecordDialogController",controllerAs:"vm",templateUrl:"assets/ms-phonebar/record/dialog.html",parent:angular.element(n.body),clickOutsideToClose:!0,locals:{session:e,sessions:m.sessions}})},m.unhold=function(e){e.unhold({useUpdate:!1}),m.putOtherCallsOnHold(e)},m.answer=function(e){m.conf.microphoneId?m.sessionConf.mediaConstraints.audio={deviceId:m.conf.microphoneId}:m.sessionConf.mediaConstraints.audio=!0,e.answer(m.sessionConf)},m.terminate=function(e){e.terminate()},m.selectSession=function(e){e.unhold({useUpdate:!1}),m.putOtherCallsOnHold(e)},m.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"#":m.type(e.key);break;case"enter":m.call()}},m.toggleDialpad=function(){m.showDialpad=!m.showDialpad},m.referAttended=function(e){a.show({controller:"ReferAttendedDialogController",controllerAs:"vm",templateUrl:"assets/ms-phonebar/referAttended/dialog.html",parent:angular.element(n.body),clickOutsideToClose:!0,locals:{session:e,sessions:_.reject(m.sessions,{id:e.id})}})},m.closeDialpad=function(){m.showDialpad=!1},m.initDevice=g,m.putOtherCallsOnHold=function(e){if(1<m.sessions.length)for(var t=0;t<m.sessions.length;t+=1)m.sessions[t].id===e.id||m.sessions[t].isOnHold().remote||m.sessions[t].hold({useUpdate:!1})},m.targetChanged=function(e){e?/^(\w|\.|\+|#|\*|\(|\)|\s|\-)*$/.test(e)?(m.target=e,i.$broadcast("angucomplete-alt:changeInput","ms-target-wrap",m.target)):m.target?i.$broadcast("angucomplete-alt:changeInput","ms-target-wrap",m.target):A():A()},m.targetSelected=function(e){e&&(m.target=e.originalObject.target,m.call(),A())},m.start3WayConf=function(){m.isInConference=!0,m.canGoInConference=!1,m.confSessions=[];var a=[];m.sessions.forEach(function(e){m.currentConferenceSessions.push(e.id),e.unhold({useUpdate:!1}),null!=e&&e.connection.getReceivers().forEach(function(e){a.push(e.track)})});var i=new AudioContext,s=new MediaStream;m.sessions.forEach(function(e){if(null!=e){var n=i.createMediaStreamDestination();e.connection.getReceivers().forEach(function(t){a.forEach(function(e){s.addTrack(t.track),t.track.id!==e.id&&i.createMediaStreamSource(new MediaStream([e])).connect(n)})}),e.connection.getSenders().forEach(function(e){i.createMediaStreamSource(new MediaStream([e.track])).connect(n)}),e.connection.getSenders()[0].replaceTrack(n.stream.getTracks()[0])}});var e=document.getElementById("remote-audio");e.srcObject=s;var t=e.play();void 0!==t&&t.then(function(){}).catch(function(e){console.log(e)})},i.$on("webrtc::settings",function(e){a.show({controller:"SettingsController",controllerAs:"vm",templateUrl:"assets/ms-phonebar/settings/settings.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,resolve:{devices:function(){return navigator.mediaDevices.enumerateDevices()}},locals:{conf:m.conf}}).then(function(e){e&&(m.conf=e,g("ringing"),g("speaker"))})}),i.$on("webrtc::logout",function(){m.ua.stop()}),i.$on("webrtc::call",function(e,t){t.target&&(m.target=t.target,m.call())}),i.$on("webrtc::transfer",function(e,t){if(t.target)for(var n=0;n<m.sessions.length;n+=1)if(m.sessions[n].isEstablished()&&!m.sessions[n].isOnHold().local)return S(t.target).then(function(e){e&&m.sessions[n].refer(e,{eventHandlers:{requestSucceeded:y(m.sessions[n],"requestSucceeded","top right",3e3),requestFailed:y(m.sessions[n],"requestFailed","top right",3e3)}})})})}e.$inject=["$scope","$document","$timeout","$interval","$mdDialog","$mdToast","$window","$translate","toasty","api","motNotification"],angular.module("app.core").controller("MsPhonebarController",e).directive("msPhonebar",function(){return{restrict:"E",scope:{conf:"="},require:"msPhonebar",controller:"MsPhonebarController",controllerAs:"vm_pb",bindToController:!0,templateUrl:"assets/ms-phonebar/ms-phonebar.html"}})}(),function(){"use strict";function e(t,e,n){var a=this;a.prefixes=e,a.required=n,a.closeDialog=function(e){t.hide(e)},a.call=function(){t.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,t){function n(){t.css("display","inline"),i(a,1e3)}function a(){t.css("display","none"),i(n,1e3)}n()}],replace:!0}}function t(t,i,s,e,n){var o=this;function a(t,e){console.log("startMonitor");var n=i.defer(),a=(e||t.filename.replace(/^.*[\\\/]/,"")).split(".")[0];return s.rpc.startMonitor({uniqueid:o.session.uniqueid,filename:a,format:"wav"}).$promise.then(function(e){t.filename=a+".wav",t.mixmonitorid=e.mixmonitorid,t.status="rec",o.session.monitor=!0,n.resolve(t)}).catch(function(e){n.reject(e)}),n.promise}o.title="Record",o.sessions=e,o.session=n,o.closeDialog=function(){t.hide()},o.addRecording=function(){var e=t.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");t.show(e).then(function(e){return a({},e)}).then(function(e){o.session.monitors.push(e)})},o.stop=function(t){return console.log("stopMonitor"),s.rpc.stopMonitor({uniqueid:o.session.uniqueid,mixmonitorid:t.mixmonitorid}).$promise.then(function(e){t.status="pause",o.session.monitor=_.includes(o.session.monitors,{status:"rec"})}).catch(function(e){console.error(e)})},o.start=a}e.$inject=["$timeout"],t.$inject=["$mdDialog","$q","api","sessions","session"],angular.module("app.core").directive("msBlink",e).controller("RecordDialogController",t)}(),function(){"use strict";function e(t,a,i,e){var s=this;function o(e){t.hide(e)}s.title="Refer Attended",s.sessions=i,s.session=e,s.sessionTarget=null,i.length&&(s.target=i[0].user),s.closeDialog=o,s.transfer=function(){var e,t,n=_.find(i,function(e){if(e.user===s.target)return e});t=n.outgoing?(e=n,s.session):(e=s.session,n);t.refer(e.user,{replaces:e,eventHandlers:{requestSucceeded:function(e){a.show(a.simple().textContent("requestSucceeded").position("top right").hideDelay(3e3)),o(),t.terminate()},requestFailed:function(e){a.show(a.simple().textContent("requestFailed").position("top right").hideDelay(3e3)),o(),t.terminate()}}})}}e.$inject=["$mdDialog","$mdToast","sessions","session"],angular.module("app.core").controller("ReferAttendedDialogController",e)}(),function(){"use strict";function e(e,s,t){var n=this;function a(e,t,n){var a;if(s[n]){if(a=_.find(e,function(e){return e.deviceId===s[n]}))return a.deviceId;var i=_.findIndex(e,function(e){return e.kind===t});if(0<=i)return e[i].deviceId}else(a=_.find(e,function(e){return e.kind===t}))&&(s[n]=a.deviceId);return s[n]||null}s.ringingId=a(t,"audiooutput","ringingId"),s.speakerId=a(t,"audiooutput","speakerId"),s.microphoneId=a(t,"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,n.conf=angular.copy(s),n.devices=t,n.saveSettings=function(){e.hide(n.conf)},n.closeDialog=function(){e.hide()},n.isCompatibleBrowser=function(){return"chrome"===n.conf.browserName.toLowerCase()||"opera"===n.conf.browserName.toLowerCase()||"safari"===n.conf.browserName.toLowerCase()}}e.$inject=["$mdDialog","conf","devices"],angular.module("app.toolbar").controller("SettingsController",e)}(),function(){"use strict";angular.module("app.core").directive("msRandomClass",function(){return{restrict:"A",scope:{msRandomClass:"="},link:function(e,t){var n=e.msRandomClass[Math.floor(Math.random()*e.msRandomClass.length)];t.addClass(n)}}})}(),function(){"use strict";function e(i){return{restrict:"E",scope:{id:"=",model:"=",download:"="},replace:!0,link:function(t,e){var n=!1,a=document.createElement("audio");t.download||a.setAttribute("controlsList","nodownload"),a.setAttribute("preload","none"),a.setAttribute("controls",""),a.setAttribute("style","width: 265px;"),a.setAttribute("src"," "),a.onplay=function(e){n||(n=!0,e.preventDefault(),i[t.model||"voiceRecording"].download({id:t.id}).$promise.then(function(e){var t=[e.buffer],n=new Blob(t,{type:e.type});a.setAttribute("type",e.type),a.setAttribute("src",URL.createObjectURL(n)),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,t){var n=angular.element('<div class="ms-responsive-table-wrapper"></div>');t.after(n),n.append(t)}}})}(),function(){"use strict";function e(s,o,t,n){return{restrict:"AE",compile:function(e){if(!(n.getConfig("disableCustomScrollbars")||n.getConfig("disableCustomScrollbarsOnMobile")&&t.isMobile()))return e.addClass("ms-scroll"),function(e,t,n){var a={};function i(){PerfectScrollbar.update(t[0])}n.msScroll&&(a=e.$eval(n.msScroll)),a=angular.extend({},o.getConfig(),a),s(function(){PerfectScrollbar.initialize(t[0],a)},0),t.on("mouseenter",i),e.$watch(function(){return t.prop("scrollHeight")},function(e,t){angular.isUndefined(e)||angular.equals(e,t)||i()}),e.$watch(function(){return t.prop("scrollWidth")},function(e,t){angular.isUndefined(e)||angular.equals(e,t)||i()}),e.$on("$destroy",function(){t.off("mouseenter"),PerfectScrollbar.destroy(t[0])})}}}}e.$inject=["$timeout","msScrollConfig","msUtils","motionConfig"],angular.module("app.core").provider("msScrollConfig",function(){var t={wheelSpeed:1,wheelPropagation:!1,swipePropagation:!0,minScrollbarLength:null,maxScrollbarLength:null,useBothWheelAxes:!1,useKeyboard:!0,suppressScrollX:!1,suppressScrollY:!1,scrollXMarginOffset:0,scrollYMarginOffset:0,stopPropagationOnClick:!0};this.config=function(e){t=angular.extend({},t,e)},this.$get=function(){var e={getConfig:function(){return t}};return e}}).directive("msScroll",e)}(),function(){"use strict";function e(s,i,e){var o=this;o.collapsed=!0,o.query="",o.queryOptions={debounce:o.debounce||0};var t=!(!o.collapseOnBlur||"true"!=o.collapseOnBlur);o.resultsLoading=!1,o.results=null,o.selectedResultIndex=0,o.ignoreMouseEvents=!1,o.populateResults=function(e){if(o.collapsed)return;var t=angular.isArray(e),n=null===e;if(!t&&!n)return;o.selectedResultIndex=0,o.results=e},o.expand=function(){o.collapsed=!1,s.expand(),o.onExpand&&angular.isFunction(o.onExpand)&&o.onExpand()},o.collapse=function(){o.query="",o.populateResults(null),o.collapsed=!0,s.collapse(),o.onCollapse&&angular.isFunction(o.onCollapse)&&o.onCollapse()},o.blurCollapse=function(){if(!t)return;o.collapse()},o.absorbEvent=function(e){e.preventDefault()},o.handleKeydown=function(e){var t=e.keyCode;-1<[27,38,40].indexOf(t)&&e.preventDefault();switch(t){case 13:if(!o.results)return;o.handleResultClick(o.results[o.selectedResultIndex]);break;case 27:o.collapse();break;case 38:0<=o.selectedResultIndex-1&&(o.selectedResultIndex--,o.ensureSelectedResultIsVisible());break;case 40:if(!o.results)return;o.selectedResultIndex+1<o.results.length&&(o.selectedResultIndex++,o.ensureSelectedResultIsVisible())}},o.handleMouseenter=function(e){if(o.ignoreMouseEvents)return;o.selectedResultIndex=e},o.temporarilyIgnoreMouseEvents=function(){o.ignoreMouseEvents=!0,e.cancel(o.mouseEventIgnoreTimeout),o.mouseEventIgnoreTimeout=e(function(){o.ignoreMouseEvents=!1},250)},o.handleResultClick=function(e){o.onResultClick&&o.onResultClick({item:e});o.collapse()},o.ensureSelectedResultIsVisible=function(){var e=i.find(".ms-search-bar-results"),t=angular.element(e.find(".result")[o.selectedResultIndex]);if(e&&t){var n=t.position().top-8,a=t.position().top+t.outerHeight()+8;o.temporarilyIgnoreMouseEvents(),e.scrollTop()>n&&e.scrollTop(n),a>e.height()+e.scrollTop()&&e.scrollTop(a-e.height())}},s.$watch("MsSearchBar.query",function(e,t){if(!angular.isUndefined(e)&&!angular.equals(e,t)&&!o.collapsed){var n=s.$parent.$eval(o.onSearch,{query:e}),a=angular.isArray(n),i=n&&!!n.then;a&&o.populateResults(n),i&&(o.resultsLoading=!0,n.then(function(e){o.populateResults(e)},function(){o.populateResults([])}).finally(function(){o.resultsLoading=!1}))}})}function t(i){return{restrict:"E",scope:{},require:"msSearchBar",controller:"MsSearchBarController as MsSearchBar",bindToController:{debounce:"=?",onSearch:"@",onResultClick:"&?",onExpand:"&?",onCollapse:"&?",collapseOnBlur:"@"},templateUrl:"app/core/directives/ms-search-bar/ms-search-bar.html",compile:function(e){return e.addClass("ms-search-bar"),function(e,t){var n,a=i.find("body");e.collapse=function(){t.removeClass("expanded"),a.removeClass("ms-search-bar-expanded")},e.expand=function(){t.addClass("expanded"),a.addClass("ms-search-bar-expanded"),n.focus()},n=t.find("#ms-search-bar-input")}}}}e.$inject=["$scope","$element","$timeout"],t.$inject=["$document"],angular.module("app.core").controller("MsSearchBarController",e).directive("msSearchBar",t)}(),function(){"use strict";function e(e,n,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=[],t=l.getFlatNavigation(),n=r.defer(),a=0;a<t.length;a++)t[a].uisref&&e.push(t[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(){n.resolve(e)},250),n.promise},d.loadShortcuts=function(){var e=r.defer(),t=angular.fromJson(n.get("motion.shortcuts"));angular.isUndefined(t)&&(t=[{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}],n.put("motion.shortcuts",angular.toJson(t)));return e.resolve(t),e.promise},d.saveShortcuts=function(){var e=r.defer();return n.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 t=0;t<d.shortcuts.length;t++)d.shortcuts[t]._id===e._id&&(d.shortcuts.splice(t,1),d.query||(0===d.shortcuts.length?d.results=null:t>=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 t=e.keyCode;-1<[38,40].indexOf(t)&&e.preventDefault();switch(t){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"),t=angular.element(e.find(".result")[d.selectedResultIndex]);if(e&&t){var n=t.position().top-8,a=t.position().top+t.outerHeight()+8;d.temporarilyIgnoreMouseEvents(),e.scrollTop()>n&&e.scrollTop(n),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,t){angular.isUndefined(e)||angular.equals(e,t)||(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,t){}}}})}(),function(){"use strict";angular.module("app.core").directive("msSidenavHelper",function(){return{restrict:"A",require:"^mdSidenav",link:function(e,t,n,a){e.$watch(function(){return a.isOpen()&&!a.isLockedOpen()},function(e){angular.isUndefined(e)||(t.parent().toggleClass("full-height",e),angular.element("html").toggleClass("sidenav-open",e))})}}})}(),function(){"use strict";function e(a){return{restrict:"E",link:function(e,t){var n=e.$on("msSplashScreen::remove",function(){a.leave(t).then(function(){n(),e=t=null})})}}}e.$inject=["$animate"],angular.module("app.core").directive("msSplashScreen",e)}(),function(){"use strict";function e(e){var i=this;function t(){i.setCurrentStep(1)}function n(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)?!!n(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,t,n){var a={element:e,scope:t,form:n,stepNumber:t.step||i.steps.length+1,stepTitle:t.stepTitle,stepTitleTranslate:t.stepTitleTranslate};return i.steps.push(a),i.steps.sort(function(e,t){return e.stepNumber-t.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(),t()})},i.setCurrentStep=function(e){if(!o(e))return;if(i.currentStepNumber=e,"horizontal"===i.orientation){for(var t=0;t<i.steps.length;t++)i.steps[t].element.hide();i.steps[i.currentStepNumber-1].element.show()}else if("vertical"===i.orientation){for(var n=0;n<i.steps.length;n++)i.steps[n].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,t=e;1<=t;t--)if(!a(t)){e=t;break}i.setCurrentStep(e)},i.gotoNextStep=function(){for(var e=i.currentStepNumber+1,t=e;t<=i.steps.length;t++)if(!a(t)){e=t;break}i.setCurrentStep(e)},i.gotoFirstStep=t,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 t=!1,n=1;n<e;n++)if(!s(n)){t=!0;break}return t},i.isStepOptional=n,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 t(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,t,n,a){var i=a[0],s=a[1];o(function(){s.setOrientation("vertical"),s.registerMainForm(i),s.setupSteps()})}}}}e.$inject=["$timeout"],t.$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,t,n,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,t,n,a){var i=a[0],s=a[1];e.optionalStep=angular.isDefined(n.optionalStep),s.registerStep(t,e,i),t.hide()}}}}).directive("msVerticalStepper",t).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,t,n,a){var i=a[0],s=a[1];e.optionalStep=angular.isDefined(n.optionalStep),e.stepInfo=s.registerStep(t,e,i),e.MsStepper=s,t.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,t){}}}}e.$inject=["$document"],angular.module("app.core").controller("MsTabScrollController",function(){function t(){var e=document.getElementById("bar-container"),t=document.getElementById("tab-container");return t.scrollWidth>e.scrollWidth&&0==e.scrollLeft&&0==t.scrollLeft?"right":t.scrollWidth>e.scrollWidth&&t.scrollLeft>e.scrollLeft&&e.scrollWidth+t.scrollLeft>=t.scrollWidth?"left":t.scrollWidth>e.scrollWidth&&t.scrollLeft>e.scrollLeft&&e.scrollWidth+t.scrollLeft<t.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(t()){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,n,t,a){var i=72,s=!1,o=!1,r=a.getScrollEl();!function(){n.find("ms-card")?e.$on("msCard::cardTemplateLoaded",function(e,t){var n=angular.element(t[0]);d(n).then(function(){m(function(){s=!0})})}):d(n).then(function(){m(function(){s=!0})});r.on("scroll",c),c()}();var l=e.$watch(function(){return s&&o},function(e,t){angular.equals(e,t)||e&&(n.removeClass("hidden").addClass("animate"),l())},!0);function d(e){var t=u.defer(),n=e.find("img");return 0<n.length?n.on("load",function(){t.resolve("Image is loaded")}):t.resolve("No images"),t.promise}function c(){r.scrollTop()+r.height()>n.position().top+i&&(m(function(){o=!0}),r.off("scroll",c))}}}}}e.$inject=["$timeout","$q"],angular.module("app.core").controller("MsTimelineController",function(){var t=this;t.scrollEl=void 0,t.setScrollEl=function(e){t.scrollEl=e},t.getScrollEl=function(){return t.scrollEl}}).directive("msTimeline",function(){return{scope:{msTimeline:"=?",loadMore:"&?msTimelineLoadMore"},controller:"MsTimelineController",compile:function(e){return e.addClass("ms-timeline"),function(e,t,n,a){var i=angular.element('<div class="ms-timeline-loader md-accent-bg md-whiteframe-4dp"><span class="spinner animate-rotate"></span></div>');t.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().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(a,e,t,n,i,s,o,r,l){function d(){a.timeoutId&&clearTimeout(a.timeoutId)}function c(){void 0!==o.startTime&&(a.millis=moment().diff(moment(a.startTime))),a.maxTimeUnit&&"day"!==a.maxTimeUnit?"second"===a.maxTimeUnit?(a.seconds=Math.floor(a.millis/1e3),a.minutes=0,a.hours=0,a.days=0,a.months=0,a.years=0):"minute"===a.maxTimeUnit?(a.seconds=Math.floor(a.millis/1e3%60),a.minutes=Math.floor(a.millis/6e4),a.hours=0,a.days=0,a.months=0,a.years=0):"hour"===a.maxTimeUnit?(a.seconds=Math.floor(a.millis/1e3%60),a.minutes=Math.floor(a.millis/6e4%60),a.hours=Math.floor(a.millis/36e5),a.days=0,a.months=0,a.years=0):"month"===a.maxTimeUnit?(a.seconds=Math.floor(a.millis/1e3%60),a.minutes=Math.floor(a.millis/6e4%60),a.hours=Math.floor(a.millis/36e5%24),a.days=Math.floor(a.millis/36e5/24%30),a.months=Math.floor(a.millis/36e5/24/30),a.years=0):"year"===a.maxTimeUnit&&(a.seconds=Math.floor(a.millis/1e3%60),a.minutes=Math.floor(a.millis/6e4%60),a.hours=Math.floor(a.millis/36e5%24),a.days=Math.floor(a.millis/36e5/24%30),a.months=Math.floor(a.millis/36e5/24/30%12),a.years=Math.floor(a.millis/36e5/24/365)):(a.seconds=Math.floor(a.millis/1e3%60),a.minutes=Math.floor(a.millis/6e4%60),a.hours=Math.floor(a.millis/36e5%24),a.days=Math.floor(a.millis/36e5/24),a.months=0,a.years=0),a.secondsS=1===a.seconds||0===a.seconds?"":"s",a.minutesS=1===a.minutes||0===a.minutes?"":"s",a.hoursS=1===a.hours||0===a.hours?"":"s",a.daysS=1===a.days||0===a.days?"":"s",a.monthsS=1===a.months||0===a.months?"":"s",a.yearsS=1===a.years||0===a.years?"":"s",a.sseconds=a.seconds<10?"0"+a.seconds:a.seconds,a.mminutes=a.minutes<10?"0"+a.minutes:a.minutes,a.hhours=a.hours<10?"0"+a.hours:a.hours,a.ddays=a.days<10?"0"+a.days:a.days,a.mmonths=a.months<10?"0"+a.months:a.months,a.yyears=a.years<10?"0"+a.years:a.years}"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),a.autoStart=o.autoStart||o.autostart,0===r.html().trim().length?r.append(l("<span>{{millis}}</span>")(a)):r.append(l(r.contents())(a)),a.interval=a.intervalAttr||1e3,a.startTime=null,a.endTime=null,a.timeoutId=null,a.countdown=a.countdownAttr&&0<=parseInt(a.countdownAttr,10)?parseInt(a.countdownAttr,10):void 0,a.isRunning=!1,a.$watch("startTimeAttr",function(e,t){e!==t&&a.isRunning&&a.start()}),a.$on("timer-start",function(){a.start()}),a.$on("timer-resume",function(){a.resume()}),a.$on("timer-stop",function(){a.stop()}),a.$on("timer-clear",function(){a.clear()}),a.$on("timer-set-countdown",function(e,t){a.countdown=t}),a.start=r[0].start=function(){var e=moment(),t=a.startTimeAttr?moment(a.startTimeAttr):null;a.startTime=!t||e<t?e:t;var n=a.endTimeAttr?moment(a.endTimeAttr):null;a.endTime=!n||n<e?null:n,a.countdown||(a.countdown=a.countdownAttr&&0<parseInt(a.countdownAttr,10)?parseInt(a.countdownattr,10):void 0),d(),m(),a.isRunning=!0},a.resume=r[0].resume=function(){d(),a.countdownAttr&&(a.countdown+=1),a.startTime=moment().diff(moment(a.stoppedTime).diff(moment(a.startTime))),m(),a.isRunning=!0},a.stop=a.pause=r[0].stop=r[0].pause=function(){a.clear(),a.$emit("timer-stopped",{timeoutId:a.timeoutId,millis:a.millis,seconds:a.seconds,minutes:a.minutes,hours:a.hours,days:a.days})},a.clear=r[0].clear=function(){a.stoppedTime=moment(),d(),a.timeoutId=null,a.isRunning=!1},r.bind("$destroy",function(){d(),a.isRunning=!1});var m=function(){a.millis=moment().diff(a.startTime);var e=a.millis%1e3;if(a.endTimeAttr&&(a.millis=moment(a.endTime).diff(moment()),e=a.interval-a.millis%1e3),a.countdownAttr&&(a.millis=1e3*a.countdown),a.millis<0)return a.stop(),a.millis=0,c(),void(a.finishCallback&&a.$eval(a.finishCallback));c(),a.timeoutId=setTimeout(function(){m(),a.$digest()},a.interval-e),a.$emit("timer-tick",{timeoutId:a.timeoutId,millis:a.millis}),0<a.countdown?a.countdown--:a.countdown<=0&&(a.stop(),a.finishCallback&&a.$eval(a.finishCallback))};void 0!==a.autoStart&&!0!==a.autoStart||a.start()}e.$inject=["$scope","$document","$timeout","$interval","$window","$translate","$attrs","$element","$compile"],angular.module("app.core").controller("MsTimerController",e).directive("timer",function(){return{restrict:"EA",replace:!1,scope:{intervalAttr:"=interval",startTimeAttr:"=startTime",endTimeAttr:"=endTime",countdownAttr:"=countdown",autoStart:"&autoStart",maxTimeUnit:"="},controller:"MsTimerController"}})}(),function(){"use strict";angular.module("app.core").directive("msTimezone",function(){return{restrict:"E",scope:{ngModel:"="},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"]}]}],templateUrl:"app/core/directives/ms-timezone/ms-timezone.html"}})}(),function(){"use strict";angular.module("app.core").controller("MsWidgetEngineCounterController",function(){var a=this;a.filter=[],a.filtered=!1,a.fontSize=20,a.getCount=function(e){var t=0;if(e){a.fontSize=e.attrs[2]&&e.attrs[2].value?parseInt(e.attrs[2].value)-parseInt(e.attrs[2].value)%2:20,e.attrs[1].value&&e.attrs[1].value.length?(a.filtered=!0,a.filter=_.intersection(e.voiceQueuesSelected,e.attrs[1].value)):(a.filtered=!1,a.filter=e.voiceQueuesSelected);for(var n=0;n<e.voiceQueues.rows.length;n+=1)_.includes(a.filter,e.voiceQueues.rows[n].id)&&(t+=e.voiceQueues.rows[n][e.attrs[0].value]?parseInt(e.voiceQueues.rows[n][e.attrs[0].value]):0)}return t}})}(),function(){"use strict";function e(o,e){var r=this;r.filter=[],r.filtered=!1,r.properties=[],r.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"}}]}}},r.getMultiBarChart=function(e){e&&(e.attrs&&function(e){r.properties=_.map(_.filter(e.attrs,function(e){return e.name&&0<=e.name.indexOf("attrSerie")&&e.value&&"null"!==e.value}),"value"),e.attrs[3].value&&e.attrs[3].value.length?(r.filtered=!0,r.filter=_.intersection(e.voiceQueuesSelected,e.attrs[3].value)):(r.filtered=!1,r.filter=e.voiceQueuesSelected);if(r.multiBarChart.series.length>r.properties.length){var t=r.multiBarChart.series.length-r.properties.length;r.multiBarChart.series.splice(0,t),r.multiBarChart.data.splice(0,t)}for(var n=0;n<r.properties.length;n+=1){if(r.multiBarChart.series[n]=o.instant("TOOLS."+r.properties[n].toUpperCase()),_.isNil(r.multiBarChart.data[n])&&(r.multiBarChart.data[n]=[]),r.multiBarChart.labels.length>r.filter.length){var a=r.multiBarChart.labels.length-r.filter.length;r.multiBarChart.labels.splice(0,a),r.multiBarChart.data[n].splice(0,a)}for(var i=0,s=0;i<e.voiceQueues.rows.length;i+=1)_.includes(r.filter,e.voiceQueues.rows[i].id)&&(r.multiBarChart.labels[s]=e.voiceQueues.rows[i].name,r.multiBarChart.data[n][s]=e.voiceQueues.rows[i][r.properties[n]]?parseInt(e.voiceQueues.rows[i][r.properties[n]]):0,s+=1)}}(e),e.foreground&&function(e){r.multiBarChart.options.legend.fontColor=e.foreground;for(var t=0;t<r.multiBarChart.options.scales.xAxes.length;t+=1)r.multiBarChart.options.scales.xAxes[t].ticks.fontColor=e.foreground;for(var n=0;n<r.multiBarChart.options.scales.yAxes.length;n+=1)r.multiBarChart.options.scales.yAxes[n].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){o.properties=_.map(_.filter(e.attrs,function(e){return e.name&&0<=e.name.indexOf("attrSerie")&&e.value&&"null"!==e.value}),"value"),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 t=o.pieChart.labels.length-o.properties.length;o.pieChart.labels.splice(0,t),o.pieChart.data.splice(0,t)}for(var n=0,a=0;n<o.properties.length;n+=1){o.pieChart.labels[n]=s.instant("TOOLS."+o.properties[n].toUpperCase());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[n]]?parseInt(e.voiceQueues.rows[i][o.properties[n]]):0);o.pieChart.data[n]=a,a=0}}(e),e.foreground&&(t=e,o.pieChart.options.legend.fontColor=t.foreground));var t}}e.$inject=["$translate"],angular.module("app.core").controller("MsWidgetEnginePieChartController",e)}(),function(){"use strict";function e(e,n,a,i){var s=this;function t(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,t).$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(t){t&&t.attrs&&(t.attrs[0]&&t.attrs[0].value&&(s.query.id=t.attrs[0].value,i.analyticFieldReport.get({fields:"field,alias",nolimit:!0,DefaultReportId:"default"===t.attrs[0].type?t.attrs[0].value:void 0,CustomReportId:"custom"===t.attrs[0].type?t.attrs[0].value:void 0}).$promise.then(function(e){switch(e&&e.rows&&(s.columns=e.rows),t.attrs[0].type){case"default":s.reportRoute="analyticDefaultReport";break;case"custom":s.reportRoute="analyticCustomReport"}return i[s.reportRoute].get({id:t.attrs[0].value,fields:"id,name"}).$promise}).then(function(e){e&&e.name&&(s.title=e.name),o()}).catch(function(e){console.log(e)})),t.attrs[1]&&t.attrs[1].value&&(s.refresh=parseInt(t.attrs[1].value),!_.isNaN(s.refresh)&&0<s.refresh?(s.countDown=parseInt(t.attrs[1].value),s.interval=a(function(){s.countDown-=1},1e3,0),s.timeout=n(function(){s.interval&&a.cancel(s.interval),e(t)},1e3*s.refresh)):(s.interval&&a.cancel(s.interval),s.timeout&&n.cancel(s.timeout))))},s.getResults=o,s.valueReplacer=function(e,t){moment(t,"YYYY-MM-DDTHH:mm:ssZ",!0).isValid()&&(t=moment(t,"").format("YYYY-MM-DD HH:mm:ss"));return t},e.$on("$destroy",function(){s.interval&&a.cancel(s.interval),s.timeout&&n.cancel(s.timeout)})}e.$inject=["$scope","$timeout","$interval","api"],angular.module("app.core").controller("MsWidgetEngineWebReportController",e)}(),function(){"use strict";function e(e,t){this.getTrustedURL=function(e){return t.trustAsResourceUrl(e)}}function t(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"],t.$inject=["$document"],angular.module("app.core").controller("MsWidgetEngineController",e).directive("msWidgetEngine",t)}(),function(){"use strict";function e(e,t){var n=this;n.flipped=!1,n.flip=function(){if(!angular.isDefined(e.flippable)||!0!==e.flippable)return;n.flipped=!n.flipped,t.toggleClass("flipped",n.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,t,n,a,i){i(function(e){t.empty(),t.append(e)})}}}}).directive("msWidgetFront",function(){return{restrict:"E",require:"^msWidget",transclude:!0,compile:function(e){return e.addClass("ms-widget-front"),function(e,t,n,a,i){i(function(e){t.empty(),t.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,t,n,a,i){i(function(e){t.empty(),t.append(e)}),e.flipWidget=a.flip}}}})}(),function(){"use strict";angular.module("app.core").filter("altDate",function(){return function(e){var t=Date.now()-new Date(e);return t<36e5?moment(e).fromNow():t<864e5?moment(e).format("HH:mm"):t<6048e5?moment(e).format("dddd"):moment(e).calendar()}})}(),function(){"use strict";function e(t){return function(e){return t.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("filterByIds",function(){return function(e,t){if(0===e.length||!t)return e;if(0===t.length)return[];for(var n=[],a=0;a<e.length;a++){for(var i=e[a],s=!1,o=0;o<t.length;o++){var r=t[o];if(i.id===r){s=!0;break}}s&&n.push(i)}return n}})}(),function(){"use strict";angular.module("app.core").filter("filterByPropIds",function(){return function(e,t,n){if(0===e.length||!n||0===n.length)return e;for(var a=[],i=0;i<e.length;i++){for(var s=e[i],o=!1,r=0;r<n.length;r++){var l=n[r];if(-1<s[t].indexOf(l)){o=!0;break}}o&&a.push(s)}return a}})}(),function(){"use strict";angular.module("app.core").filter("filterByTags",function(){return function(e,n){if(0===e.length||0===n.length)return e;var a=[];return e.forEach(function(e){var t=n.every(function(t){var n=!1;return e.tags.forEach(function(e){e.name!==t.name||(n=!0)}),n});t&&a.push(e)}),a}}).filter("filterSingleByTags",function(){return function(e,t){if(0!==e.length&&0!==t.length){if(e.length<t.length)return[];var n=[],a=t.every(function(t){var n=!1;return e.forEach(function(e){e.name!==t.name||(n=!0)}),n});return a&&n.push(e),n}}})}(),function(){"use strict";function c(e,t,n,a){this.id=Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),this.title=e,this.body=t,this.accept=n,this.reject=a,this.close=i}function m(){return/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}function i(){var n=this;navigator.serviceWorker.ready.then(function(e){e.getNotifications().then(function(e){var t=_.find(e,function(e){return e.data.id===n.id});t&&t.close()})})}angular.module("app.dashboards").provider("motNotification",function(){return{$get:[function(){var l,n,d=[];"serviceWorker"in navigator&&m()?navigator.serviceWorker.register("notification.js").then(function(e){(l=e).update(),l.installing?n=l.installing:l.waiting?n=l.waiting:l.active&&(n=l.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===n){var t=_.find(d,{id:e.data.id});if(t)switch(e.data.action){case"accept":t.accept&&t.accept();break;case"reject":t.reject&&t.reject()}}}),{create:function(e,i,s,o,r){return new Promise(function(t,n){var a;m()&&(window.document.hidden||window.document.mozHidden||window.document.webkitHidden)?(a=new c(e||"MyTitle",i||"MyBody",o,r),d.push(a),a?window.Notification.requestPermission().then(function(e){if("granted"===e)return l.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){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,t){var n=e.split("@"),a=n[0],i=n[1],s=t||{};if(!a||!i)return d.error("apiResolver.resolve requires correct action parameter (ResourceName@methodName)"),!1;var o=l.defer(),r=function(e){for(var t=e.split("."),n=c,a=0;a<t.length;a++){if(angular.isUndefined(n[t[a]])){d.error('Resource part "'+t[a]+'" is not defined!'),n=!1;break}n=n[t[a]]}return n||!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";angular.module("app.core").provider("msApi",function(){var n=angular.injector(["ng"]).get("$log"),a="",v=[];function t(e){a=e}function i(){return a}function s(e,t){angular.isString(e)?angular.isArray(t)?v[e]={url:a+(t[0]||""),paramDefaults:t[1]||[],actions:t[2]||[],options:t[3]||{}}:n.error('"resource" must be an array and it must follow $resource definition'):n.error('"path" must be a string (eg. `dashboard.project`)')}this.setBaseUrl=t,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:t,getBaseUrl:i,register:s,resolve:function(e,t){g.$broadcast("msApi::resolveStart");var n=e.split("@"),a=n[0],i=n[1],s=t||{};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,t,n,a){g.$broadcast("msApi::requestStart");var i=e.split("@"),s=i[0],o=i[1],r=t||{};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(n)&&angular.isFunction(n)&&n(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,t){return-1<t.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"}],t=[{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 n(e){for(var t=0;t<e.length;t++){var n=e[t].string,a=e[t].prop;if(i=e[t].versionSearch||e[t].identity,n){if(-1!==n.indexOf(e[t].subString))return e[t].identity}else if(a)return e[t].identity}}function a(e){var t=e.indexOf(i);if(-1!==t)return parseInt(e.substring(t+i.length+1))}var s=n(e)||"unknown-browser",o=a(l.navigator.userAgent)||a(l.navigator.appVersion)||"unknown-version",r=n(t)||"unknown-os";return s=s.toLowerCase(),o=s+"-"+o,r=r.toLowerCase(),d={browser:s,version:o,os:r}},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,t){-1===t.indexOf(e)?t.push(e):t.splice(t.indexOf(e),1)}}}e.$inject=["$window"],angular.module("app.core").factory("msUtils",e)}(),function(){"use strict";function e(e,t){var n=this;n.themes=t.themes,n.layoutModes=[{label:"Boxed",value:"boxed"},{label:"Wide",value:"wide"}],n.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"}],n.layoutMode="wide",n.layoutStyle=e.get("motion.layoutStyle")||"verticalNavigation",n.setActiveTheme=function(e){t.setActiveTheme(e)},n.getActiveTheme=function(){return t.themes.active},n.updateLayoutMode=function(){angular.element("body").toggleClass("boxed","boxed"===n.layoutMode)},n.updateLayoutStyle=function(){e.put("motion.layoutStyle",n.layoutStyle),location.reload()}}function t(t){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(){t("motion-theme-options").toggle()}}}}}e.$inject=["$cookies","motionTheming"],t.$inject=["$mdSidenav"],angular.module("app.core").controller("MsThemeOptionsController",e).directive("msThemeOptions",t)}(),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(n){o[n.name]={},angular.forEach(n.colors,function(e,t){o[n.name][t]={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 t=angular.copy(e);angular.forEach(t,function(n){angular.forEach(n,function(e,t){n[t]=e.levels,n[t].color=e.levels.default.color,n[t].contrast1=e.levels.default.contrast1,n[t].contrast2=e.levels.default.contrast2,n[t].contrast3=e.levels.default.contrast3,n[t].contrast4=e.levels.default.contrast4,delete n[t].default})}),s.setThemesList(t);var n=i.get("motion.selectedTheme");n?s.setActiveTheme(n):s.setActiveTheme("default")}(o);var r={};angular.forEach(o,function(e,t){var n,a,i,s,o;(r={})["@themeName"]=t,angular.forEach(e,function(e,a){angular.forEach(e.levels,function(e,n){angular.forEach(e,function(e,t){r["@"+a+d(n)+d(t)]=e})})}),n=r,a=new RegExp(Object.keys(n).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 n[e]}),s=angular.element("head"),(o=angular.element('<style type="text/css"></style>')).html(i),s.append(o)})},rgba:l};function l(e,t){var n=t||!1;return 4===e.length&&255===e[0]&&255===e[1]&&255===e[2]&&e.splice(3,4),n&&(e=function(e,t){var n={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]=n.white[t]:0===e[0]&&0===e[1]&&0===e[2]&&(e[3]=n.black[t]);return e}(e,n)),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(n,e,t){var a;angular.injector(["ngCookies"]).invoke(["$cookies",function(e){a=e}]);var i=a.getObject("motion.customTheme");i&&(t.custom=i),n.alwaysWatchTheme(!0),angular.forEach(e,function(e){n.definePalette(e.name,e.options)}),angular.forEach(t,function(e,t){n.theme(t).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(t,n,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 n.error('You must have at least one theme named "default"'):(n.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 t.put("motion.selectedTheme",a.themes.active.name));a.themes.active.name=e,a.themes.active.theme=a.themes.list[e],t.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(t,s,o,r){this.search=function(t){for(var e=[],n=r.getFlatNavigation(),a=o.defer(),i=0;i<n.length;i+=1)n[i].uisref&&e.push(n[i]);t&&(e=e.filter(function(e){if(-1<angular.lowercase(e.title).search(angular.lowercase(t)))return!0}));return s(function(){a.resolve(e)},1e3),a.promise},this.searchResultClick=function(e){e.uisref&&(e.stateParams?t.go(e.state,e.stateParams):t.go(e.state))}}e.$inject=["$state","$timeout","$q","msNavigationService"],angular.module("app.errors.error-404").controller("Error404Controller",e)}(),function(){"use strict";function e(e,t){var n=this;n.code="",n.send=!1,n.error=e.params,n.sendReport=function(){t.post("/api/jira",n.error).then(function(e){n.send=!0,e.data&&(n.code=e.data.id)},function(e){n.send=!1})}}e.$inject=["$state","$http"],angular.module("app.errors.error-500").controller("Error500Controller",e)}(),function(){"use strict";function e(e,t){var n=this;n.currentUser=e.getCurrentUser(),n.cookieAlertHide=t.get("motion.cookieAlertHide:"+n.currentUser.id)||!1,n.cookieAlertOnClose=function(){t.put("motion.cookieAlertHide:"+n.currentUser.id,!0)}}e.$inject=["Auth","$cookies"],angular.module("app.footer").controller("FooterController",e)}(),function(){"use strict";function e(e,t,n,a,i){var s=this;s.form={},s.forgotPassword=function(){return i.auth.forgot(s.form).$promise.then(function(){t.success({title:n.instant("FORGOTPASSWORD.LINK_SENT"),msg:n.instant("FORGOTPASSWORD.LINNK_SENT_MESSAGE")})}).catch(function(e){e&&t.error({title:n.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,t){var n=this;n.currentUser=e.getCurrentUser(),n.newsAlertHide=t.get("motion.newsAlertHide:"+n.currentUser.id)||!1,n.newsAlertOnClose=function(){t.put("motion.newsAlertHide:"+n.currentUser.id,!0)}}e.$inject=["Auth","$cookies"],angular.module("app.header").controller("HeaderController",e)}(),function(){"use strict";function e(e){var t={baseUrl:"api/"};return t.auth=e(t.baseUrl+"auth/local",{},{local:{method:"post",url:t.baseUrl+"auth/local"},forgot:{method:"post",url:t.baseUrl+"auth/local/forgot"},reset:{method:"post",url:t.baseUrl+"auth/local/reset/:token",params:{token:"@token"}},google:{method:"post",url:t.baseUrl+"auth/google"}}),t.jira=e(t.baseUrl+"jira"),t.rpc=e(t.baseUrl+"rpc",{},{startMonitor:{method:"get",url:t.baseUrl+"rpc/voice/channels/:uniqueid/mixmonitor",params:{uniqueid:"@uniqueid"}},stopMonitor:{method:"get",url:t.baseUrl+"rpc/voice/channels/:uniqueid/stopmixmonitor",params:{uniqueid:"@uniqueid"}},getVoiceChannels:{method:"get",url:t.baseUrl+"rpc/voice/channels"},getVoiceQueues:{method:"get",url:t.baseUrl+"rpc/voice/queues"},getChatQueues:{method:"get",url:t.baseUrl+"rpc/chat/queues"},getMailQueues:{method:"get",url:t.baseUrl+"rpc/mail/queues"},getSmsQueues:{method:"get",url:t.baseUrl+"rpc/sms/queues"},getOpenchannelQueues:{method:"get",url:t.baseUrl+"rpc/openchannel/queues"},getFaxQueues:{method:"get",url:t.baseUrl+"rpc/fax/queues"},getVoiceQueuesPreview:{method:"get",url:t.baseUrl+"rpc/voice/queues/preview/:id"},getVoiceQueuesChannels:{method:"get",url:t.baseUrl+"rpc/voice/queues/channels"},getVoiceQueuesChannel:{method:"get",url:t.baseUrl+"rpc/voice/queues/channels/:uniqueid"},getVoiceQueuesChannelHangup:{method:"get",url:t.baseUrl+"rpc/voice/queues/channels/:uniqueid/hangup"},getVoiceQueuesChannelRedirect:{method:"get",url:t.baseUrl+"rpc/voice/queues/channels/:uniqueid/redirect/:exten"},getOutbound:{method:"get",url:t.baseUrl+"rpc/outbound"},getOutboundChannels:{method:"get",url:t.baseUrl+"rpc/outbound/channels"},getAgents:{method:"get",url:t.baseUrl+"rpc/agents"},setAgentCapacity:{method:"put",url:t.baseUrl+"rpc/agents/:id/capacity",params:{id:"@id"}},getTelephones:{method:"get",url:t.baseUrl+"rpc/telephones"},getTrunks:{method:"get",url:t.baseUrl+"rpc/trunks"},getCampaigns:{method:"get",url:t.baseUrl+"rpc/campaigns"},getMailAccounts:{method:"get",url:t.baseUrl+"rpc/mail/accounts"},getFaxAccounts:{method:"get",url:t.baseUrl+"rpc/fax/accounts"},getChatQueuesWaitingInteractions:{method:"get",url:t.baseUrl+"rpc/chat/queues/waitinginteractions"},getMailQueuesWaitingInteractions:{method:"get",url:t.baseUrl+"rpc/mail/queues/waitinginteractions"},getOpenchannelQueuesWaitingInteractions:{method:"get",url:t.baseUrl+"rpc/openchannel/queues/waitinginteractions"},getSmsQueuesWaitingInteractions:{method:"get",url:t.baseUrl+"rpc/sms/queues/waitinginteractions"},getFaxQueuesWaitingInteractions:{method:"get",url:t.baseUrl+"rpc/fax/queues/waitinginteractions"},mailQueueNotify:{method:"post",url:t.baseUrl+"rpc/mail/queues/:id/notify",params:{id:"@id"}},chatQueueNotify:{method:"post",url:t.baseUrl+"rpc/chat/queues/:id/notify",params:{id:"@id"}},faxQueueNotify:{method:"post",url:t.baseUrl+"rpc/fax/queues/:id/notify",params:{id:"@id"}},smsQueueNotify:{method:"post",url:t.baseUrl+"rpc/sms/queues/:id/notify",params:{id:"@id"}},openchannelQueueNotify:{method:"post",url:t.baseUrl+"rpc/openchannel/queues/:id/notify",params:{id:"@id"}},agentNotify:{method:"post",url:t.baseUrl+"rpc/agents/:id/notify",params:{id:"@id"}}}),t.version=e(t.baseUrl+"version",{},{fetch:{method:"get",url:t.baseUrl+"version/fetch"},reset:{method:"get",url:t.baseUrl+"version/reset"},pull:{method:"get",url:t.baseUrl+"version/pull"},restart:{method:"get",url:t.baseUrl+"version/restart"},migrations:{method:"get",url:t.baseUrl+"version/migrations"}}),t.system=e(t.baseUrl+"system",{},{killProcess:{method:"get",url:t.baseUrl+"system/process/:pid/kill",params:{pid:"@pid"}}}),t.pm2=e(t.baseUrl+"pm2/:id",{id:"@id"},{update:{method:"put",isArray:!0}}),t.user=e(t.baseUrl+"users/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"users/describe"},clone:{method:"post",url:t.baseUrl+"users/:id/clone",params:{includeAll:"@includeAll"}},bulkCreate:{method:"post",url:t.baseUrl+"users/create_many",isArray:!0},addContacts:{isArray:!0,method:"post",url:t.baseUrl+"users/:id/contacts"},changePassword:{isArray:!1,method:"put",url:t.baseUrl+"users/:id/password"},addQueues:{isArray:!0,method:"post",url:t.baseUrl+"users/:id/queues"},removeQueues:{isArray:!1,method:"delete",url:t.baseUrl+"users/:id/queues"},addAvatar:{isArray:!1,method:"post",url:t.baseUrl+"users/:id/avatar"},getAvatar:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/avatar"},getContacts:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/contacts"},getQueues:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/queues"},getVoiceQueuesRt:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/queues_rt"},getGroups:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/groups"},getRecordings:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/recordings"},getChatInteractions:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/chat/interactions"},getOpenchannelInteractions:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/openchannel/interactions"},getMailInteractions:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/mail/interactions"},getSmsInteractions:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/sms/interactions"},getFaxInteractions:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/fax/interactions"},login:{isArray:!1,method:"post",url:t.baseUrl+"users/:id/login"},logout:{isArray:!1,method:"post",url:t.baseUrl+"users/:id/logout"},pause:{isArray:!1,method:"post",url:t.baseUrl+"users/:id/pause"},unpause:{isArray:!1,method:"post",url:t.baseUrl+"users/:id/unpause"},getTeams:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/teams"},addTeams:{isArray:!0,method:"post",url:t.baseUrl+"users/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:t.baseUrl+"users/:id/teams"},getLists:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/lists"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/agents"},addChatInteractions:{isArray:!0,method:"post",url:t.baseUrl+"users/:id/chat_interactions"},removeChatInteractions:{isArray:!1,method:"delete",url:t.baseUrl+"users/:id/chat_interactions"},addMailInteractions:{isArray:!0,method:"post",url:t.baseUrl+"users/:id/mail_interactions"},removeMailInteractions:{isArray:!1,method:"delete",url:t.baseUrl+"users/:id/mail_interactions"},addFaxInteractions:{isArray:!0,method:"post",url:t.baseUrl+"users/:id/fax_interactions"},removeFaxInteractions:{isArray:!1,method:"delete",url:t.baseUrl+"users/:id/fax_interactions"},addSmsInteractions:{isArray:!0,method:"post",url:t.baseUrl+"users/:id/sms_interactions"},removeSmsInteractions:{isArray:!1,method:"delete",url:t.baseUrl+"users/:id/sms_interactions"},addOpenchannelInteractions:{isArray:!0,method:"post",url:t.baseUrl+"users/:id/openchannel_interactions"},removeOpenchannelInteractions:{isArray:!1,method:"delete",url:t.baseUrl+"users/:id/openchannel_interactions"},getVoicePrefixes:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/prefixes"},getFaxAccounts:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/fax_accounts"},addFaxAccounts:{isArray:!0,method:"post",url:t.baseUrl+"users/:id/fax_accounts"},removeFaxAccounts:{isArray:!1,method:"delete",url:t.baseUrl+"users/:id/fax_accounts"},getMailAccounts:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/mail_accounts"},addMailAccounts:{isArray:!0,method:"post",url:t.baseUrl+"users/:id/mail_accounts"},removeMailAccounts:{isArray:!1,method:"delete",url:t.baseUrl+"users/:id/mail_accounts"},getOpenchannelAccounts:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/openchannel_accounts"},addOpenchannelAccounts:{isArray:!0,method:"post",url:t.baseUrl+"users/:id/openchannel_accounts"},removeOpenchannelAccounts:{isArray:!1,method:"delete",url:t.baseUrl+"users/:id/openchannel_accounts"},getSmsAccounts:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/sms_accounts"},addSmsAccounts:{isArray:!0,method:"post",url:t.baseUrl+"users/:id/sms_accounts"},removeSmsAccounts:{isArray:!1,method:"delete",url:t.baseUrl+"users/:id/sms_accounts"},getChatWebsites:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/chat_websites"},addChatWebsites:{isArray:!0,method:"post",url:t.baseUrl+"users/:id/chat_websites"},removeChatWebsites:{isArray:!1,method:"delete",url:t.baseUrl+"users/:id/chat_websites"},getSquareProjects:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/square_projects"},addSquareProjects:{isArray:!0,method:"post",url:t.baseUrl+"users/:id/square_projects"},removeSquareProjects:{isArray:!1,method:"delete",url:t.baseUrl+"users/:id/square_projects"},getScheduledCalls:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/scheduled_calls"},getApiKey:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/api_key"},createApiKey:{isArray:!1,method:"post",url:t.baseUrl+"users/:id/api_key"},removeApiKey:{isArray:!1,method:"delete",url:t.baseUrl+"users/:id/api_key"}}),t.voiceChanSpy=e(t.baseUrl+"voice/chanspy/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/chanspy/describe"},clone:{method:"post",url:t.baseUrl+"voice/chanspy/:id/clone",params:{includeAll:"@includeAll"}}}),t.voiceContext=e(t.baseUrl+"voice/contexts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/contexts/describe"},clone:{method:"post",url:t.baseUrl+"voice/contexts/:id/clone",params:{includeAll:"@includeAll"}}}),t.voiceExtension=e(t.baseUrl+"voice/extensions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/extensions/describe"},clone:{method:"post",url:t.baseUrl+"voice/extensions/:id/clone",params:{includeAll:"@includeAll"}},addApplications:{isArray:!1,method:"post",url:t.baseUrl+"voice/extensions/:id/applications"}}),t.voiceMusicOnHold=e(t.baseUrl+"voice/mohs/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/mohs/describe"},clone:{method:"post",url:t.baseUrl+"voice/mohs/:id/clone",params:{includeAll:"@includeAll"}},addSound:{isArray:!1,method:"post",url:t.baseUrl+"voice/mohs/:id/sounds"},removeSound:{isArray:!1,method:"delete",url:t.baseUrl+"voice/mohs/:id/sounds/:id2"},getSounds:{isArray:!1,method:"get",url:t.baseUrl+"voice/mohs/:id/sounds"}}),t.voiceQueue=e(t.baseUrl+"voice/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/queues/describe"},clone:{method:"post",url:t.baseUrl+"voice/queues/:id/clone",params:{includeAll:"@includeAll"}},getHoppers:{isArray:!1,method:"get",url:t.baseUrl+"voice/queues/:id/hoppers"},getHopperHistories:{isArray:!1,method:"get",url:t.baseUrl+"voice/queues/:id/hopper_histories"},getHopperFinals:{isArray:!1,method:"get",url:t.baseUrl+"voice/queues/:id/hopper_finals"},getHopperBlacks:{isArray:!1,method:"get",url:t.baseUrl+"voice/queues/:id/hopper_black"},getTeams:{isArray:!1,method:"get",url:t.baseUrl+"voice/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:t.baseUrl+"voice/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:t.baseUrl+"voice/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"voice/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"voice/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"voice/queues/:id/users"},getMembers:{isArray:!1,method:"get",url:t.baseUrl+"voice/queues/:id/members"},getLists:{isArray:!1,method:"get",url:t.baseUrl+"voice/queues/:id/lists"},addLists:{isArray:!0,method:"post",url:t.baseUrl+"voice/queues/:id/lists"},removeLists:{isArray:!0,method:"delete",url:t.baseUrl+"voice/queues/:id/lists"},getBlackLists:{isArray:!1,method:"get",url:t.baseUrl+"voice/queues/:id/blacklists"},addBlackLists:{isArray:!0,method:"post",url:t.baseUrl+"voice/queues/:id/blacklists"},removeBlackLists:{isArray:!0,method:"delete",url:t.baseUrl+"voice/queues/:id/blacklists"}}),t.voiceRecording=e(t.baseUrl+"voice/recordings/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/recordings/describe"},clone:{method:"post",url:t.baseUrl+"voice/recordings/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:t.baseUrl+"voice/recordings/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}},downloads:{isArray:!1,method:"get",url:t.baseUrl+"voice/recordings/:id/downloads"}}),t.voiceMail=e(t.baseUrl+"voice/mails/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/mails/describe"},clone:{method:"post",url:t.baseUrl+"voice/mails/:id/clone",params:{includeAll:"@includeAll"}},getMessages:{isArray:!1,method:"get",url:t.baseUrl+"voice/mails/:id/messages"}}),t.voiceMailMessage=e(t.baseUrl+"voice/mails/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/mails/messages/describe"},clone:{method:"post",url:t.baseUrl+"voice/mails/messages/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:t.baseUrl+"voice/mails/messages/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}}}),t.voiceCallReport=e(t.baseUrl+"voice/calls/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/calls/reports/describe"},clone:{method:"post",url:t.baseUrl+"voice/calls/reports/:id/clone",params:{includeAll:"@includeAll"}}}),t.voiceDialReport=e(t.baseUrl+"voice/dials/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/dials/reports/describe"},clone:{method:"post",url:t.baseUrl+"voice/dials/reports/:id/clone",params:{includeAll:"@includeAll"}}}),t.voiceAgentReport=e(t.baseUrl+"voice/agents/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/agents/reports/describe"},clone:{method:"post",url:t.baseUrl+"voice/agents/reports/:id/clone",params:{includeAll:"@includeAll"}}}),t.voiceQueueReport=e(t.baseUrl+"voice/queues/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/queues/reports/describe"},clone:{method:"post",url:t.baseUrl+"voice/queues/reports/:id/clone",params:{includeAll:"@includeAll"}},getVoiceQueuesReport:{isArray:!1,method:"get",url:t.baseUrl+"voice/queues/reports/index"}}),t.memberReport=e(t.baseUrl+"members/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"members/reports/describe"},clone:{method:"post",url:t.baseUrl+"members/reports/:id/clone",params:{includeAll:"@includeAll"}}}),t.trunk=e(t.baseUrl+"trunks/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"trunks/describe"},clone:{method:"post",url:t.baseUrl+"trunks/:id/clone",params:{includeAll:"@includeAll"}}}),t.voiceTransferReport=e(t.baseUrl+"voice/transfers/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/transfers/reports/describe"},clone:{method:"post",url:t.baseUrl+"voice/transfers/reports/:id/clone",params:{includeAll:"@includeAll"}}}),t.mailServerOut=e(t.baseUrl+"mail/out_servers/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"mail/out_servers/describe"},clone:{method:"post",url:t.baseUrl+"mail/out_servers/:id/clone",params:{includeAll:"@includeAll"}}}),t.mailAccount=e(t.baseUrl+"mail/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"mail/accounts/describe"},clone:{method:"post",url:t.baseUrl+"mail/accounts/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:t.baseUrl+"mail/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:t.baseUrl+"mail/accounts/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:t.baseUrl+"mail/accounts/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:t.baseUrl+"mail/accounts/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:t.baseUrl+"mail/accounts/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:t.baseUrl+"mail/accounts/:id/canned_answers"},getImap:{isArray:!1,method:"get",url:t.baseUrl+"mail/accounts/:id/in_servers"},addImap:{isArray:!1,method:"post",url:t.baseUrl+"mail/accounts/:id/in_servers"},removeImap:{isArray:!1,method:"delete",url:t.baseUrl+"mail/accounts/:id/in_servers"},getSmtp:{isArray:!1,method:"get",url:t.baseUrl+"mail/accounts/:id/out_servers"},addSmtp:{isArray:!1,method:"post",url:t.baseUrl+"mail/accounts/:id/out_servers"},removeSmtp:{isArray:!1,method:"delete",url:t.baseUrl+"mail/accounts/:id/out_servers"},addInteraction:{isArray:!1,method:"post",url:t.baseUrl+"mail/accounts/:id/interactions"},getInteractions:{isArray:!1,method:"get",url:t.baseUrl+"mail/accounts/:id/interactions"},addApplications:{isArray:!1,method:"post",url:t.baseUrl+"mail/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:t.baseUrl+"mail/accounts/:id/applications"},getMessages:{isArray:!1,method:"get",url:t.baseUrl+"mail/accounts/:id/messages"},send:{isArray:!1,method:"post",url:t.baseUrl+"mail/accounts/:id/send"},verifySmtp:{isArray:!1,method:"get",url:t.baseUrl+"mail/accounts/:id/verify"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"mail/accounts/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"mail/accounts/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"mail/accounts/:id/users"}}),t.mailQueue=e(t.baseUrl+"mail/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"mail/queues/describe"},clone:{method:"post",url:t.baseUrl+"mail/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:t.baseUrl+"mail/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:t.baseUrl+"mail/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:t.baseUrl+"mail/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:t.baseUrl+"mail/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"mail/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"mail/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"mail/queues/:id/users"}}),t.mailSubstatus=e(t.baseUrl+"mail/substatuses/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"mail/substatuses/describe"},clone:{method:"post",url:t.baseUrl+"mail/substatuses/:id/clone",params:{includeAll:"@includeAll"}}}),t.mailInteraction=e(t.baseUrl+"mail/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"mail/interactions/describe"},clone:{method:"post",url:t.baseUrl+"mail/interactions/:id/clone",params:{includeAll:"@includeAll"}},addMessage:{isArray:!1,method:"post",url:t.baseUrl+"mail/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:t.baseUrl+"mail/interactions/:id/messages"},addTags:{isArray:!1,method:"post",url:t.baseUrl+"mail/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:t.baseUrl+"mail/interactions/:id/tags"},download:{isArray:!1,method:"get",url:t.baseUrl+"mail/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}}}),t.mailMessage=e(t.baseUrl+"mail/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"mail/messages/describe"},clone:{method:"post",url:t.baseUrl+"mail/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:t.baseUrl+"mail/messages/:id/accept"},reject:{isArray:!1,method:"put",url:t.baseUrl+"mail/messages/:id/reject"},download:{isArray:!1,method:"get",url:t.baseUrl+"mail/messages/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}}}),t.mailApplication=e(t.baseUrl+"mail/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"mail/applications/describe"},clone:{method:"post",url:t.baseUrl+"mail/applications/:id/clone",params:{includeAll:"@includeAll"}}}),t.mailQueueReport=e(t.baseUrl+"mail/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"mail/reports/queue/describe"},clone:{method:"post",url:t.baseUrl+"mail/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),t.dashboard=e(t.baseUrl+"dashboards/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"dashboards/describe"},clone:{method:"post",url:t.baseUrl+"dashboards/:id/clone",params:{includeAll:"@includeAll"}},addItem:{isArray:!1,method:"post",url:t.baseUrl+"dashboards/:id/items"},getItems:{isArray:!1,method:"get",url:t.baseUrl+"dashboards/:id/items"}}),t.dashboardItem=e(t.baseUrl+"dashboards/items/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"dashboards/items/describe"},clone:{method:"post",url:t.baseUrl+"dashboards/items/:id/clone",params:{includeAll:"@includeAll"}}}),t.faxAccount=e(t.baseUrl+"fax/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"fax/accounts/describe"},clone:{method:"post",url:t.baseUrl+"fax/accounts/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:t.baseUrl+"fax/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:t.baseUrl+"fax/accounts/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:t.baseUrl+"fax/accounts/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:t.baseUrl+"fax/accounts/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:t.baseUrl+"fax/accounts/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:t.baseUrl+"fax/accounts/:id/canned_answers"},addInteraction:{isArray:!1,method:"post",url:t.baseUrl+"fax/accounts/:id/interactions"},getInteractions:{isArray:!1,method:"get",url:t.baseUrl+"fax/accounts/:id/interactions"},addApplications:{isArray:!1,method:"post",url:t.baseUrl+"fax/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:t.baseUrl+"fax/accounts/:id/applications"},addAccountApplications:{isArray:!1,method:"post",url:t.baseUrl+"fax/accounts/addaccountapplications"},updateAccountApplications:{isArray:!1,method:"post",url:t.baseUrl+"fax/accounts/updateaccountapplications"},getMessages:{isArray:!1,method:"get",url:t.baseUrl+"fax/accounts/:id/messages"},send:{isArray:!1,method:"post",url:t.baseUrl+"fax/accounts/:id/send"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"fax/accounts/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"fax/accounts/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"fax/accounts/:id/users"}}),t.faxApplication=e(t.baseUrl+"fax/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"fax/applications/describe"},clone:{method:"post",url:t.baseUrl+"fax/applications/:id/clone",params:{includeAll:"@includeAll"}}}),t.faxInteraction=e(t.baseUrl+"fax/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"fax/interactions/describe"},clone:{method:"post",url:t.baseUrl+"fax/interactions/:id/clone",params:{includeAll:"@includeAll"}},addMessage:{isArray:!1,method:"post",url:t.baseUrl+"fax/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:t.baseUrl+"fax/interactions/:id/messages"},addTags:{isArray:!1,method:"post",url:t.baseUrl+"fax/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:t.baseUrl+"fax/interactions/:id/tags"},download:{isArray:!1,method:"get",url:t.baseUrl+"fax/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}}}),t.faxMessage=e(t.baseUrl+"fax/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"fax/messages/describe"},clone:{method:"post",url:t.baseUrl+"fax/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:t.baseUrl+"fax/messages/:id/accept"},reject:{isArray:!1,method:"put",url:t.baseUrl+"fax/messages/:id/reject"},download:{isArray:!1,method:"get",url:t.baseUrl+"fax/messages/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}}}),t.faxQueue=e(t.baseUrl+"fax/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"fax/queues/describe"},clone:{method:"post",url:t.baseUrl+"fax/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:t.baseUrl+"fax/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:t.baseUrl+"fax/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:t.baseUrl+"fax/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:t.baseUrl+"fax/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"fax/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"fax/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"fax/queues/:id/users"}}),t.faxQueueReport=e(t.baseUrl+"fax/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"fax/reports/queue/describe"},clone:{method:"post",url:t.baseUrl+"fax/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),t.smsAccount=e(t.baseUrl+"sms/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"sms/accounts/describe"},clone:{method:"post",url:t.baseUrl+"sms/accounts/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:t.baseUrl+"sms/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:t.baseUrl+"sms/accounts/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:t.baseUrl+"sms/accounts/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:t.baseUrl+"sms/accounts/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:t.baseUrl+"sms/accounts/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:t.baseUrl+"sms/accounts/:id/canned_answers"},notify:{isArray:!1,method:"post",url:t.baseUrl+"sms/accounts/:id/notify"},addApplications:{isArray:!1,method:"post",url:t.baseUrl+"sms/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:t.baseUrl+"sms/accounts/:id/applications"},getInteractions:{isArray:!1,method:"get",url:t.baseUrl+"sms/accounts/:id/interactions"},send:{isArray:!1,method:"post",url:t.baseUrl+"sms/accounts/:id/send"},status:{isArray:!1,method:"post",url:t.baseUrl+"sms/accounts/:id/status"},statusGet:{isArray:!1,method:"get",url:t.baseUrl+"sms/accounts/:id/status"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"sms/accounts/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"sms/accounts/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"sms/accounts/:id/users"}}),t.smsApplication=e(t.baseUrl+"sms/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"sms/applications/describe"},clone:{method:"post",url:t.baseUrl+"sms/applications/:id/clone",params:{includeAll:"@includeAll"}}}),t.smsInteraction=e(t.baseUrl+"sms/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"sms/interactions/describe"},clone:{method:"post",url:t.baseUrl+"sms/interactions/:id/clone",params:{includeAll:"@includeAll"}},addMessage:{isArray:!1,method:"post",url:t.baseUrl+"sms/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:t.baseUrl+"sms/interactions/:id/messages"},addTags:{isArray:!1,method:"post",url:t.baseUrl+"sms/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:t.baseUrl+"sms/interactions/:id/tags"},download:{isArray:!1,method:"get",url:t.baseUrl+"sms/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}}}),t.smsMessage=e(t.baseUrl+"sms/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"sms/messages/describe"},clone:{method:"post",url:t.baseUrl+"sms/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:t.baseUrl+"sms/messages/:id/accept"},reject:{isArray:!1,method:"put",url:t.baseUrl+"sms/messages/:id/reject"},status:{isArray:!1,method:"post",url:t.baseUrl+"sms/messages/:id/status"}}),t.smsQueue=e(t.baseUrl+"sms/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"sms/queues/describe"},clone:{method:"post",url:t.baseUrl+"sms/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:t.baseUrl+"sms/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:t.baseUrl+"sms/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:t.baseUrl+"sms/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:t.baseUrl+"sms/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"sms/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"sms/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"sms/queues/:id/users"}}),t.openchannelAccount=e(t.baseUrl+"openchannel/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"openchannel/accounts/describe"},clone:{method:"post",url:t.baseUrl+"openchannel/accounts/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:t.baseUrl+"openchannel/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:t.baseUrl+"openchannel/accounts/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:t.baseUrl+"openchannel/accounts/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:t.baseUrl+"openchannel/accounts/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:t.baseUrl+"openchannel/accounts/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:t.baseUrl+"openchannel/accounts/:id/canned_answers"},notify:{isArray:!1,method:"post",url:t.baseUrl+"openchannel/accounts/:id/notify"},addApplications:{isArray:!1,method:"post",url:t.baseUrl+"openchannel/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:t.baseUrl+"openchannel/accounts/:id/applications"},getInteractions:{isArray:!1,method:"get",url:t.baseUrl+"openchannel/accounts/:id/interactions"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"openchannel/accounts/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"openchannel/accounts/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"openchannel/accounts/:id/users"},send:{isArray:!1,method:"post",url:t.baseUrl+"openchannel/accounts/:id/send"}}),t.openchannelApplication=e(t.baseUrl+"openchannel/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"openchannel/applications/describe"},clone:{method:"post",url:t.baseUrl+"openchannel/applications/:id/clone",params:{includeAll:"@includeAll"}}}),t.openchannelInteraction=e(t.baseUrl+"openchannel/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"openchannel/interactions/describe"},clone:{method:"post",url:t.baseUrl+"openchannel/interactions/:id/clone",params:{includeAll:"@includeAll"}},addMessage:{isArray:!1,method:"post",url:t.baseUrl+"openchannel/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:t.baseUrl+"openchannel/interactions/:id/messages"},addTags:{isArray:!1,method:"post",url:t.baseUrl+"openchannel/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:t.baseUrl+"openchannel/interactions/:id/tags"},download:{isArray:!1,method:"get",url:t.baseUrl+"openchannel/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}}}),t.openchannelMessage=e(t.baseUrl+"openchannel/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"openchannel/messages/describe"},clone:{method:"post",url:t.baseUrl+"openchannel/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:t.baseUrl+"openchannel/messages/:id/accept"},reject:{isArray:!1,method:"put",url:t.baseUrl+"openchannel/messages/:id/reject"}}),t.openchannelQueue=e(t.baseUrl+"openchannel/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"openchannel/queues/describe"},clone:{method:"post",url:t.baseUrl+"openchannel/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:t.baseUrl+"openchannel/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:t.baseUrl+"openchannel/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:t.baseUrl+"openchannel/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:t.baseUrl+"openchannel/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"openchannel/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"openchannel/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"openchannel/queues/:id/users"}}),t.chatWebsite=e(t.baseUrl+"chat/websites/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/websites/describe"},clone:{method:"post",url:t.baseUrl+"chat/websites/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:t.baseUrl+"chat/websites/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:t.baseUrl+"chat/websites/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:t.baseUrl+"chat/websites/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:t.baseUrl+"chat/websites/:id/canned_answers"},addLogo:{isArray:!1,method:"post",url:t.baseUrl+"chat/websites/:id/logo"},addAvatar:{isArray:!1,method:"post",url:t.baseUrl+"chat/websites/:id/avatar"},addCustomerAvatar:{isArray:!1,method:"post",url:t.baseUrl+"chat/websites/:id/customer_avatar"},addSystemAvatar:{isArray:!1,method:"post",url:t.baseUrl+"chat/websites/:id/system_avatar"},getLogo:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/logo"},getAvatar:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/avatar"},getCustomerAvatar:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/customer_avatar"},getSystemAvatar:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/system_avatar"},notify:{isArray:!1,method:"post",url:t.baseUrl+"chat/websites/:id/notify"},offline:{isArray:!1,method:"post",url:t.baseUrl+"chat/websites/:id/offline"},addInteraction:{isArray:!1,method:"post",url:t.baseUrl+"chat/websites/:id/interactions"},getInteractions:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/interactions"},getSnippet:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/snippet"},addApplications:{isArray:!1,method:"post",url:t.baseUrl+"chat/websites/:id/applications"},getApplications:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/applications"},addProactiveActions:{isArray:!1,method:"post",url:t.baseUrl+"chat/websites/:id/proactive_actions"},getProactiveActions:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/proactive_actions"},getFields:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/fields"},getOfflineMessages:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/offline_messages"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"chat/websites/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"chat/websites/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/users"}}),t.openchannelQueueReport=e(t.baseUrl+"openchannel/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"openchannel/reports/queue/describe"},clone:{method:"post",url:t.baseUrl+"openchannel/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),t.chatApplication=e(t.baseUrl+"chat/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/applications/describe"},clone:{method:"post",url:t.baseUrl+"chat/applications/:id/clone",params:{includeAll:"@includeAll"}}}),t.chatInteraction=e(t.baseUrl+"chat/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/interactions/describe"},clone:{method:"post",url:t.baseUrl+"chat/interactions/:id/clone",params:{includeAll:"@includeAll"}},customUpdate:{isArray:!1,method:"put",url:t.baseUrl+"chat/interactions/:id/custom_update"},abandon:{isArray:!1,method:"put",url:t.baseUrl+"chat/interactions/:id/abandon"},attachmentUpload:{isArray:!1,method:"post",url:t.baseUrl+"chat/interactions/:id/attachment_upload"},attachmentDownload:{isArray:!1,method:"get",url:t.baseUrl+"chat/interactions/:id/attachment_download"},close:{isArray:!1,method:"put",url:t.baseUrl+"chat/interactions/:id/close"},addMessage:{isArray:!1,method:"post",url:t.baseUrl+"chat/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:t.baseUrl+"chat/interactions/:id/messages"},getMyMessages:{isArray:!1,method:"get",url:t.baseUrl+"chat/interactions/:id/my_messages"},addTags:{isArray:!1,method:"post",url:t.baseUrl+"chat/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:t.baseUrl+"chat/interactions/:id/tags"},download:{isArray:!1,method:"get",url:t.baseUrl+"chat/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}}}),t.chatMessage=e(t.baseUrl+"chat/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/messages/describe"},clone:{method:"post",url:t.baseUrl+"chat/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:t.baseUrl+"chat/messages/:id/accept"},reject:{isArray:!1,method:"put",url:t.baseUrl+"chat/messages/:id/reject"}}),t.chatOfflineMessage=e(t.baseUrl+"chat/offline_messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/offline_messages/describe"},clone:{method:"post",url:t.baseUrl+"chat/offline_messages/:id/clone",params:{includeAll:"@includeAll"}}}),t.chatQueue=e(t.baseUrl+"chat/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/queues/describe"},clone:{method:"post",url:t.baseUrl+"chat/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:t.baseUrl+"chat/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:t.baseUrl+"chat/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:t.baseUrl+"chat/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:t.baseUrl+"chat/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"chat/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"chat/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"chat/queues/:id/users"}}),t.chatGroup=e(t.baseUrl+"chat/groups/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/groups/describe"},clone:{method:"post",url:t.baseUrl+"chat/groups/:id/clone",params:{includeAll:"@includeAll"}},getUnread:{isArray:!1,method:"get",url:t.baseUrl+"chat/groups/:id/unread"},addMembers:{isArray:!0,method:"post",url:t.baseUrl+"chat/groups/:id/members"},getMembers:{isArray:!1,method:"get",url:t.baseUrl+"chat/groups/:id/members"},removeMembers:{isArray:!1,method:"delete",url:t.baseUrl+"chat/groups/:id/members"},addMessage:{isArray:!1,method:"post",url:t.baseUrl+"chat/groups/:id/messages"},getMessages:{isArray:!1,method:"get",url:t.baseUrl+"chat/groups/:id/messages"}}),t.chatProactiveAction=e(t.baseUrl+"chat/proactive_actions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/proactive_actions/describe"},clone:{method:"post",url:t.baseUrl+"chat/proactive_actions/:id/clone",params:{includeAll:"@includeAll"}}}),t.cmCompany=e(t.baseUrl+"cm/companies/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"cm/companies/describe"},clone:{method:"post",url:t.baseUrl+"cm/companies/:id/clone",params:{includeAll:"@includeAll"}},addContacts:{isArray:!1,method:"post",url:t.baseUrl+"cm/companies/:id/contacts"},getContacts:{isArray:!1,method:"get",url:t.baseUrl+"cm/companies/:id/contacts"}}),t.cmContact=e(t.baseUrl+"cm/contacts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"cm/contacts/describe"},clone:{method:"post",url:t.baseUrl+"cm/contacts/:id/clone",params:{includeAll:"@includeAll"}},merge:{isArray:!1,method:"post",url:t.baseUrl+"cm/contacts/merge"},bulkCreate:{isArray:!1,method:"post",url:t.baseUrl+"cm/contacts/create_many"},getTags:{isArray:!1,method:"get",url:t.baseUrl+"cm/contacts/:id/tags"},setTags:{isArray:!0,method:"post",url:t.baseUrl+"cm/contacts/:id/tags"},getHoppers:{isArray:!1,method:"get",url:t.baseUrl+"cm/contacts/:id/hoppers"},getHopperHistories:{isArray:!1,method:"get",url:t.baseUrl+"cm/contacts/:id/hopper_histories"},getHopperFinals:{isArray:!1,method:"get",url:t.baseUrl+"cm/contacts/:id/hopper_finals"},getJscriptySessions:{isArray:!1,method:"get",url:t.baseUrl+"cm/contacts/:id/jscripty_sessions"},uploadCsv:{isArray:!1,method:"post",url:t.baseUrl+"cm/contacts/csv"},upload:{isArray:!1,method:"post",url:t.baseUrl+"cm/contacts/upload"},import:{isArray:!1,method:"post",url:t.baseUrl+"cm/contacts/upload/:id"}}),t.cmHopper=e(t.baseUrl+"cm/hopper/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"cm/hopper/describe"},clone:{method:"post",url:t.baseUrl+"cm/hopper/:id/clone",params:{includeAll:"@includeAll"}},getPreview:{isArray:!1,method:"post",url:t.baseUrl+"cm/hopper/preview"},getOpenContacts:{isArray:!1,method:"get",url:t.baseUrl+"cm/hopper/opencontacts"}}),t.cmHopperBlack=e(t.baseUrl+"cm/hopper_black/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"cm/hopper_black/describe"},clone:{method:"post",url:t.baseUrl+"cm/hopper_black/:id/clone",params:{includeAll:"@includeAll"}}}),t.cmHopperFinal=e(t.baseUrl+"cm/hopper_final/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"cm/hopper_final/describe"},clone:{method:"post",url:t.baseUrl+"cm/hopper_final/:id/clone",params:{includeAll:"@includeAll"}},countContactsQueueCampaignHopperFinal:{isArray:!0,method:"get",url:t.baseUrl+"cm/hopper_final/voice/queue/countAttributes/:id"},countContactsIvrCampaignHopperFinal:{isArray:!0,method:"get",url:t.baseUrl+"cm/hopper_final/campaign/countAttributes/:id"},moveContactsQueueCampaignHopperFinal:{isArray:!0,method:"post",url:t.baseUrl+"cm/hopper_final/voice/queue/moveContacts/:id"},moveContactsIvrCampaignHopperFinal:{isArray:!0,method:"post",url:t.baseUrl+"cm/hopper_final/voice/campaign/moveContacts/:id"},checkContactHopper:{isArray:!1,method:"post",url:t.baseUrl+"cm/hopper_final/checkContactHopper"}}),t.cmHopperHistory=e(t.baseUrl+"cm/hopper_history/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"cm/hopper_history/describe"},clone:{method:"post",url:t.baseUrl+"cm/hopper_history/:id/clone",params:{includeAll:"@includeAll"}}}),t.cmCustomField=e(t.baseUrl+"cm/custom_fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"cm/custom_fields/describe"},clone:{method:"post",url:t.baseUrl+"cm/custom_fields/:id/clone",params:{includeAll:"@includeAll"}}}),t.action=e(t.baseUrl+"actions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"actions/describe"},clone:{method:"post",url:t.baseUrl+"actions/:id/clone",params:{includeAll:"@includeAll"}}}),t.automation=e(t.baseUrl+"automations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"automations/describe"},clone:{method:"post",url:t.baseUrl+"automations/:id/clone",params:{includeAll:"@includeAll"}},addConditions:{isArray:!1,method:"post",url:t.baseUrl+"automations/:id/conditions"},getConditions:{isArray:!1,method:"get",url:t.baseUrl+"automations/:id/conditions"},addActions:{isArray:!1,method:"post",url:t.baseUrl+"automations/:id/actions"},getActions:{isArray:!1,method:"get",url:t.baseUrl+"automations/:id/actions"}}),t.cannedAnswer=e(t.baseUrl+"canned_answers/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"canned_answers/describe"},clone:{method:"post",url:t.baseUrl+"canned_answers/:id/clone",params:{includeAll:"@includeAll"}}}),t.disposition=e(t.baseUrl+"dispositions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"dispositions/describe"},clone:{method:"post",url:t.baseUrl+"dispositions/:id/clone",params:{includeAll:"@includeAll"}}}),t.condition=e(t.baseUrl+"conditions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"conditions/describe"},clone:{method:"post",url:t.baseUrl+"conditions/:id/clone",params:{includeAll:"@includeAll"}}}),t.interval=e(t.baseUrl+"intervals/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"intervals/describe"},clone:{method:"post",url:t.baseUrl+"intervals/:id/clone",params:{includeAll:"@includeAll"}},addInterval:{isArray:!1,method:"post",url:t.baseUrl+"intervals/:id/sub_intervals"},getIntervals:{isArray:!1,method:"get",url:t.baseUrl+"intervals/:id/sub_intervals"},addIntervals:{isArray:!0,method:"post",url:t.baseUrl+"intervals/:id/sub_intervals/create_many"}}),t.pause=e(t.baseUrl+"pauses/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"pauses/describe"},clone:{method:"post",url:t.baseUrl+"pauses/:id/clone",params:{includeAll:"@includeAll"}}}),t.cdr=e(t.baseUrl+"cdr/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"cdr/describe"},clone:{method:"post",url:t.baseUrl+"cdr/:id/clone",params:{includeAll:"@includeAll"}}}),t.voiceQueuesLog=e(t.baseUrl+"voiceQueuesLog/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voiceQueuesLog/describe"},clone:{method:"post",url:t.baseUrl+"voiceQueuesLog/:id/clone",params:{includeAll:"@includeAll"}}}),t.schedule=e(t.baseUrl+"schedules/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"schedules/describe"},clone:{method:"post",url:t.baseUrl+"schedules/:id/clone",params:{includeAll:"@includeAll"}},run:{isArray:!1,method:"get",url:t.baseUrl+"schedules/:id/run"}}),t.sound=e(t.baseUrl+"sounds/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"sounds/describe"},clone:{method:"post",url:t.baseUrl+"sounds/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:t.baseUrl+"sounds/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}},delete:{isArray:!1,method:"delete",url:t.baseUrl+"sounds/:id"}}),t.tag=e(t.baseUrl+"tags/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"tags/describe"},clone:{method:"post",url:t.baseUrl+"tags/:id/clone",params:{includeAll:"@includeAll"}}}),t.template=e(t.baseUrl+"templates/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"templates/describe"},clone:{method:"post",url:t.baseUrl+"templates/:id/clone",params:{includeAll:"@includeAll"}}}),t.trigger=e(t.baseUrl+"triggers/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"triggers/describe"},clone:{method:"post",url:t.baseUrl+"triggers/:id/clone",params:{includeAll:"@includeAll"}},addAllCondition:{isArray:!1,method:"post",url:t.baseUrl+"triggers/:id/all_conditions"},addAnyCondition:{isArray:!1,method:"post",url:t.baseUrl+"triggers/:id/any_conditions"},getAllConditions:{isArray:!1,method:"get",url:t.baseUrl+"triggers/:id/all_conditions"},getAnyConditions:{isArray:!1,method:"get",url:t.baseUrl+"triggers/:id/any_conditions"},addAction:{isArray:!1,method:"post",url:t.baseUrl+"triggers/:id/actions"},getActions:{isArray:!1,method:"get",url:t.baseUrl+"triggers/:id/actions"}}),t.variable=e(t.baseUrl+"variables/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"variables/describe"},clone:{method:"post",url:t.baseUrl+"variables/:id/clone",params:{includeAll:"@includeAll"}}}),t.integration=e(t.baseUrl+"integrations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/describe"},clone:{method:"post",url:t.baseUrl+"integrations/:id/clone",params:{includeAll:"@includeAll"}}}),t.integrationReport=e(t.baseUrl+"integrations/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/reports/describe"},clone:{method:"post",url:t.baseUrl+"integrations/reports/:id/clone",params:{includeAll:"@includeAll"}}}),t.analyticCustomReport=e(t.baseUrl+"analytics/custom_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"analytics/custom_reports/describe"},clone:{method:"post",url:t.baseUrl+"analytics/custom_reports/:id/clone",params:{includeAll:"@includeAll"}},preview:{isArray:!0,method:"get",url:t.baseUrl+"analytics/custom_reports/:id/preview"},run:{isArray:!1,method:"get",url:t.baseUrl+"analytics/custom_reports/:id/run"},query:{isArray:!1,method:"get",url:t.baseUrl+"analytics/custom_reports/:id/query"}}),t.analyticDefaultReport=e(t.baseUrl+"analytics/default_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"analytics/default_reports/describe"},clone:{method:"post",url:t.baseUrl+"analytics/default_reports/:id/clone",params:{includeAll:"@includeAll"}},preview:{isArray:!0,method:"get",url:t.baseUrl+"analytics/default_reports/:id/preview"},run:{isArray:!1,method:"get",url:t.baseUrl+"analytics/default_reports/:id/run"},query:{isArray:!1,method:"get",url:t.baseUrl+"analytics/default_reports/:id/query"}}),t.analyticExtractedReport=e(t.baseUrl+"analytics/extracted_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"analytics/extracted_reports/describe"},clone:{method:"post",url:t.baseUrl+"analytics/extracted_reports/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:t.baseUrl+"analytics/extracted_reports/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}}}),t.analyticMetric=e(t.baseUrl+"analytics/metrics/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"analytics/metrics/describe"},clone:{method:"post",url:t.baseUrl+"analytics/metrics/:id/clone",params:{includeAll:"@includeAll"}}}),t.analyticFieldReport=e(t.baseUrl+"analytics/field_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"analytics/field_reports/describe"},clone:{method:"post",url:t.baseUrl+"analytics/field_reports/:id/clone",params:{includeAll:"@includeAll"}},bulkCreate:{method:"post",url:t.baseUrl+"analytics/field_reports/create_many",isArray:!0},bulkDestroy:{method:"delete",url:t.baseUrl+"analytics/field_reports/destroy_many",isArray:!0},addFields:{isArray:!0,method:"post",url:t.baseUrl+"analytics/field_reports/:id/create_many"}}),t.analyticTreeReport=e(t.baseUrl+"analytics/tree_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"analytics/tree_reports/describe"},clone:{method:"post",url:t.baseUrl+"analytics/tree_reports/:id/clone",params:{includeAll:"@includeAll"}}}),t.intSalesforceAccount=e(t.baseUrl+"integrations/salesforce/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/salesforce/accounts/describe"},clone:{method:"post",url:t.baseUrl+"integrations/salesforce/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:t.baseUrl+"integrations/salesforce/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:t.baseUrl+"integrations/salesforce/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/salesforce/accounts/:id/fields"}}),t.intSalesforceConfiguration=e(t.baseUrl+"integrations/salesforce/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/salesforce/configurations/describe"},clone:{method:"post",url:t.baseUrl+"integrations/salesforce/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/salesforce/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:t.baseUrl+"integrations/salesforce/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:t.baseUrl+"integrations/salesforce/configurations/:id/descriptions"}}),t.intSalesforceField=e(t.baseUrl+"integrations/salesforce/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/salesforce/fields/describe"},clone:{method:"post",url:t.baseUrl+"integrations/salesforce/fields/:id/clone",params:{includeAll:"@includeAll"}}}),t.intSugarcrmAccount=e(t.baseUrl+"integrations/sugarcrm/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/sugarcrm/accounts/describe"},clone:{method:"post",url:t.baseUrl+"integrations/sugarcrm/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:t.baseUrl+"integrations/sugarcrm/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:t.baseUrl+"integrations/sugarcrm/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/sugarcrm/accounts/:id/fields"}}),t.intSugarcrmConfiguration=e(t.baseUrl+"integrations/sugarcrm/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/sugarcrm/configurations/describe"},clone:{method:"post",url:t.baseUrl+"integrations/sugarcrm/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/sugarcrm/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:t.baseUrl+"integrations/sugarcrm/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:t.baseUrl+"integrations/sugarcrm/configurations/:id/descriptions"}}),t.intSugarcrmField=e(t.baseUrl+"integrations/sugarcrm/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/sugarcrm/fields/describe"},clone:{method:"post",url:t.baseUrl+"integrations/sugarcrm/fields/:id/clone",params:{includeAll:"@includeAll"}}}),t.intDeskAccount=e(t.baseUrl+"integrations/desk/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/desk/accounts/describe"},clone:{method:"post",url:t.baseUrl+"integrations/desk/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:t.baseUrl+"integrations/desk/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:t.baseUrl+"integrations/desk/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/desk/accounts/:id/fields"}}),t.intDeskConfiguration=e(t.baseUrl+"integrations/desk/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/desk/configurations/describe"},clone:{method:"post",url:t.baseUrl+"integrations/desk/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/desk/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:t.baseUrl+"integrations/desk/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:t.baseUrl+"integrations/desk/configurations/:id/descriptions"},getTags:{isArray:!1,method:"get",url:t.baseUrl+"integrations/desk/configurations/:id/tags"},setTags:{isArray:!0,method:"post",url:t.baseUrl+"integrations/desk/configurations/:id/tags"}}),t.intDeskField=e(t.baseUrl+"integrations/desk/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/desk/fields/describe"},clone:{method:"post",url:t.baseUrl+"integrations/desk/fields/:id/clone",params:{includeAll:"@includeAll"}}}),t.intZohoAccount=e(t.baseUrl+"integrations/zoho/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/zoho/accounts/describe"},clone:{method:"post",url:t.baseUrl+"integrations/zoho/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:t.baseUrl+"integrations/zoho/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:t.baseUrl+"integrations/zoho/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/zoho/accounts/:id/fields"}}),t.intZohoConfiguration=e(t.baseUrl+"integrations/zoho/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/zoho/configurations/describe"},clone:{method:"post",url:t.baseUrl+"integrations/zoho/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/zoho/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:t.baseUrl+"integrations/zoho/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:t.baseUrl+"integrations/zoho/configurations/:id/descriptions"}}),t.intZohoField=e(t.baseUrl+"integrations/zoho/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/zoho/fields/describe"},clone:{method:"post",url:t.baseUrl+"integrations/zoho/fields/:id/clone",params:{includeAll:"@includeAll"}}}),t.intZendeskAccount=e(t.baseUrl+"integrations/zendesk/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/zendesk/accounts/describe"},clone:{method:"post",url:t.baseUrl+"integrations/zendesk/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:t.baseUrl+"integrations/zendesk/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:t.baseUrl+"integrations/zendesk/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/zendesk/accounts/:id/fields"}}),t.intZendeskConfiguration=e(t.baseUrl+"integrations/zendesk/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/zendesk/configurations/describe"},clone:{method:"post",url:t.baseUrl+"integrations/zendesk/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/zendesk/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:t.baseUrl+"integrations/zendesk/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:t.baseUrl+"integrations/zendesk/configurations/:id/descriptions"},getTags:{isArray:!1,method:"get",url:t.baseUrl+"integrations/zendesk/configurations/:id/tags"},setTags:{isArray:!0,method:"post",url:t.baseUrl+"integrations/zendesk/configurations/:id/tags"}}),t.intZendeskField=e(t.baseUrl+"integrations/zendesk/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/zendesk/fields/describe"},clone:{method:"post",url:t.baseUrl+"integrations/zendesk/fields/:id/clone",params:{includeAll:"@includeAll"}}}),t.intFreshdeskAccount=e(t.baseUrl+"integrations/freshdesk/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/freshdesk/accounts/describe"},clone:{method:"post",url:t.baseUrl+"integrations/freshdesk/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:t.baseUrl+"integrations/freshdesk/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:t.baseUrl+"integrations/freshdesk/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/freshdesk/accounts/:id/fields"}}),t.intFreshdeskConfiguration=e(t.baseUrl+"integrations/freshdesk/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/freshdesk/configurations/describe"},clone:{method:"post",url:t.baseUrl+"integrations/freshdesk/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/freshdesk/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:t.baseUrl+"integrations/freshdesk/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:t.baseUrl+"integrations/freshdesk/configurations/:id/descriptions"},getTags:{isArray:!1,method:"get",url:t.baseUrl+"integrations/freshdesk/configurations/:id/tags"},setTags:{isArray:!0,method:"post",url:t.baseUrl+"integrations/freshdesk/configurations/:id/tags"}}),t.intFreshdeskField=e(t.baseUrl+"integrations/freshdesk/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/freshdesk/fields/describe"},clone:{method:"post",url:t.baseUrl+"integrations/freshdesk/fields/:id/clone",params:{includeAll:"@includeAll"}}}),t.intVtigerAccount=e(t.baseUrl+"integrations/vtiger/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/vtiger/accounts/describe"},clone:{method:"post",url:t.baseUrl+"integrations/vtiger/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:t.baseUrl+"integrations/vtiger/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:t.baseUrl+"integrations/vtiger/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/vtiger/accounts/:id/fields"}}),t.intVtigerConfiguration=e(t.baseUrl+"integrations/vtiger/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/vtiger/configurations/describe"},clone:{method:"post",url:t.baseUrl+"integrations/vtiger/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/vtiger/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:t.baseUrl+"integrations/vtiger/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:t.baseUrl+"integrations/vtiger/configurations/:id/descriptions"}}),t.intVtigerField=e(t.baseUrl+"integrations/vtiger/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/vtiger/fields/describe"},clone:{method:"post",url:t.baseUrl+"integrations/vtiger/fields/:id/clone",params:{includeAll:"@includeAll"}}}),t.intServicenowAccount=e(t.baseUrl+"integrations/servicenow/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/servicenow/accounts/describe"},clone:{method:"post",url:t.baseUrl+"integrations/servicenow/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:t.baseUrl+"integrations/servicenow/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:t.baseUrl+"integrations/servicenow/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/servicenow/accounts/:id/fields"}}),t.intServicenowConfiguration=e(t.baseUrl+"integrations/servicenow/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/servicenow/configurations/describe"},clone:{method:"post",url:t.baseUrl+"integrations/servicenow/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/servicenow/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:t.baseUrl+"integrations/servicenow/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:t.baseUrl+"integrations/servicenow/configurations/:id/descriptions"}}),t.intServicenowField=e(t.baseUrl+"integrations/servicenow/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/servicenow/fields/describe"},clone:{method:"post",url:t.baseUrl+"integrations/servicenow/fields/:id/clone",params:{includeAll:"@includeAll"}}}),t.intDynamics365Account=e(t.baseUrl+"integrations/dynamics365/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/dynamics365/accounts/describe"},clone:{method:"post",url:t.baseUrl+"integrations/dynamics365/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:t.baseUrl+"integrations/dynamics365/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:t.baseUrl+"integrations/dynamics365/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/dynamics365/accounts/:id/fields"}}),t.intDynamics365Configuration=e(t.baseUrl+"integrations/dynamics365/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/dynamics365/configurations/describe"},clone:{method:"post",url:t.baseUrl+"integrations/dynamics365/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/dynamics365/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:t.baseUrl+"integrations/dynamics365/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:t.baseUrl+"integrations/dynamics365/configurations/:id/descriptions"}}),t.intDynamics365Field=e(t.baseUrl+"integrations/dynamics365/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/dynamics365/fields/describe"},clone:{method:"post",url:t.baseUrl+"integrations/dynamics365/fields/:id/clone",params:{includeAll:"@includeAll"}}}),t.network=e(t.baseUrl+"networks/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"networks/describe"},clone:{method:"post",url:t.baseUrl+"networks/:id/clone",params:{includeAll:"@includeAll"}}}),t.chatQueueReport=e(t.baseUrl+"chat/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/reports/queue/describe"},clone:{method:"post",url:t.baseUrl+"chat/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),t.chatInternalMessage=e(t.baseUrl+"chat/internal/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/internal/messages/describe"},clone:{method:"post",url:t.baseUrl+"chat/internal/messages/:id/clone",params:{includeAll:"@includeAll"}},getUsers:{isArray:!1,method:"get",url:t.baseUrl+"chat/internal/messages/users"}}),t.jscriptyAnswerReport=e(t.baseUrl+"jscripty/answers/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"jscripty/answers/reports/describe"},clone:{method:"post",url:t.baseUrl+"jscripty/answers/reports/:id/clone",params:{includeAll:"@includeAll"}}}),t.jscriptyQuestionReport=e(t.baseUrl+"jscripty/questions/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"jscripty/questions/reports/describe"},clone:{method:"post",url:t.baseUrl+"jscripty/questions/reports/:id/clone",params:{includeAll:"@includeAll"}}}),t.jscriptySessionReport=e(t.baseUrl+"jscripty/sessions/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"jscripty/sessions/reports/describe"},clone:{method:"post",url:t.baseUrl+"jscripty/sessions/reports/:id/clone",params:{includeAll:"@includeAll"}},getQuestions:{isArray:!1,method:"get",url:t.baseUrl+"jscripty/sessions/reports/:id/questions"}}),t.smsQueueReport=e(t.baseUrl+"sms/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"sms/reports/queue/describe"},clone:{method:"post",url:t.baseUrl+"sms/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),t.squareReport=e(t.baseUrl+"square/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"square/reports/describe"},clone:{method:"post",url:t.baseUrl+"square/reports/:id/clone",params:{includeAll:"@includeAll"}}}),t.squareReportDetail=e(t.baseUrl+"square/details/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"square/details/reports/describe"},clone:{method:"post",url:t.baseUrl+"square/details/reports/:id/clone",params:{includeAll:"@includeAll"}}}),t.jscriptyProject=e(t.baseUrl+"jscripty/projects/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"jscripty/projects/describe"},clone:{method:"post",url:t.baseUrl+"jscripty/projects/:id/clone",params:{includeAll:"@includeAll"}},getSessions:{isArray:!1,method:"get",url:t.baseUrl+"jscripty/projects/:id/sessions"},getAnswers:{isArray:!1,method:"get",url:t.baseUrl+"jscripty/projects/:id/answers"},getSummary:{isArray:!1,method:"get",url:t.baseUrl+"jscripty/projects/:id/summary",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}}}),t.setting=e(t.baseUrl+"settings/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"settings/describe"},clone:{method:"post",url:t.baseUrl+"settings/:id/clone",params:{includeAll:"@includeAll"}},addLogo:{isArray:!1,method:"post",url:t.baseUrl+"settings/:id/logo"},addLogoLogin:{isArray:!1,method:"post",url:t.baseUrl+"settings/:id/logo_login"},getLogo:{isArray:!1,method:"get",url:t.baseUrl+"settings/:id/logo"},getLogoLogin:{isArray:!1,method:"get",url:t.baseUrl+"settings/:id/logo_login"},gdpr:{isArray:!1,method:"get",url:t.baseUrl+"settings/:id/gdpr"},addPreferred:{isArray:!1,method:"post",url:t.baseUrl+"settings/:id/preferred"},getPreferred:{isArray:!1,method:"get",url:t.baseUrl+"settings/:id/preferred"}}),t.squareOdbc=e(t.baseUrl+"square/odbc/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"square/odbc/describe"},clone:{method:"post",url:t.baseUrl+"square/odbc/:id/clone",params:{includeAll:"@includeAll"}},test:{isArray:!1,method:"get",url:t.baseUrl+"square/odbc/:id/test"}}),t.squareProject=e(t.baseUrl+"square/projects/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"square/projects/describe"},clone:{method:"post",url:t.baseUrl+"square/projects/:id/clone",params:{includeAll:"@includeAll"}},addUsers:{isArray:!0,method:"post",url:t.baseUrl+"square/projects/:id/users"},removeUsers:{isArray:!1,method:"delete",url:t.baseUrl+"square/projects/:id/users"},getUsers:{isArray:!1,method:"get",url:t.baseUrl+"square/projects/:id/users"}}),t.squareRecording=e(t.baseUrl+"square/recordings/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"square/recordings/describe"},clone:{method:"post",url:t.baseUrl+"square/recordings/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:t.baseUrl+"square/recordings/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}}}),t.squareMessage=e(t.baseUrl+"square/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"square/messages/describe"},clone:{method:"post",url:t.baseUrl+"square/messages/:id/clone",params:{includeAll:"@includeAll"}}}),t.team=e(t.baseUrl+"teams/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"teams/describe"},clone:{method:"post",url:t.baseUrl+"teams/:id/clone",params:{includeAll:"@includeAll"}},getQueues:{isArray:!0,method:"get",url:t.baseUrl+"teams/:id/queues"},addQueues:{isArray:!0,method:"post",url:t.baseUrl+"teams/:id/queues"},removeQueues:{isArray:!1,method:"delete",url:t.baseUrl+"teams/:id/queues"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"teams/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"teams/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"teams/:id/users"}}),t.license=e(t.baseUrl+"license/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"license/describe"},clone:{method:"post",url:t.baseUrl+"license/:id/clone",params:{includeAll:"@includeAll"}}}),t.campaign=e(t.baseUrl+"campaigns/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"campaigns/describe"},clone:{method:"post",url:t.baseUrl+"campaigns/:id/clone",params:{includeAll:"@includeAll"}},getHoppers:{isArray:!1,method:"get",url:t.baseUrl+"campaigns/:id/hoppers"},getHopperHistories:{isArray:!1,method:"get",url:t.baseUrl+"campaigns/:id/hopper_histories"},getHopperFinals:{isArray:!1,method:"get",url:t.baseUrl+"campaigns/:id/hopper_finals"},getHopperBlacks:{isArray:!1,method:"get",url:t.baseUrl+"campaigns/:id/hopper_black"},getLists:{isArray:!1,method:"get",url:t.baseUrl+"campaigns/:id/lists"},addLists:{isArray:!0,method:"post",url:t.baseUrl+"campaigns/:id/lists"},removeLists:{isArray:!0,method:"delete",url:t.baseUrl+"campaigns/:id/lists"},getBlackLists:{isArray:!1,method:"get",url:t.baseUrl+"campaigns/:id/blacklists"},addBlackLists:{isArray:!0,method:"post",url:t.baseUrl+"campaigns/:id/blacklists"},removeBlackLists:{isArray:!0,method:"delete",url:t.baseUrl+"campaigns/:id/blacklists"}}),t.migration=e(t.baseUrl+"migrations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"migrations/describe"},clone:{method:"post",url:t.baseUrl+"migrations/:id/clone",params:{includeAll:"@includeAll"}}}),t.attachment=e(t.baseUrl+"attachments/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"attachments/describe"},clone:{method:"post",url:t.baseUrl+"attachments/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:t.baseUrl+"attachments/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}}}),t.plugin=e(t.baseUrl+"plugins/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"plugins/describe"},clone:{method:"post",url:t.baseUrl+"plugins/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:t.baseUrl+"plugins/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}},upload:{isArray:!1,method:"post",url:t.baseUrl+"plugins/"},delete:{isArray:!1,method:"delete",url:t.baseUrl+"plugins/:id"},webhookGet:{isArray:!1,method:"get",url:t.baseUrl+"plugins/webhook"},webhookPost:{isArray:!1,method:"post",url:t.baseUrl+"plugins/webhook"}}),t.mailTransferReport=e(t.baseUrl+"mail/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"mail/reports/transfer/describe"},clone:{method:"post",url:t.baseUrl+"mail/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),t.chatTransferReport=e(t.baseUrl+"chat/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/reports/transfer/describe"},clone:{method:"post",url:t.baseUrl+"chat/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),t.faxTransferReport=e(t.baseUrl+"fax/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"fax/reports/transfer/describe"},clone:{method:"post",url:t.baseUrl+"fax/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),t.openchannelTransferReport=e(t.baseUrl+"openchannel/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"openchannel/reports/transfer/describe"},clone:{method:"post",url:t.baseUrl+"openchannel/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),t.smsTransferReport=e(t.baseUrl+"sms/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"sms/reports/transfer/describe"},clone:{method:"post",url:t.baseUrl+"sms/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),t.cmList=e(t.baseUrl+"cm/lists/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"cm/lists/describe"},clone:{method:"post",url:t.baseUrl+"cm/lists/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:t.baseUrl+"cm/lists/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:t.baseUrl+"cm/lists/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:t.baseUrl+"cm/lists/:id/dispositions"},addContacts:{isArray:!1,method:"post",url:t.baseUrl+"cm/lists/:id/contacts"},getContacts:{isArray:!0,method:"get",url:t.baseUrl+"cm/lists/:id/contacts"},getContactsCsv:{isArray:!1,method:"get",url:t.baseUrl+"cm/lists/:id/contacts/csv",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}},addCustomField:{isArray:!1,method:"post",url:t.baseUrl+"cm/lists/:id/fields"},getCustomFields:{isArray:!1,method:"get",url:t.baseUrl+"cm/lists/:id/fields"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"cm/lists/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"cm/lists/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"cm/lists/:id/users"}}),t.voicePrefix=e(t.baseUrl+"voice/prefixes/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/prefixes/describe"},clone:{method:"post",url:t.baseUrl+"voice/prefixes/:id/clone",params:{includeAll:"@includeAll"}},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"voice/prefixes/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"voice/prefixes/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"voice/prefixes/:id/users"}}),t.userProfile=e(t.baseUrl+"userProfiles/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"userProfiles/describe"},clone:{method:"post",url:t.baseUrl+"userProfiles/:id/clone",params:{includeAll:"@includeAll"}},addSections:{isArray:!0,method:"post",url:t.baseUrl+"userProfiles/:id/sections"},removeSections:{isArray:!1,method:"delete",url:t.baseUrl+"userProfiles/:id/sections"},addResources:{isArray:!0,method:"post",url:t.baseUrl+"userProfiles/:id/resources"},removeResources:{isArray:!1,method:"delete",url:t.baseUrl+"userProfiles/:id/resources"},getResources:{isArray:!1,method:"get",url:t.baseUrl+"userProfiles/:id/resources"}}),t.userProfileSection=e(t.baseUrl+"userProfile/sections/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"userProfile/sections/describe"},clone:{method:"post",url:t.baseUrl+"userProfile/sections/:id/clone",params:{includeAll:"@includeAll"}}}),t.userProfileResource=e(t.baseUrl+"userProfile/resources/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"userProfile/resources/describe"},clone:{method:"post",url:t.baseUrl+"userProfile/resources/:id/clone",params:{includeAll:"@includeAll"}}}),t}e.$inject=["$resource"],angular.module("motion").factory("api",e)}(),function(){"use strict";function e(e,t){t.setConfig({position:"top-right",sound:!1,html:!0,theme:"material"}),e.useLoader("$translatePartialLoader",{urlTemplate:"{part}/i18n/{lang}.json"}),e.preferredLanguage("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,t,n){this.themes=e.themes;var a=n.get("motion.language");a&&t.use(a)}e.$inject=["motionTheming","$translate","$cookies"],angular.module("motion").controller("IndexController",e)}(),function(){"use strict";function e(a,i){return function(e){var t=new Date,n=new Date(e);return n.getDate()===t.getDate()&&n.getMonth()===t.getMonth()&&n.getFullYear()===t.getFullYear()?a("date")(n.getTime(),"shortTime"):n.getDate()===t.getDate()-1&&n.getMonth()===t.getMonth()&&n.getFullYear()===t.getFullYear()?i.instant("DASHBOARDS.YESTERDAY")+" "+a("date")(n.getTime(),"shortTime"):a("date")(n.getTime(),"MMM d, y h:mm a")}}function t(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"],t.$inject=["$translate"],angular.module("motion").filter("limitObjectFromTo",function(){return function(e,t,n){var a,i={},s=0;for(a in e)if(n<=s&&(i[a]=e[a]),++s===n+t)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"}],t=[{value:"1"},{value:"2"},{value:"3"},{value:"4"},{value:"5"},{value:"6"},{value:"7"},{value:"8"},{value:"9"},{value:"10"},{value:"11"},{value:"12"}],n=[{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 t},getDaysOfWeek:function(){return n},getDaysOfMonth:function(){return a}}}).factory("dateFilterLocalizationFactory",t).factory("Sequence",function(){return{enqueue:function(e){this.tail=this.tail?this.tail.finally(e):e()}}})}(),function(){"use strict";function e(e,t,n){var a;n.html5Mode(!0),t.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",function(e){return e.resolve("setting@get",{id:1})}]}})}e.$inject=["$stateProvider","$urlRouterProvider","$locationProvider"],angular.module("motion").config(e)}(),function(){"use strict";function e(e,t,n){var a=e.$on("$stateChangeStart",function(){e.loadingProgress=!0}),i=e.$on("$stateChangeSuccess",function(){t(function(){e.loadingProgress=!1})});e.state=n,e.$on("$destroy",function(){a(),i()})}e.$inject=["$rootScope","$timeout","$state"],angular.module("motion").run(e)}(),function(){"use strict";function e(a,e){var i;function s(){i=io({query:"id="+e.getCurrentUser().id,transports:["websocket","polling"]})}return{connect:s,on:function(e,t){t=t||angular.noop,i||s(),i.on(e,function(){var e=arguments;a.$apply(function(){t.apply(i,e)})})},onWithoutApply:function(e,t){t=t||angular.noop,i||s(),i.on(e,function(){t.apply(i,arguments)})},emit:function(e,t,n){n=n||angular.noop,i||s(),i.emit(e,t,function(){var e=arguments;a.$apply(function(){n.apply(i,e)})})},removeAllListeners:function(e){i||s(),i.removeAllListeners(e)},removeListener:function(e,t){i||s(),i.removeListener(e,t)},disconnect:function(){i||s(),i.disconnect()}}}e.$inject=["$rootScope","Auth"],angular.module("motion").factory("socket",e)}(),function(){"use strict";function e(t,n,e,a,i,s){var o=this;o.progresslogin=!1,o.login=function(){return o.progresslogin=!0,o.message="",s.login(o.form).then(function(){return t.go("app.dashboards.general")}).catch(function(e){o.message=e.message}).finally(function(){o.progresslogin=!1})},o.loginOauth=function(e){o.message="",n.location.href="/api/auth/"+e},o.onInit=function(){{if(t.params.token&&t.params.userId)return s.removeCookies(),o.progresslogin=!0,e.put("motion.token",t.params.token),i.user.get({id:t.params.userId}).$promise.then(function(e){e&&(s.updateCurrentUser(e),t.go("app.dashboards.general"))}).finally(function(){o.progresslogin=!1});s.isLoggedIn()&&t.go("app.dashboards.general")}},o.onInit()}e.$inject=["$state","$window","$cookies","$timeout","api","Auth"],angular.module("app.login").controller("LoginController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.extractedReports,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The extractedReport will be deleted.").ariaLabel("Delete ExtractedReport").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.extractedReports=l||{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="extractedReports",b.listOrder="",b.listOrderAsc=null,b.selectedExtractedReports=[],b.query={fields:"createdAt,updatedAt,id,name,basename,savename,type,startDate,endDate,status,output,reportId,reportType",sort:"-updatedAt",limit:10,page:1},b.editdialog=function(e,t){i.show({controller:"CreateOrEditExtractedReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/extractedReports/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{extractedReport:e,extractedReports:b.extractedReports.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.downloadfile2=function(s,e){return m.analyticExtractedReport.download({id:s.id}).$promise.then(function(e){var t=[e.buffer],n="download",a=new Blob(t,{type:e.type});n=s.savename;var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getExtractedReports=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.analyticExtractedReport.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="ExtractedReports",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditExtractedReport=function(e,t){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:t,extractedReports:b.extractedReports.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteExtractedReport=S,b.exportSelectedExtractedReports=function(){var e=angular.copy(b.selectedExtractedReports);return b.selectedExtractedReports=[],e},b.deleteSelectedExtractedReports=function(e){var t=i.confirm().title("Are you sure want to delete the selected extractedReports?").htmlContent("<b>"+b.selectedExtractedReports.length+" selected</b> will be deleted.").ariaLabel("delete ExtractedReports").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedExtractedReports.forEach(function(e){S(e)}),b.selectedExtractedReports=[]})},b.deselectExtractedReports=function(){b.selectedExtractedReports=[]},b.selectAllExtractedReports=function(){b.selectedExtractedReports=b.extractedReports.rows};var E=!0,A=1;function y(e){b.extractedReports=e||{count:0,rows:[]}}function S(e){m.analyticExtractedReport.delete({id:e.id}).$promise.then(function(){_.remove(b.extractedReports.rows,{id:e.id}),b.extractedReports.count-=1,b.extractedReports.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEanalyticExtractedReport"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getExtractedReports())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","extractedReports","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.analytics").controller("ExtractedReportsController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.metrics,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The metric will be deleted.").ariaLabel("Delete Metric").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.metrics=l||{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="metrics",b.listOrder="",b.listOrderAsc=null,b.selectedMetrics=[],b.query={fields:"createdAt,updatedAt,id,name,table,metric,description",sort:"-updatedAt",limit:10,page:1},b.arraytable=_.keyBy([{option:"Agent Report",value:"'report_agent'"},{option:"Call Report",value:"'report_call'"},{option:"Contacts",value:"'cm_contacts'"},{option:"CSquare Report",value:"'report_square'"},{option:"CSquare Details Report",value:"'report_square_details'"},{option:"Dialer Hopper Processing",value:"'cm_hopper'"},{option:"Dialer Hopper Logs",value:"'cm_hopper_history'"},{option:"Dialer Hopper Final",value:"'cm_hopper_final'"},{option:"Integration Report",value:"'report_integration'"},{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:"Queue Report",value:"'report_queue'"},{option:"Users",value:"'users'"},{option:"Voice Recordings",value:"'voice_recordings'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editdialog=function(e,t){i.show({controller:"CreateOrEditMetricDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/metrics/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{metric:e,metrics:b.metrics.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getMetrics=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.analyticMetric.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Metrics",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditMetric=function(e,t){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:t,metrics:b.metrics.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteMetric=S,b.exportSelectedMetrics=function(){var e=angular.copy(b.selectedMetrics);return b.selectedMetrics=[],e},b.deleteSelectedMetrics=function(e){var t=i.confirm().title("Are you sure want to delete the selected metrics?").htmlContent("<b>"+b.selectedMetrics.length+" selected</b> will be deleted.").ariaLabel("delete Metrics").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedMetrics.forEach(function(e){S(e)}),b.selectedMetrics=[]})},b.deselectMetrics=function(){b.selectedMetrics=[]},b.selectAllMetrics=function(){b.selectedMetrics=b.metrics.rows};var E=!0,A=1;function y(e){b.metrics=e||{count:0,rows:[]}}function S(e){m.analyticMetric.delete({id:e.id}).$promise.then(function(){_.remove(b.metrics.rows,{id:e.id}),b.metrics.count-=1,b.metrics.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEanalyticMetric"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getMetrics())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","metrics","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.analytics").controller("MetricsController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o){var r=this;function l(){t.hide()}r.errors=[],r.report=angular.copy(n),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,t){r.currentNode=t.node}},r.copyReport=function(){var n;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){n=e,a.success({title:"Report properly copied!",msg:r.report.name?r.report.name+" has been copied!":""});var t={fields:"field,alias,function,format,groupBy,orderBy,custom,MetricId",nolimit:!0};return t["analyticCustomReport"===s?"CustomReportId":"DefaultReportId"]=r.report.id,i.analyticFieldReport.get(t).$promise}).then(function(e){var e=_.map(e.rows,function(e){return _.extend({},e,{CustomReportId:n.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,t,n,a,i,s,o,r,l,d){var c=this;function m(){t.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),n.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 t=0;t<e.data.errors.length;t++)n.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else n.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 t=_.find(c.reports,{id:e.id});t&&_.merge(t,e),n.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 t=0;t<e.data.errors.length;t++)n.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else n.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=t.confirm().title("Are you sure?").content("The report will be deleted.").ariaLabel("Delete Report").ok("Delete").cancel("Cancel").targetEvent(event);t.show(e).then(function(){s[o].delete({id:c.report.id}).$promise.then(function(){_.remove(c.reports,{id:c.report.id}),n.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(t,n,e){var a=_.find(c.tables,{name:e});a&&a.api&&s[a.api].describe().$promise.then(function(e){t[n]=_.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,t){r.report=e,r.report.condition=angular.fromJson(e.conditions)||{group:{operator:"AND",rules:[]}},r.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1};for(var n=0;n<r.report.condition.group.rules.length;n++)if(r.report.condition.group.rules[n].field){var a=r.report.condition.group.rules[n].field.split(".");1===a.length&&(r.report.condition.group.rules[n].field=r.report.table+"."+r.report.condition.group.rules[n].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,t,n){var a=i.confirm().title("Are you sure want to delete the item?").htmlContent("The item will be deleted.").ariaLabel("delete item").targetEvent(n).ok("OK").cancel("CANCEL");i.show(a).then(function(){e.splice(t,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(t){var a={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"};return{getMap:function(){var n=[];return _.forIn(a,function(e,t){n.push({name:t,api:e})}),n},getColumns:function(e){return t[a[e]].describe().$promise}}}e.$inject=["api"],angular.module("app.analytics").factory("describeTable",e)}(),function(){"use strict";function e(e,t,n,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(){n.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 t=_.find(u.reportFields,{id:e.id});t&&_.merge(t,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 t=n.confirm().title("Are you sure?").content("The field will be deleted.").ariaLabel("Delete Report").ok("Delete").cancel("Cancel").targetEvent(e);n.show(t).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,t,n,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,t){c.report=e,c.query.CustomReportId=c.report.id,c.crudPermissions=void 0!==t?t:{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,t){var n=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>"+e.field+"</b> will be deleted.").ariaLabel("delete field").targetEvent(t).ok("OK").cancel("CANCEL");a.show(n).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,t){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:t,reportFields:c.reportFields.rows,metrics:c.metrics,columns:c.columns,setting:null,crudPermissions:c.crudPermissions}})},c.deleteReportField=p,c.deleteSelectedReportFields=function(e){var t=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(t).then(function(){c.selectedReportFields.forEach(function(e){p(e)}),c.selectedReportFields=[]})},c.getMetricName=function(e){var t=_.find(c.metrics,{id:e});return t?t.name:d.instant("ANALYTICS.NO_METRIC_FOUND")},c.getMetricValue=function(e){var t=_.find(c.metrics,{id:e});return t?t.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()})})}t.$watch("vm_rf.query.filter",function(e,t){m?n(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,t,n,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")},o.saveReport=function(){o.report.conditions=angular.toJson(o.report.condition),n.analyticCustomReport.update({id:o.report.id},_.omit(o.report,"joins")).$promise.then(function(){t.success({title:"Report updated!",msg:o.report.name?o.report.name+" has been updated!":""})}).catch(function(e){t.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,n.analyticFieldReport.get({fields:"field,alias",nolimit:!0,CustomReportId:o.report.id}).$promise.then(function(e){return o.columns=e?e.rows:[],n.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"},t.error(o.error)})},o.queryReport=function(){return o.queryResult="Loading...",n.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"},t.error(o.error)})},o.mapArray=function(e,t){if(r(e))return _.map(e,t).join(",");return""},o.isArray=r,o.valueReplacer=function(e,t){moment(t,"YYYY-MM-DDTHH:mm:ssZ",!0).isValid()&&(t=moment(t,"").format("YYYY-MM-DD HH:mm:ss"));return t}}e.$inject=["$state","toasty","api","report","Auth","userProfileSection"],angular.module("app.analytics").controller("ReportController",e)}(),function(){"use strict";function e(e,t,n,a,i,s){var o=this;o.errors=[],o.report=angular.copy(a),o.valueReplacer=function(e,t){moment(t,"YYYY-MM-DDTHH:mm:ssZ",!0).isValid()&&(t=moment(t,"").format("YYYY-MM-DD HH:mm:ss"));return t},o.closeDialog=function(){t.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"},n.error(o.error)})}()}e.$inject=["$location","$mdDialog","toasty","report","api","apiName"],angular.module("app.analytics").controller("PreviewReportDialogController",e)}(),function(){"use strict";function e(e,n,a,i,s,o,t,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,t){s.go("app.analytics.reports.edit",{id:e.id,crudPermissions:p.crudPermissions})},p.copydialog=function(e,t){i.show({controller:"CopyReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/copy/dialog.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{report:e,apiName:p.apiName,treeCustomData:p.treeCustomInstance.jstree(!0).get_json("#")}}).finally(function(){})},p.previewdialog=function(e,t){i.show({controller:"PreviewReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/preview/dialog.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{report:e,apiName:p.apiName}})},p.rundialog=function(e,t){i.show({controller:"RunReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/run/dialog.html",parent:angular.element(a.body),targetEvent:t,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 t={fields:"field,alias,function,format,groupBy,orderBy,custom,MetricId",nolimit:!0};return t["analyticCustomReport"===p.apiName?"CustomReportId":"DefaultReportId"]=a.id,d.analyticFieldReport.get(t).$promise}).then(function(e){for(var t=0;t<e.rows.length;t+=1)e.rows[t].MetricId&&(e.rows[t].field=i[e.rows[t].MetricId].metric,e.rows[t].custom=!0),delete e.rows[t].MetricId;var n=o.document.createElement("a");n.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})),n.download=a.name+".json",n.target="_self",n.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,t){var n=i.confirm().title("Are you sure want to delete the report?").htmlContent("<b>"+e.name+"</b> will be deleted.").ariaLabel("delete report").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){b(e)},function(){console.log("CANCEL")})},p.success=h,p.getReports=f,p.createOrEditReport=function(e,t){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:t,reports:p.reports.rows,apiName:p.apiName,currentNode:p.currentNode,setting:null,crudPermissions:p.crudPermissions}})},p.importReport=function(e,t,n){if("application/json"===e.file.type){var a=new FileReader;a.onload=function(e){console.log(e.target.result);try{var n=atob(e.target.result.split(",")[1]);n=angular.fromJson(n),d.analyticCustomReport.save({name:n.name,description:n.description,table:n.table,conditions:n.conditions,joins:n.joins,parent:p.currentNode.id}).$promise.then(function(t){p.reports.rows.unshift(t),m.success({title:"Report saved!",msg:t.name?t.name+" has been saved!":""});var e=_.map(n.fields,function(e){return _.extend({},e,{CustomReportId:t.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 t=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(t).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 t=e&&e.rows?e.rows:[];if(0<t.length){var n=[];return a.forEach(function(e){_.find(t,["resourceId",e.id])&&n.push(e)}),h({count:n.length,rows:n})}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 t=0;t<e.data.errors.length;t++)m.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 E(e,t){p.treeDefaultInstance.jstree(!0).deselect_all(),p.treeDefaultInstance.jstree(!0).close_all(),p.currentNode=t.node,p.currentNode.custom=!0,p.currentPath=p.treeCustomInstance.jstree(!0).get_path(p.currentNode).join("/ "),p.apiName="analyticCustomReport",p.query.parent=t.node.id,f()}function A(e,t){p.treeCustomInstance.jstree(!0).deselect_all(),p.treeCustomInstance.jstree(!0).close_all(),p.currentNode=t.node,p.currentNode.custom=!1,p.currentPath=p.treeDefaultInstance.jstree(!0).get_path(p.currentNode).join("/ "),p.apiName="analyticDefaultReport",p.query.parent=t.node.id,f()}function y(e,t){var n=angular.toJson(p.treeCustomInstance.jstree(!0).get_json("#"));d.analyticTreeReport.update({id:2,tree:n}).$promise.then(function(){c.rows[1]&&(c.rows[1].tree=n),m.success({title:"Node Updated",msg:t.node.text?t.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(n){var e={};return p.crudPermissions.canEdit&&_.assign(e,{create:{label:t.instant("ANALYTICS.CREATE"),action:function(){n=p.treeCustomInstance.jstree(!0).create_node(n),p.treeCustomInstance.jstree(!0).edit(n)}},rename:{_disabled:"#"===n.parent,label:t.instant("ANALYTICS.RENAME"),action:function(){p.treeCustomInstance.jstree(!0).edit(n)}}}),p.crudPermissions.canDelete&&_.assign(e,{remove:{_disabled:"#"===n.parent,label:t.instant("ANALYTICS.REMOVE"),action:function(){var e=i.confirm().title("Are you sure want to delete the node?").htmlContent("<b>"+(n.text?n.text:"Node")+"</b> and its subnode will be deleted.").ariaLabel("delete node").ok("OK").cancel("CANCEL");i.show(e).then(function(){var e,t=p.treeCustomInstance.jstree(!0).get_parent(n);t=p.treeCustomInstance.jstree(!0).get_node(t),p.treeCustomInstance.jstree(!0).delete_node(n),e=[n.id].concat(n.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(t)})}}}),e}}}}function T(e){return e?{create_node:y,rename_node:y,move_node:y,delete_node:y,select_node:E}:{select_node:A}}e.$watch("vm.query.filter",function(e,t){g?n(function(){g=!1}):(t||(v=p.query.page),e!==t&&(p.query.page=1),e||(p.query.page=v),p.getReports())}),e.$watch("vm.search",function(e,t){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,n,a,t,i,s,o,r){var l=this;function d(){l.export={id:l.report.id,name:l.report.name,startDate:new Date(moment().startOf("day")),endDate:new Date(moment().endOf("day")),output:"xlsx",fullPath:r?r+"/"+l.report.name:l.report.name}}function c(){n.hide()}l.errors=[],l.report=angular.copy(t),l.export={},l.runReport=function(t){l.errors=[],l.exportDate=_.assign({},l.export,{startDate:moment(l.export.startDate).format("YYYY-MM-DD HH:mm:ss"),endDate:moment(l.export.endDate).format("YYYY-MM-DD HH:mm:ss")}),i[s].run(l.exportDate).$promise.then(function(e){"web"===l.export.output?n.show({controller:"WebReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/run/web/dialog.html",parent:angular.element(o.body),targetEvent:t,skipHide:!0,locals:{apiName:s,exportDate:l.exportDate,results:e},resolve:{columns:["apiResolver",function(e){var t={fields:"field,alias",nolimit:!0};return t["analyticCustomReport"===s?"CustomReportId":"DefaultReportId"]=l.report.id,e.resolve("analyticFieldReport@get",t)}]}}):(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,t,n,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=n[s].run(o,l).$promise},r.valueReplacer=function(e,t){moment(t,"YYYY-MM-DDTHH:mm:ssZ",!0).isValid()&&(t=moment(t,"").format("YYYY-MM-DD HH:mm:ss"));return t}}e.$inject=["$mdDialog","toasty","api","columns","results","apiName","exportDate"],angular.module("app.analytics").controller("WebReportDialogController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.odbcs,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The odbc will be deleted.").ariaLabel("Delete Odbc").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.odbcs=l||{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="odbcs",b.listOrder="",b.listOrderAsc=null,b.selectedODBC=[],b.query={fields:"createdAt,updatedAt,id,name,dsn,description",sort:"-updatedAt",limit:10,page:1},b.editdialog=function(e,t){i.show({controller:"CreateOrEditOdbcDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/odbcs/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{odbc:e,odbcs:b.odbcs.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.testtestOdbc=function(e,t){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()})})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getODBC=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.squareOdbc.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="ODBC",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditOdbc=function(e,t){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:t,odbcs:b.odbcs.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteOdbc=S,b.exportSelectedODBC=function(){var e=angular.copy(b.selectedODBC);return b.selectedODBC=[],e},b.deleteSelectedODBC=function(e){var t=i.confirm().title("Are you sure want to delete the selected odbcs?").htmlContent("<b>"+b.selectedODBC.length+" selected</b> will be deleted.").ariaLabel("delete Odbcs").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedODBC.forEach(function(e){S(e)}),b.selectedODBC=[]})},b.deselectODBC=function(){b.selectedODBC=[]},b.selectAllODBC=function(){b.selectedODBC=b.odbcs.rows};var E=!0,A=1;function y(e){b.odbcs=e||{count:0,rows:[]}}function S(e){m.squareOdbc.delete({id:e.id}).$promise.then(function(){_.remove(b.odbcs.rows,{id:e.id}),b.odbcs.count-=1,b.odbcs.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEsquareOdbc"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getODBC())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","odbcs","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.callysquare").controller("OdbcsController",e)}(),function(){"use strict";function e(t,n,a,i,s,e,o,r,l,d){var c=this;function m(e){t.hide(e)}c.errors=[],c.title="CALLYSQUARE.EDIT_PROJECT",c.crudPermissions=d,c.project=angular.copy(o),c.newWindow=!0,c.projects=e,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){return r.user.addSquareProjects({id:i.getCurrentUser().id,ids:[e.id]}).$promise,e}).then(function(e){c.projects.unshift(e),s.success({title:"Project properly created",msg:c.project.name?c.project.name+" has been created!":""}),m(e),c.openFromEditor&&(c.newWindow?n.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 t=0;t<e.data.errors.length;t++)s.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else s.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 t=_.find(c.projects,{id:e.id});t&&_.merge(t,e),s.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 t=0;t<e.data.errors.length;t++)s.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else s.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=t.confirm().title("Are you sure?").content("The project will be deleted.").ariaLabel("Delete Project").ok("Delete").cancel("Cancel").targetEvent(event);t.show(e).then(function(){r.squareProject.delete({id:c.project.id}).$promise.then(function(){return r.squareProject.getUsers({id:c.project.id}).$promise}).then(function(e){for(var t=[],n=e.rows,a=0;a<n.length;a++)t.push(r.user.removeSquareProjects({id:i.getCurrentUser().id,ids:[c.project.id]}).$promise);return $q.all(t)}).then(function(){_.remove(c.projects,{id:c.project.id}),s.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(t,a,i,e,n,s,o,r,l,d,c,m,u,p,g,v,h,f,b,E,A,y,S,T,I,C,w,O,x,R){var N=this,D={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"],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"]},P={queue:["file_id"],database:["variable_id"],pause:["pause_id"]},L={sendMail:["to","cc","bcc"],voicemail:["mailbox"]};function k(e,t,n,a){return _.map(e,function(e){return{value:e[t],option:e[n],group:a?e[a]:void 0,canSelect:void 0===e.canSelect||e.canSelect}})}function M(){var e=_.find(N.attributes,{name:"sip_id"});if(!_.some(N.attributes,{id:e.value})){if(!_.some(l,{id:Number(e.value)}))return a.user.get({id:_.find(N.attributes,{name:"sip_id"}).value,fields:"id,fullname,role"}).$promise.then(function(e){var t=e.toJSON();t.canSelect=!1,l.push(t),N.values.sip_id=k(l,"id","fullname","role")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_USER",msg:e.data?JSON.stringify(e.data.message):e.toString()})});N.values.sip_id=k(l,"id","fullname","role")}}function U(){var e=_.find(N.attributes,{name:"list_id"});if(!_.some(N.attributes,{id:e.value})){if(!_.some(E,{id:Number(e.value)}))return a.cmList.get({id:_.find(N.attributes,{name:"list_id"}).value,fields:"id,name"}).$promise.then(function(e){var t=e.toJSON();t.canSelect=!1,E.push(t),N.values.list_id=k(E,"id","name")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_LIST",msg:e.data?JSON.stringify(e.data.message):e.toString()})});N.values.list_id=k(E,"id","name")}}function F(n){var e=_.find(N.attributes,{name:n});if(!_.some(N.attributes,{id:e.value})){if(!_.some(d,{id:Number(e.value)}))return a.trunk.get({id:_.find(N.attributes,{name:n}).value,fields:"id,name"}).$promise.then(function(e){var t=e.toJSON();t.canSelect=!1,d.push(t),N.values[n]=k(d,"id","name")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_TRUNK",msg:e.data?JSON.stringify(e.data.message):e.toString()})});N.values[n]=k(d,"id","name")}}function $(){var e=_.find(N.attributes,{name:"queue_id"});if(!_.some(N.attributes,{id:e.value})){if(!_.some(c,{id:Number(e.value)}))return a.voiceQueue.get({id:_.find(N.attributes,{name:"queue_id"}).value,fields:"id,name"}).$promise.then(function(e){var t=e.toJSON();t.canSelect=!1,c.push(t),N.values.queue_id=k(c,"id","name")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_QUEUE",msg:e.data?JSON.stringify(e.data.message):e.toString()})});N.values.queue_id=k(c,"id","name")}}function q(){var e=_.find(N.attributes,{name:"file_id"});if(!_.some(N.attributes,{id:e.value})){if(!_.some(m,{id:Number(e.value)}))return a.sound.get({id:_.find(N.attributes,{name:"file_id"}).value,fields:"id,name"}).$promise.then(function(e){var t=e.toJSON();t.canSelect=!1,m.push(t),N.values.file_id=k(m,"id","name")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_SOUND",msg:e.data?JSON.stringify(e.data.message):e.toString()})});N.values.file_id=k(m,"id","name")}}function G(){var e=_.find(N.attributes,{name:"variable_id"});if(!_.some(N.attributes,{id:e.value})){if(!_.some(u,{id:Number(e.value)}))return a.variable.get({id:_.find(N.attributes,{name:"variable_id"}).value,fields:"id,name"}).$promise.then(function(e){var t=e.toJSON();t.canSelect=!1,u.push(t),N.values.variable_id=k(u,"id","name")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_VARIABLE",msg:e.data?JSON.stringify(e.data.message):e.toString()})});N.values.variable_id=k(u,"id","name")}}function H(){var e=_.find(N.attributes,{name:"odbc_id"});if(!_.some(N.attributes,{id:e.value})){if(!_.some(p,{id:Number(e.value)}))return a.squareOdbc.get({id:_.find(N.attributes,{name:"odbc_id"}).value,fields:"id,name"}).$promise.then(function(e){var t=e.toJSON();t.canSelect=!1,p.push(t),N.values.odbc_id=k(p,"id","name")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_ODBC",msg:e.data?JSON.stringify(e.data.message):e.toString()})});N.values.odbc_id=k(p,"id","name")}}function V(){var e=_.find(N.attributes,{name:"project_id"});if(!_.some(N.attributes,{id:e.value})){if(!_.some(g,{id:Number(e.value)}))return a.squareProject.get({id:_.find(N.attributes,{name:"project_id"}).value,fields:"id,name"}).$promise.then(function(e){var t=e.toJSON();t.canSelect=!1,g.push(t),N.values.project_id=k(g,"id","name")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_PROJECT",msg:e.data?JSON.stringify(e.data.message):e.toString()})});N.values.project_id=k(g,"id","name")}}function Q(){var e=_.find(N.attributes,{name:"context"});if(!_.some(N.attributes,{id:e.value})){if(!_.some(v,{id:Number(e.value)}))return a.voiceContext.get({id:_.find(N.attributes,{name:"context"}).value,fields:"id,name"}).$promise.then(function(e){var t=e.toJSON();t.canSelect=!1,v.push(t),N.values.context=k(v,"id","name")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_CONTEXT",msg:e.data?JSON.stringify(e.data.message):e.toString()})});N.values.context=k(v,"id","name")}}function B(){var e=_.find(N.attributes,{name:"interval_id"});if(!_.some(N.attributes,{id:e.value})){if(!_.some(h,{id:Number(e.value)}))return a.interval.get({id:_.find(N.attributes,{name:"interval_id"}).value,fields:"id,name,IntervalId"}).$promise.then(function(e){var t=e.toJSON();t.canSelect=!1,h.push(t),N.values.interval_id=k(h,"id","name","IntervalId")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_INTERVAL",msg:e.data?JSON.stringify(e.data.message):e.toString()})});N.values.interval_id=k(h,"id","name","IntervalId")}}function W(){var e=_.find(N.attributes,{name:"account_id"});if(!_.some(N.attributes,{id:e.value})){if(!_.some(f,{id:Number(e.value)}))return a.mailAccount.get({id:_.find(N.attributes,{name:"account_id"}).value,fields:"id,name"}).$promise.then(function(e){var t=e.toJSON();t.canSelect=!1,f.push(t),N.values.account_id=k(f,"id","name")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_MAIL_ACCOUNT",msg:e.data?JSON.stringify(e.data.message):e.toString()})});N.values.account_id=k(f,"id","name")}}function Y(){var e=_.find(N.attributes,{name:"sms_account_id"});if(!_.some(N.attributes,{id:e.value})){if(!_.some(I,{id:Number(e.value)}))return a.smsAccount.get({id:_.find(N.attributes,{name:"sms_account_id"}).value,fields:"id,name"}).$promise.then(function(e){var t=e.toJSON();t.canSelect=!1,I.push(t),N.values.sms_account_id=k(I,"id","name")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_SMS_ACCOUNT",msg:e.data?JSON.stringify(e.data.message):e.toString()})});N.values.sms_account_id=k(I,"id","name")}}function j(){var e=_.find(N.attributes,{name:"template_id"});if(!_.some(N.attributes,{id:e.value})){if(!_.some(b,{id:Number(e.value)}))return a.template.get({id:_.find(N.attributes,{name:"template_id"}).value,fields:"id,name"}).$promise.then(function(e){var t=e.toJSON();t.canSelect=!1,b.push(t),N.values.template_id=k(b,"id","name")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_TEMPLATE",msg:e.data?JSON.stringify(e.data.message):e.toString()})});N.values.template_id=k(b,"id","name")}}function z(){var e=_.find(N.attributes,{name:"pause_id"});if(!_.some(N.attributes,{id:e.value})){if(!_.some(C,{id:Number(e.value)}))return a.pause.get({id:_.find(N.attributes,{name:"pause_id"}).value,fields:"id,name"}).$promise.then(function(e){var t=e.toJSON();t.canSelect=!1,C.push(t),N.values.pause_id=k(C,"id","name")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_PAUSE",msg:e.data?JSON.stringify(e.data.message):e.toString()})});N.values.pause_id=k(C,"id","name")}}N.cellName=A.tagName,N.attributes=_.map(A.attributes,function(e){return{name:e.name,value:e.value,defaultValue:P[N.cellName]&&_.includes(P[N.cellName],e.name),required:D[N.cellName]&&_.includes(D[N.cellName],e.name),help:L[N.cellName]&&_.includes(L[N.cellName],e.name)}}),N.values={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:n,ispeech_tts_language:o,google_tts_language:r,google_asr_language:s,aws_polly_region:T,aws_polly_voice:S,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,aws_lex_region:O},N.crudPermissions=R,N.onInit=function(){x.hasRole("admin")?(e={sip_id:k(l,"id","fullname","role"),trunk_name:k(d,"name","name"),trunk_id:k(d,"id","name"),queue_id:k(c,"id","name"),file_id:k(m,"id","name"),variable_id:k(u,"id","name"),odbc_id:k(p,"id","name"),project_id:k(g,"id","name"),context:k(v,"id","name"),interval_id:(n=h,a="id",i="name",s="IntervalId",o=_.filter(n,function(e){return null===e[s]}),r=[],_.forEach(o,function(t){r.push({value:t[a],option:t[i]});var e=_.filter(n,function(e){return e[s]===t.id});_.forEach(e,function(e){r.push({value:e[a],option:" - "+e[i]})})}),r),account_id:k(f,"id","name"),template_id:k(b,"id","name"),list_id:k(E,"id","name"),sms_account_id:k(I,"id","name"),pause_id:k(C,"id","name")},t=_.merge(N.values,e),N.values=t):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"],t=0;t<N.attributes.length;t++)if(_.includes(e,N.attributes[t].name))switch(N.attributes[t].name){case"sip_id":M();break;case"trunk_name":case"trunk_id":F(N.attributes[t].name);break;case"queue_id":$();break;case"file_id":q();break;case"variable_id":G();break;case"odbc_id":H();break;case"project_id":V();break;case"context":Q();break;case"interval_id":B();break;case"account_id":W();break;case"template_id":j();break;case"list_id":U();break;case"sms_account_id":Y();break;case"pause_id":z()}}();var e,t,n,a,i,s,o,r},N.closeDialog=function(e){e&&y(N.attributes),t.hide()},N.getMap=k}e.$inject=["$mdDialog","api","toasty","ispeechAsrModel","ispeechAsrLanguage","googleAsrLanguage","ispeechTtsLanguage","googleTtsLanguage","users","trunks","queues","sounds","variables","databases","projects","contexts","intervals","mailAccounts","templates","lists","cell","saveCallback","awsPollyVoice","awsPollyRegion","smsAccounts","pauses","dialogFlowLanguage","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,t,n,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("googleTtsLanguage",function(){return[{value:"af",option:"Afrikaans"},{value:"sq",option:"Albanian"},{value:"am",option:"Amharic"},{value:"ar",option:"Arabic"},{value:"hy",option:"Armenian"},{value:"az",option:"Azerbaijani"},{value:"eu",option:"Basque"},{value:"be",option:"Belarusian"},{value:"bn",option:"Bengali"},{value:"bh",option:"Bihari"},{value:"bs",option:"Bosnian"},{value:"br",option:"Breton"},{value:"bg",option:"Bulgarian"},{value:"km",option:"Cambodian"},{value:"ca",option:"Catalan"},{value:"zh-CN",option:"Chinese (Simplified)"},{value:"zh-TW",option:"Chinese (Traditional)"},{value:"co",option:"Corsican"},{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:"fo",option:"Faroese"},{value:"tl",option:"Filipino"},{value:"fi",option:"Finnish"},{value:"fr",option:"French"},{value:"fy",option:"Frisian"},{value:"gl",option:"Galician"},{value:"ka",option:"Georgian"},{value:"de",option:"German"},{value:"el",option:"Greek"},{value:"gn",option:"Guarani"},{value:"gu",option:"Gujarati"},{value:"xx-hacker",option:"Hacker"},{value:"ha",option:"Hausa"},{value:"iw",option:"Hebrew"},{value:"hi",option:"Hindi"},{value:"hu",option:"Hungarian"},{value:"is",option:"Icelandic"},{value:"id",option:"Indonesian"},{value:"ia",option:"Interlingua"},{value:"ga",option:"Irish"},{value:"it",option:"Italian"},{value:"jw",option:"Javanese"},{value:"ja",option:"Japanese"},{value:"kn",option:"Kannada"},{value:"kk",option:"Kazakh"},{value:"rw",option:"Kinyarwanda"},{value:"rn",option:"Kirundi"},{value:"xx-klingon",option:"Klingon"},{value:"ku",option:"Kurdish"},{value:"ko",option:"Korean"},{value:"ky",option:"Kyrgyz"},{value:"lo",option:"Laothian"},{value:"la",option:"Latin"},{value:"lv",option:"Latvian"},{value:"ln",option:"Lingala"},{value:"lt",option:"Lithuanian"},{value:"mk",option:"Macedonian"},{value:"mg",option:"Malagasy"},{value:"ml",option:"Malayalam"},{value:"mt",option:"Maltese"},{value:"mi",option:"Maori"},{value:"mr",option:"Marathi"},{value:"mo",option:"Moldavian"},{value:"mn",option:"Mongolian"},{value:"sr-ME",option:"Montenegrin"},{value:"ne",option:"Nepali"},{value:"no",option:"Norwegian"},{value:"nn",option:"Norwegian (Nynorsk)"},{value:"oc",option:"Occitan"},{value:"or",option:"Oriya"},{value:"om",option:"Oromo"},{value:"ps",option:"Pashto"},{value:"fa",option:"Persian"},{value:"xx-pirate",option:"Pirate"},{value:"pl",option:"Polish"},{value:"pt-BR",option:"Portuguese (Brazil)"},{value:"pt-PT",option:"Portuguese (Portugal)"},{value:"pa",option:"Punjabi"},{value:"qu",option:"Quechua"},{value:"ro",option:"Romanian"},{value:"rm",option:"Romansh"},{value:"ru",option:"Russian"},{value:"gd",option:"Scots Gaelic"},{value:"sr",option:"Serbian"},{value:"sh",option:"Serbo-Croatian"},{value:"st",option:"Sesotho"},{value:"sn",option:"Shona"},{value:"sd",option:"Sindhi"},{value:"si",option:"Sinhalese"},{value:"sk",option:"Slovak"},{value:"sl",option:"Slovenian"},{value:"so",option:"Somali"},{value:"es",option:"Spanish"},{value:"su",option:"Sundanese"},{value:"sw",option:"Swahili"},{value:"sv",option:"Swedish"},{value:"tg",option:"Tajik"},{value:"ta",option:"Tamil"},{value:"tt",option:"Tatar"},{value:"te",option:"Telugu"},{value:"th",option:"Thai"},{value:"ti",option:"Tigrinya"},{value:"to",option:"Tonga"},{value:"tr",option:"Turkish"},{value:"tk",option:"Turkmen"},{value:"tw",option:"Twi"},{value:"ug",option:"Uighur"},{value:"uk",option:"Ukrainian"},{value:"ur",option:"Urdu"},{value:"uz",option:"Uzbek"},{value:"vi",option:"Vietnamese"},{value:"cy",option:"Welsh"},{value:"xh",option:"Xhosa"},{value:"yi",option:"Yiddish"},{value:"yo",option:"Yoruba"},{value:"zu",option:"Zulu"}]}).factory("googleAsrLanguage",function(){return[{value:"af-ZA",option:"Afrikaans (South Africa)"},{value:"am-ET",option:"Amharic (Ethiopia)"},{value:"hy-AM",option:"Armenian (Armenia)"},{value:"az-AZ",option:"Azerbaijani (Azerbaijan)"},{value:"id-ID",option:"Indonesian (Indonesia)"},{value:"ms-MY",option:"Malay (Malaysia)"},{value:"bn-BD",option:"Bengali (Bangladesh)"},{value:"bn-IN",option:"Bengali (India)"},{value:"ca-ES",option:"Catalan (Spain)"},{value:"cs-CZ",option:"Czech (Czech Republic)"},{value:"da-DK",option:"Danish (Denmark)"},{value:"de-DE",option:"German (Germany)"},{value:"en-AU",option:"English (Australia)"},{value:"en-CA",option:"English (Canada)"},{value:"en-GH",option:"English (Ghana)"},{value:"en-GB",option:"English (United Kingdom)"},{value:"en-IN",option:"English (India)"},{value:"en-IE",option:"English (Ireland)"},{value:"en-KE",option:"English (Kenya)"},{value:"en-NZ",option:"English (New Zealand)"},{value:"en-NG",option:"English (Nigeria)"},{value:"en-PH",option:"English (Philippines)"},{value:"en-ZA",option:"English (South Africa)"},{value:"en-TZ",option:"English (Tanzania)"},{value:"en-US",option:"English (United States)"},{value:"es-AR",option:"Spanish (Argentina)"},{value:"es-BO",option:"Spanish (Bolivia)"},{value:"es-CL",option:"Spanish (Chile)"},{value:"es-CO",option:"Spanish (Colombia)"},{value:"es-CR",option:"Spanish (Costa Rica)"},{value:"es-EC",option:"Spanish (Ecuador)"},{value:"es-SV",option:"Spanish (El Salvador)"},{value:"es-ES",option:"Spanish (Spain)"},{value:"es-US",option:"Spanish (United States)"},{value:"es-GT",option:"Spanish (Guatemala)"},{value:"es-HN",option:"Spanish (Honduras)"},{value:"es-MX",option:"Spanish (Mexico)"},{value:"es-NI",option:"Spanish (Nicaragua)"},{value:"es-PA",option:"Spanish (Panama)"},{value:"es-PY",option:"Spanish (Paraguay)"},{value:"es-PE",option:"Spanish (Peru)"},{value:"es-PR",option:"Spanish (Puerto Rico)"},{value:"es-DO",option:"Spanish (Dominican Republic)"},{value:"es-UY",option:"Spanish (Uruguay)"},{value:"es-VE",option:"Spanish (Venezuela)"},{value:"eu-ES",option:"Basque (Spain)"},{value:"fil-PH",option:"Filipino (Philippines)"},{value:"fr-CA",option:"French (Canada)"},{value:"fr-FR",option:"French (France)"},{value:"gl-ES",option:"Galician (Spain)"},{value:"ka-GE",option:"Georgian (Georgia)"},{value:"gu-IN",option:"Gujarati (India)"},{value:"hr-HR",option:"Croatian (Croatia)"},{value:"zu-ZA",option:"Zulu (South Africa)"},{value:"is-IS",option:"Icelandic (Iceland)"},{value:"it-IT",option:"Italian (Italy)"},{value:"jv-ID",option:"Javanese (Indonesia)"},{value:"kn-IN",option:"Kannada (India)"},{value:"km-KH",option:"Khmer (Cambodia)"},{value:"lo-LA",option:"Lao (Laos)"},{value:"lv-LV",option:"Latvian (Latvia)"},{value:"lt-LT",option:"Lithuanian (Lithuania)"},{value:"hu-HU",option:"Hungarian (Hungary)"},{value:"ml-IN",option:"Malayalam (India)"},{value:"mr-IN",option:"Marathi (India)"},{value:"nl-NL",option:"Dutch (Netherlands)"},{value:"ne-NP",option:"Nepali (Nepal)"},{value:"nb-NO",option:"Norwegian Bokmal (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:"si-LK",option:"Sinhala (Srilanka)"},{value:"sk-SK",option:"Slovak (Slovakia)"},{value:"sl-SI",option:"Slovenian (Slovenia)"},{value:"su-ID",option:"Sundanese (Indonesia)"},{value:"sw-TZ",option:"Swahili (Tanzania)"},{value:"sw-KE",option:"Swahili (Kenya)"},{value:"fi-FI",option:"Finnish (Finland)"},{value:"sv-SE",option:"Swedish (Sweden)"},{value:"ta-IN",option:"Tamil (India)"},{value:"ta-SG",option:"Tamil (Singapore)"},{value:"ta-LK",option:"Tamil (Sri Lanka)"},{value:"ta-MY",option:"Tamil (Malaysia)"},{value:"te-IN",option:"Telugu (India)"},{value:"vi-VN",option:"Vietnamese (Vietnam)"},{value:"tr-TR",option:"Turkish (Turkey)"},{value:"ur-PK",option:"Urdu (Pakistan)"},{value:"ur-IN",option:"Urdu (India)"},{value:"el-GR",option:"Greek (Greece)"},{value:"bg-BG",option:"Bulgarian (Bulgaria)"},{value:"ru-RU",option:"Russian (Russia)"},{value:"sr-RS",option:"Serbian (Serbia)"},{value:"uk-UA",option:"Ukrainian (Ukraine)"},{value:"he-IL",option:"Hebrew (Israel)"},{value:"ar-IL",option:"Arabic (Israel)"},{value:"ar-JO",option:"Arabic (Jordan)"},{value:"ar-AE",option:"Arabic (United Arab Emirates)"},{value:"ar-BH",option:"Arabic (Bahrain)"},{value:"ar-DZ",option:"Arabic (Algeria)"},{value:"ar-SA",option:"Arabic (Saudi Arabia)"},{value:"ar-IQ",option:"Arabic (Iraq)"},{value:"ar-KW",option:"Arabic (Kuwait)"},{value:"ar-MA",option:"Arabic (Morocco)"},{value:"ar-TN",option:"Arabic (Tunisia)"},{value:"ar-OM",option:"Arabic (Oman)"},{value:"ar-PS",option:"Arabic (State of Palestine)"},{value:"ar-QA",option:"Arabic (Qatar)"},{value:"ar-LB",option:"Arabic (Lebanon)"},{value:"ar-EG",option:"Arabic (Egypt)"},{value:"fa-IR",option:"Persian (Iran)"},{value:"hi-IN",option:"Hindi (India)"},{value:"th-TH",option:"Thai (Thailand)"},{value:"ko-KR",option:"Korean (South Korea)"},{value:"cmn-Hant-TW",option:"Chinese, Mandarin (Traditional, Taiwan)"},{value:"yue-Hant-HK",option:"Chinese, Cantonese (Traditional, Hong Kong)"},{value:"ja-JP",option:"Japanese (Japan)"},{value:"cmn-Hans-HK",option:"Chinese, Mandarin (Simplified, Hong Kong)"},{value:"cmn-Hans-CN",option:"Chinese, Mandarin (Simplified, China)"}]}).factory("awsPollyVoice",function(){return[{value:"Amy",option:"Amy (English, British, Female)"},{value:"Astrid",option:"Astrid (Swedish, Female)"},{value:"Brian",option:"Brian (English, British, Male)"},{value:"Carla",option:"Carla (Italian, Female)"},{value:"Carmen",option:"Carmen (Romanian, Female)"},{value:"Celine",option:"Celine (French, Female)"},{value:"Chantal",option:"Chantal (French, Canadian, Female)"},{value:"Conchita",option:"Conchita (Spanish, Castilian, Female)"},{value:"Cristiano",option:"Cristiano (Portuguese, Male)"},{value:"Dora",option:"Dora (Icelandic, Female)"},{value:"Emma",option:"Emma (English, British, Female)"},{value:"Enrique",option:"Enrique (Spanish, Castilian, Male)"},{value:"Ewa",option:"Ewa (Polish, Female)"},{value:"Filiz",option:"Filiz (Turkish, Female)"},{value:"Geraint",option:"Geraint (English, Welsh, Male)"},{value:"Giorgio",option:"Giorgio (Italian, Male)"},{value:"Gwineth",option:"Gwineth (Welsh, Female)"},{value:"Hans",option:"Hans (German, Male)"},{value:"Ines",option:"Ines (Portuguese, Female)"},{value:"Ivy",option:"Ivy (English, US, Female)"},{value:"Jacek",option:"Jacek (Polish, Male)"},{value:"Jan",option:"Jan (Polish, Male)"},{value:"Joanna",option:"Joanna (English, US, Female)"},{value:"Joey",option:"Joey (English, US, Male)"},{value:"Justin",option:"Justin (English, US, Male)"},{value:"Karl",option:"Karl (Icelandic, Male)"},{value:"Kendra",option:"Kendra (English, US, Female)"},{value:"Kimberly",option:"Kimberly (English, US, Female)"},{value:"Liv",option:"Liv (Norwegian, Female)"},{value:"Lotte",option:"Lotte (Dutch, Female)"},{value:"Mads",option:"Mads (Danish, Male)"},{value:"Maja",option:"Maja (Polish, Female)"},{value:"Marlene",option:"Marlene (German, Female)"},{value:"Mathieu",option:"Mathieu (French, Male)"},{value:"Maxim",option:"Maxim (Russian, Male)"},{value:"Miguel",option:"Miguel (Spanish, US, Male)"},{value:"Mizuki",option:"Mizuki (Japanese, Female)"},{value:"Naja",option:"Naja (Danish, Female)"},{value:"Nicole",option:"Nicole (English, Austrialian, Female)"},{value:"Penelope",option:"Penelope (Spanish, US, Female)"},{value:"Raveena",option:"Raveena (English, Indian, Female)"},{value:"Ricardo",option:"Ricardo (Portuguese, Brazilian, Male)"},{value:"Ruben",option:"Ruben (Dutch, Male)"},{value:"Russell",option:"Russell (English, Austrialian, Male)"},{value:"Salli",option:"Salli (English, US, Female)"},{value:"Tatyana",option:"Tatyana (Russian, Female)"},{value:"Vitoria",option:"Vitoria (Portuguese, Brazilian, 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)"}]})}(),function(){"use strict";function e(t,e,n,a){var i=this;i.project={preproduction:n},i.closeDialog=function(e){e?(a(i.project.preproduction),t.hide(i.project.preproduction)):t.hide()}}e.$inject=["$mdDialog","toasty","currentXML","saveCallback"],angular.module("app.callysquare").controller("MxGraphEditXMLController",e)}(),function(){"use strict";function e(t,n){var a=this;function i(e){e?(n(e),t.hide(e)):t.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 t=new FileReader;t.onload=function(e){i(e.target.result)},t.readAsText(e.file)}}}e.$inject=["$mdDialog","saveCallback"],angular.module("app.callysquare").controller("MxGraphImportXMLController",e)}(),function(){"use strict";function e(t,n,e,a){var i=this;i.project=_.clone(e),i.closeDialog=function(){t.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){n.success({title:"Project updated!",msg:i.project.name?i.project.name+" has been updated!":""}),t.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(t,e,n,a,i){var s=this;s.projects=n,s.id="",s.newWindow=!0,s.closeDialog=function(e){s.errors=[],e?(t.hide(),s.newWindow?a.open("/callysquare/projects/"+s.id,"_blank"):i.go("app.callysquare.projects.edit",{id:s.id})):t.hide()}}e.$inject=["$mdDialog","toasty","projects","$window","$state"],angular.module("app.callysquare").controller("MxGraphOpenProjectController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o){var r=this;function l(){return a.squareProject.getUsers({id:r.project.id,fields:"id,name,fullname,internal",nolimit:!0,role:"user"}).$promise.then(function(e){return r.selectedItems=e.rows?_.map(e.rows,function(e){return e}):[],r.dualMultiselectOptions.selectedItems=r.selectedItems,a.user.get({fields:"id,fullname,name,internal",role:"user",nolimit:!0}).$promise}).then(function(e){r.items=e.rows?_.map(e.rows,function(e){return e}):[],r.dualMultiselectOptions.items=_.differenceBy(r.items,r.selectedItems,"id")}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETUSERS",msg:e.status?JSON.stringify(e.data):e.toString()})})}r.project=t,r.penalty=0,r.items=[],r.selectedItems=[],r.closeDialog=function(){e.hide()},r.dualMultiselectOptions={readOnly:!1,items:[],selectedItems:[],showSelectAndDeselectAll:!0,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"penalty",labelAll:s.instant("CALLYSQUARE.ALL_USERS"),labelSelected:s.instant("CALLYSQUARE.SELECTED_USERS"),transferCallback:function(e,t){a.squareProject[t?"removeUsers":"addUsers"]({id:r.project.id,ids:_.map(e,"id"),penalty:r.penalty||0}).$promise.then(function(){n.success({title:"Project properly "+(t?"removed":"added"),msg:"Project has been "+(t?"removed":"added")+"!"}),t||l()}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:squareProjects.ADDUSERS",msg:e.status?JSON.stringify(e.data):e.toString()})})}},l()}e.$inject=["$mdDialog","toasty","api","project","projects","$translate","Auth"],angular.module("app.callysquare").controller("ProjectspermissionaddController",e)}(),function(){"use strict";function e(t,n,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(){t.hide()},r.save=function(){delete r.project.id,i.squareProject.save(r.project).$promise.then(function(e){n.success({title:"Project properly created",msg:r.project.name?r.project.name+" has been created!":""}),t.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,n,a,i,s,o,r,t,l,d,c,m,u,p,g,v,h,f,b,E,A,y,S,T){var I=this;I.currentUser=T.getCurrentUser(),I.project=t||{},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,t){var n={preproduction:e};t&&(n.production=e);r.squareProject.update({id:I.project.id},n).$promise.then(function(e){o.success({title:"Project "+(t?"published":"saved")+"!",msg:I.project.name?I.project.name+" has been "+(t?"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,t){a.show({controller:"MxGraphDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/dialog/dialog.html",parent:angular.element(n.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:A.rows||[],pauses:y.rows||[],templates:b.rows||[],lists:E.rows||[],cell:e,saveCallback:t,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(n.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(n.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(n.body),clickOutsideToClose:!0,locals:{project:I.project,currentXML:e}}).then(function(e){e&&v.rows.push(e)})},I.newVariable=function(t){return i(function(a,t){return r.userProfileSection.get({userProfileId:I.currentUser.userProfileId,sectionId:1012}).$promise.then(function(e){var t=e.rows?e.rows[0]:null,n=T.parseCrudPermissions(t?t.crudPermissions:null);a(n)}).catch(function(e){t(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(n.body),clickOutsideToClose:!0,locals:{variable:t,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(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{project:I.project}}).then(function(e){e&&_.merge(I.project,e)})},I.editXML=function(e,t){a.show({controller:"MxGraphEditXMLController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/edit/edit.html",parent:angular.element(n.body),clickOutsideToClose:!0,locals:{currentXML:e,saveCallback:t}}).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(n.body),clickOutsideToClose:!0,locals:{saveCallback:e}}).then(function(e){e&&(I.project.preproduction=e)})},I.gotoProjects=function(){e.go("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,n,t,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.table="projects",p.listOrder="",p.listOrderAsc=null,p.selectedProjects=[],p.query={fields:"id,name,description,notes",sort:"-updatedAt",limit:10,page:1},p.editstate=function(e,t){n.go("app.callysquare.projects.edit",{id:e.id,crudPermissions:p.crudPermissions})},p.deleteconfirm=function(e,t){var n=l.confirm().title("Are you sure want to delete the project?").htmlContent("<b>"+e.name+"</b> will be deleted.").ariaLabel("delete project").targetEvent(t).ok("OK").cancel("CANCEL");l.show(n).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="Projects",p.promise=o.userProfile.getResources(p.query,h).$promise)},p.createOrEditProject=function(e,t){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:t,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 t=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(t).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 t=0;t<e.data.errors.length;t++)m.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){g?c(function(){g=!1}):(t||(v=p.query.page),e!==t&&(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,t,n,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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.squareRecordings,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The squareRecording will be deleted.").ariaLabel("Delete SquareRecording").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.squareRecordings=l||{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="squareRecordings",b.listOrder="",b.listOrderAsc=null,b.selectedSquareRecordings=[],b.query={fields:"createdAt,updatedAt,id,filename,projectName,uniqueid,callerid,extension,audio",sort:"-updatedAt",limit:10,page:1},b.downloadfile2=function(s,e){return m.squareRecording.download({id:s.id}).$promise.then(function(e){var t=[e.buffer],n="download",a=new Blob(t,{type:e.type});n=s.uniqueid+".wav";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getSquareRecordings=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.squareRecording.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="SquareRecordings",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditSquareRecording=function(e,t){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:t,squareRecordings:b.squareRecordings.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteSquareRecording=S,b.exportSelectedSquareRecordings=function(){var e=angular.copy(b.selectedSquareRecordings);return b.selectedSquareRecordings=[],e},b.deleteSelectedSquareRecordings=function(e){var t=i.confirm().title("Are you sure want to delete the selected squareRecordings?").htmlContent("<b>"+b.selectedSquareRecordings.length+" selected</b> will be deleted.").ariaLabel("delete SquareRecordings").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedSquareRecordings.forEach(function(e){S(e)}),b.selectedSquareRecordings=[]})},b.deselectSquareRecordings=function(){b.selectedSquareRecordings=[]},b.selectAllSquareRecordings=function(){b.selectedSquareRecordings=b.squareRecordings.rows};var E=!0,A=1;function y(e){b.squareRecordings=e||{count:0,rows:[]}}function S(e){m.squareRecording.delete({id:e.id}).$promise.then(function(){_.remove(b.squareRecordings.rows,{id:e.id}),b.squareRecordings.count-=1,b.squareRecordings.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEsquareRecording"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getSquareRecordings())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","squareRecordings","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.callysquare").controller("SquareRecordingsController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.chatQueues=l||{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="chatQueues",b.listOrder="",b.listOrderAsc=null,b.selectedChatQueues=[],b.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"chat",limit:10,page:1},b.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.chat.chatQueues.edit",{id:e.id,chatQueue:e,crudPermissions:b.crudPermissions})},b.teamadddialog=function(e,t){i.show({controller:"ChatQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{chatQueue:e,chatQueues:b.chatQueues?b.chatQueues.rows:[],crudPermissions:b.crudPermissions}})},b.agentadddialog=function(e,t){i.show({controller:"ChatQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{chatQueue:e,chatQueues:b.chatQueues?b.chatQueues.rows:[],crudPermissions:b.crudPermissions,realtime:!1}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.gotorealtimegoto=function(e,t){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:510}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.chat.realtime.queues",{})}},b.success=y,b.getChatQueues=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.chatQueue.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="ChatQueues",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditChatQueue=function(e,t){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:t,chatQueues:b.chatQueues.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteChatQueue=S,b.exportSelectedChatQueues=function(){var e=angular.copy(b.selectedChatQueues);return b.selectedChatQueues=[],e},b.deleteSelectedChatQueues=function(e){var t=i.confirm().title("Are you sure want to delete the selected chatQueues?").htmlContent("<b>"+b.selectedChatQueues.length+" selected</b> will be deleted.").ariaLabel("delete ChatQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedChatQueues.forEach(function(e){S(e)}),b.selectedChatQueues=[]})},b.deselectChatQueues=function(){b.selectedChatQueues=[]},b.selectAllChatQueues=function(){b.selectedChatQueues=b.chatQueues.rows};var E=!0,A=1;function y(e){b.chatQueues=e||{count:0,rows:[]}}function S(e){m.chatQueue.delete({id:e.id}).$promise.then(function(){_.remove(b.chatQueues.rows,{id:e.id}),b.chatQueues.count-=1,b.chatQueues.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEchatQueue"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getChatQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","chatQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.chat").controller("ChatQueuesController",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(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_CHATQUEUE",g.chatQueue=angular.copy(l),g.chatQueues=r,g.newChatQueue=!1,g.chatQueue||(g.chatQueue={strategy:"beepall",timeout:10},g.title="CHAT.NEW_CHATQUEUE",g.newChatQueue=!0),g.addNewChatQueue=function(){g.errors=[],d.chatQueue.save(g.chatQueue).$promise.then(function(e){g.chatQueues.unshift(e.toJSON()),o.success({title:"ChatQueue properly created",msg:g.chatQueue.name?g.chatQueue.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.chatQueue.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveChatQueue=function(){g.errors=[],d.chatQueue.update({id:g.chatQueue.id},g.chatQueue).$promise.then(function(e){var t=_.find(g.chatQueues,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"ChatQueue properly saved!",msg:g.chatQueue.name?g.chatQueue.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.chatQueue.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteChatQueue=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The chatQueue will be deleted.").ariaLabel("Delete ChatQueue").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.chatQueue.delete({id:g.chatQueue.id}).$promise.then(function(){_.remove(g.chatQueues,{id:g.chatQueue.id}),o.success({title:"ChatQueue properly deleted!",msg:(g.chatQueue.name||"chatQueue")+" has been deleted!"}),v(g.chatQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatQueue.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.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(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","chatQueues","chatQueue","api","Auth","license","setting","crudPermissions"],angular.module("app.chat").controller("CreateOrEditChatQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,t,n,o,r,l,d){var c=this;function m(){return a(function(n,t){return a(function(t,n){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.chatQueue.getAgents({id:c.chatQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return t.penalty=e.UserChatQueue?"penalty "+e.UserChatQueue.penalty:"",t.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=l.getCurrentUser(),c.chatQueue=t,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(n,t){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.chatQueue.removeAgents({id:c.chatQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.chatQueue.addAgents({id:c.chatQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,items:[],selectedItems:[],showSelectAndDeselectAll:!o,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("CHAT.ALL_AGENTS"),labelSelected:r.instant("CHAT.SELECTED_AGENTS"),transferCallback:function(e,t){var n=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(n)}}}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,t,n,o,r){var l=this;function d(){return a(function(n,t){return a(function(t,n){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:l.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return l.allowedItems=_.map(t,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var t=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.chatQueue.getTeams({id:l.chatQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];l.selectedItems=_.map(t,function(e){return _.find(l.items,{id:e.id})}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}l.currentUser=o.getCurrentUser(),l.chatQueue=t,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={readOnly:!l.crudPermissions.canEdit,allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!0,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:n.instant("CHAT.ALL_TEAMS"),labelSelected:n.instant("CHAT.SELECTED_TEAMS"),transferCallback:function(e,t){var n=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(n)}},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(n,t){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.chatQueue.removeTeams({id:l.chatQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.chatQueue.addTeams({id:l.chatQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},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,t,n,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=t.protocol()+"://"+t.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,t){n.show({controller:"ChatQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{chatQueue:e,chatQueues:u.chatQueues?u.chatQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,t){n.show({controller:"ChatQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:t,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")},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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.chatWebsites=l||{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="chatWebsites",b.listOrder="",b.listOrderAsc=null,b.selectedChatWebsites=[],b.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,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,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,forwardOfflineAddress,IntervalId,timezone,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,page:1},b.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"),"")}),b.arrayheader_shape=_.keyBy([{option:"Rounded",value:"'rounded'"},{option:"Squared",value:"'squared'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.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"),"")}),b.arraymessagesAlignment=_.keyBy([{option:"alternate",value:"'alternate'"},{option:"centered",value:"'centered'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arrayratingType=_.keyBy([{option:"Star",value:"'star'"},{option:"Thumb",value:"'thumb'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.chat.chatWebsites.edit",{id:e.id,chatWebsite:e,crudPermissions:b.crudPermissions})},b.interactionsgoto=function(e,t){n.go("app.chat.chatWebsites.edit",{id:e.id,tab:9})},b.offlinemessagesgoto=function(e,t){n.go("app.chat.chatWebsites.edit",{id:e.id,tab:10})},b.agentadddialog=function(e,t){i.show({controller:"ChatWebsiteagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{chatWebsite:e,chatWebsites:b.chatWebsites?b.chatWebsites.rows:[],crudPermissions:b.crudPermissions,realtime:!1}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getChatWebsites=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.chatWebsite.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="ChatWebsites",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditChatWebsite=function(e,t){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:t,chatWebsites:b.chatWebsites.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteChatWebsite=S,b.exportSelectedChatWebsites=function(){var e=angular.copy(b.selectedChatWebsites);return b.selectedChatWebsites=[],e},b.deleteSelectedChatWebsites=function(e){var t=i.confirm().title("Are you sure want to delete the selected chatWebsites?").htmlContent("<b>"+b.selectedChatWebsites.length+" selected</b> will be deleted.").ariaLabel("delete ChatWebsites").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedChatWebsites.forEach(function(e){S(e)}),b.selectedChatWebsites=[]})},b.deselectChatWebsites=function(){b.selectedChatWebsites=[]},b.selectAllChatWebsites=function(){b.selectedChatWebsites=b.chatWebsites.rows},g.hasRole("admin")?m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){b.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){b.lists=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(b.lists,{id:e.resourceId})}),n=null;if(b.chatWebsite&&(n=_.find(b.lists,{id:Number(b.chatWebsite.ListId)})),n&&!_.some(t,["id",n.id])){var a=_.find(b.lists,{id:n.id});a.canSelect=!1,t.push(a)}b.lists=t})}else{var n=[],a=null;b.chatWebsite&&(a=_.find(b.lists,{id:Number(b.chatWebsite.ListId)}));for(var i=0;i<b.lists.length;i++)a&&b.lists[i].id===a.id&&(b.lists[i].canSelect=!1,n.push(b.lists[i]));b.lists=n}}).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){b.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){b.interval=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(b.interval,{id:e.resourceId})}),n=null;if(b.chatWebsite&&(n=_.find(b.interval,{id:Number(b.chatWebsite.IntervalId)})),n&&!_.some(t,["id",n.id])){var a=_.find(b.interval,{id:n.id});a.canSelect=!1,t.push(a)}b.interval=t})}else{var n=[],a=null;b.chatWebsite&&(a=_.find(b.interval,{id:Number(b.chatWebsite.IntervalId)}));for(var i=0;i<b.interval.length;i++)a&&b.interval[i].id===a.id&&(b.interval[i].canSelect=!1,n.push(b.interval[i]));b.interval=n}}).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 E=!0,A=1;function y(e){b.chatWebsites=e||{count:0,rows:[]}}function S(e){m.chatWebsite.delete({id:e.id}).$promise.then(function(){_.remove(b.chatWebsites.rows,{id:e.id}),b.chatWebsites.count-=1,b.chatWebsites.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEchatWebsite"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getChatWebsites())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","chatWebsites","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.chat").controller("ChatWebsitesController",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(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:n.protocol()+"://"+n.host()+(n.port()?":"+n.port():""),header_shape:"rounded",alignment:"bottom_right",verticalAlignment:30,messagesAlignment:"alternate",IntervalId:"null",timezone:"null",waitForTheAssignedAgent:10,notificationSound:!0,queueTransferTimeout:300,agentTransferTimeout:300},g.title="CHAT.NEW_CHATWEBSITE",g.newChatWebsite=!0),t.params.id&&(g.chatWebsite.ChatWebsiteId=t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.chatWebsites,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The chatWebsite will be deleted.").ariaLabel("Delete ChatWebsite").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.lists,{id:e.resourceId})}),n=null;if(g.chatWebsite&&(n=_.find(g.lists,{id:Number(g.chatWebsite.ListId)})),n&&!_.some(t,["id",n.id])){var a=_.find(g.lists,{id:n.id});a.canSelect=!1,t.push(a)}g.lists=t})}else{var n=[],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,n.push(g.lists[i]));g.lists=n}}).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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.interval,{id:e.resourceId})}),n=null;if(g.chatWebsite&&(n=_.find(g.interval,{id:Number(g.chatWebsite.IntervalId)})),n&&!_.some(t,["id",n.id])){var a=_.find(g.interval,{id:n.id});a.canSelect=!1,t.push(a)}g.interval=t})}else{var n=[],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,n.push(g.interval[i]));g.interval=n}}).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 t(e,t){if(r.chatWebsiteApps.rows.length){var n=r.chatWebsiteApps.rows[t]?r.chatWebsiteApps.rows[t]:r.chatWebsiteApps.rows[0];i.show({controller:"EditChatWebsiteApp"+(n.appType||n.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/apps/"+(n.appType||n.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsiteApp:n,chatWebsite:r.chatWebsite,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.chatWebsiteApps.rows[t]=e:r.chatWebsiteApps.rows.splice(t,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,t=[],n=0;n<r.chatWebsiteApps.rows.length;n++,0){var a=r.chatWebsiteApps.rows[n],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,t=_.concat(t,i,[a],s)}o.chatWebsite.addApplications({id:r.chatWebsite.id},_.sortBy(t,"priority")).$promise.then(function(e){r.chatWebsiteApps.rows=e.rows}).catch(function(e){console.error(e)})}function n(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:"1"},{option:"Always",value:"0"}],required:!0,param:0},{title:"Text",name:"text",type:"textarea",maxlength:255,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:"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"]),{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){t(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,t){r.chatWebsite=e,r.crudPermissions=void 0!==t?t:{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,t,n){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(n).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.chatWebsiteApps.rows.splice(t,1),l()},function(){console.log("CANCEL")})},r.getChatWebsiteApps=function(){r.promise=o.chatWebsite.getApplications(r.query,n).$promise},r.editChatWebsiteApp=t,r.editInterval=function(e,t){if(r.chatWebsiteApps.rows.length){var n=r.chatWebsiteApps.rows[t]?r.chatWebsiteApps.rows[t]: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:n.interval,IntervalId:n.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(n.interval=e.interval||"*,*,*,*",n.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 t=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(t).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,t,n,o,r,l,d){var c=this;function m(){return a(function(n,t){return a(function(t,n){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.chatWebsite.getAgents({id:c.chatWebsite.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return t.penalty=e.UserChatWebsite?"penalty "+e.UserChatWebsite.penalty:"",t.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=l.getCurrentUser(),c.chatWebsite=t,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(n,t){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.chatWebsite.removeAgents({id:c.chatWebsite.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.chatWebsite.addAgents({id:c.chatWebsite.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,items:[],selectedItems:[],showSelectAndDeselectAll:!o,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("CHAT.ALL_AGENTS"),labelSelected:r.instant("CHAT.SELECTED_AGENTS"),transferCallback:function(e,t){var n=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(n)}}}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 t=["png","jpg"];if(!_.includes(t,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+t.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var n={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.chatWebsite.images.unshift(n),!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(t,e){if(t.id===a.uniqueIdentifier){var n=new FileReader;n.readAsDataURL(t.file.file),n.onload=function(e){t.url=e.target.result},t.type="image"}})},i.init=function(e,t){i.chatWebsite=angular.copy(e),i.crudPermissions=void 0!==t?t:{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(t,e,n,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"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){t.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 t=_.find(l.agents,{name:l.agent.agent});t&&(l.agent.UserId=t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),n=null;if(l.agent&&(n=_.find(l.agents,{name:l.agent.agent})),n&&!_.some(t,["id",n.id])){var a=_.find(l.agents,{id:n.id});a.canSelect=!1,t.push(a)}l.agents=t})}else{var n=[],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,n.push(l.agents[i]));l.agents=n}}).catch(function(e){n.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(t,e,n,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"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){t.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(t,e,n,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"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){t.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(t,e,n,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"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){t.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(t,e,n,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"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){t.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(t,e,n,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"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){t.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(t,e,n,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"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){t.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,t,n,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 E(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var t=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),n=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(t+"-"+n)}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 A(e){t.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=E(),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!":""}),A()}).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=E(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),A(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var t=_.find(c.intervals,{id:e.id});t&&_.merge(t,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),A()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=A,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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=e&&e.rows?e.rows:[],n=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(t,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,n.push(e))}),c.intervals=n})}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(t,e,n,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"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){t.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(t,e,n,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"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){t.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 t=_.find(l.queues,{name:l.queue.queue});t&&(l.queue[_.capitalize("chat")+"QueueId"]=t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),n=null;if(l.queue&&(n=_.find(l.queues,{name:l.queue.queue})),n&&!_.some(t,["id",n.id])){var a=_.find(l.queues,{id:n.id});a.canSelect=!1,t.push(a)}l.queues=t})}else{var n=[],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,n.push(l.queues[i]));l.queues=n}}).catch(function(e){n.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(t,e,n,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"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){t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),n=null;if(l.system&&(n=_.find(l.variables,{name:l.system.variable})),n&&!_.some(t,["id",n.id])){var a=_.find(l.variables,{id:n.id});a.canSelect=!1,t.push(a)}l.variables=t})}else{var n=[],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,n.push(l.variables[i]));l.variables=n}}).catch(function(e){n.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(t,e,n,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"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){t.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 t=_.find(l.tags,{name:l.tag.tag});t&&(l.tag.TagId=t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),n=null;if(l.tag&&(n=_.find(l.tags,{name:l.tag.tag})),n&&!_.some(t,["id",n.id])){var a=_.find(l.tags,{id:n.id});a.canSelect=!1,t.push(a)}l.tags=t})}else{var n=[],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,n.push(l.tags[i]));l.tags=n}}).catch(function(e){n.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(e,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.chatWebsite={},c.chatWebsiteChatCannedAnswers={count:0,rows:[]},c.selectedChatWebsiteChatCannedAnswers=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,key,value,description",limit:10,page:1},c.init=function(e,t){c.chatWebsite=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.chatWebsite.id,c.query.ChatWebsiteId=c.chatWebsite.id,c.getChatWebsiteChatCannedAnswers()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the chatCannedAnswer?").htmlContent("<b>"+(e.name||"chatCannedAnswer")+"</b> will be deleted.").ariaLabel("delete chatCannedAnswer").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getChatWebsiteChatCannedAnswers=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.chatWebsite.getAnswers(c.query,p).$promise},c.createOrEditChatWebsiteChatCannedAnswer=function(e,t){s.show({controller:"CreateOrEditChatCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/chatCannedAnswers/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:c.chatWebsite,chatCannedAnswer:t,chatCannedAnswers:c.chatWebsiteChatCannedAnswers.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedChatWebsiteChatCannedAnswers=function(){var e=angular.copy(c.selectedChatWebsiteChatCannedAnswers);return c.selectedChatWebsiteChatCannedAnswers=[],e},c.deleteChatWebsiteChatCannedAnswer=g,c.deleteSelectedChatWebsiteChatCannedAnswers=function(e){var t=s.confirm().title("Are you sure want to delete the selected chatCannedAnswers?").htmlContent("<b>"+c.selectedChatWebsiteChatCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete chatCannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedChatWebsiteChatCannedAnswers.forEach(function(e){g(e)}),c.selectedChatWebsiteChatCannedAnswers=[]})};var m=!0,u=1;function p(e){c.chatWebsiteChatCannedAnswers=e||{count:0,rows:[]}}function g(e){l.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(c.chatWebsiteChatCannedAnswers.rows,{id:e.id}),c.chatWebsiteChatCannedAnswers.count-=1,c.chatWebsiteChatCannedAnswers.rows.length||c.getChatWebsiteChatCannedAnswers(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETchatWebsite"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getChatWebsiteChatCannedAnswers())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.chat").controller("ChatWebsiteChatCannedAnswersController",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(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),t.params.id&&(g.chatCannedAnswer.ChatWebsiteId=t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.chatCannedAnswers,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The chatCannedAnswer will be deleted.").ariaLabel("Delete ChatCannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.chatWebsite={},c.chatWebsiteChatDispositions={count:0,rows:[]},c.selectedChatWebsiteChatDispositions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,name",limit:10,page:1},c.init=function(e,t){c.chatWebsite=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.chatWebsite.id,c.query.ChatWebsiteId=c.chatWebsite.id,c.getChatWebsiteChatDispositions()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the chatDisposition?").htmlContent("<b>"+(e.name||"chatDisposition")+"</b> will be deleted.").ariaLabel("delete chatDisposition").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getChatWebsiteChatDispositions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.chatWebsite.getDispositions(c.query,p).$promise},c.createOrEditChatWebsiteChatDisposition=function(e,t){s.show({controller:"CreateOrEditChatDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/chatDispositions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:c.chatWebsite,chatDisposition:t,chatDispositions:c.chatWebsiteChatDispositions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedChatWebsiteChatDispositions=function(){var e=angular.copy(c.selectedChatWebsiteChatDispositions);return c.selectedChatWebsiteChatDispositions=[],e},c.deleteChatWebsiteChatDisposition=g,c.deleteSelectedChatWebsiteChatDispositions=function(e){var t=s.confirm().title("Are you sure want to delete the selected chatDispositions?").htmlContent("<b>"+c.selectedChatWebsiteChatDispositions.length+" selected</b> will be deleted.").ariaLabel("delete chatDispositions").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedChatWebsiteChatDispositions.forEach(function(e){g(e)}),c.selectedChatWebsiteChatDispositions=[]})};var m=!0,u=1;function p(e){c.chatWebsiteChatDispositions=e||{count:0,rows:[]}}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){_.remove(c.chatWebsiteChatDispositions.rows,{id:e.id}),c.chatWebsiteChatDispositions.count-=1,c.chatWebsiteChatDispositions.rows.length||c.getChatWebsiteChatDispositions(),r.success({title:"ChatDisposition deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETchatWebsite"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getChatWebsiteChatDispositions())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.chat").controller("ChatWebsiteChatDispositionsController",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(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_CHATDISPOSITION",g.chatDisposition=angular.copy(l),g.chatDispositions=r,g.newChatDisposition=!1,g.chatDisposition||(g.chatDisposition={},g.title="CHAT.NEW_CHATDISPOSITION",g.newChatDisposition=!0),t.params.id&&(g.chatDisposition.ChatWebsiteId=t.params.id),g.addNewChatDisposition=function(){g.errors=[],d.disposition.save(g.chatDisposition).$promise.then(function(e){g.chatDispositions.unshift(e.toJSON()),o.success({title:"ChatDisposition properly created",msg:g.chatDisposition.name?g.chatDisposition.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.disposition.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveChatDisposition=function(){g.errors=[],d.disposition.update({id:g.chatDisposition.id},g.chatDisposition).$promise.then(function(e){var t=_.find(g.chatDispositions,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"ChatDisposition properly saved!",msg:g.chatDisposition.name?g.chatDisposition.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.disposition.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteChatDisposition=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The chatDisposition will be deleted.").ariaLabel("Delete ChatDisposition").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.disposition.delete({id:g.chatDisposition.id}).$promise.then(function(){_.remove(g.chatDispositions,{id:g.chatDisposition.id}),o.success({title:"ChatDisposition properly deleted!",msg:(g.chatDisposition.name||"chatDisposition")+" has been deleted!"}),v(g.chatDisposition)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.disposition.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.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","chatDispositions","chatDisposition","api","Auth","license","setting","crudPermissions"],angular.module("app.chat").controller("CreateOrEditChatDispositionDialogController",e)}(),function(){"use strict";function e(n,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"}],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 t=0;t<e.rows.length;t++)i.customFields.push({key:"cf_"+e.rows[t].id,value:e.rows[t].alias});return a.cmContact.describe().$promise}).then(function(e){for(var t=_.keys(e),n=0;n<t.length;n++)_.includes(i.uselessFields,t[n])||_.startsWith(t[n],"cf_")||i.fields.unshift({key:t[n],value:t[n]});return a.variable.get().$promise}).then(function(e){i.variables=e.rows}).catch(function(e){console.error(e)})},i.up=function(e,t){if(0!==t){var n=i.chatWebsite.offlineForm.items[t-1];i.chatWebsite.offlineForm.items[t]=n,i.chatWebsite.offlineForm.items[t-1]=angular.copy(e),i.chatWebsite.offlineForm.fromKey===t?i.chatWebsite.offlineForm.fromKey--:i.chatWebsite.offlineForm.fromKey===t-1&&i.chatWebsite.offlineForm.fromKey++}},i.down=function(e,t){if(t!==i.chatWebsite.offlineForm.items.length-1){var n=i.chatWebsite.offlineForm.items[t+1];i.chatWebsite.offlineForm.items[t]=n,i.chatWebsite.offlineForm.items[t+1]=angular.copy(e),i.chatWebsite.offlineForm.fromKey===t?i.chatWebsite.offlineForm.fromKey++:i.chatWebsite.offlineForm.fromKey===t+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 t=n.confirm().title("The component will be deleted.").textContent("Are you sure?").ariaLabel("Lucky day").ok("Ok").cancel("Cancel");n.show(t).then(function(){i.chatWebsite.offlineForm.items.splice(e,1)})}}e.$inject=["$mdDialog","$document","api"],angular.module("app.chat").controller("ChatWebsiteofflineFormController",e)}(),function(){"use strict";function e(n,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 t=0;t<e.rows.length;t++)i.customFields.push({key:"cf_"+e.rows[t].id,value:e.rows[t].alias});return a.cmContact.describe().$promise}).then(function(e){for(var t=_.keys(e),n=0;n<t.length;n++)_.includes(i.uselessFields,t[n])||_.startsWith(t[n],"cf_")||i.fields.unshift({key:t[n],value:t[n]});return a.variable.get().$promise}).then(function(e){i.variables=e.rows}).catch(function(e){console.error(e)})},i.up=function(e,t){if(0!==t){var n=i.chatWebsite.onlineForm.items[t-1];i.chatWebsite.onlineForm.items[t]=n,i.chatWebsite.onlineForm.items[t-1]=angular.copy(e),i.chatWebsite.onlineForm.fromKey===t?i.chatWebsite.onlineForm.fromKey--:i.chatWebsite.onlineForm.fromKey===t-1&&i.chatWebsite.onlineForm.fromKey++}},i.down=function(e,t){if(t!==i.chatWebsite.onlineForm.items.length-1){var n=i.chatWebsite.onlineForm.items[t+1];i.chatWebsite.onlineForm.items[t]=n,i.chatWebsite.onlineForm.items[t+1]=angular.copy(e),i.chatWebsite.onlineForm.fromKey===t?i.chatWebsite.onlineForm.fromKey++:i.chatWebsite.onlineForm.fromKey===t+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 t=n.confirm().title("The component will be deleted.").textContent("Are you sure?").ariaLabel("Lucky day").ok("Ok").cancel("Cancel");n.show(t).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)})}}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 t=["png","jpg"];if(!_.includes(t,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+t.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var n={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.chatWebsite.images.unshift(n),!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(t,e){if(t.id===a.uniqueIdentifier){var n=new FileReader;n.readAsDataURL(t.file.file),n.onload=function(e){t.url=e.target.result},t.type="image"}})},i.init=function(e,t){i.chatWebsite=angular.copy(e),i.crudPermissions=void 0!==t?t:{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,t,n,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.chatWebsite={},c.chatWebsiteInteractions={count:0,rows:[]},c.selectedChatWebsiteInteractions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,UserId,ContactId,ChatWebsiteId,id,closedAt,Contact.firstName,Owner.name,disposition,ratingValue,ratingType,note,tag",sort:"-createdAt",includeAll:"true",limit:10,page:1},c.init=function(e,t){c.chatWebsite=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.chatWebsite.id,c.getChatWebsiteInteractions()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.chatInteractionDownload=function(s,e,t){return l.chatInteraction.download({id:s.id,exists:!0,attachments:t}).$promise.then(function(e){var t=[e.buffer],n="interaction"+s.id,a=new Blob(t,{type:e.type});n="chat-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatWebsite.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.success=p,c.getChatWebsiteInteractions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.chatWebsite.getInteractions(c.query,p).$promise},c.createOrEditChatWebsiteInteraction=function(e,t){s.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/interactions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:c.chatWebsite,interaction:t,interactions:c.chatWebsiteInteractions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.spychatInteraction=function(e,n){s.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,t){e.vm.init({id:1,channel:"chat",interaction:n,spy:!0},a.$parent.vm.setting)}})},c.exportSelectedChatWebsiteInteractions=function(){var e=angular.copy(c.selectedChatWebsiteInteractions);return c.selectedChatWebsiteInteractions=[],e},c.deleteChatWebsiteInteraction=g,c.deleteSelectedChatWebsiteInteractions=function(e){var t=s.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+c.selectedChatWebsiteInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedChatWebsiteInteractions.forEach(function(e){g(e)}),c.selectedChatWebsiteInteractions=[]})};var m=!0,u=1;function p(e){c.chatWebsiteInteractions=e||{count:0,rows:[]}}function g(e){l.chatInteraction.delete({id:e.id}).$promise.then(function(){_.remove(c.chatWebsiteInteractions.rows,{id:e.id}),c.chatWebsiteInteractions.count-=1,c.chatWebsiteInteractions.rows.length||c.getChatWebsiteInteractions(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETchatWebsite"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}a.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getChatWebsiteInteractions())})}e.$inject=["$cookies","$scope","$state","$q","$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 t=["png","jpg"];if(!_.includes(t,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+t.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var n={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.chatWebsite.images.unshift(n),!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(t,e){if(t.id===a.uniqueIdentifier){var n=new FileReader;n.readAsDataURL(t.file.file),n.onload=function(e){t.url=e.target.result},t.type="image"}})},i.init=function(e,t){i.chatWebsite=angular.copy(e),i.crudPermissions=void 0!==t?t:{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,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.chatWebsite={},c.chatWebsiteOfflineMessages={count:0,rows:[]},c.selectedChatWebsiteOfflineMessages=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,ContactId",sort:"-createdAt",limit:10,page:1},c.init=function(e,t){c.chatWebsite=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.chatWebsite.id,c.getChatWebsiteOfflineMessages()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the offlineMessage?").htmlContent("<b>"+(e.name||"offlineMessage")+"</b> will be deleted.").ariaLabel("delete offlineMessage").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getChatWebsiteOfflineMessages=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.chatWebsite.getOfflineMessages(c.query,p).$promise},c.createOrEditChatWebsiteOfflineMessage=function(e,t){s.show({controller:"CreateOrEditOfflineMessageDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/offlineMessages/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:c.chatWebsite,offlineMessage:t,offlineMessages:c.chatWebsiteOfflineMessages.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.showOfflineMessageChatWebsiteOfflineMessage=function(e,n){s.show({controller:"ShowOfflineMessageOfflineMessageDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/offlineMessages/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,resolve:{message:["apiResolver","$stateParams",function(e,t){return e.resolve("chatOfflineMessage@get",{fields:"id,body",id:n.id})}]}})},c.exportSelectedChatWebsiteOfflineMessages=function(){var e=angular.copy(c.selectedChatWebsiteOfflineMessages);return c.selectedChatWebsiteOfflineMessages=[],e},c.deleteChatWebsiteOfflineMessage=g,c.deleteSelectedChatWebsiteOfflineMessages=function(e){var t=s.confirm().title("Are you sure want to delete the selected offlineMessages?").htmlContent("<b>"+c.selectedChatWebsiteOfflineMessages.length+" selected</b> will be deleted.").ariaLabel("delete offlineMessages").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedChatWebsiteOfflineMessages.forEach(function(e){g(e)}),c.selectedChatWebsiteOfflineMessages=[]})},l.cmContact.get({fields:"id,firstName,lastName",nolimit:"true"}).$promise.then(function(e){c.contacts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTACTS",msg:e.data?JSON.stringify(e.data):e.toString()})});var m=!0,u=1;function p(e){c.chatWebsiteOfflineMessages=e||{count:0,rows:[]}}function g(e){l.chatOfflineMessage.delete({id:e.id}).$promise.then(function(){_.remove(c.chatWebsiteOfflineMessages.rows,{id:e.id}),c.chatWebsiteOfflineMessages.count-=1,c.chatWebsiteOfflineMessages.rows.length||c.getChatWebsiteOfflineMessages(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETchatWebsite"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getChatWebsiteOfflineMessages())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.chat").controller("ChatWebsiteOfflineMessagesController",e)}(),function(){"use strict";function e(t,e){this.title="CHAT.OFFLINE_MESSAGE",this.message=e,this.closeDialog=function(e){t.hide(e)}}e.$inject=["$mdDialog","message"],angular.module("app.chat").controller("ShowOfflineMessageOfflineMessageDialogController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.chatWebsite={},c.chatWebsiteProactiveActions={count:0,rows:[]},c.selectedChatWebsiteProactiveActions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,name,type,selector,timeout",limit:10,page:1},c.arraytype=_.keyBy([{option:"MouseOver",value:"'mouseOver'"},{option:"Timeout",value:"'timeout'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.init=function(e,t){c.chatWebsite=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.chatWebsite.id,c.query.ChatWebsiteId=c.chatWebsite.id,c.getChatWebsiteProactiveActions()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the chatProactiveAction?").htmlContent("<b>"+(e.name||"chatProactiveAction")+"</b> will be deleted.").ariaLabel("delete chatProactiveAction").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getChatWebsiteProactiveActions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.chatWebsite.getProactiveActions(c.query,p).$promise},c.createOrEditChatWebsiteChatProactiveAction=function(e,t){s.show({controller:"CreateOrEditChatProactiveActionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/proactive/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:c.chatWebsite,chatProactiveAction:t,proactive:c.chatWebsiteProactiveActions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedChatWebsiteProactiveActions=function(){var e=angular.copy(c.selectedChatWebsiteProactiveActions);return c.selectedChatWebsiteProactiveActions=[],e},c.deleteChatWebsiteChatProactiveAction=g,c.deleteSelectedChatWebsiteProactiveActions=function(e){var t=s.confirm().title("Are you sure want to delete the selected proactive?").htmlContent("<b>"+c.selectedChatWebsiteProactiveActions.length+" selected</b> will be deleted.").ariaLabel("delete proactive").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedChatWebsiteProactiveActions.forEach(function(e){g(e)}),c.selectedChatWebsiteProactiveActions=[]})};var m=!0,u=1;function p(e){c.chatWebsiteProactiveActions=e||{count:0,rows:[]}}function g(e){l.chatProactiveAction.delete({id:e.id}).$promise.then(function(){_.remove(c.chatWebsiteProactiveActions.rows,{id:e.id}),c.chatWebsiteProactiveActions.count-=1,c.chatWebsiteProactiveActions.rows.length||c.getChatWebsiteProactiveActions(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETchatWebsite"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getChatWebsiteProactiveActions())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.chat").controller("ChatWebsiteProactiveActionsController",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(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),t.params.id&&(g.chatProactiveAction.ChatWebsiteId=t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.proactive,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The chatProactiveAction will be deleted.").ariaLabel("Delete ChatProactiveAction").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=this;t.chatWebsite={},t.init=function(e){t.chatWebsite=e,t.start="\n\x3c!-- START Motion Chat Script --\x3e",t.script='\n    <script src="'+t.chatWebsite.remote+"/api/chat/websites/"+t.chatWebsite.id+"/snippet?token="+t.chatWebsite.token+'"><\/script>',t.end="\n\x3c!-- START Motion Chat Script --\x3e"},t.info={},e.$watch("vm_ac.chatWebsite.remote",function(e){t.script='\n    <script src="'+t.chatWebsite.remote+"/api/chat/websites/"+t.chatWebsite.id+"/snippet?token="+t.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 t=["png","jpg"];if(!_.includes(t,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+t.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var n={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.chatWebsite.images.unshift(n),!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(t,e){if(t.id===a.uniqueIdentifier){var n=new FileReader;n.readAsDataURL(t.file.file),n.onload=function(e){t.url=e.target.result},t.type="image"}})},i.init=function(e,t){i.chatWebsite=angular.copy(e),i.crudPermissions=void 0!==t?t:{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,t,n,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=t.protocol()+"://"+t.host(),u.chatWebsite=c||e.params.chatWebsite||{},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.agentadddialog=function(e,t){n.show({controller:"ChatWebsiteagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{chatWebsite:e,chatWebsites:u.chatWebsites?u.chatWebsites.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoChatWebsites=function(){e.go("app.chat.chatWebsites")},u.saveChatWebsite=function(){r.chatWebsite.update({id:u.chatWebsite.id},u.chatWebsite).$promise.then(function(){l.success({title:"ChatWebsite updated!",msg:u.chatWebsite.name?u.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){u.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){u.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.lists,{id:e.resourceId})}),n=null;if(u.chatWebsite&&(n=_.find(u.lists,{id:Number(u.chatWebsite.ListId)})),n&&!_.some(t,["id",n.id])){var a=_.find(u.lists,{id:n.id});a.canSelect=!1,t.push(a)}u.lists=t})}else{var n=[],a=null;u.chatWebsite&&(a=_.find(u.lists,{id:Number(u.chatWebsite.ListId)}));for(var i=0;i<u.lists.length;i++)a&&u.lists[i].id===a.id&&(u.lists[i].canSelect=!1,n.push(u.lists[i]));u.lists=n}}).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){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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.interval,{id:e.resourceId})}),n=null;if(u.chatWebsite&&(n=_.find(u.interval,{id:Number(u.chatWebsite.IntervalId)})),n&&!_.some(t,["id",n.id])){var a=_.find(u.interval,{id:n.id});a.canSelect=!1,t.push(a)}u.interval=t})}else{var n=[],a=null;u.chatWebsite&&(a=_.find(u.interval,{id:Number(u.chatWebsite.IntervalId)}));for(var i=0;i<u.interval.length;i++)a&&u.interval[i].id===a.id&&(u.interval[i].canSelect=!1,n.push(u.interval[i]));u.interval=n}}).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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.pauses,{id:e.resourceId})});u.pauses.forEach(function(e){_.some(t,["id",e.id])||(e.canSelect=!1),t.push(e)}),u.pauses=t})}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","chatWebsite","userProfileSection"],angular.module("app.chat").controller("ChatWebsiteController",e)}(),function(){"use strict";function e(e,o,t,n,a,i,s,r,l,d,c,m,u,p,g,v,h,f){var b=this,E=["userpic","online","lastLoginAt","lastPauseAt","pauseType","lastPauseAt","internal","address","chatPause","openchannelPause","mailPause","smsPause","faxPause","voicePause","chatCapacity","openchannelCapacity","mailCapacity","smsCapacity","faxCapacity","chatCurrentCapacity","openchannelCurrentCapacity","mailCurrentCapacity","smsCurrentCapacity","faxCurrentCapacity","chatStatus","openchannelStatus","mailStatus","smsStatus","faxStatus","voiceStatus","chatStatusTime","openchannelStatusTime","mailStatusTime","smsStatusTime","faxStatusTime","voiceStatusTime","queue","destconnectedlinenum","onhold"],A=["chatPause","openchannelPause","mailPause","smsPause","faxPause","voicePause","online"];for(var y in b.currentUser=v.getCurrentUser(),b.availableStates=["ringing","inuse","busy","onhold","not_inuse"],b.pauses=s||{count:0,rows:[]},b.license=h,b.userProfile=p,b.userProfileSection=g&&1==g.count?g.rows[0]:null,b.crudPermissions=v.parseCrudPermissions(b.userProfileSection?b.userProfileSection.crudPermissions:null),b.agents=r?_.keyBy(r.rows?r.rows:[],"id"):{},b.rpcAgents=l?_.keyBy(l.rows?l.rows:[],"id"):{},b.paginatedAgents={},b.load=!1,b.order=[],b.agentInternal={},b.agents)b.agents.hasOwnProperty(y)&&(b.agents[y].init=!0);b.query={limit:10,page:1,order:"fullname",globalStatusFilter:"",pauseTypeFilter:""},b.logout=function(e,t){return d.user.logout({id:e.id,device:"realtime",agent_id:e.id,agent_name:e.name}).$promise.then(function(){m.success({title:"Agent logout",msg:e.fullname+"  properly logout"}),b.agents[e.id]&&(b.agents[e.id].online=!1),b.rpcAgents[e.id]&&(b.rpcAgents[e.id].online=!1),T()}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.queueAdd=function(e,t){n.show({controller:"AgentqueueaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/queueadd/queueadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{agent:e,agents:[],channel:"chat",direction:"inbound",crudPermissions:b.crudPermissions}})},b.pause=function(t,e){return d.user.pause({id:t.id,type:e}).$promise.then(function(e){b.agents[t.id]&&_.merge(b.agents[t.id],_.pick(e,E)),b.rpcAgents[t.id]&&_.merge(b.rpcAgents[t.id],_.pick(e,E)),O(b.agents[t.id])}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.unPause=function(t){return d.user.unpause({id:t.id}).$promise.then(function(e){b.agents[t.id]&&_.merge(b.agents[t.id],_.pick(e,E)),b.rpcAgents[t.id]&&_.merge(b.rpcAgents[t.id],_.pick(e,E)),O(b.agents[t.id])}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.showInfo=function(e){n.show(n.alert().clickOutsideToClose(!0).title("Legend").htmlContent("<div>TODO legend status + state</div>").ok("Ok").targetEvent(e))},b.getAgentStatus=w,b.getAgentGlobalStatus=O,b.isPause=I,b.checkPause=function(e){return"pause"===e},b.isPartialPause=function(e){return"*pause"===e},b.onSave=function(e){b.agents[e.id]&&(_.merge(b.agents[e.id],_.pick(_.omit(e,A),E)),_.merge(b.rpcAgents[e.id],_.pick(_.omit(e,A),E)),O(b.agents[e.id]))},b.onUpdate=function(e){b.agents[e.id]&&(_.merge(b.agents[e.id],_.pick(e,E)),_.merge(b.rpcAgents[e.id],_.pick(e,E)),e.lastPauseAt&&(b.agents[e.id].globalStatusTime=e.lastPauseAt,b.rpcAgents[e.id].globalStatusTime=e.lastPauseAt),O(b.agents[e.id]))},b.onInit=T,b.onConnect=function(e){b.agents[b.agentInternal[e.destaccountcode]]&&(_.merge(b.agents[b.agentInternal[e.destaccountcode]],_.pick(e,["queue","destconnectedlinenum"])),_.merge(b.rpcAgents[b.agentInternal[e.destaccountcode]],_.pick(e,["queue","destconnectedlinenum"])))},b.onComplete=function(e){b.agents[b.agentInternal[e.destaccountcode]]&&(b.agents[b.agentInternal[e.destaccountcode]]=_.omit(b.agents[b.agentInternal[e.destaccountcode]],["queue","destconnectedlinenum"]),b.rpcAgents[b.agentInternal[e.destaccountcode]]=_.omit(b.rpcAgents[b.agentInternal[e.destaccountcode]],["queue","destconnectedlinenum"]))},c.on("user:save",b.onSave),c.on("user:update",b.onUpdate),c.on("user:agentconnect",b.onConnect),c.on("user:agentcomplete",b.onComplete),T();var S=f(function(){b.load&&(b.load=!1,T())},999);function T(e){b.load=!1;var t,n,a=o.defer();b.promise=a.promise,b.filteredAgents=[],b.order=[],_.forIn(b.agents,function(e,t){b.rpcAgents[t]&&_.merge(e,_.pick(_.omit(b.rpcAgents[t],A),E)),O(e),e.online?(b.filteredAgents.push(e),b.agentInternal[e.internal]=t):e.globalStatusTime=_.toNumber(moment().format("x"))}),b.query.globalStatusFilter&&_.remove(b.filteredAgents,function(e){return e.globalStatus!==b.query.globalStatusFilter}),b.query.pauseTypeFilter&&_.remove(b.filteredAgents,function(e){return e.pauseType!==b.query.pauseTypeFilter}),b.query.filter&&_.remove(b.filteredAgents,function(e){return e.fullname.toLowerCase().indexOf(b.query.filter.toLowerCase())<0}),b.filteredAgents=(t=b.filteredAgents,n=_.startsWith(b.query.order,"-")?"desc":"asc",_.orderBy(t,[b.query.order.replace("-","")],[n]));var i=(b.query.page-1)*b.query.limit;b.paginatedAgents=_.drop(b.filteredAgents,i).slice(0,b.query.limit);for(var s=0;s<b.paginatedAgents.length;s+=1)b.order.push(b.paginatedAgents[s].id);a.resolve(),b.load=!0}function I(e){return"pause"===e||"*pause"===e}function C(e){return"idle"===e||"unknown"===e||"unavailable"===e||"ringing"===e||_.isNil(e)}function w(e,t){return"voice"===t?"idle"!==e[t+"Status"]?e[t+"Status"]:e[t+"Pause"]?e[t+"Status"]="pause":"idle":e[t+"Pause"]?e[t+"Status"]="pause":e[t+"Status"]}function O(e){var t="unknown";t=_.every([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],I)?"pause":_.some([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],I)?"*pause":_.every([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],C)?"idle":"busy",e.globalStatus!==t&&(e.globalStatus=t,e.init?(e.init=!1,e.globalStatusTime=I(t)?_.toNumber(moment(e.lastPauseAt).format("x")):_.max([e.voiceStatusTime,e.chatStatusTime,e.mailStatusTime,e.smsStatusTime,e.openchannelStatusTime,e.faxStatusTime])):e.globalStatusTime=_.toNumber(moment().format("x")))}e.$on("$destroy",function(){c.removeAllListeners("user:save"),c.removeAllListeners("user:update"),c.removeAllListeners("user:agentconnect"),c.removeAllListeners("user:agentcomplete"),S&&(f.cancel(S),S=null)})}e.$inject=["$scope","$q","$timeout","$mdDialog","$document","$filter","pauses","agents","rpcAgents","api","socket","toasty","helperClasses","userProfile","userProfileSection","Auth","license","$interval"],angular.module("app.voice").controller("AgentsChatRealtimeController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this,v=["loggedIn","available","waiting","talking","pTalking","originated","message","dialActive","dialMethod","Trunk","paused"];function h(){var n=[];return _.forIn(g.queues,function(e,t){e.paused=0,e.loggedInDb=0,g.queues[t].agents={},n.push(l.chatQueue.getMembers({id:t}).$promise),g.rpcQueues[t]&&_.merge(e,_.pick(g.rpcQueues[t],v))}),t.all(n).then(function(e){for(var t=0;t<e.length;t+=1)for(var n=0;n<e[t].rows.length;n++)e[t].rows[n].paused&&g.queues[e[t].rows[n].ChatQueueId].paused++,g.queues[e[t].rows[n].ChatQueueId].loggedInDb++,g.queues[e[t].rows[n].ChatQueueId].agents[e[t].rows[n].UserId]=e[t].rows[n].ChatQueueId}).catch(function(e){console.error(e)})}g.currentUser=p.getCurrentUser(),g.count=o.count?o.count:0,g.queues=o?_.keyBy(o.rows?o.rows:[],"id"):{},g.rpcQueues=r?_.keyBy(r.rows?r.rows:[],"id"):{},g.userProfile=m,g.userProfileSection=u&&1==u.count?u.rows[0]:null,g.crudPermissions=p.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),p.hasRole("admin")?g.query={type:"inbound",sort:"-updatedAt",limit:10,page:1}:g.query={id:g.currentUser.id,channel:"chat",type:"inbound",sort:"-updatedAt",limit:10,page:1},g.success=E,g.getQueues=function(){g.query.offset=(g.query.page-1)*g.query.limit,p.hasRole("admin")?g.promise=l.chatQueue.get(g.query,E).$promise:(g.query.id=g.userProfile.id,g.query.section="ChatQueues",g.promise=l.userProfile.getResources(g.query,E).$promise)},g.createOrEditChatQueue=function(e,t){a.show({controller:"CreateOrEditChatQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatQueue:t,chatQueues:_.values(g.queues),license:null,setting:null,crudPermissions:g.crudPermissions}})},g.agentAdd=function(e,t){a.show({controller:"ChatQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatQueue:t,chatQueues:g.queues?g.queues.rows:[],realtime:!1,crudPermissions:g.crudPermissions}})},g.updateQueue=function(e){return l.chatQueue.update(e).$promise.then(function(){c.success({title:"Queue properly updated!",msg:e.name?e.name+" has been updated!":""})}).catch(function(e){c.error({title:"Error creating queue!",msg:e.message})})},g.onSave=function(e){g.queues[e.id]&&_.merge(g.queues[e.id],_.pick(e,v))},g.onSaveMember=function(e){g.queues[e.ChatQueueId]&&g.queues[e.ChatQueueId].loggedInDb++},g.onRemoveMember=function(e){g.queues[e.ChatQueueId]&&g.queues[e.ChatQueueId].loggedInDb--},g.onPause=function(n){console.log("onPause",n),n.voicePause?_.forIn(g.queues,function(e,t){e.agents[n.id]&&(e.paused+=1,console.log("pause"))}):n.voicePause||_.forIn(g.queues,function(e,t){e.agents[n.id]&&0<e.paused&&(e.paused-=1,console.log("unpause"))})},g.onLogin=function(e){console.log("onLogged",e),g.queues[e.ChatQueueId]&&(g.queues[e.ChatQueueId].loggedInDb+=1,g.queues[e.ChatQueueId].agents[e.UserId]=e.ChatQueueId)},g.onLogout=function(e){console.log("onLogout",e),g.queues[e.ChatQueueId]&&0<g.queues[e.ChatQueueId].loggedInDb&&(g.queues[e.ChatQueueId].loggedInDb-=1,delete g.queues[e.ChatQueueId].agents[e.UserId])},g.$onInit=h,g.order=[],_.forIn(g.queues,function(e,t){g.order.push(e.id)}),d.on("chat_queue:save",g.onSave),d.on("userChatQueue:save",g.onSaveMember),d.on("userChatQueue:remove",g.onRemoveMember),d.on("user:update",g.onPause),d.on("userVoiceQueue:remove",g.onLogout),d.on("userVoiceQueue:save",g.onLogin);var f=!0,b=1;function E(e){if(g.count=e.count,g.queues=e?_.keyBy(e.rows?e.rows:[],"id"):{},e.rows){g.order=[];for(var t=0;t<e.rows.length;t++)g.order.push(e.rows[t].id)}h()}e.$watch("vm.query.filter",function(e,t){f?n(function(){f=!1}):(t||(b=g.query.page),e!==t&&(g.query.page=1),e||(g.query.page=b),g.getQueues())}),e.$on("$destroy",function(){d.removeAllListeners("chat_queue:save"),d.removeAllListeners("userChatQueue:remove"),d.removeAllListeners("userChatQueue:save"),d.removeAllListeners("user:update"),d.removeAllListeners("userVoiceQueue:remove"),d.removeAllListeners("userVoiceQueue:save")})}e.$inject=["$scope","$timeout","$mdDialog","$q","$document","$interval","queues","rpcQueues","api","socket","toasty","userProfile","userProfileSection","Auth"],angular.module("app.chat").controller("QueuesChatRealtimeController",e)}(),function(){"use strict";angular.module("app.auth").factory("helperClasses",function(){return{status:{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"},state:{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"},channelStatus:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},channelStatusOut:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"}}})}(),function(){"use strict";function e(e,n,t){switch(t.disconnect(),t.connect(),this.selectedTab=0,n.current.name){case"app.chat.realtime.agents":this.selectedTab=0;break;case"app.chat.realtime.queues":this.selectedTab=1;break;default:this.selectedTab=0,n.go("app.chat.realtime.agents")}e.$watch("vm.selectedTab",function(e,t){if(e!==t)switch(e){case 0:n.go("app.chat.realtime.agents");break;case 1:n.go("app.chat.realtime.queues");break;default:n.go("app.chat.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.chat").controller("ChatRealtimeController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.companies=l||{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="companies",b.listOrder="",b.listOrderAsc=null,b.selectedCompanies=[],b.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},b.editstate=function(e,t){a.go("app.contactmanager.companies.edit",{id:e.id,company:e,crudPermissions:b.crudPermissions})},b.gotocontactsgoto=function(n,e){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:303}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?a.go("app.contactmanager.contacts",{CompanyId:n.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:n.id})}},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getCompanies=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.cmCompany.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Companies",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditCompany=function(e,t){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:t,companies:b.companies.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteCompany=S,b.exportSelectedCompanies=function(){var e=angular.copy(b.selectedCompanies);return b.selectedCompanies=[],e},b.deleteSelectedCompanies=function(e){var t=i.confirm().title("Are you sure want to delete the selected companies?").htmlContent("<b>"+b.selectedCompanies.length+" selected</b> will be deleted.").ariaLabel("delete Companys").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedCompanies.forEach(function(e){S(e)}),b.selectedCompanies=[]})},b.deselectCompanies=function(){b.selectedCompanies=[]},b.selectAllCompanies=function(){b.selectedCompanies=b.companies.rows};var E=!0,A=1;function y(e){b.companies=e||{count:0,rows:[]}}function S(e){m.cmCompany.delete({id:e.id}).$promise.then(function(){_.remove(b.companies.rows,{id:e.id}),b.companies.count-=1,b.companies.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcmCompany"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getCompanies())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","companies","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.contactmanager").controller("CompaniesController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.companies,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The company will be deleted.").ariaLabel("Delete Company").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,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(n,e){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:303}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?a.go("app.contactmanager.contacts",{CompanyId:n.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:n.id})}},u.alert=l.info,u.gotoCompanies=function(){a.go("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(t,i,n,a,e,s,o,r,l,d,c,m,u,p,g,v,h,f,b){var E=this;E.currentUser=f.getCurrentUser(),E.license=b,E.userProfile=r,E.userProfileSection=l&&1==l.count?l.rows[0]:null,E.crudPermissions=f.parseCrudPermissions(E.userProfileSection?E.userProfileSection.crudPermissions:null);var A=60,y=1024*A*1024;E.ngFlowOptions={target:"api/cm/contacts/upload",singleFile:!0,maxChunkRetries:1,chunkSize:y,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},E.contacts=c||{count:0,rows:[]},E.options={hidden:!1,hover:!1,isOpen:!1},E.table="cm_contacts",E.selectedContacts=[],E.lists=m||{rows:[],count:0},E.companies=p||{rows:[],count:0},E.tags=v||{rows:[],count:0},E.listsMap=u,E.companiesMap=g,E.selectedTags=[],E.selectedList=null,E.selectedCompany=null,E.query=_.merge({includeAll:!0,sort:"-updatedAt",limit:10,offset:0,page:1},e),E.editdialog=function(e,t){a.go("app.contactmanager.contacts.edit",{id:e.id,crudPermissions:E.crudPermissions})},E.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){C(e)})},E.success=I,E.getContacts=function(){E.query.offset=(E.query.page-1)*E.query.limit,f.hasRole("admin")?E.promise=d.cmContact.get(E.query,I).$promise:(E.query.id=E.userProfile.id,E.query.section="Contacts",E.promise=d.userProfile.getResources(E.query,I).$promise)},E.getAssignedCompanies=function(){if(!f.hasRole("admin")){var e=_(E.contacts.rows).map(function(e){return{id:e.CompanyId}}).uniqBy("id").pullAllBy(E.companies.rows,"id").value();if(!_.isEmpty(e)){for(var t=[],n=0;n<e.length;n++)t.push(d.cmCompany.get({id:e[n].id,fields:"id,name"}).$promise);o.all(t).then(function(e){e.forEach(function(e){var t=e.toJSON();t.canSelect=!1,E.companies.rows.push(t);var n={};n[t.id]=t.name,E.companiesMap=_.assignIn(E.companiesMap,n)})}).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()})})}}},E.mergeContact=function(e,t){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:t.id})}],lists:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",nolimit:!0})}]},locals:{contacts:E.contacts.rows}})},E.duplicateContact=function(e,t){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:t.id})}],lists:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",nolimit:!0})}]},locals:{contacts:E.contacts.rows}})},E.createOrEditContact=function(e,t){t&&t.dateOfBirth&&(t.dateOfBirth=new Date(t.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:E.query.ListId||a.params.ListId,CompanyId:E.query.CompanyId||a.params.CompanyId,contact:t,contacts:E.contacts.rows,setting:null,crudPermissions:E.crudPermissions},resolve:{lists:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",nolimit:!0})}],companies:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("cmCompany@get",{fields:"id,name"}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Companies",fields:"id,name"})}]}})},E.deleteContact=C,E.exportSelectedContacts=function(){var e=angular.copy(E.selectedContacts);return E.selectedContacts=[],e},E.deleteSelectedContacts=function(e){var t=s.confirm().title("Are you sure want to delete the selected contacts?").htmlContent("<b>"+E.selectedContacts.length+" selected</b> will be deleted.").ariaLabel("delete Contacts").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){E.selectedContacts.forEach(function(e){C(e)}),E.selectedContacts=[]})},E.deselectContacts=function(){E.selectedContacts=[]},E.selectAllContacts=function(){E.selectedContacts=E.contacts.rows},E.createTag=function(e){var t=s.prompt().title("What would you name your tag?").placeholder("Tag name").ariaLabel("Tag name").targetEvent(e).ok("Ok").cancel("Cancel");return s.show(t).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&&(E.tags.rows.push(e),h.success({title:"Tag properly created!",msg:e.tag?e.name+" has been created!":""}))})},E.createList=function(e){var t=s.prompt().title("What would you name your list?").placeholder("List name").ariaLabel("List name").targetEvent(e).ok("Ok").cancel("Cancel");return s.show(t).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&&(E.lists.rows.push(e),h.success({title:"List properly created!",msg:e.name?e.name+" has been created!":""}))})},E.createCompany=function(e){var t=s.prompt().title("What would you name your company?").placeholder("Company name").ariaLabel("Company name").targetEvent(e).ok("Ok").cancel("Cancel");return s.show(t).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&&(E.companies.rows.push(e),h.success({title:"Company properly created!",msg:e.name?e.name+" has been created!":""}))})},E.importContacts=function(e,t,n){var a=JSON.parse(t);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:E.license}}).then(function(){E.getContacts()}).catch(function(e){console.error()})},E.hasPermission=function(){return f.hasPermission(303)||f.hasRole("admin")},E.fileAdded=function(e){var t=["csv"];if(!_.includes(t,e.getExtension()))return h.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+t.join()}),!1;if(e.size>y)return h.error({title:"File too big",msg:"The max allowed size is "+A+"MB"}),!1;return!0},a.params.ListId&&(E.selectedList=a.params.ListId),a.params.CompanyId&&(E.selectedCompany=a.params.CompanyId),t.$watch("vm.options.isOpen",function(e){e?n(function(){t.tooltipVisible=E.options.isOpen},600):t.tooltipVisible=E.options.isOpen});var S=!0,T=1;function I(e){E.contacts=e||{count:0,rows:[]}}function C(e){d.cmContact.delete({id:e.id}).$promise.then(function(){_.remove(E.contacts.rows,{id:e.id}),E.contacts.count-=1,E.contacts.rows.length||E.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){E.errors=e.data.errors||[{message:e.toString(),type:"api.contact.delete"}];for(var t=0;t<e.data.errors.length;t++)h.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})})}t.$watch("vm.query.filter",function(e,t){S?n(function(){S=!1}):(t||(T=E.query.page),e!==t&&(E.query.page=1),e||(E.query.page=T),E.getContacts())},!0),t.$watch("vm.selectedList",function(e,t){e!==t&&(E.query.ListId=E.selectedList||void 0,E.getContacts())}),t.$watch("vm.selectedCompany",function(e,t){e!==t&&(E.query.CompanyId=E.selectedCompany||void 0,E.getContacts())}),t.$watch("vm.selectedTags",function(e,t){(e.length||t.length)&&E.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(n,a,e,t,i,s,o,r,l,d){var c=this;function m(){n.hide()}c.errors=[],c.title="CONTACTMANAGER.EDIT_CONTACT",c.crudPermissions=d,c.contact=angular.copy(s),c.contacts=e||{rows:[],count:0},c.lists=t||{rows:[],count:0},c.companies=i||{rows:[],count:0},c.customFields={rows:[],count:0},c.newContact=!1,c.contact?(delete c.contact.List,c.ListId=c.contact.ListId||void 0):(c.contact={ListId:o?parseInt(o,10):void 0,CompanyId:r?parseInt(r,10):void 0},c.title="CONTACTMANAGER.NEW_CONTACT",c.newContact=!0),c.addNewContact=function(){c.errors=[],l.cmContact.save(c.contact).$promise.then(function(e){c.contacts.unshift(e),a.success({title:"Contact properly created",msg:c.contact.name?c.contact.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.user.save"}];for(var t=0;t<e.data.errors.length;t++)a.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})})},c.saveContact=function(){c.errors=[],l.cmContact.update({id:c.contact.id},c.contact).$promise.then(function(e){var t=_.find(c.contacts,{id:e.id});t&&_.merge(t,e),a.success({title:"Contact properly saved!",msg:c.contact.name?c.contact.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.contact.update"}];for(var t=0;t<e.data.errors.length;t++)a.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})})},c.deleteContact=function(e){c.errors=[];var t=n.confirm().title("Are you sure?").content("The contact will be deleted.").ariaLabel("Delete Contact").ok("Delete").cancel("Cancel").targetEvent(e);n.show(t).then(function(){l.cmContact.delete({id:c.contact.id}).$promise.then(function(){_.remove(c.contacts,{id:c.contact.id}),a.success({title:"Contact properly deleted!",msg:c.contact.name?c.contact.name+" has been deleted!":""}),m()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.contact.delete"}]})},function(){})},c.closeDialog=m,c.getCustomFields=function(e){{if(e)return l.cmList.getCustomFields({id:e}).$promise.then(function(e){e&&(c.customFields=e)}).catch(function(e){console.error(e)});c.customFields={rows:[],count:0}}},c.getDateFromString=function(e){return null===e?void 0:new Date(e)}}e.$inject=["$mdDialog","toasty","contacts","lists","companies","contact","ListId","CompanyId","api","crudPermissions"],angular.module("app.tools").controller("CreateOrEditContactDialogController",e)}(),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=[],delete o.contact.id,o.contact.tags&&!o.contact.tags.length&&delete o.contact.tags;s.cmContact.save(o.contact).$promise.then(function(e){a.unshift(e),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,t,n,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 t=_.find(d.hoppers,{id:e.id});t&&_.merge(t,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(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f,b,E){var A=this;A.currentUser=b.getCurrentUser(),A.license=f,A.journey=[],A.contact=r||{},A.hoppers=l||{rows:[],count:0},A.finals=d||{rows:[],count:0},A.histories=c||{rows:[],count:0},A.companies=u||{rows:[],count:0},A.lists=p||{rows:[],count:0},A.customFields=g||{rows:[],count:0},A.tags=v||{rows:[],count:0},A.jscriptySessions=h||{rows:[],count:0},A.timelineOptions={scrollEl:"#interaction-content"},A.userProfileSection=E&&1==E.count?E.rows[0]:null,A.crudPermissions=b.parseCrudPermissions(A.userProfileSection?A.userProfileSection.crudPermissions:null),A.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"),"")}),A.queryHopper={fields:"id,phone,scheduledat,priority,recallme,VoiceQueueId,CampaignId,UserId",sort:"-updatedAt",limit:10,page:1},A.queryFinal={fields:"id,uniqueid,calleridnum,statedesc,starttime,disposition",sort:"-id",limit:10,page:1},A.queryHistory={fields:"id,uniqueid,calleridnum,statedesc,scheduledat,starttime,endtime",sort:"-id",limit:10,page:1},A.queryJscriptySession={fields:"id,starttime,endtime,membername,projectname",sort:"-starttime",limit:10,page:1},A.selectedTab=t.params.tab||0,A.onInit=function(){b.hasRole("admin")||(function(){if(!_.some(A.companies.rows,{id:A.contact.CompanyId}))o.cmCompany.get({id:A.contact.CompanyId,fields:"id,name"}).$promise.then(function(e){var t=e.toJSON();t.canSelect=!1,A.companies.rows.push(t)}).catch(function(e){s.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(A.contact.Tags,function(e){return{id:e.id,name:e.name}});if(!_.isEmpty(e))for(var t=0;t<e.length;t++)_.some(A.tags.rows,{id:e.id})||(e[t].canSelect=!1,A.tags.rows.push(e[t]))}());return o.user.get({fields:"id,fullname",nolimit:!0}).$promise.then(function(e){A.users=e||{count:0,rows:[]},A.usersMap=_.mapValues(_.keyBy(A.users.rows,"id"),"fullname"),A.Tags=_.map(A.contact.Tags,"id")}).then(function(e){var t=["mail","chat","sms","openchannel","fax"];if(e&&e.id){for(var n=0;n<t.length;n++)o[t[n]+"Interaction"].get({ContactId:e.id,includeAll:!0}).$promise.then(I);o.voiceCallReport.get({fields:"id,uniqueid,type,source,destination,callerid,starttime,endtime,duration,disposition,amaflags,note,UserId,ContactId",ContactId:e.id,includeAll:!0}).$promise.then(I).catch(function(e){console.error(e)})}}(r))},A.gotoContacts=function(){t.go("app.contactmanager.contacts",{},{reload:!0,notify:!0})},A.duplicateContact=function(e){i.show({controller:"DuplicateContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,resolve:{lists:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name"}):e.resolve("userProfile@getResources",{id:A.currentUser.userProfileId,section:"Lists",fields:"id,name"})}]},locals:{contacts:m.rows,contact:r}})},A.saveContact=function(){o.cmContact.update({id:A.contact.id},A.contact).$promise.then(function(){s.success({title:"Contact updated!",msg:A.contact.name?A.contact.name+" has been updated!":""})}).then(function(){return o.cmContact.setTags({id:A.contact.id,ids:A.Tags}).$promise}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEcontact",msg:e.data?JSON.stringify(e.data):e.toString()})})},A.editCompany=function(e,t){var n=_.find(A.companies.rows,{id:t});i.show({controller:"CreateOrEditCompanyDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/companies/create/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{companies:[],license:null,setting:null,crudPermissions:!1===n.canSelect?{readOnly:!0,canEdit:!1,canDelete:!1}:o.userProfileSection.get({userProfileId:A.currentUser.userProfileId,sectionId:302}).$promise.then(function(e){var t=e.rows?e.rows[0]:null;return b.parseCrudPermissions(t?t.crudPermissions:null)}).catch(function(e){s.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:t})}]}})},A.onSelectList=function(e){if(A.contact.ListId){var t=i.confirm().title("You are selecting the list number: "+A.contact.ListId).textContent("Warning! You won't select a different list for the contact "+A.contact.firstName||A.contact.lastName||A.contact.id).targetEvent(e).ok("Ok").cancel("Cancel");return i.show(t).then(A.onSelectListSuccess).catch(function(){A.contact.ListId=null})}},A.onSelectListSuccess=function(){return o.cmList.getCustomFields({id:A.contact.ListId}).$promise.then(function(e){A.customFields=e||{rows:[],count:0}}).catch(function(e){console.error(e)})},A.getDateFromString=function(e){return null===e?void 0:new Date(e)},A.getHoppers=function(){A.queryHopper.offset=(A.queryHopper.page-1)*A.queryHopper.limit,A.queryHopper.id=A.contact.id,A.promise=o.cmContact.getHoppers(A.queryHopper,T("hoppers")).$promise},A.getFinals=function(){A.queryFinal.offset=(A.queryFinal.page-1)*A.queryFinal.limit,A.queryFinal.id=A.contact.id,A.promise=o.cmContact.getHopperFinals(A.queryFinal,T("finals")).$promise},A.getHistories=function(){A.queryHistory.offset=(A.queryHistory.page-1)*A.queryHistory.limit,A.queryHistory.id=A.contact.id,A.promise=o.cmContact.getHopperHistories(A.queryHistory,T("histories")).$promise},A.getJscriptySessions=function(){A.queryJscriptySession.offset=(A.queryJscriptySession.page-1)*A.queryJscriptySession.limit,A.queryJscriptySession.id=A.contact.id,A.promise=o.cmContact.getJscriptySessions(A.queryJscriptySession,T("jscriptySessions")).$promise},A.deleteconfirm=function(t,e){var n=i.confirm().title("Are you sure want to delete the agent?").htmlContent("<b>"+(t.phone||"hopper")+"</b> will be deleted.").ariaLabel("delete hopper").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){var e;e=t,o.cmHopper.delete({id:e.id}).$promise.then(function(){_.remove(A.hoppers.rows,{id:e.id}),A.hoppers.count--,A.hoppers.rows.length||A.getHoppers(),s.success({title:"Hopper deleted!",msg:e.phone?e.phone+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEhopper",msg:e.data?JSON.stringify(e.data):e.toString()})})},function(){console.log("CANCEL")})},A.editHopper=function(e,t){i.show({controller:"CreateOrEditHopperVoiceQueueIdDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hoppers/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{hopper:t,hoppers:A.hoppers.rows,license:null,setting:null,crudPermissions:A.crudPermissions}})},A.createOrEditIvrCampaignHopper=function(e,t){i.show({controller:"CreateOrEditHopperCampaignIdDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/hoppers/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{hopper:t,hoppers:A.hoppers.rows,license:null,setting:null,crudPermissions:A.crudPermissions}})},A.getColorByItem=function(e){var t="";e.FaxAccountId?t="fax":e.OpenchannelAccountId?t="openchannel":e.SmsAccountId?t="sms":e.MailAccountId?t="mail":e.ChatWebsiteId?t="chat":e.amaflags&&(t="voice");return 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";default:return"blue-A700"}}(t)};var y=!0,S=1;function T(t){return function(e){A[t]=e||{count:0,rows:[]}}}function I(e){e&&e.count&&e.rows.length&&(A.journey=_.concat(A.journey,e.rows))}e.$watch("vm.queryHopper.filter",function(e,t){y?n(function(){y=!1}):(t||(S=A.queryHopper.page),e!==t&&(A.queryHopper.page=1),e||(A.queryHopper.page=S),A.getHoppers())}),e.$watch("vm.queryFinal.filter",function(e,t){y?n(function(){y=!1}):(t||(S=A.queryFinal.page),e!==t&&(A.queryFinal.page=1),e||(A.queryFinal.page=S),A.getFinals())}),e.$watch("vm.queryHistory.filter",function(e,t){y?n(function(){y=!1}):(t||(S=A.queryHistory.page),e!==t&&(A.queryHistory.page=1),e||(A.queryHistory.page=S),A.getHistories())})}e.$inject=["$scope","$timeout","$state","$document","$mdDialog","toasty","api","contact","hoppers","finals","histories","contacts","companies","lists","customFields","tags","jscriptySessions","license","Auth","userProfileSection"],angular.module("app.contactmanager.contacts").controller("ContactController",e)}(),function(){"use strict";function e(e,t,n,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}],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),t.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=[],t=0;t<g.result.errors.length;t+=1){var n=g.result.errors[t].row;n.contact_import_error=g.result.errors[t].message,e.push(n)}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(n){i(function(){if(g.result.rows=n.rows,n.errors)for(var e=0;e<n.errors.length;e++)g.result.errors.push(n.errors[e]);if(n.finish){g.result.finish=!0,g.result.affectedRows=n.affectedRows,g.result.failedRows=g.result.errors.length;var t=g.result.rows-g.result.affectedRows-g.result.errors.length;t&&0<t&&(g.duplicates.length?g.result.duplicatedRows=t:g.result.failedRows+=t),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(i,e,s,t,o,n,r){var a=this;a.errors=[],a.title="CONTACTMANAGER.MERGE_CONTACT",a.contact=angular.copy(t),a.lists=n||[],a.change=function(){a.searchTerm?r.cmContact.get({fields:"id,firstName,lastName,phone,email",filter:a.searchTerm,ListId:t.ListId}).$promise.then(function(e){a.contacts=e.rows}).catch(function(e){console.error(e)}):a.contacts=[]},a.showConfirm=function(e,t,n){var a=i.confirm({skipHide:!0}).title("Would you like to merge your contacs?").textContent("All unfilled values of the contact #"+n.id+" will be overwritten by the fields of the contact #"+t.id+".").targetEvent(e).ok("Ok").cancel("Cancel");i.show(a).then(function(){return r.cmContact.merge({to:n.id,from:t.id}).$promise}).then(function(e){i.hide({new:e,to:n,from:t}),_.remove(o,{id:n.id}),_.remove(o,{id:t.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,t,n,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){n.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"},g.title="CONTACTMANAGER.NEW_GLOBALCUSTOMFIELD",g.newGlobalCustomField=!0),a.$watch("vm.globalCustomField.type",function(e,t){if(e!==t)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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.globalCustomFields,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=n.confirm().title("Are you sure?").content("The globalCustomField will be deleted.").ariaLabel("Delete GlobalCustomField").ok("Delete").cancel("Cancel").targetEvent(e);n.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){e.splice(t,1),a.globalCustomFieldForm.$pristine=!1},g.removeItems=function(e){for(var t=e.length,n=0;n<t;n++)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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.globalCustomFields=l||{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="globalCustomFields",b.listOrder="",b.listOrderAsc=null,b.selectedGlobalCustomFields=[],b.query={fields:"createdAt,updatedAt,id,alias,type,values,required",sort:"-updatedAt",ListId:"null",limit:10,page:1},b.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"),"")}),b.editdialog=function(e,t){i.show({controller:"CreateOrEditGlobalCustomFieldDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/globalCustomFields/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{globalCustomField:e,globalCustomFields:b.globalCustomFields.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getGlobalCustomFields=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.cmCustomField.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="GlobalCustomFields",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditGlobalCustomField=function(e,t){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:t,globalCustomFields:b.globalCustomFields.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteGlobalCustomField=S,b.exportSelectedGlobalCustomFields=function(){var e=angular.copy(b.selectedGlobalCustomFields);return b.selectedGlobalCustomFields=[],e},b.deleteSelectedGlobalCustomFields=function(e){var t=i.confirm().title("Are you sure want to delete the selected globalCustomFields?").htmlContent("<b>"+b.selectedGlobalCustomFields.length+" selected</b> will be deleted.").ariaLabel("delete GlobalCustomFields").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedGlobalCustomFields.forEach(function(e){S(e)}),b.selectedGlobalCustomFields=[]})},b.deselectGlobalCustomFields=function(){b.selectedGlobalCustomFields=[]},b.selectAllGlobalCustomFields=function(){b.selectedGlobalCustomFields=b.globalCustomFields.rows};var E=!0,A=1;function y(e){b.globalCustomFields=e||{count:0,rows:[]}}function S(e){m.cmCustomField.delete({id:e.id}).$promise.then(function(){_.remove(b.globalCustomFields.rows,{id:e.id}),b.globalCustomFields.count-=1,b.globalCustomFields.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcmCustomField"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getGlobalCustomFields())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","globalCustomFields","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.contactmanager").controller("GlobalCustomFieldsController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.lists,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The list will be deleted.").ariaLabel("Delete List").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,o,r,l,d){var c=this;function m(){return a(function(n,t){return a(function(t,n){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.cmList.getAgents({id:c.list.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return t.penalty=e.UserList?"penalty "+e.UserList.penalty:"",t.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=l.getCurrentUser(),c.list=t,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(n,t){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.cmList.removeAgents({id:c.list.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.cmList.addAgents({id:c.list.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,items:[],selectedItems:[],showSelectAndDeselectAll:!o,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("CONTACTMANAGER.ALL_AGENTS"),labelSelected:r.instant("CONTACTMANAGER.SELECTED_AGENTS"),transferCallback:function(e,t){var n=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(n)}}}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,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.list={},c.listCustomFields={count:0,rows:[]},c.selectedListCustomFields=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,alias,type,values,required",limit:10,page:1},c.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"),"")}),c.init=function(e,t){c.list=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.list.id,c.query.ListId=c.list.id,c.getListCustomFields()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the customField?").htmlContent("<b>"+(e.name||"customField")+"</b> will be deleted.").ariaLabel("delete customField").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getListCustomFields=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.cmList.getCustomFields(c.query,p).$promise},c.createOrEditListCustomField=function(e,t){s.show({controller:"CreateOrEditCustomFieldDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/lists/edit/customFields/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{list:c.list,customField:t,customFields:c.listCustomFields.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedListCustomFields=function(){var e=angular.copy(c.selectedListCustomFields);return c.selectedListCustomFields=[],e},c.deleteListCustomField=g,c.deleteSelectedListCustomFields=function(e){var t=s.confirm().title("Are you sure want to delete the selected customFields?").htmlContent("<b>"+c.selectedListCustomFields.length+" selected</b> will be deleted.").ariaLabel("delete customFields").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedListCustomFields.forEach(function(e){g(e)}),c.selectedListCustomFields=[]})};var m=!0,u=1;function p(e){c.listCustomFields=e||{count:0,rows:[]}}function g(e){l.cmCustomField.delete({id:e.id}).$promise.then(function(){_.remove(c.listCustomFields.rows,{id:e.id}),c.listCustomFields.count-=1,c.listCustomFields.rows.length||c.getListCustomFields(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcmList"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcmList",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getListCustomFields())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.contactmanager").controller("ListCustomFieldsController",e)}(),function(){"use strict";function e(a,e,t,n,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){n.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"},g.title="CONTACTMANAGER.NEW_CUSTOMFIELD",g.newCustomField=!0),e.params.id&&(g.customField.ListId=e.params.id),a.$watch("vm.customField.type",function(e,t){if(e!==t)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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.customFields,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=n.confirm().title("Are you sure?").content("The customField will be deleted.").ariaLabel("Delete CustomField").ok("Delete").cancel("Cancel").targetEvent(e);n.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){e.splice(t,1),a.customFieldForm.$pristine=!1},g.removeItems=function(e){for(var t=e.length,n=0;n<t;n++)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,n,i,s,t,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=t,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(n,e){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:303}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?a.go("app.contactmanager.contacts",{ListId:n.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:n.id})}},u.agentadddialog=function(e,t){n.show({controller:"ListagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/lists/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:t,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")},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,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.list={},c.listVoiceDispositions={count:0,rows:[]},c.selectedListVoiceDispositions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,name",limit:10,page:1},c.init=function(e,t){c.list=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.list.id,c.query.ListId=c.list.id,c.getListVoiceDispositions()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the voiceDisposition?").htmlContent("<b>"+(e.name||"voiceDisposition")+"</b> will be deleted.").ariaLabel("delete voiceDisposition").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getListVoiceDispositions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.cmList.getDispositions(c.query,p).$promise},c.createOrEditListVoiceDisposition=function(e,t){s.show({controller:"CreateOrEditVoiceDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/lists/edit/voiceDispositions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{list:c.list,voiceDisposition:t,voiceDispositions:c.listVoiceDispositions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedListVoiceDispositions=function(){var e=angular.copy(c.selectedListVoiceDispositions);return c.selectedListVoiceDispositions=[],e},c.deleteListVoiceDisposition=g,c.deleteSelectedListVoiceDispositions=function(e){var t=s.confirm().title("Are you sure want to delete the selected voiceDispositions?").htmlContent("<b>"+c.selectedListVoiceDispositions.length+" selected</b> will be deleted.").ariaLabel("delete voiceDispositions").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedListVoiceDispositions.forEach(function(e){g(e)}),c.selectedListVoiceDispositions=[]})};var m=!0,u=1;function p(e){c.listVoiceDispositions=e||{count:0,rows:[]}}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){_.remove(c.listVoiceDispositions.rows,{id:e.id}),c.listVoiceDispositions.count-=1,c.listVoiceDispositions.rows.length||c.getListVoiceDispositions(),r.success({title:"VoiceDisposition deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcmList"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcmList",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getListVoiceDispositions())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.contactmanager").controller("ListVoiceDispositionsController",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(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_VOICEDISPOSITION",g.voiceDisposition=angular.copy(l),g.voiceDispositions=r,g.newVoiceDisposition=!1,g.voiceDisposition||(g.voiceDisposition={},g.title="CONTACTMANAGER.NEW_VOICEDISPOSITION",g.newVoiceDisposition=!0),t.params.id&&(g.voiceDisposition.ListId=t.params.id),g.addNewVoiceDisposition=function(){g.errors=[],d.disposition.save(g.voiceDisposition).$promise.then(function(e){g.voiceDispositions.unshift(e.toJSON()),o.success({title:"VoiceDisposition properly created",msg:g.voiceDisposition.name?g.voiceDisposition.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.disposition.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveVoiceDisposition=function(){g.errors=[],d.disposition.update({id:g.voiceDisposition.id},g.voiceDisposition).$promise.then(function(e){var t=_.find(g.voiceDispositions,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"VoiceDisposition properly saved!",msg:g.voiceDisposition.name?g.voiceDisposition.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.disposition.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteVoiceDisposition=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The voiceDisposition will be deleted.").ariaLabel("Delete VoiceDisposition").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.disposition.delete({id:g.voiceDisposition.id}).$promise.then(function(){_.remove(g.voiceDispositions,{id:g.voiceDisposition.id}),o.success({title:"VoiceDisposition properly deleted!",msg:(g.voiceDisposition.name||"voiceDisposition")+" has been deleted!"}),v(g.voiceDisposition)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.disposition.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.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","voiceDispositions","voiceDisposition","api","Auth","license","setting","crudPermissions"],angular.module("app.contactmanager").controller("CreateOrEditVoiceDispositionDialogController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.lists=l||{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="lists",b.listOrder="",b.listOrderAsc=null,b.selectedLists=[],b.query={fields:"createdAt,updatedAt,id,name,description,dialPrefix",sort:"-updatedAt",limit:10,page:1},b.editstate=function(e,t){a.go("app.contactmanager.lists.edit",{id:e.id,list:e,crudPermissions:b.crudPermissions})},b.gotocontactsgoto=function(n,e){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:303}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?a.go("app.contactmanager.contacts",{ListId:n.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:n.id})}},b.exportcsvcontactsexport=function(i,e){return m.cmList.getContactsCsv({id:i.id,nolimit:!0}).$promise.then(function(e){if(void 0!==e.length){var t=[e.buffer],n=new Blob(t,{type:e.type}),a=window.document.createElement("a");a.setAttribute("href",URL.createObjectURL(n)),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()})})},b.agentadddialog=function(e,t){i.show({controller:"ListagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/lists/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{list:e,lists:b.lists?b.lists.rows:[],crudPermissions:b.crudPermissions,realtime:!1}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getLists=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.cmList.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Lists",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditList=function(e,t){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:t,lists:b.lists.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteList=S,b.exportSelectedLists=function(){var e=angular.copy(b.selectedLists);return b.selectedLists=[],e},b.deleteSelectedLists=function(e){var t=i.confirm().title("Are you sure want to delete the selected lists?").htmlContent("<b>"+b.selectedLists.length+" selected</b> will be deleted.").ariaLabel("delete Lists").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedLists.forEach(function(e){S(e)}),b.selectedLists=[]})},b.deselectLists=function(){b.selectedLists=[]},b.selectAllLists=function(){b.selectedLists=b.lists.rows};var E=!0,A=1;function y(e){b.lists=e||{count:0,rows:[]}}function S(e){m.cmList.delete({id:e.id}).$promise.then(function(){_.remove(b.lists.rows,{id:e.id}),b.lists.count-=1,b.lists.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcmList"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getLists())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","lists","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.contactmanager").controller("ListsController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l){var d=this;d.currentUser=s.getCurrentUser(),d.userProfile=r,d.userProfileSection=l&&1==l.count?l.rows[0]:null,d.crudPermissions=s.parseCrudPermissions(d.userProfileSection?d.userProfileSection.crudPermissions:null),d.customDashboard={},d.voiceQueues=o&&o.count?o:{count:0,rows:[]},d.voiceQueuesSelected=o&&o.count?_.map(o.rows,"id"):[],d.interval=t(function(){},1e3),d.onChangeVoiceQueues=function(){for(var e=0;e<d.customDashboard.widgets.length;e+=1)d.customDashboard.widgets[e].voiceQueuesSelected=d.voiceQueuesSelected},d.goToEdit=function(){e.go("app.tools.customDashboards.edit",{id:d.customDashboard.id,tab:1})},i.onWithoutApply("voice_queue:save",function(e){var t=_.find(d.voiceQueues.rows,{id:e.id});t&&_.merge(t,_.pick(e,_.keys(t)))}),a.dashboard.get({id:e.params.id}).$promise.then(function(e){if(e)return d.customDashboard=e,d.customDashboard.widgets=[],d.customDashboard.preview=!0,d.customDashboard.draggable={enabled:!1},d.customDashboard.resizable={enabled:!1},a.dashboard.getItems({id:d.customDashboard.id}).$promise}).then(function(e){if(e&&e.count&&e.rows)for(var t=0;t<e.rows.length;t+=1)e.rows[t].templateUrl="app/core/directives/ms-widget-engine/ms-widget-engine-"+e.rows[t].type+"/ms-widget-engine."+e.rows[t].type+".html",e.rows[t].voiceQueues=d.voiceQueues,e.rows[t].voiceQueuesSelected=d.voiceQueuesSelected,d.customDashboard.widgets.push(e.rows[t])}).catch(function(e){d.customDashboard=void 0}),n.$on("$destroy",function(){i.removeAllListeners("voice_queue:save"),d.interval&&t.cancel(d.interval)})}e.$inject=["$state","$interval","$scope","api","socket","Auth","voiceQueues","userProfile","userProfileSection"],angular.module("app.dashboards.custom").controller("DashboardCustomController",e)}(),function(){"use strict";function e(e,a,i,o,s,t,l,n,r,d,c,m,u,p,g,v,h){var f=this;f.license=p,f.setting=g;function b(e){var t={};for(var n in f.tabs)f.tabs.hasOwnProperty(n)&&(t[n]=f.tabs[n],f.tabs[n].interaction&&(t[n].interaction=_.pick(f.tabs[n].interaction,["id","OpenchannelAccountId","MailAccountId","ChatWebsiteId","FaxAccountId","SmsAccountId","closed","draft"])));i.localStorage.setItem("motion2.user:"+f.user.id,JSON.stringify({tabs:t,currentTab:f.currentTab})),E(e)}function E(e){if(_.isNil(e)||e&&"interaction"===e.type){var t={id:f.user.id,online:!0,capacity:{mail:0,fax:0,sms:0,openchannel:0,chat:0},interaction:{mail:[],fax:[],sms:[],openchannel:[],chat:[]}};for(var n in f.tabs)f.tabs.hasOwnProperty(n)&&t.capacity.hasOwnProperty(f.tabs[n].channel)&&f.tabs[n].interaction&&!f.tabs[n].interaction.closed&&(t.capacity[f.tabs[n].channel]+=1,t.interaction[f.tabs[n].channel].push(f.tabs[n].interaction.id));if(!_.isEqual(f.agentCapacity,t.capacity))return f.agentCapacity=t.capacity,l.rpc.setAgentCapacity(t)}}function A(t){if(f.tabs[t.id]&&(function(e){if(e.channel&&e.interaction)l.user["remove"+_.upperFirst(e.channel)+"Interactions"]({id:f.user.id,ids:[e.interaction.id]}).$promise.catch(function(e){console.error(e)})}(f.tabs[t.id]),delete f.tabs[t.id],f.currentTab=0,b(t),"interaction"===t.type))return l[t.channel+"Interaction"].get({id:t.interaction.id}).$promise.then(function(e){return l.user["remove"+_.upperFirst(t.channel)+"Interactions"]({id:f.user.id,ids:[e.id]}).$promise}).catch(function(e){console.error(e)})}function y(e){e.id=_.random(1e10),e.openedAt=new Date,e.saved=!1,e.badges=0,f.tabs[e.id]=e,f.currentTab=e.id,b(e)}function S(t,n){var e={type:"interaction",title:t?t.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";default:return"icon-hangouts"}}(t),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";default:return"grey"}}(t),channel:t,interaction:n},a=_.find(f.tabs,function(e){return"interaction"===e.type&&e.interaction&&e.interaction.id===n.id&&e.channel===t});a?f.currentTab=a.id:y(e)}function T(e){e&&e.uniqueid&&f.notifications[e.uniqueid]&&(r.clear(f.notifications[e.uniqueid]),delete f.notifications[e.uniqueid])}function I(e,t){return 0<=t&&(e.calls[t].disposedAt=new Date,n.removeAllListeners("voice_queue_channel:remove"),n.removeAllListeners("voice_outbound_channel:remove"),!0)}function C(){return function(e){if(404===e.status)r.warning({title:o.instant("DASHBOARDS.ATTENTION"),msg:o.instant("DASHBOARDS.ACCEPT_ELSEWHERE")});else if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelMessage.accept"}];for(var t=0;t<e.data.errors.length;t+=1)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelMessage.accept",msg:e.data?JSON.stringify(e.data.message):e.toString()})}}f.detectBrowser=h.detectBrowser(),f.user=t.getCurrentUser(),f.currentTab=0,f.notifications={},f.tabs={},f.agentCapacity={},f.globalUserLists=d||{count:0,rows:[]},f.globalLists=c||{count:0,rows:[]},f.globalCompanies=m||{count:0,rows:[]},f.globalTags=u||{count:0,rows:[]},f.onContactManager=function(t){var e={ListId:t.ListId,limit:1,offset:0,sort:"-updatedAt"},n=!1,a=t.calleridname&&"<unknown>"!==t.calleridname?t.calleridname:t.calleridnum||t.uniqueid,i=t.calleridnum;_.isNil(t["xmd-contactid"])?_.isNil(t.routeId)?e.phone=t.calleridnum:(e.phone=t.destcalleridnum,a=t.destcalleridname&&"<unknown>"!==t.destcalleridname?t.destcalleridname:t.destcalleridnum||t.uniqueid,i=t.destcalleridnum):(e.id=t["xmd-contactid"],n=!0,_.isNil(t["xmd-listid"])||parseInt(t["xmd-listid"],10)===t.ListId||t["xmd-contactid2"]&&(e.id=t["xmd-contactid2"]));return l.cmContact.get(e).$promise.then(function(e){n?e&&f.addContactTab(e,t):e.count&&e.rows[0]?f.addContactTab(e.rows[0],t):f.addContactTab({firstName:a,ListId:t.ListId,phone:i},t)}).catch(C())},f.onJscripty=function(n){return l.jscriptyProject.get({id:n.ProjectId}).$promise.then(function(t){if(t){if(!_.isUndefined(n["xmd-contactid"]))return l.cmContact.get({id:n["xmd-contactid"]}).$promise.then(function(e){try{t.formData=Mustache.render(t.formData,_.merge(n,{user:f.user,contact:e}))}catch(e){console.error(e)}y({type:"jscripty",title:t.name,icon:"icon-script",color:"grey",project:t,call:n,contact:e})}).catch(C());try{t.formData=Mustache.render(t.formData,_.merge(n,{user:f.user}))}catch(e){console.error(e)}y({type:"jscripty",title:t.name,icon:"icon-script",color:"grey",project:t,call:n})}}).catch(C())},f.onBot=function(t){var n=t.calleridname&&"<unknown>"!==t.calleridname?t.calleridname:t.calleridnum,a=t.calleridnum;return l.squareMessage.get({fields:"id",limit:1,offset:0,uniqueid:t.uniqueid}).$promise.then(function(e){e.count&&y({type:"bot",title:n+" <"+a+">",icon:"fas fa-robot",color:"pink",data:{uniqueid:t.uniqueid}})})},f.onBrowserUrl=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;default:i.open(e.uri)}else i.open(e.uri)},f.onBrowserPopup=function(e){e&&e.html&&y({type:"popup",title:e.calleridnum||"popup",icon:"icon-tablet",color:"grey",html:e.html})},f.onNotificationSave=function(e){if(e&&e.uniqueid){n=e,v.isSupported()?v.requestPermission().then(function(){var e,t;t={autoClose:!0,duration:10,showOnPageHidden:!0,icon:"../../../../../../../assets/images/avatars/customer.png",body:(e=n).queue?"Queue: "+e.queue:"",focusOnclick:!0,closeOnClick:!0},v.show(e.title,t)},function(e){console.error("Please enable browser notifications!",e)}):console.error("Browser notifications are not supported by the browser. Normal notifications will be used.");var t=f.alreadyExistsTab(e);if(t){if(l[e.channel+"Message"])return f.currentTab!==t.id&&(t.badges+=1),l[e.channel+"Message"].accept({id:e.id,UserId:f.user.id}).$promise.catch(C())}else r.wait({title:e.title,msg:e.msg||"",showClose:!1,clickToClose:!1,timeout:!1,sound:e.sound,html:!0,shake:e.shake||!1,onAdd:function(){f.notifications[e.uniqueid]=this.id},onAccept:function(){if(T(e),l[e.channel+"Message"])return l[e.channel+"Message"].accept({id:e.id,UserId:f.user.id,manual:!0}).$promise.then(function(e){S(e.channel,e.interaction),r.success({title:"Message properly accepted!",msg:"Message has been accepted!"})}).catch(C())},onReject:function(){if(T(e),l[e.channel+"Message"])return l[e.channel+"Message"].reject({id:e.id,UserId:f.user.id}).$promise.then(function(e){r.success({title:"Message properly rejected!",msg:"Message has been rejected!"})}).catch(C())}})}var n},f.onNotificationRemove=T,f.onVoiceChannelRemove=function(t){var e=f.currentTab?f.tabs[f.currentTab]:null;e||(e=_.find(f.tabs,{calls:[{uniqueid:t.uniqueid}]}));var n=_.findLastIndex(e.calls,function(e){return e.uniqueid===t.uniqueid});if(!I(e,n)){var a=_.find(f.tabs,{calls:[{uniqueid:t.uniqueid}]});if(a){var i=_.findLastIndex(a.calls,function(e){return e.uniqueid===t.uniqueid});I(a,i)}}f.contact&&f.contact.id&&$timeout((s=t.uniqueid,o=f.contact.id,r=e,function(){var e=_.find(r.calls,function(e){return e.uniqueid===s});if(e)return l.voiceCallReport.update({id:s,ContactId:o}).$promise.catch(function(e){console.error(e)})}),1e3);var s,o,r},f.onClickTab=function(e){f.currentTab=e,b(f.tabs[e])},f.isActiveTab=function(e){return e===f.currentTab},f.alreadyExistsTab=function(t){return _.find(f.tabs,function(e){return"interaction"===e.type&&e.interaction&&e.interaction.id==t.interactionId&&e.channel==t.channel})},f.addContactTab=function(t,n){var a={type:"contact",title:t?function(e){var t="";e&&(e.firstName||e.lastName?(e.firstName&&(t+=e.firstName+" "),e.lastName&&(t+=e.lastName)):e.phone&&(t=e.phone));return t}(t):o.instant("DASHBOARDS.NEW_CONTACT"),icon:"icon-account-circle",color:"red",contact:t,userLists:d,lists:c,companies:m,tags:u,calls:n?[n]:[],autoCreate:n?n.autoCreate:0};if(n){if(n["xmd-cdrtype"]&&"dialer"===n["xmd-cdrtype"])n.answeredAt=n.agentcalledAt?moment(n.agentcalledAt,"YYYY-MM-DD HH:mm:ss").toDate():new Date;else if(n.uniqueid){var e=n.uniqueid.split(".")[0];n.answeredAt=e?new Date(1e3*parseInt(e)):new Date}(n.agentcompleteAt||n.endtime)&&(n.disposedAt=new Date)}if(t){var i=_.find(f.tabs,function(e){return e.contact&&e.contact.id?"contact"===e.type&&e.contact&&e.contact.id==t.id:"contact"===e.type&&e.contact&&e.contact.phone==t.phone});if(i){if(n)if(i.calls){var s=_.find(i.calls,function(e){return e.uniqueid===n.uniqueid});s||i.calls.push(n)}else i.calls=[n];f.currentTab=i.id}else{if(t.ListId)return l.disposition.get({ListId:t.ListId}).$promise.then(function(e){return a.dispositions=e,l.cmList.getCustomFields({id:t.ListId}).$promise}).then(function(e){a.customFields=e}).catch(C()).finally(function(){y(a)});y(a)}}else y(a)},f.addInteractionTab=S,f.addTab=y,f.removeTab=A,f.updateLocalStorage=b,f.closeTab=function(e){var t=a.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)return a.show(t).then(function(){"interaction"===e.type&&a.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!0,locals:{user:f.user,channel:e.channel,interaction:e.interaction}}),A(e)}).catch(function(){"interaction"===e.type&&A(e)});var n=!1;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.",a.show(t).then(function(){A(e)});alert=a.alert().title("Warning").textContent("There is a call that hasn't been disposed yet.").ok("OK"),a.show(alert).finally(function(){alert=void 0})}else A(e)}},n.on("trigger:contactmanager",f.onContactManager),n.on("trigger:jscripty",f.onJscripty),n.on("trigger:bot",f.onBot),n.on("trigger:browser:url",f.onBrowserUrl),n.on("trigger:browser:popup",f.onBrowserPopup),n.on("notification:save",f.onNotificationSave),n.on("notification:remove",f.onNotificationRemove),function(){var e=i.localStorage.getItem("motion2.user:"+f.user.id);if(e)try{e=JSON.parse(e),f.tabs=e.tabs?e.tabs:{},f.currentTab=e.currentTab?e.currentTab:0,E(f.tabs[f.currentTab])}catch(e){console.error(e)}}(),e.$on("$destroy",function(){for(var e in f.notifications)f.notifications.hasOwnProperty(e)&&T({uniqueid:e});n.removeAllListeners("trigger:contactmanager"),n.removeAllListeners("trigger:jscripty"),n.removeAllListeners("trigger:browser:url"),n.removeAllListeners("trigger:browser:popup"),n.removeAllListeners("notification:save"),n.removeAllListeners("notification:remove")})}e.$inject=["$scope","$mdDialog","$window","$translate","$document","Auth","api","socket","toasty","globalUserLists","globalLists","globalCompanies","globalTags","license","setting","desktopNotification","msUtils"],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 t in e)f.hasOwnProperty(t)&&null!=e[t]&&(f[t]=e[t])},$get:["$q","$timeout","$window","PERMISSIONS",function(e,u,t,p){var g=t.Notification||t.mozNotification||t.webkitNotification;return{isSupported:v,currentPermission:h,requestPermission:function(){if(!v())return e.reject("Notification API not supported");var n=e.defer();Promise.resolve(g.requestPermission)==g.requestPermission?g.requestPermission().then(function(e){p.GRANTED===e?n.resolve(e):n.reject(e)}):g.requestPermission(function(e,t){p.GRANTED===e?n.resolve(e):n.reject(e)});return n.promise},show:function(e,t){if(t=t||{},!v()||(n=e,a=t,i=angular.isString(n),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)}(t.showOnPageHidden)||h()!==p.GRANTED)return;var n,a,i,s;var o=new g(e,t),r=t.duration||f.duration,l=void 0===t.autoClose?f.autoClose:t.autoClose;o.onclick=function(){t.onClick&&t.onClick(),t.focusOnclick&&window.focus(),t.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 t(e,t){if(angular.isString(e)){for(var n=e.split("."),a=n[n.length-1],i=function(e){var t=l;if(1===e.length)return t;e.pop();for(var n=0;n<e.length;n++){for(var a=e[n],i=!0,s=0;s<t.length;s++)if(t[s]._id===a){t=t[s].children,i=!1;break}if(i){var o={_id:a,_path:e.join("."),title:a,weight:1,children:[]};t.push(o),t=o.children}}return t}(n),s=!1,o=0;o<i.length;o++)if(i[o]._id===a){s=i[o];break}s?(angular.extend(s,t),s.uisref=d(s)):(t.children=[],!angular.isUndefined(t.weight)&&angular.isNumber(t.weight)||(t.weight=1),t._id=a,t._path=e,t.uisref=d(t),i.push(t))}else r.error("path must be a string (eg. `dashboard.project`)")}function d(e){var t="";return angular.isDefined(e.state)&&(t=e.state,angular.isDefined(e.stateParams)&&angular.isObject(e.stateParams)&&(t=t+"("+angular.toJson(e.stateParams)+")")),t}this.saveItem=t,this.deleteItem=function(e){if(!angular.isString(e))return void r.error("path must be a string (eg. `dashboard.project`)");for(var t=l,n=e.split("."),a=0;a<n.length;a++)for(var i=n[a],s=0;s<t.length;s++)if(t[s]._id===i){if(t[s]._path===e)return t.splice(s,1),!0;t=t[s].children;break}return!1},this.$get=function(){var e={saveItem:t,getNavigation:function(e){if(e){for(var t=0;t<l.length;t++)if(l[t]._id===e)return[l[t]];return null}return l}};return e}}).constant("PERMISSIONS",{DEFAULT:"default",GRANTED:"granted",DENIED:"denied"})}(),function(){"use strict";function e(n){var a=this;a.setting={},a.messages={count:0,rows:[]},a.showInteraction=!1,a.init=function(e,t){{if(a.setting=t,a.tab=e,a.tab.saved=!0,a.tab&&a.tab.data&&a.tab.data.uniqueid)return n.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(o,r,n,l,d,c,t,e,a,i){var m=this;function s(e){e&&e.count&&e.rows.length&&(m.journey=_.concat(m.journey,e.rows))}m.user=t.getCurrentUser(),m.detectBrowser=i.detectBrowser(),m.journey=[],m.queryHopper={fields:"id,phone,scheduledat",sort:"-updatedAt",limit:10,page:1},m.queryFinal={fields:"uniqueid,calleridnum,statedesc,starttime,disposition",sort:"-updatedAt",limit:10,page:1},m.queryHistory={fields:"uniqueid,calleridnum,statedesc,scheduledat,starttime,endtime",sort:"-updatedAt",limit:10,page:1},m.hoppers={rows:[],count:0},m.finals={rows:[],count:0},m.histories={rows:[],count:0},m.addNewContact=function(){m.errors=[],d.cmContact.save(m.contact).$promise.then(function(e){return m.contact.id=e.id,m.newContact=!1,m.tab.title=e.firstName||e.phone,m.tab.contact=m.contact,d.user.addContacts({id:t.getCurrentUser().id,ids:[e.id]})}).then(function(){m.detailForm.$pristine=!0,m.customFieldsForm.$pristine=!0,c.success({title:"Contact properly created",msg:m.contact.firstName?m.contact.firstName+" has been created!":""})}).then(function(){return d.cmContact.setTags({id:m.contact.id,ids:m.tab.Tags}).$promise}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.contact.save"}];for(var t=0;t<e.data.errors.length;t+=1)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contact.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){return m.tab.title=e.firstName||e.phone,m.tab.contact=m.contact,l.$parent.vm.updateLocalStorage(),d.user.addContacts({id:t.getCurrentUser().id,ids:[e.id]})}).then(function(){return d.cmContact.setTags({id:m.contact.id,ids:m.tab.Tags}).$promise}).then(function(){m.detailForm.$pristine=!0,m.customFieldsForm.$pristine=!0,c.success({title:"Contact properly updated!",msg:m.contact.name?m.contact.name+" has been updated!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.contact.save"}];for(var t=0;t<e.data.errors.length;t+=1)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contact.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.getCustomFields=function(e){return d.cmList.getCustomFields({id:e}).$promise.then(function(e){m.tab.customFields=e}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"LIST:GETCustomFields",msg:e.data?JSON.stringify(e.data):e.toString()})})},m.call=l.$parent.vm.call,m.disposeCall=function(e,t){if(m.newContact)return void c.error({title:"ATTENTION",msg:"Please save the contact before disposing!"});o.show({controller:"DisposeCallDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/contact/dispose/dialog.html",parent:angular.element(r.body),targetEvent:t,clickOutsideToClose:!1,resolve:{globalDispositions:["apiResolver",function(e){return e.resolve("disposition@get",{MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null"})}]},locals:{dispositions:m.tab.dispositions,contact:m.contact,call:t}}).then(function(e){e&&("BLACKLIST"===e?c.success({title:a.instant("DASHBOARDS.INFO"),msg:a.instant("DASHBOARDS.CALL_DISPOSED")+" "+e}):"RECALLME"===e||"RESCHEDULE"===e||c.success({title:a.instant("DASHBOARDS.INFO"),msg:a.instant("DASHBOARDS.CALL_SAVED")})),_.remove(m.tab.calls,function(e){return e.uniqueid==t.uniqueid})})},m.duplicateContact=function(e){o.show({controller:"DuplicateContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:m.contact.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:t.getCurrentUser().id,fields:"id,name"})}]},locals:{contacts:[]}})},m.mergeContact=function(e){o.show({controller:"MergeContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/merge/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:m.contact.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:t.getCurrentUser().id,fields:"id,name"})}]},locals:{contacts:[]}}).then(function(e){if(e){for(var t in l.$parent.$parent.$parent.vm.tabs)if(l.$parent.$parent.$parent.vm.tabs.hasOwnProperty(t)){var n=l.$parent.$parent.$parent.vm.tabs[t];n&&n.contact&&(e.from&&e.from.id&&e.from.id===n.contact.id&&l.$parent.$parent.$parent.vm.removeTab(n),e.to&&e.to.id&&e.to.id===n.contact.id&&l.$parent.$parent.$parent.vm.removeTab(n))}e.new&&l.$parent.$parent.$parent.vm.addContactTab(e.new)}})},m.getDateFromString=function(e){return null===e?void 0:new Date(e)},m.addJscriptyTab=function(e){try{e.formData=Mustache.render(e.formData,{contact:m.contact,user:m.user})}catch(e){console.error(e)}try{l.$parent.$parent.$parent.vm.addTab({type:"jscripty",title:e.name,icon:"icon-script",color:"grey",project:e,contact:m.contact})}catch(e){c.error({title:"ERROR OPENING JSCRIPTY PROJECT",msg:"The project cannot be started"+JSON.stringify(e)})}},m.getHoppers=function(){m.contact&&m.contact.id&&(m.queryHopper.ContactId=m.contact.id,m.queryHopper.offset=(m.queryHopper.page-1)*m.queryHopper.limit,m.promise=d.cmHopper.get(m.queryHopper,g("hoppers")).$promise)},m.getFinals=function(){m.contact&&m.contact.id&&(m.queryFinal.ContactId=m.contact.id,m.queryFinal.offset=(m.queryFinal.page-1)*m.queryFinal.limit,m.promise=d.cmHopperFinal.get(m.queryFinal,g("finals")).$promise)},m.getHistories=function(){m.contact&&m.contact.id&&(m.queryHistory.ContactId=m.contact.id,m.queryHistory.offset=(m.queryHistory.page-1)*m.queryHistory.limit,m.promise=d.cmHopperHistory.get(m.queryHistory,g("histories")).$promise)},m.getJscriptyProjects=function(){d.jscriptyProject.get({fields:"createdAt,updatedAt,id,name,description,createdAt,formData,enableUncompleteSave",sort:"-updatedAt",nolimit:!0}).$promise.then(function(e){m.jscriptyProjects=e||{count:0,rows:[]}}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.jscripty.account"}];for(var t=0;t<e.data.errors.length;t+=1)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.jscripty.account",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.getMailAccounts=function(){d.user.getMailAccounts({id:m.user.id,nolimit:!0}).$promise.then(function(e){m.mailAccounts=e||{count:0,rows:[]}}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.mail.account"}];for(var t=0;t<e.data.errors.length;t+=1)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mail.account",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.getFaxAccounts=function(){d.user.getFaxAccounts({id:m.user.id,nolimit:!0}).$promise.then(function(e){m.faxAccounts=e||{count:0,rows:[]}}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.fax.account"}];for(var t=0;t<e.data.errors.length;t+=1)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.fax.account",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.getSmsAccounts=function(){d.user.getSmsAccounts({id:m.user.id,nolimit:!0}).$promise.then(function(e){m.smsAccounts=e||{count:0,rows:[]}}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.sms.account"}];for(var t=0;t<e.data.errors.length;t+=1)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.sms.account",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.getOpenchannelAccounts=function(){d.user.getOpenchannelAccounts({id:m.user.id,nolimit:!0}).$promise.then(function(e){m.openchannelAccounts=e||{count:0,rows:[]}}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.sms.account"}];for(var t=0;t<e.data.errors.length;t+=1)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannel.account",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.getChatWebsites=function(){d.user.getChatWebsites({id:m.user.id,nolimit:!0}).$promise.then(function(e){m.chatAccounts=e||{count:0,rows:[]}}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.chatAccounts.account"}];for(var t=0;t<e.data.errors.length;t+=1)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatAccounts.account",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.getLists=function(){d.user.getLists({id:m.user.id,nolimit:!0}).$promise.then(function(e){m.lists=e||{count:0,rows:[]}}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.cm.lists"}];for(var t=0;t<e.data.errors.length;t+=1)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cm.lists",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.composeInteraction=function(e,i,t,n){var s=i.toLowerCase();o.show({controller:"Compose"+i+"InteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose"+i+"/dialog.html",parent:angular.element(r.body),clickOutsideToClose:!1,locals:{account:t,message:{to:"mail"==s?n:n.split(",")},type:"new",interaction:{Contact:m.contact}},fullscreen:!0}).then(function(a){return d[s+"Account"].send({id:t.id},a).$promise.then(function(e){if("Mail"===i){var t=e;if(t&&t.Messages&&t.Messages.length){if(a.attachments&&a.attachments.length)for(var n=0;n<a.attachments.length;n+=1)d.attachment.update({id:a.attachments[n].id},{MailMessageId:_.head(t.Messages).id});c.success({title:"Message properly sent!",msg:"Message has been sent!"}),t.closed?(t.disposition=null,o.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(r.body),clickOutsideToClose:!0,locals:{user:m.user,channel:"mail",interaction:t}})):l.$parent.vm.addInteractionTab("mail",t)}}else c.success({title:"Message properly sent!",msg:"Message has been sent!"}),l.$parent.vm.addInteractionTab(s,e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else"fax"===s?c.error({title:"FAX:SEND",msg:e.data?JSON.stringify(e.data):e.message||e.toString()}):c.error({title:e.status?"API:"+e.status+" - "+e.statusText:i.toUpperCase()+"ACCOUNT:SEND",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})})},m.init=function(e,t){m.tab=e,l.$watchGroup(["vm.detailForm.$pristine","vm.customFieldsForm.$pristine"],function(e){m.tab.saved=e[0]&&e[1]}),m.license=t,m.contact=m.tab.contact,m.newContact=!1,m.currentTab=0,m.contact&&m.contact.id?(d.user.addContacts({id:m.user.id,ids:[m.contact.id]}),m.contact.ListId&&(m.tab.userLists.rows=_.unionBy(m.tab.userLists.rows,_.filter(m.tab.lists.rows,{id:m.contact.ListId}),"id"),m.list=_.find(m.tab.userLists.rows,{id:m.contact.ListId})),m.getHoppers(),m.getFinals(),m.getHistories(),m.getMailAccounts(),m.getFaxAccounts(),m.getSmsAccounts(),m.getOpenchannelAccounts(),m.getChatWebsites(),m.getLists()):(m.newContact=!0,e.autoCreate&&(console.log("autoCreate"),m.addNewContact()));d.user.get({fields:"id,fullname",nolimit:!0}).$promise.then(function(e){m.users=e||{count:0,rows:[]},m.usersMap=_.mapValues(_.keyBy(m.users.rows,"id"),"fullname")}).then(function(){if(m.contact&&m.contact.id)return d.cmContact.getTags({id:m.contact.id}).$promise}).then(function(e){e&&(m.tab.Tags=_.map(e.rows,"id"))}).then(function(e){var t=["mail","chat","sms","openchannel","fax"];if(e&&e.id){for(var n=0;n<t.length;n++)d[t[n]+"Interaction"].get({ContactId:e.id,includeAll:!0}).$promise.then(s);d.voiceCallReport.get({ContactId:e.id,includeAll:!0}).$promise.then(s).catch(function(e){console.error(e)})}}(m.contact))},m.hasPermission=function(e){return t.hasPermission(e)},m.openInteraction=function(e,t){try{if(t.MailAccountId)return l.$parent.$parent.$parent.vm.addInteractionTab("mail",t);if(t.ChatWebsiteId)return l.$parent.$parent.$parent.vm.addInteractionTab("chat",t);if(t.SmsAccountId)return l.$parent.$parent.$parent.vm.addInteractionTab("sms",t);if(t.OpenchannelAccountId)return l.$parent.$parent.$parent.vm.addInteractionTab("openchannel",t);if(t.FaxAccountId)return l.$parent.$parent.$parent.vm.addInteractionTab("fax",t)}catch(e){c.error({title:"ERROR OPEN INTERACTION",msg:"Customer Journey can't open the interaction"})}},m.getColorByItem=function(e){var t="";e.FaxAccountId?t="fax":e.OpenchannelAccountId?t="openchannel":e.SmsAccountId?t="sms":e.MailAccountId?t="mail":e.ChatWebsiteId?t="chat":e.amaflags&&(t="voice");return 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";default:return"blue-A700"}}(t)},m.isMyAccount=function(e){{if(e.FaxAccountId)return _.includes(_.map(m.faxAccounts?m.faxAccounts.rows:[],"id"),e.FaxAccountId);if(e.OpenchannelAccountId)return _.includes(_.map(m.openchannelAccounts?m.openchannelAccounts.rows:[],"id"),e.OpenchannelAccountId);if(e.SmsAccountId)return _.includes(_.map(m.smsAccounts?m.smsAccounts.rows:[],"id"),e.SmsAccountId);if(e.MailAccountId)return _.includes(_.map(m.mailAccounts?m.mailAccounts.rows:[],"id"),e.MailAccountId);if(e.ChatWebsiteId)return _.includes(_.map(m.chatAccounts?m.chatAccounts.rows:[],"id"),e.ChatWebsiteId);if(e.amaflags)return!0}return!1},e.on("voice_queue_channel:remove",l.$parent.vm.onVoiceChannelRemove),e.on("voice_outbound_channel:remove",l.$parent.vm.onVoiceChannelRemove),m.getJscriptyProjects(),l.$watch("currentTab",function(e,t){1===m.currentTab&&(m.getHoppers(),m.getFinals(),m.getHistories())});var u=!0,p=1;function g(t){return function(e){m[t]=e||{count:0,rows:[]}}}l.$watch("queryHopper.filter",function(e,t){u?n(function(){u=!1}):(t||(p=m.queryHopper.page),e!==t&&(m.queryHopper.page=1),e||(m.queryHopper.page=p),m.getHoppers())}),l.$watch("queryFinal.filter",function(e,t){u?n(function(){u=!1}):(t||(p=m.queryFinal.page),e!==t&&(m.queryFinal.page=1),e||(m.queryFinal.page=p),m.getFinals())}),l.$watch("queryHistory.filter",function(e,t){u?n(function(){u=!1}):(t||(p=m.queryHistory.page),e!==t&&(m.queryHistory.page=1),e||(m.queryHistory.page=p),m.getHistories())}),l.$on("$destroy",function(){})}e.$inject=["$mdDialog","$document","$timeout","$scope","api","toasty","Auth","socket","$translate","msUtils"],angular.module("app.dashboards").controller("AgentGeneralContactController",e)}(),function(){"use strict";function e(t,i,s,o,e,n,a,r,l,d){var c=this;function m(){var e=c.choice?c.choice.toLowerCase():void 0;return{id:c.call.uniqueid,disposition:c.choice,dispositionat:moment(),amd:"amd"===e,fax:"fax"===e,blacklist:"blacklist"===e,recallme:"recallme"===e,UserId:"recallme"===e?l.getCurrentUser().id:null,OwnerId:l.getCurrentUser().id}}c.choice=null,c.isReschedule=!1,c.recallme=!1,c.queueCampaigns={count:0,rows:[]},c.queueCampaign=void 0,c.dispositions=e,c.globalDispositions=n,c.contact=r,c.call=a,c.note=c.call.note||void 0,c.dialerCall=!1,c.hasBlackLists=!1,c.hopper={minDate:new Date,dateTime:new Date},c.call&&c.call.variables&&c.call.variables["xmd-voicequeueid"]?(c.dialerCall=!0,o.voiceQueue.getBlackLists({id:c.call.variables["xmd-voicequeueid"]}).$promise.then(function(e){e&&e.rows&&0<e.rows.length&&(c.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()})})):o.user.getQueues({id:l.getCurrentUser().id,fields:"id,name,dialActive",channel:"voice",type:"outbound",nolimit:!0}).$promise.then(function(e){c.queueCampaigns=e||{count:0,rows:[]}}).catch(function(e){console.error(e)}),c.saveDisposition=function(e){c.choice=_.isNil(e)?c.choice:e,c.call.note=c.note,o.user.unpause({id:l.getCurrentUser().id}).$promise.then(function(e){}).catch(function(e){console.error(e)}),o.voiceCallReport.update({id:c.call.uniqueid,userDisposition:c.choice,note:c.note,UserId:l.getCurrentUser().id,ContactId:c.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:c.call.uniqueid}).$promise.then(function(e){if(e)for(var t=0;t<e.rows.length;t+=1)o.voiceRecording.update({id:e.rows[t].id,userDisposition:c.choice}).$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()})}),c.dialerCall&&(o.cmHopperFinal.update(m()).$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(m()).$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(c.choice))t.hide(c.choice?c.choice.toUpperCase():"");else switch(c.choice.toLowerCase()){case"blacklist":c.call&&c.call.variables&&c.call.variables["xmd-voicequeueid"]&&function(e){if(e)o.voiceQueue.getBlackLists({id:e,type:"outbound",fields:"id"}).$promise.then(function(e){var t=[];if(e&&0<e.count){for(var n=0;n<e.rows.length;n+=1){var a=angular.copy(c.contact);delete a.id,a.ListId=e.rows[n].id,t.push(o.cmContact.save(a).$promise)}return i.all(t)}s.success({title:d.instant("DASHBOARDS.INFO"),msg:d.instant("DASHBOARDS.NOTAVAILABLE")+" "+c.choice}),c.choice=void 0}).then(function(e){e&&t.hide(c.choice?c.choice.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()}),t.hide(c.choice?c.choice.toUpperCase():"")})}(c.call.variables["xmd-voicequeueid"]);break;case"reschedule":c.isReschedule=!0,c.recallme=!1;break;case"recallme":c.isReschedule=!0,c.recallme=!0;break;default:t.hide(c.choice?c.choice.toUpperCase():"")}},c.closeDialog=function(){t.cancel()},c.saveReschedule=function(){return c.disable=!0,o.cmHopper.save({phone:c.contact.phone,UserId:c.recallme?l.getCurrentUser().id:null,ContactId:c.contact.id,ListId:c.contact.ListId,VoiceQueueId:c.dialerCall?Number(c.call["xmd-voicequeueid"]):c.queueCampaign?c.queueCampaign.id:null,scheduledat:moment(c.hopper.dateTime).format("YYYY-MM-DD HH:mm:ss"),priority:3,recallme:c.recallme,OwnerId:l.getCurrentUser().id}).$promise.then(function(){c.dialerCall&&o.cmHopperFinal.update({id:c.call.uniqueid,rescheduled:!0,rescheduledat:moment(c.hopper.dateTime).format("YYYY-MM-DD HH:mm:ss"),recallme:c.recallme}).$promise.catch(function(e){console.log(e)})}).then(function(){s.success({title:d.instant("DASHBOARDS.INFO"),msg:d.instant("DASHBOARDS.CALL_DISPOSED")+" "+(c.recallme?d.instant("DASHBOARDS.RECALLME"):d.instant("DASHBOARDS.RESCHEDULE"))})}).catch(function(e){t.hide(c.choice?c.choice.toUpperCase():"")}).finally(function(){c.disable=!1,t.hide(c.choice?c.choice.toUpperCase():"")})}}e.$inject=["$mdDialog","$q","toasty","api","dispositions","globalDispositions","call","contact","Auth","$translate"],angular.module("app.staff").controller("DisposeCallDialogController",e)}(),function(){"use strict";function e(e,t,n,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,t){var n=t(function(){},999);e.$on("$destroy",function(){n&&(t.cancel(n),n=null)})}e.$inject=["$scope","$interval"],angular.module("app.dashboards").controller("AgentHomeAbandonedController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(){var e=i.localStorage.getItem("motion2.home.abandoned.bull.calls:"+m.currentUser.id);e&&(e=JSON.parse(e))&&e.query&&(m.query=_.merge(e.query,_.omit(m.query,["sort","limit","page"])),m.query=_.omit(m.query,"filter")),o.disposition.get({MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null"}).$promise.then(function(e){m.disposition=e?e.rows:[]}).catch(function(e){console.log(e)}),o.user.getQueues({id:r.getCurrentUser().id,fields:"id,name",channel:"voice",type:"outbound",nolimit:!0}).$promise.then(function(e){m.queues=e||{count:0,rows:[]},m.queuesMap=_.mapValues(_.keyBy(m.queues.rows,"name"),"name"),m.defaultQueues=m.queues.rows?_.map(m.queues.rows,"name").join(","):void 0}).catch(function(e){console.error(e)}).finally(function(){m.getAbandonedCalls()})}function p(e){m.abandonedCalls=e||{count:0,rows:[]},!1,m.refresh=!0}m.showTooltip=!1,m.refresh=!0,m.disable=[],m.disposition={count:0,rows:[]},m.currentUser=r.getCurrentUser(),m.localizationMap=c,m.pickerModel={dateStart:null},m.queues={},m.abandonedCalls={count:0,rows:[]},m.query={fields:"id,type,calleridnum,calleridname,queue,queuecallerabandonAt,queuecallerexitAt,queuecallerexitreason,assigned,lastAssignedTo,updatedAt,disposition",type:"outbound",queuecallerexitreason:"TIMEOUT,ABANDONED",sort:"-updatedAt",limit:10,page:1},m.clearAll=function(){m.pickerModel={dateStart:null},m.getAbandonedCalls()},m.getAbandonedCalls=function(){if(m.pickerModel.dateStart){var e=moment(m.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format();m.query.createdAt={$gte:m.pickerModel.dateStart,$lte:e}}else m.query.createdAt=void 0;m.query.queue=m.query.queue||m.defaultQueues,m.query.offset=(m.query.page-1)*m.query.limit,i.localStorage.setItem("motion2.home.abandoned.bull.calls:"+m.currentUser.id,JSON.stringify({query:_.omit(m.query,"queue")})),m.promise=o.voiceQueueReport.getVoiceQueuesReport(m.query,p).$promise},m.refreshAbandonedCalls=function(){m.showTooltip=!1,m.getAbandonedCalls()},m.onInit=u,m.reserved=function(e,t){e&&(m.disable[e.id]=!0,o.voiceQueueReport.update({id:e.id,lastAssignedTo:e.assigned?m.currentUser.name:null,assigned:e.assigned,disposition:t||null}).$promise.catch(function(e){console.log(e)}).finally(function(){m.disable[e.id]=!1}))},m.onSavevoiceQueueReport=function(e){m.queuesMap&&"outbound"===e.type&&m.queuesMap[e.queue]&&(m.showTooltip=!0)},m.onUpdatevoiceQueueReport=function(e){if(e){var t=_.findIndex(m.abandonedCalls.rows,["id",e.id]);0<=t&&_.merge(m.abandonedCalls.rows[t],e)}},m.call=e.$parent.$parent.$parent.$parent.vm.call,m.transfer=e.$parent.$parent.$parent.$parent.vm.transfer,m.webcall=e.$parent.$parent.$parent.$parent.vm.webcall,m.webtransfer=e.$parent.$parent.$parent.$parent.vm.webtransfer,l.onWithoutApply("voiceQueueReport:save",m.onSavevoiceQueueReport),l.onWithoutApply("voiceQueueReport:update",m.onUpdatevoiceQueueReport),u();var g=!0,v=1;e.$watch("vm_bull.query.filter",function(e,t){g?n(function(){g=!1}):(t||(v=m.query.page),e!==t&&(m.query.page=1),e||(m.query.page=v),m.getAbandonedCalls())}),e.$on("$destroy",function(){l.removeAllListeners("voiceQueueReport:save"),l.removeAllListeners("voiceQueueReport:update")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty","dateFilterLocalizationFactory"],angular.module("app.dashboards").controller("AgentHomeAbandonedBullController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(){var e=i.localStorage.getItem("motion2.home.abandoned.voice.calls:"+m.currentUser.id);e&&(e=JSON.parse(e))&&e.query&&(m.query=_.merge(e.query,_.omit(m.query,["sort","limit","page"])),m.query=_.omit(m.query,"filter")),o.disposition.get({MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null"}).$promise.then(function(e){m.disposition=e?e.rows:[]}).catch(function(e){console.log(e)}),o.user.getQueues({id:r.getCurrentUser().id,fields:"id,name",channel:"voice",type:"inbound",nolimit:!0}).$promise.then(function(e){m.queues=e||{count:0,rows:[]},m.queuesMap=_.mapValues(_.keyBy(m.queues.rows,"name"),"name"),m.defaultQueues=m.queues.rows?_.map(m.queues.rows,"name").join(","):void 0}).catch(function(e){console.error(e)}).finally(function(){m.getAbandonedCalls()})}function p(e){m.abandonedCalls=e||{count:0,rows:[]},!1,m.refresh=!0}m.showTooltip=!1,m.refresh=!0,m.disable=[],m.disposition={count:0,rows:[]},m.currentUser=r.getCurrentUser(),m.localizationMap=c,m.pickerModel={dateStart:null},m.queues={},m.abandonedCalls={count:0,rows:[]},m.query={fields:"id,type,calleridnum,calleridname,queue,queuecallerabandonAt,queuecallerexitAt,queuecallerexitreason,assigned,lastAssignedTo,updatedAt,disposition",type:"inbound",queuecallerexitreason:"TIMEOUT,ABANDONED",sort:"-updatedAt",limit:10,page:1},m.clearAll=function(){m.pickerModel={dateStart:null},m.getAbandonedCalls()},m.getAbandonedCalls=function(){if(m.pickerModel.dateStart){var e=moment(m.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format();m.query.createdAt={$gte:m.pickerModel.dateStart,$lte:e}}else m.query.createdAt=void 0;m.query.queue=m.query.queue||m.defaultQueues,m.query.offset=(m.query.page-1)*m.query.limit,i.localStorage.setItem("motion2.home.abandoned.voice.calls:"+m.currentUser.id,JSON.stringify({query:_.omit(m.query,"queue")})),m.promise=o.voiceQueueReport.getVoiceQueuesReport(m.query,p).$promise},m.refreshAbandonedCalls=function(){m.showTooltip=!1,m.getAbandonedCalls()},m.onInit=u,m.reserved=function(e,t){e&&(m.disable[e.id]=!0,o.voiceQueueReport.update({id:e.id,lastAssignedTo:e.assigned?m.currentUser.name:null,assigned:e.assigned,disposition:t||null}).$promise.catch(function(e){console.log(e)}).finally(function(){m.disable[e.id]=!1}))},m.onSavevoiceQueueReport=function(e){m.queuesMap&&"inbound"===e.type&&m.queuesMap[e.queue]&&(m.showTooltip=!0)},m.onUpdatevoiceQueueReport=function(e){if(e){var t=_.findIndex(m.abandonedCalls.rows,["id",e.id]);0<=t&&_.merge(m.abandonedCalls.rows[t],e)}},m.call=e.$parent.$parent.$parent.$parent.vm.call,m.transfer=e.$parent.$parent.$parent.$parent.vm.transfer,m.webcall=e.$parent.$parent.$parent.$parent.vm.webcall,m.webtransfer=e.$parent.$parent.$parent.$parent.vm.webtransfer,l.onWithoutApply("voiceQueueReport:save",m.onSavevoiceQueueReport),l.onWithoutApply("voiceQueueReport:update",m.onUpdatevoiceQueueReport),u();var g=!0,v=1;e.$watch("vm_voice.query.filter",function(e,t){g?n(function(){g=!1}):(t||(v=m.query.page),e!==t&&(m.query.page=1),e||(m.query.page=v),m.getAbandonedCalls())}),e.$on("$destroy",function(){l.removeAllListeners("voiceQueueReport:save"),l.removeAllListeners("voiceQueueReport:update")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty","dateFilterLocalizationFactory"],angular.module("app.dashboards").controller("AgentHomeAbandonedVoiceController",e)}(),function(){"use strict";function e(t,e,a,n,i,s,o){var r=this;r.user=i.getCurrentUser(),r.license={},r.plugin={},r.setting={},r.sidebar="dashboard",r.navigation=o.getNavigation(),r.addContactTab=t.$parent.vm.addContactTab,r.addInteractionTab=t.$parent.vm.addInteractionTab,r.init=function(e,t){r.license=e,r.setting=t;var n=a.localStorage.getItem("motion2.home:"+r.user.id);if(n)try{n=JSON.parse(n),r.sidebar=n.currentSidebarTab?n.currentSidebarTab:"dashboard"}catch(e){console.error(e),r.sidebar="dashboard"}},r.changeSidebarTab=function(e){r.sidebar=e.view,"plugin"===r.sidebar&&(r.plugin=e.stateParams,r.pluginId=e.id,t.$broadcast("pluginUpdated",{plugin:r.plugin}));a.localStorage.setItem("motion2.home:"+r.user.id,JSON.stringify({currentSidebarTab:e.view}))},r.hasPermission=function(e){return i.hasPermission(e)}}e.$inject=["$scope","$timeout","$window","api","Auth","socket","msNavigationAgentService"],angular.module("app.dashboards").controller("AgentGeneralHomeController",e)}(),function(){"use strict";function e(n,a,e,t,i,s,o,r,l,d,c){var m=this;function u(e){m.chatInteractions=e||{count:0,rows:[]};for(var t=0;t<m.chatInteractions.rows.length;t+=1)g(m.chatInteractions.rows[t])}function p(){if(m.pickerModel.dateStart){var e=moment(m.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format();m.query.createdAt={$gte:m.pickerModel.dateStart,$lte:e}}else m.query.createdAt=void 0;m.chatAccounts.rows.length?(_.includes(_.map(m.chatAccounts.rows,"id"),m.query.account)||(m.query.account=null),m.query.ChatWebsiteId=m.query.account||_.map(m.chatAccounts.rows,"id").join()):m.query.ChatWebsiteId=-1,m.query.offset=(m.query.page-1)*m.query.limit,i.localStorage.setItem("motion2.home.chat:"+m.user.id,JSON.stringify({query:m.query})),m.promise=o.chatInteraction.get(m.query,u).$promise}function g(e){e&&e.Messages?e.unread=_.filter(e.Messages||[],{direction:"in",read:!1}).length:e.unread=0}m.user=r.getCurrentUser(),m.license={},m.setting={},m.tags={count:0,rows:[]},m.chatInteractions={count:0,rows:[]},m.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,account:null},m.success=u,m.getChatInteractions=p,m.showChatInteraction=function(e,t){n.$parent.vm.addInteractionTab("chat",t)},m.downloadChatInteraction=function(e,s,t){o.chatInteraction.download({id:s.id,attachments:t}).$promise.then(function(e){var t=[e.buffer],n="chat-interaction"+s.id+".zip",a=new Blob(t,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)d.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadChatInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.getContactLabel=function(e){if(e.Contact){var t="";t+=(e.Contact.firstName||"")+""+(e.Contact.lastName||"");var n=e.Account?e.Account.mapKey:void 0;return t+=n&&e.Contact[n]?" <"+e.Contact[n]+">":""}return s.instant("DASHBOARDS.UNKNOWN")},m.getUserLabel=function(e){if(e.UserId)return e.UserId===r.getCurrentUser().id?s.instant("DASHBOARDS.ME"):m.usersByKey[e.UserId].fullname+" <"+m.usersByKey[e.UserId].internal+">";return s.instant("DASHBOARDS.NOT_ASSIGNED")},m.getChatWebsiteLabel=function(e){if(e.Account)return e.Account.key;return s.instant("DASHBOARDS.UNKNOWN")},m.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},m.clearAll=function(){m.calendarModel={dateStart:null},m.pickerModel={dateStart:null},m.serviceModel={dateStart:null},m.getChatInteractions()},m.onInit=function(e,t){return m.license=e,m.setting=t,o.user["get"+_.upperFirst("ChatWebsites")]({id:m.user.id,nolimit:!0}).$promise.then(function(e){return m.chatAccounts=e||{count:0,rows:[]},o.tag.get().$promise}).then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){return o.user.get({nolimit:!0,fields:"id,fullname,userpic,internal"}).$promise}).then(function(e){m.usersByKey=_.keyBy(e.rows,"id")}).catch(function(e){console.error(e)}).finally(function(){var e=i.localStorage.getItem("motion2.home.chat:"+m.user.id);if(e)try{(e=JSON.parse(e)).query&&(m.query=_.merge(m.query,e.query),m.query=_.omit(m.query,"filter"),m.query.sort&&0<=m.query.sort.indexOf("lastMessage")&&(m.query=_.omit(m.query,"sort")),m.query.includeAll=!0)}catch(e){console.error(e)}l.on("chatInteraction:save",m.onChatInteractionSave),l.on("chatInteraction:update",m.onChatInteractionSave),l.on("chatInteractionTags:save",m.onChatInteractionTagsSave),l.on("chatMessage:save",m.onChatMessageSave),l.on("chatMessage:update",m.onChatMessageSave),l.on("user_has_chat_interactions:save",m.onChatInteractionOpen),l.on("user_has_chat_interactions:remove",m.onChatInteractionClose),m.getChatInteractions()})},m.onChatInteractionSave=function(e){if(e){var t=_.find(m.chatInteractions.rows,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):p(),g(e)}},m.onChatInteractionTagsSave=function(e){if(e){var t=_.find(m.chatInteractions.rows,{id:e.id});t&&(t.Tags=e.tags||[],_.merge(t,_.pick(e,_.keys(t))))}},m.onChatMessageSave=function(e){if(e&&!e.secret){var t=_.find(m.chatInteractions.rows,{id:e.ChatInteractionId});if(t){var n=_.find(t.Messages,{id:e.id});n?_.merge(n,_.pick(e,_.keys(n))):(_.isNil(t.Messages)&&(t.Messages=[]),t.Messages.push(e)),g(t)}}},m.onChatInteractionOpen=function(e){var t=_.find(m.chatInteractions.rows,{id:e.ChatInteractionId});t&&t.Users&&(_.find(t.Users,{id:e.UserId})||t.Users.push({id:e.UserId}))},m.onChatInteractionClose=function(e){var t=_.find(m.chatInteractions.rows,{id:e.ChatInteractionId});t&&t.Users&&_.remove(t.Users,{id:e.UserId})},m.localizationMap=c,m.pickerModel={dateStart:null};var v=!0,h=1;n.$watch("vm.query.filter",function(e,t){v?a(function(){v=!1}):(t||(h=m.query.page),e!==t&&(m.query.page=1),e||(m.query.page=h),m.getChatInteractions())}),n.$on("$destroy",function(){l.removeAllListeners("chatMessage:save"),l.removeAllListeners("chatMessage:update"),l.removeAllListeners("chatInteraction:save"),l.removeAllListeners("chatInteractionTags:save"),l.removeAllListeners("chatInteraction:update"),l.removeAllListeners("user_has_chat_interactions:save"),l.removeAllListeners("user_has_chat_interactions:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty","dateFilterLocalizationFactory"],angular.module("app.dashboards").controller("AgentHomeChatController",e)}(),function(){"use strict";function e(n,t,a,i,e,s,o,r){var l=this;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.getContacts=function(){l.query.ListId=l.getListId(),l.query.offset=(l.query.page-1)*l.query.limit,r.localStorage.setItem("motion2.home.contacts:"+l.currentUser.id,JSON.stringify({query:l.query})),l.promise=o.cmContact.get(l.query,m).$promise},l.refreshContacts=function(){l.getContacts()},l.mergeContact=function(e,t){i.show({controller:"MergeContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/merge/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:t.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,t){i.show({controller:"DuplicateContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:t.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){t.$parent.vm.addContactTab(e)})},l.call=t.$parent.vm.call,l.onInit=u,l.getListId=function(){var e=_.toString(l.query.ListId);if(e){var t=e.split(","),n=l.defaultLists.split(",");_.isEqual(t,n)||(1<t.length?e=l.defaultLists:_.indexOf(n,t[0])<0&&(e=l.defaultLists))}else e=l.defaultLists;return e},u();var d=!0,c=1;function m(e){l.contacts=e||{count:0,rows:[]}}function u(){var e=r.localStorage.getItem("motion2.home.contacts:"+l.currentUser.id);e&&(e=JSON.parse(e))&&e.query&&(l.query=_.merge(l.query,e.query),l.query=_.omit(l.query,"filter")),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"),l.defaultLists=l.lists.rows?_.map(l.lists.rows,"id").join(","):void 0,o.tag.get().$promise}).then(function(e){l.tags=e||{count:0,rows:[]}}).catch(function(e){console.error(e)}).finally(function(){l.getContacts()})}t.$watch("vm.query.filter",function(e,t){d?a(function(){d=!1}):(t||(c=l.query.page),e!==t&&(l.query.page=1),e||(l.query.page=c),l.getContacts())})}e.$inject=["$document","$scope","$timeout","$mdDialog","$stateParams","Auth","api","$window"],angular.module("app.dashboards").controller("AgentHomeContactsController",e)}(),function(){"use strict";function e(e,t){var n=t(function(){},999);e.$on("$destroy",function(){n&&(t.cancel(n),n=null)})}e.$inject=["$scope","$interval"],angular.module("app.dashboards").controller("AgentHomeDashboardController",e)}(),function(){"use strict";function e(e,n,t,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,t){c.rpcVoiceQueues[t]&&(c.voiceQueues[t].waiting=c.rpcVoiceQueues[t].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,t){p?n(function(){p=!1}):(t||(g=c.query.page),e!==t&&(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,n,t,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,t){c.rpcChatQueues[t]&&(c.chatQueues[t].waiting=c.rpcChatQueues[t].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"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.onSaveVoiceQueue),l.onWithoutApply("chatQueue:update",c.onUpdateVoiceQueue),l.onWithoutApply("chatQueue:remove",c.onRemoveVoiceQueue),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 t=_.filter(e.rows,function(e){return _.includes(c.myQueues,{id:e.queue_id})});e.rows=t,e.count=t.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,t){h?n(function(){h=!1}):(t||(f=c.query.page),e!==t&&(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,n,t,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,t){c.rpcFaxQueues[t]&&(c.faxQueues[t].waiting=c.rpcFaxQueues[t].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"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.onSaveVoiceQueue),l.onWithoutApply("faxQueue:update",c.onUpdateVoiceQueue),l.onWithoutApply("faxQueue:remove",c.onRemoveVoiceQueue),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 t=_.filter(e.rows,function(e){return _.includes(c.myQueues,{id:e.queue_id})});e.rows=t,e.count=t.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,t){h?n(function(){h=!1}):(t||(f=c.query.page),e!==t&&(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,n,t,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,t){c.rpcMailQueues[t]&&(c.mailQueues[t].waiting=c.rpcMailQueues[t].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"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.onSaveVoiceQueue),l.onWithoutApply("mailQueue:update",c.onUpdateVoiceQueue),l.onWithoutApply("mailQueue:remove",c.onRemoveVoiceQueue),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 t=_.filter(e.rows,function(e){return _.includes(c.myQueues,{id:e.queue_id})});e.rows=t,e.count=t.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,t){h?n(function(){h=!1}):(t||(f=c.query.page),e!==t&&(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,n,t,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,t){c.rpcOpenchannelQueues[t]&&(c.openchannelQueues[t].waiting=c.rpcOpenchannelQueues[t].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"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.onSaveVoiceQueue),l.onWithoutApply("openchannelQueue:update",c.onUpdateVoiceQueue),l.onWithoutApply("openchannelQueue:remove",c.onRemoveVoiceQueue),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 t=_.filter(e.rows,function(e){return _.includes(c.myQueues,{id:e.queue_id})});e.rows=t,e.count=t.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,t){h?n(function(){h=!1}):(t||(f=c.query.page),e!==t&&(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,n,t,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,t){c.rpcSmsQueues[t]&&(c.smsQueues[t].waiting=c.rpcSmsQueues[t].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"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.onSaveVoiceQueue),l.onWithoutApply("smsQueue:update",c.onUpdateVoiceQueue),l.onWithoutApply("smsQueue:remove",c.onRemoveVoiceQueue),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 t=_.filter(e.rows,function(e){return _.includes(c.myQueues,{id:e.queue_id})});e.rows=t,e.count=t.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,t){h?n(function(){h=!1}):(t||(f=c.query.page),e!==t&&(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,n,t,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,t){c.rpcVoiceQueues[t]&&(c.voiceQueues[t].waiting=c.rpcVoiceQueues[t].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:"inbound",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){"inbound"===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.user.getQueues(c.query).$promise.then(function(e){return c.myQueues=e,o.rpc.getVoiceQueues().$promise}).then(function(e){for(var t=e.rows,n=_.keyBy(t,"id"),a=0;a<c.myQueues.count;a++){var i=c.myQueues.rows[a];c.rpcVoiceQueues[i.id]=n[i.id]}return o.rpc.getVoiceQueuesChannels().$promise}).then(function(e){c.rpcVoiceQueuesChannels=e?_.keyBy(e.rows?_.filter(e.rows,function(e){return!("inbound"!==e.type||e.queuecallerleaveAt||!_.find(c.myQueues.rows,{name:e.queue}))}):[],"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,t){p?n(function(){p=!1}):(t||(g=c.query.page),e!==t&&(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("AgentHomeDashboardVoiceController",e)}(),function(){"use strict";function e(n,a,i,s,o,r,l,t,d,c,e){var m=this;function u(e){m.faxInteractions=e||{count:0,rows:[]};for(var t=0;t<m.faxInteractions.rows.length;t+=1)g(m.faxInteractions.rows[t])}function p(){if(m.pickerModel.dateStart){var e=moment(m.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format();m.query.createdAt={$gte:m.pickerModel.dateStart,$lte:e}}else m.query.createdAt=void 0;m.faxAccounts.rows.length?(_.includes(_.map(m.faxAccounts.rows,"id"),m.query.account)||(m.query.account=null),m.query.FaxAccountId=m.query.account||_.map(m.faxAccounts.rows,"id").join()):m.query.FaxAccountId=-1,m.query.offset=(m.query.page-1)*m.query.limit,o.localStorage.setItem("motion2.home.fax:"+m.user.id,JSON.stringify({query:m.query})),m.promise=l.faxInteraction.get(m.query,u).$promise}function g(e){e&&e.Messages?e.unread=_.filter(e.Messages||[],{direction:"in",read:!1}).length:e.unread=0}m.user=t.getCurrentUser(),m.license={},m.setting={},m.tags={count:0,rows:[]},m.faxInteractions={count:0,rows:[]},m.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,account:null},m.success=u,m.getFaxInteractions=p,m.showFaxInteraction=function(e,t){n.$parent.vm.addInteractionTab("fax",t)},m.downloadFaxInteraction=function(e,s,t){l.faxInteraction.download({id:s.id,attachments:t}).$promise.then(function(e){var t=[e.buffer],n="fax-interaction"+s.id+".zip",a=new Blob(t,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadFaxInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.getContactLabel=function(e){if(e.Contact){var t="";return t+=(e.Contact.firstName||"")+""+(e.Contact.lastName||""),t+=" <"+(e.Contact.fax||"unknown")+">"}return r.instant("DASHBOARDS.UNKNOWN")},m.getUserLabel=function(e){if(e.UserId)return e.UserId===t.getCurrentUser().id?r.instant("DASHBOARDS.ME"):m.usersByKey[e.UserId].fullname+" <"+m.usersByKey[e.UserId].internal+">";return r.instant("DASHBOARDS.NOT_ASSIGNED")},m.getFaxAccountLabel=function(e){if(e.Account)return e.Account.key;return r.instant("DASHBOARDS.UNKNOWN")},m.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},m.clearAll=function(){m.calendarModel={dateStart:null},m.pickerModel={dateStart:null},m.serviceModel={dateStart:null},m.getFaxInteractions()},m.composeFaxInteraction=function(e,t){i.show({controller:"ComposeFaxInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/composeFax/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{account:t,message:{},type:"new",interaction:{}},fullscreen:!0}).then(function(e){return l.faxAccount.send({id:t.id},e).$promise.then(function(e){c.success({title:"Message properly sent!",msg:"Message has been sent!"}),n.$parent.vm.addInteractionTab("fax",e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t++)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else c.error({title:"FAX:SEND",msg:e.data?JSON.stringify(e.data):e.message||e.toString()})})})},m.onInit=function(e,t){return m.license=e,m.setting=t,l.user["get"+_.upperFirst("faxAccounts")]({id:m.user.id,nolimit:!0}).$promise.then(function(e){return m.faxAccounts=e||{count:0,rows:[]},l.tag.get().$promise}).then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){return l.user.get({nolimit:!0,fields:"id,fullname,userpic,internal"}).$promise}).then(function(e){m.usersByKey=_.keyBy(e.rows,"id")}).catch(function(e){console.error(e)}).finally(function(){var e=o.localStorage.getItem("motion2.home.fax:"+m.user.id);if(e)try{(e=JSON.parse(e)).query&&(m.query=_.merge(m.query,e.query),m.query=_.omit(m.query,"filter"),m.query.sort&&0<=m.query.sort.indexOf("lastMessage")&&(m.query=_.omit(m.query,"sort")),m.query.includeAll=!0)}catch(e){console.error(e)}d.on("faxInteraction:save",m.onFaxInteractionSave),d.on("faxInteraction:update",m.onFaxInteractionSave),d.on("faxInteractionTags:save",m.onFaxInteractionTagsSave),d.on("faxMessage:save",m.onFaxMessageSave),d.on("faxMessage:update",m.onFaxMessageSave),d.on("user_has_fax_interactions:save",m.onFaxInteractionOpen),d.on("user_has_fax_interactions:remove",m.onFaxInteractionClose),m.getFaxInteractions()})},m.onFaxInteractionSave=function(e){if(e){var t=_.find(m.faxInteractions.rows,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):p(),g(e)}},m.onFaxInteractionTagsSave=function(e){if(e){var t=_.find(m.faxInteractions.rows,{id:e.id});t&&(t.Tags=e.tags||[],_.merge(t,_.pick(e,_.keys(t))))}},m.onFaxMessageSave=function(e){if(e&&!e.secret){var t=_.find(m.faxInteractions.rows,{id:e.FaxInteractionId});if(t){var n=_.find(t.Messages,{id:e.id});n?_.merge(n,_.pick(e,_.keys(n))):(_.isNil(t.Messages)&&(t.Messages=[]),t.Messages.push(e)),g(t)}}},m.onFaxInteractionOpen=function(e){var t=_.find(m.faxInteractions.rows,{id:e.FaxInteractionId});t&&t.Users&&(_.find(t.Users,{id:e.UserId})||t.Users.push({id:e.UserId}))},m.onFaxInteractionClose=function(e){var t=_.find(m.faxInteractions.rows,{id:e.FaxInteractionId});t&&t.Users&&_.remove(t.Users,{id:e.UserId})},m.localizationMap=e,m.pickerModel={dateStart:null};var v=!0,h=1;n.$watch("vm.query.filter",function(e,t){v?a(function(){v=!1}):(t||(h=m.query.page),e!==t&&(m.query.page=1),e||(m.query.page=h),m.getFaxInteractions())}),n.$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")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty","dateFilterLocalizationFactory"],angular.module("app.dashboards").controller("AgentHomeFaxController",e)}(),function(){"use strict";function e(a,n,i,s,o,r,l,t,d,c,e){var m=this;function u(e){m.mailInteractions=e||{count:0,rows:[]};for(var t=0;t<m.mailInteractions.rows.length;t+=1)g(m.mailInteractions.rows[t])}function p(){if(m.pickerModel.dateStart){var e=moment(m.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format();m.query.createdAt={$gte:m.pickerModel.dateStart,$lte:e}}else m.query.createdAt=void 0;m.mailAccounts.rows.length?(_.includes(_.map(m.mailAccounts.rows,"id"),m.query.account)||(m.query.account=null),m.query.MailAccountId=m.query.account||_.map(m.mailAccounts.rows,"id").join()):m.query.MailAccountId=-1,m.query.offset=(m.query.page-1)*m.query.limit,o.localStorage.setItem("motion2.home.mail:"+m.user.id,JSON.stringify({query:m.query})),m.promise=l.mailInteraction.get(m.query,u).$promise}function g(e){e&&e.Messages?e.unread=_.filter(e.Messages||[],{direction:"in",read:!1}).length:e.unread=0}m.user=t.getCurrentUser(),m.license={},m.setting={},m.tags={count:0,rows:[]},m.mailInteractions={count:0,rows:[]},m.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,account:null},m.success=u,m.getMailInteractions=p,m.showMailInteraction=function(e,t){a.$parent.vm.addInteractionTab("mail",t)},m.downloadMailInteraction=function(e,s,t){l.mailInteraction.download({id:s.id,attachments:t}).$promise.then(function(e){var t=[e.buffer],n="mail-interaction"+s.id+".zip",a=new Blob(t,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadMailInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.getContactLabel=function(e){if(e.Contact){var t="";return t+=(e.Contact.firstName||"")+""+(e.Contact.lastName||""),e.to&&e.Account&&e.to.indexOf(e.Account.email)<0?t=e.to:t+=" <"+(e.Contact.email||"unknown")+">",t}return r.instant("DASHBOARDS.UNKNOWN")},m.getUserLabel=function(e){if(e.UserId)return e.UserId===t.getCurrentUser().id?r.instant("DASHBOARDS.ME"):m.usersByKey[e.UserId].fullname+" <"+m.usersByKey[e.UserId].internal+">";return r.instant("DASHBOARDS.NOT_ASSIGNED")},m.getMailAccountLabel=function(e){if(e.Account)return e.Account.key;return r.instant("DASHBOARDS.UNKNOWN")},m.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},m.clearAll=function(){m.calendarModel={dateStart:null},m.pickerModel={dateStart:null},m.serviceModel={dateStart:null},m.getMailInteractions()},m.composeMailInteraction=function(e,t){i.show({controller:"ComposeMailInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/composeMail/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{account:t,message:{},type:"new",interaction:{}},fullscreen:!0}).then(function(n){return l.mailAccount.send({id:t.id},n).$promise.then(function(e){if(e&&e.Messages&&e.Messages.length){if(n.attachments&&n.attachments.length)for(var t=0;t<n.attachments.length;t+=1)l.attachment.update({id:n.attachments[t].id},{MailMessageId:_.head(e.Messages).id});c.success({title:"Message properly sent!",msg:"Message has been sent!"}),e.closed?(e.disposition=null,i.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!0,locals:{user:m.user,channel:"mail",interaction:e}})):a.$parent.vm.addInteractionTab("mail",e)}}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t++)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})})})},m.onInit=function(e,t){return m.license=e,m.setting=t,l.user["get"+_.upperFirst("mailAccounts")]({id:m.user.id,nolimit:!0}).$promise.then(function(e){return m.mailAccounts=e||{count:0,rows:[]},l.tag.get().$promise}).then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){return l.user.get({nolimit:!0,fields:"id,fullname,userpic,internal"}).$promise}).then(function(e){m.usersByKey=_.keyBy(e.rows,"id")}).then(function(){return l.mailSubstatus.get({nolimit:!0}).$promise}).then(function(e){m.subStatuses=e||{count:0,rows:[]}}).catch(function(e){console.error(e)}).finally(function(){var e=o.localStorage.getItem("motion2.home.mail:"+m.user.id);if(e)try{(e=JSON.parse(e)).query&&(m.query=_.merge(m.query,e.query),m.query=_.omit(m.query,"filter"),m.query.sort&&0<=m.query.sort.indexOf("lastMessage")&&(m.query=_.omit(m.query,"sort")),m.query.includeAll=!0)}catch(e){console.error(e)}d.on("mailInteraction:save",m.onMailInteractionSave),d.on("mailInteraction:update",m.onMailInteractionSave),d.on("mailInteractionTags:save",m.onMailInteractionTagsSave),d.on("mailMessage:save",m.onMailMessageSave),d.on("mailMessage:update",m.onMailMessageSave),d.on("user_has_mail_interactions:save",m.onMailInteractionOpen),d.on("user_has_mail_interactions:remove",m.onMailInteractionClose),m.getMailInteractions()})},m.onMailInteractionSave=function(e){if(e){var t=_.find(m.mailInteractions.rows,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):p(),g(e)}},m.onMailInteractionTagsSave=function(e){if(e){var t=_.find(m.mailInteractions.rows,{id:e.id});t&&(t.Tags=e.tags||[],_.merge(t,_.pick(e,_.keys(t))))}},m.onMailMessageSave=function(e){if(e&&!e.secret){var t=_.find(m.mailInteractions.rows,{id:e.MailInteractionId});if(t){var n=_.find(t.Messages,{id:e.id});n?_.merge(n,_.pick(e,_.keys(n))):(_.isNil(t.Messages)&&(t.Messages=[]),t.Messages.push(e)),g(t)}}},m.onMailInteractionOpen=function(e){var t=_.find(m.mailInteractions.rows,{id:e.MailInteractionId});t&&t.Users&&(_.find(t.Users,{id:e.UserId})||t.Users.push({id:e.UserId}))},m.onMailInteractionClose=function(e){var t=_.find(m.mailInteractions.rows,{id:e.MailInteractionId});t&&t.Users&&_.remove(t.Users,{id:e.UserId})},m.localizationMap=e,m.pickerModel={dateStart:null};var v=!0,h=1;a.$watch("vm.query.filter",function(e,t){v?n(function(){v=!1}):(t||(h=m.query.page),e!==t&&(m.query.page=1),e||(m.query.page=h),m.getMailInteractions())}),a.$on("$destroy",function(){d.removeAllListeners("mailMessage:save"),d.removeAllListeners("mailMessage:update"),d.removeAllListeners("mailInteraction:save"),d.removeAllListeners("mailInteractionTags:save"),d.removeAllListeners("mailInteraction:update"),d.removeAllListeners("user_has_mail_interactions:save"),d.removeAllListeners("user_has_mail_interactions:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty","dateFilterLocalizationFactory"],angular.module("app.dashboards").controller("AgentHomeMailController",e)}(),function(){"use strict";function e(n,a,i,s,e,t,o){var r=this;r.currentUser=e.getCurrentUser(),r.lists={},r.contacts={count:0,rows:[]},r.tags={count:0,rows:[]},r.query={includeAll:!0,id:r.currentUser.id,sort:"-updatedAt",limit:10,page:1},r.getContacts=function(){r.query.ListId=r.getListId(),r.query.offset=(r.query.page-1)*r.query.limit,o.localStorage.setItem("motion2.home.mycontacts:"+r.currentUser.id,JSON.stringify({query:r.query})),r.promise=t.user.getContacts(r.query,c).$promise},r.refreshContacts=function(){r.getContacts()},r.mergeContact=function(e,t){s.show({controller:"MergeContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/merge/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:t.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:r.currentUser.id,fields:"id,name"})}]},locals:{contacts:r.contacts.rows}})},r.duplicateContact=function(e,t){s.show({controller:"DuplicateContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:t.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:r.currentUser.id,fields:"id,name"})}]},locals:{contacts:r.contacts.rows}})},r.openContact=function(e,t){a.$parent.vm.addContactTab(t)},r.call=a.$parent.vm.call,r.onInit=function(){var e=o.localStorage.getItem("motion2.home.mycontacts:"+r.currentUser.id);if(e)try{(e=JSON.parse(e)).query&&(r.query=_.omit(e.query,"filter"))}catch(e){console.error(e)}t.cmList.get({fields:"id,name,dialPrefix",sort:"name",nolimit:!0}).$promise.then(function(e){return r.lists=e||{count:0,rows:[]},r.listsMap=_.keyBy(r.lists.rows,"id"),r.defaultLists=r.lists.rows?_.map(r.lists.rows,"id").join(","):void 0,t.tag.get().$promise}).then(function(e){r.tags=e||{count:0,rows:[]}}).catch(function(e){console.error(e)}).finally(function(){r.getContacts()})},r.getListId=function(){var e=_.toString(r.query.ListId);if(e){var t=e.split(","),n=r.defaultLists.split(",");_.isEqual(t,n)||(1<t.length?e=r.defaultLists:_.indexOf(n,t[0])<0&&(e=r.defaultLists))}else e=r.defaultLists;return e};var l=!0,d=1;function c(e){r.contacts=e||{count:0,rows:[]}}a.$watch("vm.query.filter",function(e,t){l?i(function(){l=!1}):(t||(d=r.query.page),e!==t&&(r.query.page=1),e||(r.query.page=d),r.getContacts())})}e.$inject=["$document","$scope","$timeout","$mdDialog","Auth","api","$window"],angular.module("app.dashboards").controller("AgentHomeMyContactsController",e)}(),function(){"use strict";function e(n,a,i,s,o,r,l,t,d,c,e){var m=this;function u(e){m.openchannelInteractions=e||{count:0,rows:[]};for(var t=0;t<m.openchannelInteractions.rows.length;t+=1)g(m.openchannelInteractions.rows[t])}function p(){if(m.pickerModel.dateStart){var e=moment(m.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format();m.query.createdAt={$gte:m.pickerModel.dateStart,$lte:e}}else m.query.createdAt=void 0;m.openchannelAccounts.rows.length?(_.includes(_.map(m.openchannelAccounts.rows,"id"),m.query.account)||(m.query.account=null),m.query.OpenchannelAccountId=m.query.account||_.map(m.openchannelAccounts.rows,"id").join()):m.query.OpenchannelAccountId=-1,m.query.offset=(m.query.page-1)*m.query.limit,o.localStorage.setItem("motion2.home.openchannel:"+m.user.id,JSON.stringify({query:m.query})),m.promise=l.openchannelInteraction.get(m.query,u).$promise}function g(e){e&&e.Messages?e.unread=_.filter(e.Messages||[],{direction:"in",read:!1}).length:e.unread=0}m.user=t.getCurrentUser(),m.license={},m.setting={},m.tags={count:0,rows:[]},m.openchannelInteractions={count:0,rows:[]},m.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,account:null},m.success=u,m.getOpenchannelInteractions=p,m.showOpenchannelInteraction=function(e,t){n.$parent.vm.addInteractionTab("openchannel",t)},m.downloadOpenchannelInteraction=function(e,s,t){l.openchannelInteraction.download({id:s.id,attachments:t}).$promise.then(function(e){var t=[e.buffer],n="openchannel-interaction"+s.id+".zip",a=new Blob(t,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadOpenchannelInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.getContactLabel=function(e){if(e.Contact){var t="";return t+=(e.Contact.firstName||"")+""+(e.Contact.lastName||""),e.from&&(t=e.from),t}return r.instant("DASHBOARDS.UNKNOWN")},m.getUserLabel=function(e){if(e.UserId)return e.UserId===t.getCurrentUser().id?r.instant("DASHBOARDS.ME"):m.usersByKey[e.UserId].fullname+" <"+m.usersByKey[e.UserId].internal+">";return r.instant("DASHBOARDS.NOT_ASSIGNED")},m.getOpenchannelAccountLabel=function(e){if(e.Account)return e.Account.key;return r.instant("DASHBOARDS.UNKNOWN")},m.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},m.clearAll=function(){m.calendarModel={dateStart:null},m.pickerModel={dateStart:null},m.serviceModel={dateStart:null},m.getOpenchannelInteractions()},m.composeOpenchannelInteraction=function(e,t){i.show({controller:"ComposeOpenchannelInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/composeOpenchannel/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{account:t,message:{},type:"new",interaction:{}},fullscreen:!0}).then(function(e){return l.openchannelAccount.send({id:t.id},e).$promise.then(function(e){c.success({title:"Message properly sent!",msg:"Message has been sent!"}),n.$parent.vm.addInteractionTab("openchannel",e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t++)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})})})},m.onInit=function(e,t){return m.license=e,m.setting=t,l.user["get"+_.upperFirst("openchannelAccounts")]({id:m.user.id,nolimit:!0}).$promise.then(function(e){return m.openchannelAccounts=e||{count:0,rows:[]},l.tag.get().$promise}).then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){return l.user.get({nolimit:!0,fields:"id,fullname,userpic,internal"}).$promise}).then(function(e){m.usersByKey=_.keyBy(e.rows,"id")}).catch(function(e){console.error(e)}).finally(function(){var e=o.localStorage.getItem("motion2.home.openchannel:"+m.user.id);if(e)try{(e=JSON.parse(e)).query&&(m.query=_.merge(m.query,e.query),m.query=_.omit(m.query,"filter"),m.query.sort&&0<=m.query.sort.indexOf("lastMessage")&&(m.query=_.omit(m.query,"sort")),m.query.includeAll=!0)}catch(e){console.error(e)}d.on("openchannelInteraction:save",m.onOpenchannelInteractionSave),d.on("openchannelInteraction:update",m.onOpenchannelInteractionSave),d.on("openchannelInteractionTags:save",m.onOpenchannelInteractionTagsSave),d.on("openchannelMessage:save",m.onOpenchannelMessageSave),d.on("openchannelMessage:update",m.onOpenchannelMessageSave),d.on("user_has_openchannel_interactions:save",m.onOpenchannelInteractionOpen),d.on("user_has_openchannel_interactions:remove",m.onOpenchannelInteractionClose),m.getOpenchannelInteractions()})},m.onOpenchannelInteractionSave=function(e){if(e){var t=_.find(m.openchannelInteractions.rows,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):p(),g(e)}},m.onOpenchannelInteractionTagsSave=function(e){if(e){var t=_.find(m.openchannelInteractions.rows,{id:e.id});t&&(t.Tags=e.tags||[],_.merge(t,_.pick(e,_.keys(t))))}},m.onOpenchannelMessageSave=function(e){if(e&&!e.secret){var t=_.find(m.openchannelInteractions.rows,{id:e.OpenchannelInteractionId});if(t){var n=_.find(t.Messages,{id:e.id});n?_.merge(n,_.pick(e,_.keys(n))):(_.isNil(t.Messages)&&(t.Messages=[]),t.Messages.push(e)),g(t)}}},m.onOpenchannelInteractionOpen=function(e){var t=_.find(m.openchannelInteractions.rows,{id:e.OpenchannelInteractionId});t&&t.Users&&(_.find(t.Users,{id:e.UserId})||t.Users.push({id:e.UserId}))},m.onOpenchannelInteractionClose=function(e){var t=_.find(m.openchannelInteractions.rows,{id:e.OpenchannelInteractionId});t&&t.Users&&_.remove(t.Users,{id:e.UserId})},m.localizationMap=e,m.pickerModel={dateStart:null};var v=!0,h=1;n.$watch("vm.query.filter",function(e,t){v?a(function(){v=!1}):(t||(h=m.query.page),e!==t&&(m.query.page=1),e||(m.query.page=h),m.getOpenchannelInteractions())}),n.$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")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty","dateFilterLocalizationFactory"],angular.module("app.dashboards").controller("AgentHomeOpenchannelController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l){var d=this;function c(e,t,n){d.license=e,d.setting=t,d.plugin=n}d.currentUser=o.getCurrentUser(),d.plugin={},d.onInit=c,d.getTrustedURL=function(){return s.trustAsResourceUrl(d.plugin.agentUrl)},c(),t.$on("pluginUpdated",function(e,t){d.plugin=t.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,t,n,a,i,s,o,r,l,d,c,m,u){var p=this;function g(e){p.voiceRecordings=e||{count:0,rows:[]}}p.currentUser=c.getCurrentUser(),p.voiceRecordings={},p.localizationMap=u,p.pickerModel={dateStart:null},p.table="voiceRecordings",p.query={UserId:p.currentUser.id,fields:"createdAt,updatedAt,id,format,value,type,uniqueid,calleridnum,exten,connectedlinenum,queue,rating,audio,UserId",sort:"-updatedAt",limit:10,page:1,type:null},p.downloadfile=function(i,e){return r.voiceRecording.download({id:i.id,exists:!0}).$promise.then(function(e){var t=[e.buffer],n=new Blob(t,{type:e.type}),a=window.document.createElement("a");a.setAttribute("href",URL.createObjectURL(n)),a.setAttribute("download",i.uniqueid+i.format),a.click()}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceRecording",msg:e.data?JSON.stringify(e.data):e.toString()})})},p.success=g,p.getVoiceRecordings=function(){if(p.pickerModel.dateStart){var e=moment(p.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format();p.query.createdAt={$gte:p.pickerModel.dateStart,$lte:e}}else p.query.createdAt=void 0;p.query.offset=(p.query.page-1)*p.query.limit,t.localStorage.setItem("motion2.home.recordings:"+p.currentUser.id,JSON.stringify({query:p.query})),p.promise=r.voiceRecording.get(p.query,g).$promise},p.onInit=function(){var e=t.localStorage.getItem("motion2.home.recordings:"+p.currentUser.id);if(e)try{(e=JSON.parse(e)).query&&(p.query=_.omit(e.query,["filter","id"]),p.query.fields="createdAt,updatedAt,id,format,value,type,uniqueid,calleridnum,exten,connectedlinenum,queue,rating,audio,UserId",p.query.UserId=p.currentUser.id)}catch(e){console.error(e)}p.getVoiceRecordings()},p.clearAll=function(){p.pickerModel={dateStart:null},p.getVoiceRecordings()};var v=!0,h=1;e.$watch("vm.query.filter",function(e,t){v?o(function(){v=!1}):(t||(h=p.query.page),e!==t&&(p.query.page=1),e||(p.query.page=h),p.getVoiceRecordings())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","api","msUtils","toasty","Auth","$translate","dateFilterLocalizationFactory"],angular.module("app.dashboards").controller("AgentHomeRecordingsController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l){var d=this;function c(e){d.scheduledCalls=e||{count:0,rows:[]}}d.currentUser=r.getCurrentUser(),d.priorities=["Lowest","Low","Medium","High","Highest"],d.localizationMap=l,d.pickerModel={dateStart:null},d.scheduledCalls={},d.query={id:d.currentUser.id,fields:"id,phone,scheduledat,recallme,priority,UserId,OwnerId",sort:"scheduledat",limit:10,page:1},d.queueCampaigns={rows:[],count:0},d.success=c,d.getScheduledCalls=function(){if(d.pickerModel.dateStart){var e=moment(d.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format();d.query.scheduledat={$gte:d.pickerModel.dateStart,$lte:e}}else d.query.createdAt=void 0;d.query.id=d.currentUser.id,d.query.includeAll=!0,d.query.offset=(d.query.page-1)*d.query.limit,t.localStorage.setItem("motion2.home.scheduled:"+d.currentUser.id,JSON.stringify({query:d.query})),d.promise=o.user.getScheduledCalls(d.query,c).$promise},d.onInit=function(){var e=t.localStorage.getItem("motion2.home.scheduled:"+d.currentUser.id);if(e)try{(e=JSON.parse(e)).query&&(d.query=_.omit(e.query,["filter"]))}catch(e){console.error(e)}o.user.getQueues({id:r.getCurrentUser().id,fields:"id,name",channel:"voice",type:"outbound",nolimit:!0}).$promise.then(function(e){d.queueCampaigns=e||{count:0,rows:[]}}).catch(function(e){console.error(e)}).finally(function(){d.getScheduledCalls()})},d.clearAll=function(){d.pickerModel={dateStart:null},d.getScheduledCalls()},d.isDateBeforeToday=function(e){return moment(e).isBefore(moment())},d.createOrEditQueueCampaignHopper=function(e,t){a.show({controller:"CreateOrEditHopperVoiceQueueIdDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hoppers/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:null,hopper:t,hoppers:d.scheduledCalls.rows,license:null,setting:null}})},d.deleteConfirm=function(t,e){var n=a.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");a.show(n).then(function(){var e;e=t,o.cmHopper.delete({id:e.id}).$promise.then(function(){_.remove(d.scheduledCalls.rows,{id:e.id}),d.scheduledCalls.count-=1,d.scheduledCalls.rows.length||d.getScheduledCalls(),s.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){d.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETE_HOPPER"}];for(var t=0;t<e.data.errors.length;t++)s.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else s.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 m=!0,u=1;e.$watch("vm.query.filter",function(e,t){m?n(function(){m=!1}):(t||(u=d.query.page),e!==t&&(d.query.page=1),e||(d.query.page=u),d.getScheduledCalls())})}e.$inject=["$scope","$window","$timeout","$mdDialog","$document","toasty","api","Auth","dateFilterLocalizationFactory"],angular.module("app.dashboards").controller("AgentHomeScheduledCallsController",e)}(),function(){"use strict";function e(n,a,i,s,o,r,l,t,d,c,e){var m=this;function u(e){m.smsInteractions=e||{count:0,rows:[]};for(var t=0;t<m.smsInteractions.rows.length;t+=1)g(m.smsInteractions.rows[t])}function p(){if(m.pickerModel.dateStart){var e=moment(m.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format();m.query.createdAt={$gte:m.pickerModel.dateStart,$lte:e}}else m.query.createdAt=void 0;m.smsAccounts.rows.length?(_.includes(_.map(m.smsAccounts.rows,"id"),m.query.account)||(m.query.account=null),m.query.SmsAccountId=m.query.account||_.map(m.smsAccounts.rows,"id").join()):m.query.SmsAccountId=-1,m.query.offset=(m.query.page-1)*m.query.limit,o.localStorage.setItem("motion2.home.sms:"+m.user.id,JSON.stringify({query:m.query})),m.promise=l.smsInteraction.get(m.query,u).$promise}function g(e){e&&e.Messages?e.unread=_.filter(e.Messages||[],{direction:"in",read:!1}).length:e.unread=0}m.user=t.getCurrentUser(),m.license={},m.setting={},m.tags={count:0,rows:[]},m.smsInteractions={count:0,rows:[]},m.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,account:null},m.success=u,m.getSmsInteractions=p,m.showSmsInteraction=function(e,t){n.$parent.vm.addInteractionTab("sms",t)},m.downloadSmsInteraction=function(e,s,t){l.smsInteraction.download({id:s.id,attachments:t}).$promise.then(function(e){var t=[e.buffer],n="sms-interaction"+s.id+".zip",a=new Blob(t,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadSmsInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.getContactLabel=function(e){if(e.Contact){var t="";return t+=(e.Contact.firstName||"")+""+(e.Contact.lastName||""),t+=" <"+(e.Contact.mobile||"unknown")+">"}return r.instant("DASHBOARDS.UNKNOWN")},m.getUserLabel=function(e){if(e.UserId)return e.UserId===t.getCurrentUser().id?r.instant("DASHBOARDS.ME"):m.usersByKey[e.UserId].fullname+" <"+m.usersByKey[e.UserId].internal+">";return r.instant("DASHBOARDS.NOT_ASSIGNED")},m.getSmsAccountLabel=function(e){if(e.Account)return e.Account.key;return r.instant("DASHBOARDS.UNKNOWN")},m.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},m.clearAll=function(){m.calendarModel={dateStart:null},m.pickerModel={dateStart:null},m.serviceModel={dateStart:null},m.getSmsInteractions()},m.composeSmsInteraction=function(e,t){i.show({controller:"ComposeSmsInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/composeSms/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{account:t,message:{},type:"new",interaction:{}},fullscreen:!0}).then(function(e){return l.smsAccount.send({id:t.id},e).$promise.then(function(e){c.success({title:"Message properly sent!",msg:"Message has been sent!"}),n.$parent.vm.addInteractionTab("sms",e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t++)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})})})},m.onInit=function(e,t){return m.license=e,m.setting=t,l.user["get"+_.upperFirst("smsAccounts")]({id:m.user.id,nolimit:!0}).$promise.then(function(e){return m.smsAccounts=e||{count:0,rows:[]},l.tag.get().$promise}).then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){return l.user.get({nolimit:!0,fields:"id,fullname,userpic,internal"}).$promise}).then(function(e){m.usersByKey=_.keyBy(e.rows,"id")}).catch(function(e){console.error(e)}).finally(function(){var e=o.localStorage.getItem("motion2.home.sms:"+m.user.id);if(e)try{(e=JSON.parse(e)).query&&(m.query=_.merge(m.query,e.query),m.query=_.omit(m.query,"filter"),m.query.sort&&0<=m.query.sort.indexOf("lastMessage")&&(m.query=_.omit(m.query,"sort")),m.query.includeAll=!0)}catch(e){console.error(e)}d.on("smsInteraction:save",m.onSmsInteractionSave),d.on("smsInteraction:update",m.onSmsInteractionSave),d.on("smsInteractionTags:save",m.onSmsInteractionTagsSave),d.on("smsMessage:save",m.onSmsMessageSave),d.on("smsMessage:update",m.onSmsMessageSave),d.on("user_has_sms_interactions:save",m.onSmsInteractionOpen),d.on("user_has_sms_interactions:remove",m.onSmsInteractionClose),m.getSmsInteractions()})},m.onSmsInteractionSave=function(e){if(e){var t=_.find(m.smsInteractions.rows,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):p(),g(e)}},m.onSmsInteractionTagsSave=function(e){if(e){var t=_.find(m.smsInteractions.rows,{id:e.id});t&&(t.Tags=e.tags||[],_.merge(t,_.pick(e,_.keys(t))))}},m.onSmsMessageSave=function(e){if(e&&!e.secret){var t=_.find(m.smsInteractions.rows,{id:e.SmsInteractionId});if(t){var n=_.find(t.Messages,{id:e.id});n?_.merge(n,_.pick(e,_.keys(n))):(_.isNil(t.Messages)&&(t.Messages=[]),t.Messages.push(e)),g(t)}}},m.onSmsInteractionOpen=function(e){var t=_.find(m.smsInteractions.rows,{id:e.SmsInteractionId});t&&t.Users&&(_.find(t.Users,{id:e.UserId})||t.Users.push({id:e.UserId}))},m.onSmsInteractionClose=function(e){var t=_.find(m.smsInteractions.rows,{id:e.SmsInteractionId});t&&t.Users&&_.remove(t.Users,{id:e.UserId})},m.localizationMap=e,m.pickerModel={dateStart:null};var v=!0,h=1;n.$watch("vm.query.filter",function(e,t){v?a(function(){v=!1}):(t||(h=m.query.page),e!==t&&(m.query.page=1),e||(m.query.page=h),m.getSmsInteractions())}),n.$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")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty","dateFilterLocalizationFactory"],angular.module("app.dashboards").controller("AgentHomeSmsController",e)}(),function(){"use strict";function e(t,n,a,i,e,s,o,r,l,d){var c=this;function m(e){c.voiceCalls=e||{count:0,rows:[]}}c.currentUser=e.getCurrentUser(),c.voiceCalls={},c.localizationMap=d,c.pickerModel={dateStart:null},c.table="voiceCalls",c.query={UserId:c.currentUser.id,fields:"id,type,uniqueid,tag,starttime,endtime,source,destination,userDisposition,note,duration,billableseconds,answertime",sort:"-updatedAt",limit:10,page:1,type:null},c.success=m,c.getVoiceCalls=function(){if(c.pickerModel.dateStart){var e=moment(c.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format();c.query.createdAt={$gte:c.pickerModel.dateStart,$lte:e}}else c.query.createdAt=void 0;c.query.offset=(c.query.page-1)*c.query.limit,o.localStorage.setItem("motion2.home.voice:"+c.currentUser.id,JSON.stringify({query:c.query})),c.promise=a.voiceCallReport.get(c.query,m).$promise},c.onInit=function(){return a.tag.get().$promise.then(function(e){c.tags=e||{count:0,rows:[]}}).catch(function(e){i.error({title:"Init error",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()}),c.tags={count:0,rows:[]}}).finally(function(){var e=o.localStorage.getItem("motion2.home.voice:"+c.currentUser.id);if(e)try{(e=JSON.parse(e)).query&&(c.query=_.omit(e.query,"filter"))}catch(e){console.error(e)}c.getVoiceCalls()})},c.showDetails=function(e){t.show({controller:"AgentHomeVoiceDetailsController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/home/voice/details/dialog.html",parent:angular.element(n.body),clickOutsideToClose:!0,locals:{call:e}})},c.clearAll=function(){c.pickerModel={dateStart:null},c.getVoiceCalls()};var u=!0,p=1;r.$watch("vm.query.filter",function(e,t){u?l(function(){u=!1}):(t||(p=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=p),c.getVoiceCalls())})}e.$inject=["$mdDialog","$document","api","toasty","Auth","$translate","$window","$scope","$timeout","dateFilterLocalizationFactory"],angular.module("app.dashboards").controller("AgentHomeVoiceController",e)}(),function(){"use strict";function e(e,t){this.call=t,this.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","call"],angular.module("app.dashboards").controller("AgentHomeVoiceDetailsController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u){var p=this,g=25,v=1024*g*1024;function h(){i.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(n.body),clickOutsideToClose:!0,locals:{user:p.user,channel:p.tab.channel,interaction:p.tab.interaction}}).then(function(e){p.tab.saved=Boolean(e),e&&a.$parent.$parent.$parent.vm.closeTab(p.tab)})}function f(e,t){p.tab.message||(p.tab.message=t),i.show({controller:"ComposeMailInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/composeMail/dialog.html",parent:angular.element(n.body),clickOutsideToClose:!1,locals:{account:p.account,message:p.tab.message,type:e,interaction:p.interaction},fullscreen:!0,skipHide:Boolean(p.tab.spy)}).then(function(t){t&&E(t),t.Interaction&&p.interaction&&p.interaction.id&&(t.Interaction.id=p.interaction.id,l.mailInteraction.update(t.Interaction).$promise.then(function(e){e&&e.closed?(p.tab.saved=!0,p.interaction.closed=!0,p.interaction.closedAt=e.closedAt,h()):null!==t.Interaction.substatus&&(p.tab.saved=!0,p.tab.interaction.substatus=t.Interaction.substatus,a.$parent.$parent.$parent.vm.closeTab(p.tab))}).catch(function(e){console.error(e)}))})}function b(){"mail"!==p.tab.channel&&t(function(){var e=angular.element(n.find("md-content[name*='interaction-content-"+p.tab.id+"']"));e&&e[0]&&(e[0].scrollTop=e[0].scrollHeight)},0)}function E(n){if(n)return n["chat"===p.tab.channel?"ChatWebsiteId":_.capitalize(p.tab.channel)+"AccountId"]=p.interaction["chat"===p.tab.channel?"ChatWebsiteId":_.capitalize(p.tab.channel)+"AccountId"],n[_.capitalize(p.tab.channel)+"InteractionId"]=p.interaction.id,n.UserId=p.user.id,n.ContactId=p.interaction.ContactId,n.direction="out",n.secret=Boolean(p.tab.spy||n.secret),l[p.tab.channel+"Message"].save(n).$promise.then(function(e){if(e&&e.id&&n.attachments&&n.attachments.length)for(var t=0;t<n.attachments.length;t+=1)l.attachment.update({id:n.attachments[t].id},{MailMessageId:e.id})}).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(){p.tab.areaText="",b()})}function A(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";default:return"blue-A700"}}function y(e){e&&e.count&&e.rows.length&&(p.journey=_.concat(p.journey,e.rows))}p.showFooter=!1,p.showInteraction=!1,p.user=c.getCurrentUser(),p.detectBrowser=u.detectBrowser(),p.journey=[],p.acceptedMessages=[],p.omniChannels=["mail","chat","sms","openchannel","fax"],p.ngFlowOptions={target:"api/attachments",singleFile:!0,maxChunkRetries:1,chunkSize:v,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},p.ngFlow={flow:{}},p.selectedMailShowDetails={},p.selectedMailShowSystemMessage={},p.setting={},p.ctrlMethods={},p.init=function(e,t){p.tab=e,p.tab.saved=!0,p.tab.badges=0,p.setting=t||{},p.tab&&p.tab.channel&&p.tab.interaction&&(p.interaction=p.tab.interaction,l[p.tab.channel+"Interaction"].get({id:p.tab.interaction.id,includeAll:!0}).$promise.then(function(e){return e&&(p.interaction=e,p.tab.interaction=e),p.tab.saved=p.interaction.closed,p.queryMessage={id:p.interaction.id,includeAll:!0},"mail"===p.tab.channel?(p.queryMessage.sort="-id",p.queryMessage.offset=0,p.queryMessage.limit=3):(p.queryMessage.sort="id",p.queryMessage.nolimit=!0),l[p.tab.channel+"Interaction"].getMessages(p.queryMessage).$promise}).then(function(e){return p.messages=e||{count:0,rows:[]},l["chat"===p.tab.channel?"chatWebsite":p.tab.channel+"Account"].get({id:p.interaction["chat"===p.tab.channel?"ChatWebsiteId":_.capitalize(p.tab.channel)+"AccountId"]}).$promise}).then(function(e){if(p.account=e,p.tab.title=p.account.key||p.account.name,p.interaction.ContactId)return l.cmContact.get({id:p.interaction.ContactId}).$promise}).then(function(e){return e&&(p.contact=e),p.showInteraction=!0,p.contact?(!function(e){if(e&&e.id){for(var t=0;t<p.omniChannels.length;t++)l[p.omniChannels[t]+"Interaction"].get({ContactId:e.id,includeAll:!0}).$promise.then(y);l.voiceCallReport.get({ContactId:e.id,includeAll:!0}).$promise.then(y)}}(p.contact),p.tab.title+=" - "+p.contact.firstName):p.tab.title+=" - "+r.instant(p.tab.channel.toUpperCase()+".UNKNOWN"),l.user.get({fields:"id,fullname",nolimit:!0}).$promise}).then(function(e){p.users=e||{count:0,rows:[]},p.usersMap=_.mapValues(_.keyBy(p.users.rows,"id"),"fullname")}).then(function(){if(p.tab.channel&&p.interaction)return l.user["add"+_.upperFirst(p.tab.channel)+"Interactions"]({id:p.user.id,ids:[p.interaction.id]})}).then(function(){return l.mailSubstatus.get({nolimit:!0}).$promise}).then(function(e){p.subStatuses=e||{count:0,rows:[]}}).then(function(){return p.getMailAccounts()}).then(function(){return p.getFaxAccounts()}).then(function(){return p.getSmsAccounts()}).then(function(){return p.getOpenchannelAccounts()}).then(function(){return p.getChatWebsites()}).then(function(){return p.getLists()}).catch(function(e){console.error(e),p.showInteraction=!0}).finally(function(){!function(){if(!p.tab.spy&&!p.interaction.closed)for(var e=0;e<p.messages.rows.length;e+=1)"in"!==p.messages.rows[e].direction||p.messages.rows[e].read||(l[p.tab.channel+"Message"].accept({id:p.messages.rows[e].id,UserId:p.user.id}),p.acceptedMessages.push(p.messages.rows[e].id))}(),b(),m.on(p.tab.channel+"Message:save",p.onMessageSave),m.on(p.tab.channel+"Message:update",p.onMessageSave),m.on(p.tab.channel+"Interaction:save",p.onInteractionSave),m.on(p.tab.channel+"Interaction:update",p.onInteractionSave),m.on("user_has_"+p.tab.channel+"_interactions:save",p.onInteractionOpen),m.on("user_has_"+p.tab.channel+"_interactions:remove",p.onInteractionClose),p.tab.areaText=p.tab.areaText?p.tab.areaText:"",p.showFooter=!0}))},p.getLabelByMessage=function(e){var t="loading...";if(e)return"in"===e.direction?e.Contact?e.Contact.firstName||"Anonymous":t:e.UserId?p.usersMap?p.usersMap[e.UserId]:t:"System"},p.openContact=function(e,t){try{p.tab&&!p.tab.spy&&a.$parent.$parent.$parent.vm.addContactTab(t||p.contact)}catch(e){d.error({title:"ERROR OPEN CONTACT",msg:"Unable to open the contact"})}},p.openInteraction=function(e,t){try{if(t.MailAccountId)return a.$parent.$parent.$parent.vm.addInteractionTab("mail",t);if(t.ChatWebsiteId)return a.$parent.$parent.$parent.vm.addInteractionTab("chat",t);if(t.SmsAccountId)return a.$parent.$parent.$parent.vm.addInteractionTab("sms",t);if(t.OpenchannelAccountId)return a.$parent.$parent.$parent.vm.addInteractionTab("openchannel",t);if(t.FaxAccountId)return a.$parent.$parent.$parent.vm.addInteractionTab("fax",t)}catch(e){d.error({title:"ERROR OPEN INTERACTION",msg:"Customer Journey can't open the interaction"})}},p.disposeInteraction=h,p.tagInteraction=function(){i.show({controller:"TagInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/tag/dialog.html",parent:angular.element(n.body),clickOutsideToClose:!0,skipHide:Boolean(p.tab.spy),resolve:{tags:["apiResolver",function(e){return e.resolve("tag@get",{nolimit:!0,fields:"id,name,color"})}]},locals:{channel:p.tab.channel,interaction:p.tab.interaction}})},p.composeMailInteraction=function(t,e){if(e.inReplyTo){var n=_.find(p.messages.rows,{messageId:e.inReplyTo});if(!n)return l.mailMessage.get({messageId:e.inReplyTo}).$promise.then(function(e){f(t,e&&e.count?e.rows[0]:void 0)}).catch(function(e){console.error(e),f(t,void 0)});f(t,n)}else f(t,e)},p.composeFaxInteraction=function(e){var t={to:[]};t.to.push(p.contact.fax),i.show({controller:"ComposeFaxInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/composeFax/dialog.html",parent:angular.element(n.body),clickOutsideToClose:!1,locals:{account:p.account,message:t,type:e},fullscreen:!0}).then(function(e){return l.faxAccount.send({id:p.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 t=0;t<e.data.errors.length;t++)d.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else d.error({title:"FAX:SEND",msg:e.data?JSON.stringify(e.data):e.message||e.toString()})})})},p.composeSmsInteraction=function(e,t){i.show({controller:"ComposeSmsInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/composeSms/dialog.html",parent:angular.element(n.body),clickOutsideToClose:!1,locals:{account:p.account,message:t,type:e},fullscreen:!0,skipHide:Boolean(p.tab.spy)}).then(function(e){e&&E(e)})},p.transferLastMessage=function(){if(p.interaction){var e=_.findLast(p.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(n.body),clickOutsideToClose:!1,locals:{account:p.account,interaction:p.interaction,message:e,channel:p.tab.channel}}).then(function(e){p.tab.saved=Boolean(e),e&&a.$parent.$parent.$parent.vm.closeTab(p.tab)}):d.error({title:"Invalid transfer",msg:"Message not found!"})}},p.downloadMessage=function(s,e){p.tab.channel&&s.id&&l[p.tab.channel+"Message"].download({id:s.id,attachments:e}).$promise.then(function(e){var t=[e.buffer],n="download",a=new Blob(t,{type:e.type});n=p.tab.channel+"-message"+s.id+".eml";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)d.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})})},p.downloadInteraction=function(s,e){p.tab.channel&&s.id&&l[p.tab.channel+"Interaction"].download({id:s.id,attachments:e}).$promise.then(function(e){var t=[e.buffer],n=p.tab.channel+"-interaction"+s.id+".zip",a=new Blob(t,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)d.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})})},p.getMailAccounts=function(){l.user.getMailAccounts({id:p.user.id,nolimit:!0}).$promise.then(function(e){p.mailAccounts=e||{count:0,rows:[]}})},p.getFaxAccounts=function(){l.user.getFaxAccounts({id:p.user.id,nolimit:!0}).$promise.then(function(e){p.faxAccounts=e||{count:0,rows:[]}})},p.getSmsAccounts=function(){l.user.getSmsAccounts({id:p.user.id,nolimit:!0}).$promise.then(function(e){p.smsAccounts=e||{count:0,rows:[]}})},p.getOpenchannelAccounts=function(){l.user.getOpenchannelAccounts({id:p.user.id,nolimit:!0}).$promise.then(function(e){p.openchannelAccounts=e||{count:0,rows:[]}}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.mail.account"}];for(var t=0;t<e.data.errors.length;t+=1)d.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mail.account",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},p.getChatWebsites=function(){l.user.getChatWebsites({id:p.user.id,nolimit:!0}).$promise.then(function(e){p.chatAccounts=e||{count:0,rows:[]}})},p.getLists=function(){l.user.getLists({id:p.user.id,nolimit:!0}).$promise.then(function(e){p.voiceAccounts=e||{count:0,rows:[]}})},p.reply=function(e,t){if(e&&13===e.keyCode&&e.shiftKey)return;if(e&&13!==e.keyCode)return;if(""===t.trim())return;E(function(e){var t={},n="chat"===p.tab.channel?"ChatWebsiteId":_.capitalize(p.tab.channel)+"AccountId";t[n]=p.interaction[n].toString(),t[_.capitalize(p.tab.channel)+"InteractionId"]=p.interaction.id,"sms"===p.tab.channel&&(t.phone=p.interaction.phone);e&&(t.UserId=p.user.id,t.ContactId=p.interaction.ContactId,t.body=e,t.createdAt=Date.now());return t}(t.replace(/\n$/,"")))},p.upload=function(){p.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},p.ngFlow.flow.upload()},p.fileAdded=function(e){if(e.size>v)return d.error({title:"File too big",msg:"The max allowed size is "+g+"MB"}),!1;return!0},p.fileSuccess=function(e,t){var n=JSON.parse(t),a=n.name;"chat"===p.tab.channel&&(a='<a href="'+(p.account.remote?p.account.remote:o.protocol()+"://"+o.host())+"/api/chat/interactions/"+p.interaction.id+"/attachment_download?attachId="+n.id+"&token="+p.account.token+'" target="_self">'+n.name+"</a>");E({body:a,AttachmentId:n.id})},p.onMessageSave=function(e){if(e&&p.interaction.id!=e[_.capitalize(p.tab.channel)+"InteractionId"])return;var t=!1;p.messages?t=_.find(p.messages.rows,{id:e.id}):p.messages={rows:[],count:0};t?_.merge(t,e):("mail"===p.tab.channel?p.messages.rows.unshift(e):p.messages.rows.push(e),b())},p.onInteractionSave=function(e){if(e&&p.interaction.id!==e.id)return;e.closed&&(p.tab.saved=!0);_.merge(p.interaction,e)},p.searchTextChange=function(t){var n=s.defer(),a=[],e={},i="chat"===p.tab.channel?"ChatWebsiteId":_.capitalize(p.tab.channel)+"AccountId";return e.filter=t,e[i]=p.account.id,l.cannedAnswer.get(e).$promise.then(function(e){return a=_.concat(a,e.rows),l.cannedAnswer.get({filter:t}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),n.resolve(a)}).catch(function(e){n.reject(e)}),n.promise},p.selectedItemChange=function(t){if(t){try{_.templateSettings.interpolate=/{{([\s\S]+?)}}/g;var e=_.template(t.value),n={user:p.user,account:p.account,interaction:p.interaction,contact:p.interaction&&p.interaction.Contact?p.interaction.Contact:{}};p.tab.areaText+=" "+e(n),p.ctrlMethods.setText(p.tab.areaText)}catch(e){p.tab.areaText+=" "+t.value,p.ctrlMethods.setText(p.tab.areaText)}p.selectedItem=null,p.changeDisplayCannedAnswerInputValue()}},p.getIconByChannel=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";default:return"icon-hangouts"}},p.getColorByChannel=A,p.getColorByItem=function(e){var t="";e.FaxAccountId?t="fax":e.OpenchannelAccountId?t="openchannel":e.SmsAccountId?t="sms":e.MailAccountId?t="mail":e.ChatWebsiteId?t="chat":e.amaflags&&(t="voice");return A(t)},p.getMessagesAlignment=function(e){if(e.secret&&p.user.id!=e.UserId)return"in";switch(p.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}},p.displayCannedAnswerInput=!1,p.changeDisplayCannedAnswerInputValue=function(){p.displayCannedAnswerInput=!p.displayCannedAnswerInput},p.setAs=function(e){p.tab.channel&&p.interaction&&p.interaction.id&&l[p.tab.channel+"Interaction"].update({id:p.interaction.id,substatus:e,substatusAt:Date.now()}).$promise.catch(function(e){console.error(e)})},p.markAsUnread=function(){if(p.tab.channel&&p.interaction&&p.interaction.id)if(p.acceptedMessages.length)for(var e=0;e<p.acceptedMessages.length;e+=1)l[p.tab.channel+"Message"].update({id:p.acceptedMessages[e],read:!1,UserId:null});else for(var t=0;t<p.messages.rows.length;t+=1)if("in"===p.messages.rows[t].direction){p.messages.rows[t].UserId===p.user.id?l[p.tab.channel+"Message"].update({id:p.messages.rows[t].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}p.tab.saved=!0,a.$parent.$parent.$parent.vm.closeTab(p.tab)},p.isMyAccount=function(e){{if(e.FaxAccountId)return _.includes(_.map(p.faxAccounts?p.faxAccounts.rows:[],"id"),e.FaxAccountId);if(e.OpenchannelAccountId)return _.includes(_.map(p.openchannelAccounts?p.openchannelAccounts.rows:[],"id"),e.OpenchannelAccountId);if(e.SmsAccountId)return _.includes(_.map(p.smsAccounts?p.smsAccounts.rows:[],"id"),e.SmsAccountId);if(e.MailAccountId)return _.includes(_.map(p.mailAccounts?p.mailAccounts.rows:[],"id"),e.MailAccountId);if(e.ChatWebsiteId)return _.includes(_.map(p.chatAccounts?p.chatAccounts.rows:[],"id"),e.ChatWebsiteId);if(e.amaflags)return!0}return!1},p.getAttachments=function(t){return l.attachment.get({MailMessageId:t.id}).$promise.then(function(e){e&&e.rows&&(t.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()})})},p.getAttachment=function(i){return l.attachment.download({id:i.id}).$promise.then(function(e){if(e){var t=new Blob([e.buffer],{type:e.type}),n=document.createElement("a"),a=window.URL.createObjectURL(t);n.href=a,n.target="_self",n.download=i.name,document.body.appendChild(n),n.click(),setTimeout(function(){document.body.removeChild(n),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()})})},p.htmlToPlaintext=function(e){return e?String(e).replace(/<[^>]+>/gm,""):""},p.onInteractionOpen=function(e){var t;p.interaction.id==e[_.upperFirst(p.tab.channel)+"InteractionId"]&&(p.interaction.Users&&(t=_.find(p.interaction.Users,{id:e.UserId})),t||p.interaction.Users.push({id:e.UserId}))},p.onInteractionClose=function(e){p.interaction.id==e[_.upperFirst(p.tab.channel)+"InteractionId"]&&p.interaction.Users&&_.remove(p.interaction.Users,{id:e.UserId})},p.loadNextPage=function(){var n=s.defer();if(p.queryMessage)return p.queryMessage.offset=p.messages.rows.length,l[p.tab.channel+"Interaction"].getMessages(p.queryMessage).$promise.then(function(e){for(var t=0;t<e.rows.length;t+=1)p.messages.rows.push(e.rows[t]),p.interaction.closed||"in"!==e.rows[t].direction||e.rows[t].read||(l[p.tab.channel+"Message"].accept({id:e.rows[t].id,UserId:p.user.id}),p.acceptedMessages.push(e.rows[t].id));return n.resolve(e)}).catch(function(e){return n.reject(e)});return n.reject()},p.timelineOptions={scrollEl:"#interaction-content"},a.$on("$destroy",function(){m.removeAllListeners(p.tab.channel+"Message:save"),m.removeAllListeners(p.tab.channel+"Message:update"),m.removeAllListeners(p.tab.channel+"Interaction:save"),m.removeAllListeners(p.tab.channel+"Interaction:update"),m.removeAllListeners("user_has_"+p.tab.channel+"_interactions:save"),m.removeAllListeners("user_has_"+p.tab.channel+"_interactions:remove")})}function t(a){return{scope:{ngBindHtmlUnsafe:"="},template:"<div ng-bind-html='trustedHtml'></div>",link:function(n){n.updateView=function(){var e,t=_.replace(n.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"');n.trustedHtml=a.trustAsHtml(t)},n.$watch("ngBindHtmlUnsafe",function(e,t){n.updateView(e)})}}}e.$inject=["$cookies","$timeout","$document","$scope","$mdDialog","$q","$location","$translate","api","toasty","Auth","socket","msUtils"],t.$inject=["$sce"],angular.module("app.dashboards").directive("ngBindHtmlUnsafe",t).filter("getChannelByItem",function(){return function(e,t,n,a){for(var i=[],s=0;s<e.length;s+=1){var o=!0;switch(t){case"voice":o=Boolean(e[s].uniqueid);break;case"chat":o=Boolean(e[s].ChatWebsiteId);break;case"mail":o=Boolean(e[s].MailAccountId);break;case"sms":o=Boolean(e[s].SmsAccountId);break;case"fax":o=Boolean(e[s].FaxAccountId);break;case"openchannel":o=Boolean(e[s].OpenchannelAccountId);break;default:o=!0}o&&n&&a&&(o=moment(e[s].createdAt).isBetween(n,a)),o&&i.push(e[s])}return i}}).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,t,n,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,n.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,t){try{(t=JSON.parse(t)).size=e.size,c.message.attachments.push(t)}catch(e){console.error(e)}},c.fileAdded=function(e){var t=["pdf","tif"];if(!_.includes(t,e.getExtension()))return l.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extensions: "+t.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 t="";e.firstName&&e.firstName!==e.fax&&(t+=e.firstName+" ");e.lastName&&e.lastName!==e.fax&&(t+=e.lastName+" ");return t+="<"+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 t=e;if(_.isObject(e))return e.fax;if(n=t,!/[&\/\\#,()$~%.'":;*?<>{}\s\\|a-zA-Z\pS!òàùè…_§°çéì-]/.test(n))return t;var n;return l.error("Fax "+t+" is not valid"),null},c.closeDialog=function(){s.draft=c.message,n.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(t,e,i,n,s,o,a,r,l,d,c,m){var u=this,p=25,g=1024*p*1024;switch(u.currentUser=c.getCurrentUser(),u.secret="note"===a,u.hiddenCC=!0,u.hiddenBCC=!0,u.verifySmtp=!0,u.errors=[],u.separatorKeys=[n.KEY_CODE.ENTER,n.KEY_CODE.COMMA,n.KEY_CODE.TAB],u.searchTextChange=function(t){var n=d.defer(),a=[];return r.cannedAnswer.get({filter:t,MailAccountId:s.id}).$promise.then(function(e){return a=_.concat(a,e.rows),r.cannedAnswer.get({filter:t}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),n.resolve(a)}).catch(function(e){n.reject(e)}),n.promise},u.selectedItemChange=function(t){if(t&&t.value&&u.ckEditorInstance)try{var e=_.template(t.value),n={user:u.currentUser,account:s,interaction:m,contact:m&&m.Contact?m.Contact:{}};u.ckEditorInstance.insertHtml(e(n))}catch(e){console.error(e),u.ckEditorInstance.insertHtml(t.value)}document.getElementById("html-area").focus(),u.selectedItem=null},u.onReadyEditor=function(e){try{u.ckEditorInstance=CKEDITOR.instances["html-area"]}catch(e){console.error("Unable to get Html Editor instance",e)}},_.templateSettings.interpolate=/{{([\s\S]+?)}}/g,u.fromTemplate=_.template("{{ name }} <{{ email }}>"),u.replyTemplate=_.template("On {{ date }}, at {{ time }}, {{ from }} wrote:"),u.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 }}"),u.message={from:u.fromTemplate({name:s.name,email:s.email||s.Smtp.user}),to:[],cc:[],bcc:[],body:f(),type:a,attachments:[],showLastMessage:!0},u.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:u.secret?160:300,autoGrow_maxHeight:e.innerHeight-400,autocorrect_enabled:!0,disableNativeSpellChecker:!1,font_defaultLabel:s.fontFamily?s.fontFamily.split(",")[0]:"Arial",fontSize_defaultLabel:s.fontSize||"12",removePlugins:"magicline"},u.ngFlowOptions={target:"api/attachments",singleFile:!0,maxChunkRetries:1,chunkSize:g,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},u.ngFlow={flow:{}},u.reply=function(e){angular.isDefined(o)&&(u.message.type="reply",u.message.to="in"===o.direction?o.from.split(","):o.to.split(","),u.message.subject=_.startsWith(o.subject,"Re:")?o.subject:"Re: "+o.subject,u.message.inReplyTo=o.messageId,u.message.body=o.draft&&o.draft.inReplyTo?o.draft.body:f(),u.message.attachments=o.draft?o.draft.attachments:[],e&&o.cc&&(u.hiddenCC=!1,u.message.cc=o.cc.split(",")),u.message.showLastMessage=!!o.draft&&o.draft.showLastMessage)},u.newMail=function(){angular.isDefined(o)&&(u.message.type="new",u.message.to=o.to?o.to.split(","):[])},u.forward=function(){if(angular.isDefined(o)){if(u.message.type="forward",u.message.subject=_.startsWith(o.subject,"Fwd:")?o.subject:"Fwd: "+o.subject,u.message.body=o.draft&&!o.draft.inReplyTo?o.draft.body:f(),o.Attachments&&o.Attachments.length)for(var e=0;e<o.Attachments.length;e++)u.message.attachments.push(o.Attachments[e]);u.message.showLastMessage=!!o.draft&&o.draft.showLastMessage}},u.send=function(e,t,n){if(u.message.to&&u.message.body)if(u.message.to.length)if(o.draft=void 0,_.isEmpty(u.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(){v(t,n)})}else v(t,n);else l.error("To is mandatory")},u.note=function(){u.type="note",u.secret=!0,u.message.body='<div style="font-family:'+s.fontFamily+";font-size:"+s.fontSize+'px"><p></p></div>'},u.addNote=function(){u.message.body&&(u.message.draft=void 0,i.hide({secret:!0,body:u.message.body,attach:u.message.attachments.length,attachments:u.message.attachments}))},u.upload=function(e){u.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+t.get("motion.token")},u.ngFlow.flow.upload()},u.fileSuccess=function(e,t){try{(t=JSON.parse(t)).size=e.size,u.message.attachments.push(t)}catch(e){console.error(e)}},u.deleteAttachment=function(e){u.message.attachments=_.reject(u.message.attachments,{id:e.id}),r.attachment.delete({id:e.id}).$promise.then(function(){l.success({title:"Attachment deleted!",msg:e.name?e.name+" has been deleted!":""})})},u.fileAdded=function(e){if(e.size>g)return l.error({title:"File too big",msg:"The max allowed size is "+p+"MB"}),!1;return!0},u.getContact=function(e){var t="";e.firstName&&e.firstName!==e.email&&(t+=e.firstName+" ");e.lastName&&e.lastName!==e.email&&(t+=e.lastName+" ");return t+="<"+e.email+">"},u.contactSearch=function(e){return s&&s.ListId?r.cmContact.get({ListId:s.ListId,nolimit:!0,filter:e,fields:"firstName,lastName,email"}).$promise.then(function(e){return e.rows}):[]},u.transformContact=function(e,t){if(_.isObject(e))return e.email;if(_.isString(e)){if(h(e))return e;for(var n=e.split(","),a=0;a<n.length;a+=1)h(n[a])?_.isArray(t)&&_.indexOf(t,n[a])<0&&t.push(n[a]):l.error("Email "+n[a]+" is not valid");return null}return l.error("Email field is not valid"),null},u.closeDialog=function(){angular.isDefined(o)&&(o.draft=u.message);i.cancel()},u.loadLastMessage=function(){u.message.body+=b(u.message.type)},a){case"reply":u.reply(!1);break;case"replyAll":u.reply(!0);break;case"forward":u.forward();break;case"new":u.newMail();break;case"note":u.note()}function v(e,t){var n={from:u.message.from,to:u.message.to.join(","),cc:u.message.cc.join(","),bcc:u.message.bcc.join(","),subject:u.message.subject,body:u.message.showLastMessage?u.message.body:u.message.body+b(u.message.type),inReplyTo:u.message.inReplyTo,attach:u.message.attachments.length,attachments:u.message.attachments,Interaction:{lastMsgAt:moment().format("YYYY-MM-DD HH:mm:ss"),lastMsgDirection:"out",lastMsgBody:u.message.body,substatus:t,substatusAt:moment().format("YYYY-MM-DD HH:mm:ss")}};n.html='<div id="xm-mail-content">'+_.replace(n.body,'<div id="xm-mail-content"',"<div")+"</div>",e&&(n.Interaction.closed=!0,n.Interaction.closedAt=moment().format("YYYY-MM-DD HH:mm:ss")),i.hide(n)}function h(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 f(){return'<div style="font-family:'+s.fontFamily+";font-size:"+s.fontSize+'px">'+function(){if(_.isNil(s.template))return"";try{return _.template(s.template)({user:u.currentUser,account:s,interaction:m,contact:m&&m.Contact?m.Contact:{}})}catch(e){return console.error(e),""}}()+"</div>"}function b(e){var t,n,a='<div id="xm-mail-content"><blockquote type="cite">';switch(e){case"reply":case"replyAll":a+=u.replyTemplate({date:moment(o.createdAt).format("D MMM YYYY")||"",time:moment(o.createdAt).format("HH:mm")||"",from:_.escape(o.from)||""});break;case"forward":a+=u.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)||""})}return a+="<br><br>",a+=(t=o.body?_.replace(o.body,'<div id="xm-mail-content"',"<div"):"",(n=t.match(/\<body[^>]*\>([^]*)\<\/body/m))?n[1]:t),a+="</blockquote></div>",e?a:""}r.mailSubstatus.get({nolimit:!0}).$promise.then(function(e){u.subStatuses=e||{count:0,rows:[]}}).catch(function(e){console.error(e)}),u.secret||r.mailAccount.verifySmtp({id:s.id}).$promise.catch(function(e){u.verifySmtp=!1,u.errors.push({message:e.data,type:e.status}),u.errors.push({message:"You can't reply or send an email. Please contact the administrator!",type:"500"})})}e.$inject=["$cookies","$window","$mdDialog","$mdConstant","account","message","type","api","toasty","$q","Auth","interaction"],angular.module("app.dashboards").controller("ComposeMailInteractionDialogController",e)}(),function(){"use strict";function e(e,t,n,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(t){var n=c.defer(),a=[];return l.cannedAnswer.get({filter:t,OpenchannelAccountId:s.id}).$promise.then(function(e){return a=_.concat(a,e.rows),l.cannedAnswer.get({filter:t}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),n.resolve(a)}).catch(function(e){n.reject(e)}),n.promise},p.selectedItemChange=function(t){if(t){try{_.templateSettings.interpolate=/{{([\s\S]+?)}}/g;var e=_.template(t.value),n={user:p.currentUser,account:s};p.message.body+=" "+e(n),p.ctrlMethods.setText(p.message.body)}catch(e){p.message.body+=" "+t.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?(t=p.message.body,a.hide({to:p.message.to.join(","),body:t})):d.error("To is mandatory"));var t},p.getContact=function(e){var t="";e.firstName&&e.firstName!==e[s.mapKey]&&(t+=e.firstName+" ");e.lastName&&e.lastName!==e[s.mapKey]&&(t+=e.lastName+" ");return t+="<"+e[s.mapKey]+">"},p.closeDialog=function(){a.cancel()},p.contactSearch=function(e){if(s&&s.ListId){var t="firstName,lastName,phone,mobile";return s.mapKey&&(t+=","+s.mapKey),l.cmContact.get({ListId:s.ListId,nolimit:!0,filter:e,fields:t}).$promise.then(function(e){return e.rows})}return[]},p.transformContact=function(e){var t=e;if(_.isObject(t))return e[s.mapKey];return t},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,t,n,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(t){var n=c.defer(),a=[];return l.cannedAnswer.get({filter:t,SmsAccountId:s.id}).$promise.then(function(e){return a=_.concat(a,e.rows),l.cannedAnswer.get({filter:t}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),n.resolve(a)}).catch(function(e){n.reject(e)}),n.promise},p.selectedItemChange=function(t){if(t){try{_.templateSettings.interpolate=/{{([\s\S]+?)}}/g;var e=_.template(t.value),n={user:p.currentUser,account:s};p.message.body+=" "+e(n),p.ctrlMethods.setText(p.message.body)}catch(e){p.message.body+=" "+t.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?(t=p.message.body,a.hide({to:p.message.to.join(","),body:t})):d.error("To is mandatory"));var t},p.getContact=function(e){var t="";e.firstName&&e.firstName!==e.mobile&&(t+=e.firstName+" ");e.lastName&&e.lastName!==e.mobile&&(t+=e.lastName+" ");return t+="<"+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 t=e;if(_.isObject(t))return e.mobile;if(n=t,/^(\+|\d)[0-9]{7,16}$/.test(n))return t;var n;return d.error("Mobile "+t+" 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(t,n,a,i,s,o){var r=this;function l(){r.mandatoryDisposition&&a.user.pause({id:o.id,type:r.mandatoryDispositionPause||"DEFAULT PAUSE"}).$promise.then(function(e){}).catch(function(e){console.error(e)})}function d(e){r.mandatoryDisposition&&a.user.unpause({id:o.id}).$promise.catch(function(e){console.error(e)}),t.hide(e)}r.errors=[],r.interaction=angular.copy(i),r.dispositions={count:0,rows:[]},r.globalDispositions={count:0,rows:[]},r.channel=s,r.interactionMethod=r.channel+"Interaction",r.interaction.disposition||(r.interaction.disposition=null),r.mandatoryDisposition=!0,r.mandatoryDispositionPause="",r.saveDisposition=function(e){r.errors=[],r.interaction.closed||(r.interaction.closedAt=Date.now());r.interaction.UserId=o.id,r.interaction.closed=!0,r.interaction.closeReason="agent",a[r.interactionMethod]?a[r.interactionMethod].update(_.pick(r.interaction,["MailAccountId","FaxAccountId","SmsAccountId","ChatWebsiteId","OpenchannelId","closed","closedAt","closeReason","disposition","id","note","UserId"])).$promise.then(function(e){r.interaction=e,n.success({title:"Interaction properly closed!",msg:"Interaction has been closed!"})}).then(function(){d(!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 t=0;t<e.data.errors.length;t++)n.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.variable.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})}):d(!1)},r.closeDialog=d,function(){var e={fields:"id,name",sort:"name",nolimit:!0};switch(s){case"chat":e.ChatWebsiteId=i.ChatWebsiteId,a.chatWebsite.get({id:i.ChatWebsiteId}).$promise.then(function(e){r.mandatoryDisposition=e.mandatoryDisposition,r.mandatoryDisposition&&(r.mandatoryDispositionPause=e.mandatoryDispositionPause.name)}).then(function(){l()});break;case"mail":e[t=_.capitalize(s)+"AccountId"]=i[t],a.mailAccount.get({id:i.MailAccountId}).$promise.then(function(e){r.mandatoryDisposition=e.mandatoryDisposition,r.mandatoryDisposition&&(r.mandatoryDispositionPause=e.mandatoryDispositionPause.name)}).then(function(){l()});break;case"sms":e[t=_.capitalize(s)+"AccountId"]=i[t],a.smsAccount.get({id:i.SmsAccountId}).$promise.then(function(e){r.mandatoryDisposition=e.mandatoryDisposition,r.mandatoryDisposition&&(r.mandatoryDispositionPause=e.mandatoryDispositionPause.name)}).then(function(){l()});break;case"fax":e[t=_.capitalize(s)+"AccountId"]=i[t],a.faxAccount.get({id:i.FaxAccountId}).$promise.then(function(e){r.mandatoryDisposition=e.mandatoryDisposition,r.mandatoryDisposition&&(r.mandatoryDispositionPause=e.mandatoryDispositionPause.name)}).then(function(){l()});break;case"openchannel":var t;e[t=_.capitalize(s)+"AccountId"]=i[t],a.faxAccount.get({id:i.OpenchannelAccountId}).$promise.then(function(e){r.mandatoryDisposition=e.mandatoryDisposition,r.mandatoryDisposition&&(r.mandatoryDispositionPause=e.mandatoryDispositionPause.name)}).then(function(){l()})}a.disposition.get(e).$promise.then(function(e){r.dispositions=e}).catch(function(e){console.error(e)}),a.disposition.get({MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null"}).$promise.then(function(e){r.globalDispositions=e}).catch(function(e){console.error(e)})}()}e.$inject=["$mdDialog","toasty","api","interaction","channel","user"],angular.module("app.dashboards").controller("DisposeInteractionDialogController",e)}(),function(){"use strict";function e(t,n,e,a,i,s){var o=this;function r(e){t.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.interactionMethod])return e[o.interactionMethod].addTags({id:o.interaction.id,ids:_.map(o.interaction.Tags,"id")}).$promise.then(function(){n.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 t=0;t<e.data.errors.length;t+=1)n.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else n.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.interactionMethod=o.channel+"Interaction"}e.$inject=["$mdDialog","toasty","api","interaction","channel","tags"],angular.module("app.dashboards").controller("TagInteractionDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;function d(e){t.hide(e)}l.currentUser=n.getCurrentUser(),l.channel=s.toLowerCase(),l.message=o,l.account=r,l.transfer={id:0,type:"queue"},l.agents=l.queues={count:0,rows:[]},l.queueMethod=l.channel+"Queue",l.queueNotifyMethod=l.channel+"QueueNotify",l.onTransfer=function(){d(!0),e(function(){return a.rpc["agent"===l.transfer.type?"agentNotify":l.queueNotifyMethod]({id:l.transfer.id,messageId:l.message.id,channel:l.channel}).$promise.then(function(e){i.success({title:"Trasfer properly done!",msg:"Transfer "+l.transfer.type+" has been done!"})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){l.errors=e.data.errors||[{message:e.toString(),type:"api.rpc.notify"}];for(var t=0;t<e.data.errors.length;t++)i.error({title:e.data.errors[t].type,msg:e.data.errors[t].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)},l.closeDialog=d,l.init=function(){return a.user.get({fields:"id,name",role:"agent",nolimit:!0}).$promise.then(function(e){return l.agents=e||{count:0,rows:[]},a[l.queueMethod].get({fields:"id,name",nolimit:!0}).$promise}).then(function(e){l.queues=e||{count:0,rows:[]}}).catch(function(e){console.error(e)})},l.init()}e.$inject=["$mdDialog","$timeout","Auth","api","toasty","channel","message","account"],angular.module("app.dashboards").controller("TransferMessageDialogController",e)}(),function(){"use strict";function e(i,s,o,e,l,d,t,n,a,r,c){var m=this;function u(){try{i.$parent.$parent.$parent.vm.updateLocalStorage()}catch(e){d.error({title:"ERROR UPDATE LOCAL TABS",msg:"Error updating locally stored tabs"})}}function p(n,e){var r=t.getCurrentUser();l.jscriptySessionReport.save({starttime:m.starttime,membername:m.call&&m.call.membername?m.call.membername:r.name,calleridname:m.call&&m.call.calleridname?m.call.calleridname:void 0,calleridnum:m.call&&m.call.calleridnum?m.call.calleridnum:void 0,queue:m.call&&m.call.queue?m.call.queue:void 0,uniqueid:m.call&&m.call.uniqueid?m.call.uniqueid:void 0,VoiceQueueId:m.call&&m.call["xmd-voicequeueid"]?m.call["xmd-voicequeueid"]:void 0,ProjectId:m.project&&m.project.id?m.project.id:void 0,projectname:m.project&&m.project.name?m.project.name:void 0,ContactId:m.contact&&m.contact.id?m.contact.id:void 0,completed:e}).$promise.then(function(e){if(e)for(var t=m.getResponseSheetHeaders(),n=m.getResponseSheetRow(),a=m.getQuestionWithResponseList(),i=0;i<t.length;i+=1)if(!_.isEmpty(n[i])){l.jscriptyQuestionReport.save({question:t[i],answer:n[i],questionId:a[i].id,membername:m.call&&m.call.membername?m.call.membername:r.name,calleridname:m.call&&m.call.calleridname?m.call.calleridname:void 0,calleridnum:m.call&&m.call.calleridnum?m.call.calleridnum:void 0,queue:m.call&&m.call.queue?m.call.queue:void 0,uniqueid:m.call&&m.call.uniqueid?m.call.uniqueid:void 0,SessionId:e.id,ProjectId:m.project.id,projectname:m.project.name});for(var s=n[i].toString().split(";"),o=0;o<s.length;o+=1)l.jscriptyAnswerReport.save({question:t[i],questionId:a[i].id,answer:s[o].trim(),membername:m.call&&m.call.membername?m.call.membername:r.name,calleridname:m.call&&m.call.calleridname?m.call.calleridname:void 0,calleridnum:m.call&&m.call.calleridnum?m.call.calleridnum:void 0,queue:m.call&&m.call.queue?m.call.queue:void 0,uniqueid:m.call&&m.call.uniqueid?m.call.uniqueid:void 0,SessionId:e.id,ProjectId:m.project.id,projectname:m.project.name})}return e}).then(function(e){e?n.resolve(!0):n.reject()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.contact.save"}];for(var t=0;t<e.data.errors.length;t+=1)d.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contact.save",msg:e.data?JSON.stringify(e.data.message):e.toString()});n.reject()})}m.formViewer={},m.showResetButton=!0,m.showIncompleteSubmitButton=!1,m.detectBrowser=c.detectBrowser(),m.onSubmit=function(e,t){var n=s.defer();if(t){var a=o.confirm().title("Would you like to save your survey?").textContent("").ariaLabel("survey").targetEvent(e).ok("YES").cancel("NO");o.show(a).then(function(){p(n,!1)},function(){n.resolve()})}else p(n,!0);return n.promise.then(function(e){e&&(d.success({title:"Session saved",msg:"Your survey session has been properly saved!"}),function(e){try{i.$parent.$parent.$parent.vm.removeTab(e)}catch(e){d.error({title:"ERROR REMOVE TAB",msg:"Error while removing tab"})}}(m.tab))}).catch(function(e){d.error({title:"Session save error",msg:"There has been an error while trying to save your survey session!"})})},m.openContact=function(e,t){try{i.$parent.$parent.$parent.vm.addContactTab(t)}catch(e){d.error({title:"ERROR OPEN CONTACT",msg:"Jscripty can't open the contact"})}},m.isJsonString=function(e){if(_.isNil(e))return!1;try{JSON.parse(e)}catch(e){return!1}return!0},m.getResponseSheet=function(){return e.getResponseSheet(m.project.formData,m.project.responseData,!1)},m.getResponseSheetRow=function(){return e.getResponseSheetRow(m.project.formData,m.project.responseData)},m.getResponseSheetHeaders=function(){return e.getResponseSheetHeaders(m.project.formData,!1)},m.getQuestionWithResponseList=function(){return e.getQuestionWithResponseList(m.project.formData,m.project.responseData)},m.init=function(e){m.tab=e,m.tab&&(m.call=m.tab.call,m.starttime=m.tab.openedAt,m.contact=m.tab.contact,m.project=m.tab.project,m.project&&(_.isObjectLike(m.project.formData)?m.project.formData=m.project.formData:m.isJsonString(m.project.formData)?m.project.formData=JSON.parse(m.project.formData):m.project.formData=void 0,m.project.responseData=m.project.responseData||{},void 0!==m.project.currentPage&&r(function(){a.$broadcast("mwForm.pageEvents.changePage",{page:m.project.currentPage})}),i.$on("mwForm.pageEvents.pageCurrentChanged",function(e,t){if(t.currentPage&&(m.project.currentPage=t.currentPage.number-1,u(),m.project.enableUncompleteSave&&(1<=t.currentPage.number&&t.currentPage.number<m.project.formData.pages.length?m.showIncompleteSubmitButton=!0:m.showIncompleteSubmitButton=!1),m.project.formData&&m.project.formData.pages))for(var n=0,a=m.project.formData.pages.length;n<a;n++)if(t.currentPage.number<n+1&&m.project.formData.pages[n].elements)for(var i=0,s=m.project.formData.pages[n].elements.length;i<s;i++)"question"===m.project.formData.pages[n].elements[i].type&&m.project.formData.pages[n].elements[i].question&&delete m.project.responseData[m.project.formData.pages[n].elements[i].question.id]})))},m.resetViewer=function(e){if(m.formViewer.reset){var t=o.confirm().title(n.instant("JSCRIPTY.DO_YOU_WANT_TO_RESET_SESSION")).content(n.instant("JSCRIPTY.ALL_SURVEY_DATA_WILL_BE_LOST")).textContent("").ariaLabel("survey").targetEvent(e).ok(n.instant("JSCRIPTY.YES")).cancel(n.instant("JSCRIPTY.NO"));o.show(t).then(function(){m.showIncompleteSubmitButton=!1,m.project.currentPage=void 0,u(),m.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(n,a,e,t,i){var s=this;function o(){return function(e){if(404===e.status)a.info({title:n.instant("DASHBOARDS.ATTENTION"),msg:n.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 t=0;t<e.data.errors.length;t+=1)a.error({title:e.data.errors[t].type,msg:e.data.errors[t].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(t[s.notification.channel+"Message"])return t[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(t[s.notification.channel+"Message"])return t[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 t=this;t.init=function(e){t.tab=e,t.tab&&(t.tab.saved=!0,t.html=t.tab.html)}})}(),function(){"use strict";function e(e,t,n,a){var i=this,s=[];function o(e,t){e.closed||e.UserId||!t||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!t&&i.inbound.waiting&&(i.inbound.waiting-=1)),e.closed&&"abandoned"===e.disposition?(i.inbound.abandoned+=1,!t&&i.inbound.waiting&&(i.inbound.waiting-=1)):e.closed&&!e.UserId&&e.disposition?(i.inbound.unmanaged+=1,!t&&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,!t&&i.inbound.talking&&(i.inbound.talking-=1)),t&&(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:e.ChatWebsiteId})}function d(e){return moment(e).isBetween(moment().startOf("day").toString(),moment().endOf("day").toString())}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())},t.on("chatInteraction:save",i.onSaveChatInteraction),t.on("chatInteraction:update",i.onUpdateChatInteraction),function(){if(0<Object.keys(i.chatWebsites).length)for(var e=0;e<n.rows.length;e+=1)if(l(n.rows[e])){var t=n.rows[e];o(t,!0),r()}}(),e.$on("$destroy",function(){t.removeAllListeners("chatInteraction:save"),t.removeAllListeners("chatInteraction:update")})}e.$inject=["$scope","socket","chatInteractions","chatWebsites"],angular.module("app.dashboards").controller("UserChatDashboardGeneralController",e)}(),function(){"use strict";function e(e,t,n,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)},n.onWithoutApply("voice_queue:save",l.onSaveQueue),l.interval=t(function(){d(),c()},999),n.onWithoutApply("campaign:save",l.onSaveCampaign),d(),c(),e.$on("$destroy",function(){n.removeAllListeners("voice_queue:save"),n.removeAllListeners("campaign:save"),l.interval&&t.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,t,n,a){var i=this,s=[];function o(e,t){e.closed||e.UserId||!t||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!t&&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,!t&&i.inbound.talking&&(i.inbound.talking-=1)),e.closed&&!e.UserId&&(i.inbound.unmanaged+=1,!t&&i.inbound.waiting&&(i.inbound.waiting-=1)),t&&(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:e.FaxAccountId})}function d(e){return moment(e).isBetween(moment().startOf("day").toString(),moment().endOf("day").toString())}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())},t.on("faxInteraction:save",i.onSaveFaxInteraction),t.on("faxInteraction:update",i.onUpdateFaxInteraction),function(){if(0<Object.keys(i.faxAccounts).length)for(var e=0;e<n.rows.length;e+=1)if(l(n.rows[e])){var t=n.rows[e];o(t,!0),r()}}(),e.$on("$destroy",function(){t.removeAllListeners("faxInteraction:save"),t.removeAllListeners("faxInteraction:update")})}e.$inject=["$scope","socket","faxInteractions","faxAccounts"],angular.module("app.dashboards").controller("UserFaxDashboardGeneralController",e)}(),function(){"use strict";function e(e,t,n,a){var i=this,s=[];function o(e,t){e.closed||e.UserId||!t||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!t&&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,!t&&i.inbound.talking&&(i.inbound.talking-=1)),e.closed&&!e.UserId&&(i.inbound.unmanaged+=1,!t&&i.inbound.waiting&&(i.inbound.waiting-=1)),t&&(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:e.MailAccountId})}function d(e){return moment(e).isBetween(moment().startOf("day").toString(),moment().endOf("day").toString())}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())},t.on("mailInteraction:save",i.onSaveMailInteraction),t.on("mailInteraction:update",i.onUpdateMailInteraction),function(){if(0<Object.keys(i.mailAccounts).length)for(var e=0;e<n.rows.length;e+=1)if(l(n.rows[e])){var t=n.rows[e];o(t,!0),r()}}(),e.$on("$destroy",function(){t.removeAllListeners("mailInteraction:save"),t.removeAllListeners("mailInteraction:update")})}e.$inject=["$scope","socket","mailInteractions","mailAccounts"],angular.module("app.dashboards").controller("UserMailDashboardGeneralController",e)}(),function(){"use strict";function e(e,t,n,a){var i=this,s=[];function o(e,t){e.closed||e.UserId||!t||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!t&&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,!t&&i.inbound.talking&&(i.inbound.talking-=1)),e.closed&&!e.UserId&&(i.inbound.unmanaged+=1,!t&&i.inbound.waiting&&(i.inbound.waiting-=1)),t&&(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:e.OpenchannelAccountId})}function d(e){return moment(e).isBetween(moment().startOf("day").toString(),moment().endOf("day").toString())}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())},t.on("openchannelInteraction:save",i.onSaveOpenchannelInteraction),t.on("openchannelInteraction:update",i.onUpdateOpenchannelInteraction),function(){if(0<Object.keys(i.openchannelAccounts).length)for(var e=0;e<n.rows.length;e+=1)if(l(n.rows[e])){var t=n.rows[e];o(t,!0),r()}}(),e.$on("$destroy",function(){t.removeAllListeners("openchannelInteraction:save"),t.removeAllListeners("openchannelInteraction:update")})}e.$inject=["$scope","socket","openchannelInteractions","openchannelAccounts"],angular.module("app.dashboards").controller("UserOpenchannelDashboardGeneralController",e)}(),function(){"use strict";function e(e,t,n,a){var i=this,s=[];function o(e,t){e.closed||e.UserId||!t||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!t&&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,!t&&i.inbound.talking&&(i.inbound.talking-=1)),e.closed&&!e.UserId&&(i.inbound.unmanaged+=1,!t&&i.inbound.waiting&&(i.inbound.waiting-=1)),t&&(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:e.SmsAccountId})}function d(e){return moment(e).isBetween(moment().startOf("day").toString(),moment().endOf("day").toString())}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())},t.on("smsInteraction:save",i.onSaveSmsInteraction),t.on("smsInteraction:update",i.onUpdateSmsInteraction),function(){if(0<Object.keys(i.smsAccounts).length)for(var e=0;e<n.rows.length;e+=1)if(l(n.rows[e])){var t=n.rows[e];o(t,!0),r()}}(),e.$on("$destroy",function(){t.removeAllListeners("smsInteraction:save"),t.removeAllListeners("smsInteraction:update")})}e.$inject=["$scope","socket","smsInteractions","smsAccounts"],angular.module("app.dashboards").controller("UserSmsDashboardGeneralController",e)}(),function(){"use strict";function e(n){var i=[],s=function(){var n=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(n.queues,function(e,t){n.rpcQueues[t]&&(a.waiting+=n.rpcQueues[t].waiting||0,a.talking+=(n.rpcQueues[t].talking||0)+(n.rpcQueues[t].pTalking||0),a.answered+=n.rpcQueues[t].answered||0,a.abandoned+=n.rpcQueues[t].abandoned||0,a.sumHoldTime+=n.rpcQueues[t].sumHoldTime||0,a.sumBillable+=n.rpcQueues[t].sumBillable||0,a.total+=n.rpcQueues[t].total||0,a.originated+=n.rpcQueues[t].originated||0,a.outboundDropCallsDayCallersExit+=n.rpcQueues[t].outboundDropCallsDayCallersExit||0,a.outboundDropCallsDayTimeout+=n.rpcQueues[t].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(),n.defer.resolve(a),0<i.length&&s()};return function(e){var t=n.defer();return i.push({queues:e.queues,rpcQueues:e.rpcQueues,defer:t}),1===i.length&&s(),t.promise}}function t(n){var i=[],s=function(){var n=i[0],a={originated:0,limitCalls:0};_.forIn(n.rpcCampaigns,function(e,t){n.rpcCampaigns[t]&&(a.originated+=n.rpcCampaigns[t].originated||0,a.limitCalls+=n.rpcCampaigns[t].limitCalls||0)}),i.shift(),n.defer.resolve(a),0<i.length&&s()};return function(e){var t=n.defer();return i.push({rpcCampaigns:e.rpcCampaigns,defer:t}),1===i.length&&s(),t.promise}}function n(e,o,t,n){var r=this;r.hasPermission=function(){return t.hasPermission(101)||t.hasRole("admin")},r.license=n,e.$on("$stateChangeSuccess",function(e,t,n,a,i){var s=[];r.license.voice&&s.push("app.dashboards.general.voice"),r.license.dialer&&s.push("app.dashboards.general.dialer"),r.license.chat&&s.push("app.dashboards.general.chat"),r.license.mail&&s.push("app.dashboards.general.mail"),r.license.messaging&&s.push("app.dashboards.general.sms"),r.license.openchannel&&s.push("app.dashboards.general.openchannel"),r.license.fax&&s.push("app.dashboards.general.fax"),r.selectedTab=_.indexOf(s,t.name),r.selectedTab<0&&(r.selectedTab=0)<s.length&&o.go(_.first(s))})}e.$inject=["$q"],t.$inject=["$q"],n.$inject=["$scope","$state","Auth","license"],angular.module("app.dashboards").filter("secToTime",function(){return function(e){return new Date(1e3*e).toISOString().substr(11,8)}}).factory("initializeRealtimeQueue",e).factory("initializeRealtimeCampaign",t).controller("UserDashboardGeneralController",n)}(),function(){"use strict";function e(e,t,n,a,i,s){var o=this;function r(){s({queues:o.inboundQueues,rpcQueues:o.rpcQueues}).then(function(e){o.inbound=e})}o.inboundQueues=n?_.keyBy(n.rows?n.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},t.on("voice_queue:save",o.onSaveQueue),t.on("voice_outbound:save",o.onSaveOutbound),r(),e.$on("$destroy",function(){t.removeAllListeners("voice_queue:save"),t.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,t,n,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,notificationSound:!0,queueTransferTimeout:300,agentTransferTimeout:300},g.title="FAX.NEW_FAXACCOUNT",g.newFaxAccount=!0),t.params.id&&(g.faxAccount.FaxAccountId=t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.faxAccounts,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The faxAccount will be deleted.").ariaLabel("Delete FaxAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.trunks,{id:e.resourceId})}),n=null;if(g.faxAccount&&(n=_.find(g.trunks,{id:Number(g.faxAccount.TrunkId)})),n&&!_.some(t,["id",n.id])){var a=_.find(g.trunks,{id:n.id});a.canSelect=!1,t.push(a)}g.trunks=t})}else{var n=[],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,n.push(g.trunks[i]));g.trunks=n}}).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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.lists,{id:e.resourceId})}),n=null;if(g.faxAccount&&(n=_.find(g.lists,{id:Number(g.faxAccount.ListId)})),n&&!_.some(t,["id",n.id])){var a=_.find(g.lists,{id:n.id});a.canSelect=!1,t.push(a)}g.lists=t})}else{var n=[],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,n.push(g.lists[i]));g.lists=n}}).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 t(e,t){if(r.faxAccountApps.rows.length){var n=r.faxAccountApps.rows[t]?r.faxAccountApps.rows[t]:r.faxAccountApps.rows[0];i.show({controller:"EditFaxAccountApp"+(n.appType||n.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/apps/"+(n.appType||n.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxAccountApp:n,faxAccount:r.faxAccount,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.faxAccountApps.rows[t]=e:r.faxAccountApps.rows.splice(t,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,t=[],n=0;n<r.faxAccountApps.rows.length;n++,0){var a=r.faxAccountApps.rows[n],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,t=_.concat(t,i,[a],s)}o.faxAccount.addApplications({id:r.faxAccount.id},_.sortBy(t,"priority")).$promise.then(function(e){r.faxAccountApps.rows=e.rows}).catch(function(e){console.error(e)})}function n(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){t(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,t){r.faxAccount=e,r.crudPermissions=void 0!==t?t:{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,t,n){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(n).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.faxAccountApps.rows.splice(t,1),l()},function(){console.log("CANCEL")})},r.getFaxAccountApps=function(){r.promise=o.faxAccount.getApplications(r.query,n).$promise},r.editFaxAccountApp=t,r.editInterval=function(e,t){if(r.faxAccountApps.rows.length){var n=r.faxAccountApps.rows[t]?r.faxAccountApps.rows[t]: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:n.interval,IntervalId:n.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(n.interval=e.interval||"*,*,*,*",n.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 t=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(t).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,t,n,o,r,l,d){var c=this;function m(){return a(function(n,t){return a(function(t,n){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.faxAccount.getAgents({id:c.faxAccount.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return t.penalty=e.UserFaxAccount?"penalty "+e.UserFaxAccount.penalty:"",t.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=l.getCurrentUser(),c.faxAccount=t,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(n,t){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.faxAccount.removeAgents({id:c.faxAccount.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.faxAccount.addAgents({id:c.faxAccount.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,items:[],selectedItems:[],showSelectAndDeselectAll:!o,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("FAX.ALL_AGENTS"),labelSelected:r.instant("FAX.SELECTED_AGENTS"),transferCallback:function(e,t){var n=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(n)}}}e.$inject=["$mdDialog","$q","toasty","api","faxAccount","faxAccounts","realtime","$translate","Auth","crudPermissions"],angular.module("app.fax").controller("FaxAccountagentaddController",e)}(),function(){"use strict";function e(t,e,n,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"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){t.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 t=_.find(l.agents,{name:l.agent.agent});t&&(l.agent.UserId=t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),n=null;if(l.agent&&(n=_.find(l.agents,{name:l.agent.agent})),n&&!_.some(t,["id",n.id])){var a=_.find(l.agents,{id:n.id});a.canSelect=!1,t.push(a)}l.agents=t})}else{var n=[],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,n.push(l.agents[i]));l.agents=n}}).catch(function(e){n.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(t,e,n,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"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){t.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(t,e,n,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"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){t.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(t,e,n,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"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){t.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,t,n,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 E(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var t=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),n=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(t+"-"+n)}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 A(e){t.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=E(),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!":""}),A()}).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=E(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),A(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var t=_.find(c.intervals,{id:e.id});t&&_.merge(t,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),A()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=A,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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=e&&e.rows?e.rows:[],n=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(t,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,n.push(e))}),c.intervals=n})}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(t,e,n,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"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){t.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(t,e,n,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"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){t.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 t=_.find(l.queues,{name:l.queue.queue});t&&(l.queue[_.capitalize("fax")+"QueueId"]=t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),n=null;if(l.queue&&(n=_.find(l.queues,{name:l.queue.queue})),n&&!_.some(t,["id",n.id])){var a=_.find(l.queues,{id:n.id});a.canSelect=!1,t.push(a)}l.queues=t})}else{var n=[],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,n.push(l.queues[i]));l.queues=n}}).catch(function(e){n.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(t,e,n,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"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){t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),n=null;if(l.system&&(n=_.find(l.variables,{name:l.system.variable})),n&&!_.some(t,["id",n.id])){var a=_.find(l.variables,{id:n.id});a.canSelect=!1,t.push(a)}l.variables=t})}else{var n=[],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,n.push(l.variables[i]));l.variables=n}}).catch(function(e){n.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(t,e,n,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"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){t.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 t=_.find(l.tags,{name:l.tag.tag});t&&(l.tag.TagId=t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),n=null;if(l.tag&&(n=_.find(l.tags,{name:l.tag.tag})),n&&!_.some(t,["id",n.id])){var a=_.find(l.tags,{id:n.id});a.canSelect=!1,t.push(a)}l.tags=t})}else{var n=[],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,n.push(l.tags[i]));l.tags=n}}).catch(function(e){n.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,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.faxAccount={},c.faxAccountFaxDispositions={count:0,rows:[]},c.selectedFaxAccountFaxDispositions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,name",limit:10,page:1},c.init=function(e,t){c.faxAccount=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.faxAccount.id,c.query.FaxAccountId=c.faxAccount.id,c.getFaxAccountFaxDispositions()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the faxDisposition?").htmlContent("<b>"+(e.name||"faxDisposition")+"</b> will be deleted.").ariaLabel("delete faxDisposition").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getFaxAccountFaxDispositions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.faxAccount.getDispositions(c.query,p).$promise},c.createOrEditFaxAccountFaxDisposition=function(e,t){s.show({controller:"CreateOrEditFaxDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/faxDispositions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxAccount:c.faxAccount,faxDisposition:t,faxDispositions:c.faxAccountFaxDispositions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedFaxAccountFaxDispositions=function(){var e=angular.copy(c.selectedFaxAccountFaxDispositions);return c.selectedFaxAccountFaxDispositions=[],e},c.deleteFaxAccountFaxDisposition=g,c.deleteSelectedFaxAccountFaxDispositions=function(e){var t=s.confirm().title("Are you sure want to delete the selected faxDispositions?").htmlContent("<b>"+c.selectedFaxAccountFaxDispositions.length+" selected</b> will be deleted.").ariaLabel("delete faxDispositions").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedFaxAccountFaxDispositions.forEach(function(e){g(e)}),c.selectedFaxAccountFaxDispositions=[]})};var m=!0,u=1;function p(e){c.faxAccountFaxDispositions=e||{count:0,rows:[]}}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){_.remove(c.faxAccountFaxDispositions.rows,{id:e.id}),c.faxAccountFaxDispositions.count-=1,c.faxAccountFaxDispositions.rows.length||c.getFaxAccountFaxDispositions(),r.success({title:"FaxDisposition deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETfaxAccount"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getFaxAccountFaxDispositions())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.fax").controller("FaxAccountFaxDispositionsController",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(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_FAXDISPOSITION",g.faxDisposition=angular.copy(l),g.faxDispositions=r,g.newFaxDisposition=!1,g.faxDisposition||(g.faxDisposition={},g.title="FAX.NEW_FAXDISPOSITION",g.newFaxDisposition=!0),t.params.id&&(g.faxDisposition.FaxAccountId=t.params.id),g.addNewFaxDisposition=function(){g.errors=[],d.disposition.save(g.faxDisposition).$promise.then(function(e){g.faxDispositions.unshift(e.toJSON()),o.success({title:"FaxDisposition properly created",msg:g.faxDisposition.name?g.faxDisposition.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.disposition.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveFaxDisposition=function(){g.errors=[],d.disposition.update({id:g.faxDisposition.id},g.faxDisposition).$promise.then(function(e){var t=_.find(g.faxDispositions,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"FaxDisposition properly saved!",msg:g.faxDisposition.name?g.faxDisposition.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.disposition.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteFaxDisposition=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The faxDisposition will be deleted.").ariaLabel("Delete FaxDisposition").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.disposition.delete({id:g.faxDisposition.id}).$promise.then(function(){_.remove(g.faxDispositions,{id:g.faxDisposition.id}),o.success({title:"FaxDisposition properly deleted!",msg:(g.faxDisposition.name||"faxDisposition")+" has been deleted!"}),v(g.faxDisposition)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.disposition.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.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","faxDispositions","faxDisposition","api","Auth","license","setting","crudPermissions"],angular.module("app.fax").controller("CreateOrEditFaxDispositionDialogController",e)}(),function(){"use strict";function e(e,a,t,n,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.faxAccount={},c.faxAccountInteractions={count:0,rows:[]},c.selectedFaxAccountInteractions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,Contact.firstName,Owner.name,closedAt,disposition,note,UserId,ContactId,FaxAccountId,tag",sort:"-createdAt",includeAll:"true",limit:10,page:1},c.init=function(e,t){c.faxAccount=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.faxAccount.id,c.getFaxAccountInteractions()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.faxInteractionDownload=function(s,e,t){return l.faxInteraction.download({id:s.id,exists:!0,attachments:t}).$promise.then(function(e){var t=[e.buffer],n="interaction"+s.id,a=new Blob(t,{type:e.type});n="fax-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.success=p,c.getFaxAccountInteractions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.faxAccount.getInteractions(c.query,p).$promise},c.createOrEditFaxAccountInteraction=function(e,t){s.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/interactions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxAccount:c.faxAccount,interaction:t,interactions:c.faxAccountInteractions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.spyfaxInteraction=function(e,n){s.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,t){e.vm.init({id:1,channel:"fax",interaction:n,spy:!0},a.$parent.vm.setting)}})},c.exportSelectedFaxAccountInteractions=function(){var e=angular.copy(c.selectedFaxAccountInteractions);return c.selectedFaxAccountInteractions=[],e},c.deleteFaxAccountInteraction=g,c.deleteSelectedFaxAccountInteractions=function(e){var t=s.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+c.selectedFaxAccountInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedFaxAccountInteractions.forEach(function(e){g(e)}),c.selectedFaxAccountInteractions=[]})};var m=!0,u=1;function p(e){c.faxAccountInteractions=e||{count:0,rows:[]}}function g(e){l.faxInteraction.delete({id:e.id}).$promise.then(function(){_.remove(c.faxAccountInteractions.rows,{id:e.id}),c.faxAccountInteractions.count-=1,c.faxAccountInteractions.rows.length||c.getFaxAccountInteractions(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETfaxAccount"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}a.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getFaxAccountInteractions())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.fax").controller("FaxAccountInteractionsController",e)}(),function(){"use strict";function e(n,e,a,i,s,t,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=t,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.faxAccount=c||n.params.faxAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=n.params.tab||0,u.gotogoto=function(e,t){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:910}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.fax.realtime.accounts",{})}},u.agentadddialog=function(e,t){a.show({controller:"FaxAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:t,clickOutsideToClose:!0,locals:{faxAccount:e,faxAccounts:u.faxAccounts?u.faxAccounts.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoFaxAccounts=function(){n.go("app.fax.faxAccounts")},u.saveFaxAccount=function(){r.faxAccount.updateAccountApplications(u.faxAccount).$promise.then(function(){l.success({title:"FaxAccount updated!",msg:u.faxAccount.name?u.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){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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.trunks,{id:e.resourceId})}),n=null;if(u.faxAccount&&(n=_.find(u.trunks,{id:Number(u.faxAccount.TrunkId)})),n&&!_.some(t,["id",n.id])){var a=_.find(u.trunks,{id:n.id});a.canSelect=!1,t.push(a)}u.trunks=t})}else{var n=[],a=null;u.faxAccount&&(a=_.find(u.trunks,{id:Number(u.faxAccount.TrunkId)}));for(var i=0;i<u.trunks.length;i++)a&&u.trunks[i].id===a.id&&(u.trunks[i].canSelect=!1,n.push(u.trunks[i]));u.trunks=n}}).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){u.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){u.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.lists,{id:e.resourceId})}),n=null;if(u.faxAccount&&(n=_.find(u.lists,{id:Number(u.faxAccount.ListId)})),n&&!_.some(t,["id",n.id])){var a=_.find(u.lists,{id:n.id});a.canSelect=!1,t.push(a)}u.lists=t})}else{var n=[],a=null;u.faxAccount&&(a=_.find(u.lists,{id:Number(u.faxAccount.ListId)}));for(var i=0;i<u.lists.length;i++)a&&u.lists[i].id===a.id&&(u.lists[i].canSelect=!1,n.push(u.lists[i]));u.lists=n}}).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){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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.pauses,{id:e.resourceId})});u.pauses.forEach(function(e){_.some(t,["id",e.id])||(e.canSelect=!1),t.push(e)}),u.pauses=t})}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","faxAccount","userProfileSection"],angular.module("app.fax").controller("FaxAccountController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.faxAccounts=l||{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="faxAccounts",b.listOrder="",b.listOrderAsc=null,b.selectedFaxAccounts=[],b.query={fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,ecm,minrate,maxrate,modem,gateway,faxdetect,t38timeout,tech,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,page:1},b.arrayecm=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.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"),"")}),b.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"),"")}),b.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"),"")}),b.editstate=function(e,t){n.go("app.fax.faxAccounts.edit",{id:e.id,faxAccount:e,crudPermissions:b.crudPermissions})},b.interactionsgoto=function(e,t){n.go("app.fax.faxAccounts.edit",{id:e.id,tab:5})},b.gotorealtimegoto=function(e,t){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:910}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.fax.realtime.accounts",{})}},b.agentadddialog=function(e,t){i.show({controller:"FaxAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{faxAccount:e,faxAccounts:b.faxAccounts?b.faxAccounts.rows:[],crudPermissions:b.crudPermissions,realtime:!1}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getFaxAccounts=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.faxAccount.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="FaxAccounts",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditFaxAccount=function(e,t){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:t,faxAccounts:b.faxAccounts.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteFaxAccount=S,b.exportSelectedFaxAccounts=function(){var e=angular.copy(b.selectedFaxAccounts);return b.selectedFaxAccounts=[],e},b.deleteSelectedFaxAccounts=function(e){var t=i.confirm().title("Are you sure want to delete the selected faxAccounts?").htmlContent("<b>"+b.selectedFaxAccounts.length+" selected</b> will be deleted.").ariaLabel("delete FaxAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedFaxAccounts.forEach(function(e){S(e)}),b.selectedFaxAccounts=[]})},b.deselectFaxAccounts=function(){b.selectedFaxAccounts=[]},b.selectAllFaxAccounts=function(){b.selectedFaxAccounts=b.faxAccounts.rows},g.hasRole("admin")?m.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){b.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){b.trunks=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(b.trunks,{id:e.resourceId})}),a=null;a=[],b.faxAccounts.rows.forEach(function(e){var t=_.find(b.trunks,{id:Number(e.TrunkId)});a.push(t)}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(b.trunks,{id:e.id});t.canSelect=!1,n.push(t)}}),b.trunks=n})}else{var n=[],a=[];b.faxAccounts.rows.forEach(function(e){var t=_.find(b.trunks,{id:Number(e.TrunkId)});a.push(t)});for(var i=0;i<b.trunks.length;i++){_.some(a,{id:b.trunks[i].id})&&(b.trunks[i].canSelect=!1,n.push(b.trunks[i]))}b.trunks=n}}).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){b.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){b.lists=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(b.lists,{id:e.resourceId})}),n=null;if(b.faxAccount&&(n=_.find(b.lists,{id:Number(b.faxAccount.ListId)})),n&&!_.some(t,["id",n.id])){var a=_.find(b.lists,{id:n.id});a.canSelect=!1,t.push(a)}b.lists=t})}else{var n=[],a=null;b.faxAccount&&(a=_.find(b.lists,{id:Number(b.faxAccount.ListId)}));for(var i=0;i<b.lists.length;i++)a&&b.lists[i].id===a.id&&(b.lists[i].canSelect=!1,n.push(b.lists[i]));b.lists=n}}).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 E=!0,A=1;function y(e){b.faxAccounts=e||{count:0,rows:[]}}function S(e){m.faxAccount.delete({id:e.id}).$promise.then(function(){_.remove(b.faxAccounts.rows,{id:e.id}),b.faxAccounts.count-=1,b.faxAccounts.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEfaxAccount"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getFaxAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","faxAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.fax").controller("FaxAccountsController",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(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_FAXQUEUE",g.faxQueue=angular.copy(l),g.faxQueues=r,g.newFaxQueue=!1,g.faxQueue||(g.faxQueue={strategy:"beepall",timeout:10},g.title="FAX.NEW_FAXQUEUE",g.newFaxQueue=!0),g.addNewFaxQueue=function(){g.errors=[],d.faxQueue.save(g.faxQueue).$promise.then(function(e){g.faxQueues.unshift(e.toJSON()),o.success({title:"FaxQueue properly created",msg:g.faxQueue.name?g.faxQueue.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.faxQueue.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveFaxQueue=function(){g.errors=[],d.faxQueue.update({id:g.faxQueue.id},g.faxQueue).$promise.then(function(e){var t=_.find(g.faxQueues,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"FaxQueue properly saved!",msg:g.faxQueue.name?g.faxQueue.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.faxQueue.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteFaxQueue=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The faxQueue will be deleted.").ariaLabel("Delete FaxQueue").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.faxQueue.delete({id:g.faxQueue.id}).$promise.then(function(){_.remove(g.faxQueues,{id:g.faxQueue.id}),o.success({title:"FaxQueue properly deleted!",msg:(g.faxQueue.name||"faxQueue")+" has been deleted!"}),v(g.faxQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.faxQueue.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.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(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","faxQueues","faxQueue","api","Auth","license","setting","crudPermissions"],angular.module("app.fax").controller("CreateOrEditFaxQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,t,n,o,r,l,d){var c=this;function m(){return a(function(n,t){return a(function(t,n){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.faxQueue.getAgents({id:c.faxQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return t.penalty=e.UserFaxQueue?"penalty "+e.UserFaxQueue.penalty:"",t.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=l.getCurrentUser(),c.faxQueue=t,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(n,t){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.faxQueue.removeAgents({id:c.faxQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.faxQueue.addAgents({id:c.faxQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,items:[],selectedItems:[],showSelectAndDeselectAll:!o,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("FAX.ALL_AGENTS"),labelSelected:r.instant("FAX.SELECTED_AGENTS"),transferCallback:function(e,t){var n=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(n)}}}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,t,n,o,r){var l=this;function d(){return a(function(n,t){return a(function(t,n){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:l.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return l.allowedItems=_.map(t,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var t=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.faxQueue.getTeams({id:l.faxQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];l.selectedItems=_.map(t,function(e){return _.find(l.items,{id:e.id})}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}l.currentUser=o.getCurrentUser(),l.faxQueue=t,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={readOnly:!l.crudPermissions.canEdit,allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!0,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:n.instant("FAX.ALL_TEAMS"),labelSelected:n.instant("FAX.SELECTED_TEAMS"),transferCallback:function(e,t){var n=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(n)}},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(n,t){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.faxQueue.removeTeams({id:l.faxQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.faxQueue.addTeams({id:l.faxQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},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,t,n,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=t.protocol()+"://"+t.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,t){n.show({controller:"FaxQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{faxQueue:e,faxQueues:u.faxQueues?u.faxQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,t){n.show({controller:"FaxQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:t,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")},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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.faxQueues=l||{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="faxQueues",b.listOrder="",b.listOrderAsc=null,b.selectedFaxQueues=[],b.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"fax",limit:10,page:1},b.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.fax.faxQueues.edit",{id:e.id,faxQueue:e,crudPermissions:b.crudPermissions})},b.teamadddialog=function(e,t){i.show({controller:"FaxQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{faxQueue:e,faxQueues:b.faxQueues?b.faxQueues.rows:[],crudPermissions:b.crudPermissions}})},b.agentadddialog=function(e,t){i.show({controller:"FaxQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{faxQueue:e,faxQueues:b.faxQueues?b.faxQueues.rows:[],crudPermissions:b.crudPermissions,realtime:!1}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.gotorealtimegoto=function(e,t){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:910}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.fax.realtime.queues",{})}},b.success=y,b.getFaxQueues=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.faxQueue.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="FaxQueues",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditFaxQueue=function(e,t){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:t,faxQueues:b.faxQueues.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteFaxQueue=S,b.exportSelectedFaxQueues=function(){var e=angular.copy(b.selectedFaxQueues);return b.selectedFaxQueues=[],e},b.deleteSelectedFaxQueues=function(e){var t=i.confirm().title("Are you sure want to delete the selected faxQueues?").htmlContent("<b>"+b.selectedFaxQueues.length+" selected</b> will be deleted.").ariaLabel("delete FaxQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedFaxQueues.forEach(function(e){S(e)}),b.selectedFaxQueues=[]})},b.deselectFaxQueues=function(){b.selectedFaxQueues=[]},b.selectAllFaxQueues=function(){b.selectedFaxQueues=b.faxQueues.rows};var E=!0,A=1;function y(e){b.faxQueues=e||{count:0,rows:[]}}function S(e){m.faxQueue.delete({id:e.id}).$promise.then(function(){_.remove(b.faxQueues.rows,{id:e.id}),b.faxQueues.count-=1,b.faxQueues.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEfaxQueue"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getFaxQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","faxQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.fax").controller("FaxQueuesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){_.forIn(p.faxAccounts,function(e,t){p.rpcFaxAccounts[t]&&_.merge(e,p.rpcFaxAccounts[t])}),_.forIn(p.faxAccounts,function(t,e){var n={id:e,sort:"-id",direction:"in",limit:1,offset:0,$gte:"createdAt,"+moment().startOf("day").format("YYYY-MM-DD HH:mm:ss")};s.faxAccount.getMessages(n).$promise.then(function(e){return e&&(t.in=e.count||0,t.lastIn=e.rows&&e.rows.length?e.rows[0].createdAt:void 0),n.direction="out",s.faxAccount.getMessages(n).$promise}).then(function(e){e&&(t.out=e.count||0,t.lastOut=e.rows&&e.rows.length?e.rows[0].createdAt:void 0)}).catch(function(e){console.log(e)})})}p.currentUser=u.getCurrentUser(),p.count=l&&l.count?l.count:0,p.faxAccounts=l?_.keyBy(l.rows?l.rows:[],"id"):{},p.rpcFaxAccounts=d?_.keyBy(d.rows?d.rows:[],"id"):{},p.userProfile=c,p.userProfileSection=m&&1==m.count?m.rows[0]:null,p.crudPermissions=u.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.query={sort:"-name",limit:10,page:1},p.success=f,p.$onInit=g,p.getFaxAccounts=function(){p.query.offset=(p.query.page-1)*p.query.limit,u.hasRole("admin")?p.promise=s.faxAccount.get(p.query,f).$promise:(p.query.id=p.userProfile.id,p.query.section="FaxAccounts",p.promise=s.userProfile.getResources(p.query,f).$promise)},p.onSave=function(e){p.faxAccounts[e.id]&&_.merge(p.faxAccounts[e.id],e)},p.onFaxMessageSave=function(e){p.faxAccounts[e.FaxAccountId]&&("in"==e.direction?(p.faxAccounts[e.FaxAccountId].in+=1,p.faxAccounts[e.FaxAccountId].lastIn=e.createdAt):(p.faxAccounts[e.FaxAccountId].out+=1,p.faxAccounts[e.FaxAccountId].lastOut=e.createdAt))},p.goToFaxAccount=function(e,t){i.go("app.fax.faxAccounts.edit",{id:t.id,faxAccount:t})},p.order=[],_.forIn(p.faxAccounts,function(e,t){p.order.push(e.id)}),o.on("faxAccount:save",p.onSave),o.on("faxAccount:update",p.onSave),o.on("faxMessage:save",p.onFaxMessageSave);var v=!0,h=1;function f(e){if(p.faxAccounts=e?_.keyBy(e.rows?e.rows:[],"id"):{},e.rows){p.order=[];for(var t=0;t<e.rows.length;t++)p.order.push(e.rows[t].id)}g()}e.$watch("vm.query.filter",function(e,t){v?n(function(){v=!1}):(t||(h=p.query.page),e!==t&&(p.query.page=1),e||(p.query.page=h),p.getFaxAccounts())}),e.$on("$destroy",function(){o.removeAllListeners("faxAccount:save"),o.removeAllListeners("faxAccount:update"),o.removeAllListeners("faxMessage:save")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$state","api","socket","toasty","faxAccounts","rpcFaxAccounts","userProfile","userProfileSection","Auth"],angular.module("app.fax").controller("FaxAccountsRealtimeController",e)}(),function(){"use strict";function e(e,o,t,n,a,i,s,r,l,d,c,m,u,p,g,v,h,f){var b=this,E=["userpic","online","lastLoginAt","lastPauseAt","pauseType","lastPauseAt","internal","address","chatPause","openchannelPause","mailPause","smsPause","faxPause","voicePause","chatCapacity","openchannelCapacity","mailCapacity","smsCapacity","faxCapacity","chatCurrentCapacity","openchannelCurrentCapacity","mailCurrentCapacity","smsCurrentCapacity","faxCurrentCapacity","chatStatus","openchannelStatus","mailStatus","smsStatus","faxStatus","voiceStatus","chatStatusTime","openchannelStatusTime","mailStatusTime","smsStatusTime","faxStatusTime","voiceStatusTime","queue","destconnectedlinenum","onhold"],A=["chatPause","openchannelPause","mailPause","smsPause","faxPause","voicePause","online"];for(var y in b.currentUser=v.getCurrentUser(),b.availableStates=["ringing","inuse","busy","onhold","not_inuse"],b.pauses=s||{count:0,rows:[]},b.license=h,b.userProfile=p,b.userProfileSection=g&&1==g.count?g.rows[0]:null,b.crudPermissions=v.parseCrudPermissions(b.userProfileSection?b.userProfileSection.crudPermissions:null),b.agents=r?_.keyBy(r.rows?r.rows:[],"id"):{},b.rpcAgents=l?_.keyBy(l.rows?l.rows:[],"id"):{},b.paginatedAgents={},b.load=!1,b.order=[],b.agentInternal={},b.agents)b.agents.hasOwnProperty(y)&&(b.agents[y].init=!0);b.query={limit:10,page:1,order:"fullname",globalStatusFilter:"",pauseTypeFilter:""},b.logout=function(e,t){return d.user.logout({id:e.id,device:"realtime",agent_id:e.id,agent_name:e.name}).$promise.then(function(){m.success({title:"Agent logout",msg:e.fullname+"  properly logout"}),b.agents[e.id]&&(b.agents[e.id].online=!1),b.rpcAgents[e.id]&&(b.rpcAgents[e.id].online=!1),T()}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.queueAdd=function(e,t){n.show({controller:"AgentqueueaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/queueadd/queueadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{agent:e,agents:[],channel:"fax",direction:"inbound",crudPermissions:b.crudPermissions}})},b.pause=function(t,e){return d.user.pause({id:t.id,type:e}).$promise.then(function(e){b.agents[t.id]&&_.merge(b.agents[t.id],_.pick(e,E)),b.rpcAgents[t.id]&&_.merge(b.rpcAgents[t.id],_.pick(e,E)),O(b.agents[t.id])}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.unPause=function(t){return d.user.unpause({id:t.id}).$promise.then(function(e){b.agents[t.id]&&_.merge(b.agents[t.id],_.pick(e,E)),b.rpcAgents[t.id]&&_.merge(b.rpcAgents[t.id],_.pick(e,E)),O(b.agents[t.id])}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.showInfo=function(e){n.show(n.alert().clickOutsideToClose(!0).title("Legend").htmlContent("<div>TODO legend status + state</div>").ok("Ok").targetEvent(e))},b.getAgentStatus=w,b.getAgentGlobalStatus=O,b.isPause=I,b.checkPause=function(e){return"pause"===e},b.isPartialPause=function(e){return"*pause"===e},b.onSave=function(e){b.agents[e.id]&&(_.merge(b.agents[e.id],_.pick(_.omit(e,A),E)),_.merge(b.rpcAgents[e.id],_.pick(_.omit(e,A),E)),O(b.agents[e.id]))},b.onUpdate=function(e){b.agents[e.id]&&(_.merge(b.agents[e.id],_.pick(e,E)),_.merge(b.rpcAgents[e.id],_.pick(e,E)),e.lastPauseAt&&(b.agents[e.id].globalStatusTime=e.lastPauseAt,b.rpcAgents[e.id].globalStatusTime=e.lastPauseAt),O(b.agents[e.id]))},b.onInit=T,b.onConnect=function(e){b.agents[b.agentInternal[e.destaccountcode]]&&(_.merge(b.agents[b.agentInternal[e.destaccountcode]],_.pick(e,["queue","destconnectedlinenum"])),_.merge(b.rpcAgents[b.agentInternal[e.destaccountcode]],_.pick(e,["queue","destconnectedlinenum"])))},b.onComplete=function(e){b.agents[b.agentInternal[e.destaccountcode]]&&(b.agents[b.agentInternal[e.destaccountcode]]=_.omit(b.agents[b.agentInternal[e.destaccountcode]],["queue","destconnectedlinenum"]),b.rpcAgents[b.agentInternal[e.destaccountcode]]=_.omit(b.rpcAgents[b.agentInternal[e.destaccountcode]],["queue","destconnectedlinenum"]))},c.on("user:save",b.onSave),c.on("user:update",b.onUpdate),c.on("user:agentconnect",b.onConnect),c.on("user:agentcomplete",b.onComplete),T();var S=f(function(){b.load&&(b.load=!1,T())},999);function T(e){b.load=!1;var t,n,a=o.defer();b.promise=a.promise,b.filteredAgents=[],b.order=[],_.forIn(b.agents,function(e,t){b.rpcAgents[t]&&_.merge(e,_.pick(_.omit(b.rpcAgents[t],A),E)),O(e),e.online?(b.filteredAgents.push(e),b.agentInternal[e.internal]=t):e.globalStatusTime=_.toNumber(moment().format("x"))}),b.query.globalStatusFilter&&_.remove(b.filteredAgents,function(e){return e.globalStatus!==b.query.globalStatusFilter}),b.query.pauseTypeFilter&&_.remove(b.filteredAgents,function(e){return e.pauseType!==b.query.pauseTypeFilter}),b.query.filter&&_.remove(b.filteredAgents,function(e){return e.fullname.toLowerCase().indexOf(b.query.filter.toLowerCase())<0}),b.filteredAgents=(t=b.filteredAgents,n=_.startsWith(b.query.order,"-")?"desc":"asc",_.orderBy(t,[b.query.order.replace("-","")],[n]));var i=(b.query.page-1)*b.query.limit;b.paginatedAgents=_.drop(b.filteredAgents,i).slice(0,b.query.limit);for(var s=0;s<b.paginatedAgents.length;s+=1)b.order.push(b.paginatedAgents[s].id);a.resolve(),b.load=!0}function I(e){return"pause"===e||"*pause"===e}function C(e){return"idle"===e||"unknown"===e||"unavailable"===e||"ringing"===e||_.isNil(e)}function w(e,t){return"voice"===t?"idle"!==e[t+"Status"]?e[t+"Status"]:e[t+"Pause"]?e[t+"Status"]="pause":"idle":e[t+"Pause"]?e[t+"Status"]="pause":e[t+"Status"]}function O(e){var t="unknown";t=_.every([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],I)?"pause":_.some([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],I)?"*pause":_.every([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],C)?"idle":"busy",e.globalStatus!==t&&(e.globalStatus=t,e.init?(e.init=!1,e.globalStatusTime=I(t)?_.toNumber(moment(e.lastPauseAt).format("x")):_.max([e.voiceStatusTime,e.chatStatusTime,e.mailStatusTime,e.smsStatusTime,e.openchannelStatusTime,e.faxStatusTime])):e.globalStatusTime=_.toNumber(moment().format("x")))}e.$on("$destroy",function(){c.removeAllListeners("user:save"),c.removeAllListeners("user:update"),c.removeAllListeners("user:agentconnect"),c.removeAllListeners("user:agentcomplete"),S&&(f.cancel(S),S=null)})}e.$inject=["$scope","$q","$timeout","$mdDialog","$document","$filter","pauses","agents","rpcAgents","api","socket","toasty","helperClasses","userProfile","userProfileSection","Auth","license","$interval"],angular.module("app.voice").controller("AgentsFaxRealtimeController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this,v=["loggedIn","available","waiting","talking","pTalking","originated","message","dialActive","dialMethod","Trunk","paused"];function h(){var n=[];return _.forIn(g.queues,function(e,t){e.paused=0,e.loggedInDb=0,g.queues[t].agents={},n.push(l.faxQueue.getMembers({id:t}).$promise),g.rpcQueues[t]&&_.merge(e,_.pick(g.rpcQueues[t],v))}),t.all(n).then(function(e){for(var t=0;t<e.length;t+=1)for(var n=0;n<e[t].rows.length;n++)e[t].rows[n].paused&&g.queues[e[t].rows[n].FaxQueueId].paused++,g.queues[e[t].rows[n].FaxQueueId].loggedInDb++,g.queues[e[t].rows[n].FaxQueueId].agents[e[t].rows[n].UserId]=e[t].rows[n].FaxQueueId}).catch(function(e){console.error(e)})}g.currentUser=p.getCurrentUser(),g.count=o.count?o.count:0,g.queues=o?_.keyBy(o.rows?o.rows:[],"id"):{},g.rpcQueues=r?_.keyBy(r.rows?r.rows:[],"id"):{},g.userProfile=m,g.userProfileSection=u&&1==u.count?u.rows[0]:null,g.crudPermissions=p.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),p.hasRole("admin")?g.query={type:"inbound",sort:"-updatedAt",limit:10,page:1}:g.query={id:g.currentUser.id,channel:"fax",type:"inbound",sort:"-updatedAt",limit:10,page:1},g.success=E,g.getQueues=function(){g.query.offset=(g.query.page-1)*g.query.limit,p.hasRole("admin")?g.promise=l.faxQueue.get(g.query,E).$promise:(g.query.id=g.userProfile.id,g.query.section="FaxQueues",g.promise=l.userProfile.getResources(g.query,E).$promise)},g.createOrEditFaxQueue=function(e,t){a.show({controller:"CreateOrEditFaxQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxQueue:t,faxQueues:_.values(g.queues),license:null,setting:null,crudPermissions:g.crudPermissions}})},g.agentAdd=function(e,t){a.show({controller:"FaxQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxQueue:t,faxQueues:g.queues?g.queues.rows:[],realtime:!1,crudPermissions:g.crudPermissions}})},g.updateQueue=function(e){return l.faxQueue.update(e).$promise.then(function(){c.success({title:"Queue properly updated!",msg:e.name?e.name+" has been updated!":""})}).catch(function(e){c.error({title:"Error creating queue!",msg:e.message})})},g.onSave=function(e){g.queues[e.id]&&_.merge(g.queues[e.id],_.pick(e,v))},g.onSaveMember=function(e){g.queues[e.FaxQueueId]&&g.queues[e.FaxQueueId].loggedInDb++},g.onRemoveMember=function(e){g.queues[e.FaxQueueId]&&g.queues[e.FaxQueueId].loggedInDb--},g.onPause=function(n){console.log("onPause",n),n.voicePause?_.forIn(g.queues,function(e,t){e.agents[n.id]&&(e.paused+=1,console.log("pause"))}):n.voicePause||_.forIn(g.queues,function(e,t){e.agents[n.id]&&0<e.paused&&(e.paused-=1,console.log("unpause"))})},g.onLogin=function(e){console.log("onLogged",e),g.queues[e.FaxQueueId]&&(g.queues[e.FaxQueueId].loggedInDb+=1,g.queues[e.FaxQueueId].agents[e.UserId]=e.FaxQueueId)},g.onLogout=function(e){console.log("onLogout",e),g.queues[e.FaxQueueId]&&0<g.queues[e.FaxQueueId].loggedInDb&&(g.queues[e.FaxQueueId].loggedInDb-=1,delete g.queues[e.FaxQueueId].agents[e.UserId])},g.$onInit=h,g.order=[],_.forIn(g.queues,function(e,t){g.order.push(e.id)}),d.on("fax_queue:save",g.onSave),d.on("userFaxQueue:save",g.onSaveMember),d.on("userFaxQueue:remove",g.onRemoveMember),d.on("user:update",g.onPause),d.on("userVoiceQueue:remove",g.onLogout),d.on("userVoiceQueue:save",g.onLogin);var f=!0,b=1;function E(e){if(g.count=e.count,g.queues=e?_.keyBy(e.rows?e.rows:[],"id"):{},e.rows){g.order=[];for(var t=0;t<e.rows.length;t++)g.order.push(e.rows[t].id)}h()}e.$watch("vm.query.filter",function(e,t){f?n(function(){f=!1}):(t||(b=g.query.page),e!==t&&(g.query.page=1),e||(g.query.page=b),g.getQueues())}),e.$on("$destroy",function(){d.removeAllListeners("fax_queue:save"),d.removeAllListeners("userFaxQueue:remove"),d.removeAllListeners("userFaxQueue:save"),d.removeAllListeners("user:update"),d.removeAllListeners("userVoiceQueue:remove"),d.removeAllListeners("userVoiceQueue:save")})}e.$inject=["$scope","$timeout","$mdDialog","$q","$document","$interval","queues","rpcQueues","api","socket","toasty","userProfile","userProfileSection","Auth"],angular.module("app.fax").controller("QueuesFaxRealtimeController",e)}(),function(){"use strict";angular.module("app.auth").factory("helperClasses",function(){return{status:{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"},state:{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"},channelStatus:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},channelStatusOut:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"}}})}(),function(){"use strict";function e(e,n,t){switch(t.disconnect(),t.connect(),this.selectedTab=0,n.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,n.go("app.fax.realtime.agents")}e.$watch("vm.selectedTab",function(e,t){if(e!==t)switch(e){case 0:n.go("app.fax.realtime.agents");break;case 1:n.go("app.fax.realtime.trunks");break;case 2:n.go("app.fax.realtime.queues");break;case 3:n.go("app.fax.realtime.accounts");break;default:n.go("app.fax.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.fax").controller("FaxRealtimeController",e)}(),function(){"use strict";function e(e,n,t,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,t=0;t<u.trunks.length;t+=1)0<=(e=_.findIndex(u.rpcTrunks,["id",u.trunks[t].id]))&&_.merge(u.trunks[t],_.pick(u.rpcTrunks[e],p))}function v(e,t,n){0<=t&&_.merge(e[t],_.pick(n,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:"-updatedAt",limit:10,page:1},u.statusClass=r.status,u.stateClass=r.state,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){t.show(t.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,t){l.go("app.tools.trunks.edit",{id:t.id})},u.onSave=function(e){var t=_.findIndex(u.trunks,["id",e.id]),n=_.findIndex(u.rpcTrunks,["id",e.id]);v(u.trunks,t,e),v(u.rpcTrunks,n,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,t){h?n(function(){h=!1}):(t||(f=u.query.page),e!==t&&(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","helperClasses","$state","userProfile","userProfileSection","Auth"],angular.module("app.fax").controller("TrunksFaxRealtimeController",e)}(),function(){"use strict";function e(e,t){this.info=e,this.license=t}e.$inject=["info","license"],angular.module("app.help.about").controller("AboutController",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(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:n.protocol()+"://"+n.host()+(n.port()?":"+n.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.deskAccounts,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The deskAccount will be deleted.").ariaLabel("Delete DeskAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.deskAccounts=l||{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="deskAccounts",b.listOrder="",b.listOrderAsc=null,b.selectedDeskAccounts=[],b.query={fields:"createdAt,updatedAt,id,name,type,remoteUri,authType,username,password,serverUrl,description",limit:10,page:1},b.arraytype=_.keyBy([{option:"Integration_Tab",value:"'integrationTab'"},{option:"New_Tab",value:"'newTab'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arrayauthType=_.keyBy([{option:"Basic",value:"'basic'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.integrations.deskAccounts.edit",{id:e.id,deskAccount:e,crudPermissions:b.crudPermissions})},b.testtestintegrationaccount=function(e,t){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()})})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getDeskAccounts=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.intDeskAccount.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="DeskAccounts",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditDeskAccount=function(e,t){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:t,deskAccounts:b.deskAccounts.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteDeskAccount=S,b.exportSelectedDeskAccounts=function(){var e=angular.copy(b.selectedDeskAccounts);return b.selectedDeskAccounts=[],e},b.deleteSelectedDeskAccounts=function(e){var t=i.confirm().title("Are you sure want to delete the selected deskAccounts?").htmlContent("<b>"+b.selectedDeskAccounts.length+" selected</b> will be deleted.").ariaLabel("delete DeskAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedDeskAccounts.forEach(function(e){S(e)}),b.selectedDeskAccounts=[]})},b.deselectDeskAccounts=function(){b.selectedDeskAccounts=[]},b.selectAllDeskAccounts=function(){b.selectedDeskAccounts=b.deskAccounts.rows};var E=!0,A=1;function y(e){b.deskAccounts=e||{count:0,rows:[]}}function S(e){m.intDeskAccount.delete({id:e.id}).$promise.then(function(){_.remove(b.deskAccounts.rows,{id:e.id}),b.deskAccounts.count-=1,b.deskAccounts.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintDeskAccount"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getDeskAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","deskAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.integrations").controller("DeskAccountsController",e)}(),function(){"use strict";function e(a,n,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,t){o.deskAccount=e,o.crudPermissions=void 0!==t?t:{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,t){a.show({controller:"CreateOrEditDeskConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/deskAccounts/edit/configurations/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{deskConfiguration:t,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getDeskConfiguration(0)})},o.deleteDeskConfiguration=function(e,t){var n=a.confirm().title("Are you sure want to delete the deskConfiguration?").htmlContent("<b>"+(t.name||"deskConfiguration")+"</b> will be deleted.").ariaLabel("delete deskConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){i.intDeskConfiguration.delete({id:t.id}).$promise.then(function(){_.remove(o.configurations,{id:t.id}),s.success({title:"DeskConfiguration deleted!",msg:t.name?t.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.selectChangedAdvanced=function(){return i.intSalesforceConfiguration.update({id:o.deskConfiguration.id},o.deskConfiguration).$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.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,t){a.show({controller:"CreateOrEditDeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/deskAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:t,items:o.subjects,configuration:o.deskConfiguration,account:o.deskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,t){var n=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(n).then(function(){r(t)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var t=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(t).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,t){a.show({controller:"CreateOrEditDeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/deskAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:t,items:o.descriptions,configuration:o.deskConfiguration,account:o.deskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,t){var n=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(n).then(function(){l(t)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var t=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(t).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,t){a.show({controller:"CreateOrEditDeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/deskAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:t,items:o.fields,configuration:o.deskConfiguration,account:o.deskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,t){var n=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(n).then(function(){d(t)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var t=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(t).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,t,n,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:t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.configurations,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The deskConfiguration will be deleted.").ariaLabel("Delete DeskConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,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 t=_.find(p.items,{id:e.id});t&&_.merge(t,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 t=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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}).$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,t,n,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=t.protocol()+"://"+t.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")},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,t,n,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_DYNAMICS365ACCOUNT",g.dynamics365Account=angular.copy(l),g.dynamics365Accounts=r,g.newDynamics365Account=!1,g.dynamics365Account||(g.dynamics365Account={serverUrl:n.protocol()+"://"+n.host()+(n.port()?":"+n.port():"")},g.title="INTEGRATIONS.NEW_DYNAMICS365ACCOUNT",g.newDynamics365Account=!0),g.addNewDynamics365Account=function(){g.errors=[],d.intDynamics365Account.save(g.dynamics365Account).$promise.then(function(e){g.dynamics365Accounts.unshift(e.toJSON()),o.success({title:"Dynamics365Account properly created",msg:g.dynamics365Account.name?g.dynamics365Account.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.intDynamics365Account.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})})},g.saveDynamics365Account=function(){g.errors=[],d.intDynamics365Account.update({id:g.dynamics365Account.id},g.dynamics365Account).$promise.then(function(e){var t=_.find(g.dynamics365Accounts,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"Dynamics365Account properly saved!",msg:g.dynamics365Account.name?g.dynamics365Account.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.intDynamics365Account.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})})},g.deleteDynamics365Account=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The dynamics365Account will be deleted.").ariaLabel("Delete Dynamics365Account").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.intDynamics365Account.delete({id:g.dynamics365Account.id}).$promise.then(function(){_.remove(g.dynamics365Accounts,{id:g.dynamics365Account.id}),o.success({title:"Dynamics365Account properly deleted!",msg:(g.dynamics365Account.name||"dynamics365Account")+" has been deleted!"}),v(g.dynamics365Account)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDynamics365Account.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","dynamics365Accounts","dynamics365Account","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditDynamics365AccountDialogController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.dynamics365Accounts=l||{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="dynamics365Accounts",b.listOrder="",b.listOrderAsc=null,b.selectedDynamics365Accounts=[],b.query={fields:"createdAt,updatedAt,id,name,username,password,remoteUri,tenantId,clientId,clientSecret,serverUrl,description",limit:10,page:1},b.editstate=function(e,t){n.go("app.integrations.dynamics365Accounts.edit",{id:e.id,dynamics365Account:e,crudPermissions:b.crudPermissions})},b.testtestintegrationaccount=function(e,t){return m.intDynamics365Account.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"Dynamics365Account properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"Dynamics365Account properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getDynamics365Accounts=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.intDynamics365Account.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Dynamics365Accounts",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditDynamics365Account=function(e,t){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:t,dynamics365Accounts:b.dynamics365Accounts.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 t=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(t).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 E=!0,A=1;function y(e){b.dynamics365Accounts=e||{count:0,rows:[]}}function S(e){m.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(),p.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 t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else p.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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getDynamics365Accounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","dynamics365Accounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.integrations").controller("Dynamics365AccountsController",e)}(),function(){"use strict";function e(a,n,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,t){o.dynamics365Account=e,o.crudPermissions=void 0!==t?t:{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.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,t){a.show({controller:"CreateOrEditDynamics365ConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/edit/configurations/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{dynamics365Configuration:t,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getDynamics365Configuration(0)})},o.deleteDynamics365Configuration=function(e,t){var n=a.confirm().title("Are you sure want to delete the dynamics365Configuration?").htmlContent("<b>"+(t.name||"dynamics365Configuration")+"</b> will be deleted.").ariaLabel("delete dynamics365Configuration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){i.intDynamics365Configuration.delete({id:t.id}).$promise.then(function(){_.remove(o.configurations,{id:t.id}),s.success({title:"Dynamics365Configuration deleted!",msg:t.name?t.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.selectChangedAdvanced=function(){return i.intSalesforceConfiguration.update({id:o.dynamics365Configuration.id},o.dynamics365Configuration).$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,t){a.show({controller:"CreateOrEditDynamics365AccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:t,items:o.subjects,configuration:o.dynamics365Configuration,account:o.dynamics365Account,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,t){var n=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(n).then(function(){r(t)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var t=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(t).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,t){a.show({controller:"CreateOrEditDynamics365AccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:t,items:o.descriptions,configuration:o.dynamics365Configuration,account:o.dynamics365Account,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,t){var n=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(n).then(function(){l(t)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var t=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(t).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,t){a.show({controller:"CreateOrEditDynamics365AccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:t,items:o.fields,configuration:o.dynamics365Configuration,account:o.dynamics365Account,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,t){var n=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(n).then(function(){d(t)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var t=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(t).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,t,n,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:t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.configurations,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The dynamics365Configuration will be deleted.").ariaLabel("Delete Dynamics365Configuration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,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 t=_.find(p.items,{id:e.id});t&&_.merge(t,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 t=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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}).$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,t,n,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=t.protocol()+"://"+t.host(),u.dynamics365Account=c||e.params.dynamics365Account||{},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.gotoDynamics365Accounts=function(){e.go("app.integrations.dynamics365Accounts")},u.saveDynamics365Account=function(){r.intDynamics365Account.update({id:u.dynamics365Account.id},u.dynamics365Account).$promise.then(function(){l.success({title:"Dynamics365Account updated!",msg:u.dynamics365Account.name?u.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","userProfileSection"],angular.module("app.integrations").controller("Dynamics365AccountController",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(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:n.protocol()+"://"+n.host()+(n.port()?":"+n.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.freshdeskAccounts,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The freshdeskAccount will be deleted.").ariaLabel("Delete FreshdeskAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,n,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,t){o.freshdeskAccount=e,o.crudPermissions=void 0!==t?t:{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,t){a.show({controller:"CreateOrEditFreshdeskConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/configurations/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{freshdeskConfiguration:t,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getFreshdeskConfiguration(0)})},o.deleteFreshdeskConfiguration=function(e,t){var n=a.confirm().title("Are you sure want to delete the freshdeskConfiguration?").htmlContent("<b>"+(t.name||"freshdeskConfiguration")+"</b> will be deleted.").ariaLabel("delete freshdeskConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){i.intFreshdeskConfiguration.delete({id:t.id}).$promise.then(function(){_.remove(o.configurations,{id:t.id}),s.success({title:"FreshdeskConfiguration deleted!",msg:t.name?t.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.selectChangedAdvanced=function(){return i.intSalesforceConfiguration.update({id:o.freshdeskConfiguration.id},o.freshdeskConfiguration).$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.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,t){a.show({controller:"CreateOrEditFreshdeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:t,items:o.subjects,configuration:o.freshdeskConfiguration,account:o.freshdeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,t){var n=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(n).then(function(){r(t)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var t=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(t).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,t){a.show({controller:"CreateOrEditFreshdeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:t,items:o.descriptions,configuration:o.freshdeskConfiguration,account:o.freshdeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,t){var n=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(n).then(function(){l(t)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var t=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(t).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,t){a.show({controller:"CreateOrEditFreshdeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:t,items:o.fields,configuration:o.freshdeskConfiguration,account:o.freshdeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,t){var n=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(n).then(function(){d(t)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var t=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(t).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,t,n,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:t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.configurations,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The freshdeskConfiguration will be deleted.").ariaLabel("Delete FreshdeskConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,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 t=_.find(p.items,{id:e.id});t&&_.merge(t,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 t=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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}).$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,t,n,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=t.protocol()+"://"+t.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")},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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.freshdeskAccounts=l||{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="freshdeskAccounts",b.listOrder="",b.listOrderAsc=null,b.selectedFreshdeskAccounts=[],b.query={fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",limit:10,page:1},b.editstate=function(e,t){n.go("app.integrations.freshdeskAccounts.edit",{id:e.id,freshdeskAccount:e,crudPermissions:b.crudPermissions})},b.testtestintegrationaccount=function(e,t){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()})})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getFreshdeskAccounts=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.intFreshdeskAccount.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="FreshdeskAccounts",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditFreshdeskAccount=function(e,t){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:t,freshdeskAccounts:b.freshdeskAccounts.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteFreshdeskAccount=S,b.exportSelectedFreshdeskAccounts=function(){var e=angular.copy(b.selectedFreshdeskAccounts);return b.selectedFreshdeskAccounts=[],e},b.deleteSelectedFreshdeskAccounts=function(e){var t=i.confirm().title("Are you sure want to delete the selected freshdeskAccounts?").htmlContent("<b>"+b.selectedFreshdeskAccounts.length+" selected</b> will be deleted.").ariaLabel("delete FreshdeskAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedFreshdeskAccounts.forEach(function(e){S(e)}),b.selectedFreshdeskAccounts=[]})},b.deselectFreshdeskAccounts=function(){b.selectedFreshdeskAccounts=[]},b.selectAllFreshdeskAccounts=function(){b.selectedFreshdeskAccounts=b.freshdeskAccounts.rows};var E=!0,A=1;function y(e){b.freshdeskAccounts=e||{count:0,rows:[]}}function S(e){m.intFreshdeskAccount.delete({id:e.id}).$promise.then(function(){_.remove(b.freshdeskAccounts.rows,{id:e.id}),b.freshdeskAccounts.count-=1,b.freshdeskAccounts.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintFreshdeskAccount"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getFreshdeskAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","freshdeskAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.integrations").controller("FreshdeskAccountsController",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(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:n.protocol()+"://"+n.host()+(n.port()?":"+n.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.salesforceAccounts,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The salesforceAccount will be deleted.").ariaLabel("Delete SalesforceAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,n,i,s,e){var o=this;function r(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 l(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 d(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,t){o.salesforceAccount=e,o.crudPermissions=void 0!==t?t:{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.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,t){a.show({controller:"CreateOrEditSalesforceConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/configurations/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{salesforceConfiguration:t,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getSalesforceConfiguration(0)})},o.deleteSalesforceConfiguration=function(e,t){var n=a.confirm().title("Are you sure want to delete the salesforceConfiguration?").htmlContent("<b>"+(t.name||"salesforceConfiguration")+"</b> will be deleted.").ariaLabel("delete salesforceConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){i.intSalesforceConfiguration.delete({id:t.id}).$promise.then(function(){_.remove(o.configurations,{id:t.id}),s.success({title:"SalesforceConfiguration deleted!",msg:t.name?t.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(){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()})})},o.selectedSubjects=[],o.createOrEditSubject=function(e,t){a.show({controller:"CreateOrEditSalesforceAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:t,items:o.subjects,configuration:o.salesforceConfiguration,account:o.salesforceAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,t){var n=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(n).then(function(){r(t)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var t=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(t).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,t){a.show({controller:"CreateOrEditSalesforceAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:t,items:o.descriptions,configuration:o.salesforceConfiguration,account:o.salesforceAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,t){var n=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(n).then(function(){l(t)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var t=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(t).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,t){a.show({controller:"CreateOrEditSalesforceAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:t,items:o.fields,configuration:o.salesforceConfiguration,account:o.salesforceAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,t){var n=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(n).then(function(){d(t)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var t=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(t).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("SalesforceAccountConfigurationsController",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(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"},g.title="INTEGRATIONS.NEW_SALESFORCECONFIGURATION",g.newSalesforceConfiguration=!0),g.addNewSalesforceConfiguration=function(){g.errors=[],d.intSalesforceAccount.addConfiguration({id:t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.configurations,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The salesforceConfiguration will be deleted.").ariaLabel("Delete SalesforceConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,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 t=_.find(p.items,{id:e.id});t&&_.merge(t,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 t=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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}).$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,t,n,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=t.protocol()+"://"+t.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")},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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.salesforceAccounts=l||{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="salesforceAccounts",b.listOrder="",b.listOrderAsc=null,b.selectedSalesforceAccounts=[],b.query={fields:"createdAt,updatedAt,id,name,type,username,remoteUri,password,clientId,clientSecret,securityToken,serverUrl,description",limit:10,page:1},b.arraytype=_.keyBy([{option:"Integration_Tab",value:"'integrationTab'"},{option:"New_Tab",value:"'newTab'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.integrations.salesforceAccounts.edit",{id:e.id,salesforceAccount:e,crudPermissions:b.crudPermissions})},b.testtestintegrationaccount=function(e,t){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()})})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getSalesforceAccounts=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.intSalesforceAccount.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="SalesforceAccounts",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditSalesforceAccount=function(e,t){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:t,salesforceAccounts:b.salesforceAccounts.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteSalesforceAccount=S,b.exportSelectedSalesforceAccounts=function(){var e=angular.copy(b.selectedSalesforceAccounts);return b.selectedSalesforceAccounts=[],e},b.deleteSelectedSalesforceAccounts=function(e){var t=i.confirm().title("Are you sure want to delete the selected salesforceAccounts?").htmlContent("<b>"+b.selectedSalesforceAccounts.length+" selected</b> will be deleted.").ariaLabel("delete SalesforceAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedSalesforceAccounts.forEach(function(e){S(e)}),b.selectedSalesforceAccounts=[]})},b.deselectSalesforceAccounts=function(){b.selectedSalesforceAccounts=[]},b.selectAllSalesforceAccounts=function(){b.selectedSalesforceAccounts=b.salesforceAccounts.rows};var E=!0,A=1;function y(e){b.salesforceAccounts=e||{count:0,rows:[]}}function S(e){m.intSalesforceAccount.delete({id:e.id}).$promise.then(function(){_.remove(b.salesforceAccounts.rows,{id:e.id}),b.salesforceAccounts.count-=1,b.salesforceAccounts.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintSalesforceAccount"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getSalesforceAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","salesforceAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.integrations").controller("SalesforceAccountsController",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(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:n.protocol()+"://"+n.host()+(n.port()?":"+n.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.servicenowAccounts,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The servicenowAccount will be deleted.").ariaLabel("Delete ServicenowAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,n,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,t){o.servicenowAccount=e,o.crudPermissions=void 0!==t?t:{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,t){a.show({controller:"CreateOrEditServicenowConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/servicenowAccounts/edit/configurations/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{servicenowConfiguration:t,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getServicenowConfiguration(0)})},o.deleteServicenowConfiguration=function(e,t){var n=a.confirm().title("Are you sure want to delete the servicenowConfiguration?").htmlContent("<b>"+(t.name||"servicenowConfiguration")+"</b> will be deleted.").ariaLabel("delete servicenowConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){i.intServicenowConfiguration.delete({id:t.id}).$promise.then(function(){_.remove(o.configurations,{id:t.id}),s.success({title:"ServicenowConfiguration deleted!",msg:t.name?t.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.selectChangedAdvanced=function(){return i.intSalesforceConfiguration.update({id:o.servicenowConfiguration.id},o.servicenowConfiguration).$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,t){a.show({controller:"CreateOrEditServicenowAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/servicenowAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:t,items:o.subjects,configuration:o.servicenowConfiguration,account:o.servicenowAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,t){var n=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(n).then(function(){r(t)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var t=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(t).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,t){a.show({controller:"CreateOrEditServicenowAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/servicenowAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:t,items:o.descriptions,configuration:o.servicenowConfiguration,account:o.servicenowAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,t){var n=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(n).then(function(){l(t)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var t=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(t).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,t){a.show({controller:"CreateOrEditServicenowAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/servicenowAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:t,items:o.fields,configuration:o.servicenowConfiguration,account:o.servicenowAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,t){var n=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(n).then(function(){d(t)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var t=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(t).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,t,n,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:t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.configurations,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The servicenowConfiguration will be deleted.").ariaLabel("Delete ServicenowConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,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 t=_.find(p.items,{id:e.id});t&&_.merge(t,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 t=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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}).$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,t,n,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=t.protocol()+"://"+t.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")},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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.servicenowAccounts=l||{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="servicenowAccounts",b.listOrder="",b.listOrderAsc=null,b.selectedServicenowAccounts=[],b.query={fields:"createdAt,updatedAt,id,name,username,password,email,remoteUri,serverUrl,description",limit:10,page:1},b.editstate=function(e,t){n.go("app.integrations.servicenowAccounts.edit",{id:e.id,servicenowAccount:e,crudPermissions:b.crudPermissions})},b.testtestintegrationaccount=function(e,t){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()})})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getServicenowAccounts=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.intServicenowAccount.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="ServicenowAccounts",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditServicenowAccount=function(e,t){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:t,servicenowAccounts:b.servicenowAccounts.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteServicenowAccount=S,b.exportSelectedServicenowAccounts=function(){var e=angular.copy(b.selectedServicenowAccounts);return b.selectedServicenowAccounts=[],e},b.deleteSelectedServicenowAccounts=function(e){var t=i.confirm().title("Are you sure want to delete the selected servicenowAccounts?").htmlContent("<b>"+b.selectedServicenowAccounts.length+" selected</b> will be deleted.").ariaLabel("delete ServicenowAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedServicenowAccounts.forEach(function(e){S(e)}),b.selectedServicenowAccounts=[]})},b.deselectServicenowAccounts=function(){b.selectedServicenowAccounts=[]},b.selectAllServicenowAccounts=function(){b.selectedServicenowAccounts=b.servicenowAccounts.rows};var E=!0,A=1;function y(e){b.servicenowAccounts=e||{count:0,rows:[]}}function S(e){m.intServicenowAccount.delete({id:e.id}).$promise.then(function(){_.remove(b.servicenowAccounts.rows,{id:e.id}),b.servicenowAccounts.count-=1,b.servicenowAccounts.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintServicenowAccount"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getServicenowAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","servicenowAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.integrations").controller("ServicenowAccountsController",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(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:n.protocol()+"://"+n.host()+(n.port()?":"+n.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.sugarcrmAccounts,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The sugarcrmAccount will be deleted.").ariaLabel("Delete SugarcrmAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,n,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,t){o.sugarcrmAccount=e,o.crudPermissions=void 0!==t?t:{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,t){a.show({controller:"CreateOrEditSugarcrmConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/configurations/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{sugarcrmConfiguration:t,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getSugarcrmConfiguration(0)})},o.deleteSugarcrmConfiguration=function(e,t){var n=a.confirm().title("Are you sure want to delete the sugarcrmConfiguration?").htmlContent("<b>"+(t.name||"sugarcrmConfiguration")+"</b> will be deleted.").ariaLabel("delete sugarcrmConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){i.intSugarcrmConfiguration.delete({id:t.id}).$promise.then(function(){_.remove(o.configurations,{id:t.id}),s.success({title:"SugarcrmConfiguration deleted!",msg:t.name?t.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.selectChangedAdvanced=function(){return i.intSalesforceConfiguration.update({id:o.sugarcrmConfiguration.id},o.sugarcrmConfiguration).$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,t){a.show({controller:"CreateOrEditSugarcrmAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:t,items:o.subjects,configuration:o.sugarcrmConfiguration,account:o.sugarcrmAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,t){var n=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(n).then(function(){r(t)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var t=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(t).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,t){a.show({controller:"CreateOrEditSugarcrmAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:t,items:o.descriptions,configuration:o.sugarcrmConfiguration,account:o.sugarcrmAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,t){var n=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(n).then(function(){l(t)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var t=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(t).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,t){a.show({controller:"CreateOrEditSugarcrmAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:t,items:o.fields,configuration:o.sugarcrmConfiguration,account:o.sugarcrmAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,t){var n=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(n).then(function(){d(t)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var t=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(t).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,t,n,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:t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.configurations,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The sugarcrmConfiguration will be deleted.").ariaLabel("Delete SugarcrmConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,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 t=_.find(p.items,{id:e.id});t&&_.merge(t,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 t=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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}).$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,t,n,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=t.protocol()+"://"+t.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")},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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.sugarcrmAccounts=l||{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="sugarcrmAccounts",b.listOrder="",b.listOrderAsc=null,b.selectedSugarcrmAccounts=[],b.query={fields:"createdAt,updatedAt,id,name,username,remoteUri,password,serverUrl,description",limit:10,page:1},b.editstate=function(e,t){n.go("app.integrations.sugarcrmAccounts.edit",{id:e.id,sugarcrmAccount:e,crudPermissions:b.crudPermissions})},b.testtestintegrationaccount=function(e,t){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()})})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getSugarcrmAccounts=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.intSugarcrmAccount.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="SugarcrmAccounts",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditSugarcrmAccount=function(e,t){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:t,sugarcrmAccounts:b.sugarcrmAccounts.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteSugarcrmAccount=S,b.exportSelectedSugarcrmAccounts=function(){var e=angular.copy(b.selectedSugarcrmAccounts);return b.selectedSugarcrmAccounts=[],e},b.deleteSelectedSugarcrmAccounts=function(e){var t=i.confirm().title("Are you sure want to delete the selected sugarcrmAccounts?").htmlContent("<b>"+b.selectedSugarcrmAccounts.length+" selected</b> will be deleted.").ariaLabel("delete SugarcrmAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedSugarcrmAccounts.forEach(function(e){S(e)}),b.selectedSugarcrmAccounts=[]})},b.deselectSugarcrmAccounts=function(){b.selectedSugarcrmAccounts=[]},b.selectAllSugarcrmAccounts=function(){b.selectedSugarcrmAccounts=b.sugarcrmAccounts.rows};var E=!0,A=1;function y(e){b.sugarcrmAccounts=e||{count:0,rows:[]}}function S(e){m.intSugarcrmAccount.delete({id:e.id}).$promise.then(function(){_.remove(b.sugarcrmAccounts.rows,{id:e.id}),b.sugarcrmAccounts.count-=1,b.sugarcrmAccounts.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintSugarcrmAccount"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getSugarcrmAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","sugarcrmAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.integrations").controller("SugarcrmAccountsController",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(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:n.protocol()+"://"+n.host()+(n.port()?":"+n.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.vtigerAccounts,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The vtigerAccount will be deleted.").ariaLabel("Delete VtigerAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,n,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,t){o.vtigerAccount=e,o.crudPermissions=void 0!==t?t:{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,t){a.show({controller:"CreateOrEditVtigerConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/vtigerAccounts/edit/configurations/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{vtigerConfiguration:t,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getVtigerConfiguration(0)})},o.deleteVtigerConfiguration=function(e,t){var n=a.confirm().title("Are you sure want to delete the vtigerConfiguration?").htmlContent("<b>"+(t.name||"vtigerConfiguration")+"</b> will be deleted.").ariaLabel("delete vtigerConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){i.intVtigerConfiguration.delete({id:t.id}).$promise.then(function(){_.remove(o.configurations,{id:t.id}),s.success({title:"VtigerConfiguration deleted!",msg:t.name?t.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.selectChangedAdvanced=function(){return i.intSalesforceConfiguration.update({id:o.vtigerConfiguration.id},o.vtigerConfiguration).$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,t){a.show({controller:"CreateOrEditVtigerAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/vtigerAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:t,items:o.subjects,configuration:o.vtigerConfiguration,account:o.vtigerAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,t){var n=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(n).then(function(){r(t)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var t=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(t).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,t){a.show({controller:"CreateOrEditVtigerAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/vtigerAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:t,items:o.descriptions,configuration:o.vtigerConfiguration,account:o.vtigerAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,t){var n=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(n).then(function(){l(t)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var t=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(t).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,t){a.show({controller:"CreateOrEditVtigerAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/vtigerAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:t,items:o.fields,configuration:o.vtigerConfiguration,account:o.vtigerAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,t){var n=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(n).then(function(){d(t)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var t=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(t).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,t,n,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:t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.configurations,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The vtigerConfiguration will be deleted.").ariaLabel("Delete VtigerConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,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 t=_.find(p.items,{id:e.id});t&&_.merge(t,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 t=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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}).$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,t,n,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=t.protocol()+"://"+t.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")},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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.vtigerAccounts=l||{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="vtigerAccounts",b.listOrder="",b.listOrderAsc=null,b.selectedVtigerAccounts=[],b.query={fields:"createdAt,updatedAt,id,name,description,username,accessKey,remoteUri,serverUrl",limit:10,page:1},b.editstate=function(e,t){n.go("app.integrations.vtigerAccounts.edit",{id:e.id,vtigerAccount:e,crudPermissions:b.crudPermissions})},b.testtestintegrationaccount=function(e,t){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()})})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getVtigerAccounts=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.intVtigerAccount.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="VtigerAccounts",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditVtigerAccount=function(e,t){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:t,vtigerAccounts:b.vtigerAccounts.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteVtigerAccount=S,b.exportSelectedVtigerAccounts=function(){var e=angular.copy(b.selectedVtigerAccounts);return b.selectedVtigerAccounts=[],e},b.deleteSelectedVtigerAccounts=function(e){var t=i.confirm().title("Are you sure want to delete the selected vtigerAccounts?").htmlContent("<b>"+b.selectedVtigerAccounts.length+" selected</b> will be deleted.").ariaLabel("delete VtigerAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedVtigerAccounts.forEach(function(e){S(e)}),b.selectedVtigerAccounts=[]})},b.deselectVtigerAccounts=function(){b.selectedVtigerAccounts=[]},b.selectAllVtigerAccounts=function(){b.selectedVtigerAccounts=b.vtigerAccounts.rows};var E=!0,A=1;function y(e){b.vtigerAccounts=e||{count:0,rows:[]}}function S(e){m.intVtigerAccount.delete({id:e.id}).$promise.then(function(){_.remove(b.vtigerAccounts.rows,{id:e.id}),b.vtigerAccounts.count-=1,b.vtigerAccounts.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintVtigerAccount"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getVtigerAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","vtigerAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.integrations").controller("VtigerAccountsController",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(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:n.protocol()+"://"+n.host()+(n.port()?":"+n.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.zendeskAccounts,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The zendeskAccount will be deleted.").ariaLabel("Delete ZendeskAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,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 t=_.find(p.items,{id:e.id});t&&_.merge(t,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 t=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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}).$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,t,n,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=t.protocol()+"://"+t.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")},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,n,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,t){o.zendeskAccount=e,o.crudPermissions=void 0!==t?t:{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,t){a.show({controller:"CreateOrEditZendeskConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/zendeskConfigurations/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{zendeskConfiguration:t,zendeskConfigurations:o.zendeskConfigurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getZendeskConfiguration(0)})},o.deleteZendeskConfiguration=function(e,t){var n=a.confirm().title("Are you sure want to delete the zendeskConfiguration?").htmlContent("<b>"+(t.name||"zendeskConfiguration")+"</b> will be deleted.").ariaLabel("delete zendeskConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){i.intZendeskConfiguration.delete({id:t.id}).$promise.then(function(){_.remove(o.zendeskConfigurations,{id:t.id}),s.success({title:"ZendeskConfiguration deleted!",msg:t.name?t.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.selectChangedAdvanced=function(){return i.intSalesforceConfiguration.update({id:o.zendeskConfiguration.id},o.zendeskConfiguration).$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.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,t){a.show({controller:"CreateOrEditZendeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:t,items:o.subjects,configuration:o.zendeskConfiguration,account:o.zendeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,t){var n=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(n).then(function(){r(t)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var t=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(t).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,t){a.show({controller:"CreateOrEditZendeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:t,items:o.descriptions,configuration:o.zendeskConfiguration,account:o.zendeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,t){var n=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(n).then(function(){l(t)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var t=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(t).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,t){a.show({controller:"CreateOrEditZendeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:t,items:o.fields,configuration:o.zendeskConfiguration,account:o.zendeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,t){var n=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(n).then(function(){d(t)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var t=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(t).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,t,n,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:t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.zendeskConfigurations,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The zendeskConfiguration will be deleted.").ariaLabel("Delete ZendeskConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.zendeskAccounts=l||{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="zendeskAccounts",b.listOrder="",b.listOrderAsc=null,b.selectedZendeskAccounts=[],b.query={fields:"createdAt,updatedAt,id,name,type,username,remoteUri,authType,password,token,serverUrl,description",limit:10,page:1},b.arraytype=_.keyBy([{option:"Integration_Tab",value:"'integrationTab'"},{option:"New_Tab",value:"'newTab'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arrayauthType=_.keyBy([{option:"Password",value:"'password'"},{option:"Token",value:"'token'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.integrations.zendeskAccounts.edit",{id:e.id,zendeskAccount:e,crudPermissions:b.crudPermissions})},b.testtestintegrationaccount=function(e,t){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()})})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getZendeskAccounts=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.intZendeskAccount.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="ZendeskAccounts",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditZendeskAccount=function(e,t){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:t,zendeskAccounts:b.zendeskAccounts.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteZendeskAccount=S,b.exportSelectedZendeskAccounts=function(){var e=angular.copy(b.selectedZendeskAccounts);return b.selectedZendeskAccounts=[],e},b.deleteSelectedZendeskAccounts=function(e){var t=i.confirm().title("Are you sure want to delete the selected zendeskAccounts?").htmlContent("<b>"+b.selectedZendeskAccounts.length+" selected</b> will be deleted.").ariaLabel("delete ZendeskAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedZendeskAccounts.forEach(function(e){S(e)}),b.selectedZendeskAccounts=[]})},b.deselectZendeskAccounts=function(){b.selectedZendeskAccounts=[]},b.selectAllZendeskAccounts=function(){b.selectedZendeskAccounts=b.zendeskAccounts.rows};var E=!0,A=1;function y(e){b.zendeskAccounts=e||{count:0,rows:[]}}function S(e){m.intZendeskAccount.delete({id:e.id}).$promise.then(function(){_.remove(b.zendeskAccounts.rows,{id:e.id}),b.zendeskAccounts.count-=1,b.zendeskAccounts.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintZendeskAccount"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getZendeskAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","zendeskAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.integrations").controller("ZendeskAccountsController",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(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",serverUrl:n.protocol()+"://"+n.host()+(n.port()?":"+n.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.zohoAccounts,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The zohoAccount will be deleted.").ariaLabel("Delete ZohoAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,n,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,t){o.zohoAccount=e,o.crudPermissions=void 0!==t?t:{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,t){a.show({controller:"CreateOrEditZohoConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zohoAccounts/edit/configurations/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{zohoConfiguration:t,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getZohoConfiguration(0)})},o.deleteZohoConfiguration=function(e,t){var n=a.confirm().title("Are you sure want to delete the zohoConfiguration?").htmlContent("<b>"+(t.name||"zohoConfiguration")+"</b> will be deleted.").ariaLabel("delete zohoConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){i.intZohoConfiguration.delete({id:t.id}).$promise.then(function(){_.remove(o.configurations,{id:t.id}),s.success({title:"ZohoConfiguration deleted!",msg:t.name?t.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(){return i.intSalesforceConfiguration.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,t){a.show({controller:"CreateOrEditZohoAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zohoAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:t,items:o.subjects,configuration:o.zohoConfiguration,account:o.zohoAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,t){var n=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(n).then(function(){r(t)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var t=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(t).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,t){a.show({controller:"CreateOrEditZohoAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zohoAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:t,items:o.descriptions,configuration:o.zohoConfiguration,account:o.zohoAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,t){var n=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(n).then(function(){l(t)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var t=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(t).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,t){a.show({controller:"CreateOrEditZohoAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zohoAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:t,items:o.fields,configuration:o.zohoConfiguration,account:o.zohoAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,t){var n=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(n).then(function(){d(t)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var t=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(t).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,t,n,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:t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.configurations,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The zohoConfiguration will be deleted.").ariaLabel("Delete ZohoConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,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 t=_.find(p.items,{id:e.id});t&&_.merge(t,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 t=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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}).$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,t,n,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=t.protocol()+"://"+t.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")},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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.zohoAccounts=l||{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="zohoAccounts",b.listOrder="",b.listOrderAsc=null,b.selectedZohoAccounts=[],b.query={fields:"createdAt,updatedAt,id,name,host,authToken,serverUrl,description",limit:10,page:1},b.arrayhost=_.keyBy([{option:"zoho.com",value:"'zoho.com'"},{option:"zoho.eu",value:"'zoho.eu'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.integrations.zohoAccounts.edit",{id:e.id,zohoAccount:e,crudPermissions:b.crudPermissions})},b.testtestintegrationaccount=function(e,t){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()})})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getZohoAccounts=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.intZohoAccount.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="ZohoAccounts",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditZohoAccount=function(e,t){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:t,zohoAccounts:b.zohoAccounts.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteZohoAccount=S,b.exportSelectedZohoAccounts=function(){var e=angular.copy(b.selectedZohoAccounts);return b.selectedZohoAccounts=[],e},b.deleteSelectedZohoAccounts=function(e){var t=i.confirm().title("Are you sure want to delete the selected zohoAccounts?").htmlContent("<b>"+b.selectedZohoAccounts.length+" selected</b> will be deleted.").ariaLabel("delete ZohoAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedZohoAccounts.forEach(function(e){S(e)}),b.selectedZohoAccounts=[]})},b.deselectZohoAccounts=function(){b.selectedZohoAccounts=[]},b.selectAllZohoAccounts=function(){b.selectedZohoAccounts=b.zohoAccounts.rows};var E=!0,A=1;function y(e){b.zohoAccounts=e||{count:0,rows:[]}}function S(e){m.intZohoAccount.delete({id:e.id}).$promise.then(function(){_.remove(b.zohoAccounts.rows,{id:e.id}),b.zohoAccounts.count-=1,b.zohoAccounts.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintZohoAccount"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getZohoAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","zohoAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.integrations").controller("ZohoAccountsController",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(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},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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.projects,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The project will be deleted.").ariaLabel("Delete Project").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s){var o=this;o.project={},o.localizationMap=s;var r=new Date;r.setHours(0,0,0,0),o.pickerModel={dateStart:r,dateEnd:null,selectedTemplate:"TD"},o.init=function(e){o.project=e,o.getAnswers()},o.getSummary=function(){return a.jscriptyProject.getSummary({id:o.project.id,startTime:{$gte:o.pickerModel.dateStart,$lte:moment(o.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format()},nolimit:!0}).$promise.then(function(e){if(void 0!==e.length){var t=[e.buffer],n=new Blob(t,{type:e.type}),a=window.document.createElement("a");a.setAttribute("href",URL.createObjectURL(n)),a.setAttribute("download","jscriptyProjectSummary_"+o.project.id+".csv"),a.click()}else i.info({title:"EXPORT",msg:"No answers available"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.jscriptyProject.getSummary",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getAnswers=function(){return o.hasIdAnswers=!1,a.jscriptyProject.getAnswers({id:o.project.id,sort:"-createdAt,questionId",createdAt:{$gte:o.pickerModel.dateStart,$lte:moment(o.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format()},nolimit:!0}).$promise.then(function(e){if(e&&e.rows&&e.hasOwnProperty("count")){o.answers={};for(var t=0,n=e.count;t<n;t++)e.rows[t].questionId&&(o.hasIdAnswers=!0,o.answers.hasOwnProperty(e.rows[t].questionId)||(o.answers[e.rows[t].questionId]={question:e.rows[t].question,answers:{},sum:0}),""===e.rows[t].answer&&(e.rows[t].answer="NO_ANSWER"),o.answers[e.rows[t].questionId].answers[e.rows[t].answer]?o.answers[e.rows[t].questionId].answers[e.rows[t].answer]+=1:o.answers[e.rows[t].questionId].answers[e.rows[t].answer]=1,o.answers[e.rows[t].questionId].sum+=1)}}).catch(function(e){i.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","toasty","dateFilterLocalizationFactory"],angular.module("app.jscripty").controller("ProjectAnswersController",e)}(),function(){"use strict";angular.module("app.jscripty").controller("ProjectBuilderController",function(){var t=this;t.project={},t.optionsBuilder={questionTypes:["text","textarea","radio","checkbox","select","number","date","time","email","range","url"],elementTypes:["question","paragraph"]},t.init=function(e){t.project=e,_.isObjectLike(e.formData)?t.project.formData=e.formData:t.isJsonString(e.formData)?t.project.formData=JSON.parse(e.formData):t.project.formData={}},t.isJsonString=function(e){if(_.isNil(e))return!1;try{JSON.parse(e)}catch(e){return!1}return!0}})}(),function(){"use strict";function e(t,n,a,e,i,s,o){var r=this;function l(e){t.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!":""}),n.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 t=0;t<e.data.errors.length;t+=1)a.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){var o=this;o.project={},o.responseData={},o.formViewer={},o.init=function(e){o.project=e,t.$on("mwForm.pageEvents.pageCurrentChanged",function(e,t){if(t.currentPage&&o.project.formData&&o.project.formData.pages)for(var n=0,a=o.project.formData.pages.length;n<a;n++)if(t.currentPage.number<n+1&&o.project.formData.pages[n].elements)for(var i=0,s=o.project.formData.pages[n].elements.length;i<s;i++)"question"===o.project.formData.pages[n].elements[i].type&&o.project.formData.pages[n].elements[i].question&&delete o.responseData[o.project.formData.pages[n].elements[i].question.id]})},o.onSubmit=function(e){var t=a.defer(),n=i.confirm().title("Would you like to save your survey?").textContent("").ariaLabel("survey").targetEvent(e).ok("SAVE").cancel("CANCEL");return i.show(n).then(function(){t.resolve(!0)},function(){t.reject()}),t.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,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.project={},c.projectSessions={count:0,rows:[]},c.selectedProjectSessions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,starttime,endtime,membername,calleridnum,completed",sort:"-starttime",limit:10,page:1},c.init=function(e,t){c.project=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.project.id,c.getProjectSessions()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the session?").htmlContent("<b>"+(e.name||"session")+"</b> will be deleted.").ariaLabel("delete session").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getProjectSessions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.jscriptyProject.getSessions(c.query,p).$promise},c.createOrEditProjectSession=function(e,t){s.show({controller:"CreateOrEditSessionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/jscripty/views/projects/edit/sessions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{project:c.project,session:t,sessions:c.projectSessions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.showQuestionsProjectSession=function(e,n){s.show({controller:"ShowQuestionsSessionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/jscripty/views/projects/edit/sessions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,resolve:{questions:["apiResolver","$stateParams",function(e,t){return e.resolve("jscriptySessionReport@getQuestions",{fields:"question,answer",sort:"id",id:n.id})}]},locals:{project:c.project,session:n}})},c.exportSelectedProjectSessions=function(){var e=angular.copy(c.selectedProjectSessions);return c.selectedProjectSessions=[],e},c.deleteProjectSession=g,c.deleteSelectedProjectSessions=function(e){var t=s.confirm().title("Are you sure want to delete the selected sessions?").htmlContent("<b>"+c.selectedProjectSessions.length+" selected</b> will be deleted.").ariaLabel("delete sessions").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedProjectSessions.forEach(function(e){g(e)}),c.selectedProjectSessions=[]})};var m=!0,u=1;function p(e){c.projectSessions=e||{count:0,rows:[]}}function g(e){l.jscriptySessionReport.delete({id:e.id}).$promise.then(function(){_.remove(c.projectSessions.rows,{id:e.id}),c.projectSessions.count-=1,c.projectSessions.rows.length||c.getProjectSessions(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETjscriptyProject"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETjscriptyProject",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getProjectSessions())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.jscripty").controller("ProjectSessionsController",e)}(),function(){"use strict";function e(e,t,n,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,t,n,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=t.protocol()+"://"+t.host(),u.project=c||e.params.project||{},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.clonedialog=function(e,t){n.show({controller:"ProjectcloneController",controllerAs:"vm",templateUrl:"app/main/apps/jscripty/views/projects/edit/clone/clone.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{project:e,projects:u.projects?u.projects.rows:[],crudPermissions:u.crudPermissions}})},u.alert=l.info,u.gotoProjects=function(){e.go("app.jscripty.projects")},u.saveProject=function(){r.jscriptyProject.update({id:u.project.id},u.project).$promise.then(function(){l.success({title:"Project updated!",msg:u.project.name?u.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","userProfileSection"],angular.module("app.jscripty").controller("JscriptyProjectController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.projects=l||{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="projects",b.listOrder="",b.listOrderAsc=null,b.selectedProjects=[],b.query={fields:"createdAt,updatedAt,id,name,enableUncompleteSave,description,formData",sort:"-updatedAt",limit:10,page:1},b.editstate=function(e,t){n.go("app.jscripty.projects.edit",{id:e.id,project:e,crudPermissions:b.crudPermissions})},b.clonedialog=function(e,t){i.show({controller:"ProjectcloneController",controllerAs:"vm",templateUrl:"app/main/apps/jscripty/views/projects/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{project:e,projects:b.projects?b.projects.rows:[],crudPermissions:b.crudPermissions}})},b.sessionsgoto=function(e,t){n.go("app.jscripty.projects.edit",{id:e.id,tab:3})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getProjects=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.jscriptyProject.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Projects",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditProject=function(e,t){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:t,projects:b.projects.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteProject=S,b.exportSelectedProjects=function(){var e=angular.copy(b.selectedProjects);return b.selectedProjects=[],e},b.deleteSelectedProjects=function(e){var t=i.confirm().title("Are you sure want to delete the selected projects?").htmlContent("<b>"+b.selectedProjects.length+" selected</b> will be deleted.").ariaLabel("delete Projects").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedProjects.forEach(function(e){S(e)}),b.selectedProjects=[]})},b.deselectProjects=function(){b.selectedProjects=[]},b.selectAllProjects=function(){b.selectedProjects=b.projects.rows};var E=!0,A=1;function y(e){b.projects=e||{count:0,rows:[]}}function S(e){m.jscriptyProject.delete({id:e.id}).$promise.then(function(){_.remove(b.projects.rows,{id:e.id}),b.projects.count-=1,b.projects.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEjscriptyProject"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getProjects())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","projects","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.jscripty").controller("JscriptyProjectsController",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(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_MAILACCOUNT",g.mailAccount=angular.copy(l),g.mailAccounts=r,g.newMailAccount=!1,g.mailAccount||(g.mailAccount={active:!0,cservice:"null",cauthentication:!0,fontSize:13,waitForTheAssignedAgent:10,notificationSound:!0,queueTransferTimeout:300,agentTransferTimeout:300},g.title="MAIL.NEW_MAILACCOUNT",g.newMailAccount=!0),t.params.id&&(g.mailAccount.MailAccountId=t.params.id),g.addNewMailAccount=function(){g.errors=[],d.mailAccount.save(g.mailAccount).$promise.then(function(e){g.mailAccounts.unshift(e.toJSON()),o.success({title:"MailAccount properly created",msg:g.mailAccount.name?g.mailAccount.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.mailAccount.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.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=[],d.mailAccount.update({id:g.mailAccount.id},g.mailAccount).$promise.then(function(e){var t=_.find(g.mailAccounts,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"MailAccount properly saved!",msg:g.mailAccount.name?g.mailAccount.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.mailAccount.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.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 o.error({title:"Mail Account not deleted!",msg:"You can't remove service account"});g.errors=[];var t=a.confirm().title("Are you sure?").content("The mailAccount will be deleted.").ariaLabel("Delete MailAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.mailAccount.delete({id:g.mailAccount.id}).$promise.then(function(){_.remove(g.mailAccounts,{id:g.mailAccount.id}),o.success({title:"MailAccount properly deleted!",msg:(g.mailAccount.name||"mailAccount")+" has been deleted!"}),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.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.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.lists,{id:e.resourceId})}),n=null;if(g.mailAccount&&(n=_.find(g.lists,{id:Number(g.mailAccount.ListId)})),n&&!_.some(t,["id",n.id])){var a=_.find(g.lists,{id:n.id});a.canSelect=!1,t.push(a)}g.lists=t})}else{var n=[],a=null;g.mailAccount&&(a=_.find(g.lists,{id:Number(g.mailAccount.ListId)}));for(var i=0;i<g.lists.length;i++)a&&g.lists[i].id===a.id&&(g.lists[i].canSelect=!1,n.push(g.lists[i]));g.lists=n}}).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","mailAccounts","mailAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.mail").controller("CreateOrEditMailAccountDialogController",e)}(),function(){"use strict";function e(o,i,a,s,e){var r=this;function t(e,t){if(r.mailAccountApps.rows.length){var n=r.mailAccountApps.rows[t]?r.mailAccountApps.rows[t]:r.mailAccountApps.rows[0];i.show({controller:"EditMailAccountApp"+(n.appType||n.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/apps/"+(n.appType||n.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailAccountApp:n,mailAccount:r.mailAccount,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.mailAccountApps.rows[t]=e:r.mailAccountApps.rows.splice(t,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,t=[],n=0;n<r.mailAccountApps.rows.length;n++,0){var a=r.mailAccountApps.rows[n],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,t=_.concat(t,i,[a],s)}o.mailAccount.addApplications({id:r.mailAccount.id},_.sortBy(t,"priority")).$promise.then(function(e){r.mailAccountApps.rows=e.rows}).catch(function(e){console.error(e)})}function n(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:"1"},{option:"Always",value:"0"}],required:!0,param:0},{title:"Text",name:"text",type:"html",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){t(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,t){r.mailAccount=e,r.crudPermissions=void 0!==t?t:{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,t,n){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(n).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.mailAccountApps.rows.splice(t,1),l()},function(){console.log("CANCEL")})},r.getMailAccountApps=function(){r.promise=o.mailAccount.getApplications(r.query,n).$promise},r.editMailAccountApp=t,r.editInterval=function(e,t){if(r.mailAccountApps.rows.length){var n=r.mailAccountApps.rows[t]?r.mailAccountApps.rows[t]: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:n.interval,IntervalId:n.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(n.interval=e.interval||"*,*,*,*",n.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 t=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(t).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,t,n,o,r,l,d){var c=this;function m(){return a(function(n,t){return a(function(t,n){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.mailAccount.getAgents({id:c.mailAccount.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return t.penalty=e.UserMailAccount?"penalty "+e.UserMailAccount.penalty:"",t.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=l.getCurrentUser(),c.mailAccount=t,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(n,t){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.mailAccount.removeAgents({id:c.mailAccount.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.mailAccount.addAgents({id:c.mailAccount.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,items:[],selectedItems:[],showSelectAndDeselectAll:!o,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("MAIL.ALL_AGENTS"),labelSelected:r.instant("MAIL.SELECTED_AGENTS"),transferCallback:function(e,t){var n=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(n)}}}e.$inject=["$mdDialog","$q","toasty","api","mailAccount","mailAccounts","realtime","$translate","Auth","crudPermissions"],angular.module("app.mail").controller("MailAccountagentaddController",e)}(),function(){"use strict";function e(t,e,n,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"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){t.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 t=_.find(l.agents,{name:l.agent.agent});t&&(l.agent.UserId=t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),n=null;if(l.agent&&(n=_.find(l.agents,{name:l.agent.agent})),n&&!_.some(t,["id",n.id])){var a=_.find(l.agents,{id:n.id});a.canSelect=!1,t.push(a)}l.agents=t})}else{var n=[],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,n.push(l.agents[i]));l.agents=n}}).catch(function(e){n.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(t,e,n,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"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){t.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.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(t,e,n,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"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){t.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(t,e,n,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"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){t.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(t,e,n,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"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){t.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,t,n,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 E(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var t=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),n=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(t+"-"+n)}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 A(e){t.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=E(),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!":""}),A()}).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=E(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),A(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var t=_.find(c.intervals,{id:e.id});t&&_.merge(t,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),A()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=A,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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=e&&e.rows?e.rows:[],n=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(t,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,n.push(e))}),c.intervals=n})}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(t,e,n,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"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){t.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(t,e,n,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"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){t.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 t=_.find(l.queues,{name:l.queue.queue});t&&(l.queue[_.capitalize("mail")+"QueueId"]=t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),n=null;if(l.queue&&(n=_.find(l.queues,{name:l.queue.queue})),n&&!_.some(t,["id",n.id])){var a=_.find(l.queues,{id:n.id});a.canSelect=!1,t.push(a)}l.queues=t})}else{var n=[],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,n.push(l.queues[i]));l.queues=n}}).catch(function(e){n.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(t,e,n,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"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){t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),n=null;if(l.system&&(n=_.find(l.variables,{name:l.system.variable})),n&&!_.some(t,["id",n.id])){var a=_.find(l.variables,{id:n.id});a.canSelect=!1,t.push(a)}l.variables=t})}else{var n=[],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,n.push(l.variables[i]));l.variables=n}}).catch(function(e){n.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(t,e,n,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"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){t.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 t=_.find(l.tags,{name:l.tag.tag});t&&(l.tag.TagId=t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),n=null;if(l.tag&&(n=_.find(l.tags,{name:l.tag.tag})),n&&!_.some(t,["id",n.id])){var a=_.find(l.tags,{id:n.id});a.canSelect=!1,t.push(a)}l.tags=t})}else{var n=[],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,n.push(l.tags[i]));l.tags=n}}).catch(function(e){n.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,t,n,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.mailAccount={},c.mailAccountInteractions={count:0,rows:[]},c.selectedMailAccountInteractions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,UserId,ContactId,MailAccountId,id,Contact.firstName,Owner.name,closedAt,disposition,note,tag",sort:"-createdAt",includeAll:"true",limit:10,page:1},c.init=function(e,t){c.mailAccount=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.mailAccount.id,c.getMailAccountInteractions()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.mailInteractionDownload=function(s,e,t){return l.mailInteraction.download({id:s.id,exists:!0,attachments:t}).$promise.then(function(e){var t=[e.buffer],n="interaction"+s.id,a=new Blob(t,{type:e.type});n="mail-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.success=p,c.getMailAccountInteractions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.mailAccount.getInteractions(c.query,p).$promise},c.createOrEditMailAccountInteraction=function(e,t){s.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/interactions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailAccount:c.mailAccount,interaction:t,interactions:c.mailAccountInteractions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.spymailInteraction=function(e,n){s.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,t){e.vm.init({id:1,channel:"mail",interaction:n,spy:!0},a.$parent.vm.setting)}})},c.exportSelectedMailAccountInteractions=function(){var e=angular.copy(c.selectedMailAccountInteractions);return c.selectedMailAccountInteractions=[],e},c.deleteMailAccountInteraction=g,c.deleteSelectedMailAccountInteractions=function(e){var t=s.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+c.selectedMailAccountInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedMailAccountInteractions.forEach(function(e){g(e)}),c.selectedMailAccountInteractions=[]})};var m=!0,u=1;function p(e){c.mailAccountInteractions=e||{count:0,rows:[]}}function g(e){l.mailInteraction.delete({id:e.id}).$promise.then(function(){_.remove(c.mailAccountInteractions.rows,{id:e.id}),c.mailAccountInteractions.count-=1,c.mailAccountInteractions.rows.length||c.getMailAccountInteractions(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETmailAccount"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}a.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getMailAccountInteractions())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.mail").controller("MailAccountInteractionsController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.mailAccount={},c.mailAccountMailCannedAnswers={count:0,rows:[]},c.selectedMailAccountMailCannedAnswers=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,key,value,description",limit:10,page:1},c.init=function(e,t){c.mailAccount=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.mailAccount.id,c.query.MailAccountId=c.mailAccount.id,c.getMailAccountMailCannedAnswers()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the mailCannedAnswer?").htmlContent("<b>"+(e.name||"mailCannedAnswer")+"</b> will be deleted.").ariaLabel("delete mailCannedAnswer").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getMailAccountMailCannedAnswers=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.mailAccount.getAnswers(c.query,p).$promise},c.createOrEditMailAccountMailCannedAnswer=function(e,t){s.show({controller:"CreateOrEditMailCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/mailCannedAnswers/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailAccount:c.mailAccount,mailCannedAnswer:t,mailCannedAnswers:c.mailAccountMailCannedAnswers.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedMailAccountMailCannedAnswers=function(){var e=angular.copy(c.selectedMailAccountMailCannedAnswers);return c.selectedMailAccountMailCannedAnswers=[],e},c.deleteMailAccountMailCannedAnswer=g,c.deleteSelectedMailAccountMailCannedAnswers=function(e){var t=s.confirm().title("Are you sure want to delete the selected mailCannedAnswers?").htmlContent("<b>"+c.selectedMailAccountMailCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete mailCannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedMailAccountMailCannedAnswers.forEach(function(e){g(e)}),c.selectedMailAccountMailCannedAnswers=[]})};var m=!0,u=1;function p(e){c.mailAccountMailCannedAnswers=e||{count:0,rows:[]}}function g(e){l.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(c.mailAccountMailCannedAnswers.rows,{id:e.id}),c.mailAccountMailCannedAnswers.count-=1,c.mailAccountMailCannedAnswers.rows.length||c.getMailAccountMailCannedAnswers(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETmailAccount"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getMailAccountMailCannedAnswers())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.mail").controller("MailAccountMailCannedAnswersController",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(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),t.params.id&&(g.mailCannedAnswer.MailAccountId=t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.mailCannedAnswers,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The mailCannedAnswer will be deleted.").ariaLabel("Delete MailCannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.mailAccount={},c.mailAccountMailDispositions={count:0,rows:[]},c.selectedMailAccountMailDispositions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,name",limit:10,page:1},c.init=function(e,t){c.mailAccount=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.mailAccount.id,c.query.MailAccountId=c.mailAccount.id,c.getMailAccountMailDispositions()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the mailDisposition?").htmlContent("<b>"+(e.name||"mailDisposition")+"</b> will be deleted.").ariaLabel("delete mailDisposition").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getMailAccountMailDispositions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.mailAccount.getDispositions(c.query,p).$promise},c.createOrEditMailAccountMailDisposition=function(e,t){s.show({controller:"CreateOrEditMailDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/mailDispositions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailAccount:c.mailAccount,mailDisposition:t,mailDispositions:c.mailAccountMailDispositions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedMailAccountMailDispositions=function(){var e=angular.copy(c.selectedMailAccountMailDispositions);return c.selectedMailAccountMailDispositions=[],e},c.deleteMailAccountMailDisposition=g,c.deleteSelectedMailAccountMailDispositions=function(e){var t=s.confirm().title("Are you sure want to delete the selected mailDispositions?").htmlContent("<b>"+c.selectedMailAccountMailDispositions.length+" selected</b> will be deleted.").ariaLabel("delete mailDispositions").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedMailAccountMailDispositions.forEach(function(e){g(e)}),c.selectedMailAccountMailDispositions=[]})};var m=!0,u=1;function p(e){c.mailAccountMailDispositions=e||{count:0,rows:[]}}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){_.remove(c.mailAccountMailDispositions.rows,{id:e.id}),c.mailAccountMailDispositions.count-=1,c.mailAccountMailDispositions.rows.length||c.getMailAccountMailDispositions(),r.success({title:"MailDisposition deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETmailAccount"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getMailAccountMailDispositions())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.mail").controller("MailAccountMailDispositionsController",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(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_MAILDISPOSITION",g.mailDisposition=angular.copy(l),g.mailDispositions=r,g.newMailDisposition=!1,g.mailDisposition||(g.mailDisposition={},g.title="MAIL.NEW_MAILDISPOSITION",g.newMailDisposition=!0),t.params.id&&(g.mailDisposition.MailAccountId=t.params.id),g.addNewMailDisposition=function(){g.errors=[],d.disposition.save(g.mailDisposition).$promise.then(function(e){g.mailDispositions.unshift(e.toJSON()),o.success({title:"MailDisposition properly created",msg:g.mailDisposition.name?g.mailDisposition.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.disposition.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveMailDisposition=function(){g.errors=[],d.disposition.update({id:g.mailDisposition.id},g.mailDisposition).$promise.then(function(e){var t=_.find(g.mailDispositions,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"MailDisposition properly saved!",msg:g.mailDisposition.name?g.mailDisposition.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.disposition.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteMailDisposition=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The mailDisposition will be deleted.").ariaLabel("Delete MailDisposition").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.disposition.delete({id:g.mailDisposition.id}).$promise.then(function(){_.remove(g.mailDispositions,{id:g.mailDisposition.id}),o.success({title:"MailDisposition properly deleted!",msg:(g.mailDisposition.name||"mailDisposition")+" has been deleted!"}),v(g.mailDisposition)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.disposition.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.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","mailDispositions","mailDisposition","api","Auth","license","setting","crudPermissions"],angular.module("app.mail").controller("CreateOrEditMailDispositionDialogController",e)}(),function(){"use strict";function e(n,e,a,i,s,t,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=t,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.mailAccount=c||n.params.mailAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=n.params.tab||0,u.gotogoto=function(e,t){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:610}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.mail.realtime.accounts",{})}},u.agentadddialog=function(e,t){a.show({controller:"MailAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:t,clickOutsideToClose:!0,locals:{mailAccount:e,mailAccounts:u.mailAccounts?u.mailAccounts.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoMailAccounts=function(){n.go("app.mail.mailAccounts")},u.saveMailAccount=function(){r.mailAccount.update({id:u.mailAccount.id},u.mailAccount).$promise.then(function(){l.success({title:"MailAccount updated!",msg:u.mailAccount.name?u.mailAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.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){u.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.lists,{id:e.resourceId})}),n=null;if(u.mailAccount&&(n=_.find(u.lists,{id:Number(u.mailAccount.ListId)})),n&&!_.some(t,["id",n.id])){var a=_.find(u.lists,{id:n.id});a.canSelect=!1,t.push(a)}u.lists=t})}else{var n=[],a=null;u.mailAccount&&(a=_.find(u.lists,{id:Number(u.mailAccount.ListId)}));for(var i=0;i<u.lists.length;i++)a&&u.lists[i].id===a.id&&(u.lists[i].canSelect=!1,n.push(u.lists[i]));u.lists=n}}).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){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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.pauses,{id:e.resourceId})});u.pauses.forEach(function(e){_.some(t,["id",e.id])||(e.canSelect=!1),t.push(e)}),u.pauses=t})}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","mailAccount","userProfileSection"],angular.module("app.mail").controller("MailAccountController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.mailAccounts=l||{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="mailAccounts",b.listOrder="",b.listOrderAsc=null,b.selectedMailAccounts=[],b.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,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,page:1},b.arraycservice=_.keyBy([{option:"Custom",value:"null"},{option:"Gmail",value:"'gmail'"},{option:"Hotmail",value:"'hotmail'"},{option:"Yahoo",value:"'yahoo'"},{option:"Outlook365",value:"'outlook365'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b["arrayImap.service"]=_.keyBy([{option:"Custom",value:"null"},{option:"Gmail",value:"'gmail'"},{option:"Hotmail",value:"'hotmail'"},{option:"Yahoo",value:"'yahoo'"},{option:"Outlook365",value:"'outlook365'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b["arraySmtp.service"]=_.keyBy([{option:"Custom",value:"null"},{option:"Gmail",value:"'gmail'"},{option:"Hotmail",value:"'hotmail'"},{option:"Yahoo",value:"'yahoo'"},{option:"Outlook365",value:"'outlook365'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.mail.mailAccounts.edit",{id:e.id,mailAccount:e,crudPermissions:b.crudPermissions})},b.verifysmtpverifysmtp=function(e,t){{if(e&&e.id)return m.mailAccount.verifySmtp({id:e.id}).$promise.then(function(){p.success({title:"Smtp properly verified",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"Smtp properly verified",msg:e.data?JSON.stringify(e.data):e.toString()})});p.error({title:"Smtp properly verified",msg:"Smpt id unknown"})}},b.interactionsgoto=function(e,t){n.go("app.mail.mailAccounts.edit",{id:e.id,tab:7})},b.gotorealtimegoto=function(e,t){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:610}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.go("app.mail.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()})});n.go("app.mail.realtime.accounts",{})}},b.agentadddialog=function(e,t){i.show({controller:"MailAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{mailAccount:e,mailAccounts:b.mailAccounts?b.mailAccounts.rows:[],crudPermissions:b.crudPermissions,realtime:!1}})},b.deleteconfirm=function(e,t){var n=i.confirm().title("Are you sure want to delete the "+_.startCase("mailAccount")+"?").htmlContent("<b>"+(e.name||"mailAccount")+"</b> will be deleted.").ariaLabel("delete mailAccount").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getMailAccounts=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.mailAccount.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="MailAccounts",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditMailAccount=function(e,t){i.show({controller:"CreateOrEditMailAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailAccount:t,mailAccounts:b.mailAccounts.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteMailAccount=S,b.exportSelectedMailAccounts=function(){var e=angular.copy(b.selectedMailAccounts);return b.selectedMailAccounts=[],e},b.deleteSelectedMailAccounts=function(e){var t=i.confirm().title("Are you sure want to delete the selected mailAccounts?").htmlContent("<b>"+b.selectedMailAccounts.length+" selected</b> will be deleted.").ariaLabel("delete MailAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedMailAccounts.forEach(function(e){S(e)}),b.selectedMailAccounts=[]})},b.deselectMailAccounts=function(){b.selectedMailAccounts=[]},b.selectAllMailAccounts=function(){b.selectedMailAccounts=b.mailAccounts.rows},g.hasRole("admin")?m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){b.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){b.lists=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(b.lists,{id:e.resourceId})}),n=null;if(b.mailAccount&&(n=_.find(b.lists,{id:Number(b.mailAccount.ListId)})),n&&!_.some(t,["id",n.id])){var a=_.find(b.lists,{id:n.id});a.canSelect=!1,t.push(a)}b.lists=t})}else{var n=[],a=null;b.mailAccount&&(a=_.find(b.lists,{id:Number(b.mailAccount.ListId)}));for(var i=0;i<b.lists.length;i++)a&&b.lists[i].id===a.id&&(b.lists[i].canSelect=!1,n.push(b.lists[i]));b.lists=n}}).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 E=!0,A=1;function y(e){b.mailAccounts=e||{count:0,rows:[]}}function S(e){if(e.service)return p.error({title:"Mail Account not deleted!",msg:"You can't remove service account"});m.mailAccount.delete({id:e.id}).$promise.then(function(){_.remove(b.mailAccounts.rows,{id:e.id}),b.mailAccounts.count-=1,b.mailAccounts.rows.length||b.getMailAccounts(),p.success({title:_.startCase("MailAccount")+" 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:DELETEmailAccount"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEmailAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getMailAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","mailAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.mail").controller("MailAccountsController",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(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_MAILQUEUE",g.mailQueue=angular.copy(l),g.mailQueues=r,g.newMailQueue=!1,g.mailQueue||(g.mailQueue={strategy:"beepall",timeout:10},g.title="MAIL.NEW_MAILQUEUE",g.newMailQueue=!0),g.addNewMailQueue=function(){g.errors=[],d.mailQueue.save(g.mailQueue).$promise.then(function(e){g.mailQueues.unshift(e.toJSON()),o.success({title:"MailQueue properly created",msg:g.mailQueue.name?g.mailQueue.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.mailQueue.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveMailQueue=function(){g.errors=[],d.mailQueue.update({id:g.mailQueue.id},g.mailQueue).$promise.then(function(e){var t=_.find(g.mailQueues,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"MailQueue properly saved!",msg:g.mailQueue.name?g.mailQueue.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.mailQueue.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteMailQueue=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The mailQueue will be deleted.").ariaLabel("Delete MailQueue").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.mailQueue.delete({id:g.mailQueue.id}).$promise.then(function(){_.remove(g.mailQueues,{id:g.mailQueue.id}),o.success({title:"MailQueue properly deleted!",msg:(g.mailQueue.name||"mailQueue")+" has been deleted!"}),v(g.mailQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailQueue.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.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(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","mailQueues","mailQueue","api","Auth","license","setting","crudPermissions"],angular.module("app.mail").controller("CreateOrEditMailQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,t,n,o,r,l,d){var c=this;function m(){return a(function(n,t){return a(function(t,n){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.mailQueue.getAgents({id:c.mailQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return t.penalty=e.UserMailQueue?"penalty "+e.UserMailQueue.penalty:"",t.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=l.getCurrentUser(),c.mailQueue=t,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(n,t){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.mailQueue.removeAgents({id:c.mailQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.mailQueue.addAgents({id:c.mailQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,items:[],selectedItems:[],showSelectAndDeselectAll:!o,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("MAIL.ALL_AGENTS"),labelSelected:r.instant("MAIL.SELECTED_AGENTS"),transferCallback:function(e,t){var n=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(n)}}}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,t,n,o,r){var l=this;function d(){return a(function(n,t){return a(function(t,n){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:l.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return l.allowedItems=_.map(t,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.startingAllowedItems=angular.copy(l.allowedItems),l.items.forEach(function(e){var t=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.mailQueue.getTeams({id:l.mailQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];l.selectedItems=_.map(t,function(e){return _.find(l.items,{id:e.id})}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}l.currentUser=o.getCurrentUser(),l.mailQueue=t,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={readOnly:!l.crudPermissions.canEdit,allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!0,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:n.instant("MAIL.ALL_TEAMS"),labelSelected:n.instant("MAIL.SELECTED_TEAMS"),transferCallback:function(e,t){var n=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(n)}},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(n,t){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.mailQueue.removeTeams({id:l.mailQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.mailQueue.addTeams({id:l.mailQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},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,t,n,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=t.protocol()+"://"+t.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,t){n.show({controller:"MailQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{mailQueue:e,mailQueues:u.mailQueues?u.mailQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,t){n.show({controller:"MailQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:t,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")},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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.mailQueues=l||{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="mailQueues",b.listOrder="",b.listOrderAsc=null,b.selectedMailQueues=[],b.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"mail",limit:10,page:1},b.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.mail.mailQueues.edit",{id:e.id,mailQueue:e,crudPermissions:b.crudPermissions})},b.teamadddialog=function(e,t){i.show({controller:"MailQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{mailQueue:e,mailQueues:b.mailQueues?b.mailQueues.rows:[],crudPermissions:b.crudPermissions}})},b.agentadddialog=function(e,t){i.show({controller:"MailQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{mailQueue:e,mailQueues:b.mailQueues?b.mailQueues.rows:[],crudPermissions:b.crudPermissions,realtime:!1}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.gotorealtimegoto=function(e,t){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:610}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.mail.realtime.queues",{})}},b.success=y,b.getMailQueues=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.mailQueue.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="MailQueues",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditMailQueue=function(e,t){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:t,mailQueues:b.mailQueues.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteMailQueue=S,b.exportSelectedMailQueues=function(){var e=angular.copy(b.selectedMailQueues);return b.selectedMailQueues=[],e},b.deleteSelectedMailQueues=function(e){var t=i.confirm().title("Are you sure want to delete the selected mailQueues?").htmlContent("<b>"+b.selectedMailQueues.length+" selected</b> will be deleted.").ariaLabel("delete MailQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedMailQueues.forEach(function(e){S(e)}),b.selectedMailQueues=[]})},b.deselectMailQueues=function(){b.selectedMailQueues=[]},b.selectAllMailQueues=function(){b.selectedMailQueues=b.mailQueues.rows};var E=!0,A=1;function y(e){b.mailQueues=e||{count:0,rows:[]}}function S(e){m.mailQueue.delete({id:e.id}).$promise.then(function(){_.remove(b.mailQueues.rows,{id:e.id}),b.mailQueues.count-=1,b.mailQueues.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEmailQueue"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getMailQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","mailQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.mail").controller("MailQueuesController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.mailSubtatuses,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The mailSubstatus will be deleted.").ariaLabel("Delete MailSubstatus").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.mailSubtatuses=l||{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="mailSubtatuses",b.listOrder="",b.listOrderAsc=null,b.selectedMailSubstatuses=[],b.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},b.editdialog=function(e,t){i.show({controller:"CreateOrEditMailSubstatusDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailSubtatuses/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{mailSubstatus:e,mailSubtatuses:b.mailSubtatuses.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getMailSubstatuses=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.mailSubstatus.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="MailSubstatuses",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditMailSubstatus=function(e,t){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:t,mailSubtatuses:b.mailSubtatuses.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteMailSubstatus=S,b.exportSelectedMailSubstatuses=function(){var e=angular.copy(b.selectedMailSubstatuses);return b.selectedMailSubstatuses=[],e},b.deleteSelectedMailSubstatuses=function(e){var t=i.confirm().title("Are you sure want to delete the selected mailSubtatuses?").htmlContent("<b>"+b.selectedMailSubstatuses.length+" selected</b> will be deleted.").ariaLabel("delete MailSubstatuss").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedMailSubstatuses.forEach(function(e){S(e)}),b.selectedMailSubstatuses=[]})},b.deselectMailSubstatuses=function(){b.selectedMailSubstatuses=[]},b.selectAllMailSubstatuses=function(){b.selectedMailSubstatuses=b.mailSubtatuses.rows};var E=!0,A=1;function y(e){b.mailSubtatuses=e||{count:0,rows:[]}}function S(e){m.mailSubstatus.delete({id:e.id}).$promise.then(function(){_.remove(b.mailSubtatuses.rows,{id:e.id}),b.mailSubtatuses.count-=1,b.mailSubtatuses.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEmailSubstatus"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getMailSubstatuses())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","mailSubtatuses","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.mail").controller("MailSubstatusesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){_.forIn(p.mailAccounts,function(e,t){p.rpcMailAccounts[t]&&_.merge(e,p.rpcMailAccounts[t])}),_.forIn(p.mailAccounts,function(t,e){var n={id:e,sort:"-id",direction:"in",limit:1,offset:0,$gte:"createdAt,"+moment().startOf("day").format("YYYY-MM-DD HH:mm:ss")};s.mailAccount.getMessages(n).$promise.then(function(e){return e&&(t.in=e.count||0,t.lastIn=e.rows&&e.rows.length?e.rows[0].createdAt:void 0),n.direction="out",s.mailAccount.getMessages(n).$promise}).then(function(e){e&&(t.out=e.count||0,t.lastOut=e.rows&&e.rows.length?e.rows[0].createdAt:void 0)}).catch(function(e){console.log(e)})})}p.currentUser=u.getCurrentUser(),p.count=l&&l.count?l.count:0,p.mailAccounts=l?_.keyBy(l.rows?l.rows:[],"id"):{},p.rpcMailAccounts=d?_.keyBy(d.rows?d.rows:[],"id"):{},p.userProfile=c,p.userProfileSection=m&&1==m.count?m.rows[0]:null,p.crudPermissions=u.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.query={sort:"-name",limit:10,page:1},p.success=f,p.$onInit=g,p.getMailAccounts=function(){p.query.offset=(p.query.page-1)*p.query.limit,u.hasRole("admin")?p.promise=s.mailAccount.get(p.query,f).$promise:(p.query.id=p.userProfile.id,p.query.section="MailAccounts",p.promise=s.userProfile.getResources(p.query,f).$promise)},p.onSave=function(e){p.mailAccounts[e.id]&&_.merge(p.mailAccounts[e.id],e)},p.onMailMessageSave=function(e){p.mailAccounts[e.MailAccountId]&&("in"==e.direction?(p.mailAccounts[e.MailAccountId].in+=1,p.mailAccounts[e.MailAccountId].lastIn=e.createdAt):(p.mailAccounts[e.MailAccountId].out+=1,p.mailAccounts[e.MailAccountId].lastOut=e.createdAt))},p.goToMailAccount=function(e,t){i.go("app.mail.mailAccounts.edit",{id:t.id,mailAccount:t})},p.verifySmtp=function(e,t){{if(t&&t.id)return s.mailAccount.verifySmtp({id:t.id}).$promise.then(function(){r.success({title:"Smtp properly verified",msg:"Connection succeded!"})}).catch(function(e){r.error({title:"Smtp properly verified",msg:e.data?JSON.stringify(e.data):e.toString()})});r.error({title:"Smtp properly verified",msg:"Smpt id unknown"})}},p.order=[],_.forIn(p.mailAccounts,function(e,t){p.order.push(e.id)}),o.on("mailAccount:save",p.onSave),o.on("mailAccount:update",p.onSave),o.on("mailMessage:save",p.onMailMessageSave);var v=!0,h=1;function f(e){if(p.mailAccounts=e?_.keyBy(e.rows?e.rows:[],"id"):{},e.rows){p.order=[];for(var t=0;t<e.rows.length;t++)p.order.push(e.rows[t].id)}g()}e.$watch("vm.query.filter",function(e,t){v?n(function(){v=!1}):(t||(h=p.query.page),e!==t&&(p.query.page=1),e||(p.query.page=h),p.getMailAccounts())}),e.$on("$destroy",function(){o.removeAllListeners("mailAccount:save"),o.removeAllListeners("mailAccount:update"),o.removeAllListeners("mailMessage:save")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$state","api","socket","toasty","mailAccounts","rpcMailAccounts","userProfile","userProfileSection","Auth"],angular.module("app.mail").controller("MailAccountsRealtimeController",e)}(),function(){"use strict";function e(e,o,t,n,a,i,s,r,l,d,c,m,u,p,g,v,h,f){var b=this,E=["userpic","online","lastLoginAt","lastPauseAt","pauseType","lastPauseAt","internal","address","chatPause","openchannelPause","mailPause","smsPause","faxPause","voicePause","chatCapacity","openchannelCapacity","mailCapacity","smsCapacity","faxCapacity","chatCurrentCapacity","openchannelCurrentCapacity","mailCurrentCapacity","smsCurrentCapacity","faxCurrentCapacity","chatStatus","openchannelStatus","mailStatus","smsStatus","faxStatus","voiceStatus","chatStatusTime","openchannelStatusTime","mailStatusTime","smsStatusTime","faxStatusTime","voiceStatusTime","queue","destconnectedlinenum","onhold"],A=["chatPause","openchannelPause","mailPause","smsPause","faxPause","voicePause","online"];for(var y in b.currentUser=v.getCurrentUser(),b.availableStates=["ringing","inuse","busy","onhold","not_inuse"],b.pauses=s||{count:0,rows:[]},b.license=h,b.userProfile=p,b.userProfileSection=g&&1==g.count?g.rows[0]:null,b.crudPermissions=v.parseCrudPermissions(b.userProfileSection?b.userProfileSection.crudPermissions:null),b.agents=r?_.keyBy(r.rows?r.rows:[],"id"):{},b.rpcAgents=l?_.keyBy(l.rows?l.rows:[],"id"):{},b.paginatedAgents={},b.load=!1,b.order=[],b.agentInternal={},b.agents)b.agents.hasOwnProperty(y)&&(b.agents[y].init=!0);b.query={limit:10,page:1,order:"fullname",globalStatusFilter:"",pauseTypeFilter:""},b.logout=function(e,t){return d.user.logout({id:e.id,device:"realtime",agent_id:e.id,agent_name:e.name}).$promise.then(function(){m.success({title:"Agent logout",msg:e.fullname+"  properly logout"}),b.agents[e.id]&&(b.agents[e.id].online=!1),b.rpcAgents[e.id]&&(b.rpcAgents[e.id].online=!1),T()}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.queueAdd=function(e,t){n.show({controller:"AgentqueueaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/queueadd/queueadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{agent:e,agents:[],channel:"mail",direction:"inbound",crudPermissions:b.crudPermissions}})},b.pause=function(t,e){return d.user.pause({id:t.id,type:e}).$promise.then(function(e){b.agents[t.id]&&_.merge(b.agents[t.id],_.pick(e,E)),b.rpcAgents[t.id]&&_.merge(b.rpcAgents[t.id],_.pick(e,E)),O(b.agents[t.id])}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.unPause=function(t){return d.user.unpause({id:t.id}).$promise.then(function(e){b.agents[t.id]&&_.merge(b.agents[t.id],_.pick(e,E)),b.rpcAgents[t.id]&&_.merge(b.rpcAgents[t.id],_.pick(e,E)),O(b.agents[t.id])}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.showInfo=function(e){n.show(n.alert().clickOutsideToClose(!0).title("Legend").htmlContent("<div>TODO legend status + state</div>").ok("Ok").targetEvent(e))},b.getAgentStatus=w,b.getAgentGlobalStatus=O,b.isPause=I,b.checkPause=function(e){return"pause"===e},b.isPartialPause=function(e){return"*pause"===e},b.onSave=function(e){b.agents[e.id]&&(_.merge(b.agents[e.id],_.pick(_.omit(e,A),E)),_.merge(b.rpcAgents[e.id],_.pick(_.omit(e,A),E)),O(b.agents[e.id]))},b.onUpdate=function(e){b.agents[e.id]&&(_.merge(b.agents[e.id],_.pick(e,E)),_.merge(b.rpcAgents[e.id],_.pick(e,E)),e.lastPauseAt&&(b.agents[e.id].globalStatusTime=e.lastPauseAt,b.rpcAgents[e.id].globalStatusTime=e.lastPauseAt),O(b.agents[e.id]))},b.onInit=T,b.onConnect=function(e){b.agents[b.agentInternal[e.destaccountcode]]&&(_.merge(b.agents[b.agentInternal[e.destaccountcode]],_.pick(e,["queue","destconnectedlinenum"])),_.merge(b.rpcAgents[b.agentInternal[e.destaccountcode]],_.pick(e,["queue","destconnectedlinenum"])))},b.onComplete=function(e){b.agents[b.agentInternal[e.destaccountcode]]&&(b.agents[b.agentInternal[e.destaccountcode]]=_.omit(b.agents[b.agentInternal[e.destaccountcode]],["queue","destconnectedlinenum"]),b.rpcAgents[b.agentInternal[e.destaccountcode]]=_.omit(b.rpcAgents[b.agentInternal[e.destaccountcode]],["queue","destconnectedlinenum"]))},c.on("user:save",b.onSave),c.on("user:update",b.onUpdate),c.on("user:agentconnect",b.onConnect),c.on("user:agentcomplete",b.onComplete),T();var S=f(function(){b.load&&(b.load=!1,T())},999);function T(e){b.load=!1;var t,n,a=o.defer();b.promise=a.promise,b.filteredAgents=[],b.order=[],_.forIn(b.agents,function(e,t){b.rpcAgents[t]&&_.merge(e,_.pick(_.omit(b.rpcAgents[t],A),E)),O(e),e.online?(b.filteredAgents.push(e),b.agentInternal[e.internal]=t):e.globalStatusTime=_.toNumber(moment().format("x"))}),b.query.globalStatusFilter&&_.remove(b.filteredAgents,function(e){return e.globalStatus!==b.query.globalStatusFilter}),b.query.pauseTypeFilter&&_.remove(b.filteredAgents,function(e){return e.pauseType!==b.query.pauseTypeFilter}),b.query.filter&&_.remove(b.filteredAgents,function(e){return e.fullname.toLowerCase().indexOf(b.query.filter.toLowerCase())<0}),b.filteredAgents=(t=b.filteredAgents,n=_.startsWith(b.query.order,"-")?"desc":"asc",_.orderBy(t,[b.query.order.replace("-","")],[n]));var i=(b.query.page-1)*b.query.limit;b.paginatedAgents=_.drop(b.filteredAgents,i).slice(0,b.query.limit);for(var s=0;s<b.paginatedAgents.length;s+=1)b.order.push(b.paginatedAgents[s].id);a.resolve(),b.load=!0}function I(e){return"pause"===e||"*pause"===e}function C(e){return"idle"===e||"unknown"===e||"unavailable"===e||"ringing"===e||_.isNil(e)}function w(e,t){return"voice"===t?"idle"!==e[t+"Status"]?e[t+"Status"]:e[t+"Pause"]?e[t+"Status"]="pause":"idle":e[t+"Pause"]?e[t+"Status"]="pause":e[t+"Status"]}function O(e){var t="unknown";t=_.every([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],I)?"pause":_.some([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],I)?"*pause":_.every([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],C)?"idle":"busy",e.globalStatus!==t&&(e.globalStatus=t,e.init?(e.init=!1,e.globalStatusTime=I(t)?_.toNumber(moment(e.lastPauseAt).format("x")):_.max([e.voiceStatusTime,e.chatStatusTime,e.mailStatusTime,e.smsStatusTime,e.openchannelStatusTime,e.faxStatusTime])):e.globalStatusTime=_.toNumber(moment().format("x")))}e.$on("$destroy",function(){c.removeAllListeners("user:save"),c.removeAllListeners("user:update"),c.removeAllListeners("user:agentconnect"),c.removeAllListeners("user:agentcomplete"),S&&(f.cancel(S),S=null)})}e.$inject=["$scope","$q","$timeout","$mdDialog","$document","$filter","pauses","agents","rpcAgents","api","socket","toasty","helperClasses","userProfile","userProfileSection","Auth","license","$interval"],angular.module("app.voice").controller("AgentsMailRealtimeController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this,v=["loggedIn","available","waiting","talking","pTalking","originated","message","dialActive","dialMethod","Trunk","paused"];function h(){var n=[];return _.forIn(g.queues,function(e,t){e.paused=0,e.loggedInDb=0,g.queues[t].agents={},n.push(l.mailQueue.getMembers({id:t}).$promise),g.rpcQueues[t]&&_.merge(e,_.pick(g.rpcQueues[t],v))}),t.all(n).then(function(e){for(var t=0;t<e.length;t+=1)for(var n=0;n<e[t].rows.length;n++)e[t].rows[n].paused&&g.queues[e[t].rows[n].MailQueueId].paused++,g.queues[e[t].rows[n].MailQueueId].loggedInDb++,g.queues[e[t].rows[n].MailQueueId].agents[e[t].rows[n].UserId]=e[t].rows[n].MailQueueId}).catch(function(e){console.error(e)})}g.currentUser=p.getCurrentUser(),g.count=o.count?o.count:0,g.queues=o?_.keyBy(o.rows?o.rows:[],"id"):{},g.rpcQueues=r?_.keyBy(r.rows?r.rows:[],"id"):{},g.userProfile=m,g.userProfileSection=u&&1==u.count?u.rows[0]:null,g.crudPermissions=p.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),p.hasRole("admin")?g.query={type:"inbound",sort:"-updatedAt",limit:10,page:1}:g.query={id:g.currentUser.id,channel:"mail",type:"inbound",sort:"-updatedAt",limit:10,page:1},g.success=E,g.getQueues=function(){g.query.offset=(g.query.page-1)*g.query.limit,p.hasRole("admin")?g.promise=l.mailQueue.get(g.query,E).$promise:(g.query.id=g.userProfile.id,g.query.section="MailQueues",g.promise=l.userProfile.getResources(g.query,E).$promise)},g.createOrEditMailQueue=function(e,t){a.show({controller:"CreateOrEditMailQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailQueue:t,mailQueues:_.values(g.queues),license:null,setting:null,crudPermissions:g.crudPermissions}})},g.agentAdd=function(e,t){a.show({controller:"MailQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailQueue:t,mailQueues:g.queues?g.queues.rows:[],realtime:!1,crudPermissions:g.crudPermissions}})},g.updateQueue=function(e){return l.mailQueue.update(e).$promise.then(function(){c.success({title:"Queue properly updated!",msg:e.name?e.name+" has been updated!":""})}).catch(function(e){c.error({title:"Error creating queue!",msg:e.message})})},g.onSave=function(e){g.queues[e.id]&&_.merge(g.queues[e.id],_.pick(e,v))},g.onSaveMember=function(e){g.queues[e.MailQueueId]&&g.queues[e.MailQueueId].loggedInDb++},g.onRemoveMember=function(e){g.queues[e.MailQueueId]&&g.queues[e.MailQueueId].loggedInDb--},g.onPause=function(n){console.log("onPause",n),n.voicePause?_.forIn(g.queues,function(e,t){e.agents[n.id]&&(e.paused+=1,console.log("pause"))}):n.voicePause||_.forIn(g.queues,function(e,t){e.agents[n.id]&&0<e.paused&&(e.paused-=1,console.log("unpause"))})},g.onLogin=function(e){console.log("onLogged",e),g.queues[e.MailQueueId]&&(g.queues[e.MailQueueId].loggedInDb+=1,g.queues[e.MailQueueId].agents[e.UserId]=e.MailQueueId)},g.onLogout=function(e){console.log("onLogout",e),g.queues[e.MailQueueId]&&0<g.queues[e.MailQueueId].loggedInDb&&(g.queues[e.MailQueueId].loggedInDb-=1,delete g.queues[e.MailQueueId].agents[e.UserId])},g.$onInit=h,g.order=[],_.forIn(g.queues,function(e,t){g.order.push(e.id)}),d.on("mail_queue:save",g.onSave),d.on("userMailQueue:save",g.onSaveMember),d.on("userMailQueue:remove",g.onRemoveMember),d.on("user:update",g.onPause),d.on("userVoiceQueue:remove",g.onLogout),d.on("userVoiceQueue:save",g.onLogin);var f=!0,b=1;function E(e){if(g.count=e.count,g.queues=e?_.keyBy(e.rows?e.rows:[],"id"):{},e.rows){g.order=[];for(var t=0;t<e.rows.length;t++)g.order.push(e.rows[t].id)}h()}e.$watch("vm.query.filter",function(e,t){f?n(function(){f=!1}):(t||(b=g.query.page),e!==t&&(g.query.page=1),e||(g.query.page=b),g.getQueues())}),e.$on("$destroy",function(){d.removeAllListeners("mail_queue:save"),d.removeAllListeners("userMailQueue:remove"),d.removeAllListeners("userMailQueue:save"),d.removeAllListeners("user:update"),d.removeAllListeners("userVoiceQueue:remove"),d.removeAllListeners("userVoiceQueue:save")})}e.$inject=["$scope","$timeout","$mdDialog","$q","$document","$interval","queues","rpcQueues","api","socket","toasty","userProfile","userProfileSection","Auth"],angular.module("app.mail").controller("QueuesMailRealtimeController",e)}(),function(){"use strict";angular.module("app.auth").factory("helperClasses",function(){return{status:{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"},state:{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"},channelStatus:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},channelStatusOut:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"}}})}(),function(){"use strict";function e(e,n,t){switch(t.disconnect(),t.connect(),this.selectedTab=0,n.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,n.go("app.mail.realtime.agents")}e.$watch("vm.selectedTab",function(e,t){if(e!==t)switch(e){case 0:n.go("app.mail.realtime.agents");break;case 1:n.go("app.mail.realtime.queues");break;case 2:n.go("app.mail.realtime.accounts");break;default:n.go("app.mail.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.mail").controller("MailRealtimeController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.plugins,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The plugin will be deleted.").ariaLabel("Delete Plugin").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,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=t.protocol()+"://"+t.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")},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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.plugins=l||{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="plugins",b.listOrder="",b.listOrderAsc=null,b.selectedPlugins=[],b.query={fields:"createdAt,updatedAt,id,name,type,active,description,icon,sidebar,path,adminUrl,agentUrl,scriptName,scriptPath,version",sort:"name",limit:10,page:1},b.installing=!1,b.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"),"")}),b.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){b.errors=e.data.errors||[{message:e.toString(),type:"api.plugin.update"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})});b.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(){b.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){b.errors=e.data.errors||[{message:e.toString(),type:"api.pm2.save"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})})}},b.editstate=function(e,t){n.go("app.marketplace.plugins.edit",{id:e.id,plugin:e,crudPermissions:b.crudPermissions})},b.stopplugin=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){var n;n=e,m.pm2.get().$promise.then(function(e){if(!e||!e.rows)throw new Error("Failed to retrieve pm2 processes");var t=_.find(e.rows,{name:n.scriptName});if(!t)throw new Error("No corresponding process found");m.pm2.update({id:t.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){b.errors=e.data.errors||[{message:e.toString(),type:"api.pm2.update"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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")})},b.restartplugin=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){var n;n=e,m.pm2.get().$promise.then(function(e){if(!e||!e.rows)throw new Error("Failed to retrieve pm2 processes");var t=_.find(e.rows,{name:n.scriptName});if(!t)throw new Error("No corresponding process found");m.pm2.update({id:t.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){b.errors=e.data.errors||[{message:e.toString(),type:"api.pm2.update"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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")})},b.downloadfile2=function(s,e){return m.plugin.download({id:s.id}).$promise.then(function(e){var t=[e.buffer],n="download",a=new Blob(t,{type:e.type});n=s.name.replace(" ","_").toLowerCase()+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})})},b.uninstallplugin=function(e,t){var n=i.confirm().title("Are you sure want to uninstall the plugin?").htmlContent("<b>"+(e.name||"plugin")+"</b> will be uninstalled.").ariaLabel("uninstall plugin").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){!function(n){"script"===n.type&&m.pm2.get().$promise.then(function(e){if(!e||!e.rows)throw new Error("Failed to retrieve pm2 processes");var t=_.find(e.rows,{name:n.scriptName});if(!t)throw new Error("No corresponding process found");m.pm2.delete({id:t.pm_id,name:n.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()})});n.active=!1,m.plugin.update({id:n.id},n).$promise.then(function(){p.success({title:"Plugin uninstalled!",msg:n.name?n.name+" has been uninstalled!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){b.errors=e.data.errors||[{message:e.toString(),type:"api.plugin.update"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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")})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getPlugins=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.plugin.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Plugins",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditPlugin=function(e,t){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:t,plugins:b.plugins.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deletePlugin=S,b.exportSelectedPlugins=function(){var e=angular.copy(b.selectedPlugins);return b.selectedPlugins=[],e},b.deleteSelectedPlugins=function(e){var t=i.confirm().title("Are you sure want to delete the selected plugins?").htmlContent("<b>"+b.selectedPlugins.length+" selected</b> will be deleted.").ariaLabel("delete Plugins").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedPlugins.forEach(function(e){S(e)}),b.selectedPlugins=[]})},b.deselectPlugins=function(){b.selectedPlugins=[]},b.selectAllPlugins=function(){b.selectedPlugins=b.plugins.rows},b.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:b.plugins.rows}})};var E=!0,A=1;function y(e){b.plugins=e||{count:0,rows:[]}}function S(n){n.active&&"script"==n.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 t=_.find(e.rows,{name:n.scriptName});t?m.pm2.delete({id:t.pm_id,name:n.scriptName}).$promise:console.log("No '%s' process found",n.scriptName)}).catch(function(e){return p.error({title:"PM2 process not found!",msg:"Failed to delete the attached pm2 process"})}),m.plugin.delete({id:n.id}).$promise.then(function(){_.remove(b.plugins.rows,{id:n.id}),b.plugins.count-=1,b.plugins.rows.length||b.getPlugins(),p.success({title:_.startCase("Plugin")+" deleted!",msg:n.name?n.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:DELETEplugin"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getPlugins())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","plugins","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.marketplace").controller("MarketplacePluginsController",e)}(),function(){"use strict";function e(e,t,n,a,i,s){var o=this,r=2,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 t=["zip"];if(!_.includes(t,e.getExtension()))return n.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+t.join()}),!1;if(e.size>l)return n.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(t,e){if(t.id===a.uniqueIdentifier){var n=new FileReader;n.readAsDataURL(t.file.file),n.onload=function(e){t.url=e.target.result}}})},o.uploadError=function(e,t){o.ngFlow.flow.cancel(),n.error({title:"Upload error",msg:"Cannot upload the plugin"}),o.uploadState="failed"},o.uploadComplete=function(){"failed"!==o.uploadState&&(o.uploadState="completed",n.success({title:"Upload completed",msg:o.plugin.file.name+" uploaded successfully"}))},o.closeDialog=function(){t.hide()}}e.$inject=["$cookies","$mdDialog","toasty","plugins","api","Auth"],angular.module("app.marketplace").controller("UploadPluginDialogController",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(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,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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.ivrCampaigns,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The ivrCampaign will be deleted.").ariaLabel("Delete IvrCampaign").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.trunks,{id:e.resourceId})});g.trunks.forEach(function(e){_.some(t,["id",e.id])||(e.canSelect=!1),t.push(e)}),g.trunks=t})}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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.projects,{id:e.resourceId})}),n=null;if(g.ivrCampaign&&(n=_.find(g.projects,{id:Number(g.ivrCampaign.SquareProjectId)})),n&&!_.some(t,["id",n.id])){var a=_.find(g.projects,{id:n.id});a.canSelect=!1,t.push(a)}g.projects=t})}else{var n=[],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,n.push(g.projects[i]));g.projects=n}}).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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.interval,{id:e.resourceId})}),n=null;if(g.ivrCampaign&&(n=_.find(g.interval,{id:Number(g.ivrCampaign.IntervalId)})),n&&!_.some(t,["id",n.id])){var a=_.find(g.interval,{id:n.id});a.canSelect=!1,t.push(a)}g.interval=t})}else{var n=[],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,n.push(g.interval[i]));g.interval=n}}).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,t,n,o,r,l){var d=this;function c(){return a(function(n,t){return a(function(t,n){return s.cmList.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return d.items=e.rows?e.rows:[],r.hasRole("admin")?e:d.section?d.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:d.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return d.allowedItems=_.map(t,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 t=_.find(d.allowedItems,{id:e.id});"admin"===d.currentUser.role?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s[d.apiRoute][d.getApi]({id:d.ivrCampaign.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];d.selectedItems=_.map(t,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"),n()}).catch(function(e){t(e)})})}d.currentUser=r.getCurrentUser(),d.ivrCampaign=t,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={readOnly:!d.crudPermissions.canEdit,allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!1,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:n.instant("MOTIONDIALER.ALL_LISTS"),labelSelected:n.instant("MOTIONDIALER.SELECTED_LISTS"),transferCallback:function(e,t){var n=_.xorBy(d.startingSelectedItems,d.selectedItems,"id");d.pendingChanges=!_.isEmpty(n)}},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(n,t){s.userProfileSection.get({userProfileId:d.currentUser.userProfileId,name:"Lists"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(d.selectedItems,d.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s[d.apiRoute][d.removeApi]({id:d.ivrCampaign.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s[d.apiRoute][d.addApi]({id:d.ivrCampaign.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},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(t,n,a,e,i,s,o){var r=this;function l(e){t.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!":""}),n.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 t=0;t<e.data.errors.length;t+=1)a.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.ivrCampaign={},c.ivrCampaignHopperBlacks={count:0,rows:[]},c.selectedIvrCampaignHopperBlacks=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,ContactId,phone",sort:"-id",limit:10,page:1},c.init=function(e,t){c.ivrCampaign=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.ivrCampaign.id,c.query.CampaignId=c.ivrCampaign.id,c.getIvrCampaignHopperBlacks()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the hopperBlack?").htmlContent("<b>"+(e.name||"hopperBlack")+"</b> will be deleted.").ariaLabel("delete hopperBlack").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getIvrCampaignHopperBlacks=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.campaign.getHopperBlacks(c.query,p).$promise},c.createOrEditIvrCampaignHopperBlack=function(e,t){s.show({controller:"CreateOrEditHopperBlackDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/hopperBlacks/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:c.ivrCampaign,hopperBlack:t,hopperBlacks:c.ivrCampaignHopperBlacks.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedIvrCampaignHopperBlacks=function(){var e=angular.copy(c.selectedIvrCampaignHopperBlacks);return c.selectedIvrCampaignHopperBlacks=[],e},c.deleteIvrCampaignHopperBlack=g,c.deleteSelectedIvrCampaignHopperBlacks=function(e){var t=s.confirm().title("Are you sure want to delete the selected hopperBlacks?").htmlContent("<b>"+c.selectedIvrCampaignHopperBlacks.length+" selected</b> will be deleted.").ariaLabel("delete hopperBlacks").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedIvrCampaignHopperBlacks.forEach(function(e){g(e)}),c.selectedIvrCampaignHopperBlacks=[]})};var m=!0,u=1;function p(e){c.ivrCampaignHopperBlacks=e||{count:0,rows:[]}}function g(e){l.hopperBlack.delete({id:e.id}).$promise.then(function(){_.remove(c.ivrCampaignHopperBlacks.rows,{id:e.id}),c.ivrCampaignHopperBlacks.count-=1,c.ivrCampaignHopperBlacks.rows.length||c.getIvrCampaignHopperBlacks(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcampaign"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getIvrCampaignHopperBlacks())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("IvrCampaignHopperBlacksController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.contacts={},c.ivrCampaign={},c.ivrCampaignHopperFinals={count:0,rows:[]},c.selectedIvrCampaignHopperFinals=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,uniqueid,ContactId,calleridnum,calleridname,statedesc,countcongestionretry,countbusyretry,countnoanswerretry,countglobal,scheduledat,starttime,responsetime,endtime,disposition,ListId,UserId,VoiceQueueId,CampaignId,recallme,deleted,campaign",sort:"-id",limit:10,page:1},c.init=function(e,t){c.ivrCampaign=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.ivrCampaign.id,c.query.CampaignId=c.ivrCampaign.id,c.getIvrCampaignHopperFinals()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the hopperFinal?").htmlContent("<b>"+(e.name||"hopperFinal")+"</b> will be deleted.").ariaLabel("delete hopperFinal").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getIvrCampaignHopperFinals=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.campaign.getHopperFinals(c.query,p).$promise},c.createOrEditIvrCampaignHopperFinal=function(e,t){s.show({controller:"CreateOrEditHopperFinalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/hopperFinals/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:c.ivrCampaign,hopperFinal:t,hopperFinals:c.ivrCampaignHopperFinals.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedIvrCampaignHopperFinals=function(){var e=angular.copy(c.selectedIvrCampaignHopperFinals);return c.selectedIvrCampaignHopperFinals=[],e},c.deleteIvrCampaignHopperFinal=g,c.deleteSelectedIvrCampaignHopperFinals=function(e){var t=s.confirm().title("Are you sure want to delete the selected hopperFinals?").htmlContent("<b>"+c.selectedIvrCampaignHopperFinals.length+" selected</b> will be deleted.").ariaLabel("delete hopperFinals").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedIvrCampaignHopperFinals.forEach(function(e){g(e)}),c.selectedIvrCampaignHopperFinals=[]})},c.moveIvrCampaignHopperFinal=v,c.moveContactsIvrCampaignHopperFinal=function(e){l.cmHopperFinal.moveContactsIvrCampaignHopperFinal({id:c.query.id,state:e}).$promise.then(function(e){_.isNil(e)&&_.isNil(e[0])?r.info({title:"Restored Contacts",msg:"0"}):r.info({title:"Restored Contacts",msg:JSON.stringify(e[0].affectedRows)})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},c.countContactsIvrCampaignHopperFinal=function(e){l.cmHopperFinal.countContactsIvrCampaignHopperFinal({id:e}).$promise.then(function(e){_.merge(c.contacts,e[0])}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},c.moveConfirm=function(e,t){var n=s.confirm().title("Are you sure want to restore the contact?").htmlContent("<b>Contact</b> will be restored.").ariaLabel("Restore Contact").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){v(e)},function(){console.log("CANCEL")})},c.moveSelectedIvrCampaignHopperFinals=function(e){var t=s.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");s.show(t).then(function(){c.selectedIvrCampaignHopperFinals.forEach(function(e){v(e)}),c.selectedIvrCampaignHopperFinals=[]})};var m=!0,u=1;function p(e){c.ivrCampaignHopperFinals=e||{count:0,rows:[]}}function g(e){l.hopperFinal.delete({id:e.id}).$promise.then(function(){_.remove(c.ivrCampaignHopperFinals.rows,{id:e.id}),c.ivrCampaignHopperFinals.count-=1,c.ivrCampaignHopperFinals.rows.length||c.getIvrCampaignHopperFinals(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcampaign"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.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){l.cmHopperFinal.checkContactHopper(a).$promise.then(function(e){r.info({title:"The contact is in the hopper",msg:"Contact ID "+e.ContactId})}).catch(function(e){var t,n;"Not Found"===e.data?l.cmHopper.save((t=a,n={},n.phone=t.calleridnum,n.scheduledat=moment().format("YYYY-MM-DD HH:mm:ss"),n.countbusyretry=0,n.countcongestionretry=0,n.countnoanswerretry=0,n.countglobal=0,n.ContactId=t.ContactId,n.ListId=t.ListId,n.UserId=t.deleted?null:t.UserId,n.VoiceQueueId=t.VoiceQueueId,n.CampaignId=t.CampaignId,n.priority=t.recallme?3:2,n.recallme=!!t.recallme,n)).$promise.then(function(e){var t,n;r.info({title:"Restored Contact",msg:"Contact ID "+e.ContactId}),e.ContactId&&l.cmHopperHistory.save(((n={}).calleridnum=(t=a).calleridnum,n.calleridname=t.calleridname,n.scheduledat=moment().format("YYYY-MM-DD HH:mm:ss"),n.countbusyretry=t.countbusyretry,n.countcongestionretry=t.countcongestionretry,n.countnoanswerretry=t.countnoanswerretry,n.countglobal=t.countglobal,n.ContactId=t.ContactId,n.ListId=t.ListId,n.UserId=d.getCurrentUser().id,n.VoiceQueueId=t.VoiceQueueId,n.CampaignId=t.CampaignId,n.editedat=moment().format("YYYY-MM-DD HH:mm:ss"),n.edited=!0,n.state=25,n.statedesc="Restored",n.campaign=t.campaign,n.campaigntype=t.VoiceQueueId?"queue":"ivr",n))}).catch(function(e){_.isNil(e.data)||"Validation error"!==e.data.message?r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()}):r.info({title:"The contact is in the hopper",msg:"Contact ID "+a.ContactId})}):r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getIvrCampaignHopperFinals())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("IvrCampaignHopperFinalsController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.ivrCampaign={},c.ivrCampaignHopperHistories={count:0,rows:[]},c.selectedIvrCampaignHopperHistories=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,uniqueid,ContactId,calleridnum,calleridname,statedesc,scheduledat,starttime,responsetime,endtime",sort:"-id",limit:10,page:1},c.init=function(e,t){c.ivrCampaign=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.ivrCampaign.id,c.query.CampaignId=c.ivrCampaign.id,c.getIvrCampaignHopperHistories()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the hopperHistory?").htmlContent("<b>"+(e.name||"hopperHistory")+"</b> will be deleted.").ariaLabel("delete hopperHistory").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getIvrCampaignHopperHistories=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.campaign.getHopperHistories(c.query,p).$promise},c.createOrEditIvrCampaignHopperHistory=function(e,t){s.show({controller:"CreateOrEditHopperHistoryDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/hopperHistories/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:c.ivrCampaign,hopperHistory:t,hopperHistories:c.ivrCampaignHopperHistories.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedIvrCampaignHopperHistories=function(){var e=angular.copy(c.selectedIvrCampaignHopperHistories);return c.selectedIvrCampaignHopperHistories=[],e},c.deleteIvrCampaignHopperHistory=g,c.deleteSelectedIvrCampaignHopperHistories=function(e){var t=s.confirm().title("Are you sure want to delete the selected hopperHistories?").htmlContent("<b>"+c.selectedIvrCampaignHopperHistories.length+" selected</b> will be deleted.").ariaLabel("delete hopperHistories").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedIvrCampaignHopperHistories.forEach(function(e){g(e)}),c.selectedIvrCampaignHopperHistories=[]})};var m=!0,u=1;function p(e){c.ivrCampaignHopperHistories=e||{count:0,rows:[]}}function g(e){l.hopperHistory.delete({id:e.id}).$promise.then(function(){_.remove(c.ivrCampaignHopperHistories.rows,{id:e.id}),c.ivrCampaignHopperHistories.count-=1,c.ivrCampaignHopperHistories.rows.length||c.getIvrCampaignHopperHistories(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcampaign"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getIvrCampaignHopperHistories())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("IvrCampaignHopperHistoriesController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.ivrCampaign={},c.ivrCampaignHoppers={count:0,rows:[]},c.selectedIvrCampaignHoppers=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,ContactId,phone,countcongestionretry,countbusyretry,countnoanswerretry,scheduledat,priority",sort:"-updatedAt",limit:10,page:1},c.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"),"")}),c.init=function(e,t){c.ivrCampaign=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.ivrCampaign.id,c.query.CampaignId=c.ivrCampaign.id,c.getIvrCampaignHoppers()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the hopper?").htmlContent("<b>"+(e.name||"hopper")+"</b> will be deleted.").ariaLabel("delete hopper").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getIvrCampaignHoppers=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.campaign.getHoppers(c.query,p).$promise},c.createOrEditIvrCampaignHopper=function(e,t){s.show({controller:"CreateOrEditHopperCampaignIdDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/hoppers/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:c.ivrCampaign,hopper:t,hoppers:c.ivrCampaignHoppers.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedIvrCampaignHoppers=function(){var e=angular.copy(c.selectedIvrCampaignHoppers);return c.selectedIvrCampaignHoppers=[],e},c.deleteIvrCampaignHopper=g,c.deleteSelectedIvrCampaignHoppers=function(e){var t=s.confirm().title("Are you sure want to delete the selected hoppers?").htmlContent("<b>"+c.selectedIvrCampaignHoppers.length+" selected</b> will be deleted.").ariaLabel("delete hoppers").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedIvrCampaignHoppers.forEach(function(e){g(e)}),c.selectedIvrCampaignHoppers=[]})},d.hasRole("admin")?l.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){c.agents=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){c.agents=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(c.agents,{id:e.resourceId})});c.agents.forEach(function(e){_.some(t,["id",e.id])||(e.canSelect=!1),t.push(e)}),c.agents=t})}else c.agents=[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})});var m=!0,u=1;function p(e){c.ivrCampaignHoppers=e||{count:0,rows:[]}}function g(e){l.cmHopper.delete({id:e.id}).$promise.then(function(){_.remove(c.ivrCampaignHoppers.rows,{id:e.id}),c.ivrCampaignHoppers.count-=1,c.ivrCampaignHoppers.rows.length||c.getIvrCampaignHoppers(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcampaign"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getIvrCampaignHoppers())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("IvrCampaignHoppersController",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(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),t.params.id&&(g.hopper.CampaignId=t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 n,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){n=_.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:n,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 t=_.find(g.hoppers,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The hopper will be deleted.").ariaLabel("Delete Hopper").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.agents,{id:e.resourceId})});g.agents.forEach(function(e){_.some(t,["id",e.id])||(e.canSelect=!1),t.push(e)}),g.agents=t})}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(n,a){var i=this;i.ivrCampaign={},i.init=function(t){i.ivrCampaign=t,n.cmHopper.get({limit:0,CampaignId:t.id}).$promise.then(function(e){return i.total=e.count||0,n.cmHopper.get({limit:0,CampaignId:t.id,active:!1,countbusyretry:0,countcongestionretry:0,countnoanswerretry:0}).$promise}).then(function(e){return i.fresh=e.count||0,n.cmHopperFinal.get({limit:0,CampaignId:t.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,t,n,o,r,l){var d=this;function c(){return a(function(n,t){return a(function(t,n){return s.cmList.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return d.items=e.rows?e.rows:[],r.hasRole("admin")?e:d.section?d.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:d.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return d.allowedItems=_.map(t,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 t=_.find(d.allowedItems,{id:e.id});"admin"===d.currentUser.role?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s[d.apiRoute][d.getApi]({id:d.ivrCampaign.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];d.selectedItems=_.map(t,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"),n()}).catch(function(e){t(e)})})}d.currentUser=r.getCurrentUser(),d.ivrCampaign=t,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={readOnly:!d.crudPermissions.canEdit,allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!1,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:n.instant("MOTIONDIALER.ALL_LISTS"),labelSelected:n.instant("MOTIONDIALER.SELECTED_LISTS"),transferCallback:function(e,t){var n=_.xorBy(d.startingSelectedItems,d.selectedItems,"id");d.pendingChanges=!_.isEmpty(n)}},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(n,t){s.userProfileSection.get({userProfileId:d.currentUser.userProfileId,name:"Lists"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(d.selectedItems,d.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s[d.apiRoute][d.removeApi]({id:d.ivrCampaign.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s[d.apiRoute][d.addApi]({id:d.ivrCampaign.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},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,t,a,i,s,n,o,r){var l=this;function d(){t.hide()}function c(e,t){var n=t.id;o.enqueue(function(){return i.campaign.removeLists({id:e,ids:n}).$promise.then(function(){return i.campaign.addLists({id:e,ids:n,dialCheckDuplicateType:"never"}).$promise}).then(function(){a.success({title:"Reset Succesfull",msg:"List "+t.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=n||[],l.loading=!1,l.closeDialog=d,l.exists=function(e,t){return-1<t.indexOf(e)},l.toggle=function(e,t){var n=t.indexOf(e);-1<n?t.splice(n,1):t.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,t){for(var n=0;n<l.selected.length;n+=1)c(s.id,l.selected[n]);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(n,e,i,s,a,t,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=t,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.ivrCampaign=c||n.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=n.params.tab||0,u.clonedialog=function(e,t){i.show({controller:"IvrCampaigncloneController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:u.ivrCampaigns?u.ivrCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.listadddialog=function(e,t){i.show({controller:"IvrCampaignlistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/listadd/listadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:u.ivrCampaigns?u.ivrCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.blacklistadddialog=function(e,t){i.show({controller:"IvrCampaignblacklistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/blacklistadd/blacklistadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:u.ivrCampaigns?u.ivrCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.resetlistdialog=function(t,n){r.campaign.getLists({id:t.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(n).ok("OK").cancel("CANCEL");i.show(e).then(function(){var e,t,n;e=u.ivrCampaign.id,t=a.rows[0],n=t.id,r.campaign.removeLists({id:e,ids:n}).$promise.then(function(){return r.campaign.addLists({id:e,ids:n,dialCheckDuplicateType:"never"}).$promise}).then(function(){l.success({title:"Reset Succesfull",msg:"List "+t.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:n,clickOutsideToClose:!1,locals:{ivrCampaign:t,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,t){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:1510}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.motiondialer.realtime.ivr_campaigns",{})}},u.alert=l.info,u.gotoIvrCampaigns=function(){n.go("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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.trunks,{id:e.resourceId})});u.trunks.forEach(function(e){_.some(t,["id",e.id])||(e.canSelect=!1),t.push(e)}),u.trunks=t})}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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.projects,{id:e.resourceId})}),n=null;if(u.ivrCampaign&&(n=_.find(u.projects,{id:Number(u.ivrCampaign.SquareProjectId)})),n&&!_.some(t,["id",n.id])){var a=_.find(u.projects,{id:n.id});a.canSelect=!1,t.push(a)}u.projects=t})}else{var n=[],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,n.push(u.projects[i]));u.projects=n}}).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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.interval,{id:e.resourceId})}),n=null;if(u.ivrCampaign&&(n=_.find(u.interval,{id:Number(u.ivrCampaign.IntervalId)})),n&&!_.some(t,["id",n.id])){var a=_.find(u.interval,{id:n.id});a.canSelect=!1,t.push(a)}u.interval=t})}else{var n=[],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,n.push(u.interval[i]));u.interval=n}}).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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.ivrCampaigns=l||{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="ivrCampaigns",b.listOrder="",b.listOrderAsc=null,b.selectedIvrCampaigns=[],b.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,dialOrderByScheduledAt,dialGlobalInterval,dialTimezone,dialPrefix,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength",type:"ivr",sort:"-updatedAt",limit:10,page:1},b.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"),"")}),b.arraydialOrderByScheduledAt=_.keyBy([{option:"DESC",value:"'DESC'"},{option:"ASC",value:"'ASC'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.motiondialer.ivrCampaigns.edit",{id:e.id,ivrCampaign:e,crudPermissions:b.crudPermissions})},b.clonedialog=function(e,t){i.show({controller:"IvrCampaigncloneController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:b.ivrCampaigns?b.ivrCampaigns.rows:[],crudPermissions:b.crudPermissions}})},b.listadddialog=function(e,t){i.show({controller:"IvrCampaignlistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/listadd/listadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:b.ivrCampaigns?b.ivrCampaigns.rows:[],crudPermissions:b.crudPermissions}})},b.blacklistadddialog=function(e,t){i.show({controller:"IvrCampaignblacklistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/blacklistadd/blacklistadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:b.ivrCampaigns?b.ivrCampaigns.rows:[],crudPermissions:b.crudPermissions}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.gotorealtimegoto=function(e,t){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:1510}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.motiondialer.realtime.ivr_campaigns",{})}},b.success=y,b.getIvrCampaigns=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.campaign.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="IvrCampaigns",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditIvrCampaign=function(e,t){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:t,ivrCampaigns:b.ivrCampaigns.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteIvrCampaign=S,b.exportSelectedIvrCampaigns=function(){var e=angular.copy(b.selectedIvrCampaigns);return b.selectedIvrCampaigns=[],e},b.deleteSelectedIvrCampaigns=function(e){var t=i.confirm().title("Are you sure want to delete the selected ivrCampaigns?").htmlContent("<b>"+b.selectedIvrCampaigns.length+" selected</b> will be deleted.").ariaLabel("delete IvrCampaigns").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedIvrCampaigns.forEach(function(e){S(e)}),b.selectedIvrCampaigns=[]})},b.deselectIvrCampaigns=function(){b.selectedIvrCampaigns=[]},b.selectAllIvrCampaigns=function(){b.selectedIvrCampaigns=b.ivrCampaigns.rows},g.hasRole("admin")?m.trunk.get({fields:"id,name",sort:"name",table:"true"}).$promise.then(function(e){b.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){b.trunks=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(b.trunks,{id:e.resourceId})});b.trunks.forEach(function(e){_.some(t,["id",e.id])||(e.canSelect=!1),t.push(e)}),b.trunks=t})}else b.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){b.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){b.projects=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:1103}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(b.projects,{id:e.resourceId})}),a=null;a=[],b.ivrCampaigns.rows.forEach(function(e){var t=_.find(b.projects,{id:Number(e.SquareProjectId)});a.push(t)}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(b.projects,{id:e.id});t.canSelect=!1,n.push(t)}}),b.projects=n})}else{var n=[],a=[];b.ivrCampaigns.rows.forEach(function(e){var t=_.find(b.projects,{id:Number(e.SquareProjectId)});a.push(t)});for(var i=0;i<b.projects.length;i++){_.some(a,{id:b.projects[i].id})&&(b.projects[i].canSelect=!1,n.push(b.projects[i]))}b.projects=n}}).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){b.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){b.interval=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(b.interval,{id:e.resourceId})}),n=null;if(b.ivrCampaign&&(n=_.find(b.interval,{id:Number(b.ivrCampaign.IntervalId)})),n&&!_.some(t,["id",n.id])){var a=_.find(b.interval,{id:n.id});a.canSelect=!1,t.push(a)}b.interval=t})}else{var n=[],a=null;b.ivrCampaign&&(a=_.find(b.interval,{id:Number(b.ivrCampaign.IntervalId)}));for(var i=0;i<b.interval.length;i++)a&&b.interval[i].id===a.id&&(b.interval[i].canSelect=!1,n.push(b.interval[i]));b.interval=n}}).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 E=!0,A=1;function y(e){b.ivrCampaigns=e||{count:0,rows:[]}}function S(e){m.campaign.delete({id:e.id}).$promise.then(function(){_.remove(b.ivrCampaigns.rows,{id:e.id}),b.ivrCampaigns.count-=1,b.ivrCampaigns.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcampaign"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getIvrCampaigns())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","ivrCampaigns","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.motiondialer").controller("IvrCampaignsController",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(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},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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.queueCampaigns,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The queueCampaign will be deleted.").ariaLabel("Delete QueueCampaign").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.trunks,{id:e.resourceId})}),n=null;if(g.queueCampaign&&(n=_.find(g.trunks,{id:Number(g.queueCampaign.TrunkId)})),n&&!_.some(t,["id",n.id])){var a=_.find(g.trunks,{id:n.id});a.canSelect=!1,t.push(a)}g.trunks=t})}else{var n=[],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,n.push(g.trunks[i]));g.trunks=n}}).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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.interval,{id:e.resourceId})}),n=null;if(g.queueCampaign&&(n=_.find(g.interval,{id:Number(g.queueCampaign.IntervalId)})),n&&!_.some(t,["id",n.id])){var a=_.find(g.interval,{id:n.id});a.canSelect=!1,t.push(a)}g.interval=t})}else{var n=[],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,n.push(g.interval[i]));g.interval=n}}).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,t,n,i,s,o,r){var c=this;function m(){return l(function(n,t){return l(function(t,n){return d.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],o.hasRole("admin")?e:c.section?c.section.autoAssociation?e:l(function(t,n){return d.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),l(function(t,n){return d.voiceQueue.getAgents({id:c.queueCampaign.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return t.penalty=e.UserVoiceQueue?"penalty "+e.UserVoiceQueue.penalty:"",t.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=o.getCurrentUser(),c.queueCampaign=t,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(n,t){d.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceWith(c.selectedItems,c.startingSelectedItems,function(e,t){return e.id===t.id&&e.penalty===t.penalty});return(n=e,l(function(e,t){_.isEmpty(n)?e():d.voiceQueue.removeAgents({id:c.queueCampaign.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return r=t,l(function(e,t){if(_.isEmpty(r))e();else{for(var n=[],a=_.groupBy(r,"penalty"),i=0;i<Object.keys(a).length;i++){var s=Object.keys(a)[i],o=_.filter(r,["penalty",s]);n.push(d.voiceQueue.addAgents({id:c.queueCampaign.id,ids:_.map(o,"id"),penalty:_.trim(s,"penalty "),realtime:c.realtime||!1}).$promise)}l.all(n).then(function(){e()}).catch(function(e){t(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 n},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,items:[],selectedItems:[],showSelectAndDeselectAll:!i,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"penalty",labelAll:s.instant("MOTIONDIALER.ALL_AGENTS"),labelSelected:s.instant("MOTIONDIALER.SELECTED_AGENTS"),transferCallback:function(e,t){t?e.forEach(function(e){e.penalty=void 0}):e.forEach(function(e){e.penalty="penalty "+c.penalty});var n=_.xorWith(c.startingSelectedItems,c.selectedItems,function(e,t){return e.id===t.id&&e.penalty===t.penalty});c.pendingChanges=!_.isEmpty(n)}}}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,t,n,o,r,l){var d=this;function c(){return a(function(n,t){return a(function(t,n){return s.cmList.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return d.items=e.rows?e.rows:[],r.hasRole("admin")?e:d.section?d.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:d.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return d.allowedItems=_.map(t,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 t=_.find(d.allowedItems,{id:e.id});"admin"===d.currentUser.role?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s[d.apiRoute][d.getApi]({id:d.queueCampaign.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];d.selectedItems=_.map(t,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"),n()}).catch(function(e){t(e)})})}d.currentUser=r.getCurrentUser(),d.queueCampaign=t,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={readOnly:!d.crudPermissions.canEdit,allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!1,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:n.instant("MOTIONDIALER.ALL_LISTS"),labelSelected:n.instant("MOTIONDIALER.SELECTED_LISTS"),transferCallback:function(e,t){var n=_.xorBy(d.startingSelectedItems,d.selectedItems,"id");d.pendingChanges=!_.isEmpty(n)}},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(n,t){s.userProfileSection.get({userProfileId:d.currentUser.userProfileId,name:"Lists"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(d.selectedItems,d.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s[d.apiRoute][d.removeApi]({id:d.queueCampaign.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s[d.apiRoute][d.addApi]({id:d.queueCampaign.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},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(t,n,a,e,i,s,o){var r=this;function l(e){t.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!":""}),n.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 t=0;t<e.data.errors.length;t+=1)a.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.queueCampaign={},c.queueCampaignHopperBlacks={count:0,rows:[]},c.selectedQueueCampaignHopperBlacks=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,ContactId,phone",sort:"-id",limit:10,page:1},c.init=function(e,t){c.queueCampaign=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.queueCampaign.id,c.query.VoiceQueueId=c.queueCampaign.id,c.getQueueCampaignHopperBlacks()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the hopperBlack?").htmlContent("<b>"+(e.name||"hopperBlack")+"</b> will be deleted.").ariaLabel("delete hopperBlack").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getQueueCampaignHopperBlacks=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.voiceQueue.getHopperBlacks(c.query,p).$promise},c.createOrEditQueueCampaignHopperBlack=function(e,t){s.show({controller:"CreateOrEditHopperBlackDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hopperBlacks/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:c.queueCampaign,hopperBlack:t,hopperBlacks:c.queueCampaignHopperBlacks.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedQueueCampaignHopperBlacks=function(){var e=angular.copy(c.selectedQueueCampaignHopperBlacks);return c.selectedQueueCampaignHopperBlacks=[],e},c.deleteQueueCampaignHopperBlack=g,c.deleteSelectedQueueCampaignHopperBlacks=function(e){var t=s.confirm().title("Are you sure want to delete the selected hopperBlacks?").htmlContent("<b>"+c.selectedQueueCampaignHopperBlacks.length+" selected</b> will be deleted.").ariaLabel("delete hopperBlacks").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedQueueCampaignHopperBlacks.forEach(function(e){g(e)}),c.selectedQueueCampaignHopperBlacks=[]})};var m=!0,u=1;function p(e){c.queueCampaignHopperBlacks=e||{count:0,rows:[]}}function g(e){l.hopperBlack.delete({id:e.id}).$promise.then(function(){_.remove(c.queueCampaignHopperBlacks.rows,{id:e.id}),c.queueCampaignHopperBlacks.count-=1,c.queueCampaignHopperBlacks.rows.length||c.getQueueCampaignHopperBlacks(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceQueue"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getQueueCampaignHopperBlacks())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("QueueCampaignHopperBlacksController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.contacts={},c.queueCampaign={},c.queueCampaignHopperFinals={count:0,rows:[]},c.selectedQueueCampaignHopperFinals=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,uniqueid,ContactId,calleridnum,calleridname,statedesc,countcongestionretry,countbusyretry,countnoanswerretry,countglobal,scheduledat,starttime,responsetime,endtime,disposition,ListId,UserId,VoiceQueueId,CampaignId,recallme,deleted,campaign",sort:"-id",limit:10,page:1},c.init=function(e,t){c.queueCampaign=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.queueCampaign.id,c.query.VoiceQueueId=c.queueCampaign.id,c.getQueueCampaignHopperFinals()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the hopperFinal?").htmlContent("<b>"+(e.name||"hopperFinal")+"</b> will be deleted.").ariaLabel("delete hopperFinal").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getQueueCampaignHopperFinals=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.voiceQueue.getHopperFinals(c.query,p).$promise},c.createOrEditQueueCampaignHopperFinal=function(e,t){s.show({controller:"CreateOrEditHopperFinalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hopperFinals/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:c.queueCampaign,hopperFinal:t,hopperFinals:c.queueCampaignHopperFinals.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedQueueCampaignHopperFinals=function(){var e=angular.copy(c.selectedQueueCampaignHopperFinals);return c.selectedQueueCampaignHopperFinals=[],e},c.deleteQueueCampaignHopperFinal=g,c.deleteSelectedQueueCampaignHopperFinals=function(e){var t=s.confirm().title("Are you sure want to delete the selected hopperFinals?").htmlContent("<b>"+c.selectedQueueCampaignHopperFinals.length+" selected</b> will be deleted.").ariaLabel("delete hopperFinals").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedQueueCampaignHopperFinals.forEach(function(e){g(e)}),c.selectedQueueCampaignHopperFinals=[]})},c.moveQueueCampaignHopperFinal=v,c.moveContactsQueueCampaignHopperFinal=function(e){l.cmHopperFinal.moveContactsQueueCampaignHopperFinal({id:c.query.id,state:e}).$promise.then(function(e){_.isNil(e)&&_.isNil(e[0])?r.info({title:"Restored Contacts",msg:"0"}):r.info({title:"Restored Contacts",msg:JSON.stringify(e[0].affectedRows)})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},c.countContactsQueueCampaignHopperFinal=function(e){l.cmHopperFinal.countContactsQueueCampaignHopperFinal({id:e}).$promise.then(function(e){_.merge(c.contacts,e[0])}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},c.moveConfirm=function(e,t){var n=s.confirm().title("Are you sure want to restore the contact?").htmlContent("<b>Contact</b> will be restored.").ariaLabel("Restore Contact").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){v(e)},function(){console.log("CANCEL")})},c.moveSelectedQueueCampaignHopperFinals=function(e){var t=s.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");s.show(t).then(function(){c.selectedQueueCampaignHopperFinals.forEach(function(e){v(e)}),c.selectedQueueCampaignHopperFinals=[]})};var m=!0,u=1;function p(e){c.queueCampaignHopperFinals=e||{count:0,rows:[]}}function g(e){l.hopperFinal.delete({id:e.id}).$promise.then(function(){_.remove(c.queueCampaignHopperFinals.rows,{id:e.id}),c.queueCampaignHopperFinals.count-=1,c.queueCampaignHopperFinals.rows.length||c.getQueueCampaignHopperFinals(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceQueue"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.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){l.cmHopperFinal.checkContactHopper(a).$promise.then(function(e){r.info({title:"The contact is in the hopper",msg:"Contact ID "+e.ContactId})}).catch(function(e){var t,n;"Not Found"===e.data?l.cmHopper.save((t=a,n={},n.phone=t.calleridnum,n.scheduledat=moment().format("YYYY-MM-DD HH:mm:ss"),n.countbusyretry=0,n.countcongestionretry=0,n.countnoanswerretry=0,n.countglobal=0,n.ContactId=t.ContactId,n.ListId=t.ListId,n.UserId=t.deleted?null:t.UserId,n.VoiceQueueId=t.VoiceQueueId,n.CampaignId=t.CampaignId,n.priority=t.recallme?3:2,n.recallme=!!t.recallme,n)).$promise.then(function(e){var t,n;r.info({title:"Restored Contact",msg:"Contact ID "+e.ContactId}),e.ContactId&&l.cmHopperHistory.save(((n={}).calleridnum=(t=a).calleridnum,n.calleridname=t.calleridname,n.scheduledat=moment().format("YYYY-MM-DD HH:mm:ss"),n.countbusyretry=t.countbusyretry,n.countcongestionretry=t.countcongestionretry,n.countnoanswerretry=t.countnoanswerretry,n.countglobal=t.countglobal,n.ContactId=t.ContactId,n.ListId=t.ListId,n.UserId=d.getCurrentUser().id,n.VoiceQueueId=t.VoiceQueueId,n.CampaignId=t.CampaignId,n.editedat=moment().format("YYYY-MM-DD HH:mm:ss"),n.edited=!0,n.state=25,n.statedesc="Restored",n.campaign=t.campaign,n.campaigntype=t.VoiceQueueId?"queue":"ivr",n))}).catch(function(e){_.isNil(e.data)||"Validation error"!==e.data.message?r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()}):r.info({title:"The contact is in the hopper",msg:"Contact ID "+a.ContactId})}):r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getQueueCampaignHopperFinals())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("QueueCampaignHopperFinalsController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.queueCampaign={},c.queueCampaignHopperHistories={count:0,rows:[]},c.selectedQueueCampaignHopperHistories=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,uniqueid,ContactId,calleridnum,calleridname,statedesc,scheduledat,starttime,responsetime,endtime",sort:"-id",limit:10,page:1},c.init=function(e,t){c.queueCampaign=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.queueCampaign.id,c.query.VoiceQueueId=c.queueCampaign.id,c.getQueueCampaignHopperHistories()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the hopperHistory?").htmlContent("<b>"+(e.name||"hopperHistory")+"</b> will be deleted.").ariaLabel("delete hopperHistory").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getQueueCampaignHopperHistories=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.voiceQueue.getHopperHistories(c.query,p).$promise},c.createOrEditQueueCampaignHopperHistory=function(e,t){s.show({controller:"CreateOrEditHopperHistoryDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hopperHistories/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:c.queueCampaign,hopperHistory:t,hopperHistories:c.queueCampaignHopperHistories.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedQueueCampaignHopperHistories=function(){var e=angular.copy(c.selectedQueueCampaignHopperHistories);return c.selectedQueueCampaignHopperHistories=[],e},c.deleteQueueCampaignHopperHistory=g,c.deleteSelectedQueueCampaignHopperHistories=function(e){var t=s.confirm().title("Are you sure want to delete the selected hopperHistories?").htmlContent("<b>"+c.selectedQueueCampaignHopperHistories.length+" selected</b> will be deleted.").ariaLabel("delete hopperHistories").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedQueueCampaignHopperHistories.forEach(function(e){g(e)}),c.selectedQueueCampaignHopperHistories=[]})};var m=!0,u=1;function p(e){c.queueCampaignHopperHistories=e||{count:0,rows:[]}}function g(e){l.hopperHistory.delete({id:e.id}).$promise.then(function(){_.remove(c.queueCampaignHopperHistories.rows,{id:e.id}),c.queueCampaignHopperHistories.count-=1,c.queueCampaignHopperHistories.rows.length||c.getQueueCampaignHopperHistories(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceQueue"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getQueueCampaignHopperHistories())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("QueueCampaignHopperHistoriesController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.queueCampaign={},c.queueCampaignHoppers={count:0,rows:[]},c.selectedQueueCampaignHoppers=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,ContactId,phone,countcongestionretry,countbusyretry,countnoanswerretry,scheduledat,priority,recallme,UserId",sort:"-updatedAt",limit:10,page:1},c.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"),"")}),c.init=function(e,t){c.queueCampaign=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.queueCampaign.id,c.query.VoiceQueueId=c.queueCampaign.id,c.getQueueCampaignHoppers()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the hopper?").htmlContent("<b>"+(e.name||"hopper")+"</b> will be deleted.").ariaLabel("delete hopper").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getQueueCampaignHoppers=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.voiceQueue.getHoppers(c.query,p).$promise},c.createOrEditQueueCampaignHopper=function(e,t){s.show({controller:"CreateOrEditHopperVoiceQueueIdDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hoppers/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:c.queueCampaign,hopper:t,hoppers:c.queueCampaignHoppers.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedQueueCampaignHoppers=function(){var e=angular.copy(c.selectedQueueCampaignHoppers);return c.selectedQueueCampaignHoppers=[],e},c.deleteQueueCampaignHopper=g,c.deleteSelectedQueueCampaignHoppers=function(e){var t=s.confirm().title("Are you sure want to delete the selected hoppers?").htmlContent("<b>"+c.selectedQueueCampaignHoppers.length+" selected</b> will be deleted.").ariaLabel("delete hoppers").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedQueueCampaignHoppers.forEach(function(e){g(e)}),c.selectedQueueCampaignHoppers=[]})},d.hasRole("admin")?l.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){c.agents=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){c.agents=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(c.agents,{id:e.resourceId})}),n=null;if(c.queueCampaign&&(n=_.find(c.agents,{id:Number(c.queueCampaign.UserId)})),n&&!_.some(t,["id",n.id])){var a=_.find(c.agents,{id:n.id});a.canSelect=!1,t.push(a)}c.agents=t})}else{var n=[],a=null;c.queueCampaign&&(a=_.find(c.agents,{id:Number(c.queueCampaign.UserId)}));for(var i=0;i<c.agents.length;i++)a&&c.agents[i].id===a.id&&(c.agents[i].canSelect=!1,n.push(c.agents[i]));c.agents=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})});var m=!0,u=1;function p(e){c.queueCampaignHoppers=e||{count:0,rows:[]}}function g(e){l.cmHopper.delete({id:e.id}).$promise.then(function(){_.remove(c.queueCampaignHoppers.rows,{id:e.id}),c.queueCampaignHoppers.count-=1,c.queueCampaignHoppers.rows.length||c.getQueueCampaignHoppers(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceQueue"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getQueueCampaignHoppers())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("QueueCampaignHoppersController",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(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),t.params.id&&(g.hopper.VoiceQueueId=t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 n,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){n=_.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:n,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 t=_.find(g.hoppers,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The hopper will be deleted.").ariaLabel("Delete Hopper").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.agents,{id:e.resourceId})}),n=null;if(g.hopper&&(n=_.find(g.agents,{id:Number(g.hopper.UserId)})),n&&!_.some(t,["id",n.id])){var a=_.find(g.agents,{id:n.id});a.canSelect=!1,t.push(a)}g.agents=t})}else{var n=[],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,n.push(g.agents[i]));g.agents=n}}).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(n,a){var i=this;i.queueCampaign={},i.init=function(t){i.queueCampaign=t,n.cmHopper.get({limit:0,VoiceQueueId:t.id}).$promise.then(function(e){return i.total=e.count||0,n.cmHopper.get({limit:0,VoiceQueueId:t.id,active:!1,countbusyretry:0,countcongestionretry:0,countnoanswerretry:0}).$promise}).then(function(e){return i.fresh=e.count||0,n.cmHopperFinal.get({limit:0,VoiceQueueId:t.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,t,n,o,r,l){var d=this;function c(){return a(function(n,t){return a(function(t,n){return s.cmList.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return d.items=e.rows?e.rows:[],r.hasRole("admin")?e:d.section?d.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:d.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return d.allowedItems=_.map(t,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 t=_.find(d.allowedItems,{id:e.id});"admin"===d.currentUser.role?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s[d.apiRoute][d.getApi]({id:d.queueCampaign.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];d.selectedItems=_.map(t,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"),n()}).catch(function(e){t(e)})})}d.currentUser=r.getCurrentUser(),d.queueCampaign=t,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={readOnly:!d.crudPermissions.canEdit,allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!1,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:n.instant("MOTIONDIALER.ALL_LISTS"),labelSelected:n.instant("MOTIONDIALER.SELECTED_LISTS"),transferCallback:function(e,t){var n=_.xorBy(d.startingSelectedItems,d.selectedItems,"id");d.pendingChanges=!_.isEmpty(n)}},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(n,t){s.userProfileSection.get({userProfileId:d.currentUser.userProfileId,name:"Lists"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(d.selectedItems,d.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s[d.apiRoute][d.removeApi]({id:d.queueCampaign.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s[d.apiRoute][d.addApi]({id:d.queueCampaign.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},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,t,a,i,s,n,o,r){var l=this;function d(){t.hide()}function c(e,t){var n=t.id;o.enqueue(function(){return i.voiceQueue.removeLists({id:e,ids:n}).$promise.then(function(){return i.voiceQueue.addLists({id:e,ids:n,dialCheckDuplicateType:"never"}).$promise}).then(function(){a.success({title:"Reset Succesfull",msg:"List "+t.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=n||[],l.loading=!1,l.closeDialog=d,l.exists=function(e,t){return-1<t.indexOf(e)},l.toggle=function(e,t){var n=t.indexOf(e);-1<n?t.splice(n,1):t.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,t){for(var n=0;n<l.selected.length;n+=1)c(s.id,l.selected[n]);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,l,a,d,t,n,i,s){var c=this;function o(){return l(function(n,t){return l(function(t,n){return d.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],i.hasRole("admin")?e:c.section?c.section.autoAssociation?e:l(function(t,n){return d.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,function(e){return _.find(c.items,{id:i.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.items.forEach(function(e){var t=_.find(c.allowedItems,{id:e.id});i.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),l(function(t,n){return d.voiceQueue.getTeams({id:c.queueCampaign.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){return _.find(c.items,{id:e.id})}),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=i.getCurrentUser(),c.queueCampaign=t,c.crudPermissions=s,c.penalty=0,c.items=[],c.allowedItems=[],c.selectedItems=[],c.addedItems=[],c.removedItems=[],c.pendingChanges=!1,c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!0,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:n.instant("MOTIONDIALER.ALL_TEAMS"),labelSelected:n.instant("MOTIONDIALER.SELECTED_TEAMS"),transferCallback:function(e,t){t?c.removedItems=_.unionBy(e,c.removedItems,"id"):(e.forEach(function(e){e.penalty="penalty "+c.penalty}),c.addedItems=_.unionBy(e,c.addedItems,"id")),c.pendingChanges=!0}},c.onInit=function(){return i.hasRole("admin")?o().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(function(n,t){d.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(e)})}).then(function(e){return c.section=e,o()}).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()})})},c.saveTeams=function(){var e=c.removedItems,t=c.addedItems;return(n=e,l(function(e,t){_.isEmpty(n)?e():d.voiceQueue.removeTeams({id:c.queueCampaign.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return r=t,l(function(e,t){if(_.isEmpty(r))e();else{for(var n=[],a=_.groupBy(r,"penalty"),i=0;i<Object.keys(a).length;i++){var s=Object.keys(a)[i],o=_.filter(r,["penalty",s]);n.push(d.voiceQueue.addTeams({id:c.queueCampaign.id,ids:_.map(o,"id"),penalty:_.trim(s,"penalty ")}).$promise)}l.all(n).then(function(){e()}).catch(function(e){t(e)})}});var r}).then(function(){c.pendingChanges=!1,c.addedItems=[],c.removedItems=[],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 n},c.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(n,e,i,s,a,t,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=t,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.queueCampaign=c||n.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=n.params.tab||0,u.clonedialog=function(e,t){i.show({controller:"QueueCampaigncloneController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:u.queueCampaigns?u.queueCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.listadddialog=function(e,t){i.show({controller:"QueueCampaignlistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/listadd/listadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:u.queueCampaigns?u.queueCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.blacklistadddialog=function(e,t){i.show({controller:"QueueCampaignblacklistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/blacklistadd/blacklistadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:u.queueCampaigns?u.queueCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.teamadddialog=function(e,t){i.show({controller:"QueueCampaignteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:u.queueCampaigns?u.queueCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,t){i.show({controller:"QueueCampaignagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:u.queueCampaigns?u.queueCampaigns.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.resetlistdialog=function(t,n){r.voiceQueue.getLists({id:t.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(n).ok("OK").cancel("CANCEL");i.show(e).then(function(){var e,t,n;e=u.queueCampaign.id,t=a.rows[0],n=t.id,r.voiceQueue.removeLists({id:e,ids:n}).$promise.then(function(){return r.voiceQueue.addLists({id:e,ids:n,dialCheckDuplicateType:"never"}).$promise}).then(function(){l.success({title:"Reset Succesfull",msg:"List "+t.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:n,clickOutsideToClose:!1,locals:{queueCampaign:t,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,t){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:1510}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.motiondialer.realtime.queues",{})}},u.alert=l.info,u.gotoQueueCampaigns=function(){n.go("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 t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.musiconholds,{id:e.resourceId})}),n=null;if(u.queueCampaign&&(n=_.find(u.musiconholds,{name:u.queueCampaign.musiconhold})),n&&!_.some(t,["id",n.id])){var a=_.find(u.musiconholds,{id:n.id});a.canSelect=!1,t.push(a)}u.musiconholds=t}):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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.trunks,{id:e.resourceId})}),n=null;if(u.queueCampaign&&(n=_.find(u.trunks,{id:Number(u.queueCampaign.TrunkId)})),n&&!_.some(t,["id",n.id])){var a=_.find(u.trunks,{id:n.id});a.canSelect=!1,t.push(a)}u.trunks=t})}else{var n=[],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,n.push(u.trunks[i]));u.trunks=n}}).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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.projects,{id:e.resourceId})}),n=null;if(u.queueCampaign&&(n=_.find(u.projects,{name:u.queueCampaign.dialQueueProject})),n&&!_.some(t,["id",n.id])){var a=_.find(u.projects,{id:n.id});a.canSelect=!1,t.push(a)}u.projects=t})}else{var n=[],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,n.push(u.projects[i]));u.projects=n}}).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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.interval,{id:e.resourceId})}),n=null;if(u.queueCampaign&&(n=_.find(u.interval,{id:Number(u.queueCampaign.IntervalId)})),n&&!_.some(t,["id",n.id])){var a=_.find(u.interval,{id:n.id});a.canSelect=!1,t.push(a)}u.interval=t})}else{var n=[],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,n.push(u.interval[i]));u.interval=n}}).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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.pauses,{id:e.resourceId})});u.pauses.forEach(function(e){_.some(t,["id",e.id])||(e.canSelect=!1),t.push(e)}),u.pauses=t})}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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.queueCampaigns=l||{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="queueCampaigns",b.listOrder="",b.listOrderAsc=null,b.selectedQueueCampaigns=[],b.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,description,mandatoryDisposition,mandatoryDispositionPauseId",type:"outbound",sort:"-updatedAt",channel:"voice",limit:10,page:1},b.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"),"")}),b.arrayautopause=_.keyBy([{option:"Yes",value:"'all'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arrayringinuse=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arraytimeoutrestart=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.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"),"")}),b.arraysetinterfacevar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arraysetqueuevar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arraysetqueueentryvar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arraydialOrderByScheduledAt=_.keyBy([{option:"DESC",value:"'DESC'"},{option:"ASC",value:"'ASC'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.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"),"")}),b.arraydialPredictiveOptimization=_.keyBy([{option:"AgentBusyFactor",value:"'agentBusyFactor'"},{option:"DropRate",value:"'dropRate'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.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"),"")}),b.editstate=function(e,t){n.go("app.motiondialer.queueCampaigns.edit",{id:e.id,queueCampaign:e,crudPermissions:b.crudPermissions})},b.clonedialog=function(e,t){i.show({controller:"QueueCampaigncloneController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:b.queueCampaigns?b.queueCampaigns.rows:[],crudPermissions:b.crudPermissions}})},b.listadddialog=function(e,t){i.show({controller:"QueueCampaignlistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/listadd/listadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:b.queueCampaigns?b.queueCampaigns.rows:[],crudPermissions:b.crudPermissions}})},b.blacklistadddialog=function(e,t){i.show({controller:"QueueCampaignblacklistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/blacklistadd/blacklistadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:b.queueCampaigns?b.queueCampaigns.rows:[],crudPermissions:b.crudPermissions}})},b.teamadddialog=function(e,t){i.show({controller:"QueueCampaignteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:b.queueCampaigns?b.queueCampaigns.rows:[],crudPermissions:b.crudPermissions}})},b.agentadddialog=function(e,t){i.show({controller:"QueueCampaignagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:b.queueCampaigns?b.queueCampaigns.rows:[],crudPermissions:b.crudPermissions,realtime:!1}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.gotorealtimegoto=function(e,t){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:1510}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.motiondialer.realtime.queues",{})}},b.success=y,b.getQueueCampaigns=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.voiceQueue.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="QueueCampaigns",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditQueueCampaign=function(e,t){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:t,queueCampaigns:b.queueCampaigns.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteQueueCampaign=S,b.exportSelectedQueueCampaigns=function(){var e=angular.copy(b.selectedQueueCampaigns);return b.selectedQueueCampaigns=[],e},b.deleteSelectedQueueCampaigns=function(e){var t=i.confirm().title("Are you sure want to delete the selected queueCampaigns?").htmlContent("<b>"+b.selectedQueueCampaigns.length+" selected</b> will be deleted.").ariaLabel("delete QueueCampaigns").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedQueueCampaigns.forEach(function(e){S(e)}),b.selectedQueueCampaigns=[]})},b.deselectQueueCampaigns=function(){b.selectedQueueCampaigns=[]},b.selectAllQueueCampaigns=function(){b.selectedQueueCampaigns=b.queueCampaigns.rows},g.hasRole("admin")?m.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){b.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){b.trunks=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(b.trunks,{id:e.resourceId})}),a=null;a=[],b.queueCampaigns.rows.forEach(function(e){var t=_.find(b.trunks,{id:Number(e.TrunkId)});a.push(t)}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(b.trunks,{id:e.id});t.canSelect=!1,n.push(t)}}),b.trunks=n})}else{var n=[],a=[];b.queueCampaigns.rows.forEach(function(e){var t=_.find(b.trunks,{id:Number(e.TrunkId)});a.push(t)});for(var i=0;i<b.trunks.length;i++){_.some(a,{id:b.trunks[i].id})&&(b.trunks[i].canSelect=!1,n.push(b.trunks[i]))}b.trunks=n}}).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){b.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){b.interval=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(b.interval,{id:e.resourceId})}),n=null;if(b.queueCampaign&&(n=_.find(b.interval,{id:Number(b.queueCampaign.IntervalId)})),n&&!_.some(t,["id",n.id])){var a=_.find(b.interval,{id:n.id});a.canSelect=!1,t.push(a)}b.interval=t})}else{var n=[],a=null;b.queueCampaign&&(a=_.find(b.interval,{id:Number(b.queueCampaign.IntervalId)}));for(var i=0;i<b.interval.length;i++)a&&b.interval[i].id===a.id&&(b.interval[i].canSelect=!1,n.push(b.interval[i]));b.interval=n}}).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 E=!0,A=1;function y(e){b.queueCampaigns=e||{count:0,rows:[]}}function S(e){m.voiceQueue.delete({id:e.id}).$promise.then(function(){_.remove(b.queueCampaigns.rows,{id:e.id}),b.queueCampaigns.count-=1,b.queueCampaigns.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceQueue"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getQueueCampaigns())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","queueCampaigns","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.motiondialer").controller("QueueCampaignsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g){var v=this,h=!0;function f(){var e=i.localStorage.getItem("motion2.realtime.abandoned.bull.contacts:"+v.currentUser.id);e&&(e=JSON.parse(e))&&e.query&&(v.query=_.merge(e.query,_.omit(v.query,["sort","limit","page"])),v.query=_.omit(v.query,"filter")),d.hasRole("admin")?o.user.getQueues({id:d.getCurrentUser().id,fields:"id,name",channel:"voice",type:"outbound",nolimit:!0}).$promise.then(function(e){v.queues=e||{count:0,rows:[]},v.queuesMap=_.mapValues(_.keyBy(v.queues.rows,"name"),"name")}).catch(function(e){console.error(e)}).finally(function(){v.getContacts()}):o.userProfile.getResources({id:v.currentUser.userProfileId,section:"QueueCampaigns",channel:"voice",type:"outbound",sort:"-updatedAt",nolimit:!0}).$promise.then(function(e){v.queues=e||{count:0,rows:[]},v.queuesMap=_.mapValues(_.keyBy(v.queues.rows,"name"),"name")}).catch(function(e){console.error(e)}).finally(function(){v.getContacts()})}function b(e){v.contacts=e||{count:0,rows:[]},h=!1,v.refresh=!0}v.showTooltip=!1,v.refresh=!0,v.disable=[],v.agents=p||[],v.currentUser=d.getCurrentUser(),v.localizationMap=u,v.pickerModel={dateStart:null,dateEnd:null},v.queues={},v.contacts={count:0,rows:[]},v.dispositions=g,v.userProfile=r,v.userProfileSection=l&&1==l.count?l.rows[0]:null,v.crudPermissions=d.parseCrudPermissions(v.userProfileSection?v.userProfileSection.crudPermissions:null),v.query={fields:"id,type,calleridnum,calleridname,queue,queuecallerabandonAt,queuecallerexitAt,queuecallerexitreason,assigned,lastAssignedTo,updatedAt,disposition",type:"outbound",queuecallerexitreason:"TIMEOUT,ABANDONED",sort:"-updatedAt",limit:10,page:1},v.clearAll=function(){v.query.createdAt=void 0,v.pickerModel={dateStart:null,dateEnd:null},v.getContacts()},v.getContacts=function(){if(v.refresh=!1,v.pickerModel.dateStart&&!h){var e=moment(v.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format();v.query.createdAt={$gte:v.pickerModel.dateStart,$lte:e}}else v.query.createdAt=void 0;v.query.queue=v.query.queue,v.query.offset=(v.query.page-1)*v.query.limit,i.localStorage.setItem("motion2.realtime.abandoned.bull.contacts:"+v.currentUser.id,JSON.stringify({query:_.omit(v.query,"queue")})),v.promise=o.voiceQueueReport.getVoiceQueuesReport(v.query,b).$promise},v.refreshContacts=function(){v.showTooltip=!1,v.getContacts()},v.onInit=f,v.assignedA=function(e,t){e&&(v.disable[e.id]=!0,o.voiceQueueReport.update({id:e.id,lastAssignedTo:t?t.name:null,assigned:!!t}).$promise.catch(function(e){console.log(e)}).finally(function(){v.disable[e.id]=!1}))},v.disposed=function(e,t){e&&o.voiceQueueReport.update({id:e.id,disposition:t||null}).$promise.catch(function(e){console.log(e)})},v.onSavevoiceQueueReport=function(e){e&&v.queuesMap&&"outbound"===e.type&&v.queuesMap[e.queue]&&(v.showTooltip=!0)},v.onUpdatevoiceQueueReport=function(e){if(e){var t=_.findIndex(v.contacts.rows,["id",e.id]);0<=t&&_.merge(v.contacts.rows[t],e)}},c.onWithoutApply("voiceQueueReport:save",v.onSavevoiceQueueReport),c.on("voiceQueueReport:update",v.onUpdatevoiceQueueReport),f();var E=!0,A=1;e.$watch("vm.query.filter",function(e,t){E?n(function(){E=!1}):(t||(A=v.query.page),e!==t&&(v.query.page=1),e||(v.query.page=A),v.getContacts())}),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","dateFilterLocalizationFactory","agents","dispositions"],angular.module("app.motiondialer").controller("AbandonedCallsMotionDialerRealtimeController",e)}(),function(){"use strict";function e(e,o,t,n,a,i,s,r,l,d,c,m,u,p,g,v,h,f){var b=this,E=["userpic","online","lastLoginAt","lastPauseAt","pauseType","lastPauseAt","internal","address","chatPause","openchannelPause","mailPause","smsPause","faxPause","voicePause","chatCapacity","openchannelCapacity","mailCapacity","smsCapacity","faxCapacity","chatCurrentCapacity","openchannelCurrentCapacity","mailCurrentCapacity","smsCurrentCapacity","faxCurrentCapacity","chatStatus","openchannelStatus","mailStatus","smsStatus","faxStatus","voiceStatus","chatStatusTime","openchannelStatusTime","mailStatusTime","smsStatusTime","faxStatusTime","voiceStatusTime","queue","destconnectedlinenum","onhold"],A=["chatPause","openchannelPause","mailPause","smsPause","faxPause","voicePause","online"];for(var y in b.currentUser=v.getCurrentUser(),b.availableStates=["ringing","inuse","busy","onhold","not_inuse"],b.pauses=s||{count:0,rows:[]},b.license=h,b.userProfile=p,b.userProfileSection=g&&1==g.count?g.rows[0]:null,b.crudPermissions=v.parseCrudPermissions(b.userProfileSection?b.userProfileSection.crudPermissions:null),b.agents=r?_.keyBy(r.rows?r.rows:[],"id"):{},b.rpcAgents=l?_.keyBy(l.rows?l.rows:[],"id"):{},b.paginatedAgents={},b.load=!1,b.order=[],b.agentInternal={},b.agents)b.agents.hasOwnProperty(y)&&(b.agents[y].init=!0);b.query={limit:10,page:1,order:"fullname",globalStatusFilter:"",pauseTypeFilter:""},b.logout=function(e,t){return d.user.logout({id:e.id,device:"realtime",agent_id:e.id,agent_name:e.name}).$promise.then(function(){m.success({title:"Agent logout",msg:e.fullname+"  properly logout"}),b.agents[e.id]&&(b.agents[e.id].online=!1),b.rpcAgents[e.id]&&(b.rpcAgents[e.id].online=!1),T()}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.queueAdd=function(e,t){n.show({controller:"AgentqueueaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/queueadd/queueadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{agent:e,agents:[],channel:"voice",direction:"outbound",crudPermissions:b.crudPermissions}})},b.pause=function(t,e){return d.user.pause({id:t.id,type:e}).$promise.then(function(e){b.agents[t.id]&&_.merge(b.agents[t.id],_.pick(e,E)),b.rpcAgents[t.id]&&_.merge(b.rpcAgents[t.id],_.pick(e,E)),O(b.agents[t.id])}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.unPause=function(t){return d.user.unpause({id:t.id}).$promise.then(function(e){b.agents[t.id]&&_.merge(b.agents[t.id],_.pick(e,E)),b.rpcAgents[t.id]&&_.merge(b.rpcAgents[t.id],_.pick(e,E)),O(b.agents[t.id])}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.showInfo=function(e){n.show(n.alert().clickOutsideToClose(!0).title("Legend").htmlContent("<div>TODO legend status + state</div>").ok("Ok").targetEvent(e))},b.getAgentStatus=w,b.getAgentGlobalStatus=O,b.isPause=I,b.checkPause=function(e){return"pause"===e},b.isPartialPause=function(e){return"*pause"===e},b.onSave=function(e){b.agents[e.id]&&(_.merge(b.agents[e.id],_.pick(_.omit(e,A),E)),_.merge(b.rpcAgents[e.id],_.pick(_.omit(e,A),E)),O(b.agents[e.id]))},b.onUpdate=function(e){b.agents[e.id]&&(_.merge(b.agents[e.id],_.pick(e,E)),_.merge(b.rpcAgents[e.id],_.pick(e,E)),e.lastPauseAt&&(b.agents[e.id].globalStatusTime=e.lastPauseAt,b.rpcAgents[e.id].globalStatusTime=e.lastPauseAt),O(b.agents[e.id]))},b.onInit=T,b.onConnect=function(e){b.agents[b.agentInternal[e.destaccountcode]]&&(_.merge(b.agents[b.agentInternal[e.destaccountcode]],_.pick(e,["queue","destconnectedlinenum"])),_.merge(b.rpcAgents[b.agentInternal[e.destaccountcode]],_.pick(e,["queue","destconnectedlinenum"])))},b.onComplete=function(e){b.agents[b.agentInternal[e.destaccountcode]]&&(b.agents[b.agentInternal[e.destaccountcode]]=_.omit(b.agents[b.agentInternal[e.destaccountcode]],["queue","destconnectedlinenum"]),b.rpcAgents[b.agentInternal[e.destaccountcode]]=_.omit(b.rpcAgents[b.agentInternal[e.destaccountcode]],["queue","destconnectedlinenum"]))},c.on("user:save",b.onSave),c.on("user:update",b.onUpdate),c.on("user:agentconnect",b.onConnect),c.on("user:agentcomplete",b.onComplete),T();var S=f(function(){b.load&&(b.load=!1,T())},999);function T(e){b.load=!1;var t,n,a=o.defer();b.promise=a.promise,b.filteredAgents=[],b.order=[],_.forIn(b.agents,function(e,t){b.rpcAgents[t]&&_.merge(e,_.pick(_.omit(b.rpcAgents[t],A),E)),O(e),e.online?(b.filteredAgents.push(e),b.agentInternal[e.internal]=t):e.globalStatusTime=_.toNumber(moment().format("x"))}),b.query.globalStatusFilter&&_.remove(b.filteredAgents,function(e){return e.globalStatus!==b.query.globalStatusFilter}),b.query.pauseTypeFilter&&_.remove(b.filteredAgents,function(e){return e.pauseType!==b.query.pauseTypeFilter}),b.query.filter&&_.remove(b.filteredAgents,function(e){return e.fullname.toLowerCase().indexOf(b.query.filter.toLowerCase())<0}),b.filteredAgents=(t=b.filteredAgents,n=_.startsWith(b.query.order,"-")?"desc":"asc",_.orderBy(t,[b.query.order.replace("-","")],[n]));var i=(b.query.page-1)*b.query.limit;b.paginatedAgents=_.drop(b.filteredAgents,i).slice(0,b.query.limit);for(var s=0;s<b.paginatedAgents.length;s+=1)b.order.push(b.paginatedAgents[s].id);a.resolve(),b.load=!0}function I(e){return"pause"===e||"*pause"===e}function C(e){return"idle"===e||"unknown"===e||"unavailable"===e||"ringing"===e||_.isNil(e)}function w(e,t){return"voice"===t?"idle"!==e[t+"Status"]?e[t+"Status"]:e[t+"Pause"]?e[t+"Status"]="pause":"idle":e[t+"Pause"]?e[t+"Status"]="pause":e[t+"Status"]}function O(e){var t="unknown";t=_.every([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],I)?"pause":_.some([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],I)?"*pause":_.every([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],C)?"idle":"busy",e.globalStatus!==t&&(e.globalStatus=t,e.init?(e.init=!1,e.globalStatusTime=I(t)?_.toNumber(moment(e.lastPauseAt).format("x")):_.max([e.voiceStatusTime,e.chatStatusTime,e.mailStatusTime,e.smsStatusTime,e.openchannelStatusTime,e.faxStatusTime])):e.globalStatusTime=_.toNumber(moment().format("x")))}e.$on("$destroy",function(){c.removeAllListeners("user:save"),c.removeAllListeners("user:update"),c.removeAllListeners("user:agentconnect"),c.removeAllListeners("user:agentcomplete"),S&&(f.cancel(S),S=null)})}e.$inject=["$scope","$q","$timeout","$mdDialog","$document","$filter","pauses","agents","rpcAgents","api","socket","toasty","helperClasses","userProfile","userProfileSection","Auth","license","$interval"],angular.module("app.voice").controller("AgentsMotionDialerRealtimeController",e)}(),function(){"use strict";function e(e,n,a,i,t,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(){_.forIn(u.campaigns,function(e,t){u.rpcCampaigns[t]&&_.merge(e,_.pick(u.rpcCampaigns[t],p))})}u.currentUser=m.getCurrentUser(),u.count=o.count,u.campaigns=o?_.keyBy(o.rows?o.rows:[],"id"):{},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:"-updatedAt",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){u.campaigns[e.id]&&(_.merge(u.campaigns[e.id],_.pick(e,p)),_.merge(u.rpcCampaigns[e.id],_.pick(e,p)))},u.$onInit=g,u.createOrEditIvrCampaign=function(e,t){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:t,ivrCampaigns:_.values(u.campaigns),license:null,setting:null,crudPermissions:u.crudPermissions}})},l.onWithoutApply("campaign:save",u.onSave),u.interval=t(function(){},999);var v=!0,h=1;function f(e){u.count=e.count,u.campaigns=e?_.keyBy(e.rows?e.rows:[],"id"):{},g()}e.$watch("vm.query.filter",function(e,t){v?n(function(){v=!1}):(t||(h=u.query.page),e!==t&&(u.query.page=1),e||(u.query.page=h),u.getCampaigns())}),e.$on("$destroy",function(){l.removeAllListeners("campaign:save"),u.interval&&t.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,a,n,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=u.getCurrentUser(),p.agents=n||{count:0,rows:[]},p.queues=i?_.keyBy(i.rows?i.rows:[],"name"):{},p.rpcVoiceQueuesChannelsTmp=s?_.keyBy(s.rows?_.filter(s.rows,{type:"outbound"}):[],"uniqueid"):{},p.rpcVoiceQueuesChannels={},p.userProfile=c,p.userProfileSection=m&&1==m.count?m.rows[0]:null,p.crudPermissions=u.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.queryChannels={limit:10,page:1},p.getSize=function(e){return _.size(e)},p.$onInit=function(){_.forIn(p.rpcVoiceQueuesChannelsTmp,function(e,t){_.find(p.queues,{name:e.name})&&(p.rpcVoiceQueuesChannels[t]=e)})},p.onSave=function(e){"outbound"===e.type&&_.find(p.queues,{name:e.name})&&(p.rpcVoiceQueuesChannels[e.uniqueid]=e)},p.onRemove=function(e){p.rpcVoiceQueuesChannels[e.uniqueid]&&delete p.rpcVoiceQueuesChannels[e.uniqueid]},p.hangup=function(t){return o.rpc.getVoiceQueuesChannelHangup({uniqueid:t}).$promise.then(function(e){d.success({title:"Channel "+t+" properly hangup!",msg:e.message||""})}).catch(function(e){d.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},p.redirectToAgent=function(t,e,n){return o.rpc.getVoiceQueuesChannelRedirect({uniqueid:t,exten:e,context:n}).$promise.then(function(e){d.success({title:"Channel "+t+" properly redirect!",msg:e.message||""})}).catch(function(e){d.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},p.redirectToNumber=function(e,t){var n=a.prompt().title("Which number do you want transfer the call to?").placeholder("Number").targetEvent(e).ok("Ok").cancel("Cancel");return a.show(n).then(function(e){return o.rpc.getVoiceQueuesChannelRedirect({uniqueid:t,exten:e}).$promise}).then(function(e){d.success({title:"Channel "+t+" properly redirect!",msg:e.message||""})}).catch(function(e){d.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},r.on("voice_queue_channel:save",p.onSave),r.on("voice_queue_channel:remove",p.onRemove),e.$on("$destroy",function(){r.removeAllListeners("voice_queue_channel:save"),r.removeAllListeners("voice_queue_channel:remove")})}e.$inject=["$scope","$timeout","$mdDialog","agents","queues","rpcVoiceQueuesChannels","api","socket","helperClasses","toasty","userProfile","userProfileSection","Auth"],angular.module("app.motiondialer").controller("QueueCallsMotionDialerRealtimeController",e)}(),function(){"use strict";function e(e,n,t,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(){_.forIn(c.queues,function(e,t){c.rpcQueues[t]&&_.merge(e,_.pick(c.rpcQueues[t],m))})}c.count=a.count,c.queues=a?_.keyBy(a.rows?a.rows:[],"id"):{},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:"-updatedAt",limit:10,page:1}:c.query={id:d.getCurrentUser().id,channel:"voice",type:"outbound",fields:"id,name",sort:"-updatedAt",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){c.queues[e.id]&&_.merge(c.queues[e.id],_.pick(e,m))},c.$onInit=u,o.onWithoutApply("voice_queue:save",c.onSave),c.interval=t(function(){},999);var p=!0,g=1;function v(e){c.count=e.count,c.queues=e?_.keyBy(e.rows?e.rows:[],"id"):{},u()}e.$watch("vm.query.filter",function(e,t){p?n(function(){p=!1}):(t||(g=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=g),c.getQueues())}),e.$on("$destroy",function(){o.removeAllListeners("voice_queue:save"),c.interval&&t.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,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this,v=["loggedIn","available","waiting","talking","pTalking","originated","message","dialActive","dialMethod","Trunk","paused"];function h(){var n=[];return _.forIn(g.queues,function(e,t){e.paused=0,e.loggedInDb=0,g.queues[t].agents={},n.push(l.voiceQueue.getMembers({id:t}).$promise),g.rpcQueues[t]&&_.merge(e,_.pick(g.rpcQueues[t],v))}),t.all(n).then(function(e){for(var t=0;t<e.length;t+=1)for(var n=0;n<e[t].rows.length;n++)e[t].rows[n].paused&&g.queues[e[t].rows[n].VoiceQueueId].paused++,g.queues[e[t].rows[n].VoiceQueueId].loggedInDb++,g.queues[e[t].rows[n].VoiceQueueId].agents[e[t].rows[n].UserId]=e[t].rows[n].VoiceQueueId}).catch(function(e){console.error(e)})}g.currentUser=p.getCurrentUser(),g.count=o.count?o.count:0,g.queues=o?_.keyBy(o.rows?o.rows:[],"id"):{},g.rpcQueues=r?_.keyBy(r.rows?r.rows:[],"id"):{},g.userProfile=m,g.userProfileSection=u&&1==u.count?u.rows[0]:null,g.crudPermissions=p.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),p.hasRole("admin")?g.query={type:"outbound",sort:"-updatedAt",limit:10,page:1}:g.query={id:g.currentUser.id,channel:"voice",type:"outbound",sort:"-updatedAt",limit:10,page:1},g.success=E,g.getQueues=function(){g.query.offset=(g.query.page-1)*g.query.limit,p.hasRole("admin")?g.promise=l.voiceQueue.get(g.query,E).$promise:(g.query.id=g.userProfile.id,g.query.section="QueueCampaigns",g.promise=l.userProfile.getResources(g.query,E).$promise)},g.createOrEditMotionDialerQueue=function(e,t){a.show({controller:"CreateOrEditQueueCampaignDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:t,queueCampaigns:_.values(g.queues),license:null,setting:null,crudPermissions:g.crudPermissions}})},g.agentAdd=function(e,t){a.show({controller:"QueueCampaignagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:t,queueCampaigns:g.queues?g.queues.rows:[],realtime:!0,crudPermissions:g.crudPermissions}})},g.updateQueue=function(e){return l.voiceQueue.update(e).$promise.then(function(){c.success({title:"Queue properly updated!",msg:e.name?e.name+" has been updated!":""})}).catch(function(e){c.error({title:"Error creating queue!",msg:e.message})})},g.onSave=function(e){g.queues[e.id]&&_.merge(g.queues[e.id],_.pick(e,v))},g.onSaveMember=function(e){g.queues[e.MotionDialerQueueId]&&g.queues[e.MotionDialerQueueId].loggedInDb++},g.onPause=function(n){console.log("onPause",n),n.voicePause?_.forIn(g.queues,function(e,t){e.agents[n.id]&&(e.paused+=1,console.log("pause"))}):n.voicePause||_.forIn(g.queues,function(e,t){e.agents[n.id]&&0<e.paused&&(e.paused-=1,console.log("unpause"))})},g.onLogin=function(e){console.log("onLogged",e),g.queues[e.VoiceQueueId]&&(g.queues[e.VoiceQueueId].loggedInDb+=1,g.queues[e.VoiceQueueId].agents[e.UserId]=e.VoiceQueueId)},g.onLogout=function(e){console.log("onLogout",e),g.queues[e.VoiceQueueId]&&0<g.queues[e.VoiceQueueId].loggedInDb&&(g.queues[e.VoiceQueueId].loggedInDb-=1,delete g.queues[e.VoiceQueueId].agents[e.UserId])},g.$onInit=h,g.order=[],_.forIn(g.queues,function(e,t){g.order.push(e.id)}),d.onWithoutApply("voice_queue:save",g.onSave),g.interval=s(function(){},999),d.on("userVoiceQueueRt:save",g.onSaveMember),d.on("user:update",g.onPause),d.on("userVoiceQueue:remove",g.onLogout),d.on("userVoiceQueue:save",g.onLogin);var f=!0,b=1;function E(e){if(g.count=e.count,g.queues=e?_.keyBy(e.rows?e.rows:[],"id"):{},e.rows){g.order=[];for(var t=0;t<e.rows.length;t++)g.order.push(e.rows[t].id)}h()}e.$watch("vm.query.filter",function(e,t){f?n(function(){f=!1}):(t||(b=g.query.page),e!==t&&(g.query.page=1),e||(g.query.page=b),g.getQueues())}),e.$on("$destroy",function(){d.removeAllListeners("voice_queue:save"),g.interval&&s.cancel(g.interval),d.removeAllListeners("userVoiceQueueRt:save"),d.removeAllListeners("user:update"),d.removeAllListeners("userVoiceQueue:remove"),d.removeAllListeners("userVoiceQueue:save")})}e.$inject=["$scope","$timeout","$mdDialog","$q","$document","$interval","queues","rpcQueues","api","socket","toasty","userProfile","userProfileSection","Auth"],angular.module("app.motiondialer").controller("QueuesMotionDialerRealtimeController",e)}(),function(){"use strict";angular.module("app.auth").factory("helperClasses",function(){return{status:{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"},state:{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"},channelStatus:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},channelStatusOut:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"}}})}(),function(){"use strict";function e(e,n,t){switch(t.disconnect(),t.connect(),this.selectedTab=0,n.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,n.go("app.motiondialer.realtime.agents")}e.$watch("vm.selectedTab",function(e,t){if(e!==t)switch(e){case 0:n.go("app.motiondialer.realtime.agents");break;case 1:n.go("app.motiondialer.realtime.queues");break;case 2:n.go("app.motiondialer.realtime.queue_calls");break;case 3:n.go("app.motiondialer.realtime.abandonedcalls");break;case 4:n.go("app.motiondialer.realtime.queue_params");break;case 5:n.go("app.motiondialer.realtime.ivr_campaigns");break;default:n.go("app.motiondialer.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.motiondialer").controller("MotionDialerRealtimeController",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(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,notificationSound:!0,queueTransferTimeout:300,agentTransferTimeout:300},g.title="OPENCHANNEL.NEW_OPENCHANNELACCOUNT",g.newOpenchannelAccount=!0),t.params.id&&(g.openchannelAccount.OpenchannelAccountId=t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.openchannelAccounts,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The openchannelAccount will be deleted.").ariaLabel("Delete OpenchannelAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.lists,{id:e.resourceId})}),n=null;if(g.openchannelAccount&&(n=_.find(g.lists,{id:Number(g.openchannelAccount.ListId)})),n&&!_.some(t,["id",n.id])){var a=_.find(g.lists,{id:n.id});a.canSelect=!1,t.push(a)}g.lists=t})}else{var n=[],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,n.push(g.lists[i]));g.lists=n}}).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 t(e,t){if(r.openchannelAccountApps.rows.length){var n=r.openchannelAccountApps.rows[t]?r.openchannelAccountApps.rows[t]:r.openchannelAccountApps.rows[0];i.show({controller:"EditOpenchannelAccountApp"+(n.appType||n.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/apps/"+(n.appType||n.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelAccountApp:n,openchannelAccount:r.openchannelAccount,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.openchannelAccountApps.rows[t]=e:r.openchannelAccountApps.rows.splice(t,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,t=[],n=0;n<r.openchannelAccountApps.rows.length;n++,0){var a=r.openchannelAccountApps.rows[n],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,t=_.concat(t,i,[a],s)}o.openchannelAccount.addApplications({id:r.openchannelAccount.id},_.sortBy(t,"priority")).$promise.then(function(e){r.openchannelAccountApps.rows=e.rows}).catch(function(e){console.error(e)})}function n(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:"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:"1"},{option:"Always",value:"0"}],required:!0,param:0},{title:"Text",name:"text",type:"textarea",maxlength:255,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){t(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,t){r.openchannelAccount=e,r.crudPermissions=void 0!==t?t:{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,t,n){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(n).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.openchannelAccountApps.rows.splice(t,1),l()},function(){console.log("CANCEL")})},r.getOpenchannelAccountApps=function(){r.promise=o.openchannelAccount.getApplications(r.query,n).$promise},r.editOpenchannelAccountApp=t,r.editInterval=function(e,t){if(r.openchannelAccountApps.rows.length){var n=r.openchannelAccountApps.rows[t]?r.openchannelAccountApps.rows[t]: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:n.interval,IntervalId:n.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(n.interval=e.interval||"*,*,*,*",n.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 t=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(t).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,t,n,o,r,l,d){var c=this;function m(){return a(function(n,t){return a(function(t,n){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.openchannelAccount.getAgents({id:c.openchannelAccount.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return t.penalty=e.UserOpenchannelAccount?"penalty "+e.UserOpenchannelAccount.penalty:"",t.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=l.getCurrentUser(),c.openchannelAccount=t,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(n,t){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.openchannelAccount.removeAgents({id:c.openchannelAccount.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.openchannelAccount.addAgents({id:c.openchannelAccount.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,items:[],selectedItems:[],showSelectAndDeselectAll:!o,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("OPENCHANNEL.ALL_AGENTS"),labelSelected:r.instant("OPENCHANNEL.SELECTED_AGENTS"),transferCallback:function(e,t){var n=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(n)}}}e.$inject=["$mdDialog","$q","toasty","api","openchannelAccount","openchannelAccounts","realtime","$translate","Auth","crudPermissions"],angular.module("app.openchannel").controller("OpenchannelAccountagentaddController",e)}(),function(){"use strict";function e(t,e,n,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"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){t.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 t=_.find(l.agents,{name:l.agent.agent});t&&(l.agent.UserId=t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),n=null;if(l.agent&&(n=_.find(l.agents,{name:l.agent.agent})),n&&!_.some(t,["id",n.id])){var a=_.find(l.agents,{id:n.id});a.canSelect=!1,t.push(a)}l.agents=t})}else{var n=[],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,n.push(l.agents[i]));l.agents=n}}).catch(function(e){n.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(t,e,n,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"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){t.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(t,e,n,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"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){t.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(t,e,n,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"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){t.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(t,e,n,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"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){t.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,t,n,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 E(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var t=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),n=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(t+"-"+n)}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 A(e){t.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=E(),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!":""}),A()}).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=E(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),A(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var t=_.find(c.intervals,{id:e.id});t&&_.merge(t,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),A()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=A,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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=e&&e.rows?e.rows:[],n=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(t,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,n.push(e))}),c.intervals=n})}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(t,e,n,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"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){t.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(t,e,n,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"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){t.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 t=_.find(l.queues,{name:l.queue.queue});t&&(l.queue[_.capitalize("openChannel")+"QueueId"]=t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),n=null;if(l.queue&&(n=_.find(l.queues,{name:l.queue.queue})),n&&!_.some(t,["id",n.id])){var a=_.find(l.queues,{id:n.id});a.canSelect=!1,t.push(a)}l.queues=t})}else{var n=[],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,n.push(l.queues[i]));l.queues=n}}).catch(function(e){n.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(t,e,n,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"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){t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),n=null;if(l.system&&(n=_.find(l.variables,{name:l.system.variable})),n&&!_.some(t,["id",n.id])){var a=_.find(l.variables,{id:n.id});a.canSelect=!1,t.push(a)}l.variables=t})}else{var n=[],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,n.push(l.variables[i]));l.variables=n}}).catch(function(e){n.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(t,e,n,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"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){t.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 t=_.find(l.tags,{name:l.tag.tag});t&&(l.tag.TagId=t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),n=null;if(l.tag&&(n=_.find(l.tags,{name:l.tag.tag})),n&&!_.some(t,["id",n.id])){var a=_.find(l.tags,{id:n.id});a.canSelect=!1,t.push(a)}l.tags=t})}else{var n=[],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,n.push(l.tags[i]));l.tags=n}}).catch(function(e){n.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,t,n,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.openchannelAccount={},c.openchannelAccountInteractions={count:0,rows:[]},c.selectedOpenchannelAccountInteractions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,Contact.firstName,Owner.name,closedAt,disposition,note,UserId,ContactId,OpenchannelAccountId,tag",sort:"-createdAt",includeAll:"true",limit:10,page:1},c.init=function(e,t){c.openchannelAccount=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.openchannelAccount.id,c.getOpenchannelAccountInteractions()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.openchannelInteractionDownload=function(s,e,t){return l.openchannelInteraction.download({id:s.id,exists:!0,attachments:t}).$promise.then(function(e){var t=[e.buffer],n="interaction"+s.id,a=new Blob(t,{type:e.type});n="openchannel-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.success=p,c.getOpenchannelAccountInteractions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.openchannelAccount.getInteractions(c.query,p).$promise},c.createOrEditOpenchannelAccountInteraction=function(e,t){s.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/interactions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelAccount:c.openchannelAccount,interaction:t,interactions:c.openchannelAccountInteractions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.spyopenchannelInteraction=function(e,n){s.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,t){e.vm.init({id:1,channel:"openchannel",interaction:n,spy:!0},a.$parent.vm.setting)}})},c.exportSelectedOpenchannelAccountInteractions=function(){var e=angular.copy(c.selectedOpenchannelAccountInteractions);return c.selectedOpenchannelAccountInteractions=[],e},c.deleteOpenchannelAccountInteraction=g,c.deleteSelectedOpenchannelAccountInteractions=function(e){var t=s.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+c.selectedOpenchannelAccountInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedOpenchannelAccountInteractions.forEach(function(e){g(e)}),c.selectedOpenchannelAccountInteractions=[]})};var m=!0,u=1;function p(e){c.openchannelAccountInteractions=e||{count:0,rows:[]}}function g(e){l.openchannelInteraction.delete({id:e.id}).$promise.then(function(){_.remove(c.openchannelAccountInteractions.rows,{id:e.id}),c.openchannelAccountInteractions.count-=1,c.openchannelAccountInteractions.rows.length||c.getOpenchannelAccountInteractions(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETopenchannelAccount"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}a.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getOpenchannelAccountInteractions())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.openchannel").controller("OpenchannelAccountInteractionsController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.openchannelAccount={},c.openchannelAccountOpenchannelCannedAnswers={count:0,rows:[]},c.selectedOpenchannelAccountOpenchannelCannedAnswers=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,key,value,description",limit:10,page:1},c.init=function(e,t){c.openchannelAccount=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.openchannelAccount.id,c.query.OpenchannelAccountId=c.openchannelAccount.id,c.getOpenchannelAccountOpenchannelCannedAnswers()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the openchannelCannedAnswer?").htmlContent("<b>"+(e.name||"openchannelCannedAnswer")+"</b> will be deleted.").ariaLabel("delete openchannelCannedAnswer").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getOpenchannelAccountOpenchannelCannedAnswers=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.openchannelAccount.getAnswers(c.query,p).$promise},c.createOrEditOpenchannelAccountOpenchannelCannedAnswer=function(e,t){s.show({controller:"CreateOrEditOpenchannelCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/openchannelCannedAnswers/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelAccount:c.openchannelAccount,openchannelCannedAnswer:t,openchannelCannedAnswers:c.openchannelAccountOpenchannelCannedAnswers.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedOpenchannelAccountOpenchannelCannedAnswers=function(){var e=angular.copy(c.selectedOpenchannelAccountOpenchannelCannedAnswers);return c.selectedOpenchannelAccountOpenchannelCannedAnswers=[],e},c.deleteOpenchannelAccountOpenchannelCannedAnswer=g,c.deleteSelectedOpenchannelAccountOpenchannelCannedAnswers=function(e){var t=s.confirm().title("Are you sure want to delete the selected openchannelCannedAnswers?").htmlContent("<b>"+c.selectedOpenchannelAccountOpenchannelCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete openchannelCannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedOpenchannelAccountOpenchannelCannedAnswers.forEach(function(e){g(e)}),c.selectedOpenchannelAccountOpenchannelCannedAnswers=[]})};var m=!0,u=1;function p(e){c.openchannelAccountOpenchannelCannedAnswers=e||{count:0,rows:[]}}function g(e){l.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(c.openchannelAccountOpenchannelCannedAnswers.rows,{id:e.id}),c.openchannelAccountOpenchannelCannedAnswers.count-=1,c.openchannelAccountOpenchannelCannedAnswers.rows.length||c.getOpenchannelAccountOpenchannelCannedAnswers(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETopenchannelAccount"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getOpenchannelAccountOpenchannelCannedAnswers())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.openchannel").controller("OpenchannelAccountOpenchannelCannedAnswersController",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(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),t.params.id&&(g.openchannelCannedAnswer.OpenchannelAccountId=t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.openchannelCannedAnswers,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The openchannelCannedAnswer will be deleted.").ariaLabel("Delete OpenchannelCannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.openchannelAccount={},c.openchannelAccountOpenchannelDispositions={count:0,rows:[]},c.selectedOpenchannelAccountOpenchannelDispositions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,name",limit:10,page:1},c.init=function(e,t){c.openchannelAccount=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.openchannelAccount.id,c.query.OpenchannelAccountId=c.openchannelAccount.id,c.getOpenchannelAccountOpenchannelDispositions()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the openchannelDisposition?").htmlContent("<b>"+(e.name||"openchannelDisposition")+"</b> will be deleted.").ariaLabel("delete openchannelDisposition").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getOpenchannelAccountOpenchannelDispositions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.openchannelAccount.getDispositions(c.query,p).$promise},c.createOrEditOpenchannelAccountOpenchannelDisposition=function(e,t){s.show({controller:"CreateOrEditOpenchannelDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/openchannelDispositions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelAccount:c.openchannelAccount,openchannelDisposition:t,openchannelDispositions:c.openchannelAccountOpenchannelDispositions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedOpenchannelAccountOpenchannelDispositions=function(){var e=angular.copy(c.selectedOpenchannelAccountOpenchannelDispositions);return c.selectedOpenchannelAccountOpenchannelDispositions=[],e},c.deleteOpenchannelAccountOpenchannelDisposition=g,c.deleteSelectedOpenchannelAccountOpenchannelDispositions=function(e){var t=s.confirm().title("Are you sure want to delete the selected openchannelDispositions?").htmlContent("<b>"+c.selectedOpenchannelAccountOpenchannelDispositions.length+" selected</b> will be deleted.").ariaLabel("delete openchannelDispositions").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedOpenchannelAccountOpenchannelDispositions.forEach(function(e){g(e)}),c.selectedOpenchannelAccountOpenchannelDispositions=[]})};var m=!0,u=1;function p(e){c.openchannelAccountOpenchannelDispositions=e||{count:0,rows:[]}}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){_.remove(c.openchannelAccountOpenchannelDispositions.rows,{id:e.id}),c.openchannelAccountOpenchannelDispositions.count-=1,c.openchannelAccountOpenchannelDispositions.rows.length||c.getOpenchannelAccountOpenchannelDispositions(),r.success({title:"OpenchannelDisposition deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETopenchannelAccount"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getOpenchannelAccountOpenchannelDispositions())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.openchannel").controller("OpenchannelAccountOpenchannelDispositionsController",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(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_OPENCHANNELDISPOSITION",g.openchannelDisposition=angular.copy(l),g.openchannelDispositions=r,g.newOpenchannelDisposition=!1,g.openchannelDisposition||(g.openchannelDisposition={},g.title="OPENCHANNEL.NEW_OPENCHANNELDISPOSITION",g.newOpenchannelDisposition=!0),t.params.id&&(g.openchannelDisposition.OpenchannelAccountId=t.params.id),g.addNewOpenchannelDisposition=function(){g.errors=[],d.disposition.save(g.openchannelDisposition).$promise.then(function(e){g.openchannelDispositions.unshift(e.toJSON()),o.success({title:"OpenchannelDisposition properly created",msg:g.openchannelDisposition.name?g.openchannelDisposition.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.disposition.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveOpenchannelDisposition=function(){g.errors=[],d.disposition.update({id:g.openchannelDisposition.id},g.openchannelDisposition).$promise.then(function(e){var t=_.find(g.openchannelDispositions,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"OpenchannelDisposition properly saved!",msg:g.openchannelDisposition.name?g.openchannelDisposition.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.disposition.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteOpenchannelDisposition=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The openchannelDisposition will be deleted.").ariaLabel("Delete OpenchannelDisposition").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.disposition.delete({id:g.openchannelDisposition.id}).$promise.then(function(){_.remove(g.openchannelDispositions,{id:g.openchannelDisposition.id}),o.success({title:"OpenchannelDisposition properly deleted!",msg:(g.openchannelDisposition.name||"openchannelDisposition")+" has been deleted!"}),v(g.openchannelDisposition)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.disposition.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.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","openchannelDispositions","openchannelDisposition","api","Auth","license","setting","crudPermissions"],angular.module("app.openchannel").controller("CreateOrEditOpenchannelDispositionDialogController",e)}(),function(){"use strict";function e(e,t,n,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=t.protocol()+"://"+t.host(),u.openchannelAccount=c||e.params.openchannelAccount||{},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.agentadddialog=function(e,t){n.show({controller:"OpenchannelAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{openchannelAccount:e,openchannelAccounts:u.openchannelAccounts?u.openchannelAccounts.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoOpenchannelAccounts=function(){e.go("app.openchannel.openchannelAccounts")},u.saveOpenchannelAccount=function(){r.openchannelAccount.update({id:u.openchannelAccount.id},u.openchannelAccount).$promise.then(function(){l.success({title:"OpenchannelAccount updated!",msg:u.openchannelAccount.name?u.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){u.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){u.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.lists,{id:e.resourceId})}),n=null;if(u.openchannelAccount&&(n=_.find(u.lists,{id:Number(u.openchannelAccount.ListId)})),n&&!_.some(t,["id",n.id])){var a=_.find(u.lists,{id:n.id});a.canSelect=!1,t.push(a)}u.lists=t})}else{var n=[],a=null;u.openchannelAccount&&(a=_.find(u.lists,{id:Number(u.openchannelAccount.ListId)}));for(var i=0;i<u.lists.length;i++)a&&u.lists[i].id===a.id&&(u.lists[i].canSelect=!1,n.push(u.lists[i]));u.lists=n}}).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:u.openchannelAccount.ListId}).$promise.then(function(e){u.fields=[];e=_.values(e.toJSON());for(var t=["id","createdAt","updatedAt","deletedAt","scheduledat","ListId","CompanyId"],n=0;n<e.length;n++)_.includes(t,e[n].columnName)||u.fields.push(e[n])}).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){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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.pauses,{id:e.resourceId})});u.pauses.forEach(function(e){_.some(t,["id",e.id])||(e.canSelect=!1),t.push(e)}),u.pauses=t})}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","openchannelAccount","userProfileSection"],angular.module("app.openchannel").controller("OpenchannelAccountController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.openchannelAccounts=l||{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="openchannelAccounts",b.listOrder="",b.listOrderAsc=null,b.selectedOpenchannelAccounts=[],b.query={fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,mapKey,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUri,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,page:1},b.editstate=function(e,t){n.go("app.openchannel.openchannelAccounts.edit",{id:e.id,openchannelAccount:e,crudPermissions:b.crudPermissions})},b.interactionsgoto=function(e,t){n.go("app.openchannel.openchannelAccounts.edit",{id:e.id,tab:5})},b.agentadddialog=function(e,t){i.show({controller:"OpenchannelAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{openchannelAccount:e,openchannelAccounts:b.openchannelAccounts?b.openchannelAccounts.rows:[],crudPermissions:b.crudPermissions,realtime:!1}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getOpenchannelAccounts=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.openchannelAccount.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="OpenchannelAccounts",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditOpenchannelAccount=function(e,t){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:t,openchannelAccounts:b.openchannelAccounts.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteOpenchannelAccount=S,b.exportSelectedOpenchannelAccounts=function(){var e=angular.copy(b.selectedOpenchannelAccounts);return b.selectedOpenchannelAccounts=[],e},b.deleteSelectedOpenchannelAccounts=function(e){var t=i.confirm().title("Are you sure want to delete the selected openchannelAccounts?").htmlContent("<b>"+b.selectedOpenchannelAccounts.length+" selected</b> will be deleted.").ariaLabel("delete OpenchannelAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedOpenchannelAccounts.forEach(function(e){S(e)}),b.selectedOpenchannelAccounts=[]})},b.deselectOpenchannelAccounts=function(){b.selectedOpenchannelAccounts=[]},b.selectAllOpenchannelAccounts=function(){b.selectedOpenchannelAccounts=b.openchannelAccounts.rows},g.hasRole("admin")?m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){b.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){b.lists=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(b.lists,{id:e.resourceId})}),n=null;if(b.openchannelAccount&&(n=_.find(b.lists,{id:Number(b.openchannelAccount.ListId)})),n&&!_.some(t,["id",n.id])){var a=_.find(b.lists,{id:n.id});a.canSelect=!1,t.push(a)}b.lists=t})}else{var n=[],a=null;b.openchannelAccount&&(a=_.find(b.lists,{id:Number(b.openchannelAccount.ListId)}));for(var i=0;i<b.lists.length;i++)a&&b.lists[i].id===a.id&&(b.lists[i].canSelect=!1,n.push(b.lists[i]));b.lists=n}}).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 E=!0,A=1;function y(e){b.openchannelAccounts=e||{count:0,rows:[]}}function S(e){m.openchannelAccount.delete({id:e.id}).$promise.then(function(){_.remove(b.openchannelAccounts.rows,{id:e.id}),b.openchannelAccounts.count-=1,b.openchannelAccounts.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEopenchannelAccount"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getOpenchannelAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","openchannelAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.openchannel").controller("OpenchannelAccountsController",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(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_OPENCHANNELQUEUE",g.openchannelQueue=angular.copy(l),g.openchannelQueues=r,g.newOpenchannelQueue=!1,g.openchannelQueue||(g.openchannelQueue={strategy:"beepall",timeout:10},g.title="OPENCHANNEL.NEW_OPENCHANNELQUEUE",g.newOpenchannelQueue=!0),g.addNewOpenchannelQueue=function(){g.errors=[],d.openchannelQueue.save(g.openchannelQueue).$promise.then(function(e){g.openchannelQueues.unshift(e.toJSON()),o.success({title:"OpenchannelQueue properly created",msg:g.openchannelQueue.name?g.openchannelQueue.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.openchannelQueue.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveOpenchannelQueue=function(){g.errors=[],d.openchannelQueue.update({id:g.openchannelQueue.id},g.openchannelQueue).$promise.then(function(e){var t=_.find(g.openchannelQueues,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"OpenchannelQueue properly saved!",msg:g.openchannelQueue.name?g.openchannelQueue.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.openchannelQueue.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteOpenchannelQueue=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The openchannelQueue will be deleted.").ariaLabel("Delete OpenchannelQueue").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.openchannelQueue.delete({id:g.openchannelQueue.id}).$promise.then(function(){_.remove(g.openchannelQueues,{id:g.openchannelQueue.id}),o.success({title:"OpenchannelQueue properly deleted!",msg:(g.openchannelQueue.name||"openchannelQueue")+" has been deleted!"}),v(g.openchannelQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelQueue.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.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(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","openchannelQueues","openchannelQueue","api","Auth","license","setting","crudPermissions"],angular.module("app.openchannel").controller("CreateOrEditOpenchannelQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,t,n,o,r,l,d){var c=this;function m(){return a(function(n,t){return a(function(t,n){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.openchannelQueue.getAgents({id:c.openchannelQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return t.penalty=e.UserOpenchannelQueue?"penalty "+e.UserOpenchannelQueue.penalty:"",t.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=l.getCurrentUser(),c.openchannelQueue=t,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(n,t){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.openchannelQueue.removeAgents({id:c.openchannelQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.openchannelQueue.addAgents({id:c.openchannelQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,items:[],selectedItems:[],showSelectAndDeselectAll:!o,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("OPENCHANNEL.ALL_AGENTS"),labelSelected:r.instant("OPENCHANNEL.SELECTED_AGENTS"),transferCallback:function(e,t){var n=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(n)}}}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,t,n,o,r){var l=this;function d(){return a(function(n,t){return a(function(t,n){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:l.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return l.allowedItems=_.map(t,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var t=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.openchannelQueue.getTeams({id:l.openchannelQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];l.selectedItems=_.map(t,function(e){return _.find(l.items,{id:e.id})}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}l.currentUser=o.getCurrentUser(),l.openchannelQueue=t,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={readOnly:!l.crudPermissions.canEdit,allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!0,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:n.instant("OPENCHANNEL.ALL_TEAMS"),labelSelected:n.instant("OPENCHANNEL.SELECTED_TEAMS"),transferCallback:function(e,t){var n=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(n)}},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(n,t){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.openchannelQueue.removeTeams({id:l.openchannelQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.openchannelQueue.addTeams({id:l.openchannelQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},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,t,n,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=t.protocol()+"://"+t.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,t){n.show({controller:"OpenchannelQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{openchannelQueue:e,openchannelQueues:u.openchannelQueues?u.openchannelQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,t){n.show({controller:"OpenchannelQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:t,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")},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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.openchannelQueues=l||{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="openchannelQueues",b.listOrder="",b.listOrderAsc=null,b.selectedOpenchannelQueues=[],b.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"openchannel",limit:10,page:1},b.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.openchannel.openchannelQueues.edit",{id:e.id,openchannelQueue:e,crudPermissions:b.crudPermissions})},b.teamadddialog=function(e,t){i.show({controller:"OpenchannelQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{openchannelQueue:e,openchannelQueues:b.openchannelQueues?b.openchannelQueues.rows:[],crudPermissions:b.crudPermissions}})},b.agentadddialog=function(e,t){i.show({controller:"OpenchannelQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{openchannelQueue:e,openchannelQueues:b.openchannelQueues?b.openchannelQueues.rows:[],crudPermissions:b.crudPermissions,realtime:!1}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.gotorealtimegoto=function(e,t){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:810}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.openchannel.realtime.queues",{})}},b.success=y,b.getOpenchannelQueues=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.openchannelQueue.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="OpenchannelQueues",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditOpenchannelQueue=function(e,t){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:t,openchannelQueues:b.openchannelQueues.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteOpenchannelQueue=S,b.exportSelectedOpenchannelQueues=function(){var e=angular.copy(b.selectedOpenchannelQueues);return b.selectedOpenchannelQueues=[],e},b.deleteSelectedOpenchannelQueues=function(e){var t=i.confirm().title("Are you sure want to delete the selected openchannelQueues?").htmlContent("<b>"+b.selectedOpenchannelQueues.length+" selected</b> will be deleted.").ariaLabel("delete OpenchannelQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedOpenchannelQueues.forEach(function(e){S(e)}),b.selectedOpenchannelQueues=[]})},b.deselectOpenchannelQueues=function(){b.selectedOpenchannelQueues=[]},b.selectAllOpenchannelQueues=function(){b.selectedOpenchannelQueues=b.openchannelQueues.rows};var E=!0,A=1;function y(e){b.openchannelQueues=e||{count:0,rows:[]}}function S(e){m.openchannelQueue.delete({id:e.id}).$promise.then(function(){_.remove(b.openchannelQueues.rows,{id:e.id}),b.openchannelQueues.count-=1,b.openchannelQueues.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEopenchannelQueue"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getOpenchannelQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","openchannelQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.openchannel").controller("OpenchannelQueuesController",e)}(),function(){"use strict";function e(e,o,t,n,a,i,s,r,l,d,c,m,u,p,g,v,h,f){var b=this,E=["userpic","online","lastLoginAt","lastPauseAt","pauseType","lastPauseAt","internal","address","chatPause","openchannelPause","mailPause","smsPause","faxPause","voicePause","chatCapacity","openchannelCapacity","mailCapacity","smsCapacity","faxCapacity","chatCurrentCapacity","openchannelCurrentCapacity","mailCurrentCapacity","smsCurrentCapacity","faxCurrentCapacity","chatStatus","openchannelStatus","mailStatus","smsStatus","faxStatus","voiceStatus","chatStatusTime","openchannelStatusTime","mailStatusTime","smsStatusTime","faxStatusTime","voiceStatusTime","queue","destconnectedlinenum","onhold"],A=["chatPause","openchannelPause","mailPause","smsPause","faxPause","voicePause","online"];for(var y in b.currentUser=v.getCurrentUser(),b.availableStates=["ringing","inuse","busy","onhold","not_inuse"],b.pauses=s||{count:0,rows:[]},b.license=h,b.userProfile=p,b.userProfileSection=g&&1==g.count?g.rows[0]:null,b.crudPermissions=v.parseCrudPermissions(b.userProfileSection?b.userProfileSection.crudPermissions:null),b.agents=r?_.keyBy(r.rows?r.rows:[],"id"):{},b.rpcAgents=l?_.keyBy(l.rows?l.rows:[],"id"):{},b.paginatedAgents={},b.load=!1,b.order=[],b.agentInternal={},b.agents)b.agents.hasOwnProperty(y)&&(b.agents[y].init=!0);b.query={limit:10,page:1,order:"fullname",globalStatusFilter:"",pauseTypeFilter:""},b.logout=function(e,t){return d.user.logout({id:e.id,device:"realtime",agent_id:e.id,agent_name:e.name}).$promise.then(function(){m.success({title:"Agent logout",msg:e.fullname+"  properly logout"}),b.agents[e.id]&&(b.agents[e.id].online=!1),b.rpcAgents[e.id]&&(b.rpcAgents[e.id].online=!1),T()}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.queueAdd=function(e,t){n.show({controller:"AgentqueueaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/queueadd/queueadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{agent:e,agents:[],channel:"openchannel",direction:"inbound",crudPermissions:b.crudPermissions}})},b.pause=function(t,e){return d.user.pause({id:t.id,type:e}).$promise.then(function(e){b.agents[t.id]&&_.merge(b.agents[t.id],_.pick(e,E)),b.rpcAgents[t.id]&&_.merge(b.rpcAgents[t.id],_.pick(e,E)),O(b.agents[t.id])}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.unPause=function(t){return d.user.unpause({id:t.id}).$promise.then(function(e){b.agents[t.id]&&_.merge(b.agents[t.id],_.pick(e,E)),b.rpcAgents[t.id]&&_.merge(b.rpcAgents[t.id],_.pick(e,E)),O(b.agents[t.id])}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.showInfo=function(e){n.show(n.alert().clickOutsideToClose(!0).title("Legend").htmlContent("<div>TODO legend status + state</div>").ok("Ok").targetEvent(e))},b.getAgentStatus=w,b.getAgentGlobalStatus=O,b.isPause=I,b.checkPause=function(e){return"pause"===e},b.isPartialPause=function(e){return"*pause"===e},b.onSave=function(e){b.agents[e.id]&&(_.merge(b.agents[e.id],_.pick(_.omit(e,A),E)),_.merge(b.rpcAgents[e.id],_.pick(_.omit(e,A),E)),O(b.agents[e.id]))},b.onUpdate=function(e){b.agents[e.id]&&(_.merge(b.agents[e.id],_.pick(e,E)),_.merge(b.rpcAgents[e.id],_.pick(e,E)),e.lastPauseAt&&(b.agents[e.id].globalStatusTime=e.lastPauseAt,b.rpcAgents[e.id].globalStatusTime=e.lastPauseAt),O(b.agents[e.id]))},b.onInit=T,b.onConnect=function(e){b.agents[b.agentInternal[e.destaccountcode]]&&(_.merge(b.agents[b.agentInternal[e.destaccountcode]],_.pick(e,["queue","destconnectedlinenum"])),_.merge(b.rpcAgents[b.agentInternal[e.destaccountcode]],_.pick(e,["queue","destconnectedlinenum"])))},b.onComplete=function(e){b.agents[b.agentInternal[e.destaccountcode]]&&(b.agents[b.agentInternal[e.destaccountcode]]=_.omit(b.agents[b.agentInternal[e.destaccountcode]],["queue","destconnectedlinenum"]),b.rpcAgents[b.agentInternal[e.destaccountcode]]=_.omit(b.rpcAgents[b.agentInternal[e.destaccountcode]],["queue","destconnectedlinenum"]))},c.on("user:save",b.onSave),c.on("user:update",b.onUpdate),c.on("user:agentconnect",b.onConnect),c.on("user:agentcomplete",b.onComplete),T();var S=f(function(){b.load&&(b.load=!1,T())},999);function T(e){b.load=!1;var t,n,a=o.defer();b.promise=a.promise,b.filteredAgents=[],b.order=[],_.forIn(b.agents,function(e,t){b.rpcAgents[t]&&_.merge(e,_.pick(_.omit(b.rpcAgents[t],A),E)),O(e),e.online?(b.filteredAgents.push(e),b.agentInternal[e.internal]=t):e.globalStatusTime=_.toNumber(moment().format("x"))}),b.query.globalStatusFilter&&_.remove(b.filteredAgents,function(e){return e.globalStatus!==b.query.globalStatusFilter}),b.query.pauseTypeFilter&&_.remove(b.filteredAgents,function(e){return e.pauseType!==b.query.pauseTypeFilter}),b.query.filter&&_.remove(b.filteredAgents,function(e){return e.fullname.toLowerCase().indexOf(b.query.filter.toLowerCase())<0}),b.filteredAgents=(t=b.filteredAgents,n=_.startsWith(b.query.order,"-")?"desc":"asc",_.orderBy(t,[b.query.order.replace("-","")],[n]));var i=(b.query.page-1)*b.query.limit;b.paginatedAgents=_.drop(b.filteredAgents,i).slice(0,b.query.limit);for(var s=0;s<b.paginatedAgents.length;s+=1)b.order.push(b.paginatedAgents[s].id);a.resolve(),b.load=!0}function I(e){return"pause"===e||"*pause"===e}function C(e){return"idle"===e||"unknown"===e||"unavailable"===e||"ringing"===e||_.isNil(e)}function w(e,t){return"voice"===t?"idle"!==e[t+"Status"]?e[t+"Status"]:e[t+"Pause"]?e[t+"Status"]="pause":"idle":e[t+"Pause"]?e[t+"Status"]="pause":e[t+"Status"]}function O(e){var t="unknown";t=_.every([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],I)?"pause":_.some([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],I)?"*pause":_.every([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],C)?"idle":"busy",e.globalStatus!==t&&(e.globalStatus=t,e.init?(e.init=!1,e.globalStatusTime=I(t)?_.toNumber(moment(e.lastPauseAt).format("x")):_.max([e.voiceStatusTime,e.chatStatusTime,e.mailStatusTime,e.smsStatusTime,e.openchannelStatusTime,e.faxStatusTime])):e.globalStatusTime=_.toNumber(moment().format("x")))}e.$on("$destroy",function(){c.removeAllListeners("user:save"),c.removeAllListeners("user:update"),c.removeAllListeners("user:agentconnect"),c.removeAllListeners("user:agentcomplete"),S&&(f.cancel(S),S=null)})}e.$inject=["$scope","$q","$timeout","$mdDialog","$document","$filter","pauses","agents","rpcAgents","api","socket","toasty","helperClasses","userProfile","userProfileSection","Auth","license","$interval"],angular.module("app.voice").controller("AgentsOpenchannelRealtimeController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this,v=["loggedIn","available","waiting","talking","pTalking","originated","message","dialActive","dialMethod","Trunk","paused"];function h(){var n=[];return _.forIn(g.queues,function(e,t){e.paused=0,e.loggedInDb=0,g.queues[t].agents={},n.push(l.openchannelQueue.getMembers({id:t}).$promise),g.rpcQueues[t]&&_.merge(e,_.pick(g.rpcQueues[t],v))}),t.all(n).then(function(e){for(var t=0;t<e.length;t+=1)for(var n=0;n<e[t].rows.length;n++)e[t].rows[n].paused&&g.queues[e[t].rows[n].OpenchannelQueueId].paused++,g.queues[e[t].rows[n].OpenchannelQueueId].loggedInDb++,g.queues[e[t].rows[n].OpenchannelQueueId].agents[e[t].rows[n].UserId]=e[t].rows[n].OpenchannelQueueId}).catch(function(e){console.error(e)})}g.currentUser=p.getCurrentUser(),g.count=o.count?o.count:0,g.queues=o?_.keyBy(o.rows?o.rows:[],"id"):{},g.rpcQueues=r?_.keyBy(r.rows?r.rows:[],"id"):{},g.userProfile=m,g.userProfileSection=u&&1==u.count?u.rows[0]:null,g.crudPermissions=p.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),p.hasRole("admin")?g.query={type:"inbound",sort:"-updatedAt",limit:10,page:1}:g.query={id:g.currentUser.id,channel:"openchannel",type:"inbound",sort:"-updatedAt",limit:10,page:1},g.success=E,g.getQueues=function(){g.query.offset=(g.query.page-1)*g.query.limit,p.hasRole("admin")?g.promise=l.openchannelQueue.get(g.query,E).$promise:(g.query.id=g.userProfile.id,g.query.section="OpenchannelQueues",g.promise=l.userProfile.getResources(g.query,E).$promise)},g.createOrEditOpenchannelQueue=function(e,t){a.show({controller:"CreateOrEditOpenchannelQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelQueue:t,openchannelQueues:_.values(g.queues),license:null,setting:null,crudPermissions:g.crudPermissions}})},g.agentAdd=function(e,t){a.show({controller:"OpenchannelQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelQueue:t,openchannelQueues:g.queues?g.queues.rows:[],realtime:!1,crudPermissions:g.crudPermissions}})},g.updateQueue=function(e){return l.openchannelQueue.update(e).$promise.then(function(){c.success({title:"Queue properly updated!",msg:e.name?e.name+" has been updated!":""})}).catch(function(e){c.error({title:"Error creating queue!",msg:e.message})})},g.onSave=function(e){g.queues[e.id]&&_.merge(g.queues[e.id],_.pick(e,v))},g.onSaveMember=function(e){g.queues[e.OpenchannelQueueId]&&g.queues[e.OpenchannelQueueId].loggedInDb++},g.onRemoveMember=function(e){g.queues[e.OpenchannelQueueId]&&g.queues[e.OpenchannelQueueId].loggedInDb--},g.onPause=function(n){console.log("onPause",n),n.voicePause?_.forIn(g.queues,function(e,t){e.agents[n.id]&&(e.paused+=1,console.log("pause"))}):n.voicePause||_.forIn(g.queues,function(e,t){e.agents[n.id]&&0<e.paused&&(e.paused-=1,console.log("unpause"))})},g.onLogin=function(e){console.log("onLogged",e),g.queues[e.OpenchannelQueueId]&&(g.queues[e.OpenchannelQueueId].loggedInDb+=1,g.queues[e.OpenchannelQueueId].agents[e.UserId]=e.OpenchannelQueueId)},g.onLogout=function(e){console.log("onLogout",e),g.queues[e.OpenchannelQueueId]&&0<g.queues[e.OpenchannelQueueId].loggedInDb&&(g.queues[e.OpenchannelQueueId].loggedInDb-=1,delete g.queues[e.OpenchannelQueueId].agents[e.UserId])},g.$onInit=h,g.order=[],_.forIn(g.queues,function(e,t){g.order.push(e.id)}),d.on("openchannel_queue:save",g.onSave),d.on("userOpenchannelQueue:save",g.onSaveMember),d.on("userOpenchannelQueue:remove",g.onRemoveMember),d.on("user:update",g.onPause),d.on("userVoiceQueue:remove",g.onLogout),d.on("userVoiceQueue:save",g.onLogin);var f=!0,b=1;function E(e){if(g.count=e.count,g.queues=e?_.keyBy(e.rows?e.rows:[],"id"):{},e.rows){g.order=[];for(var t=0;t<e.rows.length;t++)g.order.push(e.rows[t].id)}h()}e.$watch("vm.query.filter",function(e,t){f?n(function(){f=!1}):(t||(b=g.query.page),e!==t&&(g.query.page=1),e||(g.query.page=b),g.getQueues())}),e.$on("$destroy",function(){d.removeAllListeners("openchannel_queue:save"),d.removeAllListeners("userOpenchannelQueue:remove"),d.removeAllListeners("userOpenchannelQueue:save"),d.removeAllListeners("user:update"),d.removeAllListeners("userVoiceQueue:remove"),d.removeAllListeners("userVoiceQueue:save")})}e.$inject=["$scope","$timeout","$mdDialog","$q","$document","$interval","queues","rpcQueues","api","socket","toasty","userProfile","userProfileSection","Auth"],angular.module("app.openchannel").controller("QueuesOpenchannelRealtimeController",e)}(),function(){"use strict";angular.module("app.auth").factory("helperClasses",function(){return{status:{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"},state:{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"},channelStatus:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},channelStatusOut:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"}}})}(),function(){"use strict";function e(e,n,t){switch(t.disconnect(),t.connect(),this.selectedTab=0,n.current.name){case"app.openchannel.realtime.agents":this.selectedTab=0;break;case"app.openchannel.realtime.queues":this.selectedTab=1;break;default:this.selectedTab=0,n.go("app.openchannel.realtime.agents")}e.$watch("vm.selectedTab",function(e,t){if(e!==t)switch(e){case 0:n.go("app.openchannel.realtime.agents");break;case 1:n.go("app.openchannel.realtime.queues");break;default:n.go("app.openchannel.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.openchannel").controller("OpenchannelRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,s){var o=this;o.currentUser=s.getCurrentUser(),o.plugin={},o.getTrustedURL=function(){return n.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(e,t,n,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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.customizations,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The customization will be deleted.").ariaLabel("Delete Customization").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,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?t.setting.update({id:s.customization.id},s.customization).$promise.then(function(){n.success({title:"Customization updated!",msg:s.customization.name?s.customization.name+" has been updated!":""})}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsetting",msg:e.data?JSON.stringify(e.data):e.toString()})}):t.setting.save(s.customization).$promise.then(function(e){_.merge(s.customization,e),n.success({title:"Customization updated!",msg:s.customization.name?s.customization.name+" has been updated!":""})}).catch(function(e){n.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 t=["png","jpg"];if(!_.includes(t,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+t.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var n={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.customization.images.unshift(n),!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(t,e){if(t.id===a.uniqueIdentifier){var n=new FileReader;n.readAsDataURL(t.file.file),n.onload=function(e){t.url=e.target.result},t.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 t=["png","jpg"];if(!_.includes(t,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+t.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var n={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.customization.images.unshift(n),!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(t,e){if(t.id===a.uniqueIdentifier){var n=new FileReader;n.readAsDataURL(t.file.file),n.onload=function(e){t.url=e.target.result},t.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 t=["png","jpg"];if(!_.includes(t,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+t.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var n={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.customization.images.unshift(n),!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(t,e){if(t.id===a.uniqueIdentifier){var n=new FileReader;n.readAsDataURL(t.file.file),n.onload=function(e){t.url=e.target.result},t.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,t,n,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:10,phoneBarAutoUpdater:!0,phoneBarAutoUpdaterUrl:"https://www.xcally.com/bar/phonebar/autoupdater.xml",splitSizeCsv:5e3,splitSizePdf:1e3,splitSizeXlsx:5e3,messagesAlignment:"alternate",phoneBarRememberMeEnabled:!0},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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.generals,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The general will be deleted.").ariaLabel("Delete General").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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","generals","general","api","Auth","license","setting","crudPermissions"],angular.module("app.settings").controller("CreateOrEditGeneralDialogController",e)}(),function(){"use strict";function e(e,t,n,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]),s.saveGeneral=function(){s.general.id?t.setting.update({id:s.general.id},s.general).$promise.then(function(){n.success({title:"General updated!",msg:s.general.name?s.general.name+" has been updated!":""})}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsetting",msg:e.data?JSON.stringify(e.data):e.toString()})}):t.setting.save(s.general).$promise.then(function(e){_.merge(s.general,e),n.success({title:"General updated!",msg:s.general.name?s.general.name+" has been updated!":""})}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsetting",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["generals","api","toasty","license","Auth"],angular.module("app.settings").controller("GeneralsController",e)}(),function(){"use strict";function e(t,n,a,i,e,s){var o=this;o.license=i||{},o.agents=0,o.users=0,o.telephones=0,o.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"}],o.modules=[{name:"cm",icon:"icon-account-circle"},{name:"dialer",icon:"icon-crosshairs"},{name:"jscripty",icon:"icon-console"}],o.addons=[{name:"webrtc",icon:"icon-server-plus"},{name:"jaws",icon:"icon-fish"},{name:"custom",icon:"icon-table-edit"}],o.sessions=[{name:"callysquare",icon:"icon-sitemap",restart:!0,label:"channels",enabled:"voice"},{name:"virtual",icon:"icon-dots-horizontal",restart:!1,label:"sessions",enabled:"chat"}],o.others=[{name:"update",icon:"icon-cloud-download"}],o.requestLicense=function(e){n.show({controller:"RequestLicenseDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/license/request/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{license:i,channels:o.channels,modules:o.modules,addons:o.addons,sessions:o.sessions,others:o.others}})},o.updateLicense=function(e){n.show({controller:"UpdateLicenseDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/license/update/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{license:i}})},o.gotoProcess=function(e){a.go("app.settings.system",{tab:1})},s.user.get({fields:"id",role:"agent",online:!0}).$promise.then(function(e){return o.agents=e&&e.count?e.count:0,s.user.get({fields:"id",role:"user,admin"}).$promise}).then(function(e){return o.users=e&&e.count?e.count:0,s.user.get({fields:"id",role:"telephone"}).$promise}).then(function(e){o.telephones=e&&e.count?e.count:0}).catch(function(e){console.log(e)})}e.$inject=["$document","$mdDialog","$state","license","toasty","api"],angular.module("app.settings.license").controller("LicenseController",e)}(),function(){"use strict";function e(e,t,n,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(n),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)&&(n[e]===m.license[e]?m.table+="|"+e+"|"+(void 0!==n[e]?n[e]:"")+"|"+m.license[e]+"|\n":m.table+="|"+e+"|{color:red}"+(void 0!==n[e]?n[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){t.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,t,n,a,i){var s=this;s.errors=[],s.license=angular.copy(n),s.licenseKey,s.updateLicense=function(){return a.license.update({id:1,key:s.licenseKey}).$promise.then(function(e){e&&(e.demo?t.error({title:"License update failed!",msg:"Invalid license key"}):t.success({title:"License properly updated!",msg:"The license has been updated!"}))}).catch(function(e){t.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,t,n,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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(p.networks,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The network will be deleted.").ariaLabel("Delete Network").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v){var h=this;h.license=p,h.setting=g,h.currentUser=u.getCurrentUser(),h.networks=l||{count:0,rows:[]},h.table="networks",h.listOrder="",h.listOrderAsc=null,h.selectedNetworks=[],h.query={fields:"createdAt,updatedAt,id,type,value",sort:"-updatedAt",limit:10,page:1},h.arraytype=_.keyBy([{option:"LocalNET",value:"'localnet'"},{option:"ExternIP",value:"'externip'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),h.editdialog=function(e,t){i.show({controller:"CreateOrEditNetworkDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/networks/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{network:e,networks:h.networks.rows,license:h.license,setting:null,crudPermissions:h.crudPermissions}})},h.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){A(e)},function(){console.log("CANCEL")})},h.success=E,h.getNetworks=function(){h.query.offset=(h.query.page-1)*h.query.limit,u.hasRole("admin")?h.promise=d.network.get(h.query,E).$promise:(h.query.id=h.userProfile.id,h.query.section="Networks",h.promise=d.userProfile.getResources(h.query,E).$promise)},h.createOrEditNetwork=function(e,t){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:t,networks:h.networks.rows,license:h.license,setting:h.setting,crudPermissions:h.crudPermissions}})},h.deleteNetwork=A,h.exportSelectedNetworks=function(){var e=angular.copy(h.selectedNetworks);return h.selectedNetworks=[],e},h.deleteSelectedNetworks=function(e){var t=i.confirm().title("Are you sure want to delete the selected networks?").htmlContent("<b>"+h.selectedNetworks.length+" selected</b> will be deleted.").ariaLabel("delete Networks").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){h.selectedNetworks.forEach(function(e){A(e)}),h.selectedNetworks=[]})},h.deselectNetworks=function(){h.selectedNetworks=[]},h.selectAllNetworks=function(){h.selectedNetworks=h.networks.rows};var f=!0,b=1;function E(e){h.networks=e||{count:0,rows:[]}}function A(e){d.network.delete({id:e.id}).$promise.then(function(){_.remove(h.networks.rows,{id:e.id}),h.networks.count-=1,h.networks.rows.length||h.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){h.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEnetwork"}];for(var t=0;t<e.data.errors.length;t++)m.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){f?o(function(){f=!1}):(t||(b=h.query.page),e!==t&&(h.query.page=1),e||(h.query.page=b),h.getNetworks())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","networks","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.settings").controller("NetworksController",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(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_SMTP",g.smtp=angular.copy(l),g.smtps=r,g.newSmtp=!1,g.smtp||(g.smtp={service:!0},g.title="SETTINGS.NEW_SMTP",g.newSmtp=!0),g.addNewSmtp=function(){g.errors=[],d.mailAccount.save(g.smtp).$promise.then(function(e){g.smtps.unshift(e.toJSON()),o.success({title:"Smtp properly created",msg:g.smtp.name?g.smtp.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.mailAccount.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSmtp=function(){g.errors=[],d.mailAccount.update({id:g.smtp.id},g.smtp).$promise.then(function(e){var t=_.find(g.smtps,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"Smtp properly saved!",msg:g.smtp.name?g.smtp.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.mailAccount.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSmtp=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The smtp will be deleted.").ariaLabel("Delete Smtp").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.mailAccount.delete({id:g.smtp.id}).$promise.then(function(){_.remove(g.smtps,{id:g.smtp.id}),o.success({title:"Smtp properly deleted!",msg:(g.smtp.name||"smtp")+" has been deleted!"}),v(g.smtp)}).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.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.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","smtps","smtp","api","Auth","license","setting","crudPermissions"],angular.module("app.settings").controller("CreateOrEditSmtpDialogController",e)}(),function(){"use strict";function e(e,t,n,a,i){var s=this;s.currentUser=i.getCurrentUser(),s.license=a,s.smtps=e,s.smtp={},s.smtps&&s.smtps.rows&&s.smtps.rows.length?s.smtp=s.smtps.rows[0]:s.smtp={service:!0,Smtp:{service:null}},s.saveSmtp=function(){s.smtp.id?t.mailAccount.update({id:s.smtp.id},s.smtp).$promise.then(function(){n.success({title:"Smtp updated!",msg:s.smtp.name?s.smtp.name+" has been updated!":""})}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data):e.toString()})}):t.mailAccount.save(s.smtp).$promise.then(function(e){_.merge(s.smtp,e),n.success({title:"Smtp updated!",msg:s.smtp.name?s.smtp.name+" has been updated!":""})}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})},s.verifySmtp=function(){s.smtp.id&&t.mailAccount.verifySmtp({id:s.smtp.id}).$promise.then(function(){n.success({title:"Smtp verified!",msg:s.smtp.name?s.smtp.name+" has been verified!":""})}).catch(function(e){n.error({title:"Smtp not verified! Remember to save before to verify!",msg:e.data?JSON.stringify(e.data):e.toString(),timeout:1e4})})}}e.$inject=["smtps","api","toasty","license","Auth"],angular.module("app.settings").controller("SmtpController",e)}(),function(){"use strict";function e(e,i,s,t,n,a,o,r){var l,d=this;d.system=n||{},d.processes=a?a.rows:[],d.processLimit=7,d.selectedTab=t.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,t,n){var a=s.confirm().title("Would you like to change the status of the process #"+t+"?").textContent("The status will be changed to: "+n.toUpperCase()).ariaLabel("Lucky day").targetEvent(e).ok("Ok").cancel("Cancel");s.show(a).then(function(){return r.pm2.update({id:t,status:n})}).then(function(){i(d.getProcesses,1e3,1)}).then(function(){o.success({title:"Process updated!",msg:"Status properly changed to: "+n})})},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,t,n,a,i){var s=this;s.title="SETTINGS.UPDATE",s.progress=0,s.updating=!0,s.output="Waiting...",s.success=!0,s.interval=t(function(){s.progress<90&&(s.progress+=1)},1e3),s.closeDialog=function(){e.hide()},s.reload=function(){n.location.reload()},s.stopInterval=function(){angular.isDefined(s.interval)&&(t.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(n,e,a,t,i){this.version=t||{},this.updateConfirm=function(e){var t=n.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");n.show(t).then(function(){n.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,o,t,n,a,i,s,r,l,d,c,m,u,p,g,v,h,f){var b=this,E=["userpic","online","lastLoginAt","lastPauseAt","pauseType","lastPauseAt","internal","address","chatPause","openchannelPause","mailPause","smsPause","faxPause","voicePause","chatCapacity","openchannelCapacity","mailCapacity","smsCapacity","faxCapacity","chatCurrentCapacity","openchannelCurrentCapacity","mailCurrentCapacity","smsCurrentCapacity","faxCurrentCapacity","chatStatus","openchannelStatus","mailStatus","smsStatus","faxStatus","voiceStatus","chatStatusTime","openchannelStatusTime","mailStatusTime","smsStatusTime","faxStatusTime","voiceStatusTime","queue","destconnectedlinenum","onhold"],A=["chatPause","openchannelPause","mailPause","smsPause","faxPause","voicePause","online"];for(var y in b.currentUser=v.getCurrentUser(),b.availableStates=["ringing","inuse","busy","onhold","not_inuse"],b.pauses=s||{count:0,rows:[]},b.license=h,b.userProfile=p,b.userProfileSection=g&&1==g.count?g.rows[0]:null,b.crudPermissions=v.parseCrudPermissions(b.userProfileSection?b.userProfileSection.crudPermissions:null),b.agents=r?_.keyBy(r.rows?r.rows:[],"id"):{},b.rpcAgents=l?_.keyBy(l.rows?l.rows:[],"id"):{},b.paginatedAgents={},b.load=!1,b.order=[],b.agentInternal={},b.agents)b.agents.hasOwnProperty(y)&&(b.agents[y].init=!0);b.query={limit:10,page:1,order:"fullname",globalStatusFilter:"",pauseTypeFilter:""},b.logout=function(e,t){return d.user.logout({id:e.id,device:"realtime",agent_id:e.id,agent_name:e.name}).$promise.then(function(){m.success({title:"Agent logout",msg:e.fullname+"  properly logout"}),b.agents[e.id]&&(b.agents[e.id].online=!1),b.rpcAgents[e.id]&&(b.rpcAgents[e.id].online=!1),T()}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.queueAdd=function(e,t){n.show({controller:"AgentqueueaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/queueadd/queueadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{agent:e,agents:[],channel:"sms",direction:"inbound",crudPermissions:b.crudPermissions}})},b.pause=function(t,e){return d.user.pause({id:t.id,type:e}).$promise.then(function(e){b.agents[t.id]&&_.merge(b.agents[t.id],_.pick(e,E)),b.rpcAgents[t.id]&&_.merge(b.rpcAgents[t.id],_.pick(e,E)),O(b.agents[t.id])}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.unPause=function(t){return d.user.unpause({id:t.id}).$promise.then(function(e){b.agents[t.id]&&_.merge(b.agents[t.id],_.pick(e,E)),b.rpcAgents[t.id]&&_.merge(b.rpcAgents[t.id],_.pick(e,E)),O(b.agents[t.id])}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.showInfo=function(e){n.show(n.alert().clickOutsideToClose(!0).title("Legend").htmlContent("<div>TODO legend status + state</div>").ok("Ok").targetEvent(e))},b.getAgentStatus=w,b.getAgentGlobalStatus=O,b.isPause=I,b.checkPause=function(e){return"pause"===e},b.isPartialPause=function(e){return"*pause"===e},b.onSave=function(e){b.agents[e.id]&&(_.merge(b.agents[e.id],_.pick(_.omit(e,A),E)),_.merge(b.rpcAgents[e.id],_.pick(_.omit(e,A),E)),O(b.agents[e.id]))},b.onUpdate=function(e){b.agents[e.id]&&(_.merge(b.agents[e.id],_.pick(e,E)),_.merge(b.rpcAgents[e.id],_.pick(e,E)),e.lastPauseAt&&(b.agents[e.id].globalStatusTime=e.lastPauseAt,b.rpcAgents[e.id].globalStatusTime=e.lastPauseAt),O(b.agents[e.id]))},b.onInit=T,b.onConnect=function(e){b.agents[b.agentInternal[e.destaccountcode]]&&(_.merge(b.agents[b.agentInternal[e.destaccountcode]],_.pick(e,["queue","destconnectedlinenum"])),_.merge(b.rpcAgents[b.agentInternal[e.destaccountcode]],_.pick(e,["queue","destconnectedlinenum"])))},b.onComplete=function(e){b.agents[b.agentInternal[e.destaccountcode]]&&(b.agents[b.agentInternal[e.destaccountcode]]=_.omit(b.agents[b.agentInternal[e.destaccountcode]],["queue","destconnectedlinenum"]),b.rpcAgents[b.agentInternal[e.destaccountcode]]=_.omit(b.rpcAgents[b.agentInternal[e.destaccountcode]],["queue","destconnectedlinenum"]))},c.on("user:save",b.onSave),c.on("user:update",b.onUpdate),c.on("user:agentconnect",b.onConnect),c.on("user:agentcomplete",b.onComplete),T();var S=f(function(){b.load&&(b.load=!1,T())},999);function T(e){b.load=!1;var t,n,a=o.defer();b.promise=a.promise,b.filteredAgents=[],b.order=[],_.forIn(b.agents,function(e,t){b.rpcAgents[t]&&_.merge(e,_.pick(_.omit(b.rpcAgents[t],A),E)),O(e),e.online?(b.filteredAgents.push(e),b.agentInternal[e.internal]=t):e.globalStatusTime=_.toNumber(moment().format("x"))}),b.query.globalStatusFilter&&_.remove(b.filteredAgents,function(e){return e.globalStatus!==b.query.globalStatusFilter}),b.query.pauseTypeFilter&&_.remove(b.filteredAgents,function(e){return e.pauseType!==b.query.pauseTypeFilter}),b.query.filter&&_.remove(b.filteredAgents,function(e){return e.fullname.toLowerCase().indexOf(b.query.filter.toLowerCase())<0}),b.filteredAgents=(t=b.filteredAgents,n=_.startsWith(b.query.order,"-")?"desc":"asc",_.orderBy(t,[b.query.order.replace("-","")],[n]));var i=(b.query.page-1)*b.query.limit;b.paginatedAgents=_.drop(b.filteredAgents,i).slice(0,b.query.limit);for(var s=0;s<b.paginatedAgents.length;s+=1)b.order.push(b.paginatedAgents[s].id);a.resolve(),b.load=!0}function I(e){return"pause"===e||"*pause"===e}function C(e){return"idle"===e||"unknown"===e||"unavailable"===e||"ringing"===e||_.isNil(e)}function w(e,t){return"voice"===t?"idle"!==e[t+"Status"]?e[t+"Status"]:e[t+"Pause"]?e[t+"Status"]="pause":"idle":e[t+"Pause"]?e[t+"Status"]="pause":e[t+"Status"]}function O(e){var t="unknown";t=_.every([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],I)?"pause":_.some([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],I)?"*pause":_.every([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],C)?"idle":"busy",e.globalStatus!==t&&(e.globalStatus=t,e.init?(e.init=!1,e.globalStatusTime=I(t)?_.toNumber(moment(e.lastPauseAt).format("x")):_.max([e.voiceStatusTime,e.chatStatusTime,e.mailStatusTime,e.smsStatusTime,e.openchannelStatusTime,e.faxStatusTime])):e.globalStatusTime=_.toNumber(moment().format("x")))}e.$on("$destroy",function(){c.removeAllListeners("user:save"),c.removeAllListeners("user:update"),c.removeAllListeners("user:agentconnect"),c.removeAllListeners("user:agentcomplete"),S&&(f.cancel(S),S=null)})}e.$inject=["$scope","$q","$timeout","$mdDialog","$document","$filter","pauses","agents","rpcAgents","api","socket","toasty","helperClasses","userProfile","userProfileSection","Auth","license","$interval"],angular.module("app.voice").controller("AgentsSmsRealtimeController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this,v=["loggedIn","available","waiting","talking","pTalking","originated","message","dialActive","dialMethod","Trunk","paused"];function h(){var n=[];return _.forIn(g.queues,function(e,t){e.paused=0,e.loggedInDb=0,g.queues[t].agents={},n.push(l.smsQueue.getMembers({id:t}).$promise),g.rpcQueues[t]&&_.merge(e,_.pick(g.rpcQueues[t],v))}),t.all(n).then(function(e){for(var t=0;t<e.length;t+=1)for(var n=0;n<e[t].rows.length;n++)e[t].rows[n].paused&&g.queues[e[t].rows[n].SmsQueueId].paused++,g.queues[e[t].rows[n].SmsQueueId].loggedInDb++,g.queues[e[t].rows[n].SmsQueueId].agents[e[t].rows[n].UserId]=e[t].rows[n].SmsQueueId}).catch(function(e){console.error(e)})}g.currentUser=p.getCurrentUser(),g.count=o.count?o.count:0,g.queues=o?_.keyBy(o.rows?o.rows:[],"id"):{},g.rpcQueues=r?_.keyBy(r.rows?r.rows:[],"id"):{},g.userProfile=m,g.userProfileSection=u&&1==u.count?u.rows[0]:null,g.crudPermissions=p.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),p.hasRole("admin")?g.query={type:"inbound",sort:"-updatedAt",limit:10,page:1}:g.query={id:g.currentUser.id,channel:"sms",type:"inbound",sort:"-updatedAt",limit:10,page:1},g.success=E,g.getQueues=function(){g.query.offset=(g.query.page-1)*g.query.limit,p.hasRole("admin")?g.promise=l.smsQueue.get(g.query,E).$promise:(g.query.id=g.userProfile.id,g.query.section="SmsQueues",g.promise=l.userProfile.getResources(g.query,E).$promise)},g.createOrEditSmsQueue=function(e,t){a.show({controller:"CreateOrEditSmsQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsQueue:t,smsQueues:_.values(g.queues),license:null,setting:null,crudPermissions:g.crudPermissions}})},g.agentAdd=function(e,t){a.show({controller:"SmsQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsQueue:t,smsQueues:g.queues?g.queues.rows:[],realtime:!1,crudPermissions:g.crudPermissions}})},g.updateQueue=function(e){return l.smsQueue.update(e).$promise.then(function(){c.success({title:"Queue properly updated!",msg:e.name?e.name+" has been updated!":""})}).catch(function(e){c.error({title:"Error creating queue!",msg:e.message})})},g.onSave=function(e){g.queues[e.id]&&_.merge(g.queues[e.id],_.pick(e,v))},g.onSaveMember=function(e){g.queues[e.SmsQueueId]&&g.queues[e.SmsQueueId].loggedInDb++},g.onRemoveMember=function(e){g.queues[e.SmsQueueId]&&g.queues[e.SmsQueueId].loggedInDb--},g.onPause=function(n){console.log("onPause",n),n.voicePause?_.forIn(g.queues,function(e,t){e.agents[n.id]&&(e.paused+=1,console.log("pause"))}):n.voicePause||_.forIn(g.queues,function(e,t){e.agents[n.id]&&0<e.paused&&(e.paused-=1,console.log("unpause"))})},g.onLogin=function(e){console.log("onLogged",e),g.queues[e.SmsQueueId]&&(g.queues[e.SmsQueueId].loggedInDb+=1,g.queues[e.SmsQueueId].agents[e.UserId]=e.SmsQueueId)},g.onLogout=function(e){console.log("onLogout",e),g.queues[e.SmsQueueId]&&0<g.queues[e.SmsQueueId].loggedInDb&&(g.queues[e.SmsQueueId].loggedInDb-=1,delete g.queues[e.SmsQueueId].agents[e.UserId])},g.$onInit=h,g.order=[],_.forIn(g.queues,function(e,t){g.order.push(e.id)}),d.on("sms_queue:save",g.onSave),d.on("userSmsQueue:save",g.onSaveMember),d.on("userSmsQueue:remove",g.onRemoveMember),d.on("user:update",g.onPause),d.on("userVoiceQueue:remove",g.onLogout),d.on("userVoiceQueue:save",g.onLogin);var f=!0,b=1;function E(e){if(g.count=e.count,g.queues=e?_.keyBy(e.rows?e.rows:[],"id"):{},e.rows){g.order=[];for(var t=0;t<e.rows.length;t++)g.order.push(e.rows[t].id)}h()}e.$watch("vm.query.filter",function(e,t){f?n(function(){f=!1}):(t||(b=g.query.page),e!==t&&(g.query.page=1),e||(g.query.page=b),g.getQueues())}),e.$on("$destroy",function(){d.removeAllListeners("sms_queue:save"),d.removeAllListeners("userSmsQueue:remove"),d.removeAllListeners("userSmsQueue:save"),d.removeAllListeners("user:update"),d.removeAllListeners("userVoiceQueue:remove"),d.removeAllListeners("userVoiceQueue:save")})}e.$inject=["$scope","$timeout","$mdDialog","$q","$document","$interval","queues","rpcQueues","api","socket","toasty","userProfile","userProfileSection","Auth"],angular.module("app.sms").controller("QueuesSmsRealtimeController",e)}(),function(){"use strict";angular.module("app.auth").factory("helperClasses",function(){return{status:{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"},state:{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"},channelStatus:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},channelStatusOut:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"}}})}(),function(){"use strict";function e(e,n,t){switch(t.disconnect(),t.connect(),this.selectedTab=0,n.current.name){case"app.sms.realtime.agents":this.selectedTab=0;break;case"app.sms.realtime.queues":this.selectedTab=1;break;default:this.selectedTab=0,n.go("app.sms.realtime.agents")}e.$watch("vm.selectedTab",function(e,t){if(e!==t)switch(e){case 0:n.go("app.sms.realtime.agents");break;case 1:n.go("app.sms.realtime.queues");break;default:n.go("app.sms.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.sms").controller("SmsRealtimeController",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(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:n.protocol()+"://"+n.host()+(n.port()?":"+n.port():""),type:"twilio",waitForTheAssignedAgent:10,notificationSound:!0,queueTransferTimeout:300,agentTransferTimeout:300},g.title="SMS.NEW_SMSACCOUNT",g.newSmsAccount=!0),t.params.id&&(g.smsAccount.SmsAccountId=t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.smsAccounts,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The smsAccount will be deleted.").ariaLabel("Delete SmsAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.lists,{id:e.resourceId})}),n=null;if(g.smsAccount&&(n=_.find(g.lists,{id:Number(g.smsAccount.ListId)})),n&&!_.some(t,["id",n.id])){var a=_.find(g.lists,{id:n.id});a.canSelect=!1,t.push(a)}g.lists=t})}else{var n=[],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,n.push(g.lists[i]));g.lists=n}}).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 t(e,t){if(r.smsAccountApps.rows.length){var n=r.smsAccountApps.rows[t]?r.smsAccountApps.rows[t]:r.smsAccountApps.rows[0];i.show({controller:"EditSmsAccountApp"+(n.appType||n.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/apps/"+(n.appType||n.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsAccountApp:n,smsAccount:r.smsAccount,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.smsAccountApps.rows[t]=e:r.smsAccountApps.rows.splice(t,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,t=[],n=0;n<r.smsAccountApps.rows.length;n++,0){var a=r.smsAccountApps.rows[n],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,t=_.concat(t,i,[a],s)}o.smsAccount.addApplications({id:r.smsAccount.id},_.sortBy(t,"priority")).$promise.then(function(e){r.smsAccountApps.rows=e.rows}).catch(function(e){console.error(e)})}function n(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:"1"},{option:"Always",value:"0"}],required:!0,param:0},{title:"Text",name:"text",type:"textarea",maxlength:255,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){t(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,t){r.smsAccount=e,r.crudPermissions=void 0!==t?t:{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,t,n){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(n).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.smsAccountApps.rows.splice(t,1),l()},function(){console.log("CANCEL")})},r.getSmsAccountApps=function(){r.promise=o.smsAccount.getApplications(r.query,n).$promise},r.editSmsAccountApp=t,r.editInterval=function(e,t){if(r.smsAccountApps.rows.length){var n=r.smsAccountApps.rows[t]?r.smsAccountApps.rows[t]: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:n.interval,IntervalId:n.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(n.interval=e.interval||"*,*,*,*",n.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 t=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(t).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,t,n,o,r,l,d){var c=this;function m(){return a(function(n,t){return a(function(t,n){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.smsAccount.getAgents({id:c.smsAccount.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return t.penalty=e.UserSmsAccount?"penalty "+e.UserSmsAccount.penalty:"",t.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=l.getCurrentUser(),c.smsAccount=t,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(n,t){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.smsAccount.removeAgents({id:c.smsAccount.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.smsAccount.addAgents({id:c.smsAccount.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,items:[],selectedItems:[],showSelectAndDeselectAll:!o,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("SMS.ALL_AGENTS"),labelSelected:r.instant("SMS.SELECTED_AGENTS"),transferCallback:function(e,t){var n=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(n)}}}e.$inject=["$mdDialog","$q","toasty","api","smsAccount","smsAccounts","realtime","$translate","Auth","crudPermissions"],angular.module("app.sms").controller("SmsAccountagentaddController",e)}(),function(){"use strict";function e(t,e,n,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"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){t.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 t=_.find(l.agents,{name:l.agent.agent});t&&(l.agent.UserId=t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),n=null;if(l.agent&&(n=_.find(l.agents,{name:l.agent.agent})),n&&!_.some(t,["id",n.id])){var a=_.find(l.agents,{id:n.id});a.canSelect=!1,t.push(a)}l.agents=t})}else{var n=[],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,n.push(l.agents[i]));l.agents=n}}).catch(function(e){n.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(t,e,n,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"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){t.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(t,e,n,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"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){t.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(t,e,n,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"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){t.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(t,e,n,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"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){t.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,t,n,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 E(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var t=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),n=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(t+"-"+n)}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 A(e){t.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=E(),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!":""}),A()}).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=E(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),A(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var t=_.find(c.intervals,{id:e.id});t&&_.merge(t,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),A()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=A,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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=e&&e.rows?e.rows:[],n=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(t,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,n.push(e))}),c.intervals=n})}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(t,e,n,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"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){t.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(t,e,n,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"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){t.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 t=_.find(l.queues,{name:l.queue.queue});t&&(l.queue[_.capitalize("sms")+"QueueId"]=t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),n=null;if(l.queue&&(n=_.find(l.queues,{name:l.queue.queue})),n&&!_.some(t,["id",n.id])){var a=_.find(l.queues,{id:n.id});a.canSelect=!1,t.push(a)}l.queues=t})}else{var n=[],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,n.push(l.queues[i]));l.queues=n}}).catch(function(e){n.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(t,e,n,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"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){t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),n=null;if(l.system&&(n=_.find(l.variables,{name:l.system.variable})),n&&!_.some(t,["id",n.id])){var a=_.find(l.variables,{id:n.id});a.canSelect=!1,t.push(a)}l.variables=t})}else{var n=[],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,n.push(l.variables[i]));l.variables=n}}).catch(function(e){n.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(t,e,n,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"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){t.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 t=_.find(l.tags,{name:l.tag.tag});t&&(l.tag.TagId=t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),n=null;if(l.tag&&(n=_.find(l.tags,{name:l.tag.tag})),n&&!_.some(t,["id",n.id])){var a=_.find(l.tags,{id:n.id});a.canSelect=!1,t.push(a)}l.tags=t})}else{var n=[],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,n.push(l.tags[i]));l.tags=n}}).catch(function(e){n.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,t,n,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.smsAccount={},c.smsAccountInteractions={count:0,rows:[]},c.selectedSmsAccountInteractions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,Contact.firstName,Owner.name,closedAt,disposition,note,UserId,ContactId,SmsAccountId,tag",sort:"-createdAt",includeAll:"true",limit:10,page:1},c.init=function(e,t){c.smsAccount=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.smsAccount.id,c.getSmsAccountInteractions()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.smsInteractionDownload=function(s,e,t){return l.smsInteraction.download({id:s.id,exists:!0,attachments:t}).$promise.then(function(e){var t=[e.buffer],n="interaction"+s.id,a=new Blob(t,{type:e.type});n="sms-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.success=p,c.getSmsAccountInteractions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.smsAccount.getInteractions(c.query,p).$promise},c.createOrEditSmsAccountInteraction=function(e,t){s.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/interactions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsAccount:c.smsAccount,interaction:t,interactions:c.smsAccountInteractions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.spysmsInteraction=function(e,n){s.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,t){e.vm.init({id:1,channel:"sms",interaction:n,spy:!0},a.$parent.vm.setting)}})},c.exportSelectedSmsAccountInteractions=function(){var e=angular.copy(c.selectedSmsAccountInteractions);return c.selectedSmsAccountInteractions=[],e},c.deleteSmsAccountInteraction=g,c.deleteSelectedSmsAccountInteractions=function(e){var t=s.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+c.selectedSmsAccountInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedSmsAccountInteractions.forEach(function(e){g(e)}),c.selectedSmsAccountInteractions=[]})};var m=!0,u=1;function p(e){c.smsAccountInteractions=e||{count:0,rows:[]}}function g(e){l.smsInteraction.delete({id:e.id}).$promise.then(function(){_.remove(c.smsAccountInteractions.rows,{id:e.id}),c.smsAccountInteractions.count-=1,c.smsAccountInteractions.rows.length||c.getSmsAccountInteractions(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETsmsAccount"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}a.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getSmsAccountInteractions())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.sms").controller("SmsAccountInteractionsController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.smsAccount={},c.smsAccountSmsCannedAnswers={count:0,rows:[]},c.selectedSmsAccountSmsCannedAnswers=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,key,value,description",limit:10,page:1},c.init=function(e,t){c.smsAccount=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.smsAccount.id,c.query.SmsAccountId=c.smsAccount.id,c.getSmsAccountSmsCannedAnswers()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the smsCannedAnswer?").htmlContent("<b>"+(e.name||"smsCannedAnswer")+"</b> will be deleted.").ariaLabel("delete smsCannedAnswer").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getSmsAccountSmsCannedAnswers=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.smsAccount.getAnswers(c.query,p).$promise},c.createOrEditSmsAccountSmsCannedAnswer=function(e,t){s.show({controller:"CreateOrEditSmsCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/smsCannedAnswers/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsAccount:c.smsAccount,smsCannedAnswer:t,smsCannedAnswers:c.smsAccountSmsCannedAnswers.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedSmsAccountSmsCannedAnswers=function(){var e=angular.copy(c.selectedSmsAccountSmsCannedAnswers);return c.selectedSmsAccountSmsCannedAnswers=[],e},c.deleteSmsAccountSmsCannedAnswer=g,c.deleteSelectedSmsAccountSmsCannedAnswers=function(e){var t=s.confirm().title("Are you sure want to delete the selected smsCannedAnswers?").htmlContent("<b>"+c.selectedSmsAccountSmsCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete smsCannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedSmsAccountSmsCannedAnswers.forEach(function(e){g(e)}),c.selectedSmsAccountSmsCannedAnswers=[]})};var m=!0,u=1;function p(e){c.smsAccountSmsCannedAnswers=e||{count:0,rows:[]}}function g(e){l.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(c.smsAccountSmsCannedAnswers.rows,{id:e.id}),c.smsAccountSmsCannedAnswers.count-=1,c.smsAccountSmsCannedAnswers.rows.length||c.getSmsAccountSmsCannedAnswers(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETsmsAccount"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getSmsAccountSmsCannedAnswers())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.sms").controller("SmsAccountSmsCannedAnswersController",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(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),t.params.id&&(g.smsCannedAnswer.SmsAccountId=t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.smsCannedAnswers,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The smsCannedAnswer will be deleted.").ariaLabel("Delete SmsCannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.smsAccount={},c.smsAccountSmsDispositions={count:0,rows:[]},c.selectedSmsAccountSmsDispositions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,name",limit:10,page:1},c.init=function(e,t){c.smsAccount=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.smsAccount.id,c.query.SmsAccountId=c.smsAccount.id,c.getSmsAccountSmsDispositions()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the smsDisposition?").htmlContent("<b>"+(e.name||"smsDisposition")+"</b> will be deleted.").ariaLabel("delete smsDisposition").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getSmsAccountSmsDispositions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.smsAccount.getDispositions(c.query,p).$promise},c.createOrEditSmsAccountSmsDisposition=function(e,t){s.show({controller:"CreateOrEditSmsDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/smsDispositions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsAccount:c.smsAccount,smsDisposition:t,smsDispositions:c.smsAccountSmsDispositions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedSmsAccountSmsDispositions=function(){var e=angular.copy(c.selectedSmsAccountSmsDispositions);return c.selectedSmsAccountSmsDispositions=[],e},c.deleteSmsAccountSmsDisposition=g,c.deleteSelectedSmsAccountSmsDispositions=function(e){var t=s.confirm().title("Are you sure want to delete the selected smsDispositions?").htmlContent("<b>"+c.selectedSmsAccountSmsDispositions.length+" selected</b> will be deleted.").ariaLabel("delete smsDispositions").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedSmsAccountSmsDispositions.forEach(function(e){g(e)}),c.selectedSmsAccountSmsDispositions=[]})};var m=!0,u=1;function p(e){c.smsAccountSmsDispositions=e||{count:0,rows:[]}}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){_.remove(c.smsAccountSmsDispositions.rows,{id:e.id}),c.smsAccountSmsDispositions.count-=1,c.smsAccountSmsDispositions.rows.length||c.getSmsAccountSmsDispositions(),r.success({title:"SmsDisposition deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETsmsAccount"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getSmsAccountSmsDispositions())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.sms").controller("SmsAccountSmsDispositionsController",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(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_SMSDISPOSITION",g.smsDisposition=angular.copy(l),g.smsDispositions=r,g.newSmsDisposition=!1,g.smsDisposition||(g.smsDisposition={},g.title="SMS.NEW_SMSDISPOSITION",g.newSmsDisposition=!0),t.params.id&&(g.smsDisposition.SmsAccountId=t.params.id),g.addNewSmsDisposition=function(){g.errors=[],d.disposition.save(g.smsDisposition).$promise.then(function(e){g.smsDispositions.unshift(e.toJSON()),o.success({title:"SmsDisposition properly created",msg:g.smsDisposition.name?g.smsDisposition.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.disposition.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSmsDisposition=function(){g.errors=[],d.disposition.update({id:g.smsDisposition.id},g.smsDisposition).$promise.then(function(e){var t=_.find(g.smsDispositions,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"SmsDisposition properly saved!",msg:g.smsDisposition.name?g.smsDisposition.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.disposition.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSmsDisposition=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The smsDisposition will be deleted.").ariaLabel("Delete SmsDisposition").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.disposition.delete({id:g.smsDisposition.id}).$promise.then(function(){_.remove(g.smsDispositions,{id:g.smsDisposition.id}),o.success({title:"SmsDisposition properly deleted!",msg:(g.smsDisposition.name||"smsDisposition")+" has been deleted!"}),v(g.smsDisposition)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.disposition.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.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","smsDispositions","smsDisposition","api","Auth","license","setting","crudPermissions"],angular.module("app.sms").controller("CreateOrEditSmsDispositionDialogController",e)}(),function(){"use strict";function e(e,t,n,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=t.protocol()+"://"+t.host(),u.smsAccount=c||e.params.smsAccount||{},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.agentadddialog=function(e,t){n.show({controller:"SmsAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{smsAccount:e,smsAccounts:u.smsAccounts?u.smsAccounts.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoSmsAccounts=function(){e.go("app.sms.smsAccounts")},u.saveSmsAccount=function(){r.smsAccount.update({id:u.smsAccount.id},u.smsAccount).$promise.then(function(){l.success({title:"SmsAccount updated!",msg:u.smsAccount.name?u.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){u.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){u.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.lists,{id:e.resourceId})}),n=null;if(u.smsAccount&&(n=_.find(u.lists,{id:Number(u.smsAccount.ListId)})),n&&!_.some(t,["id",n.id])){var a=_.find(u.lists,{id:n.id});a.canSelect=!1,t.push(a)}u.lists=t})}else{var n=[],a=null;u.smsAccount&&(a=_.find(u.lists,{id:Number(u.smsAccount.ListId)}));for(var i=0;i<u.lists.length;i++)a&&u.lists[i].id===a.id&&(u.lists[i].canSelect=!1,n.push(u.lists[i]));u.lists=n}}).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){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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.pauses,{id:e.resourceId})});u.pauses.forEach(function(e){_.some(t,["id",e.id])||(e.canSelect=!1),t.push(e)}),u.pauses=t})}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","smsAccount","userProfileSection"],angular.module("app.sms").controller("SmsAccountController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.smsAccounts=l||{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="smsAccounts",b.listOrder="",b.listOrderAsc=null,b.selectedSmsAccounts=[],b.query={fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,type,phone,accountSid,authId,authToken,smsMethod,username,password,baseUrl,apiKey,senderString,deliveryReport,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,page:1},b.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:"CSCTelecom",value:"'csc'"},{option:"Intelepeer",value:"'intelepeer'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arraysmsMethod=_.keyBy([{option:"Basic",value:"'SI'"},{option:"Classic",value:"'TI'"},{option:"Classic+",value:"'GP'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.sms.smsAccounts.edit",{id:e.id,smsAccount:e,crudPermissions:b.crudPermissions})},b.interactionsgoto=function(e,t){n.go("app.sms.smsAccounts.edit",{id:e.id,tab:5})},b.agentadddialog=function(e,t){i.show({controller:"SmsAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{smsAccount:e,smsAccounts:b.smsAccounts?b.smsAccounts.rows:[],crudPermissions:b.crudPermissions,realtime:!1}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getSmsAccounts=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.smsAccount.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="SmsAccounts",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditSmsAccount=function(e,t){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:t,smsAccounts:b.smsAccounts.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteSmsAccount=S,b.exportSelectedSmsAccounts=function(){var e=angular.copy(b.selectedSmsAccounts);return b.selectedSmsAccounts=[],e},b.deleteSelectedSmsAccounts=function(e){var t=i.confirm().title("Are you sure want to delete the selected smsAccounts?").htmlContent("<b>"+b.selectedSmsAccounts.length+" selected</b> will be deleted.").ariaLabel("delete SmsAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedSmsAccounts.forEach(function(e){S(e)}),b.selectedSmsAccounts=[]})},b.deselectSmsAccounts=function(){b.selectedSmsAccounts=[]},b.selectAllSmsAccounts=function(){b.selectedSmsAccounts=b.smsAccounts.rows},g.hasRole("admin")?m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){b.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){b.lists=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(b.lists,{id:e.resourceId})}),n=null;if(b.smsAccount&&(n=_.find(b.lists,{id:Number(b.smsAccount.ListId)})),n&&!_.some(t,["id",n.id])){var a=_.find(b.lists,{id:n.id});a.canSelect=!1,t.push(a)}b.lists=t})}else{var n=[],a=null;b.smsAccount&&(a=_.find(b.lists,{id:Number(b.smsAccount.ListId)}));for(var i=0;i<b.lists.length;i++)a&&b.lists[i].id===a.id&&(b.lists[i].canSelect=!1,n.push(b.lists[i]));b.lists=n}}).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 E=!0,A=1;function y(e){b.smsAccounts=e||{count:0,rows:[]}}function S(e){m.smsAccount.delete({id:e.id}).$promise.then(function(){_.remove(b.smsAccounts.rows,{id:e.id}),b.smsAccounts.count-=1,b.smsAccounts.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEsmsAccount"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getSmsAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","smsAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.sms").controller("SmsAccountsController",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(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_SMSQUEUE",g.smsQueue=angular.copy(l),g.smsQueues=r,g.newSmsQueue=!1,g.smsQueue||(g.smsQueue={strategy:"beepall",timeout:10},g.title="SMS.NEW_SMSQUEUE",g.newSmsQueue=!0),g.addNewSmsQueue=function(){g.errors=[],d.smsQueue.save(g.smsQueue).$promise.then(function(e){g.smsQueues.unshift(e.toJSON()),o.success({title:"SmsQueue properly created",msg:g.smsQueue.name?g.smsQueue.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.smsQueue.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSmsQueue=function(){g.errors=[],d.smsQueue.update({id:g.smsQueue.id},g.smsQueue).$promise.then(function(e){var t=_.find(g.smsQueues,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"SmsQueue properly saved!",msg:g.smsQueue.name?g.smsQueue.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.smsQueue.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSmsQueue=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The smsQueue will be deleted.").ariaLabel("Delete SmsQueue").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.smsQueue.delete({id:g.smsQueue.id}).$promise.then(function(){_.remove(g.smsQueues,{id:g.smsQueue.id}),o.success({title:"SmsQueue properly deleted!",msg:(g.smsQueue.name||"smsQueue")+" has been deleted!"}),v(g.smsQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.smsQueue.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.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(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","smsQueues","smsQueue","api","Auth","license","setting","crudPermissions"],angular.module("app.sms").controller("CreateOrEditSmsQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,t,n,o,r,l,d){var c=this;function m(){return a(function(n,t){return a(function(t,n){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.smsQueue.getAgents({id:c.smsQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return t.penalty=e.UserSmsQueue?"penalty "+e.UserSmsQueue.penalty:"",t.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=l.getCurrentUser(),c.smsQueue=t,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(n,t){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.smsQueue.removeAgents({id:c.smsQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.smsQueue.addAgents({id:c.smsQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,items:[],selectedItems:[],showSelectAndDeselectAll:!o,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("SMS.ALL_AGENTS"),labelSelected:r.instant("SMS.SELECTED_AGENTS"),transferCallback:function(e,t){var n=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(n)}}}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,t,n,o,r){var l=this;function d(){return a(function(n,t){return a(function(t,n){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:l.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return l.allowedItems=_.map(t,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.startingAllowedItems=angular.copy(l.allowedItems),l.items.forEach(function(e){var t=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.smsQueue.getTeams({id:l.smsQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];l.selectedItems=_.map(t,function(e){return _.find(l.items,{id:e.id})}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}l.currentUser=o.getCurrentUser(),l.smsQueue=t,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={readOnly:!l.crudPermissions.canEdit,allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!0,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:n.instant("SMS.ALL_TEAMS"),labelSelected:n.instant("SMS.SELECTED_TEAMS"),transferCallback:function(e,t){var n=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(n)}},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(n,t){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.smsQueue.removeTeams({id:l.smsQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.smsQueue.addTeams({id:l.smsQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},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,t,n,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=t.protocol()+"://"+t.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,t){n.show({controller:"SmsQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{smsQueue:e,smsQueues:u.smsQueues?u.smsQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,t){n.show({controller:"SmsQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:t,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")},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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.smsQueues=l||{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="smsQueues",b.listOrder="",b.listOrderAsc=null,b.selectedSmsQueues=[],b.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"sms",limit:10,page:1},b.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.sms.smsQueues.edit",{id:e.id,smsQueue:e,crudPermissions:b.crudPermissions})},b.teamadddialog=function(e,t){i.show({controller:"SmsQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{smsQueue:e,smsQueues:b.smsQueues?b.smsQueues.rows:[],crudPermissions:b.crudPermissions}})},b.agentadddialog=function(e,t){i.show({controller:"SmsQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{smsQueue:e,smsQueues:b.smsQueues?b.smsQueues.rows:[],crudPermissions:b.crudPermissions,realtime:!1}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.gotorealtimegoto=function(e,t){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:710}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.sms.realtime.queues",{})}},b.success=y,b.getSmsQueues=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.smsQueue.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="SmsQueues",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditSmsQueue=function(e,t){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:t,smsQueues:b.smsQueues.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteSmsQueue=S,b.exportSelectedSmsQueues=function(){var e=angular.copy(b.selectedSmsQueues);return b.selectedSmsQueues=[],e},b.deleteSelectedSmsQueues=function(e){var t=i.confirm().title("Are you sure want to delete the selected smsQueues?").htmlContent("<b>"+b.selectedSmsQueues.length+" selected</b> will be deleted.").ariaLabel("delete SmsQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedSmsQueues.forEach(function(e){S(e)}),b.selectedSmsQueues=[]})},b.deselectSmsQueues=function(){b.selectedSmsQueues=[]},b.selectAllSmsQueues=function(){b.selectedSmsQueues=b.smsQueues.rows};var E=!0,A=1;function y(e){b.smsQueues=e||{count:0,rows:[]}}function S(e){m.smsQueue.delete({id:e.id}).$promise.then(function(){_.remove(b.smsQueues.rows,{id:e.id}),b.smsQueues.count-=1,b.smsQueues.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEsmsQueue"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getSmsQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","smsQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.sms").controller("SmsQueuesController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.agents=l||{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="agents",b.listOrder="",b.listOrderAsc=null,b.selectedAgents=[],b.query={fields:"createdAt,updatedAt,id,role,fullname,name,alias,showWebBar,email,phone,mobile,userpic,password,hotdesk,autointernal,internal,loginInPause,description,dtlscertfile,dtlsprivatekey,voicemail,transport,host,nat,type,allow,callerid,context,callgroup,pickupgroup,chanspy,videosupport,extensionMonitor,chatCapacity,mailCapacity,faxCapacity,smsCapacity,openchannelCapacity,phoneBarEnableSettings,phoneBarAutoAnswer,phoneBarAutoAnswerDelay,phoneBarRingInUse,phoneBarEnableRecording,phoneBarEnableDtmfTone,phoneBarDnd,phoneBarUnansweredCallBadge,phoneBarEnableJaws,phoneBarOutboundProxy,phoneBarUnconditional,phoneBarUnconditionalNumber,phoneBarRemoteControl,phoneBarRemoteControlPort,phoneBarExpires,phoneBarListenPort,permissions,allowmessenger,phoneBarPrefixRequired,passwordResetAt,phoneBarEnableVideoRecording",role:"agent",sort:"-updatedAt",limit:10,page:1},b.arrayshowWebBar=_.keyBy([{option:"Phonebar",value:"0"},{option:"External",value:"1"},{option:"WebRTC",value:"2"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arraytransport=_.keyBy([{option:"udp",value:"'udp'"},{option:"tcp",value:"'tcp'"},{option:"ws",value:"'ws'",ngIf:"vm.agent.showWebBar == 1"},{option:"wss",value:"'wss'",ngIf:"vm.agent.showWebBar == 1"},{option:"tls",value:"'tls'",ngIf:"vm.agent.showWebBar == 1"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.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"),"")}),b.arraytype=_.keyBy([{option:"Friend",value:"'friend'"},{option:"User",value:"'user'"},{option:"Peer",value:"'peer'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.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"),"")}),b.arrayvideosupport=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Always",value:"'always'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arrayextensionMonitor=_.keyBy([{option:"Inactive",value:"''"},{option:"wav",value:"'wav'"},{option:"wav49",value:"'WAV'"},{option:"gsm",value:"'gsm'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.staff.agents.edit",{id:e.id,agent:e,crudPermissions:b.crudPermissions})},b.teamadddialog=function(e,t){i.show({controller:"AgentteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{agent:e,agents:b.agents?b.agents.rows:[],crudPermissions:b.crudPermissions}})},b.deleteconfirm=function(e,t){var n=i.confirm().title("Are you sure want to delete the "+_.startCase("agent")+"?").htmlContent("<b>"+(e.name||"agent")+"</b> will be deleted.").ariaLabel("delete agent").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getAgents=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.user.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Agents",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditAgent=function(e,t){i.show({controller:"CreateOrEditAgentDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{agent:t,agents:b.agents.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteAgent=S,b.exportSelectedAgents=function(){var e=angular.copy(b.selectedAgents);return b.selectedAgents=[],e},b.deleteSelectedAgents=function(e){var t=i.confirm().title("Are you sure want to delete the selected agents?").htmlContent("<b>"+b.selectedAgents.length+" selected</b> will be deleted.").ariaLabel("delete Agents").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedAgents.forEach(function(e){S(e)}),b.selectedAgents=[]})},b.deselectAgents=function(){b.selectedAgents=[]},b.selectAllAgents=function(){b.selectedAgents=b.agents.rows};var E=!0,A=1;function y(e){b.agents=e||{count:0,rows:[]}}function S(e){m.user.delete({id:e.id}).$promise.then(function(){_.remove(b.agents.rows,{id:e.id}),b.agents.count-=1,b.agents.rows.length||b.getAgents(),p.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEuser"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getAgents())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","agents","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.staff").controller("AgentsController",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(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_AGENT",g.agent=angular.copy(l),g.agents=r,g.newAgent=!1,g.agent||(g.agent={role:"agent",showWebBar:"0",autointernal:!0,type:"friend",context:"from-sip",phoneBarRemoteControl:!0,phoneBarRemoteControlPort:9888,allowmessenger:!0},g.title="STAFF.NEW_AGENT",g.newAgent=!0),g.addNewAgent=function(){g.errors=[],d.user.save(g.agent).$promise.then(function(e){g.agents.unshift(e.toJSON()),o.success({title:"Agent properly created",msg:g.agent.name?g.agent.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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.saveAgent=function(){g.errors=[],d.user.update({id:g.agent.id},g.agent).$promise.then(function(e){var t=_.find(g.agents,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"Agent properly saved!",msg:g.agent.name?g.agent.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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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.deleteAgent=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The agent will be deleted.").ariaLabel("Delete Agent").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.user.delete({id:g.agent.id}).$promise.then(function(){_.remove(g.agents,{id:g.agent.id}),o.success({title:"Agent properly deleted!",msg:(g.agent.name||"agent")+" has been deleted!"}),v(g.agent)}).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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","agents","agent","api","Auth","license","setting","crudPermissions"],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 t=["png","jpg"];if(!_.includes(t,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+t.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var n={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.agent.images.unshift(n),!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(t,e){if(t.id===a.uniqueIdentifier){var n=new FileReader;n.readAsDataURL(t.file.file),n.onload=function(e){t.url=e.target.result},t.type="image"}})},i.init=function(e,t){i.agent=angular.copy(e),i.crudPermissions=void 0!==t?t:{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(e,t,n,a,i,s){var o=this;function r(){e.hide()}o.currentUser=s.getCurrentUser(),o.errors=[],o.setting=i,o.passwordPattern=o.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",o.agent=a,o.password="",o.oldPassword="",o.savePassword=function(){o.errors=[];var e={id:o.agent.id,newPassword:o.password};o.currentUser.id==o.agent.id&&(e.oldPassword=o.oldPassword);n.user.changePassword(e).$promise.then(function(){t.success({title:"Agent password properly updated!"}),r()}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.agent.save",msg:e.data?JSON.stringify(e.data.message):e.toString()}),o.errors=e.data.errors||[{message:e.toString(),type:"api.agent.changePassword"}]})},o.closeDialog=r}e.$inject=["$mdDialog","toasty","api","agent","setting","Auth"],angular.module("app.staff").controller("AgentchangepasswordController",e)}(),function(){"use strict";function e(e,t,i,n,s){var o=this;o.agent={},o.navigation=n.getNavigation(),o.crudPermissions,o.init=function(e,t){o.agent=e,o.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1}},o.onChange=function(t,n){if((n||t).enabled){if(n)n.enabled=!0,o.agent.permissions.push(n.id);else for(var e=0;e<t.children.length;e++)t.children[e].enabled=!0,o.agent.permissions.push(t.children[e].id);t.enabled=!0,o.agent.permissions.push(t.id)}else if(n)n.enabled=!1,_.remove(o.agent.permissions,function(e){return n.id===e}),_.filter(t.children,{enabled:!1}).length===t.children.length&&(t.enabled=!1,_.remove(o.agent.permissions,function(e){return t.id===e}));else{t.enabled=!1,_.remove(o.agent.permissions,function(e){return t.id===e});for(var a=0;a<t.children.length;a++)t.children[a].enabled=!1,_.remove(o.agent.permissions,function(e){return t.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,t,n,i,s,o,r){var c=this;function m(){return l(function(n,t){return l(function(t,n){return d[c.apiName].get({fields:"id,name,strategy,type",channel:"bull"===c.channel?"voice":c.channel,type:c.direction,nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],o.hasRole("admin")?e:c.section?c.section.autoAssociation?e:l(function(t,n){return d.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),l(function(t,n){return d.user.getQueues({id:c.agent.id,fields:"id,name,strategy,type,penalty",nolimit:!0,type:c.direction,channel:c.channel}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return"voice"===c.channel&&(t.penalty=void 0!==t&&void 0!==e.UserVoiceQueue?"penalty "+e.UserVoiceQueue.penalty:"penalty 0"),t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=o.getCurrentUser(),c.agent=t,c.crudPermissions=r,c.penalty=0,c.channel=n,c.direction=i,c.apiName=c.channel+"Queue",c.title=s.instant("STAFF.QUEUEADD_AGENT_"+c.channel.toUpperCase()+"_"+c.direction.toUpperCase()),c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!0,orderBy:"name",line1:"name",line2:"type",line3:"voice"===c.channel?"penalty":"",labelAll:s.instant("STAFF.ALL_QUEUES_"+c.channel.toUpperCase()+"_"+c.direction.toUpperCase()),labelSelected:s.instant("STAFF.SELECTED_QUEUES_"+c.channel.toUpperCase()+"_"+c.direction.toUpperCase()),transferCallback:function(e,t){t?e.forEach(function(e){e.penalty=void 0}):e.forEach(function(e){e.penalty="penalty "+c.penalty});var n=_.xorWith(c.startingSelectedItems,c.selectedItems,function(e,t){return e.id===t.id&&e.penalty===t.penalty});c.pendingChanges=!_.isEmpty(n)}},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(n,t){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 t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceWith(c.selectedItems,c.startingSelectedItems,function(e,t){return e.id===t.id&&e.penalty===t.penalty});return(n=e,l(function(e,t){_.isEmpty(n)?e():d.user.removeQueues({id:c.agent.id,ids:_.map(n,"id"),channel:c.channel}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return r=t,l(function(e,t){if(_.isEmpty(r))e();else if("voice"===c.channel){for(var n=[],a=_.groupBy(r,"penalty"),i=0;i<Object.keys(a).length;i++){var s=Object.keys(a)[i],o=_.filter(r,["penalty",s]);n.push(d.user.addQueues({id:c.agent.id,ids:_.map(o,"id"),channel:c.channel,penalty:_.trim(s,"penalty ")}).$promise)}l.all(n).then(function(){e()}).catch(function(e){t(e)})}else d.user.addQueues({id:c.agent.id,ids:_.map(r,"id"),channel:c.channel}).$promise.then(function(){e()}).catch(function(e){t(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 n},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,t,n,o,r){var l=this;function d(){return a(function(n,t){return a(function(t,n){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:l.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return l.allowedItems=_.map(t,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.startingAllowedItems=angular.copy(l.allowedItems),l.items.forEach(function(e){var t=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.user.getTeams({id:l.agent.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];l.selectedItems=_.map(t,function(e){return _.find(l.items,{id:e.id})}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}l.currentUser=o.getCurrentUser(),l.agent=t,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={readOnly:!l.crudPermissions.canEdit,allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!0,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:n.instant("STAFF.ALL_TEAMS"),labelSelected:n.instant("STAFF.SELECTED_TEAMS"),transferCallback:function(e,t){var n=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(n)}},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(n,t){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.user.removeTeams({id:l.agent.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.user.addTeams({id:l.agent.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},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,t,i,s,n,a,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=a,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=t.protocol()+"://"+t.host(),u.agent=c||e.params.agent||{},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.queueaddchannel=function(e,t,n,a){i.show({controller:"AgentqueueaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/queueadd/queueadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{agent:e,agents:u.agents?u.agents.rows:[],channel:t,direction:a||"inbound",crudPermissions:u.crudPermissions}})},u.teamadddialog=function(e,t){i.show({controller:"AgentteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{agent:e,agents:u.agents?u.agents.rows:[],crudPermissions:u.crudPermissions}})},u.changepassworddialog=function(e,t){i.show({controller:"AgentchangepasswordController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/changepassword/changepassword.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{agent:e,setting:o,agents:u.agents?u.agents.rows:[],crudPermissions:u.crudPermissions}})},u.alert=l.info,u.gotoAgents=function(){e.go("app.staff.agents")},u.saveAgent=function(){u.agent=_.omit(u.agent,"userpic"),r.user.update({id:u.agent.id},u.agent).$promise.then(function(){l.success({title:"Agent updated!",msg:u.agent.name?u.agent.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 t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.contexts,{id:e.resourceId})}),n=null;if(u.agent&&(n=_.find(u.contexts,{name:u.agent.context})),n&&!_.some(t,["id",n.id])){var a=_.find(u.contexts,{id:n.id});a.canSelect=!1,t.push(a)}u.contexts=t}):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","agent","userProfileSection"],angular.module("app.staff").controller("AgentController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.teams,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The team will be deleted.").ariaLabel("Delete Team").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,o,r,l,d){var c=this;function m(){return a(function(n,t){return a(function(t,n){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.team.getAgents({id:c.team.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return t.penalty=e.UserTeam?"penalty "+e.UserTeam.penalty:"",t.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=l.getCurrentUser(),c.team=t,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(n,t){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.team.removeAgents({id:c.team.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.team.addAgents({id:c.team.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,items:[],selectedItems:[],showSelectAndDeselectAll:!o,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("STAFF.ALL_AGENTS"),labelSelected:r.instant("STAFF.SELECTED_AGENTS"),transferCallback:function(e,t){var n=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(n)}}}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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.teams=l||{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="teams",b.listOrder="",b.listOrderAsc=null,b.selectedTeams=[],b.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},b.editdialog=function(e,t){i.show({controller:"CreateOrEditTeamDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/teams/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{team:e,teams:b.teams.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.agentadddialog=function(e,t){i.show({controller:"TeamagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/teams/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{team:e,teams:b.teams?b.teams.rows:[],crudPermissions:b.crudPermissions,realtime:!1}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getTeams=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.team.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Teams",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditTeam=function(e,t){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:t,teams:b.teams.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteTeam=S,b.exportSelectedTeams=function(){var e=angular.copy(b.selectedTeams);return b.selectedTeams=[],e},b.deleteSelectedTeams=function(e){var t=i.confirm().title("Are you sure want to delete the selected teams?").htmlContent("<b>"+b.selectedTeams.length+" selected</b> will be deleted.").ariaLabel("delete Teams").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedTeams.forEach(function(e){S(e)}),b.selectedTeams=[]})},b.deselectTeams=function(){b.selectedTeams=[]},b.selectAllTeams=function(){b.selectedTeams=b.teams.rows};var E=!0,A=1;function y(e){b.teams=e||{count:0,rows:[]}}function S(e){m.team.delete({id:e.id}).$promise.then(function(){_.remove(b.teams.rows,{id:e.id}),b.teams.count-=1,b.teams.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEteam"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getTeams())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","teams","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.staff").controller("TeamsController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.telephones,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The telephone will be deleted.").ariaLabel("Delete Telephone").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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(e,t,n,a,i,s){var o=this;function r(){e.hide()}o.currentUser=s.getCurrentUser(),o.errors=[],o.setting=i,o.passwordPattern=o.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",o.telephone=a,o.password="",o.oldPassword="",o.savePassword=function(){o.errors=[];var e={id:o.telephone.id,newPassword:o.password};o.currentUser.id==o.telephone.id&&(e.oldPassword=o.oldPassword);n.user.changePassword(e).$promise.then(function(){t.success({title:"Telephone password properly updated!"}),r()}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.telephone.save",msg:e.data?JSON.stringify(e.data.message):e.toString()}),o.errors=e.data.errors||[{message:e.toString(),type:"api.telephone.changePassword"}]})},o.closeDialog=r}e.$inject=["$mdDialog","toasty","api","telephone","setting","Auth"],angular.module("app.staff").controller("TelephonechangepasswordController",e)}(),function(){"use strict";function e(e,t,n,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=t.protocol()+"://"+t.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,t){n.show({controller:"TelephonechangepasswordController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/telephones/edit/changepassword/changepassword.html",parent:angular.element(a.body),targetEvent:t,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")},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 t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.contexts,{id:e.resourceId})}),n=null;if(u.telephone&&(n=_.find(u.contexts,{name:u.telephone.context})),n&&!_.some(t,["id",n.id])){var a=_.find(u.contexts,{id:n.id});a.canSelect=!1,t.push(a)}u.contexts=t}):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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.telephones=l||{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="telephones",b.listOrder="",b.listOrderAsc=null,b.selectedTelephones=[],b.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},b.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"),"")}),b.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"),"")}),b.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"),"")}),b.arrayvideosupport=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Always",value:"'always'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arrayencryption=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.staff.telephones.edit",{id:e.id,telephone:e,crudPermissions:b.crudPermissions})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getTelephones=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.user.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Telephones",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditTelephone=function(e,t){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:t,telephones:b.telephones.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteTelephone=S,b.exportSelectedTelephones=function(){var e=angular.copy(b.selectedTelephones);return b.selectedTelephones=[],e},b.deleteSelectedTelephones=function(e){var t=i.confirm().title("Are you sure want to delete the selected telephones?").htmlContent("<b>"+b.selectedTelephones.length+" selected</b> will be deleted.").ariaLabel("delete Telephones").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedTelephones.forEach(function(e){S(e)}),b.selectedTelephones=[]})},b.deselectTelephones=function(){b.selectedTelephones=[]},b.selectAllTelephones=function(){b.selectedTelephones=b.telephones.rows};var E=!0,A=1;function y(e){b.telephones=e||{count:0,rows:[]}}function S(e){m.user.delete({id:e.id}).$promise.then(function(){_.remove(b.telephones.rows,{id:e.id}),b.telephones.count-=1,b.telephones.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEuser"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getTelephones())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","telephones","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.staff").controller("TelephonesController",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(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"]},g.title="STAFF.NEW_USERPROFILE",g.newUserProfile=!0),g.addNewUserProfile=function(){g.errors=[],d.userProfile.save(g.userProfile).$promise.then(function(e){var t,n;n=[],(t=e).crudPermissions.forEach(function(e){var t;switch(e){case"r":t="READ_PERMISSION";break;case"e":t="EDIT_PERMISSION";break;case"d":t="DELETE_PERMISSION"}n.push(s.instant("STAFF."+t))}),t.selectedcrudPermissions=n.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.userProfiles,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The userProfile will be deleted.").ariaLabel("Delete UserProfile").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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(t,a,i,e,n,s,o){var r=this;function l(e){t.hide(e)}r.newUserProfile=!0,r.userProfile=angular.copy(n),r.userProfiles=s,r.title=o.instant("STAFF.CLONE_USERPROFILE"),n&&n.name&&(r.title+=": "+n.name),r.cloneUserProfile=function(){return e.userProfile.clone({id:n.id},r.userProfile).$promise.then(function(e){var t,n;n=[],(t=e).crudPermissions.forEach(function(e){var t;switch(e){case"r":t="READ_PERMISSION";break;case"e":t="EDIT_PERMISSION";break;case"d":t="DELETE_PERMISSION"}n.push(o.instant("STAFF."+t))}),t.selectedcrudPermissions=n.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 t=0;t<e.data.errors.length;t+=1)i.error({title:e.data.errors[t].type,msg:e.data.errors[t].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(n,o,r,l,d,e,t,c){var m=this;function u(e,t){switch(e.allResourcesEnabled="full"===t,t){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(t,n){var i,a;void 0!==e.channel&&_.includes(e.route,"Queue")?(a=e,l(function(t,n){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){t(e)}).catch(function(e){n(e)})})).then(function(e){t(e)}).catch(function(e){n(e)}):(i=e,l(function(a,t){switch(i.route){case"voiceExtension":var e;switch(i.title){case"InboundRoutes":e="inbound";break;case"OutboundRoutes":e="outbound";break;case"InternalRoutes":e="internal"}break;case"user":var n;switch(i.title){case"Agents":n="agent";break;case"Telephones":n="telephone";break;case"Users":n="user"}}if("Reports"===i.title){if(!i.reportType)return d.analyticDefaultReport.get({nolimit:!0}).$promise.then(function(n){d.analyticCustomReport.get({nolimit:!0}).$promise.then(function(e){var t=_.union(n.rows,e.rows);a({count:t.length,rows:t.rows})})}).catch(function(e){t(e)});switch(i.reportType){case"default":i.route="analyticDefaultReport";break;case"custom":i.route="analyticCustomReport"}}return d[i.route].get({role:n||void 0,type:e||void 0,VoiceExtensionId:e?"null":void 0,nolimit:!0}).$promise.then(function(e){a(e)}).catch(function(e){t(e)})})).then(function(e){t(e)}).catch(function(e){n(e)})})}function g(e,t,n){var a=e&&0<e.length?e[0]:null;if(!a)return n;var i,s,o=_.find(t,["sectionId",a.id]);return o?(t=_.remove(t,["sectionId",a.id]),(i=a,s=o.id,l(function(t,n){d.userProfileResource.get({sectionId:s}).$promise.then(function(t){return p(i).then(function(e){return _.differenceBy(t.rows,e.rows,"id")})}).then(function(e){_.isEmpty(e)?t():n()}).catch(function(e){n(e)})})).then(function(){return n="full",g(e.shift(),t,n)}).catch(function(e){return l.reject(e)})):void 0}function a(a){var n="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:n}).$promise.then(function(e){var t=e&&e.rows&&0<e.rows.length?e.rows:[];if("Dashboards"===a.title)return _.isEmpty(t)?"disabled":t[0].autoAssociation?"full":d.userProfileResource.get({sectionId:t[0].id,resourceId:101}).$promise.then(function(e){return(e&&e.rows?e.rows[0]:null)?"full":"partial"});var n=_.filter(a.children,function(e){return void 0!==e.permissions&&e.permissions.hidden?void 0:e});return t.length!==n.length?0===t.length?"disabled":"partial":_.every(t,["autoAssociation",!0])?"full":g(_.filter(n,function(e){return void 0===e.permissions||e.permissions.association?e:void 0}),t,"partial")}).then(function(e){a.status=u(a,e)}).catch(function(e){var t=e?"unknown":"partial";a.status=u(a,t),e&&c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GETRESOURCES("+n.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 t=(e&&1===e.rows.length?e.rows[0]:null)?"full":"disabled";a.status=u(a,t)}):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,t){m.userProfile=e,m.license=t},m.onChangeEnableAllResources=function(t){var e=void 0!==t.permissions&&!t.permissions.association,a="Marketplace"===t.title?"AppZone":t.title;if("Fully Enabled"!==t.status.name){var i=[];if(e)return i.push({category:a,sectionId:t.id,name:a,enabled:!0,crudPermissions:"red"}),d.userProfile.addSections({id:m.userProfile.id},i).$promise.then(function(){t.status=u(t,"full"),c.success({title:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_ENABLED_ALL_SUCCESS_TITLE",{sectionName:r.instant(t.translate),userProfileName:m.userProfile.name}),msg:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_ENABLED_ALL_SUCCESS_MESSAGE_NO_RESOURCES",{sectionName:r.instant(t.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 n=o.confirm({skipHide:!0}).title("Warning").textContent(r.instant("STAFF.PERMISSIONS_WARNING_ENABLE_ALL",{sectionName:r.instant(t.translate)})).ariaLabel("Warning").ok(r.instant("STAFF.CONFIRM")).cancel(r.instant("STAFF.CANCEL"));o.show(n).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(t.children,function(e){var t=!(void 0===e.permissions||!e.permissions.hidden);if(!t){var n=e.title;switch(a){case"CallySquare":n="Projects"===n?"SquareProjects":n}i.push({category:a,sectionId:e.id,name:n,enabled:!0,autoAssociation:!0,crudPermissions:_.map(m.userProfile.crudPermissions).join("")})}})}return d.userProfile.addSections({id:m.userProfile.id},i).$promise.then(function(){t.status=u(t,"full"),c.success({title:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_ENABLED_ALL_SUCCESS_TITLE",{sectionName:r.instant(t.translate),userProfileName:m.userProfile.name}),msg:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_ENABLED_ALL_SUCCESS_MESSAGE",{sectionName:r.instant(t.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()}):t.status=u(t,t.status.tag)})}else if("Fully Enabled"===t.status.name){t.status=u(t,"disabled");var s=[];switch(a){case"Settings":case"Help":s=[t.id];break;case"Dashboards":s=_.map(m.dashboardSections,function(e){return e.id});break;default:s=_.map(t.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(t.translate),userProfileName:m.userProfile.name}),msg:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_DISABLED_ALL_SUCCESS_MESSAGE",{sectionName:r.instant(t.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,t){o.show({controller:"UserProfilepermissionsmanageController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/userProfiles/edit/permissionsmanage/permissionsmanage.html",parent:angular.element(n.body),targetEvent:t,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,s,t,o,e,a,r,i,l){var d=this;function c(){var a=void 0!==d.selectedSection.pending&&d.selectedSection.pending;return s(function(n,t){o.userProfileSection.get({userProfileId:d.userProfile.id,sectionId:d.selectedSection.id}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;a||(d.selectedSection.enabled=!!t&&!!t.enabled,d.selectedSection.autoAssociation=!!t&&!!t.autoAssociation,d.selectedSection.crudPermissions=p(t?t.crudPermissions:d.userProfile.crudPermissions)),n(t)}).catch(function(e){t(e)})})}function m(){return s(function(t,n){void 0!==d.selectedSection.channel&&_.includes(d.selectedSection.route,"Queue")?s(function(t,n){var e=void 0!==d.selectedSection.channel&&"bull"===d.selectedSection.channel?"outbound":"inbound";return o[d.selectedSection.route].get({fields:"id,name,strategy,type",channel:"bull"===d.selectedSection.channel?"voice":d.selectedSection.channel,type:e,nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){t(e)}).catch(function(e){n(e)}):s(function(t,n){var e,a;if("voiceExtension"===d.selectedSection.route)switch(d.selectedSection.title){case"InboundRoutes":e="inbound";break;case"OutboundRoutes":e="outbound";break;case"InternalRoutes":e="internal"}if("user"===d.selectedSection.route)switch(d.selectedSection.title){case"Agents":a="agent";break;case"Telephones":a="telephone";break;case"Users":a="user"}if("interval"===d.selectedSection.route)var i=!0;if("Reports"===d.selectedSection.title)switch(d.selectedSection.reportType){case"default":d.selectedSection.route="analyticDefaultReport";break;case"custom":d.selectedSection.route="analyticCustomReport"}if("Dashboards"!==d.selectedSection.title)return o[d.selectedSection.route].get({role:a||void 0,type:e||void 0,VoiceExtensionId:e?"null":void 0,IntervalId:i?"null":void 0,nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)});t({count:1,rows:[{id:101,name:r.instant("DASHBOARDS.GENERAL")}]})}).then(function(e){t(e)}).catch(function(e){n(e)})})}function u(){var a=void 0!==d.selectedSection.pending&&d.selectedSection.pending,i=[];return s(function(t,n){d.loadedSection?o.userProfileResource.get({sectionId:d.loadedSection.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)}):t(null)}).then(function(e){return i=e&&e.rows?e.rows:[],"Reports"===d.selectedSection.title&&(d.associatedReports=d.associatedReports?d.associatedReports:i,i=function(e){var t=[];switch(d.selectedSection.reportType){case"default":t=_.filter(e,{type:"DefaultReports"});break;case"custom":t=_.filter(e,{type:"CustomReports"})}return t}(d.associatedReports)),void 0===d.selectedSection.permissions||d.selectedSection.permissions.association?m():{rows:[]}}).then(function(e){d.items=e.rows?_.map(e.rows,function(e){var t,n;return"Reports"===d.selectedSection.title&&(e.fullPath=(t=e.parent,n=d.treeStructure[0].text,n=function e(t,n,a){if(!a||_.isEmpty(a.children))return t;var a=_.find(a.children,function(e){return _.includes(n,e.id)?e:void 0});return t+=a?"/"+a.text:"",e(t,n,a)}(n,t,d.treeStructure[0])).replace(" ","_")),e.isValid=!0,e}):[],a||(d.selectedSection.selectedItems=_.map(i,function(e){return _.find(d.items,{id:e.resourceId})}));var t=_.differenceBy(d.selectedSection.selectedItems,d.items,"id");switch(_.isEmpty(t)||(d.selectedSection.selectedItems=_.pullAllBy(d.selectedSection.selectedItems,t,"id")),d.selectedSection.title){case"Contexts":d.selectedSection.selectedItems=_.filter(d.items,function(e){return e.defaultEntry?(e.isValid=!1,e):void 0!==_.find(i,{resourceId:e.id})?(e.isValid=!0,e):void 0});break;case"MusicOnHolds":d.selectedSection.selectedItems=_.filter(d.items,function(e){return e.defaultEntry?(e.isValid=!1,e):void 0!==_.find(i,{resourceId:e.id})?(e.isValid=!0,e):void 0});break;case"Reports":var n=function(e){var t=[];switch(d.selectedSection.reportType){case"default":t=_.filter(e,function(e){return _.startsWith(e.parent,"motion")});break;case"custom":t=_.filter(e,function(e){return _.startsWith(e.parent,"custom")})}return t}(d.allReportsSelected);d.selectedSection.selectedItems=h(d.selectedSection.selectedItems),d.selectedSection.selectedItems=_.unionBy(d.selectedSection.selectedItems,n,"parent")}d.dualMultiselectOptions.selectedItems=d.selectedSection.selectedItems,d.dualMultiselectOptions.items=_.differenceBy(d.items,d.dualMultiselectOptions.selectedItems,"id")}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET"+d.selectedSection.title.toUpperCase(),msg:e.status?JSON.stringify(e.data):e.toString()})})}function p(e){return e&&(d.selectedSection.allowEdit=!!_.includes(e,"e"),d.selectedSection.allowDelete=!!_.includes(e,"d")),function(){var e=["r"];if(d.selectedSection.allowEdit)e.push("e");else{var t=_.indexOf(e,["e"]);0<t&&d.selectedSection.crudPermissions.replace("e","")}if(d.selectedSection.allowDelete)e.push("d");else{var t=_.indexOf(e,["d"]);0<t&&d.selectedSection.crudPermissions.replace("d","")}return e}()}function g(e){var t=_.findIndex(d.subsections,function(e){return e.id==d.selectedSection.id});d.subsections[t].pending=e,v()}function v(){return d.pendingChanges=_.some(d.subsections,["pending",!0])}function h(e){var t=[];switch(d.selectedSection.reportType){case"default":t=_.remove(e,function(e){return _.startsWith(e.parent,"motion")});break;case"custom":t=_.remove(e,function(e){return _.startsWith(e.parent,"custom")})}return t}d.userProfile=e,d.penalty=0,d.section=angular.copy(l),d.title=r.instant("STAFF.PERMISSIONS_SECTION_TITLE",{sectionName:r.instant(d.section.translate)}),d.items=[],d.selectedItems=[],d.subsections=_.filter(d.section.children,function(e){return void 0!==e.permissions&&e.permissions.hidden?void 0:e}),d.dashboardSections=[{title:"Dashboards",translate:"DASHBOARDS.DASHBOARDS",id:100}],d.dashboardItems=[],"Dashboards"===d.section.title&&(d.dashboardItems=d.subsections,d.subsections=d.dashboardSections),d.selectedSection=null,d.loadedSection=null,d.closeDialog=function(e){if(d.pendingChanges){var t=n.confirm({skipHide:!0}).title("Warning").textContent(r.instant("STAFF.PERMISSIONS_WARNING_CLOSE")).ariaLabel("Warning").targetEvent(e).ok(r.instant("STAFF.CLOSE")).cancel(r.instant("STAFF.CANCEL"));n.show(t).then(function(){n.hide()})}else n.hide()},d.onChangeSection=function(){return c().then(function(e){if(d.loadedSection=e,"Reports"===d.selectedSection.title)return s(function(t,n){o.analyticTreeReport.get({}).$promise.then(function(e){d.treeReports=e.rows||[],t(d.treeReports)}).catch(function(e){n(e)})}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TREE_REPORT_STRUCTURE",msg:e.data?JSON.stringify(e.data):e.toString()})});u()}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET"+d.selectedSection.title.toUpperCase(),msg:e.status?JSON.stringify(e.data):e.toString()})})},d.onChangeVisibility=function(){d.selectedSection.enabled=!d.selectedSection.enabled,g(!0)},d.onChangeAutoAssociation=function(){if(!d.selectedSection.autoAssociation){for(var e=[],t=0;t<d.dualMultiselectOptions.items.length;t++)e.push(d.dualMultiselectOptions.items[t]),d.dualMultiselectOptions.selectedItems.push(d.dualMultiselectOptions.items[t]);d.dualMultiselectOptions.items=[],d.dualMultiselectOptions.transferCallback(e,!1)}g(!0)},d.onChangeReportType=function(){d.treeStructure=function(){var e={};switch(d.selectedSection.reportType){case"default":e=d.treeReports[0]?angular.fromJson(d.treeReports[0].tree):[];break;case"custom":e=d.treeReports[1]?angular.fromJson(d.treeReports[1].tree):[]}return e}(),d.selectedSection.selectedItems&&(d.allReportsSelected=h(d.allReportsSelected),d.allReportsSelected=_.unionBy(d.allReportsSelected,d.selectedSection.selectedItems,"parent"));u()},d.setPermission=function(e){switch(e){case"edit":d.selectedSection.allowEdit=!d.selectedSection.allowEdit;break;case"delete":d.selectedSection.allowDelete=!d.selectedSection.allowDelete}d.selectedSection.crudPermissions=p(),g(!0)},d.saveSection=function(){var n="Marketplace"===d.section.title?"AppZone":d.section.title,e=_.map(_.filter(d.subsections,{pending:!0}),function(e){var t=e.selectedItems,a=e.title;switch("Reports"===a&&(t=_.unionBy(d.allReportsSelected,e.selectedItems,"parent")),n){case"CallySquare":a="Projects"===a?"SquareProjects":a;break;case"Integrations":e.autoAssociation=!0}return{category:n,sectionId:e.id,name:a,enabled:e.enabled,autoAssociation:e.autoAssociation,crudPermissions:_.map(e.crudPermissions).join(""),Resources:t?_.map(t,function(e){return{name:e.name,resourceId:e.id,type:(t=a,n=e,"Reports"!==t?t:(_.startsWith(n.parent,"motion")?"Default":"Custom")+t)};var t,n}):[]}});return o.userProfile.addSections({id:d.userProfile.id},e).$promise.then(function(){d.subsections.forEach(function(e){e.pending=void 0}),d.allReportsSelected=[],d.associatedReports=null,v(),t.success({title:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_SAVED_SUCCESS_TITLE",{sectionName:r.instant(n.translate)}),msg:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_SAVED_SUCCESS_MESSAGE")})}).then(function(){return c().then(function(e){d.loadedSection=e})}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:USERPROFILE.ADDSECTIONS",msg:e.status?JSON.stringify(e.data):e.toString()})})},d.dualMultiselectOptions={readOnly:!1,items:[],selectedItems:[],showSelectAndDeselectAll:!0,orderBy:"name",line1:"name",line2:"",line3:"",line4:"fullPath",labelAll:r.instant("STAFF.PERMISSIONS_ALL_RESOURCES"),labelSelected:r.instant("STAFF.PERMISSIONS_SELECTED_RESOURCES"),labelSearch:r.instant("STAFF.PERMISSIONS_PLACEHOLDER_SEARCH"),transferCallback:function(e,t){g(!0),t?(d.selectedSection.selectedItems=_.pullAllBy(d.selectedSection.selectedItems,e,"id"),d.selectedSection.autoAssociation=!1):d.selectedSection.selectedItems=_.unionBy(d.selectedSection.selectedItems,e,"id")}}}e.$inject=["$mdDialog","$q","toasty","api","userProfile","userProfiles","$translate","Auth","section"],angular.module("app.staff").controller("UserProfilepermissionsmanageController",e)}(),function(){"use strict";function e(e,t,n,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=t.protocol()+"://"+t.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,t){n.show({controller:"UserProfilepermissionsmanageController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/userProfiles/edit/permissionsmanage/permissionsmanage.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{userProfile:e,userProfiles:u.userProfiles?u.userProfiles.rows:[],crudPermissions:u.crudPermissions}})},u.clonedialog=function(e,t){n.show({controller:"UserProfilecloneController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/userProfiles/edit/clone/clone.html",parent:angular.element(a.body),targetEvent:t,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")},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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.userProfiles=l||{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="userProfiles",b.listOrder="",b.listOrderAsc=null,b.selectedUserProfiles=[],b.query={fields:"createdAt,updatedAt,id,name,description,crudPermissions",sort:"-updatedAt",limit:10,page:1},b.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"),"")}),b.userProfiles&&0<b.userProfiles.count&&b.userProfiles.rows.forEach(function(e){var t=[];e.crudPermissions.forEach(function(e){t.push(b.arraycrudPermissions[e].option)});var n=[];t.forEach(function(e){n.push(r.instant("STAFF."+e.toUpperCase()))}),e.selectedcrudPermissions=n.join(", ")}),b.editstate=function(e,t){n.go("app.staff.userProfiles.edit",{id:e.id,userProfile:e,crudPermissions:b.crudPermissions})},b.clonedialog=function(e,t){i.show({controller:"UserProfilecloneController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/userProfiles/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{userProfile:e,userProfiles:b.userProfiles?b.userProfiles.rows:[],crudPermissions:b.crudPermissions}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getUserProfiles=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.userProfile.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="UserProfiles",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditUserProfile=function(e,t){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:t,userProfiles:b.userProfiles.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteUserProfile=S,b.exportSelectedUserProfiles=function(){var e=angular.copy(b.selectedUserProfiles);return b.selectedUserProfiles=[],e},b.deleteSelectedUserProfiles=function(e){var t=i.confirm().title("Are you sure want to delete the selected userProfiles?").htmlContent("<b>"+b.selectedUserProfiles.length+" selected</b> will be deleted.").ariaLabel("delete UserProfiles").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedUserProfiles.forEach(function(e){S(e)}),b.selectedUserProfiles=[]})},b.deselectUserProfiles=function(){b.selectedUserProfiles=[]},b.selectAllUserProfiles=function(){b.selectedUserProfiles=b.userProfiles.rows};var E=!0,A=1;function y(e){b.userProfiles=e||{count:0,rows:[]}}function S(e){m.userProfile.delete({id:e.id}).$promise.then(function(){_.remove(b.userProfiles.rows,{id:e.id}),b.userProfiles.count-=1,b.userProfiles.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEuserProfile"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getUserProfiles())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","userProfiles","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.staff").controller("UserProfilesController",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(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_USER",g.user=angular.copy(l),g.users=r,g.newUser=!1,g.user||(g.user={role:"user",autointernal:!0,context:"from-sip"},g.title="STAFF.NEW_USER",g.newUser=!0),g.addNewUser=function(){g.errors=[],d.user.save(g.user).$promise.then(function(e){g.users.unshift(e.toJSON()),o.success({title:"User properly created",msg:g.user.name?g.user.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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.saveUser=function(){g.errors=[],d.user.update({id:g.user.id},g.user).$promise.then(function(e){var t=_.find(g.users,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"User properly saved!",msg:g.user.name?g.user.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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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.deleteUser=function(e){if(c.getCurrentUser().id===g.user.id)return o.error({title:"User not deleted!",msg:"You can't remove yourself"});g.errors=[];var t=a.confirm().title("Are you sure?").content("The user will be deleted.").ariaLabel("Delete User").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.user.delete({id:g.user.id}).$promise.then(function(){_.remove(g.users,{id:g.user.id}),o.success({title:"User properly deleted!",msg:(g.user.name||"user")+" has been deleted!"}),v(g.user)}).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,d.userProfile.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.userProfiles=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERPROFILES",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","users","user","api","Auth","license","setting","crudPermissions"],angular.module("app.staff").controller("CreateOrEditUserDialogController",e)}(),function(){"use strict";function e(e,t,n,a,i){var s=this;function o(){e.hide()}s.currentUser=i.getCurrentUser(),s.errors=[],s.user=a,s.generateApiKey=function(){s.errors=[],n.user.createApiKey({id:s.user.id}).$promise.then(function(e){s.user.apiKey=e.api_key||"N/A",t.success({title:"User API key updated!"}),o()}).catch(function(e){t.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=[],n.user.removeApiKey({id:s.user.id}).$promise.then(function(){s.user.apiKey="N/A",t.success({title:"User API key removed!"}),o()}).catch(function(e){t.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 t=["png","jpg"];if(!_.includes(t,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+t.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var n={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.user.images.unshift(n),!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(t,e){if(t.id===a.uniqueIdentifier){var n=new FileReader;n.readAsDataURL(t.file.file),n.onload=function(e){t.url=e.target.result},t.type="image"}})},i.init=function(e,t){i.user=angular.copy(e),i.crudPermissions=void 0!==t?t:{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(e,t,n,a,i,s){var o=this;function r(){e.hide()}o.currentUser=s.getCurrentUser(),o.errors=[],o.setting=i,o.passwordPattern=o.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",o.user=a,o.password="",o.oldPassword="",o.savePassword=function(){o.errors=[];var e={id:o.user.id,newPassword:o.password};o.currentUser.id==o.user.id&&(e.oldPassword=o.oldPassword);n.user.changePassword(e).$promise.then(function(){t.success({title:"User password properly updated!"}),r()}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.save",msg:e.data?JSON.stringify(e.data.message):e.toString()}),o.errors=e.data.errors||[{message:e.toString(),type:"api.user.changePassword"}]})},o.closeDialog=r}e.$inject=["$mdDialog","toasty","api","user","setting","Auth"],angular.module("app.staff").controller("UserchangepasswordController",e)}(),function(){"use strict";function e(e,t,n,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=t.protocol()+"://"+t.host(),u.user=c||e.params.user||{},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.apikeymanagerdialog=function(e,t){n.show({controller:"UserapikeymanagerController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/users/edit/apikeymanager/apikeymanager.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{user:e,users:u.users?u.users.rows:[],crudPermissions:u.crudPermissions}})},u.changepassworddialog=function(e,t){n.show({controller:"UserchangepasswordController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/users/edit/changepassword/changepassword.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{user:e,setting:o,users:u.users?u.users.rows:[],crudPermissions:u.crudPermissions}})},u.alert=l.info,u.gotoUsers=function(){e.go("app.staff.users")},u.saveUser=function(){u.user=_.omit(u.user,"userpic"),r.user.update({id:u.user.id},u.user).$promise.then(function(){l.success({title:"User updated!",msg:u.user.name?u.user.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()})})},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.userProfile.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.userProfiles=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERPROFILES",msg:e.data?JSON.stringify(e.data):e.toString()})}),r.user.getApiKey({id:u.user.id}).$promise.then(function(e){u.user.apiKey=e.api_key?e.api_key:"N/A"}).catch(function(e){l.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","$translate","license","setting","api","toasty","Auth","user","userProfileSection"],angular.module("app.staff").controller("UserController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.users=l||{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="users",b.listOrder="",b.listOrderAsc=null,b.selectedUsers=[],b.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",role:"admin,user",sort:"-updatedAt",limit:10,page:1},b.arrayrole=_.keyBy([{option:"Admin",value:"'admin'"},{option:"User",value:"'user'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.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"),"")}),b.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"),"")}),b.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"),"")}),b.arrayvideosupport=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Always",value:"'always'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.staff.users.edit",{id:e.id,user:e,crudPermissions:b.crudPermissions})},b.deleteconfirm=function(e,t){var n=i.confirm().title("Are you sure want to delete the "+_.startCase("user")+"?").htmlContent("<b>"+(e.name||"user")+"</b> will be deleted.").ariaLabel("delete user").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getUsers=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.user.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Users",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditUser=function(e,t){i.show({controller:"CreateOrEditUserDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/users/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{user:t,users:b.users.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteUser=S,b.exportSelectedUsers=function(){var e=angular.copy(b.selectedUsers);return b.selectedUsers=[],e},b.deleteSelectedUsers=function(e){var t=i.confirm().title("Are you sure want to delete the selected users?").htmlContent("<b>"+b.selectedUsers.length+" selected</b> will be deleted.").ariaLabel("delete Users").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedUsers.forEach(function(e){S(e)}),b.selectedUsers=[]})},b.deselectUsers=function(){b.selectedUsers=[]},b.selectAllUsers=function(){b.selectedUsers=b.users.rows},m.userProfile.get({fields:"id,name",sort:"name"}).$promise.then(function(e){b.userProfiles=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERPROFILES",msg:e.data?JSON.stringify(e.data):e.toString()})});var E=!0,A=1;function y(e){b.users=e||{count:0,rows:[]}}function S(e){m.user.delete({id:e.id}).$promise.then(function(){_.remove(b.users.rows,{id:e.id}),b.users.count-=1,b.users.rows.length||b.getUsers(),p.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEuser"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getUsers())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","users","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.staff").controller("UsersController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.cannedAnswers=l||{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="cannedAnswers",b.listOrder="",b.listOrderAsc=null,b.selectedCannedAnswers=[],b.query={fields:"createdAt,updatedAt,id,key,value,description",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",limit:10,page:1},b.editdialog=function(e,t){i.show({controller:"CreateOrEditCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/cannedAnswers/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{cannedAnswer:e,cannedAnswers:b.cannedAnswers.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getCannedAnswers=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.cannedAnswer.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="CannedAnswers",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditCannedAnswer=function(e,t){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:t,cannedAnswers:b.cannedAnswers.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteCannedAnswer=S,b.exportSelectedCannedAnswers=function(){var e=angular.copy(b.selectedCannedAnswers);return b.selectedCannedAnswers=[],e},b.deleteSelectedCannedAnswers=function(e){var t=i.confirm().title("Are you sure want to delete the selected cannedAnswers?").htmlContent("<b>"+b.selectedCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete CannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedCannedAnswers.forEach(function(e){S(e)}),b.selectedCannedAnswers=[]})},b.deselectCannedAnswers=function(){b.selectedCannedAnswers=[]},b.selectAllCannedAnswers=function(){b.selectedCannedAnswers=b.cannedAnswers.rows};var E=!0,A=1;function y(e){b.cannedAnswers=e||{count:0,rows:[]}}function S(e){m.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(b.cannedAnswers.rows,{id:e.id}),b.cannedAnswers.count-=1,b.cannedAnswers.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcannedAnswer"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getCannedAnswers())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","cannedAnswers","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.tools").controller("CannedAnswersController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.cannedAnswers,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The cannedAnswer will be deleted.").ariaLabel("Delete CannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.customDashboards,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The customDashboard will be deleted.").ariaLabel("Delete CustomDashboard").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.customDashboards=l||{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="customDashboards",b.listOrder="",b.listOrderAsc=null,b.selectedCustomDashboards=[],b.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},b.editstate=function(e,t){n.go("app.tools.customDashboards.edit",{id:e.id,customDashboard:e,crudPermissions:b.crudPermissions})},b.clonedialog=function(e,t){i.show({controller:"CustomDashboardcloneController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/customDashboards/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{customDashboard:e,customDashboards:b.customDashboards?b.customDashboards.rows:[],crudPermissions:b.crudPermissions}})},b.gotodashboardgoto=function(e,t){n.go("app.dashboards.custom",{id:e.id})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getCustomDashboards=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.dashboard.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="CustomDashboards",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditCustomDashboard=function(e,t){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:t,customDashboards:b.customDashboards.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteCustomDashboard=S,b.exportSelectedCustomDashboards=function(){var e=angular.copy(b.selectedCustomDashboards);return b.selectedCustomDashboards=[],e},b.deleteSelectedCustomDashboards=function(e){var t=i.confirm().title("Are you sure want to delete the selected customDashboards?").htmlContent("<b>"+b.selectedCustomDashboards.length+" selected</b> will be deleted.").ariaLabel("delete CustomDashboards").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedCustomDashboards.forEach(function(e){S(e)}),b.selectedCustomDashboards=[]})},b.deselectCustomDashboards=function(){b.selectedCustomDashboards=[]},b.selectAllCustomDashboards=function(){b.selectedCustomDashboards=b.customDashboards.rows};var E=!0,A=1;function y(e){b.customDashboards=e||{count:0,rows:[]}}function S(e){m.dashboard.delete({id:e.id}).$promise.then(function(){_.remove(b.customDashboards.rows,{id:e.id}),b.customDashboards.count-=1,b.customDashboards.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdashboard"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getCustomDashboards())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","customDashboards","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.tools").controller("CustomDashboardsController",e)}(),function(){"use strict";function e(t,n,a,e,i,s,o){var r=this;function l(e){t.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!":""}),n.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 t=0;t<e.data.errors.length;t+=1)a.error({title:e.data.errors[t].type,msg:e.data.errors[t].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(n,a,e,i,s){var o=this;function r(e,t,n){return s.dashboardItem.update(n).$promise.catch(function(e){console.error(e)})}o.customDashboard={},o.voiceQueues=s.rpc.getVoiceQueues({fields:"id,name"}),o.init=function(e,t){return o.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},o.customDashboard=e,o.customDashboard.draggable={enabled:!0,handle:".draggable",stop:r},o.customDashboard.resizable={enabled:!0,handle:".resizable",stop:r},o.customDashboard.widgets=[],s.dashboard.getItems({id:e.id}).$promise.then(function(e){if(e&&e.count&&e.rows)for(var t=0;t<e.rows.length;t+=1)e.rows[t].voiceQueues=o.voiceQueues,e.rows[t].voiceQueuesSelected=_.map(o.voiceQueues.rows,"id"),e.rows[t].templateUrl="app/core/directives/ms-widget-engine/ms-widget-engine-"+e.rows[t].type+"/ms-widget-engine."+e.rows[t].type+".html",o.customDashboard.widgets.push(e.rows[t])}).catch(function(e){console.error(e)})},o.createOrEditWidget=function(e){if(e&&e.attrs)for(var t=0;t<e.attrs.length;t+=1)"attrReport"===e.attrs[t].name&&(e.reportType=e.attrs[t].type),e[e.attrs[t].name]=e.attrs[t].value;n.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:o.customDashboard.widgets,license:null,setting:null,crudPermissions:o.crudPermissions}}).then(function(e){if(e)for(var t=0;t<o.customDashboard.widgets.length;t+=1)o.customDashboard.widgets[t].id===e.id&&(o.customDashboard.widgets[t].attrs=e.attrs,o.customDashboard.widgets[t].voiceQueues=o.voiceQueues,o.customDashboard.widgets[t].voiceQueuesSelected=_.map(o.voiceQueues.rows,"id"),o.customDashboard.widgets[t].templateUrl="app/core/directives/ms-widget-engine/ms-widget-engine-"+o.customDashboard.widgets[t].type+"/ms-widget-engine."+o.customDashboard.widgets[t].type+".html")})},o.deleteWidget=function(t){var e=n.confirm().title("Would you like to delete "+t.title+"?").textContent("").ariaLabel("Delete Widget").ok("YES").cancel("NO");n.show(e).then(function(){return s.dashboardItem.delete({id:t.id}).$promise.then(function(e){_.remove(o.customDashboard.widgets,{id:t.id}),i.success({title:"Widget deleted!",msg:t.name?t.name+" has been deleted!":"Widget has been deleted!"})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){o.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETE.customDashboard"}];for(var t=0;t<e.data.errors.length;t++)i.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else i.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","socket","toasty","api"],angular.module("app.tools").controller("CustomDashboardItemsController",e)}(),function(){"use strict";function e(t,e,n,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",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 t=0;t<e.data.errors.length;t+=1)s.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.dashboard,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)s.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The dashboarditem will be deleted.").ariaLabel("Delete DashboardItem").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)s.error({title:e.data.errors[t].type,msg:e.data.errors[t].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.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))}t.dashboarditemForm.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=(t={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,t}).catch(function(e){s.error({title:"ERROR",msg:e.message})}):t),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 t},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:A,select_node:b}:{loaded:y,select_node:E}}function b(e,t){g.treeDefaultInstance.jstree(!0).deselect_all(),g.treeDefaultInstance.jstree(!0).close_all(),g.currentNode=t.node,g.currentNode.custom=!0,g.currentPath=g.treeCustomInstance.jstree(!0).get_path(g.currentNode).join("/ "),g.apiName="analyticCustomReport",g.query.parent=t.node.id,S()}function E(e,t){g.treeCustomInstance.jstree(!0).deselect_all(),g.treeCustomInstance.jstree(!0).close_all(),g.currentNode=t.node,g.currentNode.custom=!1,g.currentPath=g.treeDefaultInstance.jstree(!0).get_path(g.currentNode).join("/ "),g.apiName="analyticDefaultReport",g.query.parent=t.node.id,S()}function A(){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);E(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 t=e&&e.rows?e.rows:[];if(0<t.length){var n=[];return a.forEach(function(e){_.find(t,["resourceId",e.id])&&n.push(e)}),T({count:n.length,rows:n})}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=[],t=0;t<v.length;t++)e.push(d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:v[t].id}).$promise);return o.all(e)}).then(function(e){for(var t=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),n=[],a=0;a<v.length;a++){var i=_.find(t,["sectionId",v[a].id]);if(i)if(i.autoAssociation){var s=[];h.forEach(function(e){e.type===v[a].type&&s.push(e)}),n.push({rows:s,count:s.length})}else n.push(d.userProfileResource.get({sectionId:i.id}).$promise)}return o.all(n)}).then(function(e){var t=[],n=null;g.dashboarditem&&(n=_.find(h,{id:Number(g.dashboarditem.attrVoiceQueues)}));for(var a=0;a<e.length;a++){(e[a].rows||[]).forEach(function(e){t.push(e)})}n&&!_.some(t,["resourceId",n.id])&&h.forEach(function(e){e.id===n.id&&(e.canSelect=!1,t.push(e))}),g.voiceQueues=t}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueues",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(n,e,a,i,t,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||n.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=n.params.tab||0,u.clonedialog=function(e,t){a.show({controller:"CustomDashboardcloneController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/customDashboards/edit/clone/clone.html",parent:angular.element(i.body),targetEvent:t,clickOutsideToClose:!0,locals:{customDashboard:e,customDashboards:u.customDashboards?u.customDashboards.rows:[],crudPermissions:u.crudPermissions}})},u.gotogoto=function(e,t){n.go("app.dashboards.custom",{id:e.id})},u.alert=l.info,u.gotoCustomDashboards=function(){n.go("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(e,t,n,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_DISPOSITION",g.disposition=angular.copy(l),g.dispositions=r,g.newDisposition=!1,g.disposition||(g.disposition={},g.title="TOOLS.NEW_DISPOSITION",g.newDisposition=!0),g.addNewDisposition=function(){g.errors=[],d.disposition.save(g.disposition).$promise.then(function(e){g.dispositions.unshift(e.toJSON()),o.success({title:"Disposition properly created",msg:g.disposition.name?g.disposition.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.disposition.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveDisposition=function(){g.errors=[],d.disposition.update({id:g.disposition.id},g.disposition).$promise.then(function(e){var t=_.find(g.dispositions,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"Disposition properly saved!",msg:g.disposition.name?g.disposition.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.disposition.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteDisposition=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The disposition will be deleted.").ariaLabel("Delete Disposition").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.disposition.delete({id:g.disposition.id}).$promise.then(function(){_.remove(g.dispositions,{id:g.disposition.id}),o.success({title:"Disposition properly deleted!",msg:(g.disposition.name||"disposition")+" has been deleted!"}),v(g.disposition)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.disposition.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.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","dispositions","disposition","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditDispositionDialogController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.dispositions=l||{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="dispositions",b.listOrder="",b.listOrderAsc=null,b.selectedDispositions=[],b.query={fields:"createdAt,updatedAt,id,name",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",limit:10,page:1},b.editdialog=function(e,t){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{disposition:e,dispositions:b.dispositions.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.deleteconfirm=function(e,t){var n=i.confirm().title("Are you sure want to delete the "+_.startCase("disposition")+"?").htmlContent("<b>"+(e.name||"disposition")+"</b> will be deleted.").ariaLabel("delete disposition").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getDispositions=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.disposition.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Dispositions",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditDisposition=function(e,t){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:t,dispositions:b.dispositions.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteDisposition=S,b.exportSelectedDispositions=function(){var e=angular.copy(b.selectedDispositions);return b.selectedDispositions=[],e},b.deleteSelectedDispositions=function(e){var t=i.confirm().title("Are you sure want to delete the selected dispositions?").htmlContent("<b>"+b.selectedDispositions.length+" selected</b> will be deleted.").ariaLabel("delete Dispositions").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedDispositions.forEach(function(e){S(e)}),b.selectedDispositions=[]})},b.deselectDispositions=function(){b.selectedDispositions=[]},b.selectAllDispositions=function(){b.selectedDispositions=b.dispositions.rows};var E=!0,A=1;function y(e){b.dispositions=e||{count:0,rows:[]}}function S(e){m.disposition.delete({id:e.id}).$promise.then(function(){_.remove(b.dispositions.rows,{id:e.id}),b.dispositions.count-=1,b.dispositions.rows.length||b.getDispositions(),p.success({title:_.startCase("Disposition")+" 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:DELETEdisposition"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getDispositions())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","dispositions","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.tools").controller("DispositionsController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.intervals,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The interval will be deleted.").ariaLabel("Delete Interval").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,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 E(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var t=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),n=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(t+"-"+n)}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 A(e){t.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=E(),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!":""}),A()}).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=E(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),A(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var t=_.find(c.intervals,{id:e.id});t&&_.merge(t,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),A()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=A,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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=e&&e.rows?e.rows:[],n=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(t,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,n.push(e))}),c.intervals=n})}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,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.interval={},c.intervalIntervals={count:0,rows:[]},c.selectedIntervalIntervals=[],c.crudPermissions,c.sortableTable={animation:100,onSort:function(e){l.interval.addIntervals({id:c.interval.id},e.models).$promise.then(function(e){c.intervalIntervals.rows=e}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:SORTABLETABLE",msg:e.data?JSON.stringify(e.data):e.toString()})})}},c.query={fields:"createdAt,updatedAt,id,name,interval",nolimit:"true",limit:10,page:1},c.init=function(e,t){c.interval=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.sortableTable.disabled=!c.crudPermissions.canEdit,c.query.id=c.interval.id,c.getIntervalIntervals()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the interval?").htmlContent("<b>"+(e.name||"interval")+"</b> will be deleted.").ariaLabel("delete interval").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getIntervalIntervals=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.interval.getIntervals(c.query,p).$promise},c.createOrEditIntervalInterval=function(e,t){s.show({controller:"EditAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/intervals/edit/apps/interval/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:c.interval,interval:t,intervals:c.intervalIntervals.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedIntervalIntervals=function(){var e=angular.copy(c.selectedIntervalIntervals);return c.selectedIntervalIntervals=[],e},c.deleteIntervalInterval=g,c.deleteSelectedIntervalIntervals=function(e){var t=s.confirm().title("Are you sure want to delete the selected intervals?").htmlContent("<b>"+c.selectedIntervalIntervals.length+" selected</b> will be deleted.").ariaLabel("delete intervals").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedIntervalIntervals.forEach(function(e){g(e)}),c.selectedIntervalIntervals=[]})};var m=!0,u=1;function p(e){c.intervalIntervals=e||{count:0,rows:[]}}function g(e){l.interval.delete({id:e.id}).$promise.then(function(){_.remove(c.intervalIntervals.rows,{id:e.id}),c.intervalIntervals.count-=1,c.intervalIntervals.rows.length||c.getIntervalIntervals(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETinterval"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getIntervalIntervals())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.tools").controller("IntervalIntervalsController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.intervals,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The interval will be deleted.").ariaLabel("Delete Interval").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,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=t.protocol()+"://"+t.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")},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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.intervals=l||{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="intervals",b.listOrder="",b.listOrderAsc=null,b.selectedIntervals=[],b.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",IntervalId:"null",limit:10,page:1},b.editstate=function(e,t){n.go("app.tools.intervals.edit",{id:e.id,interval:e,crudPermissions:b.crudPermissions})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getIntervals=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.interval.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Intervals",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditInterval=function(e,t){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:t,intervals:b.intervals.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteInterval=S,b.exportSelectedIntervals=function(){var e=angular.copy(b.selectedIntervals);return b.selectedIntervals=[],e},b.deleteSelectedIntervals=function(e){var t=i.confirm().title("Are you sure want to delete the selected intervals?").htmlContent("<b>"+b.selectedIntervals.length+" selected</b> will be deleted.").ariaLabel("delete Intervals").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedIntervals.forEach(function(e){S(e)}),b.selectedIntervals=[]})},b.deselectIntervals=function(){b.selectedIntervals=[]},b.selectAllIntervals=function(){b.selectedIntervals=b.intervals.rows};var E=!0,A=1;function y(e){b.intervals=e||{count:0,rows:[]}}function S(e){m.interval.delete({id:e.id}).$promise.then(function(){_.remove(b.intervals.rows,{id:e.id}),b.intervals.count-=1,b.intervals.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEinterval"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getIntervals())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","intervals","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.tools").controller("IntervalsController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.pauses,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The pause will be deleted.").ariaLabel("Delete Pause").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.pauses=l||{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="pauses",b.listOrder="",b.listOrderAsc=null,b.selectedPauses=[],b.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},b.editdialog=function(e,t){i.show({controller:"CreateOrEditPauseDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/pauses/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{pause:e,pauses:b.pauses.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getPauses=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.pause.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Pauses",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditPause=function(e,t){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:t,pauses:b.pauses.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deletePause=S,b.exportSelectedPauses=function(){var e=angular.copy(b.selectedPauses);return b.selectedPauses=[],e},b.deleteSelectedPauses=function(e){var t=i.confirm().title("Are you sure want to delete the selected pauses?").htmlContent("<b>"+b.selectedPauses.length+" selected</b> will be deleted.").ariaLabel("delete Pauses").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedPauses.forEach(function(e){S(e)}),b.selectedPauses=[]})},b.deselectPauses=function(){b.selectedPauses=[]},b.selectAllPauses=function(){b.selectedPauses=b.pauses.rows};var E=!0,A=1;function y(e){b.pauses=e||{count:0,rows:[]}}function S(e){m.pause.delete({id:e.id}).$promise.then(function(){_.remove(b.pauses.rows,{id:e.id}),b.pauses.count-=1,b.pauses.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEpause"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getPauses())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","pauses","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.tools").controller("PausesController",e)}(),function(){"use strict";function e(e,t,n,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:E,select_node:f}:{loaded:A,select_node:b}}function f(e,t){g.treeDefaultInstance.jstree(!0).deselect_all(),g.treeDefaultInstance.jstree(!0).close_all(),g.currentNode=t.node,g.currentNode.custom=!0,g.currentPath=g.treeCustomInstance.jstree(!0).get_path(g.currentNode).join("/ "),g.apiName="analyticCustomReport",g.query.parent=t.node.id,y()}function b(e,t){g.treeCustomInstance.jstree(!0).deselect_all(),g.treeCustomInstance.jstree(!0).close_all(),g.currentNode=t.node,g.currentNode.custom=!1,g.currentPath=g.treeDefaultInstance.jstree(!0).get_path(g.currentNode).join("/ "),g.apiName="analyticDefaultReport",g.query.parent=t.node.id,y()}function E(){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 A(){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 t=e&&e.rows?e.rows:[];if(0<t.length){var n=[];return a.forEach(function(e){_.find(t,["resourceId",e.id])&&n.push(e)}),S({count:n.length,rows:n})}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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.schedules,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The schedule will be deleted.").ariaLabel("Delete Schedule").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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.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=(t={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,t}).catch(function(e){o.error({title:"ERROR",msg:e.message})}):t),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 t},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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.mailAccounts,{id:e.resourceId})}),n=null;if(g.schedule&&(n=_.find(g.mailAccounts,{id:Number(g.schedule.MailAccountId)})),n&&!_.some(t,["id",n.id])){var a=_.find(g.mailAccounts,{id:n.id});a.canSelect=!1,t.push(a)}g.mailAccounts=t})}else{var n=[],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,n.push(g.mailAccounts[i]));g.mailAccounts=n}}).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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.schedules=l||{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="schedules",b.listOrder="",b.listOrderAsc=null,b.selectedScheduler=[],b.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},b.arrayoutput=_.keyBy([{option:"CSV",value:"'csv'"},{option:"PDF",value:"'pdf'"},{option:"Excel",value:"'xlsx'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.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"),"")}),b.editdialog=function(e,t){i.show({controller:"CreateOrEditScheduleDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/schedules/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{schedule:e,schedules:b.schedules.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.runconfirm=function(e,t){var n=i.confirm().title("Are you sure want to run the schedule?").htmlContent("<b>"+(e.name||"schedule")+"</b> will be run.").ariaLabel("delete schedule").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){return m.schedule.run({id:e.id}).$promise},function(){console.log("CANCEL")})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getScheduler=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.schedule.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Scheduler",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditSchedule=function(e,t){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:t,schedules:b.schedules.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteSchedule=S,b.exportSelectedScheduler=function(){var e=angular.copy(b.selectedScheduler);return b.selectedScheduler=[],e},b.deleteSelectedScheduler=function(e){var t=i.confirm().title("Are you sure want to delete the selected schedules?").htmlContent("<b>"+b.selectedScheduler.length+" selected</b> will be deleted.").ariaLabel("delete Schedules").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedScheduler.forEach(function(e){S(e)}),b.selectedScheduler=[]})},b.deselectScheduler=function(){b.selectedScheduler=[]},b.selectAllScheduler=function(){b.selectedScheduler=b.schedules.rows},m.analyticTreeReport.get({}).$promise.then(function(e){b.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){b.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){b.mailAccounts=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:602}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(b.mailAccounts,{id:e.resourceId})}),n=null;if(b.schedule&&(n=_.find(b.mailAccounts,{id:Number(b.schedule.MailAccountId)})),n&&!_.some(t,["id",n.id])){var a=_.find(b.mailAccounts,{id:n.id});a.canSelect=!1,t.push(a)}b.mailAccounts=t})}else{var n=[],a=null;b.schedule&&(a=_.find(b.mailAccounts,{id:Number(b.schedule.MailAccountId)}));for(var i=0;i<b.mailAccounts.length;i++)a&&b.mailAccounts[i].id===a.id&&(b.mailAccounts[i].canSelect=!1,n.push(b.mailAccounts[i]));b.mailAccounts=n}}).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 E=!0,A=1;function y(e){b.schedules=e||{count:0,rows:[]}}function S(e){m.schedule.delete({id:e.id}).$promise.then(function(){_.remove(b.schedules.rows,{id:e.id}),b.schedules.count-=1,b.schedules.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEschedule"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getScheduler())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","schedules","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.tools").controller("SchedulesController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.sounds,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The sound will be deleted.").ariaLabel("Delete Sound").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.sounds=l||{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="sounds",b.listOrder="",b.listOrderAsc=null,b.selectedSounds=[],b.query={fields:"createdAt,updatedAt,id,save_name,converted_format,name,audio,description",sort:"-updatedAt",limit:10,page:1},b.editdialog=function(e,t){i.show({controller:"CreateOrEditSoundDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/sounds/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{sound:e,sounds:b.sounds.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.downloadfile2=function(s,e){return m.sound.download({id:s.id}).$promise.then(function(e){var t=[e.buffer],n="download",a=new Blob(t,{type:e.type});n=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",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getSounds=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.sound.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Sounds",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditSound=function(e,t){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:t,sounds:b.sounds.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteSound=S,b.exportSelectedSounds=function(){var e=angular.copy(b.selectedSounds);return b.selectedSounds=[],e},b.deleteSelectedSounds=function(e){var t=i.confirm().title("Are you sure want to delete the selected sounds?").htmlContent("<b>"+b.selectedSounds.length+" selected</b> will be deleted.").ariaLabel("delete Sounds").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedSounds.forEach(function(e){S(e)}),b.selectedSounds=[]})},b.deselectSounds=function(){b.selectedSounds=[]},b.selectAllSounds=function(){b.selectedSounds=b.sounds.rows},b.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:b.sounds.rows}})};var E=!0,A=1;function y(e){b.sounds=e||{count:0,rows:[]}}function S(e){m.sound.delete({id:e.id}).$promise.then(function(){_.remove(b.sounds.rows,{id:e.id}),b.sounds.count-=1,b.sounds.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEsound"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getSounds())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","sounds","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.tools").controller("SoundsController",e)}(),function(){"use strict";function e(e,t,n,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 t=["wav","mp3","gsm"];if(!_.includes(t,e.getExtension()))return n.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+t.join()}),!1;if(e.size>l)return n.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(t,e){if(t.id===a.uniqueIdentifier){var n=new FileReader;n.readAsDataURL(t.file.file),n.onload=function(e){t.url=e.target.result}}})},o.uploadError=function(e,t){o.ngFlow.flow.cancel(),n.error({title:"Upload error",msg:"Cannot upload the sound"}),o.uploadState="failed"},o.uploadComplete=function(){"failed"!==o.uploadState&&(o.uploadState="completed",n.success({title:"Upload completed",msg:o.sound.file.name+" uploaded successfully"}))},o.closeDialog=function(){t.hide()}}e.$inject=["$cookies","$mdDialog","toasty","sounds","api","Auth"],angular.module("app.tools").controller("UploadSoundDialogController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.tags,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The tag will be deleted.").ariaLabel("Delete Tag").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.tags=l||{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="tags",b.listOrder="",b.listOrderAsc=null,b.selectedTags=[],b.query={fields:"createdAt,updatedAt,id,name,description,color",sort:"-updatedAt",limit:10,page:1},b.editdialog=function(e,t){i.show({controller:"CreateOrEditTagDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/tags/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{tag:e,tags:b.tags.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getTags=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.tag.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Tags",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditTag=function(e,t){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:t,tags:b.tags.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteTag=S,b.exportSelectedTags=function(){var e=angular.copy(b.selectedTags);return b.selectedTags=[],e},b.deleteSelectedTags=function(e){var t=i.confirm().title("Are you sure want to delete the selected tags?").htmlContent("<b>"+b.selectedTags.length+" selected</b> will be deleted.").ariaLabel("delete Tags").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedTags.forEach(function(e){S(e)}),b.selectedTags=[]})},b.deselectTags=function(){b.selectedTags=[]},b.selectAllTags=function(){b.selectedTags=b.tags.rows};var E=!0,A=1;function y(e){b.tags=e||{count:0,rows:[]}}function S(e){m.tag.delete({id:e.id}).$promise.then(function(){_.remove(b.tags.rows,{id:e.id}),b.tags.count-=1,b.tags.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEtag"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getTags())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","tags","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.tools").controller("TagsController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.templates,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The template will be deleted.").ariaLabel("Delete Template").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.templates=l||{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="templates",b.listOrder="",b.listOrderAsc=null,b.selectedTemplates=[],b.query={fields:"createdAt,updatedAt,id,name,html,description",sort:"-updatedAt",limit:10,page:1},b.editdialog=function(e,t){i.show({controller:"CreateOrEditTemplateDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/templates/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{template:e,templates:b.templates.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getTemplates=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.template.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Templates",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditTemplate=function(e,t){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:t,templates:b.templates.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteTemplate=S,b.exportSelectedTemplates=function(){var e=angular.copy(b.selectedTemplates);return b.selectedTemplates=[],e},b.deleteSelectedTemplates=function(e){var t=i.confirm().title("Are you sure want to delete the selected templates?").htmlContent("<b>"+b.selectedTemplates.length+" selected</b> will be deleted.").ariaLabel("delete Templates").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedTemplates.forEach(function(e){S(e)}),b.selectedTemplates=[]})},b.deselectTemplates=function(){b.selectedTemplates=[]},b.selectAllTemplates=function(){b.selectedTemplates=b.templates.rows};var E=!0,A=1;function y(e){b.templates=e||{count:0,rows:[]}}function S(e){m.template.delete({id:e.id}).$promise.then(function(){_.remove(b.templates.rows,{id:e.id}),b.templates.count-=1,b.templates.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEtemplate"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getTemplates())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","templates","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.tools").controller("TemplatesController",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(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_TRIGGER",g.trigger=angular.copy(l),g.triggers=r,g.newTrigger=!1,g.trigger||(g.trigger={channel:"voice"},g.title="TOOLS.NEW_TRIGGER",g.newTrigger=!0),g.addNewTrigger=function(){g.errors=[],d.trigger.save(g.trigger).$promise.then(function(e){g.triggers.unshift(e.toJSON()),o.success({title:"Trigger properly created",msg:g.trigger.name?g.trigger.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.trigger.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trigger.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveTrigger=function(){g.errors=[],d.trigger.update({id:g.trigger.id},g.trigger).$promise.then(function(e){var t=_.find(g.triggers,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"Trigger properly saved!",msg:g.trigger.name?g.trigger.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.trigger.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trigger.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteTrigger=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The trigger will be deleted.").ariaLabel("Delete Trigger").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.trigger.delete({id:g.trigger.id}).$promise.then(function(){_.remove(g.triggers,{id:g.trigger.id}),o.success({title:"Trigger properly deleted!",msg:(g.trigger.name||"trigger")+" has been deleted!"}),v(g.trigger)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.trigger.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.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(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","triggers","trigger","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditTriggerDialogController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.trigger={},c.triggerActions={count:0,rows:[]},c.selectedTriggerActions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,action,data1,data2,data7,data3,data4,data5,data6",limit:10,page:1},c.arrayaction=_.keyBy([{option:"CONTACT_MANAGER",value:"'contactManager'",ngIf:"vm.trigger.channel == 'voice'"},{option:"INTEGRATIONS",value:"'integration'",ngIf:"vm.trigger.channel == 'voice' && ((vm.newAction && vm.hasModulePermissions.Integrations) || !vm.newAction)"},{option:"MOTION_BAR",value:"'motionbar'"},{option:"JSCRIPTY",value:"'jscripty'"},{option:"URL_FORWARD",value:"'urlForward'"},{option:"BROWSER",value:"'browser'"},{option:"BOT",value:"'bot'",ngIf:"vm.trigger.channel == 'voice'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.browserValues=_.keyBy([{option:"Popup",value:"'0'"},{option:"CTI URL",value:"'1'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.autoCreateContact=_.keyBy([{option:"yes",value:"'1'"},{option:"no",value:"'0'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.urlForwardValues=_.keyBy([{option:"GET",value:"'GET'"},{option:"POST",value:"'POST'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.integrationValues=_.keyBy([{option:"Zendesk",value:"'zendesk'",ngIf:"(vm.newAction && vm.hasSectionPermissions[1301]) || !vm.newAction",disabled:"(!vm.newAction && !vm.hasSectionPermissions[1301])"},{option:"Salesforce",value:"'salesforce'",ngIf:"(vm.newAction && vm.hasSectionPermissions[1302]) || !vm.newAction",disabled:"(!vm.newAction && !vm.hasSectionPermissions[1302])"},{option:"SugarCRM",value:"'sugarcrm'",ngIf:"(vm.newAction && vm.hasSectionPermissions[1305]) || !vm.newAction",disabled:"(!vm.newAction && !vm.hasSectionPermissions[1305])"},{option:"Freshdesk",value:"'freshdesk'",ngIf:"(vm.newAction && vm.hasSectionPermissions[1303]) || !vm.newAction",disabled:"(!vm.newAction && !vm.hasSectionPermissions[1303])"},{option:"Desk",value:"'desk'",ngIf:"(vm.newAction && vm.hasSectionPermissions[1306]) || !vm.newAction",disabled:"(!vm.newAction && !vm.hasSectionPermissions[1306])"},{option:"Zoho",value:"'zoho'",ngIf:"(vm.newAction && vm.hasSectionPermissions[1307]) || !vm.newAction",disabled:"(!vm.newAction && !vm.hasSectionPermissions[1307])"},{option:"vTiger",value:"'vtiger'",ngIf:"(vm.newAction && vm.hasSectionPermissions[1308]) || !vm.newAction",disabled:"(!vm.newAction && !vm.hasSectionPermissions[1308])"},{option:"Dynamics365",value:"'dynamics365'",ngIf:"(vm.newAction && vm.hasSectionPermissions[1309]) || !vm.newAction",disabled:"(!vm.newAction && !vm.hasSectionPermissions[1309])"},{option:"ServiceNow",value:"'servicenow'",ngIf:"(vm.newAction && vm.hasSectionPermissions[1310]) || !vm.newAction",disabled:"(!vm.newAction && !vm.hasSectionPermissions[1310])"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.motionbarValues=_.keyBy([{option:"Popup",value:"'0'"},{option:"CTI URL",value:"'1'"},{option:"Windows App",value:"'2'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.eventVariables=_.keyBy([{option:"yes",value:"'1'"},{option:"no",value:"'0'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.location=_.keyBy([{option:"NEW_TAB",value:"'0'"},{option:"NEW_WINDOW",value:"'1'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.init=function(e,t){c.trigger=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.trigger.id,c.query.ActionId=c.trigger.id,c.getTriggerActions(),n=[1301,1302,1303,1305,1306,1307,1308],d.hasModulesPermissions(["Integrations"]).then(function(e){c.hasModulePermissions=_.merge(c.hasModulePermissions,e)}).then(function(){d.hasSectionsPermissions(n).then(function(e){c.hasSectionPermissions=_.merge(c.hasSectionPermissions,e)})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTEGRATIONS_PERMISSIONS",msg:e.data?JSON.stringify(e.data):e.toString()})});var n},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the action?").htmlContent("<b>"+(e.name||"action")+"</b> will be deleted.").ariaLabel("delete action").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getTriggerActions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.trigger.getActions(c.query,p).$promise},c.createOrEditTriggerAction=function(e,t){s.show({controller:"CreateOrEditActionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/triggers/edit/actions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{trigger:c.trigger,action:t,actions:c.triggerActions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedTriggerActions=function(){var e=angular.copy(c.selectedTriggerActions);return c.selectedTriggerActions=[],e},c.deleteTriggerAction=g,c.deleteSelectedTriggerActions=function(e){var t=s.confirm().title("Are you sure want to delete the selected actions?").htmlContent("<b>"+c.selectedTriggerActions.length+" selected</b> will be deleted.").ariaLabel("delete actions").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedTriggerActions.forEach(function(e){g(e)}),c.selectedTriggerActions=[]})},d.hasRole("admin")?l.cmList.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){c.lists=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.cmList.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){c.lists=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(c.lists,{id:e.resourceId})}),a=null;a=[],c.triggerActions.rows.forEach(function(e){if("contactManager"===e.action){var t=_.find(c.lists,{id:Number(e.data1)});a.push(t)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(c.lists,{id:e.id});t.canSelect=!1,n.push(t)}}),c.lists=n})}else{var n=[],a=[];c.triggerActions.rows.forEach(function(e){if("contactManager"===e.action){var t=_.find(c.lists,{id:Number(e.data1)});a.push(t)}});for(var i=0;i<c.lists.length;i++){_.some(a,{id:c.lists[i].id})&&(c.lists[i].canSelect=!1,n.push(c.lists[i]))}c.lists=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?l.jscriptyProject.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){c.projects=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PROJECTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.jscriptyProject.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){c.projects=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1701}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(c.projects,{id:e.resourceId})}),a=null;a=[],c.triggerActions.rows.forEach(function(e){if("jscripty"===e.action){var t=_.find(c.projects,{id:Number(e.data1)});a.push(t)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(c.projects,{id:e.id});t.canSelect=!1,n.push(t)}}),c.projects=n})}else{var n=[],a=[];c.triggerActions.rows.forEach(function(e){if("jscripty"===e.action){var t=_.find(c.projects,{id:Number(e.data1)});a.push(t)}});for(var i=0;i<c.projects.length;i++){_.some(a,{id:c.projects[i].id})&&(c.projects[i].canSelect=!1,n.push(c.projects[i]))}c.projects=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intZendeskAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.zendeskAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_ZENDESKACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intDeskAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.deskAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_DESKACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intZohoAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.zohoAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_ZOHOACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intSalesforceAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.salesforceAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SALESFORCEACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intSugarcrmAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.sugarcrmAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SUGARCRMACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intFreshdeskAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.freshdeskAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_FRESHDESKACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intVtigerAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.vtigerAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VTIGERACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intDynamics365Account.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.dynamics365Accounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_DYNAMICS365ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intServicenowAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.servicenowAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SERVICENOWACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intZendeskConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){c.zendeskConfigurations=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_ZENDESKCONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intDeskConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){c.deskConfigurations=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_DESKCONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intZohoConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){c.zohoConfigurations=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_ZOHOCONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intSalesforceConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){c.salesforceConfigurations=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SALESFORCECONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intSugarcrmConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){c.sugarcrmConfigurations=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SUGARCRMCONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intFreshdeskConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){c.freshdeskConfigurations=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_FRESHDESKCONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intVtigerConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){c.vtigerConfigurations=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VTIGERCONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intDynamics365Configuration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){c.dynamics365Configurations=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_DYNAMICS365CONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intServicenowConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){c.servicenowConfigurations=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SERVICENOWCONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?l.template.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.templates=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEMPLATES",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.template.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.templates=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1009}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(c.templates,{id:e.resourceId})}),a=null;a=[],c.triggerActions.rows.forEach(function(e){if("motionbar"===e.action){var t=_.find(c.templates,{id:Number(e.data2)});a.push(t)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(c.templates,{id:e.id});t.canSelect=!1,n.push(t)}}),c.templates=n})}else{var n=[],a=[];c.triggerActions.rows.forEach(function(e){if("motionbar"===e.action){var t=_.find(c.templates,{id:Number(e.data2)});a.push(t)}});for(var i=0;i<c.templates.length;i++){_.some(a,{id:c.templates[i].id})&&(c.templates[i].canSelect=!1,n.push(c.templates[i]))}c.templates=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtemplates",msg:e.data?JSON.stringify(e.data):e.toString()})});var m=!0,u=1;function p(e){c.triggerActions=e||{count:0,rows:[]}}function g(e){l.action.delete({id:e.id}).$promise.then(function(){_.remove(c.triggerActions.rows,{id:e.id}),c.triggerActions.count-=1,c.triggerActions.rows.length||c.getTriggerActions(),r.success({title:"Action deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETtrigger"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrigger",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getTriggerActions())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.tools").controller("TriggerActionsController",e)}(),function(){"use strict";function e(e,t,n,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="TOOLS.EDIT_ACTION",v.action=angular.copy(l),v.actions=r,v.newAction=!1,v.trigger=angular.copy(d),v.action||(v.action={data3:"0",data4:"0",data5:"800",data6:"600"},v.title="TOOLS.NEW_ACTION",v.newAction=!0),t.params.id&&(v.action.ActionId=t.params.id),v.addNewAction=function(){v.errors=[],c.trigger.addAction({id:t.params.id},v.action).$promise.then(function(e){v.actions.unshift(e.toJSON()),o.success({title:"Action properly created",msg:v.action.name?v.action.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.action.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.action.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.saveAction=function(){v.errors=[],c.action.update({id:v.action.id},v.action).$promise.then(function(e){var t=_.find(v.actions,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"Action properly saved!",msg:v.action.name?v.action.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.action.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.action.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.deleteAction=function(e){v.errors=[];var t=a.confirm().title("Are you sure?").content("The action will be deleted.").ariaLabel("Delete Action").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){c.action.delete({id:v.action.id}).$promise.then(function(){_.remove(v.actions,{id:v.action.id}),o.success({title:"Action properly deleted!",msg:(v.action.name||"action")+" has been deleted!"}),h(v.action)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.action.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.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(){})},v.getDateFromString=function(e){return null===e?void 0:new Date(e)},v.onActionInit=function(){m.hasModulesPermissions(["Integrations"]).then(function(e){v.hasModulePermissions=_.merge(v.hasModulePermissions,e)}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MODULES_PERMISSIONS",msg:e.data?JSON.stringify(e.data):e.toString()})})},v.onIntegrationInit=function(){m.hasSectionsPermissions([1301,1302,1303,1305,1306,1307,1308,1309,1310]).then(function(e){v.hasSectionPermissions=_.merge(v.hasSectionPermissions,e)}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SECTIONS_PERMISSIONS",msg:e.data?JSON.stringify(e.data):e.toString()})})},v.closeDialog=h,m.hasRole("admin")?c.cmList.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){v.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()})}):c.cmList.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){v.lists=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return c.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(v.lists,{id:e.resourceId})}),n=null;if(v.action&&(n=_.find(v.lists,{id:Number(v.action.data1)})),n&&!_.some(t,["id",n.id])){var a=_.find(v.lists,{id:n.id});a.canSelect=!1,t.push(a)}v.lists=t})}else{var n=[],a=null;v.action&&(a=_.find(v.lists,{id:Number(v.action.data1)}));for(var i=0;i<v.lists.length;i++)a&&v.lists[i].id===a.id&&(v.lists[i].canSelect=!1,n.push(v.lists[i]));v.lists=n}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),m.hasRole("admin")?c.jscriptyProject.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){v.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()})}):c.jscriptyProject.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){v.projects=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:1701}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return c.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(v.projects,{id:e.resourceId})}),n=null;if(v.action&&(n=_.find(v.projects,{id:Number(v.action.data1)})),n&&!_.some(t,["id",n.id])){var a=_.find(v.projects,{id:n.id});a.canSelect=!1,t.push(a)}v.projects=t})}else{var n=[],a=null;v.action&&(a=_.find(v.projects,{id:Number(v.action.data1)}));for(var i=0;i<v.projects.length;i++)a&&v.projects[i].id===a.id&&(v.projects[i].canSelect=!1,n.push(v.projects[i]));v.projects=n}}).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.intZendeskAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.zendeskAccounts=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_ZENDESKACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intDeskAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.deskAccounts=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_DESKACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intZohoAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.zohoAccounts=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_ZOHOACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intSalesforceAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.salesforceAccounts=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SALESFORCEACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intSugarcrmAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.sugarcrmAccounts=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SUGARCRMACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intFreshdeskAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.freshdeskAccounts=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_FRESHDESKACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intVtigerAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.vtigerAccounts=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VTIGERACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intDynamics365Account.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.dynamics365Accounts=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_DYNAMICS365ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intServicenowAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.servicenowAccounts=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SERVICENOWACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intZendeskConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){v.zendeskConfigurations=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_ZENDESKCONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intDeskConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){v.deskConfigurations=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_DESKCONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intZohoConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){v.zohoConfigurations=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_ZOHOCONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intSalesforceConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){v.salesforceConfigurations=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SALESFORCECONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intSugarcrmConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){v.sugarcrmConfigurations=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SUGARCRMCONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intFreshdeskConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){v.freshdeskConfigurations=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_FRESHDESKCONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intVtigerConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){v.vtigerConfigurations=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VTIGERCONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intDynamics365Configuration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){v.dynamics365Configurations=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_DYNAMICS365CONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intServicenowConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){v.servicenowConfigurations=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SERVICENOWCONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),m.hasRole("admin")?c.template.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.templates=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEMPLATES",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.template.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.templates=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:1009}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return c.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(v.templates,{id:e.resourceId})}),n=null;if(v.action&&(n=_.find(v.templates,{id:Number(v.action.data2)})),n&&!_.some(t,["id",n.id])){var a=_.find(v.templates,{id:n.id});a.canSelect=!1,t.push(a)}v.templates=t})}else{var n=[],a=null;v.action&&(a=_.find(v.templates,{id:Number(v.action.data2)}));for(var i=0;i<v.templates.length;i++)a&&v.templates[i].id===a.id&&(v.templates[i].canSelect=!1,n.push(v.templates[i]));v.templates=n}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtemplates",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","actions","action","trigger","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditActionDialogController",e)}(),function(){"use strict";function e(e,t,n,o,a,i,s,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.trigger={},c.triggerAllConditions={count:0,rows:[]},c.selectedTriggerAllConditions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,field,operator,value",limit:10,page:1},c.arrayfield=_.keyBy([{option:"Queue",value:"'queue'",ngIf:"vm.trigger.channel == 'voice'"},{option:"Call_Status",value:"'lastevent'",ngIf:"vm.trigger.channel == 'voice'"},{option:"OutboundRoute",value:"'routeId'",ngIf:"vm.trigger.channel == 'voice'"},{option:"Account",value:"'account'",ngIf:"vm.trigger.channel != 'voice'"},{option:"Interaction",value:"'interaction'",ngIf:"vm.trigger.channel != 'voice'"},{option:"Message",value:"'message'",ngIf:"vm.trigger.channel != 'voice'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.arrayoperator=_.keyBy([{option:"Equals",value:"'equals'"},{option:"Not_Equals",value:"'not_equals'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.callStatusValues=_.keyBy([{option:"Abandon",value:"'abandoned'"},{option:"Hangup",value:"'complete'"},{option:"Reject",value:"'rejected'"},{option:"Ring",value:"'called'"},{option:"Answer",value:"'connect'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.interactionStatusValues=_.keyBy([{option:"Opened",value:"'opened'"},{option:"Closed",value:"'closed'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.messageStatusValues=_.keyBy([{option:"Incoming",value:"'in'"},{option:"Outgoing",value:"'out'"},{option:"Accepted",value:"'accept'"},{option:"Rejected",value:"'reject'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.init=function(e,t){c.trigger=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.trigger.id,c.query.TriggerAllId=c.trigger.id,c.getTriggerAllConditions()},c.deleteConfirm=function(e,t){var n=i.confirm().title("Are you sure want to delete the allCondition?").htmlContent("<b>"+(e.name||"allCondition")+"</b> will be deleted.").ariaLabel("delete allCondition").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){h(e)},function(){console.log("CANCEL")})},c.success=v,c.getTriggerAllConditions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.trigger.getAllConditions(c.query,v).$promise},c.createOrEditTriggerAllCondition=function(e,t){i.show({controller:"CreateOrEditAllConditionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/triggers/edit/allconditions/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{trigger:c.trigger,allCondition:t,allconditions:c.triggerAllConditions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedTriggerAllConditions=function(){var e=angular.copy(c.selectedTriggerAllConditions);return c.selectedTriggerAllConditions=[],e},c.deleteTriggerAllCondition=h,c.deleteSelectedTriggerAllConditions=function(e){var t=i.confirm().title("Are you sure want to delete the selected allconditions?").htmlContent("<b>"+c.selectedTriggerAllConditions.length+" selected</b> will be deleted.").ariaLabel("delete allconditions").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){c.selectedTriggerAllConditions.forEach(function(e){h(e)}),c.selectedTriggerAllConditions=[]})},d.hasRole("admin")?l.chatWebsite.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.chatAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CHATACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.chatWebsite.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.chatAccounts=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:502}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(c.chatAccounts,{id:e.resourceId})}),a=null;a=[],c.triggerAllConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.chatAccounts,{id:Number(e.value)});a.push(t)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(c.chatAccounts,{id:e.id});t.canSelect=!1,n.push(t)}}),c.chatAccounts=n})}else{var n=[],a=[];c.triggerAllConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.chatAccounts,{id:Number(e.value)});a.push(t)}});for(var i=0;i<c.chatAccounts.length;i++){_.some(a,{id:c.chatAccounts[i].id})&&(c.chatAccounts[i].canSelect=!1,n.push(c.chatAccounts[i]))}c.chatAccounts=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?l.mailAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.mailAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MAILACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.mailAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.mailAccounts=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:602}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(c.mailAccounts,{id:e.resourceId})}),a=null;a=[],c.triggerAllConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.mailAccounts,{id:Number(e.value)});a.push(t)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(c.mailAccounts,{id:e.id});t.canSelect=!1,n.push(t)}}),c.mailAccounts=n})}else{var n=[],a=[];c.triggerAllConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.mailAccounts,{id:Number(e.value)});a.push(t)}});for(var i=0;i<c.mailAccounts.length;i++){_.some(a,{id:c.mailAccounts[i].id})&&(c.mailAccounts[i].canSelect=!1,n.push(c.mailAccounts[i]))}c.mailAccounts=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?l.smsAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.smsAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SMSACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.smsAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.smsAccounts=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:702}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(c.smsAccounts,{id:e.resourceId})}),a=null;a=[],c.triggerAllConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.smsAccounts,{id:Number(e.value)});a.push(t)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(c.smsAccounts,{id:e.id});t.canSelect=!1,n.push(t)}}),c.smsAccounts=n})}else{var n=[],a=[];c.triggerAllConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.smsAccounts,{id:Number(e.value)});a.push(t)}});for(var i=0;i<c.smsAccounts.length;i++){_.some(a,{id:c.smsAccounts[i].id})&&(c.smsAccounts[i].canSelect=!1,n.push(c.smsAccounts[i]))}c.smsAccounts=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?l.faxAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.faxAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_FAXACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.faxAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.faxAccounts=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:902}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(c.faxAccounts,{id:e.resourceId})}),a=null;a=[],c.triggerAllConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.faxAccounts,{id:Number(e.value)});a.push(t)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(c.faxAccounts,{id:e.id});t.canSelect=!1,n.push(t)}}),c.faxAccounts=n})}else{var n=[],a=[];c.triggerAllConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.faxAccounts,{id:Number(e.value)});a.push(t)}});for(var i=0;i<c.faxAccounts.length;i++){_.some(a,{id:c.faxAccounts[i].id})&&(c.faxAccounts[i].canSelect=!1,n.push(c.faxAccounts[i]))}c.faxAccounts=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?l.openchannelAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.openchannelAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OPENCHANNELACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.openchannelAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.openchannelAccounts=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:802}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(c.openchannelAccounts,{id:e.resourceId})}),a=null;a=[],c.triggerAllConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.openchannelAccounts,{id:Number(e.value)});a.push(t)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(c.openchannelAccounts,{id:e.id});t.canSelect=!1,n.push(t)}}),c.openchannelAccounts=n})}else{var n=[],a=[];c.triggerAllConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.openchannelAccounts,{id:Number(e.value)});a.push(t)}});for(var i=0;i<c.openchannelAccounts.length;i++){_.some(a,{id:c.openchannelAccounts[i].id})&&(c.openchannelAccounts[i].canSelect=!1,n.push(c.openchannelAccounts[i]))}c.openchannelAccounts=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})});var m=[{id:401,type:"inbound"},{id:1501,type:"outbound"}],u=null;d.hasRole("admin")?l.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){c.queues=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){u=e.rows||[]}).then(function(){for(var e=[],t=0;t<m.length;t++)e.push(l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:m[t].id}).$promise);return o.all(e)}).then(function(e){for(var t=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),n=[],a=0;a<m.length;a++){var i=_.find(t,["sectionId",m[a].id]);if(i)if(i.autoAssociation){var s=[];u.forEach(function(e){e.type===m[a].type&&s.push(e)}),n.push({rows:s,count:s.length})}else n.push(l.userProfileResource.get({sectionId:i.id}).$promise)}return o.all(n)}).then(function(e){var n=[],a=[];c.triggerAllConditions.rows.forEach(function(e){if("queue"===e.field){var t=_.find(u,{name:e.value});a.push(t)}});for(var t=0;t<e.length;t++){(e[t].rows||[]).forEach(function(e){n.push(e)})}_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["resourceId",e.id])){var t=_.find(u,{id:e.id});t.canSelect=!1,n.push(t)}}),c.queues=n}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?l.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){c.outboundRoutes=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){c.outboundRoutes=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(c.outboundRoutes,{id:e.resourceId})}),a=null;a=[],c.triggerAllConditions.rows.forEach(function(e){if("routeId"===e.field){var t=_.find(c.outboundRoutes,{id:Number(e.value)});a.push(t)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(c.outboundRoutes,{id:e.id});t.canSelect=!1,n.push(t)}}),c.outboundRoutes=n})}else{var n=[],a=[];c.triggerAllConditions.rows.forEach(function(e){if("routeId"===e.field){var t=_.find(c.outboundRoutes,{id:Number(e.value)});a.push(t)}});for(var i=0;i<c.outboundRoutes.length;i++){_.some(a,{id:c.outboundRoutes[i].id})&&(c.outboundRoutes[i].canSelect=!1,n.push(c.outboundRoutes[i]))}c.outboundRoutes=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GEToutboundRoutes",msg:e.data?JSON.stringify(e.data):e.toString()})});var p=!0,g=1;function v(e){c.triggerAllConditions=e||{count:0,rows:[]}}function h(e){l.condition.delete({id:e.id}).$promise.then(function(){_.remove(c.triggerAllConditions.rows,{id:e.id}),c.triggerAllConditions.count-=1,c.triggerAllConditions.rows.length||c.getTriggerAllConditions(),r.success({title:"AllCondition deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETtrigger"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrigger",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){p?a(function(){p=!1}):(t||(g=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=g),c.getTriggerAllConditions())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.tools").controller("TriggerAllConditionsController",e)}(),function(){"use strict";function e(e,t,n,a,o,i,s,r,l,d,c,m,u,p,g){var v=this;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="TOOLS.EDIT_ALLCONDITION",v.allCondition=angular.copy(l),v.allconditions=r,v.newAllCondition=!1,v.trigger=angular.copy(d),v.allCondition||(v.allCondition={field:"queue",operator:"equals",value:"abandoned",value:"opened",value:"in"},v.title="TOOLS.NEW_ALLCONDITION",v.newAllCondition=!0),t.params.id&&(v.allCondition.TriggerAllId=t.params.id),v.addNewAllCondition=function(){v.errors=[],c.trigger.addAllCondition({id:t.params.id},v.allCondition).$promise.then(function(e){v.allconditions.unshift(e.toJSON()),s.success({title:"AllCondition properly created",msg:v.allCondition.name?v.allCondition.name+" has been created!":""}),b(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.condition.save"}];for(var t=0;t<e.data.errors.length;t+=1)s.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.saveAllCondition=function(){v.errors=[],c.condition.update({id:v.allCondition.id},v.allCondition).$promise.then(function(e){var t=_.find(v.allconditions,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),s.success({title:"AllCondition properly saved!",msg:v.allCondition.name?v.allCondition.name+" has been saved!":""}),b(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.condition.update"}];for(var t=0;t<e.data.errors.length;t++)s.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.deleteAllCondition=function(e){v.errors=[];var t=a.confirm().title("Are you sure?").content("The allCondition will be deleted.").ariaLabel("Delete AllCondition").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){c.condition.delete({id:v.allCondition.id}).$promise.then(function(){_.remove(v.allconditions,{id:v.allCondition.id}),s.success({title:"AllCondition properly deleted!",msg:(v.allCondition.name||"allCondition")+" has been deleted!"}),b(v.allCondition)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.condition.delete"}];for(var t=0;t<e.data.errors.length;t++)s.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else s.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(){})},v.getDateFromString=function(e){return null===e?void 0:new Date(e)},v.closeDialog=b,m.hasRole("admin")?c.chatWebsite.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.chatAccounts=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CHATACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.chatWebsite.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.chatAccounts=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:502}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return c.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(v.chatAccounts,{id:e.resourceId})}),n=null;if(v.allCondition&&(n=_.find(v.chatAccounts,{id:Number(v.allCondition.value)})),n&&!_.some(t,["id",n.id])){var a=_.find(v.chatAccounts,{id:n.id});a.canSelect=!1,t.push(a)}v.chatAccounts=t})}else{var n=[],a=null;v.allCondition&&(a=_.find(v.chatAccounts,{id:Number(v.allCondition.value)}));for(var i=0;i<v.chatAccounts.length;i++)a&&v.chatAccounts[i].id===a.id&&(v.chatAccounts[i].canSelect=!1,n.push(v.chatAccounts[i]));v.chatAccounts=n}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),m.hasRole("admin")?c.mailAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.mailAccounts=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MAILACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.mailAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.mailAccounts=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:602}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return c.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(v.mailAccounts,{id:e.resourceId})}),n=null;if(v.allCondition&&(n=_.find(v.mailAccounts,{id:Number(v.allCondition.value)})),n&&!_.some(t,["id",n.id])){var a=_.find(v.mailAccounts,{id:n.id});a.canSelect=!1,t.push(a)}v.mailAccounts=t})}else{var n=[],a=null;v.allCondition&&(a=_.find(v.mailAccounts,{id:Number(v.allCondition.value)}));for(var i=0;i<v.mailAccounts.length;i++)a&&v.mailAccounts[i].id===a.id&&(v.mailAccounts[i].canSelect=!1,n.push(v.mailAccounts[i]));v.mailAccounts=n}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),m.hasRole("admin")?c.smsAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.smsAccounts=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SMSACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.smsAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.smsAccounts=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:702}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return c.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(v.smsAccounts,{id:e.resourceId})}),n=null;if(v.allCondition&&(n=_.find(v.smsAccounts,{id:Number(v.allCondition.value)})),n&&!_.some(t,["id",n.id])){var a=_.find(v.smsAccounts,{id:n.id});a.canSelect=!1,t.push(a)}v.smsAccounts=t})}else{var n=[],a=null;v.allCondition&&(a=_.find(v.smsAccounts,{id:Number(v.allCondition.value)}));for(var i=0;i<v.smsAccounts.length;i++)a&&v.smsAccounts[i].id===a.id&&(v.smsAccounts[i].canSelect=!1,n.push(v.smsAccounts[i]));v.smsAccounts=n}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),m.hasRole("admin")?c.faxAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.faxAccounts=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_FAXACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.faxAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.faxAccounts=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:902}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return c.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(v.faxAccounts,{id:e.resourceId})}),n=null;if(v.allCondition&&(n=_.find(v.faxAccounts,{id:Number(v.allCondition.value)})),n&&!_.some(t,["id",n.id])){var a=_.find(v.faxAccounts,{id:n.id});a.canSelect=!1,t.push(a)}v.faxAccounts=t})}else{var n=[],a=null;v.allCondition&&(a=_.find(v.faxAccounts,{id:Number(v.allCondition.value)}));for(var i=0;i<v.faxAccounts.length;i++)a&&v.faxAccounts[i].id===a.id&&(v.faxAccounts[i].canSelect=!1,n.push(v.faxAccounts[i]));v.faxAccounts=n}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),m.hasRole("admin")?c.openchannelAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.openchannelAccounts=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OPENCHANNELACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.openchannelAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.openchannelAccounts=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:802}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return c.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(v.openchannelAccounts,{id:e.resourceId})}),n=null;if(v.allCondition&&(n=_.find(v.openchannelAccounts,{id:Number(v.allCondition.value)})),n&&!_.some(t,["id",n.id])){var a=_.find(v.openchannelAccounts,{id:n.id});a.canSelect=!1,t.push(a)}v.openchannelAccounts=t})}else{var n=[],a=null;v.allCondition&&(a=_.find(v.openchannelAccounts,{id:Number(v.allCondition.value)}));for(var i=0;i<v.openchannelAccounts.length;i++)a&&v.openchannelAccounts[i].id===a.id&&(v.openchannelAccounts[i].canSelect=!1,n.push(v.openchannelAccounts[i]));v.openchannelAccounts=n}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})});var h=[{id:401,type:"inbound"},{id:1501,type:"outbound"}],f=null;function b(e){a.hide(e)}m.hasRole("admin")?c.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){v.queues=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){f=e.rows||[]}).then(function(){for(var e=[],t=0;t<h.length;t++)e.push(c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:h[t].id}).$promise);return o.all(e)}).then(function(e){for(var t=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),n=[],a=0;a<h.length;a++){var i=_.find(t,["sectionId",h[a].id]);if(i)if(i.autoAssociation){var s=[];f.forEach(function(e){e.type===h[a].type&&s.push(e)}),n.push({rows:s,count:s.length})}else n.push(c.userProfileResource.get({sectionId:i.id}).$promise)}return o.all(n)}).then(function(e){var t=[],n=null;v.allCondition&&(n=_.find(f,{name:v.allCondition.value}));for(var a=0;a<e.length;a++){(e[a].rows||[]).forEach(function(e){t.push(e)})}n&&!_.some(t,["resourceId",n.id])&&f.forEach(function(e){e.id===n.id&&(e.canSelect=!1,t.push(e))}),v.queues=t}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})}),m.hasRole("admin")?c.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){v.outboundRoutes=e.rows||[]}).catch(function(e){s.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){v.outboundRoutes=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return c.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(v.outboundRoutes,{id:e.resourceId})}),n=null;if(v.allCondition&&(n=_.find(v.outboundRoutes,{id:Number(v.allCondition.value)})),n&&!_.some(t,["id",n.id])){var a=_.find(v.outboundRoutes,{id:n.id});a.canSelect=!1,t.push(a)}v.outboundRoutes=t})}else{var n=[],a=null;v.allCondition&&(a=_.find(v.outboundRoutes,{id:Number(v.allCondition.value)}));for(var i=0;i<v.outboundRoutes.length;i++)a&&v.outboundRoutes[i].id===a.id&&(v.outboundRoutes[i].canSelect=!1,n.push(v.outboundRoutes[i]));v.outboundRoutes=n}}).catch(function(e){s.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","allconditions","allCondition","trigger","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditAllConditionDialogController",e)}(),function(){"use strict";function e(e,t,n,o,a,i,s,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.trigger={},c.triggerAnyConditions={count:0,rows:[]},c.selectedTriggerAnyConditions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,field,operator,value",limit:10,page:1},c.arrayfield=_.keyBy([{option:"Queue",value:"'queue'",ngIf:"vm.trigger.channel == 'voice'"},{option:"Call_Status",value:"'lastevent'",ngIf:"vm.trigger.channel == 'voice'"},{option:"OutboundRoute",value:"'routeId'",ngIf:"vm.trigger.channel == 'voice'"},{option:"Account",value:"'account'",ngIf:"vm.trigger.channel != 'voice'"},{option:"Interaction",value:"'interaction'",ngIf:"vm.trigger.channel != 'voice'"},{option:"Message",value:"'message'",ngIf:"vm.trigger.channel != 'voice'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.arrayoperator=_.keyBy([{option:"Equals",value:"'equals'"},{option:"Not_Equals",value:"'not_equals'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.callStatusValues=_.keyBy([{option:"Abandon",value:"'abandoned'"},{option:"Hangup",value:"'complete'"},{option:"Reject",value:"'rejected'"},{option:"Ring",value:"'called'"},{option:"Answer",value:"'connect'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.interactionStatusValues=_.keyBy([{option:"Opened",value:"'opened'"},{option:"Closed",value:"'closed'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.messageStatusValues=_.keyBy([{option:"Incoming",value:"'in'"},{option:"Outgoing",value:"'out'"},{option:"Accepted",value:"'accept'"},{option:"Rejected",value:"'reject'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.init=function(e,t){c.trigger=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.trigger.id,c.query.TriggerAnyId=c.trigger.id,c.getTriggerAnyConditions()},c.deleteConfirm=function(e,t){var n=i.confirm().title("Are you sure want to delete the anyCondition?").htmlContent("<b>"+(e.name||"anyCondition")+"</b> will be deleted.").ariaLabel("delete anyCondition").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){h(e)},function(){console.log("CANCEL")})},c.success=v,c.getTriggerAnyConditions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.trigger.getAnyConditions(c.query,v).$promise},c.createOrEditTriggerAnyCondition=function(e,t){i.show({controller:"CreateOrEditAnyConditionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/triggers/edit/anyconditions/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{trigger:c.trigger,anyCondition:t,anyconditions:c.triggerAnyConditions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedTriggerAnyConditions=function(){var e=angular.copy(c.selectedTriggerAnyConditions);return c.selectedTriggerAnyConditions=[],e},c.deleteTriggerAnyCondition=h,c.deleteSelectedTriggerAnyConditions=function(e){var t=i.confirm().title("Are you sure want to delete the selected anyconditions?").htmlContent("<b>"+c.selectedTriggerAnyConditions.length+" selected</b> will be deleted.").ariaLabel("delete anyconditions").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){c.selectedTriggerAnyConditions.forEach(function(e){h(e)}),c.selectedTriggerAnyConditions=[]})},d.hasRole("admin")?l.chatWebsite.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.chatAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CHATACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.chatWebsite.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.chatAccounts=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:502}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(c.chatAccounts,{id:e.resourceId})}),a=null;a=[],c.triggerAnyConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.chatAccounts,{id:Number(e.value)});a.push(t)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(c.chatAccounts,{id:e.id});t.canSelect=!1,n.push(t)}}),c.chatAccounts=n})}else{var n=[],a=[];c.triggerAnyConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.chatAccounts,{id:Number(e.value)});a.push(t)}});for(var i=0;i<c.chatAccounts.length;i++){_.some(a,{id:c.chatAccounts[i].id})&&(c.chatAccounts[i].canSelect=!1,n.push(c.chatAccounts[i]))}c.chatAccounts=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?l.mailAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.mailAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MAILACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.mailAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.mailAccounts=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:602}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(c.mailAccounts,{id:e.resourceId})}),a=null;a=[],c.triggerAnyConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.mailAccounts,{id:Number(e.value)});a.push(t)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(c.mailAccounts,{id:e.id});t.canSelect=!1,n.push(t)}}),c.mailAccounts=n})}else{var n=[],a=[];c.triggerAnyConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.mailAccounts,{id:Number(e.value)});a.push(t)}});for(var i=0;i<c.mailAccounts.length;i++){_.some(a,{id:c.mailAccounts[i].id})&&(c.mailAccounts[i].canSelect=!1,n.push(c.mailAccounts[i]))}c.mailAccounts=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?l.smsAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.smsAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SMSACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.smsAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.smsAccounts=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:702}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(c.smsAccounts,{id:e.resourceId})}),a=null;a=[],c.triggerAnyConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.smsAccounts,{id:Number(e.value)});a.push(t)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(c.smsAccounts,{id:e.id});t.canSelect=!1,n.push(t)}}),c.smsAccounts=n})}else{var n=[],a=[];c.triggerAnyConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.smsAccounts,{id:Number(e.value)});a.push(t)}});for(var i=0;i<c.smsAccounts.length;i++){_.some(a,{id:c.smsAccounts[i].id})&&(c.smsAccounts[i].canSelect=!1,n.push(c.smsAccounts[i]))}c.smsAccounts=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?l.faxAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.faxAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_FAXACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.faxAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.faxAccounts=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:902}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(c.faxAccounts,{id:e.resourceId})}),a=null;a=[],c.triggerAnyConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.faxAccounts,{id:Number(e.value)});a.push(t)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(c.faxAccounts,{id:e.id});t.canSelect=!1,n.push(t)}}),c.faxAccounts=n})}else{var n=[],a=[];c.triggerAnyConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.faxAccounts,{id:Number(e.value)});a.push(t)}});for(var i=0;i<c.faxAccounts.length;i++){_.some(a,{id:c.faxAccounts[i].id})&&(c.faxAccounts[i].canSelect=!1,n.push(c.faxAccounts[i]))}c.faxAccounts=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?l.openchannelAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.openchannelAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OPENCHANNELACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.openchannelAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.openchannelAccounts=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:802}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(c.openchannelAccounts,{id:e.resourceId})}),a=null;a=[],c.triggerAnyConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.openchannelAccounts,{id:Number(e.value)});a.push(t)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(c.openchannelAccounts,{id:e.id});t.canSelect=!1,n.push(t)}}),c.openchannelAccounts=n})}else{var n=[],a=[];c.triggerAnyConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.openchannelAccounts,{id:Number(e.value)});a.push(t)}});for(var i=0;i<c.openchannelAccounts.length;i++){_.some(a,{id:c.openchannelAccounts[i].id})&&(c.openchannelAccounts[i].canSelect=!1,n.push(c.openchannelAccounts[i]))}c.openchannelAccounts=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})});var m=[{id:401,type:"inbound"},{id:1501,type:"outbound"}],u=null;d.hasRole("admin")?l.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){c.queues=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){u=e.rows||[]}).then(function(){for(var e=[],t=0;t<m.length;t++)e.push(l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:m[t].id}).$promise);return o.all(e)}).then(function(e){for(var t=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),n=[],a=0;a<m.length;a++){var i=_.find(t,["sectionId",m[a].id]);if(i)if(i.autoAssociation){var s=[];u.forEach(function(e){e.type===m[a].type&&s.push(e)}),n.push({rows:s,count:s.length})}else n.push(l.userProfileResource.get({sectionId:i.id}).$promise)}return o.all(n)}).then(function(e){var n=[],a=[];c.triggerAnyConditions.rows.forEach(function(e){if("queue"===e.field){var t=_.find(u,{name:e.value});a.push(t)}});for(var t=0;t<e.length;t++){(e[t].rows||[]).forEach(function(e){n.push(e)})}_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["resourceId",e.id])){var t=_.find(u,{id:e.id});t.canSelect=!1,n.push(t)}}),c.queues=n}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?l.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){c.outboundRoutes=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){c.outboundRoutes=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(c.outboundRoutes,{id:e.resourceId})}),a=null;a=[],c.triggerAnyConditions.rows.forEach(function(e){if("routeId"===e.field){var t=_.find(c.outboundRoutes,{id:Number(e.value)});a.push(t)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(c.outboundRoutes,{id:e.id});t.canSelect=!1,n.push(t)}}),c.outboundRoutes=n})}else{var n=[],a=[];c.triggerAnyConditions.rows.forEach(function(e){if("routeId"===e.field){var t=_.find(c.outboundRoutes,{id:Number(e.value)});a.push(t)}});for(var i=0;i<c.outboundRoutes.length;i++){_.some(a,{id:c.outboundRoutes[i].id})&&(c.outboundRoutes[i].canSelect=!1,n.push(c.outboundRoutes[i]))}c.outboundRoutes=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GEToutboundRoutes",msg:e.data?JSON.stringify(e.data):e.toString()})});var p=!0,g=1;function v(e){c.triggerAnyConditions=e||{count:0,rows:[]}}function h(e){l.condition.delete({id:e.id}).$promise.then(function(){_.remove(c.triggerAnyConditions.rows,{id:e.id}),c.triggerAnyConditions.count-=1,c.triggerAnyConditions.rows.length||c.getTriggerAnyConditions(),r.success({title:"AnyCondition deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETtrigger"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrigger",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){p?a(function(){p=!1}):(t||(g=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=g),c.getTriggerAnyConditions())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.tools").controller("TriggerAnyConditionsController",e)}(),function(){"use strict";function e(e,t,n,a,o,i,s,r,l,d,c,m,u,p,g){var v=this;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="TOOLS.EDIT_ANYCONDITION",v.anyCondition=angular.copy(l),v.anyconditions=r,v.newAnyCondition=!1,v.trigger=angular.copy(d),v.anyCondition||(v.anyCondition={field:"queue",operator:"equals",value:"abandoned",value:"opened",value:"in"},v.title="TOOLS.NEW_ANYCONDITION",v.newAnyCondition=!0),t.params.id&&(v.anyCondition.TriggerAnyId=t.params.id),v.addNewAnyCondition=function(){v.errors=[],c.trigger.addAnyCondition({id:t.params.id},v.anyCondition).$promise.then(function(e){v.anyconditions.unshift(e.toJSON()),s.success({title:"AnyCondition properly created",msg:v.anyCondition.name?v.anyCondition.name+" has been created!":""}),b(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.condition.save"}];for(var t=0;t<e.data.errors.length;t+=1)s.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.saveAnyCondition=function(){v.errors=[],c.condition.update({id:v.anyCondition.id},v.anyCondition).$promise.then(function(e){var t=_.find(v.anyconditions,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),s.success({title:"AnyCondition properly saved!",msg:v.anyCondition.name?v.anyCondition.name+" has been saved!":""}),b(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.condition.update"}];for(var t=0;t<e.data.errors.length;t++)s.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.deleteAnyCondition=function(e){v.errors=[];var t=a.confirm().title("Are you sure?").content("The anyCondition will be deleted.").ariaLabel("Delete AnyCondition").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){c.condition.delete({id:v.anyCondition.id}).$promise.then(function(){_.remove(v.anyconditions,{id:v.anyCondition.id}),s.success({title:"AnyCondition properly deleted!",msg:(v.anyCondition.name||"anyCondition")+" has been deleted!"}),b(v.anyCondition)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.condition.delete"}];for(var t=0;t<e.data.errors.length;t++)s.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else s.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(){})},v.getDateFromString=function(e){return null===e?void 0:new Date(e)},v.closeDialog=b,m.hasRole("admin")?c.chatWebsite.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.chatAccounts=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CHATACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.chatWebsite.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.chatAccounts=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:502}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return c.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(v.chatAccounts,{id:e.resourceId})}),n=null;if(v.anyCondition&&(n=_.find(v.chatAccounts,{id:Number(v.anyCondition.value)})),n&&!_.some(t,["id",n.id])){var a=_.find(v.chatAccounts,{id:n.id});a.canSelect=!1,t.push(a)}v.chatAccounts=t})}else{var n=[],a=null;v.anyCondition&&(a=_.find(v.chatAccounts,{id:Number(v.anyCondition.value)}));for(var i=0;i<v.chatAccounts.length;i++)a&&v.chatAccounts[i].id===a.id&&(v.chatAccounts[i].canSelect=!1,n.push(v.chatAccounts[i]));v.chatAccounts=n}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),m.hasRole("admin")?c.mailAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.mailAccounts=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MAILACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.mailAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.mailAccounts=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:602}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return c.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(v.mailAccounts,{id:e.resourceId})}),n=null;if(v.anyCondition&&(n=_.find(v.mailAccounts,{id:Number(v.anyCondition.value)})),n&&!_.some(t,["id",n.id])){var a=_.find(v.mailAccounts,{id:n.id});a.canSelect=!1,t.push(a)}v.mailAccounts=t})}else{var n=[],a=null;v.anyCondition&&(a=_.find(v.mailAccounts,{id:Number(v.anyCondition.value)}));for(var i=0;i<v.mailAccounts.length;i++)a&&v.mailAccounts[i].id===a.id&&(v.mailAccounts[i].canSelect=!1,n.push(v.mailAccounts[i]));v.mailAccounts=n}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),m.hasRole("admin")?c.smsAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.smsAccounts=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SMSACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.smsAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.smsAccounts=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:702}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return c.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(v.smsAccounts,{id:e.resourceId})}),n=null;if(v.anyCondition&&(n=_.find(v.smsAccounts,{id:Number(v.anyCondition.value)})),n&&!_.some(t,["id",n.id])){var a=_.find(v.smsAccounts,{id:n.id});a.canSelect=!1,t.push(a)}v.smsAccounts=t})}else{var n=[],a=null;v.anyCondition&&(a=_.find(v.smsAccounts,{id:Number(v.anyCondition.value)}));for(var i=0;i<v.smsAccounts.length;i++)a&&v.smsAccounts[i].id===a.id&&(v.smsAccounts[i].canSelect=!1,n.push(v.smsAccounts[i]));v.smsAccounts=n}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),m.hasRole("admin")?c.faxAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.faxAccounts=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_FAXACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.faxAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.faxAccounts=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:902}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return c.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(v.faxAccounts,{id:e.resourceId})}),n=null;if(v.anyCondition&&(n=_.find(v.faxAccounts,{id:Number(v.anyCondition.value)})),n&&!_.some(t,["id",n.id])){var a=_.find(v.faxAccounts,{id:n.id});a.canSelect=!1,t.push(a)}v.faxAccounts=t})}else{var n=[],a=null;v.anyCondition&&(a=_.find(v.faxAccounts,{id:Number(v.anyCondition.value)}));for(var i=0;i<v.faxAccounts.length;i++)a&&v.faxAccounts[i].id===a.id&&(v.faxAccounts[i].canSelect=!1,n.push(v.faxAccounts[i]));v.faxAccounts=n}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),m.hasRole("admin")?c.openchannelAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.openchannelAccounts=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OPENCHANNELACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.openchannelAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.openchannelAccounts=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:802}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return c.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(v.openchannelAccounts,{id:e.resourceId})}),n=null;if(v.anyCondition&&(n=_.find(v.openchannelAccounts,{id:Number(v.anyCondition.value)})),n&&!_.some(t,["id",n.id])){var a=_.find(v.openchannelAccounts,{id:n.id});a.canSelect=!1,t.push(a)}v.openchannelAccounts=t})}else{var n=[],a=null;v.anyCondition&&(a=_.find(v.openchannelAccounts,{id:Number(v.anyCondition.value)}));for(var i=0;i<v.openchannelAccounts.length;i++)a&&v.openchannelAccounts[i].id===a.id&&(v.openchannelAccounts[i].canSelect=!1,n.push(v.openchannelAccounts[i]));v.openchannelAccounts=n}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})});var h=[{id:401,type:"inbound"},{id:1501,type:"outbound"}],f=null;function b(e){a.hide(e)}m.hasRole("admin")?c.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){v.queues=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){f=e.rows||[]}).then(function(){for(var e=[],t=0;t<h.length;t++)e.push(c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:h[t].id}).$promise);return o.all(e)}).then(function(e){for(var t=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),n=[],a=0;a<h.length;a++){var i=_.find(t,["sectionId",h[a].id]);if(i)if(i.autoAssociation){var s=[];f.forEach(function(e){e.type===h[a].type&&s.push(e)}),n.push({rows:s,count:s.length})}else n.push(c.userProfileResource.get({sectionId:i.id}).$promise)}return o.all(n)}).then(function(e){var t=[],n=null;v.anyCondition&&(n=_.find(f,{name:v.anyCondition.value}));for(var a=0;a<e.length;a++){(e[a].rows||[]).forEach(function(e){t.push(e)})}n&&!_.some(t,["resourceId",n.id])&&f.forEach(function(e){e.id===n.id&&(e.canSelect=!1,t.push(e))}),v.queues=t}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})}),m.hasRole("admin")?c.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){v.outboundRoutes=e.rows||[]}).catch(function(e){s.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){v.outboundRoutes=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return c.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(v.outboundRoutes,{id:e.resourceId})}),n=null;if(v.anyCondition&&(n=_.find(v.outboundRoutes,{id:Number(v.anyCondition.value)})),n&&!_.some(t,["id",n.id])){var a=_.find(v.outboundRoutes,{id:n.id});a.canSelect=!1,t.push(a)}v.outboundRoutes=t})}else{var n=[],a=null;v.anyCondition&&(a=_.find(v.outboundRoutes,{id:Number(v.anyCondition.value)}));for(var i=0;i<v.outboundRoutes.length;i++)a&&v.outboundRoutes[i].id===a.id&&(v.outboundRoutes[i].canSelect=!1,n.push(v.outboundRoutes[i]));v.outboundRoutes=n}}).catch(function(e){s.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","anyconditions","anyCondition","trigger","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditAnyConditionDialogController",e)}(),function(){"use strict";function e(e,t,n,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=t.protocol()+"://"+t.host(),u.trigger=c||e.params.trigger||{},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.gotoTriggers=function(){e.go("app.tools.triggers")},u.saveTrigger=function(){r.trigger.update({id:u.trigger.id},u.trigger).$promise.then(function(){l.success({title:"Trigger updated!",msg:u.trigger.name?u.trigger.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrigger",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","trigger","userProfileSection"],angular.module("app.tools").controller("TriggerController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.triggers=l||{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="triggers",b.listOrder="",b.listOrderAsc=null,b.selectedTriggers=[],b.query={fields:"createdAt,updatedAt,id,name,channel,status,description",sort:"-updatedAt",limit:10,page:1},b.arraychannel=_.keyBy([{option:"Voice",value:"'voice'"},{option:"Openchannel",value:"'openchannel'",ngIf:"vm.license.openchannel"},{option:"Chat",value:"'chat'",ngIf:"vm.license.chat"},{option:"Mail",value:"'mail'",ngIf:"vm.license.mail"},{option:"Sms",value:"'sms'",ngIf:"vm.license.messaging"},{option:"Fax",value:"'fax'",ngIf:"vm.license.fax"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.tools.triggers.edit",{id:e.id,trigger:e,crudPermissions:b.crudPermissions})},b.deleteconfirm=function(e,t){var n=i.confirm().title("Are you sure want to delete the "+_.startCase("trigger")+"?").htmlContent("<b>"+(e.name||"trigger")+"</b> will be deleted.").ariaLabel("delete trigger").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getTriggers=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.trigger.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Triggers",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditTrigger=function(e,t){i.show({controller:"CreateOrEditTriggerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/triggers/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{trigger:t,triggers:b.triggers.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteTrigger=S,b.exportSelectedTriggers=function(){var e=angular.copy(b.selectedTriggers);return b.selectedTriggers=[],e},b.deleteSelectedTriggers=function(e){var t=i.confirm().title("Are you sure want to delete the selected triggers?").htmlContent("<b>"+b.selectedTriggers.length+" selected</b> will be deleted.").ariaLabel("delete Triggers").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedTriggers.forEach(function(e){S(e)}),b.selectedTriggers=[]})},b.deselectTriggers=function(){b.selectedTriggers=[]},b.selectAllTriggers=function(){b.selectedTriggers=b.triggers.rows};var E=!0,A=1;function y(e){b.triggers=e||{count:0,rows:[]}}function S(e){m.trigger.delete({id:e.id}).$promise.then(function(){_.remove(b.triggers.rows,{id:e.id}),b.triggers.count-=1,b.triggers.rows.length||b.getTriggers(),p.success({title:_.startCase("Trigger")+" 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:DELETEtrigger"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEtrigger",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getTriggers())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","triggers","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.tools").controller("TriggersController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.trunks,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The trunk will be deleted.").ariaLabel("Delete Trunk").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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(t,n,a,e,i,s,o){var r=this;function l(e){t.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!":""}),n.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 t=0;t<e.data.errors.length;t+=1)a.error({title:e.data.errors[t].type,msg:e.data.errors[t].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(n,e,a,i,s,t,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=t,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.trunk=c||n.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=n.params.tab||0,u.gotogoto=function(e,t){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:411}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.voice.realtime.trunks",{})}},u.clonedialog=function(e,t){a.show({controller:"TrunkcloneController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/trunks/edit/clone/clone.html",parent:angular.element(i.body),targetEvent:t,clickOutsideToClose:!0,locals:{trunk:e,trunks:u.trunks?u.trunks.rows:[],crudPermissions:u.crudPermissions}})},u.alert=l.info,u.gotoTrunks=function(){n.go("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 t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.contexts,{id:e.resourceId})}),n=null;if(u.trunk&&(n=_.find(u.contexts,{name:u.trunk.context})),n&&!_.some(t,["id",n.id])){var a=_.find(u.contexts,{id:n.id});a.canSelect=!1,t.push(a)}u.contexts=t}):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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.trunks=l||{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="trunks",b.listOrder="",b.listOrderAsc=null,b.selectedTrunks=[],b.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},b.arraytype=_.keyBy([{option:"Friend",value:"'friend'"},{option:"User",value:"'user'"},{option:"Peer",value:"'peer'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.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"),"")}),b.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"),"")}),b.arrayqualify=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.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"),"")}),b.arrayinsecure=_.keyBy([{option:"port",value:"'port'"},{option:"invite",value:"'invite'"},{option:"very",value:"'very'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.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"),"")}),b.arraycallcounter=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arrayusereqphone=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arraytrustrpid=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arraysendrpid=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"},{option:"pai",value:"'pai'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arrayencryption=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.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"),"")}),b.arrayvideosupport=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Always",value:"'always'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.tools.trunks.edit",{id:e.id,trunk:e,crudPermissions:b.crudPermissions})},b.clonedialog=function(e,t){i.show({controller:"TrunkcloneController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/trunks/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{trunk:e,trunks:b.trunks?b.trunks.rows:[],crudPermissions:b.crudPermissions}})},b.gotorealtimegoto=function(e,t){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:411}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.voice.realtime.trunks",{})}},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getTrunks=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.trunk.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Trunks",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditTrunk=function(e,t){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:t,trunks:b.trunks.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteTrunk=S,b.exportSelectedTrunks=function(){var e=angular.copy(b.selectedTrunks);return b.selectedTrunks=[],e},b.deleteSelectedTrunks=function(e){var t=i.confirm().title("Are you sure want to delete the selected trunks?").htmlContent("<b>"+b.selectedTrunks.length+" selected</b> will be deleted.").ariaLabel("delete Trunks").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedTrunks.forEach(function(e){S(e)}),b.selectedTrunks=[]})},b.deselectTrunks=function(){b.selectedTrunks=[]},b.selectAllTrunks=function(){b.selectedTrunks=b.trunks.rows};var E=!0,A=1;function y(e){b.trunks=e||{count:0,rows:[]}}function S(e){m.trunk.delete({id:e.id}).$promise.then(function(){_.remove(b.trunks.rows,{id:e.id}),b.trunks.count-=1,b.trunks.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEtrunk"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getTrunks())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","trunks","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.tools").controller("TrunksController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.variables,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The variable will be deleted.").ariaLabel("Delete Variable").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.variables=l||{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="variables",b.listOrder="",b.listOrderAsc=null,b.selectedVariables=[],b.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},b.editdialog=function(e,t){i.show({controller:"CreateOrEditVariableDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/variables/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{variable:e,variables:b.variables.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getVariables=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.variable.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Variables",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditVariable=function(e,t){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:t,variables:b.variables.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteVariable=S,b.exportSelectedVariables=function(){var e=angular.copy(b.selectedVariables);return b.selectedVariables=[],e},b.deleteSelectedVariables=function(e){var t=i.confirm().title("Are you sure want to delete the selected variables?").htmlContent("<b>"+b.selectedVariables.length+" selected</b> will be deleted.").ariaLabel("delete Variables").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedVariables.forEach(function(e){S(e)}),b.selectedVariables=[]})},b.deselectVariables=function(){b.selectedVariables=[]},b.selectAllVariables=function(){b.selectedVariables=b.variables.rows};var E=!0,A=1;function y(e){b.variables=e||{count:0,rows:[]}}function S(e){m.variable.delete({id:e.id}).$promise.then(function(){_.remove(b.variables.rows,{id:e.id}),b.variables.count-=1,b.variables.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvariable"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getVariables())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","variables","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.tools").controller("VariablesController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.chanSpies=l||{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="chanSpies",b.listOrder="",b.listOrderAsc=null,b.selectedChanSpies=[],b.query={fields:"createdAt,updatedAt,id,name,prefix,options,auth,password,record,recordingFormat,description",sort:"-updatedAt",limit:10,page:1},b.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"),"")}),b.arrayrecordingFormat=_.keyBy([{option:"wav",value:"'wav'"},{option:"gsm",value:"'gsm'"},{option:"wav49",value:"'WAV'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editdialog=function(e,t){i.show({controller:"CreateOrEditchanSpyDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/chanSpies/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{chanSpy:e,chanSpies:b.chanSpies.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getChanSpies=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.voiceChanSpy.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="ChanSpies",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditchanSpy=function(e,t){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:t,chanSpies:b.chanSpies.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deletechanSpy=S,b.exportSelectedChanSpies=function(){var e=angular.copy(b.selectedChanSpies);return b.selectedChanSpies=[],e},b.deleteSelectedChanSpies=function(e){var t=i.confirm().title("Are you sure want to delete the selected chanSpies?").htmlContent("<b>"+b.selectedChanSpies.length+" selected</b> will be deleted.").ariaLabel("delete chanSpys").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedChanSpies.forEach(function(e){S(e)}),b.selectedChanSpies=[]})},b.deselectChanSpies=function(){b.selectedChanSpies=[]},b.selectAllChanSpies=function(){b.selectedChanSpies=b.chanSpies.rows};var E=!0,A=1;function y(e){b.chanSpies=e||{count:0,rows:[]}}function S(e){m.voiceChanSpy.delete({id:e.id}).$promise.then(function(){_.remove(b.chanSpies.rows,{id:e.id}),b.chanSpies.count-=1,b.chanSpies.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceChanSpy"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getChanSpies())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","chanSpies","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.voice").controller("ChanSpiesController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.chanSpies,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The chanSpy will be deleted.").ariaLabel("Delete chanSpy").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.contexts=l||{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="contexts",b.listOrder="",b.listOrderAsc=null,b.selectedContexts=[],b.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",defaultEntry:"false",limit:10,page:1},b.editdialog=function(e,t){i.show({controller:"CreateOrEditContextDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/contexts/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{context:e,contexts:b.contexts.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getContexts=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.voiceContext.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Contexts",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditContext=function(e,t){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:t,contexts:b.contexts.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteContext=S,b.exportSelectedContexts=function(){var e=angular.copy(b.selectedContexts);return b.selectedContexts=[],e},b.deleteSelectedContexts=function(e){var t=i.confirm().title("Are you sure want to delete the selected contexts?").htmlContent("<b>"+b.selectedContexts.length+" selected</b> will be deleted.").ariaLabel("delete Contexts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedContexts.forEach(function(e){S(e)}),b.selectedContexts=[]})},b.deselectContexts=function(){b.selectedContexts=[]},b.selectAllContexts=function(){b.selectedContexts=b.contexts.rows};var E=!0,A=1;function y(e){b.contexts=e||{count:0,rows:[]}}function S(e){m.voiceContext.delete({id:e.id}).$promise.then(function(){_.remove(b.contexts.rows,{id:e.id}),b.contexts.count-=1,b.contexts.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceContext"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getContexts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","contexts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.voice").controller("ContextsController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.contexts,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The context will be deleted.").ariaLabel("Delete Context").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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(e,t,n,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_INBOUNDROUTE",g.inboundroute=angular.copy(l),g.inboundroutes=r,g.newInboundRoute=!1,g.inboundroute||(g.inboundroute={appdata:"Inbound Call",type:"inbound",context:"from-voip-provider"},g.title="VOICE.NEW_INBOUNDROUTE",g.newInboundRoute=!0),g.addNewInboundRoute=function(){g.errors=[],d.voiceExtension.save(g.inboundroute).$promise.then(function(e){g.inboundroutes.unshift(e.toJSON()),o.success({title:"InboundRoute properly created",msg:g.inboundroute.name?g.inboundroute.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.voiceExtension.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveInboundRoute=function(){g.errors=[],d.voiceExtension.update({id:g.inboundroute.id},g.inboundroute).$promise.then(function(e){var t=_.find(g.inboundroutes,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"InboundRoute properly saved!",msg:g.inboundroute.name?g.inboundroute.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.voiceExtension.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteInboundRoute=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The inboundroute will be deleted.").ariaLabel("Delete InboundRoute").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.voiceExtension.delete({id:g.inboundroute.id}).$promise.then(function(){_.remove(g.inboundroutes,{id:g.inboundroute.id}),o.success({title:"InboundRoute properly deleted!",msg:(g.inboundroute.name||"inboundroute")+" has been deleted!"}),v(g.inboundroute)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.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.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.contexts=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.contexts=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.contexts,{id:e.resourceId})}),n=null;if(g.inboundroute&&(n=_.find(g.contexts,{name:g.inboundroute.context})),n&&!_.some(t,["id",n.id])){var a=_.find(g.contexts,{id:n.id});a.canSelect=!1,t.push(a)}g.contexts=t}):d.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){g.contexts=e.rows||[]})}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","inboundroutes","inboundroute","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditInboundRouteDialogController",e)}(),function(){"use strict";function e(m,i,a,s,e){var u=this;function t(e,t){if(u.inboundrouteApps.rows.length){var n=u.inboundrouteApps.rows[t]?u.inboundrouteApps.rows[t]:u.inboundrouteApps.rows[0];i.show({controller:"EditInboundApp"+(n.appType||n.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/inboundroutes/edit/apps/"+(n.appType||n.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{inboundrouteApp:n,inboundroute:u.inboundroute,crudPermissions:u.crudPermissions}}).then(function(e){e&&(e.id?u.inboundrouteApps.rows[t]=e:u.inboundrouteApps.rows.splice(t,0,e),o())}).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 o(){var e=["queue","playback"],t=2,n=[];n.push({type:"inbound",app:"Set",appdata:"CDR(type)=inbound",context:u.inboundroute.context,exten:u.inboundroute.exten,priority:t++,VoiceExtensionId:u.inboundroute.id}),n.push({type:"inbound",app:"Set",appdata:"XCALLY-MOTION-ANSWER=0",context:u.inboundroute.context,exten:u.inboundroute.exten,priority:t++,VoiceExtensionId:u.inboundroute.id}),n.push({type:"inbound",app:"Set",appdata:"XCALLY-MOTION-PROGRESS=0",context:u.inboundroute.context,exten:u.inboundroute.exten,priority:t++,VoiceExtensionId:u.inboundroute.id}),n.push({type:"inbound",app:"Set",appdata:"MONITOR_OPTIONS=ab",context:u.inboundroute.context,exten:u.inboundroute.exten,priority:t++,VoiceExtensionId:u.inboundroute.id});for(var a=0,i=0;a<u.inboundrouteApps.rows.length;a++,i=0){var s=u.inboundrouteApps.rows[a],o=[],r=[];s.intervals="*,*,*,*"!==s.interval?[s.interval]:s.IntervalId?_.map(_.filter(u.intervals.rows,{IntervalId:s.IntervalId}),"interval"):[],s.context=u.inboundroute.context,s.exten=u.inboundroute.exten,s.type&&(s.type=s.type.toLowerCase()),s.hasOwnProperty("answer")&&e.includes(s.app.toLowerCase())&&"custom"!==s.appType&&(s.answer?(o.push({type:s.type.toLowerCase(),app:"ExecIf",appdata:"$[${XCALLY-MOTION-ANSWER}=0]?Answer",context:u.inboundroute.context,exten:u.inboundroute.exten,priority:s.intervals.length+t+i++,VoiceExtensionId:u.inboundroute.id}),o.push({type:s.type.toLowerCase(),app:"Set",appdata:"XCALLY-MOTION-ANSWER=1",context:u.inboundroute.context,exten:u.inboundroute.exten,priority:s.intervals.length+t+i++,VoiceExtensionId:u.inboundroute.id})):(o.push({type:s.type.toLowerCase(),app:"ExecIf",appdata:"$[${XCALLY-MOTION-PROGRESS}=0]?Progress",context:u.inboundroute.context,exten:u.inboundroute.exten,priority:s.intervals.length+t+i++,VoiceExtensionId:u.inboundroute.id}),o.push({type:s.type.toLowerCase(),app:"Set",appdata:"XCALLY-MOTION-PROGRESS=1",context:u.inboundroute.context,exten:u.inboundroute.exten,priority:s.intervals.length+t+i++,VoiceExtensionId:u.inboundroute.id})));for(var l=0;l<s.intervals.length;l++){var d=t+s.intervals.length,c=l===s.intervals.length-1?t+o.length+r.length+2:t+l+1;o.splice(l,0,{type:"inbound",app:"GotoIfTime",appdata:s.intervals[l]+"?"+u.inboundroute.context+",${EXTEN},"+d+":"+u.inboundroute.context+",${EXTEN},"+c,exten:u.inboundroute.exten,context:u.inboundroute.context,priority:t+l,VoiceExtensionId:u.inboundroute.id})}s.priority=o.length?_.last(o).priority+1:t,t=(r.length?_.last(r).priority:s.priority)+1,n=_.concat(n,o,[s],r)}n.push({type:"inbound",app:"Hangup",exten:u.inboundroute.exten,context:u.inboundroute.context,priority:t,VoiceExtensionId:u.inboundroute.id}),m.voiceExtension.addApplications({id:u.inboundroute.id},_.sortBy(n,"priority")).$promise.then(function(e){u.inboundrouteApps.rows=e.rows}).catch(function(e){console.error(e)})}function n(e){u.inboundrouteApps=e||{count:0,rows:[]}}u.currentUser=e.getCurrentUser(),u.inboundroute={},u.inboundrouteApps={count:0,rows:[]},u.selectedInboundRouteApps=[],u.crudPermissions,u.query={sort:"priority"},u.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",types:["always","custom","list"],fields:[],isApp:!1},{app:"Queue",appType:"queue",context:"from-voip-provider",type:"Inbound",appdata:",xX,,,300,,,,,",icon:"icon-apps",options:"xX",interval:"*,*,*,*",answer:!0,isApp:!0,extraApi:[{name:"sounds",field:{name:"sound",key:"save_name",prefix:"/var/opt/motion2/server/files/sounds/converted/"},route:"sound",filters:{fields:"id,name,save_name",sort:"name"},permissions:{section:1007}},{name:"queues",field:{name:"queue",key:"name"},route:"voiceQueue",filters:{type:"inbound",fields:"id,name,type",sort:"name",nolimit:!0},permissions:{section:401}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",required:!0,param:0},{title:"Options",name:"options",type:"text",param:1},{title:"Url",name:"URL",type:"text",param:2},{title:"Announce_Overrides",name:"sound",type:"apiselect",values:"sounds",value:"'/var/opt/motion2/server/files/sounds/converted/{{sound.save_name}}'",option:"sound.name",defaultValues:[{value:"''",option:"None"}],param:3},{title:"Timeout",name:"timeout",type:"number",min:0,param:4},{title:"Agi",name:"agi",type:"text",param:5},{title:"Macro",name:"macro",type:"text",param:6},{title:"GoSub",name:"gosub",type:"text",param:7},{title:"Rule",name:"rule",type:"text",param:8},{title:"Position",name:"position",type:"number",min:0,param:9},{title:"Answer",name:"answer",type:"switch",general:!0}]},{app:"Playback",appType:"playback",context:"from-voip-provider",type:"Inbound",icon:"icon-apps",interval:"*,*,*,*",answer:!0,isApp:!0,extraApi:[{name:"sounds",field:{name:"sound",key:"save_name",prefix:"/var/opt/motion2/server/files/sounds/converted/"},route:"sound",filters:{fields:"id,name,save_name",sort:"name"},permissions:{section:1007}}],fields:[{title:"Audio_Files",name:"appdata",type:"apiselect",values:"sounds",value:"'/var/opt/motion2/server/files/sounds/converted/{{appdata.save_name}}'",option:"appdata.name",required:!0,param:0},{title:"Options",name:"options",type:"text",param:1},{title:"Answer",name:"answer",type:"switch",general:!0}]},{app:"Dial",appType:"dial",context:"from-voip-provider",type:"Inbound",icon:"icon-apps",interval:"*,*,*,*",options:"xX",isApp:!0,fields:[{title:"Technology/Resource",name:"tech",type:"text",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:"Dial",appType:"internalDial",context:"from-voip-provider",type:"Inbound",icon:"icon-apps",interval:"*,*,*,*",options:"xX",isApp:!0,extraApi:[{name:"users",field:{name:"user",key:"name",prefix:"SIP/"},route:"user",filters:{fields:"id,name,role",sort:"name"},permissions:{sections:[{id:202,role:"agent"},{id:203,role:"telephone"}]}}],fields:[{title:"User",name:"user",type:"apiselect",values:"users",value:"'SIP/{{user.name}}'",option:"user.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:"Dial",appType:"externalDial",context:"from-voip-provider",type:"inbound",icon:"icon-apps",interval:"*,*,*,*",options:"xX",isApp:!0,extraApi:[{name:"trunks",field:{name:"trunk",key:"name"},route:"trunk",filters:{fields:"id,name",sort:"name"},permissions:{section:1011}}],fields:[{title:"Trunk",name:"trunk",type:"apiselect",values:"trunks",value:"trunk.name",option:"trunk.name",required:!0,param:0},{title:"Phone",name:"phone",required:!0,type:"text"},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:"Dial",appType:"ringGroup",context:"from-voip-provider",type:"inbound",icon:"icon-apps",interval:"*,*,*,*",options:"xX",isApp:!0,extraApi:[{name:"users",field:{name:"multipleUsers",key:"name",prefix:"SIP/"},route:"user",filters:{fields:"id,name,role",sort:"name"},permissions:{sections:[{id:202,role:"agent"},{id:203,role:"telephone"}]}}],fields:[{title:"User",name:"multipleUsers",type:"apiselect",multiple:!0,values:"users",value:"'SIP/{{multipleUsers.name}}'",option:"multipleUsers.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:"AGI",alias:"CallySquare",appType:"agi",context:"from-voip-provider",type:"inbound",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"projects",field:{name:"project",key:"name",prefix:"agi://127.0.0.1/square,"},route:"squareProject",filters:{fields:"id,name",sort:"name"},permissions:{section:1103}}],fields:[{title:"Project",name:"project",type:"apiselect",values:"projects",value:"'agi://127.0.0.1/square,{{project.name}}'",option:"project.name",required:!0,param:0}]},{app:"goto",appType:"goTo",context:"from-voip-provider",type:"Inbound",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"contexts",field:{name:"context",key:"name"},route:"voiceContext",filters:{fields:"id,name",sort:"name"},permissions:{section:405}}],fields:[{title:"Context",name:"context",type:"apiselect",values:"contexts",value:"context.name",option:"context.name",required:!0,param:0},{title:"Extension",name:"extension",type:"text",required:!0,param:1},{title:"Priority",name:"priority",type:"text",required:!0,param:2}]},{app:"hangup",appType:"hangup",context:"from-voip-provider",type:"Inbound",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Hangup_Cause",name:"appdata",type:"select",param:0,values:[{option:"HANGUPCAUSE_1",value:"'1'"},{option:"HANGUPCAUSE_16",value:"'16'"},{option:"HANGUPCAUSE_17",value:"'17'"},{option:"HANGUPCAUSE_18",value:"'18'"},{option:"HANGUPCAUSE_21",value:"'21'"},{option:"HANGUPCAUSE_22",value:"'22'"},{option:"HANGUPCAUSE_27",value:"'27'"},{option:"HANGUPCAUSE_38",value:"'38'"},{option:"HANGUPCAUSE_41",value:"'41'"}],translate:!0,required:!0,general:!0}]},{app:"Set",appType:"set",context:"from-voip-provider",type:"Inbound",separator:"=",icon:"icon-apps",interval:"*,*,*,*",extraApi:[{name:"variables",field:{name:"name",key:"name"},route:"variable",filters:{fields:"id,name",sort:"name"},permissions:{section:1012}}],isApp:!0,fields:[{title:"Variable",name:"name",type:"apiselect",values:"variables",value:"name.name",option:"name.name",required:!0,param:0},{title:"Value",name:"value",type:"text",required:!0,param:1}]},{app:null,appType:"custom",icon:"icon-apps",type:"Inbound",interval:"*,*,*,*",isApp:!0,fields:[{title:"Application_Name",name:"app",type:"text",required:!0,param:0},{title:"Arguments",name:"appdata",type:"text",param:1}]},{app:"Voicemail",appType:"voicemail",context:"from-voip-provider",icon:"icon-apps",type:"Inbound",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"voiceMails",field:{name:"voiceMail",key:"mailbox",suffix:"@from-voicemail"},route:"voiceMail",filters:{fields:"id,mailbox",sort:"mailbox"},permissions:{section:406}}],fields:[{title:"Mailbox@Context",name:"voiceMail",type:"apiselect",values:"voiceMails",value:"'{{voiceMail.mailbox}}@from-voicemail'",option:"voiceMail.mailbox",required:!0,param:0},{title:"Options",name:"options",type:"text",param:1}]}],["app"]),{isApp:!1}),u.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},u.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){t(e,e.newIndex)},onSort:function(e){o()}},u.init=function(e,t){u.inboundroute=e,u.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},u.applications.disabled=!u.crudPermissions.canEdit,u.query.VoiceExtensionId=e.id,u.query.isApp=!0,u.query.nolimit=!0,u.getInboundRouteApps(),u.getIntervals()},u.deleteConfirm=function(e,t,n){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(n).ok("OK").cancel("CANCEL");i.show(a).then(function(){u.inboundrouteApps.rows.splice(t,1),o()},function(){console.log("CANCEL")})},u.getInboundRouteApps=function(){u.promise=m.voiceExtension.get(u.query,n).$promise},u.editInboundRouteApp=t,u.editInterval=function(e,t){if(u.inboundrouteApps.rows.length){var n=u.inboundrouteApps.rows[t]?u.inboundrouteApps.rows[t]:u.inboundrouteApps.rows[0];i.show({controller:"EditInboundAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/inboundroutes/edit/apps/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:n.interval,IntervalId:n.IntervalId,application:!0},intervals:[],crudPermissions:u.crudPermissions}}).then(function(e){e&&(n.interval=e.interval||"*,*,*,*",n.IntervalId=e.IntervalId||null,o())})}},u.deleteInboundRouteApp=function(e){_.remove(u.inboundrouteApps.rows,{id:e.id}),o(),s.success({title:"App deleted!",msg:e.app?e.app+" has been deleted!":""})},u.deleteSelectedInboundRouteApps=function(e){var t=i.confirm().title("Are you sure want to delete the selected applications?").htmlContent("<b>"+u.selectedInboundRouteApps.length+" selected</b> will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){u.selectedInboundRouteApps.forEach(function(e){_.remove(u.inboundrouteApps.rows,{id:e.id})}),u.selectedInboundRouteApps=[],o()})},u.rewriteRouting=o,u.getIntervals=function(){return m.interval.get({fields:"id,interval,IntervalId"}).$promise.then(function(e){u.intervals=e}).catch(function(e){console.error(e)})}}e.$inject=["api","$mdDialog","$document","toasty","Auth"],angular.module("app.voice").controller("InboundRouteActionsController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.agi=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.agi.appdata)switch(l.agi.appType?l.agi.appType.toLowerCase():l.agi.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.agi.appdata.split(",");l.agi.key=d[0],l.agi.language=d[1],l.agi.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.agi.appdata.split(",");l.agi.accesskeyid=d[0],l.agi.secretaccesskey=d[1],l.agi.lexregion=d[2],l.agi.botname=d[3],l.agi.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.agi.appdata.split(",");l.agi.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.agi.text=d.slice(1,d.length).join(",");break;case"message":l.agi.text=l.agi.appdata;break;case"set":l.agi.name=l.agi.appdata.split("=")[0],l.agi.value=l.agi.appdata.split("=")[1];break;case"agi":l.agi.project=l.agi.appdata;break;default:var c=l.agi.appdata.split(",");l.agi.project=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){t.hide(e)}l.agi.type&&"outbound"===l.agi.type.toLowerCase()&&"outbounddial"===l.agi.appType.toLowerCase()&&(l.agi.prefix=l.agi.phone?l.agi.phone.split("$")[0]:void 0,l.agi.callerId=l.agi.callerID?"CALLERID(all)="+l.agi.callerID:void 0),l.saveInboundRouteApp=function(){l.errors=[];var e=[];l.agi.type&&"outbound"===l.agi.type.toLowerCase()&&"outboundDial"===l.agi.appType&&(l.agi.phone=i.cutdigits?(l.agi.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.agi.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.agi.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.agi.options+="U(xcally-mixmonitor-context)"):l.agi.options=l.agi.options.replace("U(xcally-mixmonitor-context)",""));if(l.agi.appType&&"custom"===l.agi.appType);else switch((l.agi.app||l.agi.appType).toLowerCase()){case"set":l.agi.appdata=l.agi.name+"="+l.agi.value;break;case"custom":break;default:e[0]=l.agi.project,l.agi.appdata=e.join(",")}m(l.agi)},l.closeDialog=m,o.hasRole("admin")?s.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.projects=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PROJECTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.projects=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1103}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.projects,{id:e.resourceId})}),n=null;if(l.agi&&(n=_.find(l.projects,{name:l.agi.project})),n&&!_.some(t,["id",n.id])){var a=_.find(l.projects,{id:n.id});a.canSelect=!1,t.push(a)}l.projects=t})}else{var n=[],a=null;l.agi&&(a=_.find(l.projects,{name:l.agi.project}));for(var i=0;i<l.projects.length;i++)a&&l.projects[i].id===a.id&&(l.projects[i].canSelect=!1,n.push(l.projects[i]));l.projects=n}}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","inboundrouteApp","inboundroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInboundAppagiDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.custom=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.custom.appdata)switch(l.custom.appType?l.custom.appType.toLowerCase():l.custom.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.custom.appdata.split(",");l.custom.key=d[0],l.custom.language=d[1],l.custom.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.custom.appdata.split(",");l.custom.accesskeyid=d[0],l.custom.secretaccesskey=d[1],l.custom.lexregion=d[2],l.custom.botname=d[3],l.custom.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.custom.appdata.split(",");l.custom.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.custom.text=d.slice(1,d.length).join(",");break;case"message":l.custom.text=l.custom.appdata;break;case"set":l.custom.name=l.custom.appdata.split("=")[0],l.custom.value=l.custom.appdata.split("=")[1];break;case"agi":l.custom.project=l.custom.appdata;break;default:var c=l.custom.appdata.split(",");l.custom.app=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.custom.appdata=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}function m(e){t.hide(e)}l.custom.type&&"outbound"===l.custom.type.toLowerCase()&&"outbounddial"===l.custom.appType.toLowerCase()&&(l.custom.prefix=l.custom.phone?l.custom.phone.split("$")[0]:void 0,l.custom.callerId=l.custom.callerID?"CALLERID(all)="+l.custom.callerID:void 0),l.saveInboundRouteApp=function(){l.errors=[];var e=[];l.custom.type&&"outbound"===l.custom.type.toLowerCase()&&"outboundDial"===l.custom.appType&&(l.custom.phone=i.cutdigits?(l.custom.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.custom.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.custom.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.custom.options+="U(xcally-mixmonitor-context)"):l.custom.options=l.custom.options.replace("U(xcally-mixmonitor-context)",""));if(l.custom.appType&&"custom"===l.custom.appType);else switch((l.custom.app||l.custom.appType).toLowerCase()){case"set":l.custom.appdata=l.custom.name+"="+l.custom.value;break;case"custom":break;default:e[0]=l.custom.app,e[1]=l.custom.appdata,l.custom.appdata=e.join(",")}m(l.custom)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","inboundrouteApp","inboundroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInboundAppcustomDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.dial=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dial.appdata)switch(l.dial.appType?l.dial.appType.toLowerCase():l.dial.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dial.appdata.split(",");l.dial.key=d[0],l.dial.language=d[1],l.dial.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.dial.appdata.split(",");l.dial.accesskeyid=d[0],l.dial.secretaccesskey=d[1],l.dial.lexregion=d[2],l.dial.botname=d[3],l.dial.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dial.appdata.split(",");l.dial.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dial.text=d.slice(1,d.length).join(",");break;case"message":l.dial.text=l.dial.appdata;break;case"set":l.dial.name=l.dial.appdata.split("=")[0],l.dial.value=l.dial.appdata.split("=")[1];break;case"agi":l.dial.project=l.dial.appdata;break;default:var c=l.dial.appdata.split(",");l.dial.tech=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dial.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dial.options=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.dial.url=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10)}function m(e){t.hide(e)}l.dial.type&&"outbound"===l.dial.type.toLowerCase()&&"outbounddial"===l.dial.appType.toLowerCase()&&(l.dial.prefix=l.dial.phone?l.dial.phone.split("$")[0]:void 0,l.dial.callerId=l.dial.callerID?"CALLERID(all)="+l.dial.callerID:void 0),l.saveInboundRouteApp=function(){l.errors=[];var e=[];l.dial.type&&"outbound"===l.dial.type.toLowerCase()&&"outboundDial"===l.dial.appType&&(l.dial.phone=i.cutdigits?(l.dial.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dial.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dial.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dial.options+="U(xcally-mixmonitor-context)"):l.dial.options=l.dial.options.replace("U(xcally-mixmonitor-context)",""));if(l.dial.appType&&"custom"===l.dial.appType);else switch((l.dial.app||l.dial.appType).toLowerCase()){case"set":l.dial.appdata=l.dial.name+"="+l.dial.value;break;case"custom":break;default:e[0]=l.dial.tech,e[1]=l.dial.timeout,e[2]=l.dial.options,e[3]=l.dial.url,l.dial.appdata=e.join(",")}m(l.dial)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","inboundrouteApp","inboundroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInboundAppdialDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.externaldial=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.externaldial.appdata)switch(l.externaldial.appType?l.externaldial.appType.toLowerCase():l.externaldial.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.externaldial.appdata.split(",");l.externaldial.key=d[0],l.externaldial.language=d[1],l.externaldial.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.externaldial.appdata.split(",");l.externaldial.accesskeyid=d[0],l.externaldial.secretaccesskey=d[1],l.externaldial.lexregion=d[2],l.externaldial.botname=d[3],l.externaldial.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.externaldial.appdata.split(",");l.externaldial.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.externaldial.text=d.slice(1,d.length).join(",");break;case"message":l.externaldial.text=l.externaldial.appdata;break;case"set":l.externaldial.name=l.externaldial.appdata.split("=")[0],l.externaldial.value=l.externaldial.appdata.split("=")[1];break;case"agi":l.externaldial.project=l.externaldial.appdata;break;default:var c=l.externaldial.appdata.split(",");l.externaldial.trunk=c[0].split("/")[1],l.externaldial.phone=c[0].split("/")[2],l.externaldial.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.externaldial.options=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.externaldial.url=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10)}function m(e){t.hide(e)}l.externaldial.type&&"outbound"===l.externaldial.type.toLowerCase()&&"outbounddial"===l.externaldial.appType.toLowerCase()&&(l.externaldial.prefix=l.externaldial.phone?l.externaldial.phone.split("$")[0]:void 0,l.externaldial.callerId=l.externaldial.callerID?"CALLERID(all)="+l.externaldial.callerID:void 0),l.saveInboundRouteApp=function(){l.errors=[];var e=[];l.externaldial.type&&"outbound"===l.externaldial.type.toLowerCase()&&"outboundDial"===l.externaldial.appType&&(l.externaldial.phone=i.cutdigits?(l.externaldial.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.externaldial.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.externaldial.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.externaldial.options+="U(xcally-mixmonitor-context)"):l.externaldial.options=l.externaldial.options.replace("U(xcally-mixmonitor-context)",""));if(l.externaldial.appType&&"custom"===l.externaldial.appType);else switch((l.externaldial.app||l.externaldial.appType).toLowerCase()){case"set":l.externaldial.appdata=l.externaldial.name+"="+l.externaldial.value;break;case"custom":break;default:e[0]=["SIP",l.externaldial.trunk,l.externaldial.phone].join("/"),e[1]=l.externaldial.timeout,e[2]=l.externaldial.options,e[3]=l.externaldial.url,l.externaldial.appdata=e.join(",")}m(l.externaldial)},l.closeDialog=m,o.hasRole("admin")?s.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.trunks=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.trunks=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.trunks,{id:e.resourceId})}),n=null;if(l.externaldial&&(n=_.find(l.trunks,{name:l.externaldial.trunk})),n&&!_.some(t,["id",n.id])){var a=_.find(l.trunks,{id:n.id});a.canSelect=!1,t.push(a)}l.trunks=t})}else{var n=[],a=null;l.externaldial&&(a=_.find(l.trunks,{name:l.externaldial.trunk}));for(var i=0;i<l.trunks.length;i++)a&&l.trunks[i].id===a.id&&(l.trunks[i].canSelect=!1,n.push(l.trunks[i]));l.trunks=n}}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","inboundrouteApp","inboundroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInboundAppexternaldialDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.goto=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.goto.appdata)switch(l.goto.appType?l.goto.appType.toLowerCase():l.goto.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.goto.appdata.split(",");l.goto.key=d[0],l.goto.language=d[1],l.goto.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.goto.appdata.split(",");l.goto.accesskeyid=d[0],l.goto.secretaccesskey=d[1],l.goto.lexregion=d[2],l.goto.botname=d[3],l.goto.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.goto.appdata.split(",");l.goto.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.goto.text=d.slice(1,d.length).join(",");break;case"message":l.goto.text=l.goto.appdata;break;case"set":l.goto.name=l.goto.appdata.split("=")[0],l.goto.value=l.goto.appdata.split("=")[1];break;case"agi":l.goto.project=l.goto.appdata;break;default:var c=l.goto.appdata.split(",");l.goto.context=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.goto.extension=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.goto.priority=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}function m(e){t.hide(e)}l.goto.type&&"outbound"===l.goto.type.toLowerCase()&&"outbounddial"===l.goto.appType.toLowerCase()&&(l.goto.prefix=l.goto.phone?l.goto.phone.split("$")[0]:void 0,l.goto.callerId=l.goto.callerID?"CALLERID(all)="+l.goto.callerID:void 0),l.saveInboundRouteApp=function(){l.errors=[];var e=[];l.goto.type&&"outbound"===l.goto.type.toLowerCase()&&"outboundDial"===l.goto.appType&&(l.goto.phone=i.cutdigits?(l.goto.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.goto.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.goto.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.goto.options+="U(xcally-mixmonitor-context)"):l.goto.options=l.goto.options.replace("U(xcally-mixmonitor-context)",""));if(l.goto.appType&&"custom"===l.goto.appType);else switch((l.goto.app||l.goto.appType).toLowerCase()){case"set":l.goto.appdata=l.goto.name+"="+l.goto.value;break;case"custom":break;default:e[0]=l.goto.context,e[1]=l.goto.extension,e[2]=l.goto.priority,l.goto.appdata=e.join(",")}m(l.goto)},l.closeDialog=m,o.hasRole("admin")?s.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.contexts=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.contexts=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.contexts,{id:e.resourceId})}),n=null;if(l.goto&&(n=_.find(l.contexts,{name:l.goto.context})),n&&!_.some(t,["id",n.id])){var a=_.find(l.contexts,{id:n.id});a.canSelect=!1,t.push(a)}l.contexts=t}):s.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){l.contexts=e.rows||[]})}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","inboundrouteApp","inboundroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInboundAppgotoDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.hangup=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.hangup.appdata)switch(l.hangup.appType?l.hangup.appType.toLowerCase():l.hangup.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.hangup.appdata.split(",");l.hangup.key=d[0],l.hangup.language=d[1],l.hangup.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.hangup.appdata.split(",");l.hangup.accesskeyid=d[0],l.hangup.secretaccesskey=d[1],l.hangup.lexregion=d[2],l.hangup.botname=d[3],l.hangup.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.hangup.appdata.split(",");l.hangup.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.hangup.text=d.slice(1,d.length).join(",");break;case"message":l.hangup.text=l.hangup.appdata;break;case"set":l.hangup.name=l.hangup.appdata.split("=")[0],l.hangup.value=l.hangup.appdata.split("=")[1];break;case"agi":l.hangup.project=l.hangup.appdata;break;default:var c=l.hangup.appdata.split(",");l.hangup.appdata=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){t.hide(e)}l.hangup.type&&"outbound"===l.hangup.type.toLowerCase()&&"outbounddial"===l.hangup.appType.toLowerCase()&&(l.hangup.prefix=l.hangup.phone?l.hangup.phone.split("$")[0]:void 0,l.hangup.callerId=l.hangup.callerID?"CALLERID(all)="+l.hangup.callerID:void 0),l.saveInboundRouteApp=function(){l.errors=[];var e=[];l.hangup.type&&"outbound"===l.hangup.type.toLowerCase()&&"outboundDial"===l.hangup.appType&&(l.hangup.phone=i.cutdigits?(l.hangup.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.hangup.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.hangup.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.hangup.options+="U(xcally-mixmonitor-context)"):l.hangup.options=l.hangup.options.replace("U(xcally-mixmonitor-context)",""));if(l.hangup.appType&&"custom"===l.hangup.appType);else switch((l.hangup.app||l.hangup.appType).toLowerCase()){case"set":l.hangup.appdata=l.hangup.name+"="+l.hangup.value;break;case"custom":break;default:e[0]=l.hangup.appdata,l.hangup.appdata=e.join(",")}m(l.hangup)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","inboundrouteApp","inboundroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInboundApphangupDialogController",e)}(),function(){"use strict";function e(t,o,n,e,a,r,i,s){var l=this;if(l.currentUser=i.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(e.appType||e.app).toUpperCase(),l.internaldial=angular.copy(e),l.crudPermissions=s,l.hasModulePermissions={},l.internaldial.appdata)switch(l.internaldial.appType?l.internaldial.appType.toLowerCase():l.internaldial.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.internaldial.appdata.split(",");l.internaldial.key=d[0],l.internaldial.language=d[1],l.internaldial.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.internaldial.appdata.split(",");l.internaldial.accesskeyid=d[0],l.internaldial.secretaccesskey=d[1],l.internaldial.lexregion=d[2],l.internaldial.botname=d[3],l.internaldial.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.internaldial.appdata.split(",");l.internaldial.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.internaldial.text=d.slice(1,d.length).join(",");break;case"message":l.internaldial.text=l.internaldial.appdata;break;case"set":l.internaldial.name=l.internaldial.appdata.split("=")[0],l.internaldial.value=l.internaldial.appdata.split("=")[1];break;case"agi":l.internaldial.project=l.internaldial.appdata;break;default:var c=l.internaldial.appdata.split(",");l.internaldial.user=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.internaldial.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.internaldial.options=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.internaldial.url=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10)}l.internaldial.type&&"outbound"===l.internaldial.type.toLowerCase()&&"outbounddial"===l.internaldial.appType.toLowerCase()&&(l.internaldial.prefix=l.internaldial.phone?l.internaldial.phone.split("$")[0]:void 0,l.internaldial.callerId=l.internaldial.callerID?"CALLERID(all)="+l.internaldial.callerID:void 0),l.saveInboundRouteApp=function(){l.errors=[];var e=[];l.internaldial.type&&"outbound"===l.internaldial.type.toLowerCase()&&"outboundDial"===l.internaldial.appType&&(l.internaldial.phone=a.cutdigits?(l.internaldial.prefix||"")+"${EXTEN:"+a.cutdigits+"}":(l.internaldial.prefix||"")+"${EXTEN}","none"!==a.recordingFormat?l.internaldial.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.internaldial.options+="U(xcally-mixmonitor-context)"):l.internaldial.options=l.internaldial.options.replace("U(xcally-mixmonitor-context)",""));if(l.internaldial.appType&&"custom"===l.internaldial.appType);else switch((l.internaldial.app||l.internaldial.appType).toLowerCase()){case"set":l.internaldial.appdata=l.internaldial.name+"="+l.internaldial.value;break;case"custom":break;default:e[0]=l.internaldial.user,e[1]=l.internaldial.timeout,e[2]=l.internaldial.options,e[3]=l.internaldial.url,l.internaldial.appdata=e.join(",")}p(l.internaldial)},l.closeDialog=p;var m=[{id:202,role:"agent"},{id:203,role:"telephone"}],u=null;function p(e){t.hide(e)}i.hasRole("admin")?r.user.get({fields:"id,name,role",sort:"name"}).$promise.then(function(e){l.users=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.user.get({fields:"id,name,role",sort:"name"}).$promise.then(function(e){u=e.rows||[]}).then(function(){for(var e=[],t=0;t<m.length;t++)e.push(r.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:m[t].id}).$promise);return o.all(e)}).then(function(e){for(var t=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),n=[],a=0;a<m.length;a++){var i=_.find(t,["sectionId",m[a].id]);if(i)if(i.autoAssociation){var s=[];u.forEach(function(e){e.role===m[a].role&&s.push(e)}),n.push({rows:s,count:s.length})}else n.push(r.userProfileResource.get({sectionId:i.id}).$promise)}return o.all(n)}).then(function(e){var t=[],n=null;l.internaldial&&(n=_.find(u,{name:l.internaldial.user}));for(var a=0;a<e.length;a++){(e[a].rows||[]).forEach(function(e){t.push(e)})}n&&!_.some(t,["resourceId",n.id])&&u.forEach(function(e){e.id===n.id&&(e.canSelect=!1,t.push(e))}),l.users=t}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETusers",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","inboundrouteApp","inboundroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInboundAppinternaldialDialogController",e)}(),function(){"use strict";function e(e,t,n,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 E(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var t=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),n=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(t+"-"+n)}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 A(e){t.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=E(),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!":""}),A()}).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=E(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),A(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var t=_.find(c.intervals,{id:e.id});t&&_.merge(t,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),A()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=A,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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=e&&e.rows?e.rows:[],n=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(t,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,n.push(e))}),c.intervals=n})}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("EditInboundAppintervalDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.playback=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.playback.appdata)switch(l.playback.appType?l.playback.appType.toLowerCase():l.playback.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.playback.appdata.split(",");l.playback.key=d[0],l.playback.language=d[1],l.playback.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.playback.appdata.split(",");l.playback.accesskeyid=d[0],l.playback.secretaccesskey=d[1],l.playback.lexregion=d[2],l.playback.botname=d[3],l.playback.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.playback.appdata.split(",");l.playback.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.playback.text=d.slice(1,d.length).join(",");break;case"message":l.playback.text=l.playback.appdata;break;case"set":l.playback.name=l.playback.appdata.split("=")[0],l.playback.value=l.playback.appdata.split("=")[1];break;case"agi":l.playback.project=l.playback.appdata;break;default:var c=l.playback.appdata.split(",");l.playback.appdata=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.playback.options=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}function m(e){t.hide(e)}l.playback.type&&"outbound"===l.playback.type.toLowerCase()&&"outbounddial"===l.playback.appType.toLowerCase()&&(l.playback.prefix=l.playback.phone?l.playback.phone.split("$")[0]:void 0,l.playback.callerId=l.playback.callerID?"CALLERID(all)="+l.playback.callerID:void 0),l.saveInboundRouteApp=function(){l.errors=[];var e=[];l.playback.type&&"outbound"===l.playback.type.toLowerCase()&&"outboundDial"===l.playback.appType&&(l.playback.phone=i.cutdigits?(l.playback.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.playback.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.playback.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.playback.options+="U(xcally-mixmonitor-context)"):l.playback.options=l.playback.options.replace("U(xcally-mixmonitor-context)",""));if(l.playback.appType&&"custom"===l.playback.appType);else switch((l.playback.app||l.playback.appType).toLowerCase()){case"set":l.playback.appdata=l.playback.name+"="+l.playback.value;break;case"custom":break;default:e[0]=l.playback.appdata,e[1]=l.playback.options,l.playback.appdata=e.join(",")}m(l.playback)},l.closeDialog=m,o.hasRole("admin")?s.sound.get({fields:"id,name,save_name",sort:"name"}).$promise.then(function(e){l.sounds=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SOUNDS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.sound.get({fields:"id,name,save_name",sort:"name"}).$promise.then(function(e){l.sounds=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1007}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.sounds,{id:e.resourceId})}),n=null;if(l.playback&&(n=_.find(l.sounds,{save_name:l.playback.sound})),n&&!_.some(t,["id",n.id])){var a=_.find(l.sounds,{id:n.id});a.canSelect=!1,t.push(a)}l.sounds=t})}else{var n=[],a=null;l.playback&&(a=_.find(l.sounds,{save_name:l.playback.sound}));for(var i=0;i<l.sounds.length;i++)a&&l.sounds[i].id===a.id&&(l.sounds[i].canSelect=!1,n.push(l.sounds[i]));l.sounds=n}}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsounds",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","inboundrouteApp","inboundroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInboundAppplaybackDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.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"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.options=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.queue.URL=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.queue.sound=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.queue.timeout=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10),l.queue.agi=_.isEmpty(c[5])?c[5]:isNaN(c[5])?c[5]:parseInt(c[5],10),l.queue.macro=_.isEmpty(c[6])?c[6]:isNaN(c[6])?c[6]:parseInt(c[6],10),l.queue.gosub=_.isEmpty(c[7])?c[7]:isNaN(c[7])?c[7]:parseInt(c[7],10),l.queue.rule=_.isEmpty(c[8])?c[8]:isNaN(c[8])?c[8]:parseInt(c[8],10),l.queue.position=_.isEmpty(c[9])?c[9]:isNaN(c[9])?c[9]:parseInt(c[9],10)}function m(e){t.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.saveInboundRouteApp=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)",""));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.options,e[2]=l.queue.URL,e[3]=l.queue.sound,e[4]=l.queue.timeout,e[5]=l.queue.agi,e[6]=l.queue.macro,e[7]=l.queue.gosub,e[8]=l.queue.rule,e[9]=l.queue.position,l.queue.appdata=e.join(",")}m(l.queue)},l.closeDialog=m,o.hasRole("admin")?s.sound.get({fields:"id,name,save_name",sort:"name"}).$promise.then(function(e){l.sounds=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SOUNDS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.sound.get({fields:"id,name,save_name",sort:"name"}).$promise.then(function(e){l.sounds=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1007}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.sounds,{id:e.resourceId})}),n=null;if(l.queue&&(n=_.find(l.sounds,{save_name:l.queue.sound})),n&&!_.some(t,["id",n.id])){var a=_.find(l.sounds,{id:n.id});a.canSelect=!1,t.push(a)}l.sounds=t})}else{var n=[],a=null;l.queue&&(a=_.find(l.sounds,{save_name:l.queue.sound}));for(var i=0;i<l.sounds.length;i++)a&&l.sounds[i].id===a.id&&(l.sounds[i].canSelect=!1,n.push(l.sounds[i]));l.sounds=n}}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsounds",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.hasRole("admin")?s.voiceQueue.get({type:"inbound",fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.voiceQueue.get({type:"inbound",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:401}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),n=null;if(l.queue&&(n=_.find(l.queues,{name:l.queue.queue})),n&&!_.some(t,["id",n.id])){var a=_.find(l.queues,{id:n.id});a.canSelect=!1,t.push(a)}l.queues=t})}else{var n=[],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,n.push(l.queues[i]));l.queues=n}}).catch(function(e){n.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","inboundrouteApp","inboundroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInboundAppqueueDialogController",e)}(),function(){"use strict";function e(t,o,n,e,a,r,i,s){var l=this;if(l.currentUser=i.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(e.appType||e.app).toUpperCase(),l.ringgroup=angular.copy(e),l.crudPermissions=s,l.hasModulePermissions={},l.ringgroup.appdata)switch(l.ringgroup.appType?l.ringgroup.appType.toLowerCase():l.ringgroup.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.ringgroup.appdata.split(",");l.ringgroup.key=d[0],l.ringgroup.language=d[1],l.ringgroup.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.ringgroup.appdata.split(",");l.ringgroup.accesskeyid=d[0],l.ringgroup.secretaccesskey=d[1],l.ringgroup.lexregion=d[2],l.ringgroup.botname=d[3],l.ringgroup.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.ringgroup.appdata.split(",");l.ringgroup.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.ringgroup.text=d.slice(1,d.length).join(",");break;case"message":l.ringgroup.text=l.ringgroup.appdata;break;case"set":l.ringgroup.name=l.ringgroup.appdata.split("=")[0],l.ringgroup.value=l.ringgroup.appdata.split("=")[1];break;case"agi":l.ringgroup.project=l.ringgroup.appdata;break;default:var c=l.ringgroup.appdata.split(",");l.ringgroup.multipleUsers=c[0].split("&"),l.ringgroup.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.ringgroup.options=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.ringgroup.url=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10)}l.ringgroup.type&&"outbound"===l.ringgroup.type.toLowerCase()&&"outbounddial"===l.ringgroup.appType.toLowerCase()&&(l.ringgroup.prefix=l.ringgroup.phone?l.ringgroup.phone.split("$")[0]:void 0,l.ringgroup.callerId=l.ringgroup.callerID?"CALLERID(all)="+l.ringgroup.callerID:void 0),l.saveInboundRouteApp=function(){l.errors=[];var e=[];l.ringgroup.type&&"outbound"===l.ringgroup.type.toLowerCase()&&"outboundDial"===l.ringgroup.appType&&(l.ringgroup.phone=a.cutdigits?(l.ringgroup.prefix||"")+"${EXTEN:"+a.cutdigits+"}":(l.ringgroup.prefix||"")+"${EXTEN}","none"!==a.recordingFormat?l.ringgroup.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.ringgroup.options+="U(xcally-mixmonitor-context)"):l.ringgroup.options=l.ringgroup.options.replace("U(xcally-mixmonitor-context)",""));if(l.ringgroup.appType&&"custom"===l.ringgroup.appType);else switch((l.ringgroup.app||l.ringgroup.appType).toLowerCase()){case"set":l.ringgroup.appdata=l.ringgroup.name+"="+l.ringgroup.value;break;case"custom":break;default:e[0]=l.ringgroup.multipleUsers.join("&"),e[1]=l.ringgroup.timeout,e[2]=l.ringgroup.options,e[3]=l.ringgroup.url,l.ringgroup.appdata=e.join(",")}p(l.ringgroup)},l.closeDialog=p;var m=[{id:202,role:"agent"},{id:203,role:"telephone"}],u=null;function p(e){t.hide(e)}i.hasRole("admin")?r.user.get({fields:"id,name,role",sort:"name"}).$promise.then(function(e){l.users=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.user.get({fields:"id,name,role",sort:"name"}).$promise.then(function(e){u=e.rows||[]}).then(function(){for(var e=[],t=0;t<m.length;t++)e.push(r.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:m[t].id}).$promise);return o.all(e)}).then(function(e){for(var t=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),n=[],a=0;a<m.length;a++){var i=_.find(t,["sectionId",m[a].id]);if(i)if(i.autoAssociation){var s=[];u.forEach(function(e){e.role===m[a].role&&s.push(e)}),n.push({rows:s,count:s.length})}else n.push(r.userProfileResource.get({sectionId:i.id}).$promise)}return o.all(n)}).then(function(e){var t=[],n=null;l.ringgroup&&(n=_.find(u,{name:l.ringgroup.multipleUsers}));for(var a=0;a<e.length;a++){(e[a].rows||[]).forEach(function(e){t.push(e)})}n&&!_.some(t,["resourceId",n.id])&&u.forEach(function(e){e.id===n.id&&(e.canSelect=!1,t.push(e))}),l.users=t}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETusers",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","inboundrouteApp","inboundroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInboundAppringgroupDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.set=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.set.appdata)switch(l.set.appType?l.set.appType.toLowerCase():l.set.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.set.appdata.split(",");l.set.key=d[0],l.set.language=d[1],l.set.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.set.appdata.split(",");l.set.accesskeyid=d[0],l.set.secretaccesskey=d[1],l.set.lexregion=d[2],l.set.botname=d[3],l.set.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.set.appdata.split(",");l.set.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.set.text=d.slice(1,d.length).join(",");break;case"message":l.set.text=l.set.appdata;break;case"set":l.set.name=l.set.appdata.split("=")[0],l.set.value=l.set.appdata.split("=")[1];break;case"agi":l.set.project=l.set.appdata;break;default:var c=l.set.appdata.split("=");l.set.name=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.set.value=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}function m(e){t.hide(e)}l.set.type&&"outbound"===l.set.type.toLowerCase()&&"outbounddial"===l.set.appType.toLowerCase()&&(l.set.prefix=l.set.phone?l.set.phone.split("$")[0]:void 0,l.set.callerId=l.set.callerID?"CALLERID(all)="+l.set.callerID:void 0),l.saveInboundRouteApp=function(){l.errors=[];var e=[];l.set.type&&"outbound"===l.set.type.toLowerCase()&&"outboundDial"===l.set.appType&&(l.set.phone=i.cutdigits?(l.set.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.set.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.set.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.set.options+="U(xcally-mixmonitor-context)"):l.set.options=l.set.options.replace("U(xcally-mixmonitor-context)",""));if(l.set.appType&&"custom"===l.set.appType);else switch((l.set.app||l.set.appType).toLowerCase()){case"set":l.set.appdata=l.set.name+"="+l.set.value;break;case"custom":break;default:e[0]=l.set.name,e[1]=l.set.value,l.set.appdata=e.join("=")}m(l.set)},l.closeDialog=m,o.hasRole("admin")?s.variable.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.variables=e.rows||[]}).catch(function(e){n.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"}).$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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),n=null;if(l.set&&(n=_.find(l.variables,{name:l.set.name})),n&&!_.some(t,["id",n.id])){var a=_.find(l.variables,{id:n.id});a.canSelect=!1,t.push(a)}l.variables=t})}else{var n=[],a=null;l.set&&(a=_.find(l.variables,{name:l.set.name}));for(var i=0;i<l.variables.length;i++)a&&l.variables[i].id===a.id&&(l.variables[i].canSelect=!1,n.push(l.variables[i]));l.variables=n}}).catch(function(e){n.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","inboundrouteApp","inboundroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInboundAppsetDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.voicemail=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.voicemail.appdata)switch(l.voicemail.appType?l.voicemail.appType.toLowerCase():l.voicemail.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.voicemail.appdata.split(",");l.voicemail.key=d[0],l.voicemail.language=d[1],l.voicemail.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.voicemail.appdata.split(",");l.voicemail.accesskeyid=d[0],l.voicemail.secretaccesskey=d[1],l.voicemail.lexregion=d[2],l.voicemail.botname=d[3],l.voicemail.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.voicemail.appdata.split(",");l.voicemail.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.voicemail.text=d.slice(1,d.length).join(",");break;case"message":l.voicemail.text=l.voicemail.appdata;break;case"set":l.voicemail.name=l.voicemail.appdata.split("=")[0],l.voicemail.value=l.voicemail.appdata.split("=")[1];break;case"agi":l.voicemail.project=l.voicemail.appdata;break;default:var c=l.voicemail.appdata.split(",");l.voicemail.voiceMail=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.voicemail.options=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}function m(e){t.hide(e)}l.voicemail.type&&"outbound"===l.voicemail.type.toLowerCase()&&"outbounddial"===l.voicemail.appType.toLowerCase()&&(l.voicemail.prefix=l.voicemail.phone?l.voicemail.phone.split("$")[0]:void 0,l.voicemail.callerId=l.voicemail.callerID?"CALLERID(all)="+l.voicemail.callerID:void 0),l.saveInboundRouteApp=function(){l.errors=[];var e=[];l.voicemail.type&&"outbound"===l.voicemail.type.toLowerCase()&&"outboundDial"===l.voicemail.appType&&(l.voicemail.phone=i.cutdigits?(l.voicemail.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.voicemail.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.voicemail.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.voicemail.options+="U(xcally-mixmonitor-context)"):l.voicemail.options=l.voicemail.options.replace("U(xcally-mixmonitor-context)",""));if(l.voicemail.appType&&"custom"===l.voicemail.appType);else switch((l.voicemail.app||l.voicemail.appType).toLowerCase()){case"set":l.voicemail.appdata=l.voicemail.name+"="+l.voicemail.value;break;case"custom":break;default:e[0]=l.voicemail.voiceMail,e[1]=l.voicemail.options,l.voicemail.appdata=e.join(",")}m(l.voicemail)},l.closeDialog=m,o.hasRole("admin")?s.voiceMail.get({fields:"id,mailbox",sort:"mailbox"}).$promise.then(function(e){l.voiceMails=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VOICEMAILS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.voiceMail.get({fields:"id,mailbox",sort:"mailbox"}).$promise.then(function(e){l.voiceMails=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:406}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.voiceMails,{id:e.resourceId})}),n=null;if(l.voicemail&&(n=_.find(l.voiceMails,{mailbox:l.voicemail.voiceMail})),n&&!_.some(t,["id",n.id])){var a=_.find(l.voiceMails,{id:n.id});a.canSelect=!1,t.push(a)}l.voiceMails=t})}else{var n=[],a=null;l.voicemail&&(a=_.find(l.voiceMails,{mailbox:l.voicemail.voiceMail}));for(var i=0;i<l.voiceMails.length;i++)a&&l.voiceMails[i].id===a.id&&(l.voiceMails[i].canSelect=!1,n.push(l.voiceMails[i]));l.voiceMails=n}}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMails",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","inboundrouteApp","inboundroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInboundAppvoicemailDialogController",e)}(),function(){"use strict";function e(e,t,n,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=t.protocol()+"://"+t.host(),u.inboundroute=c||e.params.inboundroute||{},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.gotoInboundRoutes=function(){e.go("app.voice.inboundroutes")},u.saveInboundRoute=function(){r.voiceExtension.update({id:u.inboundroute.id},u.inboundroute).$promise.then(function(){l.success({title:"InboundRoute updated!",msg:u.inboundroute.name?u.inboundroute.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceExtension",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 t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.contexts,{id:e.resourceId})}),n=null;if(u.inboundroute&&(n=_.find(u.contexts,{name:u.inboundroute.context})),n&&!_.some(t,["id",n.id])){var a=_.find(u.contexts,{id:n.id});a.canSelect=!1,t.push(a)}u.contexts=t}):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","inboundroute","userProfileSection"],angular.module("app.voice").controller("InboundRouteController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.inboundroutes=l||{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="inboundroutes",b.listOrder="",b.listOrderAsc=null,b.selectedInboundRoutes=[],b.query={fields:"createdAt,updatedAt,id,appdata,type,exten,context,description",type:"inbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,page:1},b.editstate=function(e,t){n.go("app.voice.inboundroutes.edit",{id:e.id,inboundroute:e,crudPermissions:b.crudPermissions})},b.deleteconfirm=function(e,t){var n=i.confirm().title("Are you sure want to delete the "+_.startCase("inboundroute")+"?").htmlContent("<b>"+(e.name||"inboundroute")+"</b> will be deleted.").ariaLabel("delete inboundroute").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getInboundRoutes=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.voiceExtension.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="InboundRoutes",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditInboundRoute=function(e,t){i.show({controller:"CreateOrEditInboundRouteDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/inboundroutes/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{inboundroute:t,inboundroutes:b.inboundroutes.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteInboundRoute=S,b.exportSelectedInboundRoutes=function(){var e=angular.copy(b.selectedInboundRoutes);return b.selectedInboundRoutes=[],e},b.deleteSelectedInboundRoutes=function(e){var t=i.confirm().title("Are you sure want to delete the selected inboundroutes?").htmlContent("<b>"+b.selectedInboundRoutes.length+" selected</b> will be deleted.").ariaLabel("delete InboundRoutes").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedInboundRoutes.forEach(function(e){S(e)}),b.selectedInboundRoutes=[]})},b.deselectInboundRoutes=function(){b.selectedInboundRoutes=[]},b.selectAllInboundRoutes=function(){b.selectedInboundRoutes=b.inboundroutes.rows},g.hasRole("admin")?m.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){b.contexts=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){b.contexts=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(b.contexts,{id:e.resourceId})}),n=null;if(b.inboundroute&&(n=_.find(b.contexts,{name:b.inboundroute.context})),n&&!_.some(t,["id",n.id])){var a=_.find(b.contexts,{id:n.id});a.canSelect=!1,t.push(a)}b.contexts=t}):m.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){b.contexts=e.rows||[]})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})});var E=!0,A=1;function y(e){b.inboundroutes=e||{count:0,rows:[]}}function S(e){m.voiceExtension.delete({id:e.id}).$promise.then(function(){_.remove(b.inboundroutes.rows,{id:e.id}),b.inboundroutes.count-=1,b.inboundroutes.rows.length||b.getInboundRoutes(),p.success({title:_.startCase("InboundRoute")+" 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:DELETEvoiceExtension"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceExtension",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getInboundRoutes())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","inboundroutes","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.voice").controller("InboundRoutesController",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(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_INTERNALROUTE",g.internalroute=angular.copy(l),g.internalroutes=r,g.newInternalRoute=!1,g.internalroute||(g.internalroute={appdata:"Internal Call",type:"internal",context:"from-sip"},g.title="VOICE.NEW_INTERNALROUTE",g.newInternalRoute=!0),g.addNewInternalRoute=function(){g.errors=[],d.voiceExtension.save(g.internalroute).$promise.then(function(e){g.internalroutes.unshift(e.toJSON()),o.success({title:"InternalRoute properly created",msg:g.internalroute.name?g.internalroute.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.voiceExtension.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveInternalRoute=function(){g.errors=[],d.voiceExtension.update({id:g.internalroute.id},g.internalroute).$promise.then(function(e){var t=_.find(g.internalroutes,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"InternalRoute properly saved!",msg:g.internalroute.name?g.internalroute.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.voiceExtension.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteInternalRoute=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The internalroute will be deleted.").ariaLabel("Delete InternalRoute").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.voiceExtension.delete({id:g.internalroute.id}).$promise.then(function(){_.remove(g.internalroutes,{id:g.internalroute.id}),o.success({title:"InternalRoute properly deleted!",msg:(g.internalroute.name||"internalroute")+" has been deleted!"}),v(g.internalroute)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.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.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.contexts=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.contexts=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.contexts,{id:e.resourceId})}),n=null;if(g.internalroute&&(n=_.find(g.contexts,{name:g.internalroute.context})),n&&!_.some(t,["id",n.id])){var a=_.find(g.contexts,{id:n.id});a.canSelect=!1,t.push(a)}g.contexts=t}):d.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){g.contexts=e.rows||[]})}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","internalroutes","internalroute","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditInternalRouteDialogController",e)}(),function(){"use strict";function e(m,i,a,s,e){var u=this;function t(e,t){if(u.internalrouteApps.rows.length){var n=u.internalrouteApps.rows[t]?u.internalrouteApps.rows[t]:u.internalrouteApps.rows[0];i.show({controller:"EditInternalApp"+(n.appType||n.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/internalroutes/edit/apps/"+(n.appType||n.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{internalrouteApp:n,internalroute:u.internalroute,crudPermissions:u.crudPermissions}}).then(function(e){e&&(e.id?u.internalrouteApps.rows[t]=e:u.internalrouteApps.rows.splice(t,0,e),o())}).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 o(){var e=["queue","playback"],t=2,n=[];n.push({type:"internal",app:"Set",appdata:"CDR(type)=internal",context:u.internalroute.context,exten:u.internalroute.exten,priority:t++,VoiceExtensionId:u.internalroute.id}),n.push({type:"internal",app:"Set",appdata:"XCALLY-MOTION-ANSWER=0",context:u.internalroute.context,exten:u.internalroute.exten,priority:t++,VoiceExtensionId:u.internalroute.id}),n.push({type:"internal",app:"Set",appdata:"XCALLY-MOTION-PROGRESS=0",context:u.internalroute.context,exten:u.internalroute.exten,priority:t++,VoiceExtensionId:u.internalroute.id}),n.push({type:"internal",app:"Set",appdata:"MONITOR_OPTIONS=ab",context:u.internalroute.context,exten:u.internalroute.exten,priority:t++,VoiceExtensionId:u.internalroute.id});for(var a=0,i=0;a<u.internalrouteApps.rows.length;a++,i=0){var s=u.internalrouteApps.rows[a],o=[],r=[];s.intervals="*,*,*,*"!==s.interval?[s.interval]:s.IntervalId?_.map(_.filter(u.intervals.rows,{IntervalId:s.IntervalId}),"interval"):[],s.context=u.internalroute.context,s.exten=u.internalroute.exten,s.type&&(s.type=s.type.toLowerCase()),s.hasOwnProperty("answer")&&e.includes(s.app.toLowerCase())&&"custom"!==s.appType&&(s.answer?(o.push({type:s.type.toLowerCase(),app:"ExecIf",appdata:"$[${XCALLY-MOTION-ANSWER}=0]?Answer",context:u.internalroute.context,exten:u.internalroute.exten,priority:s.intervals.length+t+i++,VoiceExtensionId:u.internalroute.id}),o.push({type:s.type.toLowerCase(),app:"Set",appdata:"XCALLY-MOTION-ANSWER=1",context:u.internalroute.context,exten:u.internalroute.exten,priority:s.intervals.length+t+i++,VoiceExtensionId:u.internalroute.id})):(o.push({type:s.type.toLowerCase(),app:"ExecIf",appdata:"$[${XCALLY-MOTION-PROGRESS}=0]?Progress",context:u.internalroute.context,exten:u.internalroute.exten,priority:s.intervals.length+t+i++,VoiceExtensionId:u.internalroute.id}),o.push({type:s.type.toLowerCase(),app:"Set",appdata:"XCALLY-MOTION-PROGRESS=1",context:u.internalroute.context,exten:u.internalroute.exten,priority:s.intervals.length+t+i++,VoiceExtensionId:u.internalroute.id})));for(var l=0;l<s.intervals.length;l++){var d=t+s.intervals.length,c=l===s.intervals.length-1?t+o.length+r.length+2:t+l+1;o.splice(l,0,{type:"internal",app:"GotoIfTime",appdata:s.intervals[l]+"?"+u.internalroute.context+",${EXTEN},"+d+":"+u.internalroute.context+",${EXTEN},"+c,exten:u.internalroute.exten,context:u.internalroute.context,priority:t+l,VoiceExtensionId:u.internalroute.id})}s.priority=o.length?_.last(o).priority+1:t,t=(r.length?_.last(r).priority:s.priority)+1,n=_.concat(n,o,[s],r)}n.push({type:"internal",app:"Hangup",exten:u.internalroute.exten,context:u.internalroute.context,priority:t,VoiceExtensionId:u.internalroute.id}),m.voiceExtension.addApplications({id:u.internalroute.id},_.sortBy(n,"priority")).$promise.then(function(e){u.internalrouteApps.rows=e.rows}).catch(function(e){console.error(e)})}function n(e){u.internalrouteApps=e||{count:0,rows:[]}}u.currentUser=e.getCurrentUser(),u.internalroute={},u.internalrouteApps={count:0,rows:[]},u.selectedInternalRouteApps=[],u.crudPermissions,u.query={sort:"priority"},u.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",type:"Internal",types:["always","custom","list"],fields:[],isApp:!1},{app:"Queue",appType:"queue",context:"from-sip",type:"Internal",options:"xX",appdata:",xX,,,300,,,,,",icon:"icon-apps",interval:"*,*,*,*",answer:!0,isApp:!0,extraApi:[{name:"sounds",field:{name:"sound",key:"save_name",prefix:"/var/opt/motion2/server/files/sounds/converted/"},route:"sound",filters:{fields:"id,name,save_name",sort:"name"},permissions:{section:1007}},{name:"queues",field:{name:"queue",key:"name"},route:"voiceQueue",filters:{type:"inbound",fields:"id,name,type",sort:"name",nolimit:!0},permissions:{section:401}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",required:!0,param:0},{title:"Options",name:"options",type:"text",param:1},{title:"Url",name:"URL",type:"text",param:2},{title:"Announce_Overrides",name:"sound",type:"apiselect",values:"sounds",value:"'/var/opt/motion2/server/files/sounds/converted/{{sound.save_name}}'",option:"sound.name",defaultValues:[{value:"''",option:"None"}],param:3},{title:"Timeout",name:"timeout",type:"number",min:0,param:4},{title:"Agi",name:"agi",type:"text",param:5},{title:"Macro",name:"macro",type:"text",param:6},{title:"GoSub",name:"gosub",type:"text",param:7},{title:"Rule",name:"rule",type:"text",param:8},{title:"Position",name:"position",type:"number",min:0,param:9},{title:"Answer",name:"answer",type:"switch",general:!0}]},{app:"Playback",appType:"playback",context:"from-sip",type:"Internal",icon:"icon-apps",interval:"*,*,*,*",answer:!0,isApp:!0,extraApi:[{name:"sounds",field:{name:"appdata",key:"save_name",prefix:"/var/opt/motion2/server/files/sounds/converted/"},route:"sound",filters:{fields:"id,name,save_name",sort:"name"},permissions:{section:1007}}],fields:[{title:"Audio_Files",name:"appdata",type:"apiselect",values:"sounds",value:"'/var/opt/motion2/server/files/sounds/converted/{{appdata.save_name}}'",option:"appdata.name",required:!0,param:0},{title:"Options",name:"options",type:"text",param:1},{title:"Answer",name:"answer",type:"switch",general:!0}]},{app:"Dial",appType:"dial",context:"from-sip",type:"Internal",icon:"icon-apps",options:"xX",interval:"*,*,*,*",isApp:!0,fields:[{title:"Technology/Resource",name:"tech",type:"text",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:"Dial",appType:"internalDial",context:"from-sip",type:"Internal",icon:"icon-apps",options:"xX",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"users",field:{name:"user",key:"name",prefix:"SIP/"},route:"user",filters:{fields:"id,name,role",sort:"name"},permissions:{sections:[{id:202,role:"agent"},{id:203,role:"telephone"}]}}],fields:[{title:"User",name:"user",type:"apiselect",values:"users",value:"'SIP/{{user.name}}'",option:"user.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:"Dial",appType:"externalDial",context:"from-sip",type:"Internal",icon:"icon-apps",interval:"*,*,*,*",options:"xX",isApp:!0,extraApi:[{name:"trunks",field:{name:"trunk",key:"name"},route:"trunk",filters:{fields:"id,name",sort:"name"},permissions:{section:1011}}],fields:[{title:"Trunk",name:"trunk",type:"apiselect",values:"trunks",value:"trunk.name",option:"trunk.name",required:!0,param:0},{title:"Phone",name:"phone",type:"text"},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:"Dial",appType:"ringGroup",context:"from-sip",type:"Internal",icon:"icon-apps",interval:"*,*,*,*",options:"xX",isApp:!0,extraApi:[{name:"users",field:{name:"multipleUsers",key:"name",prefix:"SIP/"},route:"user",filters:{fields:"id,name,role",sort:"name"},permissions:{sections:[{id:202,role:"agent"},{id:203,role:"telephone"}]}}],fields:[{title:"User",name:"multipleUsers",type:"apiselect",multiple:!0,values:"users",value:"'SIP/{{multipleUsers.name}}'",option:"multipleUsers.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:"AGI",alias:"CallySquare",appType:"agi",context:"from-sip",type:"Internal",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"projects",field:{name:"project",key:"name",prefix:"agi://127.0.0.1/square,"},route:"squareProject",filters:{fields:"id,name",sort:"name"},permissions:{section:1103}}],fields:[{title:"Project",name:"project",type:"apiselect",values:"projects",value:"'agi://127.0.0.1/square,{{project.name}}'",option:"project.name",required:!0,param:0}]},{app:"goto",appType:"goTo",context:"from-sip",type:"Internal",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"contexts",field:{name:"context",key:"name"},route:"voiceContext",filters:{fields:"id,name",sort:"name"},permissions:{section:405}}],fields:[{title:"Context",name:"context",type:"apiselect",values:"contexts",value:"context.name",option:"context.name",required:!0,param:0},{title:"Extension",name:"extension",type:"text",required:!0,param:1},{title:"Priority",name:"priority",type:"text",required:!0,param:2}]},{app:"hangup",appType:"hangup",context:"from-sip",type:"Internal",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Hangup_Cause",name:"appdata",type:"select",param:0,values:[{option:"HANGUPCAUSE_1",value:"'1'"},{option:"HANGUPCAUSE_16",value:"'16'"},{option:"HANGUPCAUSE_17",value:"'17'"},{option:"HANGUPCAUSE_18",value:"'18'"},{option:"HANGUPCAUSE_21",value:"'21'"},{option:"HANGUPCAUSE_22",value:"'22'"},{option:"HANGUPCAUSE_27",value:"'27'"},{option:"HANGUPCAUSE_38",value:"'38'"},{option:"HANGUPCAUSE_41",value:"'41'"}],translate:!0,required:!0,general:!0}]},{app:"Set",appType:"set",context:"from-sip",type:"Internal",separator:"=",icon:"icon-apps",interval:"*,*,*,*",extraApi:[{name:"variables",field:{name:"name",key:"name"},route:"variable",filters:{fields:"id,name",sort:"name"},permissions:{section:1012}}],isApp:!0,fields:[{title:"Variable",name:"name",type:"apiselect",values:"variables",value:"name.name",option:"name.name",required:!0,param:0},{title:"Value",name:"value",type:"text",required:!0,param:1}]},{app:null,appType:"custom",icon:"icon-apps",type:"Internal",interval:"*,*,*,*",isApp:!0,fields:[{title:"Application_Name",name:"app",type:"text",required:!0,param:0},{title:"Arguments",name:"appdata",type:"text",param:1}]},{app:"Voicemail",appType:"voicemail",context:"from-sip",icon:"icon-apps",type:"Internal",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"voiceMails",field:{name:"voiceMail",key:"mailbox",suffix:"@from-voicemail"},route:"voiceMail",filters:{fields:"id,mailbox",sort:"mailbox"},permissions:{section:406}}],fields:[{title:"Mailbox@Context",name:"voiceMail",type:"apiselect",values:"voiceMails",value:"'{{voiceMail.mailbox}}@from-voicemail'",option:"voiceMail.mailbox",required:!0,param:0},{title:"Options",name:"options",type:"text",param:1}]}],["app"]),{isApp:!1}),u.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},u.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){t(e,e.newIndex)},onSort:function(e){o()}},u.init=function(e,t){u.internalroute=e,u.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},u.applications.disabled=!u.crudPermissions.canEdit,u.query.VoiceExtensionId=e.id,u.query.isApp=!0,u.query.nolimit=!0,u.getInternalRouteApps(),u.getIntervals()},u.deleteConfirm=function(e,t,n){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(n).ok("OK").cancel("CANCEL");i.show(a).then(function(){u.internalrouteApps.rows.splice(t,1),o()},function(){console.log("CANCEL")})},u.getInternalRouteApps=function(){u.promise=m.voiceExtension.get(u.query,n).$promise},u.editInternalRouteApp=t,u.editInterval=function(e,t){if(u.internalrouteApps.rows.length){var n=u.internalrouteApps.rows[t]?u.internalrouteApps.rows[t]:u.internalrouteApps.rows[0];i.show({controller:"EditInternalAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/internalroutes/edit/apps/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:n.interval,IntervalId:n.IntervalId,application:!0},intervals:[],crudPermissions:u.crudPermissions}}).then(function(e){e&&(n.interval=e.interval||"*,*,*,*",n.IntervalId=e.IntervalId||null,o())})}},u.deleteInternalRouteApp=function(e){_.remove(u.internalrouteApps.rows,{id:e.id}),o(),s.success({title:"App deleted!",msg:e.app?e.app+" has been deleted!":""})},u.deleteSelectedInternalRouteApps=function(e){var t=i.confirm().title("Are you sure want to delete the selected applications?").htmlContent("<b>"+u.selectedInternalRouteApps.length+" selected</b> will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){u.selectedInternalRouteApps.forEach(function(e){_.remove(u.internalrouteApps.rows,{id:e.id})}),u.selectedInternalRouteApps=[],o()})},u.rewriteRouting=o,u.getIntervals=function(){return m.interval.get({fields:"id,interval,IntervalId"}).$promise.then(function(e){u.intervals=e}).catch(function(e){console.error(e)})}}e.$inject=["api","$mdDialog","$document","toasty","Auth"],angular.module("app.voice").controller("InternalRouteActionsController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.agi=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.agi.appdata)switch(l.agi.appType?l.agi.appType.toLowerCase():l.agi.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.agi.appdata.split(",");l.agi.key=d[0],l.agi.language=d[1],l.agi.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.agi.appdata.split(",");l.agi.accesskeyid=d[0],l.agi.secretaccesskey=d[1],l.agi.lexregion=d[2],l.agi.botname=d[3],l.agi.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.agi.appdata.split(",");l.agi.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.agi.text=d.slice(1,d.length).join(",");break;case"message":l.agi.text=l.agi.appdata;break;case"set":l.agi.name=l.agi.appdata.split("=")[0],l.agi.value=l.agi.appdata.split("=")[1];break;case"agi":l.agi.project=l.agi.appdata;break;default:var c=l.agi.appdata.split(",");l.agi.project=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){t.hide(e)}l.agi.type&&"outbound"===l.agi.type.toLowerCase()&&"outbounddial"===l.agi.appType.toLowerCase()&&(l.agi.prefix=l.agi.phone?l.agi.phone.split("$")[0]:void 0,l.agi.callerId=l.agi.callerID?"CALLERID(all)="+l.agi.callerID:void 0),l.saveInternalRouteApp=function(){l.errors=[];var e=[];l.agi.type&&"outbound"===l.agi.type.toLowerCase()&&"outboundDial"===l.agi.appType&&(l.agi.phone=i.cutdigits?(l.agi.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.agi.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.agi.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.agi.options+="U(xcally-mixmonitor-context)"):l.agi.options=l.agi.options.replace("U(xcally-mixmonitor-context)",""));if(l.agi.appType&&"custom"===l.agi.appType);else switch((l.agi.app||l.agi.appType).toLowerCase()){case"set":l.agi.appdata=l.agi.name+"="+l.agi.value;break;case"custom":break;default:e[0]=l.agi.project,l.agi.appdata=e.join(",")}m(l.agi)},l.closeDialog=m,o.hasRole("admin")?s.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.projects=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PROJECTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.projects=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1103}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.projects,{id:e.resourceId})}),n=null;if(l.agi&&(n=_.find(l.projects,{name:l.agi.project})),n&&!_.some(t,["id",n.id])){var a=_.find(l.projects,{id:n.id});a.canSelect=!1,t.push(a)}l.projects=t})}else{var n=[],a=null;l.agi&&(a=_.find(l.projects,{name:l.agi.project}));for(var i=0;i<l.projects.length;i++)a&&l.projects[i].id===a.id&&(l.projects[i].canSelect=!1,n.push(l.projects[i]));l.projects=n}}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","internalrouteApp","internalroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInternalAppagiDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.custom=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.custom.appdata)switch(l.custom.appType?l.custom.appType.toLowerCase():l.custom.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.custom.appdata.split(",");l.custom.key=d[0],l.custom.language=d[1],l.custom.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.custom.appdata.split(",");l.custom.accesskeyid=d[0],l.custom.secretaccesskey=d[1],l.custom.lexregion=d[2],l.custom.botname=d[3],l.custom.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.custom.appdata.split(",");l.custom.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.custom.text=d.slice(1,d.length).join(",");break;case"message":l.custom.text=l.custom.appdata;break;case"set":l.custom.name=l.custom.appdata.split("=")[0],l.custom.value=l.custom.appdata.split("=")[1];break;case"agi":l.custom.project=l.custom.appdata;break;default:var c=l.custom.appdata.split(",");l.custom.app=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.custom.appdata=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}function m(e){t.hide(e)}l.custom.type&&"outbound"===l.custom.type.toLowerCase()&&"outbounddial"===l.custom.appType.toLowerCase()&&(l.custom.prefix=l.custom.phone?l.custom.phone.split("$")[0]:void 0,l.custom.callerId=l.custom.callerID?"CALLERID(all)="+l.custom.callerID:void 0),l.saveInternalRouteApp=function(){l.errors=[];var e=[];l.custom.type&&"outbound"===l.custom.type.toLowerCase()&&"outboundDial"===l.custom.appType&&(l.custom.phone=i.cutdigits?(l.custom.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.custom.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.custom.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.custom.options+="U(xcally-mixmonitor-context)"):l.custom.options=l.custom.options.replace("U(xcally-mixmonitor-context)",""));if(l.custom.appType&&"custom"===l.custom.appType);else switch((l.custom.app||l.custom.appType).toLowerCase()){case"set":l.custom.appdata=l.custom.name+"="+l.custom.value;break;case"custom":break;default:e[0]=l.custom.app,e[1]=l.custom.appdata,l.custom.appdata=e.join(",")}m(l.custom)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","internalrouteApp","internalroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInternalAppcustomDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.dial=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dial.appdata)switch(l.dial.appType?l.dial.appType.toLowerCase():l.dial.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dial.appdata.split(",");l.dial.key=d[0],l.dial.language=d[1],l.dial.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.dial.appdata.split(",");l.dial.accesskeyid=d[0],l.dial.secretaccesskey=d[1],l.dial.lexregion=d[2],l.dial.botname=d[3],l.dial.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dial.appdata.split(",");l.dial.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dial.text=d.slice(1,d.length).join(",");break;case"message":l.dial.text=l.dial.appdata;break;case"set":l.dial.name=l.dial.appdata.split("=")[0],l.dial.value=l.dial.appdata.split("=")[1];break;case"agi":l.dial.project=l.dial.appdata;break;default:var c=l.dial.appdata.split(",");l.dial.tech=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dial.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dial.options=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.dial.url=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10)}function m(e){t.hide(e)}l.dial.type&&"outbound"===l.dial.type.toLowerCase()&&"outbounddial"===l.dial.appType.toLowerCase()&&(l.dial.prefix=l.dial.phone?l.dial.phone.split("$")[0]:void 0,l.dial.callerId=l.dial.callerID?"CALLERID(all)="+l.dial.callerID:void 0),l.saveInternalRouteApp=function(){l.errors=[];var e=[];l.dial.type&&"outbound"===l.dial.type.toLowerCase()&&"outboundDial"===l.dial.appType&&(l.dial.phone=i.cutdigits?(l.dial.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dial.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dial.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dial.options+="U(xcally-mixmonitor-context)"):l.dial.options=l.dial.options.replace("U(xcally-mixmonitor-context)",""));if(l.dial.appType&&"custom"===l.dial.appType);else switch((l.dial.app||l.dial.appType).toLowerCase()){case"set":l.dial.appdata=l.dial.name+"="+l.dial.value;break;case"custom":break;default:e[0]=l.dial.tech,e[1]=l.dial.timeout,e[2]=l.dial.options,e[3]=l.dial.url,l.dial.appdata=e.join(",")}m(l.dial)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","internalrouteApp","internalroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInternalAppdialDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.externaldial=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.externaldial.appdata)switch(l.externaldial.appType?l.externaldial.appType.toLowerCase():l.externaldial.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.externaldial.appdata.split(",");l.externaldial.key=d[0],l.externaldial.language=d[1],l.externaldial.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.externaldial.appdata.split(",");l.externaldial.accesskeyid=d[0],l.externaldial.secretaccesskey=d[1],l.externaldial.lexregion=d[2],l.externaldial.botname=d[3],l.externaldial.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.externaldial.appdata.split(",");l.externaldial.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.externaldial.text=d.slice(1,d.length).join(",");break;case"message":l.externaldial.text=l.externaldial.appdata;break;case"set":l.externaldial.name=l.externaldial.appdata.split("=")[0],l.externaldial.value=l.externaldial.appdata.split("=")[1];break;case"agi":l.externaldial.project=l.externaldial.appdata;break;default:var c=l.externaldial.appdata.split(",");l.externaldial.trunk=c[0].split("/")[1],l.externaldial.phone=c[0].split("/")[2],l.externaldial.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.externaldial.options=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.externaldial.url=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10)}function m(e){t.hide(e)}l.externaldial.type&&"outbound"===l.externaldial.type.toLowerCase()&&"outbounddial"===l.externaldial.appType.toLowerCase()&&(l.externaldial.prefix=l.externaldial.phone?l.externaldial.phone.split("$")[0]:void 0,l.externaldial.callerId=l.externaldial.callerID?"CALLERID(all)="+l.externaldial.callerID:void 0),l.saveInternalRouteApp=function(){l.errors=[];var e=[];l.externaldial.type&&"outbound"===l.externaldial.type.toLowerCase()&&"outboundDial"===l.externaldial.appType&&(l.externaldial.phone=i.cutdigits?(l.externaldial.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.externaldial.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.externaldial.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.externaldial.options+="U(xcally-mixmonitor-context)"):l.externaldial.options=l.externaldial.options.replace("U(xcally-mixmonitor-context)",""));if(l.externaldial.appType&&"custom"===l.externaldial.appType);else switch((l.externaldial.app||l.externaldial.appType).toLowerCase()){case"set":l.externaldial.appdata=l.externaldial.name+"="+l.externaldial.value;break;case"custom":break;default:e[0]=["SIP",l.externaldial.trunk,l.externaldial.phone].join("/"),e[1]=l.externaldial.timeout,e[2]=l.externaldial.options,e[3]=l.externaldial.url,l.externaldial.appdata=e.join(",")}m(l.externaldial)},l.closeDialog=m,o.hasRole("admin")?s.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.trunks=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.trunks=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.trunks,{id:e.resourceId})}),n=null;if(l.externaldial&&(n=_.find(l.trunks,{name:l.externaldial.trunk})),n&&!_.some(t,["id",n.id])){var a=_.find(l.trunks,{id:n.id});a.canSelect=!1,t.push(a)}l.trunks=t})}else{var n=[],a=null;l.externaldial&&(a=_.find(l.trunks,{name:l.externaldial.trunk}));for(var i=0;i<l.trunks.length;i++)a&&l.trunks[i].id===a.id&&(l.trunks[i].canSelect=!1,n.push(l.trunks[i]));l.trunks=n}}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","internalrouteApp","internalroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInternalAppexternaldialDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.goto=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.goto.appdata)switch(l.goto.appType?l.goto.appType.toLowerCase():l.goto.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.goto.appdata.split(",");l.goto.key=d[0],l.goto.language=d[1],l.goto.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.goto.appdata.split(",");l.goto.accesskeyid=d[0],l.goto.secretaccesskey=d[1],l.goto.lexregion=d[2],l.goto.botname=d[3],l.goto.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.goto.appdata.split(",");l.goto.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.goto.text=d.slice(1,d.length).join(",");break;case"message":l.goto.text=l.goto.appdata;break;case"set":l.goto.name=l.goto.appdata.split("=")[0],l.goto.value=l.goto.appdata.split("=")[1];break;case"agi":l.goto.project=l.goto.appdata;break;default:var c=l.goto.appdata.split(",");l.goto.context=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.goto.extension=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.goto.priority=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}function m(e){t.hide(e)}l.goto.type&&"outbound"===l.goto.type.toLowerCase()&&"outbounddial"===l.goto.appType.toLowerCase()&&(l.goto.prefix=l.goto.phone?l.goto.phone.split("$")[0]:void 0,l.goto.callerId=l.goto.callerID?"CALLERID(all)="+l.goto.callerID:void 0),l.saveInternalRouteApp=function(){l.errors=[];var e=[];l.goto.type&&"outbound"===l.goto.type.toLowerCase()&&"outboundDial"===l.goto.appType&&(l.goto.phone=i.cutdigits?(l.goto.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.goto.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.goto.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.goto.options+="U(xcally-mixmonitor-context)"):l.goto.options=l.goto.options.replace("U(xcally-mixmonitor-context)",""));if(l.goto.appType&&"custom"===l.goto.appType);else switch((l.goto.app||l.goto.appType).toLowerCase()){case"set":l.goto.appdata=l.goto.name+"="+l.goto.value;break;case"custom":break;default:e[0]=l.goto.context,e[1]=l.goto.extension,e[2]=l.goto.priority,l.goto.appdata=e.join(",")}m(l.goto)},l.closeDialog=m,o.hasRole("admin")?s.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.contexts=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.contexts=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.contexts,{id:e.resourceId})}),n=null;if(l.goto&&(n=_.find(l.contexts,{name:l.goto.context})),n&&!_.some(t,["id",n.id])){var a=_.find(l.contexts,{id:n.id});a.canSelect=!1,t.push(a)}l.contexts=t}):s.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){l.contexts=e.rows||[]})}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","internalrouteApp","internalroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInternalAppgotoDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.hangup=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.hangup.appdata)switch(l.hangup.appType?l.hangup.appType.toLowerCase():l.hangup.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.hangup.appdata.split(",");l.hangup.key=d[0],l.hangup.language=d[1],l.hangup.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.hangup.appdata.split(",");l.hangup.accesskeyid=d[0],l.hangup.secretaccesskey=d[1],l.hangup.lexregion=d[2],l.hangup.botname=d[3],l.hangup.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.hangup.appdata.split(",");l.hangup.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.hangup.text=d.slice(1,d.length).join(",");break;case"message":l.hangup.text=l.hangup.appdata;break;case"set":l.hangup.name=l.hangup.appdata.split("=")[0],l.hangup.value=l.hangup.appdata.split("=")[1];break;case"agi":l.hangup.project=l.hangup.appdata;break;default:var c=l.hangup.appdata.split(",");l.hangup.appdata=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){t.hide(e)}l.hangup.type&&"outbound"===l.hangup.type.toLowerCase()&&"outbounddial"===l.hangup.appType.toLowerCase()&&(l.hangup.prefix=l.hangup.phone?l.hangup.phone.split("$")[0]:void 0,l.hangup.callerId=l.hangup.callerID?"CALLERID(all)="+l.hangup.callerID:void 0),l.saveInternalRouteApp=function(){l.errors=[];var e=[];l.hangup.type&&"outbound"===l.hangup.type.toLowerCase()&&"outboundDial"===l.hangup.appType&&(l.hangup.phone=i.cutdigits?(l.hangup.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.hangup.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.hangup.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.hangup.options+="U(xcally-mixmonitor-context)"):l.hangup.options=l.hangup.options.replace("U(xcally-mixmonitor-context)",""));if(l.hangup.appType&&"custom"===l.hangup.appType);else switch((l.hangup.app||l.hangup.appType).toLowerCase()){case"set":l.hangup.appdata=l.hangup.name+"="+l.hangup.value;break;case"custom":break;default:e[0]=l.hangup.appdata,l.hangup.appdata=e.join(",")}m(l.hangup)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","internalrouteApp","internalroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInternalApphangupDialogController",e)}(),function(){"use strict";function e(t,o,n,e,a,r,i,s){var l=this;if(l.currentUser=i.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(e.appType||e.app).toUpperCase(),l.internaldial=angular.copy(e),l.crudPermissions=s,l.hasModulePermissions={},l.internaldial.appdata)switch(l.internaldial.appType?l.internaldial.appType.toLowerCase():l.internaldial.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.internaldial.appdata.split(",");l.internaldial.key=d[0],l.internaldial.language=d[1],l.internaldial.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.internaldial.appdata.split(",");l.internaldial.accesskeyid=d[0],l.internaldial.secretaccesskey=d[1],l.internaldial.lexregion=d[2],l.internaldial.botname=d[3],l.internaldial.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.internaldial.appdata.split(",");l.internaldial.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.internaldial.text=d.slice(1,d.length).join(",");break;case"message":l.internaldial.text=l.internaldial.appdata;break;case"set":l.internaldial.name=l.internaldial.appdata.split("=")[0],l.internaldial.value=l.internaldial.appdata.split("=")[1];break;case"agi":l.internaldial.project=l.internaldial.appdata;break;default:var c=l.internaldial.appdata.split(",");l.internaldial.user=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.internaldial.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.internaldial.options=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.internaldial.url=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10)}l.internaldial.type&&"outbound"===l.internaldial.type.toLowerCase()&&"outbounddial"===l.internaldial.appType.toLowerCase()&&(l.internaldial.prefix=l.internaldial.phone?l.internaldial.phone.split("$")[0]:void 0,l.internaldial.callerId=l.internaldial.callerID?"CALLERID(all)="+l.internaldial.callerID:void 0),l.saveInternalRouteApp=function(){l.errors=[];var e=[];l.internaldial.type&&"outbound"===l.internaldial.type.toLowerCase()&&"outboundDial"===l.internaldial.appType&&(l.internaldial.phone=a.cutdigits?(l.internaldial.prefix||"")+"${EXTEN:"+a.cutdigits+"}":(l.internaldial.prefix||"")+"${EXTEN}","none"!==a.recordingFormat?l.internaldial.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.internaldial.options+="U(xcally-mixmonitor-context)"):l.internaldial.options=l.internaldial.options.replace("U(xcally-mixmonitor-context)",""));if(l.internaldial.appType&&"custom"===l.internaldial.appType);else switch((l.internaldial.app||l.internaldial.appType).toLowerCase()){case"set":l.internaldial.appdata=l.internaldial.name+"="+l.internaldial.value;break;case"custom":break;default:e[0]=l.internaldial.user,e[1]=l.internaldial.timeout,e[2]=l.internaldial.options,e[3]=l.internaldial.url,l.internaldial.appdata=e.join(",")}p(l.internaldial)},l.closeDialog=p;var m=[{id:202,role:"agent"},{id:203,role:"telephone"}],u=null;function p(e){t.hide(e)}i.hasRole("admin")?r.user.get({fields:"id,name,role",sort:"name"}).$promise.then(function(e){l.users=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.user.get({fields:"id,name,role",sort:"name"}).$promise.then(function(e){u=e.rows||[]}).then(function(){for(var e=[],t=0;t<m.length;t++)e.push(r.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:m[t].id}).$promise);return o.all(e)}).then(function(e){for(var t=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),n=[],a=0;a<m.length;a++){var i=_.find(t,["sectionId",m[a].id]);if(i)if(i.autoAssociation){var s=[];u.forEach(function(e){e.role===m[a].role&&s.push(e)}),n.push({rows:s,count:s.length})}else n.push(r.userProfileResource.get({sectionId:i.id}).$promise)}return o.all(n)}).then(function(e){var t=[],n=null;l.internaldial&&(n=_.find(u,{name:l.internaldial.user}));for(var a=0;a<e.length;a++){(e[a].rows||[]).forEach(function(e){t.push(e)})}n&&!_.some(t,["resourceId",n.id])&&u.forEach(function(e){e.id===n.id&&(e.canSelect=!1,t.push(e))}),l.users=t}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETusers",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","internalrouteApp","internalroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInternalAppinternaldialDialogController",e)}(),function(){"use strict";function e(e,t,n,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 E(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var t=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),n=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(t+"-"+n)}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 A(e){t.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=E(),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!":""}),A()}).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=E(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),A(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var t=_.find(c.intervals,{id:e.id});t&&_.merge(t,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),A()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=A,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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=e&&e.rows?e.rows:[],n=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(t,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,n.push(e))}),c.intervals=n})}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("EditInternalAppintervalDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.playback=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.playback.appdata)switch(l.playback.appType?l.playback.appType.toLowerCase():l.playback.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.playback.appdata.split(",");l.playback.key=d[0],l.playback.language=d[1],l.playback.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.playback.appdata.split(",");l.playback.accesskeyid=d[0],l.playback.secretaccesskey=d[1],l.playback.lexregion=d[2],l.playback.botname=d[3],l.playback.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.playback.appdata.split(",");l.playback.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.playback.text=d.slice(1,d.length).join(",");break;case"message":l.playback.text=l.playback.appdata;break;case"set":l.playback.name=l.playback.appdata.split("=")[0],l.playback.value=l.playback.appdata.split("=")[1];break;case"agi":l.playback.project=l.playback.appdata;break;default:var c=l.playback.appdata.split(",");l.playback.appdata=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.playback.options=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}function m(e){t.hide(e)}l.playback.type&&"outbound"===l.playback.type.toLowerCase()&&"outbounddial"===l.playback.appType.toLowerCase()&&(l.playback.prefix=l.playback.phone?l.playback.phone.split("$")[0]:void 0,l.playback.callerId=l.playback.callerID?"CALLERID(all)="+l.playback.callerID:void 0),l.saveInternalRouteApp=function(){l.errors=[];var e=[];l.playback.type&&"outbound"===l.playback.type.toLowerCase()&&"outboundDial"===l.playback.appType&&(l.playback.phone=i.cutdigits?(l.playback.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.playback.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.playback.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.playback.options+="U(xcally-mixmonitor-context)"):l.playback.options=l.playback.options.replace("U(xcally-mixmonitor-context)",""));if(l.playback.appType&&"custom"===l.playback.appType);else switch((l.playback.app||l.playback.appType).toLowerCase()){case"set":l.playback.appdata=l.playback.name+"="+l.playback.value;break;case"custom":break;default:e[0]=l.playback.appdata,e[1]=l.playback.options,l.playback.appdata=e.join(",")}m(l.playback)},l.closeDialog=m,o.hasRole("admin")?s.sound.get({fields:"id,name,save_name",sort:"name"}).$promise.then(function(e){l.sounds=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SOUNDS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.sound.get({fields:"id,name,save_name",sort:"name"}).$promise.then(function(e){l.sounds=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1007}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.sounds,{id:e.resourceId})}),n=null;if(l.playback&&(n=_.find(l.sounds,{save_name:l.playback.appdata})),n&&!_.some(t,["id",n.id])){var a=_.find(l.sounds,{id:n.id});a.canSelect=!1,t.push(a)}l.sounds=t})}else{var n=[],a=null;l.playback&&(a=_.find(l.sounds,{save_name:l.playback.appdata}));for(var i=0;i<l.sounds.length;i++)a&&l.sounds[i].id===a.id&&(l.sounds[i].canSelect=!1,n.push(l.sounds[i]));l.sounds=n}}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsounds",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","internalrouteApp","internalroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInternalAppplaybackDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.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"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.options=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.queue.URL=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.queue.sound=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.queue.timeout=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10),l.queue.agi=_.isEmpty(c[5])?c[5]:isNaN(c[5])?c[5]:parseInt(c[5],10),l.queue.macro=_.isEmpty(c[6])?c[6]:isNaN(c[6])?c[6]:parseInt(c[6],10),l.queue.gosub=_.isEmpty(c[7])?c[7]:isNaN(c[7])?c[7]:parseInt(c[7],10),l.queue.rule=_.isEmpty(c[8])?c[8]:isNaN(c[8])?c[8]:parseInt(c[8],10),l.queue.position=_.isEmpty(c[9])?c[9]:isNaN(c[9])?c[9]:parseInt(c[9],10)}function m(e){t.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.saveInternalRouteApp=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)",""));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.options,e[2]=l.queue.URL,e[3]=l.queue.sound,e[4]=l.queue.timeout,e[5]=l.queue.agi,e[6]=l.queue.macro,e[7]=l.queue.gosub,e[8]=l.queue.rule,e[9]=l.queue.position,l.queue.appdata=e.join(",")}m(l.queue)},l.closeDialog=m,o.hasRole("admin")?s.sound.get({fields:"id,name,save_name",sort:"name"}).$promise.then(function(e){l.sounds=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SOUNDS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.sound.get({fields:"id,name,save_name",sort:"name"}).$promise.then(function(e){l.sounds=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1007}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.sounds,{id:e.resourceId})}),n=null;if(l.queue&&(n=_.find(l.sounds,{save_name:l.queue.sound})),n&&!_.some(t,["id",n.id])){var a=_.find(l.sounds,{id:n.id});a.canSelect=!1,t.push(a)}l.sounds=t})}else{var n=[],a=null;l.queue&&(a=_.find(l.sounds,{save_name:l.queue.sound}));for(var i=0;i<l.sounds.length;i++)a&&l.sounds[i].id===a.id&&(l.sounds[i].canSelect=!1,n.push(l.sounds[i]));l.sounds=n}}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsounds",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.hasRole("admin")?s.voiceQueue.get({type:"inbound",fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.voiceQueue.get({type:"inbound",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:401}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),n=null;if(l.queue&&(n=_.find(l.queues,{name:l.queue.queue})),n&&!_.some(t,["id",n.id])){var a=_.find(l.queues,{id:n.id});a.canSelect=!1,t.push(a)}l.queues=t})}else{var n=[],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,n.push(l.queues[i]));l.queues=n}}).catch(function(e){n.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","internalrouteApp","internalroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInternalAppqueueDialogController",e)}(),function(){"use strict";function e(t,o,n,e,a,r,i,s){var l=this;if(l.currentUser=i.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(e.appType||e.app).toUpperCase(),l.ringgroup=angular.copy(e),l.crudPermissions=s,l.hasModulePermissions={},l.ringgroup.appdata)switch(l.ringgroup.appType?l.ringgroup.appType.toLowerCase():l.ringgroup.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.ringgroup.appdata.split(",");l.ringgroup.key=d[0],l.ringgroup.language=d[1],l.ringgroup.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.ringgroup.appdata.split(",");l.ringgroup.accesskeyid=d[0],l.ringgroup.secretaccesskey=d[1],l.ringgroup.lexregion=d[2],l.ringgroup.botname=d[3],l.ringgroup.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.ringgroup.appdata.split(",");l.ringgroup.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.ringgroup.text=d.slice(1,d.length).join(",");break;case"message":l.ringgroup.text=l.ringgroup.appdata;break;case"set":l.ringgroup.name=l.ringgroup.appdata.split("=")[0],l.ringgroup.value=l.ringgroup.appdata.split("=")[1];break;case"agi":l.ringgroup.project=l.ringgroup.appdata;break;default:var c=l.ringgroup.appdata.split(",");l.ringgroup.multipleUsers=c[0].split("&"),l.ringgroup.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.ringgroup.options=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.ringgroup.url=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10)}l.ringgroup.type&&"outbound"===l.ringgroup.type.toLowerCase()&&"outbounddial"===l.ringgroup.appType.toLowerCase()&&(l.ringgroup.prefix=l.ringgroup.phone?l.ringgroup.phone.split("$")[0]:void 0,l.ringgroup.callerId=l.ringgroup.callerID?"CALLERID(all)="+l.ringgroup.callerID:void 0),l.saveInternalRouteApp=function(){l.errors=[];var e=[];l.ringgroup.type&&"outbound"===l.ringgroup.type.toLowerCase()&&"outboundDial"===l.ringgroup.appType&&(l.ringgroup.phone=a.cutdigits?(l.ringgroup.prefix||"")+"${EXTEN:"+a.cutdigits+"}":(l.ringgroup.prefix||"")+"${EXTEN}","none"!==a.recordingFormat?l.ringgroup.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.ringgroup.options+="U(xcally-mixmonitor-context)"):l.ringgroup.options=l.ringgroup.options.replace("U(xcally-mixmonitor-context)",""));if(l.ringgroup.appType&&"custom"===l.ringgroup.appType);else switch((l.ringgroup.app||l.ringgroup.appType).toLowerCase()){case"set":l.ringgroup.appdata=l.ringgroup.name+"="+l.ringgroup.value;break;case"custom":break;default:e[0]=l.ringgroup.multipleUsers.join("&"),e[1]=l.ringgroup.timeout,e[2]=l.ringgroup.options,e[3]=l.ringgroup.url,l.ringgroup.appdata=e.join(",")}p(l.ringgroup)},l.closeDialog=p;var m=[{id:202,role:"agent"},{id:203,role:"telephone"}],u=null;function p(e){t.hide(e)}i.hasRole("admin")?r.user.get({fields:"id,name,role",sort:"name"}).$promise.then(function(e){l.users=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.user.get({fields:"id,name,role",sort:"name"}).$promise.then(function(e){u=e.rows||[]}).then(function(){for(var e=[],t=0;t<m.length;t++)e.push(r.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:m[t].id}).$promise);return o.all(e)}).then(function(e){for(var t=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),n=[],a=0;a<m.length;a++){var i=_.find(t,["sectionId",m[a].id]);if(i)if(i.autoAssociation){var s=[];u.forEach(function(e){e.role===m[a].role&&s.push(e)}),n.push({rows:s,count:s.length})}else n.push(r.userProfileResource.get({sectionId:i.id}).$promise)}return o.all(n)}).then(function(e){var t=[],n=null;l.ringgroup&&(n=_.find(u,{name:l.ringgroup.multipleUsers}));for(var a=0;a<e.length;a++){(e[a].rows||[]).forEach(function(e){t.push(e)})}n&&!_.some(t,["resourceId",n.id])&&u.forEach(function(e){e.id===n.id&&(e.canSelect=!1,t.push(e))}),l.users=t}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETusers",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","internalrouteApp","internalroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInternalAppringgroupDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.set=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.set.appdata)switch(l.set.appType?l.set.appType.toLowerCase():l.set.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.set.appdata.split(",");l.set.key=d[0],l.set.language=d[1],l.set.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.set.appdata.split(",");l.set.accesskeyid=d[0],l.set.secretaccesskey=d[1],l.set.lexregion=d[2],l.set.botname=d[3],l.set.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.set.appdata.split(",");l.set.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.set.text=d.slice(1,d.length).join(",");break;case"message":l.set.text=l.set.appdata;break;case"set":l.set.name=l.set.appdata.split("=")[0],l.set.value=l.set.appdata.split("=")[1];break;case"agi":l.set.project=l.set.appdata;break;default:var c=l.set.appdata.split("=");l.set.name=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.set.value=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}function m(e){t.hide(e)}l.set.type&&"outbound"===l.set.type.toLowerCase()&&"outbounddial"===l.set.appType.toLowerCase()&&(l.set.prefix=l.set.phone?l.set.phone.split("$")[0]:void 0,l.set.callerId=l.set.callerID?"CALLERID(all)="+l.set.callerID:void 0),l.saveInternalRouteApp=function(){l.errors=[];var e=[];l.set.type&&"outbound"===l.set.type.toLowerCase()&&"outboundDial"===l.set.appType&&(l.set.phone=i.cutdigits?(l.set.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.set.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.set.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.set.options+="U(xcally-mixmonitor-context)"):l.set.options=l.set.options.replace("U(xcally-mixmonitor-context)",""));if(l.set.appType&&"custom"===l.set.appType);else switch((l.set.app||l.set.appType).toLowerCase()){case"set":l.set.appdata=l.set.name+"="+l.set.value;break;case"custom":break;default:e[0]=l.set.name,e[1]=l.set.value,l.set.appdata=e.join("=")}m(l.set)},l.closeDialog=m,o.hasRole("admin")?s.variable.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.variables=e.rows||[]}).catch(function(e){n.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"}).$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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),n=null;if(l.set&&(n=_.find(l.variables,{name:l.set.name})),n&&!_.some(t,["id",n.id])){var a=_.find(l.variables,{id:n.id});a.canSelect=!1,t.push(a)}l.variables=t})}else{var n=[],a=null;l.set&&(a=_.find(l.variables,{name:l.set.name}));for(var i=0;i<l.variables.length;i++)a&&l.variables[i].id===a.id&&(l.variables[i].canSelect=!1,n.push(l.variables[i]));l.variables=n}}).catch(function(e){n.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","internalrouteApp","internalroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInternalAppsetDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.voicemail=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.voicemail.appdata)switch(l.voicemail.appType?l.voicemail.appType.toLowerCase():l.voicemail.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.voicemail.appdata.split(",");l.voicemail.key=d[0],l.voicemail.language=d[1],l.voicemail.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.voicemail.appdata.split(",");l.voicemail.accesskeyid=d[0],l.voicemail.secretaccesskey=d[1],l.voicemail.lexregion=d[2],l.voicemail.botname=d[3],l.voicemail.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.voicemail.appdata.split(",");l.voicemail.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.voicemail.text=d.slice(1,d.length).join(",");break;case"message":l.voicemail.text=l.voicemail.appdata;break;case"set":l.voicemail.name=l.voicemail.appdata.split("=")[0],l.voicemail.value=l.voicemail.appdata.split("=")[1];break;case"agi":l.voicemail.project=l.voicemail.appdata;break;default:var c=l.voicemail.appdata.split(",");l.voicemail.voiceMail=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.voicemail.options=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}function m(e){t.hide(e)}l.voicemail.type&&"outbound"===l.voicemail.type.toLowerCase()&&"outbounddial"===l.voicemail.appType.toLowerCase()&&(l.voicemail.prefix=l.voicemail.phone?l.voicemail.phone.split("$")[0]:void 0,l.voicemail.callerId=l.voicemail.callerID?"CALLERID(all)="+l.voicemail.callerID:void 0),l.saveInternalRouteApp=function(){l.errors=[];var e=[];l.voicemail.type&&"outbound"===l.voicemail.type.toLowerCase()&&"outboundDial"===l.voicemail.appType&&(l.voicemail.phone=i.cutdigits?(l.voicemail.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.voicemail.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.voicemail.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.voicemail.options+="U(xcally-mixmonitor-context)"):l.voicemail.options=l.voicemail.options.replace("U(xcally-mixmonitor-context)",""));if(l.voicemail.appType&&"custom"===l.voicemail.appType);else switch((l.voicemail.app||l.voicemail.appType).toLowerCase()){case"set":l.voicemail.appdata=l.voicemail.name+"="+l.voicemail.value;break;case"custom":break;default:e[0]=l.voicemail.voiceMail,e[1]=l.voicemail.options,l.voicemail.appdata=e.join(",")}m(l.voicemail)},l.closeDialog=m,o.hasRole("admin")?s.voiceMail.get({fields:"id,mailbox",sort:"mailbox"}).$promise.then(function(e){l.voiceMails=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VOICEMAILS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.voiceMail.get({fields:"id,mailbox",sort:"mailbox"}).$promise.then(function(e){l.voiceMails=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:406}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.voiceMails,{id:e.resourceId})}),n=null;if(l.voicemail&&(n=_.find(l.voiceMails,{mailbox:l.voicemail.voiceMail})),n&&!_.some(t,["id",n.id])){var a=_.find(l.voiceMails,{id:n.id});a.canSelect=!1,t.push(a)}l.voiceMails=t})}else{var n=[],a=null;l.voicemail&&(a=_.find(l.voiceMails,{mailbox:l.voicemail.voiceMail}));for(var i=0;i<l.voiceMails.length;i++)a&&l.voiceMails[i].id===a.id&&(l.voiceMails[i].canSelect=!1,n.push(l.voiceMails[i]));l.voiceMails=n}}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMails",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","internalrouteApp","internalroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInternalAppvoicemailDialogController",e)}(),function(){"use strict";function e(e,t,n,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=t.protocol()+"://"+t.host(),u.internalroute=c||e.params.internalroute||{},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.gotoInternalRoutes=function(){e.go("app.voice.internalroutes")},u.saveInternalRoute=function(){r.voiceExtension.update({id:u.internalroute.id},u.internalroute).$promise.then(function(){l.success({title:"InternalRoute updated!",msg:u.internalroute.name?u.internalroute.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceExtension",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 t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.contexts,{id:e.resourceId})}),n=null;if(u.internalroute&&(n=_.find(u.contexts,{name:u.internalroute.context})),n&&!_.some(t,["id",n.id])){var a=_.find(u.contexts,{id:n.id});a.canSelect=!1,t.push(a)}u.contexts=t}):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","internalroute","userProfileSection"],angular.module("app.voice").controller("InternalRouteController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.internalroutes=l||{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="internalroutes",b.listOrder="",b.listOrderAsc=null,b.selectedInternalRoutes=[],b.query={fields:"createdAt,updatedAt,id,appdata,type,exten,context,description",type:"internal",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,page:1},b.editstate=function(e,t){n.go("app.voice.internalroutes.edit",{id:e.id,internalroute:e,crudPermissions:b.crudPermissions})},b.deleteconfirm=function(e,t){var n=i.confirm().title("Are you sure want to delete the "+_.startCase("internalroute")+"?").htmlContent("<b>"+(e.name||"internalroute")+"</b> will be deleted.").ariaLabel("delete internalroute").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getInternalRoutes=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.voiceExtension.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="InternalRoutes",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditInternalRoute=function(e,t){i.show({controller:"CreateOrEditInternalRouteDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/internalroutes/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{internalroute:t,internalroutes:b.internalroutes.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteInternalRoute=S,b.exportSelectedInternalRoutes=function(){var e=angular.copy(b.selectedInternalRoutes);return b.selectedInternalRoutes=[],e},b.deleteSelectedInternalRoutes=function(e){var t=i.confirm().title("Are you sure want to delete the selected internalroutes?").htmlContent("<b>"+b.selectedInternalRoutes.length+" selected</b> will be deleted.").ariaLabel("delete InternalRoutes").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedInternalRoutes.forEach(function(e){S(e)}),b.selectedInternalRoutes=[]})},b.deselectInternalRoutes=function(){b.selectedInternalRoutes=[]},b.selectAllInternalRoutes=function(){b.selectedInternalRoutes=b.internalroutes.rows},g.hasRole("admin")?m.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){b.contexts=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){b.contexts=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(b.contexts,{id:e.resourceId})}),n=null;if(b.internalroute&&(n=_.find(b.contexts,{name:b.internalroute.context})),n&&!_.some(t,["id",n.id])){var a=_.find(b.contexts,{id:n.id});a.canSelect=!1,t.push(a)}b.contexts=t}):m.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){b.contexts=e.rows||[]})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})});var E=!0,A=1;function y(e){b.internalroutes=e||{count:0,rows:[]}}function S(e){m.voiceExtension.delete({id:e.id}).$promise.then(function(){_.remove(b.internalroutes.rows,{id:e.id}),b.internalroutes.count-=1,b.internalroutes.rows.length||b.getInternalRoutes(),p.success({title:_.startCase("InternalRoute")+" 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:DELETEvoiceExtension"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceExtension",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getInternalRoutes())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","internalroutes","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.voice").controller("InternalRoutesController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.musiconholds,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The musiconhold will be deleted.").ariaLabel("Delete MusicOnHold").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.musiconhold={},c.musiconholdMohSounds={count:0,rows:[]},c.selectedMusicOnHoldMohSounds=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,save_name,converted_format,audio",limit:10,page:1},c.init=function(e,t){c.musiconhold=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.musiconhold.id,c.query.VoiceMusicOnHoldId=c.musiconhold.id,c.getMusicOnHoldMohSounds()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the mohSound?").htmlContent("<b>"+(e.name||"mohSound")+"</b> will be deleted.").ariaLabel("delete mohSound").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.voiceMusicOnHoldDownload=function(s,e,t){return l.sound.download({id:s.id,exists:!0,attachments:t}).$promise.then(function(e){var t=[e.buffer],n="mohSound"+s.id,a=new Blob(t,{type:e.type});n=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",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMusicOnHold.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.success=p,c.getMusicOnHoldMohSounds=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.voiceMusicOnHold.getSounds(c.query,p).$promise},c.createOrEditMusicOnHoldMohSound=function(e,t){s.show({controller:"CreateOrEditMohSoundDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/musiconholds/edit/mohSounds/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{musiconhold:c.musiconhold,mohSound:t,mohSounds:c.musiconholdMohSounds.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedMusicOnHoldMohSounds=function(){var e=angular.copy(c.selectedMusicOnHoldMohSounds);return c.selectedMusicOnHoldMohSounds=[],e},c.deleteMusicOnHoldMohSound=g,c.deleteSelectedMusicOnHoldMohSounds=function(e){var t=s.confirm().title("Are you sure want to delete the selected mohSounds?").htmlContent("<b>"+c.selectedMusicOnHoldMohSounds.length+" selected</b> will be deleted.").ariaLabel("delete mohSounds").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedMusicOnHoldMohSounds.forEach(function(e){g(e)}),c.selectedMusicOnHoldMohSounds=[]})},d.hasRole("admin")?l.sound.get({fields:"id,name",sort:"name"}).$promise.then(function(e){c.sounds=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SOUNDS",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.sound.get({fields:"id,name",sort:"name"}).$promise.then(function(e){c.sounds=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1007}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(c.sounds,{id:e.resourceId})}),n=null;if(c.musiconhold&&(n=_.find(c.sounds,{id:Number(c.musiconhold.id)})),n&&!_.some(t,["id",n.id])){var a=_.find(c.sounds,{id:n.id});a.canSelect=!1,t.push(a)}c.sounds=t})}else{var n=[],a=null;c.musiconhold&&(a=_.find(c.sounds,{id:Number(c.musiconhold.id)}));for(var i=0;i<c.sounds.length;i++)a&&c.sounds[i].id===a.id&&(c.sounds[i].canSelect=!1,n.push(c.sounds[i]));c.sounds=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsounds",msg:e.data?JSON.stringify(e.data):e.toString()})});var m=!0,u=1;function p(e){c.musiconholdMohSounds=e||{count:0,rows:[]}}function g(e){l.voiceMusicOnHold.removeSound({id:n.params.id,id2:e.id}).$promise.then(function(){_.remove(c.musiconholdMohSounds.rows,{id:e.id}),c.musiconholdMohSounds.count-=1,c.musiconholdMohSounds.rows.length||c.getMusicOnHoldMohSounds(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceMusicOnHold"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMusicOnHold",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getMusicOnHoldMohSounds())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.voice").controller("MusicOnHoldMohSoundsController",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(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),t.params.id&&(g.mohSound.VoiceMusicOnHoldId=t.params.id),g.addNewMohSound=function(){g.errors=[],d.voiceMusicOnHold.addSound({id:t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.mohSounds,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The mohSound will be deleted.").ariaLabel("Delete MohSound").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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"}).$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"}).$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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.sounds,{id:e.resourceId})}),n=null;if(g.mohSound&&(n=_.find(g.sounds,{id:Number(g.mohSound.id)})),n&&!_.some(t,["id",n.id])){var a=_.find(g.sounds,{id:n.id});a.canSelect=!1,t.push(a)}g.sounds=t})}else{var n=[],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,n.push(g.sounds[i]));g.sounds=n}}).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,t,n,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=t.protocol()+"://"+t.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")},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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.musiconholds=l||{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="musiconholds",b.listOrder="",b.listOrderAsc=null,b.selectedMusicOnHolds=[],b.query={fields:"createdAt,updatedAt,id,name,mode,directory,application,format,sort",defaultEntry:"false",limit:10,page:1},b.arraymode=_.keyBy([{option:"Files",value:"'files'"},{option:"Custom",value:"'custom'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arraysort=_.keyBy([{option:"Random",value:"'random'"},{option:"Alphabetical",value:"'alpha'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.voice.musiconholds.edit",{id:e.id,musiconhold:e,crudPermissions:b.crudPermissions})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getMusicOnHolds=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.voiceMusicOnHold.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="MusicOnHolds",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditMusicOnHold=function(e,t){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:t,musiconholds:b.musiconholds.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteMusicOnHold=S,b.exportSelectedMusicOnHolds=function(){var e=angular.copy(b.selectedMusicOnHolds);return b.selectedMusicOnHolds=[],e},b.deleteSelectedMusicOnHolds=function(e){var t=i.confirm().title("Are you sure want to delete the selected musiconholds?").htmlContent("<b>"+b.selectedMusicOnHolds.length+" selected</b> will be deleted.").ariaLabel("delete MusicOnHolds").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedMusicOnHolds.forEach(function(e){S(e)}),b.selectedMusicOnHolds=[]})},b.deselectMusicOnHolds=function(){b.selectedMusicOnHolds=[]},b.selectAllMusicOnHolds=function(){b.selectedMusicOnHolds=b.musiconholds.rows};var E=!0,A=1;function y(e){b.musiconholds=e||{count:0,rows:[]}}function S(e){m.voiceMusicOnHold.delete({id:e.id}).$promise.then(function(){_.remove(b.musiconholds.rows,{id:e.id}),b.musiconholds.count-=1,b.musiconholds.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceMusicOnHold"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getMusicOnHolds())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","musiconholds","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.voice").controller("MusicOnHoldsController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,h,d,c,m,u){var f=this;function p(){var e=2,t=[];t.push({type:"outbound",app:"Set",appdata:"CDR(type)=outbound",context:f.outboundroute.context,exten:f.outboundroute.exten,priority:e++,VoiceExtensionId:f.outboundroute.id}),t.push({type:"outbound",app:"Set",appdata:"CDR(destination)="+(f.outboundroute.cutdigits?"${EXTEN:"+f.outboundroute.cutdigits+"}":"${EXTEN}"),context:f.outboundroute.context,exten:f.outboundroute.exten,priority:e++,VoiceExtensionId:f.outboundroute.id}),t.push({type:"outbound",app:"Set",appdata:"XCALLY-MOTION-ANSWER=0",context:f.outboundroute.context,exten:f.outboundroute.exten,priority:e++,VoiceExtensionId:f.outboundroute.id}),t.push({type:"outbound",app:"Set",appdata:"XCALLY-MOTION-PROGRESS=0",context:f.outboundroute.context,exten:f.outboundroute.exten,priority:e++,VoiceExtensionId:f.outboundroute.id}),t.push({type:"outbound",app:"Set",appdata:"MONITOR_OPTIONS=ab",context:f.outboundroute.context,exten:f.outboundroute.exten,priority:e++,VoiceExtensionId:f.outboundroute.id}),t.push({type:"outbound",app:"Set",appdata:"outboundrouteid="+f.outboundroute.id,context:f.outboundroute.context,exten:f.outboundroute.exten,priority:e++,VoiceExtensionId:f.outboundroute.id}),f.outboundroute.hasOwnProperty("recordingFormat")&&"none"!==f.outboundroute.recordingFormat&&(t.push({type:"outbound",app:"Set",appdata:"_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}",context:f.outboundroute.context,exten:f.outboundroute.exten,priority:e++,VoiceExtensionId:f.outboundroute.id}),t.push({type:"outbound",app:"Set",appdata:"_XCALLY_MIXMONITOR_FORMAT="+f.outboundroute.recordingFormat||"wav",context:f.outboundroute.context,exten:f.outboundroute.exten,priority:e++,VoiceExtensionId:f.outboundroute.id}));for(var n=0,a=0;n<f.outboundrouteApps.rows.length;n++,a=0){var i=f.outboundrouteApps.rows[n],s=[],o=[];i.intervals="*,*,*,*"!==i.interval?[i.interval]:i.IntervalId?_.map(_.filter(f.intervals.rows,{IntervalId:i.IntervalId}),"interval"):[],i.context=f.outboundroute.context,i.exten=f.outboundroute.exten,i.type&&(i.type=i.type.toLowerCase()),i.hasOwnProperty("tag")&&i.tag&&"--"!==i.tag&&s.push({type:i.type.toLowerCase(),app:"Set",appdata:"CDR(tag)="+i.tag,context:f.outboundroute.context,exten:f.outboundroute.exten,priority:i.intervals.length+e+a++,VoiceExtensionId:f.outboundroute.id}),i.callerID?s.push({type:i.type.toLowerCase(),app:"ExecIf",appdata:"$[${LEN(${PREFIX-CALLERIDALL})} > 0]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)="+i.callerID+")",context:f.outboundroute.context,exten:f.outboundroute.exten,priority:i.intervals.length+e+a++,VoiceExtensionId:f.outboundroute.id}):s.push({type:i.type.toLowerCase(),app:"ExecIf",appdata:"$[${LEN(${PREFIX-CALLERIDALL})} > 0]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No number available)",context:f.outboundroute.context,exten:f.outboundroute.exten,priority:i.intervals.length+e+a++,VoiceExtensionId:f.outboundroute.id});for(var r=0;r<i.intervals.length;r++){var l=e+i.intervals.length,d=r===i.intervals.length-1?e+s.length+o.length+2:e+r+1;s.splice(r,0,{type:"outbound",app:"GotoIfTime",appdata:i.intervals[r]+"?"+f.outboundroute.context+",${EXTEN},"+l+":"+f.outboundroute.context+",${EXTEN},"+d,exten:f.outboundroute.exten,context:f.outboundroute.context,priority:e+r,VoiceExtensionId:f.outboundroute.id})}if("outboundDial"===i.appType){var c=_.find(f.apps,{appType:"outboundDial"});if(c&&c.fields){for(var m={},u=i.appdata.split(","),p=[],g=0,v=c.fields.length;g<v;g++)if(c.fields[g].hasOwnProperty("param"))switch(c.fields[g].name){case"trunk":m.trunk=u[c.fields[g].param].split("/")[1],m.phone=u[c.fields[g].param].split("/")[2],m.prefix=m.phone?m.phone.split("$")[0]:void 0,m.phone=f.outboundroute.cutdigits?(m.prefix||"")+"${EXTEN:"+f.outboundroute.cutdigits+"}":(m.prefix||"")+"${EXTEN}",p[c.fields[g].param]=["SIP",m.trunk,m.phone].join("/");break;case"options":m.options=u[c.fields[g].param],"none"!==f.outboundroute.recordingFormat?m.options.indexOf("U(xcally-mixmonitor-context)")<0&&(m.options+="U(xcally-mixmonitor-context)"):m.options=m.options.replace("U(xcally-mixmonitor-context)",""),p[c.fields[g].param]=m.options;break;default:p[c.fields[g].param]=u[c.fields[g].param]}i.appdata=p.join(",")}}i.priority=s.length?_.last(s).priority+1:e,e=(o.length?_.last(o).priority:i.priority)+1,t=_.concat(t,s,[i],o)}t.push({type:"outbound",app:"Hangup",exten:f.outboundroute.exten,context:f.outboundroute.context,priority:e,VoiceExtensionId:f.outboundroute.id}),h.voiceExtension.addApplications({id:f.outboundroute.id},_.sortBy(t,"priority")).$promise.then(function(e){f.outboundrouteApps.rows=e.rows}).catch(function(e){console.error(e)})}function g(e){a.hide(e)}f.currentUser=d.getCurrentUser(),f.errors=[],f.setting=m,f.license=c,f.crudPermissions=u,f.hasModulePermissions={},f.passwordPattern=f.setting&&f.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",f.title="VOICE.EDIT_OUTBOUNDROUTE",f.outboundroute=angular.copy(l),f.outboundroutes=r,f.newOutboundRoute=!1,f.outboundrouteApps={count:0,rows:[]},f.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",type:"Outbound",types:["always","custom","list"],fields:[],isApp:!1},{app:"Dial",appType:"outboundDial",context:"from-sip",type:"Outbound",icon:"icon-apps",interval:"*,*,*,*",options:"xX",isApp:!0,extraApi:[{name:"trunks",route:"trunk",filters:{fields:"name",sort:"name"}},{name:"tags",route:"tag",filters:{fields:"name",sort:"name",nolimit:!0}}],fields:[{title:"Trunk",name:"trunk",type:"apiselect",values:"trunks",value:"trunk.name",option:"trunk.name",required:!0,param:0},{title:"Caller_ID",name:"callerID",type:"text",ngPattern:"/&quot;(.*)&quot;\\s&lt;(.*?)&gt;$/",help:!0},{title:"Prefix",name:"prefix",type:"text"},{title:"Tags",name:"tag",type:"apiselect",values:"tags",value:"tag.name",option:"tag.name",defaultValues:[{value:"'--'",option:"None"}]},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:null,type:"Outbound",appType:"custom",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Application_Name",name:"app",type:"text",required:!0,param:0},{title:"Arguments",name:"appdata",type:"text",param:1}]}],["app"]),{isApp:!1}),f.outboundroute||(f.outboundroute={appdata:"Outbound Call",type:"outbound",context:"from-sip",recordingFormat:"none"},f.title="VOICE.NEW_OUTBOUNDROUTE",f.newOutboundRoute=!0),f.addNewOutboundRoute=function(){f.errors=[],h.voiceExtension.save(f.outboundroute).$promise.then(function(e){f.outboundroutes.unshift(e.toJSON()),o.success({title:"OutboundRoute properly created",msg:f.outboundroute.name?f.outboundroute.name+" has been created!":""}),g(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},f.saveOutboundRoute=function(){f.errors=[],h.voiceExtension.update({id:f.outboundroute.id},f.outboundroute).$promise.then(function(e){var t=_.find(f.outboundroutes,{id:e.id});t&&(_.merge(t,_.pick(e.toJSON(),_.keys(t))),h.voiceExtension.get({sort:"priority",VoiceExtensionId:t.id,isApp:!0,nolimit:!0}).$promise.then(function(e){f.outboundrouteApps=e,p()})),o.success({title:"OutboundRoute properly saved!",msg:f.outboundroute.name?f.outboundroute.name+" has been saved!":""}),g(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},f.deleteOutboundRoute=function(n){h.voicePrefix.get({VoiceExtensionId:l.id}).$promise.then(function(e){if(e&&e.rows&&0<e.rows.length)return o.error({title:"Outbound route not deleted!",msg:"You can't remove an outbound route associated to an out prefix"});f.errors=[];var t=a.confirm().title("Are you sure?").content("The outboundroute will be deleted.").ariaLabel("Delete OutboundRoute").ok("Delete").cancel("Cancel").targetEvent(n);a.show(t).then(function(){h.voiceExtension.delete({id:f.outboundroute.id}).$promise.then(function(){_.remove(f.outboundroutes,{id:f.outboundroute.id}),o.success({title:"OutboundRoute properly deleted!",msg:(f.outboundroute.name||"outboundroute")+" has been deleted!"}),g(f.outboundroute)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})})},f.getDateFromString=function(e){return null===e?void 0:new Date(e)},f.rewriteRouting=p,f.closeDialog=g,d.hasRole("admin")?h.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.contexts=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):h.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.contexts=e.rows||[]}).then(function(){return h.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:h.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(f.contexts,{id:e.resourceId})}),n=null;if(f.outboundroute&&(n=_.find(f.contexts,{name:f.outboundroute.context})),n&&!_.some(t,["id",n.id])){var a=_.find(f.contexts,{id:n.id});a.canSelect=!1,t.push(a)}f.contexts=t}):h.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){f.contexts=e.rows||[]})}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","outboundroutes","outboundroute","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditOutboundRouteDialogController",e)}(),function(){"use strict";function e(b,i,a,s,n,e,t){var E=this;function o(e,t){if(E.outboundrouteApps.rows.length){var n=E.outboundrouteApps.rows[t]?E.outboundrouteApps.rows[t]:E.outboundrouteApps.rows[0];i.show({controller:"EditoutboundApp"+(n.appType||n.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/outboundroutes/edit/apps/"+(n.appType||n.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{outboundrouteApp:n,outboundroute:E.outboundroute,crudPermissions:E.crudPermissions}}).then(function(e){e&&(e.id?E.outboundrouteApps.rows[t]=e:E.outboundrouteApps.rows.splice(t,0,e),r())}).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 r(e){var t=2,n=[];n.push({type:"outbound",app:"Set",appdata:"CDR(type)=outbound",context:E.outboundroute.context,exten:E.outboundroute.exten,priority:t++,VoiceExtensionId:E.outboundroute.id}),n.push({type:"outbound",app:"Set",appdata:"CDR(destination)="+(E.outboundroute.cutdigits?"${EXTEN:"+E.outboundroute.cutdigits+"}":"${EXTEN}"),context:E.outboundroute.context,exten:E.outboundroute.exten,priority:t++,VoiceExtensionId:E.outboundroute.id}),n.push({type:"outbound",app:"Set",appdata:"CDR(routeid)="+E.outboundroute.id,context:E.outboundroute.context,exten:E.outboundroute.exten,priority:t++,VoiceExtensionId:E.outboundroute.id});var a=t++;n.push({type:"outbound",app:"ExecIf",appdata:"$[${LEN(${CDR(prefix)})} > 0]?Goto("+(a+2)+"):Goto("+(a+1)+")",context:E.outboundroute.context,exten:E.outboundroute.exten,priority:a,VoiceExtensionId:E.outboundroute.id}),n.push({type:"outbound",app:"Set",appdata:E.outboundroute.cutdigits?"CDR(prefix)=${EXTEN:0:"+E.outboundroute.cutdigits+"}":"CDR(prefix)=noprefix",context:E.outboundroute.context,exten:E.outboundroute.exten,priority:t++,VoiceExtensionId:E.outboundroute.id}),n.push({type:"outbound",app:"Set",appdata:"XCALLY-MOTION-ANSWER=0",context:E.outboundroute.context,exten:E.outboundroute.exten,priority:t++,VoiceExtensionId:E.outboundroute.id}),n.push({type:"outbound",app:"Set",appdata:"XCALLY-MOTION-PROGRESS=0",context:E.outboundroute.context,exten:E.outboundroute.exten,priority:t++,VoiceExtensionId:E.outboundroute.id}),n.push({type:"outbound",app:"Set",appdata:"MONITOR_OPTIONS=ab",context:E.outboundroute.context,exten:E.outboundroute.exten,priority:t++,VoiceExtensionId:E.outboundroute.id}),n.push({type:"outbound",app:"Set",appdata:"outboundrouteid="+E.outboundroute.id,context:E.outboundroute.context,exten:E.outboundroute.exten,priority:t++,VoiceExtensionId:E.outboundroute.id}),E.outboundroute.hasOwnProperty("recordingFormat")&&"none"!==E.outboundroute.recordingFormat&&(n.push({type:"outbound",app:"Set",appdata:"_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}",context:E.outboundroute.context,exten:E.outboundroute.exten,priority:t++,VoiceExtensionId:E.outboundroute.id}),n.push({type:"outbound",app:"Set",appdata:"_XCALLY_MIXMONITOR_FORMAT="+E.outboundroute.recordingFormat||"wav",context:E.outboundroute.context,exten:E.outboundroute.exten,priority:t++,VoiceExtensionId:E.outboundroute.id}));for(var i=0,s=0;i<E.outboundrouteApps.rows.length;i++,s=0){var o=E.outboundrouteApps.rows[i],r=[],l=[];o.intervals="*,*,*,*"!==o.interval?[o.interval]:o.IntervalId?_.map(_.filter(E.intervals.rows,{IntervalId:o.IntervalId}),"interval"):[],o.context=E.outboundroute.context,o.exten=E.outboundroute.exten,o.type&&(o.type=o.type.toLowerCase()),o.hasOwnProperty("tag")&&o.tag&&"--"!==o.tag&&r.push({type:o.type.toLowerCase(),app:"Set",appdata:"CDR(tag)="+o.tag,context:E.outboundroute.context,exten:E.outboundroute.exten,priority:o.intervals.length+t+s++,VoiceExtensionId:E.outboundroute.id}),o.callerID?r.push({type:o.type.toLowerCase(),app:"ExecIf",appdata:"$[${LEN(${PREFIX-CALLERIDALL})} > 0]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)="+o.callerID+")",context:E.outboundroute.context,exten:E.outboundroute.exten,priority:o.intervals.length+t+s++,VoiceExtensionId:E.outboundroute.id}):r.push({type:o.type.toLowerCase(),app:"ExecIf",appdata:"$[${LEN(${PREFIX-CALLERIDALL})} > 0]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No number available)",context:E.outboundroute.context,exten:E.outboundroute.exten,priority:o.intervals.length+t+s++,VoiceExtensionId:E.outboundroute.id});for(var d=0;d<o.intervals.length;d++){var c=t+o.intervals.length,m=d===o.intervals.length-1?t+r.length+l.length+2:t+d+1;r.splice(d,0,{type:"outbound",app:"GotoIfTime",appdata:o.intervals[d]+"?"+E.outboundroute.context+",${EXTEN},"+c+":"+E.outboundroute.context+",${EXTEN},"+m,exten:E.outboundroute.exten,context:E.outboundroute.context,priority:t+d,VoiceExtensionId:E.outboundroute.id})}if(e&&"outboundDial"===o.appType){var u=_.find(E.apps,{appType:"outboundDial"});if(u&&u.fields){for(var p={},g=o.appdata.split(","),v=[],h=0,f=u.fields.length;h<f;h++)if(u.fields[h].hasOwnProperty("param"))switch(u.fields[h].name){case"trunk":p.trunk=g[u.fields[h].param].split("/")[1],p.phone=g[u.fields[h].param].split("/")[2],p.prefix=p.phone?p.phone.split("$")[0]:void 0,p.phone=E.outboundroute.cutdigits?(p.prefix||"")+"${EXTEN:"+E.outboundroute.cutdigits+"}":(p.prefix||"")+"${EXTEN}",v[u.fields[h].param]=["SIP",p.trunk,p.phone].join("/");break;case"options":p.options=g[u.fields[h].param],"none"!==E.outboundroute.recordingFormat?p.options.indexOf("U(xcally-mixmonitor-context)")<0&&(p.options+="U(xcally-mixmonitor-context)"):p.options=p.options.replace("U(xcally-mixmonitor-context)",""),v[u.fields[h].param]=p.options;break;default:v[u.fields[h].param]=g[u.fields[h].param]}o.appdata=v.join(",")}}o.priority=r.length?_.last(r).priority+1:t,t=(l.length?_.last(l).priority:o.priority)+1,n=_.concat(n,r,[o],l)}n.push({type:"outbound",app:"Hangup",exten:E.outboundroute.exten,context:E.outboundroute.context,priority:t,VoiceExtensionId:E.outboundroute.id}),b.voiceExtension.addApplications({id:E.outboundroute.id},_.sortBy(n,"priority")).$promise.then(function(e){E.outboundrouteApps.rows=e.rows}).catch(function(e){console.error(e)})}function l(e){E.outboundrouteApps=e||{count:0,rows:[]}}E.currentUser=t.getCurrentUser(),E.outboundroute={},E.outboundrouteApps={count:0,rows:[]},E.selectedOutboundRouteApps=[],E.crudPermissions,E.query={sort:"priority"},E.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",type:"Outbound",types:["always","custom","list"],fields:[],isApp:!1},{app:"Dial",appType:"outboundDial",context:"from-sip",type:"Outbound",icon:"icon-apps",interval:"*,*,*,*",options:"xX",isApp:!0,extraApi:[{name:"trunks",field:{name:"trunk",key:"name"},route:"trunk",filters:{fields:"id,name",sort:"name"},permissions:{section:1011}},{name:"tags",field:{name:"tag",key:"name"},route:"tag",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1008}}],fields:[{title:"Trunk",name:"trunk",type:"apiselect",values:"trunks",value:"trunk.name",option:"trunk.name",required:!0,param:0},{title:"Caller_ID",name:"callerID",type:"text",help:!0},{title:"Prefix",name:"prefix",type:"text"},{title:"Tags",name:"tag",type:"apiselect",values:"tags",value:"tag.name",option:"tag.name",defaultValues:[{value:"'--'",option:"None"}]},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:null,type:"Outbound",appType:"custom",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Application_Name",name:"app",type:"text",required:!0,param:0},{title:"Arguments",name:"appdata",type:"text",param:1}]}],["app"]),{isApp:!1}),E.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},E.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){o(e,e.newIndex)},onSort:function(e){r()}},E.init=function(e,t){E.outboundroute=e,E.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},E.applications.disabled=!E.crudPermissions.canEdit,n.on("voiceExtension:update",E.onVoiceExtensionUpdate),E.query.VoiceExtensionId=e.id,E.query.isApp=!0,E.query.nolimit=!0,E.getOutboundRouteApps(),E.getIntervals()},E.deleteConfirm=function(e,t,n){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(n).ok("OK").cancel("CANCEL");i.show(a).then(function(){E.outboundrouteApps.rows.splice(t,1),r()},function(){console.log("CANCEL")})},E.getOutboundRouteApps=function(){E.promise=b.voiceExtension.get(E.query,l).$promise},E.editOutboundRouteApp=o,E.editInterval=function(e,t){if(E.outboundrouteApps.rows.length){var n=E.outboundrouteApps.rows[t]?E.outboundrouteApps.rows[t]:E.outboundrouteApps.rows[0];i.show({controller:"EditoutboundAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/outboundroutes/edit/apps/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:n.interval,IntervalId:n.IntervalId,application:!0},intervals:[],crudPermissions:E.crudPermissions}}).then(function(e){e&&(n.interval=e.interval||"*,*,*,*",n.IntervalId=e.IntervalId||null,r())})}},E.deleteOutboundRouteApp=function(e){_.remove(E.outboundrouteApps.rows,{id:e.id}),r(),s.success({title:"App deleted!",msg:e.app?e.app+" has been deleted!":""})},E.deleteSelectedOutboundRouteApps=function(e){var t=i.confirm().title("Are you sure want to delete the selected applications?").htmlContent("<b>"+E.selectedOutboundRouteApps.length+" selected</b> will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){E.selectedOutboundRouteApps.forEach(function(e){_.remove(E.outboundrouteApps.rows,{id:e.id})}),E.selectedOutboundRouteApps=[],r()})},E.rewriteRouting=r,E.getIntervals=function(){return b.interval.get({fields:"id,interval,IntervalId"}).$promise.then(function(e){E.intervals=e}).catch(function(e){console.error(e)})},E.onVoiceExtensionUpdate=function(e){e.VoiceExtensionId===E.outboundroute.id&&r(!0)},e.$on("$destroy",function(){n.removeAllListeners("voiceExtension:update")})}e.$inject=["api","$mdDialog","$document","toasty","socket","$scope","Auth"],angular.module("app.voice").controller("OutboundRouteActionsController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.custom=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.custom.appdata)switch(l.custom.appType?l.custom.appType.toLowerCase():l.custom.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.custom.appdata.split(",");l.custom.key=d[0],l.custom.language=d[1],l.custom.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.custom.appdata.split(",");l.custom.accesskeyid=d[0],l.custom.secretaccesskey=d[1],l.custom.lexregion=d[2],l.custom.botname=d[3],l.custom.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.custom.appdata.split(",");l.custom.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.custom.text=d.slice(1,d.length).join(",");break;case"message":l.custom.text=l.custom.appdata;break;case"set":l.custom.name=l.custom.appdata.split("=")[0],l.custom.value=l.custom.appdata.split("=")[1];break;case"agi":l.custom.project=l.custom.appdata;break;default:var c=l.custom.appdata.split(",");l.custom.app=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.custom.appdata=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}function m(e){t.hide(e)}l.custom.type&&"outbound"===l.custom.type.toLowerCase()&&"outbounddial"===l.custom.appType.toLowerCase()&&(l.custom.prefix=l.custom.phone?l.custom.phone.split("$")[0]:void 0,l.custom.callerId=l.custom.callerID?"CALLERID(all)="+l.custom.callerID:void 0),l.saveOutboundRouteApp=function(){l.errors=[];var e=[];l.custom.type&&"outbound"===l.custom.type.toLowerCase()&&"outboundDial"===l.custom.appType&&(l.custom.phone=i.cutdigits?(l.custom.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.custom.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.custom.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.custom.options+="U(xcally-mixmonitor-context)"):l.custom.options=l.custom.options.replace("U(xcally-mixmonitor-context)",""));if(l.custom.appType&&"custom"===l.custom.appType);else switch((l.custom.app||l.custom.appType).toLowerCase()){case"set":l.custom.appdata=l.custom.name+"="+l.custom.value;break;case"custom":break;default:e[0]=l.custom.app,e[1]=l.custom.appdata,l.custom.appdata=e.join(",")}m(l.custom)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","outboundrouteApp","outboundroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditoutboundAppcustomDialogController",e)}(),function(){"use strict";function e(e,t,n,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 E(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var t=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),n=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(t+"-"+n)}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 A(e){t.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=E(),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!":""}),A()}).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=E(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),A(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var t=_.find(c.intervals,{id:e.id});t&&_.merge(t,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),A()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=A,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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=e&&e.rows?e.rows:[],n=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(t,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,n.push(e))}),c.intervals=n})}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("EditoutboundAppintervalDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.outbounddial=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.outbounddial.appdata)switch(l.outbounddial.appType?l.outbounddial.appType.toLowerCase():l.outbounddial.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.outbounddial.appdata.split(",");l.outbounddial.key=d[0],l.outbounddial.language=d[1],l.outbounddial.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.outbounddial.appdata.split(",");l.outbounddial.accesskeyid=d[0],l.outbounddial.secretaccesskey=d[1],l.outbounddial.lexregion=d[2],l.outbounddial.botname=d[3],l.outbounddial.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.outbounddial.appdata.split(",");l.outbounddial.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.outbounddial.text=d.slice(1,d.length).join(",");break;case"message":l.outbounddial.text=l.outbounddial.appdata;break;case"set":l.outbounddial.name=l.outbounddial.appdata.split("=")[0],l.outbounddial.value=l.outbounddial.appdata.split("=")[1];break;case"agi":l.outbounddial.project=l.outbounddial.appdata;break;default:var c=l.outbounddial.appdata.split(",");l.outbounddial.trunk=c[0].split("/")[1],l.outbounddial.phone=c[0].split("/")[2],l.outbounddial.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.outbounddial.options=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.outbounddial.url=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10)}function m(e){t.hide(e)}l.outbounddial.type&&"outbound"===l.outbounddial.type.toLowerCase()&&"outbounddial"===l.outbounddial.appType.toLowerCase()&&(l.outbounddial.prefix=l.outbounddial.phone?l.outbounddial.phone.split("$")[0]:void 0,l.outbounddial.callerId=l.outbounddial.callerID?"CALLERID(all)="+l.outbounddial.callerID:void 0),l.saveOutboundRouteApp=function(){l.errors=[];var e=[];l.outbounddial.type&&"outbound"===l.outbounddial.type.toLowerCase()&&"outboundDial"===l.outbounddial.appType&&(l.outbounddial.phone=i.cutdigits?(l.outbounddial.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.outbounddial.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.outbounddial.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.outbounddial.options+="U(xcally-mixmonitor-context)"):l.outbounddial.options=l.outbounddial.options.replace("U(xcally-mixmonitor-context)",""));if(l.outbounddial.appType&&"custom"===l.outbounddial.appType);else switch((l.outbounddial.app||l.outbounddial.appType).toLowerCase()){case"set":l.outbounddial.appdata=l.outbounddial.name+"="+l.outbounddial.value;break;case"custom":break;default:e[0]=["SIP",l.outbounddial.trunk,l.outbounddial.phone].join("/"),e[1]=l.outbounddial.timeout,e[2]=l.outbounddial.options,e[3]=l.outbounddial.url,l.outbounddial.appdata=e.join(",")}m(l.outbounddial)},l.closeDialog=m,o.hasRole("admin")?s.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.trunks=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.trunks=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.trunks,{id:e.resourceId})}),n=null;if(l.outbounddial&&(n=_.find(l.trunks,{name:l.outbounddial.trunk})),n&&!_.some(t,["id",n.id])){var a=_.find(l.trunks,{id:n.id});a.canSelect=!1,t.push(a)}l.trunks=t})}else{var n=[],a=null;l.outbounddial&&(a=_.find(l.trunks,{name:l.outbounddial.trunk}));for(var i=0;i<l.trunks.length;i++)a&&l.trunks[i].id===a.id&&(l.trunks[i].canSelect=!1,n.push(l.trunks[i]));l.trunks=n}}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.hasRole("admin")?s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).catch(function(e){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),n=null;if(l.outbounddial&&(n=_.find(l.tags,{name:l.outbounddial.tag})),n&&!_.some(t,["id",n.id])){var a=_.find(l.tags,{id:n.id});a.canSelect=!1,t.push(a)}l.tags=t})}else{var n=[],a=null;l.outbounddial&&(a=_.find(l.tags,{name:l.outbounddial.tag}));for(var i=0;i<l.tags.length;i++)a&&l.tags[i].id===a.id&&(l.tags[i].canSelect=!1,n.push(l.tags[i]));l.tags=n}}).catch(function(e){n.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","outboundrouteApp","outboundroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditoutboundAppoutbounddialDialogController",e)}(),function(){"use strict";function e(e,t,n,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=t.protocol()+"://"+t.host(),u.outboundroute=c||e.params.outboundroute||{},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.gotoOutboundRoutes=function(){e.go("app.voice.outboundroutes")},u.saveOutboundRoute=function(){r.voiceExtension.update({id:u.outboundroute.id},u.outboundroute).$promise.then(function(){l.success({title:"OutboundRoute updated!",msg:u.outboundroute.name?u.outboundroute.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceExtension",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 t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.contexts,{id:e.resourceId})}),n=null;if(u.outboundroute&&(n=_.find(u.contexts,{name:u.outboundroute.context})),n&&!_.some(t,["id",n.id])){var a=_.find(u.contexts,{id:n.id});a.canSelect=!1,t.push(a)}u.contexts=t}):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","outboundroute","userProfileSection"],angular.module("app.voice").controller("OutboundRouteController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.outboundroutes=l||{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="outboundroutes",b.listOrder="",b.listOrderAsc=null,b.selectedOutboundRoutes=[],b.query={fields:"createdAt,updatedAt,id,appdata,type,exten,context,recordingFormat,cutdigits,description",type:"outbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,page:1},b.arrayrecordingFormat=_.keyBy([{option:"none",value:"'none'"},{option:"wav",value:"'wav'"},{option:"wav49",value:"'WAV'"},{option:"gsm",value:"'gsm'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.voice.outboundroutes.edit",{id:e.id,outboundroute:e,crudPermissions:b.crudPermissions})},b.deleteconfirm=function(e,t){var n=i.confirm().title("Are you sure want to delete the "+_.startCase("outboundroute")+"?").htmlContent("<b>"+(e.name||"outboundroute")+"</b> will be deleted.").ariaLabel("delete outboundroute").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getOutboundRoutes=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.voiceExtension.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="OutboundRoutes",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditOutboundRoute=function(e,t){i.show({controller:"CreateOrEditOutboundRouteDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/outboundroutes/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{outboundroute:t,outboundroutes:b.outboundroutes.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteOutboundRoute=S,b.exportSelectedOutboundRoutes=function(){var e=angular.copy(b.selectedOutboundRoutes);return b.selectedOutboundRoutes=[],e},b.deleteSelectedOutboundRoutes=function(e){var t=i.confirm().title("Are you sure want to delete the selected outboundroutes?").htmlContent("<b>"+b.selectedOutboundRoutes.length+" selected</b> will be deleted.").ariaLabel("delete OutboundRoutes").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedOutboundRoutes.forEach(function(e){S(e)}),b.selectedOutboundRoutes=[]})},b.deselectOutboundRoutes=function(){b.selectedOutboundRoutes=[]},b.selectAllOutboundRoutes=function(){b.selectedOutboundRoutes=b.outboundroutes.rows},g.hasRole("admin")?m.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){b.contexts=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){b.contexts=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(b.contexts,{id:e.resourceId})}),n=null;if(b.outboundroute&&(n=_.find(b.contexts,{name:b.outboundroute.context})),n&&!_.some(t,["id",n.id])){var a=_.find(b.contexts,{id:n.id});a.canSelect=!1,t.push(a)}b.contexts=t}):m.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){b.contexts=e.rows||[]})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})});var E=!0,A=1;function y(e){b.outboundroutes=e||{count:0,rows:[]}}function S(t){m.voicePrefix.get({VoiceExtensionId:t.id}).$promise.then(function(e){if(e&&e.rows&&0<e.rows.length)return p.error({title:"Outbound route not deleted!",msg:"You can't remove an outbound route associated to an out prefix"});m.voiceExtension.delete({id:t.id}).$promise.then(function(){_.remove(b.outboundroutes.rows,{id:t.id}),b.outboundroutes.count-=1,b.outboundroutes.rows.length||b.getOutboundRoutes(),p.success({title:_.startCase("OutboundRoute")+" deleted!",msg:t.name?t.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:DELETEvoiceExtension"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceExtension",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})})}e.$watch("vm.query.filter",function(e,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getOutboundRoutes())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","outboundroutes","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.voice").controller("OutboundRoutesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g){var v=this,h=!0;function f(){var e=i.localStorage.getItem("motion2.realtime.abandoned.voice.contacts:"+v.currentUser.id);e&&(e=JSON.parse(e))&&e.query&&(v.query=_.merge(e.query,_.omit(v.query,["sort","limit","page"])),v.query=_.omit(v.query,"filter")),d.hasRole("admin")?o.user.getQueues({id:d.getCurrentUser().id,fields:"id,name",channel:"voice",type:"inbound",nolimit:!0}).$promise.then(function(e){v.queues=e||{count:0,rows:[]},v.queuesMap=_.mapValues(_.keyBy(v.queues.rows,"name"),"name")}).catch(function(e){console.error(e)}).finally(function(){v.getContacts()}):o.userProfile.getResources({id:v.currentUser.userProfileId,section:"QueueCampaigns",channel:"voice",type:"inbound",sort:"-updatedAt",nolimit:!0}).$promise.then(function(e){v.queues=e||{count:0,rows:[]},v.queuesMap=_.mapValues(_.keyBy(v.queues.rows,"name"),"name")}).catch(function(e){console.error(e)}).finally(function(){v.getContacts()})}function b(e){v.contacts=e||{count:0,rows:[]},h=!1,v.refresh=!0}v.showTooltip=!1,v.refresh=!0,v.disable=[],v.agents=p||[],v.currentUser=d.getCurrentUser(),v.localizationMap=u,v.pickerModel={dateStart:null,dateEnd:null},v.queues={},v.contacts={count:0,rows:[]},v.dispositions=g,v.userProfile=r,v.userProfileSection=l&&1==l.count?l.rows[0]:null,v.crudPermissions=d.parseCrudPermissions(v.userProfileSection?v.userProfileSection.crudPermissions:null),v.query={fields:"id,type,calleridnum,calleridname,queue,queuecallerabandonAt,queuecallerexitAt,queuecallerexitreason,assigned,lastAssignedTo,updatedAt,disposition",type:"inbound",queuecallerexitreason:"TIMEOUT,ABANDONED",sort:"-updatedAt",limit:10,page:1},v.clearAll=function(){v.query.createdAt=void 0,v.pickerModel={dateStart:null,dateEnd:null},v.getContacts()},v.getContacts=function(){if(v.refresh=!1,v.pickerModel.dateStart&&!h){var e=moment(v.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format();v.query.createdAt={$gte:v.pickerModel.dateStart,$lte:e}}else v.query.createdAt=void 0;v.query.queue=v.query.queue,v.query.offset=(v.query.page-1)*v.query.limit,i.localStorage.setItem("motion2.realtime.abandoned.voice.contacts:"+v.currentUser.id,JSON.stringify({query:_.omit(v.query,"queue")})),v.promise=o.voiceQueueReport.getVoiceQueuesReport(v.query,b).$promise},v.refreshContacts=function(){v.showTooltip=!1,v.getContacts()},v.onInit=f,v.assignedA=function(e,t){e&&(v.disable[e.id]=!0,o.voiceQueueReport.update({id:e.id,lastAssignedTo:t?t.name:null,assigned:!!t}).$promise.catch(function(e){console.log(e)}).finally(function(){v.disable[e.id]=!1}))},v.disposed=function(e,t){e&&o.voiceQueueReport.update({id:e.id,disposition:t||null}).$promise.catch(function(e){console.log(e)})},v.onSavevoiceQueueReport=function(e){e&&v.queuesMap&&"inbound"===e.type&&v.queuesMap[e.queue]&&(v.showTooltip=!0)},v.onUpdatevoiceQueueReport=function(e){if(e){var t=_.findIndex(v.contacts.rows,["id",e.id]);0<=t&&_.merge(v.contacts.rows[t],e)}},c.onWithoutApply("voiceQueueReport:save",v.onSavevoiceQueueReport),c.on("voiceQueueReport:update",v.onUpdatevoiceQueueReport),f();var E=!0,A=1;e.$watch("vm.query.filter",function(e,t){E?n(function(){E=!1}):(t||(A=v.query.page),e!==t&&(v.query.page=1),e||(v.query.page=A),v.getContacts())}),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","dateFilterLocalizationFactory","agents","dispositions"],angular.module("app.voice").controller("AbandonedCallsVoiceRealtimeController",e)}(),function(){"use strict";function e(e,o,t,n,a,i,s,r,l,d,c,m,u,p,g,v,h,f){var b=this,E=["userpic","online","lastLoginAt","lastPauseAt","pauseType","lastPauseAt","internal","address","chatPause","openchannelPause","mailPause","smsPause","faxPause","voicePause","chatCapacity","openchannelCapacity","mailCapacity","smsCapacity","faxCapacity","chatCurrentCapacity","openchannelCurrentCapacity","mailCurrentCapacity","smsCurrentCapacity","faxCurrentCapacity","chatStatus","openchannelStatus","mailStatus","smsStatus","faxStatus","voiceStatus","chatStatusTime","openchannelStatusTime","mailStatusTime","smsStatusTime","faxStatusTime","voiceStatusTime","queue","destconnectedlinenum","onhold"],A=["chatPause","openchannelPause","mailPause","smsPause","faxPause","voicePause","online"];for(var y in b.currentUser=v.getCurrentUser(),b.availableStates=["ringing","inuse","busy","onhold","not_inuse"],b.pauses=s||{count:0,rows:[]},b.license=h,b.userProfile=p,b.userProfileSection=g&&1==g.count?g.rows[0]:null,b.crudPermissions=v.parseCrudPermissions(b.userProfileSection?b.userProfileSection.crudPermissions:null),b.agents=r?_.keyBy(r.rows?r.rows:[],"id"):{},b.rpcAgents=l?_.keyBy(l.rows?l.rows:[],"id"):{},b.paginatedAgents={},b.load=!1,b.order=[],b.agentInternal={},b.agents)b.agents.hasOwnProperty(y)&&(b.agents[y].init=!0);b.query={limit:10,page:1,order:"fullname",globalStatusFilter:"",pauseTypeFilter:""},b.logout=function(e,t){return d.user.logout({id:e.id,device:"realtime",agent_id:e.id,agent_name:e.name}).$promise.then(function(){m.success({title:"Agent logout",msg:e.fullname+"  properly logout"}),b.agents[e.id]&&(b.agents[e.id].online=!1),b.rpcAgents[e.id]&&(b.rpcAgents[e.id].online=!1),T()}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.queueAdd=function(e,t){n.show({controller:"AgentqueueaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/queueadd/queueadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{agent:e,agents:[],channel:"voice",direction:"inbound",crudPermissions:b.crudPermissions}})},b.pause=function(t,e){return d.user.pause({id:t.id,type:e}).$promise.then(function(e){b.agents[t.id]&&_.merge(b.agents[t.id],_.pick(e,E)),b.rpcAgents[t.id]&&_.merge(b.rpcAgents[t.id],_.pick(e,E)),O(b.agents[t.id])}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.unPause=function(t){return d.user.unpause({id:t.id}).$promise.then(function(e){b.agents[t.id]&&_.merge(b.agents[t.id],_.pick(e,E)),b.rpcAgents[t.id]&&_.merge(b.rpcAgents[t.id],_.pick(e,E)),O(b.agents[t.id])}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.showInfo=function(e){n.show(n.alert().clickOutsideToClose(!0).title("Legend").htmlContent("<div>TODO legend status + state</div>").ok("Ok").targetEvent(e))},b.getAgentStatus=w,b.getAgentGlobalStatus=O,b.isPause=I,b.checkPause=function(e){return"pause"===e},b.isPartialPause=function(e){return"*pause"===e},b.onSave=function(e){b.agents[e.id]&&(_.merge(b.agents[e.id],_.pick(_.omit(e,A),E)),_.merge(b.rpcAgents[e.id],_.pick(_.omit(e,A),E)),O(b.agents[e.id]))},b.onUpdate=function(e){b.agents[e.id]&&(_.merge(b.agents[e.id],_.pick(e,E)),_.merge(b.rpcAgents[e.id],_.pick(e,E)),e.lastPauseAt&&(b.agents[e.id].globalStatusTime=e.lastPauseAt,b.rpcAgents[e.id].globalStatusTime=e.lastPauseAt),O(b.agents[e.id]))},b.onInit=T,b.onConnect=function(e){b.agents[b.agentInternal[e.destaccountcode]]&&(_.merge(b.agents[b.agentInternal[e.destaccountcode]],_.pick(e,["queue","destconnectedlinenum"])),_.merge(b.rpcAgents[b.agentInternal[e.destaccountcode]],_.pick(e,["queue","destconnectedlinenum"])))},b.onComplete=function(e){b.agents[b.agentInternal[e.destaccountcode]]&&(b.agents[b.agentInternal[e.destaccountcode]]=_.omit(b.agents[b.agentInternal[e.destaccountcode]],["queue","destconnectedlinenum"]),b.rpcAgents[b.agentInternal[e.destaccountcode]]=_.omit(b.rpcAgents[b.agentInternal[e.destaccountcode]],["queue","destconnectedlinenum"]))},c.on("user:save",b.onSave),c.on("user:update",b.onUpdate),c.on("user:agentconnect",b.onConnect),c.on("user:agentcomplete",b.onComplete),T();var S=f(function(){b.load&&(b.load=!1,T())},999);function T(e){b.load=!1;var t,n,a=o.defer();b.promise=a.promise,b.filteredAgents=[],b.order=[],_.forIn(b.agents,function(e,t){b.rpcAgents[t]&&_.merge(e,_.pick(_.omit(b.rpcAgents[t],A),E)),O(e),e.online?(b.filteredAgents.push(e),b.agentInternal[e.internal]=t):e.globalStatusTime=_.toNumber(moment().format("x"))}),b.query.globalStatusFilter&&_.remove(b.filteredAgents,function(e){return e.globalStatus!==b.query.globalStatusFilter}),b.query.pauseTypeFilter&&_.remove(b.filteredAgents,function(e){return e.pauseType!==b.query.pauseTypeFilter}),b.query.filter&&_.remove(b.filteredAgents,function(e){return e.fullname.toLowerCase().indexOf(b.query.filter.toLowerCase())<0}),b.filteredAgents=(t=b.filteredAgents,n=_.startsWith(b.query.order,"-")?"desc":"asc",_.orderBy(t,[b.query.order.replace("-","")],[n]));var i=(b.query.page-1)*b.query.limit;b.paginatedAgents=_.drop(b.filteredAgents,i).slice(0,b.query.limit);for(var s=0;s<b.paginatedAgents.length;s+=1)b.order.push(b.paginatedAgents[s].id);a.resolve(),b.load=!0}function I(e){return"pause"===e||"*pause"===e}function C(e){return"idle"===e||"unknown"===e||"unavailable"===e||"ringing"===e||_.isNil(e)}function w(e,t){return"voice"===t?"idle"!==e[t+"Status"]?e[t+"Status"]:e[t+"Pause"]?e[t+"Status"]="pause":"idle":e[t+"Pause"]?e[t+"Status"]="pause":e[t+"Status"]}function O(e){var t="unknown";t=_.every([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],I)?"pause":_.some([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],I)?"*pause":_.every([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],C)?"idle":"busy",e.globalStatus!==t&&(e.globalStatus=t,e.init?(e.init=!1,e.globalStatusTime=I(t)?_.toNumber(moment(e.lastPauseAt).format("x")):_.max([e.voiceStatusTime,e.chatStatusTime,e.mailStatusTime,e.smsStatusTime,e.openchannelStatusTime,e.faxStatusTime])):e.globalStatusTime=_.toNumber(moment().format("x")))}e.$on("$destroy",function(){c.removeAllListeners("user:save"),c.removeAllListeners("user:update"),c.removeAllListeners("user:agentconnect"),c.removeAllListeners("user:agentcomplete"),S&&(f.cancel(S),S=null)})}e.$inject=["$scope","$q","$timeout","$mdDialog","$document","$filter","pauses","agents","rpcAgents","api","socket","toasty","helperClasses","userProfile","userProfileSection","Auth","license","$interval"],angular.module("app.voice").controller("AgentsVoiceRealtimeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s){var o=this;o.calls=i||{rows:[],count:0},o.query={limit:10,page:1},o.channelStatus=s.channelStatusOut,o.onSave=function(e){var t=_.find(o.calls.rows,{channel:e.channel});e.channelstatedesc=e.dialstatus?"up":"ring",t?_.merge(t,e):e.channel&&o.calls.rows.push(e)},o.onRemove=function(e){var t=_.findIndex(o.calls.rows,{channel:e.channel});0<=t&&(o.calls.rows[t].status="hangup");n(function(){o.calls.rows.splice(t,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","helperClasses"],angular.module("app.voice").controller("OutboundCallsVoiceRealtimeController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=u.getCurrentUser(),p.agents=n||{count:0,rows:[]},p.queues=i?_.keyBy(i.rows?i.rows:[],"name"):{},p.rpcVoiceQueuesChannelsTmp=s?_.keyBy(s.rows?_.filter(s.rows,{type:"inbound"}):[],"uniqueid"):{},p.rpcVoiceQueuesChannels={},p.userProfile=c,p.userProfileSection=m&&1==m.count?m.rows[0]:null,p.crudPermissions=u.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.queryChannels={limit:10,page:1},p.getSize=function(e){return _.size(e)},p.$onInit=function(){_.forIn(p.rpcVoiceQueuesChannelsTmp,function(e,t){_.find(p.queues,{name:e.name})&&(p.rpcVoiceQueuesChannels[t]=e)})},p.onSave=function(e){"inbound"===e.type&&_.find(p.queues,{name:e.name})&&(p.rpcVoiceQueuesChannels[e.uniqueid]=e)},p.onRemove=function(e){p.rpcVoiceQueuesChannels[e.uniqueid]&&delete p.rpcVoiceQueuesChannels[e.uniqueid]},p.hangup=function(t){return o.rpc.getVoiceQueuesChannelHangup({uniqueid:t}).$promise.then(function(e){d.success({title:"Channel "+t+" properly hangup!",msg:e.message||""})}).catch(function(e){d.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},p.redirectToAgent=function(t,e,n){return o.rpc.getVoiceQueuesChannelRedirect({uniqueid:t,exten:e,context:n}).$promise.then(function(e){d.success({title:"Channel "+t+" properly redirect!",msg:e.message||""})}).catch(function(e){d.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},p.redirectToNumber=function(e,t){var n=a.prompt().title("Which number do you want transfer the call to?").placeholder("Number").targetEvent(e).ok("Ok").cancel("Cancel");return a.show(n).then(function(e){return o.rpc.getVoiceQueuesChannelRedirect({uniqueid:t,exten:e}).$promise}).then(function(e){d.success({title:"Channel "+t+" properly redirect!",msg:e.message||""})}).catch(function(e){d.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},r.on("voice_queue_channel:save",p.onSave),r.on("voice_queue_channel:remove",p.onRemove),e.$on("$destroy",function(){r.removeAllListeners("voice_queue_channel:save"),r.removeAllListeners("voice_queue_channel:remove")})}e.$inject=["$scope","$timeout","$mdDialog","agents","queues","rpcVoiceQueuesChannels","api","socket","helperClasses","toasty","userProfile","userProfileSection","Auth"],angular.module("app.voice").controller("QueueCallsVoiceRealtimeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this,m=["total","answered","unmanaged","abandoned","sumHoldTime","sumDuration","sumBillable"];function u(){_.forIn(c.queues,function(e,t){c.rpcQueues[t]&&_.merge(e,_.pick(c.rpcQueues[t],m))})}c.count=a.count,c.queues=a?_.keyBy(a.rows?a.rows:[],"id"):{},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:"-updatedAt",limit:10,page:1}:c.query={id:d.getCurrentUser().id,channel:"voice",type:"inbound",fields:"id,name",sort:"-updatedAt",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){c.queues[e.id]&&_.merge(c.queues[e.id],_.pick(e,m))},c.$onInit=u,o.onWithoutApply("voice_queue:save",c.onSave),c.interval=t(function(){},999);var p=!0,g=1;function v(e){c.count=e.count,c.queues=e?_.keyBy(e.rows?e.rows:[],"id"):{},u()}e.$watch("vm.query.filter",function(e,t){p?n(function(){p=!1}):(t||(g=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=g),c.getQueues())}),e.$on("$destroy",function(){o.removeAllListeners("voice_queue:save"),c.interval&&t.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,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this,v=["loggedIn","available","waiting","talking","pTalking","originated","message","dialActive","dialMethod","Trunk","paused"];function h(){var n=[];return _.forIn(g.queues,function(e,t){e.paused=0,e.loggedInDb=0,g.queues[t].agents={},n.push(l.voiceQueue.getMembers({id:t}).$promise),g.rpcQueues[t]&&_.merge(e,_.pick(g.rpcQueues[t],v))}),t.all(n).then(function(e){for(var t=0;t<e.length;t+=1)for(var n=0;n<e[t].rows.length;n++)e[t].rows[n].paused&&g.queues[e[t].rows[n].VoiceQueueId].paused++,g.queues[e[t].rows[n].VoiceQueueId].loggedInDb++,g.queues[e[t].rows[n].VoiceQueueId].agents[e[t].rows[n].UserId]=e[t].rows[n].VoiceQueueId}).catch(function(e){console.error(e)})}g.currentUser=p.getCurrentUser(),g.count=o.count?o.count:0,g.queues=o?_.keyBy(o.rows?o.rows:[],"id"):{},g.rpcQueues=r?_.keyBy(r.rows?r.rows:[],"id"):{},g.userProfile=m,g.userProfileSection=u&&1==u.count?u.rows[0]:null,g.crudPermissions=p.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),p.hasRole("admin")?g.query={type:"inbound",sort:"-updatedAt",limit:10,page:1}:g.query={id:g.currentUser.id,channel:"voice",type:"inbound",sort:"-updatedAt",limit:10,page:1},g.success=E,g.getQueues=function(){g.query.offset=(g.query.page-1)*g.query.limit,p.hasRole("admin")?g.promise=l.voiceQueue.get(g.query,E).$promise:(g.query.id=g.userProfile.id,g.query.section="VoiceQueues",g.promise=l.userProfile.getResources(g.query,E).$promise)},g.createOrEditVoiceQueue=function(e,t){a.show({controller:"CreateOrEditVoiceQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{voiceQueue:t,voiceQueues:_.values(g.queues),license:null,setting:null,crudPermissions:g.crudPermissions}})},g.agentAdd=function(e,t){a.show({controller:"VoiceQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{voiceQueue:t,voiceQueues:g.queues?g.queues.rows:[],realtime:!0,crudPermissions:g.crudPermissions}})},g.updateQueue=function(e){return l.voiceQueue.update(e).$promise.then(function(){c.success({title:"Queue properly updated!",msg:e.name?e.name+" has been updated!":""})}).catch(function(e){c.error({title:"Error creating queue!",msg:e.message})})},g.onSave=function(e){g.queues[e.id]&&_.merge(g.queues[e.id],_.pick(e,v))},g.onPause=function(n){console.log("onPause",n),n.voicePause?_.forIn(g.queues,function(e,t){e.agents[n.id]&&(e.paused+=1,console.log("pause"))}):n.voicePause||_.forIn(g.queues,function(e,t){e.agents[n.id]&&0<e.paused&&(e.paused-=1,console.log("unpause"))})},g.onLogin=function(e){console.log("onLogged",e),g.queues[e.VoiceQueueId]&&(g.queues[e.VoiceQueueId].loggedInDb+=1,g.queues[e.VoiceQueueId].agents[e.UserId]=e.VoiceQueueId)},g.onLogout=function(e){console.log("onLogout",e),g.queues[e.VoiceQueueId]&&0<g.queues[e.VoiceQueueId].loggedInDb&&(g.queues[e.VoiceQueueId].loggedInDb-=1,delete g.queues[e.VoiceQueueId].agents[e.UserId])},g.$onInit=h,g.order=[],_.forIn(g.queues,function(e,t){g.order.push(e.id)}),d.onWithoutApply("voice_queue:save",g.onSave),g.interval=s(function(){},999),d.on("user:update",g.onPause),d.on("userVoiceQueue:remove",g.onLogout),d.on("userVoiceQueue:save",g.onLogin);var f=!0,b=1;function E(e){if(g.count=e.count,g.queues=e?_.keyBy(e.rows?e.rows:[],"id"):{},e.rows){g.order=[];for(var t=0;t<e.rows.length;t++)g.order.push(e.rows[t].id)}h()}e.$watch("vm.query.filter",function(e,t){f?n(function(){f=!1}):(t||(b=g.query.page),e!==t&&(g.query.page=1),e||(g.query.page=b),g.getQueues())}),e.$on("$destroy",function(){d.removeAllListeners("voice_queue:save"),g.interval&&s.cancel(g.interval),d.removeAllListeners("user:update"),d.removeAllListeners("userVoiceQueue:remove"),d.removeAllListeners("userVoiceQueue:save")})}e.$inject=["$scope","$timeout","$mdDialog","$q","$document","$interval","queues","rpcQueues","api","socket","toasty","userProfile","userProfileSection","Auth"],angular.module("app.voice").controller("QueuesVoiceRealtimeController",e)}(),function(){"use strict";angular.module("app.auth").factory("helperClasses",function(){return{status:{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"},state:{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"},channelStatus:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},channelStatusOut:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"}}})}(),function(){"use strict";function e(e,n,t){var a=this;switch(t.disconnect(),t.connect(),a.selectedTab=0,n.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,n.go("app.voice.realtime.agents")}e.$watch("vm.selectedTab",function(e,t){if(e!==t)switch(e){case 0:n.go("app.voice.realtime.agents");break;case 1:n.go("app.voice.realtime.telephones");break;case 2:n.go("app.voice.realtime.trunks");break;case 3:n.go("app.voice.realtime.queues");break;case 4:n.go("app.voice.realtime.queue_calls");break;case 5:n.go("app.voice.realtime.abandonedcalls");break;case 6:n.go("app.voice.realtime.queue_params");break;case 7:n.go("app.voice.realtime.outbound_calls");break;default:n.go("app.voice.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.voice").controller("VoiceRealtimeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this,u=["fullname","internal","state","status"];function p(){_.forIn(m.telephones,function(e,t){m.rpcTelephones[t]&&_.merge(e,_.pick(m.rpcTelephones[t],u))})}m.count=a.count,m.attributes=["fullname","internal","state","status","address"],m.telephones=a?_.keyBy(a.rows?a.rows:[],"id"):{},m.rpcTelephones=i?_.keyBy(i.rows?i.rows:[],"id"):{},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:"-updatedAt",limit:10,page:1},m.statusClass=r.status,m.stateClass=r.state,m.success=h,m.$onInit=p,m.showInfo=function(e){t.show(t.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?_.keyBy(e.rows?e.rows:[],"id"):{},p()}e.$watch("vm.query.filter",function(e,t){g?n(function(){g=!1}):(t||(v=m.query.page),e!==t&&(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","helperClasses","userProfile","userProfileSection","Auth"],angular.module("app.voice").controller("TelephonesVoiceRealtimeController",e)}(),function(){"use strict";function e(e,n,t,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,t=0;t<u.trunks.length;t+=1)0<=(e=_.findIndex(u.rpcTrunks,["id",u.trunks[t].id]))&&_.merge(u.trunks[t],_.pick(u.rpcTrunks[e],p))}function v(e,t,n){0<=t&&_.merge(e[t],_.pick(n,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:"-updatedAt",limit:10,page:1},u.statusClass=r.status,u.stateClass=r.state,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){t.show(t.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,t){l.go("app.tools.trunks.edit",{id:t.id})},u.onSave=function(e){var t=_.findIndex(u.trunks,["id",e.id]),n=_.findIndex(u.rpcTrunks,["id",e.id]);v(u.trunks,t,e),v(u.rpcTrunks,n,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,t){h?n(function(){h=!1}):(t||(f=u.query.page),e!==t&&(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","helperClasses","$state","userProfile","userProfileSection","Auth"],angular.module("app.voice").controller("TrunksVoiceRealtimeController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.voicemails,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The voicemail will be deleted.").ariaLabel("Delete Voicemail").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.voicemail={},c.voicemailMessages={count:0,rows:[]},c.selectedVoicemailMessages=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,callerid,duration,audio,stamp,msg_id",sort:"-stamp",limit:10,page:1},c.init=function(e,t){c.voicemail=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.voicemail.id,c.getVoicemailMessages()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the message?").htmlContent("<b>"+(e.name||"message")+"</b> will be deleted.").ariaLabel("delete message").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.voiceMailMessageDownload=function(s,e,t){return l.voiceMailMessage.download({id:s.id,exists:!0,attachments:t}).$promise.then(function(e){var t=[e.buffer],n="message"+s.id,a=new Blob(t,{type:e.type});n=s.msg_id+".wav";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMail.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.success=p,c.getVoicemailMessages=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.voiceMail.getMessages(c.query,p).$promise},c.createOrEditVoicemailMessage=function(e,t){s.show({controller:"CreateOrEditMessageDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicemails/edit/messages/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{voicemail:c.voicemail,message:t,messages:c.voicemailMessages.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedVoicemailMessages=function(){var e=angular.copy(c.selectedVoicemailMessages);return c.selectedVoicemailMessages=[],e},c.deleteVoicemailMessage=g,c.deleteSelectedVoicemailMessages=function(e){var t=s.confirm().title("Are you sure want to delete the selected messages?").htmlContent("<b>"+c.selectedVoicemailMessages.length+" selected</b> will be deleted.").ariaLabel("delete messages").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedVoicemailMessages.forEach(function(e){g(e)}),c.selectedVoicemailMessages=[]})};var m=!0,u=1;function p(e){c.voicemailMessages=e||{count:0,rows:[]}}function g(e){l.voiceMailMessage.delete({id:e.id}).$promise.then(function(){_.remove(c.voicemailMessages.rows,{id:e.id}),c.voicemailMessages.count-=1,c.voicemailMessages.rows.length||c.getVoicemailMessages(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceMail"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMail",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getVoicemailMessages())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.voice").controller("VoicemailMessagesController",e)}(),function(){"use strict";function e(e,t,n,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=t.protocol()+"://"+t.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")},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 t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.contexts,{id:e.resourceId})}),n=null;if(u.voicemail&&(n=_.find(u.contexts,{name:u.voicemail.context})),n&&!_.some(t,["id",n.id])){var a=_.find(u.contexts,{id:n.id});a.canSelect=!1,t.push(a)}u.contexts=t}):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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.voicemails=l||{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="voicemails",b.listOrder="",b.listOrderAsc=null,b.selectedVoicemails=[],b.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},b.arrayattach=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arrayenvelope=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arraydelete=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.voice.voicemails.edit",{id:e.id,voicemail:e,crudPermissions:b.crudPermissions})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getVoicemails=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.voiceMail.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Voicemails",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditVoicemail=function(e,t){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:t,voicemails:b.voicemails.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteVoicemail=S,b.exportSelectedVoicemails=function(){var e=angular.copy(b.selectedVoicemails);return b.selectedVoicemails=[],e},b.deleteSelectedVoicemails=function(e){var t=i.confirm().title("Are you sure want to delete the selected voicemails?").htmlContent("<b>"+b.selectedVoicemails.length+" selected</b> will be deleted.").ariaLabel("delete Voicemails").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedVoicemails.forEach(function(e){S(e)}),b.selectedVoicemails=[]})},b.deselectVoicemails=function(){b.selectedVoicemails=[]},b.selectAllVoicemails=function(){b.selectedVoicemails=b.voicemails.rows};var E=!0,A=1;function y(e){b.voicemails=e||{count:0,rows:[]}}function S(e){m.voiceMail.delete({id:e.id}).$promise.then(function(){_.remove(b.voicemails.rows,{id:e.id}),b.voicemails.count-=1,b.voicemails.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceMail"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getVoicemails())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","voicemails","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.voice").controller("VoicemailsController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.voicePrefixes,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The voicePrefix will be deleted.").ariaLabel("Delete voicePrefix").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.outboundRoutes,{id:e.resourceId})}),n=null;if(g.voicePrefix&&(n=_.find(g.outboundRoutes,{id:Number(g.voicePrefix.VoiceExtensionId)})),n&&!_.some(t,["id",n.id])){var a=_.find(g.outboundRoutes,{id:n.id});a.canSelect=!1,t.push(a)}g.outboundRoutes=t})}else{var n=[],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,n.push(g.outboundRoutes[i]));g.outboundRoutes=n}}).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,t,n,o,r,l,d){var c=this;function m(){return a(function(n,t){return a(function(t,n){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.voicePrefix.getAgents({id:c.voicePrefix.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return t.penalty=e.UservoicePrefix?"penalty "+e.UservoicePrefix.penalty:"",t.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=l.getCurrentUser(),c.voicePrefix=t,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(n,t){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.voicePrefix.removeAgents({id:c.voicePrefix.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.voicePrefix.addAgents({id:c.voicePrefix.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,items:[],selectedItems:[],showSelectAndDeselectAll:!o,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("VOICE.ALL_AGENTS"),labelSelected:r.instant("VOICE.SELECTED_AGENTS"),transferCallback:function(e,t){var n=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(n)}}}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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.voicePrefixes=l||{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="voicePrefixes",b.listOrder="",b.listOrderAsc=null,b.selectedVoicePrefixes=[],b.query={fields:"createdAt,updatedAt,id,name,VoiceExtensionId,callerIdAll,description",limit:10,page:1},b.editdialog=function(e,t){i.show({controller:"CreateOrEditvoicePrefixDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicePrefixes/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{voicePrefix:e,voicePrefixes:b.voicePrefixes.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.agentadddialog=function(e,t){i.show({controller:"voicePrefixagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicePrefixes/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{voicePrefix:e,voicePrefixes:b.voicePrefixes?b.voicePrefixes.rows:[],crudPermissions:b.crudPermissions,realtime:!1}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getVoicePrefixes=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.voicePrefix.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="VoicePrefixes",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditvoicePrefix=function(e,t){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:t,voicePrefixes:b.voicePrefixes.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deletevoicePrefix=S,b.exportSelectedVoicePrefixes=function(){var e=angular.copy(b.selectedVoicePrefixes);return b.selectedVoicePrefixes=[],e},b.deleteSelectedVoicePrefixes=function(e){var t=i.confirm().title("Are you sure want to delete the selected voicePrefixes?").htmlContent("<b>"+b.selectedVoicePrefixes.length+" selected</b> will be deleted.").ariaLabel("delete voicePrefixs").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedVoicePrefixes.forEach(function(e){S(e)}),b.selectedVoicePrefixes=[]})},b.deselectVoicePrefixes=function(){b.selectedVoicePrefixes=[]},b.selectAllVoicePrefixes=function(){b.selectedVoicePrefixes=b.voicePrefixes.rows},g.hasRole("admin")?m.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){b.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){b.outboundRoutes=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(b.outboundRoutes,{id:e.resourceId})}),n=null;if(b.voicePrefix&&(n=_.find(b.outboundRoutes,{id:Number(b.voicePrefix.VoiceExtensionId)})),n&&!_.some(t,["id",n.id])){var a=_.find(b.outboundRoutes,{id:n.id});a.canSelect=!1,t.push(a)}b.outboundRoutes=t})}else{var n=[],a=null;b.voicePrefix&&(a=_.find(b.outboundRoutes,{id:Number(b.voicePrefix.VoiceExtensionId)}));for(var i=0;i<b.outboundRoutes.length;i++)a&&b.outboundRoutes[i].id===a.id&&(b.outboundRoutes[i].canSelect=!1,n.push(b.outboundRoutes[i]));b.outboundRoutes=n}}).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 E=!0,A=1;function y(e){b.voicePrefixes=e||{count:0,rows:[]}}function S(e){m.voicePrefix.delete({id:e.id}).$promise.then(function(){_.remove(b.voicePrefixes.rows,{id:e.id}),b.voicePrefixes.count-=1,b.voicePrefixes.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoicePrefix"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getVoicePrefixes())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","voicePrefixes","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.voice").controller("VoicePrefixesController",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(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_VOICEQUEUE",g.voiceQueue=angular.copy(l),g.voiceQueues=r,g.newVoiceQueue=!1,g.voiceQueue||(g.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"},g.title="VOICE.NEW_VOICEQUEUE",g.newVoiceQueue=!0),g.addNewVoiceQueue=function(){g.errors=[],d.voiceQueue.save(g.voiceQueue).$promise.then(function(e){g.voiceQueues.unshift(e.toJSON()),o.success({title:"VoiceQueue properly created",msg:g.voiceQueue.name?g.voiceQueue.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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.saveVoiceQueue=function(){g.errors=[],d.voiceQueue.update({id:g.voiceQueue.id},g.voiceQueue).$promise.then(function(e){var t=_.find(g.voiceQueues,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"VoiceQueue properly saved!",msg:g.voiceQueue.name?g.voiceQueue.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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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.deleteVoiceQueue=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The voiceQueue will be deleted.").ariaLabel("Delete VoiceQueue").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.voiceQueue.delete({id:g.voiceQueue.id}).$promise.then(function(){_.remove(g.voiceQueues,{id:g.voiceQueue.id}),o.success({title:"VoiceQueue properly deleted!",msg:(g.voiceQueue.name||"voiceQueue")+" has been deleted!"}),v(g.voiceQueue)}).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","voiceQueues","voiceQueue","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditVoiceQueueDialogController",e)}(),function(){"use strict";function e(e,l,a,d,t,n,i,s,o,r){var c=this;function m(){return l(function(n,t){return l(function(t,n){return d.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],o.hasRole("admin")?e:c.section?c.section.autoAssociation?e:l(function(t,n){return d.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),l(function(t,n){return d.voiceQueue.getAgents({id:c.voiceQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return t.penalty=e.UserVoiceQueue?"penalty "+e.UserVoiceQueue.penalty:"",t.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=o.getCurrentUser(),c.voiceQueue=t,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(n,t){d.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceWith(c.selectedItems,c.startingSelectedItems,function(e,t){return e.id===t.id&&e.penalty===t.penalty});return(n=e,l(function(e,t){_.isEmpty(n)?e():d.voiceQueue.removeAgents({id:c.voiceQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return r=t,l(function(e,t){if(_.isEmpty(r))e();else{for(var n=[],a=_.groupBy(r,"penalty"),i=0;i<Object.keys(a).length;i++){var s=Object.keys(a)[i],o=_.filter(r,["penalty",s]);n.push(d.voiceQueue.addAgents({id:c.voiceQueue.id,ids:_.map(o,"id"),penalty:_.trim(s,"penalty "),realtime:c.realtime||!1}).$promise)}l.all(n).then(function(){e()}).catch(function(e){t(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 n},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,items:[],selectedItems:[],showSelectAndDeselectAll:!i,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"penalty",labelAll:s.instant("VOICE.ALL_AGENTS"),labelSelected:s.instant("VOICE.SELECTED_AGENTS"),transferCallback:function(e,t){t?e.forEach(function(e){e.penalty=void 0}):e.forEach(function(e){e.penalty="penalty "+c.penalty});var n=_.xorWith(c.startingSelectedItems,c.selectedItems,function(e,t){return e.id===t.id&&e.penalty===t.penalty});c.pendingChanges=!_.isEmpty(n)}}}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,l,a,d,t,n,i,s){var c=this;function o(){return l(function(n,t){return l(function(t,n){return d.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],i.hasRole("admin")?e:c.section?c.section.autoAssociation?e:l(function(t,n){return d.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,function(e){return _.find(c.items,{id:i.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.items.forEach(function(e){var t=_.find(c.allowedItems,{id:e.id});i.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),l(function(t,n){return d.voiceQueue.getTeams({id:c.voiceQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){return _.find(c.items,{id:e.id})}),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=i.getCurrentUser(),c.voiceQueue=t,c.crudPermissions=s,c.penalty=0,c.items=[],c.allowedItems=[],c.selectedItems=[],c.addedItems=[],c.removedItems=[],c.pendingChanges=!1,c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!0,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:n.instant("VOICE.ALL_TEAMS"),labelSelected:n.instant("VOICE.SELECTED_TEAMS"),transferCallback:function(e,t){t?c.removedItems=_.unionBy(e,c.removedItems,"id"):(e.forEach(function(e){e.penalty="penalty "+c.penalty}),c.addedItems=_.unionBy(e,c.addedItems,"id")),c.pendingChanges=!0}},c.onInit=function(){return i.hasRole("admin")?o().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(function(n,t){d.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(e)})}).then(function(e){return c.section=e,o()}).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()})})},c.saveTeams=function(){var e=c.removedItems,t=c.addedItems;return(n=e,l(function(e,t){_.isEmpty(n)?e():d.voiceQueue.removeTeams({id:c.voiceQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return r=t,l(function(e,t){if(_.isEmpty(r))e();else{for(var n=[],a=_.groupBy(r,"penalty"),i=0;i<Object.keys(a).length;i++){var s=Object.keys(a)[i],o=_.filter(r,["penalty",s]);n.push(d.voiceQueue.addTeams({id:c.voiceQueue.id,ids:_.map(o,"id"),penalty:_.trim(s,"penalty ")}).$promise)}l.all(n).then(function(){e()}).catch(function(e){t(e)})}});var r}).then(function(){c.pendingChanges=!1,c.addedItems=[],c.removedItems=[],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 n},c.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(n,e,a,i,s,t,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=t,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.voiceQueue=c||n.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=n.params.tab||0,u.teamadddialog=function(e,t){a.show({controller:"VoiceQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/edit/teamadd/teamadd.html",parent:angular.element(i.body),targetEvent:t,clickOutsideToClose:!0,locals:{voiceQueue:e,voiceQueues:u.voiceQueues?u.voiceQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,t){a.show({controller:"VoiceQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:t,clickOutsideToClose:!0,locals:{voiceQueue:e,voiceQueues:u.voiceQueues?u.voiceQueues.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.gotogoto=function(e,t){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:411}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.voice.realtime.queues",{})}},u.alert=l.info,u.gotoVoiceQueues=function(){n.go("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 t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.musiconholds,{id:e.resourceId})}),n=null;if(u.voiceQueue&&(n=_.find(u.musiconholds,{name:u.voiceQueue.musiconhold})),n&&!_.some(t,["id",n.id])){var a=_.find(u.musiconholds,{id:n.id});a.canSelect=!1,t.push(a)}u.musiconholds=t}):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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.sounds,{id:e.resourceId})});u.sounds.forEach(function(e){_.some(t,["id",e.id])||(e.canSelect=!1),t.push(e)}),u.sounds=t})}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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.pauses,{id:e.resourceId})});u.pauses.forEach(function(e){_.some(t,["id",e.id])||(e.canSelect=!1),t.push(e)}),u.pauses=t})}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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.voiceQueues=l||{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="voiceQueues",b.listOrder="",b.listOrderAsc=null,b.selectedVoiceQueues=[],b.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,mandatoryDisposition,mandatoryDispositionPauseId",type:"inbound",sort:"-updatedAt",channel:"voice",limit:10,page:1},b.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"),"")}),b.arrayjoinempty=_.keyBy([{option:"no",value:"'no'"},{option:"yes",value:"'yes'"},{option:"strict",value:"'strict'"},{option:"loose",value:"'loose'"},{option:"paused",value:"'paused'"},{option:"penalty",value:"'penalty'"},{option:"inuse",value:"'inuse'"},{option:"ringing",value:"'ringing'"},{option:"unavailable",value:"'unavailable'"},{option:"invalid",value:"'invalid'"},{option:"unknoww",value:"'unknown'"},{option:"wrapup",value:"'wrapup'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arrayleavewhenempty=_.keyBy([{option:"no",value:"'no'"},{option:"yes",value:"'yes'"},{option:"strict",value:"'strict'"},{option:"loose",value:"'loose'"},{option:"paused",value:"'paused'"},{option:"penalty",value:"'penalty'"},{option:"inuse",value:"'inuse'"},{option:"ringing",value:"'ringing'"},{option:"unavailable",value:"'unavailable'"},{option:"invalid",value:"'invalid'"},{option:"unknoww",value:"'unknown'"},{option:"wrapup",value:"'wrapup'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arrayrandom_periodic_announce=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arrayannounce_holdtime=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Once",value:"'once'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.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"),"")}),b.arrayreportholdtime=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arrayautopause=_.keyBy([{option:"Yes",value:"'all'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arrayringinuse=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arraytimeoutrestart=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.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"),"")}),b.arraysetinterfacevar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arraysetqueuevar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arraysetqueueentryvar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.voice.voiceQueues.edit",{id:e.id,voiceQueue:e,crudPermissions:b.crudPermissions})},b.teamadddialog=function(e,t){i.show({controller:"VoiceQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{voiceQueue:e,voiceQueues:b.voiceQueues?b.voiceQueues.rows:[],crudPermissions:b.crudPermissions}})},b.agentadddialog=function(e,t){i.show({controller:"VoiceQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{voiceQueue:e,voiceQueues:b.voiceQueues?b.voiceQueues.rows:[],crudPermissions:b.crudPermissions,realtime:!1}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.gotorealtimegoto=function(e,t){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:411}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.voice.realtime.queues",{})}},b.success=y,b.getVoiceQueues=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.voiceQueue.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="VoiceQueues",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditVoiceQueue=function(e,t){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:t,voiceQueues:b.voiceQueues.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteVoiceQueue=S,b.exportSelectedVoiceQueues=function(){var e=angular.copy(b.selectedVoiceQueues);return b.selectedVoiceQueues=[],e},b.deleteSelectedVoiceQueues=function(e){var t=i.confirm().title("Are you sure want to delete the selected voiceQueues?").htmlContent("<b>"+b.selectedVoiceQueues.length+" selected</b> will be deleted.").ariaLabel("delete VoiceQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedVoiceQueues.forEach(function(e){S(e)}),b.selectedVoiceQueues=[]})},b.deselectVoiceQueues=function(){b.selectedVoiceQueues=[]},b.selectAllVoiceQueues=function(){b.selectedVoiceQueues=b.voiceQueues.rows};var E=!0,A=1;function y(e){b.voiceQueues=e||{count:0,rows:[]}}function S(e){m.voiceQueue.delete({id:e.id}).$promise.then(function(){_.remove(b.voiceQueues.rows,{id:e.id}),b.voiceQueues.count-=1,b.voiceQueues.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceQueue"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getVoiceQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","voiceQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.voice").controller("VoiceQueuesController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.voiceRecordings,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The voiceRecording will be deleted.").ariaLabel("Delete VoiceRecording").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.voiceRecordings=l||{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",sort:"-updatedAt",limit:10,page:1},b.localizationMap=f,b.pickerModel={dateStart:null},b.downloadfile2=function(s,e){return m.voiceRecording.download({id:s.id}).$promise.then(function(e){var t=[e.buffer],n="download",a=new Blob(t,{type:e.type});n=s.uniqueid+s.format;var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else 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,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getVoiceRecordings=function(){if(b.pickerModel.dateStart){var e=moment(b.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format();b.query.createdAt={$gte:b.pickerModel.dateStart,$lte:e}}else b.query.createdAt=void 0;b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.voiceRecording.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="VoiceRecordings",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditVoiceRecording=function(e,t){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:t,voiceRecordings:b.voiceRecordings.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteVoiceRecording=S,b.exportSelectedVoiceRecordings=function(){var e=angular.copy(b.selectedVoiceRecordings);return b.selectedVoiceRecordings=[],e},b.deleteSelectedVoiceRecordings=function(e){var t=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(t).then(function(){b.selectedVoiceRecordings.forEach(function(e){S(e)}),b.selectedVoiceRecordings=[]})},b.deselectVoiceRecordings=function(){b.selectedVoiceRecordings=[]},b.selectAllVoiceRecordings=function(){b.selectedVoiceRecordings=b.voiceRecordings.rows},b.clearDateFilter=function(){b.pickerModel={dateStart:null},b.getVoiceRecordings()};var E=!0,A=1;function y(e){b.voiceRecordings=e||{count:0,rows:[]}}function S(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 t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getVoiceRecordings())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","voiceRecordings","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.voice").controller("VoiceRecordingsController",e)}(),function(){"use strict";function e(t,n,s,a,o,e,i,r){var l=this;function d(e,t){return{id:e,title:t.name||"NONAME",state:"app.dashboards.custom",stateParams:t,weight:2,hidden:function(){return o.hasRole("agent")||!o.hasPermission(e)&&!o.hasRole("admin")}}}function c(e,t){return{id:e,title:t.name||"NONAME",state:"app.plugins.plugin",stateParams:t,weight:2,hidden:function(){return o.hasRole("agent")||!o.hasPermission(e)&&!o.hasRole("admin")}}}function m(e,t){a.saveItem("apps.home.plugin_"+e,{id:e,title:t.name,translate:t.name,state:"plugin_"+t.id,stateParams:t,view:"plugin",icon:t.icon,weight:12,hidden:function(){return!o.hasPermission(e)}})}function u(e){return _.map(e.children,function(e){return e.id})}l.isAgent=function(){return o.getCurrentUser()&&o.hasRole("agent")},s.saveItem("apps",{title:"APPS",group:!0,weight:1,hidden:function(){return o.hasRole("agent")}}),i.version.get().$promise.then(function(e){l.version=e&&e.current?e.current:"UNKNOWN"}).catch(function(e){l.version="UNKNOWN"}).finally(function(){s.saveItem("version",{title:"VERSION "+l.version,group:!0,weight:2,hidden:function(){return o.hasRole("agent")}})}),o.isLoggedIn()&&(i.dashboard.get().$promise.then(function(e){for(var t=0,n=0;n<e.rows.length;n+=1)t=99999+e.rows[n].id,s.saveItem("apps.dashboards.custom_"+t,d(t,e.rows[n]))}),i.plugin.get({active:!0}).$promise.then(function(e){var t=0;if(e.count){var n=_.filter(e.rows,function(e){return"never"!=e.sidebar&&"agentOnly"!=e.sidebar});if(0<n.length){s.saveItem("apps.plugins",{id:1900,title:"Plugins",translate:"PLUGINS.PLUGINS",icon:"icon-apps",permissions:{hidden:!0},weight:17,hidden:function(){return o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}});for(var a=0;a<n.length;a+=1)t=88888+n[a].id,s.saveItem("apps.plugins.plugin_"+t,c(t,n[a]));s.sort()}var i=_.filter(e.rows,function(e){return"never"!=e.sidebar&&"adminOnly"!=e.sidebar});if(0<i.length)for(a=0;a<i.length;a+=1)m(t=88888+i[a].id,i[a])}})),e.custom&&!r.defaultPageTitle&&r.pageTitle&&angular.element("#pageTitle").html(r.pageTitle),s.saveItem("apps.dashboards",{id:100,title:"Dashboards",translate:"DASHBOARDS.DASHBOARDS",icon:"icon-tile-four",weight:2,hidden:function(){return o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.saveItem("apps.dashboards.general",{id:101,title:"General",route:"",translate:"DASHBOARDS.GENERAL",state:"app.dashboards.general",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(101)&&!o.hasRole("admin")}}),s.saveItem("apps.staff",{id:200,title:"Staff",translate:"STAFF.STAFF",icon:"icon-account-multiple",weight:3,hidden:function(){return o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||o.hasRole("user")||!o.hasPermission(201)&&!o.hasRole("admin")}}),s.saveItem("apps.staff.agents",{id:202,title:"Agents",route:"user",translate:"STAFF.AGENTS",state:"app.staff.agents",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(202)&&!o.hasRole("admin")}}),s.saveItem("apps.staff.telephones",{id:203,title:"Telephones",route:"user",translate:"STAFF.TELEPHONES",state:"app.staff.telephones",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(203)&&!o.hasRole("admin")}}),s.saveItem("apps.staff.teams",{id:204,title:"Teams",route:"team",translate:"STAFF.TEAMS",state:"app.staff.teams",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(204)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(205)&&!o.hasRole("admin")}}),s.saveItem("apps.contactmanager",{id:300,title:"ContactManager",translate:"CONTACTMANAGER.CONTACTMANAGER",icon:"icon-account-circle",license:"cm",weight:4,hidden:function(){return!e.cm||o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.saveItem("apps.contactmanager.lists",{id:301,title:"Lists",route:"cmList",translate:"CONTACTMANAGER.LISTS",state:"app.contactmanager.lists",weight:2,hidden:function(){return o.hasRole("agent")||!o.hasPermission(301)&&!o.hasRole("admin")}}),s.saveItem("apps.contactmanager.companies",{id:302,title:"Companies",route:"cmCompany",translate:"CONTACTMANAGER.COMPANIES",state:"app.contactmanager.companies",weight:3,hidden:function(){return o.hasRole("agent")||!o.hasPermission(302)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(304)&&!o.hasRole("admin")}}),s.saveItem("apps.contactmanager.contacts",{id:303,title:"Contacts",route:"",translate:"CONTACTMANAGER.CONTACTS",state:"app.contactmanager.contacts",permissions:{association:!1},weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(303)&&!o.hasRole("admin")}}),s.saveItem("apps.voice",{id:400,title:"Voice",translate:"VOICE.VOICE",icon:"icon-phone",license:"voice",weight:5,hidden:function(){return!e.voice||o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.saveItem("apps.voice.voiceQueues",{id:401,title:"VoiceQueues",route:"voiceQueue",channel:"voice",translate:"VOICE.VOICEQUEUES",state:"app.voice.voiceQueues",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(401)&&!o.hasRole("admin")}}),s.saveItem("apps.voice.inboundroutes",{id:402,title:"InboundRoutes",route:"voiceExtension",translate:"VOICE.INBOUNDROUTES",state:"app.voice.inboundroutes",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(402)&&!o.hasRole("admin")}}),s.saveItem("apps.voice.outboundroutes",{id:403,title:"OutboundRoutes",route:"voiceExtension",translate:"VOICE.OUTBOUNDROUTES",state:"app.voice.outboundroutes",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(403)&&!o.hasRole("admin")}}),s.saveItem("apps.voice.internalroutes",{id:404,title:"InternalRoutes",route:"voiceExtension",translate:"VOICE.INTERNALROUTES",state:"app.voice.internalroutes",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(404)&&!o.hasRole("admin")}}),s.saveItem("apps.voice.contexts",{id:405,title:"Contexts",route:"voiceContext",translate:"VOICE.CONTEXTS",state:"app.voice.contexts",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(405)&&!o.hasRole("admin")}}),s.saveItem("apps.voice.voicemails",{id:406,title:"Voicemails",route:"voiceMail",translate:"VOICE.VOICEMAILS",state:"app.voice.voicemails",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(406)&&!o.hasRole("admin")}}),s.saveItem("apps.voice.musiconholds",{id:407,title:"MusicOnHolds",route:"voiceMusicOnHold",translate:"VOICE.MUSICONHOLDS",state:"app.voice.musiconholds",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(407)&&!o.hasRole("admin")}}),s.saveItem("apps.voice.voiceRecordings",{id:408,title:"VoiceRecordings",route:"voiceRecording",translate:"VOICE.VOICERECORDINGS",state:"app.voice.voiceRecordings",permissions:{association:!1,loading:!0},weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(408)&&!o.hasRole("admin")}}),s.saveItem("apps.voice.chanSpies",{id:409,title:"ChanSpies",route:"voiceChanSpy",translate:"VOICE.CHANSPIES",state:"app.voice.chanSpies",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(409)&&!o.hasRole("admin")}}),s.saveItem("apps.voice.voicePrefixes",{id:410,title:"VoicePrefixes",route:"voicePrefix",translate:"VOICE.VOICEPREFIXES",state:"app.voice.voicePrefixes",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(410)&&!o.hasRole("admin")}}),s.saveItem("apps.voice.realtime",{id:411,title:"Realtime",route:"",translate:"VOICE.REALTIME",state:"app.voice.realtime",permissions:{association:!1,crud:!1},weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(411)&&!o.hasRole("admin")}}),s.saveItem("apps.chat",{id:500,title:"Chat",translate:"CHAT.CHAT",icon:"icon-hangouts",license:"chat",weight:6,hidden:function(){return!e.chat||o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.saveItem("apps.chat.chatQueues",{id:501,title:"ChatQueues",route:"chatQueue",channel:"chat",translate:"CHAT.CHATQUEUES",state:"app.chat.chatQueues",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(501)&&!o.hasRole("admin")}}),s.saveItem("apps.chat.chatWebsites",{id:502,title:"ChatWebsites",route:"chatWebsite",channel:"chat",translate:"CHAT.CHATWEBSITES",state:"app.chat.chatWebsites",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(502)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(510)&&!o.hasRole("admin")}}),s.saveItem("apps.mail",{id:600,title:"Mail",translate:"MAIL.MAIL",icon:"icon-email",license:"mail",weight:7,hidden:function(){return!e.mail||o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.saveItem("apps.mail.mailQueues",{id:601,title:"MailQueues",route:"mailQueue",channel:"mail",translate:"MAIL.MAILQUEUES",state:"app.mail.mailQueues",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(601)&&!o.hasRole("admin")}}),s.saveItem("apps.mail.mailAccounts",{id:602,title:"MailAccounts",route:"mailAccount",channel:"mail",translate:"MAIL.MAILACCOUNTS",state:"app.mail.mailAccounts",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(602)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(603)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(610)&&!o.hasRole("admin")}}),s.saveItem("apps.sms",{id:700,title:"Sms",translate:"SMS.SMS",icon:"icon-message-text",license:"messaging",weight:8,hidden:function(){return!e.messaging||o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.saveItem("apps.sms.smsQueues",{id:701,title:"SmsQueues",route:"smsQueue",channel:"sms",translate:"SMS.SMSQUEUES",state:"app.sms.smsQueues",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(701)&&!o.hasRole("admin")}}),s.saveItem("apps.sms.smsAccounts",{id:702,title:"SmsAccounts",route:"smsAccount",channel:"sms",translate:"SMS.SMSACCOUNTS",state:"app.sms.smsAccounts",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(702)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(710)&&!o.hasRole("admin")}}),s.saveItem("apps.openchannel",{id:800,title:"Openchannel",translate:"OPENCHANNEL.OPENCHANNEL",icon:"icon-google-earth",license:"openchannel",weight:9,hidden:function(){return!e.openchannel||o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.saveItem("apps.openchannel.openchannelQueues",{id:801,title:"OpenchannelQueues",route:"openchannelQueue",channel:"openChannel",translate:"OPENCHANNEL.OPENCHANNELQUEUES",state:"app.openchannel.openchannelQueues",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(801)&&!o.hasRole("admin")}}),s.saveItem("apps.openchannel.openchannelAccounts",{id:802,title:"OpenchannelAccounts",route:"openchannelAccount",channel:"openChannel",translate:"OPENCHANNEL.OPENCHANNELACCOUNTS",state:"app.openchannel.openchannelAccounts",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(802)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(810)&&!o.hasRole("admin")}}),s.saveItem("apps.fax",{id:900,title:"Fax",translate:"FAX.FAX",icon:"icon-deskphone",license:"fax",weight:10,hidden:function(){return!e.fax||o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.saveItem("apps.fax.faxQueues",{id:901,title:"FaxQueues",route:"faxQueue",channel:"fax",translate:"FAX.FAXQUEUES",state:"app.fax.faxQueues",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(901)&&!o.hasRole("admin")}}),s.saveItem("apps.fax.faxAccounts",{id:902,title:"FaxAccounts",route:"faxAccount",channel:"fax",translate:"FAX.FAXACCOUNTS",state:"app.fax.faxAccounts",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(902)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(910)&&!o.hasRole("admin")}}),s.saveItem("apps.tools",{id:1e3,title:"Tools",translate:"TOOLS.TOOLS",icon:"icon-auto-fix",weight:13,hidden:function(){return o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.saveItem("apps.tools.cannedAnswers",{id:1001,title:"CannedAnswers",route:"cannedAnswer",translate:"TOOLS.CANNEDANSWERS",state:"app.tools.cannedAnswers",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1001)&&!o.hasRole("admin")}}),s.saveItem("apps.tools.dispositions",{id:1002,title:"Dispositions",route:"disposition",translate:"TOOLS.DISPOSITIONS",state:"app.tools.dispositions",weight:2,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1002)&&!o.hasRole("admin")}}),s.saveItem("apps.tools.customDashboards",{id:1003,title:"CustomDashboards",route:"dashboard",translate:"TOOLS.CUSTOMDASHBOARDS",state:"app.tools.customDashboards",weight:3,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1003)&&!o.hasRole("admin")}}),s.saveItem("apps.tools.intervals",{id:1004,title:"Intervals",route:"interval",translate:"TOOLS.INTERVALS",state:"app.tools.intervals",weight:4,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1004)&&!o.hasRole("admin")}}),s.saveItem("apps.tools.pauses",{id:1005,title:"Pauses",route:"pause",translate:"TOOLS.PAUSES",state:"app.tools.pauses",weight:5,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1005)&&!o.hasRole("admin")}}),s.saveItem("apps.tools.schedules",{id:1006,title:"Scheduler",route:"schedule",translate:"TOOLS.SCHEDULER",state:"app.tools.schedules",weight:6,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1006)&&!o.hasRole("admin")}}),s.saveItem("apps.tools.sounds",{id:1007,title:"Sounds",route:"sound",translate:"TOOLS.SOUNDS",state:"app.tools.sounds",weight:7,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1007)&&!o.hasRole("admin")}}),s.saveItem("apps.tools.tags",{id:1008,title:"Tags",route:"tag",translate:"TOOLS.TAGS",state:"app.tools.tags",weight:8,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1008)&&!o.hasRole("admin")}}),s.saveItem("apps.tools.templates",{id:1009,title:"Templates",route:"template",translate:"TOOLS.TEMPLATES",state:"app.tools.templates",weight:9,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1009)&&!o.hasRole("admin")}}),s.saveItem("apps.tools.triggers",{id:1010,title:"Triggers",route:"trigger",translate:"TOOLS.TRIGGERS",state:"app.tools.triggers",weight:10,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1010)&&!o.hasRole("admin")}}),s.saveItem("apps.tools.trunks",{id:1011,title:"Trunks",route:"trunk",translate:"TOOLS.TRUNKS",state:"app.tools.trunks",weight:11,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1011)&&!o.hasRole("admin")}}),s.saveItem("apps.tools.variables",{id:1012,title:"Variables",route:"variable",translate:"TOOLS.VARIABLES",state:"app.tools.variables",weight:12,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1012)&&!o.hasRole("admin")}}),s.saveItem("apps.callysquare",{id:1100,title:"CallySquare",translate:"CALLYSQUARE.CALLYSQUARE",icon:"icon-sitemap",license:"voice",weight:11,hidden:function(){return!e.voice||o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.saveItem("apps.callysquare.odbcs",{id:1101,title:"ODBC",route:"squareOdbc",translate:"CALLYSQUARE.ODBC",state:"app.callysquare.odbcs",weight:2,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1101)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(1102)&&!o.hasRole("admin")}}),s.saveItem("apps.callysquare.projects",{id:1103,title:"Projects",route:"squareProject",translate:"CALLYSQUARE.PROJECTS",state:"app.callysquare.projects",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1103)&&!o.hasRole("admin")}}),s.saveItem("apps.analytics",{id:1200,title:"Analytics",translate:"ANALYTICS.ANALYTICS",icon:"icon-chart-line",weight:14,hidden:function(){return o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.saveItem("apps.analytics.metrics",{id:1201,title:"Metrics",route:"analyticMetric",translate:"ANALYTICS.METRICS",state:"app.analytics.metrics",weight:3,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1201)&&!o.hasRole("admin")}}),s.saveItem("apps.analytics.extractedReports",{id:1202,title:"ExtractedReports",route:"analyticExtractedReport",translate:"ANALYTICS.EXTRACTEDREPORTS",state:"app.analytics.extractedReports",weight:2,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1202)&&!o.hasRole("admin")}}),s.saveItem("apps.analytics.reports",{id:1203,title:"Reports",route:"",translate:"ANALYTICS.REPORTS",state:"app.analytics.reports",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1203)&&!o.hasRole("admin")}}),s.saveItem("apps.integrations",{id:1300,title:"Integrations",translate:"INTEGRATIONS.INTEGRATIONS",icon:"icon-heart",weight:15,hidden:function(){return o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(1301)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(1302)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(1303)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(1305)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(1306)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(1307)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(1308)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(1309)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(1310)&&!o.hasRole("admin")}}),s.saveItem("apps.settings",{id:1400,title:"Settings",translate:"SETTINGS.SETTINGS",icon:"icon-cog",permissions:{hidden:!0},weight:18,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1400)&&!o.hasRole("admin")}}),s.saveItem("apps.settings.generals",{id:1401,title:"General",route:"setting",translate:"SETTINGS.GENERAL",state:"app.settings.generals",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1400)&&!o.hasRole("admin")}}),s.saveItem("apps.settings.smtps",{id:1402,title:"Smtp",route:"mailAccount",translate:"SETTINGS.SMTP",state:"app.settings.smtps",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1400)&&!o.hasRole("admin")}}),s.saveItem("apps.settings.networks",{id:1403,title:"Networks",route:"network",translate:"SETTINGS.NETWORKS",state:"app.settings.networks",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1400)&&!o.hasRole("admin")}}),s.saveItem("apps.settings.customizations",{id:1407,title:"Customizations",route:"setting",translate:"SETTINGS.CUSTOMIZATIONS",state:"app.settings.customizations",weight:1,hidden:function(){return!e.custom||o.hasRole("agent")||!o.hasPermission(1400)&&!o.hasRole("admin")}}),s.saveItem("apps.settings.updates",{id:1404,title:"Updates",route:"",translate:"SETTINGS.UPDATES",state:"app.settings.updates",weight:1,hidden:function(){return!e.update||o.hasRole("agent")||!o.hasPermission(1400)&&!o.hasRole("admin")}}),s.saveItem("apps.settings.license",{id:1405,title:"License",route:"",translate:"SETTINGS.LICENSE",state:"app.settings.license",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1400)&&!o.hasRole("admin")}}),s.saveItem("apps.settings.system",{id:1406,title:"System",route:"",translate:"SETTINGS.SYSTEM",state:"app.settings.system",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1400)&&!o.hasRole("admin")}}),s.saveItem("apps.motiondialer",{id:1500,title:"MotionDialer",translate:"MOTIONDIALER.MOTIONDIALER",icon:"icon-fire",license:"dialer",weight:5,hidden:function(){return!e.dialer||o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.saveItem("apps.motiondialer.queueCampaigns",{id:1501,title:"QueueCampaigns",route:"voiceQueue",channel:"bull",translate:"MOTIONDIALER.QUEUECAMPAIGNS",state:"app.motiondialer.queueCampaigns",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1501)&&!o.hasRole("admin")}}),s.saveItem("apps.motiondialer.ivrCampaigns",{id:1502,title:"IvrCampaigns",route:"campaign",translate:"MOTIONDIALER.IVRCAMPAIGNS",state:"app.motiondialer.ivrCampaigns",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1502)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(1510)&&!o.hasRole("admin")}}),s.saveItem("apps.help",{id:1600,title:"Help",translate:"HELP.HELP",icon:"icon-help",permissions:{association:!1},weight:19,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1600)&&!o.hasRole("admin")}}),s.saveItem("apps.help.about",{id:1601,title:"About",route:"",translate:"HELP.ABOUT",state:"app.help.about",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1600)&&!o.hasRole("admin")}}),s.saveItem("apps.jscripty",{id:1700,title:"jscripty",translate:"JSCRIPTY.JSCRIPTY",icon:"icon-script",license:"jscripty",weight:12,hidden:function(){return!e.jscripty||o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.saveItem("apps.jscripty.projects",{id:1701,title:"Projects",route:"jscriptyProject",translate:"JSCRIPTY.PROJECTS",state:"app.jscripty.projects",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1701)&&!o.hasRole("admin")}}),s.saveItem("apps.marketplace",{id:1800,title:"Marketplace",translate:"MARKETPLACE.MARKETPLACE",icon:"icon-cart",weight:16,hidden:function(){return o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.saveItem("apps.marketplace.plugins",{id:1801,title:"Plugins",route:"plugin",translate:"MARKETPLACE.PLUGINS",state:"app.marketplace.plugins",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1801)&&!o.hasRole("admin")}}),s.sort(),a.saveItem("apps",{title:"APPS",group:!0,weight:1}),a.saveItem("apps.home",{id:100,title:"Home",translate:"DASHBOARDS.HOME",icon:"icon-home",weight:1}),a.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!o.hasPermission(101)}}),a.saveItem("apps.home.contacts",{id:102,title:"Contacts",translate:"DASHBOARDS.CONTACTS",state:"contacts",view:"contacts",icon:"icon-account-circle",iconClass:"red-fg",weight:2,hidden:function(){return!e.cm||!o.hasPermission(102)}}),a.saveItem("apps.home.mycontacts",{id:103,title:"Contacts",translate:"DASHBOARDS.MYCONTACTS",state:"mycontacts",view:"mycontacts",icon:"icon-account-multiple",iconClass:"red-fg",weight:3,hidden:function(){return!e.cm||!o.hasPermission(103)}}),a.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:3,hidden:function(){return!e.dialer||!o.hasPermission(113)}}),a.saveItem("apps.home.voice",{id:110,title:"Voice",translate:"DASHBOARDS.VOICE",state:"voice",view:"voice",icon:"icon-phone",iconClass:"blue-A700-fg",weight:4,hidden:function(){return!e.voice||!o.hasPermission(110)}}),a.saveItem("apps.home.abandoned",{id:111,title:"Abandoned",translate:"DASHBOARDS.ABANDONED",state:"abandoned",view:"abandoned",icon:"icon-phone-missed",iconClass:"blue-fg",weight:5,hidden:function(){return!e.voice||!o.hasPermission(111)}}),a.saveItem("apps.home.recordings",{id:104,title:"Recordings",translate:"DASHBOARDS.RECORDINGS",state:"recordings",view:"recordings",icon:"icon-audiobook",iconClass:"indigo-A100-fg",weight:6,hidden:function(){return!e.voice||!o.hasPermission(104)}}),a.saveItem("apps.home.chat",{id:105,title:"Chat",translate:"DASHBOARDS.CHAT",state:"chat",view:"chat",icon:"icon-hangouts",iconClass:"green-A700-fg",weight:7,hidden:function(){return!e.chat||!o.hasPermission(105)}}),a.saveItem("apps.home.mail",{id:106,title:"Mail",translate:"DASHBOARDS.MAIL",state:"mail",view:"mail",icon:"icon-email",iconClass:"teal-fg",weight:8,hidden:function(){return!e.mail||!o.hasPermission(106)}}),a.saveItem("apps.home.sms",{id:107,title:"Sms",translate:"DASHBOARDS.SMS",state:"sms",view:"sms",icon:"icon-message-text",iconClass:"orange-fg",weight:9,hidden:function(){return!e.messaging||!o.hasPermission(107)}}),a.saveItem("apps.home.openchannel",{id:108,title:"Openchannel",translate:"DASHBOARDS.OPENCHANNEL",state:"openchannel",view:"openchannel",icon:"icon-google-earth",iconClass:"amber-A200-fg",weight:10,hidden:function(){return!e.openchannel||!o.hasPermission(108)}}),a.saveItem("apps.home.fax",{id:109,title:"Fax",translate:"DASHBOARDS.FAX",state:"fax",view:"fax",icon:"icon-deskphone",iconClass:"blue-grey-A200-fg",weight:11,hidden:function(){return!e.fax||!o.hasPermission(109)}}),t.$on("$viewContentAnimationEnded",function(e){e.targetScope.$id===t.$id&&n.$broadcast("msSplashScreen::remove")})}e.$inject=["$scope","$rootScope","msNavigationService","msNavigationAgentService","Auth","license","api","setting"],angular.module("motion").controller("MainController",e)}(),function(){"use strict";function e(e,t,n,a,o,r){var i=this;function s(e){if(e&&e.id){var t=99999+e.id;o.saveItem("apps.dashboards.custom_"+t,{id:t,title:e.name||"NONAME",state:"app.dashboards.custom",stateParams:e,weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(t)&&!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 t=88888+e.id;o.saveItem("apps.plugins.plugin_"+t,{id:t,title:e.name||"NONAME",state:"app.plugins.plugin",stateParams:e,weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(t)&&!r.hasRole("admin")}}),o.sort()}}else{t=88888+e.id;n=1900,a=t,i=o.getNavigation(),(s=_.find(i[0].children,{id:n}))&&_.some(s.children,{id:a})&&("always"==e.sidebar||"adminOnly"==e.sidebar)&&(o.deleteItem("apps.plugins.plugin_"+t),d(1900)||o.saveItem("apps.plugins",{id:1900,title:"Plugins",translate:"PLUGINS.PLUGINS",icon:"icon-apps",weight:17,hidden:function(){return!0}}))}var n,a,i,s}function d(e){var t=o.getNavigation(),n=_.find(t[0].children,{id:e});return!!(n&&0<n.children.length)}i.bodyEl=angular.element("body"),i.msScrollOptions={suppressScrollX:!0},i.setting=n,i.$onInit=function(){i.folded="true"===t.get("motion.folded")||!1},i.toggleMsNavigationFolded=function(){i.folded=!i.folded,t.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 t=99999+e.id;o.deleteItem("apps.dashboards.custom_"+t)}}),a.on("plugin:save",l),a.on("plugin:update",l),a.on("plugin:remove",function(e){if(e&&e.id&&"never"!=e.sidebar){var t=88888+e.id;"always"!=e.sidebar&&"adminOnly"!=e.sidebar||(o.deleteItem("apps.plugins.plugin_"+t),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,t,n,s,o,r){var l=this;function d(n){o.isSupported()?o.requestPermission().then(function(){var e,t;t={autoClose:!0,duration:10,showOnPageHidden:!0,icon:"api/users/"+(e=n).FromId+"/avatar",body:e.body||"",focusOnclick:!0,closeOnClick:!0},o.show(a.instant("QUICKPANEL.NEW_INTERNAL_MESSAGE"),t)},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=t.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--},n.on("chatInternalMessage:save",l.onMessageSave),n.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 t=[],n=e.rows,a=0;a<n.length;a++)t.push(s.chatGroup.getUnread({id:n[a].id}).$promise);return i.all(t)}).then(function(e){for(var t=0;t<e.length;t++)l.unreadTotalGroupMessages+=e[t].count}).catch(function(e){console.error(e)}),e.$on("$destroy",function(){n.removeAllListeners("chatInternalMessage:save"),n.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(e,t,n,a,i,s,o,r,l,d,c,m){var u=this;function p(e){var t=angular.element("#chat-dialog");a(function(){t.animate({scrollTop:t[0].scrollHeight},e)},0)}function g(e){return _.isNil(e)?"":e.replace(/[^\w.+#*\-]+/g,"")}function v(e){return m.get(e).success(function(){t.success({title:"Successful call",msg:"Call properly handled!"})}).error(function(e){t.error({title:"PhoneBar API Error",msg:d.instant("CONTACTMANAGER.ERRORS.PHONEBAR_API")})})}u.currentUser=i.getCurrentUser(),u.user=void 0,u.users={count:0,rows:[]},u.standardDate=moment(0).format("YYYY-MM-DD HH:mm:ss"),u.unreadMessage={},u.replyMessage="",u.disabled=!1,u.init=function(e){u.license=e},u.toggleChat=function(e){if(e){if(!e.allowmessenger&&"agent"===e.role)return t.warning({title:d.instant("QUICKPANEL.WARNING"),msg:d.instant("QUICKPANEL.MESSENGER_DISABLED")}),void(u.user=void 0);u.user=e,u.replyMessage="",n.chatInternalMessage.get({sort:"createdAt",FromId:u.currentUser.id+","+e.id,ToId:u.currentUser.id+","+e.id,ChatGroupId:"null"}).$promise.then(function(e){if(e&&e.rows){u.user.messages=e;for(var t=0;t<u.user.messages.rows.length;t+=1)!1===u.user.messages.rows[t].read&&u.user.messages.rows[t].ToId===u.currentUser.id&&n.chatInternalMessage.update({id:u.user.messages.rows[t].id,read:!0})}}).finally(function(){p(0)})}else u.user=void 0},u.reply=function(){u.disabled=!0;Date.now();if(""===u.replyMessage)return void(u.disabled=!1);var e={FromId:u.currentUser.id,ToId:u.user.id,body:u.replyMessage,read:!1};u.replyMessage="",n.chatInternalMessage.save(e).$promise.then(function(e){u.user.messages.rows.push(e),u.user.lastMessageAt=e.createdAt,u.user.lastMessage=e,p(400)}).catch(function(e){}).finally(function(){u.disabled=!1})},u.onMessageSave=function(e){if(e.ToId===u.currentUser.id&&!e.ChatGroupId){u.user&&u.user.id===e.FromId?(u.user.messages.rows.push(e),p(0),n.chatInternalMessage.update({id:e.id,read:!0})):u.unreadMessage[e.FromId]=u.unreadMessage[e.FromId]?u.unreadMessage[e.FromId]+1:1;var t=_.find(u.users.rows,{id:e.FromId});t&&(t.lastMessageAt=e.createdAt,t.lastMessage=e)}},u.onMessageUpdate=function(e){if((e.FromId===u.currentUser.id||e.ToId===u.currentUser.id)&&!e.ChatGroupId){if(u.user){var t=_.find(u.user.messages.rows,{id:e.id});t&&_.merge(t,e)}var n=_.find(u.users.rows,{id:u.currentUser.id===e.FromId?e.ToId:e.FromId});n&&n.lastMessage&&_.merge(n.lastMessage,e),e.ToId===u.currentUser.id&&e.read&&0<u.unreadMessage[e.FromId]&&(u.unreadMessage[e.FromId]-=1)}},u.onUserUpdate=function(e){var t=_.find(u.users.rows,{id:e.id});t&&(_.isNil(e.online)||t.online===e.online||(t.online=e.online),_.isNil(e.allowmessenger)||t.allowmessenger===e.allowmessenger||(t.allowmessenger=e.allowmessenger))},u.webcall=function(e){c.$broadcast("webrtc::call",{target:g(e)})},u.call=function(e){return v("http://127.0.0.1:"+(u.user.phoneBarRemoteControlPort||"9888")+"/api/originate/"+g(e))},u.transfer=function(e){return v("http://127.0.0.1:"+(u.user.phoneBarRemoteControlPort||"9888")+"/api/transfer?number="+g(e))},s.on("chatInternalMessage:save",u.onMessageSave),s.on("chatInternalMessage:update",u.onMessageUpdate),s.on("user:update",u.onUserUpdate),o("quick-panel").onClose(function(){u.user=void 0}),n.chatInternalMessage.get({fields:"FromId",ToId:u.currentUser.id,read:!1,nolimit:!0,ChatGroupId:"null"}).$promise.then(function(e){u.unreadMessage=_.countBy(e.rows,"FromId")}).catch(function(e){}),n.chatInternalMessage.getUsers().$promise.then(function(e){u.users=e}).catch(function(e){console.error(e)}),e.$on("$destroy",function(){s.removeAllListeners("chatInternalMessage:save"),s.removeAllListeners("chatInternalMessage:update"),s.removeAllListeners("user:update")})}e.$inject=["$scope","toasty","api","$timeout","Auth","socket","$mdSidenav","$q","$interval","$translate","$rootScope","$http"],angular.module("app.quick-panel").controller("ChatInternalController",e)}(),function(){"use strict";function e(e,t,n,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 n;return d.errors=[],s.chatGroup.save({name:d.group.name,write:d.group.write}).$promise.then(function(e){var t=_.map(d.group.members,"id");return t.unshift(d.currentUser.id),n=e,s.chatGroup.addMembers({id:n.id,ids:t}).$promise}).then(function(){i.success({title:"Group properly saved!",msg:n.name+" has been saved!"}),c(n)}).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((t=e,n=angular.lowercase(t),function(e){var t=e.name.toLowerCase();return-1!=t.indexOf(n)})):[];var t,n}}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,n,a,s,t,o,i,r,l,d){var c=this;function m(){delete c.group}function u(e){var t=angular.element("#chat-group-dialog");a(function(){t.animate({scrollTop:t[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 t=0,n=[];t<e.rows.length;t++)e.rows[t].unreadGroupMessages=0,c.groups[e.rows[t].id]=e.rows[t],n.push(r.chatGroup.getUnread({id:e.rows[t].id}).$promise);return o.all(n)}).then(function(e){for(var t=0;t<e.length;t++)c.groups[e[t].id].unreadGroupMessages+=e[t].count}).catch(function(e){console.error(e)})},c.back=m,c.addGroup=function(e,t){s.show({controller:"CreateOrEditChatGroupDialogController",controllerAs:"vm",templateUrl:"app/quick-panel/tabs/groups/create/dialog.html",parent:angular.element(n.body),targetEvent:t,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,t){var n=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(t).ok("OK").cancel("CANCEL");s.show(n).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(n.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 t=[];a.messages=e.rows,a.messages.unshift(i);for(var n=0;n<a.messages.length;n++)t.push(r.user.get({id:a.messages[n].ToId,fields:"id,name,fullname,userpic"}).$promise);return o.all(t)}).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(t){c.group={id:t.id,write:t.write,messages:{}},r.chatGroup.getMembers({id:t.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:t.id,nolimit:!0}).$promise}).then(function(e){for(var t,n=0,a=[];n<e.count;n++)e.rows[n].ToId===c.currentUser.id&&(t=e.rows[n],c.group.messages[t.id]=t,e.rows[n].ToId!=c.currentUser.id||e.rows[n].FromId===c.currentUser.id||t.read||a.push(r.chatInternalMessage.update({id:t.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 n={id:c.group.id,FromId:c.currentUser.id,ToId:c.currentUser.id,body:c.replyMessage,read:!0},a=[];c.replyMessage="",r.chatGroup.addMessage(n).$promise.then(function(e){n.read=!1,n.ChatInternalMessageId=e.id;for(var t=0;t<c.group.members.length;t++)c.group.members[t].id!==c.currentUser.id&&(n.ToId=c.group.members[t].id,a.push(r.chatGroup.addMessage(angular.copy(n)).$promise));return o.all(a)}).catch(function(e){console.log(e)})},l.on("chatInternalMessage:save",function(t){if(!c.group&&t.ToId===c.currentUser.id&&t.FromId!==c.currentUser.id&&!t.read&&t.ChatGroupId){var e=c.groups[t.ChatGroupId];if(!e)return r.chatGroup.get({id:t.ChatGroupId}).$promise.then(function(e){e.unreadGroupMessages=1,c.groups[e.id]=e});e.unreadGroupMessages||(e.unreadGroupMessages=0),e.unreadGroupMessages++}c.group&&t.ChatGroupId===c.group.id&&t.ToId===c.currentUser.id&&r.chatInternalMessage.update({id:t.id,read:!0}).$promise.then(function(){var e;e=t,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]}),t("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,t,n,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,t,n,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(){t.success({title:n.instant("RESETPASSWORD.PASSWORD_RESET"),msg:n.instant("RESETPASSWORD.PASSWORD_RESET_MESSAGE")}),a.go("app.login")}).catch(function(e){e&&t.error({title:n.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&&t.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,t,n,a,i,s){var o=this;function r(){e.hide()}o.errors=[],o.user=a,o.setting=i,o.reset=s,o.passwordPattern=o.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",o.savePassword=function(){o.errors=[],n.user.changePassword({id:o.user.id},{oldPassword:o.oldPassword,newPassword:o.password}).$promise.then(function(){t.show(t.simple().textContent("Your password properly updated").position("top right").hideDelay(5e3)),r()}).catch(function(e){console.error(e),o.errors=e.data.errors&&e.data.errors.length?e.data.errors:[{message:e.data.message||"Authorization error",type:"api.user.changePassword"}]})},o.closeDialog=r}e.$inject=["$mdDialog","$mdToast","api","user","setting","reset"],angular.module("app.toolbar").controller("ChangePasswordController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r){var l=this;function d(e){_.isNil(e)&&s.cmHopper.update({id:l.preview.id,UserId:null}),a.hide()}l.customFieldsMap=r&&r.rows?_.mapValues(_.keyBy(r.rows,function(e){return"cf_"+e.id}),"name"):{},l.errors=[],l.hopperIds=[],l.preview=o,l.originated=!1,l.disable=!1,l.disableGetContact=!1,l.hopperIds.push(l.preview.id),l.originatePreview=function(){l.originated=!0,l.disable=!0,_.isEmpty(l.preview)?(i.error({title:"Message",msg:"Contact not available"}),l.disable=!1,l.hopperIds=[],d(!0)):s.rpc.getVoiceQueuesPreview({id:l.preview.id}).$promise.then(function(e){d(!0)}).catch(function(e){i.error({title:"Message",msg:e.data}),d(!0)}).finally(function(){l.disable=!1,l.hopperIds=[]})},l.closeDialog=d,l.nextContact=function(){return l.disableGetContact=!0,s.cmHopper.getPreview({hopperIds:l.hopperIds,direction:"next"}).$promise.then(function(e){l.disableGetContact=!1,_.isNil(e)||_.isNil(e.Queue)||!e.Queue.dialActive?(l.hopperIds=[],a.hide(),i.info({title:"PREVIEW",msg:"CAMPAIGN NOT ACTIVE"})):(l.originated||s.cmHopper.update({id:l.preview.id,UserId:null}),l.preview=e,l.hopperIds.push(l.preview.id))}).catch(function(e){if(l.disableGetContact=!1,l.hopperIds=[],404===e.status)l.getFirstAvailableContact();else if(e.data&&e.data.errors&&e.data.errors.length){a.hide();for(var t=0;t<e.data.errors.length;t+=1)i.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else a.hide(),i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api preview",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},l.previousContact=function(){if(l.disableGetContact=!0,1<l.hopperIds.length){var e=_.without(l.hopperIds,l.preview.id);return s.cmHopper.getPreview({hopperIds:e,direction:"prev"}).$promise.then(function(e){l.disableGetContact=!1,_.isNil(e)||_.isNil(e.Queue)||!e.Queue.dialActive?(l.hopperIds=[],a.hide(),i.info({title:"PREVIEW",msg:"CAMPAIGN NOT ACTIVE"})):(_.remove(l.hopperIds,function(e){return e==l.preview.id}),l.originated||s.cmHopper.update({id:l.preview.id,UserId:null}),l.preview=e)}).catch(function(e){if(404===e.status)l.hopperIds=[l.preview.id],i.info({title:"PREVIEW",msg:"PREVIOUS CONTACTS NOT AVAILABLE"});else if(e.data&&e.data.errors&&e.data.errors.length){l.hopperIds=[],a.hide();for(var t=0;t<e.data.errors.length;t+=1)i.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else l.hopperIds=[],a.hide(),i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api preview",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}},l.getFirstAvailableContact=function(){return l.disableGetContact=!0,i.info({title:"PREVIEW",msg:"CONTACTS NOT AVAILABLE. REWINDING THE LIST"}),s.cmHopper.getPreview({hopperIds:[l.preview.id],direction:"next"}).$promise.then(function(e){_.isNil(e)||_.isNil(e.Queue)||!e.Queue.dialActive?(a.hide(),i.info({title:"PREVIEW",msg:"CAMPAIGN NOT ACTIVE"})):(l.originated||s.cmHopper.update({id:l.preview.id,UserId:null}),l.preview=e,l.hopperIds.push(l.preview.id))}).catch(function(e){if(a.hide(),404===e.status)i.info({title:"PREVIEW",msg:"CONTACTS NOT AVAILABLE"});else if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)i.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api preview",msg:e.data?JSON.stringify(e.data.message):e.toString()})}).finally(function(){l.disableGetContact=!1})},l.isCustomField=function(e){return _.startsWith(e,"cf_")},l.isHiddenField=function(e){return _.includes(["Company","CompanyId","ListId","UserId","createdAt","deletedAt","id","priority","scheduledat","tags","updatedAt","facebook","twitter","skype","wechat","teams","viber","line","telegram"],e)},l.isNil=function(e){return _.isNil(e)},e.$on("$destroy",function(){l.originated||s.cmHopper.update({id:l.preview.id,UserId:null})})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","api","preview","customFields"],angular.module("app.toolbar").controller("PreviewDialogController",e)}(),function(){"use strict";function e(e,t,s,n,o,a,i,r,l,d,c,m,u,p,g,v,h,f,b,E,A){var y,S=this;function T(e){S.voiceQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{}}function I(){S.promise=f.user.getQueues(S.query,T).$promise}function C(e){return v.logout(e).then(function(){return h.disconnect(),t.$broadcast("webrtc::logout"),n.go("app.login")}).catch(function(e){console.error(e)})}function w(e,t){c.show({controller:"ChangePasswordController",controllerAs:"vm",templateUrl:"app/toolbar/changepassword/changepassword.html",parent:angular.element(m.body),targetEvent:e,clickOutsideToClose:!t,locals:{user:S.user,setting:E,reset:t}})}S.voiceQueues={},S.polling=!0,t.global={search:""},S.pauses=[],S.license=b,S.currentUser=v.getCurrentUser(),S.unreadTotalMessages=0,S.unreadTotalGroupMessages=0,S.contcts=0,"agent"===S.currentUser.role&&(y=A(function(){_.some(S.voiceQueues,{dialMethod:"preview",dialActive:!0})&&S.license.dialer&&S.polling?(S.polling=!1,f.cmHopper.getOpenContacts().$promise.then(function(e){e&&_.isNumber(e.contacts)&&(S.contacts=e.contacts)}).finally(function(){S.polling=!0})):S.contacts=0},14999)),S.setting=E,S.bodyEl=angular.element("body"),S.conf={realm:"asterisk",host:a.host(),protocol:a.protocol(),remotePlayerId:"remote-audio",ua:"Motion WebRTC Bar 0.2.0",license:S.license.webrtc,phoneBarExpires:S.currentUser.phoneBarExpires,phoneBarPrefixRequired:S.currentUser.phoneBarPrefixRequired},S.query={id:v.getCurrentUser().id,fields:"id,name,type,dialMethod,dialActive",channel:"voice",nolimit:!0},S.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"}],S.languages={ar:{title:"Arabic",translation:"TOOLBAR.ARABIC",code:"ar",flag:"ar"},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"},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"},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"}},S.toggleSidenav=function(e){i(e).toggle()},S.logout=C,S.changeLanguage=function(e){if(!S.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"})}S.selectedLanguage=e,u.put("motion.language",e.code),r.use(e.code),"app.callysquare.projects.edit"===n.current.name&&d.location.reload()},S.setUserStatus=function(e){S.userStatus=e},S.toggleHorizontalMobileMenu=function(){S.bodyEl.toggleClass("ms-navigation-horizontal-mobile-menu-active")},S.toggleMsNavigationFolded=function(){g.toggleFolded()},S.search=function(t){for(var e=[],n=g.getFlatNavigation(),a=s.defer(),i=0;i<n.length;i++)n[i].uisref&&e.push(n[i]);t&&(e=e.filter(function(e){if(-1<angular.lowercase(e.title).search(angular.lowercase(t)))return!0}));return o(function(){a.resolve(e)},1e3),a.promise},S.searchResultClick=function(e){e.uisref&&(e.stateParams?n.go(e.state,e.stateParams):n.go(e.state))},S.openSettings=function(e){t.$broadcast("webrtc::settings")},S.changePassword=w,S.isAgent=function(){return v.getCurrentUser()&&v.hasRole("agent")},S.onUserUpdate=function(e){if(e.id===S.user.id)if("agent"===e.role&&_.isBoolean(e.online)&&!e.online)if(0!==S.user.showWebBar){var t=c.confirm().title(r.instant("TOOLBAR.WARNING")+"!").textContent(r.instant("TOOLBAR.SOMEONE_LOGGED_YOU_OUT")).ariaLabel(r.instant("TOOLBAR.WARNING")+"!").ok(r.instant("TOOLBAR.STAY_LOGGED")).cancel("Logout");c.show(t).then(function(){v.queueLogin()}).catch(function(e){C(!0)}).finally(function(){_.merge(S.user,e),v.updateCurrentUser(S.user)})}else C(!0),_.merge(S.user,e),v.updateCurrentUser(S.user);else _.merge(S.user,e),v.updateCurrentUser(S.user)},S.onUserCalled=function(e){2===S.currentUser.showWebBar&&"agent"===S.currentUser.role&&S.currentUser.name===e.membername&&p.info({title:"WebRTC Popup",msg:"<div>                    <span>Call from: "+e.calleridnum+"</span><br>                    <span>Queue: "+e.queue+"</span><br>                    <span>Extra: "+(e.variables&&e.variables.extravar?e.variables.extravar:"Not defined")+"</span><br>                    </div>",showClose:!0,timeout:1e4,html:!0})},S.pause=function(e){return f.user.pause({id:S.user.id,type:e||"DEFAULT PAUSE"}).$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()})})},S.unpause=function(){return f.user.unpause({id:S.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()})})},S.preview=function(t){return S.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"}):c.show({controller:"PreviewDialogController",controllerAs:"vm",templateUrl:"app/toolbar/preview/dialog.html",parent:angular.element(m.body),targetEvent:t,clickOutsideToClose:!0,locals:{preview:e},resolve:{customFields:["apiResolver",function(e){return e.resolve("cmCustomField@get",{nolimit:!0})}]}})}).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){S.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelMessage.accept"}];for(var t=0;t<e.data.errors.length;t+=1)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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(){S.disable=!1})},S.getLogo=function(){return S.setting.defaultHeaderWhiteLabel?"xCALLY Motion":S.setting.headerWhiteLabel},S.userIsNotPhonebar=function(){return"admin"===S.currentUser.role||"user"===S.currentUser.role||"agent"===S.currentUser.role&&0!==S.currentUser.showWebBar},S.onInternalMessageSave=function(e){e.ToId!==S.currentUser.id||e.ChatGroupId||(S.unreadTotalMessages+=1);e.ToId===S.currentUser.id&&e.FromId!==S.currentUser.id&&!e.read&&e.ChatGroupId&&S.unreadTotalGroupMessages++},S.onInternalMessageUpdate=function(e){e.ToId===S.currentUser.id&&e.read&&0<S.unreadTotalMessages&&!e.ChatGroupId&&(S.unreadTotalMessages-=1);e.ToId===S.currentUser.id&&e.read&&e.ChatGroupId&&0<S.unreadTotalGroupMessages&&S.unreadTotalGroupMessages--},S.onUserVoiceQueue=function(e){_.toInteger(e.UserId)===v.getCurrentUser().id&&I()},S.onVoiceQueue=function(e){I()},h.connect(),h.on("user:update",S.onUserUpdate),h.on("user:called",S.onUserCalled),h.on("chatInternalMessage:save",S.onInternalMessageSave),h.on("chatInternalMessage:update",S.onInternalMessageUpdate),h.on("userVoiceQueue:save",S.onUserVoiceQueue),h.on("voiceQueue:save",S.onVoiceQueue),h.on("userVoiceQueue:remove",S.onUserVoiceQueue),h.on("voiceQueue:remove",S.onVoiceQueue),h.on("voiceQueue:update",S.onVoiceQueue),function(){S.user=v.getCurrentUser(),S.conf.ha1=S.user.md5secret,S.conf.id=S.user.id,S.conf.name=S.user.name,S.conf.fullname=S.user.fullname,S.conf.internal=S.user.internal,S.conf.recording=S.user.phoneBarEnableRecording,S.conf.autoAnswer=S.user.phoneBarAutoAnswer,S.conf.enableSettings=S.user.phoneBarEnableSettings,S.conf.enableDtmfTone=S.user.phoneBarEnableDtmfTone,S.conf.autoAnswerDelay=S.user.phoneBarAutoAnswerDelay,S.userStatus=S.userStatusOptions[0];var e=u.get("motion.language");e&&S.languages.hasOwnProperty(e)?S.selectedLanguage=S.languages[e]:S.selectedLanguage=S.languages[r.preferredLanguage()];if(f.pause.get({fields:"name",nolimit:!0}).$promise.then(function(e){S.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()})}),S.setting.securePassword)if(S.user.passwordResetAt){var t=moment(S.user.passwordResetAt).add(S.setting.passwordExpiresDays||90,"day");moment().isAfter(t)?w(null,!0):moment().add(15,"day").isAfter(t)&&p.warning({title:r.instant("TOOLBAR.WARNING")+"!",msg:r.instant("TOOLBAR.PASSWORD_EXPIRE_REMAINING_DAYS")+": "+Math.ceil(t.diff(moment(),"days",!0)),timeout:2e4})}else w(null,!0)}(),I(),f.chatInternalMessage.get({fields:"FromId",ToId:S.currentUser.id,read:!1,nolimit:!0}).$promise.then(function(e){S.unreadTotalMessages=e.rows.length}),e.$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"),y&&(A.cancel(y),y=null)})}e.$inject=["$scope","$rootScope","$q","$state","$timeout","$location","$mdSidenav","$translate","$mdToast","$window","$mdDialog","$document","$cookies","toasty","msNavigationService","Auth","socket","api","license","setting","$interval"],angular.module("app.toolbar").controller("ToolbarController",e)}();var urlParams=function(e){var t=new Object,n=e.lastIndexOf("?");if(0<n)for(var a=e.substring(n+1).split("&"),i=0;i<a.length;i++)0<(n=a[i].indexOf("="))&&(t[a[i].substring(0,n)]=a[i].substring(n+1));return t}(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-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,t,n){if(n=n||document,mxClient.IS_IE6)n.write('<link rel="'+e+'" href="'+t+'" charset="ISO-8859-1" type="text/css"/>');else{var a=n.createElement("link");a.setAttribute("rel",e),a.setAttribute("href",t),a.setAttribute("charset","ISO-8859-1"),a.setAttribute("type","text/css"),n.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,t=document.createElement("table");t.setAttribute("width","100%"),t.setAttribute("height","100%");var n=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),n.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),n.appendChild(a),t.appendChild(n),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=n=0,a="number"==typeof window.innerWidth?(n=window.innerHeight,window.innerWidth):(n=document.documentElement.clientHeight||document.body.clientHeight,document.body.clientWidth),mxLog.window=new mxWindow(e,t,Math.max(0,a-320),Math.max(0,n-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,t){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,t){var n=document.createElement("button");mxUtils.write(n,e),mxEvent.addListener(n,"click",t),mxLog.td.appendChild(n)},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,t){if(mxLog.TRACE){var n=0!=t?" ("+((new Date).getTime()-t)+" ms)":"";mxLog.writeln("Leaving "+e+n)}},debug:function(){mxLog.DEBUG&&mxLog.writeln.apply(this,arguments)},warn:function(){mxLog.WARN&&mxLog.writeln.apply(this,arguments)},write:function(){for(var e="",t=0;t<arguments.length;t++)e+=arguments[t],t<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="",t=0;t<arguments.length;t++)e+=arguments[t],t<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 t=mxUtils.getFunctionName(e.constructor);e[mxObjectIdentity.FIELD_NAME]=t+"#"+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,t){var n=mxObjectIdentity.get(e),a=this.map[n];return this.map[n]=t,a},mxDictionary.prototype.remove=function(e){e=mxObjectIdentity.get(e);var t=this.map[e];return delete this.map[e],t},mxDictionary.prototype.getKeys=function(){var e,t=[];for(e in this.map)t.push(e);return t},mxDictionary.prototype.getValues=function(){var e,t=[];for(e in this.map)t.push(this.map[e]);return t},mxDictionary.prototype.visit=function(e){for(var t in this.map)e(t,this.map[t])};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,t){return mxResources.loadDefaultBundle||!mxResources.isLanguageSupported(t)?e+mxResources.extension:null},getSpecialBundle:function(e,t){if(null==mxClient.languages||!this.isLanguageSupported(t)){var n=t.indexOf("-");0<n&&(t=t.substring(0,n))}return mxResources.loadSpecialBundle&&mxResources.isLanguageSupported(t)&&t!=mxClient.defaultLanguage?e+"_"+t+mxResources.extension:null},add:function(e,t){if((t=null!=t?t:mxClient.language.toLowerCase())!=mxConstants.NONE){var n=mxResources.getDefaultBundle(e,t);if(null!=n)try{var a=mxUtils.load(n);a.isReady()&&mxResources.parse(a.getText())}catch(e){}if(null!=(n=mxResources.getSpecialBundle(e,t)))try{(a=mxUtils.load(n)).isReady()&&mxResources.parse(a.getText())}catch(e){}}},parse:function(e){if(null!=e){e=e.split("\n");for(var t=0;t<e.length;t++)if("#"!=e[t].charAt(0)){var n=e[t].indexOf("=");if(0<n){var a=e[t].substring(0,n),i=e[t].length;13==e[t].charCodeAt(i-1)&&i--,n=e[t].substring(n+1,i),this.resourcesEncoded?(n=n.replace(/\\(?=u[a-fA-F\d]{4})/g,"%"),mxResources.resources[a]=unescape(n)):mxResources.resources[a]=n}}}},get:function(e,t,n){if(null==(e=mxResources.resources[e])&&(e=n),null!=e&&null!=t){n=[];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<t.length&&n.push(t[a]),a=null):null!=a?a+=s:n.push(s)}e=n.join("")}return e}};function mxPoint(e,t){this.x=null!=e?e:0,this.y=null!=t?t:0}function mxRectangle(e,t,n,a){mxPoint.call(this,e,t),this.width=null!=n?n: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,t,n,a){this.x=e,this.y=t,this.width=n,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 t=Math.min(this.x,e.x),n=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=t,this.y=n,this.width=a-t,this.height=e-n}},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,t=0;t<d.length;t++){var n=d[t];if(n instanceof mxGeometryChange||n instanceof mxTerminalChange||n instanceof mxValueChange||n instanceof mxChildChange||n instanceof mxStyleChange){var a=l.getView().getState(n.cell||n.child,!1);if(null!=a)if(e=!0,n.constructor!=mxGeometryChange||l.model.isEdge(n.cell))mxUtils.setOpacity(a.shape.node,100*m/10);else{var i=l.getView().scale,s=(n.geometry.x-n.previous.x)*i,o=(n.geometry.y-n.previous.y)*i,r=(n.geometry.width-n.previous.width)*i;i=(n.geometry.height-n.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,n.cell,100*m/10)}}}m<10&&e?(m++,window.setTimeout(u,p)):null!=c&&c()},p=30;u()},cascadeOpacity:function(e,t,n){for(var a=e.model.getChildCount(t),i=0;i<a;i++){var s=e.model.getChildAt(t,i),o=e.getView().getState(s);null!=o&&(mxUtils.setOpacity(o.shape.node,n),mxEffects.cascadeOpacity(e,s,n))}if(null!=(t=e.model.getEdges(t)))for(i=0;i<t.length;i++)null!=(a=e.getView().getState(t[i]))&&mxUtils.setOpacity(a.shape.node,n)},fadeOut:function(e,t,n,a,i,s){a=a||40,i=i||30;var o=t||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",n&&e.parentNode&&e.parentNode.removeChild(e))};window.setTimeout(r,i)}else e.style.visibility="hidden",n&&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 t=e.length,n=0;n<t;n+=1)mxUtils.removeCursors(e[n])},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,t){return function(){return t.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,t,n){var a=e.getAttribute(t);if(null!=a&&a==n)return e;for(e=e.firstChild;null!=e;){if(null!=(a=mxUtils.findNode(e,t,n)))return a;e=e.nextSibling}return null},findNodeByAttribute:9<=document.documentMode?function(e,t,n){var a=null;if(null!=e)if(e.nodeType==mxConstants.NODETYPE_ELEMENT&&e.getAttribute(t)==n)a=e;else for(e=e.firstChild;null!=e&&null==a;)a=mxUtils.findNodeByAttribute(e,t,n),e=e.nextSibling;return a}:mxClient.IS_IE?function(e,t,n){return null==e?null:e.ownerDocument.selectSingleNode("//*[@"+t+"='"+n+"']")}:function(e,t,n){return null==e?null:e.ownerDocument.evaluate("//*[@"+t+"='"+n+"']",e.ownerDocument,null,XPathResult.ANY_TYPE,null).iterateNext()},getFunctionName:function(e){var t=null;if(null!=e)if(null!=e.name)t=e.name;else{for(e=e.toString(),t=9;" "==e.charAt(t);)t++;var n=e.indexOf("(",t);t=e.substring(t,n)}return t},indexOf:function(e,t){if(null!=e&&null!=t)for(var n=0;n<e.length;n++)if(e[n]==t)return n;return-1},remove:function(e,t){var n=null;if("object"==typeof t)for(var a=mxUtils.indexOf(t,e);0<=a;)t.splice(a,1),n=e,a=mxUtils.indexOf(t,e);for(var i in t)t[i]==e&&(delete t[i],n=e);return n},isNode:function(e,t,n,a){return!(null==e||isNaN(e.nodeType)||null!=t&&e.nodeName.toLowerCase()!=t.toLowerCase())&&(null==n||e.getAttribute(n)==a)},getChildNodes:function(e,t){t=t||mxConstants.NODETYPE_ELEMENT;for(var n=[],a=e.firstChild;null!=a;)a.nodeType==t&&n.push(a),a=a.nextSibling;return n},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 t=mxUtils.createXmlDocument();return t.async="false",t.loadXML(e),t}: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,t,n){var a=[];if(null!=e)if(t=t||"  ",n=n||"",e.nodeType==mxConstants.NODETYPE_TEXT)a.push(e.nodeValue);else{a.push(n+"<"+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,t,n+t)),i=i.nextSibling;a.push(n+"</"+e.nodeName+">\n")}else a.push("/>\n")}return a.join("")},removeWhitespace:function(e,t){for(var n=t?e.previousSibling:e.nextSibling;null!=n&&n.nodeType==mxConstants.NODETYPE_TEXT;){var a=t?n.previousSibling:n.nextSibling,i=mxUtils.getTextContent(n);0==mxUtils.trim(i).length&&n.parentNode.removeChild(n),n=a}},htmlEntities:function(e,t){return e=(e=(e=(e=(e=(e||"").replace(/&/g,"&amp;")).replace(/"/g,"&quot;")).replace(/\'/g,"&#39;")).replace(/</g,"&lt;")).replace(/>/g,"&gt;"),(null==t||t)&&(e=e.replace(/\n/g,"&#xa;")),e},isVml:function(e){return null!=e&&"urn:schemas-microsoft-com:vml"==e.tagUrn},getXml:function(e,t){var n="";return null!=e&&(n=null==(n=e.xml)?e.innerHTML?e.innerHTML:(new XMLSerializer).serializeToString(e):n.replace(/\r\n\t[\t]*/g,"").replace(/>\r\n/g,">").replace(/\r\n/g,"\n")),n.replace(/\n/g,t||"&#xa;")},getTextContent:function(e){var t="";return null!=e&&(null!=e.firstChild&&(e=e.firstChild),t=e.nodeValue||""),t},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 t=[];t.push("<"+e.nodeName);var n=e.attributes;if(null!=n)for(var a=0;a<n.length;a++){var i=n[a].nodeValue;null!=i&&0<i.length&&(t.push(" "),t.push(n[a].nodeName),t.push('="'),t.push(i),t.push('"'))}return 0==e.innerHTML.length?t.push("/>"):(t.push(">"),t.push(e.innerHTML),t.push("</"+e.nodeName+">")),t.join("")}:function(e){return null!=e?(new XMLSerializer).serializeToString(e):""},write:function(e,t){var n=e.ownerDocument.createTextNode(t);return null!=e&&e.appendChild(n),n},writeln:function(e,t){var n=e.ownerDocument.createTextNode(t);return null!=e&&(e.appendChild(n),e.appendChild(document.createElement("br"))),n},br:function(e,t){t=t||1;for(var n=null,a=0;a<t;a++)null!=e&&(n=e.ownerDocument.createElement("br"),e.appendChild(n));return n},button:function(e,t,n){return n=(n=null!=n?n:document).createElement("button"),mxUtils.write(n,e),mxEvent.addListener(n,"click",function(e){t(e)}),n},para:function(e,t){var n=document.createElement("p");return mxUtils.write(n,t),null!=e&&e.appendChild(n),n},addTransparentBackgroundFilter:function(e){e.style.filter+="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+mxClient.imageBasePath+"/transparent.gif', sizingMethod='scale')"},linkAction:function(e,t,n,a,i){return mxUtils.link(e,t,function(){n.execute(a)},i)},linkInvoke:function(e,t,n,a,i,s){return mxUtils.link(e,t,function(){n[a](i)},s)},link:function(e,t,n,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",n),mxUtils.write(i,t),null!=e&&e.appendChild(i),i},fit:function(e){var t=parseInt(e.offsetLeft),n=parseInt(e.offsetWidth),a=document.body,i=document.documentElement,s=(a.scrollLeft||i.scrollLeft)+(a.clientWidth||i.clientWidth);s<t+n&&(e.style.left=Math.max(a.scrollLeft||i.scrollLeft,s-n)+"px"),t=parseInt(e.offsetTop),n=parseInt(e.offsetHeight),(s=(a.scrollTop||i.scrollTop)+Math.max(a.clientHeight||0,i.clientHeight))<t+n&&(e.style.top=Math.max(a.scrollTop||i.scrollTop,s-n)+"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 t=Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);return t.initWithPath(e),t.exists()?((e=Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream)).init(t,1,4,null),(t=Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance(Components.interfaces.nsIScriptableInputStream)).init(e),t.read(t.available())):(mxUtils.alert("File not found."),"")}return e=(t=new ActiveXObject("Scripting.FileSystemObject").OpenTextFile(e,1)).readAll(),t.close(),e},save:function(e,t){if(mxClient.IS_NS){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")}catch(e){return void mxUtils.alert("Permission to write file denied.")}var n=Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);n.initWithPath(e),n.exists()||n.create(0,420);var a=Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);a.init(n,34,4,null),a.write(t,t.length),a.flush(),a.close()}else(n=new ActiveXObject("Scripting.FileSystemObject").CreateTextFile(e,!0)).Write(t),n.Close()},saveAs:function(e){var t=document.createElement("iframe");t.setAttribute("src",""),t.style.visibility="hidden",document.body.appendChild(t);try{if(mxClient.IS_NS){var n=t.contentDocument;n.open(),n.write(e),n.close();try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"),t.focus(),saveDocument(n)}catch(e){mxUtils.alert("Permission to save document denied.")}}else(n=t.contentWindow.document).write(e),n.execCommand("SaveAs",!1,document.location)}finally{document.body.removeChild(t)}},copy:function(e){if(window.clipboardData)window.clipboardData.setData("Text",e);else{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");var t=Components.classes["@mozilla.org/widget/clipboard;1"].createInstance(Components.interfaces.nsIClipboard);if(t){var n=Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);if(n){n.addDataFlavor("text/unicode");var a=Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);a.data=e,n.setTransferData("text/unicode",a,2*e.length),t.setData(n,null,Components.interfaces.nsIClipboard.kGlobalClipboard)}}}},load:function(e){return(e=new mxXmlRequest(e,null,"GET",!1)).send(),e},get:function(e,t,n){return new mxXmlRequest(e,null,"GET").send(t,n)},post:function(e,t,n,a){return new mxXmlRequest(e,t).send(n,a)},submit:function(e,t,n,a){return new mxXmlRequest(e,t).simulate(n,a)},loadInto:function(e,t,n){mxClient.IS_IE?t.onreadystatechange=function(){4==t.readyState&&n()}:t.addEventListener("load",n,!1),t.load(e)},getValue:function(e,t,n){return null==(e=null!=e?e[t]:null)&&(e=n),e},getNumber:function(e,t,n){return null==(e=null!=e?e[t]:null)&&(e=n||0),Number(e)},getColor:function(e,t,n){return null==(e=null!=e?e[t]:null)?e=n:e==mxConstants.NONE&&(e=null),e},clone:function(e,t,n){n=null!=n&&n;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==t||mxUtils.indexOf(t,i)<0)&&(a[i]=n||"object"!=typeof e[i]?e[i]:mxUtils.clone(e[i]))}return a},equalPoints:function(e,t){if(null==e&&null!=t||null!=e&&null==t||null!=e&&null!=t&&e.length!=t.length)return!1;if(null!=e&&null!=t)for(var n=0;n<e.length;n++)if(e[n]==t[n]||null!=e[n]&&!e[n].equals(t[n]))return!1;return!0},equalEntries:function(e,t){if(null==e&&null!=t||null!=e&&null==t||null!=e&&null!=t&&e.length!=t.length)return!1;if(null!=e&&null!=t)for(var n in e)if(e[n]!=t[n])return!1;return!0},extend:function(e,t){var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e},toString:function(e){var t,n="";for(t in e)try{if(null==e[t])n+=t+" = [null]\n";else if("function"==typeof e[t])n+=t+" => [Function]\n";else if("object"==typeof e[t])n=n+(t+" => [")+mxUtils.getFunctionName(e[t].constructor)+"]\n";else n+=t+" = "+e[t]+"\n"}catch(e){n+=t+"="+e.message}return n},toRadians:function(e){return Math.PI*e/180},arcToCurves:function(e,t,n,a,i,s,o,r,l){if(r-=e,l-=t,0===n||0===a)return h;n=Math.abs(n),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=n*n)+(p=d*d)/(E=a*a))?(n*=Math.sqrt(v),a*=Math.sqrt(v),0):(v=1,s===o&&(v=-1),v*Math.sqrt((g*E-g*p-E*c)/(g*p+E*c))))*n*d/a)-h*(p=-1*s*a*i/n)+r/2,l=h*c+m*p+l/2,s=0<=(g=Math.atan2((d-p)/a,(i-c)/n)-Math.atan2(0,1))?g:2*Math.PI+g,i=0<=(g=Math.atan2((-d-p)/a,(-i-c)/n)-Math.atan2((d-p)/a,(i-c)/n))?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*n,m*=a,n*=h,a*=h;for(var u=Math.cos(s),p=-d*(c*(b=Math.sin(s))+a*u),g=-d*(n*b-m*u),v=E=0,h=[],f=0;f<o;++f){s+=i;var b,E=c*(u=Math.cos(s))-a*(b=Math.sin(s))+r,A=(v=n*u+m*b+l,-d*(c*b+a*u));u=-d*(n*b-m*u);h[b=6*f]=Number(p+e),h[b+1]=Number(g+t),h[b+2]=Number(E-A+e),h[b+3]=Number(v-u+t),h[b+4]=Number(E+e),h[b+5]=Number(v+t),p=E+A,g=v+u}return h},getBoundingBox:function(e,t){var n=null;if(null!=e&&null!=t&&0!=t){var a=mxUtils.toRadians(t),i=(n=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,n,i,s),a=mxUtils.getRotatedPoint(a,n,i,s),r=mxUtils.getRotatedPoint(r,n,i,s),l=mxUtils.getRotatedPoint(l,n,i,s);(n=new mxRectangle(o.x,o.y,0,0)).add(new mxRectangle(a.x,a.y,0,0)),n.add(new mxRectangle(r.x,r.y,0,0)),n.add(new mxRectangle(l.x,l.y,0,0))}return n},getRotatedPoint:function(e,t,n,a){a=null!=a?a:new mxPoint;var i=e.x-a.x;return new mxPoint(i*t-(e=e.y-a.y)*n+a.x,e*t+i*n+a.y)},getPortConstraints:function(e,t,n,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,t,n){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,t,n);(null==s||i<s)&&(s=i,a=o-1),i=r}return a},rectangleIntersectsSegment:function(e,t,n){var a=e.y,i=e.x,s=a+e.height,o=i+e.width;e=t.x;var r=n.x;if(t.x>n.x&&(e=n.x,r=t.x),o<r&&(r=o),e<i&&(e=i),r<e)return!1;i=t.y,o=n.y;var l=n.x-t.x;return 1e-7<Math.abs(l)&&(i=(n=(n.y-t.y)/l)*e+(t=t.y-n*t.x),o=n*r+t),o<i&&(t=o,o=i,i=t),s<o&&(o=s),i<a&&(i=a),!(o<i)},contains:function(e,t,n){return e.x<=t&&e.x+e.width>=t&&e.y<=n&&e.y+e.height>=n},intersects:function(e,t){var n=e.width,a=e.height,i=t.width,s=t.height;if(i<=0||s<=0||n<=0||a<=0)return!1;var o=e.x,r=e.y,l=t.x,d=t.y;s+=d,n+=o,a+=r;return((i=i+l)<l||o<i)&&(s<d||r<s)&&(n<o||l<n)&&(a<r||d<a)},intersectsHotspot:function(e,t,n,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()),t=(e=mxUtils.getRotatedPoint(new mxPoint(t,n),i,s,o)).x,n=e.y),mxUtils.contains(a,t,n)}return!0},getOffset:function(e,t){var n=0,a=0;if(null!=t&&t){var i=document.body,s=document.documentElement;n=n+(i.scrollLeft||s.scrollLeft),a=a+(i.scrollTop||s.scrollTop)}for(;e.offsetParent;)n+=e.offsetLeft,a+=e.offsetTop,e=e.offsetParent;return new mxPoint(n,a)},getScrollOrigin:function(e){for(var t=document.body,n=document.documentElement,a=new mxPoint(t.scrollLeft||n.scrollLeft,t.scrollTop||n.scrollTop);null!=e&&e!=t&&e!=n;)!isNaN(e.scrollLeft)&&!isNaN(e.scrollTop)&&(a.x+=e.scrollLeft,a.y+=e.scrollTop),e=e.parentNode;return a},convertPoint:function(e,t,n){var a=mxUtils.getScrollOrigin(e);return(e=mxUtils.getOffset(e)).x-=a.x,e.y-=a.y,new mxPoint(t-e.x,n-e.y)},ltrim:function(e,t){return e.replace(RegExp("^["+(t||"\\s")+"]+","g"),"")},rtrim:function(e,t){return e.replace(RegExp("["+(t||"\\s")+"]+$","g"),"")},trim:function(e,t){return mxUtils.ltrim(mxUtils.rtrim(e,t),t)},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,t){return(e%t+t)%t},intersection:function(e,t,n,a,i,s,o,r){var l=(r-s)*(n-e)-(o-i)*(a-t);return o=((o-i)*(t-s)-(r-s)*(e-i))/l,i=((n-e)*(t-s)-(a-t)*(e-i))/l,0<=o&&o<=1&&0<=i&&i<=1?new mxPoint(e+o*(n-e),t+o*(a-t)):null},ptSegDistSq:function(e,t,n,a,i,s){return n=(i-=e)*(n-=e)+(s-=t)*(a-=t)<=0?0:(e=(i=n-i)*n+(s=a-s)*a)<=0?0:e*e/(n*n+a*a),(i=i*i+s*s-n)<0&&(i=0),i},relativeCcw:function(e,t,n,a,i,s){return 0==(e=(i-=e)*(a-=t)-(s-=t)*(n-=e))&&(0<(e=i*n+s*a)&&((e=(i-n)*n+(s-a)*a)<0&&(e=0))),e<0?-1:0<e?1:0},animateChanges:function(e,t){mxEffects.animateChanges.apply(this,arguments)},cascadeOpacity:function(e,t,n){mxEffects.cascadeOpacity.apply(this,arguments)},fadeOut:function(e,t,n,a,i,s){mxEffects.fadeOut.apply(this,arguments)},setOpacity:function(e,t){mxUtils.isVml(e)?e.style.filter=100<=t?null:"alpha(opacity="+t/5+")":mxClient.IS_IE&&(void 0===document.documentMode||document.documentMode<9)?e.style.filter=100<=t?null:"alpha(opacity="+t+")":e.style.opacity=t/100},createImage:function(e){var t=null;return mxClient.IS_IE6&&"CSS1Compat"!=document.compatMode?((t=document.createElement(mxClient.VML_PREFIX+":image")).setAttribute("src",e),t.style.borderStyle="none"):((t=document.createElement("img")).setAttribute("src",e),t.setAttribute("border","0")),t},sortCells:function(e,i){i=null==i||i;var s=new mxDictionary;return e.sort(function(e,t){var n=s.get(e);null==n&&(n=mxCellPath.create(e).split(mxCellPath.PATH_SEPARATOR),s.put(e,n));var a=s.get(t);return null==a&&(a=mxCellPath.create(t).split(mxCellPath.PATH_SEPARATOR),s.put(t,a)),0==(n=mxCellPath.compare(n,a))?0:0<n==i?1:-1}),e},getStylename:function(e){return null!=e&&(e=e.split(";")[0]).indexOf("=")<0?e:""},getStylenames:function(e){var t=[];if(null!=e){e=e.split(";");for(var n=0;n<e.length;n++)e[n].indexOf("=")<0&&t.push(e[n])}return t},indexOfStylename:function(e,t){if(null!=e&&null!=t)for(var n=e.split(";"),a=0,i=0;i<n.length;i++){if(n[i]==t)return a;a+=n[i].length+1}return-1},addStylename:function(e,t){return mxUtils.indexOfStylename(e,t)<0&&(null==e?e="":0<e.length&&";"!=e.charAt(e.length-1)&&(e+=";"),e+=t),e},removeStylename:function(e,t){var n=[];if(null!=e)for(var a=e.split(";"),i=0;i<a.length;i++)a[i]!=t&&n.push(a[i]);return n.join(";")},removeAllStylenames:function(e){var t=[];if(null!=e){e=e.split(";");for(var n=0;n<e.length;n++)0<=e[n].indexOf("=")&&t.push(e[n])}return t.join(";")},setCellStyles:function(e,t,n,a){if(null!=t&&0<t.length){e.beginUpdate();try{for(var i=0;i<t.length;i++)if(null!=t[i]){var s=mxUtils.setStyle(e.getStyle(t[i]),n,a);e.setStyle(t[i],s)}}finally{e.endUpdate()}}},setStyle:function(e,t,n){var a=null!=n&&(void 0===n.length||0<n.length);if(null==e||0==e.length)a&&(e=t+"="+n);else{var i=e.indexOf(t+"=");i<0?a&&(a=";"==e.charAt(e.length-1)?"":";",e=e+a+t+"="+n):(t=a?t+"="+n:"",n=e.indexOf(";",i),a||n++,e=e.substring(0,i)+t+(i<n?e.substring(n):""))}return e},setCellStyleFlags:function(e,t,n,a,i){if(null!=t&&0<t.length){e.beginUpdate();try{for(var s=0;s<t.length;s++)if(null!=t[s]){var o=mxUtils.setStyleFlag(e.getStyle(t[s]),n,a,i);e.setStyle(t[s],o)}}finally{e.endUpdate()}}},setStyleFlag:function(e,t,n,a){if(null==e||0==e.length)e=a||null==a?t+"="+n:t+"=0";else{var i=e.indexOf(t+"=");if(i<0)i=";"==e.charAt(e.length-1)?"":";",e=a||null==a?e+i+t+"="+n:e+i+t+"=0";else{var s=e.indexOf(";",i),o="";o=s<0?e.substring(i+t.length+1):e.substring(i+t.length+1,s),o=null==a?parseInt(o)^n:a?parseInt(o)|n:parseInt(o)&~n;e=e.substring(0,i)+t+"="+o+(0<=s?e.substring(s):"")}}return e},getAlignmentAsPoint:function(e,t){var n=0,a=0;return e==mxConstants.ALIGN_CENTER?n=-.5:e==mxConstants.ALIGN_RIGHT&&(n=-1),t==mxConstants.ALIGN_MIDDLE?a=-.5:t==mxConstants.ALIGN_BOTTOM&&(a=-1),new mxPoint(n,a)},getSizeForString:function(e,t,n){t=null!=t?t:mxConstants.DEFAULT_FONTSIZE,n=null!=n?n:mxConstants.DEFAULT_FONTFAMILY;var a=document.createElement("div");return a.style.fontFamily=n,a.style.fontSize=Math.round(t)+"px",a.style.lineHeight=Math.round(t*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,t,n,a,i){a=null!=a?a:0,i=null!=i?i:0,t=null!=t?t:1,null==n&&(n=[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),t=new mxTemporaryCellStates(e.getView(),t,n);try{o=(new mxCodec).encode(e.getView())}finally{t.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,t,n,a){if(e<1)return 1;a=null!=a?a:0;var i=(n=null!=n?n:mxConstants.PAGE_FORMAT_A4_PORTRAIT).width-2*a;n=n.height-2*a,a=t.getGraphBounds().clone(),t=t.getView().getScale(),a.width/=t,a.height/=t,n=(t=a.width)/a.height/(i/n),a=Math.sqrt(e);var s=Math.sqrt(n);if(n=a*s,a/=s,n<1&&e<a){var o=a/e;a=e,n/=o}for(a<1&&e<n&&(o=n/e,n=e,a/=o),o=Math.ceil(n)*Math.ceil(a),s=0;e<o;){o=Math.floor(n)/n;var r=Math.floor(a)/a;if(1==o&&(o=Math.floor(n-1)/n),1==r&&(r=Math.floor(a-1)/a),n*=o=r<o?o:r,a*=o,o=Math.ceil(n)*Math.ceil(a),10<++s)break}return i*n/t*.99999},show:function(e,t,n,a){if(n=null!=n?n:0,a=null!=a?a:0,null==t?t=window.open().document:t.open(),n=-(i=e.getGraphBounds()).x+n,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>",t.writeln(i),t.close(),null!=(e=t.body.getElementsByTagName("DIV")[0])&&(e.style.position="absolute",e.style.left=n+"px",e.style.top=a+"px")}else{for(t.writeln("<html"),t.writeln("<head>"),s=document.getElementsByTagName("base"),o=0;o<s.length;o++)t.writeln(mxUtils.getOuterHtml(s[o]));for(s=document.getElementsByTagName("link"),o=0;o<s.length;o++)t.writeln(mxUtils.getOuterHtml(s[o]));for(s=document.getElementsByTagName("style"),o=0;o<s.length;o++)t.writeln(mxUtils.getOuterHtml(s[o]));for(t.writeln("</head>"),t.writeln("</html>"),t.close(),null==t.body&&t.documentElement.appendChild(t.createElement("body")),t.body.style.overflow="auto",e=e.container.firstChild;null!=e;)o=e.cloneNode(!0),t.body.appendChild(o),e=e.nextSibling;null!=(e=t.getElementsByTagName("g")[0])&&(e.setAttribute("transform","translate("+n+","+a+")"),(n=e.ownerSVGElement).setAttribute("width",i.width+Math.max(i.x,0)+3),n.setAttribute("height",i.height+Math.max(i.y,0)+3))}return mxUtils.removeCursors(t.body),t},printScreen:function(e){var t=window.open();mxUtils.show(e,t.document),e=function(){t.focus(),t.print(),t.close()},mxClient.IS_GC?t.setTimeout(e,500):e()},popup:function(e,t){if(t){var n=document.createElement("div");n.style.overflow="scroll",n.style.width="636px",n.style.height="460px";var a=document.createElement("pre");a.innerHTML=mxUtils.htmlEntities(e,!1).replace(/\n/g,"<br>").replace(/ /g,"&nbsp;"),n.appendChild(a),(n=new mxWindow("Popup Window",n,document.body.clientWidth/2-320,(document.body.clientHeight||document.documentElement.clientHeight)/2-240,640,480,!1,!0)).setClosable(!0),n.setVisible(!0)}else mxClient.IS_NS?((n=window.open()).document.writeln("<pre>"+mxUtils.htmlEntities(e)+"</pre"),n.document.close()):((a=(n=window.open()).document.createElement("pre")).innerHTML=mxUtils.htmlEntities(e,!1).replace(/\n/g,"<br>").replace(/ /g,"&nbsp;"),n.document.body.appendChild(a))},alert:function(e){alert(e)},prompt:function(e,t){return prompt(e,t)},confirm:function(e){return confirm(e)},error:function(e,t,n,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-t)/2,a/4,t,null,!1,!0);return n&&(mxUtils.br(i),t=document.createElement("p"),n=document.createElement("button"),mxClient.IS_IE?n.style.cssText="float:right":n.setAttribute("style","float:right"),mxEvent.addListener(n,"click",function(e){o.destroy()}),mxUtils.write(n,mxResources.get(mxUtils.closeResource)||mxUtils.closeResource),t.appendChild(n),i.appendChild(t),mxUtils.br(i),o.setClosable(!0)),o.setVisible(!0),o},makeDraggable:function(e,t,n,i,a,s,o,r,l,d){return(e=new mxDragSource(e,n)).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 t?t(e):t},null!=i&&(e.createDragElement=function(){return i.cloneNode(!0)},r&&(e.createPreviewElement=function(e){var t=i.cloneNode(!0),n=parseInt(t.style.width),a=parseInt(t.style.height);return t.style.width=Math.round(n*e.view.scale)+"px",t.style.height=Math.round(a*e.view.scale)+"px",t})),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 t=1;t<arguments.length;t+=2)null!=arguments[t+1]&&(this.properties[arguments[t]]=arguments[t+1])}function mxMouseEvent(e,t){this.evt=e,this.state=t}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 t=this.getSource();null!=t;){if(t==e.node)return!0;t=t.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,t){null==this.eventListeners&&(this.eventListeners=[]),this.eventListeners.push(e),this.eventListeners.push(t)},mxEventSource.prototype.removeListener=function(e){if(null!=this.eventListeners)for(var t=0;t<this.eventListeners.length;)this.eventListeners[t+1]==e?this.eventListeners.splice(t,2):t+=2},mxEventSource.prototype.fireEvent=function(e,t){if(null!=this.eventListeners&&this.isEventsEnabled()){null==e&&(e=new mxEventObject),null==t&&(t=this.getEventSource()),null==t&&(t=this);for(var n=[t,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,n)}}};var mxEvent={objects:[],addListener:function(){var a=function(e,t,n){null==e.mxListenerList&&(e.mxListenerList=[],mxEvent.objects.push(e)),e.mxListenerList.push({name:t,f:n})};return window.addEventListener?function(e,t,n){e.addEventListener(t,n,!1),a(e,t,n)}:function(e,t,n){e.attachEvent("on"+t,n),a(e,t,n)}}(),removeListener:function(){var a=function(e,t,n){if(null!=e.mxListenerList){t=e.mxListenerList.length;for(var a=0;a<t;a++)if(e.mxListenerList[a].f==n){e.mxListenerList.splice(a,1);break}0==e.mxListenerList.length&&(e.mxListenerList=null)}};return window.removeEventListener?function(e,t,n){e.removeEventListener(t,n,!1),a(e,t,n)}:function(e,t,n){e.detachEvent("on"+t,n),a(e,t,n)}}(),removeAllListeners:function(e){var t=e.mxListenerList;if(null!=t)for(;0<t.length;){var n=t[0];mxEvent.removeListener(e,n.name,n.f)}},addGestureListeners:function(e,t,n,a){null!=t&&mxEvent.addListener(e,"mousedown",t),null!=n&&mxEvent.addListener(e,"mousemove",n),null!=a&&mxEvent.addListener(e,"mouseup",a),mxClient.IS_TOUCH&&(null!=t&&mxEvent.addListener(e,"touchstart",t),null!=n&&mxEvent.addListener(e,"touchmove",n),null!=a&&mxEvent.addListener(e,"touchend",a))},removeGestureListeners:function(e,t,n,a){null!=t&&mxEvent.removeListener(e,"mousedown",t),null!=n&&mxEvent.removeListener(e,"mousemove",n),null!=a&&mxEvent.removeListener(e,"mouseup",a),mxClient.IS_TOUCH&&(null!=t&&mxEvent.removeListener(e,"touchstart",t),null!=n&&mxEvent.removeListener(e,"touchmove",n),null!=a&&mxEvent.removeListener(e,"touchend",a))},redirectMouseEvents:function(e,n,t,a,i,s,o){var r=function(e){return"function"==typeof t?t(e):t};mxEvent.addGestureListeners(e,function(e){null!=a?a(e):mxEvent.isConsumed(e)||n.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,r(e)))},function(e){null!=i?i(e):mxEvent.isConsumed(e)||n.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,r(e)))},function(e){null!=s?s(e):mxEvent.isConsumed(e)||n.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 t=r(e);n.dblClick(e,null!=t?t.cell:null)}})},release:function(e){if(null!=e&&(mxEvent.removeAllListeners(e),null!=(e=e.childNodes)))for(var t=e.length,n=0;n<t;n+=1)mxEvent.release(e[n])},addMouseWheelListener:function(n){if(null!=n){var e=function(e){null==e&&(e=window.event);var t=0;0!=(t=!mxClient.IS_NS||mxClient.IS_SF||mxClient.IS_GC?e.wheelDelta/120:-e.detail/2)&&n(e,0<t)};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,t,n){n=null==n||n,(null==t||t)&&(e.preventDefault?(n&&e.stopPropagation(),e.preventDefault()):n&&(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,t,n,a,i,s){this.url=e,this.params=t,this.method=n||"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,t){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,t){null!=t&&e.setRequestHeader("Content-Type","application/x-www-form-urlencoded")},mxXmlRequest.prototype.simulate=function(e,t){var n=null;(e=e||document)==document&&(n=window.onbeforeunload,window.onbeforeunload=null);var a=e.createElement("form");a.setAttribute("method",this.method),a.setAttribute("action",this.url),null!=t&&a.setAttribute("target",t),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!=n&&(window.onbeforeunload=n)};var mxClipboard={STEPSIZE:10,insertCount:1,cells:null,isEmpty:function(){return null==mxClipboard.cells},cut:function(e,t){return t=mxClipboard.copy(e,t),mxClipboard.insertCount=0,mxClipboard.removeCells(e,t),t},removeCells:function(e,t){e.removeCells(t)},copy:function(e,t){t=t||e.getSelectionCells();var n=e.getExportableCells(t);return mxClipboard.insertCount=1,mxClipboard.cells=e.cloneCells(n),n},paste:function(e){if(null!=mxClipboard.cells){var t=e.getImportableCells(mxClipboard.cells),n=mxClipboard.insertCount*mxClipboard.STEPSIZE,a=e.getDefaultParent();t=e.importCells(t,n,n,a);mxClipboard.insertCount++,e.setSelectionCells(t)}}};function mxWindow(e,t,n,a,i,s,o,r,l,d){null!=t&&(o=null==o||o,this.content=t,this.init(n,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,t,n){this.src=e,this.width=t,this.height=n}function mxDivResizer(e,t){if("div"==e.nodeName.toLowerCase()){null==t&&(t=window),this.div=e;var n=mxUtils.getCurrentStyle(e);null!=n&&(this.resizeWidth="auto"==n.width,this.resizeHeight="auto"==n.height),mxEvent.addListener(t,"resize",mxUtils.bind(this,function(e){this.handlingResize||(this.handlingResize=!0,this.resize(),this.handlingResize=!1)})),this.resize()}}function mxDragSource(e,t){this.element=e,this.dropHandler=t,mxEvent.addGestureListeners(e,mxUtils.bind(this,this.mouseDown))}function mxToolbar(e){this.container=e}function mxSession(t,e,n,a){this.model=t,this.urlInit=e,this.urlPoll=n,this.urlNotify=a,null!=t&&(this.codec=new mxCodec,this.codec.lookup=function(e){return t.getCell(e)}),t.addListener(mxEvent.NOTIFY,mxUtils.bind(this,function(e,t){var n=t.getProperty("edit");(null!=n&&this.debug||this.connected&&!this.suspended)&&this.notify("<edit>"+this.encodeChanges(n.changes,n.undone)+"</edit>")}))}function mxUndoableEdit(e,t){this.source=e,this.changes=[],this.significant=null==t||t}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,t,n,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=t+"px",this.table=document.createElement("table"),this.table.className=i,null!=n&&(mxClient.IS_IE||(this.div.style.width=n+"px"),this.table.style.width=n+"px"),null!=a&&(mxClient.IS_IE||(this.div.style.height=a+"px"),this.table.style.height=a+"px"),e=document.createElement("tbody"),t=document.createElement("tr"),this.title=document.createElement("td"),this.title.className=i+"Title",t.appendChild(this.title),e.appendChild(t),t=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),t.appendChild(this.td),e.appendChild(t),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 t=this.title.firstChild;null!=t;){var n=t.nextSibling;t.nodeType==mxConstants.NODETYPE_TEXT&&t.parentNode.removeChild(t),t=n}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 t=mxWindow.activeWindow.getElement();null!=t&&null!=t.style&&(t.style.zIndex=e)}t=mxWindow.activeWindow,this.getElement().style.zIndex=parseInt(e)+1,(mxWindow.activeWindow=this).fireEvent(new mxEventObject(mxEvent.ACTIVATE,"previousWindow",t))}},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,t=mxUtils.bind(this,function(e){var t=mxEvent.getClientX(e)-a,n=mxEvent.getClientY(e)-i;this.setSize(s+t,o+n),this.fireEvent(new mxEventObject(mxEvent.RESIZE,"event",e)),mxEvent.consume(e)}),n=mxUtils.bind(this,function(e){mxEvent.removeGestureListeners(document,null,t,n),this.fireEvent(new mxEventObject(mxEvent.RESIZE_END,"event",e)),mxEvent.consume(e)});mxEvent.addGestureListeners(document,null,t,n),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,t){e=Math.max(this.minimumSize.width,e),t=Math.max(this.minimumSize.height,t),mxClient.IS_IE||(this.div.style.width=e+"px",this.div.style.height=t+"px"),this.table.style.width=e+"px",this.table.style.height=t+"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 n=!1,a=null,i=null,e=mxUtils.bind(this,function(e){if(this.activate(),n)n=!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{n=!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 t=this.getMinimumSize();0<t.height&&(mxClient.IS_IE||(this.div.style.height=t.height+"px"),this.table.style.height=t.height+"px"),0<t.width&&(mxClient.IS_IE||(this.div.style.width=t.width+"px"),this.table.style.width=t.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 n=!1,a=null,i=null,s=null,o=null,e=mxUtils.bind(this,function(e){if(this.activate(),"none"!=this.maximize.style.display){if(n)n=!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"!=(t=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(n=!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 t=mxUtils.getCurrentStyle(this.contentWrapper);"auto"!=t.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(),t=mxUtils.bind(this,function(e){var t=mxEvent.getClientX(e)-a,n=mxEvent.getClientY(e)-i;this.setLocation(s+t,o+n),this.fireEvent(new mxEventObject(mxEvent.MOVE,"event",e)),mxEvent.consume(e)}),n=mxUtils.bind(this,function(e){mxEvent.removeGestureListeners(document,null,t,n),this.fireEvent(new mxEventObject(mxEvent.MOVE_END,"event",e)),mxEvent.consume(e)});mxEvent.addGestureListeners(document,null,t,n),this.fireEvent(new mxEventObject(mxEvent.MOVE_START,"event",e)),mxEvent.consume(e)}))},mxWindow.prototype.setLocation=function(e,t){this.div.style.left=e+"px",this.div.style.top=t+"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,t){var n=document.createElement("tr"),a=document.createElement("td");n.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(){t()}),n.appendChild(a),this.body.appendChild(n)},mxForm.prototype.addText=function(e,t){var n=document.createElement("input");return n.setAttribute("type","text"),n.value=t,this.addField(e,n)},mxForm.prototype.addCheckbox=function(e,t){var n=document.createElement("input");return n.setAttribute("type","checkbox"),this.addField(e,n),t&&(n.checked=!0),n},mxForm.prototype.addTextarea=function(e,t,n){var a=document.createElement("textarea");return mxClient.IS_NS&&n--,a.setAttribute("rows",n||2),a.value=t,this.addField(e,a)},mxForm.prototype.addCombo=function(e,t,n){var a=document.createElement("select");return null!=n&&a.setAttribute("size",n),t&&a.setAttribute("multiple","true"),this.addField(e,a)},mxForm.prototype.addOption=function(e,t,n,a){var i=document.createElement("option");mxUtils.writeln(i,t),i.setAttribute("value",n),a&&i.setAttribute("selected",a),e.appendChild(i)},mxForm.prototype.addField=function(e,t){var n=document.createElement("tr"),a=document.createElement("td");return mxUtils.write(a,e),n.appendChild(a),(a=document.createElement("td")).appendChild(t),n.appendChild(a),this.body.appendChild(n),t},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(),t=this.getDocumentHeight(),n=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(n)&&!isNaN(a)&&0<=n&&0<=a&&0<e-a-n&&(this.div.style.width=e-a-n+"px"),this.resizeHeight&&!isNaN(i)&&!isNaN(s)&&0<=i&&0<=s&&0<t-i-s&&(this.div.style.height=t-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,t,n){return e.getCellAt(t,n)},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,t){var n=mxEvent.getClientX(t),a=mxEvent.getClientY(t),i=mxUtils.getOffset(e.container),s=mxUtils.getScrollOrigin();return n>=i.x-s.x&&a>=i.y-s.y&&n<=i.x-s.x+e.container.offsetWidth&&a<=i.y-s.y+e.container.offsetHeight},mxDragSource.prototype.mouseMove=function(e){if(null!=(t=this.getGraphForEvent(e))&&!this.graphContainsEvent(t,e)&&(t=null),t!=this.currentGraph&&(null!=this.currentGraph&&this.dragExit(this.currentGraph),this.currentGraph=t,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 t=mxEvent.getClientX(e),n=mxEvent.getClientY(e);null==this.dragElement.parentNode&&document.body.appendChild(this.dragElement),this.dragElement.style.visibility="visible",null!=this.dragOffset&&(t+=this.dragOffset.x,n+=this.dragOffset.y),t+=document.body.scrollLeft||document.documentElement.scrollLeft,n+=document.body.scrollTop||document.documentElement.scrollTop,this.dragElement.style.left=t+"px",this.dragElement.style.top=n+"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 t=this.currentGraph.view.scale,n=this.currentGraph.view.translate;this.drop(this.currentGraph,e,this.currentDropTarget,this.currentPoint.x/t-n.x,this.currentPoint.y/t-n.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,t){var n=mxUtils.getOffset(e.container),a=mxUtils.getScrollOrigin(e.container),i=mxEvent.getClientX(t)-n.x+a.x;n=mxEvent.getClientY(t)-n.y+a.y;if(e.autoScroll&&(null==this.autoscroll||this.autoscroll)&&e.scrollPointToVisible(i,n,e.autoExtend),null!=this.currentHighlight&&e.isDropEnabled()&&(this.currentDropTarget=this.getDropTarget(e,i,n),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(t);var s=!0;if(null!=this.currentGuide&&this.currentGuide.isEnabledForEvent(t))s=new mxRectangle(0,0,s=parseInt(this.previewElement.style.width),o=parseInt(this.previewElement.style.height)),n=new mxPoint(i,n),n=this.currentGuide.move(s,n,a),s=!1,i=n.x,n=n.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,n=(e.snap(n/a-o.y-r)+o.y)*a}null!=this.currentGuide&&s&&this.currentGuide.hide(),null!=this.previewOffset&&(i+=this.previewOffset.x,n+=this.previewOffset.y),this.previewElement.style.left=Math.round(i)+"px",this.previewElement.style.top=Math.round(n)+"px",this.previewElement.style.visibility="visible"}this.currentPoint=new mxPoint(i,n)},mxDragSource.prototype.drop=function(e,t,n,a,i){this.dropHandler(e,t,n,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,t,n,a,i,s){var o=document.createElement(null!=t?"img":"button"),r=i||(null!=s?"mxToolbarMode":"mxToolbarItem");return o.className=r,o.setAttribute("src",t),null!=e&&(null!=t?o.setAttribute("title",e):mxUtils.write(o,e)),this.container.appendChild(o),null!=n&&(mxEvent.addListener(o,"click",n),mxClient.IS_TOUCH&&mxEvent.addListener(o,"touchend",n)),e=mxUtils.bind(this,function(e){null!=a?o.setAttribute("src",t):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 t=this.currentImg;this.menu.isMenuShowing()&&this.menu.hideMenu(),t!=o&&(this.currentImg=o,this.menu.factoryMethod=s,t=new mxPoint(o.offsetLeft,o.offsetTop+o.offsetHeight),this.menu.popup(t.x,t.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 t=document.createElement("div");t.style.display="inline",t.className="mxToolbarComboContainer";var n=document.createElement("select");return n.className=e||"mxToolbarCombo",t.appendChild(n),this.container.appendChild(t),n},mxToolbar.prototype.addActionCombo=function(e,t){var n=document.createElement("select");return n.className=t||"mxToolbarCombo",this.addOption(n,e,null),mxEvent.addListener(n,"change",function(e){var t=n.options[n.selectedIndex];n.selectedIndex=0,null!=t.funct&&t.funct(e)}),this.container.appendChild(n),n},mxToolbar.prototype.addOption=function(e,t,n){var a=document.createElement("option");return mxUtils.writeln(a,t),"function"==typeof n?a.funct=n:a.setAttribute("value",n),e.appendChild(a),a},mxToolbar.prototype.addSwitchMode=function(e,t,n,a,i){var s=document.createElement("img");return s.initialClassName=i||"mxToolbarMode",s.className=s.initialClassName,s.setAttribute("src",t),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)),n()})),this.container.appendChild(s),null==this.defaultMode&&(this.defaultMode=s,this.selectMode(s),n()),s},mxToolbar.prototype.addMode=function(e,t,n,a,i,s){s=null==s||s;var o=document.createElement(null!=t?"img":"button");return o.initialClassName=i||"mxToolbarMode",o.className=o.initialClassName,o.setAttribute("src",t),o.altIcon=a,null!=e&&o.setAttribute("title",e),this.enabled&&s&&(mxEvent.addListener(o,"click",mxUtils.bind(this,function(e){this.selectMode(o,n),this.noReset=!1})),mxEvent.addListener(o,"dblclick",mxUtils.bind(this,function(e){this.selectMode(o,n),this.noReset=!0})),null==this.defaultMode&&(this.defaultMode=o,this.defaultFunction=n,this.selectMode(o,n))),this.container.appendChild(o),o},mxToolbar.prototype.selectMode=function(e,t){if(this.selectedMode!=e){if(null!=this.selectedMode){var n=this.selectedMode.altIcon;null!=n?(this.selectedMode.altIcon=this.selectedMode.getAttribute("src"),this.selectedMode.setAttribute("src",n)):this.selectedMode.className=this.selectedMode.initialClassName}this.selectedMode=e,null!=(n=this.selectedMode.altIcon)?(this.selectedMode.altIcon=this.selectedMode.getAttribute("src"),this.selectedMode.setAttribute("src",n)):this.selectedMode.className=this.selectedMode.initialClassName+"Selected",this.fireEvent(new mxEventObject(mxEvent.SELECT,"function",t))}},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,t,n){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,t,n){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,t,n))),this.sent+=e.length,this.fireEvent(new mxEventObject(mxEvent.NOTIFY,"url",this.urlNotify,"xml",e)))},mxSession.prototype.get=function(n,a,t){if(void 0!==mxUtils){var i=mxUtils.bind(this,function(e){null!=t?t(e):this.stop(e)});mxUtils.get(n,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",n,"request",e)),this.isValidResponse(e)){if(0<e.getText().length){var t=e.getDocumentElement();null==t?i("Invalid response: "+e.getText()):this.receive(t)}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,t){for(var n="",a=t?-1:1,i=t?e.length-1:0;0<=i&&i<e.length;i+=a){var s=this.codec.encode(e[i]);n=n+mxUtils.getXml(s,this.linefeed)}return n},mxSession.prototype.receive=function(e){if(null!=e&&e.nodeType==mxConstants.NODETYPE_ELEMENT){var t=e.getAttribute("namespace");for(null!=t&&(this.model.prefix=t+"-"),t=e.firstChild;null!=t;){var n=t.nodeName.toLowerCase();"state"==n?this.processState(t):"delta"==n&&this.processDelta(t),t=t.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 t=this.createUndoableEdit(e);this.model.fireEvent(new mxEventObject(mxEvent.CHANGE,"edit",t,"changes",e)),this.model.fireEvent(new mxEventObject(mxEvent.UNDO,"edit",t)),this.fireEvent(new mxEventObject(mxEvent.FIRED,"edit",t))}},mxSession.prototype.createUndoableEdit=function(e){var t=new mxUndoableEdit(this.model,this.significantRemoteChanges);return t.changes=e,t.notify=function(){t.source.fireEvent(new mxEventObject(mxEvent.CHANGE,"edit",t,"changes",t.changes)),t.source.fireEvent(new mxEventObject(mxEvent.NOTIFY,"edit",t,"changes",t.changes))},t},mxSession.prototype.decodeChanges=function(e){this.codec.document=e.ownerDocument;var t=[];for(e=e.firstChild;null!=e;){var n=this.decodeChange(e);null!=n&&t.push(n),e=e.nextSibling}return t},mxSession.prototype.decodeChange=function(e){var t=null;return e.nodeType==mxConstants.NODETYPE_ELEMENT&&(null!=(t="mxRootChange"==e.nodeName?new mxCodec(e.ownerDocument).decode(e):this.codec.decode(e))&&(t.model=this.model,t.execute(),"mxChildChange"==e.nodeName&&null==t.parent&&this.cellRemoved(t.child))),t},mxSession.prototype.cellRemoved=function(e,t){this.codec.putObject(e.getId(),e);for(var n=this.model.getChildCount(e),a=0;a<n;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 t=this.changes[e];null!=t.execute?t.execute():null!=t.undo&&t.undo(),this.source.fireEvent(new mxEventObject(mxEvent.EXECUTED,"change",t))}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,t=0;t<e;t++){var n=this.changes[t];null!=n.execute?n.execute():null!=n.redo&&n.redo(),this.source.fireEvent(new mxEventObject(mxEvent.EXECUTED,"change",n))}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 t=this.history[this.indexOfNextAdd++];if(t.redo(),t.isSignificant()){this.fireEvent(new mxEventObject(mxEvent.REDO,"edit",t));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),t=0;t<e.length;t++)e[t].die()};var mxUrlConverter=function(e){var n=!0,a=null,i=null;return{isEnabled:function(){return n},setEnabled:function(e){n=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(n&&this.isRelativeUrl(e)){if(null==a){i=location.protocol+"//"+location.host;var t=(a=i+location.pathname).lastIndexOf("/");0<t&&(a=a.substring(0,t+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,t){},mouseMove:function(e,t){},mouseUp:mxUtils.bind(this,function(e,t){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),t=-s.container.scrollTop-Math.ceil(this.dy);s.panGraph(e,t),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,t,n,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!=n?n: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=t+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=t-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,t=s.panDy;0==e&&0==t||(s.panGraph(0,0),s.view.setTranslate(this.t0x+e/s.view.scale,this.t0y+t/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,t){this.isEnabled()&&this.graphModelChanged(t.getProperty("edit").changes)}),this.setGraph(e)}function mxAnimation(e){this.delay=null!=e?e:20}function mxMorphing(e,t,n,a){mxAnimation.call(this,a),this.graph=e,this.steps=null!=t?t:6,this.ease=null!=n?n: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,t){mxAbstractCanvas2D.call(this),this.root=e,this.gradients=[],this.defs=null,this.styleEnabled=null!=t&&t;var n=null;if(e.ownerDocument!=document)for(n=e;null!=n&&"svg"!=n.nodeName;)n=n.parentNode;null!=n&&(0<n.getElementsByTagName("defs").length&&(this.defs=n.getElementsByTagName("defs")[0]),null==this.defs&&(this.defs=this.createElement("defs"),null!=n.firstChild?n.insertBefore(this.defs,n.firstChild):n.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,t,n,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!=t?((i=document.createElement("img")).src=t,r.appendChild(i)):null!=i&&((t=document.createElement("div")).className=i,r.appendChild(t)),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!=n&&n(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 t=document.createElement("img");t.setAttribute("src",this.submenuImage),td=e.firstChild.nextSibling.nextSibling,td.appendChild(t)},mxPopupMenu.prototype.showSubmenu=function(e,t){if(null!=t.div){t.div.style.left=e.div.offsetLeft+t.offsetLeft+t.offsetWidth-1+"px",t.div.style.top=e.div.offsetTop+t.offsetTop+"px",document.body.appendChild(t.div);var n=parseInt(t.div.offsetLeft),a=parseInt(t.div.offsetWidth),i=document.body,s=document.documentElement;n+a>(i.scrollLeft||s.scrollLeft)+(i.clientWidth||s.clientWidth)&&(t.div.style.left=e.div.offsetLeft-a+(mxClient.IS_IE?6:-6)+"px"),mxUtils.fit(t.div)}},mxPopupMenu.prototype.addSeparator=function(e,t){if(e=e||this,this.smartSeparators&&!t)e.willAddSeparator=!0;else if(null!=e.tbody){e.willAddSeparator=!1;var n=document.createElement("tr"),a=document.createElement("td");a.className="mxPopupMenuIcon",a.style.padding="0 0 0 0px",n.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),n.appendChild(a),e.tbody.appendChild(n)}},mxPopupMenu.prototype.popup=function(e,t,n,a){if(null!=this.div&&null!=this.tbody&&null!=this.factoryMethod){for(this.div.style.left=e+"px",this.div.style.top=t+"px";null!=this.tbody.firstChild;)mxEvent.release(this.tbody.firstChild),this.tbody.removeChild(this.tbody.firstChild);this.itemCount=0,this.factoryMethod(this,n,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 t=0;t<this.cells.length;t++)this.animateCell(cells[t],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,t,n){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,t.moveState(a,-i.x/this.ease,-i.y/this.ease)}if(n&&!this.stopRecursion(a,i))for(a=this.graph.getModel().getChildCount(e),i=0;i<a;i++)this.animateCell(this.graph.getModel().getChildAt(e,i),t,n)},mxMorphing.prototype.stopRecursion=function(e,t){return null!=t&&(0!=t.x||0!=t.y)},mxMorphing.prototype.getDelta=function(e){var t=this.getOriginForCell(e.cell),n=this.graph.getView().getTranslate(),a=this.graph.getView().getScale();return e=new mxPoint(e.x/a-n.x,e.y/a-n.y),new mxPoint((t.x-e.x)*a,(t.y-e.y)*a)},mxMorphing.prototype.getOriginForCell=function(e){var t=null;return null!=e&&(t=this.getOriginForCell(this.graph.getModel().getParent(e)),null!=(e=this.graph.getCellGeometry(e))&&(t.x+=e.x,t.y+=e.y)),null==t&&(t=new mxPoint(-(t=this.graph.view.getTranslate()).x,-t.y)),t},mxImageBundle.prototype.images=null,mxImageBundle.prototype.images=null,mxImageBundle.prototype.putImage=function(e,t,n){this.images[e]={value:t,fallback:n}},mxImageBundle.prototype.getImage=function(e){var t=null;return null!=e&&(null!=(e=this.images[e])&&(t=this.alt?e.fallback:e.value)),t},mxImageExport.prototype.includeOverlays=!1,mxImageExport.prototype.drawState=function(e,t){null!=e&&(this.visitStatesRecursive(e,t,this.drawCellState),this.includeOverlays&&this.visitStatesRecursive(e,t,this.drawOverlays))},mxImageExport.prototype.visitStatesRecursive=function(e,t,n){if(null!=e){n(e,t);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,t,n)}}},mxImageExport.prototype.drawCellState=function(e,t){e.shape instanceof mxShape&&(t.save(),e.shape.paint(t),t.restore()),null!=e.text&&(t.save(),e.text.paint(t),t.restore())},mxImageExport.prototype.drawOverlays=function(e,n){null!=e.overlays&&e.overlays.visit(function(e,t){t instanceof mxShape&&t.paint(n)})},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,t=2;t<arguments.length;t+=2)this.lastX=arguments[t-1],this.lastY=arguments[t],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,t,n,a,i){return n*=Math.PI/180,mxUtils.getRotatedPoint(new mxPoint(e,t),Math.cos(n),Math.sin(n),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,t){this.state.dx+=e,this.state.dy+=t},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,t,n,a,i,s,o,r,l){(n=this.state).fillColor=e,n.fillAlpha=null!=r?r:1,n.gradientColor=t,n.gradientAlpha=null!=l?l:1,n.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,t){this.state.shadowDx=e,this.state.shadowDy=t},mxAbstractCanvas2D.prototype.begin=function(){this.lastY=this.lastX=0,this.path=[]},mxAbstractCanvas2D.prototype.moveTo=function(e,t){this.addOp(this.moveOp,e,t)},mxAbstractCanvas2D.prototype.lineTo=function(e,t){this.addOp(this.lineOp,e,t)},mxAbstractCanvas2D.prototype.quadTo=function(e,t,n,a){this.addOp(this.quadOp,e,t,n,a)},mxAbstractCanvas2D.prototype.curveTo=function(e,t,n,a,i,s){this.addOp(this.curveOp,e,t,n,a,i,s)},mxAbstractCanvas2D.prototype.arcTo=function(e,t,n,a,i,s,o){for(e=mxUtils.arcToCurves(this.lastX,this.lastY,e,t,n,a,i,s,o),t=0;t<e.length;t+=6)this.curveTo(e[t],e[t+1],e[t+2],e[t+3],e[t+4],e[t+5])},mxAbstractCanvas2D.prototype.close=function(e,t,n,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 t=this.createElement("scale");t.setAttribute("scale",e),this.root.appendChild(t)},mxXmlCanvas2D.prototype.translate=function(e,t){var n=this.createElement("translate");n.setAttribute("dx",this.format(e)),n.setAttribute("dy",this.format(t)),this.root.appendChild(n)},mxXmlCanvas2D.prototype.rotate=function(e,t,n,a,i){var s=this.createElement("rotate");(0!=e||t||n)&&(s.setAttribute("theta",this.format(e)),s.setAttribute("flipH",t?"1":"0"),s.setAttribute("flipV",n?"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 t=this.createElement("alpha");t.setAttribute("alpha",this.format(e)),this.root.appendChild(t)},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 t=this.createElement("fillcolor");t.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(t)},mxXmlCanvas2D.prototype.setGradient=function(e,t,n,a,i,s,o,r,l){if(null!=e&&null!=t){mxAbstractCanvas2D.prototype.setGradient.apply(this,arguments);var d=this.createElement("gradient");d.setAttribute("c1",e),d.setAttribute("c2",t),d.setAttribute("x",this.format(n)),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 t=this.createElement("strokecolor");t.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(t)},mxXmlCanvas2D.prototype.setStrokeWidth=function(e){if(this.compressed){if(this.state.strokeWidth==e)return;mxAbstractCanvas2D.prototype.setStrokeWidth.apply(this,arguments)}var t=this.createElement("strokewidth");t.setAttribute("width",this.format(e)),this.root.appendChild(t)},mxXmlCanvas2D.prototype.setDashed=function(e){if(this.compressed){if(this.state.dashed==e)return;mxAbstractCanvas2D.prototype.setDashed.apply(this,arguments)}var t=this.createElement("dashed");t.setAttribute("dashed",e?"1":"0"),this.root.appendChild(t)},mxXmlCanvas2D.prototype.setDashPattern=function(e){if(this.compressed){if(this.state.dashPattern==e)return;mxAbstractCanvas2D.prototype.setDashPattern.apply(this,arguments)}var t=this.createElement("dashpattern");t.setAttribute("pattern",e),this.root.appendChild(t)},mxXmlCanvas2D.prototype.setLineCap=function(e){if(this.compressed){if(this.state.lineCap==e)return;mxAbstractCanvas2D.prototype.setLineCap.apply(this,arguments)}var t=this.createElement("linecap");t.setAttribute("cap",e),this.root.appendChild(t)},mxXmlCanvas2D.prototype.setLineJoin=function(e){if(this.compressed){if(this.state.lineJoin==e)return;mxAbstractCanvas2D.prototype.setLineJoin.apply(this,arguments)}var t=this.createElement("linejoin");t.setAttribute("join",e),this.root.appendChild(t)},mxXmlCanvas2D.prototype.setMiterLimit=function(e){if(this.compressed){if(this.state.miterLimit==e)return;mxAbstractCanvas2D.prototype.setMiterLimit.apply(this,arguments)}var t=this.createElement("miterlimit");t.setAttribute("limit",e),this.root.appendChild(t)},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 t=this.createElement("fontcolor");t.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(t)}},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 t=this.createElement("fontbackgroundcolor");t.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(t)}},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 t=this.createElement("fontbordercolor");t.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(t)}},mxXmlCanvas2D.prototype.setFontSize=function(e){if(this.textEnabled){if(this.compressed){if(this.state.fontSize==e)return;mxAbstractCanvas2D.prototype.setFontSize.apply(this,arguments)}var t=this.createElement("fontsize");t.setAttribute("size",e),this.root.appendChild(t)}},mxXmlCanvas2D.prototype.setFontFamily=function(e){if(this.textEnabled){if(this.compressed){if(this.state.fontFamily==e)return;mxAbstractCanvas2D.prototype.setFontFamily.apply(this,arguments)}var t=this.createElement("fontfamily");t.setAttribute("family",e),this.root.appendChild(t)}},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 t=this.createElement("fontstyle");t.setAttribute("style",e),this.root.appendChild(t)}},mxXmlCanvas2D.prototype.setShadow=function(e){if(this.compressed){if(this.state.shadow==e)return;mxAbstractCanvas2D.prototype.setShadow.apply(this,arguments)}var t=this.createElement("shadow");t.setAttribute("enabled",e?"1":"0"),this.root.appendChild(t)},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 t=this.createElement("shadowcolor");t.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(t)},mxXmlCanvas2D.prototype.setShadowAlpha=function(e){if(this.compressed){if(this.state.shadowAlpha==e)return;mxAbstractCanvas2D.prototype.setShadowAlpha.apply(this,arguments)}var t=this.createElement("shadowalpha");t.setAttribute("alpha",e),this.root.appendChild(t)},mxXmlCanvas2D.prototype.setShadowOffset=function(e,t){if(this.compressed){if(this.state.shadowDx==e&&this.state.shadowDy==t)return;mxAbstractCanvas2D.prototype.setShadowOffset.apply(this,arguments)}var n=this.createElement("shadowoffset");n.setAttribute("dx",e),n.setAttribute("dy",t),this.root.appendChild(n)},mxXmlCanvas2D.prototype.rect=function(e,t,n,a){var i=this.createElement("rect");i.setAttribute("x",this.format(e)),i.setAttribute("y",this.format(t)),i.setAttribute("w",this.format(n)),i.setAttribute("h",this.format(a)),this.root.appendChild(i)},mxXmlCanvas2D.prototype.roundrect=function(e,t,n,a,i,s){var o=this.createElement("roundrect");o.setAttribute("x",this.format(e)),o.setAttribute("y",this.format(t)),o.setAttribute("w",this.format(n)),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,t,n,a){var i=this.createElement("ellipse");i.setAttribute("x",this.format(e)),i.setAttribute("y",this.format(t)),i.setAttribute("w",this.format(n)),i.setAttribute("h",this.format(a)),this.root.appendChild(i)},mxXmlCanvas2D.prototype.image=function(e,t,n,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(t)),l.setAttribute("w",this.format(n)),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,t){var n=this.createElement("move");n.setAttribute("x",this.format(e)),n.setAttribute("y",this.format(t)),this.root.appendChild(n),this.lastX=e,this.lastY=t},mxXmlCanvas2D.prototype.lineTo=function(e,t){var n=this.createElement("line");n.setAttribute("x",this.format(e)),n.setAttribute("y",this.format(t)),this.root.appendChild(n),this.lastX=e,this.lastY=t},mxXmlCanvas2D.prototype.quadTo=function(e,t,n,a){var i=this.createElement("quad");i.setAttribute("x1",this.format(e)),i.setAttribute("y1",this.format(t)),i.setAttribute("x2",this.format(n)),i.setAttribute("y2",this.format(a)),this.root.appendChild(i),this.lastX=n,this.lastY=a},mxXmlCanvas2D.prototype.curveTo=function(e,t,n,a,i,s){var o=this.createElement("curve");o.setAttribute("x1",this.format(e)),o.setAttribute("y1",this.format(t)),o.setAttribute("x2",this.format(n)),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,t,n,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(t)),u.setAttribute("w",this.format(n)),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,t){if(null!=this.root.ownerDocument.createElementNS)return this.root.ownerDocument.createElementNS(t||mxConstants.NS_SVG,e);var n=this.root.ownerDocument.createElement(e);return null!=t&&n.setAttribute("xmlns",t),n},mxSvgCanvas2D.prototype.createGradientId=function(e,t,n,a,i){return"#"==e.charAt(0)&&(e=e.substring(1)),"#"==t.charAt(0)&&(t=t.substring(1)),e=e.toLowerCase()+"-"+n,t=t.toLowerCase()+"-"+a,(n=null)==i||i==mxConstants.DIRECTION_SOUTH?n="s":i==mxConstants.DIRECTION_EAST?n="e":(a=e,e=t,t=a,i==mxConstants.DIRECTION_NORTH?n="s":i==mxConstants.DIRECTION_WEST&&(n="e")),"mx-gradient-"+e+"-"+t+"-"+n},mxSvgCanvas2D.prototype.getSvgGradient=function(e,t,n,a,i){var s=this.createGradientId(e,t,n,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,t,n,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,t,n,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%"),n=n<1?";stop-opacity:"+n:"",(i=this.createElement("stop")).setAttribute("offset","0%"),i.setAttribute("style","stop-color:"+e+n),s.appendChild(i),n=a<1?";stop-opacity:"+a:"",(i=this.createElement("stop")).setAttribute("offset","100%"),i.setAttribute("style","stop-color:"+t+n),s.appendChild(i),s},mxSvgCanvas2D.prototype.addNode=function(e,t){var n=this.node,a=this.state;if(null!=n){if("path"==n.nodeName){if(!(null!=this.path&&0<this.path.length))return;n.setAttribute("d",this.path.join(" "))}e&&null!=a.fillColor?this.updateFill():this.styleEnabled||("ellipse"!=n.nodeName||!mxClient.IS_NS||mxClient.IS_GC||mxClient.IS_SF?n.setAttribute("fill","none"):n.setAttribute("fill","transparent"),e=!1),t&&null!=a.strokeColor?this.updateStroke():this.styleEnabled||n.setAttribute("stroke","none"),null!=a.transform&&0<a.transform.length&&n.setAttribute("transform",a.transform),a.shadow&&this.root.appendChild(this.createShadow(n)),0<this.strokeTolerance&&!e&&this.root.appendChild(this.createTolerance(n)),this.pointerEvents&&("path"!=n.nodeName||this.path[this.path.length-1]==this.closeOp)&&n.setAttribute("pointer-events","all"),this.root.appendChild(n)}},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 t=Math.max(1,this.format(e.strokeWidth*e.scale));1!=t&&this.node.setAttribute("stroke-width",t),"path"==this.node.nodeName&&this.updateStrokeAttributes(),e.dashed&&this.node.setAttribute("stroke-dasharray",this.createDashPattern(t))},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 t=e.lineCap;"flat"==t&&(t="butt"),"butt"!=t&&this.node.setAttribute("stroke-linecap",t)}null!=e.miterLimit&&(!this.styleEnabled||10!=e.miterLimit)&&this.node.setAttribute("stroke-miterlimit",e.miterLimit)},mxSvgCanvas2D.prototype.createDashPattern=function(e){var t=this.state.dashPattern.split(" "),n=[];if(0<t.length)for(var a=0;a<t.length;a++)n[a]=Number(t[a])*e;return n.join(" ")},mxSvgCanvas2D.prototype.createTolerance=function(e){e=e.cloneNode(!0);var t=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",t),e.setAttribute("fill","none"),e.setAttribute("stroke",mxClient.IS_OP?"none":"white"),e},mxSvgCanvas2D.prototype.createShadow=function(e){e=e.cloneNode(!0);var t=this.state;return"none"!=e.getAttribute("fill")&&e.setAttribute("fill",t.shadowColor),"none"!=e.getAttribute("stroke")&&e.setAttribute("stroke",t.shadowColor),e.setAttribute("transform","translate("+this.format(t.shadowDx*t.scale)+","+this.format(t.shadowDy*t.scale)+")"+(t.transform||"")),e.setAttribute("opacity",t.shadowAlpha),e},mxSvgCanvas2D.prototype.rotate=function(e,t,n,a,i){if(0!=e||t||n){var s=this.state;if(a+=s.dx,i+=s.dy,a*=s.scale,i*=s.scale,s.transform=s.transform||"",t&&n)e+=180;else if(t^n){var o=t?a:0,r=t?-1:1,l=n?i:0,d=n?-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)+")"}(t?!n:n)&&(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,t,n,a){var i=this.state,s=this.createElement("rect");s.setAttribute("x",this.format((e+i.dx)*i.scale)),s.setAttribute("y",this.format((t+i.dy)*i.scale)),s.setAttribute("width",this.format(n*i.scale)),s.setAttribute("height",this.format(a*i.scale)),this.node=s},mxSvgCanvas2D.prototype.roundrect=function(e,t,n,a,i,s){this.rect(e,t,n,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,t,n,a){var i=this.state,s=this.createElement("ellipse");s.setAttribute("cx",Math.round((e+n/2+i.dx)*i.scale)),s.setAttribute("cy",Math.round((t+a/2+i.dy)*i.scale)),s.setAttribute("rx",n/2*i.scale),s.setAttribute("ry",a/2*i.scale),this.node=s},mxSvgCanvas2D.prototype.image=function(e,t,n,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,t+=l.dy;var d=this.createElement("image");if(d.setAttribute("x",this.format(e*l.scale)),d.setAttribute("y",this.format(t*l.scale)),d.setAttribute("width",this.format(n*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=-n-2*e),r&&(c=-1,u=-a-2*t),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(t*l.scale)),d.setAttribute("width",this.format(n*l.scale)),d.setAttribute("height",this.format(a*l.scale)),this.root.appendChild(d))},mxSvgCanvas2D.prototype.createDiv=function(e,t,n,a,i){return n=this.state,a="display:inline-block;font-size:"+Math.round(n.fontSize)+"px;font-family:"+n.fontFamily+";color:"+n.fontColor+";line-height:"+Math.round(n.fontSize*mxConstants.LINE_HEIGHT)+"px;"+a,(n.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD&&(a+="font-weight:bold;"),(n.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC&&(a+="font-style:italic;"),(n.fontStyle&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE&&(a+="font-decoration:underline;"),t==mxConstants.ALIGN_CENTER?a+="text-align:center;":t==mxConstants.ALIGN_RIGHT&&(a+="text-align:right;"),t="",null!=n.fontBackgroundColor&&(t+="background-color:"+n.fontBackgroundColor+";"),null!=n.fontBorderColor&&(t+="border:1px solid "+n.fontBorderColor+";"),mxUtils.isNode(e)||((n=document.createElement("textarea")).innerHTML=e.replace(/&lt;/g,"&amp;lt;").replace(/&gt;/g,"&amp;gt;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),e=n.value,i?a+=t:0<t.length&&(e='<div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;'+t+'">'+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,t,n,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,t+=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<n&&(p+="width:"+Math.round(n)+"px;")):d&&(p+="width:"+Math.round(n)+"px;",0<a&&(p+="max-height:"+Math.round(a)+"px;")),r?(!c&&0<n&&(p+="width:"+Math.round(n)+"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);n=d?Math.max(n,g):g,u.alpha<1&&r.setAttribute("opacity",u.alpha),d=i=0,s==mxConstants.ALIGN_CENTER?i-=n/2:s==mxConstants.ALIGN_RIGHT&&(i-=n),e+=i,o==mxConstants.ALIGN_MIDDLE?d-=a/2:o==mxConstants.ALIGN_BOTTOM&&(d-=a),t+=d,s=1!=u.scale?"scale("+u.scale+")":"",0!=u.rotation&&this.rotateHtml?(s+="rotate("+u.rotation+","+n/2+","+a/2+")",e=(t=this.rotatePoint((e+n/2)*u.scale,(t+a/2)*u.scale,u.rotation,u.rotationCx,u.rotationCy)).x-n*u.scale/2,t=t.y-a*u.scale/2):(e*=u.scale,t*=u.scale),0!=m&&(s+="rotate("+m+","+-i+","+-d+")"),r.setAttribute("transform","translate("+Math.round(e)+","+Math.round(t)+")"+s),l.setAttribute("width",Math.round(Math.max(1,n))),l.setAttribute("height",Math.round(Math.max(1,a)))}}else this.plainText(e,t,n,a,i,s,o,r,d,c,m)}},mxSvgCanvas2D.prototype.createClip=function(e,t,n,a){for(var i="mx-clip-"+(e=Math.round(e))+"-"+(t=Math.round(t))+"-"+(n=Math.round(n))+"-"+(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",t),i.setAttribute("width",n),i.setAttribute("height",a),clip.appendChild(i),clip},mxSvgCanvas2D.prototype.plainText=function(e,t,n,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(t*r.scale)+")"),d&&0<n&&0<a){var g=e;c=t,s==mxConstants.ALIGN_CENTER?g-=n/2:s==mxConstants.ALIGN_RIGHT&&(g-=n),o==mxConstants.ALIGN_MIDDLE?c-=a/2:o==mxConstants.ALIGN_BOTTOM&&(c-=a),c=this.createClip(g*r.scale-2,c*r.scale-2,n*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=t+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,t,n,v,s,o,l)},mxSvgCanvas2D.prototype.updateFont=function(e){var t=this.state;e.setAttribute("fill",t.fontColor),(!this.styleEnabled||t.fontFamily!=mxConstants.DEFAULT_FONTFAMILY)&&e.setAttribute("font-family",t.fontFamily),(t.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD&&e.setAttribute("font-weight","bold"),(t.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC&&e.setAttribute("font-style","italic"),(t.fontStyle&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE&&e.setAttribute("text-decoration","underline")},mxSvgCanvas2D.prototype.addTextBackground=function(e,t,n,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?n-=i/2:o==mxConstants.ALIGN_RIGHT&&(n-=i),r==mxConstants.ALIGN_MIDDLE?a-=s/2:r==mxConstants.ALIGN_BOTTOM&&(a-=s),new mxRectangle((n+1)*d.scale,a*d.scale,(i-2)*d.scale,(s+2)*d.scale)):null!=e.getBBox&&this.root.ownerDocument==document?(c=e.getBBox(),t=mxClient.IS_IE&&mxClient.IS_SVG,new mxRectangle(c.x,c.y+(t?0:1),c.width,c.height+(t?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"),t=mxUtils.htmlEntities(t,!1),c.innerHTML=t.replace(/\n/g,"<br/>"),document.body.appendChild(c),i=c.offsetWidth,s=c.offsetHeight,c.parentNode.removeChild(c),o==mxConstants.ALIGN_CENTER?n-=i/2:o==mxConstants.ALIGN_RIGHT&&(n-=i),r==mxConstants.ALIGN_MIDDLE?a-=s/2:r==mxConstants.ALIGN_BOTTOM&&(a-=s),new mxRectangle((n+1)*d.scale,(a+2)*d.scale,i*d.scale,(s+1)*d.scale)))&&((t=this.createElement("rect")).setAttribute("fill",d.fontBackgroundColor||"none"),t.setAttribute("stroke",d.fontBorderColor||"none"),t.setAttribute("x",Math.floor(c.x-1)),t.setAttribute("y",Math.floor(c.y-1)),t.setAttribute("width",Math.ceil(c.width+2)),t.setAttribute("height",Math.ceil(c.height)),d=null!=d.fontBorderColor?Math.max(1,this.format(d.scale)):0,t.setAttribute("stroke-width",d),this.root.ownerDocument==document&&1==mxUtils.mod(d,2)&&t.setAttribute("transform","translate(0.5, 0.5)"),e.insertBefore(t,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,t){this.graph=e,this.setStates(t)}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,t){var n=this.node,a=this.state;if(null!=n){if("shape"==n.nodeName){if(!(null!=this.path&&0<this.path.length))return;n.path=this.path.join(" ")+" e",n.style.width=this.root.style.width,n.style.height=this.root.style.height,n.coordsize=parseInt(n.style.width)+" "+parseInt(n.style.height)}n.strokeweight=this.format(Math.max(1,a.strokeWidth*a.scale/this.vmlScale))+"px",a.shadow&&this.root.appendChild(this.createShadow(n,e&&null!=a.fillColor,t&&null!=a.strokeColor)),t&&null!=a.strokeColor?(n.stroked="true",n.strokecolor=a.strokeColor):n.stroked="false",n.appendChild(this.createStroke()),e&&null!=a.fillColor?n.appendChild(this.createFill()):!this.pointerEvents||"shape"==n.nodeName&&this.path[this.path.length-1]!=this.closeOp?n.filled="false":n.appendChild(this.createTransparentFill()),this.root.appendChild(n)}},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,t=document.createElement(mxClient.VML_PREFIX+":fill");if(t.color=e.fillColor,null!=e.gradientColor){t.type="gradient",t.method="none",t.color2=e.gradientColor;var n=180-e.rotation;n=e.gradientDirection==mxConstants.DIRECTION_WEST?n-(90+("x"==this.root.style.flip?180:0)):e.gradientDirection==mxConstants.DIRECTION_EAST?n+(90+("x"==this.root.style.flip?180:0)):e.gradientDirection==mxConstants.DIRECTION_NORTH?n-(180+("y"==this.root.style.flip?-180:0)):n+("y"==this.root.style.flip?-180:0);"x"!=this.root.style.flip&&"y"!=this.root.style.flip||(n*=-1),t.angle=mxUtils.mod(n,360),t.opacity=100*e.alpha*e.fillAlpha+"%",t.setAttribute(mxClient.OFFICE_PREFIX+":opacity2",100*e.alpha*e.gradientAlpha+"%")}else e.alpha<1&&(t.opacity=100*e.alpha+"%");return t},mxVmlCanvas2D.prototype.createStroke=function(){var e=this.state,t=document.createElement(mxClient.VML_PREFIX+":stroke");return t.endcap=e.lineCap||"flat",t.joinstyle=e.lineJoin||"miter",t.miterlimit=e.miterLimit||"10",e.alpha<1&&(t.opacity=100*e.alpha+"%"),e.dashed&&(t.dashstyle=this.getVmlDashStyle()),t},mxVmlCanvas2D.prototype.getVmlDashStyle=function(){var e="dash";if(null!=this.state.dashPattern){var t=this.state.dashPattern.split(" ");0<t.length&&1==t[0]&&(e="0 2")}return e},mxVmlCanvas2D.prototype.createShadow=function(e,t,n){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))),n?(l.strokecolor=a.shadowColor,l.appendChild(this.createShadowStroke())):l.stroked="false",t?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,t,n,a,i){t&&n?e+=180:t?this.root.style.flip="x":n&&(this.root.style.flip="y"),(t?!n:n)&&(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,t,n,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*((t=(t+i.dy)*i.scale)-o);var r=(n=(n+i.dx)*i.scale)+2/3*(e-n);t=(a=(a+i.dy)*i.scale)+2/3*(t-a),this.path.push("c "+this.format(s+2/3*(e-s))+" "+this.format(o)+" "+this.format(r)+" "+this.format(t)+" "+this.format(n)+" "+this.format(a)),this.lastX=n/i.scale-i.dx,this.lastY=a/i.scale-i.dy},mxVmlCanvas2D.prototype.createRect=function(e,t,n,a,i){var s=this.state;return(e=document.createElement(e)).style.position="absolute",e.style.left=this.format((t+s.dx)*s.scale)+"px",e.style.top=this.format((n+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,t,n,a){this.node=this.createRect(mxClient.VML_PREFIX+":rect",e,t,n,a)},mxVmlCanvas2D.prototype.roundrect=function(e,t,n,a,i,s){this.node=this.createRect(mxClient.VML_PREFIX+":roundrect",e,t,n,a),this.node.setAttribute("arcsize",Math.max(100*i/n,100*s/a)+"%")},mxVmlCanvas2D.prototype.ellipse=function(e,t,n,a){this.node=this.createRect(mxClient.VML_PREFIX+":oval",e,t,n,a)},mxVmlCanvas2D.prototype.image=function(e,t,n,a,i,s,o,r){var l=null;s?((l=this.createRect(mxClient.VML_PREFIX+":rect",e,t,n,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,t,n,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,t,n,a){n=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)?n.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,n.appendChild(a)):(n.style.cssText=s,n.innerHTML=e),(e=n.style).fontSize=Math.round(i.fontSize/this.vmlScale)+"px",e.fontFamily=i.fontFamily,e.color=i.fontColor,e.verticalAlign="top",e.textAlign=t||"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"),n},mxVmlCanvas2D.prototype.text=function(e,t,n,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=(t=this.rotatePoint(e,t,u.rotation,u.rotationCx,u.rotationCy)).x,t=t.y),8==document.documentMode?(e+=u.dx,t+=u.dy):(e*=u.scale,t*=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(t)+"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<n&&(i.style.width=Math.round(n)+"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<n&&(i.style.width=Math.round(n)+"px"),0<a&&8==document.documentMode&&(i.style.maxHeight=Math.round(a)+"px")):d&&(i.style.width=n+"px",0<a&&(i.style.maxHeight=Math.round(a)+"px")),this.rotateHtml&&0!=r){n=r*(Math.PI/180),r=parseFloat(parseFloat(Math.cos(n)).toFixed(8)),m=parseFloat(parseFloat(Math.sin(-n)).toFixed(8)),(n%=2*Math.PI)<0&&(n+=2*Math.PI),(n%=Math.PI)>Math.PI/2&&(n=Math.PI-n),o=Math.cos(n);var h=Math.sin(n);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),n=i.offsetWidth,p=i.offsetHeight,mxClient.IS_QUIRKS&&(c||d)&&a<p&&(p=a,i.style.height=p+"px"),c=((a=p)-a*o+n*-h)/2-m*n*(g+.5)+r*a*(v+.5),d=(n-n*o+a*-h)/2+r*n*(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-n/2)*u.scale)+"px",g.style.top=this.format(t+(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-n/2)*u)+"px",l.style.top=this.format(t+(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),n=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+n*g*this.state.scale)+"px",l.style.top=this.format(t+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,t,n,a,mxUtils.htmlEntities(i,!1),s,o,r,l,d,c,m)}},mxVmlCanvas2D.prototype.plainText=function(e,t,n,a,i,s,o,r,l,d,c,m){e=(e+(a=this.state).dx)*a.scale,t=(t+a.dy)*a.scale,(n=document.createElement(mxClient.VML_PREFIX+":shape")).style.width="1px",n.style.height="1px",n.stroked="false",(d=document.createElement(mxClient.VML_PREFIX+":fill")).color=a.fontColor,d.opacity=100*a.alpha+"%",n.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),n.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=(n.style.rotation=m)*(Math.PI/180),i=Math.sin(o)*s,s*=Math.cos(o)),n.appendChild(d),n.style.left=this.format(e-i)+"px",n.style.top=this.format(t+s)+"px",this.root.appendChild(n)},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,t){if(null!=this.states&&(this.horizontal||this.vertical)&&null!=a&&null!=e){var n=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 t=!1;if(Math.abs(e-p)<d?(s=e-a.getCenterX(),d=Math.abs(e-p),t=!0):Math.abs(e-m)<d?(s=e-a.x,d=Math.abs(e-m),t=!0):Math.abs(e-u)<d&&(s=e-a.x-a.width,d=Math.abs(e-u),t=!0),t){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 n=this.graph.container;e-=this.graph.panDx,this.guideX.points=[new mxPoint(e,-this.graph.panDy),new mxPoint(e,n.scrollHeight-3-this.graph.panDy)]}r=r||t};for(var f=function(e){e+=this.graph.panDy;var t=!1;if(Math.abs(e-h)<c?(o=e-a.getCenterY(),c=Math.abs(e-h),t=!0):Math.abs(e-g)<c?(o=e-a.y,c=Math.abs(e-g),t=!0):Math.abs(e-v)<c&&(o=e-a.y-a.height,c=Math.abs(e-v),t=!0),t){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 n=this.graph.container;e-=this.graph.panDy,this.guideY.points=[new mxPoint(-this.graph.panDx,e),new mxPoint(n.scrollWidth-3-this.graph.panDx,e)]}l=l||t},b=0;b<this.states.length;b++){var E=this.states[b];null!=E&&(this.horizontal&&(e.call(this,E.getCenterX()),e.call(this,E.x),e.call(this,E.x+E.width)),this.vertical&&(f.call(this,E.getCenterY()),f.call(this,E.y),f.call(this,E.y+E.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",t&&(r||(t=a.x-(this.graph.snap(a.x/i-n.x)+n.x)*i,s=this.graph.snap(s/i)*i-t),l||(n=a.y-(this.graph.snap(a.y/i-n.y)+n.y)*i,o=this.graph.snap(o/i)*i-n)),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 t=0;t<e.length;t++)this.constraints.push(this.parseConstraint(e[t]))}},mxStencil.prototype.parseConstraint=function(e){var t=Number(e.getAttribute("x")),n=Number(e.getAttribute("y"));return e="1"==e.getAttribute("perimeter"),new mxConnectionConstraint(new mxPoint(t,n),e)},mxStencil.prototype.evaluateTextAttribute=function(e,t,n){return t=this.evaluateAttribute(e,t,n),e=e.getAttribute("localized"),(mxStencil.defaultLocalized&&null==e||"1"==e)&&(t=mxResources.get(t)),t},mxStencil.prototype.evaluateAttribute=function(e,t,n){return null==(t=e.getAttribute(t))&&(null!=(e=mxUtils.getTextContent(e))&&("function"==typeof(e=mxUtils.eval(e))&&(t=e(n)))),t},mxStencil.prototype.drawShape=function(e,t,n,a,i,s){this.drawChildren(e,t,n,a,i,s,this.bgNode,!1),this.drawChildren(e,t,n,a,i,s,this.fgNode,!0)},mxStencil.prototype.drawChildren=function(e,t,n,a,i,s,o,r){if(null!=o){var l=mxUtils.getValue(t.style,mxConstants.STYLE_DIRECTION,null);for(n=this.computeAspect(t.style,n,a,i,s,l),a=Math.min(n.width,n.height),a="inherit"==this.strokewidth?Number(mxUtils.getNumber(t.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,t,o,n,r),o=o.nextSibling}},mxStencil.prototype.computeAspect=function(e,t,n,a,i,s){e=t,t=a/this.w0;var o=i/this.h0;if(s="north"==s||"south"==s){o=a/this.h0,t=i/this.w0;var r=(a-i)/2;e+=r,n-=r}return"fixed"==this.aspect&&(t=o=Math.min(t,o),s?(e+=(i-this.w0*t)/2,n+=(a-this.h0*o)/2):(e+=(a-this.w0*t)/2,n+=(i-this.h0*o)/2)),new mxRectangle(e,n,t,o)},mxStencil.prototype.drawNode=function(e,t,n,a,i){var s=n.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(),n=n.firstChild;null!=n;)n.nodeType==mxConstants.NODETYPE_ELEMENT&&this.drawNode(e,t,n,a,i),n=n.nextSibling;else if("close"==s)e.close();else if("move"==s)e.moveTo(o+Number(n.getAttribute("x"))*l,r+Number(n.getAttribute("y"))*d);else if("line"==s)e.lineTo(o+Number(n.getAttribute("x"))*l,r+Number(n.getAttribute("y"))*d);else if("quad"==s)e.quadTo(o+Number(n.getAttribute("x1"))*l,r+Number(n.getAttribute("y1"))*d,o+Number(n.getAttribute("x2"))*l,r+Number(n.getAttribute("y2"))*d);else if("curve"==s)e.curveTo(o+Number(n.getAttribute("x1"))*l,r+Number(n.getAttribute("y1"))*d,o+Number(n.getAttribute("x2"))*l,r+Number(n.getAttribute("y2"))*d,o+Number(n.getAttribute("x3"))*l,r+Number(n.getAttribute("y3"))*d);else if("arc"==s)e.arcTo(Number(n.getAttribute("rx"))*l,Number(n.getAttribute("ry"))*d,Number(n.getAttribute("x-axis-rotation")),Number(n.getAttribute("large-arc-flag")),Number(n.getAttribute("sweep-flag")),o+Number(n.getAttribute("x"))*l,r+Number(n.getAttribute("y"))*d);else if("rect"==s)e.rect(o+Number(n.getAttribute("x"))*l,r+Number(n.getAttribute("y"))*d,Number(n.getAttribute("w"))*l,Number(n.getAttribute("h"))*d);else if("roundrect"==s)0==(t=n.getAttribute("arcsize"))&&(t=100*mxConstants.RECTANGLE_ROUNDING_FACTOR),c=Number(n.getAttribute("w"))*l,a=Number(n.getAttribute("h"))*d,t=Number(t)/100,t=Math.min(c*t,a*t),e.roundrect(o+Number(n.getAttribute("x"))*l,r+Number(n.getAttribute("y"))*d,c,a,t,t);else if("ellipse"==s)e.ellipse(o+Number(n.getAttribute("x"))*l,r+Number(n.getAttribute("y"))*d,Number(n.getAttribute("w"))*l,Number(n.getAttribute("h"))*d);else if("image"==s)t=this.evaluateAttribute(n,"src",t),e.image(o+Number(n.getAttribute("x"))*l,r+Number(n.getAttribute("y"))*d,Number(n.getAttribute("w"))*l,Number(n.getAttribute("h"))*d,t,!1,"1"==n.getAttribute("flipH"),"1"==n.getAttribute("flipV"));else if("text"==s){if(c=this.evaluateTextAttribute(n,"str",t),a="1"==n.getAttribute("vertical")?-90:0,"0"==n.getAttribute("align-shape")){var m=t.rotation,u=1==mxUtils.getValue(t.style,mxConstants.STYLE_FLIPH,0);t=1==mxUtils.getValue(t.style,mxConstants.STYLE_FLIPV,0),a=u&&t?a-m:u||t?a+m:a-m}a-=n.getAttribute("rotation"),e.text(o+Number(n.getAttribute("x"))*l,r+Number(n.getAttribute("y"))*d,0,0,c,n.getAttribute("align")||"left",n.getAttribute("valign")||"top",!1,"",!1,!1,a)}else if("include-shape"==s)null!=(m=mxStencilRegistry.getStencil(n.getAttribute("name")))&&(o+=Number(n.getAttribute("x"))*l,r+=Number(n.getAttribute("y"))*d,c=Number(n.getAttribute("w"))*l,a=Number(n.getAttribute("h"))*d,m.drawShape(e,t,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(n.getAttribute("width"))*c);else if("dashed"==s)e.setDashed("1"==n.getAttribute("dashed"));else if("dashpattern"==s){if(null!=(n=n.getAttribute("pattern"))){for(n=n.split(" "),l=[],d=0;d<n.length;d++)0<n[d].length&&l.push(Number(n[d])*c);n=l.join(" "),e.setDashPattern(n)}}else"strokecolor"==s?e.setStrokeColor(n.getAttribute("color")):"linecap"==s?e.setLineCap(n.getAttribute("cap")):"linejoin"==s?e.setLineJoin(n.getAttribute("join")):"miterlimit"==s?e.setMiterLimit(Number(n.getAttribute("limit"))):"fillcolor"==s?e.setFillColor(n.getAttribute("color")):"alpha"==s?e.setAlpha(n.getAttribute("alpha")):"fontcolor"==s?e.setFontColor(n.getAttribute("color")):"fontstyle"==s?e.setFontStyle(n.getAttribute("style")):"fontfamily"==s?e.setFontFamily(n.getAttribute("family")):"fontsize"==s&&e.setFontSize(Number(n.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 t=1;t<this.points.length;t++)null!=e[t]&&this.bounds.add(new mxRectangle(Number(e[t].x),Number(e[t].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,t=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!=(t=this.getSvgScreenOffset())?this.node.setAttribute("transform","translate("+t+","+t+")"):this.node.removeAttribute("transform");else{this.updateVmlContainer();var n=Math.max(1,Math.round(this.bounds.width)),a=Math.max(1,Math.round(this.bounds.height));t=8==document.documentMode&&this.isParseVml()?this.createVmlGroup():this.node,e=new mxVmlCanvas2D(t,!1);""!=t.tagUrn&&(t.coordsize=n*this.vmlScale+","+a*this.vmlScale,e.scale(this.vmlScale),e.vmlScale=this.vmlScale),t=this.scale,e.translate(-Math.round(this.bounds.x/t),-Math.round(this.bounds.y/t))}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)),t=Math.max(1,Math.round(this.bounds.height));this.node.style.width=e+"px",this.node.style.height=t+"px",this.node.style.overflow="visible"},mxShape.prototype.destroyCanvas=function(e){if(e instanceof mxSvgCanvas2D){for(var t in e.gradients){var n=e.gradients[t];n.mxRefCount=(n.mxRefCount||0)+1}this.releaseSvgGradients(this.oldGradients),this.oldGradients=e.gradients}},mxShape.prototype.paint=function(e){var t=this.scale,n=this.bounds.x/t,a=this.bounds.y/t,i=this.bounds.width/t,s=this.bounds.height/t;if(this.isPaintBoundsInverted()){n=n+(o=(i-s)/2),a=a-o;var o=i;i=s,s=o}if(this.updateTransform(e,n,a,i,s),this.configureCanvas(e,n,a,i,s),null!=this.stencil)this.paintStencilShape(e,n,a,i,s);else if(e.setStrokeWidth(this.strokewidth),null!=this.points){for(n=[],a=0;a<this.points.length;a++)n.push(new mxPoint(this.points[a].x/t,this.points[a].y/t));this.paintEdgeShape(e,n)}else this.paintVertexShape(e,n,a,i,s)},mxShape.prototype.configureCanvas=function(e,t,n,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?(t=this.getGradientBounds(e,t,n,a,i),e.setGradient(this.fill,this.gradient,t.x,t.y,t.width,t.height,this.gradientDirection)):e.setFillColor(this.fill),e.setStrokeColor(this.stroke)},mxShape.prototype.getGradientBounds=function(e,t,n,a,i){return new mxRectangle(t,n,a,i)},mxShape.prototype.updateTransform=function(e,t,n,a,i){e.scale(this.scale),e.rotate(this.getShapeRotation(),this.flipH,this.flipV,t+a/2,n+i/2)},mxShape.prototype.paintStencilShape=function(e,t,n,a,i){this.stencilPointerEvents&&(this.dialect==mxConstants.DIALECT_SVG?this.addTransparentBackgroundRectangle(this.node,t,n,a,i):8!=document.documentMode&&this.setTransparentBackgroundImage(this.node)),this.stencil.drawShape(e,this,t,n,a,i)},mxShape.prototype.paintVertexShape=function(e,t,n,a,i){this.paintBackground(e,t,n,a,i),e.setShadow(!1),this.paintForeground(e,t,n,a,i)},mxShape.prototype.paintBackground=function(e,t,n,a,i){},mxShape.prototype.paintForeground=function(e,t,n,a,i){},mxShape.prototype.paintEdgeShape=function(e,t){},mxShape.prototype.getArcSize=function(e,t){var n=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,100*mxConstants.RECTANGLE_ROUNDING_FACTOR)/100;return Math.min(e*n,t*n)},mxShape.prototype.paintGlassEffect=function(e,t,n,a,i,s){var o=Math.ceil(this.strokewidth/2);e.setGradient("#ffffff","#ffffff",t,n,a,.6*i,"south",.9,.1),e.begin(),s+=2*o,this.isRounded?(e.moveTo(t-o+s,n-o),e.quadTo(t-o,n-o,t-o,n-o+s),e.lineTo(t-o,n+.4*i),e.quadTo(t+.5*a,n+.7*i,t+a+o,n+.4*i),e.lineTo(t+a+o,n-o+s),e.quadTo(t+a+o,n-o,t+a+o-s,n-o)):(e.moveTo(t-o,n-o),e.lineTo(t-o,n+.4*i),e.quadTo(t+.5*a,n+.7*i,t+a+o,n+.4*i),e.lineTo(t+a+o,n-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 t=this.getShapeRotation();0!=t&&(e=mxUtils.getBoundingBox(e,t)),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 t=(e.width-e.height)/2;e.x+=t,e.y-=t,t=e.width,e.width=e.height,e.height=t}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 t=Math.ceil(this.strokewidth*this.scale);e.grow(Math.ceil(t/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,t,n,a,i){(e=document.createElementNS(mxConstants.NS_SVG,"rect")).setAttribute("x",t),e.setAttribute("y",n),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 t in e){var n=e[t];n.mxRefCount=(n.mxRefCount||0)-1,0==n.mxRefCount&&null!=n.parentNode&&n.parentNode.removeChild(n)}},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,t){mxStencilRegistry.stencils[e]=t},getStencil:function(e){return mxStencilRegistry.stencils[e]}},mxMarker={markers:[],addMarker:function(e,t){mxMarker.markers[e]=t},createMarker:function(e,t,n,a,i,s,o,r,l,d){var c=mxMarker.markers[n];return null!=c?c(e,t,n,a,i,s,o,r,l,d):null}};function mxActor(e,t,n,a){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=n,this.strokewidth=null!=a?a:1}function mxCloud(e,t,n,a){mxActor.call(this),this.bounds=e,this.fill=t,this.stroke=n,this.strokewidth=null!=a?a:1}function mxRectangleShape(e,t,n,a){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=n,this.strokewidth=null!=a?a:1}function mxEllipse(e,t,n,a){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=n,this.strokewidth=null!=a?a:1}function mxDoubleEllipse(e,t,n,a){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=n,this.strokewidth=null!=a?a:1}function mxRhombus(e,t,n,a){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=n,this.strokewidth=null!=a?a:1}function mxPolyline(e,t,n){mxShape.call(this),this.points=e,this.stroke=t,this.strokewidth=null!=n?n:1}function mxArrow(e,t,n,a,i,s,o){mxShape.call(this),this.points=e,this.fill=t,this.stroke=n,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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f,b,E){mxShape.call(this),this.value=e,this.bounds=t,this.color=null!=i?i:"black",this.align=null!=n?n:"",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!=E?E:0,this.rotation=0}function mxTriangle(){mxActor.call(this)}function mxHexagon(){mxActor.call(this)}function mxLine(e,t,n){mxShape.call(this),this.bounds=e,this.stroke=t,this.strokewidth=null!=n?n:1}function mxImageShape(e,t,n,a,i){mxShape.call(this),this.bounds=e,this.image=t,this.fill=n,this.stroke=a,this.strokewidth=null!=i?i:1,this.shadow=!1}function mxLabel(e,t,n,a){mxRectangleShape.call(this,e,t,n,a)}function mxCylinder(e,t,n,a){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=n,this.strokewidth=null!=a?a:1}function mxConnector(e,t,n){mxPolyline.call(this,e,t,n)}function mxSwimlane(e,t,n,a){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=n,this.strokewidth=null!=a?a:1}function mxGraphLayout(e){this.graph=e}function mxStackLayout(e,t,n,a,i,s){mxGraphLayout.call(this,e),this.horizontal=null==t||t,this.spacing=null!=n?n:0,this.x0=null!=a?a:0,this.y0=null!=i?i:0,this.border=null!=s?s:0}function mxPartitionLayout(e,t,n,a){mxGraphLayout.call(this,e),this.horizontal=null==t||t,this.spacing=n||0,this.border=a||0}function mxCompactTreeLayout(e,t,n){mxGraphLayout.call(this,e),this.horizontal=null==t||t,this.invert=null!=n&&n}function WeightedCellSorter(e,t){this.cell=e,this.weightedValue=t}function mxFastOrganicLayout(e){mxGraphLayout.call(this,e)}function mxCircleLayout(e,t){mxGraphLayout.call(this,e),this.radius=null!=t?t:100}function mxParallelEdgeLayout(e){mxGraphLayout.call(this,e)}function mxCompositeLayout(e,t,n){mxGraphLayout.call(this,e),this.layouts=t,this.master=n}function mxEdgeLabelLayout(e,t){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,t,n,a,i){for(e.getGraph(),this.tightenToSource=i,this.roots=n,this.parent=a,this.vertexMapper={},this.edgeMapper={},this.maxRank=0,n=[],null==t&&(t=this.graph.getChildVertices(a)),this.maxRank=this.SOURCESCANSTARTRANK,this.createInternalCells(e,t,n),a=0;a<t.length;a++){i=n[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];n[a]==l&&(l=e.getVisibleTerminal(r,!0),l=mxCellPath.create(l),l=this.vertexMapper[l]),null!=l&&n[a]!=l&&(0==(o.target=l).connectsAsTarget.length&&(l.connectsAsTarget=[]),mxUtils.indexOf(l.connectsAsTarget,o)<0&&l.connectsAsTarget.push(o))}}n[a].temp[0]=1}}function mxHierarchicalLayoutStage(){}function mxMedianHybridCrossingReduction(e){this.layout=e}function MedianCellSorter(){}function mxMinimumCycleRemover(e){this.layout=e}function mxCoordinateAssignment(e,t,n,a,i,s){this.layout=e,this.intraCellSpacing=t,this.interRankCellSpacing=n,this.orientation=a,this.initialX=i,this.parallelEdgeSpacing=s}!function(){function e(e,t,n,a,i,s,o,r,l,d){t=1.118*i*l,r=1.118*s*l,i*=o+l,s*=o+l;var c=a.clone();return c.x-=t,c.y-=r,o=n!=mxConstants.ARROW_CLASSIC?1:.75,a.x+=-i*o-t,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),n==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 t(e,t,n,a,i,s,o,r,l,d){r=n==mxConstants.ARROW_DIAMOND?.7071:.9862,t=i*l*r,r*=s*l,i*=o+l,s*=o+l;var c=a.clone();c.x-=t,c.y-=r,a.x+=-i-t,a.y+=-s-r;var m=n==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,t,n,a,i,s,o,r,l,d){t=1.118*i*l,n=1.118*s*l,i*=o+l,s*=o+l;var c=a.clone();return c.x-=t,c.y-=n,a.x+=2*-t,a.y+=2*-n,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,t,n,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",t),mxMarker.addMarker("diamondThin",t)}(),mxUtils.extend(mxActor,mxShape),mxActor.prototype.paintVertexShape=function(e,t,n,a,i){e.translate(t,n),e.begin(),this.redrawPath(e,t,n,a,i),e.fillAndStroke()},mxActor.prototype.redrawPath=function(e,t,n,a,i){t=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-t,2*i/5,a/2-t,0,a/2,0),e.curveTo(a/2+t,0,a/2+t,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,t,n,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,t,n,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(t,n,a,i,s,s)}else e.rect(t,n,a,i);e.fillAndStroke()},mxRectangleShape.prototype.paintForeground=function(e,t,n,a,i){this.glass&&this.paintGlassEffect(e,t,n,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 t=9<=document.documentMode?0:Math.ceil(this.strokewidth*this.scale);e.style.borderWidth=Math.max(1,t)+"px",e.style.overflow="hidden",e.style.left=Math.round(this.bounds.x-t/2)+"px",e.style.top=Math.round(this.bounds.y-t/2)+"px","CSS1Compat"==document.compatMode&&(t=-t),e.style.width=Math.round(Math.max(0,this.bounds.width+t))+"px",e.style.height=Math.round(Math.max(0,this.bounds.height+t))+"px"},mxRectangleShape.prototype.updateHtmlColors=function(e){var t=this.stroke;null!=t&&t!=mxConstants.NONE?(e.style.borderColor=t,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!=(t=this.fill)&&t!=mxConstants.NONE?(e.style.backgroundColor=t,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 t="";if(this.opacity<100&&(t+="alpha(opacity="+this.opacity+")"),this.isShadow&&(t+="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 n=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=n,n=a,a=s):2==o?(s=n,n=a,a=s):3==o&&(i="1"),t+="progid:DXImageTransform.Microsoft.gradient(startColorStr='"+n+"', endColorStr='"+a+"', gradientType='"+i+"')"}e.style.filter=t},mxUtils.extend(mxEllipse,mxShape),mxEllipse.prototype.paintVertexShape=function(e,t,n,a,i){e.ellipse(t,n,a,i),e.fillAndStroke()},mxUtils.extend(mxDoubleEllipse,mxShape),mxDoubleEllipse.prototype.vmlScale=10,mxDoubleEllipse.prototype.paintBackground=function(e,t,n,a,i){e.ellipse(t,n,a,i),e.fillAndStroke()},mxDoubleEllipse.prototype.paintForeground=function(e,t,n,a,i){var s=Math.min(4,Math.min(a/5,i/5));i-=2*s,0<(a-=2*s)&&0<i&&e.ellipse(t+s,n+s,a,i),e.stroke()},mxUtils.extend(mxRhombus,mxShape),mxRhombus.prototype.paintVertexShape=function(e,t,n,a,i){var s=a/2,o=i/2;e.begin(),e.moveTo(t+s,n),e.lineTo(t+a,n+o),e.lineTo(t+s,n+i),e.lineTo(t,n+o),e.close(),e.fillAndStroke()},mxUtils.extend(mxPolyline,mxShape),mxPolyline.prototype.getRotation=function(){return 0},mxPolyline.prototype.paintEdgeShape=function(e,t){this.paintLine(e,t,this.isRounded)},mxPolyline.prototype.paintLine=function(e,t,n){var a=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,mxConstants.LINE_ARCSIZE)/2,i=t[0],s=t[t.length-1];e.begin(),e.moveTo(i.x,i.y);for(var o=1;o<t.length-1;o++){var r=t[o],l=i.x-r.x;i=i.y-r.y;if(n&&o<t.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=t[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,t){var n=mxConstants.ARROW_SPACING,a=mxConstants.ARROW_WIDTH,i=mxConstants.ARROW_SIZE,s=t[0],o=t[t.length-1],r=o.x-s.x,l=o.y-s.y,d=(c=Math.sqrt(r*r+l*l))-2*n-i,c=(r=r/c,a*(l=l/c)/3),m=(a=-a*r/3,(i=s.x-c/2+n*r)+c),u=(s=s.y-a/2+n*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-n*r,o.y-n*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 t=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 n=null,a=null;if(null!=e.ownerSVGElement)if(null!=e.firstChild&&null!=e.firstChild.firstChild&&"foreignObject"==e.firstChild.firstChild.nodeName)e=e.firstChild.firstChild,n=this.wrap?this.bounds.width:parseInt(e.getAttribute("width"))*this.scale,a=parseInt(e.getAttribute("height"))*this.scale;else{if(0==(t=e.getBBox()).width&&0==t.height)return;this.boundingBox=new mxRectangle(t.x,t.y,t.width,t.height),t=0}else a=this.state.view.textDiv,a=null!=this.offsetWidth&&null!=this.offsetHeight?(n=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:(n=this.replaceLinefeeds?this.value.replace(/\n/g,"<br/>"):this.value,a.innerHTML=n),n=this.wrap?this.bounds.width:a.offsetWidth*this.scale,a.offsetHeight*this.scale):(n=this.wrap?this.bounds.width:e.offsetWidth*this.scale,e.offsetHeight*this.scale);null!=n&&null!=a&&(this.boundingBox=new mxRectangle(this.bounds.x+this.margin.x*n,this.bounds.y+this.margin.y*a,n,a))}null!=this.boundingBox&&(0!=t&&(t=mxUtils.getBoundingBox(this.boundingBox,t),this.boundingBox.x=t.x,this.boundingBox.y=t.y,mxClient.IS_QUIRKS||(this.boundingBox.width=t.width,this.boundingBox.height=t.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,t,n,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 t=this.scale,n=this.bounds.x/t,a=this.bounds.y/t,i=this.bounds.width/t;t=this.bounds.height/t;this.updateTransform(e,n,a,i,t),this.configureCanvas(e,n,a,i,t);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(n,a,i,t,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(),t=this.node.style,n=this.margin.x,a=this.margin.y;0!=e?(t[mxClient.CSS_PREFIX+"TransformOrigin"]=100*-n+"% "+100*-a+"%",t[mxClient.CSS_PREFIX+"Transform"]="translate("+100*n+"%,"+100*a+"%)scale("+this.scale+") rotate("+e+"deg)"):(t[mxClient.CSS_PREFIX+"TransformOrigin"]="0% 0%",t[mxClient.CSS_PREFIX+"Transform"]="scale("+this.scale+")translate("+100*n+"%,"+100*a+"%)"),t.left=Math.round(this.bounds.x)+"px",t.top=Math.round(this.bounds.y)+"px"},mxText.prototype.updateHtmlFilter=function(){var e=this.node.style,t=this.margin.x,n=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*(t=r*-(t+.5))-s*(n=o*-(n+.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*t-l*n)-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 t=null!=this.background&&this.background!=mxConstants.NONE?this.background:null,n=null!=this.border&&this.border!=mxConstants.NONE?this.border:null;if(null!=t||null!=n)if("fill"==this.overflow)null!=t&&(this.node.style.backgroundColor=t),null!=n&&(this.node.style.border="1px solid "+n);else{var a="";null!=t&&(a+="background-color:"+t+";"),null!=n&&(a+="border:1px solid "+n+";"),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 t=Math.round(this.bounds.width/this.scale),n=Math.round(this.bounds.height/this.scale);e=e.style,this.clipped?(e.overflow="hidden",0<n&&(e.maxHeight=n+"px"),0<t&&(e.width=t+"px")):"fill"==this.overflow&&(e.width=t+"px",0<n&&(e.maxHeight=n+"px")),this.wrap?(!this.clipped&&0<t&&(e.width=t+"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,t,n,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,t,n,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,t,n,a,i){n+=i/2,e.begin(),e.moveTo(t,n),e.lineTo(t+a,n),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,t,n,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(t,n,a,i),e.fillAndStroke()),e.image(t,n,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 t=this.opacity<100?"alpha(opacity="+this.opacity+")":"";this.node.style.filter=t,this.flipH&&this.flipV?t+="progid:DXImageTransform.Microsoft.BasicImage(rotation=2)":this.flipH?t+="progid:DXImageTransform.Microsoft.BasicImage(mirror=1)":this.flipV&&(t+="progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)"),e.style.filter!=t&&(e.style.filter=t),"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,t,n,a,i){this.paintImage(e,t,n,a,i),this.paintIndicator(e,t,n,a,i),mxRectangleShape.prototype.paintForeground.apply(this,arguments)},mxLabel.prototype.paintImage=function(e,t,n,a,i){null!=this.image&&(t=this.getImageBounds(t,n,a,i),e.image(t.x,t.y,t.width,t.height,this.image,!1,!1,!1))},mxLabel.prototype.getImageBounds=function(e,t,n,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+(n-o)/2:i==mxConstants.ALIGN_RIGHT?e+(n-o-l):e+l,t=s==mxConstants.ALIGN_TOP?t+l:s==mxConstants.ALIGN_BOTTOM?t+(a-r-l):t+(a-r)/2,o,r)},mxLabel.prototype.paintIndicator=function(e,t,n,a,i){null!=this.indicator?(this.indicator.bounds=this.getIndicatorBounds(t,n,a,i),this.indicator.paint(e)):null!=this.indicatorImage&&(t=this.getIndicatorBounds(t,n,a,i),e.image(t.x,t.y,t.width,t.height,this.indicatorImage,!1,!1,!1))},mxLabel.prototype.getIndicatorBounds=function(e,t,n,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+(n-o-l):i==mxConstants.ALIGN_CENTER?e+(n-o)/2:e+l,t=s==mxConstants.ALIGN_BOTTOM?t+(a-r-l):s==mxConstants.ALIGN_TOP?t+l:t+(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 t=this.getImageBounds(this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height);t.x-=this.bounds.x,t.y-=this.bounds.y,e.style.left=Math.round(t.x)+"px",e.style.top=Math.round(t.y)+"px",e.style.width=Math.round(t.width)+"px",e.style.height=Math.round(t.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,t,n,a,i){e.translate(t,n),e.begin(),this.redrawPath(e,t,n,a,i,!1),e.fillAndStroke(),e.setShadow(!1),e.begin(),this.redrawPath(e,t,n,a,i,!0),e.stroke()},mxCylinder.prototype.redrawPath=function(e,t,n,a,i,s){t=Math.min(this.maxHeight,Math.round(i/5)),(s&&null!=this.fill||!s&&null==this.fill)&&(e.moveTo(0,t),e.curveTo(0,2*t,a,2*t,a,t),s||(e.stroke(),e.begin())),s||(e.moveTo(0,t),e.curveTo(0,-t/3,a,-t/3,a,t),e.lineTo(a,i-t),e.curveTo(a,i+t/3,0,i+t/3,0,i-t),e.close())},mxUtils.extend(mxConnector,mxPolyline),mxConnector.prototype.paintEdgeShape=function(e,t){var n=this.createMarker(e,t,!0),a=this.createMarker(e,t,!1);null==this.style||1!=this.style[mxConstants.STYLE_CURVED]?this.paintLine(e,t,this.isRounded):this.paintCurvedLine(e,t),e.setFillColor(this.stroke),e.setShadow(!1),e.setDashed(!1),null!=n&&n(),null!=a&&a()},mxConnector.prototype.paintCurvedLine=function(e,t){e.begin();var n=t[0],a=t.length;for(e.moveTo(n.x,n.y),n=1;n<a-2;n++){var i=t[n],s=t[n+1];e.quadTo(i.x,i.y,(i.x+s.x)/2,(i.y+s.y)/2)}i=t[a-2],s=t[a-1],e.quadTo(i.x,i.y,s.x,s.y),e.stroke()},mxConnector.prototype.createMarker=function(e,t,n){var a=t.length,i=n?t[1]:t[a-2],s=(a=(t=n?t[0]:t[a-1]).x-i.x,t.y-i.y),o=(i=a/(o=Math.max(1,Math.sqrt(a*a+s*s))),a=s/o,s=mxUtils.getNumber(this.style,n?mxConstants.STYLE_STARTSIZE:mxConstants.STYLE_ENDSIZE,mxConstants.DEFAULT_MARKERSIZE),mxUtils.getValue(this.style,n?mxConstants.STYLE_STARTARROW:mxConstants.STYLE_ENDARROW));return mxMarker.createMarker(e,this,o,t,i,a,s,n,this.strokewidth,0!=this.style[n?mxConstants.STYLE_STARTFILL:mxConstants.STYLE_ENDFILL])},mxConnector.prototype.augmentBoundingBox=function(e){mxShape.prototype.augmentBoundingBox.apply(this,arguments);var t=0;mxUtils.getValue(this.style,mxConstants.STYLE_STARTARROW,mxConstants.NONE)!=mxConstants.NONE&&(t=mxUtils.getNumber(this.style,mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_MARKERSIZE)+1),mxUtils.getValue(this.style,mxConstants.STYLE_ENDARROW,mxConstants.NONE)!=mxConstants.NONE&&(t=Math.max(t,mxUtils.getNumber(this.style,mxConstants.STYLE_ENDSIZE,mxConstants.DEFAULT_MARKERSIZE))+1),e.grow(Math.ceil(t*this.scale))},mxUtils.extend(mxSwimlane,mxShape),mxSwimlane.prototype.imageSize=16,mxSwimlane.prototype.getGradientBounds=function(e,t,n,a,i){return new mxRectangle(t,n,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,t,n){return 3*n*(mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,100*mxConstants.RECTANGLE_ROUNDING_FACTOR)/100)},mxSwimlane.prototype.paintVertexShape=function(e,t,n,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(t,n),this.isRounded?(l=this.getArcSize(a,i,s),this.paintRoundedSwimlane(e,t,n,a,i,s,l,o,r)):this.paintSwimlane(e,t,n,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(t,s,a,i),e.image(i.x-t,i.y-n,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,t,n,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,t,n,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,t,n,a,i){i!=mxConstants.NONE&&(e.setStrokeColor(i),e.setDashed(!0),e.begin(),e.moveTo(t,n),e.lineTo(t,a),e.stroke(),e.setDashed(!1))},mxSwimlane.prototype.getImageBounds=function(e,t,n,a){return new mxRectangle(e+n-this.imageSize,t,this.imageSize,this.imageSize)},mxGraphLayout.prototype.graph=null,mxGraphLayout.prototype.useBoundingBox=!0,mxGraphLayout.prototype.parent=null,mxGraphLayout.prototype.moveCell=function(e,t,n){},mxGraphLayout.prototype.execute=function(e){},mxGraphLayout.prototype.getGraph=function(){return this.graph},mxGraphLayout.prototype.getConstraint=function(e,t,n,a){return null!=(t=null!=(n=this.graph.view.getState(t))?n.style:this.graph.getCellStyle(t))?t[e]:null},mxGraphLayout.traverse=function(e,t,n,a,i){if(null!=n&&null!=e){t=null==t||t,i=i||[];var s=mxCellPath.create(e);if(null==i[s]&&(null==(a=n(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;t&&!r||(r=this.graph.view.getVisibleTerminal(o,!r),this.traverse(r,t,n,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 t=this.graph.getModel();return!t.isEdge(e)||!this.graph.isCellVisible(e)||null==t.getTerminal(e,!0)||null==t.getTerminal(e,!1)},mxGraphLayout.prototype.setEdgeStyleEnabled=function(e,t){this.graph.setCellStyles(mxConstants.STYLE_NOEDGESTYLE,t?"0":"1",[e])},mxGraphLayout.prototype.setOrthogonalEdge=function(e,t){this.graph.setCellStyles(mxConstants.STYLE_ORTHOGONAL,t?"1":"0",[e])},mxGraphLayout.prototype.getParentOffset=function(e){var t=new mxPoint;if(null!=e&&e!=this.parent){var n=this.graph.getModel();if(n.isAncestor(this.parent,e))for(var a=n.getGeometry(e);e!=this.parent;)t.x+=a.x,t.y+=a.y,e=n.getParent(e),a=n.getGeometry(e)}return t},mxGraphLayout.prototype.setEdgePoints=function(e,t){if(null!=e){var n=this.graph.model,a=n.getGeometry(e);if(null==a?(a=new mxGeometry).setRelative(!0):a=a.clone(),null!=this.parent&&null!=t)for(var i=n.getParent(e),s=(i=this.getParentOffset(i),0);s<t.length;s++)t[s].x-=i.x,t[s].y-=i.y;a.points=t,n.setGeometry(e,a)}},mxGraphLayout.prototype.setVertexLocation=function(e,t,n){var a=this.graph.getModel(),i=a.getGeometry(e),s=null;if(null!=i){if(s=new mxRectangle(t,n,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&&(t+=(o.x-l.x)/r,s.width=l.width),o.text.boundingBox.y<o.y&&(n+=(o.y-l.y)/r,s.height=l.height)}}null!=this.parent&&(null!=(o=a.getParent(e))&&o!=this.parent&&(t-=(o=this.getParentOffset(o)).x,n-=o.y)),i.x==t&&i.y==n||((i=i.clone()).x=t,i.y=n,a.setGeometry(e,i))}return s},mxGraphLayout.prototype.getVertexBounds=function(e){var t=this.graph.getModel().getGeometry(e);if(this.useBoundingBox&&(null!=(r=this.graph.getView().getState(e))&&null!=r.text&&null!=r.text.boundingBox)){var n=this.graph.getView().scale,a=r.text.boundingBox,i=Math.max(r.x-a.x,0)/n,s=Math.max(r.y-a.y,0)/n,o=Math.max(a.x+a.width-(r.x+r.width),0)/n,r=Math.max(a.y+a.height-(r.y+r.height),0)/n;t=new mxRectangle(t.x-i,t.y-s,t.width+i+o,t.height+s+r)}return null!=this.parent&&(e=this.graph.getModel().getParent(e),t=t.clone(),null!=e&&e!=this.parent&&(e=this.getParentOffset(e),t.x+=e.x,t.y+=e.y)),new mxRectangle(t.x,t.y,t.width,t.height)},mxGraphLayout.prototype.arrangeGroups=function(e,t){this.graph.getModel().beginUpdate();try{for(var n=e.length-1;0<=n;n--){var a=e[n],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-t-r,o.y=o.y+s.y-t-l,o.width=s.width+2*t+r,o.height=s.height+2*t+l,this.graph.getModel().setGeometry(a,o),this.graph.moveCells(i,t+r-s.x,t+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,t,n){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(t=s?t:n,null!=(o=this.graph.getView().getState(i))&&(t-=s?o.x:o.y),o=0;o<l;o++)if((n=a.getChildAt(i,o))!=e&&null!=(n=a.getGeometry(n))){if(n=s?n.x+n.width/2:n.y+n.height/2,r<t&&t<n)break;r=n}s=i.getIndex(e),s=Math.max(0,o-(s<o?1:0)),a.add(i,e,s)}},mxStackLayout.prototype.getParentSize=function(e){var t=this.graph.getModel(),n=t.getGeometry(e);return null!=this.graph.container&&(null==n&&t.isLayer(e)||e==this.graph.getView().currentRoot)&&(n=new mxRectangle(0,0,this.graph.container.offsetWidth-1,this.graph.container.offsetHeight-1)),n},mxStackLayout.prototype.execute=function(e){if(null!=e){var t=this.isHorizontal(),n=this.graph.getModel(),a=this.getParentSize(e),i=0;null!=a&&(i=t?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);t==(r=mxUtils.getValue(r,mxConstants.STYLE_HORIZONTAL,!0))&&(i-=l),t?o+=l:s+=l}n.beginUpdate();try{l=0,r=null;for(var d=n.getChildCount(e),c=0;c<d;c++){var m=n.getChildAt(e,c);if(!this.isVertexIgnored(m)&&this.isVertexMovable(m)){var u=n.getGeometry(m);null!=u&&(u=u.clone(),null!=this.wrap&&null!=r&&(t&&r.x+r.width+u.width+2*this.spacing>this.wrap||!t&&r.y+r.height+u.height+2*this.spacing>this.wrap)&&(r=null,t?o+=l+this.spacing:s+=l+this.spacing,l=0),l=Math.max(l,t?u.height:u.width),null!=r?t?u.x=r.x+r.width+this.spacing:u.y=r.y+r.height+this.spacing:this.keepFirstLocation||(t?u.x=s:u.y=o),t?u.y=o:u.x=s,this.fill&&0<i&&(t?u.height=i:u.width=i),n.setGeometry(m,u),r=u)}}this.resizeParent&&null!=a&&null!=r&&!this.graph.isCellCollapsed(e)?(a=a.clone(),t?a.width=r.x+r.width+this.spacing:a.height=r.y+r.height+this.spacing,n.setGeometry(e,a)):this.resizeLast&&null!=a&&null!=r&&(t?r.width=a.width-r.x-this.spacing:r.height=a.height-r.y-this.spacing)}finally{n.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,t,n){var a=(n=this.graph.getModel()).getParent(e);if(null!=e&&null!=a){var i=0,s=0,o=n.getChildCount(a);for(i=0;i<o;i++){var r=n.getChildAt(a,i);if(null!=(r=this.getVertexBounds(r))){if(r=r.x+r.width/2,s<t&&t<r)break;s=r}}t=a.getIndex(e),t=Math.max(0,i-(t<i?1:0)),n.add(a,e,t)}},mxPartitionLayout.prototype.execute=function(e){var t=this.isHorizontal(),n=this.graph.getModel(),a=n.getGeometry(e);if(null!=this.graph.container&&(null==a&&n.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=n.getChildCount(e),o=0;o<s;o++){var r=n.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=t?a.height:a.width)-2*this.border;if(e=this.graph.isSwimlane(e)?this.graph.getStartSize(e):new mxRectangle,c-=t?e.height:e.width,l+=e.width,d+=e.height,e=this.border+(s-1)*this.spacing,0<(a=t?(a.width-l-e)/s:(a.height-d-e)/s)){n.beginUpdate();try{for(o=0;o<s;o++){r=i[o];var m=n.getGeometry(r);null!=m&&((m=m.clone()).x=l,m.y=d,t?(this.resizeVertices&&(m.width=a,m.height=c),l+=a+this.spacing):(this.resizeVertices&&(m.height=a,m.width=c),d+=a+this.spacing),n.setGeometry(r,m))}}finally{n.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,t){this.parent=e;var n=this.graph.getModel();if(null==t)if(0<this.graph.getEdges(e,n.getParent(e),this.invert,!this.invert,!1).length)t=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){t=o[a];break}}if(null!=t){this.parentsChanged=this.resizeParent?{}:null,n.beginUpdate();try{var i=this.dfs(t,e);if(null!=i){this.layout(i);var s=this.graph.gridSize,o=s;if(!this.moveTree){var r=this.getVertexBounds(t);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{n.endUpdate()}}},mxCompactTreeLayout.prototype.moveNode=function(e,t,n){for(e.x+=t,e.y+=n,this.apply(e),e=e.child;null!=e;)this.moveNode(e,t,n),e=e.next},mxCompactTreeLayout.prototype.dfs=function(e,t,n){n=null!=n?n:[];var a=mxCellPath.create(e),i=null;if(null!=e&&null==n[a]&&!this.isVertexIgnored(e)){n[a]=e;i=this.createNode(e),a=this.graph.getModel();var s=null;e=this.graph.getEdges(e,t,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,t,n))&&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 t=e.child;null!=t;)this.layout(t),t=t.next;null!=e.child?this.attachParent(e,this.join(e)):this.layoutLeaf(e)}},mxCompactTreeLayout.prototype.horizontalLayout=function(e,t,n,a){if(e.x+=t+e.offsetX,e.y+=n+e.offsetY,a=this.apply(e,a),null!=(t=e.child)){a=this.horizontalLayout(t,e.x,e.y,a),n=e.y+t.offsetY;for(var i=t.next;null!=i;)a=this.horizontalLayout(i,e.x+t.offsetX,n,a),n+=i.offsetY,i=i.next}return a},mxCompactTreeLayout.prototype.verticalLayout=function(e,t,n,a,i){if(e.x+=n+e.offsetY,e.y+=a+e.offsetX,i=this.apply(e,i),null!=(t=e.child))for(i=this.verticalLayout(t,e,e.x,e.y,i),n=e.x+t.offsetY,a=t.next;null!=a;)i=this.verticalLayout(a,e,n,e.y+t.offsetX,i),n+=a.offsetY,a=a.next;return i},mxCompactTreeLayout.prototype.attachParent=function(e,t){var n=this.nodeDistance+this.levelDistance,a=(t-e.width)/2-this.nodeDistance,i=a+e.width+2*this.nodeDistance-t;e.child.offsetX=n+e.height,e.child.offsetY=i,e.contour.upperHead=this.createLine(e.height,0,this.createLine(n,i,e.contour.upperHead)),e.contour.lowerHead=this.createLine(e.height,0,this.createLine(n,a,e.contour.lowerHead))},mxCompactTreeLayout.prototype.layoutLeaf=function(e){var t=2*this.nodeDistance;e.contour.upperTail=this.createLine(e.height+t,0),e.contour.upperHead=e.contour.upperTail,e.contour.lowerTail=this.createLine(0,-e.width-t),e.contour.lowerHead=this.createLine(e.height+t,0,e.contour.lowerTail)},mxCompactTreeLayout.prototype.join=function(e){var t=2*this.nodeDistance,n=e.child;e.contour=n.contour;var a=n.width+t,i=a;for(n=n.next;null!=n;){var s=this.merge(e.contour,n.contour);n.offsetY=s+a,n.offsetX=0,i+=s+(a=n.width+t),n=n.next}return i},mxCompactTreeLayout.prototype.merge=function(e,t){for(var n=0,a=0,i=0,s=e.lowerHead,o=t.upperHead;null!=o&&null!=s;){var r=this.offset(n,a,o.dx,o.dy,s.dx,s.dy);a=a+r,i=i+r;n+o.dx<=s.dx?(n+=o.dx,a+=o.dy,o=o.next):(n-=s.dx,a-=s.dy,s=s.next)}return null!=o?(n=this.bridge(e.upperTail,0,0,o,n,a),e.upperTail=null!=n.next?t.upperTail:n,e.lowerTail=t.lowerTail):null==(n=this.bridge(t.lowerTail,n,a,s,0,0)).next&&(e.lowerTail=n),e.lowerHead=t.lowerHead,i},mxCompactTreeLayout.prototype.offset=function(e,t,n,a,i,s){var o;return i<=e||e+n<=0?0:0<(o=0<i*a-n*s?e<0?e*a/n-t:0<e?e*s/i-t:-t:i<e+n?s-(t+(i-e)*a/n):e+n<i?(n+e)*s/i-(t+a):s-(t+a))?o:0},mxCompactTreeLayout.prototype.bridge=function(e,t,n,a,i,s){return t=i+a.dx-t,i=i=0,0==a.dx?i=a.dy:(i=t*a.dy,i/=a.dx),t=this.createLine(t,i,a.next),e.next=this.createLine(0,s+a.dy-i-n,t),t},mxCompactTreeLayout.prototype.createNode=function(e){var t={};return t.cell=e,t.x=0,t.y=0,t.width=0,t.height=0,null!=(e=this.getVertexBounds(e))&&(this.isHorizontal()?(t.width=e.height,t.height=e.width):(t.width=e.width,t.height=e.height)),t.offsetX=0,t.offsetY=0,t.contour={},t},mxCompactTreeLayout.prototype.apply=function(e,t){var n=this.graph.getModel(),a=e.cell,i=n.getGeometry(a);return null!=a&&null!=i&&(this.isVertexMovable(a)&&(i=this.setVertexLocation(a,e.x,e.y),this.resizeParent&&(n=n.getParent(a),a=mxCellPath.create(n),null==this.parentsChanged[a]&&(this.parentsChanged[a]=n))),t=null==t?new mxRectangle(i.x,i.y,i.width,i.height):new mxRectangle(Math.min(t.x,i.x),Math.min(t.y,i.y),Math.max(t.x+t.width,i.x+i.width),Math.max(t.y+t.height,i.y+i.height))),t},mxCompactTreeLayout.prototype.createLine=function(e,t,n){var a={};return a.dx=e,a.dy=t,a.next=n,a},mxCompactTreeLayout.prototype.adjustParents=function(){var e,t=[];for(e in this.parentsChanged)t.push(this.parentsChanged[e]);this.arrangeGroups(mxUtils.sortCells(t,!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 t=e.child,n=e.cell,a=0,i=[];null!=t;){a++;var s=t.x;this.horizontal&&(s=t.y),i.push(new WeightedCellSorter(t,s)),t=t.next}i.sort(WeightedCellSorter.prototype.compare),(s=e.width)>(o=(a+1)*this.prefHozEdgeSep)+2*this.prefHozEdgeSep&&(s-=2*this.prefHozEdgeSep),t=(e=s/a)/2,s>o+2*this.prefHozEdgeSep&&(t+=this.prefHozEdgeSep);s=this.minEdgeJetty-this.prefVertEdgeOff;for(var o=0,r=this.getVertexBounds(n),l=0;l<i.length;l++){for(var d=i[l].cell.cell,c=this.getVertexBounds(d),m=(d=this.graph.getEdgesBetween(n,d,!1),[]),u=0,p=0,g=0;g<d.length;g++)this.horizontal?(u=r.x+r.width,p=r.y+t,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+t,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),t+=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,t){return null!=e&&null!=t?t.weightedValue>e.weightedValue?1:t.weightedValue<e.weightedValue?-1:t.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 t=this.graph.getModel();this.vertexArray=[];for(var n=this.graph.getChildVertices(e),a=0;a<n.length;a++)this.isVertexIgnored(n[a])||this.vertexArray.push(n[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]}t.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);n=this.graph.getOpposites(p,this.vertexArray[a]);for(this.neighbours[a]=[],d=0;d<n.length;d++){this.resetEdges&&this.graph.resetEdge(p[d]),this.disableEdgeStyle&&this.setEdgeStyleEnabled(p[d],!1);r=mxCellPath.create(n[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=n=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),n=null==n?m:Math.min(n,m),e=null==e?u:Math.min(e,u)));a=1-(n||0),o=1-(e||0),null!=i&&(a+=i.x,o+=i.y),this.graph.moveCells(this.vertexArray,a,o)}finally{t.endUpdate()}},mxFastOrganicLayout.prototype.calcPositions=function(){for(var e=0;e<this.vertexArray.length;e++)if(this.isMoveable[e]){(n=Math.sqrt(this.dispX[e]*this.dispX[e]+this.dispY[e]*this.dispY[e]))<.001&&(n=.001);var t=this.dispX[e]/n*Math.min(n,this.temperature),n=this.dispY[e]/n*Math.min(n,this.temperature);this.dispX[e]=0,this.dispY[e]=0,this.cellLocation[e][0]+=t,this.cellLocation[e][1]+=n}},mxFastOrganicLayout.prototype.calcAttraction=function(){for(var e=0;e<this.vertexArray.length;e++)for(var t=0;t<this.neighbours[e].length;t++){var n=this.neighbours[e][t];if(e!=n&&this.isMoveable[e]&&this.isMoveable[n]){(a=(s=this.cellLocation[e][0]-this.cellLocation[n][0])*s+(o=this.cellLocation[e][1]-this.cellLocation[n][1])*o-this.radiusSquared[e]-this.radiusSquared[n])<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[n]+=s,this.dispY[n]+=o}}},mxFastOrganicLayout.prototype.calcRepulsion=function(){for(var e=this.vertexArray.length,t=0;t<e;t++)for(var n=t;n<e;n++){if(!this.allowedToRun)return;if(n!=t&&this.isMoveable[t]&&this.isMoveable[n]){var a=this.cellLocation[t][0]-this.cellLocation[n][0],i=this.cellLocation[t][1]-this.cellLocation[n][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[t]-this.radius[n];o>this.maxDistanceLimit||(o<this.minDistanceLimit&&(o=this.minDistanceLimit),a=a/s*(o=this.forceConstantSquared/o),i=i/s*o,this.dispX[t]+=a,this.dispY[t]+=i,this.dispX[n]-=a,this.dispY[n]-=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 t=this.graph.getModel();t.beginUpdate();try{for(var n=0,a=null,i=null,s=[],o=t.getChildCount(e),r=0;r<o;r++){var l=t.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),n=Math.max(n,Math.max(d.width,d.height))}}var c=this.getRadius(s.length,n);this.moveCircle&&(i=this.x0,a=this.y0),this.circle(s,c,i,a)}finally{t.endUpdate()}},mxCircleLayout.prototype.getRadius=function(e,t){return Math.max(e*t/Math.PI,this.radius)},mxCircleLayout.prototype.circle=function(e,t,n,a){for(var i=e.length,s=2*Math.PI/i,o=0;o<i;o++)this.isVertexMovable(e[o])&&this.setVertexLocation(e[o],n+t+t*Math.sin(o*s),a+t+t*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 t in e){var n=e[t];1<n.length&&this.layout(n)}}finally{this.graph.model.endUpdate()}},mxParallelEdgeLayout.prototype.findParallels=function(e){for(var t=this.graph.getModel(),n=[],a=t.getChildCount(e),i=0;i<a;i++){var s=t.getChildAt(e,i);if(!this.isEdgeIgnored(s)){var o=this.getEdgeId(s);null!=o&&(null==n[o]&&(n[o]=[]),n[o].push(s))}}return n},mxParallelEdgeLayout.prototype.getEdgeId=function(e){var t=this.graph.getView(),n=t.getState(e),a=null!=n?n.getVisibleTerminal(!0):t.getVisibleTerminal(e,!0);return e=null!=n?n.getVisibleTerminal(!1):t.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 t=e[0];if((o=(n=this.graph.getModel()).getGeometry(n.getTerminal(t,!0)))==(s=n.getGeometry(n.getTerminal(t,!1)))){t=o.x+o.width+this.spacing;for(var n=o.y+o.height/2,a=0;a<e.length;a++)this.route(e[a],t,n),t+=this.spacing}else if(null!=o&&null!=s){t=o.x+o.width/2,n=o.y+o.height/2,a=s.x+s.width/2-t;var i=s.y+s.height/2-n,s=Math.sqrt(a*a+i*i),o=i*this.spacing/s;for(s=a*this.spacing/s,t=t+a/2+o*(e.length-1)/2,n=n+i/2-s*(e.length-1)/2,a=0;a<e.length;a++)this.route(e[a],t,n),t-=o,n+=s}},mxParallelEdgeLayout.prototype.route=function(e,t,n){this.graph.isCellMovable(e)&&this.setEdgePoints(e,[new mxPoint(t,n)])},mxCompositeLayout.prototype=new mxGraphLayout,mxCompositeLayout.prototype.constructor=mxCompositeLayout,mxCompositeLayout.prototype.layouts=null,mxCompositeLayout.prototype.master=null,mxCompositeLayout.prototype.moveCell=function(e,t,n){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 t=this.graph.getModel();t.beginUpdate();try{for(var n=0;n<this.layouts.length;n++)this.layouts[n].execute.apply(this.layouts[n],arguments)}finally{t.endUpdate()}},mxEdgeLabelLayout.prototype=new mxGraphLayout,mxEdgeLabelLayout.prototype.constructor=mxEdgeLabelLayout,mxEdgeLabelLayout.prototype.execute=function(e){for(var t=this.graph.view,n=this.graph.getModel(),a=[],i=[],s=n.getChildCount(e),o=0;o<s;o++){var r=n.getChildAt(e,o),l=t.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,t){var n=this.graph.getModel();n.beginUpdate();try{for(var a=0;a<t.length;a++){var i=t[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{n.endUpdate()}},mxEdgeLabelLayout.prototype.avoid=function(e,t){var n=this.graph.getModel(),a=e.text.boundingBox;if(mxUtils.intersects(a,t)){var i=-a.y-a.height+t.y,s=-a.y+t.y+t.height;i=Math.abs(i)<Math.abs(s)?i:s,s=-a.x-a.width+t.x,a=-a.x+t.x+t.width,a=Math.abs(s)<Math.abs(a)?s:a;Math.abs(a)<Math.abs(i)?i=0:a=0,null!=(s=n.getGeometry(e.cell))&&(null!=(s=s.clone()).offset?(s.offset.x+=a,s.offset.y+=i):s.offset=new mxPoint(a,i),n.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,t){return null},mxGraphAbstractHierarchyCell.prototype.setX=function(e,t){this.isVertex()?this.x[0]=t:this.isEdge()&&(this.x[e-this.minRank-1]=t)},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,t){this.isVertex()?this.y[0]=t:this.isEdge()&&(this.y[e-this.minRank-1]=t)},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 t=0;t<this.connectsAsTarget.length;t++){var n=this.connectsAsTarget[t];-1==n.maxRank||n.maxRank==e+1?this.nextLayerConnectedCells[0].push(n.source):this.nextLayerConnectedCells[0].push(n)}}return this.nextLayerConnectedCells[0]},mxGraphHierarchyNode.prototype.getPreviousLayerConnectedCells=function(e){if(null==this.previousLayerConnectedCells){this.previousLayerConnectedCells=[],this.previousLayerConnectedCells[0]=[];for(var t=0;t<this.connectsAsSource.length;t++){var n=this.connectsAsSource[t];-1==n.minRank||n.minRank==e-1?this.previousLayerConnectedCells[0].push(n.target):this.previousLayerConnectedCells[0].push(n)}}return this.previousLayerConnectedCells[0]},mxGraphHierarchyNode.prototype.isVertex=function(){return!0},mxGraphHierarchyNode.prototype.getGeneralPurposeVariable=function(e){return this.temp[0]},mxGraphHierarchyNode.prototype.setGeneralPurposeVariable=function(e,t){this.temp[0]=t},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 t=0;t<this.hashCode.length;t++)if(this.hashCode[t]!=e.hashCode[t])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 t=0;t<this.temp.length;t++)this.nextLayerConnectedCells[t]=[],t==this.temp.length-1?this.nextLayerConnectedCells[t].push(this.source):this.nextLayerConnectedCells[t].push(this)}return this.nextLayerConnectedCells[e-this.minRank-1]},mxGraphHierarchyEdge.prototype.getPreviousLayerConnectedCells=function(e){if(null==this.previousLayerConnectedCells){this.previousLayerConnectedCells=[];for(var t=0;t<this.temp.length;t++)this.previousLayerConnectedCells[t]=[],0==t?this.previousLayerConnectedCells[t].push(this.target):this.previousLayerConnectedCells[t].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,t){this.temp[e-this.minRank-1]=t},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,t,n){for(var a=e.getGraph(),i=0;i<t.length;i++){n[i]=new mxGraphHierarchyNode(t[i]);var s=mxCellPath.create(t[i]);this.vertexMapper[s]=n[i],s=e.getEdges(t[i]),n[i].connectsAsSource=[];for(var o=0;o<s.length;o++){if((d=e.getVisibleTerminal(s[o],!1))!=t[i]&&d!=t[i]&&e.graph.model.isVertex(d)&&!e.isVertexIgnored(d)){var r=e.getEdgesBetween(t[i],d,!1),l=e.getEdgesBetween(t[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=n[i],mxUtils.indexOf(n[i].connectsAsSource,l)<0&&n[i].connectsAsSource.push(l)}}}n[i].temp[0]=0}},mxGraphHierarchyModel.prototype.initialRank=function(){var e=[];if(null!=this.roots)for(var t=0;t<this.roots.length;t++){var n=mxCellPath.create(this.roots[t]);null!=(n=this.vertexMapper[n])&&e.push(n)}for(var a in this.vertexMapper)(n=this.vertexMapper[a]).temp[0]=-1;for(var i=e.slice();0<e.length;){var s,o;s=(n=e[0]).connectsAsTarget,o=n.connectsAsSource;var r=!0,l=this.SOURCESCANSTARTRANK;for(t=0;t<s.length;t++){var d=s[t];if(5270620!=d.temp[0]){r=!1;break}d=d.source,l=Math.min(l,d.temp[0]-1)}if(r){if(n.temp[0]=l,this.maxRank=Math.min(this.maxRank,l),null!=o)for(t=0;t<o.length;t++)(d=o[t]).temp[0]=5270620,-1==(d=d.target).temp[0]&&(e.push(d),d.temp[0]=-2);e.shift()}else if(t=e.shift(),e.push(n),t==n&&1==e.length)break}for(a in this.vertexMapper)(n=this.vertexMapper[a]).temp[0]-=this.maxRank;for(t=0;t<i.length;t++)for(e=0,s=(n=i[t]).connectsAsSource,a=0;a<s.length;a++)d=(d=s[a]).target,n.temp[0]=Math.max(e,d.temp[0]+1),e=n.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 t=null;if(null!=this.roots){var n=this.roots;for(t=[],e=0;e<n.length;e++){var a=mxCellPath.create(n[e]);t[e]=this.vertexMapper[a]}}this.visit(function(e,t,n,a,i){if(0==i&&t.maxRank<0&&t.minRank<0&&(s[t.temp[0]].push(t),t.maxRank=t.temp[0],t.minRank=t.temp[0],t.temp[0]=s[t.maxRank].length-1),null!=e&&null!=n&&1<e.maxRank-t.maxRank)for(n.maxRank=e.maxRank,n.minRank=t.maxRank,n.temp=[],n.x=[],n.y=[],e=n.minRank+1;e<n.maxRank;e++)s[e].push(n),n.setGeneralPurposeVariable(e,s[e].length-1)},t,!1,null)},mxGraphHierarchyModel.prototype.visit=function(e,t,n,a){if(null!=t){for(var i=0;i<t.length;i++){var s=t[i];null!=s&&(null==a&&(a={}),n?(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,t,n,a,i,s){if(null!=t){var o=mxCellPath.create(t.cell);if(null==i[o])for(a(e,i[o]=t,n,s,0),e=t.connectsAsSource.slice(),n=0;n<e.length;n++)o=e[n],this.dfs(t,o.target,o,a,i,s+1);else a(e,t,n,s,1)}},mxGraphHierarchyModel.prototype.extendedDfs=function(e,t,n,a,i,s,o,r){if(null!=t)if(null==e||null!=t.hashCode&&t.hashCode[0]==e.hashCode[0]||(s=e.hashCode.length+1,t.hashCode=e.hashCode.slice(),t.hashCode[s-1]=o),null==i[o=mxCellPath.create(t.cell)])for(a(e,i[o]=t,n,r,0),e=t.connectsAsSource.slice(),n=0;n<e.length;n++)o=e[n],this.extendedDfs(t,o.target,o,a,i,t.hashCode,n,r+1);else a(e,t,n,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 t=0;t<e.ranks.length;t++)this.nestedBestRanks[t]=e.ranks[t].slice();var n=0,a=this.calculateCrossings(e);for(t=0;t<this.maxIterations&&n<this.maxNoImprovementIterations;t++){this.weightedMedian(t,e),this.transpose(t,e);var i=this.calculateCrossings(e);if(i<a)for(a=i,i=n=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(n++,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(n=[],a=[],t=0;t<e.maxRank+1;t++)a[t]=[],n[t]=a[t];for(t=0;t<this.nestedBestRanks.length;t++)for(i=0;i<this.nestedBestRanks[t].length;i++)a[t].push(this.nestedBestRanks[t][i]);e.ranks=n},mxMedianHybridCrossingReduction.prototype.calculateCrossings=function(e){for(var t=e.ranks.length,n=0,a=1;a<t;a++)n+=this.calculateRankCrossing(a,e);return n},mxMedianHybridCrossingReduction.prototype.calculateRankCrossing=function(e,t){for(var n=0,a=t.ranks[e],i=a.length,s=t.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]&&n++;for(a=0;a<r;a++)for(l=c+1;l<s;l++)201207==o[a][l]&&n++}return n/2},mxMedianHybridCrossingReduction.prototype.transpose=function(e,t){for(var n=!0,a=0;n&&a++<10;)for(var i=1==e%2&&1==a%2,s=(n=!1,0);s<t.ranks.length;s++){for(var o=t.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),E=(m=[],u=[],0);E<f.length;E++)m[E]=f[E].getGeneralPurposeVariable(s+1);for(E=0;E<b.length;E++)u[E]=b[E].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=[],E=0;E<d.length;E++)p[E]=d[E].getGeneralPurposeVariable(s+1);for(E=0;E<c.length;E++)g[E]=c[E].getGeneralPurposeVariable(s-1);var A=0,y=0;for(E=0;E<m.length;E++)for(var S=0;S<p.length;S++)m[E]>p[S]&&A++,m[E]<p[S]&&y++;for(E=0;E<u.length;E++)for(S=0;S<g.length;S++)u[E]>g[S]&&A++,u[E]<g[S]&&y++;(y<A||y==A&&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||(n=!0))}}},mxMedianHybridCrossingReduction.prototype.weightedMedian=function(e,t){var n=0==e%2;if(n)for(var a=t.maxRank-1;0<=a;a--)this.medianRank(a,n);else for(a=1;a<t.maxRank;a++)this.medianRank(a,n)},mxMedianHybridCrossingReduction.prototype.medianRank=function(e,t){for(var n=this.nestedBestRanks[e].length,a=[],i=[],s=0;s<n;s++){var o,r,l=this.nestedBestRanks[e][s],d=new MedianCellSorter;d.cell=l,r=t?e+1:e-1,null!=(o=t?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<n;s++)null==i[s]&&(l=a.shift().cell).setGeneralPurposeVariable(e,s)},mxMedianHybridCrossingReduction.prototype.medianValue=function(e,t){for(var n=[],a=0,i=0;i<e.length;i++){var s=e[i];n[a++]=s.getGeneralPurposeVariable(t)}return n.sort(function(e,t){return e-t}),1==a%2?n[Math.floor(a/2)]:2==a?(n[0]+n[1])/2:(s=n[(i=a/2)-1]-n[0],a=n[a-1]-n[i],(n[i-1]*a+n[i]*s)/(s+a))},MedianCellSorter.prototype.medianValue=0,MedianCellSorter.prototype.cell=!1,MedianCellSorter.prototype.compare=function(e,t){return null!=e&&null!=t?t.medianValue>e.medianValue?-1:t.medianValue<e.medianValue?1:0:0},mxMinimumCycleRemover.prototype=new mxHierarchicalLayoutStage,mxMinimumCycleRemover.prototype.constructor=mxMinimumCycleRemover,mxMinimumCycleRemover.prototype.layout=null,mxMinimumCycleRemover.prototype.execute=function(e){var t=this.layout.getModel(),s={},o=mxUtils.clone(t.vertexMapper,null,!0),n=null;if(null!=t.roots){var a=t.roots;n=[];for(e=0;e<a.length;e++){var i=mxCellPath.create(a[e]);n[e]=t.vertexMapper[i]}}if(t.visit(function(e,t,n,a,i){t.isAncestor(e)&&(n.invert(),mxUtils.remove(n,e.connectsAsSource),e.connectsAsTarget.push(n),mxUtils.remove(n,t.connectsAsTarget),t.connectsAsSource.push(n)),e=mxCellPath.create(t.cell),s[e]=t,delete o[e]},n,!0,null),n=null,0<o.lenth&&(n=mxUtils.clone(o,null,!0)),e=mxUtils.clone(s,null,!0),t.visit(function(e,t,n,a,i){t.isAncestor(e)&&(n.invert(),mxUtils.remove(n,e.connectsAsSource),t.connectsAsSource.push(n),e.connectsAsTarget.push(n),mxUtils.remove(n,t.connectsAsTarget)),e=mxCellPath.create(t.cell),s[e]=t,delete o[e]},o,!0,e),a=this.layout.getGraph(),null!=n&&0<n.length)for(t=t.roots,e=0;e<n.length;e++)i=n[e].cell,0==a.getIncomingEdges(i).length&&t.push(i)};var mxHierarchicalEdgeStyle={ORTHOGONAL:1,POLYLINE:2,STRAIGHT:3,CURVE:4};function WeightedCellSorter(e,t){this.cell=e,this.weightedValue=t}function mxHierarchicalLayout(e,t,n){mxGraphLayout.call(this,e),this.orientation=null!=t?t:mxConstants.DIRECTION_NORTH,this.deterministic=null==n||n}function mxGraphModel(e){this.currentEdit=this.createUndoableEdit(),null!=e?this.setRoot(e):this.clear()}function mxRootChange(e,t){this.model=e,this.previous=this.root=t}function mxChildChange(e,t,n,a){this.model=e,this.previous=this.parent=t,this.child=n,this.previousIndex=this.index=a}function mxTerminalChange(e,t,n,a){this.model=e,this.cell=t,this.previous=this.terminal=n,this.source=a}function mxValueChange(e,t,n){this.model=e,this.cell=t,this.previous=this.value=n}function mxStyleChange(e,t,n){this.model=e,this.cell=t,this.previous=this.style=n}function mxGeometryChange(e,t,n){this.model=e,this.cell=t,this.previous=this.geometry=n}function mxCollapseChange(e,t,n){this.model=e,this.cell=t,this.previous=this.collapsed=n}function mxVisibleChange(e,t,n){this.model=e,this.cell=t,this.previous=this.visible=n}function mxCellAttributeChange(e,t,n){this.cell=e,this.attribute=t,this.previous=this.value=n}function mxCell(e,t,n){this.value=e,this.setGeometry(t),this.setStyle(n),null!=this.onInit&&this.onInit()}function mxGeometry(e,t,n,a){mxRectangle.call(this,e,t,n,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 t=0;t<e.ranks.length;t++){mxLog.write("Rank ",t," : ");for(var n=e.ranks[t],a=0;a<n.length;a++)mxLog.write(n[a].getGeneralPurposeVariable(t),"  ");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 t=1e8;if(this.fineTuning)for(var n=0;n<this.maxIterations;n++){if(0!=n&&(this.medianPos(n,e),this.minNode(e)),this.currentXDelta<t){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))}t=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 t=[],n=[],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,t.push(r),n[o=mxCellPath.create(o.getCoreCell())]=r}}for(e=10*t.length,s=0;0<t.length&&s<=e;){i=(r=t.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=n[l=mxCellPath.create(l.getCoreCell())])&&0==l.visited&&(l.visited=!0,t.push(l));for(i=0;i<c.length;i++)l=c[i],null!=(l=n[l=mxCellPath.create(l.getCoreCell())])&&0==l.visited&&(l.visited=!0,t.push(l))}r.visited=!1,s++}},mxCoordinateAssignment.prototype.medianPos=function(e,t){if(0==e%2)for(var n=t.maxRank;0<n;n--)this.rankMedianPosition(n-1,t,n);else for(n=0;n<t.maxRank-1;n++)this.rankMedianPosition(n+1,t,n)},mxCoordinateAssignment.prototype.rankMedianPosition=function(e,t,n){t=t.ranks[e];for(var a=[],i=[],s=0;s<t.length;s++){var o=t[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=n<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=n<e?o.getPreviousLayerConnectedCells(e).slice():o.getNextLayerConnectedCells(e).slice())&&(r=0<(r=l.length)?this.medianXValue(l,n):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(t[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(t[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,t){for(var n=0,a=0;a<t.length;a++){var i=t[a];e.isVertex()&&i.isVertex()?n++:n=e.isEdge()&&i.isEdge()?n+8:n+2}return n},mxCoordinateAssignment.prototype.medianXValue=function(e,t){if(0==e.length)return 0;for(var n=[],a=0;a<e.length;a++)n[a]=e[a].getGeneralPurposeVariable(t);return n.sort(function(e,t){return e-t}),1==e.length%2?n[Math.floor(e.length/2)]:(n[(a=e.length/2)-1]+n[a])/2},mxCoordinateAssignment.prototype.initialCoords=function(e,t){this.calculateWidestRank(e,t);for(var n=this.widestRank;0<=n;n--)n<t.maxRank&&this.rankCoordinates(n,e,t);for(n=this.widestRank+1;n<=t.maxRank;n++)0<n&&this.rankCoordinates(n,e,t)},mxCoordinateAssignment.prototype.rankCoordinates=function(e,t,n){t=n.ranks[e],n=0;for(var a=this.initialX+(this.widestRankValue-this.rankWidths[e])/2,i=!1,s=0;s<t.length;s++){var o=t[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,n=Math.max(n,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,t){var n=-this.interRankCellSpacing,a=0;this.rankWidths=[],this.rankY=[];for(var i=t.maxRank;0<=i;i--){for(var s=0,o=t.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]=n,r=s/2+a/2+this.interRankCellSpacing,a=s,n=this.orientation==mxConstants.DIRECTION_NORTH||this.orientation==mxConstants.DIRECTION_WEST?n+r:n-r,d=0;d<o.length;d++)o[d].setY(i,n)}},mxCoordinateAssignment.prototype.minPath=function(e,t){var n,a=t.edgeMapper;for(n in a){var i=a[n];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(t,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(t,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,t,n,a){e=e.ranks[n];for(var i=-1,s=0;s<e.length;s++)if(t==e[s]){i=s;break}if(i<0)return!1;if(a<(s=t.getGeneralPurposeVariable(n))){if(0==i)return!0;if(!((n=(n=(e=e[i-1]).getGeneralPurposeVariable(n))+e.width/2+this.intraCellSpacing+t.width/2)<=a))return!1}else if(s<a){if(i==e.length-1)return!0;if(!(a<=(n=(n=(e=e[i+1]).getGeneralPurposeVariable(n))-e.width/2-this.intraCellSpacing-t.width/2)))return!1}return!0},mxCoordinateAssignment.prototype.setCellLocations=function(e,t){this.rankTopY=[],this.rankBottomY=[];for(var n=0;n<t.ranks.length;n++)this.rankTopY[n]=Number.MAX_VALUE,this.rankBottomY[n]=0;n=null,this.layout.resizeParent&&(n={});var a,i=t.edgeMapper,s=t.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==n[r]&&(n[r]=o)}}for(a in this.layout.resizeParent&&null!=n&&this.adjustParents(n),(this.edgeStyle==mxHierarchicalEdgeStyle.ORTHOGONAL||this.edgeStyle==mxHierarchicalEdgeStyle.POLYLINE||this.edgeStyle==mxHierarchicalEdgeStyle.CURVE)&&this.localEdgeProcessing(t),i)this.setEdgePosition(i[a])},mxCoordinateAssignment.prototype.adjustParents=function(e){var t,n=[];for(t in e)n.push(e[t]);this.layout.arrangeGroups(mxUtils.sortCells(n,!0),this.groupPadding)},mxCoordinateAssignment.prototype.localEdgeProcessing=function(e){for(var t=0;t<e.ranks.length;t++)for(var n=e.ranks[t],a=0;a<n.length;a++){var i=n[a];if(i.isVertex())for(var s=i.getPreviousLayerConnectedCells(t),o=t-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(t),o=t+1}}},mxCoordinateAssignment.prototype.setEdgePosition=function(e){var t=0;if(101207!=e.temp[0]){var n=e.maxRank,a=e.minRank;n==a&&(n=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[n],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]+t;var f=(this.rankTopY[c]+this.rankBottomY[c+1])/2,b=(this.rankTopY[c-1]+this.rankBottomY[c])/2;if(p){var E=f;f=b,b=E}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[n]: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),t=0==t?this.parallelEdgeSpacing:0<t?-t:-t+this.parallelEdgeSpacing,i++}e.temp[0]=101207}},mxCoordinateAssignment.prototype.setVertexLocation=function(e){var t=e.cell,n=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(t,n,a):this.layout.setVertexLocation(t,a,n),this.limitX=Math.max(this.limitX,n+e.width)},mxCoordinateAssignment.prototype.processReversedEdge=function(e,t){},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,t){return null!=e&&null!=t?t.weightedValue>e.weightedValue?-1:t.weightedValue<e.weightedValue?1:t.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,t){this.parent=e;var n=this.graph.model;if(this.edgesCache={},null!=t||null!=e){if(null!=t&&null!=e){for(var a=[],i=0;i<t.length;i++)n.isAncestor(e,t[i])&&a.push(t[i]);this.roots=a}else this.roots=t;n.beginUpdate();try{this.run(e),this.resizeParent&&!this.graph.isCellCollapsed(e)&&this.graph.updateGroupBounds([e],this.parentBorder,this.moveParent)}finally{n.endUpdate()}}},mxHierarchicalLayout.prototype.findRoots=function(e,t){var n=[];if(null!=e&&null!=t){var a,i=this.graph.model,s=null,o=-1e5;for(a in t){var r=t[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&&n.push(r),o<(l=d-c)&&(o=l,s=r)}}0==n.length&&null!=s&&n.push(s)}return n},mxHierarchicalLayout.prototype.getEdges=function(e){var t=mxCellPath.create(e);if(null!=this.edgesCache[t])return this.edgesCache[t];for(var n=this.graph.model,a=[],i=this.graph.isCellCollapsed(e),s=n.getChildCount(e),o=0;o<s;o++){var r=n.getChildAt(e,o);this.isPort(r)?a=a.concat(n.getEdges(r,!0,!0)):!i&&this.graph.isCellVisible(r)||(a=a.concat(n.getEdges(r,!0,!0)))}for(a=a.concat(n.getEdges(e,!0,!0)),n=[],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))))&&n.push(a[o]);return this.edgesCache[t]=n},mxHierarchicalLayout.prototype.getVisibleTerminal=function(e,t){var n=null!=(n=this.graph.view.getState(e))?n.getVisibleTerminal(t):this.graph.view.getVisibleTerminal(e,t);return this.isPort(n)&&(n=this.graph.model.getParent(n)),n},mxHierarchicalLayout.prototype.run=function(e){var t=[],n=[];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=[];t.push(r),this.traverse(o[s],!0,null,n,r,t,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=[],t.push(r),traverse(roots.get(s),!0,null,n,r,t,null);for(s=n=0;s<t.length;s++){for(i in a=[],r=t[s])a.push(r[i]);this.model=new mxGraphHierarchyModel(this,a,this.roots,e,this.tightenToSource),this.cycleStage(e),this.layeringStage(),this.crossingStage(e),n=this.placementStage(n,e)}},mxHierarchicalLayout.prototype.filterDescendants=function(e,t){var n=this.graph.model;if(n.isVertex(e)&&e!=this.parent&&this.graph.isCellVisible(e)&&(t[mxCellPath.create(e)]=e),this.traverseAncestors||e==this.parent&&this.graph.isCellVisible(e))for(var a=n.getChildCount(e),i=0;i<a;i++){var s=n.getChildAt(e,i);this.isPort(s)||this.filterDescendants(s,t)}},mxHierarchicalLayout.prototype.isPort=function(e){return!!e.geometry.relative},mxHierarchicalLayout.prototype.getEdgesBetween=function(e,t,n){n=null!=n&&n;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==t||!n&&o==t&&r==e)&&i.push(a[s])}return i},mxHierarchicalLayout.prototype.traverse=function(e,t,n,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(n=0;n<s.length;n++)if(null!=(e=s[n])[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(n=0;n<l.length;n++)r=this.getVisibleTerminal(l[n],!0)==e,(!t||r)&&(r=this.getVisibleTerminal(l[n],!r),i=this.traverse(r,t,l[n],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,t){var n=new mxCoordinateAssignment(this,this.intraCellSpacing,this.interRankCellSpacing,this.orientation,e,this.parallelEdgeSpacing);return n.fineTuning=this.fineTuning,n.execute(t),n.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,t){var n=null;if(null!=e){n=[];for(var a=0;a<e.length;a++)t(e[a])&&n.push(e[a])}return n},mxGraphModel.prototype.getDescendants=function(e){return this.filterDescendants(null,e)},mxGraphModel.prototype.filterDescendants=function(e,t){var n=[];t=t||this.getRoot(),(null==e||e(t))&&n.push(t);for(var a=this.getChildCount(t),i=0;i<a;i++){var s=this.getChildAt(t,i);n=n.concat(this.filterDescendants(e,s))}return n},mxGraphModel.prototype.getRoot=function(e){var t=e||this.root;if(null!=e)for(;null!=e;)t=e,e=this.getParent(e);return t},mxGraphModel.prototype.setRoot=function(e){return this.execute(new mxRootChange(this,e)),e},mxGraphModel.prototype.rootChanged=function(e){var t=this.root;return this.root=e,this.nextId=0,this.cells=null,this.cellAdded(e),t},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,t){for(;null!=t&&t!=e;)t=this.getParent(t);return t==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,t,n){if(t!=e&&null!=e&&null!=t){null==n&&(n=this.getChildCount(e));var a=e!=this.getParent(t);this.execute(new mxChildChange(this,e,t,n)),this.maintainEdgeParent&&a&&this.updateEdgeParents(t)}return t},mxGraphModel.prototype.cellAdded=function(e){if(null!=e){if(null==e.getId()&&this.createIds&&e.setId(this.createId(e)),null!=e.getId())if((t=this.getCell(e.getId()))!=e){for(;null!=t;)e.setId(this.createId(e)),t=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 t=this.getChildCount(e),n=0;n<t;n++)this.cellAdded(this.getChildAt(e,n))}},mxGraphModel.prototype.createId=function(e){return e=this.nextId,this.nextId++,this.prefix+e+this.postfix},mxGraphModel.prototype.updateEdgeParents=function(e,t){t=t||this.getRoot(e);for(var n=this.getChildCount(e),a=0;a<n;a++){var i=this.getChildAt(e,a);this.updateEdgeParents(i,t)}for(i=this.getEdgeCount(e),n=[],a=0;a<i;a++)n.push(this.getEdgeAt(e,a));for(a=0;a<n.length;a++)i=n[a],this.isAncestor(t,i)&&this.updateEdgeParent(i,t)},mxGraphModel.prototype.updateEdgeParent=function(e,t){for(var n=this.getTerminal(e,!0),a=this.getTerminal(e,!1),i=null;null!=n&&!this.isEdge(n)&&null!=n.geometry&&n.geometry.relative;)n=this.getParent(n);for(;null!=a&&!this.isEdge(a)&&null!=a.geometry&&a.geometry.relative;)a=this.getParent(a);if(this.isAncestor(t,n)&&this.isAncestor(t,a)&&(null!=(i=n==a?this.getParent(n):this.getNearestCommonAncestor(n,a))&&(this.getParent(i)!=this.root||this.isAncestor(i,e))&&this.getParent(e)!=i)){if(null!=(n=this.getGeometry(e))){var s=this.getOrigin(this.getParent(e)),o=this.getOrigin(i);a=o.x-s.x,s=o.y-s.y;(n=n.clone()).translate(-a,-s),this.setGeometry(e,n)}this.add(i,e,this.getChildCount(i))}},mxGraphModel.prototype.getOrigin=function(e){var t=null;return null!=e?(t=this.getOrigin(this.getParent(e)),this.isEdge(e)||null!=(e=this.getGeometry(e))&&(t.x+=e.x,t.y+=e.y)):t=new mxPoint,t},mxGraphModel.prototype.getNearestCommonAncestor=function(e,t){if(null!=e&&null!=t&&(null!=(s=mxCellPath.create(t))&&0<s.length)){var n=e,a=mxCellPath.create(n);if(s.length<a.length){n=t;var i=a,s=(a=s,i)}for(;null!=n;){if(i=this.getParent(n),0==s.indexOf(a+mxCellPath.PATH_SEPARATOR)&&null!=i)return n;a=mxCellPath.getParentPath(a),n=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 t=this.getChildCount(e)-1;0<=t;t--)this.cellRemoved(this.getChildAt(e,t));null!=this.cells&&null!=e.getId()&&delete this.cells[e.getId()]}},mxGraphModel.prototype.parentForCellChanged=function(e,t,n){var a=this.getParent(e);return null!=t?(t!=a||a.getIndex(e)!=n)&&t.insert(e,n):null!=a&&(n=a.getIndex(e),a.remove(n)),this.contains(a)||null==t?null==t&&this.cellRemoved(e):this.cellAdded(e),a},mxGraphModel.prototype.getChildCount=function(e){return null!=e?e.getChildCount():0},mxGraphModel.prototype.getChildAt=function(e,t){return null!=e?e.getChildAt(t):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,t,n){t=null!=t&&t,n=null!=n&&n;for(var a=this.getChildCount(e),i=[],s=0;s<a;s++){var o=this.getChildAt(e,s);(!n&&!t||n&&this.isEdge(o)||t&&this.isVertex(o))&&i.push(o)}return i},mxGraphModel.prototype.getTerminal=function(e,t){return null!=e?e.getTerminal(t):null},mxGraphModel.prototype.setTerminal=function(e,t,n){var a=t!=this.getTerminal(e,n);return this.execute(new mxTerminalChange(this,e,t,n)),this.maintainEdgeParent&&a&&this.updateEdgeParent(e,this.getRoot()),t},mxGraphModel.prototype.setTerminals=function(e,t,n){this.beginUpdate();try{this.setTerminal(e,t,!0),this.setTerminal(e,n,!1)}finally{this.endUpdate()}},mxGraphModel.prototype.terminalForCellChanged=function(e,t,n){var a=this.getTerminal(e,n);return null!=t?t.insertEdge(e,n):null!=a&&a.removeEdge(e,n),a},mxGraphModel.prototype.getEdgeCount=function(e){return null!=e?e.getEdgeCount():0},mxGraphModel.prototype.getEdgeAt=function(e,t){return null!=e?e.getEdgeAt(t):null},mxGraphModel.prototype.getDirectedEdgeCount=function(e,t,n){for(var a=0,i=this.getEdgeCount(e),s=0;s<i;s++){var o=this.getEdgeAt(e,s);o!=n&&this.getTerminal(o,t)==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,t,n,a){t=null==t||t,n=null==n||n,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&&(t&&d==e||n&&l==e))&&s.push(r)}return s},mxGraphModel.prototype.getEdgesBetween=function(e,t,n){n=null!=n&&n;var a=this.getEdgeCount(e),i=this.getEdgeCount(t),s=e,o=a;for(i<a&&(o=i,s=t),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==t||!n&&(d==e&&l==t))&&a.push(r)}return a},mxGraphModel.prototype.getOpposites=function(e,t,n,a){n=null==n||n,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==t&&null!=r&&r!=t&&a?i.push(r):r==t&&null!=o&&o!=t&&n&&i.push(o)}return i},mxGraphModel.prototype.getTopmostCells=function(e){for(var t=[],n=0;n<e.length;n++){for(var a=e[n],i=!0,s=this.getParent(a);null!=s;){if(0<=mxUtils.indexOf(e,s)){i=!1;break}s=this.getParent(s)}i&&t.push(a)}return t},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,t){return this.execute(new mxValueChange(this,e,t)),t},mxGraphModel.prototype.valueForCellChanged=function(e,t){return e.valueChanged(t)},mxGraphModel.prototype.getGeometry=function(e,t){return null!=e?e.getGeometry():null},mxGraphModel.prototype.setGeometry=function(e,t){return t!=this.getGeometry(e)&&this.execute(new mxGeometryChange(this,e,t)),t},mxGraphModel.prototype.geometryForCellChanged=function(e,t){var n=this.getGeometry(e);return e.setGeometry(t),n},mxGraphModel.prototype.getStyle=function(e){return null!=e?e.getStyle():null},mxGraphModel.prototype.setStyle=function(e,t){return t!=this.getStyle(e)&&this.execute(new mxStyleChange(this,e,t)),t},mxGraphModel.prototype.styleForCellChanged=function(e,t){var n=this.getStyle(e);return e.setStyle(t),n},mxGraphModel.prototype.isCollapsed=function(e){return null!=e&&e.isCollapsed()},mxGraphModel.prototype.setCollapsed=function(e,t){return t!=this.isCollapsed(e)&&this.execute(new mxCollapseChange(this,e,t)),t},mxGraphModel.prototype.collapsedStateForCellChanged=function(e,t){var n=this.isCollapsed(e);return e.setCollapsed(t),n},mxGraphModel.prototype.isVisible=function(e){return null!=e&&e.isVisible()},mxGraphModel.prototype.setVisible=function(e,t){return t!=this.isVisible(e)&&this.execute(new mxVisibleChange(this,e,t)),t},mxGraphModel.prototype.visibleStateForCellChanged=function(e,t){var n=this.isVisible(e);return e.setVisible(t),n},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,t,n){n=null==n||n,this.beginUpdate();try{var a={};for(var i in this.mergeChildrenImpl(e,t,n,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,t,n,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)&&n?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=t.insert(d),this.cellAdded(l)}a[mxCellPath.create(o)]=l,this.mergeChildrenImpl(o,l,n,a)}}}finally{this.endUpdate()}},mxGraphModel.prototype.getParents=function(e){var t=[];if(null!=e)for(var n={},a=0;a<e.length;a++){var i=this.getParent(e[a]);if(null!=i){var s=mxCellPath.create(i);null==n[s]&&(n[s]=i,t.push(i))}}return t},mxGraphModel.prototype.cloneCell=function(e){return null!=e?this.cloneCells([e],!0)[0]:null},mxGraphModel.prototype.cloneCells=function(e,t){for(var n={},a=[],i=0;i<e.length;i++)null!=e[i]?a.push(this.cloneCellImpl(e[i],n,t)):a.push(null);for(i=0;i<a.length;i++)null!=a[i]&&this.restoreClone(a[i],e[i],n);return a},mxGraphModel.prototype.cloneCellImpl=function(e,t,n){var a=this.cellCloned(e);if(t[mxObjectIdentity.get(e)]=a,n){n=this.getChildCount(e);for(var i=0;i<n;i++){var s=this.cloneCellImpl(this.getChildAt(e,i),t,!0);a.insert(s)}}return a},mxGraphModel.prototype.cellCloned=function(e){return e.clone()},mxGraphModel.prototype.restoreClone=function(e,t,n){null!=(a=this.getTerminal(t,!0))&&(null!=(a=n[mxObjectIdentity.get(a)])&&a.insertEdge(e,!0)),null!=(a=this.getTerminal(t,!1))&&(null!=(a=n[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(t,i),n)},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),t=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=t},mxChildChange.prototype.connect=function(e,t){t=null==t||t;var n=e.getTerminal(!0),a=e.getTerminal(!1);for(null!=n&&(t?this.model.terminalForCellChanged(e,n,!0):this.model.terminalForCellChanged(e,null,!0)),null!=a&&(t?this.model.terminalForCellChanged(e,a,!1):this.model.terminalForCellChanged(e,null,!1)),e.setTerminal(n,!0),e.setTerminal(a,!1),n=this.model.getChildCount(e),a=0;a<n;a++)this.connect(this.model.getChildAt(e,a),t)},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 t=this.getValue();return this.setValue(e),t},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,t){return t?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,t){return null!=e&&(null==t&&(t=this.getChildCount(),e.getParent()==this&&t--),e.removeFromParent(),e.setParent(this),null==this.children?(this.children=[],this.children.push(e)):this.children.splice(t,0,e)),e},mxCell.prototype.remove=function(e){var t=null;return null!=this.children&&0<=e&&(null!=(t=this.getChildAt(e))&&(this.children.splice(e,1),t.setParent(null))),t},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,t){return null!=e&&(e.removeFromTerminal(t),e.setTerminal(this,t),null==this.edges||e.getTerminal(!t)!=this||mxUtils.indexOf(this.edges,e)<0)&&(null==this.edges&&(this.edges=[]),this.edges.push(e)),e},mxCell.prototype.removeEdge=function(e,t){if(null!=e){if(e.getTerminal(!t)!=this&&null!=this.edges){var n=this.getEdgeIndex(e);0<=n&&this.edges.splice(n,1)}e.setTerminal(null,t)}return e},mxCell.prototype.removeFromTerminal=function(e){var t=this.getTerminal(e);null!=t&&t.removeEdge(this,e)},mxCell.prototype.getAttribute=function(e,t){var n=this.getValue();return(null!=n&&n.nodeType==mxConstants.NODETYPE_ELEMENT?n.getAttribute(e):null)||t},mxCell.prototype.setAttribute=function(e,t){var n=this.getValue();null!=n&&n.nodeType==mxConstants.NODETYPE_ELEMENT&&n.setAttribute(e,t)},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,t){return t?this.sourcePoint=e:this.targetPoint=e,e},mxGeometry.prototype.translate=function(e,t){if(this.clone(),this.relative||(this.x+=e,this.y+=t),null!=this.sourcePoint&&(this.sourcePoint.x+=e,this.sourcePoint.y+=t),null!=this.targetPoint&&(this.targetPoint.x+=e,this.targetPoint.y+=t),this.TRANSLATE_CONTROL_POINTS&&null!=this.points)for(var n=this.points.length,a=0;a<n;a++){var i=this.points[a];null!=i&&(i.x+=e,i.y+=t)}};var mxCellPath={PATH_SEPARATOR:".",create:function(e){var t="";if(null!=e)for(var n=e.getParent();null!=n;)t=n.getIndex(e)+mxCellPath.PATH_SEPARATOR+t,n=(e=n).getParent();return 1<(e=t.length)&&(t=t.substring(0,e-1)),t},getParentPath:function(e){if(null!=e){var t=e.lastIndexOf(mxCellPath.PATH_SEPARATOR);if(0<=t)return e.substring(0,t);if(0<e.length)return""}return null},resolve:function(e,t){var n=e;if(null!=t)for(var a=t.split(mxCellPath.PATH_SEPARATOR),i=0;i<a.length;i++)n=n.getChildAt(parseInt(a[i]));return n},compare:function(e,t){for(var n=Math.min(e.length,t.length),a=0,i=0;i<n;i++)if(e[i]!=t[i]){a=0==e[i].length||0==t[i].length?e[i]==t[i]?0:e[i]>t[i]?1:-1:(n=parseInt(e[i]))==(i=parseInt(t[i]))?0:i<n?1:-1;break}return 0==a&&((n=e.length)!=(i=t.length)&&(a=i<n?1:-1)),a}},mxPerimeter={RectanglePerimeter:function(e,t,n,a){t=e.getCenterX();var i=e.getCenterY(),s=Math.atan2(n.y-i,n.x-t),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=t-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=t+e.height*Math.tan(l)/2),a&&(n.x>=e.x&&n.x<=e.x+e.width?o.x=n.x:n.y>=e.y&&n.y<=e.y+e.height&&(o.y=n.y),n.x<e.x?o.x=e.x:n.x>e.x+e.width&&(o.x=e.x+e.width),n.y<e.y?o.y=e.y:n.y>e.y+e.height&&(o.y=e.y+e.height)),o},EllipsePerimeter:function(e,t,n,a){var i=e.x,s=e.y,o=e.width/2,r=e.height/2,l=i+o,d=s+r;t=n.x,n=n.y;var c=parseInt(t-l),m=parseInt(n-d);if(0==c&&0!=m)return new mxPoint(l,d+r*m/Math.abs(m));if(0==c&&0==m)return new mxPoint(t,n);if(a){if(s<=n&&n<=s+e.height)return e=n-d,e=Math.sqrt(o*o*(1-e*e/(r*r)))||0,t<=i&&(e=-e),new mxPoint(l+e,n);if(i<=t&&t<=i+e.width)return e=t-l,e=Math.sqrt(r*r*(1-e*e/(o*o)))||0,n<=s&&(e=-e),new mxPoint(t,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-t,2)+Math.pow(l-n,2)),t=Math.sqrt(Math.pow(r-t,2)+Math.pow(d-n,2)),s=n=0,s=i<t?(n=o,l):(n=r,d),new mxPoint(n,s)},RhombusPerimeter:function(e,t,n,a){t=e.x;var i=e.y,s=e.width,o=t+s/2,r=i+(e=e.height)/2,l=n.x;if(n=n.y,o==l)return new mxPoint(o,n<r?i:i+e);if(r==n)return new mxPoint(l<o?t:t+s,r);var d=o,c=r;return a&&(t<=l&&l<=t+s?d=l:i<=n&&n<=i+e&&(c=n)),l<o?n<r?mxUtils.intersection(l,n,d,c,o,i,t,r):mxUtils.intersection(l,n,d,c,o,i+e,t,r):n<r?mxUtils.intersection(l,n,d,c,o,i,t+s,r):mxUtils.intersection(l,n,d,c,o,i+e,t+s,r)},TrianglePerimeter:function(e,t,n,a){var i=(t=null!=t?t.style[mxConstants.STYLE_DIRECTION]:null)==mxConstants.DIRECTION_NORTH||t==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);t==mxConstants.DIRECTION_NORTH?(c=u,m=new mxPoint(l,o),u=new mxPoint(s+r,o+e)):t==mxConstants.DIRECTION_SOUTH?(m=new mxPoint(l,o+e),u=new mxPoint(s+r,o)):t==mxConstants.DIRECTION_WEST&&(c=new mxPoint(s+r,o),m=new mxPoint(s,d),u=new mxPoint(s+r,o+e));var p=n.x-l,g=n.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=t==mxConstants.DIRECTION_NORTH||t==mxConstants.DIRECTION_WEST?-v<p&&p<v:p<-Math.PI+v||p>Math.PI-v,v=null;return null==(v=g?a&&(i&&n.x>=c.x&&n.x<=u.x||!i&&n.y>=c.y&&n.y<=u.y)?i?new mxPoint(n.x,c.y):new mxPoint(c.x,n.y):t==mxConstants.DIRECTION_NORTH?new mxPoint(s+r/2+e*Math.tan(p)/2,o+e):t==mxConstants.DIRECTION_SOUTH?new mxPoint(s+r/2-e*Math.tan(p)/2,o):t==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),n.y>=o&&n.y<=o+e?(a.x=i?l:t==mxConstants.DIRECTION_WEST?s+r:s,a.y=n.y):n.x>=s&&n.x<=s+r&&(a.x=n.x,a.y=i?t==mxConstants.DIRECTION_NORTH?o+e:o:d),l=a.x,d=a.y),i&&n.x<=s+r/2||!i&&n.y<=o+e/2?mxUtils.intersection(n.x,n.y,l,d,c.x,c.y,m.x,m.y):mxUtils.intersection(n.x,n.y,l,d,m.x,m.y,u.x,u.y)))&&(v=new mxPoint(l,d)),v}};function mxPrintPreview(e,t,n,a,i,s,o,r,l){this.graph=e,this.scale=null!=t?t:1/e.pageScale,this.border=null!=a?a:0,this.pageFormat=null!=n?n: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,t,n){this.view=e,this.cell=t,this.style=n,this.origin=new mxPoint,this.absoluteOffset=new mxPoint}function mxGraphSelectionModel(e){this.graph=e,this.cells=[]}function mxSelectionChange(e,t,n){this.selectionModel=e,this.added=null!=t?t.slice():null,this.removed=null!=n?n.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 t=this.graph.cellRenderer.initializeOverlay,n=null;try{if(this.printOverlays&&(this.graph.cellRenderer.initializeOverlay=function(e,t){t.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 t=function(){e.style.top=a.body.scrollTop+10+"px"};mxEvent.addListener(this.wnd,"scroll",function(e){t()}),mxEvent.addListener(this.wnd,"resize",function(e){t()})}}});if(e=function(e,t){if(null!=this.borderColor&&(e.style.borderColor=this.borderColor,e.style.borderStyle="solid",e.style.borderWidth="1px"),e.style.background="white",t&&(e.style.pageBreakAfter="always"),mxClient.IS_IE?(a.writeln(e.outerHTML),e.parentNode.removeChild(e)):(e.parentNode.removeChild(e),a.body.appendChild(e)),t){var n=a.createElement("hr");n.className="mxPageBreak",a.body.appendChild(n)}},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,E=g*m+f+1;(n=this.renderPage(this.pageFormat.width,this.pageFormat.height,mxUtils.bind(this,function(e){this.addGraphFragment(-b,-h,this.scale,E,e)}))).setAttribute("id","mxPage-"+E),e(n,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!=n&&null!=n.parentNode&&n.parentNode.removeChild(n)}finally{this.graph.cellRenderer.initializeOverlay=t}return this.wnd},mxPrintPreview.prototype.writeHead=function(e,t){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!=t&&e.writeln(t),e.writeln("</style>")},mxPrintPreview.prototype.createPageSelector=function(e,t){var n=this.wnd.document,a=n.createElement("table");a.className="mxPageSelector",a.setAttribute("border","0");for(var i=n.createElement("tbody"),s=0;s<e;s++){for(var o=n.createElement("tr"),r=0;r<t;r++){var l=s*t+r+1,d=n.createElement("td");if(!mxClient.IS_NS||mxClient.IS_SF||mxClient.IS_GC){var c=n.createElement("a");c.setAttribute("href","#mxPage-"+l),mxUtils.write(c,l,n),d.appendChild(c)}else mxUtils.write(d,l,n);o.appendChild(d)}i.appendChild(o)}return a.appendChild(i),a},mxPrintPreview.prototype.renderPage=function(e,t,n){var a=document.createElement("div");try{a.style.width=e+"px",a.style.height=t+"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=t-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),n(i)}catch(e){throw a.parentNode.removeChild(a),e}return a},mxPrintPreview.prototype.addGraphFragment=function(e,t,n,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,t),e=null;try{var p=[this.graph.getModel().getRoot()];e=new mxTemporaryCellStates(a,n,p)}finally{if(mxClient.IS_IE)a.overlayPane.innerHTML="";else for(n=i.firstChild;null!=n;)p=n.nextSibling,"svg"==(t=n.nodeName.toLowerCase())?(n.setAttribute("width",parseInt(i.style.width)),n.setAttribute("height",parseInt(i.style.height))):"default"!=n.style.cursor&&"table"!=t&&n.parentNode.removeChild(n),n=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,t){this.styles[e]=t},mxStylesheet.prototype.getCellStyle=function(e,t){var n=t;if(null!=e&&0<e.length)for(var a=e.split(";"),i=(n=null!=n&&";"!=e.charAt(0)?mxUtils.clone(n):{},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 n[r]:mxUtils.isNumeric(o)?n[r]=parseFloat(o):n[r]=o}else if(null!=(o=this.styles[o]))for(r in o)n[r]=o[r]}return n},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,t){if(e=e||0,t=null!=t?t:new mxRectangle(this.x,this.y,this.width,this.height),null!=this.shape&&null!=this.shape.stencil){var n=this.shape.stencil.computeAspect(this.style,t.x,t.y,t.width,t.height);t.x=n.x,t.y=n.y,t.width=this.shape.stencil.w0*n.width,t.height=this.shape.stencil.h0*n.height}return 0!=e&&t.grow(e),t},mxCellState.prototype.setAbsoluteTerminalPoint=function(e,t){t?(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,t){t?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 t=0;t<this.absolutePoints.length;t++)e.absolutePoints[t]=this.absolutePoints[t].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 t=[],n=0;n<e.length;n++)this.graph.isCellSelectable(e[n])&&t.push(e[n]);this.changeSelection(t,this.cells)}},mxGraphSelectionModel.prototype.getFirstSelectableCell=function(e){if(null!=e)for(var t=0;t<e.length;t++)if(this.graph.isCellSelectable(e[t]))return e[t];return null},mxGraphSelectionModel.prototype.addCell=function(e){null!=e&&this.addCells([e])},mxGraphSelectionModel.prototype.addCells=function(e){if(null!=e){var t=null;this.singleSelection&&(t=this.cells,e=[this.getFirstSelectableCell(e)]);for(var n=[],a=0;a<e.length;a++)!this.isSelected(e[a])&&this.graph.isCellSelectable(e[a])&&n.push(e[a]);this.changeSelection(n,t)}},mxGraphSelectionModel.prototype.removeCell=function(e){null!=e&&this.removeCells([e])},mxGraphSelectionModel.prototype.removeCells=function(e){if(null!=e){for(var t=[],n=0;n<e.length;n++)this.isSelected(e[n])&&t.push(e[n]);this.changeSelection(null,t)}},mxGraphSelectionModel.prototype.changeSelection=function(e,t){if(null!=e&&0<e.length&&null!=e[0]||null!=t&&0<t.length&&null!=t[0]){var n=new mxSelectionChange(this,e,t);n.execute();var a=new mxUndoableEdit(this,!1);a.add(n),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 t=0;t<this.removed.length;t++)this.selectionModel.cellRemoved(this.removed[t]);if(null!=this.added)for(t=0;t<this.added.length;t++)this.selectionModel.cellAdded(this.added[t]);t=this.added,this.added=this.removed,this.removed=t,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),t=this.graph.isLabelClipped(e.cell),n=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),n?(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);t&&(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&&(!t&&n||(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"),!t&&n||(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,t){null==this.textarea&&this.init(),this.stopEditing(!0);var n=this.graph.getView().getState(e);if(null!=n){this.editingCell=e,this.trigger=t,(this.textNode=null)!=n.text&&this.isHideLabel(n)&&(this.textNode=n.text.node,this.textNode.style.visibility="hidden");var a=this.graph.getView().scale,i=(a=mxUtils.getValue(n.style,mxConstants.STYLE_FONTSIZE,mxConstants.DEFAULT_FONTSIZE)*a,mxUtils.getValue(n.style,mxConstants.STYLE_FONTFAMILY,mxConstants.DEFAULT_FONTFAMILY)),s=mxUtils.getValue(n.style,mxConstants.STYLE_FONTCOLOR,"black"),o=mxUtils.getValue(n.style,mxConstants.STYLE_ALIGN,mxConstants.ALIGN_LEFT),r=(mxUtils.getValue(n.style,mxConstants.STYLE_FONTSTYLE,0)&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD,l=(mxUtils.getValue(n.style,mxConstants.STYLE_FONTSTYLE,0)&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC,d=(mxUtils.getValue(n.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(n),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==(n=this.getInitialValue(n,t))||0==n.length?(n=this.getEmptyLabelText(),this.clearOnChange=!0):this.clearOnChange=!1,this.setModified(!1),this.textarea.value=n,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"),t=e.style;return t.position="absolute",t.whiteSpace="nowrap",t.visibility="hidden",t.display=mxClient.IS_QUIRKS?"inline":"inline-block",t.zoom="1",t.verticalAlign="top",t.lineHeight=this.textarea.style.lineHeight,t.fontSize=this.textarea.style.fontSize,t.fontFamily=this.textarea.style.fontFamily,t.fontWeight=this.textarea.style.fontWeight,t.textAlign=this.textarea.style.textAlign,t.fontStyle=this.textarea.style.fontStyle,t.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,t){return this.graph.getEditingValue(e.cell,t)},mxCellEditor.prototype.getCurrentValue=function(){return this.textarea.value.replace(/\r/g,"")},mxCellEditor.prototype.isHideLabel=function(e){return!0},mxCellEditor.prototype.getMinimumSize=function(e){var t=this.graph.getView().scale;return new mxRectangle(0,0,null==e.text?30:e.text.size*t+20,"left"==this.textarea.style.textAlign?120:40)},mxCellEditor.prototype.getEditorBounds=function(e){var t=this.graph.getModel().isEdge(e.cell),n=this.graph.getView().scale,a=(i=this.getMinimumSize(e)).width,i=i.height,s=parseInt(e.style[mxConstants.STYLE_SPACING]||2)*n,o=parseInt(e.style[mxConstants.STYLE_SPACING_TOP]||0)*n+s,r=parseInt(e.style[mxConstants.STYLE_SPACING_RIGHT]||0)*n+s,l=parseInt(e.style[mxConstants.STYLE_SPACING_BOTTOM]||0)*n+s;n=parseInt(e.style[mxConstants.STYLE_SPACING_LEFT]||0)*n+s,r=new mxRectangle(e.x,e.y,Math.max(a,e.width-n-r),Math.max(i,e.height-o-l));return t?(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+=n,r.y+=o,null!=e.text&&null!=e.text.boundingBox&&(t?(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)&&((t=mxUtils.getValue(e.style,mxConstants.STYLE_LABEL_POSITION,mxConstants.ALIGN_CENTER))==mxConstants.ALIGN_LEFT?r.x-=e.width:t==mxConstants.ALIGN_RIGHT&&(r.x+=e.width),(t=mxUtils.getValue(e.style,mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.ALIGN_MIDDLE))==mxConstants.ALIGN_TOP?r.y-=e.height:t==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,t){mxCellRenderer.prototype.defaultShapes[e]=t},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,t){var n=e.view.graph.getModel();null!=e.view.graph.container&&null==e.shape&&e.cell!=e.view.currentRoot&&(n.isVertex(e.cell)||n.isEdge(e.cell))&&(this.createShape(e),null==e.shape||null!=t&&!t||(this.initializeShape(e),e.view.graph.ordered||n.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,t){for(var n=null,a=e.view.graph,i=a.getModel(),s=e.cell,o=i.getParent(s);null!=o&&null==n;)n=this.findPreviousStateInContainer(a,o,s,t),s=o,o=i.getParent(s);return n},mxCellRenderer.prototype.findPreviousStateInContainer=function(e,t,n,a){var i=null,s=e.getModel();for(n=null!=n?t.getIndex(n)-1:s.getChildCount(t)-1;0<=n&&null==i;n--)i=this.findPreviousStateInContainer(e,s.getChildAt(t,n),null,a);return null!=i||(null==(i=e.view.getState(t))||null!=i.shape&&null!=i.shape.node&&i.shape.node.parentNode==a)||(i=null),i},mxCellRenderer.prototype.order=function(e){var t=e.shape.node.parentNode,n=this.getPreviousStateInContainer(e,t),a=t.firstChild;null!=n&&(a=n.shape.node,null!=n.text&&null!=n.text.node&&n.text.node.parentNode==t&&(a=n.text.node),a=a.nextSibling),this.insertState(e,a)},mxCellRenderer.prototype.orderEdge=function(e){var t=(n=e.view).graph.getModel();if(n.graph.keepEdgesInForeground)null!=this.firstEdge&&null!=this.firstEdge.parentNode&&this.firstEdge.parentNode==e.shape.node.parentNode||(this.firstEdge=e.shape.node);else if(n.graph.keepEdgesInBackground){var n,a=e.shape.node,i=a.parentNode;t=t.getParent(e.cell);null!=(i=null!=(n=n.getState(t))&&null!=n.shape&&null!=n.shape.node?n.shape.node.nextSibling:i.firstChild)&&i!=a&&this.insertState(e,i)}},mxCellRenderer.prototype.insertState=function(e,t){e.shape.node.parentNode.insertBefore(e.shape.node,t),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 t=mxStencilRegistry.getStencil(e.style[mxConstants.STYLE_SHAPE]);null!=t?e.shape=new mxShape(t):(t=this.getShapeConstructor(e),e.shape=new t),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 t=this.getShape(e.style[mxConstants.STYLE_SHAPE]);return null==t&&(t=e.view.graph.getModel().isEdge(e.cell)?this.defaultEdgeShape:this.defaultVertexShape),t},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,t,n){var a=e.shape[t],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),n=i.swimlaneIndicatorColorAttribute):"indicated"==a&&(e.shape[t]=e.shape.indicatorColor),null!=s&&(a=i.getView().getState(s),(e.shape[t]=null)!=a&&(e.shape[t]=null!=a.shape&&"indicatorColor"!=t?a.shape[t]:a.style[n]))},mxCellRenderer.prototype.getLabelValue=function(e){return e.view.graph.getLabel(e.cell)},mxCellRenderer.prototype.createLabel=function(n,e){var a=n.view.graph;if(a.getModel().isEdge(n.cell),0<n.style[mxConstants.STYLE_FONTSIZE]||null==n.style[mxConstants.STYLE_FONTSIZE]){var t=a.isHtmlLabel(n.cell)||null!=e&&mxUtils.isNode(e);n.text=new this.defaultTextShape(e,new mxRectangle,n.style[mxConstants.STYLE_ALIGN]||mxConstants.ALIGN_CENTER,a.getVerticalAlign(n),n.style[mxConstants.STYLE_FONTCOLOR],n.style[mxConstants.STYLE_FONTFAMILY],n.style[mxConstants.STYLE_FONTSIZE],n.style[mxConstants.STYLE_FONTSTYLE],n.style[mxConstants.STYLE_SPACING],n.style[mxConstants.STYLE_SPACING_TOP],n.style[mxConstants.STYLE_SPACING_RIGHT],n.style[mxConstants.STYLE_SPACING_BOTTOM],n.style[mxConstants.STYLE_SPACING_LEFT],n.style[mxConstants.STYLE_HORIZONTAL],n.style[mxConstants.STYLE_LABEL_BACKGROUNDCOLOR],n.style[mxConstants.STYLE_LABEL_BORDERCOLOR],a.isWrapping(n.cell)&&a.isHtmlLabel(n.cell),a.isLabelClipped(n.cell),n.style[mxConstants.STYLE_OVERFLOW],n.style[mxConstants.STYLE_LABEL_PADDING]),n.text.opacity=mxUtils.getValue(n.style,mxConstants.STYLE_TEXT_OPACITY,100),n.text.dialect=t?mxConstants.DIALECT_STRICTHTML:n.view.graph.dialect,n.text.state=n,this.initializeLabel(n);var i=!1,s=function(e){var t=n;return(mxClient.IS_TOUCH||i)&&(t=mxEvent.getClientX(e),e=mxEvent.getClientY(e),e=mxUtils.convertPoint(a.container,t,e),t=a.view.getState(a.getCellAt(e.x,e.y))),t};mxEvent.addGestureListeners(n.text.node,mxUtils.bind(this,function(e){this.isLabelEvent(n,e)&&(a.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,n)),i=a.dialect!=mxConstants.DIALECT_SVG&&"IMG"==mxEvent.getSource(e).nodeName)}),mxUtils.bind(this,function(e){this.isLabelEvent(n,e)&&a.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,s(e)))}),mxUtils.bind(this,function(e){this.isLabelEvent(n,e)&&(a.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e,s(e))),i=!1)})),mxEvent.addListener(n.text.node,"dblclick",mxUtils.bind(this,function(e){this.isLabelEvent(n,e)&&(a.dblClick(e,n.cell),mxEvent.consume(e))}))}},mxCellRenderer.prototype.initializeLabel=function(e){var t=e.view.graph;e.text.dialect!=mxConstants.DIALECT_SVG&&(mxClient.IS_SVG&&mxClient.NO_FO?e.text.init(t.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 t=e.view.graph.getCellOverlays(e.cell),n=null;if(null!=t){n=new mxDictionary;for(var a=0;a<t.length;a++){var i=null!=e.overlays?e.overlays.remove(t[a]):null;null==i&&((i=new mxImageShape(new mxRectangle,t[a].image.src)).dialect=e.view.graph.dialect,i.preserveImageAspect=!1,i.overlay=t[a],this.initializeOverlay(e,i),this.installCellOverlayListeners(e,t[a],i),null!=t[a].cursor&&(i.node.style.cursor=t[a].cursor)),n.put(t[a],i)}}null!=e.overlays&&e.overlays.visit(function(e,t){t.destroy()}),e.overlays=n},mxCellRenderer.prototype.initializeOverlay=function(e,t){t.init(e.view.getOverlayPane())},mxCellRenderer.prototype.installCellOverlayListeners=function(t,n,e){var a=t.view.graph;mxEvent.addListener(e.node,"click",function(e){a.isEditing()&&a.stopEditing(!a.isInvokesStopCellEditing()),n.fireEvent(new mxEventObject(mxEvent.CLICK,"event",e,"cell",t.cell))}),mxEvent.addGestureListeners(e.node,function(e){mxEvent.consume(e)},function(e){a.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,t))}),mxClient.IS_TOUCH&&mxEvent.addListener(e.node,"touchend",function(e){n.fireEvent(new mxEventObject(mxEvent.CLICK,"event",e,"cell",t.cell))})},mxCellRenderer.prototype.createControl=function(n){var a=n.view.graph,e=a.getFoldingImage(n);if(a.foldingEnabled&&null!=e){if(null==n.control){var t=new mxRectangle(0,0,e.width,e.height);n.control=new mxImageShape(t,e.src),n.control.preserveImageAspect=!1,n.control.dialect=a.dialect,this.initControl(n,n.control,!0,function(e){if(a.isEnabled()){var t=!a.isCellCollapsed(n.cell);a.foldCells(t,!1,[n.cell]),mxEvent.consume(e)}})}}else null!=n.control&&(n.control.destroy(),n.control=null)},mxCellRenderer.prototype.initControl=function(t,e,n,a){var i=t.view.graph;return i.isHtmlLabel(t.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(t.view.getOverlayPane()),e=e.innerNode||e.node,a&&(i.isEnabled()&&(e.style.cursor="pointer"),mxEvent.addListener(e,"click",a)),n&&mxEvent.addGestureListeners(e,function(e){i.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,t)),mxEvent.consume(e)},function(e){i.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,t))}),e},mxCellRenderer.prototype.isShapeEvent=function(e,t){return!0},mxCellRenderer.prototype.isLabelEvent=function(e,t){return!0},mxCellRenderer.prototype.installListeners=function(n){var a=n.view.graph,t=function(e){var t=n;return(a.dialect!=mxConstants.DIALECT_SVG&&"IMG"==mxEvent.getSource(e).nodeName||mxClient.IS_TOUCH)&&(t=mxEvent.getClientX(e),e=mxEvent.getClientY(e),e=mxUtils.convertPoint(a.container,t,e),t=a.view.getState(a.getCellAt(e.x,e.y))),t},i=!1;mxEvent.addListener(n.shape.node,"gesturestart",mxUtils.bind(this,function(e){a.lastTouchTime=0,i=!0,mxEvent.consume(e)})),mxEvent.addGestureListeners(n.shape.node,mxUtils.bind(this,function(e){this.isShapeEvent(n,e)&&!i?a.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,null!=n.shape&&mxEvent.getSource(e)==n.shape.content?null:n)):i&&mxEvent.consume(e)}),mxUtils.bind(this,function(e){this.isShapeEvent(n,e)&&!i?a.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,null!=n.shape&&mxEvent.getSource(e)==n.shape.content?null:t(e))):i&&mxEvent.consume(e)}),mxUtils.bind(this,function(e){this.isShapeEvent(n,e)&&!i?a.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e,null!=n.shape&&mxEvent.getSource(e)==n.shape.content?null:t(e))):i&&mxEvent.consume(e)}));var s=mxClient.IS_TOUCH?"gestureend":"dblclick";mxEvent.addListener(n.shape.node,s,mxUtils.bind(this,function(e){i=!1,"gestureend"==s?(a.lastTouchTime=0,a.gestureEnabled&&(a.handleGesture(n,e),mxEvent.consume(e))):this.isShapeEvent(n,e)&&(a.dblClick(e,null!=n.shape&&mxEvent.getSource(e)==n.shape.content?null:n.cell),mxEvent.consume(e))}))},mxCellRenderer.prototype.redrawLabel=function(e,t){var n=this.getLabelValue(e);if(null==e.text&&null!=n&&(mxUtils.isNode(n)||0<n.length)?this.createLabel(e,n):null==e.text||null!=n&&0!=n.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);!t&&e.text.value==n&&e.text.isWrapping==a&&e.text.isClipping==i&&e.text.scale==e.view.scale&&e.text.bounds.equals(s)||(e.text.value=n,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 t=e.view.graph,n=e.view.scale,a=t.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*n,i.y+=a.y*n,null!=(t=t.getCellGeometry(e.cell))&&(i.width=Math.max(0,e.text.margin.x*t.width*n-e.text.spacingLeft*n-e.text.spacingRight*n),i.height=Math.max(0,e.text.margin.y*t.height*n-e.text.spacingTop*n-e.text.spacingBottom*n))):(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),t.isSwimlane(e.cell)&&(0<(t=t.getStartSize(e.cell)).width?(a=Math.min(i.width,t.width*n),e.shape.flipH&&(i.x+=i.width-a),i.width=a):0<t.height&&(a=Math.min(i.height,t.height*n),e.shape.flipV&&(i.y+=i.height-a),i.height=a)),this.rotateLabelBounds(e,i)),i},mxCellRenderer.prototype.rotateLabelBounds=function(e,t){if(e.text.isPaintBoundsInverted()){var n=(e.width-e.height)/2;t.x+=n,t.y-=n,n=t.width,t.width=t.height,t.height=n}if(t.x-=e.text.margin.x*t.width,t.y-=e.text.margin.y*t.height,"fill"!=e.style[mxConstants.STYLE_OVERFLOW]){n=e.view.scale;var a=e.text.getSpacing();t.x+=a.x*n,t.y+=a.y*n,t.width=Math.max(0,t.width-e.text.spacingLeft*n-e.text.spacingRight*n),t.height=Math.max(0,t.height-e.text.spacingTop*n-e.text.spacingBottom*n)}var i=e.text.getTextRotation();0!=i&&null!=e&&e.view.graph.model.isVertex(e.cell)&&(n=e.getCenterX(),a=e.getCenterY(),t.x!=n||t.y!=a)&&(i*=Math.PI/180,pt=mxUtils.getRotatedPoint(new mxPoint(t.x,t.y),Math.cos(i),Math.sin(i),new mxPoint(n,a)),t.x=pt.x,t.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,t){var n=t.overlay.getBounds(s);if(!s.view.graph.getModel().isEdge(s.cell)&&null!=s.shape&&0!=r){var a=n.getCenterX(),i=n.getCenterY();a=(i=mxUtils.getRotatedPoint(new mxPoint(a,i),l,d,new mxPoint(s.getCenterX(),s.getCenterY()))).x,i=i.y;n.x=Math.round(a-n.width/2),n.y=Math.round(i-n.height/2)}!o&&null!=t.bounds&&t.scale==s.view.scale&&t.bounds.equals(n)||(t.bounds=n,t.scale=s.view.scale,t.redraw())})}},mxCellRenderer.prototype.redrawControl=function(e,t){if(null!=e.control){var n=this.getControlBounds(e),a=this.legacyControlPosition?mxUtils.getValue(e.style,mxConstants.STYLE_ROTATION,0):e.shape.getTextRotation(),i=e.view.scale;!t&&e.control.scale==i&&e.control.bounds.equals(n)&&e.control.rotation==a||(e.control.rotation=a,e.control.bounds=n,e.control.scale=i,e.control.redraw())}},mxCellRenderer.prototype.getControlBounds=function(e){if(null==e.control)return null;var t=e.control.scale,n=e.control.bounds.width/t,a=(t=e.control.bounds.height/t,e.view.scale),i=e.getCenterX(),s=e.getCenterY();if(!e.view.graph.getModel().isEdge(e.cell)&&(i=e.x+n*a,s=e.y+t*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-n/2*a),Math.round(s-t/2*a),Math.round(n*a),Math.round(t*a))},mxCellRenderer.prototype.redraw=function(e,t,n){if(null!=e.shape){var a=!1;e.view.graph.getModel().isEdge(e.cell),reconfigure=null!=t&&t,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),t=!0),delete e.invalidOrder,delete e.orderChanged,!t&&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==n||n?e.shape.redraw():e.shape.updateBoundingBox()),(null==n||n)&&(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,t){t.destroy()}),e.overlays=null),null!=e.control&&(e.control.destroy(),e.control=null),e.shape.destroy(),e.shape=null)};var mxEdgeStyle={EntityRelation:function(e,t,n,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)(t=new mxCellState).x=r.x,t.y=r.y;else{if(null==t)return;var c=mxUtils.getPortConstraints(t,e,!0,mxConstants.DIRECTION_MASK_NONE);c!=mxConstants.DIRECTION_MASK_NONE?d=c==mxConstants.DIRECTION_MASK_WEST:(r=o.getCellGeometry(t.cell)).relative?d=r.x<=.5:null!=n&&(d=n.x+n.width<t.x)}r=!0,null!=l?((n=new mxCellState).x=l.x,n.y=l.y):null!=n&&((c=mxUtils.getPortConstraints(n,e,!1,mxConstants.DIRECTION_MASK_NONE))!=mxConstants.DIRECTION_MASK_NONE?r=c==mxConstants.DIRECTION_MASK_WEST:(e=o.getCellGeometry(n.cell)).relative?r=e.x<=.5:null!=t&&(r=t.x+t.width<n.x)),null!=t&&null!=n&&(e=d?t.x:t.x+t.width,t=s.getRoutingCenterY(t),o=r?n.x:n.x+n.width,n=s.getRoutingCenterY(n),s=new mxPoint(e+(d?-a:a),t),l=new mxPoint(o+(r?-a:a),n),d==r?(a=d?Math.min(e,o)-a:Math.max(e,o)+a,i.push(new mxPoint(a,t)),i.push(new mxPoint(a,n))):(s.x<l.x==d?(a=t+(n-t)/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,t,n,a,i){if(null!=t){var s=(n=e.view).graph;null!=(a=null!=a&&0<a.length?a[0]:null)&&(a=n.transformControlPoint(e,a),mxUtils.contains(t,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)*n.scale;(e=mxUtils.getValue(e.style,mxConstants.STYLE_DIRECTION,mxConstants.DIRECTION_WEST))==mxConstants.DIRECTION_NORTH||e==mxConstants.DIRECTION_SOUTH?(o=n.getRoutingCenterX(t),r=s):(l=n.getRoutingCenterY(t),d=s),null==a||a.x<t.x||a.x>t.x+t.width?null!=a?(o=a.x,d=Math.max(Math.abs(l-a.y),d)):e==mxConstants.DIRECTION_NORTH?l=t.y-2*r:e==mxConstants.DIRECTION_SOUTH?l=t.y+t.height+2*r:o=e==mxConstants.DIRECTION_EAST?t.x-2*d:t.x+t.width+2*d:null!=a&&(o=n.getRoutingCenterX(t),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,t,n,a,i){var s=null!=a&&0<a.length?a[0]:null,o=!1,r=!1;if(null!=t&&null!=n)if(null!=s){var l=Math.min(t.x,n.x),d=Math.max(t.x+t.width,n.x+n.width),c=(r=Math.min(t.y,n.y),Math.max(t.y+t.height,n.y+n.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(t.x,n.x))==(d=Math.min(t.x+t.width,n.x+n.width)))||(r=(r=Math.max(t.y,n.y))==(c=Math.min(t.y+t.height,n.y+n.height)));r||!o&&e.style[mxConstants.STYLE_ELBOW]!=mxConstants.ELBOW_VERTICAL?mxEdgeStyle.SideToSide(e,t,n,a,i):mxEdgeStyle.TopToBottom(e,t,n,a,i)},SideToSide:function(e,t,n,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&&((t=new mxCellState).x=o.x,t.y=o.y),null!=r&&((n=new mxCellState).x=r.x,n.y=r.y),null!=t&&null!=n&&(e=Math.max(t.x,n.x),o=Math.min(t.x+t.width,n.x+n.width),e=null!=a?a.x:o+(e-o)/2,o=s.getRoutingCenterY(t),s=s.getRoutingCenterY(n),null!=a&&(a.y>=t.y&&a.y<=t.y+t.height&&(o=a.y),a.y>=n.y&&a.y<=n.y+n.height&&(s=a.y)),!mxUtils.contains(n,e,o)&&!mxUtils.contains(t,e,o)&&i.push(new mxPoint(e,o)),!mxUtils.contains(n,e,s)&&!mxUtils.contains(t,e,s)&&i.push(new mxPoint(e,s)),1==i.length&&(null!=a?!mxUtils.contains(n,e,a.y)&&!mxUtils.contains(t,e,a.y)&&i.push(new mxPoint(e,a.y)):(s=Math.max(t.y,n.y),t=Math.min(t.y+t.height,n.y+n.height),i.push(new mxPoint(e,s+(t-s)/2)))))},TopToBottom:function(e,t,n,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&&((t=new mxCellState).x=o.x,t.y=o.y),null!=r&&((n=new mxCellState).x=r.x,n.y=r.y),null!=t&&null!=n&&(o=Math.max(t.y,n.y),r=Math.min(t.y+t.height,n.y+n.height),e=s.getRoutingCenterX(t),null!=a&&a.x>=t.x&&a.x<=t.x+t.width&&(e=a.x),o=null!=a?a.y:r+(o-r)/2,!mxUtils.contains(n,e,o)&&!mxUtils.contains(t,e,o)&&i.push(new mxPoint(e,o)),e=null!=a&&a.x>=n.x&&a.x<=n.x+n.width?a.x:s.getRoutingCenterX(n),!mxUtils.contains(n,e,o)&&!mxUtils.contains(t,e,o)&&i.push(new mxPoint(e,o)),1==i.length&&(null!=a&&1==i.length?!mxUtils.contains(n,a.x,o)&&!mxUtils.contains(t,a.x,o)&&i.push(new mxPoint(a.x,o)):(s=Math.max(t.x,n.x),t=Math.min(t.x+t.width,n.x+n.width),i.push(new mxPoint(s+(t-s)/2,o)))))},SegmentConnector:function(e,t,n,a,i){var s=e.absolutePoints,o=!0,r=null,l=s[0];null==l&&null!=t?l=new mxPoint(e.view.getRoutingCenterX(t),e.view.getRoutingCenterY(t)):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=t,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=n,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!=t&&(r.y<t.y||r.y>t.y+t.height))?i.push(new mxPoint(l.x,r.y)):!o&&(null!=s[0]&&s[0].x!=r.x||null==s[0]&&null!=t&&(r.x<t.x||r.x>t.x+t.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!=n&&(l=new mxPoint(e.view.getRoutingCenterX(n),e.view.getRoutingCenterY(n))),o&&(null!=s[d]&&s[d].y!=r.y||null==s[d]&&null!=n&&(r.y<n.y||r.y>n.y+n.height))?i.push(new mxPoint(l.x,r.y)):!o&&(null!=s[d]&&s[d].x!=r.x||null==s[d]&&null!=n&&(r.x<n.x||r.x>n.x+n.width))&&i.push(new mxPoint(r.x,l.y)),null==s[0]&&null!=t)for(;1<i.length&&mxUtils.contains(t,i[1].x,i[1].y);)i=i.splice(1,1);if(null==s[d]&&null!=n)for(;1<i.length&&mxUtils.contains(n,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,t,n,a,i){var s=e.view.graph,o=null!=t&&s.getModel().isEdge(t.cell);s=null!=n&&s.getModel().isEdge(n.cell);if(null!=a&&0<a.length||o||s)mxEdgeStyle.SegmentConnector(e,t,n,a,i);else{var r=(a=e.absolutePoints)[0],l=a[a.length-1];a=null!=t?t.x:r.x;o=null!=t?t.y:r.y;var d=null!=t?t.width:1,c=null!=t?t.height:1,m=null!=n?n.x:l.x,u=null!=n?n.y:l.y,p=null!=n?n.width:1,g=null!=n?n.height:1,v=(s=e.view.scale*mxEdgeStyle.orthBuffer,[mxConstants.DIRECTION_MASK_ALL,mxConstants.DIRECTION_MASK_ALL]);for(null!=t&&(v[0]=mxUtils.getPortConstraints(t,e,!0,mxConstants.DIRECTION_MASK_ALL)),null!=n&&(v[1]=mxUtils.getPortConstraints(n,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)!=t&&(c=r),t=[[.5,.5],[.5,.5]],d=0;d<2;d++)null!=c&&(t[d][0]=(c.x-a[d][0])/a[d][2],t[d][0]<.01?e[d]=mxConstants.DIRECTION_MASK_WEST:.99<t[d][0]&&(e[d]=mxConstants.DIRECTION_MASK_EAST),t[d][1]=(c.y-a[d][1])/a[d][3],t[d][1]<.01?e[d]=mxConstants.DIRECTION_MASK_NORTH:.99<t[d][1]&&(e[d]=mxConstants.DIRECTION_MASK_SOUTH)),(c=null)!=n&&(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),n=[],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]),n[d]=u[d][0]&v[d],n[d]|=(u[d][1]&v[d])<<8,n[d]|=(u[1-d][d]&v[d])<<16,n[d]|=(u[1-d][1-d]&v[d])<<24,0==(15&n[d])&&(n[d]<<=8),0==(3840&n[d])&&(n[d]=15&n[d]|n[d]>>8),0==(983040&n[d])&&(n[d]=65535&n[d]|(251658240&n[d])>>8),e[d]=15&n[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]+=t[0][1]*a[0][3];break;case mxConstants.DIRECTION_MASK_SOUTH:mxEdgeStyle.wayPoints1[0][0]+=t[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]+=t[0][1]*a[0][3];break;case mxConstants.DIRECTION_MASK_NORTH:mxEdgeStyle.wayPoints1[0][0]+=t[0][0]*a[0][2],mxEdgeStyle.wayPoints1[0][1]-=s}for(r=n=(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)!=n&&(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]+t[p][0]*a[p][2]:u?a[p][1]+t[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--:n=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,t,n,a){var i=e[0]==mxConstants.DIRECTION_MASK_EAST?3:e[0];return e=e[1]==mxConstants.DIRECTION_MASK_EAST?3:e[1],(i-=t)<1&&(i+=4),(e-=t)<1&&(e+=4),t=routePatterns[i-1][e-1],0!=n&&0!=a||null!=inlineRoutePatterns[i-1][e-1]&&(t=inlineRoutePatterns[i-1][e-1]),t}},mxStyleRegistry={values:[],putValue:function(e,t){mxStyleRegistry.values[e]=t},getValue:function(e){return mxStyleRegistry.values[e]},getName:function(e){for(var t in mxStyleRegistry.values)if(mxStyleRegistry.values[t]==e)return t;return null}};function mxGraphView(e){this.graph=e,this.translate=new mxPoint,this.graphBounds=new mxRectangle,this.states=new mxDictionary}function mxCurrentRootChange(e,t){if(this.view=e,this.previous=this.root=t,this.isUp=null==t,!this.isUp)for(var n=this.view.currentRoot,a=this.view.graph.getModel();null!=n;){if(n==t){this.isUp=!0;break}n=a.getParent(n)}}function mxGraph(e,t,n,a){this.mouseListeners=null,this.renderHint=n,this.dialect=mxClient.IS_SVG?mxConstants.DIALECT_SVG:n==mxConstants.RENDERING_HINT_EXACT&&mxClient.IS_VML?mxConstants.DIALECT_VML:n==mxConstants.RENDERING_HINT_FASTEST?mxConstants.DIALECT_STRICTHTML:n==mxConstants.RENDERING_HINT_FASTER?mxConstants.DIALECT_PREFERHTML:mxConstants.DIALECT_MIXEDHTML,this.model=null!=t?t: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,t){this.graphModelChanged(t.getProperty("edit").changes)}),this.model.addListener(mxEvent.CHANGE,this.graphModelChangeListener),this.createHandlers(),null!=e&&this.init(e),this.view.revalidate()}function mxCellOverlay(e,t,n,a,i,s){this.image=e,this.tooltip=t,this.align=null!=n?n: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,t){this.source=e,null!=t&&this.init(t)}function mxMultiplicity(e,t,n,a,i,s,o,r,l,d){this.source=e,this.type=t,this.attr=n,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,t){this.isEnabled()&&this.beforeUndo(t.getProperty("edit"))}),this.moveHandler=mxUtils.bind(this,function(e,t){this.isEnabled()&&this.cellsMoved(t.getProperty("cells"),t.getProperty("event"))}),this.setGraph(e)}function mxSpaceManager(e,t,n,a){this.resizeHandler=mxUtils.bind(this,function(e,t){this.isEnabled()&&this.cellsResized(t.getProperty("cells"))}),this.foldHandler=mxUtils.bind(this,function(e,t){this.isEnabled()&&this.cellsResized(t.getProperty("cells"))}),this.shiftRightwards=null==t||t,this.shiftDownwards=null==n||n,this.extendParents=null==a||a,this.setGraph(e)}function mxSwimlaneManager(e,t,n,a){this.horizontal=null==t||t,this.addEnabled=null==n||n,this.resizeEnabled=null==a||a,this.addHandler=mxUtils.bind(this,function(e,t){this.isEnabled()&&this.isAddEnabled()&&this.cellsAdded(t.getProperty("cells"))}),this.resizeHandler=mxUtils.bind(this,function(e,t){this.isEnabled()&&this.isResizeEnabled()&&this.cellsResized(t.getProperty("cells"))}),this.setGraph(e)}function mxTemporaryCellStates(e,t,n){if(this.view=e,t=null!=t?t:1,this.oldBounds=e.getGraphBounds(),this.oldStates=e.getStates(),this.oldScale=e.getScale(),e.setStates(new mxDictionary),e.setScale(t),null!=n){t=e.createState(new mxCell);for(var a=0;a<n.length;a++)e.validateBounds(t,n[a]);var i=null;for(a=0;a<n.length;a++){var s=e.validatePoints(t,n[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,t){this.point=e,this.perimeter=null==t||t}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,t){null!=e&&(this.graph=e,this.factoryMethod=t,this.graph.addMouseListener(this),this.init())}function mxCellMarker(e,t,n,a){mxEventSource.call(this),null!=e&&(this.graph=e,this.validColor=null!=t?t:mxConstants.DEFAULT_VALID_COLOR,this.invalidColor=null!=t?n: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,t){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,t){mxEventSource.call(this),null!=e&&(this.graph=e,this.factoryMethod=t,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,t){null!=e&&(this.graph=e,this.target=t||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,t){null!=e&&(this.graph=e,this.delay=t||500,this.graph.addMouseListener(this))}function mxCellTracker(e,t,n){mxCellMarker.call(this,e,t),this.graph.addMouseListener(this),null!=n&&(this.getCell=n),mxClient.IS_IE&&mxEvent.addListener(window,"unload",mxUtils.bind(this,function(){this.destroy()}))}function mxCellHighlight(e,t,n,a){null!=e&&(this.graph=e,this.highlightColor=null!=t?t:mxConstants.DEFAULT_VALID_COLOR,this.strokeWidth=null!=n?n: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(t){if(null!=t){this.editor=t,this.handler=new mxKeyHandler(t.graph);var n=this.handler.escape;this.handler.escape=function(e){n.apply(this,arguments),t.hideProperties(),t.fireEvent(new mxEventObject(mxEvent.ESCAPE,"event",e))}}}function mxDefaultPopupMenu(e){this.config=e}function mxDefaultToolbar(e,t){this.editor=t,null!=e&&null!=t&&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 t=null;if(null!=e&&0<e.length)for(var n=this.graph.getModel(),a=0;a<e.length;a++)if(n.isVertex(e[a])||n.isEdge(e[a])){var i=this.getState(e[a]);null!=i&&(null==t?t=new mxRectangle(i.x,i.y,i.width,i.height):t.add(i))}return t},mxGraphView.prototype.setCurrentRoot=function(e){if(this.currentRoot!=e){var t=new mxCurrentRootChange(this,e);t.execute();var n=new mxUndoableEdit(this,!1);n.add(t),this.fireEvent(new mxEventObject(mxEvent.UNDO,"edit",n)),this.graph.sizeDidChange()}return e},mxGraphView.prototype.scaleAndTranslate=function(e,t,n){var a=this.scale,i=new mxPoint(this.translate.x,this.translate.y);this.scale==e&&this.translate.x==t&&this.translate.y==n||(this.scale=e,this.translate.x=t,this.translate.y=n,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 t=this.scale;this.scale!=e&&(this.scale=e,this.isEventsEnabled()&&(this.revalidate(),this.graph.sizeDidChange())),this.fireEvent(new mxEventObject(mxEvent.SCALE,"scale",e,"previousScale",t))},mxGraphView.prototype.getTranslate=function(){return this.translate},mxGraphView.prototype.setTranslate=function(e,t){var n=new mxPoint(this.translate.x,this.translate.y);this.translate.x==e&&this.translate.y==t||(this.translate.x=e,this.translate.y=t,this.isEventsEnabled()&&(this.revalidate(),this.graph.sizeDidChange())),this.fireEvent(new mxEventObject(mxEvent.TRANSLATE,"translate",this.translate,"previousTranslate",n))},mxGraphView.prototype.refresh=function(){null!=this.currentRoot&&this.clear(),this.revalidate()},mxGraphView.prototype.revalidate=function(){this.invalidate(),this.validate()},mxGraphView.prototype.clear=function(e,t,n){var a=this.graph.getModel();if(e=e||a.getRoot(),t=null!=t&&t,n=null==n||n,this.removeState(e),n&&(t||e!=this.currentRoot)){n=a.getChildCount(e);for(var i=0;i<n;i++)this.clear(a.getChildAt(e,i),t)}else this.invalidate(e)},mxGraphView.prototype.invalidate=function(e,t,n,a){var i=this.graph.getModel();if(e=e||i.getRoot(),t=null==t||t,n=null==n||n,a=null!=a&&a,null!=(o=this.getState(e))&&(o.invalid=!0,a&&(o.orderChanged=!0)),t)for(var s=i.getChildCount(e),o=0;o<s;o++){var r=i.getChildAt(e,o);this.invalidate(r,t,n,a)}if(n)for(a=i.getEdgeCount(e),o=0;o<a;o++)this.invalidate(i.getEdgeAt(e,o),t,n)},mxGraphView.prototype.validate=function(e){var t=mxLog.enter("mxGraphView.validate");window.status=mxResources.get(this.updatingDocumentResource)||this.updatingDocumentResource;var n=null;if(this.optimizeVmlReflows&&null!=this.canvas&&null==this.textDiv&&(8==document.documentMode||mxClient.IS_QUIRKS)){n=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!=n&&(this.canvas.style.display=n,document.body.removeChild(this.textDiv),this.textDiv=null),window.status=mxResources.get(this.doneResource)||this.doneResource,mxLog.leave("mxGraphView.validate",t)},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 t=new mxRectangle(0,0,1,1);this.backgroundImage=new mxImageShape(t,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?(t=this.getBackgroundPageBounds(),null==this.backgroundPageShape?(this.backgroundPageShape=this.createBackgroundPageShape(t),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=t,this.backgroundPageShape.redraw())):null!=this.backgroundPageShape&&(this.backgroundPageShape.destroy(),this.backgroundPageShape=null)},mxGraphView.prototype.getBackgroundPageBounds=function(){var e=this.graph.pageFormat,t=this.scale*this.graph.pageScale;return new mxRectangle(this.scale*this.translate.x,this.scale*this.translate.y,e.width*t,e.height*t)},mxGraphView.prototype.redrawBackgroundImage=function(e,t){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*t.width,e.bounds.height=this.scale*t.height,e.redraw()},mxGraphView.prototype.validateBounds=function(e,t){var n=this.graph.getModel(),a=this.getState(t,!0);if(null!=a&&a.invalid){if(this.graph.isCellVisible(t)){if(t!=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(t))){if(!n.isEdge(t)){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,n.isVertex(t)){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(t);null!=(i=this.graph.getChildOffsetForCell(t))&&(a.origin.x+=i.x,a.origin.y+=i.y)}if(null!=a&&(!this.graph.isCellCollapsed(t)||t==this.currentRoot))for(s=n.getChildCount(t),i=0;i<s;i++)o=n.getChildAt(t,i),this.validateBounds(a,o)},mxGraphView.prototype.updateVertexLabelOffset=function(e){var t=mxUtils.getValue(e.style,mxConstants.STYLE_LABEL_POSITION,mxConstants.ALIGN_CENTER);t==mxConstants.ALIGN_LEFT?e.absoluteOffset.x-=e.width:t==mxConstants.ALIGN_RIGHT&&(e.absoluteOffset.x+=e.width),(t=mxUtils.getValue(e.style,mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.ALIGN_MIDDLE))==mxConstants.ALIGN_TOP?e.absoluteOffset.y-=e.height:t==mxConstants.ALIGN_BOTTOM&&(e.absoluteOffset.y+=e.height)},mxGraphView.prototype.validatePoints=function(e,t){var n=this.graph.getModel(),a=this.getState(t),i=null;if(null!=a){if(a.invalid){var s=this.graph.getCellGeometry(t);if(null!=s&&n.isEdge(t)){var o=this.getState(this.getVisibleTerminal(t,!0));if(a.setVisibleTerminalState(o,!0),null!=o&&n.isEdge(o.cell)&&!n.isAncestor(o.cell,t)){var r=this.getState(n.getParent(o.cell));this.validatePoints(r,o.cell)}var l=this.getState(this.getVisibleTerminal(t,!1));a.setVisibleTerminalState(l,!1),null!=l&&n.isEdge(l.cell)&&!n.isAncestor(l.cell,t)&&(r=this.getState(n.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&&n.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,t!=this.currentRoot&&this.graph.cellRenderer.redraw(a,!1,this.isRendering())}(n.isEdge(t)||n.isVertex(t))&&(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(t)||t==this.currentRoot))for(s=n.getChildCount(t),o=0;o<s;o++)r=n.getChildAt(t,o),null!=(r=this.validatePoints(a,r))&&(null==i?i=r:i.add(r));return i},mxGraphView.prototype.childMoved=function(e,t){var n=t.cell;if(!this.graph.isCellCollapsed(n)||n==this.currentRoot)for(var a=this.graph.getModel(),i=a.getChildCount(n),s=0;s<i;s++)this.validateBounds(t,a.getChildAt(n,s))},mxGraphView.prototype.updateFixedTerminalPoints=function(e,t,n){this.updateFixedTerminalPoint(e,t,!0,this.graph.getConnectionConstraint(e,t,!0)),this.updateFixedTerminalPoint(e,n,!1,this.graph.getConnectionConstraint(e,n,!1))},mxGraphView.prototype.updateFixedTerminalPoint=function(e,t,n,a){var i=null;if(null!=a&&(i=this.graph.getConnectionPoint(t,a)),null==i&&null==t){t=this.scale,a=this.translate;var s=e.origin;null!=(i=this.graph.getCellGeometry(e.cell).getTerminalPoint(n))&&(i=new mxPoint(t*(a.x+i.x+s.x),t*(a.y+i.y+s.y)))}e.setAbsoluteTerminalPoint(i,n)},mxGraphView.prototype.updatePoints=function(e,t,n,a){if(null!=e){var i=[];i.push(e.absolutePoints[0]);var s=this.getEdgeStyle(e,t,n,a);if(null!=s)s(e,n=this.getTerminalPort(e,n,!0),a=this.getTerminalPort(e,a,!1),t,i);else if(null!=t)for(s=0;s<t.length;s++)null!=t[s]&&(a=mxUtils.clone(t[s]),i.push(this.transformControlPoint(e,a)));t=e.absolutePoints,i.push(t[t.length-1]),e.absolutePoints=i}},mxGraphView.prototype.transformControlPoint=function(e,t){var n=e.origin;return new mxPoint(this.scale*(t.x+this.translate.x+n.x),this.scale*(t.y+this.translate.y+n.y))},mxGraphView.prototype.getEdgeStyle=function(e,t,n,a){return"string"==typeof(e=null!=n&&n==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==(t=mxStyleRegistry.getValue(e))&&this.isAllowEval()&&(t=mxUtils.eval(e)),e=t),"function"==typeof e?e:null},mxGraphView.prototype.updateFloatingTerminalPoints=function(e,t,n){var a=e.absolutePoints,i=a[0];null==a[a.length-1]&&null!=n&&this.updateFloatingTerminalPoint(e,n,t,!1),null==i&&null!=t&&this.updateFloatingTerminalPoint(e,t,n,!0)},mxGraphView.prototype.updateFloatingTerminalPoint=function(e,t,n,a){t=this.getTerminalPort(e,t,a);var i=this.getNextPoint(e,n,a),s=this.graph.isOrthogonal(e);n=mxUtils.toRadians(Number(t.style[mxConstants.STYLE_ROTATION]||"0"));var o=new mxPoint(t.getCenterX(),t.getCenterY());if(0!=n){var r=Math.cos(-n),l=Math.sin(-n);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),t=this.getPerimeterPoint(t,i,0==n&&s,r),0!=n&&(r=Math.cos(n),l=Math.sin(n),t=mxUtils.getRotatedPoint(t,r,l,o)),e.setAbsoluteTerminalPoint(t,a)},mxGraphView.prototype.getTerminalPort=function(e,t,n){return null!=(e=mxUtils.getValue(e.style,n?mxConstants.STYLE_SOURCE_PORT:mxConstants.STYLE_TARGET_PORT))&&(null!=(e=this.getState(this.graph.getModel().getCell(e)))&&(t=e)),t},mxGraphView.prototype.getPerimeterPoint=function(e,t,n,a){var i=null;if(null!=e){var s=this.getPerimeterFunction(e);null!=s&&null!=t&&(0<(a=this.getPerimeterBounds(e,a)).width||0<a.height)&&(i=s(a,e,t,n)),null==i&&(i=this.getPoint(e))}return i},mxGraphView.prototype.getRoutingCenterX=function(e){var t=null!=e.style&&parseFloat(e.style[mxConstants.STYLE_ROUTING_CENTER_X])||0;return e.getCenterX()+t*e.width},mxGraphView.prototype.getRoutingCenterY=function(e){var t=null!=e.style&&parseFloat(e.style[mxConstants.STYLE_ROUTING_CENTER_Y])||0;return e.getCenterY()+t*e.height},mxGraphView.prototype.getPerimeterBounds=function(e,t){return t=null!=t?t:0,null!=e&&(t+=parseFloat(e.style[mxConstants.STYLE_PERIMETER_SPACING]||0)),e.getPerimeterBounds(t*this.scale)},mxGraphView.prototype.getPerimeterFunction=function(e){if("string"==typeof(e=e.style[mxConstants.STYLE_PERIMETER])){var t=mxStyleRegistry.getValue(e);null==t&&this.isAllowEval()&&(t=mxUtils.eval(e)),e=t}return"function"==typeof e?e:null},mxGraphView.prototype.getNextPoint=function(e,t,n){var a=null;return null!=(e=e.absolutePoints)&&(n||2<e.length||null==t)&&(a=e.length,a=e[n?Math.min(1,a-1):Math.max(0,a-2)]),null==a&&null!=t&&(a=new mxPoint(t.getCenterX(),t.getCenterY())),a},mxGraphView.prototype.getVisibleTerminal=function(e,t){for(var n=this.graph.getModel(),a=n.getTerminal(e,t),i=a;null!=a&&a!=this.currentRoot;)this.graph.isCellVisible(i)&&!this.graph.isCellCollapsed(a)||(i=a),a=n.getParent(a);return n.getParent(i)==n.getRoot()&&(i=null),i},mxGraphView.prototype.updateEdgeBounds=function(e){var t=e.absolutePoints;if(e.length=0,null!=t&&0<t.length){var n=t[0],a=t[t.length-1];if(null==n||null==a)e.cell!=this.currentRoot&&this.clear(e.cell,!0);else{if(n.x!=a.x||n.y!=a.y){var i=a.x-n.x,s=a.y-n.y;e.terminalDistance=Math.sqrt(i*i+s*s)}else e.terminalDistance=0;a=0;var o=[];if(null!=(s=n)){n=s.x;for(var r=s.y,l=n,d=r,c=1;c<t.length;c++){var m=t[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,n=Math.min(s.x,n),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=n,e.y=r,e.width=Math.max(1,l-n),e.height=Math.max(1,d-r)}}}},mxGraphView.prototype.getPoint=function(e,t){var n=e.getCenterX(),a=e.getCenterY();if(null==e.segments||null!=t&&!t.relative)null!=t&&(null!=(d=t.offset)&&(n+=d.x,a+=d.y));else{for(var i=e.absolutePoints.length,s=(.5+(null!=t?t.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=n=a=0,null!=t){a=t.y;var d=t.offset;null!=d&&(n=d.x,r=d.y)}d=l.x-s.x,l=l.y-s.y,n=s.x+d*i+((0==o?0:l/o)*a+n)*this.scale,a=s.y+l*i-((0==o?0:d/o)*a-r)*this.scale}}return new mxPoint(n,a)},mxGraphView.prototype.getRelativePoint=function(e,t,n){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,t,n),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,t,n))<=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=t-l))*e+(s=(d=o.y-s)-(s=n-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,t,n)),-1==mxUtils.relativeCcw(o.x,o.y,r.x,r.y,t,n)&&(a=-a),new mxPoint((i/2-m-e)/i*-2,a/this.scale)}}return new mxPoint},mxGraphView.prototype.updateEdgeLabelOffset=function(e){var t=e.absolutePoints;if(e.absoluteOffset.x=e.getCenterX(),e.absoluteOffset.y=e.getCenterY(),null!=t&&0<t.length&&null!=e.segments)if((i=this.graph.getCellGeometry(e.cell)).relative){null!=(n=this.getPoint(e,i))&&(e.absoluteOffset=n)}else{var n=t[0],a=t[t.length-1];if(null!=n&&null!=a){t=a.x-n.x;var i,s=a.y-n.y,o=a=0;null!=(i=i.offset)&&(a=i.x,o=i.y),i=n.y+s/2+o*this.scale,e.absoluteOffset.x=n.x+t/2+a*this.scale,e.absoluteOffset.y=i}}},mxGraphView.prototype.getState=function(e,t){t=t||!1;var n=null;return null!=e&&(n=this.states.get(e),this.graph.isCellVisible(e)&&(null==n&&t&&this.graph.isCellVisible(e)?(n=this.createState(e),this.states.put(e,n)):t&&null!=n&&this.updateStyle&&(n.style=this.graph.getCellStyle(e)))),n},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 t=[],n=0;n<e.length;n++){var a=this.getState(e[n]);null!=a&&t.push(a)}return t},mxGraphView.prototype.removeState=function(e){var t=null;return null!=e&&(null!=(t=this.states.remove(e))&&(this.graph.cellRenderer.destroy(t),t.destroy())),t},mxGraphView.prototype.createState=function(e){var t=this.graph.getCellStyle(e);return e=new mxCellState(this,e,t),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 t=mxUtils.getOffset(this.graph.container);e=new mxPoint(e.clientX-t.x,e.clientY-t.y);t=this.graph.container.offsetWidth;var n=this.graph.container.clientWidth;return n<t&&e.x>n+2&&e.x<=t||(t=this.graph.container.offsetHeight,(n=this.graph.container.clientHeight)<t&&e.y>n+2&&e.y<=t)},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,t){a.panningHandler.hideMenu()},mouseMove:function(){},mouseUp:function(){}}),this.moveHandler=mxUtils.bind(this,function(e){var t,n;null!=a.tooltipHandler&&a.tooltipHandler.isHideOnHover()&&a.tooltipHandler.hide(),this.captureDocumentGesture&&a.isMouseDown&&!mxEvent.isConsumed(e)&&a.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,(t=e,n=null,mxClient.IS_TOUCH&&(n=mxEvent.getClientX(t),t=mxEvent.getClientY(t),t=mxUtils.convertPoint(i,n,t),n=a.view.getState(a.getCellAt(t.x,t.y))),n)))}),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,t){if(null!=this.graph.container){var n=this.graph.container.offsetHeight;this.canvas.style.width=this.graph.container.offsetWidth<e?e+"px":"100%",this.canvas.style.height=n<t?t+"px":"100%"}},mxGraphView.prototype.createHtmlPane=function(e,t){var n=document.createElement("DIV");return null!=e&&null!=t?(n.style.position="absolute",n.style.left="0px",n.style.top="0px",n.style.width=e,n.style.height=t):n.style.position="relative",n},mxGraphView.prototype.createVml=function(){var e=this.graph.container;if(null!=e){var t=e.offsetWidth,n=e.offsetHeight;this.canvas=this.createVmlPane(t,n),this.backgroundPane=this.createVmlPane(t,n),this.drawPane=this.createVmlPane(t,n),this.overlayPane=this.createVmlPane(t,n),this.canvas.appendChild(this.backgroundPane),this.canvas.appendChild(this.drawPane),this.canvas.appendChild(this.overlayPane),e.appendChild(this.canvas)}},mxGraphView.prototype.createVmlPane=function(e,t){var n=document.createElement(mxClient.VML_PREFIX+":group");return n.style.position="absolute",n.style.left="0px",n.style.top="0px",n.style.width=e+"px",n.style.height=t+"px",n.setAttribute("coordsize",e+","+t),n.setAttribute("coordorigin","0,0"),n},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 t=document.createElementNS(mxConstants.NS_SVG,"svg");t.style.width="100%",t.style.height="100%",t.style.display="block",t.appendChild(this.canvas),null!=e&&(e.appendChild(t),"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 t=[],n=0;n<e.length;n++){var a=e[n];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(t,i)<0&&t.push(i)}}return this.getModel().getTopmostCells(t)},mxGraph.prototype.graphModelChanged=function(e){for(var t=0;t<e.length;t++)this.processChange(e[t]);this.removeSelectionCells(this.getRemovedCellsForChanges(e)),this.view.validate(),this.sizeDidChange()},mxGraph.prototype.getRemovedCellsForChanges=function(e){for(var t=[],n=0;n<e.length;n++){var a=e[n];if(a instanceof mxRootChange)break;a instanceof mxChildChange?null!=a.previous&&null==a.parent&&(t=t.concat(this.model.getDescendants(a.child))):a instanceof mxVisibleChange&&(t=t.concat(this.model.getDescendants(a.cell)))}return t},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 t=this.model.getParent(e.child);null!=t?this.view.invalidate(e.child,!0,!1,null!=e.previous):(this.removeStateForCell(e.child),this.view.currentRoot==e.child&&this.home()),t!=e.previous&&(null!=t&&this.view.invalidate(t,!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 t=this.model.getChildCount(e),n=0;n<t;n++)this.removeStateForCell(this.model.getChildAt(e,n));this.view.removeState(e)},mxGraph.prototype.addCellOverlay=function(e,t){null==e.overlays&&(e.overlays=[]),e.overlays.push(t);var n=this.view.getState(e);return null!=n&&this.cellRenderer.redraw(n),this.fireEvent(new mxEventObject(mxEvent.ADD_OVERLAY,"cell",e,"overlay",t)),t},mxGraph.prototype.getCellOverlays=function(e){return e.overlays},mxGraph.prototype.removeCellOverlay=function(e,t){if(null==t)this.removeCellOverlays(e);else{var n=mxUtils.indexOf(e.overlays,t);0<=n?(e.overlays.splice(n,1),0==e.overlays.length&&(e.overlays=null),null!=(n=this.view.getState(e))&&this.cellRenderer.redraw(n),this.fireEvent(new mxEventObject(mxEvent.REMOVE_OVERLAY,"cell",e,"overlay",t))):t=null}return t},mxGraph.prototype.removeCellOverlays=function(e){var t=e.overlays;if(null!=t){e.overlays=null;var n=this.view.getState(e);for(null!=n&&this.cellRenderer.redraw(n),n=0;n<t.length;n++)this.fireEvent(new mxEventObject(mxEvent.REMOVE_OVERLAY,"cell",e,"overlay",t[n]))}return t},mxGraph.prototype.clearCellOverlays=function(e){e=null!=e?e:this.model.getRoot(),this.removeCellOverlays(e);for(var t=this.model.getChildCount(e),n=0;n<t;n++){var a=this.model.getChildAt(e,n);this.clearCellOverlays(a)}},mxGraph.prototype.setCellWarning=function(n,e,t,a){return null!=e&&0<e.length?(e=new mxCellOverlay(t=null!=t?t:this.warningImage,"<font color=red>"+e+"</font>"),a&&e.addListener(mxEvent.CLICK,mxUtils.bind(this,function(e,t){this.isEnabled()&&this.setSelectionCell(n)})),this.addCellOverlay(n,e)):(this.removeCellOverlays(n),null)},mxGraph.prototype.startEditing=function(e){this.startEditingAtCell(null,e)},mxGraph.prototype.startEditingAtCell=function(e,t){null==e&&(null!=(e=this.getSelectionCell())&&!this.isCellEditable(e)&&(e=null)),null!=e&&(this.fireEvent(new mxEventObject(mxEvent.START_EDITING,"cell",e,"event",t)),this.cellEditor.startEditing(e,t))},mxGraph.prototype.getEditingValue=function(e,t){return this.convertValueToString(e)},mxGraph.prototype.stopEditing=function(e){this.cellEditor.stopEditing(e)},mxGraph.prototype.labelChanged=function(e,t,n){this.model.beginUpdate();try{this.cellLabelChanged(e,t,this.isAutoSizeCell(e)),this.fireEvent(new mxEventObject(mxEvent.LABEL_CHANGED,"cell",e,"value",t,"event",n))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellLabelChanged=function(e,t,n){this.model.beginUpdate();try{this.model.setValue(e,t),n&&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 t=0;t<e.length;t++){var n=this.view.getState(e[t]);null!=n&&null!=n.handler&&n.handler.reset()}},mxGraph.prototype.click=function(e){var t=e.getEvent(),n=e.getCell(),a=new mxEventObject(mxEvent.CLICK,"event",t,"cell",n);e.isConsumed()&&a.consume(),this.fireEvent(a),this.isEnabled()&&!mxEvent.isConsumed(t)&&!a.isConsumed()&&(null!=n?this.selectCellForEvent(n,t):(n=null,this.isSwimlaneSelectionEnabled()&&(n=this.getSwimlaneAt(e.getGraphX(),e.getGraphY())),null!=n?this.selectCellForEvent(n,t):this.isToggleEvent(t)||this.clearSelection()))},mxGraph.prototype.dblClick=function(e,t){var n=new mxEventObject(mxEvent.DOUBLE_CLICK,"event",e,"cell",t);this.fireEvent(n),this.isEnabled()&&!mxEvent.isConsumed(e)&&!n.isConsumed()&&null!=t&&this.isCellEditable(t)&&this.startEditingAtCell(t,e)},mxGraph.prototype.scrollPointToVisible=function(e,t,n,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,t+this.panDy));else{var i=this.container;if(a=null!=a?a:20,e>=i.scrollLeft&&t>=i.scrollTop&&e<=i.scrollLeft+i.clientWidth&&t<=i.scrollTop+i.clientHeight){var s=i.scrollLeft+i.clientWidth-e;if(s<a){if(e=i.scrollLeft,i.scrollLeft+=a-s,n&&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-t)<a?(e=i.scrollTop,i.scrollTop+=a-s,e==i.scrollTop&&n&&(this.dialect==mxConstants.DIALECT_SVG?(e=this.view.getDrawPane().ownerSVGElement,t=this.container.scrollHeight+a-s):(t=Math.max(i.clientHeight,i.scrollHeight)+a-s,e=this.view.getCanvas()),e.style.height=t+"px",i.scrollTop+=a-s)):(s=t-i.scrollTop)<a&&(i.scrollTop-=a-s)}}},mxGraph.prototype.createPanningManager=function(){return new mxPanningManager(this)},mxGraph.prototype.getBorderSizes=function(){function e(e){var t=0;t="thin"==e?2:"medium"==e?4:"thick"==e?6:parseInt(e);return isNaN(t)&&(t=0),t}var t=mxUtils.getCurrentStyle(this.container),n=new mxRectangle;return n.x=e(t.borderLeftWidth)+parseInt(t.paddingLeft||0),n.y=e(t.borderTopWidth)+parseInt(t.paddingTop||0),n.width=e(t.borderRightWidth)+parseInt(t.paddingRight||0),n.height=e(t.borderBottomWidth)+parseInt(t.paddingBottom||0),n},mxGraph.prototype.getPreferredPageSize=function(e,t,n){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 t=this.pageBreaksVisible?Math.ceil(t/i.width):1,n=this.pageBreaksVisible?Math.ceil(n/i.height):1,new mxRectangle(0,0,t*i.width+2+a.x/e,n*i.height+2+a.y/e)},mxGraph.prototype.sizeDidChange=function(){var e=this.getGraphBounds();if(null!=this.container){var t=this.getBorder(),n=Math.max(0,e.x+e.width+1+t);t=Math.max(0,e.y+e.height+1+t);if(null!=this.minimumContainerSize&&(n=Math.max(n,this.minimumContainerSize.width),t=Math.max(t,this.minimumContainerSize.height)),this.resizeContainer&&this.doResizeContainer(n,t),this.preferPageSize||!mxClient.IS_IE&&this.pageVisible){var a=this.getPreferredPageSize(e,n,t);null!=a&&(n=a.width,t=a.height)}null!=this.minimumGraphSize&&(n=Math.max(n,this.minimumGraphSize.width*this.view.scale),t=Math.max(t,this.minimumGraphSize.height*this.view.scale)),n=Math.ceil(n-1),t=Math.ceil(t-1),this.dialect==mxConstants.DIALECT_SVG?((a=this.view.getDrawPane().ownerSVGElement).style.minWidth=Math.max(1,n)+"px",a.style.minHeight=Math.max(1,t)+"px",a.style.width="100%",a.style.height="100%"):mxClient.IS_QUIRKS?this.view.updateHtmlCanvasSize(Math.max(1,n),Math.max(1,t)):(this.view.canvas.style.minWidth=Math.max(1,n)+"px",this.view.canvas.style.minHeight=Math.max(1,t)+"px"),this.updatePageBreaks(this.pageBreaksVisible,n-1,t-1)}this.fireEvent(new mxEventObject(mxEvent.SIZE,"bounds",e))},mxGraph.prototype.doResizeContainer=function(e,t){if(mxClient.IS_IE)if(mxClient.IS_QUIRKS){var n=this.getBorderSizes();e+=Math.max(2,n.x+n.width+1),t+=Math.max(2,n.y+n.height+1)}else 9<=document.documentMode?(e+=3,t+=5):(e+=1,t+=1);else t+=1;null!=this.maximumContainerSize&&(e=Math.min(this.maximumContainerSize.width,e),t=Math.min(this.maximumContainerSize.height,t)),this.container.style.width=Math.ceil(e)+"px",this.container.style.height=Math.ceil(t)+"px"},mxGraph.prototype.updatePageBreaks=function(e,t,n){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((t-i.x)/i.width):0,e=e?Math.ceil((n-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,n)];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(t,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 t=this.model.getStyle(e),n=null;n=this.model.isEdge(e)?this.stylesheet.getDefaultEdgeStyle():this.stylesheet.getDefaultVertexStyle();return null!=t&&(n=this.postProcessCellStyle(this.stylesheet.getCellStyle(t,n))),null==n&&(n=mxGraph.prototype.EMPTY_ARRAY),n},mxGraph.prototype.postProcessCellStyle=function(e){if(null!=e){var t=e[mxConstants.STYLE_IMAGE],n=this.getImageFromBundles(t);null!=n?e[mxConstants.STYLE_IMAGE]=n:n=t,null!=n&&"data:image/"==n.substring(0,11)&&(0<(t=n.indexOf(","))&&(n=n.substring(0,t)+";base64,"+n.substring(t+1)),e[mxConstants.STYLE_IMAGE]=n)}return e},mxGraph.prototype.setCellStyle=function(e,t){if(null!=(t=t||this.getSelectionCells())){this.model.beginUpdate();try{for(var n=0;n<t.length;n++)this.model.setStyle(t[n],e)}finally{this.model.endUpdate()}}},mxGraph.prototype.toggleCellStyle=function(e,t,n){n=n||this.getSelectionCell(),this.toggleCellStyles(e,t,[n])},mxGraph.prototype.toggleCellStyles=function(e,t,n){var a;(t=null!=t&&t,null!=(n=n||this.getSelectionCells())&&0<n.length)&&(null!=(a=null!=(a=this.view.getState(n[0]))?a.style:this.getCellStyle(n[0]))&&(t=mxUtils.getValue(a,e,t)?0:1,this.setCellStyles(e,t,n)))},mxGraph.prototype.setCellStyles=function(e,t,n){n=n||this.getSelectionCells(),mxUtils.setCellStyles(this.model,n,e,t)},mxGraph.prototype.toggleCellStyleFlags=function(e,t,n){this.setCellStyleFlags(e,t,null,n)},mxGraph.prototype.setCellStyleFlags=function(e,t,n,a){if(null!=(a=a||this.getSelectionCells())&&0<a.length){var i;if(null==n)null!=(i=null!=(i=this.view.getState(a[0]))?i.style:this.getCellStyle(a[0]))&&(n=(parseInt(i[e]||0)&t)!=t);mxUtils.setCellStyleFlags(this.model,a,e,t,n)}},mxGraph.prototype.alignCells=function(e,t,n){if(null==t&&(t=this.getSelectionCells()),null!=t&&1<t.length){if(null==n)for(var a=0;a<t.length;a++){var i=this.getCellGeometry(t[a]);if(null!=i&&!this.model.isEdge(t[a]))if(null==n){if(e==mxConstants.ALIGN_CENTER){n=i.x+i.width/2;break}if(e==mxConstants.ALIGN_RIGHT)n=i.x+i.width;else if(e==mxConstants.ALIGN_TOP)n=i.y;else{if(e==mxConstants.ALIGN_MIDDLE){n=i.y+i.height/2;break}n=e==mxConstants.ALIGN_BOTTOM?i.y+i.height:i.x}}else n=e==mxConstants.ALIGN_RIGHT?Math.max(n,i.x+i.width):e==mxConstants.ALIGN_TOP?Math.min(n,i.y):e==mxConstants.ALIGN_BOTTOM?Math.max(n,i.y+i.height):Math.min(n,i.x)}if(null!=n){this.model.beginUpdate();try{for(a=0;a<t.length;a++)null!=(i=this.getCellGeometry(t[a]))&&!this.model.isEdge(t[a])&&(i=i.clone(),e==mxConstants.ALIGN_CENTER?i.x=n-i.width/2:e==mxConstants.ALIGN_RIGHT?i.x=n-i.width:e==mxConstants.ALIGN_TOP?i.y=n:e==mxConstants.ALIGN_MIDDLE?i.y=n-i.height/2:e==mxConstants.ALIGN_BOTTOM?i.y=n-i.height:i.x=n,this.model.setGeometry(t[a],i));this.fireEvent(new mxEventObject(mxEvent.ALIGN_CELLS,"align",e,"cells",t))}finally{this.model.endUpdate()}}}return t},mxGraph.prototype.flipEdge=function(e){if(null!=e&&null!=this.alternateEdgeStyle){this.model.beginUpdate();try{var t=this.model.getStyle(e);null==t||0==t.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 t=[],n=0;n<this.imageBundles.length;n++)this.imageBundles[n]!=e&&t.push(this.imageBundles[n]);this.imageBundles=t},mxGraph.prototype.getImageFromBundles=function(e){if(null!=e)for(var t=0;t<this.imageBundles.length;t++){var n=this.imageBundles[t].getImage(e);if(null!=n)return n}return null},mxGraph.prototype.orderCells=function(e,t){null==t&&(t=mxUtils.sortCells(this.getSelectionCells(),!0)),this.model.beginUpdate();try{this.cellsOrdered(t,e),this.fireEvent(new mxEventObject(mxEvent.ORDER_CELLS,"back",e,"cells",t))}finally{this.model.endUpdate()}return t},mxGraph.prototype.cellsOrdered=function(e,t){if(null!=e){this.model.beginUpdate();try{for(var n=0;n<e.length;n++){var a=this.model.getParent(e[n]);t?this.model.add(a,e[n],n):this.model.add(a,e[n],this.model.getChildCount(a)-1)}this.fireEvent(new mxEventObject(mxEvent.CELLS_ORDERED,"back",t,"cells",e))}finally{this.model.endUpdate()}}},mxGraph.prototype.groupCells=function(e,t,n){null==n&&(n=mxUtils.sortCells(this.getSelectionCells(),!0)),n=this.getCellsForGroup(n),null==e&&(e=this.createGroupCell(n));var a=this.getBoundsForGroup(e,n,t);if(0<n.length&&null!=a){var i=this.model.getParent(e);null==i&&(i=this.model.getParent(n[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(n,e,s,null,null,!1,!1),this.cellsMoved(n,-a.x,-a.y,!1,!0),this.cellsResized([e],[a]),this.fireEvent(new mxEventObject(mxEvent.GROUP_CELLS,"group",e,"border",t,"cells",n))}finally{this.model.endUpdate()}}return e},mxGraph.prototype.getCellsForGroup=function(e){var t=[];if(null!=e&&0<e.length){var n=this.model.getParent(e[0]);t.push(e[0]);for(var a=1;a<e.length;a++)this.model.getParent(e[a])==n&&t.push(e[a])}return t},mxGraph.prototype.getBoundsForGroup=function(e,t,n){return null!=(t=this.getBoundingBoxFromGeometry(t))&&(this.isSwimlane(e)&&(e=this.getStartSize(e),t.x-=e.width,t.y-=e.height,t.width+=e.width,t.height+=e.height),t.x-=n,t.y-=n,t.width+=2*n,t.height+=2*n),t},mxGraph.prototype.createGroupCell=function(e){return(e=new mxCell("")).setVertex(!0),e.setConnectable(!1),e},mxGraph.prototype.ungroupCells=function(e){var t=[];if(null==e){e=this.getSelectionCells();for(var n=[],a=0;a<e.length;a++)0<this.model.getChildCount(e[a])&&n.push(e[a]);e=n}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),t=t.concat(i)}}this.cellsRemoved(this.addAllEdges(e)),this.fireEvent(new mxEventObject(mxEvent.UNGROUP_CELLS,"cells",e))}finally{this.model.endUpdate()}}return t},mxGraph.prototype.removeCellsFromParent=function(e){null==e&&(e=this.getSelectionCells()),this.model.beginUpdate();try{var t=this.getDefaultParent(),n=this.model.getChildCount(t);this.cellsAdded(e,t,n,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,t,n){null==e&&(e=this.getSelectionCells()),t=null!=t?t:0,n=null!=n&&n,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();n&&(r.x+=s.x-o.width-t,r.y+=s.y-o.height-t),r.width=s.width+o.width+2*t,r.height=s.height+o.height+2*t,this.model.setGeometry(e[a],r),this.moveCells(i,-s.x+o.width+t,-s.y+o.height+t)}}}}}finally{this.model.endUpdate()}return e},mxGraph.prototype.cloneCells=function(e,t){t=null==t||t;var n=null;if(null!=e){for(var a={},i=(n=[],0);i<e.length;i++){a[s=mxCellPath.create(e[i])]=e[i],n.push(e[i])}if(0<n.length){var s=this.view.scale,o=this.view.translate;for(n=this.model.cloneCells(e,!0),i=0;i<e.length;i++)if(!t&&this.model.isEdge(n[i])&&null!=this.getEdgeValidationError(n[i],this.model.getTerminal(n[i],!0),this.model.getTerminal(n[i],!1)))n[i]=null;else{var r=this.model.getGeometry(n[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(n[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 n=[]}return n},mxGraph.prototype.insertVertex=function(e,t,n,a,i,s,o,r,l){return t=this.createVertex(e,t,n,a,i,s,o,r,l),this.addCell(t,e)},mxGraph.prototype.createVertex=function(e,t,n,a,i,s,o,r,l){return(e=new mxGeometry(a,i,s,o)).relative=null!=l&&l,(n=new mxCell(n,e,r)).setId(t),n.setVertex(!0),n.setConnectable(!0),n},mxGraph.prototype.insertEdge=function(e,t,n,a,i,s){return t=this.createEdge(e,t,n,a,i,s),this.addEdge(t,e,a,i)},mxGraph.prototype.createEdge=function(e,t,n,a,i,s){return(e=new mxCell(n,new mxGeometry,s)).setId(t),e.setEdge(!0),e.geometry.relative=!0,e},mxGraph.prototype.addEdge=function(e,t,n,a,i){return this.addCell(e,t,i,n,a)},mxGraph.prototype.addCell=function(e,t,n,a,i){return this.addCells([e],t,n,a,i)[0]},mxGraph.prototype.addCells=function(e,t,n,a,i){null==t&&(t=this.getDefaultParent()),null==n&&(n=this.model.getChildCount(t)),this.model.beginUpdate();try{this.cellsAdded(e,t,n,a,i,!1,!0),this.fireEvent(new mxEventObject(mxEvent.ADD_CELLS,"cells",e,"parent",t,"index",n,"source",a,"target",i))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellsAdded=function(e,t,n,a,i,s,o){if(null!=e&&null!=t&&null!=n){this.model.beginUpdate();try{for(var r=null!=(d=s?this.view.getState(t):null)?d.origin:null,l=new mxPoint(0,0),d=0;d<e.length;d++)if(null==e[d])n--;else{var c=this.model.getParent(e[d]);if(null!=r&&e[d]!=t&&t!=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)}}t==c&&n+d>this.model.getChildCount(t)&&n--,this.model.add(t,e[d],n+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",t,"index",n,"source",a,"target",i,"absolute",s))}finally{this.model.endUpdate()}}},mxGraph.prototype.removeCells=function(e,t){t=null==t||t,null==e&&(e=this.getDeletableCells(this.getSelectionCells())),t&&(e=this.getDeletableCells(this.addAllEdges(e))),this.model.beginUpdate();try{this.cellsRemoved(e),this.fireEvent(new mxEventObject(mxEvent.REMOVE_CELLS,"cells",e,"includeEdges",t))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellsRemoved=function(e){if(null!=e&&0<e.length){var t=this.view.scale,n=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/t-n.x,m[u].y/t-n.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,t,n,a,i){a=a||0,i=i||0,null==n&&(n=this.cloneCells([e])[0]);var s=this.model.getParent(e),o=this.model.getTerminal(e,!0);this.model.beginUpdate();try{this.cellsMoved(t,a,i,!1,!1),this.cellsAdded(t,s,this.model.getChildCount(s),null,null,!0),this.cellsAdded([n],s,this.model.getChildCount(s),o,t[0],!1),this.cellConnected(e,t[0],!0),this.fireEvent(new mxEventObject(mxEvent.SPLIT_EDGE,"edge",e,"cells",t,"newEdge",n,"dx",a,"dy",i))}finally{this.model.endUpdate()}return n},mxGraph.prototype.toggleCells=function(e,t,n){null==t&&(t=this.getSelectionCells()),n&&(t=this.addAllEdges(t)),this.model.beginUpdate();try{this.cellsToggled(t,e),this.fireEvent(new mxEventObject(mxEvent.TOGGLE_CELLS,"show",e,"cells",t,"includeEdges",n))}finally{this.model.endUpdate()}return t},mxGraph.prototype.cellsToggled=function(e,t){if(null!=e&&0<e.length){this.model.beginUpdate();try{for(var n=0;n<e.length;n++)this.model.setVisible(e[n],t)}finally{this.model.endUpdate()}}},mxGraph.prototype.foldCells=function(e,t,n,a){t=null!=t&&t,null==n&&(n=this.getFoldableCells(this.getSelectionCells(),e)),this.stopEditing(!1),this.model.beginUpdate();try{this.cellsFolded(n,e,t,a),this.fireEvent(new mxEventObject(mxEvent.FOLD_CELLS,"collapse",e,"recurse",t,"cells",n))}finally{this.model.endUpdate()}return n},mxGraph.prototype.cellsFolded=function(e,t,n,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],t))&&t!=this.isCellCollapsed(e[i])&&(this.model.setCollapsed(e[i],t),this.swapBounds(e[i],t),this.isExtendParent(e[i])&&this.extendParent(e[i]),n)){var s=this.model.getChildren(e[i]);this.foldCells(s,t,n)}this.fireEvent(new mxEventObject(mxEvent.CELLS_FOLDED,"cells",e,"collapse",t,"recurse",n))}finally{this.model.endUpdate()}}},mxGraph.prototype.swapBounds=function(e,t){if(null!=e){var n=this.model.getGeometry(e);null!=n&&(n=n.clone(),this.updateAlternateBounds(e,n,t),n.swap(),this.model.setGeometry(e,n))}},mxGraph.prototype.updateAlternateBounds=function(e,t,n){if(null!=e&&null!=t){if(n=null!=(n=this.view.getState(e))?n.style:this.getCellStyle(e),null==t.alternateBounds){var a=t;this.collapseToPreferredSize&&(null!=(e=this.getPreferredSizeForCell(e))&&(a=e,0<(e=mxUtils.getValue(n,mxConstants.STYLE_STARTSIZE))&&(a.height=Math.max(a.height,e)))),t.alternateBounds=new mxRectangle(0,0,a.width,a.height)}if(null!=t.alternateBounds){t.alternateBounds.x=t.x,t.alternateBounds.y=t.y;var i=mxUtils.toRadians(n[mxConstants.STYLE_ROTATION]||"0");0!=i&&(e=t.alternateBounds.getCenterX()-t.getCenterX(),n=t.alternateBounds.getCenterY()-t.getCenterY(),a=Math.cos(i),i=Math.sin(i),t.alternateBounds.x+=a*e-i*n-e,t.alternateBounds.y+=i*e+a*n-n)}}},mxGraph.prototype.addAllEdges=function(e){var t=e.slice();return t.concat(this.getAllEdges(e))},mxGraph.prototype.getAllEdges=function(e){var t=[];if(null!=e)for(var n=0;n<e.length;n++){for(var a=this.model.getEdgeCount(e[n]),i=0;i<a;i++)t.push(this.model.getEdgeAt(e[n],i));a=this.model.getChildren(e[n]),t=t.concat(this.getAllEdges(a))}return t},mxGraph.prototype.updateCellSize=function(e,t){t=null!=t&&t,this.model.beginUpdate();try{this.cellSizeUpdated(e,t),this.fireEvent(new mxEventObject(mxEvent.UPDATE_CELL_SIZE,"cell",e,"ignoreChildren",t))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellSizeUpdated=function(e,t){if(null!=e){this.model.beginUpdate();try{var n=this.getPreferredSizeForCell(e),a=this.model.getGeometry(e);if(null!=n&&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,n.height+8),i&&(a.height=n.height+8),a.width=n.width):(r=mxUtils.setStyle(r,mxConstants.STYLE_STARTSIZE,n.width+8),i&&(a.width=n.width+8),a.height=n.height),this.model.setStyle(e,r)}else a.width=n.width,a.height=n.height;if(!t&&!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 t=null;if(null!=e){var n=this.view.getState(e),a=null!=n?n.style:this.getCellStyle(e);if(null!=a&&!this.model.isEdge(e)){var i=a[mxConstants.STYLE_FONTSIZE]||mxConstants.DEFAULT_FONTSIZE,s=0;t=0;null==this.getImage(n)&&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&&(t+=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,t+=2*(a[mxConstants.STYLE_SPACING]||0),t+=a[mxConstants.STYLE_SPACING_TOP]||0,t+=a[mxConstants.STYLE_SPACING_BOTTOM]||0,null!=(n=this.getFoldingImage(n))&&(s+=n.width+8),t=null!=(n=this.getLabel(e))&&0<n.length?(this.isHtmlLabel(e)||(n=n.replace(/\n/g,"<br>")),e=(i=mxUtils.getSizeForString(n,i,a[mxConstants.STYLE_FONTFAMILY])).width+s,t=i.height+t,mxUtils.getValue(a,mxConstants.STYLE_HORIZONTAL,!0)||(a=t,t=e,e=a),this.gridEnabled&&(e=this.snap(e+this.gridSize/2),t=this.snap(t+this.gridSize/2)),new mxRectangle(0,0,e,t)):new mxRectangle(0,0,a=4*this.gridSize,a)}}return t},mxGraph.prototype.handleGesture=function(e,t){if(.2<Math.abs(1-t.scale)){var n=this.view.scale,a=this.view.translate,i=e.width*t.scale,s=e.height*t.scale,o=e.y-(s-e.height)/2;n=new mxRectangle(this.snap((e.x-(i-e.width)/2)/n)-a.x,this.snap(o/n)-a.y,this.snap(i/n),this.snap(s/n));this.resizeCell(e.cell,n)}},mxGraph.prototype.resizeCell=function(e,t){return this.resizeCells([e],[t])[0]},mxGraph.prototype.resizeCells=function(e,t){this.model.beginUpdate();try{this.cellsResized(e,t),this.fireEvent(new mxEventObject(mxEvent.RESIZE_CELLS,"cells",e,"bounds",t))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellsResized=function(e,t){if(null!=e&&null!=t&&e.length==t.length){this.model.beginUpdate();try{for(var n=0;n<e.length;n++){var a=t[n],i=this.model.getGeometry(e[n]);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[n])&&!this.isAllowNegativeCoordinates()&&(i.x=Math.max(0,i.x),i.y=Math.max(0,i.y)),this.model.setGeometry(e[n],i),this.isExtendParent(e[n])&&this.extendParent(e[n])}}this.resetEdgesOnResize&&this.resetEdges(e),this.fireEvent(new mxEventObject(mxEvent.CELLS_RESIZED,"cells",e,"bounds",t))}finally{this.model.endUpdate()}}},mxGraph.prototype.extendParent=function(e){if(null!=e){var t=this.model.getParent(e),n=this.model.getGeometry(t);null!=t&&null!=n&&!this.isCellCollapsed(t)&&(null!=(e=this.model.getGeometry(e))&&(n.width<e.x+e.width||n.height<e.y+e.height))&&((n=n.clone()).width=Math.max(n.width,e.x+e.width),n.height=Math.max(n.height,e.y+e.height),this.cellsResized([t],[n]))}},mxGraph.prototype.importCells=function(e,t,n,a,i){return this.moveCells(e,t,n,!0,a,i)},mxGraph.prototype.moveCells=function(e,t,n,a,i,s){if(t=null!=t?t:0,n=null!=n?n:0,a=null!=a&&a,null!=e&&(0!=t||0!=n||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,t,n,!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",t,"dy",n,"clone",a,"target",i,"event",s))}finally{this.model.endUpdate()}}return e},mxGraph.prototype.cellsMoved=function(e,t,n,a,i){if(null!=e&&(0!=t||0!=n)){this.model.beginUpdate();try{a&&this.disconnectGraph(e);for(var s=0;s<e.length;s++)this.translateCell(e[s],t,n),i&&this.constrainChild(e[s]);this.resetEdgesOnMove&&this.resetEdges(e),this.fireEvent(new mxEventObject(mxEvent.CELLS_MOVED,"cells",e,"dx",n,"dy",n,"disconnect",a))}finally{this.model.endUpdate()}}},mxGraph.prototype.translateCell=function(e,t,n){var a=this.model.getGeometry(e);null!=a&&((a=a.clone()).translate(t,n),!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(t,n):(a.offset.x+=t,a.offset.y+=n)),this.model.setGeometry(e,a))},mxGraph.prototype.getCellContainmentArea=function(e){if(null!=e&&!this.model.isEdge(e)){var t=this.model.getParent(e);if(t==this.getDefaultParent()||t==this.getCurrentRoot())return this.getMaximumGraphBounds();if(null!=t&&t!=this.getDefaultParent())if(null!=(i=this.model.getGeometry(t))){var n=e=0,a=i.width,i=i.height;return this.isSwimlane(t)&&(e=(t=this.getStartSize(t)).width,a-=t.width,n=t.height,i-=t.height),new mxRectangle(e,n,a,i)}}return null},mxGraph.prototype.getMaximumGraphBounds=function(){return this.maximumGraphBounds},mxGraph.prototype.constrainChild=function(e){if(null!=e){var t=this.model.getGeometry(e),n=this.isConstrainChild(e)?this.getCellContainmentArea(e):this.getMaximumGraphBounds();null!=t&&null!=n&&!t.relative&&(t.x<n.x||t.y<n.y||n.width<t.x+t.width||n.height<t.y+t.height)&&(e=this.getOverlap(e),0<n.width&&(t.x=Math.min(t.x,n.x+n.width-(1-e)*t.width)),0<n.height&&(t.y=Math.min(t.y,n.y+n.height-(1-e)*t.height)),t.x=Math.max(t.x,n.x-t.width*e),t.y=Math.max(t.y,n.y-t.height*e))}},mxGraph.prototype.resetEdges=function(e){if(null!=e){for(var t={},n=0;n<e.length;n++){var a=mxCellPath.create(e[n]);t[a]=e[n]}this.model.beginUpdate();try{for(n=0;n<e.length;n++){var i=this.model.getEdges(e[n]);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==t[l]||null==t[d])&&this.resetEdge(i[a])}this.resetEdges(this.model.getChildren(e[n]))}}finally{this.model.endUpdate()}}},mxGraph.prototype.resetEdge=function(e){var t=this.model.getGeometry(e);return null!=t&&null!=t.points&&0<t.points.length&&((t=t.clone()).points=[],this.model.setGeometry(e,t)),e},mxGraph.prototype.getAllConnectionConstraints=function(e,t){return null!=e&&null!=e.shape&&null!=e.shape.stencil?e.shape.stencil.constraints:null},mxGraph.prototype.getConnectionConstraint=function(e,t,n){t=null;var a=e.style[n?mxConstants.STYLE_EXIT_X:mxConstants.STYLE_ENTRY_X];if(null!=a){var i=e.style[n?mxConstants.STYLE_EXIT_Y:mxConstants.STYLE_ENTRY_Y];null!=i&&(t=new mxPoint(parseFloat(a),parseFloat(i)))}return a=!1,null!=t&&(a=mxUtils.getValue(e.style,n?mxConstants.STYLE_EXIT_PERIMETER:mxConstants.STYLE_ENTRY_PERIMETER,!0)),new mxConnectionConstraint(t,a)},mxGraph.prototype.setConnectionConstraint=function(e,t,n,a){if(null!=a){this.model.beginUpdate();try{null==a||null==a.point?(this.setCellStyles(n?mxConstants.STYLE_EXIT_X:mxConstants.STYLE_ENTRY_X,null,[e]),this.setCellStyles(n?mxConstants.STYLE_EXIT_Y:mxConstants.STYLE_ENTRY_Y,null,[e]),this.setCellStyles(n?mxConstants.STYLE_EXIT_PERIMETER:mxConstants.STYLE_ENTRY_PERIMETER,null,[e])):null!=a.point&&(this.setCellStyles(n?mxConstants.STYLE_EXIT_X:mxConstants.STYLE_ENTRY_X,a.point.x,[e]),this.setCellStyles(n?mxConstants.STYLE_EXIT_Y:mxConstants.STYLE_ENTRY_Y,a.point.y,[e]),a.perimeter?this.setCellStyles(n?mxConstants.STYLE_EXIT_PERIMETER:mxConstants.STYLE_ENTRY_PERIMETER,null,[e]):this.setCellStyles(n?mxConstants.STYLE_EXIT_PERIMETER:mxConstants.STYLE_ENTRY_PERIMETER,"0",[e]))}finally{this.model.endUpdate()}}},mxGraph.prototype.getConnectionPoint=function(e,t){var n=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!=t.point){var l=n=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&&(n=-1,d=-a.width),u&&(l=-1,c=-a.height)}n=new mxPoint(a.x+t.point.x*a.width*n-d,a.y+t.point.y*a.height*l-c)}s=e.style[mxConstants.STYLE_ROTATION]||0,t.perimeter?(0!=o&&null!=n&&(r=a=0,90==o?r=1:180==o?a=-1:270==s&&(r=-1),n=mxUtils.getRotatedPoint(n,a,r,i)),null!=n&&t.perimeter&&(n=this.view.getPerimeterPoint(e,n,!1))):s+=o,0!=s&&null!=n&&(o=mxUtils.toRadians(s),a=Math.cos(o),r=Math.sin(o),n=mxUtils.getRotatedPoint(n,a,r,i))}return n},mxGraph.prototype.connectCell=function(e,t,n,a){this.model.beginUpdate();try{var i=this.model.getTerminal(e,n);this.cellConnected(e,t,n,a),this.fireEvent(new mxEventObject(mxEvent.CONNECT_CELL,"edge",e,"terminal",t,"source",n,"previous",i))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellConnected=function(e,t,n,a){if(null!=e){this.model.beginUpdate();try{var i=this.model.getTerminal(e,n);this.setConnectionConstraint(e,t,n,a),this.isPortsEnabled()&&(a=null,this.isPort(t)&&(a=t.getId(),t=this.getTerminalForPort(t,n)),this.setCellStyles(n?mxConstants.STYLE_SOURCE_PORT:mxConstants.STYLE_TARGET_PORT,a,[e])),this.model.setTerminal(e,t,n),this.resetEdgesOnConnect&&this.resetEdge(e),this.fireEvent(new mxEventObject(mxEvent.CELL_CONNECTED,"edge",e,"terminal",t,"source",n,"previous",i))}finally{this.model.endUpdate()}}},mxGraph.prototype.disconnectGraph=function(e){if(null!=e){this.model.beginUpdate();try{for(var t=this.view.scale,n=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/t-n.x+l,c[0].y/t-n.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/t-n.x+l,c[v].y/t-n.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,t){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(),t=this.getCurrentRoot();if(null!=t){for(var n=this.model.getParent(t);n!=e&&!this.isValidRoot(n)&&this.model.getParent(n)!=e;)n=this.model.getParent(n);n==e||this.model.getParent(n)==e?this.view.setCurrentRoot(null):this.view.setCurrentRoot(n),null!=this.view.getState(t)&&this.setSelectionCell(t)}},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,t,n){var a=[e];if(t&&(a=a.concat(this.model.getEdges(e))),a=this.view.getBounds(a),n){n=this.model.getChildCount(e);for(var i=0;i<n;i++){var s=this.getCellBounds(this.model.getChildAt(e,i),t,!0);null!=a?a.add(s):a=s}}return a},mxGraph.prototype.getBoundingBoxFromGeometry=function(e,t){t=null!=t&&t;var n=null;if(null!=e)for(var a=0;a<e.length;a++)if(t||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==n?n=new mxRectangle(i.x,i.y,i.width,i.height):n.add(i)}}return n},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,t){if(this.useScrollbarsForPanning&&mxUtils.hasScrollbars(this.container))this.container.scrollLeft=-e,this.container.scrollTop=-t;else{var n=this.view.getCanvas();if(this.dialect==mxConstants.DIALECT_SVG)if(0==e&&0==t){if(mxClient.IS_IE?n.setAttribute("transform","translate("+e+","+t+")"):n.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(n.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(n.setAttribute("transform","translate("+e+","+t+")"),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!=n.parentNode?s.appendChild(a):s=this.shiftPreview2,a=i;this.container.insertBefore(this.shiftPreview1,n.parentNode),this.container.appendChild(this.shiftPreview2)}this.shiftPreview1.style.left=e+"px",this.shiftPreview1.style.top=t+"px",this.shiftPreview2.style.left=e+"px",this.shiftPreview2.style.top=t+"px"}else n.style.left=e+"px",n.style.top=t+"px";this.panDx=e,this.panDy=t,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,t){this.zoom(e/this.view.scale,t)},mxGraph.prototype.zoom=function(e,t){t=null!=t?t:this.centerZoom;var n=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=n,this.scrollRectToVisible(a)||(this.view.revalidate(),this.view.setScale(n));else if(t&&!mxUtils.hasScrollbars(this.container)){a=this.container.offsetWidth;var i=this.container.offsetHeight;if(1<e){var s=(e-1)/(2*n);a=a*-s,i=i*-s}else a*=s=(1/e-1)/(2*this.view.scale),i*=s;this.view.scaleAndTranslate(n,this.view.translate.x+a,this.view.translate.y+i)}else this.view.setScale(n),mxUtils.hasScrollbars(this.container)&&(i=a=0,t&&(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 t=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 n=Math.min(this.container.scrollWidth,e.x+e.width),a=Math.min(this.container.scrollHeight,e.y+e.height);e.width=n-e.x,e.height=a-e.y,t<1?(n=((t=e.height/t)-e.height)/2,e.height=t,t=Math.min(e.y,n),e.y-=t,a=Math.min(this.container.scrollHeight,e.y+e.height),e.height=a-e.y):(n=((t*=e.width)-e.width)/2,e.width=t,t=Math.min(e.x,n),e.x-=t,n=Math.min(this.container.scrollWidth,e.x+e.width),e.width=n-e.x),t=this.container.clientWidth/e.width,n=this.view.scale*t,mxUtils.hasScrollbars(this.container)?(this.view.setScale(n),this.container.scrollLeft=Math.round(e.x*t),this.container.scrollTop=Math.round(e.y*t)):this.view.scaleAndTranslate(n,this.view.translate.x-e.x/this.view.scale,this.view.translate.y-e.y/this.view.scale)},mxGraph.prototype.fit=function(e,t){if(null!=this.container){e=null!=e?e:0,t=null!=t&&t;var n=this.container.clientWidth,a=this.container.clientHeight,i=this.view.getGraphBounds();t&&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=t?e:2*e;n=Math.floor(100*Math.min(n/(o+l),a/(r+l)))/100;null!=this.minFitScale&&(n=Math.max(n,this.minFitScale)),null!=this.maxFitScale&&(n=Math.min(n,this.maxFitScale)),t?this.view.scale!=n&&this.view.setScale(n):mxUtils.hasScrollbars(this.container)?(this.view.setScale(n),null!=i.x&&(this.container.scrollLeft=Math.round(i.x/s)*n-e-Math.max(0,(this.container.clientWidth-o*n)/2)),null!=i.y&&(this.container.scrollTop=Math.round(i.y/s)*n-e-Math.max(0,(this.container.clientHeight-r*n)/2))):this.view.scaleAndTranslate(n,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,t){var n=-this.view.translate.x,a=-this.view.translate.y,i=this.view.getState(e);null!=i&&(n=new mxRectangle(n+i.x,a+i.y,i.width,i.height),t&&null!=this.container&&(a=this.container.clientWidth,i=this.container.clientHeight,n.x=n.getCenterX()-a/2,n.width=a,n.y=n.getCenterY()-i/2,n.height=i),this.scrollRectToVisible(n)&&this.view.setTranslate(this.view.translate.x,this.view.translate.y))},mxGraph.prototype.scrollRectToVisible=function(e){var t=!1;if(null!=e){var n=this.container.offsetWidth,a=this.container.offsetHeight,i=Math.min(n,e.width),s=Math.min(a,e.height);if(mxUtils.hasScrollbars(this.container)){n=this.container,e.x+=this.view.translate.x,e.y+=this.view.translate.y;var o=n.scrollLeft-e.x;a=Math.max(o-n.scrollLeft,0);0<o?n.scrollLeft-=o+2:0<(o=e.x+i-n.scrollLeft-n.clientWidth)&&(n.scrollLeft+=o+2),i=n.scrollTop-e.y,o=Math.max(0,i-n.scrollTop),0<i?n.scrollTop-=i+2:0<(i=e.y+s-n.scrollTop-n.clientHeight)&&(n.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+n&&(this.view.translate.x-=(e.x+i-n-o)/l,t=!0),e.y+s>r+a&&(this.view.translate.y-=(e.y+s-a-r)/l,t=!0),e.x<o&&(this.view.translate.x+=(o-e.x)/l,t=!0),e.y<r&&(this.view.translate.y+=(r-e.y)/l,t=!0),t&&(this.view.refresh(),null!=this.selectionCellsHandler&&this.selectionCellsHandler.refresh())}}return t},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 t=e.style[mxConstants.STYLE_ORTHOGONAL];return null!=t?t:(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 t=e.getVisibleTerminalState(!0);return e=e.getVisibleTerminalState(!1),null!=t&&t==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,t,n){return null==this.getEdgeValidationError(e,t,n)},mxGraph.prototype.getEdgeValidationError=function(e,t,n){if(null!=e&&!this.isAllowDanglingEdges()&&(null==t||null==n))return"";if(null!=e&&null==this.model.getTerminal(e,!0)&&null==this.model.getTerminal(e,!1))return null;if(!this.allowLoops&&t==n&&null!=t||!this.isValidConnection(t,n))return"";if(null==t||null==n)return this.allowDanglingEdges?null:"";var a="";this.multigraph||(1<(i=this.model.getEdgesBetween(t,n,!0)).length||1==i.length&&i[0]!=e)&&(a+=(mxResources.get(this.alreadyConnectedResource)||this.alreadyConnectedResource)+"\n");var i=this.model.getDirectedEdgeCount(t,!0,e),s=this.model.getDirectedEdgeCount(n,!1,e);if(null!=this.multiplicities)for(var o=0;o<this.multiplicities.length;o++){var r=this.multiplicities[o].check(this,e,t,n,i,s);null!=r&&(a+=r)}return null!=(r=this.validateEdge(e,t,n))&&(a+=r),0<a.length?a:null},mxGraph.prototype.validateEdge=function(e,t,n){return null},mxGraph.prototype.validateGraph=function(e,t){e=null!=e?e:this.model.getRoot(),t=null!=t?t:{};for(var n=!0,a=this.model.getChildCount(e),i=0;i<a;i++){var s=this.model.getChildAt(e,i),o=t;this.isValidRoot(s)&&(o={}),null!=(o=this.validateGraph(s,o))?this.setCellWarning(s,o.replace(/\n/g,"<br>")):this.setCellWarning(s,null),n=n&&null==o}return a="",this.isCellCollapsed(e)&&!n&&(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,t))&&(a+=i),null==this.model.getParent(e)&&this.view.validate(),0<a.length||!n?a:null},mxGraph.prototype.getCellValidationError=function(e){var t=this.model.getDirectedEdgeCount(e,!0),n=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<t||1==s.min&&0==t||1==s.max&&1<t)?a+=s.countError+"\n":!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")}return 0<a.length?a:null},mxGraph.prototype.validateCell=function(e,t){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 t=this.isCellCollapsed(e.cell);if(this.isCellFoldable(e.cell,!t))return t?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 t="";if(this.labelsVisible&&null!=e){var n=null!=(n=this.view.getState(e))?n.style:this.getCellStyle(e);mxUtils.getValue(n,mxConstants.STYLE_NOLABEL,!1)||(t=this.convertValueToString(e))}return t},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 t=this.view.getState(e);return null!=(e=null!=t?t.style:this.getCellStyle(e))&&"wrap"==e[mxConstants.STYLE_WHITE_SPACE]},mxGraph.prototype.isLabelClipped=function(e){var t=this.view.getState(e);return null!=(e=null!=t?t.style:this.getCellStyle(e))&&"hidden"==e[mxConstants.STYLE_OVERFLOW]},mxGraph.prototype.getTooltip=function(e,n,t,a){var i=null;return null!=e&&(null==e.control||n!=e.control.node&&n.parentNode!=e.control.node||(i=this.collapseExpandResource,i=mxResources.get(i)||i),null==i&&null!=e.overlays&&e.overlays.visit(function(e,t){null!=i||n!=t.node&&n.parentNode!=t.node||(i=t.overlay.toString())}),null==i&&(null!=(t=this.selectionCellsHandler.getHandler(e.cell))&&"function"==typeof t.getTooltipForNode&&(i=t.getTooltipForNode(n))),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 t=new mxRectangle,n=this.view.getState(e);return null!=(e=null!=n?n.style:this.getCellStyle(e))&&(n=parseInt(mxUtils.getValue(e,mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_STARTSIZE)),mxUtils.getValue(e,mxConstants.STYLE_HORIZONTAL,!0)?t.height=n:t.width=n),t},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 t;if(null!=e&&this.model.getParent(e)!=this.model.getRoot()&&(null!=(t=null!=(t=this.view.getState(e))?t.style:this.getCellStyle(e))&&!this.model.isEdge(e)))return t[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 t=this.model.getGeometry(e);return this.isCellsLocked()||null!=t&&this.model.isVertex(e)&&t.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 t=this.view.getState(e);return e=null!=t?t.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 t=this.view.getState(e);return e=null!=t?t.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 t=null!=(t=this.view.getState(e))?t.style:this.getCellStyle(e);return this.isCellsMovable()&&!this.isCellLocked(e)&&0!=t[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 t=null!=(t=this.view.getState(e))?t.style:this.getCellStyle(e);return this.isCellsResizable()&&!this.isCellLocked(e)&&0!=t[mxConstants.STYLE_RESIZABLE]},mxGraph.prototype.isCellsResizable=function(){return this.cellsResizable},mxGraph.prototype.setCellsResizable=function(e){this.cellsResizable=e},mxGraph.prototype.isTerminalPointMovable=function(e,t){return!0},mxGraph.prototype.isCellBendable=function(e){var t=null!=(t=this.view.getState(e))?t.style:this.getCellStyle(e);return this.isCellsBendable()&&!this.isCellLocked(e)&&0!=t[mxConstants.STYLE_BENDABLE]},mxGraph.prototype.isCellsBendable=function(){return this.cellsBendable},mxGraph.prototype.setCellsBendable=function(e){this.cellsBendable=e},mxGraph.prototype.isCellEditable=function(e){var t=null!=(t=this.view.getState(e))?t.style:this.getCellStyle(e);return this.isCellsEditable()&&!this.isCellLocked(e)&&0!=t[mxConstants.STYLE_EDITABLE]},mxGraph.prototype.isCellsEditable=function(){return this.cellsEditable},mxGraph.prototype.setCellsEditable=function(e){this.cellsEditable=e},mxGraph.prototype.isCellDisconnectable=function(e,t,n){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,t){return this.isValidSource(e)&&this.isValidTarget(t)},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 t=this.cellEditor.getEditingCell();return null==e?null!=t:e==t},mxGraph.prototype.isAutoSizeCell=function(e){var t=this.view.getState(e);return e=null!=t?t.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,t){return this.model.filterCells(e,mxUtils.bind(this,function(e){return this.isCellFoldable(e,t)}))},mxGraph.prototype.isCellFoldable=function(e,t){var n=null!=(n=this.view.getState(e))?n.style:this.getCellStyle(e);return 0<this.model.getChildCount(e)&&0!=n[mxConstants.STYLE_FOLDABLE]},mxGraph.prototype.isValidDropTarget=function(e,t,n){return null!=e&&(this.isSplitEnabled()&&this.isSplitTarget(e,t,n)||!this.model.isEdge(e)&&(this.isSwimlane(e)||0<this.model.getChildCount(e)&&!this.isCellCollapsed(e)))},mxGraph.prototype.isSplitTarget=function(e,t,n){return!(!this.model.isEdge(e)||null==t||1!=t.length||!this.isCellConnectable(t[0])||null!=this.getEdgeValidationError(e,this.model.getTerminal(e,!0),t[0]))&&(n=this.model.getTerminal(e,!0),e=this.model.getTerminal(e,!1),!this.model.isAncestor(t[0],n)&&!this.model.isAncestor(t[0],e))},mxGraph.prototype.getDropTarget=function(e,t,n){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(t),mxEvent.getClientY(t))).x-=this.panDx,a.y-=this.panDy,a=this.getSwimlaneAt(a.x,a.y),null==n)n=a;else if(null!=a){for(var i=this.model.getParent(a);null!=i&&this.isSwimlane(i)&&i!=n;)i=this.model.getParent(i);i==n&&(n=a)}for(;null!=n&&!this.isValidDropTarget(n,e,t)&&!this.model.isLayer(n);)n=this.model.getParent(n);return!this.model.isLayer(n)&&mxUtils.indexOf(e,n)<0?n: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,t,n){if(null!=(n=n||this.getDefaultParent()))for(var a=this.model.getChildCount(n),i=0;i<a;i++){var s=this.model.getChildAt(n,i),o=this.getSwimlaneAt(e,t,s);if(null!=o)return o;if(this.isSwimlane(s)&&(o=this.view.getState(s),this.intersects(o,e,t)))return s}return null},mxGraph.prototype.getCellAt=function(e,t,n,a,i){if(a=null==a||a,i=null==i||i,null!=(n=null!=n?n:this.getDefaultParent()))for(var s=this.model.getChildCount(n)-1;0<=s;s--){var o=this.model.getChildAt(n,s),r=this.getCellAt(e,t,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,t)))return o}return null},mxGraph.prototype.intersects=function(e,t,n){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,t,n)<=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()),t=(i=mxUtils.getRotatedPoint(new mxPoint(t,n),a,i,s)).x,n=i.y),mxUtils.contains(e,t,n))return!0}return!1},mxGraph.prototype.hitsSwimlaneContent=function(e,t,n){var a=this.getView().getState(e);if(e=this.getStartSize(e),null!=a){var i=this.getView().getScale();if(t-=a.x,n-=a.y,0<e.width&&0<t&&t>e.width*i||0<e.height&&0<n&&n>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,t,n){for(e=null!=e?e:this.getDefaultParent(),e=this.model.getChildCells(e,null!=t&&t,null!=n&&n),t=[],n=0;n<e.length;n++)this.isCellVisible(e[n])&&t.push(e[n]);return t},mxGraph.prototype.getConnections=function(e,t){return this.getEdges(e,t,!0,!0,!1)},mxGraph.prototype.getIncomingEdges=function(e,t){return this.getEdges(e,t,!0,!1,!1)},mxGraph.prototype.getOutgoingEdges=function(e,t){return this.getEdges(e,t,!1,!0,!1)},mxGraph.prototype.getEdges=function(e,t,n,a,i,s){n=null==n||n,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,n,a)))}for(o=o.concat(this.model.getEdges(e,n,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&&(n&&c==e&&(null==t||this.isValidAncestor(l,t,s))||a&&l==e&&(null==t||this.isValidAncestor(c,t,s))))&&r.push(o[d]);return r},mxGraph.prototype.isValidAncestor=function(e,t,n){return n?this.model.isAncestor(t,e):this.model.getParent(e)==t},mxGraph.prototype.getOpposites=function(e,t,n,a){n=null==n||n,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==t&&null!=l&&l!=t&&a){var d=mxCellPath.create(l);null==s[d]&&(s[d]=l,i.push(l))}else l==t&&null!=r&&r!=t&&n&&(null==s[d=mxCellPath.create(r)]&&(s[d]=r,i.push(r)))}return i},mxGraph.prototype.getEdgesBetween=function(e,t,n){n=null!=n&&n;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==t||!n&&o==t&&r==e)&&i.push(a[s])}return i},mxGraph.prototype.getPointForEvent=function(e,t){var n=mxUtils.convertPoint(this.container,mxEvent.getClientX(e),mxEvent.getClientY(e)),a=this.view.scale,i=this.view.translate,s=0!=t?this.gridSize/2:0;return n.x=this.snap(n.x/a-i.x-s),n.y=this.snap(n.y/a-i.y-s),n},mxGraph.prototype.getCells=function(e,t,n,a,i,s){if(s=null!=s?s:[],0<n||0<a){var o=e+n,r=t+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>=t&&u.x+u.width<=o?s.push(c):this.getCells(e,t,n,a,c,s)}}}return s},mxGraph.prototype.getCellsBeyond=function(e,t,n,a,i){var s=[];if((a||i)&&(null==n&&(n=this.getDefaultParent()),null!=n))for(var o=this.model.getChildCount(n),r=0;r<o;r++){var l=this.model.getChildAt(n,r),d=this.view.getState(l);this.isCellVisible(l)&&null!=d&&(!a||d.x>=e)&&(!i||d.y>=t)&&s.push(l)}return s},mxGraph.prototype.findTreeRoots=function(e,t,n){t=null!=t&&t,n=null!=n&&n;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,t?e:null),m=0,u=0,p=0;p<c.length;p++)this.view.getVisibleTerminal(c[p],!0)==d?m++:u++;(n&&0==m&&0<u||!n&&0==u&&0<m)&&a.push(d),r<(c=n?u-m:m-u)&&(r=c,o=d)}}0==a.length&&null!=o&&a.push(o)}return a},mxGraph.prototype.traverse=function(e,t,n,a,i){if(null!=n&&null!=e){t=null==t||t,i=i||[];var s=mxCellPath.create(e);if(null==i[s]&&(null==(a=n(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;t&&!r||(r=this.model.getTerminal(o,!r),this.traverse(r,t,n,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,t){var n=this.getCells(e.x,e.y,e.width,e.height);return this.selectCellsForEvent(n,t),n},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,t,n){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&&!t||null==this.view.getState(i)||null==this.model.getGeometry(i)?null!=a&&n?0<this.model.getChildCount(a)&&(e=this.model.getChildAt(a,0),this.setSelectionCell(e)):0<s&&(t=i.getIndex(a),e=e?(t++,this.model.getChildAt(i,t%s)):(t--,this.model.getChildAt(i,t<0?s-1:t)),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(t,n,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)&&t||this.model.isEdge(e)&&n)});e=this.model.filterDescendants(a,e),this.setSelectionCells(e)},mxGraph.prototype.selectCellForEvent=function(e,t){var n=this.isCellSelected(e);this.isToggleEvent(t)?n?this.removeSelectionCell(e):this.addSelectionCell(e):(!n||1!=this.getSelectionCount())&&this.setSelectionCell(e)},mxGraph.prototype.selectCellsForEvent=function(e,t){this.isToggleEvent(t)?this.addSelectionCells(e):this.setSelectionCells(e)},mxGraph.prototype.createHandler=function(e){var t=null;return null!=e&&(t=this.model.isEdge(e.cell)?(t=this.view.getEdgeStyle(e),this.isLoop(e)||t==mxEdgeStyle.ElbowConnector||t==mxEdgeStyle.SideToSide||t==mxEdgeStyle.TopToBottom?new mxElbowEdgeHandler(e):t==mxEdgeStyle.SegmentConnector||t==mxEdgeStyle.OrthConnector?new mxEdgeSegmentHandler(e):new mxEdgeHandler(e)):new mxVertexHandler(e)),t},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 t=0;t<this.mouseListeners.length;t++)if(this.mouseListeners[t]==e){this.mouseListeners.splice(t,1);break}},mxGraph.prototype.updateMouseEvent=function(e){if(null==e.graphX||null==e.graphY){var t=mxUtils.convertPoint(this.container,e.getX(),e.getY());e.graphX=t.x-this.panDx,e.graphY=t.y-this.panDy}},mxGraph.prototype.fireMouseEvent=function(e,t,n){if(null==n&&(n=this),this.updateMouseEvent(t),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-t.getX())<this.doubleTapTolerance&&Math.abs(this.lastTouchY-t.getY())<this.doubleTapTolerance?(this.lastTouchTime=0,this.dblClick(t.getEvent(),t.getCell()),t.getEvent().cancelBubble=!0):(this.lastTouchX=t.getX(),this.lastTouchY=t.getY(),this.lastTouchTime=a)}if(a=2!=t.getEvent().detail,mxClient.IS_IE&&"CSS1Compat"==document.compatMode&&((null!=this.lastMouseX&&Math.abs(this.lastMouseX-t.getX())>this.doubleTapTolerance||null!=this.lastMouseY&&Math.abs(this.lastMouseY-t.getY())>this.doubleTapTolerance)&&(a=!0),e==mxEvent.MOUSE_UP&&(this.lastMouseX=t.getX(),this.lastMouseY=t.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||t.getEvent().target!=this.container)){if(e==mxEvent.MOUSE_MOVE&&this.isMouseDown&&this.autoScroll&&this.scrollPointToVisible(t.getGraphX(),t.getGraphY(),this.autoExtend),null!=this.mouseListeners)for(n=[n,t],t.getEvent().returnValue=!0,a=0;a<this.mouseListeners.length;a++){var i=this.mouseListeners[a];e==mxEvent.MOUSE_DOWN?i.mouseDown.apply(i,n):e==mxEvent.MOUSE_MOVE?i.mouseMove.apply(i,n):e==mxEvent.MOUSE_UP&&i.mouseUp.apply(i,n)}e==mxEvent.MOUSE_UP&&this.click(t)}}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 t=e.view.graph.getModel().isEdge(e.cell),n=e.view.scale,a=null,i=this.image.width,s=this.image.height;return t?a=1==(t=e.absolutePoints).length%2?t[Math.floor(t.length/2)]:(e=t[(a=t.length/2)-1],t=t[a],new mxPoint(e.x+(t.x-e.x)/2,e.y+(t.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)*n),Math.round(a.y-(s*this.defaultOverlap-this.offset.y)*n),i*n,s*n)},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 t=this.outline.graphModelChanged;this.outline.graphModelChanged=mxUtils.bind(this,function(e){!this.suspended&&null!=this.outline&&t.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,t){!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 t=this.source.view.scale,n=new mxRectangle((n=this.source.getGraphBounds()).x/t+this.source.panDx,n.y/t+this.source.panDy,n.width/t,n.height/t),a=new mxRectangle(0,0,this.source.container.clientWidth/t,this.source.container.clientHeight/t);(s=n.clone()).add(a);var i=this.getSourceContainerSize(),s=(a=Math.max(i.width/t,s.width),t=Math.max(i.height/t,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/t))){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=(t=this.source.view.translate).x+this.source.panDx;var o=t.y+this.source.panDy;null!=(s=this.getOutlineOffset(s))&&(i+=s.x,o+=s.y),n.x<0&&(i-=n.x),n.y<0&&(o-=n.y),a.translate.x==i&&a.translate.y==o||(a.translate.x=i,a.translate.y=o,e=!0);n=a.translate,i=(s=this.source.getView().scale)/a.scale,o=1/a.scale;var r=this.source.container;this.bounds=new mxRectangle((n.x-t.x-this.source.panDx)/o,(n.y-t.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,(n=this.selectionBorder.bounds).x==this.bounds.x&&n.y==this.bounds.y&&n.width==this.bounds.width&&n.height==this.bounds.height||(this.selectionBorder.bounds=this.bounds,this.selectionBorder.redraw()),n=this.sizer.bounds,a=new mxRectangle(this.bounds.x+this.bounds.width-n.width/2,this.bounds.y+this.bounds.height-n.height/2,n.width,n.height),n.x==a.x&&n.y==a.y&&n.width==a.width&&n.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,t){this.enabled&&this.showViewport&&(this.zoom=t.isSource(this.sizer),this.startX=t.getX(),this.startY=t.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),t.consume()},mxOutline.prototype.mouseMove=function(e,t){if(this.active){this.selectionBorder.node.style.display=this.showViewport?"":"none",this.sizer.node.style.display=this.selectionBorder.node.style.display;var n=t.getX()-this.startX,a=t.getY()-this.startY,i=null;if(this.zoom)a=n/((i=this.source.container).clientWidth/i.clientHeight),i=new mxRectangle(this.bounds.x,this.bounds.y,Math.max(1,this.bounds.width+n),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+n,this.bounds.y+a,this.bounds.width,this.bounds.height);this.selectionBorder.bounds=i,this.selectionBorder.redraw(),n=n/s*this.source.getView().scale,a=a/s*this.source.getView().scale,this.source.panGraph(-n-this.dx0,-a-this.dy0)}n=this.sizer.bounds,this.sizer.bounds=new mxRectangle(i.x+i.width-n.width/2,i.y+i.height-n.height/2,n.width,n.height),"hidden"!=this.sizer.node.style.visibility&&this.sizer.redraw(),t.consume()}},mxOutline.prototype.mouseUp=function(e,t){if(this.active){var n=t.getX()-this.startX,a=t.getY()-this.startY;if(0<Math.abs(n)||0<Math.abs(a)){if(this.zoom){a=this.selectionBorder.bounds.width;var i=this.source.getView().scale;this.source.zoomTo(i-n*i/a,!1)}else this.source.useScrollbarsForPanning&&mxUtils.hasScrollbars(this.source.container)||(this.source.panGraph(0,0),n/=this.outline.getView().scale,a/=this.outline.getView().scale,i=this.source.getView().translate,this.source.getView().setTranslate(i.x-n,i.y-a));this.update(),t.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,t,n,a,i,s){var o="";return(this.source&&this.checkTerminal(e,n,t)||!this.source&&this.checkTerminal(e,a,t))&&(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,t,n,a)||(o+=this.typeError+"\n"))),0<o.length?o:null},mxMultiplicity.prototype.checkNeighbors=function(e,t,n,a){t=e.model.getValue(n),a=e.model.getValue(a),n=!this.validNeighborsAllowed;for(var i=this.validNeighbors,s=0;s<i.length;s++){if(this.source&&this.checkType(e,a,i[s])){n=this.validNeighborsAllowed;break}if(!this.source&&this.checkType(e,t,i[s])){n=this.validNeighborsAllowed;break}}return n},mxMultiplicity.prototype.checkTerminal=function(e,t,n){return t=e.model.getValue(t),this.checkType(e,t,this.type,this.attr,this.value)},mxMultiplicity.prototype.checkType=function(e,t,n,a,i){return null!=t&&(isNaN(t.nodeType)?t==n:mxUtils.isNode(t,n,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 t=this.graph.getModel();t.removeListener(this.undoHandler),this.graph.removeListener(this.moveHandler)}this.graph=e,null!=this.graph&&((t=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 t=this.getGraph().getModel();if(this.isBubbling())for(var n=t.getParents(e);0<n.length;)e=e.concat(n),n=t.getParents(n);this.layoutCells(mxUtils.sortCells(e,!1))},mxLayoutManager.prototype.cellsMoved=function(e,t){if(null!=e&&null!=t)for(var n=mxUtils.convertPoint(this.getGraph().container,mxEvent.getClientX(t),mxEvent.getClientY(t)),a=this.getGraph().getModel(),i=0;i<e.length;i++){var s=this.getLayout(a.getParent(e[i]));null!=s&&s.moveCell(e[i],n.x,n.y)}},mxLayoutManager.prototype.getCellsForChanges=function(e){for(var t=[],n={},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==n[o]&&(n[o]=i[s],t.push(i[s]))}}return t},mxLayoutManager.prototype.getCellsForChange=function(e){var t=this.getGraph().getModel();return e instanceof mxChildChange?[e.child,e.previous,t.getParent(e.child)]:e instanceof mxTerminalChange||e instanceof mxGeometryChange?[e.cell,t.getParent(e.cell)]:[]},mxLayoutManager.prototype.layoutCells=function(e){if(0<e.length){var t=this.getGraph().getModel();t.beginUpdate();try{for(var n=null,a=0;a<e.length;a++)e[a]!=t.getRoot()&&e[a]!=n&&(n=e[a],this.executeLayout(this.getLayout(n),n));this.fireEvent(new mxEventObject(mxEvent.LAYOUT_CELLS,"cells",e))}finally{t.endUpdate()}}},mxLayoutManager.prototype.executeLayout=function(e,t){null!=e&&null!=t&&e.execute(t)},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 t=this.graph.getModel();t.beginUpdate();try{for(var n=0;n<e.length;n++)if(!this.isCellIgnored(e[n])){this.cellResized(e[n]);break}}finally{t.endUpdate()}}},mxSpaceManager.prototype.cellResized=function(e){var t=this.getGraph(),n=t.getView(),a=t.getModel(),i=n.getState(e),s=n.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=n.translate,d=n.scale,c=(n=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+n-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,n,s,l,c,p,i,this.isExtendParents()&&t.isExtendParent(o[r]))}finally{a.endUpdate()}}}},mxSpaceManager.prototype.shiftCell=function(e,t,n,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(-t,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,-n);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 t=this.getGraph(),n=t.getModel().getParent(e.cell),a=this.isShiftDownwards(),i=this.isShiftRightwards();return t.getCellsBeyond(e.x+(a?0:e.width),e.y+(a&&i?0:e.height),n,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 t=this.graph.view.getState(e);return e=null!=t?t.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 t=this.getGraph().getModel();t.beginUpdate();try{for(var n=0;n<e.length;n++)this.isSwimlaneIgnored(e[n])||this.swimlaneAdded(e[n])}finally{t.endUpdate()}}},mxSwimlaneManager.prototype.swimlaneAdded=function(e){for(var t=this.getGraph().getModel(),n=t.getParent(e),a=t.getChildCount(n),i=null,s=0;s<a;s++){var o=t.getChildAt(n,s);if(o!=e&&!this.isSwimlaneIgnored(o)&&null!=(i=t.getGeometry(o)))break}null!=i&&this.resizeSwimlane(e,i.width,i.height)},mxSwimlaneManager.prototype.cellsResized=function(e){if(null!=e){var t=this.getGraph().getModel();t.beginUpdate();try{for(var n=0;n<e.length;n++)if(!this.isSwimlaneIgnored(e[n])){var a=t.getGeometry(e[n]);if(null!=a){for(var i=new mxRectangle(0,0,a.width,a.height),s=o=e[n];null!=s;){var o=s,r=(s=t.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{t.endUpdate()}}},mxSwimlaneManager.prototype.resizeSwimlane=function(e,t,n){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!=n||!i&&r.width!=t)&&(r=r.clone(),i?r.height=n:r.width=t,a.setGeometry(e,r))}var s=this.graph.isSwimlane(e)?this.graph.getStartSize(e):new mxRectangle;t-=s.width,n-=s.height;for(var o=a.getChildCount(e),r=0;r<o;r++){var l=a.getChildAt(e,r);this.resizeSwimlane(l,t,n)}}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,t,n,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(t,n),this.deltas[s]=o,this.count++):a?(o.X+=t,o.Y+=n):(o.X=t,o.Y=n),i&&this.addEdges(e),o},mxCellStatePreview.prototype.show=function(e){var t,n=this.graph.getModel(),a=n.getRoot();for(t in this.deltas){var i=mxCellPath.resolve(a,t),s=this.graph.view.getState(i),o=this.deltas[t];i=this.graph.view.getState(n.getParent(i));this.translateState(i,s,o.x,o.y)}for(t in this.deltas)i=mxCellPath.resolve(a,t),s=this.graph.view.getState(i),o=this.deltas[t],i=this.graph.view.getState(n.getParent(i)),this.revalidateState(i,s,o.x,o.y,e)},mxCellStatePreview.prototype.translateState=function(e,t,n,a){if(null!=t){var i=this.graph.getModel();if(i.isVertex(t.cell)){t.invalid=!0,this.graph.view.validateBounds(e,t.cell),e=i.getGeometry(t.cell);var s=mxCellPath.create(t.cell);0==n&&0==a||null==e||e.relative&&null==this.deltas[s]||(t.x+=n,t.y+=a)}for(e=i.getChildCount(t.cell),s=0;s<e;s++)this.translateState(t,this.graph.view.getState(i.getChildAt(t.cell,s)),n,a)}},mxCellStatePreview.prototype.revalidateState=function(e,t,n,a,i){if(null!=t){t.invalid=!0,this.graph.view.validatePoints(e,t.cell);var s=mxCellPath.create(t.cell),o=this.graph.getModel(),r=this.graph.getCellGeometry(t.cell);for(0==n&&0==a||null==r||!r.relative||!o.isVertex(t.cell)||null!=e&&!o.isVertex(e.cell)&&null==this.deltas[s]||(t.x+=n,t.y+=a,this.graph.cellRenderer.redraw(t)),null!=i&&i(t),e=o.getChildCount(t.cell),s=0;s<e;s++)this.revalidateState(t,this.graph.view.getState(o.getChildAt(t.cell,s)),n,a,i)}},mxCellStatePreview.prototype.addEdges=function(e){for(var t=this.graph.getModel(),n=t.getEdgeCount(e.cell),a=0;a<n;a++){var i=this.graph.view.getState(t.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,t){if(!t.isConsumed()&&this.isEnabled()&&this.graph.isEnabled()&&!this.graph.isForceMarqueeEvent(t.getEvent())&&null!=t.getState()){var n=this.getInitialCellForEvent(t);if(this.cell=null,this.delayedSelection=this.isDelayedSelection(n),this.isSelectEnabled()&&!this.delayedSelection&&this.graph.selectCellForEvent(n,t.getEvent()),this.isMoveEnabled()){var a=this.graph.model,i=a.getGeometry(n);this.graph.isCellMovable(n)&&(!a.isEdge(n)||1<this.graph.getSelectionCount()||null!=i.points&&0<i.points.length||null==a.getTerminal(n,!0)||null==a.getTerminal(n,!1)||this.graph.allowDanglingEdges||this.graph.isCloneEvent(t.getEvent())&&this.graph.isCellsCloneable())&&this.start(n,t.getX(),t.getY()),this.cellWasClicked=!0,!mxClient.IS_SF&&!mxClient.IS_GC||"SELECT"!=t.getSource().nodeName?t.consume():mxClient.IS_SF&&"SELECT"==t.getSource().nodeName&&(this.cellWasClicked=!1,this.first=null)}}},mxGraphHandler.prototype.getGuideStates=function(){var e=this.graph.getDefaultParent(),t=this.graph.getModel(),n=mxUtils.bind(this,function(e){return null!=this.graph.view.getState(e)&&t.isVertex(e)&&null!=t.getGeometry(e)&&!t.getGeometry(e).relative});return this.graph.view.getCellStates(t.filterDescendants(n,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 t=null;if(null!=e&&0<e.length)for(var n=this.graph.getModel(),a=0;a<e.length;a++)if(n.isVertex(e[a])||n.isEdge(e[a])){var i=this.graph.view.getState(e[a]);if(null!=i){var s=i;n.isVertex(e[a])&&null!=i.shape&&null!=i.shape.boundingBox&&(s=i.shape.boundingBox),null==t?t=new mxRectangle(s.x,s.y,s.width,s.height):t.add(s)}}return t},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,t,n){this.cell=e,this.first=mxUtils.convertPoint(this.graph.container,t,n),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 t=this.scaleGrid?this.graph.view.scale:1;return e.x=this.graph.snap(e.x/t)*t,e.y=this.graph.snap(e.y/t)*t,e},mxGraphHandler.prototype.mouseMove=function(e,t){var n=this.graph;if(!t.isConsumed()&&n.isMouseDown&&null!=this.cell&&null!=this.first&&null!=this.bounds){var a=(s=mxUtils.convertPoint(n.container,t.getX(),t.getY())).x-this.first.x,i=s.y-this.first.y,s=n.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=n.isGridEnabledEvent(t.getEvent());s=!0;if(null!=this.guide&&this.useGuidesForEvent(t))s=!1,a=(i=this.guide.move(this.bounds,new mxPoint(a,i),o)).x,i=i.y;else if(o){var r=n.getView().translate,l=n.getView().scale;o=this.bounds.x-(n.snap(this.bounds.x/l-r.x)+r.x)*l,r=this.bounds.y-(n.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(),n.isConstrainedEvent(t.getEvent())&&(Math.abs(a)>Math.abs(i)?i=0:a=0),this.currentDx=a,this.currentDy=i,this.updatePreviewShape(),s=null,i=t.getCell(),n.isDropEnabled()&&this.highlightEnabled&&(s=n.getDropTarget(this.cells,t.getEvent(),i)),o=s,r=n.getModel();null!=o&&o!=this.cells[0];)o=r.getParent(o);l=n.isCloneEvent(t.getEvent())&&n.isCellsCloneable()&&this.isCloneEnabled();var d=!1;null==(a=n.getView().getState(s))||null!=o||r.getParent(this.cell)==s&&!l?(this.target=null,this.connectOnDrop&&null!=i&&1==this.cells.length&&n.getModel().isVertex(i)&&n.isCellConnectable(i)&&(null!=(a=n.getView().getState(i))&&(n=null==n.getEdgeValidationError(null,this.cell,i)?mxConstants.VALID_COLOR:mxConstants.INVALID_CONNECT_TARGET_COLOR,this.setHighlightColor(n),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()}t.consume(),mxEvent.consume(t.getEvent())}else!this.isMoveEnabled()&&!this.isCloneEnabled()||!this.updateCursor||t.isConsumed()||null==t.getState()||n.isMouseDown||(null==(a=n.getCursorForCell(t.getCell()))&&n.isEnabled()&&n.isCellMovable(t.getCell())&&(a=n.getModel().isEdge(t.getCell())?mxConstants.CURSOR_MOVABLE_EDGE:mxConstants.CURSOR_MOVABLE_VERTEX),t.getState().setCursor(a),t.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,t){if(!t.isConsumed()){var n=this.graph;if(null!=this.cell&&null!=this.first&&null!=this.shape&&null!=this.currentDx&&null!=this.currentDy){var a=n.getView().scale,i=n.isCloneEvent(t.getEvent())&&n.isCellsCloneable()&&this.isCloneEnabled(),s=this.currentDx/a,o=(a=this.currentDy/a,t.getCell());this.connectOnDrop&&null==this.target&&null!=o&&n.getModel().isVertex(o)&&n.isCellConnectable(o)&&n.isEdgeValid(null,this.cell,o)?n.connectionHandler.connect(this.cell,o,t.getEvent()):(o=this.target,n.isSplitEnabled()&&n.isSplitTarget(o,this.cells,t.getEvent())?n.splitEdge(o,this.cells,null,s,a):this.moveCells(this.cells,s,a,i,this.target,t.getEvent()))}else this.isSelectEnabled()&&this.delayedSelection&&null!=this.cell&&this.selectDelayed(t)}this.cellWasClicked&&t.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,t,n){if(this.graph.getModel().isVertex(e)){if(e=this.graph.getView().getState(e),n=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(n),mxEvent.getClientY(n)),0!=(a=mxUtils.toRadians(mxUtils.getValue(e.style,mxConstants.STYLE_ROTATION)||0))){t=Math.cos(-a);var a=Math.sin(-a),i=new mxPoint(e.getCenterX(),e.getCenterY());n=mxUtils.getRotatedPoint(n,t,a,i)}return null!=e&&!mxUtils.contains(e,n.x,n.y)}return!1},mxGraphHandler.prototype.moveCells=function(e,t,n,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,t-this.graph.panDx/this.graph.view.scale,n-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 t=e.getEvent();return this.useLeftButtonForPanning&&(this.ignoreCell||null==e.getState())&&mxEvent.isLeftMouseButton(t)||mxEvent.isControlDown(t)&&mxEvent.isShiftDown(t)||this.usePopupTrigger&&mxEvent.isPopupTrigger(t)},mxPanningHandler.prototype.mouseDown=function(e,t){if(!t.isConsumed()&&this.isEnabled()){this.hideMenu(),this.dx0=-this.graph.container.scrollLeft,this.dy0=-this.graph.container.scrollTop;var n=mxUtils.convertPoint(this.graph.container,t.getX(),t.getY());this.triggerX=n.x,this.triggerY=n.y,this.popupTrigger=this.isPopupTrigger(t),this.panningTrigger=this.isPanningEnabled()&&this.isPanningTrigger(t),this.startX=t.getX(),this.startY=t.getY(),this.panningTrigger&&this.consumePanningTrigger(t)}},mxPanningHandler.prototype.consumePanningTrigger=function(e){e.consume()},mxPanningHandler.prototype.mouseMove=function(e,t){var n=t.getX()-this.startX,a=t.getY()-this.startY;if(this.active)this.previewEnabled&&(this.useGrid&&(n=this.graph.snap(n),a=this.graph.snap(a)),this.graph.panGraph(n+this.dx0,a+this.dy0)),this.fireEvent(new mxEventObject(mxEvent.PAN,"event",t)),t.consume();else if(this.panningTrigger){var i=this.active;this.active=Math.abs(n)>this.graph.tolerance||Math.abs(a)>this.graph.tolerance,!i&&this.active&&this.fireEvent(new mxEventObject(mxEvent.PAN_START,"event",t))}},mxPanningHandler.prototype.mouseUp=function(e,t){var n=Math.abs(t.getX()-this.startX),a=Math.abs(t.getY()-this.startY);if(this.active){if(!this.graph.useScrollbarsForPanning||!mxUtils.hasScrollbars(this.graph.container)){n=t.getX()-this.startX,a=t.getY()-this.startY,this.useGrid&&(n=this.graph.snap(n),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+n/i,s.y+a/i)}this.active=!1,this.fireEvent(new mxEventObject(mxEvent.PAN_END,"event",t)),t.consume()}else this.popupTrigger&&n<this.graph.tolerance&&a<this.graph.tolerance&&(n=this.getCellForPopupEvent(t),this.graph.isEnabled()&&this.selectOnPopup&&null!=n&&!this.graph.isCellSelected(n)?this.graph.setSelectionCell(n):this.clearSelectionOnBackground&&null==n&&this.graph.clearSelection(),this.graph.tooltipHandler.hide(),a=mxUtils.getScrollOrigin(),a=new mxPoint(t.getX()+a.x,t.getY()+a.y),this.popup(a.x+1,a.y+1,n,t.getEvent()),t.consume());this.popupTrigger=this.panningTrigger=!1},mxPanningHandler.prototype.getCellForPopupEvent=function(e){return e.getCell()},mxPanningHandler.prototype.panGraph=function(e,t){this.graph.getView().setTranslate(e,t)},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 t=null;if(this.isEnabled()){var n=null!=(t=this.getState(e))&&this.isValidState(t);e=this.getMarkerColor(e.getEvent(),t,n),this.validState=n?t:null,t==this.markedState&&e==this.currentColor||(this.currentColor=e,null!=t&&null!=this.currentColor?(this.markedState=t,this.mark()):null!=this.markedState&&(this.markedState=null,this.unmark()))}return t},mxCellMarker.prototype.markCell=function(e,t){var n=this.graph.getView().getState(e);null!=n&&(this.currentColor=null!=t?t:this.validColor,this.markedState=n,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,t,n){return n?this.validColor:this.invalidColor},mxCellMarker.prototype.getState=function(e){var t=this.graph.getView();return cell=this.getCell(e),null!=(t=this.getStateToMark(t.getState(cell)))&&this.intersects(t,e)?t:null},mxCellMarker.prototype.getCell=function(e){return e.getCell()},mxCellMarker.prototype.getStateToMark=function(e){return e},mxCellMarker.prototype.intersects=function(e,t){return!this.hotspotEnabled||mxUtils.intersectsHotspot(e,t.getGraphX(),t.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,t){t.reset.apply(t)})},mxSelectionCellsHandler.prototype.refresh=function(){var e=this.handlers;this.handlers=new mxDictionary;for(var t=this.graph.getSelectionCells(),n=0;n<t.length;n++){var a=this.graph.view.getState(t[n]);if(null!=a){var i=e.remove(t[n]);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(t[n],i)}}e.visit(mxUtils.bind(this,function(e,t){this.fireEvent(new mxEventObject(mxEvent.REMOVE,"state",t.state)),t.destroy()}))},mxSelectionCellsHandler.prototype.mouseDown=function(e,t){if(this.graph.isEnabled()&&this.isEnabled()){var n=[e,t];this.handlers.visit(function(e,t){t.mouseDown.apply(t,n)})}},mxSelectionCellsHandler.prototype.mouseMove=function(e,t){if(this.graph.isEnabled()&&this.isEnabled()){var n=[e,t];this.handlers.visit(function(e,t){t.mouseMove.apply(t,n)})}},mxSelectionCellsHandler.prototype.mouseUp=function(e,t){if(this.graph.isEnabled()&&this.isEnabled()){var n=[e,t];this.handlers.visit(function(e,t){t.mouseUp.apply(t,n)})}},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 t=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,t)}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,t){return t=mxCellMarker.prototype.getCell.apply(a,arguments),this.error=null,this.isConnectableCell(t)?(null!=t?this.isConnecting()?null!=this.previous&&(this.error=this.validateConnection(this.previous.cell,t),null!=this.error&&0==this.error.length&&(t=null,this.isCreateTarget()&&(this.error=null))):this.isValidSource(t)||(t=null):this.isConnecting()&&!this.isCreateTarget()&&!this.graph.allowDanglingEdges&&(this.error=""),t):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,t,n){return null==this.connectImage||this.isConnecting()?mxCellMarker.prototype.getMarkerColor.apply(a,arguments):null}),a.intersects=mxUtils.bind(this,function(e,t){return!(null==this.connectImage&&!this.isConnecting())||mxCellMarker.prototype.intersects.apply(a,arguments)}),a},mxConnectionHandler.prototype.start=function(e,t,n,a){this.previous=e,this.first=new mxPoint(t,n),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,t){return this.isValidTarget(t)?this.graph.getEdgeValidationError(null,e,t):""},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 t=[],n=new mxImageShape(new mxRectangle(0,0,i.width,i.height),i.src,null,null,0);n.preserveImageAspect=!1,this.isMoveIconToFrontForState(e)?(n.dialect=mxConstants.DIALECT_STRICTHTML,n.init(this.graph.container)):(n.dialect=this.graph.dialect==mxConstants.DIALECT_SVG?mxConstants.DIALECT_SVG:mxConstants.DIALECT_VML,n.init(this.graph.getView().getOverlayPane()),this.moveIconBack&&null!=n.node.previousSibling&&n.node.parentNode.insertBefore(n.node,n.node.parentNode.firstChild)),n.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=n,this.graph.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,a())))});return mxEvent.redirectMouseEvents(n.node,this.graph,a,i),t.push(n),this.redrawIcons(t,this.iconState),t},mxConnectionHandler.prototype.redrawIcons=function(e,t){if(null!=e&&null!=e[0]&&null!=t){var n=this.getIconPosition(e[0],t);e[0].bounds.x=n.x,e[0].bounds.y=n.y,e[0].redraw()}},mxConnectionHandler.prototype.getIconPosition=function(e,t){var n=this.graph.getView().scale,a=t.getCenterX(),i=t.getCenterY();if(this.graph.isSwimlane(t.cell)){a=0!=(s=this.graph.getStartSize(t.cell)).width?t.x+s.width*n/2:a,i=0!=s.height?t.y+s.height*n/2:i;if(0!=(s=mxUtils.toRadians(mxUtils.getValue(t.style,mxConstants.STYLE_ROTATION)||0))){n=Math.cos(s);var s=Math.sin(s),o=new mxPoint(t.getCenterX(),t.getCenterY());a=(i=mxUtils.getRotatedPoint(new mxPoint(a,i),n,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 t=0;t<e.length;t++)e[t].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,t){if(this.mouseDownCounter++,this.isEnabled()&&this.graph.isEnabled()&&!t.isConsumed()&&!this.isConnecting()&&this.isStartEvent(t)){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(t.getGraphX(),t.getGraphY()),this.edgeState=this.createEdgeState(t),this.mouseDownCounter=1,this.waypointsEnabled&&null==this.shape&&(this.waypoints=null,this.shape=this.createShape()),null==this.previous&&null!=this.edgeState){var n=this.graph.getPointForEvent(t.getEvent());this.edgeState.cell.geometry.setTerminalPoint(n,!0)}this.fireEvent(new mxEventObject(mxEvent.START,"state",this.previous)),t.consume()}else if(mxClient.IS_TOUCH&&this.tapAndHoldEnabled&&!this.tapAndHoldInProgress&&this.isEnabled()&&this.graph.isEnabled()&&!this.isConnecting()){this.tapAndHoldInProgress=!0,this.initialTouchX=t.getX(),this.initialTouchY=t.getY();var a=this.graph.view.getState(this.marker.getCell(t));this.tapAndHoldThread&&window.clearTimeout(this.tapAndHoldThread),this.tapAndHoldThread=window.setTimeout(mxUtils.bind(this,function(){this.tapAndHoldValid&&this.tapAndHold(t,a),this.tapAndHoldValid=this.tapAndHoldInProgress=!1}),this.tapAndHoldDelay),this.tapAndHoldValid=!0}this.selectedIcon=this.icon,this.icon=null},mxConnectionHandler.prototype.tapAndHold=function(e,t){null!=t&&(this.marker.currentColor=this.marker.validColor,this.marker.markedState=t,this.marker.mark(),this.first=new mxPoint(e.getGraphX(),e.getGraphY()),this.edgeState=this.createEdgeState(e),this.previous=t,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 t=this.marker.process(e);this.constraintHandler.update(e,null==this.first),this.currentState=t},mxConnectionHandler.prototype.convertWaypoint=function(e){var t=this.graph.getView().getScale(),n=this.graph.getView().getTranslate();e.x=e.x/t-n.x,e.y=e.y/t-n.y},mxConnectionHandler.prototype.mouseMove=function(e,t){if(this.tapAndHoldValid&&(this.tapAndHoldValid=Math.abs(this.initialTouchX-t.getX())<this.tapAndHoldTolerance&&Math.abs(this.initialTouchY-t.getY())<this.tapAndHoldTolerance),t.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(t),null!=this.first){var n=this.graph.getView().scale,a=null,i=n=new mxPoint(this.graph.snap(t.getGraphX()/n)*n,this.graph.snap(t.getGraphY()/n)*n);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(t.getGraphX()+this.connectIconOffset.x,t.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,t))&&(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,t))&&(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(n.x-this.first.x),o=Math.abs(n.y-this.first.y),a>this.graph.tolerance||o>this.graph.tolerance)&&(this.shape=this.createShape(),this.updateCurrentState(t)),null!=this.shape&&(null!=this.edgeState?this.shape.points=this.edgeState.absolutePoints:(n=[s],null!=this.waypoints&&(n=n.concat(this.waypoints)),n.push(i),this.shape.points=n),this.drawPreview()),mxEvent.consume(t.getEvent()),t.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),t.consume())),this.previous=this.currentState):this.previous==this.currentState&&null!=this.currentState&&null==this.icons&&!this.graph.isMouseDown&&t.consume():this.constraintHandler.reset();if(null!=this.constraintHandler.currentConstraint&&this.marker.reset(),!this.graph.isMouseDown&&null!=this.currentState&&null!=this.icons){for(n=!1,s=t.getSource(),i=0;i<this.icons.length&&!n;i++)n=s==this.icons[i].node||s.parentNode==this.icons[i].node;n||this.updateIcons(this.currentState,this.icons,t)}}},mxConnectionHandler.prototype.getTargetPerimeterPoint=function(e,t){var n=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))&&(n=i)}else n=new mxPoint(e.getCenterX(),e.getCenterY());return n},mxConnectionHandler.prototype.getSourcePerimeterPoint=function(e,t,n){n=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&&(t=mxUtils.getRotatedPoint(new mxPoint(t.x,t.y),Math.cos(r),Math.sin(r),s)),null!=(e=i(a.getPerimeterBounds(e),e,t,!1))&&(0!=o&&(e=mxUtils.getRotatedPoint(new mxPoint(e.x,e.y),Math.cos(-r),Math.sin(-r),s)),n=e)}else n=s;return n},mxConnectionHandler.prototype.updateIcons=function(e,t,n){},mxConnectionHandler.prototype.isStopEvent=function(e){return null!=e.getState()},mxConnectionHandler.prototype.addWaypointForEvent=function(e){var t=mxUtils.convertPoint(this.graph.container,e.getX(),e.getY()),n=Math.abs(t.x-this.first.x);t=Math.abs(t.y-this.first.y);(null!=this.waypoints||1<this.mouseDownCounter&&(n>this.graph.tolerance||t>this.graph.tolerance))&&(null==this.waypoints&&(this.waypoints=[]),n=this.graph.view.scale,t=new mxPoint(this.graph.snap(e.getGraphX()/n)*n,this.graph.snap(e.getGraphY()/n)*n),this.waypoints.push(t))},mxConnectionHandler.prototype.mouseUp=function(e,t){if(!t.isConsumed()&&this.isConnecting()){if(this.waypointsEnabled&&!this.isStopEvent(t))return this.addWaypointForEvent(t),void t.consume();if(null==this.error){var n=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(n,a,t.getEvent(),t.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),t.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,t,n,a){if(null!=t||this.isCreateTarget()||this.graph.allowDanglingEdges){var i=this.graph.getModel(),s=null;i.beginUpdate();try{if(null!=e&&null==t&&this.isCreateTarget()&&null!=(t=this.createTargetVertex(n,e))){if(null!=(a=this.graph.getDropTarget([t],n,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(t);r.x-=o.origin.x,r.y-=o.origin.y}}this.graph.addCell(t,a)}var l=this.graph.getDefaultParent();if(null!=e&&null!=t&&i.getParent(e)==i.getParent(t)&&i.getParent(i.getParent(e))!=i.getRoot()&&(l=i.getParent(e),null!=e.geometry&&e.geometry.relative&&null!=t.geometry&&t.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,t,r))){this.graph.setConnectionConstraint(s,e,!0,this.sourceConstraint),this.graph.setConnectionConstraint(s,t,!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==t&&((u=this.graph.getPointForEvent(n,!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",n,"target",a))}}catch(e){mxLog.show(),mxLog.debug(e.message)}finally{i.endUpdate()}this.select&&this.selectCells(s,t)}},mxConnectionHandler.prototype.selectCells=function(e,t){this.graph.setSelectionCell(e)},mxConnectionHandler.prototype.insertEdge=function(e,t,n,a,i,s){return null==this.factoryMethod?this.graph.insertEdge(e,t,n,a,i,s):(t=this.createEdge(n,a,i,s),this.graph.addEdge(t,e,a,i))},mxConnectionHandler.prototype.createTargetVertex=function(e,t){for(var n=this.graph.getCellGeometry(t);null!=n&&n.relative;)t=this.graph.getModel().getParent(t),n=this.graph.getCellGeometry(t);var a=this.graph.cloneCells([t])[0];if(null!=(n=this.graph.getModel().getGeometry(a))){var i=this.graph.getPointForEvent(e);if(n.x=this.graph.snap(i.x-n.width/2)-this.graph.panDx/this.graph.view.scale,n.y=this.graph.snap(i.y-n.height/2)-this.graph.panDy/this.graph.view.scale,null!=this.first){var s=this.graph.view.getState(t);if(null!=s){var o=this.getAlignmentTolerance();Math.abs(this.graph.snap(this.first.x)-this.graph.snap(i.x))<=o?n.x=s.x:Math.abs(this.graph.snap(this.first.y)-this.graph.snap(i.y))<=o&&(n.y=s.y)}}}return a},mxConnectionHandler.prototype.getAlignmentTolerance=function(){return this.graph.isGridEnabled()?this.graph.gridSize:this.graph.tolerance},mxConnectionHandler.prototype.createEdge=function(e,t,n,a){var i=null;return null!=this.factoryMethod&&(i=this.factoryMethod(t,n,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,t,n){return this.pointImage},mxConstraintHandler.prototype.isEventIgnored=function(e,t){return!1},mxConstraintHandler.prototype.update=function(e,t){if(this.isEnabled()&&!this.isEventIgnored(e)){var n=this.getTolerance(),a=new mxRectangle(e.getGraphX()-n,e.getGraphY()-n,2*n,2*n),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(),t):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(n)}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],(n=this.focusIcons[i].bounds.clone()).grow(mxClient.IS_IE?3:2),mxClient.IS_IE&&(n.width-=1,n.height-=1),null==this.focusHighlight?((n=new mxRectangleShape(n,null,this.highlightColor,3)).dialect=this.graph.dialect==mxConstants.DIALECT_SVG?mxConstants.DIALECT_SVG:mxConstants.DIALECT_VML,n.init(this.graph.getView().getOverlayPane()),this.focusHighlight=n,r=mxUtils.bind(this,function(){return null!=this.currentFocus?this.currentFocus:e.getState()}),mxEvent.redirectMouseEvents(n.node,this.graph,r)):(this.focusHighlight.bounds=n,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,t){if(!t.isConsumed()&&this.isEnabled()&&this.graph.isEnabled()&&(this.graph.isForceMarqueeEvent(t.getEvent())||null==t.getState())){var n=mxUtils.getOffset(this.graph.container),a=mxUtils.getScrollOrigin(this.graph.container);if(a.x-=n.x,a.y-=n.y,this.start(t.getX()+a.x,t.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 t=mxUtils.convertPoint(i,e.getX(),e.getY());return e.graphX=t.x,e.graphY=t.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)}t.consume(!1)}},mxRubberband.prototype.start=function(e,t){this.first=new mxPoint(e,t)},mxRubberband.prototype.mouseMove=function(e,t){if(!t.isConsumed()&&null!=this.first){var n=mxUtils.getScrollOrigin(this.graph.container),a=mxUtils.getOffset(this.graph.container);n.x-=a.x,n.y-=a.y;a=t.getX()+n.x,n=t.getY()+n.y;var i=this.first.x-a,s=this.first.y-n,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,n),t.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,t){var n=null!=this.div;this.reset(),n&&(n=new mxRectangle(this.x,this.y,this.width,this.height),this.graph.selectRegion(n,t.getEvent()),t.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,t){this.currentX=e,this.currentY=t,this.repaint()},mxRubberband.prototype.repaint=function(){if(null!=this.div){var e=this.currentX-this.graph.panDx,t=this.currentY-this.graph.panDy;this.x=Math.min(this.first.x,e),this.y=Math.min(this.first.y,t),this.width=Math.max(this.first.x,e)-this.x,this.height=Math.max(this.first.y,t)-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 t=0;e&&(this.singleSizer||(this.sizers.push(this.createSizer("nw-resize",t++)),this.sizers.push(this.createSizer("n-resize",t++)),this.sizers.push(this.createSizer("ne-resize",t++)),this.sizers.push(this.createSizer("w-resize",t++)),this.sizers.push(this.createSizer("e-resize",t++)),this.sizers.push(this.createSizer("sw-resize",t++)),this.sizers.push(this.createSizer("s-resize",t++))),this.sizers.push(this.createSizer("se-resize",t++))),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,t,n,a){return n=new mxRectangle(0,0,n=n||mxConstants.HANDLE_SIZE,n),(a=this.createSizerShape(n,t,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(t)||(a.node.style.visibility="hidden"),a},mxVertexHandler.prototype.isSizerVisible=function(e){return!0},mxVertexHandler.prototype.createSizerShape=function(e,t,n){return null!=this.handleImage?(e.width=this.handleImage.width,e.height=this.handleImage.height,new mxImageShape(e,this.handleImage.src)):t==mxEvent.ROTATION_HANDLE?new mxEllipse(e,n||mxConstants.HANDLE_FILLCOLOR,mxConstants.HANDLE_STROKECOLOR):new mxRectangleShape(e,n||mxConstants.HANDLE_FILLCOLOR,mxConstants.HANDLE_STROKECOLOR)},mxVertexHandler.prototype.moveSizerTo=function(e,t,n){null!=e&&(e.bounds.x=Math.round(t-e.bounds.width/2),e.bounds.y=Math.round(n-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 t=this.tolerance,n=(t=this.allowHandleBoundsCheck&&(mxClient.IS_IE||0<t)?new mxRectangle(e.getGraphX()-t,e.getGraphY()-t,2*t,2*t):null,0);n<this.sizers.length;n++)if(e.isSource(this.sizers[n])||null!=t&&mxUtils.intersects(this.sizers[n].bounds,t))return n;return null},mxVertexHandler.prototype.mouseDown=function(e,t){if(!t.isConsumed()&&this.graph.isEnabled()&&!this.graph.isForceMarqueeEvent(t.getEvent())&&(0<this.tolerance||t.getState()==this.state)){var n=this.getHandleForEvent(t);null!=n&&(this.start(t.getX(),t.getY(),n),t.consume())}},mxVertexHandler.prototype.start=function(e,t,n){e=mxUtils.convertPoint(this.graph.container,e,t),this.startX=e.x,this.startY=e.y,this.index=n,this.selectionBorder.node.style.display=n==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,t){if(t.isConsumed()||null==this.index)null!=this.getHandleForEvent(t)&&t.consume(!1);else{var n=new mxPoint(t.getGraphX(),t.getGraphY()),a=this.graph.isGridEnabledEvent(t.getEvent()),i=this.graph.getView().scale;if(this.index==mxEvent.LABEL_HANDLE)a&&(n.x=this.graph.snap(n.x/i)*i,n.y=this.graph.snap(n.y/i)*i),this.moveSizerTo(this.sizers[this.sizers.length-1],n.x,n.y);else if(this.index==mxEvent.ROTATION_HANDLE){var s=this.state.x+this.state.width/2-n.x,o=this.state.y+this.state.height/2-n.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=n.x-this.state.getCenterX(),o=n.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=n.x-this.startX,o=n.y-this.startY,n=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,n),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()}t.consume()}},mxVertexHandler.prototype.mouseUp=function(e,t){if(!t.isConsumed()&&null!=this.index&&null!=this.state){var n=new mxPoint(t.getGraphX(),t.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(t.getEvent()),i=mxUtils.toRadians(this.state.style[mxConstants.STYLE_ROTATION]||"0"),s=Math.cos(-i),o=Math.sin(-i),r=(n=o*(r=n.x-this.startX)+s*(l=n.y-this.startY),s*r-o*l),l=n,d=this.graph.view.scale;this.resizeCell(this.state.cell,r/d,l/d,this.index,a)}}finally{this.graph.getModel().endUpdate()}this.reset(),t.consume()}},mxVertexHandler.prototype.rotateCell=function(e,t){var n=this.graph.getModel();if(n.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)+t,[e]),this.state.cell!=e&&(null!=(s=this.graph.getCellGeometry(e))&&!s.relative))if(0!=t){var a=this.graph.getModel().getParent(e),i=this.graph.getCellGeometry(a);if(!s.relative&&null!=i){var s,o=mxUtils.toRadians(t),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,n.setGeometry(e,s)}}else(s=s.clone()).x+=dx,s.y+=dy,n.setGeometry(e,s);for(s=n.getChildCount(e),a=0;a<s;a++)this.rotateCell(n.getChildAt(e,a),t)}},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,t,n,a,i){var s=this.graph.model.getGeometry(e);if(null!=s)if(a==mxEvent.LABEL_HANDLE)a=this.graph.view.scale,t=(this.labelShape.bounds.getCenterX()-this.startX)/a,n=(this.labelShape.bounds.getCenterY()-this.startY)/a,null==(s=s.clone()).offset?s.offset=new mxPoint(t,n):(s.offset.x+=t,s.offset.y+=n),this.graph.model.setGeometry(e,s);else{if(a=this.union(s,t,n,a,i,1,new mxPoint(0,0)),0!=(r=mxUtils.toRadians(this.state.style[mxConstants.STYLE_ROTATION]||"0"))){t=a.getCenterX()-s.getCenterX(),n=a.getCenterY()-s.getCenterY(),i=Math.cos(r);var o=Math.sin(r),r=i*t-o*n-t;t=o*t+i*n-n,n=a.x-s.x;var l=a.y-s.y,d=i*n-o*l;i=o*n+i*l,a.x+=r,a.y+=t,this.graph.isCellCollapsed(e)||0==r&&0==t||(n=s.x-a.x+d,l=s.y-a.y+i,this.moveChildren(e,n,l))}this.graph.resizeCell(e,a)}},mxVertexHandler.prototype.moveChildren=function(e,t,n){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+=t,r.y+=n,a.setGeometry(o,r))}}},mxVertexHandler.prototype.union=function(e,t,n,a,i,s,o){if(this.singleSizer){o=e.x+e.width+t;var r=e.y+e.height+n;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+=n,i&&(e=this.graph.snap(e/s)*s)):a<3&&(d+=n,i&&(d=this.graph.snap(d/s)*s)),0==a||3==a||5==a?(r+=t,i&&(r=this.graph.snap(r/s)*s)):2!=a&&4!=a&&7!=a||(l+=t,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 t=e.x+e.width,n=e.y+e.height;if(this.singleSizer)this.moveSizerTo(this.sizers[0],t,n);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=t,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=t,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=n,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[5],l.x,l.y),l.x=a,l.y=n,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[6],l.x,l.y),l.x=t,l.y=n,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 t=this.state.cell;if(null!=this.index){var n=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(e),mxEvent.getClientY(e));t=this.graph.getCellAt(n.x,n.y);this.graph.isSwimlane(t)&&this.graph.hitsSwimlaneContent(t,n.x,n.y)&&(t=null)}this.graph.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,this.graph.getView().getState(t)))}),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 t=mxCellMarker.prototype.getCell.apply(this,arguments);if(!a.isConnectableCell(t))return null;var n=a.graph.getModel();return(t==a.state.cell||null!=t&&!a.graph.connectableEdges&&n.isEdge(t))&&(t=null),t},e.isValidState=function(e){var t=a.graph.getModel();t=null!=(t=a.graph.view.getTerminalPort(e,a.graph.view.getState(t.getTerminal(a.state.cell,!a.isSource)),!a.isSource))?t.cell:null;return a.error=a.validateConnection(a.isSource?e.cell:t,a.isSource?t:e.cell),null==a.error},e},mxEdgeHandler.prototype.validateConnection=function(e,t){return this.graph.getEdgeValidationError(this.state.cell,e,t)},mxEdgeHandler.prototype.createBends=function(){for(var e=this.state.cell,t=[],n=0;n<this.abspoints.length;n++)if(this.isHandleVisible(n)){var a=n==this.abspoints.length-1;if((a=0==n||a)||this.graph.isCellBendable(e)){var i=this.createHandleShape(n);if(this.initBend(i),mxClient.IS_TOUCH&&i.node.setAttribute("pointer-events","none"),this.isHandleEnabled(n))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);t.push(i),a||(this.points.push(new mxPoint(0,0)),i.node.style.visibility="hidden")}}return t},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 t=this.tolerance,n=(t=this.allowHandleBoundsCheck&&(mxClient.IS_IE||0<t)?new mxRectangle(e.getGraphX()-t,e.getGraphY()-t,2*t,2*t):null,0);n<this.bends.length;n++)if((e.isSource(this.bends[n])||null!=t&&mxUtils.intersects(this.bends[n].bounds,t))&&"hidden"!=this.bends[n].node.style.visibility)return n;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,t){var n=null;null!=(n=this.getHandleForEvent(t))&&!t.isConsumed()&&this.graph.isEnabled()&&!this.graph.isForceMarqueeEvent(t.getEvent())&&(this.removeEnabled&&this.isRemovePointEvent(t.getEvent())?this.removePoint(this.state,n):(n!=mxEvent.LABEL_HANDLE||this.graph.isLabelMovable(t.getCell()))&&this.start(t.getX(),t.getY(),n),t.consume())},mxEdgeHandler.prototype.start=function(e,t,n){this.startX=e,this.startY=t,this.isSource=null!=this.bends&&0==n,this.isTarget=null!=this.bends&&n==this.bends.length-1,this.isLabel=n==mxEvent.LABEL_HANDLE,this.isSource||this.isTarget?(e=this.state.cell,(null==(t=this.graph.model.getTerminal(e,this.isSource))&&this.graph.isTerminalPointMovable(e,this.isSource)||null!=t&&this.graph.isCellDisconnectable(e,t,this.isSource))&&(this.index=n)):this.index=n},mxEdgeHandler.prototype.clonePreviewState=function(e,t){return this.state.clone()},mxEdgeHandler.prototype.getSnapToTerminalTolerance=function(){return this.graph.gridSize*this.graph.view.scale/2},mxEdgeHandler.prototype.getPointForEvent=function(e){var n=new mxPoint(e.getGraphX(),e.getGraphY()),a=this.getSnapToTerminalTolerance(),t=this.graph.getView(),i=!1,s=!1;if(this.snapToTerminals&&0<a){var o=function(e){if(null!=e){var t=e.x;Math.abs(n.x-t)<a&&(n.x=t,i=!0),e=e.y,Math.abs(n.y-e)<a&&(n.y=e,s=!0)}},r=function(e){null!=e&&o.call(this,new mxPoint(t.getRoutingCenterX(e),t.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=t.scale,r=t.translate,i||(n.x=(this.graph.snap(n.x/e-r.x)+r.x)*e),s||(n.y=(this.graph.snap(n.y/e-r.y)+r.y)*e)),n},mxEdgeHandler.prototype.getPreviewTerminalState=function(e){this.constraintHandler.update(e,this.isSource),this.marker.process(e),e=this.marker.getValidState();var t=null;return null!=this.constraintHandler.currentFocus&&null!=this.constraintHandler.currentConstraint&&this.marker.reset(),null!=e?t=e:null!=this.constraintHandler.currentConstraint&&null!=this.constraintHandler.currentFocus&&(t=this.constraintHandler.currentFocus),t},mxEdgeHandler.prototype.getPreviewPoints=function(e){var t=null!=(t=this.graph.getCellGeometry(this.state.cell)).points?t.points.slice():null;return this.isSource||this.isTarget?this.graph.resetEdgesOnConnect&&(t=null):(this.convertPoint(e,!1),null==t?t=[e]:t[this.index-1]=e),t},mxEdgeHandler.prototype.updatePreviewState=function(e,t,n){var a=this.isSource?n:this.state.getVisibleTerminalState(!0),i=this.isTarget?n: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==n&&(e.setAbsoluteTerminalPoint(t,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,t){if(null!=this.index&&null!=this.marker){var n=this.getPointForEvent(t);if(this.isLabel)this.label.x=n.x,this.label.y=n.y;else{this.points=this.getPreviewPoints(n);var a=this.isSource||this.isTarget?this.getPreviewTerminalState(t):null,i=this.clonePreviewState(n,null!=a?a.cell:null);this.updatePreviewState(i,n,a),this.setPreviewColor(null==this.error?this.marker.validColor:this.marker.invalidColor),this.abspoints=i.absolutePoints,this.active=!0}this.drawPreview(),mxEvent.consume(t.getEvent()),t.consume()}else mxClient.IS_IE&&null!=this.getHandleForEvent(t)&&t.consume(!1)},mxEdgeHandler.prototype.mouseUp=function(e,t){if(null!=this.index&&null!=this.marker){var n=this.state.cell;if(t.getX()!=this.startX||t.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)n=this.connect(n,a,this.isSource,this.graph.isCloneEvent(t.getEvent())&&this.cloneEnabled&&this.graph.isCellsCloneable(),t);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(n));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(n,a,this.isSource)}}else this.active?this.changePoints(n,this.points):(this.graph.getView().invalidate(this.state.cell),this.graph.getView().revalidate(this.state.cell));null!=this.marker&&(this.reset(),n!=this.state.cell&&this.graph.setSelectionCell(n)),t.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,t){var n=this.graph.getView().getScale(),a=this.graph.getView().getTranslate();return t&&(e.x=this.graph.snap(e.x),e.y=this.graph.snap(e.y)),e.x=Math.round(e.x/n-a.x),e.y=Math.round(e.y/n-a.y),null!=(n=this.graph.getView().getState(this.graph.getModel().getParent(this.state.cell)))&&(e.x-=n.origin.x,e.y-=n.origin.y),e},mxEdgeHandler.prototype.moveLabel=function(e,t,n){var a=this.graph.getModel();if(null!=(i=a.getGeometry(e.cell))){var i=i.clone(),s=this.graph.getView().getRelativePoint(e,t,n);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((t-s.x)/o,(n-s.y)/o),a.setGeometry(e.cell,i)}},mxEdgeHandler.prototype.connect=function(e,t,n,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,!n);this.graph.connectCell(o,r,!n),e=o}var l=this.constraintHandler.currentConstraint;null==l&&(l=new mxConnectionConstraint),this.graph.connectCell(e,t,n,l)}finally{i.endUpdate()}return e},mxEdgeHandler.prototype.changeTerminalPoint=function(e,t,n){var a=this.graph.getModel(),i=a.getGeometry(e);if(null!=i){a.beginUpdate();try{(i=i.clone()).setTerminalPoint(t,n),a.setGeometry(e,i),this.graph.connectCell(e,null,n,new mxConnectionConstraint)}finally{a.endUpdate()}}},mxEdgeHandler.prototype.changePoints=function(e,t){var n=this.graph.getModel(),a=n.getGeometry(e);null!=a&&((a=a.clone()).points=t,n.setGeometry(e,a))},mxEdgeHandler.prototype.addPoint=function(e,t){var n=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(t),mxEvent.getClientY(t)),a=this.graph.isGridEnabledEvent(t);this.convertPoint(n,a),this.addPointAt(e,n.x,n.y),mxEvent.consume(t)},mxEdgeHandler.prototype.addPointAt=function(e,t,n){var a=this.graph.getCellGeometry(e.cell);if(t=new mxPoint(t,n),null!=a){a=a.clone(),n=this.graph.view.translate;var i=this.graph.view.scale;n=mxUtils.findNearestSegment(e,(t.x+n.x)*i,(t.y+n.y)*i),null==a.points?a.points=[t]:a.points.splice(n,0,t),this.graph.getModel().setGeometry(e.cell,a),this.destroy(),this.init()}},mxEdgeHandler.prototype.removePoint=function(e,t){if(0<t&&t<this.abspoints.length-1){var n=this.graph.getCellGeometry(this.state.cell);null!=n&&null!=n.points&&((n=n.clone()).points.splice(t-1,1),this.graph.getModel().setGeometry(e.cell,n),this.destroy(),this.init())}},mxEdgeHandler.prototype.getHandleFillColor=function(e){e=0==e;var t=this.state.cell,n=this.graph.getModel().getTerminal(t,e),a=mxConstants.HANDLE_FILLCOLOR;return null!=n&&!this.graph.isCellDisconnectable(t,n,e)||null==n&&!this.graph.isTerminalPointMovable(t,e)?a=mxConstants.LOCKED_HANDLE_FILLCOLOR:null!=n&&this.graph.isCellDisconnectable(t,n,e)&&(a=mxConstants.CONNECT_HANDLE_FILLCOLOR),a},mxEdgeHandler.prototype.redraw=function(){this.abspoints=this.state.absolutePoints.slice();var e=this.state.cell,t=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-t/2),Math.round(this.label.y-t/2),t,t),this.labelShape.redraw(),null!=(t=this.graph.getLabel(e))&&0<t.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 n=this.abspoints.length-1,a=(e=this.abspoints[0],this.abspoints[0].y);t=this.bends[0].bounds;this.bends[0].bounds=new mxRectangle(Math.round(this.abspoints[0].x-t.width/2),Math.round(a-t.height/2),t.width,t.height),this.bends[0].fill=this.getHandleFillColor(0),this.bends[0].redraw();a=this.abspoints[n];var i=this.abspoints[n].x,s=(n=this.abspoints[n].y,this.bends.length-1);t=this.bends[s].bounds;this.bends[s].bounds=new mxRectangle(Math.round(i-t.width/2),Math.round(n-t.height/2),t.width,t.height),this.bends[s].fill=this.getHandleFillColor(s),this.bends[s].redraw(),this.redrawInnerBends(e,a)}this.drawPreview()},mxEdgeHandler.prototype.redrawInnerBends=function(e,t){var n=this.graph.getModel().getGeometry(this.state.cell).points;if(null!=n){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]=n[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=[],t=this.createHandleShape(0);return this.initBend(t),t.node.style.cursor=mxConstants.CURSOR_BEND_HANDLE,mxEvent.redirectMouseEvents(t.node,this.graph,this.state),e.push(t),mxClient.IS_TOUCH&&t.node.setAttribute("pointer-events","none"),e.push(this.createVirtualBend()),this.points.push(new mxPoint(0,0)),t=this.createHandleShape(2),this.initBend(t),t.node.style.cursor=mxConstants.CURSOR_BEND_HANDLE,mxEvent.redirectMouseEvents(t.node,this.graph,this.state),e.push(t),mxClient.IS_TOUCH&&t.node.setAttribute("pointer-events","none"),e},mxElbowEdgeHandler.prototype.createVirtualBend=function(){var e=this.createHandleShape();this.initBend(e);var t=this.getCursorForBend();return e.node.style.cursor=t,t=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,t),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 t=null;return null==this.bends||null==this.bends[1]||e!=this.bends[1].node&&e.parentNode!=this.bends[1].node||(t=this.doubleClickOrientationResource,t=mxResources.get(t)||t),t},mxElbowEdgeHandler.prototype.convertPoint=function(e,t){var n=this.graph.getView().getScale(),a=this.graph.getView().getTranslate(),i=this.state.origin;t&&(e.x=this.graph.snap(e.x),e.y=this.graph.snap(e.y)),e.x=Math.round(e.x/n-a.x-i.x),e.y=Math.round(e.y/n-a.y-i.y)},mxElbowEdgeHandler.prototype.redrawInnerBends=function(e,t){var n=null==(n=null!=(n=this.graph.getModel().getGeometry(this.state.cell).points)?n[0]:null)?new mxPoint(e.x+(t.x-e.x)/2,e.y+(t.y-e.y)/2):new mxPoint(this.graph.getView().scale*(n.x+this.graph.getView().translate.x+this.state.origin.x),this.graph.getView().scale*(n.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(n.x-a/2),Math.round(n.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(n.x-a/2),Math.round(n.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 t=this.state.absolutePoints,n=t[0].clone();this.convertPoint(n,!1);for(var a=[],i=1;i<t.length;i++){var s=t[i].clone();this.convertPoint(s,!1),i==this.index&&(n.x==s.x?(n.x=e.x,s.x=e.x):(n.y=e.y,s.y=e.y)),i<t.length-1&&a.push(s),n=s}if(1==a.length){if(n=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)?t[1].y==t[2].y?a[0].y=n.getRoutingCenterY(i)-r:a[0].x=n.getRoutingCenterX(i)-o:mxUtils.contains(i,a[0].x+o,a[0].y+r)&&(t[1].y==t[0].y?a[0].y=n.getRoutingCenterY(s)-r:a[0].x=n.getRoutingCenterX(s)-o)}}else 0==a.length&&(a=[e]);return a},mxEdgeSegmentHandler.prototype.createBends=function(){var e=[],t=this.createHandleShape(0);this.initBend(t),t.node.style.cursor=mxConstants.CURSOR_BEND_HANDLE,mxEvent.redirectMouseEvents(t.node,this.graph,this.state),e.push(t),mxClient.IS_TOUCH&&t.node.setAttribute("pointer-events","none");var n=this.state.absolutePoints;if(this.graph.isCellBendable(this.state.cell)){null==this.points&&(this.points=[]);for(var a=0;a<n.length-1;a++)t=this.createVirtualBend(),e.push(t),t.node.style.cursor=0==n[a].x-n[a+1].x?"col-resize":"row-resize",this.points.push(new mxPoint(0,0)),mxClient.IS_TOUCH&&t.node.setAttribute("pointer-events","none")}return t=this.createHandleShape(n.length),this.initBend(t),t.node.style.cursor=mxConstants.CURSOR_BEND_HANDLE,mxEvent.redirectMouseEvents(t.node,this.graph,this.state),e.push(t),mxClient.IS_TOUCH&&t.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,t){if(this.graph.isCellBendable(this.state.cell)){var n=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],t=a[i+1];var s=new mxPoint(e.x+(t.x-e.x)/2,e.y+(t.y-e.y)/2);this.bends[i+1].bounds=new mxRectangle(Math.round(s.x-n/2),Math.round(s.y-n/2),n,n),this.bends[i+1].redraw()}}},mxEdgeSegmentHandler.prototype.changePoints=function(e,t){t=[];var n=this.abspoints;if(1<n.length)for(var a=n[0],i=n[1],s=2;s<n.length;s++){var o=n[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),t.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,t){this.normalKeys[e]=t},mxKeyHandler.prototype.bindShiftKey=function(e,t){this.shiftKeys[e]=t},mxKeyHandler.prototype.bindControlKey=function(e,t){this.controlKeys[e]=t},mxKeyHandler.prototype.bindControlShiftKey=function(e,t){this.controlShiftKeys[e]=t},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 t=this.getFunction(e);null!=t&&(t(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,t){this.reset(t,!1),this.hideTooltip()},mxTooltipHandler.prototype.mouseMove=function(e,t){t.getX()==this.lastX&&t.getY()==this.lastY||(this.reset(t,!0),(this.isHideOnHover()||t.getState()!=this.state||t.getSource()!=this.node&&(!this.stateSource||null!=t.getState()&&this.stateSource==(t.isSource(t.getState().shape)||!t.isSource(t.getState().text))))&&this.hideTooltip()),this.lastX=t.getX(),this.lastY=t.getY()},mxTooltipHandler.prototype.mouseUp=function(e,t){this.reset(t,!0),this.hideTooltip()},mxTooltipHandler.prototype.resetTimer=function(){null!=this.thread&&(window.clearTimeout(this.thread),this.thread=null)},mxTooltipHandler.prototype.reset=function(e,t){if(this.resetTimer(),t&&this.isEnabled()&&null!=e.getState()&&(null==this.div||"hidden"==this.div.style.visibility)){var n=e.getState(),a=e.getSource(),i=e.getX(),s=e.getY(),o=e.isSource(n.shape)||e.isSource(n.text);this.thread=window.setTimeout(mxUtils.bind(this,function(){if(!this.graph.isEditing()&&!this.graph.panningHandler.isMenuShowing()){var e=this.graph.getTooltip(n,a,i,s);this.show(e,i,s),this.state=n,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,t,n){if(null!=e&&0<e.length){null==this.div&&this.init();var a=mxUtils.getScrollOrigin();this.div.style.left=t+a.x+"px",this.div.style.top=n+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,t){},mxCellTracker.prototype.mouseMove=function(e,t){this.isEnabled()&&this.process(t)},mxCellTracker.prototype.mouseUp=function(e,t){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,t,n){var a=mxUtils.bind(this,function(){this.editor.execute(t)});n?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,t,n,a){if(null!=this.config){var i=this.createConditions(e,n,a);this.addItems(e,t,n,a,i,this.config.firstChild,null)}},mxDefaultPopupMenu.prototype.addItems=function(e,t,n,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&&(t.addSeparator(o),r=!1),null!=m&&this.imageBasePath&&(m=this.imageBasePath+m),l=this.addAction(t,e,l,m,d,c,n,o,u),this.addItems(e,t,n,a,i,s.firstChild,l)}}else"separator"==s.nodeName&&(r=!0);s=s.nextSibling}},mxDefaultPopupMenu.prototype.addAction=function(e,t,n,a,i,s,o,r,l){return e.addItem(n,a,function(e){"function"==typeof i&&i.call(t,t,o,e),null!=s&&t.execute(s,o,e)},r,l)},mxDefaultPopupMenu.prototype.createConditions=function(e,t,n){var a=e.graph.getModel(),i=a.getChildCount(t),s=[];for(s.nocell=null==t,s.ncells=1<e.graph.getSelectionCount(),s.notRoot=a.getRoot()!=a.getParent(e.graph.getDefaultParent()),s.cell=null!=t,a=null!=t&&1==e.graph.getSelectionCount(),s.nonEmpty=a&&0<i,s.expandable=a&&e.graph.isCellFoldable(t,!1),s.collapsable=a&&e.graph.isCellFoldable(t,!0),s.validRoot=a&&e.graph.isValidRoot(t),s.emptyValidRoot=s.validRoot&&0==i,s.swimlane=a&&e.graph.isSwimlane(t),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,t,n))}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,t){var n=t.getProperty("function");this.editor.insertFunction=null!=n?mxUtils.bind(this,function(){n.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,t,n,a){var i=mxUtils.bind(this,function(){null!=n&&0<n.length&&this.editor.execute(n)});return this.toolbar.addItem(e,t,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,t,n){var a=mxUtils.bind(this,function(){this.editor.execute(n)});this.addOption(e,t,a)},mxDefaultToolbar.prototype.addOption=function(e,t,n){return this.toolbar.addOption(e,t,n)},mxDefaultToolbar.prototype.addMode=function(e,t,n,a,i){var s=mxUtils.bind(this,function(){this.editor.setMode(n),null!=i&&i(this.editor)});return this.toolbar.addSwitchMode(e,t,s,a)},mxDefaultToolbar.prototype.addPrototype=function(e,t,n,a,i,s){var o=function(){return"function"==typeof n?n():null!=n?n.clone():null},r=mxUtils.bind(this,function(e,t){"function"==typeof i?i(this.editor,o(),e,t):this.drop(o(),e,t),this.toolbar.resetMode(),mxEvent.consume(e)});return e=this.toolbar.addMode(e,t,r,a,null,s),this.installDropHandler(e,function(e,t,n){r(t,n)}),e},mxDefaultToolbar.prototype.drop=function(e,t,n){var a=this.editor.graph,i=a.getModel();if(null!=n&&!i.isEdge(n)&&this.connectOnDrop&&a.isCellConnectable(n))this.connect(e,t,n);else{for(;null!=n&&!a.isValidDropTarget(n,[e],t);)n=i.getParent(n);this.insert(e,t,n)}},mxDefaultToolbar.prototype.insert=function(e,t,n){var a=this.editor.graph;if(a.canImportCell(e)){var i=mxEvent.getClientX(t),s=mxEvent.getClientY(t);i=mxUtils.convertPoint(a.container,i,s);return a.isSplitEnabled()&&a.isSplitTarget(n,[e],t)?a.splitEdge(n,[e],null,i.x,i.y):this.editor.addVertex(n,e,i.x,i.y)}return null},mxDefaultToolbar.prototype.connect=function(e,t,n){var a=(t=this.editor.graph).getModel();if(null!=n&&t.isCellConnectable(e)&&t.isEdgeValid(null,n,e)){var i=null;a.beginUpdate();try{var s=a.getGeometry(n),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*t.gridSize,l=20*a.getDirectedEdgeCount(n,!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(n);if(t.addCell(e,d),t.constrainChild(e),i=this.editor.createEdge(n,e),null==a.getGeometry(i)){var c=new mxGeometry;c.relative=!0,a.setGeometry(i,c)}t.addEdge(i,d,n,e)}finally{a.endUpdate()}t.setSelectionCells([e,i]),t.scrollCellToVisible(e)}},mxDefaultToolbar.prototype.installDropHandler=function(t,n){var a=document.createElement("img");a.setAttribute("src",t.getAttribute("src"));var i=mxUtils.bind(this,function(e){a.style.width=2*t.offsetWidth+"px",a.style.height=2*t.offsetHeight+"px",mxUtils.makeDraggable(t,this.editor.graph,n,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 t=e.getUrlImage();if(null==t||mxClient.IS_LOCAL)e.execute("show");else{var n=mxUtils.getViewXml(e.graph,1);n=mxUtils.getXml(n,"\n");mxUtils.submit(t,e.postParameterName+"="+encodeURIComponent(n),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,t){e.showProperties(t)}),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,t){e.graph.isEnabled()&&e.graph.isCellEditable(t)&&e.graph.startEditingAtCell(t)}),this.addAction("toBack",function(e,t){e.graph.isEnabled()&&e.graph.orderCells(!0)}),this.addAction("toFront",function(e,t){e.graph.isEnabled()&&e.graph.orderCells(!1)}),this.addAction("enterGroup",function(e,t){e.graph.enterGroup(t)}),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 t=e.graph.getChildVertices();e.graph.foldCells(!0,!1,t)}}),this.addAction("expand",function(e){e.graph.isEnabled()&&e.graph.foldCells(!1)}),this.addAction("expandAll",function(e){if(e.graph.isEnabled()){var t=e.graph.getChildVertices();e.graph.foldCells(!1,!1,t)}}),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 t=100*e.graph.getView().scale;t=parseFloat(mxUtils.prompt(mxResources.get(e.askZoomResource)||e.askZoomResource,t))/100;isNaN(t)||e.graph.getView().setScale(t)}),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,t){this.actions[e]=t},mxEditor.prototype.execute=function(t,e,n){var a=this.actions[t];if(null!=a)try{var i=arguments;i[0]=this,a.apply(this,i)}catch(e){throw mxUtils.error("Cannot execute "+t+": "+e.message,280,!0),e}else mxUtils.error("Cannot find action "+t,280,!0)},mxEditor.prototype.addTemplate=function(e,t){this.templates[e]=t},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,t,n){return this.createPopupMenu(e,t,n)}),e.connectionHandler.factoryMethod=mxUtils.bind(this,function(e,t){return this.createEdge(e,t)}),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 t=null,n=i.graph.getModel();return null!=n.getParent(e)&&(i.layoutSwimlanes&&a.isSwimlane(e)?(null==i.swimlaneLayout&&(i.swimlaneLayout=i.createSwimlaneLayout()),t=i.swimlaneLayout):i.layoutDiagram&&(a.isValidRoot(e)||null==n.getParent(n.getParent(e)))&&(null==i.diagramLayout&&(i.diagramLayout=i.createDiagramLayout()),t=i.diagramLayout)),t},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,t){var n=t.getProperty("cell");null!=n&&a.isEnabled()&&null!=this.dblClickAction&&(this.execute(this.dblClickAction,n),t.consume())}))},mxEditor.prototype.installUndoHandler=function(a){var e=mxUtils.bind(this,function(e,t){var n=t.getProperty("edit");this.undoManager.undoableEditHappened(n)});a.getModel().addListener(mxEvent.UNDO,e),a.getView().addListener(mxEvent.UNDO,e),e=function(e,t){var n=t.getProperty("edit").changes;a.setSelectionCells(a.getSelectionCellsForChanges(n))},this.undoManager.addListener(mxEvent.UNDO,e),this.undoManager.addListener(mxEvent.REDO,e)},mxEditor.prototype.installDrillHandler=function(e){var t=mxUtils.bind(this,function(e){this.fireEvent(new mxEventObject(mxEvent.ROOT))});e.getView().addListener(mxEvent.DOWN,t),e.getView().addListener(mxEvent.UP,t)},mxEditor.prototype.installChangeHandler=function(s){var e=mxUtils.bind(this,function(e,t){this.setModified(!0),1==this.validating&&s.validateGraph();for(var n=t.getProperty("edit").changes,a=0;a<n.length;a++){var i=n[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 n=this;e.addMouseListener({mouseDown:function(e,t){null==n.insertFunction||t.isPopupTrigger()||!n.forcedInserting&&null!=t.getState()||(n.graph.clearSelection(),n.insertFunction(t.getEvent(),t.getCell()),this.isActive=!0,t.consume())},mouseMove:function(e,t){this.isActive&&t.consume()},mouseUp:function(e,t){this.isActive&&(this.isActive=!1,t.consume())}})},mxEditor.prototype.createDiagramLayout=function(){var e=this.graph.gridSize,t=new mxStackLayout(this.graph,!this.horizontalFlow,this.swimlaneSpacing,2*e,2*e);return t.isVertexIgnored=function(e){return!t.graph.isSwimlane(e)},t},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(t){this.addListener(mxEvent.ROOT,mxUtils.bind(this,function(e){t.innerHTML=this.getTitle()})),mxClient.IS_QUIRKS&&new mxDivResizer(t)},mxEditor.prototype.treeLayout=function(e,t){null!=e&&new mxCompactTreeLayout(this.graph,t).execute(e)},mxEditor.prototype.getTitle=function(){for(var e="",t=this.graph,n=t.getCurrentRoot();null!=n&&null!=t.getModel().getParent(t.getModel().getParent(n));)t.isValidRoot(n)&&(e=" > "+t.convertValueToString(n)+e),n=t.getModel().getParent(n);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 t=mxUtils.load(e).getXml();this.readGraphModel(t.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,t){if(null!=(e=e||this.getUrlPost())&&0<e.length){var n=this.writeGraphModel(t);this.postDiagram(e,n),this.setModified(!1)}this.fireEvent(new mxEventObject(mxEvent.SAVE,"url",e))},mxEditor.prototype.postDiagram=function(t,n){this.escapePostData&&(n=encodeURIComponent(n)),mxUtils.post(t,this.postParameterName+"="+n,mxUtils.bind(this,function(e){this.fireEvent(new mxEventObject(mxEvent.POST,"request",e,"url",t,"data",n))}))},mxEditor.prototype.writeGraphModel=function(e){e=null!=e?e:this.linefeed;var t=(new mxCodec).encode(this.graph.getModel());return mxUtils.getXml(t,e)},mxEditor.prototype.getUrlPost=function(){return this.urlPost},mxEditor.prototype.getUrlImage=function(){return this.urlImage},mxEditor.prototype.connect=function(e,t,n,a){var i=null;return mxClient.IS_LOCAL||((i=new mxSession(this.graph.getModel(),e,t,n)).addListener(mxEvent.RECEIVE,mxUtils.bind(this,function(e,t){null!=t.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,t){var n=this.graph.getStylesheet().styles[t];this.graph.getView().getStylesheet().putCellStyle(t,this.graph.getStylesheet().styles[e]),this.graph.getStylesheet().putCellStyle(e,n),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 t=(n=mxUtils.getOffset(this.graph.container)).x+10,n=n.y;if(null==this.properties||this.movePropertiesDialog){var a=this.graph.getCellBounds(e);null!=a&&(t+=a.x+Math.min(200,a.width),n+=a.y)}else t=this.properties.getX(),n=this.properties.getY();this.hideProperties(),null!=(e=this.createProperties(e))&&(this.properties=new mxWindow(mxResources.get(this.propertiesResource)||this.propertiesResource,e,t,n,this.propertiesWidth,this.propertiesHeight,!1),this.properties.setVisible(!0))}},mxEditor.prototype.isPropertiesVisible=function(){return null!=this.properties},mxEditor.prototype.createProperties=function(n){var a=this.graph.getModel(),e=a.getValue(n);if(mxUtils.isNode(e)){var t=new mxForm("properties");t.addText("ID",n.getId()).setAttribute("readonly","true");var i=null,s=null,o=null,r=null,l=null;a.isVertex(n)&&(null!=(i=a.getGeometry(n))&&(s=t.addText("top",i.y),o=t.addText("left",i.x),r=t.addText("width",i.width),l=t.addText("height",i.height)));var d=a.getStyle(n),c=t.addText("Style",d||""),m=e.attributes,u=[];for(e=0;e<m.length;e++)u[e]=t.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(n,i)),0<c.value.length?a.setStyle(n,c.value):a.setStyle(n,null);for(var e=0;e<m.length;e++){var t=new mxCellAttributeChange(n,m[e].nodeName,u[e].value);a.execute(t)}this.graph.isAutoSizeCell(n)&&this.graph.updateCellSize(n)}finally{a.endUpdate()}}),d=mxUtils.bind(this,function(){this.hideProperties()}),t.addButtons(e,d),t.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 t=document.createElement("div");t.style.padding="4px",t.style.paddingLeft="20px";var e=document.body.clientWidth;(e=new mxWindow(mxResources.get(this.tasksResource)||this.tasksResource,t,e-220,this.tasksTop,200)).setClosable(!0),e.destroyOnClose=!1;var n=mxUtils.bind(this,function(e){mxEvent.release(t),t.innerHTML="",this.createTasks(t)});this.graph.getModel().addListener(mxEvent.CHANGE,n),this.graph.getSelectionModel().addListener(mxEvent.CHANGE,n),this.graph.addListener(mxEvent.ROOT,n),null!=this.tasksWindowImage&&e.setImage(this.tasksWindowImage),this.tasks=e,this.createTasks(t)}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 t=document.createElement("iframe");t.setAttribute("src",mxResources.get("urlHelp")||this.urlHelp),t.setAttribute("height","100%"),t.setAttribute("width","100%"),t.setAttribute("frameBorder","0"),t.style.backgroundColor="white",e=document.body.clientWidth;var n=document.body.clientHeight||document.documentElement.clientHeight,a=new mxWindow(mxResources.get(this.helpResource)||this.helpResource,t,(e-this.helpWidth)/2,(n-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){t.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 t=new mxWindow(mxResources.get(this.outlineResource)||this.outlineResource,e,600,480,200,200,!1),n=new mxOutline(this.graph,e);t.setClosable(!0),t.setResizable(!0),t.destroyOnClose=!1,t.addListener(mxEvent.RESIZE_END,function(){n.update()}),this.outline=t,this.outline.outline=n}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,t,n){this.popupHandler.createMenu(this,e,t,n)},mxEditor.prototype.createEdge=function(e,t){var n=null;if(null!=this.defaultEdge)n=this.graph.getModel().cloneCell(this.defaultEdge);else{(n=new mxCell("")).setEdge(!0);var a=new mxGeometry;a.relative=!0,n.setGeometry(a)}return null!=(a=this.getEdgeStyle())&&n.setStyle(a),n},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 t=this.consumeCycleAttribute(e);null!=t&&e.setStyle(e.getStyle()+";"+this.cycleAttributeName+"="+t)}},mxEditor.prototype.addVertex=function(e,t,n,a){for(var i=this.graph.getModel();null!=e&&!this.graph.isValidDropTarget(e);)e=i.getParent(e);e=null!=e?e:this.graph.getSwimlaneAt(n,a);var s=this.graph.getView().scale,o=i.getGeometry(t),r=i.getGeometry(e);if(this.graph.isSwimlane(t)&&!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(n-=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<n+r&&(n-=n+r-c),(c=l.y+l.height)<a+d&&(a-=a+d-c)}}else null!=r&&(n-=r.x*s,a-=r.y*s)}}(o=o.clone()).x=this.graph.snap(n/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),t.setGeometry(o),null==e&&(e=this.graph.getDefaultParent()),this.cycleAttribute(t),this.fireEvent(new mxEventObject(mxEvent.BEFORE_ADD_VERTEX,"vertex",t,"parent",e)),i.beginUpdate();try{null!=(t=this.graph.addCell(t,e))&&(this.graph.constrainChild(t),this.fireEvent(new mxEventObject(mxEvent.ADD_VERTEX,"vertex",t)))}finally{i.endUpdate()}return null!=t&&(this.graph.setSelectionCell(t),this.graph.scrollCellToVisible(t),this.fireEvent(new mxEventObject(mxEvent.AFTER_ADD_VERTEX,"vertex",t))),t},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 t=e.getName();mxCodecRegistry.codecs[t]=e;var n=mxUtils.getFunctionName(e.template.constructor);n!=t&&mxCodecRegistry.addAlias(n,t)}return e},addAlias:function(e,t){mxCodecRegistry.aliases[e]=t},getCodec:function(e){var t=null;if(null!=e){t=mxUtils.getFunctionName(e);var n=mxCodecRegistry.aliases[t];if(null!=n&&(t=n),null==(t=mxCodecRegistry.codecs[t]))try{t=new mxObjectCodec(new e),mxCodecRegistry.register(t)}catch(e){}}return t}};function mxCodec(e){this.document=e||mxUtils.createXmlDocument(),this.objects=[]}function mxObjectCodec(e,t,n,a){for(var i in this.template=e,this.exclude=null!=t?t:[],this.idrefs=null!=n?n:[],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,t){return this.objects[e]=t},mxCodec.prototype.getObject=function(e){var t=null;return null!=e&&(null==(t=this.objects[e])&&(null==(t=this.lookup(e))&&(null!=(e=this.getElementById(e))&&(t=this.decode(e))))),t},mxCodec.prototype.lookup=function(e){return null},mxCodec.prototype.getElementById=function(e,t){return mxUtils.findNodeByAttribute(this.document.documentElement,null!=t?t:"id",e)},mxCodec.prototype.getId=function(e){var t=null;return null!=e&&(null==(t=this.reference(e))&&e instanceof mxCell&&(null==(t=e.getId())&&(0==(t=mxCellPath.create(e)).length&&(t="root")))),t},mxCodec.prototype.reference=function(e){return null},mxCodec.prototype.encode=function(e){var t=null;if(null!=e&&null!=e.constructor){var n=mxCodecRegistry.getCodec(e.constructor);null!=n?t=n.encode(this,e):mxUtils.isNode(e)?t=mxClient.IS_IE?e.cloneNode(!0):this.document.importNode(e,!0):mxLog.warn("mxCodec.encode: No codec for "+mxUtils.getFunctionName(e.constructor))}return t},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,t,n){if(t.appendChild(this.encode(e)),null==n||n){n=e.getChildCount();for(var a=0;a<n;a++)this.encodeCell(e.getChildAt(a),t)}},mxCodec.prototype.isCellCodec=function(e){return null!=e&&"function"==typeof e.isCellCodec&&e.isCellCodec()},mxCodec.prototype.decodeCell=function(e,t){t=null==t||t;var n=null;if(null!=e&&e.nodeType==mxConstants.NODETYPE_ELEMENT){if(n=mxCodecRegistry.getCodec(e.nodeName),!this.isCellCodec(n))for(var a=e.firstChild;null!=a&&!this.isCellCodec(n);)n=mxCodecRegistry.getCodec(a.nodeName),a=a.nextSibling;this.isCellCodec(n)||(n=mxCodecRegistry.getCodec(mxCell)),n=n.decode(this,e),t&&this.insertIntoGraph(n)}return n},mxCodec.prototype.insertIntoGraph=function(e){var t=e.parent,n=e.getTerminal(!0),a=e.getTerminal(!1);e.setTerminal(null,!1),e.setTerminal(null,!0),(e.parent=null)!=t&&t.insert(e),null!=n&&n.insertEdge(e,!0),null!=a&&a.insertEdge(e,!1)},mxCodec.prototype.setAttribute=function(e,t,n){null!=t&&null!=n&&e.setAttribute(t,n)},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 t=this.reverse[e];null!=t&&(e=t)}return e},mxObjectCodec.prototype.getAttributeName=function(e){if(null!=e){var t=this.mapping[e];null!=t&&(e=t)}return e},mxObjectCodec.prototype.isExcluded=function(e,t,n,a){return t==mxObjectIdentity.FIELD_NAME||0<=mxUtils.indexOf(this.exclude,t)},mxObjectCodec.prototype.isReference=function(e,t,n,a){return 0<=mxUtils.indexOf(this.idrefs,t)},mxObjectCodec.prototype.encode=function(e,t){var n=e.document.createElement(this.getName());return t=this.beforeEncode(e,t,n),this.encodeObject(e,t,n),this.afterEncode(e,t,n)},mxObjectCodec.prototype.encodeObject=function(e,t,n){for(var a in e.setAttribute(n,"id",e.getId(t)),t){var i=a,s=t[i];null!=s&&!this.isExcluded(t,i,s,!0)&&(mxUtils.isNumeric(i)&&(i=null),this.encodeValue(e,t,i,s,n))}},mxObjectCodec.prototype.encodeValue=function(e,t,n,a,i){if(null!=a){if(this.isReference(t,n,a,!0)){var s=e.getId(a);if(null==s)return void mxLog.warn("mxObjectCodec.encode: No ID for "+this.getName()+"."+n+"="+a);a=s}s=this.template[n],(null==n||e.encodeDefaults||s!=a)&&(n=this.getAttributeName(n),this.writeAttribute(e,t,n,a,i))}},mxObjectCodec.prototype.writeAttribute=function(e,t,n,a,i){"object"!=typeof a?this.writePrimitiveAttribute(e,t,n,a,i):this.writeComplexAttribute(e,t,n,a,i)},mxObjectCodec.prototype.writePrimitiveAttribute=function(e,t,n,a,i){a=this.convertValueToXml(a),null==n?(t=e.document.createElement("add"),"function"==typeof a?t.appendChild(e.document.createTextNode(a)):e.setAttribute(t,"value",a),i.appendChild(t)):"function"!=typeof a&&e.setAttribute(i,n,a)},mxObjectCodec.prototype.writeComplexAttribute=function(e,t,n,a,i){null!=(e=e.encode(a))?(null!=n&&e.setAttribute("as",n),i.appendChild(e)):mxLog.warn("mxObjectCodec.encode: No node for "+this.getName()+"."+n+": "+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,t,n){return t},mxObjectCodec.prototype.afterEncode=function(e,t,n){return n},mxObjectCodec.prototype.decode=function(e,t,n){var a=t.getAttribute("id"),i=e.objects[a];return null==i&&(i=n||this.cloneTemplate(),null!=a&&e.putObject(a,i)),t=this.beforeDecode(e,t,i),this.decodeNode(e,t,i),this.afterDecode(e,t,i)},mxObjectCodec.prototype.decodeNode=function(e,t,n){null!=t&&(this.decodeAttributes(e,t,n),this.decodeChildren(e,t,n))},mxObjectCodec.prototype.decodeAttributes=function(e,t,n){if(null!=(t=t.attributes))for(var a=0;a<t.length;a++)this.decodeAttribute(e,t[a],n)},mxObjectCodec.prototype.decodeAttribute=function(e,t,n){var a=t.nodeName;if("as"!=a&&"id"!=a){t="value"==a?t.nodeValue:this.convertValueFromXml(t.nodeValue);var i=this.getFieldName(a);if(this.isReference(n,i,t,!1)){if(null==(e=e.getObject(t)))return void mxLog.warn("mxObjectCodec.decode: No object for "+this.getName()+"."+a+"="+t);t=e}this.isExcluded(n,a,t,!1)||(n[a]=t)}},mxObjectCodec.prototype.decodeChildren=function(e,t,n){for(t=t.firstChild;null!=t;){var a=t.nextSibling;t.nodeType==mxConstants.NODETYPE_ELEMENT&&!this.processInclude(e,t,n)&&this.decodeChild(e,t,n),t=a}},mxObjectCodec.prototype.decodeChild=function(e,t,n){var a=this.getFieldName(t.getAttribute("as"));if(null==a||!this.isExcluded(n,a,t,!1)){var i=this.getFieldTemplate(n,a,t),s=null;"add"==t.nodeName?null==(s=t.getAttribute("value"))&&(s=mxUtils.eval(mxUtils.getTextContent(t))):s=e.decode(t,i),this.addObjectValue(n,a,s,i)}},mxObjectCodec.prototype.getFieldTemplate=function(e,t,n){return(e=e[t])instanceof Array&&0<e.length&&(e=null),e},mxObjectCodec.prototype.addObjectValue=function(e,t,n,a){null!=n&&n!=a&&(null!=t&&0<t.length?e[t]=n:e.push(n))},mxObjectCodec.prototype.processInclude=function(e,t,n){if("include"!=t.nodeName)return!1;if(null!=(t=t.getAttribute("name")))try{var a=mxUtils.load(t).getDocumentElement();null!=a&&e.decode(a,n)}catch(e){}return!0},mxObjectCodec.prototype.beforeDecode=function(e,t,n){return t},mxObjectCodec.prototype.afterDecode=function(e,t,n){return n},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,t,n,a){return mxObjectCodec.prototype.isExcluded.apply(this,arguments)||a&&"value"==t&&n.nodeType==mxConstants.NODETYPE_ELEMENT},e.afterEncode=function(e,t,n){if(null!=t.value&&t.value.nodeType==mxConstants.NODETYPE_ELEMENT){var a=n;(n=mxClient.IS_IE?t.value.cloneNode(!0):e.document.importNode(t.value,!0)).appendChild(a),e=a.getAttribute("id"),n.setAttribute("id",e),a.removeAttribute("id")}return n},e.beforeDecode=function(e,t,n){var a=t,i=this.getName();if(t.nodeName!=i?(null!=(a=t.getElementsByTagName(i)[0])&&a.parentNode==t?(mxUtils.removeWhitespace(a,!0),mxUtils.removeWhitespace(a,!1),a.parentNode.removeChild(a)):a=null,n.value=t.cloneNode(!0),null!=(t=n.value.getAttribute("id"))&&(n.setId(t),n.value.removeAttribute("id"))):n.setId(t.getAttribute("id")),null!=a)for(t=0;t<this.idrefs.length;t++){i=this.idrefs[t];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))),n[i]=o}}return a},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxGraphModel);return e.encodeObject=function(e,t,n){var a=e.document.createElement("root");e.encodeCell(t.getRoot(),a),n.appendChild(a)},e.decodeChild=function(e,t,n){"root"==t.nodeName?this.decodeRoot(e,t,n):mxObjectCodec.prototype.decodeChild.apply(this,arguments)},e.decodeRoot=function(e,t,n){var a=null;for(t=t.firstChild;null!=t;){var i=e.decodeCell(t);null!=i&&null==i.getParent()&&(a=i),t=t.nextSibling}null!=a&&n.setRoot(a)},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxRootChange,["model","previous","root"]);return e.afterEncode=function(e,t,n){return e.encodeCell(t.root,n),n},e.beforeDecode=function(e,t,n){if(null!=t.firstChild&&t.firstChild.nodeType==mxConstants.NODETYPE_ELEMENT){var a=(t=t.cloneNode(!0)).firstChild;for(n.root=e.decodeCell(a,!1),n=a.nextSibling,a.parentNode.removeChild(a),a=n;null!=a;)n=a.nextSibling,e.decodeCell(a),a.parentNode.removeChild(a),a=n}return t},e.afterDecode=function(e,t,n){return n.previous=n.root,n},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxChildChange,["model","child","previousIndex"],["parent","previous"]);return e.isReference=function(e,t,n,a){return!("child"!=t||null==e.previous&&a)||0<=mxUtils.indexOf(this.idrefs,t)},e.afterEncode=function(e,t,n){return this.isReference(t,"child",t.child,!0)?n.setAttribute("child",e.getId(t.child)):e.encodeCell(t.child,n),n},e.beforeDecode=function(e,t,n){if(null!=t.firstChild&&t.firstChild.nodeType==mxConstants.NODETYPE_ELEMENT){var a=(t=t.cloneNode(!0)).firstChild;for(n.child=e.decodeCell(a,!1),n=a.nextSibling,a.parentNode.removeChild(a),a=n;null!=a;){if(n=a.nextSibling,a.nodeType==mxConstants.NODETYPE_ELEMENT){var i=a.getAttribute("id");null==e.lookup(i)&&e.decodeCell(a)}a.parentNode.removeChild(a),a=n}}else a=t.getAttribute("child"),n.child=e.getObject(a);return t},e.afterDecode=function(e,t,n){return n.child.parent=n.previous,n.previous=n.parent,n.previousIndex=n.index,n},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxTerminalChange,["model","previous"],["cell","terminal"]);return e.afterDecode=function(e,t,n){return n.previous=n.terminal,n},e}());var mxGenericChangeCodec=function(e,a){var t=new mxObjectCodec(e,["model","previous"],["cell"]);return t.afterDecode=function(e,t,n){return mxUtils.isNode(n.cell)&&(n.cell=e.decodeCell(n.cell,!1)),n.previous=n[a],n},t};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,t){return this.encodeCell(e,t,t.graph.getModel().getRoot())},e.encodeCell=function(e,t,n){var a=t.graph.getModel(),i=t.getState(n),s=a.getParent(n);if(null==s||null!=i){var o=a.getChildCount(n),r=t.graph.getCellGeometry(n),l=null;if(s==a.getRoot()?l="layer":null==s?l="graph":a.isEdge(n)?l="edge":0<o&&null!=r?l="group":a.isVertex(n)&&(l="vertex"),null!=l){var d=e.document.createElement(l);if(null!=t.graph.getLabel(n)&&(d.setAttribute("label",t.graph.getLabel(n)),t.graph.isHtmlLabel(n)&&d.setAttribute("html",!0)),null==s){var c=t.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",t.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,t,a.getChildAt(n,c)))&&d.appendChild(i)}}return d},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxStylesheet);return e.encode=function(e,t){var n,a=e.document.createElement(this.getName());for(n in t.styles){var i=t.styles[n],s=e.document.createElement("add");if(null!=n){for(var o in s.setAttribute("as",n),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,t){var n=typeof t;return"function"==n?t=mxStyleRegistry.getName(style[j]):"object"==n&&(t=null),t},e.decode=function(e,t,n){n=n||new this.template.constructor;var a=t.getAttribute("id");for(null!=a&&(e.objects[a]=n),t=t.firstChild;null!=t;){if(!this.processInclude(e,t,n)&&"add"==t.nodeName&&null!=(a=t.getAttribute("as"))){var i=t.getAttribute("extend"),s=null!=i?mxUtils.clone(n.styles[i]):null;for(null==s&&(null!=i&&mxLog.warn("mxStylesheetCodec.decode: stylesheet "+i+" not found to extend"),s={}),i=t.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}n.putCellStyle(a,s)}t=t.nextSibling}return n},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxDefaultKeyHandler);return e.encode=function(e,t){return null},e.decode=function(e,t,n){if(null!=n)for(t=t.firstChild;null!=t;){if(!this.processInclude(e,t,n)&&"add"==t.nodeName){var a=t.getAttribute("as"),i=t.getAttribute("action"),s=t.getAttribute("control");n.bindAction(a,i,s)}t=t.nextSibling}return n},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxDefaultToolbar);return e.encode=function(e,t){return null},e.decode=function(e,t,n){if(null!=n){var a=n.editor;for(t=t.firstChild;null!=t;){if(t.nodeType==mxConstants.NODETYPE_ELEMENT&&!this.processInclude(e,t,n))if("separator"==t.nodeName)n.addSeparator();else if("br"==t.nodeName)n.toolbar.addBreak();else if("hr"==t.nodeName)n.toolbar.addLine();else if("add"==t.nodeName){var i=t.getAttribute("as"),s=(i=mxResources.get(i)||i,t.getAttribute("icon")),o=t.getAttribute("pressedIcon"),r=t.getAttribute("action"),l=t.getAttribute("mode"),d=t.getAttribute("template"),c="0"!=t.getAttribute("toggle"),m=mxUtils.getTextContent(t),u=null;if(null!=r)u=n.addItem(i,s,r,o);else if(null!=l){var p=mxUtils.eval(m);u=n.addMode(i,s,l,o,p)}else if(null!=d||null!=m&&0<m.length)u=a.templates[d],d=t.getAttribute("style"),null!=u&&null!=d&&(u=u.clone()).setStyle(d),(d=null)!=m&&0<m.length&&(d=mxUtils.eval(m)),u=n.addPrototype(i,s,u,o,d,c);else if(0<(o=mxUtils.getChildNodes(t)).length)if(null==s)for(d=n.addActionCombo(i),i=0;i<o.length;i++)"separator"==(c=o[i]).nodeName?n.addOption(d,"---"):"add"==c.nodeName&&(s=c.getAttribute("as"),c=c.getAttribute("action"),n.addActionOption(d,s,c));else{var g=null,v=n.addPrototype(i,s,function(){if(null==(e=a.templates[g.value]))return mxLog.warn("Template "+e+" not found"),null;var e=e.clone(),t=g.options[g.selectedIndex].cellStyle;return null!=t&&e.setStyle(t),e},null,null,c);g=n.addCombo();for(mxEvent.addListener(g,"change",function(){n.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)}),n.toolbar.noReset=!1}),i=0;i<o.length;i++)"separator"==(c=o[i]).nodeName?n.addOption(g,"---"):"add"==c.nodeName&&(s=c.getAttribute("as"),m=c.getAttribute("template"),n.addOption(g,s,m||d).cellStyle=c.getAttribute("style"))}null!=u&&(null!=(d=t.getAttribute("id"))&&0<d.length&&u.setAttribute("id",d))}t=t.nextSibling}}return n},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxDefaultPopupMenu);return e.encode=function(e,t){return null},e.decode=function(e,t,n){var a=t.getElementsByTagName("include")[0];return null!=a?this.processInclude(e,a,n):null!=n&&(n.config=t),n},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxEditor,"modified lastSnapshot ignoredChanges undoManager graphContainer toolbarContainer".split(" "));return e.afterDecode=function(e,t,n){return null!=(e=t.getAttribute("defaultEdge"))&&(t.removeAttribute("defaultEdge"),n.defaultEdge=n.templates[e]),null!=(e=t.getAttribute("defaultGroup"))&&(t.removeAttribute("defaultGroup"),n.defaultGroup=n.templates[e]),n},e.decodeChild=function(e,t,n){if("Array"==t.nodeName){if("templates"==t.getAttribute("as"))return void this.decodeTemplates(e,t,n)}else if("ui"==t.nodeName)return void this.decodeUi(e,t,n);mxObjectCodec.prototype.decodeChild.apply(this,arguments)},e.decodeUi=function(e,t,n){for(e=t.firstChild;null!=e;){if("add"==e.nodeName){t=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(t)||t,s,a,o,r,l,!1,!0).setVisible(!0)}"graph"==t?n.setGraphContainer(s):"toolbar"==t?n.setToolbarContainer(s):"title"==t?n.setTitleContainer(s):"status"==t?n.setStatusContainer(s):"map"==t&&n.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,t,n){null==n.templates&&(n.templates=[]),t=mxUtils.getChildNodes(t);for(var a=0;a<t.length;a++){for(var i=t[a].getAttribute("as"),s=t[a].firstChild;null!=s&&1!=s.nodeType;)s=s.nextSibling;null!=s&&(n.templates[i]=e.decodeCell(s))}},e}()),EditorUi=function(e,t,n){this.projectDesignController=e,this.editor=t||new Editor,this.container=n||document.body;var a=t.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("+t.gridImage+")",a.container.style.backgroundPosition="-1px -1px",a.container.focus();var o=a.fireMouseEvent;a.fireMouseEvent=function(e,t,n){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","tts","ispeechtts","awspolly","getdigits","getsecretdigits","lumenvoxtts","sestektts"],[[1,"n"],[1,1],[1,"n"],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,"n"],[1,"n"],[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"]]),this.createMultiplicities(a.multiplicities,["record"],[[1,1]],[[1,"n"]]),this.createMultiplicities(a.multiplicities,["database","ispeechasr","sendSMS","sendMail","sendFax","googleasr","lumenvoxasr","tildeasr","dialogflow","awslex","sesteknda","sestekasr"],[[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"]]),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,n){var t=new mxEventObject(mxEvent.DOUBLE_CLICK,"event",e,"cell",n);this.fireEvent(t),mxEvent.isConsumed(e)||t.isConsumed()||(this.getModel().isEdge(n)?0<=["background","gotoif","gotoiftime","menu","getdigits","getsecretdigits","vswitch","login","pause","unpause","logout"].indexOf(n.source.value.tagName)&&this.startEditingAtCell(n):this.getModel().isVertex(n)&&i.projectDesignController.openDialog(n.getValue(),function(e){for(var t=0;t<e.length;t+=1)n.setAttribute(e[t].name,e[t].value);a.refresh(n)}),t.consume())},a.panningHandler.autoExpand=!0,a.panningHandler.factoryMethod=mxUtils.bind(this,function(e,t,n){this.isEditingEnabled()&&this.menus.createPopupMenu(e,t,n)}),t.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(t):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"),t=function(){e.setEnabled(!mxClipboard.isEmpty())},n=mxClipboard.cut;mxClipboard.cut=function(){n.apply(this,arguments),t()};var a=mxClipboard.copy;mxClipboard.copy=function(){a.apply(this,arguments),t()}},EditorUi.prototype.isEditingEnabled=function(){return!!CRUD_PERMISSIONS.canEdit},EditorUi.prototype.exportXML=function(e){var t=window.document.createElement("a");t.href="data:attachment/text;charset=utf-8,"+encodeURIComponent(e),t.download=this.editor.filename+".xml",t.target="_self",t.click()},EditorUi.prototype.open=function(){try{null!=window.opener&&null!=window.opener.openFile&&window.opener.openFile.setConsumer(mxUtils.bind(this,function(e,t){try{var n=mxUtils.parseXml(e);this.editor.setGraphXml(n.documentElement),this.editor.modified=!1,this.editor.undoManager.clear(),null!=t&&(this.editor.filename=t)}catch(e){mxUtils.alert(mxResources.get("invalidOrMissingFile")+": "+e.message)}}))}catch(e){}},EditorUi.prototype.openString=function(e,t,n){try{var a=mxUtils.parseXml(e);this.editor.setGraphXml(a.documentElement),this.editor.modified=!1,this.editor.undoManager.clear(),null!=t&&(this.editor.filename=t),null!=n&&(this.editor.data=n)}catch(e){mxUtils.alert(mxResources.get("invalidOrMissingFile")+": "+e.message)}},EditorUi.prototype.validate=function(e,t){for(var n=this.editor.graph,a=(e=null!=e?e:n.model.getRoot(),t=null!=t?t:{},!0),i=n.model.getChildCount(e),s=0;s<i;s++){var o=n.model.getChildAt(e,s),r=t;n.isValidRoot(o)&&(r={}),null!=(r=this.validate(o,r))?n.setCellWarning(o,r.replace(/\n/g,"<br>")):n.setCellWarning(o,null),a=a&&null==r}if(i="",n.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="-1"!==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"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";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"}if(n.model.isEdge(e))switch(n.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 n.isCellCollapsed(e)&&!a&&(i+=(mxResources.get(n.containsValidationErrorsResource)||n.containsValidationErrorsResource)+"\n"),i=n.model.isEdge(e)?i+(n.getEdgeValidationError(e,n.model.getTerminal(e,!0),n.model.getTerminal(e,!1))||""):i+(n.getCellValidationError(e)||""),null!=(s=n.validateCell(e,t))&&(i+=s),null==n.model.getParent(e)&&n.view.validate(),0<i.length||!a?i:null},EditorUi.prototype.validateBlock=function(t){var n=this.editor.graph,e=n.getDefaultParent(),a=0;return e.children.forEach(function(e){n.model.isVertex(e)&&e.value.nodeName==t&&a++}),!(1<a)},EditorUi.prototype.getUrl=function(e){var t=null!=e?e:window.location.pathname,n=0<t.indexOf("?")?1:0;for(var a in urlParams)t+=0==n?"?":"&",t+=a+"="+urlParams[a],n++;return t},EditorUi.prototype.addUndoListener=function(){var e=this.actions.get("undo"),t=this.actions.get("redo"),n=this.editor.undoManager,a=function(){e.setEnabled(n.canUndo()),t.setEnabled(n.canRedo())};n.addListener(mxEvent.ADD,a),n.addListener(mxEvent.UNDO,a),n.addListener(mxEvent.REDO,a),n.addListener(mxEvent.CLEAR,a),a()},EditorUi.prototype.addSelectionListener=function(){var e=mxUtils.bind(this,function(){var e=this.editor.graph,t=!e.isSelectionEmpty(),n=!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)&&(n=!0),a&&n)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(t);this.actions.get("curved").setEnabled(a),this.actions.get("rotation").setEnabled(n),this.actions.get("wordWrap").setEnabled(n),this.actions.get("group").setEnabled(1<e.getSelectionCount()),this.actions.get("ungroup").setEnabled(1==e.getSelectionCount()&&0<e.getModel().getChildCount(e.getSelectionCell()));var l=n&&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(t);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(n||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),t=this.container.clientWidth+390,n=this.container.clientHeight+190;this.container==document.body&&(t=document.body.clientWidth||document.documentElement.clientWidth,n=e&&document.body.clientHeight||document.documentElement.clientHeight);var a=Math.max(0,Math.min(this.hsplitPosition,t-this.splitSize-20)),i=Math.max(0,Math.min(this.vsplitPosition,n-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=t+"px",this.toolbarContainer.style.width=this.menubarContainer.style.width;var o=n-i-this.splitSize-this.menubarHeight-this.toolbarHeight;this.sidebarContainer.style.height=o+"px",this.diagramContainer.style.width=t-a-this.splitSize+"px";var r=n-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 t=document.createElement("div");return t.className=e,t},EditorUi.prototype.createHeader=function(e){return document.createElement(e)},EditorUi.prototype.createForm=function(e){var t=document.createElement("form");return t.className=e,t},EditorUi.prototype.addSplitHandler=function(t,n,a,i){var s=null,o=null;function r(e){if(null!=s){var t=new mxPoint(mxEvent.getClientX(e),mxEvent.getClientY(e));i(Math.max(0,o+(n?t.x-s.x:s.y-t.y)-a)),mxEvent.consume(e)}}function e(e){r(e),o=s=null}mxEvent.addGestureListeners(t,function(e){s=new mxPoint(mxEvent.getClientX(e),mxEvent.getClientY(e)),o=parseInt(n?t.style.left:t.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,t,n){var a=this.editor.graph,i=a.getSelectionCell();t=null!=this.animate?this.animate:t,a.getModel().beginUpdate();try{e.execute(a.getDefaultParent(),i)}catch(e){throw e}finally{if(t&&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 t(e){if(!a.isSelectionEmpty()){var t=0,n=0;37==e?t=-1:38==e?n=-1:39==e?t=1:40==e&&(n=1),a.moveCells(a.getSelectionCells(),t,n),a.scrollCellToVisible(a.getSelectionCell())}}o.isControlDown=function(e){return mxEvent.isControlDown(e)||mxClient.IS_MAC&&e.metaKey};var n=mxUtils.bind(this,function(e,t,n,a){var i=this.actions.get(n);if(null!=i){var s=function(){i.enabled&&i.funct()};t?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(){t(37)}),o.bindKey(38,function(){t(38)}),o.bindKey(39,function(){t(39)}),o.bindKey(40,function(){t(40)}),o.bindKey(113,function(){a.startEditingAtCell()}),n(46,!1,"delete"),n(82,!0,"tilt"),n(83,!0,"save"),n(83,!0,"saveAs",!0),n(107,!1,"zoomIn"),n(109,!1,"zoomOut"),n(65,!0,"selectAll"),n(86,!0,"selectVertices",!0),n(69,!0,"selectEdges",!0),n(69,!0,"export"),n(66,!0,"toBack"),n(70,!0,"toFront"),n(68,!0,"duplicate"),n(90,!0,"undo"),n(89,!0,"redo"),n(88,!0,"cut"),n(67,!0,"copy"),n(81,!0,"connect"),n(86,!0,"paste"),n(71,!0,"group"),n(71,!0,"grid",!0),n(85,!0,"ungroup"),n(112,!1,"about"),n(80,!0,"publish",!0),o},EditorUi.prototype.createMultiplicities=function(e,t,n,a){for(var i=0;i<t.length;i++)e.push(new mxMultiplicity(!0,t[i],null,null,n[i][0],n[i][1],null,mxResources.get(t[i])+mxResources.get("musthave")+n[i][0]+mxResources.get("outgoingedge"),null)),e.push(new mxMultiplicity(!1,t[i],null,null,a[i][0],a[i][1],null,mxResources.get(t[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,t){this.editorUi=e,this.container=t,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 t=mxEvent.getSource(e);null!=t;){if(t==this.currentElt)return;t=t.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(t,"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,t,n,a,i){mxEventSource.call(this),this.label=e,this.funct=t,this.enabled=null==n||n,this.iconCls=a,this.shortcut=i}function Menubar(e,t){this.editorUi=e,this.container=t,mxEvent.addGestureListeners(document,mxUtils.bind(this,function(e){this.hideMenu()}))}function Menu(e,t){mxEventSource.call(this),this.funct=e,this.enabled=null==t||t}function Toolbar(e,t){this.editorUi=e,this.container=t,this.init(),mxEvent.addGestureListeners(document,mxUtils.bind(this,function(e){this.hideMenu()}))}function createCheckbox(e){var t=document.createElement("input");return t.setAttribute("type","checkbox"),e&&t.setAttribute("checked",!0),t}function createDropdownFromApi(e,n,a,i,t,s,o,r){var l=new XMLHttpRequest;l.open("GET",e,!1),l.setRequestHeader("Authorization","Bearer "+t.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(t){r&&t[a]==r||((m=document.createElement("option")).text=t[a],s&&o?(m.value=o,s.forEach(function(e){m.value=m.value.replace("%"+e+"%",t[e])}),m.selected=m.value==n):(m.value=t[i],m.selected=t[i]==n),c.appendChild(m))}),c.className="form-control select2",c}function createDropdownWithOptgroupFromApi(e,t,n,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[n],d.value=e[a],d.selected=e[a]==t,u.appendChild(d)}),l.appendChild(u)}return l.className="form-control select2",l}function createGroupedDropdownFromApi(e,t,n,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[n].toUpperCase(),d.value=e[a],d.selected=e[a]==t,l.appendChild(d),e[s].forEach(function(e){(d=document.createElement("option")).className="select-group-son",d.text="-"+_.capitalize(e[n]),d.value=e[a],d.selected=e[a]==t,l.appendChild(d)})}),l.className="form-control select2",l}function createDropdownFromArray(e,t){var n=document.createElement("select");for(var a in e){var i=document.createElement("option");i.text=e[a],i.value=a,(0<t||""!=t)&&(i.selected=t===a),n.appendChild(i)}return n.className="form-control select2",n}function createDropdownFromTigerDialList(e){var t=document.createElement("select"),n=[],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)n[s[o].id]=s[o].name}}}catch(e){console.log(e)}for(var r in n){var l=document.createElement("option");l.text=n[r],l.value=r,(0<e||""!=e)&&(l.selected=e===r),t.appendChild(l)}return t.className="form-control select2",t}function Dialog(e,t,n,a,i,s,o){var r=0;mxClient.IS_IE&&9!=document.documentMode&&(r=60),n+=r,a+=r;Math.max(0,Math.round((document.body.scrollWidth-n)/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(t),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(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("import")+" XML");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");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 t=e.target.files[0];if(console.log(t),t)if("text/xml"===t.type){var n=new FileReader;n.onload=function(e){var t=e.target.result;mxUtils.write(d,t)},n.readAsText(t)}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 t=mxUtils.parseXml(d.value);n.editor.setGraphXml(t.documentElement),n.hideDialog()}));m.className="btn blue";var u=mxUtils.button(mxResources.get("cancel"),function(){n.hideDialog()});u.className="btn default",i.appendChild(m),i.appendChild(u),e.appendChild(t),e.appendChild(a),e.appendChild(i),this.container=e}function AboutDialog(e){var t=e.createDiv("modal-content"),n=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",n.appendChild(o),n.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),t.appendChild(n),t.appendChild(a),t.appendChild(i),this.container=t}function SaveDialog(e){var t=e.createDiv("modal-content"),n=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",n.appendChild(o),n.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),t.appendChild(n),t.appendChild(a),t.appendChild(i),this.container=t}function NewDialog(e){var t=e.createDiv("modal-content"),n=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",n.appendChild(o),n.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),t.appendChild(n),t.appendChild(a),t.appendChild(i),this.container=t}function DescriptionDialog(e){console.log(e.editor.data);var t=e.createDiv("modal-content"),n=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",n.appendChild(o),n.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),t.appendChild(n),t.appendChild(a),t.appendChild(i),this.container=t}function VariableDialog(e){var t=e.createDiv("modal-content"),n=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",n.appendChild(o),n.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),t.appendChild(n),t.appendChild(a),t.appendChild(i),this.container=t}function OpenDialog(e){var t=e.createDiv("modal-content"),n=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",n.appendChild(o),n.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),t.appendChild(n),t.appendChild(a),t.appendChild(i),this.container=t}function RenameDialog(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("rename"));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-4"),d=n.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=n.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 t=new XMLHttpRequest;t.open("PUT",SAVE_URL+n.editor.data.id,!0),t.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),t.setRequestHeader("Authorization","Bearer "+n.editor.data.token),t.send("name="+u.value),t.onload=function(e){200===t.status?(n.editor.setStatus("Project successfully renamed"),n.editor.filename=u.value):(console.log(t.response),n.editor.setStatus(JSON.parse(t.response).errors[0].message))},t.onerror=function(e){mxUtils.alert(t.statusText)},n.hideDialog()});p.className="btn blue";var g=mxUtils.button(mxResources.get("cancel"),function(){n.hideDialog()});g.className="btn default",i.appendChild(p),i.appendChild(g),e.appendChild(t),e.appendChild(a),e.appendChild(i),this.container=e}function EditFileDialog(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("edit"));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");if(d.style.width="100%",d.style.height="374px",d.value=mxUtils.getPrettyXml(t.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 t=e.dataTransfer.files[0],n=new FileReader;n.onload=function(e){d.value=e.target.result},n.readAsText(t)}},!1)}l.appendChild(d),r.appendChild(l),a.appendChild(r);var c=mxUtils.button(mxResources.get("save"),function(){var e=mxUtils.parseXml(d.value);t.editor.setGraphXml(e.documentElement),t.hideDialog()});c.className="btn blue";var m=mxUtils.button(mxResources.get("cancel"),function(){t.hideDialog()});m.className="btn default",i.appendChild(c),i.appendChild(m),e.appendChild(n),e.appendChild(a),e.appendChild(i),this.container=e}function ExportDialog(t){var e=t.createDiv("modal-content"),n=t.createDiv("modal-header"),a=t.createDiv("modal-body form"),i=t.createDiv("modal-footer"),s=t.createHeader("h4");mxUtils.write(s,mxResources.get("export")+" XML");var o=mxUtils.button("",function(){t.hideDialog()});o.className="close",n.appendChild(o),n.appendChild(s);var r=t.createDiv("form-horizontal form-row-seperated"),l=t.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",t.editor.getOrCreateFilename()),c.className="form-control";var m=t.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){t.save(!1);encodeURIComponent(mxUtils.getXml(t.editor.getGraphXml()));new mxXmlRequest(SAVE_URL+t.editor.data.id+"/download","filename="+c.value,"GET").simulate(document,"_blank"),t.hideDialog()}));u.className="btn blue";var p=mxUtils.button(mxResources.get("cancel"),function(){t.hideDialog()});p.className="btn default",i.appendChild(u),i.appendChild(p),e.appendChild(n),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"),t=i.createDiv("md-toolbar"),n=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",t.appendChild(l),t.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 E=i.createDiv("p");E.className="help-block",mxUtils.write(E,mxResources.get("help_"+p)),b.appendChild(E)}h.appendChild(b),c.appendChild(h)}n.appendChild(c);var A=mxUtils.button(mxResources.get("save"),mxUtils.bind(this,function(e){for(var t=0;t<s.value.attributes.length;t++){var n="_"+s.value.attributes[t].name,a=s.value.attributes[t].name;s.setAttribute(a,document.getElementById(n).value)}o.refresh(s),i.hideDialog()}));A.className="btn blue";var y=mxUtils.button(mxResources.get("cancel"),function(){i.hideDialog()});y.className="btn default",a.appendChild(A),a.appendChild(y),e.appendChild(t),e.appendChild(n),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 t=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 n=e.getAttribute("pageScale");this.graph.pageScale=null!=n?n: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),t.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,t=this.outline;if(null!=e.container&&null!=t.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="",t.outline.container.style.backgroundColor=e.container.style.backgroundColor,t.outline.pageVisible==e.pageVisible&&t.outline.pageScale==e.pageScale||(t.outline.pageScale=e.pageScale,t.outline.pageVisible=e.pageVisible,t.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 n=mxClient.IS_IE&&9<=document.documentMode?"url("+this.transparentImage+")":"none";e.container.style.backgroundImage=!e.pageVisible&&e.isGridEnabled()?"url("+this.gridImage+")":n,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 n=e.apply(this,arguments);return n.intersects=mxUtils.bind(this,function(e,t){return!!this.isConnecting()||mxCellMarker.prototype.intersects.apply(n,arguments)}),n},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(),t=0<e.width?e.x/this.scale-this.translate.x:0,n=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,t)/r),c=Math.floor(Math.min(0,n)/l),m=Math.ceil(Math.max(1,t+a)/r)-d,u=Math.ceil(Math.max(1,n+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 n=mxGraph.prototype.panGraph;mxGraph.prototype.panGraph=function(e,t){n.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=t+"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 t=new mxRectangle(0,0,1,1);this.backgroundImage=new mxImageShape(t,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){t=this.getBackgroundPageBounds();null==this.backgroundPageShape?(this.backgroundPageShape=this.createBackgroundPageShape(t),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=t,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,t,n){var a=this.view.scale,i=this.view.translate,s=this.pageFormat,o=a*this.pageScale,r=this.view.getBackgroundPageBounds();t=r.width,n=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(t/l.width)-1:0,c=e?Math.ceil(n/l.height)-1:0,m=r.x+t,u=r.y+n;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,t,n){for(var a=0;a<t.length;a++)if(this.graph.getModel().isVertex(t[a])){var i=this.graph.getCellGeometry(t[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,t,n,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 t=this.graph.getModel(),n=t.getParent(this.graph.getSelectionCell()),a=o.apply(this,arguments),i=t.getParent(a);if(null==n||n!=a&&n!=i)for(;!this.graph.isCellSelected(a)&&!this.graph.isCellSelected(i)&&t.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 t=l.apply(this,arguments),n=this.graph.getModel(),a=n.getParent(this.graph.getSelectionCell()),i=n.getParent(e);return(null==a||a!=e&&a!=i)&&(this.graph.isCellSelected(e)||!n.isVertex(i)||this.graph.isValidRoot(i)||(t=!0)),t},mxGraphHandler.prototype.selectDelayed=function(e){var t=e.getCell();null==t&&(t=this.cell);for(var n=this.graph.getModel(),a=n.getParent(t);this.graph.isCellSelected(t)&&n.isVertex(a)&&!this.graph.isValidRoot(a);)t=a,a=n.getParent(t);this.graph.selectCellForEvent(t,e.getEvent())},mxPanningHandler.prototype.getCellForPopupEvent=function(e){for(var t=e.getCell(),n=this.graph.getModel(),a=n.getParent(t);n.isVertex(a)&&!this.graph.isValidRoot(a);)this.graph.isCellSelected(a)&&(t=a),a=n.getParent(a);return t}},Editor.prototype.createUndoManager=function(){var s=this.graph,n=new mxUndoManager,e=function(e,t){n.undoableEditHappened(t.getProperty("edit"))};s.getModel().addListener(mxEvent.UNDO,e),s.getView().addListener(mxEvent.UNDO,e);var t=function(e,t){for(var n=s.getSelectionCellsForChanges(t.getProperty("edit").changes),a=[],i=1;i<n.length;i++)null!=s.view.getState(n[i])&&a.push(n[i]);s.setSelectionCells(a)};return n.addListener(mxEvent.UNDO,t),n.addListener(mxEvent.REDO,t),n},Editor.prototype.initStencilRegistry=function(){mxStencilRegistry.loadStencilSet(STENCIL_PATH+"/general.xml")},mxStencilRegistry.libraries={},mxStencilRegistry.packages=[],mxStencilRegistry.getStencil=function(e){var t=mxStencilRegistry.stencils[e];if(null==t){var n=mxStencilRegistry.getBasenameForStencil(e);if(null!=n){var a=mxStencilRegistry.libraries[n];if(null!=a){if(null==mxStencilRegistry.packages[n]){mxStencilRegistry.packages[n]=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+"/"+n+".xml",null);t=mxStencilRegistry.stencils[e]}}return t},mxStencilRegistry.getBasenameForStencil=function(e){var t=e.split("."),n=null;if(0<t.length&&"mxgraph"==t[0]){n=t[1];for(var a=2;a<t.length-1;a++)n+="/"+t[a]}return n},mxStencilRegistry.loadStencilSet=function(e,t,n){n=null!=n&&n;var a=mxStencilRegistry.packages[e];if(n||null==a){var i=!1;null==a&&(a=mxUtils.load(e).getXml(),mxStencilRegistry.packages[e]=a,i=!0),mxStencilRegistry.parseStencilSet(a,t,i)}},mxStencilRegistry.parseStencilSet=function(e,t,n){n=null==n||n;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(n&&mxStencilRegistry.addStencil(s+r.toLowerCase(),new mxStencil(i)),null!=t){var l=i.getAttribute("w"),d=i.getAttribute("h");t(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,t){this.data=e,this.filename=t,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",["tts","ispeechtts","awspolly","lumenvoxtts","sestektts"],["GoogleTTS","ISpeechTTS","AWSPolly","LumenvoxTTS","SestekTTS"]),this.addImagePalette("asr","ASR",e+"/asr/","_128x128.png",["googleasr","ispeechasr","lumenvoxasr","tildeasr","sestekasr"],["GoogleASR","ISpeechASR","LumenvoxASR","TildeASR","SestekASR"]),this.addImagePalette("integrationServer",mxResources.get("integrationServer"),e+"/integration_server/","_128x128.png",["database","sendMail","sendSMS","dialogflow","awslex","sesteknda"],[mxResources.get("database"),mxResources.get("sendMail"),mxResources.get("sendSMS"),"Dialogflow","AWSLex","SestekNDA"]),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(),t=e.width+2*this.tooltipBorder+4,n=e.height+2*this.tooltipBorder;if(mxClient.IS_QUIRKS?(n+=4,this.tooltip.style.overflow="hidden"):this.tooltip.style.overflow="visible",this.tooltipImage.style.visibility="visible",this.tooltip.style.width=t+"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;n+=a,mxClient.IS_SVG?this.tooltipTitle.style.marginTop=2-a+"px":(n-=6,this.tooltipTitle.style.top=n-a+"px")}else null!=this.tooltipTitle&&null!=this.tooltipTitle.parentNode&&(this.tooltipTitle.style.display="none");this.tooltip.style.height=n+"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-n/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+n/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,t){if(null!=this.taglist&&null!=e&&0<e.length)for(var n=e.toLowerCase().replace(/[\/\,\(\)]/g," ").split(" "),a=0;a<n.length;a++)if(n[a]=n[a].replace(/\.*\d*$/,""),1<n[a].length){var i=this.taglist[n[a]];null==i&&(i={entries:[],dict:new mxDictionary},this.taglist[n[a]]=i),null==i.dict.get(t)&&(i.dict.put(t,t),i.entries.push(t))}return t},Sidebar.prototype.searchEntries=function(e,t,n,a,i){if(null!=this.taglist&&null!=e){for(var s=e.toLowerCase().split(" "),o=new mxDictionary,r=(n+1)*t,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(n*t,r),r,!0)}}else l=[];o=u,d++}var v=l.length;a(l.slice(n*t,(n+1)*t),v,!1)}else a([])},Sidebar.prototype.filterTags=function(e){if(null==e)return null;for(var t=e.split(" "),n=[],a={},i=0;i<t.length;i++)null==a[t[i]]&&(a[t[i]]="1",n.push(t[i]));return n.join(" ")},Sidebar.prototype.cloneCell=function(e,t){var n=e.clone();return null!=t&&(n.value=t),n},Sidebar.prototype.addSearchPalette=function(e){var t=document.createElement("div");t.style.visibility="hidden",this.container.appendChild(t);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 n=document.createElement("div");n.style.whiteSpace="nowrap",n.style.textOverflow="clip",n.style.paddingBottom="8px",n.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",n.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+"')",n.appendChild(s),r.appendChild(n);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 t=e.nextSibling;e!=n&&e!=l&&e.parentNode.removeChild(e),e=t}});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,t,n){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(n?(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=[t,o]},Sidebar.prototype.createTitle=function(e){var t=document.createElement("a");return t.setAttribute("href","javascript:void(0);"),t.setAttribute("title",mxResources.get("sidebarTooltip")),t.className="geTitle",mxUtils.write(t,e),t},Sidebar.prototype.createThumb=function(e,t,n,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((t-2*this.thumbBorder)/c.width,(n-2*this.thumbBorder)/c.height))/100;this.graph.view.scaleAndTranslate(m,Math.floor((t-c.width*m)/2/m-c.x),Math.floor((n-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=t+"px",u.style.height=n+"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(t,n,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(t,this.thumbWidth,this.thumbHeight,r,n,a,e,i,s);var d=new mxRectangle(0,0,i,s);if(1<t.length||t[0].vertex){var c=this.createDragSource(r,this.createDropHandler(t,!0,o,d),this.createDragPreview(i,s),t,d);this.addClickHandler(r,c,t),c.isGuidesEnabled=mxUtils.bind(this,function(){return this.editorUi.editor.graph.graphHandler.guidesEnabled})}else if(null!=t[0]&&t[0].edge){c=this.createDragSource(r,this.createDropHandler(t,!1,o,d),this.createDragPreview(i,s),t,d);this.addClickHandler(r,c,t)}return mxClient.IS_IOS||mxEvent.addGestureListeners(r,null,mxUtils.bind(this,function(e){this.showTooltip(r,t,d.width,d.height,n,a)})),r},Sidebar.prototype.createDropHandler=function(g,v,h,f){return h=null==h||h,mxUtils.bind(this,function(e,t,n,a,i){if(e.isEnabled()){if(0<(g=e.getImportableCells(g)).length){e.stopEditing();var s=null!=n&&e.isValidDropTarget(n,g,t),o=null;if(null==n||s||(n=null),!e.isCellLocked(n||e.getDefaultParent())){e.model.beginUpdate();try{if(a=Math.round(a),i=Math.round(i),v&&e.isSplitTarget(n,g,t)){var r=e.cloneCells(g);e.splitEdge(n,r,null,a-f.width/2,i-f.height/2),o=r}else 0<g.length&&(o=e.importCells(g,a,i,n));if(null!=e.layoutManager){var l=e.layoutManager.getLayout(n);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(t)}})},Sidebar.prototype.createDragPreview=function(e,t){var n=document.createElement("div");return n.style.border="1px dashed black",n.style.width=e+"px",n.style.height=t+"px",n},Sidebar.prototype.createDragSource=function(e,t,n){var a=mxUtils.makeDraggable(e,this.editorUi.editor.graph,t,n,0,0,this.editorUi.editor.graph.autoscroll,!0,!0);return a.getDropTarget=function(e,t,n){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 t=i.tolerance;if(Math.abs(s.x-mxEvent.getClientX(e))<=t&&Math.abs(s.y-mxEvent.getClientY(e))<=t){var n=i.getGridSize();a.drop(i,e,null,n,n)}}o.apply(this,arguments),s=null}},Sidebar.prototype.createVertexTemplateEntry=function(e,t,n,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,t,n,a,i,s,o)}))},Sidebar.prototype.createXmlDocument=function(e,t,n,a){var i=mxUtils.createXmlDocument().createElement(e);return i.setAttribute("label",t),n.forEach(function(e,t){i.setAttribute(e,a[t]?a[t]:"")}),i},Sidebar.prototype.createVertexTemplate=function(e,t,n,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=["","-1","60"];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","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;default:l=[],d=[]}var c=[new mxCell(this.createXmlDocument(a,i,l,d),new mxGeometry(0,0,t,n),e)];return c[0].vertex=!0,this.createVertexTemplateFromCells(c,t,n,i,s,o,r)},Sidebar.prototype.createVertexTemplateFromCells=function(e,t,n,a,i,s,o){return this.createItem(e,a,i,s,t,n,o)},Sidebar.prototype.createEdgeTemplate=function(e,t,n,a,i,s,o){var r=new mxCell(null!=a?a:"",new mxGeometry(0,0,t,n),e);return r.geometry.setTerminalPoint(new mxPoint(0,n),!0),r.geometry.setTerminalPoint(new mxPoint(t,0),!1),r.geometry.relative=!0,r.edge=!0,this.createEdgeTemplateFromCells([r],t,n,i,s,o)},Sidebar.prototype.createEdgeTemplateFromCells=function(e,t,n,a,i,s){return this.createItem(e,a,i,!0,t,n,s)},Sidebar.prototype.addPaletteFunctions=function(e,t,n,a){this.addPalette(e,t,n,mxUtils.bind(this,function(e){for(var t=0;t<a.length;t++)e.appendChild(a[t](e))}))},Sidebar.prototype.addPalette=function(e,t,n,a){var i=this.createTitle(t);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")})),n?(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(n,a,i){var s=!1;(!mxClient.IS_IE||8<=document.documentMode)&&(n.style.backgroundImage="none"==a.style.display?"url('"+this.collapsedImage+"')":"url('"+this.expandedImage+"')"),n.style.backgroundRepeat="no-repeat",n.style.backgroundPosition="0% 50%",mxEvent.addListener(n,"click",mxUtils.bind(this,function(e){if("none"==a.style.display){if(s)a.style.display="block";else if(s=!0,null!=i){n.style.cursor="wait";var t=n.innerHTML;n.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",n.style.cursor="",n.innerHTML=t},0)}else a.style.display="block";n.style.backgroundImage="url('"+this.expandedImage+"')"}else n.style.backgroundImage="url('"+this.collapsedImage+"')",a.style.display="none";mxEvent.consume(e)}))},Sidebar.prototype.addImagePalette=function(e,t,s,o,r,n,a){for(var l=[],d=0;d<r.length;d++)mxUtils.bind(this,function(e,t,n){if(null==n){var a=e.lastIndexOf("/"),i=e.lastIndexOf(".");n=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],t,!1,!0,this.filterTags(n)))})(r[d],null!=n?n[d]:null,null!=a?a[r[d]]:null);this.addPaletteFunctions(e,t,!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,t,n,a){mxGraph.call(this,e,t,n,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 t=this.view.getState(e),n=null!=t?t.style:this.getCellStyle(e);return"1"==n.html||"wrap"==n.whiteSpace},this.cellRenderer.getLabelValue=function(e){var t=mxCellRenderer.prototype.getLabelValue.apply(this,arguments);return"wrap"==e.style.whiteSpace&&1!=e.style.html&&(t=mxUtils.htmlEntities(t,!1)),t},this.isCellLocked=function(e){return!1},this.connectionHandler.tapAndHoldTolerance=16;var s=this.connectionHandler.tapAndHold;this.connectionHandler.tapAndHold=function(e,t){null==t?this.graph.panningHandler.active||(i.start(e.getGraphX(),e.getGraphY()),this.graph.panningHandler.panningTrigger=!1):tapAndHoldStartsConnection?s.apply(this,arguments):this.graph.isCellSelected(t.cell)&&1<this.graph.getSelectionCount()&&this.graph.removeSelectionCell(t.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 t=this.view.getState(e),n=null!=t?t.style:this.getCellStyle(e);if(null!=n){var a=mxUtils.getValue(n,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 t=this.getModel().cloneCells([e])[0];null!=t.geometry&&(t.geometry.points=null);var n=t.getStyle();n=mxUtils.setStyle(n,mxConstants.STYLE_ENTRY_X,null),n=mxUtils.setStyle(n,mxConstants.STYLE_ENTRY_Y,null),n=mxUtils.setStyle(n,mxConstants.STYLE_EXIT_X,null),n=mxUtils.setStyle(n,mxConstants.STYLE_EXIT_Y,null),t.setStyle(n),this.connectionHandler.createEdgeState=function(e){return this.graph.view.createState(t)},this.connectionHandler.factoryMethod=function(){return this.graph.cloneCells([t])[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 t="";return this.getModel().isVertex(e)?t+=mxResources.get("description_"+e.value.nodeName)||"":this.getModel().isEdge(e)&&(t=mxGraph.prototype.getTooltipForCell.apply(this,arguments)),t},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,t,n){if(null!=e.value&&"object"==typeof e.value){var a=e.value.cloneNode(!0);a.setAttribute("label",t),t=a}mxGraph.prototype.cellLabelChanged.apply(this,arguments)},Graph.prototype.setLinkForCell=function(e,t){var n=null;null!=e.value&&"object"==typeof e.value?n=e.value.cloneNode(!0):(n=mxUtils.createXmlDocument().createElement("UserObject")).setAttribute("label",e.value);null!=t&&0<t.length?n.setAttribute("link",t):n.removeAttribute("link"),this.model.setValue(e,n)},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,t){this.panningHandler.hideMenu()});var s=!1,o=null;this.updateMouseEvent=function(e){if(mxGraph.prototype.updateMouseEvent.apply(this,arguments),null==e.getState()){var t=this.getCellAt(e.graphX,e.graphY);this.getModel().isEdge(t)&&(e.state=this.view.getState(t),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,t,n){if(e==mxEvent.MOUSE_DOWN)this.panningHandler.isMenuShowing()?(s=!1,o=null):(o=t.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(t.getEvent()),i=mxEvent.getClientY(t.getEvent());this.panningHandler.popup(a+16,i,o,t.getEvent())}return s=!1,o=null,void t.consume()}s=!1,o=null}mxGraph.prototype.fireMouseEvent.apply(this,arguments),e==mxEvent.MOUSE_MOVE&&t.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 t=e.getEvent();return this.useLeftButtonForPanning&&(this.ignoreCell||null==e.getState())||mxEvent.isControlDown(t)&&mxEvent.isShiftDown(t)||this.usePopupTrigger&&mxEvent.isPopupTrigger(t)});var n=mxGraphHandler.prototype.mouseDown;mxGraphHandler.prototype.mouseDown=function(e,t){n.apply(this,arguments),this.graph.isCellSelected(t.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,t){touchStyle&&null!=t?this.graph.setSelectionCell(t):this.graph.setSelectionCell(e)};var a=mxGraph.prototype.dblClick;Graph.prototype.dblClick=function(e,t){if(null==t){var n=mxUtils.convertPoint(this.container,mxEvent.getClientX(e),mxEvent.getClientY(e));t=this.getCellAt(n.x,n.y)}a.call(this,e,t)};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 t=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(t),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 t=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(e),mxEvent.getClientY(e));this.graph.connectionHandler.start(this.state,t.x,t.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,t){o.apply(this,arguments),null!=this.connectorImg&&(this.connectorImg.parentNode.removeChild(this.connectorImg),this.connectorImg=null)},(new Image).src=t}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 t=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(e),mxEvent.getClientY(e));this.graph.connectionHandler.start(this.state,t.x,t.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,t){o.apply(this,arguments),null!=this.connectorImg&&(this.connectorImg.parentNode.removeChild(this.connectorImg),this.connectorImg=null)}}}}(),Actions.prototype.init=function(){var t=this.editorUi,l=t.editor,d=l.graph;this.addAction("new",function(){t.projectDesignController.newProject()},CRUD_PERMISSIONS.canEdit),this.addAction("open",function(){t.projectDesignController.openProject()},CRUD_PERMISSIONS.canEdit),this.addAction("save",function(){t.projectDesignController.saveOrPublishProject(mxUtils.getPrettyXml(l.getGraphXml())),t.editor.modified=!1},CRUD_PERMISSIONS.canEdit,null,"Ctrl+S"),this.addAction("saveAs",function(){t.projectDesignController.saveProjectAs(mxUtils.getPrettyXml(l.getGraphXml()))},CRUD_PERMISSIONS.canEdit,null,"Ctrl+Shift+S"),this.addAction("publish",function(){t.editor.setStatus(""),null===t.validate()?(t.projectDesignController.saveOrPublishProject(mxUtils.getPrettyXml(l.getGraphXml()),!0),t.editor.modified=!1):(t.editor.setStatus("...Error publishing! Please check the project and try again!"),setTimeout(function(){t.editor.setStatus("")},3e3))},CRUD_PERMISSIONS.canEdit,null,"Ctrl+Shift+P"),this.addAction("variable",function(){t.projectDesignController.newVariable()},CRUD_PERMISSIONS.canEdit),this.addAction("import",function(){t.projectDesignController.importXML(function(e){l.setGraphXml(mxUtils.parseXml(e).documentElement)})},CRUD_PERMISSIONS.canEdit),this.addAction("export",function(){t.exportXML(mxUtils.getPrettyXml(l.getGraphXml()))},null,null,"Ctrl+E"),this.addAction("editFile",function(){t.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(),t=d.getLinkForCell(e);null==t&&(t=""),null!=(t=mxUtils.prompt(mxResources.get("enterValue"),t))&&d.setLinkForCell(e,t)}),this.addAction("openLink",function(){var e=d.getSelectionCell(),t=d.getLinkForCell(e);null!=t&&window.open(t)}),this.addAction("autosize",function(){var e=d.getSelectionCells();if(null!=e){d.getModel().beginUpdate();try{for(var t=0;t<e.length;t++){var n=e[t];d.getModel().getChildCount(n)?d.updateGroupBounds([n],20):d.updateCellSize(n)}}finally{d.getModel().endUpdate()}}}),this.addAction("wordWrap",function(){var e=d.getView().getState(d.getSelectionCell()),t="wrap";null!=e&&"wrap"==e.style[mxConstants.STYLE_WHITE_SPACE]&&(t=null),d.setCellStyles(mxConstants.STYLE_WHITE_SPACE,t)}),this.addAction("rotation",function(){var e="0",t=d.getView().getState(d.getSelectionCell());null!=t&&(e=t.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 t=0;t<e.length;t++){var n=e[t];if(d.getModel().isVertex(n)&&0==d.getModel().getChildCount(n)){var a=d.getCellGeometry(n);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(n,a);var s=d.view.getState(n);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,[n])}}}}}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,t=d.pageScale,n=d.container.clientWidth-20,a=d.container.clientHeight-20,i=Math.floor(100*Math.min(n/e.width/t,a/e.height/t))/100;d.zoomTo(i),d.container.scrollLeft=Math.round(d.view.translate.x*i-Math.max(10,(d.container.clientWidth-e.width*t*i)/2)),d.container.scrollTop=Math.round(d.view.translate.y*i-Math.max(10,(d.container.clientHeight-e.height*t*i)/2))})),this.addAction("fitPageWidth",mxUtils.bind(this,function(){d.pageVisible||this.get("pageView").funct();var e=d.pageFormat,t=d.pageScale,n=d.container.clientWidth-20,a=Math.floor(100*n/e.width/t)/100;d.zoomTo(a),d.container.scrollLeft=Math.round(d.view.translate.x*a-Math.max(10,(d.container.clientWidth-e.width*t*a)/2)),d.container.scrollTop=Math.round(d.view.translate.y*a-Math.max(10,(d.container.clientHeight-e.height*t*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,t=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(t*d.view.scale)}else{var n=d.view.translate;d.view.setTranslate(n.x-d.container.scrollLeft/d.view.scale,n.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 n=mxUtils.bind(this,function(e,t){this.addAction(e,function(){d.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE,t)})});n("bold",mxConstants.FONT_BOLD),n("italic",mxConstants.FONT_ITALIC),n("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 t=d.getModel(),n=mxUtils.prompt(mxResources.get("enterValue")+" ("+mxResources.get("style")+")",t.getStyle(e[0])||"");null!=n&&d.setCellStyle(n,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 t=l.graph.selectionCellsHandler.getHandler(e);if(t instanceof mxEdgeHandler){var n=d.view.translate,a=d.view.scale,i=n.x,s=n.y,o=d.getModel().getParent(e),r=d.getCellGeometry(o);d.getModel().isVertex(o)&&null!=r&&(i+=r.x,s+=r.y),t.addPointAt(t.state,d.panningHandler.triggerX/a-i,d.panningHandler.triggerY/a-s)}}}),this.addAction("removeWaypoint",function(){var e=t.actions.get("removeWaypoint");null!=e.handler&&e.handler.removePoint(e.handler.state,e.index)}),this.addAction("image",function(){var e="",t=d.getView().getState(d.getSelectionCell());if(null!=t&&(e=t.style[mxConstants.STYLE_IMAGE]||e),null!=(e=mxUtils.prompt(mxResources.get("enterValue")+" ("+mxResources.get("url")+")",e))&&0<e.length){var n=new Image;n.onload=function(){!function(e,t,n){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,t,n)]}if(d.setCellStyles(mxConstants.STYLE_IMAGE,e,i),d.setCellStyles(mxConstants.STYLE_SHAPE,"image",i),1==d.getSelectionCount()&&null!=t&&null!=n){var o=i[0],r=d.getModel().getGeometry(o);null!=r&&((r=r.clone()).width=t,r.height=n,d.getModel().setGeometry(o,r))}}finally{d.getModel().endUpdate()}null!=a&&(d.setSelectionCells(a),d.scrollCellToVisible(a[0]))}(e,n.width,n.height)},n.onerror=function(){mxUtils.alert(mxResources.get("fileNotFound"))},n.src=e}})},Actions.prototype.addAction=function(e,t,n,a,i){return this.put(e,new Action(mxResources.get(e),t,n,a,i))},Actions.prototype.put=function(e,t){return this.actions[e]=t},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,t){for(var n=["Helvetica","Verdana","Times New Roman","Garamond","Comic Sans MS","Courier New","Georgia","Lucida Console","Tahoma"],a=0;a<n.length;a++){this.styleChange(e,n[a],[mxConstants.STYLE_FONTFAMILY],[n[a]],null,t).firstChild.nextSibling.style.fontFamily=n[a]}e.addSeparator(t),this.promptChange(e,mxResources.get("custom"),"",mxConstants.DEFAULT_FONTFAMILY,mxConstants.STYLE_FONTFAMILY,t)}))),this.put("fontSize",new Menu(mxUtils.bind(this,function(e,t){for(var n=[6,8,9,10,11,12,14,18,24,36,48,72],a=0;a<n.length;a++)this.styleChange(e,n[a],[mxConstants.STYLE_FONTSIZE],[n[a]],null,t);e.addSeparator(t),this.promptChange(e,mxResources.get("custom"),"(pt)","12",mxConstants.STYLE_FONTSIZE,t)}))),this.put("linewidth",new Menu(mxUtils.bind(this,function(e,t){for(var n=[1,2,3,4,8,12,16,24],a=0;a<n.length;a++)this.styleChange(e,n[a]+"px",[mxConstants.STYLE_STROKEWIDTH],[n[a]],null,t);e.addSeparator(t),this.promptChange(e,mxResources.get("custom"),"(px)","1",mxConstants.STYLE_STROKEWIDTH,t)}))),this.put("line",new Menu(mxUtils.bind(this,function(e,t){this.styleChange(e,mxResources.get("straight"),[mxConstants.STYLE_EDGE],[null],null,t),this.styleChange(e,mxResources.get("entityRelation"),[mxConstants.STYLE_EDGE],["entityRelationEdgeStyle"],null,t),e.addSeparator(t),this.styleChange(e,mxResources.get("horizontal"),[mxConstants.STYLE_EDGE,mxConstants.STYLE_ELBOW],["elbowEdgeStyle","horizontal"],null,t),this.styleChange(e,mxResources.get("vertical"),[mxConstants.STYLE_EDGE,mxConstants.STYLE_ELBOW],["elbowEdgeStyle","vertical"],null,t),e.addSeparator(t),this.styleChange(e,mxResources.get("manual"),[mxConstants.STYLE_EDGE],["segmentEdgeStyle"],null,t),this.styleChange(e,mxResources.get("automatic"),[mxConstants.STYLE_EDGE],["orthogonalEdgeStyle"],null,t)}))),this.put("lineend",new Menu(mxUtils.bind(this,function(e,t){this.styleChange(e,mxResources.get("classic"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_CLASSIC],null,t),this.styleChange(e,mxResources.get("openArrow"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_OPEN],null,t),this.styleChange(e,mxResources.get("block"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_BLOCK],null,t),e.addSeparator(t),this.styleChange(e,mxResources.get("oval"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_OVAL],null,t),this.styleChange(e,mxResources.get("diamond"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_DIAMOND],null,t),this.styleChange(e,mxResources.get("diamondThin"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_DIAMOND_THIN],null,t),e.addSeparator(t),this.styleChange(e,mxResources.get("none"),[mxConstants.STYLE_ENDARROW],[mxConstants.NONE],null,t),e.addSeparator(t),e.addItem(mxResources.get("transparent"),null,function(){i.toggleCellStyles("endFill",!0)},t,null,!0),e.addSeparator(t),this.promptChange(e,mxResources.get("size"),"(px)",mxConstants.DEFAULT_MARKERSIZE,mxConstants.STYLE_ENDSIZE,t)}))),this.put("linestart",new Menu(mxUtils.bind(this,function(e,t){this.styleChange(e,mxResources.get("classic"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_CLASSIC],null,t),this.styleChange(e,mxResources.get("openArrow"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_OPEN],null,t),this.styleChange(e,mxResources.get("block"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_BLOCK],null,t),e.addSeparator(t),this.styleChange(e,mxResources.get("oval"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_OVAL],null,t),this.styleChange(e,mxResources.get("diamond"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_DIAMOND],null,t),this.styleChange(e,mxResources.get("diamondThin"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_DIAMOND_THIN],null,t),e.addSeparator(t),this.styleChange(e,mxResources.get("none"),[mxConstants.STYLE_STARTARROW],[mxConstants.NONE],null,t),e.addSeparator(t),e.addItem(mxResources.get("transparent"),null,function(){i.toggleCellStyles("startFill",!0)},t,null,!0),e.addSeparator(t),this.promptChange(e,mxResources.get("size"),"(px)",mxConstants.DEFAULT_MARKERSIZE,mxConstants.STYLE_STARTSIZE,t)}))),this.put("spacing",new Menu(mxUtils.bind(this,function(e,t){var n=this.editorUi.actions.get("shadow").enabled,a=this.get("line").enabled;(n||e.showDisabled)&&(this.promptChange(e,mxResources.get("top"),"(px)","0",mxConstants.STYLE_SPACING_TOP,t,n),this.promptChange(e,mxResources.get("right"),"(px)","0",mxConstants.STYLE_SPACING_RIGHT,t,n),this.promptChange(e,mxResources.get("bottom"),"(px)","0",mxConstants.STYLE_SPACING_BOTTOM,t,n),this.promptChange(e,mxResources.get("left"),"(px)","0",mxConstants.STYLE_SPACING_LEFT,t,n),e.addSeparator(t),this.promptChange(e,mxResources.get("global"),"(px)","0",mxConstants.STYLE_SPACING,t,n),this.promptChange(e,mxResources.get("perimeter"),"(px)","0",mxConstants.STYLE_PERIMETER_SPACING,t,n)),(a||e.showDisabled)&&(e.addSeparator(t),this.promptChange(e,mxResources.get("sourceSpacing"),"(px)","0",mxConstants.STYLE_SOURCE_PERIMETER_SPACING,t,a),this.promptChange(e,mxResources.get("targetSpacing"),"(px)","0",mxConstants.STYLE_TARGET_PERIMETER_SPACING,t,a))}))),this.put("format",new Menu(mxUtils.bind(this,function(e,t){this.addMenuItem(e,"style",t)}))),this.put("text",new Menu(mxUtils.bind(this,function(e,t){var n=this.get("text").enabled;e.addSeparator(t),this.addSubmenu("fontFamily",e,t),this.addSubmenu("fontSize",e,t),this.addMenuItems(e,["-","bold","italic","underline","-"],t),this.addSubmenu("alignment",e,t),this.addMenuItem(e,"wordWrap",t),e.addSeparator(t),this.promptChange(e,mxResources.get("textOpacity"),"(%)","100",mxConstants.STYLE_TEXT_OPACITY,t,n),e.addItem(mxResources.get("hide"),null,function(){i.toggleCellStyles(mxConstants.STYLE_NOLABEL,!1)},t,null,n)}))),this.put("alignment",new Menu(mxUtils.bind(this,function(e,t){this.styleChange(e,mxResources.get("leftAlign"),[mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_LEFT],null,t),this.styleChange(e,mxResources.get("center"),[mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_CENTER],null,t),this.styleChange(e,mxResources.get("rightAlign"),[mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_RIGHT],null,t),e.addSeparator(t),this.styleChange(e,mxResources.get("topAlign"),[mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_TOP],null,t),this.styleChange(e,mxResources.get("middle"),[mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_MIDDLE],null,t),this.styleChange(e,mxResources.get("bottomAlign"),[mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_BOTTOM],null,t),e.addSeparator(t),this.addSubmenu("position",e,t),this.addSubmenu("spacing",e,t),e.addSeparator(t);var n=this.get("text").enabled;e.addItem(mxResources.get("vertical"),null,function(){i.toggleCellStyles(mxConstants.STYLE_HORIZONTAL,!0)},t,null,n)}))),this.put("position",new Menu(mxUtils.bind(this,function(e,t){this.styleChange(e,mxResources.get("left"),[mxConstants.STYLE_LABEL_POSITION,mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_LEFT,mxConstants.ALIGN_RIGHT],null,t),this.styleChange(e,mxResources.get("center"),[mxConstants.STYLE_LABEL_POSITION,mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_CENTER,mxConstants.ALIGN_CENTER],null,t),this.styleChange(e,mxResources.get("right"),[mxConstants.STYLE_LABEL_POSITION,mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_RIGHT,mxConstants.ALIGN_LEFT],null,t),e.addSeparator(t),this.styleChange(e,mxResources.get("top"),[mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_TOP,mxConstants.ALIGN_BOTTOM],null,t),this.styleChange(e,mxResources.get("middle"),[mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_MIDDLE,mxConstants.ALIGN_MIDDLE],null,t),this.styleChange(e,mxResources.get("bottom"),[mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_BOTTOM,mxConstants.ALIGN_TOP],null,t)}))),this.put("direction",new Menu(mxUtils.bind(this,function(e,t){e.addItem(mxResources.get("flipH"),null,function(){i.toggleCellStyles(mxConstants.STYLE_FLIPH,!1)},t),e.addItem(mxResources.get("flipV"),null,function(){i.toggleCellStyles(mxConstants.STYLE_FLIPV,!1)},t),this.addMenuItems(e,["-","tilt","rotation"],t)}))),this.put("align",new Menu(mxUtils.bind(this,function(e,t){e.addItem(mxResources.get("leftAlign"),null,function(){i.alignCells(mxConstants.ALIGN_LEFT)},t),e.addItem(mxResources.get("center"),null,function(){i.alignCells(mxConstants.ALIGN_CENTER)},t),e.addItem(mxResources.get("rightAlign"),null,function(){i.alignCells(mxConstants.ALIGN_RIGHT)},t),e.addSeparator(t),e.addItem(mxResources.get("topAlign"),null,function(){i.alignCells(mxConstants.ALIGN_TOP)},t),e.addItem(mxResources.get("middle"),null,function(){i.alignCells(mxConstants.ALIGN_MIDDLE)},t),e.addItem(mxResources.get("bottomAlign"),null,function(){i.alignCells(mxConstants.ALIGN_BOTTOM)},t)}))),this.put("layout",new Menu(mxUtils.bind(this,function(e,t){e.addItem(mxResources.get("horizontalFlow"),null,mxUtils.bind(this,function(){var e=new mxHierarchicalLayout(i,mxConstants.DIRECTION_WEST);this.editorUi.executeLayout(e,!0,!0)}),t),e.addItem(mxResources.get("verticalFlow"),null,mxUtils.bind(this,function(){var e=new mxHierarchicalLayout(i,mxConstants.DIRECTION_NORTH);this.editorUi.executeLayout(e,!0,!0)}),t)}))),this.put("navigation",new Menu(mxUtils.bind(this,function(e,t){this.addMenuItems(e,["home","-","exitGroup","enterGroup","-","expand","collapse"],t)}))),this.put("arrange",new Menu(mxUtils.bind(this,function(e,t){this.addMenuItems(e,["toFront","toBack","-"],t),this.addSubmenu("layout",e,t),e.addSeparator(t),this.addMenuItems(e,["-","group","ungroup","removeFromGroup"],t)}))),this.put("view",new Menu(mxUtils.bind(this,function(t,n){this.addMenuItems(t,["actualSize"],n),t.addSeparator();for(var e=[.25,.5,.75,1,2,4],a=0;a<e.length;a++)!function(e){t.addItem(100*e+"%",null,function(){i.zoomTo(e)},n)}(e[a]);this.addMenuItems(t,["-","zoomIn","zoomOut","-","fitWindow","customZoom","-","fitPage","fitPageWidth"],n)}))),this.put("file",new Menu(mxUtils.bind(this,function(e,t){this.addMenuItems(e,["new","open","-","save","saveAs","publish","-","variable","-","import","export","-","editFile","description","-","print"],t)}))),this.put("edit",new Menu(mxUtils.bind(this,function(e,t){this.addMenuItems(e,["undo","redo","-","cut","copy","paste","delete","-","duplicate","-","selectVertices","selectEdges","selectAll"])}))),this.put("help",new Menu(mxUtils.bind(this,function(e,t){this.addMenuItems(e,["help","-","about"])})))},Menus.prototype.put=function(e,t){this.menus[e]=t},Menus.prototype.get=function(e){return this.menus[e]},Menus.prototype.addSubmenu=function(e,t,n){var a=this.get(e).enabled;if(t.showDisabled||a){var i=t.addItem(mxResources.get(e),null,null,n,null,a);this.addMenu(e,t,i)}},Menus.prototype.addMenu=function(e,t,n){var a=this.get(e);null!=a&&(t.showDisabled||a.enabled)&&this.get(e).execute(t,n)},Menus.prototype.styleChange=function(e,t,n,a,i,s){return e.addItem(t,null,mxUtils.bind(this,function(){var e=this.editorUi.editor.graph;e.getModel().beginUpdate();try{for(var t=0;t<n.length;t++)e.setCellStyles(n[t],a[t])}finally{e.getModel().endUpdate()}}),s,i)},Menus.prototype.promptChange=function(e,t,a,i,s,n,o){return e.addItem(t,null,mxUtils.bind(this,function(){var e=this.editorUi.editor.graph,t=i,n=e.getView().getState(e.getSelectionCell());null!=n&&(t=n.style[s]||t),null!=(t=mxUtils.prompt(mxResources.get("enterValue")+(0<a.length?" "+a:""),t))&&0<t.length&&e.setCellStyles(s,t)}),n,null,o)},Menus.prototype.addMenuItem=function(e,t,n){var a=this.editorUi.actions.get(t);if(null==a||!e.showDisabled&&!a.enabled)return null;var i=e.addItem(a.label,null,a.funct,n,null,a.enabled);return a.toggleAction&&a.isSelected()&&this.addCheckmark(i),this.addShortcut(i,a),i},Menus.prototype.addShortcut=function(e,t){if(null!=t.shortcut){var n=e.firstChild.nextSibling.nextSibling,a=document.createElement("span");a.style.color="gray",mxUtils.write(a,t.shortcut),n.appendChild(a)}},Menus.prototype.addCheckmark=function(e){var t=e.firstChild.nextSibling;t.style.backgroundImage="url("+IMAGE_PATH+"/checkmark.gif)",t.style.backgroundRepeat="no-repeat",t.style.backgroundPosition="2px 50%"},Menus.prototype.addMenuItems=function(e,t,n){for(var a=0;a<t.length;a++)"-"==t[a]?e.addSeparator(n):this.addMenuItem(e,t[a],n)},Menus.prototype.createPopupMenu=function(e,t,n){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!=(t=a.getSelectionCell())&&a.getModel().isEdge(t)){var s=a.selectionCellsHandler.getHandler(t);if(s instanceof mxEdgeHandler&&null!=s.bends&&2<s.bends.length){var o=s.getHandleForEvent(new mxMouseEvent(n)),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 t=new Menubar(this.editorUi,e),n=[];n=CRUD_PERMISSIONS.canEdit?["file","edit","view","format","text","arrange","help"]:["file","view","help"];for(var a=0;a<n.length;a++)t.addMenu(mxResources.get(n[a]),this.get(n[a]).funct);return t},Menubar.prototype.hideMenu=function(){null!=this.currentMenu&&this.currentMenu.hideMenu()},Menubar.prototype.addMenu=function(e,t){var n=document.createElement("a");return n.setAttribute("href","javascript:void(0);"),n.className="geItem",mxUtils.write(n,e),this.addMenuHandler(n,t),this.container.appendChild(n),n},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,t=mxUtils.bind(this,function(e){if(o&&null==i.enabled||i.enabled){this.editorUi.editor.graph.panningHandler.hideMenu();var t=new mxPopupMenu(s);t.div.className+=" geMenubarMenu",t.smartSeparators=!0,t.showDisabled=!0,t.autoExpand=!0,t.hideMenu=mxUtils.bind(this,function(){mxPopupMenu.prototype.hideMenu.apply(t,arguments),t.destroy(),this.currentMenu=null,this.currentElt=null});var n=this.getOffset(i).left,a=this.getOffset(i).top+i.offsetHeight;t.popup(n,a,null,e),this.currentMenu=t,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(),t(e))})),mxEvent.addListener(i,"mousedown",mxUtils.bind(this,function(){o=this.currentElt!=i})),mxEvent.addListener(i,"click",t)}},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,t){this.funct(e,t)},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,t,n,a){var i=this.editorUi.menus.get(a),s=this.addMenuFunction(e,t,n,i.funct);return i.addListener("stateChanged",function(){s.setEnabled(i.enabled)}),s},Toolbar.prototype.addMenuFunction=function(e,t,n,a){var i=n?this.createLabel(e):this.createButton(e);return this.initElement(i,t),this.addMenuHandler(i,n,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 t=0;t<e.length;t++){var n=e[t];"-"==n?this.addSeparator():this.addItem("geSprite-"+n.toLowerCase(),n)}},Toolbar.prototype.addItem=function(e,t){var n=this.editorUi.actions.get(t),a=null;return null!=n&&((a=this.addButton(e,n.label,n.funct)).setEnabled(n.enabled),n.addListener("stateChanged",function(){a.setEnabled(n.enabled)})),a},Toolbar.prototype.addButton=function(e,t,n){var a=this.createButton(e);return this.initElement(a,t),this.addClickHandler(a,n),this.container.appendChild(a),a},Toolbar.prototype.addSelectionHandler=function(n){var a=this.editorUi.editor.graph,e=function(){for(var e=!a.isSelectionEmpty(),t=0;t<n.length;t++)n[t].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 t=i.getSelectionCells(),n=0;n<t.length;n++)if(i.getModel().isEdge(t[n])){e=!0;break}for(n=0;n<a.length;n++)a[n].setEnabled(e)};i.getSelectionModel().addListener(mxEvent.CHANGE,e),e()},Toolbar.prototype.initElement=function(e,t){e.setAttribute("tabindex","0"),null!=t&&e.setAttribute("title",t),this.addEnabledState(e)},Toolbar.prototype.addEnabledState=function(t){var n=t.className;t.setEnabled=function(e){t.enabled=e,t.className=e?n:n+" geDisabled"},t.setEnabled(!0)},Toolbar.prototype.addClickHandler=function(t,n){null!=n&&mxEvent.addListener(t,"click",function(e){t.enabled&&n(e),mxEvent.consume(e)})},Toolbar.prototype.createButton=function(e){var t=document.createElement("a");t.setAttribute("href","javascript:void(0);"),t.className="geButton";var n=document.createElement("div");return n.className="geSprite "+e,t.appendChild(n),t},Toolbar.prototype.createLabel=function(e,t){var n=document.createElement("a");return n.setAttribute("href","javascript:void(0);"),n.className="geLabel",mxUtils.write(n,e),n},Toolbar.prototype.addMenuHandler=function(t,n,a,i){if(null!=a){var s=this.editorUi.editor.graph,o=null;mxEvent.addListener(t,"click",mxUtils.bind(this,function(e){(null==t.enabled||t.enabled)&&(s.panningHandler.hideMenu(),(o=new mxPopupMenu(a)).div.className+=" geToolbarMenu",o.showDisabled=i,o.labels=n,o.autoExpand=!0,o.popup(t.offsetLeft,t.offsetTop+t.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/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()">{{target}}</span>\n\n    <md-menu ng-if="showMenu()">\n        <a aria-label="Target" ng-click="$mdOpenMenu($event)">\n            <span ng-if="prefix">{{prefix}}-</span>{{target}}\n        </a>\n\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}} ({{prefix ? prefix + \'-\' + target : target}})\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}} ({{prefix ? prefix + \'-\' + target : target}})\n                </md-button>\n            </md-menu-item>\n        </md-menu-content>\n    </md-menu>\n</section>\n\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\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\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}} ({{prefix ? prefix + \'-\' + target : target}})\n                </md-button>\n            </md-menu-item>\n            <md-menu-item>\n                <md-button ng-click="transfer(target)">\n'+"                    {{'DASHBOARDS.TRANSFER_NUMBER' | translate}} ({{prefix ? prefix + '-' + target : target}})\n                </md-button>\n            </md-menu-item>\n        </md-menu-content>\n    </md-menu>\n</section>"),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="{{options.labelSearch || \'Search...\'}}">\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="options.readOnly ? \'read-only-mode\' : \'\'" ng-disabled="options.readOnly" ng-repeat="item in options.items | filter: query | orderBy: options.orderBy" ng-click="canTransfer(item, options, false)">\n                    <div class="md-list-item-text" layout="column">\n                        <h3 ng-if="options.line1">{{getLine(item, options.line1)}}</h3>\n                        <h4 ng-if="options.line2">{{getLine(item, options.line2)}}</h4>\n                        <p ng-if="options.line3">{{getLine(item, options.line3)}}</p>\n                        <p class="ms-dual-multiselect-line-xs" ng-if="options.line4">{{getLine(item, options.line4)}}\n                        </p>\n                    </div>\n                    <md-icon ng-show="!options.readOnly" md-font-icon="icon-arrow-right-bold" aria-label="swap"></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>{{options.labelAll || \'All Items\'}} ({{options.items.length}})</span>\n            <md-icon ng-show="options.showSelectAndDeselectAll && !options.readOnly" md-font-icon="icon-chevron-double-right" aria-label="swap" ng-click="transfer(options.items, 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="{{options.labelSearch || \'Search...\'}}">\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="options.readOnly || !item.isValid ? \'read-only-mode\' : \'\'" ng-disabled="options.readOnly" ng-repeat="item in options.selectedItems | filter: selectedQuery | orderBy: options.orderBy" ng-click="canTransfer(item, options, true)">\n                    <md-icon ng-class="options.readOnly || !item.isValid ? \'hidden\' : \'\'" 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="options.line1">{{getLine(item, options.line1)}}</h3>\n                        <h4 ng-if="options.line2">{{getLine(item, options.line2)}}</h4>\n                        <p ng-if="options.line3">{{getLine(item, options.line3)}}</p>\n                        <p class="ms-dual-multiselect-line-xs" ng-if="options.line4">{{getLine(item, 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-show="options.showSelectAndDeselectAll && !options.readOnly" md-font-icon="icon-chevron-double-left" aria-label="swap" flex ng-click="transfer(options.selectedItems, options.items, -1, true)"></md-icon>\n            <span class="h4">{{options.labelSelected || \'Selected Items\'}} ({{options.selectedItems.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" ms-scroll>\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 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\x3c!-- Input 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\')" 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\')" 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 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\')" ng-disabled="!vm_pb.registered">\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" interval="1000">{{ days > 0 ? days + \'d\' : \'\' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                </span>\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" />\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!-- 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\x3c!-- Input Area --\x3e\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 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">{{ (session.user == session.name) ? session.user : (session.name + \' \' + session.user) }}</span>\n            <span class="session-info" layout="row" layout="start center">\n                <timer interval="1000">{{hhours}}:{{mminutes}}:{{sseconds}}</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="Hold" 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"></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="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>\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" 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 tranlsate="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" ms-scroll>\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-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                            <div layout="row" layout-align="space-between center">\n                                <md-switch 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-search-bar/ms-search-bar.html",'<div flex layout="row" layout-align="start center">\n    <label for="ms-search-bar-input">\n        <md-button class="ms-search-bar-expander md-icon-button" aria-label="Expand Search Bar" ng-click="MsSearchBar.expand()" ng-if="!MsSearchBar.resultsLoading || MsSearchBar.collapsed">\n            <md-icon md-font-icon="icon-magnify" class="icon s24"></md-icon>\n        </md-button>\n        <div class="ms-search-bar-loader" layout="row" layout-align="center center" ng-if="MsSearchBar.resultsLoading && !MsSearchBar.collapsed">\n            <md-progress-circular class="md-accent" md-diameter="32" md-mode="indeterminate"></md-progress-circular>\n        </div>\n    </label>\n    <input id="ms-search-bar-input" type="text" placeholder="Search" flex ng-model="MsSearchBar.query" ng-model-options="MsSearchBar.queryOptions" ng-blur="MsSearchBar.blurCollapse()" ng-keydown="MsSearchBar.handleKeydown($event)">\n    <md-button class="ms-search-bar-collapser md-icon-button" ng-click="MsSearchBar.collapse()" aria-label="Collapse Search Bar">\n        <md-icon md-font-icon="icon-close" class="icon s24"></md-icon>\n    </md-button>\n\n    <div class="ms-search-bar-results" ng-if="MsSearchBar.results" ms-scroll>\n        <div class="no-results" ng-if="MsSearchBar.results.length === 0">No Results!</div>\n\n        <div class="result" ng-repeat="result in MsSearchBar.results" ng-click="MsSearchBar.handleResultClick(result)" ng-mouseenter="MsSearchBar.handleMouseenter($index)" ng-mousedown="MsSearchBar.absorbEvent($event)" ng-class="{\'selected\': $index == MsSearchBar.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" ms-scroll 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" ms-scroll>\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">\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-32" layout="column" layout-align="center center" layout-fill ng-controller="MsWidgetEngineCounterController as vm">\n    <div ng-class="\'font-size-\' + (vm.fontSize * 3)" 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.\' + widget.attrs[0].value | 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}" class="text-truncate" flex>\n                            {{ widget.title || \'No Title\' }}\n                        </a>\n                        <md-button ng-if="!vm.config.preview" 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>\n                                    <md-button ng-click="vm.onEdit({widget: widget})" translate="TOOLS.EDIT_WIDGET">Edit</md-button>\n                                </md-menu-item>\n                                <md-menu-item>\n                                    <md-button ng-click="vm.onDelete({widget: widget})" translate="TOOLS.DELETE_WIDGET">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 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="animate-slide-up 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="animate-slide-up 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" ms-scroll 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="animate-slide-up md-hue-2" ms-scroll 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" ms-scroll 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" ms-scroll ui-view="navigation"></md-sidenav>\n\n        <div id="content-container" flex layout="column">\n            <md-content id="content" class="animate-slide-up md-hue-2" ms-scroll 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" ms-scroll 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" ms-scroll ui-view="navigation"></md-sidenav>\n\n        <div id="content-container" flex layout="column">\n            <md-content id="content" class="animate-slide-up md-hue-2" ms-scroll 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" ms-scroll 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" ms-scroll 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="animate-slide-up md-hue-2" ms-scroll 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" ms-scroll 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" ms-scroll 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" ms-scroll>\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 class="separator">\n                <span class="text" translate="LOGIN.OR">OR</span>\n            </div>\n\n            <md-button 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="icon-google-plus" class="s16"></md-icon>\n                        <span translate="LOGIN.WITH_GOOGLE">Log in with Google</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 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="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 animate-slide-down 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="EXTRACTEDREPORTS.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="EXTRACTEDREPORTS.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!-- 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                                <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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editdialog(extractedReport, $event)" translate="ANALYTICS.EDIT_EXTRACTEDREPORT">\n                                                    Edit ExtractedReport\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.downloadfile2(extractedReport, $event)" translate="ANALYTICS.DOWNLOAD_EXTRACTEDREPORT">\n                                                    Download ExtractedReport\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(extractedReport, $event)" translate="ANALYTICS.DELETE_EXTRACTEDREPORT">\n                                                    Delete ExtractedReport\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.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 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="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="\'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="\'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="\'report_integration\'">Integration Report</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="\'report_queue\'">Queue Report</md-option>\n                    <md-option ng-value="\'users\'">Users</md-option>\n                    <md-option ng-value="\'voice_recordings\'">Voice Recordings</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 animate-slide-down 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="METRICS.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="METRICS.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!-- 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                                <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="ANALYTICS.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.editdialog(metric, $event)" translate="ANALYTICS.EDIT_METRIC">\n                                                    Edit Metric\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(metric, $event)" translate="ANALYTICS.DELETE_METRIC">\n                                                    Delete Metric\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.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 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="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 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="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 track by $index">\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 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="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">\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 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                <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 animate-slide-down 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" ms-scroll>\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" ms-scroll>\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.query.filter = 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 tranlsate="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 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="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.startDate">\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.endDate">\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.PREVIEW_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 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="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 animate-slide-down 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="ODBC.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="ODBC.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!-- 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                                <td md-cell class="actions">\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.editdialog(odbc, $event)" translate="CALLYSQUARE.EDIT_ODBC">\n                                                    Edit Odbc\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.testtestOdbc(odbc, $event)" translate="CALLYSQUARE.TEST_ODBC">\n                                                    Test Odbc\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(odbc, $event)" translate="CALLYSQUARE.DELETE_ODBC">\n                                                    Delete Odbc\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.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 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="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 ms-scroll>\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_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" 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-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" 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" 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                \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></span>\n                <md-button class="md-icon-button" ng-click="vm.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 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>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></span>\n                <md-button class="md-icon-button" ng-click="vm.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 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                    </div>\n                    <md-button class="md-icon-button">\n                        <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></span>\n                <md-button class="md-icon-button" ng-click="vm.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 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="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></span>\n                <md-button class="md-icon-button" ng-click="vm.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 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="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/permissionadd/permissionadd.html",'<md-dialog class="projects-dialog" aria-label="projects">\n    <form name="projectsForm" ng-cloak>\n        <md-toolbar>\n            <div class="md-toolbar-tools">\n                <h2 translate="CALLYSQUARE.PERMISSIONADD_PROJECTS">Add User Permissions</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"></ms-dual-multiselect>\n        </md-dialog-content>\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></span>\n                <md-button class="md-icon-button" ng-click="vm.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 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="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 animate-slide-down 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" ms-scroll>\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">{{ \'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 tranlsate="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 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="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 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="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 animate-slide-down 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="SQUARERECORDINGS.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="SQUARERECORDINGS.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!-- 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 md-order-by="audio">{{ \'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 ">\n                                    \x3c!-- audio recording directive --\x3e\n                                    <ms-recording id="squareRecording.id" model="\'squareRecording\'"></ms-recording>\n                                    \x3c!-- / audio recording directive --\x3e\n                                </td>\n                                <td ng-click="vm.createOrEditSquareRecording($event, squareRecording)" md-cell class="createdAt ">{{squareRecording.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="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>\n                                                <md-button ng-click="vm.downloadfile2(squareRecording, $event)" translate="CALLYSQUARE.DOWNLOAD_SQUARERECORDING">\n                                                    Download SquareRecording\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(squareRecording, $event)" translate="CALLYSQUARE.DELETE_SQUARERECORDING">\n                                                    Delete SquareRecording\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.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 animate-slide-down 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="CHATQUEUES.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="CHATQUEUES.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!-- 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                                <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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(chatQueue, $event)" translate="CHAT.EDIT_CHATQUEUE">\n                                                    Edit ChatQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.teamadddialog(chatQueue, $event)" translate="CHAT.TEAMADD_CHATQUEUE">\n                                                    teamadd ChatQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.agentadddialog(chatQueue, $event)" translate="CHAT.AGENTADD_CHATQUEUE">\n                                                    agentadd ChatQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(chatQueue, $event)" translate="CHAT.DELETE_CHATQUEUE">\n                                                    Delete ChatQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.gotorealtimegoto(chatQueue, $event)" translate="CHAT.GOTOREALTIME_CHATQUEUE">\n                                                    goToRealtime ChatQueue\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: \'{{\'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 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="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" 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"></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"></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" 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 animate-slide-down 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="CHATWEBSITES.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="CHATWEBSITES.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!-- 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                                <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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(chatWebsite, $event)" translate="CHAT.EDIT_CHATWEBSITE">\n                                                    Edit ChatWebsite\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.interactionsgoto(chatWebsite, $event)" translate="CHAT.INTERACTIONS_CHATWEBSITE">\n                                                    Interactions ChatWebsite\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.offlinemessagesgoto(chatWebsite, $event)" translate="CHAT.OFFLINEMESSAGES_CHATWEBSITE">\n                                                    OfflineMessages ChatWebsite\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.agentadddialog(chatWebsite, $event)" translate="CHAT.AGENTADD_CHATWEBSITE">\n                                                    AgentAdd ChatWebsite\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(chatWebsite, $event)" translate="CHAT.DELETE_CHATWEBSITE">\n                                                    Delete ChatWebsite\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: \'{{\'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 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="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" 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"></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 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="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" 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 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="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 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="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="1">One Time</md-option>\n                    <md-option ng-value="0">Always</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" md-maxlength="255" 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 ng-message="md-maxlength">\n                        <span translate="CHAT.ERRORS.TEXT_MAX_LENGTH" translate-values=\'{max: 255}\'>Text 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/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 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="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 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="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/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 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="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 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="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="inboundroute-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 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\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 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="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 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="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" 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 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="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 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="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/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 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="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/chatDispositions/dialog.html",'<md-dialog class="chatDisposition-dialog" aria-label="New ChatDisposition">\n    <form name="chatDispositionForm" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="CHAT.NAME">Name</label>\n                <input type="" name="name" ng-model="vm.chatDisposition.name" md-maxlength="255" ng-required="true" autofocus>\n\n                <div ng-messages="chatDispositionForm[\'name\'].$error" ng-show="chatDispositionForm[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.newChatDisposition" ng-click="vm.saveChatDisposition()" class="send-button md-accent md-raised" ng-disabled="chatDispositionForm.$invalid || chatDispositionForm.$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.newChatDisposition" ng-click="vm.addNewChatDisposition()" class="send-button md-accent md-raised" ng-disabled="chatDispositionForm.$invalid" aria-label="ADD" translate="CHAT.ADD_CHATDISPOSITION" translate-attr-aria-label="CHAT.ADD_CHATDISPOSITION">\n                    ADD CHATDISPOSITION\n                </md-button>\n            </div>\n            <div layout="row">\n                <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newChatDisposition" ng-click="vm.deleteChatDisposition($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>{{vm.message.body}}</pre>\n    </md-content>\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 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="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) || (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" 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                            <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, 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" 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" 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                        <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                            <form name="scriptForm" flex="100" novalidate>\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                            </form>\n                        </div>\n\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">\n                                    < <div class="hint"><span translate="CHAT.HELP.TIMEZONE"></span>\n                    </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.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" 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                    </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 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\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.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="interactionForm[\'noteTitle\'].$error" ng-show="interactionForm[\'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                    <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.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\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                                        \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">\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\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)">\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                            <div flex></div>\n                            <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="CHATWEBSITES.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.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">{{ \'CHAT.ID\' | translate }}</th>\n                                    <th md-column md-order-by="name">{{ \'CHAT.NAME\' | translate }}</th>\n                                    <th md-column md-order-by="type">{{ \'CHAT.TYPE\' | translate }}</th>\n                                    <th md-column md-order-by="selector">{{ \'CHAT.SELECTOR\' | translate }}</th>\n                                    <th md-column md-order-by="timeout">{{ \'CHAT.TIMEOUT\' | translate }}</th>\n                                    <th md-column md-order-by="createdAt">{{ \'CHAT.CREATED_AT\' | translate }}</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>{{chatProactiveAction.id}}</td>\n                                    <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>{{chatProactiveAction.name}}</td>\n                                    <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>{{ \'CHAT.\' + vm_dc.arraytype[chatProactiveAction.type].option | uppercase | translate }}</td>\n                                    <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>{{chatProactiveAction.selector}}</td>\n                                    <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>{{chatProactiveAction.timeout}}</td>\n                                    <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>{{chatProactiveAction.createdAt | date:\'medium\'}}</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                                        <span class="text-boxed-ligth" translate="CHAT.NO_CHATPROACTIVEACTION_AVAILABLE">No chatproactiveaction available</span>\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 class="chatWebsite-detail-form-container chatdispositions md-background-bg md-whiteframe-1dp">\n                <div ng-controller="ChatWebsiteChatDispositionsController as vm_dc" ng-init="vm_dc.init(vm.chatWebsite, vm.crudPermissions)">\n                    <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedChatWebsiteChatDispositions.length">\n                        <div class="md-toolbar-tools">\n                            <span class="md-subhead" translate="CHAT.CHATDISPOSITIONS">ChatDispositions</span>\n                            <div flex></div>\n                            <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\n                            <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditChatWebsiteChatDisposition($event)" aria-label="add chatDisposition" translate translate-attr-label="CHAT.ADD_CHATDISPOSITION">\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.selectedChatWebsiteChatDispositions.length">\n                        <div class="md-toolbar-tools">\n                            <span class="md-subhead">{{vm_dc.selectedChatWebsiteChatDispositions.length}} {{vm_dc.selectedChatWebsiteChatDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                            <div flex></div>\n                            <button class="md-icon-button" ng-csv="vm_dc.exportSelectedChatWebsiteChatDispositions" 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.deleteSelectedChatWebsiteChatDispositions($event)" aria-label="delete selected" translate translate-attr-label="CHATWEBSITES.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.selectedChatWebsiteChatDispositions" md-progress="vm_dc.promise">\n                            <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getChatWebsiteChatDispositions">\n                                <tr md-row>\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="createdAt">{{ \'CHAT.CREATED_AT\' | translate }}</th>\n                                    <th md-column width="10px"></th>\n                                </tr>\n                            </thead>\n                            <tbody md-body>\n                                <tr md-row md-select="chatDisposition" md-select-id="id" ng-repeat="chatDisposition in vm_dc.chatWebsiteChatDispositions.rows">\n                                    <td ng-click="vm_dc.createOrEditChatWebsiteChatDisposition($event, chatDisposition)" md-cell>{{chatDisposition.id}}</td>\n                                    <td ng-click="vm_dc.createOrEditChatWebsiteChatDisposition($event, chatDisposition)" md-cell>{{chatDisposition.name}}</td>\n                                    <td ng-click="vm_dc.createOrEditChatWebsiteChatDisposition($event, chatDisposition)" md-cell>{{chatDisposition.createdAt | date:\'medium\'}}</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.createOrEditChatWebsiteChatDisposition($event, chatDisposition)" translate="CHAT.EDIT_CHATDISPOSITION">\n                                                        Edit ChatDisposition\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(chatDisposition, $event)" translate="CHAT.DELETE_CHATDISPOSITION">\n                                                        Delete ChatDisposition\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.chatWebsiteChatDispositions.rows.length">\n                                    <td md-cell colspan="5">\n                                        <span class="text-boxed-ligth" translate="CHAT.NO_CHATDISPOSITION_AVAILABLE">No chatdisposition available</span>\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.chatWebsiteChatDispositions.count}}" md-on-paginate="vm_dc.getChatWebsiteChatDispositions" 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.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)">\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                            <div flex></div>\n                            <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="CHATWEBSITES.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.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">{{ \'CHAT.ID\' | translate }}</th>\n                                    <th md-column md-order-by="key">{{ \'CHAT.KEY\' | translate }}</th>\n                                    <th md-column md-order-by="value">{{ \'CHAT.VALUE\' | translate }}</th>\n                                    <th md-column md-order-by="description">{{ \'CHAT.DESCRIPTION\' | translate }}</th>\n                                    <th md-column md-order-by="createdAt">{{ \'CHAT.CREATED_AT\' | translate }}</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>{{chatCannedAnswer.id}}</td>\n                                    <td ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" md-cell>{{chatCannedAnswer.key}}</td>\n                                    <td ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" md-cell>{{chatCannedAnswer.value}}</td>\n                                    <td ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" md-cell>{{chatCannedAnswer.description}}</td>\n                                    <td ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" md-cell>{{chatCannedAnswer.createdAt | date:\'medium\'}}</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                                        <span class="text-boxed-ligth" translate="CHAT.NO_CHATCANNEDANSWER_AVAILABLE">No chatcannedanswer available</span>\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.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" ms-scroll 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.alias || a.appType) | uppercase}}">{{a.alias || 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" ms-scroll 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" style="width:200px">{{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-ligth" 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)">\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                            <div flex></div>\n                            <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="CHATWEBSITES.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.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">{{ \'CHAT.ID\' | translate }}</th>\n                                    <th md-column md-order-by="createdAt">{{ \'CHAT.STARTEDAT\' | translate }}</th>\n                                    <th md-column md-order-by="closedAt">{{ \'CHAT.CLOSEDAT\' | translate }}</th>\n                                    <th md-column>{{ \'CHAT.CONTACT\' | translate }}</th>\n                                    <th md-column>{{ \'CHAT.AGENT\' | translate }}</th>\n                                    <th md-column md-order-by="disposition">{{ \'CHAT.DISPOSITION\' | translate }}</th>\n                                    <th md-column md-order-by="ratingValue">{{ \'CHAT.RATING\' | translate }}</th>\n                                    <th md-column md-order-by="note">{{ \'CHAT.NOTES\' | translate }}</th>\n                                    <th md-column md-order-by="tag">{{ \'CHAT.TAGS\' | translate }}</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">\n                                    <td md-cell>{{interaction.id}}</td>\n                                    <td md-cell>{{interaction.createdAt | date:\'medium\'}}</td>\n                                    <td md-cell>{{interaction.closedAt | date:\'medium\'}}</td>\n                                    <td md-cell>{{interaction.Contact.firstName}}</td>\n                                    <td md-cell>{{interaction.Owner.name}}</td>\n                                    <td md-cell>{{interaction.disposition}}</td>\n                                    <td md-cell>\n                                        <md-icon md-font-icon="icon-star" style="color:red" ng-show="interaction.ratingValue != null && (!interaction.ratingType || interaction.ratingType == \'star\')" ng-repeat="ratingValue in [1,2,3,4,5] | limitTo:interaction.ratingValue"></md-icon>\n                                        <md-icon md-font-icon="icon-thumb-up" style="color:green" ng-show="interaction.ratingValue != null && interaction.ratingType && interaction.ratingType == \'thumb\' && interaction.ratingValue == 1"></md-icon>\n                                        <md-icon md-font-icon="icon-thumb-down" style="color:red" ng-show="interaction.ratingValue != null && interaction.ratingType && interaction.ratingType == \'thumb\' && interaction.ratingValue == 0"></md-icon><span ng-show="interaction.ratingValue == null" translate="CHAT.NO_RATINGVALUE">No ratingValue</span>\n                                    </td>\n                                    <td md-cell>{{interaction.note}}</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"></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>\n                                                    <md-button class="md-primary" ng-click="vm_dc.chatInteractionDownload(interaction, $event)" translate="CHAT.DOWNLOAD_INTERACTION">\n                                                        Download Interaction\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="15">\n                                        <span class="text-boxed-ligth" translate="CHAT.NO_INTERACTION_AVAILABLE">No interaction available</span>\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)">\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                            <div flex></div>\n                            <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.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_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="CHATWEBSITES.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.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">{{ \'CHAT.ID\' | translate }}</th>\n                                    <th md-column md-order-by="ContactId">{{ \'CHAT.CONTACT\' | translate }}</th>\n                                    <th md-column md-order-by="createdAt">{{ \'CHAT.CREATED_AT\' | translate }}</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>{{offlineMessage.id}}</td>\n                                    <td md-cell>{{ (vm_dc.contacts | filter : {\'id\':offlineMessage.ContactId})[0].firstName }}</td>\n                                    <td md-cell>{{offlineMessage.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="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="5">\n                                        <span class="text-boxed-ligth" translate="CHAT.NO_OFFLINEMESSAGE_AVAILABLE">No offlinemessage available</span>\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/agents/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="CHAT.AGENTS">Agents</span>\n        <div flex></div>\n        <ms-search-bar on-search="vm.query.filter = query; vm.onInit()" on-collapse="vm.query.filter = undefined; vm.onInit()" debounce="300"></ms-search-bar>\n        <md-select ng-model="vm.query.globalStatusFilter" class="md-caption" ng-change="vm.query.pauseTypeFilter = \'\'; vm.onInit()">\n            <md-option ng-value="\'\'">{{ \'CHAT.ALL\' | translate }}</md-option>\n            <md-option value="pause">{{ \'CHAT.PAUSE\' | translate }}</md-option>\n            <md-option value="*pause">{{ \'CHAT.PARTIALPAUSE\' | translate }}</md-option>\n            <md-option value="busy">{{ \'CHAT.BUSY\' | translate }}</md-option>\n            <md-option value="idle">{{ \'CHAT.IDLE\' | translate }}</md-option>\n        </md-select>\n\n        <md-select ng-if="vm.isPause(vm.query.globalStatusFilter)" ng-model="vm.query.pauseTypeFilter" class="md-caption" ng-change="vm.onInit()">\n            <md-option ng-value="\'\'">All</md-option>\n            <md-option value="DEFAULT PAUSE">DEFAULT PAUSE</md-option>\n            <md-option value="ACW">ACW</md-option>\n            <md-option value="LOGININPAUSE">LOGININPAUSE</md-option>\n            <md-option value="Auto-Pause">AUTOPAUSE</md-option>\n            <md-option ng-value="pause.name" ng-repeat="pause in vm.pauses.rows">{{pause.name}}</md-option>\n        </md-select>\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.order" md-on-reorder="vm.onInit">\n            <tr md-row border="1">\n                <th class="bv text-center" colspan="4">{{ \'CHAT.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">{{ \'OPENCHANNEL.OPENCHANNEL\' | translate }}</th>\n                <th ng-if="vm.license.fax" class="bv bl text-center" colspan="2">{{ \'FAX.FAX\' | translate }}</th>\n                <th width="10px" class="bt bl" rowspan="2"></th>\n            </tr>\n            <tr md-row>\n                <th class="bl" md-column md-order-by="fullname">{{ \'CHAT.NAME\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="globalStatus">{{ \'CHAT.STATUS\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="lastLoginAt">{{ \'CHAT.LOGIN_TIME\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="lastPauseAt">{{ \'CHAT.PAUSE_TIME\' | translate }}</th>\n\n                <th class="bl custom-column">{{ \'VOICE.STATUS\' | translate }}</th>\n                <th class="bl custom-column">Info</th>\n\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\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\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\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\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            </tr>\n        </thead>\n        <tbody md-body>\n            <tr md-row ng-hide="vm.order.length">\n                <td md-cell colspan="17">\n                    <div layout="row" layout-align="center center">\n                        <span>{{ \'CHAT.NO_AGENT_ONLINE\' | translate }}</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-select="vm.agents[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td class="bt padding-5">\n                    <div layout="row" layout-align="start center">\n                        <img class="avatar" ng-src="{{vm.agents[value].userpic && \'api/users/\'+vm.agents[value].id+\'/avatar\' || \'assets/images/avatars/profile.png\'}}">\n                        <div layout="column">\n                            <span>{{vm.agents[value].fullname}}</span>\n                            <span>{{vm.agents[value].internal}}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class="bt">\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'}[vm.agents[value].globalStatus]\">{{ vm.isPause(vm.agents[value].globalStatus) ? '' : vm.agents[value].globalStatus | uppercase }} {{ vm.isPause(vm.agents[value].globalStatus) ? (vm.isPartialPause(vm.agents[value].globalStatus) ? '*'+vm.agents[value].pauseType || 'DEFAULT PAUSE'  : vm.agents[value].pauseType || 'DEFAULT PAUSE') : ''}}</span>\n                </td>\n                <td class=\"bt custom-column\">\n                    <timer start-time=\"vm.agents[value].lastLoginAt\" interval=\"1000\">{{ days > 0 ? days + 'd' : '' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                </td>\n                <td class=\"bt custom-column\">\n                    <timer ng-if=\"vm.isPause(vm.agents[value].globalStatus) || vm.isPartialPause(vm.agents[value].globalStatus)\" start-time=\"vm.agents[value].lastPauseAt\" interval=\"1000\">{{ days > 0 ? days + 'd' : '' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                </td>\n                <td class=\"bt bl\">\n                    <div layout=\"row\">\n                        <span ng-if=\"!vm.agents[value].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'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].voiceStatus | uppercase }}</span>\n                        <span ng-if=\"vm.agents[value].onhold\" class=\"text-boxed md-background-bg bl bt padding-5 orange-400-bg\">ONHOLD</span>\n                    </div>\n                </td>\n                <td class=\"bt bl\">\n                    <div layout=\"column\">\n                        <span ng-if=\"vm.agents[value].queue\" class=\"padding-5\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].queue }}</span>\n                        <span ng-if=\"vm.agents[value].destconnectedlinenum\" class=\"padding-5\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].destconnectedlinenum }}</span>\n                        <span class=\"padding-5\" ng-if=\"vm.agents[value].queue || vm.agents[value].destconnectedlinenum\">\n                            <timer start-time=\"vm.agents[value].voiceStatusTime\" interval=\"1000\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                        </span>\n                    </div>\n                </td>\n                <td class=\"bt bl\" ng-if=\"vm.license.chat\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].chatStatus]\">{{ vm.agents[value].chatStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td md-number class=\"bt text-center font-size-20\" ng-if=\"vm.license.chat\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].chatStatus]\">{{ vm.agents[value].chatCurrentCapacity }}</td>\n                <td class=\"bl bt\" ng-if=\"vm.license.mail\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].mailStatus]\">{{ vm.agents[value].mailStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.mail\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].mailStatus]\">{{ vm.agents[value].mailCurrentCapacity }}</td>\n                <td class=\"bl bt\" ng-if=\"vm.license.messaging\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].smsStatus]\">{{ vm.agents[value].smsStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.messaging\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].smsStatus]\">{{ vm.agents[value].smsCurrentCapacity }}</td>\n                <td class=\"bt bl\" ng-if=\"vm.license.openchannel\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].openchannelStatus]\">{{ vm.agents[value].openchannelStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.openchannel\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].openchannelStatus]\">{{ vm.agents[value].openchannelCurrentCapacity }}</td>\n                <td class=\"bt bl\" ng-if=\"vm.license.fax\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].faxStatus]\">{{ vm.agents[value].faxStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.fax\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].faxStatus]\">{{ vm.agents[value].faxCurrentCapacity }}</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\n                        <md-menu-content width=\"4\">\n                            <md-menu-item>\n                                <md-button ng-click=\"vm.logout(vm.agents[value], $event)\" translate=\"CHAT.LOGOUT\">\n                                    Logout\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-button ng-click=\"vm.queueAdd(vm.agents[value], $event)\" translate=\"CHAT.AGENTADD_QUEUE\">\n                                    Add Agent In Queue\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-menu>\n                                    <md-button ng-click=\"$mdMenu.open()\" class=\"text-capitalize\" translate=\"CHAT.PAUSE\">Pause</md-button>\n                                    <md-menu-content>\n                                        <md-menu-item>\n                                            <md-button ng-disabled=\" vm.agents[value].voicePause && 'DEFAULT PAUSE' === vm.agents[value].pauseType\" ng-click=\"vm.pause(vm.agents[value])\"><em translate=\"CHAT.DEFAULT_PAUSE\">Default Pause</em></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=\"vm.agents[value].voicePause && pause.name === vm.agents[value].pauseType\" ng-click=\"vm.pause(vm.agents[value], pause.name)\">{{pause.name}}</md-button>\n                                        </md-menu-item>\n                                    </md-menu-content>\n                                </md-menu>\n                            </md-menu-item>\n                            <md-menu-item ng-if=\"vm.isPause(vm.agents[value].globalStatus)\">\n                                <md-button ng-click=\"vm.unPause(vm.agents[value])\" translate=\"CHAT.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\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.filteredAgents.length}}\" md-on-paginate=\"vm.onInit\" md-page-select></md-table-pagination>\n\x3c!-- / AGENT TABLE --\x3e\n\x3c!-- / MAIN --\x3e"),e.put("app/main/apps/chat/views/realtime/queues/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="CHAT.QUEUES">Queues</span>\n        <div flex></div>\n        <ms-search-bar on-search="vm.query.filter = 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">{{ \'CHAT.NAME\' | translate }}</th>\n                <th md-column>{{ \'CHAT.LOGGED_IN\' | translate }}</th>\n                <th md-column>{{ \'CHAT.PAUSED\' | translate }}</th>\n                <th md-column>{{ \'CHAT.READY\' | translate }}</th>\n                <th md-column>{{ \'CHAT.WAITING\' | translate }}</th>\n                <th md-column width="10px"></th>\n            </tr>\n        </thead>\n        <tbody md-body>\n            <tr md-row ng-hide="vm.queues">\n                <td md-cell colspan="7">\n                    <div layout="row" layout-align="center center">\n                        <span tranlsate="CHAT.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-row md-select="vm.queues[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td md-cell>{{vm.queues[value].name}}</td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].loggedInDb || 0}} ({{vm.queues[value].loggedIn || 0}})</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].paused || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-16 grey-fg">{{vm.queues[value].available || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].waiting || 0}}</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="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.createOrEditChatQueue($event, vm.queues[value])" translate="CHAT.EDIT_QUEUE">\n                                    Edit Queue\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-button ng-click="vm.agentAdd($event, vm.queues[value])" translate="CHAT.AGENTSADD_QUEUE">\n                                    Add Agents to queue\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: \'{{\'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.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/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 animate-slide-down 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="COMPANIES.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="COMPANIES.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!-- 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                                <td md-cell class="actions">\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                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(company, $event)" translate="CONTACTMANAGER.EDIT_COMPANY">\n                                                    Edit Company\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.gotocontactsgoto(company, $event)" translate="CONTACTMANAGER.GOTOCONTACTS_COMPANY">\n                                                    goToContacts Company\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(company, $event)" translate="CONTACTMANAGER.DELETE_COMPANY">\n                                                    Delete Company\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.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 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="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 animate-slide-down 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" ms-scroll>\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">\n                                    <md-optgroup label="Lists">\n                                        <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n                                        <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">{{list.name}}</md-option>\n                                    </md-optgroup>\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 companie" flex="100" ng-model="vm.selectedCompany">\n                                    <md-optgroup label="Companies">\n                                        <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n                                        <md-option ng-value="company.id" ng-repeat="company in vm.companies.rows">{{company.name}}</md-option>\n                                    </md-optgroup>\n                                </md-select>\n                            </md-input-container>\n\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 placeholder="Select one or more tags" flex="100" ng-model="vm.query.tag" ng-change="vm.getContacts()" multiple>\n                                    <md-optgroup label="Tags">\n                                        <md-option ng-value="tag.id" ng-repeat="tag in vm.tags.rows">{{tag.name}}</md-option>\n                                    </md-optgroup>\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="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 tranlsate="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">{{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">{{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">{{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="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"></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-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 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            <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>\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">\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">\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">\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">\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">\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-init="vm.getCustomFields(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\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 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\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]"></mdp-time-picker>\n                    </div>\n                </div>\n\n                <div ng-switch-when="select">\n                    <label>{{customField.alias}}</label>\n\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\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-optgroup label="Companies">\n                        <md-option ng-value="company.id" ng-repeat="company in vm.companies.rows">{{company.name}}</md-option>\n                    </md-optgroup>\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 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"></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 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 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            <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 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 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" 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</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">\n\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">\n                                        </md-input-container>\n\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">\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">\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">\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 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">\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</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}}</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]"></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}}</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                    </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="scheduledat">{{ \'CONTACTMANAGER.SCHEDULEDAT\' | 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="4">\n                                                <div layout="row" layout-align="center center">\n                                                    <span tranlsate="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>{{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 tranlsate="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>{{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 tranlsate="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>{{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 tranlsate="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="interaction-content">\n                        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.html\'"></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 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>\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 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            <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 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="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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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 animate-slide-down 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="GLOBALCUSTOMFIELDS.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="GLOBALCUSTOMFIELDS.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!-- 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                                <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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editdialog(globalCustomField, $event)" translate="CONTACTMANAGER.EDIT_GLOBALCUSTOMFIELD">\n                                                    Edit GlobalCustomField\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(globalCustomField, $event)" translate="CONTACTMANAGER.DELETE_GLOBALCUSTOMFIELD">\n                                                    Delete GlobalCustomField\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.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 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="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"></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 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="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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="LISTS.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.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">{{ \'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 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>{{customField.id}}</td>\n                                            <td ng-click="vm_dc.createOrEditListCustomField($event, customField)" md-cell>{{customField.alias}}</td>\n                                            <td ng-click="vm_dc.createOrEditListCustomField($event, customField)" md-cell>{{ vm_dc.arraytype[customField.type].option }}</td>\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="7">\n                                                <span class="text-boxed-ligth" translate="CONTACTMANAGER.NO_CUSTOMFIELD_AVAILABLE">No customfield available</span>\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 class="list-detail-form-container voicedispositions md-background-bg md-whiteframe-1dp">\n                        <div ng-controller="ListVoiceDispositionsController 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.selectedListVoiceDispositions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead" translate="CONTACTMANAGER.VOICEDISPOSITIONS">VoiceDispositions</span>\n                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\n                                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditListVoiceDisposition($event)" aria-label="add voiceDisposition" translate translate-attr-label="CONTACTMANAGER.ADD_VOICEDISPOSITION">\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.selectedListVoiceDispositions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead">{{vm_dc.selectedListVoiceDispositions.length}} {{vm_dc.selectedListVoiceDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                                    <div flex></div>\n                                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedListVoiceDispositions" 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.deleteSelectedListVoiceDispositions($event)" aria-label="delete selected" translate translate-attr-label="LISTS.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.selectedListVoiceDispositions" md-progress="vm_dc.promise">\n                                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getListVoiceDispositions">\n                                        <tr md-row>\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="createdAt">{{ \'CONTACTMANAGER.CREATED_AT\' | translate }}</th>\n                                            <th md-column width="10px"></th>\n                                        </tr>\n                                    </thead>\n                                    <tbody md-body>\n                                        <tr md-row md-select="voiceDisposition" md-select-id="id" ng-repeat="voiceDisposition in vm_dc.listVoiceDispositions.rows">\n                                            <td ng-click="vm_dc.createOrEditListVoiceDisposition($event, voiceDisposition)" md-cell>{{voiceDisposition.id}}</td>\n                                            <td ng-click="vm_dc.createOrEditListVoiceDisposition($event, voiceDisposition)" md-cell>{{voiceDisposition.name}}</td>\n                                            <td ng-click="vm_dc.createOrEditListVoiceDisposition($event, voiceDisposition)" md-cell>{{voiceDisposition.createdAt | date:\'medium\'}}</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.createOrEditListVoiceDisposition($event, voiceDisposition)" translate="CONTACTMANAGER.EDIT_VOICEDISPOSITION">\n                                                                Edit VoiceDisposition\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(voiceDisposition, $event)" translate="CONTACTMANAGER.DELETE_VOICEDISPOSITION">\n                                                                Delete VoiceDisposition\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.listVoiceDispositions.rows.length">\n                                            <td md-cell colspan="5">\n                                                <span class="text-boxed-ligth" translate="CONTACTMANAGER.NO_VOICEDISPOSITION_AVAILABLE">No voicedisposition available</span>\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.listVoiceDispositions.count}}" md-on-paginate="vm_dc.getListVoiceDispositions" 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/contactmanager/views/lists/edit/voiceDispositions/dialog.html",'<md-dialog class="voiceDisposition-dialog" aria-label="New VoiceDisposition">\n    <form name="voiceDispositionForm" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="CONTACTMANAGER.NAME">Name</label>\n                <input type="" name="name" ng-model="vm.voiceDisposition.name" ng-required="true" autofocus>\n\n                <div ng-messages="voiceDispositionForm[\'name\'].$error" ng-show="voiceDispositionForm[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.newVoiceDisposition" ng-click="vm.saveVoiceDisposition()" class="send-button md-accent md-raised" ng-disabled="voiceDispositionForm.$invalid || voiceDispositionForm.$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.newVoiceDisposition" ng-click="vm.addNewVoiceDisposition()" class="send-button md-accent md-raised" ng-disabled="voiceDispositionForm.$invalid" aria-label="ADD" translate="CONTACTMANAGER.ADD_VOICEDISPOSITION" translate-attr-aria-label="CONTACTMANAGER.ADD_VOICEDISPOSITION">\n                    ADD VOICEDISPOSITION\n                </md-button>\n            </div>\n            <div layout="row">\n                <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newVoiceDisposition" ng-click="vm.deleteVoiceDisposition($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/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 animate-slide-down 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="LISTS.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="LISTS.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!-- 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                                <td md-cell class="actions">\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                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(list, $event)" translate="CONTACTMANAGER.EDIT_LIST">\n                                                    Edit List\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.gotocontactsgoto(list, $event)" translate="CONTACTMANAGER.GOTOCONTACTS_LIST">\n                                                    goToContacts List\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.exportcsvcontactsexport(list, $event)" translate="CONTACTMANAGER.EXPORTCSVCONTACTS_LIST">\n                                                    exportCsvContacts List\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.agentadddialog(list, $event)" translate="CONTACTMANAGER.AGENTADD_LIST">\n                                                    AgentAdd List\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(list, $event)" translate="CONTACTMANAGER.DELETE_LIST">\n                                                    Delete List\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.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                <div layout="column">\n                    <span class="font-size-10" translate="DASHBOARDS.FILTER_VOICE_QUEUES">Filter Voice Queues</span>\n                    <md-select placeholder="Select one or more queues" class="font-size-12 no-margin w-200" md-on-close="vm.onChangeVoiceQueues()" ng-model="vm.voiceQueuesSelected" multiple aria-label="voiceQueues">\n                        <md-option ng-value="voiceQueue.id" ng-repeat="voiceQueue in vm.voiceQueues.rows">{{ voiceQueue.name }}</md-option>\n                    </md-select>\n                </div>\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/general/agent/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/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" 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\'"></md-icon>\n                    <span class="text-truncate font-size-12" ng-class="vm.isActiveTab(tab.id) ? \'black-fg\' : \'grey-300-fg\'">\n                        {{tab.title}} <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)">\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    <div layout="row" class="agent-content" ng-if="vm.isActiveTab(0)" ng-style="{\'top\': vm.detectBrowser.browser == \'safari\' ? \'100px\' : \'36px\'}" 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    <div ng-if="!vm.isActiveTab(0)" ng-repeat="(key, tab) in vm.tabs" ng-switch="tab.type">\n        <div ng-switch-when="contact">\n            <div class="agent-content" ms-scroll ng-if="vm.isActiveTab(tab.id)" ng-style="{\'top\': vm.detectBrowser.browser == \'safari\' ? \'100px\' : \'36px\'}" 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">\n            <div ng-if="vm.isActiveTab(tab.id)" ms-scroll 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">\n            <div class="agent-content" ms-scroll ng-if="vm.isActiveTab(tab.id)" ng-style="{\'top\': vm.detectBrowser.browser == \'safari\' ? \'100px\' : \'36px\'}" 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">\n            <div id="interaction-app" ng-if="vm.isActiveTab(tab.id)" class="agent-content" ng-style="{\'top\': vm.detectBrowser.browser == \'safari\' ? \'100px\' : \'36px\'}" 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">\n            <div id="interaction-app" ng-if="vm.isActiveTab(tab.id)" class="agent-content" ng-style="{\'top\': vm.detectBrowser.browser == \'safari\' ? \'100px\' : \'36px\'}" 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)"></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                            \x3c!-- <div layout="row" layout-align="center center" class="blue-grey-300-fg padding-left-40"\n                                    ng-if="!vm.interaction.closed">\n                                    <timer start-time="vm.interaction.createdAt" interval="1000">{{ days > 0 ? days + \'d\' :\n                                        \'\' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                                    <md-icon md-font-icon="icon-timelapse" class="s16 padding-left-5"></md-icon>\n                                </div> --\x3e\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 ms-scroll 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">\n                    \x3c!-- MS-CARD --\x3e\n                    <md-card class="template-7" layout="row" layout-align="space-between" ng-repeat="call in vm.tab.calls track by call.uniqueid">\n                        <div class="info" layout="column" layout-align="space-between" layout-fill flex>\n                            <div layout="row">\n                                <span ng-if="call.answeredAt" class="text-boxed indigo-100-bg">\n                                    <timer start-time="call.answeredAt" interval="1000">{{ days > 0 ? days + \'d\' : \'\' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                                </span>\n                                <div flex></div>\n                                <span ng-if="call.disposedAt" class="text-boxed amber-200-bg">\n                                    <timer start-time="call.disposedAt" interval="1000">{{ days > 0 ? days + \'d\' : \'\' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                                </span>\n                            </div>\n                            <div class="p-16">\n                                <div class="title h1">\n                                    <md-icon ng-if="!call.routeId" md-font-icon="icon-phone-incoming"></md-icon>\n                                    <md-icon ng-if="call.routeId" md-font-icon="icon-phone-outgoing"></md-icon>\n                                    {{ call.routeId ? call.destcalleridnum : call.calleridnum }}\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"></md-icon>\n                                    Name: {{ call.calleridname }}\n                                </div>\n\n                                <div class="text h4 pt-8" ng-if="call.queue">\n                                    <md-icon md-font-icon="icon-stackoverflow"></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"></md-icon>\n                                    Extra: {{call.variables.extravar}}\n                                </div>\n                            </div>\n                            <div layout="row" layout-align="end center">\n                                <md-button ng-if="call.disposedAt" type="submit" ng-click="vm.disposeCall($event, call)" class="send-button md-accent md-raised">\n                                    {{ \'DASHBOARDS.DISPOSE\' | translate}}\n                                </md-button>\n                            </div>\n                        </div>\n                    </md-card>\n                    \x3c!-- / MS-CARD --\x3e\n                    <div flex layout="row" layout-align="end 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">PERSONAL_INFO</div>\n                            <div class="subtitle secondary-text">\n                                <span translate="CONTACTMANAGER.CREATED_AT"></span> <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>\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 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)" aria-label="jscripty">\n                                                    <md-icon md-font-icon="icon-script"></md-icon>\n                                                </md-button>\n\n                                                <md-menu-content>\n                                                    <md-menu-item ng-if="vm.jscriptyProjects && vm.jscriptyProjects.rows.length" 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> {{project.name}}\n                                                        </md-button>\n                                                    </md-menu-item>\n                                                    <md-menu-item ng-if="!vm.jscriptyProjects || !vm.jscriptyProjects.rows.length">\n                                                        <md-button disabled="disabled" translate="DASHBOARDS.NO_JSCRIPTY_PROJECTS_AVAILABLE">\n                                                            <md-icon md-font-icon="icon-script"></md-icon> No jscripty projects available\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">\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">\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">\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)" aria-label="sms">\n                                                    <md-icon md-font-icon="icon-message-text"></md-icon>\n                                                </md-button>\n\n                                                <md-menu-content>\n                                                    <md-menu-item ng-if="vm.smsAccounts && vm.smsAccounts.rows.length" 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> {{account.name}}\n                                                        </md-button>\n                                                    </md-menu-item>\n                                                    <md-menu-item ng-if="!vm.smsAccounts || !vm.smsAccounts.rows.length">\n                                                        <md-button disabled="disabled" translate="DASHBOARDS.NO_SMS_ACCOUNTS_AVAILABLE">\n                                                            <md-icon md-font-icon="icon-message-text"></md-icon> No sms accounts available\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">\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 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)" aria-label="email">\n                                                    <md-icon md-font-icon="icon-email"></md-icon>\n                                                </md-button>\n\n                                                <md-menu-content>\n                                                    <md-menu-item ng-if="vm.mailAccounts && vm.mailAccounts.rows.length" 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> {{account.name}}\n                                                        </md-button>\n                                                    </md-menu-item>\n                                                    <md-menu-item ng-if="!vm.mailAccounts || !vm.mailAccounts.rows.length">\n                                                        <md-button disabled="disabled" translate="DASHBOARDS.NO_MAIL_ACCOUNTS_AVAILABLE">\n                                                            <md-icon md-font-icon="icon-email"></md-icon> No email accounts available\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">\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)" aria-label="fax">\n                                                    <md-icon md-font-icon="icon-deskphone"></md-icon>\n                                                </md-button>\n\n                                                <md-menu-content>\n                                                    <md-menu-item ng-if="vm.faxAccounts && vm.faxAccounts.rows.length" 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> {{account.name}}\n                                                        </md-button>\n                                                    </md-menu-item>\n                                                    <md-menu-item ng-if="!vm.faxAccounts || !vm.faxAccounts.rows.length">\n                                                        <md-button disabled="disabled" translate="DASHBOARDS.NO_FAX_ACCOUNTS_AVAILABLE">\n                                                            <md-icon md-font-icon="icon-deskphone"></md-icon> No fax accounts available\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                                    <md-input-container class="md-block" flex-gt-sm="" ng-init="vm.contact.dateOfBirth = vm.getDateFromString(vm.contact.dateOfBirth)">\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                                </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}}</md-option>\n                                            <md-option ng-value="null"><em translate="DASHBOARDS.NONE">None</em></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">{{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></form>\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 FIELDS</div>\n                            <form name="vm.customFieldsForm" novalidate>\n\n                                \x3c!-- START INPUT LIST --\x3e\n                                <md-input-container class="md-block" ng-if="!vm.contact.ListId">\n                                    <label translate translate-attr-placeholder="DASHBOARDS.LIST">List</label>\n                                    <md-select name="list" 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.tab.userLists.rows">#{{list.id}} - {{list.name}}</md-option>\n                                        </md-optgroup>\n                                    </md-select>\n                                </md-input-container>\n                                <md-input-container class="md-block" ng-if="vm.contact.ListId">\n                                    <label translate translate-attr-placeholder="DASHBOARDS.LIST">List</label>\n                                    <md-select ng-disabled="!vm.newContact" name="list" ng-model="vm.contact.ListId" required>\n                                        <md-optgroup label="Lists">\n                                            <md-option ng-value="list.id" ng-repeat="list in vm.tab.lists.rows">#{{list.id}} - {{list.name}}</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]"></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]"></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">{{value.value}}</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}}<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                                        <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                                </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="interaction-content">\n                <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.html\'"></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()">\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 ms-scroll>\n            <div ng-if="!vm.isReschedule">\n                <md-input-container class="md-block">\n                    <label translate="DASHBOARDS.DISPOSITIONS">Dispositions</label>\n                    <md-select name="disposition" ng-model="vm.choice" required>\n                        <md-option ng-value="g.name" ng-repeat="g in vm.dispositions.rows">{{ g.name }}</md-option>\n                        <md-option ng-value="gd.name" ng-repeat="gd in vm.globalDispositions.rows">{{ gd.name }}</md-option>\n                    </md-select>\n                </md-input-container>\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\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" 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" 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                <md-input-container ng-if="!vm.dialerCall" class="md-block">\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">{{ queueCampaign.name }} ({{ queueCampaign.dialActive ? \'Active\' : \'Not Active\' }})</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        </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()">\n                {{(vm.choice ? \'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 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 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/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="Voice">\n                <div ng-controller="AgentHomeAbandonedVoiceController as vm_voice">\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\'" class="md-padding">\n                    </md-content>\n                </div>\n            </md-tab>\n            <md-tab ng-if="vm_home.hasPermission(110) && vm_home.license.dialer" label="Bull">\n                <div ng-controller="AgentHomeAbandonedBullController as vm_bull">\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\'" class="md-padding">\n                    </md-content>\n                </div>\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 ngCloak>\n    <md-toolbar class="md-table-toolbar md-default table-header blue-bg">\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.query.filter = query" on-collapse="vm_bull.query.filter = undefined" debounce="300"></ms-search-bar>\n            <div flex></div>\n            <div class="padding-horizontal-20" layout="column" layout-align="center center">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_DATE">Select a date</span>\n                <div layout="row" layout-align="center center">\n                    <md-button ng-if="vm_bull.pickerModel.dateStart" ng-click="vm_bull.clearAll()" class="md-icon-button no-padding width-20 height-20">\n                        <md-tooltip>{{ \'DASHBOARDS.DELETE\' | translate }}</md-tooltip>\n                        <md-icon md-font-icon="icon-close" class="s16 white-fg"></md-icon>\n                    </md-button>\n                    <md-date-range localization-map="vm_bull.localizationMap" ng-model="vm_bull.pickerModel" auto-confirm="true" show-template="true" md-on-select="vm_bull.getAbandonedCalls()" placeholder="{{ \'DASHBOARDS.ALL\' | translate }}"></md-date-range>\n                </div>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_AGENT">Select an agent</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm_bull.query.lastAssignedTo" ng-change="vm_bull.getAbandonedCalls()">\n                    <md-option ng-value="vm_bull.currentUser.name" translate="DASHBOARDS.ME"></md-option>\n                    <md-option ng-value="\'null\'" translate="DASHBOARDS.NOT_ASSIGNED"></md-option>\n                    <md-option ng-value="undefined" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div ng-if="vm_bull.queues.count" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_CAMPAIGN">Select a Campaign</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm_bull.query.queue" ng-change="vm_bull.getAbandonedCalls()">\n                    <md-option ng-value="vm_bull.defaultQueues" ng-if="vm_bull.queues.count > 1"><em translate="DASHBOARDS.ALL">All</em></md-option>\n                    <md-option ng-value="queue.name" ng-repeat="queue in vm_bull.queues.rows">{{queue.name}}</md-option>\n                </md-select>\n            </div>\n            <md-button class="md-icon-button interaction-reload" 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">{{\'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">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="disposition">{{\'DASHBOARDS.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="10">\n                        <div layout="row" layout-align="center center">\n                            <span tranlsate="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">{{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"></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">{{abandonedCall.queuecallerabandonAt ? (abandonedCall.queuecallerabandonAt | formatdate) : undefined }}</td>\n                    <td md-cell class="list">{{abandonedCall.queuecallerexitAt ? (abandonedCall.queuecallerexitAt | formatdate) : undefined }}</td>\n                    <td md-cell class="list">{{abandonedCall.queuecallerexitreason}}</td>\n                    <td md-cell class="list">{{abandonedCall.disposition}}</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, abandonedCall.disposition)"></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-menu>\n                                        <md-button ng-click="$mdMenu.open()" class="text-capitalize" translate="DASHBOARDS.DISPOSE">Dispose</md-button>\n                                        <md-menu-content>\n                                            <md-menu-item ng-if="vm_bull.disposition.length" ng-repeat="disposition in vm_bull.disposition">\n                                                <md-button ng-click="vm_bull.reserved(abandonedCall, disposition.name)">{{disposition.name}}</md-button>\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\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\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/abandoned/voice/agent.general.abandoned.voice.html",'<md-card ngCloak>\n    <md-toolbar class="md-table-toolbar md-default table-header blue-bg">\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.query.filter = query" on-collapse="vm_voice.query.filter = undefined" debounce="300"></ms-search-bar>\n            <div flex></div>\n            <div class="padding-horizontal-20" layout="column" layout-align="center center">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_DATE">Select a date</span>\n                <div layout="row" layout-align="center center">\n                    <md-button ng-if="vm_voice.pickerModel.dateStart" ng-click="vm_voice.clearAll()" class="md-icon-button no-padding width-20 height-20">\n                        <md-tooltip>{{ \'DASHBOARDS.DELETE\' | translate }}</md-tooltip>\n                        <md-icon md-font-icon="icon-close" class="s16 white-fg"></md-icon>\n                    </md-button>\n                    <md-date-range localization-map="vm_voice.localizationMap" ng-model="vm_voice.pickerModel" auto-confirm="true" show-template="true" md-on-select="vm_voice.getAbandonedCalls()" placeholder="{{ \'DASHBOARDS.ALL\' | translate }}"></md-date-range>\n                </div>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_AGENT">Select an agent</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm_voice.query.lastAssignedTo" ng-change="vm_voice.getAbandonedCalls()">\n                    <md-option ng-value="vm_voice.currentUser.name" translate="DASHBOARDS.ME"></md-option>\n                    <md-option ng-value="\'null\'" translate="DASHBOARDS.NOT_ASSIGNED"></md-option>\n                    <md-option ng-value="undefined" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div ng-if="vm_voice.queues.count" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_CAMPAIGN">Select a Campaign</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm_voice.query.queue" ng-change="vm_voice.getAbandonedCalls()">\n                    <md-option ng-value="vm_voice.defaultQueues" ng-if="vm_voice.queues.count > 1"><em translate="DASHBOARDS.ALL">All</em></md-option>\n                    <md-option ng-value="queue.name" ng-repeat="queue in vm_voice.queues.rows">{{queue.name}}</md-option>\n                </md-select>\n            </div>\n            <md-button class="md-icon-button interaction-reload" 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">{{\'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">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="disposition">{{\'DASHBOARDS.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="10">\n                        <div layout="row" layout-align="center center">\n                            <span tranlsate="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">{{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"></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">{{abandonedCall.queuecallerabandonAt ? (abandonedCall.queuecallerabandonAt | formatdate) : undefined }}</td>\n                    <td md-cell class="list">{{abandonedCall.disposition}}</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, abandonedCall.disposition)"></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-menu>\n                                        <md-button ng-click="$mdMenu.open()" class="text-capitalize" translate="DASHBOARDS.DISPOSE">Dispose</md-button>\n                                        <md-menu-content>\n                                            <md-menu-item ng-if="vm_voice.disposition.length" ng-repeat="disposition in vm_voice.disposition">\n                                                <md-button ng-click="vm_voice.reserved(abandonedCall, disposition.name)">{{disposition.name}}</md-button>\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\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\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="md-primary-bg width-50" ms-scroll>\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" 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></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 ng-switch="vm_home.sidebar" style="overflow-y: auto" flex>\n    <div ng-switch-when="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\'"></div>\n    </div>\n    <div ng-switch-when="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\'"></div>\n    </div>\n    <div ng-switch-when="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\'"></div>\n    </div>\n    <div ng-switch-when="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\'"></div>\n    </div>\n    <div ng-switch-when="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\'"></div>\n    </div>\n    <div ng-switch-when="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\'"></div>\n    </div>\n    <div ng-switch-when="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)"></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\'"></div>\n    </div>\n    <div ng-switch-when="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)"></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\'"></div>\n    </div>\n    <div ng-switch-when="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)"></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\'"></div>\n    </div>\n    <div ng-switch-when="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)"></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\'"></div>\n    </div>\n    <div ng-switch-when="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)"></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\'"></div>\n    </div>\n    <div ng-switch-when="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\'"></div>\n    </div>\n    <div ng-switch-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\'"></div>\n    </div>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/chat/agent.general.chat.html",'<md-card ngCloak>\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm.getColorByChannel(\'chat\')">\n        <div class="md-toolbar-tools">\n            <span class="md-subhead" translate="DASHBOARDS.INTERACTIONS">Interactions</span>\n            <ms-search-bar on-search="vm.query.filter = query" on-collapse="vm.query.filter = undefined" debounce="300"></ms-search-bar>\n            <div flex></div>\n            <div class="padding-horizontal-20" layout="column" layout-align="center center">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_DATE">Select a date</span>\n                <div layout="row" layout-align="center center">\n                    <md-button ng-if="vm.pickerModel.dateStart" ng-click="vm.clearAll()" class="md-icon-button no-padding width-20 height-20">\n                        <md-tooltip>{{ \'DASHBOARDS.DELETE\' | translate }}</md-tooltip>\n                        <md-icon md-font-icon="icon-close" class="s16 white-fg"></md-icon>\n                    </md-button>\n                    <md-date-range localization-map="vm.localizationMap" ng-model="vm.pickerModel" auto-confirm="true" show-template="true" md-on-select="vm.getChatInteractions()" placeholder="{{ \'DASHBOARDS.ALL\' | translate }}"></md-date-range>\n                </div>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_READ_UNREAD">Select Read/Unread</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.read" ng-change="vm.getChatInteractions()">\n                    <md-option value="0" translate="DASHBOARDS.UNREAD">READ</md-option>\n                    <md-option value="1" translate="DASHBOARDS.READ">UNREAD</md-option>\n                    <md-option ng-value="null" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_STATUS">Select a status</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.closed" ng-change="vm.getChatInteractions()">\n                    <md-option value="0" translate="DASHBOARDS.OPENED">OPENED</md-option>\n                    <md-option value="1" translate="DASHBOARDS.CLOSED">CLOSED</md-option>\n                    <md-option ng-value="null" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_WEBSITE">Select an account</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.account" ng-change="vm.getChatInteractions()">\n                    <md-option ng-value="chatAccount.id" ng-repeat="chatAccount in vm.chatAccounts.rows">{{chatAccount.name}}</md-option>\n                    <md-option ng-value="null" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_AGENT">Select an agent</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.UserId" ng-change="vm.getChatInteractions()">\n                    <md-option ng-value="vm.user.id" translate="DASHBOARDS.ME"></md-option>\n                    <md-option ng-value="\'null\'" translate="DASHBOARDS.NOT_ASSIGNED"></md-option>\n                    <md-option ng-value="undefined" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_TAG">Select a tag</span>\n                <md-select id="tags" placeholder="Tags" multiple="true" class="font-size-12 no-margin" ng-model="vm.query.tag" ng-change="vm.getChatInteractions()" style="color:white;">\n                    <md-option ng-repeat="tag in vm.tags.rows" ng-value="tag.id">{{tag.name}}</md-option>\n                </md-select>\n            </div>\n            <div layout="column">\n                <md-button class="md-icon-button interaction-reload" 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-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.getChatInteractions">\n                <tr md-row>\n                    <th md-column md-order-by="id">ID</th>\n                    <th md-column style="width:15px">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                    </th>\n                    <th md-column style="width:180px">{{\'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 style="width:80px">{{\'DASHBOARDS.AGENT\' | translate}}</th>\n                    <th md-column>{{\'DASHBOARDS.WEBSITE\' | 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.chatInteractions.rows.length">\n                    <td md-cell colspan="10">\n                        <div layout="row" layout-align="center center">\n                            <span tranlsate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available Interaction</span>\n                        </div>\n                    </td>\n                </tr>\n                <tr md-row ng-repeat="chatInteraction in vm.chatInteractions.rows" ng-class="{\'text-bold text-italic\': chatInteraction.unread}">\n                    <td ng-click="vm.showChatInteraction($event, chatInteraction)" md-cell class="id">\n                        <div layout="row" layout-align="start center">\n                            <span class="font-size-10">{{chatInteraction.id}}</span>\n                        </div>\n                    </td>\n                    <td md-cell>\n                        <div ng-if="!chatInteraction.closed && chatInteraction.Users.length">\n                            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                            <md-tooltip>\n                                <span ng-repeat="u in chatInteraction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : vm.usersByKey[u.id].fullname | translate }}<span ng-if="!$last">, </span></span>\n                            </md-tooltip>\n                        </div>\n                    </td>\n                    <td ng-click="vm.showChatInteraction($event, chatInteraction)" md-cell>\n                        <div layout="row" layout-align="start center">\n                            <div layout="column">\n                                <span ng-if="!chatInteraction.closed && chatInteraction.unread" class="badge white-fg" ng-class="vm.getColorByChannel(\'chat\')" layout-margin>{{chatInteraction.unread}}</span>\n                                <md-icon ng-if="chatInteraction.attach" md-font-icon="icon-paperclip" class="s16"></md-icon>\n                            </div>\n                            <span class="font-size-12 text-truncate" style="width:180px" layout-margin>{{vm.getContactLabel(chatInteraction)}}</span>\n                        </div>\n                    </td>\n                    <td ng-click="vm.showChatInteraction($event, chatInteraction)" md-cell>\n                        <span class="font-size-10 text-truncate">{{chatInteraction.createdAt | formatdate }}</span>\n                    </td>\n                    <td ng-click="vm.showChatInteraction($event, chatInteraction)" md-cell>\n                        <div layout="row" ng-if="chatInteraction.lastMsgAt">\n                            <span>\n                                <md-icon md-font-icon="{{chatInteraction.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="font-size-10 text-truncate">{{chatInteraction.lastMsgAt | formatdate }}</span>\n                            </div </div> <span ng-if="!chatInteraction.lastMsgAt">No messages</span>\n                    </td>\n                    <td ng-click="vm.showChatInteraction($event, chatInteraction)" md-cell>\n                        <span ng-if="chatInteraction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="chatInteraction.disposition">- {{chatInteraction.disposition}}</span></span>\n                        <md-tooltip ng-if="chatInteraction.closed">{{chatInteraction.closedAt | formatdate }}</md-tooltip>\n                        <span ng-if="!chatInteraction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="chatInteraction.substatus"> - {{chatInteraction.substatus}}</span></span>\n                    </td>\n                    <td ng-click="vm.showChatInteraction($event, chatInteraction)" md-cell class="user">\n                        <span class="font-size-12 text-truncate" style="width:120px">{{vm.getUserLabel(chatInteraction)}}</span>\n                    </td>\n                    <td ng-click="vm.showChatInteraction($event, chatInteraction)" md-cell class="chatAccount">\n                        {{ vm.getChatWebsiteLabel(chatInteraction) }}\n                    </td>\n                    <td md-cell>\n                        <div ng-if="chatInteraction.Tags.length">\n                            <div ng-if="chatInteraction.Tags.length == 1" layout="column" layout-align="center center">\n                                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': chatInteraction.Tags[0].color }"></md-icon>\n                                <span class="text-truncate">{{chatInteraction.Tags[0].name}}</span>\n                            </div>\n                            <div ng-if="chatInteraction.Tags.length > 1" layout="column" layout-align="center center">\n                                <md-tooltip md-direction="left" layout="row">\n                                    <span ng-repeat="tag in chatInteraction.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">\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="2">\n                                <md-menu-item>\n                                    <md-button ng-click="vm.showChatInteraction($event, chatInteraction)" translate="DASHBOARDS.SHOW">\n                                        Show Chat\n                                    </md-button>\n                                </md-menu-item>\n                                <md-menu-item>\n                                    <md-button ng-click="vm.downloadChatInteraction($event, chatInteraction)" translate="DASHBOARDS.DOWNLOAD">\n                                        Download Chat\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: \'{{\'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>\n    <md-toolbar class="md-table-toolbar md-default table-header red-bg">\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.query.filter = query" on-collapse="vm.query.filter = undefined" debounce="300"></ms-search-bar>\n            <div flex></div>\n            <div layout="column">\n                <span class="font-size-10" translate="CONTACTMANAGER.SELECT_LIST">Select a list</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.ListId" ng-change="vm.getContacts()">\n                    <md-option ng-value="vm.defaultLists" ng-if="vm.lists.count > 1"><em translate="CONTACTMANAGER.ALL_CONTACTS">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            </div>\n            <div layout="column">\n                <span class="font-size-10" translate="CONTACTMANAGER.SELECT_TAG">Select a tag</span>\n                <md-select id="tags" placeholder="Tags" multiple="true" class="font-size-12 no-margin" ng-model="vm.query.tag" ng-change="vm.getContacts()" style="color:white;">\n                    <md-option ng-repeat="tag in vm.tags.rows" ng-value="tag.id">{{tag.name}}</md-option>\n                </md-select>\n            </div>\n            <md-button class="md-icon-button interaction-reload" 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-button>\n            <md-button ng-if="vm.crudPermissions.canEdit" class="md-icon-button interaction-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    </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">ID</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="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 tranlsate="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">{{contact.firstName}} {{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($event, 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">{{contact.fax}}</td>\n                    <td ng-click="vm.openContact(contact.id)" md-cell class="email">{{contact.email}}</td>\n                    <td ng-click="vm.openContact(contact.id)" md-cell class="list">{{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">, </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="Voice">\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="Bull">\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="Chat">\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="Email">\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="Sms">\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="Open Channel">\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="Fax">\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-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" ngCloak>\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 tranlsate="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 tranlsate="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>{{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></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" ngCloak>\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                        \x3c!-- <th md-column>{{ \'VOICE.ACTIVE\' | translate }}</th> --\x3e\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_chat.getSize(vm_chat.chatQueues)">\n                        <td md-cell colspan="2">\n                            <div layout="row" layout-align="center center">\n                                <span tranlsate="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                        \x3c!-- <td md-cell class="dialActive ">\n                            <md-icon ng-if="queue.type === \'outbound\'" md-colors="{color: {{queue.dialActive ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{queue.dialActive ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                            <md-icon ng-if="queue.type === \'inbound\'" md-colors="{color: \'green\'}" md-font-icon="icon-check"></md-icon>\n                        </td> --\x3e\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 tranlsate="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" ngCloak>\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                        \x3c!-- <th md-column>{{ \'VOICE.ACTIVE\' | translate }}</th> --\x3e\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_fax.getSize(vm_fax.faxQueues)">\n                        <td md-cell colspan="2">\n                            <div layout="row" layout-align="center center">\n                                <span tranlsate="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                        \x3c!-- <td md-cell class="dialActive ">\n                            <md-icon ng-if="queue.type === \'outbound\'" md-colors="{color: {{queue.dialActive ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{queue.dialActive ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                            <md-icon ng-if="queue.type === \'inbound\'" md-colors="{color: \'green\'}" md-font-icon="icon-check"></md-icon>\n                        </td> --\x3e\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 tranlsate="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" ngCloak>\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                        \x3c!-- <th md-column>{{ \'VOICE.ACTIVE\' | translate }}</th> --\x3e\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_mail.getSize(vm_mail.mailQueues)">\n                        <td md-cell colspan="2">\n                            <div layout="row" layout-align="center center">\n                                <span tranlsate="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                        \x3c!-- <td md-cell class="dialActive ">\n                            <md-icon ng-if="queue.type === \'outbound\'" md-colors="{color: {{queue.dialActive ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{queue.dialActive ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                            <md-icon ng-if="queue.type === \'inbound\'" md-colors="{color: \'green\'}" md-font-icon="icon-check"></md-icon>\n                        </td> --\x3e\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 tranlsate="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" ngCloak>\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                        \x3c!-- <th md-column>{{ \'VOICE.ACTIVE\' | translate }}</th> --\x3e\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_openchannel.getSize(vm_openchannel.openchannelQueues)">\n                        <td md-cell colspan="2">\n                            <div layout="row" layout-align="center center">\n                                <span tranlsate="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                        \x3c!-- <td md-cell class="dialActive ">\n                            <md-icon ng-if="queue.type === \'outbound\'" md-colors="{color: {{queue.dialActive ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{queue.dialActive ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                            <md-icon ng-if="queue.type === \'inbound\'" md-colors="{color: \'green\'}" md-font-icon="icon-check"></md-icon>\n                        </td> --\x3e\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 tranlsate="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" ngCloak>\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                        \x3c!-- <th md-column>{{ \'VOICE.ACTIVE\' | translate }}</th> --\x3e\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_sms.getSize(vm_sms.smsQueues)">\n                        <td md-cell colspan="2">\n                            <div layout="row" layout-align="center center">\n                                <span tranlsate="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                        \x3c!-- <td md-cell class="dialActive ">\n                            <md-icon ng-if="queue.type === \'outbound\'" md-colors="{color: {{queue.dialActive ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{queue.dialActive ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                            <md-icon ng-if="queue.type === \'inbound\'" md-colors="{color: \'green\'}" md-font-icon="icon-check"></md-icon>\n                        </td> --\x3e\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 tranlsate="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" ngCloak>\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 tranlsate="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 tranlsate="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>{{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></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 ngCloak>\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm.getColorByChannel(\'fax\')">\n        <div class="md-toolbar-tools">\n            <span class="md-subhead" translate="DASHBOARDS.INTERACTIONS">Interactions</span>\n            <ms-search-bar on-search="vm.query.filter = query" on-collapse="vm.query.filter = undefined" debounce="300"></ms-search-bar>\n            <div flex></div>\n            <div class="padding-horizontal-20" layout="column" layout-align="center center">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_DATE">Select a date</span>\n                <div layout="row" layout-align="center center">\n                    <md-button ng-if="vm.pickerModel.dateStart" ng-click="vm.clearAll()" class="md-icon-button no-padding width-20 height-20">\n                        <md-tooltip>{{ \'DASHBOARDS.DELETE\' | translate }}</md-tooltip>\n                        <md-icon md-font-icon="icon-close" class="s16 white-fg"></md-icon>\n                    </md-button>\n                    <md-date-range localization-map="vm.localizationMap" ng-model="vm.pickerModel" auto-confirm="true" show-template="true" md-on-select="vm.getFaxInteractions()" placeholder="{{ \'DASHBOARDS.ALL\' | translate }}"></md-date-range>\n                </div>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_READ_UNREAD">Select Read/Unread</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.read" ng-change="vm.getFaxInteractions()">\n                    <md-option value="0" translate="DASHBOARDS.UNREAD">READ</md-option>\n                    <md-option value="1" translate="DASHBOARDS.READ">UNREAD</md-option>\n                    <md-option ng-value="null" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_STATUS">Select a status</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.closed" ng-change="vm.getFaxInteractions()">\n                    <md-option value="0" translate="DASHBOARDS.OPENED">OPENED</md-option>\n                    <md-option value="1" translate="DASHBOARDS.CLOSED">CLOSED</md-option>\n                    <md-option ng-value="null" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_ACCOUNT">Select an account</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.account" ng-change="vm.getFaxInteractions()">\n                    <md-option ng-value="faxAccount.id" ng-repeat="faxAccount in vm.faxAccounts.rows">{{faxAccount.name}}</md-option>\n                    <md-option ng-value="null" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_AGENT">Select an agent</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.UserId" ng-change="vm.getFaxInteractions()">\n                    <md-option ng-value="vm.user.id" translate="DASHBOARDS.ME"></md-option>\n                    <md-option ng-value="\'null\'" translate="DASHBOARDS.NOT_ASSIGNED"></md-option>\n                    <md-option ng-value="undefined" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_TAG">Select a tag</span>\n                <md-select id="tags" placeholder="Tags" multiple="true" class="font-size-12 no-margin" ng-model="vm.query.tag" ng-change="vm.getFaxInteractions()" style="color:white;">\n                    <md-option ng-repeat="tag in vm.tags.rows" ng-value="tag.id">{{tag.name}}</md-option>\n                </md-select>\n            </div>\n            <div layout="column">\n                <md-button class="md-icon-button interaction-reload" 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-button>\n            </div>\n            <md-menu ng-if="vm.faxAccounts.rows && vm.faxAccounts.rows.length">\n                <md-button class="md-icon-button interaction-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)">{{ 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>\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 md-column md-order-by="id">ID</th>\n                    <th md-column style="width:15px">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                    </th>\n                    <th md-column style="width:180px">{{\'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 style="width:80px">{{\'DASHBOARDS.AGENT\' | translate}}</th>\n                    <th md-column>{{\'DASHBOARDS.ACCOUNT\' | 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.faxInteractions.rows.length">\n                    <td md-cell colspan="10">\n                        <div layout="row" layout-align="center center">\n                            <span tranlsate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available Interaction</span>\n                        </div>\n                    </td>\n                </tr>\n                <tr md-row ng-repeat="faxInteraction in vm.faxInteractions.rows" ng-class="{\'text-bold text-italic\': faxInteraction.unread}">\n                    <td ng-click="vm.showFaxInteraction($event, faxInteraction)" md-cell class="id">\n                        <div layout="row" layout-align="start center">\n                            <span class="font-size-10">{{faxInteraction.id}}</span>\n                        </div>\n                    </td>\n                    <td md-cell>\n                        <div ng-if="!faxInteraction.closed && faxInteraction.Users.length">\n                            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                            <md-tooltip>\n                                <span ng-repeat="u in faxInteraction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : vm.usersByKey[u.id].fullname | translate }}<span ng-if="!$last">, </span></span>\n                            </md-tooltip>\n                        </div>\n                    </td>\n                    <td ng-click="vm.showFaxInteraction($event, faxInteraction)" md-cell>\n                        <div layout="row" layout-align="start center">\n                            <div layout="column">\n                                <span ng-if="!faxInteraction.closed && faxInteraction.unread" class="badge white-fg" ng-class="vm.getColorByChannel(\'fax\')" layout-margin>{{faxInteraction.unread}}</span>\n                                <md-icon ng-if="faxInteraction.attach" md-font-icon="icon-paperclip" class="s16"></md-icon>\n                            </div>\n                            <span class="font-size-12 text-truncate" style="width:180px" layout-margin>{{vm.getContactLabel(faxInteraction)}}</span>\n                        </div>\n                    </td>\n                    <td ng-click="vm.showFaxInteraction($event, faxInteraction)" md-cell>\n                        <span class="font-size-10 text-truncate">{{faxInteraction.createdAt | formatdate }}</span>\n                    </td>\n                    <td ng-click="vm.showFaxInteraction($event, faxInteraction)" md-cell>\n                        <div layout="row" ng-if="faxInteraction.lastMsgAt">\n                            <span>\n                                <md-icon md-font-icon="{{faxInteraction.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="font-size-10 text-truncate">{{faxInteraction.lastMsgAt | formatdate }}</span>\n                            </div </div> <span ng-if="!faxInteraction.lastMsgAt">No messages</span>\n                    </td>\n                    <td ng-click="vm.showFaxInteraction($event, faxInteraction)" md-cell>\n                        <span ng-if="faxInteraction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="faxInteraction.disposition">- {{faxInteraction.disposition}}</span></span>\n                        <md-tooltip ng-if="faxInteraction.closed">{{faxInteraction.closedAt | formatdate }}</md-tooltip>\n                        <span ng-if="!faxInteraction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="faxInteraction.substatus"> - {{faxInteraction.substatus}}</span></span>\n                    </td>\n                    <td ng-click="vm.showFaxInteraction($event, faxInteraction)" md-cell class="user">\n                        <span class="font-size-12 text-truncate" style="width:120px">{{vm.getUserLabel(faxInteraction)}}</span>\n                    </td>\n                    <td ng-click="vm.showFaxInteraction($event, faxInteraction)" md-cell class="faxAccount">\n                        {{ vm.getFaxAccountLabel(faxInteraction) }}\n                    </td>\n                    <td md-cell>\n                        <div ng-if="faxInteraction.Tags.length">\n                            <div ng-if="faxInteraction.Tags.length == 1" layout="column" layout-align="center center">\n                                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': faxInteraction.Tags[0].color }"></md-icon>\n                                <span class="text-truncate">{{faxInteraction.Tags[0].name}}</span>\n                            </div>\n                            <div ng-if="faxInteraction.Tags.length > 1" layout="column" layout-align="center center">\n                                <md-tooltip md-direction="left" layout="row">\n                                    <span ng-repeat="tag in faxInteraction.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">\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="2">\n                                <md-menu-item>\n                                    <md-button ng-click="vm.showFaxInteraction($event, faxInteraction)" translate="DASHBOARDS.SHOW">\n                                        Show Fax\n                                    </md-button>\n                                </md-menu-item>\n                                <md-menu-item>\n                                    <md-button ng-click="vm.downloadFaxInteraction($event, faxInteraction)" translate="DASHBOARDS.DOWNLOAD">\n                                        Download Fax\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: \'{{\'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 ngCloak>\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm.getColorByChannel(\'mail\')">\n        <div class="md-toolbar-tools">\n            <span class="md-subhead" translate="DASHBOARDS.INTERACTIONS">Interactions</span>\n            <ms-search-bar on-search="vm.query.filter = query" on-collapse="vm.query.filter = undefined" debounce="300"></ms-search-bar>\n            <div flex></div>\n            <div class="padding-horizontal-20" layout="column" layout-align="center center">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_DATE">Select a date</span>\n                <div layout="row" layout-align="center center">\n                    <md-button ng-if="vm.pickerModel.dateStart" ng-click="vm.clearAll()" class="md-icon-button no-padding width-20 height-20">\n                        <md-tooltip>{{ \'DASHBOARDS.DELETE\' | translate }}</md-tooltip>\n                        <md-icon md-font-icon="icon-close" class="s16 white-fg"></md-icon>\n                    </md-button>\n                    <md-date-range localization-map="vm.localizationMap" ng-model="vm.pickerModel" auto-confirm="true" show-template="true" md-on-select="vm.getMailInteractions()" placeholder="{{ \'DASHBOARDS.ALL\' | translate }}"></md-date-range>\n                </div>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_READ_UNREAD">Select Read/Unread</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.read" ng-change="vm.getMailInteractions()">\n                    <md-option value="0" translate="DASHBOARDS.UNREAD">READ</md-option>\n                    <md-option value="1" translate="DASHBOARDS.READ">UNREAD</md-option>\n                    <md-option ng-value="null" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_STATUS">Select a status</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.closed" ng-change="vm.getMailInteractions()">\n                    <md-option value="0" translate="DASHBOARDS.OPENED">OPENED</md-option>\n                    <md-option value="1" translate="DASHBOARDS.CLOSED">CLOSED</md-option>\n                    <md-option ng-value="null" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column" ng-if="vm.query.closed == 0">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_SUBSTATUS">Select a sub status</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.substatus" ng-change="vm.getMailInteractions()">\n                    <md-option ng-repeat="subStatus in vm.subStatuses.rows" ng-value="subStatus.name">{{subStatus.name}}</md-option>\n                    <md-option ng-value="\'null\'" translate="DASHBOARDS.NONE"></md-option>\n                    <md-option ng-value="undefined" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_ACCOUNT">Select an account</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.account" ng-change="vm.getMailInteractions()">\n                    <md-option ng-value="mailAccount.id" ng-repeat="mailAccount in vm.mailAccounts.rows">{{mailAccount.name}}</md-option>\n                    <md-option ng-value="null" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_AGENT">Select an agent</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.UserId" ng-change="vm.getMailInteractions()">\n                    <md-option ng-value="vm.user.id" translate="DASHBOARDS.ME"></md-option>\n                    <md-option ng-value="\'null\'" translate="DASHBOARDS.NOT_ASSIGNED"></md-option>\n                    <md-option ng-value="undefined" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_TAG">Select a tag</span>\n                <md-select id="tags" placeholder="Tags" multiple="true" class="font-size-12 no-margin" ng-model="vm.query.tag" ng-change="vm.getMailInteractions()" style="color:white;">\n                    <md-option ng-repeat="tag in vm.tags.rows" ng-value="tag.id">{{tag.name}}</md-option>\n                </md-select>\n            </div>\n            <div layout="column">\n                <md-button class="md-icon-button interaction-reload" 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-button>\n            </div>\n            <md-menu ng-if="vm.mailAccounts.rows && vm.mailAccounts.rows.length">\n                <md-button class="md-icon-button interaction-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)">{{ 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>\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 md-column md-order-by="id">ID</th>\n                    <th md-column style="width:15px">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                    </th>\n                    <th md-column style="width:180px">{{\'DASHBOARDS.CONTACT\' | translate}}</th>\n                    <th md-column md-order-by="subject" style="width:200px">{{\'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 style="width:80px">{{\'DASHBOARDS.AGENT\' | translate}}</th>\n                    <th md-column>{{\'DASHBOARDS.ACCOUNT\' | 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.mailInteractions.rows.length">\n                    <td md-cell colspan="10">\n                        <div layout="row" layout-align="center center">\n                            <span tranlsate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available Interaction</span>\n                        </div>\n                    </td>\n                </tr>\n                <tr md-row ng-repeat="mailInteraction in vm.mailInteractions.rows" ng-class="{\'text-bold text-italic\': mailInteraction.unread}">\n                    <td ng-click="vm.showMailInteraction($event, mailInteraction)" md-cell class="id">\n                        <div layout="row" layout-align="start center">\n                            <span class="font-size-10">{{mailInteraction.id}}</span>\n                        </div>\n                    </td>\n                    <td md-cell>\n                        <div ng-if="!mailInteraction.closed && mailInteraction.Users.length">\n                            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                            <md-tooltip>\n                                <span ng-repeat="u in mailInteraction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : vm.usersByKey[u.id].fullname | translate }}<span ng-if="!$last">, </span></span>\n                            </md-tooltip>\n                        </div>\n                    </td>\n                    <td ng-click="vm.showMailInteraction($event, mailInteraction)" md-cell>\n                        <div layout="row" layout-align="start center">\n                            <div layout="column">\n                                <span ng-if="!mailInteraction.closed && mailInteraction.unread" class="badge white-fg" ng-class="vm.getColorByChannel(\'mail\')" layout-margin>{{mailInteraction.unread}}</span>\n                                <md-icon ng-if="mailInteraction.attach" md-font-icon="icon-paperclip" class="s16"></md-icon>\n                            </div>\n                            <span class="font-size-12 text-truncate" style="width:180px" layout-margin>{{vm.getContactLabel(mailInteraction)}}</span>\n                        </div>\n                    </td>\n                    <td ng-click="vm.showMailInteraction($event, mailInteraction)" md-cell>\n                        <div ng-if="vm.setting.enableEmailPreview && mailInteraction.lastMsgBody" class="tooltip-preview">\n                            <span class="text-truncate font-size-12" style="width:200px">{{mailInteraction.subject}}</span>\n                            <md-card class="tooltip-preview-text" ng-style="{top: \'-\' + ((($index % 10) + 1) * 18) + \'px\'}">\n                                <md-card-content>{{mailInteraction.lastMsgBody}}<br>...</md-card-content>\n                            </md-card>\n                        </div>\n                        <span ng-if="!mailInteraction.lastMsgBody || !vm.setting.enableEmailPreview" class="text-truncate font-size-12" style="width:200px">{{mailInteraction.subject}}</span>\n                    </td>\n                    <td ng-click="vm.showMailInteraction($event, mailInteraction)" md-cell>\n                        <span class="font-size-10 text-truncate">{{mailInteraction.createdAt | formatdate }}</span>\n                    </td>\n                    <td ng-click="vm.showMailInteraction($event, mailInteraction)" md-cell>\n                        <div layout="row" ng-if="mailInteraction.lastMsgAt">\n                            <span>\n                                <md-icon md-font-icon="{{mailInteraction.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="font-size-10 text-truncate">{{mailInteraction.lastMsgAt | formatdate }}</span>\n                            </div </div> <span ng-if="!mailInteraction.lastMsgAt">No messages</span>\n                    </td>\n                    <td ng-click="vm.showMailInteraction($event, mailInteraction)" md-cell>\n                        <span ng-if="mailInteraction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="mailInteraction.disposition">- {{mailInteraction.disposition}}</span></span>\n                        <md-tooltip ng-if="mailInteraction.closed">{{mailInteraction.closedAt | formatdate }}</md-tooltip>\n                        <span ng-if="!mailInteraction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="mailInteraction.substatus"> - {{mailInteraction.substatus}}</span></span>\n                    </td>\n                    <td ng-click="vm.showMailInteraction($event, mailInteraction)" md-cell class="user">\n                        <span class="font-size-12 text-truncate" style="width:120px">{{vm.getUserLabel(mailInteraction)}}</span>\n                    </td>\n                    <td ng-click="vm.showMailInteraction($event, mailInteraction)" md-cell class="mailAccount">\n                        {{ vm.getMailAccountLabel(mailInteraction) }}\n                    </td>\n                    <td md-cell>\n                        <div ng-if="mailInteraction.Tags.length">\n                            <div ng-if="mailInteraction.Tags.length == 1" layout="column" layout-align="center center">\n                                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': mailInteraction.Tags[0].color }"></md-icon>\n                                <span class="text-truncate">{{mailInteraction.Tags[0].name}}</span>\n                            </div>\n                            <div ng-if="mailInteraction.Tags.length > 1" layout="column" layout-align="center center">\n                                <md-tooltip md-direction="left" layout="row">\n                                    <span ng-repeat="tag in mailInteraction.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">\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="2">\n                                <md-menu-item>\n                                    <md-button ng-click="vm.showMailInteraction($event, mailInteraction)" translate="DASHBOARDS.SHOW">\n                                        Show Mail\n                                    </md-button>\n                                </md-menu-item>\n                                <md-menu-item>\n                                    <md-button ng-click="vm.downloadMailInteraction($event, mailInteraction, 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.downloadMailInteraction($event, mailInteraction)" translate="MAIL.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                                        Download without attachments\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: \'{{\'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 red-bg">\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.query.filter = query" on-collapse="vm.query.filter = undefined" debounce="300"></ms-search-bar>\n            <div flex></div>\n            <div layout="column">\n                <span class="font-size-10" translate="CONTACTMANAGER.SELECT_LIST">Select a list</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.ListId" ng-change="vm.getContacts()">\n                    <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">{{list.name}}</md-option>\n                    <md-option ng-value="vm.defaultLists" ng-if="vm.lists.count > 1"><em translate="CONTACTMANAGER.ALL_CONTACTS">All</em></md-option>\n                </md-select>\n            </div>\n            <div layout="column">\n                <span class="font-size-10" translate="CONTACTMANAGER.SELECT_TAG">Select a tag</span>\n                <md-select id="tags" placeholder="Tags" multiple="true" class="font-size-12 no-margin" ng-model="vm.query.tag" ng-change="vm.getContacts()" style="color:white;">\n                    <md-option ng-repeat="tag in vm.tags.rows" ng-value="tag.id">{{tag.name}}</md-option>\n                </md-select>\n            </div>\n            <md-button class="md-icon-button interaction-reload" 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-button>\n            <md-button class="md-icon-button interaction-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    </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">ID</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="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 tranlsate="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">{{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">{{contact.fax}}</td>\n                    <td ng-click="vm.openContact($event, contact)" md-cell class="email">{{contact.email}}</td>\n                    <td ng-click="vm.openContact($event, contact)" md-cell class="list">{{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">, </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\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 ngCloak>\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm.getColorByChannel(\'openchannel\')">\n        <div class="md-toolbar-tools">\n            <span class="md-subhead" translate="DASHBOARDS.INTERACTIONS">Interactions</span>\n            <ms-search-bar on-search="vm.query.filter = query" on-collapse="vm.query.filter = undefined" debounce="300"></ms-search-bar>\n            <div flex></div>\n            <div class="padding-horizontal-20" layout="column" layout-align="center center">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_DATE">Select a date</span>\n                <div layout="row" layout-align="center center">\n                    <md-button ng-if="vm.pickerModel.dateStart" ng-click="vm.clearAll()" class="md-icon-button no-padding width-20 height-20">\n                        <md-tooltip>{{ \'DASHBOARDS.DELETE\' | translate }}</md-tooltip>\n                        <md-icon md-font-icon="icon-close" class="s16 white-fg"></md-icon>\n                    </md-button>\n                    <md-date-range localization-map="vm.localizationMap" ng-model="vm.pickerModel" auto-confirm="true" show-template="true" md-on-select="vm.getOpenchannelInteractions()" placeholder="{{ \'DASHBOARDS.ALL\' | translate }}"></md-date-range>\n                </div>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_READ_UNREAD">Select Read/Unread</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.read" ng-change="vm.getOpenchannelInteractions()">\n                    <md-option value="0" translate="DASHBOARDS.UNREAD">READ</md-option>\n                    <md-option value="1" translate="DASHBOARDS.READ">UNREAD</md-option>\n                    <md-option ng-value="null" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_STATUS">Select a status</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.closed" ng-change="vm.getOpenchannelInteractions()">\n                    <md-option value="0" translate="DASHBOARDS.OPENED">OPENED</md-option>\n                    <md-option value="1" translate="DASHBOARDS.CLOSED">CLOSED</md-option>\n                    <md-option ng-value="null" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_ACCOUNT">Select an account</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.account" ng-change="vm.getOpenchannelInteractions()">\n                    <md-option ng-value="openchannelAccount.id" ng-repeat="openchannelAccount in vm.openchannelAccounts.rows">{{openchannelAccount.name}}</md-option>\n                    <md-option ng-value="null" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_AGENT">Select an agent</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.UserId" ng-change="vm.getOpenchannelInteractions()">\n                    <md-option ng-value="vm.user.id" translate="DASHBOARDS.ME"></md-option>\n                    <md-option ng-value="\'null\'" translate="DASHBOARDS.NOT_ASSIGNED"></md-option>\n                    <md-option ng-value="undefined" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_TAG">Select a tag</span>\n                <md-select id="tags" placeholder="Tags" multiple="true" class="font-size-12 no-margin" ng-model="vm.query.tag" ng-change="vm.getOpenchannelInteractions()" style="color:white;">\n                    <md-option ng-repeat="tag in vm.tags.rows" ng-value="tag.id">{{tag.name}}</md-option>\n                </md-select>\n            </div>\n            <div layout="column">\n                <md-button class="md-icon-button interaction-reload" 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-button>\n            </div>\n            <md-menu ng-if="vm.openchannelAccounts.rows && vm.openchannelAccounts.rows.length">\n                <md-button class="md-icon-button interaction-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)">{{ 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>\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 md-column md-order-by="id">ID</th>\n                    <th md-column style="width:15px">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                    </th>\n                    <th md-column style="width:180px">{{\'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 style="width:80px">{{\'DASHBOARDS.AGENT\' | translate}}</th>\n                    <th md-column>{{\'DASHBOARDS.ACCOUNT\' | 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.openchannelInteractions.rows.length">\n                    <td md-cell colspan="10">\n                        <div layout="row" layout-align="center center">\n                            <span tranlsate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available Interaction</span>\n                        </div>\n                    </td>\n                </tr>\n                <tr md-row ng-repeat="openchannelInteraction in vm.openchannelInteractions.rows" ng-class="{\'text-bold text-italic\': openchannelInteraction.unread}">\n                    <td ng-click="vm.showOpenchannelInteraction($event, openchannelInteraction)" md-cell class="id">\n                        <div layout="row" layout-align="start center">\n                            <span class="font-size-10">{{openchannelInteraction.id}}</span>\n                        </div>\n                    </td>\n                    <td md-cell>\n                        <div ng-if="!openchannelInteraction.closed && openchannelInteraction.Users.length">\n                            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                            <md-tooltip>\n                                <span ng-repeat="u in openchannelInteraction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : vm.usersByKey[u.id].fullname | translate }}<span ng-if="!$last">, </span></span>\n                            </md-tooltip>\n                        </div>\n                    </td>\n                    <td ng-click="vm.showOpenchannelInteraction($event, openchannelInteraction)" md-cell>\n                        <div layout="row" layout-align="start center">\n                            <div layout="column">\n                                <span ng-if="!openchannelInteraction.closed && openchannelInteraction.unread" class="badge white-fg" ng-class="vm.getColorByChannel(\'openchannel\')" layout-margin>{{openchannelInteraction.unread}}</span>\n                                <md-icon ng-if="openchannelInteraction.attach" md-font-icon="icon-paperclip" class="s16"></md-icon>\n                            </div>\n                            <span class="font-size-12 text-truncate" style="width:180px" layout-margin>{{vm.getContactLabel(openchannelInteraction)}}</span>\n                        </div>\n                    </td>\n                    <td ng-click="vm.showOpenchannelInteraction($event, openchannelInteraction)" md-cell>\n                        <span class="font-size-10 text-truncate">{{openchannelInteraction.createdAt | formatdate }}</span>\n                    </td>\n                    <td ng-click="vm.showOpenchannelInteraction($event, openchannelInteraction)" md-cell>\n                        <div layout="row" ng-if="openchannelInteraction.lastMsgAt">\n                            <span>\n                                <md-icon md-font-icon="{{openchannelInteraction.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="font-size-10 text-truncate">{{openchannelInteraction.lastMsgAt | formatdate }}</span>\n                            </div </div> <span ng-if="!openchannelInteraction.lastMsgAt">No messages</span>\n                    </td>\n                    <td ng-click="vm.showOpenchannelInteraction($event, openchannelInteraction)" md-cell>\n                        <span ng-if="openchannelInteraction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="openchannelInteraction.disposition">- {{openchannelInteraction.disposition}}</span></span>\n                        <md-tooltip ng-if="openchannelInteraction.closed">{{openchannelInteraction.closedAt | formatdate }}</md-tooltip>\n                        <span ng-if="!openchannelInteraction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="openchannelInteraction.substatus"> - {{openchannelInteraction.substatus}}</span></span>\n                    </td>\n                    <td ng-click="vm.showOpenchannelInteraction($event, openchannelInteraction)" md-cell class="user">\n                        <span class="font-size-12 text-truncate" style="width:120px">{{vm.getUserLabel(openchannelInteraction)}}</span>\n                    </td>\n                    <td ng-click="vm.showOpenchannelInteraction($event, openchannelInteraction)" md-cell class="openchannelAccount">\n                        {{ vm.getOpenchannelAccountLabel(openchannelInteraction) }}\n                    </td>\n                    <td md-cell>\n                        <div ng-if="openchannelInteraction.Tags.length">\n                            <div ng-if="openchannelInteraction.Tags.length == 1" layout="column" layout-align="center center">\n                                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': openchannelInteraction.Tags[0].color }"></md-icon>\n                                <span class="text-truncate">{{openchannelInteraction.Tags[0].name}}</span>\n                            </div>\n                            <div ng-if="openchannelInteraction.Tags.length > 1" layout="column" layout-align="center center">\n                                <md-tooltip md-direction="left" layout="row">\n                                    <span ng-repeat="tag in openchannelInteraction.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">\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="2">\n                                <md-menu-item>\n                                    <md-button ng-click="vm.showOpenchannelInteraction($event, openchannelInteraction)" translate="DASHBOARDS.SHOW">\n                                        Show Openchannel\n                                    </md-button>\n                                </md-menu-item>\n                                <md-menu-item>\n                                    <md-button ng-click="vm.downloadOpenchannelInteraction($event, openchannelInteraction)" translate="DASHBOARDS.DOWNLOAD">\n                                        Download Openchannel\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: \'{{\'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/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">\n        <div class="md-toolbar-tools">\n            <span class="md-subhead" translate="VOICE.RECORDINGS">Recordings</span>\n            <ms-search-bar on-search="vm.query.filter = query" on-collapse="vm.query.filter = undefined" debounce="300"></ms-search-bar>\n            <div flex></div>\n            <div class="padding-horizontal-20" layout="column" layout-align="center center">\n                <span class="font-size-10" translate="VOICE.SELECT_DATE">Select a date</span>\n                <div layout="row" layout-align="center center">\n                    <md-button ng-if="vm.pickerModel.dateStart" ng-click="vm.clearAll()" class="md-icon-button no-padding width-20 height-20">\n                        <md-tooltip>{{ \'VOICE.DELETE\' | translate }}</md-tooltip>\n                        <md-icon md-font-icon="icon-close" class="s16 white-fg"></md-icon>\n                    </md-button>\n                    <md-date-range localization-map="vm.localizationMap" ng-model="vm.pickerModel" auto-confirm="true" show-template="true" md-on-select="vm.getVoiceRecordings()" placeholder="{{ \'VOICE.ALL\' | translate }}"></md-date-range>\n                </div>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="VOICE.SELECT_TYPE">Select a type</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.type" ng-change="vm.getVoiceRecordings()">\n                    <md-option value="internal" translate="VOICE.INTERNAL">Internal</md-option>\n                    <md-option value="inbound" translate="VOICE.INBOUND">Inbound</md-option>\n                    <md-option value="outbound" translate="VOICE.OUTBOUND">Outbound</md-option>\n                    <md-option value="dialer" translate="VOICE.DIALER">Dialer</md-option>\n                    <md-option ng-value="null" translate="VOICE.ALL">All</md-option>\n                </md-select>\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.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"></th>\n                </tr>\n            </thead>\n            <tbody md-body>\n                <tr md-row ng-hide="vm.voiceRecordings.rows.length">\n                    <td md-cell colspan="10">\n                        <div layout="row" layout-align="center center">\n                            <span tranlsate="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"></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"></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">\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-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></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">\n        <div class="md-toolbar-tools">\n            <span class="md-subhead" translate="MOTIONDIALER.SCHEDULED_CALLS">Scheduled Calls</span>\n            \x3c!-- <ms-search-bar on-search="vm.query.filter = query" on-collapse="vm.query.filter = undefined" debounce="300"></ms-search-bar> --\x3e\n            <div flex></div>\n            <div class="padding-horizontal-20" layout="column" layout-align="center center">\n                <span class="font-size-10" translate="MOTIONDIALER.SELECT_DATE">Select a date</span>\n                <div layout="row" layout-align="center center">\n                    <md-button ng-if="vm.pickerModel.dateStart" ng-click="vm.clearAll()" class="md-icon-button no-padding width-20 height-20">\n                        <md-tooltip>{{ \'VOICE.DELETE\' | translate }}</md-tooltip>\n                        <md-icon md-font-icon="icon-close" class="s16 white-fg"></md-icon>\n                    </md-button>\n                    <md-date-range localization-map="vm.localizationMap" ng-model="vm.pickerModel" auto-confirm="true" show-template="true" md-on-select="vm.getScheduledCalls()" placeholder="{{ \'MOTIONDIALER.ALL\' | translate }}"></md-date-range>\n                </div>\n            </div>\n            <div ng-if="vm.queueCampaigns.count" layout="column">\n                <span class="font-size-10" translate="MOTIONDIALER.SELECT_CAMPAIGN">Select a Campaign</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.VoiceQueueId" ng-change="vm.getScheduledCalls()">\n                    <md-option ng-value="undefined"><em translate="MOTIONDIALER.ALL">All</em></md-option>\n                    <md-option ng-value="queueCampaign.id" ng-repeat="queueCampaign in vm.queueCampaigns.rows">{{queueCampaign.name}}</md-option>\n                </md-select>\n            </div>\n            \x3c!-- <div layout="column">\n                        <span class="font-size-10" translate="MOTIONDIALER.SELECT_TYPE">Select type</span>\n                        <md-select class="font-size-12 no-margin" ng-model="vm.query.recallme" ng-change="vm.getScheduledCalls()">\n                            <md-option ng-value="undefined"><em translate="MOTIONDIALER.ALL">All</em></md-option>\n                            <md-option ng-value="1" translate="MOTIONDIALER.RECALLME">Recall me</md-option>\n                            <md-option ng-value="0" translate="MOTIONDIALER.INQUEUE">Recall in queue</md-option>\n                        </md-select>\n                    </div> --\x3e\n            <md-button class="md-icon-button" ng-click="vm.getScheduledCalls()" aria-label="refresh scheuled 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 tranlsate="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>{{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\' }}"></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></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/sms/agent.general.sms.html",'<md-card ngCloak>\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm.getColorByChannel(\'sms\')">\n        <div class="md-toolbar-tools">\n            <span class="md-subhead" translate="DASHBOARDS.INTERACTIONS">Interactions</span>\n            <ms-search-bar on-search="vm.query.filter = query" on-collapse="vm.query.filter = undefined" debounce="300"></ms-search-bar>\n            <div flex></div>\n            <div class="padding-horizontal-20" layout="column" layout-align="center center">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_DATE">Select a date</span>\n                <div layout="row" layout-align="center center">\n                    <md-button ng-if="vm.pickerModel.dateStart" ng-click="vm.clearAll()" class="md-icon-button no-padding width-20 height-20">\n                        <md-tooltip>{{ \'DASHBOARDS.DELETE\' | translate }}</md-tooltip>\n                        <md-icon md-font-icon="icon-close" class="s16 white-fg"></md-icon>\n                    </md-button>\n                    <md-date-range localization-map="vm.localizationMap" ng-model="vm.pickerModel" auto-confirm="true" show-template="true" md-on-select="vm.getSmsInteractions()" placeholder="{{ \'DASHBOARDS.ALL\' | translate }}"></md-date-range>\n                </div>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_READ_UNREAD">Select Read/Unread</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.read" ng-change="vm.getSmsInteractions()">\n                    <md-option value="0" translate="DASHBOARDS.UNREAD">READ</md-option>\n                    <md-option value="1" translate="DASHBOARDS.READ">UNREAD</md-option>\n                    <md-option ng-value="null" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_STATUS">Select a status</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.closed" ng-change="vm.getSmsInteractions()">\n                    <md-option value="0" translate="DASHBOARDS.OPENED">OPENED</md-option>\n                    <md-option value="1" translate="DASHBOARDS.CLOSED">CLOSED</md-option>\n                    <md-option ng-value="null" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_ACCOUNT">Select an account</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.account" ng-change="vm.getSmsInteractions()">\n                    <md-option ng-value="smsAccount.id" ng-repeat="smsAccount in vm.smsAccounts.rows">{{smsAccount.name}}</md-option>\n                    <md-option ng-value="null" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_AGENT">Select an agent</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.UserId" ng-change="vm.getSmsInteractions()">\n                    <md-option ng-value="vm.user.id" translate="DASHBOARDS.ME"></md-option>\n                    <md-option ng-value="\'null\'" translate="DASHBOARDS.NOT_ASSIGNED"></md-option>\n                    <md-option ng-value="undefined" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_TAG">Select a tag</span>\n                <md-select id="tags" placeholder="Tags" multiple="true" class="font-size-12 no-margin" ng-model="vm.query.tag" ng-change="vm.getSmsInteractions()" style="color:white;">\n                    <md-option ng-repeat="tag in vm.tags.rows" ng-value="tag.id">{{tag.name}}</md-option>\n                </md-select>\n            </div>\n            <div layout="column">\n                <md-button class="md-icon-button interaction-reload" 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-button>\n            </div>\n            <md-menu ng-if="vm.smsAccounts.rows && vm.smsAccounts.rows.length">\n                <md-button class="md-icon-button interaction-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)">{{ 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>\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 md-column md-order-by="id">ID</th>\n                    <th md-column style="width:15px">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                    </th>\n                    <th md-column style="width:180px">{{\'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 style="width:80px">{{\'DASHBOARDS.AGENT\' | translate}}</th>\n                    <th md-column>{{\'DASHBOARDS.ACCOUNT\' | 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.smsInteractions.rows.length">\n                    <td md-cell colspan="10">\n                        <div layout="row" layout-align="center center">\n                            <span tranlsate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available Interaction</span>\n                        </div>\n                    </td>\n                </tr>\n                <tr md-row ng-repeat="smsInteraction in vm.smsInteractions.rows" ng-class="{\'text-bold text-italic\': smsInteraction.unread}">\n                    <td ng-click="vm.showSmsInteraction($event, smsInteraction)" md-cell class="id">\n                        <div layout="row" layout-align="start center">\n                            <span class="font-size-10">{{smsInteraction.id}}</span>\n                        </div>\n                    </td>\n                    <td md-cell>\n                        <div ng-if="!smsInteraction.closed && smsInteraction.Users.length">\n                            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                            <md-tooltip>\n                                <span ng-repeat="u in smsInteraction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : vm.usersByKey[u.id].fullname | translate }}<span ng-if="!$last">, </span></span>\n                            </md-tooltip>\n                        </div>\n                    </td>\n                    <td ng-click="vm.showSmsInteraction($event, smsInteraction)" md-cell>\n                        <div layout="row" layout-align="start center">\n                            <div layout="column">\n                                <span ng-if="!smsInteraction.closed && smsInteraction.unread" class="badge white-fg" ng-class="vm.getColorByChannel(\'sms\')" layout-margin>{{smsInteraction.unread}}</span>\n                                <md-icon ng-if="smsInteraction.attach" md-font-icon="icon-paperclip" class="s16"></md-icon>\n                            </div>\n                            <span class="font-size-12 text-truncate" style="width:180px" layout-margin>{{vm.getContactLabel(smsInteraction)}}</span>\n                        </div>\n                    </td>\n                    <td ng-click="vm.showSmsInteraction($event, smsInteraction)" md-cell>\n                        <span class="font-size-10 text-truncate">{{smsInteraction.createdAt | formatdate }}</span>\n                    </td>\n                    <td ng-click="vm.showSmsInteraction($event, smsInteraction)" md-cell>\n                        <div layout="row" ng-if="smsInteraction.lastMsgAt">\n                            <span>\n                                <md-icon md-font-icon="{{smsInteraction.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="font-size-10 text-truncate">{{smsInteraction.lastMsgAt | formatdate }}</span>\n                            </div </div> <span ng-if="!smsInteraction.lastMsgAt">No messages</span>\n                    </td>\n                    <td ng-click="vm.showSmsInteraction($event, smsInteraction)" md-cell>\n                        <span ng-if="smsInteraction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="smsInteraction.disposition">- {{smsInteraction.disposition}}</span></span>\n                        <md-tooltip ng-if="smsInteraction.closed">{{smsInteraction.closedAt | formatdate }}</md-tooltip>\n                        <span ng-if="!smsInteraction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="smsInteraction.substatus"> - {{smsInteraction.substatus}}</span></span>\n                    </td>\n                    <td ng-click="vm.showSmsInteraction($event, smsInteraction)" md-cell class="user">\n                        <span class="font-size-12 text-truncate" style="width:120px">{{vm.getUserLabel(smsInteraction)}}</span>\n                    </td>\n                    <td ng-click="vm.showSmsInteraction($event, smsInteraction)" md-cell class="smsAccount">\n                        {{ vm.getSmsAccountLabel(smsInteraction) }}\n                    </td>\n                    <td md-cell>\n                        <div ng-if="smsInteraction.Tags.length">\n                            <div ng-if="smsInteraction.Tags.length == 1" layout="column" layout-align="center center">\n                                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': smsInteraction.Tags[0].color }"></md-icon>\n                                <span class="text-truncate">{{smsInteraction.Tags[0].name}}</span>\n                            </div>\n                            <div ng-if="smsInteraction.Tags.length > 1" layout="column" layout-align="center center">\n                                <md-tooltip md-direction="left" layout="row">\n                                    <span ng-repeat="tag in smsInteraction.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">\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="2">\n                                <md-menu-item>\n                                    <md-button ng-click="vm.showSmsInteraction($event, smsInteraction)" translate="DASHBOARDS.SHOW">\n                                        Show Sms\n                                    </md-button>\n                                </md-menu-item>\n                                <md-menu-item>\n                                    <md-button ng-click="vm.downloadSmsInteraction($event, smsInteraction)" translate="DASHBOARDS.DOWNLOAD">\n                                        Download Sms\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: \'{{\'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">\n        <div class="md-toolbar-tools">\n            <span class="md-subhead" translate="VOICE.CALLS">Calls</span>\n            <ms-search-bar on-search="vm.query.filter = query" on-collapse="vm.query.filter = undefined" debounce="300"></ms-search-bar>\n            <div flex></div>\n            <div class="padding-horizontal-20" layout="column" layout-align="center center">\n                <span class="font-size-10" translate="VOICE.SELECT_DATE">Select a date</span>\n                <div layout="row" layout-align="center center">\n                    <md-button ng-if="vm.pickerModel.dateStart" ng-click="vm.clearAll()" class="md-icon-button no-padding width-20 height-20">\n                        <md-tooltip>{{ \'VOICE.DELETE\' | translate }}</md-tooltip>\n                        <md-icon md-font-icon="icon-close" class="s16 white-fg"></md-icon>\n                    </md-button>\n                    <md-date-range localization-map="vm.localizationMap" ng-model="vm.pickerModel" auto-confirm="true" show-template="true" md-on-select="vm.getVoiceCalls()" placeholder="{{ \'VOICE.ALL\' | translate }}"></md-date-range>\n                </div>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="VOICE.SELECT_TYPE">Select a type</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.type" ng-change="vm.getVoiceCalls()">\n                    <md-option value="internal" translate="VOICE.INTERNAL">Internal</md-option>\n                    <md-option value="inbound" translate="VOICE.INBOUND">Inbound</md-option>\n                    <md-option value="outbound" translate="VOICE.OUTBOUND">Outbound</md-option>\n                    <md-option value="dialer" translate="VOICE.DIALER">Dialer</md-option>\n                    <md-option ng-value="null" translate="VOICE.ALL">All</md-option>\n                </md-select>\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.getVoiceCalls">\n                <tr md-row>\n                    <th md-column md-order-by="id">ID</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>{{ \'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="8">\n                        <div layout="row" layout-align="center center">\n                            <span tranlsate="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">{{voiceCall.type}}</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="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\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>{{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>{{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="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/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 }} </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\'"></md-toolbar>\n            \x3c!-- / TOOLBAR --\x3e\n\n            \x3c!-- CONTENT --\x3e\n            <md-content id="interaction-content" name="{{\'interaction-content-\' + vm.tab.id}}" flex ms-scroll 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\'"></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\'"></div>\n                    </div>\n                </div>\n            </md-content>\n            \x3c!-- / CONTENT --\x3e\n\n            \x3c!-- FOOTER --\x3e\n            <div ng-if="!vm.interaction.closed && vm.tab.channel != \'mail\' && vm.tab.channel !== \'fax\' && (vm.tab.channel != \'sms\' || !vm.tab.spy)" class="interaction-footer flex-noshrink" layout="row" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.footer.html\'"></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\'"></md-card>\n    </div>\n</md-content>\n\x3c!-- / CONTENT CARD --\x3e'),e.put("app/main/apps/dashboards/views/general/agent/interaction/composeFax/dialog.html",'<md-dialog class="compose-dialog-fax" 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\n        <md-dialog-content ms-scroll>\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                    \x3c!-- <input ng-model="vm.message.subject" type="text"> --\x3e\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\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\n                    <md-button class="md-icon-button" aria-label="Delete attachment" translate translate-attr-aria-label="FAX.DELETE_ATTACHMENT">\n                        \x3c!-- <md-icon md-font-icon="icon-close" class="s16"></md-icon> --\x3e\n                    </md-button>\n                </div>\n            </div>\n\n        </md-dialog-content>\n    </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/composeMail/dialog.html",'<md-dialog class="compose-dialog" aria-label="New Message" ng-style="{\n      \'max-width\':  {true: \'620px\', false: \'90%\'}[ vm.secret ],\n      \'width\': {true: \'620px\', false: \'100%\'}[ vm.secret ],\n      \'max-height\': {true: undefined, false: \'97%\'}[ vm.secret ]\n    }">\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\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" 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\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 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" 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\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\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" 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\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" 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\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">\n            </md-input-container>\n\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\n                    <md-button ng-click="vm.deleteAttachment(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\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\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\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">\n                <md-item-template>\n                    <md-icon ng-if="!item.MailAccountId" md-font-icon="icon-earth" aria-label="alert email" class="s16"></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 }} - {{ item.value | htmlToPlaintext }}</span>\n                </md-item-template>\n\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\n        </md-dialog-content>\n    </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/composeOpenchannel/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\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            <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\n            \x3c!-- msEmojyArea directive --\x3e\n            <ms-emoji-area on-reply="vm.reply(event, body)" ctrl-methods="vm.ctrlMethods" ng-model="vm.message.body" placeholder="\'OPENCHANNEL.INSERT_MESSAGE_HERE\'"></ms-emoji-area>\n            \x3c!-- / msEmojyArea directive --\x3e\n\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\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\n\n        </md-dialog-content>\n    </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/composeSms/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\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            <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\n            \x3c!-- msEmojyArea directive --\x3e\n            <ms-emoji-area on-reply="vm.reply(event, body)" ctrl-methods="vm.ctrlMethods" ng-model="vm.message.body" placeholder="\'SMS.INSERT_MESSAGE_HERE\'"></ms-emoji-area>\n            \x3c!-- / msEmojyArea directive --\x3e\n\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\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\n\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">\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()">\n                    <md-icon 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="DASHBOARDS.DISPOSITIONS">Dispositions</label>\n                <md-select name="disposition" ng-model="vm.interaction.disposition" required>\n                    \x3c!-- <md-select ng-disabled="vm.interaction.closed && vm.interaction.disposition" name="disposition" ng-model="vm.interaction.disposition" required> --\x3e\n                    <md-option ng-value="null">NONE</md-option>\n                    <md-option ng-value="d.name" ng-repeat="d in vm.dispositions.rows">{{ d.name }}</md-option>\n                    <md-option ng-value="gd.name" ng-repeat="gd in vm.globalDispositions.rows">{{ gd.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\n            <md-input-container class="md-block">\n                <label translate="DASHBOARDS.NOTE">Note</label>\n                \x3c!-- <textarea ng-disabled="vm.interaction.closed && vm.interaction.disposition" ng-model="vm.interaction.note" md-maxlength="255" max-rows="5" autofocus></textarea> --\x3e\n                <textarea ng-model="vm.interaction.note" md-maxlength="255" max-rows="5" autofocus></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        \x3c!-- <md-dialog-actions ng-if="!vm.interaction.closed || !vm.interaction.disposition" layout="row" layout-align="space-between center"> --\x3e\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(true)" class="send-button md-accent md-raised" ng-if="!vm.interaction.closed && vm.interaction.disposition" 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)" class="send-button md-accent md-raised" ng-if="!vm.interaction.closed && !vm.interaction.disposition && !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(false)" class="send-button md-accent md-raised" ng-if="vm.interaction.closed" aria-label="DISPOSE" translate="DASHBOARDS.DISPOSE" translate-attr-aria-label="DASHBOARDS.DISPOSE">\n                    DISPOSE\n                </md-button>\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 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                <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\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            <md-input-container class="md-block">\n                <label translate="DASHBOARDS.TYPE">Type</label>\n                <md-select name="type" ng-model="vm.transfer.type" required>\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                <div ng-messages="transferForm.type.$error" ng-show="transferForm.type.$touched" role="alert">\n                    <div ng-message="required">\n                        <span translate="DASHBOARDS.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.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\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" ng-if="vm.currentUser.id != agent.id">{{ 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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n                    </md-button>\n                </div>\n            </div>\n        </md-dialog-content>\n\n        \x3c!-- <md-dialog-actions ng-if="!vm.interaction.closed || !vm.interaction.disposition" layout="row" layout-align="space-between center"> --\x3e\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" 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">Customer IP</p>\n            <h4>{{item.customerIp}}</h4>\n        </div>\n    </md-list-item>\n    <md-divider></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>\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>\n                    </md-input-container>\n\n                    <md-input-container ng-if="vm.tab.channel != \'fax\'" 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>\n                    </md-input-container>\n\n                    <md-input-container ng-if="vm.tab.channel == \'fax\'" 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>\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}} - <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\'"></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\'"></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\'"></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-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\'"></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\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\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\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\n    <div ng-if="item.ChatWebsiteId">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.chat.html\'"></div>\n    </div>\n    <div ng-if="item.MailAccountId">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.mail.html\'"></div>\n    </div>\n\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-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\n    <p class="padding-horizontal-15 grey-fg">Tags</p>\n    <md-list-item ng-if="item.Tags.length">\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",'<md-content layout="column" layout-align="end center">\n    <div layout-margin>\n        <md-input-container>\n            <md-select ng-model="vm.channel" placeholder="Channel">\n                <md-option ng-value="undefined" translate="DASHBOARDS.ALL">All</md-option>\n                <md-option ng-value="\'voice\'" translate="DASHBOARDS.VOICE">Voice</md-option>\n                <md-option ng-value="\'chat\'">Chat</md-option>\n                <md-option ng-value="\'mail\'">Mail</md-option>\n                <md-option ng-value="\'sms\'">Sms</md-option>\n                <md-option ng-value="\'fax\'">Fax</md-option>\n                <md-option ng-value="\'openchannel\'">Openchannel</md-option>\n            </md-select>\n        </md-input-container>\n    </div>\n    <div layout-margin layout="row" layout-align="space-between center">\n        <div flex-gt-xs>\n            <md-datepicker ng-model="vm.dateFrom" md-placeholder="Enter date"></md-datepicker>\n        </div>\n\n        <div flex-gt-xs>\n            <md-datepicker ng-model="vm.dateTo" md-placeholder="Enter date"></md-datepicker>\n        </div>\n    </div>\n</md-content>\n\n<div id="timeline" ms-timeline="vm.timelineOptions" layout="column" ng-if="vm.journey && vm.journey.length">\n    \x3c!-- TIMELINE ITEM --\x3e\n    <div class="ms-timeline-item" layout-align="center center" ng-repeat="item in vm.journey | getChannelByItem:vm.channel:vm.dateFrom:vm.dateTo | orderBy:\'-createdAt\'">\n        <div class="timeline-card">\n            <md-card class="channel" ng-class="{\'md-grey-200-bg\': item.id == vm.interaction.id}">\n                <div class="header p-6" layout="row" layout-align="space-between center">\n\n                    <md-button class="md-fab md-mini" aria-label="icon-channel" ng-class="vm.getColorByItem(item) + \'-bg\'">\n                        <md-icon ng-if="item.FaxAccountId" md-font-icon="icon-deskphone"></md-icon>\n                        <md-icon ng-if="item.OpenchannelAccountId" md-font-icon="icon-google-earth"></md-icon>\n                        <md-icon ng-if="item.SmsAccountId" md-font-icon="icon-message-text"></md-icon>\n                        <md-icon ng-if="item.MailAccountId" md-font-icon="icon-email"></md-icon>\n                        <md-icon ng-if="item.ChatWebsiteId" md-font-icon="icon-hangouts"></md-icon>\n                        <md-icon ng-if="item.amaflags" md-font-icon="icon-phone"></md-icon>\n                    </md-button>\n\n                    <div class="info" layout="column" ng-init="item.showMore = false">\n                        <span class="font-size-12 text-truncate">#{{item.id}} - {{ item.Account.key || item.destination }}</span>\n                        <span class="font-size-10">{{item.createdAt | date: \'medium\'}}</span>\n                        <span>\n                            <a class="toggle-details md-accent-color" ng-hide="item.showMore" ng-click="item.showMore = !item.showMore" translate="DASHBOARDS.SHOW_DETAILS">\n                                Show Details\n                            </a>\n                            <a class="toggle-details md-accent-color" ng-show="item.showMore" ng-click="item.showMore = !item.showMore" translate="DASHBOARDS.HIDE_DETAILS">\n                                Hide Details\n                            </a>\n                        </span>\n                    </div>\n\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\n                </div>\n\n                <div ng-if="item.showMore">\n                    <div ng-if="!item.amaflags" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.all.html\'"></div>\n                    <div ng-if="item.amaflags" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.voice.html\'"></div>\n                </div>\n\n                <md-divider></md-divider>\n\n                <div ng-if="item.id != vm.interaction.id" layout="row" layout-align="space-around center">\n                    <div ng-if="item.closed && !amaflags" class="text-truncate white-fg">\n                        <span class="text-boxed md-background-bg red-fg" title="{{ \'DASHBOARDS.STATUS\' | translate}}: {{ \'DASHBOARDS.CLOSED\' | translate}} ({{ item.disposition || (\'DASHBOARDS.NO_DISPOSITION_SET\' | translate)}})">{{ \'DASHBOARDS.STATUS\' | translate}}: {{ \'DASHBOARDS.CLOSED\' | translate}} ({{ item.disposition || (\'DASHBOARDS.NO_DISPOSITION_SET\' | translate) }})</span>\n                    </div>\n                    <span class="text-boxed md-background-bg green-fg" ng-if="!item.closed && !item.amaflags" title="{{ \'DASHBOARDS.STATUS\' | translate}}: {{ \'DASHBOARDS.OPENED\' | translate}}">{{ \'DASHBOARDS.STATUS\' | translate}}: {{ \'DASHBOARDS.OPENED\' | translate}}<span ng-if="item.substatus"> - {{ item.substatus }}</span></span>\n                    <span ng-if="item.amaflags" class="text-boxed md-background-bg red-fg" title="{{ \'DASHBOARDS.DISPOSITION\' | translate}}: {{ item.userDisposition || \'No Dispose\'}}">{{ \'DASHBOARDS.DISPOSITION\' | translate}}: {{ item.userDisposition || (\'DASHBOARDS.NO_DISPOSITION_SET\' | translate)}}</span>\n                    <div flex></div>\n                    <md-button ng-if="!vm.tab.spy && vm.user.role === \'agent\' && vm.isMyAccount(item)" ng-disabled="item.amaflags" class="md-icon-button" aria-label="go" ng-click="vm.openInteraction($event, item)">\n                        <md-icon md-font-icon="icon-open-in-new" class="s20"></md-icon>\n                    </md-button>\n\n                </div>\n            </md-card>\n        </div>\n    </div>\n    \x3c!-- / TIMELINE ITEM --\x3e\n</div>\n<div ng-if="!vm.journey || !vm.journey.length" 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>{{item.source ? item.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="DASHBOARDS.DESTINATION">Destination</p>\n            <h4>{{item.destination ? item.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="DASHBOARDS.CALLERID">Caller Id</p>\n            <h4>{{item.callerid ? item.callerid : \'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="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.UNIQUEID">Uniqueid</p>\n            <h4>{{item.uniqueid ? item.uniqueid : \'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="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 ng-if="item.threadId" translate="DASHBOARDS.PUBLIC">Public</h4>\n            <h4 ng-if="!item.threadId" translate="DASHBOARDS.PRIVATE">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                    {{ vm.getLabelByMessage(message) }} - {{message.createdAt | date: \'medium\'}}\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                {{ vm.getLabelByMessage(message) }} - {{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                    {{ vm.getLabelByMessage(message) }} - {{message.createdAt | date: \'medium\'}}\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 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>\n        <div ng-if="!message.AttachmentId" 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'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.interaction.mail.html",'<div ms-timeline="vm.timelineOptions" 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">\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></md-tooltip>\n                        <div layout="row" layout-align="start center">\n                            <md-icon md-font-icon="icon-paperclip" class="icon s24"></md-icon><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)">{{ 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]">[{{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)"><strong>{{message.from}}</strong>\n                                        <md-icon ng-if="message.attach" md-font-icon="icon-paperclip" class="s16"></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">{{ message.originTo || message.to }}</span></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"><em><span class="blue-grey" translate="MAIL.YOU_ARE_REGISTERED_AS_A">You are registered as a</span> <span class="blue-grey">CC</span></em></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"><em><span class="red-fg" translate="MAIL.YOU_ARE_REGISTERED_AS_A">You are registered as a</span> <span class="red-fg">BCC</span></em></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">{{message.from}}</span>\n                                    <span class="detail">{{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">{{ message.originCc }}</span>\n                                    <span class="detail" ng-if="message.direction === \'in\' && !message.originCc && !message.originTo && message.cc">{{ message.cc }}</span>\n                                    <span class="detail" ng-if="message.direction === \'out\' && message.cc">{{ message.cc }}</span>\n                                    \x3c!-- End retrocompatibility --\x3e\n                                    <span class="detail" ng-if="message.bcc">{{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\'">{{message.from.indexOf(vm.contact.email) >= 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 || 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                            \x3c!-- <md-button 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> --\x3e\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                            <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></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></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" class="md-icon-button" aria-label="forward" ng-click="vm.downloadMessage(message)">\n                                <md-tooltip md-direction="bottom"><span translate="MAIL.DOWNLOAD">Download</span></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" 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></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>\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">\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><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)">{{ 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>\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 interaction...</span>'),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>'),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"> - {{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" interval="1000">{{ days > 0 ? days + \'d\' : \'\' }} {{hhours}}:{{mminutes}}:{{sseconds}}</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\'"></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\'"></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\'"></div>\n            </div>\n        </div>\n        <md-button ng-if="vm.tab.channel !== \'mail\'" class="md-icon-button" aria-label="Download" ng-click="vm.downloadInteraction(vm.interaction)">\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>\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                <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",'<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>\n<md-menu 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></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>\n            <md-button ng-click="vm.downloadInteraction(vm.interaction, 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.downloadInteraction(vm.interaction)" translate="MAIL.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                Download without attachments\n            </md-button>\n        </md-menu-item>\n    </md-menu-content>\n</md-menu>'),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>'),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" interval="1000">{{ days > 0 ? days + \'d\' : \'\' }} {{hhours}}:{{mminutes}}:{{sseconds}}</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" class="page-layout simple right-sidenav" layout="row">\n    \x3c!-- CENTER --\x3e\n    <div class="center" flex ms-scroll>\n        \x3c!-- CONTENT --\x3e\n        <div class="content">\n            \x3c!--  NOTE: aggoiungere nel controller ng-if="vm.hasPermission()" --\x3e\n            <md-tabs ng-if="vm.hasPermission()" 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-tabs>\n        </div>\n        \x3c!-- END CONTENT --\x3e\n\n        <md-content ng-if="!vm.hasPermission()" 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>\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/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 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="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"></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 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="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" 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 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="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 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="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 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="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="inboundroute-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 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\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 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="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 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="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" 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 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="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 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="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/faxDispositions/dialog.html",'<md-dialog class="faxDisposition-dialog" aria-label="New FaxDisposition">\n    <form name="faxDispositionForm" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="FAX.NAME">Name</label>\n                <input type="" name="name" ng-model="vm.faxDisposition.name" ng-required="true" autofocus>\n\n                <div ng-messages="faxDispositionForm[\'name\'].$error" ng-show="faxDispositionForm[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.newFaxDisposition" ng-click="vm.saveFaxDisposition()" class="send-button md-accent md-raised" ng-disabled="faxDispositionForm.$invalid || faxDispositionForm.$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.newFaxDisposition" ng-click="vm.addNewFaxDisposition()" class="send-button md-accent md-raised" ng-disabled="faxDispositionForm.$invalid" aria-label="ADD" translate="FAX.ADD_FAXDISPOSITION" translate-attr-aria-label="FAX.ADD_FAXDISPOSITION">\n                    ADD FAXDISPOSITION\n                </md-button>\n            </div>\n            <div layout="row">\n                <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newFaxDisposition" ng-click="vm.deleteFaxDisposition($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/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" 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                            <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, 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" 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" 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 class="faxAccount-detail-form-container faxdispositions md-background-bg md-whiteframe-1dp">\n                        <div ng-controller="FaxAccountFaxDispositionsController as vm_dc" ng-init="vm_dc.init(vm.faxAccount, vm.crudPermissions)">\n                            <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedFaxAccountFaxDispositions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead" translate="FAX.FAXDISPOSITIONS">FaxDispositions</span>\n                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\n                                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditFaxAccountFaxDisposition($event)" aria-label="add faxDisposition" translate translate-attr-label="FAX.ADD_FAXDISPOSITION">\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.selectedFaxAccountFaxDispositions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead">{{vm_dc.selectedFaxAccountFaxDispositions.length}} {{vm_dc.selectedFaxAccountFaxDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                                    <div flex></div>\n                                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedFaxAccountFaxDispositions" 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.deleteSelectedFaxAccountFaxDispositions($event)" aria-label="delete selected" translate translate-attr-label="FAXACCOUNTS.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.selectedFaxAccountFaxDispositions" md-progress="vm_dc.promise">\n                                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getFaxAccountFaxDispositions">\n                                        <tr md-row>\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="createdAt">{{ \'FAX.CREATED_AT\' | translate }}</th>\n                                            <th md-column width="10px"></th>\n                                        </tr>\n                                    </thead>\n                                    <tbody md-body>\n                                        <tr md-row md-select="faxDisposition" md-select-id="id" ng-repeat="faxDisposition in vm_dc.faxAccountFaxDispositions.rows">\n                                            <td ng-click="vm_dc.createOrEditFaxAccountFaxDisposition($event, faxDisposition)" md-cell>{{faxDisposition.id}}</td>\n                                            <td ng-click="vm_dc.createOrEditFaxAccountFaxDisposition($event, faxDisposition)" md-cell>{{faxDisposition.name}}</td>\n                                            <td ng-click="vm_dc.createOrEditFaxAccountFaxDisposition($event, faxDisposition)" md-cell>{{faxDisposition.createdAt | date:\'medium\'}}</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\n                                                    <md-menu-content width="3">\n                                                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                                                            <md-button ng-click="vm_dc.createOrEditFaxAccountFaxDisposition($event, faxDisposition)" translate="FAX.EDIT_FAXDISPOSITION">\n                                                                Edit FaxDisposition\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(faxDisposition, $event)" translate="FAX.DELETE_FAXDISPOSITION">\n                                                                Delete FaxDisposition\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.faxAccountFaxDispositions.rows.length">\n                                            <td md-cell colspan="5">\n                                                <span class="text-boxed-ligth" translate="FAX.NO_FAXDISPOSITION_AVAILABLE">No faxdisposition available</span>\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.faxAccountFaxDispositions.count}}" md-on-paginate="vm_dc.getFaxAccountFaxDispositions" 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="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" ms-scroll 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.alias || a.appType) | uppercase}}">{{a.alias || 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" ms-scroll 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" style="width:200px">{{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-ligth" 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)">\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                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="FAXACCOUNTS.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.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">{{ \'FAX.ID\' | translate }}</th>\n                                            <th md-column md-order-by="createdAt">{{ \'FAX.STARTEDAT\' | translate }}</th>\n                                            <th md-column>{{ \'FAX.CONTACT\' | translate }}</th>\n                                            <th md-column>{{ \'FAX.AGENT\' | translate }}</th>\n                                            <th md-column md-order-by="closedAt">{{ \'FAX.CLOSEDAT\' | translate }}</th>\n                                            <th md-column md-order-by="disposition">{{ \'FAX.DISPOSITION\' | translate }}</th>\n                                            <th md-column md-order-by="note">{{ \'FAX.NOTES\' | translate }}</th>\n                                            <th md-column md-order-by="tag">{{ \'FAX.TAGS\' | translate }}</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">\n                                            <td md-cell>{{interaction.id}}</td>\n                                            <td md-cell>{{interaction.createdAt | date:\'medium\'}}</td>\n                                            <td md-cell>{{interaction.Contact.firstName}}</td>\n                                            <td md-cell>{{interaction.Owner.name}}</td>\n                                            <td md-cell>{{interaction.closedAt | date:\'medium\'}}</td>\n                                            <td md-cell>{{interaction.disposition}}</td>\n                                            <td md-cell>{{interaction.note}}</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"></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>\n                                                            <md-button class="md-primary" ng-click="vm_dc.faxInteractionDownload(interaction, $event)" translate="FAX.DOWNLOAD_INTERACTION">\n                                                                Download Interaction\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="13">\n                                                <span class="text-boxed-ligth" translate="FAX.NO_INTERACTION_AVAILABLE">No interaction available</span>\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 animate-slide-down 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="FAXACCOUNTS.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="FAXACCOUNTS.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!-- 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})[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                                <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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(faxAccount, $event)" translate="FAX.EDIT_FAXACCOUNT">\n                                                    Edit FaxAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.interactionsgoto(faxAccount, $event)" translate="FAX.INTERACTIONS_FAXACCOUNT">\n                                                    Interactions FaxAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.gotorealtimegoto(faxAccount, $event)" translate="FAX.GOTOREALTIME_FAXACCOUNT">\n                                                    goToRealtime FaxAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.agentadddialog(faxAccount, $event)" translate="FAX.AGENTADD_FAXACCOUNT">\n                                                    AgentAdd FaxAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(faxAccount, $event)" translate="FAX.DELETE_FAXACCOUNT">\n                                                    Delete FaxAccount\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            </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 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="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" 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"></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"></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" 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 animate-slide-down 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="FAXQUEUES.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="FAXQUEUES.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!-- 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                                <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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(faxQueue, $event)" translate="FAX.EDIT_FAXQUEUE">\n                                                    Edit FaxQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.teamadddialog(faxQueue, $event)" translate="FAX.TEAMADD_FAXQUEUE">\n                                                    teamadd FaxQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.agentadddialog(faxQueue, $event)" translate="FAX.AGENTADD_FAXQUEUE">\n                                                    agentadd FaxQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(faxQueue, $event)" translate="FAX.DELETE_FAXQUEUE">\n                                                    Delete FaxQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.gotorealtimegoto(faxQueue, $event)" translate="FAX.GOTOREALTIME_FAXQUEUE">\n                                                    goToRealtime FaxQueue\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.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.query.filter = 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.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">\n                <td md-cell colspan="4">\n                    <div layout="row" layout-align="center center">\n                        <span tranlsate="FAX.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-row md-select="vm.faxAccounts[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td md-cell>{{vm.faxAccounts[value].name}}</td>\n                <td md-cell>{{vm.faxAccounts[value].key}}</td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{(vm.faxAccounts[value].in || 0) + (vm.faxAccounts[value].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">{{vm.faxAccounts[value].in || 0}}</span>\n                        <span class="text-boxed" ng-if="mailAccount.in">{{vm.faxAccounts[value].lastIn ?  (vm.faxAccounts[value].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">{{vm.faxAccounts[value].out || 0}}</span>\n                        <span class="text-boxed" ng-if="mailAccount.out">{{vm.faxAccounts[value].lastOut ?  (vm.faxAccounts[value].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, vm.faxAccounts[value])" 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.count}}" md-on-paginate="vm.getfaxAccounts" md-page-select></md-table-pagination>\n\x3c!-- / AGENT TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/fax/views/realtime/agents/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.AGENTS">Agents</span>\n        <div flex></div>\n        <ms-search-bar on-search="vm.query.filter = query; vm.onInit()" on-collapse="vm.query.filter = undefined; vm.onInit()" debounce="300"></ms-search-bar>\n        <md-select ng-model="vm.query.globalStatusFilter" class="md-caption" ng-change="vm.query.pauseTypeFilter = \'\'; vm.onInit()">\n            <md-option ng-value="\'\'">{{ \'FAX.ALL\' | translate }}</md-option>\n            <md-option value="pause">{{ \'FAX.PAUSE\' | translate }}</md-option>\n            <md-option value="*pause">{{ \'FAX.PARTIALPAUSE\' | translate }}</md-option>\n            <md-option value="busy">{{ \'FAX.BUSY\' | translate }}</md-option>\n            <md-option value="idle">{{ \'FAX.IDLE\' | translate }}</md-option>\n        </md-select>\n\n        <md-select ng-if="vm.isPause(vm.query.globalStatusFilter)" ng-model="vm.query.pauseTypeFilter" class="md-caption" ng-change="vm.onInit()">\n            <md-option ng-value="\'\'">All</md-option>\n            <md-option value="DEFAULT PAUSE">DEFAULT PAUSE</md-option>\n            <md-option value="ACW">ACW</md-option>\n            <md-option value="LOGININPAUSE">LOGININPAUSE</md-option>\n            <md-option value="Auto-Pause">AUTOPAUSE</md-option>\n            <md-option ng-value="pause.name" ng-repeat="pause in vm.pauses.rows">{{pause.name}}</md-option>\n        </md-select>\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.order" md-on-reorder="vm.onInit">\n            <tr md-row border="1">\n                <th class="bv text-center" colspan="4">{{ \'FAX.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">{{ \'OPENCHANNEL.OPENCHANNEL\' | translate }}</th>\n                <th ng-if="vm.license.fax" class="bv bl text-center" colspan="2">{{ \'FAX.FAX\' | translate }}</th>\n                <th width="10px" class="bt bl" rowspan="2"></th>\n            </tr>\n            <tr md-row>\n                <th class="bl" md-column md-order-by="fullname">{{ \'FAX.NAME\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="globalStatus">{{ \'FAX.STATUS\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="lastLoginAt">{{ \'FAX.LOGIN_TIME\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="lastPauseAt">{{ \'FAX.PAUSE_TIME\' | translate }}</th>\n\n                <th class="bl custom-column">{{ \'VOICE.STATUS\' | translate }}</th>\n                <th class="bl custom-column">Info</th>\n\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\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\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\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\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            </tr>\n        </thead>\n        <tbody md-body>\n            <tr md-row ng-hide="vm.order.length">\n                <td md-cell colspan="17">\n                    <div layout="row" layout-align="center center">\n                        <span>{{ \'FAX.NO_AGENT_ONLINE\' | translate }}</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-select="vm.agents[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td class="bt padding-5">\n                    <div layout="row" layout-align="start center">\n                        <img class="avatar" ng-src="{{vm.agents[value].userpic && \'api/users/\'+vm.agents[value].id+\'/avatar\' || \'assets/images/avatars/profile.png\'}}">\n                        <div layout="column">\n                            <span>{{vm.agents[value].fullname}}</span>\n                            <span>{{vm.agents[value].internal}}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class="bt">\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'}[vm.agents[value].globalStatus]\">{{ vm.isPause(vm.agents[value].globalStatus) ? '' : vm.agents[value].globalStatus | uppercase }} {{ vm.isPause(vm.agents[value].globalStatus) ? (vm.isPartialPause(vm.agents[value].globalStatus) ? '*'+vm.agents[value].pauseType || 'DEFAULT PAUSE'  : vm.agents[value].pauseType || 'DEFAULT PAUSE') : ''}}</span>\n                </td>\n                <td class=\"bt custom-column\">\n                    <timer start-time=\"vm.agents[value].lastLoginAt\" interval=\"1000\">{{ days > 0 ? days + 'd' : '' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                </td>\n                <td class=\"bt custom-column\">\n                    <timer ng-if=\"vm.isPause(vm.agents[value].globalStatus) || vm.isPartialPause(vm.agents[value].globalStatus)\" start-time=\"vm.agents[value].lastPauseAt\" interval=\"1000\">{{ days > 0 ? days + 'd' : '' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                </td>\n                <td class=\"bt bl\">\n                    <div layout=\"row\">\n                        <span ng-if=\"!vm.agents[value].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'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].voiceStatus | uppercase }}</span>\n                        <span ng-if=\"vm.agents[value].onhold\" class=\"text-boxed md-background-bg bl bt padding-5 orange-400-bg\">ONHOLD</span>\n                    </div>\n                </td>\n                <td class=\"bt bl\">\n                    <div layout=\"column\">\n                        <span ng-if=\"vm.agents[value].queue\" class=\"padding-5\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].queue }}</span>\n                        <span ng-if=\"vm.agents[value].destconnectedlinenum\" class=\"padding-5\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].destconnectedlinenum }}</span>\n                        <span class=\"padding-5\" ng-if=\"vm.agents[value].queue || vm.agents[value].destconnectedlinenum\">\n                            <timer start-time=\"vm.agents[value].voiceStatusTime\" interval=\"1000\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                        </span>\n                    </div>\n                </td>\n                <td class=\"bt bl\" ng-if=\"vm.license.chat\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].chatStatus]\">{{ vm.agents[value].chatStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td md-number class=\"bt text-center font-size-20\" ng-if=\"vm.license.chat\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].chatStatus]\">{{ vm.agents[value].chatCurrentCapacity }}</td>\n                <td class=\"bl bt\" ng-if=\"vm.license.mail\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].mailStatus]\">{{ vm.agents[value].mailStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.mail\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].mailStatus]\">{{ vm.agents[value].mailCurrentCapacity }}</td>\n                <td class=\"bl bt\" ng-if=\"vm.license.messaging\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].smsStatus]\">{{ vm.agents[value].smsStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.messaging\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].smsStatus]\">{{ vm.agents[value].smsCurrentCapacity }}</td>\n                <td class=\"bt bl\" ng-if=\"vm.license.openchannel\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].openchannelStatus]\">{{ vm.agents[value].openchannelStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.openchannel\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].openchannelStatus]\">{{ vm.agents[value].openchannelCurrentCapacity }}</td>\n                <td class=\"bt bl\" ng-if=\"vm.license.fax\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].faxStatus]\">{{ vm.agents[value].faxStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.fax\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].faxStatus]\">{{ vm.agents[value].faxCurrentCapacity }}</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\n                        <md-menu-content width=\"4\">\n                            <md-menu-item>\n                                <md-button ng-click=\"vm.logout(vm.agents[value], $event)\" translate=\"FAX.LOGOUT\">\n                                    Logout\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-button ng-click=\"vm.queueAdd(vm.agents[value], $event)\" translate=\"FAX.AGENTADD_QUEUE\">\n                                    Add Agent In Queue\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-menu>\n                                    <md-button ng-click=\"$mdMenu.open()\" class=\"text-capitalize\" translate=\"FAX.PAUSE\">Pause</md-button>\n                                    <md-menu-content>\n                                        <md-menu-item>\n                                            <md-button ng-disabled=\" vm.agents[value].voicePause && 'DEFAULT PAUSE' === vm.agents[value].pauseType\" ng-click=\"vm.pause(vm.agents[value])\"><em translate=\"FAX.DEFAULT_PAUSE\">Default Pause</em></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=\"vm.agents[value].voicePause && pause.name === vm.agents[value].pauseType\" ng-click=\"vm.pause(vm.agents[value], pause.name)\">{{pause.name}}</md-button>\n                                        </md-menu-item>\n                                    </md-menu-content>\n                                </md-menu>\n                            </md-menu-item>\n                            <md-menu-item ng-if=\"vm.isPause(vm.agents[value].globalStatus)\">\n                                <md-button ng-click=\"vm.unPause(vm.agents[value])\" translate=\"FAX.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\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.filteredAgents.length}}\" md-on-paginate=\"vm.onInit\" md-page-select></md-table-pagination>\n\x3c!-- / AGENT TABLE --\x3e\n\x3c!-- / MAIN --\x3e"),e.put("app/main/apps/fax/views/realtime/queues/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.QUEUES">Queues</span>\n        <div flex></div>\n        <ms-search-bar on-search="vm.query.filter = 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">{{ \'FAX.NAME\' | translate }}</th>\n                <th md-column>{{ \'FAX.LOGGED_IN\' | translate }}</th>\n                <th md-column>{{ \'FAX.PAUSED\' | translate }}</th>\n                <th md-column>{{ \'FAX.READY\' | translate }}</th>\n                <th md-column>{{ \'FAX.WAITING\' | translate }}</th>\n                <th md-column width="10px"></th>\n            </tr>\n        </thead>\n        <tbody md-body>\n            <tr md-row ng-hide="vm.queues">\n                <td md-cell colspan="7">\n                    <div layout="row" layout-align="center center">\n                        <span tranlsate="FAX.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-row md-select="vm.queues[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td md-cell>{{vm.queues[value].name}}</td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].loggedInDb || 0}} ({{vm.queues[value].loggedIn || 0}})</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].paused || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-16 grey-fg">{{vm.queues[value].available || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].waiting || 0}}</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="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.createOrEditFaxQueue($event, vm.queues[value])" translate="FAX.EDIT_QUEUE">\n                                    Edit Queue\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-button ng-click="vm.agentAdd($event, vm.queues[value])" translate="FAX.AGENTSADD_QUEUE">\n                                    Add Agents to queue\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.getQueues" md-page-select></md-table-pagination>\n\x3c!-- / QUEUE 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.query.filter = query;" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n        \x3c!-- <md-button class="md-icon-button" ng-click="vm.showInfo($event)">\n      <i class="icon-information-outline grey-600-fg">\n        <md-tooltip>{{\'FAX.INFO\' | translate}}</md-tooltip>\n      </i>\n    </md-button> --\x3e\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>\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 tranlsate="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" ms-scroll>\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="http://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 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="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">\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 animate-slide-down 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="DESKACCOUNTS.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="DESKACCOUNTS.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!-- 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                                <td md-cell class="actions">\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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(deskAccount, $event)" translate="INTEGRATIONS.EDIT_DESKACCOUNT">\n                                                    Edit DeskAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.testtestintegrationaccount(deskAccount, $event)" translate="INTEGRATIONS.TEST_DESKACCOUNT">\n                                                    Test DeskAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(deskAccount, $event)" translate="INTEGRATIONS.DELETE_DESKACCOUNT">\n                                                    Delete DeskAccount\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: \'{{\'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 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="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 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 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 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 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 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 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 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}}</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 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}}</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                            <md-select name="customField" ng-model="vm.customField" required>\n                                <md-optgroup label="Standard">\n                                    <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}</md-option>\n                                </md-optgroup>\n                                <md-optgroup label="Custom">\n                                    <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}</md-option>\n                                </md-optgroup>\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 required</span>\n                                </div>\n                            </div>\n                        </md-input-container>\n                        \x3c!-- CUSTOM FIELD --\x3e\n                        <div ng-if="vm.customField && vm.customField.custom" ng-include="\'/subject.html\'"></div>\n                        \x3c!-- / CUSTOM FIELD --\x3e\n                        \x3c!-- STANDARD FIELD --\x3e\n                        <md-input-container class="md-block" ng-if="vm.customField && !vm.customField.custom && vm.customField.options.length">\n                            <label translate="INTEGRATIONS.VALUE">Value</label>\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                            <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                        <md-input-container class="md-block" ng-if="vm.customField && !vm.customField.custom && !vm.customField.options.length">\n                            <label translate="INTEGRATIONS.VALUE">Value</label>\n                            <input type="text" name="option" ng-model="vm.item.content" required>\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                        \x3c!-- / STANDARD FIELD --\x3e\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="/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" ng-if="vm.customField.options.length">Options</md-option>\n            <md-option value="string" ng-if="!vm.customField.options.length">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    \x3c!-- <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 is required</span>\n            </div>\n        </div>\n    </md-input-container>--\x3e\n    <md-input-container class="md-block" ng-if="vm.item.type == \'string\' && vm.customField.options.length">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\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                <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\' && !vm.customField.options.length">\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 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}}</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 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.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" 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 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="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            <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            <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" required>\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">\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            <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\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 animate-slide-down 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="DYNAMICS365ACCOUNTS.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="DYNAMICS365ACCOUNTS.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!-- 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="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.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="username ">{{dynamics365Account.username}}</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="remoteUri ">{{dynamics365Account.remoteUri}}</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="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.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(dynamics365Account, $event)" translate="INTEGRATIONS.EDIT_DYNAMICS365ACCOUNT">\n                                                    Edit Dynamics365Account\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.testtestintegrationaccount(dynamics365Account, $event)" translate="INTEGRATIONS.TEST_DYNAMICS365ACCOUNT">\n                                                    Test Dynamics365Account\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.deleteconfirm(dynamics365Account, $event)" translate="INTEGRATIONS.DELETE_DYNAMICS365ACCOUNT">\n                                                    Delete Dynamics365Account\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: \'{{\'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 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="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 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 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 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 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 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 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 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}}</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 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}}</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                            <md-select name="customField" ng-model="vm.customField" required>\n                                <md-optgroup label="Standard">\n                                    <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}</md-option>\n                                </md-optgroup>\n                                <md-optgroup label="Custom">\n                                    <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}</md-option>\n                                </md-optgroup>\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 required</span>\n                                </div>\n                            </div>\n                        </md-input-container>\n                        \x3c!-- CUSTOM FIELD --\x3e\n                        <div ng-if="vm.customField && vm.customField.custom" ng-include="\'/subject.html\'"></div>\n                        \x3c!-- / CUSTOM FIELD --\x3e\n                        \x3c!-- STANDARD FIELD --\x3e\n                        <md-input-container class="md-block" ng-if="vm.customField && !vm.customField.custom && vm.customField.options.length">\n                            <label translate="INTEGRATIONS.VALUE">Value</label>\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                            <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                        <md-input-container class="md-block" ng-if="vm.customField && !vm.customField.custom && !vm.customField.options.length">\n                            <label translate="INTEGRATIONS.VALUE">Value</label>\n                            <input type="text" name="option" ng-model="vm.item.content" required>\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                        \x3c!-- / STANDARD FIELD --\x3e\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="/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" ng-if="vm.customField.options.length">Options</md-option>\n            <md-option value="string" ng-if="!vm.customField.options.length">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    \x3c!-- <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 is required</span>\n            </div>\n        </div>\n    </md-input-container>--\x3e\n    <md-input-container class="md-block" ng-if="vm.item.type == \'string\' && vm.customField.options.length">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\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                <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\' && !vm.customField.options.length">\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 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}}</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 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.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                            <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\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.dynamics365Account.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.URI">Uri</label>\n                                <input type="url" name="remoteUri" ng-model="vm.dynamics365Account.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.TENANTID">TenantId</label>\n                                <input type="text" name="tenantId" ng-model="vm.dynamics365Account.tenantId" ng-required="true" 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="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.dynamics365Account.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.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                                <input type="url" name="serverUrl" ng-model="vm.dynamics365Account.serverUrl" 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.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            <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\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\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/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 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="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">\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 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="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 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 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 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 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 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 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 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}}</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 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}}</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                            <md-select name="customField" ng-model="vm.customField" required>\n                                <md-optgroup label="Standard">\n                                    <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}</md-option>\n                                </md-optgroup>\n                                <md-optgroup label="Custom">\n                                    <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}</md-option>\n                                </md-optgroup>\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 required</span>\n                                </div>\n                            </div>\n                        </md-input-container>\n                        \x3c!-- CUSTOM FIELD --\x3e\n                        <div ng-if="vm.customField && vm.customField.custom" ng-include="\'/subject.html\'"></div>\n                        \x3c!-- / CUSTOM FIELD --\x3e\n                        \x3c!-- STANDARD FIELD --\x3e\n                        <md-input-container class="md-block" ng-if="vm.customField && !vm.customField.custom && vm.customField.options.length">\n                            <label translate="INTEGRATIONS.VALUE">Value</label>\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                            <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                        <md-input-container class="md-block" ng-if="vm.customField && !vm.customField.custom && !vm.customField.options.length">\n                            <label translate="INTEGRATIONS.VALUE">Value</label>\n                            <input type="text" name="option" ng-model="vm.item.content" required>\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                        \x3c!-- / STANDARD FIELD --\x3e\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="/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" ng-if="vm.customField.options.length">Options</md-option>\n            <md-option value="string" ng-if="!vm.customField.options.length">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    \x3c!-- <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 is required</span>\n            </div>\n        </div>\n    </md-input-container>--\x3e\n    <md-input-container class="md-block" ng-if="vm.item.type == \'string\' && vm.customField.options.length">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\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                <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\' && !vm.customField.options.length">\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 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}}</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 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.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" 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 animate-slide-down 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="FRESHDESKACCOUNTS.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="FRESHDESKACCOUNTS.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!-- 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                                <td md-cell class="actions">\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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(freshdeskAccount, $event)" translate="INTEGRATIONS.EDIT_FRESHDESKACCOUNT">\n                                                    Edit FreshdeskAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.testtestintegrationaccount(freshdeskAccount, $event)" translate="INTEGRATIONS.TEST_FRESHDESKACCOUNT">\n                                                    Test FreshdeskAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(freshdeskAccount, $event)" translate="INTEGRATIONS.DELETE_FRESHDESKACCOUNT">\n                                                    Delete FreshdeskAccount\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: \'{{\'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/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 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="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">\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 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="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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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 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 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 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 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 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 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 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}}</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 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}}</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                            <md-select name="customField" ng-model="vm.customField" required>\n                                <md-optgroup label="Standard">\n                                    <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}</md-option>\n                                </md-optgroup>\n                                <md-optgroup label="Custom">\n                                    <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}</md-option>\n                                </md-optgroup>\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 required</span>\n                                </div>\n                            </div>\n                        </md-input-container>\n                        \x3c!-- CUSTOM FIELD --\x3e\n                        <div ng-if="vm.customField && vm.customField.custom" ng-include="\'/subject.html\'"></div>\n                        \x3c!-- / CUSTOM FIELD --\x3e\n                        \x3c!-- STANDARD FIELD --\x3e\n                        <md-input-container class="md-block" ng-if="vm.customField && !vm.customField.custom && vm.customField.options.length">\n                            <label translate="INTEGRATIONS.VALUE">Value</label>\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                            <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                        <md-input-container class="md-block" ng-if="vm.customField && !vm.customField.custom && !vm.customField.options.length">\n                            <label translate="INTEGRATIONS.VALUE">Value</label>\n                            <input type="text" name="option" ng-model="vm.item.content" required>\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                        \x3c!-- / STANDARD FIELD --\x3e\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="/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" ng-if="vm.customField.options.length">Options</md-option>\n            <md-option value="string" ng-if="!vm.customField.options.length">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    \x3c!-- <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 is required</span>\n            </div>\n        </div>\n    </md-input-container>--\x3e\n    <md-input-container class="md-block" ng-if="vm.item.type == \'string\' && vm.customField.options.length">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\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                <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\' && !vm.customField.options.length">\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 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}}</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 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.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" 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">ADVANCED</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: \'contact_lead\', value: \'Contact & Lead\'}, {key: \'contact\', value: \'Contact\'}, {key: \'lead\', value: \'Lead\'}]">{{ 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\'}]">{{ 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.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 animate-slide-down 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="SALESFORCEACCOUNTS.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="SALESFORCEACCOUNTS.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!-- 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                                <td md-cell class="actions">\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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(salesforceAccount, $event)" translate="INTEGRATIONS.EDIT_SALESFORCEACCOUNT">\n                                                    Edit SalesforceAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.testtestintegrationaccount(salesforceAccount, $event)" translate="INTEGRATIONS.TEST_SALESFORCEACCOUNT">\n                                                    Test SalesforceAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(salesforceAccount, $event)" translate="INTEGRATIONS.DELETE_SALESFORCEACCOUNT">\n                                                    Delete SalesforceAccount\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: \'{{\'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 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="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">\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 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="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 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 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 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 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 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 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 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}}</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 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}}</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                            <md-select name="customField" ng-model="vm.customField" required>\n                                <md-optgroup label="Standard">\n                                    <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}</md-option>\n                                </md-optgroup>\n                                <md-optgroup label="Custom">\n                                    <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}</md-option>\n                                </md-optgroup>\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 required</span>\n                                </div>\n                            </div>\n                        </md-input-container>\n                        \x3c!-- CUSTOM FIELD --\x3e\n                        <div ng-if="vm.customField && vm.customField.custom" ng-include="\'/subject.html\'"></div>\n                        \x3c!-- / CUSTOM FIELD --\x3e\n                        \x3c!-- STANDARD FIELD --\x3e\n                        <md-input-container class="md-block" ng-if="vm.customField && !vm.customField.custom && vm.customField.options.length">\n                            <label translate="INTEGRATIONS.VALUE">Value</label>\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                            <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                        <md-input-container class="md-block" ng-if="vm.customField && !vm.customField.custom && !vm.customField.options.length">\n                            <label translate="INTEGRATIONS.VALUE">Value</label>\n                            <input type="text" name="option" ng-model="vm.item.content" required>\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                        \x3c!-- / STANDARD FIELD --\x3e\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="/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" ng-if="vm.customField.options.length">Options</md-option>\n            <md-option value="string" ng-if="!vm.customField.options.length">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    \x3c!-- <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 is required</span>\n            </div>\n        </div>\n    </md-input-container>--\x3e\n    <md-input-container class="md-block" ng-if="vm.item.type == \'string\' && vm.customField.options.length">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\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                <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\' && !vm.customField.options.length">\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 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}}</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 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.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" 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                                    <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.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 animate-slide-down 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="SERVICENOWACCOUNTS.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="SERVICENOWACCOUNTS.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!-- 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                                <td md-cell class="actions">\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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(servicenowAccount, $event)" translate="INTEGRATIONS.EDIT_SERVICENOWACCOUNT">\n                                                    Edit ServicenowAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.testtestintegrationaccount(servicenowAccount, $event)" translate="INTEGRATIONS.TEST_SERVICENOWACCOUNT">\n                                                    Test ServicenowAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.deleteconfirm(servicenowAccount, $event)" translate="INTEGRATIONS.DELETE_SERVICENOWACCOUNT">\n                                                    Delete ServicenowAccount\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: \'{{\'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 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="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">\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 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="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 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 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 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 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 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 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 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}}</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 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}}</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                            <md-select name="customField" ng-model="vm.customField" required>\n                                <md-optgroup label="Standard">\n                                    <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}</md-option>\n                                </md-optgroup>\n                                <md-optgroup label="Custom">\n                                    <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}</md-option>\n                                </md-optgroup>\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 required</span>\n                                </div>\n                            </div>\n                        </md-input-container>\n                        \x3c!-- CUSTOM FIELD --\x3e\n                        <div ng-if="vm.customField && vm.customField.custom" ng-include="\'/subject.html\'"></div>\n                        \x3c!-- / CUSTOM FIELD --\x3e\n                        \x3c!-- STANDARD FIELD --\x3e\n                        <md-input-container class="md-block" ng-if="vm.customField && !vm.customField.custom && vm.customField.options.length">\n                            <label translate="INTEGRATIONS.VALUE">Value</label>\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                            <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                        <md-input-container class="md-block" ng-if="vm.customField && !vm.customField.custom && !vm.customField.options.length">\n                            <label translate="INTEGRATIONS.VALUE">Value</label>\n                            <input type="text" name="option" ng-model="vm.item.content" required>\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                        \x3c!-- / STANDARD FIELD --\x3e\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="/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" ng-if="vm.customField.options.length">Options</md-option>\n            <md-option value="string" ng-if="!vm.customField.options.length">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    \x3c!-- <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 is required</span>\n            </div>\n        </div>\n    </md-input-container>--\x3e\n    <md-input-container class="md-block" ng-if="vm.item.type == \'string\' && vm.customField.options.length">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\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                <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\' && !vm.customField.options.length">\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 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}}</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 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.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" 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 animate-slide-down 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="SUGARCRMACCOUNTS.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="SUGARCRMACCOUNTS.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!-- 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                                <td md-cell class="actions">\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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(sugarcrmAccount, $event)" translate="INTEGRATIONS.EDIT_SUGARCRMACCOUNT">\n                                                    Edit SugarcrmAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.testtestintegrationaccount(sugarcrmAccount, $event)" translate="INTEGRATIONS.TEST_SUGARCRMACCOUNT">\n                                                    Test SugarcrmAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.deleteconfirm(sugarcrmAccount, $event)" translate="INTEGRATIONS.DELETE_SUGARCRMACCOUNT">\n                                                    Delete SugarcrmAccount\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: \'{{\'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 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="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">\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 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="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 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 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 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 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 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 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 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}}</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 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}}</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                            <md-select name="customField" ng-model="vm.customField" required>\n                                <md-optgroup label="Standard">\n                                    <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}</md-option>\n                                </md-optgroup>\n                                <md-optgroup label="Custom">\n                                    <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}</md-option>\n                                </md-optgroup>\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 required</span>\n                                </div>\n                            </div>\n                        </md-input-container>\n                        \x3c!-- CUSTOM FIELD --\x3e\n                        <div ng-if="vm.customField && vm.customField.custom" ng-include="\'/subject.html\'"></div>\n                        \x3c!-- / CUSTOM FIELD --\x3e\n                        \x3c!-- STANDARD FIELD --\x3e\n                        <md-input-container class="md-block" ng-if="vm.customField && !vm.customField.custom && vm.customField.options.length">\n                            <label translate="INTEGRATIONS.VALUE">Value</label>\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                            <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                        <md-input-container class="md-block" ng-if="vm.customField && !vm.customField.custom && !vm.customField.options.length">\n                            <label translate="INTEGRATIONS.VALUE">Value</label>\n                            <input type="text" name="option" ng-model="vm.item.content" required>\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                        \x3c!-- / STANDARD FIELD --\x3e\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="/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" ng-if="vm.customField.options.length">Options</md-option>\n            <md-option value="string" ng-if="!vm.customField.options.length">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    \x3c!-- <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 is required</span>\n            </div>\n        </div>\n    </md-input-container>--\x3e\n    <md-input-container class="md-block" ng-if="vm.item.type == \'string\' && vm.customField.options.length">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\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                <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\' && !vm.customField.options.length">\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 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}}</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 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.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" 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 animate-slide-down 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="VTIGERACCOUNTS.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="VTIGERACCOUNTS.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!-- 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                                <td md-cell class="actions">\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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(vtigerAccount, $event)" translate="INTEGRATIONS.EDIT_VTIGERACCOUNT">\n                                                    Edit VtigerAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.testtestintegrationaccount(vtigerAccount, $event)" translate="INTEGRATIONS.TEST_VTIGERACCOUNT">\n                                                    Test VtigerAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(vtigerAccount, $event)" translate="INTEGRATIONS.DELETE_VTIGERACCOUNT">\n                                                    Delete VtigerAccount\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: \'{{\'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 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="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">\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 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 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 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 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 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 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 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}}</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 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}}</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                            <md-select name="customField" ng-model="vm.customField" required>\n                                <md-optgroup label="Standard">\n                                    <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}</md-option>\n                                </md-optgroup>\n                                <md-optgroup label="Custom">\n                                    <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}</md-option>\n                                </md-optgroup>\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 required</span>\n                                </div>\n                            </div>\n                        </md-input-container>\n                        \x3c!-- CUSTOM FIELD --\x3e\n                        <div ng-if="vm.customField && vm.customField.custom" ng-include="\'/subject.html\'"></div>\n                        \x3c!-- / CUSTOM FIELD --\x3e\n                        \x3c!-- STANDARD FIELD --\x3e\n                        <md-input-container class="md-block" ng-if="vm.customField && !vm.customField.custom && vm.customField.options.length">\n                            <label translate="INTEGRATIONS.VALUE">Value</label>\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                            <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                        <md-input-container class="md-block" ng-if="vm.customField && !vm.customField.custom && !vm.customField.options.length">\n                            <label translate="INTEGRATIONS.VALUE">Value</label>\n                            <input type="text" name="option" ng-model="vm.item.content" required>\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                        \x3c!-- / STANDARD FIELD --\x3e\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="/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" ng-if="vm.customField.options.length">Options</md-option>\n            <md-option value="string" ng-if="!vm.customField.options.length">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    \x3c!-- <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 is required</span>\n            </div>\n        </div>\n    </md-input-container>--\x3e\n    <md-input-container class="md-block" ng-if="vm.item.type == \'string\' && vm.customField.options.length">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\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                <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\' && !vm.customField.options.length">\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 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}}</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 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.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" 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 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="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 animate-slide-down 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="ZENDESKACCOUNTS.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="ZENDESKACCOUNTS.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!-- 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                                <td md-cell class="actions">\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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(zendeskAccount, $event)" translate="INTEGRATIONS.EDIT_ZENDESKACCOUNT">\n                                                    Edit ZendeskAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.testtestintegrationaccount(zendeskAccount, $event)" translate="INTEGRATIONS.TEST_ZENDESKACCOUNT">\n                                                    Test ZendeskAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(zendeskAccount, $event)" translate="INTEGRATIONS.DELETE_ZENDESKACCOUNT">\n                                                    Delete ZendeskAccount\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: \'{{\'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 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="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.AUTHTOKEN">AuthToken</label>\n                <input type="text" name="authToken" ng-model="vm.zohoAccount.authToken" ng-required="true">\n\n                <div ng-messages="zohoAccountForm[\'authToken\'].$error" ng-show="zohoAccountForm[\'authToken\'].$touched" role="alert">\n                    <div ng-message="required">\n                        <span translate="INTEGRATIONS.ERRORS.AUTHTOKEN_REQUIRED">AuthToken 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">\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 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="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 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 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 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 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 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 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 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}}</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 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}}</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                            <md-select name="customField" ng-model="vm.customField" required>\n                                <md-optgroup label="Standard">\n                                    <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}</md-option>\n                                </md-optgroup>\n                                <md-optgroup label="Custom">\n                                    <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}</md-option>\n                                </md-optgroup>\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 required</span>\n                                </div>\n                            </div>\n                        </md-input-container>\n                        \x3c!-- CUSTOM FIELD --\x3e\n                        <div ng-if="vm.customField && vm.customField.custom" ng-include="\'/subject.html\'"></div>\n                        \x3c!-- / CUSTOM FIELD --\x3e\n                        \x3c!-- STANDARD FIELD --\x3e\n                        <md-input-container class="md-block" ng-if="vm.customField && !vm.customField.custom && vm.customField.options.length">\n                            <label translate="INTEGRATIONS.VALUE">Value</label>\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                            <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                        <md-input-container class="md-block" ng-if="vm.customField && !vm.customField.custom && !vm.customField.options.length">\n                            <label translate="INTEGRATIONS.VALUE">Value</label>\n                            <input type="text" name="option" ng-model="vm.item.content" required>\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                        \x3c!-- / STANDARD FIELD --\x3e\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="/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" ng-if="vm.customField.options.length">Options</md-option>\n            <md-option value="string" ng-if="!vm.customField.options.length">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    \x3c!-- <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 is required</span>\n            </div>\n        </div>\n    </md-input-container>--\x3e\n    <md-input-container class="md-block" ng-if="vm.item.type == \'string\' && vm.customField.options.length">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\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                <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\' && !vm.customField.options.length">\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 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}}</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 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.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.AUTHTOKEN">AuthToken</label>\n                                <input type="text" name="authToken" ng-model="vm.zohoAccount.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="INTEGRATIONS.ERRORS.AUTHTOKEN_REQUIRED">AuthToken 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" 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\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 animate-slide-down 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="ZOHOACCOUNTS.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="ZOHOACCOUNTS.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!-- 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 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="4">\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 md-cell class="actions">\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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(zohoAccount, $event)" translate="INTEGRATIONS.EDIT_ZOHOACCOUNT">\n                                                    Edit ZohoAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.testtestintegrationaccount(zohoAccount, $event)" translate="INTEGRATIONS.TEST_ZOHOACCOUNT">\n                                                    Test ZohoAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(zohoAccount, $event)" translate="INTEGRATIONS.DELETE_ZOHOACCOUNT">\n                                                    Delete ZohoAccount\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: \'{{\'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 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="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 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="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 ms-scroll>\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-ligth" 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                                <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)">\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                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.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_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="PROJECTS.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.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">{{ \'JSCRIPTY.ID\' | translate }}</th>\n                                            <th md-column md-order-by="starttime">{{ \'JSCRIPTY.STARTTIME\' | translate }}</th>\n                                            <th md-column md-order-by="endtime">{{ \'JSCRIPTY.ENDTIME\' | translate }}</th>\n                                            <th md-column md-order-by="membername">{{ \'JSCRIPTY.MEMBERNAME\' | translate }}</th>\n                                            <th md-column md-order-by="calleridnum">{{ \'JSCRIPTY.CALLERIDNUM\' | translate }}</th>\n                                            <th md-column md-order-by="completed">{{ \'JSCRIPTY.COMPLETE\' | translate }}</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>{{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.calleridnum}}</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                                                <span class="text-boxed-ligth" translate="JSCRIPTY.NO_SESSION_AVAILABLE">No session available</span>\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)">\n                            <div class="pb-16" layout="row" layout-align="space-between center">\n                                <div class="h2 secondary-text" translate="JSCRIPTY.ANSWERS">Answers</div>\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-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 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-ligth" 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 animate-slide-down 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="PROJECTS.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="PROJECTS.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!-- 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                                <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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(project, $event)" translate="JSCRIPTY.EDIT_PROJECT">\n                                                    Edit Project\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.clonedialog(project, $event)" translate="JSCRIPTY.CLONE_PROJECT">\n                                                    clone Project\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.sessionsgoto(project, $event)" translate="JSCRIPTY.SESSIONS_PROJECT">\n                                                    Sessions Project\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.deleteconfirm(project, $event)" translate="JSCRIPTY.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: \'{{\'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.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="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="cservice" ng-model="vm.mailAccount.cservice" required>\n                    <md-option ng-value="null">Custom</md-option>\n                    <md-option ng-value="\'gmail\'">Gmail</md-option>\n                    <md-option ng-value="\'hotmail\'">Hotmail</md-option>\n                    <md-option ng-value="\'yahoo\'">Yahoo</md-option>\n                    <md-option ng-value="\'outlook365\'">Outlook365</md-option>\n                </md-select>\n                <div ng-messages="mailAccountForm[\'cservice\'].$error" ng-show="mailAccountForm[\'cservice\'].$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            <md-input-container ng-if="(vm.newMailAccount && vm.mailAccount.cservice == null) || (vm.newMailAccount == undefined && vm.mailAccount.Imap.service == null)" 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">\n\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 ng-if="(vm.newMailAccount && vm.mailAccount.cservice == null) || (vm.newMailAccount == undefined && vm.mailAccount.Imap.service == null)" 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" ng-required="true">\n\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            <md-input-container ng-if="(vm.newMailAccount && vm.mailAccount.cservice == null) || (vm.newMailAccount == undefined && vm.mailAccount.Smtp.service == null)" 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">\n\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 ng-if="(vm.newMailAccount && vm.mailAccount.cservice == null) || (vm.newMailAccount == undefined && vm.mailAccount.Smtp.service == null)" 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" ng-required="true">\n\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            <md-input-container ng-if="vm.mailAccount.cservice !== undefined && vm.mailAccount.cservice == null && vm.newMailAccount" class="md-block">\n                <md-switch ng-model="vm.mailAccount.cauthentication" aria-label="Authentication"><span translate="MAIL.AUTHENTICATION">Authentication</span></md-switch>\n            </md-input-container>\n            <md-input-container ng-if="(vm.mailAccount.cauthentication == true || vm.mailAccount.cservice != null) && vm.newMailAccount" class="md-block">\n                <label translate="MAIL.USERNAME">Username</label>\n                <input type="text" name="cuser" ng-model="vm.mailAccount.cuser" ng-required="true">\n\n                <div class="hint"><span translate="MAIL.HELP.USERNAME"></span></div>\n                <div ng-messages="mailAccountForm[\'cuser\'].$error" ng-show="mailAccountForm[\'cuser\'].$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.cauthentication == true || vm.mailAccount.cservice != null) && vm.newMailAccount">\n                <label translate="MAIL.PASSWORD">Password</label>\n                <input type="password" name="cpassword" ng-model="vm.mailAccount.cpassword" placeholder="Password" translate translate-attr-placeholder="MAIL.PASSWORD" required>\n                <div class="hint"><span translate="MAIL.HELP.PASSWORD"></span></div>\n                <div ng-messages="mailAccountForm[\'cpassword\'].$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\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\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 MAILACCOUNT\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"></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 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="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" 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 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="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="1">One Time</md-option>\n                    <md-option ng-value="0">Always</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            <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, 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 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="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 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="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 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="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="inboundroute-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 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\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 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="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 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="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" 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 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="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 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="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 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="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, 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/mailDispositions/dialog.html",'<md-dialog class="mailDisposition-dialog" aria-label="New MailDisposition">\n    <form name="mailDispositionForm" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="MAIL.NAME">Name</label>\n                <input type="" name="name" ng-model="vm.mailDisposition.name" ng-required="true" autofocus>\n\n                <div ng-messages="mailDispositionForm[\'name\'].$error" ng-show="mailDispositionForm[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.newMailDisposition" ng-click="vm.saveMailDisposition()" class="send-button md-accent md-raised" ng-disabled="mailDispositionForm.$invalid || mailDispositionForm.$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.newMailDisposition" ng-click="vm.addNewMailDisposition()" class="send-button md-accent md-raised" ng-disabled="mailDispositionForm.$invalid" aria-label="ADD" translate="MAIL.ADD_MAILDISPOSITION" translate-attr-aria-label="MAIL.ADD_MAILDISPOSITION">\n                    ADD MAILDISPOSITION\n                </md-button>\n            </div>\n            <div layout="row">\n                <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newMailDisposition" ng-click="vm.deleteMailDisposition($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    \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-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.gotogoto(vm.mailAccount, $event)" 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.agentadddialog(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) || (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    \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="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.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                                <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="generalForm[\'fontFamily\'].$error" ng-show="generalForm[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" 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="generalForm[\'fontSize\'].$error" ng-show="generalForm[\'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, removePlugins: \'magicline\' }" ng-model="vm.mailAccount.template"></textarea>\n                            </div>\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" 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                            <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\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                    <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, removePlugins: \'magicline\' }" ng-model="vm.mailAccount.notificationTemplate"></textarea>\n                            </div>\n\n                        </form>\n                    </div>\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" 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" 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                </md-tab-body>\n            </md-tab>\n            <md-tab>\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.SERVICE">Service</label>\n                                <md-select name="Imap.service" ng-model="vm.mailAccount.Imap.service" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                                    <md-option ng-value="null">Custom</md-option>\n                                    <md-option ng-value="\'gmail\'">Gmail</md-option>\n                                    <md-option ng-value="\'hotmail\'">Hotmail</md-option>\n                                    <md-option ng-value="\'yahoo\'">Yahoo</md-option>\n                                    <md-option ng-value="\'outlook365\'">Outlook365</md-option>\n                                </md-select>\n                                <div ng-messages="imapForm[\'Imap.service\'].$error" ng-show="imapForm[\'Imap.service\'].$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                            <md-input-container ng-if="(vm.newMailAccount && vm.mailAccount.cservice == null) || (vm.newMailAccount == undefined && vm.mailAccount.Imap.service == null)" 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\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 ng-if="(vm.newMailAccount && vm.mailAccount.cservice == null) || (vm.newMailAccount == undefined && vm.mailAccount.Imap.service == null)" 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" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\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 ng-if="vm.mailAccount.Imap.service == null" 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 == true || vm.mailAccount.Imap.service != null" 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\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 == true || vm.mailAccount.Imap.service != null">\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\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\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">connTimeout</label>\n                                <input type="number" name="Imap.connTimeout" ng-model="vm.mailAccount.Imap.connTimeout" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\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">connTimeout field is required</span>\n                                    </div>\n                                    <div ng-message="min">\n                                        <span translate="MAIL.ERRORS.CONNTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">connTimeout 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">authTimeout</label>\n                                <input type="number" name="Imap.authTimeout" ng-model="vm.mailAccount.Imap.authTimeout" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\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">authTimeout field is required</span>\n                                    </div>\n                                    <div ng-message="min">\n                                        <span translate="MAIL.ERRORS.AUTHTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">authTimeout must be a valid greater or equal than</span> <span>1</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.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.SERVICE">Service</label>\n                                <md-select name="Smtp.service" ng-model="vm.mailAccount.Smtp.service" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                                    <md-option ng-value="null">Custom</md-option>\n                                    <md-option ng-value="\'gmail\'">Gmail</md-option>\n                                    <md-option ng-value="\'hotmail\'">Hotmail</md-option>\n                                    <md-option ng-value="\'yahoo\'">Yahoo</md-option>\n                                    <md-option ng-value="\'outlook365\'">Outlook365</md-option>\n                                </md-select>\n                                <div ng-messages="smtpForm[\'Smtp.service\'].$error" ng-show="smtpForm[\'Smtp.service\'].$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                            <md-input-container ng-if="(vm.newMailAccount && vm.mailAccount.cservice == null) || (vm.newMailAccount == undefined && vm.mailAccount.Smtp.service == null)" 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 ng-if="(vm.newMailAccount && vm.mailAccount.cservice == null) || (vm.newMailAccount == undefined && vm.mailAccount.Smtp.service == null)" 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" 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 ng-if="vm.mailAccount.Smtp.service == null" 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 ng-if="vm.mailAccount.Smtp.service == null" 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 == true || vm.mailAccount.Smtp.service != null" 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 == true || vm.mailAccount.Smtp.service != null">\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\n\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 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 class="mailAccount-detail-form-container maildispositions md-background-bg md-whiteframe-1dp">\n                        <div ng-controller="MailAccountMailDispositionsController as vm_dc" ng-init="vm_dc.init(vm.mailAccount, vm.crudPermissions)">\n                            <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedMailAccountMailDispositions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead" translate="MAIL.MAILDISPOSITIONS">MailDispositions</span>\n                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\n                                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditMailAccountMailDisposition($event)" aria-label="add mailDisposition" translate translate-attr-label="MAIL.ADD_MAILDISPOSITION">\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.selectedMailAccountMailDispositions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead">{{vm_dc.selectedMailAccountMailDispositions.length}} {{vm_dc.selectedMailAccountMailDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                                    <div flex></div>\n                                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedMailAccountMailDispositions" 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.deleteSelectedMailAccountMailDispositions($event)" aria-label="delete selected" translate translate-attr-label="MAILACCOUNTS.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.selectedMailAccountMailDispositions" md-progress="vm_dc.promise">\n                                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getMailAccountMailDispositions">\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="createdAt">{{ \'MAIL.CREATED_AT\' | translate }}</th>\n                                            <th md-column width="10px"></th>\n                                        </tr>\n                                    </thead>\n                                    <tbody md-body>\n                                        <tr md-row md-select="mailDisposition" md-select-id="id" ng-repeat="mailDisposition in vm_dc.mailAccountMailDispositions.rows">\n                                            <td ng-click="vm_dc.createOrEditMailAccountMailDisposition($event, mailDisposition)" md-cell>{{mailDisposition.id}}</td>\n                                            <td ng-click="vm_dc.createOrEditMailAccountMailDisposition($event, mailDisposition)" md-cell>{{mailDisposition.name}}</td>\n                                            <td ng-click="vm_dc.createOrEditMailAccountMailDisposition($event, mailDisposition)" md-cell>{{mailDisposition.createdAt | date:\'medium\'}}</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.createOrEditMailAccountMailDisposition($event, mailDisposition)" translate="MAIL.EDIT_MAILDISPOSITION">\n                                                                Edit MailDisposition\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(mailDisposition, $event)" translate="MAIL.DELETE_MAILDISPOSITION">\n                                                                Delete MailDisposition\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.mailAccountMailDispositions.rows.length">\n                                            <td md-cell colspan="5">\n                                                <span class="text-boxed-ligth" translate="MAIL.NO_MAILDISPOSITION_AVAILABLE">No maildisposition available</span>\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.mailAccountMailDispositions.count}}" md-on-paginate="vm_dc.getMailAccountMailDispositions" 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.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)">\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                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="MAILACCOUNTS.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.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">{{ \'MAIL.ID\' | translate }}</th>\n                                            <th md-column md-order-by="key">{{ \'MAIL.KEY\' | translate }}</th>\n                                            <th md-column md-order-by="value">{{ \'MAIL.VALUE\' | translate }}</th>\n                                            <th md-column md-order-by="description">{{ \'MAIL.DESCRIPTION\' | translate }}</th>\n                                            <th md-column md-order-by="createdAt">{{ \'MAIL.CREATED_AT\' | translate }}</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>{{mailCannedAnswer.id}}</td>\n                                            <td ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event, mailCannedAnswer)" md-cell>{{mailCannedAnswer.key}}</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>{{mailCannedAnswer.description}}</td>\n                                            <td ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event, mailCannedAnswer)" md-cell>{{mailCannedAnswer.createdAt | date:\'medium\'}}</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                                                <span class="text-boxed-ligth" translate="MAIL.NO_MAILCANNEDANSWER_AVAILABLE">No mailcannedanswer available</span>\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" ms-scroll 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.alias || a.appType) | uppercase}}">{{a.alias || 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" ms-scroll 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" style="width:200px">{{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-ligth" 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)">\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                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="MAILACCOUNTS.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.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">{{ \'MAIL.ID\' | translate }}</th>\n                                            <th md-column md-order-by="createdAt">{{ \'MAIL.STARTEDAT\' | translate }}</th>\n                                            <th md-column>{{ \'MAIL.CONTACT\' | translate }}</th>\n                                            <th md-column>{{ \'MAIL.AGENT\' | translate }}</th>\n                                            <th md-column md-order-by="closedAt">{{ \'MAIL.CLOSEDAT\' | translate }}</th>\n                                            <th md-column md-order-by="disposition">{{ \'MAIL.DISPOSITION\' | translate }}</th>\n                                            <th md-column md-order-by="note">{{ \'MAIL.NOTES\' | translate }}</th>\n                                            <th md-column md-order-by="tag">{{ \'MAIL.TAGS\' | translate }}</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">\n                                            <td md-cell>{{interaction.id}}</td>\n                                            <td md-cell>{{interaction.createdAt | date:\'medium\'}}</td>\n                                            <td md-cell>{{interaction.Contact.firstName}}</td>\n                                            <td md-cell>{{interaction.Owner.name}}</td>\n                                            <td md-cell>{{interaction.closedAt | date:\'medium\'}}</td>\n                                            <td md-cell>{{interaction.disposition}}</td>\n                                            <td md-cell>{{interaction.note}}</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"></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>\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>\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                                                <span class="text-boxed-ligth" translate="MAIL.NO_INTERACTION_AVAILABLE">No interaction available</span>\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    \x3c!-- / CONTENT --\x3e\n\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    \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.MAILACCOUNTS">MailAccounts</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.selectedMailAccounts.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.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="MAILACCOUNTS.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="MAILACCOUNTS.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!-- MAILACCOUNT TABLE --\x3e\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 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="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">\n                                <td md-cell ng-if="mailAccount.userpic"><img class="avatar" alt="{{mailAccount.name}}" ng-src="api/users/{{mailAccount.id}}/avatar" /></td>\n                                <td md-cell ng-if="!mailAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{mailAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(mailAccount, ev) : vm.createOrEditMailAccount($event, mailAccount)" md-cell class="id ">{{mailAccount.id}}</td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(mailAccount, ev) : vm.createOrEditMailAccount($event, mailAccount)" md-cell class="name ">{{mailAccount.name}}</td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(mailAccount, ev) : vm.createOrEditMailAccount($event, mailAccount)" md-cell class="key ">{{mailAccount.key}}</td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(mailAccount, ev) : vm.createOrEditMailAccount($event, mailAccount)" md-cell class="email ">{{mailAccount.email}}</td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(mailAccount, ev) : vm.createOrEditMailAccount($event, mailAccount)" 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 ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(mailAccount, ev) : vm.createOrEditMailAccount($event, mailAccount)" 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 MailAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.verifysmtpverifysmtp(mailAccount, $event)" translate="MAIL.VERIFYSMTP_MAILACCOUNT">\n                                                    verifysmtp MailAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.interactionsgoto(mailAccount, $event)" translate="MAIL.INTERACTIONS_MAILACCOUNT">\n                                                    Interactions MailAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.gotorealtimegoto(mailAccount, $event)" translate="MAIL.GOTOREALTIME_MAILACCOUNT">\n                                                    goToRealtime MailAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.agentadddialog(mailAccount, $event)" translate="MAIL.AGENTADD_MAILACCOUNT">\n                                                    AgentAdd MailAccount\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 MailAccount\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            \x3c!-- / MAILACCOUNT 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 MAILACCOUNT BUTTON --\x3e\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    \x3c!-- / ADD MAILACCOUNT BUTTON --\x3e\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 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="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" 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"></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"></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" 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 animate-slide-down 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="MAILQUEUES.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="MAILQUEUES.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!-- 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                                <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(mailQueue, $event)" translate="MAIL.EDIT_MAILQUEUE">\n                                                    Edit MailQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.teamadddialog(mailQueue, $event)" translate="MAIL.TEAMADD_MAILQUEUE">\n                                                    teamadd MailQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.agentadddialog(mailQueue, $event)" translate="MAIL.AGENTADD_MAILQUEUE">\n                                                    agentadd MailQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(mailQueue, $event)" translate="MAIL.DELETE_MAILQUEUE">\n                                                    Delete MailQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.gotorealtimegoto(mailQueue, $event)" translate="MAIL.GOTOREALTIME_MAILQUEUE">\n                                                    goToRealtime MailQueue\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.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 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="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 animate-slide-down 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="MAILSUBSTATUSES.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="MAILSUBSTATUSES.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!-- 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                                <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="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.editdialog(mailSubstatus, $event)" translate="MAIL.EDIT_MAILSUBSTATUS">\n                                                    Edit MailSubstatus\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(mailSubstatus, $event)" translate="MAIL.DELETE_MAILSUBSTATUS">\n                                                    Delete MailSubstatus\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.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.query.filter = 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.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">\n                <td md-cell colspan="4">\n                    <div layout="row" layout-align="center center">\n                        <span tranlsate="MAIL.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-row md-select="vm.mailAccounts[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td md-cell>{{vm.mailAccounts[value].name}}</td>\n                <td md-cell>{{vm.mailAccounts[value].key}}</td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{(vm.mailAccounts[value].in || 0) + (vm.mailAccounts[value].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">{{vm.mailAccounts[value].in || 0}}</span>\n                        <span class="text-boxed" ng-if="mailAccount.in">{{vm.mailAccounts[value].lastIn ?  (vm.mailAccounts[value].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">{{vm.mailAccounts[value].out || 0}}</span>\n                        <span class="text-boxed" ng-if="mailAccount.out">{{vm.mailAccounts[value].lastOut ?  (vm.mailAccounts[value].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>{{vm.mailAccounts[value].Imap.messageStatus}}</md-tooltip>\n                                <div ng-switch="vm.mailAccounts[value].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.\' + vm.mailAccounts[value].Imap.status.toUpperCase()) | translate}}</span>\n                        </div>\n                        <span class="text-boxed" ng-if="vm.mailAccounts[value].active">{{vm.mailAccounts[value].Imap.lastSync | date: \'shortTime\'}}</span>\n                    </div>\n                </td>\n                <td md-cell>\n                    <div layout="row" layout-align="start center" ng-if="vm.mailAccounts[value].Smtp.status">\n                        <div layout="column" layout-align="center center">\n                            <md-button class="md-icon-button" aria-label="Status">\n                                <md-tooltip>{{vm.mailAccounts[value].Smtp.messageStatus}}</md-tooltip>\n                                <md-icon md-font-icon="{{ vm.mailAccounts[value].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.\' + vm.mailAccounts[value].Smtp.status.toUpperCase()) | translate}}</span>\n                        </div>\n                        <span class="text-boxed">{{vm.mailAccounts[value].Smtp.lastSync | date: \'shortTime\'}}</span>\n                    </div>\n                    <span class="md-caption grey-fg" ng-if="!vm.mailAccounts[value].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, vm.mailAccounts[value])" 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, vm.mailAccounts[value])" 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.count}}" md-on-paginate="vm.getmailAccounts" md-page-select></md-table-pagination>\n\x3c!-- / AGENT TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/mail/views/realtime/agents/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.AGENTS">Agents</span>\n        <div flex></div>\n        <ms-search-bar on-search="vm.query.filter = query; vm.onInit()" on-collapse="vm.query.filter = undefined; vm.onInit()" debounce="300"></ms-search-bar>\n        <md-select ng-model="vm.query.globalStatusFilter" class="md-caption" ng-change="vm.query.pauseTypeFilter = \'\'; vm.onInit()">\n            <md-option ng-value="\'\'">{{ \'MAIL.ALL\' | translate }}</md-option>\n            <md-option value="pause">{{ \'MAIL.PAUSE\' | translate }}</md-option>\n            <md-option value="*pause">{{ \'MAIL.PARTIALPAUSE\' | translate }}</md-option>\n            <md-option value="busy">{{ \'MAIL.BUSY\' | translate }}</md-option>\n            <md-option value="idle">{{ \'MAIL.IDLE\' | translate }}</md-option>\n        </md-select>\n\n        <md-select ng-if="vm.isPause(vm.query.globalStatusFilter)" ng-model="vm.query.pauseTypeFilter" class="md-caption" ng-change="vm.onInit()">\n            <md-option ng-value="\'\'">All</md-option>\n            <md-option value="DEFAULT PAUSE">DEFAULT PAUSE</md-option>\n            <md-option value="ACW">ACW</md-option>\n            <md-option value="LOGININPAUSE">LOGININPAUSE</md-option>\n            <md-option value="Auto-Pause">AUTOPAUSE</md-option>\n            <md-option ng-value="pause.name" ng-repeat="pause in vm.pauses.rows">{{pause.name}}</md-option>\n        </md-select>\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.order" md-on-reorder="vm.onInit">\n            <tr md-row border="1">\n                <th class="bv text-center" colspan="4">{{ \'MAIL.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">{{ \'OPENCHANNEL.OPENCHANNEL\' | translate }}</th>\n                <th ng-if="vm.license.fax" class="bv bl text-center" colspan="2">{{ \'FAX.FAX\' | translate }}</th>\n                <th width="10px" class="bt bl" rowspan="2"></th>\n            </tr>\n            <tr md-row>\n                <th class="bl" md-column md-order-by="fullname">{{ \'MAIL.NAME\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="globalStatus">{{ \'MAIL.STATUS\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="lastLoginAt">{{ \'MAIL.LOGIN_TIME\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="lastPauseAt">{{ \'MAIL.PAUSE_TIME\' | translate }}</th>\n\n                <th class="bl custom-column">{{ \'VOICE.STATUS\' | translate }}</th>\n                <th class="bl custom-column">Info</th>\n\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\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\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\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\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            </tr>\n        </thead>\n        <tbody md-body>\n            <tr md-row ng-hide="vm.order.length">\n                <td md-cell colspan="17">\n                    <div layout="row" layout-align="center center">\n                        <span>{{ \'MAIL.NO_AGENT_ONLINE\' | translate }}</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-select="vm.agents[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td class="bt padding-5">\n                    <div layout="row" layout-align="start center">\n                        <img class="avatar" ng-src="{{vm.agents[value].userpic && \'api/users/\'+vm.agents[value].id+\'/avatar\' || \'assets/images/avatars/profile.png\'}}">\n                        <div layout="column">\n                            <span>{{vm.agents[value].fullname}}</span>\n                            <span>{{vm.agents[value].internal}}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class="bt">\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'}[vm.agents[value].globalStatus]\">{{ vm.isPause(vm.agents[value].globalStatus) ? '' : vm.agents[value].globalStatus | uppercase }} {{ vm.isPause(vm.agents[value].globalStatus) ? (vm.isPartialPause(vm.agents[value].globalStatus) ? '*'+vm.agents[value].pauseType || 'DEFAULT PAUSE'  : vm.agents[value].pauseType || 'DEFAULT PAUSE') : ''}}</span>\n                </td>\n                <td class=\"bt custom-column\">\n                    <timer start-time=\"vm.agents[value].lastLoginAt\" interval=\"1000\">{{ days > 0 ? days + 'd' : '' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                </td>\n                <td class=\"bt custom-column\">\n                    <timer ng-if=\"vm.isPause(vm.agents[value].globalStatus) || vm.isPartialPause(vm.agents[value].globalStatus)\" start-time=\"vm.agents[value].lastPauseAt\" interval=\"1000\">{{ days > 0 ? days + 'd' : '' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                </td>\n                <td class=\"bt bl\">\n                    <div layout=\"row\">\n                        <span ng-if=\"!vm.agents[value].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'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].voiceStatus | uppercase }}</span>\n                        <span ng-if=\"vm.agents[value].onhold\" class=\"text-boxed md-background-bg bl bt padding-5 orange-400-bg\">ONHOLD</span>\n                    </div>\n                </td>\n                <td class=\"bt bl\">\n                    <div layout=\"column\">\n                        <span ng-if=\"vm.agents[value].queue\" class=\"padding-5\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].queue }}</span>\n                        <span ng-if=\"vm.agents[value].destconnectedlinenum\" class=\"padding-5\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].destconnectedlinenum }}</span>\n                        <span class=\"padding-5\" ng-if=\"vm.agents[value].queue || vm.agents[value].destconnectedlinenum\">\n                            <timer start-time=\"vm.agents[value].voiceStatusTime\" interval=\"1000\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                        </span>\n                    </div>\n                </td>\n                <td class=\"bt bl\" ng-if=\"vm.license.chat\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].chatStatus]\">{{ vm.agents[value].chatStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td md-number class=\"bt text-center font-size-20\" ng-if=\"vm.license.chat\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].chatStatus]\">{{ vm.agents[value].chatCurrentCapacity }}</td>\n                <td class=\"bl bt\" ng-if=\"vm.license.mail\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].mailStatus]\">{{ vm.agents[value].mailStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.mail\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].mailStatus]\">{{ vm.agents[value].mailCurrentCapacity }}</td>\n                <td class=\"bl bt\" ng-if=\"vm.license.messaging\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].smsStatus]\">{{ vm.agents[value].smsStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.messaging\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].smsStatus]\">{{ vm.agents[value].smsCurrentCapacity }}</td>\n                <td class=\"bt bl\" ng-if=\"vm.license.openchannel\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].openchannelStatus]\">{{ vm.agents[value].openchannelStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.openchannel\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].openchannelStatus]\">{{ vm.agents[value].openchannelCurrentCapacity }}</td>\n                <td class=\"bt bl\" ng-if=\"vm.license.fax\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].faxStatus]\">{{ vm.agents[value].faxStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.fax\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].faxStatus]\">{{ vm.agents[value].faxCurrentCapacity }}</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\n                        <md-menu-content width=\"4\">\n                            <md-menu-item>\n                                <md-button ng-click=\"vm.logout(vm.agents[value], $event)\" translate=\"MAIL.LOGOUT\">\n                                    Logout\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-button ng-click=\"vm.queueAdd(vm.agents[value], $event)\" translate=\"MAIL.AGENTADD_QUEUE\">\n                                    Add Agent In Queue\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-menu>\n                                    <md-button ng-click=\"$mdMenu.open()\" class=\"text-capitalize\" translate=\"MAIL.PAUSE\">Pause</md-button>\n                                    <md-menu-content>\n                                        <md-menu-item>\n                                            <md-button ng-disabled=\" vm.agents[value].voicePause && 'DEFAULT PAUSE' === vm.agents[value].pauseType\" ng-click=\"vm.pause(vm.agents[value])\"><em translate=\"MAIL.DEFAULT_PAUSE\">Default Pause</em></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=\"vm.agents[value].voicePause && pause.name === vm.agents[value].pauseType\" ng-click=\"vm.pause(vm.agents[value], pause.name)\">{{pause.name}}</md-button>\n                                        </md-menu-item>\n                                    </md-menu-content>\n                                </md-menu>\n                            </md-menu-item>\n                            <md-menu-item ng-if=\"vm.isPause(vm.agents[value].globalStatus)\">\n                                <md-button ng-click=\"vm.unPause(vm.agents[value])\" translate=\"MAIL.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\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.filteredAgents.length}}\" md-on-paginate=\"vm.onInit\" md-page-select></md-table-pagination>\n\x3c!-- / AGENT TABLE --\x3e\n\x3c!-- / MAIN --\x3e"),e.put("app/main/apps/mail/views/realtime/queues/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.QUEUES">Queues</span>\n        <div flex></div>\n        <ms-search-bar on-search="vm.query.filter = 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">{{ \'MAIL.NAME\' | translate }}</th>\n                <th md-column>{{ \'MAIL.LOGGED_IN\' | translate }}</th>\n                <th md-column>{{ \'MAIL.PAUSED\' | translate }}</th>\n                <th md-column>{{ \'MAIL.READY\' | translate }}</th>\n                <th md-column>{{ \'MAIL.WAITING\' | translate }}</th>\n                <th md-column width="10px"></th>\n            </tr>\n        </thead>\n        <tbody md-body>\n            <tr md-row ng-hide="vm.queues">\n                <td md-cell colspan="7">\n                    <div layout="row" layout-align="center center">\n                        <span tranlsate="MAIL.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-row md-select="vm.queues[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td md-cell>{{vm.queues[value].name}}</td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].loggedInDb || 0}} ({{vm.queues[value].loggedIn || 0}})</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].paused || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-16 grey-fg">{{vm.queues[value].available || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].waiting || 0}}</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="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.createOrEditMailQueue($event, vm.queues[value])" translate="MAIL.EDIT_QUEUE">\n                                    Edit Queue\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-button ng-click="vm.agentAdd($event, vm.queues[value])" translate="MAIL.AGENTSADD_QUEUE">\n                                    Add Agents to queue\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.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/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 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="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 animate-slide-down 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="PLUGINS.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="PLUGINS.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            <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                                <td md-cell class="actions">\n                                    <md-menu>\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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit && !plugin.active">\n                                                <md-button ng-click="vm.installplugin(plugin, $event)" translate="MARKETPLACE.INSTALL_PLUGIN">\n                                                    Install Plugin\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(plugin, $event)" translate="MARKETPLACE.EDIT_PLUGIN">\n                                                    Edit Plugin\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit && plugin.active && plugin.type == \'script\'">\n                                                <md-button ng-click="vm.stopplugin(plugin, $event)" translate="MARKETPLACE.STOP_PLUGIN">\n                                                    Stop Plugin\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit && plugin.active && plugin.type == \'script\'">\n                                                <md-button ng-click="vm.restartplugin(plugin, $event)" translate="MARKETPLACE.RESTART_PLUGIN">\n                                                    Restart Plugin\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.downloadfile2(plugin, $event)" translate="MARKETPLACE.DOWNLOAD_PLUGIN">\n                                                    Download Plugin\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit && plugin.active">\n                                                <md-button ng-click="vm.uninstallplugin(plugin, $event)" translate="MARKETPLACE.UNINSTALL_PLUGIN">\n                                                    Uninstall Plugin\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(plugin, $event)" translate="MARKETPLACE.DELETE_PLUGIN">\n                                                    Delete Plugin\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: \'{{\'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 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 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/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 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="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" 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"></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 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="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 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" 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"></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) || (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" 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" 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" 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" 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+$/" 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" 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" 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" 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" 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" 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" 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" 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                </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" 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">\n                                    < <div class="hint"><span translate="MOTIONDIALER.HELP.TIMEZONE"></span>\n                    </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" 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" 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" 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" 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" 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" 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" 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" 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" 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                            <div flex></div>\n                            <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="IVRCAMPAIGNS.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.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">{{ \'MOTIONDIALER.CONTACTID\' | translate }}</th>\n                                    <th md-column md-order-by="phone">{{ \'MOTIONDIALER.PHONE\' | translate }}</th>\n                                    <th md-column md-order-by="countcongestionretry">{{ \'MOTIONDIALER.CONGESTION\' | translate }}</th>\n                                    <th md-column md-order-by="countbusyretry">{{ \'MOTIONDIALER.BUSY\' | translate }}</th>\n                                    <th md-column md-order-by="countnoanswerretry">{{ \'MOTIONDIALER.NOANSWER\' | translate }}</th>\n                                    <th md-column md-order-by="scheduledat">{{ \'MOTIONDIALER.SCHEDULEDAT\' | translate }}</th>\n                                    <th md-column md-order-by="priority">{{ \'MOTIONDIALER.PRIORITY\' | translate }}</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>{{hopper.ContactId}}</td>\n                                    <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>{{hopper.phone}}</td>\n                                    <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>{{hopper.countcongestionretry}}</td>\n                                    <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>{{hopper.countbusyretry}}</td>\n                                    <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>{{hopper.countnoanswerretry}}</td>\n                                    <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>{{hopper.scheduledat | date:\'medium\'}}</td>\n                                    <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>{{ vm_dc.arraypriority[hopper.priority].option }}</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.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="10">\n                                        <span class="text-boxed-ligth" translate="MOTIONDIALER.NO_HOPPER_AVAILABLE">No hopper available</span>\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                            <div flex></div>\n                            <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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>\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">{{ \'MOTIONDIALER.UNIQUEID\' | translate }}</th>\n                                    <th md-column md-order-by="ContactId">{{ \'MOTIONDIALER.CONTACTID\' | translate }}</th>\n                                    <th md-column md-order-by="calleridnum">{{ \'MOTIONDIALER.PHONE\' | translate }}</th>\n                                    <th md-column md-order-by="calleridname">{{ \'MOTIONDIALER.NAME\' | translate }}</th>\n                                    <th md-column md-order-by="statedesc">{{ \'MOTIONDIALER.STATUS\' | translate }}</th>\n                                    <th md-column md-order-by="scheduledat">{{ \'MOTIONDIALER.SCHEDULEDAT\' | translate }}</th>\n                                    <th md-column md-order-by="starttime">{{ \'MOTIONDIALER.STARTTIME\' | translate }}</th>\n                                    <th md-column md-order-by="endtime">{{ \'MOTIONDIALER.ENDTIME\' | translate }}</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>{{hopperHistory.uniqueid}}</td>\n                                    <td md-cell>{{hopperHistory.ContactId}}</td>\n                                    <td md-cell>{{hopperHistory.calleridnum}}</td>\n                                    <td md-cell>{{hopperHistory.calleridname}}</td>\n                                    <td md-cell>{{hopperHistory.statedesc}}</td>\n                                    <td md-cell>{{hopperHistory.scheduledat | date:\'medium\'}}</td>\n                                    <td md-cell>{{hopperHistory.starttime | date:\'medium\'}}</td>\n                                    <td md-cell>{{hopperHistory.endtime | date:\'medium\'}}</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                                        <span class="text-boxed-ligth" translate="MOTIONDIALER.NO_HOPPERHISTORY_AVAILABLE">No hopperhistory available</span>\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                            <div flex></div>\n                            <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="IVRCAMPAIGNS.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>\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">{{ \'MOTIONDIALER.UNIQUEID\' | translate }}</th>\n                                    <th md-column md-order-by="ContactId">{{ \'MOTIONDIALER.CONTACTID\' | translate }}</th>\n                                    <th md-column md-order-by="calleridnum">{{ \'MOTIONDIALER.PHONE\' | translate }}</th>\n                                    <th md-column md-order-by="calleridname">{{ \'MOTIONDIALER.NAME\' | translate }}</th>\n                                    <th md-column md-order-by="statedesc">{{ \'MOTIONDIALER.STATUS\' | translate }}</th>\n                                    <th md-column md-order-by="countcongestionretry">{{ \'MOTIONDIALER.CONGESTION\' | translate }}</th>\n                                    <th md-column md-order-by="countbusyretry">{{ \'MOTIONDIALER.BUSY\' | translate }}</th>\n                                    <th md-column md-order-by="countnoanswerretry">{{ \'MOTIONDIALER.NOANSWER\' | translate }}</th>\n                                    <th md-column md-order-by="starttime">{{ \'MOTIONDIALER.STARTTIME\' | translate }}</th>\n                                    <th md-column md-order-by="endtime">{{ \'MOTIONDIALER.ENDTIME\' | translate }}</th>\n                                    <th md-column md-order-by="disposition">{{ \'MOTIONDIALER.DISPOSITION\' | translate }}</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>{{hopperFinal.uniqueid}}</td>\n                                    <td md-cell>{{hopperFinal.ContactId}}</td>\n                                    <td md-cell>{{hopperFinal.calleridnum}}</td>\n                                    <td md-cell>{{hopperFinal.calleridname}}</td>\n                                    <td md-cell>{{hopperFinal.statedesc}}</td>\n                                    <td md-cell>{{hopperFinal.countcongestionretry}}</td>\n                                    <td md-cell>{{hopperFinal.countbusyretry}}</td>\n                                    <td md-cell>{{hopperFinal.countnoanswerretry}}</td>\n                                    <td md-cell>{{hopperFinal.starttime | date:\'medium\'}}</td>\n                                    <td md-cell>{{hopperFinal.endtime | date:\'medium\'}}</td>\n                                    <td md-cell>{{hopperFinal.disposition}}</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="23">\n                                        <span class="text-boxed-ligth" translate="MOTIONDIALER.NO_HOPPERFINAL_AVAILABLE">No hopperfinal available</span>\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                            <div flex></div>\n                            <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.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_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>\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">{{ \'MOTIONDIALER.CONTACTID\' | translate }}</th>\n                                    <th md-column md-order-by="phone">{{ \'MOTIONDIALER.PHONE\' | translate }}</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>{{hopperBlack.ContactId}}</td>\n                                    <td md-cell>{{hopperBlack.phone}}</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                                        <span class="text-boxed-ligth" translate="MOTIONDIALER.NO_HOPPERBLACK_AVAILABLE">No hopperblack available</span>\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 animate-slide-down 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="IVRCAMPAIGNS.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="IVRCAMPAIGNS.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!-- 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})[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})[0].name }}</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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(ivrCampaign, $event)" translate="MOTIONDIALER.EDIT_IVRCAMPAIGN">\n                                                    Edit IvrCampaign\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.clonedialog(ivrCampaign, $event)" translate="MOTIONDIALER.CLONE_IVRCAMPAIGN">\n                                                    clone IvrCampaign\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.listadddialog(ivrCampaign, $event)" translate="MOTIONDIALER.LISTADD_IVRCAMPAIGN">\n                                                    listadd IvrCampaign\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.blacklistadddialog(ivrCampaign, $event)" translate="MOTIONDIALER.BLACKLISTADD_IVRCAMPAIGN">\n                                                    blacklistadd IvrCampaign\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(ivrCampaign, $event)" translate="MOTIONDIALER.DELETE_IVRCAMPAIGN">\n                                                    Delete IvrCampaign\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.gotorealtimegoto(ivrCampaign, $event)" translate="MOTIONDIALER.GOTOREALTIME_IVRCAMPAIGN">\n                                                    goToRealtime IvrCampaign\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.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 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="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">\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">\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">\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" 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" 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" 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" ng-model="vm.penalty" placeholder="0" required md-minlength="0" md-maxlength="3">\n                <div ng-messages="queueCampaignForm.penalty.$error" role="alert" multiple>\n                    <div ng-message="required">\n                        <span>You must supply a penalty.</span>\n                    </div>\n                    <div ng-message="md-minlength">\n                        <span>Min Penalty 0 characters.</span>\n                    </div>\n                    <div ng-message="md-maxlength">\n                        <span>Max Penalty 3 characters.</span>\n                    </div>\n                </div>\n            </md-input-container>\n            <ms-dual-multiselect options="vm.dualMultiselectOptions"></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"></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 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="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 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" 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            <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"></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" ng-model="vm.penalty" placeholder="0" required md-minlength="0" md-maxlength="3">\n                <div ng-messages="queueCampaignForm.penalty.$error" role="alert" multiple>\n                    <div ng-message="required">\n                        <span>You must supply a penalty.</span>\n                    </div>\n                    <div ng-message="md-minlength">\n                        <span>Min Penalty 0 characters.</span>\n                    </div>\n                    <div ng-message="md-maxlength">\n                        <span>Max Penalty 3 characters.</span>\n                    </div>\n                </div>\n            </md-input-container>\n            <ms-dual-multiselect options="vm.dualMultiselectOptions"></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) || (advancedForm.$invalid) || (advancedpreviewForm.$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" 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">\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">\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">\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" 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" 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" 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" 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" 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" 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" 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" 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+$/" 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" 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" 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" 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" 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" 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" 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" 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                </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 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\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" 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">\n                                    < <div class="hint"><span translate="MOTIONDIALER.HELP.TIMEZONE"></span>\n                    </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" 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" 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" 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" 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" 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" 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" 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" 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" 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                            <div flex></div>\n                            <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="QUEUECAMPAIGNS.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.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">{{ \'MOTIONDIALER.CONTACTID\' | translate }}</th>\n                                    <th md-column md-order-by="phone">{{ \'MOTIONDIALER.PHONE\' | translate }}</th>\n                                    <th md-column md-order-by="countcongestionretry">{{ \'MOTIONDIALER.CONGESTION\' | translate }}</th>\n                                    <th md-column md-order-by="countbusyretry">{{ \'MOTIONDIALER.BUSY\' | translate }}</th>\n                                    <th md-column md-order-by="countnoanswerretry">{{ \'MOTIONDIALER.NOANSWER\' | translate }}</th>\n                                    <th md-column md-order-by="scheduledat">{{ \'MOTIONDIALER.SCHEDULEDAT\' | translate }}</th>\n                                    <th md-column md-order-by="priority">{{ \'MOTIONDIALER.PRIORITY\' | translate }}</th>\n                                    <th md-column md-order-by="recallme">{{ \'MOTIONDIALER.RECALLAGENT\' | translate }}</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>{{hopper.ContactId}}</td>\n                                    <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>{{hopper.phone}}</td>\n                                    <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>{{hopper.countcongestionretry}}</td>\n                                    <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>{{hopper.countbusyretry}}</td>\n                                    <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>{{hopper.countnoanswerretry}}</td>\n                                    <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>{{hopper.scheduledat | date:\'medium\'}}</td>\n                                    <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>{{ vm_dc.arraypriority[hopper.priority].option }}</td>\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="12">\n                                        <span class="text-boxed-ligth" translate="MOTIONDIALER.NO_HOPPER_AVAILABLE">No hopper available</span>\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                            <div flex></div>\n                            <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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>\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">{{ \'MOTIONDIALER.UNIQUEID\' | translate }}</th>\n                                    <th md-column md-order-by="ContactId">{{ \'MOTIONDIALER.CONTACTID\' | translate }}</th>\n                                    <th md-column md-order-by="calleridnum">{{ \'MOTIONDIALER.PHONE\' | translate }}</th>\n                                    <th md-column md-order-by="calleridname">{{ \'MOTIONDIALER.NAME\' | translate }}</th>\n                                    <th md-column md-order-by="statedesc">{{ \'MOTIONDIALER.STATUS\' | translate }}</th>\n                                    <th md-column md-order-by="scheduledat">{{ \'MOTIONDIALER.SCHEDULEDAT\' | translate }}</th>\n                                    <th md-column md-order-by="starttime">{{ \'MOTIONDIALER.STARTTIME\' | translate }}</th>\n                                    <th md-column md-order-by="endtime">{{ \'MOTIONDIALER.ENDTIME\' | translate }}</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>{{hopperHistory.uniqueid}}</td>\n                                    <td md-cell>{{hopperHistory.ContactId}}</td>\n                                    <td md-cell>{{hopperHistory.calleridnum}}</td>\n                                    <td md-cell>{{hopperHistory.calleridname}}</td>\n                                    <td md-cell>{{hopperHistory.statedesc}}</td>\n                                    <td md-cell>{{hopperHistory.scheduledat | date:\'medium\'}}</td>\n                                    <td md-cell>{{hopperHistory.starttime | date:\'medium\'}}</td>\n                                    <td md-cell>{{hopperHistory.endtime | date:\'medium\'}}</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                                        <span class="text-boxed-ligth" translate="MOTIONDIALER.NO_HOPPERHISTORY_AVAILABLE">No hopperhistory available</span>\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                            <div flex></div>\n                            <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="QUEUECAMPAIGNS.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>\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">{{ \'MOTIONDIALER.UNIQUEID\' | translate }}</th>\n                                    <th md-column md-order-by="ContactId">{{ \'MOTIONDIALER.CONTACTID\' | translate }}</th>\n                                    <th md-column md-order-by="calleridnum">{{ \'MOTIONDIALER.PHONE\' | translate }}</th>\n                                    <th md-column md-order-by="calleridname">{{ \'MOTIONDIALER.NAME\' | translate }}</th>\n                                    <th md-column md-order-by="statedesc">{{ \'MOTIONDIALER.STATUS\' | translate }}</th>\n                                    <th md-column md-order-by="countcongestionretry">{{ \'MOTIONDIALER.CONGESTION\' | translate }}</th>\n                                    <th md-column md-order-by="countbusyretry">{{ \'MOTIONDIALER.BUSY\' | translate }}</th>\n                                    <th md-column md-order-by="countnoanswerretry">{{ \'MOTIONDIALER.NOANSWER\' | translate }}</th>\n                                    <th md-column md-order-by="starttime">{{ \'MOTIONDIALER.STARTTIME\' | translate }}</th>\n                                    <th md-column md-order-by="endtime">{{ \'MOTIONDIALER.ENDTIME\' | translate }}</th>\n                                    <th md-column md-order-by="disposition">{{ \'MOTIONDIALER.DISPOSITION\' | translate }}</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>{{hopperFinal.uniqueid}}</td>\n                                    <td md-cell>{{hopperFinal.ContactId}}</td>\n                                    <td md-cell>{{hopperFinal.calleridnum}}</td>\n                                    <td md-cell>{{hopperFinal.calleridname}}</td>\n                                    <td md-cell>{{hopperFinal.statedesc}}</td>\n                                    <td md-cell>{{hopperFinal.countcongestionretry}}</td>\n                                    <td md-cell>{{hopperFinal.countbusyretry}}</td>\n                                    <td md-cell>{{hopperFinal.countnoanswerretry}}</td>\n                                    <td md-cell>{{hopperFinal.starttime | date:\'medium\'}}</td>\n                                    <td md-cell>{{hopperFinal.endtime | date:\'medium\'}}</td>\n                                    <td md-cell>{{hopperFinal.disposition}}</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="23">\n                                        <span class="text-boxed-ligth" translate="MOTIONDIALER.NO_HOPPERFINAL_AVAILABLE">No hopperfinal available</span>\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                            <div flex></div>\n                            <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.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_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>\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">{{ \'MOTIONDIALER.CONTACTID\' | translate }}</th>\n                                    <th md-column md-order-by="phone">{{ \'MOTIONDIALER.PHONE\' | translate }}</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>{{hopperBlack.ContactId}}</td>\n                                    <td md-cell>{{hopperBlack.phone}}</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                                        <span class="text-boxed-ligth" translate="MOTIONDIALER.NO_HOPPERBLACK_AVAILABLE">No hopperblack available</span>\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 animate-slide-down 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="QUEUECAMPAIGNS.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="QUEUECAMPAIGNS.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!-- 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})[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                                <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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(queueCampaign, $event)" translate="MOTIONDIALER.EDIT_QUEUECAMPAIGN">\n                                                    Edit QueueCampaign\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.clonedialog(queueCampaign, $event)" translate="MOTIONDIALER.CLONE_QUEUECAMPAIGN">\n                                                    clone QueueCampaign\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.listadddialog(queueCampaign, $event)" translate="MOTIONDIALER.LISTADD_QUEUECAMPAIGN">\n                                                    listadd QueueCampaign\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.blacklistadddialog(queueCampaign, $event)" translate="MOTIONDIALER.BLACKLISTADD_QUEUECAMPAIGN">\n                                                    blacklistadd QueueCampaign\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.teamadddialog(queueCampaign, $event)" translate="MOTIONDIALER.TEAMADD_QUEUECAMPAIGN">\n                                                    teamadd QueueCampaign\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.agentadddialog(queueCampaign, $event)" translate="MOTIONDIALER.AGENTADD_QUEUECAMPAIGN">\n                                                    agentadd QueueCampaign\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(queueCampaign, $event)" translate="MOTIONDIALER.DELETE_QUEUECAMPAIGN">\n                                                    Delete QueueCampaign\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.gotorealtimegoto(queueCampaign, $event)" translate="MOTIONDIALER.GOTOREALTIME_QUEUECAMPAIGN">\n                                                    goToRealtime QueueCampaign\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.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.query.filter = query" on-collapse="vm.query.filter = undefined" debounce="300"></ms-search-bar>\n            <div flex></div>\n            <div class="padding-horizontal-20" layout="column" layout-align="center center">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_DATE">Select a date</span>\n                <div layout="row" layout-align="center center">\n                    <md-button ng-if="vm.pickerModel.dateStart" ng-click="vm.clearAll()" class="md-icon-button no-padding width-20 height-20">\n                        <md-tooltip>{{ \'DASHBOARDS.DELETE\' | translate }}</md-tooltip>\n                        <md-icon md-font-icon="icon-close" class="s16 black-fg"></md-icon>\n                    </md-button>\n                    <md-date-range localization-map="vm.localizationMap" ng-model="vm.pickerModel" auto-confirm="true" show-template="true" md-on-select="vm.getContacts()" placeholder="{{ \'DASHBOARDS.ALL\' | translate }}"></md-date-range>\n                </div>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_AGENT">Select an agent</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.lastAssignedTo" ng-change="vm.getContacts()">\n                    <md-option ng-value="\'null\'" translate="DASHBOARDS.NOT_ASSIGNED"></md-option>\n                    <md-option ng-value="undefined" translate="DASHBOARDS.ALL"></md-option>\n                    <md-option ng-value="agent.name" ng-repeat="agent in vm.agents.rows">{{agent.name}}</md-option>\n                </md-select>\n            </div>\n            <div ng-if="vm.queues.count" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_CAMPAIGN">Select a Campaign</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.queue" ng-change="vm.getContacts()">\n                    <md-option ng-value="undefined" ng-if="vm.queues.count > 1"><em translate="DASHBOARDS.ALL">All</em></md-option>\n                    <md-option ng-value="queue.name" ng-repeat="queue in vm.queues.rows">{{queue.name}}</md-option>\n                </md-select>\n            </div>\n            <md-button class="md-icon-button" ng-click="vm.refresh && 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 ng-if="vm.showTooltip" md-visible="vm.showTooltip">{{\'DASHBOARDS.CLICKRELOAD\' | 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.getContacts">\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 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 tranlsate="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 md-cell class="id">{{contact.id}}</td>\n                    <td md-cell class="firstName">{{contact.calleridname}}</td>\n                    <td md-cell class="list">{{contact.calleridnum}}</td>\n                    <td md-cell class="list">{{vm.queuesMap[contact.queue]}}</td>\n                    <td md-cell class="list">{{contact.queuecallerabandonAt ? (contact.queuecallerabandonAt | formatdate) : undefined }}</td>\n                    <td md-cell class="list">{{contact.queuecallerexitAt ? (contact.queuecallerexitAt | formatdate) : undefined }}</td>\n                    <td md-cell class="list">{{contact.queuecallerexitreason}}</td>\n                    <td md-cell class="list">{{contact.lastAssignedTo}}</td>\n                    <td md-cell class="list">{{contact.disposition}}</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">Assigned a</md-button>\n                                        <md-menu-content>\n                                            <md-menu-item ng-if="contact.lastAssignedTo">\n                                                <md-button ng-click="vm.assignedA(contact)"><em translate="DASHBOARDS.NONE">Not Assigned</em></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.assignedA(contact,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-menu>\n                                        <md-button ng-click="$mdMenu.open()" class="text-capitalize" translate="DASHBOARDS.DISPOSE">Dispose</md-button>\n                                        <md-menu-content>\n                                            <md-menu-item ng-if="vm.dispositions.length > 0" ng-repeat="disposition in vm.dispositions">\n                                                <md-button ng-click="vm.disposed(contact, disposition.name)">{{disposition.name}}</md-button>\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\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>'),e.put("app/main/apps/motiondialer/views/realtime/agents/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.AGENTS">Agents</span>\n        <div flex></div>\n        <ms-search-bar on-search="vm.query.filter = query; vm.onInit()" on-collapse="vm.query.filter = undefined; vm.onInit()" debounce="300"></ms-search-bar>\n        <md-select ng-model="vm.query.globalStatusFilter" class="md-caption" ng-change="vm.query.pauseTypeFilter = \'\'; vm.onInit()">\n            <md-option ng-value="\'\'">{{ \'MOTIONDIALER.ALL\' | translate }}</md-option>\n            <md-option value="pause">{{ \'MOTIONDIALER.PAUSE\' | translate }}</md-option>\n            <md-option value="*pause">{{ \'MOTIONDIALER.PARTIALPAUSE\' | translate }}</md-option>\n            <md-option value="busy">{{ \'MOTIONDIALER.BUSY\' | translate }}</md-option>\n            <md-option value="idle">{{ \'MOTIONDIALER.IDLE\' | translate }}</md-option>\n        </md-select>\n\n        <md-select ng-if="vm.isPause(vm.query.globalStatusFilter)" ng-model="vm.query.pauseTypeFilter" class="md-caption" ng-change="vm.onInit()">\n            <md-option ng-value="\'\'">All</md-option>\n            <md-option value="DEFAULT PAUSE">DEFAULT PAUSE</md-option>\n            <md-option value="ACW">ACW</md-option>\n            <md-option value="LOGININPAUSE">LOGININPAUSE</md-option>\n            <md-option value="Auto-Pause">AUTOPAUSE</md-option>\n            <md-option ng-value="pause.name" ng-repeat="pause in vm.pauses.rows">{{pause.name}}</md-option>\n        </md-select>\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.order" md-on-reorder="vm.onInit">\n            <tr md-row border="1">\n                <th class="bv text-center" colspan="4">{{ \'MOTIONDIALER.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">{{ \'OPENCHANNEL.OPENCHANNEL\' | translate }}</th>\n                <th ng-if="vm.license.fax" class="bv bl text-center" colspan="2">{{ \'FAX.FAX\' | translate }}</th>\n                <th width="10px" class="bt bl" rowspan="2"></th>\n            </tr>\n            <tr md-row>\n                <th class="bl" md-column md-order-by="fullname">{{ \'MOTIONDIALER.NAME\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="globalStatus">{{ \'MOTIONDIALER.STATUS\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="lastLoginAt">{{ \'MOTIONDIALER.LOGIN_TIME\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="lastPauseAt">{{ \'MOTIONDIALER.PAUSE_TIME\' | translate }}</th>\n\n                <th class="bl custom-column">{{ \'VOICE.STATUS\' | translate }}</th>\n                <th class="bl custom-column">Info</th>\n\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\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\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\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\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            </tr>\n        </thead>\n        <tbody md-body>\n            <tr md-row ng-hide="vm.order.length">\n                <td md-cell colspan="17">\n                    <div layout="row" layout-align="center center">\n                        <span>{{ \'MOTIONDIALER.NO_AGENT_ONLINE\' | translate }}</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-select="vm.agents[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td class="bt padding-5">\n                    <div layout="row" layout-align="start center">\n                        <img class="avatar" ng-src="{{vm.agents[value].userpic && \'api/users/\'+vm.agents[value].id+\'/avatar\' || \'assets/images/avatars/profile.png\'}}">\n                        <div layout="column">\n                            <span>{{vm.agents[value].fullname}}</span>\n                            <span>{{vm.agents[value].internal}}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class="bt">\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'}[vm.agents[value].globalStatus]\">{{ vm.isPause(vm.agents[value].globalStatus) ? '' : vm.agents[value].globalStatus | uppercase }} {{ vm.isPause(vm.agents[value].globalStatus) ? (vm.isPartialPause(vm.agents[value].globalStatus) ? '*'+vm.agents[value].pauseType || 'DEFAULT PAUSE'  : vm.agents[value].pauseType || 'DEFAULT PAUSE') : ''}}</span>\n                </td>\n                <td class=\"bt custom-column\">\n                    <timer start-time=\"vm.agents[value].lastLoginAt\" interval=\"1000\">{{ days > 0 ? days + 'd' : '' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                </td>\n                <td class=\"bt custom-column\">\n                    <timer ng-if=\"vm.isPause(vm.agents[value].globalStatus) || vm.isPartialPause(vm.agents[value].globalStatus)\" start-time=\"vm.agents[value].lastPauseAt\" interval=\"1000\">{{ days > 0 ? days + 'd' : '' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                </td>\n                <td class=\"bt bl\">\n                    <div layout=\"row\">\n                        <span ng-if=\"!vm.agents[value].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'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].voiceStatus | uppercase }}</span>\n                        <span ng-if=\"vm.agents[value].onhold\" class=\"text-boxed md-background-bg bl bt padding-5 orange-400-bg\">ONHOLD</span>\n                    </div>\n                </td>\n                <td class=\"bt bl\">\n                    <div layout=\"column\">\n                        <span ng-if=\"vm.agents[value].queue\" class=\"padding-5\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].queue }}</span>\n                        <span ng-if=\"vm.agents[value].destconnectedlinenum\" class=\"padding-5\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].destconnectedlinenum }}</span>\n                        <span class=\"padding-5\" ng-if=\"vm.agents[value].queue || vm.agents[value].destconnectedlinenum\">\n                            <timer start-time=\"vm.agents[value].voiceStatusTime\" interval=\"1000\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                        </span>\n                    </div>\n                </td>\n                <td class=\"bt bl\" ng-if=\"vm.license.chat\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].chatStatus]\">{{ vm.agents[value].chatStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td md-number class=\"bt text-center font-size-20\" ng-if=\"vm.license.chat\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].chatStatus]\">{{ vm.agents[value].chatCurrentCapacity }}</td>\n                <td class=\"bl bt\" ng-if=\"vm.license.mail\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].mailStatus]\">{{ vm.agents[value].mailStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.mail\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].mailStatus]\">{{ vm.agents[value].mailCurrentCapacity }}</td>\n                <td class=\"bl bt\" ng-if=\"vm.license.messaging\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].smsStatus]\">{{ vm.agents[value].smsStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.messaging\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].smsStatus]\">{{ vm.agents[value].smsCurrentCapacity }}</td>\n                <td class=\"bt bl\" ng-if=\"vm.license.openchannel\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].openchannelStatus]\">{{ vm.agents[value].openchannelStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.openchannel\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].openchannelStatus]\">{{ vm.agents[value].openchannelCurrentCapacity }}</td>\n                <td class=\"bt bl\" ng-if=\"vm.license.fax\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].faxStatus]\">{{ vm.agents[value].faxStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.fax\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].faxStatus]\">{{ vm.agents[value].faxCurrentCapacity }}</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\n                        <md-menu-content width=\"4\">\n                            <md-menu-item>\n                                <md-button ng-click=\"vm.logout(vm.agents[value], $event)\" translate=\"MOTIONDIALER.LOGOUT\">\n                                    Logout\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-button ng-click=\"vm.queueAdd(vm.agents[value], $event)\" translate=\"MOTIONDIALER.AGENTADD_QUEUE\">\n                                    Add Agent In Queue\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-menu>\n                                    <md-button ng-click=\"$mdMenu.open()\" class=\"text-capitalize\" translate=\"MOTIONDIALER.PAUSE\">Pause</md-button>\n                                    <md-menu-content>\n                                        <md-menu-item>\n                                            <md-button ng-disabled=\" vm.agents[value].voicePause && 'DEFAULT PAUSE' === vm.agents[value].pauseType\" ng-click=\"vm.pause(vm.agents[value])\"><em translate=\"MOTIONDIALER.DEFAULT_PAUSE\">Default Pause</em></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=\"vm.agents[value].voicePause && pause.name === vm.agents[value].pauseType\" ng-click=\"vm.pause(vm.agents[value], pause.name)\">{{pause.name}}</md-button>\n                                        </md-menu-item>\n                                    </md-menu-content>\n                                </md-menu>\n                            </md-menu-item>\n                            <md-menu-item ng-if=\"vm.isPause(vm.agents[value].globalStatus)\">\n                                <md-button ng-click=\"vm.unPause(vm.agents[value])\" translate=\"MOTIONDIALER.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\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.filteredAgents.length}}\" md-on-paginate=\"vm.onInit\" md-page-select></md-table-pagination>\n\x3c!-- / AGENT TABLE --\x3e\n\x3c!-- / MAIN --\x3e"),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.query.filter = 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>{{\'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">\n                <td md-cell colspan="8">\n                    <div layout="row" layout-align="center center">\n                        <span tranlsate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-row ng-repeat="(id, campaign) in vm.campaigns">\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.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_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="MOTIONDIALER.QUEUE_CALLS">Queue Calls</span>\n        \x3c!-- <div flex></div>\n    <ms-search-bar on-search="vm.query.filter = query;" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar> --\x3e\n    </div>\n</md-toolbar>\n\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>{{ \'MOTIONDIALER.DID\' | translate }}</th>\n                <th md-column>{{ \'MOTIONDIALER.QUEUE\' | translate }}</th>\n                <th md-column>{{ \'MOTIONDIALER.CALLER\' | translate }}</th>\n                <th md-column>{{ \'MOTIONDIALER.AGENT\' | translate }}</th>\n                <th md-column>{{ \'MOTIONDIALER.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.getSize(vm.rpcVoiceQueuesChannels)">\n                <td md-cell colspan="6">\n                    <div layout="row" layout-align="center center">\n                        <span tranlsate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-row ng-repeat="(key, channel) in vm.rpcVoiceQueuesChannels | limitObjectFromTo: vm.queryChannels.limit:(vm.queryChannels.page - 1) * vm.queryChannels.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 md-cell>{{channel.queue}}</td>\n                <td md-cell>{{channel.calleridnum}}</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" interval="1000">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                        </span>\n                    </span>\n                    <span ng-if="!channel.queuecallerleaveAt" class="text-boxed">\n                        {{ \'MOTIONDIALER.WAITING_FOR_AGENT\' | translate }}\n                        <timer start-time="channel.queuecallerjoinAt" interval="1000">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                    </span>\n                </td>\n                <td md-cell>\n                    <span class="text-boxed">\n                        <timer start-time="channel.queuecallerjoinAt" interval="1000">{{hhours}}:{{mminutes}}:{{sseconds}}</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\n                        <md-menu-content width="2">\n                            <md-menu-item>\n                                <md-button ng-click="vm.hangup(channel.uniqueid)" translate="MOTIONDIALER.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="MOTIONDIALER.REDIRECT_TO_NUMBER">\n                                    Number\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-menu>\n                                    <md-button ng-click="$mdMenu.open()" translate="MOTIONDIALER.REDIRECT_TO_AGENT">Redirect to Agent</md-button>\n                                    <md-menu-content>\n                                        <md-menu-item ng-repeat="agent in vm.agents.rows">\n                                            <md-button ng-click="vm.redirectToAgent(channel.uniqueid, agent.name, agent.context)">{{agent.name}}</md-button>\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\n<md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm.queryChannels.limit" md-page="vm.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm.getSize(vm.rpcVoiceQueuesChannels)}}" md-page-select></md-table-pagination>\n\x3c!-- / QUEUES 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.query.filter = 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>{{\'\n                                MOTIONDIALER.NAME\' | translate}}</th>\n                <th md-column>{{\'\n                                MOTIONDIALER.TOTAL\' | translate}}</th>\n                <th md-column>{{\'\n                                MOTIONDIALER.TOTAL_OFFERED\' | translate}}</th>\n                <th md-column>{{\'\n                                MOTIONDIALER.MANAGED\' | translate}}</th>\n                <th md-column>{{\'\n                                MOTIONDIALER.ABANDONED\' | translate}}</th>\n                <th md-column>{{\'\n                                MOTIONDIALER.DROPPED\' | translate}}</th>\n                <th md-column>{{\'\n                                MOTIONDIALER.AVG_HOLD_TIME\' | translate}}</th>\n                <th md-column>{{\'\n                                MOTIONDIALER.AVG_DURATION\' | translate}}</th>\n                <th md-column>{{\'\n                                MOTIONDIALER.AVG_BILLABLE\' | translate}}</th>\n            </tr>\n        </thead>\n        <tbody md-body>\n            <tr md-row ng-hide="vm.queues">\n                <td md-cell colspan="8">\n                    <div layout="row" layout-align="center center">\n                        <span tranlsate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-row ng-repeat="(id, queue) in vm.queues">\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.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/queues/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.QUEUES">Queues</span>\n        <div flex></div>\n        <ms-search-bar on-search="vm.query.filter = 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.LOGGED_IN\' | translate }}</th>\n                <th md-column>{{ \'MOTIONDIALER.PAUSED\' | translate }}</th>\n                <th md-column>{{ \'MOTIONDIALER.READY\' | translate }}</th>\n                <th md-column>{{ \'MOTIONDIALER.WAITING\' | translate }}</th>\n                <th md-column>{{ \'MOTIONDIALER.TALKING\' | translate }}</th>\n                <th md-column>{{ \'MOTIONDIALER.ORIGINATED\' | 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>\n        </thead>\n        <tbody md-body>\n            <tr md-row ng-hide="vm.queues">\n                <td md-cell colspan="12">\n                    <div layout="row" layout-align="center center">\n                        <span tranlsate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-row md-select="vm.queues[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td md-cell>{{vm.queues[value].name}}</td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].loggedInDb || 0}} ({{vm.queues[value].loggedIn || 0}})</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].paused || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-16 grey-fg">{{vm.queues[value].available || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].waiting || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-16 grey-fg">{{(vm.queues[value].talking || 0)  +  (vm.queues[value].pTalking || 0)}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-16 grey-fg">{{vm.queues[value].originated || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-16 grey-fg">{{vm.queues[value].message ? (\'MOTIONDIALER.\'+vm.queues[value].message | translate) : \'--\'}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-16 grey-fg">{{vm.queues[value].dialMethod || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-16 grey-fg">{{vm.queues[value].Trunk ? vm.queues[value].Trunk.name : \'--\'}}</span>\n                </td>\n                <td md-cell>\n                    <md-icon md-colors="{color: {{vm.queues[value].dialActive ? \'\\\'green\\\'\' : \'\\\'red\\\'\'}}}" md-font-icon="{{vm.queues[value].dialActive ? \'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\n                        <md-menu-content width="3">\n                            <md-menu-item>\n                                <md-button ng-click="vm.createOrEditMotionDialerQueue($event, vm.queues[value])" translate="MOTIONDIALER.EDIT_QUEUE">\n                                    Edit Queue\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-button ng-click="vm.agentAdd($event, vm.queues[value])" translate="MOTIONDIALER.AGENTSADD_QUEUE">\n                                    Add Agents to queue\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.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 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="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"></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 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="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" 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/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 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="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="1">One Time</md-option>\n                    <md-option ng-value="0">Always</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" md-maxlength="255" 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 ng-message="md-maxlength">\n                        <span translate="OPENCHANNEL.ERRORS.TEXT_MAX_LENGTH" translate-values=\'{max: 255}\'>Text 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/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 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="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/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 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="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 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="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="inboundroute-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 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\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 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="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 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="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" 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 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="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 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="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 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="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/openchannelDispositions/dialog.html",'<md-dialog class="openchannelDisposition-dialog" aria-label="New OpenchannelDisposition">\n    <form name="openchannelDispositionForm" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="OPENCHANNEL.NAME">Name</label>\n                <input type="" name="name" ng-model="vm.openchannelDisposition.name" ng-required="true" autofocus>\n\n                <div ng-messages="openchannelDispositionForm[\'name\'].$error" ng-show="openchannelDispositionForm[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.newOpenchannelDisposition" ng-click="vm.saveOpenchannelDisposition()" class="send-button md-accent md-raised" ng-disabled="openchannelDispositionForm.$invalid || openchannelDispositionForm.$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.newOpenchannelDisposition" ng-click="vm.addNewOpenchannelDisposition()" class="send-button md-accent md-raised" ng-disabled="openchannelDispositionForm.$invalid" aria-label="ADD" translate="OPENCHANNEL.ADD_OPENCHANNELDISPOSITION" translate-attr-aria-label="OPENCHANNEL.ADD_OPENCHANNELDISPOSITION">\n                    ADD OPENCHANNELDISPOSITION\n                </md-button>\n            </div>\n            <div layout="row">\n                <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newOpenchannelDisposition" ng-click="vm.deleteOpenchannelDisposition($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" 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                            <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, 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" 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" 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 class="openchannelAccount-detail-form-container openchanneldispositions md-background-bg md-whiteframe-1dp">\n                        <div ng-controller="OpenchannelAccountOpenchannelDispositionsController as vm_dc" ng-init="vm_dc.init(vm.openchannelAccount, vm.crudPermissions)">\n                            <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedOpenchannelAccountOpenchannelDispositions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead" translate="OPENCHANNEL.OPENCHANNELDISPOSITIONS">OpenchannelDispositions</span>\n                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\n                                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelDisposition($event)" aria-label="add openchannelDisposition" translate translate-attr-label="OPENCHANNEL.ADD_OPENCHANNELDISPOSITION">\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.selectedOpenchannelAccountOpenchannelDispositions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead">{{vm_dc.selectedOpenchannelAccountOpenchannelDispositions.length}} {{vm_dc.selectedOpenchannelAccountOpenchannelDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                                    <div flex></div>\n                                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedOpenchannelAccountOpenchannelDispositions" 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.deleteSelectedOpenchannelAccountOpenchannelDispositions($event)" aria-label="delete selected" translate translate-attr-label="OPENCHANNELACCOUNTS.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.selectedOpenchannelAccountOpenchannelDispositions" md-progress="vm_dc.promise">\n                                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getOpenchannelAccountOpenchannelDispositions">\n                                        <tr md-row>\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="createdAt">{{ \'OPENCHANNEL.CREATED_AT\' | translate }}</th>\n                                            <th md-column width="10px"></th>\n                                        </tr>\n                                    </thead>\n                                    <tbody md-body>\n                                        <tr md-row md-select="openchannelDisposition" md-select-id="id" ng-repeat="openchannelDisposition in vm_dc.openchannelAccountOpenchannelDispositions.rows">\n                                            <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelDisposition($event, openchannelDisposition)" md-cell>{{openchannelDisposition.id}}</td>\n                                            <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelDisposition($event, openchannelDisposition)" md-cell>{{openchannelDisposition.name}}</td>\n                                            <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelDisposition($event, openchannelDisposition)" md-cell>{{openchannelDisposition.createdAt | date:\'medium\'}}</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.createOrEditOpenchannelAccountOpenchannelDisposition($event, openchannelDisposition)" translate="OPENCHANNEL.EDIT_OPENCHANNELDISPOSITION">\n                                                                Edit OpenchannelDisposition\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(openchannelDisposition, $event)" translate="OPENCHANNEL.DELETE_OPENCHANNELDISPOSITION">\n                                                                Delete OpenchannelDisposition\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.openchannelAccountOpenchannelDispositions.rows.length">\n                                            <td md-cell colspan="5">\n                                                <span class="text-boxed-ligth" translate="OPENCHANNEL.NO_OPENCHANNELDISPOSITION_AVAILABLE">No openchanneldisposition available</span>\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.openchannelAccountOpenchannelDispositions.count}}" md-on-paginate="vm_dc.getOpenchannelAccountOpenchannelDispositions" 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.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)">\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                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="OPENCHANNELACCOUNTS.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.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">{{ \'OPENCHANNEL.ID\' | translate }}</th>\n                                            <th md-column md-order-by="key">{{ \'OPENCHANNEL.KEY\' | translate }}</th>\n                                            <th md-column md-order-by="value">{{ \'OPENCHANNEL.VALUE\' | translate }}</th>\n                                            <th md-column md-order-by="description">{{ \'OPENCHANNEL.DESCRIPTION\' | translate }}</th>\n                                            <th md-column md-order-by="createdAt">{{ \'OPENCHANNEL.CREATED_AT\' | translate }}</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>{{openchannelCannedAnswer.id}}</td>\n                                            <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" md-cell>{{openchannelCannedAnswer.key}}</td>\n                                            <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" md-cell>{{openchannelCannedAnswer.value}}</td>\n                                            <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" md-cell>{{openchannelCannedAnswer.description}}</td>\n                                            <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" md-cell>{{openchannelCannedAnswer.createdAt | date:\'medium\'}}</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                                                <span class="text-boxed-ligth" translate="OPENCHANNEL.NO_OPENCHANNELCANNEDANSWER_AVAILABLE">No openchannelcannedanswer available</span>\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" ms-scroll 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.alias || a.appType) | uppercase}}">{{a.alias || 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" ms-scroll 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" style="width:200px">{{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-ligth" 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)">\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                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="OPENCHANNELACCOUNTS.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.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">{{ \'OPENCHANNEL.ID\' | translate }}</th>\n                                            <th md-column md-order-by="createdAt">{{ \'OPENCHANNEL.STARTEDAT\' | translate }}</th>\n                                            <th md-column>{{ \'OPENCHANNEL.CONTACT\' | translate }}</th>\n                                            <th md-column>{{ \'OPENCHANNEL.AGENT\' | translate }}</th>\n                                            <th md-column md-order-by="closedAt">{{ \'OPENCHANNEL.CLOSEDAT\' | translate }}</th>\n                                            <th md-column md-order-by="disposition">{{ \'OPENCHANNEL.DISPOSITION\' | translate }}</th>\n                                            <th md-column md-order-by="note">{{ \'OPENCHANNEL.NOTES\' | translate }}</th>\n                                            <th md-column md-order-by="tag">{{ \'OPENCHANNEL.TAGS\' | translate }}</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">\n                                            <td md-cell>{{interaction.id}}</td>\n                                            <td md-cell>{{interaction.createdAt | date:\'medium\'}}</td>\n                                            <td md-cell>{{interaction.Contact.firstName}}</td>\n                                            <td md-cell>{{interaction.Owner.name}}</td>\n                                            <td md-cell>{{interaction.closedAt | date:\'medium\'}}</td>\n                                            <td md-cell>{{interaction.disposition}}</td>\n                                            <td md-cell>{{interaction.note}}</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"></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>\n                                                            <md-button class="md-primary" ng-click="vm_dc.openchannelInteractionDownload(interaction, $event)" translate="OPENCHANNEL.DOWNLOAD_INTERACTION">\n                                                                Download Interaction\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="13">\n                                                <span class="text-boxed-ligth" translate="OPENCHANNEL.NO_INTERACTION_AVAILABLE">No interaction available</span>\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 animate-slide-down 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="OPENCHANNELACCOUNTS.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="OPENCHANNELACCOUNTS.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!-- 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})[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                                <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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(openchannelAccount, $event)" translate="OPENCHANNEL.EDIT_OPENCHANNELACCOUNT">\n                                                    Edit OpenchannelAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.interactionsgoto(openchannelAccount, $event)" translate="OPENCHANNEL.INTERACTIONS_OPENCHANNELACCOUNT">\n                                                    Interactions OpenchannelAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.agentadddialog(openchannelAccount, $event)" translate="OPENCHANNEL.AGENTADD_OPENCHANNELACCOUNT">\n                                                    AgentAdd OpenchannelAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(openchannelAccount, $event)" translate="OPENCHANNEL.DELETE_OPENCHANNELACCOUNT">\n                                                    Delete OpenchannelAccount\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: \'{{\'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 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="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" 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"></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"></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" 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 animate-slide-down 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="OPENCHANNELQUEUES.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="OPENCHANNELQUEUES.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!-- 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                                <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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(openchannelQueue, $event)" translate="OPENCHANNEL.EDIT_OPENCHANNELQUEUE">\n                                                    Edit OpenchannelQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.teamadddialog(openchannelQueue, $event)" translate="OPENCHANNEL.TEAMADD_OPENCHANNELQUEUE">\n                                                    teamadd OpenchannelQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.agentadddialog(openchannelQueue, $event)" translate="OPENCHANNEL.AGENTADD_OPENCHANNELQUEUE">\n                                                    agentadd OpenchannelQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(openchannelQueue, $event)" translate="OPENCHANNEL.DELETE_OPENCHANNELQUEUE">\n                                                    Delete OpenchannelQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.gotorealtimegoto(openchannelQueue, $event)" translate="OPENCHANNEL.GOTOREALTIME_OPENCHANNELQUEUE">\n                                                    goToRealtime OpenchannelQueue\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: \'{{\'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/agents/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="OPENCHANNEL.AGENTS">Agents</span>\n        <div flex></div>\n        <ms-search-bar on-search="vm.query.filter = query; vm.onInit()" on-collapse="vm.query.filter = undefined; vm.onInit()" debounce="300"></ms-search-bar>\n        <md-select ng-model="vm.query.globalStatusFilter" class="md-caption" ng-change="vm.query.pauseTypeFilter = \'\'; vm.onInit()">\n            <md-option ng-value="\'\'">{{ \'OPENCHANNEL.ALL\' | translate }}</md-option>\n            <md-option value="pause">{{ \'OPENCHANNEL.PAUSE\' | translate }}</md-option>\n            <md-option value="*pause">{{ \'OPENCHANNEL.PARTIALPAUSE\' | translate }}</md-option>\n            <md-option value="busy">{{ \'OPENCHANNEL.BUSY\' | translate }}</md-option>\n            <md-option value="idle">{{ \'OPENCHANNEL.IDLE\' | translate }}</md-option>\n        </md-select>\n\n        <md-select ng-if="vm.isPause(vm.query.globalStatusFilter)" ng-model="vm.query.pauseTypeFilter" class="md-caption" ng-change="vm.onInit()">\n            <md-option ng-value="\'\'">All</md-option>\n            <md-option value="DEFAULT PAUSE">DEFAULT PAUSE</md-option>\n            <md-option value="ACW">ACW</md-option>\n            <md-option value="LOGININPAUSE">LOGININPAUSE</md-option>\n            <md-option value="Auto-Pause">AUTOPAUSE</md-option>\n            <md-option ng-value="pause.name" ng-repeat="pause in vm.pauses.rows">{{pause.name}}</md-option>\n        </md-select>\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.order" md-on-reorder="vm.onInit">\n            <tr md-row border="1">\n                <th class="bv text-center" colspan="4">{{ \'OPENCHANNEL.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">{{ \'OPENCHANNEL.OPENCHANNEL\' | translate }}</th>\n                <th ng-if="vm.license.fax" class="bv bl text-center" colspan="2">{{ \'FAX.FAX\' | translate }}</th>\n                <th width="10px" class="bt bl" rowspan="2"></th>\n            </tr>\n            <tr md-row>\n                <th class="bl" md-column md-order-by="fullname">{{ \'OPENCHANNEL.NAME\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="globalStatus">{{ \'OPENCHANNEL.STATUS\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="lastLoginAt">{{ \'OPENCHANNEL.LOGIN_TIME\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="lastPauseAt">{{ \'OPENCHANNEL.PAUSE_TIME\' | translate }}</th>\n\n                <th class="bl custom-column">{{ \'VOICE.STATUS\' | translate }}</th>\n                <th class="bl custom-column">Info</th>\n\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\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\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\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\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            </tr>\n        </thead>\n        <tbody md-body>\n            <tr md-row ng-hide="vm.order.length">\n                <td md-cell colspan="17">\n                    <div layout="row" layout-align="center center">\n                        <span>{{ \'OPENCHANNEL.NO_AGENT_ONLINE\' | translate }}</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-select="vm.agents[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td class="bt padding-5">\n                    <div layout="row" layout-align="start center">\n                        <img class="avatar" ng-src="{{vm.agents[value].userpic && \'api/users/\'+vm.agents[value].id+\'/avatar\' || \'assets/images/avatars/profile.png\'}}">\n                        <div layout="column">\n                            <span>{{vm.agents[value].fullname}}</span>\n                            <span>{{vm.agents[value].internal}}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class="bt">\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'}[vm.agents[value].globalStatus]\">{{ vm.isPause(vm.agents[value].globalStatus) ? '' : vm.agents[value].globalStatus | uppercase }} {{ vm.isPause(vm.agents[value].globalStatus) ? (vm.isPartialPause(vm.agents[value].globalStatus) ? '*'+vm.agents[value].pauseType || 'DEFAULT PAUSE'  : vm.agents[value].pauseType || 'DEFAULT PAUSE') : ''}}</span>\n                </td>\n                <td class=\"bt custom-column\">\n                    <timer start-time=\"vm.agents[value].lastLoginAt\" interval=\"1000\">{{ days > 0 ? days + 'd' : '' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                </td>\n                <td class=\"bt custom-column\">\n                    <timer ng-if=\"vm.isPause(vm.agents[value].globalStatus) || vm.isPartialPause(vm.agents[value].globalStatus)\" start-time=\"vm.agents[value].lastPauseAt\" interval=\"1000\">{{ days > 0 ? days + 'd' : '' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                </td>\n                <td class=\"bt bl\">\n                    <div layout=\"row\">\n                        <span ng-if=\"!vm.agents[value].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'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].voiceStatus | uppercase }}</span>\n                        <span ng-if=\"vm.agents[value].onhold\" class=\"text-boxed md-background-bg bl bt padding-5 orange-400-bg\">ONHOLD</span>\n                    </div>\n                </td>\n                <td class=\"bt bl\">\n                    <div layout=\"column\">\n                        <span ng-if=\"vm.agents[value].queue\" class=\"padding-5\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].queue }}</span>\n                        <span ng-if=\"vm.agents[value].destconnectedlinenum\" class=\"padding-5\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].destconnectedlinenum }}</span>\n                        <span class=\"padding-5\" ng-if=\"vm.agents[value].queue || vm.agents[value].destconnectedlinenum\">\n                            <timer start-time=\"vm.agents[value].voiceStatusTime\" interval=\"1000\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                        </span>\n                    </div>\n                </td>\n                <td class=\"bt bl\" ng-if=\"vm.license.chat\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].chatStatus]\">{{ vm.agents[value].chatStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td md-number class=\"bt text-center font-size-20\" ng-if=\"vm.license.chat\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].chatStatus]\">{{ vm.agents[value].chatCurrentCapacity }}</td>\n                <td class=\"bl bt\" ng-if=\"vm.license.mail\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].mailStatus]\">{{ vm.agents[value].mailStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.mail\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].mailStatus]\">{{ vm.agents[value].mailCurrentCapacity }}</td>\n                <td class=\"bl bt\" ng-if=\"vm.license.messaging\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].smsStatus]\">{{ vm.agents[value].smsStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.messaging\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].smsStatus]\">{{ vm.agents[value].smsCurrentCapacity }}</td>\n                <td class=\"bt bl\" ng-if=\"vm.license.openchannel\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].openchannelStatus]\">{{ vm.agents[value].openchannelStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.openchannel\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].openchannelStatus]\">{{ vm.agents[value].openchannelCurrentCapacity }}</td>\n                <td class=\"bt bl\" ng-if=\"vm.license.fax\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].faxStatus]\">{{ vm.agents[value].faxStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.fax\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].faxStatus]\">{{ vm.agents[value].faxCurrentCapacity }}</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\n                        <md-menu-content width=\"4\">\n                            <md-menu-item>\n                                <md-button ng-click=\"vm.logout(vm.agents[value], $event)\" translate=\"OPENCHANNEL.LOGOUT\">\n                                    Logout\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-button ng-click=\"vm.queueAdd(vm.agents[value], $event)\" translate=\"OPENCHANNEL.AGENTADD_QUEUE\">\n                                    Add Agent In Queue\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-menu>\n                                    <md-button ng-click=\"$mdMenu.open()\" class=\"text-capitalize\" translate=\"OPENCHANNEL.PAUSE\">Pause</md-button>\n                                    <md-menu-content>\n                                        <md-menu-item>\n                                            <md-button ng-disabled=\" vm.agents[value].voicePause && 'DEFAULT PAUSE' === vm.agents[value].pauseType\" ng-click=\"vm.pause(vm.agents[value])\"><em translate=\"OPENCHANNEL.DEFAULT_PAUSE\">Default Pause</em></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=\"vm.agents[value].voicePause && pause.name === vm.agents[value].pauseType\" ng-click=\"vm.pause(vm.agents[value], pause.name)\">{{pause.name}}</md-button>\n                                        </md-menu-item>\n                                    </md-menu-content>\n                                </md-menu>\n                            </md-menu-item>\n                            <md-menu-item ng-if=\"vm.isPause(vm.agents[value].globalStatus)\">\n                                <md-button ng-click=\"vm.unPause(vm.agents[value])\" translate=\"OPENCHANNEL.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\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.filteredAgents.length}}\" md-on-paginate=\"vm.onInit\" md-page-select></md-table-pagination>\n\x3c!-- / AGENT TABLE --\x3e\n\x3c!-- / MAIN --\x3e"),e.put("app/main/apps/openchannel/views/realtime/queues/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="OPENCHANNEL.QUEUES">Queues</span>\n        <div flex></div>\n        <ms-search-bar on-search="vm.query.filter = 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">{{ \'OPENCHANNEL.NAME\' | translate }}</th>\n                <th md-column>{{ \'OPENCHANNEL.LOGGED_IN\' | translate }}</th>\n                <th md-column>{{ \'OPENCHANNEL.PAUSED\' | translate }}</th>\n                <th md-column>{{ \'OPENCHANNEL.READY\' | translate }}</th>\n                <th md-column>{{ \'OPENCHANNEL.WAITING\' | translate }}</th>\n                <th md-column width="10px"></th>\n            </tr>\n        </thead>\n        <tbody md-body>\n            <tr md-row ng-hide="vm.queues">\n                <td md-cell colspan="7">\n                    <div layout="row" layout-align="center center">\n                        <span tranlsate="OPENCHANNEL.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-row md-select="vm.queues[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td md-cell>{{vm.queues[value].name}}</td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].loggedInDb || 0}} ({{vm.queues[value].loggedIn || 0}})</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].paused || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-16 grey-fg">{{vm.queues[value].available || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].waiting || 0}}</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="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.createOrEditOpenchannelQueue($event, vm.queues[value])" translate="OPENCHANNEL.EDIT_QUEUE">\n                                    Edit Queue\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-button ng-click="vm.agentAdd($event, vm.queues[value])" translate="OPENCHANNEL.AGENTSADD_QUEUE">\n                                    Add Agents to queue\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: \'{{\'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.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/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/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 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                <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.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) || (customizationsForm.$invalid || logoForm.$invalid || logologinForm.$invalid || preferredForm.$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" ms-scroll>\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.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>\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 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="SETTINGS.MIN_INTERNAL">Min_Internal</label>\n                <input type="number" name="min_internal" ng-model="vm.general.min_internal" min="0" ng-required="true" autofocus>\n\n                <div ng-messages="generalForm[\'min_internal\'].$error" ng-show="generalForm[\'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                <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.CHATTIMEOUT">chatTimeout</label>\n                <input type="number" name="chatTimeout" ng-model="vm.general.chatTimeout" min="0" ng-required="true">\n\n                <div ng-messages="generalForm[\'chatTimeout\'].$error" ng-show="generalForm[\'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                <label translate="SETTINGS.STUNADDR">Stunaddr</label>\n                <input type="text" name="stunaddr" ng-model="vm.general.stunaddr">\n\n                <div ng-messages="generalForm[\'stunaddr\'].$error" ng-show="generalForm[\'stunaddr\'].$touched" role="alert">\n                    <div ng-message="required">\n                        <span translate="SETTINGS.ERRORS.STUNADDR_REQUIRED">Stunaddr field is required</span>\n                    </div>\n                </div>\n            </md-input-container>\n            <md-input-container class="md-block">\n                <label translate="SETTINGS.TURNADDR">Turnaddr</label>\n                <input type="text" name="turnaddr" ng-model="vm.general.turnaddr">\n\n                <div ng-messages="generalForm[\'turnaddr\'].$error" ng-show="generalForm[\'turnaddr\'].$touched" role="alert">\n                    <div ng-message="required">\n                        <span translate="SETTINGS.ERRORS.TURNADDR_REQUIRED">Turnaddr field is required</span>\n                    </div>\n                </div>\n            </md-input-container>\n            <md-input-container class="md-block">\n                <label translate="SETTINGS.TURN_USERNAME">Turn_Username</label>\n                <input type="text" name="turnusername" ng-model="vm.general.turnusername">\n\n                <div ng-messages="generalForm[\'turnusername\'].$error" ng-show="generalForm[\'turnusername\'].$touched" role="alert">\n                    <div ng-message="required">\n                        <span translate="SETTINGS.ERRORS.TURN_USERNAME_REQUIRED">Turn_Username field is required</span>\n                    </div>\n                </div>\n            </md-input-container>\n            <md-input-container class="md-block">\n                <label translate="SETTINGS.TURN_PASSWORD">Turn_Password</label>\n                <input type="text" name="turnpassword" ng-model="vm.general.turnpassword">\n\n                <div ng-messages="generalForm[\'turnpassword\'].$error" ng-show="generalForm[\'turnpassword\'].$touched" role="alert">\n                    <div ng-message="required">\n                        <span translate="SETTINGS.ERRORS.TURN_PASSWORD_REQUIRED">Turn_Password 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.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">\n\n                <div ng-messages="generalForm[\'splitSizeCsv\'].$error" ng-show="generalForm[\'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">\n\n                <div ng-messages="generalForm[\'splitSizePdf\'].$error" ng-show="generalForm[\'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">\n\n                <div ng-messages="generalForm[\'splitSizeXlsx\'].$error" ng-show="generalForm[\'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            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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) || (globalForm.$invalid || motionbarForm.$invalid || reportForm.$invalid || agentOmniDesktopInterfaceForm.$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" ms-scroll>\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" 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                        <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.CHATTIMEOUT">chatTimeout</label>\n                        <input type="number" name="chatTimeout" ng-model="vm.general.chatTimeout" min="0" 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                        <label translate="SETTINGS.STUNADDR">Stunaddr</label>\n                        <input type="text" name="stunaddr" ng-model="vm.general.stunaddr">\n\n                        <div ng-messages="globalForm[\'stunaddr\'].$error" ng-show="globalForm[\'stunaddr\'].$touched" role="alert">\n                            <div ng-message="required">\n                                <span translate="SETTINGS.ERRORS.STUNADDR_REQUIRED">Stunaddr field is required</span>\n                            </div>\n                        </div>\n                    </md-input-container>\n                    <md-input-container class="md-block">\n                        <label translate="SETTINGS.TURNADDR">Turnaddr</label>\n                        <input type="text" name="turnaddr" ng-model="vm.general.turnaddr">\n\n                        <div ng-messages="globalForm[\'turnaddr\'].$error" ng-show="globalForm[\'turnaddr\'].$touched" role="alert">\n                            <div ng-message="required">\n                                <span translate="SETTINGS.ERRORS.TURNADDR_REQUIRED">Turnaddr field is required</span>\n                            </div>\n                        </div>\n                    </md-input-container>\n                    <md-input-container class="md-block">\n                        <label translate="SETTINGS.TURN_USERNAME">Turn_Username</label>\n                        <input type="text" name="turnusername" ng-model="vm.general.turnusername">\n\n                        <div ng-messages="globalForm[\'turnusername\'].$error" ng-show="globalForm[\'turnusername\'].$touched" role="alert">\n                            <div ng-message="required">\n                                <span translate="SETTINGS.ERRORS.TURN_USERNAME_REQUIRED">Turn_Username field is required</span>\n                            </div>\n                        </div>\n                    </md-input-container>\n                    <md-input-container class="md-block">\n                        <label translate="SETTINGS.TURN_PASSWORD">Turn_Password</label>\n                        <input type="text" name="turnpassword" ng-model="vm.general.turnpassword">\n\n                        <div ng-messages="globalForm[\'turnpassword\'].$error" ng-show="globalForm[\'turnpassword\'].$touched" role="alert">\n                            <div ng-message="required">\n                                <span translate="SETTINGS.ERRORS.TURN_PASSWORD_REQUIRED">Turn_Password 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 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" 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">\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">\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">\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                        <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\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        <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>\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" ms-scroll>\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>\n                                <a href="https://www.xcally.com/en/index.html#pricing-table2-h" 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="36" 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                            </div>\n                        </div>\n                    </div>\n\n                    <span ng-if="!vm.license.demo && !vm.license.gray" 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 class="text-italic text-bold">{{vm.license.uuid}}</span></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 class="text-italic text-bold">{{vm.license.machineUuid}}</span></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\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" 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                    <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" 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 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="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="36"><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 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            <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 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="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-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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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 animate-slide-down 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="NETWORKS.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="NETWORKS.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!-- 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                                <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                                        <md-menu-content width="3">\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.editdialog(network, $event)" translate="SETTINGS.EDIT_NETWORK">\n                                                    Edit Network\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.deleteconfirm(network, $event)" translate="SETTINGS.DELETE_NETWORK">\n                                                    Delete Network\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: \'{{\'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/create/dialog.html",'<md-dialog class="smtp-dialog" aria-label="New Smtp">\n    <form name="smtpForm" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="SETTINGS.ACCOUNTNAME">AccountName</label>\n                <input type="text" name="name" ng-model="vm.smtp.name" ng-required="true" autofocus>\n\n                <div ng-messages="smtpForm[\'name\'].$error" ng-show="smtpForm[\'name\'].$touched" role="alert">\n                    <div ng-message="required">\n                        <span translate="SETTINGS.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="SETTINGS.EMAILADDRESS">EmailAddress</label>\n                <input type="email" name="email" ng-model="vm.smtp.email" ng-required="true">\n\n                <div class="hint"><span translate="SETTINGS.HELP.EMAILADDRESS"></span></div>\n                <div ng-messages="smtpForm[\'email\'].$error" ng-show="smtpForm[\'email\'].$touched" role="alert">\n                    <div ng-message="required">\n                        <span translate="SETTINGS.ERRORS.EMAILADDRESS_REQUIRED">EmailAddress field is required</span>\n                    </div>\n                    <div ng-message="email">\n                        <span translate="SETTINGS.ERRORS.EMAILADDRESS_MUST_VALID">EmailAddress 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.SMTP_SERVICE">SMTP_Service</label>\n                <md-select name="Smtp.service" ng-model="vm.smtp.Smtp.service" required>\n                    <md-option ng-value="null">Custom</md-option>\n                    <md-option ng-value="\'gmail\'">Gmail</md-option>\n                    <md-option ng-value="\'hotmail\'">Hotmail</md-option>\n                    <md-option ng-value="\'yahoo\'">Yahoo</md-option>\n                    <md-option ng-value="\'outlook365\'">Outlook365</md-option>\n                </md-select>\n                <div ng-messages="smtpForm[\'Smtp.service\'].$error" ng-show="smtpForm[\'Smtp.service\'].$touched" role="alert">\n                    <div ng-message="required">\n                        <span translate="SETTINGS.ERRORS.SMTP_SERVICE_REQUIRED">SMTP_Service field is required</span>\n                    </div>\n                </div>\n            </md-input-container>\n            <md-input-container ng-if="vm.smtp.Smtp.service == null" class="md-block">\n                <label translate="SETTINGS.SMTP_HOST">SMTP_Host</label>\n                <input type="text" name="Smtp.host" ng-model="vm.smtp.Smtp.host" ng-required="true">\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="SETTINGS.ERRORS.SMTP_HOST_REQUIRED">SMTP_Host field is required</span>\n                    </div>\n                </div>\n            </md-input-container>\n            <md-input-container ng-if="vm.smtp.Smtp.service == null" class="md-block">\n                <label translate="SETTINGS.SMTP_PORT">SMTP_Port</label>\n                <input type="number" name="Smtp.port" ng-model="vm.smtp.Smtp.port" ng-required="true">\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="SETTINGS.ERRORS.SMTP_PORT_REQUIRED">SMTP_Port field is required</span>\n                    </div>\n                </div>\n            </md-input-container>\n            <md-input-container ng-if="vm.smtp.Smtp.service == null" class="md-block">\n                <md-switch ng-model="vm.smtp.Smtp.secure" aria-label="SMTP_Secure"><span translate="SETTINGS.SMTP_SECURE">SMTP_Secure</span></md-switch>\n                <div class="hint"><span translate="SETTINGS.HELP.SMTP_SECURE"></span></div>\n            </md-input-container>\n            <md-input-container ng-if="vm.smtp.Smtp.service == null" class="md-block">\n                <md-switch ng-model="vm.smtp.Smtp.authentication" aria-label="SMTP_Authentication"><span translate="SETTINGS.SMTP_AUTHENTICATION">SMTP_Authentication</span></md-switch>\n            </md-input-container>\n            <md-input-container ng-if="vm.smtp.Smtp.authentication == true || vm.smtp.Smtp.service != null" class="md-block">\n                <label translate="SETTINGS.SMTP_USERNAME">SMTP_Username</label>\n                <input type="text" name="Smtp.user" ng-model="vm.smtp.Smtp.user" ng-required="true">\n\n                <div class="hint"><span translate="SETTINGS.HELP.SMTP_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="SETTINGS.ERRORS.SMTP_USERNAME_REQUIRED">SMTP_Username field is required</span>\n                    </div>\n                </div>\n            </md-input-container>\n            <md-input-container class="md-block" ng-if="vm.smtp.Smtp.authentication == true || vm.smtp.Smtp.service != null">\n                <label translate="SETTINGS.SMTP_PASSWORD">SMTP_Password</label>\n                <input type="password" name="Smtp.pass" ng-model="vm.smtp.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="smtpForm[\'Smtp.pass\'].$error" role="alert">\n                    <div ng-message="required">\n                        <span translate="SETTINGS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                    </div>\n                    <div ng-message="pattern">\n                        <span translate="SETTINGS.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="SETTINGS.DESCRIPTION">Description</label>\n                <input type="" name="description" ng-model="vm.smtp.description">\n\n                <div ng-messages="smtpForm[\'description\'].$error" ng-show="smtpForm[\'description\'].$touched" role="alert">\n                    <div ng-message="required">\n                        <span translate="SETTINGS.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.newSmtp" ng-click="vm.saveSmtp()" class="send-button md-accent md-raised" ng-disabled="smtpForm.$invalid || smtpForm.$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.newSmtp" ng-click="vm.addNewSmtp()" class="send-button md-accent md-raised" ng-disabled="smtpForm.$invalid" aria-label="ADD" translate="SETTINGS.ADD_SMTP" translate-attr-aria-label="SETTINGS.ADD_SMTP">\n                    ADD SMTP\n                </md-button>\n            </div>\n            <div layout="row">\n                <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSmtp" ng-click="vm.deleteSmtp($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/smtps/smtps.html",'<div id="smtps" 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.SMTP">Smtp</span>\n            </div>\n        </div>\n        \x3c!-- / APP TITLE --\x3e\n\n        <div>\n            <md-button type="submit" ng-click="vm.verifySmtp()" ng-disabled="!vm.smtp.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    \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" ms-scroll>\n\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                    <md-input-container class="md-block">\n                        <label translate="SETTINGS.ACCOUNTNAME">AccountName</label>\n                        <input type="text" name="name" ng-model="vm.smtp.name" ng-required="true" autofocus>\n\n                        <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                            <div ng-message="required">\n                                <span translate="SETTINGS.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="SETTINGS.EMAILADDRESS">EmailAddress</label>\n                        <input type="email" name="email" ng-model="vm.smtp.email" ng-required="true">\n\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.EMAILADDRESS_REQUIRED">EmailAddress field is required</span>\n                            </div>\n                            <div ng-message="email">\n                                <span translate="SETTINGS.ERRORS.EMAILADDRESS_MUST_VALID">EmailAddress 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.SMTP_SERVICE">SMTP_Service</label>\n                        <md-select name="Smtp.service" ng-model="vm.smtp.Smtp.service" required>\n                            <md-option ng-value="null">Custom</md-option>\n                            <md-option ng-value="\'gmail\'">Gmail</md-option>\n                            <md-option ng-value="\'hotmail\'">Hotmail</md-option>\n                            <md-option ng-value="\'yahoo\'">Yahoo</md-option>\n                            <md-option ng-value="\'outlook365\'">Outlook365</md-option>\n                        </md-select>\n                        <div ng-messages="generalForm[\'Smtp.service\'].$error" ng-show="generalForm[\'Smtp.service\'].$touched" role="alert">\n                            <div ng-message="required">\n                                <span translate="SETTINGS.ERRORS.SMTP_SERVICE_REQUIRED">SMTP_Service field is required</span>\n                            </div>\n                        </div>\n                    </md-input-container>\n                    <md-input-container ng-if="vm.smtp.Smtp.service == null" class="md-block">\n                        <label translate="SETTINGS.SMTP_HOST">SMTP_Host</label>\n                        <input type="text" name="Smtp.host" ng-model="vm.smtp.Smtp.host" ng-required="true">\n\n                        <div ng-messages="generalForm[\'Smtp.host\'].$error" ng-show="generalForm[\'Smtp.host\'].$touched" role="alert">\n                            <div ng-message="required">\n                                <span translate="SETTINGS.ERRORS.SMTP_HOST_REQUIRED">SMTP_Host field is required</span>\n                            </div>\n                        </div>\n                    </md-input-container>\n                    <md-input-container ng-if="vm.smtp.Smtp.service == null" class="md-block">\n                        <label translate="SETTINGS.SMTP_PORT">SMTP_Port</label>\n                        <input type="number" name="Smtp.port" ng-model="vm.smtp.Smtp.port" ng-required="true">\n\n                        <div ng-messages="generalForm[\'Smtp.port\'].$error" ng-show="generalForm[\'Smtp.port\'].$touched" role="alert">\n                            <div ng-message="required">\n                                <span translate="SETTINGS.ERRORS.SMTP_PORT_REQUIRED">SMTP_Port field is required</span>\n                            </div>\n                        </div>\n                    </md-input-container>\n                    <md-input-container ng-if="vm.smtp.Smtp.service == null" class="md-block">\n                        <md-switch ng-model="vm.smtp.Smtp.secure" aria-label="SMTP_Secure"><span translate="SETTINGS.SMTP_SECURE">SMTP_Secure</span></md-switch>\n                        <div class="hint"><span translate="SETTINGS.HELP.SMTP_SECURE"></span></div>\n                    </md-input-container>\n                    <md-input-container ng-if="vm.smtp.Smtp.service == null" class="md-block">\n                        <md-switch ng-model="vm.smtp.Smtp.authentication" aria-label="SMTP_Authentication"><span translate="SETTINGS.SMTP_AUTHENTICATION">SMTP_Authentication</span></md-switch>\n                    </md-input-container>\n                    <md-input-container ng-if="vm.smtp.Smtp.authentication == true || vm.smtp.Smtp.service != null" class="md-block">\n                        <label translate="SETTINGS.SMTP_USERNAME">SMTP_Username</label>\n                        <input type="text" name="Smtp.user" ng-model="vm.smtp.Smtp.user" ng-required="true">\n\n                        <div class="hint"><span translate="SETTINGS.HELP.SMTP_USERNAME"></span></div>\n                        <div ng-messages="generalForm[\'Smtp.user\'].$error" ng-show="generalForm[\'Smtp.user\'].$touched" role="alert">\n                            <div ng-message="required">\n                                <span translate="SETTINGS.ERRORS.SMTP_USERNAME_REQUIRED">SMTP_Username field is required</span>\n                            </div>\n                        </div>\n                    </md-input-container>\n                    <md-input-container class="md-block" ng-if="vm.smtp.Smtp.authentication == true || vm.smtp.Smtp.service != null">\n                        <label translate="SETTINGS.SMTP_PASSWORD">SMTP_Password</label>\n                        <input type="password" name="Smtp.pass" ng-model="vm.smtp.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[\'Smtp.pass\'].$error" role="alert">\n                            <div ng-message="required">\n                                <span translate="SETTINGS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                            </div>\n                            <div ng-message="pattern">\n                                <span translate="SETTINGS.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="SETTINGS.DESCRIPTION">Description</label>\n                        <input type="" name="description" ng-model="vm.smtp.description">\n\n                        <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                            <div ng-message="required">\n                                <span translate="SETTINGS.ERRORS.DESCRIPTION_REQUIRED">Description 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/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 ms-scroll>\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" ms-scroll>\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/agents/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="SMS.AGENTS">Agents</span>\n        <div flex></div>\n        <ms-search-bar on-search="vm.query.filter = query; vm.onInit()" on-collapse="vm.query.filter = undefined; vm.onInit()" debounce="300"></ms-search-bar>\n        <md-select ng-model="vm.query.globalStatusFilter" class="md-caption" ng-change="vm.query.pauseTypeFilter = \'\'; vm.onInit()">\n            <md-option ng-value="\'\'">{{ \'SMS.ALL\' | translate }}</md-option>\n            <md-option value="pause">{{ \'SMS.PAUSE\' | translate }}</md-option>\n            <md-option value="*pause">{{ \'SMS.PARTIALPAUSE\' | translate }}</md-option>\n            <md-option value="busy">{{ \'SMS.BUSY\' | translate }}</md-option>\n            <md-option value="idle">{{ \'SMS.IDLE\' | translate }}</md-option>\n        </md-select>\n\n        <md-select ng-if="vm.isPause(vm.query.globalStatusFilter)" ng-model="vm.query.pauseTypeFilter" class="md-caption" ng-change="vm.onInit()">\n            <md-option ng-value="\'\'">All</md-option>\n            <md-option value="DEFAULT PAUSE">DEFAULT PAUSE</md-option>\n            <md-option value="ACW">ACW</md-option>\n            <md-option value="LOGININPAUSE">LOGININPAUSE</md-option>\n            <md-option value="Auto-Pause">AUTOPAUSE</md-option>\n            <md-option ng-value="pause.name" ng-repeat="pause in vm.pauses.rows">{{pause.name}}</md-option>\n        </md-select>\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.order" md-on-reorder="vm.onInit">\n            <tr md-row border="1">\n                <th class="bv text-center" colspan="4">{{ \'SMS.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">{{ \'OPENCHANNEL.OPENCHANNEL\' | translate }}</th>\n                <th ng-if="vm.license.fax" class="bv bl text-center" colspan="2">{{ \'FAX.FAX\' | translate }}</th>\n                <th width="10px" class="bt bl" rowspan="2"></th>\n            </tr>\n            <tr md-row>\n                <th class="bl" md-column md-order-by="fullname">{{ \'SMS.NAME\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="globalStatus">{{ \'SMS.STATUS\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="lastLoginAt">{{ \'SMS.LOGIN_TIME\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="lastPauseAt">{{ \'SMS.PAUSE_TIME\' | translate }}</th>\n\n                <th class="bl custom-column">{{ \'VOICE.STATUS\' | translate }}</th>\n                <th class="bl custom-column">Info</th>\n\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\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\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\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\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            </tr>\n        </thead>\n        <tbody md-body>\n            <tr md-row ng-hide="vm.order.length">\n                <td md-cell colspan="17">\n                    <div layout="row" layout-align="center center">\n                        <span>{{ \'SMS.NO_AGENT_ONLINE\' | translate }}</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-select="vm.agents[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td class="bt padding-5">\n                    <div layout="row" layout-align="start center">\n                        <img class="avatar" ng-src="{{vm.agents[value].userpic && \'api/users/\'+vm.agents[value].id+\'/avatar\' || \'assets/images/avatars/profile.png\'}}">\n                        <div layout="column">\n                            <span>{{vm.agents[value].fullname}}</span>\n                            <span>{{vm.agents[value].internal}}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class="bt">\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'}[vm.agents[value].globalStatus]\">{{ vm.isPause(vm.agents[value].globalStatus) ? '' : vm.agents[value].globalStatus | uppercase }} {{ vm.isPause(vm.agents[value].globalStatus) ? (vm.isPartialPause(vm.agents[value].globalStatus) ? '*'+vm.agents[value].pauseType || 'DEFAULT PAUSE'  : vm.agents[value].pauseType || 'DEFAULT PAUSE') : ''}}</span>\n                </td>\n                <td class=\"bt custom-column\">\n                    <timer start-time=\"vm.agents[value].lastLoginAt\" interval=\"1000\">{{ days > 0 ? days + 'd' : '' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                </td>\n                <td class=\"bt custom-column\">\n                    <timer ng-if=\"vm.isPause(vm.agents[value].globalStatus) || vm.isPartialPause(vm.agents[value].globalStatus)\" start-time=\"vm.agents[value].lastPauseAt\" interval=\"1000\">{{ days > 0 ? days + 'd' : '' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                </td>\n                <td class=\"bt bl\">\n                    <div layout=\"row\">\n                        <span ng-if=\"!vm.agents[value].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'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].voiceStatus | uppercase }}</span>\n                        <span ng-if=\"vm.agents[value].onhold\" class=\"text-boxed md-background-bg bl bt padding-5 orange-400-bg\">ONHOLD</span>\n                    </div>\n                </td>\n                <td class=\"bt bl\">\n                    <div layout=\"column\">\n                        <span ng-if=\"vm.agents[value].queue\" class=\"padding-5\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].queue }}</span>\n                        <span ng-if=\"vm.agents[value].destconnectedlinenum\" class=\"padding-5\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].destconnectedlinenum }}</span>\n                        <span class=\"padding-5\" ng-if=\"vm.agents[value].queue || vm.agents[value].destconnectedlinenum\">\n                            <timer start-time=\"vm.agents[value].voiceStatusTime\" interval=\"1000\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                        </span>\n                    </div>\n                </td>\n                <td class=\"bt bl\" ng-if=\"vm.license.chat\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].chatStatus]\">{{ vm.agents[value].chatStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td md-number class=\"bt text-center font-size-20\" ng-if=\"vm.license.chat\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].chatStatus]\">{{ vm.agents[value].chatCurrentCapacity }}</td>\n                <td class=\"bl bt\" ng-if=\"vm.license.mail\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].mailStatus]\">{{ vm.agents[value].mailStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.mail\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].mailStatus]\">{{ vm.agents[value].mailCurrentCapacity }}</td>\n                <td class=\"bl bt\" ng-if=\"vm.license.messaging\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].smsStatus]\">{{ vm.agents[value].smsStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.messaging\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].smsStatus]\">{{ vm.agents[value].smsCurrentCapacity }}</td>\n                <td class=\"bt bl\" ng-if=\"vm.license.openchannel\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].openchannelStatus]\">{{ vm.agents[value].openchannelStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.openchannel\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].openchannelStatus]\">{{ vm.agents[value].openchannelCurrentCapacity }}</td>\n                <td class=\"bt bl\" ng-if=\"vm.license.fax\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].faxStatus]\">{{ vm.agents[value].faxStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.fax\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].faxStatus]\">{{ vm.agents[value].faxCurrentCapacity }}</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\n                        <md-menu-content width=\"4\">\n                            <md-menu-item>\n                                <md-button ng-click=\"vm.logout(vm.agents[value], $event)\" translate=\"SMS.LOGOUT\">\n                                    Logout\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-button ng-click=\"vm.queueAdd(vm.agents[value], $event)\" translate=\"SMS.AGENTADD_QUEUE\">\n                                    Add Agent In Queue\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-menu>\n                                    <md-button ng-click=\"$mdMenu.open()\" class=\"text-capitalize\" translate=\"SMS.PAUSE\">Pause</md-button>\n                                    <md-menu-content>\n                                        <md-menu-item>\n                                            <md-button ng-disabled=\" vm.agents[value].voicePause && 'DEFAULT PAUSE' === vm.agents[value].pauseType\" ng-click=\"vm.pause(vm.agents[value])\"><em translate=\"SMS.DEFAULT_PAUSE\">Default Pause</em></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=\"vm.agents[value].voicePause && pause.name === vm.agents[value].pauseType\" ng-click=\"vm.pause(vm.agents[value], pause.name)\">{{pause.name}}</md-button>\n                                        </md-menu-item>\n                                    </md-menu-content>\n                                </md-menu>\n                            </md-menu-item>\n                            <md-menu-item ng-if=\"vm.isPause(vm.agents[value].globalStatus)\">\n                                <md-button ng-click=\"vm.unPause(vm.agents[value])\" translate=\"SMS.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\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.filteredAgents.length}}\" md-on-paginate=\"vm.onInit\" md-page-select></md-table-pagination>\n\x3c!-- / AGENT TABLE --\x3e\n\x3c!-- / MAIN --\x3e"),e.put("app/main/apps/sms/views/realtime/queues/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="SMS.QUEUES">Queues</span>\n        <div flex></div>\n        <ms-search-bar on-search="vm.query.filter = 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">{{ \'SMS.NAME\' | translate }}</th>\n                <th md-column>{{ \'SMS.LOGGED_IN\' | translate }}</th>\n                <th md-column>{{ \'SMS.PAUSED\' | translate }}</th>\n                <th md-column>{{ \'SMS.READY\' | translate }}</th>\n                <th md-column>{{ \'SMS.WAITING\' | translate }}</th>\n                <th md-column width="10px"></th>\n            </tr>\n        </thead>\n        <tbody md-body>\n            <tr md-row ng-hide="vm.queues">\n                <td md-cell colspan="7">\n                    <div layout="row" layout-align="center center">\n                        <span tranlsate="SMS.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-row md-select="vm.queues[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td md-cell>{{vm.queues[value].name}}</td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].loggedInDb || 0}} ({{vm.queues[value].loggedIn || 0}})</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].paused || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-16 grey-fg">{{vm.queues[value].available || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].waiting || 0}}</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="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.createOrEditSmsQueue($event, vm.queues[value])" translate="SMS.EDIT_QUEUE">\n                                    Edit Queue\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-button ng-click="vm.agentAdd($event, vm.queues[value])" translate="SMS.AGENTSADD_QUEUE">\n                                    Add Agents to queue\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: \'{{\'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.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/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 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="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" 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="\'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\'" 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\'">\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\'" 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 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"></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 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="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" 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/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 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="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="1">One Time</md-option>\n                    <md-option ng-value="0">Always</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" md-maxlength="255" 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 ng-message="md-maxlength">\n                        <span translate="SMS.ERRORS.TEXT_MAX_LENGTH" translate-values=\'{max: 255}\'>Text 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/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 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="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/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 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="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 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="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="inboundroute-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 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\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 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="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 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="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" 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 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="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 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="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 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="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/smsDispositions/dialog.html",'<md-dialog class="smsDisposition-dialog" aria-label="New SmsDisposition">\n    <form name="smsDispositionForm" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="SMS.NAME">Name</label>\n                <input type="" name="name" ng-model="vm.smsDisposition.name" ng-required="true" autofocus>\n\n                <div ng-messages="smsDispositionForm[\'name\'].$error" ng-show="smsDispositionForm[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.newSmsDisposition" ng-click="vm.saveSmsDisposition()" class="send-button md-accent md-raised" ng-disabled="smsDispositionForm.$invalid || smsDispositionForm.$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.newSmsDisposition" ng-click="vm.addNewSmsDisposition()" class="send-button md-accent md-raised" ng-disabled="smsDispositionForm.$invalid" aria-label="ADD" translate="SMS.ADD_SMSDISPOSITION" translate-attr-aria-label="SMS.ADD_SMSDISPOSITION">\n                    ADD SMSDISPOSITION\n                </md-button>\n            </div>\n            <div layout="row">\n                <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSmsDisposition" ng-click="vm.deleteSmsDisposition($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="\'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\'" 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\'">\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\'" 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 == \'skebby\' && vm.smsAccount.smsMethod == \'GP\') || 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" 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="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" 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, 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" 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" 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" 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 class="smsAccount-detail-form-container smsdispositions md-background-bg md-whiteframe-1dp">\n                        <div ng-controller="SmsAccountSmsDispositionsController as vm_dc" ng-init="vm_dc.init(vm.smsAccount, vm.crudPermissions)">\n                            <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedSmsAccountSmsDispositions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead" translate="SMS.SMSDISPOSITIONS">SmsDispositions</span>\n                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\n                                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditSmsAccountSmsDisposition($event)" aria-label="add smsDisposition" translate translate-attr-label="SMS.ADD_SMSDISPOSITION">\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.selectedSmsAccountSmsDispositions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead">{{vm_dc.selectedSmsAccountSmsDispositions.length}} {{vm_dc.selectedSmsAccountSmsDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                                    <div flex></div>\n                                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedSmsAccountSmsDispositions" 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.deleteSelectedSmsAccountSmsDispositions($event)" aria-label="delete selected" translate translate-attr-label="SMSACCOUNTS.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.selectedSmsAccountSmsDispositions" md-progress="vm_dc.promise">\n                                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getSmsAccountSmsDispositions">\n                                        <tr md-row>\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="createdAt">{{ \'SMS.CREATED_AT\' | translate }}</th>\n                                            <th md-column width="10px"></th>\n                                        </tr>\n                                    </thead>\n                                    <tbody md-body>\n                                        <tr md-row md-select="smsDisposition" md-select-id="id" ng-repeat="smsDisposition in vm_dc.smsAccountSmsDispositions.rows">\n                                            <td ng-click="vm_dc.createOrEditSmsAccountSmsDisposition($event, smsDisposition)" md-cell>{{smsDisposition.id}}</td>\n                                            <td ng-click="vm_dc.createOrEditSmsAccountSmsDisposition($event, smsDisposition)" md-cell>{{smsDisposition.name}}</td>\n                                            <td ng-click="vm_dc.createOrEditSmsAccountSmsDisposition($event, smsDisposition)" md-cell>{{smsDisposition.createdAt | date:\'medium\'}}</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.createOrEditSmsAccountSmsDisposition($event, smsDisposition)" translate="SMS.EDIT_SMSDISPOSITION">\n                                                                Edit SmsDisposition\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(smsDisposition, $event)" translate="SMS.DELETE_SMSDISPOSITION">\n                                                                Delete SmsDisposition\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.smsAccountSmsDispositions.rows.length">\n                                            <td md-cell colspan="5">\n                                                <span class="text-boxed-ligth" translate="SMS.NO_SMSDISPOSITION_AVAILABLE">No smsdisposition available</span>\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.smsAccountSmsDispositions.count}}" md-on-paginate="vm_dc.getSmsAccountSmsDispositions" 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.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)">\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                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="SMSACCOUNTS.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.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">{{ \'SMS.ID\' | translate }}</th>\n                                            <th md-column md-order-by="key">{{ \'SMS.KEY\' | translate }}</th>\n                                            <th md-column md-order-by="value">{{ \'SMS.VALUE\' | translate }}</th>\n                                            <th md-column md-order-by="description">{{ \'SMS.DESCRIPTION\' | translate }}</th>\n                                            <th md-column md-order-by="createdAt">{{ \'SMS.CREATED_AT\' | translate }}</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>{{smsCannedAnswer.id}}</td>\n                                            <td ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" md-cell>{{smsCannedAnswer.key}}</td>\n                                            <td ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" md-cell>{{smsCannedAnswer.value}}</td>\n                                            <td ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" md-cell>{{smsCannedAnswer.description}}</td>\n                                            <td ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" md-cell>{{smsCannedAnswer.createdAt | date:\'medium\'}}</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                                                <span class="text-boxed-ligth" translate="SMS.NO_SMSCANNEDANSWER_AVAILABLE">No smscannedanswer available</span>\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" ms-scroll 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.alias || a.appType) | uppercase}}">{{a.alias || 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" ms-scroll 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" style="width:200px">{{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-ligth" 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)">\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                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="SMSACCOUNTS.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.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">{{ \'SMS.ID\' | translate }}</th>\n                                            <th md-column md-order-by="createdAt">{{ \'SMS.STARTEDAT\' | translate }}</th>\n                                            <th md-column>{{ \'SMS.CONTACT\' | translate }}</th>\n                                            <th md-column>{{ \'SMS.AGENT\' | translate }}</th>\n                                            <th md-column md-order-by="closedAt">{{ \'SMS.CLOSEDAT\' | translate }}</th>\n                                            <th md-column md-order-by="disposition">{{ \'SMS.DISPOSITION\' | translate }}</th>\n                                            <th md-column md-order-by="note">{{ \'SMS.NOTES\' | translate }}</th>\n                                            <th md-column md-order-by="tag">{{ \'SMS.TAGS\' | translate }}</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">\n                                            <td md-cell>{{interaction.id}}</td>\n                                            <td md-cell>{{interaction.createdAt | date:\'medium\'}}</td>\n                                            <td md-cell>{{interaction.Contact.firstName}}</td>\n                                            <td md-cell>{{interaction.Owner.name}}</td>\n                                            <td md-cell>{{interaction.closedAt | date:\'medium\'}}</td>\n                                            <td md-cell>{{interaction.disposition}}</td>\n                                            <td md-cell>{{interaction.note}}</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"></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>\n                                                            <md-button class="md-primary" ng-click="vm_dc.smsInteractionDownload(interaction, $event)" translate="SMS.DOWNLOAD_INTERACTION">\n                                                                Download Interaction\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="13">\n                                                <span class="text-boxed-ligth" translate="SMS.NO_INTERACTION_AVAILABLE">No interaction available</span>\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 animate-slide-down 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="SMSACCOUNTS.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="SMSACCOUNTS.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!-- 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})[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                                <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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(smsAccount, $event)" translate="SMS.EDIT_SMSACCOUNT">\n                                                    Edit SmsAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.interactionsgoto(smsAccount, $event)" translate="SMS.INTERACTIONS_SMSACCOUNT">\n                                                    Interactions SmsAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.agentadddialog(smsAccount, $event)" translate="SMS.AGENTADD_SMSACCOUNT">\n                                                    AgentAdd SmsAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(smsAccount, $event)" translate="SMS.DELETE_SMSACCOUNT">\n                                                    Delete SmsAccount\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: \'{{\'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 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="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" 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"></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"></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" 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 animate-slide-down 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="SMSQUEUES.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="SMSQUEUES.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!-- 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                                <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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(smsQueue, $event)" translate="SMS.EDIT_SMSQUEUE">\n                                                    Edit SmsQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.teamadddialog(smsQueue, $event)" translate="SMS.TEAMADD_SMSQUEUE">\n                                                    teamadd SmsQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.agentadddialog(smsQueue, $event)" translate="SMS.AGENTADD_SMSQUEUE">\n                                                    agentadd SmsQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(smsQueue, $event)" translate="SMS.DELETE_SMSQUEUE">\n                                                    Delete SmsQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.gotorealtimegoto(smsQueue, $event)" translate="SMS.GOTOREALTIME_SMSQUEUE">\n                                                    goToRealtime SmsQueue\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: \'{{\'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\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.AGENTS">Agents</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.selectedAgents.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.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\n        <div flex layout="row" layout-align="space-between center">\n\n            <div>\n                <span class="selected-agents-count">\n                    <span>{{vm.selectedAgents.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="AGENTS.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\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="AGENTS.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!-- 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 ng-if="vm.table == \'users\' || vm.table == \'agents\'" 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 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="8">\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 && (vm.table == \'users\' || vm.table == \'agents\')"><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 ">{{ vm.arrayshowWebBar[agent.showWebBar].option }}</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 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                                            <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                                            <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                                            <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\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\n            \x3c!-- / NO RESULTS --\x3e\n        </div>\n        \x3c!-- / MAIN --\x3e\n\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 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="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\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\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 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" 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 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" 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.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>\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                    <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\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" ng-model="vm.penalty" placeholder="0" required md-minlength="0" md-maxlength="3">\n                <div ng-messages="agentForm.penalty.$error" role="alert" multiple>\n                    <div ng-message="required">\n                        <span>You must supply a penalty.</span>\n                    </div>\n                    <div ng-message="md-minlength">\n                        <span>Min Penalty 0 characters.</span>\n                    </div>\n                    <div ng-message="md-maxlength">\n                        <span>Max Penalty 3 characters.</span>\n                    </div>\n                </div>\n            </md-input-container>\n            <ms-dual-multiselect options="vm.dualMultiselectOptions"></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"></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\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\n            <div layout="row" layout-align="start center">\n\n                <div class="agent-image" hide-xs>\n                    <img ng-src="assets/images/business/agents.jpg">\n                </div>\n\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-fab-actions>\n            </md-fab-speed-dial>\n        </div>\n\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\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) || (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.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\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\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\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\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\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\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\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\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\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\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\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\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\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="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\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\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\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\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\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\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\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\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\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\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.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\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.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\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\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\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" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\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" class="md-block">\n                                <md-switch ng-model="vm.agent.phoneBarEnableVideoRecording" aria-label="EnableVideoRecording" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLEVIDEORECORDING">EnableVideoRecording</span></md-switch>\n                            </md-input-container>\n\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" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\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\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\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\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\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\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\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\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\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                                <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" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\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\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\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\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.phoneBarPrefixRequired" aria-label="PrefixRequired" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.PREFIXREQUIRED">PrefixRequired</span></md-switch>\n                            </md-input-container>\n\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\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\n      <md-divider></md-divider>\n\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\n                            <span ng-if="vm_pc.agent.role === \'admin\'" class="md-headline" translate="STAFF.ALL_MODULES_AVAILABLE">All modules are already available.</span>\n\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/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 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="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"></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 animate-slide-down 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="TEAMS.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="TEAMS.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!-- 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                                <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                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editdialog(team, $event)" translate="STAFF.EDIT_TEAM">\n                                                    Edit Team\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.agentadddialog(team, $event)" translate="STAFF.AGENTADD_TEAM">\n                                                    AgentAdd Team\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(team, $event)" translate="STAFF.DELETE_TEAM">\n                                                    Delete Team\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: \'{{\'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 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="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 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" 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.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>\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                    <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\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 animate-slide-down 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="TELEPHONES.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="TELEPHONES.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!-- 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                                <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="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                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(telephone, $event)" translate="STAFF.EDIT_TELEPHONE">\n                                                    Edit Telephone\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(telephone, $event)" translate="STAFF.DELETE_TELEPHONE">\n                                                    Delete Telephone\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: \'{{\'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 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="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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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 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="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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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)" 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\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="2:1" md-row-height-gt-md="3:1" gt-xs-gutter="4px" gt-sm-gutter="8px" gt-md-gutter="8px" 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-icon>\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-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 animate-slide-down 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="USERPROFILES.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="USERPROFILES.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!-- 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 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="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="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 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                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(userProfile, $event)" translate="STAFF.EDIT_USERPROFILE">\n                                                    Edit UserProfile\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.clonedialog(userProfile, $event)" translate="STAFF.CLONE_USERPROFILE">\n                                                    clone UserProfile\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.deleteconfirm(userProfile, $event)" translate="STAFF.DELETE_USERPROFILE">\n                                                    Delete UserProfile\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: \'{{\'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 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="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\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\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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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-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="STAFF.GENERATE" 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 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" 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.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>\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                    <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\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\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\n            <div layout="row" layout-align="start center">\n\n                <div class="user-image" hide-xs>\n                    <img ng-src="assets/images/business/users.jpg">\n                </div>\n\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\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\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\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="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\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\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\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\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\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\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\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\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\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: 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-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\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\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\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="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\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\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\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\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\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.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: 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-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 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\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/users/users.html",'<div id="users" 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.USERS">Users</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.selectedUsers.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.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\n        <div flex layout="row" layout-align="space-between center">\n\n            <div>\n                <span class="selected-users-count">\n                    <span>{{vm.selectedUsers.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="USERS.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\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\n        \x3c!-- MAIN --\x3e\n        <div class="main scrollable" ms-scroll>\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 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="9">\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 && (vm.table == \'users\' || vm.table == \'agents\')"><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})[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 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                                            <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                                            <md-menu-item>\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\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\n            \x3c!-- / NO RESULTS --\x3e\n        </div>\n        \x3c!-- / MAIN --\x3e\n\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 animate-slide-down 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="CANNEDANSWERS.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="CANNEDANSWERS.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!-- 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                                <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                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editdialog(cannedAnswer, $event)" translate="TOOLS.EDIT_CANNEDANSWER">\n                                                    Edit CannedAnswer\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(cannedAnswer, $event)" translate="TOOLS.DELETE_CANNEDANSWER">\n                                                    Delete CannedAnswer\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: \'{{\'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 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.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/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 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.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 animate-slide-down 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="CUSTOMDASHBOARDS.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="CUSTOMDASHBOARDS.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!-- 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                                <td md-cell class="actions">\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.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(customDashboard, $event)" translate="TOOLS.EDIT_CUSTOMDASHBOARD">\n                                                    Edit CustomDashboard\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.clonedialog(customDashboard, $event)" translate="TOOLS.CLONE_CUSTOMDASHBOARD">\n                                                    clone CustomDashboard\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.gotodashboardgoto(customDashboard, $event)" translate="TOOLS.GOTODASHBOARD_CUSTOMDASHBOARD">\n                                                    goToDashboard CustomDashboard\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(customDashboard, $event)" translate="TOOLS.DELETE_CUSTOMDASHBOARD">\n                                                    Delete CustomDashboard\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: \'{{\'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 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.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 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.TYPE">Type</label>\n                <md-select name="type" ng-model="vm.dashboarditem.type" 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 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 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" 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" 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\'"> {{ \'TOOLS.ABANDONED\' | translate }} </md-option>\n\n                    <md-option ng-value="\'waiting\'"> {{ \'TOOLS.WAITING\' | translate }} </md-option>\n\n                    <md-option ng-value="\'talking\'"> {{ \'TOOLS.TALKING\' | translate }} </md-option>\n\n                    <md-option ng-value="\'answered\'"> {{ \'TOOLS.ANSWERED\' | translate }} </md-option>\n\n                    <md-option ng-value="\'unmanaged\'"> {{ \'TOOLS.UNMANAGED\' | 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\'"> {{ \'TOOLS.ABANDONED\' | translate }} </md-option>\n\n                    <md-option ng-value="\'waiting\'"> {{ \'TOOLS.WAITING\' | translate }} </md-option>\n\n                    <md-option ng-value="\'talking\'"> {{ \'TOOLS.TALKING\' | translate }} </md-option>\n\n                    <md-option ng-value="\'answered\'"> {{ \'TOOLS.ANSWERED\' | 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\'"> {{ \'TOOLS.ABANDONED\' | translate }} </md-option>\n\n                    <md-option ng-value="\'waiting\'"> {{ \'TOOLS.WAITING\' | translate }} </md-option>\n\n                    <md-option ng-value="\'talking\'"> {{ \'TOOLS.TALKING\' | translate }} </md-option>\n\n                    <md-option ng-value="\'answered\'"> {{ \'TOOLS.ANSWERED\' | 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\'"> {{ \'TOOLS.ABANDONED\' | translate }} </md-option>\n\n                    <md-option ng-value="\'waiting\'"> {{ \'TOOLS.WAITING\' | translate }} </md-option>\n\n                    <md-option ng-value="\'talking\'"> {{ \'TOOLS.TALKING\' | translate }} </md-option>\n\n                    <md-option ng-value="\'answered\'"> {{ \'TOOLS.ANSWERED\' | 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" 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="[\'multibar-chart\', \'pie-chart\', \'counter\'].includes(vm.dashboarditem.type)" 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 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" 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" ms-scroll>\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" ms-scroll>\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 tranlsate="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 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.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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.disposition.name" md-maxlength="255" ng-required="true" autofocus>\n\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 equal to 255</span>\n                    </div>\n                </div>\n            </md-input-container>\n\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.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\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\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.DISPOSITIONS">Dispositions</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.selectedDispositions.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.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\n        <div flex layout="row" layout-align="space-between center">\n\n            <div>\n                <span class="selected-dispositions-count">\n                    <span>{{vm.selectedDispositions.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="DISPOSITIONS.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\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="DISPOSITIONS.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!-- DISPOSITION TABLE --\x3e\n            <md-card>\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 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 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="3">\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 md-cell ng-if="disposition.userpic"><img class="avatar" alt="{{disposition.name}}" ng-src="api/users/{{disposition.id}}/avatar" /></td>\n                                <td md-cell ng-if="!disposition.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{disposition.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                                <td ng-click="vm.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}</td>\n                                <td ng-click="vm.createOrEditDisposition($event, disposition)" md-cell class="name ">{{disposition.name}}</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                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editdialog(disposition, $event)" translate="TOOLS.EDIT_DISPOSITION">\n                                                    Edit Disposition\n                                                </md-button>\n                                            </md-menu-item>\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\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></md-table-pagination>\n            </md-card>\n            \x3c!-- / DISPOSITION 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 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 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.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="inboundroute-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 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            <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 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="" 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                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="INTERVALS.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.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">{{ \'TOOLS.ID\' | translate }}</th>\n                                            <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                                            <th md-column md-order-by="interval">{{ \'TOOLS.INTERVAL\' | translate }}</th>\n                                            <th md-column md-order-by="createdAt">{{ \'TOOLS.CREATED_AT\' | translate }}</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>{{interval.id}}</td>\n                                            <td ng-click="vm_dc.createOrEditIntervalInterval($event, interval)" md-cell>{{interval.name}}</td>\n                                            <td ng-click="vm_dc.createOrEditIntervalInterval($event, interval)" md-cell>{{interval.interval}}</td>\n                                            <td ng-click="vm_dc.createOrEditIntervalInterval($event, interval)" md-cell>{{interval.createdAt | date:\'medium\'}}</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                                                <span class="text-boxed-ligth" translate="TOOLS.NO_INTERVALS_AVAILABLE">No intervals available</span>\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 animate-slide-down 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="INTERVALS.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="INTERVALS.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!-- 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                                <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                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(interval, $event)" translate="TOOLS.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.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                        </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 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.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 animate-slide-down 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="PAUSES.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="PAUSES.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!-- 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                                <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                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editdialog(pause, $event)" translate="TOOLS.EDIT_PAUSE">\n                                                    Edit Pause\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(pause, $event)" translate="TOOLS.DELETE_PAUSE">\n                                                    Delete Pause\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: \'{{\'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 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.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" 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" ms-scroll>\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" ms-scroll>\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 tranlsate="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 animate-slide-down 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="SCHEDULER.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="SCHEDULER.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!-- 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                                <td md-cell class="actions">\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.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editdialog(schedule, $event)" translate="TOOLS.EDIT_SCHEDULE">\n                                                    Edit Schedule\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.runconfirm(schedule, $event)" translate="TOOLS.RUN_SCHEDULE">\n                                                    Run Schedule\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(schedule, $event)" translate="TOOLS.DELETE_SCHEDULE">\n                                                    Delete Schedule\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: \'{{\'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 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.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 animate-slide-down 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="SOUNDS.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="SOUNDS.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!-- 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                                <td md-cell class="actions">\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.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editdialog(sound, $event)" translate="TOOLS.EDIT_SOUND">\n                                                    Edit Sound\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.downloadfile2(sound, $event)" translate="TOOLS.DOWNLOAD_SOUND">\n                                                    Download Sound\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(sound, $event)" translate="TOOLS.DELETE_SOUND">\n                                                    Delete Sound\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: \'{{\'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 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 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 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.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 animate-slide-down 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="TAGS.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="TAGS.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!-- 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                                <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                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editdialog(tag, $event)" translate="TOOLS.EDIT_TAG">\n                                                    Edit Tag\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(tag, $event)" translate="TOOLS.DELETE_TAG">\n                                                    Delete Tag\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: \'{{\'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 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.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, 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 animate-slide-down 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="TEMPLATES.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="TEMPLATES.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!-- 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                                <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                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editdialog(template, $event)" translate="TOOLS.EDIT_TEMPLATE">\n                                                    Edit Template\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(template, $event)" translate="TOOLS.DELETE_TEMPLATE">\n                                                    Delete Template\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: \'{{\'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.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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.trigger.name" ng-required="true" autofocus>\n\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\n                    <md-option ng-value="\'voice\'"> {{ \'TOOLS.VOICE\' | translate }} </md-option>\n\n                    <md-option ng-value="\'openchannel\'" ng-if="vm.license.openchannel"> {{ \'TOOLS.OPENCHANNEL\' | translate }} </md-option>\n\n                    <md-option ng-value="\'chat\'" ng-if="vm.license.chat"> {{ \'TOOLS.CHAT\' | translate }} </md-option>\n\n                    <md-option ng-value="\'mail\'" ng-if="vm.license.mail"> {{ \'TOOLS.MAIL\' | translate }} </md-option>\n\n                    <md-option ng-value="\'sms\'" ng-if="vm.license.messaging"> {{ \'TOOLS.SMS\' | translate }} </md-option>\n\n                    <md-option ng-value="\'fax\'" ng-if="vm.license.fax"> {{ \'TOOLS.FAX\' | 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></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\n                <div ng-messages="triggerForm[\'description\'].$error" ng-show="triggerForm[\'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.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\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/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.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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.ACTION">Action</label>\n                <md-select name="action" ng-model="vm.action.action" ng-init="vm.onActionInit()" autofocus required ng-disabled="!vm.newAction">\n\n                    <md-option ng-value="\'contactManager\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.CONTACT_MANAGER\' | translate }} </md-option>\n\n                    <md-option ng-value="\'integration\'" ng-if="vm.trigger.channel == \'voice\' && ((vm.newAction && vm.hasModulePermissions.Integrations) || !vm.newAction)"> {{ \'TOOLS.INTEGRATIONS\' | translate }} </md-option>\n\n                    <md-option ng-value="\'motionbar\'"> {{ \'TOOLS.MOTION_BAR\' | translate }} </md-option>\n\n                    <md-option ng-value="\'jscripty\'"> {{ \'TOOLS.JSCRIPTY\' | translate }} </md-option>\n\n                    <md-option ng-value="\'urlForward\'"> {{ \'TOOLS.URL_FORWARD\' | translate }} </md-option>\n\n                    <md-option ng-value="\'browser\'"> {{ \'TOOLS.BROWSER\' | translate }} </md-option>\n\n                    <md-option ng-value="\'bot\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.BOT\' | 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">{{ 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" 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" required>\n                    <md-option ng-value="\'\'+data1.id" ng-repeat="data1 in vm.lists" ng-disabled="data1.canSelect === false">{{ 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.AUTOCREATECONTACT">AutoCreateContact</label>\n                <md-select name="data2" ng-model="vm.action.data2" required>\n\n                    <md-option ng-value="\'1\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n\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 == \'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-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\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\' && vm.action.data1 == \'POST\'" 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 == \'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()" required>\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="\'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="\'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="\'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="\'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="\'zoho\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1307]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1307])">Zoho</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="\'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="\'servicenow\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1310]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1310])">ServiceNow</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 == \'zendesk\'" class="md-block">\n                <label translate="TOOLS.ACCOUNT">Account</label>\n                <md-select name="data2" ng-model="vm.action.data2" required ng-disabled="!vm.newAction && (!vm.newAction && !vm.hasSectionPermissions[1301])">\n                    <md-option ng-value="\'\'+data2.id" ng-repeat="data2 in vm.zendeskAccounts" ng-disabled="data2.canSelect === false">{{ 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 == \'desk\'" class="md-block">\n                <label translate="TOOLS.ACCOUNT">Account</label>\n                <md-select name="data2" ng-model="vm.action.data2" required ng-disabled="!vm.newAction && (!vm.newAction && !vm.hasSectionPermissions[1306])">\n                    <md-option ng-value="\'\'+data2.id" ng-repeat="data2 in vm.deskAccounts" ng-disabled="data2.canSelect === false">{{ 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 == \'zoho\'" class="md-block">\n                <label translate="TOOLS.ACCOUNT">Account</label>\n                <md-select name="data2" ng-model="vm.action.data2" required ng-disabled="!vm.newAction && (!vm.newAction && !vm.hasSectionPermissions[1307])">\n                    <md-option ng-value="\'\'+data2.id" ng-repeat="data2 in vm.zohoAccounts" ng-disabled="data2.canSelect === false">{{ 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 == \'salesforce\'" class="md-block">\n                <label translate="TOOLS.ACCOUNT">Account</label>\n                <md-select name="data2" ng-model="vm.action.data2" required ng-disabled="!vm.newAction && (!vm.newAction && !vm.hasSectionPermissions[1302])">\n                    <md-option ng-value="\'\'+data2.id" ng-repeat="data2 in vm.salesforceAccounts" ng-disabled="data2.canSelect === false">{{ 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 == \'sugarcrm\'" class="md-block">\n                <label translate="TOOLS.ACCOUNT">Account</label>\n                <md-select name="data2" ng-model="vm.action.data2" required ng-disabled="!vm.newAction && (!vm.newAction && !vm.hasSectionPermissions[1305])">\n                    <md-option ng-value="\'\'+data2.id" ng-repeat="data2 in vm.sugarcrmAccounts" ng-disabled="data2.canSelect === false">{{ 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 == \'freshdesk\'" class="md-block">\n                <label translate="TOOLS.ACCOUNT">Account</label>\n                <md-select name="data2" ng-model="vm.action.data2" required ng-disabled="!vm.newAction && (!vm.newAction && !vm.hasSectionPermissions[1303])">\n                    <md-option ng-value="\'\'+data2.id" ng-repeat="data2 in vm.freshdeskAccounts" ng-disabled="data2.canSelect === false">{{ 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 == \'vtiger\'" class="md-block">\n                <label translate="TOOLS.ACCOUNT">Account</label>\n                <md-select name="data2" ng-model="vm.action.data2" required ng-disabled="!vm.newAction && (!vm.newAction && !vm.hasSectionPermissions[1308])">\n                    <md-option ng-value="\'\'+data2.id" ng-repeat="data2 in vm.vtigerAccounts" ng-disabled="data2.canSelect === false">{{ 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 == \'dynamics365\'" class="md-block">\n                <label translate="TOOLS.ACCOUNT">Account</label>\n                <md-select name="data2" ng-model="vm.action.data2" required ng-disabled="!vm.newAction && (!vm.newAction && !vm.hasSectionPermissions[1309])">\n                    <md-option ng-value="\'\'+data2.id" ng-repeat="data2 in vm.dynamics365Accounts" ng-disabled="data2.canSelect === false">{{ 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 == \'servicenow\'" class="md-block">\n                <label translate="TOOLS.ACCOUNT">Account</label>\n                <md-select name="data2" ng-model="vm.action.data2" required ng-disabled="!vm.newAction && (!vm.newAction && !vm.hasSectionPermissions[1310])">\n                    <md-option ng-value="\'\'+data2.id" ng-repeat="data2 in vm.servicenowAccounts" ng-disabled="data2.canSelect === false">{{ 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 == \'zendesk\' && 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.newAction && (!vm.newAction && !vm.hasSectionPermissions[1301])">\n                    <md-option ng-value="\'\'+data3.id" ng-repeat="data3 in vm.zendeskConfigurations | filter:{AccountId:vm.action.data2}" ng-disabled="data3.canSelect === false">{{ 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 == \'integration\' && vm.action.data1 == \'desk\' && 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.newAction && (!vm.newAction && !vm.hasSectionPermissions[1306])">\n                    <md-option ng-value="\'\'+data3.id" ng-repeat="data3 in vm.deskConfigurations | filter:{AccountId:vm.action.data2}" ng-disabled="data3.canSelect === false">{{ 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 == \'integration\' && vm.action.data1 == \'zoho\' && 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.newAction && (!vm.newAction && !vm.hasSectionPermissions[1307])">\n                    <md-option ng-value="\'\'+data3.id" ng-repeat="data3 in vm.zohoConfigurations | filter:{AccountId:vm.action.data2}" ng-disabled="data3.canSelect === false">{{ 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 == \'integration\' && vm.action.data1 == \'salesforce\' && 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.newAction && (!vm.newAction && !vm.hasSectionPermissions[1302])">\n                    <md-option ng-value="\'\'+data3.id" ng-repeat="data3 in vm.salesforceConfigurations | filter:{AccountId:vm.action.data2}" ng-disabled="data3.canSelect === false">{{ 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 == \'integration\' && vm.action.data1 == \'sugarcrm\' && 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.newAction && (!vm.newAction && !vm.hasSectionPermissions[1305])">\n                    <md-option ng-value="\'\'+data3.id" ng-repeat="data3 in vm.sugarcrmConfigurations | filter:{AccountId:vm.action.data2}" ng-disabled="data3.canSelect === false">{{ 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 == \'integration\' && vm.action.data1 == \'freshdesk\' && 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.newAction && (!vm.newAction && !vm.hasSectionPermissions[1303])">\n                    <md-option ng-value="\'\'+data3.id" ng-repeat="data3 in vm.freshdeskConfigurations | filter:{AccountId:vm.action.data2}" ng-disabled="data3.canSelect === false">{{ 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 == \'integration\' && vm.action.data1 == \'vtiger\' && 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.newAction && (!vm.newAction && !vm.hasSectionPermissions[1308])">\n                    <md-option ng-value="\'\'+data3.id" ng-repeat="data3 in vm.vtigerConfigurations | filter:{AccountId:vm.action.data2}" ng-disabled="data3.canSelect === false">{{ 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 == \'integration\' && vm.action.data1 == \'dynamics365\' && 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.newAction && (!vm.newAction && !vm.hasSectionPermissions[1309])">\n                    <md-option ng-value="\'\'+data3.id" ng-repeat="data3 in vm.dynamics365Configurations | filter:{AccountId:vm.action.data2}" ng-disabled="data3.canSelect === false">{{ 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 == \'integration\' && vm.action.data1 == \'servicenow\' && 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.newAction && (!vm.newAction && !vm.hasSectionPermissions[1310])">\n                    <md-option ng-value="\'\'+data3.id" ng-repeat="data3 in vm.servicenowConfigurations | filter:{AccountId:vm.action.data2}" ng-disabled="data3.canSelect === false">{{ 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" 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\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\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\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">{{ 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">{{ 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\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\n                    <md-option ng-value="\'1\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n\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>\n\n                    <md-option ng-value="\'0\'"> {{ \'TOOLS.NEW_TAB\' | translate }} </md-option>\n\n                    <md-option ng-value="\'1\'"> {{ \'TOOLS.NEW_WINDOW\' | 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\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\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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.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\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/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.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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.FIELD">Field</label>\n                <md-select name="field" ng-model="vm.allCondition.field" autofocus required>\n\n                    <md-option ng-value="\'queue\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.QUEUE\' | translate }} </md-option>\n\n                    <md-option ng-value="\'lastevent\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.CALL_STATUS\' | translate }} </md-option>\n\n                    <md-option ng-value="\'routeId\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.OUTBOUNDROUTE\' | translate }} </md-option>\n\n                    <md-option ng-value="\'account\'" ng-if="vm.trigger.channel != \'voice\'"> {{ \'TOOLS.ACCOUNT\' | translate }} </md-option>\n\n                    <md-option ng-value="\'interaction\'" ng-if="vm.trigger.channel != \'voice\'"> {{ \'TOOLS.INTERACTION\' | translate }} </md-option>\n\n                    <md-option ng-value="\'message\'" ng-if="vm.trigger.channel != \'voice\'"> {{ \'TOOLS.MESSAGE\' | translate }} </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\n                    <md-option ng-value="\'equals\'"> {{ \'TOOLS.EQUALS\' | translate }} </md-option>\n\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\' && vm.trigger.channel == \'chat\'" 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" ng-repeat="value in vm.chatAccounts" ng-disabled="value.canSelect === false">{{ 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 == \'account\' && vm.trigger.channel == \'mail\'" 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" ng-repeat="value in vm.mailAccounts" ng-disabled="value.canSelect === false">{{ 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 == \'account\' && vm.trigger.channel == \'sms\'" 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" ng-repeat="value in vm.smsAccounts" ng-disabled="value.canSelect === false">{{ 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 == \'account\' && vm.trigger.channel == \'fax\'" 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" ng-repeat="value in vm.faxAccounts" ng-disabled="value.canSelect === false">{{ 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 == \'account\' && vm.trigger.channel == \'openchannel\'" 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" ng-repeat="value in vm.openchannelAccounts" ng-disabled="value.canSelect === false">{{ 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">{{ 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" ng-repeat="value in vm.outboundRoutes" ng-disabled="value.canSelect === false">{{ 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 == \'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="\'abandoned\'">Abandon</md-option>\n                    <md-option ng-value="\'complete\'">Hangup</md-option>\n                    <md-option ng-value="\'rejected\'">Reject</md-option>\n                    <md-option ng-value="\'called\'">Ring</md-option>\n                    <md-option ng-value="\'connect\'">Answer</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-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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.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\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/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.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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.FIELD">Field</label>\n                <md-select name="field" ng-model="vm.anyCondition.field" autofocus required>\n\n                    <md-option ng-value="\'queue\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.QUEUE\' | translate }} </md-option>\n\n                    <md-option ng-value="\'lastevent\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.CALL_STATUS\' | translate }} </md-option>\n\n                    <md-option ng-value="\'routeId\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.OUTBOUNDROUTE\' | translate }} </md-option>\n\n                    <md-option ng-value="\'account\'" ng-if="vm.trigger.channel != \'voice\'"> {{ \'TOOLS.ACCOUNT\' | translate }} </md-option>\n\n                    <md-option ng-value="\'interaction\'" ng-if="vm.trigger.channel != \'voice\'"> {{ \'TOOLS.INTERACTION\' | translate }} </md-option>\n\n                    <md-option ng-value="\'message\'" ng-if="vm.trigger.channel != \'voice\'"> {{ \'TOOLS.MESSAGE\' | translate }} </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\n                    <md-option ng-value="\'equals\'"> {{ \'TOOLS.EQUALS\' | translate }} </md-option>\n\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\' && vm.trigger.channel == \'chat\'" 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" ng-repeat="value in vm.chatAccounts" ng-disabled="value.canSelect === false">{{ 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 == \'account\' && vm.trigger.channel == \'mail\'" 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" ng-repeat="value in vm.mailAccounts" ng-disabled="value.canSelect === false">{{ 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 == \'account\' && vm.trigger.channel == \'sms\'" 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" ng-repeat="value in vm.smsAccounts" ng-disabled="value.canSelect === false">{{ 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 == \'account\' && vm.trigger.channel == \'fax\'" 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" ng-repeat="value in vm.faxAccounts" ng-disabled="value.canSelect === false">{{ 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 == \'account\' && vm.trigger.channel == \'openchannel\'" 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" ng-repeat="value in vm.openchannelAccounts" ng-disabled="value.canSelect === false">{{ 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">{{ 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" ng-repeat="value in vm.outboundRoutes" ng-disabled="value.canSelect === false">{{ 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 == \'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="\'abandoned\'">Abandon</md-option>\n                    <md-option ng-value="\'complete\'">Hangup</md-option>\n                    <md-option ng-value="\'rejected\'">Reject</md-option>\n                    <md-option ng-value="\'called\'">Ring</md-option>\n                    <md-option ng-value="\'connect\'">Answer</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-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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.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\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\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\n            <div layout="row" layout-align="start center">\n\n                <div class="trigger-image" hide-xs>\n                    <img ng-src="assets/images/business/triggers.jpg">\n                </div>\n\n                <div layout="column" layout-align="start start">\n                    <div class="h2">\n                        #{{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\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="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" 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.CHANNEL">Channel</label>\n                                <md-select name="channel" ng-model="vm.trigger.channel" required disabled>\n\n                                    <md-option ng-value="\'voice\'"> {{ \'TOOLS.VOICE\' | translate }} </md-option>\n\n                                    <md-option ng-value="\'openchannel\'" ng-if="vm.license.openchannel"> {{ \'TOOLS.OPENCHANNEL\' | translate }} </md-option>\n\n                                    <md-option ng-value="\'chat\'" ng-if="vm.license.chat"> {{ \'TOOLS.CHAT\' | translate }} </md-option>\n\n                                    <md-option ng-value="\'mail\'" ng-if="vm.license.mail"> {{ \'TOOLS.MAIL\' | translate }} </md-option>\n\n                                    <md-option ng-value="\'sms\'" ng-if="vm.license.messaging"> {{ \'TOOLS.SMS\' | translate }} </md-option>\n\n                                    <md-option ng-value="\'fax\'" ng-if="vm.license.fax"> {{ \'TOOLS.FAX\' | translate }} </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"><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\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.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">\n                        <div ng-controller="TriggerAllConditionsController as vm_dc" ng-init="vm_dc.init(vm.trigger, vm.crudPermissions)">\n                            <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedTriggerAllConditions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead" translate="TOOLS.ALLCONDITIONS">AllConditions</span>\n                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\n                                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditTriggerAllCondition($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.selectedTriggerAllConditions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead">{{vm_dc.selectedTriggerAllConditions.length}} {{vm_dc.selectedTriggerAllConditions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                                    <div flex></div>\n                                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedTriggerAllConditions" 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.deleteSelectedTriggerAllConditions($event)" aria-label="delete selected" translate translate-attr-label="TRIGGERS.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.selectedTriggerAllConditions" md-progress="vm_dc.promise">\n                                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getTriggerAllConditions">\n                                        <tr md-row>\n                                            <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                                            <th md-column md-order-by="field">{{ \'TOOLS.FIELD\' | translate }}</th>\n                                            <th md-column md-order-by="operator">{{ \'TOOLS.OPERATOR\' | translate }}</th>\n                                            <th md-column md-order-by="value">{{ \'TOOLS.VALUE\' | translate }}</th>\n                                            <th md-column md-order-by="createdAt">{{ \'TOOLS.CREATED_AT\' | translate }}</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.triggerAllConditions.rows">\n                                            <td ng-click="vm_dc.createOrEditTriggerAllCondition($event, allCondition)" md-cell>{{allCondition.id}}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAllCondition($event, allCondition)" md-cell>{{ \'TOOLS.\' + vm_dc.arrayfield[allCondition.field].option | uppercase | translate }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAllCondition($event, allCondition)" md-cell>{{ \'TOOLS.\' + vm_dc.arrayoperator[allCondition.operator].option | uppercase | translate }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAllCondition($event, allCondition)" ng-if="!allCondition.value" md-cell>{{allCondition.value}}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'chat\' && allCondition.field == \'account\'" md-cell>{{ (vm_dc.chatAccounts | filter : {\'id\':allCondition.value})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'mail\' && allCondition.field == \'account\'" md-cell>{{ (vm_dc.mailAccounts | filter : {\'id\':allCondition.value})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'sms\' && allCondition.field == \'account\'" md-cell>{{ (vm_dc.smsAccounts | filter : {\'id\':allCondition.value})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'fax\' && allCondition.field == \'account\'" md-cell>{{ (vm_dc.faxAccounts | filter : {\'id\':allCondition.value})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'openchannel\' && allCondition.field == \'account\'" md-cell>{{ (vm_dc.openchannelAccounts | filter : {\'id\':allCondition.value})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'voice\' && allCondition.field == \'queue\'" md-cell>{{ (vm_dc.queues | filter : {\'name\':allCondition.value})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'voice\' && allCondition.field == \'routeId\'" md-cell>{{ (vm_dc.outboundRoutes | filter : {\'id\':allCondition.value})[0].exten }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'voice\' && allCondition.field == \'lastevent\'" md-cell>{{ vm_dc.callStatusValues[allCondition.value].option }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAllCondition($event, allCondition)" ng-if="vm.trigger.channel != \'voice\' && allCondition.field == \'interaction\'" md-cell>{{ vm_dc.interactionStatusValues[allCondition.value].option }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAllCondition($event, allCondition)" ng-if="vm.trigger.channel != \'voice\' && allCondition.field == \'message\'" md-cell>{{ vm_dc.messageStatusValues[allCondition.value].option }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAllCondition($event, allCondition)" md-cell>{{allCondition.createdAt | date:\'medium\'}}</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.createOrEditTriggerAllCondition($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.triggerAllConditions.rows.length">\n                                            <td md-cell colspan="17">\n                                                <span class="text-boxed-ligth" translate="TOOLS.NO_ALLCONDITION_AVAILABLE">No allcondition available</span>\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.triggerAllConditions.count}}" md-on-paginate="vm_dc.getTriggerAllConditions" md-page-select></md-table-pagination>\n                        </div>\n\n                    </div>\n                    <div class="trigger-detail-form-container anyconditions md-background-bg md-whiteframe-1dp">\n                        <div ng-controller="TriggerAnyConditionsController as vm_dc" ng-init="vm_dc.init(vm.trigger, vm.crudPermissions)">\n                            <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedTriggerAnyConditions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead" translate="TOOLS.ANYCONDITIONS">AnyConditions</span>\n                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\n                                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditTriggerAnyCondition($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.selectedTriggerAnyConditions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead">{{vm_dc.selectedTriggerAnyConditions.length}} {{vm_dc.selectedTriggerAnyConditions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                                    <div flex></div>\n                                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedTriggerAnyConditions" 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.deleteSelectedTriggerAnyConditions($event)" aria-label="delete selected" translate translate-attr-label="TRIGGERS.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.selectedTriggerAnyConditions" md-progress="vm_dc.promise">\n                                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getTriggerAnyConditions">\n                                        <tr md-row>\n                                            <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                                            <th md-column md-order-by="field">{{ \'TOOLS.FIELD\' | translate }}</th>\n                                            <th md-column md-order-by="operator">{{ \'TOOLS.OPERATOR\' | translate }}</th>\n                                            <th md-column md-order-by="value">{{ \'TOOLS.VALUE\' | translate }}</th>\n                                            <th md-column md-order-by="createdAt">{{ \'TOOLS.CREATED_AT\' | translate }}</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.triggerAnyConditions.rows">\n                                            <td ng-click="vm_dc.createOrEditTriggerAnyCondition($event, anyCondition)" md-cell>{{anyCondition.id}}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAnyCondition($event, anyCondition)" md-cell>{{ \'TOOLS.\' + vm_dc.arrayfield[anyCondition.field].option | uppercase | translate }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAnyCondition($event, anyCondition)" md-cell>{{ \'TOOLS.\' + vm_dc.arrayoperator[anyCondition.operator].option | uppercase | translate }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAnyCondition($event, anyCondition)" ng-if="!anyCondition.value" md-cell>{{anyCondition.value}}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'chat\' && anyCondition.field == \'account\'" md-cell>{{ (vm_dc.chatAccounts | filter : {\'id\':anyCondition.value})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'mail\' && anyCondition.field == \'account\'" md-cell>{{ (vm_dc.mailAccounts | filter : {\'id\':anyCondition.value})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'sms\' && anyCondition.field == \'account\'" md-cell>{{ (vm_dc.smsAccounts | filter : {\'id\':anyCondition.value})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'fax\' && anyCondition.field == \'account\'" md-cell>{{ (vm_dc.faxAccounts | filter : {\'id\':anyCondition.value})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'openchannel\' && anyCondition.field == \'account\'" md-cell>{{ (vm_dc.openchannelAccounts | filter : {\'id\':anyCondition.value})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'voice\' && anyCondition.field == \'queue\'" md-cell>{{ (vm_dc.queues | filter : {\'name\':anyCondition.value})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'voice\' && anyCondition.field == \'routeId\'" md-cell>{{ (vm_dc.outboundRoutes | filter : {\'id\':anyCondition.value})[0].exten }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'voice\' && anyCondition.field == \'lastevent\'" md-cell>{{ vm_dc.callStatusValues[anyCondition.value].option }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel != \'voice\' && anyCondition.field == \'interaction\'" md-cell>{{ vm_dc.interactionStatusValues[anyCondition.value].option }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel != \'voice\' && anyCondition.field == \'message\'" md-cell>{{ vm_dc.messageStatusValues[anyCondition.value].option }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAnyCondition($event, anyCondition)" md-cell>{{anyCondition.createdAt | date:\'medium\'}}</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.createOrEditTriggerAnyCondition($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.triggerAnyConditions.rows.length">\n                                            <td md-cell colspan="17">\n                                                <span class="text-boxed-ligth" translate="TOOLS.NO_ANYCONDITION_AVAILABLE">No anycondition available</span>\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.triggerAnyConditions.count}}" md-on-paginate="vm_dc.getTriggerAnyConditions" md-page-select></md-table-pagination>\n                        </div>\n\n                    </div>\n                    <div class="trigger-detail-form-container actions md-background-bg md-whiteframe-1dp">\n                        <div ng-controller="TriggerActionsController as vm_dc" ng-init="vm_dc.init(vm.trigger, vm.crudPermissions)">\n                            <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedTriggerActions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead" translate="TOOLS.ACTIONS">Actions</span>\n                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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">\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.selectedTriggerActions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead">{{vm_dc.selectedTriggerActions.length}} {{vm_dc.selectedTriggerActions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                                    <div flex></div>\n                                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedTriggerActions" 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.deleteSelectedTriggerActions($event)" aria-label="delete selected" translate translate-attr-label="TRIGGERS.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.selectedTriggerActions" md-progress="vm_dc.promise">\n                                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getTriggerActions">\n                                        <tr md-row>\n                                            <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                                            <th md-column md-order-by="action">{{ \'TOOLS.ACTION\' | translate }}</th>\n                                            <th md-column md-order-by="data1">{{ \'TOOLS.TYPE\' | translate }}</th>\n                                            <th md-column md-order-by="data2">{{ \'TOOLS.INFO\' | translate }}</th>\n                                            <th md-column md-order-by="createdAt">{{ \'TOOLS.CREATED_AT\' | translate }}</th>\n                                            <th md-column width="10px"></th>\n                                        </tr>\n                                    </thead>\n                                    <tbody md-body>\n                                        <tr md-row md-select="action" md-select-id="id" ng-repeat="action in vm_dc.triggerActions.rows">\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" md-cell>{{action.id}}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" md-cell>{{ \'TOOLS.\' + vm_dc.arrayaction[action.action].option | uppercase | translate }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'jscripty\'" md-cell>{{ (vm_dc.projects | filter : {\'id\':action.data1})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'browser\'" md-cell>{{ vm_dc.browserValues[action.data1].option }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'contactManager\'" md-cell>{{ (vm_dc.lists | filter : {\'id\':action.data1})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'contactManager\'" md-cell>{{ \'TOOLS.\' + vm_dc.autoCreateContact[action.data2].option | uppercase | translate }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'urlForward\'" md-cell>{{ vm_dc.urlForwardValues[action.data1].option }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="!action.data1" md-cell>{{action.data1}}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="!action.data2" md-cell>{{action.data2}}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'urlForward\'" md-cell>{{action.data2}}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'urlForward\' && action.data1 == \'POST\'" md-cell>{{action.data7}}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\'" md-cell>{{ vm_dc.integrationValues[action.data1].option }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'zendesk\'" md-cell>{{ (vm_dc.zendeskAccounts | filter : {\'id\':action.data2})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'desk\'" md-cell>{{ (vm_dc.deskAccounts | filter : {\'id\':action.data2})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'zoho\'" md-cell>{{ (vm_dc.zohoAccounts | filter : {\'id\':action.data2})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'salesforce\'" md-cell>{{ (vm_dc.salesforceAccounts | filter : {\'id\':action.data2})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'sugarcrm\'" md-cell>{{ (vm_dc.sugarcrmAccounts | filter : {\'id\':action.data2})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'freshdesk\'" md-cell>{{ (vm_dc.freshdeskAccounts | filter : {\'id\':action.data2})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'vtiger\'" md-cell>{{ (vm_dc.vtigerAccounts | filter : {\'id\':action.data2})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'dynamics365\'" md-cell>{{ (vm_dc.dynamics365Accounts | filter : {\'id\':action.data2})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'servicenow\'" md-cell>{{ (vm_dc.servicenowAccounts | filter : {\'id\':action.data2})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'motionbar\'" md-cell>{{ vm_dc.motionbarValues[action.data1].option }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'motionbar\' && action.data1 == \'1\'" md-cell>{{action.data2}}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'motionbar\' && action.data1 == \'2\'" md-cell>{{action.data2}}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'motionbar\' && action.data1 == \'0\'" md-cell>{{ (vm_dc.templates | filter : {\'id\':action.data2})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'browser\' && action.data1 == \'0\'" md-cell>{{ (vm_dc.templates | filter : {\'id\':action.data2})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'browser\' && action.data1 == \'1\'" md-cell>{{action.data2}}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" md-cell>{{action.createdAt | date:\'medium\'}}</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.createOrEditTriggerAction($event, action)" translate="TOOLS.EDIT_ACTION">\n                                                                Edit Action\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(action, $event)" translate="TOOLS.DELETE_ACTION">\n                                                                Delete Action\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.triggerActions.rows.length">\n                                            <td md-cell colspan="44">\n                                                <span class="text-boxed-ligth" translate="TOOLS.NO_ACTION_AVAILABLE">No action available</span>\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.triggerActions.count}}" md-on-paginate="vm_dc.getTriggerActions" 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/tools/views/triggers/triggers.html",'<div id="triggers" 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.TRIGGERS">Triggers</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.selectedTriggers.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.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\n        <div flex layout="row" layout-align="space-between center">\n\n            <div>\n                <span class="selected-triggers-count">\n                    <span>{{vm.selectedTriggers.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="TRIGGERS.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\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="TRIGGERS.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!-- 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 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="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 md-cell ng-if="trigger.userpic"><img class="avatar" alt="{{trigger.name}}" ng-src="api/users/{{trigger.id}}/avatar" /></td>\n                                <td md-cell ng-if="!trigger.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{trigger.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trigger, ev) : vm.createOrEditTrigger($event, trigger)" md-cell class="id ">{{trigger.id}}</td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trigger, ev) : vm.createOrEditTrigger($event, trigger)" md-cell class="name ">{{trigger.name}}</td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trigger, ev) : vm.createOrEditTrigger($event, trigger)" md-cell class="channel ">{{ \'TOOLS.\' + vm.arraychannel[trigger.channel].option | uppercase | translate }}</td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trigger, ev) : 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.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trigger, ev) : vm.createOrEditTrigger($event, trigger)" md-cell class="description ">{{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                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(trigger, $event)" translate="TOOLS.EDIT_TRIGGER">\n                                                    Edit Trigger\n                                                </md-button>\n                                            </md-menu-item>\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\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\n            \x3c!-- / NO RESULTS --\x3e\n        </div>\n        \x3c!-- / MAIN --\x3e\n\n    </div>\n    \x3c!-- / CONTENT --\x3e\n\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 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.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 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.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" 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 animate-slide-down 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="TRUNKS.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="TRUNKS.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!-- 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                                <td md-cell class="actions">\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.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(trunk, $event)" translate="TOOLS.EDIT_TRUNK">\n                                                    Edit Trunk\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.clonedialog(trunk, $event)" translate="TOOLS.CLONE_TRUNK">\n                                                    clone Trunk\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.gotorealtimegoto(trunk, $event)" translate="TOOLS.GOTOREALTIME_TRUNK">\n                                                    goToRealtime Trunk\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(trunk, $event)" translate="TOOLS.DELETE_TRUNK">\n                                                    Delete 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: \'{{\'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 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.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 animate-slide-down 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="VARIABLES.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="VARIABLES.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!-- 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                                <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                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editdialog(variable, $event)" translate="TOOLS.EDIT_VARIABLE">\n                                                    Edit Variable\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(variable, $event)" translate="TOOLS.DELETE_VARIABLE">\n                                                    Delete Variable\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: \'{{\'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/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 animate-slide-down 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="CHANSPIES.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="CHANSPIES.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!-- 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                                <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.editdialog(chanSpy, $event)" translate="VOICE.EDIT_CHANSPY">\n                                                    Edit chanSpy\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(chanSpy, $event)" translate="VOICE.DELETE_CHANSPY">\n                                                    Delete chanSpy\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.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 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="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 animate-slide-down 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="CONTEXTS.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="CONTEXTS.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!-- 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                                <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.editdialog(context, $event)" translate="VOICE.EDIT_CONTEXT">\n                                                    Edit Context\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(context, $event)" translate="VOICE.DELETE_CONTEXT">\n                                                    Delete Context\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.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 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="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 class="inboundroute-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.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.PHONENUMBER">PhoneNumber</label>\n                <input type="text" name="exten" ng-model="vm.inboundroute.exten" ng-required="true" autofocus>\n\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" 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.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.inboundroute.description">\n\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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.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\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/apps/agi/dialog.html",'<md-dialog class="inboundroute-dialog" aria-label="New InboundRoute">\n    <form name="inboundrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.PROJECT">Project</label>\n                <md-select name="project" ng-model="vm.agi.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" ng-disabled="project.canSelect === false">{{ project.name }}</md-option>\n                </md-select>\n                <div ng-messages="inboundrouteFormApp[\'project\'].$error" ng-show="inboundrouteFormApp[\'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>\n\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInboundRouteApp()" class="send-button md-accent md-raised" ng-disabled="inboundrouteFormApp.$invalid || inboundrouteFormApp.$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/views/inboundroutes/edit/apps/custom/dialog.html",'<md-dialog class="inboundroute-dialog" aria-label="New InboundRoute">\n    <form name="inboundrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.APPLICATION_NAME">Application_Name</label>\n                <input type="text" name="app" ng-model="vm.custom.app" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'app\'].$error" ng-show="inboundrouteFormApp[\'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.custom.appdata" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'appdata\'].$error" ng-show="inboundrouteFormApp[\'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>\n\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInboundRouteApp()" class="send-button md-accent md-raised" ng-disabled="inboundrouteFormApp.$invalid || inboundrouteFormApp.$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/views/inboundroutes/edit/apps/dial/dialog.html",'<md-dialog class="inboundroute-dialog" aria-label="New InboundRoute">\n    <form name="inboundrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.TECHNOLOGY/RESOURCE">Technology/Resource</label>\n                <input type="text" name="tech" ng-model="vm.dial.tech" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'tech\'].$error" ng-show="inboundrouteFormApp[\'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.dial.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'timeout\'].$error" ng-show="inboundrouteFormApp[\'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.OPTIONS">Options</label>\n                <input type="text" name="options" ng-model="vm.dial.options" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'options\'].$error" ng-show="inboundrouteFormApp[\'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.dial.url" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'url\'].$error" ng-show="inboundrouteFormApp[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInboundRouteApp()" class="send-button md-accent md-raised" ng-disabled="inboundrouteFormApp.$invalid || inboundrouteFormApp.$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/views/inboundroutes/edit/apps/externaldial/dialog.html",'<md-dialog class="inboundroute-dialog" aria-label="New InboundRoute">\n    <form name="inboundrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.TRUNK">Trunk</label>\n                <md-select name="trunk" ng-model="vm.externaldial.trunk" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                    <md-option ng-value="trunk.name" ng-repeat="trunk in vm.trunks" ng-disabled="trunk.canSelect === false">{{ trunk.name }}</md-option>\n                </md-select>\n                <div ng-messages="inboundrouteFormApp[\'trunk\'].$error" ng-show="inboundrouteFormApp[\'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.externaldial.phone" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'phone\'].$error" ng-show="inboundrouteFormApp[\'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.externaldial.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'timeout\'].$error" ng-show="inboundrouteFormApp[\'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.OPTIONS">Options</label>\n                <input type="text" name="options" ng-model="vm.externaldial.options" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'options\'].$error" ng-show="inboundrouteFormApp[\'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.externaldial.url" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'url\'].$error" ng-show="inboundrouteFormApp[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInboundRouteApp()" class="send-button md-accent md-raised" ng-disabled="inboundrouteFormApp.$invalid || inboundrouteFormApp.$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/views/inboundroutes/edit/apps/goto/dialog.html",'<md-dialog class="inboundroute-dialog" aria-label="New InboundRoute">\n    <form name="inboundrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.CONTEXT">Context</label>\n                <md-select name="context" ng-model="vm.goto.context" autofocus 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="inboundrouteFormApp[\'context\'].$error" ng-show="inboundrouteFormApp[\'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.goto.extension" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'extension\'].$error" ng-show="inboundrouteFormApp[\'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.goto.priority" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'priority\'].$error" ng-show="inboundrouteFormApp[\'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>\n\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInboundRouteApp()" class="send-button md-accent md-raised" ng-disabled="inboundrouteFormApp.$invalid || inboundrouteFormApp.$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/views/inboundroutes/edit/apps/hangup/dialog.html",'<md-dialog class="inboundroute-dialog" aria-label="New InboundRoute">\n    <form name="inboundrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.HANGUP_CAUSE">Hangup_Cause</label>\n                <md-select name="appdata" ng-model="vm.hangup.appdata" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n\n                    <md-option ng-value="\'1\'"> {{ \'VOICE.HANGUPCAUSE_1\' | translate }} </md-option>\n\n                    <md-option ng-value="\'16\'"> {{ \'VOICE.HANGUPCAUSE_16\' | translate }} </md-option>\n\n                    <md-option ng-value="\'17\'"> {{ \'VOICE.HANGUPCAUSE_17\' | translate }} </md-option>\n\n                    <md-option ng-value="\'18\'"> {{ \'VOICE.HANGUPCAUSE_18\' | translate }} </md-option>\n\n                    <md-option ng-value="\'21\'"> {{ \'VOICE.HANGUPCAUSE_21\' | translate }} </md-option>\n\n                    <md-option ng-value="\'22\'"> {{ \'VOICE.HANGUPCAUSE_22\' | translate }} </md-option>\n\n                    <md-option ng-value="\'27\'"> {{ \'VOICE.HANGUPCAUSE_27\' | translate }} </md-option>\n\n                    <md-option ng-value="\'38\'"> {{ \'VOICE.HANGUPCAUSE_38\' | translate }} </md-option>\n\n                    <md-option ng-value="\'41\'"> {{ \'VOICE.HANGUPCAUSE_41\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="inboundrouteFormApp[\'appdata\'].$error" ng-show="inboundrouteFormApp[\'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>\n\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInboundRouteApp()" class="send-button md-accent md-raised" ng-disabled="inboundrouteFormApp.$invalid || inboundrouteFormApp.$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/views/inboundroutes/edit/apps/internaldial/dialog.html",'<md-dialog class="inboundroute-dialog" aria-label="New InboundRoute">\n    <form name="inboundrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.USER">User</label>\n                <md-select name="user" ng-model="vm.internaldial.user" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                    <md-option ng-value="\'SIP/{{user.name}}\'" ng-repeat="user in vm.users" ng-disabled="user.canSelect === false">{{ user.name }}</md-option>\n                </md-select>\n                <div ng-messages="inboundrouteFormApp[\'user\'].$error" ng-show="inboundrouteFormApp[\'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.internaldial.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'timeout\'].$error" ng-show="inboundrouteFormApp[\'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.OPTIONS">Options</label>\n                <input type="text" name="options" ng-model="vm.internaldial.options" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'options\'].$error" ng-show="inboundrouteFormApp[\'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.internaldial.url" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'url\'].$error" ng-show="inboundrouteFormApp[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInboundRouteApp()" class="send-button md-accent md-raised" ng-disabled="inboundrouteFormApp.$invalid || inboundrouteFormApp.$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/views/inboundroutes/edit/apps/interval/dialog.html",'<md-dialog class="inboundroute-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 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\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/voice/views/inboundroutes/edit/apps/playback/dialog.html",'<md-dialog class="inboundroute-dialog" aria-label="New InboundRoute">\n    <form name="inboundrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.AUDIO_FILES">Audio_Files</label>\n                <md-select name="appdata" ng-model="vm.playback.appdata" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                    <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/{{appdata.save_name}}\'" ng-repeat="appdata in vm.sounds" ng-disabled="appdata.canSelect === false">{{ appdata.name }}</md-option>\n                </md-select>\n                <div ng-messages="inboundrouteFormApp[\'appdata\'].$error" ng-show="inboundrouteFormApp[\'appdata\'].$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.playback.options" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'options\'].$error" ng-show="inboundrouteFormApp[\'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.playback.answer" aria-label="Answer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="VOICE.ANSWER">Answer</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            <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n                <md-button type="submit" ng-click="vm.saveInboundRouteApp()" class="send-button md-accent md-raised" ng-disabled="inboundrouteFormApp.$invalid || inboundrouteFormApp.$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/views/inboundroutes/edit/apps/queue/dialog.html",'<md-dialog class="inboundroute-dialog" aria-label="New InboundRoute">\n    <form name="inboundrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.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="inboundrouteFormApp[\'queue\'].$error" ng-show="inboundrouteFormApp[\'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.queue.options" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'options\'].$error" ng-show="inboundrouteFormApp[\'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.queue.URL" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'URL\'].$error" ng-show="inboundrouteFormApp[\'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.queue.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" ng-disabled="sound.canSelect === false">{{ sound.name }}</md-option>\n                </md-select>\n                <div ng-messages="inboundrouteFormApp[\'sound\'].$error" ng-show="inboundrouteFormApp[\'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.queue.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'timeout\'].$error" ng-show="inboundrouteFormApp[\'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.AGI">Agi</label>\n                <input type="text" name="agi" ng-model="vm.queue.agi" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'agi\'].$error" ng-show="inboundrouteFormApp[\'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.queue.macro" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'macro\'].$error" ng-show="inboundrouteFormApp[\'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.queue.gosub" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'gosub\'].$error" ng-show="inboundrouteFormApp[\'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.queue.rule" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'rule\'].$error" ng-show="inboundrouteFormApp[\'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.queue.position" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'position\'].$error" ng-show="inboundrouteFormApp[\'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 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.queue.answer" aria-label="Answer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="VOICE.ANSWER">Answer</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            <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n                <md-button type="submit" ng-click="vm.saveInboundRouteApp()" class="send-button md-accent md-raised" ng-disabled="inboundrouteFormApp.$invalid || inboundrouteFormApp.$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/views/inboundroutes/edit/apps/ringgroup/dialog.html",'<md-dialog class="inboundroute-dialog" aria-label="New InboundRoute">\n    <form name="inboundrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.USER">User</label>\n                <md-select name="multipleUsers" ng-model="vm.ringgroup.multipleUsers" autofocus multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                    <md-option ng-value="\'SIP/{{multipleUsers.name}}\'" ng-repeat="multipleUsers in vm.users" ng-disabled="multipleUsers.canSelect === false">{{ multipleUsers.name }}</md-option>\n                </md-select>\n                <div ng-messages="inboundrouteFormApp[\'multipleUsers\'].$error" ng-show="inboundrouteFormApp[\'multipleUsers\'].$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.ringgroup.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'timeout\'].$error" ng-show="inboundrouteFormApp[\'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.OPTIONS">Options</label>\n                <input type="text" name="options" ng-model="vm.ringgroup.options" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'options\'].$error" ng-show="inboundrouteFormApp[\'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.ringgroup.url" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'url\'].$error" ng-show="inboundrouteFormApp[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInboundRouteApp()" class="send-button md-accent md-raised" ng-disabled="inboundrouteFormApp.$invalid || inboundrouteFormApp.$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/views/inboundroutes/edit/apps/set/dialog.html",'<md-dialog class="inboundroute-dialog" aria-label="New InboundRoute">\n    <form name="inboundrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.VARIABLE">Variable</label>\n                <md-select name="name" ng-model="vm.set.name" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                    <md-option ng-value="name.name" ng-repeat="name in vm.variables" ng-disabled="name.canSelect === false">{{ name.name }}</md-option>\n                </md-select>\n                <div ng-messages="inboundrouteFormApp[\'name\'].$error" ng-show="inboundrouteFormApp[\'name\'].$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.set.value" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'value\'].$error" ng-show="inboundrouteFormApp[\'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>\n\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInboundRouteApp()" class="send-button md-accent md-raised" ng-disabled="inboundrouteFormApp.$invalid || inboundrouteFormApp.$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/views/inboundroutes/edit/apps/voicemail/dialog.html",'<md-dialog class="inboundroute-dialog" aria-label="New InboundRoute">\n    <form name="inboundrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.MAILBOX@CONTEXT">Mailbox@Context</label>\n                <md-select name="voiceMail" ng-model="vm.voicemail.voiceMail" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                    <md-option ng-value="\'{{voiceMail.mailbox}}@from-voicemail\'" ng-repeat="voiceMail in vm.voiceMails" ng-disabled="voiceMail.canSelect === false">{{ voiceMail.mailbox }}</md-option>\n                </md-select>\n                <div ng-messages="inboundrouteFormApp[\'voiceMail\'].$error" ng-show="inboundrouteFormApp[\'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.voicemail.options" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'options\'].$error" ng-show="inboundrouteFormApp[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInboundRouteApp()" class="send-button md-accent md-raised" ng-disabled="inboundrouteFormApp.$invalid || inboundrouteFormApp.$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/views/inboundroutes/edit/view.html",'<div id="voice-inboundroute" 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-inboundroutes-button md-icon-button" aria-label="Go to inboundroutes" 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\n            <div layout="row" layout-align="start center">\n\n                <div class="inboundroute-image" hide-xs>\n                    <img ng-src="assets/images/business/inboundroutes.jpg">\n                </div>\n\n                <div layout="column" layout-align="start start">\n                    <div class="h2">\n                        #{{vm.inboundroute.id}}\n                        <span ng-if="vm.inboundroute.name">{{vm.inboundroute.name}}</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\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="inboundroute-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.PHONENUMBER">PhoneNumber</label>\n                                <input type="text" name="exten" ng-model="vm.inboundroute.exten" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\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" 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.DESCRIPTION">Description</label>\n                                <input type="text" name="description" ng-model="vm.inboundroute.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.ACTIONS">ACTIONS</span>\n                </md-tab-label>\n                <md-tab-body>\n                    <div class="inboundroute-detail-form-container actions md-background-bg md-whiteframe-1dp">\n                        <div ng-controller="InboundRouteActionsController as vm_ac" ng-init="vm_ac.init(vm.inboundroute, 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" ms-scroll 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="VOICE.{{(a.alias || a.appType) | uppercase}}">{{a.alias || 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" ms-scroll layout="column" flex="{{vm_ac.crudPermissions.canEdit ? 75 : 100}}">\n                                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_ac.selectedInboundRouteApps.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.selectedInboundRouteApps.length">\n                                    <div class="md-toolbar-tools">\n                                        <span class="md-subhead">{{vm_ac.selectedInboundRouteApps.length}} {{vm_ac.selectedInboundRouteApps.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.deleteSelectedInboundRouteApps($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\n                                \x3c!-- QUEUES TABLE --\x3e\n                                <md-table-container>\n                                    <table md-table md-row-select multiple ng-model="vm_ac.selectedInboundRouteApps">\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_ac.applications">\n                                            <tr md-row md-select="app" md-select-id="id" ng-repeat="app in vm_ac.inboundrouteApps.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.editInboundRouteApp($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.editInboundRouteApp($event, $index)"><span class="text-truncate" style="width:200px">{{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.editInboundRouteApp($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.inboundrouteApps.rows.length">\n                                                <td md-cell colspan="6">\n                                                    <span class="text-boxed-ligth" translate="VOICE.NO_APPS_AVAILABLE">No apps 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                                \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-tabs>\n\n    </div>\n    \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/voice/views/inboundroutes/inboundroutes.html",'<div id="inboundroutes" 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.INBOUNDROUTES">InboundRoutes</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.selectedInboundRoutes.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.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\n        <div flex layout="row" layout-align="space-between center">\n\n            <div>\n                <span class="selected-inboundroutes-count">\n                    <span>{{vm.selectedInboundRoutes.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="INBOUNDROUTES.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.selectAllInboundRoutes()" translate="VOICE.SELECT_ALL">\n                                Select all\n                            </md-button>\n                        </md-menu-item>\n                        <md-menu-item>\n                            <md-button ng-click="vm.deselectInboundRoutes()" 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.exportSelectedInboundRoutes" csv-label="true" filename="inboundroutes.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="INBOUNDROUTES.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!-- INBOUNDROUTE TABLE --\x3e\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 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="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="inboundroute" md-select-id="id" ng-repeat="inboundroute in vm.inboundroutes.rows">\n                                <td md-cell ng-if="inboundroute.userpic"><img class="avatar" alt="{{inboundroute.name}}" ng-src="api/users/{{inboundroute.id}}/avatar" /></td>\n                                <td md-cell ng-if="!inboundroute.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{inboundroute.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(inboundroute, ev) : vm.createOrEditInboundRoute($event, inboundroute)" md-cell class="id ">{{inboundroute.id}}</td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(inboundroute, ev) : vm.createOrEditInboundRoute($event, inboundroute)" md-cell class="exten ">{{inboundroute.exten}}</td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(inboundroute, ev) : vm.createOrEditInboundRoute($event, inboundroute)" md-cell class="description ">{{inboundroute.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.editstate(inboundroute, $event)" 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(inboundroute, $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\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></md-table-pagination>\n            </md-card>\n            \x3c!-- / INBOUNDROUTE 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 INBOUNDROUTE BUTTON --\x3e\n    <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-inboundroute-button" ng-click="vm.createOrEditInboundRoute($event)" aria-label="add inboundroute" translate translate-attr-aria-label="VOICE.ADD_INBOUNDROUTE">\n        <md-icon md-font-icon="icon-plus"></md-icon>\n    </md-button>\n    \x3c!-- / ADD INBOUNDROUTE BUTTON --\x3e\n</div>'),e.put("app/main/apps/voice/views/internalroutes/create/dialog.html",'<md-dialog class="internalroute-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.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.PHONENUMBER">PhoneNumber</label>\n                <input type="text" name="exten" ng-model="vm.internalroute.exten" ng-required="true" autofocus>\n\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" 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.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.internalroute.description">\n\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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.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\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/apps/agi/dialog.html",'<md-dialog class="internalroute-dialog" aria-label="New InternalRoute">\n    <form name="internalrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.PROJECT">Project</label>\n                <md-select name="project" ng-model="vm.agi.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" ng-disabled="project.canSelect === false">{{ project.name }}</md-option>\n                </md-select>\n                <div ng-messages="internalrouteFormApp[\'project\'].$error" ng-show="internalrouteFormApp[\'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>\n\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInternalRouteApp()" class="send-button md-accent md-raised" ng-disabled="internalrouteFormApp.$invalid || internalrouteFormApp.$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/views/internalroutes/edit/apps/custom/dialog.html",'<md-dialog class="internalroute-dialog" aria-label="New InternalRoute">\n    <form name="internalrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.APPLICATION_NAME">Application_Name</label>\n                <input type="text" name="app" ng-model="vm.custom.app" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'app\'].$error" ng-show="internalrouteFormApp[\'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.custom.appdata" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'appdata\'].$error" ng-show="internalrouteFormApp[\'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>\n\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInternalRouteApp()" class="send-button md-accent md-raised" ng-disabled="internalrouteFormApp.$invalid || internalrouteFormApp.$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/views/internalroutes/edit/apps/dial/dialog.html",'<md-dialog class="internalroute-dialog" aria-label="New InternalRoute">\n    <form name="internalrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.TECHNOLOGY/RESOURCE">Technology/Resource</label>\n                <input type="text" name="tech" ng-model="vm.dial.tech" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'tech\'].$error" ng-show="internalrouteFormApp[\'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.dial.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'timeout\'].$error" ng-show="internalrouteFormApp[\'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.OPTIONS">Options</label>\n                <input type="text" name="options" ng-model="vm.dial.options" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'options\'].$error" ng-show="internalrouteFormApp[\'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.dial.url" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'url\'].$error" ng-show="internalrouteFormApp[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInternalRouteApp()" class="send-button md-accent md-raised" ng-disabled="internalrouteFormApp.$invalid || internalrouteFormApp.$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/views/internalroutes/edit/apps/externaldial/dialog.html",'<md-dialog class="internalroute-dialog" aria-label="New InternalRoute">\n    <form name="internalrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.TRUNK">Trunk</label>\n                <md-select name="trunk" ng-model="vm.externaldial.trunk" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                    <md-option ng-value="trunk.name" ng-repeat="trunk in vm.trunks" ng-disabled="trunk.canSelect === false">{{ trunk.name }}</md-option>\n                </md-select>\n                <div ng-messages="internalrouteFormApp[\'trunk\'].$error" ng-show="internalrouteFormApp[\'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.externaldial.phone" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'phone\'].$error" ng-show="internalrouteFormApp[\'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.externaldial.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'timeout\'].$error" ng-show="internalrouteFormApp[\'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.OPTIONS">Options</label>\n                <input type="text" name="options" ng-model="vm.externaldial.options" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'options\'].$error" ng-show="internalrouteFormApp[\'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.externaldial.url" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'url\'].$error" ng-show="internalrouteFormApp[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInternalRouteApp()" class="send-button md-accent md-raised" ng-disabled="internalrouteFormApp.$invalid || internalrouteFormApp.$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/views/internalroutes/edit/apps/goto/dialog.html",'<md-dialog class="internalroute-dialog" aria-label="New InternalRoute">\n    <form name="internalrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.CONTEXT">Context</label>\n                <md-select name="context" ng-model="vm.goto.context" autofocus 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="internalrouteFormApp[\'context\'].$error" ng-show="internalrouteFormApp[\'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.goto.extension" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'extension\'].$error" ng-show="internalrouteFormApp[\'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.goto.priority" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'priority\'].$error" ng-show="internalrouteFormApp[\'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>\n\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInternalRouteApp()" class="send-button md-accent md-raised" ng-disabled="internalrouteFormApp.$invalid || internalrouteFormApp.$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/views/internalroutes/edit/apps/hangup/dialog.html",'<md-dialog class="internalroute-dialog" aria-label="New InternalRoute">\n    <form name="internalrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.HANGUP_CAUSE">Hangup_Cause</label>\n                <md-select name="appdata" ng-model="vm.hangup.appdata" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n\n                    <md-option ng-value="\'1\'"> {{ \'VOICE.HANGUPCAUSE_1\' | translate }} </md-option>\n\n                    <md-option ng-value="\'16\'"> {{ \'VOICE.HANGUPCAUSE_16\' | translate }} </md-option>\n\n                    <md-option ng-value="\'17\'"> {{ \'VOICE.HANGUPCAUSE_17\' | translate }} </md-option>\n\n                    <md-option ng-value="\'18\'"> {{ \'VOICE.HANGUPCAUSE_18\' | translate }} </md-option>\n\n                    <md-option ng-value="\'21\'"> {{ \'VOICE.HANGUPCAUSE_21\' | translate }} </md-option>\n\n                    <md-option ng-value="\'22\'"> {{ \'VOICE.HANGUPCAUSE_22\' | translate }} </md-option>\n\n                    <md-option ng-value="\'27\'"> {{ \'VOICE.HANGUPCAUSE_27\' | translate }} </md-option>\n\n                    <md-option ng-value="\'38\'"> {{ \'VOICE.HANGUPCAUSE_38\' | translate }} </md-option>\n\n                    <md-option ng-value="\'41\'"> {{ \'VOICE.HANGUPCAUSE_41\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="internalrouteFormApp[\'appdata\'].$error" ng-show="internalrouteFormApp[\'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>\n\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInternalRouteApp()" class="send-button md-accent md-raised" ng-disabled="internalrouteFormApp.$invalid || internalrouteFormApp.$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/views/internalroutes/edit/apps/internaldial/dialog.html",'<md-dialog class="internalroute-dialog" aria-label="New InternalRoute">\n    <form name="internalrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.USER">User</label>\n                <md-select name="user" ng-model="vm.internaldial.user" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                    <md-option ng-value="\'SIP/{{user.name}}\'" ng-repeat="user in vm.users" ng-disabled="user.canSelect === false">{{ user.name }}</md-option>\n                </md-select>\n                <div ng-messages="internalrouteFormApp[\'user\'].$error" ng-show="internalrouteFormApp[\'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.internaldial.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'timeout\'].$error" ng-show="internalrouteFormApp[\'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.OPTIONS">Options</label>\n                <input type="text" name="options" ng-model="vm.internaldial.options" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'options\'].$error" ng-show="internalrouteFormApp[\'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.internaldial.url" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'url\'].$error" ng-show="internalrouteFormApp[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInternalRouteApp()" class="send-button md-accent md-raised" ng-disabled="internalrouteFormApp.$invalid || internalrouteFormApp.$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/views/internalroutes/edit/apps/interval/dialog.html",'<md-dialog class="inboundroute-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 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\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/voice/views/internalroutes/edit/apps/playback/dialog.html",'<md-dialog class="internalroute-dialog" aria-label="New InternalRoute">\n    <form name="internalrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.AUDIO_FILES">Audio_Files</label>\n                <md-select name="appdata" ng-model="vm.playback.appdata" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                    <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/{{appdata.save_name}}\'" ng-repeat="appdata in vm.sounds" ng-disabled="appdata.canSelect === false">{{ appdata.name }}</md-option>\n                </md-select>\n                <div ng-messages="internalrouteFormApp[\'appdata\'].$error" ng-show="internalrouteFormApp[\'appdata\'].$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.playback.options" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'options\'].$error" ng-show="internalrouteFormApp[\'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.playback.answer" aria-label="Answer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="VOICE.ANSWER">Answer</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            <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n                <md-button type="submit" ng-click="vm.saveInternalRouteApp()" class="send-button md-accent md-raised" ng-disabled="internalrouteFormApp.$invalid || internalrouteFormApp.$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/views/internalroutes/edit/apps/queue/dialog.html",'<md-dialog class="internalroute-dialog" aria-label="New InternalRoute">\n    <form name="internalrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.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="internalrouteFormApp[\'queue\'].$error" ng-show="internalrouteFormApp[\'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.queue.options" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'options\'].$error" ng-show="internalrouteFormApp[\'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.queue.URL" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'URL\'].$error" ng-show="internalrouteFormApp[\'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.queue.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" ng-disabled="sound.canSelect === false">{{ sound.name }}</md-option>\n                </md-select>\n                <div ng-messages="internalrouteFormApp[\'sound\'].$error" ng-show="internalrouteFormApp[\'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.queue.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'timeout\'].$error" ng-show="internalrouteFormApp[\'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.AGI">Agi</label>\n                <input type="text" name="agi" ng-model="vm.queue.agi" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'agi\'].$error" ng-show="internalrouteFormApp[\'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.queue.macro" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'macro\'].$error" ng-show="internalrouteFormApp[\'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.queue.gosub" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'gosub\'].$error" ng-show="internalrouteFormApp[\'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.queue.rule" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'rule\'].$error" ng-show="internalrouteFormApp[\'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.queue.position" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'position\'].$error" ng-show="internalrouteFormApp[\'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 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.queue.answer" aria-label="Answer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="VOICE.ANSWER">Answer</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            <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n                <md-button type="submit" ng-click="vm.saveInternalRouteApp()" class="send-button md-accent md-raised" ng-disabled="internalrouteFormApp.$invalid || internalrouteFormApp.$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/views/internalroutes/edit/apps/ringgroup/dialog.html",'<md-dialog class="internalroute-dialog" aria-label="New InternalRoute">\n    <form name="internalrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.USER">User</label>\n                <md-select name="multipleUsers" ng-model="vm.ringgroup.multipleUsers" autofocus multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                    <md-option ng-value="\'SIP/{{multipleUsers.name}}\'" ng-repeat="multipleUsers in vm.users" ng-disabled="multipleUsers.canSelect === false">{{ multipleUsers.name }}</md-option>\n                </md-select>\n                <div ng-messages="internalrouteFormApp[\'multipleUsers\'].$error" ng-show="internalrouteFormApp[\'multipleUsers\'].$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.ringgroup.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'timeout\'].$error" ng-show="internalrouteFormApp[\'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.OPTIONS">Options</label>\n                <input type="text" name="options" ng-model="vm.ringgroup.options" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'options\'].$error" ng-show="internalrouteFormApp[\'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.ringgroup.url" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'url\'].$error" ng-show="internalrouteFormApp[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInternalRouteApp()" class="send-button md-accent md-raised" ng-disabled="internalrouteFormApp.$invalid || internalrouteFormApp.$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/views/internalroutes/edit/apps/set/dialog.html",'<md-dialog class="internalroute-dialog" aria-label="New InternalRoute">\n    <form name="internalrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.VARIABLE">Variable</label>\n                <md-select name="name" ng-model="vm.set.name" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                    <md-option ng-value="name.name" ng-repeat="name in vm.variables" ng-disabled="name.canSelect === false">{{ name.name }}</md-option>\n                </md-select>\n                <div ng-messages="internalrouteFormApp[\'name\'].$error" ng-show="internalrouteFormApp[\'name\'].$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.set.value" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'value\'].$error" ng-show="internalrouteFormApp[\'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>\n\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInternalRouteApp()" class="send-button md-accent md-raised" ng-disabled="internalrouteFormApp.$invalid || internalrouteFormApp.$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/views/internalroutes/edit/apps/voicemail/dialog.html",'<md-dialog class="internalroute-dialog" aria-label="New InternalRoute">\n    <form name="internalrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.MAILBOX@CONTEXT">Mailbox@Context</label>\n                <md-select name="voiceMail" ng-model="vm.voicemail.voiceMail" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                    <md-option ng-value="\'{{voiceMail.mailbox}}@from-voicemail\'" ng-repeat="voiceMail in vm.voiceMails" ng-disabled="voiceMail.canSelect === false">{{ voiceMail.mailbox }}</md-option>\n                </md-select>\n                <div ng-messages="internalrouteFormApp[\'voiceMail\'].$error" ng-show="internalrouteFormApp[\'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.voicemail.options" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'options\'].$error" ng-show="internalrouteFormApp[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInternalRouteApp()" class="send-button md-accent md-raised" ng-disabled="internalrouteFormApp.$invalid || internalrouteFormApp.$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/views/internalroutes/edit/view.html",'<div id="voice-internalroute" 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-internalroutes-button md-icon-button" aria-label="Go to internalroutes" 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\n            <div layout="row" layout-align="start center">\n\n                <div class="internalroute-image" hide-xs>\n                    <img ng-src="assets/images/business/internalroutes.jpg">\n                </div>\n\n                <div layout="column" layout-align="start start">\n                    <div class="h2">\n                        #{{vm.internalroute.id}}\n                        <span ng-if="vm.internalroute.name">{{vm.internalroute.name}}</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\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="internalroute-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.PHONENUMBER">PhoneNumber</label>\n                                <input type="text" name="exten" ng-model="vm.internalroute.exten" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\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" 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.DESCRIPTION">Description</label>\n                                <input type="text" name="description" ng-model="vm.internalroute.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.ACTIONS">ACTIONS</span>\n                </md-tab-label>\n                <md-tab-body>\n                    <div class="internalroute-detail-form-container actions md-background-bg md-whiteframe-1dp">\n                        <div ng-controller="InternalRouteActionsController as vm_ac" ng-init="vm_ac.init(vm.internalroute, 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" ms-scroll 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="VOICE.{{(a.alias || a.appType) | uppercase}}">{{a.alias || 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" ms-scroll layout="column" flex="{{vm_ac.crudPermissions.canEdit ? 75 : 100}}">\n                                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_ac.selectedInternalRouteApps.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.selectedInternalRouteApps.length">\n                                    <div class="md-toolbar-tools">\n                                        <span class="md-subhead">{{vm_ac.selectedInternalRouteApps.length}} {{vm_ac.selectedInternalRouteApps.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.deleteSelectedInternalRouteApps($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\n                                \x3c!-- QUEUES TABLE --\x3e\n                                <md-table-container>\n                                    <table md-table md-row-select multiple ng-model="vm_ac.selectedInternalRouteApps">\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_ac.applications">\n                                            <tr md-row md-select="app" md-select-id="id" ng-repeat="app in vm_ac.internalrouteApps.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.editInternalRouteApp($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.editInternalRouteApp($event, $index)"><span class="text-truncate" style="width:200px">{{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.editInternalRouteApp($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.internalrouteApps.rows.length">\n                                                <td md-cell colspan="6">\n                                                    <span class="text-boxed-ligth" translate="VOICE.NO_APPS_AVAILABLE">No apps 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                                \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-tabs>\n\n    </div>\n    \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/voice/views/internalroutes/internalroutes.html",'<div id="internalroutes" 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.INTERNALROUTES">InternalRoutes</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.selectedInternalRoutes.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.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\n        <div flex layout="row" layout-align="space-between center">\n\n            <div>\n                <span class="selected-internalroutes-count">\n                    <span>{{vm.selectedInternalRoutes.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="INTERNALROUTES.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.selectAllInternalRoutes()" translate="VOICE.SELECT_ALL">\n                                Select all\n                            </md-button>\n                        </md-menu-item>\n                        <md-menu-item>\n                            <md-button ng-click="vm.deselectInternalRoutes()" 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.exportSelectedInternalRoutes" csv-label="true" filename="internalroutes.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="INTERNALROUTES.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!-- INTERNALROUTE TABLE --\x3e\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 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="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="internalroute" md-select-id="id" ng-repeat="internalroute in vm.internalroutes.rows">\n                                <td md-cell ng-if="internalroute.userpic"><img class="avatar" alt="{{internalroute.name}}" ng-src="api/users/{{internalroute.id}}/avatar" /></td>\n                                <td md-cell ng-if="!internalroute.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{internalroute.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(internalroute, ev) : vm.createOrEditInternalRoute($event, internalroute)" md-cell class="id ">{{internalroute.id}}</td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(internalroute, ev) : vm.createOrEditInternalRoute($event, internalroute)" md-cell class="exten ">{{internalroute.exten}}</td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(internalroute, ev) : vm.createOrEditInternalRoute($event, internalroute)" md-cell class="description ">{{internalroute.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.editstate(internalroute, $event)" 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(internalroute, $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\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></md-table-pagination>\n            </md-card>\n            \x3c!-- / INTERNALROUTE 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 INTERNALROUTE BUTTON --\x3e\n    <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-internalroute-button" ng-click="vm.createOrEditInternalRoute($event)" aria-label="add internalroute" translate translate-attr-aria-label="VOICE.ADD_INTERNALROUTE">\n        <md-icon md-font-icon="icon-plus"></md-icon>\n    </md-button>\n    \x3c!-- / ADD INTERNALROUTE BUTTON --\x3e\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 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="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 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="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                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="MUSICONHOLDS.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.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">{{ \'VOICE.ID\' | translate }}</th>\n                                            <th md-column md-order-by="audio">{{ \'VOICE.AUDIO\' | translate }}</th>\n                                            <th md-column md-order-by="createdAt">{{ \'VOICE.CREATED_AT\' | translate }}</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>{{mohSound.id}}</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>{{mohSound.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="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 class="md-primary" ng-click="vm_dc.voiceMusicOnHoldDownload(mohSound, $event)" translate="VOICE.DOWNLOAD_MOHSOUND">\n                                                                Download MohSound\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(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                                                <span class="text-boxed-ligth" translate="VOICE.NO_MOHSOUND_AVAILABLE">No mohsound available</span>\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 animate-slide-down 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="MUSICONHOLDS.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="MUSICONHOLDS.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!-- 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                                <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.editstate(musiconhold, $event)" translate="VOICE.EDIT_MUSICONHOLD">\n                                                    Edit MusicOnHold\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(musiconhold, $event)" translate="VOICE.DELETE_MUSICONHOLD">\n                                                    Delete MusicOnHold\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.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 class="outboundroute-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.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.PHONENUMBER">PhoneNumber</label>\n                <input type="text" name="exten" ng-model="vm.outboundroute.exten" ng-required="true" autofocus>\n\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" 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" 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\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 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.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.outboundroute.description">\n\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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.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\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/apps/custom/dialog.html",'<md-dialog class="outboundroute-dialog" aria-label="New OutboundRoute">\n    <form name="outboundrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.APPLICATION_NAME">Application_Name</label>\n                <input type="text" name="app" ng-model="vm.custom.app" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="outboundrouteFormApp[\'app\'].$error" ng-show="outboundrouteFormApp[\'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.custom.appdata" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="outboundrouteFormApp[\'appdata\'].$error" ng-show="outboundrouteFormApp[\'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>\n\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveOutboundRouteApp()" class="send-button md-accent md-raised" ng-disabled="outboundrouteFormApp.$invalid || outboundrouteFormApp.$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/views/outboundroutes/edit/apps/interval/dialog.html",'<md-dialog class="inboundroute-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 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\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/voice/views/outboundroutes/edit/apps/outbounddial/dialog.html",'<md-dialog class="outboundroute-dialog" aria-label="New OutboundRoute">\n    <form name="outboundrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.TRUNK">Trunk</label>\n                <md-select name="trunk" ng-model="vm.outbounddial.trunk" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                    <md-option ng-value="trunk.name" ng-repeat="trunk in vm.trunks" ng-disabled="trunk.canSelect === false">{{ trunk.name }}</md-option>\n                </md-select>\n                <div ng-messages="outboundrouteFormApp[\'trunk\'].$error" ng-show="outboundrouteFormApp[\'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.outbounddial.callerID" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.CALLER_ID"></span></div>\n                <div ng-messages="outboundrouteFormApp[\'callerID\'].$error" ng-show="outboundrouteFormApp[\'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.outbounddial.prefix" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="outboundrouteFormApp[\'prefix\'].$error" ng-show="outboundrouteFormApp[\'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.outbounddial.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" ng-disabled="tag.canSelect === false">{{ tag.name }}</md-option>\n                </md-select>\n                <div ng-messages="outboundrouteFormApp[\'tag\'].$error" ng-show="outboundrouteFormApp[\'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.outbounddial.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="outboundrouteFormApp[\'timeout\'].$error" ng-show="outboundrouteFormApp[\'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.OPTIONS">Options</label>\n                <input type="text" name="options" ng-model="vm.outbounddial.options" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="outboundrouteFormApp[\'options\'].$error" ng-show="outboundrouteFormApp[\'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.outbounddial.url" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="outboundrouteFormApp[\'url\'].$error" ng-show="outboundrouteFormApp[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveOutboundRouteApp()" class="send-button md-accent md-raised" ng-disabled="outboundrouteFormApp.$invalid || outboundrouteFormApp.$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/views/outboundroutes/edit/view.html",'<div id="voice-outboundroute" 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-outboundroutes-button md-icon-button" aria-label="Go to outboundroutes" 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\n            <div layout="row" layout-align="start center">\n\n                <div class="outboundroute-image" hide-xs>\n                    <img ng-src="assets/images/business/outboundroutes.jpg">\n                </div>\n\n                <div layout="column" layout-align="start start">\n                    <div class="h2">\n                        #{{vm.outboundroute.id}}\n                        <span ng-if="vm.outboundroute.name">{{vm.outboundroute.name}}</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\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="outboundroute-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.PHONENUMBER">PhoneNumber</label>\n                                <input type="text" name="exten" ng-model="vm.outboundroute.exten" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\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" 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" 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 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.DESCRIPTION">Description</label>\n                                <input type="text" name="description" ng-model="vm.outboundroute.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.ACTIONS">ACTIONS</span>\n                </md-tab-label>\n                <md-tab-body>\n                    <div class="outboundroute-detail-form-container actions md-background-bg md-whiteframe-1dp">\n                        <div ng-controller="OutboundRouteActionsController as vm_ac" ng-init="vm_ac.init(vm.outboundroute, 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" ms-scroll 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="VOICE.{{(a.alias || a.appType) | uppercase}}">{{a.alias || 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" ms-scroll layout="column" flex="{{vm_ac.crudPermissions.canEdit ? 75 : 100}}">\n                                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_ac.selectedOutboundRouteApps.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.selectedOutboundRouteApps.length">\n                                    <div class="md-toolbar-tools">\n                                        <span class="md-subhead">{{vm_ac.selectedOutboundRouteApps.length}} {{vm_ac.selectedOutboundRouteApps.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.deleteSelectedOutboundRouteApps($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\n                                \x3c!-- QUEUES TABLE --\x3e\n                                <md-table-container>\n                                    <table md-table md-row-select multiple ng-model="vm_ac.selectedOutboundRouteApps">\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_ac.applications">\n                                            <tr md-row md-select="app" md-select-id="id" ng-repeat="app in vm_ac.outboundrouteApps.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.editOutboundRouteApp($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.editOutboundRouteApp($event, $index)"><span class="text-truncate" style="width:200px">{{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.editOutboundRouteApp($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.outboundrouteApps.rows.length">\n                                                <td md-cell colspan="6">\n                                                    <span class="text-boxed-ligth" translate="VOICE.NO_APPS_AVAILABLE">No apps 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                                \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-tabs>\n\n    </div>\n    \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/voice/views/outboundroutes/outboundroutes.html",'<div id="outboundroutes" 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.OUTBOUNDROUTES">OutboundRoutes</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.selectedOutboundRoutes.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.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\n        <div flex layout="row" layout-align="space-between center">\n\n            <div>\n                <span class="selected-outboundroutes-count">\n                    <span>{{vm.selectedOutboundRoutes.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="OUTBOUNDROUTES.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.selectAllOutboundRoutes()" translate="VOICE.SELECT_ALL">\n                                Select all\n                            </md-button>\n                        </md-menu-item>\n                        <md-menu-item>\n                            <md-button ng-click="vm.deselectOutboundRoutes()" 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.exportSelectedOutboundRoutes" csv-label="true" filename="outboundroutes.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="OUTBOUNDROUTES.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!-- OUTBOUNDROUTE TABLE --\x3e\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 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="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="outboundroute" md-select-id="id" ng-repeat="outboundroute in vm.outboundroutes.rows">\n                                <td md-cell ng-if="outboundroute.userpic"><img class="avatar" alt="{{outboundroute.name}}" ng-src="api/users/{{outboundroute.id}}/avatar" /></td>\n                                <td md-cell ng-if="!outboundroute.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{outboundroute.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(outboundroute, ev) : vm.createOrEditOutboundRoute($event, outboundroute)" md-cell class="id ">{{outboundroute.id}}</td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(outboundroute, ev) : vm.createOrEditOutboundRoute($event, outboundroute)" md-cell class="exten ">{{outboundroute.exten}}</td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(outboundroute, ev) : vm.createOrEditOutboundRoute($event, outboundroute)" md-cell class="description ">{{outboundroute.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.editstate(outboundroute, $event)" 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(outboundroute, $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\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></md-table-pagination>\n            </md-card>\n            \x3c!-- / OUTBOUNDROUTE 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 OUTBOUNDROUTE BUTTON --\x3e\n    <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-outboundroute-button" ng-click="vm.createOrEditOutboundRoute($event)" aria-label="add outboundroute" translate translate-attr-aria-label="VOICE.ADD_OUTBOUNDROUTE">\n        <md-icon md-font-icon="icon-plus"></md-icon>\n    </md-button>\n    \x3c!-- / ADD OUTBOUNDROUTE BUTTON --\x3e\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.query.filter = query" on-collapse="vm.query.filter = undefined" debounce="300"></ms-search-bar>\n            <div flex></div>\n            <div class="padding-horizontal-20" layout="column" layout-align="center center">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_DATE">Select a date</span>\n                <div layout="row" layout-align="center center">\n                    <md-button ng-if="vm.pickerModel.dateStart" ng-click="vm.clearAll()" class="md-icon-button no-padding width-20 height-20">\n                        <md-tooltip>{{ \'DASHBOARDS.DELETE\' | translate }}</md-tooltip>\n                        <md-icon md-font-icon="icon-close" class="s16 black-fg"></md-icon>\n                    </md-button>\n                    <md-date-range localization-map="vm.localizationMap" ng-model="vm.pickerModel" auto-confirm="true" show-template="true" md-on-select="vm.getContacts()" placeholder="{{ \'DASHBOARDS.ALL\' | translate }}"></md-date-range>\n                </div>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_AGENT">Select an agent</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.lastAssignedTo" ng-change="vm.getContacts()">\n                    <md-option ng-value="\'null\'" translate="DASHBOARDS.NOT_ASSIGNED"></md-option>\n                    <md-option ng-value="undefined" translate="DASHBOARDS.ALL"></md-option>\n                    <md-option ng-value="agent.name" ng-repeat="agent in vm.agents.rows">{{agent.name}}</md-option>\n                </md-select>\n            </div>\n            <div ng-if="vm.queues.count" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_CAMPAIGN">Select a Campaign</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.queue" ng-change="vm.getContacts()">\n                    <md-option ng-value="undefined" ng-if="vm.queues.count > 1"><em translate="DASHBOARDS.ALL">All</em></md-option>\n                    <md-option ng-value="queue.name" ng-repeat="queue in vm.queues.rows">{{queue.name}}</md-option>\n                </md-select>\n            </div>\n            <md-button class="md-icon-button" ng-click="vm.refresh && 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 ng-if="vm.showTooltip" md-visible="vm.showTooltip">{{\'DASHBOARDS.CLICKRELOAD\' | 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.getContacts">\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 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 tranlsate="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 md-cell class="id">{{contact.id}}</td>\n                    <td md-cell class="firstName">{{contact.calleridname}}</td>\n                    <td md-cell class="list">{{contact.calleridnum}}</td>\n                    <td md-cell class="list">{{vm.queuesMap[contact.queue]}}</td>\n                    <td md-cell class="list">{{contact.queuecallerabandonAt ? (contact.queuecallerabandonAt | formatdate) : undefined }}</td>\n                    <td md-cell class="list">{{contact.lastAssignedTo}}</td>\n                    <td md-cell class="list">{{contact.disposition}}</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">Assigned a</md-button>\n                                        <md-menu-content>\n                                            <md-menu-item ng-if="contact.lastAssignedTo">\n                                                <md-button ng-click="vm.assignedA(contact)"><em translate="DASHBOARDS.NONE">Not Assigned</em></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.assignedA(contact,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-menu>\n                                        <md-button ng-click="$mdMenu.open()" class="text-capitalize" translate="DASHBOARDS.DISPOSE">Dispose</md-button>\n                                        <md-menu-content>\n                                            <md-menu-item ng-if="vm.dispositions.length > 0" ng-repeat="disposition in vm.dispositions">\n                                                <md-button ng-click="vm.disposed(contact, disposition.name)">{{disposition.name}}</md-button>\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\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>'),e.put("app/main/apps/voice/views/realtime/agents/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.AGENTS">Agents</span>\n        <div flex></div>\n        <ms-search-bar on-search="vm.query.filter = query; vm.onInit()" on-collapse="vm.query.filter = undefined; vm.onInit()" debounce="300"></ms-search-bar>\n        <md-select ng-model="vm.query.globalStatusFilter" class="md-caption" ng-change="vm.query.pauseTypeFilter = \'\'; vm.onInit()">\n            <md-option ng-value="\'\'">{{ \'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\n        <md-select ng-if="vm.isPause(vm.query.globalStatusFilter)" ng-model="vm.query.pauseTypeFilter" class="md-caption" ng-change="vm.onInit()">\n            <md-option ng-value="\'\'">All</md-option>\n            <md-option value="DEFAULT PAUSE">DEFAULT PAUSE</md-option>\n            <md-option value="ACW">ACW</md-option>\n            <md-option value="LOGININPAUSE">LOGININPAUSE</md-option>\n            <md-option value="Auto-Pause">AUTOPAUSE</md-option>\n            <md-option ng-value="pause.name" ng-repeat="pause in vm.pauses.rows">{{pause.name}}</md-option>\n        </md-select>\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.order" md-on-reorder="vm.onInit">\n            <tr md-row border="1">\n                <th class="bv text-center" colspan="4">{{ \'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">{{ \'OPENCHANNEL.OPENCHANNEL\' | translate }}</th>\n                <th ng-if="vm.license.fax" class="bv bl text-center" colspan="2">{{ \'FAX.FAX\' | translate }}</th>\n                <th width="10px" class="bt bl" rowspan="2"></th>\n            </tr>\n            <tr md-row>\n                <th class="bl" md-column md-order-by="fullname">{{ \'VOICE.NAME\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="globalStatus">{{ \'VOICE.STATUS\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="lastLoginAt">{{ \'VOICE.LOGIN_TIME\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="lastPauseAt">{{ \'VOICE.PAUSE_TIME\' | translate }}</th>\n\n                <th class="bl custom-column">{{ \'VOICE.STATUS\' | translate }}</th>\n                <th class="bl custom-column">Info</th>\n\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\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\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\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\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            </tr>\n        </thead>\n        <tbody md-body>\n            <tr md-row ng-hide="vm.order.length">\n                <td md-cell colspan="17">\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="vm.agents[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td class="bt padding-5">\n                    <div layout="row" layout-align="start center">\n                        <img class="avatar" ng-src="{{vm.agents[value].userpic && \'api/users/\'+vm.agents[value].id+\'/avatar\' || \'assets/images/avatars/profile.png\'}}">\n                        <div layout="column">\n                            <span>{{vm.agents[value].fullname}}</span>\n                            <span>{{vm.agents[value].internal}}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class="bt">\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'}[vm.agents[value].globalStatus]\">{{ vm.isPause(vm.agents[value].globalStatus) ? '' : vm.agents[value].globalStatus | uppercase }} {{ vm.isPause(vm.agents[value].globalStatus) ? (vm.isPartialPause(vm.agents[value].globalStatus) ? '*'+vm.agents[value].pauseType || 'DEFAULT PAUSE'  : vm.agents[value].pauseType || 'DEFAULT PAUSE') : ''}}</span>\n                </td>\n                <td class=\"bt custom-column\">\n                    <timer start-time=\"vm.agents[value].lastLoginAt\" interval=\"1000\">{{ days > 0 ? days + 'd' : '' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                </td>\n                <td class=\"bt custom-column\">\n                    <timer ng-if=\"vm.isPause(vm.agents[value].globalStatus) || vm.isPartialPause(vm.agents[value].globalStatus)\" start-time=\"vm.agents[value].lastPauseAt\" interval=\"1000\">{{ days > 0 ? days + 'd' : '' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                </td>\n                <td class=\"bt bl\">\n                    <div layout=\"row\">\n                        <span ng-if=\"!vm.agents[value].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'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].voiceStatus | uppercase }}</span>\n                        <span ng-if=\"vm.agents[value].onhold\" class=\"text-boxed md-background-bg bl bt padding-5 orange-400-bg\">ONHOLD</span>\n                    </div>\n                </td>\n                <td class=\"bt bl\">\n                    <div layout=\"column\">\n                        <span ng-if=\"vm.agents[value].queue\" class=\"padding-5\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].queue }}</span>\n                        <span ng-if=\"vm.agents[value].destconnectedlinenum\" class=\"padding-5\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].destconnectedlinenum }}</span>\n                        <span class=\"padding-5\" ng-if=\"vm.agents[value].queue || vm.agents[value].destconnectedlinenum\">\n                            <timer start-time=\"vm.agents[value].voiceStatusTime\" interval=\"1000\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                        </span>\n                    </div>\n                </td>\n                <td class=\"bt bl\" ng-if=\"vm.license.chat\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].chatStatus]\">{{ vm.agents[value].chatStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td md-number class=\"bt text-center font-size-20\" ng-if=\"vm.license.chat\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].chatStatus]\">{{ vm.agents[value].chatCurrentCapacity }}</td>\n                <td class=\"bl bt\" ng-if=\"vm.license.mail\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].mailStatus]\">{{ vm.agents[value].mailStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.mail\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].mailStatus]\">{{ vm.agents[value].mailCurrentCapacity }}</td>\n                <td class=\"bl bt\" ng-if=\"vm.license.messaging\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].smsStatus]\">{{ vm.agents[value].smsStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.messaging\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].smsStatus]\">{{ vm.agents[value].smsCurrentCapacity }}</td>\n                <td class=\"bt bl\" ng-if=\"vm.license.openchannel\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].openchannelStatus]\">{{ vm.agents[value].openchannelStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.openchannel\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].openchannelStatus]\">{{ vm.agents[value].openchannelCurrentCapacity }}</td>\n                <td class=\"bt bl\" ng-if=\"vm.license.fax\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].faxStatus]\">{{ vm.agents[value].faxStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.fax\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].faxStatus]\">{{ vm.agents[value].faxCurrentCapacity }}</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\n                        <md-menu-content width=\"4\">\n                            <md-menu-item>\n                                <md-button ng-click=\"vm.logout(vm.agents[value], $event)\" translate=\"VOICE.LOGOUT\">\n                                    Logout\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-button ng-click=\"vm.queueAdd(vm.agents[value], $event)\" translate=\"VOICE.AGENTADD_QUEUE\">\n                                    Add Agent In Queue\n                                </md-button>\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=\" vm.agents[value].voicePause && 'DEFAULT PAUSE' === vm.agents[value].pauseType\" ng-click=\"vm.pause(vm.agents[value])\"><em translate=\"VOICE.DEFAULT_PAUSE\">Default Pause</em></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=\"vm.agents[value].voicePause && pause.name === vm.agents[value].pauseType\" ng-click=\"vm.pause(vm.agents[value], pause.name)\">{{pause.name}}</md-button>\n                                        </md-menu-item>\n                                    </md-menu-content>\n                                </md-menu>\n                            </md-menu-item>\n                            <md-menu-item ng-if=\"vm.isPause(vm.agents[value].globalStatus)\">\n                                <md-button ng-click=\"vm.unPause(vm.agents[value])\" 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\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.filteredAgents.length}}\" md-on-paginate=\"vm.onInit\" md-page-select></md-table-pagination>\n\x3c!-- / AGENT TABLE --\x3e\n\x3c!-- / MAIN --\x3e"),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 flex></div>\n        <ms-search-bar on-search="vm.query.filter = query;" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\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.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="4">\n                    <div layout="row" layout-align="center center">\n                        <span tranlsate="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>\n                    {{call.calleridname}}, {{call.calleridnum}} <span class="text-boxed" ng-if="call.answered">\n                        <timer ng-if="call.answertime" start-time="call.answertime" interval="1000">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                    </span>\n                </td>\n                <td md-cell>{{call.exten}}</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" interval="1000">{{hhours}}:{{mminutes}}:{{sseconds}}</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_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        \x3c!-- <div flex></div>\n    <ms-search-bar on-search="vm.query.filter = query;" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar> --\x3e\n    </div>\n</md-toolbar>\n\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 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.getSize(vm.rpcVoiceQueuesChannels)">\n                <td md-cell colspan="6">\n                    <div layout="row" layout-align="center center">\n                        <span tranlsate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-row ng-repeat="(key, channel) in vm.rpcVoiceQueuesChannels | limitObjectFromTo: vm.queryChannels.limit:(vm.queryChannels.page - 1) * vm.queryChannels.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 md-cell>{{channel.queue}}</td>\n                <td md-cell>{{channel.calleridnum}}</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" interval="1000">{{hhours}}:{{mminutes}}:{{sseconds}}</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" interval="1000">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                    </span>\n                </td>\n                <td md-cell>\n                    <span class="text-boxed">\n                        <timer start-time="channel.queuecallerjoinAt" interval="1000">{{hhours}}:{{mminutes}}:{{sseconds}}</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\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>\n                                    <md-button ng-click="$mdMenu.open()" translate="VOICE.REDIRECT_TO_AGENT">Redirect to Agent</md-button>\n                                    <md-menu-content>\n                                        <md-menu-item ng-repeat="agent in vm.agents.rows">\n                                            <md-button ng-click="vm.redirectToAgent(channel.uniqueid, agent.name, agent.context)">{{agent.name}}</md-button>\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\n<md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.queryChannels.limit" md-page="vm.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm.getSize(vm.rpcVoiceQueuesChannels)}}" md-page-select></md-table-pagination>\n\x3c!-- / QUEUES 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.query.filter = 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>{{\'\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">\n                <td md-cell colspan="8">\n                    <div layout="row" layout-align="center center">\n                        <span tranlsate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-row ng-repeat="(id, queue) in vm.queues">\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.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/queues/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.QUEUES">Queues</span>\n        <div flex></div>\n        <ms-search-bar on-search="vm.query.filter = 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">{{ \'VOICE.NAME\' | translate }}</th>\n                <th md-column>{{ \'VOICE.LOGGED_IN\' | translate }}</th>\n                <th md-column>{{ \'VOICE.PAUSED\' | translate }}</th>\n                <th md-column>{{ \'VOICE.READY\' | translate }}</th>\n                <th md-column>{{ \'VOICE.WAITING\' | translate }}</th>\n                <th md-column>{{ \'VOICE.TALKING\' | translate }}</th>\n                <th md-column width="10px"></th>\n            </tr>\n        </thead>\n        <tbody md-body>\n            <tr md-row ng-hide="vm.queues">\n                <td md-cell colspan="7">\n                    <div layout="row" layout-align="center center">\n                        <span tranlsate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-row md-select="vm.queues[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td md-cell>{{vm.queues[value].name}}</td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].loggedInDb || 0}} ({{vm.queues[value].loggedIn || 0}})</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].paused || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-16 grey-fg">{{vm.queues[value].available || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].waiting || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-16 grey-fg">{{(vm.queues[value].talking || 0) }}</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="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.createOrEditVoiceQueue($event, vm.queues[value])" translate="VOICE.EDIT_QUEUE">\n                                    Edit Queue\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-button ng-click="vm.agentAdd($event, vm.queues[value])" translate="VOICE.AGENTSADD_QUEUE">\n                                    Add Agents to queue\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.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.query.filter = query;" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n        \x3c!-- <md-button class="md-icon-button" ng-click="vm.showInfo($event)">\n            <i class="icon-information-outline grey-600-fg">\n              <md-tooltip>{{\'VOICE.INFO\' | translate}}</md-tooltip>\n            </i>\n        </md-button> --\x3e\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 tranlsate="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.query.filter = query;" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n        \x3c!-- <md-button class="md-icon-button" ng-click="vm.showInfo($event)">\n      <i class="icon-information-outline grey-600-fg">\n        <md-tooltip>{{\'FAX.INFO\' | translate}}</md-tooltip>\n      </i>\n    </md-button> --\x3e\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>\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 tranlsate="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 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="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                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.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_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="VOICEMAILS.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.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">{{ \'VOICE.ID\' | translate }}</th>\n                                            <th md-column md-order-by="callerid">{{ \'VOICE.CALLER_ID\' | translate }}</th>\n                                            <th md-column md-order-by="duration">{{ \'VOICE.DURATION\' | translate }}</th>\n                                            <th md-column md-order-by="audio">{{ \'VOICE.AUDIO\' | translate }}</th>\n                                            <th md-column md-order-by="stamp">{{ \'VOICE.RECEIVED_AT\' | translate }}</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>{{message.id}}</td>\n                                            <td md-cell>{{message.callerid}}</td>\n                                            <td md-cell>{{message.duration}}</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>{{message.stamp | 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="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 class="md-primary" ng-click="vm_dc.voiceMailMessageDownload(message, $event)" translate="VOICE.DOWNLOAD_MESSAGE">\n                                                                Download Message\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(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                                                <span class="text-boxed-ligth" translate="VOICE.NO_MESSAGE_AVAILABLE">No message available</span>\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 animate-slide-down 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="VOICEMAILS.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="VOICEMAILS.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!-- 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                                <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.editstate(voicemail, $event)" translate="VOICE.EDIT_VOICEMAIL">\n                                                    Edit Voicemail\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(voicemail, $event)" translate="VOICE.DELETE_VOICEMAIL">\n                                                    Delete Voicemail\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.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 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="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"></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/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 animate-slide-down 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="VOICEPREFIXES.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="VOICEPREFIXES.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!-- 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})[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                                <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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editdialog(voicePrefix, $event)" translate="VOICE.EDIT_VOICEPREFIX">\n                                                    Edit voicePrefix\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.agentadddialog(voicePrefix, $event)" translate="VOICE.AGENTADD_VOICEPREFIX">\n                                                    AgentAdd voicePrefix\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(voicePrefix, $event)" translate="VOICE.DELETE_VOICEPREFIX">\n                                                    Delete voicePrefix\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.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 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="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" ng-model="vm.penalty" placeholder="0" required md-minlength="0" md-maxlength="3">\n                <div ng-messages="voiceQueueForm.penalty.$error" role="alert" multiple>\n                    <div ng-message="required">\n                        <span>You must supply a penalty.</span>\n                    </div>\n                    <div ng-message="md-minlength">\n                        <span>Min Penalty 0 characters.</span>\n                    </div>\n                    <div ng-message="md-maxlength">\n                        <span>Max Penalty 3 characters.</span>\n                    </div>\n                </div>\n            </md-input-container>\n            <ms-dual-multiselect options="vm.dualMultiselectOptions"></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" ng-model="vm.penalty" placeholder="0" required md-minlength="0" md-maxlength="3">\n                <div ng-messages="voiceQueueForm.penalty.$error" role="alert" multiple>\n                    <div ng-message="required">\n                        <span>You must supply a penalty.</span>\n                    </div>\n                    <div ng-message="md-minlength">\n                        <span>Min Penalty 0 characters.</span>\n                    </div>\n                    <div ng-message="md-maxlength">\n                        <span>Max Penalty 3 characters.</span>\n                    </div>\n                </div>\n            </md-input-container>\n            <ms-dual-multiselect options="vm.dualMultiselectOptions"></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" 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" 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\'">no</md-option>\n                                    <md-option ng-value="\'yes\'">yes</md-option>\n                                    <md-option ng-value="\'strict\'">strict</md-option>\n                                    <md-option ng-value="\'loose\'">loose</md-option>\n                                    <md-option ng-value="\'paused\'">paused</md-option>\n                                    <md-option ng-value="\'penalty\'">penalty</md-option>\n                                    <md-option ng-value="\'inuse\'">inuse</md-option>\n                                    <md-option ng-value="\'ringing\'">ringing</md-option>\n                                    <md-option ng-value="\'unavailable\'">unavailable</md-option>\n                                    <md-option ng-value="\'invalid\'">invalid</md-option>\n                                    <md-option ng-value="\'unknown\'">unknoww</md-option>\n                                    <md-option ng-value="\'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\'">no</md-option>\n                                    <md-option ng-value="\'yes\'">yes</md-option>\n                                    <md-option ng-value="\'strict\'">strict</md-option>\n                                    <md-option ng-value="\'loose\'">loose</md-option>\n                                    <md-option ng-value="\'paused\'">paused</md-option>\n                                    <md-option ng-value="\'penalty\'">penalty</md-option>\n                                    <md-option ng-value="\'inuse\'">inuse</md-option>\n                                    <md-option ng-value="\'ringing\'">ringing</md-option>\n                                    <md-option ng-value="\'unavailable\'">unavailable</md-option>\n                                    <md-option ng-value="\'invalid\'">invalid</md-option>\n                                    <md-option ng-value="\'unknown\'">unknoww</md-option>\n                                    <md-option ng-value="\'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                                <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 animate-slide-down 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="VOICEQUEUES.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="VOICEQUEUES.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!-- 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                                <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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(voiceQueue, $event)" translate="VOICE.EDIT_VOICEQUEUE">\n                                                    Edit VoiceQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.teamadddialog(voiceQueue, $event)" translate="VOICE.TEAMADD_VOICEQUEUE">\n                                                    teamadd VoiceQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.agentadddialog(voiceQueue, $event)" translate="VOICE.AGENTADD_VOICEQUEUE">\n                                                    agentadd VoiceQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(voiceQueue, $event)" translate="VOICE.DELETE_VOICEQUEUE">\n                                                    Delete VoiceQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.gotorealtimegoto(voiceQueue, $event)" translate="VOICE.GOTOREALTIME_VOICEQUEUE">\n                                                    goToRealtime VoiceQueue\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.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 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="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/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            \x3c!-- DATE FILTER --\x3e\n            <div class="padding-horizontal-20" layout="column" layout-align="center center">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_DATE_RANGE">Select Date Range</span>\n                <div layout="row" layout-align="center center">\n                    <md-button ng-if="vm.pickerModel.dateStart" ng-click="vm.clearDateFilter()" class="md-icon-button no-padding width-20 height-20">\n                        <md-tooltip>{{ \'DASHBOARDS.CLEAR\' | translate }}</md-tooltip>\n                        <md-icon md-font-icon="icon-close" class="s16 white-fg"></md-icon>\n                    </md-button>\n                    <md-date-range localization-map="vm.localizationMap" ng-model="vm.pickerModel" auto-confirm="true" show-template="true" md-on-select="vm.getVoiceRecordings()" placeholder="{{ \'DASHBOARDS.ALL\' | translate }}"></md-date-range>\n                </div>\n            </div>\n            \x3c!-- /DATE FILTER --\x3e\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 animate-slide-down 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="VOICERECORDINGS.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.crudPermissions.canDelete" ng-click="vm.deleteSelectedVoiceRecordings($event)" aria-label="delete selected" translate translate-attr-label="VOICERECORDINGS.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!-- 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 md-order-by="audio">{{ \'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 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="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 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.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="type ">{{voiceRecording.type}}</td>\n                                <td ng-click="vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="uniqueid ">{{voiceRecording.uniqueid}}</td>\n                                <td ng-click="vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="calleridnum ">{{voiceRecording.calleridnum}}</td>\n                                <td ng-click="vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="exten ">{{voiceRecording.exten}}</td>\n                                <td ng-click="vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="connectedlinenum ">{{voiceRecording.connectedlinenum}}</td>\n                                <td ng-click="vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="queue ">{{voiceRecording.queue}}</td>\n                                <td ng-click="vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="membername ">{{voiceRecording.membername}}</td>\n                                <td ng-click="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"></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.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="createdAt ">{{voiceRecording.createdAt | date:\'medium\' }}</td>\n                                <td ng-click="vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="userDisposition ">{{voiceRecording.userDisposition}}</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                                        <md-menu-content width="3">\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.downloadfile2(voiceRecording, $event)" translate="VOICE.DOWNLOAD_VOICERECORDING">\n                                                    Download VoiceRecording\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(voiceRecording, $event)" translate="VOICE.DELETE_VOICERECORDING">\n                                                    Delete VoiceRecording\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.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/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-scroll="vm.msScrollOptions"></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-scroll="vm.msScrollOptions"></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" ms-scroll 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" ms-scroll 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" ms-scroll 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 animate-slide-left" ng-hide="vm_ct.user">\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" placeholder="Search by fullname.." 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" <md-option ng-value="undefined">All</md-option>\n                <md-option ng-value="true">\n                    <md-icon md-font-icon="icon-checkbox-blank-circle" class="s12 green-fg"></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"></md-icon>Offline\n                </md-option>\n            </md-select>\n        </div>\n    </md-subheader>\n    \x3c!-- <select ng-model="vm_ct.filterOnline" class="height-50 no-padding no-margin">\n            <option ng-value="undefined">All</option>\n            <option ng-value="true"><md-icon md-font-icon="icon-checkbox-blank-circle" class="s12 green-fg"></md-icon>Online</option>\n            <option ng-value="false"><md-icon md-font-icon="icon-checkbox-blank-circle" class="s12 red-fg"></md-icon>Offline</option>\n        </select> --\x3e\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.toggleChat(user)">\n            <md-divider></md-divider>\n            <img ng-src="{{user.userpic ? \'api/users/\' + user.id + \'/avatar\' : \'assets/images/avatars/profile.png\'}}" 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.unreadMessage[user.id]" class="md-accent-bg unread-message-count">\n                {{vm_ct.unreadMessage[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"></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.read && user.lastMessage.FromId === vm_ct.currentUser.id" class="s16 no-margin" md-font-icon="icon-check"></md-icon>\n                    <md-icon ng-if="user.lastMessage.read && user.lastMessage.FromId === vm_ct.currentUser.id" class="s16 no-margin" md-font-icon="icon-check-all md-accent"></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            </div>\n        </md-list-item>\n    </md-list>\n</div>\n\n<div class="chat animate-slide-right" ng-show="vm_ct.user" 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.toggleChat()" 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 layout="row" ng-repeat="message in vm_ct.user.messages.rows" class="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\' : \'assets/images/avatars/profile.png\'}}" class="avatar" alt="{{vm_ct.user.fullname}}" />\n            <img ng-if="message.FromId === vm_ct.currentUser.id" class="avatar" ng-src="{{vm_ct.currentUser.userpic ? \'api/users/\' + vm_ct.currentUser.id + \'/avatar\' : \'assets/images/avatars/profile.png\'}}">\n            <div class="bubble" 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.read && message.FromId === vm_ct.currentUser.id" class="s16 margin-5" md-font-icon="icon-check"></md-icon>\n                    <md-icon ng-if="message.read && message.FromId === vm_ct.currentUser.id" class="s16 margin-5" md-font-icon="icon-check-all md-accent"></md-icon>\n                </div>\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\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 ms-scroll>\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 animate-slide-left" 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 animate-slide-right" 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 ms-scroll 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 ms-scroll>\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()" ms-scroll>\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/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 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="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.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>\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>\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() | 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" 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"></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">{{ days > 0 ? days + \'d\' : \'\' }} {{hhours}}:{{mminutes}}:{{sseconds}}</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">{{ days > 0 ? days + \'d\' : \'\' }} {{hhours}}:{{mminutes}}:{{sseconds}}</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 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.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">{{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        <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 translate="{{lang.translation}}">{{lang.title}}</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">{{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">Preview</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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 layout="row" ng-if="vm.preview">\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                </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 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-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-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.core",["ngAnimate","ngAria","ngCookies","ngMessages","ngResource","ngSanitize","ngMaterial","pascalprecht.translate","ui.router","gridster","ds.clock","angucomplete-alt"])}(),function(){"use strict";function e(e,t){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"}),t.addPart("app/errors/404")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.errors.error-404",[]).config(e)}(),function(){"use strict";function e(e,t){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"}),t.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,t){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"}),t.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.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.login","app.forgot","app.reset","app.errors"])}(),function(){"use strict";function e(e,t){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"}),t.addPart("app/login")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.login",[]).config(e)}(),function(){"use strict";function e(e,t,n,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,t){return t.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:t.getCurrentUser().userProfileId,section:"Metrics",fields:"createdAt,updatedAt,id,name,table,metric,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.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:t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1202})}]},authenticate:!0,permissionId:1202,bodyClass:"analytics"}),t.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,t){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t,a,i){var s;return e.resolve("analyticCustomReport@get",{fields:"createdAt,updatedAt,id,name,description,table,conditions,joins",id:t.id}).then(function(e){var t=[];if((s=e).joins)try{s.joins=JSON.parse(s.joins);for(var n=0;n<s.joins.length;n+=1)t.push(i.getColumns(s.joins[n].foreignTable))}catch(e){console.log(e)}return a.all(t)}).then(function(e){for(var t=0;t<e.length;t+=1)s.joins[t].foreignTableFields=_.difference(_.keys(e[t]),["$promise","$resolved"]);return s})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t,n,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,t){return t.hasRole("admin")?e.resolve("squareOdbc@get",{fields:"createdAt,updatedAt,id,name,dsn,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"ODBC",fields:"createdAt,updatedAt,id,name,dsn,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("squareRecording@get",{fields:"createdAt,updatedAt,id,filename,projectName,uniqueid,callerid,extension,audio",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"SquareRecordings",fields:"createdAt,updatedAt,id,filename,projectName,uniqueid,callerid,extension,audio",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1102})}]},authenticate:!0,permissionId:1102,bodyClass:"callysquare"}),t.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,t){return t.hasRole("admin")?e.resolve("squareProject@get",{fields:"id,name,description,notes",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"SquareProjects",fields:"id,name,description,notes",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("squareProject@get",{id:t.id})}],users:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("user@get",{fields:"id,fullname,role",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Users",mergeResources:!0,fields:"id,fullname,role",sort:"name",nolimit:!0})}],trunks:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("trunk@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Trunks",fields:"id,name",sort:"name",nolimit:!0})}],queues:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("voiceQueue@get",{type:"inbound",fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"VoiceQueues",type:"inbound",fields:"id,name",sort:"name",nolimit:!0})}],sounds:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("sound@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Sounds",fields:"id,name",sort:"name",nolimit:!0})}],variables:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("variable@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Variables",fields:"id,name",sort:"name",nolimit:!0})}],databases:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("squareOdbc@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"ODBC",fields:"id,name",sort:"name",nolimit:!0})}],projects:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("squareProject@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"SquareProjects",fields:"id,name",sort:"name",nolimit:!0})}],contexts:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("voiceContext@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Contexts",fields:"id,name",sort:"name",nolimit:!0})}],intervals:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("interval@get",{fields:"id,name,IntervalId",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Intervals",fields:"id,name,IntervalId",sort:"name",nolimit:!0})}],mailAccounts:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("mailAccount@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"MailAccounts",fields:"id,name",sort:"name",nolimit:!0})}],templates:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("template@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Templates",fields:"id,name",sort:"name",nolimit:!0})}],lists:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",sort:"name",nolimit:!0})}],smsAccounts:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("smsAccount@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"SmsAccounts",fields:"id,name",sort:"name",nolimit:!0})}],pauses:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("pause@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Pauses",fields:"id,name",sort:"name",nolimit:!0})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t,n,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,t){return t.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:t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("chatQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.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,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,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,forwardOfflineAddress,IntervalId,timezone,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.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,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,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,forwardOfflineAddress,IntervalId,timezone,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){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,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,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,forwardOfflineAddress,IntervalId,timezone,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:502})}]},authenticate:!0,permissionId:502,bodyClass:"chat"}),t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:510})}]},authenticate:!0,permissionId:510}).state("app.chat.realtime.agents",{url:"/agents",controller:"AgentsChatRealtimeController as vm",templateUrl:"app/main/apps/chat/views/realtime/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{nolimit:!0})}],agents:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("user@get",{fields:"id,name,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,mailPause,pauseType,lastPauseAt,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity",role:"agent",sort:"fullname",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Agents",fields:"id,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,mailPause,pauseType,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity",role:"agent",sort:"fullname",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:202})}],rpcAgents:["apiResolver",function(e){return e.resolve("rpc@getAgents")}]},authenticate:!0,permissionId:510}).state("app.chat.realtime.queues",{url:"/queues",controller:"QueuesChatRealtimeController as vm",templateUrl:"app/main/apps/chat/views/realtime/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("chatQueue@get",{type:"inbound",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"ChatQueues",channel:"chat",type:"inbound",sort:"-updatedAt",limit:10,page:1})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:501})}],rpcQueues:["apiResolver",function(e){return e.resolve("rpc@getChatQueues")}]},authenticate:!0,permissionId:510})}e.$inject=["$stateProvider"],angular.module("app.chat.realtime",[]).config(e)}(),function(){"use strict";function e(e,t,n,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,t){return t.hasRole("admin")?e.resolve("cmList@get",{fields:"createdAt,updatedAt,id,name,description,dialPrefix",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Lists",fields:"createdAt,updatedAt,id,name,description,dialPrefix",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("cmList@get",{fields:"createdAt,updatedAt,id,name,description,dialPrefix",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.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:t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){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:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("cmCustomField@get",{fields:"createdAt,updatedAt,id,alias,type,values,required",sort:"-updatedAt",ListId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:304})}]},authenticate:!0,permissionId:304,bodyClass:"contactmanager"}),t.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,t,n){return t.hasRole("admin")?e.resolve("cmContact@get",_.merge({includeAll:!0,sort:"-updatedAt",limit:10,offset:0},n)):e.resolve("userProfile@getResources",_.merge({id:t.getCurrentUser().userProfileId,section:"Contacts",includeAll:!0,sort:"-updatedAt",limit:10,offset:0},n))}],lists:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",sort:"-updatedAt",limit:10,offset:0})}],listsMap:["lists",function(e){for(var t={},n=0;n<e.rows.length;n++)t[e.rows[n].id]=e.rows[n].name;return t}],companies:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("cmCompany@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Companies",fields:"id,name",sort:"name",nolimit:!0})}],companiesMap:["companies",function(e){for(var t={},n=0;n<e.rows.length;n++)t[e.rows[n].id]=e.rows[n].name;return t}],tags:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("tag@get",{fields:"id,name",sort:"name",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Tags",fields:"id,name",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("cmContact@get",{id:t.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,t){return e.resolve("cmContact@getHoppers",{id:t.id,fields:"id,phone,scheduledat,priority,recallme,VoiceQueueId,CampaignId,UserId",sort:"-updatedAt",limit:10,offset:0})}],finals:["apiResolver","$stateParams",function(e,t){return e.resolve("cmContact@getHopperFinals",{id:t.id,fields:"id,uniqueid,calleridnum,statedesc,starttime,disposition",sort:"-updatedAt",limit:10,offset:0})}],histories:["apiResolver","$stateParams",function(e,t){return e.resolve("cmContact@getHopperHistories",{id:t.id,fields:"id,uniqueid,calleridnum,statedesc,scheduledat,starttime,endtime",sort:"-updatedAt",limit:10,offset:0})}],jscriptySessions:["apiResolver","$stateParams",function(e,t){return e.resolve("cmContact@getJscriptySessions",{id:t.id,fields:"id,starttime,endtime,membername,projectname",sort:"-starttime",limit:10,offset:0})}],companies:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("cmCompany@get"):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Companies"})}],lists:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",sort:"-updatedAt",nolimit:!0})}],customFields:["apiResolver","contact",function(e,t){return t.ListId?e.resolve("cmList@getCustomFields",{id:t.ListId}):null}],tags:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("tag@get"):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Tags"})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t,n,a){e.state("app.dashboards",{abstract:!0,url:"/dashboards"}),t.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(t,e){var a;return(e.hasRole("admin")?t.resolve("voiceQueue@get",{fields:"id,name",nolimit:!0}):t.resolve("userProfile@getResources",{id:e.getCurrentUser().userProfileId,section:"VoiceQueues",mergeResources:!0,fields:"id,name",channel:"voice",nolimit:!0})).then(function(e){return a=e,t.resolve("rpc@getVoiceQueues")}).then(function(e){if(e)for(var t,n=0;n<e.rows.length;n+=1)(t=_.find(a.rows,{id:e.rows[n].id}))&&_.merge(t,_.pick(e.rows[n],["waiting","total","talking","answered","unmanaged","abandoned"]));return a})}],userProfile:["apiResolver","Auth",function(e,t){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:100})}]},authenticate:!0,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",data:{selectedTab:0},views:{"content@app":{templateProvider:["$stateParams","$templateFactory","Auth",function(e,t,n){var a=n.getCurrentUser();return a&&"agent"===a.role?t.fromUrl("app/main/apps/dashboards/views/general/agent/agent.general.html",e):t.fromUrl("app/main/apps/dashboards/views/general/user/user.general.html",e)}],controllerProvider:["Auth",function(e){var t=e.getCurrentUser();return t&&"agent"===t.role?"AgentDashboardGeneralController as vm":"UserDashboardGeneralController as vm"}]}},resolve:{globalUserLists:["apiResolver","Auth",function(e,t){return e.resolve("user@getLists",{id:t.getCurrentUser().id,sort:"name",nolimit:!0})}],globalLists:["apiResolver","Auth",function(e,t){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,t){return t.hasRole("admin")?e.resolve("voiceQueue@get",{fields:"id,name",type:"inbound",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.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,t){return t.hasRole("admin")?e.resolve("voiceQueue@get",{fields:"id,name",type:"outbound",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.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",{dateStart:moment().startOf("day").toString(),dateEnd:moment().endOf("day").toString()})}],chatWebsites:["apiResolver","Auth",function(e,t){return t.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,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,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,header_offline,offline_message,message_title,enquiry_message_placeholder,enquiry_button,rating_message,rating_send,rating_skip,acceptMethod,acceptUrl,rejectMethod,rejectUrl,closeMethod,closeUrl,onlineForm,offlineForm,mapKey,mapKeyOffline,forwardTranscript,forwardOffline,forwardOfflineAddress,IntervalId,timezone,waitForTheAssignedAgent,description,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.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,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,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,header_offline,offline_message,message_title,enquiry_message_placeholder,enquiry_button,rating_message,rating_send,rating_skip,acceptMethod,acceptUrl,rejectMethod,rejectUrl,closeMethod,closeUrl,onlineForm,offlineForm,mapKey,mapKeyOffline,forwardTranscript,forwardOffline,forwardOfflineAddress,IntervalId,timezone,waitForTheAssignedAgent,description,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",limit:10,offset: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",{dateStart:moment().startOf("day").toString(),dateEnd:moment().endOf("day").toString()})}],mailAccounts:["apiResolver","Auth",function(e,t){return t.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,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.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,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset: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",{dateStart:moment().startOf("day").toString(),dateEnd:moment().endOf("day").toString()})}],smsAccounts:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("smsAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,phone,type,accountSid,authId,authToken,smsMethod,username,password,senderString,deliveryReport,waitForTheAssignedAgent,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"SmsAccounts",fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,phone,type,accountSid,authId,authToken,smsMethod,username,password,senderString,deliveryReport,waitForTheAssignedAgent,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",limit:10,offset: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",{dateStart:moment().startOf("day").toString(),dateEnd:moment().endOf("day").toString()})}],openchannelAccounts:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("openchannelAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,mapKey,description,receiveUri,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"OpenchannelAccounts",fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,mapKey,description,receiveUri,notificationSound,notificationShake,notificationTemplate",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",{dateStart:moment().startOf("day").toString(),dateEnd:moment().endOf("day").toString()})}],faxAccounts:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("faxAccount@get",{fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,description,ecm,minrate,maxrate,modem,gateway,faxdetect,t38timeout,tech,acceptMethod,acceptUrl,rejectMethod,rejectUrl,closeMethod,closeUrl,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"FaxAccounts",fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,description,ecm,minrate,maxrate,modem,gateway,faxdetect,t38timeout,tech,acceptMethod,acceptUrl,rejectMethod,rejectUrl,closeMethod,closeUrl,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",limit:10,offset:0})}]},authenticate:!0,bodyClass:"dashboards"})}e.$inject=["$stateProvider"],angular.module("app.dashboards.general.user",[]).config(e)}(),function(){"use strict";function e(e,t,n,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,t){return t.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:t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("faxQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("faxAccount@get",{fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,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:t.getCurrentUser().userProfileId,section:"FaxAccounts",fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("faxAccount@get",{fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,ecm,minrate,maxrate,modem,gateway,faxdetect,t38timeout,tech,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:902})}]},authenticate:!0,permissionId:902,bodyClass:"fax"}),t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:910})}]},authenticate:!0,permissionId:910}).state("app.fax.realtime.agents",{url:"/agents",controller:"AgentsFaxRealtimeController as vm",templateUrl:"app/main/apps/fax/views/realtime/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{nolimit:!0})}],agents:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("user@get",{fields:"id,name,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,mailPause,pauseType,lastPauseAt,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity",role:"agent",sort:"fullname",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Agents",fields:"id,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,mailPause,pauseType,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity",role:"agent",sort:"fullname",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:202})}],rpcAgents:["apiResolver",function(e){return e.resolve("rpc@getAgents")}]},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,t){return t.hasRole("admin")?e.resolve("trunk@get",{fields:"id,name",active:!0,sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Trunks",fields:"id,name",active:!0,sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1011})}],rpcTrunks:["apiResolver",function(e){return e.resolve("rpc@getTrunks")}]},authenticate:!0,permissionId:910}).state("app.fax.realtime.queues",{url:"/queues",controller:"QueuesFaxRealtimeController as vm",templateUrl:"app/main/apps/fax/views/realtime/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("faxQueue@get",{type:"inbound",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"FaxQueues",channel:"fax",type:"inbound",sort:"-updatedAt",limit:10,page:1})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:901})}],rpcQueues:["apiResolver",function(e){return e.resolve("rpc@getFaxQueues")}]},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,t){return t.hasRole("admin")?e.resolve("faxAccount@get",{sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"FaxAccounts",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t,n,a){e.state("app.help",{abstract:!0,url:"/help"}),t.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,t,n,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,t){return t.hasRole("admin")?e.resolve("intZendeskAccount@get",{fields:"createdAt,updatedAt,id,name,type,username,remoteUri,authType,password,token,serverUrl,description",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"ZendeskAccounts",fields:"createdAt,updatedAt,id,name,type,username,remoteUri,authType,password,token,serverUrl,description",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("intZendeskAccount@get",{fields:"createdAt,updatedAt,id,name,type,username,remoteUri,authType,password,token,serverUrl,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("intSalesforceAccount@get",{fields:"createdAt,updatedAt,id,name,type,username,remoteUri,password,clientId,clientSecret,securityToken,serverUrl,description",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"SalesforceAccounts",fields:"createdAt,updatedAt,id,name,type,username,remoteUri,password,clientId,clientSecret,securityToken,serverUrl,description",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("intSalesforceAccount@get",{fields:"createdAt,updatedAt,id,name,type,username,remoteUri,password,clientId,clientSecret,securityToken,serverUrl,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("intFreshdeskAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"FreshdeskAccounts",fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("intFreshdeskAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("intSugarcrmAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,password,serverUrl,description",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"SugarcrmAccounts",fields:"createdAt,updatedAt,id,name,username,remoteUri,password,serverUrl,description",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("intSugarcrmAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,password,serverUrl,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("intDeskAccount@get",{fields:"createdAt,updatedAt,id,name,type,remoteUri,authType,username,password,serverUrl,description",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"DeskAccounts",fields:"createdAt,updatedAt,id,name,type,remoteUri,authType,username,password,serverUrl,description",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("intDeskAccount@get",{fields:"createdAt,updatedAt,id,name,type,remoteUri,authType,username,password,serverUrl,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("intZohoAccount@get",{fields:"createdAt,updatedAt,id,name,host,authToken,serverUrl,description",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"ZohoAccounts",fields:"createdAt,updatedAt,id,name,host,authToken,serverUrl,description",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("intZohoAccount@get",{fields:"createdAt,updatedAt,id,name,host,authToken,serverUrl,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("intVtigerAccount@get",{fields:"createdAt,updatedAt,id,name,description,username,accessKey,remoteUri,serverUrl",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"VtigerAccounts",fields:"createdAt,updatedAt,id,name,description,username,accessKey,remoteUri,serverUrl",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("intVtigerAccount@get",{fields:"createdAt,updatedAt,id,name,description,username,accessKey,remoteUri,serverUrl",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("intDynamics365Account@get",{fields:"createdAt,updatedAt,id,name,username,password,remoteUri,tenantId,clientId,clientSecret,serverUrl,description",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Dynamics365Accounts",fields:"createdAt,updatedAt,id,name,username,password,remoteUri,tenantId,clientId,clientSecret,serverUrl,description",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("intDynamics365Account@get",{fields:"createdAt,updatedAt,id,name,username,password,remoteUri,tenantId,clientId,clientSecret,serverUrl,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("intServicenowAccount@get",{fields:"createdAt,updatedAt,id,name,username,password,email,remoteUri,serverUrl,description",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"ServicenowAccounts",fields:"createdAt,updatedAt,id,name,username,password,email,remoteUri,serverUrl,description",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("intServicenowAccount@get",{fields:"createdAt,updatedAt,id,name,username,password,email,remoteUri,serverUrl,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1310})}]},authenticate:!0,permissionId:1310,bodyClass:"integrations"}),t.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,t,n,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,t){return t.hasRole("admin")?e.resolve("jscriptyProject@get",{fields:"createdAt,updatedAt,id,name,enableUncompleteSave,description,formData",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Projects",fields:"createdAt,updatedAt,id,name,enableUncompleteSave,description,formData",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("jscriptyProject@get",{fields:"createdAt,updatedAt,id,name,enableUncompleteSave,description,formData",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1701})}]},authenticate:!0,permissionId:1701,bodyClass:"jscripty"}),t.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,t,n,a){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,t){return t.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:t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("mailQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.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,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.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,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){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,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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","Auth",function(e,t){return e.resolve("mailSubstatus@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:603})}]},authenticate:!0,permissionId:603,bodyClass:"mail"}),t.addPart("app/main/apps/mail")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:610})}]},authenticate:!0,permissionId:610}).state("app.mail.realtime.agents",{url:"/agents",controller:"AgentsMailRealtimeController as vm",templateUrl:"app/main/apps/mail/views/realtime/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{nolimit:!0})}],agents:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("user@get",{fields:"id,name,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,mailPause,pauseType,lastPauseAt,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity",role:"agent",sort:"fullname",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Agents",fields:"id,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,mailPause,pauseType,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity",role:"agent",sort:"fullname",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:202})}],rpcAgents:["apiResolver",function(e){return e.resolve("rpc@getAgents")}]},authenticate:!0,permissionId:610}).state("app.mail.realtime.queues",{url:"/queues",controller:"QueuesMailRealtimeController as vm",templateUrl:"app/main/apps/mail/views/realtime/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("mailQueue@get",{type:"inbound",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"MailQueues",channel:"mail",type:"inbound",sort:"-updatedAt",limit:10,page:1})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:601})}],rpcQueues:["apiResolver",function(e){return e.resolve("rpc@getMailQueues")}]},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,t){return t.hasRole("admin")?e.resolve("mailAccount@get",{sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"MailAccounts",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t,n,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,t){return t.hasRole("admin")?e.resolve("plugin@get",{fields:"createdAt,updatedAt,id,name,type,active,description,icon,sidebar,path,adminUrl,agentUrl,scriptName,scriptPath,version",sort:"name",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Plugins",fields:"createdAt,updatedAt,id,name,type,active,description,icon,sidebar,path,adminUrl,agentUrl,scriptName,scriptPath,version",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("plugin@get",{fields:"createdAt,updatedAt,id,name,type,active,description,icon,sidebar,path,adminUrl,agentUrl,scriptName,scriptPath,version",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1801})}]},authenticate:!0,permissionId:1801,bodyClass:"marketplace"}),t.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,t,n,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,t){return t.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,description,mandatoryDisposition,mandatoryDispositionPauseId",type:"outbound",sort:"-updatedAt",channel:"voice",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.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,description,mandatoryDisposition,mandatoryDispositionPauseId",type:"outbound",sort:"-updatedAt",channel:"voice",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){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,description,mandatoryDisposition,mandatoryDispositionPauseId",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.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,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:t.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,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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){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,dialOrderByScheduledAt,dialGlobalInterval,dialTimezone,dialPrefix,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1502})}]},authenticate:!0,permissionId:1502,bodyClass:"motiondialer"}),t.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.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1510})}]},authenticate:!0,permissionId:1510}).state("app.motiondialer.realtime.agents",{url:"/agents",controller:"AgentsMotionDialerRealtimeController as vm",templateUrl:"app/main/apps/motiondialer/views/realtime/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{nolimit:!0})}],agents:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("user@get",{fields:"id,name,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,mailPause,pauseType,lastPauseAt,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity",role:"agent",sort:"fullname",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Agents",fields:"id,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,mailPause,pauseType,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity",role:"agent",sort:"fullname",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:202})}],rpcAgents:["apiResolver",function(e){return e.resolve("rpc@getAgents")}]},authenticate:!0,permissionId:1510}).state("app.motiondialer.realtime.queues",{url:"/queues",controller:"QueuesMotionDialerRealtimeController as vm",templateUrl:"app/main/apps/motiondialer/views/realtime/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("voiceQueue@get",{type:"outbound",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"QueueCampaigns",channel:"voice",type:"outbound",sort:"-updatedAt",limit:10,page:1})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1501})}],rpcQueues:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueues")}]},authenticate:!0,permissionId:1510}).state("app.motiondialer.realtime.queue_calls",{url:"/queue_calls",controller:"QueueCallsMotionDialerRealtimeController as vm",templateUrl:"app/main/apps/motiondialer/views/realtime/queue_calls/view.html",resolve:{agents:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("user@get",{fields:"id,name,role,context",role:"agent",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Agents",fields:"id,name,role,context",role:"agent",nolimit:!0})}],queues:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("voiceQueue@get",{type:"outbound",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"QueueCampaigns",channel:"voice",type:"outbound",sort:"-updatedAt",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1501})}],rpcVoiceQueuesChannels:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueuesChannels")}]},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,t){return t.hasRole("admin")?e.resolve("user@get",{fields:"id,name,role,context",role:"agent",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Agents",fields:"id,name,role,context",role:"agent",nolimit:!0})}],queues:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("voiceQueue@get",{type:"outbound",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"QueueCampaigns",channel:"voice",type:"outbound",sort:"-updatedAt",nolimit:!0})}],dispositions:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("disposition@get",{fields:"createdAt,updatedAt,id,name",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Dispositions",fields:"createdAt,updatedAt,id,name",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("voiceQueue@get",{type:"outbound",fields:"id,name",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"QueueCampaigns",channel:"voice",type:"outbound",sort:"-updatedAt",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("campaign@get",{sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"IvrCampaigns",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t,n,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,t){return t.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:t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("openchannelQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("openchannelAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,mapKey,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUri,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"OpenchannelAccounts",fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,mapKey,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUri,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("openchannelAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,mapKey,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUri,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:802})}]},authenticate:!0,permissionId:802,bodyClass:"openchannel"}),t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:810})}]},authenticate:!0,permissionId:810}).state("app.openchannel.realtime.agents",{url:"/agents",controller:"AgentsOpenchannelRealtimeController as vm",templateUrl:"app/main/apps/openchannel/views/realtime/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{nolimit:!0})}],agents:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("user@get",{fields:"id,name,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,mailPause,pauseType,lastPauseAt,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity",role:"agent",sort:"fullname",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Agents",fields:"id,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,mailPause,pauseType,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity",role:"agent",sort:"fullname",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:202})}],rpcAgents:["apiResolver",function(e){return e.resolve("rpc@getAgents")}]},authenticate:!0,permissionId:810}).state("app.openchannel.realtime.queues",{url:"/queues",controller:"QueuesOpenchannelRealtimeController as vm",templateUrl:"app/main/apps/openchannel/views/realtime/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("openchannelQueue@get",{type:"inbound",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"OpenchannelQueues",channel:"openchannel",type:"inbound",sort:"-updatedAt",limit:10,page:1})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:801})}],rpcQueues:["apiResolver",function(e){return e.resolve("rpc@getOpenchannelQueues")}]},authenticate:!0,permissionId:810})}e.$inject=["$stateProvider"],angular.module("app.openchannel.realtime",[]).config(e)}(),function(){"use strict";function e(e,t,n,a){e.state("app.plugins",{abstract:!0,url:"/plugins"}),t.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";function e(e,t,n,a){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,stunaddr,turnaddr,turnusername,turnpassword,phoneBarAutoUpdater,phoneBarAutoUpdaterUrl,enableEmailPreview,split,splitSizeCsv,splitSizePdf,splitSizeXlsx,messagesAlignment,phoneBarRememberMeEnabled,rtlSupport",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:{smtps:["apiResolver",function(e){return e.resolve("mailAccount@get",{fields:"createdAt,updatedAt,id,service,name,email,Smtp.service,Smtp.host,Smtp.port,Smtp.secure,Smtp.authentication,Smtp.user,Smtp.pass,description",service:"1",limit:10,offset:0})}]},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",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,defaultHeaderWhiteLabel,headerWhiteLabel,defaultPageTitle,pageTitle,defaultPreferred",limit:10,offset:0})}]},authenticate:!0,permissionId:1400,bodyClass:"settings"}),t.addPart("app/main/apps/settings")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],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,t){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t,n,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,t){return t.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:t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("smsQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.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,senderString,deliveryReport,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"SmsAccounts",fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,type,phone,accountSid,authId,authToken,smsMethod,username,password,baseUrl,apiKey,senderString,deliveryReport,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("smsAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,type,phone,accountSid,authId,authToken,smsMethod,username,password,baseUrl,apiKey,senderString,deliveryReport,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:702})}]},authenticate:!0,permissionId:702,bodyClass:"sms"}),t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:710})}]},authenticate:!0,permissionId:710}).state("app.sms.realtime.agents",{url:"/agents",controller:"AgentsSmsRealtimeController as vm",templateUrl:"app/main/apps/sms/views/realtime/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{nolimit:!0})}],agents:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("user@get",{fields:"id,name,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,mailPause,pauseType,lastPauseAt,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity",role:"agent",sort:"fullname",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Agents",fields:"id,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,mailPause,pauseType,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity",role:"agent",sort:"fullname",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:202})}],rpcAgents:["apiResolver",function(e){return e.resolve("rpc@getAgents")}]},authenticate:!0,permissionId:710}).state("app.sms.realtime.queues",{url:"/queues",controller:"QueuesSmsRealtimeController as vm",templateUrl:"app/main/apps/sms/views/realtime/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("smsQueue@get",{type:"inbound",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"SmsQueues",channel:"sms",type:"inbound",sort:"-updatedAt",limit:10,page:1})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:701})}],rpcQueues:["apiResolver",function(e){return e.resolve("rpc@getSmsQueues")}]},authenticate:!0,permissionId:710})}e.$inject=["$stateProvider"],angular.module("app.sms.realtime",[]).config(e)}(),function(){"use strict";function e(e,t,n,a){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","Auth",function(e,t){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",role:"admin,user",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){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",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.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,voicemail,transport,host,nat,type,allow,callerid,context,callgroup,pickupgroup,chanspy,videosupport,extensionMonitor,chatCapacity,mailCapacity,faxCapacity,smsCapacity,openchannelCapacity,phoneBarEnableSettings,phoneBarAutoAnswer,phoneBarAutoAnswerDelay,phoneBarRingInUse,phoneBarEnableRecording,phoneBarEnableDtmfTone,phoneBarDnd,phoneBarUnansweredCallBadge,phoneBarEnableJaws,phoneBarOutboundProxy,phoneBarUnconditional,phoneBarUnconditionalNumber,phoneBarRemoteControl,phoneBarRemoteControlPort,phoneBarExpires,phoneBarListenPort,permissions,allowmessenger,phoneBarPrefixRequired,passwordResetAt,phoneBarEnableVideoRecording",role:"agent",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.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,voicemail,transport,host,nat,type,allow,callerid,context,callgroup,pickupgroup,chanspy,videosupport,extensionMonitor,chatCapacity,mailCapacity,faxCapacity,smsCapacity,openchannelCapacity,phoneBarEnableSettings,phoneBarAutoAnswer,phoneBarAutoAnswerDelay,phoneBarRingInUse,phoneBarEnableRecording,phoneBarEnableDtmfTone,phoneBarDnd,phoneBarUnansweredCallBadge,phoneBarEnableJaws,phoneBarOutboundProxy,phoneBarUnconditional,phoneBarUnconditionalNumber,phoneBarRemoteControl,phoneBarRemoteControlPort,phoneBarExpires,phoneBarListenPort,permissions,allowmessenger,phoneBarPrefixRequired,passwordResetAt,phoneBarEnableVideoRecording",role:"agent",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){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,voicemail,transport,host,nat,type,allow,callerid,context,callgroup,pickupgroup,chanspy,videosupport,extensionMonitor,chatCapacity,mailCapacity,faxCapacity,smsCapacity,openchannelCapacity,phoneBarEnableSettings,phoneBarAutoAnswer,phoneBarAutoAnswerDelay,phoneBarRingInUse,phoneBarEnableRecording,phoneBarEnableDtmfTone,phoneBarDnd,phoneBarUnansweredCallBadge,phoneBarEnableJaws,phoneBarOutboundProxy,phoneBarUnconditional,phoneBarUnconditionalNumber,phoneBarRemoteControl,phoneBarRemoteControlPort,phoneBarExpires,phoneBarListenPort,permissions,allowmessenger,phoneBarPrefixRequired,passwordResetAt,phoneBarEnableVideoRecording",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.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:t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){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:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("team@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Teams",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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","Auth",function(e,t){return e.resolve("userProfile@get",{fields:"createdAt,updatedAt,id,name,description,crudPermissions",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("userProfile@get",{fields:"createdAt,updatedAt,id,name,description,crudPermissions",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:205})}]},authenticate:!0,permissionId:205,bodyClass:"staff"}),t.addPart("app/main/apps/staff")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],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,t,n,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,t){return t.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:t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1001})}]},authenticate:!0,permissionId:1001,bodyClass:"tools"}).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,t){return t.hasRole("admin")?e.resolve("disposition@get",{fields:"createdAt,updatedAt,id,name",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Dispositions",fields:"createdAt,updatedAt,id,name",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1002})}]},authenticate:!0,permissionId:1002,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,t){return t.hasRole("admin")?e.resolve("dashboard@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"CustomDashboards",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("dashboard@get",{fields:"createdAt,updatedAt,id,name,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.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:t.getCurrentUser().userProfileId,section:"Intervals",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",IntervalId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("interval@get",{fields:"createdAt,updatedAt,id,name,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("pause@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Pauses",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.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:t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.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:t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("tag@get",{fields:"createdAt,updatedAt,id,name,description,color",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Tags",fields:"createdAt,updatedAt,id,name,description,color",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("template@get",{fields:"createdAt,updatedAt,id,name,html,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Templates",fields:"createdAt,updatedAt,id,name,html,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1009})}]},authenticate:!0,permissionId:1009,bodyClass:"tools"}).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,t){return t.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:t.getCurrentUser().userProfileId,section:"Triggers",fields:"createdAt,updatedAt,id,name,channel,status,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("trigger@get",{fields:"createdAt,updatedAt,id,name,channel,status,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1010})}]},authenticate:!0,permissionId:1010,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,t){return t.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:t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){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:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("variable@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Variables",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1012})}]},authenticate:!0,permissionId:1012,bodyClass:"tools"}),t.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"]).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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:411})}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.agents",{url:"/agents",controller:"AgentsVoiceRealtimeController as vm",templateUrl:"app/main/apps/voice/views/realtime/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{nolimit:!0})}],agents:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("user@get",{fields:"id,name,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,mailPause,pauseType,lastPauseAt,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity",role:"agent",sort:"fullname",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Agents",fields:"id,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,mailPause,pauseType,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity",role:"agent",sort:"fullname",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:202})}],rpcAgents:["apiResolver",function(e){return e.resolve("rpc@getAgents")}]},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,t){return t.hasRole("admin")?e.resolve("user@get",{fields:"id,fullname,userpic,internal",role:"telephone",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Telephones",fields:"id,fullname,userpic,internal",role:"telephone",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("trunk@get",{fields:"id,name",active:!0,sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Trunks",fields:"id,name",active:!0,sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:1011})}],rpcTrunks:["apiResolver",function(e){return e.resolve("rpc@getTrunks")}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.queues",{url:"/queues",controller:"QueuesVoiceRealtimeController as vm",templateUrl:"app/main/apps/voice/views/realtime/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("voiceQueue@get",{type:"inbound",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"VoiceQueues",channel:"voice",type:"inbound",sort:"-updatedAt",limit:10,page:1})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:401})}],rpcQueues:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueues")}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.queue_calls",{url:"/queue_calls",controller:"QueueCallsVoiceRealtimeController as vm",templateUrl:"app/main/apps/voice/views/realtime/queue_calls/view.html",resolve:{agents:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("user@get",{fields:"id,name,role,context",role:"agent",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Agents",fields:"id,name,role,context",role:"agent",nolimit:!0})}],queues:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("voiceQueue@get",{type:"inbound",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"VoiceQueues",channel:"voice",type:"inbound",sort:"-updatedAt",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:401})}],rpcVoiceQueuesChannels:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueuesChannels")}]},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,t){return t.hasRole("admin")?e.resolve("user@get",{fields:"id,name,role,context",role:"agent",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Agents",fields:"id,name,role,context",role:"agent",nolimit:!0})}],queues:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("voiceQueue@get",{type:"inbound",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"VoiceQueues",channel:"voice",type:"inbound",sort:"-updatedAt",nolimit:!0})}],dispositions:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("disposition@get",{fields:"createdAt,updatedAt,id,name",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Dispositions",fields:"createdAt,updatedAt,id,name",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("voiceQueue@get",{type:"inbound",fields:"id,name",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"VoiceQueues",channel:"voice",type:"inbound",sort:"-updatedAt",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t,n,a){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,t){return t.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,mandatoryDisposition,mandatoryDispositionPauseId",type:"inbound",sort:"-updatedAt",channel:"voice",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.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,mandatoryDisposition,mandatoryDispositionPauseId",type:"inbound",sort:"-updatedAt",channel:"voice",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){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,mandatoryDisposition,mandatoryDispositionPauseId",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:401})}]},authenticate:!0,permissionId:401,bodyClass:"voice"}).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,t){return t.hasRole("admin")?e.resolve("voiceExtension@get",{fields:"createdAt,updatedAt,id,appdata,type,exten,context,description",type:"inbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"InboundRoutes",fields:"createdAt,updatedAt,id,appdata,type,exten,context,description",type:"inbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("voiceExtension@get",{fields:"createdAt,updatedAt,id,appdata,type,exten,context,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:402})}]},authenticate:!0,permissionId:402,bodyClass:"voice"}).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,t){return t.hasRole("admin")?e.resolve("voiceExtension@get",{fields:"createdAt,updatedAt,id,appdata,type,exten,context,recordingFormat,cutdigits,description",type:"outbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"OutboundRoutes",fields:"createdAt,updatedAt,id,appdata,type,exten,context,recordingFormat,cutdigits,description",type:"outbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("voiceExtension@get",{fields:"createdAt,updatedAt,id,appdata,type,exten,context,recordingFormat,cutdigits,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:403})}]},authenticate:!0,permissionId:403,bodyClass:"voice"}).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,t){return t.hasRole("admin")?e.resolve("voiceExtension@get",{fields:"createdAt,updatedAt,id,appdata,type,exten,context,description",type:"internal",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"InternalRoutes",fields:"createdAt,updatedAt,id,appdata,type,exten,context,description",type:"internal",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("voiceExtension@get",{fields:"createdAt,updatedAt,id,appdata,type,exten,context,description",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:404})}]},authenticate:!0,permissionId:404,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,t){return t.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:t.getCurrentUser().userProfileId,section:"Contexts",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",defaultEntry:"false",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.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:t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){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:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.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:t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return e.resolve("voiceMusicOnHold@get",{fields:"createdAt,updatedAt,id,name,mode,directory,application,format,sort",id:t.id})}],userProfileSection:["apiResolver","Auth",function(e,t){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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",function(e,t){return t.hasRole("admin")?e.resolve("voiceRecording@get",{fields:"createdAt,updatedAt,id,format,value,type,uniqueid,calleridnum,exten,connectedlinenum,queue,membername,rating,audio,userDisposition",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"VoiceRecordings",fields:"createdAt,updatedAt,id,format,value,type,uniqueid,calleridnum,exten,connectedlinenum,queue,membername,rating,audio,userDisposition",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.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:t.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,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.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,t){return t.hasRole("admin")?e.resolve("voicePrefix@get",{fields:"createdAt,updatedAt,id,name,VoiceExtensionId,callerIdAll,description",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"VoicePrefixes",fields:"createdAt,updatedAt,id,name,VoiceExtensionId,callerIdAll,description",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:t.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:t.getCurrentUser().userProfileId,sectionId:410})}]},authenticate:!0,permissionId:410,bodyClass:"voice"}),t.addPart("app/main/apps/voice")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],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.realtime"]).config(e)}(),function(){"use strict";angular.module("app.navigation",[]).config(function(){})}(),function(){"use strict";function e(e,t){e.addPart("app/quick-panel")}e.$inject=["$translatePartialLoaderProvider","msApiProvider"],angular.module("app.quick-panel",[]).config(e)}(),function(){"use strict";function e(e,t){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"}),t.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";function e(e){e.interceptors.push("authInterceptor")}e.$inject=["$httpProvider"],angular.module("app.auth").config(e)}(),function(){"use strict";function e(e,n,t,a){e.$on("$stateChangeStart",function(e,t){return t.hasOwnProperty("authenticate")&&t.authenticate&&!a.isLoggedIn()?(e.preventDefault(),n.go("app.login",{},{reload:!0,notify:!0})):a.isLoggedIn()&&t.hasOwnProperty("permissionId")&&t.permissionId&&!a.hasRole("admin")?a.reloadPermissions().then(function(){if(!a.hasPermission(t.permissionId))return e.preventDefault(),n.go("app.dashboards.general",{},{reload:!0,notify:!0})}).catch(function(){return e.preventDefault(),n.go("app.dashboards.general",{},{reload:!0,notify:!0})}):void 0})}e.$inject=["$rootScope","$state","$window","Auth"],angular.module("app.auth").run(e)}(),function(){"use strict";function e(a,i,s,o,t,r){var l,d=["id","role","fullname","name","internal","email","userpic","permissions","md5secret","phoneBarAutoAnswer","phoneBarAutoAnswerDelay","phoneBarEnableRecording","phoneBarEnableDtmfTone","voicePause","chatPause","mailPause","faxPause","smsPause","openchannelPause","phoneBarEnableSettings","phoneBarExpires","pauseType","showWebBar","phoneBarRemoteControlPort","phoneBarRemoteControl","lastLoginAt","lastPauseAt","crudPermissions","allowmessenger","passwordResetAt","alias","phoneBarPrefixRequired","hotdesk","userProfileId"];function c(e){var t=s.defer();return m("agent")&&0!==l.showWebBar?o.user.login({id:l.id,device:"web",intrf:e}).$promise.then(function(){console.log("AGENT LOGGED IN"),t.resolve()}).catch(function(e){console.error(e),t.reject(e)}):m("admin")||m("user")?o.user.update({id:l.id},{online:!0,lastLoginAt:moment().format("YYYY-MM-DD HH:mm:ss")}).$promise.catch(function(e){console.error(e)}).finally(function(){t.resolve()}):t.resolve(),t.promise}function n(){if(i.remove("motion.user"),i.remove("motion.token"),l&&l.id){var e=l.id;l=null,t.localStorage.removeItem("motion.user:"+e)}}function m(e){return!!l&&l.role===e}function u(e){return!!l&&_.includes(l.permissions,e)}function e(){return i.get("motion.token")}function p(e){return l=_.assign(l,_.pick(e,d)),i.put("motion.user",JSON.stringify(l)),m("user")&&g().then(function(e){l.permissions=e}),l}function g(){var i=[];return s(function(t,n){var a=[];return l||t(a),o.userProfileSection.get({userProfileId:l.userProfileId}).$promise.then(function(e){return i=e&&e.rows?e.rows:[],_.isEmpty(i)||(a=_.map(_.filter(i,function(e){return e.enabled}),function(e){return e.sectionId})),a}).then(function(t){if(_.includes(t,100)){var e=_.find(i,{sectionId:100});return e.autoAssociation?(t.push(101),t):o.userProfileResource.get({sectionId:e.id}).$promise.then(function(e){return(e&&e.rows?e.rows[0]:null)&&t.push(101),t})}return t}).then(function(t){if(_.includes(t,1003)||_.some(i,{enabled:!1,sectionId:1003})){var e=_.find(i,{sectionId:1003});return e.autoAssociation?o.dashboard.get().$promise.then(function(e){return(e&&e.rows?e.rows:[]).forEach(function(e){t.push(e.id+99999)}),t}):o.userProfileResource.get({sectionId:e.id}).$promise.then(function(e){return(e&&e.rows?e.rows:[]).forEach(function(e){t.push(e.resourceId+99999)}),t})}return t}).then(function(t){if(_.includes(t,1801)||_.some(i,{enabled:!1,sectionId:1801})){var e=_.find(i,{sectionId:1801});return e.autoAssociation?o.plugin.get().$promise.then(function(e){return(e&&e.rows?e.rows:[]).forEach(function(e){t.push(e.id+88888)}),t}):o.userProfileResource.get({sectionId:e.id}).$promise.then(function(e){return(e&&e.rows?e.rows:[]).forEach(function(e){t.push(e.resourceId+88888)}),t})}return t}).then(function(e){t(e)}).catch(function(e){n("Error retrieving user profile permissions",e)})})}function v(){return s(function(t,n){g().then(function(e){l.permissions=e,t()}).catch(function(e){n(e)})})}return function(){if(i.get("motion.user"))l=JSON.parse(i.get("motion.user")),o.user.get({id:l.id,fields:d.join(",")}).$promise.then(function(e){if(e)return p(e)}).catch(function(e){console.log("Error retrieving user",e)})}(),{login:function(e){var t,n=s.defer();return o.auth.local(e).$promise.then(function(e){return t=e,i.put("motion.token",e.token),o.user.get({id:e.id,fields:d.join(",")}).$promise}).then(function(e){(l=e).lastLoginAt=moment(),i.put("motion.user",JSON.stringify(e))}).then(function(){if(m("agent")&&1==l.showWebBar&&l.hotdesk)return a.show({controller:"HotDeskDialogController",controllerAs:"vm",templateUrl:"app/auth/services/hotdesk/dialog.html",parent:angular.element(r.body),clickOutsideToClose:!1,resolve:{telephones:["apiResolver","Auth",function(e,t){return e.resolve("user@get",{fields:"id,fullname,name,internal",role:"telephone",nolimit:!0})}]}})}).then(function(e){return c(e)}).catch(function(e){n.reject(e.data)}).finally(function(){o.user.get({id:t.id,fields:d.join(",")}).$promise.then(function(e){l=e,m("user")&&g().then(function(e){l.permissions=e}),n.resolve()}).catch(function(e){console.log("Error update user login",e),n.reject(e.data)})}),n.promise},logout:function(e){var t;return s.defer(),e?(n(),s.resolve()):(t=s.defer(),m("agent")&&0!==l.showWebBar?o.user.logout({id:l.id,device:"web"}).$promise.then(function(){console.log("AGENT LOGGED OUT")}).catch(function(e){console.error(e)}).finally(function(){t.resolve()}):m("admin")||m("user")?o.user.update({id:l.id},{online:!1}).$promise.catch(function(e){console.error(e)}).finally(function(){t.resolve()}):t.resolve(),t.promise).then(n).catch(function(e){console.error(e)})},queueLogin:c,isLoggedIn:function(){return!(!l||!e())},getPermissions:g,reloadPermissions:v,hasChildrenPermissions:function(e){return!!e&&_.some(e,function(e){return u(e)})},hasModulePermissions:function(i){return s(function(a,t){m("admin")?a(!0):o.userProfileSection.get({userProfileId:l.userProfileId}).$promise.then(function(e){var t=e&&e.rows?e.rows:[];if(_.isEmpty(t))a(!1);else{var n=_.filter(t,function(e){return e.enabled});a(_.some(n,["category",i]))}}).catch(function(e){t(e)})})},hasModulesPermissions:function(i){return s(function(n,t){var a={};m("admin")?(i.forEach(function(e){a[e]=!0}),n(a)):o.userProfileSection.get({userProfileId:l.userProfileId}).$promise.then(function(e){var t=e&&e.rows?e.rows:[];_.isEmpty(t)?n({}):(_(t).filter(function(e){return e.enabled&&_.includes(i,e.category)}).uniqBy(function(e){return e.category}).map(function(e){return e.category}).value().forEach(function(e){a[e]=!0}),n(a))}).catch(function(e){t(e)})})},hasRole:m,hasPermission:u,hasSectionPermissions:function(a){return s(function(e,t){var n={};return v().then(function(){_.includes(l.permissions,a)&&(n[a]=!0),e(n)}).catch(function(e){t(e)})})},hasSectionsPermissions:function(a){return s(function(e,t){var n={};if(!m("admin"))return v().then(function(){a.forEach(function(e){_.includes(l.permissions,e)&&(n[e]=!0)}),e(n)}).catch(function(e){t(e)});a.forEach(function(e){n[e]=!0}),e(n)})},getToken:e,getCurrentUser:function(){return l},parseCrudPermissions:function(e){return m("admin")?{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}},updateCurrentUser:p,removeCookies:n}}e.$inject=["$mdDialog","$cookies","$q","api","$window","$document"],angular.module("app.auth").factory("Auth",e)}(),function(){"use strict";function e(t,e){this.telephones=e,this.closeDialog=function(e){t.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(e,t,n,a,i){var s;return{request:function(e){var t=n.get("motion.token");return e.headers=e.headers||{},i.isSameOrigin(e.url)&&t&&(e.headers.Authorization="Bearer "+t),e},responseError:function(e){switch(e.status){case 401:n.remove("motion.user"),n.remove("motion.token"),(s||(s=a.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(t){var n={safeCb:function(e){return angular.isFunction(e)?e:angular.noop},urlParse:function(e){var t=document.createElement("a");return t.href=e,""===t.host&&(t.href=t.href),t},isSameOrigin:function(i,e){return i=n.urlParse(i),(e=(e=e&&[].concat(e)||[]).map(n.urlParse)).push(t.location),1<=(e=e.filter(function(e){var t=i.hostname===e.hostname,n=i.protocol===e.protocol,a=i.port===e.port||""===e.port&&("80"===i.port||"443"===i.port);return t&&n&&a})).length}};return n}e.$inject=["$window"],angular.module("app.auth").factory("Util",e)}(),function(){"use strict";angular.module("app.core").provider("motionConfig",function(){var n={disableCustomScrollbars:!1,disableMdInkRippleOnMobile:!0,disableCustomScrollbarsOnMobile:!0};this.config=function(e){n=angular.extend({},n,e)},this.$get=function(){var e={getConfig:function(e){if(angular.isUndefined(n[e]))return!1;return n[e]},setConfig:function(e,t){n[e]=t}};return e}})}(),function(){"use strict";function e(e,t,n,a){t.debugEnabled(!0),e.config({tabindex:!1}),a.config({disableCustomScrollbars:!1,disableCustomScrollbarsOnMobile:!0,disableMdInkRippleOnMobile:!0}),n.config({wheelPropagation:!0})}e.$inject=["$ariaProvider","$logProvider","msScrollConfigProvider","motionConfigProvider"],angular.module("app.core").config(e)}(),function(){"use strict";function e(e,t,n){(t.generate(),n.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(o,l,d){return{restrict:"E",compile:function(e,t){var s;return t.code||(s=e.html(),e.empty()),function(n,a,r){r.code&&(s=n.$eval(r.code));var i=n.$eval(r.shouldInterpolate);l.when(s).then(function(e){if(e){i&&(e=d(e)(n));var t=angular.element('<pre><code class="highlight" ng-non-bindable></code></pre>');a.append(t),o(function(){!function(e,t){var n=t.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/>",""),n.append(o.value).addClass("highlight")}(e,t)},34,!1)}})}}}}e.$inject=["$timeout","$q","$interpolate"],angular.module("app.core").directive("hljs",e)}(),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,t){e.cardTemplateLoaded=function(){e.$emit("msCard::cardTemplateLoaded",t)}}}}})}(),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(n,t,a,i,s,o,e,r,l){function d(e){switch(n.currentUser.showWebBar){case 0:return m("http://127.0.0.1:"+(n.currentUser.phoneBarRemoteControlPort||"9888")+"/api/originate/"+c(e));case 2:return t.$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")})})}n.currentUser=e.getCurrentUser(),n.showMenu=function(){return n.target&&n.target.indexOf("@")<0&&n.target!=n.currentUser.internal&&n.target!=n.currentUser.name&&(0==n.currentUser.showWebBar&&n.currentUser.phoneBarRemoteControl||2==n.currentUser.showWebBar&&n.license.webrtc)&&!n.disabled},n.call=function(e){return 2!==n.currentUser.showWebBar?(t=e,l.user.getVoicePrefixes({id:n.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:n.currentUser.phoneBarPrefixRequired}})}).then(function(e){n.currentUser.phoneBarPrefixRequired?e&&-1!==e&&d(e+t):e&&-1!==e?d(e+t):e||d(t)})):d(e);var t},n.transfer=function(e){switch(n.currentUser.showWebBar){case 0:return m("http://127.0.0.1:"+(n.currentUser.phoneBarRemoteControlPort||"9888")+"/api/transfer?number="+c(e));case 2:t.$broadcast("webrtc::transfer",{target:c(e)})}}}],templateUrl:"app/core/directives/ms-click-to-call/ms-click-to-call.html"}})}(),function(){"use strict";function e(i){return{require:"ngModel",priority:1,link:function(e,t,n,a){a.$formatters.push(i.formatter),a.$parsers.push(i.parser)}}}e.$inject=["msDatepickerFixConfig"],angular.module("app.core").provider("msDatepickerFixConfig",function(){var t={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){t=angular.extend({},t,e)},this.$get=function(){return t}}).directive("msDatepickerFix",e)}(),function(){"use strict";angular.module("app.core").directive("msDualMultiselect",function(){return{restrict:"E",scope:{options:"="},controller:["$scope",function(o){o.canTransfer=function(e,t,n){if(!t.readOnly)return void 0!==e.isValid&&e.isValid?n?o.transfer(t.selectedItems,t.items,t.selectedItems.indexOf(e),n):o.transfer(t.items,t.selectedItems,t.items.indexOf(e),n):void 0},o.transfer=function(e,t,n,a){var i=[];if(0<=n)i.push(e[n]),t.push(e[n]),e.splice(n,1);else{for(var s=0;s<e.length;s++)void 0!==e[s].isValid&&e[s].isValid&&t.push(e[s]);for(var s=e.length-1;0<=s;s--)e[s].isValid&&e.splice(s,1);i=t}o.options.transferCallback&&o.options.transferCallback(i,a)},o.getLine=function(e,t){var n="";if(_.isNil(t))return n;if(_.isArray(t)){for(var a=0;a<t.length;a++)n+=" "+(e[t[a]]?e[t[a]]:"");return n}return e[t]?e[t]:""}}],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(n,e){var t=e.emojioneArea({pickerPosition:n.pickerPosition,search:n.search,recentEmojis:n.recentEmojis,placeholder:a.instant(n.placeholder||"Type a message"),attributes:{spellcheck:!0},events:{keyup:function(e,t){n.ngModel=this.getText(),n.onReply({event:t,body:this.getText()})},emojibtn_click:function(){n.ngModel=this.getText()}}});n.ngModel&&t[0].emojioneArea.setText(n.ngModel),n.internalControl=n.ctrlMethods||{},n.internalControl.setText=function(e){t[0].emojioneArea.setText(e)},n.internalControl.getText=function(){return t[0].emojioneArea.getText()},n.$watch("ngModel",function(e){e||t[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:"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 t=this;function e(){return t.forms.length}function n(){return 0===t.selectedIndex}function a(){return t.selectedIndex===e()-1}t.forms=[],t.selectedIndex=0,t.registerForm=function(e){t.forms.push(e)},t.previousStep=function(){if(n())return;t.selectedIndex--},t.nextStep=function(){if(a())return;t.selectedIndex++},t.firstStep=function(){t.selectedIndex=0},t.lastStep=function(){t.selectedIndex=e()-1},t.totalSteps=e,t.isFirstStep=n,t.isLastStep=a,t.currentStepInvalid=function(){return angular.isDefined(t.forms[t.selectedIndex])&&t.forms[t.selectedIndex].$invalid},t.previousStepInvalid=function(){return 0<t.selectedIndex&&angular.isDefined(t.forms[t.selectedIndex-1])&&t.forms[t.selectedIndex-1].$invalid},t.formsIncomplete=function(){for(var e=0;e<t.forms.length;e++)if(t.forms[e].$invalid)return!0;return!1},t.resetForm=function(){for(var e=t.selectedIndex=0;e<t.forms.length;e++)t.forms[e].$setPristine(),t.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,t,n,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,t){var n=i.find("ms-info-bar-active"),a="ms-info-bar-active";n.addClass(a),e.removeInfoBar=function(){n.removeClass(a),t.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,t={columnCount:5,respectItemOrder:!1,reLayoutDebounce:400,responsive:{md:3,sm:2,xs:1}},n=!0;function i(){n&&e.cancel(n),n=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}),t=0;t<d.items.length;t++){var n,a,i,s,o=d.items[t];(o=angular.element(o)).scope()&&o.scope().$broadcast("msMasonryItem:startReLayout"),o.css({width:d.columnWidth}),d.options.respectItemOrder?(i=t%d.columnCount,s=e[i]):(s=Math.min.apply(Math,e),i=e.indexOf(s)),e[i]=s+o[0].getBoundingClientRect().height,n=Math.round(i*d.columnWidth),a=s,o.css({transform:"translate3d("+n+"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(t,d.options):t,r.$watch(function(){return d.container.width()},function(e,t){e!==t&&i()})},d.waitImagesLoaded=function(e,t){if("undefined"!=typeof imagesLoaded){var n=a.imagesLoaded(e);n.on("done",function(){t()})}else t()},r.$on("msMasonry:relayout",function(){i()})}function t(o){return{restrict:"AEC",controller:"msMasonryController",compile:function(i,s){return{pre:function(e,t,n,a){a.options=angular.fromJson(s.options||"{}"),a.container=i},post:function(e,t,n,a){o(function(){a.initialize()})}}}}}e.$inject=["$scope","$window","$mdMedia","$timeout"],t.$inject=["$timeout"],angular.module("app.core").controller("msMasonryController",e).directive("msMasonry",t).directive("msMasonryItem",function(){return{restrict:"AEC",require:"^msMasonry",priority:1,link:function(e,t,n,a){a.waitImagesLoaded(t,function(){a.reLayout()}),e.$on("msMasonryItem:finishReLayout",function(){e.$watch(function(){return t.height()},function(e,t){e!==t&&a.reLayout()})}),t.on("$destroy",function(){a.reLayout()})}}})}(),function(){"use strict";function e(n,e,a,i){var s=this;function o(e,t){s.selectedPalette=e,s.selectedHues=t}function r(){o(!(s.selectedColor={palette:"",hue:"",class:""}),!1),d()}function l(e,t){s.selectedColor={palette:e,hue:t,class:"md-"+e+"-"+t+"-bg",bgColorValue:i.rgba(s.palettes[e][t].value),fgColorValue:i.rgba(s.palettes[e][t].contrast)},"obj"!==s.msModelType||angular.equals(s.selectedColor,s.modelCtrl.$viewValue)||d(),o(e,s.palettes[e]),n.$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,n.$selectedColor={},s.activateHueSelection=o,s.selectColor=function(e,t){l(e,t),d(),a.hide()},s.removeColor=r,n.$watch("ngModel",function(){if(!s.modelCtrl.$viewValue||""===s.modelCtrl.$viewValue)return void r();var e,t;if("class"===s.msModelType){var n=s.modelCtrl.$viewValue.split("-");t=5<=n.length?(e=n[1]+"-"+n[2],n[3]):(e=n[1],n[2])}else"obj"===s.msModelType&&(e=s.modelCtrl.$viewValue.palette,t=s.modelCtrl.$viewValue.hue||500);l(e,t)})}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,t,n,a,i){var s=a[0];s.modelCtrl=a[1],s.msModelType=e.msModelType||"class",i(e,function(e){(e=e.filter(function(e,t){return 1===t.nodeType})).length&&t.find("ms-color-picker-button").replaceWith(e)})}}})}(),function(){"use strict";function e(p,g,v){return{restrict:"A",link:function(e,t,n){var a="true"===n.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=t.parent();function d(){s.addClass("ms-nav-folded"),g.$broadcast("msNav::forceCollapse"),t.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"),t.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"),t.off("mouseenter mouseleave")}v.setFoldable(e,t,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"),t.off("mouseenter mouseleave")})}}}function t(n,a,i){return{restrict:"E",scope:{},controller:"MsNavController",compile:function(e){return e.addClass("ms-nav"),function(e){n.$broadcast("msNav::expandMatchingToggles");var t=n.$on("$stateChangeSuccess",function(){n.$broadcast("msNav::expandMatchingToggles"),a.when("navigation").then(function(e){e.close(),i.isNavFoldedOpen()&&i.closeFolded()})});e.$on("$destroy",function(){t()})}}}}function n(m,u,p,g){return{restrict:"A",require:"^msNav",scope:!0,compile:function(e,t){return e.addClass("ms-nav-toggle"),angular.isUndefined(t.collapsed)&&(t.collapsed=!0),e.attr("collapsed",t.collapsed),function(a,i,e,n){var s={expanded:"expanded",expandAnimation:"expand-animation",collapseAnimation:"collapse-animation"},t=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 t=angular.element(i.find("ms-nav-toggle-items")[0]);t.css({position:"absolute",visibility:"hidden",display:"block",height:"auto"});var n=t[0].offsetHeight;return t.css({position:"",visibility:"",display:"",height:""}),a.$evalAsync(function(){p.animate(t,{display:"block",height:"0px"},{height:n+"px"},s.expandAnimation).then(function(){t.addClass(s.expanded),t.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 t=angular.element(i.find("ms-nav-toggle-items")[0]),n=t[0].offsetHeight;return a.$evalAsync(function(){p.animate(t,{height:n+"px"},{height:"0px"},s.collapseAnimation).then(function(){t.removeClass(s.expanded),t.css({display:"",height:""}),e.resolve({success:!0})})}),e.promise}angular.forEach(t,function(e){var t=angular.element(e).attr("ui-sref");angular.isUndefined(t)||(t=t.replace(r,""),o.push(t))}),n.setToggleItem(i,a),i.children(".ms-nav-button").on("click",function(){if(n.isDisabled())return;n.disable(),l()?(n.clearLockedItems(),a.$emit("msNav::pushToLockedList"),m.$broadcast("msNav::collapse"),d().then(function(){n.enable()})):a.$broadcast("msNav::forceCollapse")}),a.$on("$destroy",function(){i.children(".ms-nav-button").off("click")}),a.$on("msNav::collapse",function(){var e=n.getLockedItems(),t=!1;angular.forEach(e,function(e){angular.equals(e.scope,a)&&(t=!0)}),t||c().then(function(){n.enable()})}),a.$on("msNav::forceCollapse",function(){c().then(function(){n.enable()})}),a.$on("msNav::expandMatchingToggles",function(){var t=g.current.name,n=!1;angular.forEach(o,function(e){t===e&&(n=!0)}),n?d():c()}),a.$on("msNav::pushToLockedList",function(){n.setLockedItem(i,a)})}}}}e.$inject=["$document","$rootScope","msNavFoldService"],t.$inject=["$rootScope","$mdComponentRegistry","msNavFoldService"],n.$inject=["$rootScope","$q","$animate","$state"],angular.module("app.core").factory("msNavFoldService",function(){var n={};return{setFoldable:function(e,t){n={scope:e,element:t}},isNavFoldedOpen:function(){return n.scope.isNavFoldedOpen()},toggleFold:function(){n.scope.toggleFold()},openFolded:function(){n.scope.openFolded()},closeFolded:function(){n.scope.closeFolded()}}}).directive("msNavIsFolded",e).controller("MsNavController",function(){var e=this,t=!1,n=[],a=[];e.isDisabled=function(){return t},e.enable=function(){t=!1},e.disable=function(){t=!0},e.setToggleItem=function(e,t){n.push({element:e,scope:t})},e.getLockedItems=function(){return a},e.setLockedItem=function(e,t){a.push({element:e,scope:t})},e.clearLockedItems=function(){a=[]}}).directive("msNav",t).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",n)}(),function(){"use strict";function e(e,t){e.root?this.navigation=t.getNavigation(e.root):this.navigation=t.getNavigation(),this.toggleHorizontalMobileMenu=function(){angular.element("body").toggleClass("ms-navigation-horizontal-mobile-menu-active")},t.sort()}function t(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,t){var n=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"),n.addClass("ms-navigation-folded"),r();else{var t=p.getActiveItem();t&&t.scope.$emit("msNavigation::stateMatched"),n.removeClass("ms-navigation-folded ms-navigation-folded-open"),i.remove()}}function r(){t.parent().append(a),m(function(){a.on("mouseenter touchstart",l)})}function l(e){e&&e.preventDefault(),p.setFoldedOpen(!0);var t=p.getActiveItem();t&&t.scope.$emit("msNavigation::stateMatched"),n.addClass("ms-navigation-folded-open"),a.remove(),n.find("#main").append(i),i.on("mouseenter touchstart",d)}function d(e){e&&e.preventDefault(),p.setFoldedOpen(!1),c.$broadcast("msNavigation::collapse"),n.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")}),n.addClass("ms-navigation-folded"),r())}(),e.$watch(function(){return s.isLockedOpen()},function(e,t){if(!angular.isUndefined(e)&&!angular.equals(e,t)&&p.getFolded())if(e)c.$broadcast("msNavigation::collapse");else{var n=p.getActiveItem();n&&n.scope.$emit("msNavigation::stateMatched")}}),e.$watch("folded",function(e,t){angular.isUndefined(e)||angular.equals(e,t)||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 n(n,e,a,i,t,s){var o=this;o.element=e,o.node=n.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"),t=e[0].offsetHeight;n.$evalAsync(function(){o.collapsed=!0,o.element.addClass("collapsing"),i.animate(e,{display:"block",height:t+"px"},{height:"0px"},o.animateHeightClass).then(function(){e.css({display:"",height:""}),o.element.removeClass("collapsing")}),n.$broadcast("msNavigation::collapse")})},o.expand=function(){var e=o.element.children("ul");e.css({position:"absolute",visibility:"hidden",display:"block",height:"auto"});var t=e[0].offsetHeight;e.css({position:"",visibility:"",display:"",height:""}),n.$evalAsync(function(){o.collapsed=!1,o.element.addClass("expanding"),i.animate(e,{display:"block",height:"0px"},{height:t+"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===t.current.name||t.includes(o.node.state)){if(angular.isDefined(o.node.stateParams)&&angular.isDefined(t.params)&&!angular.equals(o.node.stateParams,t.params))return;n.$emit("msNavigation::stateMatched"),s.setActiveItem(o.node,n)}n.$on("msNavigation::stateMatched",function(){o.collapsable&&o.collapsed&&n.$evalAsync(function(){o.collapsed=!1})}),n.$on("msNavigation::collapse",function(e,t){if(!o.collapsed&&o.collapsable)if(angular.isUndefined(t))o.collapse();else{var n=t.split("."),a=[],i=s.getActiveItem();if(i&&(a=i.node._path.split(".")),-1<n.indexOf(o.node._id))return;if(-1<a.indexOf(o.node._id))return;o.collapse()}}),n.$on("$stateChangeSuccess",function(){if(o.node.state===t.current.name){if(angular.isDefined(o.node.stateParams)&&angular.isDefined(t.params)&&!angular.equals(o.node.stateParams,t.params))return;s.setActiveItem(o.node,n),a.$broadcast("msNavigation::collapse",o.node._path)}if(t.includes(o.node.state)){if(angular.isDefined(o.node.stateParams)&&angular.isDefined(t.params)&&!angular.equals(o.node.stateParams,t.params))return;n.$emit("msNavigation::stateMatched")}})}()}function a(t){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){t.setNavigationScope(e)}}}}function i(n,e,t,a,i){var s=this;s.element=e,s.node=n.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;n.$emit("msNavigation::stateMatched"),i.setActiveItem(s.node,n)}n.$on("msNavigation::stateMatched",function(){s.hasChildren&&n.$evalAsync(function(){s.isActive=!0})}),n.$on("msNavigation::clearActive",function(){if(s.hasChildren){var e=[],t=i.getActiveItem();t&&(e=t.node._path.split(".")),-1<e.indexOf(s.node._id)?n.$evalAsync(function(){s.isActive=!0}):n.$evalAsync(function(){s.isActive=!1})}}),n.$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,n),t.$broadcast("msNavigation::clearActive")}})}()}function s(i){return{restrict:"A",require:"^msNavigationHorizontalNode",compile:function(e){return e.addClass("ms-navigation-horizontal-item"),function(e,t,n,a){t.on("click",function(){if(!a.hasChildren||i("gt-md"))return;t.toggleClass("expanded")}),e.$on("$destroy",function(){t.off("click")})}}}}e.$inject=["$scope","msNavigationService"],t.$inject=["$rootScope","$timeout","$mdSidenav","msNavigationService"],n.$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 o(e,t){if(angular.isString(e)){for(var n=e.split("."),a=n[n.length-1],i=function(e){var t=l;if(1===e.length)return t;e.pop();for(var n=0;n<e.length;n++){for(var a=e[n],i=!0,s=0;s<t.length;s++)if(t[s]._id===a){t=t[s].children,i=!1;break}if(i){var o={_id:a,_path:e.join("."),title:a,weight:1,children:[]};t.push(o),t=o.children}}return t}(n),s=!1,o=0;o<i.length;o++)if(i[o]._id===a){s=i[o];break}s?(angular.extend(s,t),s.uisref=m(s)):(t.children=[],!angular.isUndefined(t.weight)&&angular.isNumber(t.weight)||(t.weight=1),t._id=a,t._path=e,t.uisref=m(t),i.push(t))}else r.error("path must be a string (eg. `dashboard.project`)")}function d(e){if(angular.isString(e)){for(var t=l,n=e.split("."),a=0;a<n.length;a++)for(var i=n[a],s=0;s<t.length;s++)if(t[s]._id===i){if(t[s]._path===e)return t.splice(s,1),!0;t=t[s].children;break}return!1}r.error("path must be a string (eg. `dashboard.project`)")}function c(e){e||(e=l).sort(a);for(var t=0;t<e.length;t++){var n=e[t].children;1<n.length&&n.sort(a),0<n.length&&c(n)}}function a(e,t){return parseInt(e.weight)-parseInt(t.weight)}function m(e){var t="";return angular.isDefined(e.state)&&(t=e.state,angular.isDefined(e.stateParams)&&angular.isObject(e.stateParams)&&(t=t+"("+angular.toJson(e.stateParams)+")")),t}this.saveItem=o,this.deleteItem=d,this.sortByWeight=c,this.$get=function(){var n=null,t=null,a=null,i=null,e={saveItem:o,deleteItem:d,sort:c,clearNavigation:function(){l=[],t&&(t.vm.navigation=l)},setActiveItem:function(e,t){n={node:e,scope:t}},getActiveItem:function(){return n},getNavigation:s,getFlatNavigation:function(e){return function e(t){var n=[];for(var a=0;a<t.length;a++){var i=angular.copy(t[a]);i.children=[],n.push(i),0<t[a].children.length&&(n=n.concat(e(t[a].children)))}return n}(s(e))},setNavigationScope:function(e){t=e},setFolded:function(e){a=e},getFolded:function(){return a},setFoldedOpen:function(e){i=e},getFoldedOpen:function(){return i},toggleFolded:function(){t.toggleFolded()}};return e;function s(e){if(e){for(var t=0;t<l.length;t++)if(l[t]._id===e)return[l[t]];return null}return l}}}).controller("MsNavigationController",e).directive("msNavigation",t).controller("MsNavigationNodeController",n).directive("msNavigationNode",function(){return{restrict:"A",bindToController:{node:"=msNavigationNode"},controller:"MsNavigationNodeController as vm",compile:function(e){return e.addClass("ms-navigation-node"),function(e,t,n,a){t.addClass(a.getClass()),a.group&&t.addClass("group")}}}}).directive("msNavigationItem",function(){return{restrict:"A",require:"^msNavigationNode",compile:function(e){return e.addClass("ms-navigation-item"),function(e,t,n,a){a.collapsable&&t.on("click",a.toggleCollapsed),e.$on("$destroy",function(){t.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,t,n,a){t.addClass(a.getClass()),a.group&&t.addClass("group")}}}}).directive("msNavigationHorizontalItem",s)}(),function(){"use strict";function e(i,n,s,e,a,o,t,r,l,d,c){var m=this,u=["ringingId","speakerId","microphoneId","ringingVolume","speakerVolume","microphoneVolume","ringingMute","speakerMute","microphoneMute"],p=JSON.parse(t.localStorage.getItem("motion2.user:"+m.conf.id))||{webrtc:{ringingVolume:.5,speakerVolume:.5,microphoneVolume:1,ringingMute:!1,speakerMute:!1,microphoneMute:!1}};function g(e){switch(e){case"ringing":m.conf.ringingMute?m.soundPlayer.muted=!0:m.soundPlayer.muted=!1,m.conf.ringingId&&m.soundPlayer.setSinkId(m.conf.ringingId).then(function(){m.soundPlayer.volume=m.conf.ringingVolume}).then(f).catch(function(e){console.info(e.message,m.conf.ringingId)});break;case"speaker":m.conf.speakerMute?m.remotePlayer.muted=!0:m.remotePlayer.muted=!1,m.conf.speakerId&&m.remotePlayer.setSinkId(m.conf.speakerId).then(function(){m.remotePlayer.volume=m.conf.speakerVolume}).then(f).catch(function(e){console.info(e.message,m.conf.speakerId)});break;case"microphone":for(var t=0;t<m.sessions.length;t+=1)m.conf.microphoneMute?m.sessions[t].mute():m.sessions[t].unmute();f();break;default:console.log("unknown device")}}function v(e,t,n){m.calls.unshift({target:e,fullname:n||e,inbound:t,time:moment().format("HH:mm")}),50<m.calls.length&&m.calls.pop()}function h(){return m.conf.license&&m.conf.isWebRTCSupported&&m.conf.hasMicrophone&&m.conf.hasSpeakers&&"https"===m.conf.protocol&&("chrome"===m.conf.browserName.toLowerCase()||"opera"===m.conf.browserName.toLowerCase()||"safari"===m.conf.browserName.toLowerCase())}function f(){p.webrtc=_.pick(m.conf,u),t.localStorage.setItem("motion2.user:"+m.conf.id,JSON.stringify(p))}function b(e){this.remotePlayer.srcObject=e.stream}function E(e){var t,n,a=e.session;switch(e.originator){case"local":a.outgoing=!0,a.name=e.request.ruri.user,a.user=e.request.ruri.user,v(a.user,!1);break;case"remote":a.incoming=!0,a.name=e.request.from.display_name,a.user=e.request.from.uri.user,t=e.session,n=t.name?t.name+" <"+t.user+">":t.user,c.create("Incoming call from: ",n,null,function(){t.answer(m.sessionConf)},function(){t.terminate()}).then(function(e){t.notification=e}).catch(function(e){console.error(e)}),v(e.session.user,!0),m.conf.autoAnswer&&s(function(){a.isInProgress()&&(a.autoAnswer=!0,m.conf.microphoneId?m.sessionConf.mediaConstraints.audio={deviceId:m.conf.microphoneId}:m.sessionConf.mediaConstraints.audio=!0,a.answer(m.sessionConf))},m.conf.autoAnswerDelay?1e3*m.conf.autoAnswerDelay:0)}a.call_id=e.request.call_id,a.connection&&(a.connection.onaddstream=b.bind(this)),a.on("progress",function(e,t){var n=!1;switch(t.originator){case"local":this.conf.ringingMute||(this.soundPlayer.setAttribute("src","assets/ms-phonebar/sounds/incoming-call.ogg"),n=!0);break;case"remote":this.putOtherCallsOnHold(e),this.soundPlayer.setAttribute("src","assets/ms-phonebar/sounds/outgoing-call.ogg"),n=!0}n&&(this.soundPlayer.loop="loop",this.soundPlayer.play().catch(function(e){console.log(e.message)}))}.bind(this,a)),a.on("confirmed",function(n,e){return n.confirmed=!0,"remote"===e.originator&&n.connection&&(n.connection.onaddstream=b.bind(this),_.head(n.connection.getRemoteStreams())&&(this.remotePlayer.srcObject=_.head(n.connection.getRemoteStreams()))),this.soundPlayer.pause(),this.soundPlayer.loop=null,this.putOtherCallsOnHold(n),g("speaker"),g("microphone"),n.autoAnswer&&(this.soundPlayer.setAttribute("src","assets/ms-phonebar/sounds/beep.ogg"),this.soundPlayer.play().catch(function(e){console.log(e.message)})),2==m.sessions.length?m.canGoInConference=!0:m.canGoInConference=!1,d.rpc.getVoiceChannels().$promise.then(function(e){var t=_.find(e.rows,function(e){return e.sipcalllinkedid===n.call_id?e:e.sipcalluniqueid===n.call_id?e:null});t&&(n.monitor=t.monitor,n.uniqueid=t.uniqueid,n.monitors=t.monitors)}).catch(function(e){console.error(e)})}.bind(this,a)),a.on("hold",function(e,t){"local"===t.originator&&(e.localHold=!0)}.bind(this,a)),a.on("unhold",function(e,t){"local"===t.originator&&(e.localHold=!1)}.bind(this,a)),a.on("ended",function(e,t){_.includes(m.currentConferenceSessions,e.id)&&T(),_.remove(this.sessions,{id:e.id})}.bind(this,a)),a.on("failed",function(e,t){this.soundPlayer.pause(),this.soundPlayer.loop=null,e.notification&&e.notification.close(),_.includes(m.currentConferenceSessions,e.id)&&T(),_.remove(this.sessions,{id:e.id})}.bind(this,a)),this.sessions.push(a)}function A(){m.target="",document.getElementById("ms-target").blur(),document.getElementById("ms-target").value="",i.$broadcast("angucomplete-alt:clearInput","ms-target-wrap")}function y(e,t,n,a){return function(){o.show(o.simple().textContent(t).position(n).hideDelay(a)),e.terminate()}}function S(t){return d.user.getVoicePrefixes({id:m.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(n.body),clickOutsideToClose:!0,locals:{prefixes:e,required:m.conf.phoneBarPrefixRequired}})}).then(function(e){if(m.conf.phoneBarPrefixRequired){if(e&&-1!==e)return e+t}else{if(e&&-1!==e)return e+t;if(!e)return t}})}function T(){m.canGoInConference=!1,m.isInConference=!1,m.currentconferenceSessions=[]}e(function(){},999),m.direction="right",m.selectedMode="md-scale",m.target="",m.showDialpad=!1,m.soundPlayer=document.createElement("audio"),m.remotePlayer=document.getElementById(m.conf.remotePlayerId),m.soundPlayer.volume=1,m.sessionConf={mediaConstraints:{audio:!0,video:!1}},m.sessions=[],m.calls=[],m.canGoInConference=!1,m.isInConference=!1,m.currentConferenceSessions=[],m.ua=new JsSIP.UA({sockets:[new JsSIP.WebSocketInterface("wss://"+m.conf.host+":8089/ws")],uri:new JsSIP.URI("sip",m.conf.name,m.conf.host,5060,null,null).toString(),authorization_user:m.conf.name,ha1:m.conf.ha1,realm:m.conf.realm,user_agent:m.conf.ua,session_timers_refresh_method:"invite",register_expires:m.conf.phoneBarExpires||60,register:!0}),m.conf=_.merge(p.webrtc,m.conf),n.bind("keyup",function(e){switch(e.keyCode){case 27:s(function(){m.showDialpad=!1})}}),m.$onInit=function(){g("ringing"),g("speaker"),this.ua.on("registered",function(){console.log("registered"),this.registered=!0}.bind(this)),this.ua.on("unregistered",function(){console.log("unregistered"),this.registered=!1}.bind(this)),this.ua.on("newRTCSession",E.bind(this)),DetectRTC.load(function(){this.conf.hasMicrophone=DetectRTC.hasMicrophone,this.conf.hasSpeakers="Chrome"!==DetectRTC.browser.name&&"Edge"!==DetectRTC.browser.name&&"Opera"!==DetectRTC.browser.name||DetectRTC.hasSpeakers,this.conf.isWebRTCSupported=DetectRTC.isWebRTCSupported,this.conf.osName=DetectRTC.osName,this.conf.osVersion=DetectRTC.osVersion,this.conf.browserName=DetectRTC.browser.name,this.conf.browserVersion=DetectRTC.browser.version,h()?this.ua.start():this.conf.license||l.warning({title:r.instant("TOOLBAR.WARNING"),msg:r.instant("TOOLBAR.WEBRTC_LICENSE_NOT_ENABELD"),clickToClose:!0,showClose:!0,shake:!1,timeout:!1,position:"bottom-right"})}.bind(this))}.bind(this),m.type=function(e,t){var n=e;switch(m.target||(m.target=""),t&&(m.target+=e,i.$broadcast("angucomplete-alt:changeInput","ms-target-wrap",m.target)),e){case"*":n="asterisk";break;case"#":n="pound"}m.conf.enableDtmfTone&&(m.soundPlayer.setAttribute("src","assets/ms-phonebar/sounds/dialpad/"+n+".ogg"),m.soundPlayer.play().catch(function(e){console.log(e.message)}));for(var a=0;a<m.sessions.length;a+=1)m.sessions[a].isEstablished()&&!m.sessions[a].isOnHold().local&&m.sessions[a].sendDTMF(e)},m.call=function(){if(m.target&&m.target!==m.conf.name&&m.target!==m.conf.internal){m.conf.microphoneId?m.sessionConf.mediaConstraints.audio={deviceId:m.conf.microphoneId}:m.sessionConf.mediaConstraints.audio=!0;var e=m.target.replace(/ /g,"");return S(e=(e=e.replace(/\(/g,"")).replace(/\)/g,"")).then(function(e){e&&m.ua.call(e,m.sessionConf)}).then(function(){A()})}},m.hold=function(e){e.hold({useUpdate:!1})},m.refer=function(t){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 S(e)}).then(function(e){t.refer(e,{eventHandlers:{requestSucceeded:y(t,"requestSucceeded","top right",3e3),requestFailed:y(t,"requestFailed","top right",3e3)}})})},m.record=function(e){a.show({controller:"RecordDialogController",controllerAs:"vm",templateUrl:"assets/ms-phonebar/record/dialog.html",parent:angular.element(n.body),clickOutsideToClose:!0,locals:{session:e,sessions:m.sessions}})},m.unhold=function(e){e.unhold({useUpdate:!1}),m.putOtherCallsOnHold(e)},m.answer=function(e){m.conf.microphoneId?m.sessionConf.mediaConstraints.audio={deviceId:m.conf.microphoneId}:m.sessionConf.mediaConstraints.audio=!0,e.answer(m.sessionConf)},m.terminate=function(e){e.terminate()},m.selectSession=function(e){e.unhold({useUpdate:!1}),m.putOtherCallsOnHold(e)},m.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"#":m.type(e.key);break;case"enter":m.call()}},m.toggleDialpad=function(){m.showDialpad=!m.showDialpad},m.referAttended=function(e){a.show({controller:"ReferAttendedDialogController",controllerAs:"vm",templateUrl:"assets/ms-phonebar/referAttended/dialog.html",parent:angular.element(n.body),clickOutsideToClose:!0,locals:{session:e,sessions:_.reject(m.sessions,{id:e.id})}})},m.closeDialpad=function(){m.showDialpad=!1},m.initDevice=g,m.putOtherCallsOnHold=function(e){if(1<m.sessions.length)for(var t=0;t<m.sessions.length;t+=1)m.sessions[t].id===e.id||m.sessions[t].isOnHold().remote||m.sessions[t].hold({useUpdate:!1})},m.targetChanged=function(e){e?/^(\w|\.|\+|#|\*|\(|\)|\s|\-)*$/.test(e)?(m.target=e,i.$broadcast("angucomplete-alt:changeInput","ms-target-wrap",m.target)):m.target?i.$broadcast("angucomplete-alt:changeInput","ms-target-wrap",m.target):A():A()},m.targetSelected=function(e){e&&(m.target=e.originalObject.target,m.call(),A())},m.start3WayConf=function(){m.isInConference=!0,m.canGoInConference=!1,m.confSessions=[];var a=[];m.sessions.forEach(function(e){m.currentConferenceSessions.push(e.id),e.unhold({useUpdate:!1}),null!=e&&e.connection.getReceivers().forEach(function(e){a.push(e.track)})});var i=new AudioContext,s=new MediaStream;m.sessions.forEach(function(e){if(null!=e){var n=i.createMediaStreamDestination();e.connection.getReceivers().forEach(function(t){a.forEach(function(e){s.addTrack(t.track),t.track.id!==e.id&&i.createMediaStreamSource(new MediaStream([e])).connect(n)})}),e.connection.getSenders().forEach(function(e){i.createMediaStreamSource(new MediaStream([e.track])).connect(n)}),e.connection.getSenders()[0].replaceTrack(n.stream.getTracks()[0])}});var e=document.getElementById("remote-audio");e.srcObject=s;var t=e.play();void 0!==t&&t.then(function(){}).catch(function(e){console.log(e)})},i.$on("webrtc::settings",function(e){a.show({controller:"SettingsController",controllerAs:"vm",templateUrl:"assets/ms-phonebar/settings/settings.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,resolve:{devices:function(){return navigator.mediaDevices.enumerateDevices()}},locals:{conf:m.conf}}).then(function(e){e&&(m.conf=e,g("ringing"),g("speaker"))})}),i.$on("webrtc::logout",function(){m.ua.stop()}),i.$on("webrtc::call",function(e,t){t.target&&(m.target=t.target,m.call())}),i.$on("webrtc::transfer",function(e,t){if(t.target)for(var n=0;n<m.sessions.length;n+=1)if(m.sessions[n].isEstablished()&&!m.sessions[n].isOnHold().local)return S(t.target).then(function(e){e&&m.sessions[n].refer(e,{eventHandlers:{requestSucceeded:y(m.sessions[n],"requestSucceeded","top right",3e3),requestFailed:y(m.sessions[n],"requestFailed","top right",3e3)}})})})}e.$inject=["$scope","$document","$timeout","$interval","$mdDialog","$mdToast","$window","$translate","toasty","api","motNotification"],angular.module("app.core").controller("MsPhonebarController",e).directive("msPhonebar",function(){return{restrict:"E",scope:{conf:"="},require:"msPhonebar",controller:"MsPhonebarController",controllerAs:"vm_pb",bindToController:!0,templateUrl:"assets/ms-phonebar/ms-phonebar.html"}})}(),function(){"use strict";function e(t,e,n){var a=this;a.prefixes=e,a.required=n,a.closeDialog=function(e){t.hide(e)},a.call=function(){t.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,t){function n(){t.css("display","inline"),i(a,1e3)}function a(){t.css("display","none"),i(n,1e3)}n()}],replace:!0}}function t(t,i,s,e,n){var o=this;function a(t,e){console.log("startMonitor");var n=i.defer(),a=(e||t.filename.replace(/^.*[\\\/]/,"")).split(".")[0];return s.rpc.startMonitor({uniqueid:o.session.uniqueid,filename:a,format:"wav"}).$promise.then(function(e){t.filename=a+".wav",t.mixmonitorid=e.mixmonitorid,t.status="rec",o.session.monitor=!0,n.resolve(t)}).catch(function(e){n.reject(e)}),n.promise}o.title="Record",o.sessions=e,o.session=n,o.closeDialog=function(){t.hide()},o.addRecording=function(){var e=t.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");t.show(e).then(function(e){return a({},e)}).then(function(e){o.session.monitors.push(e)})},o.stop=function(t){return console.log("stopMonitor"),s.rpc.stopMonitor({uniqueid:o.session.uniqueid,mixmonitorid:t.mixmonitorid}).$promise.then(function(e){t.status="pause",o.session.monitor=_.includes(o.session.monitors,{status:"rec"})}).catch(function(e){console.error(e)})},o.start=a}e.$inject=["$timeout"],t.$inject=["$mdDialog","$q","api","sessions","session"],angular.module("app.core").directive("msBlink",e).controller("RecordDialogController",t)}(),function(){"use strict";function e(t,a,i,e){var s=this;function o(e){t.hide(e)}s.title="Refer Attended",s.sessions=i,s.session=e,s.sessionTarget=null,i.length&&(s.target=i[0].user),s.closeDialog=o,s.transfer=function(){var e,t,n=_.find(i,function(e){if(e.user===s.target)return e});t=n.outgoing?(e=n,s.session):(e=s.session,n);t.refer(e.user,{replaces:e,eventHandlers:{requestSucceeded:function(e){a.show(a.simple().textContent("requestSucceeded").position("top right").hideDelay(3e3)),o(),t.terminate()},requestFailed:function(e){a.show(a.simple().textContent("requestFailed").position("top right").hideDelay(3e3)),o(),t.terminate()}}})}}e.$inject=["$mdDialog","$mdToast","sessions","session"],angular.module("app.core").controller("ReferAttendedDialogController",e)}(),function(){"use strict";function e(e,s,t){var n=this;function a(e,t,n){var a;if(s[n]){if(a=_.find(e,function(e){return e.deviceId===s[n]}))return a.deviceId;var i=_.findIndex(e,function(e){return e.kind===t});if(0<=i)return e[i].deviceId}else(a=_.find(e,function(e){return e.kind===t}))&&(s[n]=a.deviceId);return s[n]||null}s.ringingId=a(t,"audiooutput","ringingId"),s.speakerId=a(t,"audiooutput","speakerId"),s.microphoneId=a(t,"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,n.conf=angular.copy(s),n.devices=t,n.saveSettings=function(){e.hide(n.conf)},n.closeDialog=function(){e.hide()},n.isCompatibleBrowser=function(){return"chrome"===n.conf.browserName.toLowerCase()||"opera"===n.conf.browserName.toLowerCase()||"safari"===n.conf.browserName.toLowerCase()}}e.$inject=["$mdDialog","conf","devices"],angular.module("app.toolbar").controller("SettingsController",e)}(),function(){"use strict";angular.module("app.core").directive("msRandomClass",function(){return{restrict:"A",scope:{msRandomClass:"="},link:function(e,t){var n=e.msRandomClass[Math.floor(Math.random()*e.msRandomClass.length)];t.addClass(n)}}})}(),function(){"use strict";function e(i){return{restrict:"E",scope:{id:"=",model:"=",download:"="},replace:!0,link:function(t,e){var n=!1,a=document.createElement("audio");t.download||a.setAttribute("controlsList","nodownload"),a.setAttribute("preload","none"),a.setAttribute("controls",""),a.setAttribute("style","width: 265px;"),a.setAttribute("src"," "),a.onplay=function(e){n||(n=!0,e.preventDefault(),i[t.model||"voiceRecording"].download({id:t.id}).$promise.then(function(e){var t=[e.buffer],n=new Blob(t,{type:e.type});a.setAttribute("type",e.type),a.setAttribute("src",URL.createObjectURL(n)),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,t){var n=angular.element('<div class="ms-responsive-table-wrapper"></div>');t.after(n),n.append(t)}}})}(),function(){"use strict";function e(s,o,t,n){return{restrict:"AE",compile:function(e){if(!(n.getConfig("disableCustomScrollbars")||n.getConfig("disableCustomScrollbarsOnMobile")&&t.isMobile()))return e.addClass("ms-scroll"),function(e,t,n){var a={};function i(){PerfectScrollbar.update(t[0])}n.msScroll&&(a=e.$eval(n.msScroll)),a=angular.extend({},o.getConfig(),a),s(function(){PerfectScrollbar.initialize(t[0],a)},0),t.on("mouseenter",i),e.$watch(function(){return t.prop("scrollHeight")},function(e,t){angular.isUndefined(e)||angular.equals(e,t)||i()}),e.$watch(function(){return t.prop("scrollWidth")},function(e,t){angular.isUndefined(e)||angular.equals(e,t)||i()}),e.$on("$destroy",function(){t.off("mouseenter"),PerfectScrollbar.destroy(t[0])})}}}}e.$inject=["$timeout","msScrollConfig","msUtils","motionConfig"],angular.module("app.core").provider("msScrollConfig",function(){var t={wheelSpeed:1,wheelPropagation:!1,swipePropagation:!0,minScrollbarLength:null,maxScrollbarLength:null,useBothWheelAxes:!1,useKeyboard:!0,suppressScrollX:!1,suppressScrollY:!1,scrollXMarginOffset:0,scrollYMarginOffset:0,stopPropagationOnClick:!0};this.config=function(e){t=angular.extend({},t,e)},this.$get=function(){var e={getConfig:function(){return t}};return e}}).directive("msScroll",e)}(),function(){"use strict";function e(s,i,e){var o=this;o.collapsed=!0,o.query="",o.queryOptions={debounce:o.debounce||0};var t=!(!o.collapseOnBlur||"true"!=o.collapseOnBlur);o.resultsLoading=!1,o.results=null,o.selectedResultIndex=0,o.ignoreMouseEvents=!1,o.populateResults=function(e){if(o.collapsed)return;var t=angular.isArray(e),n=null===e;if(!t&&!n)return;o.selectedResultIndex=0,o.results=e},o.expand=function(){o.collapsed=!1,s.expand(),o.onExpand&&angular.isFunction(o.onExpand)&&o.onExpand()},o.collapse=function(){o.query="",o.populateResults(null),o.collapsed=!0,s.collapse(),o.onCollapse&&angular.isFunction(o.onCollapse)&&o.onCollapse()},o.blurCollapse=function(){if(!t)return;o.collapse()},o.absorbEvent=function(e){e.preventDefault()},o.handleKeydown=function(e){var t=e.keyCode;-1<[27,38,40].indexOf(t)&&e.preventDefault();switch(t){case 13:if(!o.results)return;o.handleResultClick(o.results[o.selectedResultIndex]);break;case 27:o.collapse();break;case 38:0<=o.selectedResultIndex-1&&(o.selectedResultIndex--,o.ensureSelectedResultIsVisible());break;case 40:if(!o.results)return;o.selectedResultIndex+1<o.results.length&&(o.selectedResultIndex++,o.ensureSelectedResultIsVisible())}},o.handleMouseenter=function(e){if(o.ignoreMouseEvents)return;o.selectedResultIndex=e},o.temporarilyIgnoreMouseEvents=function(){o.ignoreMouseEvents=!0,e.cancel(o.mouseEventIgnoreTimeout),o.mouseEventIgnoreTimeout=e(function(){o.ignoreMouseEvents=!1},250)},o.handleResultClick=function(e){o.onResultClick&&o.onResultClick({item:e});o.collapse()},o.ensureSelectedResultIsVisible=function(){var e=i.find(".ms-search-bar-results"),t=angular.element(e.find(".result")[o.selectedResultIndex]);if(e&&t){var n=t.position().top-8,a=t.position().top+t.outerHeight()+8;o.temporarilyIgnoreMouseEvents(),e.scrollTop()>n&&e.scrollTop(n),a>e.height()+e.scrollTop()&&e.scrollTop(a-e.height())}},s.$watch("MsSearchBar.query",function(e,t){if(!angular.isUndefined(e)&&!angular.equals(e,t)&&!o.collapsed){var n=s.$parent.$eval(o.onSearch,{query:e}),a=angular.isArray(n),i=n&&!!n.then;a&&o.populateResults(n),i&&(o.resultsLoading=!0,n.then(function(e){o.populateResults(e)},function(){o.populateResults([])}).finally(function(){o.resultsLoading=!1}))}})}function t(i){return{restrict:"E",scope:{},require:"msSearchBar",controller:"MsSearchBarController as MsSearchBar",bindToController:{debounce:"=?",onSearch:"@",onResultClick:"&?",onExpand:"&?",onCollapse:"&?",collapseOnBlur:"@"},templateUrl:"app/core/directives/ms-search-bar/ms-search-bar.html",compile:function(e){return e.addClass("ms-search-bar"),function(e,t){var n,a=i.find("body");e.collapse=function(){t.removeClass("expanded"),a.removeClass("ms-search-bar-expanded")},e.expand=function(){t.addClass("expanded"),a.addClass("ms-search-bar-expanded"),n.focus()},n=t.find("#ms-search-bar-input")}}}}e.$inject=["$scope","$element","$timeout"],t.$inject=["$document"],angular.module("app.core").controller("MsSearchBarController",e).directive("msSearchBar",t)}(),function(){"use strict";function e(e,n,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=[],t=l.getFlatNavigation(),n=r.defer(),a=0;a<t.length;a++)t[a].uisref&&e.push(t[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(){n.resolve(e)},250),n.promise},d.loadShortcuts=function(){var e=r.defer(),t=angular.fromJson(n.get("motion.shortcuts"));angular.isUndefined(t)&&(t=[{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}],n.put("motion.shortcuts",angular.toJson(t)));return e.resolve(t),e.promise},d.saveShortcuts=function(){var e=r.defer();return n.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 t=0;t<d.shortcuts.length;t++)d.shortcuts[t]._id===e._id&&(d.shortcuts.splice(t,1),d.query||(0===d.shortcuts.length?d.results=null:t>=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 t=e.keyCode;-1<[38,40].indexOf(t)&&e.preventDefault();switch(t){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"),t=angular.element(e.find(".result")[d.selectedResultIndex]);if(e&&t){var n=t.position().top-8,a=t.position().top+t.outerHeight()+8;d.temporarilyIgnoreMouseEvents(),e.scrollTop()>n&&e.scrollTop(n),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,t){angular.isUndefined(e)||angular.equals(e,t)||(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,t){}}}})}(),function(){"use strict";angular.module("app.core").directive("msSidenavHelper",function(){return{restrict:"A",require:"^mdSidenav",link:function(e,t,n,a){e.$watch(function(){return a.isOpen()&&!a.isLockedOpen()},function(e){angular.isUndefined(e)||(t.parent().toggleClass("full-height",e),angular.element("html").toggleClass("sidenav-open",e))})}}})}(),function(){"use strict";function e(a){return{restrict:"E",link:function(e,t){var n=e.$on("msSplashScreen::remove",function(){a.leave(t).then(function(){n(),e=t=null})})}}}e.$inject=["$animate"],angular.module("app.core").directive("msSplashScreen",e)}(),function(){"use strict";function e(e){var i=this;function t(){i.setCurrentStep(1)}function n(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)?!!n(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,t,n){var a={element:e,scope:t,form:n,stepNumber:t.step||i.steps.length+1,stepTitle:t.stepTitle,stepTitleTranslate:t.stepTitleTranslate};return i.steps.push(a),i.steps.sort(function(e,t){return e.stepNumber-t.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(),t()})},i.setCurrentStep=function(e){if(!o(e))return;if(i.currentStepNumber=e,"horizontal"===i.orientation){for(var t=0;t<i.steps.length;t++)i.steps[t].element.hide();i.steps[i.currentStepNumber-1].element.show()}else if("vertical"===i.orientation){for(var n=0;n<i.steps.length;n++)i.steps[n].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,t=e;1<=t;t--)if(!a(t)){e=t;break}i.setCurrentStep(e)},i.gotoNextStep=function(){for(var e=i.currentStepNumber+1,t=e;t<=i.steps.length;t++)if(!a(t)){e=t;break}i.setCurrentStep(e)},i.gotoFirstStep=t,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 t=!1,n=1;n<e;n++)if(!s(n)){t=!0;break}return t},i.isStepOptional=n,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 t(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,t,n,a){var i=a[0],s=a[1];o(function(){s.setOrientation("vertical"),s.registerMainForm(i),s.setupSteps()})}}}}e.$inject=["$timeout"],t.$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,t,n,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,t,n,a){var i=a[0],s=a[1];e.optionalStep=angular.isDefined(n.optionalStep),s.registerStep(t,e,i),t.hide()}}}}).directive("msVerticalStepper",t).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,t,n,a){var i=a[0],s=a[1];e.optionalStep=angular.isDefined(n.optionalStep),e.stepInfo=s.registerStep(t,e,i),e.MsStepper=s,t.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,t){}}}}e.$inject=["$document"],angular.module("app.core").controller("MsTabScrollController",function(){function t(){var e=document.getElementById("bar-container"),t=document.getElementById("tab-container");return t.scrollWidth>e.scrollWidth&&0==e.scrollLeft&&0==t.scrollLeft?"right":t.scrollWidth>e.scrollWidth&&t.scrollLeft>e.scrollLeft&&e.scrollWidth+t.scrollLeft>=t.scrollWidth?"left":t.scrollWidth>e.scrollWidth&&t.scrollLeft>e.scrollLeft&&e.scrollWidth+t.scrollLeft<t.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(t()){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,n,t,a){var i=72,s=!1,o=!1,r=a.getScrollEl();!function(){n.find("ms-card")?e.$on("msCard::cardTemplateLoaded",function(e,t){var n=angular.element(t[0]);d(n).then(function(){m(function(){s=!0})})}):d(n).then(function(){m(function(){s=!0})});r.on("scroll",c),c()}();var l=e.$watch(function(){return s&&o},function(e,t){angular.equals(e,t)||e&&(n.removeClass("hidden").addClass("animate"),l())},!0);function d(e){var t=u.defer(),n=e.find("img");return 0<n.length?n.on("load",function(){t.resolve("Image is loaded")}):t.resolve("No images"),t.promise}function c(){r.scrollTop()+r.height()>n.position().top+i&&(m(function(){o=!0}),r.off("scroll",c))}}}}}e.$inject=["$timeout","$q"],angular.module("app.core").controller("MsTimelineController",function(){var t=this;t.scrollEl=void 0,t.setScrollEl=function(e){t.scrollEl=e},t.getScrollEl=function(){return t.scrollEl}}).directive("msTimeline",function(){return{scope:{msTimeline:"=?",loadMore:"&?msTimelineLoadMore"},controller:"MsTimelineController",compile:function(e){return e.addClass("ms-timeline"),function(e,t,n,a){var i=angular.element('<div class="ms-timeline-loader md-accent-bg md-whiteframe-4dp"><span class="spinner animate-rotate"></span></div>');t.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().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(a,e,t,n,i,s,o,r,l){function d(){a.timeoutId&&clearTimeout(a.timeoutId)}function c(){void 0!==o.startTime&&(a.millis=moment().diff(moment(a.startTime))),a.maxTimeUnit&&"day"!==a.maxTimeUnit?"second"===a.maxTimeUnit?(a.seconds=Math.floor(a.millis/1e3),a.minutes=0,a.hours=0,a.days=0,a.months=0,a.years=0):"minute"===a.maxTimeUnit?(a.seconds=Math.floor(a.millis/1e3%60),a.minutes=Math.floor(a.millis/6e4),a.hours=0,a.days=0,a.months=0,a.years=0):"hour"===a.maxTimeUnit?(a.seconds=Math.floor(a.millis/1e3%60),a.minutes=Math.floor(a.millis/6e4%60),a.hours=Math.floor(a.millis/36e5),a.days=0,a.months=0,a.years=0):"month"===a.maxTimeUnit?(a.seconds=Math.floor(a.millis/1e3%60),a.minutes=Math.floor(a.millis/6e4%60),a.hours=Math.floor(a.millis/36e5%24),a.days=Math.floor(a.millis/36e5/24%30),a.months=Math.floor(a.millis/36e5/24/30),a.years=0):"year"===a.maxTimeUnit&&(a.seconds=Math.floor(a.millis/1e3%60),a.minutes=Math.floor(a.millis/6e4%60),a.hours=Math.floor(a.millis/36e5%24),a.days=Math.floor(a.millis/36e5/24%30),a.months=Math.floor(a.millis/36e5/24/30%12),a.years=Math.floor(a.millis/36e5/24/365)):(a.seconds=Math.floor(a.millis/1e3%60),a.minutes=Math.floor(a.millis/6e4%60),a.hours=Math.floor(a.millis/36e5%24),a.days=Math.floor(a.millis/36e5/24),a.months=0,a.years=0),a.secondsS=1===a.seconds||0===a.seconds?"":"s",a.minutesS=1===a.minutes||0===a.minutes?"":"s",a.hoursS=1===a.hours||0===a.hours?"":"s",a.daysS=1===a.days||0===a.days?"":"s",a.monthsS=1===a.months||0===a.months?"":"s",a.yearsS=1===a.years||0===a.years?"":"s",a.sseconds=a.seconds<10?"0"+a.seconds:a.seconds,a.mminutes=a.minutes<10?"0"+a.minutes:a.minutes,a.hhours=a.hours<10?"0"+a.hours:a.hours,a.ddays=a.days<10?"0"+a.days:a.days,a.mmonths=a.months<10?"0"+a.months:a.months,a.yyears=a.years<10?"0"+a.years:a.years}"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),a.autoStart=o.autoStart||o.autostart,0===r.html().trim().length?r.append(l("<span>{{millis}}</span>")(a)):r.append(l(r.contents())(a)),a.interval=a.intervalAttr||1e3,a.startTime=null,a.endTime=null,a.timeoutId=null,a.countdown=a.countdownAttr&&0<=parseInt(a.countdownAttr,10)?parseInt(a.countdownAttr,10):void 0,a.isRunning=!1,a.$watch("startTimeAttr",function(e,t){e!==t&&a.isRunning&&a.start()}),a.$on("timer-start",function(){a.start()}),a.$on("timer-resume",function(){a.resume()}),a.$on("timer-stop",function(){a.stop()}),a.$on("timer-clear",function(){a.clear()}),a.$on("timer-set-countdown",function(e,t){a.countdown=t}),a.start=r[0].start=function(){var e=moment(),t=a.startTimeAttr?moment(a.startTimeAttr):null;a.startTime=!t||e<t?e:t;var n=a.endTimeAttr?moment(a.endTimeAttr):null;a.endTime=!n||n<e?null:n,a.countdown||(a.countdown=a.countdownAttr&&0<parseInt(a.countdownAttr,10)?parseInt(a.countdownattr,10):void 0),d(),m(),a.isRunning=!0},a.resume=r[0].resume=function(){d(),a.countdownAttr&&(a.countdown+=1),a.startTime=moment().diff(moment(a.stoppedTime).diff(moment(a.startTime))),m(),a.isRunning=!0},a.stop=a.pause=r[0].stop=r[0].pause=function(){a.clear(),a.$emit("timer-stopped",{timeoutId:a.timeoutId,millis:a.millis,seconds:a.seconds,minutes:a.minutes,hours:a.hours,days:a.days})},a.clear=r[0].clear=function(){a.stoppedTime=moment(),d(),a.timeoutId=null,a.isRunning=!1},r.bind("$destroy",function(){d(),a.isRunning=!1});var m=function(){a.millis=moment().diff(a.startTime);var e=a.millis%1e3;if(a.endTimeAttr&&(a.millis=moment(a.endTime).diff(moment()),e=a.interval-a.millis%1e3),a.countdownAttr&&(a.millis=1e3*a.countdown),a.millis<0)return a.stop(),a.millis=0,c(),void(a.finishCallback&&a.$eval(a.finishCallback));c(),a.timeoutId=setTimeout(function(){m(),a.$digest()},a.interval-e),a.$emit("timer-tick",{timeoutId:a.timeoutId,millis:a.millis}),0<a.countdown?a.countdown--:a.countdown<=0&&(a.stop(),a.finishCallback&&a.$eval(a.finishCallback))};void 0!==a.autoStart&&!0!==a.autoStart||a.start()}e.$inject=["$scope","$document","$timeout","$interval","$window","$translate","$attrs","$element","$compile"],angular.module("app.core").controller("MsTimerController",e).directive("timer",function(){return{restrict:"EA",replace:!1,scope:{intervalAttr:"=interval",startTimeAttr:"=startTime",endTimeAttr:"=endTime",countdownAttr:"=countdown",autoStart:"&autoStart",maxTimeUnit:"="},controller:"MsTimerController"}})}(),function(){"use strict";angular.module("app.core").directive("msTimezone",function(){return{restrict:"E",scope:{ngModel:"="},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"]}]}],templateUrl:"app/core/directives/ms-timezone/ms-timezone.html"}})}(),function(){"use strict";angular.module("app.core").controller("MsWidgetEngineCounterController",function(){var a=this;a.filter=[],a.filtered=!1,a.fontSize=20,a.getCount=function(e){var t=0;if(e){a.fontSize=e.attrs[2]&&e.attrs[2].value?parseInt(e.attrs[2].value)-parseInt(e.attrs[2].value)%2:20,e.attrs[1].value&&e.attrs[1].value.length?(a.filtered=!0,a.filter=_.intersection(e.voiceQueuesSelected,e.attrs[1].value)):(a.filtered=!1,a.filter=e.voiceQueuesSelected);for(var n=0;n<e.voiceQueues.rows.length;n+=1)_.includes(a.filter,e.voiceQueues.rows[n].id)&&(t+=e.voiceQueues.rows[n][e.attrs[0].value]?parseInt(e.voiceQueues.rows[n][e.attrs[0].value]):0)}return t}})}(),function(){"use strict";function e(o,e){var r=this;r.filter=[],r.filtered=!1,r.properties=[],r.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"}}]}}},r.getMultiBarChart=function(e){e&&(e.attrs&&function(e){r.properties=_.map(_.filter(e.attrs,function(e){return e.name&&0<=e.name.indexOf("attrSerie")&&e.value&&"null"!==e.value}),"value"),e.attrs[3].value&&e.attrs[3].value.length?(r.filtered=!0,r.filter=_.intersection(e.voiceQueuesSelected,e.attrs[3].value)):(r.filtered=!1,r.filter=e.voiceQueuesSelected);if(r.multiBarChart.series.length>r.properties.length){var t=r.multiBarChart.series.length-r.properties.length;r.multiBarChart.series.splice(0,t),r.multiBarChart.data.splice(0,t)}for(var n=0;n<r.properties.length;n+=1){if(r.multiBarChart.series[n]=o.instant("TOOLS."+r.properties[n].toUpperCase()),_.isNil(r.multiBarChart.data[n])&&(r.multiBarChart.data[n]=[]),r.multiBarChart.labels.length>r.filter.length){var a=r.multiBarChart.labels.length-r.filter.length;r.multiBarChart.labels.splice(0,a),r.multiBarChart.data[n].splice(0,a)}for(var i=0,s=0;i<e.voiceQueues.rows.length;i+=1)_.includes(r.filter,e.voiceQueues.rows[i].id)&&(r.multiBarChart.labels[s]=e.voiceQueues.rows[i].name,r.multiBarChart.data[n][s]=e.voiceQueues.rows[i][r.properties[n]]?parseInt(e.voiceQueues.rows[i][r.properties[n]]):0,s+=1)}}(e),e.foreground&&function(e){r.multiBarChart.options.legend.fontColor=e.foreground;for(var t=0;t<r.multiBarChart.options.scales.xAxes.length;t+=1)r.multiBarChart.options.scales.xAxes[t].ticks.fontColor=e.foreground;for(var n=0;n<r.multiBarChart.options.scales.yAxes.length;n+=1)r.multiBarChart.options.scales.yAxes[n].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){o.properties=_.map(_.filter(e.attrs,function(e){return e.name&&0<=e.name.indexOf("attrSerie")&&e.value&&"null"!==e.value}),"value"),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 t=o.pieChart.labels.length-o.properties.length;o.pieChart.labels.splice(0,t),o.pieChart.data.splice(0,t)}for(var n=0,a=0;n<o.properties.length;n+=1){o.pieChart.labels[n]=s.instant("TOOLS."+o.properties[n].toUpperCase());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[n]]?parseInt(e.voiceQueues.rows[i][o.properties[n]]):0);o.pieChart.data[n]=a,a=0}}(e),e.foreground&&(t=e,o.pieChart.options.legend.fontColor=t.foreground));var t}}e.$inject=["$translate"],angular.module("app.core").controller("MsWidgetEnginePieChartController",e)}(),function(){"use strict";function e(e,n,a,i){var s=this;function t(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,t).$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(t){t&&t.attrs&&(t.attrs[0]&&t.attrs[0].value&&(s.query.id=t.attrs[0].value,i.analyticFieldReport.get({fields:"field,alias",nolimit:!0,DefaultReportId:"default"===t.attrs[0].type?t.attrs[0].value:void 0,CustomReportId:"custom"===t.attrs[0].type?t.attrs[0].value:void 0}).$promise.then(function(e){switch(e&&e.rows&&(s.columns=e.rows),t.attrs[0].type){case"default":s.reportRoute="analyticDefaultReport";break;case"custom":s.reportRoute="analyticCustomReport"}return i[s.reportRoute].get({id:t.attrs[0].value,fields:"id,name"}).$promise}).then(function(e){e&&e.name&&(s.title=e.name),o()}).catch(function(e){console.log(e)})),t.attrs[1]&&t.attrs[1].value&&(s.refresh=parseInt(t.attrs[1].value),!_.isNaN(s.refresh)&&0<s.refresh?(s.countDown=parseInt(t.attrs[1].value),s.interval=a(function(){s.countDown-=1},1e3,0),s.timeout=n(function(){s.interval&&a.cancel(s.interval),e(t)},1e3*s.refresh)):(s.interval&&a.cancel(s.interval),s.timeout&&n.cancel(s.timeout))))},s.getResults=o,s.valueReplacer=function(e,t){moment(t,"YYYY-MM-DDTHH:mm:ssZ",!0).isValid()&&(t=moment(t,"").format("YYYY-MM-DD HH:mm:ss"));return t},e.$on("$destroy",function(){s.interval&&a.cancel(s.interval),s.timeout&&n.cancel(s.timeout)})}e.$inject=["$scope","$timeout","$interval","api"],angular.module("app.core").controller("MsWidgetEngineWebReportController",e)}(),function(){"use strict";function e(e,t){this.getTrustedURL=function(e){return t.trustAsResourceUrl(e)}}function t(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"],t.$inject=["$document"],angular.module("app.core").controller("MsWidgetEngineController",e).directive("msWidgetEngine",t)}(),function(){"use strict";function e(e,t){var n=this;n.flipped=!1,n.flip=function(){if(!angular.isDefined(e.flippable)||!0!==e.flippable)return;n.flipped=!n.flipped,t.toggleClass("flipped",n.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,t,n,a,i){i(function(e){t.empty(),t.append(e)})}}}}).directive("msWidgetFront",function(){return{restrict:"E",require:"^msWidget",transclude:!0,compile:function(e){return e.addClass("ms-widget-front"),function(e,t,n,a,i){i(function(e){t.empty(),t.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,t,n,a,i){i(function(e){t.empty(),t.append(e)}),e.flipWidget=a.flip}}}})}(),function(){"use strict";angular.module("app.core").filter("altDate",function(){return function(e){var t=Date.now()-new Date(e);return t<36e5?moment(e).fromNow():t<864e5?moment(e).format("HH:mm"):t<6048e5?moment(e).format("dddd"):moment(e).calendar()}})}(),function(){"use strict";function e(t){return function(e){return t.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("filterByIds",function(){return function(e,t){if(0===e.length||!t)return e;if(0===t.length)return[];for(var n=[],a=0;a<e.length;a++){for(var i=e[a],s=!1,o=0;o<t.length;o++){var r=t[o];if(i.id===r){s=!0;break}}s&&n.push(i)}return n}})}(),function(){"use strict";angular.module("app.core").filter("filterByPropIds",function(){return function(e,t,n){if(0===e.length||!n||0===n.length)return e;for(var a=[],i=0;i<e.length;i++){for(var s=e[i],o=!1,r=0;r<n.length;r++){var l=n[r];if(-1<s[t].indexOf(l)){o=!0;break}}o&&a.push(s)}return a}})}(),function(){"use strict";angular.module("app.core").filter("filterByTags",function(){return function(e,n){if(0===e.length||0===n.length)return e;var a=[];return e.forEach(function(e){var t=n.every(function(t){var n=!1;return e.tags.forEach(function(e){e.name!==t.name||(n=!0)}),n});t&&a.push(e)}),a}}).filter("filterSingleByTags",function(){return function(e,t){if(0!==e.length&&0!==t.length){if(e.length<t.length)return[];var n=[],a=t.every(function(t){var n=!1;return e.forEach(function(e){e.name!==t.name||(n=!0)}),n});return a&&n.push(e),n}}})}(),function(){"use strict";function c(e,t,n,a){this.id=Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),this.title=e,this.body=t,this.accept=n,this.reject=a,this.close=i}function m(){return/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}function i(){var n=this;navigator.serviceWorker.ready.then(function(e){e.getNotifications().then(function(e){var t=_.find(e,function(e){return e.data.id===n.id});t&&t.close()})})}angular.module("app.dashboards").provider("motNotification",function(){return{$get:[function(){var l,n,d=[];"serviceWorker"in navigator&&m()?navigator.serviceWorker.register("notification.js").then(function(e){(l=e).update(),l.installing?n=l.installing:l.waiting?n=l.waiting:l.active&&(n=l.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===n){var t=_.find(d,{id:e.data.id});if(t)switch(e.data.action){case"accept":t.accept&&t.accept();break;case"reject":t.reject&&t.reject()}}}),{create:function(e,i,s,o,r){return new Promise(function(t,n){var a;m()&&(window.document.hidden||window.document.mozHidden||window.document.webkitHidden)?(a=new c(e||"MyTitle",i||"MyBody",o,r),d.push(a),a?window.Notification.requestPermission().then(function(e){if("granted"===e)return l.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){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,t){var n=e.split("@"),a=n[0],i=n[1],s=t||{};if(!a||!i)return d.error("apiResolver.resolve requires correct action parameter (ResourceName@methodName)"),!1;var o=l.defer(),r=function(e){for(var t=e.split("."),n=c,a=0;a<t.length;a++){if(angular.isUndefined(n[t[a]])){d.error('Resource part "'+t[a]+'" is not defined!'),n=!1;break}n=n[t[a]]}return n||!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";angular.module("app.core").provider("msApi",function(){var n=angular.injector(["ng"]).get("$log"),a="",v=[];function t(e){a=e}function i(){return a}function s(e,t){angular.isString(e)?angular.isArray(t)?v[e]={url:a+(t[0]||""),paramDefaults:t[1]||[],actions:t[2]||[],options:t[3]||{}}:n.error('"resource" must be an array and it must follow $resource definition'):n.error('"path" must be a string (eg. `dashboard.project`)')}this.setBaseUrl=t,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:t,getBaseUrl:i,register:s,resolve:function(e,t){g.$broadcast("msApi::resolveStart");var n=e.split("@"),a=n[0],i=n[1],s=t||{};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,t,n,a){g.$broadcast("msApi::requestStart");var i=e.split("@"),s=i[0],o=i[1],r=t||{};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(n)&&angular.isFunction(n)&&n(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,t){return-1<t.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"}],t=[{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 n(e){for(var t=0;t<e.length;t++){var n=e[t].string,a=e[t].prop;if(i=e[t].versionSearch||e[t].identity,n){if(-1!==n.indexOf(e[t].subString))return e[t].identity}else if(a)return e[t].identity}}function a(e){var t=e.indexOf(i);if(-1!==t)return parseInt(e.substring(t+i.length+1))}var s=n(e)||"unknown-browser",o=a(l.navigator.userAgent)||a(l.navigator.appVersion)||"unknown-version",r=n(t)||"unknown-os";return s=s.toLowerCase(),o=s+"-"+o,r=r.toLowerCase(),d={browser:s,version:o,os:r}},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,t){-1===t.indexOf(e)?t.push(e):t.splice(t.indexOf(e),1)}}}e.$inject=["$window"],angular.module("app.core").factory("msUtils",e)}(),function(){"use strict";function e(e,t){var n=this;n.themes=t.themes,n.layoutModes=[{label:"Boxed",value:"boxed"},{label:"Wide",value:"wide"}],n.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"}],n.layoutMode="wide",n.layoutStyle=e.get("motion.layoutStyle")||"verticalNavigation",n.setActiveTheme=function(e){t.setActiveTheme(e)},n.getActiveTheme=function(){return t.themes.active},n.updateLayoutMode=function(){angular.element("body").toggleClass("boxed","boxed"===n.layoutMode)},n.updateLayoutStyle=function(){e.put("motion.layoutStyle",n.layoutStyle),location.reload()}}function t(t){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(){t("motion-theme-options").toggle()}}}}}e.$inject=["$cookies","motionTheming"],t.$inject=["$mdSidenav"],angular.module("app.core").controller("MsThemeOptionsController",e).directive("msThemeOptions",t)}(),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(n){o[n.name]={},angular.forEach(n.colors,function(e,t){o[n.name][t]={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 t=angular.copy(e);angular.forEach(t,function(n){angular.forEach(n,function(e,t){n[t]=e.levels,n[t].color=e.levels.default.color,n[t].contrast1=e.levels.default.contrast1,n[t].contrast2=e.levels.default.contrast2,n[t].contrast3=e.levels.default.contrast3,n[t].contrast4=e.levels.default.contrast4,delete n[t].default})}),s.setThemesList(t);var n=i.get("motion.selectedTheme");n?s.setActiveTheme(n):s.setActiveTheme("default")}(o);var r={};angular.forEach(o,function(e,t){var n,a,i,s,o;(r={})["@themeName"]=t,angular.forEach(e,function(e,a){angular.forEach(e.levels,function(e,n){angular.forEach(e,function(e,t){r["@"+a+d(n)+d(t)]=e})})}),n=r,a=new RegExp(Object.keys(n).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 n[e]}),s=angular.element("head"),(o=angular.element('<style type="text/css"></style>')).html(i),s.append(o)})},rgba:l};function l(e,t){var n=t||!1;return 4===e.length&&255===e[0]&&255===e[1]&&255===e[2]&&e.splice(3,4),n&&(e=function(e,t){var n={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]=n.white[t]:0===e[0]&&0===e[1]&&0===e[2]&&(e[3]=n.black[t]);return e}(e,n)),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(n,e,t){var a;angular.injector(["ngCookies"]).invoke(["$cookies",function(e){a=e}]);var i=a.getObject("motion.customTheme");i&&(t.custom=i),n.alwaysWatchTheme(!0),angular.forEach(e,function(e){n.definePalette(e.name,e.options)}),angular.forEach(t,function(e,t){n.theme(t).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(t,n,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 n.error('You must have at least one theme named "default"'):(n.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 t.put("motion.selectedTheme",a.themes.active.name));a.themes.active.name=e,a.themes.active.theme=a.themes.list[e],t.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(t,s,o,r){this.search=function(t){for(var e=[],n=r.getFlatNavigation(),a=o.defer(),i=0;i<n.length;i+=1)n[i].uisref&&e.push(n[i]);t&&(e=e.filter(function(e){if(-1<angular.lowercase(e.title).search(angular.lowercase(t)))return!0}));return s(function(){a.resolve(e)},1e3),a.promise},this.searchResultClick=function(e){e.uisref&&(e.stateParams?t.go(e.state,e.stateParams):t.go(e.state))}}e.$inject=["$state","$timeout","$q","msNavigationService"],angular.module("app.errors.error-404").controller("Error404Controller",e)}(),function(){"use strict";function e(e,t){var n=this;n.code="",n.send=!1,n.error=e.params,n.sendReport=function(){t.post("/api/jira",n.error).then(function(e){n.send=!0,e.data&&(n.code=e.data.id)},function(e){n.send=!1})}}e.$inject=["$state","$http"],angular.module("app.errors.error-500").controller("Error500Controller",e)}(),function(){"use strict";function e(e,t){var n=this;n.currentUser=e.getCurrentUser(),n.cookieAlertHide=t.get("motion.cookieAlertHide:"+n.currentUser.id)||!1,n.cookieAlertOnClose=function(){t.put("motion.cookieAlertHide:"+n.currentUser.id,!0)}}e.$inject=["Auth","$cookies"],angular.module("app.footer").controller("FooterController",e)}(),function(){"use strict";function e(e,t,n,a,i){var s=this;s.form={},s.forgotPassword=function(){return i.auth.forgot(s.form).$promise.then(function(){t.success({title:n.instant("FORGOTPASSWORD.LINK_SENT"),msg:n.instant("FORGOTPASSWORD.LINNK_SENT_MESSAGE")})}).catch(function(e){e&&t.error({title:n.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,t){var n=this;n.currentUser=e.getCurrentUser(),n.newsAlertHide=t.get("motion.newsAlertHide:"+n.currentUser.id)||!1,n.newsAlertOnClose=function(){t.put("motion.newsAlertHide:"+n.currentUser.id,!0)}}e.$inject=["Auth","$cookies"],angular.module("app.header").controller("HeaderController",e)}(),function(){"use strict";function e(e){var t={baseUrl:"api/"};return t.auth=e(t.baseUrl+"auth/local",{},{local:{method:"post",url:t.baseUrl+"auth/local"},forgot:{method:"post",url:t.baseUrl+"auth/local/forgot"},reset:{method:"post",url:t.baseUrl+"auth/local/reset/:token",params:{token:"@token"}},google:{method:"post",url:t.baseUrl+"auth/google"}}),t.jira=e(t.baseUrl+"jira"),t.rpc=e(t.baseUrl+"rpc",{},{startMonitor:{method:"get",url:t.baseUrl+"rpc/voice/channels/:uniqueid/mixmonitor",params:{uniqueid:"@uniqueid"}},stopMonitor:{method:"get",url:t.baseUrl+"rpc/voice/channels/:uniqueid/stopmixmonitor",params:{uniqueid:"@uniqueid"}},getVoiceChannels:{method:"get",url:t.baseUrl+"rpc/voice/channels"},getVoiceQueues:{method:"get",url:t.baseUrl+"rpc/voice/queues"},getChatQueues:{method:"get",url:t.baseUrl+"rpc/chat/queues"},getMailQueues:{method:"get",url:t.baseUrl+"rpc/mail/queues"},getSmsQueues:{method:"get",url:t.baseUrl+"rpc/sms/queues"},getOpenchannelQueues:{method:"get",url:t.baseUrl+"rpc/openchannel/queues"},getFaxQueues:{method:"get",url:t.baseUrl+"rpc/fax/queues"},getVoiceQueuesPreview:{method:"get",url:t.baseUrl+"rpc/voice/queues/preview/:id"},getVoiceQueuesChannels:{method:"get",url:t.baseUrl+"rpc/voice/queues/channels"},getVoiceQueuesChannel:{method:"get",url:t.baseUrl+"rpc/voice/queues/channels/:uniqueid"},getVoiceQueuesChannelHangup:{method:"get",url:t.baseUrl+"rpc/voice/queues/channels/:uniqueid/hangup"},getVoiceQueuesChannelRedirect:{method:"get",url:t.baseUrl+"rpc/voice/queues/channels/:uniqueid/redirect/:exten"},getOutbound:{method:"get",url:t.baseUrl+"rpc/outbound"},getOutboundChannels:{method:"get",url:t.baseUrl+"rpc/outbound/channels"},getAgents:{method:"get",url:t.baseUrl+"rpc/agents"},setAgentCapacity:{method:"put",url:t.baseUrl+"rpc/agents/:id/capacity",params:{id:"@id"}},getTelephones:{method:"get",url:t.baseUrl+"rpc/telephones"},getTrunks:{method:"get",url:t.baseUrl+"rpc/trunks"},getCampaigns:{method:"get",url:t.baseUrl+"rpc/campaigns"},getMailAccounts:{method:"get",url:t.baseUrl+"rpc/mail/accounts"},getFaxAccounts:{method:"get",url:t.baseUrl+"rpc/fax/accounts"},getChatQueuesWaitingInteractions:{method:"get",url:t.baseUrl+"rpc/chat/queues/waitinginteractions"},getMailQueuesWaitingInteractions:{method:"get",url:t.baseUrl+"rpc/mail/queues/waitinginteractions"},getOpenchannelQueuesWaitingInteractions:{method:"get",url:t.baseUrl+"rpc/openchannel/queues/waitinginteractions"},getSmsQueuesWaitingInteractions:{method:"get",url:t.baseUrl+"rpc/sms/queues/waitinginteractions"},getFaxQueuesWaitingInteractions:{method:"get",url:t.baseUrl+"rpc/fax/queues/waitinginteractions"},mailQueueNotify:{method:"post",url:t.baseUrl+"rpc/mail/queues/:id/notify",params:{id:"@id"}},chatQueueNotify:{method:"post",url:t.baseUrl+"rpc/chat/queues/:id/notify",params:{id:"@id"}},faxQueueNotify:{method:"post",url:t.baseUrl+"rpc/fax/queues/:id/notify",params:{id:"@id"}},smsQueueNotify:{method:"post",url:t.baseUrl+"rpc/sms/queues/:id/notify",params:{id:"@id"}},openchannelQueueNotify:{method:"post",url:t.baseUrl+"rpc/openchannel/queues/:id/notify",params:{id:"@id"}},agentNotify:{method:"post",url:t.baseUrl+"rpc/agents/:id/notify",params:{id:"@id"}}}),t.version=e(t.baseUrl+"version",{},{fetch:{method:"get",url:t.baseUrl+"version/fetch"},reset:{method:"get",url:t.baseUrl+"version/reset"},pull:{method:"get",url:t.baseUrl+"version/pull"},restart:{method:"get",url:t.baseUrl+"version/restart"},migrations:{method:"get",url:t.baseUrl+"version/migrations"}}),t.system=e(t.baseUrl+"system",{},{killProcess:{method:"get",url:t.baseUrl+"system/process/:pid/kill",params:{pid:"@pid"}}}),t.pm2=e(t.baseUrl+"pm2/:id",{id:"@id"},{update:{method:"put",isArray:!0}}),t.user=e(t.baseUrl+"users/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"users/describe"},clone:{method:"post",url:t.baseUrl+"users/:id/clone",params:{includeAll:"@includeAll"}},bulkCreate:{method:"post",url:t.baseUrl+"users/create_many",isArray:!0},addContacts:{isArray:!0,method:"post",url:t.baseUrl+"users/:id/contacts"},changePassword:{isArray:!1,method:"put",url:t.baseUrl+"users/:id/password"},addQueues:{isArray:!0,method:"post",url:t.baseUrl+"users/:id/queues"},removeQueues:{isArray:!1,method:"delete",url:t.baseUrl+"users/:id/queues"},addAvatar:{isArray:!1,method:"post",url:t.baseUrl+"users/:id/avatar"},getAvatar:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/avatar"},getContacts:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/contacts"},getQueues:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/queues"},getVoiceQueuesRt:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/queues_rt"},getGroups:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/groups"},getRecordings:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/recordings"},getChatInteractions:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/chat/interactions"},getOpenchannelInteractions:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/openchannel/interactions"},getMailInteractions:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/mail/interactions"},getSmsInteractions:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/sms/interactions"},getFaxInteractions:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/fax/interactions"},login:{isArray:!1,method:"post",url:t.baseUrl+"users/:id/login"},logout:{isArray:!1,method:"post",url:t.baseUrl+"users/:id/logout"},pause:{isArray:!1,method:"post",url:t.baseUrl+"users/:id/pause"},unpause:{isArray:!1,method:"post",url:t.baseUrl+"users/:id/unpause"},getTeams:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/teams"},addTeams:{isArray:!0,method:"post",url:t.baseUrl+"users/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:t.baseUrl+"users/:id/teams"},getLists:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/lists"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/agents"},addChatInteractions:{isArray:!0,method:"post",url:t.baseUrl+"users/:id/chat_interactions"},removeChatInteractions:{isArray:!1,method:"delete",url:t.baseUrl+"users/:id/chat_interactions"},addMailInteractions:{isArray:!0,method:"post",url:t.baseUrl+"users/:id/mail_interactions"},removeMailInteractions:{isArray:!1,method:"delete",url:t.baseUrl+"users/:id/mail_interactions"},addFaxInteractions:{isArray:!0,method:"post",url:t.baseUrl+"users/:id/fax_interactions"},removeFaxInteractions:{isArray:!1,method:"delete",url:t.baseUrl+"users/:id/fax_interactions"},addSmsInteractions:{isArray:!0,method:"post",url:t.baseUrl+"users/:id/sms_interactions"},removeSmsInteractions:{isArray:!1,method:"delete",url:t.baseUrl+"users/:id/sms_interactions"},addOpenchannelInteractions:{isArray:!0,method:"post",url:t.baseUrl+"users/:id/openchannel_interactions"},removeOpenchannelInteractions:{isArray:!1,method:"delete",url:t.baseUrl+"users/:id/openchannel_interactions"},getVoicePrefixes:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/prefixes"},getFaxAccounts:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/fax_accounts"},addFaxAccounts:{isArray:!0,method:"post",url:t.baseUrl+"users/:id/fax_accounts"},removeFaxAccounts:{isArray:!1,method:"delete",url:t.baseUrl+"users/:id/fax_accounts"},getMailAccounts:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/mail_accounts"},addMailAccounts:{isArray:!0,method:"post",url:t.baseUrl+"users/:id/mail_accounts"},removeMailAccounts:{isArray:!1,method:"delete",url:t.baseUrl+"users/:id/mail_accounts"},getOpenchannelAccounts:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/openchannel_accounts"},addOpenchannelAccounts:{isArray:!0,method:"post",url:t.baseUrl+"users/:id/openchannel_accounts"},removeOpenchannelAccounts:{isArray:!1,method:"delete",url:t.baseUrl+"users/:id/openchannel_accounts"},getSmsAccounts:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/sms_accounts"},addSmsAccounts:{isArray:!0,method:"post",url:t.baseUrl+"users/:id/sms_accounts"},removeSmsAccounts:{isArray:!1,method:"delete",url:t.baseUrl+"users/:id/sms_accounts"},getChatWebsites:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/chat_websites"},addChatWebsites:{isArray:!0,method:"post",url:t.baseUrl+"users/:id/chat_websites"},removeChatWebsites:{isArray:!1,method:"delete",url:t.baseUrl+"users/:id/chat_websites"},getSquareProjects:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/square_projects"},addSquareProjects:{isArray:!0,method:"post",url:t.baseUrl+"users/:id/square_projects"},removeSquareProjects:{isArray:!1,method:"delete",url:t.baseUrl+"users/:id/square_projects"},getScheduledCalls:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/scheduled_calls"},getApiKey:{isArray:!1,method:"get",url:t.baseUrl+"users/:id/api_key"},createApiKey:{isArray:!1,method:"post",url:t.baseUrl+"users/:id/api_key"},removeApiKey:{isArray:!1,method:"delete",url:t.baseUrl+"users/:id/api_key"}}),t.voiceChanSpy=e(t.baseUrl+"voice/chanspy/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/chanspy/describe"},clone:{method:"post",url:t.baseUrl+"voice/chanspy/:id/clone",params:{includeAll:"@includeAll"}}}),t.voiceContext=e(t.baseUrl+"voice/contexts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/contexts/describe"},clone:{method:"post",url:t.baseUrl+"voice/contexts/:id/clone",params:{includeAll:"@includeAll"}}}),t.voiceExtension=e(t.baseUrl+"voice/extensions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/extensions/describe"},clone:{method:"post",url:t.baseUrl+"voice/extensions/:id/clone",params:{includeAll:"@includeAll"}},addApplications:{isArray:!1,method:"post",url:t.baseUrl+"voice/extensions/:id/applications"}}),t.voiceMusicOnHold=e(t.baseUrl+"voice/mohs/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/mohs/describe"},clone:{method:"post",url:t.baseUrl+"voice/mohs/:id/clone",params:{includeAll:"@includeAll"}},addSound:{isArray:!1,method:"post",url:t.baseUrl+"voice/mohs/:id/sounds"},removeSound:{isArray:!1,method:"delete",url:t.baseUrl+"voice/mohs/:id/sounds/:id2"},getSounds:{isArray:!1,method:"get",url:t.baseUrl+"voice/mohs/:id/sounds"}}),t.voiceQueue=e(t.baseUrl+"voice/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/queues/describe"},clone:{method:"post",url:t.baseUrl+"voice/queues/:id/clone",params:{includeAll:"@includeAll"}},getHoppers:{isArray:!1,method:"get",url:t.baseUrl+"voice/queues/:id/hoppers"},getHopperHistories:{isArray:!1,method:"get",url:t.baseUrl+"voice/queues/:id/hopper_histories"},getHopperFinals:{isArray:!1,method:"get",url:t.baseUrl+"voice/queues/:id/hopper_finals"},getHopperBlacks:{isArray:!1,method:"get",url:t.baseUrl+"voice/queues/:id/hopper_black"},getTeams:{isArray:!1,method:"get",url:t.baseUrl+"voice/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:t.baseUrl+"voice/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:t.baseUrl+"voice/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"voice/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"voice/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"voice/queues/:id/users"},getMembers:{isArray:!1,method:"get",url:t.baseUrl+"voice/queues/:id/members"},getLists:{isArray:!1,method:"get",url:t.baseUrl+"voice/queues/:id/lists"},addLists:{isArray:!0,method:"post",url:t.baseUrl+"voice/queues/:id/lists"},removeLists:{isArray:!0,method:"delete",url:t.baseUrl+"voice/queues/:id/lists"},getBlackLists:{isArray:!1,method:"get",url:t.baseUrl+"voice/queues/:id/blacklists"},addBlackLists:{isArray:!0,method:"post",url:t.baseUrl+"voice/queues/:id/blacklists"},removeBlackLists:{isArray:!0,method:"delete",url:t.baseUrl+"voice/queues/:id/blacklists"}}),t.voiceRecording=e(t.baseUrl+"voice/recordings/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/recordings/describe"},clone:{method:"post",url:t.baseUrl+"voice/recordings/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:t.baseUrl+"voice/recordings/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}},downloads:{isArray:!1,method:"get",url:t.baseUrl+"voice/recordings/:id/downloads"}}),t.voiceMail=e(t.baseUrl+"voice/mails/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/mails/describe"},clone:{method:"post",url:t.baseUrl+"voice/mails/:id/clone",params:{includeAll:"@includeAll"}},getMessages:{isArray:!1,method:"get",url:t.baseUrl+"voice/mails/:id/messages"}}),t.voiceMailMessage=e(t.baseUrl+"voice/mails/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/mails/messages/describe"},clone:{method:"post",url:t.baseUrl+"voice/mails/messages/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:t.baseUrl+"voice/mails/messages/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}}}),t.voiceCallReport=e(t.baseUrl+"voice/calls/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/calls/reports/describe"},clone:{method:"post",url:t.baseUrl+"voice/calls/reports/:id/clone",params:{includeAll:"@includeAll"}}}),t.voiceDialReport=e(t.baseUrl+"voice/dials/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/dials/reports/describe"},clone:{method:"post",url:t.baseUrl+"voice/dials/reports/:id/clone",params:{includeAll:"@includeAll"}}}),t.voiceAgentReport=e(t.baseUrl+"voice/agents/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/agents/reports/describe"},clone:{method:"post",url:t.baseUrl+"voice/agents/reports/:id/clone",params:{includeAll:"@includeAll"}}}),t.voiceQueueReport=e(t.baseUrl+"voice/queues/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/queues/reports/describe"},clone:{method:"post",url:t.baseUrl+"voice/queues/reports/:id/clone",params:{includeAll:"@includeAll"}},getVoiceQueuesReport:{isArray:!1,method:"get",url:t.baseUrl+"voice/queues/reports/index"}}),t.memberReport=e(t.baseUrl+"members/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"members/reports/describe"},clone:{method:"post",url:t.baseUrl+"members/reports/:id/clone",params:{includeAll:"@includeAll"}}}),t.trunk=e(t.baseUrl+"trunks/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"trunks/describe"},clone:{method:"post",url:t.baseUrl+"trunks/:id/clone",params:{includeAll:"@includeAll"}}}),t.voiceTransferReport=e(t.baseUrl+"voice/transfers/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/transfers/reports/describe"},clone:{method:"post",url:t.baseUrl+"voice/transfers/reports/:id/clone",params:{includeAll:"@includeAll"}}}),t.mailServerOut=e(t.baseUrl+"mail/out_servers/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"mail/out_servers/describe"},clone:{method:"post",url:t.baseUrl+"mail/out_servers/:id/clone",params:{includeAll:"@includeAll"}}}),t.mailAccount=e(t.baseUrl+"mail/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"mail/accounts/describe"},clone:{method:"post",url:t.baseUrl+"mail/accounts/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:t.baseUrl+"mail/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:t.baseUrl+"mail/accounts/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:t.baseUrl+"mail/accounts/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:t.baseUrl+"mail/accounts/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:t.baseUrl+"mail/accounts/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:t.baseUrl+"mail/accounts/:id/canned_answers"},getImap:{isArray:!1,method:"get",url:t.baseUrl+"mail/accounts/:id/in_servers"},addImap:{isArray:!1,method:"post",url:t.baseUrl+"mail/accounts/:id/in_servers"},removeImap:{isArray:!1,method:"delete",url:t.baseUrl+"mail/accounts/:id/in_servers"},getSmtp:{isArray:!1,method:"get",url:t.baseUrl+"mail/accounts/:id/out_servers"},addSmtp:{isArray:!1,method:"post",url:t.baseUrl+"mail/accounts/:id/out_servers"},removeSmtp:{isArray:!1,method:"delete",url:t.baseUrl+"mail/accounts/:id/out_servers"},addInteraction:{isArray:!1,method:"post",url:t.baseUrl+"mail/accounts/:id/interactions"},getInteractions:{isArray:!1,method:"get",url:t.baseUrl+"mail/accounts/:id/interactions"},addApplications:{isArray:!1,method:"post",url:t.baseUrl+"mail/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:t.baseUrl+"mail/accounts/:id/applications"},getMessages:{isArray:!1,method:"get",url:t.baseUrl+"mail/accounts/:id/messages"},send:{isArray:!1,method:"post",url:t.baseUrl+"mail/accounts/:id/send"},verifySmtp:{isArray:!1,method:"get",url:t.baseUrl+"mail/accounts/:id/verify"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"mail/accounts/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"mail/accounts/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"mail/accounts/:id/users"}}),t.mailQueue=e(t.baseUrl+"mail/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"mail/queues/describe"},clone:{method:"post",url:t.baseUrl+"mail/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:t.baseUrl+"mail/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:t.baseUrl+"mail/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:t.baseUrl+"mail/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:t.baseUrl+"mail/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"mail/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"mail/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"mail/queues/:id/users"}}),t.mailSubstatus=e(t.baseUrl+"mail/substatuses/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"mail/substatuses/describe"},clone:{method:"post",url:t.baseUrl+"mail/substatuses/:id/clone",params:{includeAll:"@includeAll"}}}),t.mailInteraction=e(t.baseUrl+"mail/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"mail/interactions/describe"},clone:{method:"post",url:t.baseUrl+"mail/interactions/:id/clone",params:{includeAll:"@includeAll"}},addMessage:{isArray:!1,method:"post",url:t.baseUrl+"mail/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:t.baseUrl+"mail/interactions/:id/messages"},addTags:{isArray:!1,method:"post",url:t.baseUrl+"mail/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:t.baseUrl+"mail/interactions/:id/tags"},download:{isArray:!1,method:"get",url:t.baseUrl+"mail/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}}}),t.mailMessage=e(t.baseUrl+"mail/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"mail/messages/describe"},clone:{method:"post",url:t.baseUrl+"mail/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:t.baseUrl+"mail/messages/:id/accept"},reject:{isArray:!1,method:"put",url:t.baseUrl+"mail/messages/:id/reject"},download:{isArray:!1,method:"get",url:t.baseUrl+"mail/messages/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}}}),t.mailApplication=e(t.baseUrl+"mail/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"mail/applications/describe"},clone:{method:"post",url:t.baseUrl+"mail/applications/:id/clone",params:{includeAll:"@includeAll"}}}),t.mailQueueReport=e(t.baseUrl+"mail/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"mail/reports/queue/describe"},clone:{method:"post",url:t.baseUrl+"mail/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),t.dashboard=e(t.baseUrl+"dashboards/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"dashboards/describe"},clone:{method:"post",url:t.baseUrl+"dashboards/:id/clone",params:{includeAll:"@includeAll"}},addItem:{isArray:!1,method:"post",url:t.baseUrl+"dashboards/:id/items"},getItems:{isArray:!1,method:"get",url:t.baseUrl+"dashboards/:id/items"}}),t.dashboardItem=e(t.baseUrl+"dashboards/items/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"dashboards/items/describe"},clone:{method:"post",url:t.baseUrl+"dashboards/items/:id/clone",params:{includeAll:"@includeAll"}}}),t.faxAccount=e(t.baseUrl+"fax/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"fax/accounts/describe"},clone:{method:"post",url:t.baseUrl+"fax/accounts/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:t.baseUrl+"fax/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:t.baseUrl+"fax/accounts/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:t.baseUrl+"fax/accounts/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:t.baseUrl+"fax/accounts/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:t.baseUrl+"fax/accounts/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:t.baseUrl+"fax/accounts/:id/canned_answers"},addInteraction:{isArray:!1,method:"post",url:t.baseUrl+"fax/accounts/:id/interactions"},getInteractions:{isArray:!1,method:"get",url:t.baseUrl+"fax/accounts/:id/interactions"},addApplications:{isArray:!1,method:"post",url:t.baseUrl+"fax/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:t.baseUrl+"fax/accounts/:id/applications"},addAccountApplications:{isArray:!1,method:"post",url:t.baseUrl+"fax/accounts/addaccountapplications"},updateAccountApplications:{isArray:!1,method:"post",url:t.baseUrl+"fax/accounts/updateaccountapplications"},getMessages:{isArray:!1,method:"get",url:t.baseUrl+"fax/accounts/:id/messages"},send:{isArray:!1,method:"post",url:t.baseUrl+"fax/accounts/:id/send"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"fax/accounts/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"fax/accounts/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"fax/accounts/:id/users"}}),t.faxApplication=e(t.baseUrl+"fax/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"fax/applications/describe"},clone:{method:"post",url:t.baseUrl+"fax/applications/:id/clone",params:{includeAll:"@includeAll"}}}),t.faxInteraction=e(t.baseUrl+"fax/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"fax/interactions/describe"},clone:{method:"post",url:t.baseUrl+"fax/interactions/:id/clone",params:{includeAll:"@includeAll"}},addMessage:{isArray:!1,method:"post",url:t.baseUrl+"fax/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:t.baseUrl+"fax/interactions/:id/messages"},addTags:{isArray:!1,method:"post",url:t.baseUrl+"fax/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:t.baseUrl+"fax/interactions/:id/tags"},download:{isArray:!1,method:"get",url:t.baseUrl+"fax/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}}}),t.faxMessage=e(t.baseUrl+"fax/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"fax/messages/describe"},clone:{method:"post",url:t.baseUrl+"fax/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:t.baseUrl+"fax/messages/:id/accept"},reject:{isArray:!1,method:"put",url:t.baseUrl+"fax/messages/:id/reject"},download:{isArray:!1,method:"get",url:t.baseUrl+"fax/messages/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}}}),t.faxQueue=e(t.baseUrl+"fax/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"fax/queues/describe"},clone:{method:"post",url:t.baseUrl+"fax/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:t.baseUrl+"fax/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:t.baseUrl+"fax/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:t.baseUrl+"fax/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:t.baseUrl+"fax/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"fax/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"fax/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"fax/queues/:id/users"}}),t.faxQueueReport=e(t.baseUrl+"fax/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"fax/reports/queue/describe"},clone:{method:"post",url:t.baseUrl+"fax/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),t.smsAccount=e(t.baseUrl+"sms/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"sms/accounts/describe"},clone:{method:"post",url:t.baseUrl+"sms/accounts/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:t.baseUrl+"sms/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:t.baseUrl+"sms/accounts/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:t.baseUrl+"sms/accounts/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:t.baseUrl+"sms/accounts/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:t.baseUrl+"sms/accounts/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:t.baseUrl+"sms/accounts/:id/canned_answers"},notify:{isArray:!1,method:"post",url:t.baseUrl+"sms/accounts/:id/notify"},addApplications:{isArray:!1,method:"post",url:t.baseUrl+"sms/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:t.baseUrl+"sms/accounts/:id/applications"},getInteractions:{isArray:!1,method:"get",url:t.baseUrl+"sms/accounts/:id/interactions"},send:{isArray:!1,method:"post",url:t.baseUrl+"sms/accounts/:id/send"},status:{isArray:!1,method:"post",url:t.baseUrl+"sms/accounts/:id/status"},statusGet:{isArray:!1,method:"get",url:t.baseUrl+"sms/accounts/:id/status"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"sms/accounts/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"sms/accounts/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"sms/accounts/:id/users"}}),t.smsApplication=e(t.baseUrl+"sms/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"sms/applications/describe"},clone:{method:"post",url:t.baseUrl+"sms/applications/:id/clone",params:{includeAll:"@includeAll"}}}),t.smsInteraction=e(t.baseUrl+"sms/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"sms/interactions/describe"},clone:{method:"post",url:t.baseUrl+"sms/interactions/:id/clone",params:{includeAll:"@includeAll"}},addMessage:{isArray:!1,method:"post",url:t.baseUrl+"sms/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:t.baseUrl+"sms/interactions/:id/messages"},addTags:{isArray:!1,method:"post",url:t.baseUrl+"sms/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:t.baseUrl+"sms/interactions/:id/tags"},download:{isArray:!1,method:"get",url:t.baseUrl+"sms/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}}}),t.smsMessage=e(t.baseUrl+"sms/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"sms/messages/describe"},clone:{method:"post",url:t.baseUrl+"sms/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:t.baseUrl+"sms/messages/:id/accept"},reject:{isArray:!1,method:"put",url:t.baseUrl+"sms/messages/:id/reject"},status:{isArray:!1,method:"post",url:t.baseUrl+"sms/messages/:id/status"}}),t.smsQueue=e(t.baseUrl+"sms/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"sms/queues/describe"},clone:{method:"post",url:t.baseUrl+"sms/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:t.baseUrl+"sms/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:t.baseUrl+"sms/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:t.baseUrl+"sms/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:t.baseUrl+"sms/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"sms/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"sms/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"sms/queues/:id/users"}}),t.openchannelAccount=e(t.baseUrl+"openchannel/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"openchannel/accounts/describe"},clone:{method:"post",url:t.baseUrl+"openchannel/accounts/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:t.baseUrl+"openchannel/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:t.baseUrl+"openchannel/accounts/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:t.baseUrl+"openchannel/accounts/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:t.baseUrl+"openchannel/accounts/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:t.baseUrl+"openchannel/accounts/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:t.baseUrl+"openchannel/accounts/:id/canned_answers"},notify:{isArray:!1,method:"post",url:t.baseUrl+"openchannel/accounts/:id/notify"},addApplications:{isArray:!1,method:"post",url:t.baseUrl+"openchannel/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:t.baseUrl+"openchannel/accounts/:id/applications"},getInteractions:{isArray:!1,method:"get",url:t.baseUrl+"openchannel/accounts/:id/interactions"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"openchannel/accounts/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"openchannel/accounts/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"openchannel/accounts/:id/users"},send:{isArray:!1,method:"post",url:t.baseUrl+"openchannel/accounts/:id/send"}}),t.openchannelApplication=e(t.baseUrl+"openchannel/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"openchannel/applications/describe"},clone:{method:"post",url:t.baseUrl+"openchannel/applications/:id/clone",params:{includeAll:"@includeAll"}}}),t.openchannelInteraction=e(t.baseUrl+"openchannel/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"openchannel/interactions/describe"},clone:{method:"post",url:t.baseUrl+"openchannel/interactions/:id/clone",params:{includeAll:"@includeAll"}},addMessage:{isArray:!1,method:"post",url:t.baseUrl+"openchannel/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:t.baseUrl+"openchannel/interactions/:id/messages"},addTags:{isArray:!1,method:"post",url:t.baseUrl+"openchannel/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:t.baseUrl+"openchannel/interactions/:id/tags"},download:{isArray:!1,method:"get",url:t.baseUrl+"openchannel/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}}}),t.openchannelMessage=e(t.baseUrl+"openchannel/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"openchannel/messages/describe"},clone:{method:"post",url:t.baseUrl+"openchannel/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:t.baseUrl+"openchannel/messages/:id/accept"},reject:{isArray:!1,method:"put",url:t.baseUrl+"openchannel/messages/:id/reject"}}),t.openchannelQueue=e(t.baseUrl+"openchannel/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"openchannel/queues/describe"},clone:{method:"post",url:t.baseUrl+"openchannel/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:t.baseUrl+"openchannel/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:t.baseUrl+"openchannel/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:t.baseUrl+"openchannel/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:t.baseUrl+"openchannel/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"openchannel/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"openchannel/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"openchannel/queues/:id/users"}}),t.chatWebsite=e(t.baseUrl+"chat/websites/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/websites/describe"},clone:{method:"post",url:t.baseUrl+"chat/websites/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:t.baseUrl+"chat/websites/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:t.baseUrl+"chat/websites/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:t.baseUrl+"chat/websites/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:t.baseUrl+"chat/websites/:id/canned_answers"},addLogo:{isArray:!1,method:"post",url:t.baseUrl+"chat/websites/:id/logo"},addAvatar:{isArray:!1,method:"post",url:t.baseUrl+"chat/websites/:id/avatar"},addCustomerAvatar:{isArray:!1,method:"post",url:t.baseUrl+"chat/websites/:id/customer_avatar"},addSystemAvatar:{isArray:!1,method:"post",url:t.baseUrl+"chat/websites/:id/system_avatar"},getLogo:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/logo"},getAvatar:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/avatar"},getCustomerAvatar:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/customer_avatar"},getSystemAvatar:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/system_avatar"},notify:{isArray:!1,method:"post",url:t.baseUrl+"chat/websites/:id/notify"},offline:{isArray:!1,method:"post",url:t.baseUrl+"chat/websites/:id/offline"},addInteraction:{isArray:!1,method:"post",url:t.baseUrl+"chat/websites/:id/interactions"},getInteractions:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/interactions"},getSnippet:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/snippet"},addApplications:{isArray:!1,method:"post",url:t.baseUrl+"chat/websites/:id/applications"},getApplications:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/applications"},addProactiveActions:{isArray:!1,method:"post",url:t.baseUrl+"chat/websites/:id/proactive_actions"},getProactiveActions:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/proactive_actions"},getFields:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/fields"},getOfflineMessages:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/offline_messages"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"chat/websites/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"chat/websites/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"chat/websites/:id/users"}}),t.openchannelQueueReport=e(t.baseUrl+"openchannel/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"openchannel/reports/queue/describe"},clone:{method:"post",url:t.baseUrl+"openchannel/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),t.chatApplication=e(t.baseUrl+"chat/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/applications/describe"},clone:{method:"post",url:t.baseUrl+"chat/applications/:id/clone",params:{includeAll:"@includeAll"}}}),t.chatInteraction=e(t.baseUrl+"chat/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/interactions/describe"},clone:{method:"post",url:t.baseUrl+"chat/interactions/:id/clone",params:{includeAll:"@includeAll"}},customUpdate:{isArray:!1,method:"put",url:t.baseUrl+"chat/interactions/:id/custom_update"},abandon:{isArray:!1,method:"put",url:t.baseUrl+"chat/interactions/:id/abandon"},attachmentUpload:{isArray:!1,method:"post",url:t.baseUrl+"chat/interactions/:id/attachment_upload"},attachmentDownload:{isArray:!1,method:"get",url:t.baseUrl+"chat/interactions/:id/attachment_download"},close:{isArray:!1,method:"put",url:t.baseUrl+"chat/interactions/:id/close"},addMessage:{isArray:!1,method:"post",url:t.baseUrl+"chat/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:t.baseUrl+"chat/interactions/:id/messages"},getMyMessages:{isArray:!1,method:"get",url:t.baseUrl+"chat/interactions/:id/my_messages"},addTags:{isArray:!1,method:"post",url:t.baseUrl+"chat/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:t.baseUrl+"chat/interactions/:id/tags"},download:{isArray:!1,method:"get",url:t.baseUrl+"chat/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}}}),t.chatMessage=e(t.baseUrl+"chat/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/messages/describe"},clone:{method:"post",url:t.baseUrl+"chat/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:t.baseUrl+"chat/messages/:id/accept"},reject:{isArray:!1,method:"put",url:t.baseUrl+"chat/messages/:id/reject"}}),t.chatOfflineMessage=e(t.baseUrl+"chat/offline_messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/offline_messages/describe"},clone:{method:"post",url:t.baseUrl+"chat/offline_messages/:id/clone",params:{includeAll:"@includeAll"}}}),t.chatQueue=e(t.baseUrl+"chat/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/queues/describe"},clone:{method:"post",url:t.baseUrl+"chat/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:t.baseUrl+"chat/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:t.baseUrl+"chat/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:t.baseUrl+"chat/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:t.baseUrl+"chat/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"chat/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"chat/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"chat/queues/:id/users"}}),t.chatGroup=e(t.baseUrl+"chat/groups/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/groups/describe"},clone:{method:"post",url:t.baseUrl+"chat/groups/:id/clone",params:{includeAll:"@includeAll"}},getUnread:{isArray:!1,method:"get",url:t.baseUrl+"chat/groups/:id/unread"},addMembers:{isArray:!0,method:"post",url:t.baseUrl+"chat/groups/:id/members"},getMembers:{isArray:!1,method:"get",url:t.baseUrl+"chat/groups/:id/members"},removeMembers:{isArray:!1,method:"delete",url:t.baseUrl+"chat/groups/:id/members"},addMessage:{isArray:!1,method:"post",url:t.baseUrl+"chat/groups/:id/messages"},getMessages:{isArray:!1,method:"get",url:t.baseUrl+"chat/groups/:id/messages"}}),t.chatProactiveAction=e(t.baseUrl+"chat/proactive_actions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/proactive_actions/describe"},clone:{method:"post",url:t.baseUrl+"chat/proactive_actions/:id/clone",params:{includeAll:"@includeAll"}}}),t.cmCompany=e(t.baseUrl+"cm/companies/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"cm/companies/describe"},clone:{method:"post",url:t.baseUrl+"cm/companies/:id/clone",params:{includeAll:"@includeAll"}},addContacts:{isArray:!1,method:"post",url:t.baseUrl+"cm/companies/:id/contacts"},getContacts:{isArray:!1,method:"get",url:t.baseUrl+"cm/companies/:id/contacts"}}),t.cmContact=e(t.baseUrl+"cm/contacts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"cm/contacts/describe"},clone:{method:"post",url:t.baseUrl+"cm/contacts/:id/clone",params:{includeAll:"@includeAll"}},merge:{isArray:!1,method:"post",url:t.baseUrl+"cm/contacts/merge"},bulkCreate:{isArray:!1,method:"post",url:t.baseUrl+"cm/contacts/create_many"},getTags:{isArray:!1,method:"get",url:t.baseUrl+"cm/contacts/:id/tags"},setTags:{isArray:!0,method:"post",url:t.baseUrl+"cm/contacts/:id/tags"},getHoppers:{isArray:!1,method:"get",url:t.baseUrl+"cm/contacts/:id/hoppers"},getHopperHistories:{isArray:!1,method:"get",url:t.baseUrl+"cm/contacts/:id/hopper_histories"},getHopperFinals:{isArray:!1,method:"get",url:t.baseUrl+"cm/contacts/:id/hopper_finals"},getJscriptySessions:{isArray:!1,method:"get",url:t.baseUrl+"cm/contacts/:id/jscripty_sessions"},uploadCsv:{isArray:!1,method:"post",url:t.baseUrl+"cm/contacts/csv"},upload:{isArray:!1,method:"post",url:t.baseUrl+"cm/contacts/upload"},import:{isArray:!1,method:"post",url:t.baseUrl+"cm/contacts/upload/:id"}}),t.cmHopper=e(t.baseUrl+"cm/hopper/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"cm/hopper/describe"},clone:{method:"post",url:t.baseUrl+"cm/hopper/:id/clone",params:{includeAll:"@includeAll"}},getPreview:{isArray:!1,method:"post",url:t.baseUrl+"cm/hopper/preview"},getOpenContacts:{isArray:!1,method:"get",url:t.baseUrl+"cm/hopper/opencontacts"}}),t.cmHopperBlack=e(t.baseUrl+"cm/hopper_black/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"cm/hopper_black/describe"},clone:{method:"post",url:t.baseUrl+"cm/hopper_black/:id/clone",params:{includeAll:"@includeAll"}}}),t.cmHopperFinal=e(t.baseUrl+"cm/hopper_final/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"cm/hopper_final/describe"},clone:{method:"post",url:t.baseUrl+"cm/hopper_final/:id/clone",params:{includeAll:"@includeAll"}},countContactsQueueCampaignHopperFinal:{isArray:!0,method:"get",url:t.baseUrl+"cm/hopper_final/voice/queue/countAttributes/:id"},countContactsIvrCampaignHopperFinal:{isArray:!0,method:"get",url:t.baseUrl+"cm/hopper_final/campaign/countAttributes/:id"},moveContactsQueueCampaignHopperFinal:{isArray:!0,method:"post",url:t.baseUrl+"cm/hopper_final/voice/queue/moveContacts/:id"},moveContactsIvrCampaignHopperFinal:{isArray:!0,method:"post",url:t.baseUrl+"cm/hopper_final/voice/campaign/moveContacts/:id"},checkContactHopper:{isArray:!1,method:"post",url:t.baseUrl+"cm/hopper_final/checkContactHopper"}}),t.cmHopperHistory=e(t.baseUrl+"cm/hopper_history/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"cm/hopper_history/describe"},clone:{method:"post",url:t.baseUrl+"cm/hopper_history/:id/clone",params:{includeAll:"@includeAll"}}}),t.cmCustomField=e(t.baseUrl+"cm/custom_fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"cm/custom_fields/describe"},clone:{method:"post",url:t.baseUrl+"cm/custom_fields/:id/clone",params:{includeAll:"@includeAll"}}}),t.action=e(t.baseUrl+"actions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"actions/describe"},clone:{method:"post",url:t.baseUrl+"actions/:id/clone",params:{includeAll:"@includeAll"}}}),t.automation=e(t.baseUrl+"automations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"automations/describe"},clone:{method:"post",url:t.baseUrl+"automations/:id/clone",params:{includeAll:"@includeAll"}},addConditions:{isArray:!1,method:"post",url:t.baseUrl+"automations/:id/conditions"},getConditions:{isArray:!1,method:"get",url:t.baseUrl+"automations/:id/conditions"},addActions:{isArray:!1,method:"post",url:t.baseUrl+"automations/:id/actions"},getActions:{isArray:!1,method:"get",url:t.baseUrl+"automations/:id/actions"}}),t.cannedAnswer=e(t.baseUrl+"canned_answers/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"canned_answers/describe"},clone:{method:"post",url:t.baseUrl+"canned_answers/:id/clone",params:{includeAll:"@includeAll"}}}),t.disposition=e(t.baseUrl+"dispositions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"dispositions/describe"},clone:{method:"post",url:t.baseUrl+"dispositions/:id/clone",params:{includeAll:"@includeAll"}}}),t.condition=e(t.baseUrl+"conditions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"conditions/describe"},clone:{method:"post",url:t.baseUrl+"conditions/:id/clone",params:{includeAll:"@includeAll"}}}),t.interval=e(t.baseUrl+"intervals/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"intervals/describe"},clone:{method:"post",url:t.baseUrl+"intervals/:id/clone",params:{includeAll:"@includeAll"}},addInterval:{isArray:!1,method:"post",url:t.baseUrl+"intervals/:id/sub_intervals"},getIntervals:{isArray:!1,method:"get",url:t.baseUrl+"intervals/:id/sub_intervals"},addIntervals:{isArray:!0,method:"post",url:t.baseUrl+"intervals/:id/sub_intervals/create_many"}}),t.pause=e(t.baseUrl+"pauses/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"pauses/describe"},clone:{method:"post",url:t.baseUrl+"pauses/:id/clone",params:{includeAll:"@includeAll"}}}),t.cdr=e(t.baseUrl+"cdr/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"cdr/describe"},clone:{method:"post",url:t.baseUrl+"cdr/:id/clone",params:{includeAll:"@includeAll"}}}),t.voiceQueuesLog=e(t.baseUrl+"voiceQueuesLog/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voiceQueuesLog/describe"},clone:{method:"post",url:t.baseUrl+"voiceQueuesLog/:id/clone",params:{includeAll:"@includeAll"}}}),t.schedule=e(t.baseUrl+"schedules/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"schedules/describe"},clone:{method:"post",url:t.baseUrl+"schedules/:id/clone",params:{includeAll:"@includeAll"}},run:{isArray:!1,method:"get",url:t.baseUrl+"schedules/:id/run"}}),t.sound=e(t.baseUrl+"sounds/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"sounds/describe"},clone:{method:"post",url:t.baseUrl+"sounds/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:t.baseUrl+"sounds/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}},delete:{isArray:!1,method:"delete",url:t.baseUrl+"sounds/:id"}}),t.tag=e(t.baseUrl+"tags/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"tags/describe"},clone:{method:"post",url:t.baseUrl+"tags/:id/clone",params:{includeAll:"@includeAll"}}}),t.template=e(t.baseUrl+"templates/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"templates/describe"},clone:{method:"post",url:t.baseUrl+"templates/:id/clone",params:{includeAll:"@includeAll"}}}),t.trigger=e(t.baseUrl+"triggers/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"triggers/describe"},clone:{method:"post",url:t.baseUrl+"triggers/:id/clone",params:{includeAll:"@includeAll"}},addAllCondition:{isArray:!1,method:"post",url:t.baseUrl+"triggers/:id/all_conditions"},addAnyCondition:{isArray:!1,method:"post",url:t.baseUrl+"triggers/:id/any_conditions"},getAllConditions:{isArray:!1,method:"get",url:t.baseUrl+"triggers/:id/all_conditions"},getAnyConditions:{isArray:!1,method:"get",url:t.baseUrl+"triggers/:id/any_conditions"},addAction:{isArray:!1,method:"post",url:t.baseUrl+"triggers/:id/actions"},getActions:{isArray:!1,method:"get",url:t.baseUrl+"triggers/:id/actions"}}),t.variable=e(t.baseUrl+"variables/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"variables/describe"},clone:{method:"post",url:t.baseUrl+"variables/:id/clone",params:{includeAll:"@includeAll"}}}),t.integration=e(t.baseUrl+"integrations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/describe"},clone:{method:"post",url:t.baseUrl+"integrations/:id/clone",params:{includeAll:"@includeAll"}}}),t.integrationReport=e(t.baseUrl+"integrations/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/reports/describe"},clone:{method:"post",url:t.baseUrl+"integrations/reports/:id/clone",params:{includeAll:"@includeAll"}}}),t.analyticCustomReport=e(t.baseUrl+"analytics/custom_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"analytics/custom_reports/describe"},clone:{method:"post",url:t.baseUrl+"analytics/custom_reports/:id/clone",params:{includeAll:"@includeAll"}},preview:{isArray:!0,method:"get",url:t.baseUrl+"analytics/custom_reports/:id/preview"},run:{isArray:!1,method:"get",url:t.baseUrl+"analytics/custom_reports/:id/run"},query:{isArray:!1,method:"get",url:t.baseUrl+"analytics/custom_reports/:id/query"}}),t.analyticDefaultReport=e(t.baseUrl+"analytics/default_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"analytics/default_reports/describe"},clone:{method:"post",url:t.baseUrl+"analytics/default_reports/:id/clone",params:{includeAll:"@includeAll"}},preview:{isArray:!0,method:"get",url:t.baseUrl+"analytics/default_reports/:id/preview"},run:{isArray:!1,method:"get",url:t.baseUrl+"analytics/default_reports/:id/run"},query:{isArray:!1,method:"get",url:t.baseUrl+"analytics/default_reports/:id/query"}}),t.analyticExtractedReport=e(t.baseUrl+"analytics/extracted_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"analytics/extracted_reports/describe"},clone:{method:"post",url:t.baseUrl+"analytics/extracted_reports/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:t.baseUrl+"analytics/extracted_reports/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}}}),t.analyticMetric=e(t.baseUrl+"analytics/metrics/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"analytics/metrics/describe"},clone:{method:"post",url:t.baseUrl+"analytics/metrics/:id/clone",params:{includeAll:"@includeAll"}}}),t.analyticFieldReport=e(t.baseUrl+"analytics/field_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"analytics/field_reports/describe"},clone:{method:"post",url:t.baseUrl+"analytics/field_reports/:id/clone",params:{includeAll:"@includeAll"}},bulkCreate:{method:"post",url:t.baseUrl+"analytics/field_reports/create_many",isArray:!0},bulkDestroy:{method:"delete",url:t.baseUrl+"analytics/field_reports/destroy_many",isArray:!0},addFields:{isArray:!0,method:"post",url:t.baseUrl+"analytics/field_reports/:id/create_many"}}),t.analyticTreeReport=e(t.baseUrl+"analytics/tree_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"analytics/tree_reports/describe"},clone:{method:"post",url:t.baseUrl+"analytics/tree_reports/:id/clone",params:{includeAll:"@includeAll"}}}),t.intSalesforceAccount=e(t.baseUrl+"integrations/salesforce/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/salesforce/accounts/describe"},clone:{method:"post",url:t.baseUrl+"integrations/salesforce/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:t.baseUrl+"integrations/salesforce/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:t.baseUrl+"integrations/salesforce/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/salesforce/accounts/:id/fields"}}),t.intSalesforceConfiguration=e(t.baseUrl+"integrations/salesforce/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/salesforce/configurations/describe"},clone:{method:"post",url:t.baseUrl+"integrations/salesforce/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/salesforce/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:t.baseUrl+"integrations/salesforce/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:t.baseUrl+"integrations/salesforce/configurations/:id/descriptions"}}),t.intSalesforceField=e(t.baseUrl+"integrations/salesforce/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/salesforce/fields/describe"},clone:{method:"post",url:t.baseUrl+"integrations/salesforce/fields/:id/clone",params:{includeAll:"@includeAll"}}}),t.intSugarcrmAccount=e(t.baseUrl+"integrations/sugarcrm/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/sugarcrm/accounts/describe"},clone:{method:"post",url:t.baseUrl+"integrations/sugarcrm/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:t.baseUrl+"integrations/sugarcrm/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:t.baseUrl+"integrations/sugarcrm/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/sugarcrm/accounts/:id/fields"}}),t.intSugarcrmConfiguration=e(t.baseUrl+"integrations/sugarcrm/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/sugarcrm/configurations/describe"},clone:{method:"post",url:t.baseUrl+"integrations/sugarcrm/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/sugarcrm/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:t.baseUrl+"integrations/sugarcrm/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:t.baseUrl+"integrations/sugarcrm/configurations/:id/descriptions"}}),t.intSugarcrmField=e(t.baseUrl+"integrations/sugarcrm/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/sugarcrm/fields/describe"},clone:{method:"post",url:t.baseUrl+"integrations/sugarcrm/fields/:id/clone",params:{includeAll:"@includeAll"}}}),t.intDeskAccount=e(t.baseUrl+"integrations/desk/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/desk/accounts/describe"},clone:{method:"post",url:t.baseUrl+"integrations/desk/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:t.baseUrl+"integrations/desk/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:t.baseUrl+"integrations/desk/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/desk/accounts/:id/fields"}}),t.intDeskConfiguration=e(t.baseUrl+"integrations/desk/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/desk/configurations/describe"},clone:{method:"post",url:t.baseUrl+"integrations/desk/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/desk/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:t.baseUrl+"integrations/desk/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:t.baseUrl+"integrations/desk/configurations/:id/descriptions"},getTags:{isArray:!1,method:"get",url:t.baseUrl+"integrations/desk/configurations/:id/tags"},setTags:{isArray:!0,method:"post",url:t.baseUrl+"integrations/desk/configurations/:id/tags"}}),t.intDeskField=e(t.baseUrl+"integrations/desk/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/desk/fields/describe"},clone:{method:"post",url:t.baseUrl+"integrations/desk/fields/:id/clone",params:{includeAll:"@includeAll"}}}),t.intZohoAccount=e(t.baseUrl+"integrations/zoho/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/zoho/accounts/describe"},clone:{method:"post",url:t.baseUrl+"integrations/zoho/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:t.baseUrl+"integrations/zoho/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:t.baseUrl+"integrations/zoho/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/zoho/accounts/:id/fields"}}),t.intZohoConfiguration=e(t.baseUrl+"integrations/zoho/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/zoho/configurations/describe"},clone:{method:"post",url:t.baseUrl+"integrations/zoho/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/zoho/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:t.baseUrl+"integrations/zoho/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:t.baseUrl+"integrations/zoho/configurations/:id/descriptions"}}),t.intZohoField=e(t.baseUrl+"integrations/zoho/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/zoho/fields/describe"},clone:{method:"post",url:t.baseUrl+"integrations/zoho/fields/:id/clone",params:{includeAll:"@includeAll"}}}),t.intZendeskAccount=e(t.baseUrl+"integrations/zendesk/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/zendesk/accounts/describe"},clone:{method:"post",url:t.baseUrl+"integrations/zendesk/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:t.baseUrl+"integrations/zendesk/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:t.baseUrl+"integrations/zendesk/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/zendesk/accounts/:id/fields"}}),t.intZendeskConfiguration=e(t.baseUrl+"integrations/zendesk/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/zendesk/configurations/describe"},clone:{method:"post",url:t.baseUrl+"integrations/zendesk/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/zendesk/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:t.baseUrl+"integrations/zendesk/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:t.baseUrl+"integrations/zendesk/configurations/:id/descriptions"},getTags:{isArray:!1,method:"get",url:t.baseUrl+"integrations/zendesk/configurations/:id/tags"},setTags:{isArray:!0,method:"post",url:t.baseUrl+"integrations/zendesk/configurations/:id/tags"}}),t.intZendeskField=e(t.baseUrl+"integrations/zendesk/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/zendesk/fields/describe"},clone:{method:"post",url:t.baseUrl+"integrations/zendesk/fields/:id/clone",params:{includeAll:"@includeAll"}}}),t.intFreshdeskAccount=e(t.baseUrl+"integrations/freshdesk/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/freshdesk/accounts/describe"},clone:{method:"post",url:t.baseUrl+"integrations/freshdesk/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:t.baseUrl+"integrations/freshdesk/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:t.baseUrl+"integrations/freshdesk/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/freshdesk/accounts/:id/fields"}}),t.intFreshdeskConfiguration=e(t.baseUrl+"integrations/freshdesk/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/freshdesk/configurations/describe"},clone:{method:"post",url:t.baseUrl+"integrations/freshdesk/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/freshdesk/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:t.baseUrl+"integrations/freshdesk/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:t.baseUrl+"integrations/freshdesk/configurations/:id/descriptions"},getTags:{isArray:!1,method:"get",url:t.baseUrl+"integrations/freshdesk/configurations/:id/tags"},setTags:{isArray:!0,method:"post",url:t.baseUrl+"integrations/freshdesk/configurations/:id/tags"}}),t.intFreshdeskField=e(t.baseUrl+"integrations/freshdesk/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/freshdesk/fields/describe"},clone:{method:"post",url:t.baseUrl+"integrations/freshdesk/fields/:id/clone",params:{includeAll:"@includeAll"}}}),t.intVtigerAccount=e(t.baseUrl+"integrations/vtiger/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/vtiger/accounts/describe"},clone:{method:"post",url:t.baseUrl+"integrations/vtiger/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:t.baseUrl+"integrations/vtiger/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:t.baseUrl+"integrations/vtiger/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/vtiger/accounts/:id/fields"}}),t.intVtigerConfiguration=e(t.baseUrl+"integrations/vtiger/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/vtiger/configurations/describe"},clone:{method:"post",url:t.baseUrl+"integrations/vtiger/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/vtiger/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:t.baseUrl+"integrations/vtiger/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:t.baseUrl+"integrations/vtiger/configurations/:id/descriptions"}}),t.intVtigerField=e(t.baseUrl+"integrations/vtiger/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/vtiger/fields/describe"},clone:{method:"post",url:t.baseUrl+"integrations/vtiger/fields/:id/clone",params:{includeAll:"@includeAll"}}}),t.intServicenowAccount=e(t.baseUrl+"integrations/servicenow/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/servicenow/accounts/describe"},clone:{method:"post",url:t.baseUrl+"integrations/servicenow/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:t.baseUrl+"integrations/servicenow/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:t.baseUrl+"integrations/servicenow/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/servicenow/accounts/:id/fields"}}),t.intServicenowConfiguration=e(t.baseUrl+"integrations/servicenow/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/servicenow/configurations/describe"},clone:{method:"post",url:t.baseUrl+"integrations/servicenow/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/servicenow/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:t.baseUrl+"integrations/servicenow/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:t.baseUrl+"integrations/servicenow/configurations/:id/descriptions"}}),t.intServicenowField=e(t.baseUrl+"integrations/servicenow/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/servicenow/fields/describe"},clone:{method:"post",url:t.baseUrl+"integrations/servicenow/fields/:id/clone",params:{includeAll:"@includeAll"}}}),t.intDynamics365Account=e(t.baseUrl+"integrations/dynamics365/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/dynamics365/accounts/describe"},clone:{method:"post",url:t.baseUrl+"integrations/dynamics365/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:t.baseUrl+"integrations/dynamics365/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:t.baseUrl+"integrations/dynamics365/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/dynamics365/accounts/:id/fields"}}),t.intDynamics365Configuration=e(t.baseUrl+"integrations/dynamics365/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/dynamics365/configurations/describe"},clone:{method:"post",url:t.baseUrl+"integrations/dynamics365/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:t.baseUrl+"integrations/dynamics365/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:t.baseUrl+"integrations/dynamics365/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:t.baseUrl+"integrations/dynamics365/configurations/:id/descriptions"}}),t.intDynamics365Field=e(t.baseUrl+"integrations/dynamics365/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"integrations/dynamics365/fields/describe"},clone:{method:"post",url:t.baseUrl+"integrations/dynamics365/fields/:id/clone",params:{includeAll:"@includeAll"}}}),t.network=e(t.baseUrl+"networks/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"networks/describe"},clone:{method:"post",url:t.baseUrl+"networks/:id/clone",params:{includeAll:"@includeAll"}}}),t.chatQueueReport=e(t.baseUrl+"chat/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/reports/queue/describe"},clone:{method:"post",url:t.baseUrl+"chat/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),t.chatInternalMessage=e(t.baseUrl+"chat/internal/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/internal/messages/describe"},clone:{method:"post",url:t.baseUrl+"chat/internal/messages/:id/clone",params:{includeAll:"@includeAll"}},getUsers:{isArray:!1,method:"get",url:t.baseUrl+"chat/internal/messages/users"}}),t.jscriptyAnswerReport=e(t.baseUrl+"jscripty/answers/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"jscripty/answers/reports/describe"},clone:{method:"post",url:t.baseUrl+"jscripty/answers/reports/:id/clone",params:{includeAll:"@includeAll"}}}),t.jscriptyQuestionReport=e(t.baseUrl+"jscripty/questions/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"jscripty/questions/reports/describe"},clone:{method:"post",url:t.baseUrl+"jscripty/questions/reports/:id/clone",params:{includeAll:"@includeAll"}}}),t.jscriptySessionReport=e(t.baseUrl+"jscripty/sessions/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"jscripty/sessions/reports/describe"},clone:{method:"post",url:t.baseUrl+"jscripty/sessions/reports/:id/clone",params:{includeAll:"@includeAll"}},getQuestions:{isArray:!1,method:"get",url:t.baseUrl+"jscripty/sessions/reports/:id/questions"}}),t.smsQueueReport=e(t.baseUrl+"sms/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"sms/reports/queue/describe"},clone:{method:"post",url:t.baseUrl+"sms/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),t.squareReport=e(t.baseUrl+"square/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"square/reports/describe"},clone:{method:"post",url:t.baseUrl+"square/reports/:id/clone",params:{includeAll:"@includeAll"}}}),t.squareReportDetail=e(t.baseUrl+"square/details/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"square/details/reports/describe"},clone:{method:"post",url:t.baseUrl+"square/details/reports/:id/clone",params:{includeAll:"@includeAll"}}}),t.jscriptyProject=e(t.baseUrl+"jscripty/projects/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"jscripty/projects/describe"},clone:{method:"post",url:t.baseUrl+"jscripty/projects/:id/clone",params:{includeAll:"@includeAll"}},getSessions:{isArray:!1,method:"get",url:t.baseUrl+"jscripty/projects/:id/sessions"},getAnswers:{isArray:!1,method:"get",url:t.baseUrl+"jscripty/projects/:id/answers"},getSummary:{isArray:!1,method:"get",url:t.baseUrl+"jscripty/projects/:id/summary",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}}}),t.setting=e(t.baseUrl+"settings/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"settings/describe"},clone:{method:"post",url:t.baseUrl+"settings/:id/clone",params:{includeAll:"@includeAll"}},addLogo:{isArray:!1,method:"post",url:t.baseUrl+"settings/:id/logo"},addLogoLogin:{isArray:!1,method:"post",url:t.baseUrl+"settings/:id/logo_login"},getLogo:{isArray:!1,method:"get",url:t.baseUrl+"settings/:id/logo"},getLogoLogin:{isArray:!1,method:"get",url:t.baseUrl+"settings/:id/logo_login"},gdpr:{isArray:!1,method:"get",url:t.baseUrl+"settings/:id/gdpr"},addPreferred:{isArray:!1,method:"post",url:t.baseUrl+"settings/:id/preferred"},getPreferred:{isArray:!1,method:"get",url:t.baseUrl+"settings/:id/preferred"}}),t.squareOdbc=e(t.baseUrl+"square/odbc/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"square/odbc/describe"},clone:{method:"post",url:t.baseUrl+"square/odbc/:id/clone",params:{includeAll:"@includeAll"}},test:{isArray:!1,method:"get",url:t.baseUrl+"square/odbc/:id/test"}}),t.squareProject=e(t.baseUrl+"square/projects/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"square/projects/describe"},clone:{method:"post",url:t.baseUrl+"square/projects/:id/clone",params:{includeAll:"@includeAll"}},addUsers:{isArray:!0,method:"post",url:t.baseUrl+"square/projects/:id/users"},removeUsers:{isArray:!1,method:"delete",url:t.baseUrl+"square/projects/:id/users"},getUsers:{isArray:!1,method:"get",url:t.baseUrl+"square/projects/:id/users"}}),t.squareRecording=e(t.baseUrl+"square/recordings/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"square/recordings/describe"},clone:{method:"post",url:t.baseUrl+"square/recordings/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:t.baseUrl+"square/recordings/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}}}),t.squareMessage=e(t.baseUrl+"square/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"square/messages/describe"},clone:{method:"post",url:t.baseUrl+"square/messages/:id/clone",params:{includeAll:"@includeAll"}}}),t.team=e(t.baseUrl+"teams/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"teams/describe"},clone:{method:"post",url:t.baseUrl+"teams/:id/clone",params:{includeAll:"@includeAll"}},getQueues:{isArray:!0,method:"get",url:t.baseUrl+"teams/:id/queues"},addQueues:{isArray:!0,method:"post",url:t.baseUrl+"teams/:id/queues"},removeQueues:{isArray:!1,method:"delete",url:t.baseUrl+"teams/:id/queues"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"teams/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"teams/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"teams/:id/users"}}),t.license=e(t.baseUrl+"license/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"license/describe"},clone:{method:"post",url:t.baseUrl+"license/:id/clone",params:{includeAll:"@includeAll"}}}),t.campaign=e(t.baseUrl+"campaigns/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"campaigns/describe"},clone:{method:"post",url:t.baseUrl+"campaigns/:id/clone",params:{includeAll:"@includeAll"}},getHoppers:{isArray:!1,method:"get",url:t.baseUrl+"campaigns/:id/hoppers"},getHopperHistories:{isArray:!1,method:"get",url:t.baseUrl+"campaigns/:id/hopper_histories"},getHopperFinals:{isArray:!1,method:"get",url:t.baseUrl+"campaigns/:id/hopper_finals"},getHopperBlacks:{isArray:!1,method:"get",url:t.baseUrl+"campaigns/:id/hopper_black"},getLists:{isArray:!1,method:"get",url:t.baseUrl+"campaigns/:id/lists"},addLists:{isArray:!0,method:"post",url:t.baseUrl+"campaigns/:id/lists"},removeLists:{isArray:!0,method:"delete",url:t.baseUrl+"campaigns/:id/lists"},getBlackLists:{isArray:!1,method:"get",url:t.baseUrl+"campaigns/:id/blacklists"},addBlackLists:{isArray:!0,method:"post",url:t.baseUrl+"campaigns/:id/blacklists"},removeBlackLists:{isArray:!0,method:"delete",url:t.baseUrl+"campaigns/:id/blacklists"}}),t.migration=e(t.baseUrl+"migrations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"migrations/describe"},clone:{method:"post",url:t.baseUrl+"migrations/:id/clone",params:{includeAll:"@includeAll"}}}),t.attachment=e(t.baseUrl+"attachments/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"attachments/describe"},clone:{method:"post",url:t.baseUrl+"attachments/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:t.baseUrl+"attachments/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}}}),t.plugin=e(t.baseUrl+"plugins/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"plugins/describe"},clone:{method:"post",url:t.baseUrl+"plugins/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:t.baseUrl+"plugins/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}},upload:{isArray:!1,method:"post",url:t.baseUrl+"plugins/"},delete:{isArray:!1,method:"delete",url:t.baseUrl+"plugins/:id"},webhookGet:{isArray:!1,method:"get",url:t.baseUrl+"plugins/webhook"},webhookPost:{isArray:!1,method:"post",url:t.baseUrl+"plugins/webhook"}}),t.mailTransferReport=e(t.baseUrl+"mail/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"mail/reports/transfer/describe"},clone:{method:"post",url:t.baseUrl+"mail/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),t.chatTransferReport=e(t.baseUrl+"chat/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"chat/reports/transfer/describe"},clone:{method:"post",url:t.baseUrl+"chat/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),t.faxTransferReport=e(t.baseUrl+"fax/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"fax/reports/transfer/describe"},clone:{method:"post",url:t.baseUrl+"fax/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),t.openchannelTransferReport=e(t.baseUrl+"openchannel/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"openchannel/reports/transfer/describe"},clone:{method:"post",url:t.baseUrl+"openchannel/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),t.smsTransferReport=e(t.baseUrl+"sms/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"sms/reports/transfer/describe"},clone:{method:"post",url:t.baseUrl+"sms/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),t.cmList=e(t.baseUrl+"cm/lists/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"cm/lists/describe"},clone:{method:"post",url:t.baseUrl+"cm/lists/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:t.baseUrl+"cm/lists/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:t.baseUrl+"cm/lists/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:t.baseUrl+"cm/lists/:id/dispositions"},addContacts:{isArray:!1,method:"post",url:t.baseUrl+"cm/lists/:id/contacts"},getContacts:{isArray:!0,method:"get",url:t.baseUrl+"cm/lists/:id/contacts"},getContactsCsv:{isArray:!1,method:"get",url:t.baseUrl+"cm/lists/:id/contacts/csv",responseType:"arraybuffer",cache:!1,transformResponse:function(e,t){var n=t();return{type:n["content-type"],length:n["content-length"],buffer:e}}},addCustomField:{isArray:!1,method:"post",url:t.baseUrl+"cm/lists/:id/fields"},getCustomFields:{isArray:!1,method:"get",url:t.baseUrl+"cm/lists/:id/fields"},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"cm/lists/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"cm/lists/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"cm/lists/:id/users"}}),t.voicePrefix=e(t.baseUrl+"voice/prefixes/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"voice/prefixes/describe"},clone:{method:"post",url:t.baseUrl+"voice/prefixes/:id/clone",params:{includeAll:"@includeAll"}},addAgents:{isArray:!0,method:"post",url:t.baseUrl+"voice/prefixes/:id/users"},removeAgents:{isArray:!1,method:"delete",url:t.baseUrl+"voice/prefixes/:id/users"},getAgents:{isArray:!1,method:"get",url:t.baseUrl+"voice/prefixes/:id/users"}}),t.userProfile=e(t.baseUrl+"userProfiles/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"userProfiles/describe"},clone:{method:"post",url:t.baseUrl+"userProfiles/:id/clone",params:{includeAll:"@includeAll"}},addSections:{isArray:!0,method:"post",url:t.baseUrl+"userProfiles/:id/sections"},removeSections:{isArray:!1,method:"delete",url:t.baseUrl+"userProfiles/:id/sections"},addResources:{isArray:!0,method:"post",url:t.baseUrl+"userProfiles/:id/resources"},removeResources:{isArray:!1,method:"delete",url:t.baseUrl+"userProfiles/:id/resources"},getResources:{isArray:!1,method:"get",url:t.baseUrl+"userProfiles/:id/resources"}}),t.userProfileSection=e(t.baseUrl+"userProfile/sections/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"userProfile/sections/describe"},clone:{method:"post",url:t.baseUrl+"userProfile/sections/:id/clone",params:{includeAll:"@includeAll"}}}),t.userProfileResource=e(t.baseUrl+"userProfile/resources/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:t.baseUrl+"userProfile/resources/describe"},clone:{method:"post",url:t.baseUrl+"userProfile/resources/:id/clone",params:{includeAll:"@includeAll"}}}),t}e.$inject=["$resource"],angular.module("motion").factory("api",e)}(),function(){"use strict";function e(e,t){t.setConfig({position:"top-right",sound:!1,html:!0,theme:"material"}),e.useLoader("$translatePartialLoader",{urlTemplate:"{part}/i18n/{lang}.json"}),e.preferredLanguage("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,t,n,a){var i=this;i.themes=e.themes,i.direction="ltr";var s=n.get("motion.language");s&&(t.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 t=new Date,n=new Date(e);return n.getDate()===t.getDate()&&n.getMonth()===t.getMonth()&&n.getFullYear()===t.getFullYear()?a("date")(n.getTime(),"shortTime"):n.getDate()===t.getDate()-1&&n.getMonth()===t.getMonth()&&n.getFullYear()===t.getFullYear()?i.instant("DASHBOARDS.YESTERDAY")+" "+a("date")(n.getTime(),"shortTime"):a("date")(n.getTime(),"MMM d, y h:mm a")}}function t(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"],t.$inject=["$translate"],angular.module("motion").filter("limitObjectFromTo",function(){return function(e,t,n){var a,i={},s=0;for(a in e)if(n<=s&&(i[a]=e[a]),++s===n+t)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"}],t=[{value:"1"},{value:"2"},{value:"3"},{value:"4"},{value:"5"},{value:"6"},{value:"7"},{value:"8"},{value:"9"},{value:"10"},{value:"11"},{value:"12"}],n=[{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 t},getDaysOfWeek:function(){return n},getDaysOfMonth:function(){return a}}}).factory("dateFilterLocalizationFactory",t).factory("Sequence",function(){return{enqueue:function(e){this.tail=this.tail?this.tail.finally(e):e()}}})}(),function(){"use strict";function e(e,t,n){var a;n.html5Mode(!0),t.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",function(e){return e.resolve("setting@get",{id:1})}]}})}e.$inject=["$stateProvider","$urlRouterProvider","$locationProvider"],angular.module("motion").config(e)}(),function(){"use strict";function e(e,t,n){var a=e.$on("$stateChangeStart",function(){e.loadingProgress=!0}),i=e.$on("$stateChangeSuccess",function(){t(function(){e.loadingProgress=!1})});e.state=n,e.$on("$destroy",function(){a(),i()})}e.$inject=["$rootScope","$timeout","$state"],angular.module("motion").run(e)}(),function(){"use strict";function e(a,e){var i;function s(){i=io({query:"id="+e.getCurrentUser().id,transports:["websocket","polling"]})}return{connect:s,on:function(e,t){t=t||angular.noop,i||s(),i.on(e,function(){var e=arguments;a.$apply(function(){t.apply(i,e)})})},onWithoutApply:function(e,t){t=t||angular.noop,i||s(),i.on(e,function(){t.apply(i,arguments)})},emit:function(e,t,n){n=n||angular.noop,i||s(),i.emit(e,t,function(){var e=arguments;a.$apply(function(){n.apply(i,e)})})},removeAllListeners:function(e){i||s(),i.removeAllListeners(e)},removeListener:function(e,t){i||s(),i.removeListener(e,t)},disconnect:function(){i||s(),i.disconnect()}}}e.$inject=["$rootScope","Auth"],angular.module("motion").factory("socket",e)}(),function(){"use strict";function e(t,n,e,a,i,s){var o=this;o.progresslogin=!1,o.login=function(){return o.progresslogin=!0,o.message="",s.login(o.form).then(function(){return t.go("app.dashboards.general")}).catch(function(e){o.message=e.message}).finally(function(){o.progresslogin=!1})},o.loginOauth=function(e){o.message="",n.location.href="/api/auth/"+e},o.onInit=function(){{if(t.params.token&&t.params.userId)return s.removeCookies(),o.progresslogin=!0,e.put("motion.token",t.params.token),i.user.get({id:t.params.userId}).$promise.then(function(e){e&&(s.updateCurrentUser(e),t.go("app.dashboards.general"))}).finally(function(){o.progresslogin=!1});s.isLoggedIn()&&t.go("app.dashboards.general")}},o.onInit()}e.$inject=["$state","$window","$cookies","$timeout","api","Auth"],angular.module("app.login").controller("LoginController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.extractedReports,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The extractedReport will be deleted.").ariaLabel("Delete ExtractedReport").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.extractedReports=l||{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="extractedReports",b.listOrder="",b.listOrderAsc=null,b.selectedExtractedReports=[],b.query={fields:"createdAt,updatedAt,id,name,basename,savename,type,startDate,endDate,status,output,reportId,reportType",sort:"-updatedAt",limit:10,page:1},b.editdialog=function(e,t){i.show({controller:"CreateOrEditExtractedReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/extractedReports/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{extractedReport:e,extractedReports:b.extractedReports.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.downloadfile2=function(s,e){return m.analyticExtractedReport.download({id:s.id}).$promise.then(function(e){var t=[e.buffer],n="download",a=new Blob(t,{type:e.type});n=s.savename;var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getExtractedReports=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.analyticExtractedReport.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="ExtractedReports",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditExtractedReport=function(e,t){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:t,extractedReports:b.extractedReports.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteExtractedReport=S,b.exportSelectedExtractedReports=function(){var e=angular.copy(b.selectedExtractedReports);return b.selectedExtractedReports=[],e},b.deleteSelectedExtractedReports=function(e){var t=i.confirm().title("Are you sure want to delete the selected extractedReports?").htmlContent("<b>"+b.selectedExtractedReports.length+" selected</b> will be deleted.").ariaLabel("delete ExtractedReports").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedExtractedReports.forEach(function(e){S(e)}),b.selectedExtractedReports=[]})},b.deselectExtractedReports=function(){b.selectedExtractedReports=[]},b.selectAllExtractedReports=function(){b.selectedExtractedReports=b.extractedReports.rows};var E=!0,A=1;function y(e){b.extractedReports=e||{count:0,rows:[]}}function S(e){m.analyticExtractedReport.delete({id:e.id}).$promise.then(function(){_.remove(b.extractedReports.rows,{id:e.id}),b.extractedReports.count-=1,b.extractedReports.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEanalyticExtractedReport"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getExtractedReports())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","extractedReports","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.analytics").controller("ExtractedReportsController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.metrics,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The metric will be deleted.").ariaLabel("Delete Metric").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.metrics=l||{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="metrics",b.listOrder="",b.listOrderAsc=null,b.selectedMetrics=[],b.query={fields:"createdAt,updatedAt,id,name,table,metric,description",sort:"-updatedAt",limit:10,page:1},b.arraytable=_.keyBy([{option:"Agent Report",value:"'report_agent'"},{option:"Call Report",value:"'report_call'"},{option:"Contacts",value:"'cm_contacts'"},{option:"CSquare Report",value:"'report_square'"},{option:"CSquare Details Report",value:"'report_square_details'"},{option:"Dialer Hopper Processing",value:"'cm_hopper'"},{option:"Dialer Hopper Logs",value:"'cm_hopper_history'"},{option:"Dialer Hopper Final",value:"'cm_hopper_final'"},{option:"Integration Report",value:"'report_integration'"},{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:"Queue Report",value:"'report_queue'"},{option:"Users",value:"'users'"},{option:"Voice Recordings",value:"'voice_recordings'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editdialog=function(e,t){i.show({controller:"CreateOrEditMetricDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/metrics/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{metric:e,metrics:b.metrics.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getMetrics=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.analyticMetric.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Metrics",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditMetric=function(e,t){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:t,metrics:b.metrics.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteMetric=S,b.exportSelectedMetrics=function(){var e=angular.copy(b.selectedMetrics);return b.selectedMetrics=[],e},b.deleteSelectedMetrics=function(e){var t=i.confirm().title("Are you sure want to delete the selected metrics?").htmlContent("<b>"+b.selectedMetrics.length+" selected</b> will be deleted.").ariaLabel("delete Metrics").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedMetrics.forEach(function(e){S(e)}),b.selectedMetrics=[]})},b.deselectMetrics=function(){b.selectedMetrics=[]},b.selectAllMetrics=function(){b.selectedMetrics=b.metrics.rows};var E=!0,A=1;function y(e){b.metrics=e||{count:0,rows:[]}}function S(e){m.analyticMetric.delete({id:e.id}).$promise.then(function(){_.remove(b.metrics.rows,{id:e.id}),b.metrics.count-=1,b.metrics.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEanalyticMetric"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getMetrics())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","metrics","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.analytics").controller("MetricsController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o){var r=this;function l(){t.hide()}r.errors=[],r.report=angular.copy(n),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,t){r.currentNode=t.node}},r.copyReport=function(){var n;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){n=e,a.success({title:"Report properly copied!",msg:r.report.name?r.report.name+" has been copied!":""});var t={fields:"field,alias,function,format,groupBy,orderBy,custom,MetricId",nolimit:!0};return t["analyticCustomReport"===s?"CustomReportId":"DefaultReportId"]=r.report.id,i.analyticFieldReport.get(t).$promise}).then(function(e){var e=_.map(e.rows,function(e){return _.extend({},e,{CustomReportId:n.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,t,n,a,i,s,o,r,l,d){var c=this;function m(){t.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),n.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 t=0;t<e.data.errors.length;t++)n.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else n.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 t=_.find(c.reports,{id:e.id});t&&_.merge(t,e),n.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 t=0;t<e.data.errors.length;t++)n.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else n.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=t.confirm().title("Are you sure?").content("The report will be deleted.").ariaLabel("Delete Report").ok("Delete").cancel("Cancel").targetEvent(event);t.show(e).then(function(){s[o].delete({id:c.report.id}).$promise.then(function(){_.remove(c.reports,{id:c.report.id}),n.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(t,n,e){var a=_.find(c.tables,{name:e});a&&a.api&&s[a.api].describe().$promise.then(function(e){t[n]=_.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,t){r.report=e,r.report.condition=angular.fromJson(e.conditions)||{group:{operator:"AND",rules:[]}},r.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1};for(var n=0;n<r.report.condition.group.rules.length;n++)if(r.report.condition.group.rules[n].field){var a=r.report.condition.group.rules[n].field.split(".");1===a.length&&(r.report.condition.group.rules[n].field=r.report.table+"."+r.report.condition.group.rules[n].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,t,n){var a=i.confirm().title("Are you sure want to delete the item?").htmlContent("The item will be deleted.").ariaLabel("delete item").targetEvent(n).ok("OK").cancel("CANCEL");i.show(a).then(function(){e.splice(t,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(t){var a={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"};return{getMap:function(){var n=[];return _.forIn(a,function(e,t){n.push({name:t,api:e})}),n},getColumns:function(e){return t[a[e]].describe().$promise}}}e.$inject=["api"],angular.module("app.analytics").factory("describeTable",e)}(),function(){"use strict";function e(e,t,n,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(){n.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 t=_.find(u.reportFields,{id:e.id});t&&_.merge(t,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 t=n.confirm().title("Are you sure?").content("The field will be deleted.").ariaLabel("Delete Report").ok("Delete").cancel("Cancel").targetEvent(e);n.show(t).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,t,n,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,t){c.report=e,c.query.CustomReportId=c.report.id,c.crudPermissions=void 0!==t?t:{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,t){var n=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>"+e.field+"</b> will be deleted.").ariaLabel("delete field").targetEvent(t).ok("OK").cancel("CANCEL");a.show(n).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,t){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:t,reportFields:c.reportFields.rows,metrics:c.metrics,columns:c.columns,setting:null,crudPermissions:c.crudPermissions}})},c.deleteReportField=p,c.deleteSelectedReportFields=function(e){var t=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(t).then(function(){c.selectedReportFields.forEach(function(e){p(e)}),c.selectedReportFields=[]})},c.getMetricName=function(e){var t=_.find(c.metrics,{id:e});return t?t.name:d.instant("ANALYTICS.NO_METRIC_FOUND")},c.getMetricValue=function(e){var t=_.find(c.metrics,{id:e});return t?t.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()})})}t.$watch("vm_rf.query.filter",function(e,t){m?n(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,t,n,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")},o.saveReport=function(){o.report.conditions=angular.toJson(o.report.condition),n.analyticCustomReport.update({id:o.report.id},_.omit(o.report,"joins")).$promise.then(function(){t.success({title:"Report updated!",msg:o.report.name?o.report.name+" has been updated!":""})}).catch(function(e){t.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,n.analyticFieldReport.get({fields:"field,alias",nolimit:!0,CustomReportId:o.report.id}).$promise.then(function(e){return o.columns=e?e.rows:[],n.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"},t.error(o.error)})},o.queryReport=function(){return o.queryResult="Loading...",n.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"},t.error(o.error)})},o.mapArray=function(e,t){if(r(e))return _.map(e,t).join(",");return""},o.isArray=r,o.valueReplacer=function(e,t){moment(t,"YYYY-MM-DDTHH:mm:ssZ",!0).isValid()&&(t=moment(t,"").format("YYYY-MM-DD HH:mm:ss"));return t}}e.$inject=["$state","toasty","api","report","Auth","userProfileSection"],angular.module("app.analytics").controller("ReportController",e)}(),function(){"use strict";function e(e,t,n,a,i,s){var o=this;o.errors=[],o.report=angular.copy(a),o.valueReplacer=function(e,t){moment(t,"YYYY-MM-DDTHH:mm:ssZ",!0).isValid()&&(t=moment(t,"").format("YYYY-MM-DD HH:mm:ss"));return t},o.closeDialog=function(){t.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"},n.error(o.error)})}()}e.$inject=["$location","$mdDialog","toasty","report","api","apiName"],angular.module("app.analytics").controller("PreviewReportDialogController",e)}(),function(){"use strict";function e(e,n,a,i,s,o,t,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,t){s.go("app.analytics.reports.edit",{id:e.id,crudPermissions:p.crudPermissions})},p.copydialog=function(e,t){i.show({controller:"CopyReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/copy/dialog.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{report:e,apiName:p.apiName,treeCustomData:p.treeCustomInstance.jstree(!0).get_json("#")}}).finally(function(){})},p.previewdialog=function(e,t){i.show({controller:"PreviewReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/preview/dialog.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{report:e,apiName:p.apiName}})},p.rundialog=function(e,t){i.show({controller:"RunReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/run/dialog.html",parent:angular.element(a.body),targetEvent:t,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 t={fields:"field,alias,function,format,groupBy,orderBy,custom,MetricId",nolimit:!0};return t["analyticCustomReport"===p.apiName?"CustomReportId":"DefaultReportId"]=a.id,d.analyticFieldReport.get(t).$promise}).then(function(e){for(var t=0;t<e.rows.length;t+=1)e.rows[t].MetricId&&(e.rows[t].field=i[e.rows[t].MetricId].metric,e.rows[t].custom=!0),delete e.rows[t].MetricId;var n=o.document.createElement("a");n.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})),n.download=a.name+".json",n.target="_self",n.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,t){var n=i.confirm().title("Are you sure want to delete the report?").htmlContent("<b>"+e.name+"</b> will be deleted.").ariaLabel("delete report").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){b(e)},function(){console.log("CANCEL")})},p.success=h,p.getReports=f,p.createOrEditReport=function(e,t){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:t,reports:p.reports.rows,apiName:p.apiName,currentNode:p.currentNode,setting:null,crudPermissions:p.crudPermissions}})},p.importReport=function(e,t,n){if("application/json"===e.file.type){var a=new FileReader;a.onload=function(e){console.log(e.target.result);try{var n=atob(e.target.result.split(",")[1]);n=angular.fromJson(n),d.analyticCustomReport.save({name:n.name,description:n.description,table:n.table,conditions:n.conditions,joins:n.joins,parent:p.currentNode.id}).$promise.then(function(t){p.reports.rows.unshift(t),m.success({title:"Report saved!",msg:t.name?t.name+" has been saved!":""});var e=_.map(n.fields,function(e){return _.extend({},e,{CustomReportId:t.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 t=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(t).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 t=e&&e.rows?e.rows:[];if(0<t.length){var n=[];return a.forEach(function(e){_.find(t,["resourceId",e.id])&&n.push(e)}),h({count:n.length,rows:n})}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 t=0;t<e.data.errors.length;t++)m.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 E(e,t){p.treeDefaultInstance.jstree(!0).deselect_all(),p.treeDefaultInstance.jstree(!0).close_all(),p.currentNode=t.node,p.currentNode.custom=!0,p.currentPath=p.treeCustomInstance.jstree(!0).get_path(p.currentNode).join("/ "),p.apiName="analyticCustomReport",p.query.parent=t.node.id,f()}function A(e,t){p.treeCustomInstance.jstree(!0).deselect_all(),p.treeCustomInstance.jstree(!0).close_all(),p.currentNode=t.node,p.currentNode.custom=!1,p.currentPath=p.treeDefaultInstance.jstree(!0).get_path(p.currentNode).join("/ "),p.apiName="analyticDefaultReport",p.query.parent=t.node.id,f()}function y(e,t){var n=angular.toJson(p.treeCustomInstance.jstree(!0).get_json("#"));d.analyticTreeReport.update({id:2,tree:n}).$promise.then(function(){c.rows[1]&&(c.rows[1].tree=n),m.success({title:"Node Updated",msg:t.node.text?t.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(n){var e={};return p.crudPermissions.canEdit&&_.assign(e,{create:{label:t.instant("ANALYTICS.CREATE"),action:function(){n=p.treeCustomInstance.jstree(!0).create_node(n),p.treeCustomInstance.jstree(!0).edit(n)}},rename:{_disabled:"#"===n.parent,label:t.instant("ANALYTICS.RENAME"),action:function(){p.treeCustomInstance.jstree(!0).edit(n)}}}),p.crudPermissions.canDelete&&_.assign(e,{remove:{_disabled:"#"===n.parent,label:t.instant("ANALYTICS.REMOVE"),action:function(){var e=i.confirm().title("Are you sure want to delete the node?").htmlContent("<b>"+(n.text?n.text:"Node")+"</b> and its subnode will be deleted.").ariaLabel("delete node").ok("OK").cancel("CANCEL");i.show(e).then(function(){var e,t=p.treeCustomInstance.jstree(!0).get_parent(n);t=p.treeCustomInstance.jstree(!0).get_node(t),p.treeCustomInstance.jstree(!0).delete_node(n),e=[n.id].concat(n.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(t)})}}}),e}}}}function T(e){return e?{create_node:y,rename_node:y,move_node:y,delete_node:y,select_node:E}:{select_node:A}}e.$watch("vm.query.filter",function(e,t){g?n(function(){g=!1}):(t||(v=p.query.page),e!==t&&(p.query.page=1),e||(p.query.page=v),p.getReports())}),e.$watch("vm.search",function(e,t){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,n,a,t,i,s,o,r){var l=this;function d(){l.export={id:l.report.id,name:l.report.name,startDate:new Date(moment().startOf("day")),endDate:new Date(moment().endOf("day")),output:"xlsx",fullPath:r?r+"/"+l.report.name:l.report.name}}function c(){n.hide()}l.errors=[],l.report=angular.copy(t),l.export={},l.runReport=function(t){l.errors=[],l.exportDate=_.assign({},l.export,{startDate:moment(l.export.startDate).format("YYYY-MM-DD HH:mm:ss"),endDate:moment(l.export.endDate).format("YYYY-MM-DD HH:mm:ss")}),i[s].run(l.exportDate).$promise.then(function(e){"web"===l.export.output?n.show({controller:"WebReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/run/web/dialog.html",parent:angular.element(o.body),targetEvent:t,skipHide:!0,locals:{apiName:s,exportDate:l.exportDate,results:e},resolve:{columns:["apiResolver",function(e){var t={fields:"field,alias",nolimit:!0};return t["analyticCustomReport"===s?"CustomReportId":"DefaultReportId"]=l.report.id,e.resolve("analyticFieldReport@get",t)}]}}):(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,t,n,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=n[s].run(o,l).$promise},r.valueReplacer=function(e,t){moment(t,"YYYY-MM-DDTHH:mm:ssZ",!0).isValid()&&(t=moment(t,"").format("YYYY-MM-DD HH:mm:ss"));return t}}e.$inject=["$mdDialog","toasty","api","columns","results","apiName","exportDate"],angular.module("app.analytics").controller("WebReportDialogController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.odbcs,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The odbc will be deleted.").ariaLabel("Delete Odbc").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.odbcs=l||{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="odbcs",b.listOrder="",b.listOrderAsc=null,b.selectedODBC=[],b.query={fields:"createdAt,updatedAt,id,name,dsn,description",sort:"-updatedAt",limit:10,page:1},b.editdialog=function(e,t){i.show({controller:"CreateOrEditOdbcDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/odbcs/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{odbc:e,odbcs:b.odbcs.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.testtestOdbc=function(e,t){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()})})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getODBC=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.squareOdbc.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="ODBC",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditOdbc=function(e,t){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:t,odbcs:b.odbcs.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteOdbc=S,b.exportSelectedODBC=function(){var e=angular.copy(b.selectedODBC);return b.selectedODBC=[],e},b.deleteSelectedODBC=function(e){var t=i.confirm().title("Are you sure want to delete the selected odbcs?").htmlContent("<b>"+b.selectedODBC.length+" selected</b> will be deleted.").ariaLabel("delete Odbcs").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedODBC.forEach(function(e){S(e)}),b.selectedODBC=[]})},b.deselectODBC=function(){b.selectedODBC=[]},b.selectAllODBC=function(){b.selectedODBC=b.odbcs.rows};var E=!0,A=1;function y(e){b.odbcs=e||{count:0,rows:[]}}function S(e){m.squareOdbc.delete({id:e.id}).$promise.then(function(){_.remove(b.odbcs.rows,{id:e.id}),b.odbcs.count-=1,b.odbcs.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEsquareOdbc"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getODBC())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","odbcs","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.callysquare").controller("OdbcsController",e)}(),function(){"use strict";function e(t,n,a,i,s,e,o,r,l,d){var c=this;function m(e){t.hide(e)}c.errors=[],c.title="CALLYSQUARE.EDIT_PROJECT",c.crudPermissions=d,c.project=angular.copy(o),c.newWindow=!0,c.projects=e,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){return r.user.addSquareProjects({id:i.getCurrentUser().id,ids:[e.id]}).$promise,e}).then(function(e){c.projects.unshift(e),s.success({title:"Project properly created",msg:c.project.name?c.project.name+" has been created!":""}),m(e),c.openFromEditor&&(c.newWindow?n.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 t=0;t<e.data.errors.length;t++)s.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else s.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 t=_.find(c.projects,{id:e.id});t&&_.merge(t,e),s.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 t=0;t<e.data.errors.length;t++)s.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else s.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=t.confirm().title("Are you sure?").content("The project will be deleted.").ariaLabel("Delete Project").ok("Delete").cancel("Cancel").targetEvent(event);t.show(e).then(function(){r.squareProject.delete({id:c.project.id}).$promise.then(function(){return r.squareProject.getUsers({id:c.project.id}).$promise}).then(function(e){for(var t=[],n=e.rows,a=0;a<n.length;a++)t.push(r.user.removeSquareProjects({id:i.getCurrentUser().id,ids:[c.project.id]}).$promise);return $q.all(t)}).then(function(){_.remove(c.projects,{id:c.project.id}),s.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(t,a,i,e,n,s,o,r,l,d,c,m,u,p,g,v,h,f,b,E,A,y,S,T,I,C,w,O,x,R){var N=this,D={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"],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"]},P={queue:["file_id"],database:["variable_id"],pause:["pause_id"]},L={sendMail:["to","cc","bcc"],voicemail:["mailbox"]};function k(e,t,n,a){return _.map(e,function(e){return{value:e[t],option:e[n],group:a?e[a]:void 0,canSelect:void 0===e.canSelect||e.canSelect}})}function M(){var e=_.find(N.attributes,{name:"sip_id"});if(!_.some(N.attributes,{id:e.value})){if(!_.some(l,{id:Number(e.value)}))return a.user.get({id:_.find(N.attributes,{name:"sip_id"}).value,fields:"id,fullname,role"}).$promise.then(function(e){var t=e.toJSON();t.canSelect=!1,l.push(t),N.values.sip_id=k(l,"id","fullname","role")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_USER",msg:e.data?JSON.stringify(e.data.message):e.toString()})});N.values.sip_id=k(l,"id","fullname","role")}}function U(){var e=_.find(N.attributes,{name:"list_id"});if(!_.some(N.attributes,{id:e.value})){if(!_.some(E,{id:Number(e.value)}))return a.cmList.get({id:_.find(N.attributes,{name:"list_id"}).value,fields:"id,name"}).$promise.then(function(e){var t=e.toJSON();t.canSelect=!1,E.push(t),N.values.list_id=k(E,"id","name")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_LIST",msg:e.data?JSON.stringify(e.data.message):e.toString()})});N.values.list_id=k(E,"id","name")}}function F(n){var e=_.find(N.attributes,{name:n});if(!_.some(N.attributes,{id:e.value})){if(!_.some(d,{id:Number(e.value)}))return a.trunk.get({id:_.find(N.attributes,{name:n}).value,fields:"id,name"}).$promise.then(function(e){var t=e.toJSON();t.canSelect=!1,d.push(t),N.values[n]=k(d,"id","name")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_TRUNK",msg:e.data?JSON.stringify(e.data.message):e.toString()})});N.values[n]=k(d,"id","name")}}function $(){var e=_.find(N.attributes,{name:"queue_id"});if(!_.some(N.attributes,{id:e.value})){if(!_.some(c,{id:Number(e.value)}))return a.voiceQueue.get({id:_.find(N.attributes,{name:"queue_id"}).value,fields:"id,name"}).$promise.then(function(e){var t=e.toJSON();t.canSelect=!1,c.push(t),N.values.queue_id=k(c,"id","name")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_QUEUE",msg:e.data?JSON.stringify(e.data.message):e.toString()})});N.values.queue_id=k(c,"id","name")}}function q(){var e=_.find(N.attributes,{name:"file_id"});if(!_.some(N.attributes,{id:e.value})){if(!_.some(m,{id:Number(e.value)}))return a.sound.get({id:_.find(N.attributes,{name:"file_id"}).value,fields:"id,name"}).$promise.then(function(e){var t=e.toJSON();t.canSelect=!1,m.push(t),N.values.file_id=k(m,"id","name")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_SOUND",msg:e.data?JSON.stringify(e.data.message):e.toString()})});N.values.file_id=k(m,"id","name")}}function G(){var e=_.find(N.attributes,{name:"variable_id"});if(!_.some(N.attributes,{id:e.value})){if(!_.some(u,{id:Number(e.value)}))return a.variable.get({id:_.find(N.attributes,{name:"variable_id"}).value,fields:"id,name"}).$promise.then(function(e){var t=e.toJSON();t.canSelect=!1,u.push(t),N.values.variable_id=k(u,"id","name")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_VARIABLE",msg:e.data?JSON.stringify(e.data.message):e.toString()})});N.values.variable_id=k(u,"id","name")}}function H(){var e=_.find(N.attributes,{name:"odbc_id"});if(!_.some(N.attributes,{id:e.value})){if(!_.some(p,{id:Number(e.value)}))return a.squareOdbc.get({id:_.find(N.attributes,{name:"odbc_id"}).value,fields:"id,name"}).$promise.then(function(e){var t=e.toJSON();t.canSelect=!1,p.push(t),N.values.odbc_id=k(p,"id","name")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_ODBC",msg:e.data?JSON.stringify(e.data.message):e.toString()})});N.values.odbc_id=k(p,"id","name")}}function V(){var e=_.find(N.attributes,{name:"project_id"});if(!_.some(N.attributes,{id:e.value})){if(!_.some(g,{id:Number(e.value)}))return a.squareProject.get({id:_.find(N.attributes,{name:"project_id"}).value,fields:"id,name"}).$promise.then(function(e){var t=e.toJSON();t.canSelect=!1,g.push(t),N.values.project_id=k(g,"id","name")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_PROJECT",msg:e.data?JSON.stringify(e.data.message):e.toString()})});N.values.project_id=k(g,"id","name")}}function Q(){var e=_.find(N.attributes,{name:"context"});if(!_.some(N.attributes,{id:e.value})){if(!_.some(v,{id:Number(e.value)}))return a.voiceContext.get({id:_.find(N.attributes,{name:"context"}).value,fields:"id,name"}).$promise.then(function(e){var t=e.toJSON();t.canSelect=!1,v.push(t),N.values.context=k(v,"id","name")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_CONTEXT",msg:e.data?JSON.stringify(e.data.message):e.toString()})});N.values.context=k(v,"id","name")}}function B(){var e=_.find(N.attributes,{name:"interval_id"});if(!_.some(N.attributes,{id:e.value})){if(!_.some(h,{id:Number(e.value)}))return a.interval.get({id:_.find(N.attributes,{name:"interval_id"}).value,fields:"id,name,IntervalId"}).$promise.then(function(e){var t=e.toJSON();t.canSelect=!1,h.push(t),N.values.interval_id=k(h,"id","name","IntervalId")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_INTERVAL",msg:e.data?JSON.stringify(e.data.message):e.toString()})});N.values.interval_id=k(h,"id","name","IntervalId")}}function W(){var e=_.find(N.attributes,{name:"account_id"});if(!_.some(N.attributes,{id:e.value})){if(!_.some(f,{id:Number(e.value)}))return a.mailAccount.get({id:_.find(N.attributes,{name:"account_id"}).value,fields:"id,name"}).$promise.then(function(e){var t=e.toJSON();t.canSelect=!1,f.push(t),N.values.account_id=k(f,"id","name")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_MAIL_ACCOUNT",msg:e.data?JSON.stringify(e.data.message):e.toString()})});N.values.account_id=k(f,"id","name")}}function Y(){var e=_.find(N.attributes,{name:"sms_account_id"});if(!_.some(N.attributes,{id:e.value})){if(!_.some(I,{id:Number(e.value)}))return a.smsAccount.get({id:_.find(N.attributes,{name:"sms_account_id"}).value,fields:"id,name"}).$promise.then(function(e){var t=e.toJSON();t.canSelect=!1,I.push(t),N.values.sms_account_id=k(I,"id","name")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_SMS_ACCOUNT",msg:e.data?JSON.stringify(e.data.message):e.toString()})});N.values.sms_account_id=k(I,"id","name")}}function j(){var e=_.find(N.attributes,{name:"template_id"});if(!_.some(N.attributes,{id:e.value})){if(!_.some(b,{id:Number(e.value)}))return a.template.get({id:_.find(N.attributes,{name:"template_id"}).value,fields:"id,name"}).$promise.then(function(e){var t=e.toJSON();t.canSelect=!1,b.push(t),N.values.template_id=k(b,"id","name")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_TEMPLATE",msg:e.data?JSON.stringify(e.data.message):e.toString()})});N.values.template_id=k(b,"id","name")}}function z(){var e=_.find(N.attributes,{name:"pause_id"});if(!_.some(N.attributes,{id:e.value})){if(!_.some(C,{id:Number(e.value)}))return a.pause.get({id:_.find(N.attributes,{name:"pause_id"}).value,fields:"id,name"}).$promise.then(function(e){var t=e.toJSON();t.canSelect=!1,C.push(t),N.values.pause_id=k(C,"id","name")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_PAUSE",msg:e.data?JSON.stringify(e.data.message):e.toString()})});N.values.pause_id=k(C,"id","name")}}N.cellName=A.tagName,N.attributes=_.map(A.attributes,function(e){return{name:e.name,value:e.value,defaultValue:P[N.cellName]&&_.includes(P[N.cellName],e.name),required:D[N.cellName]&&_.includes(D[N.cellName],e.name),help:L[N.cellName]&&_.includes(L[N.cellName],e.name)}}),N.values={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:n,ispeech_tts_language:o,google_tts_language:r,google_asr_language:s,aws_polly_region:T,aws_polly_voice:S,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,aws_lex_region:O},N.crudPermissions=R,N.onInit=function(){x.hasRole("admin")?(e={sip_id:k(l,"id","fullname","role"),trunk_name:k(d,"name","name"),trunk_id:k(d,"id","name"),queue_id:k(c,"id","name"),file_id:k(m,"id","name"),variable_id:k(u,"id","name"),odbc_id:k(p,"id","name"),project_id:k(g,"id","name"),context:k(v,"id","name"),interval_id:(n=h,a="id",i="name",s="IntervalId",o=_.filter(n,function(e){return null===e[s]}),r=[],_.forEach(o,function(t){r.push({value:t[a],option:t[i]});var e=_.filter(n,function(e){return e[s]===t.id});_.forEach(e,function(e){r.push({value:e[a],option:" - "+e[i]})})}),r),account_id:k(f,"id","name"),template_id:k(b,"id","name"),list_id:k(E,"id","name"),sms_account_id:k(I,"id","name"),pause_id:k(C,"id","name")},t=_.merge(N.values,e),N.values=t):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"],t=0;t<N.attributes.length;t++)if(_.includes(e,N.attributes[t].name))switch(N.attributes[t].name){case"sip_id":M();break;case"trunk_name":case"trunk_id":F(N.attributes[t].name);break;case"queue_id":$();break;case"file_id":q();break;case"variable_id":G();break;case"odbc_id":H();break;case"project_id":V();break;case"context":Q();break;case"interval_id":B();break;case"account_id":W();break;case"template_id":j();break;case"list_id":U();break;case"sms_account_id":Y();break;case"pause_id":z()}}();var e,t,n,a,i,s,o,r},N.closeDialog=function(e){e&&y(N.attributes),t.hide()},N.getMap=k}e.$inject=["$mdDialog","api","toasty","ispeechAsrModel","ispeechAsrLanguage","googleAsrLanguage","ispeechTtsLanguage","googleTtsLanguage","users","trunks","queues","sounds","variables","databases","projects","contexts","intervals","mailAccounts","templates","lists","cell","saveCallback","awsPollyVoice","awsPollyRegion","smsAccounts","pauses","dialogFlowLanguage","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,t,n,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("googleTtsLanguage",function(){return[{value:"af",option:"Afrikaans"},{value:"sq",option:"Albanian"},{value:"am",option:"Amharic"},{value:"ar",option:"Arabic"},{value:"hy",option:"Armenian"},{value:"az",option:"Azerbaijani"},{value:"eu",option:"Basque"},{value:"be",option:"Belarusian"},{value:"bn",option:"Bengali"},{value:"bh",option:"Bihari"},{value:"bs",option:"Bosnian"},{value:"br",option:"Breton"},{value:"bg",option:"Bulgarian"},{value:"km",option:"Cambodian"},{value:"ca",option:"Catalan"},{value:"zh-CN",option:"Chinese (Simplified)"},{value:"zh-TW",option:"Chinese (Traditional)"},{value:"co",option:"Corsican"},{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:"fo",option:"Faroese"},{value:"tl",option:"Filipino"},{value:"fi",option:"Finnish"},{value:"fr",option:"French"},{value:"fy",option:"Frisian"},{value:"gl",option:"Galician"},{value:"ka",option:"Georgian"},{value:"de",option:"German"},{value:"el",option:"Greek"},{value:"gn",option:"Guarani"},{value:"gu",option:"Gujarati"},{value:"xx-hacker",option:"Hacker"},{value:"ha",option:"Hausa"},{value:"iw",option:"Hebrew"},{value:"hi",option:"Hindi"},{value:"hu",option:"Hungarian"},{value:"is",option:"Icelandic"},{value:"id",option:"Indonesian"},{value:"ia",option:"Interlingua"},{value:"ga",option:"Irish"},{value:"it",option:"Italian"},{value:"jw",option:"Javanese"},{value:"ja",option:"Japanese"},{value:"kn",option:"Kannada"},{value:"kk",option:"Kazakh"},{value:"rw",option:"Kinyarwanda"},{value:"rn",option:"Kirundi"},{value:"xx-klingon",option:"Klingon"},{value:"ku",option:"Kurdish"},{value:"ko",option:"Korean"},{value:"ky",option:"Kyrgyz"},{value:"lo",option:"Laothian"},{value:"la",option:"Latin"},{value:"lv",option:"Latvian"},{value:"ln",option:"Lingala"},{value:"lt",option:"Lithuanian"},{value:"mk",option:"Macedonian"},{value:"mg",option:"Malagasy"},{value:"ml",option:"Malayalam"},{value:"mt",option:"Maltese"},{value:"mi",option:"Maori"},{value:"mr",option:"Marathi"},{value:"mo",option:"Moldavian"},{value:"mn",option:"Mongolian"},{value:"sr-ME",option:"Montenegrin"},{value:"ne",option:"Nepali"},{value:"no",option:"Norwegian"},{value:"nn",option:"Norwegian (Nynorsk)"},{value:"oc",option:"Occitan"},{value:"or",option:"Oriya"},{value:"om",option:"Oromo"},{value:"ps",option:"Pashto"},{value:"fa",option:"Persian"},{value:"xx-pirate",option:"Pirate"},{value:"pl",option:"Polish"},{value:"pt-BR",option:"Portuguese (Brazil)"},{value:"pt-PT",option:"Portuguese (Portugal)"},{value:"pa",option:"Punjabi"},{value:"qu",option:"Quechua"},{value:"ro",option:"Romanian"},{value:"rm",option:"Romansh"},{value:"ru",option:"Russian"},{value:"gd",option:"Scots Gaelic"},{value:"sr",option:"Serbian"},{value:"sh",option:"Serbo-Croatian"},{value:"st",option:"Sesotho"},{value:"sn",option:"Shona"},{value:"sd",option:"Sindhi"},{value:"si",option:"Sinhalese"},{value:"sk",option:"Slovak"},{value:"sl",option:"Slovenian"},{value:"so",option:"Somali"},{value:"es",option:"Spanish"},{value:"su",option:"Sundanese"},{value:"sw",option:"Swahili"},{value:"sv",option:"Swedish"},{value:"tg",option:"Tajik"},{value:"ta",option:"Tamil"},{value:"tt",option:"Tatar"},{value:"te",option:"Telugu"},{value:"th",option:"Thai"},{value:"ti",option:"Tigrinya"},{value:"to",option:"Tonga"},{value:"tr",option:"Turkish"},{value:"tk",option:"Turkmen"},{value:"tw",option:"Twi"},{value:"ug",option:"Uighur"},{value:"uk",option:"Ukrainian"},{value:"ur",option:"Urdu"},{value:"uz",option:"Uzbek"},{value:"vi",option:"Vietnamese"},{value:"cy",option:"Welsh"},{value:"xh",option:"Xhosa"},{value:"yi",option:"Yiddish"},{value:"yo",option:"Yoruba"},{value:"zu",option:"Zulu"}]}).factory("googleAsrLanguage",function(){return[{value:"af-ZA",option:"Afrikaans (South Africa)"},{value:"am-ET",option:"Amharic (Ethiopia)"},{value:"hy-AM",option:"Armenian (Armenia)"},{value:"az-AZ",option:"Azerbaijani (Azerbaijan)"},{value:"id-ID",option:"Indonesian (Indonesia)"},{value:"ms-MY",option:"Malay (Malaysia)"},{value:"bn-BD",option:"Bengali (Bangladesh)"},{value:"bn-IN",option:"Bengali (India)"},{value:"ca-ES",option:"Catalan (Spain)"},{value:"cs-CZ",option:"Czech (Czech Republic)"},{value:"da-DK",option:"Danish (Denmark)"},{value:"de-DE",option:"German (Germany)"},{value:"en-AU",option:"English (Australia)"},{value:"en-CA",option:"English (Canada)"},{value:"en-GH",option:"English (Ghana)"},{value:"en-GB",option:"English (United Kingdom)"},{value:"en-IN",option:"English (India)"},{value:"en-IE",option:"English (Ireland)"},{value:"en-KE",option:"English (Kenya)"},{value:"en-NZ",option:"English (New Zealand)"},{value:"en-NG",option:"English (Nigeria)"},{value:"en-PH",option:"English (Philippines)"},{value:"en-ZA",option:"English (South Africa)"},{value:"en-TZ",option:"English (Tanzania)"},{value:"en-US",option:"English (United States)"},{value:"es-AR",option:"Spanish (Argentina)"},{value:"es-BO",option:"Spanish (Bolivia)"},{value:"es-CL",option:"Spanish (Chile)"},{value:"es-CO",option:"Spanish (Colombia)"},{value:"es-CR",option:"Spanish (Costa Rica)"},{value:"es-EC",option:"Spanish (Ecuador)"},{value:"es-SV",option:"Spanish (El Salvador)"},{value:"es-ES",option:"Spanish (Spain)"},{value:"es-US",option:"Spanish (United States)"},{value:"es-GT",option:"Spanish (Guatemala)"},{value:"es-HN",option:"Spanish (Honduras)"},{value:"es-MX",option:"Spanish (Mexico)"},{value:"es-NI",option:"Spanish (Nicaragua)"},{value:"es-PA",option:"Spanish (Panama)"},{value:"es-PY",option:"Spanish (Paraguay)"},{value:"es-PE",option:"Spanish (Peru)"},{value:"es-PR",option:"Spanish (Puerto Rico)"},{value:"es-DO",option:"Spanish (Dominican Republic)"},{value:"es-UY",option:"Spanish (Uruguay)"},{value:"es-VE",option:"Spanish (Venezuela)"},{value:"eu-ES",option:"Basque (Spain)"},{value:"fil-PH",option:"Filipino (Philippines)"},{value:"fr-CA",option:"French (Canada)"},{value:"fr-FR",option:"French (France)"},{value:"gl-ES",option:"Galician (Spain)"},{value:"ka-GE",option:"Georgian (Georgia)"},{value:"gu-IN",option:"Gujarati (India)"},{value:"hr-HR",option:"Croatian (Croatia)"},{value:"zu-ZA",option:"Zulu (South Africa)"},{value:"is-IS",option:"Icelandic (Iceland)"},{value:"it-IT",option:"Italian (Italy)"},{value:"jv-ID",option:"Javanese (Indonesia)"},{value:"kn-IN",option:"Kannada (India)"},{value:"km-KH",option:"Khmer (Cambodia)"},{value:"lo-LA",option:"Lao (Laos)"},{value:"lv-LV",option:"Latvian (Latvia)"},{value:"lt-LT",option:"Lithuanian (Lithuania)"},{value:"hu-HU",option:"Hungarian (Hungary)"},{value:"ml-IN",option:"Malayalam (India)"},{value:"mr-IN",option:"Marathi (India)"},{value:"nl-NL",option:"Dutch (Netherlands)"},{value:"ne-NP",option:"Nepali (Nepal)"},{value:"nb-NO",option:"Norwegian Bokmal (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:"si-LK",option:"Sinhala (Srilanka)"},{value:"sk-SK",option:"Slovak (Slovakia)"},{value:"sl-SI",option:"Slovenian (Slovenia)"},{value:"su-ID",option:"Sundanese (Indonesia)"},{value:"sw-TZ",option:"Swahili (Tanzania)"},{value:"sw-KE",option:"Swahili (Kenya)"},{value:"fi-FI",option:"Finnish (Finland)"},{value:"sv-SE",option:"Swedish (Sweden)"},{value:"ta-IN",option:"Tamil (India)"},{value:"ta-SG",option:"Tamil (Singapore)"},{value:"ta-LK",option:"Tamil (Sri Lanka)"},{value:"ta-MY",option:"Tamil (Malaysia)"},{value:"te-IN",option:"Telugu (India)"},{value:"vi-VN",option:"Vietnamese (Vietnam)"},{value:"tr-TR",option:"Turkish (Turkey)"},{value:"ur-PK",option:"Urdu (Pakistan)"},{value:"ur-IN",option:"Urdu (India)"},{value:"el-GR",option:"Greek (Greece)"},{value:"bg-BG",option:"Bulgarian (Bulgaria)"},{value:"ru-RU",option:"Russian (Russia)"},{value:"sr-RS",option:"Serbian (Serbia)"},{value:"uk-UA",option:"Ukrainian (Ukraine)"},{value:"he-IL",option:"Hebrew (Israel)"},{value:"ar-IL",option:"Arabic (Israel)"},{value:"ar-JO",option:"Arabic (Jordan)"},{value:"ar-AE",option:"Arabic (United Arab Emirates)"},{value:"ar-BH",option:"Arabic (Bahrain)"},{value:"ar-DZ",option:"Arabic (Algeria)"},{value:"ar-SA",option:"Arabic (Saudi Arabia)"},{value:"ar-IQ",option:"Arabic (Iraq)"},{value:"ar-KW",option:"Arabic (Kuwait)"},{value:"ar-MA",option:"Arabic (Morocco)"},{value:"ar-TN",option:"Arabic (Tunisia)"},{value:"ar-OM",option:"Arabic (Oman)"},{value:"ar-PS",option:"Arabic (State of Palestine)"},{value:"ar-QA",option:"Arabic (Qatar)"},{value:"ar-LB",option:"Arabic (Lebanon)"},{value:"ar-EG",option:"Arabic (Egypt)"},{value:"fa-IR",option:"Persian (Iran)"},{value:"hi-IN",option:"Hindi (India)"},{value:"th-TH",option:"Thai (Thailand)"},{value:"ko-KR",option:"Korean (South Korea)"},{value:"cmn-Hant-TW",option:"Chinese, Mandarin (Traditional, Taiwan)"},{value:"yue-Hant-HK",option:"Chinese, Cantonese (Traditional, Hong Kong)"},{value:"ja-JP",option:"Japanese (Japan)"},{value:"cmn-Hans-HK",option:"Chinese, Mandarin (Simplified, Hong Kong)"},{value:"cmn-Hans-CN",option:"Chinese, Mandarin (Simplified, China)"}]}).factory("awsPollyVoice",function(){return[{value:"Amy",option:"Amy (English, British, Female)"},{value:"Astrid",option:"Astrid (Swedish, Female)"},{value:"Brian",option:"Brian (English, British, Male)"},{value:"Carla",option:"Carla (Italian, Female)"},{value:"Carmen",option:"Carmen (Romanian, Female)"},{value:"Celine",option:"Celine (French, Female)"},{value:"Chantal",option:"Chantal (French, Canadian, Female)"},{value:"Conchita",option:"Conchita (Spanish, Castilian, Female)"},{value:"Cristiano",option:"Cristiano (Portuguese, Male)"},{value:"Dora",option:"Dora (Icelandic, Female)"},{value:"Emma",option:"Emma (English, British, Female)"},{value:"Enrique",option:"Enrique (Spanish, Castilian, Male)"},{value:"Ewa",option:"Ewa (Polish, Female)"},{value:"Filiz",option:"Filiz (Turkish, Female)"},{value:"Geraint",option:"Geraint (English, Welsh, Male)"},{value:"Giorgio",option:"Giorgio (Italian, Male)"},{value:"Gwineth",option:"Gwineth (Welsh, Female)"},{value:"Hans",option:"Hans (German, Male)"},{value:"Ines",option:"Ines (Portuguese, Female)"},{value:"Ivy",option:"Ivy (English, US, Female)"},{value:"Jacek",option:"Jacek (Polish, Male)"},{value:"Jan",option:"Jan (Polish, Male)"},{value:"Joanna",option:"Joanna (English, US, Female)"},{value:"Joey",option:"Joey (English, US, Male)"},{value:"Justin",option:"Justin (English, US, Male)"},{value:"Karl",option:"Karl (Icelandic, Male)"},{value:"Kendra",option:"Kendra (English, US, Female)"},{value:"Kimberly",option:"Kimberly (English, US, Female)"},{value:"Liv",option:"Liv (Norwegian, Female)"},{value:"Lotte",option:"Lotte (Dutch, Female)"},{value:"Mads",option:"Mads (Danish, Male)"},{value:"Maja",option:"Maja (Polish, Female)"},{value:"Marlene",option:"Marlene (German, Female)"},{value:"Mathieu",option:"Mathieu (French, Male)"},{value:"Maxim",option:"Maxim (Russian, Male)"},{value:"Miguel",option:"Miguel (Spanish, US, Male)"},{value:"Mizuki",option:"Mizuki (Japanese, Female)"},{value:"Naja",option:"Naja (Danish, Female)"},{value:"Nicole",option:"Nicole (English, Austrialian, Female)"},{value:"Penelope",option:"Penelope (Spanish, US, Female)"},{value:"Raveena",option:"Raveena (English, Indian, Female)"},{value:"Ricardo",option:"Ricardo (Portuguese, Brazilian, Male)"},{value:"Ruben",option:"Ruben (Dutch, Male)"},{value:"Russell",option:"Russell (English, Austrialian, Male)"},{value:"Salli",option:"Salli (English, US, Female)"},{value:"Tatyana",option:"Tatyana (Russian, Female)"},{value:"Vitoria",option:"Vitoria (Portuguese, Brazilian, 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)"}]})}(),function(){"use strict";function e(t,e,n,a){var i=this;i.project={preproduction:n},i.closeDialog=function(e){e?(a(i.project.preproduction),t.hide(i.project.preproduction)):t.hide()}}e.$inject=["$mdDialog","toasty","currentXML","saveCallback"],angular.module("app.callysquare").controller("MxGraphEditXMLController",e)}(),function(){"use strict";function e(t,n){var a=this;function i(e){e?(n(e),t.hide(e)):t.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 t=new FileReader;t.onload=function(e){i(e.target.result)},t.readAsText(e.file)}}}e.$inject=["$mdDialog","saveCallback"],angular.module("app.callysquare").controller("MxGraphImportXMLController",e)}(),function(){"use strict";function e(t,n,e,a){var i=this;i.project=_.clone(e),i.closeDialog=function(){t.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){n.success({title:"Project updated!",msg:i.project.name?i.project.name+" has been updated!":""}),t.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(t,e,n,a,i){var s=this;s.projects=n,s.id="",s.newWindow=!0,s.closeDialog=function(e){s.errors=[],e?(t.hide(),s.newWindow?a.open("/callysquare/projects/"+s.id,"_blank"):i.go("app.callysquare.projects.edit",{id:s.id})):t.hide()}}e.$inject=["$mdDialog","toasty","projects","$window","$state"],angular.module("app.callysquare").controller("MxGraphOpenProjectController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o){var r=this;function l(){return a.squareProject.getUsers({id:r.project.id,fields:"id,name,fullname,internal",nolimit:!0,role:"user"}).$promise.then(function(e){return r.selectedItems=e.rows?_.map(e.rows,function(e){return e}):[],r.dualMultiselectOptions.selectedItems=r.selectedItems,a.user.get({fields:"id,fullname,name,internal",role:"user",nolimit:!0}).$promise}).then(function(e){r.items=e.rows?_.map(e.rows,function(e){return e}):[],r.dualMultiselectOptions.items=_.differenceBy(r.items,r.selectedItems,"id")}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETUSERS",msg:e.status?JSON.stringify(e.data):e.toString()})})}r.project=t,r.penalty=0,r.items=[],r.selectedItems=[],r.closeDialog=function(){e.hide()},r.dualMultiselectOptions={readOnly:!1,items:[],selectedItems:[],showSelectAndDeselectAll:!0,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"penalty",labelAll:s.instant("CALLYSQUARE.ALL_USERS"),labelSelected:s.instant("CALLYSQUARE.SELECTED_USERS"),transferCallback:function(e,t){a.squareProject[t?"removeUsers":"addUsers"]({id:r.project.id,ids:_.map(e,"id"),penalty:r.penalty||0}).$promise.then(function(){n.success({title:"Project properly "+(t?"removed":"added"),msg:"Project has been "+(t?"removed":"added")+"!"}),t||l()}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:squareProjects.ADDUSERS",msg:e.status?JSON.stringify(e.data):e.toString()})})}},l()}e.$inject=["$mdDialog","toasty","api","project","projects","$translate","Auth"],angular.module("app.callysquare").controller("ProjectspermissionaddController",e)}(),function(){"use strict";function e(t,n,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(){t.hide()},r.save=function(){delete r.project.id,i.squareProject.save(r.project).$promise.then(function(e){n.success({title:"Project properly created",msg:r.project.name?r.project.name+" has been created!":""}),t.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,n,a,i,s,o,r,t,l,d,c,m,u,p,g,v,h,f,b,E,A,y,S,T){var I=this;I.currentUser=T.getCurrentUser(),I.project=t||{},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,t){var n={preproduction:e};t&&(n.production=e);r.squareProject.update({id:I.project.id},n).$promise.then(function(e){o.success({title:"Project "+(t?"published":"saved")+"!",msg:I.project.name?I.project.name+" has been "+(t?"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,t){a.show({controller:"MxGraphDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/dialog/dialog.html",parent:angular.element(n.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:A.rows||[],pauses:y.rows||[],templates:b.rows||[],lists:E.rows||[],cell:e,saveCallback:t,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(n.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(n.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(n.body),clickOutsideToClose:!0,locals:{project:I.project,currentXML:e}}).then(function(e){e&&v.rows.push(e)})},I.newVariable=function(t){return i(function(a,t){return r.userProfileSection.get({userProfileId:I.currentUser.userProfileId,sectionId:1012}).$promise.then(function(e){var t=e.rows?e.rows[0]:null,n=T.parseCrudPermissions(t?t.crudPermissions:null);a(n)}).catch(function(e){t(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(n.body),clickOutsideToClose:!0,locals:{variable:t,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(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{project:I.project}}).then(function(e){e&&_.merge(I.project,e)})},I.editXML=function(e,t){a.show({controller:"MxGraphEditXMLController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/edit/edit.html",parent:angular.element(n.body),clickOutsideToClose:!0,locals:{currentXML:e,saveCallback:t}}).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(n.body),clickOutsideToClose:!0,locals:{saveCallback:e}}).then(function(e){e&&(I.project.preproduction=e)})},I.gotoProjects=function(){e.go("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,n,t,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.table="projects",p.listOrder="",p.listOrderAsc=null,p.selectedProjects=[],p.query={fields:"id,name,description,notes",sort:"-updatedAt",limit:10,page:1},p.editstate=function(e,t){n.go("app.callysquare.projects.edit",{id:e.id,crudPermissions:p.crudPermissions})},p.deleteconfirm=function(e,t){var n=l.confirm().title("Are you sure want to delete the project?").htmlContent("<b>"+e.name+"</b> will be deleted.").ariaLabel("delete project").targetEvent(t).ok("OK").cancel("CANCEL");l.show(n).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="Projects",p.promise=o.userProfile.getResources(p.query,h).$promise)},p.createOrEditProject=function(e,t){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:t,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 t=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(t).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 t=0;t<e.data.errors.length;t++)m.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){g?c(function(){g=!1}):(t||(v=p.query.page),e!==t&&(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,t,n,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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.squareRecordings,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The squareRecording will be deleted.").ariaLabel("Delete SquareRecording").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.squareRecordings=l||{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="squareRecordings",b.listOrder="",b.listOrderAsc=null,b.selectedSquareRecordings=[],b.query={fields:"createdAt,updatedAt,id,filename,projectName,uniqueid,callerid,extension,audio",sort:"-updatedAt",limit:10,page:1},b.downloadfile2=function(s,e){return m.squareRecording.download({id:s.id}).$promise.then(function(e){var t=[e.buffer],n="download",a=new Blob(t,{type:e.type});n=s.uniqueid+".wav";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getSquareRecordings=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.squareRecording.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="SquareRecordings",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditSquareRecording=function(e,t){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:t,squareRecordings:b.squareRecordings.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteSquareRecording=S,b.exportSelectedSquareRecordings=function(){var e=angular.copy(b.selectedSquareRecordings);return b.selectedSquareRecordings=[],e},b.deleteSelectedSquareRecordings=function(e){var t=i.confirm().title("Are you sure want to delete the selected squareRecordings?").htmlContent("<b>"+b.selectedSquareRecordings.length+" selected</b> will be deleted.").ariaLabel("delete SquareRecordings").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedSquareRecordings.forEach(function(e){S(e)}),b.selectedSquareRecordings=[]})},b.deselectSquareRecordings=function(){b.selectedSquareRecordings=[]},b.selectAllSquareRecordings=function(){b.selectedSquareRecordings=b.squareRecordings.rows};var E=!0,A=1;function y(e){b.squareRecordings=e||{count:0,rows:[]}}function S(e){m.squareRecording.delete({id:e.id}).$promise.then(function(){_.remove(b.squareRecordings.rows,{id:e.id}),b.squareRecordings.count-=1,b.squareRecordings.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEsquareRecording"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getSquareRecordings())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","squareRecordings","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.callysquare").controller("SquareRecordingsController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.chatQueues=l||{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="chatQueues",b.listOrder="",b.listOrderAsc=null,b.selectedChatQueues=[],b.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"chat",limit:10,page:1},b.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.chat.chatQueues.edit",{id:e.id,chatQueue:e,crudPermissions:b.crudPermissions})},b.teamadddialog=function(e,t){i.show({controller:"ChatQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{chatQueue:e,chatQueues:b.chatQueues?b.chatQueues.rows:[],crudPermissions:b.crudPermissions}})},b.agentadddialog=function(e,t){i.show({controller:"ChatQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{chatQueue:e,chatQueues:b.chatQueues?b.chatQueues.rows:[],crudPermissions:b.crudPermissions,realtime:!1}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.gotorealtimegoto=function(e,t){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:510}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.chat.realtime.queues",{})}},b.success=y,b.getChatQueues=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.chatQueue.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="ChatQueues",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditChatQueue=function(e,t){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:t,chatQueues:b.chatQueues.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteChatQueue=S,b.exportSelectedChatQueues=function(){var e=angular.copy(b.selectedChatQueues);return b.selectedChatQueues=[],e},b.deleteSelectedChatQueues=function(e){var t=i.confirm().title("Are you sure want to delete the selected chatQueues?").htmlContent("<b>"+b.selectedChatQueues.length+" selected</b> will be deleted.").ariaLabel("delete ChatQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedChatQueues.forEach(function(e){S(e)}),b.selectedChatQueues=[]})},b.deselectChatQueues=function(){b.selectedChatQueues=[]},b.selectAllChatQueues=function(){b.selectedChatQueues=b.chatQueues.rows};var E=!0,A=1;function y(e){b.chatQueues=e||{count:0,rows:[]}}function S(e){m.chatQueue.delete({id:e.id}).$promise.then(function(){_.remove(b.chatQueues.rows,{id:e.id}),b.chatQueues.count-=1,b.chatQueues.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEchatQueue"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getChatQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","chatQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.chat").controller("ChatQueuesController",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(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_CHATQUEUE",g.chatQueue=angular.copy(l),g.chatQueues=r,g.newChatQueue=!1,g.chatQueue||(g.chatQueue={strategy:"beepall",timeout:10},g.title="CHAT.NEW_CHATQUEUE",g.newChatQueue=!0),g.addNewChatQueue=function(){g.errors=[],d.chatQueue.save(g.chatQueue).$promise.then(function(e){g.chatQueues.unshift(e.toJSON()),o.success({title:"ChatQueue properly created",msg:g.chatQueue.name?g.chatQueue.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.chatQueue.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveChatQueue=function(){g.errors=[],d.chatQueue.update({id:g.chatQueue.id},g.chatQueue).$promise.then(function(e){var t=_.find(g.chatQueues,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"ChatQueue properly saved!",msg:g.chatQueue.name?g.chatQueue.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.chatQueue.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteChatQueue=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The chatQueue will be deleted.").ariaLabel("Delete ChatQueue").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.chatQueue.delete({id:g.chatQueue.id}).$promise.then(function(){_.remove(g.chatQueues,{id:g.chatQueue.id}),o.success({title:"ChatQueue properly deleted!",msg:(g.chatQueue.name||"chatQueue")+" has been deleted!"}),v(g.chatQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatQueue.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.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(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","chatQueues","chatQueue","api","Auth","license","setting","crudPermissions"],angular.module("app.chat").controller("CreateOrEditChatQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,t,n,o,r,l,d){var c=this;function m(){return a(function(n,t){return a(function(t,n){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.chatQueue.getAgents({id:c.chatQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return t.penalty=e.UserChatQueue?"penalty "+e.UserChatQueue.penalty:"",t.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=l.getCurrentUser(),c.chatQueue=t,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(n,t){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.chatQueue.removeAgents({id:c.chatQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.chatQueue.addAgents({id:c.chatQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,items:[],selectedItems:[],showSelectAndDeselectAll:!o,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("CHAT.ALL_AGENTS"),labelSelected:r.instant("CHAT.SELECTED_AGENTS"),transferCallback:function(e,t){var n=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(n)}}}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,t,n,o,r){var l=this;function d(){return a(function(n,t){return a(function(t,n){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:l.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return l.allowedItems=_.map(t,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var t=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.chatQueue.getTeams({id:l.chatQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];l.selectedItems=_.map(t,function(e){return _.find(l.items,{id:e.id})}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}l.currentUser=o.getCurrentUser(),l.chatQueue=t,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={readOnly:!l.crudPermissions.canEdit,allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!0,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:n.instant("CHAT.ALL_TEAMS"),labelSelected:n.instant("CHAT.SELECTED_TEAMS"),transferCallback:function(e,t){var n=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(n)}},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(n,t){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.chatQueue.removeTeams({id:l.chatQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.chatQueue.addTeams({id:l.chatQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},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,t,n,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=t.protocol()+"://"+t.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,t){n.show({controller:"ChatQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{chatQueue:e,chatQueues:u.chatQueues?u.chatQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,t){n.show({controller:"ChatQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:t,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")},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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.chatWebsites=l||{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="chatWebsites",b.listOrder="",b.listOrderAsc=null,b.selectedChatWebsites=[],b.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,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,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,forwardOfflineAddress,IntervalId,timezone,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,page:1},b.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"),"")}),b.arrayheader_shape=_.keyBy([{option:"Rounded",value:"'rounded'"},{option:"Squared",value:"'squared'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.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"),"")}),b.arraymessagesAlignment=_.keyBy([{option:"alternate",value:"'alternate'"},{option:"centered",value:"'centered'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arrayratingType=_.keyBy([{option:"Star",value:"'star'"},{option:"Thumb",value:"'thumb'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.chat.chatWebsites.edit",{id:e.id,chatWebsite:e,crudPermissions:b.crudPermissions})},b.interactionsgoto=function(e,t){n.go("app.chat.chatWebsites.edit",{id:e.id,tab:9})},b.offlinemessagesgoto=function(e,t){n.go("app.chat.chatWebsites.edit",{id:e.id,tab:10})},b.agentadddialog=function(e,t){i.show({controller:"ChatWebsiteagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{chatWebsite:e,chatWebsites:b.chatWebsites?b.chatWebsites.rows:[],crudPermissions:b.crudPermissions,realtime:!1}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getChatWebsites=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.chatWebsite.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="ChatWebsites",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditChatWebsite=function(e,t){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:t,chatWebsites:b.chatWebsites.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteChatWebsite=S,b.exportSelectedChatWebsites=function(){var e=angular.copy(b.selectedChatWebsites);return b.selectedChatWebsites=[],e},b.deleteSelectedChatWebsites=function(e){var t=i.confirm().title("Are you sure want to delete the selected chatWebsites?").htmlContent("<b>"+b.selectedChatWebsites.length+" selected</b> will be deleted.").ariaLabel("delete ChatWebsites").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedChatWebsites.forEach(function(e){S(e)}),b.selectedChatWebsites=[]})},b.deselectChatWebsites=function(){b.selectedChatWebsites=[]},b.selectAllChatWebsites=function(){b.selectedChatWebsites=b.chatWebsites.rows},g.hasRole("admin")?m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){b.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){b.lists=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(b.lists,{id:e.resourceId})}),n=null;if(b.chatWebsite&&(n=_.find(b.lists,{id:Number(b.chatWebsite.ListId)})),n&&!_.some(t,["id",n.id])){var a=_.find(b.lists,{id:n.id});a.canSelect=!1,t.push(a)}b.lists=t})}else{var n=[],a=null;b.chatWebsite&&(a=_.find(b.lists,{id:Number(b.chatWebsite.ListId)}));for(var i=0;i<b.lists.length;i++)a&&b.lists[i].id===a.id&&(b.lists[i].canSelect=!1,n.push(b.lists[i]));b.lists=n}}).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){b.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){b.interval=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(b.interval,{id:e.resourceId})}),n=null;if(b.chatWebsite&&(n=_.find(b.interval,{id:Number(b.chatWebsite.IntervalId)})),n&&!_.some(t,["id",n.id])){var a=_.find(b.interval,{id:n.id});a.canSelect=!1,t.push(a)}b.interval=t})}else{var n=[],a=null;b.chatWebsite&&(a=_.find(b.interval,{id:Number(b.chatWebsite.IntervalId)}));for(var i=0;i<b.interval.length;i++)a&&b.interval[i].id===a.id&&(b.interval[i].canSelect=!1,n.push(b.interval[i]));b.interval=n}}).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 E=!0,A=1;function y(e){b.chatWebsites=e||{count:0,rows:[]}}function S(e){m.chatWebsite.delete({id:e.id}).$promise.then(function(){_.remove(b.chatWebsites.rows,{id:e.id}),b.chatWebsites.count-=1,b.chatWebsites.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEchatWebsite"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getChatWebsites())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","chatWebsites","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.chat").controller("ChatWebsitesController",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(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:n.protocol()+"://"+n.host()+(n.port()?":"+n.port():""),header_shape:"rounded",alignment:"bottom_right",verticalAlignment:30,messagesAlignment:"alternate",IntervalId:"null",timezone:"null",waitForTheAssignedAgent:10,notificationSound:!0,queueTransferTimeout:300,agentTransferTimeout:300},g.title="CHAT.NEW_CHATWEBSITE",g.newChatWebsite=!0),t.params.id&&(g.chatWebsite.ChatWebsiteId=t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.chatWebsites,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The chatWebsite will be deleted.").ariaLabel("Delete ChatWebsite").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.lists,{id:e.resourceId})}),n=null;if(g.chatWebsite&&(n=_.find(g.lists,{id:Number(g.chatWebsite.ListId)})),n&&!_.some(t,["id",n.id])){var a=_.find(g.lists,{id:n.id});a.canSelect=!1,t.push(a)}g.lists=t})}else{var n=[],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,n.push(g.lists[i]));g.lists=n}}).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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.interval,{id:e.resourceId})}),n=null;if(g.chatWebsite&&(n=_.find(g.interval,{id:Number(g.chatWebsite.IntervalId)})),n&&!_.some(t,["id",n.id])){var a=_.find(g.interval,{id:n.id});a.canSelect=!1,t.push(a)}g.interval=t})}else{var n=[],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,n.push(g.interval[i]));g.interval=n}}).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 t(e,t){if(r.chatWebsiteApps.rows.length){var n=r.chatWebsiteApps.rows[t]?r.chatWebsiteApps.rows[t]:r.chatWebsiteApps.rows[0];i.show({controller:"EditChatWebsiteApp"+(n.appType||n.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/apps/"+(n.appType||n.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsiteApp:n,chatWebsite:r.chatWebsite,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.chatWebsiteApps.rows[t]=e:r.chatWebsiteApps.rows.splice(t,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,t=[],n=0;n<r.chatWebsiteApps.rows.length;n++,0){var a=r.chatWebsiteApps.rows[n],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,t=_.concat(t,i,[a],s)}o.chatWebsite.addApplications({id:r.chatWebsite.id},_.sortBy(t,"priority")).$promise.then(function(e){r.chatWebsiteApps.rows=e.rows}).catch(function(e){console.error(e)})}function n(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:"1"},{option:"Always",value:"0"}],required:!0,param:0},{title:"Text",name:"text",type:"textarea",maxlength:255,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:"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"]),{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){t(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,t){r.chatWebsite=e,r.crudPermissions=void 0!==t?t:{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,t,n){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(n).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.chatWebsiteApps.rows.splice(t,1),l()},function(){console.log("CANCEL")})},r.getChatWebsiteApps=function(){r.promise=o.chatWebsite.getApplications(r.query,n).$promise},r.editChatWebsiteApp=t,r.editInterval=function(e,t){if(r.chatWebsiteApps.rows.length){var n=r.chatWebsiteApps.rows[t]?r.chatWebsiteApps.rows[t]: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:n.interval,IntervalId:n.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(n.interval=e.interval||"*,*,*,*",n.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 t=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(t).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,t,n,o,r,l,d){var c=this;function m(){return a(function(n,t){return a(function(t,n){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.chatWebsite.getAgents({id:c.chatWebsite.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return t.penalty=e.UserChatWebsite?"penalty "+e.UserChatWebsite.penalty:"",t.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=l.getCurrentUser(),c.chatWebsite=t,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(n,t){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.chatWebsite.removeAgents({id:c.chatWebsite.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.chatWebsite.addAgents({id:c.chatWebsite.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,items:[],selectedItems:[],showSelectAndDeselectAll:!o,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("CHAT.ALL_AGENTS"),labelSelected:r.instant("CHAT.SELECTED_AGENTS"),transferCallback:function(e,t){var n=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(n)}}}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 t=["png","jpg"];if(!_.includes(t,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+t.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var n={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.chatWebsite.images.unshift(n),!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(t,e){if(t.id===a.uniqueIdentifier){var n=new FileReader;n.readAsDataURL(t.file.file),n.onload=function(e){t.url=e.target.result},t.type="image"}})},i.init=function(e,t){i.chatWebsite=angular.copy(e),i.crudPermissions=void 0!==t?t:{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(t,e,n,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"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){t.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 t=_.find(l.agents,{name:l.agent.agent});t&&(l.agent.UserId=t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),n=null;if(l.agent&&(n=_.find(l.agents,{name:l.agent.agent})),n&&!_.some(t,["id",n.id])){var a=_.find(l.agents,{id:n.id});a.canSelect=!1,t.push(a)}l.agents=t})}else{var n=[],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,n.push(l.agents[i]));l.agents=n}}).catch(function(e){n.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(t,e,n,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"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){t.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(t,e,n,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"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){t.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(t,e,n,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"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){t.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(t,e,n,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"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){t.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(t,e,n,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"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){t.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(t,e,n,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"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){t.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,t,n,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 E(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var t=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),n=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(t+"-"+n)}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 A(e){t.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=E(),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!":""}),A()}).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=E(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),A(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var t=_.find(c.intervals,{id:e.id});t&&_.merge(t,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),A()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=A,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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=e&&e.rows?e.rows:[],n=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(t,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,n.push(e))}),c.intervals=n})}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(t,e,n,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"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){t.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(t,e,n,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"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){t.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 t=_.find(l.queues,{name:l.queue.queue});t&&(l.queue[_.capitalize("chat")+"QueueId"]=t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),n=null;if(l.queue&&(n=_.find(l.queues,{name:l.queue.queue})),n&&!_.some(t,["id",n.id])){var a=_.find(l.queues,{id:n.id});a.canSelect=!1,t.push(a)}l.queues=t})}else{var n=[],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,n.push(l.queues[i]));l.queues=n}}).catch(function(e){n.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(t,e,n,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"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){t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),n=null;if(l.system&&(n=_.find(l.variables,{name:l.system.variable})),n&&!_.some(t,["id",n.id])){var a=_.find(l.variables,{id:n.id});a.canSelect=!1,t.push(a)}l.variables=t})}else{var n=[],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,n.push(l.variables[i]));l.variables=n}}).catch(function(e){n.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(t,e,n,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"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){t.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 t=_.find(l.tags,{name:l.tag.tag});t&&(l.tag.TagId=t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),n=null;if(l.tag&&(n=_.find(l.tags,{name:l.tag.tag})),n&&!_.some(t,["id",n.id])){var a=_.find(l.tags,{id:n.id});a.canSelect=!1,t.push(a)}l.tags=t})}else{var n=[],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,n.push(l.tags[i]));l.tags=n}}).catch(function(e){n.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(e,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.chatWebsite={},c.chatWebsiteChatCannedAnswers={count:0,rows:[]},c.selectedChatWebsiteChatCannedAnswers=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,key,value,description",limit:10,page:1},c.init=function(e,t){c.chatWebsite=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.chatWebsite.id,c.query.ChatWebsiteId=c.chatWebsite.id,c.getChatWebsiteChatCannedAnswers()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the chatCannedAnswer?").htmlContent("<b>"+(e.name||"chatCannedAnswer")+"</b> will be deleted.").ariaLabel("delete chatCannedAnswer").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getChatWebsiteChatCannedAnswers=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.chatWebsite.getAnswers(c.query,p).$promise},c.createOrEditChatWebsiteChatCannedAnswer=function(e,t){s.show({controller:"CreateOrEditChatCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/chatCannedAnswers/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:c.chatWebsite,chatCannedAnswer:t,chatCannedAnswers:c.chatWebsiteChatCannedAnswers.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedChatWebsiteChatCannedAnswers=function(){var e=angular.copy(c.selectedChatWebsiteChatCannedAnswers);return c.selectedChatWebsiteChatCannedAnswers=[],e},c.deleteChatWebsiteChatCannedAnswer=g,c.deleteSelectedChatWebsiteChatCannedAnswers=function(e){var t=s.confirm().title("Are you sure want to delete the selected chatCannedAnswers?").htmlContent("<b>"+c.selectedChatWebsiteChatCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete chatCannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedChatWebsiteChatCannedAnswers.forEach(function(e){g(e)}),c.selectedChatWebsiteChatCannedAnswers=[]})};var m=!0,u=1;function p(e){c.chatWebsiteChatCannedAnswers=e||{count:0,rows:[]}}function g(e){l.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(c.chatWebsiteChatCannedAnswers.rows,{id:e.id}),c.chatWebsiteChatCannedAnswers.count-=1,c.chatWebsiteChatCannedAnswers.rows.length||c.getChatWebsiteChatCannedAnswers(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETchatWebsite"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getChatWebsiteChatCannedAnswers())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.chat").controller("ChatWebsiteChatCannedAnswersController",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(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),t.params.id&&(g.chatCannedAnswer.ChatWebsiteId=t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.chatCannedAnswers,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The chatCannedAnswer will be deleted.").ariaLabel("Delete ChatCannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.chatWebsite={},c.chatWebsiteChatDispositions={count:0,rows:[]},c.selectedChatWebsiteChatDispositions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,name",limit:10,page:1},c.init=function(e,t){c.chatWebsite=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.chatWebsite.id,c.query.ChatWebsiteId=c.chatWebsite.id,c.getChatWebsiteChatDispositions()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the chatDisposition?").htmlContent("<b>"+(e.name||"chatDisposition")+"</b> will be deleted.").ariaLabel("delete chatDisposition").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getChatWebsiteChatDispositions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.chatWebsite.getDispositions(c.query,p).$promise},c.createOrEditChatWebsiteChatDisposition=function(e,t){s.show({controller:"CreateOrEditChatDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/chatDispositions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:c.chatWebsite,chatDisposition:t,chatDispositions:c.chatWebsiteChatDispositions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedChatWebsiteChatDispositions=function(){var e=angular.copy(c.selectedChatWebsiteChatDispositions);return c.selectedChatWebsiteChatDispositions=[],e},c.deleteChatWebsiteChatDisposition=g,c.deleteSelectedChatWebsiteChatDispositions=function(e){var t=s.confirm().title("Are you sure want to delete the selected chatDispositions?").htmlContent("<b>"+c.selectedChatWebsiteChatDispositions.length+" selected</b> will be deleted.").ariaLabel("delete chatDispositions").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedChatWebsiteChatDispositions.forEach(function(e){g(e)}),c.selectedChatWebsiteChatDispositions=[]})};var m=!0,u=1;function p(e){c.chatWebsiteChatDispositions=e||{count:0,rows:[]}}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){_.remove(c.chatWebsiteChatDispositions.rows,{id:e.id}),c.chatWebsiteChatDispositions.count-=1,c.chatWebsiteChatDispositions.rows.length||c.getChatWebsiteChatDispositions(),r.success({title:"ChatDisposition deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETchatWebsite"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getChatWebsiteChatDispositions())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.chat").controller("ChatWebsiteChatDispositionsController",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(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_CHATDISPOSITION",g.chatDisposition=angular.copy(l),g.chatDispositions=r,g.newChatDisposition=!1,g.chatDisposition||(g.chatDisposition={},g.title="CHAT.NEW_CHATDISPOSITION",g.newChatDisposition=!0),t.params.id&&(g.chatDisposition.ChatWebsiteId=t.params.id),g.addNewChatDisposition=function(){g.errors=[],d.disposition.save(g.chatDisposition).$promise.then(function(e){g.chatDispositions.unshift(e.toJSON()),o.success({title:"ChatDisposition properly created",msg:g.chatDisposition.name?g.chatDisposition.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.disposition.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveChatDisposition=function(){g.errors=[],d.disposition.update({id:g.chatDisposition.id},g.chatDisposition).$promise.then(function(e){var t=_.find(g.chatDispositions,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"ChatDisposition properly saved!",msg:g.chatDisposition.name?g.chatDisposition.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.disposition.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteChatDisposition=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The chatDisposition will be deleted.").ariaLabel("Delete ChatDisposition").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.disposition.delete({id:g.chatDisposition.id}).$promise.then(function(){_.remove(g.chatDispositions,{id:g.chatDisposition.id}),o.success({title:"ChatDisposition properly deleted!",msg:(g.chatDisposition.name||"chatDisposition")+" has been deleted!"}),v(g.chatDisposition)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.disposition.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.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","chatDispositions","chatDisposition","api","Auth","license","setting","crudPermissions"],angular.module("app.chat").controller("CreateOrEditChatDispositionDialogController",e)}(),function(){"use strict";function e(n,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"}],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 t=0;t<e.rows.length;t++)i.customFields.push({key:"cf_"+e.rows[t].id,value:e.rows[t].alias});return a.cmContact.describe().$promise}).then(function(e){for(var t=_.keys(e),n=0;n<t.length;n++)_.includes(i.uselessFields,t[n])||_.startsWith(t[n],"cf_")||i.fields.unshift({key:t[n],value:t[n]});return a.variable.get().$promise}).then(function(e){i.variables=e.rows}).catch(function(e){console.error(e)})},i.up=function(e,t){if(0!==t){var n=i.chatWebsite.offlineForm.items[t-1];i.chatWebsite.offlineForm.items[t]=n,i.chatWebsite.offlineForm.items[t-1]=angular.copy(e),i.chatWebsite.offlineForm.fromKey===t?i.chatWebsite.offlineForm.fromKey--:i.chatWebsite.offlineForm.fromKey===t-1&&i.chatWebsite.offlineForm.fromKey++}},i.down=function(e,t){if(t!==i.chatWebsite.offlineForm.items.length-1){var n=i.chatWebsite.offlineForm.items[t+1];i.chatWebsite.offlineForm.items[t]=n,i.chatWebsite.offlineForm.items[t+1]=angular.copy(e),i.chatWebsite.offlineForm.fromKey===t?i.chatWebsite.offlineForm.fromKey++:i.chatWebsite.offlineForm.fromKey===t+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 t=n.confirm().title("The component will be deleted.").textContent("Are you sure?").ariaLabel("Lucky day").ok("Ok").cancel("Cancel");n.show(t).then(function(){i.chatWebsite.offlineForm.items.splice(e,1)})}}e.$inject=["$mdDialog","$document","api"],angular.module("app.chat").controller("ChatWebsiteofflineFormController",e)}(),function(){"use strict";function e(n,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 t=0;t<e.rows.length;t++)i.customFields.push({key:"cf_"+e.rows[t].id,value:e.rows[t].alias});return a.cmContact.describe().$promise}).then(function(e){for(var t=_.keys(e),n=0;n<t.length;n++)_.includes(i.uselessFields,t[n])||_.startsWith(t[n],"cf_")||i.fields.unshift({key:t[n],value:t[n]});return a.variable.get().$promise}).then(function(e){i.variables=e.rows}).catch(function(e){console.error(e)})},i.up=function(e,t){if(0!==t){var n=i.chatWebsite.onlineForm.items[t-1];i.chatWebsite.onlineForm.items[t]=n,i.chatWebsite.onlineForm.items[t-1]=angular.copy(e),i.chatWebsite.onlineForm.fromKey===t?i.chatWebsite.onlineForm.fromKey--:i.chatWebsite.onlineForm.fromKey===t-1&&i.chatWebsite.onlineForm.fromKey++}},i.down=function(e,t){if(t!==i.chatWebsite.onlineForm.items.length-1){var n=i.chatWebsite.onlineForm.items[t+1];i.chatWebsite.onlineForm.items[t]=n,i.chatWebsite.onlineForm.items[t+1]=angular.copy(e),i.chatWebsite.onlineForm.fromKey===t?i.chatWebsite.onlineForm.fromKey++:i.chatWebsite.onlineForm.fromKey===t+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 t=n.confirm().title("The component will be deleted.").textContent("Are you sure?").ariaLabel("Lucky day").ok("Ok").cancel("Cancel");n.show(t).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)})}}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 t=["png","jpg"];if(!_.includes(t,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+t.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var n={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.chatWebsite.images.unshift(n),!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(t,e){if(t.id===a.uniqueIdentifier){var n=new FileReader;n.readAsDataURL(t.file.file),n.onload=function(e){t.url=e.target.result},t.type="image"}})},i.init=function(e,t){i.chatWebsite=angular.copy(e),i.crudPermissions=void 0!==t?t:{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,t,n,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.chatWebsite={},c.chatWebsiteInteractions={count:0,rows:[]},c.selectedChatWebsiteInteractions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,UserId,ContactId,ChatWebsiteId,id,closedAt,Contact.firstName,Owner.name,disposition,ratingValue,ratingType,note,tag",sort:"-createdAt",includeAll:"true",limit:10,page:1},c.init=function(e,t){c.chatWebsite=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.chatWebsite.id,c.getChatWebsiteInteractions()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.chatInteractionDownload=function(s,e,t){return l.chatInteraction.download({id:s.id,exists:!0,attachments:t}).$promise.then(function(e){var t=[e.buffer],n="interaction"+s.id,a=new Blob(t,{type:e.type});n="chat-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatWebsite.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.success=p,c.getChatWebsiteInteractions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.chatWebsite.getInteractions(c.query,p).$promise},c.createOrEditChatWebsiteInteraction=function(e,t){s.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/interactions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:c.chatWebsite,interaction:t,interactions:c.chatWebsiteInteractions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.spychatInteraction=function(e,n){s.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,t){e.vm.init({id:1,channel:"chat",interaction:n,spy:!0},a.$parent.vm.setting)}})},c.exportSelectedChatWebsiteInteractions=function(){var e=angular.copy(c.selectedChatWebsiteInteractions);return c.selectedChatWebsiteInteractions=[],e},c.deleteChatWebsiteInteraction=g,c.deleteSelectedChatWebsiteInteractions=function(e){var t=s.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+c.selectedChatWebsiteInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedChatWebsiteInteractions.forEach(function(e){g(e)}),c.selectedChatWebsiteInteractions=[]})};var m=!0,u=1;function p(e){c.chatWebsiteInteractions=e||{count:0,rows:[]}}function g(e){l.chatInteraction.delete({id:e.id}).$promise.then(function(){_.remove(c.chatWebsiteInteractions.rows,{id:e.id}),c.chatWebsiteInteractions.count-=1,c.chatWebsiteInteractions.rows.length||c.getChatWebsiteInteractions(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETchatWebsite"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}a.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getChatWebsiteInteractions())})}e.$inject=["$cookies","$scope","$state","$q","$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 t=["png","jpg"];if(!_.includes(t,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+t.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var n={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.chatWebsite.images.unshift(n),!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(t,e){if(t.id===a.uniqueIdentifier){var n=new FileReader;n.readAsDataURL(t.file.file),n.onload=function(e){t.url=e.target.result},t.type="image"}})},i.init=function(e,t){i.chatWebsite=angular.copy(e),i.crudPermissions=void 0!==t?t:{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,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.chatWebsite={},c.chatWebsiteOfflineMessages={count:0,rows:[]},c.selectedChatWebsiteOfflineMessages=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,ContactId",sort:"-createdAt",limit:10,page:1},c.init=function(e,t){c.chatWebsite=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.chatWebsite.id,c.getChatWebsiteOfflineMessages()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the offlineMessage?").htmlContent("<b>"+(e.name||"offlineMessage")+"</b> will be deleted.").ariaLabel("delete offlineMessage").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getChatWebsiteOfflineMessages=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.chatWebsite.getOfflineMessages(c.query,p).$promise},c.createOrEditChatWebsiteOfflineMessage=function(e,t){s.show({controller:"CreateOrEditOfflineMessageDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/offlineMessages/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:c.chatWebsite,offlineMessage:t,offlineMessages:c.chatWebsiteOfflineMessages.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.showOfflineMessageChatWebsiteOfflineMessage=function(e,n){s.show({controller:"ShowOfflineMessageOfflineMessageDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/offlineMessages/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,resolve:{message:["apiResolver","$stateParams",function(e,t){return e.resolve("chatOfflineMessage@get",{fields:"id,body",id:n.id})}]}})},c.exportSelectedChatWebsiteOfflineMessages=function(){var e=angular.copy(c.selectedChatWebsiteOfflineMessages);return c.selectedChatWebsiteOfflineMessages=[],e},c.deleteChatWebsiteOfflineMessage=g,c.deleteSelectedChatWebsiteOfflineMessages=function(e){var t=s.confirm().title("Are you sure want to delete the selected offlineMessages?").htmlContent("<b>"+c.selectedChatWebsiteOfflineMessages.length+" selected</b> will be deleted.").ariaLabel("delete offlineMessages").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedChatWebsiteOfflineMessages.forEach(function(e){g(e)}),c.selectedChatWebsiteOfflineMessages=[]})},l.cmContact.get({fields:"id,firstName,lastName",nolimit:"true"}).$promise.then(function(e){c.contacts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTACTS",msg:e.data?JSON.stringify(e.data):e.toString()})});var m=!0,u=1;function p(e){c.chatWebsiteOfflineMessages=e||{count:0,rows:[]}}function g(e){l.chatOfflineMessage.delete({id:e.id}).$promise.then(function(){_.remove(c.chatWebsiteOfflineMessages.rows,{id:e.id}),c.chatWebsiteOfflineMessages.count-=1,c.chatWebsiteOfflineMessages.rows.length||c.getChatWebsiteOfflineMessages(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETchatWebsite"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getChatWebsiteOfflineMessages())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.chat").controller("ChatWebsiteOfflineMessagesController",e)}(),function(){"use strict";function e(t,e){this.title="CHAT.OFFLINE_MESSAGE",this.message=e,this.closeDialog=function(e){t.hide(e)}}e.$inject=["$mdDialog","message"],angular.module("app.chat").controller("ShowOfflineMessageOfflineMessageDialogController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.chatWebsite={},c.chatWebsiteProactiveActions={count:0,rows:[]},c.selectedChatWebsiteProactiveActions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,name,type,selector,timeout",limit:10,page:1},c.arraytype=_.keyBy([{option:"MouseOver",value:"'mouseOver'"},{option:"Timeout",value:"'timeout'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.init=function(e,t){c.chatWebsite=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.chatWebsite.id,c.query.ChatWebsiteId=c.chatWebsite.id,c.getChatWebsiteProactiveActions()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the chatProactiveAction?").htmlContent("<b>"+(e.name||"chatProactiveAction")+"</b> will be deleted.").ariaLabel("delete chatProactiveAction").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getChatWebsiteProactiveActions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.chatWebsite.getProactiveActions(c.query,p).$promise},c.createOrEditChatWebsiteChatProactiveAction=function(e,t){s.show({controller:"CreateOrEditChatProactiveActionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/proactive/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:c.chatWebsite,chatProactiveAction:t,proactive:c.chatWebsiteProactiveActions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedChatWebsiteProactiveActions=function(){var e=angular.copy(c.selectedChatWebsiteProactiveActions);return c.selectedChatWebsiteProactiveActions=[],e},c.deleteChatWebsiteChatProactiveAction=g,c.deleteSelectedChatWebsiteProactiveActions=function(e){var t=s.confirm().title("Are you sure want to delete the selected proactive?").htmlContent("<b>"+c.selectedChatWebsiteProactiveActions.length+" selected</b> will be deleted.").ariaLabel("delete proactive").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedChatWebsiteProactiveActions.forEach(function(e){g(e)}),c.selectedChatWebsiteProactiveActions=[]})};var m=!0,u=1;function p(e){c.chatWebsiteProactiveActions=e||{count:0,rows:[]}}function g(e){l.chatProactiveAction.delete({id:e.id}).$promise.then(function(){_.remove(c.chatWebsiteProactiveActions.rows,{id:e.id}),c.chatWebsiteProactiveActions.count-=1,c.chatWebsiteProactiveActions.rows.length||c.getChatWebsiteProactiveActions(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETchatWebsite"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getChatWebsiteProactiveActions())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.chat").controller("ChatWebsiteProactiveActionsController",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(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),t.params.id&&(g.chatProactiveAction.ChatWebsiteId=t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.proactive,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The chatProactiveAction will be deleted.").ariaLabel("Delete ChatProactiveAction").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=this;t.chatWebsite={},t.init=function(e){t.chatWebsite=e,t.start="\n\x3c!-- START Motion Chat Script --\x3e",t.script='\n    <script src="'+t.chatWebsite.remote+"/api/chat/websites/"+t.chatWebsite.id+"/snippet?token="+t.chatWebsite.token+'"><\/script>',t.end="\n\x3c!-- START Motion Chat Script --\x3e"},t.info={},e.$watch("vm_ac.chatWebsite.remote",function(e){t.script='\n    <script src="'+t.chatWebsite.remote+"/api/chat/websites/"+t.chatWebsite.id+"/snippet?token="+t.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 t=["png","jpg"];if(!_.includes(t,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+t.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var n={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.chatWebsite.images.unshift(n),!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(t,e){if(t.id===a.uniqueIdentifier){var n=new FileReader;n.readAsDataURL(t.file.file),n.onload=function(e){t.url=e.target.result},t.type="image"}})},i.init=function(e,t){i.chatWebsite=angular.copy(e),i.crudPermissions=void 0!==t?t:{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,t,n,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=t.protocol()+"://"+t.host(),u.chatWebsite=c||e.params.chatWebsite||{},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.agentadddialog=function(e,t){n.show({controller:"ChatWebsiteagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{chatWebsite:e,chatWebsites:u.chatWebsites?u.chatWebsites.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoChatWebsites=function(){e.go("app.chat.chatWebsites")},u.saveChatWebsite=function(){r.chatWebsite.update({id:u.chatWebsite.id},u.chatWebsite).$promise.then(function(){l.success({title:"ChatWebsite updated!",msg:u.chatWebsite.name?u.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){u.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){u.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.lists,{id:e.resourceId})}),n=null;if(u.chatWebsite&&(n=_.find(u.lists,{id:Number(u.chatWebsite.ListId)})),n&&!_.some(t,["id",n.id])){var a=_.find(u.lists,{id:n.id});a.canSelect=!1,t.push(a)}u.lists=t})}else{var n=[],a=null;u.chatWebsite&&(a=_.find(u.lists,{id:Number(u.chatWebsite.ListId)}));for(var i=0;i<u.lists.length;i++)a&&u.lists[i].id===a.id&&(u.lists[i].canSelect=!1,n.push(u.lists[i]));u.lists=n}}).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){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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.interval,{id:e.resourceId})}),n=null;if(u.chatWebsite&&(n=_.find(u.interval,{id:Number(u.chatWebsite.IntervalId)})),n&&!_.some(t,["id",n.id])){var a=_.find(u.interval,{id:n.id});a.canSelect=!1,t.push(a)}u.interval=t})}else{var n=[],a=null;u.chatWebsite&&(a=_.find(u.interval,{id:Number(u.chatWebsite.IntervalId)}));for(var i=0;i<u.interval.length;i++)a&&u.interval[i].id===a.id&&(u.interval[i].canSelect=!1,n.push(u.interval[i]));u.interval=n}}).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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.pauses,{id:e.resourceId})});u.pauses.forEach(function(e){_.some(t,["id",e.id])||(e.canSelect=!1),t.push(e)}),u.pauses=t})}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","chatWebsite","userProfileSection"],angular.module("app.chat").controller("ChatWebsiteController",e)}(),function(){"use strict";function e(e,o,t,n,a,i,s,r,l,d,c,m,u,p,g,v,h,f){var b=this,E=["userpic","online","lastLoginAt","lastPauseAt","pauseType","lastPauseAt","internal","address","chatPause","openchannelPause","mailPause","smsPause","faxPause","voicePause","chatCapacity","openchannelCapacity","mailCapacity","smsCapacity","faxCapacity","chatCurrentCapacity","openchannelCurrentCapacity","mailCurrentCapacity","smsCurrentCapacity","faxCurrentCapacity","chatStatus","openchannelStatus","mailStatus","smsStatus","faxStatus","voiceStatus","chatStatusTime","openchannelStatusTime","mailStatusTime","smsStatusTime","faxStatusTime","voiceStatusTime","queue","destconnectedlinenum","onhold"],A=["chatPause","openchannelPause","mailPause","smsPause","faxPause","voicePause","online"];for(var y in b.currentUser=v.getCurrentUser(),b.availableStates=["ringing","inuse","busy","onhold","not_inuse"],b.pauses=s||{count:0,rows:[]},b.license=h,b.userProfile=p,b.userProfileSection=g&&1==g.count?g.rows[0]:null,b.crudPermissions=v.parseCrudPermissions(b.userProfileSection?b.userProfileSection.crudPermissions:null),b.agents=r?_.keyBy(r.rows?r.rows:[],"id"):{},b.rpcAgents=l?_.keyBy(l.rows?l.rows:[],"id"):{},b.paginatedAgents={},b.load=!1,b.order=[],b.agentInternal={},b.agents)b.agents.hasOwnProperty(y)&&(b.agents[y].init=!0);b.query={limit:10,page:1,order:"fullname",globalStatusFilter:"",pauseTypeFilter:""},b.logout=function(e,t){return d.user.logout({id:e.id,device:"realtime",agent_id:e.id,agent_name:e.name}).$promise.then(function(){m.success({title:"Agent logout",msg:e.fullname+"  properly logout"}),b.agents[e.id]&&(b.agents[e.id].online=!1),b.rpcAgents[e.id]&&(b.rpcAgents[e.id].online=!1),T()}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.queueAdd=function(e,t){n.show({controller:"AgentqueueaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/queueadd/queueadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{agent:e,agents:[],channel:"chat",direction:"inbound",crudPermissions:b.crudPermissions}})},b.pause=function(t,e){return d.user.pause({id:t.id,type:e}).$promise.then(function(e){b.agents[t.id]&&_.merge(b.agents[t.id],_.pick(e,E)),b.rpcAgents[t.id]&&_.merge(b.rpcAgents[t.id],_.pick(e,E)),O(b.agents[t.id])}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.unPause=function(t){return d.user.unpause({id:t.id}).$promise.then(function(e){b.agents[t.id]&&_.merge(b.agents[t.id],_.pick(e,E)),b.rpcAgents[t.id]&&_.merge(b.rpcAgents[t.id],_.pick(e,E)),O(b.agents[t.id])}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.showInfo=function(e){n.show(n.alert().clickOutsideToClose(!0).title("Legend").htmlContent("<div>TODO legend status + state</div>").ok("Ok").targetEvent(e))},b.getAgentStatus=w,b.getAgentGlobalStatus=O,b.isPause=I,b.checkPause=function(e){return"pause"===e},b.isPartialPause=function(e){return"*pause"===e},b.onSave=function(e){b.agents[e.id]&&(_.merge(b.agents[e.id],_.pick(_.omit(e,A),E)),_.merge(b.rpcAgents[e.id],_.pick(_.omit(e,A),E)),O(b.agents[e.id]))},b.onUpdate=function(e){b.agents[e.id]&&(_.merge(b.agents[e.id],_.pick(e,E)),_.merge(b.rpcAgents[e.id],_.pick(e,E)),e.lastPauseAt&&(b.agents[e.id].globalStatusTime=e.lastPauseAt,b.rpcAgents[e.id].globalStatusTime=e.lastPauseAt),O(b.agents[e.id]))},b.onInit=T,b.onConnect=function(e){b.agents[b.agentInternal[e.destaccountcode]]&&(_.merge(b.agents[b.agentInternal[e.destaccountcode]],_.pick(e,["queue","destconnectedlinenum"])),_.merge(b.rpcAgents[b.agentInternal[e.destaccountcode]],_.pick(e,["queue","destconnectedlinenum"])))},b.onComplete=function(e){b.agents[b.agentInternal[e.destaccountcode]]&&(b.agents[b.agentInternal[e.destaccountcode]]=_.omit(b.agents[b.agentInternal[e.destaccountcode]],["queue","destconnectedlinenum"]),b.rpcAgents[b.agentInternal[e.destaccountcode]]=_.omit(b.rpcAgents[b.agentInternal[e.destaccountcode]],["queue","destconnectedlinenum"]))},c.on("user:save",b.onSave),c.on("user:update",b.onUpdate),c.on("user:agentconnect",b.onConnect),c.on("user:agentcomplete",b.onComplete),T();var S=f(function(){b.load&&(b.load=!1,T())},999);function T(e){b.load=!1;var t,n,a=o.defer();b.promise=a.promise,b.filteredAgents=[],b.order=[],_.forIn(b.agents,function(e,t){b.rpcAgents[t]&&_.merge(e,_.pick(_.omit(b.rpcAgents[t],A),E)),O(e),e.online?(b.filteredAgents.push(e),b.agentInternal[e.internal]=t):e.globalStatusTime=_.toNumber(moment().format("x"))}),b.query.globalStatusFilter&&_.remove(b.filteredAgents,function(e){return e.globalStatus!==b.query.globalStatusFilter}),b.query.pauseTypeFilter&&_.remove(b.filteredAgents,function(e){return e.pauseType!==b.query.pauseTypeFilter}),b.query.filter&&_.remove(b.filteredAgents,function(e){return e.fullname.toLowerCase().indexOf(b.query.filter.toLowerCase())<0}),b.filteredAgents=(t=b.filteredAgents,n=_.startsWith(b.query.order,"-")?"desc":"asc",_.orderBy(t,[b.query.order.replace("-","")],[n]));var i=(b.query.page-1)*b.query.limit;b.paginatedAgents=_.drop(b.filteredAgents,i).slice(0,b.query.limit);for(var s=0;s<b.paginatedAgents.length;s+=1)b.order.push(b.paginatedAgents[s].id);a.resolve(),b.load=!0}function I(e){return"pause"===e||"*pause"===e}function C(e){return"idle"===e||"unknown"===e||"unavailable"===e||"ringing"===e||_.isNil(e)}function w(e,t){return"voice"===t?"idle"!==e[t+"Status"]?e[t+"Status"]:e[t+"Pause"]?e[t+"Status"]="pause":"idle":e[t+"Pause"]?e[t+"Status"]="pause":e[t+"Status"]}function O(e){var t="unknown";t=_.every([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],I)?"pause":_.some([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],I)?"*pause":_.every([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],C)?"idle":"busy",e.globalStatus!==t&&(e.globalStatus=t,e.init?(e.init=!1,e.globalStatusTime=I(t)?_.toNumber(moment(e.lastPauseAt).format("x")):_.max([e.voiceStatusTime,e.chatStatusTime,e.mailStatusTime,e.smsStatusTime,e.openchannelStatusTime,e.faxStatusTime])):e.globalStatusTime=_.toNumber(moment().format("x")))}e.$on("$destroy",function(){c.removeAllListeners("user:save"),c.removeAllListeners("user:update"),c.removeAllListeners("user:agentconnect"),c.removeAllListeners("user:agentcomplete"),S&&(f.cancel(S),S=null)})}e.$inject=["$scope","$q","$timeout","$mdDialog","$document","$filter","pauses","agents","rpcAgents","api","socket","toasty","helperClasses","userProfile","userProfileSection","Auth","license","$interval"],angular.module("app.voice").controller("AgentsChatRealtimeController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this,v=["loggedIn","available","waiting","talking","pTalking","originated","message","dialActive","dialMethod","Trunk","paused"];function h(){var n=[];return _.forIn(g.queues,function(e,t){e.paused=0,e.loggedInDb=0,g.queues[t].agents={},n.push(l.chatQueue.getMembers({id:t}).$promise),g.rpcQueues[t]&&_.merge(e,_.pick(g.rpcQueues[t],v))}),t.all(n).then(function(e){for(var t=0;t<e.length;t+=1)for(var n=0;n<e[t].rows.length;n++)e[t].rows[n].paused&&g.queues[e[t].rows[n].ChatQueueId].paused++,g.queues[e[t].rows[n].ChatQueueId].loggedInDb++,g.queues[e[t].rows[n].ChatQueueId].agents[e[t].rows[n].UserId]=e[t].rows[n].ChatQueueId}).catch(function(e){console.error(e)})}g.currentUser=p.getCurrentUser(),g.count=o.count?o.count:0,g.queues=o?_.keyBy(o.rows?o.rows:[],"id"):{},g.rpcQueues=r?_.keyBy(r.rows?r.rows:[],"id"):{},g.userProfile=m,g.userProfileSection=u&&1==u.count?u.rows[0]:null,g.crudPermissions=p.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),p.hasRole("admin")?g.query={type:"inbound",sort:"-updatedAt",limit:10,page:1}:g.query={id:g.currentUser.id,channel:"chat",type:"inbound",sort:"-updatedAt",limit:10,page:1},g.success=E,g.getQueues=function(){g.query.offset=(g.query.page-1)*g.query.limit,p.hasRole("admin")?g.promise=l.chatQueue.get(g.query,E).$promise:(g.query.id=g.userProfile.id,g.query.section="ChatQueues",g.promise=l.userProfile.getResources(g.query,E).$promise)},g.createOrEditChatQueue=function(e,t){a.show({controller:"CreateOrEditChatQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatQueue:t,chatQueues:_.values(g.queues),license:null,setting:null,crudPermissions:g.crudPermissions}})},g.agentAdd=function(e,t){a.show({controller:"ChatQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatQueue:t,chatQueues:g.queues?g.queues.rows:[],realtime:!1,crudPermissions:g.crudPermissions}})},g.updateQueue=function(e){return l.chatQueue.update(e).$promise.then(function(){c.success({title:"Queue properly updated!",msg:e.name?e.name+" has been updated!":""})}).catch(function(e){c.error({title:"Error creating queue!",msg:e.message})})},g.onSave=function(e){g.queues[e.id]&&_.merge(g.queues[e.id],_.pick(e,v))},g.onSaveMember=function(e){g.queues[e.ChatQueueId]&&g.queues[e.ChatQueueId].loggedInDb++},g.onRemoveMember=function(e){g.queues[e.ChatQueueId]&&g.queues[e.ChatQueueId].loggedInDb--},g.onPause=function(n){console.log("onPause",n),n.voicePause?_.forIn(g.queues,function(e,t){e.agents[n.id]&&(e.paused+=1,console.log("pause"))}):n.voicePause||_.forIn(g.queues,function(e,t){e.agents[n.id]&&0<e.paused&&(e.paused-=1,console.log("unpause"))})},g.onLogin=function(e){console.log("onLogged",e),g.queues[e.ChatQueueId]&&(g.queues[e.ChatQueueId].loggedInDb+=1,g.queues[e.ChatQueueId].agents[e.UserId]=e.ChatQueueId)},g.onLogout=function(e){console.log("onLogout",e),g.queues[e.ChatQueueId]&&0<g.queues[e.ChatQueueId].loggedInDb&&(g.queues[e.ChatQueueId].loggedInDb-=1,delete g.queues[e.ChatQueueId].agents[e.UserId])},g.$onInit=h,g.order=[],_.forIn(g.queues,function(e,t){g.order.push(e.id)}),d.on("chat_queue:save",g.onSave),d.on("userChatQueue:save",g.onSaveMember),d.on("userChatQueue:remove",g.onRemoveMember),d.on("user:update",g.onPause),d.on("userVoiceQueue:remove",g.onLogout),d.on("userVoiceQueue:save",g.onLogin);var f=!0,b=1;function E(e){if(g.count=e.count,g.queues=e?_.keyBy(e.rows?e.rows:[],"id"):{},e.rows){g.order=[];for(var t=0;t<e.rows.length;t++)g.order.push(e.rows[t].id)}h()}e.$watch("vm.query.filter",function(e,t){f?n(function(){f=!1}):(t||(b=g.query.page),e!==t&&(g.query.page=1),e||(g.query.page=b),g.getQueues())}),e.$on("$destroy",function(){d.removeAllListeners("chat_queue:save"),d.removeAllListeners("userChatQueue:remove"),d.removeAllListeners("userChatQueue:save"),d.removeAllListeners("user:update"),d.removeAllListeners("userVoiceQueue:remove"),d.removeAllListeners("userVoiceQueue:save")})}e.$inject=["$scope","$timeout","$mdDialog","$q","$document","$interval","queues","rpcQueues","api","socket","toasty","userProfile","userProfileSection","Auth"],angular.module("app.chat").controller("QueuesChatRealtimeController",e)}(),function(){"use strict";angular.module("app.auth").factory("helperClasses",function(){return{status:{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"},state:{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"},channelStatus:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},channelStatusOut:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"}}})}(),function(){"use strict";function e(e,n,t){switch(t.disconnect(),t.connect(),this.selectedTab=0,n.current.name){case"app.chat.realtime.agents":this.selectedTab=0;break;case"app.chat.realtime.queues":this.selectedTab=1;break;default:this.selectedTab=0,n.go("app.chat.realtime.agents")}e.$watch("vm.selectedTab",function(e,t){if(e!==t)switch(e){case 0:n.go("app.chat.realtime.agents");break;case 1:n.go("app.chat.realtime.queues");break;default:n.go("app.chat.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.chat").controller("ChatRealtimeController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.companies=l||{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="companies",b.listOrder="",b.listOrderAsc=null,b.selectedCompanies=[],b.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},b.editstate=function(e,t){a.go("app.contactmanager.companies.edit",{id:e.id,company:e,crudPermissions:b.crudPermissions})},b.gotocontactsgoto=function(n,e){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:303}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?a.go("app.contactmanager.contacts",{CompanyId:n.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:n.id})}},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getCompanies=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.cmCompany.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Companies",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditCompany=function(e,t){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:t,companies:b.companies.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteCompany=S,b.exportSelectedCompanies=function(){var e=angular.copy(b.selectedCompanies);return b.selectedCompanies=[],e},b.deleteSelectedCompanies=function(e){var t=i.confirm().title("Are you sure want to delete the selected companies?").htmlContent("<b>"+b.selectedCompanies.length+" selected</b> will be deleted.").ariaLabel("delete Companys").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedCompanies.forEach(function(e){S(e)}),b.selectedCompanies=[]})},b.deselectCompanies=function(){b.selectedCompanies=[]},b.selectAllCompanies=function(){b.selectedCompanies=b.companies.rows};var E=!0,A=1;function y(e){b.companies=e||{count:0,rows:[]}}function S(e){m.cmCompany.delete({id:e.id}).$promise.then(function(){_.remove(b.companies.rows,{id:e.id}),b.companies.count-=1,b.companies.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcmCompany"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getCompanies())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","companies","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.contactmanager").controller("CompaniesController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.companies,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The company will be deleted.").ariaLabel("Delete Company").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,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(n,e){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:303}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?a.go("app.contactmanager.contacts",{CompanyId:n.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:n.id})}},u.alert=l.info,u.gotoCompanies=function(){a.go("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(t,i,n,a,e,s,o,r,l,d,c,m,u,p,g,v,h,f,b){var E=this;E.currentUser=f.getCurrentUser(),E.license=b,E.userProfile=r,E.userProfileSection=l&&1==l.count?l.rows[0]:null,E.crudPermissions=f.parseCrudPermissions(E.userProfileSection?E.userProfileSection.crudPermissions:null);var A=60,y=1024*A*1024;E.ngFlowOptions={target:"api/cm/contacts/upload",singleFile:!0,maxChunkRetries:1,chunkSize:y,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},E.contacts=c||{count:0,rows:[]},E.options={hidden:!1,hover:!1,isOpen:!1},E.table="cm_contacts",E.selectedContacts=[],E.lists=m||{rows:[],count:0},E.companies=p||{rows:[],count:0},E.tags=v||{rows:[],count:0},E.listsMap=u,E.companiesMap=g,E.selectedTags=[],E.selectedList=null,E.selectedCompany=null,E.query=_.merge({includeAll:!0,sort:"-updatedAt",limit:10,offset:0,page:1},e),E.editdialog=function(e,t){a.go("app.contactmanager.contacts.edit",{id:e.id,crudPermissions:E.crudPermissions})},E.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){C(e)})},E.success=I,E.getContacts=function(){E.query.offset=(E.query.page-1)*E.query.limit,f.hasRole("admin")?E.promise=d.cmContact.get(E.query,I).$promise:(E.query.id=E.userProfile.id,E.query.section="Contacts",E.promise=d.userProfile.getResources(E.query,I).$promise)},E.getAssignedCompanies=function(){if(!f.hasRole("admin")){var e=_(E.contacts.rows).map(function(e){return{id:e.CompanyId}}).uniqBy("id").pullAllBy(E.companies.rows,"id").value();if(!_.isEmpty(e)){for(var t=[],n=0;n<e.length;n++)t.push(d.cmCompany.get({id:e[n].id,fields:"id,name"}).$promise);o.all(t).then(function(e){e.forEach(function(e){var t=e.toJSON();t.canSelect=!1,E.companies.rows.push(t);var n={};n[t.id]=t.name,E.companiesMap=_.assignIn(E.companiesMap,n)})}).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()})})}}},E.mergeContact=function(e,t){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:t.id})}],lists:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",nolimit:!0})}]},locals:{contacts:E.contacts.rows}})},E.duplicateContact=function(e,t){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:t.id})}],lists:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",nolimit:!0})}]},locals:{contacts:E.contacts.rows}})},E.createOrEditContact=function(e,t){t&&t.dateOfBirth&&(t.dateOfBirth=new Date(t.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:E.query.ListId||a.params.ListId,CompanyId:E.query.CompanyId||a.params.CompanyId,contact:t,contacts:E.contacts.rows,setting:null,crudPermissions:E.crudPermissions},resolve:{lists:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",nolimit:!0}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",nolimit:!0})}],companies:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("cmCompany@get",{fields:"id,name"}):e.resolve("userProfile@getResources",{id:t.getCurrentUser().userProfileId,section:"Companies",fields:"id,name"})}]}})},E.deleteContact=C,E.exportSelectedContacts=function(){var e=angular.copy(E.selectedContacts);return E.selectedContacts=[],e},E.deleteSelectedContacts=function(e){var t=s.confirm().title("Are you sure want to delete the selected contacts?").htmlContent("<b>"+E.selectedContacts.length+" selected</b> will be deleted.").ariaLabel("delete Contacts").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){E.selectedContacts.forEach(function(e){C(e)}),E.selectedContacts=[]})},E.deselectContacts=function(){E.selectedContacts=[]},E.selectAllContacts=function(){E.selectedContacts=E.contacts.rows},E.createTag=function(e){var t=s.prompt().title("What would you name your tag?").placeholder("Tag name").ariaLabel("Tag name").targetEvent(e).ok("Ok").cancel("Cancel");return s.show(t).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&&(E.tags.rows.push(e),h.success({title:"Tag properly created!",msg:e.tag?e.name+" has been created!":""}))})},E.createList=function(e){var t=s.prompt().title("What would you name your list?").placeholder("List name").ariaLabel("List name").targetEvent(e).ok("Ok").cancel("Cancel");return s.show(t).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&&(E.lists.rows.push(e),h.success({title:"List properly created!",msg:e.name?e.name+" has been created!":""}))})},E.createCompany=function(e){var t=s.prompt().title("What would you name your company?").placeholder("Company name").ariaLabel("Company name").targetEvent(e).ok("Ok").cancel("Cancel");return s.show(t).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&&(E.companies.rows.push(e),h.success({title:"Company properly created!",msg:e.name?e.name+" has been created!":""}))})},E.importContacts=function(e,t,n){var a=JSON.parse(t);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:E.license}}).then(function(){E.getContacts()}).catch(function(e){console.error()})},E.hasPermission=function(){return f.hasPermission(303)||f.hasRole("admin")},E.fileAdded=function(e){var t=["csv"];if(!_.includes(t,e.getExtension()))return h.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+t.join()}),!1;if(e.size>y)return h.error({title:"File too big",msg:"The max allowed size is "+A+"MB"}),!1;return!0},a.params.ListId&&(E.selectedList=a.params.ListId),a.params.CompanyId&&(E.selectedCompany=a.params.CompanyId),t.$watch("vm.options.isOpen",function(e){e?n(function(){t.tooltipVisible=E.options.isOpen},600):t.tooltipVisible=E.options.isOpen});var S=!0,T=1;function I(e){E.contacts=e||{count:0,rows:[]}}function C(e){d.cmContact.delete({id:e.id}).$promise.then(function(){_.remove(E.contacts.rows,{id:e.id}),E.contacts.count-=1,E.contacts.rows.length||E.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){E.errors=e.data.errors||[{message:e.toString(),type:"api.contact.delete"}];for(var t=0;t<e.data.errors.length;t++)h.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})})}t.$watch("vm.query.filter",function(e,t){S?n(function(){S=!1}):(t||(T=E.query.page),e!==t&&(E.query.page=1),e||(E.query.page=T),E.getContacts())},!0),t.$watch("vm.selectedList",function(e,t){e!==t&&(E.query.ListId=E.selectedList||void 0,E.getContacts())}),t.$watch("vm.selectedCompany",function(e,t){e!==t&&(E.query.CompanyId=E.selectedCompany||void 0,E.getContacts())}),t.$watch("vm.selectedTags",function(e,t){(e.length||t.length)&&E.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(n,a,e,t,i,s,o,r,l,d){var c=this;function m(){n.hide()}c.errors=[],c.title="CONTACTMANAGER.EDIT_CONTACT",c.crudPermissions=d,c.contact=angular.copy(s),c.contacts=e||{rows:[],count:0},c.lists=t||{rows:[],count:0},c.companies=i||{rows:[],count:0},c.customFields={rows:[],count:0},c.newContact=!1,c.contact?(delete c.contact.List,c.ListId=c.contact.ListId||void 0):(c.contact={ListId:o?parseInt(o,10):void 0,CompanyId:r?parseInt(r,10):void 0},c.title="CONTACTMANAGER.NEW_CONTACT",c.newContact=!0),c.addNewContact=function(){c.errors=[],l.cmContact.save(c.contact).$promise.then(function(e){c.contacts.unshift(e),a.success({title:"Contact properly created",msg:c.contact.name?c.contact.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.user.save"}];for(var t=0;t<e.data.errors.length;t++)a.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})})},c.saveContact=function(){c.errors=[],l.cmContact.update({id:c.contact.id},c.contact).$promise.then(function(e){var t=_.find(c.contacts,{id:e.id});t&&_.merge(t,e),a.success({title:"Contact properly saved!",msg:c.contact.name?c.contact.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.contact.update"}];for(var t=0;t<e.data.errors.length;t++)a.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})})},c.deleteContact=function(e){c.errors=[];var t=n.confirm().title("Are you sure?").content("The contact will be deleted.").ariaLabel("Delete Contact").ok("Delete").cancel("Cancel").targetEvent(e);n.show(t).then(function(){l.cmContact.delete({id:c.contact.id}).$promise.then(function(){_.remove(c.contacts,{id:c.contact.id}),a.success({title:"Contact properly deleted!",msg:c.contact.name?c.contact.name+" has been deleted!":""}),m()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.contact.delete"}]})},function(){})},c.closeDialog=m,c.getCustomFields=function(e){{if(e)return l.cmList.getCustomFields({id:e}).$promise.then(function(e){e&&(c.customFields=e)}).catch(function(e){console.error(e)});c.customFields={rows:[],count:0}}},c.getDateFromString=function(e){return null===e?void 0:new Date(e)}}e.$inject=["$mdDialog","toasty","contacts","lists","companies","contact","ListId","CompanyId","api","crudPermissions"],angular.module("app.tools").controller("CreateOrEditContactDialogController",e)}(),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=[],delete o.contact.id,o.contact.tags&&!o.contact.tags.length&&delete o.contact.tags;s.cmContact.save(o.contact).$promise.then(function(e){a.unshift(e),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,t,n,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 t=_.find(d.hoppers,{id:e.id});t&&_.merge(t,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(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f,b,E){var A=this;A.currentUser=b.getCurrentUser(),A.license=f,A.journey=[],A.contact=r||{},A.hoppers=l||{rows:[],count:0},A.finals=d||{rows:[],count:0},A.histories=c||{rows:[],count:0},A.companies=u||{rows:[],count:0},A.lists=p||{rows:[],count:0},A.customFields=g||{rows:[],count:0},A.tags=v||{rows:[],count:0},A.jscriptySessions=h||{rows:[],count:0},A.timelineOptions={scrollEl:"#interaction-content"},A.userProfileSection=E&&1==E.count?E.rows[0]:null,A.crudPermissions=b.parseCrudPermissions(A.userProfileSection?A.userProfileSection.crudPermissions:null),A.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"),"")}),A.queryHopper={fields:"id,phone,scheduledat,priority,recallme,VoiceQueueId,CampaignId,UserId",sort:"-updatedAt",limit:10,page:1},A.queryFinal={fields:"id,uniqueid,calleridnum,statedesc,starttime,disposition",sort:"-id",limit:10,page:1},A.queryHistory={fields:"id,uniqueid,calleridnum,statedesc,scheduledat,starttime,endtime",sort:"-id",limit:10,page:1},A.queryJscriptySession={fields:"id,starttime,endtime,membername,projectname",sort:"-starttime",limit:10,page:1},A.selectedTab=t.params.tab||0,A.onInit=function(){b.hasRole("admin")||(function(){if(!_.some(A.companies.rows,{id:A.contact.CompanyId}))o.cmCompany.get({id:A.contact.CompanyId,fields:"id,name"}).$promise.then(function(e){var t=e.toJSON();t.canSelect=!1,A.companies.rows.push(t)}).catch(function(e){s.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(A.contact.Tags,function(e){return{id:e.id,name:e.name}});if(!_.isEmpty(e))for(var t=0;t<e.length;t++)_.some(A.tags.rows,{id:e.id})||(e[t].canSelect=!1,A.tags.rows.push(e[t]))}());return o.user.get({fields:"id,fullname",nolimit:!0}).$promise.then(function(e){A.users=e||{count:0,rows:[]},A.usersMap=_.mapValues(_.keyBy(A.users.rows,"id"),"fullname"),A.Tags=_.map(A.contact.Tags,"id")}).then(function(e){var t=["mail","chat","sms","openchannel","fax"];if(e&&e.id){for(var n=0;n<t.length;n++)o[t[n]+"Interaction"].get({ContactId:e.id,includeAll:!0}).$promise.then(I);o.voiceCallReport.get({fields:"id,uniqueid,type,source,destination,callerid,starttime,endtime,duration,disposition,amaflags,note,UserId,ContactId",ContactId:e.id,includeAll:!0}).$promise.then(I).catch(function(e){console.error(e)})}}(r))},A.gotoContacts=function(){t.go("app.contactmanager.contacts",{},{reload:!0,notify:!0})},A.duplicateContact=function(e){i.show({controller:"DuplicateContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,resolve:{lists:["apiResolver","Auth",function(e,t){return t.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name"}):e.resolve("userProfile@getResources",{id:A.currentUser.userProfileId,section:"Lists",fields:"id,name"})}]},locals:{contacts:m.rows,contact:r}})},A.saveContact=function(){o.cmContact.update({id:A.contact.id},A.contact).$promise.then(function(){s.success({title:"Contact updated!",msg:A.contact.name?A.contact.name+" has been updated!":""})}).then(function(){return o.cmContact.setTags({id:A.contact.id,ids:A.Tags}).$promise}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEcontact",msg:e.data?JSON.stringify(e.data):e.toString()})})},A.editCompany=function(e,t){var n=_.find(A.companies.rows,{id:t});i.show({controller:"CreateOrEditCompanyDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/companies/create/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{companies:[],license:null,setting:null,crudPermissions:!1===n.canSelect?{readOnly:!0,canEdit:!1,canDelete:!1}:o.userProfileSection.get({userProfileId:A.currentUser.userProfileId,sectionId:302}).$promise.then(function(e){var t=e.rows?e.rows[0]:null;return b.parseCrudPermissions(t?t.crudPermissions:null)}).catch(function(e){s.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:t})}]}})},A.onSelectList=function(e){if(A.contact.ListId){var t=i.confirm().title("You are selecting the list number: "+A.contact.ListId).textContent("Warning! You won't select a different list for the contact "+A.contact.firstName||A.contact.lastName||A.contact.id).targetEvent(e).ok("Ok").cancel("Cancel");return i.show(t).then(A.onSelectListSuccess).catch(function(){A.contact.ListId=null})}},A.onSelectListSuccess=function(){return o.cmList.getCustomFields({id:A.contact.ListId}).$promise.then(function(e){A.customFields=e||{rows:[],count:0}}).catch(function(e){console.error(e)})},A.getDateFromString=function(e){return null===e?void 0:new Date(e)},A.getHoppers=function(){A.queryHopper.offset=(A.queryHopper.page-1)*A.queryHopper.limit,A.queryHopper.id=A.contact.id,A.promise=o.cmContact.getHoppers(A.queryHopper,T("hoppers")).$promise},A.getFinals=function(){A.queryFinal.offset=(A.queryFinal.page-1)*A.queryFinal.limit,A.queryFinal.id=A.contact.id,A.promise=o.cmContact.getHopperFinals(A.queryFinal,T("finals")).$promise},A.getHistories=function(){A.queryHistory.offset=(A.queryHistory.page-1)*A.queryHistory.limit,A.queryHistory.id=A.contact.id,A.promise=o.cmContact.getHopperHistories(A.queryHistory,T("histories")).$promise},A.getJscriptySessions=function(){A.queryJscriptySession.offset=(A.queryJscriptySession.page-1)*A.queryJscriptySession.limit,A.queryJscriptySession.id=A.contact.id,A.promise=o.cmContact.getJscriptySessions(A.queryJscriptySession,T("jscriptySessions")).$promise},A.deleteconfirm=function(t,e){var n=i.confirm().title("Are you sure want to delete the agent?").htmlContent("<b>"+(t.phone||"hopper")+"</b> will be deleted.").ariaLabel("delete hopper").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){var e;e=t,o.cmHopper.delete({id:e.id}).$promise.then(function(){_.remove(A.hoppers.rows,{id:e.id}),A.hoppers.count--,A.hoppers.rows.length||A.getHoppers(),s.success({title:"Hopper deleted!",msg:e.phone?e.phone+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEhopper",msg:e.data?JSON.stringify(e.data):e.toString()})})},function(){console.log("CANCEL")})},A.editHopper=function(e,t){i.show({controller:"CreateOrEditHopperVoiceQueueIdDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hoppers/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{hopper:t,hoppers:A.hoppers.rows,license:null,setting:null,crudPermissions:A.crudPermissions}})},A.createOrEditIvrCampaignHopper=function(e,t){i.show({controller:"CreateOrEditHopperCampaignIdDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/hoppers/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{hopper:t,hoppers:A.hoppers.rows,license:null,setting:null,crudPermissions:A.crudPermissions}})},A.getColorByItem=function(e){var t="";e.FaxAccountId?t="fax":e.OpenchannelAccountId?t="openchannel":e.SmsAccountId?t="sms":e.MailAccountId?t="mail":e.ChatWebsiteId?t="chat":e.amaflags&&(t="voice");return 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";default:return"blue-A700"}}(t)};var y=!0,S=1;function T(t){return function(e){A[t]=e||{count:0,rows:[]}}}function I(e){e&&e.count&&e.rows.length&&(A.journey=_.concat(A.journey,e.rows))}e.$watch("vm.queryHopper.filter",function(e,t){y?n(function(){y=!1}):(t||(S=A.queryHopper.page),e!==t&&(A.queryHopper.page=1),e||(A.queryHopper.page=S),A.getHoppers())}),e.$watch("vm.queryFinal.filter",function(e,t){y?n(function(){y=!1}):(t||(S=A.queryFinal.page),e!==t&&(A.queryFinal.page=1),e||(A.queryFinal.page=S),A.getFinals())}),e.$watch("vm.queryHistory.filter",function(e,t){y?n(function(){y=!1}):(t||(S=A.queryHistory.page),e!==t&&(A.queryHistory.page=1),e||(A.queryHistory.page=S),A.getHistories())})}e.$inject=["$scope","$timeout","$state","$document","$mdDialog","toasty","api","contact","hoppers","finals","histories","contacts","companies","lists","customFields","tags","jscriptySessions","license","Auth","userProfileSection"],angular.module("app.contactmanager.contacts").controller("ContactController",e)}(),function(){"use strict";function e(e,t,n,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}],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),t.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=[],t=0;t<g.result.errors.length;t+=1){var n=g.result.errors[t].row;n.contact_import_error=g.result.errors[t].message,e.push(n)}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(n){i(function(){if(g.result.rows=n.rows,n.errors)for(var e=0;e<n.errors.length;e++)g.result.errors.push(n.errors[e]);if(n.finish){g.result.finish=!0,g.result.affectedRows=n.affectedRows,g.result.failedRows=g.result.errors.length;var t=g.result.rows-g.result.affectedRows-g.result.errors.length;t&&0<t&&(g.duplicates.length?g.result.duplicatedRows=t:g.result.failedRows+=t),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(i,e,s,t,o,n,r){var a=this;a.errors=[],a.title="CONTACTMANAGER.MERGE_CONTACT",a.contact=angular.copy(t),a.lists=n||[],a.change=function(){a.searchTerm?r.cmContact.get({fields:"id,firstName,lastName,phone,email",filter:a.searchTerm,ListId:t.ListId}).$promise.then(function(e){a.contacts=e.rows}).catch(function(e){console.error(e)}):a.contacts=[]},a.showConfirm=function(e,t,n){var a=i.confirm({skipHide:!0}).title("Would you like to merge your contacs?").textContent("All unfilled values of the contact #"+n.id+" will be overwritten by the fields of the contact #"+t.id+".").targetEvent(e).ok("Ok").cancel("Cancel");i.show(a).then(function(){return r.cmContact.merge({to:n.id,from:t.id}).$promise}).then(function(e){i.hide({new:e,to:n,from:t}),_.remove(o,{id:n.id}),_.remove(o,{id:t.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,t,n,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){n.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"},g.title="CONTACTMANAGER.NEW_GLOBALCUSTOMFIELD",g.newGlobalCustomField=!0),a.$watch("vm.globalCustomField.type",function(e,t){if(e!==t)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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.globalCustomFields,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=n.confirm().title("Are you sure?").content("The globalCustomField will be deleted.").ariaLabel("Delete GlobalCustomField").ok("Delete").cancel("Cancel").targetEvent(e);n.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){e.splice(t,1),a.globalCustomFieldForm.$pristine=!1},g.removeItems=function(e){for(var t=e.length,n=0;n<t;n++)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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.globalCustomFields=l||{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="globalCustomFields",b.listOrder="",b.listOrderAsc=null,b.selectedGlobalCustomFields=[],b.query={fields:"createdAt,updatedAt,id,alias,type,values,required",sort:"-updatedAt",ListId:"null",limit:10,page:1},b.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"),"")}),b.editdialog=function(e,t){i.show({controller:"CreateOrEditGlobalCustomFieldDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/globalCustomFields/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{globalCustomField:e,globalCustomFields:b.globalCustomFields.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getGlobalCustomFields=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.cmCustomField.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="GlobalCustomFields",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditGlobalCustomField=function(e,t){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:t,globalCustomFields:b.globalCustomFields.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteGlobalCustomField=S,b.exportSelectedGlobalCustomFields=function(){var e=angular.copy(b.selectedGlobalCustomFields);return b.selectedGlobalCustomFields=[],e},b.deleteSelectedGlobalCustomFields=function(e){var t=i.confirm().title("Are you sure want to delete the selected globalCustomFields?").htmlContent("<b>"+b.selectedGlobalCustomFields.length+" selected</b> will be deleted.").ariaLabel("delete GlobalCustomFields").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedGlobalCustomFields.forEach(function(e){S(e)}),b.selectedGlobalCustomFields=[]})},b.deselectGlobalCustomFields=function(){b.selectedGlobalCustomFields=[]},b.selectAllGlobalCustomFields=function(){b.selectedGlobalCustomFields=b.globalCustomFields.rows};var E=!0,A=1;function y(e){b.globalCustomFields=e||{count:0,rows:[]}}function S(e){m.cmCustomField.delete({id:e.id}).$promise.then(function(){_.remove(b.globalCustomFields.rows,{id:e.id}),b.globalCustomFields.count-=1,b.globalCustomFields.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcmCustomField"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getGlobalCustomFields())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","globalCustomFields","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.contactmanager").controller("GlobalCustomFieldsController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.lists,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The list will be deleted.").ariaLabel("Delete List").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,o,r,l,d){var c=this;function m(){return a(function(n,t){return a(function(t,n){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.cmList.getAgents({id:c.list.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return t.penalty=e.UserList?"penalty "+e.UserList.penalty:"",t.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=l.getCurrentUser(),c.list=t,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(n,t){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.cmList.removeAgents({id:c.list.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.cmList.addAgents({id:c.list.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,items:[],selectedItems:[],showSelectAndDeselectAll:!o,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("CONTACTMANAGER.ALL_AGENTS"),labelSelected:r.instant("CONTACTMANAGER.SELECTED_AGENTS"),transferCallback:function(e,t){var n=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(n)}}}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,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.list={},c.listCustomFields={count:0,rows:[]},c.selectedListCustomFields=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,alias,type,values,required",limit:10,page:1},c.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"),"")}),c.init=function(e,t){c.list=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.list.id,c.query.ListId=c.list.id,c.getListCustomFields()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the customField?").htmlContent("<b>"+(e.name||"customField")+"</b> will be deleted.").ariaLabel("delete customField").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getListCustomFields=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.cmList.getCustomFields(c.query,p).$promise},c.createOrEditListCustomField=function(e,t){s.show({controller:"CreateOrEditCustomFieldDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/lists/edit/customFields/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{list:c.list,customField:t,customFields:c.listCustomFields.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedListCustomFields=function(){var e=angular.copy(c.selectedListCustomFields);return c.selectedListCustomFields=[],e},c.deleteListCustomField=g,c.deleteSelectedListCustomFields=function(e){var t=s.confirm().title("Are you sure want to delete the selected customFields?").htmlContent("<b>"+c.selectedListCustomFields.length+" selected</b> will be deleted.").ariaLabel("delete customFields").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedListCustomFields.forEach(function(e){g(e)}),c.selectedListCustomFields=[]})};var m=!0,u=1;function p(e){c.listCustomFields=e||{count:0,rows:[]}}function g(e){l.cmCustomField.delete({id:e.id}).$promise.then(function(){_.remove(c.listCustomFields.rows,{id:e.id}),c.listCustomFields.count-=1,c.listCustomFields.rows.length||c.getListCustomFields(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcmList"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcmList",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getListCustomFields())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.contactmanager").controller("ListCustomFieldsController",e)}(),function(){"use strict";function e(a,e,t,n,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){n.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"},g.title="CONTACTMANAGER.NEW_CUSTOMFIELD",g.newCustomField=!0),e.params.id&&(g.customField.ListId=e.params.id),a.$watch("vm.customField.type",function(e,t){if(e!==t)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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.customFields,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=n.confirm().title("Are you sure?").content("The customField will be deleted.").ariaLabel("Delete CustomField").ok("Delete").cancel("Cancel").targetEvent(e);n.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){e.splice(t,1),a.customFieldForm.$pristine=!1},g.removeItems=function(e){for(var t=e.length,n=0;n<t;n++)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,n,i,s,t,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=t,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(n,e){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:303}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?a.go("app.contactmanager.contacts",{ListId:n.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:n.id})}},u.agentadddialog=function(e,t){n.show({controller:"ListagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/lists/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:t,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")},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,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.list={},c.listVoiceDispositions={count:0,rows:[]},c.selectedListVoiceDispositions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,name",limit:10,page:1},c.init=function(e,t){c.list=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.list.id,c.query.ListId=c.list.id,c.getListVoiceDispositions()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the voiceDisposition?").htmlContent("<b>"+(e.name||"voiceDisposition")+"</b> will be deleted.").ariaLabel("delete voiceDisposition").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getListVoiceDispositions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.cmList.getDispositions(c.query,p).$promise},c.createOrEditListVoiceDisposition=function(e,t){s.show({controller:"CreateOrEditVoiceDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/lists/edit/voiceDispositions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{list:c.list,voiceDisposition:t,voiceDispositions:c.listVoiceDispositions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedListVoiceDispositions=function(){var e=angular.copy(c.selectedListVoiceDispositions);return c.selectedListVoiceDispositions=[],e},c.deleteListVoiceDisposition=g,c.deleteSelectedListVoiceDispositions=function(e){var t=s.confirm().title("Are you sure want to delete the selected voiceDispositions?").htmlContent("<b>"+c.selectedListVoiceDispositions.length+" selected</b> will be deleted.").ariaLabel("delete voiceDispositions").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedListVoiceDispositions.forEach(function(e){g(e)}),c.selectedListVoiceDispositions=[]})};var m=!0,u=1;function p(e){c.listVoiceDispositions=e||{count:0,rows:[]}}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){_.remove(c.listVoiceDispositions.rows,{id:e.id}),c.listVoiceDispositions.count-=1,c.listVoiceDispositions.rows.length||c.getListVoiceDispositions(),r.success({title:"VoiceDisposition deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcmList"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcmList",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getListVoiceDispositions())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.contactmanager").controller("ListVoiceDispositionsController",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(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_VOICEDISPOSITION",g.voiceDisposition=angular.copy(l),g.voiceDispositions=r,g.newVoiceDisposition=!1,g.voiceDisposition||(g.voiceDisposition={},g.title="CONTACTMANAGER.NEW_VOICEDISPOSITION",g.newVoiceDisposition=!0),t.params.id&&(g.voiceDisposition.ListId=t.params.id),g.addNewVoiceDisposition=function(){g.errors=[],d.disposition.save(g.voiceDisposition).$promise.then(function(e){g.voiceDispositions.unshift(e.toJSON()),o.success({title:"VoiceDisposition properly created",msg:g.voiceDisposition.name?g.voiceDisposition.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.disposition.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveVoiceDisposition=function(){g.errors=[],d.disposition.update({id:g.voiceDisposition.id},g.voiceDisposition).$promise.then(function(e){var t=_.find(g.voiceDispositions,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"VoiceDisposition properly saved!",msg:g.voiceDisposition.name?g.voiceDisposition.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.disposition.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteVoiceDisposition=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The voiceDisposition will be deleted.").ariaLabel("Delete VoiceDisposition").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.disposition.delete({id:g.voiceDisposition.id}).$promise.then(function(){_.remove(g.voiceDispositions,{id:g.voiceDisposition.id}),o.success({title:"VoiceDisposition properly deleted!",msg:(g.voiceDisposition.name||"voiceDisposition")+" has been deleted!"}),v(g.voiceDisposition)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.disposition.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.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","voiceDispositions","voiceDisposition","api","Auth","license","setting","crudPermissions"],angular.module("app.contactmanager").controller("CreateOrEditVoiceDispositionDialogController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.lists=l||{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="lists",b.listOrder="",b.listOrderAsc=null,b.selectedLists=[],b.query={fields:"createdAt,updatedAt,id,name,description,dialPrefix",sort:"-updatedAt",limit:10,page:1},b.editstate=function(e,t){a.go("app.contactmanager.lists.edit",{id:e.id,list:e,crudPermissions:b.crudPermissions})},b.gotocontactsgoto=function(n,e){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:303}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?a.go("app.contactmanager.contacts",{ListId:n.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:n.id})}},b.exportcsvcontactsexport=function(i,e){return m.cmList.getContactsCsv({id:i.id,nolimit:!0}).$promise.then(function(e){if(void 0!==e.length){var t=[e.buffer],n=new Blob(t,{type:e.type}),a=window.document.createElement("a");a.setAttribute("href",URL.createObjectURL(n)),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()})})},b.agentadddialog=function(e,t){i.show({controller:"ListagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/lists/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{list:e,lists:b.lists?b.lists.rows:[],crudPermissions:b.crudPermissions,realtime:!1}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getLists=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.cmList.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Lists",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditList=function(e,t){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:t,lists:b.lists.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteList=S,b.exportSelectedLists=function(){var e=angular.copy(b.selectedLists);return b.selectedLists=[],e},b.deleteSelectedLists=function(e){var t=i.confirm().title("Are you sure want to delete the selected lists?").htmlContent("<b>"+b.selectedLists.length+" selected</b> will be deleted.").ariaLabel("delete Lists").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedLists.forEach(function(e){S(e)}),b.selectedLists=[]})},b.deselectLists=function(){b.selectedLists=[]},b.selectAllLists=function(){b.selectedLists=b.lists.rows};var E=!0,A=1;function y(e){b.lists=e||{count:0,rows:[]}}function S(e){m.cmList.delete({id:e.id}).$promise.then(function(){_.remove(b.lists.rows,{id:e.id}),b.lists.count-=1,b.lists.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcmList"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getLists())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","lists","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.contactmanager").controller("ListsController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l){var d=this;d.currentUser=s.getCurrentUser(),d.userProfile=r,d.userProfileSection=l&&1==l.count?l.rows[0]:null,d.crudPermissions=s.parseCrudPermissions(d.userProfileSection?d.userProfileSection.crudPermissions:null),d.customDashboard={},d.voiceQueues=o&&o.count?o:{count:0,rows:[]},d.voiceQueuesSelected=o&&o.count?_.map(o.rows,"id"):[],d.interval=t(function(){},1e3),d.onChangeVoiceQueues=function(){for(var e=0;e<d.customDashboard.widgets.length;e+=1)d.customDashboard.widgets[e].voiceQueuesSelected=d.voiceQueuesSelected},d.goToEdit=function(){e.go("app.tools.customDashboards.edit",{id:d.customDashboard.id,tab:1})},i.onWithoutApply("voice_queue:save",function(e){var t=_.find(d.voiceQueues.rows,{id:e.id});t&&_.merge(t,_.pick(e,_.keys(t)))}),a.dashboard.get({id:e.params.id}).$promise.then(function(e){if(e)return d.customDashboard=e,d.customDashboard.widgets=[],d.customDashboard.preview=!0,d.customDashboard.draggable={enabled:!1},d.customDashboard.resizable={enabled:!1},a.dashboard.getItems({id:d.customDashboard.id}).$promise}).then(function(e){if(e&&e.count&&e.rows)for(var t=0;t<e.rows.length;t+=1)e.rows[t].templateUrl="app/core/directives/ms-widget-engine/ms-widget-engine-"+e.rows[t].type+"/ms-widget-engine."+e.rows[t].type+".html",e.rows[t].voiceQueues=d.voiceQueues,e.rows[t].voiceQueuesSelected=d.voiceQueuesSelected,d.customDashboard.widgets.push(e.rows[t])}).catch(function(e){d.customDashboard=void 0}),n.$on("$destroy",function(){i.removeAllListeners("voice_queue:save"),d.interval&&t.cancel(d.interval)})}e.$inject=["$state","$interval","$scope","api","socket","Auth","voiceQueues","userProfile","userProfileSection"],angular.module("app.dashboards.custom").controller("DashboardCustomController",e)}(),function(){"use strict";function e(e,a,i,o,s,t,l,n,r,d,c,m,u,p,g,v,h){var f=this;f.license=p,f.setting=g;function b(e){var t={};for(var n in f.tabs)f.tabs.hasOwnProperty(n)&&(t[n]=f.tabs[n],f.tabs[n].interaction&&(t[n].interaction=_.pick(f.tabs[n].interaction,["id","OpenchannelAccountId","MailAccountId","ChatWebsiteId","FaxAccountId","SmsAccountId","closed","draft"])));i.localStorage.setItem("motion2.user:"+f.user.id,JSON.stringify({tabs:t,currentTab:f.currentTab})),E(e)}function E(e){if(_.isNil(e)||e&&"interaction"===e.type){var t={id:f.user.id,online:!0,capacity:{mail:0,fax:0,sms:0,openchannel:0,chat:0},interaction:{mail:[],fax:[],sms:[],openchannel:[],chat:[]}};for(var n in f.tabs)f.tabs.hasOwnProperty(n)&&t.capacity.hasOwnProperty(f.tabs[n].channel)&&f.tabs[n].interaction&&!f.tabs[n].interaction.closed&&(t.capacity[f.tabs[n].channel]+=1,t.interaction[f.tabs[n].channel].push(f.tabs[n].interaction.id));if(!_.isEqual(f.agentCapacity,t.capacity))return f.agentCapacity=t.capacity,l.rpc.setAgentCapacity(t)}}function A(t){if(f.tabs[t.id]&&(function(e){if(e.channel&&e.interaction)l.user["remove"+_.upperFirst(e.channel)+"Interactions"]({id:f.user.id,ids:[e.interaction.id]}).$promise.catch(function(e){console.error(e)})}(f.tabs[t.id]),delete f.tabs[t.id],f.currentTab=0,b(t),"interaction"===t.type))return l[t.channel+"Interaction"].get({id:t.interaction.id}).$promise.then(function(e){return l.user["remove"+_.upperFirst(t.channel)+"Interactions"]({id:f.user.id,ids:[e.id]}).$promise}).catch(function(e){console.error(e)})}function y(e){e.id=_.random(1e10),e.openedAt=new Date,e.saved=!1,e.badges=0,f.tabs[e.id]=e,f.currentTab=e.id,b(e)}function S(t,n){var e={type:"interaction",title:t?t.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";default:return"icon-hangouts"}}(t),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";default:return"grey"}}(t),channel:t,interaction:n},a=_.find(f.tabs,function(e){return"interaction"===e.type&&e.interaction&&e.interaction.id===n.id&&e.channel===t});a?f.currentTab=a.id:y(e)}function T(e){e&&e.uniqueid&&f.notifications[e.uniqueid]&&(r.clear(f.notifications[e.uniqueid]),delete f.notifications[e.uniqueid])}function I(e,t){return 0<=t&&(e.calls[t].disposedAt=new Date,n.removeAllListeners("voice_queue_channel:remove"),n.removeAllListeners("voice_outbound_channel:remove"),!0)}function C(){return function(e){if(404===e.status)r.warning({title:o.instant("DASHBOARDS.ATTENTION"),msg:o.instant("DASHBOARDS.ACCEPT_ELSEWHERE")});else if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelMessage.accept"}];for(var t=0;t<e.data.errors.length;t+=1)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelMessage.accept",msg:e.data?JSON.stringify(e.data.message):e.toString()})}}f.detectBrowser=h.detectBrowser(),f.user=t.getCurrentUser(),f.currentTab=0,f.notifications={},f.tabs={},f.agentCapacity={},f.globalUserLists=d||{count:0,rows:[]},f.globalLists=c||{count:0,rows:[]},f.globalCompanies=m||{count:0,rows:[]},f.globalTags=u||{count:0,rows:[]},f.onContactManager=function(t){var e={ListId:t.ListId,limit:1,offset:0,sort:"-updatedAt"},n=!1,a=t.calleridname&&"<unknown>"!==t.calleridname?t.calleridname:t.calleridnum||t.uniqueid,i=t.calleridnum;_.isNil(t["xmd-contactid"])?_.isNil(t.routeId)?e.phone=t.calleridnum:(e.phone=t.destcalleridnum,a=t.destcalleridname&&"<unknown>"!==t.destcalleridname?t.destcalleridname:t.destcalleridnum||t.uniqueid,i=t.destcalleridnum):(e.id=t["xmd-contactid"],n=!0,_.isNil(t["xmd-listid"])||parseInt(t["xmd-listid"],10)===t.ListId||t["xmd-contactid2"]&&(e.id=t["xmd-contactid2"]));return l.cmContact.get(e).$promise.then(function(e){n?e&&f.addContactTab(e,t):e.count&&e.rows[0]?f.addContactTab(e.rows[0],t):f.addContactTab({firstName:a,ListId:t.ListId,phone:i},t)}).catch(C())},f.onJscripty=function(n){return l.jscriptyProject.get({id:n.ProjectId}).$promise.then(function(t){if(t){if(!_.isUndefined(n["xmd-contactid"]))return l.cmContact.get({id:n["xmd-contactid"]}).$promise.then(function(e){try{t.formData=Mustache.render(t.formData,_.merge(n,{user:f.user,contact:e}))}catch(e){console.error(e)}y({type:"jscripty",title:t.name,icon:"icon-script",color:"grey",project:t,call:n,contact:e})}).catch(C());try{t.formData=Mustache.render(t.formData,_.merge(n,{user:f.user}))}catch(e){console.error(e)}y({type:"jscripty",title:t.name,icon:"icon-script",color:"grey",project:t,call:n})}}).catch(C())},f.onBot=function(t){var n=t.calleridname&&"<unknown>"!==t.calleridname?t.calleridname:t.calleridnum,a=t.calleridnum;return l.squareMessage.get({fields:"id",limit:1,offset:0,uniqueid:t.uniqueid}).$promise.then(function(e){e.count&&y({type:"bot",title:n+" <"+a+">",icon:"fas fa-robot",color:"pink",data:{uniqueid:t.uniqueid}})})},f.onBrowserUrl=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;default:i.open(e.uri)}else i.open(e.uri)},f.onBrowserPopup=function(e){e&&e.html&&y({type:"popup",title:e.calleridnum||"popup",icon:"icon-tablet",color:"grey",html:e.html})},f.onNotificationSave=function(e){if(e&&e.uniqueid){n=e,v.isSupported()?v.requestPermission().then(function(){var e,t;t={autoClose:!0,duration:10,showOnPageHidden:!0,icon:"../../../../../../../assets/images/avatars/customer.png",body:(e=n).queue?"Queue: "+e.queue:"",focusOnclick:!0,closeOnClick:!0},v.show(e.title,t)},function(e){console.error("Please enable browser notifications!",e)}):console.error("Browser notifications are not supported by the browser. Normal notifications will be used.");var t=f.alreadyExistsTab(e);if(t){if(l[e.channel+"Message"])return f.currentTab!==t.id&&(t.badges+=1),l[e.channel+"Message"].accept({id:e.id,UserId:f.user.id}).$promise.catch(C())}else r.wait({title:e.title,msg:e.msg||"",showClose:!1,clickToClose:!1,timeout:!1,sound:e.sound,html:!0,shake:e.shake||!1,onAdd:function(){f.notifications[e.uniqueid]=this.id},onAccept:function(){if(T(e),l[e.channel+"Message"])return l[e.channel+"Message"].accept({id:e.id,UserId:f.user.id,manual:!0}).$promise.then(function(e){S(e.channel,e.interaction),r.success({title:"Message properly accepted!",msg:"Message has been accepted!"})}).catch(C())},onReject:function(){if(T(e),l[e.channel+"Message"])return l[e.channel+"Message"].reject({id:e.id,UserId:f.user.id}).$promise.then(function(e){r.success({title:"Message properly rejected!",msg:"Message has been rejected!"})}).catch(C())}})}var n},f.onNotificationRemove=T,f.onVoiceChannelRemove=function(t){var e=f.currentTab?f.tabs[f.currentTab]:null;e||(e=_.find(f.tabs,{calls:[{uniqueid:t.uniqueid}]}));var n=_.findLastIndex(e.calls,function(e){return e.uniqueid===t.uniqueid});if(!I(e,n)){var a=_.find(f.tabs,{calls:[{uniqueid:t.uniqueid}]});if(a){var i=_.findLastIndex(a.calls,function(e){return e.uniqueid===t.uniqueid});I(a,i)}}f.contact&&f.contact.id&&$timeout((s=t.uniqueid,o=f.contact.id,r=e,function(){var e=_.find(r.calls,function(e){return e.uniqueid===s});if(e)return l.voiceCallReport.update({id:s,ContactId:o}).$promise.catch(function(e){console.error(e)})}),1e3);var s,o,r},f.onClickTab=function(e){f.currentTab=e,b(f.tabs[e])},f.isActiveTab=function(e){return e===f.currentTab},f.alreadyExistsTab=function(t){return _.find(f.tabs,function(e){return"interaction"===e.type&&e.interaction&&e.interaction.id==t.interactionId&&e.channel==t.channel})},f.addContactTab=function(t,n){var a={type:"contact",title:t?function(e){var t="";e&&(e.firstName||e.lastName?(e.firstName&&(t+=e.firstName+" "),e.lastName&&(t+=e.lastName)):e.phone&&(t=e.phone));return t}(t):o.instant("DASHBOARDS.NEW_CONTACT"),icon:"icon-account-circle",color:"red",contact:t,userLists:d,lists:c,companies:m,tags:u,calls:n?[n]:[],autoCreate:n?n.autoCreate:0};if(n){if(n["xmd-cdrtype"]&&"dialer"===n["xmd-cdrtype"])n.answeredAt=n.agentcalledAt?moment(n.agentcalledAt,"YYYY-MM-DD HH:mm:ss").toDate():new Date;else if(n.uniqueid){var e=n.uniqueid.split(".")[0];n.answeredAt=e?new Date(1e3*parseInt(e)):new Date}(n.agentcompleteAt||n.endtime)&&(n.disposedAt=new Date)}if(t){var i=_.find(f.tabs,function(e){return e.contact&&e.contact.id?"contact"===e.type&&e.contact&&e.contact.id==t.id:"contact"===e.type&&e.contact&&e.contact.phone==t.phone});if(i){if(n)if(i.calls){var s=_.find(i.calls,function(e){return e.uniqueid===n.uniqueid});s||i.calls.push(n)}else i.calls=[n];f.currentTab=i.id}else{if(t.ListId)return l.disposition.get({ListId:t.ListId}).$promise.then(function(e){return a.dispositions=e,l.cmList.getCustomFields({id:t.ListId}).$promise}).then(function(e){a.customFields=e}).catch(C()).finally(function(){y(a)});y(a)}}else y(a)},f.addInteractionTab=S,f.addTab=y,f.removeTab=A,f.updateLocalStorage=b,f.closeTab=function(e){var t=a.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)return a.show(t).then(function(){"interaction"===e.type&&a.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!0,locals:{user:f.user,channel:e.channel,interaction:e.interaction}}),A(e)}).catch(function(){"interaction"===e.type&&A(e)});var n=!1;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.",a.show(t).then(function(){A(e)});alert=a.alert().title("Warning").textContent("There is a call that hasn't been disposed yet.").ok("OK"),a.show(alert).finally(function(){alert=void 0})}else A(e)}},n.on("trigger:contactmanager",f.onContactManager),n.on("trigger:jscripty",f.onJscripty),n.on("trigger:bot",f.onBot),n.on("trigger:browser:url",f.onBrowserUrl),n.on("trigger:browser:popup",f.onBrowserPopup),n.on("notification:save",f.onNotificationSave),n.on("notification:remove",f.onNotificationRemove),function(){var e=i.localStorage.getItem("motion2.user:"+f.user.id);if(e)try{e=JSON.parse(e),f.tabs=e.tabs?e.tabs:{},f.currentTab=e.currentTab?e.currentTab:0,E(f.tabs[f.currentTab])}catch(e){console.error(e)}}(),e.$on("$destroy",function(){for(var e in f.notifications)f.notifications.hasOwnProperty(e)&&T({uniqueid:e});n.removeAllListeners("trigger:contactmanager"),n.removeAllListeners("trigger:jscripty"),n.removeAllListeners("trigger:browser:url"),n.removeAllListeners("trigger:browser:popup"),n.removeAllListeners("notification:save"),n.removeAllListeners("notification:remove")})}e.$inject=["$scope","$mdDialog","$window","$translate","$document","Auth","api","socket","toasty","globalUserLists","globalLists","globalCompanies","globalTags","license","setting","desktopNotification","msUtils"],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 t in e)f.hasOwnProperty(t)&&null!=e[t]&&(f[t]=e[t])},$get:["$q","$timeout","$window","PERMISSIONS",function(e,u,t,p){var g=t.Notification||t.mozNotification||t.webkitNotification;return{isSupported:v,currentPermission:h,requestPermission:function(){if(!v())return e.reject("Notification API not supported");var n=e.defer();Promise.resolve(g.requestPermission)==g.requestPermission?g.requestPermission().then(function(e){p.GRANTED===e?n.resolve(e):n.reject(e)}):g.requestPermission(function(e,t){p.GRANTED===e?n.resolve(e):n.reject(e)});return n.promise},show:function(e,t){if(t=t||{},!v()||(n=e,a=t,i=angular.isString(n),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)}(t.showOnPageHidden)||h()!==p.GRANTED)return;var n,a,i,s;var o=new g(e,t),r=t.duration||f.duration,l=void 0===t.autoClose?f.autoClose:t.autoClose;o.onclick=function(){t.onClick&&t.onClick(),t.focusOnclick&&window.focus(),t.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 t(e,t){if(angular.isString(e)){for(var n=e.split("."),a=n[n.length-1],i=function(e){var t=l;if(1===e.length)return t;e.pop();for(var n=0;n<e.length;n++){for(var a=e[n],i=!0,s=0;s<t.length;s++)if(t[s]._id===a){t=t[s].children,i=!1;break}if(i){var o={_id:a,_path:e.join("."),title:a,weight:1,children:[]};t.push(o),t=o.children}}return t}(n),s=!1,o=0;o<i.length;o++)if(i[o]._id===a){s=i[o];break}s?(angular.extend(s,t),s.uisref=d(s)):(t.children=[],!angular.isUndefined(t.weight)&&angular.isNumber(t.weight)||(t.weight=1),t._id=a,t._path=e,t.uisref=d(t),i.push(t))}else r.error("path must be a string (eg. `dashboard.project`)")}function d(e){var t="";return angular.isDefined(e.state)&&(t=e.state,angular.isDefined(e.stateParams)&&angular.isObject(e.stateParams)&&(t=t+"("+angular.toJson(e.stateParams)+")")),t}this.saveItem=t,this.deleteItem=function(e){if(!angular.isString(e))return void r.error("path must be a string (eg. `dashboard.project`)");for(var t=l,n=e.split("."),a=0;a<n.length;a++)for(var i=n[a],s=0;s<t.length;s++)if(t[s]._id===i){if(t[s]._path===e)return t.splice(s,1),!0;t=t[s].children;break}return!1},this.$get=function(){var e={saveItem:t,getNavigation:function(e){if(e){for(var t=0;t<l.length;t++)if(l[t]._id===e)return[l[t]];return null}return l}};return e}}).constant("PERMISSIONS",{DEFAULT:"default",GRANTED:"granted",DENIED:"denied"})}(),function(){"use strict";function e(n){var a=this;a.setting={},a.messages={count:0,rows:[]},a.showInteraction=!1,a.init=function(e,t){{if(a.setting=t,a.tab=e,a.tab.saved=!0,a.tab&&a.tab.data&&a.tab.data.uniqueid)return n.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(o,r,n,l,d,c,t,e,a,i){var m=this;function s(e){e&&e.count&&e.rows.length&&(m.journey=_.concat(m.journey,e.rows))}m.user=t.getCurrentUser(),m.detectBrowser=i.detectBrowser(),m.journey=[],m.queryHopper={fields:"id,phone,scheduledat",sort:"-updatedAt",limit:10,page:1},m.queryFinal={fields:"uniqueid,calleridnum,statedesc,starttime,disposition",sort:"-updatedAt",limit:10,page:1},m.queryHistory={fields:"uniqueid,calleridnum,statedesc,scheduledat,starttime,endtime",sort:"-updatedAt",limit:10,page:1},m.hoppers={rows:[],count:0},m.finals={rows:[],count:0},m.histories={rows:[],count:0},m.addNewContact=function(){m.errors=[],d.cmContact.save(m.contact).$promise.then(function(e){return m.contact.id=e.id,m.newContact=!1,m.tab.title=e.firstName||e.phone,m.tab.contact=m.contact,d.user.addContacts({id:t.getCurrentUser().id,ids:[e.id]})}).then(function(){m.detailForm.$pristine=!0,m.customFieldsForm.$pristine=!0,c.success({title:"Contact properly created",msg:m.contact.firstName?m.contact.firstName+" has been created!":""})}).then(function(){return d.cmContact.setTags({id:m.contact.id,ids:m.tab.Tags}).$promise}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.contact.save"}];for(var t=0;t<e.data.errors.length;t+=1)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contact.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){return m.tab.title=e.firstName||e.phone,m.tab.contact=m.contact,l.$parent.vm.updateLocalStorage(),d.user.addContacts({id:t.getCurrentUser().id,ids:[e.id]})}).then(function(){return d.cmContact.setTags({id:m.contact.id,ids:m.tab.Tags}).$promise}).then(function(){m.detailForm.$pristine=!0,m.customFieldsForm.$pristine=!0,c.success({title:"Contact properly updated!",msg:m.contact.name?m.contact.name+" has been updated!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.contact.save"}];for(var t=0;t<e.data.errors.length;t+=1)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contact.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.getCustomFields=function(e){return d.cmList.getCustomFields({id:e}).$promise.then(function(e){m.tab.customFields=e}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"LIST:GETCustomFields",msg:e.data?JSON.stringify(e.data):e.toString()})})},m.call=l.$parent.vm.call,m.disposeCall=function(e,t){if(m.newContact)return void c.error({title:"ATTENTION",msg:"Please save the contact before disposing!"});o.show({controller:"DisposeCallDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/contact/dispose/dialog.html",parent:angular.element(r.body),targetEvent:t,clickOutsideToClose:!1,resolve:{globalDispositions:["apiResolver",function(e){return e.resolve("disposition@get",{MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null"})}]},locals:{dispositions:m.tab.dispositions,contact:m.contact,call:t}}).then(function(e){e&&("BLACKLIST"===e?c.success({title:a.instant("DASHBOARDS.INFO"),msg:a.instant("DASHBOARDS.CALL_DISPOSED")+" "+e}):"RECALLME"===e||"RESCHEDULE"===e||c.success({title:a.instant("DASHBOARDS.INFO"),msg:a.instant("DASHBOARDS.CALL_SAVED")})),_.remove(m.tab.calls,function(e){return e.uniqueid==t.uniqueid})})},m.duplicateContact=function(e){o.show({controller:"DuplicateContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:m.contact.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:t.getCurrentUser().id,fields:"id,name"})}]},locals:{contacts:[]}})},m.mergeContact=function(e){o.show({controller:"MergeContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/merge/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:m.contact.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:t.getCurrentUser().id,fields:"id,name"})}]},locals:{contacts:[]}}).then(function(e){if(e){for(var t in l.$parent.$parent.$parent.vm.tabs)if(l.$parent.$parent.$parent.vm.tabs.hasOwnProperty(t)){var n=l.$parent.$parent.$parent.vm.tabs[t];n&&n.contact&&(e.from&&e.from.id&&e.from.id===n.contact.id&&l.$parent.$parent.$parent.vm.removeTab(n),e.to&&e.to.id&&e.to.id===n.contact.id&&l.$parent.$parent.$parent.vm.removeTab(n))}e.new&&l.$parent.$parent.$parent.vm.addContactTab(e.new)}})},m.getDateFromString=function(e){return null===e?void 0:new Date(e)},m.addJscriptyTab=function(e){try{e.formData=Mustache.render(e.formData,{contact:m.contact,user:m.user})}catch(e){console.error(e)}try{l.$parent.$parent.$parent.vm.addTab({type:"jscripty",title:e.name,icon:"icon-script",color:"grey",project:e,contact:m.contact})}catch(e){c.error({title:"ERROR OPENING JSCRIPTY PROJECT",msg:"The project cannot be started"+JSON.stringify(e)})}},m.getHoppers=function(){m.contact&&m.contact.id&&(m.queryHopper.ContactId=m.contact.id,m.queryHopper.offset=(m.queryHopper.page-1)*m.queryHopper.limit,m.promise=d.cmHopper.get(m.queryHopper,g("hoppers")).$promise)},m.getFinals=function(){m.contact&&m.contact.id&&(m.queryFinal.ContactId=m.contact.id,m.queryFinal.offset=(m.queryFinal.page-1)*m.queryFinal.limit,m.promise=d.cmHopperFinal.get(m.queryFinal,g("finals")).$promise)},m.getHistories=function(){m.contact&&m.contact.id&&(m.queryHistory.ContactId=m.contact.id,m.queryHistory.offset=(m.queryHistory.page-1)*m.queryHistory.limit,m.promise=d.cmHopperHistory.get(m.queryHistory,g("histories")).$promise)},m.getJscriptyProjects=function(){d.jscriptyProject.get({fields:"createdAt,updatedAt,id,name,description,createdAt,formData,enableUncompleteSave",sort:"-updatedAt",nolimit:!0}).$promise.then(function(e){m.jscriptyProjects=e||{count:0,rows:[]}}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.jscripty.account"}];for(var t=0;t<e.data.errors.length;t+=1)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.jscripty.account",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.getMailAccounts=function(){d.user.getMailAccounts({id:m.user.id,nolimit:!0}).$promise.then(function(e){m.mailAccounts=e||{count:0,rows:[]}}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.mail.account"}];for(var t=0;t<e.data.errors.length;t+=1)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mail.account",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.getFaxAccounts=function(){d.user.getFaxAccounts({id:m.user.id,nolimit:!0}).$promise.then(function(e){m.faxAccounts=e||{count:0,rows:[]}}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.fax.account"}];for(var t=0;t<e.data.errors.length;t+=1)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.fax.account",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.getSmsAccounts=function(){d.user.getSmsAccounts({id:m.user.id,nolimit:!0}).$promise.then(function(e){m.smsAccounts=e||{count:0,rows:[]}}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.sms.account"}];for(var t=0;t<e.data.errors.length;t+=1)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.sms.account",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.getOpenchannelAccounts=function(){d.user.getOpenchannelAccounts({id:m.user.id,nolimit:!0}).$promise.then(function(e){m.openchannelAccounts=e||{count:0,rows:[]}}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.sms.account"}];for(var t=0;t<e.data.errors.length;t+=1)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannel.account",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.getChatWebsites=function(){d.user.getChatWebsites({id:m.user.id,nolimit:!0}).$promise.then(function(e){m.chatAccounts=e||{count:0,rows:[]}}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.chatAccounts.account"}];for(var t=0;t<e.data.errors.length;t+=1)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatAccounts.account",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.getLists=function(){d.user.getLists({id:m.user.id,nolimit:!0}).$promise.then(function(e){m.lists=e||{count:0,rows:[]}}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.cm.lists"}];for(var t=0;t<e.data.errors.length;t+=1)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cm.lists",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.composeInteraction=function(e,i,t,n){var s=i.toLowerCase();o.show({controller:"Compose"+i+"InteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose"+i+"/dialog.html",parent:angular.element(r.body),clickOutsideToClose:!1,locals:{account:t,message:{to:"mail"==s?n:n.split(",")},type:"new",interaction:{Contact:m.contact}},fullscreen:!0}).then(function(a){return d[s+"Account"].send({id:t.id},a).$promise.then(function(e){if("Mail"===i){var t=e;if(t&&t.Messages&&t.Messages.length){if(a.attachments&&a.attachments.length)for(var n=0;n<a.attachments.length;n+=1)d.attachment.update({id:a.attachments[n].id},{MailMessageId:_.head(t.Messages).id});c.success({title:"Message properly sent!",msg:"Message has been sent!"}),t.closed?(t.disposition=null,o.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(r.body),clickOutsideToClose:!0,locals:{user:m.user,channel:"mail",interaction:t}})):l.$parent.vm.addInteractionTab("mail",t)}}else c.success({title:"Message properly sent!",msg:"Message has been sent!"}),l.$parent.vm.addInteractionTab(s,e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else"fax"===s?c.error({title:"FAX:SEND",msg:e.data?JSON.stringify(e.data):e.message||e.toString()}):c.error({title:e.status?"API:"+e.status+" - "+e.statusText:i.toUpperCase()+"ACCOUNT:SEND",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})})},m.init=function(e,t){m.tab=e,l.$watchGroup(["vm.detailForm.$pristine","vm.customFieldsForm.$pristine"],function(e){m.tab.saved=e[0]&&e[1]}),m.license=t,m.contact=m.tab.contact,m.newContact=!1,m.currentTab=0,m.contact&&m.contact.id?(d.user.addContacts({id:m.user.id,ids:[m.contact.id]}),m.contact.ListId&&(m.tab.userLists.rows=_.unionBy(m.tab.userLists.rows,_.filter(m.tab.lists.rows,{id:m.contact.ListId}),"id"),m.list=_.find(m.tab.userLists.rows,{id:m.contact.ListId})),m.getHoppers(),m.getFinals(),m.getHistories(),m.getMailAccounts(),m.getFaxAccounts(),m.getSmsAccounts(),m.getOpenchannelAccounts(),m.getChatWebsites(),m.getLists()):(m.newContact=!0,e.autoCreate&&(console.log("autoCreate"),m.addNewContact()));d.user.get({fields:"id,fullname",nolimit:!0}).$promise.then(function(e){m.users=e||{count:0,rows:[]},m.usersMap=_.mapValues(_.keyBy(m.users.rows,"id"),"fullname")}).then(function(){if(m.contact&&m.contact.id)return d.cmContact.getTags({id:m.contact.id}).$promise}).then(function(e){e&&(m.tab.Tags=_.map(e.rows,"id"))}).then(function(e){var t=["mail","chat","sms","openchannel","fax"];if(e&&e.id){for(var n=0;n<t.length;n++)d[t[n]+"Interaction"].get({ContactId:e.id,includeAll:!0}).$promise.then(s);d.voiceCallReport.get({ContactId:e.id,includeAll:!0}).$promise.then(s).catch(function(e){console.error(e)})}}(m.contact))},m.hasPermission=function(e){return t.hasPermission(e)},m.openInteraction=function(e,t){try{if(t.MailAccountId)return l.$parent.$parent.$parent.vm.addInteractionTab("mail",t);if(t.ChatWebsiteId)return l.$parent.$parent.$parent.vm.addInteractionTab("chat",t);if(t.SmsAccountId)return l.$parent.$parent.$parent.vm.addInteractionTab("sms",t);if(t.OpenchannelAccountId)return l.$parent.$parent.$parent.vm.addInteractionTab("openchannel",t);if(t.FaxAccountId)return l.$parent.$parent.$parent.vm.addInteractionTab("fax",t)}catch(e){c.error({title:"ERROR OPEN INTERACTION",msg:"Customer Journey can't open the interaction"})}},m.getColorByItem=function(e){var t="";e.FaxAccountId?t="fax":e.OpenchannelAccountId?t="openchannel":e.SmsAccountId?t="sms":e.MailAccountId?t="mail":e.ChatWebsiteId?t="chat":e.amaflags&&(t="voice");return 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";default:return"blue-A700"}}(t)},m.isMyAccount=function(e){{if(e.FaxAccountId)return _.includes(_.map(m.faxAccounts?m.faxAccounts.rows:[],"id"),e.FaxAccountId);if(e.OpenchannelAccountId)return _.includes(_.map(m.openchannelAccounts?m.openchannelAccounts.rows:[],"id"),e.OpenchannelAccountId);if(e.SmsAccountId)return _.includes(_.map(m.smsAccounts?m.smsAccounts.rows:[],"id"),e.SmsAccountId);if(e.MailAccountId)return _.includes(_.map(m.mailAccounts?m.mailAccounts.rows:[],"id"),e.MailAccountId);if(e.ChatWebsiteId)return _.includes(_.map(m.chatAccounts?m.chatAccounts.rows:[],"id"),e.ChatWebsiteId);if(e.amaflags)return!0}return!1},e.on("voice_queue_channel:remove",l.$parent.vm.onVoiceChannelRemove),e.on("voice_outbound_channel:remove",l.$parent.vm.onVoiceChannelRemove),m.getJscriptyProjects(),l.$watch("currentTab",function(e,t){1===m.currentTab&&(m.getHoppers(),m.getFinals(),m.getHistories())});var u=!0,p=1;function g(t){return function(e){m[t]=e||{count:0,rows:[]}}}l.$watch("queryHopper.filter",function(e,t){u?n(function(){u=!1}):(t||(p=m.queryHopper.page),e!==t&&(m.queryHopper.page=1),e||(m.queryHopper.page=p),m.getHoppers())}),l.$watch("queryFinal.filter",function(e,t){u?n(function(){u=!1}):(t||(p=m.queryFinal.page),e!==t&&(m.queryFinal.page=1),e||(m.queryFinal.page=p),m.getFinals())}),l.$watch("queryHistory.filter",function(e,t){u?n(function(){u=!1}):(t||(p=m.queryHistory.page),e!==t&&(m.queryHistory.page=1),e||(m.queryHistory.page=p),m.getHistories())}),l.$on("$destroy",function(){})}e.$inject=["$mdDialog","$document","$timeout","$scope","api","toasty","Auth","socket","$translate","msUtils"],angular.module("app.dashboards").controller("AgentGeneralContactController",e)}(),function(){"use strict";function e(t,i,s,o,e,n,a,r,l,d){var c=this;function m(){var e=c.choice?c.choice.toLowerCase():void 0;return{id:c.call.uniqueid,disposition:c.choice,dispositionat:moment(),amd:"amd"===e,fax:"fax"===e,blacklist:"blacklist"===e,recallme:"recallme"===e,UserId:"recallme"===e?l.getCurrentUser().id:null,OwnerId:l.getCurrentUser().id}}c.choice=null,c.isReschedule=!1,c.recallme=!1,c.queueCampaigns={count:0,rows:[]},c.queueCampaign=void 0,c.dispositions=e,c.globalDispositions=n,c.contact=r,c.call=a,c.note=c.call.note||void 0,c.dialerCall=!1,c.hasBlackLists=!1,c.hopper={minDate:new Date,dateTime:new Date},c.call&&c.call.variables&&c.call.variables["xmd-voicequeueid"]?(c.dialerCall=!0,o.voiceQueue.getBlackLists({id:c.call.variables["xmd-voicequeueid"]}).$promise.then(function(e){e&&e.rows&&0<e.rows.length&&(c.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()})})):o.user.getQueues({id:l.getCurrentUser().id,fields:"id,name,dialActive",channel:"voice",type:"outbound",nolimit:!0}).$promise.then(function(e){c.queueCampaigns=e||{count:0,rows:[]}}).catch(function(e){console.error(e)}),c.saveDisposition=function(e){c.choice=_.isNil(e)?c.choice:e,c.call.note=c.note,o.user.unpause({id:l.getCurrentUser().id}).$promise.then(function(e){}).catch(function(e){console.error(e)}),o.voiceCallReport.update({id:c.call.uniqueid,userDisposition:c.choice,note:c.note,UserId:l.getCurrentUser().id,ContactId:c.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:c.call.uniqueid}).$promise.then(function(e){if(e)for(var t=0;t<e.rows.length;t+=1)o.voiceRecording.update({id:e.rows[t].id,userDisposition:c.choice}).$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()})}),c.dialerCall&&(o.cmHopperFinal.update(m()).$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(m()).$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(c.choice))t.hide(c.choice?c.choice.toUpperCase():"");else switch(c.choice.toLowerCase()){case"blacklist":c.call&&c.call.variables&&c.call.variables["xmd-voicequeueid"]&&function(e){if(e)o.voiceQueue.getBlackLists({id:e,type:"outbound",fields:"id"}).$promise.then(function(e){var t=[];if(e&&0<e.count){for(var n=0;n<e.rows.length;n+=1){var a=angular.copy(c.contact);delete a.id,a.ListId=e.rows[n].id,t.push(o.cmContact.save(a).$promise)}return i.all(t)}s.success({title:d.instant("DASHBOARDS.INFO"),msg:d.instant("DASHBOARDS.NOTAVAILABLE")+" "+c.choice}),c.choice=void 0}).then(function(e){e&&t.hide(c.choice?c.choice.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()}),t.hide(c.choice?c.choice.toUpperCase():"")})}(c.call.variables["xmd-voicequeueid"]);break;case"reschedule":c.isReschedule=!0,c.recallme=!1;break;case"recallme":c.isReschedule=!0,c.recallme=!0;break;default:t.hide(c.choice?c.choice.toUpperCase():"")}},c.closeDialog=function(){t.cancel()},c.saveReschedule=function(){return c.disable=!0,o.cmHopper.save({phone:c.contact.phone,UserId:c.recallme?l.getCurrentUser().id:null,ContactId:c.contact.id,ListId:c.contact.ListId,VoiceQueueId:c.dialerCall?Number(c.call["xmd-voicequeueid"]):c.queueCampaign?c.queueCampaign.id:null,scheduledat:moment(c.hopper.dateTime).format("YYYY-MM-DD HH:mm:ss"),priority:3,recallme:c.recallme,OwnerId:l.getCurrentUser().id}).$promise.then(function(){c.dialerCall&&o.cmHopperFinal.update({id:c.call.uniqueid,rescheduled:!0,rescheduledat:moment(c.hopper.dateTime).format("YYYY-MM-DD HH:mm:ss"),recallme:c.recallme}).$promise.catch(function(e){console.log(e)})}).then(function(){s.success({title:d.instant("DASHBOARDS.INFO"),msg:d.instant("DASHBOARDS.CALL_DISPOSED")+" "+(c.recallme?d.instant("DASHBOARDS.RECALLME"):d.instant("DASHBOARDS.RESCHEDULE"))})}).catch(function(e){t.hide(c.choice?c.choice.toUpperCase():"")}).finally(function(){c.disable=!1,t.hide(c.choice?c.choice.toUpperCase():"")})}}e.$inject=["$mdDialog","$q","toasty","api","dispositions","globalDispositions","call","contact","Auth","$translate"],angular.module("app.staff").controller("DisposeCallDialogController",e)}(),function(){"use strict";function e(e,t,n,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,t){var n=t(function(){},999);e.$on("$destroy",function(){n&&(t.cancel(n),n=null)})}e.$inject=["$scope","$interval"],angular.module("app.dashboards").controller("AgentHomeAbandonedController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(){var e=i.localStorage.getItem("motion2.home.abandoned.bull.calls:"+m.currentUser.id);e&&(e=JSON.parse(e))&&e.query&&(m.query=_.merge(e.query,_.omit(m.query,["sort","limit","page"])),m.query=_.omit(m.query,"filter")),o.disposition.get({MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null"}).$promise.then(function(e){m.disposition=e?e.rows:[]}).catch(function(e){console.log(e)}),o.user.getQueues({id:r.getCurrentUser().id,fields:"id,name",channel:"voice",type:"outbound",nolimit:!0}).$promise.then(function(e){m.queues=e||{count:0,rows:[]},m.queuesMap=_.mapValues(_.keyBy(m.queues.rows,"name"),"name"),m.defaultQueues=m.queues.rows?_.map(m.queues.rows,"name").join(","):void 0}).catch(function(e){console.error(e)}).finally(function(){m.getAbandonedCalls()})}function p(e){m.abandonedCalls=e||{count:0,rows:[]},!1,m.refresh=!0}m.showTooltip=!1,m.refresh=!0,m.disable=[],m.disposition={count:0,rows:[]},m.currentUser=r.getCurrentUser(),m.localizationMap=c,m.pickerModel={dateStart:null},m.queues={},m.abandonedCalls={count:0,rows:[]},m.query={fields:"id,type,calleridnum,calleridname,queue,queuecallerabandonAt,queuecallerexitAt,queuecallerexitreason,assigned,lastAssignedTo,updatedAt,disposition",type:"outbound",queuecallerexitreason:"TIMEOUT,ABANDONED",sort:"-updatedAt",limit:10,page:1},m.clearAll=function(){m.pickerModel={dateStart:null},m.getAbandonedCalls()},m.getAbandonedCalls=function(){if(m.pickerModel.dateStart){var e=moment(m.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format();m.query.createdAt={$gte:m.pickerModel.dateStart,$lte:e}}else m.query.createdAt=void 0;m.query.queue=m.query.queue||m.defaultQueues,m.query.offset=(m.query.page-1)*m.query.limit,i.localStorage.setItem("motion2.home.abandoned.bull.calls:"+m.currentUser.id,JSON.stringify({query:_.omit(m.query,"queue")})),m.promise=o.voiceQueueReport.getVoiceQueuesReport(m.query,p).$promise},m.refreshAbandonedCalls=function(){m.showTooltip=!1,m.getAbandonedCalls()},m.onInit=u,m.reserved=function(e,t){e&&(m.disable[e.id]=!0,o.voiceQueueReport.update({id:e.id,lastAssignedTo:e.assigned?m.currentUser.name:null,assigned:e.assigned,disposition:t||null}).$promise.catch(function(e){console.log(e)}).finally(function(){m.disable[e.id]=!1}))},m.onSavevoiceQueueReport=function(e){m.queuesMap&&"outbound"===e.type&&m.queuesMap[e.queue]&&(m.showTooltip=!0)},m.onUpdatevoiceQueueReport=function(e){if(e){var t=_.findIndex(m.abandonedCalls.rows,["id",e.id]);0<=t&&_.merge(m.abandonedCalls.rows[t],e)}},m.call=e.$parent.$parent.$parent.$parent.vm.call,m.transfer=e.$parent.$parent.$parent.$parent.vm.transfer,m.webcall=e.$parent.$parent.$parent.$parent.vm.webcall,m.webtransfer=e.$parent.$parent.$parent.$parent.vm.webtransfer,l.onWithoutApply("voiceQueueReport:save",m.onSavevoiceQueueReport),l.onWithoutApply("voiceQueueReport:update",m.onUpdatevoiceQueueReport),u();var g=!0,v=1;e.$watch("vm_bull.query.filter",function(e,t){g?n(function(){g=!1}):(t||(v=m.query.page),e!==t&&(m.query.page=1),e||(m.query.page=v),m.getAbandonedCalls())}),e.$on("$destroy",function(){l.removeAllListeners("voiceQueueReport:save"),l.removeAllListeners("voiceQueueReport:update")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty","dateFilterLocalizationFactory"],angular.module("app.dashboards").controller("AgentHomeAbandonedBullController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(){var e=i.localStorage.getItem("motion2.home.abandoned.voice.calls:"+m.currentUser.id);e&&(e=JSON.parse(e))&&e.query&&(m.query=_.merge(e.query,_.omit(m.query,["sort","limit","page"])),m.query=_.omit(m.query,"filter")),o.disposition.get({MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null"}).$promise.then(function(e){m.disposition=e?e.rows:[]}).catch(function(e){console.log(e)}),o.user.getQueues({id:r.getCurrentUser().id,fields:"id,name",channel:"voice",type:"inbound",nolimit:!0}).$promise.then(function(e){m.queues=e||{count:0,rows:[]},m.queuesMap=_.mapValues(_.keyBy(m.queues.rows,"name"),"name"),m.defaultQueues=m.queues.rows?_.map(m.queues.rows,"name").join(","):void 0}).catch(function(e){console.error(e)}).finally(function(){m.getAbandonedCalls()})}function p(e){m.abandonedCalls=e||{count:0,rows:[]},!1,m.refresh=!0}m.showTooltip=!1,m.refresh=!0,m.disable=[],m.disposition={count:0,rows:[]},m.currentUser=r.getCurrentUser(),m.localizationMap=c,m.pickerModel={dateStart:null},m.queues={},m.abandonedCalls={count:0,rows:[]},m.query={fields:"id,type,calleridnum,calleridname,queue,queuecallerabandonAt,queuecallerexitAt,queuecallerexitreason,assigned,lastAssignedTo,updatedAt,disposition",type:"inbound",queuecallerexitreason:"TIMEOUT,ABANDONED",sort:"-updatedAt",limit:10,page:1},m.clearAll=function(){m.pickerModel={dateStart:null},m.getAbandonedCalls()},m.getAbandonedCalls=function(){if(m.pickerModel.dateStart){var e=moment(m.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format();m.query.createdAt={$gte:m.pickerModel.dateStart,$lte:e}}else m.query.createdAt=void 0;m.query.queue=m.query.queue||m.defaultQueues,m.query.offset=(m.query.page-1)*m.query.limit,i.localStorage.setItem("motion2.home.abandoned.voice.calls:"+m.currentUser.id,JSON.stringify({query:_.omit(m.query,"queue")})),m.promise=o.voiceQueueReport.getVoiceQueuesReport(m.query,p).$promise},m.refreshAbandonedCalls=function(){m.showTooltip=!1,m.getAbandonedCalls()},m.onInit=u,m.reserved=function(e,t){e&&(m.disable[e.id]=!0,o.voiceQueueReport.update({id:e.id,lastAssignedTo:e.assigned?m.currentUser.name:null,assigned:e.assigned,disposition:t||null}).$promise.catch(function(e){console.log(e)}).finally(function(){m.disable[e.id]=!1}))},m.onSavevoiceQueueReport=function(e){m.queuesMap&&"inbound"===e.type&&m.queuesMap[e.queue]&&(m.showTooltip=!0)},m.onUpdatevoiceQueueReport=function(e){if(e){var t=_.findIndex(m.abandonedCalls.rows,["id",e.id]);0<=t&&_.merge(m.abandonedCalls.rows[t],e)}},m.call=e.$parent.$parent.$parent.$parent.vm.call,m.transfer=e.$parent.$parent.$parent.$parent.vm.transfer,m.webcall=e.$parent.$parent.$parent.$parent.vm.webcall,m.webtransfer=e.$parent.$parent.$parent.$parent.vm.webtransfer,l.onWithoutApply("voiceQueueReport:save",m.onSavevoiceQueueReport),l.onWithoutApply("voiceQueueReport:update",m.onUpdatevoiceQueueReport),u();var g=!0,v=1;e.$watch("vm_voice.query.filter",function(e,t){g?n(function(){g=!1}):(t||(v=m.query.page),e!==t&&(m.query.page=1),e||(m.query.page=v),m.getAbandonedCalls())}),e.$on("$destroy",function(){l.removeAllListeners("voiceQueueReport:save"),l.removeAllListeners("voiceQueueReport:update")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty","dateFilterLocalizationFactory"],angular.module("app.dashboards").controller("AgentHomeAbandonedVoiceController",e)}(),function(){"use strict";function e(t,e,a,n,i,s,o){var r=this;r.user=i.getCurrentUser(),r.license={},r.plugin={},r.setting={},r.sidebar="dashboard",r.navigation=o.getNavigation(),r.addContactTab=t.$parent.vm.addContactTab,r.addInteractionTab=t.$parent.vm.addInteractionTab,r.init=function(e,t){r.license=e,r.setting=t;var n=a.localStorage.getItem("motion2.home:"+r.user.id);if(n)try{n=JSON.parse(n),r.sidebar=n.currentSidebarTab?n.currentSidebarTab:"dashboard"}catch(e){console.error(e),r.sidebar="dashboard"}},r.changeSidebarTab=function(e){r.sidebar=e.view,"plugin"===r.sidebar&&(r.plugin=e.stateParams,r.pluginId=e.id,t.$broadcast("pluginUpdated",{plugin:r.plugin}));a.localStorage.setItem("motion2.home:"+r.user.id,JSON.stringify({currentSidebarTab:e.view}))},r.hasPermission=function(e){return i.hasPermission(e)}}e.$inject=["$scope","$timeout","$window","api","Auth","socket","msNavigationAgentService"],angular.module("app.dashboards").controller("AgentGeneralHomeController",e)}(),function(){"use strict";function e(n,a,e,t,i,s,o,r,l,d,c){var m=this;function u(e){m.chatInteractions=e||{count:0,rows:[]};for(var t=0;t<m.chatInteractions.rows.length;t+=1)g(m.chatInteractions.rows[t])}function p(){if(m.pickerModel.dateStart){var e=moment(m.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format();m.query.createdAt={$gte:m.pickerModel.dateStart,$lte:e}}else m.query.createdAt=void 0;m.chatAccounts.rows.length?(_.includes(_.map(m.chatAccounts.rows,"id"),m.query.account)||(m.query.account=null),m.query.ChatWebsiteId=m.query.account||_.map(m.chatAccounts.rows,"id").join()):m.query.ChatWebsiteId=-1,m.query.offset=(m.query.page-1)*m.query.limit,i.localStorage.setItem("motion2.home.chat:"+m.user.id,JSON.stringify({query:m.query})),m.promise=o.chatInteraction.get(m.query,u).$promise}function g(e){e&&e.Messages?e.unread=_.filter(e.Messages||[],{direction:"in",read:!1}).length:e.unread=0}m.user=r.getCurrentUser(),m.license={},m.setting={},m.tags={count:0,rows:[]},m.chatInteractions={count:0,rows:[]},m.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,account:null},m.success=u,m.getChatInteractions=p,m.showChatInteraction=function(e,t){n.$parent.vm.addInteractionTab("chat",t)},m.downloadChatInteraction=function(e,s,t){o.chatInteraction.download({id:s.id,attachments:t}).$promise.then(function(e){var t=[e.buffer],n="chat-interaction"+s.id+".zip",a=new Blob(t,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)d.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadChatInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.getContactLabel=function(e){if(e.Contact){var t="";t+=(e.Contact.firstName||"")+""+(e.Contact.lastName||"");var n=e.Account?e.Account.mapKey:void 0;return t+=n&&e.Contact[n]?" <"+e.Contact[n]+">":""}return s.instant("DASHBOARDS.UNKNOWN")},m.getUserLabel=function(e){if(e.UserId)return e.UserId===r.getCurrentUser().id?s.instant("DASHBOARDS.ME"):m.usersByKey[e.UserId].fullname+" <"+m.usersByKey[e.UserId].internal+">";return s.instant("DASHBOARDS.NOT_ASSIGNED")},m.getChatWebsiteLabel=function(e){if(e.Account)return e.Account.key;return s.instant("DASHBOARDS.UNKNOWN")},m.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},m.clearAll=function(){m.calendarModel={dateStart:null},m.pickerModel={dateStart:null},m.serviceModel={dateStart:null},m.getChatInteractions()},m.onInit=function(e,t){return m.license=e,m.setting=t,o.user["get"+_.upperFirst("ChatWebsites")]({id:m.user.id,nolimit:!0}).$promise.then(function(e){return m.chatAccounts=e||{count:0,rows:[]},o.tag.get().$promise}).then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){return o.user.get({nolimit:!0,fields:"id,fullname,userpic,internal"}).$promise}).then(function(e){m.usersByKey=_.keyBy(e.rows,"id")}).catch(function(e){console.error(e)}).finally(function(){var e=i.localStorage.getItem("motion2.home.chat:"+m.user.id);if(e)try{(e=JSON.parse(e)).query&&(m.query=_.merge(m.query,e.query),m.query=_.omit(m.query,"filter"),m.query.sort&&0<=m.query.sort.indexOf("lastMessage")&&(m.query=_.omit(m.query,"sort")),m.query.includeAll=!0)}catch(e){console.error(e)}l.on("chatInteraction:save",m.onChatInteractionSave),l.on("chatInteraction:update",m.onChatInteractionSave),l.on("chatInteractionTags:save",m.onChatInteractionTagsSave),l.on("chatMessage:save",m.onChatMessageSave),l.on("chatMessage:update",m.onChatMessageSave),l.on("user_has_chat_interactions:save",m.onChatInteractionOpen),l.on("user_has_chat_interactions:remove",m.onChatInteractionClose),m.getChatInteractions()})},m.onChatInteractionSave=function(e){if(e){var t=_.find(m.chatInteractions.rows,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):p(),g(e)}},m.onChatInteractionTagsSave=function(e){if(e){var t=_.find(m.chatInteractions.rows,{id:e.id});t&&(t.Tags=e.tags||[],_.merge(t,_.pick(e,_.keys(t))))}},m.onChatMessageSave=function(e){if(e&&!e.secret){var t=_.find(m.chatInteractions.rows,{id:e.ChatInteractionId});if(t){var n=_.find(t.Messages,{id:e.id});n?_.merge(n,_.pick(e,_.keys(n))):(_.isNil(t.Messages)&&(t.Messages=[]),t.Messages.push(e)),g(t)}}},m.onChatInteractionOpen=function(e){var t=_.find(m.chatInteractions.rows,{id:e.ChatInteractionId});t&&t.Users&&(_.find(t.Users,{id:e.UserId})||t.Users.push({id:e.UserId}))},m.onChatInteractionClose=function(e){var t=_.find(m.chatInteractions.rows,{id:e.ChatInteractionId});t&&t.Users&&_.remove(t.Users,{id:e.UserId})},m.localizationMap=c,m.pickerModel={dateStart:null};var v=!0,h=1;n.$watch("vm.query.filter",function(e,t){v?a(function(){v=!1}):(t||(h=m.query.page),e!==t&&(m.query.page=1),e||(m.query.page=h),m.getChatInteractions())}),n.$on("$destroy",function(){l.removeAllListeners("chatMessage:save"),l.removeAllListeners("chatMessage:update"),l.removeAllListeners("chatInteraction:save"),l.removeAllListeners("chatInteractionTags:save"),l.removeAllListeners("chatInteraction:update"),l.removeAllListeners("user_has_chat_interactions:save"),l.removeAllListeners("user_has_chat_interactions:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty","dateFilterLocalizationFactory"],angular.module("app.dashboards").controller("AgentHomeChatController",e)}(),function(){"use strict";function e(n,t,a,i,e,s,o,r){var l=this;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.getContacts=function(){l.query.ListId=l.getListId(),l.query.offset=(l.query.page-1)*l.query.limit,r.localStorage.setItem("motion2.home.contacts:"+l.currentUser.id,JSON.stringify({query:l.query})),l.promise=o.cmContact.get(l.query,m).$promise},l.refreshContacts=function(){l.getContacts()},l.mergeContact=function(e,t){i.show({controller:"MergeContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/merge/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:t.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,t){i.show({controller:"DuplicateContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:t.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){t.$parent.vm.addContactTab(e)})},l.call=t.$parent.vm.call,l.onInit=u,l.getListId=function(){var e=_.toString(l.query.ListId);if(e){var t=e.split(","),n=l.defaultLists.split(",");_.isEqual(t,n)||(1<t.length?e=l.defaultLists:_.indexOf(n,t[0])<0&&(e=l.defaultLists))}else e=l.defaultLists;return e},u();var d=!0,c=1;function m(e){l.contacts=e||{count:0,rows:[]}}function u(){var e=r.localStorage.getItem("motion2.home.contacts:"+l.currentUser.id);e&&(e=JSON.parse(e))&&e.query&&(l.query=_.merge(l.query,e.query),l.query=_.omit(l.query,"filter")),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"),l.defaultLists=l.lists.rows?_.map(l.lists.rows,"id").join(","):void 0,o.tag.get().$promise}).then(function(e){l.tags=e||{count:0,rows:[]}}).catch(function(e){console.error(e)}).finally(function(){l.getContacts()})}t.$watch("vm.query.filter",function(e,t){d?a(function(){d=!1}):(t||(c=l.query.page),e!==t&&(l.query.page=1),e||(l.query.page=c),l.getContacts())})}e.$inject=["$document","$scope","$timeout","$mdDialog","$stateParams","Auth","api","$window"],angular.module("app.dashboards").controller("AgentHomeContactsController",e)}(),function(){"use strict";function e(e,t){var n=t(function(){},999);e.$on("$destroy",function(){n&&(t.cancel(n),n=null)})}e.$inject=["$scope","$interval"],angular.module("app.dashboards").controller("AgentHomeDashboardController",e)}(),function(){"use strict";function e(e,n,t,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,t){c.rpcVoiceQueues[t]&&(c.voiceQueues[t].waiting=c.rpcVoiceQueues[t].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,t){p?n(function(){p=!1}):(t||(g=c.query.page),e!==t&&(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,n,t,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,t){c.rpcChatQueues[t]&&(c.chatQueues[t].waiting=c.rpcChatQueues[t].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"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.onSaveVoiceQueue),l.onWithoutApply("chatQueue:update",c.onUpdateVoiceQueue),l.onWithoutApply("chatQueue:remove",c.onRemoveVoiceQueue),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 t=_.filter(e.rows,function(e){return _.includes(c.myQueues,{id:e.queue_id})});e.rows=t,e.count=t.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,t){h?n(function(){h=!1}):(t||(f=c.query.page),e!==t&&(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,n,t,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,t){c.rpcFaxQueues[t]&&(c.faxQueues[t].waiting=c.rpcFaxQueues[t].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"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.onSaveVoiceQueue),l.onWithoutApply("faxQueue:update",c.onUpdateVoiceQueue),l.onWithoutApply("faxQueue:remove",c.onRemoveVoiceQueue),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 t=_.filter(e.rows,function(e){return _.includes(c.myQueues,{id:e.queue_id})});e.rows=t,e.count=t.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,t){h?n(function(){h=!1}):(t||(f=c.query.page),e!==t&&(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,n,t,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,t){c.rpcMailQueues[t]&&(c.mailQueues[t].waiting=c.rpcMailQueues[t].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"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.onSaveVoiceQueue),l.onWithoutApply("mailQueue:update",c.onUpdateVoiceQueue),l.onWithoutApply("mailQueue:remove",c.onRemoveVoiceQueue),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 t=_.filter(e.rows,function(e){return _.includes(c.myQueues,{id:e.queue_id})});e.rows=t,e.count=t.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,t){h?n(function(){h=!1}):(t||(f=c.query.page),e!==t&&(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,n,t,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,t){c.rpcOpenchannelQueues[t]&&(c.openchannelQueues[t].waiting=c.rpcOpenchannelQueues[t].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"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.onSaveVoiceQueue),l.onWithoutApply("openchannelQueue:update",c.onUpdateVoiceQueue),l.onWithoutApply("openchannelQueue:remove",c.onRemoveVoiceQueue),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 t=_.filter(e.rows,function(e){return _.includes(c.myQueues,{id:e.queue_id})});e.rows=t,e.count=t.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,t){h?n(function(){h=!1}):(t||(f=c.query.page),e!==t&&(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,n,t,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,t){c.rpcSmsQueues[t]&&(c.smsQueues[t].waiting=c.rpcSmsQueues[t].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"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.onSaveVoiceQueue),l.onWithoutApply("smsQueue:update",c.onUpdateVoiceQueue),l.onWithoutApply("smsQueue:remove",c.onRemoveVoiceQueue),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 t=_.filter(e.rows,function(e){return _.includes(c.myQueues,{id:e.queue_id})});e.rows=t,e.count=t.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,t){h?n(function(){h=!1}):(t||(f=c.query.page),e!==t&&(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,n,t,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,t){c.rpcVoiceQueues[t]&&(c.voiceQueues[t].waiting=c.rpcVoiceQueues[t].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:"inbound",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){"inbound"===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.user.getQueues(c.query).$promise.then(function(e){return c.myQueues=e,o.rpc.getVoiceQueues().$promise}).then(function(e){for(var t=e.rows,n=_.keyBy(t,"id"),a=0;a<c.myQueues.count;a++){var i=c.myQueues.rows[a];c.rpcVoiceQueues[i.id]=n[i.id]}return o.rpc.getVoiceQueuesChannels().$promise}).then(function(e){c.rpcVoiceQueuesChannels=e?_.keyBy(e.rows?_.filter(e.rows,function(e){return!("inbound"!==e.type||e.queuecallerleaveAt||!_.find(c.myQueues.rows,{name:e.queue}))}):[],"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,t){p?n(function(){p=!1}):(t||(g=c.query.page),e!==t&&(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("AgentHomeDashboardVoiceController",e)}(),function(){"use strict";function e(n,a,i,s,o,r,l,t,d,c,e){var m=this;function u(e){m.faxInteractions=e||{count:0,rows:[]};for(var t=0;t<m.faxInteractions.rows.length;t+=1)g(m.faxInteractions.rows[t])}function p(){if(m.pickerModel.dateStart){var e=moment(m.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format();m.query.createdAt={$gte:m.pickerModel.dateStart,$lte:e}}else m.query.createdAt=void 0;m.faxAccounts.rows.length?(_.includes(_.map(m.faxAccounts.rows,"id"),m.query.account)||(m.query.account=null),m.query.FaxAccountId=m.query.account||_.map(m.faxAccounts.rows,"id").join()):m.query.FaxAccountId=-1,m.query.offset=(m.query.page-1)*m.query.limit,o.localStorage.setItem("motion2.home.fax:"+m.user.id,JSON.stringify({query:m.query})),m.promise=l.faxInteraction.get(m.query,u).$promise}function g(e){e&&e.Messages?e.unread=_.filter(e.Messages||[],{direction:"in",read:!1}).length:e.unread=0}m.user=t.getCurrentUser(),m.license={},m.setting={},m.tags={count:0,rows:[]},m.faxInteractions={count:0,rows:[]},m.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,account:null},m.success=u,m.getFaxInteractions=p,m.showFaxInteraction=function(e,t){n.$parent.vm.addInteractionTab("fax",t)},m.downloadFaxInteraction=function(e,s,t){l.faxInteraction.download({id:s.id,attachments:t}).$promise.then(function(e){var t=[e.buffer],n="fax-interaction"+s.id+".zip",a=new Blob(t,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadFaxInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.getContactLabel=function(e){if(e.Contact){var t="";return t+=(e.Contact.firstName||"")+""+(e.Contact.lastName||""),t+=" <"+(e.Contact.fax||"unknown")+">"}return r.instant("DASHBOARDS.UNKNOWN")},m.getUserLabel=function(e){if(e.UserId)return e.UserId===t.getCurrentUser().id?r.instant("DASHBOARDS.ME"):m.usersByKey[e.UserId].fullname+" <"+m.usersByKey[e.UserId].internal+">";return r.instant("DASHBOARDS.NOT_ASSIGNED")},m.getFaxAccountLabel=function(e){if(e.Account)return e.Account.key;return r.instant("DASHBOARDS.UNKNOWN")},m.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},m.clearAll=function(){m.calendarModel={dateStart:null},m.pickerModel={dateStart:null},m.serviceModel={dateStart:null},m.getFaxInteractions()},m.composeFaxInteraction=function(e,t){i.show({controller:"ComposeFaxInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/composeFax/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{account:t,message:{},type:"new",interaction:{}},fullscreen:!0}).then(function(e){return l.faxAccount.send({id:t.id},e).$promise.then(function(e){c.success({title:"Message properly sent!",msg:"Message has been sent!"}),n.$parent.vm.addInteractionTab("fax",e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t++)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else c.error({title:"FAX:SEND",msg:e.data?JSON.stringify(e.data):e.message||e.toString()})})})},m.onInit=function(e,t){return m.license=e,m.setting=t,l.user["get"+_.upperFirst("faxAccounts")]({id:m.user.id,nolimit:!0}).$promise.then(function(e){return m.faxAccounts=e||{count:0,rows:[]},l.tag.get().$promise}).then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){return l.user.get({nolimit:!0,fields:"id,fullname,userpic,internal"}).$promise}).then(function(e){m.usersByKey=_.keyBy(e.rows,"id")}).catch(function(e){console.error(e)}).finally(function(){var e=o.localStorage.getItem("motion2.home.fax:"+m.user.id);if(e)try{(e=JSON.parse(e)).query&&(m.query=_.merge(m.query,e.query),m.query=_.omit(m.query,"filter"),m.query.sort&&0<=m.query.sort.indexOf("lastMessage")&&(m.query=_.omit(m.query,"sort")),m.query.includeAll=!0)}catch(e){console.error(e)}d.on("faxInteraction:save",m.onFaxInteractionSave),d.on("faxInteraction:update",m.onFaxInteractionSave),d.on("faxInteractionTags:save",m.onFaxInteractionTagsSave),d.on("faxMessage:save",m.onFaxMessageSave),d.on("faxMessage:update",m.onFaxMessageSave),d.on("user_has_fax_interactions:save",m.onFaxInteractionOpen),d.on("user_has_fax_interactions:remove",m.onFaxInteractionClose),m.getFaxInteractions()})},m.onFaxInteractionSave=function(e){if(e){var t=_.find(m.faxInteractions.rows,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):p(),g(e)}},m.onFaxInteractionTagsSave=function(e){if(e){var t=_.find(m.faxInteractions.rows,{id:e.id});t&&(t.Tags=e.tags||[],_.merge(t,_.pick(e,_.keys(t))))}},m.onFaxMessageSave=function(e){if(e&&!e.secret){var t=_.find(m.faxInteractions.rows,{id:e.FaxInteractionId});if(t){var n=_.find(t.Messages,{id:e.id});n?_.merge(n,_.pick(e,_.keys(n))):(_.isNil(t.Messages)&&(t.Messages=[]),t.Messages.push(e)),g(t)}}},m.onFaxInteractionOpen=function(e){var t=_.find(m.faxInteractions.rows,{id:e.FaxInteractionId});t&&t.Users&&(_.find(t.Users,{id:e.UserId})||t.Users.push({id:e.UserId}))},m.onFaxInteractionClose=function(e){var t=_.find(m.faxInteractions.rows,{id:e.FaxInteractionId});t&&t.Users&&_.remove(t.Users,{id:e.UserId})},m.localizationMap=e,m.pickerModel={dateStart:null};var v=!0,h=1;n.$watch("vm.query.filter",function(e,t){v?a(function(){v=!1}):(t||(h=m.query.page),e!==t&&(m.query.page=1),e||(m.query.page=h),m.getFaxInteractions())}),n.$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")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty","dateFilterLocalizationFactory"],angular.module("app.dashboards").controller("AgentHomeFaxController",e)}(),function(){"use strict";function e(a,n,i,s,o,r,l,t,d,c,e){var m=this;function u(e){m.mailInteractions=e||{count:0,rows:[]};for(var t=0;t<m.mailInteractions.rows.length;t+=1)g(m.mailInteractions.rows[t])}function p(){if(m.pickerModel.dateStart){var e=moment(m.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format();m.query.createdAt={$gte:m.pickerModel.dateStart,$lte:e}}else m.query.createdAt=void 0;m.mailAccounts.rows.length?(_.includes(_.map(m.mailAccounts.rows,"id"),m.query.account)||(m.query.account=null),m.query.MailAccountId=m.query.account||_.map(m.mailAccounts.rows,"id").join()):m.query.MailAccountId=-1,m.query.offset=(m.query.page-1)*m.query.limit,o.localStorage.setItem("motion2.home.mail:"+m.user.id,JSON.stringify({query:m.query})),m.promise=l.mailInteraction.get(m.query,u).$promise}function g(e){e&&e.Messages?e.unread=_.filter(e.Messages||[],{direction:"in",read:!1}).length:e.unread=0}m.user=t.getCurrentUser(),m.license={},m.setting={},m.tags={count:0,rows:[]},m.mailInteractions={count:0,rows:[]},m.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,account:null},m.success=u,m.getMailInteractions=p,m.showMailInteraction=function(e,t){a.$parent.vm.addInteractionTab("mail",t)},m.downloadMailInteraction=function(e,s,t){l.mailInteraction.download({id:s.id,attachments:t}).$promise.then(function(e){var t=[e.buffer],n="mail-interaction"+s.id+".zip",a=new Blob(t,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadMailInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.getContactLabel=function(e){if(e.Contact){var t="";return t+=(e.Contact.firstName||"")+""+(e.Contact.lastName||""),e.to&&e.Account&&e.to.indexOf(e.Account.email)<0?t=e.to:t+=" <"+(e.Contact.email||"unknown")+">",t}return r.instant("DASHBOARDS.UNKNOWN")},m.getUserLabel=function(e){if(e.UserId)return e.UserId===t.getCurrentUser().id?r.instant("DASHBOARDS.ME"):m.usersByKey[e.UserId].fullname+" <"+m.usersByKey[e.UserId].internal+">";return r.instant("DASHBOARDS.NOT_ASSIGNED")},m.getMailAccountLabel=function(e){if(e.Account)return e.Account.key;return r.instant("DASHBOARDS.UNKNOWN")},m.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},m.clearAll=function(){m.calendarModel={dateStart:null},m.pickerModel={dateStart:null},m.serviceModel={dateStart:null},m.getMailInteractions()},m.composeMailInteraction=function(e,t){i.show({controller:"ComposeMailInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/composeMail/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{account:t,message:{},type:"new",interaction:{}},fullscreen:!0}).then(function(n){return l.mailAccount.send({id:t.id},n).$promise.then(function(e){if(e&&e.Messages&&e.Messages.length){if(n.attachments&&n.attachments.length)for(var t=0;t<n.attachments.length;t+=1)l.attachment.update({id:n.attachments[t].id},{MailMessageId:_.head(e.Messages).id});c.success({title:"Message properly sent!",msg:"Message has been sent!"}),e.closed?(e.disposition=null,i.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!0,locals:{user:m.user,channel:"mail",interaction:e}})):a.$parent.vm.addInteractionTab("mail",e)}}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t++)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})})})},m.onInit=function(e,t){return m.license=e,m.setting=t,l.user["get"+_.upperFirst("mailAccounts")]({id:m.user.id,nolimit:!0}).$promise.then(function(e){return m.mailAccounts=e||{count:0,rows:[]},l.tag.get().$promise}).then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){return l.user.get({nolimit:!0,fields:"id,fullname,userpic,internal"}).$promise}).then(function(e){m.usersByKey=_.keyBy(e.rows,"id")}).then(function(){return l.mailSubstatus.get({nolimit:!0}).$promise}).then(function(e){m.subStatuses=e||{count:0,rows:[]}}).catch(function(e){console.error(e)}).finally(function(){var e=o.localStorage.getItem("motion2.home.mail:"+m.user.id);if(e)try{(e=JSON.parse(e)).query&&(m.query=_.merge(m.query,e.query),m.query=_.omit(m.query,"filter"),m.query.sort&&0<=m.query.sort.indexOf("lastMessage")&&(m.query=_.omit(m.query,"sort")),m.query.includeAll=!0)}catch(e){console.error(e)}d.on("mailInteraction:save",m.onMailInteractionSave),d.on("mailInteraction:update",m.onMailInteractionSave),d.on("mailInteractionTags:save",m.onMailInteractionTagsSave),d.on("mailMessage:save",m.onMailMessageSave),d.on("mailMessage:update",m.onMailMessageSave),d.on("user_has_mail_interactions:save",m.onMailInteractionOpen),d.on("user_has_mail_interactions:remove",m.onMailInteractionClose),m.getMailInteractions()})},m.onMailInteractionSave=function(e){if(e){var t=_.find(m.mailInteractions.rows,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):p(),g(e)}},m.onMailInteractionTagsSave=function(e){if(e){var t=_.find(m.mailInteractions.rows,{id:e.id});t&&(t.Tags=e.tags||[],_.merge(t,_.pick(e,_.keys(t))))}},m.onMailMessageSave=function(e){if(e&&!e.secret){var t=_.find(m.mailInteractions.rows,{id:e.MailInteractionId});if(t){var n=_.find(t.Messages,{id:e.id});n?_.merge(n,_.pick(e,_.keys(n))):(_.isNil(t.Messages)&&(t.Messages=[]),t.Messages.push(e)),g(t)}}},m.onMailInteractionOpen=function(e){var t=_.find(m.mailInteractions.rows,{id:e.MailInteractionId});t&&t.Users&&(_.find(t.Users,{id:e.UserId})||t.Users.push({id:e.UserId}))},m.onMailInteractionClose=function(e){var t=_.find(m.mailInteractions.rows,{id:e.MailInteractionId});t&&t.Users&&_.remove(t.Users,{id:e.UserId})},m.localizationMap=e,m.pickerModel={dateStart:null};var v=!0,h=1;a.$watch("vm.query.filter",function(e,t){v?n(function(){v=!1}):(t||(h=m.query.page),e!==t&&(m.query.page=1),e||(m.query.page=h),m.getMailInteractions())}),a.$on("$destroy",function(){d.removeAllListeners("mailMessage:save"),d.removeAllListeners("mailMessage:update"),d.removeAllListeners("mailInteraction:save"),d.removeAllListeners("mailInteractionTags:save"),d.removeAllListeners("mailInteraction:update"),d.removeAllListeners("user_has_mail_interactions:save"),d.removeAllListeners("user_has_mail_interactions:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty","dateFilterLocalizationFactory"],angular.module("app.dashboards").controller("AgentHomeMailController",e)}(),function(){"use strict";function e(n,a,i,s,e,t,o){var r=this;r.currentUser=e.getCurrentUser(),r.lists={},r.contacts={count:0,rows:[]},r.tags={count:0,rows:[]},r.query={includeAll:!0,id:r.currentUser.id,sort:"-updatedAt",limit:10,page:1},r.getContacts=function(){r.query.ListId=r.getListId(),r.query.offset=(r.query.page-1)*r.query.limit,o.localStorage.setItem("motion2.home.mycontacts:"+r.currentUser.id,JSON.stringify({query:r.query})),r.promise=t.user.getContacts(r.query,c).$promise},r.refreshContacts=function(){r.getContacts()},r.mergeContact=function(e,t){s.show({controller:"MergeContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/merge/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:t.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:r.currentUser.id,fields:"id,name"})}]},locals:{contacts:r.contacts.rows}})},r.duplicateContact=function(e,t){s.show({controller:"DuplicateContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:t.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:r.currentUser.id,fields:"id,name"})}]},locals:{contacts:r.contacts.rows}})},r.openContact=function(e,t){a.$parent.vm.addContactTab(t)},r.call=a.$parent.vm.call,r.onInit=function(){var e=o.localStorage.getItem("motion2.home.mycontacts:"+r.currentUser.id);if(e)try{(e=JSON.parse(e)).query&&(r.query=_.omit(e.query,"filter"))}catch(e){console.error(e)}t.cmList.get({fields:"id,name,dialPrefix",sort:"name",nolimit:!0}).$promise.then(function(e){return r.lists=e||{count:0,rows:[]},r.listsMap=_.keyBy(r.lists.rows,"id"),r.defaultLists=r.lists.rows?_.map(r.lists.rows,"id").join(","):void 0,t.tag.get().$promise}).then(function(e){r.tags=e||{count:0,rows:[]}}).catch(function(e){console.error(e)}).finally(function(){r.getContacts()})},r.getListId=function(){var e=_.toString(r.query.ListId);if(e){var t=e.split(","),n=r.defaultLists.split(",");_.isEqual(t,n)||(1<t.length?e=r.defaultLists:_.indexOf(n,t[0])<0&&(e=r.defaultLists))}else e=r.defaultLists;return e};var l=!0,d=1;function c(e){r.contacts=e||{count:0,rows:[]}}a.$watch("vm.query.filter",function(e,t){l?i(function(){l=!1}):(t||(d=r.query.page),e!==t&&(r.query.page=1),e||(r.query.page=d),r.getContacts())})}e.$inject=["$document","$scope","$timeout","$mdDialog","Auth","api","$window"],angular.module("app.dashboards").controller("AgentHomeMyContactsController",e)}(),function(){"use strict";function e(n,a,i,s,o,r,l,t,d,c,e){var m=this;function u(e){m.openchannelInteractions=e||{count:0,rows:[]};for(var t=0;t<m.openchannelInteractions.rows.length;t+=1)g(m.openchannelInteractions.rows[t])}function p(){if(m.pickerModel.dateStart){var e=moment(m.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format();m.query.createdAt={$gte:m.pickerModel.dateStart,$lte:e}}else m.query.createdAt=void 0;m.openchannelAccounts.rows.length?(_.includes(_.map(m.openchannelAccounts.rows,"id"),m.query.account)||(m.query.account=null),m.query.OpenchannelAccountId=m.query.account||_.map(m.openchannelAccounts.rows,"id").join()):m.query.OpenchannelAccountId=-1,m.query.offset=(m.query.page-1)*m.query.limit,o.localStorage.setItem("motion2.home.openchannel:"+m.user.id,JSON.stringify({query:m.query})),m.promise=l.openchannelInteraction.get(m.query,u).$promise}function g(e){e&&e.Messages?e.unread=_.filter(e.Messages||[],{direction:"in",read:!1}).length:e.unread=0}m.user=t.getCurrentUser(),m.license={},m.setting={},m.tags={count:0,rows:[]},m.openchannelInteractions={count:0,rows:[]},m.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,account:null},m.success=u,m.getOpenchannelInteractions=p,m.showOpenchannelInteraction=function(e,t){n.$parent.vm.addInteractionTab("openchannel",t)},m.downloadOpenchannelInteraction=function(e,s,t){l.openchannelInteraction.download({id:s.id,attachments:t}).$promise.then(function(e){var t=[e.buffer],n="openchannel-interaction"+s.id+".zip",a=new Blob(t,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadOpenchannelInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.getContactLabel=function(e){if(e.Contact){var t="";return t+=(e.Contact.firstName||"")+""+(e.Contact.lastName||""),e.from&&(t=e.from),t}return r.instant("DASHBOARDS.UNKNOWN")},m.getUserLabel=function(e){if(e.UserId)return e.UserId===t.getCurrentUser().id?r.instant("DASHBOARDS.ME"):m.usersByKey[e.UserId].fullname+" <"+m.usersByKey[e.UserId].internal+">";return r.instant("DASHBOARDS.NOT_ASSIGNED")},m.getOpenchannelAccountLabel=function(e){if(e.Account)return e.Account.key;return r.instant("DASHBOARDS.UNKNOWN")},m.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},m.clearAll=function(){m.calendarModel={dateStart:null},m.pickerModel={dateStart:null},m.serviceModel={dateStart:null},m.getOpenchannelInteractions()},m.composeOpenchannelInteraction=function(e,t){i.show({controller:"ComposeOpenchannelInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/composeOpenchannel/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{account:t,message:{},type:"new",interaction:{}},fullscreen:!0}).then(function(e){return l.openchannelAccount.send({id:t.id},e).$promise.then(function(e){c.success({title:"Message properly sent!",msg:"Message has been sent!"}),n.$parent.vm.addInteractionTab("openchannel",e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t++)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})})})},m.onInit=function(e,t){return m.license=e,m.setting=t,l.user["get"+_.upperFirst("openchannelAccounts")]({id:m.user.id,nolimit:!0}).$promise.then(function(e){return m.openchannelAccounts=e||{count:0,rows:[]},l.tag.get().$promise}).then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){return l.user.get({nolimit:!0,fields:"id,fullname,userpic,internal"}).$promise}).then(function(e){m.usersByKey=_.keyBy(e.rows,"id")}).catch(function(e){console.error(e)}).finally(function(){var e=o.localStorage.getItem("motion2.home.openchannel:"+m.user.id);if(e)try{(e=JSON.parse(e)).query&&(m.query=_.merge(m.query,e.query),m.query=_.omit(m.query,"filter"),m.query.sort&&0<=m.query.sort.indexOf("lastMessage")&&(m.query=_.omit(m.query,"sort")),m.query.includeAll=!0)}catch(e){console.error(e)}d.on("openchannelInteraction:save",m.onOpenchannelInteractionSave),d.on("openchannelInteraction:update",m.onOpenchannelInteractionSave),d.on("openchannelInteractionTags:save",m.onOpenchannelInteractionTagsSave),d.on("openchannelMessage:save",m.onOpenchannelMessageSave),d.on("openchannelMessage:update",m.onOpenchannelMessageSave),d.on("user_has_openchannel_interactions:save",m.onOpenchannelInteractionOpen),d.on("user_has_openchannel_interactions:remove",m.onOpenchannelInteractionClose),m.getOpenchannelInteractions()})},m.onOpenchannelInteractionSave=function(e){if(e){var t=_.find(m.openchannelInteractions.rows,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):p(),g(e)}},m.onOpenchannelInteractionTagsSave=function(e){if(e){var t=_.find(m.openchannelInteractions.rows,{id:e.id});t&&(t.Tags=e.tags||[],_.merge(t,_.pick(e,_.keys(t))))}},m.onOpenchannelMessageSave=function(e){if(e&&!e.secret){var t=_.find(m.openchannelInteractions.rows,{id:e.OpenchannelInteractionId});if(t){var n=_.find(t.Messages,{id:e.id});n?_.merge(n,_.pick(e,_.keys(n))):(_.isNil(t.Messages)&&(t.Messages=[]),t.Messages.push(e)),g(t)}}},m.onOpenchannelInteractionOpen=function(e){var t=_.find(m.openchannelInteractions.rows,{id:e.OpenchannelInteractionId});t&&t.Users&&(_.find(t.Users,{id:e.UserId})||t.Users.push({id:e.UserId}))},m.onOpenchannelInteractionClose=function(e){var t=_.find(m.openchannelInteractions.rows,{id:e.OpenchannelInteractionId});t&&t.Users&&_.remove(t.Users,{id:e.UserId})},m.localizationMap=e,m.pickerModel={dateStart:null};var v=!0,h=1;n.$watch("vm.query.filter",function(e,t){v?a(function(){v=!1}):(t||(h=m.query.page),e!==t&&(m.query.page=1),e||(m.query.page=h),m.getOpenchannelInteractions())}),n.$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")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty","dateFilterLocalizationFactory"],angular.module("app.dashboards").controller("AgentHomeOpenchannelController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l){var d=this;function c(e,t,n){d.license=e,d.setting=t,d.plugin=n}d.currentUser=o.getCurrentUser(),d.plugin={},d.onInit=c,d.getTrustedURL=function(){return s.trustAsResourceUrl(d.plugin.agentUrl)},c(),t.$on("pluginUpdated",function(e,t){d.plugin=t.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,t,n,a,i,s,o,r,l,d,c,m,u){var p=this;function g(e){p.voiceRecordings=e||{count:0,rows:[]}}p.currentUser=c.getCurrentUser(),p.voiceRecordings={},p.localizationMap=u,p.pickerModel={dateStart:null},p.table="voiceRecordings",p.query={UserId:p.currentUser.id,fields:"createdAt,updatedAt,id,format,value,type,uniqueid,calleridnum,exten,connectedlinenum,queue,rating,audio,UserId",sort:"-updatedAt",limit:10,page:1,type:null},p.downloadfile=function(i,e){return r.voiceRecording.download({id:i.id,exists:!0}).$promise.then(function(e){var t=[e.buffer],n=new Blob(t,{type:e.type}),a=window.document.createElement("a");a.setAttribute("href",URL.createObjectURL(n)),a.setAttribute("download",i.uniqueid+i.format),a.click()}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceRecording",msg:e.data?JSON.stringify(e.data):e.toString()})})},p.success=g,p.getVoiceRecordings=function(){if(p.pickerModel.dateStart){var e=moment(p.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format();p.query.createdAt={$gte:p.pickerModel.dateStart,$lte:e}}else p.query.createdAt=void 0;p.query.offset=(p.query.page-1)*p.query.limit,t.localStorage.setItem("motion2.home.recordings:"+p.currentUser.id,JSON.stringify({query:p.query})),p.promise=r.voiceRecording.get(p.query,g).$promise},p.onInit=function(){var e=t.localStorage.getItem("motion2.home.recordings:"+p.currentUser.id);if(e)try{(e=JSON.parse(e)).query&&(p.query=_.omit(e.query,["filter","id"]),p.query.fields="createdAt,updatedAt,id,format,value,type,uniqueid,calleridnum,exten,connectedlinenum,queue,rating,audio,UserId",p.query.UserId=p.currentUser.id)}catch(e){console.error(e)}p.getVoiceRecordings()},p.clearAll=function(){p.pickerModel={dateStart:null},p.getVoiceRecordings()};var v=!0,h=1;e.$watch("vm.query.filter",function(e,t){v?o(function(){v=!1}):(t||(h=p.query.page),e!==t&&(p.query.page=1),e||(p.query.page=h),p.getVoiceRecordings())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","api","msUtils","toasty","Auth","$translate","dateFilterLocalizationFactory"],angular.module("app.dashboards").controller("AgentHomeRecordingsController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l){var d=this;function c(e){d.scheduledCalls=e||{count:0,rows:[]}}d.currentUser=r.getCurrentUser(),d.priorities=["Lowest","Low","Medium","High","Highest"],d.localizationMap=l,d.pickerModel={dateStart:null},d.scheduledCalls={},d.query={id:d.currentUser.id,fields:"id,phone,scheduledat,recallme,priority,UserId,OwnerId",sort:"scheduledat",limit:10,page:1},d.queueCampaigns={rows:[],count:0},d.success=c,d.getScheduledCalls=function(){if(d.pickerModel.dateStart){var e=moment(d.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format();d.query.scheduledat={$gte:d.pickerModel.dateStart,$lte:e}}else d.query.createdAt=void 0;d.query.id=d.currentUser.id,d.query.includeAll=!0,d.query.offset=(d.query.page-1)*d.query.limit,t.localStorage.setItem("motion2.home.scheduled:"+d.currentUser.id,JSON.stringify({query:d.query})),d.promise=o.user.getScheduledCalls(d.query,c).$promise},d.onInit=function(){var e=t.localStorage.getItem("motion2.home.scheduled:"+d.currentUser.id);if(e)try{(e=JSON.parse(e)).query&&(d.query=_.omit(e.query,["filter"]))}catch(e){console.error(e)}o.user.getQueues({id:r.getCurrentUser().id,fields:"id,name",channel:"voice",type:"outbound",nolimit:!0}).$promise.then(function(e){d.queueCampaigns=e||{count:0,rows:[]}}).catch(function(e){console.error(e)}).finally(function(){d.getScheduledCalls()})},d.clearAll=function(){d.pickerModel={dateStart:null},d.getScheduledCalls()},d.isDateBeforeToday=function(e){return moment(e).isBefore(moment())},d.createOrEditQueueCampaignHopper=function(e,t){a.show({controller:"CreateOrEditHopperVoiceQueueIdDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hoppers/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:null,hopper:t,hoppers:d.scheduledCalls.rows,license:null,setting:null}})},d.deleteConfirm=function(t,e){var n=a.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");a.show(n).then(function(){var e;e=t,o.cmHopper.delete({id:e.id}).$promise.then(function(){_.remove(d.scheduledCalls.rows,{id:e.id}),d.scheduledCalls.count-=1,d.scheduledCalls.rows.length||d.getScheduledCalls(),s.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){d.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETE_HOPPER"}];for(var t=0;t<e.data.errors.length;t++)s.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else s.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 m=!0,u=1;e.$watch("vm.query.filter",function(e,t){m?n(function(){m=!1}):(t||(u=d.query.page),e!==t&&(d.query.page=1),e||(d.query.page=u),d.getScheduledCalls())})}e.$inject=["$scope","$window","$timeout","$mdDialog","$document","toasty","api","Auth","dateFilterLocalizationFactory"],angular.module("app.dashboards").controller("AgentHomeScheduledCallsController",e)}(),function(){"use strict";function e(n,a,i,s,o,r,l,t,d,c,e){var m=this;function u(e){m.smsInteractions=e||{count:0,rows:[]};for(var t=0;t<m.smsInteractions.rows.length;t+=1)g(m.smsInteractions.rows[t])}function p(){if(m.pickerModel.dateStart){var e=moment(m.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format();m.query.createdAt={$gte:m.pickerModel.dateStart,$lte:e}}else m.query.createdAt=void 0;m.smsAccounts.rows.length?(_.includes(_.map(m.smsAccounts.rows,"id"),m.query.account)||(m.query.account=null),m.query.SmsAccountId=m.query.account||_.map(m.smsAccounts.rows,"id").join()):m.query.SmsAccountId=-1,m.query.offset=(m.query.page-1)*m.query.limit,o.localStorage.setItem("motion2.home.sms:"+m.user.id,JSON.stringify({query:m.query})),m.promise=l.smsInteraction.get(m.query,u).$promise}function g(e){e&&e.Messages?e.unread=_.filter(e.Messages||[],{direction:"in",read:!1}).length:e.unread=0}m.user=t.getCurrentUser(),m.license={},m.setting={},m.tags={count:0,rows:[]},m.smsInteractions={count:0,rows:[]},m.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,account:null},m.success=u,m.getSmsInteractions=p,m.showSmsInteraction=function(e,t){n.$parent.vm.addInteractionTab("sms",t)},m.downloadSmsInteraction=function(e,s,t){l.smsInteraction.download({id:s.id,attachments:t}).$promise.then(function(e){var t=[e.buffer],n="sms-interaction"+s.id+".zip",a=new Blob(t,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadSmsInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.getContactLabel=function(e){if(e.Contact){var t="";return t+=(e.Contact.firstName||"")+""+(e.Contact.lastName||""),t+=" <"+(e.Contact.mobile||"unknown")+">"}return r.instant("DASHBOARDS.UNKNOWN")},m.getUserLabel=function(e){if(e.UserId)return e.UserId===t.getCurrentUser().id?r.instant("DASHBOARDS.ME"):m.usersByKey[e.UserId].fullname+" <"+m.usersByKey[e.UserId].internal+">";return r.instant("DASHBOARDS.NOT_ASSIGNED")},m.getSmsAccountLabel=function(e){if(e.Account)return e.Account.key;return r.instant("DASHBOARDS.UNKNOWN")},m.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},m.clearAll=function(){m.calendarModel={dateStart:null},m.pickerModel={dateStart:null},m.serviceModel={dateStart:null},m.getSmsInteractions()},m.composeSmsInteraction=function(e,t){i.show({controller:"ComposeSmsInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/composeSms/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{account:t,message:{},type:"new",interaction:{}},fullscreen:!0}).then(function(e){return l.smsAccount.send({id:t.id},e).$promise.then(function(e){c.success({title:"Message properly sent!",msg:"Message has been sent!"}),n.$parent.vm.addInteractionTab("sms",e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t++)c.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})})})},m.onInit=function(e,t){return m.license=e,m.setting=t,l.user["get"+_.upperFirst("smsAccounts")]({id:m.user.id,nolimit:!0}).$promise.then(function(e){return m.smsAccounts=e||{count:0,rows:[]},l.tag.get().$promise}).then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){return l.user.get({nolimit:!0,fields:"id,fullname,userpic,internal"}).$promise}).then(function(e){m.usersByKey=_.keyBy(e.rows,"id")}).catch(function(e){console.error(e)}).finally(function(){var e=o.localStorage.getItem("motion2.home.sms:"+m.user.id);if(e)try{(e=JSON.parse(e)).query&&(m.query=_.merge(m.query,e.query),m.query=_.omit(m.query,"filter"),m.query.sort&&0<=m.query.sort.indexOf("lastMessage")&&(m.query=_.omit(m.query,"sort")),m.query.includeAll=!0)}catch(e){console.error(e)}d.on("smsInteraction:save",m.onSmsInteractionSave),d.on("smsInteraction:update",m.onSmsInteractionSave),d.on("smsInteractionTags:save",m.onSmsInteractionTagsSave),d.on("smsMessage:save",m.onSmsMessageSave),d.on("smsMessage:update",m.onSmsMessageSave),d.on("user_has_sms_interactions:save",m.onSmsInteractionOpen),d.on("user_has_sms_interactions:remove",m.onSmsInteractionClose),m.getSmsInteractions()})},m.onSmsInteractionSave=function(e){if(e){var t=_.find(m.smsInteractions.rows,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):p(),g(e)}},m.onSmsInteractionTagsSave=function(e){if(e){var t=_.find(m.smsInteractions.rows,{id:e.id});t&&(t.Tags=e.tags||[],_.merge(t,_.pick(e,_.keys(t))))}},m.onSmsMessageSave=function(e){if(e&&!e.secret){var t=_.find(m.smsInteractions.rows,{id:e.SmsInteractionId});if(t){var n=_.find(t.Messages,{id:e.id});n?_.merge(n,_.pick(e,_.keys(n))):(_.isNil(t.Messages)&&(t.Messages=[]),t.Messages.push(e)),g(t)}}},m.onSmsInteractionOpen=function(e){var t=_.find(m.smsInteractions.rows,{id:e.SmsInteractionId});t&&t.Users&&(_.find(t.Users,{id:e.UserId})||t.Users.push({id:e.UserId}))},m.onSmsInteractionClose=function(e){var t=_.find(m.smsInteractions.rows,{id:e.SmsInteractionId});t&&t.Users&&_.remove(t.Users,{id:e.UserId})},m.localizationMap=e,m.pickerModel={dateStart:null};var v=!0,h=1;n.$watch("vm.query.filter",function(e,t){v?a(function(){v=!1}):(t||(h=m.query.page),e!==t&&(m.query.page=1),e||(m.query.page=h),m.getSmsInteractions())}),n.$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")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty","dateFilterLocalizationFactory"],angular.module("app.dashboards").controller("AgentHomeSmsController",e)}(),function(){"use strict";function e(t,n,a,i,e,s,o,r,l,d){var c=this;function m(e){c.voiceCalls=e||{count:0,rows:[]}}c.currentUser=e.getCurrentUser(),c.voiceCalls={},c.localizationMap=d,c.pickerModel={dateStart:null},c.table="voiceCalls",c.query={UserId:c.currentUser.id,fields:"id,type,uniqueid,tag,starttime,endtime,source,destination,userDisposition,note,duration,billableseconds,answertime",sort:"-updatedAt",limit:10,page:1,type:null},c.success=m,c.getVoiceCalls=function(){if(c.pickerModel.dateStart){var e=moment(c.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format();c.query.createdAt={$gte:c.pickerModel.dateStart,$lte:e}}else c.query.createdAt=void 0;c.query.offset=(c.query.page-1)*c.query.limit,o.localStorage.setItem("motion2.home.voice:"+c.currentUser.id,JSON.stringify({query:c.query})),c.promise=a.voiceCallReport.get(c.query,m).$promise},c.onInit=function(){return a.tag.get().$promise.then(function(e){c.tags=e||{count:0,rows:[]}}).catch(function(e){i.error({title:"Init error",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()}),c.tags={count:0,rows:[]}}).finally(function(){var e=o.localStorage.getItem("motion2.home.voice:"+c.currentUser.id);if(e)try{(e=JSON.parse(e)).query&&(c.query=_.omit(e.query,"filter"))}catch(e){console.error(e)}c.getVoiceCalls()})},c.showDetails=function(e){t.show({controller:"AgentHomeVoiceDetailsController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/home/voice/details/dialog.html",parent:angular.element(n.body),clickOutsideToClose:!0,locals:{call:e}})},c.clearAll=function(){c.pickerModel={dateStart:null},c.getVoiceCalls()};var u=!0,p=1;r.$watch("vm.query.filter",function(e,t){u?l(function(){u=!1}):(t||(p=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=p),c.getVoiceCalls())})}e.$inject=["$mdDialog","$document","api","toasty","Auth","$translate","$window","$scope","$timeout","dateFilterLocalizationFactory"],angular.module("app.dashboards").controller("AgentHomeVoiceController",e)}(),function(){"use strict";function e(e,t){this.call=t,this.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","call"],angular.module("app.dashboards").controller("AgentHomeVoiceDetailsController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u){var p=this,g=25,v=1024*g*1024;function h(){i.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(n.body),clickOutsideToClose:!0,locals:{user:p.user,channel:p.tab.channel,interaction:p.tab.interaction}}).then(function(e){p.tab.saved=Boolean(e),e&&a.$parent.$parent.$parent.vm.closeTab(p.tab)})}function f(e,t){p.tab.message||(p.tab.message=t),i.show({controller:"ComposeMailInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/composeMail/dialog.html",parent:angular.element(n.body),clickOutsideToClose:!1,locals:{account:p.account,message:p.tab.message,type:e,interaction:p.interaction},fullscreen:!0,skipHide:Boolean(p.tab.spy)}).then(function(t){t&&E(t),t.Interaction&&p.interaction&&p.interaction.id&&(t.Interaction.id=p.interaction.id,l.mailInteraction.update(t.Interaction).$promise.then(function(e){e&&e.closed?(p.tab.saved=!0,p.interaction.closed=!0,h()):null!==t.Interaction.substatus&&(p.tab.saved=!0,p.tab.interaction.substatus=t.Interaction.substatus,a.$parent.$parent.$parent.vm.closeTab(p.tab))}).catch(function(e){console.error(e)}))})}function b(){"mail"!==p.tab.channel&&t(function(){var e=angular.element(n.find("md-content[name*='interaction-content-"+p.tab.id+"']"));e&&e[0]&&(e[0].scrollTop=e[0].scrollHeight)},0)}function E(n){if(n)return n["chat"===p.tab.channel?"ChatWebsiteId":_.capitalize(p.tab.channel)+"AccountId"]=p.interaction["chat"===p.tab.channel?"ChatWebsiteId":_.capitalize(p.tab.channel)+"AccountId"],n[_.capitalize(p.tab.channel)+"InteractionId"]=p.interaction.id,n.UserId=p.user.id,n.ContactId=p.interaction.ContactId,n.direction="out",n.secret=Boolean(p.tab.spy||n.secret),l[p.tab.channel+"Message"].save(n).$promise.then(function(e){if(e&&e.id&&n.attachments&&n.attachments.length)for(var t=0;t<n.attachments.length;t+=1)l.attachment.update({id:n.attachments[t].id},{MailMessageId:e.id})}).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(){p.tab.areaText="",b()})}function A(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";default:return"blue-A700"}}function y(e){e&&e.count&&e.rows.length&&(p.journey=_.concat(p.journey,e.rows))}p.showFooter=!1,p.showInteraction=!1,p.user=c.getCurrentUser(),p.detectBrowser=u.detectBrowser(),p.journey=[],p.acceptedMessages=[],p.omniChannels=["mail","chat","sms","openchannel","fax"],p.ngFlowOptions={target:"api/attachments",singleFile:!0,maxChunkRetries:1,chunkSize:v,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},p.ngFlow={flow:{}},p.selectedMailShowDetails={},p.selectedMailShowSystemMessage={},p.setting={},p.ctrlMethods={},p.init=function(e,t){p.tab=e,p.tab.saved=!0,p.tab.badges=0,p.setting=t||{},p.tab&&p.tab.channel&&p.tab.interaction&&(p.interaction=p.tab.interaction,l[p.tab.channel+"Interaction"].get({id:p.tab.interaction.id,includeAll:!0}).$promise.then(function(e){return e&&(p.interaction=e,p.tab.interaction=e),p.tab.saved=p.interaction.closed,p.queryMessage={id:p.interaction.id,includeAll:!0},"mail"===p.tab.channel?(p.queryMessage.sort="-id",p.queryMessage.offset=0,p.queryMessage.limit=3):(p.queryMessage.sort="id",p.queryMessage.nolimit=!0),l[p.tab.channel+"Interaction"].getMessages(p.queryMessage).$promise}).then(function(e){return p.messages=e||{count:0,rows:[]},l["chat"===p.tab.channel?"chatWebsite":p.tab.channel+"Account"].get({id:p.interaction["chat"===p.tab.channel?"ChatWebsiteId":_.capitalize(p.tab.channel)+"AccountId"]}).$promise}).then(function(e){if(p.account=e,p.tab.title=p.account.key||p.account.name,p.interaction.ContactId)return l.cmContact.get({id:p.interaction.ContactId}).$promise}).then(function(e){return e&&(p.contact=e),p.showInteraction=!0,p.contact?(!function(e){if(e&&e.id){for(var t=0;t<p.omniChannels.length;t++)l[p.omniChannels[t]+"Interaction"].get({ContactId:e.id,includeAll:!0}).$promise.then(y);l.voiceCallReport.get({ContactId:e.id,includeAll:!0}).$promise.then(y)}}(p.contact),p.tab.title+=" - "+p.contact.firstName):p.tab.title+=" - "+r.instant(p.tab.channel.toUpperCase()+".UNKNOWN"),l.user.get({fields:"id,fullname",nolimit:!0}).$promise}).then(function(e){p.users=e||{count:0,rows:[]},p.usersMap=_.mapValues(_.keyBy(p.users.rows,"id"),"fullname")}).then(function(){if(p.tab.channel&&p.interaction)return l.user["add"+_.upperFirst(p.tab.channel)+"Interactions"]({id:p.user.id,ids:[p.interaction.id]})}).then(function(){return l.mailSubstatus.get({nolimit:!0}).$promise}).then(function(e){p.subStatuses=e||{count:0,rows:[]}}).then(function(){return p.getMailAccounts()}).then(function(){return p.getFaxAccounts()}).then(function(){return p.getSmsAccounts()}).then(function(){return p.getOpenchannelAccounts()}).then(function(){return p.getChatWebsites()}).then(function(){return p.getLists()}).catch(function(e){console.error(e),p.showInteraction=!0}).finally(function(){!function(){if(!p.tab.spy&&!p.interaction.closed)for(var e=0;e<p.messages.rows.length;e+=1)"in"!==p.messages.rows[e].direction||p.messages.rows[e].read||(l[p.tab.channel+"Message"].accept({id:p.messages.rows[e].id,UserId:p.user.id}),p.acceptedMessages.push(p.messages.rows[e].id))}(),b(),m.on(p.tab.channel+"Message:save",p.onMessageSave),m.on(p.tab.channel+"Message:update",p.onMessageSave),m.on(p.tab.channel+"Interaction:save",p.onInteractionSave),m.on(p.tab.channel+"Interaction:update",p.onInteractionSave),m.on("user_has_"+p.tab.channel+"_interactions:save",p.onInteractionOpen),m.on("user_has_"+p.tab.channel+"_interactions:remove",p.onInteractionClose),p.tab.areaText=p.tab.areaText?p.tab.areaText:"",p.showFooter=!0}))},p.getLabelByMessage=function(e){var t="loading...";if(e)return"in"===e.direction?e.Contact?e.Contact.firstName||"Anonymous":t:e.UserId?p.usersMap?p.usersMap[e.UserId]:t:"System"},p.openContact=function(e,t){try{p.tab&&!p.tab.spy&&a.$parent.$parent.$parent.vm.addContactTab(t||p.contact)}catch(e){d.error({title:"ERROR OPEN CONTACT",msg:"Unable to open the contact"})}},p.openInteraction=function(e,t){try{if(t.MailAccountId)return a.$parent.$parent.$parent.vm.addInteractionTab("mail",t);if(t.ChatWebsiteId)return a.$parent.$parent.$parent.vm.addInteractionTab("chat",t);if(t.SmsAccountId)return a.$parent.$parent.$parent.vm.addInteractionTab("sms",t);if(t.OpenchannelAccountId)return a.$parent.$parent.$parent.vm.addInteractionTab("openchannel",t);if(t.FaxAccountId)return a.$parent.$parent.$parent.vm.addInteractionTab("fax",t)}catch(e){d.error({title:"ERROR OPEN INTERACTION",msg:"Customer Journey can't open the interaction"})}},p.disposeInteraction=h,p.tagInteraction=function(){i.show({controller:"TagInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/tag/dialog.html",parent:angular.element(n.body),clickOutsideToClose:!0,skipHide:Boolean(p.tab.spy),resolve:{tags:["apiResolver",function(e){return e.resolve("tag@get",{nolimit:!0,fields:"id,name,color"})}]},locals:{channel:p.tab.channel,interaction:p.tab.interaction}})},p.composeMailInteraction=function(t,e){if(e.inReplyTo){var n=_.find(p.messages.rows,{messageId:e.inReplyTo});if(!n)return l.mailMessage.get({messageId:e.inReplyTo}).$promise.then(function(e){f(t,e&&e.count?e.rows[0]:void 0)}).catch(function(e){console.error(e),f(t,void 0)});f(t,n)}else f(t,e)},p.composeFaxInteraction=function(e){var t={to:[]};t.to.push(p.contact.fax),i.show({controller:"ComposeFaxInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/composeFax/dialog.html",parent:angular.element(n.body),clickOutsideToClose:!1,locals:{account:p.account,message:t,type:e},fullscreen:!0}).then(function(e){return l.faxAccount.send({id:p.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 t=0;t<e.data.errors.length;t++)d.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else d.error({title:"FAX:SEND",msg:e.data?JSON.stringify(e.data):e.message||e.toString()})})})},p.composeSmsInteraction=function(e,t){i.show({controller:"ComposeSmsInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/composeSms/dialog.html",parent:angular.element(n.body),clickOutsideToClose:!1,locals:{account:p.account,message:t,type:e},fullscreen:!0,skipHide:Boolean(p.tab.spy)}).then(function(e){e&&E(e)})},p.transferLastMessage=function(){if(p.interaction){var e=_.findLast(p.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(n.body),clickOutsideToClose:!1,locals:{account:p.account,interaction:p.interaction,message:e,channel:p.tab.channel}}).then(function(e){p.tab.saved=Boolean(e),e&&a.$parent.$parent.$parent.vm.closeTab(p.tab)}):d.error({title:"Invalid transfer",msg:"Message not found!"})}},p.downloadMessage=function(s,e){p.tab.channel&&s.id&&l[p.tab.channel+"Message"].download({id:s.id,attachments:e}).$promise.then(function(e){var t=[e.buffer],n="download",a=new Blob(t,{type:e.type});n=p.tab.channel+"-message"+s.id+".eml";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)d.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})})},p.downloadInteraction=function(s,e){p.tab.channel&&s.id&&l[p.tab.channel+"Interaction"].download({id:s.id,attachments:e}).$promise.then(function(e){var t=[e.buffer],n=p.tab.channel+"-interaction"+s.id+".zip",a=new Blob(t,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)d.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})})},p.getMailAccounts=function(){l.user.getMailAccounts({id:p.user.id,nolimit:!0}).$promise.then(function(e){p.mailAccounts=e||{count:0,rows:[]}})},p.getFaxAccounts=function(){l.user.getFaxAccounts({id:p.user.id,nolimit:!0}).$promise.then(function(e){p.faxAccounts=e||{count:0,rows:[]}})},p.getSmsAccounts=function(){l.user.getSmsAccounts({id:p.user.id,nolimit:!0}).$promise.then(function(e){p.smsAccounts=e||{count:0,rows:[]}})},p.getOpenchannelAccounts=function(){l.user.getOpenchannelAccounts({id:p.user.id,nolimit:!0}).$promise.then(function(e){p.openchannelAccounts=e||{count:0,rows:[]}}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.mail.account"}];for(var t=0;t<e.data.errors.length;t+=1)d.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mail.account",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},p.getChatWebsites=function(){l.user.getChatWebsites({id:p.user.id,nolimit:!0}).$promise.then(function(e){p.chatAccounts=e||{count:0,rows:[]}})},p.getLists=function(){l.user.getLists({id:p.user.id,nolimit:!0}).$promise.then(function(e){p.voiceAccounts=e||{count:0,rows:[]}})},p.reply=function(e,t){if(e&&13===e.keyCode&&e.shiftKey)return;if(e&&13!==e.keyCode)return;if(""===t.trim())return;E(function(e){var t={},n="chat"===p.tab.channel?"ChatWebsiteId":_.capitalize(p.tab.channel)+"AccountId";t[n]=p.interaction[n].toString(),t[_.capitalize(p.tab.channel)+"InteractionId"]=p.interaction.id,"sms"===p.tab.channel&&(t.phone=p.interaction.phone);e&&(t.UserId=p.user.id,t.ContactId=p.interaction.ContactId,t.body=e,t.createdAt=Date.now());return t}(t.replace(/\n$/,"")))},p.upload=function(){p.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},p.ngFlow.flow.upload()},p.fileAdded=function(e){if(e.size>v)return d.error({title:"File too big",msg:"The max allowed size is "+g+"MB"}),!1;return!0},p.fileSuccess=function(e,t){var n=JSON.parse(t),a=n.name;"chat"===p.tab.channel&&(a='<a href="'+(p.account.remote?p.account.remote:o.protocol()+"://"+o.host())+"/api/chat/interactions/"+p.interaction.id+"/attachment_download?attachId="+n.id+"&token="+p.account.token+'" target="_self">'+n.name+"</a>");E({body:a,AttachmentId:n.id})},p.onMessageSave=function(e){if(e&&p.interaction.id!=e[_.capitalize(p.tab.channel)+"InteractionId"])return;var t=!1;p.messages?t=_.find(p.messages.rows,{id:e.id}):p.messages={rows:[],count:0};t?_.merge(t,e):("mail"===p.tab.channel?p.messages.rows.unshift(e):p.messages.rows.push(e),b())},p.onInteractionSave=function(e){if(e&&p.interaction.id!==e.id)return;e.closed&&(p.tab.saved=!0);_.merge(p.interaction,e)},p.searchTextChange=function(t){var n=s.defer(),a=[],e={},i="chat"===p.tab.channel?"ChatWebsiteId":_.capitalize(p.tab.channel)+"AccountId";return e.filter=t,e[i]=p.account.id,l.cannedAnswer.get(e).$promise.then(function(e){return a=_.concat(a,e.rows),l.cannedAnswer.get({filter:t}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),n.resolve(a)}).catch(function(e){n.reject(e)}),n.promise},p.selectedItemChange=function(t){if(t){try{_.templateSettings.interpolate=/{{([\s\S]+?)}}/g;var e=_.template(t.value),n={user:p.user,account:p.account,interaction:p.interaction,contact:p.interaction&&p.interaction.Contact?p.interaction.Contact:{}};p.tab.areaText+=" "+e(n),p.ctrlMethods.setText(p.tab.areaText)}catch(e){p.tab.areaText+=" "+t.value,p.ctrlMethods.setText(p.tab.areaText)}p.selectedItem=null,p.changeDisplayCannedAnswerInputValue()}},p.getIconByChannel=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";default:return"icon-hangouts"}},p.getColorByChannel=A,p.getColorByItem=function(e){var t="";e.FaxAccountId?t="fax":e.OpenchannelAccountId?t="openchannel":e.SmsAccountId?t="sms":e.MailAccountId?t="mail":e.ChatWebsiteId?t="chat":e.amaflags&&(t="voice");return A(t)},p.getMessagesAlignment=function(e){if(e.secret&&p.user.id!=e.UserId)return"in";switch(p.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}},p.displayCannedAnswerInput=!1,p.changeDisplayCannedAnswerInputValue=function(){p.displayCannedAnswerInput=!p.displayCannedAnswerInput},p.setAs=function(e){p.tab.channel&&p.interaction&&p.interaction.id&&l[p.tab.channel+"Interaction"].update({id:p.interaction.id,substatus:e}).$promise.catch(function(e){console.error(e)})},p.markAsUnread=function(){if(p.tab.channel&&p.interaction&&p.interaction.id)if(p.acceptedMessages.length)for(var e=0;e<p.acceptedMessages.length;e+=1)l[p.tab.channel+"Message"].update({id:p.acceptedMessages[e],read:!1,UserId:null});else for(var t=0;t<p.messages.rows.length;t+=1)if("in"===p.messages.rows[t].direction){p.messages.rows[t].UserId===p.user.id?l[p.tab.channel+"Message"].update({id:p.messages.rows[t].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}p.tab.saved=!0,a.$parent.$parent.$parent.vm.closeTab(p.tab)},p.isMyAccount=function(e){{if(e.FaxAccountId)return _.includes(_.map(p.faxAccounts?p.faxAccounts.rows:[],"id"),e.FaxAccountId);if(e.OpenchannelAccountId)return _.includes(_.map(p.openchannelAccounts?p.openchannelAccounts.rows:[],"id"),e.OpenchannelAccountId);if(e.SmsAccountId)return _.includes(_.map(p.smsAccounts?p.smsAccounts.rows:[],"id"),e.SmsAccountId);if(e.MailAccountId)return _.includes(_.map(p.mailAccounts?p.mailAccounts.rows:[],"id"),e.MailAccountId);if(e.ChatWebsiteId)return _.includes(_.map(p.chatAccounts?p.chatAccounts.rows:[],"id"),e.ChatWebsiteId);if(e.amaflags)return!0}return!1},p.getAttachments=function(t){return l.attachment.get({MailMessageId:t.id}).$promise.then(function(e){e&&e.rows&&(t.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()})})},p.getAttachment=function(i){return l.attachment.download({id:i.id}).$promise.then(function(e){if(e){var t=new Blob([e.buffer],{type:e.type}),n=document.createElement("a"),a=window.URL.createObjectURL(t);n.href=a,n.target="_self",n.download=i.name,document.body.appendChild(n),n.click(),setTimeout(function(){document.body.removeChild(n),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()})})},p.htmlToPlaintext=function(e){return e?String(e).replace(/<[^>]+>/gm,""):""},p.onInteractionOpen=function(e){var t;p.interaction.id==e[_.upperFirst(p.tab.channel)+"InteractionId"]&&(p.interaction.Users&&(t=_.find(p.interaction.Users,{id:e.UserId})),t||p.interaction.Users.push({id:e.UserId}))},p.onInteractionClose=function(e){p.interaction.id==e[_.upperFirst(p.tab.channel)+"InteractionId"]&&p.interaction.Users&&_.remove(p.interaction.Users,{id:e.UserId})},p.loadNextPage=function(){var n=s.defer();if(p.queryMessage)return p.queryMessage.offset=p.messages.rows.length,l[p.tab.channel+"Interaction"].getMessages(p.queryMessage).$promise.then(function(e){for(var t=0;t<e.rows.length;t+=1)p.messages.rows.push(e.rows[t]),p.interaction.closed||"in"!==e.rows[t].direction||e.rows[t].read||(l[p.tab.channel+"Message"].accept({id:e.rows[t].id,UserId:p.user.id}),p.acceptedMessages.push(e.rows[t].id));return n.resolve(e)}).catch(function(e){return n.reject(e)});return n.reject()},p.timelineOptions={scrollEl:"#interaction-content"},a.$on("$destroy",function(){m.removeAllListeners(p.tab.channel+"Message:save"),m.removeAllListeners(p.tab.channel+"Message:update"),m.removeAllListeners(p.tab.channel+"Interaction:save"),m.removeAllListeners(p.tab.channel+"Interaction:update"),m.removeAllListeners("user_has_"+p.tab.channel+"_interactions:save"),m.removeAllListeners("user_has_"+p.tab.channel+"_interactions:remove")})}function t(a){return{scope:{ngBindHtmlUnsafe:"="},template:"<div ng-bind-html='trustedHtml'></div>",link:function(n){n.updateView=function(){var e,t=_.replace(n.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"');n.trustedHtml=a.trustAsHtml(t)},n.$watch("ngBindHtmlUnsafe",function(e,t){n.updateView(e)})}}}e.$inject=["$cookies","$timeout","$document","$scope","$mdDialog","$q","$location","$translate","api","toasty","Auth","socket","msUtils"],t.$inject=["$sce"],angular.module("app.dashboards").directive("ngBindHtmlUnsafe",t).filter("getChannelByItem",function(){return function(e,t,n,a){for(var i=[],s=0;s<e.length;s+=1){var o=!0;switch(t){case"voice":o=Boolean(e[s].uniqueid);break;case"chat":o=Boolean(e[s].ChatWebsiteId);break;case"mail":o=Boolean(e[s].MailAccountId);break;case"sms":o=Boolean(e[s].SmsAccountId);break;case"fax":o=Boolean(e[s].FaxAccountId);break;case"openchannel":o=Boolean(e[s].OpenchannelAccountId);break;default:o=!0}o&&n&&a&&(o=moment(e[s].createdAt).isBetween(n,a)),o&&i.push(e[s])}return i}}).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,t,n,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,n.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,t){try{(t=JSON.parse(t)).size=e.size,c.message.attachments.push(t)}catch(e){console.error(e)}},c.fileAdded=function(e){var t=["pdf","tif"];if(!_.includes(t,e.getExtension()))return l.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extensions: "+t.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 t="";e.firstName&&e.firstName!==e.fax&&(t+=e.firstName+" ");e.lastName&&e.lastName!==e.fax&&(t+=e.lastName+" ");return t+="<"+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 t=e;if(_.isObject(e))return e.fax;if(n=t,!/[&\/\\#,()$~%.'":;*?<>{}\s\\|a-zA-Z\pS!òàùè…_§°çéì-]/.test(n))return t;var n;return l.error("Fax "+t+" is not valid"),null},c.closeDialog=function(){s.draft=c.message,n.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(t,e,i,n,s,o,a,r,l,d,c,m){var u=this,p=25,g=1024*p*1024;switch(u.currentUser=c.getCurrentUser(),u.secret="note"===a,u.hiddenCC=!0,u.hiddenBCC=!0,u.verifySmtp=!0,u.errors=[],u.separatorKeys=[n.KEY_CODE.ENTER,n.KEY_CODE.COMMA,n.KEY_CODE.TAB],u.searchTextChange=function(t){var n=d.defer(),a=[];return r.cannedAnswer.get({filter:t,MailAccountId:s.id}).$promise.then(function(e){return a=_.concat(a,e.rows),r.cannedAnswer.get({filter:t}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),n.resolve(a)}).catch(function(e){n.reject(e)}),n.promise},u.selectedItemChange=function(t){if(t&&t.value&&u.ckEditorInstance)try{var e=_.template(t.value),n={user:u.currentUser,account:s,interaction:m,contact:m&&m.Contact?m.Contact:{}};u.ckEditorInstance.insertHtml(e(n))}catch(e){console.error(e),u.ckEditorInstance.insertHtml(t.value)}document.getElementById("html-area").focus(),u.selectedItem=null},u.onReadyEditor=function(e){try{u.ckEditorInstance=CKEDITOR.instances["html-area"]}catch(e){console.error("Unable to get Html Editor instance",e)}},_.templateSettings.interpolate=/{{([\s\S]+?)}}/g,u.fromTemplate=_.template("{{ name }} <{{ email }}>"),u.replyTemplate=_.template("On {{ date }}, at {{ time }}, {{ from }} wrote:"),u.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 }}"),u.message={from:u.fromTemplate({name:s.name,email:s.email||s.Smtp.user}),to:[],cc:[],bcc:[],body:f(),type:a,attachments:[],showLastMessage:!0},u.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:u.secret?160:300,autoGrow_maxHeight:e.innerHeight-400,autocorrect_enabled:!0,disableNativeSpellChecker:!1,font_defaultLabel:s.fontFamily?s.fontFamily.split(",")[0]:"Arial",fontSize_defaultLabel:s.fontSize||"12",removePlugins:"magicline"},u.ngFlowOptions={target:"api/attachments",singleFile:!0,maxChunkRetries:1,chunkSize:g,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},u.ngFlow={flow:{}},u.reply=function(e){angular.isDefined(o)&&(u.message.type="reply",u.message.to="in"===o.direction?o.from.split(","):o.to.split(","),u.message.subject=_.startsWith(o.subject,"Re:")?o.subject:"Re: "+o.subject,u.message.inReplyTo=o.messageId,u.message.body=o.draft&&o.draft.inReplyTo?o.draft.body:f(),u.message.attachments=o.draft?o.draft.attachments:[],e&&o.cc&&(u.hiddenCC=!1,u.message.cc=o.cc.split(",")),u.message.showLastMessage=!!o.draft&&o.draft.showLastMessage)},u.newMail=function(){angular.isDefined(o)&&(u.message.type="new",u.message.to=o.to?o.to.split(","):[])},u.forward=function(){if(angular.isDefined(o)){if(u.message.type="forward",u.message.subject=_.startsWith(o.subject,"Fwd:")?o.subject:"Fwd: "+o.subject,u.message.body=o.draft&&!o.draft.inReplyTo?o.draft.body:f(),o.Attachments&&o.Attachments.length)for(var e=0;e<o.Attachments.length;e++)u.message.attachments.push(o.Attachments[e]);u.message.showLastMessage=!!o.draft&&o.draft.showLastMessage}},u.send=function(e,t,n){if(u.message.to&&u.message.body)if(u.message.to.length)if(o.draft=void 0,_.isEmpty(u.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(){v(t,n)})}else v(t,n);else l.error("To is mandatory")},u.note=function(){u.type="note",u.secret=!0,u.message.body='<div style="font-family:'+s.fontFamily+";font-size:"+s.fontSize+'px"><p></p></div>'},u.addNote=function(){u.message.body&&(u.message.draft=void 0,i.hide({secret:!0,body:u.message.body,attach:u.message.attachments.length,attachments:u.message.attachments}))},u.upload=function(e){u.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+t.get("motion.token")},u.ngFlow.flow.upload()},u.fileSuccess=function(e,t){try{(t=JSON.parse(t)).size=e.size,u.message.attachments.push(t)}catch(e){console.error(e)}},u.deleteAttachment=function(e){u.message.attachments=_.reject(u.message.attachments,{id:e.id}),r.attachment.delete({id:e.id}).$promise.then(function(){l.success({title:"Attachment deleted!",msg:e.name?e.name+" has been deleted!":""})})},u.fileAdded=function(e){if(e.size>g)return l.error({title:"File too big",msg:"The max allowed size is "+p+"MB"}),!1;return!0},u.getContact=function(e){var t="";e.firstName&&e.firstName!==e.email&&(t+=e.firstName+" ");e.lastName&&e.lastName!==e.email&&(t+=e.lastName+" ");return t+="<"+e.email+">"},u.contactSearch=function(e){return s&&s.ListId?r.cmContact.get({ListId:s.ListId,nolimit:!0,filter:e,fields:"firstName,lastName,email"}).$promise.then(function(e){return e.rows}):[]},u.transformContact=function(e,t){if(_.isObject(e))return e.email;if(_.isString(e)){if(h(e))return e;for(var n=e.split(","),a=0;a<n.length;a+=1)h(n[a])?_.isArray(t)&&_.indexOf(t,n[a])<0&&t.push(n[a]):l.error("Email "+n[a]+" is not valid");return null}return l.error("Email field is not valid"),null},u.closeDialog=function(){angular.isDefined(o)&&(o.draft=u.message);i.cancel()},u.loadLastMessage=function(){u.message.body+=b(u.message.type)},a){case"reply":u.reply(!1);break;case"replyAll":u.reply(!0);break;case"forward":u.forward();break;case"new":u.newMail();break;case"note":u.note()}function v(e,t){var n={from:u.message.from,to:u.message.to.join(","),cc:u.message.cc.join(","),bcc:u.message.bcc.join(","),subject:u.message.subject,body:u.message.showLastMessage?u.message.body:u.message.body+b(u.message.type),inReplyTo:u.message.inReplyTo,attach:u.message.attachments.length,attachments:u.message.attachments,Interaction:{lastMsgDirection:"out",lastMsgBody:u.message.body,substatus:t}};n.html='<div id="xm-mail-content">'+_.replace(n.body,'<div id="xm-mail-content"',"<div")+"</div>",e&&(n.Interaction.closed=!0),i.hide(n)}function h(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 f(){return'<div style="font-family:'+s.fontFamily+";font-size:"+s.fontSize+'px">'+function(){if(_.isNil(s.template))return"";try{return _.template(s.template)({user:u.currentUser,account:s,interaction:m,contact:m&&m.Contact?m.Contact:{}})}catch(e){return console.error(e),""}}()+"</div>"}function b(e){var t,n,a='<div id="xm-mail-content"><blockquote type="cite">';switch(e){case"reply":case"replyAll":a+=u.replyTemplate({date:moment(o.createdAt).format("D MMM YYYY")||"",time:moment(o.createdAt).format("HH:mm")||"",from:_.escape(o.from)||""});break;case"forward":a+=u.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)||""})}return a+="<br><br>",a+=(t=o.body?_.replace(o.body,'<div id="xm-mail-content"',"<div"):"",(n=t.match(/\<body[^>]*\>([^]*)\<\/body/m))?n[1]:t),a+="</blockquote></div>",e?a:""}r.mailSubstatus.get({nolimit:!0}).$promise.then(function(e){u.subStatuses=e||{count:0,rows:[]}}).catch(function(e){console.error(e)}),u.secret||r.mailAccount.verifySmtp({id:s.id}).$promise.catch(function(e){u.verifySmtp=!1,u.errors.push({message:e.data,type:e.status}),u.errors.push({message:"You can't reply or send an email. Please contact the administrator!",type:"500"})})}e.$inject=["$cookies","$window","$mdDialog","$mdConstant","account","message","type","api","toasty","$q","Auth","interaction"],angular.module("app.dashboards").controller("ComposeMailInteractionDialogController",e)}(),function(){"use strict";function e(e,t,n,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(t){var n=c.defer(),a=[];return l.cannedAnswer.get({filter:t,OpenchannelAccountId:s.id}).$promise.then(function(e){return a=_.concat(a,e.rows),l.cannedAnswer.get({filter:t}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),n.resolve(a)}).catch(function(e){n.reject(e)}),n.promise},p.selectedItemChange=function(t){if(t){try{_.templateSettings.interpolate=/{{([\s\S]+?)}}/g;var e=_.template(t.value),n={user:p.currentUser,account:s};p.message.body+=" "+e(n),p.ctrlMethods.setText(p.message.body)}catch(e){p.message.body+=" "+t.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?(t=p.message.body,a.hide({to:p.message.to.join(","),body:t})):d.error("To is mandatory"));var t},p.getContact=function(e){var t="";e.firstName&&e.firstName!==e[s.mapKey]&&(t+=e.firstName+" ");e.lastName&&e.lastName!==e[s.mapKey]&&(t+=e.lastName+" ");return t+="<"+e[s.mapKey]+">"},p.closeDialog=function(){a.cancel()},p.contactSearch=function(e){if(s&&s.ListId){var t="firstName,lastName,phone,mobile";return s.mapKey&&(t+=","+s.mapKey),l.cmContact.get({ListId:s.ListId,nolimit:!0,filter:e,fields:t}).$promise.then(function(e){return e.rows})}return[]},p.transformContact=function(e){var t=e;if(_.isObject(t))return e[s.mapKey];return t},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,t,n,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(t){var n=c.defer(),a=[];return l.cannedAnswer.get({filter:t,SmsAccountId:s.id}).$promise.then(function(e){return a=_.concat(a,e.rows),l.cannedAnswer.get({filter:t}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),n.resolve(a)}).catch(function(e){n.reject(e)}),n.promise},p.selectedItemChange=function(t){if(t){try{_.templateSettings.interpolate=/{{([\s\S]+?)}}/g;var e=_.template(t.value),n={user:p.currentUser,account:s};p.message.body+=" "+e(n),p.ctrlMethods.setText(p.message.body)}catch(e){p.message.body+=" "+t.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?(t=p.message.body,a.hide({to:p.message.to.join(","),body:t})):d.error("To is mandatory"));var t},p.getContact=function(e){var t="";e.firstName&&e.firstName!==e.mobile&&(t+=e.firstName+" ");e.lastName&&e.lastName!==e.mobile&&(t+=e.lastName+" ");return t+="<"+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 t=e;if(_.isObject(t))return e.mobile;if(n=t,/^(\+|\d)[0-9]{7,16}$/.test(n))return t;var n;return d.error("Mobile "+t+" 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(t,n,a,i,s,o){var r=this;function l(){r.mandatoryDisposition&&a.user.pause({id:o.id,type:r.mandatoryDispositionPause||"DEFAULT PAUSE"}).$promise.then(function(e){}).catch(function(e){console.error(e)})}function d(e){r.mandatoryDisposition&&a.user.unpause({id:o.id}).$promise.catch(function(e){console.error(e)}),t.hide(e)}r.errors=[],r.interaction=angular.copy(i),r.dispositions={count:0,rows:[]},r.globalDispositions={count:0,rows:[]},r.channel=s,r.apiRoute=r.channel+"Interaction",r.interaction.disposition||(r.interaction.disposition=null),r.mandatoryDisposition=!0,r.mandatoryDispositionPause="",r.saveDisposition=function(e){r.errors=[],r.interaction.UserId=o.id,r.interaction.closed=!0,r.interaction.closeReason="agent",a[r.apiRoute]?a[r.apiRoute].update(_.pick(r.interaction,["MailAccountId","FaxAccountId","SmsAccountId","ChatWebsiteId","OpenchannelAccountId","closed","closeReason","disposition","id","note","UserId"])).$promise.then(function(e){r.interaction=e,n.success({title:"Interaction properly closed!",msg:"Interaction has been closed!"})}).then(function(){d(!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 t=0;t<e.data.errors.length;t++)n.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.variable.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})}):d(!1)},r.closeDialog=d,function(){var e={fields:"id,name",sort:"name",nolimit:!0};switch(s){case"chat":e.ChatWebsiteId=i.ChatWebsiteId,a.chatWebsite.get({id:i.ChatWebsiteId}).$promise.then(function(e){r.mandatoryDisposition=e.mandatoryDisposition,r.mandatoryDisposition&&(r.mandatoryDispositionPause=e.mandatoryDispositionPause.name)}).then(function(){l()});break;case"mail":e[t=_.capitalize(s)+"AccountId"]=i[t],a.mailAccount.get({id:i.MailAccountId}).$promise.then(function(e){r.mandatoryDisposition=e.mandatoryDisposition,r.mandatoryDisposition&&(r.mandatoryDispositionPause=e.mandatoryDispositionPause.name)}).then(function(){l()});break;case"sms":e[t=_.capitalize(s)+"AccountId"]=i[t],a.smsAccount.get({id:i.SmsAccountId}).$promise.then(function(e){r.mandatoryDisposition=e.mandatoryDisposition,r.mandatoryDisposition&&(r.mandatoryDispositionPause=e.mandatoryDispositionPause.name)}).then(function(){l()});break;case"fax":e[t=_.capitalize(s)+"AccountId"]=i[t],a.faxAccount.get({id:i.FaxAccountId}).$promise.then(function(e){r.mandatoryDisposition=e.mandatoryDisposition,r.mandatoryDisposition&&(r.mandatoryDispositionPause=e.mandatoryDispositionPause.name)}).then(function(){l()});break;case"openchannel":var t;e[t=_.capitalize(s)+"AccountId"]=i[t],a.faxAccount.get({id:i.OpenchannelAccountId}).$promise.then(function(e){r.mandatoryDisposition=e.mandatoryDisposition,r.mandatoryDisposition&&(r.mandatoryDispositionPause=e.mandatoryDispositionPause.name)}).then(function(){l()})}a.disposition.get(e).$promise.then(function(e){r.dispositions=e}).catch(function(e){console.error(e)}),a.disposition.get({MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null"}).$promise.then(function(e){r.globalDispositions=e}).catch(function(e){console.error(e)})}()}e.$inject=["$mdDialog","toasty","api","interaction","channel","user"],angular.module("app.dashboards").controller("DisposeInteractionDialogController",e)}(),function(){"use strict";function e(t,n,e,a,i,s){var o=this;function r(e){t.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(){n.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 t=0;t<e.data.errors.length;t+=1)n.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else n.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(t,e,n,a,i,s,o,r){var l=this;function d(e){t.hide(e)}l.currentUser=n.getCurrentUser(),l.channel=s.toLowerCase(),l.message=o,l.account=r,l.transfer={id:0,type:"queue"},l.agents=l.queues={count:0,rows:[]},l.queueMethod=l.channel+"Queue",l.queueNotifyMethod=l.channel+"QueueNotify",l.onTransfer=function(){d(!0),e(function(){return a.rpc["agent"===l.transfer.type?"agentNotify":l.queueNotifyMethod]({id:l.transfer.id,messageId:l.message.id,channel:l.channel}).$promise.then(function(e){i.success({title:"Trasfer properly done!",msg:"Transfer "+l.transfer.type+" has been done!"})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){l.errors=e.data.errors||[{message:e.toString(),type:"api.rpc.notify"}];for(var t=0;t<e.data.errors.length;t++)i.error({title:e.data.errors[t].type,msg:e.data.errors[t].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)},l.closeDialog=d,l.init=function(){return a.user.get({fields:"id,name",role:"agent",nolimit:!0}).$promise.then(function(e){return l.agents=e||{count:0,rows:[]},a[l.queueMethod].get({fields:"id,name",nolimit:!0}).$promise}).then(function(e){l.queues=e||{count:0,rows:[]}}).catch(function(e){console.error(e)})},l.init()}e.$inject=["$mdDialog","$timeout","Auth","api","toasty","channel","message","account"],angular.module("app.dashboards").controller("TransferMessageDialogController",e)}(),function(){"use strict";function e(i,s,o,e,l,d,t,n,a,r,c){var m=this;function u(){try{i.$parent.$parent.$parent.vm.updateLocalStorage()}catch(e){d.error({title:"ERROR UPDATE LOCAL TABS",msg:"Error updating locally stored tabs"})}}function p(n,e){var r=t.getCurrentUser();l.jscriptySessionReport.save({starttime:m.starttime,membername:m.call&&m.call.membername?m.call.membername:r.name,calleridname:m.call&&m.call.calleridname?m.call.calleridname:void 0,calleridnum:m.call&&m.call.calleridnum?m.call.calleridnum:void 0,queue:m.call&&m.call.queue?m.call.queue:void 0,uniqueid:m.call&&m.call.uniqueid?m.call.uniqueid:void 0,VoiceQueueId:m.call&&m.call["xmd-voicequeueid"]?m.call["xmd-voicequeueid"]:void 0,ProjectId:m.project&&m.project.id?m.project.id:void 0,projectname:m.project&&m.project.name?m.project.name:void 0,ContactId:m.contact&&m.contact.id?m.contact.id:void 0,completed:e}).$promise.then(function(e){if(e)for(var t=m.getResponseSheetHeaders(),n=m.getResponseSheetRow(),a=m.getQuestionWithResponseList(),i=0;i<t.length;i+=1)if(!_.isEmpty(n[i])){l.jscriptyQuestionReport.save({question:t[i],answer:n[i],questionId:a[i].id,membername:m.call&&m.call.membername?m.call.membername:r.name,calleridname:m.call&&m.call.calleridname?m.call.calleridname:void 0,calleridnum:m.call&&m.call.calleridnum?m.call.calleridnum:void 0,queue:m.call&&m.call.queue?m.call.queue:void 0,uniqueid:m.call&&m.call.uniqueid?m.call.uniqueid:void 0,SessionId:e.id,ProjectId:m.project.id,projectname:m.project.name});for(var s=n[i].toString().split(";"),o=0;o<s.length;o+=1)l.jscriptyAnswerReport.save({question:t[i],questionId:a[i].id,answer:s[o].trim(),membername:m.call&&m.call.membername?m.call.membername:r.name,calleridname:m.call&&m.call.calleridname?m.call.calleridname:void 0,calleridnum:m.call&&m.call.calleridnum?m.call.calleridnum:void 0,queue:m.call&&m.call.queue?m.call.queue:void 0,uniqueid:m.call&&m.call.uniqueid?m.call.uniqueid:void 0,SessionId:e.id,ProjectId:m.project.id,projectname:m.project.name})}return e}).then(function(e){e?n.resolve(!0):n.reject()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.contact.save"}];for(var t=0;t<e.data.errors.length;t+=1)d.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contact.save",msg:e.data?JSON.stringify(e.data.message):e.toString()});n.reject()})}m.formViewer={},m.showResetButton=!0,m.showIncompleteSubmitButton=!1,m.detectBrowser=c.detectBrowser(),m.onSubmit=function(e,t){var n=s.defer();if(t){var a=o.confirm().title("Would you like to save your survey?").textContent("").ariaLabel("survey").targetEvent(e).ok("YES").cancel("NO");o.show(a).then(function(){p(n,!1)},function(){n.resolve()})}else p(n,!0);return n.promise.then(function(e){e&&(d.success({title:"Session saved",msg:"Your survey session has been properly saved!"}),function(e){try{i.$parent.$parent.$parent.vm.removeTab(e)}catch(e){d.error({title:"ERROR REMOVE TAB",msg:"Error while removing tab"})}}(m.tab))}).catch(function(e){d.error({title:"Session save error",msg:"There has been an error while trying to save your survey session!"})})},m.openContact=function(e,t){try{i.$parent.$parent.$parent.vm.addContactTab(t)}catch(e){d.error({title:"ERROR OPEN CONTACT",msg:"Jscripty can't open the contact"})}},m.isJsonString=function(e){if(_.isNil(e))return!1;try{JSON.parse(e)}catch(e){return!1}return!0},m.getResponseSheet=function(){return e.getResponseSheet(m.project.formData,m.project.responseData,!1)},m.getResponseSheetRow=function(){return e.getResponseSheetRow(m.project.formData,m.project.responseData)},m.getResponseSheetHeaders=function(){return e.getResponseSheetHeaders(m.project.formData,!1)},m.getQuestionWithResponseList=function(){return e.getQuestionWithResponseList(m.project.formData,m.project.responseData)},m.init=function(e){m.tab=e,m.tab&&(m.call=m.tab.call,m.starttime=m.tab.openedAt,m.contact=m.tab.contact,m.project=m.tab.project,m.project&&(_.isObjectLike(m.project.formData)?m.project.formData=m.project.formData:m.isJsonString(m.project.formData)?m.project.formData=JSON.parse(m.project.formData):m.project.formData=void 0,m.project.responseData=m.project.responseData||{},void 0!==m.project.currentPage&&r(function(){a.$broadcast("mwForm.pageEvents.changePage",{page:m.project.currentPage})}),i.$on("mwForm.pageEvents.pageCurrentChanged",function(e,t){if(t.currentPage&&(m.project.currentPage=t.currentPage.number-1,u(),m.project.enableUncompleteSave&&(1<=t.currentPage.number&&t.currentPage.number<m.project.formData.pages.length?m.showIncompleteSubmitButton=!0:m.showIncompleteSubmitButton=!1),m.project.formData&&m.project.formData.pages))for(var n=0,a=m.project.formData.pages.length;n<a;n++)if(t.currentPage.number<n+1&&m.project.formData.pages[n].elements)for(var i=0,s=m.project.formData.pages[n].elements.length;i<s;i++)"question"===m.project.formData.pages[n].elements[i].type&&m.project.formData.pages[n].elements[i].question&&delete m.project.responseData[m.project.formData.pages[n].elements[i].question.id]})))},m.resetViewer=function(e){if(m.formViewer.reset){var t=o.confirm().title(n.instant("JSCRIPTY.DO_YOU_WANT_TO_RESET_SESSION")).content(n.instant("JSCRIPTY.ALL_SURVEY_DATA_WILL_BE_LOST")).textContent("").ariaLabel("survey").targetEvent(e).ok(n.instant("JSCRIPTY.YES")).cancel(n.instant("JSCRIPTY.NO"));o.show(t).then(function(){m.showIncompleteSubmitButton=!1,m.project.currentPage=void 0,u(),m.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(n,a,e,t,i){var s=this;function o(){return function(e){if(404===e.status)a.info({title:n.instant("DASHBOARDS.ATTENTION"),msg:n.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 t=0;t<e.data.errors.length;t+=1)a.error({title:e.data.errors[t].type,msg:e.data.errors[t].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(t[s.notification.channel+"Message"])return t[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(t[s.notification.channel+"Message"])return t[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 t=this;t.init=function(e){t.tab=e,t.tab&&(t.tab.saved=!0,t.html=t.tab.html)}})}(),function(){"use strict";function e(e,t,n,a){var i=this,s=[];function o(e,t){e.closed||e.UserId||!t||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!t&&i.inbound.waiting&&(i.inbound.waiting-=1)),e.closed&&"abandoned"===e.disposition?(i.inbound.abandoned+=1,!t&&i.inbound.waiting&&(i.inbound.waiting-=1)):e.closed&&!e.UserId&&e.disposition?(i.inbound.unmanaged+=1,!t&&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,!t&&i.inbound.talking&&(i.inbound.talking-=1)),t&&(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:e.ChatWebsiteId})}function d(e){return moment(e).isBetween(moment().startOf("day").toString(),moment().endOf("day").toString())}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())},t.on("chatInteraction:save",i.onSaveChatInteraction),t.on("chatInteraction:update",i.onUpdateChatInteraction),function(){if(0<Object.keys(i.chatWebsites).length)for(var e=0;e<n.rows.length;e+=1)if(l(n.rows[e])){var t=n.rows[e];o(t,!0),r()}}(),e.$on("$destroy",function(){t.removeAllListeners("chatInteraction:save"),t.removeAllListeners("chatInteraction:update")})}e.$inject=["$scope","socket","chatInteractions","chatWebsites"],angular.module("app.dashboards").controller("UserChatDashboardGeneralController",e)}(),function(){"use strict";function e(e,t,n,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)},n.onWithoutApply("voice_queue:save",l.onSaveQueue),l.interval=t(function(){d(),c()},999),n.onWithoutApply("campaign:save",l.onSaveCampaign),d(),c(),e.$on("$destroy",function(){n.removeAllListeners("voice_queue:save"),n.removeAllListeners("campaign:save"),l.interval&&t.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,t,n,a){var i=this,s=[];function o(e,t){e.closed||e.UserId||!t||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!t&&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,!t&&i.inbound.talking&&(i.inbound.talking-=1)),e.closed&&!e.UserId&&(i.inbound.unmanaged+=1,!t&&i.inbound.waiting&&(i.inbound.waiting-=1)),t&&(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:e.FaxAccountId})}function d(e){return moment(e).isBetween(moment().startOf("day").toString(),moment().endOf("day").toString())}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())},t.on("faxInteraction:save",i.onSaveFaxInteraction),t.on("faxInteraction:update",i.onUpdateFaxInteraction),function(){if(0<Object.keys(i.faxAccounts).length)for(var e=0;e<n.rows.length;e+=1)if(l(n.rows[e])){var t=n.rows[e];o(t,!0),r()}}(),e.$on("$destroy",function(){t.removeAllListeners("faxInteraction:save"),t.removeAllListeners("faxInteraction:update")})}e.$inject=["$scope","socket","faxInteractions","faxAccounts"],angular.module("app.dashboards").controller("UserFaxDashboardGeneralController",e)}(),function(){"use strict";function e(e,t,n,a){var i=this,s=[];function o(e,t){e.closed||e.UserId||!t||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!t&&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,!t&&i.inbound.talking&&(i.inbound.talking-=1)),e.closed&&!e.UserId&&(i.inbound.unmanaged+=1,!t&&i.inbound.waiting&&(i.inbound.waiting-=1)),t&&(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:e.MailAccountId})}function d(e){return moment(e).isBetween(moment().startOf("day").toString(),moment().endOf("day").toString())}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())},t.on("mailInteraction:save",i.onSaveMailInteraction),t.on("mailInteraction:update",i.onUpdateMailInteraction),function(){if(0<Object.keys(i.mailAccounts).length)for(var e=0;e<n.rows.length;e+=1)if(l(n.rows[e])){var t=n.rows[e];o(t,!0),r()}}(),e.$on("$destroy",function(){t.removeAllListeners("mailInteraction:save"),t.removeAllListeners("mailInteraction:update")})}e.$inject=["$scope","socket","mailInteractions","mailAccounts"],angular.module("app.dashboards").controller("UserMailDashboardGeneralController",e)}(),function(){"use strict";function e(e,t,n,a){var i=this,s=[];function o(e,t){e.closed||e.UserId||!t||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!t&&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,!t&&i.inbound.talking&&(i.inbound.talking-=1)),e.closed&&!e.UserId&&(i.inbound.unmanaged+=1,!t&&i.inbound.waiting&&(i.inbound.waiting-=1)),t&&(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:e.OpenchannelAccountId})}function d(e){return moment(e).isBetween(moment().startOf("day").toString(),moment().endOf("day").toString())}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())},t.on("openchannelInteraction:save",i.onSaveOpenchannelInteraction),t.on("openchannelInteraction:update",i.onUpdateOpenchannelInteraction),function(){if(0<Object.keys(i.openchannelAccounts).length)for(var e=0;e<n.rows.length;e+=1)if(l(n.rows[e])){var t=n.rows[e];o(t,!0),r()}}(),e.$on("$destroy",function(){t.removeAllListeners("openchannelInteraction:save"),t.removeAllListeners("openchannelInteraction:update")})}e.$inject=["$scope","socket","openchannelInteractions","openchannelAccounts"],angular.module("app.dashboards").controller("UserOpenchannelDashboardGeneralController",e)}(),function(){"use strict";function e(e,t,n,a){var i=this,s=[];function o(e,t){e.closed||e.UserId||!t||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!t&&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,!t&&i.inbound.talking&&(i.inbound.talking-=1)),e.closed&&!e.UserId&&(i.inbound.unmanaged+=1,!t&&i.inbound.waiting&&(i.inbound.waiting-=1)),t&&(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:e.SmsAccountId})}function d(e){return moment(e).isBetween(moment().startOf("day").toString(),moment().endOf("day").toString())}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())},t.on("smsInteraction:save",i.onSaveSmsInteraction),t.on("smsInteraction:update",i.onUpdateSmsInteraction),function(){if(0<Object.keys(i.smsAccounts).length)for(var e=0;e<n.rows.length;e+=1)if(l(n.rows[e])){var t=n.rows[e];o(t,!0),r()}}(),e.$on("$destroy",function(){t.removeAllListeners("smsInteraction:save"),t.removeAllListeners("smsInteraction:update")})}e.$inject=["$scope","socket","smsInteractions","smsAccounts"],angular.module("app.dashboards").controller("UserSmsDashboardGeneralController",e)}(),function(){"use strict";function e(n){var i=[],s=function(){var n=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(n.queues,function(e,t){n.rpcQueues[t]&&(a.waiting+=n.rpcQueues[t].waiting||0,a.talking+=(n.rpcQueues[t].talking||0)+(n.rpcQueues[t].pTalking||0),a.answered+=n.rpcQueues[t].answered||0,a.abandoned+=n.rpcQueues[t].abandoned||0,a.sumHoldTime+=n.rpcQueues[t].sumHoldTime||0,a.sumBillable+=n.rpcQueues[t].sumBillable||0,a.total+=n.rpcQueues[t].total||0,a.originated+=n.rpcQueues[t].originated||0,a.outboundDropCallsDayCallersExit+=n.rpcQueues[t].outboundDropCallsDayCallersExit||0,a.outboundDropCallsDayTimeout+=n.rpcQueues[t].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(),n.defer.resolve(a),0<i.length&&s()};return function(e){var t=n.defer();return i.push({queues:e.queues,rpcQueues:e.rpcQueues,defer:t}),1===i.length&&s(),t.promise}}function t(n){var i=[],s=function(){var n=i[0],a={originated:0,limitCalls:0};_.forIn(n.rpcCampaigns,function(e,t){n.rpcCampaigns[t]&&(a.originated+=n.rpcCampaigns[t].originated||0,a.limitCalls+=n.rpcCampaigns[t].limitCalls||0)}),i.shift(),n.defer.resolve(a),0<i.length&&s()};return function(e){var t=n.defer();return i.push({rpcCampaigns:e.rpcCampaigns,defer:t}),1===i.length&&s(),t.promise}}function n(e,o,t,n){var r=this;r.hasPermission=function(){return t.hasPermission(101)||t.hasRole("admin")},r.license=n,e.$on("$stateChangeSuccess",function(e,t,n,a,i){var s=[];r.license.voice&&s.push("app.dashboards.general.voice"),r.license.dialer&&s.push("app.dashboards.general.dialer"),r.license.chat&&s.push("app.dashboards.general.chat"),r.license.mail&&s.push("app.dashboards.general.mail"),r.license.messaging&&s.push("app.dashboards.general.sms"),r.license.openchannel&&s.push("app.dashboards.general.openchannel"),r.license.fax&&s.push("app.dashboards.general.fax"),r.selectedTab=_.indexOf(s,t.name),r.selectedTab<0&&(r.selectedTab=0)<s.length&&o.go(_.first(s))})}e.$inject=["$q"],t.$inject=["$q"],n.$inject=["$scope","$state","Auth","license"],angular.module("app.dashboards").filter("secToTime",function(){return function(e){return new Date(1e3*e).toISOString().substr(11,8)}}).factory("initializeRealtimeQueue",e).factory("initializeRealtimeCampaign",t).controller("UserDashboardGeneralController",n)}(),function(){"use strict";function e(e,t,n,a,i,s){var o=this;function r(){s({queues:o.inboundQueues,rpcQueues:o.rpcQueues}).then(function(e){o.inbound=e})}o.inboundQueues=n?_.keyBy(n.rows?n.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},t.on("voice_queue:save",o.onSaveQueue),t.on("voice_outbound:save",o.onSaveOutbound),r(),e.$on("$destroy",function(){t.removeAllListeners("voice_queue:save"),t.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,t,n,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,notificationSound:!0,queueTransferTimeout:300,agentTransferTimeout:300},g.title="FAX.NEW_FAXACCOUNT",g.newFaxAccount=!0),t.params.id&&(g.faxAccount.FaxAccountId=t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.faxAccounts,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The faxAccount will be deleted.").ariaLabel("Delete FaxAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.trunks,{id:e.resourceId})}),n=null;if(g.faxAccount&&(n=_.find(g.trunks,{id:Number(g.faxAccount.TrunkId)})),n&&!_.some(t,["id",n.id])){var a=_.find(g.trunks,{id:n.id});a.canSelect=!1,t.push(a)}g.trunks=t})}else{var n=[],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,n.push(g.trunks[i]));g.trunks=n}}).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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.lists,{id:e.resourceId})}),n=null;if(g.faxAccount&&(n=_.find(g.lists,{id:Number(g.faxAccount.ListId)})),n&&!_.some(t,["id",n.id])){var a=_.find(g.lists,{id:n.id});a.canSelect=!1,t.push(a)}g.lists=t})}else{var n=[],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,n.push(g.lists[i]));g.lists=n}}).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 t(e,t){if(r.faxAccountApps.rows.length){var n=r.faxAccountApps.rows[t]?r.faxAccountApps.rows[t]:r.faxAccountApps.rows[0];i.show({controller:"EditFaxAccountApp"+(n.appType||n.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/apps/"+(n.appType||n.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxAccountApp:n,faxAccount:r.faxAccount,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.faxAccountApps.rows[t]=e:r.faxAccountApps.rows.splice(t,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,t=[],n=0;n<r.faxAccountApps.rows.length;n++,0){var a=r.faxAccountApps.rows[n],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,t=_.concat(t,i,[a],s)}o.faxAccount.addApplications({id:r.faxAccount.id},_.sortBy(t,"priority")).$promise.then(function(e){r.faxAccountApps.rows=e.rows}).catch(function(e){console.error(e)})}function n(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){t(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,t){r.faxAccount=e,r.crudPermissions=void 0!==t?t:{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,t,n){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(n).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.faxAccountApps.rows.splice(t,1),l()},function(){console.log("CANCEL")})},r.getFaxAccountApps=function(){r.promise=o.faxAccount.getApplications(r.query,n).$promise},r.editFaxAccountApp=t,r.editInterval=function(e,t){if(r.faxAccountApps.rows.length){var n=r.faxAccountApps.rows[t]?r.faxAccountApps.rows[t]: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:n.interval,IntervalId:n.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(n.interval=e.interval||"*,*,*,*",n.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 t=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(t).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,t,n,o,r,l,d){var c=this;function m(){return a(function(n,t){return a(function(t,n){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.faxAccount.getAgents({id:c.faxAccount.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return t.penalty=e.UserFaxAccount?"penalty "+e.UserFaxAccount.penalty:"",t.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=l.getCurrentUser(),c.faxAccount=t,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(n,t){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.faxAccount.removeAgents({id:c.faxAccount.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.faxAccount.addAgents({id:c.faxAccount.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,items:[],selectedItems:[],showSelectAndDeselectAll:!o,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("FAX.ALL_AGENTS"),labelSelected:r.instant("FAX.SELECTED_AGENTS"),transferCallback:function(e,t){var n=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(n)}}}e.$inject=["$mdDialog","$q","toasty","api","faxAccount","faxAccounts","realtime","$translate","Auth","crudPermissions"],angular.module("app.fax").controller("FaxAccountagentaddController",e)}(),function(){"use strict";function e(t,e,n,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"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){t.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 t=_.find(l.agents,{name:l.agent.agent});t&&(l.agent.UserId=t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),n=null;if(l.agent&&(n=_.find(l.agents,{name:l.agent.agent})),n&&!_.some(t,["id",n.id])){var a=_.find(l.agents,{id:n.id});a.canSelect=!1,t.push(a)}l.agents=t})}else{var n=[],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,n.push(l.agents[i]));l.agents=n}}).catch(function(e){n.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(t,e,n,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"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){t.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(t,e,n,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"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){t.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(t,e,n,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"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){t.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,t,n,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 E(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var t=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),n=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(t+"-"+n)}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 A(e){t.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=E(),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!":""}),A()}).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=E(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),A(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var t=_.find(c.intervals,{id:e.id});t&&_.merge(t,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),A()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=A,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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=e&&e.rows?e.rows:[],n=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(t,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,n.push(e))}),c.intervals=n})}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(t,e,n,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"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){t.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(t,e,n,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"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){t.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 t=_.find(l.queues,{name:l.queue.queue});t&&(l.queue[_.capitalize("fax")+"QueueId"]=t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),n=null;if(l.queue&&(n=_.find(l.queues,{name:l.queue.queue})),n&&!_.some(t,["id",n.id])){var a=_.find(l.queues,{id:n.id});a.canSelect=!1,t.push(a)}l.queues=t})}else{var n=[],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,n.push(l.queues[i]));l.queues=n}}).catch(function(e){n.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(t,e,n,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"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){t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),n=null;if(l.system&&(n=_.find(l.variables,{name:l.system.variable})),n&&!_.some(t,["id",n.id])){var a=_.find(l.variables,{id:n.id});a.canSelect=!1,t.push(a)}l.variables=t})}else{var n=[],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,n.push(l.variables[i]));l.variables=n}}).catch(function(e){n.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(t,e,n,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"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){t.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 t=_.find(l.tags,{name:l.tag.tag});t&&(l.tag.TagId=t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),n=null;if(l.tag&&(n=_.find(l.tags,{name:l.tag.tag})),n&&!_.some(t,["id",n.id])){var a=_.find(l.tags,{id:n.id});a.canSelect=!1,t.push(a)}l.tags=t})}else{var n=[],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,n.push(l.tags[i]));l.tags=n}}).catch(function(e){n.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,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.faxAccount={},c.faxAccountFaxDispositions={count:0,rows:[]},c.selectedFaxAccountFaxDispositions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,name",limit:10,page:1},c.init=function(e,t){c.faxAccount=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.faxAccount.id,c.query.FaxAccountId=c.faxAccount.id,c.getFaxAccountFaxDispositions()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the faxDisposition?").htmlContent("<b>"+(e.name||"faxDisposition")+"</b> will be deleted.").ariaLabel("delete faxDisposition").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getFaxAccountFaxDispositions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.faxAccount.getDispositions(c.query,p).$promise},c.createOrEditFaxAccountFaxDisposition=function(e,t){s.show({controller:"CreateOrEditFaxDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/faxDispositions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxAccount:c.faxAccount,faxDisposition:t,faxDispositions:c.faxAccountFaxDispositions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedFaxAccountFaxDispositions=function(){var e=angular.copy(c.selectedFaxAccountFaxDispositions);return c.selectedFaxAccountFaxDispositions=[],e},c.deleteFaxAccountFaxDisposition=g,c.deleteSelectedFaxAccountFaxDispositions=function(e){var t=s.confirm().title("Are you sure want to delete the selected faxDispositions?").htmlContent("<b>"+c.selectedFaxAccountFaxDispositions.length+" selected</b> will be deleted.").ariaLabel("delete faxDispositions").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedFaxAccountFaxDispositions.forEach(function(e){g(e)}),c.selectedFaxAccountFaxDispositions=[]})};var m=!0,u=1;function p(e){c.faxAccountFaxDispositions=e||{count:0,rows:[]}}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){_.remove(c.faxAccountFaxDispositions.rows,{id:e.id}),c.faxAccountFaxDispositions.count-=1,c.faxAccountFaxDispositions.rows.length||c.getFaxAccountFaxDispositions(),r.success({title:"FaxDisposition deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETfaxAccount"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getFaxAccountFaxDispositions())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.fax").controller("FaxAccountFaxDispositionsController",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(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_FAXDISPOSITION",g.faxDisposition=angular.copy(l),g.faxDispositions=r,g.newFaxDisposition=!1,g.faxDisposition||(g.faxDisposition={},g.title="FAX.NEW_FAXDISPOSITION",g.newFaxDisposition=!0),t.params.id&&(g.faxDisposition.FaxAccountId=t.params.id),g.addNewFaxDisposition=function(){g.errors=[],d.disposition.save(g.faxDisposition).$promise.then(function(e){g.faxDispositions.unshift(e.toJSON()),o.success({title:"FaxDisposition properly created",msg:g.faxDisposition.name?g.faxDisposition.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.disposition.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveFaxDisposition=function(){g.errors=[],d.disposition.update({id:g.faxDisposition.id},g.faxDisposition).$promise.then(function(e){var t=_.find(g.faxDispositions,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"FaxDisposition properly saved!",msg:g.faxDisposition.name?g.faxDisposition.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.disposition.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteFaxDisposition=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The faxDisposition will be deleted.").ariaLabel("Delete FaxDisposition").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.disposition.delete({id:g.faxDisposition.id}).$promise.then(function(){_.remove(g.faxDispositions,{id:g.faxDisposition.id}),o.success({title:"FaxDisposition properly deleted!",msg:(g.faxDisposition.name||"faxDisposition")+" has been deleted!"}),v(g.faxDisposition)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.disposition.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.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","faxDispositions","faxDisposition","api","Auth","license","setting","crudPermissions"],angular.module("app.fax").controller("CreateOrEditFaxDispositionDialogController",e)}(),function(){"use strict";function e(e,a,t,n,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.faxAccount={},c.faxAccountInteractions={count:0,rows:[]},c.selectedFaxAccountInteractions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,Contact.firstName,Owner.name,closedAt,disposition,note,UserId,ContactId,FaxAccountId,tag",sort:"-createdAt",includeAll:"true",limit:10,page:1},c.init=function(e,t){c.faxAccount=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.faxAccount.id,c.getFaxAccountInteractions()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.faxInteractionDownload=function(s,e,t){return l.faxInteraction.download({id:s.id,exists:!0,attachments:t}).$promise.then(function(e){var t=[e.buffer],n="interaction"+s.id,a=new Blob(t,{type:e.type});n="fax-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.success=p,c.getFaxAccountInteractions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.faxAccount.getInteractions(c.query,p).$promise},c.createOrEditFaxAccountInteraction=function(e,t){s.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/interactions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxAccount:c.faxAccount,interaction:t,interactions:c.faxAccountInteractions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.spyfaxInteraction=function(e,n){s.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,t){e.vm.init({id:1,channel:"fax",interaction:n,spy:!0},a.$parent.vm.setting)}})},c.exportSelectedFaxAccountInteractions=function(){var e=angular.copy(c.selectedFaxAccountInteractions);return c.selectedFaxAccountInteractions=[],e},c.deleteFaxAccountInteraction=g,c.deleteSelectedFaxAccountInteractions=function(e){var t=s.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+c.selectedFaxAccountInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedFaxAccountInteractions.forEach(function(e){g(e)}),c.selectedFaxAccountInteractions=[]})};var m=!0,u=1;function p(e){c.faxAccountInteractions=e||{count:0,rows:[]}}function g(e){l.faxInteraction.delete({id:e.id}).$promise.then(function(){_.remove(c.faxAccountInteractions.rows,{id:e.id}),c.faxAccountInteractions.count-=1,c.faxAccountInteractions.rows.length||c.getFaxAccountInteractions(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETfaxAccount"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}a.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getFaxAccountInteractions())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.fax").controller("FaxAccountInteractionsController",e)}(),function(){"use strict";function e(n,e,a,i,s,t,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=t,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.faxAccount=c||n.params.faxAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=n.params.tab||0,u.gotogoto=function(e,t){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:910}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.fax.realtime.accounts",{})}},u.agentadddialog=function(e,t){a.show({controller:"FaxAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:t,clickOutsideToClose:!0,locals:{faxAccount:e,faxAccounts:u.faxAccounts?u.faxAccounts.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoFaxAccounts=function(){n.go("app.fax.faxAccounts")},u.saveFaxAccount=function(){r.faxAccount.updateAccountApplications(u.faxAccount).$promise.then(function(){l.success({title:"FaxAccount updated!",msg:u.faxAccount.name?u.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){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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.trunks,{id:e.resourceId})}),n=null;if(u.faxAccount&&(n=_.find(u.trunks,{id:Number(u.faxAccount.TrunkId)})),n&&!_.some(t,["id",n.id])){var a=_.find(u.trunks,{id:n.id});a.canSelect=!1,t.push(a)}u.trunks=t})}else{var n=[],a=null;u.faxAccount&&(a=_.find(u.trunks,{id:Number(u.faxAccount.TrunkId)}));for(var i=0;i<u.trunks.length;i++)a&&u.trunks[i].id===a.id&&(u.trunks[i].canSelect=!1,n.push(u.trunks[i]));u.trunks=n}}).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){u.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){u.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.lists,{id:e.resourceId})}),n=null;if(u.faxAccount&&(n=_.find(u.lists,{id:Number(u.faxAccount.ListId)})),n&&!_.some(t,["id",n.id])){var a=_.find(u.lists,{id:n.id});a.canSelect=!1,t.push(a)}u.lists=t})}else{var n=[],a=null;u.faxAccount&&(a=_.find(u.lists,{id:Number(u.faxAccount.ListId)}));for(var i=0;i<u.lists.length;i++)a&&u.lists[i].id===a.id&&(u.lists[i].canSelect=!1,n.push(u.lists[i]));u.lists=n}}).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){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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.pauses,{id:e.resourceId})});u.pauses.forEach(function(e){_.some(t,["id",e.id])||(e.canSelect=!1),t.push(e)}),u.pauses=t})}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","faxAccount","userProfileSection"],angular.module("app.fax").controller("FaxAccountController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.faxAccounts=l||{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="faxAccounts",b.listOrder="",b.listOrderAsc=null,b.selectedFaxAccounts=[],b.query={fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,ecm,minrate,maxrate,modem,gateway,faxdetect,t38timeout,tech,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,page:1},b.arrayecm=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.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"),"")}),b.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"),"")}),b.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"),"")}),b.editstate=function(e,t){n.go("app.fax.faxAccounts.edit",{id:e.id,faxAccount:e,crudPermissions:b.crudPermissions})},b.interactionsgoto=function(e,t){n.go("app.fax.faxAccounts.edit",{id:e.id,tab:5})},b.gotorealtimegoto=function(e,t){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:910}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.fax.realtime.accounts",{})}},b.agentadddialog=function(e,t){i.show({controller:"FaxAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{faxAccount:e,faxAccounts:b.faxAccounts?b.faxAccounts.rows:[],crudPermissions:b.crudPermissions,realtime:!1}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getFaxAccounts=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.faxAccount.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="FaxAccounts",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditFaxAccount=function(e,t){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:t,faxAccounts:b.faxAccounts.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteFaxAccount=S,b.exportSelectedFaxAccounts=function(){var e=angular.copy(b.selectedFaxAccounts);return b.selectedFaxAccounts=[],e},b.deleteSelectedFaxAccounts=function(e){var t=i.confirm().title("Are you sure want to delete the selected faxAccounts?").htmlContent("<b>"+b.selectedFaxAccounts.length+" selected</b> will be deleted.").ariaLabel("delete FaxAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedFaxAccounts.forEach(function(e){S(e)}),b.selectedFaxAccounts=[]})},b.deselectFaxAccounts=function(){b.selectedFaxAccounts=[]},b.selectAllFaxAccounts=function(){b.selectedFaxAccounts=b.faxAccounts.rows},g.hasRole("admin")?m.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){b.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){b.trunks=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(b.trunks,{id:e.resourceId})}),a=null;a=[],b.faxAccounts.rows.forEach(function(e){var t=_.find(b.trunks,{id:Number(e.TrunkId)});a.push(t)}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(b.trunks,{id:e.id});t.canSelect=!1,n.push(t)}}),b.trunks=n})}else{var n=[],a=[];b.faxAccounts.rows.forEach(function(e){var t=_.find(b.trunks,{id:Number(e.TrunkId)});a.push(t)});for(var i=0;i<b.trunks.length;i++){_.some(a,{id:b.trunks[i].id})&&(b.trunks[i].canSelect=!1,n.push(b.trunks[i]))}b.trunks=n}}).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){b.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){b.lists=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(b.lists,{id:e.resourceId})}),n=null;if(b.faxAccount&&(n=_.find(b.lists,{id:Number(b.faxAccount.ListId)})),n&&!_.some(t,["id",n.id])){var a=_.find(b.lists,{id:n.id});a.canSelect=!1,t.push(a)}b.lists=t})}else{var n=[],a=null;b.faxAccount&&(a=_.find(b.lists,{id:Number(b.faxAccount.ListId)}));for(var i=0;i<b.lists.length;i++)a&&b.lists[i].id===a.id&&(b.lists[i].canSelect=!1,n.push(b.lists[i]));b.lists=n}}).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 E=!0,A=1;function y(e){b.faxAccounts=e||{count:0,rows:[]}}function S(e){m.faxAccount.delete({id:e.id}).$promise.then(function(){_.remove(b.faxAccounts.rows,{id:e.id}),b.faxAccounts.count-=1,b.faxAccounts.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEfaxAccount"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getFaxAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","faxAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.fax").controller("FaxAccountsController",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(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_FAXQUEUE",g.faxQueue=angular.copy(l),g.faxQueues=r,g.newFaxQueue=!1,g.faxQueue||(g.faxQueue={strategy:"beepall",timeout:10},g.title="FAX.NEW_FAXQUEUE",g.newFaxQueue=!0),g.addNewFaxQueue=function(){g.errors=[],d.faxQueue.save(g.faxQueue).$promise.then(function(e){g.faxQueues.unshift(e.toJSON()),o.success({title:"FaxQueue properly created",msg:g.faxQueue.name?g.faxQueue.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.faxQueue.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveFaxQueue=function(){g.errors=[],d.faxQueue.update({id:g.faxQueue.id},g.faxQueue).$promise.then(function(e){var t=_.find(g.faxQueues,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"FaxQueue properly saved!",msg:g.faxQueue.name?g.faxQueue.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.faxQueue.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteFaxQueue=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The faxQueue will be deleted.").ariaLabel("Delete FaxQueue").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.faxQueue.delete({id:g.faxQueue.id}).$promise.then(function(){_.remove(g.faxQueues,{id:g.faxQueue.id}),o.success({title:"FaxQueue properly deleted!",msg:(g.faxQueue.name||"faxQueue")+" has been deleted!"}),v(g.faxQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.faxQueue.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.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(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","faxQueues","faxQueue","api","Auth","license","setting","crudPermissions"],angular.module("app.fax").controller("CreateOrEditFaxQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,t,n,o,r,l,d){var c=this;function m(){return a(function(n,t){return a(function(t,n){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.faxQueue.getAgents({id:c.faxQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return t.penalty=e.UserFaxQueue?"penalty "+e.UserFaxQueue.penalty:"",t.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=l.getCurrentUser(),c.faxQueue=t,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(n,t){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.faxQueue.removeAgents({id:c.faxQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.faxQueue.addAgents({id:c.faxQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,items:[],selectedItems:[],showSelectAndDeselectAll:!o,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("FAX.ALL_AGENTS"),labelSelected:r.instant("FAX.SELECTED_AGENTS"),transferCallback:function(e,t){var n=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(n)}}}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,t,n,o,r){var l=this;function d(){return a(function(n,t){return a(function(t,n){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:l.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return l.allowedItems=_.map(t,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var t=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.faxQueue.getTeams({id:l.faxQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];l.selectedItems=_.map(t,function(e){return _.find(l.items,{id:e.id})}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}l.currentUser=o.getCurrentUser(),l.faxQueue=t,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={readOnly:!l.crudPermissions.canEdit,allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!0,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:n.instant("FAX.ALL_TEAMS"),labelSelected:n.instant("FAX.SELECTED_TEAMS"),transferCallback:function(e,t){var n=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(n)}},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(n,t){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.faxQueue.removeTeams({id:l.faxQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.faxQueue.addTeams({id:l.faxQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},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,t,n,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=t.protocol()+"://"+t.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,t){n.show({controller:"FaxQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{faxQueue:e,faxQueues:u.faxQueues?u.faxQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,t){n.show({controller:"FaxQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:t,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")},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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.faxQueues=l||{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="faxQueues",b.listOrder="",b.listOrderAsc=null,b.selectedFaxQueues=[],b.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"fax",limit:10,page:1},b.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.fax.faxQueues.edit",{id:e.id,faxQueue:e,crudPermissions:b.crudPermissions})},b.teamadddialog=function(e,t){i.show({controller:"FaxQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{faxQueue:e,faxQueues:b.faxQueues?b.faxQueues.rows:[],crudPermissions:b.crudPermissions}})},b.agentadddialog=function(e,t){i.show({controller:"FaxQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{faxQueue:e,faxQueues:b.faxQueues?b.faxQueues.rows:[],crudPermissions:b.crudPermissions,realtime:!1}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.gotorealtimegoto=function(e,t){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:910}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.fax.realtime.queues",{})}},b.success=y,b.getFaxQueues=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.faxQueue.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="FaxQueues",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditFaxQueue=function(e,t){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:t,faxQueues:b.faxQueues.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteFaxQueue=S,b.exportSelectedFaxQueues=function(){var e=angular.copy(b.selectedFaxQueues);return b.selectedFaxQueues=[],e},b.deleteSelectedFaxQueues=function(e){var t=i.confirm().title("Are you sure want to delete the selected faxQueues?").htmlContent("<b>"+b.selectedFaxQueues.length+" selected</b> will be deleted.").ariaLabel("delete FaxQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedFaxQueues.forEach(function(e){S(e)}),b.selectedFaxQueues=[]})},b.deselectFaxQueues=function(){b.selectedFaxQueues=[]},b.selectAllFaxQueues=function(){b.selectedFaxQueues=b.faxQueues.rows};var E=!0,A=1;function y(e){b.faxQueues=e||{count:0,rows:[]}}function S(e){m.faxQueue.delete({id:e.id}).$promise.then(function(){_.remove(b.faxQueues.rows,{id:e.id}),b.faxQueues.count-=1,b.faxQueues.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEfaxQueue"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getFaxQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","faxQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.fax").controller("FaxQueuesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){_.forIn(p.faxAccounts,function(e,t){p.rpcFaxAccounts[t]&&_.merge(e,p.rpcFaxAccounts[t])}),_.forIn(p.faxAccounts,function(t,e){var n={id:e,sort:"-id",direction:"in",limit:1,offset:0,$gte:"createdAt,"+moment().startOf("day").format("YYYY-MM-DD HH:mm:ss")};s.faxAccount.getMessages(n).$promise.then(function(e){return e&&(t.in=e.count||0,t.lastIn=e.rows&&e.rows.length?e.rows[0].createdAt:void 0),n.direction="out",s.faxAccount.getMessages(n).$promise}).then(function(e){e&&(t.out=e.count||0,t.lastOut=e.rows&&e.rows.length?e.rows[0].createdAt:void 0)}).catch(function(e){console.log(e)})})}p.currentUser=u.getCurrentUser(),p.count=l&&l.count?l.count:0,p.faxAccounts=l?_.keyBy(l.rows?l.rows:[],"id"):{},p.rpcFaxAccounts=d?_.keyBy(d.rows?d.rows:[],"id"):{},p.userProfile=c,p.userProfileSection=m&&1==m.count?m.rows[0]:null,p.crudPermissions=u.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.query={sort:"-name",limit:10,page:1},p.success=f,p.$onInit=g,p.getFaxAccounts=function(){p.query.offset=(p.query.page-1)*p.query.limit,u.hasRole("admin")?p.promise=s.faxAccount.get(p.query,f).$promise:(p.query.id=p.userProfile.id,p.query.section="FaxAccounts",p.promise=s.userProfile.getResources(p.query,f).$promise)},p.onSave=function(e){p.faxAccounts[e.id]&&_.merge(p.faxAccounts[e.id],e)},p.onFaxMessageSave=function(e){p.faxAccounts[e.FaxAccountId]&&("in"==e.direction?(p.faxAccounts[e.FaxAccountId].in+=1,p.faxAccounts[e.FaxAccountId].lastIn=e.createdAt):(p.faxAccounts[e.FaxAccountId].out+=1,p.faxAccounts[e.FaxAccountId].lastOut=e.createdAt))},p.goToFaxAccount=function(e,t){i.go("app.fax.faxAccounts.edit",{id:t.id,faxAccount:t})},p.order=[],_.forIn(p.faxAccounts,function(e,t){p.order.push(e.id)}),o.on("faxAccount:save",p.onSave),o.on("faxAccount:update",p.onSave),o.on("faxMessage:save",p.onFaxMessageSave);var v=!0,h=1;function f(e){if(p.faxAccounts=e?_.keyBy(e.rows?e.rows:[],"id"):{},e.rows){p.order=[];for(var t=0;t<e.rows.length;t++)p.order.push(e.rows[t].id)}g()}e.$watch("vm.query.filter",function(e,t){v?n(function(){v=!1}):(t||(h=p.query.page),e!==t&&(p.query.page=1),e||(p.query.page=h),p.getFaxAccounts())}),e.$on("$destroy",function(){o.removeAllListeners("faxAccount:save"),o.removeAllListeners("faxAccount:update"),o.removeAllListeners("faxMessage:save")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$state","api","socket","toasty","faxAccounts","rpcFaxAccounts","userProfile","userProfileSection","Auth"],angular.module("app.fax").controller("FaxAccountsRealtimeController",e)}(),function(){"use strict";function e(e,o,t,n,a,i,s,r,l,d,c,m,u,p,g,v,h,f){var b=this,E=["userpic","online","lastLoginAt","lastPauseAt","pauseType","lastPauseAt","internal","address","chatPause","openchannelPause","mailPause","smsPause","faxPause","voicePause","chatCapacity","openchannelCapacity","mailCapacity","smsCapacity","faxCapacity","chatCurrentCapacity","openchannelCurrentCapacity","mailCurrentCapacity","smsCurrentCapacity","faxCurrentCapacity","chatStatus","openchannelStatus","mailStatus","smsStatus","faxStatus","voiceStatus","chatStatusTime","openchannelStatusTime","mailStatusTime","smsStatusTime","faxStatusTime","voiceStatusTime","queue","destconnectedlinenum","onhold"],A=["chatPause","openchannelPause","mailPause","smsPause","faxPause","voicePause","online"];for(var y in b.currentUser=v.getCurrentUser(),b.availableStates=["ringing","inuse","busy","onhold","not_inuse"],b.pauses=s||{count:0,rows:[]},b.license=h,b.userProfile=p,b.userProfileSection=g&&1==g.count?g.rows[0]:null,b.crudPermissions=v.parseCrudPermissions(b.userProfileSection?b.userProfileSection.crudPermissions:null),b.agents=r?_.keyBy(r.rows?r.rows:[],"id"):{},b.rpcAgents=l?_.keyBy(l.rows?l.rows:[],"id"):{},b.paginatedAgents={},b.load=!1,b.order=[],b.agentInternal={},b.agents)b.agents.hasOwnProperty(y)&&(b.agents[y].init=!0);b.query={limit:10,page:1,order:"fullname",globalStatusFilter:"",pauseTypeFilter:""},b.logout=function(e,t){return d.user.logout({id:e.id,device:"realtime",agent_id:e.id,agent_name:e.name}).$promise.then(function(){m.success({title:"Agent logout",msg:e.fullname+"  properly logout"}),b.agents[e.id]&&(b.agents[e.id].online=!1),b.rpcAgents[e.id]&&(b.rpcAgents[e.id].online=!1),T()}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.queueAdd=function(e,t){n.show({controller:"AgentqueueaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/queueadd/queueadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{agent:e,agents:[],channel:"fax",direction:"inbound",crudPermissions:b.crudPermissions}})},b.pause=function(t,e){return d.user.pause({id:t.id,type:e}).$promise.then(function(e){b.agents[t.id]&&_.merge(b.agents[t.id],_.pick(e,E)),b.rpcAgents[t.id]&&_.merge(b.rpcAgents[t.id],_.pick(e,E)),O(b.agents[t.id])}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.unPause=function(t){return d.user.unpause({id:t.id}).$promise.then(function(e){b.agents[t.id]&&_.merge(b.agents[t.id],_.pick(e,E)),b.rpcAgents[t.id]&&_.merge(b.rpcAgents[t.id],_.pick(e,E)),O(b.agents[t.id])}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.showInfo=function(e){n.show(n.alert().clickOutsideToClose(!0).title("Legend").htmlContent("<div>TODO legend status + state</div>").ok("Ok").targetEvent(e))},b.getAgentStatus=w,b.getAgentGlobalStatus=O,b.isPause=I,b.checkPause=function(e){return"pause"===e},b.isPartialPause=function(e){return"*pause"===e},b.onSave=function(e){b.agents[e.id]&&(_.merge(b.agents[e.id],_.pick(_.omit(e,A),E)),_.merge(b.rpcAgents[e.id],_.pick(_.omit(e,A),E)),O(b.agents[e.id]))},b.onUpdate=function(e){b.agents[e.id]&&(_.merge(b.agents[e.id],_.pick(e,E)),_.merge(b.rpcAgents[e.id],_.pick(e,E)),e.lastPauseAt&&(b.agents[e.id].globalStatusTime=e.lastPauseAt,b.rpcAgents[e.id].globalStatusTime=e.lastPauseAt),O(b.agents[e.id]))},b.onInit=T,b.onConnect=function(e){b.agents[b.agentInternal[e.destaccountcode]]&&(_.merge(b.agents[b.agentInternal[e.destaccountcode]],_.pick(e,["queue","destconnectedlinenum"])),_.merge(b.rpcAgents[b.agentInternal[e.destaccountcode]],_.pick(e,["queue","destconnectedlinenum"])))},b.onComplete=function(e){b.agents[b.agentInternal[e.destaccountcode]]&&(b.agents[b.agentInternal[e.destaccountcode]]=_.omit(b.agents[b.agentInternal[e.destaccountcode]],["queue","destconnectedlinenum"]),b.rpcAgents[b.agentInternal[e.destaccountcode]]=_.omit(b.rpcAgents[b.agentInternal[e.destaccountcode]],["queue","destconnectedlinenum"]))},c.on("user:save",b.onSave),c.on("user:update",b.onUpdate),c.on("user:agentconnect",b.onConnect),c.on("user:agentcomplete",b.onComplete),T();var S=f(function(){b.load&&(b.load=!1,T())},999);function T(e){b.load=!1;var t,n,a=o.defer();b.promise=a.promise,b.filteredAgents=[],b.order=[],_.forIn(b.agents,function(e,t){b.rpcAgents[t]&&_.merge(e,_.pick(_.omit(b.rpcAgents[t],A),E)),O(e),e.online?(b.filteredAgents.push(e),b.agentInternal[e.internal]=t):e.globalStatusTime=_.toNumber(moment().format("x"))}),b.query.globalStatusFilter&&_.remove(b.filteredAgents,function(e){return e.globalStatus!==b.query.globalStatusFilter}),b.query.pauseTypeFilter&&_.remove(b.filteredAgents,function(e){return e.pauseType!==b.query.pauseTypeFilter}),b.query.filter&&_.remove(b.filteredAgents,function(e){return e.fullname.toLowerCase().indexOf(b.query.filter.toLowerCase())<0}),b.filteredAgents=(t=b.filteredAgents,n=_.startsWith(b.query.order,"-")?"desc":"asc",_.orderBy(t,[b.query.order.replace("-","")],[n]));var i=(b.query.page-1)*b.query.limit;b.paginatedAgents=_.drop(b.filteredAgents,i).slice(0,b.query.limit);for(var s=0;s<b.paginatedAgents.length;s+=1)b.order.push(b.paginatedAgents[s].id);a.resolve(),b.load=!0}function I(e){return"pause"===e||"*pause"===e}function C(e){return"idle"===e||"unknown"===e||"unavailable"===e||"ringing"===e||_.isNil(e)}function w(e,t){return"voice"===t?"idle"!==e[t+"Status"]?e[t+"Status"]:e[t+"Pause"]?e[t+"Status"]="pause":"idle":e[t+"Pause"]?e[t+"Status"]="pause":e[t+"Status"]}function O(e){var t="unknown";t=_.every([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],I)?"pause":_.some([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],I)?"*pause":_.every([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],C)?"idle":"busy",e.globalStatus!==t&&(e.globalStatus=t,e.init?(e.init=!1,e.globalStatusTime=I(t)?_.toNumber(moment(e.lastPauseAt).format("x")):_.max([e.voiceStatusTime,e.chatStatusTime,e.mailStatusTime,e.smsStatusTime,e.openchannelStatusTime,e.faxStatusTime])):e.globalStatusTime=_.toNumber(moment().format("x")))}e.$on("$destroy",function(){c.removeAllListeners("user:save"),c.removeAllListeners("user:update"),c.removeAllListeners("user:agentconnect"),c.removeAllListeners("user:agentcomplete"),S&&(f.cancel(S),S=null)})}e.$inject=["$scope","$q","$timeout","$mdDialog","$document","$filter","pauses","agents","rpcAgents","api","socket","toasty","helperClasses","userProfile","userProfileSection","Auth","license","$interval"],angular.module("app.voice").controller("AgentsFaxRealtimeController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this,v=["loggedIn","available","waiting","talking","pTalking","originated","message","dialActive","dialMethod","Trunk","paused"];function h(){var n=[];return _.forIn(g.queues,function(e,t){e.paused=0,e.loggedInDb=0,g.queues[t].agents={},n.push(l.faxQueue.getMembers({id:t}).$promise),g.rpcQueues[t]&&_.merge(e,_.pick(g.rpcQueues[t],v))}),t.all(n).then(function(e){for(var t=0;t<e.length;t+=1)for(var n=0;n<e[t].rows.length;n++)e[t].rows[n].paused&&g.queues[e[t].rows[n].FaxQueueId].paused++,g.queues[e[t].rows[n].FaxQueueId].loggedInDb++,g.queues[e[t].rows[n].FaxQueueId].agents[e[t].rows[n].UserId]=e[t].rows[n].FaxQueueId}).catch(function(e){console.error(e)})}g.currentUser=p.getCurrentUser(),g.count=o.count?o.count:0,g.queues=o?_.keyBy(o.rows?o.rows:[],"id"):{},g.rpcQueues=r?_.keyBy(r.rows?r.rows:[],"id"):{},g.userProfile=m,g.userProfileSection=u&&1==u.count?u.rows[0]:null,g.crudPermissions=p.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),p.hasRole("admin")?g.query={type:"inbound",sort:"-updatedAt",limit:10,page:1}:g.query={id:g.currentUser.id,channel:"fax",type:"inbound",sort:"-updatedAt",limit:10,page:1},g.success=E,g.getQueues=function(){g.query.offset=(g.query.page-1)*g.query.limit,p.hasRole("admin")?g.promise=l.faxQueue.get(g.query,E).$promise:(g.query.id=g.userProfile.id,g.query.section="FaxQueues",g.promise=l.userProfile.getResources(g.query,E).$promise)},g.createOrEditFaxQueue=function(e,t){a.show({controller:"CreateOrEditFaxQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxQueue:t,faxQueues:_.values(g.queues),license:null,setting:null,crudPermissions:g.crudPermissions}})},g.agentAdd=function(e,t){a.show({controller:"FaxQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxQueue:t,faxQueues:g.queues?g.queues.rows:[],realtime:!1,crudPermissions:g.crudPermissions}})},g.updateQueue=function(e){return l.faxQueue.update(e).$promise.then(function(){c.success({title:"Queue properly updated!",msg:e.name?e.name+" has been updated!":""})}).catch(function(e){c.error({title:"Error creating queue!",msg:e.message})})},g.onSave=function(e){g.queues[e.id]&&_.merge(g.queues[e.id],_.pick(e,v))},g.onSaveMember=function(e){g.queues[e.FaxQueueId]&&g.queues[e.FaxQueueId].loggedInDb++},g.onRemoveMember=function(e){g.queues[e.FaxQueueId]&&g.queues[e.FaxQueueId].loggedInDb--},g.onPause=function(n){console.log("onPause",n),n.voicePause?_.forIn(g.queues,function(e,t){e.agents[n.id]&&(e.paused+=1,console.log("pause"))}):n.voicePause||_.forIn(g.queues,function(e,t){e.agents[n.id]&&0<e.paused&&(e.paused-=1,console.log("unpause"))})},g.onLogin=function(e){console.log("onLogged",e),g.queues[e.FaxQueueId]&&(g.queues[e.FaxQueueId].loggedInDb+=1,g.queues[e.FaxQueueId].agents[e.UserId]=e.FaxQueueId)},g.onLogout=function(e){console.log("onLogout",e),g.queues[e.FaxQueueId]&&0<g.queues[e.FaxQueueId].loggedInDb&&(g.queues[e.FaxQueueId].loggedInDb-=1,delete g.queues[e.FaxQueueId].agents[e.UserId])},g.$onInit=h,g.order=[],_.forIn(g.queues,function(e,t){g.order.push(e.id)}),d.on("fax_queue:save",g.onSave),d.on("userFaxQueue:save",g.onSaveMember),d.on("userFaxQueue:remove",g.onRemoveMember),d.on("user:update",g.onPause),d.on("userVoiceQueue:remove",g.onLogout),d.on("userVoiceQueue:save",g.onLogin);var f=!0,b=1;function E(e){if(g.count=e.count,g.queues=e?_.keyBy(e.rows?e.rows:[],"id"):{},e.rows){g.order=[];for(var t=0;t<e.rows.length;t++)g.order.push(e.rows[t].id)}h()}e.$watch("vm.query.filter",function(e,t){f?n(function(){f=!1}):(t||(b=g.query.page),e!==t&&(g.query.page=1),e||(g.query.page=b),g.getQueues())}),e.$on("$destroy",function(){d.removeAllListeners("fax_queue:save"),d.removeAllListeners("userFaxQueue:remove"),d.removeAllListeners("userFaxQueue:save"),d.removeAllListeners("user:update"),d.removeAllListeners("userVoiceQueue:remove"),d.removeAllListeners("userVoiceQueue:save")})}e.$inject=["$scope","$timeout","$mdDialog","$q","$document","$interval","queues","rpcQueues","api","socket","toasty","userProfile","userProfileSection","Auth"],angular.module("app.fax").controller("QueuesFaxRealtimeController",e)}(),function(){"use strict";angular.module("app.auth").factory("helperClasses",function(){return{status:{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"},state:{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"},channelStatus:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},channelStatusOut:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"}}})}(),function(){"use strict";function e(e,n,t){switch(t.disconnect(),t.connect(),this.selectedTab=0,n.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,n.go("app.fax.realtime.agents")}e.$watch("vm.selectedTab",function(e,t){if(e!==t)switch(e){case 0:n.go("app.fax.realtime.agents");break;case 1:n.go("app.fax.realtime.trunks");break;case 2:n.go("app.fax.realtime.queues");break;case 3:n.go("app.fax.realtime.accounts");break;default:n.go("app.fax.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.fax").controller("FaxRealtimeController",e)}(),function(){"use strict";function e(e,n,t,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,t=0;t<u.trunks.length;t+=1)0<=(e=_.findIndex(u.rpcTrunks,["id",u.trunks[t].id]))&&_.merge(u.trunks[t],_.pick(u.rpcTrunks[e],p))}function v(e,t,n){0<=t&&_.merge(e[t],_.pick(n,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:"-updatedAt",limit:10,page:1},u.statusClass=r.status,u.stateClass=r.state,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){t.show(t.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,t){l.go("app.tools.trunks.edit",{id:t.id})},u.onSave=function(e){var t=_.findIndex(u.trunks,["id",e.id]),n=_.findIndex(u.rpcTrunks,["id",e.id]);v(u.trunks,t,e),v(u.rpcTrunks,n,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,t){h?n(function(){h=!1}):(t||(f=u.query.page),e!==t&&(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","helperClasses","$state","userProfile","userProfileSection","Auth"],angular.module("app.fax").controller("TrunksFaxRealtimeController",e)}(),function(){"use strict";function e(e,t){this.info=e,this.license=t}e.$inject=["info","license"],angular.module("app.help.about").controller("AboutController",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(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:n.protocol()+"://"+n.host()+(n.port()?":"+n.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.deskAccounts,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The deskAccount will be deleted.").ariaLabel("Delete DeskAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.deskAccounts=l||{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="deskAccounts",b.listOrder="",b.listOrderAsc=null,b.selectedDeskAccounts=[],b.query={fields:"createdAt,updatedAt,id,name,type,remoteUri,authType,username,password,serverUrl,description",limit:10,page:1},b.arraytype=_.keyBy([{option:"Integration_Tab",value:"'integrationTab'"},{option:"New_Tab",value:"'newTab'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arrayauthType=_.keyBy([{option:"Basic",value:"'basic'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.integrations.deskAccounts.edit",{id:e.id,deskAccount:e,crudPermissions:b.crudPermissions})},b.testtestintegrationaccount=function(e,t){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()})})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getDeskAccounts=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.intDeskAccount.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="DeskAccounts",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditDeskAccount=function(e,t){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:t,deskAccounts:b.deskAccounts.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteDeskAccount=S,b.exportSelectedDeskAccounts=function(){var e=angular.copy(b.selectedDeskAccounts);return b.selectedDeskAccounts=[],e},b.deleteSelectedDeskAccounts=function(e){var t=i.confirm().title("Are you sure want to delete the selected deskAccounts?").htmlContent("<b>"+b.selectedDeskAccounts.length+" selected</b> will be deleted.").ariaLabel("delete DeskAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedDeskAccounts.forEach(function(e){S(e)}),b.selectedDeskAccounts=[]})},b.deselectDeskAccounts=function(){b.selectedDeskAccounts=[]},b.selectAllDeskAccounts=function(){b.selectedDeskAccounts=b.deskAccounts.rows};var E=!0,A=1;function y(e){b.deskAccounts=e||{count:0,rows:[]}}function S(e){m.intDeskAccount.delete({id:e.id}).$promise.then(function(){_.remove(b.deskAccounts.rows,{id:e.id}),b.deskAccounts.count-=1,b.deskAccounts.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintDeskAccount"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getDeskAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","deskAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.integrations").controller("DeskAccountsController",e)}(),function(){"use strict";function e(a,n,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,t){o.deskAccount=e,o.crudPermissions=void 0!==t?t:{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,t){a.show({controller:"CreateOrEditDeskConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/deskAccounts/edit/configurations/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{deskConfiguration:t,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getDeskConfiguration(0)})},o.deleteDeskConfiguration=function(e,t){var n=a.confirm().title("Are you sure want to delete the deskConfiguration?").htmlContent("<b>"+(t.name||"deskConfiguration")+"</b> will be deleted.").ariaLabel("delete deskConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){i.intDeskConfiguration.delete({id:t.id}).$promise.then(function(){_.remove(o.configurations,{id:t.id}),s.success({title:"DeskConfiguration deleted!",msg:t.name?t.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.selectChangedAdvanced=function(){return i.intSalesforceConfiguration.update({id:o.deskConfiguration.id},o.deskConfiguration).$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.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,t){a.show({controller:"CreateOrEditDeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/deskAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:t,items:o.subjects,configuration:o.deskConfiguration,account:o.deskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,t){var n=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(n).then(function(){r(t)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var t=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(t).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,t){a.show({controller:"CreateOrEditDeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/deskAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:t,items:o.descriptions,configuration:o.deskConfiguration,account:o.deskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,t){var n=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(n).then(function(){l(t)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var t=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(t).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,t){a.show({controller:"CreateOrEditDeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/deskAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:t,items:o.fields,configuration:o.deskConfiguration,account:o.deskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,t){var n=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(n).then(function(){d(t)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var t=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(t).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,t,n,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:t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.configurations,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The deskConfiguration will be deleted.").ariaLabel("Delete DeskConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,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 t=_.find(p.items,{id:e.id});t&&_.merge(t,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 t=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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}).$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,t,n,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=t.protocol()+"://"+t.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")},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,t,n,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_DYNAMICS365ACCOUNT",g.dynamics365Account=angular.copy(l),g.dynamics365Accounts=r,g.newDynamics365Account=!1,g.dynamics365Account||(g.dynamics365Account={serverUrl:n.protocol()+"://"+n.host()+(n.port()?":"+n.port():"")},g.title="INTEGRATIONS.NEW_DYNAMICS365ACCOUNT",g.newDynamics365Account=!0),g.addNewDynamics365Account=function(){g.errors=[],d.intDynamics365Account.save(g.dynamics365Account).$promise.then(function(e){g.dynamics365Accounts.unshift(e.toJSON()),o.success({title:"Dynamics365Account properly created",msg:g.dynamics365Account.name?g.dynamics365Account.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.intDynamics365Account.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})})},g.saveDynamics365Account=function(){g.errors=[],d.intDynamics365Account.update({id:g.dynamics365Account.id},g.dynamics365Account).$promise.then(function(e){var t=_.find(g.dynamics365Accounts,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"Dynamics365Account properly saved!",msg:g.dynamics365Account.name?g.dynamics365Account.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.intDynamics365Account.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})})},g.deleteDynamics365Account=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The dynamics365Account will be deleted.").ariaLabel("Delete Dynamics365Account").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.intDynamics365Account.delete({id:g.dynamics365Account.id}).$promise.then(function(){_.remove(g.dynamics365Accounts,{id:g.dynamics365Account.id}),o.success({title:"Dynamics365Account properly deleted!",msg:(g.dynamics365Account.name||"dynamics365Account")+" has been deleted!"}),v(g.dynamics365Account)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDynamics365Account.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","dynamics365Accounts","dynamics365Account","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditDynamics365AccountDialogController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.dynamics365Accounts=l||{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="dynamics365Accounts",b.listOrder="",b.listOrderAsc=null,b.selectedDynamics365Accounts=[],b.query={fields:"createdAt,updatedAt,id,name,username,password,remoteUri,tenantId,clientId,clientSecret,serverUrl,description",limit:10,page:1},b.editstate=function(e,t){n.go("app.integrations.dynamics365Accounts.edit",{id:e.id,dynamics365Account:e,crudPermissions:b.crudPermissions})},b.testtestintegrationaccount=function(e,t){return m.intDynamics365Account.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"Dynamics365Account properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"Dynamics365Account properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getDynamics365Accounts=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.intDynamics365Account.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Dynamics365Accounts",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditDynamics365Account=function(e,t){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:t,dynamics365Accounts:b.dynamics365Accounts.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 t=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(t).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 E=!0,A=1;function y(e){b.dynamics365Accounts=e||{count:0,rows:[]}}function S(e){m.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(),p.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 t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else p.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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getDynamics365Accounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","dynamics365Accounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.integrations").controller("Dynamics365AccountsController",e)}(),function(){"use strict";function e(a,n,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,t){o.dynamics365Account=e,o.crudPermissions=void 0!==t?t:{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.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,t){a.show({controller:"CreateOrEditDynamics365ConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/edit/configurations/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{dynamics365Configuration:t,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getDynamics365Configuration(0)})},o.deleteDynamics365Configuration=function(e,t){var n=a.confirm().title("Are you sure want to delete the dynamics365Configuration?").htmlContent("<b>"+(t.name||"dynamics365Configuration")+"</b> will be deleted.").ariaLabel("delete dynamics365Configuration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){i.intDynamics365Configuration.delete({id:t.id}).$promise.then(function(){_.remove(o.configurations,{id:t.id}),s.success({title:"Dynamics365Configuration deleted!",msg:t.name?t.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.selectChangedAdvanced=function(){return i.intSalesforceConfiguration.update({id:o.dynamics365Configuration.id},o.dynamics365Configuration).$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,t){a.show({controller:"CreateOrEditDynamics365AccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:t,items:o.subjects,configuration:o.dynamics365Configuration,account:o.dynamics365Account,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,t){var n=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(n).then(function(){r(t)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var t=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(t).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,t){a.show({controller:"CreateOrEditDynamics365AccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:t,items:o.descriptions,configuration:o.dynamics365Configuration,account:o.dynamics365Account,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,t){var n=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(n).then(function(){l(t)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var t=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(t).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,t){a.show({controller:"CreateOrEditDynamics365AccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:t,items:o.fields,configuration:o.dynamics365Configuration,account:o.dynamics365Account,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,t){var n=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(n).then(function(){d(t)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var t=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(t).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,t,n,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:t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.configurations,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The dynamics365Configuration will be deleted.").ariaLabel("Delete Dynamics365Configuration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,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 t=_.find(p.items,{id:e.id});t&&_.merge(t,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 t=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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}).$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,t,n,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=t.protocol()+"://"+t.host(),u.dynamics365Account=c||e.params.dynamics365Account||{},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.gotoDynamics365Accounts=function(){e.go("app.integrations.dynamics365Accounts")},u.saveDynamics365Account=function(){r.intDynamics365Account.update({id:u.dynamics365Account.id},u.dynamics365Account).$promise.then(function(){l.success({title:"Dynamics365Account updated!",msg:u.dynamics365Account.name?u.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","userProfileSection"],angular.module("app.integrations").controller("Dynamics365AccountController",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(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:n.protocol()+"://"+n.host()+(n.port()?":"+n.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.freshdeskAccounts,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The freshdeskAccount will be deleted.").ariaLabel("Delete FreshdeskAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,n,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,t){o.freshdeskAccount=e,o.crudPermissions=void 0!==t?t:{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,t){a.show({controller:"CreateOrEditFreshdeskConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/configurations/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{freshdeskConfiguration:t,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getFreshdeskConfiguration(0)})},o.deleteFreshdeskConfiguration=function(e,t){var n=a.confirm().title("Are you sure want to delete the freshdeskConfiguration?").htmlContent("<b>"+(t.name||"freshdeskConfiguration")+"</b> will be deleted.").ariaLabel("delete freshdeskConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){i.intFreshdeskConfiguration.delete({id:t.id}).$promise.then(function(){_.remove(o.configurations,{id:t.id}),s.success({title:"FreshdeskConfiguration deleted!",msg:t.name?t.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.selectChangedAdvanced=function(){return i.intSalesforceConfiguration.update({id:o.freshdeskConfiguration.id},o.freshdeskConfiguration).$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.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,t){a.show({controller:"CreateOrEditFreshdeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:t,items:o.subjects,configuration:o.freshdeskConfiguration,account:o.freshdeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,t){var n=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(n).then(function(){r(t)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var t=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(t).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,t){a.show({controller:"CreateOrEditFreshdeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:t,items:o.descriptions,configuration:o.freshdeskConfiguration,account:o.freshdeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,t){var n=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(n).then(function(){l(t)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var t=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(t).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,t){a.show({controller:"CreateOrEditFreshdeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:t,items:o.fields,configuration:o.freshdeskConfiguration,account:o.freshdeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,t){var n=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(n).then(function(){d(t)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var t=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(t).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,t,n,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:t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.configurations,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The freshdeskConfiguration will be deleted.").ariaLabel("Delete FreshdeskConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,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 t=_.find(p.items,{id:e.id});t&&_.merge(t,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 t=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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}).$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,t,n,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=t.protocol()+"://"+t.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")},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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.freshdeskAccounts=l||{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="freshdeskAccounts",b.listOrder="",b.listOrderAsc=null,b.selectedFreshdeskAccounts=[],b.query={fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",limit:10,page:1},b.editstate=function(e,t){n.go("app.integrations.freshdeskAccounts.edit",{id:e.id,freshdeskAccount:e,crudPermissions:b.crudPermissions})},b.testtestintegrationaccount=function(e,t){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()})})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getFreshdeskAccounts=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.intFreshdeskAccount.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="FreshdeskAccounts",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditFreshdeskAccount=function(e,t){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:t,freshdeskAccounts:b.freshdeskAccounts.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteFreshdeskAccount=S,b.exportSelectedFreshdeskAccounts=function(){var e=angular.copy(b.selectedFreshdeskAccounts);return b.selectedFreshdeskAccounts=[],e},b.deleteSelectedFreshdeskAccounts=function(e){var t=i.confirm().title("Are you sure want to delete the selected freshdeskAccounts?").htmlContent("<b>"+b.selectedFreshdeskAccounts.length+" selected</b> will be deleted.").ariaLabel("delete FreshdeskAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedFreshdeskAccounts.forEach(function(e){S(e)}),b.selectedFreshdeskAccounts=[]})},b.deselectFreshdeskAccounts=function(){b.selectedFreshdeskAccounts=[]},b.selectAllFreshdeskAccounts=function(){b.selectedFreshdeskAccounts=b.freshdeskAccounts.rows};var E=!0,A=1;function y(e){b.freshdeskAccounts=e||{count:0,rows:[]}}function S(e){m.intFreshdeskAccount.delete({id:e.id}).$promise.then(function(){_.remove(b.freshdeskAccounts.rows,{id:e.id}),b.freshdeskAccounts.count-=1,b.freshdeskAccounts.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintFreshdeskAccount"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getFreshdeskAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","freshdeskAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.integrations").controller("FreshdeskAccountsController",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(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:n.protocol()+"://"+n.host()+(n.port()?":"+n.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.salesforceAccounts,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The salesforceAccount will be deleted.").ariaLabel("Delete SalesforceAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,n,i,s,e){var o=this;function r(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 l(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 d(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,t){o.salesforceAccount=e,o.crudPermissions=void 0!==t?t:{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.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,t){a.show({controller:"CreateOrEditSalesforceConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/configurations/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{salesforceConfiguration:t,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getSalesforceConfiguration(0)})},o.deleteSalesforceConfiguration=function(e,t){var n=a.confirm().title("Are you sure want to delete the salesforceConfiguration?").htmlContent("<b>"+(t.name||"salesforceConfiguration")+"</b> will be deleted.").ariaLabel("delete salesforceConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){i.intSalesforceConfiguration.delete({id:t.id}).$promise.then(function(){_.remove(o.configurations,{id:t.id}),s.success({title:"SalesforceConfiguration deleted!",msg:t.name?t.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(){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()})})},o.selectedSubjects=[],o.createOrEditSubject=function(e,t){a.show({controller:"CreateOrEditSalesforceAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:t,items:o.subjects,configuration:o.salesforceConfiguration,account:o.salesforceAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,t){var n=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(n).then(function(){r(t)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var t=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(t).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,t){a.show({controller:"CreateOrEditSalesforceAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:t,items:o.descriptions,configuration:o.salesforceConfiguration,account:o.salesforceAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,t){var n=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(n).then(function(){l(t)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var t=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(t).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,t){a.show({controller:"CreateOrEditSalesforceAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:t,items:o.fields,configuration:o.salesforceConfiguration,account:o.salesforceAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,t){var n=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(n).then(function(){d(t)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var t=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(t).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("SalesforceAccountConfigurationsController",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(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"},g.title="INTEGRATIONS.NEW_SALESFORCECONFIGURATION",g.newSalesforceConfiguration=!0),g.addNewSalesforceConfiguration=function(){g.errors=[],d.intSalesforceAccount.addConfiguration({id:t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.configurations,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The salesforceConfiguration will be deleted.").ariaLabel("Delete SalesforceConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,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 t=_.find(p.items,{id:e.id});t&&_.merge(t,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 t=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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}).$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,t,n,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=t.protocol()+"://"+t.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")},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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.salesforceAccounts=l||{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="salesforceAccounts",b.listOrder="",b.listOrderAsc=null,b.selectedSalesforceAccounts=[],b.query={fields:"createdAt,updatedAt,id,name,type,username,remoteUri,password,clientId,clientSecret,securityToken,serverUrl,description",limit:10,page:1},b.arraytype=_.keyBy([{option:"Integration_Tab",value:"'integrationTab'"},{option:"New_Tab",value:"'newTab'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.integrations.salesforceAccounts.edit",{id:e.id,salesforceAccount:e,crudPermissions:b.crudPermissions})},b.testtestintegrationaccount=function(e,t){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()})})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getSalesforceAccounts=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.intSalesforceAccount.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="SalesforceAccounts",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditSalesforceAccount=function(e,t){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:t,salesforceAccounts:b.salesforceAccounts.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteSalesforceAccount=S,b.exportSelectedSalesforceAccounts=function(){var e=angular.copy(b.selectedSalesforceAccounts);return b.selectedSalesforceAccounts=[],e},b.deleteSelectedSalesforceAccounts=function(e){var t=i.confirm().title("Are you sure want to delete the selected salesforceAccounts?").htmlContent("<b>"+b.selectedSalesforceAccounts.length+" selected</b> will be deleted.").ariaLabel("delete SalesforceAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedSalesforceAccounts.forEach(function(e){S(e)}),b.selectedSalesforceAccounts=[]})},b.deselectSalesforceAccounts=function(){b.selectedSalesforceAccounts=[]},b.selectAllSalesforceAccounts=function(){b.selectedSalesforceAccounts=b.salesforceAccounts.rows};var E=!0,A=1;function y(e){b.salesforceAccounts=e||{count:0,rows:[]}}function S(e){m.intSalesforceAccount.delete({id:e.id}).$promise.then(function(){_.remove(b.salesforceAccounts.rows,{id:e.id}),b.salesforceAccounts.count-=1,b.salesforceAccounts.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintSalesforceAccount"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getSalesforceAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","salesforceAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.integrations").controller("SalesforceAccountsController",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(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:n.protocol()+"://"+n.host()+(n.port()?":"+n.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.servicenowAccounts,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The servicenowAccount will be deleted.").ariaLabel("Delete ServicenowAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,n,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,t){o.servicenowAccount=e,o.crudPermissions=void 0!==t?t:{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,t){a.show({controller:"CreateOrEditServicenowConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/servicenowAccounts/edit/configurations/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{servicenowConfiguration:t,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getServicenowConfiguration(0)})},o.deleteServicenowConfiguration=function(e,t){var n=a.confirm().title("Are you sure want to delete the servicenowConfiguration?").htmlContent("<b>"+(t.name||"servicenowConfiguration")+"</b> will be deleted.").ariaLabel("delete servicenowConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){i.intServicenowConfiguration.delete({id:t.id}).$promise.then(function(){_.remove(o.configurations,{id:t.id}),s.success({title:"ServicenowConfiguration deleted!",msg:t.name?t.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.selectChangedAdvanced=function(){return i.intSalesforceConfiguration.update({id:o.servicenowConfiguration.id},o.servicenowConfiguration).$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,t){a.show({controller:"CreateOrEditServicenowAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/servicenowAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:t,items:o.subjects,configuration:o.servicenowConfiguration,account:o.servicenowAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,t){var n=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(n).then(function(){r(t)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var t=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(t).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,t){a.show({controller:"CreateOrEditServicenowAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/servicenowAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:t,items:o.descriptions,configuration:o.servicenowConfiguration,account:o.servicenowAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,t){var n=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(n).then(function(){l(t)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var t=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(t).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,t){a.show({controller:"CreateOrEditServicenowAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/servicenowAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:t,items:o.fields,configuration:o.servicenowConfiguration,account:o.servicenowAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,t){var n=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(n).then(function(){d(t)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var t=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(t).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,t,n,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:t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.configurations,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The servicenowConfiguration will be deleted.").ariaLabel("Delete ServicenowConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,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 t=_.find(p.items,{id:e.id});t&&_.merge(t,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 t=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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}).$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,t,n,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=t.protocol()+"://"+t.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")},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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.servicenowAccounts=l||{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="servicenowAccounts",b.listOrder="",b.listOrderAsc=null,b.selectedServicenowAccounts=[],b.query={fields:"createdAt,updatedAt,id,name,username,password,email,remoteUri,serverUrl,description",limit:10,page:1},b.editstate=function(e,t){n.go("app.integrations.servicenowAccounts.edit",{id:e.id,servicenowAccount:e,crudPermissions:b.crudPermissions})},b.testtestintegrationaccount=function(e,t){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()})})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getServicenowAccounts=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.intServicenowAccount.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="ServicenowAccounts",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditServicenowAccount=function(e,t){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:t,servicenowAccounts:b.servicenowAccounts.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteServicenowAccount=S,b.exportSelectedServicenowAccounts=function(){var e=angular.copy(b.selectedServicenowAccounts);return b.selectedServicenowAccounts=[],e},b.deleteSelectedServicenowAccounts=function(e){var t=i.confirm().title("Are you sure want to delete the selected servicenowAccounts?").htmlContent("<b>"+b.selectedServicenowAccounts.length+" selected</b> will be deleted.").ariaLabel("delete ServicenowAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedServicenowAccounts.forEach(function(e){S(e)}),b.selectedServicenowAccounts=[]})},b.deselectServicenowAccounts=function(){b.selectedServicenowAccounts=[]},b.selectAllServicenowAccounts=function(){b.selectedServicenowAccounts=b.servicenowAccounts.rows};var E=!0,A=1;function y(e){b.servicenowAccounts=e||{count:0,rows:[]}}function S(e){m.intServicenowAccount.delete({id:e.id}).$promise.then(function(){_.remove(b.servicenowAccounts.rows,{id:e.id}),b.servicenowAccounts.count-=1,b.servicenowAccounts.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintServicenowAccount"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getServicenowAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","servicenowAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.integrations").controller("ServicenowAccountsController",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(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:n.protocol()+"://"+n.host()+(n.port()?":"+n.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.sugarcrmAccounts,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The sugarcrmAccount will be deleted.").ariaLabel("Delete SugarcrmAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,n,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,t){o.sugarcrmAccount=e,o.crudPermissions=void 0!==t?t:{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,t){a.show({controller:"CreateOrEditSugarcrmConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/configurations/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{sugarcrmConfiguration:t,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getSugarcrmConfiguration(0)})},o.deleteSugarcrmConfiguration=function(e,t){var n=a.confirm().title("Are you sure want to delete the sugarcrmConfiguration?").htmlContent("<b>"+(t.name||"sugarcrmConfiguration")+"</b> will be deleted.").ariaLabel("delete sugarcrmConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){i.intSugarcrmConfiguration.delete({id:t.id}).$promise.then(function(){_.remove(o.configurations,{id:t.id}),s.success({title:"SugarcrmConfiguration deleted!",msg:t.name?t.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.selectChangedAdvanced=function(){return i.intSalesforceConfiguration.update({id:o.sugarcrmConfiguration.id},o.sugarcrmConfiguration).$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,t){a.show({controller:"CreateOrEditSugarcrmAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:t,items:o.subjects,configuration:o.sugarcrmConfiguration,account:o.sugarcrmAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,t){var n=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(n).then(function(){r(t)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var t=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(t).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,t){a.show({controller:"CreateOrEditSugarcrmAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:t,items:o.descriptions,configuration:o.sugarcrmConfiguration,account:o.sugarcrmAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,t){var n=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(n).then(function(){l(t)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var t=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(t).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,t){a.show({controller:"CreateOrEditSugarcrmAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:t,items:o.fields,configuration:o.sugarcrmConfiguration,account:o.sugarcrmAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,t){var n=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(n).then(function(){d(t)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var t=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(t).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,t,n,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:t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.configurations,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The sugarcrmConfiguration will be deleted.").ariaLabel("Delete SugarcrmConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,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 t=_.find(p.items,{id:e.id});t&&_.merge(t,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 t=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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}).$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,t,n,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=t.protocol()+"://"+t.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")},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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.sugarcrmAccounts=l||{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="sugarcrmAccounts",b.listOrder="",b.listOrderAsc=null,b.selectedSugarcrmAccounts=[],b.query={fields:"createdAt,updatedAt,id,name,username,remoteUri,password,serverUrl,description",limit:10,page:1},b.editstate=function(e,t){n.go("app.integrations.sugarcrmAccounts.edit",{id:e.id,sugarcrmAccount:e,crudPermissions:b.crudPermissions})},b.testtestintegrationaccount=function(e,t){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()})})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getSugarcrmAccounts=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.intSugarcrmAccount.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="SugarcrmAccounts",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditSugarcrmAccount=function(e,t){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:t,sugarcrmAccounts:b.sugarcrmAccounts.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteSugarcrmAccount=S,b.exportSelectedSugarcrmAccounts=function(){var e=angular.copy(b.selectedSugarcrmAccounts);return b.selectedSugarcrmAccounts=[],e},b.deleteSelectedSugarcrmAccounts=function(e){var t=i.confirm().title("Are you sure want to delete the selected sugarcrmAccounts?").htmlContent("<b>"+b.selectedSugarcrmAccounts.length+" selected</b> will be deleted.").ariaLabel("delete SugarcrmAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedSugarcrmAccounts.forEach(function(e){S(e)}),b.selectedSugarcrmAccounts=[]})},b.deselectSugarcrmAccounts=function(){b.selectedSugarcrmAccounts=[]},b.selectAllSugarcrmAccounts=function(){b.selectedSugarcrmAccounts=b.sugarcrmAccounts.rows};var E=!0,A=1;function y(e){b.sugarcrmAccounts=e||{count:0,rows:[]}}function S(e){m.intSugarcrmAccount.delete({id:e.id}).$promise.then(function(){_.remove(b.sugarcrmAccounts.rows,{id:e.id}),b.sugarcrmAccounts.count-=1,b.sugarcrmAccounts.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintSugarcrmAccount"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getSugarcrmAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","sugarcrmAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.integrations").controller("SugarcrmAccountsController",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(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:n.protocol()+"://"+n.host()+(n.port()?":"+n.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.vtigerAccounts,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The vtigerAccount will be deleted.").ariaLabel("Delete VtigerAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,n,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,t){o.vtigerAccount=e,o.crudPermissions=void 0!==t?t:{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,t){a.show({controller:"CreateOrEditVtigerConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/vtigerAccounts/edit/configurations/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{vtigerConfiguration:t,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getVtigerConfiguration(0)})},o.deleteVtigerConfiguration=function(e,t){var n=a.confirm().title("Are you sure want to delete the vtigerConfiguration?").htmlContent("<b>"+(t.name||"vtigerConfiguration")+"</b> will be deleted.").ariaLabel("delete vtigerConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){i.intVtigerConfiguration.delete({id:t.id}).$promise.then(function(){_.remove(o.configurations,{id:t.id}),s.success({title:"VtigerConfiguration deleted!",msg:t.name?t.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.selectChangedAdvanced=function(){return i.intSalesforceConfiguration.update({id:o.vtigerConfiguration.id},o.vtigerConfiguration).$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,t){a.show({controller:"CreateOrEditVtigerAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/vtigerAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:t,items:o.subjects,configuration:o.vtigerConfiguration,account:o.vtigerAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,t){var n=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(n).then(function(){r(t)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var t=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(t).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,t){a.show({controller:"CreateOrEditVtigerAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/vtigerAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:t,items:o.descriptions,configuration:o.vtigerConfiguration,account:o.vtigerAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,t){var n=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(n).then(function(){l(t)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var t=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(t).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,t){a.show({controller:"CreateOrEditVtigerAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/vtigerAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:t,items:o.fields,configuration:o.vtigerConfiguration,account:o.vtigerAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,t){var n=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(n).then(function(){d(t)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var t=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(t).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,t,n,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:t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.configurations,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The vtigerConfiguration will be deleted.").ariaLabel("Delete VtigerConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,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 t=_.find(p.items,{id:e.id});t&&_.merge(t,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 t=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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}).$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,t,n,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=t.protocol()+"://"+t.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")},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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.vtigerAccounts=l||{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="vtigerAccounts",b.listOrder="",b.listOrderAsc=null,b.selectedVtigerAccounts=[],b.query={fields:"createdAt,updatedAt,id,name,description,username,accessKey,remoteUri,serverUrl",limit:10,page:1},b.editstate=function(e,t){n.go("app.integrations.vtigerAccounts.edit",{id:e.id,vtigerAccount:e,crudPermissions:b.crudPermissions})},b.testtestintegrationaccount=function(e,t){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()})})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getVtigerAccounts=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.intVtigerAccount.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="VtigerAccounts",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditVtigerAccount=function(e,t){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:t,vtigerAccounts:b.vtigerAccounts.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteVtigerAccount=S,b.exportSelectedVtigerAccounts=function(){var e=angular.copy(b.selectedVtigerAccounts);return b.selectedVtigerAccounts=[],e},b.deleteSelectedVtigerAccounts=function(e){var t=i.confirm().title("Are you sure want to delete the selected vtigerAccounts?").htmlContent("<b>"+b.selectedVtigerAccounts.length+" selected</b> will be deleted.").ariaLabel("delete VtigerAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedVtigerAccounts.forEach(function(e){S(e)}),b.selectedVtigerAccounts=[]})},b.deselectVtigerAccounts=function(){b.selectedVtigerAccounts=[]},b.selectAllVtigerAccounts=function(){b.selectedVtigerAccounts=b.vtigerAccounts.rows};var E=!0,A=1;function y(e){b.vtigerAccounts=e||{count:0,rows:[]}}function S(e){m.intVtigerAccount.delete({id:e.id}).$promise.then(function(){_.remove(b.vtigerAccounts.rows,{id:e.id}),b.vtigerAccounts.count-=1,b.vtigerAccounts.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintVtigerAccount"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getVtigerAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","vtigerAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.integrations").controller("VtigerAccountsController",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(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:n.protocol()+"://"+n.host()+(n.port()?":"+n.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.zendeskAccounts,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The zendeskAccount will be deleted.").ariaLabel("Delete ZendeskAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,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 t=_.find(p.items,{id:e.id});t&&_.merge(t,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 t=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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}).$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,t,n,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=t.protocol()+"://"+t.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")},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,n,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,t){o.zendeskAccount=e,o.crudPermissions=void 0!==t?t:{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,t){a.show({controller:"CreateOrEditZendeskConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/zendeskConfigurations/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{zendeskConfiguration:t,zendeskConfigurations:o.zendeskConfigurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getZendeskConfiguration(0)})},o.deleteZendeskConfiguration=function(e,t){var n=a.confirm().title("Are you sure want to delete the zendeskConfiguration?").htmlContent("<b>"+(t.name||"zendeskConfiguration")+"</b> will be deleted.").ariaLabel("delete zendeskConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){i.intZendeskConfiguration.delete({id:t.id}).$promise.then(function(){_.remove(o.zendeskConfigurations,{id:t.id}),s.success({title:"ZendeskConfiguration deleted!",msg:t.name?t.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.selectChangedAdvanced=function(){return i.intSalesforceConfiguration.update({id:o.zendeskConfiguration.id},o.zendeskConfiguration).$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.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,t){a.show({controller:"CreateOrEditZendeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:t,items:o.subjects,configuration:o.zendeskConfiguration,account:o.zendeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,t){var n=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(n).then(function(){r(t)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var t=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(t).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,t){a.show({controller:"CreateOrEditZendeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:t,items:o.descriptions,configuration:o.zendeskConfiguration,account:o.zendeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,t){var n=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(n).then(function(){l(t)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var t=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(t).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,t){a.show({controller:"CreateOrEditZendeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:t,items:o.fields,configuration:o.zendeskConfiguration,account:o.zendeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,t){var n=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(n).then(function(){d(t)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var t=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(t).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,t,n,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:t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.zendeskConfigurations,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The zendeskConfiguration will be deleted.").ariaLabel("Delete ZendeskConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.zendeskAccounts=l||{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="zendeskAccounts",b.listOrder="",b.listOrderAsc=null,b.selectedZendeskAccounts=[],b.query={fields:"createdAt,updatedAt,id,name,type,username,remoteUri,authType,password,token,serverUrl,description",limit:10,page:1},b.arraytype=_.keyBy([{option:"Integration_Tab",value:"'integrationTab'"},{option:"New_Tab",value:"'newTab'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arrayauthType=_.keyBy([{option:"Password",value:"'password'"},{option:"Token",value:"'token'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.integrations.zendeskAccounts.edit",{id:e.id,zendeskAccount:e,crudPermissions:b.crudPermissions})},b.testtestintegrationaccount=function(e,t){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()})})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getZendeskAccounts=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.intZendeskAccount.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="ZendeskAccounts",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditZendeskAccount=function(e,t){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:t,zendeskAccounts:b.zendeskAccounts.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteZendeskAccount=S,b.exportSelectedZendeskAccounts=function(){var e=angular.copy(b.selectedZendeskAccounts);return b.selectedZendeskAccounts=[],e},b.deleteSelectedZendeskAccounts=function(e){var t=i.confirm().title("Are you sure want to delete the selected zendeskAccounts?").htmlContent("<b>"+b.selectedZendeskAccounts.length+" selected</b> will be deleted.").ariaLabel("delete ZendeskAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedZendeskAccounts.forEach(function(e){S(e)}),b.selectedZendeskAccounts=[]})},b.deselectZendeskAccounts=function(){b.selectedZendeskAccounts=[]},b.selectAllZendeskAccounts=function(){b.selectedZendeskAccounts=b.zendeskAccounts.rows};var E=!0,A=1;function y(e){b.zendeskAccounts=e||{count:0,rows:[]}}function S(e){m.intZendeskAccount.delete({id:e.id}).$promise.then(function(){_.remove(b.zendeskAccounts.rows,{id:e.id}),b.zendeskAccounts.count-=1,b.zendeskAccounts.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintZendeskAccount"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getZendeskAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","zendeskAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.integrations").controller("ZendeskAccountsController",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(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",serverUrl:n.protocol()+"://"+n.host()+(n.port()?":"+n.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.zohoAccounts,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The zohoAccount will be deleted.").ariaLabel("Delete ZohoAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,n,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,t){o.zohoAccount=e,o.crudPermissions=void 0!==t?t:{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,t){a.show({controller:"CreateOrEditZohoConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zohoAccounts/edit/configurations/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{zohoConfiguration:t,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getZohoConfiguration(0)})},o.deleteZohoConfiguration=function(e,t){var n=a.confirm().title("Are you sure want to delete the zohoConfiguration?").htmlContent("<b>"+(t.name||"zohoConfiguration")+"</b> will be deleted.").ariaLabel("delete zohoConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){i.intZohoConfiguration.delete({id:t.id}).$promise.then(function(){_.remove(o.configurations,{id:t.id}),s.success({title:"ZohoConfiguration deleted!",msg:t.name?t.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(){return i.intSalesforceConfiguration.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,t){a.show({controller:"CreateOrEditZohoAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zohoAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:t,items:o.subjects,configuration:o.zohoConfiguration,account:o.zohoAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,t){var n=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(n).then(function(){r(t)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var t=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(t).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,t){a.show({controller:"CreateOrEditZohoAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zohoAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:t,items:o.descriptions,configuration:o.zohoConfiguration,account:o.zohoAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,t){var n=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(n).then(function(){l(t)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var t=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(t).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,t){a.show({controller:"CreateOrEditZohoAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zohoAccounts/edit/item/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:t,items:o.fields,configuration:o.zohoConfiguration,account:o.zohoAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,t){var n=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(n).then(function(){d(t)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var t=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(t).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,t,n,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:t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.configurations,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The zohoConfiguration will be deleted.").ariaLabel("Delete ZohoConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,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 t=_.find(p.items,{id:e.id});t&&_.merge(t,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 t=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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}).$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,t,n,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=t.protocol()+"://"+t.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")},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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.zohoAccounts=l||{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="zohoAccounts",b.listOrder="",b.listOrderAsc=null,b.selectedZohoAccounts=[],b.query={fields:"createdAt,updatedAt,id,name,host,authToken,serverUrl,description",limit:10,page:1},b.arrayhost=_.keyBy([{option:"zoho.com",value:"'zoho.com'"},{option:"zoho.eu",value:"'zoho.eu'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.integrations.zohoAccounts.edit",{id:e.id,zohoAccount:e,crudPermissions:b.crudPermissions})},b.testtestintegrationaccount=function(e,t){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()})})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getZohoAccounts=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.intZohoAccount.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="ZohoAccounts",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditZohoAccount=function(e,t){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:t,zohoAccounts:b.zohoAccounts.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteZohoAccount=S,b.exportSelectedZohoAccounts=function(){var e=angular.copy(b.selectedZohoAccounts);return b.selectedZohoAccounts=[],e},b.deleteSelectedZohoAccounts=function(e){var t=i.confirm().title("Are you sure want to delete the selected zohoAccounts?").htmlContent("<b>"+b.selectedZohoAccounts.length+" selected</b> will be deleted.").ariaLabel("delete ZohoAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedZohoAccounts.forEach(function(e){S(e)}),b.selectedZohoAccounts=[]})},b.deselectZohoAccounts=function(){b.selectedZohoAccounts=[]},b.selectAllZohoAccounts=function(){b.selectedZohoAccounts=b.zohoAccounts.rows};var E=!0,A=1;function y(e){b.zohoAccounts=e||{count:0,rows:[]}}function S(e){m.intZohoAccount.delete({id:e.id}).$promise.then(function(){_.remove(b.zohoAccounts.rows,{id:e.id}),b.zohoAccounts.count-=1,b.zohoAccounts.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintZohoAccount"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getZohoAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","zohoAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.integrations").controller("ZohoAccountsController",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(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},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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.projects,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The project will be deleted.").ariaLabel("Delete Project").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s){var o=this;o.project={},o.localizationMap=s;var r=new Date;r.setHours(0,0,0,0),o.pickerModel={dateStart:r,dateEnd:null,selectedTemplate:"TD"},o.init=function(e){o.project=e,o.getAnswers()},o.getSummary=function(){return a.jscriptyProject.getSummary({id:o.project.id,startTime:{$gte:o.pickerModel.dateStart,$lte:moment(o.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format()},nolimit:!0}).$promise.then(function(e){if(void 0!==e.length){var t=[e.buffer],n=new Blob(t,{type:e.type}),a=window.document.createElement("a");a.setAttribute("href",URL.createObjectURL(n)),a.setAttribute("download","jscriptyProjectSummary_"+o.project.id+".csv"),a.click()}else i.info({title:"EXPORT",msg:"No answers available"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.jscriptyProject.getSummary",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getAnswers=function(){return o.hasIdAnswers=!1,a.jscriptyProject.getAnswers({id:o.project.id,sort:"-createdAt,questionId",createdAt:{$gte:o.pickerModel.dateStart,$lte:moment(o.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format()},nolimit:!0}).$promise.then(function(e){if(e&&e.rows&&e.hasOwnProperty("count")){o.answers={};for(var t=0,n=e.count;t<n;t++)e.rows[t].questionId&&(o.hasIdAnswers=!0,o.answers.hasOwnProperty(e.rows[t].questionId)||(o.answers[e.rows[t].questionId]={question:e.rows[t].question,answers:{},sum:0}),""===e.rows[t].answer&&(e.rows[t].answer="NO_ANSWER"),o.answers[e.rows[t].questionId].answers[e.rows[t].answer]?o.answers[e.rows[t].questionId].answers[e.rows[t].answer]+=1:o.answers[e.rows[t].questionId].answers[e.rows[t].answer]=1,o.answers[e.rows[t].questionId].sum+=1)}}).catch(function(e){i.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","toasty","dateFilterLocalizationFactory"],angular.module("app.jscripty").controller("ProjectAnswersController",e)}(),function(){"use strict";angular.module("app.jscripty").controller("ProjectBuilderController",function(){var t=this;t.project={},t.optionsBuilder={questionTypes:["text","textarea","radio","checkbox","select","number","date","time","email","range","url"],elementTypes:["question","paragraph"]},t.init=function(e){t.project=e,_.isObjectLike(e.formData)?t.project.formData=e.formData:t.isJsonString(e.formData)?t.project.formData=JSON.parse(e.formData):t.project.formData={}},t.isJsonString=function(e){if(_.isNil(e))return!1;try{JSON.parse(e)}catch(e){return!1}return!0}})}(),function(){"use strict";function e(t,n,a,e,i,s,o){var r=this;function l(e){t.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!":""}),n.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 t=0;t<e.data.errors.length;t+=1)a.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){var o=this;o.project={},o.responseData={},o.formViewer={},o.init=function(e){o.project=e,t.$on("mwForm.pageEvents.pageCurrentChanged",function(e,t){if(t.currentPage&&o.project.formData&&o.project.formData.pages)for(var n=0,a=o.project.formData.pages.length;n<a;n++)if(t.currentPage.number<n+1&&o.project.formData.pages[n].elements)for(var i=0,s=o.project.formData.pages[n].elements.length;i<s;i++)"question"===o.project.formData.pages[n].elements[i].type&&o.project.formData.pages[n].elements[i].question&&delete o.responseData[o.project.formData.pages[n].elements[i].question.id]})},o.onSubmit=function(e){var t=a.defer(),n=i.confirm().title("Would you like to save your survey?").textContent("").ariaLabel("survey").targetEvent(e).ok("SAVE").cancel("CANCEL");return i.show(n).then(function(){t.resolve(!0)},function(){t.reject()}),t.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,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.project={},c.projectSessions={count:0,rows:[]},c.selectedProjectSessions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,starttime,endtime,membername,calleridnum,completed",sort:"-starttime",limit:10,page:1},c.init=function(e,t){c.project=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.project.id,c.getProjectSessions()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the session?").htmlContent("<b>"+(e.name||"session")+"</b> will be deleted.").ariaLabel("delete session").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getProjectSessions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.jscriptyProject.getSessions(c.query,p).$promise},c.createOrEditProjectSession=function(e,t){s.show({controller:"CreateOrEditSessionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/jscripty/views/projects/edit/sessions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{project:c.project,session:t,sessions:c.projectSessions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.showQuestionsProjectSession=function(e,n){s.show({controller:"ShowQuestionsSessionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/jscripty/views/projects/edit/sessions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,resolve:{questions:["apiResolver","$stateParams",function(e,t){return e.resolve("jscriptySessionReport@getQuestions",{fields:"question,answer",sort:"id",id:n.id})}]},locals:{project:c.project,session:n}})},c.exportSelectedProjectSessions=function(){var e=angular.copy(c.selectedProjectSessions);return c.selectedProjectSessions=[],e},c.deleteProjectSession=g,c.deleteSelectedProjectSessions=function(e){var t=s.confirm().title("Are you sure want to delete the selected sessions?").htmlContent("<b>"+c.selectedProjectSessions.length+" selected</b> will be deleted.").ariaLabel("delete sessions").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedProjectSessions.forEach(function(e){g(e)}),c.selectedProjectSessions=[]})};var m=!0,u=1;function p(e){c.projectSessions=e||{count:0,rows:[]}}function g(e){l.jscriptySessionReport.delete({id:e.id}).$promise.then(function(){_.remove(c.projectSessions.rows,{id:e.id}),c.projectSessions.count-=1,c.projectSessions.rows.length||c.getProjectSessions(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETjscriptyProject"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETjscriptyProject",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getProjectSessions())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.jscripty").controller("ProjectSessionsController",e)}(),function(){"use strict";function e(e,t,n,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,t,n,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=t.protocol()+"://"+t.host(),u.project=c||e.params.project||{},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.clonedialog=function(e,t){n.show({controller:"ProjectcloneController",controllerAs:"vm",templateUrl:"app/main/apps/jscripty/views/projects/edit/clone/clone.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{project:e,projects:u.projects?u.projects.rows:[],crudPermissions:u.crudPermissions}})},u.alert=l.info,u.gotoProjects=function(){e.go("app.jscripty.projects")},u.saveProject=function(){r.jscriptyProject.update({id:u.project.id},u.project).$promise.then(function(){l.success({title:"Project updated!",msg:u.project.name?u.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","userProfileSection"],angular.module("app.jscripty").controller("JscriptyProjectController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.projects=l||{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="projects",b.listOrder="",b.listOrderAsc=null,b.selectedProjects=[],b.query={fields:"createdAt,updatedAt,id,name,enableUncompleteSave,description,formData",sort:"-updatedAt",limit:10,page:1},b.editstate=function(e,t){n.go("app.jscripty.projects.edit",{id:e.id,project:e,crudPermissions:b.crudPermissions})},b.clonedialog=function(e,t){i.show({controller:"ProjectcloneController",controllerAs:"vm",templateUrl:"app/main/apps/jscripty/views/projects/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{project:e,projects:b.projects?b.projects.rows:[],crudPermissions:b.crudPermissions}})},b.sessionsgoto=function(e,t){n.go("app.jscripty.projects.edit",{id:e.id,tab:3})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getProjects=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.jscriptyProject.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Projects",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditProject=function(e,t){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:t,projects:b.projects.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteProject=S,b.exportSelectedProjects=function(){var e=angular.copy(b.selectedProjects);return b.selectedProjects=[],e},b.deleteSelectedProjects=function(e){var t=i.confirm().title("Are you sure want to delete the selected projects?").htmlContent("<b>"+b.selectedProjects.length+" selected</b> will be deleted.").ariaLabel("delete Projects").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedProjects.forEach(function(e){S(e)}),b.selectedProjects=[]})},b.deselectProjects=function(){b.selectedProjects=[]},b.selectAllProjects=function(){b.selectedProjects=b.projects.rows};var E=!0,A=1;function y(e){b.projects=e||{count:0,rows:[]}}function S(e){m.jscriptyProject.delete({id:e.id}).$promise.then(function(){_.remove(b.projects.rows,{id:e.id}),b.projects.count-=1,b.projects.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEjscriptyProject"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getProjects())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","projects","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.jscripty").controller("JscriptyProjectsController",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(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_MAILACCOUNT",g.mailAccount=angular.copy(l),g.mailAccounts=r,g.newMailAccount=!1,g.mailAccount||(g.mailAccount={active:!0,cservice:"null",cauthentication:!0,fontSize:13,waitForTheAssignedAgent:10,notificationSound:!0,queueTransferTimeout:300,agentTransferTimeout:300},g.title="MAIL.NEW_MAILACCOUNT",g.newMailAccount=!0),t.params.id&&(g.mailAccount.MailAccountId=t.params.id),g.addNewMailAccount=function(){g.errors=[],d.mailAccount.save(g.mailAccount).$promise.then(function(e){g.mailAccounts.unshift(e.toJSON()),o.success({title:"MailAccount properly created",msg:g.mailAccount.name?g.mailAccount.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.mailAccount.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.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=[],d.mailAccount.update({id:g.mailAccount.id},g.mailAccount).$promise.then(function(e){var t=_.find(g.mailAccounts,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"MailAccount properly saved!",msg:g.mailAccount.name?g.mailAccount.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.mailAccount.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.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 o.error({title:"Mail Account not deleted!",msg:"You can't remove service account"});g.errors=[];var t=a.confirm().title("Are you sure?").content("The mailAccount will be deleted.").ariaLabel("Delete MailAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.mailAccount.delete({id:g.mailAccount.id}).$promise.then(function(){_.remove(g.mailAccounts,{id:g.mailAccount.id}),o.success({title:"MailAccount properly deleted!",msg:(g.mailAccount.name||"mailAccount")+" has been deleted!"}),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.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.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.lists,{id:e.resourceId})}),n=null;if(g.mailAccount&&(n=_.find(g.lists,{id:Number(g.mailAccount.ListId)})),n&&!_.some(t,["id",n.id])){var a=_.find(g.lists,{id:n.id});a.canSelect=!1,t.push(a)}g.lists=t})}else{var n=[],a=null;g.mailAccount&&(a=_.find(g.lists,{id:Number(g.mailAccount.ListId)}));for(var i=0;i<g.lists.length;i++)a&&g.lists[i].id===a.id&&(g.lists[i].canSelect=!1,n.push(g.lists[i]));g.lists=n}}).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","mailAccounts","mailAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.mail").controller("CreateOrEditMailAccountDialogController",e)}(),function(){"use strict";function e(o,i,a,s,e){var r=this;function t(e,t){if(r.mailAccountApps.rows.length){var n=r.mailAccountApps.rows[t]?r.mailAccountApps.rows[t]:r.mailAccountApps.rows[0];i.show({controller:"EditMailAccountApp"+(n.appType||n.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/apps/"+(n.appType||n.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailAccountApp:n,mailAccount:r.mailAccount,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.mailAccountApps.rows[t]=e:r.mailAccountApps.rows.splice(t,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,t=[],n=0;n<r.mailAccountApps.rows.length;n++,0){var a=r.mailAccountApps.rows[n],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,t=_.concat(t,i,[a],s)}o.mailAccount.addApplications({id:r.mailAccount.id},_.sortBy(t,"priority")).$promise.then(function(e){r.mailAccountApps.rows=e.rows}).catch(function(e){console.error(e)})}function n(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:"1"},{option:"Always",value:"0"}],required:!0,param:0},{title:"Text",name:"text",type:"html",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){t(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,t){r.mailAccount=e,r.crudPermissions=void 0!==t?t:{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,t,n){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(n).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.mailAccountApps.rows.splice(t,1),l()},function(){console.log("CANCEL")})},r.getMailAccountApps=function(){r.promise=o.mailAccount.getApplications(r.query,n).$promise},r.editMailAccountApp=t,r.editInterval=function(e,t){if(r.mailAccountApps.rows.length){var n=r.mailAccountApps.rows[t]?r.mailAccountApps.rows[t]: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:n.interval,IntervalId:n.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(n.interval=e.interval||"*,*,*,*",n.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 t=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(t).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,t,n,o,r,l,d){var c=this;function m(){return a(function(n,t){return a(function(t,n){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.mailAccount.getAgents({id:c.mailAccount.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return t.penalty=e.UserMailAccount?"penalty "+e.UserMailAccount.penalty:"",t.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=l.getCurrentUser(),c.mailAccount=t,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(n,t){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.mailAccount.removeAgents({id:c.mailAccount.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.mailAccount.addAgents({id:c.mailAccount.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,items:[],selectedItems:[],showSelectAndDeselectAll:!o,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("MAIL.ALL_AGENTS"),labelSelected:r.instant("MAIL.SELECTED_AGENTS"),transferCallback:function(e,t){var n=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(n)}}}e.$inject=["$mdDialog","$q","toasty","api","mailAccount","mailAccounts","realtime","$translate","Auth","crudPermissions"],angular.module("app.mail").controller("MailAccountagentaddController",e)}(),function(){"use strict";function e(t,e,n,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"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){t.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 t=_.find(l.agents,{name:l.agent.agent});t&&(l.agent.UserId=t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),n=null;if(l.agent&&(n=_.find(l.agents,{name:l.agent.agent})),n&&!_.some(t,["id",n.id])){var a=_.find(l.agents,{id:n.id});a.canSelect=!1,t.push(a)}l.agents=t})}else{var n=[],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,n.push(l.agents[i]));l.agents=n}}).catch(function(e){n.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(t,e,n,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"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){t.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.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(t,e,n,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"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){t.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(t,e,n,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"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){t.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(t,e,n,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"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){t.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,t,n,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 E(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var t=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),n=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(t+"-"+n)}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 A(e){t.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=E(),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!":""}),A()}).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=E(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),A(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var t=_.find(c.intervals,{id:e.id});t&&_.merge(t,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),A()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=A,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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=e&&e.rows?e.rows:[],n=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(t,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,n.push(e))}),c.intervals=n})}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(t,e,n,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"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){t.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(t,e,n,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"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){t.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 t=_.find(l.queues,{name:l.queue.queue});t&&(l.queue[_.capitalize("mail")+"QueueId"]=t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),n=null;if(l.queue&&(n=_.find(l.queues,{name:l.queue.queue})),n&&!_.some(t,["id",n.id])){var a=_.find(l.queues,{id:n.id});a.canSelect=!1,t.push(a)}l.queues=t})}else{var n=[],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,n.push(l.queues[i]));l.queues=n}}).catch(function(e){n.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(t,e,n,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"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){t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),n=null;if(l.system&&(n=_.find(l.variables,{name:l.system.variable})),n&&!_.some(t,["id",n.id])){var a=_.find(l.variables,{id:n.id});a.canSelect=!1,t.push(a)}l.variables=t})}else{var n=[],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,n.push(l.variables[i]));l.variables=n}}).catch(function(e){n.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(t,e,n,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"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){t.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 t=_.find(l.tags,{name:l.tag.tag});t&&(l.tag.TagId=t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),n=null;if(l.tag&&(n=_.find(l.tags,{name:l.tag.tag})),n&&!_.some(t,["id",n.id])){var a=_.find(l.tags,{id:n.id});a.canSelect=!1,t.push(a)}l.tags=t})}else{var n=[],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,n.push(l.tags[i]));l.tags=n}}).catch(function(e){n.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,t,n,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.mailAccount={},c.mailAccountInteractions={count:0,rows:[]},c.selectedMailAccountInteractions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,UserId,ContactId,MailAccountId,id,Contact.firstName,Owner.name,closedAt,disposition,note,tag",sort:"-createdAt",includeAll:"true",limit:10,page:1},c.init=function(e,t){c.mailAccount=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.mailAccount.id,c.getMailAccountInteractions()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.mailInteractionDownload=function(s,e,t){return l.mailInteraction.download({id:s.id,exists:!0,attachments:t}).$promise.then(function(e){var t=[e.buffer],n="interaction"+s.id,a=new Blob(t,{type:e.type});n="mail-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.success=p,c.getMailAccountInteractions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.mailAccount.getInteractions(c.query,p).$promise},c.createOrEditMailAccountInteraction=function(e,t){s.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/interactions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailAccount:c.mailAccount,interaction:t,interactions:c.mailAccountInteractions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.spymailInteraction=function(e,n){s.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,t){e.vm.init({id:1,channel:"mail",interaction:n,spy:!0},a.$parent.vm.setting)}})},c.exportSelectedMailAccountInteractions=function(){var e=angular.copy(c.selectedMailAccountInteractions);return c.selectedMailAccountInteractions=[],e},c.deleteMailAccountInteraction=g,c.deleteSelectedMailAccountInteractions=function(e){var t=s.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+c.selectedMailAccountInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedMailAccountInteractions.forEach(function(e){g(e)}),c.selectedMailAccountInteractions=[]})};var m=!0,u=1;function p(e){c.mailAccountInteractions=e||{count:0,rows:[]}}function g(e){l.mailInteraction.delete({id:e.id}).$promise.then(function(){_.remove(c.mailAccountInteractions.rows,{id:e.id}),c.mailAccountInteractions.count-=1,c.mailAccountInteractions.rows.length||c.getMailAccountInteractions(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETmailAccount"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}a.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getMailAccountInteractions())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.mail").controller("MailAccountInteractionsController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.mailAccount={},c.mailAccountMailCannedAnswers={count:0,rows:[]},c.selectedMailAccountMailCannedAnswers=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,key,value,description",limit:10,page:1},c.init=function(e,t){c.mailAccount=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.mailAccount.id,c.query.MailAccountId=c.mailAccount.id,c.getMailAccountMailCannedAnswers()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the mailCannedAnswer?").htmlContent("<b>"+(e.name||"mailCannedAnswer")+"</b> will be deleted.").ariaLabel("delete mailCannedAnswer").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getMailAccountMailCannedAnswers=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.mailAccount.getAnswers(c.query,p).$promise},c.createOrEditMailAccountMailCannedAnswer=function(e,t){s.show({controller:"CreateOrEditMailCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/mailCannedAnswers/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailAccount:c.mailAccount,mailCannedAnswer:t,mailCannedAnswers:c.mailAccountMailCannedAnswers.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedMailAccountMailCannedAnswers=function(){var e=angular.copy(c.selectedMailAccountMailCannedAnswers);return c.selectedMailAccountMailCannedAnswers=[],e},c.deleteMailAccountMailCannedAnswer=g,c.deleteSelectedMailAccountMailCannedAnswers=function(e){var t=s.confirm().title("Are you sure want to delete the selected mailCannedAnswers?").htmlContent("<b>"+c.selectedMailAccountMailCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete mailCannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedMailAccountMailCannedAnswers.forEach(function(e){g(e)}),c.selectedMailAccountMailCannedAnswers=[]})};var m=!0,u=1;function p(e){c.mailAccountMailCannedAnswers=e||{count:0,rows:[]}}function g(e){l.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(c.mailAccountMailCannedAnswers.rows,{id:e.id}),c.mailAccountMailCannedAnswers.count-=1,c.mailAccountMailCannedAnswers.rows.length||c.getMailAccountMailCannedAnswers(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETmailAccount"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getMailAccountMailCannedAnswers())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.mail").controller("MailAccountMailCannedAnswersController",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(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),t.params.id&&(g.mailCannedAnswer.MailAccountId=t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.mailCannedAnswers,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The mailCannedAnswer will be deleted.").ariaLabel("Delete MailCannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.mailAccount={},c.mailAccountMailDispositions={count:0,rows:[]},c.selectedMailAccountMailDispositions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,name",limit:10,page:1},c.init=function(e,t){c.mailAccount=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.mailAccount.id,c.query.MailAccountId=c.mailAccount.id,c.getMailAccountMailDispositions()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the mailDisposition?").htmlContent("<b>"+(e.name||"mailDisposition")+"</b> will be deleted.").ariaLabel("delete mailDisposition").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getMailAccountMailDispositions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.mailAccount.getDispositions(c.query,p).$promise},c.createOrEditMailAccountMailDisposition=function(e,t){s.show({controller:"CreateOrEditMailDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/mailDispositions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailAccount:c.mailAccount,mailDisposition:t,mailDispositions:c.mailAccountMailDispositions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedMailAccountMailDispositions=function(){var e=angular.copy(c.selectedMailAccountMailDispositions);return c.selectedMailAccountMailDispositions=[],e},c.deleteMailAccountMailDisposition=g,c.deleteSelectedMailAccountMailDispositions=function(e){var t=s.confirm().title("Are you sure want to delete the selected mailDispositions?").htmlContent("<b>"+c.selectedMailAccountMailDispositions.length+" selected</b> will be deleted.").ariaLabel("delete mailDispositions").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedMailAccountMailDispositions.forEach(function(e){g(e)}),c.selectedMailAccountMailDispositions=[]})};var m=!0,u=1;function p(e){c.mailAccountMailDispositions=e||{count:0,rows:[]}}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){_.remove(c.mailAccountMailDispositions.rows,{id:e.id}),c.mailAccountMailDispositions.count-=1,c.mailAccountMailDispositions.rows.length||c.getMailAccountMailDispositions(),r.success({title:"MailDisposition deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETmailAccount"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getMailAccountMailDispositions())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.mail").controller("MailAccountMailDispositionsController",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(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_MAILDISPOSITION",g.mailDisposition=angular.copy(l),g.mailDispositions=r,g.newMailDisposition=!1,g.mailDisposition||(g.mailDisposition={},g.title="MAIL.NEW_MAILDISPOSITION",g.newMailDisposition=!0),t.params.id&&(g.mailDisposition.MailAccountId=t.params.id),g.addNewMailDisposition=function(){g.errors=[],d.disposition.save(g.mailDisposition).$promise.then(function(e){g.mailDispositions.unshift(e.toJSON()),o.success({title:"MailDisposition properly created",msg:g.mailDisposition.name?g.mailDisposition.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.disposition.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveMailDisposition=function(){g.errors=[],d.disposition.update({id:g.mailDisposition.id},g.mailDisposition).$promise.then(function(e){var t=_.find(g.mailDispositions,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"MailDisposition properly saved!",msg:g.mailDisposition.name?g.mailDisposition.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.disposition.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteMailDisposition=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The mailDisposition will be deleted.").ariaLabel("Delete MailDisposition").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.disposition.delete({id:g.mailDisposition.id}).$promise.then(function(){_.remove(g.mailDispositions,{id:g.mailDisposition.id}),o.success({title:"MailDisposition properly deleted!",msg:(g.mailDisposition.name||"mailDisposition")+" has been deleted!"}),v(g.mailDisposition)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.disposition.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.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","mailDispositions","mailDisposition","api","Auth","license","setting","crudPermissions"],angular.module("app.mail").controller("CreateOrEditMailDispositionDialogController",e)}(),function(){"use strict";function e(n,e,a,i,s,t,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=t,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.mailAccount=c||n.params.mailAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=n.params.tab||0,u.gotogoto=function(e,t){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:610}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.mail.realtime.accounts",{})}},u.agentadddialog=function(e,t){a.show({controller:"MailAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:t,clickOutsideToClose:!0,locals:{mailAccount:e,mailAccounts:u.mailAccounts?u.mailAccounts.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoMailAccounts=function(){n.go("app.mail.mailAccounts")},u.saveMailAccount=function(){r.mailAccount.update({id:u.mailAccount.id},u.mailAccount).$promise.then(function(){l.success({title:"MailAccount updated!",msg:u.mailAccount.name?u.mailAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.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){u.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.lists,{id:e.resourceId})}),n=null;if(u.mailAccount&&(n=_.find(u.lists,{id:Number(u.mailAccount.ListId)})),n&&!_.some(t,["id",n.id])){var a=_.find(u.lists,{id:n.id});a.canSelect=!1,t.push(a)}u.lists=t})}else{var n=[],a=null;u.mailAccount&&(a=_.find(u.lists,{id:Number(u.mailAccount.ListId)}));for(var i=0;i<u.lists.length;i++)a&&u.lists[i].id===a.id&&(u.lists[i].canSelect=!1,n.push(u.lists[i]));u.lists=n}}).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){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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.pauses,{id:e.resourceId})});u.pauses.forEach(function(e){_.some(t,["id",e.id])||(e.canSelect=!1),t.push(e)}),u.pauses=t})}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","mailAccount","userProfileSection"],angular.module("app.mail").controller("MailAccountController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.mailAccounts=l||{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="mailAccounts",b.listOrder="",b.listOrderAsc=null,b.selectedMailAccounts=[],b.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,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,page:1},b.arraycservice=_.keyBy([{option:"Custom",value:"null"},{option:"Gmail",value:"'gmail'"},{option:"Hotmail",value:"'hotmail'"},{option:"Yahoo",value:"'yahoo'"},{option:"Outlook365",value:"'outlook365'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b["arrayImap.service"]=_.keyBy([{option:"Custom",value:"null"},{option:"Gmail",value:"'gmail'"},{option:"Hotmail",value:"'hotmail'"},{option:"Yahoo",value:"'yahoo'"},{option:"Outlook365",value:"'outlook365'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b["arraySmtp.service"]=_.keyBy([{option:"Custom",value:"null"},{option:"Gmail",value:"'gmail'"},{option:"Hotmail",value:"'hotmail'"},{option:"Yahoo",value:"'yahoo'"},{option:"Outlook365",value:"'outlook365'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.mail.mailAccounts.edit",{id:e.id,mailAccount:e,crudPermissions:b.crudPermissions})},b.verifysmtpverifysmtp=function(e,t){{if(e&&e.id)return m.mailAccount.verifySmtp({id:e.id}).$promise.then(function(){p.success({title:"Smtp properly verified",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"Smtp properly verified",msg:e.data?JSON.stringify(e.data):e.toString()})});p.error({title:"Smtp properly verified",msg:"Smpt id unknown"})}},b.interactionsgoto=function(e,t){n.go("app.mail.mailAccounts.edit",{id:e.id,tab:7})},b.gotorealtimegoto=function(e,t){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:610}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.go("app.mail.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()})});n.go("app.mail.realtime.accounts",{})}},b.agentadddialog=function(e,t){i.show({controller:"MailAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{mailAccount:e,mailAccounts:b.mailAccounts?b.mailAccounts.rows:[],crudPermissions:b.crudPermissions,realtime:!1}})},b.deleteconfirm=function(e,t){var n=i.confirm().title("Are you sure want to delete the "+_.startCase("mailAccount")+"?").htmlContent("<b>"+(e.name||"mailAccount")+"</b> will be deleted.").ariaLabel("delete mailAccount").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getMailAccounts=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.mailAccount.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="MailAccounts",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditMailAccount=function(e,t){i.show({controller:"CreateOrEditMailAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailAccount:t,mailAccounts:b.mailAccounts.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteMailAccount=S,b.exportSelectedMailAccounts=function(){var e=angular.copy(b.selectedMailAccounts);return b.selectedMailAccounts=[],e},b.deleteSelectedMailAccounts=function(e){var t=i.confirm().title("Are you sure want to delete the selected mailAccounts?").htmlContent("<b>"+b.selectedMailAccounts.length+" selected</b> will be deleted.").ariaLabel("delete MailAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedMailAccounts.forEach(function(e){S(e)}),b.selectedMailAccounts=[]})},b.deselectMailAccounts=function(){b.selectedMailAccounts=[]},b.selectAllMailAccounts=function(){b.selectedMailAccounts=b.mailAccounts.rows},g.hasRole("admin")?m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){b.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){b.lists=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(b.lists,{id:e.resourceId})}),n=null;if(b.mailAccount&&(n=_.find(b.lists,{id:Number(b.mailAccount.ListId)})),n&&!_.some(t,["id",n.id])){var a=_.find(b.lists,{id:n.id});a.canSelect=!1,t.push(a)}b.lists=t})}else{var n=[],a=null;b.mailAccount&&(a=_.find(b.lists,{id:Number(b.mailAccount.ListId)}));for(var i=0;i<b.lists.length;i++)a&&b.lists[i].id===a.id&&(b.lists[i].canSelect=!1,n.push(b.lists[i]));b.lists=n}}).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 E=!0,A=1;function y(e){b.mailAccounts=e||{count:0,rows:[]}}function S(e){if(e.service)return p.error({title:"Mail Account not deleted!",msg:"You can't remove service account"});m.mailAccount.delete({id:e.id}).$promise.then(function(){_.remove(b.mailAccounts.rows,{id:e.id}),b.mailAccounts.count-=1,b.mailAccounts.rows.length||b.getMailAccounts(),p.success({title:_.startCase("MailAccount")+" 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:DELETEmailAccount"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEmailAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getMailAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","mailAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.mail").controller("MailAccountsController",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(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_MAILQUEUE",g.mailQueue=angular.copy(l),g.mailQueues=r,g.newMailQueue=!1,g.mailQueue||(g.mailQueue={strategy:"beepall",timeout:10},g.title="MAIL.NEW_MAILQUEUE",g.newMailQueue=!0),g.addNewMailQueue=function(){g.errors=[],d.mailQueue.save(g.mailQueue).$promise.then(function(e){g.mailQueues.unshift(e.toJSON()),o.success({title:"MailQueue properly created",msg:g.mailQueue.name?g.mailQueue.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.mailQueue.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveMailQueue=function(){g.errors=[],d.mailQueue.update({id:g.mailQueue.id},g.mailQueue).$promise.then(function(e){var t=_.find(g.mailQueues,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"MailQueue properly saved!",msg:g.mailQueue.name?g.mailQueue.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.mailQueue.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteMailQueue=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The mailQueue will be deleted.").ariaLabel("Delete MailQueue").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.mailQueue.delete({id:g.mailQueue.id}).$promise.then(function(){_.remove(g.mailQueues,{id:g.mailQueue.id}),o.success({title:"MailQueue properly deleted!",msg:(g.mailQueue.name||"mailQueue")+" has been deleted!"}),v(g.mailQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailQueue.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.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(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","mailQueues","mailQueue","api","Auth","license","setting","crudPermissions"],angular.module("app.mail").controller("CreateOrEditMailQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,t,n,o,r,l,d){var c=this;function m(){return a(function(n,t){return a(function(t,n){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.mailQueue.getAgents({id:c.mailQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return t.penalty=e.UserMailQueue?"penalty "+e.UserMailQueue.penalty:"",t.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=l.getCurrentUser(),c.mailQueue=t,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(n,t){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.mailQueue.removeAgents({id:c.mailQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.mailQueue.addAgents({id:c.mailQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,items:[],selectedItems:[],showSelectAndDeselectAll:!o,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("MAIL.ALL_AGENTS"),labelSelected:r.instant("MAIL.SELECTED_AGENTS"),transferCallback:function(e,t){var n=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(n)}}}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,t,n,o,r){var l=this;function d(){return a(function(n,t){return a(function(t,n){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:l.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return l.allowedItems=_.map(t,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.startingAllowedItems=angular.copy(l.allowedItems),l.items.forEach(function(e){var t=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.mailQueue.getTeams({id:l.mailQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];l.selectedItems=_.map(t,function(e){return _.find(l.items,{id:e.id})}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}l.currentUser=o.getCurrentUser(),l.mailQueue=t,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={readOnly:!l.crudPermissions.canEdit,allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!0,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:n.instant("MAIL.ALL_TEAMS"),labelSelected:n.instant("MAIL.SELECTED_TEAMS"),transferCallback:function(e,t){var n=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(n)}},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(n,t){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.mailQueue.removeTeams({id:l.mailQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.mailQueue.addTeams({id:l.mailQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},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,t,n,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=t.protocol()+"://"+t.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,t){n.show({controller:"MailQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{mailQueue:e,mailQueues:u.mailQueues?u.mailQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,t){n.show({controller:"MailQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:t,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")},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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.mailQueues=l||{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="mailQueues",b.listOrder="",b.listOrderAsc=null,b.selectedMailQueues=[],b.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"mail",limit:10,page:1},b.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.mail.mailQueues.edit",{id:e.id,mailQueue:e,crudPermissions:b.crudPermissions})},b.teamadddialog=function(e,t){i.show({controller:"MailQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{mailQueue:e,mailQueues:b.mailQueues?b.mailQueues.rows:[],crudPermissions:b.crudPermissions}})},b.agentadddialog=function(e,t){i.show({controller:"MailQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{mailQueue:e,mailQueues:b.mailQueues?b.mailQueues.rows:[],crudPermissions:b.crudPermissions,realtime:!1}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.gotorealtimegoto=function(e,t){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:610}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.mail.realtime.queues",{})}},b.success=y,b.getMailQueues=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.mailQueue.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="MailQueues",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditMailQueue=function(e,t){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:t,mailQueues:b.mailQueues.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteMailQueue=S,b.exportSelectedMailQueues=function(){var e=angular.copy(b.selectedMailQueues);return b.selectedMailQueues=[],e},b.deleteSelectedMailQueues=function(e){var t=i.confirm().title("Are you sure want to delete the selected mailQueues?").htmlContent("<b>"+b.selectedMailQueues.length+" selected</b> will be deleted.").ariaLabel("delete MailQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedMailQueues.forEach(function(e){S(e)}),b.selectedMailQueues=[]})},b.deselectMailQueues=function(){b.selectedMailQueues=[]},b.selectAllMailQueues=function(){b.selectedMailQueues=b.mailQueues.rows};var E=!0,A=1;function y(e){b.mailQueues=e||{count:0,rows:[]}}function S(e){m.mailQueue.delete({id:e.id}).$promise.then(function(){_.remove(b.mailQueues.rows,{id:e.id}),b.mailQueues.count-=1,b.mailQueues.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEmailQueue"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getMailQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","mailQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.mail").controller("MailQueuesController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.mailSubtatuses,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The mailSubstatus will be deleted.").ariaLabel("Delete MailSubstatus").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.mailSubtatuses=l||{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="mailSubtatuses",b.listOrder="",b.listOrderAsc=null,b.selectedMailSubstatuses=[],b.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},b.editdialog=function(e,t){i.show({controller:"CreateOrEditMailSubstatusDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailSubtatuses/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{mailSubstatus:e,mailSubtatuses:b.mailSubtatuses.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getMailSubstatuses=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.mailSubstatus.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="MailSubstatuses",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditMailSubstatus=function(e,t){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:t,mailSubtatuses:b.mailSubtatuses.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteMailSubstatus=S,b.exportSelectedMailSubstatuses=function(){var e=angular.copy(b.selectedMailSubstatuses);return b.selectedMailSubstatuses=[],e},b.deleteSelectedMailSubstatuses=function(e){var t=i.confirm().title("Are you sure want to delete the selected mailSubtatuses?").htmlContent("<b>"+b.selectedMailSubstatuses.length+" selected</b> will be deleted.").ariaLabel("delete MailSubstatuss").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedMailSubstatuses.forEach(function(e){S(e)}),b.selectedMailSubstatuses=[]})},b.deselectMailSubstatuses=function(){b.selectedMailSubstatuses=[]},b.selectAllMailSubstatuses=function(){b.selectedMailSubstatuses=b.mailSubtatuses.rows};var E=!0,A=1;function y(e){b.mailSubtatuses=e||{count:0,rows:[]}}function S(e){m.mailSubstatus.delete({id:e.id}).$promise.then(function(){_.remove(b.mailSubtatuses.rows,{id:e.id}),b.mailSubtatuses.count-=1,b.mailSubtatuses.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEmailSubstatus"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getMailSubstatuses())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","mailSubtatuses","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.mail").controller("MailSubstatusesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){_.forIn(p.mailAccounts,function(e,t){p.rpcMailAccounts[t]&&_.merge(e,p.rpcMailAccounts[t])}),_.forIn(p.mailAccounts,function(t,e){var n={id:e,sort:"-id",direction:"in",limit:1,offset:0,$gte:"createdAt,"+moment().startOf("day").format("YYYY-MM-DD HH:mm:ss")};s.mailAccount.getMessages(n).$promise.then(function(e){return e&&(t.in=e.count||0,t.lastIn=e.rows&&e.rows.length?e.rows[0].createdAt:void 0),n.direction="out",s.mailAccount.getMessages(n).$promise}).then(function(e){e&&(t.out=e.count||0,t.lastOut=e.rows&&e.rows.length?e.rows[0].createdAt:void 0)}).catch(function(e){console.log(e)})})}p.currentUser=u.getCurrentUser(),p.count=l&&l.count?l.count:0,p.mailAccounts=l?_.keyBy(l.rows?l.rows:[],"id"):{},p.rpcMailAccounts=d?_.keyBy(d.rows?d.rows:[],"id"):{},p.userProfile=c,p.userProfileSection=m&&1==m.count?m.rows[0]:null,p.crudPermissions=u.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.query={sort:"-name",limit:10,page:1},p.success=f,p.$onInit=g,p.getMailAccounts=function(){p.query.offset=(p.query.page-1)*p.query.limit,u.hasRole("admin")?p.promise=s.mailAccount.get(p.query,f).$promise:(p.query.id=p.userProfile.id,p.query.section="MailAccounts",p.promise=s.userProfile.getResources(p.query,f).$promise)},p.onSave=function(e){p.mailAccounts[e.id]&&_.merge(p.mailAccounts[e.id],e)},p.onMailMessageSave=function(e){p.mailAccounts[e.MailAccountId]&&("in"==e.direction?(p.mailAccounts[e.MailAccountId].in+=1,p.mailAccounts[e.MailAccountId].lastIn=e.createdAt):(p.mailAccounts[e.MailAccountId].out+=1,p.mailAccounts[e.MailAccountId].lastOut=e.createdAt))},p.goToMailAccount=function(e,t){i.go("app.mail.mailAccounts.edit",{id:t.id,mailAccount:t})},p.verifySmtp=function(e,t){{if(t&&t.id)return s.mailAccount.verifySmtp({id:t.id}).$promise.then(function(){r.success({title:"Smtp properly verified",msg:"Connection succeded!"})}).catch(function(e){r.error({title:"Smtp properly verified",msg:e.data?JSON.stringify(e.data):e.toString()})});r.error({title:"Smtp properly verified",msg:"Smpt id unknown"})}},p.order=[],_.forIn(p.mailAccounts,function(e,t){p.order.push(e.id)}),o.on("mailAccount:save",p.onSave),o.on("mailAccount:update",p.onSave),o.on("mailMessage:save",p.onMailMessageSave);var v=!0,h=1;function f(e){if(p.mailAccounts=e?_.keyBy(e.rows?e.rows:[],"id"):{},e.rows){p.order=[];for(var t=0;t<e.rows.length;t++)p.order.push(e.rows[t].id)}g()}e.$watch("vm.query.filter",function(e,t){v?n(function(){v=!1}):(t||(h=p.query.page),e!==t&&(p.query.page=1),e||(p.query.page=h),p.getMailAccounts())}),e.$on("$destroy",function(){o.removeAllListeners("mailAccount:save"),o.removeAllListeners("mailAccount:update"),o.removeAllListeners("mailMessage:save")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$state","api","socket","toasty","mailAccounts","rpcMailAccounts","userProfile","userProfileSection","Auth"],angular.module("app.mail").controller("MailAccountsRealtimeController",e)}(),function(){"use strict";function e(e,o,t,n,a,i,s,r,l,d,c,m,u,p,g,v,h,f){var b=this,E=["userpic","online","lastLoginAt","lastPauseAt","pauseType","lastPauseAt","internal","address","chatPause","openchannelPause","mailPause","smsPause","faxPause","voicePause","chatCapacity","openchannelCapacity","mailCapacity","smsCapacity","faxCapacity","chatCurrentCapacity","openchannelCurrentCapacity","mailCurrentCapacity","smsCurrentCapacity","faxCurrentCapacity","chatStatus","openchannelStatus","mailStatus","smsStatus","faxStatus","voiceStatus","chatStatusTime","openchannelStatusTime","mailStatusTime","smsStatusTime","faxStatusTime","voiceStatusTime","queue","destconnectedlinenum","onhold"],A=["chatPause","openchannelPause","mailPause","smsPause","faxPause","voicePause","online"];for(var y in b.currentUser=v.getCurrentUser(),b.availableStates=["ringing","inuse","busy","onhold","not_inuse"],b.pauses=s||{count:0,rows:[]},b.license=h,b.userProfile=p,b.userProfileSection=g&&1==g.count?g.rows[0]:null,b.crudPermissions=v.parseCrudPermissions(b.userProfileSection?b.userProfileSection.crudPermissions:null),b.agents=r?_.keyBy(r.rows?r.rows:[],"id"):{},b.rpcAgents=l?_.keyBy(l.rows?l.rows:[],"id"):{},b.paginatedAgents={},b.load=!1,b.order=[],b.agentInternal={},b.agents)b.agents.hasOwnProperty(y)&&(b.agents[y].init=!0);b.query={limit:10,page:1,order:"fullname",globalStatusFilter:"",pauseTypeFilter:""},b.logout=function(e,t){return d.user.logout({id:e.id,device:"realtime",agent_id:e.id,agent_name:e.name}).$promise.then(function(){m.success({title:"Agent logout",msg:e.fullname+"  properly logout"}),b.agents[e.id]&&(b.agents[e.id].online=!1),b.rpcAgents[e.id]&&(b.rpcAgents[e.id].online=!1),T()}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.queueAdd=function(e,t){n.show({controller:"AgentqueueaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/queueadd/queueadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{agent:e,agents:[],channel:"mail",direction:"inbound",crudPermissions:b.crudPermissions}})},b.pause=function(t,e){return d.user.pause({id:t.id,type:e}).$promise.then(function(e){b.agents[t.id]&&_.merge(b.agents[t.id],_.pick(e,E)),b.rpcAgents[t.id]&&_.merge(b.rpcAgents[t.id],_.pick(e,E)),O(b.agents[t.id])}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.unPause=function(t){return d.user.unpause({id:t.id}).$promise.then(function(e){b.agents[t.id]&&_.merge(b.agents[t.id],_.pick(e,E)),b.rpcAgents[t.id]&&_.merge(b.rpcAgents[t.id],_.pick(e,E)),O(b.agents[t.id])}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.showInfo=function(e){n.show(n.alert().clickOutsideToClose(!0).title("Legend").htmlContent("<div>TODO legend status + state</div>").ok("Ok").targetEvent(e))},b.getAgentStatus=w,b.getAgentGlobalStatus=O,b.isPause=I,b.checkPause=function(e){return"pause"===e},b.isPartialPause=function(e){return"*pause"===e},b.onSave=function(e){b.agents[e.id]&&(_.merge(b.agents[e.id],_.pick(_.omit(e,A),E)),_.merge(b.rpcAgents[e.id],_.pick(_.omit(e,A),E)),O(b.agents[e.id]))},b.onUpdate=function(e){b.agents[e.id]&&(_.merge(b.agents[e.id],_.pick(e,E)),_.merge(b.rpcAgents[e.id],_.pick(e,E)),e.lastPauseAt&&(b.agents[e.id].globalStatusTime=e.lastPauseAt,b.rpcAgents[e.id].globalStatusTime=e.lastPauseAt),O(b.agents[e.id]))},b.onInit=T,b.onConnect=function(e){b.agents[b.agentInternal[e.destaccountcode]]&&(_.merge(b.agents[b.agentInternal[e.destaccountcode]],_.pick(e,["queue","destconnectedlinenum"])),_.merge(b.rpcAgents[b.agentInternal[e.destaccountcode]],_.pick(e,["queue","destconnectedlinenum"])))},b.onComplete=function(e){b.agents[b.agentInternal[e.destaccountcode]]&&(b.agents[b.agentInternal[e.destaccountcode]]=_.omit(b.agents[b.agentInternal[e.destaccountcode]],["queue","destconnectedlinenum"]),b.rpcAgents[b.agentInternal[e.destaccountcode]]=_.omit(b.rpcAgents[b.agentInternal[e.destaccountcode]],["queue","destconnectedlinenum"]))},c.on("user:save",b.onSave),c.on("user:update",b.onUpdate),c.on("user:agentconnect",b.onConnect),c.on("user:agentcomplete",b.onComplete),T();var S=f(function(){b.load&&(b.load=!1,T())},999);function T(e){b.load=!1;var t,n,a=o.defer();b.promise=a.promise,b.filteredAgents=[],b.order=[],_.forIn(b.agents,function(e,t){b.rpcAgents[t]&&_.merge(e,_.pick(_.omit(b.rpcAgents[t],A),E)),O(e),e.online?(b.filteredAgents.push(e),b.agentInternal[e.internal]=t):e.globalStatusTime=_.toNumber(moment().format("x"))}),b.query.globalStatusFilter&&_.remove(b.filteredAgents,function(e){return e.globalStatus!==b.query.globalStatusFilter}),b.query.pauseTypeFilter&&_.remove(b.filteredAgents,function(e){return e.pauseType!==b.query.pauseTypeFilter}),b.query.filter&&_.remove(b.filteredAgents,function(e){return e.fullname.toLowerCase().indexOf(b.query.filter.toLowerCase())<0}),b.filteredAgents=(t=b.filteredAgents,n=_.startsWith(b.query.order,"-")?"desc":"asc",_.orderBy(t,[b.query.order.replace("-","")],[n]));var i=(b.query.page-1)*b.query.limit;b.paginatedAgents=_.drop(b.filteredAgents,i).slice(0,b.query.limit);for(var s=0;s<b.paginatedAgents.length;s+=1)b.order.push(b.paginatedAgents[s].id);a.resolve(),b.load=!0}function I(e){return"pause"===e||"*pause"===e}function C(e){return"idle"===e||"unknown"===e||"unavailable"===e||"ringing"===e||_.isNil(e)}function w(e,t){return"voice"===t?"idle"!==e[t+"Status"]?e[t+"Status"]:e[t+"Pause"]?e[t+"Status"]="pause":"idle":e[t+"Pause"]?e[t+"Status"]="pause":e[t+"Status"]}function O(e){var t="unknown";t=_.every([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],I)?"pause":_.some([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],I)?"*pause":_.every([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],C)?"idle":"busy",e.globalStatus!==t&&(e.globalStatus=t,e.init?(e.init=!1,e.globalStatusTime=I(t)?_.toNumber(moment(e.lastPauseAt).format("x")):_.max([e.voiceStatusTime,e.chatStatusTime,e.mailStatusTime,e.smsStatusTime,e.openchannelStatusTime,e.faxStatusTime])):e.globalStatusTime=_.toNumber(moment().format("x")))}e.$on("$destroy",function(){c.removeAllListeners("user:save"),c.removeAllListeners("user:update"),c.removeAllListeners("user:agentconnect"),c.removeAllListeners("user:agentcomplete"),S&&(f.cancel(S),S=null)})}e.$inject=["$scope","$q","$timeout","$mdDialog","$document","$filter","pauses","agents","rpcAgents","api","socket","toasty","helperClasses","userProfile","userProfileSection","Auth","license","$interval"],angular.module("app.voice").controller("AgentsMailRealtimeController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this,v=["loggedIn","available","waiting","talking","pTalking","originated","message","dialActive","dialMethod","Trunk","paused"];function h(){var n=[];return _.forIn(g.queues,function(e,t){e.paused=0,e.loggedInDb=0,g.queues[t].agents={},n.push(l.mailQueue.getMembers({id:t}).$promise),g.rpcQueues[t]&&_.merge(e,_.pick(g.rpcQueues[t],v))}),t.all(n).then(function(e){for(var t=0;t<e.length;t+=1)for(var n=0;n<e[t].rows.length;n++)e[t].rows[n].paused&&g.queues[e[t].rows[n].MailQueueId].paused++,g.queues[e[t].rows[n].MailQueueId].loggedInDb++,g.queues[e[t].rows[n].MailQueueId].agents[e[t].rows[n].UserId]=e[t].rows[n].MailQueueId}).catch(function(e){console.error(e)})}g.currentUser=p.getCurrentUser(),g.count=o.count?o.count:0,g.queues=o?_.keyBy(o.rows?o.rows:[],"id"):{},g.rpcQueues=r?_.keyBy(r.rows?r.rows:[],"id"):{},g.userProfile=m,g.userProfileSection=u&&1==u.count?u.rows[0]:null,g.crudPermissions=p.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),p.hasRole("admin")?g.query={type:"inbound",sort:"-updatedAt",limit:10,page:1}:g.query={id:g.currentUser.id,channel:"mail",type:"inbound",sort:"-updatedAt",limit:10,page:1},g.success=E,g.getQueues=function(){g.query.offset=(g.query.page-1)*g.query.limit,p.hasRole("admin")?g.promise=l.mailQueue.get(g.query,E).$promise:(g.query.id=g.userProfile.id,g.query.section="MailQueues",g.promise=l.userProfile.getResources(g.query,E).$promise)},g.createOrEditMailQueue=function(e,t){a.show({controller:"CreateOrEditMailQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailQueue:t,mailQueues:_.values(g.queues),license:null,setting:null,crudPermissions:g.crudPermissions}})},g.agentAdd=function(e,t){a.show({controller:"MailQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailQueue:t,mailQueues:g.queues?g.queues.rows:[],realtime:!1,crudPermissions:g.crudPermissions}})},g.updateQueue=function(e){return l.mailQueue.update(e).$promise.then(function(){c.success({title:"Queue properly updated!",msg:e.name?e.name+" has been updated!":""})}).catch(function(e){c.error({title:"Error creating queue!",msg:e.message})})},g.onSave=function(e){g.queues[e.id]&&_.merge(g.queues[e.id],_.pick(e,v))},g.onSaveMember=function(e){g.queues[e.MailQueueId]&&g.queues[e.MailQueueId].loggedInDb++},g.onRemoveMember=function(e){g.queues[e.MailQueueId]&&g.queues[e.MailQueueId].loggedInDb--},g.onPause=function(n){console.log("onPause",n),n.voicePause?_.forIn(g.queues,function(e,t){e.agents[n.id]&&(e.paused+=1,console.log("pause"))}):n.voicePause||_.forIn(g.queues,function(e,t){e.agents[n.id]&&0<e.paused&&(e.paused-=1,console.log("unpause"))})},g.onLogin=function(e){console.log("onLogged",e),g.queues[e.MailQueueId]&&(g.queues[e.MailQueueId].loggedInDb+=1,g.queues[e.MailQueueId].agents[e.UserId]=e.MailQueueId)},g.onLogout=function(e){console.log("onLogout",e),g.queues[e.MailQueueId]&&0<g.queues[e.MailQueueId].loggedInDb&&(g.queues[e.MailQueueId].loggedInDb-=1,delete g.queues[e.MailQueueId].agents[e.UserId])},g.$onInit=h,g.order=[],_.forIn(g.queues,function(e,t){g.order.push(e.id)}),d.on("mail_queue:save",g.onSave),d.on("userMailQueue:save",g.onSaveMember),d.on("userMailQueue:remove",g.onRemoveMember),d.on("user:update",g.onPause),d.on("userVoiceQueue:remove",g.onLogout),d.on("userVoiceQueue:save",g.onLogin);var f=!0,b=1;function E(e){if(g.count=e.count,g.queues=e?_.keyBy(e.rows?e.rows:[],"id"):{},e.rows){g.order=[];for(var t=0;t<e.rows.length;t++)g.order.push(e.rows[t].id)}h()}e.$watch("vm.query.filter",function(e,t){f?n(function(){f=!1}):(t||(b=g.query.page),e!==t&&(g.query.page=1),e||(g.query.page=b),g.getQueues())}),e.$on("$destroy",function(){d.removeAllListeners("mail_queue:save"),d.removeAllListeners("userMailQueue:remove"),d.removeAllListeners("userMailQueue:save"),d.removeAllListeners("user:update"),d.removeAllListeners("userVoiceQueue:remove"),d.removeAllListeners("userVoiceQueue:save")})}e.$inject=["$scope","$timeout","$mdDialog","$q","$document","$interval","queues","rpcQueues","api","socket","toasty","userProfile","userProfileSection","Auth"],angular.module("app.mail").controller("QueuesMailRealtimeController",e)}(),function(){"use strict";angular.module("app.auth").factory("helperClasses",function(){return{status:{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"},state:{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"},channelStatus:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},channelStatusOut:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"}}})}(),function(){"use strict";function e(e,n,t){switch(t.disconnect(),t.connect(),this.selectedTab=0,n.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,n.go("app.mail.realtime.agents")}e.$watch("vm.selectedTab",function(e,t){if(e!==t)switch(e){case 0:n.go("app.mail.realtime.agents");break;case 1:n.go("app.mail.realtime.queues");break;case 2:n.go("app.mail.realtime.accounts");break;default:n.go("app.mail.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.mail").controller("MailRealtimeController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.plugins,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The plugin will be deleted.").ariaLabel("Delete Plugin").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,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=t.protocol()+"://"+t.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")},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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.plugins=l||{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="plugins",b.listOrder="",b.listOrderAsc=null,b.selectedPlugins=[],b.query={fields:"createdAt,updatedAt,id,name,type,active,description,icon,sidebar,path,adminUrl,agentUrl,scriptName,scriptPath,version",sort:"name",limit:10,page:1},b.installing=!1,b.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"),"")}),b.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){b.errors=e.data.errors||[{message:e.toString(),type:"api.plugin.update"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})});b.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(){b.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){b.errors=e.data.errors||[{message:e.toString(),type:"api.pm2.save"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})})}},b.editstate=function(e,t){n.go("app.marketplace.plugins.edit",{id:e.id,plugin:e,crudPermissions:b.crudPermissions})},b.stopplugin=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){var n;n=e,m.pm2.get().$promise.then(function(e){if(!e||!e.rows)throw new Error("Failed to retrieve pm2 processes");var t=_.find(e.rows,{name:n.scriptName});if(!t)throw new Error("No corresponding process found");m.pm2.update({id:t.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){b.errors=e.data.errors||[{message:e.toString(),type:"api.pm2.update"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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")})},b.restartplugin=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){var n;n=e,m.pm2.get().$promise.then(function(e){if(!e||!e.rows)throw new Error("Failed to retrieve pm2 processes");var t=_.find(e.rows,{name:n.scriptName});if(!t)throw new Error("No corresponding process found");m.pm2.update({id:t.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){b.errors=e.data.errors||[{message:e.toString(),type:"api.pm2.update"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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")})},b.downloadfile2=function(s,e){return m.plugin.download({id:s.id}).$promise.then(function(e){var t=[e.buffer],n="download",a=new Blob(t,{type:e.type});n=s.name.replace(" ","_").toLowerCase()+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})})},b.uninstallplugin=function(e,t){var n=i.confirm().title("Are you sure want to uninstall the plugin?").htmlContent("<b>"+(e.name||"plugin")+"</b> will be uninstalled.").ariaLabel("uninstall plugin").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){!function(n){"script"===n.type&&m.pm2.get().$promise.then(function(e){if(!e||!e.rows)throw new Error("Failed to retrieve pm2 processes");var t=_.find(e.rows,{name:n.scriptName});if(!t)throw new Error("No corresponding process found");m.pm2.delete({id:t.pm_id,name:n.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()})});n.active=!1,m.plugin.update({id:n.id},n).$promise.then(function(){p.success({title:"Plugin uninstalled!",msg:n.name?n.name+" has been uninstalled!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){b.errors=e.data.errors||[{message:e.toString(),type:"api.plugin.update"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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")})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getPlugins=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.plugin.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Plugins",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditPlugin=function(e,t){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:t,plugins:b.plugins.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deletePlugin=S,b.exportSelectedPlugins=function(){var e=angular.copy(b.selectedPlugins);return b.selectedPlugins=[],e},b.deleteSelectedPlugins=function(e){var t=i.confirm().title("Are you sure want to delete the selected plugins?").htmlContent("<b>"+b.selectedPlugins.length+" selected</b> will be deleted.").ariaLabel("delete Plugins").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedPlugins.forEach(function(e){S(e)}),b.selectedPlugins=[]})},b.deselectPlugins=function(){b.selectedPlugins=[]},b.selectAllPlugins=function(){b.selectedPlugins=b.plugins.rows},b.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:b.plugins.rows}})};var E=!0,A=1;function y(e){b.plugins=e||{count:0,rows:[]}}function S(n){n.active&&"script"==n.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 t=_.find(e.rows,{name:n.scriptName});t?m.pm2.delete({id:t.pm_id,name:n.scriptName}).$promise:console.log("No '%s' process found",n.scriptName)}).catch(function(e){return p.error({title:"PM2 process not found!",msg:"Failed to delete the attached pm2 process"})}),m.plugin.delete({id:n.id}).$promise.then(function(){_.remove(b.plugins.rows,{id:n.id}),b.plugins.count-=1,b.plugins.rows.length||b.getPlugins(),p.success({title:_.startCase("Plugin")+" deleted!",msg:n.name?n.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:DELETEplugin"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getPlugins())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","plugins","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.marketplace").controller("MarketplacePluginsController",e)}(),function(){"use strict";function e(e,t,n,a,i,s){var o=this,r=2,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 t=["zip"];if(!_.includes(t,e.getExtension()))return n.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+t.join()}),!1;if(e.size>l)return n.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(t,e){if(t.id===a.uniqueIdentifier){var n=new FileReader;n.readAsDataURL(t.file.file),n.onload=function(e){t.url=e.target.result}}})},o.uploadError=function(e,t){o.ngFlow.flow.cancel(),n.error({title:"Upload error",msg:"Cannot upload the plugin"}),o.uploadState="failed"},o.uploadComplete=function(){"failed"!==o.uploadState&&(o.uploadState="completed",n.success({title:"Upload completed",msg:o.plugin.file.name+" uploaded successfully"}))},o.closeDialog=function(){t.hide()}}e.$inject=["$cookies","$mdDialog","toasty","plugins","api","Auth"],angular.module("app.marketplace").controller("UploadPluginDialogController",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(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,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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.ivrCampaigns,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The ivrCampaign will be deleted.").ariaLabel("Delete IvrCampaign").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.trunks,{id:e.resourceId})});g.trunks.forEach(function(e){_.some(t,["id",e.id])||(e.canSelect=!1),t.push(e)}),g.trunks=t})}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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.projects,{id:e.resourceId})}),n=null;if(g.ivrCampaign&&(n=_.find(g.projects,{id:Number(g.ivrCampaign.SquareProjectId)})),n&&!_.some(t,["id",n.id])){var a=_.find(g.projects,{id:n.id});a.canSelect=!1,t.push(a)}g.projects=t})}else{var n=[],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,n.push(g.projects[i]));g.projects=n}}).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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.interval,{id:e.resourceId})}),n=null;if(g.ivrCampaign&&(n=_.find(g.interval,{id:Number(g.ivrCampaign.IntervalId)})),n&&!_.some(t,["id",n.id])){var a=_.find(g.interval,{id:n.id});a.canSelect=!1,t.push(a)}g.interval=t})}else{var n=[],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,n.push(g.interval[i]));g.interval=n}}).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,t,n,o,r,l){var d=this;function c(){return a(function(n,t){return a(function(t,n){return s.cmList.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return d.items=e.rows?e.rows:[],r.hasRole("admin")?e:d.section?d.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:d.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return d.allowedItems=_.map(t,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 t=_.find(d.allowedItems,{id:e.id});"admin"===d.currentUser.role?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s[d.apiRoute][d.getApi]({id:d.ivrCampaign.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];d.selectedItems=_.map(t,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"),n()}).catch(function(e){t(e)})})}d.currentUser=r.getCurrentUser(),d.ivrCampaign=t,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={readOnly:!d.crudPermissions.canEdit,allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!1,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:n.instant("MOTIONDIALER.ALL_LISTS"),labelSelected:n.instant("MOTIONDIALER.SELECTED_LISTS"),transferCallback:function(e,t){var n=_.xorBy(d.startingSelectedItems,d.selectedItems,"id");d.pendingChanges=!_.isEmpty(n)}},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(n,t){s.userProfileSection.get({userProfileId:d.currentUser.userProfileId,name:"Lists"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(d.selectedItems,d.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s[d.apiRoute][d.removeApi]({id:d.ivrCampaign.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s[d.apiRoute][d.addApi]({id:d.ivrCampaign.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},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(t,n,a,e,i,s,o){var r=this;function l(e){t.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!":""}),n.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 t=0;t<e.data.errors.length;t+=1)a.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.ivrCampaign={},c.ivrCampaignHopperBlacks={count:0,rows:[]},c.selectedIvrCampaignHopperBlacks=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,ContactId,phone",sort:"-id",limit:10,page:1},c.init=function(e,t){c.ivrCampaign=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.ivrCampaign.id,c.query.CampaignId=c.ivrCampaign.id,c.getIvrCampaignHopperBlacks()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the hopperBlack?").htmlContent("<b>"+(e.name||"hopperBlack")+"</b> will be deleted.").ariaLabel("delete hopperBlack").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getIvrCampaignHopperBlacks=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.campaign.getHopperBlacks(c.query,p).$promise},c.createOrEditIvrCampaignHopperBlack=function(e,t){s.show({controller:"CreateOrEditHopperBlackDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/hopperBlacks/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:c.ivrCampaign,hopperBlack:t,hopperBlacks:c.ivrCampaignHopperBlacks.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedIvrCampaignHopperBlacks=function(){var e=angular.copy(c.selectedIvrCampaignHopperBlacks);return c.selectedIvrCampaignHopperBlacks=[],e},c.deleteIvrCampaignHopperBlack=g,c.deleteSelectedIvrCampaignHopperBlacks=function(e){var t=s.confirm().title("Are you sure want to delete the selected hopperBlacks?").htmlContent("<b>"+c.selectedIvrCampaignHopperBlacks.length+" selected</b> will be deleted.").ariaLabel("delete hopperBlacks").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedIvrCampaignHopperBlacks.forEach(function(e){g(e)}),c.selectedIvrCampaignHopperBlacks=[]})};var m=!0,u=1;function p(e){c.ivrCampaignHopperBlacks=e||{count:0,rows:[]}}function g(e){l.hopperBlack.delete({id:e.id}).$promise.then(function(){_.remove(c.ivrCampaignHopperBlacks.rows,{id:e.id}),c.ivrCampaignHopperBlacks.count-=1,c.ivrCampaignHopperBlacks.rows.length||c.getIvrCampaignHopperBlacks(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcampaign"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getIvrCampaignHopperBlacks())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("IvrCampaignHopperBlacksController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.contacts={},c.ivrCampaign={},c.ivrCampaignHopperFinals={count:0,rows:[]},c.selectedIvrCampaignHopperFinals=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,uniqueid,ContactId,calleridnum,calleridname,statedesc,countcongestionretry,countbusyretry,countnoanswerretry,countglobal,scheduledat,starttime,responsetime,endtime,disposition,ListId,UserId,VoiceQueueId,CampaignId,recallme,deleted,campaign",sort:"-id",limit:10,page:1},c.init=function(e,t){c.ivrCampaign=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.ivrCampaign.id,c.query.CampaignId=c.ivrCampaign.id,c.getIvrCampaignHopperFinals()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the hopperFinal?").htmlContent("<b>"+(e.name||"hopperFinal")+"</b> will be deleted.").ariaLabel("delete hopperFinal").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getIvrCampaignHopperFinals=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.campaign.getHopperFinals(c.query,p).$promise},c.createOrEditIvrCampaignHopperFinal=function(e,t){s.show({controller:"CreateOrEditHopperFinalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/hopperFinals/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:c.ivrCampaign,hopperFinal:t,hopperFinals:c.ivrCampaignHopperFinals.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedIvrCampaignHopperFinals=function(){var e=angular.copy(c.selectedIvrCampaignHopperFinals);return c.selectedIvrCampaignHopperFinals=[],e},c.deleteIvrCampaignHopperFinal=g,c.deleteSelectedIvrCampaignHopperFinals=function(e){var t=s.confirm().title("Are you sure want to delete the selected hopperFinals?").htmlContent("<b>"+c.selectedIvrCampaignHopperFinals.length+" selected</b> will be deleted.").ariaLabel("delete hopperFinals").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedIvrCampaignHopperFinals.forEach(function(e){g(e)}),c.selectedIvrCampaignHopperFinals=[]})},c.moveIvrCampaignHopperFinal=v,c.moveContactsIvrCampaignHopperFinal=function(e){l.cmHopperFinal.moveContactsIvrCampaignHopperFinal({id:c.query.id,state:e}).$promise.then(function(e){_.isNil(e)&&_.isNil(e[0])?r.info({title:"Restored Contacts",msg:"0"}):r.info({title:"Restored Contacts",msg:JSON.stringify(e[0].affectedRows)})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},c.countContactsIvrCampaignHopperFinal=function(e){l.cmHopperFinal.countContactsIvrCampaignHopperFinal({id:e}).$promise.then(function(e){_.merge(c.contacts,e[0])}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},c.moveConfirm=function(e,t){var n=s.confirm().title("Are you sure want to restore the contact?").htmlContent("<b>Contact</b> will be restored.").ariaLabel("Restore Contact").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){v(e)},function(){console.log("CANCEL")})},c.moveSelectedIvrCampaignHopperFinals=function(e){var t=s.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");s.show(t).then(function(){c.selectedIvrCampaignHopperFinals.forEach(function(e){v(e)}),c.selectedIvrCampaignHopperFinals=[]})};var m=!0,u=1;function p(e){c.ivrCampaignHopperFinals=e||{count:0,rows:[]}}function g(e){l.hopperFinal.delete({id:e.id}).$promise.then(function(){_.remove(c.ivrCampaignHopperFinals.rows,{id:e.id}),c.ivrCampaignHopperFinals.count-=1,c.ivrCampaignHopperFinals.rows.length||c.getIvrCampaignHopperFinals(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcampaign"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.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){l.cmHopperFinal.checkContactHopper(a).$promise.then(function(e){r.info({title:"The contact is in the hopper",msg:"Contact ID "+e.ContactId})}).catch(function(e){var t,n;"Not Found"===e.data?l.cmHopper.save((t=a,n={},n.phone=t.calleridnum,n.scheduledat=moment().format("YYYY-MM-DD HH:mm:ss"),n.countbusyretry=0,n.countcongestionretry=0,n.countnoanswerretry=0,n.countglobal=0,n.ContactId=t.ContactId,n.ListId=t.ListId,n.UserId=t.deleted?null:t.UserId,n.VoiceQueueId=t.VoiceQueueId,n.CampaignId=t.CampaignId,n.priority=t.recallme?3:2,n.recallme=!!t.recallme,n)).$promise.then(function(e){var t,n;r.info({title:"Restored Contact",msg:"Contact ID "+e.ContactId}),e.ContactId&&l.cmHopperHistory.save(((n={}).calleridnum=(t=a).calleridnum,n.calleridname=t.calleridname,n.scheduledat=moment().format("YYYY-MM-DD HH:mm:ss"),n.countbusyretry=t.countbusyretry,n.countcongestionretry=t.countcongestionretry,n.countnoanswerretry=t.countnoanswerretry,n.countglobal=t.countglobal,n.ContactId=t.ContactId,n.ListId=t.ListId,n.UserId=d.getCurrentUser().id,n.VoiceQueueId=t.VoiceQueueId,n.CampaignId=t.CampaignId,n.editedat=moment().format("YYYY-MM-DD HH:mm:ss"),n.edited=!0,n.state=25,n.statedesc="Restored",n.campaign=t.campaign,n.campaigntype=t.VoiceQueueId?"queue":"ivr",n))}).catch(function(e){_.isNil(e.data)||"Validation error"!==e.data.message?r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()}):r.info({title:"The contact is in the hopper",msg:"Contact ID "+a.ContactId})}):r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getIvrCampaignHopperFinals())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("IvrCampaignHopperFinalsController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.ivrCampaign={},c.ivrCampaignHopperHistories={count:0,rows:[]},c.selectedIvrCampaignHopperHistories=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,uniqueid,ContactId,calleridnum,calleridname,statedesc,scheduledat,starttime,responsetime,endtime",sort:"-id",limit:10,page:1},c.init=function(e,t){c.ivrCampaign=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.ivrCampaign.id,c.query.CampaignId=c.ivrCampaign.id,c.getIvrCampaignHopperHistories()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the hopperHistory?").htmlContent("<b>"+(e.name||"hopperHistory")+"</b> will be deleted.").ariaLabel("delete hopperHistory").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getIvrCampaignHopperHistories=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.campaign.getHopperHistories(c.query,p).$promise},c.createOrEditIvrCampaignHopperHistory=function(e,t){s.show({controller:"CreateOrEditHopperHistoryDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/hopperHistories/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:c.ivrCampaign,hopperHistory:t,hopperHistories:c.ivrCampaignHopperHistories.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedIvrCampaignHopperHistories=function(){var e=angular.copy(c.selectedIvrCampaignHopperHistories);return c.selectedIvrCampaignHopperHistories=[],e},c.deleteIvrCampaignHopperHistory=g,c.deleteSelectedIvrCampaignHopperHistories=function(e){var t=s.confirm().title("Are you sure want to delete the selected hopperHistories?").htmlContent("<b>"+c.selectedIvrCampaignHopperHistories.length+" selected</b> will be deleted.").ariaLabel("delete hopperHistories").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedIvrCampaignHopperHistories.forEach(function(e){g(e)}),c.selectedIvrCampaignHopperHistories=[]})};var m=!0,u=1;function p(e){c.ivrCampaignHopperHistories=e||{count:0,rows:[]}}function g(e){l.hopperHistory.delete({id:e.id}).$promise.then(function(){_.remove(c.ivrCampaignHopperHistories.rows,{id:e.id}),c.ivrCampaignHopperHistories.count-=1,c.ivrCampaignHopperHistories.rows.length||c.getIvrCampaignHopperHistories(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcampaign"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getIvrCampaignHopperHistories())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("IvrCampaignHopperHistoriesController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.ivrCampaign={},c.ivrCampaignHoppers={count:0,rows:[]},c.selectedIvrCampaignHoppers=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,ContactId,phone,countcongestionretry,countbusyretry,countnoanswerretry,scheduledat,priority",sort:"-updatedAt",limit:10,page:1},c.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"),"")}),c.init=function(e,t){c.ivrCampaign=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.ivrCampaign.id,c.query.CampaignId=c.ivrCampaign.id,c.getIvrCampaignHoppers()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the hopper?").htmlContent("<b>"+(e.name||"hopper")+"</b> will be deleted.").ariaLabel("delete hopper").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getIvrCampaignHoppers=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.campaign.getHoppers(c.query,p).$promise},c.createOrEditIvrCampaignHopper=function(e,t){s.show({controller:"CreateOrEditHopperCampaignIdDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/hoppers/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:c.ivrCampaign,hopper:t,hoppers:c.ivrCampaignHoppers.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedIvrCampaignHoppers=function(){var e=angular.copy(c.selectedIvrCampaignHoppers);return c.selectedIvrCampaignHoppers=[],e},c.deleteIvrCampaignHopper=g,c.deleteSelectedIvrCampaignHoppers=function(e){var t=s.confirm().title("Are you sure want to delete the selected hoppers?").htmlContent("<b>"+c.selectedIvrCampaignHoppers.length+" selected</b> will be deleted.").ariaLabel("delete hoppers").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedIvrCampaignHoppers.forEach(function(e){g(e)}),c.selectedIvrCampaignHoppers=[]})},d.hasRole("admin")?l.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){c.agents=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){c.agents=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(c.agents,{id:e.resourceId})});c.agents.forEach(function(e){_.some(t,["id",e.id])||(e.canSelect=!1),t.push(e)}),c.agents=t})}else c.agents=[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})});var m=!0,u=1;function p(e){c.ivrCampaignHoppers=e||{count:0,rows:[]}}function g(e){l.cmHopper.delete({id:e.id}).$promise.then(function(){_.remove(c.ivrCampaignHoppers.rows,{id:e.id}),c.ivrCampaignHoppers.count-=1,c.ivrCampaignHoppers.rows.length||c.getIvrCampaignHoppers(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcampaign"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getIvrCampaignHoppers())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("IvrCampaignHoppersController",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(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),t.params.id&&(g.hopper.CampaignId=t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 n,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){n=_.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:n,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 t=_.find(g.hoppers,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The hopper will be deleted.").ariaLabel("Delete Hopper").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.agents,{id:e.resourceId})});g.agents.forEach(function(e){_.some(t,["id",e.id])||(e.canSelect=!1),t.push(e)}),g.agents=t})}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(n,a){var i=this;i.ivrCampaign={},i.init=function(t){i.ivrCampaign=t,n.cmHopper.get({limit:0,CampaignId:t.id}).$promise.then(function(e){return i.total=e.count||0,n.cmHopper.get({limit:0,CampaignId:t.id,active:!1,countbusyretry:0,countcongestionretry:0,countnoanswerretry:0}).$promise}).then(function(e){return i.fresh=e.count||0,n.cmHopperFinal.get({limit:0,CampaignId:t.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,t,n,o,r,l){var d=this;function c(){return a(function(n,t){return a(function(t,n){return s.cmList.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return d.items=e.rows?e.rows:[],r.hasRole("admin")?e:d.section?d.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:d.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return d.allowedItems=_.map(t,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 t=_.find(d.allowedItems,{id:e.id});"admin"===d.currentUser.role?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s[d.apiRoute][d.getApi]({id:d.ivrCampaign.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];d.selectedItems=_.map(t,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"),n()}).catch(function(e){t(e)})})}d.currentUser=r.getCurrentUser(),d.ivrCampaign=t,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={readOnly:!d.crudPermissions.canEdit,allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!1,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:n.instant("MOTIONDIALER.ALL_LISTS"),labelSelected:n.instant("MOTIONDIALER.SELECTED_LISTS"),transferCallback:function(e,t){var n=_.xorBy(d.startingSelectedItems,d.selectedItems,"id");d.pendingChanges=!_.isEmpty(n)}},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(n,t){s.userProfileSection.get({userProfileId:d.currentUser.userProfileId,name:"Lists"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(d.selectedItems,d.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s[d.apiRoute][d.removeApi]({id:d.ivrCampaign.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s[d.apiRoute][d.addApi]({id:d.ivrCampaign.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},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,t,a,i,s,n,o,r){var l=this;function d(){t.hide()}function c(e,t){var n=t.id;o.enqueue(function(){return i.campaign.removeLists({id:e,ids:n}).$promise.then(function(){return i.campaign.addLists({id:e,ids:n,dialCheckDuplicateType:"never"}).$promise}).then(function(){a.success({title:"Reset Succesfull",msg:"List "+t.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=n||[],l.loading=!1,l.closeDialog=d,l.exists=function(e,t){return-1<t.indexOf(e)},l.toggle=function(e,t){var n=t.indexOf(e);-1<n?t.splice(n,1):t.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,t){for(var n=0;n<l.selected.length;n+=1)c(s.id,l.selected[n]);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(n,e,i,s,a,t,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=t,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.ivrCampaign=c||n.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=n.params.tab||0,u.clonedialog=function(e,t){i.show({controller:"IvrCampaigncloneController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:u.ivrCampaigns?u.ivrCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.listadddialog=function(e,t){i.show({controller:"IvrCampaignlistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/listadd/listadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:u.ivrCampaigns?u.ivrCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.blacklistadddialog=function(e,t){i.show({controller:"IvrCampaignblacklistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/blacklistadd/blacklistadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:u.ivrCampaigns?u.ivrCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.resetlistdialog=function(t,n){r.campaign.getLists({id:t.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(n).ok("OK").cancel("CANCEL");i.show(e).then(function(){var e,t,n;e=u.ivrCampaign.id,t=a.rows[0],n=t.id,r.campaign.removeLists({id:e,ids:n}).$promise.then(function(){return r.campaign.addLists({id:e,ids:n,dialCheckDuplicateType:"never"}).$promise}).then(function(){l.success({title:"Reset Succesfull",msg:"List "+t.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:n,clickOutsideToClose:!1,locals:{ivrCampaign:t,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,t){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:1510}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.motiondialer.realtime.ivr_campaigns",{})}},u.alert=l.info,u.gotoIvrCampaigns=function(){n.go("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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.trunks,{id:e.resourceId})});u.trunks.forEach(function(e){_.some(t,["id",e.id])||(e.canSelect=!1),t.push(e)}),u.trunks=t})}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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.projects,{id:e.resourceId})}),n=null;if(u.ivrCampaign&&(n=_.find(u.projects,{id:Number(u.ivrCampaign.SquareProjectId)})),n&&!_.some(t,["id",n.id])){var a=_.find(u.projects,{id:n.id});a.canSelect=!1,t.push(a)}u.projects=t})}else{var n=[],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,n.push(u.projects[i]));u.projects=n}}).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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.interval,{id:e.resourceId})}),n=null;if(u.ivrCampaign&&(n=_.find(u.interval,{id:Number(u.ivrCampaign.IntervalId)})),n&&!_.some(t,["id",n.id])){var a=_.find(u.interval,{id:n.id});a.canSelect=!1,t.push(a)}u.interval=t})}else{var n=[],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,n.push(u.interval[i]));u.interval=n}}).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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.ivrCampaigns=l||{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="ivrCampaigns",b.listOrder="",b.listOrderAsc=null,b.selectedIvrCampaigns=[],b.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,dialOrderByScheduledAt,dialGlobalInterval,dialTimezone,dialPrefix,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength",type:"ivr",sort:"-updatedAt",limit:10,page:1},b.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"),"")}),b.arraydialOrderByScheduledAt=_.keyBy([{option:"DESC",value:"'DESC'"},{option:"ASC",value:"'ASC'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.motiondialer.ivrCampaigns.edit",{id:e.id,ivrCampaign:e,crudPermissions:b.crudPermissions})},b.clonedialog=function(e,t){i.show({controller:"IvrCampaigncloneController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:b.ivrCampaigns?b.ivrCampaigns.rows:[],crudPermissions:b.crudPermissions}})},b.listadddialog=function(e,t){i.show({controller:"IvrCampaignlistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/listadd/listadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:b.ivrCampaigns?b.ivrCampaigns.rows:[],crudPermissions:b.crudPermissions}})},b.blacklistadddialog=function(e,t){i.show({controller:"IvrCampaignblacklistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/blacklistadd/blacklistadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:b.ivrCampaigns?b.ivrCampaigns.rows:[],crudPermissions:b.crudPermissions}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.gotorealtimegoto=function(e,t){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:1510}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.motiondialer.realtime.ivr_campaigns",{})}},b.success=y,b.getIvrCampaigns=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.campaign.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="IvrCampaigns",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditIvrCampaign=function(e,t){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:t,ivrCampaigns:b.ivrCampaigns.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteIvrCampaign=S,b.exportSelectedIvrCampaigns=function(){var e=angular.copy(b.selectedIvrCampaigns);return b.selectedIvrCampaigns=[],e},b.deleteSelectedIvrCampaigns=function(e){var t=i.confirm().title("Are you sure want to delete the selected ivrCampaigns?").htmlContent("<b>"+b.selectedIvrCampaigns.length+" selected</b> will be deleted.").ariaLabel("delete IvrCampaigns").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedIvrCampaigns.forEach(function(e){S(e)}),b.selectedIvrCampaigns=[]})},b.deselectIvrCampaigns=function(){b.selectedIvrCampaigns=[]},b.selectAllIvrCampaigns=function(){b.selectedIvrCampaigns=b.ivrCampaigns.rows},g.hasRole("admin")?m.trunk.get({fields:"id,name",sort:"name",table:"true"}).$promise.then(function(e){b.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){b.trunks=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(b.trunks,{id:e.resourceId})});b.trunks.forEach(function(e){_.some(t,["id",e.id])||(e.canSelect=!1),t.push(e)}),b.trunks=t})}else b.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){b.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){b.projects=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:1103}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(b.projects,{id:e.resourceId})}),a=null;a=[],b.ivrCampaigns.rows.forEach(function(e){var t=_.find(b.projects,{id:Number(e.SquareProjectId)});a.push(t)}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(b.projects,{id:e.id});t.canSelect=!1,n.push(t)}}),b.projects=n})}else{var n=[],a=[];b.ivrCampaigns.rows.forEach(function(e){var t=_.find(b.projects,{id:Number(e.SquareProjectId)});a.push(t)});for(var i=0;i<b.projects.length;i++){_.some(a,{id:b.projects[i].id})&&(b.projects[i].canSelect=!1,n.push(b.projects[i]))}b.projects=n}}).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){b.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){b.interval=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(b.interval,{id:e.resourceId})}),n=null;if(b.ivrCampaign&&(n=_.find(b.interval,{id:Number(b.ivrCampaign.IntervalId)})),n&&!_.some(t,["id",n.id])){var a=_.find(b.interval,{id:n.id});a.canSelect=!1,t.push(a)}b.interval=t})}else{var n=[],a=null;b.ivrCampaign&&(a=_.find(b.interval,{id:Number(b.ivrCampaign.IntervalId)}));for(var i=0;i<b.interval.length;i++)a&&b.interval[i].id===a.id&&(b.interval[i].canSelect=!1,n.push(b.interval[i]));b.interval=n}}).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 E=!0,A=1;function y(e){b.ivrCampaigns=e||{count:0,rows:[]}}function S(e){m.campaign.delete({id:e.id}).$promise.then(function(){_.remove(b.ivrCampaigns.rows,{id:e.id}),b.ivrCampaigns.count-=1,b.ivrCampaigns.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcampaign"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getIvrCampaigns())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","ivrCampaigns","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.motiondialer").controller("IvrCampaignsController",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(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},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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.queueCampaigns,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The queueCampaign will be deleted.").ariaLabel("Delete QueueCampaign").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.trunks,{id:e.resourceId})}),n=null;if(g.queueCampaign&&(n=_.find(g.trunks,{id:Number(g.queueCampaign.TrunkId)})),n&&!_.some(t,["id",n.id])){var a=_.find(g.trunks,{id:n.id});a.canSelect=!1,t.push(a)}g.trunks=t})}else{var n=[],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,n.push(g.trunks[i]));g.trunks=n}}).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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.interval,{id:e.resourceId})}),n=null;if(g.queueCampaign&&(n=_.find(g.interval,{id:Number(g.queueCampaign.IntervalId)})),n&&!_.some(t,["id",n.id])){var a=_.find(g.interval,{id:n.id});a.canSelect=!1,t.push(a)}g.interval=t})}else{var n=[],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,n.push(g.interval[i]));g.interval=n}}).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,t,n,i,s,o,r){var c=this;function m(){return l(function(n,t){return l(function(t,n){return d.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],o.hasRole("admin")?e:c.section?c.section.autoAssociation?e:l(function(t,n){return d.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),l(function(t,n){return d.voiceQueue.getAgents({id:c.queueCampaign.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return t.penalty=e.UserVoiceQueue?"penalty "+e.UserVoiceQueue.penalty:"",t.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=o.getCurrentUser(),c.queueCampaign=t,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(n,t){d.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceWith(c.selectedItems,c.startingSelectedItems,function(e,t){return e.id===t.id&&e.penalty===t.penalty});return(n=e,l(function(e,t){_.isEmpty(n)?e():d.voiceQueue.removeAgents({id:c.queueCampaign.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return r=t,l(function(e,t){if(_.isEmpty(r))e();else{for(var n=[],a=_.groupBy(r,"penalty"),i=0;i<Object.keys(a).length;i++){var s=Object.keys(a)[i],o=_.filter(r,["penalty",s]);n.push(d.voiceQueue.addAgents({id:c.queueCampaign.id,ids:_.map(o,"id"),penalty:_.trim(s,"penalty "),realtime:c.realtime||!1}).$promise)}l.all(n).then(function(){e()}).catch(function(e){t(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 n},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,items:[],selectedItems:[],showSelectAndDeselectAll:!i,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"penalty",labelAll:s.instant("MOTIONDIALER.ALL_AGENTS"),labelSelected:s.instant("MOTIONDIALER.SELECTED_AGENTS"),transferCallback:function(e,t){t?e.forEach(function(e){e.penalty=void 0}):e.forEach(function(e){e.penalty="penalty "+c.penalty});var n=_.xorWith(c.startingSelectedItems,c.selectedItems,function(e,t){return e.id===t.id&&e.penalty===t.penalty});c.pendingChanges=!_.isEmpty(n)}}}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,t,n,o,r,l){var d=this;function c(){return a(function(n,t){return a(function(t,n){return s.cmList.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return d.items=e.rows?e.rows:[],r.hasRole("admin")?e:d.section?d.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:d.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return d.allowedItems=_.map(t,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 t=_.find(d.allowedItems,{id:e.id});"admin"===d.currentUser.role?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s[d.apiRoute][d.getApi]({id:d.queueCampaign.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];d.selectedItems=_.map(t,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"),n()}).catch(function(e){t(e)})})}d.currentUser=r.getCurrentUser(),d.queueCampaign=t,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={readOnly:!d.crudPermissions.canEdit,allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!1,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:n.instant("MOTIONDIALER.ALL_LISTS"),labelSelected:n.instant("MOTIONDIALER.SELECTED_LISTS"),transferCallback:function(e,t){var n=_.xorBy(d.startingSelectedItems,d.selectedItems,"id");d.pendingChanges=!_.isEmpty(n)}},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(n,t){s.userProfileSection.get({userProfileId:d.currentUser.userProfileId,name:"Lists"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(d.selectedItems,d.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s[d.apiRoute][d.removeApi]({id:d.queueCampaign.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s[d.apiRoute][d.addApi]({id:d.queueCampaign.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},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(t,n,a,e,i,s,o){var r=this;function l(e){t.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!":""}),n.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 t=0;t<e.data.errors.length;t+=1)a.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.queueCampaign={},c.queueCampaignHopperBlacks={count:0,rows:[]},c.selectedQueueCampaignHopperBlacks=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,ContactId,phone",sort:"-id",limit:10,page:1},c.init=function(e,t){c.queueCampaign=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.queueCampaign.id,c.query.VoiceQueueId=c.queueCampaign.id,c.getQueueCampaignHopperBlacks()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the hopperBlack?").htmlContent("<b>"+(e.name||"hopperBlack")+"</b> will be deleted.").ariaLabel("delete hopperBlack").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getQueueCampaignHopperBlacks=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.voiceQueue.getHopperBlacks(c.query,p).$promise},c.createOrEditQueueCampaignHopperBlack=function(e,t){s.show({controller:"CreateOrEditHopperBlackDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hopperBlacks/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:c.queueCampaign,hopperBlack:t,hopperBlacks:c.queueCampaignHopperBlacks.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedQueueCampaignHopperBlacks=function(){var e=angular.copy(c.selectedQueueCampaignHopperBlacks);return c.selectedQueueCampaignHopperBlacks=[],e},c.deleteQueueCampaignHopperBlack=g,c.deleteSelectedQueueCampaignHopperBlacks=function(e){var t=s.confirm().title("Are you sure want to delete the selected hopperBlacks?").htmlContent("<b>"+c.selectedQueueCampaignHopperBlacks.length+" selected</b> will be deleted.").ariaLabel("delete hopperBlacks").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedQueueCampaignHopperBlacks.forEach(function(e){g(e)}),c.selectedQueueCampaignHopperBlacks=[]})};var m=!0,u=1;function p(e){c.queueCampaignHopperBlacks=e||{count:0,rows:[]}}function g(e){l.hopperBlack.delete({id:e.id}).$promise.then(function(){_.remove(c.queueCampaignHopperBlacks.rows,{id:e.id}),c.queueCampaignHopperBlacks.count-=1,c.queueCampaignHopperBlacks.rows.length||c.getQueueCampaignHopperBlacks(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceQueue"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getQueueCampaignHopperBlacks())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("QueueCampaignHopperBlacksController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.contacts={},c.queueCampaign={},c.queueCampaignHopperFinals={count:0,rows:[]},c.selectedQueueCampaignHopperFinals=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,uniqueid,ContactId,calleridnum,calleridname,statedesc,countcongestionretry,countbusyretry,countnoanswerretry,countglobal,scheduledat,starttime,responsetime,endtime,disposition,ListId,UserId,VoiceQueueId,CampaignId,recallme,deleted,campaign",sort:"-id",limit:10,page:1},c.init=function(e,t){c.queueCampaign=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.queueCampaign.id,c.query.VoiceQueueId=c.queueCampaign.id,c.getQueueCampaignHopperFinals()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the hopperFinal?").htmlContent("<b>"+(e.name||"hopperFinal")+"</b> will be deleted.").ariaLabel("delete hopperFinal").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getQueueCampaignHopperFinals=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.voiceQueue.getHopperFinals(c.query,p).$promise},c.createOrEditQueueCampaignHopperFinal=function(e,t){s.show({controller:"CreateOrEditHopperFinalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hopperFinals/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:c.queueCampaign,hopperFinal:t,hopperFinals:c.queueCampaignHopperFinals.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedQueueCampaignHopperFinals=function(){var e=angular.copy(c.selectedQueueCampaignHopperFinals);return c.selectedQueueCampaignHopperFinals=[],e},c.deleteQueueCampaignHopperFinal=g,c.deleteSelectedQueueCampaignHopperFinals=function(e){var t=s.confirm().title("Are you sure want to delete the selected hopperFinals?").htmlContent("<b>"+c.selectedQueueCampaignHopperFinals.length+" selected</b> will be deleted.").ariaLabel("delete hopperFinals").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedQueueCampaignHopperFinals.forEach(function(e){g(e)}),c.selectedQueueCampaignHopperFinals=[]})},c.moveQueueCampaignHopperFinal=v,c.moveContactsQueueCampaignHopperFinal=function(e){l.cmHopperFinal.moveContactsQueueCampaignHopperFinal({id:c.query.id,state:e}).$promise.then(function(e){_.isNil(e)&&_.isNil(e[0])?r.info({title:"Restored Contacts",msg:"0"}):r.info({title:"Restored Contacts",msg:JSON.stringify(e[0].affectedRows)})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},c.countContactsQueueCampaignHopperFinal=function(e){l.cmHopperFinal.countContactsQueueCampaignHopperFinal({id:e}).$promise.then(function(e){_.merge(c.contacts,e[0])}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},c.moveConfirm=function(e,t){var n=s.confirm().title("Are you sure want to restore the contact?").htmlContent("<b>Contact</b> will be restored.").ariaLabel("Restore Contact").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){v(e)},function(){console.log("CANCEL")})},c.moveSelectedQueueCampaignHopperFinals=function(e){var t=s.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");s.show(t).then(function(){c.selectedQueueCampaignHopperFinals.forEach(function(e){v(e)}),c.selectedQueueCampaignHopperFinals=[]})};var m=!0,u=1;function p(e){c.queueCampaignHopperFinals=e||{count:0,rows:[]}}function g(e){l.hopperFinal.delete({id:e.id}).$promise.then(function(){_.remove(c.queueCampaignHopperFinals.rows,{id:e.id}),c.queueCampaignHopperFinals.count-=1,c.queueCampaignHopperFinals.rows.length||c.getQueueCampaignHopperFinals(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceQueue"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.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){l.cmHopperFinal.checkContactHopper(a).$promise.then(function(e){r.info({title:"The contact is in the hopper",msg:"Contact ID "+e.ContactId})}).catch(function(e){var t,n;"Not Found"===e.data?l.cmHopper.save((t=a,n={},n.phone=t.calleridnum,n.scheduledat=moment().format("YYYY-MM-DD HH:mm:ss"),n.countbusyretry=0,n.countcongestionretry=0,n.countnoanswerretry=0,n.countglobal=0,n.ContactId=t.ContactId,n.ListId=t.ListId,n.UserId=t.deleted?null:t.UserId,n.VoiceQueueId=t.VoiceQueueId,n.CampaignId=t.CampaignId,n.priority=t.recallme?3:2,n.recallme=!!t.recallme,n)).$promise.then(function(e){var t,n;r.info({title:"Restored Contact",msg:"Contact ID "+e.ContactId}),e.ContactId&&l.cmHopperHistory.save(((n={}).calleridnum=(t=a).calleridnum,n.calleridname=t.calleridname,n.scheduledat=moment().format("YYYY-MM-DD HH:mm:ss"),n.countbusyretry=t.countbusyretry,n.countcongestionretry=t.countcongestionretry,n.countnoanswerretry=t.countnoanswerretry,n.countglobal=t.countglobal,n.ContactId=t.ContactId,n.ListId=t.ListId,n.UserId=d.getCurrentUser().id,n.VoiceQueueId=t.VoiceQueueId,n.CampaignId=t.CampaignId,n.editedat=moment().format("YYYY-MM-DD HH:mm:ss"),n.edited=!0,n.state=25,n.statedesc="Restored",n.campaign=t.campaign,n.campaigntype=t.VoiceQueueId?"queue":"ivr",n))}).catch(function(e){_.isNil(e.data)||"Validation error"!==e.data.message?r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()}):r.info({title:"The contact is in the hopper",msg:"Contact ID "+a.ContactId})}):r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getQueueCampaignHopperFinals())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("QueueCampaignHopperFinalsController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.queueCampaign={},c.queueCampaignHopperHistories={count:0,rows:[]},c.selectedQueueCampaignHopperHistories=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,uniqueid,ContactId,calleridnum,calleridname,statedesc,scheduledat,starttime,responsetime,endtime",sort:"-id",limit:10,page:1},c.init=function(e,t){c.queueCampaign=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.queueCampaign.id,c.query.VoiceQueueId=c.queueCampaign.id,c.getQueueCampaignHopperHistories()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the hopperHistory?").htmlContent("<b>"+(e.name||"hopperHistory")+"</b> will be deleted.").ariaLabel("delete hopperHistory").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getQueueCampaignHopperHistories=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.voiceQueue.getHopperHistories(c.query,p).$promise},c.createOrEditQueueCampaignHopperHistory=function(e,t){s.show({controller:"CreateOrEditHopperHistoryDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hopperHistories/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:c.queueCampaign,hopperHistory:t,hopperHistories:c.queueCampaignHopperHistories.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedQueueCampaignHopperHistories=function(){var e=angular.copy(c.selectedQueueCampaignHopperHistories);return c.selectedQueueCampaignHopperHistories=[],e},c.deleteQueueCampaignHopperHistory=g,c.deleteSelectedQueueCampaignHopperHistories=function(e){var t=s.confirm().title("Are you sure want to delete the selected hopperHistories?").htmlContent("<b>"+c.selectedQueueCampaignHopperHistories.length+" selected</b> will be deleted.").ariaLabel("delete hopperHistories").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedQueueCampaignHopperHistories.forEach(function(e){g(e)}),c.selectedQueueCampaignHopperHistories=[]})};var m=!0,u=1;function p(e){c.queueCampaignHopperHistories=e||{count:0,rows:[]}}function g(e){l.hopperHistory.delete({id:e.id}).$promise.then(function(){_.remove(c.queueCampaignHopperHistories.rows,{id:e.id}),c.queueCampaignHopperHistories.count-=1,c.queueCampaignHopperHistories.rows.length||c.getQueueCampaignHopperHistories(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceQueue"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getQueueCampaignHopperHistories())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("QueueCampaignHopperHistoriesController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.queueCampaign={},c.queueCampaignHoppers={count:0,rows:[]},c.selectedQueueCampaignHoppers=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,ContactId,phone,countcongestionretry,countbusyretry,countnoanswerretry,scheduledat,priority,recallme,UserId",sort:"-updatedAt",limit:10,page:1},c.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"),"")}),c.init=function(e,t){c.queueCampaign=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.queueCampaign.id,c.query.VoiceQueueId=c.queueCampaign.id,c.getQueueCampaignHoppers()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the hopper?").htmlContent("<b>"+(e.name||"hopper")+"</b> will be deleted.").ariaLabel("delete hopper").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getQueueCampaignHoppers=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.voiceQueue.getHoppers(c.query,p).$promise},c.createOrEditQueueCampaignHopper=function(e,t){s.show({controller:"CreateOrEditHopperVoiceQueueIdDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hoppers/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:c.queueCampaign,hopper:t,hoppers:c.queueCampaignHoppers.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedQueueCampaignHoppers=function(){var e=angular.copy(c.selectedQueueCampaignHoppers);return c.selectedQueueCampaignHoppers=[],e},c.deleteQueueCampaignHopper=g,c.deleteSelectedQueueCampaignHoppers=function(e){var t=s.confirm().title("Are you sure want to delete the selected hoppers?").htmlContent("<b>"+c.selectedQueueCampaignHoppers.length+" selected</b> will be deleted.").ariaLabel("delete hoppers").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedQueueCampaignHoppers.forEach(function(e){g(e)}),c.selectedQueueCampaignHoppers=[]})},d.hasRole("admin")?l.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){c.agents=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){c.agents=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(c.agents,{id:e.resourceId})}),n=null;if(c.queueCampaign&&(n=_.find(c.agents,{id:Number(c.queueCampaign.UserId)})),n&&!_.some(t,["id",n.id])){var a=_.find(c.agents,{id:n.id});a.canSelect=!1,t.push(a)}c.agents=t})}else{var n=[],a=null;c.queueCampaign&&(a=_.find(c.agents,{id:Number(c.queueCampaign.UserId)}));for(var i=0;i<c.agents.length;i++)a&&c.agents[i].id===a.id&&(c.agents[i].canSelect=!1,n.push(c.agents[i]));c.agents=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})});var m=!0,u=1;function p(e){c.queueCampaignHoppers=e||{count:0,rows:[]}}function g(e){l.cmHopper.delete({id:e.id}).$promise.then(function(){_.remove(c.queueCampaignHoppers.rows,{id:e.id}),c.queueCampaignHoppers.count-=1,c.queueCampaignHoppers.rows.length||c.getQueueCampaignHoppers(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceQueue"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getQueueCampaignHoppers())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("QueueCampaignHoppersController",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(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),t.params.id&&(g.hopper.VoiceQueueId=t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 n,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){n=_.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:n,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 t=_.find(g.hoppers,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The hopper will be deleted.").ariaLabel("Delete Hopper").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.agents,{id:e.resourceId})}),n=null;if(g.hopper&&(n=_.find(g.agents,{id:Number(g.hopper.UserId)})),n&&!_.some(t,["id",n.id])){var a=_.find(g.agents,{id:n.id});a.canSelect=!1,t.push(a)}g.agents=t})}else{var n=[],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,n.push(g.agents[i]));g.agents=n}}).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(n,a){var i=this;i.queueCampaign={},i.init=function(t){i.queueCampaign=t,n.cmHopper.get({limit:0,VoiceQueueId:t.id}).$promise.then(function(e){return i.total=e.count||0,n.cmHopper.get({limit:0,VoiceQueueId:t.id,active:!1,countbusyretry:0,countcongestionretry:0,countnoanswerretry:0}).$promise}).then(function(e){return i.fresh=e.count||0,n.cmHopperFinal.get({limit:0,VoiceQueueId:t.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,t,n,o,r,l){var d=this;function c(){return a(function(n,t){return a(function(t,n){return s.cmList.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return d.items=e.rows?e.rows:[],r.hasRole("admin")?e:d.section?d.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:d.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return d.allowedItems=_.map(t,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 t=_.find(d.allowedItems,{id:e.id});"admin"===d.currentUser.role?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s[d.apiRoute][d.getApi]({id:d.queueCampaign.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];d.selectedItems=_.map(t,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"),n()}).catch(function(e){t(e)})})}d.currentUser=r.getCurrentUser(),d.queueCampaign=t,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={readOnly:!d.crudPermissions.canEdit,allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!1,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:n.instant("MOTIONDIALER.ALL_LISTS"),labelSelected:n.instant("MOTIONDIALER.SELECTED_LISTS"),transferCallback:function(e,t){var n=_.xorBy(d.startingSelectedItems,d.selectedItems,"id");d.pendingChanges=!_.isEmpty(n)}},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(n,t){s.userProfileSection.get({userProfileId:d.currentUser.userProfileId,name:"Lists"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(d.selectedItems,d.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s[d.apiRoute][d.removeApi]({id:d.queueCampaign.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s[d.apiRoute][d.addApi]({id:d.queueCampaign.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},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,t,a,i,s,n,o,r){var l=this;function d(){t.hide()}function c(e,t){var n=t.id;o.enqueue(function(){return i.voiceQueue.removeLists({id:e,ids:n}).$promise.then(function(){return i.voiceQueue.addLists({id:e,ids:n,dialCheckDuplicateType:"never"}).$promise}).then(function(){a.success({title:"Reset Succesfull",msg:"List "+t.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=n||[],l.loading=!1,l.closeDialog=d,l.exists=function(e,t){return-1<t.indexOf(e)},l.toggle=function(e,t){var n=t.indexOf(e);-1<n?t.splice(n,1):t.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,t){for(var n=0;n<l.selected.length;n+=1)c(s.id,l.selected[n]);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,l,a,d,t,n,i,s){var c=this;function o(){return l(function(n,t){return l(function(t,n){return d.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],i.hasRole("admin")?e:c.section?c.section.autoAssociation?e:l(function(t,n){return d.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,function(e){return _.find(c.items,{id:i.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.items.forEach(function(e){var t=_.find(c.allowedItems,{id:e.id});i.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),l(function(t,n){return d.voiceQueue.getTeams({id:c.queueCampaign.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){return _.find(c.items,{id:e.id})}),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=i.getCurrentUser(),c.queueCampaign=t,c.crudPermissions=s,c.penalty=0,c.items=[],c.allowedItems=[],c.selectedItems=[],c.addedItems=[],c.removedItems=[],c.pendingChanges=!1,c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!0,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:n.instant("MOTIONDIALER.ALL_TEAMS"),labelSelected:n.instant("MOTIONDIALER.SELECTED_TEAMS"),transferCallback:function(e,t){t?c.removedItems=_.unionBy(e,c.removedItems,"id"):(e.forEach(function(e){e.penalty="penalty "+c.penalty}),c.addedItems=_.unionBy(e,c.addedItems,"id")),c.pendingChanges=!0}},c.onInit=function(){return i.hasRole("admin")?o().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(function(n,t){d.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(e)})}).then(function(e){return c.section=e,o()}).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()})})},c.saveTeams=function(){var e=c.removedItems,t=c.addedItems;return(n=e,l(function(e,t){_.isEmpty(n)?e():d.voiceQueue.removeTeams({id:c.queueCampaign.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return r=t,l(function(e,t){if(_.isEmpty(r))e();else{for(var n=[],a=_.groupBy(r,"penalty"),i=0;i<Object.keys(a).length;i++){var s=Object.keys(a)[i],o=_.filter(r,["penalty",s]);n.push(d.voiceQueue.addTeams({id:c.queueCampaign.id,ids:_.map(o,"id"),penalty:_.trim(s,"penalty ")}).$promise)}l.all(n).then(function(){e()}).catch(function(e){t(e)})}});var r}).then(function(){c.pendingChanges=!1,c.addedItems=[],c.removedItems=[],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 n},c.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(n,e,i,s,a,t,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=t,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.queueCampaign=c||n.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=n.params.tab||0,u.clonedialog=function(e,t){i.show({controller:"QueueCampaigncloneController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:u.queueCampaigns?u.queueCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.listadddialog=function(e,t){i.show({controller:"QueueCampaignlistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/listadd/listadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:u.queueCampaigns?u.queueCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.blacklistadddialog=function(e,t){i.show({controller:"QueueCampaignblacklistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/blacklistadd/blacklistadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:u.queueCampaigns?u.queueCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.teamadddialog=function(e,t){i.show({controller:"QueueCampaignteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:u.queueCampaigns?u.queueCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,t){i.show({controller:"QueueCampaignagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:u.queueCampaigns?u.queueCampaigns.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.resetlistdialog=function(t,n){r.voiceQueue.getLists({id:t.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(n).ok("OK").cancel("CANCEL");i.show(e).then(function(){var e,t,n;e=u.queueCampaign.id,t=a.rows[0],n=t.id,r.voiceQueue.removeLists({id:e,ids:n}).$promise.then(function(){return r.voiceQueue.addLists({id:e,ids:n,dialCheckDuplicateType:"never"}).$promise}).then(function(){l.success({title:"Reset Succesfull",msg:"List "+t.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:n,clickOutsideToClose:!1,locals:{queueCampaign:t,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,t){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:1510}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.motiondialer.realtime.queues",{})}},u.alert=l.info,u.gotoQueueCampaigns=function(){n.go("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 t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.musiconholds,{id:e.resourceId})}),n=null;if(u.queueCampaign&&(n=_.find(u.musiconholds,{name:u.queueCampaign.musiconhold})),n&&!_.some(t,["id",n.id])){var a=_.find(u.musiconholds,{id:n.id});a.canSelect=!1,t.push(a)}u.musiconholds=t}):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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.trunks,{id:e.resourceId})}),n=null;if(u.queueCampaign&&(n=_.find(u.trunks,{id:Number(u.queueCampaign.TrunkId)})),n&&!_.some(t,["id",n.id])){var a=_.find(u.trunks,{id:n.id});a.canSelect=!1,t.push(a)}u.trunks=t})}else{var n=[],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,n.push(u.trunks[i]));u.trunks=n}}).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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.projects,{id:e.resourceId})}),n=null;if(u.queueCampaign&&(n=_.find(u.projects,{name:u.queueCampaign.dialQueueProject})),n&&!_.some(t,["id",n.id])){var a=_.find(u.projects,{id:n.id});a.canSelect=!1,t.push(a)}u.projects=t})}else{var n=[],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,n.push(u.projects[i]));u.projects=n}}).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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.interval,{id:e.resourceId})}),n=null;if(u.queueCampaign&&(n=_.find(u.interval,{id:Number(u.queueCampaign.IntervalId)})),n&&!_.some(t,["id",n.id])){var a=_.find(u.interval,{id:n.id});a.canSelect=!1,t.push(a)}u.interval=t})}else{var n=[],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,n.push(u.interval[i]));u.interval=n}}).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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.pauses,{id:e.resourceId})});u.pauses.forEach(function(e){_.some(t,["id",e.id])||(e.canSelect=!1),t.push(e)}),u.pauses=t})}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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.queueCampaigns=l||{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="queueCampaigns",b.listOrder="",b.listOrderAsc=null,b.selectedQueueCampaigns=[],b.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,description,mandatoryDisposition,mandatoryDispositionPauseId",type:"outbound",sort:"-updatedAt",channel:"voice",limit:10,page:1},b.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"),"")}),b.arrayautopause=_.keyBy([{option:"Yes",value:"'all'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arrayringinuse=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arraytimeoutrestart=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.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"),"")}),b.arraysetinterfacevar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arraysetqueuevar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arraysetqueueentryvar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arraydialOrderByScheduledAt=_.keyBy([{option:"DESC",value:"'DESC'"},{option:"ASC",value:"'ASC'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.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"),"")}),b.arraydialPredictiveOptimization=_.keyBy([{option:"AgentBusyFactor",value:"'agentBusyFactor'"},{option:"DropRate",value:"'dropRate'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.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"),"")}),b.editstate=function(e,t){n.go("app.motiondialer.queueCampaigns.edit",{id:e.id,queueCampaign:e,crudPermissions:b.crudPermissions})},b.clonedialog=function(e,t){i.show({controller:"QueueCampaigncloneController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:b.queueCampaigns?b.queueCampaigns.rows:[],crudPermissions:b.crudPermissions}})},b.listadddialog=function(e,t){i.show({controller:"QueueCampaignlistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/listadd/listadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:b.queueCampaigns?b.queueCampaigns.rows:[],crudPermissions:b.crudPermissions}})},b.blacklistadddialog=function(e,t){i.show({controller:"QueueCampaignblacklistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/blacklistadd/blacklistadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:b.queueCampaigns?b.queueCampaigns.rows:[],crudPermissions:b.crudPermissions}})},b.teamadddialog=function(e,t){i.show({controller:"QueueCampaignteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:b.queueCampaigns?b.queueCampaigns.rows:[],crudPermissions:b.crudPermissions}})},b.agentadddialog=function(e,t){i.show({controller:"QueueCampaignagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:b.queueCampaigns?b.queueCampaigns.rows:[],crudPermissions:b.crudPermissions,realtime:!1}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.gotorealtimegoto=function(e,t){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:1510}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.motiondialer.realtime.queues",{})}},b.success=y,b.getQueueCampaigns=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.voiceQueue.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="QueueCampaigns",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditQueueCampaign=function(e,t){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:t,queueCampaigns:b.queueCampaigns.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteQueueCampaign=S,b.exportSelectedQueueCampaigns=function(){var e=angular.copy(b.selectedQueueCampaigns);return b.selectedQueueCampaigns=[],e},b.deleteSelectedQueueCampaigns=function(e){var t=i.confirm().title("Are you sure want to delete the selected queueCampaigns?").htmlContent("<b>"+b.selectedQueueCampaigns.length+" selected</b> will be deleted.").ariaLabel("delete QueueCampaigns").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedQueueCampaigns.forEach(function(e){S(e)}),b.selectedQueueCampaigns=[]})},b.deselectQueueCampaigns=function(){b.selectedQueueCampaigns=[]},b.selectAllQueueCampaigns=function(){b.selectedQueueCampaigns=b.queueCampaigns.rows},g.hasRole("admin")?m.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){b.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){b.trunks=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(b.trunks,{id:e.resourceId})}),a=null;a=[],b.queueCampaigns.rows.forEach(function(e){var t=_.find(b.trunks,{id:Number(e.TrunkId)});a.push(t)}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(b.trunks,{id:e.id});t.canSelect=!1,n.push(t)}}),b.trunks=n})}else{var n=[],a=[];b.queueCampaigns.rows.forEach(function(e){var t=_.find(b.trunks,{id:Number(e.TrunkId)});a.push(t)});for(var i=0;i<b.trunks.length;i++){_.some(a,{id:b.trunks[i].id})&&(b.trunks[i].canSelect=!1,n.push(b.trunks[i]))}b.trunks=n}}).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){b.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){b.interval=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(b.interval,{id:e.resourceId})}),n=null;if(b.queueCampaign&&(n=_.find(b.interval,{id:Number(b.queueCampaign.IntervalId)})),n&&!_.some(t,["id",n.id])){var a=_.find(b.interval,{id:n.id});a.canSelect=!1,t.push(a)}b.interval=t})}else{var n=[],a=null;b.queueCampaign&&(a=_.find(b.interval,{id:Number(b.queueCampaign.IntervalId)}));for(var i=0;i<b.interval.length;i++)a&&b.interval[i].id===a.id&&(b.interval[i].canSelect=!1,n.push(b.interval[i]));b.interval=n}}).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 E=!0,A=1;function y(e){b.queueCampaigns=e||{count:0,rows:[]}}function S(e){m.voiceQueue.delete({id:e.id}).$promise.then(function(){_.remove(b.queueCampaigns.rows,{id:e.id}),b.queueCampaigns.count-=1,b.queueCampaigns.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceQueue"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getQueueCampaigns())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","queueCampaigns","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.motiondialer").controller("QueueCampaignsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g){var v=this,h=!0;function f(){var e=i.localStorage.getItem("motion2.realtime.abandoned.bull.contacts:"+v.currentUser.id);e&&(e=JSON.parse(e))&&e.query&&(v.query=_.merge(e.query,_.omit(v.query,["sort","limit","page"])),v.query=_.omit(v.query,"filter")),d.hasRole("admin")?o.user.getQueues({id:d.getCurrentUser().id,fields:"id,name",channel:"voice",type:"outbound",nolimit:!0}).$promise.then(function(e){v.queues=e||{count:0,rows:[]},v.queuesMap=_.mapValues(_.keyBy(v.queues.rows,"name"),"name")}).catch(function(e){console.error(e)}).finally(function(){v.getContacts()}):o.userProfile.getResources({id:v.currentUser.userProfileId,section:"QueueCampaigns",channel:"voice",type:"outbound",sort:"-updatedAt",nolimit:!0}).$promise.then(function(e){v.queues=e||{count:0,rows:[]},v.queuesMap=_.mapValues(_.keyBy(v.queues.rows,"name"),"name")}).catch(function(e){console.error(e)}).finally(function(){v.getContacts()})}function b(e){v.contacts=e||{count:0,rows:[]},h=!1,v.refresh=!0}v.showTooltip=!1,v.refresh=!0,v.disable=[],v.agents=p||[],v.currentUser=d.getCurrentUser(),v.localizationMap=u,v.pickerModel={dateStart:null,dateEnd:null},v.queues={},v.contacts={count:0,rows:[]},v.dispositions=g,v.userProfile=r,v.userProfileSection=l&&1==l.count?l.rows[0]:null,v.crudPermissions=d.parseCrudPermissions(v.userProfileSection?v.userProfileSection.crudPermissions:null),v.query={fields:"id,type,calleridnum,calleridname,queue,queuecallerabandonAt,queuecallerexitAt,queuecallerexitreason,assigned,lastAssignedTo,updatedAt,disposition",type:"outbound",queuecallerexitreason:"TIMEOUT,ABANDONED",sort:"-updatedAt",limit:10,page:1},v.clearAll=function(){v.query.createdAt=void 0,v.pickerModel={dateStart:null,dateEnd:null},v.getContacts()},v.getContacts=function(){if(v.refresh=!1,v.pickerModel.dateStart&&!h){var e=moment(v.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format();v.query.createdAt={$gte:v.pickerModel.dateStart,$lte:e}}else v.query.createdAt=void 0;v.query.queue=v.query.queue,v.query.offset=(v.query.page-1)*v.query.limit,i.localStorage.setItem("motion2.realtime.abandoned.bull.contacts:"+v.currentUser.id,JSON.stringify({query:_.omit(v.query,"queue")})),v.promise=o.voiceQueueReport.getVoiceQueuesReport(v.query,b).$promise},v.refreshContacts=function(){v.showTooltip=!1,v.getContacts()},v.onInit=f,v.assignedA=function(e,t){e&&(v.disable[e.id]=!0,o.voiceQueueReport.update({id:e.id,lastAssignedTo:t?t.name:null,assigned:!!t}).$promise.catch(function(e){console.log(e)}).finally(function(){v.disable[e.id]=!1}))},v.disposed=function(e,t){e&&o.voiceQueueReport.update({id:e.id,disposition:t||null}).$promise.catch(function(e){console.log(e)})},v.onSavevoiceQueueReport=function(e){e&&v.queuesMap&&"outbound"===e.type&&v.queuesMap[e.queue]&&(v.showTooltip=!0)},v.onUpdatevoiceQueueReport=function(e){if(e){var t=_.findIndex(v.contacts.rows,["id",e.id]);0<=t&&_.merge(v.contacts.rows[t],e)}},c.onWithoutApply("voiceQueueReport:save",v.onSavevoiceQueueReport),c.on("voiceQueueReport:update",v.onUpdatevoiceQueueReport),f();var E=!0,A=1;e.$watch("vm.query.filter",function(e,t){E?n(function(){E=!1}):(t||(A=v.query.page),e!==t&&(v.query.page=1),e||(v.query.page=A),v.getContacts())}),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","dateFilterLocalizationFactory","agents","dispositions"],angular.module("app.motiondialer").controller("AbandonedCallsMotionDialerRealtimeController",e)}(),function(){"use strict";function e(e,o,t,n,a,i,s,r,l,d,c,m,u,p,g,v,h,f){var b=this,E=["userpic","online","lastLoginAt","lastPauseAt","pauseType","lastPauseAt","internal","address","chatPause","openchannelPause","mailPause","smsPause","faxPause","voicePause","chatCapacity","openchannelCapacity","mailCapacity","smsCapacity","faxCapacity","chatCurrentCapacity","openchannelCurrentCapacity","mailCurrentCapacity","smsCurrentCapacity","faxCurrentCapacity","chatStatus","openchannelStatus","mailStatus","smsStatus","faxStatus","voiceStatus","chatStatusTime","openchannelStatusTime","mailStatusTime","smsStatusTime","faxStatusTime","voiceStatusTime","queue","destconnectedlinenum","onhold"],A=["chatPause","openchannelPause","mailPause","smsPause","faxPause","voicePause","online"];for(var y in b.currentUser=v.getCurrentUser(),b.availableStates=["ringing","inuse","busy","onhold","not_inuse"],b.pauses=s||{count:0,rows:[]},b.license=h,b.userProfile=p,b.userProfileSection=g&&1==g.count?g.rows[0]:null,b.crudPermissions=v.parseCrudPermissions(b.userProfileSection?b.userProfileSection.crudPermissions:null),b.agents=r?_.keyBy(r.rows?r.rows:[],"id"):{},b.rpcAgents=l?_.keyBy(l.rows?l.rows:[],"id"):{},b.paginatedAgents={},b.load=!1,b.order=[],b.agentInternal={},b.agents)b.agents.hasOwnProperty(y)&&(b.agents[y].init=!0);b.query={limit:10,page:1,order:"fullname",globalStatusFilter:"",pauseTypeFilter:""},b.logout=function(e,t){return d.user.logout({id:e.id,device:"realtime",agent_id:e.id,agent_name:e.name}).$promise.then(function(){m.success({title:"Agent logout",msg:e.fullname+"  properly logout"}),b.agents[e.id]&&(b.agents[e.id].online=!1),b.rpcAgents[e.id]&&(b.rpcAgents[e.id].online=!1),T()}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.queueAdd=function(e,t){n.show({controller:"AgentqueueaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/queueadd/queueadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{agent:e,agents:[],channel:"voice",direction:"outbound",crudPermissions:b.crudPermissions}})},b.pause=function(t,e){return d.user.pause({id:t.id,type:e}).$promise.then(function(e){b.agents[t.id]&&_.merge(b.agents[t.id],_.pick(e,E)),b.rpcAgents[t.id]&&_.merge(b.rpcAgents[t.id],_.pick(e,E)),O(b.agents[t.id])}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.unPause=function(t){return d.user.unpause({id:t.id}).$promise.then(function(e){b.agents[t.id]&&_.merge(b.agents[t.id],_.pick(e,E)),b.rpcAgents[t.id]&&_.merge(b.rpcAgents[t.id],_.pick(e,E)),O(b.agents[t.id])}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.showInfo=function(e){n.show(n.alert().clickOutsideToClose(!0).title("Legend").htmlContent("<div>TODO legend status + state</div>").ok("Ok").targetEvent(e))},b.getAgentStatus=w,b.getAgentGlobalStatus=O,b.isPause=I,b.checkPause=function(e){return"pause"===e},b.isPartialPause=function(e){return"*pause"===e},b.onSave=function(e){b.agents[e.id]&&(_.merge(b.agents[e.id],_.pick(_.omit(e,A),E)),_.merge(b.rpcAgents[e.id],_.pick(_.omit(e,A),E)),O(b.agents[e.id]))},b.onUpdate=function(e){b.agents[e.id]&&(_.merge(b.agents[e.id],_.pick(e,E)),_.merge(b.rpcAgents[e.id],_.pick(e,E)),e.lastPauseAt&&(b.agents[e.id].globalStatusTime=e.lastPauseAt,b.rpcAgents[e.id].globalStatusTime=e.lastPauseAt),O(b.agents[e.id]))},b.onInit=T,b.onConnect=function(e){b.agents[b.agentInternal[e.destaccountcode]]&&(_.merge(b.agents[b.agentInternal[e.destaccountcode]],_.pick(e,["queue","destconnectedlinenum"])),_.merge(b.rpcAgents[b.agentInternal[e.destaccountcode]],_.pick(e,["queue","destconnectedlinenum"])))},b.onComplete=function(e){b.agents[b.agentInternal[e.destaccountcode]]&&(b.agents[b.agentInternal[e.destaccountcode]]=_.omit(b.agents[b.agentInternal[e.destaccountcode]],["queue","destconnectedlinenum"]),b.rpcAgents[b.agentInternal[e.destaccountcode]]=_.omit(b.rpcAgents[b.agentInternal[e.destaccountcode]],["queue","destconnectedlinenum"]))},c.on("user:save",b.onSave),c.on("user:update",b.onUpdate),c.on("user:agentconnect",b.onConnect),c.on("user:agentcomplete",b.onComplete),T();var S=f(function(){b.load&&(b.load=!1,T())},999);function T(e){b.load=!1;var t,n,a=o.defer();b.promise=a.promise,b.filteredAgents=[],b.order=[],_.forIn(b.agents,function(e,t){b.rpcAgents[t]&&_.merge(e,_.pick(_.omit(b.rpcAgents[t],A),E)),O(e),e.online?(b.filteredAgents.push(e),b.agentInternal[e.internal]=t):e.globalStatusTime=_.toNumber(moment().format("x"))}),b.query.globalStatusFilter&&_.remove(b.filteredAgents,function(e){return e.globalStatus!==b.query.globalStatusFilter}),b.query.pauseTypeFilter&&_.remove(b.filteredAgents,function(e){return e.pauseType!==b.query.pauseTypeFilter}),b.query.filter&&_.remove(b.filteredAgents,function(e){return e.fullname.toLowerCase().indexOf(b.query.filter.toLowerCase())<0}),b.filteredAgents=(t=b.filteredAgents,n=_.startsWith(b.query.order,"-")?"desc":"asc",_.orderBy(t,[b.query.order.replace("-","")],[n]));var i=(b.query.page-1)*b.query.limit;b.paginatedAgents=_.drop(b.filteredAgents,i).slice(0,b.query.limit);for(var s=0;s<b.paginatedAgents.length;s+=1)b.order.push(b.paginatedAgents[s].id);a.resolve(),b.load=!0}function I(e){return"pause"===e||"*pause"===e}function C(e){return"idle"===e||"unknown"===e||"unavailable"===e||"ringing"===e||_.isNil(e)}function w(e,t){return"voice"===t?"idle"!==e[t+"Status"]?e[t+"Status"]:e[t+"Pause"]?e[t+"Status"]="pause":"idle":e[t+"Pause"]?e[t+"Status"]="pause":e[t+"Status"]}function O(e){var t="unknown";t=_.every([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],I)?"pause":_.some([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],I)?"*pause":_.every([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],C)?"idle":"busy",e.globalStatus!==t&&(e.globalStatus=t,e.init?(e.init=!1,e.globalStatusTime=I(t)?_.toNumber(moment(e.lastPauseAt).format("x")):_.max([e.voiceStatusTime,e.chatStatusTime,e.mailStatusTime,e.smsStatusTime,e.openchannelStatusTime,e.faxStatusTime])):e.globalStatusTime=_.toNumber(moment().format("x")))}e.$on("$destroy",function(){c.removeAllListeners("user:save"),c.removeAllListeners("user:update"),c.removeAllListeners("user:agentconnect"),c.removeAllListeners("user:agentcomplete"),S&&(f.cancel(S),S=null)})}e.$inject=["$scope","$q","$timeout","$mdDialog","$document","$filter","pauses","agents","rpcAgents","api","socket","toasty","helperClasses","userProfile","userProfileSection","Auth","license","$interval"],angular.module("app.voice").controller("AgentsMotionDialerRealtimeController",e)}(),function(){"use strict";function e(e,n,a,i,t,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(){_.forIn(u.campaigns,function(e,t){u.rpcCampaigns[t]&&_.merge(e,_.pick(u.rpcCampaigns[t],p))})}u.currentUser=m.getCurrentUser(),u.count=o.count,u.campaigns=o?_.keyBy(o.rows?o.rows:[],"id"):{},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:"-updatedAt",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){u.campaigns[e.id]&&(_.merge(u.campaigns[e.id],_.pick(e,p)),_.merge(u.rpcCampaigns[e.id],_.pick(e,p)))},u.$onInit=g,u.createOrEditIvrCampaign=function(e,t){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:t,ivrCampaigns:_.values(u.campaigns),license:null,setting:null,crudPermissions:u.crudPermissions}})},l.onWithoutApply("campaign:save",u.onSave),u.interval=t(function(){},999);var v=!0,h=1;function f(e){u.count=e.count,u.campaigns=e?_.keyBy(e.rows?e.rows:[],"id"):{},g()}e.$watch("vm.query.filter",function(e,t){v?n(function(){v=!1}):(t||(h=u.query.page),e!==t&&(u.query.page=1),e||(u.query.page=h),u.getCampaigns())}),e.$on("$destroy",function(){l.removeAllListeners("campaign:save"),u.interval&&t.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,a,n,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=u.getCurrentUser(),p.agents=n||{count:0,rows:[]},p.queues=i?_.keyBy(i.rows?i.rows:[],"name"):{},p.rpcVoiceQueuesChannelsTmp=s?_.keyBy(s.rows?_.filter(s.rows,{type:"outbound"}):[],"uniqueid"):{},p.rpcVoiceQueuesChannels={},p.userProfile=c,p.userProfileSection=m&&1==m.count?m.rows[0]:null,p.crudPermissions=u.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.queryChannels={limit:10,page:1},p.getSize=function(e){return _.size(e)},p.$onInit=function(){_.forIn(p.rpcVoiceQueuesChannelsTmp,function(e,t){_.find(p.queues,{name:e.name})&&(p.rpcVoiceQueuesChannels[t]=e)})},p.onSave=function(e){"outbound"===e.type&&_.find(p.queues,{name:e.name})&&(p.rpcVoiceQueuesChannels[e.uniqueid]=e)},p.onRemove=function(e){p.rpcVoiceQueuesChannels[e.uniqueid]&&delete p.rpcVoiceQueuesChannels[e.uniqueid]},p.hangup=function(t){return o.rpc.getVoiceQueuesChannelHangup({uniqueid:t}).$promise.then(function(e){d.success({title:"Channel "+t+" properly hangup!",msg:e.message||""})}).catch(function(e){d.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},p.redirectToAgent=function(t,e,n){return o.rpc.getVoiceQueuesChannelRedirect({uniqueid:t,exten:e,context:n}).$promise.then(function(e){d.success({title:"Channel "+t+" properly redirect!",msg:e.message||""})}).catch(function(e){d.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},p.redirectToNumber=function(e,t){var n=a.prompt().title("Which number do you want transfer the call to?").placeholder("Number").targetEvent(e).ok("Ok").cancel("Cancel");return a.show(n).then(function(e){return o.rpc.getVoiceQueuesChannelRedirect({uniqueid:t,exten:e}).$promise}).then(function(e){d.success({title:"Channel "+t+" properly redirect!",msg:e.message||""})}).catch(function(e){d.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},r.on("voice_queue_channel:save",p.onSave),r.on("voice_queue_channel:remove",p.onRemove),e.$on("$destroy",function(){r.removeAllListeners("voice_queue_channel:save"),r.removeAllListeners("voice_queue_channel:remove")})}e.$inject=["$scope","$timeout","$mdDialog","agents","queues","rpcVoiceQueuesChannels","api","socket","helperClasses","toasty","userProfile","userProfileSection","Auth"],angular.module("app.motiondialer").controller("QueueCallsMotionDialerRealtimeController",e)}(),function(){"use strict";function e(e,n,t,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(){_.forIn(c.queues,function(e,t){c.rpcQueues[t]&&_.merge(e,_.pick(c.rpcQueues[t],m))})}c.count=a.count,c.queues=a?_.keyBy(a.rows?a.rows:[],"id"):{},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:"-updatedAt",limit:10,page:1}:c.query={id:d.getCurrentUser().id,channel:"voice",type:"outbound",fields:"id,name",sort:"-updatedAt",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){c.queues[e.id]&&_.merge(c.queues[e.id],_.pick(e,m))},c.$onInit=u,o.onWithoutApply("voice_queue:save",c.onSave),c.interval=t(function(){},999);var p=!0,g=1;function v(e){c.count=e.count,c.queues=e?_.keyBy(e.rows?e.rows:[],"id"):{},u()}e.$watch("vm.query.filter",function(e,t){p?n(function(){p=!1}):(t||(g=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=g),c.getQueues())}),e.$on("$destroy",function(){o.removeAllListeners("voice_queue:save"),c.interval&&t.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,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this,v=["loggedIn","available","waiting","talking","pTalking","originated","message","dialActive","dialMethod","Trunk","paused"];function h(){var n=[];return _.forIn(g.queues,function(e,t){e.paused=0,e.loggedInDb=0,g.queues[t].agents={},n.push(l.voiceQueue.getMembers({id:t}).$promise),g.rpcQueues[t]&&_.merge(e,_.pick(g.rpcQueues[t],v))}),t.all(n).then(function(e){for(var t=0;t<e.length;t+=1)for(var n=0;n<e[t].rows.length;n++)e[t].rows[n].paused&&g.queues[e[t].rows[n].VoiceQueueId].paused++,g.queues[e[t].rows[n].VoiceQueueId].loggedInDb++,g.queues[e[t].rows[n].VoiceQueueId].agents[e[t].rows[n].UserId]=e[t].rows[n].VoiceQueueId}).catch(function(e){console.error(e)})}g.currentUser=p.getCurrentUser(),g.count=o.count?o.count:0,g.queues=o?_.keyBy(o.rows?o.rows:[],"id"):{},g.rpcQueues=r?_.keyBy(r.rows?r.rows:[],"id"):{},g.userProfile=m,g.userProfileSection=u&&1==u.count?u.rows[0]:null,g.crudPermissions=p.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),p.hasRole("admin")?g.query={type:"outbound",sort:"-updatedAt",limit:10,page:1}:g.query={id:g.currentUser.id,channel:"voice",type:"outbound",sort:"-updatedAt",limit:10,page:1},g.success=E,g.getQueues=function(){g.query.offset=(g.query.page-1)*g.query.limit,p.hasRole("admin")?g.promise=l.voiceQueue.get(g.query,E).$promise:(g.query.id=g.userProfile.id,g.query.section="QueueCampaigns",g.promise=l.userProfile.getResources(g.query,E).$promise)},g.createOrEditMotionDialerQueue=function(e,t){a.show({controller:"CreateOrEditQueueCampaignDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:t,queueCampaigns:_.values(g.queues),license:null,setting:null,crudPermissions:g.crudPermissions}})},g.agentAdd=function(e,t){a.show({controller:"QueueCampaignagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:t,queueCampaigns:g.queues?g.queues.rows:[],realtime:!0,crudPermissions:g.crudPermissions}})},g.updateQueue=function(e){return l.voiceQueue.update(e).$promise.then(function(){c.success({title:"Queue properly updated!",msg:e.name?e.name+" has been updated!":""})}).catch(function(e){c.error({title:"Error creating queue!",msg:e.message})})},g.onSave=function(e){g.queues[e.id]&&_.merge(g.queues[e.id],_.pick(e,v))},g.onSaveMember=function(e){g.queues[e.MotionDialerQueueId]&&g.queues[e.MotionDialerQueueId].loggedInDb++},g.onPause=function(n){console.log("onPause",n),n.voicePause?_.forIn(g.queues,function(e,t){e.agents[n.id]&&(e.paused+=1,console.log("pause"))}):n.voicePause||_.forIn(g.queues,function(e,t){e.agents[n.id]&&0<e.paused&&(e.paused-=1,console.log("unpause"))})},g.onLogin=function(e){console.log("onLogged",e),g.queues[e.VoiceQueueId]&&(g.queues[e.VoiceQueueId].loggedInDb+=1,g.queues[e.VoiceQueueId].agents[e.UserId]=e.VoiceQueueId)},g.onLogout=function(e){console.log("onLogout",e),g.queues[e.VoiceQueueId]&&0<g.queues[e.VoiceQueueId].loggedInDb&&(g.queues[e.VoiceQueueId].loggedInDb-=1,delete g.queues[e.VoiceQueueId].agents[e.UserId])},g.$onInit=h,g.order=[],_.forIn(g.queues,function(e,t){g.order.push(e.id)}),d.onWithoutApply("voice_queue:save",g.onSave),g.interval=s(function(){},999),d.on("userVoiceQueueRt:save",g.onSaveMember),d.on("user:update",g.onPause),d.on("userVoiceQueue:remove",g.onLogout),d.on("userVoiceQueue:save",g.onLogin);var f=!0,b=1;function E(e){if(g.count=e.count,g.queues=e?_.keyBy(e.rows?e.rows:[],"id"):{},e.rows){g.order=[];for(var t=0;t<e.rows.length;t++)g.order.push(e.rows[t].id)}h()}e.$watch("vm.query.filter",function(e,t){f?n(function(){f=!1}):(t||(b=g.query.page),e!==t&&(g.query.page=1),e||(g.query.page=b),g.getQueues())}),e.$on("$destroy",function(){d.removeAllListeners("voice_queue:save"),g.interval&&s.cancel(g.interval),d.removeAllListeners("userVoiceQueueRt:save"),d.removeAllListeners("user:update"),d.removeAllListeners("userVoiceQueue:remove"),d.removeAllListeners("userVoiceQueue:save")})}e.$inject=["$scope","$timeout","$mdDialog","$q","$document","$interval","queues","rpcQueues","api","socket","toasty","userProfile","userProfileSection","Auth"],angular.module("app.motiondialer").controller("QueuesMotionDialerRealtimeController",e)}(),function(){"use strict";angular.module("app.auth").factory("helperClasses",function(){return{status:{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"},state:{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"},channelStatus:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},channelStatusOut:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"}}})}(),function(){"use strict";function e(e,n,t){switch(t.disconnect(),t.connect(),this.selectedTab=0,n.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,n.go("app.motiondialer.realtime.agents")}e.$watch("vm.selectedTab",function(e,t){if(e!==t)switch(e){case 0:n.go("app.motiondialer.realtime.agents");break;case 1:n.go("app.motiondialer.realtime.queues");break;case 2:n.go("app.motiondialer.realtime.queue_calls");break;case 3:n.go("app.motiondialer.realtime.abandonedcalls");break;case 4:n.go("app.motiondialer.realtime.queue_params");break;case 5:n.go("app.motiondialer.realtime.ivr_campaigns");break;default:n.go("app.motiondialer.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.motiondialer").controller("MotionDialerRealtimeController",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(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,notificationSound:!0,queueTransferTimeout:300,agentTransferTimeout:300},g.title="OPENCHANNEL.NEW_OPENCHANNELACCOUNT",g.newOpenchannelAccount=!0),t.params.id&&(g.openchannelAccount.OpenchannelAccountId=t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.openchannelAccounts,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The openchannelAccount will be deleted.").ariaLabel("Delete OpenchannelAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.lists,{id:e.resourceId})}),n=null;if(g.openchannelAccount&&(n=_.find(g.lists,{id:Number(g.openchannelAccount.ListId)})),n&&!_.some(t,["id",n.id])){var a=_.find(g.lists,{id:n.id});a.canSelect=!1,t.push(a)}g.lists=t})}else{var n=[],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,n.push(g.lists[i]));g.lists=n}}).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 t(e,t){if(r.openchannelAccountApps.rows.length){var n=r.openchannelAccountApps.rows[t]?r.openchannelAccountApps.rows[t]:r.openchannelAccountApps.rows[0];i.show({controller:"EditOpenchannelAccountApp"+(n.appType||n.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/apps/"+(n.appType||n.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelAccountApp:n,openchannelAccount:r.openchannelAccount,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.openchannelAccountApps.rows[t]=e:r.openchannelAccountApps.rows.splice(t,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,t=[],n=0;n<r.openchannelAccountApps.rows.length;n++,0){var a=r.openchannelAccountApps.rows[n],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,t=_.concat(t,i,[a],s)}o.openchannelAccount.addApplications({id:r.openchannelAccount.id},_.sortBy(t,"priority")).$promise.then(function(e){r.openchannelAccountApps.rows=e.rows}).catch(function(e){console.error(e)})}function n(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:"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:"1"},{option:"Always",value:"0"}],required:!0,param:0},{title:"Text",name:"text",type:"textarea",maxlength:255,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){t(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,t){r.openchannelAccount=e,r.crudPermissions=void 0!==t?t:{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,t,n){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(n).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.openchannelAccountApps.rows.splice(t,1),l()},function(){console.log("CANCEL")})},r.getOpenchannelAccountApps=function(){r.promise=o.openchannelAccount.getApplications(r.query,n).$promise},r.editOpenchannelAccountApp=t,r.editInterval=function(e,t){if(r.openchannelAccountApps.rows.length){var n=r.openchannelAccountApps.rows[t]?r.openchannelAccountApps.rows[t]: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:n.interval,IntervalId:n.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(n.interval=e.interval||"*,*,*,*",n.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 t=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(t).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,t,n,o,r,l,d){var c=this;function m(){return a(function(n,t){return a(function(t,n){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.openchannelAccount.getAgents({id:c.openchannelAccount.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return t.penalty=e.UserOpenchannelAccount?"penalty "+e.UserOpenchannelAccount.penalty:"",t.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=l.getCurrentUser(),c.openchannelAccount=t,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(n,t){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.openchannelAccount.removeAgents({id:c.openchannelAccount.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.openchannelAccount.addAgents({id:c.openchannelAccount.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,items:[],selectedItems:[],showSelectAndDeselectAll:!o,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("OPENCHANNEL.ALL_AGENTS"),labelSelected:r.instant("OPENCHANNEL.SELECTED_AGENTS"),transferCallback:function(e,t){var n=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(n)}}}e.$inject=["$mdDialog","$q","toasty","api","openchannelAccount","openchannelAccounts","realtime","$translate","Auth","crudPermissions"],angular.module("app.openchannel").controller("OpenchannelAccountagentaddController",e)}(),function(){"use strict";function e(t,e,n,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"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){t.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 t=_.find(l.agents,{name:l.agent.agent});t&&(l.agent.UserId=t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),n=null;if(l.agent&&(n=_.find(l.agents,{name:l.agent.agent})),n&&!_.some(t,["id",n.id])){var a=_.find(l.agents,{id:n.id});a.canSelect=!1,t.push(a)}l.agents=t})}else{var n=[],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,n.push(l.agents[i]));l.agents=n}}).catch(function(e){n.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(t,e,n,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"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){t.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(t,e,n,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"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){t.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(t,e,n,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"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){t.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(t,e,n,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"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){t.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,t,n,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 E(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var t=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),n=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(t+"-"+n)}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 A(e){t.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=E(),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!":""}),A()}).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=E(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),A(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var t=_.find(c.intervals,{id:e.id});t&&_.merge(t,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),A()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=A,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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=e&&e.rows?e.rows:[],n=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(t,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,n.push(e))}),c.intervals=n})}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(t,e,n,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"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){t.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(t,e,n,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"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){t.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 t=_.find(l.queues,{name:l.queue.queue});t&&(l.queue[_.capitalize("openChannel")+"QueueId"]=t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),n=null;if(l.queue&&(n=_.find(l.queues,{name:l.queue.queue})),n&&!_.some(t,["id",n.id])){var a=_.find(l.queues,{id:n.id});a.canSelect=!1,t.push(a)}l.queues=t})}else{var n=[],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,n.push(l.queues[i]));l.queues=n}}).catch(function(e){n.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(t,e,n,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"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){t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),n=null;if(l.system&&(n=_.find(l.variables,{name:l.system.variable})),n&&!_.some(t,["id",n.id])){var a=_.find(l.variables,{id:n.id});a.canSelect=!1,t.push(a)}l.variables=t})}else{var n=[],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,n.push(l.variables[i]));l.variables=n}}).catch(function(e){n.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(t,e,n,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"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){t.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 t=_.find(l.tags,{name:l.tag.tag});t&&(l.tag.TagId=t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),n=null;if(l.tag&&(n=_.find(l.tags,{name:l.tag.tag})),n&&!_.some(t,["id",n.id])){var a=_.find(l.tags,{id:n.id});a.canSelect=!1,t.push(a)}l.tags=t})}else{var n=[],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,n.push(l.tags[i]));l.tags=n}}).catch(function(e){n.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,t,n,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.openchannelAccount={},c.openchannelAccountInteractions={count:0,rows:[]},c.selectedOpenchannelAccountInteractions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,Contact.firstName,Owner.name,closedAt,disposition,note,UserId,ContactId,OpenchannelAccountId,tag",sort:"-createdAt",includeAll:"true",limit:10,page:1},c.init=function(e,t){c.openchannelAccount=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.openchannelAccount.id,c.getOpenchannelAccountInteractions()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.openchannelInteractionDownload=function(s,e,t){return l.openchannelInteraction.download({id:s.id,exists:!0,attachments:t}).$promise.then(function(e){var t=[e.buffer],n="interaction"+s.id,a=new Blob(t,{type:e.type});n="openchannel-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.success=p,c.getOpenchannelAccountInteractions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.openchannelAccount.getInteractions(c.query,p).$promise},c.createOrEditOpenchannelAccountInteraction=function(e,t){s.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/interactions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelAccount:c.openchannelAccount,interaction:t,interactions:c.openchannelAccountInteractions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.spyopenchannelInteraction=function(e,n){s.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,t){e.vm.init({id:1,channel:"openchannel",interaction:n,spy:!0},a.$parent.vm.setting)}})},c.exportSelectedOpenchannelAccountInteractions=function(){var e=angular.copy(c.selectedOpenchannelAccountInteractions);return c.selectedOpenchannelAccountInteractions=[],e},c.deleteOpenchannelAccountInteraction=g,c.deleteSelectedOpenchannelAccountInteractions=function(e){var t=s.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+c.selectedOpenchannelAccountInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedOpenchannelAccountInteractions.forEach(function(e){g(e)}),c.selectedOpenchannelAccountInteractions=[]})};var m=!0,u=1;function p(e){c.openchannelAccountInteractions=e||{count:0,rows:[]}}function g(e){l.openchannelInteraction.delete({id:e.id}).$promise.then(function(){_.remove(c.openchannelAccountInteractions.rows,{id:e.id}),c.openchannelAccountInteractions.count-=1,c.openchannelAccountInteractions.rows.length||c.getOpenchannelAccountInteractions(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETopenchannelAccount"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}a.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getOpenchannelAccountInteractions())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.openchannel").controller("OpenchannelAccountInteractionsController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.openchannelAccount={},c.openchannelAccountOpenchannelCannedAnswers={count:0,rows:[]},c.selectedOpenchannelAccountOpenchannelCannedAnswers=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,key,value,description",limit:10,page:1},c.init=function(e,t){c.openchannelAccount=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.openchannelAccount.id,c.query.OpenchannelAccountId=c.openchannelAccount.id,c.getOpenchannelAccountOpenchannelCannedAnswers()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the openchannelCannedAnswer?").htmlContent("<b>"+(e.name||"openchannelCannedAnswer")+"</b> will be deleted.").ariaLabel("delete openchannelCannedAnswer").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getOpenchannelAccountOpenchannelCannedAnswers=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.openchannelAccount.getAnswers(c.query,p).$promise},c.createOrEditOpenchannelAccountOpenchannelCannedAnswer=function(e,t){s.show({controller:"CreateOrEditOpenchannelCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/openchannelCannedAnswers/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelAccount:c.openchannelAccount,openchannelCannedAnswer:t,openchannelCannedAnswers:c.openchannelAccountOpenchannelCannedAnswers.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedOpenchannelAccountOpenchannelCannedAnswers=function(){var e=angular.copy(c.selectedOpenchannelAccountOpenchannelCannedAnswers);return c.selectedOpenchannelAccountOpenchannelCannedAnswers=[],e},c.deleteOpenchannelAccountOpenchannelCannedAnswer=g,c.deleteSelectedOpenchannelAccountOpenchannelCannedAnswers=function(e){var t=s.confirm().title("Are you sure want to delete the selected openchannelCannedAnswers?").htmlContent("<b>"+c.selectedOpenchannelAccountOpenchannelCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete openchannelCannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedOpenchannelAccountOpenchannelCannedAnswers.forEach(function(e){g(e)}),c.selectedOpenchannelAccountOpenchannelCannedAnswers=[]})};var m=!0,u=1;function p(e){c.openchannelAccountOpenchannelCannedAnswers=e||{count:0,rows:[]}}function g(e){l.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(c.openchannelAccountOpenchannelCannedAnswers.rows,{id:e.id}),c.openchannelAccountOpenchannelCannedAnswers.count-=1,c.openchannelAccountOpenchannelCannedAnswers.rows.length||c.getOpenchannelAccountOpenchannelCannedAnswers(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETopenchannelAccount"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getOpenchannelAccountOpenchannelCannedAnswers())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.openchannel").controller("OpenchannelAccountOpenchannelCannedAnswersController",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(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),t.params.id&&(g.openchannelCannedAnswer.OpenchannelAccountId=t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.openchannelCannedAnswers,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The openchannelCannedAnswer will be deleted.").ariaLabel("Delete OpenchannelCannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.openchannelAccount={},c.openchannelAccountOpenchannelDispositions={count:0,rows:[]},c.selectedOpenchannelAccountOpenchannelDispositions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,name",limit:10,page:1},c.init=function(e,t){c.openchannelAccount=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.openchannelAccount.id,c.query.OpenchannelAccountId=c.openchannelAccount.id,c.getOpenchannelAccountOpenchannelDispositions()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the openchannelDisposition?").htmlContent("<b>"+(e.name||"openchannelDisposition")+"</b> will be deleted.").ariaLabel("delete openchannelDisposition").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getOpenchannelAccountOpenchannelDispositions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.openchannelAccount.getDispositions(c.query,p).$promise},c.createOrEditOpenchannelAccountOpenchannelDisposition=function(e,t){s.show({controller:"CreateOrEditOpenchannelDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/openchannelDispositions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelAccount:c.openchannelAccount,openchannelDisposition:t,openchannelDispositions:c.openchannelAccountOpenchannelDispositions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedOpenchannelAccountOpenchannelDispositions=function(){var e=angular.copy(c.selectedOpenchannelAccountOpenchannelDispositions);return c.selectedOpenchannelAccountOpenchannelDispositions=[],e},c.deleteOpenchannelAccountOpenchannelDisposition=g,c.deleteSelectedOpenchannelAccountOpenchannelDispositions=function(e){var t=s.confirm().title("Are you sure want to delete the selected openchannelDispositions?").htmlContent("<b>"+c.selectedOpenchannelAccountOpenchannelDispositions.length+" selected</b> will be deleted.").ariaLabel("delete openchannelDispositions").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedOpenchannelAccountOpenchannelDispositions.forEach(function(e){g(e)}),c.selectedOpenchannelAccountOpenchannelDispositions=[]})};var m=!0,u=1;function p(e){c.openchannelAccountOpenchannelDispositions=e||{count:0,rows:[]}}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){_.remove(c.openchannelAccountOpenchannelDispositions.rows,{id:e.id}),c.openchannelAccountOpenchannelDispositions.count-=1,c.openchannelAccountOpenchannelDispositions.rows.length||c.getOpenchannelAccountOpenchannelDispositions(),r.success({title:"OpenchannelDisposition deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETopenchannelAccount"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getOpenchannelAccountOpenchannelDispositions())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.openchannel").controller("OpenchannelAccountOpenchannelDispositionsController",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(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_OPENCHANNELDISPOSITION",g.openchannelDisposition=angular.copy(l),g.openchannelDispositions=r,g.newOpenchannelDisposition=!1,g.openchannelDisposition||(g.openchannelDisposition={},g.title="OPENCHANNEL.NEW_OPENCHANNELDISPOSITION",g.newOpenchannelDisposition=!0),t.params.id&&(g.openchannelDisposition.OpenchannelAccountId=t.params.id),g.addNewOpenchannelDisposition=function(){g.errors=[],d.disposition.save(g.openchannelDisposition).$promise.then(function(e){g.openchannelDispositions.unshift(e.toJSON()),o.success({title:"OpenchannelDisposition properly created",msg:g.openchannelDisposition.name?g.openchannelDisposition.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.disposition.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveOpenchannelDisposition=function(){g.errors=[],d.disposition.update({id:g.openchannelDisposition.id},g.openchannelDisposition).$promise.then(function(e){var t=_.find(g.openchannelDispositions,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"OpenchannelDisposition properly saved!",msg:g.openchannelDisposition.name?g.openchannelDisposition.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.disposition.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteOpenchannelDisposition=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The openchannelDisposition will be deleted.").ariaLabel("Delete OpenchannelDisposition").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.disposition.delete({id:g.openchannelDisposition.id}).$promise.then(function(){_.remove(g.openchannelDispositions,{id:g.openchannelDisposition.id}),o.success({title:"OpenchannelDisposition properly deleted!",msg:(g.openchannelDisposition.name||"openchannelDisposition")+" has been deleted!"}),v(g.openchannelDisposition)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.disposition.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.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","openchannelDispositions","openchannelDisposition","api","Auth","license","setting","crudPermissions"],angular.module("app.openchannel").controller("CreateOrEditOpenchannelDispositionDialogController",e)}(),function(){"use strict";function e(e,t,n,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=t.protocol()+"://"+t.host(),u.openchannelAccount=c||e.params.openchannelAccount||{},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.agentadddialog=function(e,t){n.show({controller:"OpenchannelAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{openchannelAccount:e,openchannelAccounts:u.openchannelAccounts?u.openchannelAccounts.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoOpenchannelAccounts=function(){e.go("app.openchannel.openchannelAccounts")},u.saveOpenchannelAccount=function(){r.openchannelAccount.update({id:u.openchannelAccount.id},u.openchannelAccount).$promise.then(function(){l.success({title:"OpenchannelAccount updated!",msg:u.openchannelAccount.name?u.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){u.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){u.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.lists,{id:e.resourceId})}),n=null;if(u.openchannelAccount&&(n=_.find(u.lists,{id:Number(u.openchannelAccount.ListId)})),n&&!_.some(t,["id",n.id])){var a=_.find(u.lists,{id:n.id});a.canSelect=!1,t.push(a)}u.lists=t})}else{var n=[],a=null;u.openchannelAccount&&(a=_.find(u.lists,{id:Number(u.openchannelAccount.ListId)}));for(var i=0;i<u.lists.length;i++)a&&u.lists[i].id===a.id&&(u.lists[i].canSelect=!1,n.push(u.lists[i]));u.lists=n}}).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:u.openchannelAccount.ListId}).$promise.then(function(e){u.fields=[];e=_.values(e.toJSON());for(var t=["id","createdAt","updatedAt","deletedAt","scheduledat","ListId","CompanyId"],n=0;n<e.length;n++)_.includes(t,e[n].columnName)||u.fields.push(e[n])}).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){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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.pauses,{id:e.resourceId})});u.pauses.forEach(function(e){_.some(t,["id",e.id])||(e.canSelect=!1),t.push(e)}),u.pauses=t})}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","openchannelAccount","userProfileSection"],angular.module("app.openchannel").controller("OpenchannelAccountController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.openchannelAccounts=l||{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="openchannelAccounts",b.listOrder="",b.listOrderAsc=null,b.selectedOpenchannelAccounts=[],b.query={fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,mapKey,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUri,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,page:1},b.editstate=function(e,t){n.go("app.openchannel.openchannelAccounts.edit",{id:e.id,openchannelAccount:e,crudPermissions:b.crudPermissions})},b.interactionsgoto=function(e,t){n.go("app.openchannel.openchannelAccounts.edit",{id:e.id,tab:5})},b.agentadddialog=function(e,t){i.show({controller:"OpenchannelAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{openchannelAccount:e,openchannelAccounts:b.openchannelAccounts?b.openchannelAccounts.rows:[],crudPermissions:b.crudPermissions,realtime:!1}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getOpenchannelAccounts=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.openchannelAccount.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="OpenchannelAccounts",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditOpenchannelAccount=function(e,t){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:t,openchannelAccounts:b.openchannelAccounts.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteOpenchannelAccount=S,b.exportSelectedOpenchannelAccounts=function(){var e=angular.copy(b.selectedOpenchannelAccounts);return b.selectedOpenchannelAccounts=[],e},b.deleteSelectedOpenchannelAccounts=function(e){var t=i.confirm().title("Are you sure want to delete the selected openchannelAccounts?").htmlContent("<b>"+b.selectedOpenchannelAccounts.length+" selected</b> will be deleted.").ariaLabel("delete OpenchannelAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedOpenchannelAccounts.forEach(function(e){S(e)}),b.selectedOpenchannelAccounts=[]})},b.deselectOpenchannelAccounts=function(){b.selectedOpenchannelAccounts=[]},b.selectAllOpenchannelAccounts=function(){b.selectedOpenchannelAccounts=b.openchannelAccounts.rows},g.hasRole("admin")?m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){b.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){b.lists=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(b.lists,{id:e.resourceId})}),n=null;if(b.openchannelAccount&&(n=_.find(b.lists,{id:Number(b.openchannelAccount.ListId)})),n&&!_.some(t,["id",n.id])){var a=_.find(b.lists,{id:n.id});a.canSelect=!1,t.push(a)}b.lists=t})}else{var n=[],a=null;b.openchannelAccount&&(a=_.find(b.lists,{id:Number(b.openchannelAccount.ListId)}));for(var i=0;i<b.lists.length;i++)a&&b.lists[i].id===a.id&&(b.lists[i].canSelect=!1,n.push(b.lists[i]));b.lists=n}}).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 E=!0,A=1;function y(e){b.openchannelAccounts=e||{count:0,rows:[]}}function S(e){m.openchannelAccount.delete({id:e.id}).$promise.then(function(){_.remove(b.openchannelAccounts.rows,{id:e.id}),b.openchannelAccounts.count-=1,b.openchannelAccounts.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEopenchannelAccount"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getOpenchannelAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","openchannelAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.openchannel").controller("OpenchannelAccountsController",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(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_OPENCHANNELQUEUE",g.openchannelQueue=angular.copy(l),g.openchannelQueues=r,g.newOpenchannelQueue=!1,g.openchannelQueue||(g.openchannelQueue={strategy:"beepall",timeout:10},g.title="OPENCHANNEL.NEW_OPENCHANNELQUEUE",g.newOpenchannelQueue=!0),g.addNewOpenchannelQueue=function(){g.errors=[],d.openchannelQueue.save(g.openchannelQueue).$promise.then(function(e){g.openchannelQueues.unshift(e.toJSON()),o.success({title:"OpenchannelQueue properly created",msg:g.openchannelQueue.name?g.openchannelQueue.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.openchannelQueue.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveOpenchannelQueue=function(){g.errors=[],d.openchannelQueue.update({id:g.openchannelQueue.id},g.openchannelQueue).$promise.then(function(e){var t=_.find(g.openchannelQueues,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"OpenchannelQueue properly saved!",msg:g.openchannelQueue.name?g.openchannelQueue.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.openchannelQueue.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteOpenchannelQueue=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The openchannelQueue will be deleted.").ariaLabel("Delete OpenchannelQueue").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.openchannelQueue.delete({id:g.openchannelQueue.id}).$promise.then(function(){_.remove(g.openchannelQueues,{id:g.openchannelQueue.id}),o.success({title:"OpenchannelQueue properly deleted!",msg:(g.openchannelQueue.name||"openchannelQueue")+" has been deleted!"}),v(g.openchannelQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelQueue.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.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(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","openchannelQueues","openchannelQueue","api","Auth","license","setting","crudPermissions"],angular.module("app.openchannel").controller("CreateOrEditOpenchannelQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,t,n,o,r,l,d){var c=this;function m(){return a(function(n,t){return a(function(t,n){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.openchannelQueue.getAgents({id:c.openchannelQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return t.penalty=e.UserOpenchannelQueue?"penalty "+e.UserOpenchannelQueue.penalty:"",t.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=l.getCurrentUser(),c.openchannelQueue=t,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(n,t){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.openchannelQueue.removeAgents({id:c.openchannelQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.openchannelQueue.addAgents({id:c.openchannelQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,items:[],selectedItems:[],showSelectAndDeselectAll:!o,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("OPENCHANNEL.ALL_AGENTS"),labelSelected:r.instant("OPENCHANNEL.SELECTED_AGENTS"),transferCallback:function(e,t){var n=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(n)}}}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,t,n,o,r){var l=this;function d(){return a(function(n,t){return a(function(t,n){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:l.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return l.allowedItems=_.map(t,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var t=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.openchannelQueue.getTeams({id:l.openchannelQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];l.selectedItems=_.map(t,function(e){return _.find(l.items,{id:e.id})}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}l.currentUser=o.getCurrentUser(),l.openchannelQueue=t,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={readOnly:!l.crudPermissions.canEdit,allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!0,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:n.instant("OPENCHANNEL.ALL_TEAMS"),labelSelected:n.instant("OPENCHANNEL.SELECTED_TEAMS"),transferCallback:function(e,t){var n=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(n)}},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(n,t){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.openchannelQueue.removeTeams({id:l.openchannelQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.openchannelQueue.addTeams({id:l.openchannelQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},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,t,n,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=t.protocol()+"://"+t.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,t){n.show({controller:"OpenchannelQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{openchannelQueue:e,openchannelQueues:u.openchannelQueues?u.openchannelQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,t){n.show({controller:"OpenchannelQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:t,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")},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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.openchannelQueues=l||{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="openchannelQueues",b.listOrder="",b.listOrderAsc=null,b.selectedOpenchannelQueues=[],b.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"openchannel",limit:10,page:1},b.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.openchannel.openchannelQueues.edit",{id:e.id,openchannelQueue:e,crudPermissions:b.crudPermissions})},b.teamadddialog=function(e,t){i.show({controller:"OpenchannelQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{openchannelQueue:e,openchannelQueues:b.openchannelQueues?b.openchannelQueues.rows:[],crudPermissions:b.crudPermissions}})},b.agentadddialog=function(e,t){i.show({controller:"OpenchannelQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{openchannelQueue:e,openchannelQueues:b.openchannelQueues?b.openchannelQueues.rows:[],crudPermissions:b.crudPermissions,realtime:!1}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.gotorealtimegoto=function(e,t){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:810}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.openchannel.realtime.queues",{})}},b.success=y,b.getOpenchannelQueues=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.openchannelQueue.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="OpenchannelQueues",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditOpenchannelQueue=function(e,t){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:t,openchannelQueues:b.openchannelQueues.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteOpenchannelQueue=S,b.exportSelectedOpenchannelQueues=function(){var e=angular.copy(b.selectedOpenchannelQueues);return b.selectedOpenchannelQueues=[],e},b.deleteSelectedOpenchannelQueues=function(e){var t=i.confirm().title("Are you sure want to delete the selected openchannelQueues?").htmlContent("<b>"+b.selectedOpenchannelQueues.length+" selected</b> will be deleted.").ariaLabel("delete OpenchannelQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedOpenchannelQueues.forEach(function(e){S(e)}),b.selectedOpenchannelQueues=[]})},b.deselectOpenchannelQueues=function(){b.selectedOpenchannelQueues=[]},b.selectAllOpenchannelQueues=function(){b.selectedOpenchannelQueues=b.openchannelQueues.rows};var E=!0,A=1;function y(e){b.openchannelQueues=e||{count:0,rows:[]}}function S(e){m.openchannelQueue.delete({id:e.id}).$promise.then(function(){_.remove(b.openchannelQueues.rows,{id:e.id}),b.openchannelQueues.count-=1,b.openchannelQueues.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEopenchannelQueue"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getOpenchannelQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","openchannelQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.openchannel").controller("OpenchannelQueuesController",e)}(),function(){"use strict";function e(e,o,t,n,a,i,s,r,l,d,c,m,u,p,g,v,h,f){var b=this,E=["userpic","online","lastLoginAt","lastPauseAt","pauseType","lastPauseAt","internal","address","chatPause","openchannelPause","mailPause","smsPause","faxPause","voicePause","chatCapacity","openchannelCapacity","mailCapacity","smsCapacity","faxCapacity","chatCurrentCapacity","openchannelCurrentCapacity","mailCurrentCapacity","smsCurrentCapacity","faxCurrentCapacity","chatStatus","openchannelStatus","mailStatus","smsStatus","faxStatus","voiceStatus","chatStatusTime","openchannelStatusTime","mailStatusTime","smsStatusTime","faxStatusTime","voiceStatusTime","queue","destconnectedlinenum","onhold"],A=["chatPause","openchannelPause","mailPause","smsPause","faxPause","voicePause","online"];for(var y in b.currentUser=v.getCurrentUser(),b.availableStates=["ringing","inuse","busy","onhold","not_inuse"],b.pauses=s||{count:0,rows:[]},b.license=h,b.userProfile=p,b.userProfileSection=g&&1==g.count?g.rows[0]:null,b.crudPermissions=v.parseCrudPermissions(b.userProfileSection?b.userProfileSection.crudPermissions:null),b.agents=r?_.keyBy(r.rows?r.rows:[],"id"):{},b.rpcAgents=l?_.keyBy(l.rows?l.rows:[],"id"):{},b.paginatedAgents={},b.load=!1,b.order=[],b.agentInternal={},b.agents)b.agents.hasOwnProperty(y)&&(b.agents[y].init=!0);b.query={limit:10,page:1,order:"fullname",globalStatusFilter:"",pauseTypeFilter:""},b.logout=function(e,t){return d.user.logout({id:e.id,device:"realtime",agent_id:e.id,agent_name:e.name}).$promise.then(function(){m.success({title:"Agent logout",msg:e.fullname+"  properly logout"}),b.agents[e.id]&&(b.agents[e.id].online=!1),b.rpcAgents[e.id]&&(b.rpcAgents[e.id].online=!1),T()}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.queueAdd=function(e,t){n.show({controller:"AgentqueueaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/queueadd/queueadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{agent:e,agents:[],channel:"openchannel",direction:"inbound",crudPermissions:b.crudPermissions}})},b.pause=function(t,e){return d.user.pause({id:t.id,type:e}).$promise.then(function(e){b.agents[t.id]&&_.merge(b.agents[t.id],_.pick(e,E)),b.rpcAgents[t.id]&&_.merge(b.rpcAgents[t.id],_.pick(e,E)),O(b.agents[t.id])}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.unPause=function(t){return d.user.unpause({id:t.id}).$promise.then(function(e){b.agents[t.id]&&_.merge(b.agents[t.id],_.pick(e,E)),b.rpcAgents[t.id]&&_.merge(b.rpcAgents[t.id],_.pick(e,E)),O(b.agents[t.id])}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.showInfo=function(e){n.show(n.alert().clickOutsideToClose(!0).title("Legend").htmlContent("<div>TODO legend status + state</div>").ok("Ok").targetEvent(e))},b.getAgentStatus=w,b.getAgentGlobalStatus=O,b.isPause=I,b.checkPause=function(e){return"pause"===e},b.isPartialPause=function(e){return"*pause"===e},b.onSave=function(e){b.agents[e.id]&&(_.merge(b.agents[e.id],_.pick(_.omit(e,A),E)),_.merge(b.rpcAgents[e.id],_.pick(_.omit(e,A),E)),O(b.agents[e.id]))},b.onUpdate=function(e){b.agents[e.id]&&(_.merge(b.agents[e.id],_.pick(e,E)),_.merge(b.rpcAgents[e.id],_.pick(e,E)),e.lastPauseAt&&(b.agents[e.id].globalStatusTime=e.lastPauseAt,b.rpcAgents[e.id].globalStatusTime=e.lastPauseAt),O(b.agents[e.id]))},b.onInit=T,b.onConnect=function(e){b.agents[b.agentInternal[e.destaccountcode]]&&(_.merge(b.agents[b.agentInternal[e.destaccountcode]],_.pick(e,["queue","destconnectedlinenum"])),_.merge(b.rpcAgents[b.agentInternal[e.destaccountcode]],_.pick(e,["queue","destconnectedlinenum"])))},b.onComplete=function(e){b.agents[b.agentInternal[e.destaccountcode]]&&(b.agents[b.agentInternal[e.destaccountcode]]=_.omit(b.agents[b.agentInternal[e.destaccountcode]],["queue","destconnectedlinenum"]),b.rpcAgents[b.agentInternal[e.destaccountcode]]=_.omit(b.rpcAgents[b.agentInternal[e.destaccountcode]],["queue","destconnectedlinenum"]))},c.on("user:save",b.onSave),c.on("user:update",b.onUpdate),c.on("user:agentconnect",b.onConnect),c.on("user:agentcomplete",b.onComplete),T();var S=f(function(){b.load&&(b.load=!1,T())},999);function T(e){b.load=!1;var t,n,a=o.defer();b.promise=a.promise,b.filteredAgents=[],b.order=[],_.forIn(b.agents,function(e,t){b.rpcAgents[t]&&_.merge(e,_.pick(_.omit(b.rpcAgents[t],A),E)),O(e),e.online?(b.filteredAgents.push(e),b.agentInternal[e.internal]=t):e.globalStatusTime=_.toNumber(moment().format("x"))}),b.query.globalStatusFilter&&_.remove(b.filteredAgents,function(e){return e.globalStatus!==b.query.globalStatusFilter}),b.query.pauseTypeFilter&&_.remove(b.filteredAgents,function(e){return e.pauseType!==b.query.pauseTypeFilter}),b.query.filter&&_.remove(b.filteredAgents,function(e){return e.fullname.toLowerCase().indexOf(b.query.filter.toLowerCase())<0}),b.filteredAgents=(t=b.filteredAgents,n=_.startsWith(b.query.order,"-")?"desc":"asc",_.orderBy(t,[b.query.order.replace("-","")],[n]));var i=(b.query.page-1)*b.query.limit;b.paginatedAgents=_.drop(b.filteredAgents,i).slice(0,b.query.limit);for(var s=0;s<b.paginatedAgents.length;s+=1)b.order.push(b.paginatedAgents[s].id);a.resolve(),b.load=!0}function I(e){return"pause"===e||"*pause"===e}function C(e){return"idle"===e||"unknown"===e||"unavailable"===e||"ringing"===e||_.isNil(e)}function w(e,t){return"voice"===t?"idle"!==e[t+"Status"]?e[t+"Status"]:e[t+"Pause"]?e[t+"Status"]="pause":"idle":e[t+"Pause"]?e[t+"Status"]="pause":e[t+"Status"]}function O(e){var t="unknown";t=_.every([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],I)?"pause":_.some([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],I)?"*pause":_.every([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],C)?"idle":"busy",e.globalStatus!==t&&(e.globalStatus=t,e.init?(e.init=!1,e.globalStatusTime=I(t)?_.toNumber(moment(e.lastPauseAt).format("x")):_.max([e.voiceStatusTime,e.chatStatusTime,e.mailStatusTime,e.smsStatusTime,e.openchannelStatusTime,e.faxStatusTime])):e.globalStatusTime=_.toNumber(moment().format("x")))}e.$on("$destroy",function(){c.removeAllListeners("user:save"),c.removeAllListeners("user:update"),c.removeAllListeners("user:agentconnect"),c.removeAllListeners("user:agentcomplete"),S&&(f.cancel(S),S=null)})}e.$inject=["$scope","$q","$timeout","$mdDialog","$document","$filter","pauses","agents","rpcAgents","api","socket","toasty","helperClasses","userProfile","userProfileSection","Auth","license","$interval"],angular.module("app.voice").controller("AgentsOpenchannelRealtimeController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this,v=["loggedIn","available","waiting","talking","pTalking","originated","message","dialActive","dialMethod","Trunk","paused"];function h(){var n=[];return _.forIn(g.queues,function(e,t){e.paused=0,e.loggedInDb=0,g.queues[t].agents={},n.push(l.openchannelQueue.getMembers({id:t}).$promise),g.rpcQueues[t]&&_.merge(e,_.pick(g.rpcQueues[t],v))}),t.all(n).then(function(e){for(var t=0;t<e.length;t+=1)for(var n=0;n<e[t].rows.length;n++)e[t].rows[n].paused&&g.queues[e[t].rows[n].OpenchannelQueueId].paused++,g.queues[e[t].rows[n].OpenchannelQueueId].loggedInDb++,g.queues[e[t].rows[n].OpenchannelQueueId].agents[e[t].rows[n].UserId]=e[t].rows[n].OpenchannelQueueId}).catch(function(e){console.error(e)})}g.currentUser=p.getCurrentUser(),g.count=o.count?o.count:0,g.queues=o?_.keyBy(o.rows?o.rows:[],"id"):{},g.rpcQueues=r?_.keyBy(r.rows?r.rows:[],"id"):{},g.userProfile=m,g.userProfileSection=u&&1==u.count?u.rows[0]:null,g.crudPermissions=p.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),p.hasRole("admin")?g.query={type:"inbound",sort:"-updatedAt",limit:10,page:1}:g.query={id:g.currentUser.id,channel:"openchannel",type:"inbound",sort:"-updatedAt",limit:10,page:1},g.success=E,g.getQueues=function(){g.query.offset=(g.query.page-1)*g.query.limit,p.hasRole("admin")?g.promise=l.openchannelQueue.get(g.query,E).$promise:(g.query.id=g.userProfile.id,g.query.section="OpenchannelQueues",g.promise=l.userProfile.getResources(g.query,E).$promise)},g.createOrEditOpenchannelQueue=function(e,t){a.show({controller:"CreateOrEditOpenchannelQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelQueue:t,openchannelQueues:_.values(g.queues),license:null,setting:null,crudPermissions:g.crudPermissions}})},g.agentAdd=function(e,t){a.show({controller:"OpenchannelQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelQueue:t,openchannelQueues:g.queues?g.queues.rows:[],realtime:!1,crudPermissions:g.crudPermissions}})},g.updateQueue=function(e){return l.openchannelQueue.update(e).$promise.then(function(){c.success({title:"Queue properly updated!",msg:e.name?e.name+" has been updated!":""})}).catch(function(e){c.error({title:"Error creating queue!",msg:e.message})})},g.onSave=function(e){g.queues[e.id]&&_.merge(g.queues[e.id],_.pick(e,v))},g.onSaveMember=function(e){g.queues[e.OpenchannelQueueId]&&g.queues[e.OpenchannelQueueId].loggedInDb++},g.onRemoveMember=function(e){g.queues[e.OpenchannelQueueId]&&g.queues[e.OpenchannelQueueId].loggedInDb--},g.onPause=function(n){console.log("onPause",n),n.voicePause?_.forIn(g.queues,function(e,t){e.agents[n.id]&&(e.paused+=1,console.log("pause"))}):n.voicePause||_.forIn(g.queues,function(e,t){e.agents[n.id]&&0<e.paused&&(e.paused-=1,console.log("unpause"))})},g.onLogin=function(e){console.log("onLogged",e),g.queues[e.OpenchannelQueueId]&&(g.queues[e.OpenchannelQueueId].loggedInDb+=1,g.queues[e.OpenchannelQueueId].agents[e.UserId]=e.OpenchannelQueueId)},g.onLogout=function(e){console.log("onLogout",e),g.queues[e.OpenchannelQueueId]&&0<g.queues[e.OpenchannelQueueId].loggedInDb&&(g.queues[e.OpenchannelQueueId].loggedInDb-=1,delete g.queues[e.OpenchannelQueueId].agents[e.UserId])},g.$onInit=h,g.order=[],_.forIn(g.queues,function(e,t){g.order.push(e.id)}),d.on("openchannel_queue:save",g.onSave),d.on("userOpenchannelQueue:save",g.onSaveMember),d.on("userOpenchannelQueue:remove",g.onRemoveMember),d.on("user:update",g.onPause),d.on("userVoiceQueue:remove",g.onLogout),d.on("userVoiceQueue:save",g.onLogin);var f=!0,b=1;function E(e){if(g.count=e.count,g.queues=e?_.keyBy(e.rows?e.rows:[],"id"):{},e.rows){g.order=[];for(var t=0;t<e.rows.length;t++)g.order.push(e.rows[t].id)}h()}e.$watch("vm.query.filter",function(e,t){f?n(function(){f=!1}):(t||(b=g.query.page),e!==t&&(g.query.page=1),e||(g.query.page=b),g.getQueues())}),e.$on("$destroy",function(){d.removeAllListeners("openchannel_queue:save"),d.removeAllListeners("userOpenchannelQueue:remove"),d.removeAllListeners("userOpenchannelQueue:save"),d.removeAllListeners("user:update"),d.removeAllListeners("userVoiceQueue:remove"),d.removeAllListeners("userVoiceQueue:save")})}e.$inject=["$scope","$timeout","$mdDialog","$q","$document","$interval","queues","rpcQueues","api","socket","toasty","userProfile","userProfileSection","Auth"],angular.module("app.openchannel").controller("QueuesOpenchannelRealtimeController",e)}(),function(){"use strict";angular.module("app.auth").factory("helperClasses",function(){return{status:{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"},state:{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"},channelStatus:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},channelStatusOut:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"}}})}(),function(){"use strict";function e(e,n,t){switch(t.disconnect(),t.connect(),this.selectedTab=0,n.current.name){case"app.openchannel.realtime.agents":this.selectedTab=0;break;case"app.openchannel.realtime.queues":this.selectedTab=1;break;default:this.selectedTab=0,n.go("app.openchannel.realtime.agents")}e.$watch("vm.selectedTab",function(e,t){if(e!==t)switch(e){case 0:n.go("app.openchannel.realtime.agents");break;case 1:n.go("app.openchannel.realtime.queues");break;default:n.go("app.openchannel.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.openchannel").controller("OpenchannelRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,s){var o=this;o.currentUser=s.getCurrentUser(),o.plugin={},o.getTrustedURL=function(){return n.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(e,t,n,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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.customizations,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The customization will be deleted.").ariaLabel("Delete Customization").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,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?t.setting.update({id:s.customization.id},s.customization).$promise.then(function(){n.success({title:"Customization updated!",msg:s.customization.name?s.customization.name+" has been updated!":""})}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsetting",msg:e.data?JSON.stringify(e.data):e.toString()})}):t.setting.save(s.customization).$promise.then(function(e){_.merge(s.customization,e),n.success({title:"Customization updated!",msg:s.customization.name?s.customization.name+" has been updated!":""})}).catch(function(e){n.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 t=["png","jpg"];if(!_.includes(t,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+t.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var n={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.customization.images.unshift(n),!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(t,e){if(t.id===a.uniqueIdentifier){var n=new FileReader;n.readAsDataURL(t.file.file),n.onload=function(e){t.url=e.target.result},t.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 t=["png","jpg"];if(!_.includes(t,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+t.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var n={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.customization.images.unshift(n),!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(t,e){if(t.id===a.uniqueIdentifier){var n=new FileReader;n.readAsDataURL(t.file.file),n.onload=function(e){t.url=e.target.result},t.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 t=["png","jpg"];if(!_.includes(t,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+t.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var n={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.customization.images.unshift(n),!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(t,e){if(t.id===a.uniqueIdentifier){var n=new FileReader;n.readAsDataURL(t.file.file),n.onload=function(e){t.url=e.target.result},t.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,t,n,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:10,phoneBarAutoUpdater:!0,phoneBarAutoUpdaterUrl:"https://www.xcally.com/bar/phonebar/autoupdater.xml",splitSizeCsv:5e3,splitSizePdf:1e3,splitSizeXlsx:5e3,messagesAlignment:"alternate",phoneBarRememberMeEnabled:!0},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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.generals,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The general will be deleted.").ariaLabel("Delete General").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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","generals","general","api","Auth","license","setting","crudPermissions"],angular.module("app.settings").controller("CreateOrEditGeneralDialogController",e)}(),function(){"use strict";function e(e,t,n,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]),s.saveGeneral=function(){s.general.id?t.setting.update({id:s.general.id},s.general).$promise.then(function(){n.success({title:"General updated!",msg:s.general.name?s.general.name+" has been updated!":""})}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsetting",msg:e.data?JSON.stringify(e.data):e.toString()})}):t.setting.save(s.general).$promise.then(function(e){_.merge(s.general,e),n.success({title:"General updated!",msg:s.general.name?s.general.name+" has been updated!":""})}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsetting",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["generals","api","toasty","license","Auth"],angular.module("app.settings").controller("GeneralsController",e)}(),function(){"use strict";function e(t,n,a,i,e,s){var o=this;o.license=i||{},o.agents=0,o.users=0,o.telephones=0,o.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"}],o.modules=[{name:"cm",icon:"icon-account-circle"},{name:"dialer",icon:"icon-crosshairs"},{name:"jscripty",icon:"icon-console"}],o.addons=[{name:"webrtc",icon:"icon-server-plus"},{name:"jaws",icon:"icon-fish"},{name:"custom",icon:"icon-table-edit"}],o.sessions=[{name:"callysquare",icon:"icon-sitemap",restart:!0,label:"channels",enabled:"voice"},{name:"virtual",icon:"icon-dots-horizontal",restart:!1,label:"sessions",enabled:"chat"}],o.others=[{name:"update",icon:"icon-cloud-download"}],o.requestLicense=function(e){n.show({controller:"RequestLicenseDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/license/request/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{license:i,channels:o.channels,modules:o.modules,addons:o.addons,sessions:o.sessions,others:o.others}})},o.updateLicense=function(e){n.show({controller:"UpdateLicenseDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/license/update/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{license:i}})},o.gotoProcess=function(e){a.go("app.settings.system",{tab:1})},s.user.get({fields:"id",role:"agent",online:!0}).$promise.then(function(e){return o.agents=e&&e.count?e.count:0,s.user.get({fields:"id",role:"user,admin"}).$promise}).then(function(e){return o.users=e&&e.count?e.count:0,s.user.get({fields:"id",role:"telephone"}).$promise}).then(function(e){o.telephones=e&&e.count?e.count:0}).catch(function(e){console.log(e)})}e.$inject=["$document","$mdDialog","$state","license","toasty","api"],angular.module("app.settings.license").controller("LicenseController",e)}(),function(){"use strict";function e(e,t,n,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(n),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)&&(n[e]===m.license[e]?m.table+="|"+e+"|"+(void 0!==n[e]?n[e]:"")+"|"+m.license[e]+"|\n":m.table+="|"+e+"|{color:red}"+(void 0!==n[e]?n[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){t.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,t,n,a,i){var s=this;s.errors=[],s.license=angular.copy(n),s.licenseKey,s.updateLicense=function(){return a.license.update({id:1,key:s.licenseKey}).$promise.then(function(e){e&&(e.demo?t.error({title:"License update failed!",msg:"Invalid license key"}):t.success({title:"License properly updated!",msg:"The license has been updated!"}))}).catch(function(e){t.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,t,n,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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(p.networks,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The network will be deleted.").ariaLabel("Delete Network").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v){var h=this;h.license=p,h.setting=g,h.currentUser=u.getCurrentUser(),h.networks=l||{count:0,rows:[]},h.table="networks",h.listOrder="",h.listOrderAsc=null,h.selectedNetworks=[],h.query={fields:"createdAt,updatedAt,id,type,value",sort:"-updatedAt",limit:10,page:1},h.arraytype=_.keyBy([{option:"LocalNET",value:"'localnet'"},{option:"ExternIP",value:"'externip'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),h.editdialog=function(e,t){i.show({controller:"CreateOrEditNetworkDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/networks/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{network:e,networks:h.networks.rows,license:h.license,setting:null,crudPermissions:h.crudPermissions}})},h.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){A(e)},function(){console.log("CANCEL")})},h.success=E,h.getNetworks=function(){h.query.offset=(h.query.page-1)*h.query.limit,u.hasRole("admin")?h.promise=d.network.get(h.query,E).$promise:(h.query.id=h.userProfile.id,h.query.section="Networks",h.promise=d.userProfile.getResources(h.query,E).$promise)},h.createOrEditNetwork=function(e,t){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:t,networks:h.networks.rows,license:h.license,setting:h.setting,crudPermissions:h.crudPermissions}})},h.deleteNetwork=A,h.exportSelectedNetworks=function(){var e=angular.copy(h.selectedNetworks);return h.selectedNetworks=[],e},h.deleteSelectedNetworks=function(e){var t=i.confirm().title("Are you sure want to delete the selected networks?").htmlContent("<b>"+h.selectedNetworks.length+" selected</b> will be deleted.").ariaLabel("delete Networks").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){h.selectedNetworks.forEach(function(e){A(e)}),h.selectedNetworks=[]})},h.deselectNetworks=function(){h.selectedNetworks=[]},h.selectAllNetworks=function(){h.selectedNetworks=h.networks.rows};var f=!0,b=1;function E(e){h.networks=e||{count:0,rows:[]}}function A(e){d.network.delete({id:e.id}).$promise.then(function(){_.remove(h.networks.rows,{id:e.id}),h.networks.count-=1,h.networks.rows.length||h.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){h.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEnetwork"}];for(var t=0;t<e.data.errors.length;t++)m.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){f?o(function(){f=!1}):(t||(b=h.query.page),e!==t&&(h.query.page=1),e||(h.query.page=b),h.getNetworks())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","networks","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.settings").controller("NetworksController",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(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_SMTP",g.smtp=angular.copy(l),g.smtps=r,g.newSmtp=!1,g.smtp||(g.smtp={service:!0},g.title="SETTINGS.NEW_SMTP",g.newSmtp=!0),g.addNewSmtp=function(){g.errors=[],d.mailAccount.save(g.smtp).$promise.then(function(e){g.smtps.unshift(e.toJSON()),o.success({title:"Smtp properly created",msg:g.smtp.name?g.smtp.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.mailAccount.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSmtp=function(){g.errors=[],d.mailAccount.update({id:g.smtp.id},g.smtp).$promise.then(function(e){var t=_.find(g.smtps,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"Smtp properly saved!",msg:g.smtp.name?g.smtp.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.mailAccount.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSmtp=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The smtp will be deleted.").ariaLabel("Delete Smtp").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.mailAccount.delete({id:g.smtp.id}).$promise.then(function(){_.remove(g.smtps,{id:g.smtp.id}),o.success({title:"Smtp properly deleted!",msg:(g.smtp.name||"smtp")+" has been deleted!"}),v(g.smtp)}).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.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.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","smtps","smtp","api","Auth","license","setting","crudPermissions"],angular.module("app.settings").controller("CreateOrEditSmtpDialogController",e)}(),function(){"use strict";function e(e,t,n,a,i){var s=this;s.currentUser=i.getCurrentUser(),s.license=a,s.smtps=e,s.smtp={},s.smtps&&s.smtps.rows&&s.smtps.rows.length?s.smtp=s.smtps.rows[0]:s.smtp={service:!0,Smtp:{service:null}},s.saveSmtp=function(){s.smtp.id?t.mailAccount.update({id:s.smtp.id},s.smtp).$promise.then(function(){n.success({title:"Smtp updated!",msg:s.smtp.name?s.smtp.name+" has been updated!":""})}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data):e.toString()})}):t.mailAccount.save(s.smtp).$promise.then(function(e){_.merge(s.smtp,e),n.success({title:"Smtp updated!",msg:s.smtp.name?s.smtp.name+" has been updated!":""})}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})},s.verifySmtp=function(){s.smtp.id&&t.mailAccount.verifySmtp({id:s.smtp.id}).$promise.then(function(){n.success({title:"Smtp verified!",msg:s.smtp.name?s.smtp.name+" has been verified!":""})}).catch(function(e){n.error({title:"Smtp not verified! Remember to save before to verify!",msg:e.data?JSON.stringify(e.data):e.toString(),timeout:1e4})})}}e.$inject=["smtps","api","toasty","license","Auth"],angular.module("app.settings").controller("SmtpController",e)}(),function(){"use strict";function e(e,i,s,t,n,a,o,r){var l,d=this;d.system=n||{},d.processes=a?a.rows:[],d.processLimit=7,d.selectedTab=t.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,t,n){var a=s.confirm().title("Would you like to change the status of the process #"+t+"?").textContent("The status will be changed to: "+n.toUpperCase()).ariaLabel("Lucky day").targetEvent(e).ok("Ok").cancel("Cancel");s.show(a).then(function(){return r.pm2.update({id:t,status:n})}).then(function(){i(d.getProcesses,1e3,1)}).then(function(){o.success({title:"Process updated!",msg:"Status properly changed to: "+n})})},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,t,n,a,i){var s=this;s.title="SETTINGS.UPDATE",s.progress=0,s.updating=!0,s.output="Waiting...",s.success=!0,s.interval=t(function(){s.progress<90&&(s.progress+=1)},1e3),s.closeDialog=function(){e.hide()},s.reload=function(){n.location.reload()},s.stopInterval=function(){angular.isDefined(s.interval)&&(t.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(n,e,a,t,i){this.version=t||{},this.updateConfirm=function(e){var t=n.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");n.show(t).then(function(){n.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,o,t,n,a,i,s,r,l,d,c,m,u,p,g,v,h,f){var b=this,E=["userpic","online","lastLoginAt","lastPauseAt","pauseType","lastPauseAt","internal","address","chatPause","openchannelPause","mailPause","smsPause","faxPause","voicePause","chatCapacity","openchannelCapacity","mailCapacity","smsCapacity","faxCapacity","chatCurrentCapacity","openchannelCurrentCapacity","mailCurrentCapacity","smsCurrentCapacity","faxCurrentCapacity","chatStatus","openchannelStatus","mailStatus","smsStatus","faxStatus","voiceStatus","chatStatusTime","openchannelStatusTime","mailStatusTime","smsStatusTime","faxStatusTime","voiceStatusTime","queue","destconnectedlinenum","onhold"],A=["chatPause","openchannelPause","mailPause","smsPause","faxPause","voicePause","online"];for(var y in b.currentUser=v.getCurrentUser(),b.availableStates=["ringing","inuse","busy","onhold","not_inuse"],b.pauses=s||{count:0,rows:[]},b.license=h,b.userProfile=p,b.userProfileSection=g&&1==g.count?g.rows[0]:null,b.crudPermissions=v.parseCrudPermissions(b.userProfileSection?b.userProfileSection.crudPermissions:null),b.agents=r?_.keyBy(r.rows?r.rows:[],"id"):{},b.rpcAgents=l?_.keyBy(l.rows?l.rows:[],"id"):{},b.paginatedAgents={},b.load=!1,b.order=[],b.agentInternal={},b.agents)b.agents.hasOwnProperty(y)&&(b.agents[y].init=!0);b.query={limit:10,page:1,order:"fullname",globalStatusFilter:"",pauseTypeFilter:""},b.logout=function(e,t){return d.user.logout({id:e.id,device:"realtime",agent_id:e.id,agent_name:e.name}).$promise.then(function(){m.success({title:"Agent logout",msg:e.fullname+"  properly logout"}),b.agents[e.id]&&(b.agents[e.id].online=!1),b.rpcAgents[e.id]&&(b.rpcAgents[e.id].online=!1),T()}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.queueAdd=function(e,t){n.show({controller:"AgentqueueaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/queueadd/queueadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{agent:e,agents:[],channel:"sms",direction:"inbound",crudPermissions:b.crudPermissions}})},b.pause=function(t,e){return d.user.pause({id:t.id,type:e}).$promise.then(function(e){b.agents[t.id]&&_.merge(b.agents[t.id],_.pick(e,E)),b.rpcAgents[t.id]&&_.merge(b.rpcAgents[t.id],_.pick(e,E)),O(b.agents[t.id])}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.unPause=function(t){return d.user.unpause({id:t.id}).$promise.then(function(e){b.agents[t.id]&&_.merge(b.agents[t.id],_.pick(e,E)),b.rpcAgents[t.id]&&_.merge(b.rpcAgents[t.id],_.pick(e,E)),O(b.agents[t.id])}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.showInfo=function(e){n.show(n.alert().clickOutsideToClose(!0).title("Legend").htmlContent("<div>TODO legend status + state</div>").ok("Ok").targetEvent(e))},b.getAgentStatus=w,b.getAgentGlobalStatus=O,b.isPause=I,b.checkPause=function(e){return"pause"===e},b.isPartialPause=function(e){return"*pause"===e},b.onSave=function(e){b.agents[e.id]&&(_.merge(b.agents[e.id],_.pick(_.omit(e,A),E)),_.merge(b.rpcAgents[e.id],_.pick(_.omit(e,A),E)),O(b.agents[e.id]))},b.onUpdate=function(e){b.agents[e.id]&&(_.merge(b.agents[e.id],_.pick(e,E)),_.merge(b.rpcAgents[e.id],_.pick(e,E)),e.lastPauseAt&&(b.agents[e.id].globalStatusTime=e.lastPauseAt,b.rpcAgents[e.id].globalStatusTime=e.lastPauseAt),O(b.agents[e.id]))},b.onInit=T,b.onConnect=function(e){b.agents[b.agentInternal[e.destaccountcode]]&&(_.merge(b.agents[b.agentInternal[e.destaccountcode]],_.pick(e,["queue","destconnectedlinenum"])),_.merge(b.rpcAgents[b.agentInternal[e.destaccountcode]],_.pick(e,["queue","destconnectedlinenum"])))},b.onComplete=function(e){b.agents[b.agentInternal[e.destaccountcode]]&&(b.agents[b.agentInternal[e.destaccountcode]]=_.omit(b.agents[b.agentInternal[e.destaccountcode]],["queue","destconnectedlinenum"]),b.rpcAgents[b.agentInternal[e.destaccountcode]]=_.omit(b.rpcAgents[b.agentInternal[e.destaccountcode]],["queue","destconnectedlinenum"]))},c.on("user:save",b.onSave),c.on("user:update",b.onUpdate),c.on("user:agentconnect",b.onConnect),c.on("user:agentcomplete",b.onComplete),T();var S=f(function(){b.load&&(b.load=!1,T())},999);function T(e){b.load=!1;var t,n,a=o.defer();b.promise=a.promise,b.filteredAgents=[],b.order=[],_.forIn(b.agents,function(e,t){b.rpcAgents[t]&&_.merge(e,_.pick(_.omit(b.rpcAgents[t],A),E)),O(e),e.online?(b.filteredAgents.push(e),b.agentInternal[e.internal]=t):e.globalStatusTime=_.toNumber(moment().format("x"))}),b.query.globalStatusFilter&&_.remove(b.filteredAgents,function(e){return e.globalStatus!==b.query.globalStatusFilter}),b.query.pauseTypeFilter&&_.remove(b.filteredAgents,function(e){return e.pauseType!==b.query.pauseTypeFilter}),b.query.filter&&_.remove(b.filteredAgents,function(e){return e.fullname.toLowerCase().indexOf(b.query.filter.toLowerCase())<0}),b.filteredAgents=(t=b.filteredAgents,n=_.startsWith(b.query.order,"-")?"desc":"asc",_.orderBy(t,[b.query.order.replace("-","")],[n]));var i=(b.query.page-1)*b.query.limit;b.paginatedAgents=_.drop(b.filteredAgents,i).slice(0,b.query.limit);for(var s=0;s<b.paginatedAgents.length;s+=1)b.order.push(b.paginatedAgents[s].id);a.resolve(),b.load=!0}function I(e){return"pause"===e||"*pause"===e}function C(e){return"idle"===e||"unknown"===e||"unavailable"===e||"ringing"===e||_.isNil(e)}function w(e,t){return"voice"===t?"idle"!==e[t+"Status"]?e[t+"Status"]:e[t+"Pause"]?e[t+"Status"]="pause":"idle":e[t+"Pause"]?e[t+"Status"]="pause":e[t+"Status"]}function O(e){var t="unknown";t=_.every([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],I)?"pause":_.some([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],I)?"*pause":_.every([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],C)?"idle":"busy",e.globalStatus!==t&&(e.globalStatus=t,e.init?(e.init=!1,e.globalStatusTime=I(t)?_.toNumber(moment(e.lastPauseAt).format("x")):_.max([e.voiceStatusTime,e.chatStatusTime,e.mailStatusTime,e.smsStatusTime,e.openchannelStatusTime,e.faxStatusTime])):e.globalStatusTime=_.toNumber(moment().format("x")))}e.$on("$destroy",function(){c.removeAllListeners("user:save"),c.removeAllListeners("user:update"),c.removeAllListeners("user:agentconnect"),c.removeAllListeners("user:agentcomplete"),S&&(f.cancel(S),S=null)})}e.$inject=["$scope","$q","$timeout","$mdDialog","$document","$filter","pauses","agents","rpcAgents","api","socket","toasty","helperClasses","userProfile","userProfileSection","Auth","license","$interval"],angular.module("app.voice").controller("AgentsSmsRealtimeController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this,v=["loggedIn","available","waiting","talking","pTalking","originated","message","dialActive","dialMethod","Trunk","paused"];function h(){var n=[];return _.forIn(g.queues,function(e,t){e.paused=0,e.loggedInDb=0,g.queues[t].agents={},n.push(l.smsQueue.getMembers({id:t}).$promise),g.rpcQueues[t]&&_.merge(e,_.pick(g.rpcQueues[t],v))}),t.all(n).then(function(e){for(var t=0;t<e.length;t+=1)for(var n=0;n<e[t].rows.length;n++)e[t].rows[n].paused&&g.queues[e[t].rows[n].SmsQueueId].paused++,g.queues[e[t].rows[n].SmsQueueId].loggedInDb++,g.queues[e[t].rows[n].SmsQueueId].agents[e[t].rows[n].UserId]=e[t].rows[n].SmsQueueId}).catch(function(e){console.error(e)})}g.currentUser=p.getCurrentUser(),g.count=o.count?o.count:0,g.queues=o?_.keyBy(o.rows?o.rows:[],"id"):{},g.rpcQueues=r?_.keyBy(r.rows?r.rows:[],"id"):{},g.userProfile=m,g.userProfileSection=u&&1==u.count?u.rows[0]:null,g.crudPermissions=p.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),p.hasRole("admin")?g.query={type:"inbound",sort:"-updatedAt",limit:10,page:1}:g.query={id:g.currentUser.id,channel:"sms",type:"inbound",sort:"-updatedAt",limit:10,page:1},g.success=E,g.getQueues=function(){g.query.offset=(g.query.page-1)*g.query.limit,p.hasRole("admin")?g.promise=l.smsQueue.get(g.query,E).$promise:(g.query.id=g.userProfile.id,g.query.section="SmsQueues",g.promise=l.userProfile.getResources(g.query,E).$promise)},g.createOrEditSmsQueue=function(e,t){a.show({controller:"CreateOrEditSmsQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsQueue:t,smsQueues:_.values(g.queues),license:null,setting:null,crudPermissions:g.crudPermissions}})},g.agentAdd=function(e,t){a.show({controller:"SmsQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsQueue:t,smsQueues:g.queues?g.queues.rows:[],realtime:!1,crudPermissions:g.crudPermissions}})},g.updateQueue=function(e){return l.smsQueue.update(e).$promise.then(function(){c.success({title:"Queue properly updated!",msg:e.name?e.name+" has been updated!":""})}).catch(function(e){c.error({title:"Error creating queue!",msg:e.message})})},g.onSave=function(e){g.queues[e.id]&&_.merge(g.queues[e.id],_.pick(e,v))},g.onSaveMember=function(e){g.queues[e.SmsQueueId]&&g.queues[e.SmsQueueId].loggedInDb++},g.onRemoveMember=function(e){g.queues[e.SmsQueueId]&&g.queues[e.SmsQueueId].loggedInDb--},g.onPause=function(n){console.log("onPause",n),n.voicePause?_.forIn(g.queues,function(e,t){e.agents[n.id]&&(e.paused+=1,console.log("pause"))}):n.voicePause||_.forIn(g.queues,function(e,t){e.agents[n.id]&&0<e.paused&&(e.paused-=1,console.log("unpause"))})},g.onLogin=function(e){console.log("onLogged",e),g.queues[e.SmsQueueId]&&(g.queues[e.SmsQueueId].loggedInDb+=1,g.queues[e.SmsQueueId].agents[e.UserId]=e.SmsQueueId)},g.onLogout=function(e){console.log("onLogout",e),g.queues[e.SmsQueueId]&&0<g.queues[e.SmsQueueId].loggedInDb&&(g.queues[e.SmsQueueId].loggedInDb-=1,delete g.queues[e.SmsQueueId].agents[e.UserId])},g.$onInit=h,g.order=[],_.forIn(g.queues,function(e,t){g.order.push(e.id)}),d.on("sms_queue:save",g.onSave),d.on("userSmsQueue:save",g.onSaveMember),d.on("userSmsQueue:remove",g.onRemoveMember),d.on("user:update",g.onPause),d.on("userVoiceQueue:remove",g.onLogout),d.on("userVoiceQueue:save",g.onLogin);var f=!0,b=1;function E(e){if(g.count=e.count,g.queues=e?_.keyBy(e.rows?e.rows:[],"id"):{},e.rows){g.order=[];for(var t=0;t<e.rows.length;t++)g.order.push(e.rows[t].id)}h()}e.$watch("vm.query.filter",function(e,t){f?n(function(){f=!1}):(t||(b=g.query.page),e!==t&&(g.query.page=1),e||(g.query.page=b),g.getQueues())}),e.$on("$destroy",function(){d.removeAllListeners("sms_queue:save"),d.removeAllListeners("userSmsQueue:remove"),d.removeAllListeners("userSmsQueue:save"),d.removeAllListeners("user:update"),d.removeAllListeners("userVoiceQueue:remove"),d.removeAllListeners("userVoiceQueue:save")})}e.$inject=["$scope","$timeout","$mdDialog","$q","$document","$interval","queues","rpcQueues","api","socket","toasty","userProfile","userProfileSection","Auth"],angular.module("app.sms").controller("QueuesSmsRealtimeController",e)}(),function(){"use strict";angular.module("app.auth").factory("helperClasses",function(){return{status:{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"},state:{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"},channelStatus:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},channelStatusOut:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"}}})}(),function(){"use strict";function e(e,n,t){switch(t.disconnect(),t.connect(),this.selectedTab=0,n.current.name){case"app.sms.realtime.agents":this.selectedTab=0;break;case"app.sms.realtime.queues":this.selectedTab=1;break;default:this.selectedTab=0,n.go("app.sms.realtime.agents")}e.$watch("vm.selectedTab",function(e,t){if(e!==t)switch(e){case 0:n.go("app.sms.realtime.agents");break;case 1:n.go("app.sms.realtime.queues");break;default:n.go("app.sms.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.sms").controller("SmsRealtimeController",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(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:n.protocol()+"://"+n.host()+(n.port()?":"+n.port():""),type:"twilio",waitForTheAssignedAgent:10,notificationSound:!0,queueTransferTimeout:300,agentTransferTimeout:300},g.title="SMS.NEW_SMSACCOUNT",g.newSmsAccount=!0),t.params.id&&(g.smsAccount.SmsAccountId=t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.smsAccounts,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The smsAccount will be deleted.").ariaLabel("Delete SmsAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.lists,{id:e.resourceId})}),n=null;if(g.smsAccount&&(n=_.find(g.lists,{id:Number(g.smsAccount.ListId)})),n&&!_.some(t,["id",n.id])){var a=_.find(g.lists,{id:n.id});a.canSelect=!1,t.push(a)}g.lists=t})}else{var n=[],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,n.push(g.lists[i]));g.lists=n}}).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 t(e,t){if(r.smsAccountApps.rows.length){var n=r.smsAccountApps.rows[t]?r.smsAccountApps.rows[t]:r.smsAccountApps.rows[0];i.show({controller:"EditSmsAccountApp"+(n.appType||n.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/apps/"+(n.appType||n.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsAccountApp:n,smsAccount:r.smsAccount,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.smsAccountApps.rows[t]=e:r.smsAccountApps.rows.splice(t,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,t=[],n=0;n<r.smsAccountApps.rows.length;n++,0){var a=r.smsAccountApps.rows[n],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,t=_.concat(t,i,[a],s)}o.smsAccount.addApplications({id:r.smsAccount.id},_.sortBy(t,"priority")).$promise.then(function(e){r.smsAccountApps.rows=e.rows}).catch(function(e){console.error(e)})}function n(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:"1"},{option:"Always",value:"0"}],required:!0,param:0},{title:"Text",name:"text",type:"textarea",maxlength:255,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){t(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,t){r.smsAccount=e,r.crudPermissions=void 0!==t?t:{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,t,n){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(n).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.smsAccountApps.rows.splice(t,1),l()},function(){console.log("CANCEL")})},r.getSmsAccountApps=function(){r.promise=o.smsAccount.getApplications(r.query,n).$promise},r.editSmsAccountApp=t,r.editInterval=function(e,t){if(r.smsAccountApps.rows.length){var n=r.smsAccountApps.rows[t]?r.smsAccountApps.rows[t]: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:n.interval,IntervalId:n.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(n.interval=e.interval||"*,*,*,*",n.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 t=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(t).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,t,n,o,r,l,d){var c=this;function m(){return a(function(n,t){return a(function(t,n){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.smsAccount.getAgents({id:c.smsAccount.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return t.penalty=e.UserSmsAccount?"penalty "+e.UserSmsAccount.penalty:"",t.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=l.getCurrentUser(),c.smsAccount=t,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(n,t){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.smsAccount.removeAgents({id:c.smsAccount.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.smsAccount.addAgents({id:c.smsAccount.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,items:[],selectedItems:[],showSelectAndDeselectAll:!o,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("SMS.ALL_AGENTS"),labelSelected:r.instant("SMS.SELECTED_AGENTS"),transferCallback:function(e,t){var n=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(n)}}}e.$inject=["$mdDialog","$q","toasty","api","smsAccount","smsAccounts","realtime","$translate","Auth","crudPermissions"],angular.module("app.sms").controller("SmsAccountagentaddController",e)}(),function(){"use strict";function e(t,e,n,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"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){t.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 t=_.find(l.agents,{name:l.agent.agent});t&&(l.agent.UserId=t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),n=null;if(l.agent&&(n=_.find(l.agents,{name:l.agent.agent})),n&&!_.some(t,["id",n.id])){var a=_.find(l.agents,{id:n.id});a.canSelect=!1,t.push(a)}l.agents=t})}else{var n=[],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,n.push(l.agents[i]));l.agents=n}}).catch(function(e){n.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(t,e,n,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"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){t.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(t,e,n,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"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){t.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(t,e,n,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"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){t.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(t,e,n,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"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){t.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,t,n,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 E(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var t=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),n=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(t+"-"+n)}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 A(e){t.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=E(),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!":""}),A()}).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=E(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),A(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var t=_.find(c.intervals,{id:e.id});t&&_.merge(t,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),A()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=A,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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=e&&e.rows?e.rows:[],n=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(t,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,n.push(e))}),c.intervals=n})}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(t,e,n,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"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){t.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(t,e,n,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"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){t.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 t=_.find(l.queues,{name:l.queue.queue});t&&(l.queue[_.capitalize("sms")+"QueueId"]=t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),n=null;if(l.queue&&(n=_.find(l.queues,{name:l.queue.queue})),n&&!_.some(t,["id",n.id])){var a=_.find(l.queues,{id:n.id});a.canSelect=!1,t.push(a)}l.queues=t})}else{var n=[],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,n.push(l.queues[i]));l.queues=n}}).catch(function(e){n.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(t,e,n,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"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){t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),n=null;if(l.system&&(n=_.find(l.variables,{name:l.system.variable})),n&&!_.some(t,["id",n.id])){var a=_.find(l.variables,{id:n.id});a.canSelect=!1,t.push(a)}l.variables=t})}else{var n=[],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,n.push(l.variables[i]));l.variables=n}}).catch(function(e){n.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(t,e,n,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"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){t.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 t=_.find(l.tags,{name:l.tag.tag});t&&(l.tag.TagId=t.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){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),n=null;if(l.tag&&(n=_.find(l.tags,{name:l.tag.tag})),n&&!_.some(t,["id",n.id])){var a=_.find(l.tags,{id:n.id});a.canSelect=!1,t.push(a)}l.tags=t})}else{var n=[],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,n.push(l.tags[i]));l.tags=n}}).catch(function(e){n.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,t,n,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.smsAccount={},c.smsAccountInteractions={count:0,rows:[]},c.selectedSmsAccountInteractions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,Contact.firstName,Owner.name,closedAt,disposition,note,UserId,ContactId,SmsAccountId,tag",sort:"-createdAt",includeAll:"true",limit:10,page:1},c.init=function(e,t){c.smsAccount=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.smsAccount.id,c.getSmsAccountInteractions()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.smsInteractionDownload=function(s,e,t){return l.smsInteraction.download({id:s.id,exists:!0,attachments:t}).$promise.then(function(e){var t=[e.buffer],n="interaction"+s.id,a=new Blob(t,{type:e.type});n="sms-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.success=p,c.getSmsAccountInteractions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.smsAccount.getInteractions(c.query,p).$promise},c.createOrEditSmsAccountInteraction=function(e,t){s.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/interactions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsAccount:c.smsAccount,interaction:t,interactions:c.smsAccountInteractions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.spysmsInteraction=function(e,n){s.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,t){e.vm.init({id:1,channel:"sms",interaction:n,spy:!0},a.$parent.vm.setting)}})},c.exportSelectedSmsAccountInteractions=function(){var e=angular.copy(c.selectedSmsAccountInteractions);return c.selectedSmsAccountInteractions=[],e},c.deleteSmsAccountInteraction=g,c.deleteSelectedSmsAccountInteractions=function(e){var t=s.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+c.selectedSmsAccountInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedSmsAccountInteractions.forEach(function(e){g(e)}),c.selectedSmsAccountInteractions=[]})};var m=!0,u=1;function p(e){c.smsAccountInteractions=e||{count:0,rows:[]}}function g(e){l.smsInteraction.delete({id:e.id}).$promise.then(function(){_.remove(c.smsAccountInteractions.rows,{id:e.id}),c.smsAccountInteractions.count-=1,c.smsAccountInteractions.rows.length||c.getSmsAccountInteractions(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETsmsAccount"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}a.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getSmsAccountInteractions())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.sms").controller("SmsAccountInteractionsController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.smsAccount={},c.smsAccountSmsCannedAnswers={count:0,rows:[]},c.selectedSmsAccountSmsCannedAnswers=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,key,value,description",limit:10,page:1},c.init=function(e,t){c.smsAccount=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.smsAccount.id,c.query.SmsAccountId=c.smsAccount.id,c.getSmsAccountSmsCannedAnswers()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the smsCannedAnswer?").htmlContent("<b>"+(e.name||"smsCannedAnswer")+"</b> will be deleted.").ariaLabel("delete smsCannedAnswer").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getSmsAccountSmsCannedAnswers=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.smsAccount.getAnswers(c.query,p).$promise},c.createOrEditSmsAccountSmsCannedAnswer=function(e,t){s.show({controller:"CreateOrEditSmsCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/smsCannedAnswers/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsAccount:c.smsAccount,smsCannedAnswer:t,smsCannedAnswers:c.smsAccountSmsCannedAnswers.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedSmsAccountSmsCannedAnswers=function(){var e=angular.copy(c.selectedSmsAccountSmsCannedAnswers);return c.selectedSmsAccountSmsCannedAnswers=[],e},c.deleteSmsAccountSmsCannedAnswer=g,c.deleteSelectedSmsAccountSmsCannedAnswers=function(e){var t=s.confirm().title("Are you sure want to delete the selected smsCannedAnswers?").htmlContent("<b>"+c.selectedSmsAccountSmsCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete smsCannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedSmsAccountSmsCannedAnswers.forEach(function(e){g(e)}),c.selectedSmsAccountSmsCannedAnswers=[]})};var m=!0,u=1;function p(e){c.smsAccountSmsCannedAnswers=e||{count:0,rows:[]}}function g(e){l.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(c.smsAccountSmsCannedAnswers.rows,{id:e.id}),c.smsAccountSmsCannedAnswers.count-=1,c.smsAccountSmsCannedAnswers.rows.length||c.getSmsAccountSmsCannedAnswers(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETsmsAccount"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getSmsAccountSmsCannedAnswers())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.sms").controller("SmsAccountSmsCannedAnswersController",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(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),t.params.id&&(g.smsCannedAnswer.SmsAccountId=t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.smsCannedAnswers,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The smsCannedAnswer will be deleted.").ariaLabel("Delete SmsCannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.smsAccount={},c.smsAccountSmsDispositions={count:0,rows:[]},c.selectedSmsAccountSmsDispositions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,name",limit:10,page:1},c.init=function(e,t){c.smsAccount=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.smsAccount.id,c.query.SmsAccountId=c.smsAccount.id,c.getSmsAccountSmsDispositions()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the smsDisposition?").htmlContent("<b>"+(e.name||"smsDisposition")+"</b> will be deleted.").ariaLabel("delete smsDisposition").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getSmsAccountSmsDispositions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.smsAccount.getDispositions(c.query,p).$promise},c.createOrEditSmsAccountSmsDisposition=function(e,t){s.show({controller:"CreateOrEditSmsDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/smsDispositions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsAccount:c.smsAccount,smsDisposition:t,smsDispositions:c.smsAccountSmsDispositions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedSmsAccountSmsDispositions=function(){var e=angular.copy(c.selectedSmsAccountSmsDispositions);return c.selectedSmsAccountSmsDispositions=[],e},c.deleteSmsAccountSmsDisposition=g,c.deleteSelectedSmsAccountSmsDispositions=function(e){var t=s.confirm().title("Are you sure want to delete the selected smsDispositions?").htmlContent("<b>"+c.selectedSmsAccountSmsDispositions.length+" selected</b> will be deleted.").ariaLabel("delete smsDispositions").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedSmsAccountSmsDispositions.forEach(function(e){g(e)}),c.selectedSmsAccountSmsDispositions=[]})};var m=!0,u=1;function p(e){c.smsAccountSmsDispositions=e||{count:0,rows:[]}}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){_.remove(c.smsAccountSmsDispositions.rows,{id:e.id}),c.smsAccountSmsDispositions.count-=1,c.smsAccountSmsDispositions.rows.length||c.getSmsAccountSmsDispositions(),r.success({title:"SmsDisposition deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETsmsAccount"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getSmsAccountSmsDispositions())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.sms").controller("SmsAccountSmsDispositionsController",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(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_SMSDISPOSITION",g.smsDisposition=angular.copy(l),g.smsDispositions=r,g.newSmsDisposition=!1,g.smsDisposition||(g.smsDisposition={},g.title="SMS.NEW_SMSDISPOSITION",g.newSmsDisposition=!0),t.params.id&&(g.smsDisposition.SmsAccountId=t.params.id),g.addNewSmsDisposition=function(){g.errors=[],d.disposition.save(g.smsDisposition).$promise.then(function(e){g.smsDispositions.unshift(e.toJSON()),o.success({title:"SmsDisposition properly created",msg:g.smsDisposition.name?g.smsDisposition.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.disposition.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSmsDisposition=function(){g.errors=[],d.disposition.update({id:g.smsDisposition.id},g.smsDisposition).$promise.then(function(e){var t=_.find(g.smsDispositions,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"SmsDisposition properly saved!",msg:g.smsDisposition.name?g.smsDisposition.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.disposition.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSmsDisposition=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The smsDisposition will be deleted.").ariaLabel("Delete SmsDisposition").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.disposition.delete({id:g.smsDisposition.id}).$promise.then(function(){_.remove(g.smsDispositions,{id:g.smsDisposition.id}),o.success({title:"SmsDisposition properly deleted!",msg:(g.smsDisposition.name||"smsDisposition")+" has been deleted!"}),v(g.smsDisposition)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.disposition.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.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","smsDispositions","smsDisposition","api","Auth","license","setting","crudPermissions"],angular.module("app.sms").controller("CreateOrEditSmsDispositionDialogController",e)}(),function(){"use strict";function e(e,t,n,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=t.protocol()+"://"+t.host(),u.smsAccount=c||e.params.smsAccount||{},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.agentadddialog=function(e,t){n.show({controller:"SmsAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{smsAccount:e,smsAccounts:u.smsAccounts?u.smsAccounts.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoSmsAccounts=function(){e.go("app.sms.smsAccounts")},u.saveSmsAccount=function(){r.smsAccount.update({id:u.smsAccount.id},u.smsAccount).$promise.then(function(){l.success({title:"SmsAccount updated!",msg:u.smsAccount.name?u.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){u.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){u.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.lists,{id:e.resourceId})}),n=null;if(u.smsAccount&&(n=_.find(u.lists,{id:Number(u.smsAccount.ListId)})),n&&!_.some(t,["id",n.id])){var a=_.find(u.lists,{id:n.id});a.canSelect=!1,t.push(a)}u.lists=t})}else{var n=[],a=null;u.smsAccount&&(a=_.find(u.lists,{id:Number(u.smsAccount.ListId)}));for(var i=0;i<u.lists.length;i++)a&&u.lists[i].id===a.id&&(u.lists[i].canSelect=!1,n.push(u.lists[i]));u.lists=n}}).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){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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.pauses,{id:e.resourceId})});u.pauses.forEach(function(e){_.some(t,["id",e.id])||(e.canSelect=!1),t.push(e)}),u.pauses=t})}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","smsAccount","userProfileSection"],angular.module("app.sms").controller("SmsAccountController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.smsAccounts=l||{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="smsAccounts",b.listOrder="",b.listOrderAsc=null,b.selectedSmsAccounts=[],b.query={fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,type,phone,accountSid,authId,authToken,smsMethod,username,password,baseUrl,apiKey,senderString,deliveryReport,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,page:1},b.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:"CSCTelecom",value:"'csc'"},{option:"Intelepeer",value:"'intelepeer'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arraysmsMethod=_.keyBy([{option:"Basic",value:"'SI'"},{option:"Classic",value:"'TI'"},{option:"Classic+",value:"'GP'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.sms.smsAccounts.edit",{id:e.id,smsAccount:e,crudPermissions:b.crudPermissions})},b.interactionsgoto=function(e,t){n.go("app.sms.smsAccounts.edit",{id:e.id,tab:5})},b.agentadddialog=function(e,t){i.show({controller:"SmsAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{smsAccount:e,smsAccounts:b.smsAccounts?b.smsAccounts.rows:[],crudPermissions:b.crudPermissions,realtime:!1}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getSmsAccounts=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.smsAccount.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="SmsAccounts",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditSmsAccount=function(e,t){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:t,smsAccounts:b.smsAccounts.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteSmsAccount=S,b.exportSelectedSmsAccounts=function(){var e=angular.copy(b.selectedSmsAccounts);return b.selectedSmsAccounts=[],e},b.deleteSelectedSmsAccounts=function(e){var t=i.confirm().title("Are you sure want to delete the selected smsAccounts?").htmlContent("<b>"+b.selectedSmsAccounts.length+" selected</b> will be deleted.").ariaLabel("delete SmsAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedSmsAccounts.forEach(function(e){S(e)}),b.selectedSmsAccounts=[]})},b.deselectSmsAccounts=function(){b.selectedSmsAccounts=[]},b.selectAllSmsAccounts=function(){b.selectedSmsAccounts=b.smsAccounts.rows},g.hasRole("admin")?m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){b.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){b.lists=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(b.lists,{id:e.resourceId})}),n=null;if(b.smsAccount&&(n=_.find(b.lists,{id:Number(b.smsAccount.ListId)})),n&&!_.some(t,["id",n.id])){var a=_.find(b.lists,{id:n.id});a.canSelect=!1,t.push(a)}b.lists=t})}else{var n=[],a=null;b.smsAccount&&(a=_.find(b.lists,{id:Number(b.smsAccount.ListId)}));for(var i=0;i<b.lists.length;i++)a&&b.lists[i].id===a.id&&(b.lists[i].canSelect=!1,n.push(b.lists[i]));b.lists=n}}).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 E=!0,A=1;function y(e){b.smsAccounts=e||{count:0,rows:[]}}function S(e){m.smsAccount.delete({id:e.id}).$promise.then(function(){_.remove(b.smsAccounts.rows,{id:e.id}),b.smsAccounts.count-=1,b.smsAccounts.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEsmsAccount"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getSmsAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","smsAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.sms").controller("SmsAccountsController",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(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_SMSQUEUE",g.smsQueue=angular.copy(l),g.smsQueues=r,g.newSmsQueue=!1,g.smsQueue||(g.smsQueue={strategy:"beepall",timeout:10},g.title="SMS.NEW_SMSQUEUE",g.newSmsQueue=!0),g.addNewSmsQueue=function(){g.errors=[],d.smsQueue.save(g.smsQueue).$promise.then(function(e){g.smsQueues.unshift(e.toJSON()),o.success({title:"SmsQueue properly created",msg:g.smsQueue.name?g.smsQueue.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.smsQueue.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSmsQueue=function(){g.errors=[],d.smsQueue.update({id:g.smsQueue.id},g.smsQueue).$promise.then(function(e){var t=_.find(g.smsQueues,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"SmsQueue properly saved!",msg:g.smsQueue.name?g.smsQueue.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.smsQueue.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSmsQueue=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The smsQueue will be deleted.").ariaLabel("Delete SmsQueue").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.smsQueue.delete({id:g.smsQueue.id}).$promise.then(function(){_.remove(g.smsQueues,{id:g.smsQueue.id}),o.success({title:"SmsQueue properly deleted!",msg:(g.smsQueue.name||"smsQueue")+" has been deleted!"}),v(g.smsQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.smsQueue.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.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(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","smsQueues","smsQueue","api","Auth","license","setting","crudPermissions"],angular.module("app.sms").controller("CreateOrEditSmsQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,t,n,o,r,l,d){var c=this;function m(){return a(function(n,t){return a(function(t,n){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.smsQueue.getAgents({id:c.smsQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return t.penalty=e.UserSmsQueue?"penalty "+e.UserSmsQueue.penalty:"",t.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=l.getCurrentUser(),c.smsQueue=t,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(n,t){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.smsQueue.removeAgents({id:c.smsQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.smsQueue.addAgents({id:c.smsQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,items:[],selectedItems:[],showSelectAndDeselectAll:!o,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("SMS.ALL_AGENTS"),labelSelected:r.instant("SMS.SELECTED_AGENTS"),transferCallback:function(e,t){var n=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(n)}}}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,t,n,o,r){var l=this;function d(){return a(function(n,t){return a(function(t,n){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:l.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return l.allowedItems=_.map(t,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.startingAllowedItems=angular.copy(l.allowedItems),l.items.forEach(function(e){var t=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.smsQueue.getTeams({id:l.smsQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];l.selectedItems=_.map(t,function(e){return _.find(l.items,{id:e.id})}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}l.currentUser=o.getCurrentUser(),l.smsQueue=t,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={readOnly:!l.crudPermissions.canEdit,allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!0,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:n.instant("SMS.ALL_TEAMS"),labelSelected:n.instant("SMS.SELECTED_TEAMS"),transferCallback:function(e,t){var n=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(n)}},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(n,t){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.smsQueue.removeTeams({id:l.smsQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.smsQueue.addTeams({id:l.smsQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},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,t,n,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=t.protocol()+"://"+t.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,t){n.show({controller:"SmsQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{smsQueue:e,smsQueues:u.smsQueues?u.smsQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,t){n.show({controller:"SmsQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:t,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")},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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.smsQueues=l||{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="smsQueues",b.listOrder="",b.listOrderAsc=null,b.selectedSmsQueues=[],b.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"sms",limit:10,page:1},b.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.sms.smsQueues.edit",{id:e.id,smsQueue:e,crudPermissions:b.crudPermissions})},b.teamadddialog=function(e,t){i.show({controller:"SmsQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{smsQueue:e,smsQueues:b.smsQueues?b.smsQueues.rows:[],crudPermissions:b.crudPermissions}})},b.agentadddialog=function(e,t){i.show({controller:"SmsQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{smsQueue:e,smsQueues:b.smsQueues?b.smsQueues.rows:[],crudPermissions:b.crudPermissions,realtime:!1}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.gotorealtimegoto=function(e,t){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:710}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.sms.realtime.queues",{})}},b.success=y,b.getSmsQueues=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.smsQueue.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="SmsQueues",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditSmsQueue=function(e,t){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:t,smsQueues:b.smsQueues.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteSmsQueue=S,b.exportSelectedSmsQueues=function(){var e=angular.copy(b.selectedSmsQueues);return b.selectedSmsQueues=[],e},b.deleteSelectedSmsQueues=function(e){var t=i.confirm().title("Are you sure want to delete the selected smsQueues?").htmlContent("<b>"+b.selectedSmsQueues.length+" selected</b> will be deleted.").ariaLabel("delete SmsQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedSmsQueues.forEach(function(e){S(e)}),b.selectedSmsQueues=[]})},b.deselectSmsQueues=function(){b.selectedSmsQueues=[]},b.selectAllSmsQueues=function(){b.selectedSmsQueues=b.smsQueues.rows};var E=!0,A=1;function y(e){b.smsQueues=e||{count:0,rows:[]}}function S(e){m.smsQueue.delete({id:e.id}).$promise.then(function(){_.remove(b.smsQueues.rows,{id:e.id}),b.smsQueues.count-=1,b.smsQueues.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEsmsQueue"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getSmsQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","smsQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.sms").controller("SmsQueuesController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.agents=l||{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="agents",b.listOrder="",b.listOrderAsc=null,b.selectedAgents=[],b.query={fields:"createdAt,updatedAt,id,role,fullname,name,alias,showWebBar,email,phone,mobile,userpic,password,hotdesk,autointernal,internal,loginInPause,description,dtlscertfile,dtlsprivatekey,voicemail,transport,host,nat,type,allow,callerid,context,callgroup,pickupgroup,chanspy,videosupport,extensionMonitor,chatCapacity,mailCapacity,faxCapacity,smsCapacity,openchannelCapacity,phoneBarEnableSettings,phoneBarAutoAnswer,phoneBarAutoAnswerDelay,phoneBarRingInUse,phoneBarEnableRecording,phoneBarEnableDtmfTone,phoneBarDnd,phoneBarUnansweredCallBadge,phoneBarEnableJaws,phoneBarOutboundProxy,phoneBarUnconditional,phoneBarUnconditionalNumber,phoneBarRemoteControl,phoneBarRemoteControlPort,phoneBarExpires,phoneBarListenPort,permissions,allowmessenger,phoneBarPrefixRequired,passwordResetAt,phoneBarEnableVideoRecording",role:"agent",sort:"-updatedAt",limit:10,page:1},b.arrayshowWebBar=_.keyBy([{option:"Phonebar",value:"0"},{option:"External",value:"1"},{option:"WebRTC",value:"2"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arraytransport=_.keyBy([{option:"udp",value:"'udp'"},{option:"tcp",value:"'tcp'"},{option:"ws",value:"'ws'",ngIf:"vm.agent.showWebBar == 1"},{option:"wss",value:"'wss'",ngIf:"vm.agent.showWebBar == 1"},{option:"tls",value:"'tls'",ngIf:"vm.agent.showWebBar == 1"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.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"),"")}),b.arraytype=_.keyBy([{option:"Friend",value:"'friend'"},{option:"User",value:"'user'"},{option:"Peer",value:"'peer'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.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"),"")}),b.arrayvideosupport=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Always",value:"'always'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arrayextensionMonitor=_.keyBy([{option:"Inactive",value:"''"},{option:"wav",value:"'wav'"},{option:"wav49",value:"'WAV'"},{option:"gsm",value:"'gsm'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.staff.agents.edit",{id:e.id,agent:e,crudPermissions:b.crudPermissions})},b.teamadddialog=function(e,t){i.show({controller:"AgentteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{agent:e,agents:b.agents?b.agents.rows:[],crudPermissions:b.crudPermissions}})},b.deleteconfirm=function(e,t){var n=i.confirm().title("Are you sure want to delete the "+_.startCase("agent")+"?").htmlContent("<b>"+(e.name||"agent")+"</b> will be deleted.").ariaLabel("delete agent").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getAgents=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.user.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Agents",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditAgent=function(e,t){i.show({controller:"CreateOrEditAgentDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{agent:t,agents:b.agents.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteAgent=S,b.exportSelectedAgents=function(){var e=angular.copy(b.selectedAgents);return b.selectedAgents=[],e},b.deleteSelectedAgents=function(e){var t=i.confirm().title("Are you sure want to delete the selected agents?").htmlContent("<b>"+b.selectedAgents.length+" selected</b> will be deleted.").ariaLabel("delete Agents").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedAgents.forEach(function(e){S(e)}),b.selectedAgents=[]})},b.deselectAgents=function(){b.selectedAgents=[]},b.selectAllAgents=function(){b.selectedAgents=b.agents.rows};var E=!0,A=1;function y(e){b.agents=e||{count:0,rows:[]}}function S(e){m.user.delete({id:e.id}).$promise.then(function(){_.remove(b.agents.rows,{id:e.id}),b.agents.count-=1,b.agents.rows.length||b.getAgents(),p.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEuser"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getAgents())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","agents","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.staff").controller("AgentsController",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(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_AGENT",g.agent=angular.copy(l),g.agents=r,g.newAgent=!1,g.agent||(g.agent={role:"agent",showWebBar:"0",autointernal:!0,type:"friend",context:"from-sip",phoneBarRemoteControl:!0,phoneBarRemoteControlPort:9888,allowmessenger:!0},g.title="STAFF.NEW_AGENT",g.newAgent=!0),g.addNewAgent=function(){g.errors=[],d.user.save(g.agent).$promise.then(function(e){g.agents.unshift(e.toJSON()),o.success({title:"Agent properly created",msg:g.agent.name?g.agent.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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.saveAgent=function(){g.errors=[],d.user.update({id:g.agent.id},g.agent).$promise.then(function(e){var t=_.find(g.agents,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"Agent properly saved!",msg:g.agent.name?g.agent.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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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.deleteAgent=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The agent will be deleted.").ariaLabel("Delete Agent").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.user.delete({id:g.agent.id}).$promise.then(function(){_.remove(g.agents,{id:g.agent.id}),o.success({title:"Agent properly deleted!",msg:(g.agent.name||"agent")+" has been deleted!"}),v(g.agent)}).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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","agents","agent","api","Auth","license","setting","crudPermissions"],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 t=["png","jpg"];if(!_.includes(t,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+t.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var n={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.agent.images.unshift(n),!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(t,e){if(t.id===a.uniqueIdentifier){var n=new FileReader;n.readAsDataURL(t.file.file),n.onload=function(e){t.url=e.target.result},t.type="image"}})},i.init=function(e,t){i.agent=angular.copy(e),i.crudPermissions=void 0!==t?t:{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(e,t,n,a,i,s){var o=this;function r(){e.hide()}o.currentUser=s.getCurrentUser(),o.errors=[],o.setting=i,o.passwordPattern=o.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",o.agent=a,o.password="",o.oldPassword="",o.savePassword=function(){o.errors=[];var e={id:o.agent.id,newPassword:o.password};o.currentUser.id==o.agent.id&&(e.oldPassword=o.oldPassword);n.user.changePassword(e).$promise.then(function(){t.success({title:"Agent password properly updated!"}),r()}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.agent.save",msg:e.data?JSON.stringify(e.data.message):e.toString()}),o.errors=e.data.errors||[{message:e.toString(),type:"api.agent.changePassword"}]})},o.closeDialog=r}e.$inject=["$mdDialog","toasty","api","agent","setting","Auth"],angular.module("app.staff").controller("AgentchangepasswordController",e)}(),function(){"use strict";function e(e,t,i,n,s){var o=this;o.agent={},o.navigation=n.getNavigation(),o.crudPermissions,o.init=function(e,t){o.agent=e,o.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1}},o.onChange=function(t,n){if((n||t).enabled){if(n)n.enabled=!0,o.agent.permissions.push(n.id);else for(var e=0;e<t.children.length;e++)t.children[e].enabled=!0,o.agent.permissions.push(t.children[e].id);t.enabled=!0,o.agent.permissions.push(t.id)}else if(n)n.enabled=!1,_.remove(o.agent.permissions,function(e){return n.id===e}),_.filter(t.children,{enabled:!1}).length===t.children.length&&(t.enabled=!1,_.remove(o.agent.permissions,function(e){return t.id===e}));else{t.enabled=!1,_.remove(o.agent.permissions,function(e){return t.id===e});for(var a=0;a<t.children.length;a++)t.children[a].enabled=!1,_.remove(o.agent.permissions,function(e){return t.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,t,n,i,s,o,r){var c=this;function m(){return l(function(n,t){return l(function(t,n){return d[c.apiName].get({fields:"id,name,strategy,type",channel:"bull"===c.channel?"voice":c.channel,type:c.direction,nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],o.hasRole("admin")?e:c.section?c.section.autoAssociation?e:l(function(t,n){return d.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),l(function(t,n){return d.user.getQueues({id:c.agent.id,fields:"id,name,strategy,type,penalty",nolimit:!0,type:c.direction,channel:c.channel}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return"voice"===c.channel&&(t.penalty=void 0!==t&&void 0!==e.UserVoiceQueue?"penalty "+e.UserVoiceQueue.penalty:"penalty 0"),t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=o.getCurrentUser(),c.agent=t,c.crudPermissions=r,c.penalty=0,c.channel=n,c.direction=i,c.apiName=c.channel+"Queue",c.title=s.instant("STAFF.QUEUEADD_AGENT_"+c.channel.toUpperCase()+"_"+c.direction.toUpperCase()),c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!0,orderBy:"name",line1:"name",line2:"type",line3:"voice"===c.channel?"penalty":"",labelAll:s.instant("STAFF.ALL_QUEUES_"+c.channel.toUpperCase()+"_"+c.direction.toUpperCase()),labelSelected:s.instant("STAFF.SELECTED_QUEUES_"+c.channel.toUpperCase()+"_"+c.direction.toUpperCase()),transferCallback:function(e,t){t?e.forEach(function(e){e.penalty=void 0}):e.forEach(function(e){e.penalty="penalty "+c.penalty});var n=_.xorWith(c.startingSelectedItems,c.selectedItems,function(e,t){return e.id===t.id&&e.penalty===t.penalty});c.pendingChanges=!_.isEmpty(n)}},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(n,t){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 t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceWith(c.selectedItems,c.startingSelectedItems,function(e,t){return e.id===t.id&&e.penalty===t.penalty});return(n=e,l(function(e,t){_.isEmpty(n)?e():d.user.removeQueues({id:c.agent.id,ids:_.map(n,"id"),channel:c.channel}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return r=t,l(function(e,t){if(_.isEmpty(r))e();else if("voice"===c.channel){for(var n=[],a=_.groupBy(r,"penalty"),i=0;i<Object.keys(a).length;i++){var s=Object.keys(a)[i],o=_.filter(r,["penalty",s]);n.push(d.user.addQueues({id:c.agent.id,ids:_.map(o,"id"),channel:c.channel,penalty:_.trim(s,"penalty ")}).$promise)}l.all(n).then(function(){e()}).catch(function(e){t(e)})}else d.user.addQueues({id:c.agent.id,ids:_.map(r,"id"),channel:c.channel}).$promise.then(function(){e()}).catch(function(e){t(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 n},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,t,n,o,r){var l=this;function d(){return a(function(n,t){return a(function(t,n){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:l.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return l.allowedItems=_.map(t,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.startingAllowedItems=angular.copy(l.allowedItems),l.items.forEach(function(e){var t=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.user.getTeams({id:l.agent.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];l.selectedItems=_.map(t,function(e){return _.find(l.items,{id:e.id})}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}l.currentUser=o.getCurrentUser(),l.agent=t,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={readOnly:!l.crudPermissions.canEdit,allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!0,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:n.instant("STAFF.ALL_TEAMS"),labelSelected:n.instant("STAFF.SELECTED_TEAMS"),transferCallback:function(e,t){var n=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(n)}},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(n,t){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.user.removeTeams({id:l.agent.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.user.addTeams({id:l.agent.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},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,t,i,s,n,a,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=a,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=t.protocol()+"://"+t.host(),u.agent=c||e.params.agent||{},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.queueaddchannel=function(e,t,n,a){i.show({controller:"AgentqueueaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/queueadd/queueadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{agent:e,agents:u.agents?u.agents.rows:[],channel:t,direction:a||"inbound",crudPermissions:u.crudPermissions}})},u.teamadddialog=function(e,t){i.show({controller:"AgentteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{agent:e,agents:u.agents?u.agents.rows:[],crudPermissions:u.crudPermissions}})},u.changepassworddialog=function(e,t){i.show({controller:"AgentchangepasswordController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/changepassword/changepassword.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{agent:e,setting:o,agents:u.agents?u.agents.rows:[],crudPermissions:u.crudPermissions}})},u.alert=l.info,u.gotoAgents=function(){e.go("app.staff.agents")},u.saveAgent=function(){u.agent=_.omit(u.agent,"userpic"),r.user.update({id:u.agent.id},u.agent).$promise.then(function(){l.success({title:"Agent updated!",msg:u.agent.name?u.agent.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 t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.contexts,{id:e.resourceId})}),n=null;if(u.agent&&(n=_.find(u.contexts,{name:u.agent.context})),n&&!_.some(t,["id",n.id])){var a=_.find(u.contexts,{id:n.id});a.canSelect=!1,t.push(a)}u.contexts=t}):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","agent","userProfileSection"],angular.module("app.staff").controller("AgentController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.teams,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The team will be deleted.").ariaLabel("Delete Team").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,o,r,l,d){var c=this;function m(){return a(function(n,t){return a(function(t,n){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.team.getAgents({id:c.team.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return t.penalty=e.UserTeam?"penalty "+e.UserTeam.penalty:"",t.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=l.getCurrentUser(),c.team=t,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(n,t){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.team.removeAgents({id:c.team.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.team.addAgents({id:c.team.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,items:[],selectedItems:[],showSelectAndDeselectAll:!o,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("STAFF.ALL_AGENTS"),labelSelected:r.instant("STAFF.SELECTED_AGENTS"),transferCallback:function(e,t){var n=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(n)}}}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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.teams=l||{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="teams",b.listOrder="",b.listOrderAsc=null,b.selectedTeams=[],b.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},b.editdialog=function(e,t){i.show({controller:"CreateOrEditTeamDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/teams/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{team:e,teams:b.teams.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.agentadddialog=function(e,t){i.show({controller:"TeamagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/teams/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{team:e,teams:b.teams?b.teams.rows:[],crudPermissions:b.crudPermissions,realtime:!1}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getTeams=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.team.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Teams",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditTeam=function(e,t){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:t,teams:b.teams.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteTeam=S,b.exportSelectedTeams=function(){var e=angular.copy(b.selectedTeams);return b.selectedTeams=[],e},b.deleteSelectedTeams=function(e){var t=i.confirm().title("Are you sure want to delete the selected teams?").htmlContent("<b>"+b.selectedTeams.length+" selected</b> will be deleted.").ariaLabel("delete Teams").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedTeams.forEach(function(e){S(e)}),b.selectedTeams=[]})},b.deselectTeams=function(){b.selectedTeams=[]},b.selectAllTeams=function(){b.selectedTeams=b.teams.rows};var E=!0,A=1;function y(e){b.teams=e||{count:0,rows:[]}}function S(e){m.team.delete({id:e.id}).$promise.then(function(){_.remove(b.teams.rows,{id:e.id}),b.teams.count-=1,b.teams.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEteam"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getTeams())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","teams","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.staff").controller("TeamsController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.telephones,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The telephone will be deleted.").ariaLabel("Delete Telephone").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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(e,t,n,a,i,s){var o=this;function r(){e.hide()}o.currentUser=s.getCurrentUser(),o.errors=[],o.setting=i,o.passwordPattern=o.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",o.telephone=a,o.password="",o.oldPassword="",o.savePassword=function(){o.errors=[];var e={id:o.telephone.id,newPassword:o.password};o.currentUser.id==o.telephone.id&&(e.oldPassword=o.oldPassword);n.user.changePassword(e).$promise.then(function(){t.success({title:"Telephone password properly updated!"}),r()}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.telephone.save",msg:e.data?JSON.stringify(e.data.message):e.toString()}),o.errors=e.data.errors||[{message:e.toString(),type:"api.telephone.changePassword"}]})},o.closeDialog=r}e.$inject=["$mdDialog","toasty","api","telephone","setting","Auth"],angular.module("app.staff").controller("TelephonechangepasswordController",e)}(),function(){"use strict";function e(e,t,n,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=t.protocol()+"://"+t.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,t){n.show({controller:"TelephonechangepasswordController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/telephones/edit/changepassword/changepassword.html",parent:angular.element(a.body),targetEvent:t,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")},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 t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.contexts,{id:e.resourceId})}),n=null;if(u.telephone&&(n=_.find(u.contexts,{name:u.telephone.context})),n&&!_.some(t,["id",n.id])){var a=_.find(u.contexts,{id:n.id});a.canSelect=!1,t.push(a)}u.contexts=t}):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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.telephones=l||{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="telephones",b.listOrder="",b.listOrderAsc=null,b.selectedTelephones=[],b.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},b.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"),"")}),b.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"),"")}),b.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"),"")}),b.arrayvideosupport=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Always",value:"'always'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arrayencryption=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.staff.telephones.edit",{id:e.id,telephone:e,crudPermissions:b.crudPermissions})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getTelephones=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.user.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Telephones",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditTelephone=function(e,t){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:t,telephones:b.telephones.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteTelephone=S,b.exportSelectedTelephones=function(){var e=angular.copy(b.selectedTelephones);return b.selectedTelephones=[],e},b.deleteSelectedTelephones=function(e){var t=i.confirm().title("Are you sure want to delete the selected telephones?").htmlContent("<b>"+b.selectedTelephones.length+" selected</b> will be deleted.").ariaLabel("delete Telephones").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedTelephones.forEach(function(e){S(e)}),b.selectedTelephones=[]})},b.deselectTelephones=function(){b.selectedTelephones=[]},b.selectAllTelephones=function(){b.selectedTelephones=b.telephones.rows};var E=!0,A=1;function y(e){b.telephones=e||{count:0,rows:[]}}function S(e){m.user.delete({id:e.id}).$promise.then(function(){_.remove(b.telephones.rows,{id:e.id}),b.telephones.count-=1,b.telephones.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEuser"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getTelephones())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","telephones","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.staff").controller("TelephonesController",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(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"]},g.title="STAFF.NEW_USERPROFILE",g.newUserProfile=!0),g.addNewUserProfile=function(){g.errors=[],d.userProfile.save(g.userProfile).$promise.then(function(e){var t,n;n=[],(t=e).crudPermissions.forEach(function(e){var t;switch(e){case"r":t="READ_PERMISSION";break;case"e":t="EDIT_PERMISSION";break;case"d":t="DELETE_PERMISSION"}n.push(s.instant("STAFF."+t))}),t.selectedcrudPermissions=n.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.userProfiles,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The userProfile will be deleted.").ariaLabel("Delete UserProfile").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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(t,a,i,e,n,s,o){var r=this;function l(e){t.hide(e)}r.newUserProfile=!0,r.userProfile=angular.copy(n),r.userProfiles=s,r.title=o.instant("STAFF.CLONE_USERPROFILE"),n&&n.name&&(r.title+=": "+n.name),r.cloneUserProfile=function(){return e.userProfile.clone({id:n.id},r.userProfile).$promise.then(function(e){var t,n;n=[],(t=e).crudPermissions.forEach(function(e){var t;switch(e){case"r":t="READ_PERMISSION";break;case"e":t="EDIT_PERMISSION";break;case"d":t="DELETE_PERMISSION"}n.push(o.instant("STAFF."+t))}),t.selectedcrudPermissions=n.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 t=0;t<e.data.errors.length;t+=1)i.error({title:e.data.errors[t].type,msg:e.data.errors[t].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(n,o,r,l,d,e,t,c){var m=this;function u(e,t){switch(e.allResourcesEnabled="full"===t,t){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(t,n){var i,a;void 0!==e.channel&&_.includes(e.route,"Queue")?(a=e,l(function(t,n){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){t(e)}).catch(function(e){n(e)})})).then(function(e){t(e)}).catch(function(e){n(e)}):(i=e,l(function(a,t){switch(i.route){case"voiceExtension":var e;switch(i.title){case"InboundRoutes":e="inbound";break;case"OutboundRoutes":e="outbound";break;case"InternalRoutes":e="internal"}break;case"user":var n;switch(i.title){case"Agents":n="agent";break;case"Telephones":n="telephone";break;case"Users":n="user"}}if("Reports"===i.title){if(!i.reportType)return d.analyticDefaultReport.get({nolimit:!0}).$promise.then(function(n){d.analyticCustomReport.get({nolimit:!0}).$promise.then(function(e){var t=_.union(n.rows,e.rows);a({count:t.length,rows:t.rows})})}).catch(function(e){t(e)});switch(i.reportType){case"default":i.route="analyticDefaultReport";break;case"custom":i.route="analyticCustomReport"}}return d[i.route].get({role:n||void 0,type:e||void 0,VoiceExtensionId:e?"null":void 0,nolimit:!0}).$promise.then(function(e){a(e)}).catch(function(e){t(e)})})).then(function(e){t(e)}).catch(function(e){n(e)})})}function g(e,t,n){var a=e&&0<e.length?e[0]:null;if(!a)return n;var i,s,o=_.find(t,["sectionId",a.id]);return o?(t=_.remove(t,["sectionId",a.id]),(i=a,s=o.id,l(function(t,n){d.userProfileResource.get({sectionId:s}).$promise.then(function(t){return p(i).then(function(e){return _.differenceBy(t.rows,e.rows,"id")})}).then(function(e){_.isEmpty(e)?t():n()}).catch(function(e){n(e)})})).then(function(){return n="full",g(e.shift(),t,n)}).catch(function(e){return l.reject(e)})):void 0}function a(a){var n="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:n}).$promise.then(function(e){var t=e&&e.rows&&0<e.rows.length?e.rows:[];if("Dashboards"===a.title)return _.isEmpty(t)?"disabled":t[0].autoAssociation?"full":d.userProfileResource.get({sectionId:t[0].id,resourceId:101}).$promise.then(function(e){return(e&&e.rows?e.rows[0]:null)?"full":"partial"});var n=_.filter(a.children,function(e){return void 0!==e.permissions&&e.permissions.hidden?void 0:e});return t.length!==n.length?0===t.length?"disabled":"partial":_.every(t,["autoAssociation",!0])?"full":g(_.filter(n,function(e){return void 0===e.permissions||e.permissions.association?e:void 0}),t,"partial")}).then(function(e){a.status=u(a,e)}).catch(function(e){var t=e?"unknown":"partial";a.status=u(a,t),e&&c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GETRESOURCES("+n.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 t=(e&&1===e.rows.length?e.rows[0]:null)?"full":"disabled";a.status=u(a,t)}):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,t){m.userProfile=e,m.license=t},m.onChangeEnableAllResources=function(t){var e=void 0!==t.permissions&&!t.permissions.association,a="Marketplace"===t.title?"AppZone":t.title;if("Fully Enabled"!==t.status.name){var i=[];if(e)return i.push({category:a,sectionId:t.id,name:a,enabled:!0,crudPermissions:"red"}),d.userProfile.addSections({id:m.userProfile.id},i).$promise.then(function(){t.status=u(t,"full"),c.success({title:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_ENABLED_ALL_SUCCESS_TITLE",{sectionName:r.instant(t.translate),userProfileName:m.userProfile.name}),msg:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_ENABLED_ALL_SUCCESS_MESSAGE_NO_RESOURCES",{sectionName:r.instant(t.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 n=o.confirm({skipHide:!0}).title("Warning").textContent(r.instant("STAFF.PERMISSIONS_WARNING_ENABLE_ALL",{sectionName:r.instant(t.translate)})).ariaLabel("Warning").ok(r.instant("STAFF.CONFIRM")).cancel(r.instant("STAFF.CANCEL"));o.show(n).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(t.children,function(e){var t=!(void 0===e.permissions||!e.permissions.hidden);if(!t){var n=e.title;switch(a){case"CallySquare":n="Projects"===n?"SquareProjects":n}i.push({category:a,sectionId:e.id,name:n,enabled:!0,autoAssociation:!0,crudPermissions:_.map(m.userProfile.crudPermissions).join("")})}})}return d.userProfile.addSections({id:m.userProfile.id},i).$promise.then(function(){t.status=u(t,"full"),c.success({title:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_ENABLED_ALL_SUCCESS_TITLE",{sectionName:r.instant(t.translate),userProfileName:m.userProfile.name}),msg:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_ENABLED_ALL_SUCCESS_MESSAGE",{sectionName:r.instant(t.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()}):t.status=u(t,t.status.tag)})}else if("Fully Enabled"===t.status.name){t.status=u(t,"disabled");var s=[];switch(a){case"Settings":case"Help":s=[t.id];break;case"Dashboards":s=_.map(m.dashboardSections,function(e){return e.id});break;default:s=_.map(t.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(t.translate),userProfileName:m.userProfile.name}),msg:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_DISABLED_ALL_SUCCESS_MESSAGE",{sectionName:r.instant(t.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,t){o.show({controller:"UserProfilepermissionsmanageController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/userProfiles/edit/permissionsmanage/permissionsmanage.html",parent:angular.element(n.body),targetEvent:t,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,s,t,o,e,a,r,i,l){var d=this;function c(){var a=void 0!==d.selectedSection.pending&&d.selectedSection.pending;return s(function(n,t){o.userProfileSection.get({userProfileId:d.userProfile.id,sectionId:d.selectedSection.id}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;a||(d.selectedSection.enabled=!!t&&!!t.enabled,d.selectedSection.autoAssociation=!!t&&!!t.autoAssociation,d.selectedSection.crudPermissions=p(t?t.crudPermissions:d.userProfile.crudPermissions)),n(t)}).catch(function(e){t(e)})})}function m(){return s(function(t,n){void 0!==d.selectedSection.channel&&_.includes(d.selectedSection.route,"Queue")?s(function(t,n){var e=void 0!==d.selectedSection.channel&&"bull"===d.selectedSection.channel?"outbound":"inbound";return o[d.selectedSection.route].get({fields:"id,name,strategy,type",channel:"bull"===d.selectedSection.channel?"voice":d.selectedSection.channel,type:e,nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){t(e)}).catch(function(e){n(e)}):s(function(t,n){var e,a;if("voiceExtension"===d.selectedSection.route)switch(d.selectedSection.title){case"InboundRoutes":e="inbound";break;case"OutboundRoutes":e="outbound";break;case"InternalRoutes":e="internal"}if("user"===d.selectedSection.route)switch(d.selectedSection.title){case"Agents":a="agent";break;case"Telephones":a="telephone";break;case"Users":a="user"}if("interval"===d.selectedSection.route)var i=!0;if("Reports"===d.selectedSection.title)switch(d.selectedSection.reportType){case"default":d.selectedSection.route="analyticDefaultReport";break;case"custom":d.selectedSection.route="analyticCustomReport"}if("Dashboards"!==d.selectedSection.title)return o[d.selectedSection.route].get({role:a||void 0,type:e||void 0,VoiceExtensionId:e?"null":void 0,IntervalId:i?"null":void 0,nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)});t({count:1,rows:[{id:101,name:r.instant("DASHBOARDS.GENERAL")}]})}).then(function(e){t(e)}).catch(function(e){n(e)})})}function u(){var a=void 0!==d.selectedSection.pending&&d.selectedSection.pending,i=[];return s(function(t,n){d.loadedSection?o.userProfileResource.get({sectionId:d.loadedSection.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)}):t(null)}).then(function(e){return i=e&&e.rows?e.rows:[],"Reports"===d.selectedSection.title&&(d.associatedReports=d.associatedReports?d.associatedReports:i,i=function(e){var t=[];switch(d.selectedSection.reportType){case"default":t=_.filter(e,{type:"DefaultReports"});break;case"custom":t=_.filter(e,{type:"CustomReports"})}return t}(d.associatedReports)),void 0===d.selectedSection.permissions||d.selectedSection.permissions.association?m():{rows:[]}}).then(function(e){d.items=e.rows?_.map(e.rows,function(e){var t,n;return"Reports"===d.selectedSection.title&&(e.fullPath=(t=e.parent,n=d.treeStructure[0].text,n=function e(t,n,a){if(!a||_.isEmpty(a.children))return t;var a=_.find(a.children,function(e){return _.includes(n,e.id)?e:void 0});return t+=a?"/"+a.text:"",e(t,n,a)}(n,t,d.treeStructure[0])).replace(" ","_")),e.isValid=!0,e}):[],a||(d.selectedSection.selectedItems=_.map(i,function(e){return _.find(d.items,{id:e.resourceId})}));var t=_.differenceBy(d.selectedSection.selectedItems,d.items,"id");switch(_.isEmpty(t)||(d.selectedSection.selectedItems=_.pullAllBy(d.selectedSection.selectedItems,t,"id")),d.selectedSection.title){case"Contexts":d.selectedSection.selectedItems=_.filter(d.items,function(e){return e.defaultEntry?(e.isValid=!1,e):void 0!==_.find(i,{resourceId:e.id})?(e.isValid=!0,e):void 0});break;case"MusicOnHolds":d.selectedSection.selectedItems=_.filter(d.items,function(e){return e.defaultEntry?(e.isValid=!1,e):void 0!==_.find(i,{resourceId:e.id})?(e.isValid=!0,e):void 0});break;case"Reports":var n=function(e){var t=[];switch(d.selectedSection.reportType){case"default":t=_.filter(e,function(e){return _.startsWith(e.parent,"motion")});break;case"custom":t=_.filter(e,function(e){return _.startsWith(e.parent,"custom")})}return t}(d.allReportsSelected);d.selectedSection.selectedItems=h(d.selectedSection.selectedItems),d.selectedSection.selectedItems=_.unionBy(d.selectedSection.selectedItems,n,"parent")}d.dualMultiselectOptions.selectedItems=d.selectedSection.selectedItems,d.dualMultiselectOptions.items=_.differenceBy(d.items,d.dualMultiselectOptions.selectedItems,"id")}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET"+d.selectedSection.title.toUpperCase(),msg:e.status?JSON.stringify(e.data):e.toString()})})}function p(e){return e&&(d.selectedSection.allowEdit=!!_.includes(e,"e"),d.selectedSection.allowDelete=!!_.includes(e,"d")),function(){var e=["r"];if(d.selectedSection.allowEdit)e.push("e");else{var t=_.indexOf(e,["e"]);0<t&&d.selectedSection.crudPermissions.replace("e","")}if(d.selectedSection.allowDelete)e.push("d");else{var t=_.indexOf(e,["d"]);0<t&&d.selectedSection.crudPermissions.replace("d","")}return e}()}function g(e){var t=_.findIndex(d.subsections,function(e){return e.id==d.selectedSection.id});d.subsections[t].pending=e,v()}function v(){return d.pendingChanges=_.some(d.subsections,["pending",!0])}function h(e){var t=[];switch(d.selectedSection.reportType){case"default":t=_.remove(e,function(e){return _.startsWith(e.parent,"motion")});break;case"custom":t=_.remove(e,function(e){return _.startsWith(e.parent,"custom")})}return t}d.userProfile=e,d.penalty=0,d.section=angular.copy(l),d.title=r.instant("STAFF.PERMISSIONS_SECTION_TITLE",{sectionName:r.instant(d.section.translate)}),d.items=[],d.selectedItems=[],d.subsections=_.filter(d.section.children,function(e){return void 0!==e.permissions&&e.permissions.hidden?void 0:e}),d.dashboardSections=[{title:"Dashboards",translate:"DASHBOARDS.DASHBOARDS",id:100}],d.dashboardItems=[],"Dashboards"===d.section.title&&(d.dashboardItems=d.subsections,d.subsections=d.dashboardSections),d.selectedSection=null,d.loadedSection=null,d.closeDialog=function(e){if(d.pendingChanges){var t=n.confirm({skipHide:!0}).title("Warning").textContent(r.instant("STAFF.PERMISSIONS_WARNING_CLOSE")).ariaLabel("Warning").targetEvent(e).ok(r.instant("STAFF.CLOSE")).cancel(r.instant("STAFF.CANCEL"));n.show(t).then(function(){n.hide()})}else n.hide()},d.onChangeSection=function(){return c().then(function(e){if(d.loadedSection=e,"Reports"===d.selectedSection.title)return s(function(t,n){o.analyticTreeReport.get({}).$promise.then(function(e){d.treeReports=e.rows||[],t(d.treeReports)}).catch(function(e){n(e)})}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TREE_REPORT_STRUCTURE",msg:e.data?JSON.stringify(e.data):e.toString()})});u()}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET"+d.selectedSection.title.toUpperCase(),msg:e.status?JSON.stringify(e.data):e.toString()})})},d.onChangeVisibility=function(){d.selectedSection.enabled=!d.selectedSection.enabled,g(!0)},d.onChangeAutoAssociation=function(){if(!d.selectedSection.autoAssociation){for(var e=[],t=0;t<d.dualMultiselectOptions.items.length;t++)e.push(d.dualMultiselectOptions.items[t]),d.dualMultiselectOptions.selectedItems.push(d.dualMultiselectOptions.items[t]);d.dualMultiselectOptions.items=[],d.dualMultiselectOptions.transferCallback(e,!1)}g(!0)},d.onChangeReportType=function(){d.treeStructure=function(){var e={};switch(d.selectedSection.reportType){case"default":e=d.treeReports[0]?angular.fromJson(d.treeReports[0].tree):[];break;case"custom":e=d.treeReports[1]?angular.fromJson(d.treeReports[1].tree):[]}return e}(),d.selectedSection.selectedItems&&(d.allReportsSelected=h(d.allReportsSelected),d.allReportsSelected=_.unionBy(d.allReportsSelected,d.selectedSection.selectedItems,"parent"));u()},d.setPermission=function(e){switch(e){case"edit":d.selectedSection.allowEdit=!d.selectedSection.allowEdit;break;case"delete":d.selectedSection.allowDelete=!d.selectedSection.allowDelete}d.selectedSection.crudPermissions=p(),g(!0)},d.saveSection=function(){var n="Marketplace"===d.section.title?"AppZone":d.section.title,e=_.map(_.filter(d.subsections,{pending:!0}),function(e){var t=e.selectedItems,a=e.title;switch("Reports"===a&&(t=_.unionBy(d.allReportsSelected,e.selectedItems,"parent")),n){case"CallySquare":a="Projects"===a?"SquareProjects":a;break;case"Integrations":e.autoAssociation=!0}return{category:n,sectionId:e.id,name:a,enabled:e.enabled,autoAssociation:e.autoAssociation,crudPermissions:_.map(e.crudPermissions).join(""),Resources:t?_.map(t,function(e){return{name:e.name,resourceId:e.id,type:(t=a,n=e,"Reports"!==t?t:(_.startsWith(n.parent,"motion")?"Default":"Custom")+t)};var t,n}):[]}});return o.userProfile.addSections({id:d.userProfile.id},e).$promise.then(function(){d.subsections.forEach(function(e){e.pending=void 0}),d.allReportsSelected=[],d.associatedReports=null,v(),t.success({title:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_SAVED_SUCCESS_TITLE",{sectionName:r.instant(n.translate)}),msg:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_SAVED_SUCCESS_MESSAGE")})}).then(function(){return c().then(function(e){d.loadedSection=e})}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:USERPROFILE.ADDSECTIONS",msg:e.status?JSON.stringify(e.data):e.toString()})})},d.dualMultiselectOptions={readOnly:!1,items:[],selectedItems:[],showSelectAndDeselectAll:!0,orderBy:"name",line1:"name",line2:"",line3:"",line4:"fullPath",labelAll:r.instant("STAFF.PERMISSIONS_ALL_RESOURCES"),labelSelected:r.instant("STAFF.PERMISSIONS_SELECTED_RESOURCES"),labelSearch:r.instant("STAFF.PERMISSIONS_PLACEHOLDER_SEARCH"),transferCallback:function(e,t){g(!0),t?(d.selectedSection.selectedItems=_.pullAllBy(d.selectedSection.selectedItems,e,"id"),d.selectedSection.autoAssociation=!1):d.selectedSection.selectedItems=_.unionBy(d.selectedSection.selectedItems,e,"id")}}}e.$inject=["$mdDialog","$q","toasty","api","userProfile","userProfiles","$translate","Auth","section"],angular.module("app.staff").controller("UserProfilepermissionsmanageController",e)}(),function(){"use strict";function e(e,t,n,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=t.protocol()+"://"+t.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,t){n.show({controller:"UserProfilepermissionsmanageController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/userProfiles/edit/permissionsmanage/permissionsmanage.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{userProfile:e,userProfiles:u.userProfiles?u.userProfiles.rows:[],crudPermissions:u.crudPermissions}})},u.clonedialog=function(e,t){n.show({controller:"UserProfilecloneController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/userProfiles/edit/clone/clone.html",parent:angular.element(a.body),targetEvent:t,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")},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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.userProfiles=l||{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="userProfiles",b.listOrder="",b.listOrderAsc=null,b.selectedUserProfiles=[],b.query={fields:"createdAt,updatedAt,id,name,description,crudPermissions",sort:"-updatedAt",limit:10,page:1},b.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"),"")}),b.userProfiles&&0<b.userProfiles.count&&b.userProfiles.rows.forEach(function(e){var t=[];e.crudPermissions.forEach(function(e){t.push(b.arraycrudPermissions[e].option)});var n=[];t.forEach(function(e){n.push(r.instant("STAFF."+e.toUpperCase()))}),e.selectedcrudPermissions=n.join(", ")}),b.editstate=function(e,t){n.go("app.staff.userProfiles.edit",{id:e.id,userProfile:e,crudPermissions:b.crudPermissions})},b.clonedialog=function(e,t){i.show({controller:"UserProfilecloneController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/userProfiles/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{userProfile:e,userProfiles:b.userProfiles?b.userProfiles.rows:[],crudPermissions:b.crudPermissions}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getUserProfiles=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.userProfile.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="UserProfiles",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditUserProfile=function(e,t){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:t,userProfiles:b.userProfiles.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteUserProfile=S,b.exportSelectedUserProfiles=function(){var e=angular.copy(b.selectedUserProfiles);return b.selectedUserProfiles=[],e},b.deleteSelectedUserProfiles=function(e){var t=i.confirm().title("Are you sure want to delete the selected userProfiles?").htmlContent("<b>"+b.selectedUserProfiles.length+" selected</b> will be deleted.").ariaLabel("delete UserProfiles").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedUserProfiles.forEach(function(e){S(e)}),b.selectedUserProfiles=[]})},b.deselectUserProfiles=function(){b.selectedUserProfiles=[]},b.selectAllUserProfiles=function(){b.selectedUserProfiles=b.userProfiles.rows};var E=!0,A=1;function y(e){b.userProfiles=e||{count:0,rows:[]}}function S(e){m.userProfile.delete({id:e.id}).$promise.then(function(){_.remove(b.userProfiles.rows,{id:e.id}),b.userProfiles.count-=1,b.userProfiles.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEuserProfile"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getUserProfiles())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","userProfiles","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.staff").controller("UserProfilesController",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(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_USER",g.user=angular.copy(l),g.users=r,g.newUser=!1,g.user||(g.user={role:"user",autointernal:!0,context:"from-sip"},g.title="STAFF.NEW_USER",g.newUser=!0),g.addNewUser=function(){g.errors=[],d.user.save(g.user).$promise.then(function(e){g.users.unshift(e.toJSON()),o.success({title:"User properly created",msg:g.user.name?g.user.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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.saveUser=function(){g.errors=[],d.user.update({id:g.user.id},g.user).$promise.then(function(e){var t=_.find(g.users,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"User properly saved!",msg:g.user.name?g.user.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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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.deleteUser=function(e){if(c.getCurrentUser().id===g.user.id)return o.error({title:"User not deleted!",msg:"You can't remove yourself"});g.errors=[];var t=a.confirm().title("Are you sure?").content("The user will be deleted.").ariaLabel("Delete User").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.user.delete({id:g.user.id}).$promise.then(function(){_.remove(g.users,{id:g.user.id}),o.success({title:"User properly deleted!",msg:(g.user.name||"user")+" has been deleted!"}),v(g.user)}).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,d.userProfile.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.userProfiles=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERPROFILES",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","users","user","api","Auth","license","setting","crudPermissions"],angular.module("app.staff").controller("CreateOrEditUserDialogController",e)}(),function(){"use strict";function e(e,t,n,a,i){var s=this;function o(){e.hide()}s.currentUser=i.getCurrentUser(),s.errors=[],s.user=a,s.generateApiKey=function(){s.errors=[],n.user.createApiKey({id:s.user.id}).$promise.then(function(e){s.user.apiKey=e.api_key||"N/A",t.success({title:"User API key updated!"}),o()}).catch(function(e){t.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=[],n.user.removeApiKey({id:s.user.id}).$promise.then(function(){s.user.apiKey="N/A",t.success({title:"User API key removed!"}),o()}).catch(function(e){t.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 t=["png","jpg"];if(!_.includes(t,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+t.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var n={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.user.images.unshift(n),!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(t,e){if(t.id===a.uniqueIdentifier){var n=new FileReader;n.readAsDataURL(t.file.file),n.onload=function(e){t.url=e.target.result},t.type="image"}})},i.init=function(e,t){i.user=angular.copy(e),i.crudPermissions=void 0!==t?t:{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(e,t,n,a,i,s){var o=this;function r(){e.hide()}o.currentUser=s.getCurrentUser(),o.errors=[],o.setting=i,o.passwordPattern=o.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",o.user=a,o.password="",o.oldPassword="",o.savePassword=function(){o.errors=[];var e={id:o.user.id,newPassword:o.password};o.currentUser.id==o.user.id&&(e.oldPassword=o.oldPassword);n.user.changePassword(e).$promise.then(function(){t.success({title:"User password properly updated!"}),r()}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.save",msg:e.data?JSON.stringify(e.data.message):e.toString()}),o.errors=e.data.errors||[{message:e.toString(),type:"api.user.changePassword"}]})},o.closeDialog=r}e.$inject=["$mdDialog","toasty","api","user","setting","Auth"],angular.module("app.staff").controller("UserchangepasswordController",e)}(),function(){"use strict";function e(e,t,n,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=t.protocol()+"://"+t.host(),u.user=c||e.params.user||{},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.apikeymanagerdialog=function(e,t){n.show({controller:"UserapikeymanagerController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/users/edit/apikeymanager/apikeymanager.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{user:e,users:u.users?u.users.rows:[],crudPermissions:u.crudPermissions}})},u.changepassworddialog=function(e,t){n.show({controller:"UserchangepasswordController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/users/edit/changepassword/changepassword.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{user:e,setting:o,users:u.users?u.users.rows:[],crudPermissions:u.crudPermissions}})},u.alert=l.info,u.gotoUsers=function(){e.go("app.staff.users")},u.saveUser=function(){u.user=_.omit(u.user,"userpic"),r.user.update({id:u.user.id},u.user).$promise.then(function(){l.success({title:"User updated!",msg:u.user.name?u.user.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()})})},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.userProfile.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.userProfiles=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERPROFILES",msg:e.data?JSON.stringify(e.data):e.toString()})}),r.user.getApiKey({id:u.user.id}).$promise.then(function(e){u.user.apiKey=e.api_key?e.api_key:"N/A"}).catch(function(e){l.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","$translate","license","setting","api","toasty","Auth","user","userProfileSection"],angular.module("app.staff").controller("UserController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.users=l||{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="users",b.listOrder="",b.listOrderAsc=null,b.selectedUsers=[],b.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",role:"admin,user",sort:"-updatedAt",limit:10,page:1},b.arrayrole=_.keyBy([{option:"Admin",value:"'admin'"},{option:"User",value:"'user'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.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"),"")}),b.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"),"")}),b.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"),"")}),b.arrayvideosupport=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Always",value:"'always'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.staff.users.edit",{id:e.id,user:e,crudPermissions:b.crudPermissions})},b.deleteconfirm=function(e,t){var n=i.confirm().title("Are you sure want to delete the "+_.startCase("user")+"?").htmlContent("<b>"+(e.name||"user")+"</b> will be deleted.").ariaLabel("delete user").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getUsers=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.user.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Users",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditUser=function(e,t){i.show({controller:"CreateOrEditUserDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/users/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{user:t,users:b.users.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteUser=S,b.exportSelectedUsers=function(){var e=angular.copy(b.selectedUsers);return b.selectedUsers=[],e},b.deleteSelectedUsers=function(e){var t=i.confirm().title("Are you sure want to delete the selected users?").htmlContent("<b>"+b.selectedUsers.length+" selected</b> will be deleted.").ariaLabel("delete Users").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedUsers.forEach(function(e){S(e)}),b.selectedUsers=[]})},b.deselectUsers=function(){b.selectedUsers=[]},b.selectAllUsers=function(){b.selectedUsers=b.users.rows},m.userProfile.get({fields:"id,name",sort:"name"}).$promise.then(function(e){b.userProfiles=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERPROFILES",msg:e.data?JSON.stringify(e.data):e.toString()})});var E=!0,A=1;function y(e){b.users=e||{count:0,rows:[]}}function S(e){m.user.delete({id:e.id}).$promise.then(function(){_.remove(b.users.rows,{id:e.id}),b.users.count-=1,b.users.rows.length||b.getUsers(),p.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEuser"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getUsers())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","users","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.staff").controller("UsersController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.cannedAnswers=l||{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="cannedAnswers",b.listOrder="",b.listOrderAsc=null,b.selectedCannedAnswers=[],b.query={fields:"createdAt,updatedAt,id,key,value,description",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",limit:10,page:1},b.editdialog=function(e,t){i.show({controller:"CreateOrEditCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/cannedAnswers/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{cannedAnswer:e,cannedAnswers:b.cannedAnswers.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getCannedAnswers=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.cannedAnswer.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="CannedAnswers",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditCannedAnswer=function(e,t){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:t,cannedAnswers:b.cannedAnswers.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteCannedAnswer=S,b.exportSelectedCannedAnswers=function(){var e=angular.copy(b.selectedCannedAnswers);return b.selectedCannedAnswers=[],e},b.deleteSelectedCannedAnswers=function(e){var t=i.confirm().title("Are you sure want to delete the selected cannedAnswers?").htmlContent("<b>"+b.selectedCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete CannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedCannedAnswers.forEach(function(e){S(e)}),b.selectedCannedAnswers=[]})},b.deselectCannedAnswers=function(){b.selectedCannedAnswers=[]},b.selectAllCannedAnswers=function(){b.selectedCannedAnswers=b.cannedAnswers.rows};var E=!0,A=1;function y(e){b.cannedAnswers=e||{count:0,rows:[]}}function S(e){m.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(b.cannedAnswers.rows,{id:e.id}),b.cannedAnswers.count-=1,b.cannedAnswers.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcannedAnswer"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getCannedAnswers())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","cannedAnswers","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.tools").controller("CannedAnswersController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.cannedAnswers,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The cannedAnswer will be deleted.").ariaLabel("Delete CannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.customDashboards,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The customDashboard will be deleted.").ariaLabel("Delete CustomDashboard").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.customDashboards=l||{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="customDashboards",b.listOrder="",b.listOrderAsc=null,b.selectedCustomDashboards=[],b.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},b.editstate=function(e,t){n.go("app.tools.customDashboards.edit",{id:e.id,customDashboard:e,crudPermissions:b.crudPermissions})},b.clonedialog=function(e,t){i.show({controller:"CustomDashboardcloneController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/customDashboards/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{customDashboard:e,customDashboards:b.customDashboards?b.customDashboards.rows:[],crudPermissions:b.crudPermissions}})},b.gotodashboardgoto=function(e,t){n.go("app.dashboards.custom",{id:e.id})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getCustomDashboards=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.dashboard.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="CustomDashboards",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditCustomDashboard=function(e,t){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:t,customDashboards:b.customDashboards.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteCustomDashboard=S,b.exportSelectedCustomDashboards=function(){var e=angular.copy(b.selectedCustomDashboards);return b.selectedCustomDashboards=[],e},b.deleteSelectedCustomDashboards=function(e){var t=i.confirm().title("Are you sure want to delete the selected customDashboards?").htmlContent("<b>"+b.selectedCustomDashboards.length+" selected</b> will be deleted.").ariaLabel("delete CustomDashboards").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedCustomDashboards.forEach(function(e){S(e)}),b.selectedCustomDashboards=[]})},b.deselectCustomDashboards=function(){b.selectedCustomDashboards=[]},b.selectAllCustomDashboards=function(){b.selectedCustomDashboards=b.customDashboards.rows};var E=!0,A=1;function y(e){b.customDashboards=e||{count:0,rows:[]}}function S(e){m.dashboard.delete({id:e.id}).$promise.then(function(){_.remove(b.customDashboards.rows,{id:e.id}),b.customDashboards.count-=1,b.customDashboards.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdashboard"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getCustomDashboards())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","customDashboards","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.tools").controller("CustomDashboardsController",e)}(),function(){"use strict";function e(t,n,a,e,i,s,o){var r=this;function l(e){t.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!":""}),n.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 t=0;t<e.data.errors.length;t+=1)a.error({title:e.data.errors[t].type,msg:e.data.errors[t].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(n,a,e,i,s){var o=this;function r(e,t,n){return s.dashboardItem.update(n).$promise.catch(function(e){console.error(e)})}o.customDashboard={},o.voiceQueues=s.rpc.getVoiceQueues({fields:"id,name"}),o.init=function(e,t){return o.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},o.customDashboard=e,o.customDashboard.draggable={enabled:!0,handle:".draggable",stop:r},o.customDashboard.resizable={enabled:!0,handle:".resizable",stop:r},o.customDashboard.widgets=[],s.dashboard.getItems({id:e.id}).$promise.then(function(e){if(e&&e.count&&e.rows)for(var t=0;t<e.rows.length;t+=1)e.rows[t].voiceQueues=o.voiceQueues,e.rows[t].voiceQueuesSelected=_.map(o.voiceQueues.rows,"id"),e.rows[t].templateUrl="app/core/directives/ms-widget-engine/ms-widget-engine-"+e.rows[t].type+"/ms-widget-engine."+e.rows[t].type+".html",o.customDashboard.widgets.push(e.rows[t])}).catch(function(e){console.error(e)})},o.createOrEditWidget=function(e){if(e&&e.attrs)for(var t=0;t<e.attrs.length;t+=1)"attrReport"===e.attrs[t].name&&(e.reportType=e.attrs[t].type),e[e.attrs[t].name]=e.attrs[t].value;n.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:o.customDashboard.widgets,license:null,setting:null,crudPermissions:o.crudPermissions}}).then(function(e){if(e)for(var t=0;t<o.customDashboard.widgets.length;t+=1)o.customDashboard.widgets[t].id===e.id&&(o.customDashboard.widgets[t].attrs=e.attrs,o.customDashboard.widgets[t].voiceQueues=o.voiceQueues,o.customDashboard.widgets[t].voiceQueuesSelected=_.map(o.voiceQueues.rows,"id"),o.customDashboard.widgets[t].templateUrl="app/core/directives/ms-widget-engine/ms-widget-engine-"+o.customDashboard.widgets[t].type+"/ms-widget-engine."+o.customDashboard.widgets[t].type+".html")})},o.deleteWidget=function(t){var e=n.confirm().title("Would you like to delete "+t.title+"?").textContent("").ariaLabel("Delete Widget").ok("YES").cancel("NO");n.show(e).then(function(){return s.dashboardItem.delete({id:t.id}).$promise.then(function(e){_.remove(o.customDashboard.widgets,{id:t.id}),i.success({title:"Widget deleted!",msg:t.name?t.name+" has been deleted!":"Widget has been deleted!"})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){o.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETE.customDashboard"}];for(var t=0;t<e.data.errors.length;t++)i.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else i.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","socket","toasty","api"],angular.module("app.tools").controller("CustomDashboardItemsController",e)}(),function(){"use strict";function e(t,e,n,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",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 t=0;t<e.data.errors.length;t+=1)s.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.dashboard,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)s.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The dashboarditem will be deleted.").ariaLabel("Delete DashboardItem").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)s.error({title:e.data.errors[t].type,msg:e.data.errors[t].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.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))}t.dashboarditemForm.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=(t={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,t}).catch(function(e){s.error({title:"ERROR",msg:e.message})}):t),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 t},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:A,select_node:b}:{loaded:y,select_node:E}}function b(e,t){g.treeDefaultInstance.jstree(!0).deselect_all(),g.treeDefaultInstance.jstree(!0).close_all(),g.currentNode=t.node,g.currentNode.custom=!0,g.currentPath=g.treeCustomInstance.jstree(!0).get_path(g.currentNode).join("/ "),g.apiName="analyticCustomReport",g.query.parent=t.node.id,S()}function E(e,t){g.treeCustomInstance.jstree(!0).deselect_all(),g.treeCustomInstance.jstree(!0).close_all(),g.currentNode=t.node,g.currentNode.custom=!1,g.currentPath=g.treeDefaultInstance.jstree(!0).get_path(g.currentNode).join("/ "),g.apiName="analyticDefaultReport",g.query.parent=t.node.id,S()}function A(){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);E(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 t=e&&e.rows?e.rows:[];if(0<t.length){var n=[];return a.forEach(function(e){_.find(t,["resourceId",e.id])&&n.push(e)}),T({count:n.length,rows:n})}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=[],t=0;t<v.length;t++)e.push(d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:v[t].id}).$promise);return o.all(e)}).then(function(e){for(var t=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),n=[],a=0;a<v.length;a++){var i=_.find(t,["sectionId",v[a].id]);if(i)if(i.autoAssociation){var s=[];h.forEach(function(e){e.type===v[a].type&&s.push(e)}),n.push({rows:s,count:s.length})}else n.push(d.userProfileResource.get({sectionId:i.id}).$promise)}return o.all(n)}).then(function(e){var t=[],n=null;g.dashboarditem&&(n=_.find(h,{id:Number(g.dashboarditem.attrVoiceQueues)}));for(var a=0;a<e.length;a++){(e[a].rows||[]).forEach(function(e){t.push(e)})}n&&!_.some(t,["resourceId",n.id])&&h.forEach(function(e){e.id===n.id&&(e.canSelect=!1,t.push(e))}),g.voiceQueues=t}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueues",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(n,e,a,i,t,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||n.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=n.params.tab||0,u.clonedialog=function(e,t){a.show({controller:"CustomDashboardcloneController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/customDashboards/edit/clone/clone.html",parent:angular.element(i.body),targetEvent:t,clickOutsideToClose:!0,locals:{customDashboard:e,customDashboards:u.customDashboards?u.customDashboards.rows:[],crudPermissions:u.crudPermissions}})},u.gotogoto=function(e,t){n.go("app.dashboards.custom",{id:e.id})},u.alert=l.info,u.gotoCustomDashboards=function(){n.go("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(e,t,n,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_DISPOSITION",g.disposition=angular.copy(l),g.dispositions=r,g.newDisposition=!1,g.disposition||(g.disposition={},g.title="TOOLS.NEW_DISPOSITION",g.newDisposition=!0),g.addNewDisposition=function(){g.errors=[],d.disposition.save(g.disposition).$promise.then(function(e){g.dispositions.unshift(e.toJSON()),o.success({title:"Disposition properly created",msg:g.disposition.name?g.disposition.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.disposition.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveDisposition=function(){g.errors=[],d.disposition.update({id:g.disposition.id},g.disposition).$promise.then(function(e){var t=_.find(g.dispositions,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"Disposition properly saved!",msg:g.disposition.name?g.disposition.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.disposition.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteDisposition=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The disposition will be deleted.").ariaLabel("Delete Disposition").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.disposition.delete({id:g.disposition.id}).$promise.then(function(){_.remove(g.dispositions,{id:g.disposition.id}),o.success({title:"Disposition properly deleted!",msg:(g.disposition.name||"disposition")+" has been deleted!"}),v(g.disposition)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.disposition.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.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","dispositions","disposition","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditDispositionDialogController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.dispositions=l||{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="dispositions",b.listOrder="",b.listOrderAsc=null,b.selectedDispositions=[],b.query={fields:"createdAt,updatedAt,id,name",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",limit:10,page:1},b.editdialog=function(e,t){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{disposition:e,dispositions:b.dispositions.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.deleteconfirm=function(e,t){var n=i.confirm().title("Are you sure want to delete the "+_.startCase("disposition")+"?").htmlContent("<b>"+(e.name||"disposition")+"</b> will be deleted.").ariaLabel("delete disposition").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getDispositions=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.disposition.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Dispositions",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditDisposition=function(e,t){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:t,dispositions:b.dispositions.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteDisposition=S,b.exportSelectedDispositions=function(){var e=angular.copy(b.selectedDispositions);return b.selectedDispositions=[],e},b.deleteSelectedDispositions=function(e){var t=i.confirm().title("Are you sure want to delete the selected dispositions?").htmlContent("<b>"+b.selectedDispositions.length+" selected</b> will be deleted.").ariaLabel("delete Dispositions").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedDispositions.forEach(function(e){S(e)}),b.selectedDispositions=[]})},b.deselectDispositions=function(){b.selectedDispositions=[]},b.selectAllDispositions=function(){b.selectedDispositions=b.dispositions.rows};var E=!0,A=1;function y(e){b.dispositions=e||{count:0,rows:[]}}function S(e){m.disposition.delete({id:e.id}).$promise.then(function(){_.remove(b.dispositions.rows,{id:e.id}),b.dispositions.count-=1,b.dispositions.rows.length||b.getDispositions(),p.success({title:_.startCase("Disposition")+" 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:DELETEdisposition"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getDispositions())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","dispositions","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.tools").controller("DispositionsController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.intervals,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The interval will be deleted.").ariaLabel("Delete Interval").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,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 E(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var t=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),n=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(t+"-"+n)}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 A(e){t.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=E(),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!":""}),A()}).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=E(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),A(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var t=_.find(c.intervals,{id:e.id});t&&_.merge(t,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),A()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=A,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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=e&&e.rows?e.rows:[],n=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(t,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,n.push(e))}),c.intervals=n})}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,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.interval={},c.intervalIntervals={count:0,rows:[]},c.selectedIntervalIntervals=[],c.crudPermissions,c.sortableTable={animation:100,onSort:function(e){l.interval.addIntervals({id:c.interval.id},e.models).$promise.then(function(e){c.intervalIntervals.rows=e}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:SORTABLETABLE",msg:e.data?JSON.stringify(e.data):e.toString()})})}},c.query={fields:"createdAt,updatedAt,id,name,interval",nolimit:"true",limit:10,page:1},c.init=function(e,t){c.interval=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.sortableTable.disabled=!c.crudPermissions.canEdit,c.query.id=c.interval.id,c.getIntervalIntervals()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the interval?").htmlContent("<b>"+(e.name||"interval")+"</b> will be deleted.").ariaLabel("delete interval").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getIntervalIntervals=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.interval.getIntervals(c.query,p).$promise},c.createOrEditIntervalInterval=function(e,t){s.show({controller:"EditAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/intervals/edit/apps/interval/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:c.interval,interval:t,intervals:c.intervalIntervals.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedIntervalIntervals=function(){var e=angular.copy(c.selectedIntervalIntervals);return c.selectedIntervalIntervals=[],e},c.deleteIntervalInterval=g,c.deleteSelectedIntervalIntervals=function(e){var t=s.confirm().title("Are you sure want to delete the selected intervals?").htmlContent("<b>"+c.selectedIntervalIntervals.length+" selected</b> will be deleted.").ariaLabel("delete intervals").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedIntervalIntervals.forEach(function(e){g(e)}),c.selectedIntervalIntervals=[]})};var m=!0,u=1;function p(e){c.intervalIntervals=e||{count:0,rows:[]}}function g(e){l.interval.delete({id:e.id}).$promise.then(function(){_.remove(c.intervalIntervals.rows,{id:e.id}),c.intervalIntervals.count-=1,c.intervalIntervals.rows.length||c.getIntervalIntervals(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETinterval"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getIntervalIntervals())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.tools").controller("IntervalIntervalsController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.intervals,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The interval will be deleted.").ariaLabel("Delete Interval").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,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=t.protocol()+"://"+t.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")},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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.intervals=l||{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="intervals",b.listOrder="",b.listOrderAsc=null,b.selectedIntervals=[],b.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",IntervalId:"null",limit:10,page:1},b.editstate=function(e,t){n.go("app.tools.intervals.edit",{id:e.id,interval:e,crudPermissions:b.crudPermissions})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getIntervals=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.interval.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Intervals",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditInterval=function(e,t){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:t,intervals:b.intervals.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteInterval=S,b.exportSelectedIntervals=function(){var e=angular.copy(b.selectedIntervals);return b.selectedIntervals=[],e},b.deleteSelectedIntervals=function(e){var t=i.confirm().title("Are you sure want to delete the selected intervals?").htmlContent("<b>"+b.selectedIntervals.length+" selected</b> will be deleted.").ariaLabel("delete Intervals").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedIntervals.forEach(function(e){S(e)}),b.selectedIntervals=[]})},b.deselectIntervals=function(){b.selectedIntervals=[]},b.selectAllIntervals=function(){b.selectedIntervals=b.intervals.rows};var E=!0,A=1;function y(e){b.intervals=e||{count:0,rows:[]}}function S(e){m.interval.delete({id:e.id}).$promise.then(function(){_.remove(b.intervals.rows,{id:e.id}),b.intervals.count-=1,b.intervals.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEinterval"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getIntervals())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","intervals","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.tools").controller("IntervalsController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.pauses,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The pause will be deleted.").ariaLabel("Delete Pause").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.pauses=l||{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="pauses",b.listOrder="",b.listOrderAsc=null,b.selectedPauses=[],b.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},b.editdialog=function(e,t){i.show({controller:"CreateOrEditPauseDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/pauses/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{pause:e,pauses:b.pauses.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getPauses=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.pause.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Pauses",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditPause=function(e,t){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:t,pauses:b.pauses.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deletePause=S,b.exportSelectedPauses=function(){var e=angular.copy(b.selectedPauses);return b.selectedPauses=[],e},b.deleteSelectedPauses=function(e){var t=i.confirm().title("Are you sure want to delete the selected pauses?").htmlContent("<b>"+b.selectedPauses.length+" selected</b> will be deleted.").ariaLabel("delete Pauses").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedPauses.forEach(function(e){S(e)}),b.selectedPauses=[]})},b.deselectPauses=function(){b.selectedPauses=[]},b.selectAllPauses=function(){b.selectedPauses=b.pauses.rows};var E=!0,A=1;function y(e){b.pauses=e||{count:0,rows:[]}}function S(e){m.pause.delete({id:e.id}).$promise.then(function(){_.remove(b.pauses.rows,{id:e.id}),b.pauses.count-=1,b.pauses.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEpause"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getPauses())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","pauses","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.tools").controller("PausesController",e)}(),function(){"use strict";function e(e,t,n,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:E,select_node:f}:{loaded:A,select_node:b}}function f(e,t){g.treeDefaultInstance.jstree(!0).deselect_all(),g.treeDefaultInstance.jstree(!0).close_all(),g.currentNode=t.node,g.currentNode.custom=!0,g.currentPath=g.treeCustomInstance.jstree(!0).get_path(g.currentNode).join("/ "),g.apiName="analyticCustomReport",g.query.parent=t.node.id,y()}function b(e,t){g.treeCustomInstance.jstree(!0).deselect_all(),g.treeCustomInstance.jstree(!0).close_all(),g.currentNode=t.node,g.currentNode.custom=!1,g.currentPath=g.treeDefaultInstance.jstree(!0).get_path(g.currentNode).join("/ "),g.apiName="analyticDefaultReport",g.query.parent=t.node.id,y()}function E(){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 A(){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 t=e&&e.rows?e.rows:[];if(0<t.length){var n=[];return a.forEach(function(e){_.find(t,["resourceId",e.id])&&n.push(e)}),S({count:n.length,rows:n})}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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.schedules,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The schedule will be deleted.").ariaLabel("Delete Schedule").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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.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=(t={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,t}).catch(function(e){o.error({title:"ERROR",msg:e.message})}):t),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 t},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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.mailAccounts,{id:e.resourceId})}),n=null;if(g.schedule&&(n=_.find(g.mailAccounts,{id:Number(g.schedule.MailAccountId)})),n&&!_.some(t,["id",n.id])){var a=_.find(g.mailAccounts,{id:n.id});a.canSelect=!1,t.push(a)}g.mailAccounts=t})}else{var n=[],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,n.push(g.mailAccounts[i]));g.mailAccounts=n}}).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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.schedules=l||{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="schedules",b.listOrder="",b.listOrderAsc=null,b.selectedScheduler=[],b.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},b.arrayoutput=_.keyBy([{option:"CSV",value:"'csv'"},{option:"PDF",value:"'pdf'"},{option:"Excel",value:"'xlsx'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.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"),"")}),b.editdialog=function(e,t){i.show({controller:"CreateOrEditScheduleDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/schedules/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{schedule:e,schedules:b.schedules.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.runconfirm=function(e,t){var n=i.confirm().title("Are you sure want to run the schedule?").htmlContent("<b>"+(e.name||"schedule")+"</b> will be run.").ariaLabel("delete schedule").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){return m.schedule.run({id:e.id}).$promise},function(){console.log("CANCEL")})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getScheduler=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.schedule.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Scheduler",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditSchedule=function(e,t){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:t,schedules:b.schedules.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteSchedule=S,b.exportSelectedScheduler=function(){var e=angular.copy(b.selectedScheduler);return b.selectedScheduler=[],e},b.deleteSelectedScheduler=function(e){var t=i.confirm().title("Are you sure want to delete the selected schedules?").htmlContent("<b>"+b.selectedScheduler.length+" selected</b> will be deleted.").ariaLabel("delete Schedules").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedScheduler.forEach(function(e){S(e)}),b.selectedScheduler=[]})},b.deselectScheduler=function(){b.selectedScheduler=[]},b.selectAllScheduler=function(){b.selectedScheduler=b.schedules.rows},m.analyticTreeReport.get({}).$promise.then(function(e){b.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){b.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){b.mailAccounts=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:602}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(b.mailAccounts,{id:e.resourceId})}),n=null;if(b.schedule&&(n=_.find(b.mailAccounts,{id:Number(b.schedule.MailAccountId)})),n&&!_.some(t,["id",n.id])){var a=_.find(b.mailAccounts,{id:n.id});a.canSelect=!1,t.push(a)}b.mailAccounts=t})}else{var n=[],a=null;b.schedule&&(a=_.find(b.mailAccounts,{id:Number(b.schedule.MailAccountId)}));for(var i=0;i<b.mailAccounts.length;i++)a&&b.mailAccounts[i].id===a.id&&(b.mailAccounts[i].canSelect=!1,n.push(b.mailAccounts[i]));b.mailAccounts=n}}).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 E=!0,A=1;function y(e){b.schedules=e||{count:0,rows:[]}}function S(e){m.schedule.delete({id:e.id}).$promise.then(function(){_.remove(b.schedules.rows,{id:e.id}),b.schedules.count-=1,b.schedules.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEschedule"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getScheduler())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","schedules","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.tools").controller("SchedulesController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.sounds,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The sound will be deleted.").ariaLabel("Delete Sound").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.sounds=l||{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="sounds",b.listOrder="",b.listOrderAsc=null,b.selectedSounds=[],b.query={fields:"createdAt,updatedAt,id,save_name,converted_format,name,audio,description",sort:"-updatedAt",limit:10,page:1},b.editdialog=function(e,t){i.show({controller:"CreateOrEditSoundDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/sounds/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{sound:e,sounds:b.sounds.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.downloadfile2=function(s,e){return m.sound.download({id:s.id}).$promise.then(function(e){var t=[e.buffer],n="download",a=new Blob(t,{type:e.type});n=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",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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()})})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getSounds=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.sound.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Sounds",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditSound=function(e,t){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:t,sounds:b.sounds.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteSound=S,b.exportSelectedSounds=function(){var e=angular.copy(b.selectedSounds);return b.selectedSounds=[],e},b.deleteSelectedSounds=function(e){var t=i.confirm().title("Are you sure want to delete the selected sounds?").htmlContent("<b>"+b.selectedSounds.length+" selected</b> will be deleted.").ariaLabel("delete Sounds").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedSounds.forEach(function(e){S(e)}),b.selectedSounds=[]})},b.deselectSounds=function(){b.selectedSounds=[]},b.selectAllSounds=function(){b.selectedSounds=b.sounds.rows},b.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:b.sounds.rows}})};var E=!0,A=1;function y(e){b.sounds=e||{count:0,rows:[]}}function S(e){m.sound.delete({id:e.id}).$promise.then(function(){_.remove(b.sounds.rows,{id:e.id}),b.sounds.count-=1,b.sounds.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEsound"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getSounds())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","sounds","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.tools").controller("SoundsController",e)}(),function(){"use strict";function e(e,t,n,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 t=["wav","mp3","gsm"];if(!_.includes(t,e.getExtension()))return n.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+t.join()}),!1;if(e.size>l)return n.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(t,e){if(t.id===a.uniqueIdentifier){var n=new FileReader;n.readAsDataURL(t.file.file),n.onload=function(e){t.url=e.target.result}}})},o.uploadError=function(e,t){o.ngFlow.flow.cancel(),n.error({title:"Upload error",msg:"Cannot upload the sound"}),o.uploadState="failed"},o.uploadComplete=function(){"failed"!==o.uploadState&&(o.uploadState="completed",n.success({title:"Upload completed",msg:o.sound.file.name+" uploaded successfully"}))},o.closeDialog=function(){t.hide()}}e.$inject=["$cookies","$mdDialog","toasty","sounds","api","Auth"],angular.module("app.tools").controller("UploadSoundDialogController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.tags,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The tag will be deleted.").ariaLabel("Delete Tag").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.tags=l||{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="tags",b.listOrder="",b.listOrderAsc=null,b.selectedTags=[],b.query={fields:"createdAt,updatedAt,id,name,description,color",sort:"-updatedAt",limit:10,page:1},b.editdialog=function(e,t){i.show({controller:"CreateOrEditTagDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/tags/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{tag:e,tags:b.tags.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getTags=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.tag.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Tags",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditTag=function(e,t){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:t,tags:b.tags.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteTag=S,b.exportSelectedTags=function(){var e=angular.copy(b.selectedTags);return b.selectedTags=[],e},b.deleteSelectedTags=function(e){var t=i.confirm().title("Are you sure want to delete the selected tags?").htmlContent("<b>"+b.selectedTags.length+" selected</b> will be deleted.").ariaLabel("delete Tags").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedTags.forEach(function(e){S(e)}),b.selectedTags=[]})},b.deselectTags=function(){b.selectedTags=[]},b.selectAllTags=function(){b.selectedTags=b.tags.rows};var E=!0,A=1;function y(e){b.tags=e||{count:0,rows:[]}}function S(e){m.tag.delete({id:e.id}).$promise.then(function(){_.remove(b.tags.rows,{id:e.id}),b.tags.count-=1,b.tags.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEtag"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getTags())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","tags","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.tools").controller("TagsController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.templates,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The template will be deleted.").ariaLabel("Delete Template").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.templates=l||{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="templates",b.listOrder="",b.listOrderAsc=null,b.selectedTemplates=[],b.query={fields:"createdAt,updatedAt,id,name,html,description",sort:"-updatedAt",limit:10,page:1},b.editdialog=function(e,t){i.show({controller:"CreateOrEditTemplateDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/templates/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{template:e,templates:b.templates.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getTemplates=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.template.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Templates",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditTemplate=function(e,t){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:t,templates:b.templates.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteTemplate=S,b.exportSelectedTemplates=function(){var e=angular.copy(b.selectedTemplates);return b.selectedTemplates=[],e},b.deleteSelectedTemplates=function(e){var t=i.confirm().title("Are you sure want to delete the selected templates?").htmlContent("<b>"+b.selectedTemplates.length+" selected</b> will be deleted.").ariaLabel("delete Templates").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedTemplates.forEach(function(e){S(e)}),b.selectedTemplates=[]})},b.deselectTemplates=function(){b.selectedTemplates=[]},b.selectAllTemplates=function(){b.selectedTemplates=b.templates.rows};var E=!0,A=1;function y(e){b.templates=e||{count:0,rows:[]}}function S(e){m.template.delete({id:e.id}).$promise.then(function(){_.remove(b.templates.rows,{id:e.id}),b.templates.count-=1,b.templates.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEtemplate"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getTemplates())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","templates","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.tools").controller("TemplatesController",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(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_TRIGGER",g.trigger=angular.copy(l),g.triggers=r,g.newTrigger=!1,g.trigger||(g.trigger={channel:"voice"},g.title="TOOLS.NEW_TRIGGER",g.newTrigger=!0),g.addNewTrigger=function(){g.errors=[],d.trigger.save(g.trigger).$promise.then(function(e){g.triggers.unshift(e.toJSON()),o.success({title:"Trigger properly created",msg:g.trigger.name?g.trigger.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.trigger.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trigger.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveTrigger=function(){g.errors=[],d.trigger.update({id:g.trigger.id},g.trigger).$promise.then(function(e){var t=_.find(g.triggers,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"Trigger properly saved!",msg:g.trigger.name?g.trigger.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.trigger.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trigger.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteTrigger=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The trigger will be deleted.").ariaLabel("Delete Trigger").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.trigger.delete({id:g.trigger.id}).$promise.then(function(){_.remove(g.triggers,{id:g.trigger.id}),o.success({title:"Trigger properly deleted!",msg:(g.trigger.name||"trigger")+" has been deleted!"}),v(g.trigger)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.trigger.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.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(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","triggers","trigger","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditTriggerDialogController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.trigger={},c.triggerActions={count:0,rows:[]},c.selectedTriggerActions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,action,data1,data2,data7,data3,data4,data5,data6",limit:10,page:1},c.arrayaction=_.keyBy([{option:"CONTACT_MANAGER",value:"'contactManager'",ngIf:"vm.trigger.channel == 'voice'"},{option:"INTEGRATIONS",value:"'integration'",ngIf:"vm.trigger.channel == 'voice' && ((vm.newAction && vm.hasModulePermissions.Integrations) || !vm.newAction)"},{option:"MOTION_BAR",value:"'motionbar'"},{option:"JSCRIPTY",value:"'jscripty'"},{option:"URL_FORWARD",value:"'urlForward'"},{option:"BROWSER",value:"'browser'"},{option:"BOT",value:"'bot'",ngIf:"vm.trigger.channel == 'voice'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.browserValues=_.keyBy([{option:"Popup",value:"'0'"},{option:"CTI URL",value:"'1'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.autoCreateContact=_.keyBy([{option:"yes",value:"'1'"},{option:"no",value:"'0'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.urlForwardValues=_.keyBy([{option:"GET",value:"'GET'"},{option:"POST",value:"'POST'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.integrationValues=_.keyBy([{option:"Zendesk",value:"'zendesk'",ngIf:"(vm.newAction && vm.hasSectionPermissions[1301]) || !vm.newAction",disabled:"(!vm.newAction && !vm.hasSectionPermissions[1301])"},{option:"Salesforce",value:"'salesforce'",ngIf:"(vm.newAction && vm.hasSectionPermissions[1302]) || !vm.newAction",disabled:"(!vm.newAction && !vm.hasSectionPermissions[1302])"},{option:"SugarCRM",value:"'sugarcrm'",ngIf:"(vm.newAction && vm.hasSectionPermissions[1305]) || !vm.newAction",disabled:"(!vm.newAction && !vm.hasSectionPermissions[1305])"},{option:"Freshdesk",value:"'freshdesk'",ngIf:"(vm.newAction && vm.hasSectionPermissions[1303]) || !vm.newAction",disabled:"(!vm.newAction && !vm.hasSectionPermissions[1303])"},{option:"Desk",value:"'desk'",ngIf:"(vm.newAction && vm.hasSectionPermissions[1306]) || !vm.newAction",disabled:"(!vm.newAction && !vm.hasSectionPermissions[1306])"},{option:"Zoho",value:"'zoho'",ngIf:"(vm.newAction && vm.hasSectionPermissions[1307]) || !vm.newAction",disabled:"(!vm.newAction && !vm.hasSectionPermissions[1307])"},{option:"vTiger",value:"'vtiger'",ngIf:"(vm.newAction && vm.hasSectionPermissions[1308]) || !vm.newAction",disabled:"(!vm.newAction && !vm.hasSectionPermissions[1308])"},{option:"Dynamics365",value:"'dynamics365'",ngIf:"(vm.newAction && vm.hasSectionPermissions[1309]) || !vm.newAction",disabled:"(!vm.newAction && !vm.hasSectionPermissions[1309])"},{option:"ServiceNow",value:"'servicenow'",ngIf:"(vm.newAction && vm.hasSectionPermissions[1310]) || !vm.newAction",disabled:"(!vm.newAction && !vm.hasSectionPermissions[1310])"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.motionbarValues=_.keyBy([{option:"Popup",value:"'0'"},{option:"CTI URL",value:"'1'"},{option:"Windows App",value:"'2'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.eventVariables=_.keyBy([{option:"yes",value:"'1'"},{option:"no",value:"'0'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.location=_.keyBy([{option:"NEW_TAB",value:"'0'"},{option:"NEW_WINDOW",value:"'1'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.init=function(e,t){c.trigger=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.trigger.id,c.query.ActionId=c.trigger.id,c.getTriggerActions(),n=[1301,1302,1303,1305,1306,1307,1308],d.hasModulesPermissions(["Integrations"]).then(function(e){c.hasModulePermissions=_.merge(c.hasModulePermissions,e)}).then(function(){d.hasSectionsPermissions(n).then(function(e){c.hasSectionPermissions=_.merge(c.hasSectionPermissions,e)})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTEGRATIONS_PERMISSIONS",msg:e.data?JSON.stringify(e.data):e.toString()})});var n},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the action?").htmlContent("<b>"+(e.name||"action")+"</b> will be deleted.").ariaLabel("delete action").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.success=p,c.getTriggerActions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.trigger.getActions(c.query,p).$promise},c.createOrEditTriggerAction=function(e,t){s.show({controller:"CreateOrEditActionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/triggers/edit/actions/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{trigger:c.trigger,action:t,actions:c.triggerActions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedTriggerActions=function(){var e=angular.copy(c.selectedTriggerActions);return c.selectedTriggerActions=[],e},c.deleteTriggerAction=g,c.deleteSelectedTriggerActions=function(e){var t=s.confirm().title("Are you sure want to delete the selected actions?").htmlContent("<b>"+c.selectedTriggerActions.length+" selected</b> will be deleted.").ariaLabel("delete actions").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedTriggerActions.forEach(function(e){g(e)}),c.selectedTriggerActions=[]})},d.hasRole("admin")?l.cmList.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){c.lists=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.cmList.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){c.lists=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(c.lists,{id:e.resourceId})}),a=null;a=[],c.triggerActions.rows.forEach(function(e){if("contactManager"===e.action){var t=_.find(c.lists,{id:Number(e.data1)});a.push(t)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(c.lists,{id:e.id});t.canSelect=!1,n.push(t)}}),c.lists=n})}else{var n=[],a=[];c.triggerActions.rows.forEach(function(e){if("contactManager"===e.action){var t=_.find(c.lists,{id:Number(e.data1)});a.push(t)}});for(var i=0;i<c.lists.length;i++){_.some(a,{id:c.lists[i].id})&&(c.lists[i].canSelect=!1,n.push(c.lists[i]))}c.lists=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?l.jscriptyProject.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){c.projects=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PROJECTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.jscriptyProject.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){c.projects=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1701}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(c.projects,{id:e.resourceId})}),a=null;a=[],c.triggerActions.rows.forEach(function(e){if("jscripty"===e.action){var t=_.find(c.projects,{id:Number(e.data1)});a.push(t)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(c.projects,{id:e.id});t.canSelect=!1,n.push(t)}}),c.projects=n})}else{var n=[],a=[];c.triggerActions.rows.forEach(function(e){if("jscripty"===e.action){var t=_.find(c.projects,{id:Number(e.data1)});a.push(t)}});for(var i=0;i<c.projects.length;i++){_.some(a,{id:c.projects[i].id})&&(c.projects[i].canSelect=!1,n.push(c.projects[i]))}c.projects=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intZendeskAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.zendeskAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_ZENDESKACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intDeskAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.deskAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_DESKACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intZohoAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.zohoAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_ZOHOACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intSalesforceAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.salesforceAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SALESFORCEACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intSugarcrmAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.sugarcrmAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SUGARCRMACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intFreshdeskAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.freshdeskAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_FRESHDESKACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intVtigerAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.vtigerAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VTIGERACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intDynamics365Account.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.dynamics365Accounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_DYNAMICS365ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intServicenowAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.servicenowAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SERVICENOWACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intZendeskConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){c.zendeskConfigurations=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_ZENDESKCONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intDeskConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){c.deskConfigurations=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_DESKCONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intZohoConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){c.zohoConfigurations=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_ZOHOCONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intSalesforceConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){c.salesforceConfigurations=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SALESFORCECONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intSugarcrmConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){c.sugarcrmConfigurations=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SUGARCRMCONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intFreshdeskConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){c.freshdeskConfigurations=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_FRESHDESKCONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intVtigerConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){c.vtigerConfigurations=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VTIGERCONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intDynamics365Configuration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){c.dynamics365Configurations=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_DYNAMICS365CONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),l.intServicenowConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){c.servicenowConfigurations=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SERVICENOWCONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?l.template.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.templates=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEMPLATES",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.template.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.templates=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1009}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(c.templates,{id:e.resourceId})}),a=null;a=[],c.triggerActions.rows.forEach(function(e){if("motionbar"===e.action){var t=_.find(c.templates,{id:Number(e.data2)});a.push(t)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(c.templates,{id:e.id});t.canSelect=!1,n.push(t)}}),c.templates=n})}else{var n=[],a=[];c.triggerActions.rows.forEach(function(e){if("motionbar"===e.action){var t=_.find(c.templates,{id:Number(e.data2)});a.push(t)}});for(var i=0;i<c.templates.length;i++){_.some(a,{id:c.templates[i].id})&&(c.templates[i].canSelect=!1,n.push(c.templates[i]))}c.templates=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtemplates",msg:e.data?JSON.stringify(e.data):e.toString()})});var m=!0,u=1;function p(e){c.triggerActions=e||{count:0,rows:[]}}function g(e){l.action.delete({id:e.id}).$promise.then(function(){_.remove(c.triggerActions.rows,{id:e.id}),c.triggerActions.count-=1,c.triggerActions.rows.length||c.getTriggerActions(),r.success({title:"Action deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETtrigger"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrigger",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getTriggerActions())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.tools").controller("TriggerActionsController",e)}(),function(){"use strict";function e(e,t,n,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="TOOLS.EDIT_ACTION",v.action=angular.copy(l),v.actions=r,v.newAction=!1,v.trigger=angular.copy(d),v.action||(v.action={data3:"0",data4:"0",data5:"800",data6:"600"},v.title="TOOLS.NEW_ACTION",v.newAction=!0),t.params.id&&(v.action.ActionId=t.params.id),v.addNewAction=function(){v.errors=[],c.trigger.addAction({id:t.params.id},v.action).$promise.then(function(e){v.actions.unshift(e.toJSON()),o.success({title:"Action properly created",msg:v.action.name?v.action.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.action.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.action.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.saveAction=function(){v.errors=[],c.action.update({id:v.action.id},v.action).$promise.then(function(e){var t=_.find(v.actions,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"Action properly saved!",msg:v.action.name?v.action.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.action.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.action.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.deleteAction=function(e){v.errors=[];var t=a.confirm().title("Are you sure?").content("The action will be deleted.").ariaLabel("Delete Action").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){c.action.delete({id:v.action.id}).$promise.then(function(){_.remove(v.actions,{id:v.action.id}),o.success({title:"Action properly deleted!",msg:(v.action.name||"action")+" has been deleted!"}),h(v.action)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.action.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.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(){})},v.getDateFromString=function(e){return null===e?void 0:new Date(e)},v.onActionInit=function(){m.hasModulesPermissions(["Integrations"]).then(function(e){v.hasModulePermissions=_.merge(v.hasModulePermissions,e)}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MODULES_PERMISSIONS",msg:e.data?JSON.stringify(e.data):e.toString()})})},v.onIntegrationInit=function(){m.hasSectionsPermissions([1301,1302,1303,1305,1306,1307,1308,1309,1310]).then(function(e){v.hasSectionPermissions=_.merge(v.hasSectionPermissions,e)}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SECTIONS_PERMISSIONS",msg:e.data?JSON.stringify(e.data):e.toString()})})},v.closeDialog=h,m.hasRole("admin")?c.cmList.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){v.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()})}):c.cmList.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){v.lists=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return c.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(v.lists,{id:e.resourceId})}),n=null;if(v.action&&(n=_.find(v.lists,{id:Number(v.action.data1)})),n&&!_.some(t,["id",n.id])){var a=_.find(v.lists,{id:n.id});a.canSelect=!1,t.push(a)}v.lists=t})}else{var n=[],a=null;v.action&&(a=_.find(v.lists,{id:Number(v.action.data1)}));for(var i=0;i<v.lists.length;i++)a&&v.lists[i].id===a.id&&(v.lists[i].canSelect=!1,n.push(v.lists[i]));v.lists=n}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),m.hasRole("admin")?c.jscriptyProject.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){v.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()})}):c.jscriptyProject.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){v.projects=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:1701}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return c.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(v.projects,{id:e.resourceId})}),n=null;if(v.action&&(n=_.find(v.projects,{id:Number(v.action.data1)})),n&&!_.some(t,["id",n.id])){var a=_.find(v.projects,{id:n.id});a.canSelect=!1,t.push(a)}v.projects=t})}else{var n=[],a=null;v.action&&(a=_.find(v.projects,{id:Number(v.action.data1)}));for(var i=0;i<v.projects.length;i++)a&&v.projects[i].id===a.id&&(v.projects[i].canSelect=!1,n.push(v.projects[i]));v.projects=n}}).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.intZendeskAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.zendeskAccounts=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_ZENDESKACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intDeskAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.deskAccounts=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_DESKACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intZohoAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.zohoAccounts=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_ZOHOACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intSalesforceAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.salesforceAccounts=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SALESFORCEACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intSugarcrmAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.sugarcrmAccounts=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SUGARCRMACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intFreshdeskAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.freshdeskAccounts=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_FRESHDESKACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intVtigerAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.vtigerAccounts=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VTIGERACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intDynamics365Account.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.dynamics365Accounts=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_DYNAMICS365ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intServicenowAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.servicenowAccounts=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SERVICENOWACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intZendeskConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){v.zendeskConfigurations=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_ZENDESKCONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intDeskConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){v.deskConfigurations=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_DESKCONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intZohoConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){v.zohoConfigurations=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_ZOHOCONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intSalesforceConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){v.salesforceConfigurations=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SALESFORCECONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intSugarcrmConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){v.sugarcrmConfigurations=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SUGARCRMCONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intFreshdeskConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){v.freshdeskConfigurations=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_FRESHDESKCONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intVtigerConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){v.vtigerConfigurations=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VTIGERCONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intDynamics365Configuration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){v.dynamics365Configurations=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_DYNAMICS365CONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intServicenowConfiguration.get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){v.servicenowConfigurations=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SERVICENOWCONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),m.hasRole("admin")?c.template.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.templates=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEMPLATES",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.template.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.templates=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:1009}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return c.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(v.templates,{id:e.resourceId})}),n=null;if(v.action&&(n=_.find(v.templates,{id:Number(v.action.data2)})),n&&!_.some(t,["id",n.id])){var a=_.find(v.templates,{id:n.id});a.canSelect=!1,t.push(a)}v.templates=t})}else{var n=[],a=null;v.action&&(a=_.find(v.templates,{id:Number(v.action.data2)}));for(var i=0;i<v.templates.length;i++)a&&v.templates[i].id===a.id&&(v.templates[i].canSelect=!1,n.push(v.templates[i]));v.templates=n}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtemplates",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","actions","action","trigger","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditActionDialogController",e)}(),function(){"use strict";function e(e,t,n,o,a,i,s,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.trigger={},c.triggerAllConditions={count:0,rows:[]},c.selectedTriggerAllConditions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,field,operator,value",limit:10,page:1},c.arrayfield=_.keyBy([{option:"Queue",value:"'queue'",ngIf:"vm.trigger.channel == 'voice'"},{option:"Call_Status",value:"'lastevent'",ngIf:"vm.trigger.channel == 'voice'"},{option:"OutboundRoute",value:"'routeId'",ngIf:"vm.trigger.channel == 'voice'"},{option:"Account",value:"'account'",ngIf:"vm.trigger.channel != 'voice'"},{option:"Interaction",value:"'interaction'",ngIf:"vm.trigger.channel != 'voice'"},{option:"Message",value:"'message'",ngIf:"vm.trigger.channel != 'voice'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.arrayoperator=_.keyBy([{option:"Equals",value:"'equals'"},{option:"Not_Equals",value:"'not_equals'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.callStatusValues=_.keyBy([{option:"Abandon",value:"'abandoned'"},{option:"Hangup",value:"'complete'"},{option:"Reject",value:"'rejected'"},{option:"Ring",value:"'called'"},{option:"Answer",value:"'connect'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.interactionStatusValues=_.keyBy([{option:"Opened",value:"'opened'"},{option:"Closed",value:"'closed'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.messageStatusValues=_.keyBy([{option:"Incoming",value:"'in'"},{option:"Outgoing",value:"'out'"},{option:"Accepted",value:"'accept'"},{option:"Rejected",value:"'reject'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.init=function(e,t){c.trigger=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.trigger.id,c.query.TriggerAllId=c.trigger.id,c.getTriggerAllConditions()},c.deleteConfirm=function(e,t){var n=i.confirm().title("Are you sure want to delete the allCondition?").htmlContent("<b>"+(e.name||"allCondition")+"</b> will be deleted.").ariaLabel("delete allCondition").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){h(e)},function(){console.log("CANCEL")})},c.success=v,c.getTriggerAllConditions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.trigger.getAllConditions(c.query,v).$promise},c.createOrEditTriggerAllCondition=function(e,t){i.show({controller:"CreateOrEditAllConditionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/triggers/edit/allconditions/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{trigger:c.trigger,allCondition:t,allconditions:c.triggerAllConditions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedTriggerAllConditions=function(){var e=angular.copy(c.selectedTriggerAllConditions);return c.selectedTriggerAllConditions=[],e},c.deleteTriggerAllCondition=h,c.deleteSelectedTriggerAllConditions=function(e){var t=i.confirm().title("Are you sure want to delete the selected allconditions?").htmlContent("<b>"+c.selectedTriggerAllConditions.length+" selected</b> will be deleted.").ariaLabel("delete allconditions").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){c.selectedTriggerAllConditions.forEach(function(e){h(e)}),c.selectedTriggerAllConditions=[]})},d.hasRole("admin")?l.chatWebsite.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.chatAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CHATACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.chatWebsite.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.chatAccounts=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:502}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(c.chatAccounts,{id:e.resourceId})}),a=null;a=[],c.triggerAllConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.chatAccounts,{id:Number(e.value)});a.push(t)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(c.chatAccounts,{id:e.id});t.canSelect=!1,n.push(t)}}),c.chatAccounts=n})}else{var n=[],a=[];c.triggerAllConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.chatAccounts,{id:Number(e.value)});a.push(t)}});for(var i=0;i<c.chatAccounts.length;i++){_.some(a,{id:c.chatAccounts[i].id})&&(c.chatAccounts[i].canSelect=!1,n.push(c.chatAccounts[i]))}c.chatAccounts=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?l.mailAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.mailAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MAILACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.mailAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.mailAccounts=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:602}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(c.mailAccounts,{id:e.resourceId})}),a=null;a=[],c.triggerAllConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.mailAccounts,{id:Number(e.value)});a.push(t)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(c.mailAccounts,{id:e.id});t.canSelect=!1,n.push(t)}}),c.mailAccounts=n})}else{var n=[],a=[];c.triggerAllConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.mailAccounts,{id:Number(e.value)});a.push(t)}});for(var i=0;i<c.mailAccounts.length;i++){_.some(a,{id:c.mailAccounts[i].id})&&(c.mailAccounts[i].canSelect=!1,n.push(c.mailAccounts[i]))}c.mailAccounts=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?l.smsAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.smsAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SMSACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.smsAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.smsAccounts=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:702}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(c.smsAccounts,{id:e.resourceId})}),a=null;a=[],c.triggerAllConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.smsAccounts,{id:Number(e.value)});a.push(t)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(c.smsAccounts,{id:e.id});t.canSelect=!1,n.push(t)}}),c.smsAccounts=n})}else{var n=[],a=[];c.triggerAllConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.smsAccounts,{id:Number(e.value)});a.push(t)}});for(var i=0;i<c.smsAccounts.length;i++){_.some(a,{id:c.smsAccounts[i].id})&&(c.smsAccounts[i].canSelect=!1,n.push(c.smsAccounts[i]))}c.smsAccounts=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?l.faxAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.faxAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_FAXACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.faxAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.faxAccounts=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:902}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(c.faxAccounts,{id:e.resourceId})}),a=null;a=[],c.triggerAllConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.faxAccounts,{id:Number(e.value)});a.push(t)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(c.faxAccounts,{id:e.id});t.canSelect=!1,n.push(t)}}),c.faxAccounts=n})}else{var n=[],a=[];c.triggerAllConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.faxAccounts,{id:Number(e.value)});a.push(t)}});for(var i=0;i<c.faxAccounts.length;i++){_.some(a,{id:c.faxAccounts[i].id})&&(c.faxAccounts[i].canSelect=!1,n.push(c.faxAccounts[i]))}c.faxAccounts=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?l.openchannelAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.openchannelAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OPENCHANNELACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.openchannelAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.openchannelAccounts=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:802}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(c.openchannelAccounts,{id:e.resourceId})}),a=null;a=[],c.triggerAllConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.openchannelAccounts,{id:Number(e.value)});a.push(t)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(c.openchannelAccounts,{id:e.id});t.canSelect=!1,n.push(t)}}),c.openchannelAccounts=n})}else{var n=[],a=[];c.triggerAllConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.openchannelAccounts,{id:Number(e.value)});a.push(t)}});for(var i=0;i<c.openchannelAccounts.length;i++){_.some(a,{id:c.openchannelAccounts[i].id})&&(c.openchannelAccounts[i].canSelect=!1,n.push(c.openchannelAccounts[i]))}c.openchannelAccounts=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})});var m=[{id:401,type:"inbound"},{id:1501,type:"outbound"}],u=null;d.hasRole("admin")?l.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){c.queues=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){u=e.rows||[]}).then(function(){for(var e=[],t=0;t<m.length;t++)e.push(l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:m[t].id}).$promise);return o.all(e)}).then(function(e){for(var t=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),n=[],a=0;a<m.length;a++){var i=_.find(t,["sectionId",m[a].id]);if(i)if(i.autoAssociation){var s=[];u.forEach(function(e){e.type===m[a].type&&s.push(e)}),n.push({rows:s,count:s.length})}else n.push(l.userProfileResource.get({sectionId:i.id}).$promise)}return o.all(n)}).then(function(e){var n=[],a=[];c.triggerAllConditions.rows.forEach(function(e){if("queue"===e.field){var t=_.find(u,{name:e.value});a.push(t)}});for(var t=0;t<e.length;t++){(e[t].rows||[]).forEach(function(e){n.push(e)})}_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["resourceId",e.id])){var t=_.find(u,{id:e.id});t.canSelect=!1,n.push(t)}}),c.queues=n}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?l.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){c.outboundRoutes=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){c.outboundRoutes=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(c.outboundRoutes,{id:e.resourceId})}),a=null;a=[],c.triggerAllConditions.rows.forEach(function(e){if("routeId"===e.field){var t=_.find(c.outboundRoutes,{id:Number(e.value)});a.push(t)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(c.outboundRoutes,{id:e.id});t.canSelect=!1,n.push(t)}}),c.outboundRoutes=n})}else{var n=[],a=[];c.triggerAllConditions.rows.forEach(function(e){if("routeId"===e.field){var t=_.find(c.outboundRoutes,{id:Number(e.value)});a.push(t)}});for(var i=0;i<c.outboundRoutes.length;i++){_.some(a,{id:c.outboundRoutes[i].id})&&(c.outboundRoutes[i].canSelect=!1,n.push(c.outboundRoutes[i]))}c.outboundRoutes=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GEToutboundRoutes",msg:e.data?JSON.stringify(e.data):e.toString()})});var p=!0,g=1;function v(e){c.triggerAllConditions=e||{count:0,rows:[]}}function h(e){l.condition.delete({id:e.id}).$promise.then(function(){_.remove(c.triggerAllConditions.rows,{id:e.id}),c.triggerAllConditions.count-=1,c.triggerAllConditions.rows.length||c.getTriggerAllConditions(),r.success({title:"AllCondition deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETtrigger"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrigger",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){p?a(function(){p=!1}):(t||(g=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=g),c.getTriggerAllConditions())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.tools").controller("TriggerAllConditionsController",e)}(),function(){"use strict";function e(e,t,n,a,o,i,s,r,l,d,c,m,u,p,g){var v=this;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="TOOLS.EDIT_ALLCONDITION",v.allCondition=angular.copy(l),v.allconditions=r,v.newAllCondition=!1,v.trigger=angular.copy(d),v.allCondition||(v.allCondition={field:"queue",operator:"equals",value:"abandoned",value:"opened",value:"in"},v.title="TOOLS.NEW_ALLCONDITION",v.newAllCondition=!0),t.params.id&&(v.allCondition.TriggerAllId=t.params.id),v.addNewAllCondition=function(){v.errors=[],c.trigger.addAllCondition({id:t.params.id},v.allCondition).$promise.then(function(e){v.allconditions.unshift(e.toJSON()),s.success({title:"AllCondition properly created",msg:v.allCondition.name?v.allCondition.name+" has been created!":""}),b(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.condition.save"}];for(var t=0;t<e.data.errors.length;t+=1)s.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.saveAllCondition=function(){v.errors=[],c.condition.update({id:v.allCondition.id},v.allCondition).$promise.then(function(e){var t=_.find(v.allconditions,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),s.success({title:"AllCondition properly saved!",msg:v.allCondition.name?v.allCondition.name+" has been saved!":""}),b(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.condition.update"}];for(var t=0;t<e.data.errors.length;t++)s.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.deleteAllCondition=function(e){v.errors=[];var t=a.confirm().title("Are you sure?").content("The allCondition will be deleted.").ariaLabel("Delete AllCondition").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){c.condition.delete({id:v.allCondition.id}).$promise.then(function(){_.remove(v.allconditions,{id:v.allCondition.id}),s.success({title:"AllCondition properly deleted!",msg:(v.allCondition.name||"allCondition")+" has been deleted!"}),b(v.allCondition)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.condition.delete"}];for(var t=0;t<e.data.errors.length;t++)s.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else s.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(){})},v.getDateFromString=function(e){return null===e?void 0:new Date(e)},v.closeDialog=b,m.hasRole("admin")?c.chatWebsite.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.chatAccounts=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CHATACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.chatWebsite.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.chatAccounts=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:502}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return c.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(v.chatAccounts,{id:e.resourceId})}),n=null;if(v.allCondition&&(n=_.find(v.chatAccounts,{id:Number(v.allCondition.value)})),n&&!_.some(t,["id",n.id])){var a=_.find(v.chatAccounts,{id:n.id});a.canSelect=!1,t.push(a)}v.chatAccounts=t})}else{var n=[],a=null;v.allCondition&&(a=_.find(v.chatAccounts,{id:Number(v.allCondition.value)}));for(var i=0;i<v.chatAccounts.length;i++)a&&v.chatAccounts[i].id===a.id&&(v.chatAccounts[i].canSelect=!1,n.push(v.chatAccounts[i]));v.chatAccounts=n}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),m.hasRole("admin")?c.mailAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.mailAccounts=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MAILACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.mailAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.mailAccounts=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:602}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return c.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(v.mailAccounts,{id:e.resourceId})}),n=null;if(v.allCondition&&(n=_.find(v.mailAccounts,{id:Number(v.allCondition.value)})),n&&!_.some(t,["id",n.id])){var a=_.find(v.mailAccounts,{id:n.id});a.canSelect=!1,t.push(a)}v.mailAccounts=t})}else{var n=[],a=null;v.allCondition&&(a=_.find(v.mailAccounts,{id:Number(v.allCondition.value)}));for(var i=0;i<v.mailAccounts.length;i++)a&&v.mailAccounts[i].id===a.id&&(v.mailAccounts[i].canSelect=!1,n.push(v.mailAccounts[i]));v.mailAccounts=n}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),m.hasRole("admin")?c.smsAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.smsAccounts=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SMSACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.smsAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.smsAccounts=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:702}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return c.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(v.smsAccounts,{id:e.resourceId})}),n=null;if(v.allCondition&&(n=_.find(v.smsAccounts,{id:Number(v.allCondition.value)})),n&&!_.some(t,["id",n.id])){var a=_.find(v.smsAccounts,{id:n.id});a.canSelect=!1,t.push(a)}v.smsAccounts=t})}else{var n=[],a=null;v.allCondition&&(a=_.find(v.smsAccounts,{id:Number(v.allCondition.value)}));for(var i=0;i<v.smsAccounts.length;i++)a&&v.smsAccounts[i].id===a.id&&(v.smsAccounts[i].canSelect=!1,n.push(v.smsAccounts[i]));v.smsAccounts=n}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),m.hasRole("admin")?c.faxAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.faxAccounts=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_FAXACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.faxAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.faxAccounts=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:902}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return c.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(v.faxAccounts,{id:e.resourceId})}),n=null;if(v.allCondition&&(n=_.find(v.faxAccounts,{id:Number(v.allCondition.value)})),n&&!_.some(t,["id",n.id])){var a=_.find(v.faxAccounts,{id:n.id});a.canSelect=!1,t.push(a)}v.faxAccounts=t})}else{var n=[],a=null;v.allCondition&&(a=_.find(v.faxAccounts,{id:Number(v.allCondition.value)}));for(var i=0;i<v.faxAccounts.length;i++)a&&v.faxAccounts[i].id===a.id&&(v.faxAccounts[i].canSelect=!1,n.push(v.faxAccounts[i]));v.faxAccounts=n}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),m.hasRole("admin")?c.openchannelAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.openchannelAccounts=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OPENCHANNELACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.openchannelAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.openchannelAccounts=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:802}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return c.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(v.openchannelAccounts,{id:e.resourceId})}),n=null;if(v.allCondition&&(n=_.find(v.openchannelAccounts,{id:Number(v.allCondition.value)})),n&&!_.some(t,["id",n.id])){var a=_.find(v.openchannelAccounts,{id:n.id});a.canSelect=!1,t.push(a)}v.openchannelAccounts=t})}else{var n=[],a=null;v.allCondition&&(a=_.find(v.openchannelAccounts,{id:Number(v.allCondition.value)}));for(var i=0;i<v.openchannelAccounts.length;i++)a&&v.openchannelAccounts[i].id===a.id&&(v.openchannelAccounts[i].canSelect=!1,n.push(v.openchannelAccounts[i]));v.openchannelAccounts=n}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})});var h=[{id:401,type:"inbound"},{id:1501,type:"outbound"}],f=null;function b(e){a.hide(e)}m.hasRole("admin")?c.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){v.queues=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){f=e.rows||[]}).then(function(){for(var e=[],t=0;t<h.length;t++)e.push(c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:h[t].id}).$promise);return o.all(e)}).then(function(e){for(var t=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),n=[],a=0;a<h.length;a++){var i=_.find(t,["sectionId",h[a].id]);if(i)if(i.autoAssociation){var s=[];f.forEach(function(e){e.type===h[a].type&&s.push(e)}),n.push({rows:s,count:s.length})}else n.push(c.userProfileResource.get({sectionId:i.id}).$promise)}return o.all(n)}).then(function(e){var t=[],n=null;v.allCondition&&(n=_.find(f,{name:v.allCondition.value}));for(var a=0;a<e.length;a++){(e[a].rows||[]).forEach(function(e){t.push(e)})}n&&!_.some(t,["resourceId",n.id])&&f.forEach(function(e){e.id===n.id&&(e.canSelect=!1,t.push(e))}),v.queues=t}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})}),m.hasRole("admin")?c.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){v.outboundRoutes=e.rows||[]}).catch(function(e){s.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){v.outboundRoutes=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return c.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(v.outboundRoutes,{id:e.resourceId})}),n=null;if(v.allCondition&&(n=_.find(v.outboundRoutes,{id:Number(v.allCondition.value)})),n&&!_.some(t,["id",n.id])){var a=_.find(v.outboundRoutes,{id:n.id});a.canSelect=!1,t.push(a)}v.outboundRoutes=t})}else{var n=[],a=null;v.allCondition&&(a=_.find(v.outboundRoutes,{id:Number(v.allCondition.value)}));for(var i=0;i<v.outboundRoutes.length;i++)a&&v.outboundRoutes[i].id===a.id&&(v.outboundRoutes[i].canSelect=!1,n.push(v.outboundRoutes[i]));v.outboundRoutes=n}}).catch(function(e){s.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","allconditions","allCondition","trigger","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditAllConditionDialogController",e)}(),function(){"use strict";function e(e,t,n,o,a,i,s,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.trigger={},c.triggerAnyConditions={count:0,rows:[]},c.selectedTriggerAnyConditions=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,field,operator,value",limit:10,page:1},c.arrayfield=_.keyBy([{option:"Queue",value:"'queue'",ngIf:"vm.trigger.channel == 'voice'"},{option:"Call_Status",value:"'lastevent'",ngIf:"vm.trigger.channel == 'voice'"},{option:"OutboundRoute",value:"'routeId'",ngIf:"vm.trigger.channel == 'voice'"},{option:"Account",value:"'account'",ngIf:"vm.trigger.channel != 'voice'"},{option:"Interaction",value:"'interaction'",ngIf:"vm.trigger.channel != 'voice'"},{option:"Message",value:"'message'",ngIf:"vm.trigger.channel != 'voice'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.arrayoperator=_.keyBy([{option:"Equals",value:"'equals'"},{option:"Not_Equals",value:"'not_equals'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.callStatusValues=_.keyBy([{option:"Abandon",value:"'abandoned'"},{option:"Hangup",value:"'complete'"},{option:"Reject",value:"'rejected'"},{option:"Ring",value:"'called'"},{option:"Answer",value:"'connect'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.interactionStatusValues=_.keyBy([{option:"Opened",value:"'opened'"},{option:"Closed",value:"'closed'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.messageStatusValues=_.keyBy([{option:"Incoming",value:"'in'"},{option:"Outgoing",value:"'out'"},{option:"Accepted",value:"'accept'"},{option:"Rejected",value:"'reject'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),c.init=function(e,t){c.trigger=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.trigger.id,c.query.TriggerAnyId=c.trigger.id,c.getTriggerAnyConditions()},c.deleteConfirm=function(e,t){var n=i.confirm().title("Are you sure want to delete the anyCondition?").htmlContent("<b>"+(e.name||"anyCondition")+"</b> will be deleted.").ariaLabel("delete anyCondition").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){h(e)},function(){console.log("CANCEL")})},c.success=v,c.getTriggerAnyConditions=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.trigger.getAnyConditions(c.query,v).$promise},c.createOrEditTriggerAnyCondition=function(e,t){i.show({controller:"CreateOrEditAnyConditionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/triggers/edit/anyconditions/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{trigger:c.trigger,anyCondition:t,anyconditions:c.triggerAnyConditions.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedTriggerAnyConditions=function(){var e=angular.copy(c.selectedTriggerAnyConditions);return c.selectedTriggerAnyConditions=[],e},c.deleteTriggerAnyCondition=h,c.deleteSelectedTriggerAnyConditions=function(e){var t=i.confirm().title("Are you sure want to delete the selected anyconditions?").htmlContent("<b>"+c.selectedTriggerAnyConditions.length+" selected</b> will be deleted.").ariaLabel("delete anyconditions").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){c.selectedTriggerAnyConditions.forEach(function(e){h(e)}),c.selectedTriggerAnyConditions=[]})},d.hasRole("admin")?l.chatWebsite.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.chatAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CHATACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.chatWebsite.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.chatAccounts=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:502}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(c.chatAccounts,{id:e.resourceId})}),a=null;a=[],c.triggerAnyConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.chatAccounts,{id:Number(e.value)});a.push(t)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(c.chatAccounts,{id:e.id});t.canSelect=!1,n.push(t)}}),c.chatAccounts=n})}else{var n=[],a=[];c.triggerAnyConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.chatAccounts,{id:Number(e.value)});a.push(t)}});for(var i=0;i<c.chatAccounts.length;i++){_.some(a,{id:c.chatAccounts[i].id})&&(c.chatAccounts[i].canSelect=!1,n.push(c.chatAccounts[i]))}c.chatAccounts=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?l.mailAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.mailAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MAILACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.mailAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.mailAccounts=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:602}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(c.mailAccounts,{id:e.resourceId})}),a=null;a=[],c.triggerAnyConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.mailAccounts,{id:Number(e.value)});a.push(t)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(c.mailAccounts,{id:e.id});t.canSelect=!1,n.push(t)}}),c.mailAccounts=n})}else{var n=[],a=[];c.triggerAnyConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.mailAccounts,{id:Number(e.value)});a.push(t)}});for(var i=0;i<c.mailAccounts.length;i++){_.some(a,{id:c.mailAccounts[i].id})&&(c.mailAccounts[i].canSelect=!1,n.push(c.mailAccounts[i]))}c.mailAccounts=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?l.smsAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.smsAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SMSACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.smsAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.smsAccounts=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:702}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(c.smsAccounts,{id:e.resourceId})}),a=null;a=[],c.triggerAnyConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.smsAccounts,{id:Number(e.value)});a.push(t)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(c.smsAccounts,{id:e.id});t.canSelect=!1,n.push(t)}}),c.smsAccounts=n})}else{var n=[],a=[];c.triggerAnyConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.smsAccounts,{id:Number(e.value)});a.push(t)}});for(var i=0;i<c.smsAccounts.length;i++){_.some(a,{id:c.smsAccounts[i].id})&&(c.smsAccounts[i].canSelect=!1,n.push(c.smsAccounts[i]))}c.smsAccounts=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?l.faxAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.faxAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_FAXACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.faxAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.faxAccounts=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:902}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(c.faxAccounts,{id:e.resourceId})}),a=null;a=[],c.triggerAnyConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.faxAccounts,{id:Number(e.value)});a.push(t)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(c.faxAccounts,{id:e.id});t.canSelect=!1,n.push(t)}}),c.faxAccounts=n})}else{var n=[],a=[];c.triggerAnyConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.faxAccounts,{id:Number(e.value)});a.push(t)}});for(var i=0;i<c.faxAccounts.length;i++){_.some(a,{id:c.faxAccounts[i].id})&&(c.faxAccounts[i].canSelect=!1,n.push(c.faxAccounts[i]))}c.faxAccounts=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?l.openchannelAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.openchannelAccounts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OPENCHANNELACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.openchannelAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){c.openchannelAccounts=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:802}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(c.openchannelAccounts,{id:e.resourceId})}),a=null;a=[],c.triggerAnyConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.openchannelAccounts,{id:Number(e.value)});a.push(t)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(c.openchannelAccounts,{id:e.id});t.canSelect=!1,n.push(t)}}),c.openchannelAccounts=n})}else{var n=[],a=[];c.triggerAnyConditions.rows.forEach(function(e){if("account"===e.field){var t=_.find(c.openchannelAccounts,{id:Number(e.value)});a.push(t)}});for(var i=0;i<c.openchannelAccounts.length;i++){_.some(a,{id:c.openchannelAccounts[i].id})&&(c.openchannelAccounts[i].canSelect=!1,n.push(c.openchannelAccounts[i]))}c.openchannelAccounts=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})});var m=[{id:401,type:"inbound"},{id:1501,type:"outbound"}],u=null;d.hasRole("admin")?l.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){c.queues=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){u=e.rows||[]}).then(function(){for(var e=[],t=0;t<m.length;t++)e.push(l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:m[t].id}).$promise);return o.all(e)}).then(function(e){for(var t=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),n=[],a=0;a<m.length;a++){var i=_.find(t,["sectionId",m[a].id]);if(i)if(i.autoAssociation){var s=[];u.forEach(function(e){e.type===m[a].type&&s.push(e)}),n.push({rows:s,count:s.length})}else n.push(l.userProfileResource.get({sectionId:i.id}).$promise)}return o.all(n)}).then(function(e){var n=[],a=[];c.triggerAnyConditions.rows.forEach(function(e){if("queue"===e.field){var t=_.find(u,{name:e.value});a.push(t)}});for(var t=0;t<e.length;t++){(e[t].rows||[]).forEach(function(e){n.push(e)})}_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["resourceId",e.id])){var t=_.find(u,{id:e.id});t.canSelect=!1,n.push(t)}}),c.queues=n}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?l.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){c.outboundRoutes=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){c.outboundRoutes=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(c.outboundRoutes,{id:e.resourceId})}),a=null;a=[],c.triggerAnyConditions.rows.forEach(function(e){if("routeId"===e.field){var t=_.find(c.outboundRoutes,{id:Number(e.value)});a.push(t)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(n,["id",e.id])){var t=_.find(c.outboundRoutes,{id:e.id});t.canSelect=!1,n.push(t)}}),c.outboundRoutes=n})}else{var n=[],a=[];c.triggerAnyConditions.rows.forEach(function(e){if("routeId"===e.field){var t=_.find(c.outboundRoutes,{id:Number(e.value)});a.push(t)}});for(var i=0;i<c.outboundRoutes.length;i++){_.some(a,{id:c.outboundRoutes[i].id})&&(c.outboundRoutes[i].canSelect=!1,n.push(c.outboundRoutes[i]))}c.outboundRoutes=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GEToutboundRoutes",msg:e.data?JSON.stringify(e.data):e.toString()})});var p=!0,g=1;function v(e){c.triggerAnyConditions=e||{count:0,rows:[]}}function h(e){l.condition.delete({id:e.id}).$promise.then(function(){_.remove(c.triggerAnyConditions.rows,{id:e.id}),c.triggerAnyConditions.count-=1,c.triggerAnyConditions.rows.length||c.getTriggerAnyConditions(),r.success({title:"AnyCondition deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETtrigger"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrigger",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){p?a(function(){p=!1}):(t||(g=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=g),c.getTriggerAnyConditions())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.tools").controller("TriggerAnyConditionsController",e)}(),function(){"use strict";function e(e,t,n,a,o,i,s,r,l,d,c,m,u,p,g){var v=this;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="TOOLS.EDIT_ANYCONDITION",v.anyCondition=angular.copy(l),v.anyconditions=r,v.newAnyCondition=!1,v.trigger=angular.copy(d),v.anyCondition||(v.anyCondition={field:"queue",operator:"equals",value:"abandoned",value:"opened",value:"in"},v.title="TOOLS.NEW_ANYCONDITION",v.newAnyCondition=!0),t.params.id&&(v.anyCondition.TriggerAnyId=t.params.id),v.addNewAnyCondition=function(){v.errors=[],c.trigger.addAnyCondition({id:t.params.id},v.anyCondition).$promise.then(function(e){v.anyconditions.unshift(e.toJSON()),s.success({title:"AnyCondition properly created",msg:v.anyCondition.name?v.anyCondition.name+" has been created!":""}),b(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.condition.save"}];for(var t=0;t<e.data.errors.length;t+=1)s.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.saveAnyCondition=function(){v.errors=[],c.condition.update({id:v.anyCondition.id},v.anyCondition).$promise.then(function(e){var t=_.find(v.anyconditions,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),s.success({title:"AnyCondition properly saved!",msg:v.anyCondition.name?v.anyCondition.name+" has been saved!":""}),b(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.condition.update"}];for(var t=0;t<e.data.errors.length;t++)s.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.deleteAnyCondition=function(e){v.errors=[];var t=a.confirm().title("Are you sure?").content("The anyCondition will be deleted.").ariaLabel("Delete AnyCondition").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){c.condition.delete({id:v.anyCondition.id}).$promise.then(function(){_.remove(v.anyconditions,{id:v.anyCondition.id}),s.success({title:"AnyCondition properly deleted!",msg:(v.anyCondition.name||"anyCondition")+" has been deleted!"}),b(v.anyCondition)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.condition.delete"}];for(var t=0;t<e.data.errors.length;t++)s.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else s.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(){})},v.getDateFromString=function(e){return null===e?void 0:new Date(e)},v.closeDialog=b,m.hasRole("admin")?c.chatWebsite.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.chatAccounts=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CHATACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.chatWebsite.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.chatAccounts=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:502}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return c.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(v.chatAccounts,{id:e.resourceId})}),n=null;if(v.anyCondition&&(n=_.find(v.chatAccounts,{id:Number(v.anyCondition.value)})),n&&!_.some(t,["id",n.id])){var a=_.find(v.chatAccounts,{id:n.id});a.canSelect=!1,t.push(a)}v.chatAccounts=t})}else{var n=[],a=null;v.anyCondition&&(a=_.find(v.chatAccounts,{id:Number(v.anyCondition.value)}));for(var i=0;i<v.chatAccounts.length;i++)a&&v.chatAccounts[i].id===a.id&&(v.chatAccounts[i].canSelect=!1,n.push(v.chatAccounts[i]));v.chatAccounts=n}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),m.hasRole("admin")?c.mailAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.mailAccounts=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MAILACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.mailAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.mailAccounts=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:602}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return c.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(v.mailAccounts,{id:e.resourceId})}),n=null;if(v.anyCondition&&(n=_.find(v.mailAccounts,{id:Number(v.anyCondition.value)})),n&&!_.some(t,["id",n.id])){var a=_.find(v.mailAccounts,{id:n.id});a.canSelect=!1,t.push(a)}v.mailAccounts=t})}else{var n=[],a=null;v.anyCondition&&(a=_.find(v.mailAccounts,{id:Number(v.anyCondition.value)}));for(var i=0;i<v.mailAccounts.length;i++)a&&v.mailAccounts[i].id===a.id&&(v.mailAccounts[i].canSelect=!1,n.push(v.mailAccounts[i]));v.mailAccounts=n}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),m.hasRole("admin")?c.smsAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.smsAccounts=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SMSACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.smsAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.smsAccounts=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:702}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return c.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(v.smsAccounts,{id:e.resourceId})}),n=null;if(v.anyCondition&&(n=_.find(v.smsAccounts,{id:Number(v.anyCondition.value)})),n&&!_.some(t,["id",n.id])){var a=_.find(v.smsAccounts,{id:n.id});a.canSelect=!1,t.push(a)}v.smsAccounts=t})}else{var n=[],a=null;v.anyCondition&&(a=_.find(v.smsAccounts,{id:Number(v.anyCondition.value)}));for(var i=0;i<v.smsAccounts.length;i++)a&&v.smsAccounts[i].id===a.id&&(v.smsAccounts[i].canSelect=!1,n.push(v.smsAccounts[i]));v.smsAccounts=n}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),m.hasRole("admin")?c.faxAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.faxAccounts=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_FAXACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.faxAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.faxAccounts=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:902}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return c.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(v.faxAccounts,{id:e.resourceId})}),n=null;if(v.anyCondition&&(n=_.find(v.faxAccounts,{id:Number(v.anyCondition.value)})),n&&!_.some(t,["id",n.id])){var a=_.find(v.faxAccounts,{id:n.id});a.canSelect=!1,t.push(a)}v.faxAccounts=t})}else{var n=[],a=null;v.anyCondition&&(a=_.find(v.faxAccounts,{id:Number(v.anyCondition.value)}));for(var i=0;i<v.faxAccounts.length;i++)a&&v.faxAccounts[i].id===a.id&&(v.faxAccounts[i].canSelect=!1,n.push(v.faxAccounts[i]));v.faxAccounts=n}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})}),m.hasRole("admin")?c.openchannelAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.openchannelAccounts=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OPENCHANNELACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.openchannelAccount.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){v.openchannelAccounts=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:802}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return c.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(v.openchannelAccounts,{id:e.resourceId})}),n=null;if(v.anyCondition&&(n=_.find(v.openchannelAccounts,{id:Number(v.anyCondition.value)})),n&&!_.some(t,["id",n.id])){var a=_.find(v.openchannelAccounts,{id:n.id});a.canSelect=!1,t.push(a)}v.openchannelAccounts=t})}else{var n=[],a=null;v.anyCondition&&(a=_.find(v.openchannelAccounts,{id:Number(v.anyCondition.value)}));for(var i=0;i<v.openchannelAccounts.length;i++)a&&v.openchannelAccounts[i].id===a.id&&(v.openchannelAccounts[i].canSelect=!1,n.push(v.openchannelAccounts[i]));v.openchannelAccounts=n}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})});var h=[{id:401,type:"inbound"},{id:1501,type:"outbound"}],f=null;function b(e){a.hide(e)}m.hasRole("admin")?c.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){v.queues=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){f=e.rows||[]}).then(function(){for(var e=[],t=0;t<h.length;t++)e.push(c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:h[t].id}).$promise);return o.all(e)}).then(function(e){for(var t=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),n=[],a=0;a<h.length;a++){var i=_.find(t,["sectionId",h[a].id]);if(i)if(i.autoAssociation){var s=[];f.forEach(function(e){e.type===h[a].type&&s.push(e)}),n.push({rows:s,count:s.length})}else n.push(c.userProfileResource.get({sectionId:i.id}).$promise)}return o.all(n)}).then(function(e){var t=[],n=null;v.anyCondition&&(n=_.find(f,{name:v.anyCondition.value}));for(var a=0;a<e.length;a++){(e[a].rows||[]).forEach(function(e){t.push(e)})}n&&!_.some(t,["resourceId",n.id])&&f.forEach(function(e){e.id===n.id&&(e.canSelect=!1,t.push(e))}),v.queues=t}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})}),m.hasRole("admin")?c.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){v.outboundRoutes=e.rows||[]}).catch(function(e){s.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){v.outboundRoutes=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return c.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(v.outboundRoutes,{id:e.resourceId})}),n=null;if(v.anyCondition&&(n=_.find(v.outboundRoutes,{id:Number(v.anyCondition.value)})),n&&!_.some(t,["id",n.id])){var a=_.find(v.outboundRoutes,{id:n.id});a.canSelect=!1,t.push(a)}v.outboundRoutes=t})}else{var n=[],a=null;v.anyCondition&&(a=_.find(v.outboundRoutes,{id:Number(v.anyCondition.value)}));for(var i=0;i<v.outboundRoutes.length;i++)a&&v.outboundRoutes[i].id===a.id&&(v.outboundRoutes[i].canSelect=!1,n.push(v.outboundRoutes[i]));v.outboundRoutes=n}}).catch(function(e){s.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","anyconditions","anyCondition","trigger","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditAnyConditionDialogController",e)}(),function(){"use strict";function e(e,t,n,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=t.protocol()+"://"+t.host(),u.trigger=c||e.params.trigger||{},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.gotoTriggers=function(){e.go("app.tools.triggers")},u.saveTrigger=function(){r.trigger.update({id:u.trigger.id},u.trigger).$promise.then(function(){l.success({title:"Trigger updated!",msg:u.trigger.name?u.trigger.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrigger",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","trigger","userProfileSection"],angular.module("app.tools").controller("TriggerController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.triggers=l||{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="triggers",b.listOrder="",b.listOrderAsc=null,b.selectedTriggers=[],b.query={fields:"createdAt,updatedAt,id,name,channel,status,description",sort:"-updatedAt",limit:10,page:1},b.arraychannel=_.keyBy([{option:"Voice",value:"'voice'"},{option:"Openchannel",value:"'openchannel'",ngIf:"vm.license.openchannel"},{option:"Chat",value:"'chat'",ngIf:"vm.license.chat"},{option:"Mail",value:"'mail'",ngIf:"vm.license.mail"},{option:"Sms",value:"'sms'",ngIf:"vm.license.messaging"},{option:"Fax",value:"'fax'",ngIf:"vm.license.fax"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.tools.triggers.edit",{id:e.id,trigger:e,crudPermissions:b.crudPermissions})},b.deleteconfirm=function(e,t){var n=i.confirm().title("Are you sure want to delete the "+_.startCase("trigger")+"?").htmlContent("<b>"+(e.name||"trigger")+"</b> will be deleted.").ariaLabel("delete trigger").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getTriggers=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.trigger.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Triggers",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditTrigger=function(e,t){i.show({controller:"CreateOrEditTriggerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/triggers/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{trigger:t,triggers:b.triggers.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteTrigger=S,b.exportSelectedTriggers=function(){var e=angular.copy(b.selectedTriggers);return b.selectedTriggers=[],e},b.deleteSelectedTriggers=function(e){var t=i.confirm().title("Are you sure want to delete the selected triggers?").htmlContent("<b>"+b.selectedTriggers.length+" selected</b> will be deleted.").ariaLabel("delete Triggers").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedTriggers.forEach(function(e){S(e)}),b.selectedTriggers=[]})},b.deselectTriggers=function(){b.selectedTriggers=[]},b.selectAllTriggers=function(){b.selectedTriggers=b.triggers.rows};var E=!0,A=1;function y(e){b.triggers=e||{count:0,rows:[]}}function S(e){m.trigger.delete({id:e.id}).$promise.then(function(){_.remove(b.triggers.rows,{id:e.id}),b.triggers.count-=1,b.triggers.rows.length||b.getTriggers(),p.success({title:_.startCase("Trigger")+" 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:DELETEtrigger"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEtrigger",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getTriggers())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","triggers","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.tools").controller("TriggersController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.trunks,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The trunk will be deleted.").ariaLabel("Delete Trunk").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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(t,n,a,e,i,s,o){var r=this;function l(e){t.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!":""}),n.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 t=0;t<e.data.errors.length;t+=1)a.error({title:e.data.errors[t].type,msg:e.data.errors[t].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(n,e,a,i,s,t,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=t,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.trunk=c||n.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=n.params.tab||0,u.gotogoto=function(e,t){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:411}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.voice.realtime.trunks",{})}},u.clonedialog=function(e,t){a.show({controller:"TrunkcloneController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/trunks/edit/clone/clone.html",parent:angular.element(i.body),targetEvent:t,clickOutsideToClose:!0,locals:{trunk:e,trunks:u.trunks?u.trunks.rows:[],crudPermissions:u.crudPermissions}})},u.alert=l.info,u.gotoTrunks=function(){n.go("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 t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.contexts,{id:e.resourceId})}),n=null;if(u.trunk&&(n=_.find(u.contexts,{name:u.trunk.context})),n&&!_.some(t,["id",n.id])){var a=_.find(u.contexts,{id:n.id});a.canSelect=!1,t.push(a)}u.contexts=t}):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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.trunks=l||{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="trunks",b.listOrder="",b.listOrderAsc=null,b.selectedTrunks=[],b.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},b.arraytype=_.keyBy([{option:"Friend",value:"'friend'"},{option:"User",value:"'user'"},{option:"Peer",value:"'peer'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.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"),"")}),b.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"),"")}),b.arrayqualify=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.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"),"")}),b.arrayinsecure=_.keyBy([{option:"port",value:"'port'"},{option:"invite",value:"'invite'"},{option:"very",value:"'very'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.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"),"")}),b.arraycallcounter=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arrayusereqphone=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arraytrustrpid=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arraysendrpid=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"},{option:"pai",value:"'pai'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arrayencryption=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.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"),"")}),b.arrayvideosupport=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Always",value:"'always'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.tools.trunks.edit",{id:e.id,trunk:e,crudPermissions:b.crudPermissions})},b.clonedialog=function(e,t){i.show({controller:"TrunkcloneController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/trunks/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{trunk:e,trunks:b.trunks?b.trunks.rows:[],crudPermissions:b.crudPermissions}})},b.gotorealtimegoto=function(e,t){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:411}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.voice.realtime.trunks",{})}},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getTrunks=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.trunk.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Trunks",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditTrunk=function(e,t){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:t,trunks:b.trunks.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteTrunk=S,b.exportSelectedTrunks=function(){var e=angular.copy(b.selectedTrunks);return b.selectedTrunks=[],e},b.deleteSelectedTrunks=function(e){var t=i.confirm().title("Are you sure want to delete the selected trunks?").htmlContent("<b>"+b.selectedTrunks.length+" selected</b> will be deleted.").ariaLabel("delete Trunks").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedTrunks.forEach(function(e){S(e)}),b.selectedTrunks=[]})},b.deselectTrunks=function(){b.selectedTrunks=[]},b.selectAllTrunks=function(){b.selectedTrunks=b.trunks.rows};var E=!0,A=1;function y(e){b.trunks=e||{count:0,rows:[]}}function S(e){m.trunk.delete({id:e.id}).$promise.then(function(){_.remove(b.trunks.rows,{id:e.id}),b.trunks.count-=1,b.trunks.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEtrunk"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getTrunks())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","trunks","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.tools").controller("TrunksController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.variables,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The variable will be deleted.").ariaLabel("Delete Variable").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.variables=l||{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="variables",b.listOrder="",b.listOrderAsc=null,b.selectedVariables=[],b.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},b.editdialog=function(e,t){i.show({controller:"CreateOrEditVariableDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/variables/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{variable:e,variables:b.variables.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getVariables=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.variable.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Variables",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditVariable=function(e,t){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:t,variables:b.variables.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteVariable=S,b.exportSelectedVariables=function(){var e=angular.copy(b.selectedVariables);return b.selectedVariables=[],e},b.deleteSelectedVariables=function(e){var t=i.confirm().title("Are you sure want to delete the selected variables?").htmlContent("<b>"+b.selectedVariables.length+" selected</b> will be deleted.").ariaLabel("delete Variables").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedVariables.forEach(function(e){S(e)}),b.selectedVariables=[]})},b.deselectVariables=function(){b.selectedVariables=[]},b.selectAllVariables=function(){b.selectedVariables=b.variables.rows};var E=!0,A=1;function y(e){b.variables=e||{count:0,rows:[]}}function S(e){m.variable.delete({id:e.id}).$promise.then(function(){_.remove(b.variables.rows,{id:e.id}),b.variables.count-=1,b.variables.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvariable"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getVariables())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","variables","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.tools").controller("VariablesController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.chanSpies=l||{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="chanSpies",b.listOrder="",b.listOrderAsc=null,b.selectedChanSpies=[],b.query={fields:"createdAt,updatedAt,id,name,prefix,options,auth,password,record,recordingFormat,description",sort:"-updatedAt",limit:10,page:1},b.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"),"")}),b.arrayrecordingFormat=_.keyBy([{option:"wav",value:"'wav'"},{option:"gsm",value:"'gsm'"},{option:"wav49",value:"'WAV'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editdialog=function(e,t){i.show({controller:"CreateOrEditchanSpyDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/chanSpies/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{chanSpy:e,chanSpies:b.chanSpies.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getChanSpies=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.voiceChanSpy.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="ChanSpies",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditchanSpy=function(e,t){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:t,chanSpies:b.chanSpies.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deletechanSpy=S,b.exportSelectedChanSpies=function(){var e=angular.copy(b.selectedChanSpies);return b.selectedChanSpies=[],e},b.deleteSelectedChanSpies=function(e){var t=i.confirm().title("Are you sure want to delete the selected chanSpies?").htmlContent("<b>"+b.selectedChanSpies.length+" selected</b> will be deleted.").ariaLabel("delete chanSpys").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedChanSpies.forEach(function(e){S(e)}),b.selectedChanSpies=[]})},b.deselectChanSpies=function(){b.selectedChanSpies=[]},b.selectAllChanSpies=function(){b.selectedChanSpies=b.chanSpies.rows};var E=!0,A=1;function y(e){b.chanSpies=e||{count:0,rows:[]}}function S(e){m.voiceChanSpy.delete({id:e.id}).$promise.then(function(){_.remove(b.chanSpies.rows,{id:e.id}),b.chanSpies.count-=1,b.chanSpies.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceChanSpy"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getChanSpies())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","chanSpies","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.voice").controller("ChanSpiesController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.chanSpies,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The chanSpy will be deleted.").ariaLabel("Delete chanSpy").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.contexts=l||{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="contexts",b.listOrder="",b.listOrderAsc=null,b.selectedContexts=[],b.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",defaultEntry:"false",limit:10,page:1},b.editdialog=function(e,t){i.show({controller:"CreateOrEditContextDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/contexts/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{context:e,contexts:b.contexts.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getContexts=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.voiceContext.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Contexts",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditContext=function(e,t){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:t,contexts:b.contexts.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteContext=S,b.exportSelectedContexts=function(){var e=angular.copy(b.selectedContexts);return b.selectedContexts=[],e},b.deleteSelectedContexts=function(e){var t=i.confirm().title("Are you sure want to delete the selected contexts?").htmlContent("<b>"+b.selectedContexts.length+" selected</b> will be deleted.").ariaLabel("delete Contexts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedContexts.forEach(function(e){S(e)}),b.selectedContexts=[]})},b.deselectContexts=function(){b.selectedContexts=[]},b.selectAllContexts=function(){b.selectedContexts=b.contexts.rows};var E=!0,A=1;function y(e){b.contexts=e||{count:0,rows:[]}}function S(e){m.voiceContext.delete({id:e.id}).$promise.then(function(){_.remove(b.contexts.rows,{id:e.id}),b.contexts.count-=1,b.contexts.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceContext"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getContexts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","contexts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.voice").controller("ContextsController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.contexts,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The context will be deleted.").ariaLabel("Delete Context").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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(e,t,n,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_INBOUNDROUTE",g.inboundroute=angular.copy(l),g.inboundroutes=r,g.newInboundRoute=!1,g.inboundroute||(g.inboundroute={appdata:"Inbound Call",type:"inbound",context:"from-voip-provider"},g.title="VOICE.NEW_INBOUNDROUTE",g.newInboundRoute=!0),g.addNewInboundRoute=function(){g.errors=[],d.voiceExtension.save(g.inboundroute).$promise.then(function(e){g.inboundroutes.unshift(e.toJSON()),o.success({title:"InboundRoute properly created",msg:g.inboundroute.name?g.inboundroute.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.voiceExtension.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveInboundRoute=function(){g.errors=[],d.voiceExtension.update({id:g.inboundroute.id},g.inboundroute).$promise.then(function(e){var t=_.find(g.inboundroutes,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"InboundRoute properly saved!",msg:g.inboundroute.name?g.inboundroute.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.voiceExtension.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteInboundRoute=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The inboundroute will be deleted.").ariaLabel("Delete InboundRoute").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.voiceExtension.delete({id:g.inboundroute.id}).$promise.then(function(){_.remove(g.inboundroutes,{id:g.inboundroute.id}),o.success({title:"InboundRoute properly deleted!",msg:(g.inboundroute.name||"inboundroute")+" has been deleted!"}),v(g.inboundroute)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.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.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.contexts=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.contexts=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.contexts,{id:e.resourceId})}),n=null;if(g.inboundroute&&(n=_.find(g.contexts,{name:g.inboundroute.context})),n&&!_.some(t,["id",n.id])){var a=_.find(g.contexts,{id:n.id});a.canSelect=!1,t.push(a)}g.contexts=t}):d.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){g.contexts=e.rows||[]})}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","inboundroutes","inboundroute","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditInboundRouteDialogController",e)}(),function(){"use strict";function e(m,i,a,s,e){var u=this;function t(e,t){if(u.inboundrouteApps.rows.length){var n=u.inboundrouteApps.rows[t]?u.inboundrouteApps.rows[t]:u.inboundrouteApps.rows[0];i.show({controller:"EditInboundApp"+(n.appType||n.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/inboundroutes/edit/apps/"+(n.appType||n.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{inboundrouteApp:n,inboundroute:u.inboundroute,crudPermissions:u.crudPermissions}}).then(function(e){e&&(e.id?u.inboundrouteApps.rows[t]=e:u.inboundrouteApps.rows.splice(t,0,e),o())}).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 o(){var e=["queue","playback"],t=2,n=[];n.push({type:"inbound",app:"Set",appdata:"CDR(type)=inbound",context:u.inboundroute.context,exten:u.inboundroute.exten,priority:t++,VoiceExtensionId:u.inboundroute.id}),n.push({type:"inbound",app:"Set",appdata:"XCALLY-MOTION-ANSWER=0",context:u.inboundroute.context,exten:u.inboundroute.exten,priority:t++,VoiceExtensionId:u.inboundroute.id}),n.push({type:"inbound",app:"Set",appdata:"XCALLY-MOTION-PROGRESS=0",context:u.inboundroute.context,exten:u.inboundroute.exten,priority:t++,VoiceExtensionId:u.inboundroute.id}),n.push({type:"inbound",app:"Set",appdata:"MONITOR_OPTIONS=ab",context:u.inboundroute.context,exten:u.inboundroute.exten,priority:t++,VoiceExtensionId:u.inboundroute.id});for(var a=0,i=0;a<u.inboundrouteApps.rows.length;a++,i=0){var s=u.inboundrouteApps.rows[a],o=[],r=[];s.intervals="*,*,*,*"!==s.interval?[s.interval]:s.IntervalId?_.map(_.filter(u.intervals.rows,{IntervalId:s.IntervalId}),"interval"):[],s.context=u.inboundroute.context,s.exten=u.inboundroute.exten,s.type&&(s.type=s.type.toLowerCase()),s.hasOwnProperty("answer")&&e.includes(s.app.toLowerCase())&&"custom"!==s.appType&&(s.answer?(o.push({type:s.type.toLowerCase(),app:"ExecIf",appdata:"$[${XCALLY-MOTION-ANSWER}=0]?Answer",context:u.inboundroute.context,exten:u.inboundroute.exten,priority:s.intervals.length+t+i++,VoiceExtensionId:u.inboundroute.id}),o.push({type:s.type.toLowerCase(),app:"Set",appdata:"XCALLY-MOTION-ANSWER=1",context:u.inboundroute.context,exten:u.inboundroute.exten,priority:s.intervals.length+t+i++,VoiceExtensionId:u.inboundroute.id})):(o.push({type:s.type.toLowerCase(),app:"ExecIf",appdata:"$[${XCALLY-MOTION-PROGRESS}=0]?Progress",context:u.inboundroute.context,exten:u.inboundroute.exten,priority:s.intervals.length+t+i++,VoiceExtensionId:u.inboundroute.id}),o.push({type:s.type.toLowerCase(),app:"Set",appdata:"XCALLY-MOTION-PROGRESS=1",context:u.inboundroute.context,exten:u.inboundroute.exten,priority:s.intervals.length+t+i++,VoiceExtensionId:u.inboundroute.id})));for(var l=0;l<s.intervals.length;l++){var d=t+s.intervals.length,c=l===s.intervals.length-1?t+o.length+r.length+2:t+l+1;o.splice(l,0,{type:"inbound",app:"GotoIfTime",appdata:s.intervals[l]+"?"+u.inboundroute.context+",${EXTEN},"+d+":"+u.inboundroute.context+",${EXTEN},"+c,exten:u.inboundroute.exten,context:u.inboundroute.context,priority:t+l,VoiceExtensionId:u.inboundroute.id})}s.priority=o.length?_.last(o).priority+1:t,t=(r.length?_.last(r).priority:s.priority)+1,n=_.concat(n,o,[s],r)}n.push({type:"inbound",app:"Hangup",exten:u.inboundroute.exten,context:u.inboundroute.context,priority:t,VoiceExtensionId:u.inboundroute.id}),m.voiceExtension.addApplications({id:u.inboundroute.id},_.sortBy(n,"priority")).$promise.then(function(e){u.inboundrouteApps.rows=e.rows}).catch(function(e){console.error(e)})}function n(e){u.inboundrouteApps=e||{count:0,rows:[]}}u.currentUser=e.getCurrentUser(),u.inboundroute={},u.inboundrouteApps={count:0,rows:[]},u.selectedInboundRouteApps=[],u.crudPermissions,u.query={sort:"priority"},u.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",types:["always","custom","list"],fields:[],isApp:!1},{app:"Queue",appType:"queue",context:"from-voip-provider",type:"Inbound",appdata:",xX,,,300,,,,,",icon:"icon-apps",options:"xX",interval:"*,*,*,*",answer:!0,isApp:!0,extraApi:[{name:"sounds",field:{name:"sound",key:"save_name",prefix:"/var/opt/motion2/server/files/sounds/converted/"},route:"sound",filters:{fields:"id,name,save_name",sort:"name"},permissions:{section:1007}},{name:"queues",field:{name:"queue",key:"name"},route:"voiceQueue",filters:{type:"inbound",fields:"id,name,type",sort:"name",nolimit:!0},permissions:{section:401}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",required:!0,param:0},{title:"Options",name:"options",type:"text",param:1},{title:"Url",name:"URL",type:"text",param:2},{title:"Announce_Overrides",name:"sound",type:"apiselect",values:"sounds",value:"'/var/opt/motion2/server/files/sounds/converted/{{sound.save_name}}'",option:"sound.name",defaultValues:[{value:"''",option:"None"}],param:3},{title:"Timeout",name:"timeout",type:"number",min:0,param:4},{title:"Agi",name:"agi",type:"text",param:5},{title:"Macro",name:"macro",type:"text",param:6},{title:"GoSub",name:"gosub",type:"text",param:7},{title:"Rule",name:"rule",type:"text",param:8},{title:"Position",name:"position",type:"number",min:0,param:9},{title:"Answer",name:"answer",type:"switch",general:!0}]},{app:"Playback",appType:"playback",context:"from-voip-provider",type:"Inbound",icon:"icon-apps",interval:"*,*,*,*",answer:!0,isApp:!0,extraApi:[{name:"sounds",field:{name:"sound",key:"save_name",prefix:"/var/opt/motion2/server/files/sounds/converted/"},route:"sound",filters:{fields:"id,name,save_name",sort:"name"},permissions:{section:1007}}],fields:[{title:"Audio_Files",name:"appdata",type:"apiselect",values:"sounds",value:"'/var/opt/motion2/server/files/sounds/converted/{{appdata.save_name}}'",option:"appdata.name",required:!0,param:0},{title:"Options",name:"options",type:"text",param:1},{title:"Answer",name:"answer",type:"switch",general:!0}]},{app:"Dial",appType:"dial",context:"from-voip-provider",type:"Inbound",icon:"icon-apps",interval:"*,*,*,*",options:"xX",isApp:!0,fields:[{title:"Technology/Resource",name:"tech",type:"text",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:"Dial",appType:"internalDial",context:"from-voip-provider",type:"Inbound",icon:"icon-apps",interval:"*,*,*,*",options:"xX",isApp:!0,extraApi:[{name:"users",field:{name:"user",key:"name",prefix:"SIP/"},route:"user",filters:{fields:"id,name,role",sort:"name"},permissions:{sections:[{id:202,role:"agent"},{id:203,role:"telephone"}]}}],fields:[{title:"User",name:"user",type:"apiselect",values:"users",value:"'SIP/{{user.name}}'",option:"user.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:"Dial",appType:"externalDial",context:"from-voip-provider",type:"inbound",icon:"icon-apps",interval:"*,*,*,*",options:"xX",isApp:!0,extraApi:[{name:"trunks",field:{name:"trunk",key:"name"},route:"trunk",filters:{fields:"id,name",sort:"name"},permissions:{section:1011}}],fields:[{title:"Trunk",name:"trunk",type:"apiselect",values:"trunks",value:"trunk.name",option:"trunk.name",required:!0,param:0},{title:"Phone",name:"phone",required:!0,type:"text"},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:"Dial",appType:"ringGroup",context:"from-voip-provider",type:"inbound",icon:"icon-apps",interval:"*,*,*,*",options:"xX",isApp:!0,extraApi:[{name:"users",field:{name:"multipleUsers",key:"name",prefix:"SIP/"},route:"user",filters:{fields:"id,name,role",sort:"name"},permissions:{sections:[{id:202,role:"agent"},{id:203,role:"telephone"}]}}],fields:[{title:"User",name:"multipleUsers",type:"apiselect",multiple:!0,values:"users",value:"'SIP/{{multipleUsers.name}}'",option:"multipleUsers.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:"AGI",alias:"CallySquare",appType:"agi",context:"from-voip-provider",type:"inbound",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"projects",field:{name:"project",key:"name",prefix:"agi://127.0.0.1/square,"},route:"squareProject",filters:{fields:"id,name",sort:"name"},permissions:{section:1103}}],fields:[{title:"Project",name:"project",type:"apiselect",values:"projects",value:"'agi://127.0.0.1/square,{{project.name}}'",option:"project.name",required:!0,param:0}]},{app:"goto",appType:"goTo",context:"from-voip-provider",type:"Inbound",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"contexts",field:{name:"context",key:"name"},route:"voiceContext",filters:{fields:"id,name",sort:"name"},permissions:{section:405}}],fields:[{title:"Context",name:"context",type:"apiselect",values:"contexts",value:"context.name",option:"context.name",required:!0,param:0},{title:"Extension",name:"extension",type:"text",required:!0,param:1},{title:"Priority",name:"priority",type:"text",required:!0,param:2}]},{app:"hangup",appType:"hangup",context:"from-voip-provider",type:"Inbound",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Hangup_Cause",name:"appdata",type:"select",param:0,values:[{option:"HANGUPCAUSE_1",value:"'1'"},{option:"HANGUPCAUSE_16",value:"'16'"},{option:"HANGUPCAUSE_17",value:"'17'"},{option:"HANGUPCAUSE_18",value:"'18'"},{option:"HANGUPCAUSE_21",value:"'21'"},{option:"HANGUPCAUSE_22",value:"'22'"},{option:"HANGUPCAUSE_27",value:"'27'"},{option:"HANGUPCAUSE_38",value:"'38'"},{option:"HANGUPCAUSE_41",value:"'41'"}],translate:!0,required:!0,general:!0}]},{app:"Set",appType:"set",context:"from-voip-provider",type:"Inbound",separator:"=",icon:"icon-apps",interval:"*,*,*,*",extraApi:[{name:"variables",field:{name:"name",key:"name"},route:"variable",filters:{fields:"id,name",sort:"name"},permissions:{section:1012}}],isApp:!0,fields:[{title:"Variable",name:"name",type:"apiselect",values:"variables",value:"name.name",option:"name.name",required:!0,param:0},{title:"Value",name:"value",type:"text",required:!0,param:1}]},{app:null,appType:"custom",icon:"icon-apps",type:"Inbound",interval:"*,*,*,*",isApp:!0,fields:[{title:"Application_Name",name:"app",type:"text",required:!0,param:0},{title:"Arguments",name:"appdata",type:"text",param:1}]},{app:"Voicemail",appType:"voicemail",context:"from-voip-provider",icon:"icon-apps",type:"Inbound",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"voiceMails",field:{name:"voiceMail",key:"mailbox",suffix:"@from-voicemail"},route:"voiceMail",filters:{fields:"id,mailbox",sort:"mailbox"},permissions:{section:406}}],fields:[{title:"Mailbox@Context",name:"voiceMail",type:"apiselect",values:"voiceMails",value:"'{{voiceMail.mailbox}}@from-voicemail'",option:"voiceMail.mailbox",required:!0,param:0},{title:"Options",name:"options",type:"text",param:1}]}],["app"]),{isApp:!1}),u.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},u.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){t(e,e.newIndex)},onSort:function(e){o()}},u.init=function(e,t){u.inboundroute=e,u.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},u.applications.disabled=!u.crudPermissions.canEdit,u.query.VoiceExtensionId=e.id,u.query.isApp=!0,u.query.nolimit=!0,u.getInboundRouteApps(),u.getIntervals()},u.deleteConfirm=function(e,t,n){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(n).ok("OK").cancel("CANCEL");i.show(a).then(function(){u.inboundrouteApps.rows.splice(t,1),o()},function(){console.log("CANCEL")})},u.getInboundRouteApps=function(){u.promise=m.voiceExtension.get(u.query,n).$promise},u.editInboundRouteApp=t,u.editInterval=function(e,t){if(u.inboundrouteApps.rows.length){var n=u.inboundrouteApps.rows[t]?u.inboundrouteApps.rows[t]:u.inboundrouteApps.rows[0];i.show({controller:"EditInboundAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/inboundroutes/edit/apps/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:n.interval,IntervalId:n.IntervalId,application:!0},intervals:[],crudPermissions:u.crudPermissions}}).then(function(e){e&&(n.interval=e.interval||"*,*,*,*",n.IntervalId=e.IntervalId||null,o())})}},u.deleteInboundRouteApp=function(e){_.remove(u.inboundrouteApps.rows,{id:e.id}),o(),s.success({title:"App deleted!",msg:e.app?e.app+" has been deleted!":""})},u.deleteSelectedInboundRouteApps=function(e){var t=i.confirm().title("Are you sure want to delete the selected applications?").htmlContent("<b>"+u.selectedInboundRouteApps.length+" selected</b> will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){u.selectedInboundRouteApps.forEach(function(e){_.remove(u.inboundrouteApps.rows,{id:e.id})}),u.selectedInboundRouteApps=[],o()})},u.rewriteRouting=o,u.getIntervals=function(){return m.interval.get({fields:"id,interval,IntervalId"}).$promise.then(function(e){u.intervals=e}).catch(function(e){console.error(e)})}}e.$inject=["api","$mdDialog","$document","toasty","Auth"],angular.module("app.voice").controller("InboundRouteActionsController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.agi=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.agi.appdata)switch(l.agi.appType?l.agi.appType.toLowerCase():l.agi.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.agi.appdata.split(",");l.agi.key=d[0],l.agi.language=d[1],l.agi.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.agi.appdata.split(",");l.agi.accesskeyid=d[0],l.agi.secretaccesskey=d[1],l.agi.lexregion=d[2],l.agi.botname=d[3],l.agi.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.agi.appdata.split(",");l.agi.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.agi.text=d.slice(1,d.length).join(",");break;case"message":l.agi.text=l.agi.appdata;break;case"set":l.agi.name=l.agi.appdata.split("=")[0],l.agi.value=l.agi.appdata.split("=")[1];break;case"agi":l.agi.project=l.agi.appdata;break;default:var c=l.agi.appdata.split(",");l.agi.project=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){t.hide(e)}l.agi.type&&"outbound"===l.agi.type.toLowerCase()&&"outbounddial"===l.agi.appType.toLowerCase()&&(l.agi.prefix=l.agi.phone?l.agi.phone.split("$")[0]:void 0,l.agi.callerId=l.agi.callerID?"CALLERID(all)="+l.agi.callerID:void 0),l.saveInboundRouteApp=function(){l.errors=[];var e=[];l.agi.type&&"outbound"===l.agi.type.toLowerCase()&&"outboundDial"===l.agi.appType&&(l.agi.phone=i.cutdigits?(l.agi.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.agi.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.agi.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.agi.options+="U(xcally-mixmonitor-context)"):l.agi.options=l.agi.options.replace("U(xcally-mixmonitor-context)",""));if(l.agi.appType&&"custom"===l.agi.appType);else switch((l.agi.app||l.agi.appType).toLowerCase()){case"set":l.agi.appdata=l.agi.name+"="+l.agi.value;break;case"custom":break;default:e[0]=l.agi.project,l.agi.appdata=e.join(",")}m(l.agi)},l.closeDialog=m,o.hasRole("admin")?s.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.projects=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PROJECTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.projects=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1103}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.projects,{id:e.resourceId})}),n=null;if(l.agi&&(n=_.find(l.projects,{name:l.agi.project})),n&&!_.some(t,["id",n.id])){var a=_.find(l.projects,{id:n.id});a.canSelect=!1,t.push(a)}l.projects=t})}else{var n=[],a=null;l.agi&&(a=_.find(l.projects,{name:l.agi.project}));for(var i=0;i<l.projects.length;i++)a&&l.projects[i].id===a.id&&(l.projects[i].canSelect=!1,n.push(l.projects[i]));l.projects=n}}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","inboundrouteApp","inboundroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInboundAppagiDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.custom=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.custom.appdata)switch(l.custom.appType?l.custom.appType.toLowerCase():l.custom.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.custom.appdata.split(",");l.custom.key=d[0],l.custom.language=d[1],l.custom.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.custom.appdata.split(",");l.custom.accesskeyid=d[0],l.custom.secretaccesskey=d[1],l.custom.lexregion=d[2],l.custom.botname=d[3],l.custom.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.custom.appdata.split(",");l.custom.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.custom.text=d.slice(1,d.length).join(",");break;case"message":l.custom.text=l.custom.appdata;break;case"set":l.custom.name=l.custom.appdata.split("=")[0],l.custom.value=l.custom.appdata.split("=")[1];break;case"agi":l.custom.project=l.custom.appdata;break;default:var c=l.custom.appdata.split(",");l.custom.app=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.custom.appdata=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}function m(e){t.hide(e)}l.custom.type&&"outbound"===l.custom.type.toLowerCase()&&"outbounddial"===l.custom.appType.toLowerCase()&&(l.custom.prefix=l.custom.phone?l.custom.phone.split("$")[0]:void 0,l.custom.callerId=l.custom.callerID?"CALLERID(all)="+l.custom.callerID:void 0),l.saveInboundRouteApp=function(){l.errors=[];var e=[];l.custom.type&&"outbound"===l.custom.type.toLowerCase()&&"outboundDial"===l.custom.appType&&(l.custom.phone=i.cutdigits?(l.custom.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.custom.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.custom.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.custom.options+="U(xcally-mixmonitor-context)"):l.custom.options=l.custom.options.replace("U(xcally-mixmonitor-context)",""));if(l.custom.appType&&"custom"===l.custom.appType);else switch((l.custom.app||l.custom.appType).toLowerCase()){case"set":l.custom.appdata=l.custom.name+"="+l.custom.value;break;case"custom":break;default:e[0]=l.custom.app,e[1]=l.custom.appdata,l.custom.appdata=e.join(",")}m(l.custom)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","inboundrouteApp","inboundroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInboundAppcustomDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.dial=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dial.appdata)switch(l.dial.appType?l.dial.appType.toLowerCase():l.dial.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dial.appdata.split(",");l.dial.key=d[0],l.dial.language=d[1],l.dial.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.dial.appdata.split(",");l.dial.accesskeyid=d[0],l.dial.secretaccesskey=d[1],l.dial.lexregion=d[2],l.dial.botname=d[3],l.dial.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dial.appdata.split(",");l.dial.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dial.text=d.slice(1,d.length).join(",");break;case"message":l.dial.text=l.dial.appdata;break;case"set":l.dial.name=l.dial.appdata.split("=")[0],l.dial.value=l.dial.appdata.split("=")[1];break;case"agi":l.dial.project=l.dial.appdata;break;default:var c=l.dial.appdata.split(",");l.dial.tech=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dial.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dial.options=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.dial.url=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10)}function m(e){t.hide(e)}l.dial.type&&"outbound"===l.dial.type.toLowerCase()&&"outbounddial"===l.dial.appType.toLowerCase()&&(l.dial.prefix=l.dial.phone?l.dial.phone.split("$")[0]:void 0,l.dial.callerId=l.dial.callerID?"CALLERID(all)="+l.dial.callerID:void 0),l.saveInboundRouteApp=function(){l.errors=[];var e=[];l.dial.type&&"outbound"===l.dial.type.toLowerCase()&&"outboundDial"===l.dial.appType&&(l.dial.phone=i.cutdigits?(l.dial.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dial.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dial.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dial.options+="U(xcally-mixmonitor-context)"):l.dial.options=l.dial.options.replace("U(xcally-mixmonitor-context)",""));if(l.dial.appType&&"custom"===l.dial.appType);else switch((l.dial.app||l.dial.appType).toLowerCase()){case"set":l.dial.appdata=l.dial.name+"="+l.dial.value;break;case"custom":break;default:e[0]=l.dial.tech,e[1]=l.dial.timeout,e[2]=l.dial.options,e[3]=l.dial.url,l.dial.appdata=e.join(",")}m(l.dial)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","inboundrouteApp","inboundroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInboundAppdialDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.externaldial=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.externaldial.appdata)switch(l.externaldial.appType?l.externaldial.appType.toLowerCase():l.externaldial.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.externaldial.appdata.split(",");l.externaldial.key=d[0],l.externaldial.language=d[1],l.externaldial.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.externaldial.appdata.split(",");l.externaldial.accesskeyid=d[0],l.externaldial.secretaccesskey=d[1],l.externaldial.lexregion=d[2],l.externaldial.botname=d[3],l.externaldial.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.externaldial.appdata.split(",");l.externaldial.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.externaldial.text=d.slice(1,d.length).join(",");break;case"message":l.externaldial.text=l.externaldial.appdata;break;case"set":l.externaldial.name=l.externaldial.appdata.split("=")[0],l.externaldial.value=l.externaldial.appdata.split("=")[1];break;case"agi":l.externaldial.project=l.externaldial.appdata;break;default:var c=l.externaldial.appdata.split(",");l.externaldial.trunk=c[0].split("/")[1],l.externaldial.phone=c[0].split("/")[2],l.externaldial.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.externaldial.options=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.externaldial.url=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10)}function m(e){t.hide(e)}l.externaldial.type&&"outbound"===l.externaldial.type.toLowerCase()&&"outbounddial"===l.externaldial.appType.toLowerCase()&&(l.externaldial.prefix=l.externaldial.phone?l.externaldial.phone.split("$")[0]:void 0,l.externaldial.callerId=l.externaldial.callerID?"CALLERID(all)="+l.externaldial.callerID:void 0),l.saveInboundRouteApp=function(){l.errors=[];var e=[];l.externaldial.type&&"outbound"===l.externaldial.type.toLowerCase()&&"outboundDial"===l.externaldial.appType&&(l.externaldial.phone=i.cutdigits?(l.externaldial.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.externaldial.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.externaldial.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.externaldial.options+="U(xcally-mixmonitor-context)"):l.externaldial.options=l.externaldial.options.replace("U(xcally-mixmonitor-context)",""));if(l.externaldial.appType&&"custom"===l.externaldial.appType);else switch((l.externaldial.app||l.externaldial.appType).toLowerCase()){case"set":l.externaldial.appdata=l.externaldial.name+"="+l.externaldial.value;break;case"custom":break;default:e[0]=["SIP",l.externaldial.trunk,l.externaldial.phone].join("/"),e[1]=l.externaldial.timeout,e[2]=l.externaldial.options,e[3]=l.externaldial.url,l.externaldial.appdata=e.join(",")}m(l.externaldial)},l.closeDialog=m,o.hasRole("admin")?s.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.trunks=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.trunks=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.trunks,{id:e.resourceId})}),n=null;if(l.externaldial&&(n=_.find(l.trunks,{name:l.externaldial.trunk})),n&&!_.some(t,["id",n.id])){var a=_.find(l.trunks,{id:n.id});a.canSelect=!1,t.push(a)}l.trunks=t})}else{var n=[],a=null;l.externaldial&&(a=_.find(l.trunks,{name:l.externaldial.trunk}));for(var i=0;i<l.trunks.length;i++)a&&l.trunks[i].id===a.id&&(l.trunks[i].canSelect=!1,n.push(l.trunks[i]));l.trunks=n}}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","inboundrouteApp","inboundroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInboundAppexternaldialDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.goto=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.goto.appdata)switch(l.goto.appType?l.goto.appType.toLowerCase():l.goto.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.goto.appdata.split(",");l.goto.key=d[0],l.goto.language=d[1],l.goto.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.goto.appdata.split(",");l.goto.accesskeyid=d[0],l.goto.secretaccesskey=d[1],l.goto.lexregion=d[2],l.goto.botname=d[3],l.goto.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.goto.appdata.split(",");l.goto.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.goto.text=d.slice(1,d.length).join(",");break;case"message":l.goto.text=l.goto.appdata;break;case"set":l.goto.name=l.goto.appdata.split("=")[0],l.goto.value=l.goto.appdata.split("=")[1];break;case"agi":l.goto.project=l.goto.appdata;break;default:var c=l.goto.appdata.split(",");l.goto.context=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.goto.extension=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.goto.priority=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}function m(e){t.hide(e)}l.goto.type&&"outbound"===l.goto.type.toLowerCase()&&"outbounddial"===l.goto.appType.toLowerCase()&&(l.goto.prefix=l.goto.phone?l.goto.phone.split("$")[0]:void 0,l.goto.callerId=l.goto.callerID?"CALLERID(all)="+l.goto.callerID:void 0),l.saveInboundRouteApp=function(){l.errors=[];var e=[];l.goto.type&&"outbound"===l.goto.type.toLowerCase()&&"outboundDial"===l.goto.appType&&(l.goto.phone=i.cutdigits?(l.goto.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.goto.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.goto.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.goto.options+="U(xcally-mixmonitor-context)"):l.goto.options=l.goto.options.replace("U(xcally-mixmonitor-context)",""));if(l.goto.appType&&"custom"===l.goto.appType);else switch((l.goto.app||l.goto.appType).toLowerCase()){case"set":l.goto.appdata=l.goto.name+"="+l.goto.value;break;case"custom":break;default:e[0]=l.goto.context,e[1]=l.goto.extension,e[2]=l.goto.priority,l.goto.appdata=e.join(",")}m(l.goto)},l.closeDialog=m,o.hasRole("admin")?s.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.contexts=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.contexts=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.contexts,{id:e.resourceId})}),n=null;if(l.goto&&(n=_.find(l.contexts,{name:l.goto.context})),n&&!_.some(t,["id",n.id])){var a=_.find(l.contexts,{id:n.id});a.canSelect=!1,t.push(a)}l.contexts=t}):s.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){l.contexts=e.rows||[]})}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","inboundrouteApp","inboundroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInboundAppgotoDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.hangup=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.hangup.appdata)switch(l.hangup.appType?l.hangup.appType.toLowerCase():l.hangup.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.hangup.appdata.split(",");l.hangup.key=d[0],l.hangup.language=d[1],l.hangup.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.hangup.appdata.split(",");l.hangup.accesskeyid=d[0],l.hangup.secretaccesskey=d[1],l.hangup.lexregion=d[2],l.hangup.botname=d[3],l.hangup.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.hangup.appdata.split(",");l.hangup.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.hangup.text=d.slice(1,d.length).join(",");break;case"message":l.hangup.text=l.hangup.appdata;break;case"set":l.hangup.name=l.hangup.appdata.split("=")[0],l.hangup.value=l.hangup.appdata.split("=")[1];break;case"agi":l.hangup.project=l.hangup.appdata;break;default:var c=l.hangup.appdata.split(",");l.hangup.appdata=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){t.hide(e)}l.hangup.type&&"outbound"===l.hangup.type.toLowerCase()&&"outbounddial"===l.hangup.appType.toLowerCase()&&(l.hangup.prefix=l.hangup.phone?l.hangup.phone.split("$")[0]:void 0,l.hangup.callerId=l.hangup.callerID?"CALLERID(all)="+l.hangup.callerID:void 0),l.saveInboundRouteApp=function(){l.errors=[];var e=[];l.hangup.type&&"outbound"===l.hangup.type.toLowerCase()&&"outboundDial"===l.hangup.appType&&(l.hangup.phone=i.cutdigits?(l.hangup.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.hangup.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.hangup.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.hangup.options+="U(xcally-mixmonitor-context)"):l.hangup.options=l.hangup.options.replace("U(xcally-mixmonitor-context)",""));if(l.hangup.appType&&"custom"===l.hangup.appType);else switch((l.hangup.app||l.hangup.appType).toLowerCase()){case"set":l.hangup.appdata=l.hangup.name+"="+l.hangup.value;break;case"custom":break;default:e[0]=l.hangup.appdata,l.hangup.appdata=e.join(",")}m(l.hangup)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","inboundrouteApp","inboundroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInboundApphangupDialogController",e)}(),function(){"use strict";function e(t,o,n,e,a,r,i,s){var l=this;if(l.currentUser=i.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(e.appType||e.app).toUpperCase(),l.internaldial=angular.copy(e),l.crudPermissions=s,l.hasModulePermissions={},l.internaldial.appdata)switch(l.internaldial.appType?l.internaldial.appType.toLowerCase():l.internaldial.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.internaldial.appdata.split(",");l.internaldial.key=d[0],l.internaldial.language=d[1],l.internaldial.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.internaldial.appdata.split(",");l.internaldial.accesskeyid=d[0],l.internaldial.secretaccesskey=d[1],l.internaldial.lexregion=d[2],l.internaldial.botname=d[3],l.internaldial.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.internaldial.appdata.split(",");l.internaldial.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.internaldial.text=d.slice(1,d.length).join(",");break;case"message":l.internaldial.text=l.internaldial.appdata;break;case"set":l.internaldial.name=l.internaldial.appdata.split("=")[0],l.internaldial.value=l.internaldial.appdata.split("=")[1];break;case"agi":l.internaldial.project=l.internaldial.appdata;break;default:var c=l.internaldial.appdata.split(",");l.internaldial.user=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.internaldial.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.internaldial.options=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.internaldial.url=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10)}l.internaldial.type&&"outbound"===l.internaldial.type.toLowerCase()&&"outbounddial"===l.internaldial.appType.toLowerCase()&&(l.internaldial.prefix=l.internaldial.phone?l.internaldial.phone.split("$")[0]:void 0,l.internaldial.callerId=l.internaldial.callerID?"CALLERID(all)="+l.internaldial.callerID:void 0),l.saveInboundRouteApp=function(){l.errors=[];var e=[];l.internaldial.type&&"outbound"===l.internaldial.type.toLowerCase()&&"outboundDial"===l.internaldial.appType&&(l.internaldial.phone=a.cutdigits?(l.internaldial.prefix||"")+"${EXTEN:"+a.cutdigits+"}":(l.internaldial.prefix||"")+"${EXTEN}","none"!==a.recordingFormat?l.internaldial.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.internaldial.options+="U(xcally-mixmonitor-context)"):l.internaldial.options=l.internaldial.options.replace("U(xcally-mixmonitor-context)",""));if(l.internaldial.appType&&"custom"===l.internaldial.appType);else switch((l.internaldial.app||l.internaldial.appType).toLowerCase()){case"set":l.internaldial.appdata=l.internaldial.name+"="+l.internaldial.value;break;case"custom":break;default:e[0]=l.internaldial.user,e[1]=l.internaldial.timeout,e[2]=l.internaldial.options,e[3]=l.internaldial.url,l.internaldial.appdata=e.join(",")}p(l.internaldial)},l.closeDialog=p;var m=[{id:202,role:"agent"},{id:203,role:"telephone"}],u=null;function p(e){t.hide(e)}i.hasRole("admin")?r.user.get({fields:"id,name,role",sort:"name"}).$promise.then(function(e){l.users=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.user.get({fields:"id,name,role",sort:"name"}).$promise.then(function(e){u=e.rows||[]}).then(function(){for(var e=[],t=0;t<m.length;t++)e.push(r.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:m[t].id}).$promise);return o.all(e)}).then(function(e){for(var t=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),n=[],a=0;a<m.length;a++){var i=_.find(t,["sectionId",m[a].id]);if(i)if(i.autoAssociation){var s=[];u.forEach(function(e){e.role===m[a].role&&s.push(e)}),n.push({rows:s,count:s.length})}else n.push(r.userProfileResource.get({sectionId:i.id}).$promise)}return o.all(n)}).then(function(e){var t=[],n=null;l.internaldial&&(n=_.find(u,{name:l.internaldial.user}));for(var a=0;a<e.length;a++){(e[a].rows||[]).forEach(function(e){t.push(e)})}n&&!_.some(t,["resourceId",n.id])&&u.forEach(function(e){e.id===n.id&&(e.canSelect=!1,t.push(e))}),l.users=t}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETusers",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","inboundrouteApp","inboundroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInboundAppinternaldialDialogController",e)}(),function(){"use strict";function e(e,t,n,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 E(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var t=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),n=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(t+"-"+n)}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 A(e){t.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=E(),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!":""}),A()}).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=E(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),A(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var t=_.find(c.intervals,{id:e.id});t&&_.merge(t,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),A()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=A,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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=e&&e.rows?e.rows:[],n=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(t,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,n.push(e))}),c.intervals=n})}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("EditInboundAppintervalDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.playback=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.playback.appdata)switch(l.playback.appType?l.playback.appType.toLowerCase():l.playback.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.playback.appdata.split(",");l.playback.key=d[0],l.playback.language=d[1],l.playback.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.playback.appdata.split(",");l.playback.accesskeyid=d[0],l.playback.secretaccesskey=d[1],l.playback.lexregion=d[2],l.playback.botname=d[3],l.playback.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.playback.appdata.split(",");l.playback.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.playback.text=d.slice(1,d.length).join(",");break;case"message":l.playback.text=l.playback.appdata;break;case"set":l.playback.name=l.playback.appdata.split("=")[0],l.playback.value=l.playback.appdata.split("=")[1];break;case"agi":l.playback.project=l.playback.appdata;break;default:var c=l.playback.appdata.split(",");l.playback.appdata=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.playback.options=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}function m(e){t.hide(e)}l.playback.type&&"outbound"===l.playback.type.toLowerCase()&&"outbounddial"===l.playback.appType.toLowerCase()&&(l.playback.prefix=l.playback.phone?l.playback.phone.split("$")[0]:void 0,l.playback.callerId=l.playback.callerID?"CALLERID(all)="+l.playback.callerID:void 0),l.saveInboundRouteApp=function(){l.errors=[];var e=[];l.playback.type&&"outbound"===l.playback.type.toLowerCase()&&"outboundDial"===l.playback.appType&&(l.playback.phone=i.cutdigits?(l.playback.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.playback.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.playback.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.playback.options+="U(xcally-mixmonitor-context)"):l.playback.options=l.playback.options.replace("U(xcally-mixmonitor-context)",""));if(l.playback.appType&&"custom"===l.playback.appType);else switch((l.playback.app||l.playback.appType).toLowerCase()){case"set":l.playback.appdata=l.playback.name+"="+l.playback.value;break;case"custom":break;default:e[0]=l.playback.appdata,e[1]=l.playback.options,l.playback.appdata=e.join(",")}m(l.playback)},l.closeDialog=m,o.hasRole("admin")?s.sound.get({fields:"id,name,save_name",sort:"name"}).$promise.then(function(e){l.sounds=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SOUNDS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.sound.get({fields:"id,name,save_name",sort:"name"}).$promise.then(function(e){l.sounds=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1007}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.sounds,{id:e.resourceId})}),n=null;if(l.playback&&(n=_.find(l.sounds,{save_name:l.playback.sound})),n&&!_.some(t,["id",n.id])){var a=_.find(l.sounds,{id:n.id});a.canSelect=!1,t.push(a)}l.sounds=t})}else{var n=[],a=null;l.playback&&(a=_.find(l.sounds,{save_name:l.playback.sound}));for(var i=0;i<l.sounds.length;i++)a&&l.sounds[i].id===a.id&&(l.sounds[i].canSelect=!1,n.push(l.sounds[i]));l.sounds=n}}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsounds",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","inboundrouteApp","inboundroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInboundAppplaybackDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.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"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.options=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.queue.URL=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.queue.sound=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.queue.timeout=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10),l.queue.agi=_.isEmpty(c[5])?c[5]:isNaN(c[5])?c[5]:parseInt(c[5],10),l.queue.macro=_.isEmpty(c[6])?c[6]:isNaN(c[6])?c[6]:parseInt(c[6],10),l.queue.gosub=_.isEmpty(c[7])?c[7]:isNaN(c[7])?c[7]:parseInt(c[7],10),l.queue.rule=_.isEmpty(c[8])?c[8]:isNaN(c[8])?c[8]:parseInt(c[8],10),l.queue.position=_.isEmpty(c[9])?c[9]:isNaN(c[9])?c[9]:parseInt(c[9],10)}function m(e){t.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.saveInboundRouteApp=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)",""));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.options,e[2]=l.queue.URL,e[3]=l.queue.sound,e[4]=l.queue.timeout,e[5]=l.queue.agi,e[6]=l.queue.macro,e[7]=l.queue.gosub,e[8]=l.queue.rule,e[9]=l.queue.position,l.queue.appdata=e.join(",")}m(l.queue)},l.closeDialog=m,o.hasRole("admin")?s.sound.get({fields:"id,name,save_name",sort:"name"}).$promise.then(function(e){l.sounds=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SOUNDS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.sound.get({fields:"id,name,save_name",sort:"name"}).$promise.then(function(e){l.sounds=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1007}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.sounds,{id:e.resourceId})}),n=null;if(l.queue&&(n=_.find(l.sounds,{save_name:l.queue.sound})),n&&!_.some(t,["id",n.id])){var a=_.find(l.sounds,{id:n.id});a.canSelect=!1,t.push(a)}l.sounds=t})}else{var n=[],a=null;l.queue&&(a=_.find(l.sounds,{save_name:l.queue.sound}));for(var i=0;i<l.sounds.length;i++)a&&l.sounds[i].id===a.id&&(l.sounds[i].canSelect=!1,n.push(l.sounds[i]));l.sounds=n}}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsounds",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.hasRole("admin")?s.voiceQueue.get({type:"inbound",fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.voiceQueue.get({type:"inbound",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:401}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),n=null;if(l.queue&&(n=_.find(l.queues,{name:l.queue.queue})),n&&!_.some(t,["id",n.id])){var a=_.find(l.queues,{id:n.id});a.canSelect=!1,t.push(a)}l.queues=t})}else{var n=[],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,n.push(l.queues[i]));l.queues=n}}).catch(function(e){n.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","inboundrouteApp","inboundroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInboundAppqueueDialogController",e)}(),function(){"use strict";function e(t,o,n,e,a,r,i,s){var l=this;if(l.currentUser=i.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(e.appType||e.app).toUpperCase(),l.ringgroup=angular.copy(e),l.crudPermissions=s,l.hasModulePermissions={},l.ringgroup.appdata)switch(l.ringgroup.appType?l.ringgroup.appType.toLowerCase():l.ringgroup.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.ringgroup.appdata.split(",");l.ringgroup.key=d[0],l.ringgroup.language=d[1],l.ringgroup.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.ringgroup.appdata.split(",");l.ringgroup.accesskeyid=d[0],l.ringgroup.secretaccesskey=d[1],l.ringgroup.lexregion=d[2],l.ringgroup.botname=d[3],l.ringgroup.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.ringgroup.appdata.split(",");l.ringgroup.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.ringgroup.text=d.slice(1,d.length).join(",");break;case"message":l.ringgroup.text=l.ringgroup.appdata;break;case"set":l.ringgroup.name=l.ringgroup.appdata.split("=")[0],l.ringgroup.value=l.ringgroup.appdata.split("=")[1];break;case"agi":l.ringgroup.project=l.ringgroup.appdata;break;default:var c=l.ringgroup.appdata.split(",");l.ringgroup.multipleUsers=c[0].split("&"),l.ringgroup.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.ringgroup.options=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.ringgroup.url=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10)}l.ringgroup.type&&"outbound"===l.ringgroup.type.toLowerCase()&&"outbounddial"===l.ringgroup.appType.toLowerCase()&&(l.ringgroup.prefix=l.ringgroup.phone?l.ringgroup.phone.split("$")[0]:void 0,l.ringgroup.callerId=l.ringgroup.callerID?"CALLERID(all)="+l.ringgroup.callerID:void 0),l.saveInboundRouteApp=function(){l.errors=[];var e=[];l.ringgroup.type&&"outbound"===l.ringgroup.type.toLowerCase()&&"outboundDial"===l.ringgroup.appType&&(l.ringgroup.phone=a.cutdigits?(l.ringgroup.prefix||"")+"${EXTEN:"+a.cutdigits+"}":(l.ringgroup.prefix||"")+"${EXTEN}","none"!==a.recordingFormat?l.ringgroup.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.ringgroup.options+="U(xcally-mixmonitor-context)"):l.ringgroup.options=l.ringgroup.options.replace("U(xcally-mixmonitor-context)",""));if(l.ringgroup.appType&&"custom"===l.ringgroup.appType);else switch((l.ringgroup.app||l.ringgroup.appType).toLowerCase()){case"set":l.ringgroup.appdata=l.ringgroup.name+"="+l.ringgroup.value;break;case"custom":break;default:e[0]=l.ringgroup.multipleUsers.join("&"),e[1]=l.ringgroup.timeout,e[2]=l.ringgroup.options,e[3]=l.ringgroup.url,l.ringgroup.appdata=e.join(",")}p(l.ringgroup)},l.closeDialog=p;var m=[{id:202,role:"agent"},{id:203,role:"telephone"}],u=null;function p(e){t.hide(e)}i.hasRole("admin")?r.user.get({fields:"id,name,role",sort:"name"}).$promise.then(function(e){l.users=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.user.get({fields:"id,name,role",sort:"name"}).$promise.then(function(e){u=e.rows||[]}).then(function(){for(var e=[],t=0;t<m.length;t++)e.push(r.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:m[t].id}).$promise);return o.all(e)}).then(function(e){for(var t=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),n=[],a=0;a<m.length;a++){var i=_.find(t,["sectionId",m[a].id]);if(i)if(i.autoAssociation){var s=[];u.forEach(function(e){e.role===m[a].role&&s.push(e)}),n.push({rows:s,count:s.length})}else n.push(r.userProfileResource.get({sectionId:i.id}).$promise)}return o.all(n)}).then(function(e){var t=[],n=null;l.ringgroup&&(n=_.find(u,{name:l.ringgroup.multipleUsers}));for(var a=0;a<e.length;a++){(e[a].rows||[]).forEach(function(e){t.push(e)})}n&&!_.some(t,["resourceId",n.id])&&u.forEach(function(e){e.id===n.id&&(e.canSelect=!1,t.push(e))}),l.users=t}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETusers",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","inboundrouteApp","inboundroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInboundAppringgroupDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.set=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.set.appdata)switch(l.set.appType?l.set.appType.toLowerCase():l.set.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.set.appdata.split(",");l.set.key=d[0],l.set.language=d[1],l.set.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.set.appdata.split(",");l.set.accesskeyid=d[0],l.set.secretaccesskey=d[1],l.set.lexregion=d[2],l.set.botname=d[3],l.set.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.set.appdata.split(",");l.set.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.set.text=d.slice(1,d.length).join(",");break;case"message":l.set.text=l.set.appdata;break;case"set":l.set.name=l.set.appdata.split("=")[0],l.set.value=l.set.appdata.split("=")[1];break;case"agi":l.set.project=l.set.appdata;break;default:var c=l.set.appdata.split("=");l.set.name=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.set.value=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}function m(e){t.hide(e)}l.set.type&&"outbound"===l.set.type.toLowerCase()&&"outbounddial"===l.set.appType.toLowerCase()&&(l.set.prefix=l.set.phone?l.set.phone.split("$")[0]:void 0,l.set.callerId=l.set.callerID?"CALLERID(all)="+l.set.callerID:void 0),l.saveInboundRouteApp=function(){l.errors=[];var e=[];l.set.type&&"outbound"===l.set.type.toLowerCase()&&"outboundDial"===l.set.appType&&(l.set.phone=i.cutdigits?(l.set.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.set.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.set.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.set.options+="U(xcally-mixmonitor-context)"):l.set.options=l.set.options.replace("U(xcally-mixmonitor-context)",""));if(l.set.appType&&"custom"===l.set.appType);else switch((l.set.app||l.set.appType).toLowerCase()){case"set":l.set.appdata=l.set.name+"="+l.set.value;break;case"custom":break;default:e[0]=l.set.name,e[1]=l.set.value,l.set.appdata=e.join("=")}m(l.set)},l.closeDialog=m,o.hasRole("admin")?s.variable.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.variables=e.rows||[]}).catch(function(e){n.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"}).$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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),n=null;if(l.set&&(n=_.find(l.variables,{name:l.set.name})),n&&!_.some(t,["id",n.id])){var a=_.find(l.variables,{id:n.id});a.canSelect=!1,t.push(a)}l.variables=t})}else{var n=[],a=null;l.set&&(a=_.find(l.variables,{name:l.set.name}));for(var i=0;i<l.variables.length;i++)a&&l.variables[i].id===a.id&&(l.variables[i].canSelect=!1,n.push(l.variables[i]));l.variables=n}}).catch(function(e){n.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","inboundrouteApp","inboundroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInboundAppsetDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.voicemail=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.voicemail.appdata)switch(l.voicemail.appType?l.voicemail.appType.toLowerCase():l.voicemail.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.voicemail.appdata.split(",");l.voicemail.key=d[0],l.voicemail.language=d[1],l.voicemail.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.voicemail.appdata.split(",");l.voicemail.accesskeyid=d[0],l.voicemail.secretaccesskey=d[1],l.voicemail.lexregion=d[2],l.voicemail.botname=d[3],l.voicemail.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.voicemail.appdata.split(",");l.voicemail.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.voicemail.text=d.slice(1,d.length).join(",");break;case"message":l.voicemail.text=l.voicemail.appdata;break;case"set":l.voicemail.name=l.voicemail.appdata.split("=")[0],l.voicemail.value=l.voicemail.appdata.split("=")[1];break;case"agi":l.voicemail.project=l.voicemail.appdata;break;default:var c=l.voicemail.appdata.split(",");l.voicemail.voiceMail=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.voicemail.options=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}function m(e){t.hide(e)}l.voicemail.type&&"outbound"===l.voicemail.type.toLowerCase()&&"outbounddial"===l.voicemail.appType.toLowerCase()&&(l.voicemail.prefix=l.voicemail.phone?l.voicemail.phone.split("$")[0]:void 0,l.voicemail.callerId=l.voicemail.callerID?"CALLERID(all)="+l.voicemail.callerID:void 0),l.saveInboundRouteApp=function(){l.errors=[];var e=[];l.voicemail.type&&"outbound"===l.voicemail.type.toLowerCase()&&"outboundDial"===l.voicemail.appType&&(l.voicemail.phone=i.cutdigits?(l.voicemail.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.voicemail.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.voicemail.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.voicemail.options+="U(xcally-mixmonitor-context)"):l.voicemail.options=l.voicemail.options.replace("U(xcally-mixmonitor-context)",""));if(l.voicemail.appType&&"custom"===l.voicemail.appType);else switch((l.voicemail.app||l.voicemail.appType).toLowerCase()){case"set":l.voicemail.appdata=l.voicemail.name+"="+l.voicemail.value;break;case"custom":break;default:e[0]=l.voicemail.voiceMail,e[1]=l.voicemail.options,l.voicemail.appdata=e.join(",")}m(l.voicemail)},l.closeDialog=m,o.hasRole("admin")?s.voiceMail.get({fields:"id,mailbox",sort:"mailbox"}).$promise.then(function(e){l.voiceMails=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VOICEMAILS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.voiceMail.get({fields:"id,mailbox",sort:"mailbox"}).$promise.then(function(e){l.voiceMails=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:406}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.voiceMails,{id:e.resourceId})}),n=null;if(l.voicemail&&(n=_.find(l.voiceMails,{mailbox:l.voicemail.voiceMail})),n&&!_.some(t,["id",n.id])){var a=_.find(l.voiceMails,{id:n.id});a.canSelect=!1,t.push(a)}l.voiceMails=t})}else{var n=[],a=null;l.voicemail&&(a=_.find(l.voiceMails,{mailbox:l.voicemail.voiceMail}));for(var i=0;i<l.voiceMails.length;i++)a&&l.voiceMails[i].id===a.id&&(l.voiceMails[i].canSelect=!1,n.push(l.voiceMails[i]));l.voiceMails=n}}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMails",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","inboundrouteApp","inboundroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInboundAppvoicemailDialogController",e)}(),function(){"use strict";function e(e,t,n,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=t.protocol()+"://"+t.host(),u.inboundroute=c||e.params.inboundroute||{},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.gotoInboundRoutes=function(){e.go("app.voice.inboundroutes")},u.saveInboundRoute=function(){r.voiceExtension.update({id:u.inboundroute.id},u.inboundroute).$promise.then(function(){l.success({title:"InboundRoute updated!",msg:u.inboundroute.name?u.inboundroute.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceExtension",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 t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.contexts,{id:e.resourceId})}),n=null;if(u.inboundroute&&(n=_.find(u.contexts,{name:u.inboundroute.context})),n&&!_.some(t,["id",n.id])){var a=_.find(u.contexts,{id:n.id});a.canSelect=!1,t.push(a)}u.contexts=t}):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","inboundroute","userProfileSection"],angular.module("app.voice").controller("InboundRouteController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.inboundroutes=l||{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="inboundroutes",b.listOrder="",b.listOrderAsc=null,b.selectedInboundRoutes=[],b.query={fields:"createdAt,updatedAt,id,appdata,type,exten,context,description",type:"inbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,page:1},b.editstate=function(e,t){n.go("app.voice.inboundroutes.edit",{id:e.id,inboundroute:e,crudPermissions:b.crudPermissions})},b.deleteconfirm=function(e,t){var n=i.confirm().title("Are you sure want to delete the "+_.startCase("inboundroute")+"?").htmlContent("<b>"+(e.name||"inboundroute")+"</b> will be deleted.").ariaLabel("delete inboundroute").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getInboundRoutes=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.voiceExtension.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="InboundRoutes",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditInboundRoute=function(e,t){i.show({controller:"CreateOrEditInboundRouteDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/inboundroutes/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{inboundroute:t,inboundroutes:b.inboundroutes.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteInboundRoute=S,b.exportSelectedInboundRoutes=function(){var e=angular.copy(b.selectedInboundRoutes);return b.selectedInboundRoutes=[],e},b.deleteSelectedInboundRoutes=function(e){var t=i.confirm().title("Are you sure want to delete the selected inboundroutes?").htmlContent("<b>"+b.selectedInboundRoutes.length+" selected</b> will be deleted.").ariaLabel("delete InboundRoutes").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedInboundRoutes.forEach(function(e){S(e)}),b.selectedInboundRoutes=[]})},b.deselectInboundRoutes=function(){b.selectedInboundRoutes=[]},b.selectAllInboundRoutes=function(){b.selectedInboundRoutes=b.inboundroutes.rows},g.hasRole("admin")?m.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){b.contexts=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){b.contexts=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(b.contexts,{id:e.resourceId})}),n=null;if(b.inboundroute&&(n=_.find(b.contexts,{name:b.inboundroute.context})),n&&!_.some(t,["id",n.id])){var a=_.find(b.contexts,{id:n.id});a.canSelect=!1,t.push(a)}b.contexts=t}):m.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){b.contexts=e.rows||[]})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})});var E=!0,A=1;function y(e){b.inboundroutes=e||{count:0,rows:[]}}function S(e){m.voiceExtension.delete({id:e.id}).$promise.then(function(){_.remove(b.inboundroutes.rows,{id:e.id}),b.inboundroutes.count-=1,b.inboundroutes.rows.length||b.getInboundRoutes(),p.success({title:_.startCase("InboundRoute")+" 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:DELETEvoiceExtension"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceExtension",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getInboundRoutes())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","inboundroutes","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.voice").controller("InboundRoutesController",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(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_INTERNALROUTE",g.internalroute=angular.copy(l),g.internalroutes=r,g.newInternalRoute=!1,g.internalroute||(g.internalroute={appdata:"Internal Call",type:"internal",context:"from-sip"},g.title="VOICE.NEW_INTERNALROUTE",g.newInternalRoute=!0),g.addNewInternalRoute=function(){g.errors=[],d.voiceExtension.save(g.internalroute).$promise.then(function(e){g.internalroutes.unshift(e.toJSON()),o.success({title:"InternalRoute properly created",msg:g.internalroute.name?g.internalroute.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.voiceExtension.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveInternalRoute=function(){g.errors=[],d.voiceExtension.update({id:g.internalroute.id},g.internalroute).$promise.then(function(e){var t=_.find(g.internalroutes,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"InternalRoute properly saved!",msg:g.internalroute.name?g.internalroute.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.voiceExtension.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteInternalRoute=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The internalroute will be deleted.").ariaLabel("Delete InternalRoute").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.voiceExtension.delete({id:g.internalroute.id}).$promise.then(function(){_.remove(g.internalroutes,{id:g.internalroute.id}),o.success({title:"InternalRoute properly deleted!",msg:(g.internalroute.name||"internalroute")+" has been deleted!"}),v(g.internalroute)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.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.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.contexts=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.contexts=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.contexts,{id:e.resourceId})}),n=null;if(g.internalroute&&(n=_.find(g.contexts,{name:g.internalroute.context})),n&&!_.some(t,["id",n.id])){var a=_.find(g.contexts,{id:n.id});a.canSelect=!1,t.push(a)}g.contexts=t}):d.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){g.contexts=e.rows||[]})}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","internalroutes","internalroute","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditInternalRouteDialogController",e)}(),function(){"use strict";function e(m,i,a,s,e){var u=this;function t(e,t){if(u.internalrouteApps.rows.length){var n=u.internalrouteApps.rows[t]?u.internalrouteApps.rows[t]:u.internalrouteApps.rows[0];i.show({controller:"EditInternalApp"+(n.appType||n.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/internalroutes/edit/apps/"+(n.appType||n.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{internalrouteApp:n,internalroute:u.internalroute,crudPermissions:u.crudPermissions}}).then(function(e){e&&(e.id?u.internalrouteApps.rows[t]=e:u.internalrouteApps.rows.splice(t,0,e),o())}).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 o(){var e=["queue","playback"],t=2,n=[];n.push({type:"internal",app:"Set",appdata:"CDR(type)=internal",context:u.internalroute.context,exten:u.internalroute.exten,priority:t++,VoiceExtensionId:u.internalroute.id}),n.push({type:"internal",app:"Set",appdata:"XCALLY-MOTION-ANSWER=0",context:u.internalroute.context,exten:u.internalroute.exten,priority:t++,VoiceExtensionId:u.internalroute.id}),n.push({type:"internal",app:"Set",appdata:"XCALLY-MOTION-PROGRESS=0",context:u.internalroute.context,exten:u.internalroute.exten,priority:t++,VoiceExtensionId:u.internalroute.id}),n.push({type:"internal",app:"Set",appdata:"MONITOR_OPTIONS=ab",context:u.internalroute.context,exten:u.internalroute.exten,priority:t++,VoiceExtensionId:u.internalroute.id});for(var a=0,i=0;a<u.internalrouteApps.rows.length;a++,i=0){var s=u.internalrouteApps.rows[a],o=[],r=[];s.intervals="*,*,*,*"!==s.interval?[s.interval]:s.IntervalId?_.map(_.filter(u.intervals.rows,{IntervalId:s.IntervalId}),"interval"):[],s.context=u.internalroute.context,s.exten=u.internalroute.exten,s.type&&(s.type=s.type.toLowerCase()),s.hasOwnProperty("answer")&&e.includes(s.app.toLowerCase())&&"custom"!==s.appType&&(s.answer?(o.push({type:s.type.toLowerCase(),app:"ExecIf",appdata:"$[${XCALLY-MOTION-ANSWER}=0]?Answer",context:u.internalroute.context,exten:u.internalroute.exten,priority:s.intervals.length+t+i++,VoiceExtensionId:u.internalroute.id}),o.push({type:s.type.toLowerCase(),app:"Set",appdata:"XCALLY-MOTION-ANSWER=1",context:u.internalroute.context,exten:u.internalroute.exten,priority:s.intervals.length+t+i++,VoiceExtensionId:u.internalroute.id})):(o.push({type:s.type.toLowerCase(),app:"ExecIf",appdata:"$[${XCALLY-MOTION-PROGRESS}=0]?Progress",context:u.internalroute.context,exten:u.internalroute.exten,priority:s.intervals.length+t+i++,VoiceExtensionId:u.internalroute.id}),o.push({type:s.type.toLowerCase(),app:"Set",appdata:"XCALLY-MOTION-PROGRESS=1",context:u.internalroute.context,exten:u.internalroute.exten,priority:s.intervals.length+t+i++,VoiceExtensionId:u.internalroute.id})));for(var l=0;l<s.intervals.length;l++){var d=t+s.intervals.length,c=l===s.intervals.length-1?t+o.length+r.length+2:t+l+1;o.splice(l,0,{type:"internal",app:"GotoIfTime",appdata:s.intervals[l]+"?"+u.internalroute.context+",${EXTEN},"+d+":"+u.internalroute.context+",${EXTEN},"+c,exten:u.internalroute.exten,context:u.internalroute.context,priority:t+l,VoiceExtensionId:u.internalroute.id})}s.priority=o.length?_.last(o).priority+1:t,t=(r.length?_.last(r).priority:s.priority)+1,n=_.concat(n,o,[s],r)}n.push({type:"internal",app:"Hangup",exten:u.internalroute.exten,context:u.internalroute.context,priority:t,VoiceExtensionId:u.internalroute.id}),m.voiceExtension.addApplications({id:u.internalroute.id},_.sortBy(n,"priority")).$promise.then(function(e){u.internalrouteApps.rows=e.rows}).catch(function(e){console.error(e)})}function n(e){u.internalrouteApps=e||{count:0,rows:[]}}u.currentUser=e.getCurrentUser(),u.internalroute={},u.internalrouteApps={count:0,rows:[]},u.selectedInternalRouteApps=[],u.crudPermissions,u.query={sort:"priority"},u.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",type:"Internal",types:["always","custom","list"],fields:[],isApp:!1},{app:"Queue",appType:"queue",context:"from-sip",type:"Internal",options:"xX",appdata:",xX,,,300,,,,,",icon:"icon-apps",interval:"*,*,*,*",answer:!0,isApp:!0,extraApi:[{name:"sounds",field:{name:"sound",key:"save_name",prefix:"/var/opt/motion2/server/files/sounds/converted/"},route:"sound",filters:{fields:"id,name,save_name",sort:"name"},permissions:{section:1007}},{name:"queues",field:{name:"queue",key:"name"},route:"voiceQueue",filters:{type:"inbound",fields:"id,name,type",sort:"name",nolimit:!0},permissions:{section:401}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",required:!0,param:0},{title:"Options",name:"options",type:"text",param:1},{title:"Url",name:"URL",type:"text",param:2},{title:"Announce_Overrides",name:"sound",type:"apiselect",values:"sounds",value:"'/var/opt/motion2/server/files/sounds/converted/{{sound.save_name}}'",option:"sound.name",defaultValues:[{value:"''",option:"None"}],param:3},{title:"Timeout",name:"timeout",type:"number",min:0,param:4},{title:"Agi",name:"agi",type:"text",param:5},{title:"Macro",name:"macro",type:"text",param:6},{title:"GoSub",name:"gosub",type:"text",param:7},{title:"Rule",name:"rule",type:"text",param:8},{title:"Position",name:"position",type:"number",min:0,param:9},{title:"Answer",name:"answer",type:"switch",general:!0}]},{app:"Playback",appType:"playback",context:"from-sip",type:"Internal",icon:"icon-apps",interval:"*,*,*,*",answer:!0,isApp:!0,extraApi:[{name:"sounds",field:{name:"appdata",key:"save_name",prefix:"/var/opt/motion2/server/files/sounds/converted/"},route:"sound",filters:{fields:"id,name,save_name",sort:"name"},permissions:{section:1007}}],fields:[{title:"Audio_Files",name:"appdata",type:"apiselect",values:"sounds",value:"'/var/opt/motion2/server/files/sounds/converted/{{appdata.save_name}}'",option:"appdata.name",required:!0,param:0},{title:"Options",name:"options",type:"text",param:1},{title:"Answer",name:"answer",type:"switch",general:!0}]},{app:"Dial",appType:"dial",context:"from-sip",type:"Internal",icon:"icon-apps",options:"xX",interval:"*,*,*,*",isApp:!0,fields:[{title:"Technology/Resource",name:"tech",type:"text",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:"Dial",appType:"internalDial",context:"from-sip",type:"Internal",icon:"icon-apps",options:"xX",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"users",field:{name:"user",key:"name",prefix:"SIP/"},route:"user",filters:{fields:"id,name,role",sort:"name"},permissions:{sections:[{id:202,role:"agent"},{id:203,role:"telephone"}]}}],fields:[{title:"User",name:"user",type:"apiselect",values:"users",value:"'SIP/{{user.name}}'",option:"user.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:"Dial",appType:"externalDial",context:"from-sip",type:"Internal",icon:"icon-apps",interval:"*,*,*,*",options:"xX",isApp:!0,extraApi:[{name:"trunks",field:{name:"trunk",key:"name"},route:"trunk",filters:{fields:"id,name",sort:"name"},permissions:{section:1011}}],fields:[{title:"Trunk",name:"trunk",type:"apiselect",values:"trunks",value:"trunk.name",option:"trunk.name",required:!0,param:0},{title:"Phone",name:"phone",type:"text"},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:"Dial",appType:"ringGroup",context:"from-sip",type:"Internal",icon:"icon-apps",interval:"*,*,*,*",options:"xX",isApp:!0,extraApi:[{name:"users",field:{name:"multipleUsers",key:"name",prefix:"SIP/"},route:"user",filters:{fields:"id,name,role",sort:"name"},permissions:{sections:[{id:202,role:"agent"},{id:203,role:"telephone"}]}}],fields:[{title:"User",name:"multipleUsers",type:"apiselect",multiple:!0,values:"users",value:"'SIP/{{multipleUsers.name}}'",option:"multipleUsers.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:"AGI",alias:"CallySquare",appType:"agi",context:"from-sip",type:"Internal",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"projects",field:{name:"project",key:"name",prefix:"agi://127.0.0.1/square,"},route:"squareProject",filters:{fields:"id,name",sort:"name"},permissions:{section:1103}}],fields:[{title:"Project",name:"project",type:"apiselect",values:"projects",value:"'agi://127.0.0.1/square,{{project.name}}'",option:"project.name",required:!0,param:0}]},{app:"goto",appType:"goTo",context:"from-sip",type:"Internal",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"contexts",field:{name:"context",key:"name"},route:"voiceContext",filters:{fields:"id,name",sort:"name"},permissions:{section:405}}],fields:[{title:"Context",name:"context",type:"apiselect",values:"contexts",value:"context.name",option:"context.name",required:!0,param:0},{title:"Extension",name:"extension",type:"text",required:!0,param:1},{title:"Priority",name:"priority",type:"text",required:!0,param:2}]},{app:"hangup",appType:"hangup",context:"from-sip",type:"Internal",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Hangup_Cause",name:"appdata",type:"select",param:0,values:[{option:"HANGUPCAUSE_1",value:"'1'"},{option:"HANGUPCAUSE_16",value:"'16'"},{option:"HANGUPCAUSE_17",value:"'17'"},{option:"HANGUPCAUSE_18",value:"'18'"},{option:"HANGUPCAUSE_21",value:"'21'"},{option:"HANGUPCAUSE_22",value:"'22'"},{option:"HANGUPCAUSE_27",value:"'27'"},{option:"HANGUPCAUSE_38",value:"'38'"},{option:"HANGUPCAUSE_41",value:"'41'"}],translate:!0,required:!0,general:!0}]},{app:"Set",appType:"set",context:"from-sip",type:"Internal",separator:"=",icon:"icon-apps",interval:"*,*,*,*",extraApi:[{name:"variables",field:{name:"name",key:"name"},route:"variable",filters:{fields:"id,name",sort:"name"},permissions:{section:1012}}],isApp:!0,fields:[{title:"Variable",name:"name",type:"apiselect",values:"variables",value:"name.name",option:"name.name",required:!0,param:0},{title:"Value",name:"value",type:"text",required:!0,param:1}]},{app:null,appType:"custom",icon:"icon-apps",type:"Internal",interval:"*,*,*,*",isApp:!0,fields:[{title:"Application_Name",name:"app",type:"text",required:!0,param:0},{title:"Arguments",name:"appdata",type:"text",param:1}]},{app:"Voicemail",appType:"voicemail",context:"from-sip",icon:"icon-apps",type:"Internal",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"voiceMails",field:{name:"voiceMail",key:"mailbox",suffix:"@from-voicemail"},route:"voiceMail",filters:{fields:"id,mailbox",sort:"mailbox"},permissions:{section:406}}],fields:[{title:"Mailbox@Context",name:"voiceMail",type:"apiselect",values:"voiceMails",value:"'{{voiceMail.mailbox}}@from-voicemail'",option:"voiceMail.mailbox",required:!0,param:0},{title:"Options",name:"options",type:"text",param:1}]}],["app"]),{isApp:!1}),u.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},u.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){t(e,e.newIndex)},onSort:function(e){o()}},u.init=function(e,t){u.internalroute=e,u.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},u.applications.disabled=!u.crudPermissions.canEdit,u.query.VoiceExtensionId=e.id,u.query.isApp=!0,u.query.nolimit=!0,u.getInternalRouteApps(),u.getIntervals()},u.deleteConfirm=function(e,t,n){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(n).ok("OK").cancel("CANCEL");i.show(a).then(function(){u.internalrouteApps.rows.splice(t,1),o()},function(){console.log("CANCEL")})},u.getInternalRouteApps=function(){u.promise=m.voiceExtension.get(u.query,n).$promise},u.editInternalRouteApp=t,u.editInterval=function(e,t){if(u.internalrouteApps.rows.length){var n=u.internalrouteApps.rows[t]?u.internalrouteApps.rows[t]:u.internalrouteApps.rows[0];i.show({controller:"EditInternalAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/internalroutes/edit/apps/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:n.interval,IntervalId:n.IntervalId,application:!0},intervals:[],crudPermissions:u.crudPermissions}}).then(function(e){e&&(n.interval=e.interval||"*,*,*,*",n.IntervalId=e.IntervalId||null,o())})}},u.deleteInternalRouteApp=function(e){_.remove(u.internalrouteApps.rows,{id:e.id}),o(),s.success({title:"App deleted!",msg:e.app?e.app+" has been deleted!":""})},u.deleteSelectedInternalRouteApps=function(e){var t=i.confirm().title("Are you sure want to delete the selected applications?").htmlContent("<b>"+u.selectedInternalRouteApps.length+" selected</b> will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){u.selectedInternalRouteApps.forEach(function(e){_.remove(u.internalrouteApps.rows,{id:e.id})}),u.selectedInternalRouteApps=[],o()})},u.rewriteRouting=o,u.getIntervals=function(){return m.interval.get({fields:"id,interval,IntervalId"}).$promise.then(function(e){u.intervals=e}).catch(function(e){console.error(e)})}}e.$inject=["api","$mdDialog","$document","toasty","Auth"],angular.module("app.voice").controller("InternalRouteActionsController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.agi=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.agi.appdata)switch(l.agi.appType?l.agi.appType.toLowerCase():l.agi.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.agi.appdata.split(",");l.agi.key=d[0],l.agi.language=d[1],l.agi.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.agi.appdata.split(",");l.agi.accesskeyid=d[0],l.agi.secretaccesskey=d[1],l.agi.lexregion=d[2],l.agi.botname=d[3],l.agi.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.agi.appdata.split(",");l.agi.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.agi.text=d.slice(1,d.length).join(",");break;case"message":l.agi.text=l.agi.appdata;break;case"set":l.agi.name=l.agi.appdata.split("=")[0],l.agi.value=l.agi.appdata.split("=")[1];break;case"agi":l.agi.project=l.agi.appdata;break;default:var c=l.agi.appdata.split(",");l.agi.project=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){t.hide(e)}l.agi.type&&"outbound"===l.agi.type.toLowerCase()&&"outbounddial"===l.agi.appType.toLowerCase()&&(l.agi.prefix=l.agi.phone?l.agi.phone.split("$")[0]:void 0,l.agi.callerId=l.agi.callerID?"CALLERID(all)="+l.agi.callerID:void 0),l.saveInternalRouteApp=function(){l.errors=[];var e=[];l.agi.type&&"outbound"===l.agi.type.toLowerCase()&&"outboundDial"===l.agi.appType&&(l.agi.phone=i.cutdigits?(l.agi.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.agi.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.agi.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.agi.options+="U(xcally-mixmonitor-context)"):l.agi.options=l.agi.options.replace("U(xcally-mixmonitor-context)",""));if(l.agi.appType&&"custom"===l.agi.appType);else switch((l.agi.app||l.agi.appType).toLowerCase()){case"set":l.agi.appdata=l.agi.name+"="+l.agi.value;break;case"custom":break;default:e[0]=l.agi.project,l.agi.appdata=e.join(",")}m(l.agi)},l.closeDialog=m,o.hasRole("admin")?s.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.projects=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PROJECTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.projects=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1103}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.projects,{id:e.resourceId})}),n=null;if(l.agi&&(n=_.find(l.projects,{name:l.agi.project})),n&&!_.some(t,["id",n.id])){var a=_.find(l.projects,{id:n.id});a.canSelect=!1,t.push(a)}l.projects=t})}else{var n=[],a=null;l.agi&&(a=_.find(l.projects,{name:l.agi.project}));for(var i=0;i<l.projects.length;i++)a&&l.projects[i].id===a.id&&(l.projects[i].canSelect=!1,n.push(l.projects[i]));l.projects=n}}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","internalrouteApp","internalroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInternalAppagiDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.custom=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.custom.appdata)switch(l.custom.appType?l.custom.appType.toLowerCase():l.custom.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.custom.appdata.split(",");l.custom.key=d[0],l.custom.language=d[1],l.custom.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.custom.appdata.split(",");l.custom.accesskeyid=d[0],l.custom.secretaccesskey=d[1],l.custom.lexregion=d[2],l.custom.botname=d[3],l.custom.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.custom.appdata.split(",");l.custom.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.custom.text=d.slice(1,d.length).join(",");break;case"message":l.custom.text=l.custom.appdata;break;case"set":l.custom.name=l.custom.appdata.split("=")[0],l.custom.value=l.custom.appdata.split("=")[1];break;case"agi":l.custom.project=l.custom.appdata;break;default:var c=l.custom.appdata.split(",");l.custom.app=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.custom.appdata=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}function m(e){t.hide(e)}l.custom.type&&"outbound"===l.custom.type.toLowerCase()&&"outbounddial"===l.custom.appType.toLowerCase()&&(l.custom.prefix=l.custom.phone?l.custom.phone.split("$")[0]:void 0,l.custom.callerId=l.custom.callerID?"CALLERID(all)="+l.custom.callerID:void 0),l.saveInternalRouteApp=function(){l.errors=[];var e=[];l.custom.type&&"outbound"===l.custom.type.toLowerCase()&&"outboundDial"===l.custom.appType&&(l.custom.phone=i.cutdigits?(l.custom.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.custom.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.custom.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.custom.options+="U(xcally-mixmonitor-context)"):l.custom.options=l.custom.options.replace("U(xcally-mixmonitor-context)",""));if(l.custom.appType&&"custom"===l.custom.appType);else switch((l.custom.app||l.custom.appType).toLowerCase()){case"set":l.custom.appdata=l.custom.name+"="+l.custom.value;break;case"custom":break;default:e[0]=l.custom.app,e[1]=l.custom.appdata,l.custom.appdata=e.join(",")}m(l.custom)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","internalrouteApp","internalroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInternalAppcustomDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.dial=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dial.appdata)switch(l.dial.appType?l.dial.appType.toLowerCase():l.dial.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dial.appdata.split(",");l.dial.key=d[0],l.dial.language=d[1],l.dial.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.dial.appdata.split(",");l.dial.accesskeyid=d[0],l.dial.secretaccesskey=d[1],l.dial.lexregion=d[2],l.dial.botname=d[3],l.dial.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dial.appdata.split(",");l.dial.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dial.text=d.slice(1,d.length).join(",");break;case"message":l.dial.text=l.dial.appdata;break;case"set":l.dial.name=l.dial.appdata.split("=")[0],l.dial.value=l.dial.appdata.split("=")[1];break;case"agi":l.dial.project=l.dial.appdata;break;default:var c=l.dial.appdata.split(",");l.dial.tech=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dial.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dial.options=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.dial.url=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10)}function m(e){t.hide(e)}l.dial.type&&"outbound"===l.dial.type.toLowerCase()&&"outbounddial"===l.dial.appType.toLowerCase()&&(l.dial.prefix=l.dial.phone?l.dial.phone.split("$")[0]:void 0,l.dial.callerId=l.dial.callerID?"CALLERID(all)="+l.dial.callerID:void 0),l.saveInternalRouteApp=function(){l.errors=[];var e=[];l.dial.type&&"outbound"===l.dial.type.toLowerCase()&&"outboundDial"===l.dial.appType&&(l.dial.phone=i.cutdigits?(l.dial.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dial.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dial.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dial.options+="U(xcally-mixmonitor-context)"):l.dial.options=l.dial.options.replace("U(xcally-mixmonitor-context)",""));if(l.dial.appType&&"custom"===l.dial.appType);else switch((l.dial.app||l.dial.appType).toLowerCase()){case"set":l.dial.appdata=l.dial.name+"="+l.dial.value;break;case"custom":break;default:e[0]=l.dial.tech,e[1]=l.dial.timeout,e[2]=l.dial.options,e[3]=l.dial.url,l.dial.appdata=e.join(",")}m(l.dial)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","internalrouteApp","internalroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInternalAppdialDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.externaldial=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.externaldial.appdata)switch(l.externaldial.appType?l.externaldial.appType.toLowerCase():l.externaldial.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.externaldial.appdata.split(",");l.externaldial.key=d[0],l.externaldial.language=d[1],l.externaldial.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.externaldial.appdata.split(",");l.externaldial.accesskeyid=d[0],l.externaldial.secretaccesskey=d[1],l.externaldial.lexregion=d[2],l.externaldial.botname=d[3],l.externaldial.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.externaldial.appdata.split(",");l.externaldial.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.externaldial.text=d.slice(1,d.length).join(",");break;case"message":l.externaldial.text=l.externaldial.appdata;break;case"set":l.externaldial.name=l.externaldial.appdata.split("=")[0],l.externaldial.value=l.externaldial.appdata.split("=")[1];break;case"agi":l.externaldial.project=l.externaldial.appdata;break;default:var c=l.externaldial.appdata.split(",");l.externaldial.trunk=c[0].split("/")[1],l.externaldial.phone=c[0].split("/")[2],l.externaldial.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.externaldial.options=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.externaldial.url=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10)}function m(e){t.hide(e)}l.externaldial.type&&"outbound"===l.externaldial.type.toLowerCase()&&"outbounddial"===l.externaldial.appType.toLowerCase()&&(l.externaldial.prefix=l.externaldial.phone?l.externaldial.phone.split("$")[0]:void 0,l.externaldial.callerId=l.externaldial.callerID?"CALLERID(all)="+l.externaldial.callerID:void 0),l.saveInternalRouteApp=function(){l.errors=[];var e=[];l.externaldial.type&&"outbound"===l.externaldial.type.toLowerCase()&&"outboundDial"===l.externaldial.appType&&(l.externaldial.phone=i.cutdigits?(l.externaldial.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.externaldial.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.externaldial.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.externaldial.options+="U(xcally-mixmonitor-context)"):l.externaldial.options=l.externaldial.options.replace("U(xcally-mixmonitor-context)",""));if(l.externaldial.appType&&"custom"===l.externaldial.appType);else switch((l.externaldial.app||l.externaldial.appType).toLowerCase()){case"set":l.externaldial.appdata=l.externaldial.name+"="+l.externaldial.value;break;case"custom":break;default:e[0]=["SIP",l.externaldial.trunk,l.externaldial.phone].join("/"),e[1]=l.externaldial.timeout,e[2]=l.externaldial.options,e[3]=l.externaldial.url,l.externaldial.appdata=e.join(",")}m(l.externaldial)},l.closeDialog=m,o.hasRole("admin")?s.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.trunks=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.trunks=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.trunks,{id:e.resourceId})}),n=null;if(l.externaldial&&(n=_.find(l.trunks,{name:l.externaldial.trunk})),n&&!_.some(t,["id",n.id])){var a=_.find(l.trunks,{id:n.id});a.canSelect=!1,t.push(a)}l.trunks=t})}else{var n=[],a=null;l.externaldial&&(a=_.find(l.trunks,{name:l.externaldial.trunk}));for(var i=0;i<l.trunks.length;i++)a&&l.trunks[i].id===a.id&&(l.trunks[i].canSelect=!1,n.push(l.trunks[i]));l.trunks=n}}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","internalrouteApp","internalroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInternalAppexternaldialDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.goto=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.goto.appdata)switch(l.goto.appType?l.goto.appType.toLowerCase():l.goto.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.goto.appdata.split(",");l.goto.key=d[0],l.goto.language=d[1],l.goto.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.goto.appdata.split(",");l.goto.accesskeyid=d[0],l.goto.secretaccesskey=d[1],l.goto.lexregion=d[2],l.goto.botname=d[3],l.goto.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.goto.appdata.split(",");l.goto.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.goto.text=d.slice(1,d.length).join(",");break;case"message":l.goto.text=l.goto.appdata;break;case"set":l.goto.name=l.goto.appdata.split("=")[0],l.goto.value=l.goto.appdata.split("=")[1];break;case"agi":l.goto.project=l.goto.appdata;break;default:var c=l.goto.appdata.split(",");l.goto.context=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.goto.extension=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.goto.priority=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}function m(e){t.hide(e)}l.goto.type&&"outbound"===l.goto.type.toLowerCase()&&"outbounddial"===l.goto.appType.toLowerCase()&&(l.goto.prefix=l.goto.phone?l.goto.phone.split("$")[0]:void 0,l.goto.callerId=l.goto.callerID?"CALLERID(all)="+l.goto.callerID:void 0),l.saveInternalRouteApp=function(){l.errors=[];var e=[];l.goto.type&&"outbound"===l.goto.type.toLowerCase()&&"outboundDial"===l.goto.appType&&(l.goto.phone=i.cutdigits?(l.goto.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.goto.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.goto.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.goto.options+="U(xcally-mixmonitor-context)"):l.goto.options=l.goto.options.replace("U(xcally-mixmonitor-context)",""));if(l.goto.appType&&"custom"===l.goto.appType);else switch((l.goto.app||l.goto.appType).toLowerCase()){case"set":l.goto.appdata=l.goto.name+"="+l.goto.value;break;case"custom":break;default:e[0]=l.goto.context,e[1]=l.goto.extension,e[2]=l.goto.priority,l.goto.appdata=e.join(",")}m(l.goto)},l.closeDialog=m,o.hasRole("admin")?s.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.contexts=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.contexts=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.contexts,{id:e.resourceId})}),n=null;if(l.goto&&(n=_.find(l.contexts,{name:l.goto.context})),n&&!_.some(t,["id",n.id])){var a=_.find(l.contexts,{id:n.id});a.canSelect=!1,t.push(a)}l.contexts=t}):s.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){l.contexts=e.rows||[]})}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","internalrouteApp","internalroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInternalAppgotoDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.hangup=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.hangup.appdata)switch(l.hangup.appType?l.hangup.appType.toLowerCase():l.hangup.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.hangup.appdata.split(",");l.hangup.key=d[0],l.hangup.language=d[1],l.hangup.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.hangup.appdata.split(",");l.hangup.accesskeyid=d[0],l.hangup.secretaccesskey=d[1],l.hangup.lexregion=d[2],l.hangup.botname=d[3],l.hangup.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.hangup.appdata.split(",");l.hangup.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.hangup.text=d.slice(1,d.length).join(",");break;case"message":l.hangup.text=l.hangup.appdata;break;case"set":l.hangup.name=l.hangup.appdata.split("=")[0],l.hangup.value=l.hangup.appdata.split("=")[1];break;case"agi":l.hangup.project=l.hangup.appdata;break;default:var c=l.hangup.appdata.split(",");l.hangup.appdata=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){t.hide(e)}l.hangup.type&&"outbound"===l.hangup.type.toLowerCase()&&"outbounddial"===l.hangup.appType.toLowerCase()&&(l.hangup.prefix=l.hangup.phone?l.hangup.phone.split("$")[0]:void 0,l.hangup.callerId=l.hangup.callerID?"CALLERID(all)="+l.hangup.callerID:void 0),l.saveInternalRouteApp=function(){l.errors=[];var e=[];l.hangup.type&&"outbound"===l.hangup.type.toLowerCase()&&"outboundDial"===l.hangup.appType&&(l.hangup.phone=i.cutdigits?(l.hangup.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.hangup.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.hangup.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.hangup.options+="U(xcally-mixmonitor-context)"):l.hangup.options=l.hangup.options.replace("U(xcally-mixmonitor-context)",""));if(l.hangup.appType&&"custom"===l.hangup.appType);else switch((l.hangup.app||l.hangup.appType).toLowerCase()){case"set":l.hangup.appdata=l.hangup.name+"="+l.hangup.value;break;case"custom":break;default:e[0]=l.hangup.appdata,l.hangup.appdata=e.join(",")}m(l.hangup)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","internalrouteApp","internalroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInternalApphangupDialogController",e)}(),function(){"use strict";function e(t,o,n,e,a,r,i,s){var l=this;if(l.currentUser=i.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(e.appType||e.app).toUpperCase(),l.internaldial=angular.copy(e),l.crudPermissions=s,l.hasModulePermissions={},l.internaldial.appdata)switch(l.internaldial.appType?l.internaldial.appType.toLowerCase():l.internaldial.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.internaldial.appdata.split(",");l.internaldial.key=d[0],l.internaldial.language=d[1],l.internaldial.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.internaldial.appdata.split(",");l.internaldial.accesskeyid=d[0],l.internaldial.secretaccesskey=d[1],l.internaldial.lexregion=d[2],l.internaldial.botname=d[3],l.internaldial.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.internaldial.appdata.split(",");l.internaldial.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.internaldial.text=d.slice(1,d.length).join(",");break;case"message":l.internaldial.text=l.internaldial.appdata;break;case"set":l.internaldial.name=l.internaldial.appdata.split("=")[0],l.internaldial.value=l.internaldial.appdata.split("=")[1];break;case"agi":l.internaldial.project=l.internaldial.appdata;break;default:var c=l.internaldial.appdata.split(",");l.internaldial.user=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.internaldial.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.internaldial.options=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.internaldial.url=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10)}l.internaldial.type&&"outbound"===l.internaldial.type.toLowerCase()&&"outbounddial"===l.internaldial.appType.toLowerCase()&&(l.internaldial.prefix=l.internaldial.phone?l.internaldial.phone.split("$")[0]:void 0,l.internaldial.callerId=l.internaldial.callerID?"CALLERID(all)="+l.internaldial.callerID:void 0),l.saveInternalRouteApp=function(){l.errors=[];var e=[];l.internaldial.type&&"outbound"===l.internaldial.type.toLowerCase()&&"outboundDial"===l.internaldial.appType&&(l.internaldial.phone=a.cutdigits?(l.internaldial.prefix||"")+"${EXTEN:"+a.cutdigits+"}":(l.internaldial.prefix||"")+"${EXTEN}","none"!==a.recordingFormat?l.internaldial.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.internaldial.options+="U(xcally-mixmonitor-context)"):l.internaldial.options=l.internaldial.options.replace("U(xcally-mixmonitor-context)",""));if(l.internaldial.appType&&"custom"===l.internaldial.appType);else switch((l.internaldial.app||l.internaldial.appType).toLowerCase()){case"set":l.internaldial.appdata=l.internaldial.name+"="+l.internaldial.value;break;case"custom":break;default:e[0]=l.internaldial.user,e[1]=l.internaldial.timeout,e[2]=l.internaldial.options,e[3]=l.internaldial.url,l.internaldial.appdata=e.join(",")}p(l.internaldial)},l.closeDialog=p;var m=[{id:202,role:"agent"},{id:203,role:"telephone"}],u=null;function p(e){t.hide(e)}i.hasRole("admin")?r.user.get({fields:"id,name,role",sort:"name"}).$promise.then(function(e){l.users=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.user.get({fields:"id,name,role",sort:"name"}).$promise.then(function(e){u=e.rows||[]}).then(function(){for(var e=[],t=0;t<m.length;t++)e.push(r.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:m[t].id}).$promise);return o.all(e)}).then(function(e){for(var t=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),n=[],a=0;a<m.length;a++){var i=_.find(t,["sectionId",m[a].id]);if(i)if(i.autoAssociation){var s=[];u.forEach(function(e){e.role===m[a].role&&s.push(e)}),n.push({rows:s,count:s.length})}else n.push(r.userProfileResource.get({sectionId:i.id}).$promise)}return o.all(n)}).then(function(e){var t=[],n=null;l.internaldial&&(n=_.find(u,{name:l.internaldial.user}));for(var a=0;a<e.length;a++){(e[a].rows||[]).forEach(function(e){t.push(e)})}n&&!_.some(t,["resourceId",n.id])&&u.forEach(function(e){e.id===n.id&&(e.canSelect=!1,t.push(e))}),l.users=t}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETusers",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","internalrouteApp","internalroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInternalAppinternaldialDialogController",e)}(),function(){"use strict";function e(e,t,n,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 E(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var t=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),n=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(t+"-"+n)}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 A(e){t.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=E(),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!":""}),A()}).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=E(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),A(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var t=_.find(c.intervals,{id:e.id});t&&_.merge(t,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),A()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=A,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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=e&&e.rows?e.rows:[],n=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(t,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,n.push(e))}),c.intervals=n})}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("EditInternalAppintervalDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.playback=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.playback.appdata)switch(l.playback.appType?l.playback.appType.toLowerCase():l.playback.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.playback.appdata.split(",");l.playback.key=d[0],l.playback.language=d[1],l.playback.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.playback.appdata.split(",");l.playback.accesskeyid=d[0],l.playback.secretaccesskey=d[1],l.playback.lexregion=d[2],l.playback.botname=d[3],l.playback.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.playback.appdata.split(",");l.playback.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.playback.text=d.slice(1,d.length).join(",");break;case"message":l.playback.text=l.playback.appdata;break;case"set":l.playback.name=l.playback.appdata.split("=")[0],l.playback.value=l.playback.appdata.split("=")[1];break;case"agi":l.playback.project=l.playback.appdata;break;default:var c=l.playback.appdata.split(",");l.playback.appdata=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.playback.options=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}function m(e){t.hide(e)}l.playback.type&&"outbound"===l.playback.type.toLowerCase()&&"outbounddial"===l.playback.appType.toLowerCase()&&(l.playback.prefix=l.playback.phone?l.playback.phone.split("$")[0]:void 0,l.playback.callerId=l.playback.callerID?"CALLERID(all)="+l.playback.callerID:void 0),l.saveInternalRouteApp=function(){l.errors=[];var e=[];l.playback.type&&"outbound"===l.playback.type.toLowerCase()&&"outboundDial"===l.playback.appType&&(l.playback.phone=i.cutdigits?(l.playback.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.playback.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.playback.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.playback.options+="U(xcally-mixmonitor-context)"):l.playback.options=l.playback.options.replace("U(xcally-mixmonitor-context)",""));if(l.playback.appType&&"custom"===l.playback.appType);else switch((l.playback.app||l.playback.appType).toLowerCase()){case"set":l.playback.appdata=l.playback.name+"="+l.playback.value;break;case"custom":break;default:e[0]=l.playback.appdata,e[1]=l.playback.options,l.playback.appdata=e.join(",")}m(l.playback)},l.closeDialog=m,o.hasRole("admin")?s.sound.get({fields:"id,name,save_name",sort:"name"}).$promise.then(function(e){l.sounds=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SOUNDS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.sound.get({fields:"id,name,save_name",sort:"name"}).$promise.then(function(e){l.sounds=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1007}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.sounds,{id:e.resourceId})}),n=null;if(l.playback&&(n=_.find(l.sounds,{save_name:l.playback.appdata})),n&&!_.some(t,["id",n.id])){var a=_.find(l.sounds,{id:n.id});a.canSelect=!1,t.push(a)}l.sounds=t})}else{var n=[],a=null;l.playback&&(a=_.find(l.sounds,{save_name:l.playback.appdata}));for(var i=0;i<l.sounds.length;i++)a&&l.sounds[i].id===a.id&&(l.sounds[i].canSelect=!1,n.push(l.sounds[i]));l.sounds=n}}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsounds",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","internalrouteApp","internalroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInternalAppplaybackDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.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"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.options=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.queue.URL=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.queue.sound=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.queue.timeout=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10),l.queue.agi=_.isEmpty(c[5])?c[5]:isNaN(c[5])?c[5]:parseInt(c[5],10),l.queue.macro=_.isEmpty(c[6])?c[6]:isNaN(c[6])?c[6]:parseInt(c[6],10),l.queue.gosub=_.isEmpty(c[7])?c[7]:isNaN(c[7])?c[7]:parseInt(c[7],10),l.queue.rule=_.isEmpty(c[8])?c[8]:isNaN(c[8])?c[8]:parseInt(c[8],10),l.queue.position=_.isEmpty(c[9])?c[9]:isNaN(c[9])?c[9]:parseInt(c[9],10)}function m(e){t.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.saveInternalRouteApp=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)",""));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.options,e[2]=l.queue.URL,e[3]=l.queue.sound,e[4]=l.queue.timeout,e[5]=l.queue.agi,e[6]=l.queue.macro,e[7]=l.queue.gosub,e[8]=l.queue.rule,e[9]=l.queue.position,l.queue.appdata=e.join(",")}m(l.queue)},l.closeDialog=m,o.hasRole("admin")?s.sound.get({fields:"id,name,save_name",sort:"name"}).$promise.then(function(e){l.sounds=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SOUNDS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.sound.get({fields:"id,name,save_name",sort:"name"}).$promise.then(function(e){l.sounds=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1007}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.sounds,{id:e.resourceId})}),n=null;if(l.queue&&(n=_.find(l.sounds,{save_name:l.queue.sound})),n&&!_.some(t,["id",n.id])){var a=_.find(l.sounds,{id:n.id});a.canSelect=!1,t.push(a)}l.sounds=t})}else{var n=[],a=null;l.queue&&(a=_.find(l.sounds,{save_name:l.queue.sound}));for(var i=0;i<l.sounds.length;i++)a&&l.sounds[i].id===a.id&&(l.sounds[i].canSelect=!1,n.push(l.sounds[i]));l.sounds=n}}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsounds",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.hasRole("admin")?s.voiceQueue.get({type:"inbound",fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.voiceQueue.get({type:"inbound",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:401}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),n=null;if(l.queue&&(n=_.find(l.queues,{name:l.queue.queue})),n&&!_.some(t,["id",n.id])){var a=_.find(l.queues,{id:n.id});a.canSelect=!1,t.push(a)}l.queues=t})}else{var n=[],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,n.push(l.queues[i]));l.queues=n}}).catch(function(e){n.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","internalrouteApp","internalroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInternalAppqueueDialogController",e)}(),function(){"use strict";function e(t,o,n,e,a,r,i,s){var l=this;if(l.currentUser=i.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(e.appType||e.app).toUpperCase(),l.ringgroup=angular.copy(e),l.crudPermissions=s,l.hasModulePermissions={},l.ringgroup.appdata)switch(l.ringgroup.appType?l.ringgroup.appType.toLowerCase():l.ringgroup.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.ringgroup.appdata.split(",");l.ringgroup.key=d[0],l.ringgroup.language=d[1],l.ringgroup.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.ringgroup.appdata.split(",");l.ringgroup.accesskeyid=d[0],l.ringgroup.secretaccesskey=d[1],l.ringgroup.lexregion=d[2],l.ringgroup.botname=d[3],l.ringgroup.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.ringgroup.appdata.split(",");l.ringgroup.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.ringgroup.text=d.slice(1,d.length).join(",");break;case"message":l.ringgroup.text=l.ringgroup.appdata;break;case"set":l.ringgroup.name=l.ringgroup.appdata.split("=")[0],l.ringgroup.value=l.ringgroup.appdata.split("=")[1];break;case"agi":l.ringgroup.project=l.ringgroup.appdata;break;default:var c=l.ringgroup.appdata.split(",");l.ringgroup.multipleUsers=c[0].split("&"),l.ringgroup.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.ringgroup.options=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.ringgroup.url=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10)}l.ringgroup.type&&"outbound"===l.ringgroup.type.toLowerCase()&&"outbounddial"===l.ringgroup.appType.toLowerCase()&&(l.ringgroup.prefix=l.ringgroup.phone?l.ringgroup.phone.split("$")[0]:void 0,l.ringgroup.callerId=l.ringgroup.callerID?"CALLERID(all)="+l.ringgroup.callerID:void 0),l.saveInternalRouteApp=function(){l.errors=[];var e=[];l.ringgroup.type&&"outbound"===l.ringgroup.type.toLowerCase()&&"outboundDial"===l.ringgroup.appType&&(l.ringgroup.phone=a.cutdigits?(l.ringgroup.prefix||"")+"${EXTEN:"+a.cutdigits+"}":(l.ringgroup.prefix||"")+"${EXTEN}","none"!==a.recordingFormat?l.ringgroup.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.ringgroup.options+="U(xcally-mixmonitor-context)"):l.ringgroup.options=l.ringgroup.options.replace("U(xcally-mixmonitor-context)",""));if(l.ringgroup.appType&&"custom"===l.ringgroup.appType);else switch((l.ringgroup.app||l.ringgroup.appType).toLowerCase()){case"set":l.ringgroup.appdata=l.ringgroup.name+"="+l.ringgroup.value;break;case"custom":break;default:e[0]=l.ringgroup.multipleUsers.join("&"),e[1]=l.ringgroup.timeout,e[2]=l.ringgroup.options,e[3]=l.ringgroup.url,l.ringgroup.appdata=e.join(",")}p(l.ringgroup)},l.closeDialog=p;var m=[{id:202,role:"agent"},{id:203,role:"telephone"}],u=null;function p(e){t.hide(e)}i.hasRole("admin")?r.user.get({fields:"id,name,role",sort:"name"}).$promise.then(function(e){l.users=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.user.get({fields:"id,name,role",sort:"name"}).$promise.then(function(e){u=e.rows||[]}).then(function(){for(var e=[],t=0;t<m.length;t++)e.push(r.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:m[t].id}).$promise);return o.all(e)}).then(function(e){for(var t=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),n=[],a=0;a<m.length;a++){var i=_.find(t,["sectionId",m[a].id]);if(i)if(i.autoAssociation){var s=[];u.forEach(function(e){e.role===m[a].role&&s.push(e)}),n.push({rows:s,count:s.length})}else n.push(r.userProfileResource.get({sectionId:i.id}).$promise)}return o.all(n)}).then(function(e){var t=[],n=null;l.ringgroup&&(n=_.find(u,{name:l.ringgroup.multipleUsers}));for(var a=0;a<e.length;a++){(e[a].rows||[]).forEach(function(e){t.push(e)})}n&&!_.some(t,["resourceId",n.id])&&u.forEach(function(e){e.id===n.id&&(e.canSelect=!1,t.push(e))}),l.users=t}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETusers",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","internalrouteApp","internalroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInternalAppringgroupDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.set=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.set.appdata)switch(l.set.appType?l.set.appType.toLowerCase():l.set.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.set.appdata.split(",");l.set.key=d[0],l.set.language=d[1],l.set.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.set.appdata.split(",");l.set.accesskeyid=d[0],l.set.secretaccesskey=d[1],l.set.lexregion=d[2],l.set.botname=d[3],l.set.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.set.appdata.split(",");l.set.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.set.text=d.slice(1,d.length).join(",");break;case"message":l.set.text=l.set.appdata;break;case"set":l.set.name=l.set.appdata.split("=")[0],l.set.value=l.set.appdata.split("=")[1];break;case"agi":l.set.project=l.set.appdata;break;default:var c=l.set.appdata.split("=");l.set.name=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.set.value=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}function m(e){t.hide(e)}l.set.type&&"outbound"===l.set.type.toLowerCase()&&"outbounddial"===l.set.appType.toLowerCase()&&(l.set.prefix=l.set.phone?l.set.phone.split("$")[0]:void 0,l.set.callerId=l.set.callerID?"CALLERID(all)="+l.set.callerID:void 0),l.saveInternalRouteApp=function(){l.errors=[];var e=[];l.set.type&&"outbound"===l.set.type.toLowerCase()&&"outboundDial"===l.set.appType&&(l.set.phone=i.cutdigits?(l.set.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.set.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.set.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.set.options+="U(xcally-mixmonitor-context)"):l.set.options=l.set.options.replace("U(xcally-mixmonitor-context)",""));if(l.set.appType&&"custom"===l.set.appType);else switch((l.set.app||l.set.appType).toLowerCase()){case"set":l.set.appdata=l.set.name+"="+l.set.value;break;case"custom":break;default:e[0]=l.set.name,e[1]=l.set.value,l.set.appdata=e.join("=")}m(l.set)},l.closeDialog=m,o.hasRole("admin")?s.variable.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.variables=e.rows||[]}).catch(function(e){n.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"}).$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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),n=null;if(l.set&&(n=_.find(l.variables,{name:l.set.name})),n&&!_.some(t,["id",n.id])){var a=_.find(l.variables,{id:n.id});a.canSelect=!1,t.push(a)}l.variables=t})}else{var n=[],a=null;l.set&&(a=_.find(l.variables,{name:l.set.name}));for(var i=0;i<l.variables.length;i++)a&&l.variables[i].id===a.id&&(l.variables[i].canSelect=!1,n.push(l.variables[i]));l.variables=n}}).catch(function(e){n.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","internalrouteApp","internalroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInternalAppsetDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.voicemail=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.voicemail.appdata)switch(l.voicemail.appType?l.voicemail.appType.toLowerCase():l.voicemail.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.voicemail.appdata.split(",");l.voicemail.key=d[0],l.voicemail.language=d[1],l.voicemail.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.voicemail.appdata.split(",");l.voicemail.accesskeyid=d[0],l.voicemail.secretaccesskey=d[1],l.voicemail.lexregion=d[2],l.voicemail.botname=d[3],l.voicemail.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.voicemail.appdata.split(",");l.voicemail.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.voicemail.text=d.slice(1,d.length).join(",");break;case"message":l.voicemail.text=l.voicemail.appdata;break;case"set":l.voicemail.name=l.voicemail.appdata.split("=")[0],l.voicemail.value=l.voicemail.appdata.split("=")[1];break;case"agi":l.voicemail.project=l.voicemail.appdata;break;default:var c=l.voicemail.appdata.split(",");l.voicemail.voiceMail=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.voicemail.options=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}function m(e){t.hide(e)}l.voicemail.type&&"outbound"===l.voicemail.type.toLowerCase()&&"outbounddial"===l.voicemail.appType.toLowerCase()&&(l.voicemail.prefix=l.voicemail.phone?l.voicemail.phone.split("$")[0]:void 0,l.voicemail.callerId=l.voicemail.callerID?"CALLERID(all)="+l.voicemail.callerID:void 0),l.saveInternalRouteApp=function(){l.errors=[];var e=[];l.voicemail.type&&"outbound"===l.voicemail.type.toLowerCase()&&"outboundDial"===l.voicemail.appType&&(l.voicemail.phone=i.cutdigits?(l.voicemail.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.voicemail.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.voicemail.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.voicemail.options+="U(xcally-mixmonitor-context)"):l.voicemail.options=l.voicemail.options.replace("U(xcally-mixmonitor-context)",""));if(l.voicemail.appType&&"custom"===l.voicemail.appType);else switch((l.voicemail.app||l.voicemail.appType).toLowerCase()){case"set":l.voicemail.appdata=l.voicemail.name+"="+l.voicemail.value;break;case"custom":break;default:e[0]=l.voicemail.voiceMail,e[1]=l.voicemail.options,l.voicemail.appdata=e.join(",")}m(l.voicemail)},l.closeDialog=m,o.hasRole("admin")?s.voiceMail.get({fields:"id,mailbox",sort:"mailbox"}).$promise.then(function(e){l.voiceMails=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VOICEMAILS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.voiceMail.get({fields:"id,mailbox",sort:"mailbox"}).$promise.then(function(e){l.voiceMails=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:406}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.voiceMails,{id:e.resourceId})}),n=null;if(l.voicemail&&(n=_.find(l.voiceMails,{mailbox:l.voicemail.voiceMail})),n&&!_.some(t,["id",n.id])){var a=_.find(l.voiceMails,{id:n.id});a.canSelect=!1,t.push(a)}l.voiceMails=t})}else{var n=[],a=null;l.voicemail&&(a=_.find(l.voiceMails,{mailbox:l.voicemail.voiceMail}));for(var i=0;i<l.voiceMails.length;i++)a&&l.voiceMails[i].id===a.id&&(l.voiceMails[i].canSelect=!1,n.push(l.voiceMails[i]));l.voiceMails=n}}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMails",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","internalrouteApp","internalroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditInternalAppvoicemailDialogController",e)}(),function(){"use strict";function e(e,t,n,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=t.protocol()+"://"+t.host(),u.internalroute=c||e.params.internalroute||{},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.gotoInternalRoutes=function(){e.go("app.voice.internalroutes")},u.saveInternalRoute=function(){r.voiceExtension.update({id:u.internalroute.id},u.internalroute).$promise.then(function(){l.success({title:"InternalRoute updated!",msg:u.internalroute.name?u.internalroute.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceExtension",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 t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.contexts,{id:e.resourceId})}),n=null;if(u.internalroute&&(n=_.find(u.contexts,{name:u.internalroute.context})),n&&!_.some(t,["id",n.id])){var a=_.find(u.contexts,{id:n.id});a.canSelect=!1,t.push(a)}u.contexts=t}):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","internalroute","userProfileSection"],angular.module("app.voice").controller("InternalRouteController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.internalroutes=l||{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="internalroutes",b.listOrder="",b.listOrderAsc=null,b.selectedInternalRoutes=[],b.query={fields:"createdAt,updatedAt,id,appdata,type,exten,context,description",type:"internal",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,page:1},b.editstate=function(e,t){n.go("app.voice.internalroutes.edit",{id:e.id,internalroute:e,crudPermissions:b.crudPermissions})},b.deleteconfirm=function(e,t){var n=i.confirm().title("Are you sure want to delete the "+_.startCase("internalroute")+"?").htmlContent("<b>"+(e.name||"internalroute")+"</b> will be deleted.").ariaLabel("delete internalroute").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getInternalRoutes=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.voiceExtension.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="InternalRoutes",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditInternalRoute=function(e,t){i.show({controller:"CreateOrEditInternalRouteDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/internalroutes/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{internalroute:t,internalroutes:b.internalroutes.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteInternalRoute=S,b.exportSelectedInternalRoutes=function(){var e=angular.copy(b.selectedInternalRoutes);return b.selectedInternalRoutes=[],e},b.deleteSelectedInternalRoutes=function(e){var t=i.confirm().title("Are you sure want to delete the selected internalroutes?").htmlContent("<b>"+b.selectedInternalRoutes.length+" selected</b> will be deleted.").ariaLabel("delete InternalRoutes").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedInternalRoutes.forEach(function(e){S(e)}),b.selectedInternalRoutes=[]})},b.deselectInternalRoutes=function(){b.selectedInternalRoutes=[]},b.selectAllInternalRoutes=function(){b.selectedInternalRoutes=b.internalroutes.rows},g.hasRole("admin")?m.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){b.contexts=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){b.contexts=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(b.contexts,{id:e.resourceId})}),n=null;if(b.internalroute&&(n=_.find(b.contexts,{name:b.internalroute.context})),n&&!_.some(t,["id",n.id])){var a=_.find(b.contexts,{id:n.id});a.canSelect=!1,t.push(a)}b.contexts=t}):m.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){b.contexts=e.rows||[]})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})});var E=!0,A=1;function y(e){b.internalroutes=e||{count:0,rows:[]}}function S(e){m.voiceExtension.delete({id:e.id}).$promise.then(function(){_.remove(b.internalroutes.rows,{id:e.id}),b.internalroutes.count-=1,b.internalroutes.rows.length||b.getInternalRoutes(),p.success({title:_.startCase("InternalRoute")+" 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:DELETEvoiceExtension"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceExtension",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getInternalRoutes())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","internalroutes","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.voice").controller("InternalRoutesController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.musiconholds,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The musiconhold will be deleted.").ariaLabel("Delete MusicOnHold").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.musiconhold={},c.musiconholdMohSounds={count:0,rows:[]},c.selectedMusicOnHoldMohSounds=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,save_name,converted_format,audio",limit:10,page:1},c.init=function(e,t){c.musiconhold=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.musiconhold.id,c.query.VoiceMusicOnHoldId=c.musiconhold.id,c.getMusicOnHoldMohSounds()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the mohSound?").htmlContent("<b>"+(e.name||"mohSound")+"</b> will be deleted.").ariaLabel("delete mohSound").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.voiceMusicOnHoldDownload=function(s,e,t){return l.sound.download({id:s.id,exists:!0,attachments:t}).$promise.then(function(e){var t=[e.buffer],n="mohSound"+s.id,a=new Blob(t,{type:e.type});n=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",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMusicOnHold.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.success=p,c.getMusicOnHoldMohSounds=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.voiceMusicOnHold.getSounds(c.query,p).$promise},c.createOrEditMusicOnHoldMohSound=function(e,t){s.show({controller:"CreateOrEditMohSoundDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/musiconholds/edit/mohSounds/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{musiconhold:c.musiconhold,mohSound:t,mohSounds:c.musiconholdMohSounds.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedMusicOnHoldMohSounds=function(){var e=angular.copy(c.selectedMusicOnHoldMohSounds);return c.selectedMusicOnHoldMohSounds=[],e},c.deleteMusicOnHoldMohSound=g,c.deleteSelectedMusicOnHoldMohSounds=function(e){var t=s.confirm().title("Are you sure want to delete the selected mohSounds?").htmlContent("<b>"+c.selectedMusicOnHoldMohSounds.length+" selected</b> will be deleted.").ariaLabel("delete mohSounds").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedMusicOnHoldMohSounds.forEach(function(e){g(e)}),c.selectedMusicOnHoldMohSounds=[]})},d.hasRole("admin")?l.sound.get({fields:"id,name",sort:"name"}).$promise.then(function(e){c.sounds=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SOUNDS",msg:e.data?JSON.stringify(e.data):e.toString()})}):l.sound.get({fields:"id,name",sort:"name"}).$promise.then(function(e){c.sounds=e.rows||[]}).then(function(){return l.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1007}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return l.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(c.sounds,{id:e.resourceId})}),n=null;if(c.musiconhold&&(n=_.find(c.sounds,{id:Number(c.musiconhold.id)})),n&&!_.some(t,["id",n.id])){var a=_.find(c.sounds,{id:n.id});a.canSelect=!1,t.push(a)}c.sounds=t})}else{var n=[],a=null;c.musiconhold&&(a=_.find(c.sounds,{id:Number(c.musiconhold.id)}));for(var i=0;i<c.sounds.length;i++)a&&c.sounds[i].id===a.id&&(c.sounds[i].canSelect=!1,n.push(c.sounds[i]));c.sounds=n}}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsounds",msg:e.data?JSON.stringify(e.data):e.toString()})});var m=!0,u=1;function p(e){c.musiconholdMohSounds=e||{count:0,rows:[]}}function g(e){l.voiceMusicOnHold.removeSound({id:n.params.id,id2:e.id}).$promise.then(function(){_.remove(c.musiconholdMohSounds.rows,{id:e.id}),c.musiconholdMohSounds.count-=1,c.musiconholdMohSounds.rows.length||c.getMusicOnHoldMohSounds(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceMusicOnHold"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMusicOnHold",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getMusicOnHoldMohSounds())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.voice").controller("MusicOnHoldMohSoundsController",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(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),t.params.id&&(g.mohSound.VoiceMusicOnHoldId=t.params.id),g.addNewMohSound=function(){g.errors=[],d.voiceMusicOnHold.addSound({id:t.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.mohSounds,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The mohSound will be deleted.").ariaLabel("Delete MohSound").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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"}).$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"}).$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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.sounds,{id:e.resourceId})}),n=null;if(g.mohSound&&(n=_.find(g.sounds,{id:Number(g.mohSound.id)})),n&&!_.some(t,["id",n.id])){var a=_.find(g.sounds,{id:n.id});a.canSelect=!1,t.push(a)}g.sounds=t})}else{var n=[],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,n.push(g.sounds[i]));g.sounds=n}}).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,t,n,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=t.protocol()+"://"+t.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")},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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.musiconholds=l||{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="musiconholds",b.listOrder="",b.listOrderAsc=null,b.selectedMusicOnHolds=[],b.query={fields:"createdAt,updatedAt,id,name,mode,directory,application,format,sort",defaultEntry:"false",limit:10,page:1},b.arraymode=_.keyBy([{option:"Files",value:"'files'"},{option:"Custom",value:"'custom'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arraysort=_.keyBy([{option:"Random",value:"'random'"},{option:"Alphabetical",value:"'alpha'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.voice.musiconholds.edit",{id:e.id,musiconhold:e,crudPermissions:b.crudPermissions})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getMusicOnHolds=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.voiceMusicOnHold.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="MusicOnHolds",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditMusicOnHold=function(e,t){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:t,musiconholds:b.musiconholds.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteMusicOnHold=S,b.exportSelectedMusicOnHolds=function(){var e=angular.copy(b.selectedMusicOnHolds);return b.selectedMusicOnHolds=[],e},b.deleteSelectedMusicOnHolds=function(e){var t=i.confirm().title("Are you sure want to delete the selected musiconholds?").htmlContent("<b>"+b.selectedMusicOnHolds.length+" selected</b> will be deleted.").ariaLabel("delete MusicOnHolds").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedMusicOnHolds.forEach(function(e){S(e)}),b.selectedMusicOnHolds=[]})},b.deselectMusicOnHolds=function(){b.selectedMusicOnHolds=[]},b.selectAllMusicOnHolds=function(){b.selectedMusicOnHolds=b.musiconholds.rows};var E=!0,A=1;function y(e){b.musiconholds=e||{count:0,rows:[]}}function S(e){m.voiceMusicOnHold.delete({id:e.id}).$promise.then(function(){_.remove(b.musiconholds.rows,{id:e.id}),b.musiconholds.count-=1,b.musiconholds.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceMusicOnHold"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getMusicOnHolds())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","musiconholds","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.voice").controller("MusicOnHoldsController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,h,d,c,m,u){var f=this;function p(){var e=2,t=[];t.push({type:"outbound",app:"Set",appdata:"CDR(type)=outbound",context:f.outboundroute.context,exten:f.outboundroute.exten,priority:e++,VoiceExtensionId:f.outboundroute.id}),t.push({type:"outbound",app:"Set",appdata:"CDR(destination)="+(f.outboundroute.cutdigits?"${EXTEN:"+f.outboundroute.cutdigits+"}":"${EXTEN}"),context:f.outboundroute.context,exten:f.outboundroute.exten,priority:e++,VoiceExtensionId:f.outboundroute.id}),t.push({type:"outbound",app:"Set",appdata:"XCALLY-MOTION-ANSWER=0",context:f.outboundroute.context,exten:f.outboundroute.exten,priority:e++,VoiceExtensionId:f.outboundroute.id}),t.push({type:"outbound",app:"Set",appdata:"XCALLY-MOTION-PROGRESS=0",context:f.outboundroute.context,exten:f.outboundroute.exten,priority:e++,VoiceExtensionId:f.outboundroute.id}),t.push({type:"outbound",app:"Set",appdata:"MONITOR_OPTIONS=ab",context:f.outboundroute.context,exten:f.outboundroute.exten,priority:e++,VoiceExtensionId:f.outboundroute.id}),t.push({type:"outbound",app:"Set",appdata:"outboundrouteid="+f.outboundroute.id,context:f.outboundroute.context,exten:f.outboundroute.exten,priority:e++,VoiceExtensionId:f.outboundroute.id}),f.outboundroute.hasOwnProperty("recordingFormat")&&"none"!==f.outboundroute.recordingFormat&&(t.push({type:"outbound",app:"Set",appdata:"_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}",context:f.outboundroute.context,exten:f.outboundroute.exten,priority:e++,VoiceExtensionId:f.outboundroute.id}),t.push({type:"outbound",app:"Set",appdata:"_XCALLY_MIXMONITOR_FORMAT="+f.outboundroute.recordingFormat||"wav",context:f.outboundroute.context,exten:f.outboundroute.exten,priority:e++,VoiceExtensionId:f.outboundroute.id}));for(var n=0,a=0;n<f.outboundrouteApps.rows.length;n++,a=0){var i=f.outboundrouteApps.rows[n],s=[],o=[];i.intervals="*,*,*,*"!==i.interval?[i.interval]:i.IntervalId?_.map(_.filter(f.intervals.rows,{IntervalId:i.IntervalId}),"interval"):[],i.context=f.outboundroute.context,i.exten=f.outboundroute.exten,i.type&&(i.type=i.type.toLowerCase()),i.hasOwnProperty("tag")&&i.tag&&"--"!==i.tag&&s.push({type:i.type.toLowerCase(),app:"Set",appdata:"CDR(tag)="+i.tag,context:f.outboundroute.context,exten:f.outboundroute.exten,priority:i.intervals.length+e+a++,VoiceExtensionId:f.outboundroute.id}),i.callerID?s.push({type:i.type.toLowerCase(),app:"ExecIf",appdata:"$[${LEN(${PREFIX-CALLERIDALL})} > 0]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)="+i.callerID+")",context:f.outboundroute.context,exten:f.outboundroute.exten,priority:i.intervals.length+e+a++,VoiceExtensionId:f.outboundroute.id}):s.push({type:i.type.toLowerCase(),app:"ExecIf",appdata:"$[${LEN(${PREFIX-CALLERIDALL})} > 0]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No number available)",context:f.outboundroute.context,exten:f.outboundroute.exten,priority:i.intervals.length+e+a++,VoiceExtensionId:f.outboundroute.id});for(var r=0;r<i.intervals.length;r++){var l=e+i.intervals.length,d=r===i.intervals.length-1?e+s.length+o.length+2:e+r+1;s.splice(r,0,{type:"outbound",app:"GotoIfTime",appdata:i.intervals[r]+"?"+f.outboundroute.context+",${EXTEN},"+l+":"+f.outboundroute.context+",${EXTEN},"+d,exten:f.outboundroute.exten,context:f.outboundroute.context,priority:e+r,VoiceExtensionId:f.outboundroute.id})}if("outboundDial"===i.appType){var c=_.find(f.apps,{appType:"outboundDial"});if(c&&c.fields){for(var m={},u=i.appdata.split(","),p=[],g=0,v=c.fields.length;g<v;g++)if(c.fields[g].hasOwnProperty("param"))switch(c.fields[g].name){case"trunk":m.trunk=u[c.fields[g].param].split("/")[1],m.phone=u[c.fields[g].param].split("/")[2],m.prefix=m.phone?m.phone.split("$")[0]:void 0,m.phone=f.outboundroute.cutdigits?(m.prefix||"")+"${EXTEN:"+f.outboundroute.cutdigits+"}":(m.prefix||"")+"${EXTEN}",p[c.fields[g].param]=["SIP",m.trunk,m.phone].join("/");break;case"options":m.options=u[c.fields[g].param],"none"!==f.outboundroute.recordingFormat?m.options.indexOf("U(xcally-mixmonitor-context)")<0&&(m.options+="U(xcally-mixmonitor-context)"):m.options=m.options.replace("U(xcally-mixmonitor-context)",""),p[c.fields[g].param]=m.options;break;default:p[c.fields[g].param]=u[c.fields[g].param]}i.appdata=p.join(",")}}i.priority=s.length?_.last(s).priority+1:e,e=(o.length?_.last(o).priority:i.priority)+1,t=_.concat(t,s,[i],o)}t.push({type:"outbound",app:"Hangup",exten:f.outboundroute.exten,context:f.outboundroute.context,priority:e,VoiceExtensionId:f.outboundroute.id}),h.voiceExtension.addApplications({id:f.outboundroute.id},_.sortBy(t,"priority")).$promise.then(function(e){f.outboundrouteApps.rows=e.rows}).catch(function(e){console.error(e)})}function g(e){a.hide(e)}f.currentUser=d.getCurrentUser(),f.errors=[],f.setting=m,f.license=c,f.crudPermissions=u,f.hasModulePermissions={},f.passwordPattern=f.setting&&f.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",f.title="VOICE.EDIT_OUTBOUNDROUTE",f.outboundroute=angular.copy(l),f.outboundroutes=r,f.newOutboundRoute=!1,f.outboundrouteApps={count:0,rows:[]},f.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",type:"Outbound",types:["always","custom","list"],fields:[],isApp:!1},{app:"Dial",appType:"outboundDial",context:"from-sip",type:"Outbound",icon:"icon-apps",interval:"*,*,*,*",options:"xX",isApp:!0,extraApi:[{name:"trunks",route:"trunk",filters:{fields:"name",sort:"name"}},{name:"tags",route:"tag",filters:{fields:"name",sort:"name",nolimit:!0}}],fields:[{title:"Trunk",name:"trunk",type:"apiselect",values:"trunks",value:"trunk.name",option:"trunk.name",required:!0,param:0},{title:"Caller_ID",name:"callerID",type:"text",ngPattern:"/&quot;(.*)&quot;\\s&lt;(.*?)&gt;$/",help:!0},{title:"Prefix",name:"prefix",type:"text"},{title:"Tags",name:"tag",type:"apiselect",values:"tags",value:"tag.name",option:"tag.name",defaultValues:[{value:"'--'",option:"None"}]},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:null,type:"Outbound",appType:"custom",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Application_Name",name:"app",type:"text",required:!0,param:0},{title:"Arguments",name:"appdata",type:"text",param:1}]}],["app"]),{isApp:!1}),f.outboundroute||(f.outboundroute={appdata:"Outbound Call",type:"outbound",context:"from-sip",recordingFormat:"none"},f.title="VOICE.NEW_OUTBOUNDROUTE",f.newOutboundRoute=!0),f.addNewOutboundRoute=function(){f.errors=[],h.voiceExtension.save(f.outboundroute).$promise.then(function(e){f.outboundroutes.unshift(e.toJSON()),o.success({title:"OutboundRoute properly created",msg:f.outboundroute.name?f.outboundroute.name+" has been created!":""}),g(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.save"}];for(var t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},f.saveOutboundRoute=function(){f.errors=[],h.voiceExtension.update({id:f.outboundroute.id},f.outboundroute).$promise.then(function(e){var t=_.find(f.outboundroutes,{id:e.id});t&&(_.merge(t,_.pick(e.toJSON(),_.keys(t))),h.voiceExtension.get({sort:"priority",VoiceExtensionId:t.id,isApp:!0,nolimit:!0}).$promise.then(function(e){f.outboundrouteApps=e,p()})),o.success({title:"OutboundRoute properly saved!",msg:f.outboundroute.name?f.outboundroute.name+" has been saved!":""}),g(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.update"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},f.deleteOutboundRoute=function(n){h.voicePrefix.get({VoiceExtensionId:l.id}).$promise.then(function(e){if(e&&e.rows&&0<e.rows.length)return o.error({title:"Outbound route not deleted!",msg:"You can't remove an outbound route associated to an out prefix"});f.errors=[];var t=a.confirm().title("Are you sure?").content("The outboundroute will be deleted.").ariaLabel("Delete OutboundRoute").ok("Delete").cancel("Cancel").targetEvent(n);a.show(t).then(function(){h.voiceExtension.delete({id:f.outboundroute.id}).$promise.then(function(){_.remove(f.outboundroutes,{id:f.outboundroute.id}),o.success({title:"OutboundRoute properly deleted!",msg:(f.outboundroute.name||"outboundroute")+" has been deleted!"}),g(f.outboundroute)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.delete"}];for(var t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})})},f.getDateFromString=function(e){return null===e?void 0:new Date(e)},f.rewriteRouting=p,f.closeDialog=g,d.hasRole("admin")?h.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.contexts=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):h.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.contexts=e.rows||[]}).then(function(){return h.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:h.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(f.contexts,{id:e.resourceId})}),n=null;if(f.outboundroute&&(n=_.find(f.contexts,{name:f.outboundroute.context})),n&&!_.some(t,["id",n.id])){var a=_.find(f.contexts,{id:n.id});a.canSelect=!1,t.push(a)}f.contexts=t}):h.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){f.contexts=e.rows||[]})}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","outboundroutes","outboundroute","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditOutboundRouteDialogController",e)}(),function(){"use strict";function e(b,i,a,s,n,e,t){var E=this;function o(e,t){if(E.outboundrouteApps.rows.length){var n=E.outboundrouteApps.rows[t]?E.outboundrouteApps.rows[t]:E.outboundrouteApps.rows[0];i.show({controller:"EditoutboundApp"+(n.appType||n.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/outboundroutes/edit/apps/"+(n.appType||n.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{outboundrouteApp:n,outboundroute:E.outboundroute,crudPermissions:E.crudPermissions}}).then(function(e){e&&(e.id?E.outboundrouteApps.rows[t]=e:E.outboundrouteApps.rows.splice(t,0,e),r())}).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 r(e){var t=2,n=[];n.push({type:"outbound",app:"Set",appdata:"CDR(type)=outbound",context:E.outboundroute.context,exten:E.outboundroute.exten,priority:t++,VoiceExtensionId:E.outboundroute.id}),n.push({type:"outbound",app:"Set",appdata:"CDR(destination)="+(E.outboundroute.cutdigits?"${EXTEN:"+E.outboundroute.cutdigits+"}":"${EXTEN}"),context:E.outboundroute.context,exten:E.outboundroute.exten,priority:t++,VoiceExtensionId:E.outboundroute.id}),n.push({type:"outbound",app:"Set",appdata:"CDR(routeid)="+E.outboundroute.id,context:E.outboundroute.context,exten:E.outboundroute.exten,priority:t++,VoiceExtensionId:E.outboundroute.id});var a=t++;n.push({type:"outbound",app:"ExecIf",appdata:"$[${LEN(${CDR(prefix)})} > 0]?Goto("+(a+2)+"):Goto("+(a+1)+")",context:E.outboundroute.context,exten:E.outboundroute.exten,priority:a,VoiceExtensionId:E.outboundroute.id}),n.push({type:"outbound",app:"Set",appdata:E.outboundroute.cutdigits?"CDR(prefix)=${EXTEN:0:"+E.outboundroute.cutdigits+"}":"CDR(prefix)=noprefix",context:E.outboundroute.context,exten:E.outboundroute.exten,priority:t++,VoiceExtensionId:E.outboundroute.id}),n.push({type:"outbound",app:"Set",appdata:"XCALLY-MOTION-ANSWER=0",context:E.outboundroute.context,exten:E.outboundroute.exten,priority:t++,VoiceExtensionId:E.outboundroute.id}),n.push({type:"outbound",app:"Set",appdata:"XCALLY-MOTION-PROGRESS=0",context:E.outboundroute.context,exten:E.outboundroute.exten,priority:t++,VoiceExtensionId:E.outboundroute.id}),n.push({type:"outbound",app:"Set",appdata:"MONITOR_OPTIONS=ab",context:E.outboundroute.context,exten:E.outboundroute.exten,priority:t++,VoiceExtensionId:E.outboundroute.id}),n.push({type:"outbound",app:"Set",appdata:"outboundrouteid="+E.outboundroute.id,context:E.outboundroute.context,exten:E.outboundroute.exten,priority:t++,VoiceExtensionId:E.outboundroute.id}),E.outboundroute.hasOwnProperty("recordingFormat")&&"none"!==E.outboundroute.recordingFormat&&(n.push({type:"outbound",app:"Set",appdata:"_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}",context:E.outboundroute.context,exten:E.outboundroute.exten,priority:t++,VoiceExtensionId:E.outboundroute.id}),n.push({type:"outbound",app:"Set",appdata:"_XCALLY_MIXMONITOR_FORMAT="+E.outboundroute.recordingFormat||"wav",context:E.outboundroute.context,exten:E.outboundroute.exten,priority:t++,VoiceExtensionId:E.outboundroute.id}));for(var i=0,s=0;i<E.outboundrouteApps.rows.length;i++,s=0){var o=E.outboundrouteApps.rows[i],r=[],l=[];o.intervals="*,*,*,*"!==o.interval?[o.interval]:o.IntervalId?_.map(_.filter(E.intervals.rows,{IntervalId:o.IntervalId}),"interval"):[],o.context=E.outboundroute.context,o.exten=E.outboundroute.exten,o.type&&(o.type=o.type.toLowerCase()),o.hasOwnProperty("tag")&&o.tag&&"--"!==o.tag&&r.push({type:o.type.toLowerCase(),app:"Set",appdata:"CDR(tag)="+o.tag,context:E.outboundroute.context,exten:E.outboundroute.exten,priority:o.intervals.length+t+s++,VoiceExtensionId:E.outboundroute.id}),o.callerID?r.push({type:o.type.toLowerCase(),app:"ExecIf",appdata:"$[${LEN(${PREFIX-CALLERIDALL})} > 0]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)="+o.callerID+")",context:E.outboundroute.context,exten:E.outboundroute.exten,priority:o.intervals.length+t+s++,VoiceExtensionId:E.outboundroute.id}):r.push({type:o.type.toLowerCase(),app:"ExecIf",appdata:"$[${LEN(${PREFIX-CALLERIDALL})} > 0]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No number available)",context:E.outboundroute.context,exten:E.outboundroute.exten,priority:o.intervals.length+t+s++,VoiceExtensionId:E.outboundroute.id});for(var d=0;d<o.intervals.length;d++){var c=t+o.intervals.length,m=d===o.intervals.length-1?t+r.length+l.length+2:t+d+1;r.splice(d,0,{type:"outbound",app:"GotoIfTime",appdata:o.intervals[d]+"?"+E.outboundroute.context+",${EXTEN},"+c+":"+E.outboundroute.context+",${EXTEN},"+m,exten:E.outboundroute.exten,context:E.outboundroute.context,priority:t+d,VoiceExtensionId:E.outboundroute.id})}if(e&&"outboundDial"===o.appType){var u=_.find(E.apps,{appType:"outboundDial"});if(u&&u.fields){for(var p={},g=o.appdata.split(","),v=[],h=0,f=u.fields.length;h<f;h++)if(u.fields[h].hasOwnProperty("param"))switch(u.fields[h].name){case"trunk":p.trunk=g[u.fields[h].param].split("/")[1],p.phone=g[u.fields[h].param].split("/")[2],p.prefix=p.phone?p.phone.split("$")[0]:void 0,p.phone=E.outboundroute.cutdigits?(p.prefix||"")+"${EXTEN:"+E.outboundroute.cutdigits+"}":(p.prefix||"")+"${EXTEN}",v[u.fields[h].param]=["SIP",p.trunk,p.phone].join("/");break;case"options":p.options=g[u.fields[h].param],"none"!==E.outboundroute.recordingFormat?p.options.indexOf("U(xcally-mixmonitor-context)")<0&&(p.options+="U(xcally-mixmonitor-context)"):p.options=p.options.replace("U(xcally-mixmonitor-context)",""),v[u.fields[h].param]=p.options;break;default:v[u.fields[h].param]=g[u.fields[h].param]}o.appdata=v.join(",")}}o.priority=r.length?_.last(r).priority+1:t,t=(l.length?_.last(l).priority:o.priority)+1,n=_.concat(n,r,[o],l)}n.push({type:"outbound",app:"Hangup",exten:E.outboundroute.exten,context:E.outboundroute.context,priority:t,VoiceExtensionId:E.outboundroute.id}),b.voiceExtension.addApplications({id:E.outboundroute.id},_.sortBy(n,"priority")).$promise.then(function(e){E.outboundrouteApps.rows=e.rows}).catch(function(e){console.error(e)})}function l(e){E.outboundrouteApps=e||{count:0,rows:[]}}E.currentUser=t.getCurrentUser(),E.outboundroute={},E.outboundrouteApps={count:0,rows:[]},E.selectedOutboundRouteApps=[],E.crudPermissions,E.query={sort:"priority"},E.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",type:"Outbound",types:["always","custom","list"],fields:[],isApp:!1},{app:"Dial",appType:"outboundDial",context:"from-sip",type:"Outbound",icon:"icon-apps",interval:"*,*,*,*",options:"xX",isApp:!0,extraApi:[{name:"trunks",field:{name:"trunk",key:"name"},route:"trunk",filters:{fields:"id,name",sort:"name"},permissions:{section:1011}},{name:"tags",field:{name:"tag",key:"name"},route:"tag",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1008}}],fields:[{title:"Trunk",name:"trunk",type:"apiselect",values:"trunks",value:"trunk.name",option:"trunk.name",required:!0,param:0},{title:"Caller_ID",name:"callerID",type:"text",help:!0},{title:"Prefix",name:"prefix",type:"text"},{title:"Tags",name:"tag",type:"apiselect",values:"tags",value:"tag.name",option:"tag.name",defaultValues:[{value:"'--'",option:"None"}]},{title:"Timeout",name:"timeout",type:"number",min:0,param:1},{title:"Options",name:"options",type:"text",param:2},{title:"Url",name:"url",type:"text",param:3}]},{app:null,type:"Outbound",appType:"custom",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Application_Name",name:"app",type:"text",required:!0,param:0},{title:"Arguments",name:"appdata",type:"text",param:1}]}],["app"]),{isApp:!1}),E.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},E.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){o(e,e.newIndex)},onSort:function(e){r()}},E.init=function(e,t){E.outboundroute=e,E.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},E.applications.disabled=!E.crudPermissions.canEdit,n.on("voiceExtension:update",E.onVoiceExtensionUpdate),E.query.VoiceExtensionId=e.id,E.query.isApp=!0,E.query.nolimit=!0,E.getOutboundRouteApps(),E.getIntervals()},E.deleteConfirm=function(e,t,n){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(n).ok("OK").cancel("CANCEL");i.show(a).then(function(){E.outboundrouteApps.rows.splice(t,1),r()},function(){console.log("CANCEL")})},E.getOutboundRouteApps=function(){E.promise=b.voiceExtension.get(E.query,l).$promise},E.editOutboundRouteApp=o,E.editInterval=function(e,t){if(E.outboundrouteApps.rows.length){var n=E.outboundrouteApps.rows[t]?E.outboundrouteApps.rows[t]:E.outboundrouteApps.rows[0];i.show({controller:"EditoutboundAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/outboundroutes/edit/apps/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:n.interval,IntervalId:n.IntervalId,application:!0},intervals:[],crudPermissions:E.crudPermissions}}).then(function(e){e&&(n.interval=e.interval||"*,*,*,*",n.IntervalId=e.IntervalId||null,r())})}},E.deleteOutboundRouteApp=function(e){_.remove(E.outboundrouteApps.rows,{id:e.id}),r(),s.success({title:"App deleted!",msg:e.app?e.app+" has been deleted!":""})},E.deleteSelectedOutboundRouteApps=function(e){var t=i.confirm().title("Are you sure want to delete the selected applications?").htmlContent("<b>"+E.selectedOutboundRouteApps.length+" selected</b> will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){E.selectedOutboundRouteApps.forEach(function(e){_.remove(E.outboundrouteApps.rows,{id:e.id})}),E.selectedOutboundRouteApps=[],r()})},E.rewriteRouting=r,E.getIntervals=function(){return b.interval.get({fields:"id,interval,IntervalId"}).$promise.then(function(e){E.intervals=e}).catch(function(e){console.error(e)})},E.onVoiceExtensionUpdate=function(e){e.VoiceExtensionId===E.outboundroute.id&&r(!0)},e.$on("$destroy",function(){n.removeAllListeners("voiceExtension:update")})}e.$inject=["api","$mdDialog","$document","toasty","socket","$scope","Auth"],angular.module("app.voice").controller("OutboundRouteActionsController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.custom=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.custom.appdata)switch(l.custom.appType?l.custom.appType.toLowerCase():l.custom.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.custom.appdata.split(",");l.custom.key=d[0],l.custom.language=d[1],l.custom.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.custom.appdata.split(",");l.custom.accesskeyid=d[0],l.custom.secretaccesskey=d[1],l.custom.lexregion=d[2],l.custom.botname=d[3],l.custom.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.custom.appdata.split(",");l.custom.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.custom.text=d.slice(1,d.length).join(",");break;case"message":l.custom.text=l.custom.appdata;break;case"set":l.custom.name=l.custom.appdata.split("=")[0],l.custom.value=l.custom.appdata.split("=")[1];break;case"agi":l.custom.project=l.custom.appdata;break;default:var c=l.custom.appdata.split(",");l.custom.app=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.custom.appdata=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}function m(e){t.hide(e)}l.custom.type&&"outbound"===l.custom.type.toLowerCase()&&"outbounddial"===l.custom.appType.toLowerCase()&&(l.custom.prefix=l.custom.phone?l.custom.phone.split("$")[0]:void 0,l.custom.callerId=l.custom.callerID?"CALLERID(all)="+l.custom.callerID:void 0),l.saveOutboundRouteApp=function(){l.errors=[];var e=[];l.custom.type&&"outbound"===l.custom.type.toLowerCase()&&"outboundDial"===l.custom.appType&&(l.custom.phone=i.cutdigits?(l.custom.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.custom.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.custom.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.custom.options+="U(xcally-mixmonitor-context)"):l.custom.options=l.custom.options.replace("U(xcally-mixmonitor-context)",""));if(l.custom.appType&&"custom"===l.custom.appType);else switch((l.custom.app||l.custom.appType).toLowerCase()){case"set":l.custom.appdata=l.custom.name+"="+l.custom.value;break;case"custom":break;default:e[0]=l.custom.app,e[1]=l.custom.appdata,l.custom.appdata=e.join(",")}m(l.custom)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","outboundrouteApp","outboundroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditoutboundAppcustomDialogController",e)}(),function(){"use strict";function e(e,t,n,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 E(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var t=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),n=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(t+"-"+n)}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 A(e){t.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=E(),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!":""}),A()}).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=E(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),A(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var t=_.find(c.intervals,{id:e.id});t&&_.merge(t,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),A()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=A,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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=e&&e.rows?e.rows:[],n=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(t,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,n.push(e))}),c.intervals=n})}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("EditoutboundAppintervalDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="VOICE.EDIT_"+(a.appType||a.app).toUpperCase(),l.outbounddial=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.outbounddial.appdata)switch(l.outbounddial.appType?l.outbounddial.appType.toLowerCase():l.outbounddial.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.outbounddial.appdata.split(",");l.outbounddial.key=d[0],l.outbounddial.language=d[1],l.outbounddial.welcomemessage=d.slice(2,d.length).join(",");break;case"amazonlex":d=l.outbounddial.appdata.split(",");l.outbounddial.accesskeyid=d[0],l.outbounddial.secretaccesskey=d[1],l.outbounddial.lexregion=d[2],l.outbounddial.botname=d[3],l.outbounddial.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.outbounddial.appdata.split(",");l.outbounddial.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.outbounddial.text=d.slice(1,d.length).join(",");break;case"message":l.outbounddial.text=l.outbounddial.appdata;break;case"set":l.outbounddial.name=l.outbounddial.appdata.split("=")[0],l.outbounddial.value=l.outbounddial.appdata.split("=")[1];break;case"agi":l.outbounddial.project=l.outbounddial.appdata;break;default:var c=l.outbounddial.appdata.split(",");l.outbounddial.trunk=c[0].split("/")[1],l.outbounddial.phone=c[0].split("/")[2],l.outbounddial.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.outbounddial.options=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.outbounddial.url=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10)}function m(e){t.hide(e)}l.outbounddial.type&&"outbound"===l.outbounddial.type.toLowerCase()&&"outbounddial"===l.outbounddial.appType.toLowerCase()&&(l.outbounddial.prefix=l.outbounddial.phone?l.outbounddial.phone.split("$")[0]:void 0,l.outbounddial.callerId=l.outbounddial.callerID?"CALLERID(all)="+l.outbounddial.callerID:void 0),l.saveOutboundRouteApp=function(){l.errors=[];var e=[];l.outbounddial.type&&"outbound"===l.outbounddial.type.toLowerCase()&&"outboundDial"===l.outbounddial.appType&&(l.outbounddial.phone=i.cutdigits?(l.outbounddial.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.outbounddial.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.outbounddial.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.outbounddial.options+="U(xcally-mixmonitor-context)"):l.outbounddial.options=l.outbounddial.options.replace("U(xcally-mixmonitor-context)",""));if(l.outbounddial.appType&&"custom"===l.outbounddial.appType);else switch((l.outbounddial.app||l.outbounddial.appType).toLowerCase()){case"set":l.outbounddial.appdata=l.outbounddial.name+"="+l.outbounddial.value;break;case"custom":break;default:e[0]=["SIP",l.outbounddial.trunk,l.outbounddial.phone].join("/"),e[1]=l.outbounddial.timeout,e[2]=l.outbounddial.options,e[3]=l.outbounddial.url,l.outbounddial.appdata=e.join(",")}m(l.outbounddial)},l.closeDialog=m,o.hasRole("admin")?s.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.trunks=e.rows||[]}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){l.trunks=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.trunks,{id:e.resourceId})}),n=null;if(l.outbounddial&&(n=_.find(l.trunks,{name:l.outbounddial.trunk})),n&&!_.some(t,["id",n.id])){var a=_.find(l.trunks,{id:n.id});a.canSelect=!1,t.push(a)}l.trunks=t})}else{var n=[],a=null;l.outbounddial&&(a=_.find(l.trunks,{name:l.outbounddial.trunk}));for(var i=0;i<l.trunks.length;i++)a&&l.trunks[i].id===a.id&&(l.trunks[i].canSelect=!1,n.push(l.trunks[i]));l.trunks=n}}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.hasRole("admin")?s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).catch(function(e){n.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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return s.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),n=null;if(l.outbounddial&&(n=_.find(l.tags,{name:l.outbounddial.tag})),n&&!_.some(t,["id",n.id])){var a=_.find(l.tags,{id:n.id});a.canSelect=!1,t.push(a)}l.tags=t})}else{var n=[],a=null;l.outbounddial&&(a=_.find(l.tags,{name:l.outbounddial.tag}));for(var i=0;i<l.tags.length;i++)a&&l.tags[i].id===a.id&&(l.tags[i].canSelect=!1,n.push(l.tags[i]));l.tags=n}}).catch(function(e){n.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","outboundrouteApp","outboundroute","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditoutboundAppoutbounddialDialogController",e)}(),function(){"use strict";function e(e,t,n,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=t.protocol()+"://"+t.host(),u.outboundroute=c||e.params.outboundroute||{},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.gotoOutboundRoutes=function(){e.go("app.voice.outboundroutes")},u.saveOutboundRoute=function(){r.voiceExtension.update({id:u.outboundroute.id},u.outboundroute).$promise.then(function(){l.success({title:"OutboundRoute updated!",msg:u.outboundroute.name?u.outboundroute.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceExtension",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 t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.contexts,{id:e.resourceId})}),n=null;if(u.outboundroute&&(n=_.find(u.contexts,{name:u.outboundroute.context})),n&&!_.some(t,["id",n.id])){var a=_.find(u.contexts,{id:n.id});a.canSelect=!1,t.push(a)}u.contexts=t}):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","outboundroute","userProfileSection"],angular.module("app.voice").controller("OutboundRouteController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.outboundroutes=l||{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="outboundroutes",b.listOrder="",b.listOrderAsc=null,b.selectedOutboundRoutes=[],b.query={fields:"createdAt,updatedAt,id,appdata,type,exten,context,recordingFormat,cutdigits,description",type:"outbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,page:1},b.arrayrecordingFormat=_.keyBy([{option:"none",value:"'none'"},{option:"wav",value:"'wav'"},{option:"wav49",value:"'WAV'"},{option:"gsm",value:"'gsm'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.voice.outboundroutes.edit",{id:e.id,outboundroute:e,crudPermissions:b.crudPermissions})},b.deleteconfirm=function(e,t){var n=i.confirm().title("Are you sure want to delete the "+_.startCase("outboundroute")+"?").htmlContent("<b>"+(e.name||"outboundroute")+"</b> will be deleted.").ariaLabel("delete outboundroute").targetEvent(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getOutboundRoutes=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.voiceExtension.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="OutboundRoutes",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditOutboundRoute=function(e,t){i.show({controller:"CreateOrEditOutboundRouteDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/outboundroutes/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{outboundroute:t,outboundroutes:b.outboundroutes.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteOutboundRoute=S,b.exportSelectedOutboundRoutes=function(){var e=angular.copy(b.selectedOutboundRoutes);return b.selectedOutboundRoutes=[],e},b.deleteSelectedOutboundRoutes=function(e){var t=i.confirm().title("Are you sure want to delete the selected outboundroutes?").htmlContent("<b>"+b.selectedOutboundRoutes.length+" selected</b> will be deleted.").ariaLabel("delete OutboundRoutes").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedOutboundRoutes.forEach(function(e){S(e)}),b.selectedOutboundRoutes=[]})},b.deselectOutboundRoutes=function(){b.selectedOutboundRoutes=[]},b.selectAllOutboundRoutes=function(){b.selectedOutboundRoutes=b.outboundroutes.rows},g.hasRole("admin")?m.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){b.contexts=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){b.contexts=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(b.contexts,{id:e.resourceId})}),n=null;if(b.outboundroute&&(n=_.find(b.contexts,{name:b.outboundroute.context})),n&&!_.some(t,["id",n.id])){var a=_.find(b.contexts,{id:n.id});a.canSelect=!1,t.push(a)}b.contexts=t}):m.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){b.contexts=e.rows||[]})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})});var E=!0,A=1;function y(e){b.outboundroutes=e||{count:0,rows:[]}}function S(t){m.voicePrefix.get({VoiceExtensionId:t.id}).$promise.then(function(e){if(e&&e.rows&&0<e.rows.length)return p.error({title:"Outbound route not deleted!",msg:"You can't remove an outbound route associated to an out prefix"});m.voiceExtension.delete({id:t.id}).$promise.then(function(){_.remove(b.outboundroutes.rows,{id:t.id}),b.outboundroutes.count-=1,b.outboundroutes.rows.length||b.getOutboundRoutes(),p.success({title:_.startCase("OutboundRoute")+" deleted!",msg:t.name?t.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:DELETEvoiceExtension"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceExtension",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})})}e.$watch("vm.query.filter",function(e,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getOutboundRoutes())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","outboundroutes","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.voice").controller("OutboundRoutesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g){var v=this,h=!0;function f(){var e=i.localStorage.getItem("motion2.realtime.abandoned.voice.contacts:"+v.currentUser.id);e&&(e=JSON.parse(e))&&e.query&&(v.query=_.merge(e.query,_.omit(v.query,["sort","limit","page"])),v.query=_.omit(v.query,"filter")),d.hasRole("admin")?o.user.getQueues({id:d.getCurrentUser().id,fields:"id,name",channel:"voice",type:"inbound",nolimit:!0}).$promise.then(function(e){v.queues=e||{count:0,rows:[]},v.queuesMap=_.mapValues(_.keyBy(v.queues.rows,"name"),"name")}).catch(function(e){console.error(e)}).finally(function(){v.getContacts()}):o.userProfile.getResources({id:v.currentUser.userProfileId,section:"QueueCampaigns",channel:"voice",type:"inbound",sort:"-updatedAt",nolimit:!0}).$promise.then(function(e){v.queues=e||{count:0,rows:[]},v.queuesMap=_.mapValues(_.keyBy(v.queues.rows,"name"),"name")}).catch(function(e){console.error(e)}).finally(function(){v.getContacts()})}function b(e){v.contacts=e||{count:0,rows:[]},h=!1,v.refresh=!0}v.showTooltip=!1,v.refresh=!0,v.disable=[],v.agents=p||[],v.currentUser=d.getCurrentUser(),v.localizationMap=u,v.pickerModel={dateStart:null,dateEnd:null},v.queues={},v.contacts={count:0,rows:[]},v.dispositions=g,v.userProfile=r,v.userProfileSection=l&&1==l.count?l.rows[0]:null,v.crudPermissions=d.parseCrudPermissions(v.userProfileSection?v.userProfileSection.crudPermissions:null),v.query={fields:"id,type,calleridnum,calleridname,queue,queuecallerabandonAt,queuecallerexitAt,queuecallerexitreason,assigned,lastAssignedTo,updatedAt,disposition",type:"inbound",queuecallerexitreason:"TIMEOUT,ABANDONED",sort:"-updatedAt",limit:10,page:1},v.clearAll=function(){v.query.createdAt=void 0,v.pickerModel={dateStart:null,dateEnd:null},v.getContacts()},v.getContacts=function(){if(v.refresh=!1,v.pickerModel.dateStart&&!h){var e=moment(v.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format();v.query.createdAt={$gte:v.pickerModel.dateStart,$lte:e}}else v.query.createdAt=void 0;v.query.queue=v.query.queue,v.query.offset=(v.query.page-1)*v.query.limit,i.localStorage.setItem("motion2.realtime.abandoned.voice.contacts:"+v.currentUser.id,JSON.stringify({query:_.omit(v.query,"queue")})),v.promise=o.voiceQueueReport.getVoiceQueuesReport(v.query,b).$promise},v.refreshContacts=function(){v.showTooltip=!1,v.getContacts()},v.onInit=f,v.assignedA=function(e,t){e&&(v.disable[e.id]=!0,o.voiceQueueReport.update({id:e.id,lastAssignedTo:t?t.name:null,assigned:!!t}).$promise.catch(function(e){console.log(e)}).finally(function(){v.disable[e.id]=!1}))},v.disposed=function(e,t){e&&o.voiceQueueReport.update({id:e.id,disposition:t||null}).$promise.catch(function(e){console.log(e)})},v.onSavevoiceQueueReport=function(e){e&&v.queuesMap&&"inbound"===e.type&&v.queuesMap[e.queue]&&(v.showTooltip=!0)},v.onUpdatevoiceQueueReport=function(e){if(e){var t=_.findIndex(v.contacts.rows,["id",e.id]);0<=t&&_.merge(v.contacts.rows[t],e)}},c.onWithoutApply("voiceQueueReport:save",v.onSavevoiceQueueReport),c.on("voiceQueueReport:update",v.onUpdatevoiceQueueReport),f();var E=!0,A=1;e.$watch("vm.query.filter",function(e,t){E?n(function(){E=!1}):(t||(A=v.query.page),e!==t&&(v.query.page=1),e||(v.query.page=A),v.getContacts())}),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","dateFilterLocalizationFactory","agents","dispositions"],angular.module("app.voice").controller("AbandonedCallsVoiceRealtimeController",e)}(),function(){"use strict";function e(e,o,t,n,a,i,s,r,l,d,c,m,u,p,g,v,h,f){var b=this,E=["userpic","online","lastLoginAt","lastPauseAt","pauseType","lastPauseAt","internal","address","chatPause","openchannelPause","mailPause","smsPause","faxPause","voicePause","chatCapacity","openchannelCapacity","mailCapacity","smsCapacity","faxCapacity","chatCurrentCapacity","openchannelCurrentCapacity","mailCurrentCapacity","smsCurrentCapacity","faxCurrentCapacity","chatStatus","openchannelStatus","mailStatus","smsStatus","faxStatus","voiceStatus","chatStatusTime","openchannelStatusTime","mailStatusTime","smsStatusTime","faxStatusTime","voiceStatusTime","queue","destconnectedlinenum","onhold"],A=["chatPause","openchannelPause","mailPause","smsPause","faxPause","voicePause","online"];for(var y in b.currentUser=v.getCurrentUser(),b.availableStates=["ringing","inuse","busy","onhold","not_inuse"],b.pauses=s||{count:0,rows:[]},b.license=h,b.userProfile=p,b.userProfileSection=g&&1==g.count?g.rows[0]:null,b.crudPermissions=v.parseCrudPermissions(b.userProfileSection?b.userProfileSection.crudPermissions:null),b.agents=r?_.keyBy(r.rows?r.rows:[],"id"):{},b.rpcAgents=l?_.keyBy(l.rows?l.rows:[],"id"):{},b.paginatedAgents={},b.load=!1,b.order=[],b.agentInternal={},b.agents)b.agents.hasOwnProperty(y)&&(b.agents[y].init=!0);b.query={limit:10,page:1,order:"fullname",globalStatusFilter:"",pauseTypeFilter:""},b.logout=function(e,t){return d.user.logout({id:e.id,device:"realtime",agent_id:e.id,agent_name:e.name}).$promise.then(function(){m.success({title:"Agent logout",msg:e.fullname+"  properly logout"}),b.agents[e.id]&&(b.agents[e.id].online=!1),b.rpcAgents[e.id]&&(b.rpcAgents[e.id].online=!1),T()}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.queueAdd=function(e,t){n.show({controller:"AgentqueueaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/queueadd/queueadd.html",parent:angular.element(a.body),targetEvent:t,clickOutsideToClose:!0,locals:{agent:e,agents:[],channel:"voice",direction:"inbound",crudPermissions:b.crudPermissions}})},b.pause=function(t,e){return d.user.pause({id:t.id,type:e}).$promise.then(function(e){b.agents[t.id]&&_.merge(b.agents[t.id],_.pick(e,E)),b.rpcAgents[t.id]&&_.merge(b.rpcAgents[t.id],_.pick(e,E)),O(b.agents[t.id])}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.unPause=function(t){return d.user.unpause({id:t.id}).$promise.then(function(e){b.agents[t.id]&&_.merge(b.agents[t.id],_.pick(e,E)),b.rpcAgents[t.id]&&_.merge(b.rpcAgents[t.id],_.pick(e,E)),O(b.agents[t.id])}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.staff.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.showInfo=function(e){n.show(n.alert().clickOutsideToClose(!0).title("Legend").htmlContent("<div>TODO legend status + state</div>").ok("Ok").targetEvent(e))},b.getAgentStatus=w,b.getAgentGlobalStatus=O,b.isPause=I,b.checkPause=function(e){return"pause"===e},b.isPartialPause=function(e){return"*pause"===e},b.onSave=function(e){b.agents[e.id]&&(_.merge(b.agents[e.id],_.pick(_.omit(e,A),E)),_.merge(b.rpcAgents[e.id],_.pick(_.omit(e,A),E)),O(b.agents[e.id]))},b.onUpdate=function(e){b.agents[e.id]&&(_.merge(b.agents[e.id],_.pick(e,E)),_.merge(b.rpcAgents[e.id],_.pick(e,E)),e.lastPauseAt&&(b.agents[e.id].globalStatusTime=e.lastPauseAt,b.rpcAgents[e.id].globalStatusTime=e.lastPauseAt),O(b.agents[e.id]))},b.onInit=T,b.onConnect=function(e){b.agents[b.agentInternal[e.destaccountcode]]&&(_.merge(b.agents[b.agentInternal[e.destaccountcode]],_.pick(e,["queue","destconnectedlinenum"])),_.merge(b.rpcAgents[b.agentInternal[e.destaccountcode]],_.pick(e,["queue","destconnectedlinenum"])))},b.onComplete=function(e){b.agents[b.agentInternal[e.destaccountcode]]&&(b.agents[b.agentInternal[e.destaccountcode]]=_.omit(b.agents[b.agentInternal[e.destaccountcode]],["queue","destconnectedlinenum"]),b.rpcAgents[b.agentInternal[e.destaccountcode]]=_.omit(b.rpcAgents[b.agentInternal[e.destaccountcode]],["queue","destconnectedlinenum"]))},c.on("user:save",b.onSave),c.on("user:update",b.onUpdate),c.on("user:agentconnect",b.onConnect),c.on("user:agentcomplete",b.onComplete),T();var S=f(function(){b.load&&(b.load=!1,T())},999);function T(e){b.load=!1;var t,n,a=o.defer();b.promise=a.promise,b.filteredAgents=[],b.order=[],_.forIn(b.agents,function(e,t){b.rpcAgents[t]&&_.merge(e,_.pick(_.omit(b.rpcAgents[t],A),E)),O(e),e.online?(b.filteredAgents.push(e),b.agentInternal[e.internal]=t):e.globalStatusTime=_.toNumber(moment().format("x"))}),b.query.globalStatusFilter&&_.remove(b.filteredAgents,function(e){return e.globalStatus!==b.query.globalStatusFilter}),b.query.pauseTypeFilter&&_.remove(b.filteredAgents,function(e){return e.pauseType!==b.query.pauseTypeFilter}),b.query.filter&&_.remove(b.filteredAgents,function(e){return e.fullname.toLowerCase().indexOf(b.query.filter.toLowerCase())<0}),b.filteredAgents=(t=b.filteredAgents,n=_.startsWith(b.query.order,"-")?"desc":"asc",_.orderBy(t,[b.query.order.replace("-","")],[n]));var i=(b.query.page-1)*b.query.limit;b.paginatedAgents=_.drop(b.filteredAgents,i).slice(0,b.query.limit);for(var s=0;s<b.paginatedAgents.length;s+=1)b.order.push(b.paginatedAgents[s].id);a.resolve(),b.load=!0}function I(e){return"pause"===e||"*pause"===e}function C(e){return"idle"===e||"unknown"===e||"unavailable"===e||"ringing"===e||_.isNil(e)}function w(e,t){return"voice"===t?"idle"!==e[t+"Status"]?e[t+"Status"]:e[t+"Pause"]?e[t+"Status"]="pause":"idle":e[t+"Pause"]?e[t+"Status"]="pause":e[t+"Status"]}function O(e){var t="unknown";t=_.every([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],I)?"pause":_.some([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],I)?"*pause":_.every([w(e,"voice"),w(e,"chat"),w(e,"mail"),w(e,"openchannel"),w(e,"sms"),w(e,"fax")],C)?"idle":"busy",e.globalStatus!==t&&(e.globalStatus=t,e.init?(e.init=!1,e.globalStatusTime=I(t)?_.toNumber(moment(e.lastPauseAt).format("x")):_.max([e.voiceStatusTime,e.chatStatusTime,e.mailStatusTime,e.smsStatusTime,e.openchannelStatusTime,e.faxStatusTime])):e.globalStatusTime=_.toNumber(moment().format("x")))}e.$on("$destroy",function(){c.removeAllListeners("user:save"),c.removeAllListeners("user:update"),c.removeAllListeners("user:agentconnect"),c.removeAllListeners("user:agentcomplete"),S&&(f.cancel(S),S=null)})}e.$inject=["$scope","$q","$timeout","$mdDialog","$document","$filter","pauses","agents","rpcAgents","api","socket","toasty","helperClasses","userProfile","userProfileSection","Auth","license","$interval"],angular.module("app.voice").controller("AgentsVoiceRealtimeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s){var o=this;o.calls=i||{rows:[],count:0},o.query={limit:10,page:1},o.channelStatus=s.channelStatusOut,o.onSave=function(e){var t=_.find(o.calls.rows,{channel:e.channel});e.channelstatedesc=e.dialstatus?"up":"ring",t?_.merge(t,e):e.channel&&o.calls.rows.push(e)},o.onRemove=function(e){var t=_.findIndex(o.calls.rows,{channel:e.channel});0<=t&&(o.calls.rows[t].status="hangup");n(function(){o.calls.rows.splice(t,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","helperClasses"],angular.module("app.voice").controller("OutboundCallsVoiceRealtimeController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=u.getCurrentUser(),p.agents=n||{count:0,rows:[]},p.queues=i?_.keyBy(i.rows?i.rows:[],"name"):{},p.rpcVoiceQueuesChannelsTmp=s?_.keyBy(s.rows?_.filter(s.rows,{type:"inbound"}):[],"uniqueid"):{},p.rpcVoiceQueuesChannels={},p.userProfile=c,p.userProfileSection=m&&1==m.count?m.rows[0]:null,p.crudPermissions=u.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.queryChannels={limit:10,page:1},p.getSize=function(e){return _.size(e)},p.$onInit=function(){_.forIn(p.rpcVoiceQueuesChannelsTmp,function(e,t){_.find(p.queues,{name:e.name})&&(p.rpcVoiceQueuesChannels[t]=e)})},p.onSave=function(e){"inbound"===e.type&&_.find(p.queues,{name:e.name})&&(p.rpcVoiceQueuesChannels[e.uniqueid]=e)},p.onRemove=function(e){p.rpcVoiceQueuesChannels[e.uniqueid]&&delete p.rpcVoiceQueuesChannels[e.uniqueid]},p.hangup=function(t){return o.rpc.getVoiceQueuesChannelHangup({uniqueid:t}).$promise.then(function(e){d.success({title:"Channel "+t+" properly hangup!",msg:e.message||""})}).catch(function(e){d.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},p.redirectToAgent=function(t,e,n){return o.rpc.getVoiceQueuesChannelRedirect({uniqueid:t,exten:e,context:n}).$promise.then(function(e){d.success({title:"Channel "+t+" properly redirect!",msg:e.message||""})}).catch(function(e){d.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},p.redirectToNumber=function(e,t){var n=a.prompt().title("Which number do you want transfer the call to?").placeholder("Number").targetEvent(e).ok("Ok").cancel("Cancel");return a.show(n).then(function(e){return o.rpc.getVoiceQueuesChannelRedirect({uniqueid:t,exten:e}).$promise}).then(function(e){d.success({title:"Channel "+t+" properly redirect!",msg:e.message||""})}).catch(function(e){d.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},r.on("voice_queue_channel:save",p.onSave),r.on("voice_queue_channel:remove",p.onRemove),e.$on("$destroy",function(){r.removeAllListeners("voice_queue_channel:save"),r.removeAllListeners("voice_queue_channel:remove")})}e.$inject=["$scope","$timeout","$mdDialog","agents","queues","rpcVoiceQueuesChannels","api","socket","helperClasses","toasty","userProfile","userProfileSection","Auth"],angular.module("app.voice").controller("QueueCallsVoiceRealtimeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this,m=["total","answered","unmanaged","abandoned","sumHoldTime","sumDuration","sumBillable"];function u(){_.forIn(c.queues,function(e,t){c.rpcQueues[t]&&_.merge(e,_.pick(c.rpcQueues[t],m))})}c.count=a.count,c.queues=a?_.keyBy(a.rows?a.rows:[],"id"):{},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:"-updatedAt",limit:10,page:1}:c.query={id:d.getCurrentUser().id,channel:"voice",type:"inbound",fields:"id,name",sort:"-updatedAt",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){c.queues[e.id]&&_.merge(c.queues[e.id],_.pick(e,m))},c.$onInit=u,o.onWithoutApply("voice_queue:save",c.onSave),c.interval=t(function(){},999);var p=!0,g=1;function v(e){c.count=e.count,c.queues=e?_.keyBy(e.rows?e.rows:[],"id"):{},u()}e.$watch("vm.query.filter",function(e,t){p?n(function(){p=!1}):(t||(g=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=g),c.getQueues())}),e.$on("$destroy",function(){o.removeAllListeners("voice_queue:save"),c.interval&&t.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,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this,v=["loggedIn","available","waiting","talking","pTalking","originated","message","dialActive","dialMethod","Trunk","paused"];function h(){var n=[];return _.forIn(g.queues,function(e,t){e.paused=0,e.loggedInDb=0,g.queues[t].agents={},n.push(l.voiceQueue.getMembers({id:t}).$promise),g.rpcQueues[t]&&_.merge(e,_.pick(g.rpcQueues[t],v))}),t.all(n).then(function(e){for(var t=0;t<e.length;t+=1)for(var n=0;n<e[t].rows.length;n++)e[t].rows[n].paused&&g.queues[e[t].rows[n].VoiceQueueId].paused++,g.queues[e[t].rows[n].VoiceQueueId].loggedInDb++,g.queues[e[t].rows[n].VoiceQueueId].agents[e[t].rows[n].UserId]=e[t].rows[n].VoiceQueueId}).catch(function(e){console.error(e)})}g.currentUser=p.getCurrentUser(),g.count=o.count?o.count:0,g.queues=o?_.keyBy(o.rows?o.rows:[],"id"):{},g.rpcQueues=r?_.keyBy(r.rows?r.rows:[],"id"):{},g.userProfile=m,g.userProfileSection=u&&1==u.count?u.rows[0]:null,g.crudPermissions=p.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),p.hasRole("admin")?g.query={type:"inbound",sort:"-updatedAt",limit:10,page:1}:g.query={id:g.currentUser.id,channel:"voice",type:"inbound",sort:"-updatedAt",limit:10,page:1},g.success=E,g.getQueues=function(){g.query.offset=(g.query.page-1)*g.query.limit,p.hasRole("admin")?g.promise=l.voiceQueue.get(g.query,E).$promise:(g.query.id=g.userProfile.id,g.query.section="VoiceQueues",g.promise=l.userProfile.getResources(g.query,E).$promise)},g.createOrEditVoiceQueue=function(e,t){a.show({controller:"CreateOrEditVoiceQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{voiceQueue:t,voiceQueues:_.values(g.queues),license:null,setting:null,crudPermissions:g.crudPermissions}})},g.agentAdd=function(e,t){a.show({controller:"VoiceQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{voiceQueue:t,voiceQueues:g.queues?g.queues.rows:[],realtime:!0,crudPermissions:g.crudPermissions}})},g.updateQueue=function(e){return l.voiceQueue.update(e).$promise.then(function(){c.success({title:"Queue properly updated!",msg:e.name?e.name+" has been updated!":""})}).catch(function(e){c.error({title:"Error creating queue!",msg:e.message})})},g.onSave=function(e){g.queues[e.id]&&_.merge(g.queues[e.id],_.pick(e,v))},g.onPause=function(n){console.log("onPause",n),n.voicePause?_.forIn(g.queues,function(e,t){e.agents[n.id]&&(e.paused+=1,console.log("pause"))}):n.voicePause||_.forIn(g.queues,function(e,t){e.agents[n.id]&&0<e.paused&&(e.paused-=1,console.log("unpause"))})},g.onLogin=function(e){console.log("onLogged",e),g.queues[e.VoiceQueueId]&&(g.queues[e.VoiceQueueId].loggedInDb+=1,g.queues[e.VoiceQueueId].agents[e.UserId]=e.VoiceQueueId)},g.onLogout=function(e){console.log("onLogout",e),g.queues[e.VoiceQueueId]&&0<g.queues[e.VoiceQueueId].loggedInDb&&(g.queues[e.VoiceQueueId].loggedInDb-=1,delete g.queues[e.VoiceQueueId].agents[e.UserId])},g.$onInit=h,g.order=[],_.forIn(g.queues,function(e,t){g.order.push(e.id)}),d.onWithoutApply("voice_queue:save",g.onSave),g.interval=s(function(){},999),d.on("user:update",g.onPause),d.on("userVoiceQueue:remove",g.onLogout),d.on("userVoiceQueue:save",g.onLogin);var f=!0,b=1;function E(e){if(g.count=e.count,g.queues=e?_.keyBy(e.rows?e.rows:[],"id"):{},e.rows){g.order=[];for(var t=0;t<e.rows.length;t++)g.order.push(e.rows[t].id)}h()}e.$watch("vm.query.filter",function(e,t){f?n(function(){f=!1}):(t||(b=g.query.page),e!==t&&(g.query.page=1),e||(g.query.page=b),g.getQueues())}),e.$on("$destroy",function(){d.removeAllListeners("voice_queue:save"),g.interval&&s.cancel(g.interval),d.removeAllListeners("user:update"),d.removeAllListeners("userVoiceQueue:remove"),d.removeAllListeners("userVoiceQueue:save")})}e.$inject=["$scope","$timeout","$mdDialog","$q","$document","$interval","queues","rpcQueues","api","socket","toasty","userProfile","userProfileSection","Auth"],angular.module("app.voice").controller("QueuesVoiceRealtimeController",e)}(),function(){"use strict";angular.module("app.auth").factory("helperClasses",function(){return{status:{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"},state:{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"},channelStatus:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},channelStatusOut:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"}}})}(),function(){"use strict";function e(e,n,t){var a=this;switch(t.disconnect(),t.connect(),a.selectedTab=0,n.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,n.go("app.voice.realtime.agents")}e.$watch("vm.selectedTab",function(e,t){if(e!==t)switch(e){case 0:n.go("app.voice.realtime.agents");break;case 1:n.go("app.voice.realtime.telephones");break;case 2:n.go("app.voice.realtime.trunks");break;case 3:n.go("app.voice.realtime.queues");break;case 4:n.go("app.voice.realtime.queue_calls");break;case 5:n.go("app.voice.realtime.abandonedcalls");break;case 6:n.go("app.voice.realtime.queue_params");break;case 7:n.go("app.voice.realtime.outbound_calls");break;default:n.go("app.voice.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.voice").controller("VoiceRealtimeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this,u=["fullname","internal","state","status"];function p(){_.forIn(m.telephones,function(e,t){m.rpcTelephones[t]&&_.merge(e,_.pick(m.rpcTelephones[t],u))})}m.count=a.count,m.attributes=["fullname","internal","state","status","address"],m.telephones=a?_.keyBy(a.rows?a.rows:[],"id"):{},m.rpcTelephones=i?_.keyBy(i.rows?i.rows:[],"id"):{},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:"-updatedAt",limit:10,page:1},m.statusClass=r.status,m.stateClass=r.state,m.success=h,m.$onInit=p,m.showInfo=function(e){t.show(t.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?_.keyBy(e.rows?e.rows:[],"id"):{},p()}e.$watch("vm.query.filter",function(e,t){g?n(function(){g=!1}):(t||(v=m.query.page),e!==t&&(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","helperClasses","userProfile","userProfileSection","Auth"],angular.module("app.voice").controller("TelephonesVoiceRealtimeController",e)}(),function(){"use strict";function e(e,n,t,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,t=0;t<u.trunks.length;t+=1)0<=(e=_.findIndex(u.rpcTrunks,["id",u.trunks[t].id]))&&_.merge(u.trunks[t],_.pick(u.rpcTrunks[e],p))}function v(e,t,n){0<=t&&_.merge(e[t],_.pick(n,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:"-updatedAt",limit:10,page:1},u.statusClass=r.status,u.stateClass=r.state,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){t.show(t.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,t){l.go("app.tools.trunks.edit",{id:t.id})},u.onSave=function(e){var t=_.findIndex(u.trunks,["id",e.id]),n=_.findIndex(u.rpcTrunks,["id",e.id]);v(u.trunks,t,e),v(u.rpcTrunks,n,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,t){h?n(function(){h=!1}):(t||(f=u.query.page),e!==t&&(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","helperClasses","$state","userProfile","userProfileSection","Auth"],angular.module("app.voice").controller("TrunksVoiceRealtimeController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.voicemails,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The voicemail will be deleted.").ariaLabel("Delete Voicemail").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d){var c=this;c.currentUser=d.getCurrentUser(),c.voicemail={},c.voicemailMessages={count:0,rows:[]},c.selectedVoicemailMessages=[],c.crudPermissions,c.query={fields:"createdAt,updatedAt,id,callerid,duration,audio,stamp,msg_id",sort:"-stamp",limit:10,page:1},c.init=function(e,t){c.voicemail=e,c.crudPermissions=void 0!==t?t:{readOnly:!0,canEdit:!1,canDelete:!1},c.query.id=c.voicemail.id,c.getVoicemailMessages()},c.deleteConfirm=function(e,t){var n=s.confirm().title("Are you sure want to delete the message?").htmlContent("<b>"+(e.name||"message")+"</b> will be deleted.").ariaLabel("delete message").targetEvent(t).ok("OK").cancel("CANCEL");s.show(n).then(function(){g(e)},function(){console.log("CANCEL")})},c.voiceMailMessageDownload=function(s,e,t){return l.voiceMailMessage.download({id:s.id,exists:!0,attachments:t}).$promise.then(function(e){var t=[e.buffer],n="message"+s.id,a=new Blob(t,{type:e.type});n=s.msg_id+".wav";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMail.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.success=p,c.getVoicemailMessages=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=l.voiceMail.getMessages(c.query,p).$promise},c.createOrEditVoicemailMessage=function(e,t){s.show({controller:"CreateOrEditMessageDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicemails/edit/messages/dialog.html",parent:angular.element(o.body),targetEvent:e,clickOutsideToClose:!0,locals:{voicemail:c.voicemail,message:t,messages:c.voicemailMessages.rows,license:null,setting:null,crudPermissions:c.crudPermissions}})},c.exportSelectedVoicemailMessages=function(){var e=angular.copy(c.selectedVoicemailMessages);return c.selectedVoicemailMessages=[],e},c.deleteVoicemailMessage=g,c.deleteSelectedVoicemailMessages=function(e){var t=s.confirm().title("Are you sure want to delete the selected messages?").htmlContent("<b>"+c.selectedVoicemailMessages.length+" selected</b> will be deleted.").ariaLabel("delete messages").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){c.selectedVoicemailMessages.forEach(function(e){g(e)}),c.selectedVoicemailMessages=[]})};var m=!0,u=1;function p(e){c.voicemailMessages=e||{count:0,rows:[]}}function g(e){l.voiceMailMessage.delete({id:e.id}).$promise.then(function(){_.remove(c.voicemailMessages.rows,{id:e.id}),c.voicemailMessages.count-=1,c.voicemailMessages.rows.length||c.getVoicemailMessages(),r.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){vm.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceMail"}];for(var t=0;t<e.data.errors.length;t++)r.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMail",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}t.$watch("vm_dc.query.filter",function(e,t){m?i(function(){m=!1}):(t||(u=c.query.page),e!==t&&(c.query.page=1),e||(c.query.page=u),c.getVoicemailMessages())})}e.$inject=["$cookies","$scope","$state","$q","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.voice").controller("VoicemailMessagesController",e)}(),function(){"use strict";function e(e,t,n,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=t.protocol()+"://"+t.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")},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 t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.contexts,{id:e.resourceId})}),n=null;if(u.voicemail&&(n=_.find(u.contexts,{name:u.voicemail.context})),n&&!_.some(t,["id",n.id])){var a=_.find(u.contexts,{id:n.id});a.canSelect=!1,t.push(a)}u.contexts=t}):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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.voicemails=l||{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="voicemails",b.listOrder="",b.listOrderAsc=null,b.selectedVoicemails=[],b.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},b.arrayattach=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arrayenvelope=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arraydelete=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.voice.voicemails.edit",{id:e.id,voicemail:e,crudPermissions:b.crudPermissions})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getVoicemails=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.voiceMail.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Voicemails",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditVoicemail=function(e,t){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:t,voicemails:b.voicemails.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteVoicemail=S,b.exportSelectedVoicemails=function(){var e=angular.copy(b.selectedVoicemails);return b.selectedVoicemails=[],e},b.deleteSelectedVoicemails=function(e){var t=i.confirm().title("Are you sure want to delete the selected voicemails?").htmlContent("<b>"+b.selectedVoicemails.length+" selected</b> will be deleted.").ariaLabel("delete Voicemails").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedVoicemails.forEach(function(e){S(e)}),b.selectedVoicemails=[]})},b.deselectVoicemails=function(){b.selectedVoicemails=[]},b.selectAllVoicemails=function(){b.selectedVoicemails=b.voicemails.rows};var E=!0,A=1;function y(e){b.voicemails=e||{count:0,rows:[]}}function S(e){m.voiceMail.delete({id:e.id}).$promise.then(function(){_.remove(b.voicemails.rows,{id:e.id}),b.voicemails.count-=1,b.voicemails.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceMail"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getVoicemails())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","voicemails","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.voice").controller("VoicemailsController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.voicePrefixes,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The voicePrefix will be deleted.").ariaLabel("Delete voicePrefix").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return d.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(g.outboundRoutes,{id:e.resourceId})}),n=null;if(g.voicePrefix&&(n=_.find(g.outboundRoutes,{id:Number(g.voicePrefix.VoiceExtensionId)})),n&&!_.some(t,["id",n.id])){var a=_.find(g.outboundRoutes,{id:n.id});a.canSelect=!1,t.push(a)}g.outboundRoutes=t})}else{var n=[],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,n.push(g.outboundRoutes[i]));g.outboundRoutes=n}}).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,t,n,o,r,l,d){var c=this;function m(){return a(function(n,t){return a(function(t,n){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(t,n){return s.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),a(function(t,n){return s.voicePrefix.getAgents({id:c.voicePrefix.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return t.penalty=e.UservoicePrefix?"penalty "+e.UservoicePrefix.penalty:"",t.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=l.getCurrentUser(),c.voicePrefix=t,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(n,t){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(n=e,a(function(e,t){_.isEmpty(n)?e():s.voicePrefix.removeAgents({id:c.voicePrefix.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return n=t,a(function(e,t){_.isEmpty(n)?e():s.voicePrefix.addAgents({id:c.voicePrefix.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})});var n}).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 n},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,items:[],selectedItems:[],showSelectAndDeselectAll:!o,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("VOICE.ALL_AGENTS"),labelSelected:r.instant("VOICE.SELECTED_AGENTS"),transferCallback:function(e,t){var n=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(n)}}}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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.voicePrefixes=l||{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="voicePrefixes",b.listOrder="",b.listOrderAsc=null,b.selectedVoicePrefixes=[],b.query={fields:"createdAt,updatedAt,id,name,VoiceExtensionId,callerIdAll,description",limit:10,page:1},b.editdialog=function(e,t){i.show({controller:"CreateOrEditvoicePrefixDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicePrefixes/create/dialog.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{voicePrefix:e,voicePrefixes:b.voicePrefixes.rows,license:b.license,setting:null,crudPermissions:b.crudPermissions}})},b.agentadddialog=function(e,t){i.show({controller:"voicePrefixagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicePrefixes/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{voicePrefix:e,voicePrefixes:b.voicePrefixes?b.voicePrefixes.rows:[],crudPermissions:b.crudPermissions,realtime:!1}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getVoicePrefixes=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.voicePrefix.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="VoicePrefixes",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditvoicePrefix=function(e,t){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:t,voicePrefixes:b.voicePrefixes.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deletevoicePrefix=S,b.exportSelectedVoicePrefixes=function(){var e=angular.copy(b.selectedVoicePrefixes);return b.selectedVoicePrefixes=[],e},b.deleteSelectedVoicePrefixes=function(e){var t=i.confirm().title("Are you sure want to delete the selected voicePrefixes?").htmlContent("<b>"+b.selectedVoicePrefixes.length+" selected</b> will be deleted.").ariaLabel("delete voicePrefixs").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedVoicePrefixes.forEach(function(e){S(e)}),b.selectedVoicePrefixes=[]})},b.deselectVoicePrefixes=function(){b.selectedVoicePrefixes=[]},b.selectAllVoicePrefixes=function(){b.selectedVoicePrefixes=b.voicePrefixes.rows},g.hasRole("admin")?m.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){b.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){b.outboundRoutes=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:b.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return m.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(b.outboundRoutes,{id:e.resourceId})}),n=null;if(b.voicePrefix&&(n=_.find(b.outboundRoutes,{id:Number(b.voicePrefix.VoiceExtensionId)})),n&&!_.some(t,["id",n.id])){var a=_.find(b.outboundRoutes,{id:n.id});a.canSelect=!1,t.push(a)}b.outboundRoutes=t})}else{var n=[],a=null;b.voicePrefix&&(a=_.find(b.outboundRoutes,{id:Number(b.voicePrefix.VoiceExtensionId)}));for(var i=0;i<b.outboundRoutes.length;i++)a&&b.outboundRoutes[i].id===a.id&&(b.outboundRoutes[i].canSelect=!1,n.push(b.outboundRoutes[i]));b.outboundRoutes=n}}).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 E=!0,A=1;function y(e){b.voicePrefixes=e||{count:0,rows:[]}}function S(e){m.voicePrefix.delete({id:e.id}).$promise.then(function(){_.remove(b.voicePrefixes.rows,{id:e.id}),b.voicePrefixes.count-=1,b.voicePrefixes.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoicePrefix"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getVoicePrefixes())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","voicePrefixes","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.voice").controller("VoicePrefixesController",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(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_VOICEQUEUE",g.voiceQueue=angular.copy(l),g.voiceQueues=r,g.newVoiceQueue=!1,g.voiceQueue||(g.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"},g.title="VOICE.NEW_VOICEQUEUE",g.newVoiceQueue=!0),g.addNewVoiceQueue=function(){g.errors=[],d.voiceQueue.save(g.voiceQueue).$promise.then(function(e){g.voiceQueues.unshift(e.toJSON()),o.success({title:"VoiceQueue properly created",msg:g.voiceQueue.name?g.voiceQueue.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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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.saveVoiceQueue=function(){g.errors=[],d.voiceQueue.update({id:g.voiceQueue.id},g.voiceQueue).$promise.then(function(e){var t=_.find(g.voiceQueues,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),o.success({title:"VoiceQueue properly saved!",msg:g.voiceQueue.name?g.voiceQueue.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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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.deleteVoiceQueue=function(e){g.errors=[];var t=a.confirm().title("Are you sure?").content("The voiceQueue will be deleted.").ariaLabel("Delete VoiceQueue").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).then(function(){d.voiceQueue.delete({id:g.voiceQueue.id}).$promise.then(function(){_.remove(g.voiceQueues,{id:g.voiceQueue.id}),o.success({title:"VoiceQueue properly deleted!",msg:(g.voiceQueue.name||"voiceQueue")+" has been deleted!"}),v(g.voiceQueue)}).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","voiceQueues","voiceQueue","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditVoiceQueueDialogController",e)}(),function(){"use strict";function e(e,l,a,d,t,n,i,s,o,r){var c=this;function m(){return l(function(n,t){return l(function(t,n){return d.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],o.hasRole("admin")?e:c.section?c.section.autoAssociation?e:l(function(t,n){return d.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,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 t=_.find(c.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),l(function(t,n){return d.voiceQueue.getAgents({id:c.voiceQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){var t=_.find(c.items,{id:e.id});return t.penalty=e.UserVoiceQueue?"penalty "+e.UserVoiceQueue.penalty:"",t.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",t}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=o.getCurrentUser(),c.voiceQueue=t,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(n,t){d.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(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"),t=_.differenceWith(c.selectedItems,c.startingSelectedItems,function(e,t){return e.id===t.id&&e.penalty===t.penalty});return(n=e,l(function(e,t){_.isEmpty(n)?e():d.voiceQueue.removeAgents({id:c.voiceQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return r=t,l(function(e,t){if(_.isEmpty(r))e();else{for(var n=[],a=_.groupBy(r,"penalty"),i=0;i<Object.keys(a).length;i++){var s=Object.keys(a)[i],o=_.filter(r,["penalty",s]);n.push(d.voiceQueue.addAgents({id:c.voiceQueue.id,ids:_.map(o,"id"),penalty:_.trim(s,"penalty "),realtime:c.realtime||!1}).$promise)}l.all(n).then(function(){e()}).catch(function(e){t(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 n},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,items:[],selectedItems:[],showSelectAndDeselectAll:!i,orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"penalty",labelAll:s.instant("VOICE.ALL_AGENTS"),labelSelected:s.instant("VOICE.SELECTED_AGENTS"),transferCallback:function(e,t){t?e.forEach(function(e){e.penalty=void 0}):e.forEach(function(e){e.penalty="penalty "+c.penalty});var n=_.xorWith(c.startingSelectedItems,c.selectedItems,function(e,t){return e.id===t.id&&e.penalty===t.penalty});c.pendingChanges=!_.isEmpty(n)}}}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,l,a,d,t,n,i,s){var c=this;function o(){return l(function(n,t){return l(function(t,n){return d.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}).then(function(e){return c.items=e.rows?e.rows:[],i.hasRole("admin")?e:c.section?c.section.autoAssociation?e:l(function(t,n){return d.userProfileResource.get({sectionId:c.section.id}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})}):null}).then(function(e){var t=e&&e.rows?e.rows:[];return c.allowedItems=_.map(t,function(e){return _.find(c.items,{id:i.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.items.forEach(function(e){var t=_.find(c.allowedItems,{id:e.id});i.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==t}),l(function(t,n){return d.voiceQueue.getTeams({id:c.voiceQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){t(e)}).catch(function(e){n(e)})})}).then(function(e){var t=e&&e.rows?e.rows:[];c.selectedItems=_.map(t,function(e){return _.find(c.items,{id:e.id})}),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),n()}).catch(function(e){t(e)})})}c.currentUser=i.getCurrentUser(),c.voiceQueue=t,c.crudPermissions=s,c.penalty=0,c.items=[],c.allowedItems=[],c.selectedItems=[],c.addedItems=[],c.removedItems=[],c.pendingChanges=!1,c.dualMultiselectOptions={readOnly:!c.crudPermissions.canEdit,allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!0,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:n.instant("VOICE.ALL_TEAMS"),labelSelected:n.instant("VOICE.SELECTED_TEAMS"),transferCallback:function(e,t){t?c.removedItems=_.unionBy(e,c.removedItems,"id"):(e.forEach(function(e){e.penalty="penalty "+c.penalty}),c.addedItems=_.unionBy(e,c.addedItems,"id")),c.pendingChanges=!0}},c.onInit=function(){return i.hasRole("admin")?o().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(function(n,t){d.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;n(t)}).catch(function(e){t(e)})}).then(function(e){return c.section=e,o()}).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()})})},c.saveTeams=function(){var e=c.removedItems,t=c.addedItems;return(n=e,l(function(e,t){_.isEmpty(n)?e():d.voiceQueue.removeTeams({id:c.voiceQueue.id,ids:_.map(n,"id")}).$promise.then(function(){e()}).catch(function(e){t(e)})})).then(function(){return r=t,l(function(e,t){if(_.isEmpty(r))e();else{for(var n=[],a=_.groupBy(r,"penalty"),i=0;i<Object.keys(a).length;i++){var s=Object.keys(a)[i],o=_.filter(r,["penalty",s]);n.push(d.voiceQueue.addTeams({id:c.voiceQueue.id,ids:_.map(o,"id"),penalty:_.trim(s,"penalty ")}).$promise)}l.all(n).then(function(){e()}).catch(function(e){t(e)})}});var r}).then(function(){c.pendingChanges=!1,c.addedItems=[],c.removedItems=[],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 n},c.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(n,e,a,i,s,t,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=t,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.voiceQueue=c||n.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=n.params.tab||0,u.teamadddialog=function(e,t){a.show({controller:"VoiceQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/edit/teamadd/teamadd.html",parent:angular.element(i.body),targetEvent:t,clickOutsideToClose:!0,locals:{voiceQueue:e,voiceQueues:u.voiceQueues?u.voiceQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,t){a.show({controller:"VoiceQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:t,clickOutsideToClose:!0,locals:{voiceQueue:e,voiceQueues:u.voiceQueues?u.voiceQueues.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.gotogoto=function(e,t){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:411}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.voice.realtime.queues",{})}},u.alert=l.info,u.gotoVoiceQueues=function(){n.go("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 t=e&&e.rows?e.rows[0]:null;return t?t.autoAssociation?void 0:r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.musiconholds,{id:e.resourceId})}),n=null;if(u.voiceQueue&&(n=_.find(u.musiconholds,{name:u.voiceQueue.musiconhold})),n&&!_.some(t,["id",n.id])){var a=_.find(u.musiconholds,{id:n.id});a.canSelect=!1,t.push(a)}u.musiconholds=t}):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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.sounds,{id:e.resourceId})});u.sounds.forEach(function(e){_.some(t,["id",e.id])||(e.canSelect=!1),t.push(e)}),u.sounds=t})}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 t=e&&e.rows?e.rows[0]:null;if(t){if(!t.autoAssociation)return r.userProfileResource.get({sectionId:t.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.pauses,{id:e.resourceId})});u.pauses.forEach(function(e){_.some(t,["id",e.id])||(e.canSelect=!1),t.push(e)}),u.pauses=t})}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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.voiceQueues=l||{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="voiceQueues",b.listOrder="",b.listOrderAsc=null,b.selectedVoiceQueues=[],b.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,mandatoryDisposition,mandatoryDispositionPauseId",type:"inbound",sort:"-updatedAt",channel:"voice",limit:10,page:1},b.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"),"")}),b.arrayjoinempty=_.keyBy([{option:"no",value:"'no'"},{option:"yes",value:"'yes'"},{option:"strict",value:"'strict'"},{option:"loose",value:"'loose'"},{option:"paused",value:"'paused'"},{option:"penalty",value:"'penalty'"},{option:"inuse",value:"'inuse'"},{option:"ringing",value:"'ringing'"},{option:"unavailable",value:"'unavailable'"},{option:"invalid",value:"'invalid'"},{option:"unknown",value:"'unknown'"},{option:"wrapup",value:"'wrapup'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arrayleavewhenempty=_.keyBy([{option:"no",value:"'no'"},{option:"yes",value:"'yes'"},{option:"strict",value:"'strict'"},{option:"loose",value:"'loose'"},{option:"paused",value:"'paused'"},{option:"penalty",value:"'penalty'"},{option:"inuse",value:"'inuse'"},{option:"ringing",value:"'ringing'"},{option:"unavailable",value:"'unavailable'"},{option:"invalid",value:"'invalid'"},{option:"unknown",value:"'unknown'"},{option:"wrapup",value:"'wrapup'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arrayrandom_periodic_announce=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arrayannounce_holdtime=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Once",value:"'once'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.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"),"")}),b.arrayreportholdtime=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arrayautopause=_.keyBy([{option:"Yes",value:"'all'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arrayringinuse=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arraytimeoutrestart=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.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"),"")}),b.arraysetinterfacevar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arraysetqueuevar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.arraysetqueueentryvar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),b.editstate=function(e,t){n.go("app.voice.voiceQueues.edit",{id:e.id,voiceQueue:e,crudPermissions:b.crudPermissions})},b.teamadddialog=function(e,t){i.show({controller:"VoiceQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{voiceQueue:e,voiceQueues:b.voiceQueues?b.voiceQueues.rows:[],crudPermissions:b.crudPermissions}})},b.agentadddialog=function(e,t){i.show({controller:"VoiceQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{voiceQueue:e,voiceQueues:b.voiceQueues?b.voiceQueues.rows:[],crudPermissions:b.crudPermissions,realtime:!1}})},b.deleteconfirm=function(e,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.gotorealtimegoto=function(e,t){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:411}).$promise.then(function(e){var t=e&&e.rows?e.rows[0]:null;t&&t.enabled?n.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()})});n.go("app.voice.realtime.queues",{})}},b.success=y,b.getVoiceQueues=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.voiceQueue.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="VoiceQueues",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditVoiceQueue=function(e,t){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:t,voiceQueues:b.voiceQueues.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteVoiceQueue=S,b.exportSelectedVoiceQueues=function(){var e=angular.copy(b.selectedVoiceQueues);return b.selectedVoiceQueues=[],e},b.deleteSelectedVoiceQueues=function(e){var t=i.confirm().title("Are you sure want to delete the selected voiceQueues?").htmlContent("<b>"+b.selectedVoiceQueues.length+" selected</b> will be deleted.").ariaLabel("delete VoiceQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){b.selectedVoiceQueues.forEach(function(e){S(e)}),b.selectedVoiceQueues=[]})},b.deselectVoiceQueues=function(){b.selectedVoiceQueues=[]},b.selectAllVoiceQueues=function(){b.selectedVoiceQueues=b.voiceQueues.rows};var E=!0,A=1;function y(e){b.voiceQueues=e||{count:0,rows:[]}}function S(e){m.voiceQueue.delete({id:e.id}).$promise.then(function(){_.remove(b.voiceQueues.rows,{id:e.id}),b.voiceQueues.count-=1,b.voiceQueues.rows.length||b.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){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceQueue"}];for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getVoiceQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","voiceQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.voice").controller("VoiceQueuesController",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(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 t=0;t<e.data.errors.length;t+=1)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=_.find(g.voiceRecordings,{id:e.id});t&&_.merge(t,_.pick(e.toJSON(),_.keys(t))),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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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 t=a.confirm().title("Are you sure?").content("The voiceRecording will be deleted.").ariaLabel("Delete VoiceRecording").ok("Delete").cancel("Cancel").targetEvent(e);a.show(t).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 t=0;t<e.data.errors.length;t++)o.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.voiceRecordings=l||{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",sort:"-updatedAt",limit:10,page:1},b.localizationMap=f,b.pickerModel={dateStart:null},b.downloadfile2=function(s,e){return m.voiceRecording.download({id:s.id}).$promise.then(function(e){var t=[e.buffer],n="download",a=new Blob(t,{type:e.type});n=s.uniqueid+s.format;var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",n),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else 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,t){var n=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(t).ok("OK").cancel("CANCEL");i.show(n).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getVoiceRecordings=function(){if(b.pickerModel.dateStart){var e=moment(b.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format();b.query.createdAt={$gte:b.pickerModel.dateStart,$lte:e}}else b.query.createdAt=void 0;b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.voiceRecording.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="VoiceRecordings",b.promise=m.userProfile.getResources(b.query,y).$promise)},b.createOrEditVoiceRecording=function(e,t){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:t,voiceRecordings:b.voiceRecordings.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteVoiceRecording=S,b.exportSelectedVoiceRecordings=function(){var e=angular.copy(b.selectedVoiceRecordings);return b.selectedVoiceRecordings=[],e},b.deleteSelectedVoiceRecordings=function(e){var t=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(t).then(function(){b.selectedVoiceRecordings.forEach(function(e){S(e)}),b.selectedVoiceRecordings=[]})},b.deselectVoiceRecordings=function(){b.selectedVoiceRecordings=[]},b.selectAllVoiceRecordings=function(){b.selectedVoiceRecordings=b.voiceRecordings.rows},b.clearDateFilter=function(){b.pickerModel={dateStart:null},b.getVoiceRecordings()};var E=!0,A=1;function y(e){b.voiceRecordings=e||{count:0,rows:[]}}function S(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 t=0;t<e.data.errors.length;t++)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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,t){E?o(function(){E=!1}):(t||(A=b.query.page),e!==t&&(b.query.page=1),e||(b.query.page=A),b.getVoiceRecordings())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","voiceRecordings","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","dateFilterLocalizationFactory"],angular.module("app.voice").controller("VoiceRecordingsController",e)}(),function(){"use strict";function e(t,n,s,a,o,e,i,r){var l=this;function d(e,t){return{id:e,title:t.name||"NONAME",state:"app.dashboards.custom",stateParams:t,weight:2,hidden:function(){return o.hasRole("agent")||!o.hasPermission(e)&&!o.hasRole("admin")}}}function c(e,t){return{id:e,title:t.name||"NONAME",state:"app.plugins.plugin",stateParams:t,weight:2,hidden:function(){return o.hasRole("agent")||!o.hasPermission(e)&&!o.hasRole("admin")}}}function m(e,t){a.saveItem("apps.home.plugin_"+e,{id:e,title:t.name,translate:t.name,state:"plugin_"+t.id,stateParams:t,view:"plugin",icon:t.icon,weight:12,hidden:function(){return!o.hasPermission(e)}})}function u(e){return _.map(e.children,function(e){return e.id})}l.isAgent=function(){return o.getCurrentUser()&&o.hasRole("agent")},s.saveItem("apps",{title:"APPS",group:!0,weight:1,hidden:function(){return o.hasRole("agent")}}),i.version.get().$promise.then(function(e){l.version=e&&e.current?e.current:"UNKNOWN"}).catch(function(e){l.version="UNKNOWN"}).finally(function(){s.saveItem("version",{title:"VERSION "+l.version,group:!0,weight:2,hidden:function(){return o.hasRole("agent")}})}),o.isLoggedIn()&&(i.dashboard.get().$promise.then(function(e){for(var t=0,n=0;n<e.rows.length;n+=1)t=99999+e.rows[n].id,s.saveItem("apps.dashboards.custom_"+t,d(t,e.rows[n]))}),i.plugin.get({active:!0}).$promise.then(function(e){var t=0;if(e.count){var n=_.filter(e.rows,function(e){return"never"!=e.sidebar&&"agentOnly"!=e.sidebar});if(0<n.length){s.saveItem("apps.plugins",{id:1900,title:"Plugins",translate:"PLUGINS.PLUGINS",icon:"icon-apps",permissions:{hidden:!0},weight:17,hidden:function(){return o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}});for(var a=0;a<n.length;a+=1)t=88888+n[a].id,s.saveItem("apps.plugins.plugin_"+t,c(t,n[a]));s.sort()}var i=_.filter(e.rows,function(e){return"never"!=e.sidebar&&"adminOnly"!=e.sidebar});if(0<i.length)for(a=0;a<i.length;a+=1)m(t=88888+i[a].id,i[a])}})),e.custom&&!r.defaultPageTitle&&r.pageTitle&&angular.element("#pageTitle").html(r.pageTitle),s.saveItem("apps.dashboards",{id:100,title:"Dashboards",translate:"DASHBOARDS.DASHBOARDS",icon:"icon-tile-four",weight:2,hidden:function(){return o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.saveItem("apps.dashboards.general",{id:101,title:"General",route:"",translate:"DASHBOARDS.GENERAL",state:"app.dashboards.general",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(101)&&!o.hasRole("admin")}}),s.saveItem("apps.staff",{id:200,title:"Staff",translate:"STAFF.STAFF",icon:"icon-account-multiple",weight:3,hidden:function(){return o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||o.hasRole("user")||!o.hasPermission(201)&&!o.hasRole("admin")}}),s.saveItem("apps.staff.agents",{id:202,title:"Agents",route:"user",translate:"STAFF.AGENTS",state:"app.staff.agents",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(202)&&!o.hasRole("admin")}}),s.saveItem("apps.staff.telephones",{id:203,title:"Telephones",route:"user",translate:"STAFF.TELEPHONES",state:"app.staff.telephones",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(203)&&!o.hasRole("admin")}}),s.saveItem("apps.staff.teams",{id:204,title:"Teams",route:"team",translate:"STAFF.TEAMS",state:"app.staff.teams",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(204)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(205)&&!o.hasRole("admin")}}),s.saveItem("apps.contactmanager",{id:300,title:"ContactManager",translate:"CONTACTMANAGER.CONTACTMANAGER",icon:"icon-account-circle",license:"cm",weight:4,hidden:function(){return!e.cm||o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.saveItem("apps.contactmanager.lists",{id:301,title:"Lists",route:"cmList",translate:"CONTACTMANAGER.LISTS",state:"app.contactmanager.lists",weight:2,hidden:function(){return o.hasRole("agent")||!o.hasPermission(301)&&!o.hasRole("admin")}}),s.saveItem("apps.contactmanager.companies",{id:302,title:"Companies",route:"cmCompany",translate:"CONTACTMANAGER.COMPANIES",state:"app.contactmanager.companies",weight:3,hidden:function(){return o.hasRole("agent")||!o.hasPermission(302)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(304)&&!o.hasRole("admin")}}),s.saveItem("apps.contactmanager.contacts",{id:303,title:"Contacts",route:"",translate:"CONTACTMANAGER.CONTACTS",state:"app.contactmanager.contacts",permissions:{association:!1},weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(303)&&!o.hasRole("admin")}}),s.saveItem("apps.voice",{id:400,title:"Voice",translate:"VOICE.VOICE",icon:"icon-phone",license:"voice",weight:5,hidden:function(){return!e.voice||o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.saveItem("apps.voice.voiceQueues",{id:401,title:"VoiceQueues",route:"voiceQueue",channel:"voice",translate:"VOICE.VOICEQUEUES",state:"app.voice.voiceQueues",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(401)&&!o.hasRole("admin")}}),s.saveItem("apps.voice.inboundroutes",{id:402,title:"InboundRoutes",route:"voiceExtension",translate:"VOICE.INBOUNDROUTES",state:"app.voice.inboundroutes",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(402)&&!o.hasRole("admin")}}),s.saveItem("apps.voice.outboundroutes",{id:403,title:"OutboundRoutes",route:"voiceExtension",translate:"VOICE.OUTBOUNDROUTES",state:"app.voice.outboundroutes",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(403)&&!o.hasRole("admin")}}),s.saveItem("apps.voice.internalroutes",{id:404,title:"InternalRoutes",route:"voiceExtension",translate:"VOICE.INTERNALROUTES",state:"app.voice.internalroutes",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(404)&&!o.hasRole("admin")}}),s.saveItem("apps.voice.contexts",{id:405,title:"Contexts",route:"voiceContext",translate:"VOICE.CONTEXTS",state:"app.voice.contexts",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(405)&&!o.hasRole("admin")}}),s.saveItem("apps.voice.voicemails",{id:406,title:"Voicemails",route:"voiceMail",translate:"VOICE.VOICEMAILS",state:"app.voice.voicemails",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(406)&&!o.hasRole("admin")}}),s.saveItem("apps.voice.musiconholds",{id:407,title:"MusicOnHolds",route:"voiceMusicOnHold",translate:"VOICE.MUSICONHOLDS",state:"app.voice.musiconholds",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(407)&&!o.hasRole("admin")}}),s.saveItem("apps.voice.voiceRecordings",{id:408,title:"VoiceRecordings",route:"voiceRecording",translate:"VOICE.VOICERECORDINGS",state:"app.voice.voiceRecordings",permissions:{association:!1,loading:!0},weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(408)&&!o.hasRole("admin")}}),s.saveItem("apps.voice.chanSpies",{id:409,title:"ChanSpies",route:"voiceChanSpy",translate:"VOICE.CHANSPIES",state:"app.voice.chanSpies",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(409)&&!o.hasRole("admin")}}),s.saveItem("apps.voice.voicePrefixes",{id:410,title:"VoicePrefixes",route:"voicePrefix",translate:"VOICE.VOICEPREFIXES",state:"app.voice.voicePrefixes",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(410)&&!o.hasRole("admin")}}),s.saveItem("apps.voice.realtime",{id:411,title:"Realtime",route:"",translate:"VOICE.REALTIME",state:"app.voice.realtime",permissions:{association:!1,crud:!1},weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(411)&&!o.hasRole("admin")}}),s.saveItem("apps.chat",{id:500,title:"Chat",translate:"CHAT.CHAT",icon:"icon-hangouts",license:"chat",weight:6,hidden:function(){return!e.chat||o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.saveItem("apps.chat.chatQueues",{id:501,title:"ChatQueues",route:"chatQueue",channel:"chat",translate:"CHAT.CHATQUEUES",state:"app.chat.chatQueues",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(501)&&!o.hasRole("admin")}}),s.saveItem("apps.chat.chatWebsites",{id:502,title:"ChatWebsites",route:"chatWebsite",channel:"chat",translate:"CHAT.CHATWEBSITES",state:"app.chat.chatWebsites",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(502)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(510)&&!o.hasRole("admin")}}),s.saveItem("apps.mail",{id:600,title:"Mail",translate:"MAIL.MAIL",icon:"icon-email",license:"mail",weight:7,hidden:function(){return!e.mail||o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.saveItem("apps.mail.mailQueues",{id:601,title:"MailQueues",route:"mailQueue",channel:"mail",translate:"MAIL.MAILQUEUES",state:"app.mail.mailQueues",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(601)&&!o.hasRole("admin")}}),s.saveItem("apps.mail.mailAccounts",{id:602,title:"MailAccounts",route:"mailAccount",channel:"mail",translate:"MAIL.MAILACCOUNTS",state:"app.mail.mailAccounts",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(602)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(603)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(610)&&!o.hasRole("admin")}}),s.saveItem("apps.sms",{id:700,title:"Sms",translate:"SMS.SMS",icon:"icon-message-text",license:"messaging",weight:8,hidden:function(){return!e.messaging||o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.saveItem("apps.sms.smsQueues",{id:701,title:"SmsQueues",route:"smsQueue",channel:"sms",translate:"SMS.SMSQUEUES",state:"app.sms.smsQueues",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(701)&&!o.hasRole("admin")}}),s.saveItem("apps.sms.smsAccounts",{id:702,title:"SmsAccounts",route:"smsAccount",channel:"sms",translate:"SMS.SMSACCOUNTS",state:"app.sms.smsAccounts",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(702)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(710)&&!o.hasRole("admin")}}),s.saveItem("apps.openchannel",{id:800,title:"Openchannel",translate:"OPENCHANNEL.OPENCHANNEL",icon:"icon-google-earth",license:"openchannel",weight:9,hidden:function(){return!e.openchannel||o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.saveItem("apps.openchannel.openchannelQueues",{id:801,title:"OpenchannelQueues",route:"openchannelQueue",channel:"openChannel",translate:"OPENCHANNEL.OPENCHANNELQUEUES",state:"app.openchannel.openchannelQueues",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(801)&&!o.hasRole("admin")}}),s.saveItem("apps.openchannel.openchannelAccounts",{id:802,title:"OpenchannelAccounts",route:"openchannelAccount",channel:"openChannel",translate:"OPENCHANNEL.OPENCHANNELACCOUNTS",state:"app.openchannel.openchannelAccounts",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(802)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(810)&&!o.hasRole("admin")}}),s.saveItem("apps.fax",{id:900,title:"Fax",translate:"FAX.FAX",icon:"icon-deskphone",license:"fax",weight:10,hidden:function(){return!e.fax||o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.saveItem("apps.fax.faxQueues",{id:901,title:"FaxQueues",route:"faxQueue",channel:"fax",translate:"FAX.FAXQUEUES",state:"app.fax.faxQueues",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(901)&&!o.hasRole("admin")}}),s.saveItem("apps.fax.faxAccounts",{id:902,title:"FaxAccounts",route:"faxAccount",channel:"fax",translate:"FAX.FAXACCOUNTS",state:"app.fax.faxAccounts",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(902)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(910)&&!o.hasRole("admin")}}),s.saveItem("apps.tools",{id:1e3,title:"Tools",translate:"TOOLS.TOOLS",icon:"icon-auto-fix",weight:13,hidden:function(){return o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.saveItem("apps.tools.cannedAnswers",{id:1001,title:"CannedAnswers",route:"cannedAnswer",translate:"TOOLS.CANNEDANSWERS",state:"app.tools.cannedAnswers",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1001)&&!o.hasRole("admin")}}),s.saveItem("apps.tools.dispositions",{id:1002,title:"Dispositions",route:"disposition",translate:"TOOLS.DISPOSITIONS",state:"app.tools.dispositions",weight:2,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1002)&&!o.hasRole("admin")}}),s.saveItem("apps.tools.customDashboards",{id:1003,title:"CustomDashboards",route:"dashboard",translate:"TOOLS.CUSTOMDASHBOARDS",state:"app.tools.customDashboards",weight:3,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1003)&&!o.hasRole("admin")}}),s.saveItem("apps.tools.intervals",{id:1004,title:"Intervals",route:"interval",translate:"TOOLS.INTERVALS",state:"app.tools.intervals",weight:4,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1004)&&!o.hasRole("admin")}}),s.saveItem("apps.tools.pauses",{id:1005,title:"Pauses",route:"pause",translate:"TOOLS.PAUSES",state:"app.tools.pauses",weight:5,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1005)&&!o.hasRole("admin")}}),s.saveItem("apps.tools.schedules",{id:1006,title:"Scheduler",route:"schedule",translate:"TOOLS.SCHEDULER",state:"app.tools.schedules",weight:6,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1006)&&!o.hasRole("admin")}}),s.saveItem("apps.tools.sounds",{id:1007,title:"Sounds",route:"sound",translate:"TOOLS.SOUNDS",state:"app.tools.sounds",weight:7,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1007)&&!o.hasRole("admin")}}),s.saveItem("apps.tools.tags",{id:1008,title:"Tags",route:"tag",translate:"TOOLS.TAGS",state:"app.tools.tags",weight:8,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1008)&&!o.hasRole("admin")}}),s.saveItem("apps.tools.templates",{id:1009,title:"Templates",route:"template",translate:"TOOLS.TEMPLATES",state:"app.tools.templates",weight:9,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1009)&&!o.hasRole("admin")}}),s.saveItem("apps.tools.triggers",{id:1010,title:"Triggers",route:"trigger",translate:"TOOLS.TRIGGERS",state:"app.tools.triggers",weight:10,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1010)&&!o.hasRole("admin")}}),s.saveItem("apps.tools.trunks",{id:1011,title:"Trunks",route:"trunk",translate:"TOOLS.TRUNKS",state:"app.tools.trunks",weight:11,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1011)&&!o.hasRole("admin")}}),s.saveItem("apps.tools.variables",{id:1012,title:"Variables",route:"variable",translate:"TOOLS.VARIABLES",state:"app.tools.variables",weight:12,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1012)&&!o.hasRole("admin")}}),s.saveItem("apps.callysquare",{id:1100,title:"CallySquare",translate:"CALLYSQUARE.CALLYSQUARE",icon:"icon-sitemap",license:"voice",weight:11,hidden:function(){return!e.voice||o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.saveItem("apps.callysquare.odbcs",{id:1101,title:"ODBC",route:"squareOdbc",translate:"CALLYSQUARE.ODBC",state:"app.callysquare.odbcs",weight:2,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1101)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(1102)&&!o.hasRole("admin")}}),s.saveItem("apps.callysquare.projects",{id:1103,title:"Projects",route:"squareProject",translate:"CALLYSQUARE.PROJECTS",state:"app.callysquare.projects",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1103)&&!o.hasRole("admin")}}),s.saveItem("apps.analytics",{id:1200,title:"Analytics",translate:"ANALYTICS.ANALYTICS",icon:"icon-chart-line",weight:14,hidden:function(){return o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.saveItem("apps.analytics.metrics",{id:1201,title:"Metrics",route:"analyticMetric",translate:"ANALYTICS.METRICS",state:"app.analytics.metrics",weight:3,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1201)&&!o.hasRole("admin")}}),s.saveItem("apps.analytics.extractedReports",{id:1202,title:"ExtractedReports",route:"analyticExtractedReport",translate:"ANALYTICS.EXTRACTEDREPORTS",state:"app.analytics.extractedReports",weight:2,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1202)&&!o.hasRole("admin")}}),s.saveItem("apps.analytics.reports",{id:1203,title:"Reports",route:"",translate:"ANALYTICS.REPORTS",state:"app.analytics.reports",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1203)&&!o.hasRole("admin")}}),s.saveItem("apps.integrations",{id:1300,title:"Integrations",translate:"INTEGRATIONS.INTEGRATIONS",icon:"icon-heart",weight:15,hidden:function(){return o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(1301)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(1302)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(1303)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(1305)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(1306)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(1307)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(1308)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(1309)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(1310)&&!o.hasRole("admin")}}),s.saveItem("apps.settings",{id:1400,title:"Settings",translate:"SETTINGS.SETTINGS",icon:"icon-cog",permissions:{hidden:!0},weight:18,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1400)&&!o.hasRole("admin")}}),s.saveItem("apps.settings.generals",{id:1401,title:"General",route:"setting",translate:"SETTINGS.GENERAL",state:"app.settings.generals",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1400)&&!o.hasRole("admin")}}),s.saveItem("apps.settings.smtps",{id:1402,title:"Smtp",route:"mailAccount",translate:"SETTINGS.SMTP",state:"app.settings.smtps",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1400)&&!o.hasRole("admin")}}),s.saveItem("apps.settings.networks",{id:1403,title:"Networks",route:"network",translate:"SETTINGS.NETWORKS",state:"app.settings.networks",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1400)&&!o.hasRole("admin")}}),s.saveItem("apps.settings.customizations",{id:1407,title:"Customizations",route:"setting",translate:"SETTINGS.CUSTOMIZATIONS",state:"app.settings.customizations",weight:1,hidden:function(){return!e.custom||o.hasRole("agent")||!o.hasPermission(1400)&&!o.hasRole("admin")}}),s.saveItem("apps.settings.updates",{id:1404,title:"Updates",route:"",translate:"SETTINGS.UPDATES",state:"app.settings.updates",weight:1,hidden:function(){return!e.update||o.hasRole("agent")||!o.hasPermission(1400)&&!o.hasRole("admin")}}),s.saveItem("apps.settings.license",{id:1405,title:"License",route:"",translate:"SETTINGS.LICENSE",state:"app.settings.license",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1400)&&!o.hasRole("admin")}}),s.saveItem("apps.settings.system",{id:1406,title:"System",route:"",translate:"SETTINGS.SYSTEM",state:"app.settings.system",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1400)&&!o.hasRole("admin")}}),s.saveItem("apps.motiondialer",{id:1500,title:"MotionDialer",translate:"MOTIONDIALER.MOTIONDIALER",icon:"icon-fire",license:"dialer",weight:5,hidden:function(){return!e.dialer||o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.saveItem("apps.motiondialer.queueCampaigns",{id:1501,title:"QueueCampaigns",route:"voiceQueue",channel:"bull",translate:"MOTIONDIALER.QUEUECAMPAIGNS",state:"app.motiondialer.queueCampaigns",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1501)&&!o.hasRole("admin")}}),s.saveItem("apps.motiondialer.ivrCampaigns",{id:1502,title:"IvrCampaigns",route:"campaign",translate:"MOTIONDIALER.IVRCAMPAIGNS",state:"app.motiondialer.ivrCampaigns",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1502)&&!o.hasRole("admin")}}),s.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 o.hasRole("agent")||!o.hasPermission(1510)&&!o.hasRole("admin")}}),s.saveItem("apps.help",{id:1600,title:"Help",translate:"HELP.HELP",icon:"icon-help",permissions:{association:!1},weight:19,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1600)&&!o.hasRole("admin")}}),s.saveItem("apps.help.about",{id:1601,title:"About",route:"",translate:"HELP.ABOUT",state:"app.help.about",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1600)&&!o.hasRole("admin")}}),s.saveItem("apps.jscripty",{id:1700,title:"jscripty",translate:"JSCRIPTY.JSCRIPTY",icon:"icon-script",license:"jscripty",weight:12,hidden:function(){return!e.jscripty||o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.saveItem("apps.jscripty.projects",{id:1701,title:"Projects",route:"jscriptyProject",translate:"JSCRIPTY.PROJECTS",state:"app.jscripty.projects",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1701)&&!o.hasRole("admin")}}),s.saveItem("apps.marketplace",{id:1800,title:"Marketplace",translate:"MARKETPLACE.MARKETPLACE",icon:"icon-cart",weight:16,hidden:function(){return o.hasRole("agent")||!o.hasChildrenPermissions(u(this))&&!o.hasRole("admin")}}),s.saveItem("apps.marketplace.plugins",{id:1801,title:"Plugins",route:"plugin",translate:"MARKETPLACE.PLUGINS",state:"app.marketplace.plugins",weight:1,hidden:function(){return o.hasRole("agent")||!o.hasPermission(1801)&&!o.hasRole("admin")}}),s.sort(),a.saveItem("apps",{title:"APPS",group:!0,weight:1}),a.saveItem("apps.home",{id:100,title:"Home",translate:"DASHBOARDS.HOME",icon:"icon-home",weight:1}),a.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!o.hasPermission(101)}}),a.saveItem("apps.home.contacts",{id:102,title:"Contacts",translate:"DASHBOARDS.CONTACTS",state:"contacts",view:"contacts",icon:"icon-account-circle",iconClass:"red-fg",weight:2,hidden:function(){return!e.cm||!o.hasPermission(102)}}),a.saveItem("apps.home.mycontacts",{id:103,title:"Contacts",translate:"DASHBOARDS.MYCONTACTS",state:"mycontacts",view:"mycontacts",icon:"icon-account-multiple",iconClass:"red-fg",weight:3,hidden:function(){return!e.cm||!o.hasPermission(103)}}),a.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:3,hidden:function(){return!e.dialer||!o.hasPermission(113)}}),a.saveItem("apps.home.voice",{id:110,title:"Voice",translate:"DASHBOARDS.VOICE",state:"voice",view:"voice",icon:"icon-phone",iconClass:"blue-A700-fg",weight:4,hidden:function(){return!e.voice||!o.hasPermission(110)}}),a.saveItem("apps.home.abandoned",{id:111,title:"Abandoned",translate:"DASHBOARDS.ABANDONED",state:"abandoned",view:"abandoned",icon:"icon-phone-missed",iconClass:"blue-fg",weight:5,hidden:function(){return!e.voice||!o.hasPermission(111)}}),a.saveItem("apps.home.recordings",{id:104,title:"Recordings",translate:"DASHBOARDS.RECORDINGS",state:"recordings",view:"recordings",icon:"icon-audiobook",iconClass:"indigo-A100-fg",weight:6,hidden:function(){return!e.voice||!o.hasPermission(104)}}),a.saveItem("apps.home.chat",{id:105,title:"Chat",translate:"DASHBOARDS.CHAT",state:"chat",view:"chat",icon:"icon-hangouts",iconClass:"green-A700-fg",weight:7,hidden:function(){return!e.chat||!o.hasPermission(105)}}),a.saveItem("apps.home.mail",{id:106,title:"Mail",translate:"DASHBOARDS.MAIL",state:"mail",view:"mail",icon:"icon-email",iconClass:"teal-fg",weight:8,hidden:function(){return!e.mail||!o.hasPermission(106)}}),a.saveItem("apps.home.sms",{id:107,title:"Sms",translate:"DASHBOARDS.SMS",state:"sms",view:"sms",icon:"icon-message-text",iconClass:"orange-fg",weight:9,hidden:function(){return!e.messaging||!o.hasPermission(107)}}),a.saveItem("apps.home.openchannel",{id:108,title:"Openchannel",translate:"DASHBOARDS.OPENCHANNEL",state:"openchannel",view:"openchannel",icon:"icon-google-earth",iconClass:"amber-A200-fg",weight:10,hidden:function(){return!e.openchannel||!o.hasPermission(108)}}),a.saveItem("apps.home.fax",{id:109,title:"Fax",translate:"DASHBOARDS.FAX",state:"fax",view:"fax",icon:"icon-deskphone",iconClass:"blue-grey-A200-fg",weight:11,hidden:function(){return!e.fax||!o.hasPermission(109)}}),t.$on("$viewContentAnimationEnded",function(e){e.targetScope.$id===t.$id&&n.$broadcast("msSplashScreen::remove")})}e.$inject=["$scope","$rootScope","msNavigationService","msNavigationAgentService","Auth","license","api","setting"],angular.module("motion").controller("MainController",e)}(),function(){"use strict";function e(e,t,n,a,o,r){var i=this;function s(e){if(e&&e.id){var t=99999+e.id;o.saveItem("apps.dashboards.custom_"+t,{id:t,title:e.name||"NONAME",state:"app.dashboards.custom",stateParams:e,weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(t)&&!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 t=88888+e.id;o.saveItem("apps.plugins.plugin_"+t,{id:t,title:e.name||"NONAME",state:"app.plugins.plugin",stateParams:e,weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(t)&&!r.hasRole("admin")}}),o.sort()}}else{t=88888+e.id;n=1900,a=t,i=o.getNavigation(),(s=_.find(i[0].children,{id:n}))&&_.some(s.children,{id:a})&&("always"==e.sidebar||"adminOnly"==e.sidebar)&&(o.deleteItem("apps.plugins.plugin_"+t),d(1900)||o.saveItem("apps.plugins",{id:1900,title:"Plugins",translate:"PLUGINS.PLUGINS",icon:"icon-apps",weight:17,hidden:function(){return!0}}))}var n,a,i,s}function d(e){var t=o.getNavigation(),n=_.find(t[0].children,{id:e});return!!(n&&0<n.children.length)}i.bodyEl=angular.element("body"),i.msScrollOptions={suppressScrollX:!0},i.setting=n,i.$onInit=function(){i.folded="true"===t.get("motion.folded")||!1},i.toggleMsNavigationFolded=function(){i.folded=!i.folded,t.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 t=99999+e.id;o.deleteItem("apps.dashboards.custom_"+t)}}),a.on("plugin:save",l),a.on("plugin:update",l),a.on("plugin:remove",function(e){if(e&&e.id&&"never"!=e.sidebar){var t=88888+e.id;"always"!=e.sidebar&&"adminOnly"!=e.sidebar||(o.deleteItem("apps.plugins.plugin_"+t),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,t,n,s,o,r){var l=this;function d(n){o.isSupported()?o.requestPermission().then(function(){var e,t;t={autoClose:!0,duration:10,showOnPageHidden:!0,icon:"api/users/"+(e=n).FromId+"/avatar",body:e.body||"",focusOnclick:!0,closeOnClick:!0},o.show(a.instant("QUICKPANEL.NEW_INTERNAL_MESSAGE"),t)},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=t.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--},n.on("chatInternalMessage:save",l.onMessageSave),n.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 t=[],n=e.rows,a=0;a<n.length;a++)t.push(s.chatGroup.getUnread({id:n[a].id}).$promise);return i.all(t)}).then(function(e){for(var t=0;t<e.length;t++)l.unreadTotalGroupMessages+=e[t].count}).catch(function(e){console.error(e)}),e.$on("$destroy",function(){n.removeAllListeners("chatInternalMessage:save"),n.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(e,t,n,a,i,s,o,r,l,d,c,m){var u=this;function p(e){var t=angular.element("#chat-dialog");a(function(){t.animate({scrollTop:t[0].scrollHeight},e)},0)}function g(e){return _.isNil(e)?"":e.replace(/[^\w.+#*\-]+/g,"")}function v(e){return m.get(e).success(function(){t.success({title:"Successful call",msg:"Call properly handled!"})}).error(function(e){t.error({title:"PhoneBar API Error",msg:d.instant("CONTACTMANAGER.ERRORS.PHONEBAR_API")})})}u.currentUser=i.getCurrentUser(),u.user=void 0,u.users={count:0,rows:[]},u.standardDate=moment(0).format("YYYY-MM-DD HH:mm:ss"),u.unreadMessage={},u.replyMessage="",u.disabled=!1,u.init=function(e){u.license=e},u.toggleChat=function(e){if(e){if(!e.allowmessenger&&"agent"===e.role)return t.warning({title:d.instant("QUICKPANEL.WARNING"),msg:d.instant("QUICKPANEL.MESSENGER_DISABLED")}),void(u.user=void 0);u.user=e,u.replyMessage="",n.chatInternalMessage.get({sort:"createdAt",FromId:u.currentUser.id+","+e.id,ToId:u.currentUser.id+","+e.id,ChatGroupId:"null"}).$promise.then(function(e){if(e&&e.rows){u.user.messages=e;for(var t=0;t<u.user.messages.rows.length;t+=1)!1===u.user.messages.rows[t].read&&u.user.messages.rows[t].ToId===u.currentUser.id&&n.chatInternalMessage.update({id:u.user.messages.rows[t].id,read:!0})}}).finally(function(){p(0)})}else u.user=void 0},u.reply=function(){u.disabled=!0;Date.now();if(""===u.replyMessage)return void(u.disabled=!1);var e={FromId:u.currentUser.id,ToId:u.user.id,body:u.replyMessage,read:!1};u.replyMessage="",n.chatInternalMessage.save(e).$promise.then(function(e){u.user.messages.rows.push(e),u.user.lastMessageAt=e.createdAt,u.user.lastMessage=e,p(400)}).catch(function(e){}).finally(function(){u.disabled=!1})},u.onMessageSave=function(e){if(e.ToId===u.currentUser.id&&!e.ChatGroupId){u.user&&u.user.id===e.FromId?(u.user.messages.rows.push(e),p(0),n.chatInternalMessage.update({id:e.id,read:!0})):u.unreadMessage[e.FromId]=u.unreadMessage[e.FromId]?u.unreadMessage[e.FromId]+1:1;var t=_.find(u.users.rows,{id:e.FromId});t&&(t.lastMessageAt=e.createdAt,t.lastMessage=e)}},u.onMessageUpdate=function(e){if((e.FromId===u.currentUser.id||e.ToId===u.currentUser.id)&&!e.ChatGroupId){if(u.user){var t=_.find(u.user.messages.rows,{id:e.id});t&&_.merge(t,e)}var n=_.find(u.users.rows,{id:u.currentUser.id===e.FromId?e.ToId:e.FromId});n&&n.lastMessage&&_.merge(n.lastMessage,e),e.ToId===u.currentUser.id&&e.read&&0<u.unreadMessage[e.FromId]&&(u.unreadMessage[e.FromId]-=1)}},u.onUserUpdate=function(e){var t=_.find(u.users.rows,{id:e.id});t&&(_.isNil(e.online)||t.online===e.online||(t.online=e.online),_.isNil(e.allowmessenger)||t.allowmessenger===e.allowmessenger||(t.allowmessenger=e.allowmessenger))},u.webcall=function(e){c.$broadcast("webrtc::call",{target:g(e)})},u.call=function(e){return v("http://127.0.0.1:"+(u.user.phoneBarRemoteControlPort||"9888")+"/api/originate/"+g(e))},u.transfer=function(e){return v("http://127.0.0.1:"+(u.user.phoneBarRemoteControlPort||"9888")+"/api/transfer?number="+g(e))},s.on("chatInternalMessage:save",u.onMessageSave),s.on("chatInternalMessage:update",u.onMessageUpdate),s.on("user:update",u.onUserUpdate),o("quick-panel").onClose(function(){u.user=void 0}),n.chatInternalMessage.get({fields:"FromId",ToId:u.currentUser.id,read:!1,nolimit:!0,ChatGroupId:"null"}).$promise.then(function(e){u.unreadMessage=_.countBy(e.rows,"FromId")}).catch(function(e){}),n.chatInternalMessage.getUsers().$promise.then(function(e){u.users=e}).catch(function(e){console.error(e)}),e.$on("$destroy",function(){s.removeAllListeners("chatInternalMessage:save"),s.removeAllListeners("chatInternalMessage:update"),s.removeAllListeners("user:update")})}e.$inject=["$scope","toasty","api","$timeout","Auth","socket","$mdSidenav","$q","$interval","$translate","$rootScope","$http"],angular.module("app.quick-panel").controller("ChatInternalController",e)}(),function(){"use strict";function e(e,t,n,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 n;return d.errors=[],s.chatGroup.save({name:d.group.name,write:d.group.write}).$promise.then(function(e){var t=_.map(d.group.members,"id");return t.unshift(d.currentUser.id),n=e,s.chatGroup.addMembers({id:n.id,ids:t}).$promise}).then(function(){i.success({title:"Group properly saved!",msg:n.name+" has been saved!"}),c(n)}).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((t=e,n=angular.lowercase(t),function(e){var t=e.name.toLowerCase();return-1!=t.indexOf(n)})):[];var t,n}}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,n,a,s,t,o,i,r,l,d){var c=this;function m(){delete c.group}function u(e){var t=angular.element("#chat-group-dialog");a(function(){t.animate({scrollTop:t[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 t=0,n=[];t<e.rows.length;t++)e.rows[t].unreadGroupMessages=0,c.groups[e.rows[t].id]=e.rows[t],n.push(r.chatGroup.getUnread({id:e.rows[t].id}).$promise);return o.all(n)}).then(function(e){for(var t=0;t<e.length;t++)c.groups[e[t].id].unreadGroupMessages+=e[t].count}).catch(function(e){console.error(e)})},c.back=m,c.addGroup=function(e,t){s.show({controller:"CreateOrEditChatGroupDialogController",controllerAs:"vm",templateUrl:"app/quick-panel/tabs/groups/create/dialog.html",parent:angular.element(n.body),targetEvent:t,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,t){var n=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(t).ok("OK").cancel("CANCEL");s.show(n).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(n.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 t=[];a.messages=e.rows,a.messages.unshift(i);for(var n=0;n<a.messages.length;n++)t.push(r.user.get({id:a.messages[n].ToId,fields:"id,name,fullname,userpic"}).$promise);return o.all(t)}).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(t){c.group={id:t.id,write:t.write,messages:{}},r.chatGroup.getMembers({id:t.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:t.id,nolimit:!0}).$promise}).then(function(e){for(var t,n=0,a=[];n<e.count;n++)e.rows[n].ToId===c.currentUser.id&&(t=e.rows[n],c.group.messages[t.id]=t,e.rows[n].ToId!=c.currentUser.id||e.rows[n].FromId===c.currentUser.id||t.read||a.push(r.chatInternalMessage.update({id:t.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 n={id:c.group.id,FromId:c.currentUser.id,ToId:c.currentUser.id,body:c.replyMessage,read:!0},a=[];c.replyMessage="",r.chatGroup.addMessage(n).$promise.then(function(e){n.read=!1,n.ChatInternalMessageId=e.id;for(var t=0;t<c.group.members.length;t++)c.group.members[t].id!==c.currentUser.id&&(n.ToId=c.group.members[t].id,a.push(r.chatGroup.addMessage(angular.copy(n)).$promise));return o.all(a)}).catch(function(e){console.log(e)})},l.on("chatInternalMessage:save",function(t){if(!c.group&&t.ToId===c.currentUser.id&&t.FromId!==c.currentUser.id&&!t.read&&t.ChatGroupId){var e=c.groups[t.ChatGroupId];if(!e)return r.chatGroup.get({id:t.ChatGroupId}).$promise.then(function(e){e.unreadGroupMessages=1,c.groups[e.id]=e});e.unreadGroupMessages||(e.unreadGroupMessages=0),e.unreadGroupMessages++}c.group&&t.ChatGroupId===c.group.id&&t.ToId===c.currentUser.id&&r.chatInternalMessage.update({id:t.id,read:!0}).$promise.then(function(){var e;e=t,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]}),t("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,t,n,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,t,n,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(){t.success({title:n.instant("RESETPASSWORD.PASSWORD_RESET"),msg:n.instant("RESETPASSWORD.PASSWORD_RESET_MESSAGE")}),a.go("app.login")}).catch(function(e){e&&t.error({title:n.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&&t.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,t,n,a,i,s){var o=this;function r(){e.hide()}o.errors=[],o.user=a,o.setting=i,o.reset=s,o.passwordPattern=o.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",o.savePassword=function(){o.errors=[],n.user.changePassword({id:o.user.id},{oldPassword:o.oldPassword,newPassword:o.password}).$promise.then(function(){t.show(t.simple().textContent("Your password properly updated").position("top right").hideDelay(5e3)),r()}).catch(function(e){console.error(e),o.errors=e.data.errors&&e.data.errors.length?e.data.errors:[{message:e.data.message||"Authorization error",type:"api.user.changePassword"}]})},o.closeDialog=r}e.$inject=["$mdDialog","$mdToast","api","user","setting","reset"],angular.module("app.toolbar").controller("ChangePasswordController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r){var l=this;function d(e){_.isNil(e)&&s.cmHopper.update({id:l.preview.id,UserId:null}),a.hide()}l.customFieldsMap=r&&r.rows?_.mapValues(_.keyBy(r.rows,function(e){return"cf_"+e.id}),"name"):{},l.errors=[],l.hopperIds=[],l.preview=o,l.originated=!1,l.disable=!1,l.disableGetContact=!1,l.hopperIds.push(l.preview.id),l.originatePreview=function(){l.originated=!0,l.disable=!0,_.isEmpty(l.preview)?(i.error({title:"Message",msg:"Contact not available"}),l.disable=!1,l.hopperIds=[],d(!0)):s.rpc.getVoiceQueuesPreview({id:l.preview.id}).$promise.then(function(e){d(!0)}).catch(function(e){i.error({title:"Message",msg:e.data}),d(!0)}).finally(function(){l.disable=!1,l.hopperIds=[]})},l.closeDialog=d,l.nextContact=function(){return l.disableGetContact=!0,s.cmHopper.getPreview({hopperIds:l.hopperIds,direction:"next"}).$promise.then(function(e){l.disableGetContact=!1,_.isNil(e)||_.isNil(e.Queue)||!e.Queue.dialActive?(l.hopperIds=[],a.hide(),i.info({title:"PREVIEW",msg:"CAMPAIGN NOT ACTIVE"})):(l.originated||s.cmHopper.update({id:l.preview.id,UserId:null}),l.preview=e,l.hopperIds.push(l.preview.id))}).catch(function(e){if(l.disableGetContact=!1,l.hopperIds=[],404===e.status)l.getFirstAvailableContact();else if(e.data&&e.data.errors&&e.data.errors.length){a.hide();for(var t=0;t<e.data.errors.length;t+=1)i.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else a.hide(),i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api preview",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},l.previousContact=function(){if(l.disableGetContact=!0,1<l.hopperIds.length){var e=_.without(l.hopperIds,l.preview.id);return s.cmHopper.getPreview({hopperIds:e,direction:"prev"}).$promise.then(function(e){l.disableGetContact=!1,_.isNil(e)||_.isNil(e.Queue)||!e.Queue.dialActive?(l.hopperIds=[],a.hide(),i.info({title:"PREVIEW",msg:"CAMPAIGN NOT ACTIVE"})):(_.remove(l.hopperIds,function(e){return e==l.preview.id}),l.originated||s.cmHopper.update({id:l.preview.id,UserId:null}),l.preview=e)}).catch(function(e){if(404===e.status)l.hopperIds=[l.preview.id],i.info({title:"PREVIEW",msg:"PREVIOUS CONTACTS NOT AVAILABLE"});else if(e.data&&e.data.errors&&e.data.errors.length){l.hopperIds=[],a.hide();for(var t=0;t<e.data.errors.length;t+=1)i.error({title:e.data.errors[t].type,msg:e.data.errors[t].message})}else l.hopperIds=[],a.hide(),i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api preview",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}},l.getFirstAvailableContact=function(){return l.disableGetContact=!0,i.info({title:"PREVIEW",msg:"CONTACTS NOT AVAILABLE. REWINDING THE LIST"}),s.cmHopper.getPreview({hopperIds:[l.preview.id],direction:"next"}).$promise.then(function(e){_.isNil(e)||_.isNil(e.Queue)||!e.Queue.dialActive?(a.hide(),i.info({title:"PREVIEW",msg:"CAMPAIGN NOT ACTIVE"})):(l.originated||s.cmHopper.update({id:l.preview.id,UserId:null}),l.preview=e,l.hopperIds.push(l.preview.id))}).catch(function(e){if(a.hide(),404===e.status)i.info({title:"PREVIEW",msg:"CONTACTS NOT AVAILABLE"});else if(e.data&&e.data.errors&&e.data.errors.length)for(var t=0;t<e.data.errors.length;t+=1)i.error({title:e.data.errors[t].type,msg:e.data.errors[t].message});else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api preview",msg:e.data?JSON.stringify(e.data.message):e.toString()})}).finally(function(){l.disableGetContact=!1})},l.isCustomField=function(e){return _.startsWith(e,"cf_")},l.isHiddenField=function(e){return _.includes(["Company","CompanyId","ListId","UserId","createdAt","deletedAt","id","priority","scheduledat","tags","updatedAt","facebook","twitter","skype","wechat","teams","viber","line","telegram"],e)},l.isNil=function(e){return _.isNil(e)},e.$on("$destroy",function(){l.originated||s.cmHopper.update({id:l.preview.id,UserId:null})})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","api","preview","customFields"],angular.module("app.toolbar").controller("PreviewDialogController",e)}(),function(){"use strict";function e(t,n,s,a,o,e,i,r,l,d,c,m,u,p,g,v,h,f,b,E,A){var y,S=this;S.voiceQueues={},S.polling=!0,n.global={search:""},S.pauses=[],S.license=b,S.currentUser=v.getCurrentUser(),S.unreadTotalMessages=0,S.unreadTotalGroupMessages=0,S.contcts=0,"agent"===S.currentUser.role&&(y=A(function(){_.some(S.voiceQueues,{dialMethod:"preview",dialActive:!0})&&S.license.dialer&&S.polling?(S.polling=!1,f.cmHopper.getOpenContacts().$promise.then(function(e){e&&_.isNumber(e.contacts)&&(S.contacts=e.contacts)}).finally(function(){S.polling=!0})):S.contacts=0},14999)),S.setting=E,S.bodyEl=angular.element("body"),S.conf={realm:"asterisk",host:e.host(),protocol:e.protocol(),remotePlayerId:"remote-audio",ua:"Motion WebRTC Bar 0.2.0",license:S.license.webrtc,phoneBarExpires:S.currentUser.phoneBarExpires,phoneBarPrefixRequired:S.currentUser.phoneBarPrefixRequired},S.query={id:v.getCurrentUser().id,fields:"id,name,type,dialMethod,dialActive",channel:"voice",nolimit:!0},S.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"}],S.languages={ar:{title:"Arabic",translation:"TOOLBAR.ARABIC",code:"ar",flag:"ar"},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"},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"},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"}};var T=["ar","fa","he"];function I(e){S.voiceQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{}}function C(){S.promise=f.user.getQueues(S.query,I).$promise}function w(e){return v.logout(e).then(function(){return h.disconnect(),n.$broadcast("webrtc::logout"),a.go("app.login")}).catch(function(e){console.error(e)})}function O(e,t){c.show({controller:"ChangePasswordController",controllerAs:"vm",templateUrl:"app/toolbar/changepassword/changepassword.html",parent:angular.element(m.body),targetEvent:e,clickOutsideToClose:!t,locals:{user:S.user,setting:E,reset:t}})}S.toggleSidenav=function(e){i(e).toggle()},S.logout=w,S.changeLanguage=function(e){if(!S.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"})}S.selectedLanguage=e,u.put("motion.language",e.code),r.use(e.code),"app.callysquare.projects.edit"===a.current.name&&d.location.reload();0<=T.indexOf(e.code)?p.info({title:r.instant("TOOLBAR.CHANGE_LANGUAGE_TITLE"),msg:r.instant("TOOLBAR.CHANGE_LANGUAGE_MESSAGE")}):t.$parent.$parent.vm.direction="ltr"},S.setUserStatus=function(e){S.userStatus=e},S.toggleHorizontalMobileMenu=function(){S.bodyEl.toggleClass("ms-navigation-horizontal-mobile-menu-active")},S.toggleMsNavigationFolded=function(){g.toggleFolded()},S.search=function(t){for(var e=[],n=g.getFlatNavigation(),a=s.defer(),i=0;i<n.length;i++)n[i].uisref&&e.push(n[i]);t&&(e=e.filter(function(e){if(-1<angular.lowercase(e.title).search(angular.lowercase(t)))return!0}));return o(function(){a.resolve(e)},1e3),a.promise},S.searchResultClick=function(e){e.uisref&&(e.stateParams?a.go(e.state,e.stateParams):a.go(e.state))},S.openSettings=function(e){n.$broadcast("webrtc::settings")},S.changePassword=O,S.isAgent=function(){return v.getCurrentUser()&&v.hasRole("agent")},S.onUserUpdate=function(e){if(e.id===S.user.id)if("agent"===e.role&&_.isBoolean(e.online)&&!e.online)if(0!==S.user.showWebBar){var t=c.confirm().title(r.instant("TOOLBAR.WARNING")+"!").textContent(r.instant("TOOLBAR.SOMEONE_LOGGED_YOU_OUT")).ariaLabel(r.instant("TOOLBAR.WARNING")+"!").ok(r.instant("TOOLBAR.STAY_LOGGED")).cancel("Logout");c.show(t).then(function(){v.queueLogin()}).catch(function(e){w(!0)}).finally(function(){_.merge(S.user,e),v.updateCurrentUser(S.user)})}else w(!0),_.merge(S.user,e),v.updateCurrentUser(S.user);else _.merge(S.user,e),v.updateCurrentUser(S.user)},S.onUserCalled=function(e){2===S.currentUser.showWebBar&&"agent"===S.currentUser.role&&S.currentUser.name===e.membername&&p.info({title:"WebRTC Popup",msg:"<div>                    <span>Call from: "+e.calleridnum+"</span><br>                    <span>Queue: "+e.queue+"</span><br>                    <span>Extra: "+(e.variables&&e.variables.extravar?e.variables.extravar:"Not defined")+"</span><br>                    </div>",showClose:!0,timeout:1e4,html:!0})},S.pause=function(e){return f.user.pause({id:S.user.id,type:e||"DEFAULT PAUSE"}).$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()})})},S.unpause=function(){return f.user.unpause({id:S.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()})})},S.preview=function(t){return S.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"}):c.show({controller:"PreviewDialogController",controllerAs:"vm",templateUrl:"app/toolbar/preview/dialog.html",parent:angular.element(m.body),targetEvent:t,clickOutsideToClose:!0,locals:{preview:e},resolve:{customFields:["apiResolver",function(e){return e.resolve("cmCustomField@get",{nolimit:!0})}]}})}).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){S.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelMessage.accept"}];for(var t=0;t<e.data.errors.length;t+=1)p.error({title:e.data.errors[t].type,msg:e.data.errors[t].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(){S.disable=!1})},S.getLogo=function(){return S.setting.defaultHeaderWhiteLabel?"xCALLY Motion":S.setting.headerWhiteLabel},S.userIsNotPhonebar=function(){return"admin"===S.currentUser.role||"user"===S.currentUser.role||"agent"===S.currentUser.role&&0!==S.currentUser.showWebBar},S.onInternalMessageSave=function(e){e.ToId!==S.currentUser.id||e.ChatGroupId||(S.unreadTotalMessages+=1);e.ToId===S.currentUser.id&&e.FromId!==S.currentUser.id&&!e.read&&e.ChatGroupId&&S.unreadTotalGroupMessages++},S.onInternalMessageUpdate=function(e){e.ToId===S.currentUser.id&&e.read&&0<S.unreadTotalMessages&&!e.ChatGroupId&&(S.unreadTotalMessages-=1);e.ToId===S.currentUser.id&&e.read&&e.ChatGroupId&&0<S.unreadTotalGroupMessages&&S.unreadTotalGroupMessages--},S.onUserVoiceQueue=function(e){_.toInteger(e.UserId)===v.getCurrentUser().id&&C()},S.onVoiceQueue=function(e){C()},h.connect(),h.on("user:update",S.onUserUpdate),h.on("user:called",S.onUserCalled),h.on("chatInternalMessage:save",S.onInternalMessageSave),h.on("chatInternalMessage:update",S.onInternalMessageUpdate),h.on("userVoiceQueue:save",S.onUserVoiceQueue),h.on("voiceQueue:save",S.onVoiceQueue),h.on("userVoiceQueue:remove",S.onUserVoiceQueue),h.on("voiceQueue:remove",S.onVoiceQueue),h.on("voiceQueue:update",S.onVoiceQueue),function(){S.user=v.getCurrentUser(),S.conf.ha1=S.user.md5secret,S.conf.id=S.user.id,S.conf.name=S.user.name,S.conf.fullname=S.user.fullname,S.conf.internal=S.user.internal,S.conf.recording=S.user.phoneBarEnableRecording,S.conf.autoAnswer=S.user.phoneBarAutoAnswer,S.conf.enableSettings=S.user.phoneBarEnableSettings,S.conf.enableDtmfTone=S.user.phoneBarEnableDtmfTone,S.conf.autoAnswerDelay=S.user.phoneBarAutoAnswerDelay,S.userStatus=S.userStatusOptions[0];var e=u.get("motion.language");e&&S.languages.hasOwnProperty(e)?S.selectedLanguage=S.languages[e]:S.selectedLanguage=S.languages[r.preferredLanguage()];if(f.pause.get({fields:"name",nolimit:!0}).$promise.then(function(e){S.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()})}),S.setting.securePassword)if(S.user.passwordResetAt){var t=moment(S.user.passwordResetAt).add(S.setting.passwordExpiresDays||90,"day");moment().isAfter(t)?O(null,!0):moment().add(15,"day").isAfter(t)&&p.warning({title:r.instant("TOOLBAR.WARNING")+"!",msg:r.instant("TOOLBAR.PASSWORD_EXPIRE_REMAINING_DAYS")+": "+Math.ceil(t.diff(moment(),"days",!0)),timeout:2e4})}else O(null,!0)}(),C(),f.chatInternalMessage.get({fields:"FromId",ToId:S.currentUser.id,read:!1,nolimit:!0}).$promise.then(function(e){S.unreadTotalMessages=e.rows.length}),t.$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"),y&&(A.cancel(y),y=null)})}e.$inject=["$scope","$rootScope","$q","$state","$timeout","$location","$mdSidenav","$translate","$mdToast","$window","$mdDialog","$document","$cookies","toasty","msNavigationService","Auth","socket","api","license","setting","$interval"],angular.module("app.toolbar").controller("ToolbarController",e)}();var urlParams=function(e){var t=new Object,n=e.lastIndexOf("?");if(0<n)for(var a=e.substring(n+1).split("&"),i=0;i<a.length;i++)0<(n=a[i].indexOf("="))&&(t[a[i].substring(0,n)]=a[i].substring(n+1));return t}(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-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,t,n){if(n=n||document,mxClient.IS_IE6)n.write('<link rel="'+e+'" href="'+t+'" charset="ISO-8859-1" type="text/css"/>');else{var a=n.createElement("link");a.setAttribute("rel",e),a.setAttribute("href",t),a.setAttribute("charset","ISO-8859-1"),a.setAttribute("type","text/css"),n.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,t=document.createElement("table");t.setAttribute("width","100%"),t.setAttribute("height","100%");var n=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),n.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),n.appendChild(a),t.appendChild(n),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=n=0,a="number"==typeof window.innerWidth?(n=window.innerHeight,window.innerWidth):(n=document.documentElement.clientHeight||document.body.clientHeight,document.body.clientWidth),mxLog.window=new mxWindow(e,t,Math.max(0,a-320),Math.max(0,n-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,t){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,t){var n=document.createElement("button");mxUtils.write(n,e),mxEvent.addListener(n,"click",t),mxLog.td.appendChild(n)},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,t){if(mxLog.TRACE){var n=0!=t?" ("+((new Date).getTime()-t)+" ms)":"";mxLog.writeln("Leaving "+e+n)}},debug:function(){mxLog.DEBUG&&mxLog.writeln.apply(this,arguments)},warn:function(){mxLog.WARN&&mxLog.writeln.apply(this,arguments)},write:function(){for(var e="",t=0;t<arguments.length;t++)e+=arguments[t],t<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="",t=0;t<arguments.length;t++)e+=arguments[t],t<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 t=mxUtils.getFunctionName(e.constructor);e[mxObjectIdentity.FIELD_NAME]=t+"#"+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,t){var n=mxObjectIdentity.get(e),a=this.map[n];return this.map[n]=t,a},mxDictionary.prototype.remove=function(e){e=mxObjectIdentity.get(e);var t=this.map[e];return delete this.map[e],t},mxDictionary.prototype.getKeys=function(){var e,t=[];for(e in this.map)t.push(e);return t},mxDictionary.prototype.getValues=function(){var e,t=[];for(e in this.map)t.push(this.map[e]);return t},mxDictionary.prototype.visit=function(e){for(var t in this.map)e(t,this.map[t])};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,t){return mxResources.loadDefaultBundle||!mxResources.isLanguageSupported(t)?e+mxResources.extension:null},getSpecialBundle:function(e,t){if(null==mxClient.languages||!this.isLanguageSupported(t)){var n=t.indexOf("-");0<n&&(t=t.substring(0,n))}return mxResources.loadSpecialBundle&&mxResources.isLanguageSupported(t)&&t!=mxClient.defaultLanguage?e+"_"+t+mxResources.extension:null},add:function(e,t){if((t=null!=t?t:mxClient.language.toLowerCase())!=mxConstants.NONE){var n=mxResources.getDefaultBundle(e,t);if(null!=n)try{var a=mxUtils.load(n);a.isReady()&&mxResources.parse(a.getText())}catch(e){}if(null!=(n=mxResources.getSpecialBundle(e,t)))try{(a=mxUtils.load(n)).isReady()&&mxResources.parse(a.getText())}catch(e){}}},parse:function(e){if(null!=e){e=e.split("\n");for(var t=0;t<e.length;t++)if("#"!=e[t].charAt(0)){var n=e[t].indexOf("=");if(0<n){var a=e[t].substring(0,n),i=e[t].length;13==e[t].charCodeAt(i-1)&&i--,n=e[t].substring(n+1,i),this.resourcesEncoded?(n=n.replace(/\\(?=u[a-fA-F\d]{4})/g,"%"),mxResources.resources[a]=unescape(n)):mxResources.resources[a]=n}}}},get:function(e,t,n){if(null==(e=mxResources.resources[e])&&(e=n),null!=e&&null!=t){n=[];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<t.length&&n.push(t[a]),a=null):null!=a?a+=s:n.push(s)}e=n.join("")}return e}};function mxPoint(e,t){this.x=null!=e?e:0,this.y=null!=t?t:0}function mxRectangle(e,t,n,a){mxPoint.call(this,e,t),this.width=null!=n?n: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,t,n,a){this.x=e,this.y=t,this.width=n,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 t=Math.min(this.x,e.x),n=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=t,this.y=n,this.width=a-t,this.height=e-n}},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,t=0;t<d.length;t++){var n=d[t];if(n instanceof mxGeometryChange||n instanceof mxTerminalChange||n instanceof mxValueChange||n instanceof mxChildChange||n instanceof mxStyleChange){var a=l.getView().getState(n.cell||n.child,!1);if(null!=a)if(e=!0,n.constructor!=mxGeometryChange||l.model.isEdge(n.cell))mxUtils.setOpacity(a.shape.node,100*m/10);else{var i=l.getView().scale,s=(n.geometry.x-n.previous.x)*i,o=(n.geometry.y-n.previous.y)*i,r=(n.geometry.width-n.previous.width)*i;i=(n.geometry.height-n.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,n.cell,100*m/10)}}}m<10&&e?(m++,window.setTimeout(u,p)):null!=c&&c()},p=30;u()},cascadeOpacity:function(e,t,n){for(var a=e.model.getChildCount(t),i=0;i<a;i++){var s=e.model.getChildAt(t,i),o=e.getView().getState(s);null!=o&&(mxUtils.setOpacity(o.shape.node,n),mxEffects.cascadeOpacity(e,s,n))}if(null!=(t=e.model.getEdges(t)))for(i=0;i<t.length;i++)null!=(a=e.getView().getState(t[i]))&&mxUtils.setOpacity(a.shape.node,n)},fadeOut:function(e,t,n,a,i,s){a=a||40,i=i||30;var o=t||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",n&&e.parentNode&&e.parentNode.removeChild(e))};window.setTimeout(r,i)}else e.style.visibility="hidden",n&&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 t=e.length,n=0;n<t;n+=1)mxUtils.removeCursors(e[n])},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,t){return function(){return t.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,t,n){var a=e.getAttribute(t);if(null!=a&&a==n)return e;for(e=e.firstChild;null!=e;){if(null!=(a=mxUtils.findNode(e,t,n)))return a;e=e.nextSibling}return null},findNodeByAttribute:9<=document.documentMode?function(e,t,n){var a=null;if(null!=e)if(e.nodeType==mxConstants.NODETYPE_ELEMENT&&e.getAttribute(t)==n)a=e;else for(e=e.firstChild;null!=e&&null==a;)a=mxUtils.findNodeByAttribute(e,t,n),e=e.nextSibling;return a}:mxClient.IS_IE?function(e,t,n){return null==e?null:e.ownerDocument.selectSingleNode("//*[@"+t+"='"+n+"']")}:function(e,t,n){return null==e?null:e.ownerDocument.evaluate("//*[@"+t+"='"+n+"']",e.ownerDocument,null,XPathResult.ANY_TYPE,null).iterateNext()},getFunctionName:function(e){var t=null;if(null!=e)if(null!=e.name)t=e.name;else{for(e=e.toString(),t=9;" "==e.charAt(t);)t++;var n=e.indexOf("(",t);t=e.substring(t,n)}return t},indexOf:function(e,t){if(null!=e&&null!=t)for(var n=0;n<e.length;n++)if(e[n]==t)return n;return-1},remove:function(e,t){var n=null;if("object"==typeof t)for(var a=mxUtils.indexOf(t,e);0<=a;)t.splice(a,1),n=e,a=mxUtils.indexOf(t,e);for(var i in t)t[i]==e&&(delete t[i],n=e);return n},isNode:function(e,t,n,a){return!(null==e||isNaN(e.nodeType)||null!=t&&e.nodeName.toLowerCase()!=t.toLowerCase())&&(null==n||e.getAttribute(n)==a)},getChildNodes:function(e,t){t=t||mxConstants.NODETYPE_ELEMENT;for(var n=[],a=e.firstChild;null!=a;)a.nodeType==t&&n.push(a),a=a.nextSibling;return n},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 t=mxUtils.createXmlDocument();return t.async="false",t.loadXML(e),t}: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,t,n){var a=[];if(null!=e)if(t=t||"  ",n=n||"",e.nodeType==mxConstants.NODETYPE_TEXT)a.push(e.nodeValue);else{a.push(n+"<"+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,t,n+t)),i=i.nextSibling;a.push(n+"</"+e.nodeName+">\n")}else a.push("/>\n")}return a.join("")},removeWhitespace:function(e,t){for(var n=t?e.previousSibling:e.nextSibling;null!=n&&n.nodeType==mxConstants.NODETYPE_TEXT;){var a=t?n.previousSibling:n.nextSibling,i=mxUtils.getTextContent(n);0==mxUtils.trim(i).length&&n.parentNode.removeChild(n),n=a}},htmlEntities:function(e,t){return e=(e=(e=(e=(e=(e||"").replace(/&/g,"&amp;")).replace(/"/g,"&quot;")).replace(/\'/g,"&#39;")).replace(/</g,"&lt;")).replace(/>/g,"&gt;"),(null==t||t)&&(e=e.replace(/\n/g,"&#xa;")),e},isVml:function(e){return null!=e&&"urn:schemas-microsoft-com:vml"==e.tagUrn},getXml:function(e,t){var n="";return null!=e&&(n=null==(n=e.xml)?e.innerHTML?e.innerHTML:(new XMLSerializer).serializeToString(e):n.replace(/\r\n\t[\t]*/g,"").replace(/>\r\n/g,">").replace(/\r\n/g,"\n")),n.replace(/\n/g,t||"&#xa;")},getTextContent:function(e){var t="";return null!=e&&(null!=e.firstChild&&(e=e.firstChild),t=e.nodeValue||""),t},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 t=[];t.push("<"+e.nodeName);var n=e.attributes;if(null!=n)for(var a=0;a<n.length;a++){var i=n[a].nodeValue;null!=i&&0<i.length&&(t.push(" "),t.push(n[a].nodeName),t.push('="'),t.push(i),t.push('"'))}return 0==e.innerHTML.length?t.push("/>"):(t.push(">"),t.push(e.innerHTML),t.push("</"+e.nodeName+">")),t.join("")}:function(e){return null!=e?(new XMLSerializer).serializeToString(e):""},write:function(e,t){var n=e.ownerDocument.createTextNode(t);return null!=e&&e.appendChild(n),n},writeln:function(e,t){var n=e.ownerDocument.createTextNode(t);return null!=e&&(e.appendChild(n),e.appendChild(document.createElement("br"))),n},br:function(e,t){t=t||1;for(var n=null,a=0;a<t;a++)null!=e&&(n=e.ownerDocument.createElement("br"),e.appendChild(n));return n},button:function(e,t,n){return n=(n=null!=n?n:document).createElement("button"),mxUtils.write(n,e),mxEvent.addListener(n,"click",function(e){t(e)}),n},para:function(e,t){var n=document.createElement("p");return mxUtils.write(n,t),null!=e&&e.appendChild(n),n},addTransparentBackgroundFilter:function(e){e.style.filter+="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+mxClient.imageBasePath+"/transparent.gif', sizingMethod='scale')"},linkAction:function(e,t,n,a,i){return mxUtils.link(e,t,function(){n.execute(a)},i)},linkInvoke:function(e,t,n,a,i,s){return mxUtils.link(e,t,function(){n[a](i)},s)},link:function(e,t,n,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",n),mxUtils.write(i,t),null!=e&&e.appendChild(i),i},fit:function(e){var t=parseInt(e.offsetLeft),n=parseInt(e.offsetWidth),a=document.body,i=document.documentElement,s=(a.scrollLeft||i.scrollLeft)+(a.clientWidth||i.clientWidth);s<t+n&&(e.style.left=Math.max(a.scrollLeft||i.scrollLeft,s-n)+"px"),t=parseInt(e.offsetTop),n=parseInt(e.offsetHeight),(s=(a.scrollTop||i.scrollTop)+Math.max(a.clientHeight||0,i.clientHeight))<t+n&&(e.style.top=Math.max(a.scrollTop||i.scrollTop,s-n)+"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 t=Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);return t.initWithPath(e),t.exists()?((e=Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream)).init(t,1,4,null),(t=Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance(Components.interfaces.nsIScriptableInputStream)).init(e),t.read(t.available())):(mxUtils.alert("File not found."),"")}return e=(t=new ActiveXObject("Scripting.FileSystemObject").OpenTextFile(e,1)).readAll(),t.close(),e},save:function(e,t){if(mxClient.IS_NS){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")}catch(e){return void mxUtils.alert("Permission to write file denied.")}var n=Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);n.initWithPath(e),n.exists()||n.create(0,420);var a=Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);a.init(n,34,4,null),a.write(t,t.length),a.flush(),a.close()}else(n=new ActiveXObject("Scripting.FileSystemObject").CreateTextFile(e,!0)).Write(t),n.Close()},saveAs:function(e){var t=document.createElement("iframe");t.setAttribute("src",""),t.style.visibility="hidden",document.body.appendChild(t);try{if(mxClient.IS_NS){var n=t.contentDocument;n.open(),n.write(e),n.close();try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"),t.focus(),saveDocument(n)}catch(e){mxUtils.alert("Permission to save document denied.")}}else(n=t.contentWindow.document).write(e),n.execCommand("SaveAs",!1,document.location)}finally{document.body.removeChild(t)}},copy:function(e){if(window.clipboardData)window.clipboardData.setData("Text",e);else{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");var t=Components.classes["@mozilla.org/widget/clipboard;1"].createInstance(Components.interfaces.nsIClipboard);if(t){var n=Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);if(n){n.addDataFlavor("text/unicode");var a=Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);a.data=e,n.setTransferData("text/unicode",a,2*e.length),t.setData(n,null,Components.interfaces.nsIClipboard.kGlobalClipboard)}}}},load:function(e){return(e=new mxXmlRequest(e,null,"GET",!1)).send(),e},get:function(e,t,n){return new mxXmlRequest(e,null,"GET").send(t,n)},post:function(e,t,n,a){return new mxXmlRequest(e,t).send(n,a)},submit:function(e,t,n,a){return new mxXmlRequest(e,t).simulate(n,a)},loadInto:function(e,t,n){mxClient.IS_IE?t.onreadystatechange=function(){4==t.readyState&&n()}:t.addEventListener("load",n,!1),t.load(e)},getValue:function(e,t,n){return null==(e=null!=e?e[t]:null)&&(e=n),e},getNumber:function(e,t,n){return null==(e=null!=e?e[t]:null)&&(e=n||0),Number(e)},getColor:function(e,t,n){return null==(e=null!=e?e[t]:null)?e=n:e==mxConstants.NONE&&(e=null),e},clone:function(e,t,n){n=null!=n&&n;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==t||mxUtils.indexOf(t,i)<0)&&(a[i]=n||"object"!=typeof e[i]?e[i]:mxUtils.clone(e[i]))}return a},equalPoints:function(e,t){if(null==e&&null!=t||null!=e&&null==t||null!=e&&null!=t&&e.length!=t.length)return!1;if(null!=e&&null!=t)for(var n=0;n<e.length;n++)if(e[n]==t[n]||null!=e[n]&&!e[n].equals(t[n]))return!1;return!0},equalEntries:function(e,t){if(null==e&&null!=t||null!=e&&null==t||null!=e&&null!=t&&e.length!=t.length)return!1;if(null!=e&&null!=t)for(var n in e)if(e[n]!=t[n])return!1;return!0},extend:function(e,t){var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e},toString:function(e){var t,n="";for(t in e)try{if(null==e[t])n+=t+" = [null]\n";else if("function"==typeof e[t])n+=t+" => [Function]\n";else if("object"==typeof e[t])n=n+(t+" => [")+mxUtils.getFunctionName(e[t].constructor)+"]\n";else n+=t+" = "+e[t]+"\n"}catch(e){n+=t+"="+e.message}return n},toRadians:function(e){return Math.PI*e/180},arcToCurves:function(e,t,n,a,i,s,o,r,l){if(r-=e,l-=t,0===n||0===a)return h;n=Math.abs(n),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=n*n)+(p=d*d)/(E=a*a))?(n*=Math.sqrt(v),a*=Math.sqrt(v),0):(v=1,s===o&&(v=-1),v*Math.sqrt((g*E-g*p-E*c)/(g*p+E*c))))*n*d/a)-h*(p=-1*s*a*i/n)+r/2,l=h*c+m*p+l/2,s=0<=(g=Math.atan2((d-p)/a,(i-c)/n)-Math.atan2(0,1))?g:2*Math.PI+g,i=0<=(g=Math.atan2((-d-p)/a,(-i-c)/n)-Math.atan2((d-p)/a,(i-c)/n))?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*n,m*=a,n*=h,a*=h;for(var u=Math.cos(s),p=-d*(c*(b=Math.sin(s))+a*u),g=-d*(n*b-m*u),v=E=0,h=[],f=0;f<o;++f){s+=i;var b,E=c*(u=Math.cos(s))-a*(b=Math.sin(s))+r,A=(v=n*u+m*b+l,-d*(c*b+a*u));u=-d*(n*b-m*u);h[b=6*f]=Number(p+e),h[b+1]=Number(g+t),h[b+2]=Number(E-A+e),h[b+3]=Number(v-u+t),h[b+4]=Number(E+e),h[b+5]=Number(v+t),p=E+A,g=v+u}return h},getBoundingBox:function(e,t){var n=null;if(null!=e&&null!=t&&0!=t){var a=mxUtils.toRadians(t),i=(n=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,n,i,s),a=mxUtils.getRotatedPoint(a,n,i,s),r=mxUtils.getRotatedPoint(r,n,i,s),l=mxUtils.getRotatedPoint(l,n,i,s);(n=new mxRectangle(o.x,o.y,0,0)).add(new mxRectangle(a.x,a.y,0,0)),n.add(new mxRectangle(r.x,r.y,0,0)),n.add(new mxRectangle(l.x,l.y,0,0))}return n},getRotatedPoint:function(e,t,n,a){a=null!=a?a:new mxPoint;var i=e.x-a.x;return new mxPoint(i*t-(e=e.y-a.y)*n+a.x,e*t+i*n+a.y)},getPortConstraints:function(e,t,n,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,t,n){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,t,n);(null==s||i<s)&&(s=i,a=o-1),i=r}return a},rectangleIntersectsSegment:function(e,t,n){var a=e.y,i=e.x,s=a+e.height,o=i+e.width;e=t.x;var r=n.x;if(t.x>n.x&&(e=n.x,r=t.x),o<r&&(r=o),e<i&&(e=i),r<e)return!1;i=t.y,o=n.y;var l=n.x-t.x;return 1e-7<Math.abs(l)&&(i=(n=(n.y-t.y)/l)*e+(t=t.y-n*t.x),o=n*r+t),o<i&&(t=o,o=i,i=t),s<o&&(o=s),i<a&&(i=a),!(o<i)},contains:function(e,t,n){return e.x<=t&&e.x+e.width>=t&&e.y<=n&&e.y+e.height>=n},intersects:function(e,t){var n=e.width,a=e.height,i=t.width,s=t.height;if(i<=0||s<=0||n<=0||a<=0)return!1;var o=e.x,r=e.y,l=t.x,d=t.y;s+=d,n+=o,a+=r;return((i=i+l)<l||o<i)&&(s<d||r<s)&&(n<o||l<n)&&(a<r||d<a)},intersectsHotspot:function(e,t,n,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()),t=(e=mxUtils.getRotatedPoint(new mxPoint(t,n),i,s,o)).x,n=e.y),mxUtils.contains(a,t,n)}return!0},getOffset:function(e,t){var n=0,a=0;if(null!=t&&t){var i=document.body,s=document.documentElement;n=n+(i.scrollLeft||s.scrollLeft),a=a+(i.scrollTop||s.scrollTop)}for(;e.offsetParent;)n+=e.offsetLeft,a+=e.offsetTop,e=e.offsetParent;return new mxPoint(n,a)},getScrollOrigin:function(e){for(var t=document.body,n=document.documentElement,a=new mxPoint(t.scrollLeft||n.scrollLeft,t.scrollTop||n.scrollTop);null!=e&&e!=t&&e!=n;)!isNaN(e.scrollLeft)&&!isNaN(e.scrollTop)&&(a.x+=e.scrollLeft,a.y+=e.scrollTop),e=e.parentNode;return a},convertPoint:function(e,t,n){var a=mxUtils.getScrollOrigin(e);return(e=mxUtils.getOffset(e)).x-=a.x,e.y-=a.y,new mxPoint(t-e.x,n-e.y)},ltrim:function(e,t){return e.replace(RegExp("^["+(t||"\\s")+"]+","g"),"")},rtrim:function(e,t){return e.replace(RegExp("["+(t||"\\s")+"]+$","g"),"")},trim:function(e,t){return mxUtils.ltrim(mxUtils.rtrim(e,t),t)},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,t){return(e%t+t)%t},intersection:function(e,t,n,a,i,s,o,r){var l=(r-s)*(n-e)-(o-i)*(a-t);return o=((o-i)*(t-s)-(r-s)*(e-i))/l,i=((n-e)*(t-s)-(a-t)*(e-i))/l,0<=o&&o<=1&&0<=i&&i<=1?new mxPoint(e+o*(n-e),t+o*(a-t)):null},ptSegDistSq:function(e,t,n,a,i,s){return n=(i-=e)*(n-=e)+(s-=t)*(a-=t)<=0?0:(e=(i=n-i)*n+(s=a-s)*a)<=0?0:e*e/(n*n+a*a),(i=i*i+s*s-n)<0&&(i=0),i},relativeCcw:function(e,t,n,a,i,s){return 0==(e=(i-=e)*(a-=t)-(s-=t)*(n-=e))&&(0<(e=i*n+s*a)&&((e=(i-n)*n+(s-a)*a)<0&&(e=0))),e<0?-1:0<e?1:0},animateChanges:function(e,t){mxEffects.animateChanges.apply(this,arguments)},cascadeOpacity:function(e,t,n){mxEffects.cascadeOpacity.apply(this,arguments)},fadeOut:function(e,t,n,a,i,s){mxEffects.fadeOut.apply(this,arguments)},setOpacity:function(e,t){mxUtils.isVml(e)?e.style.filter=100<=t?null:"alpha(opacity="+t/5+")":mxClient.IS_IE&&(void 0===document.documentMode||document.documentMode<9)?e.style.filter=100<=t?null:"alpha(opacity="+t+")":e.style.opacity=t/100},createImage:function(e){var t=null;return mxClient.IS_IE6&&"CSS1Compat"!=document.compatMode?((t=document.createElement(mxClient.VML_PREFIX+":image")).setAttribute("src",e),t.style.borderStyle="none"):((t=document.createElement("img")).setAttribute("src",e),t.setAttribute("border","0")),t},sortCells:function(e,i){i=null==i||i;var s=new mxDictionary;return e.sort(function(e,t){var n=s.get(e);null==n&&(n=mxCellPath.create(e).split(mxCellPath.PATH_SEPARATOR),s.put(e,n));var a=s.get(t);return null==a&&(a=mxCellPath.create(t).split(mxCellPath.PATH_SEPARATOR),s.put(t,a)),0==(n=mxCellPath.compare(n,a))?0:0<n==i?1:-1}),e},getStylename:function(e){return null!=e&&(e=e.split(";")[0]).indexOf("=")<0?e:""},getStylenames:function(e){var t=[];if(null!=e){e=e.split(";");for(var n=0;n<e.length;n++)e[n].indexOf("=")<0&&t.push(e[n])}return t},indexOfStylename:function(e,t){if(null!=e&&null!=t)for(var n=e.split(";"),a=0,i=0;i<n.length;i++){if(n[i]==t)return a;a+=n[i].length+1}return-1},addStylename:function(e,t){return mxUtils.indexOfStylename(e,t)<0&&(null==e?e="":0<e.length&&";"!=e.charAt(e.length-1)&&(e+=";"),e+=t),e},removeStylename:function(e,t){var n=[];if(null!=e)for(var a=e.split(";"),i=0;i<a.length;i++)a[i]!=t&&n.push(a[i]);return n.join(";")},removeAllStylenames:function(e){var t=[];if(null!=e){e=e.split(";");for(var n=0;n<e.length;n++)0<=e[n].indexOf("=")&&t.push(e[n])}return t.join(";")},setCellStyles:function(e,t,n,a){if(null!=t&&0<t.length){e.beginUpdate();try{for(var i=0;i<t.length;i++)if(null!=t[i]){var s=mxUtils.setStyle(e.getStyle(t[i]),n,a);e.setStyle(t[i],s)}}finally{e.endUpdate()}}},setStyle:function(e,t,n){var a=null!=n&&(void 0===n.length||0<n.length);if(null==e||0==e.length)a&&(e=t+"="+n);else{var i=e.indexOf(t+"=");i<0?a&&(a=";"==e.charAt(e.length-1)?"":";",e=e+a+t+"="+n):(t=a?t+"="+n:"",n=e.indexOf(";",i),a||n++,e=e.substring(0,i)+t+(i<n?e.substring(n):""))}return e},setCellStyleFlags:function(e,t,n,a,i){if(null!=t&&0<t.length){e.beginUpdate();try{for(var s=0;s<t.length;s++)if(null!=t[s]){var o=mxUtils.setStyleFlag(e.getStyle(t[s]),n,a,i);e.setStyle(t[s],o)}}finally{e.endUpdate()}}},setStyleFlag:function(e,t,n,a){if(null==e||0==e.length)e=a||null==a?t+"="+n:t+"=0";else{var i=e.indexOf(t+"=");if(i<0)i=";"==e.charAt(e.length-1)?"":";",e=a||null==a?e+i+t+"="+n:e+i+t+"=0";else{var s=e.indexOf(";",i),o="";o=s<0?e.substring(i+t.length+1):e.substring(i+t.length+1,s),o=null==a?parseInt(o)^n:a?parseInt(o)|n:parseInt(o)&~n;e=e.substring(0,i)+t+"="+o+(0<=s?e.substring(s):"")}}return e},getAlignmentAsPoint:function(e,t){var n=0,a=0;return e==mxConstants.ALIGN_CENTER?n=-.5:e==mxConstants.ALIGN_RIGHT&&(n=-1),t==mxConstants.ALIGN_MIDDLE?a=-.5:t==mxConstants.ALIGN_BOTTOM&&(a=-1),new mxPoint(n,a)},getSizeForString:function(e,t,n){t=null!=t?t:mxConstants.DEFAULT_FONTSIZE,n=null!=n?n:mxConstants.DEFAULT_FONTFAMILY;var a=document.createElement("div");return a.style.fontFamily=n,a.style.fontSize=Math.round(t)+"px",a.style.lineHeight=Math.round(t*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,t,n,a,i){a=null!=a?a:0,i=null!=i?i:0,t=null!=t?t:1,null==n&&(n=[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),t=new mxTemporaryCellStates(e.getView(),t,n);try{o=(new mxCodec).encode(e.getView())}finally{t.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,t,n,a){if(e<1)return 1;a=null!=a?a:0;var i=(n=null!=n?n:mxConstants.PAGE_FORMAT_A4_PORTRAIT).width-2*a;n=n.height-2*a,a=t.getGraphBounds().clone(),t=t.getView().getScale(),a.width/=t,a.height/=t,n=(t=a.width)/a.height/(i/n),a=Math.sqrt(e);var s=Math.sqrt(n);if(n=a*s,a/=s,n<1&&e<a){var o=a/e;a=e,n/=o}for(a<1&&e<n&&(o=n/e,n=e,a/=o),o=Math.ceil(n)*Math.ceil(a),s=0;e<o;){o=Math.floor(n)/n;var r=Math.floor(a)/a;if(1==o&&(o=Math.floor(n-1)/n),1==r&&(r=Math.floor(a-1)/a),n*=o=r<o?o:r,a*=o,o=Math.ceil(n)*Math.ceil(a),10<++s)break}return i*n/t*.99999},show:function(e,t,n,a){if(n=null!=n?n:0,a=null!=a?a:0,null==t?t=window.open().document:t.open(),n=-(i=e.getGraphBounds()).x+n,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>",t.writeln(i),t.close(),null!=(e=t.body.getElementsByTagName("DIV")[0])&&(e.style.position="absolute",e.style.left=n+"px",e.style.top=a+"px")}else{for(t.writeln("<html"),t.writeln("<head>"),s=document.getElementsByTagName("base"),o=0;o<s.length;o++)t.writeln(mxUtils.getOuterHtml(s[o]));for(s=document.getElementsByTagName("link"),o=0;o<s.length;o++)t.writeln(mxUtils.getOuterHtml(s[o]));for(s=document.getElementsByTagName("style"),o=0;o<s.length;o++)t.writeln(mxUtils.getOuterHtml(s[o]));for(t.writeln("</head>"),t.writeln("</html>"),t.close(),null==t.body&&t.documentElement.appendChild(t.createElement("body")),t.body.style.overflow="auto",e=e.container.firstChild;null!=e;)o=e.cloneNode(!0),t.body.appendChild(o),e=e.nextSibling;null!=(e=t.getElementsByTagName("g")[0])&&(e.setAttribute("transform","translate("+n+","+a+")"),(n=e.ownerSVGElement).setAttribute("width",i.width+Math.max(i.x,0)+3),n.setAttribute("height",i.height+Math.max(i.y,0)+3))}return mxUtils.removeCursors(t.body),t},printScreen:function(e){var t=window.open();mxUtils.show(e,t.document),e=function(){t.focus(),t.print(),t.close()},mxClient.IS_GC?t.setTimeout(e,500):e()},popup:function(e,t){if(t){var n=document.createElement("div");n.style.overflow="scroll",n.style.width="636px",n.style.height="460px";var a=document.createElement("pre");a.innerHTML=mxUtils.htmlEntities(e,!1).replace(/\n/g,"<br>").replace(/ /g,"&nbsp;"),n.appendChild(a),(n=new mxWindow("Popup Window",n,document.body.clientWidth/2-320,(document.body.clientHeight||document.documentElement.clientHeight)/2-240,640,480,!1,!0)).setClosable(!0),n.setVisible(!0)}else mxClient.IS_NS?((n=window.open()).document.writeln("<pre>"+mxUtils.htmlEntities(e)+"</pre"),n.document.close()):((a=(n=window.open()).document.createElement("pre")).innerHTML=mxUtils.htmlEntities(e,!1).replace(/\n/g,"<br>").replace(/ /g,"&nbsp;"),n.document.body.appendChild(a))},alert:function(e){alert(e)},prompt:function(e,t){return prompt(e,t)},confirm:function(e){return confirm(e)},error:function(e,t,n,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-t)/2,a/4,t,null,!1,!0);return n&&(mxUtils.br(i),t=document.createElement("p"),n=document.createElement("button"),mxClient.IS_IE?n.style.cssText="float:right":n.setAttribute("style","float:right"),mxEvent.addListener(n,"click",function(e){o.destroy()}),mxUtils.write(n,mxResources.get(mxUtils.closeResource)||mxUtils.closeResource),t.appendChild(n),i.appendChild(t),mxUtils.br(i),o.setClosable(!0)),o.setVisible(!0),o},makeDraggable:function(e,t,n,i,a,s,o,r,l,d){return(e=new mxDragSource(e,n)).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 t?t(e):t},null!=i&&(e.createDragElement=function(){return i.cloneNode(!0)},r&&(e.createPreviewElement=function(e){var t=i.cloneNode(!0),n=parseInt(t.style.width),a=parseInt(t.style.height);return t.style.width=Math.round(n*e.view.scale)+"px",t.style.height=Math.round(a*e.view.scale)+"px",t})),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 t=1;t<arguments.length;t+=2)null!=arguments[t+1]&&(this.properties[arguments[t]]=arguments[t+1])}function mxMouseEvent(e,t){this.evt=e,this.state=t}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 t=this.getSource();null!=t;){if(t==e.node)return!0;t=t.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,t){null==this.eventListeners&&(this.eventListeners=[]),this.eventListeners.push(e),this.eventListeners.push(t)},mxEventSource.prototype.removeListener=function(e){if(null!=this.eventListeners)for(var t=0;t<this.eventListeners.length;)this.eventListeners[t+1]==e?this.eventListeners.splice(t,2):t+=2},mxEventSource.prototype.fireEvent=function(e,t){if(null!=this.eventListeners&&this.isEventsEnabled()){null==e&&(e=new mxEventObject),null==t&&(t=this.getEventSource()),null==t&&(t=this);for(var n=[t,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,n)}}};var mxEvent={objects:[],addListener:function(){var a=function(e,t,n){null==e.mxListenerList&&(e.mxListenerList=[],mxEvent.objects.push(e)),e.mxListenerList.push({name:t,f:n})};return window.addEventListener?function(e,t,n){e.addEventListener(t,n,!1),a(e,t,n)}:function(e,t,n){e.attachEvent("on"+t,n),a(e,t,n)}}(),removeListener:function(){var a=function(e,t,n){if(null!=e.mxListenerList){t=e.mxListenerList.length;for(var a=0;a<t;a++)if(e.mxListenerList[a].f==n){e.mxListenerList.splice(a,1);break}0==e.mxListenerList.length&&(e.mxListenerList=null)}};return window.removeEventListener?function(e,t,n){e.removeEventListener(t,n,!1),a(e,t,n)}:function(e,t,n){e.detachEvent("on"+t,n),a(e,t,n)}}(),removeAllListeners:function(e){var t=e.mxListenerList;if(null!=t)for(;0<t.length;){var n=t[0];mxEvent.removeListener(e,n.name,n.f)}},addGestureListeners:function(e,t,n,a){null!=t&&mxEvent.addListener(e,"mousedown",t),null!=n&&mxEvent.addListener(e,"mousemove",n),null!=a&&mxEvent.addListener(e,"mouseup",a),mxClient.IS_TOUCH&&(null!=t&&mxEvent.addListener(e,"touchstart",t),null!=n&&mxEvent.addListener(e,"touchmove",n),null!=a&&mxEvent.addListener(e,"touchend",a))},removeGestureListeners:function(e,t,n,a){null!=t&&mxEvent.removeListener(e,"mousedown",t),null!=n&&mxEvent.removeListener(e,"mousemove",n),null!=a&&mxEvent.removeListener(e,"mouseup",a),mxClient.IS_TOUCH&&(null!=t&&mxEvent.removeListener(e,"touchstart",t),null!=n&&mxEvent.removeListener(e,"touchmove",n),null!=a&&mxEvent.removeListener(e,"touchend",a))},redirectMouseEvents:function(e,n,t,a,i,s,o){var r=function(e){return"function"==typeof t?t(e):t};mxEvent.addGestureListeners(e,function(e){null!=a?a(e):mxEvent.isConsumed(e)||n.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,r(e)))},function(e){null!=i?i(e):mxEvent.isConsumed(e)||n.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,r(e)))},function(e){null!=s?s(e):mxEvent.isConsumed(e)||n.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 t=r(e);n.dblClick(e,null!=t?t.cell:null)}})},release:function(e){if(null!=e&&(mxEvent.removeAllListeners(e),null!=(e=e.childNodes)))for(var t=e.length,n=0;n<t;n+=1)mxEvent.release(e[n])},addMouseWheelListener:function(n){if(null!=n){var e=function(e){null==e&&(e=window.event);var t=0;0!=(t=!mxClient.IS_NS||mxClient.IS_SF||mxClient.IS_GC?e.wheelDelta/120:-e.detail/2)&&n(e,0<t)};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,t,n){n=null==n||n,(null==t||t)&&(e.preventDefault?(n&&e.stopPropagation(),e.preventDefault()):n&&(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,t,n,a,i,s){this.url=e,this.params=t,this.method=n||"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,t){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,t){null!=t&&e.setRequestHeader("Content-Type","application/x-www-form-urlencoded")},mxXmlRequest.prototype.simulate=function(e,t){var n=null;(e=e||document)==document&&(n=window.onbeforeunload,window.onbeforeunload=null);var a=e.createElement("form");a.setAttribute("method",this.method),a.setAttribute("action",this.url),null!=t&&a.setAttribute("target",t),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!=n&&(window.onbeforeunload=n)};var mxClipboard={STEPSIZE:10,insertCount:1,cells:null,isEmpty:function(){return null==mxClipboard.cells},cut:function(e,t){return t=mxClipboard.copy(e,t),mxClipboard.insertCount=0,mxClipboard.removeCells(e,t),t},removeCells:function(e,t){e.removeCells(t)},copy:function(e,t){t=t||e.getSelectionCells();var n=e.getExportableCells(t);return mxClipboard.insertCount=1,mxClipboard.cells=e.cloneCells(n),n},paste:function(e){if(null!=mxClipboard.cells){var t=e.getImportableCells(mxClipboard.cells),n=mxClipboard.insertCount*mxClipboard.STEPSIZE,a=e.getDefaultParent();t=e.importCells(t,n,n,a);mxClipboard.insertCount++,e.setSelectionCells(t)}}};function mxWindow(e,t,n,a,i,s,o,r,l,d){null!=t&&(o=null==o||o,this.content=t,this.init(n,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,t,n){this.src=e,this.width=t,this.height=n}function mxDivResizer(e,t){if("div"==e.nodeName.toLowerCase()){null==t&&(t=window),this.div=e;var n=mxUtils.getCurrentStyle(e);null!=n&&(this.resizeWidth="auto"==n.width,this.resizeHeight="auto"==n.height),mxEvent.addListener(t,"resize",mxUtils.bind(this,function(e){this.handlingResize||(this.handlingResize=!0,this.resize(),this.handlingResize=!1)})),this.resize()}}function mxDragSource(e,t){this.element=e,this.dropHandler=t,mxEvent.addGestureListeners(e,mxUtils.bind(this,this.mouseDown))}function mxToolbar(e){this.container=e}function mxSession(t,e,n,a){this.model=t,this.urlInit=e,this.urlPoll=n,this.urlNotify=a,null!=t&&(this.codec=new mxCodec,this.codec.lookup=function(e){return t.getCell(e)}),t.addListener(mxEvent.NOTIFY,mxUtils.bind(this,function(e,t){var n=t.getProperty("edit");(null!=n&&this.debug||this.connected&&!this.suspended)&&this.notify("<edit>"+this.encodeChanges(n.changes,n.undone)+"</edit>")}))}function mxUndoableEdit(e,t){this.source=e,this.changes=[],this.significant=null==t||t}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,t,n,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=t+"px",this.table=document.createElement("table"),this.table.className=i,null!=n&&(mxClient.IS_IE||(this.div.style.width=n+"px"),this.table.style.width=n+"px"),null!=a&&(mxClient.IS_IE||(this.div.style.height=a+"px"),this.table.style.height=a+"px"),e=document.createElement("tbody"),t=document.createElement("tr"),this.title=document.createElement("td"),this.title.className=i+"Title",t.appendChild(this.title),e.appendChild(t),t=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),t.appendChild(this.td),e.appendChild(t),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 t=this.title.firstChild;null!=t;){var n=t.nextSibling;t.nodeType==mxConstants.NODETYPE_TEXT&&t.parentNode.removeChild(t),t=n}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 t=mxWindow.activeWindow.getElement();null!=t&&null!=t.style&&(t.style.zIndex=e)}t=mxWindow.activeWindow,this.getElement().style.zIndex=parseInt(e)+1,(mxWindow.activeWindow=this).fireEvent(new mxEventObject(mxEvent.ACTIVATE,"previousWindow",t))}},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,t=mxUtils.bind(this,function(e){var t=mxEvent.getClientX(e)-a,n=mxEvent.getClientY(e)-i;this.setSize(s+t,o+n),this.fireEvent(new mxEventObject(mxEvent.RESIZE,"event",e)),mxEvent.consume(e)}),n=mxUtils.bind(this,function(e){mxEvent.removeGestureListeners(document,null,t,n),this.fireEvent(new mxEventObject(mxEvent.RESIZE_END,"event",e)),mxEvent.consume(e)});mxEvent.addGestureListeners(document,null,t,n),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,t){e=Math.max(this.minimumSize.width,e),t=Math.max(this.minimumSize.height,t),mxClient.IS_IE||(this.div.style.width=e+"px",this.div.style.height=t+"px"),this.table.style.width=e+"px",this.table.style.height=t+"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 n=!1,a=null,i=null,e=mxUtils.bind(this,function(e){if(this.activate(),n)n=!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{n=!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 t=this.getMinimumSize();0<t.height&&(mxClient.IS_IE||(this.div.style.height=t.height+"px"),this.table.style.height=t.height+"px"),0<t.width&&(mxClient.IS_IE||(this.div.style.width=t.width+"px"),this.table.style.width=t.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 n=!1,a=null,i=null,s=null,o=null,e=mxUtils.bind(this,function(e){if(this.activate(),"none"!=this.maximize.style.display){if(n)n=!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"!=(t=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(n=!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 t=mxUtils.getCurrentStyle(this.contentWrapper);"auto"!=t.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(),t=mxUtils.bind(this,function(e){var t=mxEvent.getClientX(e)-a,n=mxEvent.getClientY(e)-i;this.setLocation(s+t,o+n),this.fireEvent(new mxEventObject(mxEvent.MOVE,"event",e)),mxEvent.consume(e)}),n=mxUtils.bind(this,function(e){mxEvent.removeGestureListeners(document,null,t,n),this.fireEvent(new mxEventObject(mxEvent.MOVE_END,"event",e)),mxEvent.consume(e)});mxEvent.addGestureListeners(document,null,t,n),this.fireEvent(new mxEventObject(mxEvent.MOVE_START,"event",e)),mxEvent.consume(e)}))},mxWindow.prototype.setLocation=function(e,t){this.div.style.left=e+"px",this.div.style.top=t+"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,t){var n=document.createElement("tr"),a=document.createElement("td");n.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(){t()}),n.appendChild(a),this.body.appendChild(n)},mxForm.prototype.addText=function(e,t){var n=document.createElement("input");return n.setAttribute("type","text"),n.value=t,this.addField(e,n)},mxForm.prototype.addCheckbox=function(e,t){var n=document.createElement("input");return n.setAttribute("type","checkbox"),this.addField(e,n),t&&(n.checked=!0),n},mxForm.prototype.addTextarea=function(e,t,n){var a=document.createElement("textarea");return mxClient.IS_NS&&n--,a.setAttribute("rows",n||2),a.value=t,this.addField(e,a)},mxForm.prototype.addCombo=function(e,t,n){var a=document.createElement("select");return null!=n&&a.setAttribute("size",n),t&&a.setAttribute("multiple","true"),this.addField(e,a)},mxForm.prototype.addOption=function(e,t,n,a){var i=document.createElement("option");mxUtils.writeln(i,t),i.setAttribute("value",n),a&&i.setAttribute("selected",a),e.appendChild(i)},mxForm.prototype.addField=function(e,t){var n=document.createElement("tr"),a=document.createElement("td");return mxUtils.write(a,e),n.appendChild(a),(a=document.createElement("td")).appendChild(t),n.appendChild(a),this.body.appendChild(n),t},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(),t=this.getDocumentHeight(),n=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(n)&&!isNaN(a)&&0<=n&&0<=a&&0<e-a-n&&(this.div.style.width=e-a-n+"px"),this.resizeHeight&&!isNaN(i)&&!isNaN(s)&&0<=i&&0<=s&&0<t-i-s&&(this.div.style.height=t-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,t,n){return e.getCellAt(t,n)},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,t){var n=mxEvent.getClientX(t),a=mxEvent.getClientY(t),i=mxUtils.getOffset(e.container),s=mxUtils.getScrollOrigin();return n>=i.x-s.x&&a>=i.y-s.y&&n<=i.x-s.x+e.container.offsetWidth&&a<=i.y-s.y+e.container.offsetHeight},mxDragSource.prototype.mouseMove=function(e){if(null!=(t=this.getGraphForEvent(e))&&!this.graphContainsEvent(t,e)&&(t=null),t!=this.currentGraph&&(null!=this.currentGraph&&this.dragExit(this.currentGraph),this.currentGraph=t,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 t=mxEvent.getClientX(e),n=mxEvent.getClientY(e);null==this.dragElement.parentNode&&document.body.appendChild(this.dragElement),this.dragElement.style.visibility="visible",null!=this.dragOffset&&(t+=this.dragOffset.x,n+=this.dragOffset.y),t+=document.body.scrollLeft||document.documentElement.scrollLeft,n+=document.body.scrollTop||document.documentElement.scrollTop,this.dragElement.style.left=t+"px",this.dragElement.style.top=n+"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 t=this.currentGraph.view.scale,n=this.currentGraph.view.translate;this.drop(this.currentGraph,e,this.currentDropTarget,this.currentPoint.x/t-n.x,this.currentPoint.y/t-n.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,t){var n=mxUtils.getOffset(e.container),a=mxUtils.getScrollOrigin(e.container),i=mxEvent.getClientX(t)-n.x+a.x;n=mxEvent.getClientY(t)-n.y+a.y;if(e.autoScroll&&(null==this.autoscroll||this.autoscroll)&&e.scrollPointToVisible(i,n,e.autoExtend),null!=this.currentHighlight&&e.isDropEnabled()&&(this.currentDropTarget=this.getDropTarget(e,i,n),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(t);var s=!0;if(null!=this.currentGuide&&this.currentGuide.isEnabledForEvent(t))s=new mxRectangle(0,0,s=parseInt(this.previewElement.style.width),o=parseInt(this.previewElement.style.height)),n=new mxPoint(i,n),n=this.currentGuide.move(s,n,a),s=!1,i=n.x,n=n.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,n=(e.snap(n/a-o.y-r)+o.y)*a}null!=this.currentGuide&&s&&this.currentGuide.hide(),null!=this.previewOffset&&(i+=this.previewOffset.x,n+=this.previewOffset.y),this.previewElement.style.left=Math.round(i)+"px",this.previewElement.style.top=Math.round(n)+"px",this.previewElement.style.visibility="visible"}this.currentPoint=new mxPoint(i,n)},mxDragSource.prototype.drop=function(e,t,n,a,i){this.dropHandler(e,t,n,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,t,n,a,i,s){var o=document.createElement(null!=t?"img":"button"),r=i||(null!=s?"mxToolbarMode":"mxToolbarItem");return o.className=r,o.setAttribute("src",t),null!=e&&(null!=t?o.setAttribute("title",e):mxUtils.write(o,e)),this.container.appendChild(o),null!=n&&(mxEvent.addListener(o,"click",n),mxClient.IS_TOUCH&&mxEvent.addListener(o,"touchend",n)),e=mxUtils.bind(this,function(e){null!=a?o.setAttribute("src",t):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 t=this.currentImg;this.menu.isMenuShowing()&&this.menu.hideMenu(),t!=o&&(this.currentImg=o,this.menu.factoryMethod=s,t=new mxPoint(o.offsetLeft,o.offsetTop+o.offsetHeight),this.menu.popup(t.x,t.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 t=document.createElement("div");t.style.display="inline",t.className="mxToolbarComboContainer";var n=document.createElement("select");return n.className=e||"mxToolbarCombo",t.appendChild(n),this.container.appendChild(t),n},mxToolbar.prototype.addActionCombo=function(e,t){var n=document.createElement("select");return n.className=t||"mxToolbarCombo",this.addOption(n,e,null),mxEvent.addListener(n,"change",function(e){var t=n.options[n.selectedIndex];n.selectedIndex=0,null!=t.funct&&t.funct(e)}),this.container.appendChild(n),n},mxToolbar.prototype.addOption=function(e,t,n){var a=document.createElement("option");return mxUtils.writeln(a,t),"function"==typeof n?a.funct=n:a.setAttribute("value",n),e.appendChild(a),a},mxToolbar.prototype.addSwitchMode=function(e,t,n,a,i){var s=document.createElement("img");return s.initialClassName=i||"mxToolbarMode",s.className=s.initialClassName,s.setAttribute("src",t),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)),n()})),this.container.appendChild(s),null==this.defaultMode&&(this.defaultMode=s,this.selectMode(s),n()),s},mxToolbar.prototype.addMode=function(e,t,n,a,i,s){s=null==s||s;var o=document.createElement(null!=t?"img":"button");return o.initialClassName=i||"mxToolbarMode",o.className=o.initialClassName,o.setAttribute("src",t),o.altIcon=a,null!=e&&o.setAttribute("title",e),this.enabled&&s&&(mxEvent.addListener(o,"click",mxUtils.bind(this,function(e){this.selectMode(o,n),this.noReset=!1})),mxEvent.addListener(o,"dblclick",mxUtils.bind(this,function(e){this.selectMode(o,n),this.noReset=!0})),null==this.defaultMode&&(this.defaultMode=o,this.defaultFunction=n,this.selectMode(o,n))),this.container.appendChild(o),o},mxToolbar.prototype.selectMode=function(e,t){if(this.selectedMode!=e){if(null!=this.selectedMode){var n=this.selectedMode.altIcon;null!=n?(this.selectedMode.altIcon=this.selectedMode.getAttribute("src"),this.selectedMode.setAttribute("src",n)):this.selectedMode.className=this.selectedMode.initialClassName}this.selectedMode=e,null!=(n=this.selectedMode.altIcon)?(this.selectedMode.altIcon=this.selectedMode.getAttribute("src"),this.selectedMode.setAttribute("src",n)):this.selectedMode.className=this.selectedMode.initialClassName+"Selected",this.fireEvent(new mxEventObject(mxEvent.SELECT,"function",t))}},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,t,n){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,t,n){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,t,n))),this.sent+=e.length,this.fireEvent(new mxEventObject(mxEvent.NOTIFY,"url",this.urlNotify,"xml",e)))},mxSession.prototype.get=function(n,a,t){if(void 0!==mxUtils){var i=mxUtils.bind(this,function(e){null!=t?t(e):this.stop(e)});mxUtils.get(n,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",n,"request",e)),this.isValidResponse(e)){if(0<e.getText().length){var t=e.getDocumentElement();null==t?i("Invalid response: "+e.getText()):this.receive(t)}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,t){for(var n="",a=t?-1:1,i=t?e.length-1:0;0<=i&&i<e.length;i+=a){var s=this.codec.encode(e[i]);n=n+mxUtils.getXml(s,this.linefeed)}return n},mxSession.prototype.receive=function(e){if(null!=e&&e.nodeType==mxConstants.NODETYPE_ELEMENT){var t=e.getAttribute("namespace");for(null!=t&&(this.model.prefix=t+"-"),t=e.firstChild;null!=t;){var n=t.nodeName.toLowerCase();"state"==n?this.processState(t):"delta"==n&&this.processDelta(t),t=t.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 t=this.createUndoableEdit(e);this.model.fireEvent(new mxEventObject(mxEvent.CHANGE,"edit",t,"changes",e)),this.model.fireEvent(new mxEventObject(mxEvent.UNDO,"edit",t)),this.fireEvent(new mxEventObject(mxEvent.FIRED,"edit",t))}},mxSession.prototype.createUndoableEdit=function(e){var t=new mxUndoableEdit(this.model,this.significantRemoteChanges);return t.changes=e,t.notify=function(){t.source.fireEvent(new mxEventObject(mxEvent.CHANGE,"edit",t,"changes",t.changes)),t.source.fireEvent(new mxEventObject(mxEvent.NOTIFY,"edit",t,"changes",t.changes))},t},mxSession.prototype.decodeChanges=function(e){this.codec.document=e.ownerDocument;var t=[];for(e=e.firstChild;null!=e;){var n=this.decodeChange(e);null!=n&&t.push(n),e=e.nextSibling}return t},mxSession.prototype.decodeChange=function(e){var t=null;return e.nodeType==mxConstants.NODETYPE_ELEMENT&&(null!=(t="mxRootChange"==e.nodeName?new mxCodec(e.ownerDocument).decode(e):this.codec.decode(e))&&(t.model=this.model,t.execute(),"mxChildChange"==e.nodeName&&null==t.parent&&this.cellRemoved(t.child))),t},mxSession.prototype.cellRemoved=function(e,t){this.codec.putObject(e.getId(),e);for(var n=this.model.getChildCount(e),a=0;a<n;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 t=this.changes[e];null!=t.execute?t.execute():null!=t.undo&&t.undo(),this.source.fireEvent(new mxEventObject(mxEvent.EXECUTED,"change",t))}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,t=0;t<e;t++){var n=this.changes[t];null!=n.execute?n.execute():null!=n.redo&&n.redo(),this.source.fireEvent(new mxEventObject(mxEvent.EXECUTED,"change",n))}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 t=this.history[this.indexOfNextAdd++];if(t.redo(),t.isSignificant()){this.fireEvent(new mxEventObject(mxEvent.REDO,"edit",t));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),t=0;t<e.length;t++)e[t].die()};var mxUrlConverter=function(e){var n=!0,a=null,i=null;return{isEnabled:function(){return n},setEnabled:function(e){n=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(n&&this.isRelativeUrl(e)){if(null==a){i=location.protocol+"//"+location.host;var t=(a=i+location.pathname).lastIndexOf("/");0<t&&(a=a.substring(0,t+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,t){},mouseMove:function(e,t){},mouseUp:mxUtils.bind(this,function(e,t){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),t=-s.container.scrollTop-Math.ceil(this.dy);s.panGraph(e,t),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,t,n,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!=n?n: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=t+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=t-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,t=s.panDy;0==e&&0==t||(s.panGraph(0,0),s.view.setTranslate(this.t0x+e/s.view.scale,this.t0y+t/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,t){this.isEnabled()&&this.graphModelChanged(t.getProperty("edit").changes)}),this.setGraph(e)}function mxAnimation(e){this.delay=null!=e?e:20}function mxMorphing(e,t,n,a){mxAnimation.call(this,a),this.graph=e,this.steps=null!=t?t:6,this.ease=null!=n?n: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,t){mxAbstractCanvas2D.call(this),this.root=e,this.gradients=[],this.defs=null,this.styleEnabled=null!=t&&t;var n=null;if(e.ownerDocument!=document)for(n=e;null!=n&&"svg"!=n.nodeName;)n=n.parentNode;null!=n&&(0<n.getElementsByTagName("defs").length&&(this.defs=n.getElementsByTagName("defs")[0]),null==this.defs&&(this.defs=this.createElement("defs"),null!=n.firstChild?n.insertBefore(this.defs,n.firstChild):n.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,t,n,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!=t?((i=document.createElement("img")).src=t,r.appendChild(i)):null!=i&&((t=document.createElement("div")).className=i,r.appendChild(t)),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!=n&&n(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 t=document.createElement("img");t.setAttribute("src",this.submenuImage),td=e.firstChild.nextSibling.nextSibling,td.appendChild(t)},mxPopupMenu.prototype.showSubmenu=function(e,t){if(null!=t.div){t.div.style.left=e.div.offsetLeft+t.offsetLeft+t.offsetWidth-1+"px",t.div.style.top=e.div.offsetTop+t.offsetTop+"px",document.body.appendChild(t.div);var n=parseInt(t.div.offsetLeft),a=parseInt(t.div.offsetWidth),i=document.body,s=document.documentElement;n+a>(i.scrollLeft||s.scrollLeft)+(i.clientWidth||s.clientWidth)&&(t.div.style.left=e.div.offsetLeft-a+(mxClient.IS_IE?6:-6)+"px"),mxUtils.fit(t.div)}},mxPopupMenu.prototype.addSeparator=function(e,t){if(e=e||this,this.smartSeparators&&!t)e.willAddSeparator=!0;else if(null!=e.tbody){e.willAddSeparator=!1;var n=document.createElement("tr"),a=document.createElement("td");a.className="mxPopupMenuIcon",a.style.padding="0 0 0 0px",n.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),n.appendChild(a),e.tbody.appendChild(n)}},mxPopupMenu.prototype.popup=function(e,t,n,a){if(null!=this.div&&null!=this.tbody&&null!=this.factoryMethod){for(this.div.style.left=e+"px",this.div.style.top=t+"px";null!=this.tbody.firstChild;)mxEvent.release(this.tbody.firstChild),this.tbody.removeChild(this.tbody.firstChild);this.itemCount=0,this.factoryMethod(this,n,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 t=0;t<this.cells.length;t++)this.animateCell(cells[t],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,t,n){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,t.moveState(a,-i.x/this.ease,-i.y/this.ease)}if(n&&!this.stopRecursion(a,i))for(a=this.graph.getModel().getChildCount(e),i=0;i<a;i++)this.animateCell(this.graph.getModel().getChildAt(e,i),t,n)},mxMorphing.prototype.stopRecursion=function(e,t){return null!=t&&(0!=t.x||0!=t.y)},mxMorphing.prototype.getDelta=function(e){var t=this.getOriginForCell(e.cell),n=this.graph.getView().getTranslate(),a=this.graph.getView().getScale();return e=new mxPoint(e.x/a-n.x,e.y/a-n.y),new mxPoint((t.x-e.x)*a,(t.y-e.y)*a)},mxMorphing.prototype.getOriginForCell=function(e){var t=null;return null!=e&&(t=this.getOriginForCell(this.graph.getModel().getParent(e)),null!=(e=this.graph.getCellGeometry(e))&&(t.x+=e.x,t.y+=e.y)),null==t&&(t=new mxPoint(-(t=this.graph.view.getTranslate()).x,-t.y)),t},mxImageBundle.prototype.images=null,mxImageBundle.prototype.images=null,mxImageBundle.prototype.putImage=function(e,t,n){this.images[e]={value:t,fallback:n}},mxImageBundle.prototype.getImage=function(e){var t=null;return null!=e&&(null!=(e=this.images[e])&&(t=this.alt?e.fallback:e.value)),t},mxImageExport.prototype.includeOverlays=!1,mxImageExport.prototype.drawState=function(e,t){null!=e&&(this.visitStatesRecursive(e,t,this.drawCellState),this.includeOverlays&&this.visitStatesRecursive(e,t,this.drawOverlays))},mxImageExport.prototype.visitStatesRecursive=function(e,t,n){if(null!=e){n(e,t);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,t,n)}}},mxImageExport.prototype.drawCellState=function(e,t){e.shape instanceof mxShape&&(t.save(),e.shape.paint(t),t.restore()),null!=e.text&&(t.save(),e.text.paint(t),t.restore())},mxImageExport.prototype.drawOverlays=function(e,n){null!=e.overlays&&e.overlays.visit(function(e,t){t instanceof mxShape&&t.paint(n)})},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,t=2;t<arguments.length;t+=2)this.lastX=arguments[t-1],this.lastY=arguments[t],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,t,n,a,i){return n*=Math.PI/180,mxUtils.getRotatedPoint(new mxPoint(e,t),Math.cos(n),Math.sin(n),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,t){this.state.dx+=e,this.state.dy+=t},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,t,n,a,i,s,o,r,l){(n=this.state).fillColor=e,n.fillAlpha=null!=r?r:1,n.gradientColor=t,n.gradientAlpha=null!=l?l:1,n.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,t){this.state.shadowDx=e,this.state.shadowDy=t},mxAbstractCanvas2D.prototype.begin=function(){this.lastY=this.lastX=0,this.path=[]},mxAbstractCanvas2D.prototype.moveTo=function(e,t){this.addOp(this.moveOp,e,t)},mxAbstractCanvas2D.prototype.lineTo=function(e,t){this.addOp(this.lineOp,e,t)},mxAbstractCanvas2D.prototype.quadTo=function(e,t,n,a){this.addOp(this.quadOp,e,t,n,a)},mxAbstractCanvas2D.prototype.curveTo=function(e,t,n,a,i,s){this.addOp(this.curveOp,e,t,n,a,i,s)},mxAbstractCanvas2D.prototype.arcTo=function(e,t,n,a,i,s,o){for(e=mxUtils.arcToCurves(this.lastX,this.lastY,e,t,n,a,i,s,o),t=0;t<e.length;t+=6)this.curveTo(e[t],e[t+1],e[t+2],e[t+3],e[t+4],e[t+5])},mxAbstractCanvas2D.prototype.close=function(e,t,n,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 t=this.createElement("scale");t.setAttribute("scale",e),this.root.appendChild(t)},mxXmlCanvas2D.prototype.translate=function(e,t){var n=this.createElement("translate");n.setAttribute("dx",this.format(e)),n.setAttribute("dy",this.format(t)),this.root.appendChild(n)},mxXmlCanvas2D.prototype.rotate=function(e,t,n,a,i){var s=this.createElement("rotate");(0!=e||t||n)&&(s.setAttribute("theta",this.format(e)),s.setAttribute("flipH",t?"1":"0"),s.setAttribute("flipV",n?"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 t=this.createElement("alpha");t.setAttribute("alpha",this.format(e)),this.root.appendChild(t)},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 t=this.createElement("fillcolor");t.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(t)},mxXmlCanvas2D.prototype.setGradient=function(e,t,n,a,i,s,o,r,l){if(null!=e&&null!=t){mxAbstractCanvas2D.prototype.setGradient.apply(this,arguments);var d=this.createElement("gradient");d.setAttribute("c1",e),d.setAttribute("c2",t),d.setAttribute("x",this.format(n)),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 t=this.createElement("strokecolor");t.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(t)},mxXmlCanvas2D.prototype.setStrokeWidth=function(e){if(this.compressed){if(this.state.strokeWidth==e)return;mxAbstractCanvas2D.prototype.setStrokeWidth.apply(this,arguments)}var t=this.createElement("strokewidth");t.setAttribute("width",this.format(e)),this.root.appendChild(t)},mxXmlCanvas2D.prototype.setDashed=function(e){if(this.compressed){if(this.state.dashed==e)return;mxAbstractCanvas2D.prototype.setDashed.apply(this,arguments)}var t=this.createElement("dashed");t.setAttribute("dashed",e?"1":"0"),this.root.appendChild(t)},mxXmlCanvas2D.prototype.setDashPattern=function(e){if(this.compressed){if(this.state.dashPattern==e)return;mxAbstractCanvas2D.prototype.setDashPattern.apply(this,arguments)}var t=this.createElement("dashpattern");t.setAttribute("pattern",e),this.root.appendChild(t)},mxXmlCanvas2D.prototype.setLineCap=function(e){if(this.compressed){if(this.state.lineCap==e)return;mxAbstractCanvas2D.prototype.setLineCap.apply(this,arguments)}var t=this.createElement("linecap");t.setAttribute("cap",e),this.root.appendChild(t)},mxXmlCanvas2D.prototype.setLineJoin=function(e){if(this.compressed){if(this.state.lineJoin==e)return;mxAbstractCanvas2D.prototype.setLineJoin.apply(this,arguments)}var t=this.createElement("linejoin");t.setAttribute("join",e),this.root.appendChild(t)},mxXmlCanvas2D.prototype.setMiterLimit=function(e){if(this.compressed){if(this.state.miterLimit==e)return;mxAbstractCanvas2D.prototype.setMiterLimit.apply(this,arguments)}var t=this.createElement("miterlimit");t.setAttribute("limit",e),this.root.appendChild(t)},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 t=this.createElement("fontcolor");t.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(t)}},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 t=this.createElement("fontbackgroundcolor");t.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(t)}},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 t=this.createElement("fontbordercolor");t.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(t)}},mxXmlCanvas2D.prototype.setFontSize=function(e){if(this.textEnabled){if(this.compressed){if(this.state.fontSize==e)return;mxAbstractCanvas2D.prototype.setFontSize.apply(this,arguments)}var t=this.createElement("fontsize");t.setAttribute("size",e),this.root.appendChild(t)}},mxXmlCanvas2D.prototype.setFontFamily=function(e){if(this.textEnabled){if(this.compressed){if(this.state.fontFamily==e)return;mxAbstractCanvas2D.prototype.setFontFamily.apply(this,arguments)}var t=this.createElement("fontfamily");t.setAttribute("family",e),this.root.appendChild(t)}},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 t=this.createElement("fontstyle");t.setAttribute("style",e),this.root.appendChild(t)}},mxXmlCanvas2D.prototype.setShadow=function(e){if(this.compressed){if(this.state.shadow==e)return;mxAbstractCanvas2D.prototype.setShadow.apply(this,arguments)}var t=this.createElement("shadow");t.setAttribute("enabled",e?"1":"0"),this.root.appendChild(t)},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 t=this.createElement("shadowcolor");t.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(t)},mxXmlCanvas2D.prototype.setShadowAlpha=function(e){if(this.compressed){if(this.state.shadowAlpha==e)return;mxAbstractCanvas2D.prototype.setShadowAlpha.apply(this,arguments)}var t=this.createElement("shadowalpha");t.setAttribute("alpha",e),this.root.appendChild(t)},mxXmlCanvas2D.prototype.setShadowOffset=function(e,t){if(this.compressed){if(this.state.shadowDx==e&&this.state.shadowDy==t)return;mxAbstractCanvas2D.prototype.setShadowOffset.apply(this,arguments)}var n=this.createElement("shadowoffset");n.setAttribute("dx",e),n.setAttribute("dy",t),this.root.appendChild(n)},mxXmlCanvas2D.prototype.rect=function(e,t,n,a){var i=this.createElement("rect");i.setAttribute("x",this.format(e)),i.setAttribute("y",this.format(t)),i.setAttribute("w",this.format(n)),i.setAttribute("h",this.format(a)),this.root.appendChild(i)},mxXmlCanvas2D.prototype.roundrect=function(e,t,n,a,i,s){var o=this.createElement("roundrect");o.setAttribute("x",this.format(e)),o.setAttribute("y",this.format(t)),o.setAttribute("w",this.format(n)),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,t,n,a){var i=this.createElement("ellipse");i.setAttribute("x",this.format(e)),i.setAttribute("y",this.format(t)),i.setAttribute("w",this.format(n)),i.setAttribute("h",this.format(a)),this.root.appendChild(i)},mxXmlCanvas2D.prototype.image=function(e,t,n,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(t)),l.setAttribute("w",this.format(n)),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,t){var n=this.createElement("move");n.setAttribute("x",this.format(e)),n.setAttribute("y",this.format(t)),this.root.appendChild(n),this.lastX=e,this.lastY=t},mxXmlCanvas2D.prototype.lineTo=function(e,t){var n=this.createElement("line");n.setAttribute("x",this.format(e)),n.setAttribute("y",this.format(t)),this.root.appendChild(n),this.lastX=e,this.lastY=t},mxXmlCanvas2D.prototype.quadTo=function(e,t,n,a){var i=this.createElement("quad");i.setAttribute("x1",this.format(e)),i.setAttribute("y1",this.format(t)),i.setAttribute("x2",this.format(n)),i.setAttribute("y2",this.format(a)),this.root.appendChild(i),this.lastX=n,this.lastY=a},mxXmlCanvas2D.prototype.curveTo=function(e,t,n,a,i,s){var o=this.createElement("curve");o.setAttribute("x1",this.format(e)),o.setAttribute("y1",this.format(t)),o.setAttribute("x2",this.format(n)),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,t,n,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(t)),u.setAttribute("w",this.format(n)),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,t){if(null!=this.root.ownerDocument.createElementNS)return this.root.ownerDocument.createElementNS(t||mxConstants.NS_SVG,e);var n=this.root.ownerDocument.createElement(e);return null!=t&&n.setAttribute("xmlns",t),n},mxSvgCanvas2D.prototype.createGradientId=function(e,t,n,a,i){return"#"==e.charAt(0)&&(e=e.substring(1)),"#"==t.charAt(0)&&(t=t.substring(1)),e=e.toLowerCase()+"-"+n,t=t.toLowerCase()+"-"+a,(n=null)==i||i==mxConstants.DIRECTION_SOUTH?n="s":i==mxConstants.DIRECTION_EAST?n="e":(a=e,e=t,t=a,i==mxConstants.DIRECTION_NORTH?n="s":i==mxConstants.DIRECTION_WEST&&(n="e")),"mx-gradient-"+e+"-"+t+"-"+n},mxSvgCanvas2D.prototype.getSvgGradient=function(e,t,n,a,i){var s=this.createGradientId(e,t,n,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,t,n,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,t,n,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%"),n=n<1?";stop-opacity:"+n:"",(i=this.createElement("stop")).setAttribute("offset","0%"),i.setAttribute("style","stop-color:"+e+n),s.appendChild(i),n=a<1?";stop-opacity:"+a:"",(i=this.createElement("stop")).setAttribute("offset","100%"),i.setAttribute("style","stop-color:"+t+n),s.appendChild(i),s},mxSvgCanvas2D.prototype.addNode=function(e,t){var n=this.node,a=this.state;if(null!=n){if("path"==n.nodeName){if(!(null!=this.path&&0<this.path.length))return;n.setAttribute("d",this.path.join(" "))}e&&null!=a.fillColor?this.updateFill():this.styleEnabled||("ellipse"!=n.nodeName||!mxClient.IS_NS||mxClient.IS_GC||mxClient.IS_SF?n.setAttribute("fill","none"):n.setAttribute("fill","transparent"),e=!1),t&&null!=a.strokeColor?this.updateStroke():this.styleEnabled||n.setAttribute("stroke","none"),null!=a.transform&&0<a.transform.length&&n.setAttribute("transform",a.transform),a.shadow&&this.root.appendChild(this.createShadow(n)),0<this.strokeTolerance&&!e&&this.root.appendChild(this.createTolerance(n)),this.pointerEvents&&("path"!=n.nodeName||this.path[this.path.length-1]==this.closeOp)&&n.setAttribute("pointer-events","all"),this.root.appendChild(n)}},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 t=Math.max(1,this.format(e.strokeWidth*e.scale));1!=t&&this.node.setAttribute("stroke-width",t),"path"==this.node.nodeName&&this.updateStrokeAttributes(),e.dashed&&this.node.setAttribute("stroke-dasharray",this.createDashPattern(t))},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 t=e.lineCap;"flat"==t&&(t="butt"),"butt"!=t&&this.node.setAttribute("stroke-linecap",t)}null!=e.miterLimit&&(!this.styleEnabled||10!=e.miterLimit)&&this.node.setAttribute("stroke-miterlimit",e.miterLimit)},mxSvgCanvas2D.prototype.createDashPattern=function(e){var t=this.state.dashPattern.split(" "),n=[];if(0<t.length)for(var a=0;a<t.length;a++)n[a]=Number(t[a])*e;return n.join(" ")},mxSvgCanvas2D.prototype.createTolerance=function(e){e=e.cloneNode(!0);var t=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",t),e.setAttribute("fill","none"),e.setAttribute("stroke",mxClient.IS_OP?"none":"white"),e},mxSvgCanvas2D.prototype.createShadow=function(e){e=e.cloneNode(!0);var t=this.state;return"none"!=e.getAttribute("fill")&&e.setAttribute("fill",t.shadowColor),"none"!=e.getAttribute("stroke")&&e.setAttribute("stroke",t.shadowColor),e.setAttribute("transform","translate("+this.format(t.shadowDx*t.scale)+","+this.format(t.shadowDy*t.scale)+")"+(t.transform||"")),e.setAttribute("opacity",t.shadowAlpha),e},mxSvgCanvas2D.prototype.rotate=function(e,t,n,a,i){if(0!=e||t||n){var s=this.state;if(a+=s.dx,i+=s.dy,a*=s.scale,i*=s.scale,s.transform=s.transform||"",t&&n)e+=180;else if(t^n){var o=t?a:0,r=t?-1:1,l=n?i:0,d=n?-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)+")"}(t?!n:n)&&(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,t,n,a){var i=this.state,s=this.createElement("rect");s.setAttribute("x",this.format((e+i.dx)*i.scale)),s.setAttribute("y",this.format((t+i.dy)*i.scale)),s.setAttribute("width",this.format(n*i.scale)),s.setAttribute("height",this.format(a*i.scale)),this.node=s},mxSvgCanvas2D.prototype.roundrect=function(e,t,n,a,i,s){this.rect(e,t,n,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,t,n,a){var i=this.state,s=this.createElement("ellipse");s.setAttribute("cx",Math.round((e+n/2+i.dx)*i.scale)),s.setAttribute("cy",Math.round((t+a/2+i.dy)*i.scale)),s.setAttribute("rx",n/2*i.scale),s.setAttribute("ry",a/2*i.scale),this.node=s},mxSvgCanvas2D.prototype.image=function(e,t,n,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,t+=l.dy;var d=this.createElement("image");if(d.setAttribute("x",this.format(e*l.scale)),d.setAttribute("y",this.format(t*l.scale)),d.setAttribute("width",this.format(n*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=-n-2*e),r&&(c=-1,u=-a-2*t),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(t*l.scale)),d.setAttribute("width",this.format(n*l.scale)),d.setAttribute("height",this.format(a*l.scale)),this.root.appendChild(d))},mxSvgCanvas2D.prototype.createDiv=function(e,t,n,a,i){return n=this.state,a="display:inline-block;font-size:"+Math.round(n.fontSize)+"px;font-family:"+n.fontFamily+";color:"+n.fontColor+";line-height:"+Math.round(n.fontSize*mxConstants.LINE_HEIGHT)+"px;"+a,(n.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD&&(a+="font-weight:bold;"),(n.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC&&(a+="font-style:italic;"),(n.fontStyle&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE&&(a+="font-decoration:underline;"),t==mxConstants.ALIGN_CENTER?a+="text-align:center;":t==mxConstants.ALIGN_RIGHT&&(a+="text-align:right;"),t="",null!=n.fontBackgroundColor&&(t+="background-color:"+n.fontBackgroundColor+";"),null!=n.fontBorderColor&&(t+="border:1px solid "+n.fontBorderColor+";"),mxUtils.isNode(e)||((n=document.createElement("textarea")).innerHTML=e.replace(/&lt;/g,"&amp;lt;").replace(/&gt;/g,"&amp;gt;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),e=n.value,i?a+=t:0<t.length&&(e='<div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;'+t+'">'+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,t,n,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,t+=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<n&&(p+="width:"+Math.round(n)+"px;")):d&&(p+="width:"+Math.round(n)+"px;",0<a&&(p+="max-height:"+Math.round(a)+"px;")),r?(!c&&0<n&&(p+="width:"+Math.round(n)+"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);n=d?Math.max(n,g):g,u.alpha<1&&r.setAttribute("opacity",u.alpha),d=i=0,s==mxConstants.ALIGN_CENTER?i-=n/2:s==mxConstants.ALIGN_RIGHT&&(i-=n),e+=i,o==mxConstants.ALIGN_MIDDLE?d-=a/2:o==mxConstants.ALIGN_BOTTOM&&(d-=a),t+=d,s=1!=u.scale?"scale("+u.scale+")":"",0!=u.rotation&&this.rotateHtml?(s+="rotate("+u.rotation+","+n/2+","+a/2+")",e=(t=this.rotatePoint((e+n/2)*u.scale,(t+a/2)*u.scale,u.rotation,u.rotationCx,u.rotationCy)).x-n*u.scale/2,t=t.y-a*u.scale/2):(e*=u.scale,t*=u.scale),0!=m&&(s+="rotate("+m+","+-i+","+-d+")"),r.setAttribute("transform","translate("+Math.round(e)+","+Math.round(t)+")"+s),l.setAttribute("width",Math.round(Math.max(1,n))),l.setAttribute("height",Math.round(Math.max(1,a)))}}else this.plainText(e,t,n,a,i,s,o,r,d,c,m)}},mxSvgCanvas2D.prototype.createClip=function(e,t,n,a){for(var i="mx-clip-"+(e=Math.round(e))+"-"+(t=Math.round(t))+"-"+(n=Math.round(n))+"-"+(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",t),i.setAttribute("width",n),i.setAttribute("height",a),clip.appendChild(i),clip},mxSvgCanvas2D.prototype.plainText=function(e,t,n,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(t*r.scale)+")"),d&&0<n&&0<a){var g=e;c=t,s==mxConstants.ALIGN_CENTER?g-=n/2:s==mxConstants.ALIGN_RIGHT&&(g-=n),o==mxConstants.ALIGN_MIDDLE?c-=a/2:o==mxConstants.ALIGN_BOTTOM&&(c-=a),c=this.createClip(g*r.scale-2,c*r.scale-2,n*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=t+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,t,n,v,s,o,l)},mxSvgCanvas2D.prototype.updateFont=function(e){var t=this.state;e.setAttribute("fill",t.fontColor),(!this.styleEnabled||t.fontFamily!=mxConstants.DEFAULT_FONTFAMILY)&&e.setAttribute("font-family",t.fontFamily),(t.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD&&e.setAttribute("font-weight","bold"),(t.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC&&e.setAttribute("font-style","italic"),(t.fontStyle&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE&&e.setAttribute("text-decoration","underline")},mxSvgCanvas2D.prototype.addTextBackground=function(e,t,n,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?n-=i/2:o==mxConstants.ALIGN_RIGHT&&(n-=i),r==mxConstants.ALIGN_MIDDLE?a-=s/2:r==mxConstants.ALIGN_BOTTOM&&(a-=s),new mxRectangle((n+1)*d.scale,a*d.scale,(i-2)*d.scale,(s+2)*d.scale)):null!=e.getBBox&&this.root.ownerDocument==document?(c=e.getBBox(),t=mxClient.IS_IE&&mxClient.IS_SVG,new mxRectangle(c.x,c.y+(t?0:1),c.width,c.height+(t?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"),t=mxUtils.htmlEntities(t,!1),c.innerHTML=t.replace(/\n/g,"<br/>"),document.body.appendChild(c),i=c.offsetWidth,s=c.offsetHeight,c.parentNode.removeChild(c),o==mxConstants.ALIGN_CENTER?n-=i/2:o==mxConstants.ALIGN_RIGHT&&(n-=i),r==mxConstants.ALIGN_MIDDLE?a-=s/2:r==mxConstants.ALIGN_BOTTOM&&(a-=s),new mxRectangle((n+1)*d.scale,(a+2)*d.scale,i*d.scale,(s+1)*d.scale)))&&((t=this.createElement("rect")).setAttribute("fill",d.fontBackgroundColor||"none"),t.setAttribute("stroke",d.fontBorderColor||"none"),t.setAttribute("x",Math.floor(c.x-1)),t.setAttribute("y",Math.floor(c.y-1)),t.setAttribute("width",Math.ceil(c.width+2)),t.setAttribute("height",Math.ceil(c.height)),d=null!=d.fontBorderColor?Math.max(1,this.format(d.scale)):0,t.setAttribute("stroke-width",d),this.root.ownerDocument==document&&1==mxUtils.mod(d,2)&&t.setAttribute("transform","translate(0.5, 0.5)"),e.insertBefore(t,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,t){this.graph=e,this.setStates(t)}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,t){var n=this.node,a=this.state;if(null!=n){if("shape"==n.nodeName){if(!(null!=this.path&&0<this.path.length))return;n.path=this.path.join(" ")+" e",n.style.width=this.root.style.width,n.style.height=this.root.style.height,n.coordsize=parseInt(n.style.width)+" "+parseInt(n.style.height)}n.strokeweight=this.format(Math.max(1,a.strokeWidth*a.scale/this.vmlScale))+"px",a.shadow&&this.root.appendChild(this.createShadow(n,e&&null!=a.fillColor,t&&null!=a.strokeColor)),t&&null!=a.strokeColor?(n.stroked="true",n.strokecolor=a.strokeColor):n.stroked="false",n.appendChild(this.createStroke()),e&&null!=a.fillColor?n.appendChild(this.createFill()):!this.pointerEvents||"shape"==n.nodeName&&this.path[this.path.length-1]!=this.closeOp?n.filled="false":n.appendChild(this.createTransparentFill()),this.root.appendChild(n)}},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,t=document.createElement(mxClient.VML_PREFIX+":fill");if(t.color=e.fillColor,null!=e.gradientColor){t.type="gradient",t.method="none",t.color2=e.gradientColor;var n=180-e.rotation;n=e.gradientDirection==mxConstants.DIRECTION_WEST?n-(90+("x"==this.root.style.flip?180:0)):e.gradientDirection==mxConstants.DIRECTION_EAST?n+(90+("x"==this.root.style.flip?180:0)):e.gradientDirection==mxConstants.DIRECTION_NORTH?n-(180+("y"==this.root.style.flip?-180:0)):n+("y"==this.root.style.flip?-180:0);"x"!=this.root.style.flip&&"y"!=this.root.style.flip||(n*=-1),t.angle=mxUtils.mod(n,360),t.opacity=100*e.alpha*e.fillAlpha+"%",t.setAttribute(mxClient.OFFICE_PREFIX+":opacity2",100*e.alpha*e.gradientAlpha+"%")}else e.alpha<1&&(t.opacity=100*e.alpha+"%");return t},mxVmlCanvas2D.prototype.createStroke=function(){var e=this.state,t=document.createElement(mxClient.VML_PREFIX+":stroke");return t.endcap=e.lineCap||"flat",t.joinstyle=e.lineJoin||"miter",t.miterlimit=e.miterLimit||"10",e.alpha<1&&(t.opacity=100*e.alpha+"%"),e.dashed&&(t.dashstyle=this.getVmlDashStyle()),t},mxVmlCanvas2D.prototype.getVmlDashStyle=function(){var e="dash";if(null!=this.state.dashPattern){var t=this.state.dashPattern.split(" ");0<t.length&&1==t[0]&&(e="0 2")}return e},mxVmlCanvas2D.prototype.createShadow=function(e,t,n){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))),n?(l.strokecolor=a.shadowColor,l.appendChild(this.createShadowStroke())):l.stroked="false",t?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,t,n,a,i){t&&n?e+=180:t?this.root.style.flip="x":n&&(this.root.style.flip="y"),(t?!n:n)&&(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,t,n,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*((t=(t+i.dy)*i.scale)-o);var r=(n=(n+i.dx)*i.scale)+2/3*(e-n);t=(a=(a+i.dy)*i.scale)+2/3*(t-a),this.path.push("c "+this.format(s+2/3*(e-s))+" "+this.format(o)+" "+this.format(r)+" "+this.format(t)+" "+this.format(n)+" "+this.format(a)),this.lastX=n/i.scale-i.dx,this.lastY=a/i.scale-i.dy},mxVmlCanvas2D.prototype.createRect=function(e,t,n,a,i){var s=this.state;return(e=document.createElement(e)).style.position="absolute",e.style.left=this.format((t+s.dx)*s.scale)+"px",e.style.top=this.format((n+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,t,n,a){this.node=this.createRect(mxClient.VML_PREFIX+":rect",e,t,n,a)},mxVmlCanvas2D.prototype.roundrect=function(e,t,n,a,i,s){this.node=this.createRect(mxClient.VML_PREFIX+":roundrect",e,t,n,a),this.node.setAttribute("arcsize",Math.max(100*i/n,100*s/a)+"%")},mxVmlCanvas2D.prototype.ellipse=function(e,t,n,a){this.node=this.createRect(mxClient.VML_PREFIX+":oval",e,t,n,a)},mxVmlCanvas2D.prototype.image=function(e,t,n,a,i,s,o,r){var l=null;s?((l=this.createRect(mxClient.VML_PREFIX+":rect",e,t,n,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,t,n,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,t,n,a){n=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)?n.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,n.appendChild(a)):(n.style.cssText=s,n.innerHTML=e),(e=n.style).fontSize=Math.round(i.fontSize/this.vmlScale)+"px",e.fontFamily=i.fontFamily,e.color=i.fontColor,e.verticalAlign="top",e.textAlign=t||"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"),n},mxVmlCanvas2D.prototype.text=function(e,t,n,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=(t=this.rotatePoint(e,t,u.rotation,u.rotationCx,u.rotationCy)).x,t=t.y),8==document.documentMode?(e+=u.dx,t+=u.dy):(e*=u.scale,t*=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(t)+"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<n&&(i.style.width=Math.round(n)+"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<n&&(i.style.width=Math.round(n)+"px"),0<a&&8==document.documentMode&&(i.style.maxHeight=Math.round(a)+"px")):d&&(i.style.width=n+"px",0<a&&(i.style.maxHeight=Math.round(a)+"px")),this.rotateHtml&&0!=r){n=r*(Math.PI/180),r=parseFloat(parseFloat(Math.cos(n)).toFixed(8)),m=parseFloat(parseFloat(Math.sin(-n)).toFixed(8)),(n%=2*Math.PI)<0&&(n+=2*Math.PI),(n%=Math.PI)>Math.PI/2&&(n=Math.PI-n),o=Math.cos(n);var h=Math.sin(n);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),n=i.offsetWidth,p=i.offsetHeight,mxClient.IS_QUIRKS&&(c||d)&&a<p&&(p=a,i.style.height=p+"px"),c=((a=p)-a*o+n*-h)/2-m*n*(g+.5)+r*a*(v+.5),d=(n-n*o+a*-h)/2+r*n*(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-n/2)*u.scale)+"px",g.style.top=this.format(t+(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-n/2)*u)+"px",l.style.top=this.format(t+(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),n=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+n*g*this.state.scale)+"px",l.style.top=this.format(t+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,t,n,a,mxUtils.htmlEntities(i,!1),s,o,r,l,d,c,m)}},mxVmlCanvas2D.prototype.plainText=function(e,t,n,a,i,s,o,r,l,d,c,m){e=(e+(a=this.state).dx)*a.scale,t=(t+a.dy)*a.scale,(n=document.createElement(mxClient.VML_PREFIX+":shape")).style.width="1px",n.style.height="1px",n.stroked="false",(d=document.createElement(mxClient.VML_PREFIX+":fill")).color=a.fontColor,d.opacity=100*a.alpha+"%",n.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),n.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=(n.style.rotation=m)*(Math.PI/180),i=Math.sin(o)*s,s*=Math.cos(o)),n.appendChild(d),n.style.left=this.format(e-i)+"px",n.style.top=this.format(t+s)+"px",this.root.appendChild(n)},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,t){if(null!=this.states&&(this.horizontal||this.vertical)&&null!=a&&null!=e){var n=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 t=!1;if(Math.abs(e-p)<d?(s=e-a.getCenterX(),d=Math.abs(e-p),t=!0):Math.abs(e-m)<d?(s=e-a.x,d=Math.abs(e-m),t=!0):Math.abs(e-u)<d&&(s=e-a.x-a.width,d=Math.abs(e-u),t=!0),t){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 n=this.graph.container;e-=this.graph.panDx,this.guideX.points=[new mxPoint(e,-this.graph.panDy),new mxPoint(e,n.scrollHeight-3-this.graph.panDy)]}r=r||t};for(var f=function(e){e+=this.graph.panDy;var t=!1;if(Math.abs(e-h)<c?(o=e-a.getCenterY(),c=Math.abs(e-h),t=!0):Math.abs(e-g)<c?(o=e-a.y,c=Math.abs(e-g),t=!0):Math.abs(e-v)<c&&(o=e-a.y-a.height,c=Math.abs(e-v),t=!0),t){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 n=this.graph.container;e-=this.graph.panDy,this.guideY.points=[new mxPoint(-this.graph.panDx,e),new mxPoint(n.scrollWidth-3-this.graph.panDx,e)]}l=l||t},b=0;b<this.states.length;b++){var E=this.states[b];null!=E&&(this.horizontal&&(e.call(this,E.getCenterX()),e.call(this,E.x),e.call(this,E.x+E.width)),this.vertical&&(f.call(this,E.getCenterY()),f.call(this,E.y),f.call(this,E.y+E.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",t&&(r||(t=a.x-(this.graph.snap(a.x/i-n.x)+n.x)*i,s=this.graph.snap(s/i)*i-t),l||(n=a.y-(this.graph.snap(a.y/i-n.y)+n.y)*i,o=this.graph.snap(o/i)*i-n)),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 t=0;t<e.length;t++)this.constraints.push(this.parseConstraint(e[t]))}},mxStencil.prototype.parseConstraint=function(e){var t=Number(e.getAttribute("x")),n=Number(e.getAttribute("y"));return e="1"==e.getAttribute("perimeter"),new mxConnectionConstraint(new mxPoint(t,n),e)},mxStencil.prototype.evaluateTextAttribute=function(e,t,n){return t=this.evaluateAttribute(e,t,n),e=e.getAttribute("localized"),(mxStencil.defaultLocalized&&null==e||"1"==e)&&(t=mxResources.get(t)),t},mxStencil.prototype.evaluateAttribute=function(e,t,n){return null==(t=e.getAttribute(t))&&(null!=(e=mxUtils.getTextContent(e))&&("function"==typeof(e=mxUtils.eval(e))&&(t=e(n)))),t},mxStencil.prototype.drawShape=function(e,t,n,a,i,s){this.drawChildren(e,t,n,a,i,s,this.bgNode,!1),this.drawChildren(e,t,n,a,i,s,this.fgNode,!0)},mxStencil.prototype.drawChildren=function(e,t,n,a,i,s,o,r){if(null!=o){var l=mxUtils.getValue(t.style,mxConstants.STYLE_DIRECTION,null);for(n=this.computeAspect(t.style,n,a,i,s,l),a=Math.min(n.width,n.height),a="inherit"==this.strokewidth?Number(mxUtils.getNumber(t.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,t,o,n,r),o=o.nextSibling}},mxStencil.prototype.computeAspect=function(e,t,n,a,i,s){e=t,t=a/this.w0;var o=i/this.h0;if(s="north"==s||"south"==s){o=a/this.h0,t=i/this.w0;var r=(a-i)/2;e+=r,n-=r}return"fixed"==this.aspect&&(t=o=Math.min(t,o),s?(e+=(i-this.w0*t)/2,n+=(a-this.h0*o)/2):(e+=(a-this.w0*t)/2,n+=(i-this.h0*o)/2)),new mxRectangle(e,n,t,o)},mxStencil.prototype.drawNode=function(e,t,n,a,i){var s=n.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(),n=n.firstChild;null!=n;)n.nodeType==mxConstants.NODETYPE_ELEMENT&&this.drawNode(e,t,n,a,i),n=n.nextSibling;else if("close"==s)e.close();else if("move"==s)e.moveTo(o+Number(n.getAttribute("x"))*l,r+Number(n.getAttribute("y"))*d);else if("line"==s)e.lineTo(o+Number(n.getAttribute("x"))*l,r+Number(n.getAttribute("y"))*d);else if("quad"==s)e.quadTo(o+Number(n.getAttribute("x1"))*l,r+Number(n.getAttribute("y1"))*d,o+Number(n.getAttribute("x2"))*l,r+Number(n.getAttribute("y2"))*d);else if("curve"==s)e.curveTo(o+Number(n.getAttribute("x1"))*l,r+Number(n.getAttribute("y1"))*d,o+Number(n.getAttribute("x2"))*l,r+Number(n.getAttribute("y2"))*d,o+Number(n.getAttribute("x3"))*l,r+Number(n.getAttribute("y3"))*d);else if("arc"==s)e.arcTo(Number(n.getAttribute("rx"))*l,Number(n.getAttribute("ry"))*d,Number(n.getAttribute("x-axis-rotation")),Number(n.getAttribute("large-arc-flag")),Number(n.getAttribute("sweep-flag")),o+Number(n.getAttribute("x"))*l,r+Number(n.getAttribute("y"))*d);else if("rect"==s)e.rect(o+Number(n.getAttribute("x"))*l,r+Number(n.getAttribute("y"))*d,Number(n.getAttribute("w"))*l,Number(n.getAttribute("h"))*d);else if("roundrect"==s)0==(t=n.getAttribute("arcsize"))&&(t=100*mxConstants.RECTANGLE_ROUNDING_FACTOR),c=Number(n.getAttribute("w"))*l,a=Number(n.getAttribute("h"))*d,t=Number(t)/100,t=Math.min(c*t,a*t),e.roundrect(o+Number(n.getAttribute("x"))*l,r+Number(n.getAttribute("y"))*d,c,a,t,t);else if("ellipse"==s)e.ellipse(o+Number(n.getAttribute("x"))*l,r+Number(n.getAttribute("y"))*d,Number(n.getAttribute("w"))*l,Number(n.getAttribute("h"))*d);else if("image"==s)t=this.evaluateAttribute(n,"src",t),e.image(o+Number(n.getAttribute("x"))*l,r+Number(n.getAttribute("y"))*d,Number(n.getAttribute("w"))*l,Number(n.getAttribute("h"))*d,t,!1,"1"==n.getAttribute("flipH"),"1"==n.getAttribute("flipV"));else if("text"==s){if(c=this.evaluateTextAttribute(n,"str",t),a="1"==n.getAttribute("vertical")?-90:0,"0"==n.getAttribute("align-shape")){var m=t.rotation,u=1==mxUtils.getValue(t.style,mxConstants.STYLE_FLIPH,0);t=1==mxUtils.getValue(t.style,mxConstants.STYLE_FLIPV,0),a=u&&t?a-m:u||t?a+m:a-m}a-=n.getAttribute("rotation"),e.text(o+Number(n.getAttribute("x"))*l,r+Number(n.getAttribute("y"))*d,0,0,c,n.getAttribute("align")||"left",n.getAttribute("valign")||"top",!1,"",!1,!1,a)}else if("include-shape"==s)null!=(m=mxStencilRegistry.getStencil(n.getAttribute("name")))&&(o+=Number(n.getAttribute("x"))*l,r+=Number(n.getAttribute("y"))*d,c=Number(n.getAttribute("w"))*l,a=Number(n.getAttribute("h"))*d,m.drawShape(e,t,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(n.getAttribute("width"))*c);else if("dashed"==s)e.setDashed("1"==n.getAttribute("dashed"));else if("dashpattern"==s){if(null!=(n=n.getAttribute("pattern"))){for(n=n.split(" "),l=[],d=0;d<n.length;d++)0<n[d].length&&l.push(Number(n[d])*c);n=l.join(" "),e.setDashPattern(n)}}else"strokecolor"==s?e.setStrokeColor(n.getAttribute("color")):"linecap"==s?e.setLineCap(n.getAttribute("cap")):"linejoin"==s?e.setLineJoin(n.getAttribute("join")):"miterlimit"==s?e.setMiterLimit(Number(n.getAttribute("limit"))):"fillcolor"==s?e.setFillColor(n.getAttribute("color")):"alpha"==s?e.setAlpha(n.getAttribute("alpha")):"fontcolor"==s?e.setFontColor(n.getAttribute("color")):"fontstyle"==s?e.setFontStyle(n.getAttribute("style")):"fontfamily"==s?e.setFontFamily(n.getAttribute("family")):"fontsize"==s&&e.setFontSize(Number(n.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 t=1;t<this.points.length;t++)null!=e[t]&&this.bounds.add(new mxRectangle(Number(e[t].x),Number(e[t].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,t=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!=(t=this.getSvgScreenOffset())?this.node.setAttribute("transform","translate("+t+","+t+")"):this.node.removeAttribute("transform");else{this.updateVmlContainer();var n=Math.max(1,Math.round(this.bounds.width)),a=Math.max(1,Math.round(this.bounds.height));t=8==document.documentMode&&this.isParseVml()?this.createVmlGroup():this.node,e=new mxVmlCanvas2D(t,!1);""!=t.tagUrn&&(t.coordsize=n*this.vmlScale+","+a*this.vmlScale,e.scale(this.vmlScale),e.vmlScale=this.vmlScale),t=this.scale,e.translate(-Math.round(this.bounds.x/t),-Math.round(this.bounds.y/t))}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)),t=Math.max(1,Math.round(this.bounds.height));this.node.style.width=e+"px",this.node.style.height=t+"px",this.node.style.overflow="visible"},mxShape.prototype.destroyCanvas=function(e){if(e instanceof mxSvgCanvas2D){for(var t in e.gradients){var n=e.gradients[t];n.mxRefCount=(n.mxRefCount||0)+1}this.releaseSvgGradients(this.oldGradients),this.oldGradients=e.gradients}},mxShape.prototype.paint=function(e){var t=this.scale,n=this.bounds.x/t,a=this.bounds.y/t,i=this.bounds.width/t,s=this.bounds.height/t;if(this.isPaintBoundsInverted()){n=n+(o=(i-s)/2),a=a-o;var o=i;i=s,s=o}if(this.updateTransform(e,n,a,i,s),this.configureCanvas(e,n,a,i,s),null!=this.stencil)this.paintStencilShape(e,n,a,i,s);else if(e.setStrokeWidth(this.strokewidth),null!=this.points){for(n=[],a=0;a<this.points.length;a++)n.push(new mxPoint(this.points[a].x/t,this.points[a].y/t));this.paintEdgeShape(e,n)}else this.paintVertexShape(e,n,a,i,s)},mxShape.prototype.configureCanvas=function(e,t,n,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?(t=this.getGradientBounds(e,t,n,a,i),e.setGradient(this.fill,this.gradient,t.x,t.y,t.width,t.height,this.gradientDirection)):e.setFillColor(this.fill),e.setStrokeColor(this.stroke)},mxShape.prototype.getGradientBounds=function(e,t,n,a,i){return new mxRectangle(t,n,a,i)},mxShape.prototype.updateTransform=function(e,t,n,a,i){e.scale(this.scale),e.rotate(this.getShapeRotation(),this.flipH,this.flipV,t+a/2,n+i/2)},mxShape.prototype.paintStencilShape=function(e,t,n,a,i){this.stencilPointerEvents&&(this.dialect==mxConstants.DIALECT_SVG?this.addTransparentBackgroundRectangle(this.node,t,n,a,i):8!=document.documentMode&&this.setTransparentBackgroundImage(this.node)),this.stencil.drawShape(e,this,t,n,a,i)},mxShape.prototype.paintVertexShape=function(e,t,n,a,i){this.paintBackground(e,t,n,a,i),e.setShadow(!1),this.paintForeground(e,t,n,a,i)},mxShape.prototype.paintBackground=function(e,t,n,a,i){},mxShape.prototype.paintForeground=function(e,t,n,a,i){},mxShape.prototype.paintEdgeShape=function(e,t){},mxShape.prototype.getArcSize=function(e,t){var n=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,100*mxConstants.RECTANGLE_ROUNDING_FACTOR)/100;return Math.min(e*n,t*n)},mxShape.prototype.paintGlassEffect=function(e,t,n,a,i,s){var o=Math.ceil(this.strokewidth/2);e.setGradient("#ffffff","#ffffff",t,n,a,.6*i,"south",.9,.1),e.begin(),s+=2*o,this.isRounded?(e.moveTo(t-o+s,n-o),e.quadTo(t-o,n-o,t-o,n-o+s),e.lineTo(t-o,n+.4*i),e.quadTo(t+.5*a,n+.7*i,t+a+o,n+.4*i),e.lineTo(t+a+o,n-o+s),e.quadTo(t+a+o,n-o,t+a+o-s,n-o)):(e.moveTo(t-o,n-o),e.lineTo(t-o,n+.4*i),e.quadTo(t+.5*a,n+.7*i,t+a+o,n+.4*i),e.lineTo(t+a+o,n-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 t=this.getShapeRotation();0!=t&&(e=mxUtils.getBoundingBox(e,t)),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 t=(e.width-e.height)/2;e.x+=t,e.y-=t,t=e.width,e.width=e.height,e.height=t}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 t=Math.ceil(this.strokewidth*this.scale);e.grow(Math.ceil(t/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,t,n,a,i){(e=document.createElementNS(mxConstants.NS_SVG,"rect")).setAttribute("x",t),e.setAttribute("y",n),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 t in e){var n=e[t];n.mxRefCount=(n.mxRefCount||0)-1,0==n.mxRefCount&&null!=n.parentNode&&n.parentNode.removeChild(n)}},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,t){mxStencilRegistry.stencils[e]=t},getStencil:function(e){return mxStencilRegistry.stencils[e]}},mxMarker={markers:[],addMarker:function(e,t){mxMarker.markers[e]=t},createMarker:function(e,t,n,a,i,s,o,r,l,d){var c=mxMarker.markers[n];return null!=c?c(e,t,n,a,i,s,o,r,l,d):null}};function mxActor(e,t,n,a){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=n,this.strokewidth=null!=a?a:1}function mxCloud(e,t,n,a){mxActor.call(this),this.bounds=e,this.fill=t,this.stroke=n,this.strokewidth=null!=a?a:1}function mxRectangleShape(e,t,n,a){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=n,this.strokewidth=null!=a?a:1}function mxEllipse(e,t,n,a){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=n,this.strokewidth=null!=a?a:1}function mxDoubleEllipse(e,t,n,a){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=n,this.strokewidth=null!=a?a:1}function mxRhombus(e,t,n,a){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=n,this.strokewidth=null!=a?a:1}function mxPolyline(e,t,n){mxShape.call(this),this.points=e,this.stroke=t,this.strokewidth=null!=n?n:1}function mxArrow(e,t,n,a,i,s,o){mxShape.call(this),this.points=e,this.fill=t,this.stroke=n,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,t,n,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f,b,E){mxShape.call(this),this.value=e,this.bounds=t,this.color=null!=i?i:"black",this.align=null!=n?n:"",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!=E?E:0,this.rotation=0}function mxTriangle(){mxActor.call(this)}function mxHexagon(){mxActor.call(this)}function mxLine(e,t,n){mxShape.call(this),this.bounds=e,this.stroke=t,this.strokewidth=null!=n?n:1}function mxImageShape(e,t,n,a,i){mxShape.call(this),this.bounds=e,this.image=t,this.fill=n,this.stroke=a,this.strokewidth=null!=i?i:1,this.shadow=!1}function mxLabel(e,t,n,a){mxRectangleShape.call(this,e,t,n,a)}function mxCylinder(e,t,n,a){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=n,this.strokewidth=null!=a?a:1}function mxConnector(e,t,n){mxPolyline.call(this,e,t,n)}function mxSwimlane(e,t,n,a){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=n,this.strokewidth=null!=a?a:1}function mxGraphLayout(e){this.graph=e}function mxStackLayout(e,t,n,a,i,s){mxGraphLayout.call(this,e),this.horizontal=null==t||t,this.spacing=null!=n?n:0,this.x0=null!=a?a:0,this.y0=null!=i?i:0,this.border=null!=s?s:0}function mxPartitionLayout(e,t,n,a){mxGraphLayout.call(this,e),this.horizontal=null==t||t,this.spacing=n||0,this.border=a||0}function mxCompactTreeLayout(e,t,n){mxGraphLayout.call(this,e),this.horizontal=null==t||t,this.invert=null!=n&&n}function WeightedCellSorter(e,t){this.cell=e,this.weightedValue=t}function mxFastOrganicLayout(e){mxGraphLayout.call(this,e)}function mxCircleLayout(e,t){mxGraphLayout.call(this,e),this.radius=null!=t?t:100}function mxParallelEdgeLayout(e){mxGraphLayout.call(this,e)}function mxCompositeLayout(e,t,n){mxGraphLayout.call(this,e),this.layouts=t,this.master=n}function mxEdgeLabelLayout(e,t){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,t,n,a,i){for(e.getGraph(),this.tightenToSource=i,this.roots=n,this.parent=a,this.vertexMapper={},this.edgeMapper={},this.maxRank=0,n=[],null==t&&(t=this.graph.getChildVertices(a)),this.maxRank=this.SOURCESCANSTARTRANK,this.createInternalCells(e,t,n),a=0;a<t.length;a++){i=n[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];n[a]==l&&(l=e.getVisibleTerminal(r,!0),l=mxCellPath.create(l),l=this.vertexMapper[l]),null!=l&&n[a]!=l&&(0==(o.target=l).connectsAsTarget.length&&(l.connectsAsTarget=[]),mxUtils.indexOf(l.connectsAsTarget,o)<0&&l.connectsAsTarget.push(o))}}n[a].temp[0]=1}}function mxHierarchicalLayoutStage(){}function mxMedianHybridCrossingReduction(e){this.layout=e}function MedianCellSorter(){}function mxMinimumCycleRemover(e){this.layout=e}function mxCoordinateAssignment(e,t,n,a,i,s){this.layout=e,this.intraCellSpacing=t,this.interRankCellSpacing=n,this.orientation=a,this.initialX=i,this.parallelEdgeSpacing=s}!function(){function e(e,t,n,a,i,s,o,r,l,d){t=1.118*i*l,r=1.118*s*l,i*=o+l,s*=o+l;var c=a.clone();return c.x-=t,c.y-=r,o=n!=mxConstants.ARROW_CLASSIC?1:.75,a.x+=-i*o-t,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),n==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 t(e,t,n,a,i,s,o,r,l,d){r=n==mxConstants.ARROW_DIAMOND?.7071:.9862,t=i*l*r,r*=s*l,i*=o+l,s*=o+l;var c=a.clone();c.x-=t,c.y-=r,a.x+=-i-t,a.y+=-s-r;var m=n==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,t,n,a,i,s,o,r,l,d){t=1.118*i*l,n=1.118*s*l,i*=o+l,s*=o+l;var c=a.clone();return c.x-=t,c.y-=n,a.x+=2*-t,a.y+=2*-n,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,t,n,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",t),mxMarker.addMarker("diamondThin",t)}(),mxUtils.extend(mxActor,mxShape),mxActor.prototype.paintVertexShape=function(e,t,n,a,i){e.translate(t,n),e.begin(),this.redrawPath(e,t,n,a,i),e.fillAndStroke()},mxActor.prototype.redrawPath=function(e,t,n,a,i){t=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-t,2*i/5,a/2-t,0,a/2,0),e.curveTo(a/2+t,0,a/2+t,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,t,n,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,t,n,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(t,n,a,i,s,s)}else e.rect(t,n,a,i);e.fillAndStroke()},mxRectangleShape.prototype.paintForeground=function(e,t,n,a,i){this.glass&&this.paintGlassEffect(e,t,n,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 t=9<=document.documentMode?0:Math.ceil(this.strokewidth*this.scale);e.style.borderWidth=Math.max(1,t)+"px",e.style.overflow="hidden",e.style.left=Math.round(this.bounds.x-t/2)+"px",e.style.top=Math.round(this.bounds.y-t/2)+"px","CSS1Compat"==document.compatMode&&(t=-t),e.style.width=Math.round(Math.max(0,this.bounds.width+t))+"px",e.style.height=Math.round(Math.max(0,this.bounds.height+t))+"px"},mxRectangleShape.prototype.updateHtmlColors=function(e){var t=this.stroke;null!=t&&t!=mxConstants.NONE?(e.style.borderColor=t,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!=(t=this.fill)&&t!=mxConstants.NONE?(e.style.backgroundColor=t,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 t="";if(this.opacity<100&&(t+="alpha(opacity="+this.opacity+")"),this.isShadow&&(t+="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 n=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=n,n=a,a=s):2==o?(s=n,n=a,a=s):3==o&&(i="1"),t+="progid:DXImageTransform.Microsoft.gradient(startColorStr='"+n+"', endColorStr='"+a+"', gradientType='"+i+"')"}e.style.filter=t},mxUtils.extend(mxEllipse,mxShape),mxEllipse.prototype.paintVertexShape=function(e,t,n,a,i){e.ellipse(t,n,a,i),e.fillAndStroke()},mxUtils.extend(mxDoubleEllipse,mxShape),mxDoubleEllipse.prototype.vmlScale=10,mxDoubleEllipse.prototype.paintBackground=function(e,t,n,a,i){e.ellipse(t,n,a,i),e.fillAndStroke()},mxDoubleEllipse.prototype.paintForeground=function(e,t,n,a,i){var s=Math.min(4,Math.min(a/5,i/5));i-=2*s,0<(a-=2*s)&&0<i&&e.ellipse(t+s,n+s,a,i),e.stroke()},mxUtils.extend(mxRhombus,mxShape),mxRhombus.prototype.paintVertexShape=function(e,t,n,a,i){var s=a/2,o=i/2;e.begin(),e.moveTo(t+s,n),e.lineTo(t+a,n+o),e.lineTo(t+s,n+i),e.lineTo(t,n+o),e.close(),e.fillAndStroke()},mxUtils.extend(mxPolyline,mxShape),mxPolyline.prototype.getRotation=function(){return 0},mxPolyline.prototype.paintEdgeShape=function(e,t){this.paintLine(e,t,this.isRounded)},mxPolyline.prototype.paintLine=function(e,t,n){var a=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,mxConstants.LINE_ARCSIZE)/2,i=t[0],s=t[t.length-1];e.begin(),e.moveTo(i.x,i.y);for(var o=1;o<t.length-1;o++){var r=t[o],l=i.x-r.x;i=i.y-r.y;if(n&&o<t.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=t[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,t){var n=mxConstants.ARROW_SPACING,a=mxConstants.ARROW_WIDTH,i=mxConstants.ARROW_SIZE,s=t[0],o=t[t.length-1],r=o.x-s.x,l=o.y-s.y,d=(c=Math.sqrt(r*r+l*l))-2*n-i,c=(r=r/c,a*(l=l/c)/3),m=(a=-a*r/3,(i=s.x-c/2+n*r)+c),u=(s=s.y-a/2+n*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-n*r,o.y-n*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 t=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 n=null,a=null;if(null!=e.ownerSVGElement)if(null!=e.firstChild&&null!=e.firstChild.firstChild&&"foreignObject"==e.firstChild.firstChild.nodeName)e=e.firstChild.firstChild,n=this.wrap?this.bounds.width:parseInt(e.getAttribute("width"))*this.scale,a=parseInt(e.getAttribute("height"))*this.scale;else{if(0==(t=e.getBBox()).width&&0==t.height)return;this.boundingBox=new mxRectangle(t.x,t.y,t.width,t.height),t=0}else a=this.state.view.textDiv,a=null!=this.offsetWidth&&null!=this.offsetHeight?(n=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:(n=this.replaceLinefeeds?this.value.replace(/\n/g,"<br/>"):this.value,a.innerHTML=n),n=this.wrap?this.bounds.width:a.offsetWidth*this.scale,a.offsetHeight*this.scale):(n=this.wrap?this.bounds.width:e.offsetWidth*this.scale,e.offsetHeight*this.scale);null!=n&&null!=a&&(this.boundingBox=new mxRectangle(this.bounds.x+this.margin.x*n,this.bounds.y+this.margin.y*a,n,a))}null!=this.boundingBox&&(0!=t&&(t=mxUtils.getBoundingBox(this.boundingBox,t),this.boundingBox.x=t.x,this.boundingBox.y=t.y,mxClient.IS_QUIRKS||(this.boundingBox.width=t.width,this.boundingBox.height=t.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,t,n,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 t=this.scale,n=this.bounds.x/t,a=this.bounds.y/t,i=this.bounds.width/t;t=this.bounds.height/t;this.updateTransform(e,n,a,i,t),this.configureCanvas(e,n,a,i,t);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(n,a,i,t,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(),t=this.node.style,n=this.margin.x,a=this.margin.y;0!=e?(t[mxClient.CSS_PREFIX+"TransformOrigin"]=100*-n+"% "+100*-a+"%",t[mxClient.CSS_PREFIX+"Transform"]="translate("+100*n+"%,"+100*a+"%)scale("+this.scale+") rotate("+e+"deg)"):(t[mxClient.CSS_PREFIX+"TransformOrigin"]="0% 0%",t[mxClient.CSS_PREFIX+"Transform"]="scale("+this.scale+")translate("+100*n+"%,"+100*a+"%)"),t.left=Math.round(this.bounds.x)+"px",t.top=Math.round(this.bounds.y)+"px"},mxText.prototype.updateHtmlFilter=function(){var e=this.node.style,t=this.margin.x,n=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*(t=r*-(t+.5))-s*(n=o*-(n+.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*t-l*n)-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 t=null!=this.background&&this.background!=mxConstants.NONE?this.background:null,n=null!=this.border&&this.border!=mxConstants.NONE?this.border:null;if(null!=t||null!=n)if("fill"==this.overflow)null!=t&&(this.node.style.backgroundColor=t),null!=n&&(this.node.style.border="1px solid "+n);else{var a="";null!=t&&(a+="background-color:"+t+";"),null!=n&&(a+="border:1px solid "+n+";"),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 t=Math.round(this.bounds.width/this.scale),n=Math.round(this.bounds.height/this.scale);e=e.style,this.clipped?(e.overflow="hidden",0<n&&(e.maxHeight=n+"px"),0<t&&(e.width=t+"px")):"fill"==this.overflow&&(e.width=t+"px",0<n&&(e.maxHeight=n+"px")),this.wrap?(!this.clipped&&0<t&&(e.width=t+"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,t,n,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,t,n,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,t,n,a,i){n+=i/2,e.begin(),e.moveTo(t,n),e.lineTo(t+a,n),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,t,n,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(t,n,a,i),e.fillAndStroke()),e.image(t,n,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 t=this.opacity<100?"alpha(opacity="+this.opacity+")":"";this.node.style.filter=t,this.flipH&&this.flipV?t+="progid:DXImageTransform.Microsoft.BasicImage(rotation=2)":this.flipH?t+="progid:DXImageTransform.Microsoft.BasicImage(mirror=1)":this.flipV&&(t+="progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)"),e.style.filter!=t&&(e.style.filter=t),"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,t,n,a,i){this.paintImage(e,t,n,a,i),this.paintIndicator(e,t,n,a,i),mxRectangleShape.prototype.paintForeground.apply(this,arguments)},mxLabel.prototype.paintImage=function(e,t,n,a,i){null!=this.image&&(t=this.getImageBounds(t,n,a,i),e.image(t.x,t.y,t.width,t.height,this.image,!1,!1,!1))},mxLabel.prototype.getImageBounds=function(e,t,n,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+(n-o)/2:i==mxConstants.ALIGN_RIGHT?e+(n-o-l):e+l,t=s==mxConstants.ALIGN_TOP?t+l:s==mxConstants.ALIGN_BOTTOM?t+(a-r-l):t+(a-r)/2,o,r)},mxLabel.prototype.paintIndicator=function(e,t,n,a,i){null!=this.indicator?(this.indicator.bounds=this.getIndicatorBounds(t,n,a,i),this.indicator.paint(e)):null!=this.indicatorImage&&(t=this.getIndicatorBounds(t,n,a,i),e.image(t.x,t.y,t.width,t.height,this.indicatorImage,!1,!1,!1))},mxLabel.prototype.getIndicatorBounds=function(e,t,n,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+(n-o-l):i==mxConstants.ALIGN_CENTER?e+(n-o)/2:e+l,t=s==mxConstants.ALIGN_BOTTOM?t+(a-r-l):s==mxConstants.ALIGN_TOP?t+l:t+(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 t=this.getImageBounds(this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height);t.x-=this.bounds.x,t.y-=this.bounds.y,e.style.left=Math.round(t.x)+"px",e.style.top=Math.round(t.y)+"px",e.style.width=Math.round(t.width)+"px",e.style.height=Math.round(t.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,t,n,a,i){e.translate(t,n),e.begin(),this.redrawPath(e,t,n,a,i,!1),e.fillAndStroke(),e.setShadow(!1),e.begin(),this.redrawPath(e,t,n,a,i,!0),e.stroke()},mxCylinder.prototype.redrawPath=function(e,t,n,a,i,s){t=Math.min(this.maxHeight,Math.round(i/5)),(s&&null!=this.fill||!s&&null==this.fill)&&(e.moveTo(0,t),e.curveTo(0,2*t,a,2*t,a,t),s||(e.stroke(),e.begin())),s||(e.moveTo(0,t),e.curveTo(0,-t/3,a,-t/3,a,t),e.lineTo(a,i-t),e.curveTo(a,i+t/3,0,i+t/3,0,i-t),e.close())},mxUtils.extend(mxConnector,mxPolyline),mxConnector.prototype.paintEdgeShape=function(e,t){var n=this.createMarker(e,t,!0),a=this.createMarker(e,t,!1);null==this.style||1!=this.style[mxConstants.STYLE_CURVED]?this.paintLine(e,t,this.isRounded):this.paintCurvedLine(e,t),e.setFillColor(this.stroke),e.setShadow(!1),e.setDashed(!1),null!=n&&n(),null!=a&&a()},mxConnector.prototype.paintCurvedLine=function(e,t){e.begin();var n=t[0],a=t.length;for(e.moveTo(n.x,n.y),n=1;n<a-2;n++){var i=t[n],s=t[n+1];e.quadTo(i.x,i.y,(i.x+s.x)/2,(i.y+s.y)/2)}i=t[a-2],s=t[a-1],e.quadTo(i.x,i.y,s.x,s.y),e.stroke()},mxConnector.prototype.createMarker=function(e,t,n){var a=t.length,i=n?t[1]:t[a-2],s=(a=(t=n?t[0]:t[a-1]).x-i.x,t.y-i.y),o=(i=a/(o=Math.max(1,Math.sqrt(a*a+s*s))),a=s/o,s=mxUtils.getNumber(this.style,n?mxConstants.STYLE_STARTSIZE:mxConstants.STYLE_ENDSIZE,mxConstants.DEFAULT_MARKERSIZE),mxUtils.getValue(this.style,n?mxConstants.STYLE_STARTARROW:mxConstants.STYLE_ENDARROW));return mxMarker.createMarker(e,this,o,t,i,a,s,n,this.strokewidth,0!=this.style[n?mxConstants.STYLE_STARTFILL:mxConstants.STYLE_ENDFILL])},mxConnector.prototype.augmentBoundingBox=function(e){mxShape.prototype.augmentBoundingBox.apply(this,arguments);var t=0;mxUtils.getValue(this.style,mxConstants.STYLE_STARTARROW,mxConstants.NONE)!=mxConstants.NONE&&(t=mxUtils.getNumber(this.style,mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_MARKERSIZE)+1),mxUtils.getValue(this.style,mxConstants.STYLE_ENDARROW,mxConstants.NONE)!=mxConstants.NONE&&(t=Math.max(t,mxUtils.getNumber(this.style,mxConstants.STYLE_ENDSIZE,mxConstants.DEFAULT_MARKERSIZE))+1),e.grow(Math.ceil(t*this.scale))},mxUtils.extend(mxSwimlane,mxShape),mxSwimlane.prototype.imageSize=16,mxSwimlane.prototype.getGradientBounds=function(e,t,n,a,i){return new mxRectangle(t,n,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,t,n){return 3*n*(mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,100*mxConstants.RECTANGLE_ROUNDING_FACTOR)/100)},mxSwimlane.prototype.paintVertexShape=function(e,t,n,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(t,n),this.isRounded?(l=this.getArcSize(a,i,s),this.paintRoundedSwimlane(e,t,n,a,i,s,l,o,r)):this.paintSwimlane(e,t,n,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(t,s,a,i),e.image(i.x-t,i.y-n,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,t,n,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,t,n,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,t,n,a,i){i!=mxConstants.NONE&&(e.setStrokeColor(i),e.setDashed(!0),e.begin(),e.moveTo(t,n),e.lineTo(t,a),e.stroke(),e.setDashed(!1))},mxSwimlane.prototype.getImageBounds=function(e,t,n,a){return new mxRectangle(e+n-this.imageSize,t,this.imageSize,this.imageSize)},mxGraphLayout.prototype.graph=null,mxGraphLayout.prototype.useBoundingBox=!0,mxGraphLayout.prototype.parent=null,mxGraphLayout.prototype.moveCell=function(e,t,n){},mxGraphLayout.prototype.execute=function(e){},mxGraphLayout.prototype.getGraph=function(){return this.graph},mxGraphLayout.prototype.getConstraint=function(e,t,n,a){return null!=(t=null!=(n=this.graph.view.getState(t))?n.style:this.graph.getCellStyle(t))?t[e]:null},mxGraphLayout.traverse=function(e,t,n,a,i){if(null!=n&&null!=e){t=null==t||t,i=i||[];var s=mxCellPath.create(e);if(null==i[s]&&(null==(a=n(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;t&&!r||(r=this.graph.view.getVisibleTerminal(o,!r),this.traverse(r,t,n,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 t=this.graph.getModel();return!t.isEdge(e)||!this.graph.isCellVisible(e)||null==t.getTerminal(e,!0)||null==t.getTerminal(e,!1)},mxGraphLayout.prototype.setEdgeStyleEnabled=function(e,t){this.graph.setCellStyles(mxConstants.STYLE_NOEDGESTYLE,t?"0":"1",[e])},mxGraphLayout.prototype.setOrthogonalEdge=function(e,t){this.graph.setCellStyles(mxConstants.STYLE_ORTHOGONAL,t?"1":"0",[e])},mxGraphLayout.prototype.getParentOffset=function(e){var t=new mxPoint;if(null!=e&&e!=this.parent){var n=this.graph.getModel();if(n.isAncestor(this.parent,e))for(var a=n.getGeometry(e);e!=this.parent;)t.x+=a.x,t.y+=a.y,e=n.getParent(e),a=n.getGeometry(e)}return t},mxGraphLayout.prototype.setEdgePoints=function(e,t){if(null!=e){var n=this.graph.model,a=n.getGeometry(e);if(null==a?(a=new mxGeometry).setRelative(!0):a=a.clone(),null!=this.parent&&null!=t)for(var i=n.getParent(e),s=(i=this.getParentOffset(i),0);s<t.length;s++)t[s].x-=i.x,t[s].y-=i.y;a.points=t,n.setGeometry(e,a)}},mxGraphLayout.prototype.setVertexLocation=function(e,t,n){var a=this.graph.getModel(),i=a.getGeometry(e),s=null;if(null!=i){if(s=new mxRectangle(t,n,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&&(t+=(o.x-l.x)/r,s.width=l.width),o.text.boundingBox.y<o.y&&(n+=(o.y-l.y)/r,s.height=l.height)}}null!=this.parent&&(null!=(o=a.getParent(e))&&o!=this.parent&&(t-=(o=this.getParentOffset(o)).x,n-=o.y)),i.x==t&&i.y==n||((i=i.clone()).x=t,i.y=n,a.setGeometry(e,i))}return s},mxGraphLayout.prototype.getVertexBounds=function(e){var t=this.graph.getModel().getGeometry(e);if(this.useBoundingBox&&(null!=(r=this.graph.getView().getState(e))&&null!=r.text&&null!=r.text.boundingBox)){var n=this.graph.getView().scale,a=r.text.boundingBox,i=Math.max(r.x-a.x,0)/n,s=Math.max(r.y-a.y,0)/n,o=Math.max(a.x+a.width-(r.x+r.width),0)/n,r=Math.max(a.y+a.height-(r.y+r.height),0)/n;t=new mxRectangle(t.x-i,t.y-s,t.width+i+o,t.height+s+r)}return null!=this.parent&&(e=this.graph.getModel().getParent(e),t=t.clone(),null!=e&&e!=this.parent&&(e=this.getParentOffset(e),t.x+=e.x,t.y+=e.y)),new mxRectangle(t.x,t.y,t.width,t.height)},mxGraphLayout.prototype.arrangeGroups=function(e,t){this.graph.getModel().beginUpdate();try{for(var n=e.length-1;0<=n;n--){var a=e[n],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-t-r,o.y=o.y+s.y-t-l,o.width=s.width+2*t+r,o.height=s.height+2*t+l,this.graph.getModel().setGeometry(a,o),this.graph.moveCells(i,t+r-s.x,t+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,t,n){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(t=s?t:n,null!=(o=this.graph.getView().getState(i))&&(t-=s?o.x:o.y),o=0;o<l;o++)if((n=a.getChildAt(i,o))!=e&&null!=(n=a.getGeometry(n))){if(n=s?n.x+n.width/2:n.y+n.height/2,r<t&&t<n)break;r=n}s=i.getIndex(e),s=Math.max(0,o-(s<o?1:0)),a.add(i,e,s)}},mxStackLayout.prototype.getParentSize=function(e){var t=this.graph.getModel(),n=t.getGeometry(e);return null!=this.graph.container&&(null==n&&t.isLayer(e)||e==this.graph.getView().currentRoot)&&(n=new mxRectangle(0,0,this.graph.container.offsetWidth-1,this.graph.container.offsetHeight-1)),n},mxStackLayout.prototype.execute=function(e){if(null!=e){var t=this.isHorizontal(),n=this.graph.getModel(),a=this.getParentSize(e),i=0;null!=a&&(i=t?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);t==(r=mxUtils.getValue(r,mxConstants.STYLE_HORIZONTAL,!0))&&(i-=l),t?o+=l:s+=l}n.beginUpdate();try{l=0,r=null;for(var d=n.getChildCount(e),c=0;c<d;c++){var m=n.getChildAt(e,c);if(!this.isVertexIgnored(m)&&this.isVertexMovable(m)){var u=n.getGeometry(m);null!=u&&(u=u.clone(),null!=this.wrap&&null!=r&&(t&&r.x+r.width+u.width+2*this.spacing>this.wrap||!t&&r.y+r.height+u.height+2*this.spacing>this.wrap)&&(r=null,t?o+=l+this.spacing:s+=l+this.spacing,l=0),l=Math.max(l,t?u.height:u.width),null!=r?t?u.x=r.x+r.width+this.spacing:u.y=r.y+r.height+this.spacing:this.keepFirstLocation||(t?u.x=s:u.y=o),t?u.y=o:u.x=s,this.fill&&0<i&&(t?u.height=i:u.width=i),n.setGeometry(m,u),r=u)}}this.resizeParent&&null!=a&&null!=r&&!this.graph.isCellCollapsed(e)?(a=a.clone(),t?a.width=r.x+r.width+this.spacing:a.height=r.y+r.height+this.spacing,n.setGeometry(e,a)):this.resizeLast&&null!=a&&null!=r&&(t?r.width=a.width-r.x-this.spacing:r.height=a.height-r.y-this.spacing)}finally{n.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,t,n){var a=(n=this.graph.getModel()).getParent(e);if(null!=e&&null!=a){var i=0,s=0,o=n.getChildCount(a);for(i=0;i<o;i++){var r=n.getChildAt(a,i);if(null!=(r=this.getVertexBounds(r))){if(r=r.x+r.width/2,s<t&&t<r)break;s=r}}t=a.getIndex(e),t=Math.max(0,i-(t<i?1:0)),n.add(a,e,t)}},mxPartitionLayout.prototype.execute=function(e){var t=this.isHorizontal(),n=this.graph.getModel(),a=n.getGeometry(e);if(null!=this.graph.container&&(null==a&&n.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=n.getChildCount(e),o=0;o<s;o++){var r=n.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=t?a.height:a.width)-2*this.border;if(e=this.graph.isSwimlane(e)?this.graph.getStartSize(e):new mxRectangle,c-=t?e.height:e.width,l+=e.width,d+=e.height,e=this.border+(s-1)*this.spacing,0<(a=t?(a.width-l-e)/s:(a.height-d-e)/s)){n.beginUpdate();try{for(o=0;o<s;o++){r=i[o];var m=n.getGeometry(r);null!=m&&((m=m.clone()).x=l,m.y=d,t?(this.resizeVertices&&(m.width=a,m.height=c),l+=a+this.spacing):(this.resizeVertices&&(m.height=a,m.width=c),d+=a+this.spacing),n.setGeometry(r,m))}}finally{n.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,t){this.parent=e;var n=this.graph.getModel();if(null==t)if(0<this.graph.getEdges(e,n.getParent(e),this.invert,!this.invert,!1).length)t=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){t=o[a];break}}if(null!=t){this.parentsChanged=this.resizeParent?{}:null,n.beginUpdate();try{var i=this.dfs(t,e);if(null!=i){this.layout(i);var s=this.graph.gridSize,o=s;if(!this.moveTree){var r=this.getVertexBounds(t);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{n.endUpdate()}}},mxCompactTreeLayout.prototype.moveNode=function(e,t,n){for(e.x+=t,e.y+=n,this.apply(e),e=e.child;null!=e;)this.moveNode(e,t,n),e=e.next},mxCompactTreeLayout.prototype.dfs=function(e,t,n){n=null!=n?n:[];var a=mxCellPath.create(e),i=null;if(null!=e&&null==n[a]&&!this.isVertexIgnored(e)){n[a]=e;i=this.createNode(e),a=this.graph.getModel();var s=null;e=this.graph.getEdges(e,t,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,t,n))&&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 t=e.child;null!=t;)this.layout(t),t=t.next;null!=e.child?this.attachParent(e,this.join(e)):this.layoutLeaf(e)}},mxCompactTreeLayout.prototype.horizontalLayout=function(e,t,n,a){if(e.x+=t+e.offsetX,e.y+=n+e.offsetY,a=this.apply(e,a),null!=(t=e.child)){a=this.horizontalLayout(t,e.x,e.y,a),n=e.y+t.offsetY;for(var i=t.next;null!=i;)a=this.horizontalLayout(i,e.x+t.offsetX,n,a),n+=i.offsetY,i=i.next}return a},mxCompactTreeLayout.prototype.verticalLayout=function(e,t,n,a,i){if(e.x+=n+e.offsetY,e.y+=a+e.offsetX,i=this.apply(e,i),null!=(t=e.child))for(i=this.verticalLayout(t,e,e.x,e.y,i),n=e.x+t.offsetY,a=t.next;null!=a;)i=this.verticalLayout(a,e,n,e.y+t.offsetX,i),n+=a.offsetY,a=a.next;return i},mxCompactTreeLayout.prototype.attachParent=function(e,t){var n=this.nodeDistance+this.levelDistance,a=(t-e.width)/2-this.nodeDistance,i=a+e.width+2*this.nodeDistance-t;e.child.offsetX=n+e.height,e.child.offsetY=i,e.contour.upperHead=this.createLine(e.height,0,this.createLine(n,i,e.contour.upperHead)),e.contour.lowerHead=this.createLine(e.height,0,this.createLine(n,a,e.contour.lowerHead))},mxCompactTreeLayout.prototype.layoutLeaf=function(e){var t=2*this.nodeDistance;e.contour.upperTail=this.createLine(e.height+t,0),e.contour.upperHead=e.contour.upperTail,e.contour.lowerTail=this.createLine(0,-e.width-t),e.contour.lowerHead=this.createLine(e.height+t,0,e.contour.lowerTail)},mxCompactTreeLayout.prototype.join=function(e){var t=2*this.nodeDistance,n=e.child;e.contour=n.contour;var a=n.width+t,i=a;for(n=n.next;null!=n;){var s=this.merge(e.contour,n.contour);n.offsetY=s+a,n.offsetX=0,i+=s+(a=n.width+t),n=n.next}return i},mxCompactTreeLayout.prototype.merge=function(e,t){for(var n=0,a=0,i=0,s=e.lowerHead,o=t.upperHead;null!=o&&null!=s;){var r=this.offset(n,a,o.dx,o.dy,s.dx,s.dy);a=a+r,i=i+r;n+o.dx<=s.dx?(n+=o.dx,a+=o.dy,o=o.next):(n-=s.dx,a-=s.dy,s=s.next)}return null!=o?(n=this.bridge(e.upperTail,0,0,o,n,a),e.upperTail=null!=n.next?t.upperTail:n,e.lowerTail=t.lowerTail):null==(n=this.bridge(t.lowerTail,n,a,s,0,0)).next&&(e.lowerTail=n),e.lowerHead=t.lowerHead,i},mxCompactTreeLayout.prototype.offset=function(e,t,n,a,i,s){var o;return i<=e||e+n<=0?0:0<(o=0<i*a-n*s?e<0?e*a/n-t:0<e?e*s/i-t:-t:i<e+n?s-(t+(i-e)*a/n):e+n<i?(n+e)*s/i-(t+a):s-(t+a))?o:0},mxCompactTreeLayout.prototype.bridge=function(e,t,n,a,i,s){return t=i+a.dx-t,i=i=0,0==a.dx?i=a.dy:(i=t*a.dy,i/=a.dx),t=this.createLine(t,i,a.next),e.next=this.createLine(0,s+a.dy-i-n,t),t},mxCompactTreeLayout.prototype.createNode=function(e){var t={};return t.cell=e,t.x=0,t.y=0,t.width=0,t.height=0,null!=(e=this.getVertexBounds(e))&&(this.isHorizontal()?(t.width=e.height,t.height=e.width):(t.width=e.width,t.height=e.height)),t.offsetX=0,t.offsetY=0,t.contour={},t},mxCompactTreeLayout.prototype.apply=function(e,t){var n=this.graph.getModel(),a=e.cell,i=n.getGeometry(a);return null!=a&&null!=i&&(this.isVertexMovable(a)&&(i=this.setVertexLocation(a,e.x,e.y),this.resizeParent&&(n=n.getParent(a),a=mxCellPath.create(n),null==this.parentsChanged[a]&&(this.parentsChanged[a]=n))),t=null==t?new mxRectangle(i.x,i.y,i.width,i.height):new mxRectangle(Math.min(t.x,i.x),Math.min(t.y,i.y),Math.max(t.x+t.width,i.x+i.width),Math.max(t.y+t.height,i.y+i.height))),t},mxCompactTreeLayout.prototype.createLine=function(e,t,n){var a={};return a.dx=e,a.dy=t,a.next=n,a},mxCompactTreeLayout.prototype.adjustParents=function(){var e,t=[];for(e in this.parentsChanged)t.push(this.parentsChanged[e]);this.arrangeGroups(mxUtils.sortCells(t,!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 t=e.child,n=e.cell,a=0,i=[];null!=t;){a++;var s=t.x;this.horizontal&&(s=t.y),i.push(new WeightedCellSorter(t,s)),t=t.next}i.sort(WeightedCellSorter.prototype.compare),(s=e.width)>(o=(a+1)*this.prefHozEdgeSep)+2*this.prefHozEdgeSep&&(s-=2*this.prefHozEdgeSep),t=(e=s/a)/2,s>o+2*this.prefHozEdgeSep&&(t+=this.prefHozEdgeSep);s=this.minEdgeJetty-this.prefVertEdgeOff;for(var o=0,r=this.getVertexBounds(n),l=0;l<i.length;l++){for(var d=i[l].cell.cell,c=this.getVertexBounds(d),m=(d=this.graph.getEdgesBetween(n,d,!1),[]),u=0,p=0,g=0;g<d.length;g++)this.horizontal?(u=r.x+r.width,p=r.y+t,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+t,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),t+=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,t){return null!=e&&null!=t?t.weightedValue>e.weightedValue?1:t.weightedValue<e.weightedValue?-1:t.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 t=this.graph.getModel();this.vertexArray=[];for(var n=this.graph.getChildVertices(e),a=0;a<n.length;a++)this.isVertexIgnored(n[a])||this.vertexArray.push(n[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]}t.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);n=this.graph.getOpposites(p,this.vertexArray[a]);for(this.neighbours[a]=[],d=0;d<n.length;d++){this.resetEdges&&this.graph.resetEdge(p[d]),this.disableEdgeStyle&&this.setEdgeStyleEnabled(p[d],!1);r=mxCellPath.create(n[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=n=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),n=null==n?m:Math.min(n,m),e=null==e?u:Math.min(e,u)));a=1-(n||0),o=1-(e||0),null!=i&&(a+=i.x,o+=i.y),this.graph.moveCells(this.vertexArray,a,o)}finally{t.endUpdate()}},mxFastOrganicLayout.prototype.calcPositions=function(){for(var e=0;e<this.vertexArray.length;e++)if(this.isMoveable[e]){(n=Math.sqrt(this.dispX[e]*this.dispX[e]+this.dispY[e]*this.dispY[e]))<.001&&(n=.001);var t=this.dispX[e]/n*Math.min(n,this.temperature),n=this.dispY[e]/n*Math.min(n,this.temperature);this.dispX[e]=0,this.dispY[e]=0,this.cellLocation[e][0]+=t,this.cellLocation[e][1]+=n}},mxFastOrganicLayout.prototype.calcAttraction=function(){for(var e=0;e<this.vertexArray.length;e++)for(var t=0;t<this.neighbours[e].length;t++){var n=this.neighbours[e][t];if(e!=n&&this.isMoveable[e]&&this.isMoveable[n]){(a=(s=this.cellLocation[e][0]-this.cellLocation[n][0])*s+(o=this.cellLocation[e][1]-this.cellLocation[n][1])*o-this.radiusSquared[e]-this.radiusSquared[n])<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[n]+=s,this.dispY[n]+=o}}},mxFastOrganicLayout.prototype.calcRepulsion=function(){for(var e=this.vertexArray.length,t=0;t<e;t++)for(var n=t;n<e;n++){if(!this.allowedToRun)return;if(n!=t&&this.isMoveable[t]&&this.isMoveable[n]){var a=this.cellLocation[t][0]-this.cellLocation[n][0],i=this.cellLocation[t][1]-this.cellLocation[n][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[t]-this.radius[n];o>this.maxDistanceLimit||(o<this.minDistanceLimit&&(o=this.minDistanceLimit),a=a/s*(o=this.forceConstantSquared/o),i=i/s*o,this.dispX[t]+=a,this.dispY[t]+=i,this.dispX[n]-=a,this.dispY[n]-=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 t=this.graph.getModel();t.beginUpdate();try{for(var n=0,a=null,i=null,s=[],o=t.getChildCount(e),r=0;r<o;r++){var l=t.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),n=Math.max(n,Math.max(d.width,d.height))}}var c=this.getRadius(s.length,n);this.moveCircle&&(i=this.x0,a=this.y0),this.circle(s,c,i,a)}finally{t.endUpdate()}},mxCircleLayout.prototype.getRadius=function(e,t){return Math.max(e*t/Math.PI,this.radius)},mxCircleLayout.prototype.circle=function(e,t,n,a){for(var i=e.length,s=2*Math.PI/i,o=0;o<i;o++)this.isVertexMovable(e[o])&&this.setVertexLocation(e[o],n+t+t*Math.sin(o*s),a+t+t*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 t in e){var n=e[t];1<n.length&&this.layout(n)}}finally{this.graph.model.endUpdate()}},mxParallelEdgeLayout.prototype.findParallels=function(e){for(var t=this.graph.getModel(),n=[],a=t.getChildCount(e),i=0;i<a;i++){var s=t.getChildAt(e,i);if(!this.isEdgeIgnored(s)){var o=this.getEdgeId(s);null!=o&&(null==n[o]&&(n[o]=[]),n[o].push(s))}}return n},mxParallelEdgeLayout.prototype.getEdgeId=function(e){var t=this.graph.getView(),n=t.getState(e),a=null!=n?n.getVisibleTerminal(!0):t.getVisibleTerminal(e,!0);return e=null!=n?n.getVisibleTerminal(!1):t.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 t=e[0];if((o=(n=this.graph.getModel()).getGeometry(n.getTerminal(t,!0)))==(s=n.getGeometry(n.getTerminal(t,!1)))){t=o.x+o.width+this.spacing;for(var n=o.y+o.height/2,a=0;a<e.length;a++)this.route(e[a],t,n),t+=this.spacing}else if(null!=o&&null!=s){t=o.x+o.width/2,n=o.y+o.height/2,a=s.x+s.width/2-t;var i=s.y+s.height/2-n,s=Math.sqrt(a*a+i*i),o=i*this.spacing/s;for(s=a*this.spacing/s,t=t+a/2+o*(e.length-1)/2,n=n+i/2-s*(e.length-1)/2,a=0;a<e.length;a++)this.route(e[a],t,n),t-=o,n+=s}},mxParallelEdgeLayout.prototype.route=function(e,t,n){this.graph.isCellMovable(e)&&this.setEdgePoints(e,[new mxPoint(t,n)])},mxCompositeLayout.prototype=new mxGraphLayout,mxCompositeLayout.prototype.constructor=mxCompositeLayout,mxCompositeLayout.prototype.layouts=null,mxCompositeLayout.prototype.master=null,mxCompositeLayout.prototype.moveCell=function(e,t,n){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 t=this.graph.getModel();t.beginUpdate();try{for(var n=0;n<this.layouts.length;n++)this.layouts[n].execute.apply(this.layouts[n],arguments)}finally{t.endUpdate()}},mxEdgeLabelLayout.prototype=new mxGraphLayout,mxEdgeLabelLayout.prototype.constructor=mxEdgeLabelLayout,mxEdgeLabelLayout.prototype.execute=function(e){for(var t=this.graph.view,n=this.graph.getModel(),a=[],i=[],s=n.getChildCount(e),o=0;o<s;o++){var r=n.getChildAt(e,o),l=t.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,t){var n=this.graph.getModel();n.beginUpdate();try{for(var a=0;a<t.length;a++){var i=t[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{n.endUpdate()}},mxEdgeLabelLayout.prototype.avoid=function(e,t){var n=this.graph.getModel(),a=e.text.boundingBox;if(mxUtils.intersects(a,t)){var i=-a.y-a.height+t.y,s=-a.y+t.y+t.height;i=Math.abs(i)<Math.abs(s)?i:s,s=-a.x-a.width+t.x,a=-a.x+t.x+t.width,a=Math.abs(s)<Math.abs(a)?s:a;Math.abs(a)<Math.abs(i)?i=0:a=0,null!=(s=n.getGeometry(e.cell))&&(null!=(s=s.clone()).offset?(s.offset.x+=a,s.offset.y+=i):s.offset=new mxPoint(a,i),n.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,t){return null},mxGraphAbstractHierarchyCell.prototype.setX=function(e,t){this.isVertex()?this.x[0]=t:this.isEdge()&&(this.x[e-this.minRank-1]=t)},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,t){this.isVertex()?this.y[0]=t:this.isEdge()&&(this.y[e-this.minRank-1]=t)},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 t=0;t<this.connectsAsTarget.length;t++){var n=this.connectsAsTarget[t];-1==n.maxRank||n.maxRank==e+1?this.nextLayerConnectedCells[0].push(n.source):this.nextLayerConnectedCells[0].push(n)}}return this.nextLayerConnectedCells[0]},mxGraphHierarchyNode.prototype.getPreviousLayerConnectedCells=function(e){if(null==this.previousLayerConnectedCells){this.previousLayerConnectedCells=[],this.previousLayerConnectedCells[0]=[];for(var t=0;t<this.connectsAsSource.length;t++){var n=this.connectsAsSource[t];-1==n.minRank||n.minRank==e-1?this.previousLayerConnectedCells[0].push(n.target):this.previousLayerConnectedCells[0].push(n)}}return this.previousLayerConnectedCells[0]},mxGraphHierarchyNode.prototype.isVertex=function(){return!0},mxGraphHierarchyNode.prototype.getGeneralPurposeVariable=function(e){return this.temp[0]},mxGraphHierarchyNode.prototype.setGeneralPurposeVariable=function(e,t){this.temp[0]=t},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 t=0;t<this.hashCode.length;t++)if(this.hashCode[t]!=e.hashCode[t])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 t=0;t<this.temp.length;t++)this.nextLayerConnectedCells[t]=[],t==this.temp.length-1?this.nextLayerConnectedCells[t].push(this.source):this.nextLayerConnectedCells[t].push(this)}return this.nextLayerConnectedCells[e-this.minRank-1]},mxGraphHierarchyEdge.prototype.getPreviousLayerConnectedCells=function(e){if(null==this.previousLayerConnectedCells){this.previousLayerConnectedCells=[];for(var t=0;t<this.temp.length;t++)this.previousLayerConnectedCells[t]=[],0==t?this.previousLayerConnectedCells[t].push(this.target):this.previousLayerConnectedCells[t].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,t){this.temp[e-this.minRank-1]=t},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,t,n){for(var a=e.getGraph(),i=0;i<t.length;i++){n[i]=new mxGraphHierarchyNode(t[i]);var s=mxCellPath.create(t[i]);this.vertexMapper[s]=n[i],s=e.getEdges(t[i]),n[i].connectsAsSource=[];for(var o=0;o<s.length;o++){if((d=e.getVisibleTerminal(s[o],!1))!=t[i]&&d!=t[i]&&e.graph.model.isVertex(d)&&!e.isVertexIgnored(d)){var r=e.getEdgesBetween(t[i],d,!1),l=e.getEdgesBetween(t[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=n[i],mxUtils.indexOf(n[i].connectsAsSource,l)<0&&n[i].connectsAsSource.push(l)}}}n[i].temp[0]=0}},mxGraphHierarchyModel.prototype.initialRank=function(){var e=[];if(null!=this.roots)for(var t=0;t<this.roots.length;t++){var n=mxCellPath.create(this.roots[t]);null!=(n=this.vertexMapper[n])&&e.push(n)}for(var a in this.vertexMapper)(n=this.vertexMapper[a]).temp[0]=-1;for(var i=e.slice();0<e.length;){var s,o;s=(n=e[0]).connectsAsTarget,o=n.connectsAsSource;var r=!0,l=this.SOURCESCANSTARTRANK;for(t=0;t<s.length;t++){var d=s[t];if(5270620!=d.temp[0]){r=!1;break}d=d.source,l=Math.min(l,d.temp[0]-1)}if(r){if(n.temp[0]=l,this.maxRank=Math.min(this.maxRank,l),null!=o)for(t=0;t<o.length;t++)(d=o[t]).temp[0]=5270620,-1==(d=d.target).temp[0]&&(e.push(d),d.temp[0]=-2);e.shift()}else if(t=e.shift(),e.push(n),t==n&&1==e.length)break}for(a in this.vertexMapper)(n=this.vertexMapper[a]).temp[0]-=this.maxRank;for(t=0;t<i.length;t++)for(e=0,s=(n=i[t]).connectsAsSource,a=0;a<s.length;a++)d=(d=s[a]).target,n.temp[0]=Math.max(e,d.temp[0]+1),e=n.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 t=null;if(null!=this.roots){var n=this.roots;for(t=[],e=0;e<n.length;e++){var a=mxCellPath.create(n[e]);t[e]=this.vertexMapper[a]}}this.visit(function(e,t,n,a,i){if(0==i&&t.maxRank<0&&t.minRank<0&&(s[t.temp[0]].push(t),t.maxRank=t.temp[0],t.minRank=t.temp[0],t.temp[0]=s[t.maxRank].length-1),null!=e&&null!=n&&1<e.maxRank-t.maxRank)for(n.maxRank=e.maxRank,n.minRank=t.maxRank,n.temp=[],n.x=[],n.y=[],e=n.minRank+1;e<n.maxRank;e++)s[e].push(n),n.setGeneralPurposeVariable(e,s[e].length-1)},t,!1,null)},mxGraphHierarchyModel.prototype.visit=function(e,t,n,a){if(null!=t){for(var i=0;i<t.length;i++){var s=t[i];null!=s&&(null==a&&(a={}),n?(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,t,n,a,i,s){if(null!=t){var o=mxCellPath.create(t.cell);if(null==i[o])for(a(e,i[o]=t,n,s,0),e=t.connectsAsSource.slice(),n=0;n<e.length;n++)o=e[n],this.dfs(t,o.target,o,a,i,s+1);else a(e,t,n,s,1)}},mxGraphHierarchyModel.prototype.extendedDfs=function(e,t,n,a,i,s,o,r){if(null!=t)if(null==e||null!=t.hashCode&&t.hashCode[0]==e.hashCode[0]||(s=e.hashCode.length+1,t.hashCode=e.hashCode.slice(),t.hashCode[s-1]=o),null==i[o=mxCellPath.create(t.cell)])for(a(e,i[o]=t,n,r,0),e=t.connectsAsSource.slice(),n=0;n<e.length;n++)o=e[n],this.extendedDfs(t,o.target,o,a,i,t.hashCode,n,r+1);else a(e,t,n,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 t=0;t<e.ranks.length;t++)this.nestedBestRanks[t]=e.ranks[t].slice();var n=0,a=this.calculateCrossings(e);for(t=0;t<this.maxIterations&&n<this.maxNoImprovementIterations;t++){this.weightedMedian(t,e),this.transpose(t,e);var i=this.calculateCrossings(e);if(i<a)for(a=i,i=n=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(n++,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(n=[],a=[],t=0;t<e.maxRank+1;t++)a[t]=[],n[t]=a[t];for(t=0;t<this.nestedBestRanks.length;t++)for(i=0;i<this.nestedBestRanks[t].length;i++)a[t].push(this.nestedBestRanks[t][i]);e.ranks=n},mxMedianHybridCrossingReduction.prototype.calculateCrossings=function(e){for(var t=e.ranks.length,n=0,a=1;a<t;a++)n+=this.calculateRankCrossing(a,e);return n},mxMedianHybridCrossingReduction.prototype.calculateRankCrossing=function(e,t){for(var n=0,a=t.ranks[e],i=a.length,s=t.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]&&n++;for(a=0;a<r;a++)for(l=c+1;l<s;l++)201207==o[a][l]&&n++}return n/2},mxMedianHybridCrossingReduction.prototype.transpose=function(e,t){for(var n=!0,a=0;n&&a++<10;)for(var i=1==e%2&&1==a%2,s=(n=!1,0);s<t.ranks.length;s++){for(var o=t.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),E=(m=[],u=[],0);E<f.length;E++)m[E]=f[E].getGeneralPurposeVariable(s+1);for(E=0;E<b.length;E++)u[E]=b[E].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=[],E=0;E<d.length;E++)p[E]=d[E].getGeneralPurposeVariable(s+1);for(E=0;E<c.length;E++)g[E]=c[E].getGeneralPurposeVariable(s-1);var A=0,y=0;for(E=0;E<m.length;E++)for(var S=0;S<p.length;S++)m[E]>p[S]&&A++,m[E]<p[S]&&y++;for(E=0;E<u.length;E++)for(S=0;S<g.length;S++)u[E]>g[S]&&A++,u[E]<g[S]&&y++;(y<A||y==A&&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||(n=!0))}}},mxMedianHybridCrossingReduction.prototype.weightedMedian=function(e,t){var n=0==e%2;if(n)for(var a=t.maxRank-1;0<=a;a--)this.medianRank(a,n);else for(a=1;a<t.maxRank;a++)this.medianRank(a,n)},mxMedianHybridCrossingReduction.prototype.medianRank=function(e,t){for(var n=this.nestedBestRanks[e].length,a=[],i=[],s=0;s<n;s++){var o,r,l=this.nestedBestRanks[e][s],d=new MedianCellSorter;d.cell=l,r=t?e+1:e-1,null!=(o=t?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<n;s++)null==i[s]&&(l=a.shift().cell).setGeneralPurposeVariable(e,s)},mxMedianHybridCrossingReduction.prototype.medianValue=function(e,t){for(var n=[],a=0,i=0;i<e.length;i++){var s=e[i];n[a++]=s.getGeneralPurposeVariable(t)}return n.sort(function(e,t){return e-t}),1==a%2?n[Math.floor(a/2)]:2==a?(n[0]+n[1])/2:(s=n[(i=a/2)-1]-n[0],a=n[a-1]-n[i],(n[i-1]*a+n[i]*s)/(s+a))},MedianCellSorter.prototype.medianValue=0,MedianCellSorter.prototype.cell=!1,MedianCellSorter.prototype.compare=function(e,t){return null!=e&&null!=t?t.medianValue>e.medianValue?-1:t.medianValue<e.medianValue?1:0:0},mxMinimumCycleRemover.prototype=new mxHierarchicalLayoutStage,mxMinimumCycleRemover.prototype.constructor=mxMinimumCycleRemover,mxMinimumCycleRemover.prototype.layout=null,mxMinimumCycleRemover.prototype.execute=function(e){var t=this.layout.getModel(),s={},o=mxUtils.clone(t.vertexMapper,null,!0),n=null;if(null!=t.roots){var a=t.roots;n=[];for(e=0;e<a.length;e++){var i=mxCellPath.create(a[e]);n[e]=t.vertexMapper[i]}}if(t.visit(function(e,t,n,a,i){t.isAncestor(e)&&(n.invert(),mxUtils.remove(n,e.connectsAsSource),e.connectsAsTarget.push(n),mxUtils.remove(n,t.connectsAsTarget),t.connectsAsSource.push(n)),e=mxCellPath.create(t.cell),s[e]=t,delete o[e]},n,!0,null),n=null,0<o.lenth&&(n=mxUtils.clone(o,null,!0)),e=mxUtils.clone(s,null,!0),t.visit(function(e,t,n,a,i){t.isAncestor(e)&&(n.invert(),mxUtils.remove(n,e.connectsAsSource),t.connectsAsSource.push(n),e.connectsAsTarget.push(n),mxUtils.remove(n,t.connectsAsTarget)),e=mxCellPath.create(t.cell),s[e]=t,delete o[e]},o,!0,e),a=this.layout.getGraph(),null!=n&&0<n.length)for(t=t.roots,e=0;e<n.length;e++)i=n[e].cell,0==a.getIncomingEdges(i).length&&t.push(i)};var mxHierarchicalEdgeStyle={ORTHOGONAL:1,POLYLINE:2,STRAIGHT:3,CURVE:4};function WeightedCellSorter(e,t){this.cell=e,this.weightedValue=t}function mxHierarchicalLayout(e,t,n){mxGraphLayout.call(this,e),this.orientation=null!=t?t:mxConstants.DIRECTION_NORTH,this.deterministic=null==n||n}function mxGraphModel(e){this.currentEdit=this.createUndoableEdit(),null!=e?this.setRoot(e):this.clear()}function mxRootChange(e,t){this.model=e,this.previous=this.root=t}function mxChildChange(e,t,n,a){this.model=e,this.previous=this.parent=t,this.child=n,this.previousIndex=this.index=a}function mxTerminalChange(e,t,n,a){this.model=e,this.cell=t,this.previous=this.terminal=n,this.source=a}function mxValueChange(e,t,n){this.model=e,this.cell=t,this.previous=this.value=n}function mxStyleChange(e,t,n){this.model=e,this.cell=t,this.previous=this.style=n}function mxGeometryChange(e,t,n){this.model=e,this.cell=t,this.previous=this.geometry=n}function mxCollapseChange(e,t,n){this.model=e,this.cell=t,this.previous=this.collapsed=n}function mxVisibleChange(e,t,n){this.model=e,this.cell=t,this.previous=this.visible=n}function mxCellAttributeChange(e,t,n){this.cell=e,this.attribute=t,this.previous=this.value=n}function mxCell(e,t,n){this.value=e,this.setGeometry(t),this.setStyle(n),null!=this.onInit&&this.onInit()}function mxGeometry(e,t,n,a){mxRectangle.call(this,e,t,n,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 t=0;t<e.ranks.length;t++){mxLog.write("Rank ",t," : ");for(var n=e.ranks[t],a=0;a<n.length;a++)mxLog.write(n[a].getGeneralPurposeVariable(t),"  ");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 t=1e8;if(this.fineTuning)for(var n=0;n<this.maxIterations;n++){if(0!=n&&(this.medianPos(n,e),this.minNode(e)),this.currentXDelta<t){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))}t=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 t=[],n=[],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,t.push(r),n[o=mxCellPath.create(o.getCoreCell())]=r}}for(e=10*t.length,s=0;0<t.length&&s<=e;){i=(r=t.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=n[l=mxCellPath.create(l.getCoreCell())])&&0==l.visited&&(l.visited=!0,t.push(l));for(i=0;i<c.length;i++)l=c[i],null!=(l=n[l=mxCellPath.create(l.getCoreCell())])&&0==l.visited&&(l.visited=!0,t.push(l))}r.visited=!1,s++}},mxCoordinateAssignment.prototype.medianPos=function(e,t){if(0==e%2)for(var n=t.maxRank;0<n;n--)this.rankMedianPosition(n-1,t,n);else for(n=0;n<t.maxRank-1;n++)this.rankMedianPosition(n+1,t,n)},mxCoordinateAssignment.prototype.rankMedianPosition=function(e,t,n){t=t.ranks[e];for(var a=[],i=[],s=0;s<t.length;s++){var o=t[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=n<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=n<e?o.getPreviousLayerConnectedCells(e).slice():o.getNextLayerConnectedCells(e).slice())&&(r=0<(r=l.length)?this.medianXValue(l,n):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(t[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(t[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,t){for(var n=0,a=0;a<t.length;a++){var i=t[a];e.isVertex()&&i.isVertex()?n++:n=e.isEdge()&&i.isEdge()?n+8:n+2}return n},mxCoordinateAssignment.prototype.medianXValue=function(e,t){if(0==e.length)return 0;for(var n=[],a=0;a<e.length;a++)n[a]=e[a].getGeneralPurposeVariable(t);return n.sort(function(e,t){return e-t}),1==e.length%2?n[Math.floor(e.length/2)]:(n[(a=e.length/2)-1]+n[a])/2},mxCoordinateAssignment.prototype.initialCoords=function(e,t){this.calculateWidestRank(e,t);for(var n=this.widestRank;0<=n;n--)n<t.maxRank&&this.rankCoordinates(n,e,t);for(n=this.widestRank+1;n<=t.maxRank;n++)0<n&&this.rankCoordinates(n,e,t)},mxCoordinateAssignment.prototype.rankCoordinates=function(e,t,n){t=n.ranks[e],n=0;for(var a=this.initialX+(this.widestRankValue-this.rankWidths[e])/2,i=!1,s=0;s<t.length;s++){var o=t[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,n=Math.max(n,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,t){var n=-this.interRankCellSpacing,a=0;this.rankWidths=[],this.rankY=[];for(var i=t.maxRank;0<=i;i--){for(var s=0,o=t.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]=n,r=s/2+a/2+this.interRankCellSpacing,a=s,n=this.orientation==mxConstants.DIRECTION_NORTH||this.orientation==mxConstants.DIRECTION_WEST?n+r:n-r,d=0;d<o.length;d++)o[d].setY(i,n)}},mxCoordinateAssignment.prototype.minPath=function(e,t){var n,a=t.edgeMapper;for(n in a){var i=a[n];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(t,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(t,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,t,n,a){e=e.ranks[n];for(var i=-1,s=0;s<e.length;s++)if(t==e[s]){i=s;break}if(i<0)return!1;if(a<(s=t.getGeneralPurposeVariable(n))){if(0==i)return!0;if(!((n=(n=(e=e[i-1]).getGeneralPurposeVariable(n))+e.width/2+this.intraCellSpacing+t.width/2)<=a))return!1}else if(s<a){if(i==e.length-1)return!0;if(!(a<=(n=(n=(e=e[i+1]).getGeneralPurposeVariable(n))-e.width/2-this.intraCellSpacing-t.width/2)))return!1}return!0},mxCoordinateAssignment.prototype.setCellLocations=function(e,t){this.rankTopY=[],this.rankBottomY=[];for(var n=0;n<t.ranks.length;n++)this.rankTopY[n]=Number.MAX_VALUE,this.rankBottomY[n]=0;n=null,this.layout.resizeParent&&(n={});var a,i=t.edgeMapper,s=t.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==n[r]&&(n[r]=o)}}for(a in this.layout.resizeParent&&null!=n&&this.adjustParents(n),(this.edgeStyle==mxHierarchicalEdgeStyle.ORTHOGONAL||this.edgeStyle==mxHierarchicalEdgeStyle.POLYLINE||this.edgeStyle==mxHierarchicalEdgeStyle.CURVE)&&this.localEdgeProcessing(t),i)this.setEdgePosition(i[a])},mxCoordinateAssignment.prototype.adjustParents=function(e){var t,n=[];for(t in e)n.push(e[t]);this.layout.arrangeGroups(mxUtils.sortCells(n,!0),this.groupPadding)},mxCoordinateAssignment.prototype.localEdgeProcessing=function(e){for(var t=0;t<e.ranks.length;t++)for(var n=e.ranks[t],a=0;a<n.length;a++){var i=n[a];if(i.isVertex())for(var s=i.getPreviousLayerConnectedCells(t),o=t-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(t),o=t+1}}},mxCoordinateAssignment.prototype.setEdgePosition=function(e){var t=0;if(101207!=e.temp[0]){var n=e.maxRank,a=e.minRank;n==a&&(n=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[n],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]+t;var f=(this.rankTopY[c]+this.rankBottomY[c+1])/2,b=(this.rankTopY[c-1]+this.rankBottomY[c])/2;if(p){var E=f;f=b,b=E}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[n]: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),t=0==t?this.parallelEdgeSpacing:0<t?-t:-t+this.parallelEdgeSpacing,i++}e.temp[0]=101207}},mxCoordinateAssignment.prototype.setVertexLocation=function(e){var t=e.cell,n=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(t,n,a):this.layout.setVertexLocation(t,a,n),this.limitX=Math.max(this.limitX,n+e.width)},mxCoordinateAssignment.prototype.processReversedEdge=function(e,t){},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,t){return null!=e&&null!=t?t.weightedValue>e.weightedValue?-1:t.weightedValue<e.weightedValue?1:t.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,t){this.parent=e;var n=this.graph.model;if(this.edgesCache={},null!=t||null!=e){if(null!=t&&null!=e){for(var a=[],i=0;i<t.length;i++)n.isAncestor(e,t[i])&&a.push(t[i]);this.roots=a}else this.roots=t;n.beginUpdate();try{this.run(e),this.resizeParent&&!this.graph.isCellCollapsed(e)&&this.graph.updateGroupBounds([e],this.parentBorder,this.moveParent)}finally{n.endUpdate()}}},mxHierarchicalLayout.prototype.findRoots=function(e,t){var n=[];if(null!=e&&null!=t){var a,i=this.graph.model,s=null,o=-1e5;for(a in t){var r=t[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&&n.push(r),o<(l=d-c)&&(o=l,s=r)}}0==n.length&&null!=s&&n.push(s)}return n},mxHierarchicalLayout.prototype.getEdges=function(e){var t=mxCellPath.create(e);if(null!=this.edgesCache[t])return this.edgesCache[t];for(var n=this.graph.model,a=[],i=this.graph.isCellCollapsed(e),s=n.getChildCount(e),o=0;o<s;o++){var r=n.getChildAt(e,o);this.isPort(r)?a=a.concat(n.getEdges(r,!0,!0)):!i&&this.graph.isCellVisible(r)||(a=a.concat(n.getEdges(r,!0,!0)))}for(a=a.concat(n.getEdges(e,!0,!0)),n=[],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))))&&n.push(a[o]);return this.edgesCache[t]=n},mxHierarchicalLayout.prototype.getVisibleTerminal=function(e,t){var n=null!=(n=this.graph.view.getState(e))?n.getVisibleTerminal(t):this.graph.view.getVisibleTerminal(e,t);return this.isPort(n)&&(n=this.graph.model.getParent(n)),n},mxHierarchicalLayout.prototype.run=function(e){var t=[],n=[];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=[];t.push(r),this.traverse(o[s],!0,null,n,r,t,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=[],t.push(r),traverse(roots.get(s),!0,null,n,r,t,null);for(s=n=0;s<t.length;s++){for(i in a=[],r=t[s])a.push(r[i]);this.model=new mxGraphHierarchyModel(this,a,this.roots,e,this.tightenToSource),this.cycleStage(e),this.layeringStage(),this.crossingStage(e),n=this.placementStage(n,e)}},mxHierarchicalLayout.prototype.filterDescendants=function(e,t){var n=this.graph.model;if(n.isVertex(e)&&e!=this.parent&&this.graph.isCellVisible(e)&&(t[mxCellPath.create(e)]=e),this.traverseAncestors||e==this.parent&&this.graph.isCellVisible(e))for(var a=n.getChildCount(e),i=0;i<a;i++){var s=n.getChildAt(e,i);this.isPort(s)||this.filterDescendants(s,t)}},mxHierarchicalLayout.prototype.isPort=function(e){return!!e.geometry.relative},mxHierarchicalLayout.prototype.getEdgesBetween=function(e,t,n){n=null!=n&&n;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==t||!n&&o==t&&r==e)&&i.push(a[s])}return i},mxHierarchicalLayout.prototype.traverse=function(e,t,n,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(n=0;n<s.length;n++)if(null!=(e=s[n])[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(n=0;n<l.length;n++)r=this.getVisibleTerminal(l[n],!0)==e,(!t||r)&&(r=this.getVisibleTerminal(l[n],!r),i=this.traverse(r,t,l[n],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,t){var n=new mxCoordinateAssignment(this,this.intraCellSpacing,this.interRankCellSpacing,this.orientation,e,this.parallelEdgeSpacing);return n.fineTuning=this.fineTuning,n.execute(t),n.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,t){var n=null;if(null!=e){n=[];for(var a=0;a<e.length;a++)t(e[a])&&n.push(e[a])}return n},mxGraphModel.prototype.getDescendants=function(e){return this.filterDescendants(null,e)},mxGraphModel.prototype.filterDescendants=function(e,t){var n=[];t=t||this.getRoot(),(null==e||e(t))&&n.push(t);for(var a=this.getChildCount(t),i=0;i<a;i++){var s=this.getChildAt(t,i);n=n.concat(this.filterDescendants(e,s))}return n},mxGraphModel.prototype.getRoot=function(e){var t=e||this.root;if(null!=e)for(;null!=e;)t=e,e=this.getParent(e);return t},mxGraphModel.prototype.setRoot=function(e){return this.execute(new mxRootChange(this,e)),e},mxGraphModel.prototype.rootChanged=function(e){var t=this.root;return this.root=e,this.nextId=0,this.cells=null,this.cellAdded(e),t},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,t){for(;null!=t&&t!=e;)t=this.getParent(t);return t==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,t,n){if(t!=e&&null!=e&&null!=t){null==n&&(n=this.getChildCount(e));var a=e!=this.getParent(t);this.execute(new mxChildChange(this,e,t,n)),this.maintainEdgeParent&&a&&this.updateEdgeParents(t)}return t},mxGraphModel.prototype.cellAdded=function(e){if(null!=e){if(null==e.getId()&&this.createIds&&e.setId(this.createId(e)),null!=e.getId())if((t=this.getCell(e.getId()))!=e){for(;null!=t;)e.setId(this.createId(e)),t=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 t=this.getChildCount(e),n=0;n<t;n++)this.cellAdded(this.getChildAt(e,n))}},mxGraphModel.prototype.createId=function(e){return e=this.nextId,this.nextId++,this.prefix+e+this.postfix},mxGraphModel.prototype.updateEdgeParents=function(e,t){t=t||this.getRoot(e);for(var n=this.getChildCount(e),a=0;a<n;a++){var i=this.getChildAt(e,a);this.updateEdgeParents(i,t)}for(i=this.getEdgeCount(e),n=[],a=0;a<i;a++)n.push(this.getEdgeAt(e,a));for(a=0;a<n.length;a++)i=n[a],this.isAncestor(t,i)&&this.updateEdgeParent(i,t)},mxGraphModel.prototype.updateEdgeParent=function(e,t){for(var n=this.getTerminal(e,!0),a=this.getTerminal(e,!1),i=null;null!=n&&!this.isEdge(n)&&null!=n.geometry&&n.geometry.relative;)n=this.getParent(n);for(;null!=a&&!this.isEdge(a)&&null!=a.geometry&&a.geometry.relative;)a=this.getParent(a);if(this.isAncestor(t,n)&&this.isAncestor(t,a)&&(null!=(i=n==a?this.getParent(n):this.getNearestCommonAncestor(n,a))&&(this.getParent(i)!=this.root||this.isAncestor(i,e))&&this.getParent(e)!=i)){if(null!=(n=this.getGeometry(e))){var s=this.getOrigin(this.getParent(e)),o=this.getOrigin(i);a=o.x-s.x,s=o.y-s.y;(n=n.clone()).translate(-a,-s),this.setGeometry(e,n)}this.add(i,e,this.getChildCount(i))}},mxGraphModel.prototype.getOrigin=function(e){var t=null;return null!=e?(t=this.getOrigin(this.getParent(e)),this.isEdge(e)||null!=(e=this.getGeometry(e))&&(t.x+=e.x,t.y+=e.y)):t=new mxPoint,t},mxGraphModel.prototype.getNearestCommonAncestor=function(e,t){if(null!=e&&null!=t&&(null!=(s=mxCellPath.create(t))&&0<s.length)){var n=e,a=mxCellPath.create(n);if(s.length<a.length){n=t;var i=a,s=(a=s,i)}for(;null!=n;){if(i=this.getParent(n),0==s.indexOf(a+mxCellPath.PATH_SEPARATOR)&&null!=i)return n;a=mxCellPath.getParentPath(a),n=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 t=this.getChildCount(e)-1;0<=t;t--)this.cellRemoved(this.getChildAt(e,t));null!=this.cells&&null!=e.getId()&&delete this.cells[e.getId()]}},mxGraphModel.prototype.parentForCellChanged=function(e,t,n){var a=this.getParent(e);return null!=t?(t!=a||a.getIndex(e)!=n)&&t.insert(e,n):null!=a&&(n=a.getIndex(e),a.remove(n)),this.contains(a)||null==t?null==t&&this.cellRemoved(e):this.cellAdded(e),a},mxGraphModel.prototype.getChildCount=function(e){return null!=e?e.getChildCount():0},mxGraphModel.prototype.getChildAt=function(e,t){return null!=e?e.getChildAt(t):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,t,n){t=null!=t&&t,n=null!=n&&n;for(var a=this.getChildCount(e),i=[],s=0;s<a;s++){var o=this.getChildAt(e,s);(!n&&!t||n&&this.isEdge(o)||t&&this.isVertex(o))&&i.push(o)}return i},mxGraphModel.prototype.getTerminal=function(e,t){return null!=e?e.getTerminal(t):null},mxGraphModel.prototype.setTerminal=function(e,t,n){var a=t!=this.getTerminal(e,n);return this.execute(new mxTerminalChange(this,e,t,n)),this.maintainEdgeParent&&a&&this.updateEdgeParent(e,this.getRoot()),t},mxGraphModel.prototype.setTerminals=function(e,t,n){this.beginUpdate();try{this.setTerminal(e,t,!0),this.setTerminal(e,n,!1)}finally{this.endUpdate()}},mxGraphModel.prototype.terminalForCellChanged=function(e,t,n){var a=this.getTerminal(e,n);return null!=t?t.insertEdge(e,n):null!=a&&a.removeEdge(e,n),a},mxGraphModel.prototype.getEdgeCount=function(e){return null!=e?e.getEdgeCount():0},mxGraphModel.prototype.getEdgeAt=function(e,t){return null!=e?e.getEdgeAt(t):null},mxGraphModel.prototype.getDirectedEdgeCount=function(e,t,n){for(var a=0,i=this.getEdgeCount(e),s=0;s<i;s++){var o=this.getEdgeAt(e,s);o!=n&&this.getTerminal(o,t)==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,t,n,a){t=null==t||t,n=null==n||n,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&&(t&&d==e||n&&l==e))&&s.push(r)}return s},mxGraphModel.prototype.getEdgesBetween=function(e,t,n){n=null!=n&&n;var a=this.getEdgeCount(e),i=this.getEdgeCount(t),s=e,o=a;for(i<a&&(o=i,s=t),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==t||!n&&(d==e&&l==t))&&a.push(r)}return a},mxGraphModel.prototype.getOpposites=function(e,t,n,a){n=null==n||n,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==t&&null!=r&&r!=t&&a?i.push(r):r==t&&null!=o&&o!=t&&n&&i.push(o)}return i},mxGraphModel.prototype.getTopmostCells=function(e){for(var t=[],n=0;n<e.length;n++){for(var a=e[n],i=!0,s=this.getParent(a);null!=s;){if(0<=mxUtils.indexOf(e,s)){i=!1;break}s=this.getParent(s)}i&&t.push(a)}return t},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,t){return this.execute(new mxValueChange(this,e,t)),t},mxGraphModel.prototype.valueForCellChanged=function(e,t){return e.valueChanged(t)},mxGraphModel.prototype.getGeometry=function(e,t){return null!=e?e.getGeometry():null},mxGraphModel.prototype.setGeometry=function(e,t){return t!=this.getGeometry(e)&&this.execute(new mxGeometryChange(this,e,t)),t},mxGraphModel.prototype.geometryForCellChanged=function(e,t){var n=this.getGeometry(e);return e.setGeometry(t),n},mxGraphModel.prototype.getStyle=function(e){return null!=e?e.getStyle():null},mxGraphModel.prototype.setStyle=function(e,t){return t!=this.getStyle(e)&&this.execute(new mxStyleChange(this,e,t)),t},mxGraphModel.prototype.styleForCellChanged=function(e,t){var n=this.getStyle(e);return e.setStyle(t),n},mxGraphModel.prototype.isCollapsed=function(e){return null!=e&&e.isCollapsed()},mxGraphModel.prototype.setCollapsed=function(e,t){return t!=this.isCollapsed(e)&&this.execute(new mxCollapseChange(this,e,t)),t},mxGraphModel.prototype.collapsedStateForCellChanged=function(e,t){var n=this.isCollapsed(e);return e.setCollapsed(t),n},mxGraphModel.prototype.isVisible=function(e){return null!=e&&e.isVisible()},mxGraphModel.prototype.setVisible=function(e,t){return t!=this.isVisible(e)&&this.execute(new mxVisibleChange(this,e,t)),t},mxGraphModel.prototype.visibleStateForCellChanged=function(e,t){var n=this.isVisible(e);return e.setVisible(t),n},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,t,n){n=null==n||n,this.beginUpdate();try{var a={};for(var i in this.mergeChildrenImpl(e,t,n,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,t,n,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)&&n?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=t.insert(d),this.cellAdded(l)}a[mxCellPath.create(o)]=l,this.mergeChildrenImpl(o,l,n,a)}}}finally{this.endUpdate()}},mxGraphModel.prototype.getParents=function(e){var t=[];if(null!=e)for(var n={},a=0;a<e.length;a++){var i=this.getParent(e[a]);if(null!=i){var s=mxCellPath.create(i);null==n[s]&&(n[s]=i,t.push(i))}}return t},mxGraphModel.prototype.cloneCell=function(e){return null!=e?this.cloneCells([e],!0)[0]:null},mxGraphModel.prototype.cloneCells=function(e,t){for(var n={},a=[],i=0;i<e.length;i++)null!=e[i]?a.push(this.cloneCellImpl(e[i],n,t)):a.push(null);for(i=0;i<a.length;i++)null!=a[i]&&this.restoreClone(a[i],e[i],n);return a},mxGraphModel.prototype.cloneCellImpl=function(e,t,n){var a=this.cellCloned(e);if(t[mxObjectIdentity.get(e)]=a,n){n=this.getChildCount(e);for(var i=0;i<n;i++){var s=this.cloneCellImpl(this.getChildAt(e,i),t,!0);a.insert(s)}}return a},mxGraphModel.prototype.cellCloned=function(e){return e.clone()},mxGraphModel.prototype.restoreClone=function(e,t,n){null!=(a=this.getTerminal(t,!0))&&(null!=(a=n[mxObjectIdentity.get(a)])&&a.insertEdge(e,!0)),null!=(a=this.getTerminal(t,!1))&&(null!=(a=n[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(t,i),n)},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),t=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=t},mxChildChange.prototype.connect=function(e,t){t=null==t||t;var n=e.getTerminal(!0),a=e.getTerminal(!1);for(null!=n&&(t?this.model.terminalForCellChanged(e,n,!0):this.model.terminalForCellChanged(e,null,!0)),null!=a&&(t?this.model.terminalForCellChanged(e,a,!1):this.model.terminalForCellChanged(e,null,!1)),e.setTerminal(n,!0),e.setTerminal(a,!1),n=this.model.getChildCount(e),a=0;a<n;a++)this.connect(this.model.getChildAt(e,a),t)},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 t=this.getValue();return this.setValue(e),t},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,t){return t?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,t){return null!=e&&(null==t&&(t=this.getChildCount(),e.getParent()==this&&t--),e.removeFromParent(),e.setParent(this),null==this.children?(this.children=[],this.children.push(e)):this.children.splice(t,0,e)),e},mxCell.prototype.remove=function(e){var t=null;return null!=this.children&&0<=e&&(null!=(t=this.getChildAt(e))&&(this.children.splice(e,1),t.setParent(null))),t},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,t){return null!=e&&(e.removeFromTerminal(t),e.setTerminal(this,t),null==this.edges||e.getTerminal(!t)!=this||mxUtils.indexOf(this.edges,e)<0)&&(null==this.edges&&(this.edges=[]),this.edges.push(e)),e},mxCell.prototype.removeEdge=function(e,t){if(null!=e){if(e.getTerminal(!t)!=this&&null!=this.edges){var n=this.getEdgeIndex(e);0<=n&&this.edges.splice(n,1)}e.setTerminal(null,t)}return e},mxCell.prototype.removeFromTerminal=function(e){var t=this.getTerminal(e);null!=t&&t.removeEdge(this,e)},mxCell.prototype.getAttribute=function(e,t){var n=this.getValue();return(null!=n&&n.nodeType==mxConstants.NODETYPE_ELEMENT?n.getAttribute(e):null)||t},mxCell.prototype.setAttribute=function(e,t){var n=this.getValue();null!=n&&n.nodeType==mxConstants.NODETYPE_ELEMENT&&n.setAttribute(e,t)},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,t){return t?this.sourcePoint=e:this.targetPoint=e,e},mxGeometry.prototype.translate=function(e,t){if(this.clone(),this.relative||(this.x+=e,this.y+=t),null!=this.sourcePoint&&(this.sourcePoint.x+=e,this.sourcePoint.y+=t),null!=this.targetPoint&&(this.targetPoint.x+=e,this.targetPoint.y+=t),this.TRANSLATE_CONTROL_POINTS&&null!=this.points)for(var n=this.points.length,a=0;a<n;a++){var i=this.points[a];null!=i&&(i.x+=e,i.y+=t)}};var mxCellPath={PATH_SEPARATOR:".",create:function(e){var t="";if(null!=e)for(var n=e.getParent();null!=n;)t=n.getIndex(e)+mxCellPath.PATH_SEPARATOR+t,n=(e=n).getParent();return 1<(e=t.length)&&(t=t.substring(0,e-1)),t},getParentPath:function(e){if(null!=e){var t=e.lastIndexOf(mxCellPath.PATH_SEPARATOR);if(0<=t)return e.substring(0,t);if(0<e.length)return""}return null},resolve:function(e,t){var n=e;if(null!=t)for(var a=t.split(mxCellPath.PATH_SEPARATOR),i=0;i<a.length;i++)n=n.getChildAt(parseInt(a[i]));return n},compare:function(e,t){for(var n=Math.min(e.length,t.length),a=0,i=0;i<n;i++)if(e[i]!=t[i]){a=0==e[i].length||0==t[i].length?e[i]==t[i]?0:e[i]>t[i]?1:-1:(n=parseInt(e[i]))==(i=parseInt(t[i]))?0:i<n?1:-1;break}return 0==a&&((n=e.length)!=(i=t.length)&&(a=i<n?1:-1)),a}},mxPerimeter={RectanglePerimeter:function(e,t,n,a){t=e.getCenterX();var i=e.getCenterY(),s=Math.atan2(n.y-i,n.x-t),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=t-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=t+e.height*Math.tan(l)/2),a&&(n.x>=e.x&&n.x<=e.x+e.width?o.x=n.x:n.y>=e.y&&n.y<=e.y+e.height&&(o.y=n.y),n.x<e.x?o.x=e.x:n.x>e.x+e.width&&(o.x=e.x+e.width),n.y<e.y?o.y=e.y:n.y>e.y+e.height&&(o.y=e.y+e.height)),o},EllipsePerimeter:function(e,t,n,a){var i=e.x,s=e.y,o=e.width/2,r=e.height/2,l=i+o,d=s+r;t=n.x,n=n.y;var c=parseInt(t-l),m=parseInt(n-d);if(0==c&&0!=m)return new mxPoint(l,d+r*m/Math.abs(m));if(0==c&&0==m)return new mxPoint(t,n);if(a){if(s<=n&&n<=s+e.height)return e=n-d,e=Math.sqrt(o*o*(1-e*e/(r*r)))||0,t<=i&&(e=-e),new mxPoint(l+e,n);if(i<=t&&t<=i+e.width)return e=t-l,e=Math.sqrt(r*r*(1-e*e/(o*o)))||0,n<=s&&(e=-e),new mxPoint(t,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-t,2)+Math.pow(l-n,2)),t=Math.sqrt(Math.pow(r-t,2)+Math.pow(d-n,2)),s=n=0,s=i<t?(n=o,l):(n=r,d),new mxPoint(n,s)},RhombusPerimeter:function(e,t,n,a){t=e.x;var i=e.y,s=e.width,o=t+s/2,r=i+(e=e.height)/2,l=n.x;if(n=n.y,o==l)return new mxPoint(o,n<r?i:i+e);if(r==n)return new mxPoint(l<o?t:t+s,r);var d=o,c=r;return a&&(t<=l&&l<=t+s?d=l:i<=n&&n<=i+e&&(c=n)),l<o?n<r?mxUtils.intersection(l,n,d,c,o,i,t,r):mxUtils.intersection(l,n,d,c,o,i+e,t,r):n<r?mxUtils.intersection(l,n,d,c,o,i,t+s,r):mxUtils.intersection(l,n,d,c,o,i+e,t+s,r)},TrianglePerimeter:function(e,t,n,a){var i=(t=null!=t?t.style[mxConstants.STYLE_DIRECTION]:null)==mxConstants.DIRECTION_NORTH||t==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);t==mxConstants.DIRECTION_NORTH?(c=u,m=new mxPoint(l,o),u=new mxPoint(s+r,o+e)):t==mxConstants.DIRECTION_SOUTH?(m=new mxPoint(l,o+e),u=new mxPoint(s+r,o)):t==mxConstants.DIRECTION_WEST&&(c=new mxPoint(s+r,o),m=new mxPoint(s,d),u=new mxPoint(s+r,o+e));var p=n.x-l,g=n.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=t==mxConstants.DIRECTION_NORTH||t==mxConstants.DIRECTION_WEST?-v<p&&p<v:p<-Math.PI+v||p>Math.PI-v,v=null;return null==(v=g?a&&(i&&n.x>=c.x&&n.x<=u.x||!i&&n.y>=c.y&&n.y<=u.y)?i?new mxPoint(n.x,c.y):new mxPoint(c.x,n.y):t==mxConstants.DIRECTION_NORTH?new mxPoint(s+r/2+e*Math.tan(p)/2,o+e):t==mxConstants.DIRECTION_SOUTH?new mxPoint(s+r/2-e*Math.tan(p)/2,o):t==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),n.y>=o&&n.y<=o+e?(a.x=i?l:t==mxConstants.DIRECTION_WEST?s+r:s,a.y=n.y):n.x>=s&&n.x<=s+r&&(a.x=n.x,a.y=i?t==mxConstants.DIRECTION_NORTH?o+e:o:d),l=a.x,d=a.y),i&&n.x<=s+r/2||!i&&n.y<=o+e/2?mxUtils.intersection(n.x,n.y,l,d,c.x,c.y,m.x,m.y):mxUtils.intersection(n.x,n.y,l,d,m.x,m.y,u.x,u.y)))&&(v=new mxPoint(l,d)),v}};function mxPrintPreview(e,t,n,a,i,s,o,r,l){this.graph=e,this.scale=null!=t?t:1/e.pageScale,this.border=null!=a?a:0,this.pageFormat=null!=n?n: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,t,n){this.view=e,this.cell=t,this.style=n,this.origin=new mxPoint,this.absoluteOffset=new mxPoint}function mxGraphSelectionModel(e){this.graph=e,this.cells=[]}function mxSelectionChange(e,t,n){this.selectionModel=e,this.added=null!=t?t.slice():null,this.removed=null!=n?n.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 t=this.graph.cellRenderer.initializeOverlay,n=null;try{if(this.printOverlays&&(this.graph.cellRenderer.initializeOverlay=function(e,t){t.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 t=function(){e.style.top=a.body.scrollTop+10+"px"};mxEvent.addListener(this.wnd,"scroll",function(e){t()}),mxEvent.addListener(this.wnd,"resize",function(e){t()})}}});if(e=function(e,t){if(null!=this.borderColor&&(e.style.borderColor=this.borderColor,e.style.borderStyle="solid",e.style.borderWidth="1px"),e.style.background="white",t&&(e.style.pageBreakAfter="always"),mxClient.IS_IE?(a.writeln(e.outerHTML),e.parentNode.removeChild(e)):(e.parentNode.removeChild(e),a.body.appendChild(e)),t){var n=a.createElement("hr");n.className="mxPageBreak",a.body.appendChild(n)}},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,E=g*m+f+1;(n=this.renderPage(this.pageFormat.width,this.pageFormat.height,mxUtils.bind(this,function(e){this.addGraphFragment(-b,-h,this.scale,E,e)}))).setAttribute("id","mxPage-"+E),e(n,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!=n&&null!=n.parentNode&&n.parentNode.removeChild(n)}finally{this.graph.cellRenderer.initializeOverlay=t}return this.wnd},mxPrintPreview.prototype.writeHead=function(e,t){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!=t&&e.writeln(t),e.writeln("</style>")},mxPrintPreview.prototype.createPageSelector=function(e,t){var n=this.wnd.document,a=n.createElement("table");a.className="mxPageSelector",a.setAttribute("border","0");for(var i=n.createElement("tbody"),s=0;s<e;s++){for(var o=n.createElement("tr"),r=0;r<t;r++){var l=s*t+r+1,d=n.createElement("td");if(!mxClient.IS_NS||mxClient.IS_SF||mxClient.IS_GC){var c=n.createElement("a");c.setAttribute("href","#mxPage-"+l),mxUtils.write(c,l,n),d.appendChild(c)}else mxUtils.write(d,l,n);o.appendChild(d)}i.appendChild(o)}return a.appendChild(i),a},mxPrintPreview.prototype.renderPage=function(e,t,n){var a=document.createElement("div");try{a.style.width=e+"px",a.style.height=t+"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=t-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),n(i)}catch(e){throw a.parentNode.removeChild(a),e}return a},mxPrintPreview.prototype.addGraphFragment=function(e,t,n,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,t),e=null;try{var p=[this.graph.getModel().getRoot()];e=new mxTemporaryCellStates(a,n,p)}finally{if(mxClient.IS_IE)a.overlayPane.innerHTML="";else for(n=i.firstChild;null!=n;)p=n.nextSibling,"svg"==(t=n.nodeName.toLowerCase())?(n.setAttribute("width",parseInt(i.style.width)),n.setAttribute("height",parseInt(i.style.height))):"default"!=n.style.cursor&&"table"!=t&&n.parentNode.removeChild(n),n=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,t){this.styles[e]=t},mxStylesheet.prototype.getCellStyle=function(e,t){var n=t;if(null!=e&&0<e.length)for(var a=e.split(";"),i=(n=null!=n&&";"!=e.charAt(0)?mxUtils.clone(n):{},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 n[r]:mxUtils.isNumeric(o)?n[r]=parseFloat(o):n[r]=o}else if(null!=(o=this.styles[o]))for(r in o)n[r]=o[r]}return n},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,t){if(e=e||0,t=null!=t?t:new mxRectangle(this.x,this.y,this.width,this.height),null!=this.shape&&null!=this.shape.stencil){var n=this.shape.stencil.computeAspect(this.style,t.x,t.y,t.width,t.height);t.x=n.x,t.y=n.y,t.width=this.shape.stencil.w0*n.width,t.height=this.shape.stencil.h0*n.height}return 0!=e&&t.grow(e),t},mxCellState.prototype.setAbsoluteTerminalPoint=function(e,t){t?(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,t){t?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 t=0;t<this.absolutePoints.length;t++)e.absolutePoints[t]=this.absolutePoints[t].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 t=[],n=0;n<e.length;n++)this.graph.isCellSelectable(e[n])&&t.push(e[n]);this.changeSelection(t,this.cells)}},mxGraphSelectionModel.prototype.getFirstSelectableCell=function(e){if(null!=e)for(var t=0;t<e.length;t++)if(this.graph.isCellSelectable(e[t]))return e[t];return null},mxGraphSelectionModel.prototype.addCell=function(e){null!=e&&this.addCells([e])},mxGraphSelectionModel.prototype.addCells=function(e){if(null!=e){var t=null;this.singleSelection&&(t=this.cells,e=[this.getFirstSelectableCell(e)]);for(var n=[],a=0;a<e.length;a++)!this.isSelected(e[a])&&this.graph.isCellSelectable(e[a])&&n.push(e[a]);this.changeSelection(n,t)}},mxGraphSelectionModel.prototype.removeCell=function(e){null!=e&&this.removeCells([e])},mxGraphSelectionModel.prototype.removeCells=function(e){if(null!=e){for(var t=[],n=0;n<e.length;n++)this.isSelected(e[n])&&t.push(e[n]);this.changeSelection(null,t)}},mxGraphSelectionModel.prototype.changeSelection=function(e,t){if(null!=e&&0<e.length&&null!=e[0]||null!=t&&0<t.length&&null!=t[0]){var n=new mxSelectionChange(this,e,t);n.execute();var a=new mxUndoableEdit(this,!1);a.add(n),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 t=0;t<this.removed.length;t++)this.selectionModel.cellRemoved(this.removed[t]);if(null!=this.added)for(t=0;t<this.added.length;t++)this.selectionModel.cellAdded(this.added[t]);t=this.added,this.added=this.removed,this.removed=t,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),t=this.graph.isLabelClipped(e.cell),n=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),n?(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);t&&(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&&(!t&&n||(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"),!t&&n||(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,t){null==this.textarea&&this.init(),this.stopEditing(!0);var n=this.graph.getView().getState(e);if(null!=n){this.editingCell=e,this.trigger=t,(this.textNode=null)!=n.text&&this.isHideLabel(n)&&(this.textNode=n.text.node,this.textNode.style.visibility="hidden");var a=this.graph.getView().scale,i=(a=mxUtils.getValue(n.style,mxConstants.STYLE_FONTSIZE,mxConstants.DEFAULT_FONTSIZE)*a,mxUtils.getValue(n.style,mxConstants.STYLE_FONTFAMILY,mxConstants.DEFAULT_FONTFAMILY)),s=mxUtils.getValue(n.style,mxConstants.STYLE_FONTCOLOR,"black"),o=mxUtils.getValue(n.style,mxConstants.STYLE_ALIGN,mxConstants.ALIGN_LEFT),r=(mxUtils.getValue(n.style,mxConstants.STYLE_FONTSTYLE,0)&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD,l=(mxUtils.getValue(n.style,mxConstants.STYLE_FONTSTYLE,0)&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC,d=(mxUtils.getValue(n.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(n),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==(n=this.getInitialValue(n,t))||0==n.length?(n=this.getEmptyLabelText(),this.clearOnChange=!0):this.clearOnChange=!1,this.setModified(!1),this.textarea.value=n,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"),t=e.style;return t.position="absolute",t.whiteSpace="nowrap",t.visibility="hidden",t.display=mxClient.IS_QUIRKS?"inline":"inline-block",t.zoom="1",t.verticalAlign="top",t.lineHeight=this.textarea.style.lineHeight,t.fontSize=this.textarea.style.fontSize,t.fontFamily=this.textarea.style.fontFamily,t.fontWeight=this.textarea.style.fontWeight,t.textAlign=this.textarea.style.textAlign,t.fontStyle=this.textarea.style.fontStyle,t.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,t){return this.graph.getEditingValue(e.cell,t)},mxCellEditor.prototype.getCurrentValue=function(){return this.textarea.value.replace(/\r/g,"")},mxCellEditor.prototype.isHideLabel=function(e){return!0},mxCellEditor.prototype.getMinimumSize=function(e){var t=this.graph.getView().scale;return new mxRectangle(0,0,null==e.text?30:e.text.size*t+20,"left"==this.textarea.style.textAlign?120:40)},mxCellEditor.prototype.getEditorBounds=function(e){var t=this.graph.getModel().isEdge(e.cell),n=this.graph.getView().scale,a=(i=this.getMinimumSize(e)).width,i=i.height,s=parseInt(e.style[mxConstants.STYLE_SPACING]||2)*n,o=parseInt(e.style[mxConstants.STYLE_SPACING_TOP]||0)*n+s,r=parseInt(e.style[mxConstants.STYLE_SPACING_RIGHT]||0)*n+s,l=parseInt(e.style[mxConstants.STYLE_SPACING_BOTTOM]||0)*n+s;n=parseInt(e.style[mxConstants.STYLE_SPACING_LEFT]||0)*n+s,r=new mxRectangle(e.x,e.y,Math.max(a,e.width-n-r),Math.max(i,e.height-o-l));return t?(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+=n,r.y+=o,null!=e.text&&null!=e.text.boundingBox&&(t?(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)&&((t=mxUtils.getValue(e.style,mxConstants.STYLE_LABEL_POSITION,mxConstants.ALIGN_CENTER))==mxConstants.ALIGN_LEFT?r.x-=e.width:t==mxConstants.ALIGN_RIGHT&&(r.x+=e.width),(t=mxUtils.getValue(e.style,mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.ALIGN_MIDDLE))==mxConstants.ALIGN_TOP?r.y-=e.height:t==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,t){mxCellRenderer.prototype.defaultShapes[e]=t},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,t){var n=e.view.graph.getModel();null!=e.view.graph.container&&null==e.shape&&e.cell!=e.view.currentRoot&&(n.isVertex(e.cell)||n.isEdge(e.cell))&&(this.createShape(e),null==e.shape||null!=t&&!t||(this.initializeShape(e),e.view.graph.ordered||n.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,t){for(var n=null,a=e.view.graph,i=a.getModel(),s=e.cell,o=i.getParent(s);null!=o&&null==n;)n=this.findPreviousStateInContainer(a,o,s,t),s=o,o=i.getParent(s);return n},mxCellRenderer.prototype.findPreviousStateInContainer=function(e,t,n,a){var i=null,s=e.getModel();for(n=null!=n?t.getIndex(n)-1:s.getChildCount(t)-1;0<=n&&null==i;n--)i=this.findPreviousStateInContainer(e,s.getChildAt(t,n),null,a);return null!=i||(null==(i=e.view.getState(t))||null!=i.shape&&null!=i.shape.node&&i.shape.node.parentNode==a)||(i=null),i},mxCellRenderer.prototype.order=function(e){var t=e.shape.node.parentNode,n=this.getPreviousStateInContainer(e,t),a=t.firstChild;null!=n&&(a=n.shape.node,null!=n.text&&null!=n.text.node&&n.text.node.parentNode==t&&(a=n.text.node),a=a.nextSibling),this.insertState(e,a)},mxCellRenderer.prototype.orderEdge=function(e){var t=(n=e.view).graph.getModel();if(n.graph.keepEdgesInForeground)null!=this.firstEdge&&null!=this.firstEdge.parentNode&&this.firstEdge.parentNode==e.shape.node.parentNode||(this.firstEdge=e.shape.node);else if(n.graph.keepEdgesInBackground){var n,a=e.shape.node,i=a.parentNode;t=t.getParent(e.cell);null!=(i=null!=(n=n.getState(t))&&null!=n.shape&&null!=n.shape.node?n.shape.node.nextSibling:i.firstChild)&&i!=a&&this.insertState(e,i)}},mxCellRenderer.prototype.insertState=function(e,t){e.shape.node.parentNode.insertBefore(e.shape.node,t),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 t=mxStencilRegistry.getStencil(e.style[mxConstants.STYLE_SHAPE]);null!=t?e.shape=new mxShape(t):(t=this.getShapeConstructor(e),e.shape=new t),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 t=this.getShape(e.style[mxConstants.STYLE_SHAPE]);return null==t&&(t=e.view.graph.getModel().isEdge(e.cell)?this.defaultEdgeShape:this.defaultVertexShape),t},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,t,n){var a=e.shape[t],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),n=i.swimlaneIndicatorColorAttribute):"indicated"==a&&(e.shape[t]=e.shape.indicatorColor),null!=s&&(a=i.getView().getState(s),(e.shape[t]=null)!=a&&(e.shape[t]=null!=a.shape&&"indicatorColor"!=t?a.shape[t]:a.style[n]))},mxCellRenderer.prototype.getLabelValue=function(e){return e.view.graph.getLabel(e.cell)},mxCellRenderer.prototype.createLabel=function(n,e){var a=n.view.graph;if(a.getModel().isEdge(n.cell),0<n.style[mxConstants.STYLE_FONTSIZE]||null==n.style[mxConstants.STYLE_FONTSIZE]){var t=a.isHtmlLabel(n.cell)||null!=e&&mxUtils.isNode(e);n.text=new this.defaultTextShape(e,new mxRectangle,n.style[mxConstants.STYLE_ALIGN]||mxConstants.ALIGN_CENTER,a.getVerticalAlign(n),n.style[mxConstants.STYLE_FONTCOLOR],n.style[mxConstants.STYLE_FONTFAMILY],n.style[mxConstants.STYLE_FONTSIZE],n.style[mxConstants.STYLE_FONTSTYLE],n.style[mxConstants.STYLE_SPACING],n.style[mxConstants.STYLE_SPACING_TOP],n.style[mxConstants.STYLE_SPACING_RIGHT],n.style[mxConstants.STYLE_SPACING_BOTTOM],n.style[mxConstants.STYLE_SPACING_LEFT],n.style[mxConstants.STYLE_HORIZONTAL],n.style[mxConstants.STYLE_LABEL_BACKGROUNDCOLOR],n.style[mxConstants.STYLE_LABEL_BORDERCOLOR],a.isWrapping(n.cell)&&a.isHtmlLabel(n.cell),a.isLabelClipped(n.cell),n.style[mxConstants.STYLE_OVERFLOW],n.style[mxConstants.STYLE_LABEL_PADDING]),n.text.opacity=mxUtils.getValue(n.style,mxConstants.STYLE_TEXT_OPACITY,100),n.text.dialect=t?mxConstants.DIALECT_STRICTHTML:n.view.graph.dialect,n.text.state=n,this.initializeLabel(n);var i=!1,s=function(e){var t=n;return(mxClient.IS_TOUCH||i)&&(t=mxEvent.getClientX(e),e=mxEvent.getClientY(e),e=mxUtils.convertPoint(a.container,t,e),t=a.view.getState(a.getCellAt(e.x,e.y))),t};mxEvent.addGestureListeners(n.text.node,mxUtils.bind(this,function(e){this.isLabelEvent(n,e)&&(a.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,n)),i=a.dialect!=mxConstants.DIALECT_SVG&&"IMG"==mxEvent.getSource(e).nodeName)}),mxUtils.bind(this,function(e){this.isLabelEvent(n,e)&&a.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,s(e)))}),mxUtils.bind(this,function(e){this.isLabelEvent(n,e)&&(a.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e,s(e))),i=!1)})),mxEvent.addListener(n.text.node,"dblclick",mxUtils.bind(this,function(e){this.isLabelEvent(n,e)&&(a.dblClick(e,n.cell),mxEvent.consume(e))}))}},mxCellRenderer.prototype.initializeLabel=function(e){var t=e.view.graph;e.text.dialect!=mxConstants.DIALECT_SVG&&(mxClient.IS_SVG&&mxClient.NO_FO?e.text.init(t.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 t=e.view.graph.getCellOverlays(e.cell),n=null;if(null!=t){n=new mxDictionary;for(var a=0;a<t.length;a++){var i=null!=e.overlays?e.overlays.remove(t[a]):null;null==i&&((i=new mxImageShape(new mxRectangle,t[a].image.src)).dialect=e.view.graph.dialect,i.preserveImageAspect=!1,i.overlay=t[a],this.initializeOverlay(e,i),this.installCellOverlayListeners(e,t[a],i),null!=t[a].cursor&&(i.node.style.cursor=t[a].cursor)),n.put(t[a],i)}}null!=e.overlays&&e.overlays.visit(function(e,t){t.destroy()}),e.overlays=n},mxCellRenderer.prototype.initializeOverlay=function(e,t){t.init(e.view.getOverlayPane())},mxCellRenderer.prototype.installCellOverlayListeners=function(t,n,e){var a=t.view.graph;mxEvent.addListener(e.node,"click",function(e){a.isEditing()&&a.stopEditing(!a.isInvokesStopCellEditing()),n.fireEvent(new mxEventObject(mxEvent.CLICK,"event",e,"cell",t.cell))}),mxEvent.addGestureListeners(e.node,function(e){mxEvent.consume(e)},function(e){a.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,t))}),mxClient.IS_TOUCH&&mxEvent.addListener(e.node,"touchend",function(e){n.fireEvent(new mxEventObject(mxEvent.CLICK,"event",e,"cell",t.cell))})},mxCellRenderer.prototype.createControl=function(n){var a=n.view.graph,e=a.getFoldingImage(n);if(a.foldingEnabled&&null!=e){if(null==n.control){var t=new mxRectangle(0,0,e.width,e.height);n.control=new mxImageShape(t,e.src),n.control.preserveImageAspect=!1,n.control.dialect=a.dialect,this.initControl(n,n.control,!0,function(e){if(a.isEnabled()){var t=!a.isCellCollapsed(n.cell);a.foldCells(t,!1,[n.cell]),mxEvent.consume(e)}})}}else null!=n.control&&(n.control.destroy(),n.control=null)},mxCellRenderer.prototype.initControl=function(t,e,n,a){var i=t.view.graph;return i.isHtmlLabel(t.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(t.view.getOverlayPane()),e=e.innerNode||e.node,a&&(i.isEnabled()&&(e.style.cursor="pointer"),mxEvent.addListener(e,"click",a)),n&&mxEvent.addGestureListeners(e,function(e){i.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,t)),mxEvent.consume(e)},function(e){i.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,t))}),e},mxCellRenderer.prototype.isShapeEvent=function(e,t){return!0},mxCellRenderer.prototype.isLabelEvent=function(e,t){return!0},mxCellRenderer.prototype.installListeners=function(n){var a=n.view.graph,t=function(e){var t=n;return(a.dialect!=mxConstants.DIALECT_SVG&&"IMG"==mxEvent.getSource(e).nodeName||mxClient.IS_TOUCH)&&(t=mxEvent.getClientX(e),e=mxEvent.getClientY(e),e=mxUtils.convertPoint(a.container,t,e),t=a.view.getState(a.getCellAt(e.x,e.y))),t},i=!1;mxEvent.addListener(n.shape.node,"gesturestart",mxUtils.bind(this,function(e){a.lastTouchTime=0,i=!0,mxEvent.consume(e)})),mxEvent.addGestureListeners(n.shape.node,mxUtils.bind(this,function(e){this.isShapeEvent(n,e)&&!i?a.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,null!=n.shape&&mxEvent.getSource(e)==n.shape.content?null:n)):i&&mxEvent.consume(e)}),mxUtils.bind(this,function(e){this.isShapeEvent(n,e)&&!i?a.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,null!=n.shape&&mxEvent.getSource(e)==n.shape.content?null:t(e))):i&&mxEvent.consume(e)}),mxUtils.bind(this,function(e){this.isShapeEvent(n,e)&&!i?a.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e,null!=n.shape&&mxEvent.getSource(e)==n.shape.content?null:t(e))):i&&mxEvent.consume(e)}));var s=mxClient.IS_TOUCH?"gestureend":"dblclick";mxEvent.addListener(n.shape.node,s,mxUtils.bind(this,function(e){i=!1,"gestureend"==s?(a.lastTouchTime=0,a.gestureEnabled&&(a.handleGesture(n,e),mxEvent.consume(e))):this.isShapeEvent(n,e)&&(a.dblClick(e,null!=n.shape&&mxEvent.getSource(e)==n.shape.content?null:n.cell),mxEvent.consume(e))}))},mxCellRenderer.prototype.redrawLabel=function(e,t){var n=this.getLabelValue(e);if(null==e.text&&null!=n&&(mxUtils.isNode(n)||0<n.length)?this.createLabel(e,n):null==e.text||null!=n&&0!=n.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);!t&&e.text.value==n&&e.text.isWrapping==a&&e.text.isClipping==i&&e.text.scale==e.view.scale&&e.text.bounds.equals(s)||(e.text.value=n,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 t=e.view.graph,n=e.view.scale,a=t.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*n,i.y+=a.y*n,null!=(t=t.getCellGeometry(e.cell))&&(i.width=Math.max(0,e.text.margin.x*t.width*n-e.text.spacingLeft*n-e.text.spacingRight*n),i.height=Math.max(0,e.text.margin.y*t.height*n-e.text.spacingTop*n-e.text.spacingBottom*n))):(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),t.isSwimlane(e.cell)&&(0<(t=t.getStartSize(e.cell)).width?(a=Math.min(i.width,t.width*n),e.shape.flipH&&(i.x+=i.width-a),i.width=a):0<t.height&&(a=Math.min(i.height,t.height*n),e.shape.flipV&&(i.y+=i.height-a),i.height=a)),this.rotateLabelBounds(e,i)),i},mxCellRenderer.prototype.rotateLabelBounds=function(e,t){if(e.text.isPaintBoundsInverted()){var n=(e.width-e.height)/2;t.x+=n,t.y-=n,n=t.width,t.width=t.height,t.height=n}if(t.x-=e.text.margin.x*t.width,t.y-=e.text.margin.y*t.height,"fill"!=e.style[mxConstants.STYLE_OVERFLOW]){n=e.view.scale;var a=e.text.getSpacing();t.x+=a.x*n,t.y+=a.y*n,t.width=Math.max(0,t.width-e.text.spacingLeft*n-e.text.spacingRight*n),t.height=Math.max(0,t.height-e.text.spacingTop*n-e.text.spacingBottom*n)}var i=e.text.getTextRotation();0!=i&&null!=e&&e.view.graph.model.isVertex(e.cell)&&(n=e.getCenterX(),a=e.getCenterY(),t.x!=n||t.y!=a)&&(i*=Math.PI/180,pt=mxUtils.getRotatedPoint(new mxPoint(t.x,t.y),Math.cos(i),Math.sin(i),new mxPoint(n,a)),t.x=pt.x,t.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,t){var n=t.overlay.getBounds(s);if(!s.view.graph.getModel().isEdge(s.cell)&&null!=s.shape&&0!=r){var a=n.getCenterX(),i=n.getCenterY();a=(i=mxUtils.getRotatedPoint(new mxPoint(a,i),l,d,new mxPoint(s.getCenterX(),s.getCenterY()))).x,i=i.y;n.x=Math.round(a-n.width/2),n.y=Math.round(i-n.height/2)}!o&&null!=t.bounds&&t.scale==s.view.scale&&t.bounds.equals(n)||(t.bounds=n,t.scale=s.view.scale,t.redraw())})}},mxCellRenderer.prototype.redrawControl=function(e,t){if(null!=e.control){var n=this.getControlBounds(e),a=this.legacyControlPosition?mxUtils.getValue(e.style,mxConstants.STYLE_ROTATION,0):e.shape.getTextRotation(),i=e.view.scale;!t&&e.control.scale==i&&e.control.bounds.equals(n)&&e.control.rotation==a||(e.control.rotation=a,e.control.bounds=n,e.control.scale=i,e.control.redraw())}},mxCellRenderer.prototype.getControlBounds=function(e){if(null==e.control)return null;var t=e.control.scale,n=e.control.bounds.width/t,a=(t=e.control.bounds.height/t,e.view.scale),i=e.getCenterX(),s=e.getCenterY();if(!e.view.graph.getModel().isEdge(e.cell)&&(i=e.x+n*a,s=e.y+t*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-n/2*a),Math.round(s-t/2*a),Math.round(n*a),Math.round(t*a))},mxCellRenderer.prototype.redraw=function(e,t,n){if(null!=e.shape){var a=!1;e.view.graph.getModel().isEdge(e.cell),reconfigure=null!=t&&t,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),t=!0),delete e.invalidOrder,delete e.orderChanged,!t&&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==n||n?e.shape.redraw():e.shape.updateBoundingBox()),(null==n||n)&&(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,t){t.destroy()}),e.overlays=null),null!=e.control&&(e.control.destroy(),e.control=null),e.shape.destroy(),e.shape=null)};var mxEdgeStyle={EntityRelation:function(e,t,n,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)(t=new mxCellState).x=r.x,t.y=r.y;else{if(null==t)return;var c=mxUtils.getPortConstraints(t,e,!0,mxConstants.DIRECTION_MASK_NONE);c!=mxConstants.DIRECTION_MASK_NONE?d=c==mxConstants.DIRECTION_MASK_WEST:(r=o.getCellGeometry(t.cell)).relative?d=r.x<=.5:null!=n&&(d=n.x+n.width<t.x)}r=!0,null!=l?((n=new mxCellState).x=l.x,n.y=l.y):null!=n&&((c=mxUtils.getPortConstraints(n,e,!1,mxConstants.DIRECTION_MASK_NONE))!=mxConstants.DIRECTION_MASK_NONE?r=c==mxConstants.DIRECTION_MASK_WEST:(e=o.getCellGeometry(n.cell)).relative?r=e.x<=.5:null!=t&&(r=t.x+t.width<n.x)),null!=t&&null!=n&&(e=d?t.x:t.x+t.width,t=s.getRoutingCenterY(t),o=r?n.x:n.x+n.width,n=s.getRoutingCenterY(n),s=new mxPoint(e+(d?-a:a),t),l=new mxPoint(o+(r?-a:a),n),d==r?(a=d?Math.min(e,o)-a:Math.max(e,o)+a,i.push(new mxPoint(a,t)),i.push(new mxPoint(a,n))):(s.x<l.x==d?(a=t+(n-t)/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,t,n,a,i){if(null!=t){var s=(n=e.view).graph;null!=(a=null!=a&&0<a.length?a[0]:null)&&(a=n.transformControlPoint(e,a),mxUtils.contains(t,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)*n.scale;(e=mxUtils.getValue(e.style,mxConstants.STYLE_DIRECTION,mxConstants.DIRECTION_WEST))==mxConstants.DIRECTION_NORTH||e==mxConstants.DIRECTION_SOUTH?(o=n.getRoutingCenterX(t),r=s):(l=n.getRoutingCenterY(t),d=s),null==a||a.x<t.x||a.x>t.x+t.width?null!=a?(o=a.x,d=Math.max(Math.abs(l-a.y),d)):e==mxConstants.DIRECTION_NORTH?l=t.y-2*r:e==mxConstants.DIRECTION_SOUTH?l=t.y+t.height+2*r:o=e==mxConstants.DIRECTION_EAST?t.x-2*d:t.x+t.width+2*d:null!=a&&(o=n.getRoutingCenterX(t),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,t,n,a,i){var s=null!=a&&0<a.length?a[0]:null,o=!1,r=!1;if(null!=t&&null!=n)if(null!=s){var l=Math.min(t.x,n.x),d=Math.max(t.x+t.width,n.x+n.width),c=(r=Math.min(t.y,n.y),Math.max(t.y+t.height,n.y+n.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(t.x,n.x))==(d=Math.min(t.x+t.width,n.x+n.width)))||(r=(r=Math.max(t.y,n.y))==(c=Math.min(t.y+t.height,n.y+n.height)));r||!o&&e.style[mxConstants.STYLE_ELBOW]!=mxConstants.ELBOW_VERTICAL?mxEdgeStyle.SideToSide(e,t,n,a,i):mxEdgeStyle.TopToBottom(e,t,n,a,i)},SideToSide:function(e,t,n,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&&((t=new mxCellState).x=o.x,t.y=o.y),null!=r&&((n=new mxCellState).x=r.x,n.y=r.y),null!=t&&null!=n&&(e=Math.max(t.x,n.x),o=Math.min(t.x+t.width,n.x+n.width),e=null!=a?a.x:o+(e-o)/2,o=s.getRoutingCenterY(t),s=s.getRoutingCenterY(n),null!=a&&(a.y>=t.y&&a.y<=t.y+t.height&&(o=a.y),a.y>=n.y&&a.y<=n.y+n.height&&(s=a.y)),!mxUtils.contains(n,e,o)&&!mxUtils.contains(t,e,o)&&i.push(new mxPoint(e,o)),!mxUtils.contains(n,e,s)&&!mxUtils.contains(t,e,s)&&i.push(new mxPoint(e,s)),1==i.length&&(null!=a?!mxUtils.contains(n,e,a.y)&&!mxUtils.contains(t,e,a.y)&&i.push(new mxPoint(e,a.y)):(s=Math.max(t.y,n.y),t=Math.min(t.y+t.height,n.y+n.height),i.push(new mxPoint(e,s+(t-s)/2)))))},TopToBottom:function(e,t,n,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&&((t=new mxCellState).x=o.x,t.y=o.y),null!=r&&((n=new mxCellState).x=r.x,n.y=r.y),null!=t&&null!=n&&(o=Math.max(t.y,n.y),r=Math.min(t.y+t.height,n.y+n.height),e=s.getRoutingCenterX(t),null!=a&&a.x>=t.x&&a.x<=t.x+t.width&&(e=a.x),o=null!=a?a.y:r+(o-r)/2,!mxUtils.contains(n,e,o)&&!mxUtils.contains(t,e,o)&&i.push(new mxPoint(e,o)),e=null!=a&&a.x>=n.x&&a.x<=n.x+n.width?a.x:s.getRoutingCenterX(n),!mxUtils.contains(n,e,o)&&!mxUtils.contains(t,e,o)&&i.push(new mxPoint(e,o)),1==i.length&&(null!=a&&1==i.length?!mxUtils.contains(n,a.x,o)&&!mxUtils.contains(t,a.x,o)&&i.push(new mxPoint(a.x,o)):(s=Math.max(t.x,n.x),t=Math.min(t.x+t.width,n.x+n.width),i.push(new mxPoint(s+(t-s)/2,o)))))},SegmentConnector:function(e,t,n,a,i){var s=e.absolutePoints,o=!0,r=null,l=s[0];null==l&&null!=t?l=new mxPoint(e.view.getRoutingCenterX(t),e.view.getRoutingCenterY(t)):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=t,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=n,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!=t&&(r.y<t.y||r.y>t.y+t.height))?i.push(new mxPoint(l.x,r.y)):!o&&(null!=s[0]&&s[0].x!=r.x||null==s[0]&&null!=t&&(r.x<t.x||r.x>t.x+t.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!=n&&(l=new mxPoint(e.view.getRoutingCenterX(n),e.view.getRoutingCenterY(n))),o&&(null!=s[d]&&s[d].y!=r.y||null==s[d]&&null!=n&&(r.y<n.y||r.y>n.y+n.height))?i.push(new mxPoint(l.x,r.y)):!o&&(null!=s[d]&&s[d].x!=r.x||null==s[d]&&null!=n&&(r.x<n.x||r.x>n.x+n.width))&&i.push(new mxPoint(r.x,l.y)),null==s[0]&&null!=t)for(;1<i.length&&mxUtils.contains(t,i[1].x,i[1].y);)i=i.splice(1,1);if(null==s[d]&&null!=n)for(;1<i.length&&mxUtils.contains(n,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,t,n,a,i){var s=e.view.graph,o=null!=t&&s.getModel().isEdge(t.cell);s=null!=n&&s.getModel().isEdge(n.cell);if(null!=a&&0<a.length||o||s)mxEdgeStyle.SegmentConnector(e,t,n,a,i);else{var r=(a=e.absolutePoints)[0],l=a[a.length-1];a=null!=t?t.x:r.x;o=null!=t?t.y:r.y;var d=null!=t?t.width:1,c=null!=t?t.height:1,m=null!=n?n.x:l.x,u=null!=n?n.y:l.y,p=null!=n?n.width:1,g=null!=n?n.height:1,v=(s=e.view.scale*mxEdgeStyle.orthBuffer,[mxConstants.DIRECTION_MASK_ALL,mxConstants.DIRECTION_MASK_ALL]);for(null!=t&&(v[0]=mxUtils.getPortConstraints(t,e,!0,mxConstants.DIRECTION_MASK_ALL)),null!=n&&(v[1]=mxUtils.getPortConstraints(n,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)!=t&&(c=r),t=[[.5,.5],[.5,.5]],d=0;d<2;d++)null!=c&&(t[d][0]=(c.x-a[d][0])/a[d][2],t[d][0]<.01?e[d]=mxConstants.DIRECTION_MASK_WEST:.99<t[d][0]&&(e[d]=mxConstants.DIRECTION_MASK_EAST),t[d][1]=(c.y-a[d][1])/a[d][3],t[d][1]<.01?e[d]=mxConstants.DIRECTION_MASK_NORTH:.99<t[d][1]&&(e[d]=mxConstants.DIRECTION_MASK_SOUTH)),(c=null)!=n&&(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),n=[],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]),n[d]=u[d][0]&v[d],n[d]|=(u[d][1]&v[d])<<8,n[d]|=(u[1-d][d]&v[d])<<16,n[d]|=(u[1-d][1-d]&v[d])<<24,0==(15&n[d])&&(n[d]<<=8),0==(3840&n[d])&&(n[d]=15&n[d]|n[d]>>8),0==(983040&n[d])&&(n[d]=65535&n[d]|(251658240&n[d])>>8),e[d]=15&n[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]+=t[0][1]*a[0][3];break;case mxConstants.DIRECTION_MASK_SOUTH:mxEdgeStyle.wayPoints1[0][0]+=t[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]+=t[0][1]*a[0][3];break;case mxConstants.DIRECTION_MASK_NORTH:mxEdgeStyle.wayPoints1[0][0]+=t[0][0]*a[0][2],mxEdgeStyle.wayPoints1[0][1]-=s}for(r=n=(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)!=n&&(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]+t[p][0]*a[p][2]:u?a[p][1]+t[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--:n=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,t,n,a){var i=e[0]==mxConstants.DIRECTION_MASK_EAST?3:e[0];return e=e[1]==mxConstants.DIRECTION_MASK_EAST?3:e[1],(i-=t)<1&&(i+=4),(e-=t)<1&&(e+=4),t=routePatterns[i-1][e-1],0!=n&&0!=a||null!=inlineRoutePatterns[i-1][e-1]&&(t=inlineRoutePatterns[i-1][e-1]),t}},mxStyleRegistry={values:[],putValue:function(e,t){mxStyleRegistry.values[e]=t},getValue:function(e){return mxStyleRegistry.values[e]},getName:function(e){for(var t in mxStyleRegistry.values)if(mxStyleRegistry.values[t]==e)return t;return null}};function mxGraphView(e){this.graph=e,this.translate=new mxPoint,this.graphBounds=new mxRectangle,this.states=new mxDictionary}function mxCurrentRootChange(e,t){if(this.view=e,this.previous=this.root=t,this.isUp=null==t,!this.isUp)for(var n=this.view.currentRoot,a=this.view.graph.getModel();null!=n;){if(n==t){this.isUp=!0;break}n=a.getParent(n)}}function mxGraph(e,t,n,a){this.mouseListeners=null,this.renderHint=n,this.dialect=mxClient.IS_SVG?mxConstants.DIALECT_SVG:n==mxConstants.RENDERING_HINT_EXACT&&mxClient.IS_VML?mxConstants.DIALECT_VML:n==mxConstants.RENDERING_HINT_FASTEST?mxConstants.DIALECT_STRICTHTML:n==mxConstants.RENDERING_HINT_FASTER?mxConstants.DIALECT_PREFERHTML:mxConstants.DIALECT_MIXEDHTML,this.model=null!=t?t: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,t){this.graphModelChanged(t.getProperty("edit").changes)}),this.model.addListener(mxEvent.CHANGE,this.graphModelChangeListener),this.createHandlers(),null!=e&&this.init(e),this.view.revalidate()}function mxCellOverlay(e,t,n,a,i,s){this.image=e,this.tooltip=t,this.align=null!=n?n: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,t){this.source=e,null!=t&&this.init(t)}function mxMultiplicity(e,t,n,a,i,s,o,r,l,d){this.source=e,this.type=t,this.attr=n,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,t){this.isEnabled()&&this.beforeUndo(t.getProperty("edit"))}),this.moveHandler=mxUtils.bind(this,function(e,t){this.isEnabled()&&this.cellsMoved(t.getProperty("cells"),t.getProperty("event"))}),this.setGraph(e)}function mxSpaceManager(e,t,n,a){this.resizeHandler=mxUtils.bind(this,function(e,t){this.isEnabled()&&this.cellsResized(t.getProperty("cells"))}),this.foldHandler=mxUtils.bind(this,function(e,t){this.isEnabled()&&this.cellsResized(t.getProperty("cells"))}),this.shiftRightwards=null==t||t,this.shiftDownwards=null==n||n,this.extendParents=null==a||a,this.setGraph(e)}function mxSwimlaneManager(e,t,n,a){this.horizontal=null==t||t,this.addEnabled=null==n||n,this.resizeEnabled=null==a||a,this.addHandler=mxUtils.bind(this,function(e,t){this.isEnabled()&&this.isAddEnabled()&&this.cellsAdded(t.getProperty("cells"))}),this.resizeHandler=mxUtils.bind(this,function(e,t){this.isEnabled()&&this.isResizeEnabled()&&this.cellsResized(t.getProperty("cells"))}),this.setGraph(e)}function mxTemporaryCellStates(e,t,n){if(this.view=e,t=null!=t?t:1,this.oldBounds=e.getGraphBounds(),this.oldStates=e.getStates(),this.oldScale=e.getScale(),e.setStates(new mxDictionary),e.setScale(t),null!=n){t=e.createState(new mxCell);for(var a=0;a<n.length;a++)e.validateBounds(t,n[a]);var i=null;for(a=0;a<n.length;a++){var s=e.validatePoints(t,n[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,t){this.point=e,this.perimeter=null==t||t}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,t){null!=e&&(this.graph=e,this.factoryMethod=t,this.graph.addMouseListener(this),this.init())}function mxCellMarker(e,t,n,a){mxEventSource.call(this),null!=e&&(this.graph=e,this.validColor=null!=t?t:mxConstants.DEFAULT_VALID_COLOR,this.invalidColor=null!=t?n: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,t){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,t){mxEventSource.call(this),null!=e&&(this.graph=e,this.factoryMethod=t,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,t){null!=e&&(this.graph=e,this.target=t||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,t){null!=e&&(this.graph=e,this.delay=t||500,this.graph.addMouseListener(this))}function mxCellTracker(e,t,n){mxCellMarker.call(this,e,t),this.graph.addMouseListener(this),null!=n&&(this.getCell=n),mxClient.IS_IE&&mxEvent.addListener(window,"unload",mxUtils.bind(this,function(){this.destroy()}))}function mxCellHighlight(e,t,n,a){null!=e&&(this.graph=e,this.highlightColor=null!=t?t:mxConstants.DEFAULT_VALID_COLOR,this.strokeWidth=null!=n?n: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(t){if(null!=t){this.editor=t,this.handler=new mxKeyHandler(t.graph);var n=this.handler.escape;this.handler.escape=function(e){n.apply(this,arguments),t.hideProperties(),t.fireEvent(new mxEventObject(mxEvent.ESCAPE,"event",e))}}}function mxDefaultPopupMenu(e){this.config=e}function mxDefaultToolbar(e,t){this.editor=t,null!=e&&null!=t&&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 t=null;if(null!=e&&0<e.length)for(var n=this.graph.getModel(),a=0;a<e.length;a++)if(n.isVertex(e[a])||n.isEdge(e[a])){var i=this.getState(e[a]);null!=i&&(null==t?t=new mxRectangle(i.x,i.y,i.width,i.height):t.add(i))}return t},mxGraphView.prototype.setCurrentRoot=function(e){if(this.currentRoot!=e){var t=new mxCurrentRootChange(this,e);t.execute();var n=new mxUndoableEdit(this,!1);n.add(t),this.fireEvent(new mxEventObject(mxEvent.UNDO,"edit",n)),this.graph.sizeDidChange()}return e},mxGraphView.prototype.scaleAndTranslate=function(e,t,n){var a=this.scale,i=new mxPoint(this.translate.x,this.translate.y);this.scale==e&&this.translate.x==t&&this.translate.y==n||(this.scale=e,this.translate.x=t,this.translate.y=n,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 t=this.scale;this.scale!=e&&(this.scale=e,this.isEventsEnabled()&&(this.revalidate(),this.graph.sizeDidChange())),this.fireEvent(new mxEventObject(mxEvent.SCALE,"scale",e,"previousScale",t))},mxGraphView.prototype.getTranslate=function(){return this.translate},mxGraphView.prototype.setTranslate=function(e,t){var n=new mxPoint(this.translate.x,this.translate.y);this.translate.x==e&&this.translate.y==t||(this.translate.x=e,this.translate.y=t,this.isEventsEnabled()&&(this.revalidate(),this.graph.sizeDidChange())),this.fireEvent(new mxEventObject(mxEvent.TRANSLATE,"translate",this.translate,"previousTranslate",n))},mxGraphView.prototype.refresh=function(){null!=this.currentRoot&&this.clear(),this.revalidate()},mxGraphView.prototype.revalidate=function(){this.invalidate(),this.validate()},mxGraphView.prototype.clear=function(e,t,n){var a=this.graph.getModel();if(e=e||a.getRoot(),t=null!=t&&t,n=null==n||n,this.removeState(e),n&&(t||e!=this.currentRoot)){n=a.getChildCount(e);for(var i=0;i<n;i++)this.clear(a.getChildAt(e,i),t)}else this.invalidate(e)},mxGraphView.prototype.invalidate=function(e,t,n,a){var i=this.graph.getModel();if(e=e||i.getRoot(),t=null==t||t,n=null==n||n,a=null!=a&&a,null!=(o=this.getState(e))&&(o.invalid=!0,a&&(o.orderChanged=!0)),t)for(var s=i.getChildCount(e),o=0;o<s;o++){var r=i.getChildAt(e,o);this.invalidate(r,t,n,a)}if(n)for(a=i.getEdgeCount(e),o=0;o<a;o++)this.invalidate(i.getEdgeAt(e,o),t,n)},mxGraphView.prototype.validate=function(e){var t=mxLog.enter("mxGraphView.validate");window.status=mxResources.get(this.updatingDocumentResource)||this.updatingDocumentResource;var n=null;if(this.optimizeVmlReflows&&null!=this.canvas&&null==this.textDiv&&(8==document.documentMode||mxClient.IS_QUIRKS)){n=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!=n&&(this.canvas.style.display=n,document.body.removeChild(this.textDiv),this.textDiv=null),window.status=mxResources.get(this.doneResource)||this.doneResource,mxLog.leave("mxGraphView.validate",t)},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 t=new mxRectangle(0,0,1,1);this.backgroundImage=new mxImageShape(t,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?(t=this.getBackgroundPageBounds(),null==this.backgroundPageShape?(this.backgroundPageShape=this.createBackgroundPageShape(t),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=t,this.backgroundPageShape.redraw())):null!=this.backgroundPageShape&&(this.backgroundPageShape.destroy(),this.backgroundPageShape=null)},mxGraphView.prototype.getBackgroundPageBounds=function(){var e=this.graph.pageFormat,t=this.scale*this.graph.pageScale;return new mxRectangle(this.scale*this.translate.x,this.scale*this.translate.y,e.width*t,e.height*t)},mxGraphView.prototype.redrawBackgroundImage=function(e,t){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*t.width,e.bounds.height=this.scale*t.height,e.redraw()},mxGraphView.prototype.validateBounds=function(e,t){var n=this.graph.getModel(),a=this.getState(t,!0);if(null!=a&&a.invalid){if(this.graph.isCellVisible(t)){if(t!=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(t))){if(!n.isEdge(t)){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,n.isVertex(t)){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(t);null!=(i=this.graph.getChildOffsetForCell(t))&&(a.origin.x+=i.x,a.origin.y+=i.y)}if(null!=a&&(!this.graph.isCellCollapsed(t)||t==this.currentRoot))for(s=n.getChildCount(t),i=0;i<s;i++)o=n.getChildAt(t,i),this.validateBounds(a,o)},mxGraphView.prototype.updateVertexLabelOffset=function(e){var t=mxUtils.getValue(e.style,mxConstants.STYLE_LABEL_POSITION,mxConstants.ALIGN_CENTER);t==mxConstants.ALIGN_LEFT?e.absoluteOffset.x-=e.width:t==mxConstants.ALIGN_RIGHT&&(e.absoluteOffset.x+=e.width),(t=mxUtils.getValue(e.style,mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.ALIGN_MIDDLE))==mxConstants.ALIGN_TOP?e.absoluteOffset.y-=e.height:t==mxConstants.ALIGN_BOTTOM&&(e.absoluteOffset.y+=e.height)},mxGraphView.prototype.validatePoints=function(e,t){var n=this.graph.getModel(),a=this.getState(t),i=null;if(null!=a){if(a.invalid){var s=this.graph.getCellGeometry(t);if(null!=s&&n.isEdge(t)){var o=this.getState(this.getVisibleTerminal(t,!0));if(a.setVisibleTerminalState(o,!0),null!=o&&n.isEdge(o.cell)&&!n.isAncestor(o.cell,t)){var r=this.getState(n.getParent(o.cell));this.validatePoints(r,o.cell)}var l=this.getState(this.getVisibleTerminal(t,!1));a.setVisibleTerminalState(l,!1),null!=l&&n.isEdge(l.cell)&&!n.isAncestor(l.cell,t)&&(r=this.getState(n.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&&n.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,t!=this.currentRoot&&this.graph.cellRenderer.redraw(a,!1,this.isRendering())}(n.isEdge(t)||n.isVertex(t))&&(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(t)||t==this.currentRoot))for(s=n.getChildCount(t),o=0;o<s;o++)r=n.getChildAt(t,o),null!=(r=this.validatePoints(a,r))&&(null==i?i=r:i.add(r));return i},mxGraphView.prototype.childMoved=function(e,t){var n=t.cell;if(!this.graph.isCellCollapsed(n)||n==this.currentRoot)for(var a=this.graph.getModel(),i=a.getChildCount(n),s=0;s<i;s++)this.validateBounds(t,a.getChildAt(n,s))},mxGraphView.prototype.updateFixedTerminalPoints=function(e,t,n){this.updateFixedTerminalPoint(e,t,!0,this.graph.getConnectionConstraint(e,t,!0)),this.updateFixedTerminalPoint(e,n,!1,this.graph.getConnectionConstraint(e,n,!1))},mxGraphView.prototype.updateFixedTerminalPoint=function(e,t,n,a){var i=null;if(null!=a&&(i=this.graph.getConnectionPoint(t,a)),null==i&&null==t){t=this.scale,a=this.translate;var s=e.origin;null!=(i=this.graph.getCellGeometry(e.cell).getTerminalPoint(n))&&(i=new mxPoint(t*(a.x+i.x+s.x),t*(a.y+i.y+s.y)))}e.setAbsoluteTerminalPoint(i,n)},mxGraphView.prototype.updatePoints=function(e,t,n,a){if(null!=e){var i=[];i.push(e.absolutePoints[0]);var s=this.getEdgeStyle(e,t,n,a);if(null!=s)s(e,n=this.getTerminalPort(e,n,!0),a=this.getTerminalPort(e,a,!1),t,i);else if(null!=t)for(s=0;s<t.length;s++)null!=t[s]&&(a=mxUtils.clone(t[s]),i.push(this.transformControlPoint(e,a)));t=e.absolutePoints,i.push(t[t.length-1]),e.absolutePoints=i}},mxGraphView.prototype.transformControlPoint=function(e,t){var n=e.origin;return new mxPoint(this.scale*(t.x+this.translate.x+n.x),this.scale*(t.y+this.translate.y+n.y))},mxGraphView.prototype.getEdgeStyle=function(e,t,n,a){return"string"==typeof(e=null!=n&&n==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==(t=mxStyleRegistry.getValue(e))&&this.isAllowEval()&&(t=mxUtils.eval(e)),e=t),"function"==typeof e?e:null},mxGraphView.prototype.updateFloatingTerminalPoints=function(e,t,n){var a=e.absolutePoints,i=a[0];null==a[a.length-1]&&null!=n&&this.updateFloatingTerminalPoint(e,n,t,!1),null==i&&null!=t&&this.updateFloatingTerminalPoint(e,t,n,!0)},mxGraphView.prototype.updateFloatingTerminalPoint=function(e,t,n,a){t=this.getTerminalPort(e,t,a);var i=this.getNextPoint(e,n,a),s=this.graph.isOrthogonal(e);n=mxUtils.toRadians(Number(t.style[mxConstants.STYLE_ROTATION]||"0"));var o=new mxPoint(t.getCenterX(),t.getCenterY());if(0!=n){var r=Math.cos(-n),l=Math.sin(-n);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),t=this.getPerimeterPoint(t,i,0==n&&s,r),0!=n&&(r=Math.cos(n),l=Math.sin(n),t=mxUtils.getRotatedPoint(t,r,l,o)),e.setAbsoluteTerminalPoint(t,a)},mxGraphView.prototype.getTerminalPort=function(e,t,n){return null!=(e=mxUtils.getValue(e.style,n?mxConstants.STYLE_SOURCE_PORT:mxConstants.STYLE_TARGET_PORT))&&(null!=(e=this.getState(this.graph.getModel().getCell(e)))&&(t=e)),t},mxGraphView.prototype.getPerimeterPoint=function(e,t,n,a){var i=null;if(null!=e){var s=this.getPerimeterFunction(e);null!=s&&null!=t&&(0<(a=this.getPerimeterBounds(e,a)).width||0<a.height)&&(i=s(a,e,t,n)),null==i&&(i=this.getPoint(e))}return i},mxGraphView.prototype.getRoutingCenterX=function(e){var t=null!=e.style&&parseFloat(e.style[mxConstants.STYLE_ROUTING_CENTER_X])||0;return e.getCenterX()+t*e.width},mxGraphView.prototype.getRoutingCenterY=function(e){var t=null!=e.style&&parseFloat(e.style[mxConstants.STYLE_ROUTING_CENTER_Y])||0;return e.getCenterY()+t*e.height},mxGraphView.prototype.getPerimeterBounds=function(e,t){return t=null!=t?t:0,null!=e&&(t+=parseFloat(e.style[mxConstants.STYLE_PERIMETER_SPACING]||0)),e.getPerimeterBounds(t*this.scale)},mxGraphView.prototype.getPerimeterFunction=function(e){if("string"==typeof(e=e.style[mxConstants.STYLE_PERIMETER])){var t=mxStyleRegistry.getValue(e);null==t&&this.isAllowEval()&&(t=mxUtils.eval(e)),e=t}return"function"==typeof e?e:null},mxGraphView.prototype.getNextPoint=function(e,t,n){var a=null;return null!=(e=e.absolutePoints)&&(n||2<e.length||null==t)&&(a=e.length,a=e[n?Math.min(1,a-1):Math.max(0,a-2)]),null==a&&null!=t&&(a=new mxPoint(t.getCenterX(),t.getCenterY())),a},mxGraphView.prototype.getVisibleTerminal=function(e,t){for(var n=this.graph.getModel(),a=n.getTerminal(e,t),i=a;null!=a&&a!=this.currentRoot;)this.graph.isCellVisible(i)&&!this.graph.isCellCollapsed(a)||(i=a),a=n.getParent(a);return n.getParent(i)==n.getRoot()&&(i=null),i},mxGraphView.prototype.updateEdgeBounds=function(e){var t=e.absolutePoints;if(e.length=0,null!=t&&0<t.length){var n=t[0],a=t[t.length-1];if(null==n||null==a)e.cell!=this.currentRoot&&this.clear(e.cell,!0);else{if(n.x!=a.x||n.y!=a.y){var i=a.x-n.x,s=a.y-n.y;e.terminalDistance=Math.sqrt(i*i+s*s)}else e.terminalDistance=0;a=0;var o=[];if(null!=(s=n)){n=s.x;for(var r=s.y,l=n,d=r,c=1;c<t.length;c++){var m=t[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,n=Math.min(s.x,n),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=n,e.y=r,e.width=Math.max(1,l-n),e.height=Math.max(1,d-r)}}}},mxGraphView.prototype.getPoint=function(e,t){var n=e.getCenterX(),a=e.getCenterY();if(null==e.segments||null!=t&&!t.relative)null!=t&&(null!=(d=t.offset)&&(n+=d.x,a+=d.y));else{for(var i=e.absolutePoints.length,s=(.5+(null!=t?t.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=n=a=0,null!=t){a=t.y;var d=t.offset;null!=d&&(n=d.x,r=d.y)}d=l.x-s.x,l=l.y-s.y,n=s.x+d*i+((0==o?0:l/o)*a+n)*this.scale,a=s.y+l*i-((0==o?0:d/o)*a-r)*this.scale}}return new mxPoint(n,a)},mxGraphView.prototype.getRelativePoint=function(e,t,n){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,t,n),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,t,n))<=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=t-l))*e+(s=(d=o.y-s)-(s=n-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,t,n)),-1==mxUtils.relativeCcw(o.x,o.y,r.x,r.y,t,n)&&(a=-a),new mxPoint((i/2-m-e)/i*-2,a/this.scale)}}return new mxPoint},mxGraphView.prototype.updateEdgeLabelOffset=function(e){var t=e.absolutePoints;if(e.absoluteOffset.x=e.getCenterX(),e.absoluteOffset.y=e.getCenterY(),null!=t&&0<t.length&&null!=e.segments)if((i=this.graph.getCellGeometry(e.cell)).relative){null!=(n=this.getPoint(e,i))&&(e.absoluteOffset=n)}else{var n=t[0],a=t[t.length-1];if(null!=n&&null!=a){t=a.x-n.x;var i,s=a.y-n.y,o=a=0;null!=(i=i.offset)&&(a=i.x,o=i.y),i=n.y+s/2+o*this.scale,e.absoluteOffset.x=n.x+t/2+a*this.scale,e.absoluteOffset.y=i}}},mxGraphView.prototype.getState=function(e,t){t=t||!1;var n=null;return null!=e&&(n=this.states.get(e),this.graph.isCellVisible(e)&&(null==n&&t&&this.graph.isCellVisible(e)?(n=this.createState(e),this.states.put(e,n)):t&&null!=n&&this.updateStyle&&(n.style=this.graph.getCellStyle(e)))),n},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 t=[],n=0;n<e.length;n++){var a=this.getState(e[n]);null!=a&&t.push(a)}return t},mxGraphView.prototype.removeState=function(e){var t=null;return null!=e&&(null!=(t=this.states.remove(e))&&(this.graph.cellRenderer.destroy(t),t.destroy())),t},mxGraphView.prototype.createState=function(e){var t=this.graph.getCellStyle(e);return e=new mxCellState(this,e,t),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 t=mxUtils.getOffset(this.graph.container);e=new mxPoint(e.clientX-t.x,e.clientY-t.y);t=this.graph.container.offsetWidth;var n=this.graph.container.clientWidth;return n<t&&e.x>n+2&&e.x<=t||(t=this.graph.container.offsetHeight,(n=this.graph.container.clientHeight)<t&&e.y>n+2&&e.y<=t)},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,t){a.panningHandler.hideMenu()},mouseMove:function(){},mouseUp:function(){}}),this.moveHandler=mxUtils.bind(this,function(e){var t,n;null!=a.tooltipHandler&&a.tooltipHandler.isHideOnHover()&&a.tooltipHandler.hide(),this.captureDocumentGesture&&a.isMouseDown&&!mxEvent.isConsumed(e)&&a.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,(t=e,n=null,mxClient.IS_TOUCH&&(n=mxEvent.getClientX(t),t=mxEvent.getClientY(t),t=mxUtils.convertPoint(i,n,t),n=a.view.getState(a.getCellAt(t.x,t.y))),n)))}),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,t){if(null!=this.graph.container){var n=this.graph.container.offsetHeight;this.canvas.style.width=this.graph.container.offsetWidth<e?e+"px":"100%",this.canvas.style.height=n<t?t+"px":"100%"}},mxGraphView.prototype.createHtmlPane=function(e,t){var n=document.createElement("DIV");return null!=e&&null!=t?(n.style.position="absolute",n.style.left="0px",n.style.top="0px",n.style.width=e,n.style.height=t):n.style.position="relative",n},mxGraphView.prototype.createVml=function(){var e=this.graph.container;if(null!=e){var t=e.offsetWidth,n=e.offsetHeight;this.canvas=this.createVmlPane(t,n),this.backgroundPane=this.createVmlPane(t,n),this.drawPane=this.createVmlPane(t,n),this.overlayPane=this.createVmlPane(t,n),this.canvas.appendChild(this.backgroundPane),this.canvas.appendChild(this.drawPane),this.canvas.appendChild(this.overlayPane),e.appendChild(this.canvas)}},mxGraphView.prototype.createVmlPane=function(e,t){var n=document.createElement(mxClient.VML_PREFIX+":group");return n.style.position="absolute",n.style.left="0px",n.style.top="0px",n.style.width=e+"px",n.style.height=t+"px",n.setAttribute("coordsize",e+","+t),n.setAttribute("coordorigin","0,0"),n},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 t=document.createElementNS(mxConstants.NS_SVG,"svg");t.style.width="100%",t.style.height="100%",t.style.display="block",t.appendChild(this.canvas),null!=e&&(e.appendChild(t),"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 t=[],n=0;n<e.length;n++){var a=e[n];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(t,i)<0&&t.push(i)}}return this.getModel().getTopmostCells(t)},mxGraph.prototype.graphModelChanged=function(e){for(var t=0;t<e.length;t++)this.processChange(e[t]);this.removeSelectionCells(this.getRemovedCellsForChanges(e)),this.view.validate(),this.sizeDidChange()},mxGraph.prototype.getRemovedCellsForChanges=function(e){for(var t=[],n=0;n<e.length;n++){var a=e[n];if(a instanceof mxRootChange)break;a instanceof mxChildChange?null!=a.previous&&null==a.parent&&(t=t.concat(this.model.getDescendants(a.child))):a instanceof mxVisibleChange&&(t=t.concat(this.model.getDescendants(a.cell)))}return t},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 t=this.model.getParent(e.child);null!=t?this.view.invalidate(e.child,!0,!1,null!=e.previous):(this.removeStateForCell(e.child),this.view.currentRoot==e.child&&this.home()),t!=e.previous&&(null!=t&&this.view.invalidate(t,!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 t=this.model.getChildCount(e),n=0;n<t;n++)this.removeStateForCell(this.model.getChildAt(e,n));this.view.removeState(e)},mxGraph.prototype.addCellOverlay=function(e,t){null==e.overlays&&(e.overlays=[]),e.overlays.push(t);var n=this.view.getState(e);return null!=n&&this.cellRenderer.redraw(n),this.fireEvent(new mxEventObject(mxEvent.ADD_OVERLAY,"cell",e,"overlay",t)),t},mxGraph.prototype.getCellOverlays=function(e){return e.overlays},mxGraph.prototype.removeCellOverlay=function(e,t){if(null==t)this.removeCellOverlays(e);else{var n=mxUtils.indexOf(e.overlays,t);0<=n?(e.overlays.splice(n,1),0==e.overlays.length&&(e.overlays=null),null!=(n=this.view.getState(e))&&this.cellRenderer.redraw(n),this.fireEvent(new mxEventObject(mxEvent.REMOVE_OVERLAY,"cell",e,"overlay",t))):t=null}return t},mxGraph.prototype.removeCellOverlays=function(e){var t=e.overlays;if(null!=t){e.overlays=null;var n=this.view.getState(e);for(null!=n&&this.cellRenderer.redraw(n),n=0;n<t.length;n++)this.fireEvent(new mxEventObject(mxEvent.REMOVE_OVERLAY,"cell",e,"overlay",t[n]))}return t},mxGraph.prototype.clearCellOverlays=function(e){e=null!=e?e:this.model.getRoot(),this.removeCellOverlays(e);for(var t=this.model.getChildCount(e),n=0;n<t;n++){var a=this.model.getChildAt(e,n);this.clearCellOverlays(a)}},mxGraph.prototype.setCellWarning=function(n,e,t,a){return null!=e&&0<e.length?(e=new mxCellOverlay(t=null!=t?t:this.warningImage,"<font color=red>"+e+"</font>"),a&&e.addListener(mxEvent.CLICK,mxUtils.bind(this,function(e,t){this.isEnabled()&&this.setSelectionCell(n)})),this.addCellOverlay(n,e)):(this.removeCellOverlays(n),null)},mxGraph.prototype.startEditing=function(e){this.startEditingAtCell(null,e)},mxGraph.prototype.startEditingAtCell=function(e,t){null==e&&(null!=(e=this.getSelectionCell())&&!this.isCellEditable(e)&&(e=null)),null!=e&&(this.fireEvent(new mxEventObject(mxEvent.START_EDITING,"cell",e,"event",t)),this.cellEditor.startEditing(e,t))},mxGraph.prototype.getEditingValue=function(e,t){return this.convertValueToString(e)},mxGraph.prototype.stopEditing=function(e){this.cellEditor.stopEditing(e)},mxGraph.prototype.labelChanged=function(e,t,n){this.model.beginUpdate();try{this.cellLabelChanged(e,t,this.isAutoSizeCell(e)),this.fireEvent(new mxEventObject(mxEvent.LABEL_CHANGED,"cell",e,"value",t,"event",n))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellLabelChanged=function(e,t,n){this.model.beginUpdate();try{this.model.setValue(e,t),n&&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 t=0;t<e.length;t++){var n=this.view.getState(e[t]);null!=n&&null!=n.handler&&n.handler.reset()}},mxGraph.prototype.click=function(e){var t=e.getEvent(),n=e.getCell(),a=new mxEventObject(mxEvent.CLICK,"event",t,"cell",n);e.isConsumed()&&a.consume(),this.fireEvent(a),this.isEnabled()&&!mxEvent.isConsumed(t)&&!a.isConsumed()&&(null!=n?this.selectCellForEvent(n,t):(n=null,this.isSwimlaneSelectionEnabled()&&(n=this.getSwimlaneAt(e.getGraphX(),e.getGraphY())),null!=n?this.selectCellForEvent(n,t):this.isToggleEvent(t)||this.clearSelection()))},mxGraph.prototype.dblClick=function(e,t){var n=new mxEventObject(mxEvent.DOUBLE_CLICK,"event",e,"cell",t);this.fireEvent(n),this.isEnabled()&&!mxEvent.isConsumed(e)&&!n.isConsumed()&&null!=t&&this.isCellEditable(t)&&this.startEditingAtCell(t,e)},mxGraph.prototype.scrollPointToVisible=function(e,t,n,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,t+this.panDy));else{var i=this.container;if(a=null!=a?a:20,e>=i.scrollLeft&&t>=i.scrollTop&&e<=i.scrollLeft+i.clientWidth&&t<=i.scrollTop+i.clientHeight){var s=i.scrollLeft+i.clientWidth-e;if(s<a){if(e=i.scrollLeft,i.scrollLeft+=a-s,n&&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-t)<a?(e=i.scrollTop,i.scrollTop+=a-s,e==i.scrollTop&&n&&(this.dialect==mxConstants.DIALECT_SVG?(e=this.view.getDrawPane().ownerSVGElement,t=this.container.scrollHeight+a-s):(t=Math.max(i.clientHeight,i.scrollHeight)+a-s,e=this.view.getCanvas()),e.style.height=t+"px",i.scrollTop+=a-s)):(s=t-i.scrollTop)<a&&(i.scrollTop-=a-s)}}},mxGraph.prototype.createPanningManager=function(){return new mxPanningManager(this)},mxGraph.prototype.getBorderSizes=function(){function e(e){var t=0;t="thin"==e?2:"medium"==e?4:"thick"==e?6:parseInt(e);return isNaN(t)&&(t=0),t}var t=mxUtils.getCurrentStyle(this.container),n=new mxRectangle;return n.x=e(t.borderLeftWidth)+parseInt(t.paddingLeft||0),n.y=e(t.borderTopWidth)+parseInt(t.paddingTop||0),n.width=e(t.borderRightWidth)+parseInt(t.paddingRight||0),n.height=e(t.borderBottomWidth)+parseInt(t.paddingBottom||0),n},mxGraph.prototype.getPreferredPageSize=function(e,t,n){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 t=this.pageBreaksVisible?Math.ceil(t/i.width):1,n=this.pageBreaksVisible?Math.ceil(n/i.height):1,new mxRectangle(0,0,t*i.width+2+a.x/e,n*i.height+2+a.y/e)},mxGraph.prototype.sizeDidChange=function(){var e=this.getGraphBounds();if(null!=this.container){var t=this.getBorder(),n=Math.max(0,e.x+e.width+1+t);t=Math.max(0,e.y+e.height+1+t);if(null!=this.minimumContainerSize&&(n=Math.max(n,this.minimumContainerSize.width),t=Math.max(t,this.minimumContainerSize.height)),this.resizeContainer&&this.doResizeContainer(n,t),this.preferPageSize||!mxClient.IS_IE&&this.pageVisible){var a=this.getPreferredPageSize(e,n,t);null!=a&&(n=a.width,t=a.height)}null!=this.minimumGraphSize&&(n=Math.max(n,this.minimumGraphSize.width*this.view.scale),t=Math.max(t,this.minimumGraphSize.height*this.view.scale)),n=Math.ceil(n-1),t=Math.ceil(t-1),this.dialect==mxConstants.DIALECT_SVG?((a=this.view.getDrawPane().ownerSVGElement).style.minWidth=Math.max(1,n)+"px",a.style.minHeight=Math.max(1,t)+"px",a.style.width="100%",a.style.height="100%"):mxClient.IS_QUIRKS?this.view.updateHtmlCanvasSize(Math.max(1,n),Math.max(1,t)):(this.view.canvas.style.minWidth=Math.max(1,n)+"px",this.view.canvas.style.minHeight=Math.max(1,t)+"px"),this.updatePageBreaks(this.pageBreaksVisible,n-1,t-1)}this.fireEvent(new mxEventObject(mxEvent.SIZE,"bounds",e))},mxGraph.prototype.doResizeContainer=function(e,t){if(mxClient.IS_IE)if(mxClient.IS_QUIRKS){var n=this.getBorderSizes();e+=Math.max(2,n.x+n.width+1),t+=Math.max(2,n.y+n.height+1)}else 9<=document.documentMode?(e+=3,t+=5):(e+=1,t+=1);else t+=1;null!=this.maximumContainerSize&&(e=Math.min(this.maximumContainerSize.width,e),t=Math.min(this.maximumContainerSize.height,t)),this.container.style.width=Math.ceil(e)+"px",this.container.style.height=Math.ceil(t)+"px"},mxGraph.prototype.updatePageBreaks=function(e,t,n){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((t-i.x)/i.width):0,e=e?Math.ceil((n-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,n)];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(t,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 t=this.model.getStyle(e),n=null;n=this.model.isEdge(e)?this.stylesheet.getDefaultEdgeStyle():this.stylesheet.getDefaultVertexStyle();return null!=t&&(n=this.postProcessCellStyle(this.stylesheet.getCellStyle(t,n))),null==n&&(n=mxGraph.prototype.EMPTY_ARRAY),n},mxGraph.prototype.postProcessCellStyle=function(e){if(null!=e){var t=e[mxConstants.STYLE_IMAGE],n=this.getImageFromBundles(t);null!=n?e[mxConstants.STYLE_IMAGE]=n:n=t,null!=n&&"data:image/"==n.substring(0,11)&&(0<(t=n.indexOf(","))&&(n=n.substring(0,t)+";base64,"+n.substring(t+1)),e[mxConstants.STYLE_IMAGE]=n)}return e},mxGraph.prototype.setCellStyle=function(e,t){if(null!=(t=t||this.getSelectionCells())){this.model.beginUpdate();try{for(var n=0;n<t.length;n++)this.model.setStyle(t[n],e)}finally{this.model.endUpdate()}}},mxGraph.prototype.toggleCellStyle=function(e,t,n){n=n||this.getSelectionCell(),this.toggleCellStyles(e,t,[n])},mxGraph.prototype.toggleCellStyles=function(e,t,n){var a;(t=null!=t&&t,null!=(n=n||this.getSelectionCells())&&0<n.length)&&(null!=(a=null!=(a=this.view.getState(n[0]))?a.style:this.getCellStyle(n[0]))&&(t=mxUtils.getValue(a,e,t)?0:1,this.setCellStyles(e,t,n)))},mxGraph.prototype.setCellStyles=function(e,t,n){n=n||this.getSelectionCells(),mxUtils.setCellStyles(this.model,n,e,t)},mxGraph.prototype.toggleCellStyleFlags=function(e,t,n){this.setCellStyleFlags(e,t,null,n)},mxGraph.prototype.setCellStyleFlags=function(e,t,n,a){if(null!=(a=a||this.getSelectionCells())&&0<a.length){var i;if(null==n)null!=(i=null!=(i=this.view.getState(a[0]))?i.style:this.getCellStyle(a[0]))&&(n=(parseInt(i[e]||0)&t)!=t);mxUtils.setCellStyleFlags(this.model,a,e,t,n)}},mxGraph.prototype.alignCells=function(e,t,n){if(null==t&&(t=this.getSelectionCells()),null!=t&&1<t.length){if(null==n)for(var a=0;a<t.length;a++){var i=this.getCellGeometry(t[a]);if(null!=i&&!this.model.isEdge(t[a]))if(null==n){if(e==mxConstants.ALIGN_CENTER){n=i.x+i.width/2;break}if(e==mxConstants.ALIGN_RIGHT)n=i.x+i.width;else if(e==mxConstants.ALIGN_TOP)n=i.y;else{if(e==mxConstants.ALIGN_MIDDLE){n=i.y+i.height/2;break}n=e==mxConstants.ALIGN_BOTTOM?i.y+i.height:i.x}}else n=e==mxConstants.ALIGN_RIGHT?Math.max(n,i.x+i.width):e==mxConstants.ALIGN_TOP?Math.min(n,i.y):e==mxConstants.ALIGN_BOTTOM?Math.max(n,i.y+i.height):Math.min(n,i.x)}if(null!=n){this.model.beginUpdate();try{for(a=0;a<t.length;a++)null!=(i=this.getCellGeometry(t[a]))&&!this.model.isEdge(t[a])&&(i=i.clone(),e==mxConstants.ALIGN_CENTER?i.x=n-i.width/2:e==mxConstants.ALIGN_RIGHT?i.x=n-i.width:e==mxConstants.ALIGN_TOP?i.y=n:e==mxConstants.ALIGN_MIDDLE?i.y=n-i.height/2:e==mxConstants.ALIGN_BOTTOM?i.y=n-i.height:i.x=n,this.model.setGeometry(t[a],i));this.fireEvent(new mxEventObject(mxEvent.ALIGN_CELLS,"align",e,"cells",t))}finally{this.model.endUpdate()}}}return t},mxGraph.prototype.flipEdge=function(e){if(null!=e&&null!=this.alternateEdgeStyle){this.model.beginUpdate();try{var t=this.model.getStyle(e);null==t||0==t.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 t=[],n=0;n<this.imageBundles.length;n++)this.imageBundles[n]!=e&&t.push(this.imageBundles[n]);this.imageBundles=t},mxGraph.prototype.getImageFromBundles=function(e){if(null!=e)for(var t=0;t<this.imageBundles.length;t++){var n=this.imageBundles[t].getImage(e);if(null!=n)return n}return null},mxGraph.prototype.orderCells=function(e,t){null==t&&(t=mxUtils.sortCells(this.getSelectionCells(),!0)),this.model.beginUpdate();try{this.cellsOrdered(t,e),this.fireEvent(new mxEventObject(mxEvent.ORDER_CELLS,"back",e,"cells",t))}finally{this.model.endUpdate()}return t},mxGraph.prototype.cellsOrdered=function(e,t){if(null!=e){this.model.beginUpdate();try{for(var n=0;n<e.length;n++){var a=this.model.getParent(e[n]);t?this.model.add(a,e[n],n):this.model.add(a,e[n],this.model.getChildCount(a)-1)}this.fireEvent(new mxEventObject(mxEvent.CELLS_ORDERED,"back",t,"cells",e))}finally{this.model.endUpdate()}}},mxGraph.prototype.groupCells=function(e,t,n){null==n&&(n=mxUtils.sortCells(this.getSelectionCells(),!0)),n=this.getCellsForGroup(n),null==e&&(e=this.createGroupCell(n));var a=this.getBoundsForGroup(e,n,t);if(0<n.length&&null!=a){var i=this.model.getParent(e);null==i&&(i=this.model.getParent(n[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(n,e,s,null,null,!1,!1),this.cellsMoved(n,-a.x,-a.y,!1,!0),this.cellsResized([e],[a]),this.fireEvent(new mxEventObject(mxEvent.GROUP_CELLS,"group",e,"border",t,"cells",n))}finally{this.model.endUpdate()}}return e},mxGraph.prototype.getCellsForGroup=function(e){var t=[];if(null!=e&&0<e.length){var n=this.model.getParent(e[0]);t.push(e[0]);for(var a=1;a<e.length;a++)this.model.getParent(e[a])==n&&t.push(e[a])}return t},mxGraph.prototype.getBoundsForGroup=function(e,t,n){return null!=(t=this.getBoundingBoxFromGeometry(t))&&(this.isSwimlane(e)&&(e=this.getStartSize(e),t.x-=e.width,t.y-=e.height,t.width+=e.width,t.height+=e.height),t.x-=n,t.y-=n,t.width+=2*n,t.height+=2*n),t},mxGraph.prototype.createGroupCell=function(e){return(e=new mxCell("")).setVertex(!0),e.setConnectable(!1),e},mxGraph.prototype.ungroupCells=function(e){var t=[];if(null==e){e=this.getSelectionCells();for(var n=[],a=0;a<e.length;a++)0<this.model.getChildCount(e[a])&&n.push(e[a]);e=n}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),t=t.concat(i)}}this.cellsRemoved(this.addAllEdges(e)),this.fireEvent(new mxEventObject(mxEvent.UNGROUP_CELLS,"cells",e))}finally{this.model.endUpdate()}}return t},mxGraph.prototype.removeCellsFromParent=function(e){null==e&&(e=this.getSelectionCells()),this.model.beginUpdate();try{var t=this.getDefaultParent(),n=this.model.getChildCount(t);this.cellsAdded(e,t,n,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,t,n){null==e&&(e=this.getSelectionCells()),t=null!=t?t:0,n=null!=n&&n,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();n&&(r.x+=s.x-o.width-t,r.y+=s.y-o.height-t),r.width=s.width+o.width+2*t,r.height=s.height+o.height+2*t,this.model.setGeometry(e[a],r),this.moveCells(i,-s.x+o.width+t,-s.y+o.height+t)}}}}}finally{this.model.endUpdate()}return e},mxGraph.prototype.cloneCells=function(e,t){t=null==t||t;var n=null;if(null!=e){for(var a={},i=(n=[],0);i<e.length;i++){a[s=mxCellPath.create(e[i])]=e[i],n.push(e[i])}if(0<n.length){var s=this.view.scale,o=this.view.translate;for(n=this.model.cloneCells(e,!0),i=0;i<e.length;i++)if(!t&&this.model.isEdge(n[i])&&null!=this.getEdgeValidationError(n[i],this.model.getTerminal(n[i],!0),this.model.getTerminal(n[i],!1)))n[i]=null;else{var r=this.model.getGeometry(n[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(n[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 n=[]}return n},mxGraph.prototype.insertVertex=function(e,t,n,a,i,s,o,r,l){return t=this.createVertex(e,t,n,a,i,s,o,r,l),this.addCell(t,e)},mxGraph.prototype.createVertex=function(e,t,n,a,i,s,o,r,l){return(e=new mxGeometry(a,i,s,o)).relative=null!=l&&l,(n=new mxCell(n,e,r)).setId(t),n.setVertex(!0),n.setConnectable(!0),n},mxGraph.prototype.insertEdge=function(e,t,n,a,i,s){return t=this.createEdge(e,t,n,a,i,s),this.addEdge(t,e,a,i)},mxGraph.prototype.createEdge=function(e,t,n,a,i,s){return(e=new mxCell(n,new mxGeometry,s)).setId(t),e.setEdge(!0),e.geometry.relative=!0,e},mxGraph.prototype.addEdge=function(e,t,n,a,i){return this.addCell(e,t,i,n,a)},mxGraph.prototype.addCell=function(e,t,n,a,i){return this.addCells([e],t,n,a,i)[0]},mxGraph.prototype.addCells=function(e,t,n,a,i){null==t&&(t=this.getDefaultParent()),null==n&&(n=this.model.getChildCount(t)),this.model.beginUpdate();try{this.cellsAdded(e,t,n,a,i,!1,!0),this.fireEvent(new mxEventObject(mxEvent.ADD_CELLS,"cells",e,"parent",t,"index",n,"source",a,"target",i))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellsAdded=function(e,t,n,a,i,s,o){if(null!=e&&null!=t&&null!=n){this.model.beginUpdate();try{for(var r=null!=(d=s?this.view.getState(t):null)?d.origin:null,l=new mxPoint(0,0),d=0;d<e.length;d++)if(null==e[d])n--;else{var c=this.model.getParent(e[d]);if(null!=r&&e[d]!=t&&t!=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)}}t==c&&n+d>this.model.getChildCount(t)&&n--,this.model.add(t,e[d],n+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",t,"index",n,"source",a,"target",i,"absolute",s))}finally{this.model.endUpdate()}}},mxGraph.prototype.removeCells=function(e,t){t=null==t||t,null==e&&(e=this.getDeletableCells(this.getSelectionCells())),t&&(e=this.getDeletableCells(this.addAllEdges(e))),this.model.beginUpdate();try{this.cellsRemoved(e),this.fireEvent(new mxEventObject(mxEvent.REMOVE_CELLS,"cells",e,"includeEdges",t))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellsRemoved=function(e){if(null!=e&&0<e.length){var t=this.view.scale,n=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/t-n.x,m[u].y/t-n.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,t,n,a,i){a=a||0,i=i||0,null==n&&(n=this.cloneCells([e])[0]);var s=this.model.getParent(e),o=this.model.getTerminal(e,!0);this.model.beginUpdate();try{this.cellsMoved(t,a,i,!1,!1),this.cellsAdded(t,s,this.model.getChildCount(s),null,null,!0),this.cellsAdded([n],s,this.model.getChildCount(s),o,t[0],!1),this.cellConnected(e,t[0],!0),this.fireEvent(new mxEventObject(mxEvent.SPLIT_EDGE,"edge",e,"cells",t,"newEdge",n,"dx",a,"dy",i))}finally{this.model.endUpdate()}return n},mxGraph.prototype.toggleCells=function(e,t,n){null==t&&(t=this.getSelectionCells()),n&&(t=this.addAllEdges(t)),this.model.beginUpdate();try{this.cellsToggled(t,e),this.fireEvent(new mxEventObject(mxEvent.TOGGLE_CELLS,"show",e,"cells",t,"includeEdges",n))}finally{this.model.endUpdate()}return t},mxGraph.prototype.cellsToggled=function(e,t){if(null!=e&&0<e.length){this.model.beginUpdate();try{for(var n=0;n<e.length;n++)this.model.setVisible(e[n],t)}finally{this.model.endUpdate()}}},mxGraph.prototype.foldCells=function(e,t,n,a){t=null!=t&&t,null==n&&(n=this.getFoldableCells(this.getSelectionCells(),e)),this.stopEditing(!1),this.model.beginUpdate();try{this.cellsFolded(n,e,t,a),this.fireEvent(new mxEventObject(mxEvent.FOLD_CELLS,"collapse",e,"recurse",t,"cells",n))}finally{this.model.endUpdate()}return n},mxGraph.prototype.cellsFolded=function(e,t,n,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],t))&&t!=this.isCellCollapsed(e[i])&&(this.model.setCollapsed(e[i],t),this.swapBounds(e[i],t),this.isExtendParent(e[i])&&this.extendParent(e[i]),n)){var s=this.model.getChildren(e[i]);this.foldCells(s,t,n)}this.fireEvent(new mxEventObject(mxEvent.CELLS_FOLDED,"cells",e,"collapse",t,"recurse",n))}finally{this.model.endUpdate()}}},mxGraph.prototype.swapBounds=function(e,t){if(null!=e){var n=this.model.getGeometry(e);null!=n&&(n=n.clone(),this.updateAlternateBounds(e,n,t),n.swap(),this.model.setGeometry(e,n))}},mxGraph.prototype.updateAlternateBounds=function(e,t,n){if(null!=e&&null!=t){if(n=null!=(n=this.view.getState(e))?n.style:this.getCellStyle(e),null==t.alternateBounds){var a=t;this.collapseToPreferredSize&&(null!=(e=this.getPreferredSizeForCell(e))&&(a=e,0<(e=mxUtils.getValue(n,mxConstants.STYLE_STARTSIZE))&&(a.height=Math.max(a.height,e)))),t.alternateBounds=new mxRectangle(0,0,a.width,a.height)}if(null!=t.alternateBounds){t.alternateBounds.x=t.x,t.alternateBounds.y=t.y;var i=mxUtils.toRadians(n[mxConstants.STYLE_ROTATION]||"0");0!=i&&(e=t.alternateBounds.getCenterX()-t.getCenterX(),n=t.alternateBounds.getCenterY()-t.getCenterY(),a=Math.cos(i),i=Math.sin(i),t.alternateBounds.x+=a*e-i*n-e,t.alternateBounds.y+=i*e+a*n-n)}}},mxGraph.prototype.addAllEdges=function(e){var t=e.slice();return t.concat(this.getAllEdges(e))},mxGraph.prototype.getAllEdges=function(e){var t=[];if(null!=e)for(var n=0;n<e.length;n++){for(var a=this.model.getEdgeCount(e[n]),i=0;i<a;i++)t.push(this.model.getEdgeAt(e[n],i));a=this.model.getChildren(e[n]),t=t.concat(this.getAllEdges(a))}return t},mxGraph.prototype.updateCellSize=function(e,t){t=null!=t&&t,this.model.beginUpdate();try{this.cellSizeUpdated(e,t),this.fireEvent(new mxEventObject(mxEvent.UPDATE_CELL_SIZE,"cell",e,"ignoreChildren",t))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellSizeUpdated=function(e,t){if(null!=e){this.model.beginUpdate();try{var n=this.getPreferredSizeForCell(e),a=this.model.getGeometry(e);if(null!=n&&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,n.height+8),i&&(a.height=n.height+8),a.width=n.width):(r=mxUtils.setStyle(r,mxConstants.STYLE_STARTSIZE,n.width+8),i&&(a.width=n.width+8),a.height=n.height),this.model.setStyle(e,r)}else a.width=n.width,a.height=n.height;if(!t&&!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 t=null;if(null!=e){var n=this.view.getState(e),a=null!=n?n.style:this.getCellStyle(e);if(null!=a&&!this.model.isEdge(e)){var i=a[mxConstants.STYLE_FONTSIZE]||mxConstants.DEFAULT_FONTSIZE,s=0;t=0;null==this.getImage(n)&&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&&(t+=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,t+=2*(a[mxConstants.STYLE_SPACING]||0),t+=a[mxConstants.STYLE_SPACING_TOP]||0,t+=a[mxConstants.STYLE_SPACING_BOTTOM]||0,null!=(n=this.getFoldingImage(n))&&(s+=n.width+8),t=null!=(n=this.getLabel(e))&&0<n.length?(this.isHtmlLabel(e)||(n=n.replace(/\n/g,"<br>")),e=(i=mxUtils.getSizeForString(n,i,a[mxConstants.STYLE_FONTFAMILY])).width+s,t=i.height+t,mxUtils.getValue(a,mxConstants.STYLE_HORIZONTAL,!0)||(a=t,t=e,e=a),this.gridEnabled&&(e=this.snap(e+this.gridSize/2),t=this.snap(t+this.gridSize/2)),new mxRectangle(0,0,e,t)):new mxRectangle(0,0,a=4*this.gridSize,a)}}return t},mxGraph.prototype.handleGesture=function(e,t){if(.2<Math.abs(1-t.scale)){var n=this.view.scale,a=this.view.translate,i=e.width*t.scale,s=e.height*t.scale,o=e.y-(s-e.height)/2;n=new mxRectangle(this.snap((e.x-(i-e.width)/2)/n)-a.x,this.snap(o/n)-a.y,this.snap(i/n),this.snap(s/n));this.resizeCell(e.cell,n)}},mxGraph.prototype.resizeCell=function(e,t){return this.resizeCells([e],[t])[0]},mxGraph.prototype.resizeCells=function(e,t){this.model.beginUpdate();try{this.cellsResized(e,t),this.fireEvent(new mxEventObject(mxEvent.RESIZE_CELLS,"cells",e,"bounds",t))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellsResized=function(e,t){if(null!=e&&null!=t&&e.length==t.length){this.model.beginUpdate();try{for(var n=0;n<e.length;n++){var a=t[n],i=this.model.getGeometry(e[n]);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[n])&&!this.isAllowNegativeCoordinates()&&(i.x=Math.max(0,i.x),i.y=Math.max(0,i.y)),this.model.setGeometry(e[n],i),this.isExtendParent(e[n])&&this.extendParent(e[n])}}this.resetEdgesOnResize&&this.resetEdges(e),this.fireEvent(new mxEventObject(mxEvent.CELLS_RESIZED,"cells",e,"bounds",t))}finally{this.model.endUpdate()}}},mxGraph.prototype.extendParent=function(e){if(null!=e){var t=this.model.getParent(e),n=this.model.getGeometry(t);null!=t&&null!=n&&!this.isCellCollapsed(t)&&(null!=(e=this.model.getGeometry(e))&&(n.width<e.x+e.width||n.height<e.y+e.height))&&((n=n.clone()).width=Math.max(n.width,e.x+e.width),n.height=Math.max(n.height,e.y+e.height),this.cellsResized([t],[n]))}},mxGraph.prototype.importCells=function(e,t,n,a,i){return this.moveCells(e,t,n,!0,a,i)},mxGraph.prototype.moveCells=function(e,t,n,a,i,s){if(t=null!=t?t:0,n=null!=n?n:0,a=null!=a&&a,null!=e&&(0!=t||0!=n||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,t,n,!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",t,"dy",n,"clone",a,"target",i,"event",s))}finally{this.model.endUpdate()}}return e},mxGraph.prototype.cellsMoved=function(e,t,n,a,i){if(null!=e&&(0!=t||0!=n)){this.model.beginUpdate();try{a&&this.disconnectGraph(e);for(var s=0;s<e.length;s++)this.translateCell(e[s],t,n),i&&this.constrainChild(e[s]);this.resetEdgesOnMove&&this.resetEdges(e),this.fireEvent(new mxEventObject(mxEvent.CELLS_MOVED,"cells",e,"dx",n,"dy",n,"disconnect",a))}finally{this.model.endUpdate()}}},mxGraph.prototype.translateCell=function(e,t,n){var a=this.model.getGeometry(e);null!=a&&((a=a.clone()).translate(t,n),!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(t,n):(a.offset.x+=t,a.offset.y+=n)),this.model.setGeometry(e,a))},mxGraph.prototype.getCellContainmentArea=function(e){if(null!=e&&!this.model.isEdge(e)){var t=this.model.getParent(e);if(t==this.getDefaultParent()||t==this.getCurrentRoot())return this.getMaximumGraphBounds();if(null!=t&&t!=this.getDefaultParent())if(null!=(i=this.model.getGeometry(t))){var n=e=0,a=i.width,i=i.height;return this.isSwimlane(t)&&(e=(t=this.getStartSize(t)).width,a-=t.width,n=t.height,i-=t.height),new mxRectangle(e,n,a,i)}}return null},mxGraph.prototype.getMaximumGraphBounds=function(){return this.maximumGraphBounds},mxGraph.prototype.constrainChild=function(e){if(null!=e){var t=this.model.getGeometry(e),n=this.isConstrainChild(e)?this.getCellContainmentArea(e):this.getMaximumGraphBounds();null!=t&&null!=n&&!t.relative&&(t.x<n.x||t.y<n.y||n.width<t.x+t.width||n.height<t.y+t.height)&&(e=this.getOverlap(e),0<n.width&&(t.x=Math.min(t.x,n.x+n.width-(1-e)*t.width)),0<n.height&&(t.y=Math.min(t.y,n.y+n.height-(1-e)*t.height)),t.x=Math.max(t.x,n.x-t.width*e),t.y=Math.max(t.y,n.y-t.height*e))}},mxGraph.prototype.resetEdges=function(e){if(null!=e){for(var t={},n=0;n<e.length;n++){var a=mxCellPath.create(e[n]);t[a]=e[n]}this.model.beginUpdate();try{for(n=0;n<e.length;n++){var i=this.model.getEdges(e[n]);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==t[l]||null==t[d])&&this.resetEdge(i[a])}this.resetEdges(this.model.getChildren(e[n]))}}finally{this.model.endUpdate()}}},mxGraph.prototype.resetEdge=function(e){var t=this.model.getGeometry(e);return null!=t&&null!=t.points&&0<t.points.length&&((t=t.clone()).points=[],this.model.setGeometry(e,t)),e},mxGraph.prototype.getAllConnectionConstraints=function(e,t){return null!=e&&null!=e.shape&&null!=e.shape.stencil?e.shape.stencil.constraints:null},mxGraph.prototype.getConnectionConstraint=function(e,t,n){t=null;var a=e.style[n?mxConstants.STYLE_EXIT_X:mxConstants.STYLE_ENTRY_X];if(null!=a){var i=e.style[n?mxConstants.STYLE_EXIT_Y:mxConstants.STYLE_ENTRY_Y];null!=i&&(t=new mxPoint(parseFloat(a),parseFloat(i)))}return a=!1,null!=t&&(a=mxUtils.getValue(e.style,n?mxConstants.STYLE_EXIT_PERIMETER:mxConstants.STYLE_ENTRY_PERIMETER,!0)),new mxConnectionConstraint(t,a)},mxGraph.prototype.setConnectionConstraint=function(e,t,n,a){if(null!=a){this.model.beginUpdate();try{null==a||null==a.point?(this.setCellStyles(n?mxConstants.STYLE_EXIT_X:mxConstants.STYLE_ENTRY_X,null,[e]),this.setCellStyles(n?mxConstants.STYLE_EXIT_Y:mxConstants.STYLE_ENTRY_Y,null,[e]),this.setCellStyles(n?mxConstants.STYLE_EXIT_PERIMETER:mxConstants.STYLE_ENTRY_PERIMETER,null,[e])):null!=a.point&&(this.setCellStyles(n?mxConstants.STYLE_EXIT_X:mxConstants.STYLE_ENTRY_X,a.point.x,[e]),this.setCellStyles(n?mxConstants.STYLE_EXIT_Y:mxConstants.STYLE_ENTRY_Y,a.point.y,[e]),a.perimeter?this.setCellStyles(n?mxConstants.STYLE_EXIT_PERIMETER:mxConstants.STYLE_ENTRY_PERIMETER,null,[e]):this.setCellStyles(n?mxConstants.STYLE_EXIT_PERIMETER:mxConstants.STYLE_ENTRY_PERIMETER,"0",[e]))}finally{this.model.endUpdate()}}},mxGraph.prototype.getConnectionPoint=function(e,t){var n=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!=t.point){var l=n=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&&(n=-1,d=-a.width),u&&(l=-1,c=-a.height)}n=new mxPoint(a.x+t.point.x*a.width*n-d,a.y+t.point.y*a.height*l-c)}s=e.style[mxConstants.STYLE_ROTATION]||0,t.perimeter?(0!=o&&null!=n&&(r=a=0,90==o?r=1:180==o?a=-1:270==s&&(r=-1),n=mxUtils.getRotatedPoint(n,a,r,i)),null!=n&&t.perimeter&&(n=this.view.getPerimeterPoint(e,n,!1))):s+=o,0!=s&&null!=n&&(o=mxUtils.toRadians(s),a=Math.cos(o),r=Math.sin(o),n=mxUtils.getRotatedPoint(n,a,r,i))}return n},mxGraph.prototype.connectCell=function(e,t,n,a){this.model.beginUpdate();try{var i=this.model.getTerminal(e,n);this.cellConnected(e,t,n,a),this.fireEvent(new mxEventObject(mxEvent.CONNECT_CELL,"edge",e,"terminal",t,"source",n,"previous",i))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellConnected=function(e,t,n,a){if(null!=e){this.model.beginUpdate();try{var i=this.model.getTerminal(e,n);this.setConnectionConstraint(e,t,n,a),this.isPortsEnabled()&&(a=null,this.isPort(t)&&(a=t.getId(),t=this.getTerminalForPort(t,n)),this.setCellStyles(n?mxConstants.STYLE_SOURCE_PORT:mxConstants.STYLE_TARGET_PORT,a,[e])),this.model.setTerminal(e,t,n),this.resetEdgesOnConnect&&this.resetEdge(e),this.fireEvent(new mxEventObject(mxEvent.CELL_CONNECTED,"edge",e,"terminal",t,"source",n,"previous",i))}finally{this.model.endUpdate()}}},mxGraph.prototype.disconnectGraph=function(e){if(null!=e){this.model.beginUpdate();try{for(var t=this.view.scale,n=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/t-n.x+l,c[0].y/t-n.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/t-n.x+l,c[v].y/t-n.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,t){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(),t=this.getCurrentRoot();if(null!=t){for(var n=this.model.getParent(t);n!=e&&!this.isValidRoot(n)&&this.model.getParent(n)!=e;)n=this.model.getParent(n);n==e||this.model.getParent(n)==e?this.view.setCurrentRoot(null):this.view.setCurrentRoot(n),null!=this.view.getState(t)&&this.setSelectionCell(t)}},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,t,n){var a=[e];if(t&&(a=a.concat(this.model.getEdges(e))),a=this.view.getBounds(a),n){n=this.model.getChildCount(e);for(var i=0;i<n;i++){var s=this.getCellBounds(this.model.getChildAt(e,i),t,!0);null!=a?a.add(s):a=s}}return a},mxGraph.prototype.getBoundingBoxFromGeometry=function(e,t){t=null!=t&&t;var n=null;if(null!=e)for(var a=0;a<e.length;a++)if(t||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==n?n=new mxRectangle(i.x,i.y,i.width,i.height):n.add(i)}}return n},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,t){if(this.useScrollbarsForPanning&&mxUtils.hasScrollbars(this.container))this.container.scrollLeft=-e,this.container.scrollTop=-t;else{var n=this.view.getCanvas();if(this.dialect==mxConstants.DIALECT_SVG)if(0==e&&0==t){if(mxClient.IS_IE?n.setAttribute("transform","translate("+e+","+t+")"):n.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(n.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(n.setAttribute("transform","translate("+e+","+t+")"),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!=n.parentNode?s.appendChild(a):s=this.shiftPreview2,a=i;this.container.insertBefore(this.shiftPreview1,n.parentNode),this.container.appendChild(this.shiftPreview2)}this.shiftPreview1.style.left=e+"px",this.shiftPreview1.style.top=t+"px",this.shiftPreview2.style.left=e+"px",this.shiftPreview2.style.top=t+"px"}else n.style.left=e+"px",n.style.top=t+"px";this.panDx=e,this.panDy=t,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,t){this.zoom(e/this.view.scale,t)},mxGraph.prototype.zoom=function(e,t){t=null!=t?t:this.centerZoom;var n=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=n,this.scrollRectToVisible(a)||(this.view.revalidate(),this.view.setScale(n));else if(t&&!mxUtils.hasScrollbars(this.container)){a=this.container.offsetWidth;var i=this.container.offsetHeight;if(1<e){var s=(e-1)/(2*n);a=a*-s,i=i*-s}else a*=s=(1/e-1)/(2*this.view.scale),i*=s;this.view.scaleAndTranslate(n,this.view.translate.x+a,this.view.translate.y+i)}else this.view.setScale(n),mxUtils.hasScrollbars(this.container)&&(i=a=0,t&&(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 t=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 n=Math.min(this.container.scrollWidth,e.x+e.width),a=Math.min(this.container.scrollHeight,e.y+e.height);e.width=n-e.x,e.height=a-e.y,t<1?(n=((t=e.height/t)-e.height)/2,e.height=t,t=Math.min(e.y,n),e.y-=t,a=Math.min(this.container.scrollHeight,e.y+e.height),e.height=a-e.y):(n=((t*=e.width)-e.width)/2,e.width=t,t=Math.min(e.x,n),e.x-=t,n=Math.min(this.container.scrollWidth,e.x+e.width),e.width=n-e.x),t=this.container.clientWidth/e.width,n=this.view.scale*t,mxUtils.hasScrollbars(this.container)?(this.view.setScale(n),this.container.scrollLeft=Math.round(e.x*t),this.container.scrollTop=Math.round(e.y*t)):this.view.scaleAndTranslate(n,this.view.translate.x-e.x/this.view.scale,this.view.translate.y-e.y/this.view.scale)},mxGraph.prototype.fit=function(e,t){if(null!=this.container){e=null!=e?e:0,t=null!=t&&t;var n=this.container.clientWidth,a=this.container.clientHeight,i=this.view.getGraphBounds();t&&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=t?e:2*e;n=Math.floor(100*Math.min(n/(o+l),a/(r+l)))/100;null!=this.minFitScale&&(n=Math.max(n,this.minFitScale)),null!=this.maxFitScale&&(n=Math.min(n,this.maxFitScale)),t?this.view.scale!=n&&this.view.setScale(n):mxUtils.hasScrollbars(this.container)?(this.view.setScale(n),null!=i.x&&(this.container.scrollLeft=Math.round(i.x/s)*n-e-Math.max(0,(this.container.clientWidth-o*n)/2)),null!=i.y&&(this.container.scrollTop=Math.round(i.y/s)*n-e-Math.max(0,(this.container.clientHeight-r*n)/2))):this.view.scaleAndTranslate(n,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,t){var n=-this.view.translate.x,a=-this.view.translate.y,i=this.view.getState(e);null!=i&&(n=new mxRectangle(n+i.x,a+i.y,i.width,i.height),t&&null!=this.container&&(a=this.container.clientWidth,i=this.container.clientHeight,n.x=n.getCenterX()-a/2,n.width=a,n.y=n.getCenterY()-i/2,n.height=i),this.scrollRectToVisible(n)&&this.view.setTranslate(this.view.translate.x,this.view.translate.y))},mxGraph.prototype.scrollRectToVisible=function(e){var t=!1;if(null!=e){var n=this.container.offsetWidth,a=this.container.offsetHeight,i=Math.min(n,e.width),s=Math.min(a,e.height);if(mxUtils.hasScrollbars(this.container)){n=this.container,e.x+=this.view.translate.x,e.y+=this.view.translate.y;var o=n.scrollLeft-e.x;a=Math.max(o-n.scrollLeft,0);0<o?n.scrollLeft-=o+2:0<(o=e.x+i-n.scrollLeft-n.clientWidth)&&(n.scrollLeft+=o+2),i=n.scrollTop-e.y,o=Math.max(0,i-n.scrollTop),0<i?n.scrollTop-=i+2:0<(i=e.y+s-n.scrollTop-n.clientHeight)&&(n.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+n&&(this.view.translate.x-=(e.x+i-n-o)/l,t=!0),e.y+s>r+a&&(this.view.translate.y-=(e.y+s-a-r)/l,t=!0),e.x<o&&(this.view.translate.x+=(o-e.x)/l,t=!0),e.y<r&&(this.view.translate.y+=(r-e.y)/l,t=!0),t&&(this.view.refresh(),null!=this.selectionCellsHandler&&this.selectionCellsHandler.refresh())}}return t},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 t=e.style[mxConstants.STYLE_ORTHOGONAL];return null!=t?t:(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 t=e.getVisibleTerminalState(!0);return e=e.getVisibleTerminalState(!1),null!=t&&t==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,t,n){return null==this.getEdgeValidationError(e,t,n)},mxGraph.prototype.getEdgeValidationError=function(e,t,n){if(null!=e&&!this.isAllowDanglingEdges()&&(null==t||null==n))return"";if(null!=e&&null==this.model.getTerminal(e,!0)&&null==this.model.getTerminal(e,!1))return null;if(!this.allowLoops&&t==n&&null!=t||!this.isValidConnection(t,n))return"";if(null==t||null==n)return this.allowDanglingEdges?null:"";var a="";this.multigraph||(1<(i=this.model.getEdgesBetween(t,n,!0)).length||1==i.length&&i[0]!=e)&&(a+=(mxResources.get(this.alreadyConnectedResource)||this.alreadyConnectedResource)+"\n");var i=this.model.getDirectedEdgeCount(t,!0,e),s=this.model.getDirectedEdgeCount(n,!1,e);if(null!=this.multiplicities)for(var o=0;o<this.multiplicities.length;o++){var r=this.multiplicities[o].check(this,e,t,n,i,s);null!=r&&(a+=r)}return null!=(r=this.validateEdge(e,t,n))&&(a+=r),0<a.length?a:null},mxGraph.prototype.validateEdge=function(e,t,n){return null},mxGraph.prototype.validateGraph=function(e,t){e=null!=e?e:this.model.getRoot(),t=null!=t?t:{};for(var n=!0,a=this.model.getChildCount(e),i=0;i<a;i++){var s=this.model.getChildAt(e,i),o=t;this.isValidRoot(s)&&(o={}),null!=(o=this.validateGraph(s,o))?this.setCellWarning(s,o.replace(/\n/g,"<br>")):this.setCellWarning(s,null),n=n&&null==o}return a="",this.isCellCollapsed(e)&&!n&&(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,t))&&(a+=i),null==this.model.getParent(e)&&this.view.validate(),0<a.length||!n?a:null},mxGraph.prototype.getCellValidationError=function(e){var t=this.model.getDirectedEdgeCount(e,!0),n=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<t||1==s.min&&0==t||1==s.max&&1<t)?a+=s.countError+"\n":!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")}return 0<a.length?a:null},mxGraph.prototype.validateCell=function(e,t){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 t=this.isCellCollapsed(e.cell);if(this.isCellFoldable(e.cell,!t))return t?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 t="";if(this.labelsVisible&&null!=e){var n=null!=(n=this.view.getState(e))?n.style:this.getCellStyle(e);mxUtils.getValue(n,mxConstants.STYLE_NOLABEL,!1)||(t=this.convertValueToString(e))}return t},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 t=this.view.getState(e);return null!=(e=null!=t?t.style:this.getCellStyle(e))&&"wrap"==e[mxConstants.STYLE_WHITE_SPACE]},mxGraph.prototype.isLabelClipped=function(e){var t=this.view.getState(e);return null!=(e=null!=t?t.style:this.getCellStyle(e))&&"hidden"==e[mxConstants.STYLE_OVERFLOW]},mxGraph.prototype.getTooltip=function(e,n,t,a){var i=null;return null!=e&&(null==e.control||n!=e.control.node&&n.parentNode!=e.control.node||(i=this.collapseExpandResource,i=mxResources.get(i)||i),null==i&&null!=e.overlays&&e.overlays.visit(function(e,t){null!=i||n!=t.node&&n.parentNode!=t.node||(i=t.overlay.toString())}),null==i&&(null!=(t=this.selectionCellsHandler.getHandler(e.cell))&&"function"==typeof t.getTooltipForNode&&(i=t.getTooltipForNode(n))),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 t=new mxRectangle,n=this.view.getState(e);return null!=(e=null!=n?n.style:this.getCellStyle(e))&&(n=parseInt(mxUtils.getValue(e,mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_STARTSIZE)),mxUtils.getValue(e,mxConstants.STYLE_HORIZONTAL,!0)?t.height=n:t.width=n),t},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 t;if(null!=e&&this.model.getParent(e)!=this.model.getRoot()&&(null!=(t=null!=(t=this.view.getState(e))?t.style:this.getCellStyle(e))&&!this.model.isEdge(e)))return t[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 t=this.model.getGeometry(e);return this.isCellsLocked()||null!=t&&this.model.isVertex(e)&&t.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 t=this.view.getState(e);return e=null!=t?t.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 t=this.view.getState(e);return e=null!=t?t.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 t=null!=(t=this.view.getState(e))?t.style:this.getCellStyle(e);return this.isCellsMovable()&&!this.isCellLocked(e)&&0!=t[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 t=null!=(t=this.view.getState(e))?t.style:this.getCellStyle(e);return this.isCellsResizable()&&!this.isCellLocked(e)&&0!=t[mxConstants.STYLE_RESIZABLE]},mxGraph.prototype.isCellsResizable=function(){return this.cellsResizable},mxGraph.prototype.setCellsResizable=function(e){this.cellsResizable=e},mxGraph.prototype.isTerminalPointMovable=function(e,t){return!0},mxGraph.prototype.isCellBendable=function(e){var t=null!=(t=this.view.getState(e))?t.style:this.getCellStyle(e);return this.isCellsBendable()&&!this.isCellLocked(e)&&0!=t[mxConstants.STYLE_BENDABLE]},mxGraph.prototype.isCellsBendable=function(){return this.cellsBendable},mxGraph.prototype.setCellsBendable=function(e){this.cellsBendable=e},mxGraph.prototype.isCellEditable=function(e){var t=null!=(t=this.view.getState(e))?t.style:this.getCellStyle(e);return this.isCellsEditable()&&!this.isCellLocked(e)&&0!=t[mxConstants.STYLE_EDITABLE]},mxGraph.prototype.isCellsEditable=function(){return this.cellsEditable},mxGraph.prototype.setCellsEditable=function(e){this.cellsEditable=e},mxGraph.prototype.isCellDisconnectable=function(e,t,n){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,t){return this.isValidSource(e)&&this.isValidTarget(t)},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 t=this.cellEditor.getEditingCell();return null==e?null!=t:e==t},mxGraph.prototype.isAutoSizeCell=function(e){var t=this.view.getState(e);return e=null!=t?t.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,t){return this.model.filterCells(e,mxUtils.bind(this,function(e){return this.isCellFoldable(e,t)}))},mxGraph.prototype.isCellFoldable=function(e,t){var n=null!=(n=this.view.getState(e))?n.style:this.getCellStyle(e);return 0<this.model.getChildCount(e)&&0!=n[mxConstants.STYLE_FOLDABLE]},mxGraph.prototype.isValidDropTarget=function(e,t,n){return null!=e&&(this.isSplitEnabled()&&this.isSplitTarget(e,t,n)||!this.model.isEdge(e)&&(this.isSwimlane(e)||0<this.model.getChildCount(e)&&!this.isCellCollapsed(e)))},mxGraph.prototype.isSplitTarget=function(e,t,n){return!(!this.model.isEdge(e)||null==t||1!=t.length||!this.isCellConnectable(t[0])||null!=this.getEdgeValidationError(e,this.model.getTerminal(e,!0),t[0]))&&(n=this.model.getTerminal(e,!0),e=this.model.getTerminal(e,!1),!this.model.isAncestor(t[0],n)&&!this.model.isAncestor(t[0],e))},mxGraph.prototype.getDropTarget=function(e,t,n){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(t),mxEvent.getClientY(t))).x-=this.panDx,a.y-=this.panDy,a=this.getSwimlaneAt(a.x,a.y),null==n)n=a;else if(null!=a){for(var i=this.model.getParent(a);null!=i&&this.isSwimlane(i)&&i!=n;)i=this.model.getParent(i);i==n&&(n=a)}for(;null!=n&&!this.isValidDropTarget(n,e,t)&&!this.model.isLayer(n);)n=this.model.getParent(n);return!this.model.isLayer(n)&&mxUtils.indexOf(e,n)<0?n: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,t,n){if(null!=(n=n||this.getDefaultParent()))for(var a=this.model.getChildCount(n),i=0;i<a;i++){var s=this.model.getChildAt(n,i),o=this.getSwimlaneAt(e,t,s);if(null!=o)return o;if(this.isSwimlane(s)&&(o=this.view.getState(s),this.intersects(o,e,t)))return s}return null},mxGraph.prototype.getCellAt=function(e,t,n,a,i){if(a=null==a||a,i=null==i||i,null!=(n=null!=n?n:this.getDefaultParent()))for(var s=this.model.getChildCount(n)-1;0<=s;s--){var o=this.model.getChildAt(n,s),r=this.getCellAt(e,t,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,t)))return o}return null},mxGraph.prototype.intersects=function(e,t,n){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,t,n)<=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()),t=(i=mxUtils.getRotatedPoint(new mxPoint(t,n),a,i,s)).x,n=i.y),mxUtils.contains(e,t,n))return!0}return!1},mxGraph.prototype.hitsSwimlaneContent=function(e,t,n){var a=this.getView().getState(e);if(e=this.getStartSize(e),null!=a){var i=this.getView().getScale();if(t-=a.x,n-=a.y,0<e.width&&0<t&&t>e.width*i||0<e.height&&0<n&&n>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,t,n){for(e=null!=e?e:this.getDefaultParent(),e=this.model.getChildCells(e,null!=t&&t,null!=n&&n),t=[],n=0;n<e.length;n++)this.isCellVisible(e[n])&&t.push(e[n]);return t},mxGraph.prototype.getConnections=function(e,t){return this.getEdges(e,t,!0,!0,!1)},mxGraph.prototype.getIncomingEdges=function(e,t){return this.getEdges(e,t,!0,!1,!1)},mxGraph.prototype.getOutgoingEdges=function(e,t){return this.getEdges(e,t,!1,!0,!1)},mxGraph.prototype.getEdges=function(e,t,n,a,i,s){n=null==n||n,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,n,a)))}for(o=o.concat(this.model.getEdges(e,n,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&&(n&&c==e&&(null==t||this.isValidAncestor(l,t,s))||a&&l==e&&(null==t||this.isValidAncestor(c,t,s))))&&r.push(o[d]);return r},mxGraph.prototype.isValidAncestor=function(e,t,n){return n?this.model.isAncestor(t,e):this.model.getParent(e)==t},mxGraph.prototype.getOpposites=function(e,t,n,a){n=null==n||n,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==t&&null!=l&&l!=t&&a){var d=mxCellPath.create(l);null==s[d]&&(s[d]=l,i.push(l))}else l==t&&null!=r&&r!=t&&n&&(null==s[d=mxCellPath.create(r)]&&(s[d]=r,i.push(r)))}return i},mxGraph.prototype.getEdgesBetween=function(e,t,n){n=null!=n&&n;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==t||!n&&o==t&&r==e)&&i.push(a[s])}return i},mxGraph.prototype.getPointForEvent=function(e,t){var n=mxUtils.convertPoint(this.container,mxEvent.getClientX(e),mxEvent.getClientY(e)),a=this.view.scale,i=this.view.translate,s=0!=t?this.gridSize/2:0;return n.x=this.snap(n.x/a-i.x-s),n.y=this.snap(n.y/a-i.y-s),n},mxGraph.prototype.getCells=function(e,t,n,a,i,s){if(s=null!=s?s:[],0<n||0<a){var o=e+n,r=t+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>=t&&u.x+u.width<=o?s.push(c):this.getCells(e,t,n,a,c,s)}}}return s},mxGraph.prototype.getCellsBeyond=function(e,t,n,a,i){var s=[];if((a||i)&&(null==n&&(n=this.getDefaultParent()),null!=n))for(var o=this.model.getChildCount(n),r=0;r<o;r++){var l=this.model.getChildAt(n,r),d=this.view.getState(l);this.isCellVisible(l)&&null!=d&&(!a||d.x>=e)&&(!i||d.y>=t)&&s.push(l)}return s},mxGraph.prototype.findTreeRoots=function(e,t,n){t=null!=t&&t,n=null!=n&&n;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,t?e:null),m=0,u=0,p=0;p<c.length;p++)this.view.getVisibleTerminal(c[p],!0)==d?m++:u++;(n&&0==m&&0<u||!n&&0==u&&0<m)&&a.push(d),r<(c=n?u-m:m-u)&&(r=c,o=d)}}0==a.length&&null!=o&&a.push(o)}return a},mxGraph.prototype.traverse=function(e,t,n,a,i){if(null!=n&&null!=e){t=null==t||t,i=i||[];var s=mxCellPath.create(e);if(null==i[s]&&(null==(a=n(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;t&&!r||(r=this.model.getTerminal(o,!r),this.traverse(r,t,n,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,t){var n=this.getCells(e.x,e.y,e.width,e.height);return this.selectCellsForEvent(n,t),n},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,t,n){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&&!t||null==this.view.getState(i)||null==this.model.getGeometry(i)?null!=a&&n?0<this.model.getChildCount(a)&&(e=this.model.getChildAt(a,0),this.setSelectionCell(e)):0<s&&(t=i.getIndex(a),e=e?(t++,this.model.getChildAt(i,t%s)):(t--,this.model.getChildAt(i,t<0?s-1:t)),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(t,n,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)&&t||this.model.isEdge(e)&&n)});e=this.model.filterDescendants(a,e),this.setSelectionCells(e)},mxGraph.prototype.selectCellForEvent=function(e,t){var n=this.isCellSelected(e);this.isToggleEvent(t)?n?this.removeSelectionCell(e):this.addSelectionCell(e):(!n||1!=this.getSelectionCount())&&this.setSelectionCell(e)},mxGraph.prototype.selectCellsForEvent=function(e,t){this.isToggleEvent(t)?this.addSelectionCells(e):this.setSelectionCells(e)},mxGraph.prototype.createHandler=function(e){var t=null;return null!=e&&(t=this.model.isEdge(e.cell)?(t=this.view.getEdgeStyle(e),this.isLoop(e)||t==mxEdgeStyle.ElbowConnector||t==mxEdgeStyle.SideToSide||t==mxEdgeStyle.TopToBottom?new mxElbowEdgeHandler(e):t==mxEdgeStyle.SegmentConnector||t==mxEdgeStyle.OrthConnector?new mxEdgeSegmentHandler(e):new mxEdgeHandler(e)):new mxVertexHandler(e)),t},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 t=0;t<this.mouseListeners.length;t++)if(this.mouseListeners[t]==e){this.mouseListeners.splice(t,1);break}},mxGraph.prototype.updateMouseEvent=function(e){if(null==e.graphX||null==e.graphY){var t=mxUtils.convertPoint(this.container,e.getX(),e.getY());e.graphX=t.x-this.panDx,e.graphY=t.y-this.panDy}},mxGraph.prototype.fireMouseEvent=function(e,t,n){if(null==n&&(n=this),this.updateMouseEvent(t),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-t.getX())<this.doubleTapTolerance&&Math.abs(this.lastTouchY-t.getY())<this.doubleTapTolerance?(this.lastTouchTime=0,this.dblClick(t.getEvent(),t.getCell()),t.getEvent().cancelBubble=!0):(this.lastTouchX=t.getX(),this.lastTouchY=t.getY(),this.lastTouchTime=a)}if(a=2!=t.getEvent().detail,mxClient.IS_IE&&"CSS1Compat"==document.compatMode&&((null!=this.lastMouseX&&Math.abs(this.lastMouseX-t.getX())>this.doubleTapTolerance||null!=this.lastMouseY&&Math.abs(this.lastMouseY-t.getY())>this.doubleTapTolerance)&&(a=!0),e==mxEvent.MOUSE_UP&&(this.lastMouseX=t.getX(),this.lastMouseY=t.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||t.getEvent().target!=this.container)){if(e==mxEvent.MOUSE_MOVE&&this.isMouseDown&&this.autoScroll&&this.scrollPointToVisible(t.getGraphX(),t.getGraphY(),this.autoExtend),null!=this.mouseListeners)for(n=[n,t],t.getEvent().returnValue=!0,a=0;a<this.mouseListeners.length;a++){var i=this.mouseListeners[a];e==mxEvent.MOUSE_DOWN?i.mouseDown.apply(i,n):e==mxEvent.MOUSE_MOVE?i.mouseMove.apply(i,n):e==mxEvent.MOUSE_UP&&i.mouseUp.apply(i,n)}e==mxEvent.MOUSE_UP&&this.click(t)}}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 t=e.view.graph.getModel().isEdge(e.cell),n=e.view.scale,a=null,i=this.image.width,s=this.image.height;return t?a=1==(t=e.absolutePoints).length%2?t[Math.floor(t.length/2)]:(e=t[(a=t.length/2)-1],t=t[a],new mxPoint(e.x+(t.x-e.x)/2,e.y+(t.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)*n),Math.round(a.y-(s*this.defaultOverlap-this.offset.y)*n),i*n,s*n)},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 t=this.outline.graphModelChanged;this.outline.graphModelChanged=mxUtils.bind(this,function(e){!this.suspended&&null!=this.outline&&t.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,t){!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 t=this.source.view.scale,n=new mxRectangle((n=this.source.getGraphBounds()).x/t+this.source.panDx,n.y/t+this.source.panDy,n.width/t,n.height/t),a=new mxRectangle(0,0,this.source.container.clientWidth/t,this.source.container.clientHeight/t);(s=n.clone()).add(a);var i=this.getSourceContainerSize(),s=(a=Math.max(i.width/t,s.width),t=Math.max(i.height/t,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/t))){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=(t=this.source.view.translate).x+this.source.panDx;var o=t.y+this.source.panDy;null!=(s=this.getOutlineOffset(s))&&(i+=s.x,o+=s.y),n.x<0&&(i-=n.x),n.y<0&&(o-=n.y),a.translate.x==i&&a.translate.y==o||(a.translate.x=i,a.translate.y=o,e=!0);n=a.translate,i=(s=this.source.getView().scale)/a.scale,o=1/a.scale;var r=this.source.container;this.bounds=new mxRectangle((n.x-t.x-this.source.panDx)/o,(n.y-t.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,(n=this.selectionBorder.bounds).x==this.bounds.x&&n.y==this.bounds.y&&n.width==this.bounds.width&&n.height==this.bounds.height||(this.selectionBorder.bounds=this.bounds,this.selectionBorder.redraw()),n=this.sizer.bounds,a=new mxRectangle(this.bounds.x+this.bounds.width-n.width/2,this.bounds.y+this.bounds.height-n.height/2,n.width,n.height),n.x==a.x&&n.y==a.y&&n.width==a.width&&n.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,t){this.enabled&&this.showViewport&&(this.zoom=t.isSource(this.sizer),this.startX=t.getX(),this.startY=t.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),t.consume()},mxOutline.prototype.mouseMove=function(e,t){if(this.active){this.selectionBorder.node.style.display=this.showViewport?"":"none",this.sizer.node.style.display=this.selectionBorder.node.style.display;var n=t.getX()-this.startX,a=t.getY()-this.startY,i=null;if(this.zoom)a=n/((i=this.source.container).clientWidth/i.clientHeight),i=new mxRectangle(this.bounds.x,this.bounds.y,Math.max(1,this.bounds.width+n),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+n,this.bounds.y+a,this.bounds.width,this.bounds.height);this.selectionBorder.bounds=i,this.selectionBorder.redraw(),n=n/s*this.source.getView().scale,a=a/s*this.source.getView().scale,this.source.panGraph(-n-this.dx0,-a-this.dy0)}n=this.sizer.bounds,this.sizer.bounds=new mxRectangle(i.x+i.width-n.width/2,i.y+i.height-n.height/2,n.width,n.height),"hidden"!=this.sizer.node.style.visibility&&this.sizer.redraw(),t.consume()}},mxOutline.prototype.mouseUp=function(e,t){if(this.active){var n=t.getX()-this.startX,a=t.getY()-this.startY;if(0<Math.abs(n)||0<Math.abs(a)){if(this.zoom){a=this.selectionBorder.bounds.width;var i=this.source.getView().scale;this.source.zoomTo(i-n*i/a,!1)}else this.source.useScrollbarsForPanning&&mxUtils.hasScrollbars(this.source.container)||(this.source.panGraph(0,0),n/=this.outline.getView().scale,a/=this.outline.getView().scale,i=this.source.getView().translate,this.source.getView().setTranslate(i.x-n,i.y-a));this.update(),t.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,t,n,a,i,s){var o="";return(this.source&&this.checkTerminal(e,n,t)||!this.source&&this.checkTerminal(e,a,t))&&(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,t,n,a)||(o+=this.typeError+"\n"))),0<o.length?o:null},mxMultiplicity.prototype.checkNeighbors=function(e,t,n,a){t=e.model.getValue(n),a=e.model.getValue(a),n=!this.validNeighborsAllowed;for(var i=this.validNeighbors,s=0;s<i.length;s++){if(this.source&&this.checkType(e,a,i[s])){n=this.validNeighborsAllowed;break}if(!this.source&&this.checkType(e,t,i[s])){n=this.validNeighborsAllowed;break}}return n},mxMultiplicity.prototype.checkTerminal=function(e,t,n){return t=e.model.getValue(t),this.checkType(e,t,this.type,this.attr,this.value)},mxMultiplicity.prototype.checkType=function(e,t,n,a,i){return null!=t&&(isNaN(t.nodeType)?t==n:mxUtils.isNode(t,n,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 t=this.graph.getModel();t.removeListener(this.undoHandler),this.graph.removeListener(this.moveHandler)}this.graph=e,null!=this.graph&&((t=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 t=this.getGraph().getModel();if(this.isBubbling())for(var n=t.getParents(e);0<n.length;)e=e.concat(n),n=t.getParents(n);this.layoutCells(mxUtils.sortCells(e,!1))},mxLayoutManager.prototype.cellsMoved=function(e,t){if(null!=e&&null!=t)for(var n=mxUtils.convertPoint(this.getGraph().container,mxEvent.getClientX(t),mxEvent.getClientY(t)),a=this.getGraph().getModel(),i=0;i<e.length;i++){var s=this.getLayout(a.getParent(e[i]));null!=s&&s.moveCell(e[i],n.x,n.y)}},mxLayoutManager.prototype.getCellsForChanges=function(e){for(var t=[],n={},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==n[o]&&(n[o]=i[s],t.push(i[s]))}}return t},mxLayoutManager.prototype.getCellsForChange=function(e){var t=this.getGraph().getModel();return e instanceof mxChildChange?[e.child,e.previous,t.getParent(e.child)]:e instanceof mxTerminalChange||e instanceof mxGeometryChange?[e.cell,t.getParent(e.cell)]:[]},mxLayoutManager.prototype.layoutCells=function(e){if(0<e.length){var t=this.getGraph().getModel();t.beginUpdate();try{for(var n=null,a=0;a<e.length;a++)e[a]!=t.getRoot()&&e[a]!=n&&(n=e[a],this.executeLayout(this.getLayout(n),n));this.fireEvent(new mxEventObject(mxEvent.LAYOUT_CELLS,"cells",e))}finally{t.endUpdate()}}},mxLayoutManager.prototype.executeLayout=function(e,t){null!=e&&null!=t&&e.execute(t)},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 t=this.graph.getModel();t.beginUpdate();try{for(var n=0;n<e.length;n++)if(!this.isCellIgnored(e[n])){this.cellResized(e[n]);break}}finally{t.endUpdate()}}},mxSpaceManager.prototype.cellResized=function(e){var t=this.getGraph(),n=t.getView(),a=t.getModel(),i=n.getState(e),s=n.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=n.translate,d=n.scale,c=(n=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+n-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,n,s,l,c,p,i,this.isExtendParents()&&t.isExtendParent(o[r]))}finally{a.endUpdate()}}}},mxSpaceManager.prototype.shiftCell=function(e,t,n,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(-t,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,-n);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 t=this.getGraph(),n=t.getModel().getParent(e.cell),a=this.isShiftDownwards(),i=this.isShiftRightwards();return t.getCellsBeyond(e.x+(a?0:e.width),e.y+(a&&i?0:e.height),n,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 t=this.graph.view.getState(e);return e=null!=t?t.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 t=this.getGraph().getModel();t.beginUpdate();try{for(var n=0;n<e.length;n++)this.isSwimlaneIgnored(e[n])||this.swimlaneAdded(e[n])}finally{t.endUpdate()}}},mxSwimlaneManager.prototype.swimlaneAdded=function(e){for(var t=this.getGraph().getModel(),n=t.getParent(e),a=t.getChildCount(n),i=null,s=0;s<a;s++){var o=t.getChildAt(n,s);if(o!=e&&!this.isSwimlaneIgnored(o)&&null!=(i=t.getGeometry(o)))break}null!=i&&this.resizeSwimlane(e,i.width,i.height)},mxSwimlaneManager.prototype.cellsResized=function(e){if(null!=e){var t=this.getGraph().getModel();t.beginUpdate();try{for(var n=0;n<e.length;n++)if(!this.isSwimlaneIgnored(e[n])){var a=t.getGeometry(e[n]);if(null!=a){for(var i=new mxRectangle(0,0,a.width,a.height),s=o=e[n];null!=s;){var o=s,r=(s=t.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{t.endUpdate()}}},mxSwimlaneManager.prototype.resizeSwimlane=function(e,t,n){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!=n||!i&&r.width!=t)&&(r=r.clone(),i?r.height=n:r.width=t,a.setGeometry(e,r))}var s=this.graph.isSwimlane(e)?this.graph.getStartSize(e):new mxRectangle;t-=s.width,n-=s.height;for(var o=a.getChildCount(e),r=0;r<o;r++){var l=a.getChildAt(e,r);this.resizeSwimlane(l,t,n)}}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,t,n,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(t,n),this.deltas[s]=o,this.count++):a?(o.X+=t,o.Y+=n):(o.X=t,o.Y=n),i&&this.addEdges(e),o},mxCellStatePreview.prototype.show=function(e){var t,n=this.graph.getModel(),a=n.getRoot();for(t in this.deltas){var i=mxCellPath.resolve(a,t),s=this.graph.view.getState(i),o=this.deltas[t];i=this.graph.view.getState(n.getParent(i));this.translateState(i,s,o.x,o.y)}for(t in this.deltas)i=mxCellPath.resolve(a,t),s=this.graph.view.getState(i),o=this.deltas[t],i=this.graph.view.getState(n.getParent(i)),this.revalidateState(i,s,o.x,o.y,e)},mxCellStatePreview.prototype.translateState=function(e,t,n,a){if(null!=t){var i=this.graph.getModel();if(i.isVertex(t.cell)){t.invalid=!0,this.graph.view.validateBounds(e,t.cell),e=i.getGeometry(t.cell);var s=mxCellPath.create(t.cell);0==n&&0==a||null==e||e.relative&&null==this.deltas[s]||(t.x+=n,t.y+=a)}for(e=i.getChildCount(t.cell),s=0;s<e;s++)this.translateState(t,this.graph.view.getState(i.getChildAt(t.cell,s)),n,a)}},mxCellStatePreview.prototype.revalidateState=function(e,t,n,a,i){if(null!=t){t.invalid=!0,this.graph.view.validatePoints(e,t.cell);var s=mxCellPath.create(t.cell),o=this.graph.getModel(),r=this.graph.getCellGeometry(t.cell);for(0==n&&0==a||null==r||!r.relative||!o.isVertex(t.cell)||null!=e&&!o.isVertex(e.cell)&&null==this.deltas[s]||(t.x+=n,t.y+=a,this.graph.cellRenderer.redraw(t)),null!=i&&i(t),e=o.getChildCount(t.cell),s=0;s<e;s++)this.revalidateState(t,this.graph.view.getState(o.getChildAt(t.cell,s)),n,a,i)}},mxCellStatePreview.prototype.addEdges=function(e){for(var t=this.graph.getModel(),n=t.getEdgeCount(e.cell),a=0;a<n;a++){var i=this.graph.view.getState(t.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,t){if(!t.isConsumed()&&this.isEnabled()&&this.graph.isEnabled()&&!this.graph.isForceMarqueeEvent(t.getEvent())&&null!=t.getState()){var n=this.getInitialCellForEvent(t);if(this.cell=null,this.delayedSelection=this.isDelayedSelection(n),this.isSelectEnabled()&&!this.delayedSelection&&this.graph.selectCellForEvent(n,t.getEvent()),this.isMoveEnabled()){var a=this.graph.model,i=a.getGeometry(n);this.graph.isCellMovable(n)&&(!a.isEdge(n)||1<this.graph.getSelectionCount()||null!=i.points&&0<i.points.length||null==a.getTerminal(n,!0)||null==a.getTerminal(n,!1)||this.graph.allowDanglingEdges||this.graph.isCloneEvent(t.getEvent())&&this.graph.isCellsCloneable())&&this.start(n,t.getX(),t.getY()),this.cellWasClicked=!0,!mxClient.IS_SF&&!mxClient.IS_GC||"SELECT"!=t.getSource().nodeName?t.consume():mxClient.IS_SF&&"SELECT"==t.getSource().nodeName&&(this.cellWasClicked=!1,this.first=null)}}},mxGraphHandler.prototype.getGuideStates=function(){var e=this.graph.getDefaultParent(),t=this.graph.getModel(),n=mxUtils.bind(this,function(e){return null!=this.graph.view.getState(e)&&t.isVertex(e)&&null!=t.getGeometry(e)&&!t.getGeometry(e).relative});return this.graph.view.getCellStates(t.filterDescendants(n,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 t=null;if(null!=e&&0<e.length)for(var n=this.graph.getModel(),a=0;a<e.length;a++)if(n.isVertex(e[a])||n.isEdge(e[a])){var i=this.graph.view.getState(e[a]);if(null!=i){var s=i;n.isVertex(e[a])&&null!=i.shape&&null!=i.shape.boundingBox&&(s=i.shape.boundingBox),null==t?t=new mxRectangle(s.x,s.y,s.width,s.height):t.add(s)}}return t},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,t,n){this.cell=e,this.first=mxUtils.convertPoint(this.graph.container,t,n),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 t=this.scaleGrid?this.graph.view.scale:1;return e.x=this.graph.snap(e.x/t)*t,e.y=this.graph.snap(e.y/t)*t,e},mxGraphHandler.prototype.mouseMove=function(e,t){var n=this.graph;if(!t.isConsumed()&&n.isMouseDown&&null!=this.cell&&null!=this.first&&null!=this.bounds){var a=(s=mxUtils.convertPoint(n.container,t.getX(),t.getY())).x-this.first.x,i=s.y-this.first.y,s=n.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=n.isGridEnabledEvent(t.getEvent());s=!0;if(null!=this.guide&&this.useGuidesForEvent(t))s=!1,a=(i=this.guide.move(this.bounds,new mxPoint(a,i),o)).x,i=i.y;else if(o){var r=n.getView().translate,l=n.getView().scale;o=this.bounds.x-(n.snap(this.bounds.x/l-r.x)+r.x)*l,r=this.bounds.y-(n.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(),n.isConstrainedEvent(t.getEvent())&&(Math.abs(a)>Math.abs(i)?i=0:a=0),this.currentDx=a,this.currentDy=i,this.updatePreviewShape(),s=null,i=t.getCell(),n.isDropEnabled()&&this.highlightEnabled&&(s=n.getDropTarget(this.cells,t.getEvent(),i)),o=s,r=n.getModel();null!=o&&o!=this.cells[0];)o=r.getParent(o);l=n.isCloneEvent(t.getEvent())&&n.isCellsCloneable()&&this.isCloneEnabled();var d=!1;null==(a=n.getView().getState(s))||null!=o||r.getParent(this.cell)==s&&!l?(this.target=null,this.connectOnDrop&&null!=i&&1==this.cells.length&&n.getModel().isVertex(i)&&n.isCellConnectable(i)&&(null!=(a=n.getView().getState(i))&&(n=null==n.getEdgeValidationError(null,this.cell,i)?mxConstants.VALID_COLOR:mxConstants.INVALID_CONNECT_TARGET_COLOR,this.setHighlightColor(n),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()}t.consume(),mxEvent.consume(t.getEvent())}else!this.isMoveEnabled()&&!this.isCloneEnabled()||!this.updateCursor||t.isConsumed()||null==t.getState()||n.isMouseDown||(null==(a=n.getCursorForCell(t.getCell()))&&n.isEnabled()&&n.isCellMovable(t.getCell())&&(a=n.getModel().isEdge(t.getCell())?mxConstants.CURSOR_MOVABLE_EDGE:mxConstants.CURSOR_MOVABLE_VERTEX),t.getState().setCursor(a),t.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,t){if(!t.isConsumed()){var n=this.graph;if(null!=this.cell&&null!=this.first&&null!=this.shape&&null!=this.currentDx&&null!=this.currentDy){var a=n.getView().scale,i=n.isCloneEvent(t.getEvent())&&n.isCellsCloneable()&&this.isCloneEnabled(),s=this.currentDx/a,o=(a=this.currentDy/a,t.getCell());this.connectOnDrop&&null==this.target&&null!=o&&n.getModel().isVertex(o)&&n.isCellConnectable(o)&&n.isEdgeValid(null,this.cell,o)?n.connectionHandler.connect(this.cell,o,t.getEvent()):(o=this.target,n.isSplitEnabled()&&n.isSplitTarget(o,this.cells,t.getEvent())?n.splitEdge(o,this.cells,null,s,a):this.moveCells(this.cells,s,a,i,this.target,t.getEvent()))}else this.isSelectEnabled()&&this.delayedSelection&&null!=this.cell&&this.selectDelayed(t)}this.cellWasClicked&&t.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,t,n){if(this.graph.getModel().isVertex(e)){if(e=this.graph.getView().getState(e),n=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(n),mxEvent.getClientY(n)),0!=(a=mxUtils.toRadians(mxUtils.getValue(e.style,mxConstants.STYLE_ROTATION)||0))){t=Math.cos(-a);var a=Math.sin(-a),i=new mxPoint(e.getCenterX(),e.getCenterY());n=mxUtils.getRotatedPoint(n,t,a,i)}return null!=e&&!mxUtils.contains(e,n.x,n.y)}return!1},mxGraphHandler.prototype.moveCells=function(e,t,n,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,t-this.graph.panDx/this.graph.view.scale,n-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 t=e.getEvent();return this.useLeftButtonForPanning&&(this.ignoreCell||null==e.getState())&&mxEvent.isLeftMouseButton(t)||mxEvent.isControlDown(t)&&mxEvent.isShiftDown(t)||this.usePopupTrigger&&mxEvent.isPopupTrigger(t)},mxPanningHandler.prototype.mouseDown=function(e,t){if(!t.isConsumed()&&this.isEnabled()){this.hideMenu(),this.dx0=-this.graph.container.scrollLeft,this.dy0=-this.graph.container.scrollTop;var n=mxUtils.convertPoint(this.graph.container,t.getX(),t.getY());this.triggerX=n.x,this.triggerY=n.y,this.popupTrigger=this.isPopupTrigger(t),this.panningTrigger=this.isPanningEnabled()&&this.isPanningTrigger(t),this.startX=t.getX(),this.startY=t.getY(),this.panningTrigger&&this.consumePanningTrigger(t)}},mxPanningHandler.prototype.consumePanningTrigger=function(e){e.consume()},mxPanningHandler.prototype.mouseMove=function(e,t){var n=t.getX()-this.startX,a=t.getY()-this.startY;if(this.active)this.previewEnabled&&(this.useGrid&&(n=this.graph.snap(n),a=this.graph.snap(a)),this.graph.panGraph(n+this.dx0,a+this.dy0)),this.fireEvent(new mxEventObject(mxEvent.PAN,"event",t)),t.consume();else if(this.panningTrigger){var i=this.active;this.active=Math.abs(n)>this.graph.tolerance||Math.abs(a)>this.graph.tolerance,!i&&this.active&&this.fireEvent(new mxEventObject(mxEvent.PAN_START,"event",t))}},mxPanningHandler.prototype.mouseUp=function(e,t){var n=Math.abs(t.getX()-this.startX),a=Math.abs(t.getY()-this.startY);if(this.active){if(!this.graph.useScrollbarsForPanning||!mxUtils.hasScrollbars(this.graph.container)){n=t.getX()-this.startX,a=t.getY()-this.startY,this.useGrid&&(n=this.graph.snap(n),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+n/i,s.y+a/i)}this.active=!1,this.fireEvent(new mxEventObject(mxEvent.PAN_END,"event",t)),t.consume()}else this.popupTrigger&&n<this.graph.tolerance&&a<this.graph.tolerance&&(n=this.getCellForPopupEvent(t),this.graph.isEnabled()&&this.selectOnPopup&&null!=n&&!this.graph.isCellSelected(n)?this.graph.setSelectionCell(n):this.clearSelectionOnBackground&&null==n&&this.graph.clearSelection(),this.graph.tooltipHandler.hide(),a=mxUtils.getScrollOrigin(),a=new mxPoint(t.getX()+a.x,t.getY()+a.y),this.popup(a.x+1,a.y+1,n,t.getEvent()),t.consume());this.popupTrigger=this.panningTrigger=!1},mxPanningHandler.prototype.getCellForPopupEvent=function(e){return e.getCell()},mxPanningHandler.prototype.panGraph=function(e,t){this.graph.getView().setTranslate(e,t)},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 t=null;if(this.isEnabled()){var n=null!=(t=this.getState(e))&&this.isValidState(t);e=this.getMarkerColor(e.getEvent(),t,n),this.validState=n?t:null,t==this.markedState&&e==this.currentColor||(this.currentColor=e,null!=t&&null!=this.currentColor?(this.markedState=t,this.mark()):null!=this.markedState&&(this.markedState=null,this.unmark()))}return t},mxCellMarker.prototype.markCell=function(e,t){var n=this.graph.getView().getState(e);null!=n&&(this.currentColor=null!=t?t:this.validColor,this.markedState=n,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,t,n){return n?this.validColor:this.invalidColor},mxCellMarker.prototype.getState=function(e){var t=this.graph.getView();return cell=this.getCell(e),null!=(t=this.getStateToMark(t.getState(cell)))&&this.intersects(t,e)?t:null},mxCellMarker.prototype.getCell=function(e){return e.getCell()},mxCellMarker.prototype.getStateToMark=function(e){return e},mxCellMarker.prototype.intersects=function(e,t){return!this.hotspotEnabled||mxUtils.intersectsHotspot(e,t.getGraphX(),t.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,t){t.reset.apply(t)})},mxSelectionCellsHandler.prototype.refresh=function(){var e=this.handlers;this.handlers=new mxDictionary;for(var t=this.graph.getSelectionCells(),n=0;n<t.length;n++){var a=this.graph.view.getState(t[n]);if(null!=a){var i=e.remove(t[n]);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(t[n],i)}}e.visit(mxUtils.bind(this,function(e,t){this.fireEvent(new mxEventObject(mxEvent.REMOVE,"state",t.state)),t.destroy()}))},mxSelectionCellsHandler.prototype.mouseDown=function(e,t){if(this.graph.isEnabled()&&this.isEnabled()){var n=[e,t];this.handlers.visit(function(e,t){t.mouseDown.apply(t,n)})}},mxSelectionCellsHandler.prototype.mouseMove=function(e,t){if(this.graph.isEnabled()&&this.isEnabled()){var n=[e,t];this.handlers.visit(function(e,t){t.mouseMove.apply(t,n)})}},mxSelectionCellsHandler.prototype.mouseUp=function(e,t){if(this.graph.isEnabled()&&this.isEnabled()){var n=[e,t];this.handlers.visit(function(e,t){t.mouseUp.apply(t,n)})}},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 t=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,t)}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,t){return t=mxCellMarker.prototype.getCell.apply(a,arguments),this.error=null,this.isConnectableCell(t)?(null!=t?this.isConnecting()?null!=this.previous&&(this.error=this.validateConnection(this.previous.cell,t),null!=this.error&&0==this.error.length&&(t=null,this.isCreateTarget()&&(this.error=null))):this.isValidSource(t)||(t=null):this.isConnecting()&&!this.isCreateTarget()&&!this.graph.allowDanglingEdges&&(this.error=""),t):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,t,n){return null==this.connectImage||this.isConnecting()?mxCellMarker.prototype.getMarkerColor.apply(a,arguments):null}),a.intersects=mxUtils.bind(this,function(e,t){return!(null==this.connectImage&&!this.isConnecting())||mxCellMarker.prototype.intersects.apply(a,arguments)}),a},mxConnectionHandler.prototype.start=function(e,t,n,a){this.previous=e,this.first=new mxPoint(t,n),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,t){return this.isValidTarget(t)?this.graph.getEdgeValidationError(null,e,t):""},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 t=[],n=new mxImageShape(new mxRectangle(0,0,i.width,i.height),i.src,null,null,0);n.preserveImageAspect=!1,this.isMoveIconToFrontForState(e)?(n.dialect=mxConstants.DIALECT_STRICTHTML,n.init(this.graph.container)):(n.dialect=this.graph.dialect==mxConstants.DIALECT_SVG?mxConstants.DIALECT_SVG:mxConstants.DIALECT_VML,n.init(this.graph.getView().getOverlayPane()),this.moveIconBack&&null!=n.node.previousSibling&&n.node.parentNode.insertBefore(n.node,n.node.parentNode.firstChild)),n.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=n,this.graph.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,a())))});return mxEvent.redirectMouseEvents(n.node,this.graph,a,i),t.push(n),this.redrawIcons(t,this.iconState),t},mxConnectionHandler.prototype.redrawIcons=function(e,t){if(null!=e&&null!=e[0]&&null!=t){var n=this.getIconPosition(e[0],t);e[0].bounds.x=n.x,e[0].bounds.y=n.y,e[0].redraw()}},mxConnectionHandler.prototype.getIconPosition=function(e,t){var n=this.graph.getView().scale,a=t.getCenterX(),i=t.getCenterY();if(this.graph.isSwimlane(t.cell)){a=0!=(s=this.graph.getStartSize(t.cell)).width?t.x+s.width*n/2:a,i=0!=s.height?t.y+s.height*n/2:i;if(0!=(s=mxUtils.toRadians(mxUtils.getValue(t.style,mxConstants.STYLE_ROTATION)||0))){n=Math.cos(s);var s=Math.sin(s),o=new mxPoint(t.getCenterX(),t.getCenterY());a=(i=mxUtils.getRotatedPoint(new mxPoint(a,i),n,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 t=0;t<e.length;t++)e[t].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,t){if(this.mouseDownCounter++,this.isEnabled()&&this.graph.isEnabled()&&!t.isConsumed()&&!this.isConnecting()&&this.isStartEvent(t)){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(t.getGraphX(),t.getGraphY()),this.edgeState=this.createEdgeState(t),this.mouseDownCounter=1,this.waypointsEnabled&&null==this.shape&&(this.waypoints=null,this.shape=this.createShape()),null==this.previous&&null!=this.edgeState){var n=this.graph.getPointForEvent(t.getEvent());this.edgeState.cell.geometry.setTerminalPoint(n,!0)}this.fireEvent(new mxEventObject(mxEvent.START,"state",this.previous)),t.consume()}else if(mxClient.IS_TOUCH&&this.tapAndHoldEnabled&&!this.tapAndHoldInProgress&&this.isEnabled()&&this.graph.isEnabled()&&!this.isConnecting()){this.tapAndHoldInProgress=!0,this.initialTouchX=t.getX(),this.initialTouchY=t.getY();var a=this.graph.view.getState(this.marker.getCell(t));this.tapAndHoldThread&&window.clearTimeout(this.tapAndHoldThread),this.tapAndHoldThread=window.setTimeout(mxUtils.bind(this,function(){this.tapAndHoldValid&&this.tapAndHold(t,a),this.tapAndHoldValid=this.tapAndHoldInProgress=!1}),this.tapAndHoldDelay),this.tapAndHoldValid=!0}this.selectedIcon=this.icon,this.icon=null},mxConnectionHandler.prototype.tapAndHold=function(e,t){null!=t&&(this.marker.currentColor=this.marker.validColor,this.marker.markedState=t,this.marker.mark(),this.first=new mxPoint(e.getGraphX(),e.getGraphY()),this.edgeState=this.createEdgeState(e),this.previous=t,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 t=this.marker.process(e);this.constraintHandler.update(e,null==this.first),this.currentState=t},mxConnectionHandler.prototype.convertWaypoint=function(e){var t=this.graph.getView().getScale(),n=this.graph.getView().getTranslate();e.x=e.x/t-n.x,e.y=e.y/t-n.y},mxConnectionHandler.prototype.mouseMove=function(e,t){if(this.tapAndHoldValid&&(this.tapAndHoldValid=Math.abs(this.initialTouchX-t.getX())<this.tapAndHoldTolerance&&Math.abs(this.initialTouchY-t.getY())<this.tapAndHoldTolerance),t.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(t),null!=this.first){var n=this.graph.getView().scale,a=null,i=n=new mxPoint(this.graph.snap(t.getGraphX()/n)*n,this.graph.snap(t.getGraphY()/n)*n);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(t.getGraphX()+this.connectIconOffset.x,t.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,t))&&(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,t))&&(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(n.x-this.first.x),o=Math.abs(n.y-this.first.y),a>this.graph.tolerance||o>this.graph.tolerance)&&(this.shape=this.createShape(),this.updateCurrentState(t)),null!=this.shape&&(null!=this.edgeState?this.shape.points=this.edgeState.absolutePoints:(n=[s],null!=this.waypoints&&(n=n.concat(this.waypoints)),n.push(i),this.shape.points=n),this.drawPreview()),mxEvent.consume(t.getEvent()),t.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),t.consume())),this.previous=this.currentState):this.previous==this.currentState&&null!=this.currentState&&null==this.icons&&!this.graph.isMouseDown&&t.consume():this.constraintHandler.reset();if(null!=this.constraintHandler.currentConstraint&&this.marker.reset(),!this.graph.isMouseDown&&null!=this.currentState&&null!=this.icons){for(n=!1,s=t.getSource(),i=0;i<this.icons.length&&!n;i++)n=s==this.icons[i].node||s.parentNode==this.icons[i].node;n||this.updateIcons(this.currentState,this.icons,t)}}},mxConnectionHandler.prototype.getTargetPerimeterPoint=function(e,t){var n=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))&&(n=i)}else n=new mxPoint(e.getCenterX(),e.getCenterY());return n},mxConnectionHandler.prototype.getSourcePerimeterPoint=function(e,t,n){n=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&&(t=mxUtils.getRotatedPoint(new mxPoint(t.x,t.y),Math.cos(r),Math.sin(r),s)),null!=(e=i(a.getPerimeterBounds(e),e,t,!1))&&(0!=o&&(e=mxUtils.getRotatedPoint(new mxPoint(e.x,e.y),Math.cos(-r),Math.sin(-r),s)),n=e)}else n=s;return n},mxConnectionHandler.prototype.updateIcons=function(e,t,n){},mxConnectionHandler.prototype.isStopEvent=function(e){return null!=e.getState()},mxConnectionHandler.prototype.addWaypointForEvent=function(e){var t=mxUtils.convertPoint(this.graph.container,e.getX(),e.getY()),n=Math.abs(t.x-this.first.x);t=Math.abs(t.y-this.first.y);(null!=this.waypoints||1<this.mouseDownCounter&&(n>this.graph.tolerance||t>this.graph.tolerance))&&(null==this.waypoints&&(this.waypoints=[]),n=this.graph.view.scale,t=new mxPoint(this.graph.snap(e.getGraphX()/n)*n,this.graph.snap(e.getGraphY()/n)*n),this.waypoints.push(t))},mxConnectionHandler.prototype.mouseUp=function(e,t){if(!t.isConsumed()&&this.isConnecting()){if(this.waypointsEnabled&&!this.isStopEvent(t))return this.addWaypointForEvent(t),void t.consume();if(null==this.error){var n=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(n,a,t.getEvent(),t.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),t.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,t,n,a){if(null!=t||this.isCreateTarget()||this.graph.allowDanglingEdges){var i=this.graph.getModel(),s=null;i.beginUpdate();try{if(null!=e&&null==t&&this.isCreateTarget()&&null!=(t=this.createTargetVertex(n,e))){if(null!=(a=this.graph.getDropTarget([t],n,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(t);r.x-=o.origin.x,r.y-=o.origin.y}}this.graph.addCell(t,a)}var l=this.graph.getDefaultParent();if(null!=e&&null!=t&&i.getParent(e)==i.getParent(t)&&i.getParent(i.getParent(e))!=i.getRoot()&&(l=i.getParent(e),null!=e.geometry&&e.geometry.relative&&null!=t.geometry&&t.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,t,r))){this.graph.setConnectionConstraint(s,e,!0,this.sourceConstraint),this.graph.setConnectionConstraint(s,t,!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==t&&((u=this.graph.getPointForEvent(n,!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",n,"target",a))}}catch(e){mxLog.show(),mxLog.debug(e.message)}finally{i.endUpdate()}this.select&&this.selectCells(s,t)}},mxConnectionHandler.prototype.selectCells=function(e,t){this.graph.setSelectionCell(e)},mxConnectionHandler.prototype.insertEdge=function(e,t,n,a,i,s){return null==this.factoryMethod?this.graph.insertEdge(e,t,n,a,i,s):(t=this.createEdge(n,a,i,s),this.graph.addEdge(t,e,a,i))},mxConnectionHandler.prototype.createTargetVertex=function(e,t){for(var n=this.graph.getCellGeometry(t);null!=n&&n.relative;)t=this.graph.getModel().getParent(t),n=this.graph.getCellGeometry(t);var a=this.graph.cloneCells([t])[0];if(null!=(n=this.graph.getModel().getGeometry(a))){var i=this.graph.getPointForEvent(e);if(n.x=this.graph.snap(i.x-n.width/2)-this.graph.panDx/this.graph.view.scale,n.y=this.graph.snap(i.y-n.height/2)-this.graph.panDy/this.graph.view.scale,null!=this.first){var s=this.graph.view.getState(t);if(null!=s){var o=this.getAlignmentTolerance();Math.abs(this.graph.snap(this.first.x)-this.graph.snap(i.x))<=o?n.x=s.x:Math.abs(this.graph.snap(this.first.y)-this.graph.snap(i.y))<=o&&(n.y=s.y)}}}return a},mxConnectionHandler.prototype.getAlignmentTolerance=function(){return this.graph.isGridEnabled()?this.graph.gridSize:this.graph.tolerance},mxConnectionHandler.prototype.createEdge=function(e,t,n,a){var i=null;return null!=this.factoryMethod&&(i=this.factoryMethod(t,n,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,t,n){return this.pointImage},mxConstraintHandler.prototype.isEventIgnored=function(e,t){return!1},mxConstraintHandler.prototype.update=function(e,t){if(this.isEnabled()&&!this.isEventIgnored(e)){var n=this.getTolerance(),a=new mxRectangle(e.getGraphX()-n,e.getGraphY()-n,2*n,2*n),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(),t):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(n)}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],(n=this.focusIcons[i].bounds.clone()).grow(mxClient.IS_IE?3:2),mxClient.IS_IE&&(n.width-=1,n.height-=1),null==this.focusHighlight?((n=new mxRectangleShape(n,null,this.highlightColor,3)).dialect=this.graph.dialect==mxConstants.DIALECT_SVG?mxConstants.DIALECT_SVG:mxConstants.DIALECT_VML,n.init(this.graph.getView().getOverlayPane()),this.focusHighlight=n,r=mxUtils.bind(this,function(){return null!=this.currentFocus?this.currentFocus:e.getState()}),mxEvent.redirectMouseEvents(n.node,this.graph,r)):(this.focusHighlight.bounds=n,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,t){if(!t.isConsumed()&&this.isEnabled()&&this.graph.isEnabled()&&(this.graph.isForceMarqueeEvent(t.getEvent())||null==t.getState())){var n=mxUtils.getOffset(this.graph.container),a=mxUtils.getScrollOrigin(this.graph.container);if(a.x-=n.x,a.y-=n.y,this.start(t.getX()+a.x,t.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 t=mxUtils.convertPoint(i,e.getX(),e.getY());return e.graphX=t.x,e.graphY=t.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)}t.consume(!1)}},mxRubberband.prototype.start=function(e,t){this.first=new mxPoint(e,t)},mxRubberband.prototype.mouseMove=function(e,t){if(!t.isConsumed()&&null!=this.first){var n=mxUtils.getScrollOrigin(this.graph.container),a=mxUtils.getOffset(this.graph.container);n.x-=a.x,n.y-=a.y;a=t.getX()+n.x,n=t.getY()+n.y;var i=this.first.x-a,s=this.first.y-n,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,n),t.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,t){var n=null!=this.div;this.reset(),n&&(n=new mxRectangle(this.x,this.y,this.width,this.height),this.graph.selectRegion(n,t.getEvent()),t.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,t){this.currentX=e,this.currentY=t,this.repaint()},mxRubberband.prototype.repaint=function(){if(null!=this.div){var e=this.currentX-this.graph.panDx,t=this.currentY-this.graph.panDy;this.x=Math.min(this.first.x,e),this.y=Math.min(this.first.y,t),this.width=Math.max(this.first.x,e)-this.x,this.height=Math.max(this.first.y,t)-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 t=0;e&&(this.singleSizer||(this.sizers.push(this.createSizer("nw-resize",t++)),this.sizers.push(this.createSizer("n-resize",t++)),this.sizers.push(this.createSizer("ne-resize",t++)),this.sizers.push(this.createSizer("w-resize",t++)),this.sizers.push(this.createSizer("e-resize",t++)),this.sizers.push(this.createSizer("sw-resize",t++)),this.sizers.push(this.createSizer("s-resize",t++))),this.sizers.push(this.createSizer("se-resize",t++))),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,t,n,a){return n=new mxRectangle(0,0,n=n||mxConstants.HANDLE_SIZE,n),(a=this.createSizerShape(n,t,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(t)||(a.node.style.visibility="hidden"),a},mxVertexHandler.prototype.isSizerVisible=function(e){return!0},mxVertexHandler.prototype.createSizerShape=function(e,t,n){return null!=this.handleImage?(e.width=this.handleImage.width,e.height=this.handleImage.height,new mxImageShape(e,this.handleImage.src)):t==mxEvent.ROTATION_HANDLE?new mxEllipse(e,n||mxConstants.HANDLE_FILLCOLOR,mxConstants.HANDLE_STROKECOLOR):new mxRectangleShape(e,n||mxConstants.HANDLE_FILLCOLOR,mxConstants.HANDLE_STROKECOLOR)},mxVertexHandler.prototype.moveSizerTo=function(e,t,n){null!=e&&(e.bounds.x=Math.round(t-e.bounds.width/2),e.bounds.y=Math.round(n-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 t=this.tolerance,n=(t=this.allowHandleBoundsCheck&&(mxClient.IS_IE||0<t)?new mxRectangle(e.getGraphX()-t,e.getGraphY()-t,2*t,2*t):null,0);n<this.sizers.length;n++)if(e.isSource(this.sizers[n])||null!=t&&mxUtils.intersects(this.sizers[n].bounds,t))return n;return null},mxVertexHandler.prototype.mouseDown=function(e,t){if(!t.isConsumed()&&this.graph.isEnabled()&&!this.graph.isForceMarqueeEvent(t.getEvent())&&(0<this.tolerance||t.getState()==this.state)){var n=this.getHandleForEvent(t);null!=n&&(this.start(t.getX(),t.getY(),n),t.consume())}},mxVertexHandler.prototype.start=function(e,t,n){e=mxUtils.convertPoint(this.graph.container,e,t),this.startX=e.x,this.startY=e.y,this.index=n,this.selectionBorder.node.style.display=n==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,t){if(t.isConsumed()||null==this.index)null!=this.getHandleForEvent(t)&&t.consume(!1);else{var n=new mxPoint(t.getGraphX(),t.getGraphY()),a=this.graph.isGridEnabledEvent(t.getEvent()),i=this.graph.getView().scale;if(this.index==mxEvent.LABEL_HANDLE)a&&(n.x=this.graph.snap(n.x/i)*i,n.y=this.graph.snap(n.y/i)*i),this.moveSizerTo(this.sizers[this.sizers.length-1],n.x,n.y);else if(this.index==mxEvent.ROTATION_HANDLE){var s=this.state.x+this.state.width/2-n.x,o=this.state.y+this.state.height/2-n.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=n.x-this.state.getCenterX(),o=n.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=n.x-this.startX,o=n.y-this.startY,n=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,n),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()}t.consume()}},mxVertexHandler.prototype.mouseUp=function(e,t){if(!t.isConsumed()&&null!=this.index&&null!=this.state){var n=new mxPoint(t.getGraphX(),t.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(t.getEvent()),i=mxUtils.toRadians(this.state.style[mxConstants.STYLE_ROTATION]||"0"),s=Math.cos(-i),o=Math.sin(-i),r=(n=o*(r=n.x-this.startX)+s*(l=n.y-this.startY),s*r-o*l),l=n,d=this.graph.view.scale;this.resizeCell(this.state.cell,r/d,l/d,this.index,a)}}finally{this.graph.getModel().endUpdate()}this.reset(),t.consume()}},mxVertexHandler.prototype.rotateCell=function(e,t){var n=this.graph.getModel();if(n.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)+t,[e]),this.state.cell!=e&&(null!=(s=this.graph.getCellGeometry(e))&&!s.relative))if(0!=t){var a=this.graph.getModel().getParent(e),i=this.graph.getCellGeometry(a);if(!s.relative&&null!=i){var s,o=mxUtils.toRadians(t),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,n.setGeometry(e,s)}}else(s=s.clone()).x+=dx,s.y+=dy,n.setGeometry(e,s);for(s=n.getChildCount(e),a=0;a<s;a++)this.rotateCell(n.getChildAt(e,a),t)}},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,t,n,a,i){var s=this.graph.model.getGeometry(e);if(null!=s)if(a==mxEvent.LABEL_HANDLE)a=this.graph.view.scale,t=(this.labelShape.bounds.getCenterX()-this.startX)/a,n=(this.labelShape.bounds.getCenterY()-this.startY)/a,null==(s=s.clone()).offset?s.offset=new mxPoint(t,n):(s.offset.x+=t,s.offset.y+=n),this.graph.model.setGeometry(e,s);else{if(a=this.union(s,t,n,a,i,1,new mxPoint(0,0)),0!=(r=mxUtils.toRadians(this.state.style[mxConstants.STYLE_ROTATION]||"0"))){t=a.getCenterX()-s.getCenterX(),n=a.getCenterY()-s.getCenterY(),i=Math.cos(r);var o=Math.sin(r),r=i*t-o*n-t;t=o*t+i*n-n,n=a.x-s.x;var l=a.y-s.y,d=i*n-o*l;i=o*n+i*l,a.x+=r,a.y+=t,this.graph.isCellCollapsed(e)||0==r&&0==t||(n=s.x-a.x+d,l=s.y-a.y+i,this.moveChildren(e,n,l))}this.graph.resizeCell(e,a)}},mxVertexHandler.prototype.moveChildren=function(e,t,n){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+=t,r.y+=n,a.setGeometry(o,r))}}},mxVertexHandler.prototype.union=function(e,t,n,a,i,s,o){if(this.singleSizer){o=e.x+e.width+t;var r=e.y+e.height+n;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+=n,i&&(e=this.graph.snap(e/s)*s)):a<3&&(d+=n,i&&(d=this.graph.snap(d/s)*s)),0==a||3==a||5==a?(r+=t,i&&(r=this.graph.snap(r/s)*s)):2!=a&&4!=a&&7!=a||(l+=t,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 t=e.x+e.width,n=e.y+e.height;if(this.singleSizer)this.moveSizerTo(this.sizers[0],t,n);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=t,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=t,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=n,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[5],l.x,l.y),l.x=a,l.y=n,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[6],l.x,l.y),l.x=t,l.y=n,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 t=this.state.cell;if(null!=this.index){var n=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(e),mxEvent.getClientY(e));t=this.graph.getCellAt(n.x,n.y);this.graph.isSwimlane(t)&&this.graph.hitsSwimlaneContent(t,n.x,n.y)&&(t=null)}this.graph.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,this.graph.getView().getState(t)))}),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 t=mxCellMarker.prototype.getCell.apply(this,arguments);if(!a.isConnectableCell(t))return null;var n=a.graph.getModel();return(t==a.state.cell||null!=t&&!a.graph.connectableEdges&&n.isEdge(t))&&(t=null),t},e.isValidState=function(e){var t=a.graph.getModel();t=null!=(t=a.graph.view.getTerminalPort(e,a.graph.view.getState(t.getTerminal(a.state.cell,!a.isSource)),!a.isSource))?t.cell:null;return a.error=a.validateConnection(a.isSource?e.cell:t,a.isSource?t:e.cell),null==a.error},e},mxEdgeHandler.prototype.validateConnection=function(e,t){return this.graph.getEdgeValidationError(this.state.cell,e,t)},mxEdgeHandler.prototype.createBends=function(){for(var e=this.state.cell,t=[],n=0;n<this.abspoints.length;n++)if(this.isHandleVisible(n)){var a=n==this.abspoints.length-1;if((a=0==n||a)||this.graph.isCellBendable(e)){var i=this.createHandleShape(n);if(this.initBend(i),mxClient.IS_TOUCH&&i.node.setAttribute("pointer-events","none"),this.isHandleEnabled(n))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);t.push(i),a||(this.points.push(new mxPoint(0,0)),i.node.style.visibility="hidden")}}return t},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 t=this.tolerance,n=(t=this.allowHandleBoundsCheck&&(mxClient.IS_IE||0<t)?new mxRectangle(e.getGraphX()-t,e.getGraphY()-t,2*t,2*t):null,0);n<this.bends.length;n++)if((e.isSource(this.bends[n])||null!=t&&mxUtils.intersects(this.bends[n].bounds,t))&&"hidden"!=this.bends[n].node.style.visibility)return n;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,t){var n=null;null!=(n=this.getHandleForEvent(t))&&!t.isConsumed()&&this.graph.isEnabled()&&!this.graph.isForceMarqueeEvent(t.getEvent())&&(this.removeEnabled&&this.isRemovePointEvent(t.getEvent())?this.removePoint(this.state,n):(n!=mxEvent.LABEL_HANDLE||this.graph.isLabelMovable(t.getCell()))&&this.start(t.getX(),t.getY(),n),t.consume())},mxEdgeHandler.prototype.start=function(e,t,n){this.startX=e,this.startY=t,this.isSource=null!=this.bends&&0==n,this.isTarget=null!=this.bends&&n==this.bends.length-1,this.isLabel=n==mxEvent.LABEL_HANDLE,this.isSource||this.isTarget?(e=this.state.cell,(null==(t=this.graph.model.getTerminal(e,this.isSource))&&this.graph.isTerminalPointMovable(e,this.isSource)||null!=t&&this.graph.isCellDisconnectable(e,t,this.isSource))&&(this.index=n)):this.index=n},mxEdgeHandler.prototype.clonePreviewState=function(e,t){return this.state.clone()},mxEdgeHandler.prototype.getSnapToTerminalTolerance=function(){return this.graph.gridSize*this.graph.view.scale/2},mxEdgeHandler.prototype.getPointForEvent=function(e){var n=new mxPoint(e.getGraphX(),e.getGraphY()),a=this.getSnapToTerminalTolerance(),t=this.graph.getView(),i=!1,s=!1;if(this.snapToTerminals&&0<a){var o=function(e){if(null!=e){var t=e.x;Math.abs(n.x-t)<a&&(n.x=t,i=!0),e=e.y,Math.abs(n.y-e)<a&&(n.y=e,s=!0)}},r=function(e){null!=e&&o.call(this,new mxPoint(t.getRoutingCenterX(e),t.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=t.scale,r=t.translate,i||(n.x=(this.graph.snap(n.x/e-r.x)+r.x)*e),s||(n.y=(this.graph.snap(n.y/e-r.y)+r.y)*e)),n},mxEdgeHandler.prototype.getPreviewTerminalState=function(e){this.constraintHandler.update(e,this.isSource),this.marker.process(e),e=this.marker.getValidState();var t=null;return null!=this.constraintHandler.currentFocus&&null!=this.constraintHandler.currentConstraint&&this.marker.reset(),null!=e?t=e:null!=this.constraintHandler.currentConstraint&&null!=this.constraintHandler.currentFocus&&(t=this.constraintHandler.currentFocus),t},mxEdgeHandler.prototype.getPreviewPoints=function(e){var t=null!=(t=this.graph.getCellGeometry(this.state.cell)).points?t.points.slice():null;return this.isSource||this.isTarget?this.graph.resetEdgesOnConnect&&(t=null):(this.convertPoint(e,!1),null==t?t=[e]:t[this.index-1]=e),t},mxEdgeHandler.prototype.updatePreviewState=function(e,t,n){var a=this.isSource?n:this.state.getVisibleTerminalState(!0),i=this.isTarget?n: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==n&&(e.setAbsoluteTerminalPoint(t,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,t){if(null!=this.index&&null!=this.marker){var n=this.getPointForEvent(t);if(this.isLabel)this.label.x=n.x,this.label.y=n.y;else{this.points=this.getPreviewPoints(n);var a=this.isSource||this.isTarget?this.getPreviewTerminalState(t):null,i=this.clonePreviewState(n,null!=a?a.cell:null);this.updatePreviewState(i,n,a),this.setPreviewColor(null==this.error?this.marker.validColor:this.marker.invalidColor),this.abspoints=i.absolutePoints,this.active=!0}this.drawPreview(),mxEvent.consume(t.getEvent()),t.consume()}else mxClient.IS_IE&&null!=this.getHandleForEvent(t)&&t.consume(!1)},mxEdgeHandler.prototype.mouseUp=function(e,t){if(null!=this.index&&null!=this.marker){var n=this.state.cell;if(t.getX()!=this.startX||t.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)n=this.connect(n,a,this.isSource,this.graph.isCloneEvent(t.getEvent())&&this.cloneEnabled&&this.graph.isCellsCloneable(),t);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(n));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(n,a,this.isSource)}}else this.active?this.changePoints(n,this.points):(this.graph.getView().invalidate(this.state.cell),this.graph.getView().revalidate(this.state.cell));null!=this.marker&&(this.reset(),n!=this.state.cell&&this.graph.setSelectionCell(n)),t.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,t){var n=this.graph.getView().getScale(),a=this.graph.getView().getTranslate();return t&&(e.x=this.graph.snap(e.x),e.y=this.graph.snap(e.y)),e.x=Math.round(e.x/n-a.x),e.y=Math.round(e.y/n-a.y),null!=(n=this.graph.getView().getState(this.graph.getModel().getParent(this.state.cell)))&&(e.x-=n.origin.x,e.y-=n.origin.y),e},mxEdgeHandler.prototype.moveLabel=function(e,t,n){var a=this.graph.getModel();if(null!=(i=a.getGeometry(e.cell))){var i=i.clone(),s=this.graph.getView().getRelativePoint(e,t,n);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((t-s.x)/o,(n-s.y)/o),a.setGeometry(e.cell,i)}},mxEdgeHandler.prototype.connect=function(e,t,n,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,!n);this.graph.connectCell(o,r,!n),e=o}var l=this.constraintHandler.currentConstraint;null==l&&(l=new mxConnectionConstraint),this.graph.connectCell(e,t,n,l)}finally{i.endUpdate()}return e},mxEdgeHandler.prototype.changeTerminalPoint=function(e,t,n){var a=this.graph.getModel(),i=a.getGeometry(e);if(null!=i){a.beginUpdate();try{(i=i.clone()).setTerminalPoint(t,n),a.setGeometry(e,i),this.graph.connectCell(e,null,n,new mxConnectionConstraint)}finally{a.endUpdate()}}},mxEdgeHandler.prototype.changePoints=function(e,t){var n=this.graph.getModel(),a=n.getGeometry(e);null!=a&&((a=a.clone()).points=t,n.setGeometry(e,a))},mxEdgeHandler.prototype.addPoint=function(e,t){var n=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(t),mxEvent.getClientY(t)),a=this.graph.isGridEnabledEvent(t);this.convertPoint(n,a),this.addPointAt(e,n.x,n.y),mxEvent.consume(t)},mxEdgeHandler.prototype.addPointAt=function(e,t,n){var a=this.graph.getCellGeometry(e.cell);if(t=new mxPoint(t,n),null!=a){a=a.clone(),n=this.graph.view.translate;var i=this.graph.view.scale;n=mxUtils.findNearestSegment(e,(t.x+n.x)*i,(t.y+n.y)*i),null==a.points?a.points=[t]:a.points.splice(n,0,t),this.graph.getModel().setGeometry(e.cell,a),this.destroy(),this.init()}},mxEdgeHandler.prototype.removePoint=function(e,t){if(0<t&&t<this.abspoints.length-1){var n=this.graph.getCellGeometry(this.state.cell);null!=n&&null!=n.points&&((n=n.clone()).points.splice(t-1,1),this.graph.getModel().setGeometry(e.cell,n),this.destroy(),this.init())}},mxEdgeHandler.prototype.getHandleFillColor=function(e){e=0==e;var t=this.state.cell,n=this.graph.getModel().getTerminal(t,e),a=mxConstants.HANDLE_FILLCOLOR;return null!=n&&!this.graph.isCellDisconnectable(t,n,e)||null==n&&!this.graph.isTerminalPointMovable(t,e)?a=mxConstants.LOCKED_HANDLE_FILLCOLOR:null!=n&&this.graph.isCellDisconnectable(t,n,e)&&(a=mxConstants.CONNECT_HANDLE_FILLCOLOR),a},mxEdgeHandler.prototype.redraw=function(){this.abspoints=this.state.absolutePoints.slice();var e=this.state.cell,t=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-t/2),Math.round(this.label.y-t/2),t,t),this.labelShape.redraw(),null!=(t=this.graph.getLabel(e))&&0<t.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 n=this.abspoints.length-1,a=(e=this.abspoints[0],this.abspoints[0].y);t=this.bends[0].bounds;this.bends[0].bounds=new mxRectangle(Math.round(this.abspoints[0].x-t.width/2),Math.round(a-t.height/2),t.width,t.height),this.bends[0].fill=this.getHandleFillColor(0),this.bends[0].redraw();a=this.abspoints[n];var i=this.abspoints[n].x,s=(n=this.abspoints[n].y,this.bends.length-1);t=this.bends[s].bounds;this.bends[s].bounds=new mxRectangle(Math.round(i-t.width/2),Math.round(n-t.height/2),t.width,t.height),this.bends[s].fill=this.getHandleFillColor(s),this.bends[s].redraw(),this.redrawInnerBends(e,a)}this.drawPreview()},mxEdgeHandler.prototype.redrawInnerBends=function(e,t){var n=this.graph.getModel().getGeometry(this.state.cell).points;if(null!=n){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]=n[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=[],t=this.createHandleShape(0);return this.initBend(t),t.node.style.cursor=mxConstants.CURSOR_BEND_HANDLE,mxEvent.redirectMouseEvents(t.node,this.graph,this.state),e.push(t),mxClient.IS_TOUCH&&t.node.setAttribute("pointer-events","none"),e.push(this.createVirtualBend()),this.points.push(new mxPoint(0,0)),t=this.createHandleShape(2),this.initBend(t),t.node.style.cursor=mxConstants.CURSOR_BEND_HANDLE,mxEvent.redirectMouseEvents(t.node,this.graph,this.state),e.push(t),mxClient.IS_TOUCH&&t.node.setAttribute("pointer-events","none"),e},mxElbowEdgeHandler.prototype.createVirtualBend=function(){var e=this.createHandleShape();this.initBend(e);var t=this.getCursorForBend();return e.node.style.cursor=t,t=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,t),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 t=null;return null==this.bends||null==this.bends[1]||e!=this.bends[1].node&&e.parentNode!=this.bends[1].node||(t=this.doubleClickOrientationResource,t=mxResources.get(t)||t),t},mxElbowEdgeHandler.prototype.convertPoint=function(e,t){var n=this.graph.getView().getScale(),a=this.graph.getView().getTranslate(),i=this.state.origin;t&&(e.x=this.graph.snap(e.x),e.y=this.graph.snap(e.y)),e.x=Math.round(e.x/n-a.x-i.x),e.y=Math.round(e.y/n-a.y-i.y)},mxElbowEdgeHandler.prototype.redrawInnerBends=function(e,t){var n=null==(n=null!=(n=this.graph.getModel().getGeometry(this.state.cell).points)?n[0]:null)?new mxPoint(e.x+(t.x-e.x)/2,e.y+(t.y-e.y)/2):new mxPoint(this.graph.getView().scale*(n.x+this.graph.getView().translate.x+this.state.origin.x),this.graph.getView().scale*(n.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(n.x-a/2),Math.round(n.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(n.x-a/2),Math.round(n.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 t=this.state.absolutePoints,n=t[0].clone();this.convertPoint(n,!1);for(var a=[],i=1;i<t.length;i++){var s=t[i].clone();this.convertPoint(s,!1),i==this.index&&(n.x==s.x?(n.x=e.x,s.x=e.x):(n.y=e.y,s.y=e.y)),i<t.length-1&&a.push(s),n=s}if(1==a.length){if(n=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)?t[1].y==t[2].y?a[0].y=n.getRoutingCenterY(i)-r:a[0].x=n.getRoutingCenterX(i)-o:mxUtils.contains(i,a[0].x+o,a[0].y+r)&&(t[1].y==t[0].y?a[0].y=n.getRoutingCenterY(s)-r:a[0].x=n.getRoutingCenterX(s)-o)}}else 0==a.length&&(a=[e]);return a},mxEdgeSegmentHandler.prototype.createBends=function(){var e=[],t=this.createHandleShape(0);this.initBend(t),t.node.style.cursor=mxConstants.CURSOR_BEND_HANDLE,mxEvent.redirectMouseEvents(t.node,this.graph,this.state),e.push(t),mxClient.IS_TOUCH&&t.node.setAttribute("pointer-events","none");var n=this.state.absolutePoints;if(this.graph.isCellBendable(this.state.cell)){null==this.points&&(this.points=[]);for(var a=0;a<n.length-1;a++)t=this.createVirtualBend(),e.push(t),t.node.style.cursor=0==n[a].x-n[a+1].x?"col-resize":"row-resize",this.points.push(new mxPoint(0,0)),mxClient.IS_TOUCH&&t.node.setAttribute("pointer-events","none")}return t=this.createHandleShape(n.length),this.initBend(t),t.node.style.cursor=mxConstants.CURSOR_BEND_HANDLE,mxEvent.redirectMouseEvents(t.node,this.graph,this.state),e.push(t),mxClient.IS_TOUCH&&t.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,t){if(this.graph.isCellBendable(this.state.cell)){var n=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],t=a[i+1];var s=new mxPoint(e.x+(t.x-e.x)/2,e.y+(t.y-e.y)/2);this.bends[i+1].bounds=new mxRectangle(Math.round(s.x-n/2),Math.round(s.y-n/2),n,n),this.bends[i+1].redraw()}}},mxEdgeSegmentHandler.prototype.changePoints=function(e,t){t=[];var n=this.abspoints;if(1<n.length)for(var a=n[0],i=n[1],s=2;s<n.length;s++){var o=n[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),t.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,t){this.normalKeys[e]=t},mxKeyHandler.prototype.bindShiftKey=function(e,t){this.shiftKeys[e]=t},mxKeyHandler.prototype.bindControlKey=function(e,t){this.controlKeys[e]=t},mxKeyHandler.prototype.bindControlShiftKey=function(e,t){this.controlShiftKeys[e]=t},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 t=this.getFunction(e);null!=t&&(t(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,t){this.reset(t,!1),this.hideTooltip()},mxTooltipHandler.prototype.mouseMove=function(e,t){t.getX()==this.lastX&&t.getY()==this.lastY||(this.reset(t,!0),(this.isHideOnHover()||t.getState()!=this.state||t.getSource()!=this.node&&(!this.stateSource||null!=t.getState()&&this.stateSource==(t.isSource(t.getState().shape)||!t.isSource(t.getState().text))))&&this.hideTooltip()),this.lastX=t.getX(),this.lastY=t.getY()},mxTooltipHandler.prototype.mouseUp=function(e,t){this.reset(t,!0),this.hideTooltip()},mxTooltipHandler.prototype.resetTimer=function(){null!=this.thread&&(window.clearTimeout(this.thread),this.thread=null)},mxTooltipHandler.prototype.reset=function(e,t){if(this.resetTimer(),t&&this.isEnabled()&&null!=e.getState()&&(null==this.div||"hidden"==this.div.style.visibility)){var n=e.getState(),a=e.getSource(),i=e.getX(),s=e.getY(),o=e.isSource(n.shape)||e.isSource(n.text);this.thread=window.setTimeout(mxUtils.bind(this,function(){if(!this.graph.isEditing()&&!this.graph.panningHandler.isMenuShowing()){var e=this.graph.getTooltip(n,a,i,s);this.show(e,i,s),this.state=n,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,t,n){if(null!=e&&0<e.length){null==this.div&&this.init();var a=mxUtils.getScrollOrigin();this.div.style.left=t+a.x+"px",this.div.style.top=n+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,t){},mxCellTracker.prototype.mouseMove=function(e,t){this.isEnabled()&&this.process(t)},mxCellTracker.prototype.mouseUp=function(e,t){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,t,n){var a=mxUtils.bind(this,function(){this.editor.execute(t)});n?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,t,n,a){if(null!=this.config){var i=this.createConditions(e,n,a);this.addItems(e,t,n,a,i,this.config.firstChild,null)}},mxDefaultPopupMenu.prototype.addItems=function(e,t,n,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&&(t.addSeparator(o),r=!1),null!=m&&this.imageBasePath&&(m=this.imageBasePath+m),l=this.addAction(t,e,l,m,d,c,n,o,u),this.addItems(e,t,n,a,i,s.firstChild,l)}}else"separator"==s.nodeName&&(r=!0);s=s.nextSibling}},mxDefaultPopupMenu.prototype.addAction=function(e,t,n,a,i,s,o,r,l){return e.addItem(n,a,function(e){"function"==typeof i&&i.call(t,t,o,e),null!=s&&t.execute(s,o,e)},r,l)},mxDefaultPopupMenu.prototype.createConditions=function(e,t,n){var a=e.graph.getModel(),i=a.getChildCount(t),s=[];for(s.nocell=null==t,s.ncells=1<e.graph.getSelectionCount(),s.notRoot=a.getRoot()!=a.getParent(e.graph.getDefaultParent()),s.cell=null!=t,a=null!=t&&1==e.graph.getSelectionCount(),s.nonEmpty=a&&0<i,s.expandable=a&&e.graph.isCellFoldable(t,!1),s.collapsable=a&&e.graph.isCellFoldable(t,!0),s.validRoot=a&&e.graph.isValidRoot(t),s.emptyValidRoot=s.validRoot&&0==i,s.swimlane=a&&e.graph.isSwimlane(t),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,t,n))}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,t){var n=t.getProperty("function");this.editor.insertFunction=null!=n?mxUtils.bind(this,function(){n.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,t,n,a){var i=mxUtils.bind(this,function(){null!=n&&0<n.length&&this.editor.execute(n)});return this.toolbar.addItem(e,t,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,t,n){var a=mxUtils.bind(this,function(){this.editor.execute(n)});this.addOption(e,t,a)},mxDefaultToolbar.prototype.addOption=function(e,t,n){return this.toolbar.addOption(e,t,n)},mxDefaultToolbar.prototype.addMode=function(e,t,n,a,i){var s=mxUtils.bind(this,function(){this.editor.setMode(n),null!=i&&i(this.editor)});return this.toolbar.addSwitchMode(e,t,s,a)},mxDefaultToolbar.prototype.addPrototype=function(e,t,n,a,i,s){var o=function(){return"function"==typeof n?n():null!=n?n.clone():null},r=mxUtils.bind(this,function(e,t){"function"==typeof i?i(this.editor,o(),e,t):this.drop(o(),e,t),this.toolbar.resetMode(),mxEvent.consume(e)});return e=this.toolbar.addMode(e,t,r,a,null,s),this.installDropHandler(e,function(e,t,n){r(t,n)}),e},mxDefaultToolbar.prototype.drop=function(e,t,n){var a=this.editor.graph,i=a.getModel();if(null!=n&&!i.isEdge(n)&&this.connectOnDrop&&a.isCellConnectable(n))this.connect(e,t,n);else{for(;null!=n&&!a.isValidDropTarget(n,[e],t);)n=i.getParent(n);this.insert(e,t,n)}},mxDefaultToolbar.prototype.insert=function(e,t,n){var a=this.editor.graph;if(a.canImportCell(e)){var i=mxEvent.getClientX(t),s=mxEvent.getClientY(t);i=mxUtils.convertPoint(a.container,i,s);return a.isSplitEnabled()&&a.isSplitTarget(n,[e],t)?a.splitEdge(n,[e],null,i.x,i.y):this.editor.addVertex(n,e,i.x,i.y)}return null},mxDefaultToolbar.prototype.connect=function(e,t,n){var a=(t=this.editor.graph).getModel();if(null!=n&&t.isCellConnectable(e)&&t.isEdgeValid(null,n,e)){var i=null;a.beginUpdate();try{var s=a.getGeometry(n),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*t.gridSize,l=20*a.getDirectedEdgeCount(n,!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(n);if(t.addCell(e,d),t.constrainChild(e),i=this.editor.createEdge(n,e),null==a.getGeometry(i)){var c=new mxGeometry;c.relative=!0,a.setGeometry(i,c)}t.addEdge(i,d,n,e)}finally{a.endUpdate()}t.setSelectionCells([e,i]),t.scrollCellToVisible(e)}},mxDefaultToolbar.prototype.installDropHandler=function(t,n){var a=document.createElement("img");a.setAttribute("src",t.getAttribute("src"));var i=mxUtils.bind(this,function(e){a.style.width=2*t.offsetWidth+"px",a.style.height=2*t.offsetHeight+"px",mxUtils.makeDraggable(t,this.editor.graph,n,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 t=e.getUrlImage();if(null==t||mxClient.IS_LOCAL)e.execute("show");else{var n=mxUtils.getViewXml(e.graph,1);n=mxUtils.getXml(n,"\n");mxUtils.submit(t,e.postParameterName+"="+encodeURIComponent(n),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,t){e.showProperties(t)}),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,t){e.graph.isEnabled()&&e.graph.isCellEditable(t)&&e.graph.startEditingAtCell(t)}),this.addAction("toBack",function(e,t){e.graph.isEnabled()&&e.graph.orderCells(!0)}),this.addAction("toFront",function(e,t){e.graph.isEnabled()&&e.graph.orderCells(!1)}),this.addAction("enterGroup",function(e,t){e.graph.enterGroup(t)}),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 t=e.graph.getChildVertices();e.graph.foldCells(!0,!1,t)}}),this.addAction("expand",function(e){e.graph.isEnabled()&&e.graph.foldCells(!1)}),this.addAction("expandAll",function(e){if(e.graph.isEnabled()){var t=e.graph.getChildVertices();e.graph.foldCells(!1,!1,t)}}),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 t=100*e.graph.getView().scale;t=parseFloat(mxUtils.prompt(mxResources.get(e.askZoomResource)||e.askZoomResource,t))/100;isNaN(t)||e.graph.getView().setScale(t)}),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,t){this.actions[e]=t},mxEditor.prototype.execute=function(t,e,n){var a=this.actions[t];if(null!=a)try{var i=arguments;i[0]=this,a.apply(this,i)}catch(e){throw mxUtils.error("Cannot execute "+t+": "+e.message,280,!0),e}else mxUtils.error("Cannot find action "+t,280,!0)},mxEditor.prototype.addTemplate=function(e,t){this.templates[e]=t},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,t,n){return this.createPopupMenu(e,t,n)}),e.connectionHandler.factoryMethod=mxUtils.bind(this,function(e,t){return this.createEdge(e,t)}),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 t=null,n=i.graph.getModel();return null!=n.getParent(e)&&(i.layoutSwimlanes&&a.isSwimlane(e)?(null==i.swimlaneLayout&&(i.swimlaneLayout=i.createSwimlaneLayout()),t=i.swimlaneLayout):i.layoutDiagram&&(a.isValidRoot(e)||null==n.getParent(n.getParent(e)))&&(null==i.diagramLayout&&(i.diagramLayout=i.createDiagramLayout()),t=i.diagramLayout)),t},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,t){var n=t.getProperty("cell");null!=n&&a.isEnabled()&&null!=this.dblClickAction&&(this.execute(this.dblClickAction,n),t.consume())}))},mxEditor.prototype.installUndoHandler=function(a){var e=mxUtils.bind(this,function(e,t){var n=t.getProperty("edit");this.undoManager.undoableEditHappened(n)});a.getModel().addListener(mxEvent.UNDO,e),a.getView().addListener(mxEvent.UNDO,e),e=function(e,t){var n=t.getProperty("edit").changes;a.setSelectionCells(a.getSelectionCellsForChanges(n))},this.undoManager.addListener(mxEvent.UNDO,e),this.undoManager.addListener(mxEvent.REDO,e)},mxEditor.prototype.installDrillHandler=function(e){var t=mxUtils.bind(this,function(e){this.fireEvent(new mxEventObject(mxEvent.ROOT))});e.getView().addListener(mxEvent.DOWN,t),e.getView().addListener(mxEvent.UP,t)},mxEditor.prototype.installChangeHandler=function(s){var e=mxUtils.bind(this,function(e,t){this.setModified(!0),1==this.validating&&s.validateGraph();for(var n=t.getProperty("edit").changes,a=0;a<n.length;a++){var i=n[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 n=this;e.addMouseListener({mouseDown:function(e,t){null==n.insertFunction||t.isPopupTrigger()||!n.forcedInserting&&null!=t.getState()||(n.graph.clearSelection(),n.insertFunction(t.getEvent(),t.getCell()),this.isActive=!0,t.consume())},mouseMove:function(e,t){this.isActive&&t.consume()},mouseUp:function(e,t){this.isActive&&(this.isActive=!1,t.consume())}})},mxEditor.prototype.createDiagramLayout=function(){var e=this.graph.gridSize,t=new mxStackLayout(this.graph,!this.horizontalFlow,this.swimlaneSpacing,2*e,2*e);return t.isVertexIgnored=function(e){return!t.graph.isSwimlane(e)},t},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(t){this.addListener(mxEvent.ROOT,mxUtils.bind(this,function(e){t.innerHTML=this.getTitle()})),mxClient.IS_QUIRKS&&new mxDivResizer(t)},mxEditor.prototype.treeLayout=function(e,t){null!=e&&new mxCompactTreeLayout(this.graph,t).execute(e)},mxEditor.prototype.getTitle=function(){for(var e="",t=this.graph,n=t.getCurrentRoot();null!=n&&null!=t.getModel().getParent(t.getModel().getParent(n));)t.isValidRoot(n)&&(e=" > "+t.convertValueToString(n)+e),n=t.getModel().getParent(n);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 t=mxUtils.load(e).getXml();this.readGraphModel(t.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,t){if(null!=(e=e||this.getUrlPost())&&0<e.length){var n=this.writeGraphModel(t);this.postDiagram(e,n),this.setModified(!1)}this.fireEvent(new mxEventObject(mxEvent.SAVE,"url",e))},mxEditor.prototype.postDiagram=function(t,n){this.escapePostData&&(n=encodeURIComponent(n)),mxUtils.post(t,this.postParameterName+"="+n,mxUtils.bind(this,function(e){this.fireEvent(new mxEventObject(mxEvent.POST,"request",e,"url",t,"data",n))}))},mxEditor.prototype.writeGraphModel=function(e){e=null!=e?e:this.linefeed;var t=(new mxCodec).encode(this.graph.getModel());return mxUtils.getXml(t,e)},mxEditor.prototype.getUrlPost=function(){return this.urlPost},mxEditor.prototype.getUrlImage=function(){return this.urlImage},mxEditor.prototype.connect=function(e,t,n,a){var i=null;return mxClient.IS_LOCAL||((i=new mxSession(this.graph.getModel(),e,t,n)).addListener(mxEvent.RECEIVE,mxUtils.bind(this,function(e,t){null!=t.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,t){var n=this.graph.getStylesheet().styles[t];this.graph.getView().getStylesheet().putCellStyle(t,this.graph.getStylesheet().styles[e]),this.graph.getStylesheet().putCellStyle(e,n),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 t=(n=mxUtils.getOffset(this.graph.container)).x+10,n=n.y;if(null==this.properties||this.movePropertiesDialog){var a=this.graph.getCellBounds(e);null!=a&&(t+=a.x+Math.min(200,a.width),n+=a.y)}else t=this.properties.getX(),n=this.properties.getY();this.hideProperties(),null!=(e=this.createProperties(e))&&(this.properties=new mxWindow(mxResources.get(this.propertiesResource)||this.propertiesResource,e,t,n,this.propertiesWidth,this.propertiesHeight,!1),this.properties.setVisible(!0))}},mxEditor.prototype.isPropertiesVisible=function(){return null!=this.properties},mxEditor.prototype.createProperties=function(n){var a=this.graph.getModel(),e=a.getValue(n);if(mxUtils.isNode(e)){var t=new mxForm("properties");t.addText("ID",n.getId()).setAttribute("readonly","true");var i=null,s=null,o=null,r=null,l=null;a.isVertex(n)&&(null!=(i=a.getGeometry(n))&&(s=t.addText("top",i.y),o=t.addText("left",i.x),r=t.addText("width",i.width),l=t.addText("height",i.height)));var d=a.getStyle(n),c=t.addText("Style",d||""),m=e.attributes,u=[];for(e=0;e<m.length;e++)u[e]=t.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(n,i)),0<c.value.length?a.setStyle(n,c.value):a.setStyle(n,null);for(var e=0;e<m.length;e++){var t=new mxCellAttributeChange(n,m[e].nodeName,u[e].value);a.execute(t)}this.graph.isAutoSizeCell(n)&&this.graph.updateCellSize(n)}finally{a.endUpdate()}}),d=mxUtils.bind(this,function(){this.hideProperties()}),t.addButtons(e,d),t.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 t=document.createElement("div");t.style.padding="4px",t.style.paddingLeft="20px";var e=document.body.clientWidth;(e=new mxWindow(mxResources.get(this.tasksResource)||this.tasksResource,t,e-220,this.tasksTop,200)).setClosable(!0),e.destroyOnClose=!1;var n=mxUtils.bind(this,function(e){mxEvent.release(t),t.innerHTML="",this.createTasks(t)});this.graph.getModel().addListener(mxEvent.CHANGE,n),this.graph.getSelectionModel().addListener(mxEvent.CHANGE,n),this.graph.addListener(mxEvent.ROOT,n),null!=this.tasksWindowImage&&e.setImage(this.tasksWindowImage),this.tasks=e,this.createTasks(t)}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 t=document.createElement("iframe");t.setAttribute("src",mxResources.get("urlHelp")||this.urlHelp),t.setAttribute("height","100%"),t.setAttribute("width","100%"),t.setAttribute("frameBorder","0"),t.style.backgroundColor="white",e=document.body.clientWidth;var n=document.body.clientHeight||document.documentElement.clientHeight,a=new mxWindow(mxResources.get(this.helpResource)||this.helpResource,t,(e-this.helpWidth)/2,(n-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){t.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 t=new mxWindow(mxResources.get(this.outlineResource)||this.outlineResource,e,600,480,200,200,!1),n=new mxOutline(this.graph,e);t.setClosable(!0),t.setResizable(!0),t.destroyOnClose=!1,t.addListener(mxEvent.RESIZE_END,function(){n.update()}),this.outline=t,this.outline.outline=n}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,t,n){this.popupHandler.createMenu(this,e,t,n)},mxEditor.prototype.createEdge=function(e,t){var n=null;if(null!=this.defaultEdge)n=this.graph.getModel().cloneCell(this.defaultEdge);else{(n=new mxCell("")).setEdge(!0);var a=new mxGeometry;a.relative=!0,n.setGeometry(a)}return null!=(a=this.getEdgeStyle())&&n.setStyle(a),n},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 t=this.consumeCycleAttribute(e);null!=t&&e.setStyle(e.getStyle()+";"+this.cycleAttributeName+"="+t)}},mxEditor.prototype.addVertex=function(e,t,n,a){for(var i=this.graph.getModel();null!=e&&!this.graph.isValidDropTarget(e);)e=i.getParent(e);e=null!=e?e:this.graph.getSwimlaneAt(n,a);var s=this.graph.getView().scale,o=i.getGeometry(t),r=i.getGeometry(e);if(this.graph.isSwimlane(t)&&!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(n-=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<n+r&&(n-=n+r-c),(c=l.y+l.height)<a+d&&(a-=a+d-c)}}else null!=r&&(n-=r.x*s,a-=r.y*s)}}(o=o.clone()).x=this.graph.snap(n/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),t.setGeometry(o),null==e&&(e=this.graph.getDefaultParent()),this.cycleAttribute(t),this.fireEvent(new mxEventObject(mxEvent.BEFORE_ADD_VERTEX,"vertex",t,"parent",e)),i.beginUpdate();try{null!=(t=this.graph.addCell(t,e))&&(this.graph.constrainChild(t),this.fireEvent(new mxEventObject(mxEvent.ADD_VERTEX,"vertex",t)))}finally{i.endUpdate()}return null!=t&&(this.graph.setSelectionCell(t),this.graph.scrollCellToVisible(t),this.fireEvent(new mxEventObject(mxEvent.AFTER_ADD_VERTEX,"vertex",t))),t},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 t=e.getName();mxCodecRegistry.codecs[t]=e;var n=mxUtils.getFunctionName(e.template.constructor);n!=t&&mxCodecRegistry.addAlias(n,t)}return e},addAlias:function(e,t){mxCodecRegistry.aliases[e]=t},getCodec:function(e){var t=null;if(null!=e){t=mxUtils.getFunctionName(e);var n=mxCodecRegistry.aliases[t];if(null!=n&&(t=n),null==(t=mxCodecRegistry.codecs[t]))try{t=new mxObjectCodec(new e),mxCodecRegistry.register(t)}catch(e){}}return t}};function mxCodec(e){this.document=e||mxUtils.createXmlDocument(),this.objects=[]}function mxObjectCodec(e,t,n,a){for(var i in this.template=e,this.exclude=null!=t?t:[],this.idrefs=null!=n?n:[],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,t){return this.objects[e]=t},mxCodec.prototype.getObject=function(e){var t=null;return null!=e&&(null==(t=this.objects[e])&&(null==(t=this.lookup(e))&&(null!=(e=this.getElementById(e))&&(t=this.decode(e))))),t},mxCodec.prototype.lookup=function(e){return null},mxCodec.prototype.getElementById=function(e,t){return mxUtils.findNodeByAttribute(this.document.documentElement,null!=t?t:"id",e)},mxCodec.prototype.getId=function(e){var t=null;return null!=e&&(null==(t=this.reference(e))&&e instanceof mxCell&&(null==(t=e.getId())&&(0==(t=mxCellPath.create(e)).length&&(t="root")))),t},mxCodec.prototype.reference=function(e){return null},mxCodec.prototype.encode=function(e){var t=null;if(null!=e&&null!=e.constructor){var n=mxCodecRegistry.getCodec(e.constructor);null!=n?t=n.encode(this,e):mxUtils.isNode(e)?t=mxClient.IS_IE?e.cloneNode(!0):this.document.importNode(e,!0):mxLog.warn("mxCodec.encode: No codec for "+mxUtils.getFunctionName(e.constructor))}return t},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,t,n){if(t.appendChild(this.encode(e)),null==n||n){n=e.getChildCount();for(var a=0;a<n;a++)this.encodeCell(e.getChildAt(a),t)}},mxCodec.prototype.isCellCodec=function(e){return null!=e&&"function"==typeof e.isCellCodec&&e.isCellCodec()},mxCodec.prototype.decodeCell=function(e,t){t=null==t||t;var n=null;if(null!=e&&e.nodeType==mxConstants.NODETYPE_ELEMENT){if(n=mxCodecRegistry.getCodec(e.nodeName),!this.isCellCodec(n))for(var a=e.firstChild;null!=a&&!this.isCellCodec(n);)n=mxCodecRegistry.getCodec(a.nodeName),a=a.nextSibling;this.isCellCodec(n)||(n=mxCodecRegistry.getCodec(mxCell)),n=n.decode(this,e),t&&this.insertIntoGraph(n)}return n},mxCodec.prototype.insertIntoGraph=function(e){var t=e.parent,n=e.getTerminal(!0),a=e.getTerminal(!1);e.setTerminal(null,!1),e.setTerminal(null,!0),(e.parent=null)!=t&&t.insert(e),null!=n&&n.insertEdge(e,!0),null!=a&&a.insertEdge(e,!1)},mxCodec.prototype.setAttribute=function(e,t,n){null!=t&&null!=n&&e.setAttribute(t,n)},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 t=this.reverse[e];null!=t&&(e=t)}return e},mxObjectCodec.prototype.getAttributeName=function(e){if(null!=e){var t=this.mapping[e];null!=t&&(e=t)}return e},mxObjectCodec.prototype.isExcluded=function(e,t,n,a){return t==mxObjectIdentity.FIELD_NAME||0<=mxUtils.indexOf(this.exclude,t)},mxObjectCodec.prototype.isReference=function(e,t,n,a){return 0<=mxUtils.indexOf(this.idrefs,t)},mxObjectCodec.prototype.encode=function(e,t){var n=e.document.createElement(this.getName());return t=this.beforeEncode(e,t,n),this.encodeObject(e,t,n),this.afterEncode(e,t,n)},mxObjectCodec.prototype.encodeObject=function(e,t,n){for(var a in e.setAttribute(n,"id",e.getId(t)),t){var i=a,s=t[i];null!=s&&!this.isExcluded(t,i,s,!0)&&(mxUtils.isNumeric(i)&&(i=null),this.encodeValue(e,t,i,s,n))}},mxObjectCodec.prototype.encodeValue=function(e,t,n,a,i){if(null!=a){if(this.isReference(t,n,a,!0)){var s=e.getId(a);if(null==s)return void mxLog.warn("mxObjectCodec.encode: No ID for "+this.getName()+"."+n+"="+a);a=s}s=this.template[n],(null==n||e.encodeDefaults||s!=a)&&(n=this.getAttributeName(n),this.writeAttribute(e,t,n,a,i))}},mxObjectCodec.prototype.writeAttribute=function(e,t,n,a,i){"object"!=typeof a?this.writePrimitiveAttribute(e,t,n,a,i):this.writeComplexAttribute(e,t,n,a,i)},mxObjectCodec.prototype.writePrimitiveAttribute=function(e,t,n,a,i){a=this.convertValueToXml(a),null==n?(t=e.document.createElement("add"),"function"==typeof a?t.appendChild(e.document.createTextNode(a)):e.setAttribute(t,"value",a),i.appendChild(t)):"function"!=typeof a&&e.setAttribute(i,n,a)},mxObjectCodec.prototype.writeComplexAttribute=function(e,t,n,a,i){null!=(e=e.encode(a))?(null!=n&&e.setAttribute("as",n),i.appendChild(e)):mxLog.warn("mxObjectCodec.encode: No node for "+this.getName()+"."+n+": "+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,t,n){return t},mxObjectCodec.prototype.afterEncode=function(e,t,n){return n},mxObjectCodec.prototype.decode=function(e,t,n){var a=t.getAttribute("id"),i=e.objects[a];return null==i&&(i=n||this.cloneTemplate(),null!=a&&e.putObject(a,i)),t=this.beforeDecode(e,t,i),this.decodeNode(e,t,i),this.afterDecode(e,t,i)},mxObjectCodec.prototype.decodeNode=function(e,t,n){null!=t&&(this.decodeAttributes(e,t,n),this.decodeChildren(e,t,n))},mxObjectCodec.prototype.decodeAttributes=function(e,t,n){if(null!=(t=t.attributes))for(var a=0;a<t.length;a++)this.decodeAttribute(e,t[a],n)},mxObjectCodec.prototype.decodeAttribute=function(e,t,n){var a=t.nodeName;if("as"!=a&&"id"!=a){t="value"==a?t.nodeValue:this.convertValueFromXml(t.nodeValue);var i=this.getFieldName(a);if(this.isReference(n,i,t,!1)){if(null==(e=e.getObject(t)))return void mxLog.warn("mxObjectCodec.decode: No object for "+this.getName()+"."+a+"="+t);t=e}this.isExcluded(n,a,t,!1)||(n[a]=t)}},mxObjectCodec.prototype.decodeChildren=function(e,t,n){for(t=t.firstChild;null!=t;){var a=t.nextSibling;t.nodeType==mxConstants.NODETYPE_ELEMENT&&!this.processInclude(e,t,n)&&this.decodeChild(e,t,n),t=a}},mxObjectCodec.prototype.decodeChild=function(e,t,n){var a=this.getFieldName(t.getAttribute("as"));if(null==a||!this.isExcluded(n,a,t,!1)){var i=this.getFieldTemplate(n,a,t),s=null;"add"==t.nodeName?null==(s=t.getAttribute("value"))&&(s=mxUtils.eval(mxUtils.getTextContent(t))):s=e.decode(t,i),this.addObjectValue(n,a,s,i)}},mxObjectCodec.prototype.getFieldTemplate=function(e,t,n){return(e=e[t])instanceof Array&&0<e.length&&(e=null),e},mxObjectCodec.prototype.addObjectValue=function(e,t,n,a){null!=n&&n!=a&&(null!=t&&0<t.length?e[t]=n:e.push(n))},mxObjectCodec.prototype.processInclude=function(e,t,n){if("include"!=t.nodeName)return!1;if(null!=(t=t.getAttribute("name")))try{var a=mxUtils.load(t).getDocumentElement();null!=a&&e.decode(a,n)}catch(e){}return!0},mxObjectCodec.prototype.beforeDecode=function(e,t,n){return t},mxObjectCodec.prototype.afterDecode=function(e,t,n){return n},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,t,n,a){return mxObjectCodec.prototype.isExcluded.apply(this,arguments)||a&&"value"==t&&n.nodeType==mxConstants.NODETYPE_ELEMENT},e.afterEncode=function(e,t,n){if(null!=t.value&&t.value.nodeType==mxConstants.NODETYPE_ELEMENT){var a=n;(n=mxClient.IS_IE?t.value.cloneNode(!0):e.document.importNode(t.value,!0)).appendChild(a),e=a.getAttribute("id"),n.setAttribute("id",e),a.removeAttribute("id")}return n},e.beforeDecode=function(e,t,n){var a=t,i=this.getName();if(t.nodeName!=i?(null!=(a=t.getElementsByTagName(i)[0])&&a.parentNode==t?(mxUtils.removeWhitespace(a,!0),mxUtils.removeWhitespace(a,!1),a.parentNode.removeChild(a)):a=null,n.value=t.cloneNode(!0),null!=(t=n.value.getAttribute("id"))&&(n.setId(t),n.value.removeAttribute("id"))):n.setId(t.getAttribute("id")),null!=a)for(t=0;t<this.idrefs.length;t++){i=this.idrefs[t];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))),n[i]=o}}return a},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxGraphModel);return e.encodeObject=function(e,t,n){var a=e.document.createElement("root");e.encodeCell(t.getRoot(),a),n.appendChild(a)},e.decodeChild=function(e,t,n){"root"==t.nodeName?this.decodeRoot(e,t,n):mxObjectCodec.prototype.decodeChild.apply(this,arguments)},e.decodeRoot=function(e,t,n){var a=null;for(t=t.firstChild;null!=t;){var i=e.decodeCell(t);null!=i&&null==i.getParent()&&(a=i),t=t.nextSibling}null!=a&&n.setRoot(a)},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxRootChange,["model","previous","root"]);return e.afterEncode=function(e,t,n){return e.encodeCell(t.root,n),n},e.beforeDecode=function(e,t,n){if(null!=t.firstChild&&t.firstChild.nodeType==mxConstants.NODETYPE_ELEMENT){var a=(t=t.cloneNode(!0)).firstChild;for(n.root=e.decodeCell(a,!1),n=a.nextSibling,a.parentNode.removeChild(a),a=n;null!=a;)n=a.nextSibling,e.decodeCell(a),a.parentNode.removeChild(a),a=n}return t},e.afterDecode=function(e,t,n){return n.previous=n.root,n},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxChildChange,["model","child","previousIndex"],["parent","previous"]);return e.isReference=function(e,t,n,a){return!("child"!=t||null==e.previous&&a)||0<=mxUtils.indexOf(this.idrefs,t)},e.afterEncode=function(e,t,n){return this.isReference(t,"child",t.child,!0)?n.setAttribute("child",e.getId(t.child)):e.encodeCell(t.child,n),n},e.beforeDecode=function(e,t,n){if(null!=t.firstChild&&t.firstChild.nodeType==mxConstants.NODETYPE_ELEMENT){var a=(t=t.cloneNode(!0)).firstChild;for(n.child=e.decodeCell(a,!1),n=a.nextSibling,a.parentNode.removeChild(a),a=n;null!=a;){if(n=a.nextSibling,a.nodeType==mxConstants.NODETYPE_ELEMENT){var i=a.getAttribute("id");null==e.lookup(i)&&e.decodeCell(a)}a.parentNode.removeChild(a),a=n}}else a=t.getAttribute("child"),n.child=e.getObject(a);return t},e.afterDecode=function(e,t,n){return n.child.parent=n.previous,n.previous=n.parent,n.previousIndex=n.index,n},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxTerminalChange,["model","previous"],["cell","terminal"]);return e.afterDecode=function(e,t,n){return n.previous=n.terminal,n},e}());var mxGenericChangeCodec=function(e,a){var t=new mxObjectCodec(e,["model","previous"],["cell"]);return t.afterDecode=function(e,t,n){return mxUtils.isNode(n.cell)&&(n.cell=e.decodeCell(n.cell,!1)),n.previous=n[a],n},t};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,t){return this.encodeCell(e,t,t.graph.getModel().getRoot())},e.encodeCell=function(e,t,n){var a=t.graph.getModel(),i=t.getState(n),s=a.getParent(n);if(null==s||null!=i){var o=a.getChildCount(n),r=t.graph.getCellGeometry(n),l=null;if(s==a.getRoot()?l="layer":null==s?l="graph":a.isEdge(n)?l="edge":0<o&&null!=r?l="group":a.isVertex(n)&&(l="vertex"),null!=l){var d=e.document.createElement(l);if(null!=t.graph.getLabel(n)&&(d.setAttribute("label",t.graph.getLabel(n)),t.graph.isHtmlLabel(n)&&d.setAttribute("html",!0)),null==s){var c=t.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",t.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,t,a.getChildAt(n,c)))&&d.appendChild(i)}}return d},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxStylesheet);return e.encode=function(e,t){var n,a=e.document.createElement(this.getName());for(n in t.styles){var i=t.styles[n],s=e.document.createElement("add");if(null!=n){for(var o in s.setAttribute("as",n),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,t){var n=typeof t;return"function"==n?t=mxStyleRegistry.getName(style[j]):"object"==n&&(t=null),t},e.decode=function(e,t,n){n=n||new this.template.constructor;var a=t.getAttribute("id");for(null!=a&&(e.objects[a]=n),t=t.firstChild;null!=t;){if(!this.processInclude(e,t,n)&&"add"==t.nodeName&&null!=(a=t.getAttribute("as"))){var i=t.getAttribute("extend"),s=null!=i?mxUtils.clone(n.styles[i]):null;for(null==s&&(null!=i&&mxLog.warn("mxStylesheetCodec.decode: stylesheet "+i+" not found to extend"),s={}),i=t.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}n.putCellStyle(a,s)}t=t.nextSibling}return n},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxDefaultKeyHandler);return e.encode=function(e,t){return null},e.decode=function(e,t,n){if(null!=n)for(t=t.firstChild;null!=t;){if(!this.processInclude(e,t,n)&&"add"==t.nodeName){var a=t.getAttribute("as"),i=t.getAttribute("action"),s=t.getAttribute("control");n.bindAction(a,i,s)}t=t.nextSibling}return n},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxDefaultToolbar);return e.encode=function(e,t){return null},e.decode=function(e,t,n){if(null!=n){var a=n.editor;for(t=t.firstChild;null!=t;){if(t.nodeType==mxConstants.NODETYPE_ELEMENT&&!this.processInclude(e,t,n))if("separator"==t.nodeName)n.addSeparator();else if("br"==t.nodeName)n.toolbar.addBreak();else if("hr"==t.nodeName)n.toolbar.addLine();else if("add"==t.nodeName){var i=t.getAttribute("as"),s=(i=mxResources.get(i)||i,t.getAttribute("icon")),o=t.getAttribute("pressedIcon"),r=t.getAttribute("action"),l=t.getAttribute("mode"),d=t.getAttribute("template"),c="0"!=t.getAttribute("toggle"),m=mxUtils.getTextContent(t),u=null;if(null!=r)u=n.addItem(i,s,r,o);else if(null!=l){var p=mxUtils.eval(m);u=n.addMode(i,s,l,o,p)}else if(null!=d||null!=m&&0<m.length)u=a.templates[d],d=t.getAttribute("style"),null!=u&&null!=d&&(u=u.clone()).setStyle(d),(d=null)!=m&&0<m.length&&(d=mxUtils.eval(m)),u=n.addPrototype(i,s,u,o,d,c);else if(0<(o=mxUtils.getChildNodes(t)).length)if(null==s)for(d=n.addActionCombo(i),i=0;i<o.length;i++)"separator"==(c=o[i]).nodeName?n.addOption(d,"---"):"add"==c.nodeName&&(s=c.getAttribute("as"),c=c.getAttribute("action"),n.addActionOption(d,s,c));else{var g=null,v=n.addPrototype(i,s,function(){if(null==(e=a.templates[g.value]))return mxLog.warn("Template "+e+" not found"),null;var e=e.clone(),t=g.options[g.selectedIndex].cellStyle;return null!=t&&e.setStyle(t),e},null,null,c);g=n.addCombo();for(mxEvent.addListener(g,"change",function(){n.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)}),n.toolbar.noReset=!1}),i=0;i<o.length;i++)"separator"==(c=o[i]).nodeName?n.addOption(g,"---"):"add"==c.nodeName&&(s=c.getAttribute("as"),m=c.getAttribute("template"),n.addOption(g,s,m||d).cellStyle=c.getAttribute("style"))}null!=u&&(null!=(d=t.getAttribute("id"))&&0<d.length&&u.setAttribute("id",d))}t=t.nextSibling}}return n},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxDefaultPopupMenu);return e.encode=function(e,t){return null},e.decode=function(e,t,n){var a=t.getElementsByTagName("include")[0];return null!=a?this.processInclude(e,a,n):null!=n&&(n.config=t),n},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxEditor,"modified lastSnapshot ignoredChanges undoManager graphContainer toolbarContainer".split(" "));return e.afterDecode=function(e,t,n){return null!=(e=t.getAttribute("defaultEdge"))&&(t.removeAttribute("defaultEdge"),n.defaultEdge=n.templates[e]),null!=(e=t.getAttribute("defaultGroup"))&&(t.removeAttribute("defaultGroup"),n.defaultGroup=n.templates[e]),n},e.decodeChild=function(e,t,n){if("Array"==t.nodeName){if("templates"==t.getAttribute("as"))return void this.decodeTemplates(e,t,n)}else if("ui"==t.nodeName)return void this.decodeUi(e,t,n);mxObjectCodec.prototype.decodeChild.apply(this,arguments)},e.decodeUi=function(e,t,n){for(e=t.firstChild;null!=e;){if("add"==e.nodeName){t=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(t)||t,s,a,o,r,l,!1,!0).setVisible(!0)}"graph"==t?n.setGraphContainer(s):"toolbar"==t?n.setToolbarContainer(s):"title"==t?n.setTitleContainer(s):"status"==t?n.setStatusContainer(s):"map"==t&&n.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,t,n){null==n.templates&&(n.templates=[]),t=mxUtils.getChildNodes(t);for(var a=0;a<t.length;a++){for(var i=t[a].getAttribute("as"),s=t[a].firstChild;null!=s&&1!=s.nodeType;)s=s.nextSibling;null!=s&&(n.templates[i]=e.decodeCell(s))}},e}()),EditorUi=function(e,t,n){this.projectDesignController=e,this.editor=t||new Editor,this.container=n||document.body;var a=t.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("+t.gridImage+")",a.container.style.backgroundPosition="-1px -1px",a.container.focus();var o=a.fireMouseEvent;a.fireMouseEvent=function(e,t,n){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","tts","ispeechtts","awspolly","getdigits","getsecretdigits","lumenvoxtts","sestektts"],[[1,"n"],[1,1],[1,"n"],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,"n"],[1,"n"],[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"]]),this.createMultiplicities(a.multiplicities,["record"],[[1,1]],[[1,"n"]]),this.createMultiplicities(a.multiplicities,["database","ispeechasr","sendSMS","sendMail","sendFax","googleasr","lumenvoxasr","tildeasr","dialogflow","awslex","sesteknda","sestekasr"],[[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"]]),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,n){var t=new mxEventObject(mxEvent.DOUBLE_CLICK,"event",e,"cell",n);this.fireEvent(t),mxEvent.isConsumed(e)||t.isConsumed()||(this.getModel().isEdge(n)?0<=["background","gotoif","gotoiftime","menu","getdigits","getsecretdigits","vswitch","login","pause","unpause","logout"].indexOf(n.source.value.tagName)&&this.startEditingAtCell(n):this.getModel().isVertex(n)&&i.projectDesignController.openDialog(n.getValue(),function(e){for(var t=0;t<e.length;t+=1)n.setAttribute(e[t].name,e[t].value);a.refresh(n)}),t.consume())},a.panningHandler.autoExpand=!0,a.panningHandler.factoryMethod=mxUtils.bind(this,function(e,t,n){this.isEditingEnabled()&&this.menus.createPopupMenu(e,t,n)}),t.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(t):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"),t=function(){e.setEnabled(!mxClipboard.isEmpty())},n=mxClipboard.cut;mxClipboard.cut=function(){n.apply(this,arguments),t()};var a=mxClipboard.copy;mxClipboard.copy=function(){a.apply(this,arguments),t()}},EditorUi.prototype.isEditingEnabled=function(){return!!CRUD_PERMISSIONS.canEdit},EditorUi.prototype.exportXML=function(e){var t=window.document.createElement("a");t.href="data:attachment/text;charset=utf-8,"+encodeURIComponent(e),t.download=this.editor.filename+".xml",t.target="_self",t.click()},EditorUi.prototype.open=function(){try{null!=window.opener&&null!=window.opener.openFile&&window.opener.openFile.setConsumer(mxUtils.bind(this,function(e,t){try{var n=mxUtils.parseXml(e);this.editor.setGraphXml(n.documentElement),this.editor.modified=!1,this.editor.undoManager.clear(),null!=t&&(this.editor.filename=t)}catch(e){mxUtils.alert(mxResources.get("invalidOrMissingFile")+": "+e.message)}}))}catch(e){}},EditorUi.prototype.openString=function(e,t,n){try{var a=mxUtils.parseXml(e);this.editor.setGraphXml(a.documentElement),this.editor.modified=!1,this.editor.undoManager.clear(),null!=t&&(this.editor.filename=t),null!=n&&(this.editor.data=n)}catch(e){mxUtils.alert(mxResources.get("invalidOrMissingFile")+": "+e.message)}},EditorUi.prototype.validate=function(e,t){for(var n=this.editor.graph,a=(e=null!=e?e:n.model.getRoot(),t=null!=t?t:{},!0),i=n.model.getChildCount(e),s=0;s<i;s++){var o=n.model.getChildAt(e,s),r=t;n.isValidRoot(o)&&(r={}),null!=(r=this.validate(o,r))?n.setCellWarning(o,r.replace(/\n/g,"<br>")):n.setCellWarning(o,null),a=a&&null==r}if(i="",n.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="-1"!==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"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";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"}if(n.model.isEdge(e))switch(n.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 n.isCellCollapsed(e)&&!a&&(i+=(mxResources.get(n.containsValidationErrorsResource)||n.containsValidationErrorsResource)+"\n"),i=n.model.isEdge(e)?i+(n.getEdgeValidationError(e,n.model.getTerminal(e,!0),n.model.getTerminal(e,!1))||""):i+(n.getCellValidationError(e)||""),null!=(s=n.validateCell(e,t))&&(i+=s),null==n.model.getParent(e)&&n.view.validate(),0<i.length||!a?i:null},EditorUi.prototype.validateBlock=function(t){var n=this.editor.graph,e=n.getDefaultParent(),a=0;return e.children.forEach(function(e){n.model.isVertex(e)&&e.value.nodeName==t&&a++}),!(1<a)},EditorUi.prototype.getUrl=function(e){var t=null!=e?e:window.location.pathname,n=0<t.indexOf("?")?1:0;for(var a in urlParams)t+=0==n?"?":"&",t+=a+"="+urlParams[a],n++;return t},EditorUi.prototype.addUndoListener=function(){var e=this.actions.get("undo"),t=this.actions.get("redo"),n=this.editor.undoManager,a=function(){e.setEnabled(n.canUndo()),t.setEnabled(n.canRedo())};n.addListener(mxEvent.ADD,a),n.addListener(mxEvent.UNDO,a),n.addListener(mxEvent.REDO,a),n.addListener(mxEvent.CLEAR,a),a()},EditorUi.prototype.addSelectionListener=function(){var e=mxUtils.bind(this,function(){var e=this.editor.graph,t=!e.isSelectionEmpty(),n=!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)&&(n=!0),a&&n)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(t);this.actions.get("curved").setEnabled(a),this.actions.get("rotation").setEnabled(n),this.actions.get("wordWrap").setEnabled(n),this.actions.get("group").setEnabled(1<e.getSelectionCount()),this.actions.get("ungroup").setEnabled(1==e.getSelectionCount()&&0<e.getModel().getChildCount(e.getSelectionCell()));var l=n&&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(t);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(n||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),t=this.container.clientWidth+390,n=this.container.clientHeight+190;this.container==document.body&&(t=document.body.clientWidth||document.documentElement.clientWidth,n=e&&document.body.clientHeight||document.documentElement.clientHeight);var a=Math.max(0,Math.min(this.hsplitPosition,t-this.splitSize-20)),i=Math.max(0,Math.min(this.vsplitPosition,n-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=t+"px",this.toolbarContainer.style.width=this.menubarContainer.style.width;var o=n-i-this.splitSize-this.menubarHeight-this.toolbarHeight;this.sidebarContainer.style.height=o+"px",this.diagramContainer.style.width=t-a-this.splitSize+"px";var r=n-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 t=document.createElement("div");return t.className=e,t},EditorUi.prototype.createHeader=function(e){return document.createElement(e)},EditorUi.prototype.createForm=function(e){var t=document.createElement("form");return t.className=e,t},EditorUi.prototype.addSplitHandler=function(t,n,a,i){var s=null,o=null;function r(e){if(null!=s){var t=new mxPoint(mxEvent.getClientX(e),mxEvent.getClientY(e));i(Math.max(0,o+(n?t.x-s.x:s.y-t.y)-a)),mxEvent.consume(e)}}function e(e){r(e),o=s=null}mxEvent.addGestureListeners(t,function(e){s=new mxPoint(mxEvent.getClientX(e),mxEvent.getClientY(e)),o=parseInt(n?t.style.left:t.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,t,n){var a=this.editor.graph,i=a.getSelectionCell();t=null!=this.animate?this.animate:t,a.getModel().beginUpdate();try{e.execute(a.getDefaultParent(),i)}catch(e){throw e}finally{if(t&&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 t(e){if(!a.isSelectionEmpty()){var t=0,n=0;37==e?t=-1:38==e?n=-1:39==e?t=1:40==e&&(n=1),a.moveCells(a.getSelectionCells(),t,n),a.scrollCellToVisible(a.getSelectionCell())}}o.isControlDown=function(e){return mxEvent.isControlDown(e)||mxClient.IS_MAC&&e.metaKey};var n=mxUtils.bind(this,function(e,t,n,a){var i=this.actions.get(n);if(null!=i){var s=function(){i.enabled&&i.funct()};t?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(){t(37)}),o.bindKey(38,function(){t(38)}),o.bindKey(39,function(){t(39)}),o.bindKey(40,function(){t(40)}),o.bindKey(113,function(){a.startEditingAtCell()}),n(46,!1,"delete"),n(82,!0,"tilt"),n(83,!0,"save"),n(83,!0,"saveAs",!0),n(107,!1,"zoomIn"),n(109,!1,"zoomOut"),n(65,!0,"selectAll"),n(86,!0,"selectVertices",!0),n(69,!0,"selectEdges",!0),n(69,!0,"export"),n(66,!0,"toBack"),n(70,!0,"toFront"),n(68,!0,"duplicate"),n(90,!0,"undo"),n(89,!0,"redo"),n(88,!0,"cut"),n(67,!0,"copy"),n(81,!0,"connect"),n(86,!0,"paste"),n(71,!0,"group"),n(71,!0,"grid",!0),n(85,!0,"ungroup"),n(112,!1,"about"),n(80,!0,"publish",!0),o},EditorUi.prototype.createMultiplicities=function(e,t,n,a){for(var i=0;i<t.length;i++)e.push(new mxMultiplicity(!0,t[i],null,null,n[i][0],n[i][1],null,mxResources.get(t[i])+mxResources.get("musthave")+n[i][0]+mxResources.get("outgoingedge"),null)),e.push(new mxMultiplicity(!1,t[i],null,null,a[i][0],a[i][1],null,mxResources.get(t[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,t){this.editorUi=e,this.container=t,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 t=mxEvent.getSource(e);null!=t;){if(t==this.currentElt)return;t=t.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(t,"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,t,n,a,i){mxEventSource.call(this),this.label=e,this.funct=t,this.enabled=null==n||n,this.iconCls=a,this.shortcut=i}function Menubar(e,t){this.editorUi=e,this.container=t,mxEvent.addGestureListeners(document,mxUtils.bind(this,function(e){this.hideMenu()}))}function Menu(e,t){mxEventSource.call(this),this.funct=e,this.enabled=null==t||t}function Toolbar(e,t){this.editorUi=e,this.container=t,this.init(),mxEvent.addGestureListeners(document,mxUtils.bind(this,function(e){this.hideMenu()}))}function createCheckbox(e){var t=document.createElement("input");return t.setAttribute("type","checkbox"),e&&t.setAttribute("checked",!0),t}function createDropdownFromApi(e,n,a,i,t,s,o,r){var l=new XMLHttpRequest;l.open("GET",e,!1),l.setRequestHeader("Authorization","Bearer "+t.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(t){r&&t[a]==r||((m=document.createElement("option")).text=t[a],s&&o?(m.value=o,s.forEach(function(e){m.value=m.value.replace("%"+e+"%",t[e])}),m.selected=m.value==n):(m.value=t[i],m.selected=t[i]==n),c.appendChild(m))}),c.className="form-control select2",c}function createDropdownWithOptgroupFromApi(e,t,n,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[n],d.value=e[a],d.selected=e[a]==t,u.appendChild(d)}),l.appendChild(u)}return l.className="form-control select2",l}function createGroupedDropdownFromApi(e,t,n,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[n].toUpperCase(),d.value=e[a],d.selected=e[a]==t,l.appendChild(d),e[s].forEach(function(e){(d=document.createElement("option")).className="select-group-son",d.text="-"+_.capitalize(e[n]),d.value=e[a],d.selected=e[a]==t,l.appendChild(d)})}),l.className="form-control select2",l}function createDropdownFromArray(e,t){var n=document.createElement("select");for(var a in e){var i=document.createElement("option");i.text=e[a],i.value=a,(0<t||""!=t)&&(i.selected=t===a),n.appendChild(i)}return n.className="form-control select2",n}function createDropdownFromTigerDialList(e){var t=document.createElement("select"),n=[],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)n[s[o].id]=s[o].name}}}catch(e){console.log(e)}for(var r in n){var l=document.createElement("option");l.text=n[r],l.value=r,(0<e||""!=e)&&(l.selected=e===r),t.appendChild(l)}return t.className="form-control select2",t}function Dialog(e,t,n,a,i,s,o){var r=0;mxClient.IS_IE&&9!=document.documentMode&&(r=60),n+=r,a+=r;Math.max(0,Math.round((document.body.scrollWidth-n)/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(t),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(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("import")+" XML");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");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 t=e.target.files[0];if(console.log(t),t)if("text/xml"===t.type){var n=new FileReader;n.onload=function(e){var t=e.target.result;mxUtils.write(d,t)},n.readAsText(t)}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 t=mxUtils.parseXml(d.value);n.editor.setGraphXml(t.documentElement),n.hideDialog()}));m.className="btn blue";var u=mxUtils.button(mxResources.get("cancel"),function(){n.hideDialog()});u.className="btn default",i.appendChild(m),i.appendChild(u),e.appendChild(t),e.appendChild(a),e.appendChild(i),this.container=e}function AboutDialog(e){var t=e.createDiv("modal-content"),n=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",n.appendChild(o),n.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),t.appendChild(n),t.appendChild(a),t.appendChild(i),this.container=t}function SaveDialog(e){var t=e.createDiv("modal-content"),n=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",n.appendChild(o),n.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),t.appendChild(n),t.appendChild(a),t.appendChild(i),this.container=t}function NewDialog(e){var t=e.createDiv("modal-content"),n=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",n.appendChild(o),n.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),t.appendChild(n),t.appendChild(a),t.appendChild(i),this.container=t}function DescriptionDialog(e){console.log(e.editor.data);var t=e.createDiv("modal-content"),n=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",n.appendChild(o),n.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),t.appendChild(n),t.appendChild(a),t.appendChild(i),this.container=t}function VariableDialog(e){var t=e.createDiv("modal-content"),n=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",n.appendChild(o),n.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),t.appendChild(n),t.appendChild(a),t.appendChild(i),this.container=t}function OpenDialog(e){var t=e.createDiv("modal-content"),n=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",n.appendChild(o),n.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),t.appendChild(n),t.appendChild(a),t.appendChild(i),this.container=t}function RenameDialog(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("rename"));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-4"),d=n.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=n.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 t=new XMLHttpRequest;t.open("PUT",SAVE_URL+n.editor.data.id,!0),t.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),t.setRequestHeader("Authorization","Bearer "+n.editor.data.token),t.send("name="+u.value),t.onload=function(e){200===t.status?(n.editor.setStatus("Project successfully renamed"),n.editor.filename=u.value):(console.log(t.response),n.editor.setStatus(JSON.parse(t.response).errors[0].message))},t.onerror=function(e){mxUtils.alert(t.statusText)},n.hideDialog()});p.className="btn blue";var g=mxUtils.button(mxResources.get("cancel"),function(){n.hideDialog()});g.className="btn default",i.appendChild(p),i.appendChild(g),e.appendChild(t),e.appendChild(a),e.appendChild(i),this.container=e}function EditFileDialog(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("edit"));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");if(d.style.width="100%",d.style.height="374px",d.value=mxUtils.getPrettyXml(t.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 t=e.dataTransfer.files[0],n=new FileReader;n.onload=function(e){d.value=e.target.result},n.readAsText(t)}},!1)}l.appendChild(d),r.appendChild(l),a.appendChild(r);var c=mxUtils.button(mxResources.get("save"),function(){var e=mxUtils.parseXml(d.value);t.editor.setGraphXml(e.documentElement),t.hideDialog()});c.className="btn blue";var m=mxUtils.button(mxResources.get("cancel"),function(){t.hideDialog()});m.className="btn default",i.appendChild(c),i.appendChild(m),e.appendChild(n),e.appendChild(a),e.appendChild(i),this.container=e}function ExportDialog(t){var e=t.createDiv("modal-content"),n=t.createDiv("modal-header"),a=t.createDiv("modal-body form"),i=t.createDiv("modal-footer"),s=t.createHeader("h4");mxUtils.write(s,mxResources.get("export")+" XML");var o=mxUtils.button("",function(){t.hideDialog()});o.className="close",n.appendChild(o),n.appendChild(s);var r=t.createDiv("form-horizontal form-row-seperated"),l=t.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",t.editor.getOrCreateFilename()),c.className="form-control";var m=t.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){t.save(!1);encodeURIComponent(mxUtils.getXml(t.editor.getGraphXml()));new mxXmlRequest(SAVE_URL+t.editor.data.id+"/download","filename="+c.value,"GET").simulate(document,"_blank"),t.hideDialog()}));u.className="btn blue";var p=mxUtils.button(mxResources.get("cancel"),function(){t.hideDialog()});p.className="btn default",i.appendChild(u),i.appendChild(p),e.appendChild(n),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"),t=i.createDiv("md-toolbar"),n=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",t.appendChild(l),t.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 E=i.createDiv("p");E.className="help-block",mxUtils.write(E,mxResources.get("help_"+p)),b.appendChild(E)}h.appendChild(b),c.appendChild(h)}n.appendChild(c);var A=mxUtils.button(mxResources.get("save"),mxUtils.bind(this,function(e){for(var t=0;t<s.value.attributes.length;t++){var n="_"+s.value.attributes[t].name,a=s.value.attributes[t].name;s.setAttribute(a,document.getElementById(n).value)}o.refresh(s),i.hideDialog()}));A.className="btn blue";var y=mxUtils.button(mxResources.get("cancel"),function(){i.hideDialog()});y.className="btn default",a.appendChild(A),a.appendChild(y),e.appendChild(t),e.appendChild(n),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 t=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 n=e.getAttribute("pageScale");this.graph.pageScale=null!=n?n: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),t.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,t=this.outline;if(null!=e.container&&null!=t.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="",t.outline.container.style.backgroundColor=e.container.style.backgroundColor,t.outline.pageVisible==e.pageVisible&&t.outline.pageScale==e.pageScale||(t.outline.pageScale=e.pageScale,t.outline.pageVisible=e.pageVisible,t.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 n=mxClient.IS_IE&&9<=document.documentMode?"url("+this.transparentImage+")":"none";e.container.style.backgroundImage=!e.pageVisible&&e.isGridEnabled()?"url("+this.gridImage+")":n,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 n=e.apply(this,arguments);return n.intersects=mxUtils.bind(this,function(e,t){return!!this.isConnecting()||mxCellMarker.prototype.intersects.apply(n,arguments)}),n},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(),t=0<e.width?e.x/this.scale-this.translate.x:0,n=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,t)/r),c=Math.floor(Math.min(0,n)/l),m=Math.ceil(Math.max(1,t+a)/r)-d,u=Math.ceil(Math.max(1,n+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 n=mxGraph.prototype.panGraph;mxGraph.prototype.panGraph=function(e,t){n.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=t+"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 t=new mxRectangle(0,0,1,1);this.backgroundImage=new mxImageShape(t,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){t=this.getBackgroundPageBounds();null==this.backgroundPageShape?(this.backgroundPageShape=this.createBackgroundPageShape(t),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=t,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,t,n){var a=this.view.scale,i=this.view.translate,s=this.pageFormat,o=a*this.pageScale,r=this.view.getBackgroundPageBounds();t=r.width,n=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(t/l.width)-1:0,c=e?Math.ceil(n/l.height)-1:0,m=r.x+t,u=r.y+n;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,t,n){for(var a=0;a<t.length;a++)if(this.graph.getModel().isVertex(t[a])){var i=this.graph.getCellGeometry(t[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,t,n,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 t=this.graph.getModel(),n=t.getParent(this.graph.getSelectionCell()),a=o.apply(this,arguments),i=t.getParent(a);if(null==n||n!=a&&n!=i)for(;!this.graph.isCellSelected(a)&&!this.graph.isCellSelected(i)&&t.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 t=l.apply(this,arguments),n=this.graph.getModel(),a=n.getParent(this.graph.getSelectionCell()),i=n.getParent(e);return(null==a||a!=e&&a!=i)&&(this.graph.isCellSelected(e)||!n.isVertex(i)||this.graph.isValidRoot(i)||(t=!0)),t},mxGraphHandler.prototype.selectDelayed=function(e){var t=e.getCell();null==t&&(t=this.cell);for(var n=this.graph.getModel(),a=n.getParent(t);this.graph.isCellSelected(t)&&n.isVertex(a)&&!this.graph.isValidRoot(a);)t=a,a=n.getParent(t);this.graph.selectCellForEvent(t,e.getEvent())},mxPanningHandler.prototype.getCellForPopupEvent=function(e){for(var t=e.getCell(),n=this.graph.getModel(),a=n.getParent(t);n.isVertex(a)&&!this.graph.isValidRoot(a);)this.graph.isCellSelected(a)&&(t=a),a=n.getParent(a);return t}},Editor.prototype.createUndoManager=function(){var s=this.graph,n=new mxUndoManager,e=function(e,t){n.undoableEditHappened(t.getProperty("edit"))};s.getModel().addListener(mxEvent.UNDO,e),s.getView().addListener(mxEvent.UNDO,e);var t=function(e,t){for(var n=s.getSelectionCellsForChanges(t.getProperty("edit").changes),a=[],i=1;i<n.length;i++)null!=s.view.getState(n[i])&&a.push(n[i]);s.setSelectionCells(a)};return n.addListener(mxEvent.UNDO,t),n.addListener(mxEvent.REDO,t),n},Editor.prototype.initStencilRegistry=function(){mxStencilRegistry.loadStencilSet(STENCIL_PATH+"/general.xml")},mxStencilRegistry.libraries={},mxStencilRegistry.packages=[],mxStencilRegistry.getStencil=function(e){var t=mxStencilRegistry.stencils[e];if(null==t){var n=mxStencilRegistry.getBasenameForStencil(e);if(null!=n){var a=mxStencilRegistry.libraries[n];if(null!=a){if(null==mxStencilRegistry.packages[n]){mxStencilRegistry.packages[n]=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+"/"+n+".xml",null);t=mxStencilRegistry.stencils[e]}}return t},mxStencilRegistry.getBasenameForStencil=function(e){var t=e.split("."),n=null;if(0<t.length&&"mxgraph"==t[0]){n=t[1];for(var a=2;a<t.length-1;a++)n+="/"+t[a]}return n},mxStencilRegistry.loadStencilSet=function(e,t,n){n=null!=n&&n;var a=mxStencilRegistry.packages[e];if(n||null==a){var i=!1;null==a&&(a=mxUtils.load(e).getXml(),mxStencilRegistry.packages[e]=a,i=!0),mxStencilRegistry.parseStencilSet(a,t,i)}},mxStencilRegistry.parseStencilSet=function(e,t,n){n=null==n||n;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(n&&mxStencilRegistry.addStencil(s+r.toLowerCase(),new mxStencil(i)),null!=t){var l=i.getAttribute("w"),d=i.getAttribute("h");t(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,t){this.data=e,this.filename=t,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",["tts","ispeechtts","awspolly","lumenvoxtts","sestektts"],["GoogleTTS","ISpeechTTS","AWSPolly","LumenvoxTTS","SestekTTS"]),this.addImagePalette("asr","ASR",e+"/asr/","_128x128.png",["googleasr","ispeechasr","lumenvoxasr","tildeasr","sestekasr"],["GoogleASR","ISpeechASR","LumenvoxASR","TildeASR","SestekASR"]),this.addImagePalette("integrationServer",mxResources.get("integrationServer"),e+"/integration_server/","_128x128.png",["database","sendMail","sendSMS","dialogflow","awslex","sesteknda"],[mxResources.get("database"),mxResources.get("sendMail"),mxResources.get("sendSMS"),"Dialogflow","AWSLex","SestekNDA"]),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(),t=e.width+2*this.tooltipBorder+4,n=e.height+2*this.tooltipBorder;if(mxClient.IS_QUIRKS?(n+=4,this.tooltip.style.overflow="hidden"):this.tooltip.style.overflow="visible",this.tooltipImage.style.visibility="visible",this.tooltip.style.width=t+"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;n+=a,mxClient.IS_SVG?this.tooltipTitle.style.marginTop=2-a+"px":(n-=6,this.tooltipTitle.style.top=n-a+"px")}else null!=this.tooltipTitle&&null!=this.tooltipTitle.parentNode&&(this.tooltipTitle.style.display="none");this.tooltip.style.height=n+"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-n/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+n/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,t){if(null!=this.taglist&&null!=e&&0<e.length)for(var n=e.toLowerCase().replace(/[\/\,\(\)]/g," ").split(" "),a=0;a<n.length;a++)if(n[a]=n[a].replace(/\.*\d*$/,""),1<n[a].length){var i=this.taglist[n[a]];null==i&&(i={entries:[],dict:new mxDictionary},this.taglist[n[a]]=i),null==i.dict.get(t)&&(i.dict.put(t,t),i.entries.push(t))}return t},Sidebar.prototype.searchEntries=function(e,t,n,a,i){if(null!=this.taglist&&null!=e){for(var s=e.toLowerCase().split(" "),o=new mxDictionary,r=(n+1)*t,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(n*t,r),r,!0)}}else l=[];o=u,d++}var v=l.length;a(l.slice(n*t,(n+1)*t),v,!1)}else a([])},Sidebar.prototype.filterTags=function(e){if(null==e)return null;for(var t=e.split(" "),n=[],a={},i=0;i<t.length;i++)null==a[t[i]]&&(a[t[i]]="1",n.push(t[i]));return n.join(" ")},Sidebar.prototype.cloneCell=function(e,t){var n=e.clone();return null!=t&&(n.value=t),n},Sidebar.prototype.addSearchPalette=function(e){var t=document.createElement("div");t.style.visibility="hidden",this.container.appendChild(t);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 n=document.createElement("div");n.style.whiteSpace="nowrap",n.style.textOverflow="clip",n.style.paddingBottom="8px",n.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",n.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+"')",n.appendChild(s),r.appendChild(n);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 t=e.nextSibling;e!=n&&e!=l&&e.parentNode.removeChild(e),e=t}});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,t,n){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(n?(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=[t,o]},Sidebar.prototype.createTitle=function(e){var t=document.createElement("a");return t.setAttribute("href","javascript:void(0);"),t.setAttribute("title",mxResources.get("sidebarTooltip")),t.className="geTitle",mxUtils.write(t,e),t},Sidebar.prototype.createThumb=function(e,t,n,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((t-2*this.thumbBorder)/c.width,(n-2*this.thumbBorder)/c.height))/100;this.graph.view.scaleAndTranslate(m,Math.floor((t-c.width*m)/2/m-c.x),Math.floor((n-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=t+"px",u.style.height=n+"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(t,n,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(t,this.thumbWidth,this.thumbHeight,r,n,a,e,i,s);var d=new mxRectangle(0,0,i,s);if(1<t.length||t[0].vertex){var c=this.createDragSource(r,this.createDropHandler(t,!0,o,d),this.createDragPreview(i,s),t,d);this.addClickHandler(r,c,t),c.isGuidesEnabled=mxUtils.bind(this,function(){return this.editorUi.editor.graph.graphHandler.guidesEnabled})}else if(null!=t[0]&&t[0].edge){c=this.createDragSource(r,this.createDropHandler(t,!1,o,d),this.createDragPreview(i,s),t,d);this.addClickHandler(r,c,t)}return mxClient.IS_IOS||mxEvent.addGestureListeners(r,null,mxUtils.bind(this,function(e){this.showTooltip(r,t,d.width,d.height,n,a)})),r},Sidebar.prototype.createDropHandler=function(g,v,h,f){return h=null==h||h,mxUtils.bind(this,function(e,t,n,a,i){if(e.isEnabled()){if(0<(g=e.getImportableCells(g)).length){e.stopEditing();var s=null!=n&&e.isValidDropTarget(n,g,t),o=null;if(null==n||s||(n=null),!e.isCellLocked(n||e.getDefaultParent())){e.model.beginUpdate();try{if(a=Math.round(a),i=Math.round(i),v&&e.isSplitTarget(n,g,t)){var r=e.cloneCells(g);e.splitEdge(n,r,null,a-f.width/2,i-f.height/2),o=r}else 0<g.length&&(o=e.importCells(g,a,i,n));if(null!=e.layoutManager){var l=e.layoutManager.getLayout(n);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(t)}})},Sidebar.prototype.createDragPreview=function(e,t){var n=document.createElement("div");return n.style.border="1px dashed black",n.style.width=e+"px",n.style.height=t+"px",n},Sidebar.prototype.createDragSource=function(e,t,n){var a=mxUtils.makeDraggable(e,this.editorUi.editor.graph,t,n,0,0,this.editorUi.editor.graph.autoscroll,!0,!0);return a.getDropTarget=function(e,t,n){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 t=i.tolerance;if(Math.abs(s.x-mxEvent.getClientX(e))<=t&&Math.abs(s.y-mxEvent.getClientY(e))<=t){var n=i.getGridSize();a.drop(i,e,null,n,n)}}o.apply(this,arguments),s=null}},Sidebar.prototype.createVertexTemplateEntry=function(e,t,n,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,t,n,a,i,s,o)}))},Sidebar.prototype.createXmlDocument=function(e,t,n,a){var i=mxUtils.createXmlDocument().createElement(e);return i.setAttribute("label",t),n.forEach(function(e,t){i.setAttribute(e,a[t]?a[t]:"")}),i},Sidebar.prototype.createVertexTemplate=function(e,t,n,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=["","-1","60"];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","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;default:l=[],d=[]}var c=[new mxCell(this.createXmlDocument(a,i,l,d),new mxGeometry(0,0,t,n),e)];return c[0].vertex=!0,this.createVertexTemplateFromCells(c,t,n,i,s,o,r)},Sidebar.prototype.createVertexTemplateFromCells=function(e,t,n,a,i,s,o){return this.createItem(e,a,i,s,t,n,o)},Sidebar.prototype.createEdgeTemplate=function(e,t,n,a,i,s,o){var r=new mxCell(null!=a?a:"",new mxGeometry(0,0,t,n),e);return r.geometry.setTerminalPoint(new mxPoint(0,n),!0),r.geometry.setTerminalPoint(new mxPoint(t,0),!1),r.geometry.relative=!0,r.edge=!0,this.createEdgeTemplateFromCells([r],t,n,i,s,o)},Sidebar.prototype.createEdgeTemplateFromCells=function(e,t,n,a,i,s){return this.createItem(e,a,i,!0,t,n,s)},Sidebar.prototype.addPaletteFunctions=function(e,t,n,a){this.addPalette(e,t,n,mxUtils.bind(this,function(e){for(var t=0;t<a.length;t++)e.appendChild(a[t](e))}))},Sidebar.prototype.addPalette=function(e,t,n,a){var i=this.createTitle(t);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")})),n?(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(n,a,i){var s=!1;(!mxClient.IS_IE||8<=document.documentMode)&&(n.style.backgroundImage="none"==a.style.display?"url('"+this.collapsedImage+"')":"url('"+this.expandedImage+"')"),n.style.backgroundRepeat="no-repeat",n.style.backgroundPosition="0% 50%",mxEvent.addListener(n,"click",mxUtils.bind(this,function(e){if("none"==a.style.display){if(s)a.style.display="block";else if(s=!0,null!=i){n.style.cursor="wait";var t=n.innerHTML;n.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",n.style.cursor="",n.innerHTML=t},0)}else a.style.display="block";n.style.backgroundImage="url('"+this.expandedImage+"')"}else n.style.backgroundImage="url('"+this.collapsedImage+"')",a.style.display="none";mxEvent.consume(e)}))},Sidebar.prototype.addImagePalette=function(e,t,s,o,r,n,a){for(var l=[],d=0;d<r.length;d++)mxUtils.bind(this,function(e,t,n){if(null==n){var a=e.lastIndexOf("/"),i=e.lastIndexOf(".");n=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],t,!1,!0,this.filterTags(n)))})(r[d],null!=n?n[d]:null,null!=a?a[r[d]]:null);this.addPaletteFunctions(e,t,!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,t,n,a){mxGraph.call(this,e,t,n,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 t=this.view.getState(e),n=null!=t?t.style:this.getCellStyle(e);return"1"==n.html||"wrap"==n.whiteSpace},this.cellRenderer.getLabelValue=function(e){var t=mxCellRenderer.prototype.getLabelValue.apply(this,arguments);return"wrap"==e.style.whiteSpace&&1!=e.style.html&&(t=mxUtils.htmlEntities(t,!1)),t},this.isCellLocked=function(e){return!1},this.connectionHandler.tapAndHoldTolerance=16;var s=this.connectionHandler.tapAndHold;this.connectionHandler.tapAndHold=function(e,t){null==t?this.graph.panningHandler.active||(i.start(e.getGraphX(),e.getGraphY()),this.graph.panningHandler.panningTrigger=!1):tapAndHoldStartsConnection?s.apply(this,arguments):this.graph.isCellSelected(t.cell)&&1<this.graph.getSelectionCount()&&this.graph.removeSelectionCell(t.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 t=this.view.getState(e),n=null!=t?t.style:this.getCellStyle(e);if(null!=n){var a=mxUtils.getValue(n,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 t=this.getModel().cloneCells([e])[0];null!=t.geometry&&(t.geometry.points=null);var n=t.getStyle();n=mxUtils.setStyle(n,mxConstants.STYLE_ENTRY_X,null),n=mxUtils.setStyle(n,mxConstants.STYLE_ENTRY_Y,null),n=mxUtils.setStyle(n,mxConstants.STYLE_EXIT_X,null),n=mxUtils.setStyle(n,mxConstants.STYLE_EXIT_Y,null),t.setStyle(n),this.connectionHandler.createEdgeState=function(e){return this.graph.view.createState(t)},this.connectionHandler.factoryMethod=function(){return this.graph.cloneCells([t])[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 t="";return this.getModel().isVertex(e)?t+=mxResources.get("description_"+e.value.nodeName)||"":this.getModel().isEdge(e)&&(t=mxGraph.prototype.getTooltipForCell.apply(this,arguments)),t},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,t,n){if(null!=e.value&&"object"==typeof e.value){var a=e.value.cloneNode(!0);a.setAttribute("label",t),t=a}mxGraph.prototype.cellLabelChanged.apply(this,arguments)},Graph.prototype.setLinkForCell=function(e,t){var n=null;null!=e.value&&"object"==typeof e.value?n=e.value.cloneNode(!0):(n=mxUtils.createXmlDocument().createElement("UserObject")).setAttribute("label",e.value);null!=t&&0<t.length?n.setAttribute("link",t):n.removeAttribute("link"),this.model.setValue(e,n)},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,t){this.panningHandler.hideMenu()});var s=!1,o=null;this.updateMouseEvent=function(e){if(mxGraph.prototype.updateMouseEvent.apply(this,arguments),null==e.getState()){var t=this.getCellAt(e.graphX,e.graphY);this.getModel().isEdge(t)&&(e.state=this.view.getState(t),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,t,n){if(e==mxEvent.MOUSE_DOWN)this.panningHandler.isMenuShowing()?(s=!1,o=null):(o=t.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(t.getEvent()),i=mxEvent.getClientY(t.getEvent());this.panningHandler.popup(a+16,i,o,t.getEvent())}return s=!1,o=null,void t.consume()}s=!1,o=null}mxGraph.prototype.fireMouseEvent.apply(this,arguments),e==mxEvent.MOUSE_MOVE&&t.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 t=e.getEvent();return this.useLeftButtonForPanning&&(this.ignoreCell||null==e.getState())||mxEvent.isControlDown(t)&&mxEvent.isShiftDown(t)||this.usePopupTrigger&&mxEvent.isPopupTrigger(t)});var n=mxGraphHandler.prototype.mouseDown;mxGraphHandler.prototype.mouseDown=function(e,t){n.apply(this,arguments),this.graph.isCellSelected(t.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,t){touchStyle&&null!=t?this.graph.setSelectionCell(t):this.graph.setSelectionCell(e)};var a=mxGraph.prototype.dblClick;Graph.prototype.dblClick=function(e,t){if(null==t){var n=mxUtils.convertPoint(this.container,mxEvent.getClientX(e),mxEvent.getClientY(e));t=this.getCellAt(n.x,n.y)}a.call(this,e,t)};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 t=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(t),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 t=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(e),mxEvent.getClientY(e));this.graph.connectionHandler.start(this.state,t.x,t.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,t){o.apply(this,arguments),null!=this.connectorImg&&(this.connectorImg.parentNode.removeChild(this.connectorImg),this.connectorImg=null)},(new Image).src=t}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 t=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(e),mxEvent.getClientY(e));this.graph.connectionHandler.start(this.state,t.x,t.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,t){o.apply(this,arguments),null!=this.connectorImg&&(this.connectorImg.parentNode.removeChild(this.connectorImg),this.connectorImg=null)}}}}(),Actions.prototype.init=function(){var t=this.editorUi,l=t.editor,d=l.graph;this.addAction("new",function(){t.projectDesignController.newProject()},CRUD_PERMISSIONS.canEdit),this.addAction("open",function(){t.projectDesignController.openProject()},CRUD_PERMISSIONS.canEdit),this.addAction("save",function(){t.projectDesignController.saveOrPublishProject(mxUtils.getPrettyXml(l.getGraphXml())),t.editor.modified=!1},CRUD_PERMISSIONS.canEdit,null,"Ctrl+S"),this.addAction("saveAs",function(){t.projectDesignController.saveProjectAs(mxUtils.getPrettyXml(l.getGraphXml()))},CRUD_PERMISSIONS.canEdit,null,"Ctrl+Shift+S"),this.addAction("publish",function(){t.editor.setStatus(""),null===t.validate()?(t.projectDesignController.saveOrPublishProject(mxUtils.getPrettyXml(l.getGraphXml()),!0),t.editor.modified=!1):(t.editor.setStatus("...Error publishing! Please check the project and try again!"),setTimeout(function(){t.editor.setStatus("")},3e3))},CRUD_PERMISSIONS.canEdit,null,"Ctrl+Shift+P"),this.addAction("variable",function(){t.projectDesignController.newVariable()},CRUD_PERMISSIONS.canEdit),this.addAction("import",function(){t.projectDesignController.importXML(function(e){l.setGraphXml(mxUtils.parseXml(e).documentElement)})},CRUD_PERMISSIONS.canEdit),this.addAction("export",function(){t.exportXML(mxUtils.getPrettyXml(l.getGraphXml()))},null,null,"Ctrl+E"),this.addAction("editFile",function(){t.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(),t=d.getLinkForCell(e);null==t&&(t=""),null!=(t=mxUtils.prompt(mxResources.get("enterValue"),t))&&d.setLinkForCell(e,t)}),this.addAction("openLink",function(){var e=d.getSelectionCell(),t=d.getLinkForCell(e);null!=t&&window.open(t)}),this.addAction("autosize",function(){var e=d.getSelectionCells();if(null!=e){d.getModel().beginUpdate();try{for(var t=0;t<e.length;t++){var n=e[t];d.getModel().getChildCount(n)?d.updateGroupBounds([n],20):d.updateCellSize(n)}}finally{d.getModel().endUpdate()}}}),this.addAction("wordWrap",function(){var e=d.getView().getState(d.getSelectionCell()),t="wrap";null!=e&&"wrap"==e.style[mxConstants.STYLE_WHITE_SPACE]&&(t=null),d.setCellStyles(mxConstants.STYLE_WHITE_SPACE,t)}),this.addAction("rotation",function(){var e="0",t=d.getView().getState(d.getSelectionCell());null!=t&&(e=t.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 t=0;t<e.length;t++){var n=e[t];if(d.getModel().isVertex(n)&&0==d.getModel().getChildCount(n)){var a=d.getCellGeometry(n);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(n,a);var s=d.view.getState(n);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,[n])}}}}}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,t=d.pageScale,n=d.container.clientWidth-20,a=d.container.clientHeight-20,i=Math.floor(100*Math.min(n/e.width/t,a/e.height/t))/100;d.zoomTo(i),d.container.scrollLeft=Math.round(d.view.translate.x*i-Math.max(10,(d.container.clientWidth-e.width*t*i)/2)),d.container.scrollTop=Math.round(d.view.translate.y*i-Math.max(10,(d.container.clientHeight-e.height*t*i)/2))})),this.addAction("fitPageWidth",mxUtils.bind(this,function(){d.pageVisible||this.get("pageView").funct();var e=d.pageFormat,t=d.pageScale,n=d.container.clientWidth-20,a=Math.floor(100*n/e.width/t)/100;d.zoomTo(a),d.container.scrollLeft=Math.round(d.view.translate.x*a-Math.max(10,(d.container.clientWidth-e.width*t*a)/2)),d.container.scrollTop=Math.round(d.view.translate.y*a-Math.max(10,(d.container.clientHeight-e.height*t*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,t=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(t*d.view.scale)}else{var n=d.view.translate;d.view.setTranslate(n.x-d.container.scrollLeft/d.view.scale,n.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 n=mxUtils.bind(this,function(e,t){this.addAction(e,function(){d.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE,t)})});n("bold",mxConstants.FONT_BOLD),n("italic",mxConstants.FONT_ITALIC),n("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 t=d.getModel(),n=mxUtils.prompt(mxResources.get("enterValue")+" ("+mxResources.get("style")+")",t.getStyle(e[0])||"");null!=n&&d.setCellStyle(n,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 t=l.graph.selectionCellsHandler.getHandler(e);if(t instanceof mxEdgeHandler){var n=d.view.translate,a=d.view.scale,i=n.x,s=n.y,o=d.getModel().getParent(e),r=d.getCellGeometry(o);d.getModel().isVertex(o)&&null!=r&&(i+=r.x,s+=r.y),t.addPointAt(t.state,d.panningHandler.triggerX/a-i,d.panningHandler.triggerY/a-s)}}}),this.addAction("removeWaypoint",function(){var e=t.actions.get("removeWaypoint");null!=e.handler&&e.handler.removePoint(e.handler.state,e.index)}),this.addAction("image",function(){var e="",t=d.getView().getState(d.getSelectionCell());if(null!=t&&(e=t.style[mxConstants.STYLE_IMAGE]||e),null!=(e=mxUtils.prompt(mxResources.get("enterValue")+" ("+mxResources.get("url")+")",e))&&0<e.length){var n=new Image;n.onload=function(){!function(e,t,n){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,t,n)]}if(d.setCellStyles(mxConstants.STYLE_IMAGE,e,i),d.setCellStyles(mxConstants.STYLE_SHAPE,"image",i),1==d.getSelectionCount()&&null!=t&&null!=n){var o=i[0],r=d.getModel().getGeometry(o);null!=r&&((r=r.clone()).width=t,r.height=n,d.getModel().setGeometry(o,r))}}finally{d.getModel().endUpdate()}null!=a&&(d.setSelectionCells(a),d.scrollCellToVisible(a[0]))}(e,n.width,n.height)},n.onerror=function(){mxUtils.alert(mxResources.get("fileNotFound"))},n.src=e}})},Actions.prototype.addAction=function(e,t,n,a,i){return this.put(e,new Action(mxResources.get(e),t,n,a,i))},Actions.prototype.put=function(e,t){return this.actions[e]=t},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,t){for(var n=["Helvetica","Verdana","Times New Roman","Garamond","Comic Sans MS","Courier New","Georgia","Lucida Console","Tahoma"],a=0;a<n.length;a++){this.styleChange(e,n[a],[mxConstants.STYLE_FONTFAMILY],[n[a]],null,t).firstChild.nextSibling.style.fontFamily=n[a]}e.addSeparator(t),this.promptChange(e,mxResources.get("custom"),"",mxConstants.DEFAULT_FONTFAMILY,mxConstants.STYLE_FONTFAMILY,t)}))),this.put("fontSize",new Menu(mxUtils.bind(this,function(e,t){for(var n=[6,8,9,10,11,12,14,18,24,36,48,72],a=0;a<n.length;a++)this.styleChange(e,n[a],[mxConstants.STYLE_FONTSIZE],[n[a]],null,t);e.addSeparator(t),this.promptChange(e,mxResources.get("custom"),"(pt)","12",mxConstants.STYLE_FONTSIZE,t)}))),this.put("linewidth",new Menu(mxUtils.bind(this,function(e,t){for(var n=[1,2,3,4,8,12,16,24],a=0;a<n.length;a++)this.styleChange(e,n[a]+"px",[mxConstants.STYLE_STROKEWIDTH],[n[a]],null,t);e.addSeparator(t),this.promptChange(e,mxResources.get("custom"),"(px)","1",mxConstants.STYLE_STROKEWIDTH,t)}))),this.put("line",new Menu(mxUtils.bind(this,function(e,t){this.styleChange(e,mxResources.get("straight"),[mxConstants.STYLE_EDGE],[null],null,t),this.styleChange(e,mxResources.get("entityRelation"),[mxConstants.STYLE_EDGE],["entityRelationEdgeStyle"],null,t),e.addSeparator(t),this.styleChange(e,mxResources.get("horizontal"),[mxConstants.STYLE_EDGE,mxConstants.STYLE_ELBOW],["elbowEdgeStyle","horizontal"],null,t),this.styleChange(e,mxResources.get("vertical"),[mxConstants.STYLE_EDGE,mxConstants.STYLE_ELBOW],["elbowEdgeStyle","vertical"],null,t),e.addSeparator(t),this.styleChange(e,mxResources.get("manual"),[mxConstants.STYLE_EDGE],["segmentEdgeStyle"],null,t),this.styleChange(e,mxResources.get("automatic"),[mxConstants.STYLE_EDGE],["orthogonalEdgeStyle"],null,t)}))),this.put("lineend",new Menu(mxUtils.bind(this,function(e,t){this.styleChange(e,mxResources.get("classic"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_CLASSIC],null,t),this.styleChange(e,mxResources.get("openArrow"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_OPEN],null,t),this.styleChange(e,mxResources.get("block"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_BLOCK],null,t),e.addSeparator(t),this.styleChange(e,mxResources.get("oval"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_OVAL],null,t),this.styleChange(e,mxResources.get("diamond"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_DIAMOND],null,t),this.styleChange(e,mxResources.get("diamondThin"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_DIAMOND_THIN],null,t),e.addSeparator(t),this.styleChange(e,mxResources.get("none"),[mxConstants.STYLE_ENDARROW],[mxConstants.NONE],null,t),e.addSeparator(t),e.addItem(mxResources.get("transparent"),null,function(){i.toggleCellStyles("endFill",!0)},t,null,!0),e.addSeparator(t),this.promptChange(e,mxResources.get("size"),"(px)",mxConstants.DEFAULT_MARKERSIZE,mxConstants.STYLE_ENDSIZE,t)}))),this.put("linestart",new Menu(mxUtils.bind(this,function(e,t){this.styleChange(e,mxResources.get("classic"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_CLASSIC],null,t),this.styleChange(e,mxResources.get("openArrow"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_OPEN],null,t),this.styleChange(e,mxResources.get("block"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_BLOCK],null,t),e.addSeparator(t),this.styleChange(e,mxResources.get("oval"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_OVAL],null,t),this.styleChange(e,mxResources.get("diamond"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_DIAMOND],null,t),this.styleChange(e,mxResources.get("diamondThin"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_DIAMOND_THIN],null,t),e.addSeparator(t),this.styleChange(e,mxResources.get("none"),[mxConstants.STYLE_STARTARROW],[mxConstants.NONE],null,t),e.addSeparator(t),e.addItem(mxResources.get("transparent"),null,function(){i.toggleCellStyles("startFill",!0)},t,null,!0),e.addSeparator(t),this.promptChange(e,mxResources.get("size"),"(px)",mxConstants.DEFAULT_MARKERSIZE,mxConstants.STYLE_STARTSIZE,t)}))),this.put("spacing",new Menu(mxUtils.bind(this,function(e,t){var n=this.editorUi.actions.get("shadow").enabled,a=this.get("line").enabled;(n||e.showDisabled)&&(this.promptChange(e,mxResources.get("top"),"(px)","0",mxConstants.STYLE_SPACING_TOP,t,n),this.promptChange(e,mxResources.get("right"),"(px)","0",mxConstants.STYLE_SPACING_RIGHT,t,n),this.promptChange(e,mxResources.get("bottom"),"(px)","0",mxConstants.STYLE_SPACING_BOTTOM,t,n),this.promptChange(e,mxResources.get("left"),"(px)","0",mxConstants.STYLE_SPACING_LEFT,t,n),e.addSeparator(t),this.promptChange(e,mxResources.get("global"),"(px)","0",mxConstants.STYLE_SPACING,t,n),this.promptChange(e,mxResources.get("perimeter"),"(px)","0",mxConstants.STYLE_PERIMETER_SPACING,t,n)),(a||e.showDisabled)&&(e.addSeparator(t),this.promptChange(e,mxResources.get("sourceSpacing"),"(px)","0",mxConstants.STYLE_SOURCE_PERIMETER_SPACING,t,a),this.promptChange(e,mxResources.get("targetSpacing"),"(px)","0",mxConstants.STYLE_TARGET_PERIMETER_SPACING,t,a))}))),this.put("format",new Menu(mxUtils.bind(this,function(e,t){this.addMenuItem(e,"style",t)}))),this.put("text",new Menu(mxUtils.bind(this,function(e,t){var n=this.get("text").enabled;e.addSeparator(t),this.addSubmenu("fontFamily",e,t),this.addSubmenu("fontSize",e,t),this.addMenuItems(e,["-","bold","italic","underline","-"],t),this.addSubmenu("alignment",e,t),this.addMenuItem(e,"wordWrap",t),e.addSeparator(t),this.promptChange(e,mxResources.get("textOpacity"),"(%)","100",mxConstants.STYLE_TEXT_OPACITY,t,n),e.addItem(mxResources.get("hide"),null,function(){i.toggleCellStyles(mxConstants.STYLE_NOLABEL,!1)},t,null,n)}))),this.put("alignment",new Menu(mxUtils.bind(this,function(e,t){this.styleChange(e,mxResources.get("leftAlign"),[mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_LEFT],null,t),this.styleChange(e,mxResources.get("center"),[mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_CENTER],null,t),this.styleChange(e,mxResources.get("rightAlign"),[mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_RIGHT],null,t),e.addSeparator(t),this.styleChange(e,mxResources.get("topAlign"),[mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_TOP],null,t),this.styleChange(e,mxResources.get("middle"),[mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_MIDDLE],null,t),this.styleChange(e,mxResources.get("bottomAlign"),[mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_BOTTOM],null,t),e.addSeparator(t),this.addSubmenu("position",e,t),this.addSubmenu("spacing",e,t),e.addSeparator(t);var n=this.get("text").enabled;e.addItem(mxResources.get("vertical"),null,function(){i.toggleCellStyles(mxConstants.STYLE_HORIZONTAL,!0)},t,null,n)}))),this.put("position",new Menu(mxUtils.bind(this,function(e,t){this.styleChange(e,mxResources.get("left"),[mxConstants.STYLE_LABEL_POSITION,mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_LEFT,mxConstants.ALIGN_RIGHT],null,t),this.styleChange(e,mxResources.get("center"),[mxConstants.STYLE_LABEL_POSITION,mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_CENTER,mxConstants.ALIGN_CENTER],null,t),this.styleChange(e,mxResources.get("right"),[mxConstants.STYLE_LABEL_POSITION,mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_RIGHT,mxConstants.ALIGN_LEFT],null,t),e.addSeparator(t),this.styleChange(e,mxResources.get("top"),[mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_TOP,mxConstants.ALIGN_BOTTOM],null,t),this.styleChange(e,mxResources.get("middle"),[mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_MIDDLE,mxConstants.ALIGN_MIDDLE],null,t),this.styleChange(e,mxResources.get("bottom"),[mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_BOTTOM,mxConstants.ALIGN_TOP],null,t)}))),this.put("direction",new Menu(mxUtils.bind(this,function(e,t){e.addItem(mxResources.get("flipH"),null,function(){i.toggleCellStyles(mxConstants.STYLE_FLIPH,!1)},t),e.addItem(mxResources.get("flipV"),null,function(){i.toggleCellStyles(mxConstants.STYLE_FLIPV,!1)},t),this.addMenuItems(e,["-","tilt","rotation"],t)}))),this.put("align",new Menu(mxUtils.bind(this,function(e,t){e.addItem(mxResources.get("leftAlign"),null,function(){i.alignCells(mxConstants.ALIGN_LEFT)},t),e.addItem(mxResources.get("center"),null,function(){i.alignCells(mxConstants.ALIGN_CENTER)},t),e.addItem(mxResources.get("rightAlign"),null,function(){i.alignCells(mxConstants.ALIGN_RIGHT)},t),e.addSeparator(t),e.addItem(mxResources.get("topAlign"),null,function(){i.alignCells(mxConstants.ALIGN_TOP)},t),e.addItem(mxResources.get("middle"),null,function(){i.alignCells(mxConstants.ALIGN_MIDDLE)},t),e.addItem(mxResources.get("bottomAlign"),null,function(){i.alignCells(mxConstants.ALIGN_BOTTOM)},t)}))),this.put("layout",new Menu(mxUtils.bind(this,function(e,t){e.addItem(mxResources.get("horizontalFlow"),null,mxUtils.bind(this,function(){var e=new mxHierarchicalLayout(i,mxConstants.DIRECTION_WEST);this.editorUi.executeLayout(e,!0,!0)}),t),e.addItem(mxResources.get("verticalFlow"),null,mxUtils.bind(this,function(){var e=new mxHierarchicalLayout(i,mxConstants.DIRECTION_NORTH);this.editorUi.executeLayout(e,!0,!0)}),t)}))),this.put("navigation",new Menu(mxUtils.bind(this,function(e,t){this.addMenuItems(e,["home","-","exitGroup","enterGroup","-","expand","collapse"],t)}))),this.put("arrange",new Menu(mxUtils.bind(this,function(e,t){this.addMenuItems(e,["toFront","toBack","-"],t),this.addSubmenu("layout",e,t),e.addSeparator(t),this.addMenuItems(e,["-","group","ungroup","removeFromGroup"],t)}))),this.put("view",new Menu(mxUtils.bind(this,function(t,n){this.addMenuItems(t,["actualSize"],n),t.addSeparator();for(var e=[.25,.5,.75,1,2,4],a=0;a<e.length;a++)!function(e){t.addItem(100*e+"%",null,function(){i.zoomTo(e)},n)}(e[a]);this.addMenuItems(t,["-","zoomIn","zoomOut","-","fitWindow","customZoom","-","fitPage","fitPageWidth"],n)}))),this.put("file",new Menu(mxUtils.bind(this,function(e,t){this.addMenuItems(e,["new","open","-","save","saveAs","publish","-","variable","-","import","export","-","editFile","description","-","print"],t)}))),this.put("edit",new Menu(mxUtils.bind(this,function(e,t){this.addMenuItems(e,["undo","redo","-","cut","copy","paste","delete","-","duplicate","-","selectVertices","selectEdges","selectAll"])}))),this.put("help",new Menu(mxUtils.bind(this,function(e,t){this.addMenuItems(e,["help","-","about"])})))},Menus.prototype.put=function(e,t){this.menus[e]=t},Menus.prototype.get=function(e){return this.menus[e]},Menus.prototype.addSubmenu=function(e,t,n){var a=this.get(e).enabled;if(t.showDisabled||a){var i=t.addItem(mxResources.get(e),null,null,n,null,a);this.addMenu(e,t,i)}},Menus.prototype.addMenu=function(e,t,n){var a=this.get(e);null!=a&&(t.showDisabled||a.enabled)&&this.get(e).execute(t,n)},Menus.prototype.styleChange=function(e,t,n,a,i,s){return e.addItem(t,null,mxUtils.bind(this,function(){var e=this.editorUi.editor.graph;e.getModel().beginUpdate();try{for(var t=0;t<n.length;t++)e.setCellStyles(n[t],a[t])}finally{e.getModel().endUpdate()}}),s,i)},Menus.prototype.promptChange=function(e,t,a,i,s,n,o){return e.addItem(t,null,mxUtils.bind(this,function(){var e=this.editorUi.editor.graph,t=i,n=e.getView().getState(e.getSelectionCell());null!=n&&(t=n.style[s]||t),null!=(t=mxUtils.prompt(mxResources.get("enterValue")+(0<a.length?" "+a:""),t))&&0<t.length&&e.setCellStyles(s,t)}),n,null,o)},Menus.prototype.addMenuItem=function(e,t,n){var a=this.editorUi.actions.get(t);if(null==a||!e.showDisabled&&!a.enabled)return null;var i=e.addItem(a.label,null,a.funct,n,null,a.enabled);return a.toggleAction&&a.isSelected()&&this.addCheckmark(i),this.addShortcut(i,a),i},Menus.prototype.addShortcut=function(e,t){if(null!=t.shortcut){var n=e.firstChild.nextSibling.nextSibling,a=document.createElement("span");a.style.color="gray",mxUtils.write(a,t.shortcut),n.appendChild(a)}},Menus.prototype.addCheckmark=function(e){var t=e.firstChild.nextSibling;t.style.backgroundImage="url("+IMAGE_PATH+"/checkmark.gif)",t.style.backgroundRepeat="no-repeat",t.style.backgroundPosition="2px 50%"},Menus.prototype.addMenuItems=function(e,t,n){for(var a=0;a<t.length;a++)"-"==t[a]?e.addSeparator(n):this.addMenuItem(e,t[a],n)},Menus.prototype.createPopupMenu=function(e,t,n){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!=(t=a.getSelectionCell())&&a.getModel().isEdge(t)){var s=a.selectionCellsHandler.getHandler(t);if(s instanceof mxEdgeHandler&&null!=s.bends&&2<s.bends.length){var o=s.getHandleForEvent(new mxMouseEvent(n)),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 t=new Menubar(this.editorUi,e),n=[];n=CRUD_PERMISSIONS.canEdit?["file","edit","view","format","text","arrange","help"]:["file","view","help"];for(var a=0;a<n.length;a++)t.addMenu(mxResources.get(n[a]),this.get(n[a]).funct);return t},Menubar.prototype.hideMenu=function(){null!=this.currentMenu&&this.currentMenu.hideMenu()},Menubar.prototype.addMenu=function(e,t){var n=document.createElement("a");return n.setAttribute("href","javascript:void(0);"),n.className="geItem",mxUtils.write(n,e),this.addMenuHandler(n,t),this.container.appendChild(n),n},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,t=mxUtils.bind(this,function(e){if(o&&null==i.enabled||i.enabled){this.editorUi.editor.graph.panningHandler.hideMenu();var t=new mxPopupMenu(s);t.div.className+=" geMenubarMenu",t.smartSeparators=!0,t.showDisabled=!0,t.autoExpand=!0,t.hideMenu=mxUtils.bind(this,function(){mxPopupMenu.prototype.hideMenu.apply(t,arguments),t.destroy(),this.currentMenu=null,this.currentElt=null});var n=this.getOffset(i).left,a=this.getOffset(i).top+i.offsetHeight;t.popup(n,a,null,e),this.currentMenu=t,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(),t(e))})),mxEvent.addListener(i,"mousedown",mxUtils.bind(this,function(){o=this.currentElt!=i})),mxEvent.addListener(i,"click",t)}},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,t){this.funct(e,t)},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,t,n,a){var i=this.editorUi.menus.get(a),s=this.addMenuFunction(e,t,n,i.funct);return i.addListener("stateChanged",function(){s.setEnabled(i.enabled)}),s},Toolbar.prototype.addMenuFunction=function(e,t,n,a){var i=n?this.createLabel(e):this.createButton(e);return this.initElement(i,t),this.addMenuHandler(i,n,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 t=0;t<e.length;t++){var n=e[t];"-"==n?this.addSeparator():this.addItem("geSprite-"+n.toLowerCase(),n)}},Toolbar.prototype.addItem=function(e,t){var n=this.editorUi.actions.get(t),a=null;return null!=n&&((a=this.addButton(e,n.label,n.funct)).setEnabled(n.enabled),n.addListener("stateChanged",function(){a.setEnabled(n.enabled)})),a},Toolbar.prototype.addButton=function(e,t,n){var a=this.createButton(e);return this.initElement(a,t),this.addClickHandler(a,n),this.container.appendChild(a),a},Toolbar.prototype.addSelectionHandler=function(n){var a=this.editorUi.editor.graph,e=function(){for(var e=!a.isSelectionEmpty(),t=0;t<n.length;t++)n[t].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 t=i.getSelectionCells(),n=0;n<t.length;n++)if(i.getModel().isEdge(t[n])){e=!0;break}for(n=0;n<a.length;n++)a[n].setEnabled(e)};i.getSelectionModel().addListener(mxEvent.CHANGE,e),e()},Toolbar.prototype.initElement=function(e,t){e.setAttribute("tabindex","0"),null!=t&&e.setAttribute("title",t),this.addEnabledState(e)},Toolbar.prototype.addEnabledState=function(t){var n=t.className;t.setEnabled=function(e){t.enabled=e,t.className=e?n:n+" geDisabled"},t.setEnabled(!0)},Toolbar.prototype.addClickHandler=function(t,n){null!=n&&mxEvent.addListener(t,"click",function(e){t.enabled&&n(e),mxEvent.consume(e)})},Toolbar.prototype.createButton=function(e){var t=document.createElement("a");t.setAttribute("href","javascript:void(0);"),t.className="geButton";var n=document.createElement("div");return n.className="geSprite "+e,t.appendChild(n),t},Toolbar.prototype.createLabel=function(e,t){var n=document.createElement("a");return n.setAttribute("href","javascript:void(0);"),n.className="geLabel",mxUtils.write(n,e),n},Toolbar.prototype.addMenuHandler=function(t,n,a,i){if(null!=a){var s=this.editorUi.editor.graph,o=null;mxEvent.addListener(t,"click",mxUtils.bind(this,function(e){(null==t.enabled||t.enabled)&&(s.panningHandler.hideMenu(),(o=new mxPopupMenu(a)).div.className+=" geToolbarMenu",o.showDisabled=i,o.labels=n,o.autoExpand=!0,o.popup(t.offsetLeft,t.offsetTop+t.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/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()">{{target}}</span>\n\n    <md-menu ng-if="showMenu()">\n        <a aria-label="Target" ng-click="$mdOpenMenu($event)">\n            <span ng-if="prefix">{{prefix}}-</span>{{target}}\n        </a>\n\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}} ({{prefix ? prefix + \'-\' + target : target}})\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}} ({{prefix ? prefix + \'-\' + target : target}})\n                </md-button>\n            </md-menu-item>\n        </md-menu-content>\n    </md-menu>\n</section>\n\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\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\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}} ({{prefix ? prefix + \'-\' + target : target}})\n                </md-button>\n            </md-menu-item>\n            <md-menu-item>\n                <md-button ng-click="transfer(target)">\n'+"                    {{'DASHBOARDS.TRANSFER_NUMBER' | translate}} ({{prefix ? prefix + '-' + target : target}})\n                </md-button>\n            </md-menu-item>\n        </md-menu-content>\n    </md-menu>\n</section>"),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="{{options.labelSearch || \'Search...\'}}">\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="options.readOnly ? \'read-only-mode\' : \'\'" ng-disabled="options.readOnly" ng-repeat="item in options.items | filter: query | orderBy: options.orderBy" ng-click="canTransfer(item, options, false)">\n                    <div class="md-list-item-text" layout="column">\n                        <h3 ng-if="options.line1">{{getLine(item, options.line1)}}</h3>\n                        <h4 ng-if="options.line2">{{getLine(item, options.line2)}}</h4>\n                        <p ng-if="options.line3">{{getLine(item, options.line3)}}</p>\n                        <p class="ms-dual-multiselect-line-xs" ng-if="options.line4">{{getLine(item, options.line4)}}\n                        </p>\n                    </div>\n                    <md-icon ng-show="!options.readOnly" md-font-icon="icon-arrow-right-bold" aria-label="swap"></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>{{options.labelAll || \'All Items\'}} ({{options.items.length}})</span>\n            <md-icon ng-show="options.showSelectAndDeselectAll && !options.readOnly" md-font-icon="icon-chevron-double-right" aria-label="swap" ng-click="transfer(options.items, 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="{{options.labelSearch || \'Search...\'}}">\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="options.readOnly || !item.isValid ? \'read-only-mode\' : \'\'" ng-disabled="options.readOnly" ng-repeat="item in options.selectedItems | filter: selectedQuery | orderBy: options.orderBy" ng-click="canTransfer(item, options, true)">\n                    <md-icon ng-class="options.readOnly || !item.isValid ? \'hidden\' : \'\'" 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="options.line1">{{getLine(item, options.line1)}}</h3>\n                        <h4 ng-if="options.line2">{{getLine(item, options.line2)}}</h4>\n                        <p ng-if="options.line3">{{getLine(item, options.line3)}}</p>\n                        <p class="ms-dual-multiselect-line-xs" ng-if="options.line4">{{getLine(item, 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-show="options.showSelectAndDeselectAll && !options.readOnly" md-font-icon="icon-chevron-double-left" aria-label="swap" flex ng-click="transfer(options.selectedItems, options.items, -1, true)"></md-icon>\n            <span class="h4">{{options.labelSelected || \'Selected Items\'}} ({{options.selectedItems.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" ms-scroll>\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 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\x3c!-- Input 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\')" 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\')" 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 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\')" ng-disabled="!vm_pb.registered">\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" interval="1000">{{ days > 0 ? days + \'d\' : \'\' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                </span>\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" />\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!-- 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\x3c!-- Input Area --\x3e\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 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">{{ (session.user == session.name) ? session.user : (session.name + \' \' + session.user) }}</span>\n            <span class="session-info" layout="row" layout="start center">\n                <timer interval="1000">{{hhours}}:{{mminutes}}:{{sseconds}}</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="Hold" 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"></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="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>\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" 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 tranlsate="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" ms-scroll>\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-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                            <div layout="row" layout-align="space-between center">\n                                <md-switch 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-search-bar/ms-search-bar.html",'<div flex layout="row" layout-align="start center">\n    <label for="ms-search-bar-input">\n        <md-button class="ms-search-bar-expander md-icon-button" aria-label="Expand Search Bar" ng-click="MsSearchBar.expand()" ng-if="!MsSearchBar.resultsLoading || MsSearchBar.collapsed">\n            <md-icon md-font-icon="icon-magnify" class="icon s24"></md-icon>\n        </md-button>\n        <div class="ms-search-bar-loader" layout="row" layout-align="center center" ng-if="MsSearchBar.resultsLoading && !MsSearchBar.collapsed">\n            <md-progress-circular class="md-accent" md-diameter="32" md-mode="indeterminate"></md-progress-circular>\n        </div>\n    </label>\n    <input id="ms-search-bar-input" type="text" placeholder="Search" flex ng-model="MsSearchBar.query" ng-model-options="MsSearchBar.queryOptions" ng-blur="MsSearchBar.blurCollapse()" ng-keydown="MsSearchBar.handleKeydown($event)">\n    <md-button class="ms-search-bar-collapser md-icon-button" ng-click="MsSearchBar.collapse()" aria-label="Collapse Search Bar">\n        <md-icon md-font-icon="icon-close" class="icon s24"></md-icon>\n    </md-button>\n\n    <div class="ms-search-bar-results" ng-if="MsSearchBar.results" ms-scroll>\n        <div class="no-results" ng-if="MsSearchBar.results.length === 0">No Results!</div>\n\n        <div class="result" ng-repeat="result in MsSearchBar.results" ng-click="MsSearchBar.handleResultClick(result)" ng-mouseenter="MsSearchBar.handleMouseenter($index)" ng-mousedown="MsSearchBar.absorbEvent($event)" ng-class="{\'selected\': $index == MsSearchBar.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" ms-scroll 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" ms-scroll>\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">\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-32" layout="column" layout-align="center center" layout-fill ng-controller="MsWidgetEngineCounterController as vm">\n    <div ng-class="\'font-size-\' + (vm.fontSize * 3)" 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.\' + widget.attrs[0].value | 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}" class="text-truncate" flex>\n                            {{ widget.title || \'No Title\' }}\n                        </a>\n                        <md-button ng-if="!vm.config.preview" 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>\n                                    <md-button ng-click="vm.onEdit({widget: widget})" translate="TOOLS.EDIT_WIDGET">Edit</md-button>\n                                </md-menu-item>\n                                <md-menu-item>\n                                    <md-button ng-click="vm.onDelete({widget: widget})" translate="TOOLS.DELETE_WIDGET">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 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="animate-slide-up 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="animate-slide-up 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" ms-scroll 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="animate-slide-up md-hue-2" ms-scroll 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" ms-scroll 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" ms-scroll ui-view="navigation"></md-sidenav>\n\n        <div id="content-container" flex layout="column">\n            <md-content id="content" class="animate-slide-up md-hue-2" ms-scroll 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" ms-scroll 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" ms-scroll ui-view="navigation"></md-sidenav>\n\n        <div id="content-container" flex layout="column">\n            <md-content id="content" class="animate-slide-up md-hue-2" ms-scroll 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" ms-scroll 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" ms-scroll 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="animate-slide-up md-hue-2" ms-scroll 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" ms-scroll 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" ms-scroll 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" ms-scroll>\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 class="separator">\n                <span class="text" translate="LOGIN.OR">OR</span>\n            </div>\n\n            <md-button 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="icon-google-plus" class="s16"></md-icon>\n                        <span translate="LOGIN.WITH_GOOGLE">Log in with Google</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 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="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 animate-slide-down 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="EXTRACTEDREPORTS.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="EXTRACTEDREPORTS.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!-- 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                                <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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editdialog(extractedReport, $event)" translate="ANALYTICS.EDIT_EXTRACTEDREPORT">\n                                                    Edit ExtractedReport\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.downloadfile2(extractedReport, $event)" translate="ANALYTICS.DOWNLOAD_EXTRACTEDREPORT">\n                                                    Download ExtractedReport\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(extractedReport, $event)" translate="ANALYTICS.DELETE_EXTRACTEDREPORT">\n                                                    Delete ExtractedReport\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.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 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="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="\'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="\'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="\'report_integration\'">Integration Report</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="\'report_queue\'">Queue Report</md-option>\n                    <md-option ng-value="\'users\'">Users</md-option>\n                    <md-option ng-value="\'voice_recordings\'">Voice Recordings</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 animate-slide-down 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="METRICS.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="METRICS.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!-- 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                                <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="ANALYTICS.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.editdialog(metric, $event)" translate="ANALYTICS.EDIT_METRIC">\n                                                    Edit Metric\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(metric, $event)" translate="ANALYTICS.DELETE_METRIC">\n                                                    Delete Metric\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.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 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="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 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="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 track by $index">\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 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="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">\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 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                <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 animate-slide-down 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" ms-scroll>\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" ms-scroll>\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.query.filter = 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 tranlsate="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 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="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.startDate">\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.endDate">\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.PREVIEW_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 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="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 animate-slide-down 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="ODBC.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="ODBC.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!-- 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                                <td md-cell class="actions">\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.editdialog(odbc, $event)" translate="CALLYSQUARE.EDIT_ODBC">\n                                                    Edit Odbc\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.testtestOdbc(odbc, $event)" translate="CALLYSQUARE.TEST_ODBC">\n                                                    Test Odbc\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(odbc, $event)" translate="CALLYSQUARE.DELETE_ODBC">\n                                                    Delete Odbc\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.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 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="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 ms-scroll>\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_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" 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-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" 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" 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                \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></span>\n                <md-button class="md-icon-button" ng-click="vm.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 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>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></span>\n                <md-button class="md-icon-button" ng-click="vm.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 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                    </div>\n                    <md-button class="md-icon-button">\n                        <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></span>\n                <md-button class="md-icon-button" ng-click="vm.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 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="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></span>\n                <md-button class="md-icon-button" ng-click="vm.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 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="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/permissionadd/permissionadd.html",'<md-dialog class="projects-dialog" aria-label="projects">\n    <form name="projectsForm" ng-cloak>\n        <md-toolbar>\n            <div class="md-toolbar-tools">\n                <h2 translate="CALLYSQUARE.PERMISSIONADD_PROJECTS">Add User Permissions</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"></ms-dual-multiselect>\n        </md-dialog-content>\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></span>\n                <md-button class="md-icon-button" ng-click="vm.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 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="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 animate-slide-down 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" ms-scroll>\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">{{ \'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 tranlsate="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 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="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 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="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 animate-slide-down 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="SQUARERECORDINGS.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="SQUARERECORDINGS.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!-- 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 md-order-by="audio">{{ \'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 ">\n                                    \x3c!-- audio recording directive --\x3e\n                                    <ms-recording id="squareRecording.id" model="\'squareRecording\'"></ms-recording>\n                                    \x3c!-- / audio recording directive --\x3e\n                                </td>\n                                <td ng-click="vm.createOrEditSquareRecording($event, squareRecording)" md-cell class="createdAt ">{{squareRecording.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="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>\n                                                <md-button ng-click="vm.downloadfile2(squareRecording, $event)" translate="CALLYSQUARE.DOWNLOAD_SQUARERECORDING">\n                                                    Download SquareRecording\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(squareRecording, $event)" translate="CALLYSQUARE.DELETE_SQUARERECORDING">\n                                                    Delete SquareRecording\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.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 animate-slide-down 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="CHATQUEUES.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="CHATQUEUES.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!-- 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                                <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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(chatQueue, $event)" translate="CHAT.EDIT_CHATQUEUE">\n                                                    Edit ChatQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.teamadddialog(chatQueue, $event)" translate="CHAT.TEAMADD_CHATQUEUE">\n                                                    teamadd ChatQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.agentadddialog(chatQueue, $event)" translate="CHAT.AGENTADD_CHATQUEUE">\n                                                    agentadd ChatQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(chatQueue, $event)" translate="CHAT.DELETE_CHATQUEUE">\n                                                    Delete ChatQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.gotorealtimegoto(chatQueue, $event)" translate="CHAT.GOTOREALTIME_CHATQUEUE">\n                                                    goToRealtime ChatQueue\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: \'{{\'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 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="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" 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"></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"></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" 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 animate-slide-down 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="CHATWEBSITES.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="CHATWEBSITES.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!-- 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                                <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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(chatWebsite, $event)" translate="CHAT.EDIT_CHATWEBSITE">\n                                                    Edit ChatWebsite\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.interactionsgoto(chatWebsite, $event)" translate="CHAT.INTERACTIONS_CHATWEBSITE">\n                                                    Interactions ChatWebsite\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.offlinemessagesgoto(chatWebsite, $event)" translate="CHAT.OFFLINEMESSAGES_CHATWEBSITE">\n                                                    OfflineMessages ChatWebsite\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.agentadddialog(chatWebsite, $event)" translate="CHAT.AGENTADD_CHATWEBSITE">\n                                                    AgentAdd ChatWebsite\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(chatWebsite, $event)" translate="CHAT.DELETE_CHATWEBSITE">\n                                                    Delete ChatWebsite\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: \'{{\'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 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="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" 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"></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 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="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" 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 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="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 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="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="1">One Time</md-option>\n                    <md-option ng-value="0">Always</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" md-maxlength="255" 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 ng-message="md-maxlength">\n                        <span translate="CHAT.ERRORS.TEXT_MAX_LENGTH" translate-values=\'{max: 255}\'>Text 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/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 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="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 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="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/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 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="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 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="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="inboundroute-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 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\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 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="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 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="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" 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 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="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 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="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/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 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="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/chatDispositions/dialog.html",'<md-dialog class="chatDisposition-dialog" aria-label="New ChatDisposition">\n    <form name="chatDispositionForm" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="CHAT.NAME">Name</label>\n                <input type="" name="name" ng-model="vm.chatDisposition.name" md-maxlength="255" ng-required="true" autofocus>\n\n                <div ng-messages="chatDispositionForm[\'name\'].$error" ng-show="chatDispositionForm[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.newChatDisposition" ng-click="vm.saveChatDisposition()" class="send-button md-accent md-raised" ng-disabled="chatDispositionForm.$invalid || chatDispositionForm.$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.newChatDisposition" ng-click="vm.addNewChatDisposition()" class="send-button md-accent md-raised" ng-disabled="chatDispositionForm.$invalid" aria-label="ADD" translate="CHAT.ADD_CHATDISPOSITION" translate-attr-aria-label="CHAT.ADD_CHATDISPOSITION">\n                    ADD CHATDISPOSITION\n                </md-button>\n            </div>\n            <div layout="row">\n                <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newChatDisposition" ng-click="vm.deleteChatDisposition($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>{{vm.message.body}}</pre>\n    </md-content>\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 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="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) || (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" 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                            <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, 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" 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" 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                        <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                            <form name="scriptForm" flex="100" novalidate>\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                            </form>\n                        </div>\n\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">\n                                    < <div class="hint"><span translate="CHAT.HELP.TIMEZONE"></span>\n                    </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.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" 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                    </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 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\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.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="interactionForm[\'noteTitle\'].$error" ng-show="interactionForm[\'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                    <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.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\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                                        \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">\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\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)">\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                            <div flex></div>\n                            <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="CHATWEBSITES.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.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">{{ \'CHAT.ID\' | translate }}</th>\n                                    <th md-column md-order-by="name">{{ \'CHAT.NAME\' | translate }}</th>\n                                    <th md-column md-order-by="type">{{ \'CHAT.TYPE\' | translate }}</th>\n                                    <th md-column md-order-by="selector">{{ \'CHAT.SELECTOR\' | translate }}</th>\n                                    <th md-column md-order-by="timeout">{{ \'CHAT.TIMEOUT\' | translate }}</th>\n                                    <th md-column md-order-by="createdAt">{{ \'CHAT.CREATED_AT\' | translate }}</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>{{chatProactiveAction.id}}</td>\n                                    <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>{{chatProactiveAction.name}}</td>\n                                    <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>{{ \'CHAT.\' + vm_dc.arraytype[chatProactiveAction.type].option | uppercase | translate }}</td>\n                                    <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>{{chatProactiveAction.selector}}</td>\n                                    <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>{{chatProactiveAction.timeout}}</td>\n                                    <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>{{chatProactiveAction.createdAt | date:\'medium\'}}</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                                        <span class="text-boxed-ligth" translate="CHAT.NO_CHATPROACTIVEACTION_AVAILABLE">No chatproactiveaction available</span>\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 class="chatWebsite-detail-form-container chatdispositions md-background-bg md-whiteframe-1dp">\n                <div ng-controller="ChatWebsiteChatDispositionsController as vm_dc" ng-init="vm_dc.init(vm.chatWebsite, vm.crudPermissions)">\n                    <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedChatWebsiteChatDispositions.length">\n                        <div class="md-toolbar-tools">\n                            <span class="md-subhead" translate="CHAT.CHATDISPOSITIONS">ChatDispositions</span>\n                            <div flex></div>\n                            <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\n                            <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditChatWebsiteChatDisposition($event)" aria-label="add chatDisposition" translate translate-attr-label="CHAT.ADD_CHATDISPOSITION">\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.selectedChatWebsiteChatDispositions.length">\n                        <div class="md-toolbar-tools">\n                            <span class="md-subhead">{{vm_dc.selectedChatWebsiteChatDispositions.length}} {{vm_dc.selectedChatWebsiteChatDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                            <div flex></div>\n                            <button class="md-icon-button" ng-csv="vm_dc.exportSelectedChatWebsiteChatDispositions" 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.deleteSelectedChatWebsiteChatDispositions($event)" aria-label="delete selected" translate translate-attr-label="CHATWEBSITES.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.selectedChatWebsiteChatDispositions" md-progress="vm_dc.promise">\n                            <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getChatWebsiteChatDispositions">\n                                <tr md-row>\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="createdAt">{{ \'CHAT.CREATED_AT\' | translate }}</th>\n                                    <th md-column width="10px"></th>\n                                </tr>\n                            </thead>\n                            <tbody md-body>\n                                <tr md-row md-select="chatDisposition" md-select-id="id" ng-repeat="chatDisposition in vm_dc.chatWebsiteChatDispositions.rows">\n                                    <td ng-click="vm_dc.createOrEditChatWebsiteChatDisposition($event, chatDisposition)" md-cell>{{chatDisposition.id}}</td>\n                                    <td ng-click="vm_dc.createOrEditChatWebsiteChatDisposition($event, chatDisposition)" md-cell>{{chatDisposition.name}}</td>\n                                    <td ng-click="vm_dc.createOrEditChatWebsiteChatDisposition($event, chatDisposition)" md-cell>{{chatDisposition.createdAt | date:\'medium\'}}</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.createOrEditChatWebsiteChatDisposition($event, chatDisposition)" translate="CHAT.EDIT_CHATDISPOSITION">\n                                                        Edit ChatDisposition\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(chatDisposition, $event)" translate="CHAT.DELETE_CHATDISPOSITION">\n                                                        Delete ChatDisposition\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.chatWebsiteChatDispositions.rows.length">\n                                    <td md-cell colspan="5">\n                                        <span class="text-boxed-ligth" translate="CHAT.NO_CHATDISPOSITION_AVAILABLE">No chatdisposition available</span>\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.chatWebsiteChatDispositions.count}}" md-on-paginate="vm_dc.getChatWebsiteChatDispositions" 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.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)">\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                            <div flex></div>\n                            <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="CHATWEBSITES.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.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">{{ \'CHAT.ID\' | translate }}</th>\n                                    <th md-column md-order-by="key">{{ \'CHAT.KEY\' | translate }}</th>\n                                    <th md-column md-order-by="value">{{ \'CHAT.VALUE\' | translate }}</th>\n                                    <th md-column md-order-by="description">{{ \'CHAT.DESCRIPTION\' | translate }}</th>\n                                    <th md-column md-order-by="createdAt">{{ \'CHAT.CREATED_AT\' | translate }}</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>{{chatCannedAnswer.id}}</td>\n                                    <td ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" md-cell>{{chatCannedAnswer.key}}</td>\n                                    <td ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" md-cell>{{chatCannedAnswer.value}}</td>\n                                    <td ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" md-cell>{{chatCannedAnswer.description}}</td>\n                                    <td ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" md-cell>{{chatCannedAnswer.createdAt | date:\'medium\'}}</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                                        <span class="text-boxed-ligth" translate="CHAT.NO_CHATCANNEDANSWER_AVAILABLE">No chatcannedanswer available</span>\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.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" ms-scroll 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.alias || a.appType) | uppercase}}">{{a.alias || 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" ms-scroll 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" style="width:200px">{{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-ligth" 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)">\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                            <div flex></div>\n                            <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="CHATWEBSITES.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.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">{{ \'CHAT.ID\' | translate }}</th>\n                                    <th md-column md-order-by="createdAt">{{ \'CHAT.STARTEDAT\' | translate }}</th>\n                                    <th md-column md-order-by="closedAt">{{ \'CHAT.CLOSEDAT\' | translate }}</th>\n                                    <th md-column>{{ \'CHAT.CONTACT\' | translate }}</th>\n                                    <th md-column>{{ \'CHAT.AGENT\' | translate }}</th>\n                                    <th md-column md-order-by="disposition">{{ \'CHAT.DISPOSITION\' | translate }}</th>\n                                    <th md-column md-order-by="ratingValue">{{ \'CHAT.RATING\' | translate }}</th>\n                                    <th md-column md-order-by="note">{{ \'CHAT.NOTES\' | translate }}</th>\n                                    <th md-column md-order-by="tag">{{ \'CHAT.TAGS\' | translate }}</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">\n                                    <td md-cell>{{interaction.id}}</td>\n                                    <td md-cell>{{interaction.createdAt | date:\'medium\'}}</td>\n                                    <td md-cell>{{interaction.closedAt | date:\'medium\'}}</td>\n                                    <td md-cell>{{interaction.Contact.firstName}}</td>\n                                    <td md-cell>{{interaction.Owner.name}}</td>\n                                    <td md-cell>{{interaction.disposition}}</td>\n                                    <td md-cell>\n                                        <md-icon md-font-icon="icon-star" style="color:red" ng-show="interaction.ratingValue != null && (!interaction.ratingType || interaction.ratingType == \'star\')" ng-repeat="ratingValue in [1,2,3,4,5] | limitTo:interaction.ratingValue"></md-icon>\n                                        <md-icon md-font-icon="icon-thumb-up" style="color:green" ng-show="interaction.ratingValue != null && interaction.ratingType && interaction.ratingType == \'thumb\' && interaction.ratingValue == 1"></md-icon>\n                                        <md-icon md-font-icon="icon-thumb-down" style="color:red" ng-show="interaction.ratingValue != null && interaction.ratingType && interaction.ratingType == \'thumb\' && interaction.ratingValue == 0"></md-icon><span ng-show="interaction.ratingValue == null" translate="CHAT.NO_RATINGVALUE">No ratingValue</span>\n                                    </td>\n                                    <td md-cell>{{interaction.note}}</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"></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>\n                                                    <md-button class="md-primary" ng-click="vm_dc.chatInteractionDownload(interaction, $event)" translate="CHAT.DOWNLOAD_INTERACTION">\n                                                        Download Interaction\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="15">\n                                        <span class="text-boxed-ligth" translate="CHAT.NO_INTERACTION_AVAILABLE">No interaction available</span>\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)">\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                            <div flex></div>\n                            <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.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_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="CHATWEBSITES.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.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">{{ \'CHAT.ID\' | translate }}</th>\n                                    <th md-column md-order-by="ContactId">{{ \'CHAT.CONTACT\' | translate }}</th>\n                                    <th md-column md-order-by="createdAt">{{ \'CHAT.CREATED_AT\' | translate }}</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>{{offlineMessage.id}}</td>\n                                    <td md-cell>{{ (vm_dc.contacts | filter : {\'id\':offlineMessage.ContactId})[0].firstName }}</td>\n                                    <td md-cell>{{offlineMessage.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="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="5">\n                                        <span class="text-boxed-ligth" translate="CHAT.NO_OFFLINEMESSAGE_AVAILABLE">No offlinemessage available</span>\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/agents/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="CHAT.AGENTS">Agents</span>\n        <div flex></div>\n        <ms-search-bar on-search="vm.query.filter = query; vm.onInit()" on-collapse="vm.query.filter = undefined; vm.onInit()" debounce="300"></ms-search-bar>\n        <md-select ng-model="vm.query.globalStatusFilter" class="md-caption" ng-change="vm.query.pauseTypeFilter = \'\'; vm.onInit()">\n            <md-option ng-value="\'\'">{{ \'CHAT.ALL\' | translate }}</md-option>\n            <md-option value="pause">{{ \'CHAT.PAUSE\' | translate }}</md-option>\n            <md-option value="*pause">{{ \'CHAT.PARTIALPAUSE\' | translate }}</md-option>\n            <md-option value="busy">{{ \'CHAT.BUSY\' | translate }}</md-option>\n            <md-option value="idle">{{ \'CHAT.IDLE\' | translate }}</md-option>\n        </md-select>\n\n        <md-select ng-if="vm.isPause(vm.query.globalStatusFilter)" ng-model="vm.query.pauseTypeFilter" class="md-caption" ng-change="vm.onInit()">\n            <md-option ng-value="\'\'">All</md-option>\n            <md-option value="DEFAULT PAUSE">DEFAULT PAUSE</md-option>\n            <md-option value="ACW">ACW</md-option>\n            <md-option value="LOGININPAUSE">LOGININPAUSE</md-option>\n            <md-option value="Auto-Pause">AUTOPAUSE</md-option>\n            <md-option ng-value="pause.name" ng-repeat="pause in vm.pauses.rows">{{pause.name}}</md-option>\n        </md-select>\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.order" md-on-reorder="vm.onInit">\n            <tr md-row border="1">\n                <th class="bv text-center" colspan="4">{{ \'CHAT.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">{{ \'OPENCHANNEL.OPENCHANNEL\' | translate }}</th>\n                <th ng-if="vm.license.fax" class="bv bl text-center" colspan="2">{{ \'FAX.FAX\' | translate }}</th>\n                <th width="10px" class="bt bl" rowspan="2"></th>\n            </tr>\n            <tr md-row>\n                <th class="bl" md-column md-order-by="fullname">{{ \'CHAT.NAME\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="globalStatus">{{ \'CHAT.STATUS\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="lastLoginAt">{{ \'CHAT.LOGIN_TIME\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="lastPauseAt">{{ \'CHAT.PAUSE_TIME\' | translate }}</th>\n\n                <th class="bl custom-column">{{ \'VOICE.STATUS\' | translate }}</th>\n                <th class="bl custom-column">Info</th>\n\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\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\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\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\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            </tr>\n        </thead>\n        <tbody md-body>\n            <tr md-row ng-hide="vm.order.length">\n                <td md-cell colspan="17">\n                    <div layout="row" layout-align="center center">\n                        <span>{{ \'CHAT.NO_AGENT_ONLINE\' | translate }}</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-select="vm.agents[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td class="bt padding-5">\n                    <div layout="row" layout-align="start center">\n                        <img class="avatar" ng-src="{{vm.agents[value].userpic && \'api/users/\'+vm.agents[value].id+\'/avatar\' || \'assets/images/avatars/profile.png\'}}">\n                        <div layout="column">\n                            <span>{{vm.agents[value].fullname}}</span>\n                            <span>{{vm.agents[value].internal}}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class="bt">\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'}[vm.agents[value].globalStatus]\">{{ vm.isPause(vm.agents[value].globalStatus) ? '' : vm.agents[value].globalStatus | uppercase }} {{ vm.isPause(vm.agents[value].globalStatus) ? (vm.isPartialPause(vm.agents[value].globalStatus) ? '*'+vm.agents[value].pauseType || 'DEFAULT PAUSE'  : vm.agents[value].pauseType || 'DEFAULT PAUSE') : ''}}</span>\n                </td>\n                <td class=\"bt custom-column\">\n                    <timer start-time=\"vm.agents[value].lastLoginAt\" interval=\"1000\">{{ days > 0 ? days + 'd' : '' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                </td>\n                <td class=\"bt custom-column\">\n                    <timer ng-if=\"vm.isPause(vm.agents[value].globalStatus) || vm.isPartialPause(vm.agents[value].globalStatus)\" start-time=\"vm.agents[value].lastPauseAt\" interval=\"1000\">{{ days > 0 ? days + 'd' : '' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                </td>\n                <td class=\"bt bl\">\n                    <div layout=\"row\">\n                        <span ng-if=\"!vm.agents[value].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'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].voiceStatus | uppercase }}</span>\n                        <span ng-if=\"vm.agents[value].onhold\" class=\"text-boxed md-background-bg bl bt padding-5 orange-400-bg\">ONHOLD</span>\n                    </div>\n                </td>\n                <td class=\"bt bl\">\n                    <div layout=\"column\">\n                        <span ng-if=\"vm.agents[value].queue\" class=\"padding-5\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].queue }}</span>\n                        <span ng-if=\"vm.agents[value].destconnectedlinenum\" class=\"padding-5\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].destconnectedlinenum }}</span>\n                        <span class=\"padding-5\" ng-if=\"vm.agents[value].queue || vm.agents[value].destconnectedlinenum\">\n                            <timer start-time=\"vm.agents[value].voiceStatusTime\" interval=\"1000\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                        </span>\n                    </div>\n                </td>\n                <td class=\"bt bl\" ng-if=\"vm.license.chat\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].chatStatus]\">{{ vm.agents[value].chatStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td md-number class=\"bt text-center font-size-20\" ng-if=\"vm.license.chat\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].chatStatus]\">{{ vm.agents[value].chatCurrentCapacity }}</td>\n                <td class=\"bl bt\" ng-if=\"vm.license.mail\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].mailStatus]\">{{ vm.agents[value].mailStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.mail\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].mailStatus]\">{{ vm.agents[value].mailCurrentCapacity }}</td>\n                <td class=\"bl bt\" ng-if=\"vm.license.messaging\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].smsStatus]\">{{ vm.agents[value].smsStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.messaging\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].smsStatus]\">{{ vm.agents[value].smsCurrentCapacity }}</td>\n                <td class=\"bt bl\" ng-if=\"vm.license.openchannel\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].openchannelStatus]\">{{ vm.agents[value].openchannelStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.openchannel\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].openchannelStatus]\">{{ vm.agents[value].openchannelCurrentCapacity }}</td>\n                <td class=\"bt bl\" ng-if=\"vm.license.fax\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].faxStatus]\">{{ vm.agents[value].faxStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.fax\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].faxStatus]\">{{ vm.agents[value].faxCurrentCapacity }}</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\n                        <md-menu-content width=\"4\">\n                            <md-menu-item>\n                                <md-button ng-click=\"vm.logout(vm.agents[value], $event)\" translate=\"CHAT.LOGOUT\">\n                                    Logout\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-button ng-click=\"vm.queueAdd(vm.agents[value], $event)\" translate=\"CHAT.AGENTADD_QUEUE\">\n                                    Add Agent In Queue\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-menu>\n                                    <md-button ng-click=\"$mdMenu.open()\" class=\"text-capitalize\" translate=\"CHAT.PAUSE\">Pause</md-button>\n                                    <md-menu-content>\n                                        <md-menu-item>\n                                            <md-button ng-disabled=\" vm.agents[value].voicePause && 'DEFAULT PAUSE' === vm.agents[value].pauseType\" ng-click=\"vm.pause(vm.agents[value])\"><em translate=\"CHAT.DEFAULT_PAUSE\">Default Pause</em></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=\"vm.agents[value].voicePause && pause.name === vm.agents[value].pauseType\" ng-click=\"vm.pause(vm.agents[value], pause.name)\">{{pause.name}}</md-button>\n                                        </md-menu-item>\n                                    </md-menu-content>\n                                </md-menu>\n                            </md-menu-item>\n                            <md-menu-item ng-if=\"vm.isPause(vm.agents[value].globalStatus)\">\n                                <md-button ng-click=\"vm.unPause(vm.agents[value])\" translate=\"CHAT.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\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.filteredAgents.length}}\" md-on-paginate=\"vm.onInit\" md-page-select></md-table-pagination>\n\x3c!-- / AGENT TABLE --\x3e\n\x3c!-- / MAIN --\x3e"),e.put("app/main/apps/chat/views/realtime/queues/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="CHAT.QUEUES">Queues</span>\n        <div flex></div>\n        <ms-search-bar on-search="vm.query.filter = 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">{{ \'CHAT.NAME\' | translate }}</th>\n                <th md-column>{{ \'CHAT.LOGGED_IN\' | translate }}</th>\n                <th md-column>{{ \'CHAT.PAUSED\' | translate }}</th>\n                <th md-column>{{ \'CHAT.READY\' | translate }}</th>\n                <th md-column>{{ \'CHAT.WAITING\' | translate }}</th>\n                <th md-column width="10px"></th>\n            </tr>\n        </thead>\n        <tbody md-body>\n            <tr md-row ng-hide="vm.queues">\n                <td md-cell colspan="7">\n                    <div layout="row" layout-align="center center">\n                        <span tranlsate="CHAT.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-row md-select="vm.queues[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td md-cell>{{vm.queues[value].name}}</td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].loggedInDb || 0}} ({{vm.queues[value].loggedIn || 0}})</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].paused || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-16 grey-fg">{{vm.queues[value].available || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].waiting || 0}}</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="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.createOrEditChatQueue($event, vm.queues[value])" translate="CHAT.EDIT_QUEUE">\n                                    Edit Queue\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-button ng-click="vm.agentAdd($event, vm.queues[value])" translate="CHAT.AGENTSADD_QUEUE">\n                                    Add Agents to queue\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: \'{{\'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.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/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 animate-slide-down 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="COMPANIES.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="COMPANIES.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!-- 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                                <td md-cell class="actions">\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                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(company, $event)" translate="CONTACTMANAGER.EDIT_COMPANY">\n                                                    Edit Company\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.gotocontactsgoto(company, $event)" translate="CONTACTMANAGER.GOTOCONTACTS_COMPANY">\n                                                    goToContacts Company\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(company, $event)" translate="CONTACTMANAGER.DELETE_COMPANY">\n                                                    Delete Company\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.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 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="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 animate-slide-down 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" ms-scroll>\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">\n                                    <md-optgroup label="Lists">\n                                        <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n                                        <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">{{list.name}}</md-option>\n                                    </md-optgroup>\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 companie" flex="100" ng-model="vm.selectedCompany">\n                                    <md-optgroup label="Companies">\n                                        <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n                                        <md-option ng-value="company.id" ng-repeat="company in vm.companies.rows">{{company.name}}</md-option>\n                                    </md-optgroup>\n                                </md-select>\n                            </md-input-container>\n\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 placeholder="Select one or more tags" flex="100" ng-model="vm.query.tag" ng-change="vm.getContacts()" multiple>\n                                    <md-optgroup label="Tags">\n                                        <md-option ng-value="tag.id" ng-repeat="tag in vm.tags.rows">{{tag.name}}</md-option>\n                                    </md-optgroup>\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 tranlsate="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">{{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">{{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">{{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"></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-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 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            <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>\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">\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">\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">\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">\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">\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-init="vm.getCustomFields(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\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 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\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]"></mdp-time-picker>\n                    </div>\n                </div>\n\n                <div ng-switch-when="select">\n                    <label>{{customField.alias}}</label>\n\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\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-optgroup label="Companies">\n                        <md-option ng-value="company.id" ng-repeat="company in vm.companies.rows">{{company.name}}</md-option>\n                    </md-optgroup>\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 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"></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 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 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            <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 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 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" 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</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">\n\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">\n                                        </md-input-container>\n\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">\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">\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">\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 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">\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</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}}</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]"></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}}</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                    </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="scheduledat">{{ \'CONTACTMANAGER.SCHEDULEDAT\' | 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="4">\n                                                <div layout="row" layout-align="center center">\n                                                    <span tranlsate="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>{{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 tranlsate="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>{{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 tranlsate="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>{{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 tranlsate="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="interaction-content">\n                        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.html\'"></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 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>\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 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            <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 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="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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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 animate-slide-down 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="GLOBALCUSTOMFIELDS.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="GLOBALCUSTOMFIELDS.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!-- 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                                <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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editdialog(globalCustomField, $event)" translate="CONTACTMANAGER.EDIT_GLOBALCUSTOMFIELD">\n                                                    Edit GlobalCustomField\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(globalCustomField, $event)" translate="CONTACTMANAGER.DELETE_GLOBALCUSTOMFIELD">\n                                                    Delete GlobalCustomField\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.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 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="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"></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 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="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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="LISTS.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.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">{{ \'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 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>{{customField.id}}</td>\n                                            <td ng-click="vm_dc.createOrEditListCustomField($event, customField)" md-cell>{{customField.alias}}</td>\n                                            <td ng-click="vm_dc.createOrEditListCustomField($event, customField)" md-cell>{{ vm_dc.arraytype[customField.type].option }}</td>\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="7">\n                                                <span class="text-boxed-ligth" translate="CONTACTMANAGER.NO_CUSTOMFIELD_AVAILABLE">No customfield available</span>\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 class="list-detail-form-container voicedispositions md-background-bg md-whiteframe-1dp">\n                        <div ng-controller="ListVoiceDispositionsController 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.selectedListVoiceDispositions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead" translate="CONTACTMANAGER.VOICEDISPOSITIONS">VoiceDispositions</span>\n                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\n                                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditListVoiceDisposition($event)" aria-label="add voiceDisposition" translate translate-attr-label="CONTACTMANAGER.ADD_VOICEDISPOSITION">\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.selectedListVoiceDispositions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead">{{vm_dc.selectedListVoiceDispositions.length}} {{vm_dc.selectedListVoiceDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                                    <div flex></div>\n                                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedListVoiceDispositions" 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.deleteSelectedListVoiceDispositions($event)" aria-label="delete selected" translate translate-attr-label="LISTS.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.selectedListVoiceDispositions" md-progress="vm_dc.promise">\n                                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getListVoiceDispositions">\n                                        <tr md-row>\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="createdAt">{{ \'CONTACTMANAGER.CREATED_AT\' | translate }}</th>\n                                            <th md-column width="10px"></th>\n                                        </tr>\n                                    </thead>\n                                    <tbody md-body>\n                                        <tr md-row md-select="voiceDisposition" md-select-id="id" ng-repeat="voiceDisposition in vm_dc.listVoiceDispositions.rows">\n                                            <td ng-click="vm_dc.createOrEditListVoiceDisposition($event, voiceDisposition)" md-cell>{{voiceDisposition.id}}</td>\n                                            <td ng-click="vm_dc.createOrEditListVoiceDisposition($event, voiceDisposition)" md-cell>{{voiceDisposition.name}}</td>\n                                            <td ng-click="vm_dc.createOrEditListVoiceDisposition($event, voiceDisposition)" md-cell>{{voiceDisposition.createdAt | date:\'medium\'}}</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.createOrEditListVoiceDisposition($event, voiceDisposition)" translate="CONTACTMANAGER.EDIT_VOICEDISPOSITION">\n                                                                Edit VoiceDisposition\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(voiceDisposition, $event)" translate="CONTACTMANAGER.DELETE_VOICEDISPOSITION">\n                                                                Delete VoiceDisposition\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.listVoiceDispositions.rows.length">\n                                            <td md-cell colspan="5">\n                                                <span class="text-boxed-ligth" translate="CONTACTMANAGER.NO_VOICEDISPOSITION_AVAILABLE">No voicedisposition available</span>\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.listVoiceDispositions.count}}" md-on-paginate="vm_dc.getListVoiceDispositions" 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/contactmanager/views/lists/edit/voiceDispositions/dialog.html",'<md-dialog class="voiceDisposition-dialog" aria-label="New VoiceDisposition">\n    <form name="voiceDispositionForm" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="CONTACTMANAGER.NAME">Name</label>\n                <input type="" name="name" ng-model="vm.voiceDisposition.name" ng-required="true" autofocus>\n\n                <div ng-messages="voiceDispositionForm[\'name\'].$error" ng-show="voiceDispositionForm[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.newVoiceDisposition" ng-click="vm.saveVoiceDisposition()" class="send-button md-accent md-raised" ng-disabled="voiceDispositionForm.$invalid || voiceDispositionForm.$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.newVoiceDisposition" ng-click="vm.addNewVoiceDisposition()" class="send-button md-accent md-raised" ng-disabled="voiceDispositionForm.$invalid" aria-label="ADD" translate="CONTACTMANAGER.ADD_VOICEDISPOSITION" translate-attr-aria-label="CONTACTMANAGER.ADD_VOICEDISPOSITION">\n                    ADD VOICEDISPOSITION\n                </md-button>\n            </div>\n            <div layout="row">\n                <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newVoiceDisposition" ng-click="vm.deleteVoiceDisposition($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/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 animate-slide-down 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="LISTS.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="LISTS.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!-- 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                                <td md-cell class="actions">\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                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(list, $event)" translate="CONTACTMANAGER.EDIT_LIST">\n                                                    Edit List\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.gotocontactsgoto(list, $event)" translate="CONTACTMANAGER.GOTOCONTACTS_LIST">\n                                                    goToContacts List\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.exportcsvcontactsexport(list, $event)" translate="CONTACTMANAGER.EXPORTCSVCONTACTS_LIST">\n                                                    exportCsvContacts List\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.agentadddialog(list, $event)" translate="CONTACTMANAGER.AGENTADD_LIST">\n                                                    AgentAdd List\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(list, $event)" translate="CONTACTMANAGER.DELETE_LIST">\n                                                    Delete List\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.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                <div layout="column">\n                    <span class="font-size-10" translate="DASHBOARDS.FILTER_VOICE_QUEUES">Filter Voice Queues</span>\n                    <md-select placeholder="Select one or more queues" class="font-size-12 no-margin w-200" md-on-close="vm.onChangeVoiceQueues()" ng-model="vm.voiceQueuesSelected" multiple aria-label="voiceQueues">\n                        <md-option ng-value="voiceQueue.id" ng-repeat="voiceQueue in vm.voiceQueues.rows">{{ voiceQueue.name }}</md-option>\n                    </md-select>\n                </div>\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/general/agent/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/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" 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\'"></md-icon>\n                    <span class="text-truncate font-size-12" ng-class="vm.isActiveTab(tab.id) ? \'black-fg\' : \'grey-300-fg\'">\n                        {{tab.title}} <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)">\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    <div layout="row" class="agent-content" ng-if="vm.isActiveTab(0)" ng-style="{\'top\': vm.detectBrowser.browser == \'safari\' ? \'100px\' : \'36px\'}" 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    <div ng-if="!vm.isActiveTab(0)" ng-repeat="(key, tab) in vm.tabs" ng-switch="tab.type">\n        <div ng-switch-when="contact">\n            <div class="agent-content" ms-scroll ng-if="vm.isActiveTab(tab.id)" ng-style="{\'top\': vm.detectBrowser.browser == \'safari\' ? \'100px\' : \'36px\'}" 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">\n            <div ng-if="vm.isActiveTab(tab.id)" ms-scroll 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">\n            <div class="agent-content" ms-scroll ng-if="vm.isActiveTab(tab.id)" ng-style="{\'top\': vm.detectBrowser.browser == \'safari\' ? \'100px\' : \'36px\'}" 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">\n            <div id="interaction-app" ng-if="vm.isActiveTab(tab.id)" class="agent-content" ng-style="{\'top\': vm.detectBrowser.browser == \'safari\' ? \'100px\' : \'36px\'}" 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">\n            <div id="interaction-app" ng-if="vm.isActiveTab(tab.id)" class="agent-content" ng-style="{\'top\': vm.detectBrowser.browser == \'safari\' ? \'100px\' : \'36px\'}" 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)"></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                            \x3c!-- <div layout="row" layout-align="center center" class="blue-grey-300-fg padding-left-40"\n                                    ng-if="!vm.interaction.closed">\n                                    <timer start-time="vm.interaction.createdAt" interval="1000">{{ days > 0 ? days + \'d\' :\n                                        \'\' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                                    <md-icon md-font-icon="icon-timelapse" class="s16 padding-left-5"></md-icon>\n                                </div> --\x3e\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 ms-scroll 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">\n                    \x3c!-- MS-CARD --\x3e\n                    <md-card class="template-7" layout="row" layout-align="space-between" ng-repeat="call in vm.tab.calls track by call.uniqueid">\n                        <div class="info" layout="column" layout-align="space-between" layout-fill flex>\n                            <div layout="row">\n                                <span ng-if="call.answeredAt" class="text-boxed indigo-100-bg">\n                                    <timer start-time="call.answeredAt" interval="1000">{{ days > 0 ? days + \'d\' : \'\' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                                </span>\n                                <div flex></div>\n                                <span ng-if="call.disposedAt" class="text-boxed amber-200-bg">\n                                    <timer start-time="call.disposedAt" interval="1000">{{ days > 0 ? days + \'d\' : \'\' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                                </span>\n                            </div>\n                            <div class="p-16">\n                                <div class="title h1">\n                                    <md-icon ng-if="!call.routeId" md-font-icon="icon-phone-incoming"></md-icon>\n                                    <md-icon ng-if="call.routeId" md-font-icon="icon-phone-outgoing"></md-icon>\n                                    {{ call.routeId ? call.destcalleridnum : call.calleridnum }}\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"></md-icon>\n                                    Name: {{ call.calleridname }}\n                                </div>\n\n                                <div class="text h4 pt-8" ng-if="call.queue">\n                                    <md-icon md-font-icon="icon-stackoverflow"></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"></md-icon>\n                                    Extra: {{call.variables.extravar}}\n                                </div>\n                            </div>\n                            <div layout="row" layout-align="end center">\n                                <md-button ng-if="call.disposedAt" type="submit" ng-click="vm.disposeCall($event, call)" class="send-button md-accent md-raised">\n                                    {{ \'DASHBOARDS.DISPOSE\' | translate}}\n                                </md-button>\n                            </div>\n                        </div>\n                    </md-card>\n                    \x3c!-- / MS-CARD --\x3e\n                    <div flex layout="row" layout-align="end 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">PERSONAL_INFO</div>\n                            <div class="subtitle secondary-text">\n                                <span translate="CONTACTMANAGER.CREATED_AT"></span> <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>\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 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)" aria-label="jscripty">\n                                                    <md-icon md-font-icon="icon-script"></md-icon>\n                                                </md-button>\n\n                                                <md-menu-content>\n                                                    <md-menu-item ng-if="vm.jscriptyProjects && vm.jscriptyProjects.rows.length" 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> {{project.name}}\n                                                        </md-button>\n                                                    </md-menu-item>\n                                                    <md-menu-item ng-if="!vm.jscriptyProjects || !vm.jscriptyProjects.rows.length">\n                                                        <md-button disabled="disabled" translate="DASHBOARDS.NO_JSCRIPTY_PROJECTS_AVAILABLE">\n                                                            <md-icon md-font-icon="icon-script"></md-icon> No jscripty projects available\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">\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">\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">\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)" aria-label="sms">\n                                                    <md-icon md-font-icon="icon-message-text"></md-icon>\n                                                </md-button>\n\n                                                <md-menu-content>\n                                                    <md-menu-item ng-if="vm.smsAccounts && vm.smsAccounts.rows.length" 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> {{account.name}}\n                                                        </md-button>\n                                                    </md-menu-item>\n                                                    <md-menu-item ng-if="!vm.smsAccounts || !vm.smsAccounts.rows.length">\n                                                        <md-button disabled="disabled" translate="DASHBOARDS.NO_SMS_ACCOUNTS_AVAILABLE">\n                                                            <md-icon md-font-icon="icon-message-text"></md-icon> No sms accounts available\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">\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 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)" aria-label="email">\n                                                    <md-icon md-font-icon="icon-email"></md-icon>\n                                                </md-button>\n\n                                                <md-menu-content>\n                                                    <md-menu-item ng-if="vm.mailAccounts && vm.mailAccounts.rows.length" 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> {{account.name}}\n                                                        </md-button>\n                                                    </md-menu-item>\n                                                    <md-menu-item ng-if="!vm.mailAccounts || !vm.mailAccounts.rows.length">\n                                                        <md-button disabled="disabled" translate="DASHBOARDS.NO_MAIL_ACCOUNTS_AVAILABLE">\n                                                            <md-icon md-font-icon="icon-email"></md-icon> No email accounts available\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">\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)" aria-label="fax">\n                                                    <md-icon md-font-icon="icon-deskphone"></md-icon>\n                                                </md-button>\n\n                                                <md-menu-content>\n                                                    <md-menu-item ng-if="vm.faxAccounts && vm.faxAccounts.rows.length" 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> {{account.name}}\n                                                        </md-button>\n                                                    </md-menu-item>\n                                                    <md-menu-item ng-if="!vm.faxAccounts || !vm.faxAccounts.rows.length">\n                                                        <md-button disabled="disabled" translate="DASHBOARDS.NO_FAX_ACCOUNTS_AVAILABLE">\n                                                            <md-icon md-font-icon="icon-deskphone"></md-icon> No fax accounts available\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                                    <md-input-container class="md-block" flex-gt-sm="" ng-init="vm.contact.dateOfBirth = vm.getDateFromString(vm.contact.dateOfBirth)">\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                                </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}}</md-option>\n                                            <md-option ng-value="null"><em translate="DASHBOARDS.NONE">None</em></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">{{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></form>\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 FIELDS</div>\n                            <form name="vm.customFieldsForm" novalidate>\n\n                                \x3c!-- START INPUT LIST --\x3e\n                                <md-input-container class="md-block" ng-if="!vm.contact.ListId">\n                                    <label translate translate-attr-placeholder="DASHBOARDS.LIST">List</label>\n                                    <md-select name="list" 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.tab.userLists.rows">#{{list.id}} - {{list.name}}</md-option>\n                                        </md-optgroup>\n                                    </md-select>\n                                </md-input-container>\n                                <md-input-container class="md-block" ng-if="vm.contact.ListId">\n                                    <label translate translate-attr-placeholder="DASHBOARDS.LIST">List</label>\n                                    <md-select ng-disabled="!vm.newContact" name="list" ng-model="vm.contact.ListId" required>\n                                        <md-optgroup label="Lists">\n                                            <md-option ng-value="list.id" ng-repeat="list in vm.tab.lists.rows">#{{list.id}} - {{list.name}}</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]"></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]"></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">{{value.value}}</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}}<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                                        <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                                </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="interaction-content">\n                <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.html\'"></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()">\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 ms-scroll>\n            <div ng-if="!vm.isReschedule">\n                <md-input-container class="md-block">\n                    <label translate="DASHBOARDS.DISPOSITIONS">Dispositions</label>\n                    <md-select name="disposition" ng-model="vm.choice" required>\n                        <md-option ng-value="g.name" ng-repeat="g in vm.dispositions.rows">{{ g.name }}</md-option>\n                        <md-option ng-value="gd.name" ng-repeat="gd in vm.globalDispositions.rows">{{ gd.name }}</md-option>\n                    </md-select>\n                </md-input-container>\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\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" 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" 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                <md-input-container ng-if="!vm.dialerCall" class="md-block">\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">{{ queueCampaign.name }} ({{ queueCampaign.dialActive ? \'Active\' : \'Not Active\' }})</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        </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()">\n                {{(vm.choice ? \'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 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 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/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="Voice">\n                <div ng-controller="AgentHomeAbandonedVoiceController as vm_voice">\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\'" class="md-padding">\n                    </md-content>\n                </div>\n            </md-tab>\n            <md-tab ng-if="vm_home.hasPermission(110) && vm_home.license.dialer" label="Bull">\n                <div ng-controller="AgentHomeAbandonedBullController as vm_bull">\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\'" class="md-padding">\n                    </md-content>\n                </div>\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 ngCloak>\n    <md-toolbar class="md-table-toolbar md-default table-header blue-bg">\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.query.filter = query" on-collapse="vm_bull.query.filter = undefined" debounce="300"></ms-search-bar>\n            <div flex></div>\n            <div class="padding-horizontal-20" layout="column" layout-align="center center">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_DATE">Select a date</span>\n                <div layout="row" layout-align="center center">\n                    <md-button ng-if="vm_bull.pickerModel.dateStart" ng-click="vm_bull.clearAll()" class="md-icon-button no-padding width-20 height-20">\n                        <md-tooltip>{{ \'DASHBOARDS.DELETE\' | translate }}</md-tooltip>\n                        <md-icon md-font-icon="icon-close" class="s16 white-fg"></md-icon>\n                    </md-button>\n                    <md-date-range localization-map="vm_bull.localizationMap" ng-model="vm_bull.pickerModel" auto-confirm="true" show-template="true" md-on-select="vm_bull.getAbandonedCalls()" placeholder="{{ \'DASHBOARDS.ALL\' | translate }}"></md-date-range>\n                </div>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_AGENT">Select an agent</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm_bull.query.lastAssignedTo" ng-change="vm_bull.getAbandonedCalls()">\n                    <md-option ng-value="vm_bull.currentUser.name" translate="DASHBOARDS.ME"></md-option>\n                    <md-option ng-value="\'null\'" translate="DASHBOARDS.NOT_ASSIGNED"></md-option>\n                    <md-option ng-value="undefined" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div ng-if="vm_bull.queues.count" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_CAMPAIGN">Select a Campaign</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm_bull.query.queue" ng-change="vm_bull.getAbandonedCalls()">\n                    <md-option ng-value="vm_bull.defaultQueues" ng-if="vm_bull.queues.count > 1"><em translate="DASHBOARDS.ALL">All</em></md-option>\n                    <md-option ng-value="queue.name" ng-repeat="queue in vm_bull.queues.rows">{{queue.name}}</md-option>\n                </md-select>\n            </div>\n            <md-button class="md-icon-button interaction-reload" 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">{{\'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">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="disposition">{{\'DASHBOARDS.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="10">\n                        <div layout="row" layout-align="center center">\n                            <span tranlsate="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">{{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"></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">{{abandonedCall.queuecallerabandonAt ? (abandonedCall.queuecallerabandonAt | formatdate) : undefined }}</td>\n                    <td md-cell class="list">{{abandonedCall.queuecallerexitAt ? (abandonedCall.queuecallerexitAt | formatdate) : undefined }}</td>\n                    <td md-cell class="list">{{abandonedCall.queuecallerexitreason}}</td>\n                    <td md-cell class="list">{{abandonedCall.disposition}}</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, abandonedCall.disposition)"></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-menu>\n                                        <md-button ng-click="$mdMenu.open()" class="text-capitalize" translate="DASHBOARDS.DISPOSE">Dispose</md-button>\n                                        <md-menu-content>\n                                            <md-menu-item ng-if="vm_bull.disposition.length" ng-repeat="disposition in vm_bull.disposition">\n                                                <md-button ng-click="vm_bull.reserved(abandonedCall, disposition.name)">{{disposition.name}}</md-button>\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\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\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/abandoned/voice/agent.general.abandoned.voice.html",'<md-card ngCloak>\n    <md-toolbar class="md-table-toolbar md-default table-header blue-bg">\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.query.filter = query" on-collapse="vm_voice.query.filter = undefined" debounce="300"></ms-search-bar>\n            <div flex></div>\n            <div class="padding-horizontal-20" layout="column" layout-align="center center">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_DATE">Select a date</span>\n                <div layout="row" layout-align="center center">\n                    <md-button ng-if="vm_voice.pickerModel.dateStart" ng-click="vm_voice.clearAll()" class="md-icon-button no-padding width-20 height-20">\n                        <md-tooltip>{{ \'DASHBOARDS.DELETE\' | translate }}</md-tooltip>\n                        <md-icon md-font-icon="icon-close" class="s16 white-fg"></md-icon>\n                    </md-button>\n                    <md-date-range localization-map="vm_voice.localizationMap" ng-model="vm_voice.pickerModel" auto-confirm="true" show-template="true" md-on-select="vm_voice.getAbandonedCalls()" placeholder="{{ \'DASHBOARDS.ALL\' | translate }}"></md-date-range>\n                </div>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_AGENT">Select an agent</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm_voice.query.lastAssignedTo" ng-change="vm_voice.getAbandonedCalls()">\n                    <md-option ng-value="vm_voice.currentUser.name" translate="DASHBOARDS.ME"></md-option>\n                    <md-option ng-value="\'null\'" translate="DASHBOARDS.NOT_ASSIGNED"></md-option>\n                    <md-option ng-value="undefined" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div ng-if="vm_voice.queues.count" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_CAMPAIGN">Select a Campaign</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm_voice.query.queue" ng-change="vm_voice.getAbandonedCalls()">\n                    <md-option ng-value="vm_voice.defaultQueues" ng-if="vm_voice.queues.count > 1"><em translate="DASHBOARDS.ALL">All</em></md-option>\n                    <md-option ng-value="queue.name" ng-repeat="queue in vm_voice.queues.rows">{{queue.name}}</md-option>\n                </md-select>\n            </div>\n            <md-button class="md-icon-button interaction-reload" 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">{{\'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">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="disposition">{{\'DASHBOARDS.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="10">\n                        <div layout="row" layout-align="center center">\n                            <span tranlsate="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">{{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"></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">{{abandonedCall.queuecallerabandonAt ? (abandonedCall.queuecallerabandonAt | formatdate) : undefined }}</td>\n                    <td md-cell class="list">{{abandonedCall.disposition}}</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, abandonedCall.disposition)"></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-menu>\n                                        <md-button ng-click="$mdMenu.open()" class="text-capitalize" translate="DASHBOARDS.DISPOSE">Dispose</md-button>\n                                        <md-menu-content>\n                                            <md-menu-item ng-if="vm_voice.disposition.length" ng-repeat="disposition in vm_voice.disposition">\n                                                <md-button ng-click="vm_voice.reserved(abandonedCall, disposition.name)">{{disposition.name}}</md-button>\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\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\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="md-primary-bg width-50" ms-scroll>\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" 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></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 ng-switch="vm_home.sidebar" style="overflow-y: auto" flex>\n    <div ng-switch-when="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\'"></div>\n    </div>\n    <div ng-switch-when="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\'"></div>\n    </div>\n    <div ng-switch-when="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\'"></div>\n    </div>\n    <div ng-switch-when="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\'"></div>\n    </div>\n    <div ng-switch-when="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\'"></div>\n    </div>\n    <div ng-switch-when="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\'"></div>\n    </div>\n    <div ng-switch-when="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)"></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\'"></div>\n    </div>\n    <div ng-switch-when="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)"></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\'"></div>\n    </div>\n    <div ng-switch-when="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)"></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\'"></div>\n    </div>\n    <div ng-switch-when="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)"></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\'"></div>\n    </div>\n    <div ng-switch-when="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)"></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\'"></div>\n    </div>\n    <div ng-switch-when="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\'"></div>\n    </div>\n    <div ng-switch-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\'"></div>\n    </div>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/chat/agent.general.chat.html",'<md-card ngCloak>\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm.getColorByChannel(\'chat\')">\n        <div class="md-toolbar-tools">\n            <span class="md-subhead" translate="DASHBOARDS.INTERACTIONS">Interactions</span>\n            <ms-search-bar on-search="vm.query.filter = query" on-collapse="vm.query.filter = undefined" debounce="300"></ms-search-bar>\n            <div flex></div>\n            <div class="padding-horizontal-20" layout="column" layout-align="center center">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_DATE">Select a date</span>\n                <div layout="row" layout-align="center center">\n                    <md-button ng-if="vm.pickerModel.dateStart" ng-click="vm.clearAll()" class="md-icon-button no-padding width-20 height-20">\n                        <md-tooltip>{{ \'DASHBOARDS.DELETE\' | translate }}</md-tooltip>\n                        <md-icon md-font-icon="icon-close" class="s16 white-fg"></md-icon>\n                    </md-button>\n                    <md-date-range localization-map="vm.localizationMap" ng-model="vm.pickerModel" auto-confirm="true" show-template="true" md-on-select="vm.getChatInteractions()" placeholder="{{ \'DASHBOARDS.ALL\' | translate }}"></md-date-range>\n                </div>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_READ_UNREAD">Select Read/Unread</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.read" ng-change="vm.getChatInteractions()">\n                    <md-option value="0" translate="DASHBOARDS.UNREAD">READ</md-option>\n                    <md-option value="1" translate="DASHBOARDS.READ">UNREAD</md-option>\n                    <md-option ng-value="null" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_STATUS">Select a status</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.closed" ng-change="vm.getChatInteractions()">\n                    <md-option value="0" translate="DASHBOARDS.OPENED">OPENED</md-option>\n                    <md-option value="1" translate="DASHBOARDS.CLOSED">CLOSED</md-option>\n                    <md-option ng-value="null" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_WEBSITE">Select an account</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.account" ng-change="vm.getChatInteractions()">\n                    <md-option ng-value="chatAccount.id" ng-repeat="chatAccount in vm.chatAccounts.rows">{{chatAccount.name}}</md-option>\n                    <md-option ng-value="null" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_AGENT">Select an agent</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.UserId" ng-change="vm.getChatInteractions()">\n                    <md-option ng-value="vm.user.id" translate="DASHBOARDS.ME"></md-option>\n                    <md-option ng-value="\'null\'" translate="DASHBOARDS.NOT_ASSIGNED"></md-option>\n                    <md-option ng-value="undefined" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_TAG">Select a tag</span>\n                <md-select id="tags" placeholder="Tags" multiple="true" class="font-size-12 no-margin" ng-model="vm.query.tag" ng-change="vm.getChatInteractions()" style="color:white;">\n                    <md-option ng-repeat="tag in vm.tags.rows" ng-value="tag.id">{{tag.name}}</md-option>\n                </md-select>\n            </div>\n            <div layout="column">\n                <md-button class="md-icon-button interaction-reload" 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-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.getChatInteractions">\n                <tr md-row>\n                    <th md-column md-order-by="id">ID</th>\n                    <th md-column style="width:15px">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                    </th>\n                    <th md-column style="width:180px">{{\'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 style="width:80px">{{\'DASHBOARDS.AGENT\' | translate}}</th>\n                    <th md-column>{{\'DASHBOARDS.WEBSITE\' | 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.chatInteractions.rows.length">\n                    <td md-cell colspan="10">\n                        <div layout="row" layout-align="center center">\n                            <span tranlsate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available Interaction</span>\n                        </div>\n                    </td>\n                </tr>\n                <tr md-row ng-repeat="chatInteraction in vm.chatInteractions.rows" ng-class="{\'text-bold text-italic\': chatInteraction.unread}">\n                    <td ng-click="vm.showChatInteraction($event, chatInteraction)" md-cell class="id">\n                        <div layout="row" layout-align="start center">\n                            <span class="font-size-10">{{chatInteraction.id}}</span>\n                        </div>\n                    </td>\n                    <td md-cell>\n                        <div ng-if="!chatInteraction.closed && chatInteraction.Users.length">\n                            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                            <md-tooltip>\n                                <span ng-repeat="u in chatInteraction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : vm.usersByKey[u.id].fullname | translate }}<span ng-if="!$last">, </span></span>\n                            </md-tooltip>\n                        </div>\n                    </td>\n                    <td ng-click="vm.showChatInteraction($event, chatInteraction)" md-cell>\n                        <div layout="row" layout-align="start center">\n                            <div layout="column">\n                                <span ng-if="!chatInteraction.closed && chatInteraction.unread" class="badge white-fg" ng-class="vm.getColorByChannel(\'chat\')" layout-margin>{{chatInteraction.unread}}</span>\n                                <md-icon ng-if="chatInteraction.attach" md-font-icon="icon-paperclip" class="s16"></md-icon>\n                            </div>\n                            <span class="font-size-12 text-truncate" style="width:180px" layout-margin>{{vm.getContactLabel(chatInteraction)}}</span>\n                        </div>\n                    </td>\n                    <td ng-click="vm.showChatInteraction($event, chatInteraction)" md-cell>\n                        <span class="font-size-10 text-truncate">{{chatInteraction.createdAt | formatdate }}</span>\n                    </td>\n                    <td ng-click="vm.showChatInteraction($event, chatInteraction)" md-cell>\n                        <div layout="row" ng-if="chatInteraction.lastMsgAt">\n                            <span>\n                                <md-icon md-font-icon="{{chatInteraction.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="font-size-10 text-truncate">{{chatInteraction.lastMsgAt | formatdate }}</span>\n                            </div </div> <span ng-if="!chatInteraction.lastMsgAt">No messages</span>\n                    </td>\n                    <td ng-click="vm.showChatInteraction($event, chatInteraction)" md-cell>\n                        <span ng-if="chatInteraction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="chatInteraction.disposition">- {{chatInteraction.disposition}}</span></span>\n                        <md-tooltip ng-if="chatInteraction.closed">{{chatInteraction.closedAt | formatdate }}</md-tooltip>\n                        <span ng-if="!chatInteraction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="chatInteraction.substatus"> - {{chatInteraction.substatus}}</span></span>\n                    </td>\n                    <td ng-click="vm.showChatInteraction($event, chatInteraction)" md-cell class="user">\n                        <span class="font-size-12 text-truncate" style="width:120px">{{vm.getUserLabel(chatInteraction)}}</span>\n                    </td>\n                    <td ng-click="vm.showChatInteraction($event, chatInteraction)" md-cell class="chatAccount">\n                        {{ vm.getChatWebsiteLabel(chatInteraction) }}\n                    </td>\n                    <td md-cell>\n                        <div ng-if="chatInteraction.Tags.length">\n                            <div ng-if="chatInteraction.Tags.length == 1" layout="column" layout-align="center center">\n                                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': chatInteraction.Tags[0].color }"></md-icon>\n                                <span class="text-truncate">{{chatInteraction.Tags[0].name}}</span>\n                            </div>\n                            <div ng-if="chatInteraction.Tags.length > 1" layout="column" layout-align="center center">\n                                <md-tooltip md-direction="left" layout="row">\n                                    <span ng-repeat="tag in chatInteraction.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">\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="2">\n                                <md-menu-item>\n                                    <md-button ng-click="vm.showChatInteraction($event, chatInteraction)" translate="DASHBOARDS.SHOW">\n                                        Show Chat\n                                    </md-button>\n                                </md-menu-item>\n                                <md-menu-item>\n                                    <md-button ng-click="vm.downloadChatInteraction($event, chatInteraction)" translate="DASHBOARDS.DOWNLOAD">\n                                        Download Chat\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: \'{{\'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>\n    <md-toolbar class="md-table-toolbar md-default table-header red-bg">\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.query.filter = query" on-collapse="vm.query.filter = undefined" debounce="300"></ms-search-bar>\n            <div flex></div>\n            <div layout="column">\n                <span class="font-size-10" translate="CONTACTMANAGER.SELECT_LIST">Select a list</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.ListId" ng-change="vm.getContacts()">\n                    <md-option ng-value="vm.defaultLists" ng-if="vm.lists.count > 1"><em translate="CONTACTMANAGER.ALL_CONTACTS">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            </div>\n            <div layout="column">\n                <span class="font-size-10" translate="CONTACTMANAGER.SELECT_TAG">Select a tag</span>\n                <md-select id="tags" placeholder="Tags" multiple="true" class="font-size-12 no-margin" ng-model="vm.query.tag" ng-change="vm.getContacts()" style="color:white;">\n                    <md-option ng-repeat="tag in vm.tags.rows" ng-value="tag.id">{{tag.name}}</md-option>\n                </md-select>\n            </div>\n            <md-button class="md-icon-button interaction-reload" 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-button>\n            <md-button ng-if="vm.crudPermissions.canEdit" class="md-icon-button interaction-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    </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">ID</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="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 tranlsate="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">{{contact.firstName}} {{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($event, 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">{{contact.fax}}</td>\n                    <td ng-click="vm.openContact(contact.id)" md-cell class="email">{{contact.email}}</td>\n                    <td ng-click="vm.openContact(contact.id)" md-cell class="list">{{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">, </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="Voice">\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="Bull">\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="Chat">\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="Email">\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="Sms">\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="Open Channel">\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="Fax">\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-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" ngCloak>\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 tranlsate="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 tranlsate="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>{{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></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" ngCloak>\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                        \x3c!-- <th md-column>{{ \'VOICE.ACTIVE\' | translate }}</th> --\x3e\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_chat.getSize(vm_chat.chatQueues)">\n                        <td md-cell colspan="2">\n                            <div layout="row" layout-align="center center">\n                                <span tranlsate="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                        \x3c!-- <td md-cell class="dialActive ">\n                            <md-icon ng-if="queue.type === \'outbound\'" md-colors="{color: {{queue.dialActive ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{queue.dialActive ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                            <md-icon ng-if="queue.type === \'inbound\'" md-colors="{color: \'green\'}" md-font-icon="icon-check"></md-icon>\n                        </td> --\x3e\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 tranlsate="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" ngCloak>\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                        \x3c!-- <th md-column>{{ \'VOICE.ACTIVE\' | translate }}</th> --\x3e\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_fax.getSize(vm_fax.faxQueues)">\n                        <td md-cell colspan="2">\n                            <div layout="row" layout-align="center center">\n                                <span tranlsate="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                        \x3c!-- <td md-cell class="dialActive ">\n                            <md-icon ng-if="queue.type === \'outbound\'" md-colors="{color: {{queue.dialActive ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{queue.dialActive ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                            <md-icon ng-if="queue.type === \'inbound\'" md-colors="{color: \'green\'}" md-font-icon="icon-check"></md-icon>\n                        </td> --\x3e\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 tranlsate="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" ngCloak>\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                        \x3c!-- <th md-column>{{ \'VOICE.ACTIVE\' | translate }}</th> --\x3e\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_mail.getSize(vm_mail.mailQueues)">\n                        <td md-cell colspan="2">\n                            <div layout="row" layout-align="center center">\n                                <span tranlsate="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                        \x3c!-- <td md-cell class="dialActive ">\n                            <md-icon ng-if="queue.type === \'outbound\'" md-colors="{color: {{queue.dialActive ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{queue.dialActive ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                            <md-icon ng-if="queue.type === \'inbound\'" md-colors="{color: \'green\'}" md-font-icon="icon-check"></md-icon>\n                        </td> --\x3e\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 tranlsate="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" ngCloak>\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                        \x3c!-- <th md-column>{{ \'VOICE.ACTIVE\' | translate }}</th> --\x3e\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_openchannel.getSize(vm_openchannel.openchannelQueues)">\n                        <td md-cell colspan="2">\n                            <div layout="row" layout-align="center center">\n                                <span tranlsate="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                        \x3c!-- <td md-cell class="dialActive ">\n                            <md-icon ng-if="queue.type === \'outbound\'" md-colors="{color: {{queue.dialActive ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{queue.dialActive ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                            <md-icon ng-if="queue.type === \'inbound\'" md-colors="{color: \'green\'}" md-font-icon="icon-check"></md-icon>\n                        </td> --\x3e\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 tranlsate="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" ngCloak>\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                        \x3c!-- <th md-column>{{ \'VOICE.ACTIVE\' | translate }}</th> --\x3e\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_sms.getSize(vm_sms.smsQueues)">\n                        <td md-cell colspan="2">\n                            <div layout="row" layout-align="center center">\n                                <span tranlsate="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                        \x3c!-- <td md-cell class="dialActive ">\n                            <md-icon ng-if="queue.type === \'outbound\'" md-colors="{color: {{queue.dialActive ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{queue.dialActive ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                            <md-icon ng-if="queue.type === \'inbound\'" md-colors="{color: \'green\'}" md-font-icon="icon-check"></md-icon>\n                        </td> --\x3e\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 tranlsate="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" ngCloak>\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 tranlsate="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 tranlsate="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>{{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></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 ngCloak>\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm.getColorByChannel(\'fax\')">\n        <div class="md-toolbar-tools">\n            <span class="md-subhead" translate="DASHBOARDS.INTERACTIONS">Interactions</span>\n            <ms-search-bar on-search="vm.query.filter = query" on-collapse="vm.query.filter = undefined" debounce="300"></ms-search-bar>\n            <div flex></div>\n            <div class="padding-horizontal-20" layout="column" layout-align="center center">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_DATE">Select a date</span>\n                <div layout="row" layout-align="center center">\n                    <md-button ng-if="vm.pickerModel.dateStart" ng-click="vm.clearAll()" class="md-icon-button no-padding width-20 height-20">\n                        <md-tooltip>{{ \'DASHBOARDS.DELETE\' | translate }}</md-tooltip>\n                        <md-icon md-font-icon="icon-close" class="s16 white-fg"></md-icon>\n                    </md-button>\n                    <md-date-range localization-map="vm.localizationMap" ng-model="vm.pickerModel" auto-confirm="true" show-template="true" md-on-select="vm.getFaxInteractions()" placeholder="{{ \'DASHBOARDS.ALL\' | translate }}"></md-date-range>\n                </div>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_READ_UNREAD">Select Read/Unread</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.read" ng-change="vm.getFaxInteractions()">\n                    <md-option value="0" translate="DASHBOARDS.UNREAD">READ</md-option>\n                    <md-option value="1" translate="DASHBOARDS.READ">UNREAD</md-option>\n                    <md-option ng-value="null" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_STATUS">Select a status</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.closed" ng-change="vm.getFaxInteractions()">\n                    <md-option value="0" translate="DASHBOARDS.OPENED">OPENED</md-option>\n                    <md-option value="1" translate="DASHBOARDS.CLOSED">CLOSED</md-option>\n                    <md-option ng-value="null" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_ACCOUNT">Select an account</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.account" ng-change="vm.getFaxInteractions()">\n                    <md-option ng-value="faxAccount.id" ng-repeat="faxAccount in vm.faxAccounts.rows">{{faxAccount.name}}</md-option>\n                    <md-option ng-value="null" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_AGENT">Select an agent</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.UserId" ng-change="vm.getFaxInteractions()">\n                    <md-option ng-value="vm.user.id" translate="DASHBOARDS.ME"></md-option>\n                    <md-option ng-value="\'null\'" translate="DASHBOARDS.NOT_ASSIGNED"></md-option>\n                    <md-option ng-value="undefined" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_TAG">Select a tag</span>\n                <md-select id="tags" placeholder="Tags" multiple="true" class="font-size-12 no-margin" ng-model="vm.query.tag" ng-change="vm.getFaxInteractions()" style="color:white;">\n                    <md-option ng-repeat="tag in vm.tags.rows" ng-value="tag.id">{{tag.name}}</md-option>\n                </md-select>\n            </div>\n            <div layout="column">\n                <md-button class="md-icon-button interaction-reload" 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-button>\n            </div>\n            <md-menu ng-if="vm.faxAccounts.rows && vm.faxAccounts.rows.length">\n                <md-button class="md-icon-button interaction-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)">{{ 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>\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 md-column md-order-by="id">ID</th>\n                    <th md-column style="width:15px">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                    </th>\n                    <th md-column style="width:180px">{{\'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 style="width:80px">{{\'DASHBOARDS.AGENT\' | translate}}</th>\n                    <th md-column>{{\'DASHBOARDS.ACCOUNT\' | 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.faxInteractions.rows.length">\n                    <td md-cell colspan="10">\n                        <div layout="row" layout-align="center center">\n                            <span tranlsate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available Interaction</span>\n                        </div>\n                    </td>\n                </tr>\n                <tr md-row ng-repeat="faxInteraction in vm.faxInteractions.rows" ng-class="{\'text-bold text-italic\': faxInteraction.unread}">\n                    <td ng-click="vm.showFaxInteraction($event, faxInteraction)" md-cell class="id">\n                        <div layout="row" layout-align="start center">\n                            <span class="font-size-10">{{faxInteraction.id}}</span>\n                        </div>\n                    </td>\n                    <td md-cell>\n                        <div ng-if="!faxInteraction.closed && faxInteraction.Users.length">\n                            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                            <md-tooltip>\n                                <span ng-repeat="u in faxInteraction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : vm.usersByKey[u.id].fullname | translate }}<span ng-if="!$last">, </span></span>\n                            </md-tooltip>\n                        </div>\n                    </td>\n                    <td ng-click="vm.showFaxInteraction($event, faxInteraction)" md-cell>\n                        <div layout="row" layout-align="start center">\n                            <div layout="column">\n                                <span ng-if="!faxInteraction.closed && faxInteraction.unread" class="badge white-fg" ng-class="vm.getColorByChannel(\'fax\')" layout-margin>{{faxInteraction.unread}}</span>\n                                <md-icon ng-if="faxInteraction.attach" md-font-icon="icon-paperclip" class="s16"></md-icon>\n                            </div>\n                            <span class="font-size-12 text-truncate" style="width:180px" layout-margin>{{vm.getContactLabel(faxInteraction)}}</span>\n                        </div>\n                    </td>\n                    <td ng-click="vm.showFaxInteraction($event, faxInteraction)" md-cell>\n                        <span class="font-size-10 text-truncate">{{faxInteraction.createdAt | formatdate }}</span>\n                    </td>\n                    <td ng-click="vm.showFaxInteraction($event, faxInteraction)" md-cell>\n                        <div layout="row" ng-if="faxInteraction.lastMsgAt">\n                            <span>\n                                <md-icon md-font-icon="{{faxInteraction.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="font-size-10 text-truncate">{{faxInteraction.lastMsgAt | formatdate }}</span>\n                            </div </div> <span ng-if="!faxInteraction.lastMsgAt">No messages</span>\n                    </td>\n                    <td ng-click="vm.showFaxInteraction($event, faxInteraction)" md-cell>\n                        <span ng-if="faxInteraction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="faxInteraction.disposition">- {{faxInteraction.disposition}}</span></span>\n                        <md-tooltip ng-if="faxInteraction.closed">{{faxInteraction.closedAt | formatdate }}</md-tooltip>\n                        <span ng-if="!faxInteraction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="faxInteraction.substatus"> - {{faxInteraction.substatus}}</span></span>\n                    </td>\n                    <td ng-click="vm.showFaxInteraction($event, faxInteraction)" md-cell class="user">\n                        <span class="font-size-12 text-truncate" style="width:120px">{{vm.getUserLabel(faxInteraction)}}</span>\n                    </td>\n                    <td ng-click="vm.showFaxInteraction($event, faxInteraction)" md-cell class="faxAccount">\n                        {{ vm.getFaxAccountLabel(faxInteraction) }}\n                    </td>\n                    <td md-cell>\n                        <div ng-if="faxInteraction.Tags.length">\n                            <div ng-if="faxInteraction.Tags.length == 1" layout="column" layout-align="center center">\n                                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': faxInteraction.Tags[0].color }"></md-icon>\n                                <span class="text-truncate">{{faxInteraction.Tags[0].name}}</span>\n                            </div>\n                            <div ng-if="faxInteraction.Tags.length > 1" layout="column" layout-align="center center">\n                                <md-tooltip md-direction="left" layout="row">\n                                    <span ng-repeat="tag in faxInteraction.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">\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="2">\n                                <md-menu-item>\n                                    <md-button ng-click="vm.showFaxInteraction($event, faxInteraction)" translate="DASHBOARDS.SHOW">\n                                        Show Fax\n                                    </md-button>\n                                </md-menu-item>\n                                <md-menu-item>\n                                    <md-button ng-click="vm.downloadFaxInteraction($event, faxInteraction)" translate="DASHBOARDS.DOWNLOAD">\n                                        Download Fax\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: \'{{\'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 ngCloak>\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm.getColorByChannel(\'mail\')">\n        <div class="md-toolbar-tools">\n            <span class="md-subhead" translate="DASHBOARDS.INTERACTIONS">Interactions</span>\n            <ms-search-bar on-search="vm.query.filter = query" on-collapse="vm.query.filter = undefined" debounce="300"></ms-search-bar>\n            <div flex></div>\n            <div class="padding-horizontal-20" layout="column" layout-align="center center">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_DATE">Select a date</span>\n                <div layout="row" layout-align="center center">\n                    <md-button ng-if="vm.pickerModel.dateStart" ng-click="vm.clearAll()" class="md-icon-button no-padding width-20 height-20">\n                        <md-tooltip>{{ \'DASHBOARDS.DELETE\' | translate }}</md-tooltip>\n                        <md-icon md-font-icon="icon-close" class="s16 white-fg"></md-icon>\n                    </md-button>\n                    <md-date-range localization-map="vm.localizationMap" ng-model="vm.pickerModel" auto-confirm="true" show-template="true" md-on-select="vm.getMailInteractions()" placeholder="{{ \'DASHBOARDS.ALL\' | translate }}"></md-date-range>\n                </div>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_READ_UNREAD">Select Read/Unread</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.read" ng-change="vm.getMailInteractions()">\n                    <md-option value="0" translate="DASHBOARDS.UNREAD">READ</md-option>\n                    <md-option value="1" translate="DASHBOARDS.READ">UNREAD</md-option>\n                    <md-option ng-value="null" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_STATUS">Select a status</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.closed" ng-change="vm.getMailInteractions()">\n                    <md-option value="0" translate="DASHBOARDS.OPENED">OPENED</md-option>\n                    <md-option value="1" translate="DASHBOARDS.CLOSED">CLOSED</md-option>\n                    <md-option ng-value="null" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column" ng-if="vm.query.closed == 0">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_SUBSTATUS">Select a sub status</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.substatus" ng-change="vm.getMailInteractions()">\n                    <md-option ng-repeat="subStatus in vm.subStatuses.rows" ng-value="subStatus.name">{{subStatus.name}}</md-option>\n                    <md-option ng-value="\'null\'" translate="DASHBOARDS.NONE"></md-option>\n                    <md-option ng-value="undefined" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_ACCOUNT">Select an account</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.account" ng-change="vm.getMailInteractions()">\n                    <md-option ng-value="mailAccount.id" ng-repeat="mailAccount in vm.mailAccounts.rows">{{mailAccount.name}}</md-option>\n                    <md-option ng-value="null" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_AGENT">Select an agent</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.UserId" ng-change="vm.getMailInteractions()">\n                    <md-option ng-value="vm.user.id" translate="DASHBOARDS.ME"></md-option>\n                    <md-option ng-value="\'null\'" translate="DASHBOARDS.NOT_ASSIGNED"></md-option>\n                    <md-option ng-value="undefined" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_TAG">Select a tag</span>\n                <md-select id="tags" placeholder="Tags" multiple="true" class="font-size-12 no-margin" ng-model="vm.query.tag" ng-change="vm.getMailInteractions()" style="color:white;">\n                    <md-option ng-repeat="tag in vm.tags.rows" ng-value="tag.id">{{tag.name}}</md-option>\n                </md-select>\n            </div>\n            <div layout="column">\n                <md-button class="md-icon-button interaction-reload" 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-button>\n            </div>\n            <md-menu ng-if="vm.mailAccounts.rows && vm.mailAccounts.rows.length">\n                <md-button class="md-icon-button interaction-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)">{{ 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>\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 md-column md-order-by="id">ID</th>\n                    <th md-column style="width:15px">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                    </th>\n                    <th md-column style="width:180px">{{\'DASHBOARDS.CONTACT\' | translate}}</th>\n                    <th md-column md-order-by="subject" style="width:200px">{{\'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 style="width:80px">{{\'DASHBOARDS.AGENT\' | translate}}</th>\n                    <th md-column>{{\'DASHBOARDS.ACCOUNT\' | 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.mailInteractions.rows.length">\n                    <td md-cell colspan="10">\n                        <div layout="row" layout-align="center center">\n                            <span tranlsate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available Interaction</span>\n                        </div>\n                    </td>\n                </tr>\n                <tr md-row ng-repeat="mailInteraction in vm.mailInteractions.rows" ng-class="{\'text-bold text-italic\': mailInteraction.unread}">\n                    <td ng-click="vm.showMailInteraction($event, mailInteraction)" md-cell class="id">\n                        <div layout="row" layout-align="start center">\n                            <span class="font-size-10">{{mailInteraction.id}}</span>\n                        </div>\n                    </td>\n                    <td md-cell>\n                        <div ng-if="!mailInteraction.closed && mailInteraction.Users.length">\n                            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                            <md-tooltip>\n                                <span ng-repeat="u in mailInteraction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : vm.usersByKey[u.id].fullname | translate }}<span ng-if="!$last">, </span></span>\n                            </md-tooltip>\n                        </div>\n                    </td>\n                    <td ng-click="vm.showMailInteraction($event, mailInteraction)" md-cell>\n                        <div layout="row" layout-align="start center">\n                            <div layout="column">\n                                <span ng-if="!mailInteraction.closed && mailInteraction.unread" class="badge white-fg" ng-class="vm.getColorByChannel(\'mail\')" layout-margin>{{mailInteraction.unread}}</span>\n                                <md-icon ng-if="mailInteraction.attach" md-font-icon="icon-paperclip" class="s16"></md-icon>\n                            </div>\n                            <span class="font-size-12 text-truncate" style="width:180px" layout-margin>{{vm.getContactLabel(mailInteraction)}}</span>\n                        </div>\n                    </td>\n                    <td ng-click="vm.showMailInteraction($event, mailInteraction)" md-cell>\n                        <div ng-if="vm.setting.enableEmailPreview && mailInteraction.lastMsgBody" class="tooltip-preview">\n                            <span class="text-truncate font-size-12" style="width:200px">{{mailInteraction.subject}}</span>\n                            <md-card class="tooltip-preview-text" ng-style="{top: \'-\' + ((($index % 10) + 1) * 18) + \'px\'}">\n                                <md-card-content>{{mailInteraction.lastMsgBody}}<br>...</md-card-content>\n                            </md-card>\n                        </div>\n                        <span ng-if="!mailInteraction.lastMsgBody || !vm.setting.enableEmailPreview" class="text-truncate font-size-12" style="width:200px">{{mailInteraction.subject}}</span>\n                    </td>\n                    <td ng-click="vm.showMailInteraction($event, mailInteraction)" md-cell>\n                        <span class="font-size-10 text-truncate">{{mailInteraction.createdAt | formatdate }}</span>\n                    </td>\n                    <td ng-click="vm.showMailInteraction($event, mailInteraction)" md-cell>\n                        <div layout="row" ng-if="mailInteraction.lastMsgAt">\n                            <span>\n                                <md-icon md-font-icon="{{mailInteraction.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="font-size-10 text-truncate">{{mailInteraction.lastMsgAt | formatdate }}</span>\n                            </div </div> <span ng-if="!mailInteraction.lastMsgAt">No messages</span>\n                    </td>\n                    <td ng-click="vm.showMailInteraction($event, mailInteraction)" md-cell>\n                        <span ng-if="mailInteraction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="mailInteraction.disposition">- {{mailInteraction.disposition}}</span></span>\n                        <md-tooltip ng-if="mailInteraction.closed">{{mailInteraction.closedAt | formatdate }}</md-tooltip>\n                        <span ng-if="!mailInteraction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="mailInteraction.substatus"> - {{mailInteraction.substatus}}</span></span>\n                    </td>\n                    <td ng-click="vm.showMailInteraction($event, mailInteraction)" md-cell class="user">\n                        <span class="font-size-12 text-truncate" style="width:120px">{{vm.getUserLabel(mailInteraction)}}</span>\n                    </td>\n                    <td ng-click="vm.showMailInteraction($event, mailInteraction)" md-cell class="mailAccount">\n                        {{ vm.getMailAccountLabel(mailInteraction) }}\n                    </td>\n                    <td md-cell>\n                        <div ng-if="mailInteraction.Tags.length">\n                            <div ng-if="mailInteraction.Tags.length == 1" layout="column" layout-align="center center">\n                                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': mailInteraction.Tags[0].color }"></md-icon>\n                                <span class="text-truncate">{{mailInteraction.Tags[0].name}}</span>\n                            </div>\n                            <div ng-if="mailInteraction.Tags.length > 1" layout="column" layout-align="center center">\n                                <md-tooltip md-direction="left" layout="row">\n                                    <span ng-repeat="tag in mailInteraction.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">\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="2">\n                                <md-menu-item>\n                                    <md-button ng-click="vm.showMailInteraction($event, mailInteraction)" translate="DASHBOARDS.SHOW">\n                                        Show Mail\n                                    </md-button>\n                                </md-menu-item>\n                                <md-menu-item>\n                                    <md-button ng-click="vm.downloadMailInteraction($event, mailInteraction, 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.downloadMailInteraction($event, mailInteraction)" translate="MAIL.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                                        Download without attachments\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: \'{{\'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 red-bg">\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.query.filter = query" on-collapse="vm.query.filter = undefined" debounce="300"></ms-search-bar>\n            <div flex></div>\n            <div layout="column">\n                <span class="font-size-10" translate="CONTACTMANAGER.SELECT_LIST">Select a list</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.ListId" ng-change="vm.getContacts()">\n                    <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">{{list.name}}</md-option>\n                    <md-option ng-value="vm.defaultLists" ng-if="vm.lists.count > 1"><em translate="CONTACTMANAGER.ALL_CONTACTS">All</em></md-option>\n                </md-select>\n            </div>\n            <div layout="column">\n                <span class="font-size-10" translate="CONTACTMANAGER.SELECT_TAG">Select a tag</span>\n                <md-select id="tags" placeholder="Tags" multiple="true" class="font-size-12 no-margin" ng-model="vm.query.tag" ng-change="vm.getContacts()" style="color:white;">\n                    <md-option ng-repeat="tag in vm.tags.rows" ng-value="tag.id">{{tag.name}}</md-option>\n                </md-select>\n            </div>\n            <md-button class="md-icon-button interaction-reload" 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-button>\n            <md-button class="md-icon-button interaction-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    </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">ID</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="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 tranlsate="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">{{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">{{contact.fax}}</td>\n                    <td ng-click="vm.openContact($event, contact)" md-cell class="email">{{contact.email}}</td>\n                    <td ng-click="vm.openContact($event, contact)" md-cell class="list">{{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">, </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\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 ngCloak>\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm.getColorByChannel(\'openchannel\')">\n        <div class="md-toolbar-tools">\n            <span class="md-subhead" translate="DASHBOARDS.INTERACTIONS">Interactions</span>\n            <ms-search-bar on-search="vm.query.filter = query" on-collapse="vm.query.filter = undefined" debounce="300"></ms-search-bar>\n            <div flex></div>\n            <div class="padding-horizontal-20" layout="column" layout-align="center center">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_DATE">Select a date</span>\n                <div layout="row" layout-align="center center">\n                    <md-button ng-if="vm.pickerModel.dateStart" ng-click="vm.clearAll()" class="md-icon-button no-padding width-20 height-20">\n                        <md-tooltip>{{ \'DASHBOARDS.DELETE\' | translate }}</md-tooltip>\n                        <md-icon md-font-icon="icon-close" class="s16 white-fg"></md-icon>\n                    </md-button>\n                    <md-date-range localization-map="vm.localizationMap" ng-model="vm.pickerModel" auto-confirm="true" show-template="true" md-on-select="vm.getOpenchannelInteractions()" placeholder="{{ \'DASHBOARDS.ALL\' | translate }}"></md-date-range>\n                </div>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_READ_UNREAD">Select Read/Unread</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.read" ng-change="vm.getOpenchannelInteractions()">\n                    <md-option value="0" translate="DASHBOARDS.UNREAD">READ</md-option>\n                    <md-option value="1" translate="DASHBOARDS.READ">UNREAD</md-option>\n                    <md-option ng-value="null" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_STATUS">Select a status</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.closed" ng-change="vm.getOpenchannelInteractions()">\n                    <md-option value="0" translate="DASHBOARDS.OPENED">OPENED</md-option>\n                    <md-option value="1" translate="DASHBOARDS.CLOSED">CLOSED</md-option>\n                    <md-option ng-value="null" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_ACCOUNT">Select an account</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.account" ng-change="vm.getOpenchannelInteractions()">\n                    <md-option ng-value="openchannelAccount.id" ng-repeat="openchannelAccount in vm.openchannelAccounts.rows">{{openchannelAccount.name}}</md-option>\n                    <md-option ng-value="null" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_AGENT">Select an agent</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.UserId" ng-change="vm.getOpenchannelInteractions()">\n                    <md-option ng-value="vm.user.id" translate="DASHBOARDS.ME"></md-option>\n                    <md-option ng-value="\'null\'" translate="DASHBOARDS.NOT_ASSIGNED"></md-option>\n                    <md-option ng-value="undefined" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_TAG">Select a tag</span>\n                <md-select id="tags" placeholder="Tags" multiple="true" class="font-size-12 no-margin" ng-model="vm.query.tag" ng-change="vm.getOpenchannelInteractions()" style="color:white;">\n                    <md-option ng-repeat="tag in vm.tags.rows" ng-value="tag.id">{{tag.name}}</md-option>\n                </md-select>\n            </div>\n            <div layout="column">\n                <md-button class="md-icon-button interaction-reload" 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-button>\n            </div>\n            <md-menu ng-if="vm.openchannelAccounts.rows && vm.openchannelAccounts.rows.length">\n                <md-button class="md-icon-button interaction-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)">{{ 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>\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 md-column md-order-by="id">ID</th>\n                    <th md-column style="width:15px">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                    </th>\n                    <th md-column style="width:180px">{{\'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 style="width:80px">{{\'DASHBOARDS.AGENT\' | translate}}</th>\n                    <th md-column>{{\'DASHBOARDS.ACCOUNT\' | 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.openchannelInteractions.rows.length">\n                    <td md-cell colspan="10">\n                        <div layout="row" layout-align="center center">\n                            <span tranlsate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available Interaction</span>\n                        </div>\n                    </td>\n                </tr>\n                <tr md-row ng-repeat="openchannelInteraction in vm.openchannelInteractions.rows" ng-class="{\'text-bold text-italic\': openchannelInteraction.unread}">\n                    <td ng-click="vm.showOpenchannelInteraction($event, openchannelInteraction)" md-cell class="id">\n                        <div layout="row" layout-align="start center">\n                            <span class="font-size-10">{{openchannelInteraction.id}}</span>\n                        </div>\n                    </td>\n                    <td md-cell>\n                        <div ng-if="!openchannelInteraction.closed && openchannelInteraction.Users.length">\n                            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                            <md-tooltip>\n                                <span ng-repeat="u in openchannelInteraction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : vm.usersByKey[u.id].fullname | translate }}<span ng-if="!$last">, </span></span>\n                            </md-tooltip>\n                        </div>\n                    </td>\n                    <td ng-click="vm.showOpenchannelInteraction($event, openchannelInteraction)" md-cell>\n                        <div layout="row" layout-align="start center">\n                            <div layout="column">\n                                <span ng-if="!openchannelInteraction.closed && openchannelInteraction.unread" class="badge white-fg" ng-class="vm.getColorByChannel(\'openchannel\')" layout-margin>{{openchannelInteraction.unread}}</span>\n                                <md-icon ng-if="openchannelInteraction.attach" md-font-icon="icon-paperclip" class="s16"></md-icon>\n                            </div>\n                            <span class="font-size-12 text-truncate" style="width:180px" layout-margin>{{vm.getContactLabel(openchannelInteraction)}}</span>\n                        </div>\n                    </td>\n                    <td ng-click="vm.showOpenchannelInteraction($event, openchannelInteraction)" md-cell>\n                        <span class="font-size-10 text-truncate">{{openchannelInteraction.createdAt | formatdate }}</span>\n                    </td>\n                    <td ng-click="vm.showOpenchannelInteraction($event, openchannelInteraction)" md-cell>\n                        <div layout="row" ng-if="openchannelInteraction.lastMsgAt">\n                            <span>\n                                <md-icon md-font-icon="{{openchannelInteraction.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="font-size-10 text-truncate">{{openchannelInteraction.lastMsgAt | formatdate }}</span>\n                            </div </div> <span ng-if="!openchannelInteraction.lastMsgAt">No messages</span>\n                    </td>\n                    <td ng-click="vm.showOpenchannelInteraction($event, openchannelInteraction)" md-cell>\n                        <span ng-if="openchannelInteraction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="openchannelInteraction.disposition">- {{openchannelInteraction.disposition}}</span></span>\n                        <md-tooltip ng-if="openchannelInteraction.closed">{{openchannelInteraction.closedAt | formatdate }}</md-tooltip>\n                        <span ng-if="!openchannelInteraction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="openchannelInteraction.substatus"> - {{openchannelInteraction.substatus}}</span></span>\n                    </td>\n                    <td ng-click="vm.showOpenchannelInteraction($event, openchannelInteraction)" md-cell class="user">\n                        <span class="font-size-12 text-truncate" style="width:120px">{{vm.getUserLabel(openchannelInteraction)}}</span>\n                    </td>\n                    <td ng-click="vm.showOpenchannelInteraction($event, openchannelInteraction)" md-cell class="openchannelAccount">\n                        {{ vm.getOpenchannelAccountLabel(openchannelInteraction) }}\n                    </td>\n                    <td md-cell>\n                        <div ng-if="openchannelInteraction.Tags.length">\n                            <div ng-if="openchannelInteraction.Tags.length == 1" layout="column" layout-align="center center">\n                                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': openchannelInteraction.Tags[0].color }"></md-icon>\n                                <span class="text-truncate">{{openchannelInteraction.Tags[0].name}}</span>\n                            </div>\n                            <div ng-if="openchannelInteraction.Tags.length > 1" layout="column" layout-align="center center">\n                                <md-tooltip md-direction="left" layout="row">\n                                    <span ng-repeat="tag in openchannelInteraction.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">\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="2">\n                                <md-menu-item>\n                                    <md-button ng-click="vm.showOpenchannelInteraction($event, openchannelInteraction)" translate="DASHBOARDS.SHOW">\n                                        Show Openchannel\n                                    </md-button>\n                                </md-menu-item>\n                                <md-menu-item>\n                                    <md-button ng-click="vm.downloadOpenchannelInteraction($event, openchannelInteraction)" translate="DASHBOARDS.DOWNLOAD">\n                                        Download Openchannel\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: \'{{\'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/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">\n        <div class="md-toolbar-tools">\n            <span class="md-subhead" translate="VOICE.RECORDINGS">Recordings</span>\n            <ms-search-bar on-search="vm.query.filter = query" on-collapse="vm.query.filter = undefined" debounce="300"></ms-search-bar>\n            <div flex></div>\n            <div class="padding-horizontal-20" layout="column" layout-align="center center">\n                <span class="font-size-10" translate="VOICE.SELECT_DATE">Select a date</span>\n                <div layout="row" layout-align="center center">\n                    <md-button ng-if="vm.pickerModel.dateStart" ng-click="vm.clearAll()" class="md-icon-button no-padding width-20 height-20">\n                        <md-tooltip>{{ \'VOICE.DELETE\' | translate }}</md-tooltip>\n                        <md-icon md-font-icon="icon-close" class="s16 white-fg"></md-icon>\n                    </md-button>\n                    <md-date-range localization-map="vm.localizationMap" ng-model="vm.pickerModel" auto-confirm="true" show-template="true" md-on-select="vm.getVoiceRecordings()" placeholder="{{ \'VOICE.ALL\' | translate }}"></md-date-range>\n                </div>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="VOICE.SELECT_TYPE">Select a type</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.type" ng-change="vm.getVoiceRecordings()">\n                    <md-option value="internal" translate="VOICE.INTERNAL">Internal</md-option>\n                    <md-option value="inbound" translate="VOICE.INBOUND">Inbound</md-option>\n                    <md-option value="outbound" translate="VOICE.OUTBOUND">Outbound</md-option>\n                    <md-option value="dialer" translate="VOICE.DIALER">Dialer</md-option>\n                    <md-option ng-value="null" translate="VOICE.ALL">All</md-option>\n                </md-select>\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.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"></th>\n                </tr>\n            </thead>\n            <tbody md-body>\n                <tr md-row ng-hide="vm.voiceRecordings.rows.length">\n                    <td md-cell colspan="10">\n                        <div layout="row" layout-align="center center">\n                            <span tranlsate="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"></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"></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">\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-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></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">\n        <div class="md-toolbar-tools">\n            <span class="md-subhead" translate="MOTIONDIALER.SCHEDULED_CALLS">Scheduled Calls</span>\n            \x3c!-- <ms-search-bar on-search="vm.query.filter = query" on-collapse="vm.query.filter = undefined" debounce="300"></ms-search-bar> --\x3e\n            <div flex></div>\n            <div class="padding-horizontal-20" layout="column" layout-align="center center">\n                <span class="font-size-10" translate="MOTIONDIALER.SELECT_DATE">Select a date</span>\n                <div layout="row" layout-align="center center">\n                    <md-button ng-if="vm.pickerModel.dateStart" ng-click="vm.clearAll()" class="md-icon-button no-padding width-20 height-20">\n                        <md-tooltip>{{ \'VOICE.DELETE\' | translate }}</md-tooltip>\n                        <md-icon md-font-icon="icon-close" class="s16 white-fg"></md-icon>\n                    </md-button>\n                    <md-date-range localization-map="vm.localizationMap" ng-model="vm.pickerModel" auto-confirm="true" show-template="true" md-on-select="vm.getScheduledCalls()" placeholder="{{ \'MOTIONDIALER.ALL\' | translate }}"></md-date-range>\n                </div>\n            </div>\n            <div ng-if="vm.queueCampaigns.count" layout="column">\n                <span class="font-size-10" translate="MOTIONDIALER.SELECT_CAMPAIGN">Select a Campaign</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.VoiceQueueId" ng-change="vm.getScheduledCalls()">\n                    <md-option ng-value="undefined"><em translate="MOTIONDIALER.ALL">All</em></md-option>\n                    <md-option ng-value="queueCampaign.id" ng-repeat="queueCampaign in vm.queueCampaigns.rows">{{queueCampaign.name}}</md-option>\n                </md-select>\n            </div>\n            \x3c!-- <div layout="column">\n                        <span class="font-size-10" translate="MOTIONDIALER.SELECT_TYPE">Select type</span>\n                        <md-select class="font-size-12 no-margin" ng-model="vm.query.recallme" ng-change="vm.getScheduledCalls()">\n                            <md-option ng-value="undefined"><em translate="MOTIONDIALER.ALL">All</em></md-option>\n                            <md-option ng-value="1" translate="MOTIONDIALER.RECALLME">Recall me</md-option>\n                            <md-option ng-value="0" translate="MOTIONDIALER.INQUEUE">Recall in queue</md-option>\n                        </md-select>\n                    </div> --\x3e\n            <md-button class="md-icon-button" ng-click="vm.getScheduledCalls()" aria-label="refresh scheuled 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 tranlsate="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>{{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\' }}"></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></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/sms/agent.general.sms.html",'<md-card ngCloak>\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm.getColorByChannel(\'sms\')">\n        <div class="md-toolbar-tools">\n            <span class="md-subhead" translate="DASHBOARDS.INTERACTIONS">Interactions</span>\n            <ms-search-bar on-search="vm.query.filter = query" on-collapse="vm.query.filter = undefined" debounce="300"></ms-search-bar>\n            <div flex></div>\n            <div class="padding-horizontal-20" layout="column" layout-align="center center">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_DATE">Select a date</span>\n                <div layout="row" layout-align="center center">\n                    <md-button ng-if="vm.pickerModel.dateStart" ng-click="vm.clearAll()" class="md-icon-button no-padding width-20 height-20">\n                        <md-tooltip>{{ \'DASHBOARDS.DELETE\' | translate }}</md-tooltip>\n                        <md-icon md-font-icon="icon-close" class="s16 white-fg"></md-icon>\n                    </md-button>\n                    <md-date-range localization-map="vm.localizationMap" ng-model="vm.pickerModel" auto-confirm="true" show-template="true" md-on-select="vm.getSmsInteractions()" placeholder="{{ \'DASHBOARDS.ALL\' | translate }}"></md-date-range>\n                </div>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_READ_UNREAD">Select Read/Unread</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.read" ng-change="vm.getSmsInteractions()">\n                    <md-option value="0" translate="DASHBOARDS.UNREAD">READ</md-option>\n                    <md-option value="1" translate="DASHBOARDS.READ">UNREAD</md-option>\n                    <md-option ng-value="null" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_STATUS">Select a status</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.closed" ng-change="vm.getSmsInteractions()">\n                    <md-option value="0" translate="DASHBOARDS.OPENED">OPENED</md-option>\n                    <md-option value="1" translate="DASHBOARDS.CLOSED">CLOSED</md-option>\n                    <md-option ng-value="null" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_ACCOUNT">Select an account</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.account" ng-change="vm.getSmsInteractions()">\n                    <md-option ng-value="smsAccount.id" ng-repeat="smsAccount in vm.smsAccounts.rows">{{smsAccount.name}}</md-option>\n                    <md-option ng-value="null" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_AGENT">Select an agent</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.UserId" ng-change="vm.getSmsInteractions()">\n                    <md-option ng-value="vm.user.id" translate="DASHBOARDS.ME"></md-option>\n                    <md-option ng-value="\'null\'" translate="DASHBOARDS.NOT_ASSIGNED"></md-option>\n                    <md-option ng-value="undefined" translate="DASHBOARDS.ALL"></md-option>\n                </md-select>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_TAG">Select a tag</span>\n                <md-select id="tags" placeholder="Tags" multiple="true" class="font-size-12 no-margin" ng-model="vm.query.tag" ng-change="vm.getSmsInteractions()" style="color:white;">\n                    <md-option ng-repeat="tag in vm.tags.rows" ng-value="tag.id">{{tag.name}}</md-option>\n                </md-select>\n            </div>\n            <div layout="column">\n                <md-button class="md-icon-button interaction-reload" 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-button>\n            </div>\n            <md-menu ng-if="vm.smsAccounts.rows && vm.smsAccounts.rows.length">\n                <md-button class="md-icon-button interaction-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)">{{ 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>\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 md-column md-order-by="id">ID</th>\n                    <th md-column style="width:15px">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                    </th>\n                    <th md-column style="width:180px">{{\'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 style="width:80px">{{\'DASHBOARDS.AGENT\' | translate}}</th>\n                    <th md-column>{{\'DASHBOARDS.ACCOUNT\' | 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.smsInteractions.rows.length">\n                    <td md-cell colspan="10">\n                        <div layout="row" layout-align="center center">\n                            <span tranlsate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available Interaction</span>\n                        </div>\n                    </td>\n                </tr>\n                <tr md-row ng-repeat="smsInteraction in vm.smsInteractions.rows" ng-class="{\'text-bold text-italic\': smsInteraction.unread}">\n                    <td ng-click="vm.showSmsInteraction($event, smsInteraction)" md-cell class="id">\n                        <div layout="row" layout-align="start center">\n                            <span class="font-size-10">{{smsInteraction.id}}</span>\n                        </div>\n                    </td>\n                    <td md-cell>\n                        <div ng-if="!smsInteraction.closed && smsInteraction.Users.length">\n                            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                            <md-tooltip>\n                                <span ng-repeat="u in smsInteraction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : vm.usersByKey[u.id].fullname | translate }}<span ng-if="!$last">, </span></span>\n                            </md-tooltip>\n                        </div>\n                    </td>\n                    <td ng-click="vm.showSmsInteraction($event, smsInteraction)" md-cell>\n                        <div layout="row" layout-align="start center">\n                            <div layout="column">\n                                <span ng-if="!smsInteraction.closed && smsInteraction.unread" class="badge white-fg" ng-class="vm.getColorByChannel(\'sms\')" layout-margin>{{smsInteraction.unread}}</span>\n                                <md-icon ng-if="smsInteraction.attach" md-font-icon="icon-paperclip" class="s16"></md-icon>\n                            </div>\n                            <span class="font-size-12 text-truncate" style="width:180px" layout-margin>{{vm.getContactLabel(smsInteraction)}}</span>\n                        </div>\n                    </td>\n                    <td ng-click="vm.showSmsInteraction($event, smsInteraction)" md-cell>\n                        <span class="font-size-10 text-truncate">{{smsInteraction.createdAt | formatdate }}</span>\n                    </td>\n                    <td ng-click="vm.showSmsInteraction($event, smsInteraction)" md-cell>\n                        <div layout="row" ng-if="smsInteraction.lastMsgAt">\n                            <span>\n                                <md-icon md-font-icon="{{smsInteraction.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="font-size-10 text-truncate">{{smsInteraction.lastMsgAt | formatdate }}</span>\n                            </div </div> <span ng-if="!smsInteraction.lastMsgAt">No messages</span>\n                    </td>\n                    <td ng-click="vm.showSmsInteraction($event, smsInteraction)" md-cell>\n                        <span ng-if="smsInteraction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="smsInteraction.disposition">- {{smsInteraction.disposition}}</span></span>\n                        <md-tooltip ng-if="smsInteraction.closed">{{smsInteraction.closedAt | formatdate }}</md-tooltip>\n                        <span ng-if="!smsInteraction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="smsInteraction.substatus"> - {{smsInteraction.substatus}}</span></span>\n                    </td>\n                    <td ng-click="vm.showSmsInteraction($event, smsInteraction)" md-cell class="user">\n                        <span class="font-size-12 text-truncate" style="width:120px">{{vm.getUserLabel(smsInteraction)}}</span>\n                    </td>\n                    <td ng-click="vm.showSmsInteraction($event, smsInteraction)" md-cell class="smsAccount">\n                        {{ vm.getSmsAccountLabel(smsInteraction) }}\n                    </td>\n                    <td md-cell>\n                        <div ng-if="smsInteraction.Tags.length">\n                            <div ng-if="smsInteraction.Tags.length == 1" layout="column" layout-align="center center">\n                                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': smsInteraction.Tags[0].color }"></md-icon>\n                                <span class="text-truncate">{{smsInteraction.Tags[0].name}}</span>\n                            </div>\n                            <div ng-if="smsInteraction.Tags.length > 1" layout="column" layout-align="center center">\n                                <md-tooltip md-direction="left" layout="row">\n                                    <span ng-repeat="tag in smsInteraction.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">\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="2">\n                                <md-menu-item>\n                                    <md-button ng-click="vm.showSmsInteraction($event, smsInteraction)" translate="DASHBOARDS.SHOW">\n                                        Show Sms\n                                    </md-button>\n                                </md-menu-item>\n                                <md-menu-item>\n                                    <md-button ng-click="vm.downloadSmsInteraction($event, smsInteraction)" translate="DASHBOARDS.DOWNLOAD">\n                                        Download Sms\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: \'{{\'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">\n        <div class="md-toolbar-tools">\n            <span class="md-subhead" translate="VOICE.CALLS">Calls</span>\n            <ms-search-bar on-search="vm.query.filter = query" on-collapse="vm.query.filter = undefined" debounce="300"></ms-search-bar>\n            <div flex></div>\n            <div class="padding-horizontal-20" layout="column" layout-align="center center">\n                <span class="font-size-10" translate="VOICE.SELECT_DATE">Select a date</span>\n                <div layout="row" layout-align="center center">\n                    <md-button ng-if="vm.pickerModel.dateStart" ng-click="vm.clearAll()" class="md-icon-button no-padding width-20 height-20">\n                        <md-tooltip>{{ \'VOICE.DELETE\' | translate }}</md-tooltip>\n                        <md-icon md-font-icon="icon-close" class="s16 white-fg"></md-icon>\n                    </md-button>\n                    <md-date-range localization-map="vm.localizationMap" ng-model="vm.pickerModel" auto-confirm="true" show-template="true" md-on-select="vm.getVoiceCalls()" placeholder="{{ \'VOICE.ALL\' | translate }}"></md-date-range>\n                </div>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="VOICE.SELECT_TYPE">Select a type</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.type" ng-change="vm.getVoiceCalls()">\n                    <md-option value="internal" translate="VOICE.INTERNAL">Internal</md-option>\n                    <md-option value="inbound" translate="VOICE.INBOUND">Inbound</md-option>\n                    <md-option value="outbound" translate="VOICE.OUTBOUND">Outbound</md-option>\n                    <md-option value="dialer" translate="VOICE.DIALER">Dialer</md-option>\n                    <md-option ng-value="null" translate="VOICE.ALL">All</md-option>\n                </md-select>\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.getVoiceCalls">\n                <tr md-row>\n                    <th md-column md-order-by="id">ID</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>{{ \'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="8">\n                        <div layout="row" layout-align="center center">\n                            <span tranlsate="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">{{voiceCall.type}}</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="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\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>{{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>{{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="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/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 }} </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\'"></md-toolbar>\n            \x3c!-- / TOOLBAR --\x3e\n\n            \x3c!-- CONTENT --\x3e\n            <md-content id="interaction-content" name="{{\'interaction-content-\' + vm.tab.id}}" flex ms-scroll 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\'"></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\'"></div>\n                    </div>\n                </div>\n            </md-content>\n            \x3c!-- / CONTENT --\x3e\n\n            \x3c!-- FOOTER --\x3e\n            <div ng-if="!vm.interaction.closed && vm.tab.channel != \'mail\' && vm.tab.channel !== \'fax\' && (vm.tab.channel != \'sms\' || !vm.tab.spy)" class="interaction-footer flex-noshrink" layout="row" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.footer.html\'"></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\'"></md-card>\n    </div>\n</md-content>\n\x3c!-- / CONTENT CARD --\x3e'),e.put("app/main/apps/dashboards/views/general/agent/interaction/composeFax/dialog.html",'<md-dialog class="compose-dialog-fax" 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\n        <md-dialog-content ms-scroll>\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                    \x3c!-- <input ng-model="vm.message.subject" type="text"> --\x3e\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\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\n                    <md-button class="md-icon-button" aria-label="Delete attachment" translate translate-attr-aria-label="FAX.DELETE_ATTACHMENT">\n                        \x3c!-- <md-icon md-font-icon="icon-close" class="s16"></md-icon> --\x3e\n                    </md-button>\n                </div>\n            </div>\n\n        </md-dialog-content>\n    </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/composeMail/dialog.html",'<md-dialog class="compose-dialog" aria-label="New Message" ng-style="{\n      \'max-width\':  {true: \'620px\', false: \'90%\'}[ vm.secret ],\n      \'width\': {true: \'620px\', false: \'100%\'}[ vm.secret ],\n      \'max-height\': {true: undefined, false: \'97%\'}[ vm.secret ]\n    }">\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\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" 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\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 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" 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\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\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" 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\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" 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\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">\n            </md-input-container>\n\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\n                    <md-button ng-click="vm.deleteAttachment(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\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\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\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">\n                <md-item-template>\n                    <md-icon ng-if="!item.MailAccountId" md-font-icon="icon-earth" aria-label="alert email" class="s16"></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 }} - {{ item.value | htmlToPlaintext }}</span>\n                </md-item-template>\n\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\n        </md-dialog-content>\n    </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/composeOpenchannel/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\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            <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\n            \x3c!-- msEmojyArea directive --\x3e\n            <ms-emoji-area on-reply="vm.reply(event, body)" ctrl-methods="vm.ctrlMethods" ng-model="vm.message.body" placeholder="\'OPENCHANNEL.INSERT_MESSAGE_HERE\'"></ms-emoji-area>\n            \x3c!-- / msEmojyArea directive --\x3e\n\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\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\n\n        </md-dialog-content>\n    </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/composeSms/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\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            <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\n            \x3c!-- msEmojyArea directive --\x3e\n            <ms-emoji-area on-reply="vm.reply(event, body)" ctrl-methods="vm.ctrlMethods" ng-model="vm.message.body" placeholder="\'SMS.INSERT_MESSAGE_HERE\'"></ms-emoji-area>\n            \x3c!-- / msEmojyArea directive --\x3e\n\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\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\n\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()">\n                    <md-icon 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="DASHBOARDS.DISPOSITIONS">Dispositions</label>\n                <md-select name="disposition" ng-model="vm.interaction.disposition" required>\n                    \x3c!-- <md-select ng-disabled="vm.interaction.closed && vm.interaction.disposition" name="disposition" ng-model="vm.interaction.disposition" required> --\x3e\n                    <md-option ng-value="null">NONE</md-option>\n                    <md-option ng-value="d.name" ng-repeat="d in vm.dispositions.rows">{{ d.name }}</md-option>\n                    <md-option ng-value="gd.name" ng-repeat="gd in vm.globalDispositions.rows">{{ gd.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\n            <md-input-container class="md-block">\n                <label translate="DASHBOARDS.NOTE">Note</label>\n                \x3c!-- <textarea ng-disabled="vm.interaction.closed && vm.interaction.disposition" ng-model="vm.interaction.note" md-maxlength="255" max-rows="5" autofocus></textarea> --\x3e\n                <textarea ng-model="vm.interaction.note" md-maxlength="255" max-rows="5" autofocus></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        \x3c!-- <md-dialog-actions ng-if="!vm.interaction.closed || !vm.interaction.disposition" layout="row" layout-align="space-between center"> --\x3e\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()" class="send-button md-accent md-raised" ng-if="!vm.interaction.closed && vm.interaction.disposition" 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)" class="send-button md-accent md-raised" ng-if="!vm.interaction.closed && !vm.interaction.disposition && !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()" class="send-button md-accent md-raised" ng-if="vm.interaction.closed" aria-label="DISPOSE" translate="DASHBOARDS.DISPOSE" translate-attr-aria-label="DASHBOARDS.DISPOSE">\n                    DISPOSE\n                </md-button>\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 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                <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\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            <md-input-container class="md-block">\n                <label translate="DASHBOARDS.TYPE">Type</label>\n                <md-select name="type" ng-model="vm.transfer.type" required>\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                <div ng-messages="transferForm.type.$error" ng-show="transferForm.type.$touched" role="alert">\n                    <div ng-message="required">\n                        <span translate="DASHBOARDS.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.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\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" ng-if="vm.currentUser.id != agent.id">{{ 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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n                    </md-button>\n                </div>\n            </div>\n        </md-dialog-content>\n\n        \x3c!-- <md-dialog-actions ng-if="!vm.interaction.closed || !vm.interaction.disposition" layout="row" layout-align="space-between center"> --\x3e\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" 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">Customer IP</p>\n            <h4>{{item.customerIp}}</h4>\n        </div>\n    </md-list-item>\n    <md-divider></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>\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>\n                    </md-input-container>\n\n                    <md-input-container ng-if="vm.tab.channel != \'fax\'" 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>\n                    </md-input-container>\n\n                    <md-input-container ng-if="vm.tab.channel == \'fax\'" 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>\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}} - <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\'"></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\'"></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\'"></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-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\'"></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\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\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\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\n    <div ng-if="item.ChatWebsiteId">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.chat.html\'"></div>\n    </div>\n    <div ng-if="item.MailAccountId">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.mail.html\'"></div>\n    </div>\n\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-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\n    <p class="padding-horizontal-15 grey-fg">Tags</p>\n    <md-list-item ng-if="item.Tags.length">\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",'<md-content layout="column" layout-align="end center">\n    <div layout-margin>\n        <md-input-container>\n            <md-select ng-model="vm.channel" placeholder="Channel">\n                <md-option ng-value="undefined" translate="DASHBOARDS.ALL">All</md-option>\n                <md-option ng-value="\'voice\'" translate="DASHBOARDS.VOICE">Voice</md-option>\n                <md-option ng-value="\'chat\'">Chat</md-option>\n                <md-option ng-value="\'mail\'">Mail</md-option>\n                <md-option ng-value="\'sms\'">Sms</md-option>\n                <md-option ng-value="\'fax\'">Fax</md-option>\n                <md-option ng-value="\'openchannel\'">Openchannel</md-option>\n            </md-select>\n        </md-input-container>\n    </div>\n    <div layout-margin layout="row" layout-align="space-between center">\n        <div flex-gt-xs>\n            <md-datepicker ng-model="vm.dateFrom" md-placeholder="Enter date"></md-datepicker>\n        </div>\n\n        <div flex-gt-xs>\n            <md-datepicker ng-model="vm.dateTo" md-placeholder="Enter date"></md-datepicker>\n        </div>\n    </div>\n</md-content>\n\n<div id="timeline" ms-timeline="vm.timelineOptions" layout="column" ng-if="vm.journey && vm.journey.length">\n    \x3c!-- TIMELINE ITEM --\x3e\n    <div class="ms-timeline-item" layout-align="center center" ng-repeat="item in vm.journey | getChannelByItem:vm.channel:vm.dateFrom:vm.dateTo | orderBy:\'-createdAt\'">\n        <div class="timeline-card">\n            <md-card class="channel" ng-class="{\'md-grey-200-bg\': item.id == vm.interaction.id}">\n                <div class="header p-6" layout="row" layout-align="space-between center">\n\n                    <md-button class="md-fab md-mini" aria-label="icon-channel" ng-class="vm.getColorByItem(item) + \'-bg\'">\n                        <md-icon ng-if="item.FaxAccountId" md-font-icon="icon-deskphone"></md-icon>\n                        <md-icon ng-if="item.OpenchannelAccountId" md-font-icon="icon-google-earth"></md-icon>\n                        <md-icon ng-if="item.SmsAccountId" md-font-icon="icon-message-text"></md-icon>\n                        <md-icon ng-if="item.MailAccountId" md-font-icon="icon-email"></md-icon>\n                        <md-icon ng-if="item.ChatWebsiteId" md-font-icon="icon-hangouts"></md-icon>\n                        <md-icon ng-if="item.amaflags" md-font-icon="icon-phone"></md-icon>\n                    </md-button>\n\n                    <div class="info" layout="column" ng-init="item.showMore = false">\n                        <span class="font-size-12 text-truncate">#{{item.id}} - {{ item.Account.key || item.destination }}</span>\n                        <span class="font-size-10">{{item.createdAt | date: \'medium\'}}</span>\n                        <span>\n                            <a class="toggle-details md-accent-color" ng-hide="item.showMore" ng-click="item.showMore = !item.showMore" translate="DASHBOARDS.SHOW_DETAILS">\n                                Show Details\n                            </a>\n                            <a class="toggle-details md-accent-color" ng-show="item.showMore" ng-click="item.showMore = !item.showMore" translate="DASHBOARDS.HIDE_DETAILS">\n                                Hide Details\n                            </a>\n                        </span>\n                    </div>\n\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\n                </div>\n\n                <div ng-if="item.showMore">\n                    <div ng-if="!item.amaflags" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.all.html\'"></div>\n                    <div ng-if="item.amaflags" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.voice.html\'"></div>\n                </div>\n\n                <md-divider></md-divider>\n\n                <div ng-if="item.id != vm.interaction.id" layout="row" layout-align="space-around center">\n                    <div ng-if="item.closed && !amaflags" class="text-truncate white-fg">\n                        <span class="text-boxed md-background-bg red-fg" title="{{ \'DASHBOARDS.STATUS\' | translate}}: {{ \'DASHBOARDS.CLOSED\' | translate}} ({{ item.disposition || (\'DASHBOARDS.NO_DISPOSITION_SET\' | translate)}})">{{ \'DASHBOARDS.STATUS\' | translate}}: {{ \'DASHBOARDS.CLOSED\' | translate}} ({{ item.disposition || (\'DASHBOARDS.NO_DISPOSITION_SET\' | translate) }})</span>\n                    </div>\n                    <span class="text-boxed md-background-bg green-fg" ng-if="!item.closed && !item.amaflags" title="{{ \'DASHBOARDS.STATUS\' | translate}}: {{ \'DASHBOARDS.OPENED\' | translate}}">{{ \'DASHBOARDS.STATUS\' | translate}}: {{ \'DASHBOARDS.OPENED\' | translate}}<span ng-if="item.substatus"> - {{ item.substatus }}</span></span>\n                    <span ng-if="item.amaflags" class="text-boxed md-background-bg red-fg" title="{{ \'DASHBOARDS.DISPOSITION\' | translate}}: {{ item.userDisposition || \'No Dispose\'}}">{{ \'DASHBOARDS.DISPOSITION\' | translate}}: {{ item.userDisposition || (\'DASHBOARDS.NO_DISPOSITION_SET\' | translate)}}</span>\n                    <div flex></div>\n                    <md-button ng-if="!vm.tab.spy && vm.user.role === \'agent\' && vm.isMyAccount(item)" ng-disabled="item.amaflags" class="md-icon-button" aria-label="go" ng-click="vm.openInteraction($event, item)">\n                        <md-icon md-font-icon="icon-open-in-new" class="s20"></md-icon>\n                    </md-button>\n\n                </div>\n            </md-card>\n        </div>\n    </div>\n    \x3c!-- / TIMELINE ITEM --\x3e\n</div>\n<div ng-if="!vm.journey || !vm.journey.length" 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>{{item.source ? item.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="DASHBOARDS.DESTINATION">Destination</p>\n            <h4>{{item.destination ? item.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="DASHBOARDS.CALLERID">Caller Id</p>\n            <h4>{{item.callerid ? item.callerid : \'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="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.UNIQUEID">Uniqueid</p>\n            <h4>{{item.uniqueid ? item.uniqueid : \'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="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 ng-if="item.threadId" translate="DASHBOARDS.PUBLIC">Public</h4>\n            <h4 ng-if="!item.threadId" translate="DASHBOARDS.PRIVATE">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                    {{ vm.getLabelByMessage(message) }} - {{message.createdAt | date: \'medium\'}}\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                {{ vm.getLabelByMessage(message) }} - {{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                    {{ vm.getLabelByMessage(message) }} - {{message.createdAt | date: \'medium\'}}\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 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>\n        <div ng-if="!message.AttachmentId" 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'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.interaction.mail.html",'<div ms-timeline="vm.timelineOptions" 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">\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></md-tooltip>\n                        <div layout="row" layout-align="start center">\n                            <md-icon md-font-icon="icon-paperclip" class="icon s24"></md-icon><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)">{{ 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]">[{{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)"><strong>{{message.from}}</strong>\n                                        <md-icon ng-if="message.attach" md-font-icon="icon-paperclip" class="s16"></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">{{ message.originTo || message.to }}</span></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"><em><span class="blue-grey" translate="MAIL.YOU_ARE_REGISTERED_AS_A">You are registered as a</span> <span class="blue-grey">CC</span></em></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"><em><span class="red-fg" translate="MAIL.YOU_ARE_REGISTERED_AS_A">You are registered as a</span> <span class="red-fg">BCC</span></em></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">{{message.from}}</span>\n                                    <span class="detail">{{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">{{ message.originCc }}</span>\n                                    <span class="detail" ng-if="message.direction === \'in\' && !message.originCc && !message.originTo && message.cc">{{ message.cc }}</span>\n                                    <span class="detail" ng-if="message.direction === \'out\' && message.cc">{{ message.cc }}</span>\n                                    \x3c!-- End retrocompatibility --\x3e\n                                    <span class="detail" ng-if="message.bcc">{{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\'">{{message.from.indexOf(vm.contact.email) >= 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 || 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                            \x3c!-- <md-button 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> --\x3e\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                            <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></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></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" class="md-icon-button" aria-label="forward" ng-click="vm.downloadMessage(message)">\n                                <md-tooltip md-direction="bottom"><span translate="MAIL.DOWNLOAD">Download</span></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" 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></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>\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">\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><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)">{{ 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>\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 interaction...</span>'),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>'),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"> - {{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" interval="1000">{{ days > 0 ? days + \'d\' : \'\' }} {{hhours}}:{{mminutes}}:{{sseconds}}</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\'"></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\'"></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\'"></div>\n            </div>\n        </div>\n        <md-button ng-if="vm.tab.channel !== \'mail\'" class="md-icon-button" aria-label="Download" ng-click="vm.downloadInteraction(vm.interaction)">\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>\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                <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",'<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>\n<md-menu 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></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>\n            <md-button ng-click="vm.downloadInteraction(vm.interaction, 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.downloadInteraction(vm.interaction)" translate="MAIL.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                Download without attachments\n            </md-button>\n        </md-menu-item>\n    </md-menu-content>\n</md-menu>'),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>'),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" interval="1000">{{ days > 0 ? days + \'d\' : \'\' }} {{hhours}}:{{mminutes}}:{{sseconds}}</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" class="page-layout simple right-sidenav" layout="row">\n    \x3c!-- CENTER --\x3e\n    <div class="center" flex ms-scroll>\n        \x3c!-- CONTENT --\x3e\n        <div class="content">\n            \x3c!--  NOTE: aggoiungere nel controller ng-if="vm.hasPermission()" --\x3e\n            <md-tabs ng-if="vm.hasPermission()" 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-tabs>\n        </div>\n        \x3c!-- END CONTENT --\x3e\n\n        <md-content ng-if="!vm.hasPermission()" 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>\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/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 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="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"></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 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="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" 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 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="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 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="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 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="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="inboundroute-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 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\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 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="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 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="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" 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 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="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 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="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/faxDispositions/dialog.html",'<md-dialog class="faxDisposition-dialog" aria-label="New FaxDisposition">\n    <form name="faxDispositionForm" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="FAX.NAME">Name</label>\n                <input type="" name="name" ng-model="vm.faxDisposition.name" ng-required="true" autofocus>\n\n                <div ng-messages="faxDispositionForm[\'name\'].$error" ng-show="faxDispositionForm[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.newFaxDisposition" ng-click="vm.saveFaxDisposition()" class="send-button md-accent md-raised" ng-disabled="faxDispositionForm.$invalid || faxDispositionForm.$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.newFaxDisposition" ng-click="vm.addNewFaxDisposition()" class="send-button md-accent md-raised" ng-disabled="faxDispositionForm.$invalid" aria-label="ADD" translate="FAX.ADD_FAXDISPOSITION" translate-attr-aria-label="FAX.ADD_FAXDISPOSITION">\n                    ADD FAXDISPOSITION\n                </md-button>\n            </div>\n            <div layout="row">\n                <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newFaxDisposition" ng-click="vm.deleteFaxDisposition($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/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" 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                            <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, 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" 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" 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 class="faxAccount-detail-form-container faxdispositions md-background-bg md-whiteframe-1dp">\n                        <div ng-controller="FaxAccountFaxDispositionsController as vm_dc" ng-init="vm_dc.init(vm.faxAccount, vm.crudPermissions)">\n                            <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedFaxAccountFaxDispositions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead" translate="FAX.FAXDISPOSITIONS">FaxDispositions</span>\n                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\n                                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditFaxAccountFaxDisposition($event)" aria-label="add faxDisposition" translate translate-attr-label="FAX.ADD_FAXDISPOSITION">\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.selectedFaxAccountFaxDispositions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead">{{vm_dc.selectedFaxAccountFaxDispositions.length}} {{vm_dc.selectedFaxAccountFaxDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                                    <div flex></div>\n                                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedFaxAccountFaxDispositions" 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.deleteSelectedFaxAccountFaxDispositions($event)" aria-label="delete selected" translate translate-attr-label="FAXACCOUNTS.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.selectedFaxAccountFaxDispositions" md-progress="vm_dc.promise">\n                                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getFaxAccountFaxDispositions">\n                                        <tr md-row>\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="createdAt">{{ \'FAX.CREATED_AT\' | translate }}</th>\n                                            <th md-column width="10px"></th>\n                                        </tr>\n                                    </thead>\n                                    <tbody md-body>\n                                        <tr md-row md-select="faxDisposition" md-select-id="id" ng-repeat="faxDisposition in vm_dc.faxAccountFaxDispositions.rows">\n                                            <td ng-click="vm_dc.createOrEditFaxAccountFaxDisposition($event, faxDisposition)" md-cell>{{faxDisposition.id}}</td>\n                                            <td ng-click="vm_dc.createOrEditFaxAccountFaxDisposition($event, faxDisposition)" md-cell>{{faxDisposition.name}}</td>\n                                            <td ng-click="vm_dc.createOrEditFaxAccountFaxDisposition($event, faxDisposition)" md-cell>{{faxDisposition.createdAt | date:\'medium\'}}</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\n                                                    <md-menu-content width="3">\n                                                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                                                            <md-button ng-click="vm_dc.createOrEditFaxAccountFaxDisposition($event, faxDisposition)" translate="FAX.EDIT_FAXDISPOSITION">\n                                                                Edit FaxDisposition\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(faxDisposition, $event)" translate="FAX.DELETE_FAXDISPOSITION">\n                                                                Delete FaxDisposition\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.faxAccountFaxDispositions.rows.length">\n                                            <td md-cell colspan="5">\n                                                <span class="text-boxed-ligth" translate="FAX.NO_FAXDISPOSITION_AVAILABLE">No faxdisposition available</span>\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.faxAccountFaxDispositions.count}}" md-on-paginate="vm_dc.getFaxAccountFaxDispositions" 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="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" ms-scroll 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.alias || a.appType) | uppercase}}">{{a.alias || 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" ms-scroll 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" style="width:200px">{{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-ligth" 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)">\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                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="FAXACCOUNTS.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.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">{{ \'FAX.ID\' | translate }}</th>\n                                            <th md-column md-order-by="createdAt">{{ \'FAX.STARTEDAT\' | translate }}</th>\n                                            <th md-column>{{ \'FAX.CONTACT\' | translate }}</th>\n                                            <th md-column>{{ \'FAX.AGENT\' | translate }}</th>\n                                            <th md-column md-order-by="closedAt">{{ \'FAX.CLOSEDAT\' | translate }}</th>\n                                            <th md-column md-order-by="disposition">{{ \'FAX.DISPOSITION\' | translate }}</th>\n                                            <th md-column md-order-by="note">{{ \'FAX.NOTES\' | translate }}</th>\n                                            <th md-column md-order-by="tag">{{ \'FAX.TAGS\' | translate }}</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">\n                                            <td md-cell>{{interaction.id}}</td>\n                                            <td md-cell>{{interaction.createdAt | date:\'medium\'}}</td>\n                                            <td md-cell>{{interaction.Contact.firstName}}</td>\n                                            <td md-cell>{{interaction.Owner.name}}</td>\n                                            <td md-cell>{{interaction.closedAt | date:\'medium\'}}</td>\n                                            <td md-cell>{{interaction.disposition}}</td>\n                                            <td md-cell>{{interaction.note}}</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"></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>\n                                                            <md-button class="md-primary" ng-click="vm_dc.faxInteractionDownload(interaction, $event)" translate="FAX.DOWNLOAD_INTERACTION">\n                                                                Download Interaction\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="13">\n                                                <span class="text-boxed-ligth" translate="FAX.NO_INTERACTION_AVAILABLE">No interaction available</span>\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 animate-slide-down 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="FAXACCOUNTS.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="FAXACCOUNTS.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!-- 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})[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                                <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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(faxAccount, $event)" translate="FAX.EDIT_FAXACCOUNT">\n                                                    Edit FaxAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.interactionsgoto(faxAccount, $event)" translate="FAX.INTERACTIONS_FAXACCOUNT">\n                                                    Interactions FaxAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.gotorealtimegoto(faxAccount, $event)" translate="FAX.GOTOREALTIME_FAXACCOUNT">\n                                                    goToRealtime FaxAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.agentadddialog(faxAccount, $event)" translate="FAX.AGENTADD_FAXACCOUNT">\n                                                    AgentAdd FaxAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(faxAccount, $event)" translate="FAX.DELETE_FAXACCOUNT">\n                                                    Delete FaxAccount\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            </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 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="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" 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"></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"></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" 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 animate-slide-down 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="FAXQUEUES.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="FAXQUEUES.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!-- 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                                <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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(faxQueue, $event)" translate="FAX.EDIT_FAXQUEUE">\n                                                    Edit FaxQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.teamadddialog(faxQueue, $event)" translate="FAX.TEAMADD_FAXQUEUE">\n                                                    teamadd FaxQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.agentadddialog(faxQueue, $event)" translate="FAX.AGENTADD_FAXQUEUE">\n                                                    agentadd FaxQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(faxQueue, $event)" translate="FAX.DELETE_FAXQUEUE">\n                                                    Delete FaxQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.gotorealtimegoto(faxQueue, $event)" translate="FAX.GOTOREALTIME_FAXQUEUE">\n                                                    goToRealtime FaxQueue\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.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.query.filter = 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.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">\n                <td md-cell colspan="4">\n                    <div layout="row" layout-align="center center">\n                        <span tranlsate="FAX.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-row md-select="vm.faxAccounts[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td md-cell>{{vm.faxAccounts[value].name}}</td>\n                <td md-cell>{{vm.faxAccounts[value].key}}</td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{(vm.faxAccounts[value].in || 0) + (vm.faxAccounts[value].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">{{vm.faxAccounts[value].in || 0}}</span>\n                        <span class="text-boxed" ng-if="mailAccount.in">{{vm.faxAccounts[value].lastIn ?  (vm.faxAccounts[value].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">{{vm.faxAccounts[value].out || 0}}</span>\n                        <span class="text-boxed" ng-if="mailAccount.out">{{vm.faxAccounts[value].lastOut ?  (vm.faxAccounts[value].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, vm.faxAccounts[value])" 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.count}}" md-on-paginate="vm.getfaxAccounts" md-page-select></md-table-pagination>\n\x3c!-- / AGENT TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/fax/views/realtime/agents/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.AGENTS">Agents</span>\n        <div flex></div>\n        <ms-search-bar on-search="vm.query.filter = query; vm.onInit()" on-collapse="vm.query.filter = undefined; vm.onInit()" debounce="300"></ms-search-bar>\n        <md-select ng-model="vm.query.globalStatusFilter" class="md-caption" ng-change="vm.query.pauseTypeFilter = \'\'; vm.onInit()">\n            <md-option ng-value="\'\'">{{ \'FAX.ALL\' | translate }}</md-option>\n            <md-option value="pause">{{ \'FAX.PAUSE\' | translate }}</md-option>\n            <md-option value="*pause">{{ \'FAX.PARTIALPAUSE\' | translate }}</md-option>\n            <md-option value="busy">{{ \'FAX.BUSY\' | translate }}</md-option>\n            <md-option value="idle">{{ \'FAX.IDLE\' | translate }}</md-option>\n        </md-select>\n\n        <md-select ng-if="vm.isPause(vm.query.globalStatusFilter)" ng-model="vm.query.pauseTypeFilter" class="md-caption" ng-change="vm.onInit()">\n            <md-option ng-value="\'\'">All</md-option>\n            <md-option value="DEFAULT PAUSE">DEFAULT PAUSE</md-option>\n            <md-option value="ACW">ACW</md-option>\n            <md-option value="LOGININPAUSE">LOGININPAUSE</md-option>\n            <md-option value="Auto-Pause">AUTOPAUSE</md-option>\n            <md-option ng-value="pause.name" ng-repeat="pause in vm.pauses.rows">{{pause.name}}</md-option>\n        </md-select>\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.order" md-on-reorder="vm.onInit">\n            <tr md-row border="1">\n                <th class="bv text-center" colspan="4">{{ \'FAX.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">{{ \'OPENCHANNEL.OPENCHANNEL\' | translate }}</th>\n                <th ng-if="vm.license.fax" class="bv bl text-center" colspan="2">{{ \'FAX.FAX\' | translate }}</th>\n                <th width="10px" class="bt bl" rowspan="2"></th>\n            </tr>\n            <tr md-row>\n                <th class="bl" md-column md-order-by="fullname">{{ \'FAX.NAME\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="globalStatus">{{ \'FAX.STATUS\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="lastLoginAt">{{ \'FAX.LOGIN_TIME\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="lastPauseAt">{{ \'FAX.PAUSE_TIME\' | translate }}</th>\n\n                <th class="bl custom-column">{{ \'VOICE.STATUS\' | translate }}</th>\n                <th class="bl custom-column">Info</th>\n\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\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\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\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\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            </tr>\n        </thead>\n        <tbody md-body>\n            <tr md-row ng-hide="vm.order.length">\n                <td md-cell colspan="17">\n                    <div layout="row" layout-align="center center">\n                        <span>{{ \'FAX.NO_AGENT_ONLINE\' | translate }}</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-select="vm.agents[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td class="bt padding-5">\n                    <div layout="row" layout-align="start center">\n                        <img class="avatar" ng-src="{{vm.agents[value].userpic && \'api/users/\'+vm.agents[value].id+\'/avatar\' || \'assets/images/avatars/profile.png\'}}">\n                        <div layout="column">\n                            <span>{{vm.agents[value].fullname}}</span>\n                            <span>{{vm.agents[value].internal}}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class="bt">\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'}[vm.agents[value].globalStatus]\">{{ vm.isPause(vm.agents[value].globalStatus) ? '' : vm.agents[value].globalStatus | uppercase }} {{ vm.isPause(vm.agents[value].globalStatus) ? (vm.isPartialPause(vm.agents[value].globalStatus) ? '*'+vm.agents[value].pauseType || 'DEFAULT PAUSE'  : vm.agents[value].pauseType || 'DEFAULT PAUSE') : ''}}</span>\n                </td>\n                <td class=\"bt custom-column\">\n                    <timer start-time=\"vm.agents[value].lastLoginAt\" interval=\"1000\">{{ days > 0 ? days + 'd' : '' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                </td>\n                <td class=\"bt custom-column\">\n                    <timer ng-if=\"vm.isPause(vm.agents[value].globalStatus) || vm.isPartialPause(vm.agents[value].globalStatus)\" start-time=\"vm.agents[value].lastPauseAt\" interval=\"1000\">{{ days > 0 ? days + 'd' : '' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                </td>\n                <td class=\"bt bl\">\n                    <div layout=\"row\">\n                        <span ng-if=\"!vm.agents[value].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'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].voiceStatus | uppercase }}</span>\n                        <span ng-if=\"vm.agents[value].onhold\" class=\"text-boxed md-background-bg bl bt padding-5 orange-400-bg\">ONHOLD</span>\n                    </div>\n                </td>\n                <td class=\"bt bl\">\n                    <div layout=\"column\">\n                        <span ng-if=\"vm.agents[value].queue\" class=\"padding-5\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].queue }}</span>\n                        <span ng-if=\"vm.agents[value].destconnectedlinenum\" class=\"padding-5\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].destconnectedlinenum }}</span>\n                        <span class=\"padding-5\" ng-if=\"vm.agents[value].queue || vm.agents[value].destconnectedlinenum\">\n                            <timer start-time=\"vm.agents[value].voiceStatusTime\" interval=\"1000\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                        </span>\n                    </div>\n                </td>\n                <td class=\"bt bl\" ng-if=\"vm.license.chat\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].chatStatus]\">{{ vm.agents[value].chatStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td md-number class=\"bt text-center font-size-20\" ng-if=\"vm.license.chat\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].chatStatus]\">{{ vm.agents[value].chatCurrentCapacity }}</td>\n                <td class=\"bl bt\" ng-if=\"vm.license.mail\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].mailStatus]\">{{ vm.agents[value].mailStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.mail\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].mailStatus]\">{{ vm.agents[value].mailCurrentCapacity }}</td>\n                <td class=\"bl bt\" ng-if=\"vm.license.messaging\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].smsStatus]\">{{ vm.agents[value].smsStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.messaging\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].smsStatus]\">{{ vm.agents[value].smsCurrentCapacity }}</td>\n                <td class=\"bt bl\" ng-if=\"vm.license.openchannel\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].openchannelStatus]\">{{ vm.agents[value].openchannelStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.openchannel\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].openchannelStatus]\">{{ vm.agents[value].openchannelCurrentCapacity }}</td>\n                <td class=\"bt bl\" ng-if=\"vm.license.fax\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].faxStatus]\">{{ vm.agents[value].faxStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.fax\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].faxStatus]\">{{ vm.agents[value].faxCurrentCapacity }}</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\n                        <md-menu-content width=\"4\">\n                            <md-menu-item>\n                                <md-button ng-click=\"vm.logout(vm.agents[value], $event)\" translate=\"FAX.LOGOUT\">\n                                    Logout\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-button ng-click=\"vm.queueAdd(vm.agents[value], $event)\" translate=\"FAX.AGENTADD_QUEUE\">\n                                    Add Agent In Queue\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-menu>\n                                    <md-button ng-click=\"$mdMenu.open()\" class=\"text-capitalize\" translate=\"FAX.PAUSE\">Pause</md-button>\n                                    <md-menu-content>\n                                        <md-menu-item>\n                                            <md-button ng-disabled=\" vm.agents[value].voicePause && 'DEFAULT PAUSE' === vm.agents[value].pauseType\" ng-click=\"vm.pause(vm.agents[value])\"><em translate=\"FAX.DEFAULT_PAUSE\">Default Pause</em></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=\"vm.agents[value].voicePause && pause.name === vm.agents[value].pauseType\" ng-click=\"vm.pause(vm.agents[value], pause.name)\">{{pause.name}}</md-button>\n                                        </md-menu-item>\n                                    </md-menu-content>\n                                </md-menu>\n                            </md-menu-item>\n                            <md-menu-item ng-if=\"vm.isPause(vm.agents[value].globalStatus)\">\n                                <md-button ng-click=\"vm.unPause(vm.agents[value])\" translate=\"FAX.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\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.filteredAgents.length}}\" md-on-paginate=\"vm.onInit\" md-page-select></md-table-pagination>\n\x3c!-- / AGENT TABLE --\x3e\n\x3c!-- / MAIN --\x3e"),e.put("app/main/apps/fax/views/realtime/queues/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.QUEUES">Queues</span>\n        <div flex></div>\n        <ms-search-bar on-search="vm.query.filter = 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">{{ \'FAX.NAME\' | translate }}</th>\n                <th md-column>{{ \'FAX.LOGGED_IN\' | translate }}</th>\n                <th md-column>{{ \'FAX.PAUSED\' | translate }}</th>\n                <th md-column>{{ \'FAX.READY\' | translate }}</th>\n                <th md-column>{{ \'FAX.WAITING\' | translate }}</th>\n                <th md-column width="10px"></th>\n            </tr>\n        </thead>\n        <tbody md-body>\n            <tr md-row ng-hide="vm.queues">\n                <td md-cell colspan="7">\n                    <div layout="row" layout-align="center center">\n                        <span tranlsate="FAX.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-row md-select="vm.queues[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td md-cell>{{vm.queues[value].name}}</td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].loggedInDb || 0}} ({{vm.queues[value].loggedIn || 0}})</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].paused || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-16 grey-fg">{{vm.queues[value].available || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].waiting || 0}}</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="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.createOrEditFaxQueue($event, vm.queues[value])" translate="FAX.EDIT_QUEUE">\n                                    Edit Queue\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-button ng-click="vm.agentAdd($event, vm.queues[value])" translate="FAX.AGENTSADD_QUEUE">\n                                    Add Agents to queue\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.getQueues" md-page-select></md-table-pagination>\n\x3c!-- / QUEUE 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.query.filter = query;" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n        \x3c!-- <md-button class="md-icon-button" ng-click="vm.showInfo($event)">\n      <i class="icon-information-outline grey-600-fg">\n        <md-tooltip>{{\'FAX.INFO\' | translate}}</md-tooltip>\n      </i>\n    </md-button> --\x3e\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>\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 tranlsate="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" ms-scroll>\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="http://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 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="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">\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 animate-slide-down 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="DESKACCOUNTS.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="DESKACCOUNTS.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!-- 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                                <td md-cell class="actions">\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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(deskAccount, $event)" translate="INTEGRATIONS.EDIT_DESKACCOUNT">\n                                                    Edit DeskAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.testtestintegrationaccount(deskAccount, $event)" translate="INTEGRATIONS.TEST_DESKACCOUNT">\n                                                    Test DeskAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(deskAccount, $event)" translate="INTEGRATIONS.DELETE_DESKACCOUNT">\n                                                    Delete DeskAccount\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: \'{{\'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 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="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 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 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" ng-if="!vm.customField.options.length">\n\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.item.type" required>\n\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"\n            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 == \'string\' && vm.customField.options.length">\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"\n            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\' && !vm.customField.options.length">\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"\n            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()"\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\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" 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 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="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            <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            <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" required>\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">\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            <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\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 animate-slide-down 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="DYNAMICS365ACCOUNTS.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="DYNAMICS365ACCOUNTS.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!-- 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="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.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="username ">{{dynamics365Account.username}}</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="remoteUri ">{{dynamics365Account.remoteUri}}</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="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.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(dynamics365Account, $event)" translate="INTEGRATIONS.EDIT_DYNAMICS365ACCOUNT">\n                                                    Edit Dynamics365Account\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.testtestintegrationaccount(dynamics365Account, $event)" translate="INTEGRATIONS.TEST_DYNAMICS365ACCOUNT">\n                                                    Test Dynamics365Account\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.deleteconfirm(dynamics365Account, $event)" translate="INTEGRATIONS.DELETE_DYNAMICS365ACCOUNT">\n                                                    Delete Dynamics365Account\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: \'{{\'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 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="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 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 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" ng-if="!vm.customField.options.length">\n\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.item.type" required>\n\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"\n            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 == \'string\' && vm.customField.options.length">\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"\n            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\' && !vm.customField.options.length">\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"\n            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()"\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\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                            <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\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.dynamics365Account.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.URI">Uri</label>\n                                <input type="url" name="remoteUri" ng-model="vm.dynamics365Account.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.TENANTID">TenantId</label>\n                                <input type="text" name="tenantId" ng-model="vm.dynamics365Account.tenantId" ng-required="true" 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="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.dynamics365Account.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.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                                <input type="url" name="serverUrl" ng-model="vm.dynamics365Account.serverUrl" 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.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            <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\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\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/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 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="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">\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 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="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 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 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" ng-if="!vm.customField.options.length">\n\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.item.type" required>\n\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"\n            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 == \'string\' && vm.customField.options.length">\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"\n            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\' && !vm.customField.options.length">\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"\n            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()"\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\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" 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 animate-slide-down 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="FRESHDESKACCOUNTS.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="FRESHDESKACCOUNTS.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!-- 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                                <td md-cell class="actions">\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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(freshdeskAccount, $event)" translate="INTEGRATIONS.EDIT_FRESHDESKACCOUNT">\n                                                    Edit FreshdeskAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.testtestintegrationaccount(freshdeskAccount, $event)" translate="INTEGRATIONS.TEST_FRESHDESKACCOUNT">\n                                                    Test FreshdeskAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(freshdeskAccount, $event)" translate="INTEGRATIONS.DELETE_FRESHDESKACCOUNT">\n                                                    Delete FreshdeskAccount\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: \'{{\'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/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 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="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">\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 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="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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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 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 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" ng-if="!vm.customField.options.length">\n\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.item.type" required>\n\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"\n            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 == \'string\' && vm.customField.options.length">\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"\n            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\' && !vm.customField.options.length">\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"\n            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()"\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\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" 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">ADVANCED</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: \'contact_lead\', value: \'Contact & Lead\'}, {key: \'contact\', value: \'Contact\'}, {key: \'lead\', value: \'Lead\'}]">{{ 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\'}]">{{ 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.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 animate-slide-down 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="SALESFORCEACCOUNTS.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="SALESFORCEACCOUNTS.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!-- 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                                <td md-cell class="actions">\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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(salesforceAccount, $event)" translate="INTEGRATIONS.EDIT_SALESFORCEACCOUNT">\n                                                    Edit SalesforceAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.testtestintegrationaccount(salesforceAccount, $event)" translate="INTEGRATIONS.TEST_SALESFORCEACCOUNT">\n                                                    Test SalesforceAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(salesforceAccount, $event)" translate="INTEGRATIONS.DELETE_SALESFORCEACCOUNT">\n                                                    Delete SalesforceAccount\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: \'{{\'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 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="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">\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 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="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 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 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" ng-if="!vm.customField.options.length">\n\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.item.type" required>\n\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"\n            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 == \'string\' && vm.customField.options.length">\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"\n            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\' && !vm.customField.options.length">\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"\n            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()"\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\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" 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                                    <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.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 animate-slide-down 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="SERVICENOWACCOUNTS.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="SERVICENOWACCOUNTS.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!-- 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                                <td md-cell class="actions">\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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(servicenowAccount, $event)" translate="INTEGRATIONS.EDIT_SERVICENOWACCOUNT">\n                                                    Edit ServicenowAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.testtestintegrationaccount(servicenowAccount, $event)" translate="INTEGRATIONS.TEST_SERVICENOWACCOUNT">\n                                                    Test ServicenowAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.deleteconfirm(servicenowAccount, $event)" translate="INTEGRATIONS.DELETE_SERVICENOWACCOUNT">\n                                                    Delete ServicenowAccount\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: \'{{\'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 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="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">\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 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="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 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 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" ng-if="!vm.customField.options.length">\n\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.item.type" required>\n\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"\n            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 == \'string\' && vm.customField.options.length">\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"\n            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\' && !vm.customField.options.length">\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"\n            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()"\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\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" 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 animate-slide-down 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="SUGARCRMACCOUNTS.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="SUGARCRMACCOUNTS.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!-- 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                                <td md-cell class="actions">\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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(sugarcrmAccount, $event)" translate="INTEGRATIONS.EDIT_SUGARCRMACCOUNT">\n                                                    Edit SugarcrmAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.testtestintegrationaccount(sugarcrmAccount, $event)" translate="INTEGRATIONS.TEST_SUGARCRMACCOUNT">\n                                                    Test SugarcrmAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.deleteconfirm(sugarcrmAccount, $event)" translate="INTEGRATIONS.DELETE_SUGARCRMACCOUNT">\n                                                    Delete SugarcrmAccount\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: \'{{\'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 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="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">\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 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="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 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 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" ng-if="!vm.customField.options.length">\n\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.item.type" required>\n\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"\n            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 == \'string\' && vm.customField.options.length">\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"\n            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\' && !vm.customField.options.length">\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"\n            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()"\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\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" 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 animate-slide-down 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="VTIGERACCOUNTS.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="VTIGERACCOUNTS.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!-- 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                                <td md-cell class="actions">\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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(vtigerAccount, $event)" translate="INTEGRATIONS.EDIT_VTIGERACCOUNT">\n                                                    Edit VtigerAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.testtestintegrationaccount(vtigerAccount, $event)" translate="INTEGRATIONS.TEST_VTIGERACCOUNT">\n                                                    Test VtigerAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(vtigerAccount, $event)" translate="INTEGRATIONS.DELETE_VTIGERACCOUNT">\n                                                    Delete VtigerAccount\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: \'{{\'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 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="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">\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 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 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" ng-if="!vm.customField.options.length">\n\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.item.type" required>\n\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"\n            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 == \'string\' && vm.customField.options.length">\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"\n            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\' && !vm.customField.options.length">\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"\n            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()"\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\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" 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 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="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 animate-slide-down 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="ZENDESKACCOUNTS.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="ZENDESKACCOUNTS.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!-- 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                                <td md-cell class="actions">\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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(zendeskAccount, $event)" translate="INTEGRATIONS.EDIT_ZENDESKACCOUNT">\n                                                    Edit ZendeskAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.testtestintegrationaccount(zendeskAccount, $event)" translate="INTEGRATIONS.TEST_ZENDESKACCOUNT">\n                                                    Test ZendeskAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(zendeskAccount, $event)" translate="INTEGRATIONS.DELETE_ZENDESKACCOUNT">\n                                                    Delete ZendeskAccount\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: \'{{\'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 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="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.AUTHTOKEN">AuthToken</label>\n                <input type="text" name="authToken" ng-model="vm.zohoAccount.authToken" ng-required="true">\n\n                <div ng-messages="zohoAccountForm[\'authToken\'].$error" ng-show="zohoAccountForm[\'authToken\'].$touched" role="alert">\n                    <div ng-message="required">\n                        <span translate="INTEGRATIONS.ERRORS.AUTHTOKEN_REQUIRED">AuthToken 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">\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 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="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 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 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" ng-if="!vm.customField.options.length">\n\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.item.type" required>\n\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"\n            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 == \'string\' && vm.customField.options.length">\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"\n            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\' && !vm.customField.options.length">\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"\n            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()"\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\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.AUTHTOKEN">AuthToken</label>\n                                <input type="text" name="authToken" ng-model="vm.zohoAccount.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="INTEGRATIONS.ERRORS.AUTHTOKEN_REQUIRED">AuthToken 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" 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\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 animate-slide-down 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="ZOHOACCOUNTS.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="ZOHOACCOUNTS.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!-- 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 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="4">\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 md-cell class="actions">\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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(zohoAccount, $event)" translate="INTEGRATIONS.EDIT_ZOHOACCOUNT">\n                                                    Edit ZohoAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.testtestintegrationaccount(zohoAccount, $event)" translate="INTEGRATIONS.TEST_ZOHOACCOUNT">\n                                                    Test ZohoAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(zohoAccount, $event)" translate="INTEGRATIONS.DELETE_ZOHOACCOUNT">\n                                                    Delete ZohoAccount\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: \'{{\'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 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="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 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="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 ms-scroll>\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-ligth" 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                                <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)">\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                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.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_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="PROJECTS.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.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">{{ \'JSCRIPTY.ID\' | translate }}</th>\n                                            <th md-column md-order-by="starttime">{{ \'JSCRIPTY.STARTTIME\' | translate }}</th>\n                                            <th md-column md-order-by="endtime">{{ \'JSCRIPTY.ENDTIME\' | translate }}</th>\n                                            <th md-column md-order-by="membername">{{ \'JSCRIPTY.MEMBERNAME\' | translate }}</th>\n                                            <th md-column md-order-by="calleridnum">{{ \'JSCRIPTY.CALLERIDNUM\' | translate }}</th>\n                                            <th md-column md-order-by="completed">{{ \'JSCRIPTY.COMPLETE\' | translate }}</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>{{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.calleridnum}}</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                                                <span class="text-boxed-ligth" translate="JSCRIPTY.NO_SESSION_AVAILABLE">No session available</span>\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)">\n                            <div class="pb-16" layout="row" layout-align="space-between center">\n                                <div class="h2 secondary-text" translate="JSCRIPTY.ANSWERS">Answers</div>\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-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 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-ligth" 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 animate-slide-down 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="PROJECTS.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="PROJECTS.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!-- 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                                <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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(project, $event)" translate="JSCRIPTY.EDIT_PROJECT">\n                                                    Edit Project\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.clonedialog(project, $event)" translate="JSCRIPTY.CLONE_PROJECT">\n                                                    clone Project\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.sessionsgoto(project, $event)" translate="JSCRIPTY.SESSIONS_PROJECT">\n                                                    Sessions Project\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.deleteconfirm(project, $event)" translate="JSCRIPTY.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: \'{{\'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.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="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="cservice" ng-model="vm.mailAccount.cservice" required>\n                    <md-option ng-value="null">Custom</md-option>\n                    <md-option ng-value="\'gmail\'">Gmail</md-option>\n                    <md-option ng-value="\'hotmail\'">Hotmail</md-option>\n                    <md-option ng-value="\'yahoo\'">Yahoo</md-option>\n                    <md-option ng-value="\'outlook365\'">Outlook365</md-option>\n                </md-select>\n                <div ng-messages="mailAccountForm[\'cservice\'].$error" ng-show="mailAccountForm[\'cservice\'].$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            <md-input-container ng-if="(vm.newMailAccount && vm.mailAccount.cservice == null) || (vm.newMailAccount == undefined && vm.mailAccount.Imap.service == null)" 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">\n\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 ng-if="(vm.newMailAccount && vm.mailAccount.cservice == null) || (vm.newMailAccount == undefined && vm.mailAccount.Imap.service == null)" 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" ng-required="true">\n\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            <md-input-container ng-if="(vm.newMailAccount && vm.mailAccount.cservice == null) || (vm.newMailAccount == undefined && vm.mailAccount.Smtp.service == null)" 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">\n\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 ng-if="(vm.newMailAccount && vm.mailAccount.cservice == null) || (vm.newMailAccount == undefined && vm.mailAccount.Smtp.service == null)" 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" ng-required="true">\n\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            <md-input-container ng-if="vm.mailAccount.cservice !== undefined && vm.mailAccount.cservice == null && vm.newMailAccount" class="md-block">\n                <md-switch ng-model="vm.mailAccount.cauthentication" aria-label="Authentication"><span translate="MAIL.AUTHENTICATION">Authentication</span></md-switch>\n            </md-input-container>\n            <md-input-container ng-if="(vm.mailAccount.cauthentication == true || vm.mailAccount.cservice != null) && vm.newMailAccount" class="md-block">\n                <label translate="MAIL.USERNAME">Username</label>\n                <input type="text" name="cuser" ng-model="vm.mailAccount.cuser" ng-required="true">\n\n                <div class="hint"><span translate="MAIL.HELP.USERNAME"></span></div>\n                <div ng-messages="mailAccountForm[\'cuser\'].$error" ng-show="mailAccountForm[\'cuser\'].$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.cauthentication == true || vm.mailAccount.cservice != null) && vm.newMailAccount">\n                <label translate="MAIL.PASSWORD">Password</label>\n                <input type="password" name="cpassword" ng-model="vm.mailAccount.cpassword" placeholder="Password" translate translate-attr-placeholder="MAIL.PASSWORD" required>\n                <div class="hint"><span translate="MAIL.HELP.PASSWORD"></span></div>\n                <div ng-messages="mailAccountForm[\'cpassword\'].$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\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\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 MAILACCOUNT\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"></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 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="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" 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 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="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="1">One Time</md-option>\n                    <md-option ng-value="0">Always</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            <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, 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 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="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 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="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 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="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="inboundroute-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 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\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 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="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 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="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" 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 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="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 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="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 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="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, 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/mailDispositions/dialog.html",'<md-dialog class="mailDisposition-dialog" aria-label="New MailDisposition">\n    <form name="mailDispositionForm" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="MAIL.NAME">Name</label>\n                <input type="" name="name" ng-model="vm.mailDisposition.name" ng-required="true" autofocus>\n\n                <div ng-messages="mailDispositionForm[\'name\'].$error" ng-show="mailDispositionForm[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.newMailDisposition" ng-click="vm.saveMailDisposition()" class="send-button md-accent md-raised" ng-disabled="mailDispositionForm.$invalid || mailDispositionForm.$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.newMailDisposition" ng-click="vm.addNewMailDisposition()" class="send-button md-accent md-raised" ng-disabled="mailDispositionForm.$invalid" aria-label="ADD" translate="MAIL.ADD_MAILDISPOSITION" translate-attr-aria-label="MAIL.ADD_MAILDISPOSITION">\n                    ADD MAILDISPOSITION\n                </md-button>\n            </div>\n            <div layout="row">\n                <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newMailDisposition" ng-click="vm.deleteMailDisposition($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    \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-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.gotogoto(vm.mailAccount, $event)" 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.agentadddialog(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) || (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    \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="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.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                                <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="generalForm[\'fontFamily\'].$error" ng-show="generalForm[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" 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="generalForm[\'fontSize\'].$error" ng-show="generalForm[\'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, removePlugins: \'magicline\' }" ng-model="vm.mailAccount.template"></textarea>\n                            </div>\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" 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                            <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\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                    <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, removePlugins: \'magicline\' }" ng-model="vm.mailAccount.notificationTemplate"></textarea>\n                            </div>\n\n                        </form>\n                    </div>\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" 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" 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                </md-tab-body>\n            </md-tab>\n            <md-tab>\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.SERVICE">Service</label>\n                                <md-select name="Imap.service" ng-model="vm.mailAccount.Imap.service" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                                    <md-option ng-value="null">Custom</md-option>\n                                    <md-option ng-value="\'gmail\'">Gmail</md-option>\n                                    <md-option ng-value="\'hotmail\'">Hotmail</md-option>\n                                    <md-option ng-value="\'yahoo\'">Yahoo</md-option>\n                                    <md-option ng-value="\'outlook365\'">Outlook365</md-option>\n                                </md-select>\n                                <div ng-messages="imapForm[\'Imap.service\'].$error" ng-show="imapForm[\'Imap.service\'].$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                            <md-input-container ng-if="(vm.newMailAccount && vm.mailAccount.cservice == null) || (vm.newMailAccount == undefined && vm.mailAccount.Imap.service == null)" 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\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 ng-if="(vm.newMailAccount && vm.mailAccount.cservice == null) || (vm.newMailAccount == undefined && vm.mailAccount.Imap.service == null)" 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" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\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 ng-if="vm.mailAccount.Imap.service == null" 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 == true || vm.mailAccount.Imap.service != null" 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\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 == true || vm.mailAccount.Imap.service != null">\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\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\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">connTimeout</label>\n                                <input type="number" name="Imap.connTimeout" ng-model="vm.mailAccount.Imap.connTimeout" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\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">connTimeout field is required</span>\n                                    </div>\n                                    <div ng-message="min">\n                                        <span translate="MAIL.ERRORS.CONNTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">connTimeout 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">authTimeout</label>\n                                <input type="number" name="Imap.authTimeout" ng-model="vm.mailAccount.Imap.authTimeout" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\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">authTimeout field is required</span>\n                                    </div>\n                                    <div ng-message="min">\n                                        <span translate="MAIL.ERRORS.AUTHTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">authTimeout must be a valid greater or equal than</span> <span>1</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.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.SERVICE">Service</label>\n                                <md-select name="Smtp.service" ng-model="vm.mailAccount.Smtp.service" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                                    <md-option ng-value="null">Custom</md-option>\n                                    <md-option ng-value="\'gmail\'">Gmail</md-option>\n                                    <md-option ng-value="\'hotmail\'">Hotmail</md-option>\n                                    <md-option ng-value="\'yahoo\'">Yahoo</md-option>\n                                    <md-option ng-value="\'outlook365\'">Outlook365</md-option>\n                                </md-select>\n                                <div ng-messages="smtpForm[\'Smtp.service\'].$error" ng-show="smtpForm[\'Smtp.service\'].$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                            <md-input-container ng-if="(vm.newMailAccount && vm.mailAccount.cservice == null) || (vm.newMailAccount == undefined && vm.mailAccount.Smtp.service == null)" 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 ng-if="(vm.newMailAccount && vm.mailAccount.cservice == null) || (vm.newMailAccount == undefined && vm.mailAccount.Smtp.service == null)" 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" 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 ng-if="vm.mailAccount.Smtp.service == null" 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 ng-if="vm.mailAccount.Smtp.service == null" 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 == true || vm.mailAccount.Smtp.service != null" 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 == true || vm.mailAccount.Smtp.service != null">\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\n\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 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 class="mailAccount-detail-form-container maildispositions md-background-bg md-whiteframe-1dp">\n                        <div ng-controller="MailAccountMailDispositionsController as vm_dc" ng-init="vm_dc.init(vm.mailAccount, vm.crudPermissions)">\n                            <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedMailAccountMailDispositions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead" translate="MAIL.MAILDISPOSITIONS">MailDispositions</span>\n                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\n                                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditMailAccountMailDisposition($event)" aria-label="add mailDisposition" translate translate-attr-label="MAIL.ADD_MAILDISPOSITION">\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.selectedMailAccountMailDispositions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead">{{vm_dc.selectedMailAccountMailDispositions.length}} {{vm_dc.selectedMailAccountMailDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                                    <div flex></div>\n                                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedMailAccountMailDispositions" 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.deleteSelectedMailAccountMailDispositions($event)" aria-label="delete selected" translate translate-attr-label="MAILACCOUNTS.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.selectedMailAccountMailDispositions" md-progress="vm_dc.promise">\n                                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getMailAccountMailDispositions">\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="createdAt">{{ \'MAIL.CREATED_AT\' | translate }}</th>\n                                            <th md-column width="10px"></th>\n                                        </tr>\n                                    </thead>\n                                    <tbody md-body>\n                                        <tr md-row md-select="mailDisposition" md-select-id="id" ng-repeat="mailDisposition in vm_dc.mailAccountMailDispositions.rows">\n                                            <td ng-click="vm_dc.createOrEditMailAccountMailDisposition($event, mailDisposition)" md-cell>{{mailDisposition.id}}</td>\n                                            <td ng-click="vm_dc.createOrEditMailAccountMailDisposition($event, mailDisposition)" md-cell>{{mailDisposition.name}}</td>\n                                            <td ng-click="vm_dc.createOrEditMailAccountMailDisposition($event, mailDisposition)" md-cell>{{mailDisposition.createdAt | date:\'medium\'}}</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.createOrEditMailAccountMailDisposition($event, mailDisposition)" translate="MAIL.EDIT_MAILDISPOSITION">\n                                                                Edit MailDisposition\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(mailDisposition, $event)" translate="MAIL.DELETE_MAILDISPOSITION">\n                                                                Delete MailDisposition\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.mailAccountMailDispositions.rows.length">\n                                            <td md-cell colspan="5">\n                                                <span class="text-boxed-ligth" translate="MAIL.NO_MAILDISPOSITION_AVAILABLE">No maildisposition available</span>\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.mailAccountMailDispositions.count}}" md-on-paginate="vm_dc.getMailAccountMailDispositions" 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.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)">\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                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="MAILACCOUNTS.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.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">{{ \'MAIL.ID\' | translate }}</th>\n                                            <th md-column md-order-by="key">{{ \'MAIL.KEY\' | translate }}</th>\n                                            <th md-column md-order-by="value">{{ \'MAIL.VALUE\' | translate }}</th>\n                                            <th md-column md-order-by="description">{{ \'MAIL.DESCRIPTION\' | translate }}</th>\n                                            <th md-column md-order-by="createdAt">{{ \'MAIL.CREATED_AT\' | translate }}</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>{{mailCannedAnswer.id}}</td>\n                                            <td ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event, mailCannedAnswer)" md-cell>{{mailCannedAnswer.key}}</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>{{mailCannedAnswer.description}}</td>\n                                            <td ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event, mailCannedAnswer)" md-cell>{{mailCannedAnswer.createdAt | date:\'medium\'}}</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                                                <span class="text-boxed-ligth" translate="MAIL.NO_MAILCANNEDANSWER_AVAILABLE">No mailcannedanswer available</span>\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" ms-scroll 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.alias || a.appType) | uppercase}}">{{a.alias || 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" ms-scroll 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" style="width:200px">{{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-ligth" 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)">\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                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="MAILACCOUNTS.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.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">{{ \'MAIL.ID\' | translate }}</th>\n                                            <th md-column md-order-by="createdAt">{{ \'MAIL.STARTEDAT\' | translate }}</th>\n                                            <th md-column>{{ \'MAIL.CONTACT\' | translate }}</th>\n                                            <th md-column>{{ \'MAIL.AGENT\' | translate }}</th>\n                                            <th md-column md-order-by="closedAt">{{ \'MAIL.CLOSEDAT\' | translate }}</th>\n                                            <th md-column md-order-by="disposition">{{ \'MAIL.DISPOSITION\' | translate }}</th>\n                                            <th md-column md-order-by="note">{{ \'MAIL.NOTES\' | translate }}</th>\n                                            <th md-column md-order-by="tag">{{ \'MAIL.TAGS\' | translate }}</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">\n                                            <td md-cell>{{interaction.id}}</td>\n                                            <td md-cell>{{interaction.createdAt | date:\'medium\'}}</td>\n                                            <td md-cell>{{interaction.Contact.firstName}}</td>\n                                            <td md-cell>{{interaction.Owner.name}}</td>\n                                            <td md-cell>{{interaction.closedAt | date:\'medium\'}}</td>\n                                            <td md-cell>{{interaction.disposition}}</td>\n                                            <td md-cell>{{interaction.note}}</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"></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>\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>\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                                                <span class="text-boxed-ligth" translate="MAIL.NO_INTERACTION_AVAILABLE">No interaction available</span>\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    \x3c!-- / CONTENT --\x3e\n\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    \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.MAILACCOUNTS">MailAccounts</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.selectedMailAccounts.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.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="MAILACCOUNTS.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="MAILACCOUNTS.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!-- MAILACCOUNT TABLE --\x3e\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 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="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">\n                                <td md-cell ng-if="mailAccount.userpic"><img class="avatar" alt="{{mailAccount.name}}" ng-src="api/users/{{mailAccount.id}}/avatar" /></td>\n                                <td md-cell ng-if="!mailAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{mailAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(mailAccount, ev) : vm.createOrEditMailAccount($event, mailAccount)" md-cell class="id ">{{mailAccount.id}}</td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(mailAccount, ev) : vm.createOrEditMailAccount($event, mailAccount)" md-cell class="name ">{{mailAccount.name}}</td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(mailAccount, ev) : vm.createOrEditMailAccount($event, mailAccount)" md-cell class="key ">{{mailAccount.key}}</td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(mailAccount, ev) : vm.createOrEditMailAccount($event, mailAccount)" md-cell class="email ">{{mailAccount.email}}</td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(mailAccount, ev) : vm.createOrEditMailAccount($event, mailAccount)" 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 ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(mailAccount, ev) : vm.createOrEditMailAccount($event, mailAccount)" 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 MailAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.verifysmtpverifysmtp(mailAccount, $event)" translate="MAIL.VERIFYSMTP_MAILACCOUNT">\n                                                    verifysmtp MailAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.interactionsgoto(mailAccount, $event)" translate="MAIL.INTERACTIONS_MAILACCOUNT">\n                                                    Interactions MailAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.gotorealtimegoto(mailAccount, $event)" translate="MAIL.GOTOREALTIME_MAILACCOUNT">\n                                                    goToRealtime MailAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.agentadddialog(mailAccount, $event)" translate="MAIL.AGENTADD_MAILACCOUNT">\n                                                    AgentAdd MailAccount\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 MailAccount\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            \x3c!-- / MAILACCOUNT 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 MAILACCOUNT BUTTON --\x3e\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    \x3c!-- / ADD MAILACCOUNT BUTTON --\x3e\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 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="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" 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"></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"></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" 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 animate-slide-down 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="MAILQUEUES.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="MAILQUEUES.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!-- 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                                <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(mailQueue, $event)" translate="MAIL.EDIT_MAILQUEUE">\n                                                    Edit MailQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.teamadddialog(mailQueue, $event)" translate="MAIL.TEAMADD_MAILQUEUE">\n                                                    teamadd MailQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.agentadddialog(mailQueue, $event)" translate="MAIL.AGENTADD_MAILQUEUE">\n                                                    agentadd MailQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(mailQueue, $event)" translate="MAIL.DELETE_MAILQUEUE">\n                                                    Delete MailQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.gotorealtimegoto(mailQueue, $event)" translate="MAIL.GOTOREALTIME_MAILQUEUE">\n                                                    goToRealtime MailQueue\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.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 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="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 animate-slide-down 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="MAILSUBSTATUSES.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="MAILSUBSTATUSES.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!-- 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                                <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="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.editdialog(mailSubstatus, $event)" translate="MAIL.EDIT_MAILSUBSTATUS">\n                                                    Edit MailSubstatus\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(mailSubstatus, $event)" translate="MAIL.DELETE_MAILSUBSTATUS">\n                                                    Delete MailSubstatus\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.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.query.filter = 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.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">\n                <td md-cell colspan="4">\n                    <div layout="row" layout-align="center center">\n                        <span tranlsate="MAIL.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-row md-select="vm.mailAccounts[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td md-cell>{{vm.mailAccounts[value].name}}</td>\n                <td md-cell>{{vm.mailAccounts[value].key}}</td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{(vm.mailAccounts[value].in || 0) + (vm.mailAccounts[value].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">{{vm.mailAccounts[value].in || 0}}</span>\n                        <span class="text-boxed" ng-if="mailAccount.in">{{vm.mailAccounts[value].lastIn ?  (vm.mailAccounts[value].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">{{vm.mailAccounts[value].out || 0}}</span>\n                        <span class="text-boxed" ng-if="mailAccount.out">{{vm.mailAccounts[value].lastOut ?  (vm.mailAccounts[value].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>{{vm.mailAccounts[value].Imap.messageStatus}}</md-tooltip>\n                                <div ng-switch="vm.mailAccounts[value].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.\' + vm.mailAccounts[value].Imap.status.toUpperCase()) | translate}}</span>\n                        </div>\n                        <span class="text-boxed" ng-if="vm.mailAccounts[value].active">{{vm.mailAccounts[value].Imap.lastSync | date: \'shortTime\'}}</span>\n                    </div>\n                </td>\n                <td md-cell>\n                    <div layout="row" layout-align="start center" ng-if="vm.mailAccounts[value].Smtp.status">\n                        <div layout="column" layout-align="center center">\n                            <md-button class="md-icon-button" aria-label="Status">\n                                <md-tooltip>{{vm.mailAccounts[value].Smtp.messageStatus}}</md-tooltip>\n                                <md-icon md-font-icon="{{ vm.mailAccounts[value].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.\' + vm.mailAccounts[value].Smtp.status.toUpperCase()) | translate}}</span>\n                        </div>\n                        <span class="text-boxed">{{vm.mailAccounts[value].Smtp.lastSync | date: \'shortTime\'}}</span>\n                    </div>\n                    <span class="md-caption grey-fg" ng-if="!vm.mailAccounts[value].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, vm.mailAccounts[value])" 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, vm.mailAccounts[value])" 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.count}}" md-on-paginate="vm.getmailAccounts" md-page-select></md-table-pagination>\n\x3c!-- / AGENT TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/mail/views/realtime/agents/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.AGENTS">Agents</span>\n        <div flex></div>\n        <ms-search-bar on-search="vm.query.filter = query; vm.onInit()" on-collapse="vm.query.filter = undefined; vm.onInit()" debounce="300"></ms-search-bar>\n        <md-select ng-model="vm.query.globalStatusFilter" class="md-caption" ng-change="vm.query.pauseTypeFilter = \'\'; vm.onInit()">\n            <md-option ng-value="\'\'">{{ \'MAIL.ALL\' | translate }}</md-option>\n            <md-option value="pause">{{ \'MAIL.PAUSE\' | translate }}</md-option>\n            <md-option value="*pause">{{ \'MAIL.PARTIALPAUSE\' | translate }}</md-option>\n            <md-option value="busy">{{ \'MAIL.BUSY\' | translate }}</md-option>\n            <md-option value="idle">{{ \'MAIL.IDLE\' | translate }}</md-option>\n        </md-select>\n\n        <md-select ng-if="vm.isPause(vm.query.globalStatusFilter)" ng-model="vm.query.pauseTypeFilter" class="md-caption" ng-change="vm.onInit()">\n            <md-option ng-value="\'\'">All</md-option>\n            <md-option value="DEFAULT PAUSE">DEFAULT PAUSE</md-option>\n            <md-option value="ACW">ACW</md-option>\n            <md-option value="LOGININPAUSE">LOGININPAUSE</md-option>\n            <md-option value="Auto-Pause">AUTOPAUSE</md-option>\n            <md-option ng-value="pause.name" ng-repeat="pause in vm.pauses.rows">{{pause.name}}</md-option>\n        </md-select>\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.order" md-on-reorder="vm.onInit">\n            <tr md-row border="1">\n                <th class="bv text-center" colspan="4">{{ \'MAIL.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">{{ \'OPENCHANNEL.OPENCHANNEL\' | translate }}</th>\n                <th ng-if="vm.license.fax" class="bv bl text-center" colspan="2">{{ \'FAX.FAX\' | translate }}</th>\n                <th width="10px" class="bt bl" rowspan="2"></th>\n            </tr>\n            <tr md-row>\n                <th class="bl" md-column md-order-by="fullname">{{ \'MAIL.NAME\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="globalStatus">{{ \'MAIL.STATUS\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="lastLoginAt">{{ \'MAIL.LOGIN_TIME\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="lastPauseAt">{{ \'MAIL.PAUSE_TIME\' | translate }}</th>\n\n                <th class="bl custom-column">{{ \'VOICE.STATUS\' | translate }}</th>\n                <th class="bl custom-column">Info</th>\n\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\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\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\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\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            </tr>\n        </thead>\n        <tbody md-body>\n            <tr md-row ng-hide="vm.order.length">\n                <td md-cell colspan="17">\n                    <div layout="row" layout-align="center center">\n                        <span>{{ \'MAIL.NO_AGENT_ONLINE\' | translate }}</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-select="vm.agents[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td class="bt padding-5">\n                    <div layout="row" layout-align="start center">\n                        <img class="avatar" ng-src="{{vm.agents[value].userpic && \'api/users/\'+vm.agents[value].id+\'/avatar\' || \'assets/images/avatars/profile.png\'}}">\n                        <div layout="column">\n                            <span>{{vm.agents[value].fullname}}</span>\n                            <span>{{vm.agents[value].internal}}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class="bt">\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'}[vm.agents[value].globalStatus]\">{{ vm.isPause(vm.agents[value].globalStatus) ? '' : vm.agents[value].globalStatus | uppercase }} {{ vm.isPause(vm.agents[value].globalStatus) ? (vm.isPartialPause(vm.agents[value].globalStatus) ? '*'+vm.agents[value].pauseType || 'DEFAULT PAUSE'  : vm.agents[value].pauseType || 'DEFAULT PAUSE') : ''}}</span>\n                </td>\n                <td class=\"bt custom-column\">\n                    <timer start-time=\"vm.agents[value].lastLoginAt\" interval=\"1000\">{{ days > 0 ? days + 'd' : '' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                </td>\n                <td class=\"bt custom-column\">\n                    <timer ng-if=\"vm.isPause(vm.agents[value].globalStatus) || vm.isPartialPause(vm.agents[value].globalStatus)\" start-time=\"vm.agents[value].lastPauseAt\" interval=\"1000\">{{ days > 0 ? days + 'd' : '' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                </td>\n                <td class=\"bt bl\">\n                    <div layout=\"row\">\n                        <span ng-if=\"!vm.agents[value].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'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].voiceStatus | uppercase }}</span>\n                        <span ng-if=\"vm.agents[value].onhold\" class=\"text-boxed md-background-bg bl bt padding-5 orange-400-bg\">ONHOLD</span>\n                    </div>\n                </td>\n                <td class=\"bt bl\">\n                    <div layout=\"column\">\n                        <span ng-if=\"vm.agents[value].queue\" class=\"padding-5\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].queue }}</span>\n                        <span ng-if=\"vm.agents[value].destconnectedlinenum\" class=\"padding-5\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].destconnectedlinenum }}</span>\n                        <span class=\"padding-5\" ng-if=\"vm.agents[value].queue || vm.agents[value].destconnectedlinenum\">\n                            <timer start-time=\"vm.agents[value].voiceStatusTime\" interval=\"1000\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                        </span>\n                    </div>\n                </td>\n                <td class=\"bt bl\" ng-if=\"vm.license.chat\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].chatStatus]\">{{ vm.agents[value].chatStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td md-number class=\"bt text-center font-size-20\" ng-if=\"vm.license.chat\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].chatStatus]\">{{ vm.agents[value].chatCurrentCapacity }}</td>\n                <td class=\"bl bt\" ng-if=\"vm.license.mail\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].mailStatus]\">{{ vm.agents[value].mailStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.mail\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].mailStatus]\">{{ vm.agents[value].mailCurrentCapacity }}</td>\n                <td class=\"bl bt\" ng-if=\"vm.license.messaging\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].smsStatus]\">{{ vm.agents[value].smsStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.messaging\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].smsStatus]\">{{ vm.agents[value].smsCurrentCapacity }}</td>\n                <td class=\"bt bl\" ng-if=\"vm.license.openchannel\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].openchannelStatus]\">{{ vm.agents[value].openchannelStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.openchannel\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].openchannelStatus]\">{{ vm.agents[value].openchannelCurrentCapacity }}</td>\n                <td class=\"bt bl\" ng-if=\"vm.license.fax\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].faxStatus]\">{{ vm.agents[value].faxStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.fax\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].faxStatus]\">{{ vm.agents[value].faxCurrentCapacity }}</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\n                        <md-menu-content width=\"4\">\n                            <md-menu-item>\n                                <md-button ng-click=\"vm.logout(vm.agents[value], $event)\" translate=\"MAIL.LOGOUT\">\n                                    Logout\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-button ng-click=\"vm.queueAdd(vm.agents[value], $event)\" translate=\"MAIL.AGENTADD_QUEUE\">\n                                    Add Agent In Queue\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-menu>\n                                    <md-button ng-click=\"$mdMenu.open()\" class=\"text-capitalize\" translate=\"MAIL.PAUSE\">Pause</md-button>\n                                    <md-menu-content>\n                                        <md-menu-item>\n                                            <md-button ng-disabled=\" vm.agents[value].voicePause && 'DEFAULT PAUSE' === vm.agents[value].pauseType\" ng-click=\"vm.pause(vm.agents[value])\"><em translate=\"MAIL.DEFAULT_PAUSE\">Default Pause</em></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=\"vm.agents[value].voicePause && pause.name === vm.agents[value].pauseType\" ng-click=\"vm.pause(vm.agents[value], pause.name)\">{{pause.name}}</md-button>\n                                        </md-menu-item>\n                                    </md-menu-content>\n                                </md-menu>\n                            </md-menu-item>\n                            <md-menu-item ng-if=\"vm.isPause(vm.agents[value].globalStatus)\">\n                                <md-button ng-click=\"vm.unPause(vm.agents[value])\" translate=\"MAIL.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\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.filteredAgents.length}}\" md-on-paginate=\"vm.onInit\" md-page-select></md-table-pagination>\n\x3c!-- / AGENT TABLE --\x3e\n\x3c!-- / MAIN --\x3e"),e.put("app/main/apps/mail/views/realtime/queues/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.QUEUES">Queues</span>\n        <div flex></div>\n        <ms-search-bar on-search="vm.query.filter = 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">{{ \'MAIL.NAME\' | translate }}</th>\n                <th md-column>{{ \'MAIL.LOGGED_IN\' | translate }}</th>\n                <th md-column>{{ \'MAIL.PAUSED\' | translate }}</th>\n                <th md-column>{{ \'MAIL.READY\' | translate }}</th>\n                <th md-column>{{ \'MAIL.WAITING\' | translate }}</th>\n                <th md-column width="10px"></th>\n            </tr>\n        </thead>\n        <tbody md-body>\n            <tr md-row ng-hide="vm.queues">\n                <td md-cell colspan="7">\n                    <div layout="row" layout-align="center center">\n                        <span tranlsate="MAIL.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-row md-select="vm.queues[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td md-cell>{{vm.queues[value].name}}</td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].loggedInDb || 0}} ({{vm.queues[value].loggedIn || 0}})</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].paused || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-16 grey-fg">{{vm.queues[value].available || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].waiting || 0}}</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="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.createOrEditMailQueue($event, vm.queues[value])" translate="MAIL.EDIT_QUEUE">\n                                    Edit Queue\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-button ng-click="vm.agentAdd($event, vm.queues[value])" translate="MAIL.AGENTSADD_QUEUE">\n                                    Add Agents to queue\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.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/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 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="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 animate-slide-down 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="PLUGINS.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="PLUGINS.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            <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                                <td md-cell class="actions">\n                                    <md-menu>\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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit && !plugin.active">\n                                                <md-button ng-click="vm.installplugin(plugin, $event)" translate="MARKETPLACE.INSTALL_PLUGIN">\n                                                    Install Plugin\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(plugin, $event)" translate="MARKETPLACE.EDIT_PLUGIN">\n                                                    Edit Plugin\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit && plugin.active && plugin.type == \'script\'">\n                                                <md-button ng-click="vm.stopplugin(plugin, $event)" translate="MARKETPLACE.STOP_PLUGIN">\n                                                    Stop Plugin\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit && plugin.active && plugin.type == \'script\'">\n                                                <md-button ng-click="vm.restartplugin(plugin, $event)" translate="MARKETPLACE.RESTART_PLUGIN">\n                                                    Restart Plugin\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.downloadfile2(plugin, $event)" translate="MARKETPLACE.DOWNLOAD_PLUGIN">\n                                                    Download Plugin\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit && plugin.active">\n                                                <md-button ng-click="vm.uninstallplugin(plugin, $event)" translate="MARKETPLACE.UNINSTALL_PLUGIN">\n                                                    Uninstall Plugin\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(plugin, $event)" translate="MARKETPLACE.DELETE_PLUGIN">\n                                                    Delete Plugin\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: \'{{\'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 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 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/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 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="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" 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"></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 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="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 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" 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"></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) || (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" 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" 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" 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" 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+$/" 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" 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" 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" 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" 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" 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" 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" 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                </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" 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">\n                                    < <div class="hint"><span translate="MOTIONDIALER.HELP.TIMEZONE"></span>\n                    </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" 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" 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" 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" 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" 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" 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" 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" 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" 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                            <div flex></div>\n                            <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="IVRCAMPAIGNS.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.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">{{ \'MOTIONDIALER.CONTACTID\' | translate }}</th>\n                                    <th md-column md-order-by="phone">{{ \'MOTIONDIALER.PHONE\' | translate }}</th>\n                                    <th md-column md-order-by="countcongestionretry">{{ \'MOTIONDIALER.CONGESTION\' | translate }}</th>\n                                    <th md-column md-order-by="countbusyretry">{{ \'MOTIONDIALER.BUSY\' | translate }}</th>\n                                    <th md-column md-order-by="countnoanswerretry">{{ \'MOTIONDIALER.NOANSWER\' | translate }}</th>\n                                    <th md-column md-order-by="scheduledat">{{ \'MOTIONDIALER.SCHEDULEDAT\' | translate }}</th>\n                                    <th md-column md-order-by="priority">{{ \'MOTIONDIALER.PRIORITY\' | translate }}</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>{{hopper.ContactId}}</td>\n                                    <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>{{hopper.phone}}</td>\n                                    <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>{{hopper.countcongestionretry}}</td>\n                                    <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>{{hopper.countbusyretry}}</td>\n                                    <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>{{hopper.countnoanswerretry}}</td>\n                                    <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>{{hopper.scheduledat | date:\'medium\'}}</td>\n                                    <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>{{ vm_dc.arraypriority[hopper.priority].option }}</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.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="10">\n                                        <span class="text-boxed-ligth" translate="MOTIONDIALER.NO_HOPPER_AVAILABLE">No hopper available</span>\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                            <div flex></div>\n                            <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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>\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">{{ \'MOTIONDIALER.UNIQUEID\' | translate }}</th>\n                                    <th md-column md-order-by="ContactId">{{ \'MOTIONDIALER.CONTACTID\' | translate }}</th>\n                                    <th md-column md-order-by="calleridnum">{{ \'MOTIONDIALER.PHONE\' | translate }}</th>\n                                    <th md-column md-order-by="calleridname">{{ \'MOTIONDIALER.NAME\' | translate }}</th>\n                                    <th md-column md-order-by="statedesc">{{ \'MOTIONDIALER.STATUS\' | translate }}</th>\n                                    <th md-column md-order-by="scheduledat">{{ \'MOTIONDIALER.SCHEDULEDAT\' | translate }}</th>\n                                    <th md-column md-order-by="starttime">{{ \'MOTIONDIALER.STARTTIME\' | translate }}</th>\n                                    <th md-column md-order-by="endtime">{{ \'MOTIONDIALER.ENDTIME\' | translate }}</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>{{hopperHistory.uniqueid}}</td>\n                                    <td md-cell>{{hopperHistory.ContactId}}</td>\n                                    <td md-cell>{{hopperHistory.calleridnum}}</td>\n                                    <td md-cell>{{hopperHistory.calleridname}}</td>\n                                    <td md-cell>{{hopperHistory.statedesc}}</td>\n                                    <td md-cell>{{hopperHistory.scheduledat | date:\'medium\'}}</td>\n                                    <td md-cell>{{hopperHistory.starttime | date:\'medium\'}}</td>\n                                    <td md-cell>{{hopperHistory.endtime | date:\'medium\'}}</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                                        <span class="text-boxed-ligth" translate="MOTIONDIALER.NO_HOPPERHISTORY_AVAILABLE">No hopperhistory available</span>\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                            <div flex></div>\n                            <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="IVRCAMPAIGNS.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>\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">{{ \'MOTIONDIALER.UNIQUEID\' | translate }}</th>\n                                    <th md-column md-order-by="ContactId">{{ \'MOTIONDIALER.CONTACTID\' | translate }}</th>\n                                    <th md-column md-order-by="calleridnum">{{ \'MOTIONDIALER.PHONE\' | translate }}</th>\n                                    <th md-column md-order-by="calleridname">{{ \'MOTIONDIALER.NAME\' | translate }}</th>\n                                    <th md-column md-order-by="statedesc">{{ \'MOTIONDIALER.STATUS\' | translate }}</th>\n                                    <th md-column md-order-by="countcongestionretry">{{ \'MOTIONDIALER.CONGESTION\' | translate }}</th>\n                                    <th md-column md-order-by="countbusyretry">{{ \'MOTIONDIALER.BUSY\' | translate }}</th>\n                                    <th md-column md-order-by="countnoanswerretry">{{ \'MOTIONDIALER.NOANSWER\' | translate }}</th>\n                                    <th md-column md-order-by="starttime">{{ \'MOTIONDIALER.STARTTIME\' | translate }}</th>\n                                    <th md-column md-order-by="endtime">{{ \'MOTIONDIALER.ENDTIME\' | translate }}</th>\n                                    <th md-column md-order-by="disposition">{{ \'MOTIONDIALER.DISPOSITION\' | translate }}</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>{{hopperFinal.uniqueid}}</td>\n                                    <td md-cell>{{hopperFinal.ContactId}}</td>\n                                    <td md-cell>{{hopperFinal.calleridnum}}</td>\n                                    <td md-cell>{{hopperFinal.calleridname}}</td>\n                                    <td md-cell>{{hopperFinal.statedesc}}</td>\n                                    <td md-cell>{{hopperFinal.countcongestionretry}}</td>\n                                    <td md-cell>{{hopperFinal.countbusyretry}}</td>\n                                    <td md-cell>{{hopperFinal.countnoanswerretry}}</td>\n                                    <td md-cell>{{hopperFinal.starttime | date:\'medium\'}}</td>\n                                    <td md-cell>{{hopperFinal.endtime | date:\'medium\'}}</td>\n                                    <td md-cell>{{hopperFinal.disposition}}</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="23">\n                                        <span class="text-boxed-ligth" translate="MOTIONDIALER.NO_HOPPERFINAL_AVAILABLE">No hopperfinal available</span>\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                            <div flex></div>\n                            <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.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_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>\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">{{ \'MOTIONDIALER.CONTACTID\' | translate }}</th>\n                                    <th md-column md-order-by="phone">{{ \'MOTIONDIALER.PHONE\' | translate }}</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>{{hopperBlack.ContactId}}</td>\n                                    <td md-cell>{{hopperBlack.phone}}</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                                        <span class="text-boxed-ligth" translate="MOTIONDIALER.NO_HOPPERBLACK_AVAILABLE">No hopperblack available</span>\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 animate-slide-down 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="IVRCAMPAIGNS.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="IVRCAMPAIGNS.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!-- 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})[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})[0].name }}</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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(ivrCampaign, $event)" translate="MOTIONDIALER.EDIT_IVRCAMPAIGN">\n                                                    Edit IvrCampaign\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.clonedialog(ivrCampaign, $event)" translate="MOTIONDIALER.CLONE_IVRCAMPAIGN">\n                                                    clone IvrCampaign\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.listadddialog(ivrCampaign, $event)" translate="MOTIONDIALER.LISTADD_IVRCAMPAIGN">\n                                                    listadd IvrCampaign\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.blacklistadddialog(ivrCampaign, $event)" translate="MOTIONDIALER.BLACKLISTADD_IVRCAMPAIGN">\n                                                    blacklistadd IvrCampaign\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(ivrCampaign, $event)" translate="MOTIONDIALER.DELETE_IVRCAMPAIGN">\n                                                    Delete IvrCampaign\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.gotorealtimegoto(ivrCampaign, $event)" translate="MOTIONDIALER.GOTOREALTIME_IVRCAMPAIGN">\n                                                    goToRealtime IvrCampaign\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.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 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="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">\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">\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">\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" 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" 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" 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" ng-model="vm.penalty" placeholder="0" required md-minlength="0" md-maxlength="3">\n                <div ng-messages="queueCampaignForm.penalty.$error" role="alert" multiple>\n                    <div ng-message="required">\n                        <span>You must supply a penalty.</span>\n                    </div>\n                    <div ng-message="md-minlength">\n                        <span>Min Penalty 0 characters.</span>\n                    </div>\n                    <div ng-message="md-maxlength">\n                        <span>Max Penalty 3 characters.</span>\n                    </div>\n                </div>\n            </md-input-container>\n            <ms-dual-multiselect options="vm.dualMultiselectOptions"></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"></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 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="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 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" 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            <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"></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" ng-model="vm.penalty" placeholder="0" required md-minlength="0" md-maxlength="3">\n                <div ng-messages="queueCampaignForm.penalty.$error" role="alert" multiple>\n                    <div ng-message="required">\n                        <span>You must supply a penalty.</span>\n                    </div>\n                    <div ng-message="md-minlength">\n                        <span>Min Penalty 0 characters.</span>\n                    </div>\n                    <div ng-message="md-maxlength">\n                        <span>Max Penalty 3 characters.</span>\n                    </div>\n                </div>\n            </md-input-container>\n            <ms-dual-multiselect options="vm.dualMultiselectOptions"></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) || (advancedForm.$invalid) || (advancedpreviewForm.$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" 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">\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">\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">\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" 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" 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" 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" 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" 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" 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" 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" 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+$/" 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" 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" 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" 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" 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" 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" 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" 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                </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 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\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" 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">\n                                    < <div class="hint"><span translate="MOTIONDIALER.HELP.TIMEZONE"></span>\n                    </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" 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" 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" 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" 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" 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" 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" 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" 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" 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                            <div flex></div>\n                            <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="QUEUECAMPAIGNS.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.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">{{ \'MOTIONDIALER.CONTACTID\' | translate }}</th>\n                                    <th md-column md-order-by="phone">{{ \'MOTIONDIALER.PHONE\' | translate }}</th>\n                                    <th md-column md-order-by="countcongestionretry">{{ \'MOTIONDIALER.CONGESTION\' | translate }}</th>\n                                    <th md-column md-order-by="countbusyretry">{{ \'MOTIONDIALER.BUSY\' | translate }}</th>\n                                    <th md-column md-order-by="countnoanswerretry">{{ \'MOTIONDIALER.NOANSWER\' | translate }}</th>\n                                    <th md-column md-order-by="scheduledat">{{ \'MOTIONDIALER.SCHEDULEDAT\' | translate }}</th>\n                                    <th md-column md-order-by="priority">{{ \'MOTIONDIALER.PRIORITY\' | translate }}</th>\n                                    <th md-column md-order-by="recallme">{{ \'MOTIONDIALER.RECALLAGENT\' | translate }}</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>{{hopper.ContactId}}</td>\n                                    <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>{{hopper.phone}}</td>\n                                    <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>{{hopper.countcongestionretry}}</td>\n                                    <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>{{hopper.countbusyretry}}</td>\n                                    <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>{{hopper.countnoanswerretry}}</td>\n                                    <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>{{hopper.scheduledat | date:\'medium\'}}</td>\n                                    <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>{{ vm_dc.arraypriority[hopper.priority].option }}</td>\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="12">\n                                        <span class="text-boxed-ligth" translate="MOTIONDIALER.NO_HOPPER_AVAILABLE">No hopper available</span>\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                            <div flex></div>\n                            <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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>\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">{{ \'MOTIONDIALER.UNIQUEID\' | translate }}</th>\n                                    <th md-column md-order-by="ContactId">{{ \'MOTIONDIALER.CONTACTID\' | translate }}</th>\n                                    <th md-column md-order-by="calleridnum">{{ \'MOTIONDIALER.PHONE\' | translate }}</th>\n                                    <th md-column md-order-by="calleridname">{{ \'MOTIONDIALER.NAME\' | translate }}</th>\n                                    <th md-column md-order-by="statedesc">{{ \'MOTIONDIALER.STATUS\' | translate }}</th>\n                                    <th md-column md-order-by="scheduledat">{{ \'MOTIONDIALER.SCHEDULEDAT\' | translate }}</th>\n                                    <th md-column md-order-by="starttime">{{ \'MOTIONDIALER.STARTTIME\' | translate }}</th>\n                                    <th md-column md-order-by="endtime">{{ \'MOTIONDIALER.ENDTIME\' | translate }}</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>{{hopperHistory.uniqueid}}</td>\n                                    <td md-cell>{{hopperHistory.ContactId}}</td>\n                                    <td md-cell>{{hopperHistory.calleridnum}}</td>\n                                    <td md-cell>{{hopperHistory.calleridname}}</td>\n                                    <td md-cell>{{hopperHistory.statedesc}}</td>\n                                    <td md-cell>{{hopperHistory.scheduledat | date:\'medium\'}}</td>\n                                    <td md-cell>{{hopperHistory.starttime | date:\'medium\'}}</td>\n                                    <td md-cell>{{hopperHistory.endtime | date:\'medium\'}}</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                                        <span class="text-boxed-ligth" translate="MOTIONDIALER.NO_HOPPERHISTORY_AVAILABLE">No hopperhistory available</span>\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                            <div flex></div>\n                            <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="QUEUECAMPAIGNS.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>\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">{{ \'MOTIONDIALER.UNIQUEID\' | translate }}</th>\n                                    <th md-column md-order-by="ContactId">{{ \'MOTIONDIALER.CONTACTID\' | translate }}</th>\n                                    <th md-column md-order-by="calleridnum">{{ \'MOTIONDIALER.PHONE\' | translate }}</th>\n                                    <th md-column md-order-by="calleridname">{{ \'MOTIONDIALER.NAME\' | translate }}</th>\n                                    <th md-column md-order-by="statedesc">{{ \'MOTIONDIALER.STATUS\' | translate }}</th>\n                                    <th md-column md-order-by="countcongestionretry">{{ \'MOTIONDIALER.CONGESTION\' | translate }}</th>\n                                    <th md-column md-order-by="countbusyretry">{{ \'MOTIONDIALER.BUSY\' | translate }}</th>\n                                    <th md-column md-order-by="countnoanswerretry">{{ \'MOTIONDIALER.NOANSWER\' | translate }}</th>\n                                    <th md-column md-order-by="starttime">{{ \'MOTIONDIALER.STARTTIME\' | translate }}</th>\n                                    <th md-column md-order-by="endtime">{{ \'MOTIONDIALER.ENDTIME\' | translate }}</th>\n                                    <th md-column md-order-by="disposition">{{ \'MOTIONDIALER.DISPOSITION\' | translate }}</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>{{hopperFinal.uniqueid}}</td>\n                                    <td md-cell>{{hopperFinal.ContactId}}</td>\n                                    <td md-cell>{{hopperFinal.calleridnum}}</td>\n                                    <td md-cell>{{hopperFinal.calleridname}}</td>\n                                    <td md-cell>{{hopperFinal.statedesc}}</td>\n                                    <td md-cell>{{hopperFinal.countcongestionretry}}</td>\n                                    <td md-cell>{{hopperFinal.countbusyretry}}</td>\n                                    <td md-cell>{{hopperFinal.countnoanswerretry}}</td>\n                                    <td md-cell>{{hopperFinal.starttime | date:\'medium\'}}</td>\n                                    <td md-cell>{{hopperFinal.endtime | date:\'medium\'}}</td>\n                                    <td md-cell>{{hopperFinal.disposition}}</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="23">\n                                        <span class="text-boxed-ligth" translate="MOTIONDIALER.NO_HOPPERFINAL_AVAILABLE">No hopperfinal available</span>\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                            <div flex></div>\n                            <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.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_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>\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">{{ \'MOTIONDIALER.CONTACTID\' | translate }}</th>\n                                    <th md-column md-order-by="phone">{{ \'MOTIONDIALER.PHONE\' | translate }}</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>{{hopperBlack.ContactId}}</td>\n                                    <td md-cell>{{hopperBlack.phone}}</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                                        <span class="text-boxed-ligth" translate="MOTIONDIALER.NO_HOPPERBLACK_AVAILABLE">No hopperblack available</span>\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 animate-slide-down 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="QUEUECAMPAIGNS.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="QUEUECAMPAIGNS.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!-- 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})[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                                <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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(queueCampaign, $event)" translate="MOTIONDIALER.EDIT_QUEUECAMPAIGN">\n                                                    Edit QueueCampaign\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.clonedialog(queueCampaign, $event)" translate="MOTIONDIALER.CLONE_QUEUECAMPAIGN">\n                                                    clone QueueCampaign\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.listadddialog(queueCampaign, $event)" translate="MOTIONDIALER.LISTADD_QUEUECAMPAIGN">\n                                                    listadd QueueCampaign\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.blacklistadddialog(queueCampaign, $event)" translate="MOTIONDIALER.BLACKLISTADD_QUEUECAMPAIGN">\n                                                    blacklistadd QueueCampaign\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.teamadddialog(queueCampaign, $event)" translate="MOTIONDIALER.TEAMADD_QUEUECAMPAIGN">\n                                                    teamadd QueueCampaign\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.agentadddialog(queueCampaign, $event)" translate="MOTIONDIALER.AGENTADD_QUEUECAMPAIGN">\n                                                    agentadd QueueCampaign\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(queueCampaign, $event)" translate="MOTIONDIALER.DELETE_QUEUECAMPAIGN">\n                                                    Delete QueueCampaign\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.gotorealtimegoto(queueCampaign, $event)" translate="MOTIONDIALER.GOTOREALTIME_QUEUECAMPAIGN">\n                                                    goToRealtime QueueCampaign\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.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.query.filter = query" on-collapse="vm.query.filter = undefined" debounce="300"></ms-search-bar>\n            <div flex></div>\n            <div class="padding-horizontal-20" layout="column" layout-align="center center">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_DATE">Select a date</span>\n                <div layout="row" layout-align="center center">\n                    <md-button ng-if="vm.pickerModel.dateStart" ng-click="vm.clearAll()" class="md-icon-button no-padding width-20 height-20">\n                        <md-tooltip>{{ \'DASHBOARDS.DELETE\' | translate }}</md-tooltip>\n                        <md-icon md-font-icon="icon-close" class="s16 black-fg"></md-icon>\n                    </md-button>\n                    <md-date-range localization-map="vm.localizationMap" ng-model="vm.pickerModel" auto-confirm="true" show-template="true" md-on-select="vm.getContacts()" placeholder="{{ \'DASHBOARDS.ALL\' | translate }}"></md-date-range>\n                </div>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_AGENT">Select an agent</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.lastAssignedTo" ng-change="vm.getContacts()">\n                    <md-option ng-value="\'null\'" translate="DASHBOARDS.NOT_ASSIGNED"></md-option>\n                    <md-option ng-value="undefined" translate="DASHBOARDS.ALL"></md-option>\n                    <md-option ng-value="agent.name" ng-repeat="agent in vm.agents.rows">{{agent.name}}</md-option>\n                </md-select>\n            </div>\n            <div ng-if="vm.queues.count" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_CAMPAIGN">Select a Campaign</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.queue" ng-change="vm.getContacts()">\n                    <md-option ng-value="undefined" ng-if="vm.queues.count > 1"><em translate="DASHBOARDS.ALL">All</em></md-option>\n                    <md-option ng-value="queue.name" ng-repeat="queue in vm.queues.rows">{{queue.name}}</md-option>\n                </md-select>\n            </div>\n            <md-button class="md-icon-button" ng-click="vm.refresh && 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 ng-if="vm.showTooltip" md-visible="vm.showTooltip">{{\'DASHBOARDS.CLICKRELOAD\' | 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.getContacts">\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 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 tranlsate="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 md-cell class="id">{{contact.id}}</td>\n                    <td md-cell class="firstName">{{contact.calleridname}}</td>\n                    <td md-cell class="list">{{contact.calleridnum}}</td>\n                    <td md-cell class="list">{{vm.queuesMap[contact.queue]}}</td>\n                    <td md-cell class="list">{{contact.queuecallerabandonAt ? (contact.queuecallerabandonAt | formatdate) : undefined }}</td>\n                    <td md-cell class="list">{{contact.queuecallerexitAt ? (contact.queuecallerexitAt | formatdate) : undefined }}</td>\n                    <td md-cell class="list">{{contact.queuecallerexitreason}}</td>\n                    <td md-cell class="list">{{contact.lastAssignedTo}}</td>\n                    <td md-cell class="list">{{contact.disposition}}</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">Assigned a</md-button>\n                                        <md-menu-content>\n                                            <md-menu-item ng-if="contact.lastAssignedTo">\n                                                <md-button ng-click="vm.assignedA(contact)"><em translate="DASHBOARDS.NONE">Not Assigned</em></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.assignedA(contact,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-menu>\n                                        <md-button ng-click="$mdMenu.open()" class="text-capitalize" translate="DASHBOARDS.DISPOSE">Dispose</md-button>\n                                        <md-menu-content>\n                                            <md-menu-item ng-if="vm.dispositions.length > 0" ng-repeat="disposition in vm.dispositions">\n                                                <md-button ng-click="vm.disposed(contact, disposition.name)">{{disposition.name}}</md-button>\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\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>'),e.put("app/main/apps/motiondialer/views/realtime/agents/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.AGENTS">Agents</span>\n        <div flex></div>\n        <ms-search-bar on-search="vm.query.filter = query; vm.onInit()" on-collapse="vm.query.filter = undefined; vm.onInit()" debounce="300"></ms-search-bar>\n        <md-select ng-model="vm.query.globalStatusFilter" class="md-caption" ng-change="vm.query.pauseTypeFilter = \'\'; vm.onInit()">\n            <md-option ng-value="\'\'">{{ \'MOTIONDIALER.ALL\' | translate }}</md-option>\n            <md-option value="pause">{{ \'MOTIONDIALER.PAUSE\' | translate }}</md-option>\n            <md-option value="*pause">{{ \'MOTIONDIALER.PARTIALPAUSE\' | translate }}</md-option>\n            <md-option value="busy">{{ \'MOTIONDIALER.BUSY\' | translate }}</md-option>\n            <md-option value="idle">{{ \'MOTIONDIALER.IDLE\' | translate }}</md-option>\n        </md-select>\n\n        <md-select ng-if="vm.isPause(vm.query.globalStatusFilter)" ng-model="vm.query.pauseTypeFilter" class="md-caption" ng-change="vm.onInit()">\n            <md-option ng-value="\'\'">All</md-option>\n            <md-option value="DEFAULT PAUSE">DEFAULT PAUSE</md-option>\n            <md-option value="ACW">ACW</md-option>\n            <md-option value="LOGININPAUSE">LOGININPAUSE</md-option>\n            <md-option value="Auto-Pause">AUTOPAUSE</md-option>\n            <md-option ng-value="pause.name" ng-repeat="pause in vm.pauses.rows">{{pause.name}}</md-option>\n        </md-select>\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.order" md-on-reorder="vm.onInit">\n            <tr md-row border="1">\n                <th class="bv text-center" colspan="4">{{ \'MOTIONDIALER.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">{{ \'OPENCHANNEL.OPENCHANNEL\' | translate }}</th>\n                <th ng-if="vm.license.fax" class="bv bl text-center" colspan="2">{{ \'FAX.FAX\' | translate }}</th>\n                <th width="10px" class="bt bl" rowspan="2"></th>\n            </tr>\n            <tr md-row>\n                <th class="bl" md-column md-order-by="fullname">{{ \'MOTIONDIALER.NAME\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="globalStatus">{{ \'MOTIONDIALER.STATUS\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="lastLoginAt">{{ \'MOTIONDIALER.LOGIN_TIME\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="lastPauseAt">{{ \'MOTIONDIALER.PAUSE_TIME\' | translate }}</th>\n\n                <th class="bl custom-column">{{ \'VOICE.STATUS\' | translate }}</th>\n                <th class="bl custom-column">Info</th>\n\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\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\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\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\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            </tr>\n        </thead>\n        <tbody md-body>\n            <tr md-row ng-hide="vm.order.length">\n                <td md-cell colspan="17">\n                    <div layout="row" layout-align="center center">\n                        <span>{{ \'MOTIONDIALER.NO_AGENT_ONLINE\' | translate }}</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-select="vm.agents[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td class="bt padding-5">\n                    <div layout="row" layout-align="start center">\n                        <img class="avatar" ng-src="{{vm.agents[value].userpic && \'api/users/\'+vm.agents[value].id+\'/avatar\' || \'assets/images/avatars/profile.png\'}}">\n                        <div layout="column">\n                            <span>{{vm.agents[value].fullname}}</span>\n                            <span>{{vm.agents[value].internal}}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class="bt">\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'}[vm.agents[value].globalStatus]\">{{ vm.isPause(vm.agents[value].globalStatus) ? '' : vm.agents[value].globalStatus | uppercase }} {{ vm.isPause(vm.agents[value].globalStatus) ? (vm.isPartialPause(vm.agents[value].globalStatus) ? '*'+vm.agents[value].pauseType || 'DEFAULT PAUSE'  : vm.agents[value].pauseType || 'DEFAULT PAUSE') : ''}}</span>\n                </td>\n                <td class=\"bt custom-column\">\n                    <timer start-time=\"vm.agents[value].lastLoginAt\" interval=\"1000\">{{ days > 0 ? days + 'd' : '' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                </td>\n                <td class=\"bt custom-column\">\n                    <timer ng-if=\"vm.isPause(vm.agents[value].globalStatus) || vm.isPartialPause(vm.agents[value].globalStatus)\" start-time=\"vm.agents[value].lastPauseAt\" interval=\"1000\">{{ days > 0 ? days + 'd' : '' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                </td>\n                <td class=\"bt bl\">\n                    <div layout=\"row\">\n                        <span ng-if=\"!vm.agents[value].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'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].voiceStatus | uppercase }}</span>\n                        <span ng-if=\"vm.agents[value].onhold\" class=\"text-boxed md-background-bg bl bt padding-5 orange-400-bg\">ONHOLD</span>\n                    </div>\n                </td>\n                <td class=\"bt bl\">\n                    <div layout=\"column\">\n                        <span ng-if=\"vm.agents[value].queue\" class=\"padding-5\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].queue }}</span>\n                        <span ng-if=\"vm.agents[value].destconnectedlinenum\" class=\"padding-5\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].destconnectedlinenum }}</span>\n                        <span class=\"padding-5\" ng-if=\"vm.agents[value].queue || vm.agents[value].destconnectedlinenum\">\n                            <timer start-time=\"vm.agents[value].voiceStatusTime\" interval=\"1000\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                        </span>\n                    </div>\n                </td>\n                <td class=\"bt bl\" ng-if=\"vm.license.chat\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].chatStatus]\">{{ vm.agents[value].chatStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td md-number class=\"bt text-center font-size-20\" ng-if=\"vm.license.chat\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].chatStatus]\">{{ vm.agents[value].chatCurrentCapacity }}</td>\n                <td class=\"bl bt\" ng-if=\"vm.license.mail\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].mailStatus]\">{{ vm.agents[value].mailStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.mail\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].mailStatus]\">{{ vm.agents[value].mailCurrentCapacity }}</td>\n                <td class=\"bl bt\" ng-if=\"vm.license.messaging\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].smsStatus]\">{{ vm.agents[value].smsStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.messaging\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].smsStatus]\">{{ vm.agents[value].smsCurrentCapacity }}</td>\n                <td class=\"bt bl\" ng-if=\"vm.license.openchannel\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].openchannelStatus]\">{{ vm.agents[value].openchannelStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.openchannel\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].openchannelStatus]\">{{ vm.agents[value].openchannelCurrentCapacity }}</td>\n                <td class=\"bt bl\" ng-if=\"vm.license.fax\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].faxStatus]\">{{ vm.agents[value].faxStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.fax\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].faxStatus]\">{{ vm.agents[value].faxCurrentCapacity }}</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\n                        <md-menu-content width=\"4\">\n                            <md-menu-item>\n                                <md-button ng-click=\"vm.logout(vm.agents[value], $event)\" translate=\"MOTIONDIALER.LOGOUT\">\n                                    Logout\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-button ng-click=\"vm.queueAdd(vm.agents[value], $event)\" translate=\"MOTIONDIALER.AGENTADD_QUEUE\">\n                                    Add Agent In Queue\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-menu>\n                                    <md-button ng-click=\"$mdMenu.open()\" class=\"text-capitalize\" translate=\"MOTIONDIALER.PAUSE\">Pause</md-button>\n                                    <md-menu-content>\n                                        <md-menu-item>\n                                            <md-button ng-disabled=\" vm.agents[value].voicePause && 'DEFAULT PAUSE' === vm.agents[value].pauseType\" ng-click=\"vm.pause(vm.agents[value])\"><em translate=\"MOTIONDIALER.DEFAULT_PAUSE\">Default Pause</em></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=\"vm.agents[value].voicePause && pause.name === vm.agents[value].pauseType\" ng-click=\"vm.pause(vm.agents[value], pause.name)\">{{pause.name}}</md-button>\n                                        </md-menu-item>\n                                    </md-menu-content>\n                                </md-menu>\n                            </md-menu-item>\n                            <md-menu-item ng-if=\"vm.isPause(vm.agents[value].globalStatus)\">\n                                <md-button ng-click=\"vm.unPause(vm.agents[value])\" translate=\"MOTIONDIALER.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\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.filteredAgents.length}}\" md-on-paginate=\"vm.onInit\" md-page-select></md-table-pagination>\n\x3c!-- / AGENT TABLE --\x3e\n\x3c!-- / MAIN --\x3e"),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.query.filter = 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>{{\'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">\n                <td md-cell colspan="8">\n                    <div layout="row" layout-align="center center">\n                        <span tranlsate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-row ng-repeat="(id, campaign) in vm.campaigns">\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.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_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="MOTIONDIALER.QUEUE_CALLS">Queue Calls</span>\n        \x3c!-- <div flex></div>\n    <ms-search-bar on-search="vm.query.filter = query;" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar> --\x3e\n    </div>\n</md-toolbar>\n\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>{{ \'MOTIONDIALER.DID\' | translate }}</th>\n                <th md-column>{{ \'MOTIONDIALER.QUEUE\' | translate }}</th>\n                <th md-column>{{ \'MOTIONDIALER.CALLER\' | translate }}</th>\n                <th md-column>{{ \'MOTIONDIALER.AGENT\' | translate }}</th>\n                <th md-column>{{ \'MOTIONDIALER.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.getSize(vm.rpcVoiceQueuesChannels)">\n                <td md-cell colspan="6">\n                    <div layout="row" layout-align="center center">\n                        <span tranlsate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-row ng-repeat="(key, channel) in vm.rpcVoiceQueuesChannels | limitObjectFromTo: vm.queryChannels.limit:(vm.queryChannels.page - 1) * vm.queryChannels.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 md-cell>{{channel.queue}}</td>\n                <td md-cell>{{channel.calleridnum}}</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" interval="1000">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                        </span>\n                    </span>\n                    <span ng-if="!channel.queuecallerleaveAt" class="text-boxed">\n                        {{ \'MOTIONDIALER.WAITING_FOR_AGENT\' | translate }}\n                        <timer start-time="channel.queuecallerjoinAt" interval="1000">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                    </span>\n                </td>\n                <td md-cell>\n                    <span class="text-boxed">\n                        <timer start-time="channel.queuecallerjoinAt" interval="1000">{{hhours}}:{{mminutes}}:{{sseconds}}</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\n                        <md-menu-content width="2">\n                            <md-menu-item>\n                                <md-button ng-click="vm.hangup(channel.uniqueid)" translate="MOTIONDIALER.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="MOTIONDIALER.REDIRECT_TO_NUMBER">\n                                    Number\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-menu>\n                                    <md-button ng-click="$mdMenu.open()" translate="MOTIONDIALER.REDIRECT_TO_AGENT">Redirect to Agent</md-button>\n                                    <md-menu-content>\n                                        <md-menu-item ng-repeat="agent in vm.agents.rows">\n                                            <md-button ng-click="vm.redirectToAgent(channel.uniqueid, agent.name, agent.context)">{{agent.name}}</md-button>\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\n<md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm.queryChannels.limit" md-page="vm.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm.getSize(vm.rpcVoiceQueuesChannels)}}" md-page-select></md-table-pagination>\n\x3c!-- / QUEUES 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.query.filter = 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>{{\'\n                                MOTIONDIALER.NAME\' | translate}}</th>\n                <th md-column>{{\'\n                                MOTIONDIALER.TOTAL\' | translate}}</th>\n                <th md-column>{{\'\n                                MOTIONDIALER.TOTAL_OFFERED\' | translate}}</th>\n                <th md-column>{{\'\n                                MOTIONDIALER.MANAGED\' | translate}}</th>\n                <th md-column>{{\'\n                                MOTIONDIALER.ABANDONED\' | translate}}</th>\n                <th md-column>{{\'\n                                MOTIONDIALER.DROPPED\' | translate}}</th>\n                <th md-column>{{\'\n                                MOTIONDIALER.AVG_HOLD_TIME\' | translate}}</th>\n                <th md-column>{{\'\n                                MOTIONDIALER.AVG_DURATION\' | translate}}</th>\n                <th md-column>{{\'\n                                MOTIONDIALER.AVG_BILLABLE\' | translate}}</th>\n            </tr>\n        </thead>\n        <tbody md-body>\n            <tr md-row ng-hide="vm.queues">\n                <td md-cell colspan="8">\n                    <div layout="row" layout-align="center center">\n                        <span tranlsate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-row ng-repeat="(id, queue) in vm.queues">\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.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/queues/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.QUEUES">Queues</span>\n        <div flex></div>\n        <ms-search-bar on-search="vm.query.filter = 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.LOGGED_IN\' | translate }}</th>\n                <th md-column>{{ \'MOTIONDIALER.PAUSED\' | translate }}</th>\n                <th md-column>{{ \'MOTIONDIALER.READY\' | translate }}</th>\n                <th md-column>{{ \'MOTIONDIALER.WAITING\' | translate }}</th>\n                <th md-column>{{ \'MOTIONDIALER.TALKING\' | translate }}</th>\n                <th md-column>{{ \'MOTIONDIALER.ORIGINATED\' | 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>\n        </thead>\n        <tbody md-body>\n            <tr md-row ng-hide="vm.queues">\n                <td md-cell colspan="12">\n                    <div layout="row" layout-align="center center">\n                        <span tranlsate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-row md-select="vm.queues[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td md-cell>{{vm.queues[value].name}}</td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].loggedInDb || 0}} ({{vm.queues[value].loggedIn || 0}})</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].paused || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-16 grey-fg">{{vm.queues[value].available || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].waiting || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-16 grey-fg">{{(vm.queues[value].talking || 0)  +  (vm.queues[value].pTalking || 0)}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-16 grey-fg">{{vm.queues[value].originated || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-16 grey-fg">{{vm.queues[value].message ? (\'MOTIONDIALER.\'+vm.queues[value].message | translate) : \'--\'}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-16 grey-fg">{{vm.queues[value].dialMethod || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-16 grey-fg">{{vm.queues[value].Trunk ? vm.queues[value].Trunk.name : \'--\'}}</span>\n                </td>\n                <td md-cell>\n                    <md-icon md-colors="{color: {{vm.queues[value].dialActive ? \'\\\'green\\\'\' : \'\\\'red\\\'\'}}}" md-font-icon="{{vm.queues[value].dialActive ? \'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\n                        <md-menu-content width="3">\n                            <md-menu-item>\n                                <md-button ng-click="vm.createOrEditMotionDialerQueue($event, vm.queues[value])" translate="MOTIONDIALER.EDIT_QUEUE">\n                                    Edit Queue\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-button ng-click="vm.agentAdd($event, vm.queues[value])" translate="MOTIONDIALER.AGENTSADD_QUEUE">\n                                    Add Agents to queue\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.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 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="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"></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 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="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" 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/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 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="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="1">One Time</md-option>\n                    <md-option ng-value="0">Always</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" md-maxlength="255" 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 ng-message="md-maxlength">\n                        <span translate="OPENCHANNEL.ERRORS.TEXT_MAX_LENGTH" translate-values=\'{max: 255}\'>Text 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/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 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="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/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 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="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 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="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="inboundroute-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 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\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 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="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 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="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" 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 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="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 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="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 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="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/openchannelDispositions/dialog.html",'<md-dialog class="openchannelDisposition-dialog" aria-label="New OpenchannelDisposition">\n    <form name="openchannelDispositionForm" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="OPENCHANNEL.NAME">Name</label>\n                <input type="" name="name" ng-model="vm.openchannelDisposition.name" ng-required="true" autofocus>\n\n                <div ng-messages="openchannelDispositionForm[\'name\'].$error" ng-show="openchannelDispositionForm[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.newOpenchannelDisposition" ng-click="vm.saveOpenchannelDisposition()" class="send-button md-accent md-raised" ng-disabled="openchannelDispositionForm.$invalid || openchannelDispositionForm.$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.newOpenchannelDisposition" ng-click="vm.addNewOpenchannelDisposition()" class="send-button md-accent md-raised" ng-disabled="openchannelDispositionForm.$invalid" aria-label="ADD" translate="OPENCHANNEL.ADD_OPENCHANNELDISPOSITION" translate-attr-aria-label="OPENCHANNEL.ADD_OPENCHANNELDISPOSITION">\n                    ADD OPENCHANNELDISPOSITION\n                </md-button>\n            </div>\n            <div layout="row">\n                <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newOpenchannelDisposition" ng-click="vm.deleteOpenchannelDisposition($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" 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                            <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, 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" 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" 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 class="openchannelAccount-detail-form-container openchanneldispositions md-background-bg md-whiteframe-1dp">\n                        <div ng-controller="OpenchannelAccountOpenchannelDispositionsController as vm_dc" ng-init="vm_dc.init(vm.openchannelAccount, vm.crudPermissions)">\n                            <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedOpenchannelAccountOpenchannelDispositions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead" translate="OPENCHANNEL.OPENCHANNELDISPOSITIONS">OpenchannelDispositions</span>\n                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\n                                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelDisposition($event)" aria-label="add openchannelDisposition" translate translate-attr-label="OPENCHANNEL.ADD_OPENCHANNELDISPOSITION">\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.selectedOpenchannelAccountOpenchannelDispositions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead">{{vm_dc.selectedOpenchannelAccountOpenchannelDispositions.length}} {{vm_dc.selectedOpenchannelAccountOpenchannelDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                                    <div flex></div>\n                                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedOpenchannelAccountOpenchannelDispositions" 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.deleteSelectedOpenchannelAccountOpenchannelDispositions($event)" aria-label="delete selected" translate translate-attr-label="OPENCHANNELACCOUNTS.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.selectedOpenchannelAccountOpenchannelDispositions" md-progress="vm_dc.promise">\n                                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getOpenchannelAccountOpenchannelDispositions">\n                                        <tr md-row>\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="createdAt">{{ \'OPENCHANNEL.CREATED_AT\' | translate }}</th>\n                                            <th md-column width="10px"></th>\n                                        </tr>\n                                    </thead>\n                                    <tbody md-body>\n                                        <tr md-row md-select="openchannelDisposition" md-select-id="id" ng-repeat="openchannelDisposition in vm_dc.openchannelAccountOpenchannelDispositions.rows">\n                                            <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelDisposition($event, openchannelDisposition)" md-cell>{{openchannelDisposition.id}}</td>\n                                            <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelDisposition($event, openchannelDisposition)" md-cell>{{openchannelDisposition.name}}</td>\n                                            <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelDisposition($event, openchannelDisposition)" md-cell>{{openchannelDisposition.createdAt | date:\'medium\'}}</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.createOrEditOpenchannelAccountOpenchannelDisposition($event, openchannelDisposition)" translate="OPENCHANNEL.EDIT_OPENCHANNELDISPOSITION">\n                                                                Edit OpenchannelDisposition\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(openchannelDisposition, $event)" translate="OPENCHANNEL.DELETE_OPENCHANNELDISPOSITION">\n                                                                Delete OpenchannelDisposition\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.openchannelAccountOpenchannelDispositions.rows.length">\n                                            <td md-cell colspan="5">\n                                                <span class="text-boxed-ligth" translate="OPENCHANNEL.NO_OPENCHANNELDISPOSITION_AVAILABLE">No openchanneldisposition available</span>\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.openchannelAccountOpenchannelDispositions.count}}" md-on-paginate="vm_dc.getOpenchannelAccountOpenchannelDispositions" 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.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)">\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                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="OPENCHANNELACCOUNTS.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.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">{{ \'OPENCHANNEL.ID\' | translate }}</th>\n                                            <th md-column md-order-by="key">{{ \'OPENCHANNEL.KEY\' | translate }}</th>\n                                            <th md-column md-order-by="value">{{ \'OPENCHANNEL.VALUE\' | translate }}</th>\n                                            <th md-column md-order-by="description">{{ \'OPENCHANNEL.DESCRIPTION\' | translate }}</th>\n                                            <th md-column md-order-by="createdAt">{{ \'OPENCHANNEL.CREATED_AT\' | translate }}</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>{{openchannelCannedAnswer.id}}</td>\n                                            <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" md-cell>{{openchannelCannedAnswer.key}}</td>\n                                            <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" md-cell>{{openchannelCannedAnswer.value}}</td>\n                                            <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" md-cell>{{openchannelCannedAnswer.description}}</td>\n                                            <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" md-cell>{{openchannelCannedAnswer.createdAt | date:\'medium\'}}</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                                                <span class="text-boxed-ligth" translate="OPENCHANNEL.NO_OPENCHANNELCANNEDANSWER_AVAILABLE">No openchannelcannedanswer available</span>\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" ms-scroll 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.alias || a.appType) | uppercase}}">{{a.alias || 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" ms-scroll 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" style="width:200px">{{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-ligth" 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)">\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                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="OPENCHANNELACCOUNTS.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.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">{{ \'OPENCHANNEL.ID\' | translate }}</th>\n                                            <th md-column md-order-by="createdAt">{{ \'OPENCHANNEL.STARTEDAT\' | translate }}</th>\n                                            <th md-column>{{ \'OPENCHANNEL.CONTACT\' | translate }}</th>\n                                            <th md-column>{{ \'OPENCHANNEL.AGENT\' | translate }}</th>\n                                            <th md-column md-order-by="closedAt">{{ \'OPENCHANNEL.CLOSEDAT\' | translate }}</th>\n                                            <th md-column md-order-by="disposition">{{ \'OPENCHANNEL.DISPOSITION\' | translate }}</th>\n                                            <th md-column md-order-by="note">{{ \'OPENCHANNEL.NOTES\' | translate }}</th>\n                                            <th md-column md-order-by="tag">{{ \'OPENCHANNEL.TAGS\' | translate }}</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">\n                                            <td md-cell>{{interaction.id}}</td>\n                                            <td md-cell>{{interaction.createdAt | date:\'medium\'}}</td>\n                                            <td md-cell>{{interaction.Contact.firstName}}</td>\n                                            <td md-cell>{{interaction.Owner.name}}</td>\n                                            <td md-cell>{{interaction.closedAt | date:\'medium\'}}</td>\n                                            <td md-cell>{{interaction.disposition}}</td>\n                                            <td md-cell>{{interaction.note}}</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"></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>\n                                                            <md-button class="md-primary" ng-click="vm_dc.openchannelInteractionDownload(interaction, $event)" translate="OPENCHANNEL.DOWNLOAD_INTERACTION">\n                                                                Download Interaction\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="13">\n                                                <span class="text-boxed-ligth" translate="OPENCHANNEL.NO_INTERACTION_AVAILABLE">No interaction available</span>\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 animate-slide-down 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="OPENCHANNELACCOUNTS.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="OPENCHANNELACCOUNTS.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!-- 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})[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                                <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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(openchannelAccount, $event)" translate="OPENCHANNEL.EDIT_OPENCHANNELACCOUNT">\n                                                    Edit OpenchannelAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.interactionsgoto(openchannelAccount, $event)" translate="OPENCHANNEL.INTERACTIONS_OPENCHANNELACCOUNT">\n                                                    Interactions OpenchannelAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.agentadddialog(openchannelAccount, $event)" translate="OPENCHANNEL.AGENTADD_OPENCHANNELACCOUNT">\n                                                    AgentAdd OpenchannelAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(openchannelAccount, $event)" translate="OPENCHANNEL.DELETE_OPENCHANNELACCOUNT">\n                                                    Delete OpenchannelAccount\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: \'{{\'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 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="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" 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"></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"></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" 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 animate-slide-down 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="OPENCHANNELQUEUES.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="OPENCHANNELQUEUES.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!-- 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                                <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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(openchannelQueue, $event)" translate="OPENCHANNEL.EDIT_OPENCHANNELQUEUE">\n                                                    Edit OpenchannelQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.teamadddialog(openchannelQueue, $event)" translate="OPENCHANNEL.TEAMADD_OPENCHANNELQUEUE">\n                                                    teamadd OpenchannelQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.agentadddialog(openchannelQueue, $event)" translate="OPENCHANNEL.AGENTADD_OPENCHANNELQUEUE">\n                                                    agentadd OpenchannelQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(openchannelQueue, $event)" translate="OPENCHANNEL.DELETE_OPENCHANNELQUEUE">\n                                                    Delete OpenchannelQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.gotorealtimegoto(openchannelQueue, $event)" translate="OPENCHANNEL.GOTOREALTIME_OPENCHANNELQUEUE">\n                                                    goToRealtime OpenchannelQueue\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: \'{{\'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/agents/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="OPENCHANNEL.AGENTS">Agents</span>\n        <div flex></div>\n        <ms-search-bar on-search="vm.query.filter = query; vm.onInit()" on-collapse="vm.query.filter = undefined; vm.onInit()" debounce="300"></ms-search-bar>\n        <md-select ng-model="vm.query.globalStatusFilter" class="md-caption" ng-change="vm.query.pauseTypeFilter = \'\'; vm.onInit()">\n            <md-option ng-value="\'\'">{{ \'OPENCHANNEL.ALL\' | translate }}</md-option>\n            <md-option value="pause">{{ \'OPENCHANNEL.PAUSE\' | translate }}</md-option>\n            <md-option value="*pause">{{ \'OPENCHANNEL.PARTIALPAUSE\' | translate }}</md-option>\n            <md-option value="busy">{{ \'OPENCHANNEL.BUSY\' | translate }}</md-option>\n            <md-option value="idle">{{ \'OPENCHANNEL.IDLE\' | translate }}</md-option>\n        </md-select>\n\n        <md-select ng-if="vm.isPause(vm.query.globalStatusFilter)" ng-model="vm.query.pauseTypeFilter" class="md-caption" ng-change="vm.onInit()">\n            <md-option ng-value="\'\'">All</md-option>\n            <md-option value="DEFAULT PAUSE">DEFAULT PAUSE</md-option>\n            <md-option value="ACW">ACW</md-option>\n            <md-option value="LOGININPAUSE">LOGININPAUSE</md-option>\n            <md-option value="Auto-Pause">AUTOPAUSE</md-option>\n            <md-option ng-value="pause.name" ng-repeat="pause in vm.pauses.rows">{{pause.name}}</md-option>\n        </md-select>\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.order" md-on-reorder="vm.onInit">\n            <tr md-row border="1">\n                <th class="bv text-center" colspan="4">{{ \'OPENCHANNEL.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">{{ \'OPENCHANNEL.OPENCHANNEL\' | translate }}</th>\n                <th ng-if="vm.license.fax" class="bv bl text-center" colspan="2">{{ \'FAX.FAX\' | translate }}</th>\n                <th width="10px" class="bt bl" rowspan="2"></th>\n            </tr>\n            <tr md-row>\n                <th class="bl" md-column md-order-by="fullname">{{ \'OPENCHANNEL.NAME\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="globalStatus">{{ \'OPENCHANNEL.STATUS\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="lastLoginAt">{{ \'OPENCHANNEL.LOGIN_TIME\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="lastPauseAt">{{ \'OPENCHANNEL.PAUSE_TIME\' | translate }}</th>\n\n                <th class="bl custom-column">{{ \'VOICE.STATUS\' | translate }}</th>\n                <th class="bl custom-column">Info</th>\n\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\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\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\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\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            </tr>\n        </thead>\n        <tbody md-body>\n            <tr md-row ng-hide="vm.order.length">\n                <td md-cell colspan="17">\n                    <div layout="row" layout-align="center center">\n                        <span>{{ \'OPENCHANNEL.NO_AGENT_ONLINE\' | translate }}</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-select="vm.agents[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td class="bt padding-5">\n                    <div layout="row" layout-align="start center">\n                        <img class="avatar" ng-src="{{vm.agents[value].userpic && \'api/users/\'+vm.agents[value].id+\'/avatar\' || \'assets/images/avatars/profile.png\'}}">\n                        <div layout="column">\n                            <span>{{vm.agents[value].fullname}}</span>\n                            <span>{{vm.agents[value].internal}}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class="bt">\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'}[vm.agents[value].globalStatus]\">{{ vm.isPause(vm.agents[value].globalStatus) ? '' : vm.agents[value].globalStatus | uppercase }} {{ vm.isPause(vm.agents[value].globalStatus) ? (vm.isPartialPause(vm.agents[value].globalStatus) ? '*'+vm.agents[value].pauseType || 'DEFAULT PAUSE'  : vm.agents[value].pauseType || 'DEFAULT PAUSE') : ''}}</span>\n                </td>\n                <td class=\"bt custom-column\">\n                    <timer start-time=\"vm.agents[value].lastLoginAt\" interval=\"1000\">{{ days > 0 ? days + 'd' : '' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                </td>\n                <td class=\"bt custom-column\">\n                    <timer ng-if=\"vm.isPause(vm.agents[value].globalStatus) || vm.isPartialPause(vm.agents[value].globalStatus)\" start-time=\"vm.agents[value].lastPauseAt\" interval=\"1000\">{{ days > 0 ? days + 'd' : '' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                </td>\n                <td class=\"bt bl\">\n                    <div layout=\"row\">\n                        <span ng-if=\"!vm.agents[value].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'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].voiceStatus | uppercase }}</span>\n                        <span ng-if=\"vm.agents[value].onhold\" class=\"text-boxed md-background-bg bl bt padding-5 orange-400-bg\">ONHOLD</span>\n                    </div>\n                </td>\n                <td class=\"bt bl\">\n                    <div layout=\"column\">\n                        <span ng-if=\"vm.agents[value].queue\" class=\"padding-5\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].queue }}</span>\n                        <span ng-if=\"vm.agents[value].destconnectedlinenum\" class=\"padding-5\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].destconnectedlinenum }}</span>\n                        <span class=\"padding-5\" ng-if=\"vm.agents[value].queue || vm.agents[value].destconnectedlinenum\">\n                            <timer start-time=\"vm.agents[value].voiceStatusTime\" interval=\"1000\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                        </span>\n                    </div>\n                </td>\n                <td class=\"bt bl\" ng-if=\"vm.license.chat\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].chatStatus]\">{{ vm.agents[value].chatStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td md-number class=\"bt text-center font-size-20\" ng-if=\"vm.license.chat\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].chatStatus]\">{{ vm.agents[value].chatCurrentCapacity }}</td>\n                <td class=\"bl bt\" ng-if=\"vm.license.mail\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].mailStatus]\">{{ vm.agents[value].mailStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.mail\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].mailStatus]\">{{ vm.agents[value].mailCurrentCapacity }}</td>\n                <td class=\"bl bt\" ng-if=\"vm.license.messaging\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].smsStatus]\">{{ vm.agents[value].smsStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.messaging\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].smsStatus]\">{{ vm.agents[value].smsCurrentCapacity }}</td>\n                <td class=\"bt bl\" ng-if=\"vm.license.openchannel\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].openchannelStatus]\">{{ vm.agents[value].openchannelStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.openchannel\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].openchannelStatus]\">{{ vm.agents[value].openchannelCurrentCapacity }}</td>\n                <td class=\"bt bl\" ng-if=\"vm.license.fax\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].faxStatus]\">{{ vm.agents[value].faxStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.fax\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].faxStatus]\">{{ vm.agents[value].faxCurrentCapacity }}</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\n                        <md-menu-content width=\"4\">\n                            <md-menu-item>\n                                <md-button ng-click=\"vm.logout(vm.agents[value], $event)\" translate=\"OPENCHANNEL.LOGOUT\">\n                                    Logout\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-button ng-click=\"vm.queueAdd(vm.agents[value], $event)\" translate=\"OPENCHANNEL.AGENTADD_QUEUE\">\n                                    Add Agent In Queue\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-menu>\n                                    <md-button ng-click=\"$mdMenu.open()\" class=\"text-capitalize\" translate=\"OPENCHANNEL.PAUSE\">Pause</md-button>\n                                    <md-menu-content>\n                                        <md-menu-item>\n                                            <md-button ng-disabled=\" vm.agents[value].voicePause && 'DEFAULT PAUSE' === vm.agents[value].pauseType\" ng-click=\"vm.pause(vm.agents[value])\"><em translate=\"OPENCHANNEL.DEFAULT_PAUSE\">Default Pause</em></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=\"vm.agents[value].voicePause && pause.name === vm.agents[value].pauseType\" ng-click=\"vm.pause(vm.agents[value], pause.name)\">{{pause.name}}</md-button>\n                                        </md-menu-item>\n                                    </md-menu-content>\n                                </md-menu>\n                            </md-menu-item>\n                            <md-menu-item ng-if=\"vm.isPause(vm.agents[value].globalStatus)\">\n                                <md-button ng-click=\"vm.unPause(vm.agents[value])\" translate=\"OPENCHANNEL.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\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.filteredAgents.length}}\" md-on-paginate=\"vm.onInit\" md-page-select></md-table-pagination>\n\x3c!-- / AGENT TABLE --\x3e\n\x3c!-- / MAIN --\x3e"),e.put("app/main/apps/openchannel/views/realtime/queues/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="OPENCHANNEL.QUEUES">Queues</span>\n        <div flex></div>\n        <ms-search-bar on-search="vm.query.filter = 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">{{ \'OPENCHANNEL.NAME\' | translate }}</th>\n                <th md-column>{{ \'OPENCHANNEL.LOGGED_IN\' | translate }}</th>\n                <th md-column>{{ \'OPENCHANNEL.PAUSED\' | translate }}</th>\n                <th md-column>{{ \'OPENCHANNEL.READY\' | translate }}</th>\n                <th md-column>{{ \'OPENCHANNEL.WAITING\' | translate }}</th>\n                <th md-column width="10px"></th>\n            </tr>\n        </thead>\n        <tbody md-body>\n            <tr md-row ng-hide="vm.queues">\n                <td md-cell colspan="7">\n                    <div layout="row" layout-align="center center">\n                        <span tranlsate="OPENCHANNEL.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-row md-select="vm.queues[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td md-cell>{{vm.queues[value].name}}</td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].loggedInDb || 0}} ({{vm.queues[value].loggedIn || 0}})</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].paused || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-16 grey-fg">{{vm.queues[value].available || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].waiting || 0}}</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="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.createOrEditOpenchannelQueue($event, vm.queues[value])" translate="OPENCHANNEL.EDIT_QUEUE">\n                                    Edit Queue\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-button ng-click="vm.agentAdd($event, vm.queues[value])" translate="OPENCHANNEL.AGENTSADD_QUEUE">\n                                    Add Agents to queue\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: \'{{\'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.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/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/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 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                <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.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) || (customizationsForm.$invalid || logoForm.$invalid || logologinForm.$invalid || preferredForm.$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" ms-scroll>\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.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>\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 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="SETTINGS.MIN_INTERNAL">Min_Internal</label>\n                <input type="number" name="min_internal" ng-model="vm.general.min_internal" min="0" ng-required="true" autofocus>\n\n                <div ng-messages="generalForm[\'min_internal\'].$error" ng-show="generalForm[\'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                <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.CHATTIMEOUT">chatTimeout</label>\n                <input type="number" name="chatTimeout" ng-model="vm.general.chatTimeout" min="0" ng-required="true">\n\n                <div ng-messages="generalForm[\'chatTimeout\'].$error" ng-show="generalForm[\'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                <label translate="SETTINGS.STUNADDR">Stunaddr</label>\n                <input type="text" name="stunaddr" ng-model="vm.general.stunaddr">\n\n                <div ng-messages="generalForm[\'stunaddr\'].$error" ng-show="generalForm[\'stunaddr\'].$touched" role="alert">\n                    <div ng-message="required">\n                        <span translate="SETTINGS.ERRORS.STUNADDR_REQUIRED">Stunaddr field is required</span>\n                    </div>\n                </div>\n            </md-input-container>\n            <md-input-container class="md-block">\n                <label translate="SETTINGS.TURNADDR">Turnaddr</label>\n                <input type="text" name="turnaddr" ng-model="vm.general.turnaddr">\n\n                <div ng-messages="generalForm[\'turnaddr\'].$error" ng-show="generalForm[\'turnaddr\'].$touched" role="alert">\n                    <div ng-message="required">\n                        <span translate="SETTINGS.ERRORS.TURNADDR_REQUIRED">Turnaddr field is required</span>\n                    </div>\n                </div>\n            </md-input-container>\n            <md-input-container class="md-block">\n                <label translate="SETTINGS.TURN_USERNAME">Turn_Username</label>\n                <input type="text" name="turnusername" ng-model="vm.general.turnusername">\n\n                <div ng-messages="generalForm[\'turnusername\'].$error" ng-show="generalForm[\'turnusername\'].$touched" role="alert">\n                    <div ng-message="required">\n                        <span translate="SETTINGS.ERRORS.TURN_USERNAME_REQUIRED">Turn_Username field is required</span>\n                    </div>\n                </div>\n            </md-input-container>\n            <md-input-container class="md-block">\n                <label translate="SETTINGS.TURN_PASSWORD">Turn_Password</label>\n                <input type="text" name="turnpassword" ng-model="vm.general.turnpassword">\n\n                <div ng-messages="generalForm[\'turnpassword\'].$error" ng-show="generalForm[\'turnpassword\'].$touched" role="alert">\n                    <div ng-message="required">\n                        <span translate="SETTINGS.ERRORS.TURN_PASSWORD_REQUIRED">Turn_Password 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.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">\n\n                <div ng-messages="generalForm[\'splitSizeCsv\'].$error" ng-show="generalForm[\'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">\n\n                <div ng-messages="generalForm[\'splitSizePdf\'].$error" ng-show="generalForm[\'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">\n\n                <div ng-messages="generalForm[\'splitSizeXlsx\'].$error" ng-show="generalForm[\'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            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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) || (globalForm.$invalid || motionbarForm.$invalid || reportForm.$invalid || agentOmniDesktopInterfaceForm.$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" ms-scroll>\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" 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                        <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.CHATTIMEOUT">chatTimeout</label>\n                        <input type="number" name="chatTimeout" ng-model="vm.general.chatTimeout" min="0" 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                        <label translate="SETTINGS.STUNADDR">Stunaddr</label>\n                        <input type="text" name="stunaddr" ng-model="vm.general.stunaddr">\n\n                        <div ng-messages="globalForm[\'stunaddr\'].$error" ng-show="globalForm[\'stunaddr\'].$touched" role="alert">\n                            <div ng-message="required">\n                                <span translate="SETTINGS.ERRORS.STUNADDR_REQUIRED">Stunaddr field is required</span>\n                            </div>\n                        </div>\n                    </md-input-container>\n                    <md-input-container class="md-block">\n                        <label translate="SETTINGS.TURNADDR">Turnaddr</label>\n                        <input type="text" name="turnaddr" ng-model="vm.general.turnaddr">\n\n                        <div ng-messages="globalForm[\'turnaddr\'].$error" ng-show="globalForm[\'turnaddr\'].$touched" role="alert">\n                            <div ng-message="required">\n                                <span translate="SETTINGS.ERRORS.TURNADDR_REQUIRED">Turnaddr field is required</span>\n                            </div>\n                        </div>\n                    </md-input-container>\n                    <md-input-container class="md-block">\n                        <label translate="SETTINGS.TURN_USERNAME">Turn_Username</label>\n                        <input type="text" name="turnusername" ng-model="vm.general.turnusername">\n\n                        <div ng-messages="globalForm[\'turnusername\'].$error" ng-show="globalForm[\'turnusername\'].$touched" role="alert">\n                            <div ng-message="required">\n                                <span translate="SETTINGS.ERRORS.TURN_USERNAME_REQUIRED">Turn_Username field is required</span>\n                            </div>\n                        </div>\n                    </md-input-container>\n                    <md-input-container class="md-block">\n                        <label translate="SETTINGS.TURN_PASSWORD">Turn_Password</label>\n                        <input type="text" name="turnpassword" ng-model="vm.general.turnpassword">\n\n                        <div ng-messages="globalForm[\'turnpassword\'].$error" ng-show="globalForm[\'turnpassword\'].$touched" role="alert">\n                            <div ng-message="required">\n                                <span translate="SETTINGS.ERRORS.TURN_PASSWORD_REQUIRED">Turn_Password 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.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\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" 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">\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">\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">\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                        <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\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        <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>\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" ms-scroll>\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>\n                                <a href="https://www.xcally.com/en/index.html#pricing-table2-h" 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="36" 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                            </div>\n                        </div>\n                    </div>\n\n                    <span ng-if="!vm.license.demo && !vm.license.gray" 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 class="text-italic text-bold">{{vm.license.uuid}}</span></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 class="text-italic text-bold">{{vm.license.machineUuid}}</span></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\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" 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                    <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" 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 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="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="36"><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 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            <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 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="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-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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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 animate-slide-down 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="NETWORKS.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="NETWORKS.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!-- 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                                <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                                        <md-menu-content width="3">\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.editdialog(network, $event)" translate="SETTINGS.EDIT_NETWORK">\n                                                    Edit Network\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.deleteconfirm(network, $event)" translate="SETTINGS.DELETE_NETWORK">\n                                                    Delete Network\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: \'{{\'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/create/dialog.html",'<md-dialog class="smtp-dialog" aria-label="New Smtp">\n    <form name="smtpForm" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="SETTINGS.ACCOUNTNAME">AccountName</label>\n                <input type="text" name="name" ng-model="vm.smtp.name" ng-required="true" autofocus>\n\n                <div ng-messages="smtpForm[\'name\'].$error" ng-show="smtpForm[\'name\'].$touched" role="alert">\n                    <div ng-message="required">\n                        <span translate="SETTINGS.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="SETTINGS.EMAILADDRESS">EmailAddress</label>\n                <input type="email" name="email" ng-model="vm.smtp.email" ng-required="true">\n\n                <div class="hint"><span translate="SETTINGS.HELP.EMAILADDRESS"></span></div>\n                <div ng-messages="smtpForm[\'email\'].$error" ng-show="smtpForm[\'email\'].$touched" role="alert">\n                    <div ng-message="required">\n                        <span translate="SETTINGS.ERRORS.EMAILADDRESS_REQUIRED">EmailAddress field is required</span>\n                    </div>\n                    <div ng-message="email">\n                        <span translate="SETTINGS.ERRORS.EMAILADDRESS_MUST_VALID">EmailAddress 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.SMTP_SERVICE">SMTP_Service</label>\n                <md-select name="Smtp.service" ng-model="vm.smtp.Smtp.service" required>\n                    <md-option ng-value="null">Custom</md-option>\n                    <md-option ng-value="\'gmail\'">Gmail</md-option>\n                    <md-option ng-value="\'hotmail\'">Hotmail</md-option>\n                    <md-option ng-value="\'yahoo\'">Yahoo</md-option>\n                    <md-option ng-value="\'outlook365\'">Outlook365</md-option>\n                </md-select>\n                <div ng-messages="smtpForm[\'Smtp.service\'].$error" ng-show="smtpForm[\'Smtp.service\'].$touched" role="alert">\n                    <div ng-message="required">\n                        <span translate="SETTINGS.ERRORS.SMTP_SERVICE_REQUIRED">SMTP_Service field is required</span>\n                    </div>\n                </div>\n            </md-input-container>\n            <md-input-container ng-if="vm.smtp.Smtp.service == null" class="md-block">\n                <label translate="SETTINGS.SMTP_HOST">SMTP_Host</label>\n                <input type="text" name="Smtp.host" ng-model="vm.smtp.Smtp.host" ng-required="true">\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="SETTINGS.ERRORS.SMTP_HOST_REQUIRED">SMTP_Host field is required</span>\n                    </div>\n                </div>\n            </md-input-container>\n            <md-input-container ng-if="vm.smtp.Smtp.service == null" class="md-block">\n                <label translate="SETTINGS.SMTP_PORT">SMTP_Port</label>\n                <input type="number" name="Smtp.port" ng-model="vm.smtp.Smtp.port" ng-required="true">\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="SETTINGS.ERRORS.SMTP_PORT_REQUIRED">SMTP_Port field is required</span>\n                    </div>\n                </div>\n            </md-input-container>\n            <md-input-container ng-if="vm.smtp.Smtp.service == null" class="md-block">\n                <md-switch ng-model="vm.smtp.Smtp.secure" aria-label="SMTP_Secure"><span translate="SETTINGS.SMTP_SECURE">SMTP_Secure</span></md-switch>\n                <div class="hint"><span translate="SETTINGS.HELP.SMTP_SECURE"></span></div>\n            </md-input-container>\n            <md-input-container ng-if="vm.smtp.Smtp.service == null" class="md-block">\n                <md-switch ng-model="vm.smtp.Smtp.authentication" aria-label="SMTP_Authentication"><span translate="SETTINGS.SMTP_AUTHENTICATION">SMTP_Authentication</span></md-switch>\n            </md-input-container>\n            <md-input-container ng-if="vm.smtp.Smtp.authentication == true || vm.smtp.Smtp.service != null" class="md-block">\n                <label translate="SETTINGS.SMTP_USERNAME">SMTP_Username</label>\n                <input type="text" name="Smtp.user" ng-model="vm.smtp.Smtp.user" ng-required="true">\n\n                <div class="hint"><span translate="SETTINGS.HELP.SMTP_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="SETTINGS.ERRORS.SMTP_USERNAME_REQUIRED">SMTP_Username field is required</span>\n                    </div>\n                </div>\n            </md-input-container>\n            <md-input-container class="md-block" ng-if="vm.smtp.Smtp.authentication == true || vm.smtp.Smtp.service != null">\n                <label translate="SETTINGS.SMTP_PASSWORD">SMTP_Password</label>\n                <input type="password" name="Smtp.pass" ng-model="vm.smtp.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="smtpForm[\'Smtp.pass\'].$error" role="alert">\n                    <div ng-message="required">\n                        <span translate="SETTINGS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                    </div>\n                    <div ng-message="pattern">\n                        <span translate="SETTINGS.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="SETTINGS.DESCRIPTION">Description</label>\n                <input type="" name="description" ng-model="vm.smtp.description">\n\n                <div ng-messages="smtpForm[\'description\'].$error" ng-show="smtpForm[\'description\'].$touched" role="alert">\n                    <div ng-message="required">\n                        <span translate="SETTINGS.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.newSmtp" ng-click="vm.saveSmtp()" class="send-button md-accent md-raised" ng-disabled="smtpForm.$invalid || smtpForm.$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.newSmtp" ng-click="vm.addNewSmtp()" class="send-button md-accent md-raised" ng-disabled="smtpForm.$invalid" aria-label="ADD" translate="SETTINGS.ADD_SMTP" translate-attr-aria-label="SETTINGS.ADD_SMTP">\n                    ADD SMTP\n                </md-button>\n            </div>\n            <div layout="row">\n                <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSmtp" ng-click="vm.deleteSmtp($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/smtps/smtps.html",'<div id="smtps" 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.SMTP">Smtp</span>\n            </div>\n        </div>\n        \x3c!-- / APP TITLE --\x3e\n\n        <div>\n            <md-button type="submit" ng-click="vm.verifySmtp()" ng-disabled="!vm.smtp.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    \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" ms-scroll>\n\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                    <md-input-container class="md-block">\n                        <label translate="SETTINGS.ACCOUNTNAME">AccountName</label>\n                        <input type="text" name="name" ng-model="vm.smtp.name" ng-required="true" autofocus>\n\n                        <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                            <div ng-message="required">\n                                <span translate="SETTINGS.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="SETTINGS.EMAILADDRESS">EmailAddress</label>\n                        <input type="email" name="email" ng-model="vm.smtp.email" ng-required="true">\n\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.EMAILADDRESS_REQUIRED">EmailAddress field is required</span>\n                            </div>\n                            <div ng-message="email">\n                                <span translate="SETTINGS.ERRORS.EMAILADDRESS_MUST_VALID">EmailAddress 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.SMTP_SERVICE">SMTP_Service</label>\n                        <md-select name="Smtp.service" ng-model="vm.smtp.Smtp.service" required>\n                            <md-option ng-value="null">Custom</md-option>\n                            <md-option ng-value="\'gmail\'">Gmail</md-option>\n                            <md-option ng-value="\'hotmail\'">Hotmail</md-option>\n                            <md-option ng-value="\'yahoo\'">Yahoo</md-option>\n                            <md-option ng-value="\'outlook365\'">Outlook365</md-option>\n                        </md-select>\n                        <div ng-messages="generalForm[\'Smtp.service\'].$error" ng-show="generalForm[\'Smtp.service\'].$touched" role="alert">\n                            <div ng-message="required">\n                                <span translate="SETTINGS.ERRORS.SMTP_SERVICE_REQUIRED">SMTP_Service field is required</span>\n                            </div>\n                        </div>\n                    </md-input-container>\n                    <md-input-container ng-if="vm.smtp.Smtp.service == null" class="md-block">\n                        <label translate="SETTINGS.SMTP_HOST">SMTP_Host</label>\n                        <input type="text" name="Smtp.host" ng-model="vm.smtp.Smtp.host" ng-required="true">\n\n                        <div ng-messages="generalForm[\'Smtp.host\'].$error" ng-show="generalForm[\'Smtp.host\'].$touched" role="alert">\n                            <div ng-message="required">\n                                <span translate="SETTINGS.ERRORS.SMTP_HOST_REQUIRED">SMTP_Host field is required</span>\n                            </div>\n                        </div>\n                    </md-input-container>\n                    <md-input-container ng-if="vm.smtp.Smtp.service == null" class="md-block">\n                        <label translate="SETTINGS.SMTP_PORT">SMTP_Port</label>\n                        <input type="number" name="Smtp.port" ng-model="vm.smtp.Smtp.port" ng-required="true">\n\n                        <div ng-messages="generalForm[\'Smtp.port\'].$error" ng-show="generalForm[\'Smtp.port\'].$touched" role="alert">\n                            <div ng-message="required">\n                                <span translate="SETTINGS.ERRORS.SMTP_PORT_REQUIRED">SMTP_Port field is required</span>\n                            </div>\n                        </div>\n                    </md-input-container>\n                    <md-input-container ng-if="vm.smtp.Smtp.service == null" class="md-block">\n                        <md-switch ng-model="vm.smtp.Smtp.secure" aria-label="SMTP_Secure"><span translate="SETTINGS.SMTP_SECURE">SMTP_Secure</span></md-switch>\n                        <div class="hint"><span translate="SETTINGS.HELP.SMTP_SECURE"></span></div>\n                    </md-input-container>\n                    <md-input-container ng-if="vm.smtp.Smtp.service == null" class="md-block">\n                        <md-switch ng-model="vm.smtp.Smtp.authentication" aria-label="SMTP_Authentication"><span translate="SETTINGS.SMTP_AUTHENTICATION">SMTP_Authentication</span></md-switch>\n                    </md-input-container>\n                    <md-input-container ng-if="vm.smtp.Smtp.authentication == true || vm.smtp.Smtp.service != null" class="md-block">\n                        <label translate="SETTINGS.SMTP_USERNAME">SMTP_Username</label>\n                        <input type="text" name="Smtp.user" ng-model="vm.smtp.Smtp.user" ng-required="true">\n\n                        <div class="hint"><span translate="SETTINGS.HELP.SMTP_USERNAME"></span></div>\n                        <div ng-messages="generalForm[\'Smtp.user\'].$error" ng-show="generalForm[\'Smtp.user\'].$touched" role="alert">\n                            <div ng-message="required">\n                                <span translate="SETTINGS.ERRORS.SMTP_USERNAME_REQUIRED">SMTP_Username field is required</span>\n                            </div>\n                        </div>\n                    </md-input-container>\n                    <md-input-container class="md-block" ng-if="vm.smtp.Smtp.authentication == true || vm.smtp.Smtp.service != null">\n                        <label translate="SETTINGS.SMTP_PASSWORD">SMTP_Password</label>\n                        <input type="password" name="Smtp.pass" ng-model="vm.smtp.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[\'Smtp.pass\'].$error" role="alert">\n                            <div ng-message="required">\n                                <span translate="SETTINGS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                            </div>\n                            <div ng-message="pattern">\n                                <span translate="SETTINGS.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="SETTINGS.DESCRIPTION">Description</label>\n                        <input type="" name="description" ng-model="vm.smtp.description">\n\n                        <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                            <div ng-message="required">\n                                <span translate="SETTINGS.ERRORS.DESCRIPTION_REQUIRED">Description 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/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 ms-scroll>\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" ms-scroll>\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/agents/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="SMS.AGENTS">Agents</span>\n        <div flex></div>\n        <ms-search-bar on-search="vm.query.filter = query; vm.onInit()" on-collapse="vm.query.filter = undefined; vm.onInit()" debounce="300"></ms-search-bar>\n        <md-select ng-model="vm.query.globalStatusFilter" class="md-caption" ng-change="vm.query.pauseTypeFilter = \'\'; vm.onInit()">\n            <md-option ng-value="\'\'">{{ \'SMS.ALL\' | translate }}</md-option>\n            <md-option value="pause">{{ \'SMS.PAUSE\' | translate }}</md-option>\n            <md-option value="*pause">{{ \'SMS.PARTIALPAUSE\' | translate }}</md-option>\n            <md-option value="busy">{{ \'SMS.BUSY\' | translate }}</md-option>\n            <md-option value="idle">{{ \'SMS.IDLE\' | translate }}</md-option>\n        </md-select>\n\n        <md-select ng-if="vm.isPause(vm.query.globalStatusFilter)" ng-model="vm.query.pauseTypeFilter" class="md-caption" ng-change="vm.onInit()">\n            <md-option ng-value="\'\'">All</md-option>\n            <md-option value="DEFAULT PAUSE">DEFAULT PAUSE</md-option>\n            <md-option value="ACW">ACW</md-option>\n            <md-option value="LOGININPAUSE">LOGININPAUSE</md-option>\n            <md-option value="Auto-Pause">AUTOPAUSE</md-option>\n            <md-option ng-value="pause.name" ng-repeat="pause in vm.pauses.rows">{{pause.name}}</md-option>\n        </md-select>\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.order" md-on-reorder="vm.onInit">\n            <tr md-row border="1">\n                <th class="bv text-center" colspan="4">{{ \'SMS.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">{{ \'OPENCHANNEL.OPENCHANNEL\' | translate }}</th>\n                <th ng-if="vm.license.fax" class="bv bl text-center" colspan="2">{{ \'FAX.FAX\' | translate }}</th>\n                <th width="10px" class="bt bl" rowspan="2"></th>\n            </tr>\n            <tr md-row>\n                <th class="bl" md-column md-order-by="fullname">{{ \'SMS.NAME\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="globalStatus">{{ \'SMS.STATUS\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="lastLoginAt">{{ \'SMS.LOGIN_TIME\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="lastPauseAt">{{ \'SMS.PAUSE_TIME\' | translate }}</th>\n\n                <th class="bl custom-column">{{ \'VOICE.STATUS\' | translate }}</th>\n                <th class="bl custom-column">Info</th>\n\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\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\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\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\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            </tr>\n        </thead>\n        <tbody md-body>\n            <tr md-row ng-hide="vm.order.length">\n                <td md-cell colspan="17">\n                    <div layout="row" layout-align="center center">\n                        <span>{{ \'SMS.NO_AGENT_ONLINE\' | translate }}</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-select="vm.agents[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td class="bt padding-5">\n                    <div layout="row" layout-align="start center">\n                        <img class="avatar" ng-src="{{vm.agents[value].userpic && \'api/users/\'+vm.agents[value].id+\'/avatar\' || \'assets/images/avatars/profile.png\'}}">\n                        <div layout="column">\n                            <span>{{vm.agents[value].fullname}}</span>\n                            <span>{{vm.agents[value].internal}}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class="bt">\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'}[vm.agents[value].globalStatus]\">{{ vm.isPause(vm.agents[value].globalStatus) ? '' : vm.agents[value].globalStatus | uppercase }} {{ vm.isPause(vm.agents[value].globalStatus) ? (vm.isPartialPause(vm.agents[value].globalStatus) ? '*'+vm.agents[value].pauseType || 'DEFAULT PAUSE'  : vm.agents[value].pauseType || 'DEFAULT PAUSE') : ''}}</span>\n                </td>\n                <td class=\"bt custom-column\">\n                    <timer start-time=\"vm.agents[value].lastLoginAt\" interval=\"1000\">{{ days > 0 ? days + 'd' : '' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                </td>\n                <td class=\"bt custom-column\">\n                    <timer ng-if=\"vm.isPause(vm.agents[value].globalStatus) || vm.isPartialPause(vm.agents[value].globalStatus)\" start-time=\"vm.agents[value].lastPauseAt\" interval=\"1000\">{{ days > 0 ? days + 'd' : '' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                </td>\n                <td class=\"bt bl\">\n                    <div layout=\"row\">\n                        <span ng-if=\"!vm.agents[value].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'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].voiceStatus | uppercase }}</span>\n                        <span ng-if=\"vm.agents[value].onhold\" class=\"text-boxed md-background-bg bl bt padding-5 orange-400-bg\">ONHOLD</span>\n                    </div>\n                </td>\n                <td class=\"bt bl\">\n                    <div layout=\"column\">\n                        <span ng-if=\"vm.agents[value].queue\" class=\"padding-5\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].queue }}</span>\n                        <span ng-if=\"vm.agents[value].destconnectedlinenum\" class=\"padding-5\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].destconnectedlinenum }}</span>\n                        <span class=\"padding-5\" ng-if=\"vm.agents[value].queue || vm.agents[value].destconnectedlinenum\">\n                            <timer start-time=\"vm.agents[value].voiceStatusTime\" interval=\"1000\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                        </span>\n                    </div>\n                </td>\n                <td class=\"bt bl\" ng-if=\"vm.license.chat\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].chatStatus]\">{{ vm.agents[value].chatStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td md-number class=\"bt text-center font-size-20\" ng-if=\"vm.license.chat\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].chatStatus]\">{{ vm.agents[value].chatCurrentCapacity }}</td>\n                <td class=\"bl bt\" ng-if=\"vm.license.mail\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].mailStatus]\">{{ vm.agents[value].mailStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.mail\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].mailStatus]\">{{ vm.agents[value].mailCurrentCapacity }}</td>\n                <td class=\"bl bt\" ng-if=\"vm.license.messaging\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].smsStatus]\">{{ vm.agents[value].smsStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.messaging\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].smsStatus]\">{{ vm.agents[value].smsCurrentCapacity }}</td>\n                <td class=\"bt bl\" ng-if=\"vm.license.openchannel\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].openchannelStatus]\">{{ vm.agents[value].openchannelStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.openchannel\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].openchannelStatus]\">{{ vm.agents[value].openchannelCurrentCapacity }}</td>\n                <td class=\"bt bl\" ng-if=\"vm.license.fax\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].faxStatus]\">{{ vm.agents[value].faxStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.fax\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].faxStatus]\">{{ vm.agents[value].faxCurrentCapacity }}</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\n                        <md-menu-content width=\"4\">\n                            <md-menu-item>\n                                <md-button ng-click=\"vm.logout(vm.agents[value], $event)\" translate=\"SMS.LOGOUT\">\n                                    Logout\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-button ng-click=\"vm.queueAdd(vm.agents[value], $event)\" translate=\"SMS.AGENTADD_QUEUE\">\n                                    Add Agent In Queue\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-menu>\n                                    <md-button ng-click=\"$mdMenu.open()\" class=\"text-capitalize\" translate=\"SMS.PAUSE\">Pause</md-button>\n                                    <md-menu-content>\n                                        <md-menu-item>\n                                            <md-button ng-disabled=\" vm.agents[value].voicePause && 'DEFAULT PAUSE' === vm.agents[value].pauseType\" ng-click=\"vm.pause(vm.agents[value])\"><em translate=\"SMS.DEFAULT_PAUSE\">Default Pause</em></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=\"vm.agents[value].voicePause && pause.name === vm.agents[value].pauseType\" ng-click=\"vm.pause(vm.agents[value], pause.name)\">{{pause.name}}</md-button>\n                                        </md-menu-item>\n                                    </md-menu-content>\n                                </md-menu>\n                            </md-menu-item>\n                            <md-menu-item ng-if=\"vm.isPause(vm.agents[value].globalStatus)\">\n                                <md-button ng-click=\"vm.unPause(vm.agents[value])\" translate=\"SMS.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\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.filteredAgents.length}}\" md-on-paginate=\"vm.onInit\" md-page-select></md-table-pagination>\n\x3c!-- / AGENT TABLE --\x3e\n\x3c!-- / MAIN --\x3e"),e.put("app/main/apps/sms/views/realtime/queues/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="SMS.QUEUES">Queues</span>\n        <div flex></div>\n        <ms-search-bar on-search="vm.query.filter = 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">{{ \'SMS.NAME\' | translate }}</th>\n                <th md-column>{{ \'SMS.LOGGED_IN\' | translate }}</th>\n                <th md-column>{{ \'SMS.PAUSED\' | translate }}</th>\n                <th md-column>{{ \'SMS.READY\' | translate }}</th>\n                <th md-column>{{ \'SMS.WAITING\' | translate }}</th>\n                <th md-column width="10px"></th>\n            </tr>\n        </thead>\n        <tbody md-body>\n            <tr md-row ng-hide="vm.queues">\n                <td md-cell colspan="7">\n                    <div layout="row" layout-align="center center">\n                        <span tranlsate="SMS.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-row md-select="vm.queues[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td md-cell>{{vm.queues[value].name}}</td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].loggedInDb || 0}} ({{vm.queues[value].loggedIn || 0}})</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].paused || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-16 grey-fg">{{vm.queues[value].available || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].waiting || 0}}</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="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.createOrEditSmsQueue($event, vm.queues[value])" translate="SMS.EDIT_QUEUE">\n                                    Edit Queue\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-button ng-click="vm.agentAdd($event, vm.queues[value])" translate="SMS.AGENTSADD_QUEUE">\n                                    Add Agents to queue\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: \'{{\'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.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/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 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="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" 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="\'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\'" 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\'">\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\'" 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 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"></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 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="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" 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/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 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="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="1">One Time</md-option>\n                    <md-option ng-value="0">Always</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" md-maxlength="255" 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 ng-message="md-maxlength">\n                        <span translate="SMS.ERRORS.TEXT_MAX_LENGTH" translate-values=\'{max: 255}\'>Text 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/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 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="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/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 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="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 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="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="inboundroute-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 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\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 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="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 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="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" 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 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="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 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="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 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="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/smsDispositions/dialog.html",'<md-dialog class="smsDisposition-dialog" aria-label="New SmsDisposition">\n    <form name="smsDispositionForm" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="SMS.NAME">Name</label>\n                <input type="" name="name" ng-model="vm.smsDisposition.name" ng-required="true" autofocus>\n\n                <div ng-messages="smsDispositionForm[\'name\'].$error" ng-show="smsDispositionForm[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.newSmsDisposition" ng-click="vm.saveSmsDisposition()" class="send-button md-accent md-raised" ng-disabled="smsDispositionForm.$invalid || smsDispositionForm.$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.newSmsDisposition" ng-click="vm.addNewSmsDisposition()" class="send-button md-accent md-raised" ng-disabled="smsDispositionForm.$invalid" aria-label="ADD" translate="SMS.ADD_SMSDISPOSITION" translate-attr-aria-label="SMS.ADD_SMSDISPOSITION">\n                    ADD SMSDISPOSITION\n                </md-button>\n            </div>\n            <div layout="row">\n                <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSmsDisposition" ng-click="vm.deleteSmsDisposition($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="\'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\'" 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\'">\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\'" 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 == \'skebby\' && vm.smsAccount.smsMethod == \'GP\') || 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" 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="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" 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, 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" 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" 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" 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 class="smsAccount-detail-form-container smsdispositions md-background-bg md-whiteframe-1dp">\n                        <div ng-controller="SmsAccountSmsDispositionsController as vm_dc" ng-init="vm_dc.init(vm.smsAccount, vm.crudPermissions)">\n                            <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedSmsAccountSmsDispositions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead" translate="SMS.SMSDISPOSITIONS">SmsDispositions</span>\n                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\n                                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditSmsAccountSmsDisposition($event)" aria-label="add smsDisposition" translate translate-attr-label="SMS.ADD_SMSDISPOSITION">\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.selectedSmsAccountSmsDispositions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead">{{vm_dc.selectedSmsAccountSmsDispositions.length}} {{vm_dc.selectedSmsAccountSmsDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                                    <div flex></div>\n                                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedSmsAccountSmsDispositions" 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.deleteSelectedSmsAccountSmsDispositions($event)" aria-label="delete selected" translate translate-attr-label="SMSACCOUNTS.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.selectedSmsAccountSmsDispositions" md-progress="vm_dc.promise">\n                                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getSmsAccountSmsDispositions">\n                                        <tr md-row>\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="createdAt">{{ \'SMS.CREATED_AT\' | translate }}</th>\n                                            <th md-column width="10px"></th>\n                                        </tr>\n                                    </thead>\n                                    <tbody md-body>\n                                        <tr md-row md-select="smsDisposition" md-select-id="id" ng-repeat="smsDisposition in vm_dc.smsAccountSmsDispositions.rows">\n                                            <td ng-click="vm_dc.createOrEditSmsAccountSmsDisposition($event, smsDisposition)" md-cell>{{smsDisposition.id}}</td>\n                                            <td ng-click="vm_dc.createOrEditSmsAccountSmsDisposition($event, smsDisposition)" md-cell>{{smsDisposition.name}}</td>\n                                            <td ng-click="vm_dc.createOrEditSmsAccountSmsDisposition($event, smsDisposition)" md-cell>{{smsDisposition.createdAt | date:\'medium\'}}</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.createOrEditSmsAccountSmsDisposition($event, smsDisposition)" translate="SMS.EDIT_SMSDISPOSITION">\n                                                                Edit SmsDisposition\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(smsDisposition, $event)" translate="SMS.DELETE_SMSDISPOSITION">\n                                                                Delete SmsDisposition\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.smsAccountSmsDispositions.rows.length">\n                                            <td md-cell colspan="5">\n                                                <span class="text-boxed-ligth" translate="SMS.NO_SMSDISPOSITION_AVAILABLE">No smsdisposition available</span>\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.smsAccountSmsDispositions.count}}" md-on-paginate="vm_dc.getSmsAccountSmsDispositions" 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.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)">\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                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="SMSACCOUNTS.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.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">{{ \'SMS.ID\' | translate }}</th>\n                                            <th md-column md-order-by="key">{{ \'SMS.KEY\' | translate }}</th>\n                                            <th md-column md-order-by="value">{{ \'SMS.VALUE\' | translate }}</th>\n                                            <th md-column md-order-by="description">{{ \'SMS.DESCRIPTION\' | translate }}</th>\n                                            <th md-column md-order-by="createdAt">{{ \'SMS.CREATED_AT\' | translate }}</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>{{smsCannedAnswer.id}}</td>\n                                            <td ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" md-cell>{{smsCannedAnswer.key}}</td>\n                                            <td ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" md-cell>{{smsCannedAnswer.value}}</td>\n                                            <td ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" md-cell>{{smsCannedAnswer.description}}</td>\n                                            <td ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" md-cell>{{smsCannedAnswer.createdAt | date:\'medium\'}}</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                                                <span class="text-boxed-ligth" translate="SMS.NO_SMSCANNEDANSWER_AVAILABLE">No smscannedanswer available</span>\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" ms-scroll 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.alias || a.appType) | uppercase}}">{{a.alias || 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" ms-scroll 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" style="width:200px">{{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-ligth" 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)">\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                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="SMSACCOUNTS.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.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">{{ \'SMS.ID\' | translate }}</th>\n                                            <th md-column md-order-by="createdAt">{{ \'SMS.STARTEDAT\' | translate }}</th>\n                                            <th md-column>{{ \'SMS.CONTACT\' | translate }}</th>\n                                            <th md-column>{{ \'SMS.AGENT\' | translate }}</th>\n                                            <th md-column md-order-by="closedAt">{{ \'SMS.CLOSEDAT\' | translate }}</th>\n                                            <th md-column md-order-by="disposition">{{ \'SMS.DISPOSITION\' | translate }}</th>\n                                            <th md-column md-order-by="note">{{ \'SMS.NOTES\' | translate }}</th>\n                                            <th md-column md-order-by="tag">{{ \'SMS.TAGS\' | translate }}</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">\n                                            <td md-cell>{{interaction.id}}</td>\n                                            <td md-cell>{{interaction.createdAt | date:\'medium\'}}</td>\n                                            <td md-cell>{{interaction.Contact.firstName}}</td>\n                                            <td md-cell>{{interaction.Owner.name}}</td>\n                                            <td md-cell>{{interaction.closedAt | date:\'medium\'}}</td>\n                                            <td md-cell>{{interaction.disposition}}</td>\n                                            <td md-cell>{{interaction.note}}</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"></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>\n                                                            <md-button class="md-primary" ng-click="vm_dc.smsInteractionDownload(interaction, $event)" translate="SMS.DOWNLOAD_INTERACTION">\n                                                                Download Interaction\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="13">\n                                                <span class="text-boxed-ligth" translate="SMS.NO_INTERACTION_AVAILABLE">No interaction available</span>\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 animate-slide-down 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="SMSACCOUNTS.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="SMSACCOUNTS.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!-- 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})[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                                <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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(smsAccount, $event)" translate="SMS.EDIT_SMSACCOUNT">\n                                                    Edit SmsAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.interactionsgoto(smsAccount, $event)" translate="SMS.INTERACTIONS_SMSACCOUNT">\n                                                    Interactions SmsAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.agentadddialog(smsAccount, $event)" translate="SMS.AGENTADD_SMSACCOUNT">\n                                                    AgentAdd SmsAccount\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(smsAccount, $event)" translate="SMS.DELETE_SMSACCOUNT">\n                                                    Delete SmsAccount\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: \'{{\'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 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="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" 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"></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"></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" 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 animate-slide-down 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="SMSQUEUES.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="SMSQUEUES.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!-- 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                                <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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(smsQueue, $event)" translate="SMS.EDIT_SMSQUEUE">\n                                                    Edit SmsQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.teamadddialog(smsQueue, $event)" translate="SMS.TEAMADD_SMSQUEUE">\n                                                    teamadd SmsQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.agentadddialog(smsQueue, $event)" translate="SMS.AGENTADD_SMSQUEUE">\n                                                    agentadd SmsQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(smsQueue, $event)" translate="SMS.DELETE_SMSQUEUE">\n                                                    Delete SmsQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.gotorealtimegoto(smsQueue, $event)" translate="SMS.GOTOREALTIME_SMSQUEUE">\n                                                    goToRealtime SmsQueue\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: \'{{\'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\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.AGENTS">Agents</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.selectedAgents.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.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\n        <div flex layout="row" layout-align="space-between center">\n\n            <div>\n                <span class="selected-agents-count">\n                    <span>{{vm.selectedAgents.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="AGENTS.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\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="AGENTS.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!-- 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 ng-if="vm.table == \'users\' || vm.table == \'agents\'" 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 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="8">\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 && (vm.table == \'users\' || vm.table == \'agents\')"><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 ">{{ vm.arrayshowWebBar[agent.showWebBar].option }}</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 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                                            <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                                            <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                                            <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\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\n            \x3c!-- / NO RESULTS --\x3e\n        </div>\n        \x3c!-- / MAIN --\x3e\n\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 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="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\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\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 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" 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 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" 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.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>\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                    <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\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" ng-model="vm.penalty" placeholder="0" required md-minlength="0" md-maxlength="3">\n                <div ng-messages="agentForm.penalty.$error" role="alert" multiple>\n                    <div ng-message="required">\n                        <span>You must supply a penalty.</span>\n                    </div>\n                    <div ng-message="md-minlength">\n                        <span>Min Penalty 0 characters.</span>\n                    </div>\n                    <div ng-message="md-maxlength">\n                        <span>Max Penalty 3 characters.</span>\n                    </div>\n                </div>\n            </md-input-container>\n            <ms-dual-multiselect options="vm.dualMultiselectOptions"></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"></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\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\n            <div layout="row" layout-align="start center">\n\n                <div class="agent-image" hide-xs>\n                    <img ng-src="assets/images/business/agents.jpg">\n                </div>\n\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-fab-actions>\n            </md-fab-speed-dial>\n        </div>\n\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\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) || (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.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\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\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\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\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\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\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\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\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\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\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\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\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\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="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\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\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\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\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\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\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\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\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\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\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.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\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.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\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\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\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" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\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" class="md-block">\n                                <md-switch ng-model="vm.agent.phoneBarEnableVideoRecording" aria-label="EnableVideoRecording" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLEVIDEORECORDING">EnableVideoRecording</span></md-switch>\n                            </md-input-container>\n\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" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\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\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\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\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\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\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\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\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\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                                <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" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\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\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\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\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.phoneBarPrefixRequired" aria-label="PrefixRequired" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.PREFIXREQUIRED">PrefixRequired</span></md-switch>\n                            </md-input-container>\n\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\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\n      <md-divider></md-divider>\n\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\n                            <span ng-if="vm_pc.agent.role === \'admin\'" class="md-headline" translate="STAFF.ALL_MODULES_AVAILABLE">All modules are already available.</span>\n\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/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 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="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"></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 animate-slide-down 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="TEAMS.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="TEAMS.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!-- 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                                <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                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editdialog(team, $event)" translate="STAFF.EDIT_TEAM">\n                                                    Edit Team\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.agentadddialog(team, $event)" translate="STAFF.AGENTADD_TEAM">\n                                                    AgentAdd Team\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(team, $event)" translate="STAFF.DELETE_TEAM">\n                                                    Delete Team\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: \'{{\'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 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="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 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" 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.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>\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                    <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\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 animate-slide-down 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="TELEPHONES.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="TELEPHONES.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!-- 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                                <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="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                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(telephone, $event)" translate="STAFF.EDIT_TELEPHONE">\n                                                    Edit Telephone\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(telephone, $event)" translate="STAFF.DELETE_TELEPHONE">\n                                                    Delete Telephone\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: \'{{\'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 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="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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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 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="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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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)" 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\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="2:1" md-row-height-gt-md="3:1" gt-xs-gutter="4px" gt-sm-gutter="8px" gt-md-gutter="8px" 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-icon>\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-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 animate-slide-down 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="USERPROFILES.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="USERPROFILES.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!-- 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 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="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="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 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                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(userProfile, $event)" translate="STAFF.EDIT_USERPROFILE">\n                                                    Edit UserProfile\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.clonedialog(userProfile, $event)" translate="STAFF.CLONE_USERPROFILE">\n                                                    clone UserProfile\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.deleteconfirm(userProfile, $event)" translate="STAFF.DELETE_USERPROFILE">\n                                                    Delete UserProfile\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: \'{{\'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 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="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\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\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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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-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="STAFF.GENERATE" 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 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" 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.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>\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                    <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\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\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\n            <div layout="row" layout-align="start center">\n\n                <div class="user-image" hide-xs>\n                    <img ng-src="assets/images/business/users.jpg">\n                </div>\n\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\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\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\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="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\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\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\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\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\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\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\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\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\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: 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-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\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\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\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="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\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\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\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\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\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.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: 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-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 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\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/users/users.html",'<div id="users" 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.USERS">Users</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.selectedUsers.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.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\n        <div flex layout="row" layout-align="space-between center">\n\n            <div>\n                <span class="selected-users-count">\n                    <span>{{vm.selectedUsers.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="USERS.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\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\n        \x3c!-- MAIN --\x3e\n        <div class="main scrollable" ms-scroll>\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 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="9">\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 && (vm.table == \'users\' || vm.table == \'agents\')"><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})[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 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                                            <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                                            <md-menu-item>\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\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\n            \x3c!-- / NO RESULTS --\x3e\n        </div>\n        \x3c!-- / MAIN --\x3e\n\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 animate-slide-down 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="CANNEDANSWERS.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="CANNEDANSWERS.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!-- 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                                <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                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editdialog(cannedAnswer, $event)" translate="TOOLS.EDIT_CANNEDANSWER">\n                                                    Edit CannedAnswer\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(cannedAnswer, $event)" translate="TOOLS.DELETE_CANNEDANSWER">\n                                                    Delete CannedAnswer\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: \'{{\'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 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.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/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 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.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 animate-slide-down 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="CUSTOMDASHBOARDS.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="CUSTOMDASHBOARDS.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!-- 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                                <td md-cell class="actions">\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.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(customDashboard, $event)" translate="TOOLS.EDIT_CUSTOMDASHBOARD">\n                                                    Edit CustomDashboard\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.clonedialog(customDashboard, $event)" translate="TOOLS.CLONE_CUSTOMDASHBOARD">\n                                                    clone CustomDashboard\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.gotodashboardgoto(customDashboard, $event)" translate="TOOLS.GOTODASHBOARD_CUSTOMDASHBOARD">\n                                                    goToDashboard CustomDashboard\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(customDashboard, $event)" translate="TOOLS.DELETE_CUSTOMDASHBOARD">\n                                                    Delete CustomDashboard\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: \'{{\'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 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.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 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.TYPE">Type</label>\n                <md-select name="type" ng-model="vm.dashboarditem.type" 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 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 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" 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" 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\'"> {{ \'TOOLS.ABANDONED\' | translate }} </md-option>\n\n                    <md-option ng-value="\'waiting\'"> {{ \'TOOLS.WAITING\' | translate }} </md-option>\n\n                    <md-option ng-value="\'talking\'"> {{ \'TOOLS.TALKING\' | translate }} </md-option>\n\n                    <md-option ng-value="\'answered\'"> {{ \'TOOLS.ANSWERED\' | translate }} </md-option>\n\n                    <md-option ng-value="\'unmanaged\'"> {{ \'TOOLS.UNMANAGED\' | 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\'"> {{ \'TOOLS.ABANDONED\' | translate }} </md-option>\n\n                    <md-option ng-value="\'waiting\'"> {{ \'TOOLS.WAITING\' | translate }} </md-option>\n\n                    <md-option ng-value="\'talking\'"> {{ \'TOOLS.TALKING\' | translate }} </md-option>\n\n                    <md-option ng-value="\'answered\'"> {{ \'TOOLS.ANSWERED\' | 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\'"> {{ \'TOOLS.ABANDONED\' | translate }} </md-option>\n\n                    <md-option ng-value="\'waiting\'"> {{ \'TOOLS.WAITING\' | translate }} </md-option>\n\n                    <md-option ng-value="\'talking\'"> {{ \'TOOLS.TALKING\' | translate }} </md-option>\n\n                    <md-option ng-value="\'answered\'"> {{ \'TOOLS.ANSWERED\' | 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\'"> {{ \'TOOLS.ABANDONED\' | translate }} </md-option>\n\n                    <md-option ng-value="\'waiting\'"> {{ \'TOOLS.WAITING\' | translate }} </md-option>\n\n                    <md-option ng-value="\'talking\'"> {{ \'TOOLS.TALKING\' | translate }} </md-option>\n\n                    <md-option ng-value="\'answered\'"> {{ \'TOOLS.ANSWERED\' | 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" 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="[\'multibar-chart\', \'pie-chart\', \'counter\'].includes(vm.dashboarditem.type)" 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 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" 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" ms-scroll>\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" ms-scroll>\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 tranlsate="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 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.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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.disposition.name" md-maxlength="255" ng-required="true" autofocus>\n\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 equal to 255</span>\n                    </div>\n                </div>\n            </md-input-container>\n\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.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\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\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.DISPOSITIONS">Dispositions</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.selectedDispositions.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.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\n        <div flex layout="row" layout-align="space-between center">\n\n            <div>\n                <span class="selected-dispositions-count">\n                    <span>{{vm.selectedDispositions.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="DISPOSITIONS.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\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="DISPOSITIONS.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!-- DISPOSITION TABLE --\x3e\n            <md-card>\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 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 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="3">\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 md-cell ng-if="disposition.userpic"><img class="avatar" alt="{{disposition.name}}" ng-src="api/users/{{disposition.id}}/avatar" /></td>\n                                <td md-cell ng-if="!disposition.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{disposition.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                                <td ng-click="vm.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}</td>\n                                <td ng-click="vm.createOrEditDisposition($event, disposition)" md-cell class="name ">{{disposition.name}}</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                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editdialog(disposition, $event)" translate="TOOLS.EDIT_DISPOSITION">\n                                                    Edit Disposition\n                                                </md-button>\n                                            </md-menu-item>\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\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></md-table-pagination>\n            </md-card>\n            \x3c!-- / DISPOSITION 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 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 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.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="inboundroute-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 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            <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 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="" 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                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="INTERVALS.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.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">{{ \'TOOLS.ID\' | translate }}</th>\n                                            <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                                            <th md-column md-order-by="interval">{{ \'TOOLS.INTERVAL\' | translate }}</th>\n                                            <th md-column md-order-by="createdAt">{{ \'TOOLS.CREATED_AT\' | translate }}</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>{{interval.id}}</td>\n                                            <td ng-click="vm_dc.createOrEditIntervalInterval($event, interval)" md-cell>{{interval.name}}</td>\n                                            <td ng-click="vm_dc.createOrEditIntervalInterval($event, interval)" md-cell>{{interval.interval}}</td>\n                                            <td ng-click="vm_dc.createOrEditIntervalInterval($event, interval)" md-cell>{{interval.createdAt | date:\'medium\'}}</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                                                <span class="text-boxed-ligth" translate="TOOLS.NO_INTERVALS_AVAILABLE">No intervals available</span>\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 animate-slide-down 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="INTERVALS.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="INTERVALS.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!-- 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                                <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                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(interval, $event)" translate="TOOLS.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.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                        </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 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.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 animate-slide-down 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="PAUSES.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="PAUSES.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!-- 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                                <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                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editdialog(pause, $event)" translate="TOOLS.EDIT_PAUSE">\n                                                    Edit Pause\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(pause, $event)" translate="TOOLS.DELETE_PAUSE">\n                                                    Delete Pause\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: \'{{\'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 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.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" 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" ms-scroll>\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" ms-scroll>\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 tranlsate="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 animate-slide-down 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="SCHEDULER.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="SCHEDULER.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!-- 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                                <td md-cell class="actions">\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.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editdialog(schedule, $event)" translate="TOOLS.EDIT_SCHEDULE">\n                                                    Edit Schedule\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.runconfirm(schedule, $event)" translate="TOOLS.RUN_SCHEDULE">\n                                                    Run Schedule\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(schedule, $event)" translate="TOOLS.DELETE_SCHEDULE">\n                                                    Delete Schedule\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: \'{{\'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 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.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 animate-slide-down 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="SOUNDS.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="SOUNDS.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!-- 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                                <td md-cell class="actions">\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.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editdialog(sound, $event)" translate="TOOLS.EDIT_SOUND">\n                                                    Edit Sound\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.downloadfile2(sound, $event)" translate="TOOLS.DOWNLOAD_SOUND">\n                                                    Download Sound\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(sound, $event)" translate="TOOLS.DELETE_SOUND">\n                                                    Delete Sound\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: \'{{\'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 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 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 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.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 animate-slide-down 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="TAGS.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="TAGS.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!-- 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                                <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                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editdialog(tag, $event)" translate="TOOLS.EDIT_TAG">\n                                                    Edit Tag\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(tag, $event)" translate="TOOLS.DELETE_TAG">\n                                                    Delete Tag\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: \'{{\'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 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.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, 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 animate-slide-down 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="TEMPLATES.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="TEMPLATES.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!-- 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                                <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                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editdialog(template, $event)" translate="TOOLS.EDIT_TEMPLATE">\n                                                    Edit Template\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(template, $event)" translate="TOOLS.DELETE_TEMPLATE">\n                                                    Delete Template\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: \'{{\'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.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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.trigger.name" ng-required="true" autofocus>\n\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\n                    <md-option ng-value="\'voice\'"> {{ \'TOOLS.VOICE\' | translate }} </md-option>\n\n                    <md-option ng-value="\'openchannel\'" ng-if="vm.license.openchannel"> {{ \'TOOLS.OPENCHANNEL\' | translate }} </md-option>\n\n                    <md-option ng-value="\'chat\'" ng-if="vm.license.chat"> {{ \'TOOLS.CHAT\' | translate }} </md-option>\n\n                    <md-option ng-value="\'mail\'" ng-if="vm.license.mail"> {{ \'TOOLS.MAIL\' | translate }} </md-option>\n\n                    <md-option ng-value="\'sms\'" ng-if="vm.license.messaging"> {{ \'TOOLS.SMS\' | translate }} </md-option>\n\n                    <md-option ng-value="\'fax\'" ng-if="vm.license.fax"> {{ \'TOOLS.FAX\' | 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></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\n                <div ng-messages="triggerForm[\'description\'].$error" ng-show="triggerForm[\'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.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\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/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.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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.ACTION">Action</label>\n                <md-select name="action" ng-model="vm.action.action" ng-init="vm.onActionInit()" autofocus required ng-disabled="!vm.newAction">\n\n                    <md-option ng-value="\'contactManager\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.CONTACT_MANAGER\' | translate }} </md-option>\n\n                    <md-option ng-value="\'integration\'" ng-if="vm.trigger.channel == \'voice\' && ((vm.newAction && vm.hasModulePermissions.Integrations) || !vm.newAction)"> {{ \'TOOLS.INTEGRATIONS\' | translate }} </md-option>\n\n                    <md-option ng-value="\'motionbar\'"> {{ \'TOOLS.MOTION_BAR\' | translate }} </md-option>\n\n                    <md-option ng-value="\'jscripty\'"> {{ \'TOOLS.JSCRIPTY\' | translate }} </md-option>\n\n                    <md-option ng-value="\'urlForward\'"> {{ \'TOOLS.URL_FORWARD\' | translate }} </md-option>\n\n                    <md-option ng-value="\'browser\'"> {{ \'TOOLS.BROWSER\' | translate }} </md-option>\n\n                    <md-option ng-value="\'bot\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.BOT\' | 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">{{ 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" 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" required>\n                    <md-option ng-value="\'\'+data1.id" ng-repeat="data1 in vm.lists" ng-disabled="data1.canSelect === false">{{ 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.AUTOCREATECONTACT">AutoCreateContact</label>\n                <md-select name="data2" ng-model="vm.action.data2" required>\n\n                    <md-option ng-value="\'1\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n\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 == \'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-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\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\' && vm.action.data1 == \'POST\'" 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 == \'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()" required>\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="\'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="\'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="\'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="\'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="\'zoho\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1307]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1307])">Zoho</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="\'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="\'servicenow\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1310]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1310])">ServiceNow</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 == \'zendesk\'" class="md-block">\n                <label translate="TOOLS.ACCOUNT">Account</label>\n                <md-select name="data2" ng-model="vm.action.data2" required ng-disabled="!vm.newAction && (!vm.newAction && !vm.hasSectionPermissions[1301])">\n                    <md-option ng-value="\'\'+data2.id" ng-repeat="data2 in vm.zendeskAccounts" ng-disabled="data2.canSelect === false">{{ 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 == \'desk\'" class="md-block">\n                <label translate="TOOLS.ACCOUNT">Account</label>\n                <md-select name="data2" ng-model="vm.action.data2" required ng-disabled="!vm.newAction && (!vm.newAction && !vm.hasSectionPermissions[1306])">\n                    <md-option ng-value="\'\'+data2.id" ng-repeat="data2 in vm.deskAccounts" ng-disabled="data2.canSelect === false">{{ 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 == \'zoho\'" class="md-block">\n                <label translate="TOOLS.ACCOUNT">Account</label>\n                <md-select name="data2" ng-model="vm.action.data2" required ng-disabled="!vm.newAction && (!vm.newAction && !vm.hasSectionPermissions[1307])">\n                    <md-option ng-value="\'\'+data2.id" ng-repeat="data2 in vm.zohoAccounts" ng-disabled="data2.canSelect === false">{{ 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 == \'salesforce\'" class="md-block">\n                <label translate="TOOLS.ACCOUNT">Account</label>\n                <md-select name="data2" ng-model="vm.action.data2" required ng-disabled="!vm.newAction && (!vm.newAction && !vm.hasSectionPermissions[1302])">\n                    <md-option ng-value="\'\'+data2.id" ng-repeat="data2 in vm.salesforceAccounts" ng-disabled="data2.canSelect === false">{{ 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 == \'sugarcrm\'" class="md-block">\n                <label translate="TOOLS.ACCOUNT">Account</label>\n                <md-select name="data2" ng-model="vm.action.data2" required ng-disabled="!vm.newAction && (!vm.newAction && !vm.hasSectionPermissions[1305])">\n                    <md-option ng-value="\'\'+data2.id" ng-repeat="data2 in vm.sugarcrmAccounts" ng-disabled="data2.canSelect === false">{{ 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 == \'freshdesk\'" class="md-block">\n                <label translate="TOOLS.ACCOUNT">Account</label>\n                <md-select name="data2" ng-model="vm.action.data2" required ng-disabled="!vm.newAction && (!vm.newAction && !vm.hasSectionPermissions[1303])">\n                    <md-option ng-value="\'\'+data2.id" ng-repeat="data2 in vm.freshdeskAccounts" ng-disabled="data2.canSelect === false">{{ 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 == \'vtiger\'" class="md-block">\n                <label translate="TOOLS.ACCOUNT">Account</label>\n                <md-select name="data2" ng-model="vm.action.data2" required ng-disabled="!vm.newAction && (!vm.newAction && !vm.hasSectionPermissions[1308])">\n                    <md-option ng-value="\'\'+data2.id" ng-repeat="data2 in vm.vtigerAccounts" ng-disabled="data2.canSelect === false">{{ 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 == \'dynamics365\'" class="md-block">\n                <label translate="TOOLS.ACCOUNT">Account</label>\n                <md-select name="data2" ng-model="vm.action.data2" required ng-disabled="!vm.newAction && (!vm.newAction && !vm.hasSectionPermissions[1309])">\n                    <md-option ng-value="\'\'+data2.id" ng-repeat="data2 in vm.dynamics365Accounts" ng-disabled="data2.canSelect === false">{{ 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 == \'servicenow\'" class="md-block">\n                <label translate="TOOLS.ACCOUNT">Account</label>\n                <md-select name="data2" ng-model="vm.action.data2" required ng-disabled="!vm.newAction && (!vm.newAction && !vm.hasSectionPermissions[1310])">\n                    <md-option ng-value="\'\'+data2.id" ng-repeat="data2 in vm.servicenowAccounts" ng-disabled="data2.canSelect === false">{{ 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 == \'zendesk\' && 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.newAction && (!vm.newAction && !vm.hasSectionPermissions[1301])">\n                    <md-option ng-value="\'\'+data3.id" ng-repeat="data3 in vm.zendeskConfigurations | filter:{AccountId:vm.action.data2}" ng-disabled="data3.canSelect === false">{{ 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 == \'integration\' && vm.action.data1 == \'desk\' && 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.newAction && (!vm.newAction && !vm.hasSectionPermissions[1306])">\n                    <md-option ng-value="\'\'+data3.id" ng-repeat="data3 in vm.deskConfigurations | filter:{AccountId:vm.action.data2}" ng-disabled="data3.canSelect === false">{{ 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 == \'integration\' && vm.action.data1 == \'zoho\' && 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.newAction && (!vm.newAction && !vm.hasSectionPermissions[1307])">\n                    <md-option ng-value="\'\'+data3.id" ng-repeat="data3 in vm.zohoConfigurations | filter:{AccountId:vm.action.data2}" ng-disabled="data3.canSelect === false">{{ 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 == \'integration\' && vm.action.data1 == \'salesforce\' && 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.newAction && (!vm.newAction && !vm.hasSectionPermissions[1302])">\n                    <md-option ng-value="\'\'+data3.id" ng-repeat="data3 in vm.salesforceConfigurations | filter:{AccountId:vm.action.data2}" ng-disabled="data3.canSelect === false">{{ 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 == \'integration\' && vm.action.data1 == \'sugarcrm\' && 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.newAction && (!vm.newAction && !vm.hasSectionPermissions[1305])">\n                    <md-option ng-value="\'\'+data3.id" ng-repeat="data3 in vm.sugarcrmConfigurations | filter:{AccountId:vm.action.data2}" ng-disabled="data3.canSelect === false">{{ 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 == \'integration\' && vm.action.data1 == \'freshdesk\' && 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.newAction && (!vm.newAction && !vm.hasSectionPermissions[1303])">\n                    <md-option ng-value="\'\'+data3.id" ng-repeat="data3 in vm.freshdeskConfigurations | filter:{AccountId:vm.action.data2}" ng-disabled="data3.canSelect === false">{{ 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 == \'integration\' && vm.action.data1 == \'vtiger\' && 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.newAction && (!vm.newAction && !vm.hasSectionPermissions[1308])">\n                    <md-option ng-value="\'\'+data3.id" ng-repeat="data3 in vm.vtigerConfigurations | filter:{AccountId:vm.action.data2}" ng-disabled="data3.canSelect === false">{{ 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 == \'integration\' && vm.action.data1 == \'dynamics365\' && 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.newAction && (!vm.newAction && !vm.hasSectionPermissions[1309])">\n                    <md-option ng-value="\'\'+data3.id" ng-repeat="data3 in vm.dynamics365Configurations | filter:{AccountId:vm.action.data2}" ng-disabled="data3.canSelect === false">{{ 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 == \'integration\' && vm.action.data1 == \'servicenow\' && 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.newAction && (!vm.newAction && !vm.hasSectionPermissions[1310])">\n                    <md-option ng-value="\'\'+data3.id" ng-repeat="data3 in vm.servicenowConfigurations | filter:{AccountId:vm.action.data2}" ng-disabled="data3.canSelect === false">{{ 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" 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\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\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\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">{{ 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">{{ 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\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\n                    <md-option ng-value="\'1\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n\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>\n\n                    <md-option ng-value="\'0\'"> {{ \'TOOLS.NEW_TAB\' | translate }} </md-option>\n\n                    <md-option ng-value="\'1\'"> {{ \'TOOLS.NEW_WINDOW\' | 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\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\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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.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\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/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.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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.FIELD">Field</label>\n                <md-select name="field" ng-model="vm.allCondition.field" autofocus required>\n\n                    <md-option ng-value="\'queue\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.QUEUE\' | translate }} </md-option>\n\n                    <md-option ng-value="\'lastevent\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.CALL_STATUS\' | translate }} </md-option>\n\n                    <md-option ng-value="\'routeId\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.OUTBOUNDROUTE\' | translate }} </md-option>\n\n                    <md-option ng-value="\'account\'" ng-if="vm.trigger.channel != \'voice\'"> {{ \'TOOLS.ACCOUNT\' | translate }} </md-option>\n\n                    <md-option ng-value="\'interaction\'" ng-if="vm.trigger.channel != \'voice\'"> {{ \'TOOLS.INTERACTION\' | translate }} </md-option>\n\n                    <md-option ng-value="\'message\'" ng-if="vm.trigger.channel != \'voice\'"> {{ \'TOOLS.MESSAGE\' | translate }} </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\n                    <md-option ng-value="\'equals\'"> {{ \'TOOLS.EQUALS\' | translate }} </md-option>\n\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\' && vm.trigger.channel == \'chat\'" 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" ng-repeat="value in vm.chatAccounts" ng-disabled="value.canSelect === false">{{ 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 == \'account\' && vm.trigger.channel == \'mail\'" 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" ng-repeat="value in vm.mailAccounts" ng-disabled="value.canSelect === false">{{ 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 == \'account\' && vm.trigger.channel == \'sms\'" 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" ng-repeat="value in vm.smsAccounts" ng-disabled="value.canSelect === false">{{ 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 == \'account\' && vm.trigger.channel == \'fax\'" 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" ng-repeat="value in vm.faxAccounts" ng-disabled="value.canSelect === false">{{ 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 == \'account\' && vm.trigger.channel == \'openchannel\'" 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" ng-repeat="value in vm.openchannelAccounts" ng-disabled="value.canSelect === false">{{ 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">{{ 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" ng-repeat="value in vm.outboundRoutes" ng-disabled="value.canSelect === false">{{ 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 == \'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="\'abandoned\'">Abandon</md-option>\n                    <md-option ng-value="\'complete\'">Hangup</md-option>\n                    <md-option ng-value="\'rejected\'">Reject</md-option>\n                    <md-option ng-value="\'called\'">Ring</md-option>\n                    <md-option ng-value="\'connect\'">Answer</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-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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.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\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/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.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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.FIELD">Field</label>\n                <md-select name="field" ng-model="vm.anyCondition.field" autofocus required>\n\n                    <md-option ng-value="\'queue\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.QUEUE\' | translate }} </md-option>\n\n                    <md-option ng-value="\'lastevent\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.CALL_STATUS\' | translate }} </md-option>\n\n                    <md-option ng-value="\'routeId\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.OUTBOUNDROUTE\' | translate }} </md-option>\n\n                    <md-option ng-value="\'account\'" ng-if="vm.trigger.channel != \'voice\'"> {{ \'TOOLS.ACCOUNT\' | translate }} </md-option>\n\n                    <md-option ng-value="\'interaction\'" ng-if="vm.trigger.channel != \'voice\'"> {{ \'TOOLS.INTERACTION\' | translate }} </md-option>\n\n                    <md-option ng-value="\'message\'" ng-if="vm.trigger.channel != \'voice\'"> {{ \'TOOLS.MESSAGE\' | translate }} </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\n                    <md-option ng-value="\'equals\'"> {{ \'TOOLS.EQUALS\' | translate }} </md-option>\n\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\' && vm.trigger.channel == \'chat\'" 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" ng-repeat="value in vm.chatAccounts" ng-disabled="value.canSelect === false">{{ 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 == \'account\' && vm.trigger.channel == \'mail\'" 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" ng-repeat="value in vm.mailAccounts" ng-disabled="value.canSelect === false">{{ 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 == \'account\' && vm.trigger.channel == \'sms\'" 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" ng-repeat="value in vm.smsAccounts" ng-disabled="value.canSelect === false">{{ 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 == \'account\' && vm.trigger.channel == \'fax\'" 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" ng-repeat="value in vm.faxAccounts" ng-disabled="value.canSelect === false">{{ 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 == \'account\' && vm.trigger.channel == \'openchannel\'" 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" ng-repeat="value in vm.openchannelAccounts" ng-disabled="value.canSelect === false">{{ 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">{{ 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" ng-repeat="value in vm.outboundRoutes" ng-disabled="value.canSelect === false">{{ 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 == \'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="\'abandoned\'">Abandon</md-option>\n                    <md-option ng-value="\'complete\'">Hangup</md-option>\n                    <md-option ng-value="\'rejected\'">Reject</md-option>\n                    <md-option ng-value="\'called\'">Ring</md-option>\n                    <md-option ng-value="\'connect\'">Answer</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-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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.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\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\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\n            <div layout="row" layout-align="start center">\n\n                <div class="trigger-image" hide-xs>\n                    <img ng-src="assets/images/business/triggers.jpg">\n                </div>\n\n                <div layout="column" layout-align="start start">\n                    <div class="h2">\n                        #{{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\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="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" 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.CHANNEL">Channel</label>\n                                <md-select name="channel" ng-model="vm.trigger.channel" required disabled>\n\n                                    <md-option ng-value="\'voice\'"> {{ \'TOOLS.VOICE\' | translate }} </md-option>\n\n                                    <md-option ng-value="\'openchannel\'" ng-if="vm.license.openchannel"> {{ \'TOOLS.OPENCHANNEL\' | translate }} </md-option>\n\n                                    <md-option ng-value="\'chat\'" ng-if="vm.license.chat"> {{ \'TOOLS.CHAT\' | translate }} </md-option>\n\n                                    <md-option ng-value="\'mail\'" ng-if="vm.license.mail"> {{ \'TOOLS.MAIL\' | translate }} </md-option>\n\n                                    <md-option ng-value="\'sms\'" ng-if="vm.license.messaging"> {{ \'TOOLS.SMS\' | translate }} </md-option>\n\n                                    <md-option ng-value="\'fax\'" ng-if="vm.license.fax"> {{ \'TOOLS.FAX\' | translate }} </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"><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\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.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">\n                        <div ng-controller="TriggerAllConditionsController as vm_dc" ng-init="vm_dc.init(vm.trigger, vm.crudPermissions)">\n                            <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedTriggerAllConditions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead" translate="TOOLS.ALLCONDITIONS">AllConditions</span>\n                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\n                                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditTriggerAllCondition($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.selectedTriggerAllConditions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead">{{vm_dc.selectedTriggerAllConditions.length}} {{vm_dc.selectedTriggerAllConditions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                                    <div flex></div>\n                                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedTriggerAllConditions" 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.deleteSelectedTriggerAllConditions($event)" aria-label="delete selected" translate translate-attr-label="TRIGGERS.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.selectedTriggerAllConditions" md-progress="vm_dc.promise">\n                                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getTriggerAllConditions">\n                                        <tr md-row>\n                                            <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                                            <th md-column md-order-by="field">{{ \'TOOLS.FIELD\' | translate }}</th>\n                                            <th md-column md-order-by="operator">{{ \'TOOLS.OPERATOR\' | translate }}</th>\n                                            <th md-column md-order-by="value">{{ \'TOOLS.VALUE\' | translate }}</th>\n                                            <th md-column md-order-by="createdAt">{{ \'TOOLS.CREATED_AT\' | translate }}</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.triggerAllConditions.rows">\n                                            <td ng-click="vm_dc.createOrEditTriggerAllCondition($event, allCondition)" md-cell>{{allCondition.id}}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAllCondition($event, allCondition)" md-cell>{{ \'TOOLS.\' + vm_dc.arrayfield[allCondition.field].option | uppercase | translate }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAllCondition($event, allCondition)" md-cell>{{ \'TOOLS.\' + vm_dc.arrayoperator[allCondition.operator].option | uppercase | translate }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAllCondition($event, allCondition)" ng-if="!allCondition.value" md-cell>{{allCondition.value}}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'chat\' && allCondition.field == \'account\'" md-cell>{{ (vm_dc.chatAccounts | filter : {\'id\':allCondition.value})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'mail\' && allCondition.field == \'account\'" md-cell>{{ (vm_dc.mailAccounts | filter : {\'id\':allCondition.value})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'sms\' && allCondition.field == \'account\'" md-cell>{{ (vm_dc.smsAccounts | filter : {\'id\':allCondition.value})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'fax\' && allCondition.field == \'account\'" md-cell>{{ (vm_dc.faxAccounts | filter : {\'id\':allCondition.value})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'openchannel\' && allCondition.field == \'account\'" md-cell>{{ (vm_dc.openchannelAccounts | filter : {\'id\':allCondition.value})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'voice\' && allCondition.field == \'queue\'" md-cell>{{ (vm_dc.queues | filter : {\'name\':allCondition.value})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'voice\' && allCondition.field == \'routeId\'" md-cell>{{ (vm_dc.outboundRoutes | filter : {\'id\':allCondition.value})[0].exten }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'voice\' && allCondition.field == \'lastevent\'" md-cell>{{ vm_dc.callStatusValues[allCondition.value].option }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAllCondition($event, allCondition)" ng-if="vm.trigger.channel != \'voice\' && allCondition.field == \'interaction\'" md-cell>{{ vm_dc.interactionStatusValues[allCondition.value].option }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAllCondition($event, allCondition)" ng-if="vm.trigger.channel != \'voice\' && allCondition.field == \'message\'" md-cell>{{ vm_dc.messageStatusValues[allCondition.value].option }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAllCondition($event, allCondition)" md-cell>{{allCondition.createdAt | date:\'medium\'}}</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.createOrEditTriggerAllCondition($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.triggerAllConditions.rows.length">\n                                            <td md-cell colspan="17">\n                                                <span class="text-boxed-ligth" translate="TOOLS.NO_ALLCONDITION_AVAILABLE">No allcondition available</span>\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.triggerAllConditions.count}}" md-on-paginate="vm_dc.getTriggerAllConditions" md-page-select></md-table-pagination>\n                        </div>\n\n                    </div>\n                    <div class="trigger-detail-form-container anyconditions md-background-bg md-whiteframe-1dp">\n                        <div ng-controller="TriggerAnyConditionsController as vm_dc" ng-init="vm_dc.init(vm.trigger, vm.crudPermissions)">\n                            <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedTriggerAnyConditions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead" translate="TOOLS.ANYCONDITIONS">AnyConditions</span>\n                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\n                                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditTriggerAnyCondition($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.selectedTriggerAnyConditions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead">{{vm_dc.selectedTriggerAnyConditions.length}} {{vm_dc.selectedTriggerAnyConditions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                                    <div flex></div>\n                                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedTriggerAnyConditions" 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.deleteSelectedTriggerAnyConditions($event)" aria-label="delete selected" translate translate-attr-label="TRIGGERS.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.selectedTriggerAnyConditions" md-progress="vm_dc.promise">\n                                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getTriggerAnyConditions">\n                                        <tr md-row>\n                                            <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                                            <th md-column md-order-by="field">{{ \'TOOLS.FIELD\' | translate }}</th>\n                                            <th md-column md-order-by="operator">{{ \'TOOLS.OPERATOR\' | translate }}</th>\n                                            <th md-column md-order-by="value">{{ \'TOOLS.VALUE\' | translate }}</th>\n                                            <th md-column md-order-by="createdAt">{{ \'TOOLS.CREATED_AT\' | translate }}</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.triggerAnyConditions.rows">\n                                            <td ng-click="vm_dc.createOrEditTriggerAnyCondition($event, anyCondition)" md-cell>{{anyCondition.id}}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAnyCondition($event, anyCondition)" md-cell>{{ \'TOOLS.\' + vm_dc.arrayfield[anyCondition.field].option | uppercase | translate }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAnyCondition($event, anyCondition)" md-cell>{{ \'TOOLS.\' + vm_dc.arrayoperator[anyCondition.operator].option | uppercase | translate }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAnyCondition($event, anyCondition)" ng-if="!anyCondition.value" md-cell>{{anyCondition.value}}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'chat\' && anyCondition.field == \'account\'" md-cell>{{ (vm_dc.chatAccounts | filter : {\'id\':anyCondition.value})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'mail\' && anyCondition.field == \'account\'" md-cell>{{ (vm_dc.mailAccounts | filter : {\'id\':anyCondition.value})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'sms\' && anyCondition.field == \'account\'" md-cell>{{ (vm_dc.smsAccounts | filter : {\'id\':anyCondition.value})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'fax\' && anyCondition.field == \'account\'" md-cell>{{ (vm_dc.faxAccounts | filter : {\'id\':anyCondition.value})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'openchannel\' && anyCondition.field == \'account\'" md-cell>{{ (vm_dc.openchannelAccounts | filter : {\'id\':anyCondition.value})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'voice\' && anyCondition.field == \'queue\'" md-cell>{{ (vm_dc.queues | filter : {\'name\':anyCondition.value})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'voice\' && anyCondition.field == \'routeId\'" md-cell>{{ (vm_dc.outboundRoutes | filter : {\'id\':anyCondition.value})[0].exten }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'voice\' && anyCondition.field == \'lastevent\'" md-cell>{{ vm_dc.callStatusValues[anyCondition.value].option }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel != \'voice\' && anyCondition.field == \'interaction\'" md-cell>{{ vm_dc.interactionStatusValues[anyCondition.value].option }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel != \'voice\' && anyCondition.field == \'message\'" md-cell>{{ vm_dc.messageStatusValues[anyCondition.value].option }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAnyCondition($event, anyCondition)" md-cell>{{anyCondition.createdAt | date:\'medium\'}}</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.createOrEditTriggerAnyCondition($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.triggerAnyConditions.rows.length">\n                                            <td md-cell colspan="17">\n                                                <span class="text-boxed-ligth" translate="TOOLS.NO_ANYCONDITION_AVAILABLE">No anycondition available</span>\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.triggerAnyConditions.count}}" md-on-paginate="vm_dc.getTriggerAnyConditions" md-page-select></md-table-pagination>\n                        </div>\n\n                    </div>\n                    <div class="trigger-detail-form-container actions md-background-bg md-whiteframe-1dp">\n                        <div ng-controller="TriggerActionsController as vm_dc" ng-init="vm_dc.init(vm.trigger, vm.crudPermissions)">\n                            <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedTriggerActions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead" translate="TOOLS.ACTIONS">Actions</span>\n                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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">\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.selectedTriggerActions.length">\n                                <div class="md-toolbar-tools">\n                                    <span class="md-subhead">{{vm_dc.selectedTriggerActions.length}} {{vm_dc.selectedTriggerActions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                                    <div flex></div>\n                                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedTriggerActions" 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.deleteSelectedTriggerActions($event)" aria-label="delete selected" translate translate-attr-label="TRIGGERS.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.selectedTriggerActions" md-progress="vm_dc.promise">\n                                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getTriggerActions">\n                                        <tr md-row>\n                                            <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                                            <th md-column md-order-by="action">{{ \'TOOLS.ACTION\' | translate }}</th>\n                                            <th md-column md-order-by="data1">{{ \'TOOLS.TYPE\' | translate }}</th>\n                                            <th md-column md-order-by="data2">{{ \'TOOLS.INFO\' | translate }}</th>\n                                            <th md-column md-order-by="createdAt">{{ \'TOOLS.CREATED_AT\' | translate }}</th>\n                                            <th md-column width="10px"></th>\n                                        </tr>\n                                    </thead>\n                                    <tbody md-body>\n                                        <tr md-row md-select="action" md-select-id="id" ng-repeat="action in vm_dc.triggerActions.rows">\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" md-cell>{{action.id}}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" md-cell>{{ \'TOOLS.\' + vm_dc.arrayaction[action.action].option | uppercase | translate }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'jscripty\'" md-cell>{{ (vm_dc.projects | filter : {\'id\':action.data1})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'browser\'" md-cell>{{ vm_dc.browserValues[action.data1].option }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'contactManager\'" md-cell>{{ (vm_dc.lists | filter : {\'id\':action.data1})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'contactManager\'" md-cell>{{ \'TOOLS.\' + vm_dc.autoCreateContact[action.data2].option | uppercase | translate }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'urlForward\'" md-cell>{{ vm_dc.urlForwardValues[action.data1].option }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="!action.data1" md-cell>{{action.data1}}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="!action.data2" md-cell>{{action.data2}}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'urlForward\'" md-cell>{{action.data2}}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'urlForward\' && action.data1 == \'POST\'" md-cell>{{action.data7}}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\'" md-cell>{{ vm_dc.integrationValues[action.data1].option }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'zendesk\'" md-cell>{{ (vm_dc.zendeskAccounts | filter : {\'id\':action.data2})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'desk\'" md-cell>{{ (vm_dc.deskAccounts | filter : {\'id\':action.data2})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'zoho\'" md-cell>{{ (vm_dc.zohoAccounts | filter : {\'id\':action.data2})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'salesforce\'" md-cell>{{ (vm_dc.salesforceAccounts | filter : {\'id\':action.data2})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'sugarcrm\'" md-cell>{{ (vm_dc.sugarcrmAccounts | filter : {\'id\':action.data2})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'freshdesk\'" md-cell>{{ (vm_dc.freshdeskAccounts | filter : {\'id\':action.data2})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'vtiger\'" md-cell>{{ (vm_dc.vtigerAccounts | filter : {\'id\':action.data2})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'dynamics365\'" md-cell>{{ (vm_dc.dynamics365Accounts | filter : {\'id\':action.data2})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'servicenow\'" md-cell>{{ (vm_dc.servicenowAccounts | filter : {\'id\':action.data2})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'motionbar\'" md-cell>{{ vm_dc.motionbarValues[action.data1].option }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'motionbar\' && action.data1 == \'1\'" md-cell>{{action.data2}}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'motionbar\' && action.data1 == \'2\'" md-cell>{{action.data2}}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'motionbar\' && action.data1 == \'0\'" md-cell>{{ (vm_dc.templates | filter : {\'id\':action.data2})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'browser\' && action.data1 == \'0\'" md-cell>{{ (vm_dc.templates | filter : {\'id\':action.data2})[0].name }}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'browser\' && action.data1 == \'1\'" md-cell>{{action.data2}}</td>\n                                            <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" md-cell>{{action.createdAt | date:\'medium\'}}</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.createOrEditTriggerAction($event, action)" translate="TOOLS.EDIT_ACTION">\n                                                                Edit Action\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(action, $event)" translate="TOOLS.DELETE_ACTION">\n                                                                Delete Action\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.triggerActions.rows.length">\n                                            <td md-cell colspan="44">\n                                                <span class="text-boxed-ligth" translate="TOOLS.NO_ACTION_AVAILABLE">No action available</span>\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.triggerActions.count}}" md-on-paginate="vm_dc.getTriggerActions" 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/tools/views/triggers/triggers.html",'<div id="triggers" 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.TRIGGERS">Triggers</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.selectedTriggers.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.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\n        <div flex layout="row" layout-align="space-between center">\n\n            <div>\n                <span class="selected-triggers-count">\n                    <span>{{vm.selectedTriggers.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="TRIGGERS.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\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="TRIGGERS.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!-- 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 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="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 md-cell ng-if="trigger.userpic"><img class="avatar" alt="{{trigger.name}}" ng-src="api/users/{{trigger.id}}/avatar" /></td>\n                                <td md-cell ng-if="!trigger.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{trigger.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trigger, ev) : vm.createOrEditTrigger($event, trigger)" md-cell class="id ">{{trigger.id}}</td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trigger, ev) : vm.createOrEditTrigger($event, trigger)" md-cell class="name ">{{trigger.name}}</td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trigger, ev) : vm.createOrEditTrigger($event, trigger)" md-cell class="channel ">{{ \'TOOLS.\' + vm.arraychannel[trigger.channel].option | uppercase | translate }}</td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trigger, ev) : 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.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trigger, ev) : vm.createOrEditTrigger($event, trigger)" md-cell class="description ">{{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                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(trigger, $event)" translate="TOOLS.EDIT_TRIGGER">\n                                                    Edit Trigger\n                                                </md-button>\n                                            </md-menu-item>\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\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\n            \x3c!-- / NO RESULTS --\x3e\n        </div>\n        \x3c!-- / MAIN --\x3e\n\n    </div>\n    \x3c!-- / CONTENT --\x3e\n\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 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.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 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.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" 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 animate-slide-down 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="TRUNKS.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="TRUNKS.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!-- 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                                <td md-cell class="actions">\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.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(trunk, $event)" translate="TOOLS.EDIT_TRUNK">\n                                                    Edit Trunk\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.clonedialog(trunk, $event)" translate="TOOLS.CLONE_TRUNK">\n                                                    clone Trunk\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.gotorealtimegoto(trunk, $event)" translate="TOOLS.GOTOREALTIME_TRUNK">\n                                                    goToRealtime Trunk\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(trunk, $event)" translate="TOOLS.DELETE_TRUNK">\n                                                    Delete 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: \'{{\'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 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.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 animate-slide-down 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="VARIABLES.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="VARIABLES.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!-- 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                                <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                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editdialog(variable, $event)" translate="TOOLS.EDIT_VARIABLE">\n                                                    Edit Variable\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(variable, $event)" translate="TOOLS.DELETE_VARIABLE">\n                                                    Delete Variable\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: \'{{\'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/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 animate-slide-down 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="CHANSPIES.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="CHANSPIES.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!-- 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                                <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.editdialog(chanSpy, $event)" translate="VOICE.EDIT_CHANSPY">\n                                                    Edit chanSpy\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(chanSpy, $event)" translate="VOICE.DELETE_CHANSPY">\n                                                    Delete chanSpy\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.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 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="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 animate-slide-down 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="CONTEXTS.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="CONTEXTS.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!-- 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                                <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.editdialog(context, $event)" translate="VOICE.EDIT_CONTEXT">\n                                                    Edit Context\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(context, $event)" translate="VOICE.DELETE_CONTEXT">\n                                                    Delete Context\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.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 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="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 class="inboundroute-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.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.PHONENUMBER">PhoneNumber</label>\n                <input type="text" name="exten" ng-model="vm.inboundroute.exten" ng-required="true" autofocus>\n\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" 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.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.inboundroute.description">\n\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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.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\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/apps/agi/dialog.html",'<md-dialog class="inboundroute-dialog" aria-label="New InboundRoute">\n    <form name="inboundrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.PROJECT">Project</label>\n                <md-select name="project" ng-model="vm.agi.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" ng-disabled="project.canSelect === false">{{ project.name }}</md-option>\n                </md-select>\n                <div ng-messages="inboundrouteFormApp[\'project\'].$error" ng-show="inboundrouteFormApp[\'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>\n\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInboundRouteApp()" class="send-button md-accent md-raised" ng-disabled="inboundrouteFormApp.$invalid || inboundrouteFormApp.$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/views/inboundroutes/edit/apps/custom/dialog.html",'<md-dialog class="inboundroute-dialog" aria-label="New InboundRoute">\n    <form name="inboundrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.APPLICATION_NAME">Application_Name</label>\n                <input type="text" name="app" ng-model="vm.custom.app" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'app\'].$error" ng-show="inboundrouteFormApp[\'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.custom.appdata" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'appdata\'].$error" ng-show="inboundrouteFormApp[\'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>\n\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInboundRouteApp()" class="send-button md-accent md-raised" ng-disabled="inboundrouteFormApp.$invalid || inboundrouteFormApp.$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/views/inboundroutes/edit/apps/dial/dialog.html",'<md-dialog class="inboundroute-dialog" aria-label="New InboundRoute">\n    <form name="inboundrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.TECHNOLOGY/RESOURCE">Technology/Resource</label>\n                <input type="text" name="tech" ng-model="vm.dial.tech" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'tech\'].$error" ng-show="inboundrouteFormApp[\'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.dial.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'timeout\'].$error" ng-show="inboundrouteFormApp[\'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.OPTIONS">Options</label>\n                <input type="text" name="options" ng-model="vm.dial.options" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'options\'].$error" ng-show="inboundrouteFormApp[\'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.dial.url" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'url\'].$error" ng-show="inboundrouteFormApp[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInboundRouteApp()" class="send-button md-accent md-raised" ng-disabled="inboundrouteFormApp.$invalid || inboundrouteFormApp.$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/views/inboundroutes/edit/apps/externaldial/dialog.html",'<md-dialog class="inboundroute-dialog" aria-label="New InboundRoute">\n    <form name="inboundrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.TRUNK">Trunk</label>\n                <md-select name="trunk" ng-model="vm.externaldial.trunk" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                    <md-option ng-value="trunk.name" ng-repeat="trunk in vm.trunks" ng-disabled="trunk.canSelect === false">{{ trunk.name }}</md-option>\n                </md-select>\n                <div ng-messages="inboundrouteFormApp[\'trunk\'].$error" ng-show="inboundrouteFormApp[\'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.externaldial.phone" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'phone\'].$error" ng-show="inboundrouteFormApp[\'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.externaldial.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'timeout\'].$error" ng-show="inboundrouteFormApp[\'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.OPTIONS">Options</label>\n                <input type="text" name="options" ng-model="vm.externaldial.options" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'options\'].$error" ng-show="inboundrouteFormApp[\'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.externaldial.url" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'url\'].$error" ng-show="inboundrouteFormApp[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInboundRouteApp()" class="send-button md-accent md-raised" ng-disabled="inboundrouteFormApp.$invalid || inboundrouteFormApp.$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/views/inboundroutes/edit/apps/goto/dialog.html",'<md-dialog class="inboundroute-dialog" aria-label="New InboundRoute">\n    <form name="inboundrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.CONTEXT">Context</label>\n                <md-select name="context" ng-model="vm.goto.context" autofocus 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="inboundrouteFormApp[\'context\'].$error" ng-show="inboundrouteFormApp[\'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.goto.extension" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'extension\'].$error" ng-show="inboundrouteFormApp[\'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.goto.priority" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'priority\'].$error" ng-show="inboundrouteFormApp[\'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>\n\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInboundRouteApp()" class="send-button md-accent md-raised" ng-disabled="inboundrouteFormApp.$invalid || inboundrouteFormApp.$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/views/inboundroutes/edit/apps/hangup/dialog.html",'<md-dialog class="inboundroute-dialog" aria-label="New InboundRoute">\n    <form name="inboundrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.HANGUP_CAUSE">Hangup_Cause</label>\n                <md-select name="appdata" ng-model="vm.hangup.appdata" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n\n                    <md-option ng-value="\'1\'"> {{ \'VOICE.HANGUPCAUSE_1\' | translate }} </md-option>\n\n                    <md-option ng-value="\'16\'"> {{ \'VOICE.HANGUPCAUSE_16\' | translate }} </md-option>\n\n                    <md-option ng-value="\'17\'"> {{ \'VOICE.HANGUPCAUSE_17\' | translate }} </md-option>\n\n                    <md-option ng-value="\'18\'"> {{ \'VOICE.HANGUPCAUSE_18\' | translate }} </md-option>\n\n                    <md-option ng-value="\'21\'"> {{ \'VOICE.HANGUPCAUSE_21\' | translate }} </md-option>\n\n                    <md-option ng-value="\'22\'"> {{ \'VOICE.HANGUPCAUSE_22\' | translate }} </md-option>\n\n                    <md-option ng-value="\'27\'"> {{ \'VOICE.HANGUPCAUSE_27\' | translate }} </md-option>\n\n                    <md-option ng-value="\'38\'"> {{ \'VOICE.HANGUPCAUSE_38\' | translate }} </md-option>\n\n                    <md-option ng-value="\'41\'"> {{ \'VOICE.HANGUPCAUSE_41\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="inboundrouteFormApp[\'appdata\'].$error" ng-show="inboundrouteFormApp[\'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>\n\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInboundRouteApp()" class="send-button md-accent md-raised" ng-disabled="inboundrouteFormApp.$invalid || inboundrouteFormApp.$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/views/inboundroutes/edit/apps/internaldial/dialog.html",'<md-dialog class="inboundroute-dialog" aria-label="New InboundRoute">\n    <form name="inboundrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.USER">User</label>\n                <md-select name="user" ng-model="vm.internaldial.user" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                    <md-option ng-value="\'SIP/{{user.name}}\'" ng-repeat="user in vm.users" ng-disabled="user.canSelect === false">{{ user.name }}</md-option>\n                </md-select>\n                <div ng-messages="inboundrouteFormApp[\'user\'].$error" ng-show="inboundrouteFormApp[\'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.internaldial.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'timeout\'].$error" ng-show="inboundrouteFormApp[\'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.OPTIONS">Options</label>\n                <input type="text" name="options" ng-model="vm.internaldial.options" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'options\'].$error" ng-show="inboundrouteFormApp[\'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.internaldial.url" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'url\'].$error" ng-show="inboundrouteFormApp[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInboundRouteApp()" class="send-button md-accent md-raised" ng-disabled="inboundrouteFormApp.$invalid || inboundrouteFormApp.$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/views/inboundroutes/edit/apps/interval/dialog.html",'<md-dialog class="inboundroute-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 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\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/voice/views/inboundroutes/edit/apps/playback/dialog.html",'<md-dialog class="inboundroute-dialog" aria-label="New InboundRoute">\n    <form name="inboundrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.AUDIO_FILES">Audio_Files</label>\n                <md-select name="appdata" ng-model="vm.playback.appdata" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                    <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/{{appdata.save_name}}\'" ng-repeat="appdata in vm.sounds" ng-disabled="appdata.canSelect === false">{{ appdata.name }}</md-option>\n                </md-select>\n                <div ng-messages="inboundrouteFormApp[\'appdata\'].$error" ng-show="inboundrouteFormApp[\'appdata\'].$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.playback.options" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'options\'].$error" ng-show="inboundrouteFormApp[\'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.playback.answer" aria-label="Answer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="VOICE.ANSWER">Answer</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            <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n                <md-button type="submit" ng-click="vm.saveInboundRouteApp()" class="send-button md-accent md-raised" ng-disabled="inboundrouteFormApp.$invalid || inboundrouteFormApp.$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/views/inboundroutes/edit/apps/queue/dialog.html",'<md-dialog class="inboundroute-dialog" aria-label="New InboundRoute">\n    <form name="inboundrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.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="inboundrouteFormApp[\'queue\'].$error" ng-show="inboundrouteFormApp[\'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.queue.options" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'options\'].$error" ng-show="inboundrouteFormApp[\'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.queue.URL" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'URL\'].$error" ng-show="inboundrouteFormApp[\'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.queue.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" ng-disabled="sound.canSelect === false">{{ sound.name }}</md-option>\n                </md-select>\n                <div ng-messages="inboundrouteFormApp[\'sound\'].$error" ng-show="inboundrouteFormApp[\'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.queue.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'timeout\'].$error" ng-show="inboundrouteFormApp[\'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.AGI">Agi</label>\n                <input type="text" name="agi" ng-model="vm.queue.agi" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'agi\'].$error" ng-show="inboundrouteFormApp[\'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.queue.macro" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'macro\'].$error" ng-show="inboundrouteFormApp[\'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.queue.gosub" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'gosub\'].$error" ng-show="inboundrouteFormApp[\'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.queue.rule" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'rule\'].$error" ng-show="inboundrouteFormApp[\'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.queue.position" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'position\'].$error" ng-show="inboundrouteFormApp[\'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 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.queue.answer" aria-label="Answer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="VOICE.ANSWER">Answer</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            <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n                <md-button type="submit" ng-click="vm.saveInboundRouteApp()" class="send-button md-accent md-raised" ng-disabled="inboundrouteFormApp.$invalid || inboundrouteFormApp.$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/views/inboundroutes/edit/apps/ringgroup/dialog.html",'<md-dialog class="inboundroute-dialog" aria-label="New InboundRoute">\n    <form name="inboundrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.USER">User</label>\n                <md-select name="multipleUsers" ng-model="vm.ringgroup.multipleUsers" autofocus multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                    <md-option ng-value="\'SIP/{{multipleUsers.name}}\'" ng-repeat="multipleUsers in vm.users" ng-disabled="multipleUsers.canSelect === false">{{ multipleUsers.name }}</md-option>\n                </md-select>\n                <div ng-messages="inboundrouteFormApp[\'multipleUsers\'].$error" ng-show="inboundrouteFormApp[\'multipleUsers\'].$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.ringgroup.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'timeout\'].$error" ng-show="inboundrouteFormApp[\'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.OPTIONS">Options</label>\n                <input type="text" name="options" ng-model="vm.ringgroup.options" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'options\'].$error" ng-show="inboundrouteFormApp[\'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.ringgroup.url" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'url\'].$error" ng-show="inboundrouteFormApp[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInboundRouteApp()" class="send-button md-accent md-raised" ng-disabled="inboundrouteFormApp.$invalid || inboundrouteFormApp.$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/views/inboundroutes/edit/apps/set/dialog.html",'<md-dialog class="inboundroute-dialog" aria-label="New InboundRoute">\n    <form name="inboundrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.VARIABLE">Variable</label>\n                <md-select name="name" ng-model="vm.set.name" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                    <md-option ng-value="name.name" ng-repeat="name in vm.variables" ng-disabled="name.canSelect === false">{{ name.name }}</md-option>\n                </md-select>\n                <div ng-messages="inboundrouteFormApp[\'name\'].$error" ng-show="inboundrouteFormApp[\'name\'].$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.set.value" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'value\'].$error" ng-show="inboundrouteFormApp[\'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>\n\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInboundRouteApp()" class="send-button md-accent md-raised" ng-disabled="inboundrouteFormApp.$invalid || inboundrouteFormApp.$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/views/inboundroutes/edit/apps/voicemail/dialog.html",'<md-dialog class="inboundroute-dialog" aria-label="New InboundRoute">\n    <form name="inboundrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.MAILBOX@CONTEXT">Mailbox@Context</label>\n                <md-select name="voiceMail" ng-model="vm.voicemail.voiceMail" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                    <md-option ng-value="\'{{voiceMail.mailbox}}@from-voicemail\'" ng-repeat="voiceMail in vm.voiceMails" ng-disabled="voiceMail.canSelect === false">{{ voiceMail.mailbox }}</md-option>\n                </md-select>\n                <div ng-messages="inboundrouteFormApp[\'voiceMail\'].$error" ng-show="inboundrouteFormApp[\'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.voicemail.options" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="inboundrouteFormApp[\'options\'].$error" ng-show="inboundrouteFormApp[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInboundRouteApp()" class="send-button md-accent md-raised" ng-disabled="inboundrouteFormApp.$invalid || inboundrouteFormApp.$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/views/inboundroutes/edit/view.html",'<div id="voice-inboundroute" 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-inboundroutes-button md-icon-button" aria-label="Go to inboundroutes" 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\n            <div layout="row" layout-align="start center">\n\n                <div class="inboundroute-image" hide-xs>\n                    <img ng-src="assets/images/business/inboundroutes.jpg">\n                </div>\n\n                <div layout="column" layout-align="start start">\n                    <div class="h2">\n                        #{{vm.inboundroute.id}}\n                        <span ng-if="vm.inboundroute.name">{{vm.inboundroute.name}}</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\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="inboundroute-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.PHONENUMBER">PhoneNumber</label>\n                                <input type="text" name="exten" ng-model="vm.inboundroute.exten" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\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" 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.DESCRIPTION">Description</label>\n                                <input type="text" name="description" ng-model="vm.inboundroute.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.ACTIONS">ACTIONS</span>\n                </md-tab-label>\n                <md-tab-body>\n                    <div class="inboundroute-detail-form-container actions md-background-bg md-whiteframe-1dp">\n                        <div ng-controller="InboundRouteActionsController as vm_ac" ng-init="vm_ac.init(vm.inboundroute, 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" ms-scroll 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="VOICE.{{(a.alias || a.appType) | uppercase}}">{{a.alias || 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" ms-scroll layout="column" flex="{{vm_ac.crudPermissions.canEdit ? 75 : 100}}">\n                                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_ac.selectedInboundRouteApps.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.selectedInboundRouteApps.length">\n                                    <div class="md-toolbar-tools">\n                                        <span class="md-subhead">{{vm_ac.selectedInboundRouteApps.length}} {{vm_ac.selectedInboundRouteApps.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.deleteSelectedInboundRouteApps($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\n                                \x3c!-- QUEUES TABLE --\x3e\n                                <md-table-container>\n                                    <table md-table md-row-select multiple ng-model="vm_ac.selectedInboundRouteApps">\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_ac.applications">\n                                            <tr md-row md-select="app" md-select-id="id" ng-repeat="app in vm_ac.inboundrouteApps.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.editInboundRouteApp($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.editInboundRouteApp($event, $index)"><span class="text-truncate" style="width:200px">{{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.editInboundRouteApp($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.inboundrouteApps.rows.length">\n                                                <td md-cell colspan="6">\n                                                    <span class="text-boxed-ligth" translate="VOICE.NO_APPS_AVAILABLE">No apps 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                                \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-tabs>\n\n    </div>\n    \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/voice/views/inboundroutes/inboundroutes.html",'<div id="inboundroutes" 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.INBOUNDROUTES">InboundRoutes</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.selectedInboundRoutes.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.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\n        <div flex layout="row" layout-align="space-between center">\n\n            <div>\n                <span class="selected-inboundroutes-count">\n                    <span>{{vm.selectedInboundRoutes.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="INBOUNDROUTES.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.selectAllInboundRoutes()" translate="VOICE.SELECT_ALL">\n                                Select all\n                            </md-button>\n                        </md-menu-item>\n                        <md-menu-item>\n                            <md-button ng-click="vm.deselectInboundRoutes()" 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.exportSelectedInboundRoutes" csv-label="true" filename="inboundroutes.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="INBOUNDROUTES.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!-- INBOUNDROUTE TABLE --\x3e\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 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="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="inboundroute" md-select-id="id" ng-repeat="inboundroute in vm.inboundroutes.rows">\n                                <td md-cell ng-if="inboundroute.userpic"><img class="avatar" alt="{{inboundroute.name}}" ng-src="api/users/{{inboundroute.id}}/avatar" /></td>\n                                <td md-cell ng-if="!inboundroute.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{inboundroute.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(inboundroute, ev) : vm.createOrEditInboundRoute($event, inboundroute)" md-cell class="id ">{{inboundroute.id}}</td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(inboundroute, ev) : vm.createOrEditInboundRoute($event, inboundroute)" md-cell class="exten ">{{inboundroute.exten}}</td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(inboundroute, ev) : vm.createOrEditInboundRoute($event, inboundroute)" md-cell class="description ">{{inboundroute.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.editstate(inboundroute, $event)" 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(inboundroute, $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\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></md-table-pagination>\n            </md-card>\n            \x3c!-- / INBOUNDROUTE 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 INBOUNDROUTE BUTTON --\x3e\n    <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-inboundroute-button" ng-click="vm.createOrEditInboundRoute($event)" aria-label="add inboundroute" translate translate-attr-aria-label="VOICE.ADD_INBOUNDROUTE">\n        <md-icon md-font-icon="icon-plus"></md-icon>\n    </md-button>\n    \x3c!-- / ADD INBOUNDROUTE BUTTON --\x3e\n</div>'),e.put("app/main/apps/voice/views/internalroutes/create/dialog.html",'<md-dialog class="internalroute-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.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.PHONENUMBER">PhoneNumber</label>\n                <input type="text" name="exten" ng-model="vm.internalroute.exten" ng-required="true" autofocus>\n\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" 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.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.internalroute.description">\n\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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.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\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/apps/agi/dialog.html",'<md-dialog class="internalroute-dialog" aria-label="New InternalRoute">\n    <form name="internalrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.PROJECT">Project</label>\n                <md-select name="project" ng-model="vm.agi.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" ng-disabled="project.canSelect === false">{{ project.name }}</md-option>\n                </md-select>\n                <div ng-messages="internalrouteFormApp[\'project\'].$error" ng-show="internalrouteFormApp[\'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>\n\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInternalRouteApp()" class="send-button md-accent md-raised" ng-disabled="internalrouteFormApp.$invalid || internalrouteFormApp.$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/views/internalroutes/edit/apps/custom/dialog.html",'<md-dialog class="internalroute-dialog" aria-label="New InternalRoute">\n    <form name="internalrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.APPLICATION_NAME">Application_Name</label>\n                <input type="text" name="app" ng-model="vm.custom.app" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'app\'].$error" ng-show="internalrouteFormApp[\'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.custom.appdata" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'appdata\'].$error" ng-show="internalrouteFormApp[\'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>\n\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInternalRouteApp()" class="send-button md-accent md-raised" ng-disabled="internalrouteFormApp.$invalid || internalrouteFormApp.$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/views/internalroutes/edit/apps/dial/dialog.html",'<md-dialog class="internalroute-dialog" aria-label="New InternalRoute">\n    <form name="internalrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.TECHNOLOGY/RESOURCE">Technology/Resource</label>\n                <input type="text" name="tech" ng-model="vm.dial.tech" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'tech\'].$error" ng-show="internalrouteFormApp[\'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.dial.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'timeout\'].$error" ng-show="internalrouteFormApp[\'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.OPTIONS">Options</label>\n                <input type="text" name="options" ng-model="vm.dial.options" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'options\'].$error" ng-show="internalrouteFormApp[\'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.dial.url" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'url\'].$error" ng-show="internalrouteFormApp[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInternalRouteApp()" class="send-button md-accent md-raised" ng-disabled="internalrouteFormApp.$invalid || internalrouteFormApp.$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/views/internalroutes/edit/apps/externaldial/dialog.html",'<md-dialog class="internalroute-dialog" aria-label="New InternalRoute">\n    <form name="internalrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.TRUNK">Trunk</label>\n                <md-select name="trunk" ng-model="vm.externaldial.trunk" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                    <md-option ng-value="trunk.name" ng-repeat="trunk in vm.trunks" ng-disabled="trunk.canSelect === false">{{ trunk.name }}</md-option>\n                </md-select>\n                <div ng-messages="internalrouteFormApp[\'trunk\'].$error" ng-show="internalrouteFormApp[\'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.externaldial.phone" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'phone\'].$error" ng-show="internalrouteFormApp[\'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.externaldial.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'timeout\'].$error" ng-show="internalrouteFormApp[\'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.OPTIONS">Options</label>\n                <input type="text" name="options" ng-model="vm.externaldial.options" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'options\'].$error" ng-show="internalrouteFormApp[\'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.externaldial.url" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'url\'].$error" ng-show="internalrouteFormApp[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInternalRouteApp()" class="send-button md-accent md-raised" ng-disabled="internalrouteFormApp.$invalid || internalrouteFormApp.$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/views/internalroutes/edit/apps/goto/dialog.html",'<md-dialog class="internalroute-dialog" aria-label="New InternalRoute">\n    <form name="internalrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.CONTEXT">Context</label>\n                <md-select name="context" ng-model="vm.goto.context" autofocus 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="internalrouteFormApp[\'context\'].$error" ng-show="internalrouteFormApp[\'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.goto.extension" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'extension\'].$error" ng-show="internalrouteFormApp[\'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.goto.priority" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'priority\'].$error" ng-show="internalrouteFormApp[\'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>\n\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInternalRouteApp()" class="send-button md-accent md-raised" ng-disabled="internalrouteFormApp.$invalid || internalrouteFormApp.$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/views/internalroutes/edit/apps/hangup/dialog.html",'<md-dialog class="internalroute-dialog" aria-label="New InternalRoute">\n    <form name="internalrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.HANGUP_CAUSE">Hangup_Cause</label>\n                <md-select name="appdata" ng-model="vm.hangup.appdata" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n\n                    <md-option ng-value="\'1\'"> {{ \'VOICE.HANGUPCAUSE_1\' | translate }} </md-option>\n\n                    <md-option ng-value="\'16\'"> {{ \'VOICE.HANGUPCAUSE_16\' | translate }} </md-option>\n\n                    <md-option ng-value="\'17\'"> {{ \'VOICE.HANGUPCAUSE_17\' | translate }} </md-option>\n\n                    <md-option ng-value="\'18\'"> {{ \'VOICE.HANGUPCAUSE_18\' | translate }} </md-option>\n\n                    <md-option ng-value="\'21\'"> {{ \'VOICE.HANGUPCAUSE_21\' | translate }} </md-option>\n\n                    <md-option ng-value="\'22\'"> {{ \'VOICE.HANGUPCAUSE_22\' | translate }} </md-option>\n\n                    <md-option ng-value="\'27\'"> {{ \'VOICE.HANGUPCAUSE_27\' | translate }} </md-option>\n\n                    <md-option ng-value="\'38\'"> {{ \'VOICE.HANGUPCAUSE_38\' | translate }} </md-option>\n\n                    <md-option ng-value="\'41\'"> {{ \'VOICE.HANGUPCAUSE_41\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="internalrouteFormApp[\'appdata\'].$error" ng-show="internalrouteFormApp[\'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>\n\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInternalRouteApp()" class="send-button md-accent md-raised" ng-disabled="internalrouteFormApp.$invalid || internalrouteFormApp.$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/views/internalroutes/edit/apps/internaldial/dialog.html",'<md-dialog class="internalroute-dialog" aria-label="New InternalRoute">\n    <form name="internalrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.USER">User</label>\n                <md-select name="user" ng-model="vm.internaldial.user" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                    <md-option ng-value="\'SIP/{{user.name}}\'" ng-repeat="user in vm.users" ng-disabled="user.canSelect === false">{{ user.name }}</md-option>\n                </md-select>\n                <div ng-messages="internalrouteFormApp[\'user\'].$error" ng-show="internalrouteFormApp[\'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.internaldial.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'timeout\'].$error" ng-show="internalrouteFormApp[\'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.OPTIONS">Options</label>\n                <input type="text" name="options" ng-model="vm.internaldial.options" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'options\'].$error" ng-show="internalrouteFormApp[\'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.internaldial.url" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'url\'].$error" ng-show="internalrouteFormApp[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInternalRouteApp()" class="send-button md-accent md-raised" ng-disabled="internalrouteFormApp.$invalid || internalrouteFormApp.$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/views/internalroutes/edit/apps/interval/dialog.html",'<md-dialog class="inboundroute-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 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\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/voice/views/internalroutes/edit/apps/playback/dialog.html",'<md-dialog class="internalroute-dialog" aria-label="New InternalRoute">\n    <form name="internalrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.AUDIO_FILES">Audio_Files</label>\n                <md-select name="appdata" ng-model="vm.playback.appdata" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                    <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/{{appdata.save_name}}\'" ng-repeat="appdata in vm.sounds" ng-disabled="appdata.canSelect === false">{{ appdata.name }}</md-option>\n                </md-select>\n                <div ng-messages="internalrouteFormApp[\'appdata\'].$error" ng-show="internalrouteFormApp[\'appdata\'].$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.playback.options" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'options\'].$error" ng-show="internalrouteFormApp[\'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.playback.answer" aria-label="Answer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="VOICE.ANSWER">Answer</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            <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n                <md-button type="submit" ng-click="vm.saveInternalRouteApp()" class="send-button md-accent md-raised" ng-disabled="internalrouteFormApp.$invalid || internalrouteFormApp.$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/views/internalroutes/edit/apps/queue/dialog.html",'<md-dialog class="internalroute-dialog" aria-label="New InternalRoute">\n    <form name="internalrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.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="internalrouteFormApp[\'queue\'].$error" ng-show="internalrouteFormApp[\'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.queue.options" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'options\'].$error" ng-show="internalrouteFormApp[\'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.queue.URL" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'URL\'].$error" ng-show="internalrouteFormApp[\'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.queue.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" ng-disabled="sound.canSelect === false">{{ sound.name }}</md-option>\n                </md-select>\n                <div ng-messages="internalrouteFormApp[\'sound\'].$error" ng-show="internalrouteFormApp[\'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.queue.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'timeout\'].$error" ng-show="internalrouteFormApp[\'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.AGI">Agi</label>\n                <input type="text" name="agi" ng-model="vm.queue.agi" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'agi\'].$error" ng-show="internalrouteFormApp[\'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.queue.macro" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'macro\'].$error" ng-show="internalrouteFormApp[\'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.queue.gosub" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'gosub\'].$error" ng-show="internalrouteFormApp[\'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.queue.rule" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'rule\'].$error" ng-show="internalrouteFormApp[\'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.queue.position" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'position\'].$error" ng-show="internalrouteFormApp[\'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 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.queue.answer" aria-label="Answer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="VOICE.ANSWER">Answer</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            <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n                <md-button type="submit" ng-click="vm.saveInternalRouteApp()" class="send-button md-accent md-raised" ng-disabled="internalrouteFormApp.$invalid || internalrouteFormApp.$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/views/internalroutes/edit/apps/ringgroup/dialog.html",'<md-dialog class="internalroute-dialog" aria-label="New InternalRoute">\n    <form name="internalrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.USER">User</label>\n                <md-select name="multipleUsers" ng-model="vm.ringgroup.multipleUsers" autofocus multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                    <md-option ng-value="\'SIP/{{multipleUsers.name}}\'" ng-repeat="multipleUsers in vm.users" ng-disabled="multipleUsers.canSelect === false">{{ multipleUsers.name }}</md-option>\n                </md-select>\n                <div ng-messages="internalrouteFormApp[\'multipleUsers\'].$error" ng-show="internalrouteFormApp[\'multipleUsers\'].$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.ringgroup.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'timeout\'].$error" ng-show="internalrouteFormApp[\'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.OPTIONS">Options</label>\n                <input type="text" name="options" ng-model="vm.ringgroup.options" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'options\'].$error" ng-show="internalrouteFormApp[\'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.ringgroup.url" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'url\'].$error" ng-show="internalrouteFormApp[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInternalRouteApp()" class="send-button md-accent md-raised" ng-disabled="internalrouteFormApp.$invalid || internalrouteFormApp.$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/views/internalroutes/edit/apps/set/dialog.html",'<md-dialog class="internalroute-dialog" aria-label="New InternalRoute">\n    <form name="internalrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.VARIABLE">Variable</label>\n                <md-select name="name" ng-model="vm.set.name" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                    <md-option ng-value="name.name" ng-repeat="name in vm.variables" ng-disabled="name.canSelect === false">{{ name.name }}</md-option>\n                </md-select>\n                <div ng-messages="internalrouteFormApp[\'name\'].$error" ng-show="internalrouteFormApp[\'name\'].$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.set.value" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'value\'].$error" ng-show="internalrouteFormApp[\'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>\n\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInternalRouteApp()" class="send-button md-accent md-raised" ng-disabled="internalrouteFormApp.$invalid || internalrouteFormApp.$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/views/internalroutes/edit/apps/voicemail/dialog.html",'<md-dialog class="internalroute-dialog" aria-label="New InternalRoute">\n    <form name="internalrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.MAILBOX@CONTEXT">Mailbox@Context</label>\n                <md-select name="voiceMail" ng-model="vm.voicemail.voiceMail" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                    <md-option ng-value="\'{{voiceMail.mailbox}}@from-voicemail\'" ng-repeat="voiceMail in vm.voiceMails" ng-disabled="voiceMail.canSelect === false">{{ voiceMail.mailbox }}</md-option>\n                </md-select>\n                <div ng-messages="internalrouteFormApp[\'voiceMail\'].$error" ng-show="internalrouteFormApp[\'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.voicemail.options" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="internalrouteFormApp[\'options\'].$error" ng-show="internalrouteFormApp[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveInternalRouteApp()" class="send-button md-accent md-raised" ng-disabled="internalrouteFormApp.$invalid || internalrouteFormApp.$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/views/internalroutes/edit/view.html",'<div id="voice-internalroute" 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-internalroutes-button md-icon-button" aria-label="Go to internalroutes" 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\n            <div layout="row" layout-align="start center">\n\n                <div class="internalroute-image" hide-xs>\n                    <img ng-src="assets/images/business/internalroutes.jpg">\n                </div>\n\n                <div layout="column" layout-align="start start">\n                    <div class="h2">\n                        #{{vm.internalroute.id}}\n                        <span ng-if="vm.internalroute.name">{{vm.internalroute.name}}</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\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="internalroute-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.PHONENUMBER">PhoneNumber</label>\n                                <input type="text" name="exten" ng-model="vm.internalroute.exten" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\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" 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.DESCRIPTION">Description</label>\n                                <input type="text" name="description" ng-model="vm.internalroute.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.ACTIONS">ACTIONS</span>\n                </md-tab-label>\n                <md-tab-body>\n                    <div class="internalroute-detail-form-container actions md-background-bg md-whiteframe-1dp">\n                        <div ng-controller="InternalRouteActionsController as vm_ac" ng-init="vm_ac.init(vm.internalroute, 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" ms-scroll 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="VOICE.{{(a.alias || a.appType) | uppercase}}">{{a.alias || 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" ms-scroll layout="column" flex="{{vm_ac.crudPermissions.canEdit ? 75 : 100}}">\n                                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_ac.selectedInternalRouteApps.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.selectedInternalRouteApps.length">\n                                    <div class="md-toolbar-tools">\n                                        <span class="md-subhead">{{vm_ac.selectedInternalRouteApps.length}} {{vm_ac.selectedInternalRouteApps.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.deleteSelectedInternalRouteApps($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\n                                \x3c!-- QUEUES TABLE --\x3e\n                                <md-table-container>\n                                    <table md-table md-row-select multiple ng-model="vm_ac.selectedInternalRouteApps">\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_ac.applications">\n                                            <tr md-row md-select="app" md-select-id="id" ng-repeat="app in vm_ac.internalrouteApps.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.editInternalRouteApp($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.editInternalRouteApp($event, $index)"><span class="text-truncate" style="width:200px">{{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.editInternalRouteApp($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.internalrouteApps.rows.length">\n                                                <td md-cell colspan="6">\n                                                    <span class="text-boxed-ligth" translate="VOICE.NO_APPS_AVAILABLE">No apps 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                                \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-tabs>\n\n    </div>\n    \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/voice/views/internalroutes/internalroutes.html",'<div id="internalroutes" 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.INTERNALROUTES">InternalRoutes</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.selectedInternalRoutes.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.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\n        <div flex layout="row" layout-align="space-between center">\n\n            <div>\n                <span class="selected-internalroutes-count">\n                    <span>{{vm.selectedInternalRoutes.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="INTERNALROUTES.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.selectAllInternalRoutes()" translate="VOICE.SELECT_ALL">\n                                Select all\n                            </md-button>\n                        </md-menu-item>\n                        <md-menu-item>\n                            <md-button ng-click="vm.deselectInternalRoutes()" 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.exportSelectedInternalRoutes" csv-label="true" filename="internalroutes.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="INTERNALROUTES.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!-- INTERNALROUTE TABLE --\x3e\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 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="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="internalroute" md-select-id="id" ng-repeat="internalroute in vm.internalroutes.rows">\n                                <td md-cell ng-if="internalroute.userpic"><img class="avatar" alt="{{internalroute.name}}" ng-src="api/users/{{internalroute.id}}/avatar" /></td>\n                                <td md-cell ng-if="!internalroute.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{internalroute.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(internalroute, ev) : vm.createOrEditInternalRoute($event, internalroute)" md-cell class="id ">{{internalroute.id}}</td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(internalroute, ev) : vm.createOrEditInternalRoute($event, internalroute)" md-cell class="exten ">{{internalroute.exten}}</td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(internalroute, ev) : vm.createOrEditInternalRoute($event, internalroute)" md-cell class="description ">{{internalroute.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.editstate(internalroute, $event)" 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(internalroute, $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\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></md-table-pagination>\n            </md-card>\n            \x3c!-- / INTERNALROUTE 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 INTERNALROUTE BUTTON --\x3e\n    <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-internalroute-button" ng-click="vm.createOrEditInternalRoute($event)" aria-label="add internalroute" translate translate-attr-aria-label="VOICE.ADD_INTERNALROUTE">\n        <md-icon md-font-icon="icon-plus"></md-icon>\n    </md-button>\n    \x3c!-- / ADD INTERNALROUTE BUTTON --\x3e\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 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="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 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="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                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300"></ms-search-bar>\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="MUSICONHOLDS.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.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">{{ \'VOICE.ID\' | translate }}</th>\n                                            <th md-column md-order-by="audio">{{ \'VOICE.AUDIO\' | translate }}</th>\n                                            <th md-column md-order-by="createdAt">{{ \'VOICE.CREATED_AT\' | translate }}</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>{{mohSound.id}}</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>{{mohSound.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="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 class="md-primary" ng-click="vm_dc.voiceMusicOnHoldDownload(mohSound, $event)" translate="VOICE.DOWNLOAD_MOHSOUND">\n                                                                Download MohSound\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(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                                                <span class="text-boxed-ligth" translate="VOICE.NO_MOHSOUND_AVAILABLE">No mohsound available</span>\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 animate-slide-down 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="MUSICONHOLDS.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="MUSICONHOLDS.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!-- 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                                <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.editstate(musiconhold, $event)" translate="VOICE.EDIT_MUSICONHOLD">\n                                                    Edit MusicOnHold\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(musiconhold, $event)" translate="VOICE.DELETE_MUSICONHOLD">\n                                                    Delete MusicOnHold\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.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 class="outboundroute-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.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.PHONENUMBER">PhoneNumber</label>\n                <input type="text" name="exten" ng-model="vm.outboundroute.exten" ng-required="true" autofocus>\n\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" 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" 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\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 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.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.outboundroute.description">\n\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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.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\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/apps/custom/dialog.html",'<md-dialog class="outboundroute-dialog" aria-label="New OutboundRoute">\n    <form name="outboundrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.APPLICATION_NAME">Application_Name</label>\n                <input type="text" name="app" ng-model="vm.custom.app" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="outboundrouteFormApp[\'app\'].$error" ng-show="outboundrouteFormApp[\'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.custom.appdata" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="outboundrouteFormApp[\'appdata\'].$error" ng-show="outboundrouteFormApp[\'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>\n\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveOutboundRouteApp()" class="send-button md-accent md-raised" ng-disabled="outboundrouteFormApp.$invalid || outboundrouteFormApp.$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/views/outboundroutes/edit/apps/interval/dialog.html",'<md-dialog class="inboundroute-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 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\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/voice/views/outboundroutes/edit/apps/outbounddial/dialog.html",'<md-dialog class="outboundroute-dialog" aria-label="New OutboundRoute">\n    <form name="outboundrouteFormApp" class="md-inline-form" novalidate>\n        <md-toolbar class="md-accent md-hue-2">\n            <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n                <span class="title">{{ vm.title | translate }}</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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="VOICE.TRUNK">Trunk</label>\n                <md-select name="trunk" ng-model="vm.outbounddial.trunk" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                    <md-option ng-value="trunk.name" ng-repeat="trunk in vm.trunks" ng-disabled="trunk.canSelect === false">{{ trunk.name }}</md-option>\n                </md-select>\n                <div ng-messages="outboundrouteFormApp[\'trunk\'].$error" ng-show="outboundrouteFormApp[\'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.outbounddial.callerID" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.CALLER_ID"></span></div>\n                <div ng-messages="outboundrouteFormApp[\'callerID\'].$error" ng-show="outboundrouteFormApp[\'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.outbounddial.prefix" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="outboundrouteFormApp[\'prefix\'].$error" ng-show="outboundrouteFormApp[\'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.outbounddial.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" ng-disabled="tag.canSelect === false">{{ tag.name }}</md-option>\n                </md-select>\n                <div ng-messages="outboundrouteFormApp[\'tag\'].$error" ng-show="outboundrouteFormApp[\'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.outbounddial.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="outboundrouteFormApp[\'timeout\'].$error" ng-show="outboundrouteFormApp[\'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.OPTIONS">Options</label>\n                <input type="text" name="options" ng-model="vm.outbounddial.options" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="outboundrouteFormApp[\'options\'].$error" ng-show="outboundrouteFormApp[\'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.outbounddial.url" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="outboundrouteFormApp[\'url\'].$error" ng-show="outboundrouteFormApp[\'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\n            <div class="error-list">\n                <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n                    <div>\n                        <span class="message">{{error.message}}</span>\n                        <span class="type">({{error.type}})</span>\n                    </div>\n                    <md-button class="md-icon-button">\n                        <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-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.saveOutboundRouteApp()" class="send-button md-accent md-raised" ng-disabled="outboundrouteFormApp.$invalid || outboundrouteFormApp.$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/views/outboundroutes/edit/view.html",'<div id="voice-outboundroute" 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-outboundroutes-button md-icon-button" aria-label="Go to outboundroutes" 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\n            <div layout="row" layout-align="start center">\n\n                <div class="outboundroute-image" hide-xs>\n                    <img ng-src="assets/images/business/outboundroutes.jpg">\n                </div>\n\n                <div layout="column" layout-align="start start">\n                    <div class="h2">\n                        #{{vm.outboundroute.id}}\n                        <span ng-if="vm.outboundroute.name">{{vm.outboundroute.name}}</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\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="outboundroute-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.PHONENUMBER">PhoneNumber</label>\n                                <input type="text" name="exten" ng-model="vm.outboundroute.exten" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\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" 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" 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 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.DESCRIPTION">Description</label>\n                                <input type="text" name="description" ng-model="vm.outboundroute.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.ACTIONS">ACTIONS</span>\n                </md-tab-label>\n                <md-tab-body>\n                    <div class="outboundroute-detail-form-container actions md-background-bg md-whiteframe-1dp">\n                        <div ng-controller="OutboundRouteActionsController as vm_ac" ng-init="vm_ac.init(vm.outboundroute, 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" ms-scroll 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="VOICE.{{(a.alias || a.appType) | uppercase}}">{{a.alias || 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" ms-scroll layout="column" flex="{{vm_ac.crudPermissions.canEdit ? 75 : 100}}">\n                                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_ac.selectedOutboundRouteApps.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.selectedOutboundRouteApps.length">\n                                    <div class="md-toolbar-tools">\n                                        <span class="md-subhead">{{vm_ac.selectedOutboundRouteApps.length}} {{vm_ac.selectedOutboundRouteApps.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.deleteSelectedOutboundRouteApps($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\n                                \x3c!-- QUEUES TABLE --\x3e\n                                <md-table-container>\n                                    <table md-table md-row-select multiple ng-model="vm_ac.selectedOutboundRouteApps">\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_ac.applications">\n                                            <tr md-row md-select="app" md-select-id="id" ng-repeat="app in vm_ac.outboundrouteApps.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.editOutboundRouteApp($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.editOutboundRouteApp($event, $index)"><span class="text-truncate" style="width:200px">{{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.editOutboundRouteApp($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.outboundrouteApps.rows.length">\n                                                <td md-cell colspan="6">\n                                                    <span class="text-boxed-ligth" translate="VOICE.NO_APPS_AVAILABLE">No apps 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                                \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-tabs>\n\n    </div>\n    \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/voice/views/outboundroutes/outboundroutes.html",'<div id="outboundroutes" 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.OUTBOUNDROUTES">OutboundRoutes</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.selectedOutboundRoutes.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.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\n        <div flex layout="row" layout-align="space-between center">\n\n            <div>\n                <span class="selected-outboundroutes-count">\n                    <span>{{vm.selectedOutboundRoutes.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="OUTBOUNDROUTES.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.selectAllOutboundRoutes()" translate="VOICE.SELECT_ALL">\n                                Select all\n                            </md-button>\n                        </md-menu-item>\n                        <md-menu-item>\n                            <md-button ng-click="vm.deselectOutboundRoutes()" 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.exportSelectedOutboundRoutes" csv-label="true" filename="outboundroutes.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="OUTBOUNDROUTES.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!-- OUTBOUNDROUTE TABLE --\x3e\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 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="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="outboundroute" md-select-id="id" ng-repeat="outboundroute in vm.outboundroutes.rows">\n                                <td md-cell ng-if="outboundroute.userpic"><img class="avatar" alt="{{outboundroute.name}}" ng-src="api/users/{{outboundroute.id}}/avatar" /></td>\n                                <td md-cell ng-if="!outboundroute.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{outboundroute.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(outboundroute, ev) : vm.createOrEditOutboundRoute($event, outboundroute)" md-cell class="id ">{{outboundroute.id}}</td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(outboundroute, ev) : vm.createOrEditOutboundRoute($event, outboundroute)" md-cell class="exten ">{{outboundroute.exten}}</td>\n                                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(outboundroute, ev) : vm.createOrEditOutboundRoute($event, outboundroute)" md-cell class="description ">{{outboundroute.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.editstate(outboundroute, $event)" 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(outboundroute, $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\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></md-table-pagination>\n            </md-card>\n            \x3c!-- / OUTBOUNDROUTE 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 OUTBOUNDROUTE BUTTON --\x3e\n    <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-outboundroute-button" ng-click="vm.createOrEditOutboundRoute($event)" aria-label="add outboundroute" translate translate-attr-aria-label="VOICE.ADD_OUTBOUNDROUTE">\n        <md-icon md-font-icon="icon-plus"></md-icon>\n    </md-button>\n    \x3c!-- / ADD OUTBOUNDROUTE BUTTON --\x3e\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.query.filter = query" on-collapse="vm.query.filter = undefined" debounce="300"></ms-search-bar>\n            <div flex></div>\n            <div class="padding-horizontal-20" layout="column" layout-align="center center">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_DATE">Select a date</span>\n                <div layout="row" layout-align="center center">\n                    <md-button ng-if="vm.pickerModel.dateStart" ng-click="vm.clearAll()" class="md-icon-button no-padding width-20 height-20">\n                        <md-tooltip>{{ \'DASHBOARDS.DELETE\' | translate }}</md-tooltip>\n                        <md-icon md-font-icon="icon-close" class="s16 black-fg"></md-icon>\n                    </md-button>\n                    <md-date-range localization-map="vm.localizationMap" ng-model="vm.pickerModel" auto-confirm="true" show-template="true" md-on-select="vm.getContacts()" placeholder="{{ \'DASHBOARDS.ALL\' | translate }}"></md-date-range>\n                </div>\n            </div>\n            <div class="padding-horizontal-20" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_AGENT">Select an agent</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.lastAssignedTo" ng-change="vm.getContacts()">\n                    <md-option ng-value="\'null\'" translate="DASHBOARDS.NOT_ASSIGNED"></md-option>\n                    <md-option ng-value="undefined" translate="DASHBOARDS.ALL"></md-option>\n                    <md-option ng-value="agent.name" ng-repeat="agent in vm.agents.rows">{{agent.name}}</md-option>\n                </md-select>\n            </div>\n            <div ng-if="vm.queues.count" layout="column">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_CAMPAIGN">Select a Campaign</span>\n                <md-select class="font-size-12 no-margin" ng-model="vm.query.queue" ng-change="vm.getContacts()">\n                    <md-option ng-value="undefined" ng-if="vm.queues.count > 1"><em translate="DASHBOARDS.ALL">All</em></md-option>\n                    <md-option ng-value="queue.name" ng-repeat="queue in vm.queues.rows">{{queue.name}}</md-option>\n                </md-select>\n            </div>\n            <md-button class="md-icon-button" ng-click="vm.refresh && 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 ng-if="vm.showTooltip" md-visible="vm.showTooltip">{{\'DASHBOARDS.CLICKRELOAD\' | 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.getContacts">\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 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 tranlsate="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 md-cell class="id">{{contact.id}}</td>\n                    <td md-cell class="firstName">{{contact.calleridname}}</td>\n                    <td md-cell class="list">{{contact.calleridnum}}</td>\n                    <td md-cell class="list">{{vm.queuesMap[contact.queue]}}</td>\n                    <td md-cell class="list">{{contact.queuecallerabandonAt ? (contact.queuecallerabandonAt | formatdate) : undefined }}</td>\n                    <td md-cell class="list">{{contact.lastAssignedTo}}</td>\n                    <td md-cell class="list">{{contact.disposition}}</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">Assigned a</md-button>\n                                        <md-menu-content>\n                                            <md-menu-item ng-if="contact.lastAssignedTo">\n                                                <md-button ng-click="vm.assignedA(contact)"><em translate="DASHBOARDS.NONE">Not Assigned</em></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.assignedA(contact,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-menu>\n                                        <md-button ng-click="$mdMenu.open()" class="text-capitalize" translate="DASHBOARDS.DISPOSE">Dispose</md-button>\n                                        <md-menu-content>\n                                            <md-menu-item ng-if="vm.dispositions.length > 0" ng-repeat="disposition in vm.dispositions">\n                                                <md-button ng-click="vm.disposed(contact, disposition.name)">{{disposition.name}}</md-button>\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\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>'),e.put("app/main/apps/voice/views/realtime/agents/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.AGENTS">Agents</span>\n        <div flex></div>\n        <ms-search-bar on-search="vm.query.filter = query; vm.onInit()" on-collapse="vm.query.filter = undefined; vm.onInit()" debounce="300"></ms-search-bar>\n        <md-select ng-model="vm.query.globalStatusFilter" class="md-caption" ng-change="vm.query.pauseTypeFilter = \'\'; vm.onInit()">\n            <md-option ng-value="\'\'">{{ \'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\n        <md-select ng-if="vm.isPause(vm.query.globalStatusFilter)" ng-model="vm.query.pauseTypeFilter" class="md-caption" ng-change="vm.onInit()">\n            <md-option ng-value="\'\'">All</md-option>\n            <md-option value="DEFAULT PAUSE">DEFAULT PAUSE</md-option>\n            <md-option value="ACW">ACW</md-option>\n            <md-option value="LOGININPAUSE">LOGININPAUSE</md-option>\n            <md-option value="Auto-Pause">AUTOPAUSE</md-option>\n            <md-option ng-value="pause.name" ng-repeat="pause in vm.pauses.rows">{{pause.name}}</md-option>\n        </md-select>\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.order" md-on-reorder="vm.onInit">\n            <tr md-row border="1">\n                <th class="bv text-center" colspan="4">{{ \'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">{{ \'OPENCHANNEL.OPENCHANNEL\' | translate }}</th>\n                <th ng-if="vm.license.fax" class="bv bl text-center" colspan="2">{{ \'FAX.FAX\' | translate }}</th>\n                <th width="10px" class="bt bl" rowspan="2"></th>\n            </tr>\n            <tr md-row>\n                <th class="bl" md-column md-order-by="fullname">{{ \'VOICE.NAME\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="globalStatus">{{ \'VOICE.STATUS\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="lastLoginAt">{{ \'VOICE.LOGIN_TIME\' | translate }}</th>\n                <th class="bl custom-column" md-column md-order-by="lastPauseAt">{{ \'VOICE.PAUSE_TIME\' | translate }}</th>\n\n                <th class="bl custom-column">{{ \'VOICE.STATUS\' | translate }}</th>\n                <th class="bl custom-column">Info</th>\n\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\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\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\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\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            </tr>\n        </thead>\n        <tbody md-body>\n            <tr md-row ng-hide="vm.order.length">\n                <td md-cell colspan="17">\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="vm.agents[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td class="bt padding-5">\n                    <div layout="row" layout-align="start center">\n                        <img class="avatar" ng-src="{{vm.agents[value].userpic && \'api/users/\'+vm.agents[value].id+\'/avatar\' || \'assets/images/avatars/profile.png\'}}">\n                        <div layout="column">\n                            <span>{{vm.agents[value].fullname}}</span>\n                            <span>{{vm.agents[value].internal}}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class="bt">\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'}[vm.agents[value].globalStatus]\">{{ vm.isPause(vm.agents[value].globalStatus) ? '' : vm.agents[value].globalStatus | uppercase }} {{ vm.isPause(vm.agents[value].globalStatus) ? (vm.isPartialPause(vm.agents[value].globalStatus) ? '*'+vm.agents[value].pauseType || 'DEFAULT PAUSE'  : vm.agents[value].pauseType || 'DEFAULT PAUSE') : ''}}</span>\n                </td>\n                <td class=\"bt custom-column\">\n                    <timer start-time=\"vm.agents[value].lastLoginAt\" interval=\"1000\">{{ days > 0 ? days + 'd' : '' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                </td>\n                <td class=\"bt custom-column\">\n                    <timer ng-if=\"vm.isPause(vm.agents[value].globalStatus) || vm.isPartialPause(vm.agents[value].globalStatus)\" start-time=\"vm.agents[value].lastPauseAt\" interval=\"1000\">{{ days > 0 ? days + 'd' : '' }} {{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                </td>\n                <td class=\"bt bl\">\n                    <div layout=\"row\">\n                        <span ng-if=\"!vm.agents[value].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'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].voiceStatus | uppercase }}</span>\n                        <span ng-if=\"vm.agents[value].onhold\" class=\"text-boxed md-background-bg bl bt padding-5 orange-400-bg\">ONHOLD</span>\n                    </div>\n                </td>\n                <td class=\"bt bl\">\n                    <div layout=\"column\">\n                        <span ng-if=\"vm.agents[value].queue\" class=\"padding-5\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].queue }}</span>\n                        <span ng-if=\"vm.agents[value].destconnectedlinenum\" class=\"padding-5\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{ vm.agents[value].destconnectedlinenum }}</span>\n                        <span class=\"padding-5\" ng-if=\"vm.agents[value].queue || vm.agents[value].destconnectedlinenum\">\n                            <timer start-time=\"vm.agents[value].voiceStatusTime\" interval=\"1000\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].voiceStatus]\">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                        </span>\n                    </div>\n                </td>\n                <td class=\"bt bl\" ng-if=\"vm.license.chat\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].chatStatus]\">{{ vm.agents[value].chatStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td md-number class=\"bt text-center font-size-20\" ng-if=\"vm.license.chat\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].chatStatus]\">{{ vm.agents[value].chatCurrentCapacity }}</td>\n                <td class=\"bl bt\" ng-if=\"vm.license.mail\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].mailStatus]\">{{ vm.agents[value].mailStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.mail\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].mailStatus]\">{{ vm.agents[value].mailCurrentCapacity }}</td>\n                <td class=\"bl bt\" ng-if=\"vm.license.messaging\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].smsStatus]\">{{ vm.agents[value].smsStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.messaging\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].smsStatus]\">{{ vm.agents[value].smsCurrentCapacity }}</td>\n                <td class=\"bt bl\" ng-if=\"vm.license.openchannel\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].openchannelStatus]\">{{ vm.agents[value].openchannelStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.openchannel\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].openchannelStatus]\">{{ vm.agents[value].openchannelCurrentCapacity }}</td>\n                <td class=\"bt bl\" ng-if=\"vm.license.fax\">\n                    <div layout=\"row\">\n                        <div layout=\"column\" layout-align=\"center center\">\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'}[vm.agents[value].faxStatus]\">{{ vm.agents[value].faxStatus | uppercase }}</span>\n                        </div>\n                    </div>\n                </td>\n                <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.fax\" ng-class=\"{'idle':'lime-300-fg','maxcapacity':'red-A200-fg','working':'indigo-100-fg','pause':'amber-200-fg'}[vm.agents[value].faxStatus]\">{{ vm.agents[value].faxCurrentCapacity }}</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\n                        <md-menu-content width=\"4\">\n                            <md-menu-item>\n                                <md-button ng-click=\"vm.logout(vm.agents[value], $event)\" translate=\"VOICE.LOGOUT\">\n                                    Logout\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-button ng-click=\"vm.queueAdd(vm.agents[value], $event)\" translate=\"VOICE.AGENTADD_QUEUE\">\n                                    Add Agent In Queue\n                                </md-button>\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=\" vm.agents[value].voicePause && 'DEFAULT PAUSE' === vm.agents[value].pauseType\" ng-click=\"vm.pause(vm.agents[value])\"><em translate=\"VOICE.DEFAULT_PAUSE\">Default Pause</em></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=\"vm.agents[value].voicePause && pause.name === vm.agents[value].pauseType\" ng-click=\"vm.pause(vm.agents[value], pause.name)\">{{pause.name}}</md-button>\n                                        </md-menu-item>\n                                    </md-menu-content>\n                                </md-menu>\n                            </md-menu-item>\n                            <md-menu-item ng-if=\"vm.isPause(vm.agents[value].globalStatus)\">\n                                <md-button ng-click=\"vm.unPause(vm.agents[value])\" 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\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.filteredAgents.length}}\" md-on-paginate=\"vm.onInit\" md-page-select></md-table-pagination>\n\x3c!-- / AGENT TABLE --\x3e\n\x3c!-- / MAIN --\x3e"),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 flex></div>\n        <ms-search-bar on-search="vm.query.filter = query;" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\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.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="4">\n                    <div layout="row" layout-align="center center">\n                        <span tranlsate="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>\n                    {{call.calleridname}}, {{call.calleridnum}} <span class="text-boxed" ng-if="call.answered">\n                        <timer ng-if="call.answertime" start-time="call.answertime" interval="1000">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                    </span>\n                </td>\n                <td md-cell>{{call.exten}}</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" interval="1000">{{hhours}}:{{mminutes}}:{{sseconds}}</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_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        \x3c!-- <div flex></div>\n    <ms-search-bar on-search="vm.query.filter = query;" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar> --\x3e\n    </div>\n</md-toolbar>\n\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 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.getSize(vm.rpcVoiceQueuesChannels)">\n                <td md-cell colspan="6">\n                    <div layout="row" layout-align="center center">\n                        <span tranlsate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-row ng-repeat="(key, channel) in vm.rpcVoiceQueuesChannels | limitObjectFromTo: vm.queryChannels.limit:(vm.queryChannels.page - 1) * vm.queryChannels.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 md-cell>{{channel.queue}}</td>\n                <td md-cell>{{channel.calleridnum}}</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" interval="1000">{{hhours}}:{{mminutes}}:{{sseconds}}</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" interval="1000">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>\n                    </span>\n                </td>\n                <td md-cell>\n                    <span class="text-boxed">\n                        <timer start-time="channel.queuecallerjoinAt" interval="1000">{{hhours}}:{{mminutes}}:{{sseconds}}</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\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>\n                                    <md-button ng-click="$mdMenu.open()" translate="VOICE.REDIRECT_TO_AGENT">Redirect to Agent</md-button>\n                                    <md-menu-content>\n                                        <md-menu-item ng-repeat="agent in vm.agents.rows">\n                                            <md-button ng-click="vm.redirectToAgent(channel.uniqueid, agent.name, agent.context)">{{agent.name}}</md-button>\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\n<md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.queryChannels.limit" md-page="vm.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm.getSize(vm.rpcVoiceQueuesChannels)}}" md-page-select></md-table-pagination>\n\x3c!-- / QUEUES 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.query.filter = 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>{{\'\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">\n                <td md-cell colspan="8">\n                    <div layout="row" layout-align="center center">\n                        <span tranlsate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-row ng-repeat="(id, queue) in vm.queues">\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.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/queues/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.QUEUES">Queues</span>\n        <div flex></div>\n        <ms-search-bar on-search="vm.query.filter = 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">{{ \'VOICE.NAME\' | translate }}</th>\n                <th md-column>{{ \'VOICE.LOGGED_IN\' | translate }}</th>\n                <th md-column>{{ \'VOICE.PAUSED\' | translate }}</th>\n                <th md-column>{{ \'VOICE.READY\' | translate }}</th>\n                <th md-column>{{ \'VOICE.WAITING\' | translate }}</th>\n                <th md-column>{{ \'VOICE.TALKING\' | translate }}</th>\n                <th md-column width="10px"></th>\n            </tr>\n        </thead>\n        <tbody md-body>\n            <tr md-row ng-hide="vm.queues">\n                <td md-cell colspan="7">\n                    <div layout="row" layout-align="center center">\n                        <span tranlsate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                </td>\n            </tr>\n            <tr md-row md-select="vm.queues[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n                <td md-cell>{{vm.queues[value].name}}</td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].loggedInDb || 0}} ({{vm.queues[value].loggedIn || 0}})</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].paused || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-16 grey-fg">{{vm.queues[value].available || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-20 grey-fg">{{vm.queues[value].waiting || 0}}</span>\n                </td>\n                <td md-cell>\n                    <span class="font-size-16 grey-fg">{{(vm.queues[value].talking || 0) }}</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="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.createOrEditVoiceQueue($event, vm.queues[value])" translate="VOICE.EDIT_QUEUE">\n                                    Edit Queue\n                                </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                                <md-button ng-click="vm.agentAdd($event, vm.queues[value])" translate="VOICE.AGENTSADD_QUEUE">\n                                    Add Agents to queue\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.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.query.filter = query;" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n        \x3c!-- <md-button class="md-icon-button" ng-click="vm.showInfo($event)">\n            <i class="icon-information-outline grey-600-fg">\n              <md-tooltip>{{\'VOICE.INFO\' | translate}}</md-tooltip>\n            </i>\n        </md-button> --\x3e\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 tranlsate="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.query.filter = query;" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n        \x3c!-- <md-button class="md-icon-button" ng-click="vm.showInfo($event)">\n      <i class="icon-information-outline grey-600-fg">\n        <md-tooltip>{{\'FAX.INFO\' | translate}}</md-tooltip>\n      </i>\n    </md-button> --\x3e\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>\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 tranlsate="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 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="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                                    <div flex></div>\n                                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.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_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="VOICEMAILS.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.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">{{ \'VOICE.ID\' | translate }}</th>\n                                            <th md-column md-order-by="callerid">{{ \'VOICE.CALLER_ID\' | translate }}</th>\n                                            <th md-column md-order-by="duration">{{ \'VOICE.DURATION\' | translate }}</th>\n                                            <th md-column md-order-by="audio">{{ \'VOICE.AUDIO\' | translate }}</th>\n                                            <th md-column md-order-by="stamp">{{ \'VOICE.RECEIVED_AT\' | translate }}</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>{{message.id}}</td>\n                                            <td md-cell>{{message.callerid}}</td>\n                                            <td md-cell>{{message.duration}}</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>{{message.stamp | 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="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 class="md-primary" ng-click="vm_dc.voiceMailMessageDownload(message, $event)" translate="VOICE.DOWNLOAD_MESSAGE">\n                                                                Download Message\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(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                                                <span class="text-boxed-ligth" translate="VOICE.NO_MESSAGE_AVAILABLE">No message available</span>\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 animate-slide-down 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="VOICEMAILS.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="VOICEMAILS.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!-- 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                                <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.editstate(voicemail, $event)" translate="VOICE.EDIT_VOICEMAIL">\n                                                    Edit Voicemail\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(voicemail, $event)" translate="VOICE.DELETE_VOICEMAIL">\n                                                    Delete Voicemail\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.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 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="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"></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/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 animate-slide-down 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="VOICEPREFIXES.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="VOICEPREFIXES.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!-- 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})[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                                <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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editdialog(voicePrefix, $event)" translate="VOICE.EDIT_VOICEPREFIX">\n                                                    Edit voicePrefix\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.agentadddialog(voicePrefix, $event)" translate="VOICE.AGENTADD_VOICEPREFIX">\n                                                    AgentAdd voicePrefix\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(voicePrefix, $event)" translate="VOICE.DELETE_VOICEPREFIX">\n                                                    Delete voicePrefix\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.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 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="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" ng-model="vm.penalty" placeholder="0" required md-minlength="0" md-maxlength="3">\n                <div ng-messages="voiceQueueForm.penalty.$error" role="alert" multiple>\n                    <div ng-message="required">\n                        <span>You must supply a penalty.</span>\n                    </div>\n                    <div ng-message="md-minlength">\n                        <span>Min Penalty 0 characters.</span>\n                    </div>\n                    <div ng-message="md-maxlength">\n                        <span>Max Penalty 3 characters.</span>\n                    </div>\n                </div>\n            </md-input-container>\n            <ms-dual-multiselect options="vm.dualMultiselectOptions"></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" ng-model="vm.penalty" placeholder="0" required md-minlength="0" md-maxlength="3">\n                <div ng-messages="voiceQueueForm.penalty.$error" role="alert" multiple>\n                    <div ng-message="required">\n                        <span>You must supply a penalty.</span>\n                    </div>\n                    <div ng-message="md-minlength">\n                        <span>Min Penalty 0 characters.</span>\n                    </div>\n                    <div ng-message="md-maxlength">\n                        <span>Max Penalty 3 characters.</span>\n                    </div>\n                </div>\n            </md-input-container>\n            <ms-dual-multiselect options="vm.dualMultiselectOptions"></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" 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" 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\'">no</md-option>\n                                    <md-option ng-value="\'yes\'">yes</md-option>\n                                    <md-option ng-value="\'strict\'">strict</md-option>\n                                    <md-option ng-value="\'loose\'">loose</md-option>\n                                    <md-option ng-value="\'paused\'">paused</md-option>\n                                    <md-option ng-value="\'penalty\'">penalty</md-option>\n                                    <md-option ng-value="\'inuse\'">inuse</md-option>\n                                    <md-option ng-value="\'ringing\'">ringing</md-option>\n                                    <md-option ng-value="\'unavailable\'">unavailable</md-option>\n                                    <md-option ng-value="\'invalid\'">invalid</md-option>\n                                    <md-option ng-value="\'unknown\'">unknown</md-option>\n                                    <md-option ng-value="\'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\'">no</md-option>\n                                    <md-option ng-value="\'yes\'">yes</md-option>\n                                    <md-option ng-value="\'strict\'">strict</md-option>\n                                    <md-option ng-value="\'loose\'">loose</md-option>\n                                    <md-option ng-value="\'paused\'">paused</md-option>\n                                    <md-option ng-value="\'penalty\'">penalty</md-option>\n                                    <md-option ng-value="\'inuse\'">inuse</md-option>\n                                    <md-option ng-value="\'ringing\'">ringing</md-option>\n                                    <md-option ng-value="\'unavailable\'">unavailable</md-option>\n                                    <md-option ng-value="\'invalid\'">invalid</md-option>\n                                    <md-option ng-value="\'unknown\'">unknown</md-option>\n                                    <md-option ng-value="\'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                                <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 animate-slide-down 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="VOICEQUEUES.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="VOICEQUEUES.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!-- 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                                <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                                        <md-menu-content width="3">\n                                            <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                                <md-button ng-click="vm.editstate(voiceQueue, $event)" translate="VOICE.EDIT_VOICEQUEUE">\n                                                    Edit VoiceQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.teamadddialog(voiceQueue, $event)" translate="VOICE.TEAMADD_VOICEQUEUE">\n                                                    teamadd VoiceQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.agentadddialog(voiceQueue, $event)" translate="VOICE.AGENTADD_VOICEQUEUE">\n                                                    agentadd VoiceQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(voiceQueue, $event)" translate="VOICE.DELETE_VOICEQUEUE">\n                                                    Delete VoiceQueue\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.gotorealtimegoto(voiceQueue, $event)" translate="VOICE.GOTOREALTIME_VOICEQUEUE">\n                                                    goToRealtime VoiceQueue\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.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 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="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/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            \x3c!-- DATE FILTER --\x3e\n            <div class="padding-horizontal-20" layout="column" layout-align="center center">\n                <span class="font-size-10" translate="DASHBOARDS.SELECT_DATE_RANGE">Select Date Range</span>\n                <div layout="row" layout-align="center center">\n                    <md-button ng-if="vm.pickerModel.dateStart" ng-click="vm.clearDateFilter()" class="md-icon-button no-padding width-20 height-20">\n                        <md-tooltip>{{ \'DASHBOARDS.CLEAR\' | translate }}</md-tooltip>\n                        <md-icon md-font-icon="icon-close" class="s16 white-fg"></md-icon>\n                    </md-button>\n                    <md-date-range localization-map="vm.localizationMap" ng-model="vm.pickerModel" auto-confirm="true" show-template="true" md-on-select="vm.getVoiceRecordings()" placeholder="{{ \'DASHBOARDS.ALL\' | translate }}"></md-date-range>\n                </div>\n            </div>\n            \x3c!-- /DATE FILTER --\x3e\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 animate-slide-down 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="VOICERECORDINGS.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.crudPermissions.canDelete" ng-click="vm.deleteSelectedVoiceRecordings($event)" aria-label="delete selected" translate translate-attr-label="VOICERECORDINGS.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!-- 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 md-order-by="audio">{{ \'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 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="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 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.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="type ">{{voiceRecording.type}}</td>\n                                <td ng-click="vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="uniqueid ">{{voiceRecording.uniqueid}}</td>\n                                <td ng-click="vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="calleridnum ">{{voiceRecording.calleridnum}}</td>\n                                <td ng-click="vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="exten ">{{voiceRecording.exten}}</td>\n                                <td ng-click="vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="connectedlinenum ">{{voiceRecording.connectedlinenum}}</td>\n                                <td ng-click="vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="queue ">{{voiceRecording.queue}}</td>\n                                <td ng-click="vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="membername ">{{voiceRecording.membername}}</td>\n                                <td ng-click="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"></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.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="createdAt ">{{voiceRecording.createdAt | date:\'medium\' }}</td>\n                                <td ng-click="vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="userDisposition ">{{voiceRecording.userDisposition}}</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                                        <md-menu-content width="3">\n                                            <md-menu-item>\n                                                <md-button ng-click="vm.downloadfile2(voiceRecording, $event)" translate="VOICE.DOWNLOAD_VOICERECORDING">\n                                                    Download VoiceRecording\n                                                </md-button>\n                                            </md-menu-item>\n                                            <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                                <md-button ng-click="vm.deleteconfirm(voiceRecording, $event)" translate="VOICE.DELETE_VOICERECORDING">\n                                                    Delete VoiceRecording\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.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/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-scroll="vm.msScrollOptions"></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-scroll="vm.msScrollOptions"></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" ms-scroll 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" ms-scroll 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" ms-scroll 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 animate-slide-left" ng-hide="vm_ct.user">\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" placeholder="Search by fullname.." 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" <md-option ng-value="undefined">All</md-option>\n                <md-option ng-value="true">\n                    <md-icon md-font-icon="icon-checkbox-blank-circle" class="s12 green-fg"></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"></md-icon>Offline\n                </md-option>\n            </md-select>\n        </div>\n    </md-subheader>\n    \x3c!-- <select ng-model="vm_ct.filterOnline" class="height-50 no-padding no-margin">\n            <option ng-value="undefined">All</option>\n            <option ng-value="true"><md-icon md-font-icon="icon-checkbox-blank-circle" class="s12 green-fg"></md-icon>Online</option>\n            <option ng-value="false"><md-icon md-font-icon="icon-checkbox-blank-circle" class="s12 red-fg"></md-icon>Offline</option>\n        </select> --\x3e\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.toggleChat(user)">\n            <md-divider></md-divider>\n            <img ng-src="{{user.userpic ? \'api/users/\' + user.id + \'/avatar\' : \'assets/images/avatars/profile.png\'}}" 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.unreadMessage[user.id]" class="md-accent-bg unread-message-count">\n                {{vm_ct.unreadMessage[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"></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.read && user.lastMessage.FromId === vm_ct.currentUser.id" class="s16 no-margin" md-font-icon="icon-check"></md-icon>\n                    <md-icon ng-if="user.lastMessage.read && user.lastMessage.FromId === vm_ct.currentUser.id" class="s16 no-margin" md-font-icon="icon-check-all md-accent"></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            </div>\n        </md-list-item>\n    </md-list>\n</div>\n\n<div class="chat animate-slide-right" ng-show="vm_ct.user" 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.toggleChat()" 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 layout="row" ng-repeat="message in vm_ct.user.messages.rows" class="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\' : \'assets/images/avatars/profile.png\'}}" class="avatar" alt="{{vm_ct.user.fullname}}" />\n            <img ng-if="message.FromId === vm_ct.currentUser.id" class="avatar" ng-src="{{vm_ct.currentUser.userpic ? \'api/users/\' + vm_ct.currentUser.id + \'/avatar\' : \'assets/images/avatars/profile.png\'}}">\n            <div class="bubble" 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.read && message.FromId === vm_ct.currentUser.id" class="s16 margin-5" md-font-icon="icon-check"></md-icon>\n                    <md-icon ng-if="message.read && message.FromId === vm_ct.currentUser.id" class="s16 margin-5" md-font-icon="icon-check-all md-accent"></md-icon>\n                </div>\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\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 ms-scroll>\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 animate-slide-left" 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 animate-slide-right" 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 ms-scroll 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 ms-scroll>\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()" ms-scroll>\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/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 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="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.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>\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>\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() | 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" 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"></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">{{ days > 0 ? days + \'d\' : \'\' }} {{hhours}}:{{mminutes}}:{{sseconds}}</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">{{ days > 0 ? days + \'d\' : \'\' }} {{hhours}}:{{mminutes}}:{{sseconds}}</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 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.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">{{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        <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 translate="{{lang.translation}}">{{lang.title}}</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">{{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">Preview</span>\n                <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n                    <md-icon 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 layout="row" ng-if="vm.preview">\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                </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 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-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-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 a5ad333..d7b3f7b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf494=['STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','sequelize','exports','VIRTUAL','getDataValue','action'];(function(_0x2e4a6c,_0x3e3df7){var _0x47bd95=function(_0x287b2b){while(--_0x287b2b){_0x2e4a6c['push'](_0x2e4a6c['shift']());}};_0x47bd95(++_0x3e3df7);}(_0xf494,0x1c6));var _0x4f49=function(_0xebedaf,_0x20fc45){_0xebedaf=_0xebedaf-0x0;var _0x828eef=_0xf494[_0xebedaf];return _0x828eef;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'name':{'type':Sequelize[_0x4f49('0x2')],'get':function(_0x52d22c){return this[_0x4f49('0x3')](_0x4f49('0x4'));}},'action':{'type':Sequelize[_0x4f49('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x4f49('0x6'),_0x4f49('0x7'),_0x4f49('0x8'),_0x4f49('0x9'),_0x4f49('0xa'),_0x4f49('0xb'),_0x4f49('0xc')]],'msg':_0x4f49('0xd')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x4f49('0xe')},'data2':{'type':Sequelize[_0x4f49('0x5')](0x1000),'comment':_0x4f49('0xf')},'data3':{'type':Sequelize[_0x4f49('0x5')](0x1000),'comment':_0x4f49('0x10')},'data4':{'type':Sequelize[_0x4f49('0x5')](0x1000)},'data5':{'type':Sequelize[_0x4f49('0x5')](0x1000)},'data6':{'type':Sequelize[_0x4f49('0x5')]},'data7':{'type':Sequelize['TEXT']}};
\ No newline at end of file
+var _0x8ef6=['Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','VIRTUAL','getDataValue','action','STRING','integration','motionbar','jscripty','urlForward'];(function(_0x4c16c9,_0x4e79e0){var _0x4cffad=function(_0x32d74c){while(--_0x32d74c){_0x4c16c9['push'](_0x4c16c9['shift']());}};_0x4cffad(++_0x4e79e0);}(_0x8ef6,0xf2));var _0x68ef=function(_0x39fec2,_0x500f05){_0x39fec2=_0x39fec2-0x0;var _0x4808f2=_0x8ef6[_0x39fec2];return _0x4808f2;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'name':{'type':Sequelize[_0x68ef('0x2')],'get':function(_0x279e08){return this[_0x68ef('0x3')](_0x68ef('0x4'));}},'action':{'type':Sequelize[_0x68ef('0x5')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x68ef('0x6'),_0x68ef('0x7'),_0x68ef('0x8'),_0x68ef('0x9'),'browser','bot']],'msg':_0x68ef('0xa')}},'comment':_0x68ef('0xa')},'data1':{'type':Sequelize[_0x68ef('0x5')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize[_0x68ef('0x5')](0x1000),'comment':_0x68ef('0xb')},'data3':{'type':Sequelize[_0x68ef('0x5')](0x1000),'comment':_0x68ef('0xc')},'data4':{'type':Sequelize[_0x68ef('0x5')](0x1000)},'data5':{'type':Sequelize[_0x68ef('0x5')](0x1000)},'data6':{'type':Sequelize[_0x68ef('0x5')]},'data7':{'type':Sequelize[_0x68ef('0xd')]}};
\ No newline at end of file
index 9681d27..b9b53a7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x102c=['querystring','papaparse','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','error','stack','name','body','Action','find','catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','desk.js'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0x102c,0xbc));var _0xc102=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x102c[_0x31cb5f];return _0x586042;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc102('0x0'));var jsonpatch=require(_0xc102('0x1'));var rp=require(_0xc102('0x2'));var moment=require(_0xc102('0x3'));var BPromise=require(_0xc102('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc102('0x5'));var sox=require(_0xc102('0x6'));var csv=require(_0xc102('0x7'));var ejs=require(_0xc102('0x8'));var fs=require('fs');var _=require(_0xc102('0x9'));var squel=require(_0xc102('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc102('0xb'));var toCsv=require(_0xc102('0x7'));var querystring=require(_0xc102('0xc'));var Papa=require(_0xc102('0xd'));var authService=require('../../components/auth/service');var hardwareService=require(_0xc102('0xe'));var Redis=require('ioredis');var qs=require(_0xc102('0xf'));var logger=require(_0xc102('0x10'))(_0xc102('0x11'));var utils=require(_0xc102('0x12'));var config=require(_0xc102('0x13'));var db=require(_0xc102('0x14'))['db'];function respondWithStatusCode(_0x198df6,_0x58519e){_0x58519e=_0x58519e||0xcc;return function(_0x211833){if(_0x211833){return _0x198df6['sendStatus'](_0x58519e);}return _0x198df6[_0xc102('0x15')](_0x58519e)[_0xc102('0x16')]();};}function respondWithResult(_0x1cc6ab,_0x1db166){_0x1db166=_0x1db166||0xc8;return function(_0x5a08a4){if(_0x5a08a4){return _0x1cc6ab[_0xc102('0x15')](_0x1db166)[_0xc102('0x17')](_0x5a08a4);}};}function respondWithFilteredResult(_0x267572,_0x26210b){return function(_0x56124e){if(_0x56124e){var _0x229f33=_0x56124e[_0xc102('0x18')],_0x3d1766=_0x26210b[_0xc102('0x19')],_0x2fd426=_0x26210b[_0xc102('0x19')]+_0x26210b[_0xc102('0x1a')],_0x4d44cc;if(_0x2fd426>=_0x229f33){_0x2fd426=_0x229f33;_0x4d44cc=0xc8;}else{_0x4d44cc=0xce;}_0x267572[_0xc102('0x15')](_0x4d44cc);return _0x267572[_0xc102('0x1b')](_0xc102('0x1c'),_0x3d1766+'-'+_0x2fd426+'/'+_0x229f33)[_0xc102('0x17')](_0x56124e);}return null;};}function patchUpdates(_0x41be07){return function(_0x26b890){try{jsonpatch['apply'](_0x26b890,_0x41be07,!![]);}catch(_0x410169){return BPromise[_0xc102('0x1d')](_0x410169);}return _0x26b890[_0xc102('0x1e')]();};}function saveUpdates(_0x2f58ac,_0x165c8c){return function(_0x2e9f0d){if(_0x2e9f0d){return _0x2e9f0d[_0xc102('0x1f')](_0x2f58ac)[_0xc102('0x20')](function(_0x2c32bf){return _0x2c32bf;});}return null;};}function removeEntity(_0x50a88c,_0x27e905){return function(_0x3eeb7c){if(_0x3eeb7c){return _0x3eeb7c['destroy']()[_0xc102('0x20')](function(){_0x50a88c[_0xc102('0x15')](0xcc)[_0xc102('0x16')]();});}};}function handleEntityNotFound(_0x12c2f4,_0x55e0ff){return function(_0x3772d1){if(!_0x3772d1){_0x12c2f4['sendStatus'](0x194);}return _0x3772d1;};}function handleError(_0x5a331a,_0x2e8fb7){_0x2e8fb7=_0x2e8fb7||0x1f4;return function(_0x498abc){logger[_0xc102('0x21')](_0x498abc[_0xc102('0x22')]);if(_0x498abc[_0xc102('0x23')]){delete _0x498abc[_0xc102('0x23')];}_0x5a331a[_0xc102('0x15')](_0x2e8fb7)['send'](_0x498abc);};}exports[_0xc102('0x1f')]=function(_0x1d8241,_0x3c958b){if(_0x1d8241[_0xc102('0x24')]['id']){delete _0x1d8241[_0xc102('0x24')]['id'];}return db[_0xc102('0x25')][_0xc102('0x26')]({'where':{'id':_0x1d8241['params']['id']}})[_0xc102('0x20')](handleEntityNotFound(_0x3c958b,null))['then'](saveUpdates(_0x1d8241[_0xc102('0x24')],null))[_0xc102('0x20')](respondWithResult(_0x3c958b,null))[_0xc102('0x27')](handleError(_0x3c958b,null));};exports['destroy']=function(_0x53ec90,_0x5d2d94){return db[_0xc102('0x25')][_0xc102('0x26')]({'where':{'id':_0x53ec90['params']['id']}})[_0xc102('0x20')](handleEntityNotFound(_0x5d2d94,null))['then'](removeEntity(_0x5d2d94,null))[_0xc102('0x27')](handleError(_0x5d2d94,null));};
\ No newline at end of file
+var _0x1fe4=['save','update','destroy','then','end','stack','name','send','body','params','catch','Action','html-pdf','eml-format','rimraf','zip-dir','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject'];(function(_0x59d4bf,_0x22b6ab){var _0x1b2f3d=function(_0x4e68de){while(--_0x4e68de){_0x59d4bf['push'](_0x59d4bf['shift']());}};_0x1b2f3d(++_0x22b6ab);}(_0x1fe4,0x16c));var _0x41fe=function(_0x5751e6,_0x125e5e){_0x5751e6=_0x5751e6-0x0;var _0x4199e4=_0x1fe4[_0x5751e6];return _0x4199e4;};'use strict';var pdf=require(_0x41fe('0x0'));var emlformat=require(_0x41fe('0x1'));var rimraf=require(_0x41fe('0x2'));var zipdir=require(_0x41fe('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x41fe('0x4'));var Mustache=require('mustache');var util=require(_0x41fe('0x5'));var path=require(_0x41fe('0x6'));var sox=require(_0x41fe('0x7'));var csv=require(_0x41fe('0x8'));var ejs=require(_0x41fe('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x41fe('0xa'));var crypto=require(_0x41fe('0xb'));var jsforce=require(_0x41fe('0xc'));var deskjs=require(_0x41fe('0xd'));var toCsv=require(_0x41fe('0x8'));var querystring=require(_0x41fe('0xe'));var Papa=require(_0x41fe('0xf'));var authService=require(_0x41fe('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x41fe('0x11'));var qs=require(_0x41fe('0x12'));var logger=require(_0x41fe('0x13'))('api');var utils=require(_0x41fe('0x14'));var config=require(_0x41fe('0x15'));var db=require(_0x41fe('0x16'))['db'];function respondWithStatusCode(_0x40f2e5,_0x4d2928){_0x4d2928=_0x4d2928||0xcc;return function(_0x5f1bf9){if(_0x5f1bf9){return _0x40f2e5[_0x41fe('0x17')](_0x4d2928);}return _0x40f2e5[_0x41fe('0x18')](_0x4d2928)['end']();};}function respondWithResult(_0x47ce58,_0x5ca3d6){_0x5ca3d6=_0x5ca3d6||0xc8;return function(_0x5841da){if(_0x5841da){return _0x47ce58[_0x41fe('0x18')](_0x5ca3d6)[_0x41fe('0x19')](_0x5841da);}};}function respondWithFilteredResult(_0x44ce25,_0x1929dd){return function(_0x15613e){if(_0x15613e){var _0x16abe2=_0x15613e[_0x41fe('0x1a')],_0x2163ee=_0x1929dd[_0x41fe('0x1b')],_0x560447=_0x1929dd[_0x41fe('0x1b')]+_0x1929dd['limit'],_0x227da8;if(_0x560447>=_0x16abe2){_0x560447=_0x16abe2;_0x227da8=0xc8;}else{_0x227da8=0xce;}_0x44ce25[_0x41fe('0x18')](_0x227da8);return _0x44ce25[_0x41fe('0x1c')](_0x41fe('0x1d'),_0x2163ee+'-'+_0x560447+'/'+_0x16abe2)[_0x41fe('0x19')](_0x15613e);}return null;};}function patchUpdates(_0x39d7a9){return function(_0x27ee72){try{jsonpatch[_0x41fe('0x1e')](_0x27ee72,_0x39d7a9,!![]);}catch(_0x4fe379){return BPromise[_0x41fe('0x1f')](_0x4fe379);}return _0x27ee72[_0x41fe('0x20')]();};}function saveUpdates(_0x4eb293,_0x30fb60){return function(_0x305d2e){if(_0x305d2e){return _0x305d2e[_0x41fe('0x21')](_0x4eb293)['then'](function(_0x106b59){return _0x106b59;});}return null;};}function removeEntity(_0x6f3ac,_0x4b0282){return function(_0x32b16a){if(_0x32b16a){return _0x32b16a[_0x41fe('0x22')]()[_0x41fe('0x23')](function(){_0x6f3ac[_0x41fe('0x18')](0xcc)[_0x41fe('0x24')]();});}};}function handleEntityNotFound(_0x4edcf7,_0xdf40ca){return function(_0x21dffb){if(!_0x21dffb){_0x4edcf7[_0x41fe('0x17')](0x194);}return _0x21dffb;};}function handleError(_0x52bbc9,_0x21b85b){_0x21b85b=_0x21b85b||0x1f4;return function(_0x390841){logger['error'](_0x390841[_0x41fe('0x25')]);if(_0x390841['name']){delete _0x390841[_0x41fe('0x26')];}_0x52bbc9[_0x41fe('0x18')](_0x21b85b)[_0x41fe('0x27')](_0x390841);};}exports['update']=function(_0x2f7ef7,_0x1148f3){if(_0x2f7ef7[_0x41fe('0x28')]['id']){delete _0x2f7ef7['body']['id'];}return db['Action']['find']({'where':{'id':_0x2f7ef7[_0x41fe('0x29')]['id']}})['then'](handleEntityNotFound(_0x1148f3,null))[_0x41fe('0x23')](saveUpdates(_0x2f7ef7[_0x41fe('0x28')],null))[_0x41fe('0x23')](respondWithResult(_0x1148f3,null))[_0x41fe('0x2a')](handleError(_0x1148f3,null));};exports[_0x41fe('0x22')]=function(_0x446d1c,_0x590897){return db[_0x41fe('0x2b')]['find']({'where':{'id':_0x446d1c['params']['id']}})['then'](handleEntityNotFound(_0x590897,null))[_0x41fe('0x23')](removeEntity(_0x590897,null))[_0x41fe('0x2a')](handleError(_0x590897,null));};
\ No newline at end of file
index d1bff32..03d05fa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x24a3=['request-promise','./action.attributes','exports','define','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xb6e2ea,_0x3b26e9){var _0x2a57bb=function(_0x2a1ac9){while(--_0x2a1ac9){_0xb6e2ea['push'](_0xb6e2ea['shift']());}};_0x2a57bb(++_0x3b26e9);}(_0x24a3,0x96));var _0x324a=function(_0x38a58f,_0x4e14f7){_0x38a58f=_0x38a58f-0x0;var _0x4187b7=_0x24a3[_0x38a58f];return _0x4187b7;};'use strict';var _=require(_0x324a('0x0'));var util=require(_0x324a('0x1'));var logger=require(_0x324a('0x2'))(_0x324a('0x3'));var moment=require(_0x324a('0x4'));var BPromise=require(_0x324a('0x5'));var rp=require(_0x324a('0x6'));var attributes=require(_0x324a('0x7'));module[_0x324a('0x8')]=function(_0x3821ec,_0x4f779b){return _0x3821ec[_0x324a('0x9')](_0x324a('0xa'),attributes,{'tableName':_0x324a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x4238=['api','moment','bluebird','request-promise','./action.attributes','exports','Action','../../config/logger'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x4238,0x107));var _0x8423=function(_0x585133,_0x2412a1){_0x585133=_0x585133-0x0;var _0x18254a=_0x4238[_0x585133];return _0x18254a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8423('0x0'))(_0x8423('0x1'));var moment=require(_0x8423('0x2'));var BPromise=require(_0x8423('0x3'));var rp=require(_0x8423('0x4'));var attributes=require(_0x8423('0x5'));module[_0x8423('0x6')]=function(_0x1cf95a,_0x4c9858){return _0x1cf95a['define'](_0x8423('0x7'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index acbd35b..59f2adf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x79a8=['message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x79a8,0x1d0));var _0x879a=function(_0x29e398,_0x890225){_0x29e398=_0x29e398-0x0;var _0xd799e2=_0x79a8[_0x29e398];return _0xd799e2;};'use strict';var _=require(_0x879a('0x0'));var util=require('util');var moment=require(_0x879a('0x1'));var BPromise=require(_0x879a('0x2'));var rs=require(_0x879a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x879a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x879a('0x5'))(_0x879a('0x6'));var config=require(_0x879a('0x7'));var jayson=require(_0x879a('0x8'));var client=jayson[_0x879a('0x9')][_0x879a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d353e,_0x2427bf,_0x4bf3ab){return new BPromise(function(_0xe27fe6,_0x5cb5c9){return client[_0x879a('0xb')](_0x1d353e,_0x4bf3ab)[_0x879a('0xc')](function(_0x5eba04){logger[_0x879a('0xd')](_0x879a('0xe'),_0x2427bf,_0x879a('0xf'));logger['debug'](_0x879a('0x10'),_0x2427bf,_0x879a('0xf'),JSON['stringify'](_0x5eba04));if(_0x5eba04['error']){if(_0x5eba04[_0x879a('0x11')][_0x879a('0x12')]===0x1f4){logger[_0x879a('0x11')](_0x879a('0xe'),_0x2427bf,_0x5eba04['error'][_0x879a('0x13')]);return _0x5cb5c9(_0x5eba04[_0x879a('0x11')][_0x879a('0x13')]);}logger[_0x879a('0x11')](_0x879a('0xe'),_0x2427bf,_0x5eba04[_0x879a('0x11')][_0x879a('0x13')]);return _0xe27fe6(_0x5eba04[_0x879a('0x11')][_0x879a('0x13')]);}else{logger[_0x879a('0xd')]('Action,\x20%s,\x20%s',_0x2427bf,'request\x20sent');_0xe27fe6(_0x5eba04[_0x879a('0x14')][_0x879a('0x13')]);}})['catch'](function(_0x119260){logger[_0x879a('0x11')](_0x879a('0xe'),_0x2427bf,_0x119260);_0x5cb5c9(_0x119260);});});}
\ No newline at end of file
+var _0xa1a5=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4dfd70,_0x35e8d2){var _0x48d818=function(_0x4e9e22){while(--_0x4e9e22){_0x4dfd70['push'](_0x4dfd70['shift']());}};_0x48d818(++_0x35e8d2);}(_0xa1a5,0x1b8));var _0x5a1a=function(_0x32ae32,_0x2a6f65){_0x32ae32=_0x32ae32-0x0;var _0x3e1fb7=_0xa1a5[_0x32ae32];return _0x3e1fb7;};'use strict';var _=require(_0x5a1a('0x0'));var util=require('util');var moment=require(_0x5a1a('0x1'));var BPromise=require(_0x5a1a('0x2'));var rs=require(_0x5a1a('0x3'));var fs=require('fs');var Redis=require(_0x5a1a('0x4'));var db=require(_0x5a1a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5a1a('0x6'))(_0x5a1a('0x7'));var config=require(_0x5a1a('0x8'));var jayson=require(_0x5a1a('0x9'));var client=jayson[_0x5a1a('0xa')][_0x5a1a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1062b9,_0x59e0f6,_0x1ec37f){return new BPromise(function(_0x313212,_0x1ee70b){return client[_0x5a1a('0xc')](_0x1062b9,_0x1ec37f)[_0x5a1a('0xd')](function(_0x1c9374){logger[_0x5a1a('0xe')](_0x5a1a('0xf'),_0x59e0f6,_0x5a1a('0x10'));logger['debug'](_0x5a1a('0x11'),_0x59e0f6,_0x5a1a('0x10'),JSON[_0x5a1a('0x12')](_0x1c9374));if(_0x1c9374['error']){if(_0x1c9374[_0x5a1a('0x13')]['code']===0x1f4){logger['error']('Action,\x20%s,\x20%s',_0x59e0f6,_0x1c9374[_0x5a1a('0x13')][_0x5a1a('0x14')]);return _0x1ee70b(_0x1c9374[_0x5a1a('0x13')][_0x5a1a('0x14')]);}logger['error'](_0x5a1a('0xf'),_0x59e0f6,_0x1c9374[_0x5a1a('0x13')]['message']);return _0x313212(_0x1c9374[_0x5a1a('0x13')][_0x5a1a('0x14')]);}else{logger[_0x5a1a('0xe')]('Action,\x20%s,\x20%s',_0x59e0f6,_0x5a1a('0x10'));_0x313212(_0x1c9374[_0x5a1a('0x15')][_0x5a1a('0x14')]);}})[_0x5a1a('0x16')](function(_0x3d0432){logger[_0x5a1a('0x13')](_0x5a1a('0xf'),_0x59e0f6,_0x3d0432);_0x1ee70b(_0x3d0432);});});}
\ No newline at end of file
index 66d438e..7ecc16e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x574d=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./action.controller','put','/:id','update','delete','isAuthenticated','destroy','exports'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x574d,0xc0));var _0xd574=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x574d[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require(_0xd574('0x0'));var util=require(_0xd574('0x1'));var path=require(_0xd574('0x2'));var timeout=require(_0xd574('0x3'));var express=require(_0xd574('0x4'));var router=express[_0xd574('0x5')]();var auth=require(_0xd574('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd574('0x7'));var controller=require(_0xd574('0x8'));router[_0xd574('0x9')](_0xd574('0xa'),auth['isAuthenticated'](),controller[_0xd574('0xb')]);router[_0xd574('0xc')](_0xd574('0xa'),auth[_0xd574('0xd')](),controller[_0xd574('0xe')]);module[_0xd574('0xf')]=router;
\ No newline at end of file
+var _0x83cd=['update','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','/:id','isAuthenticated'];(function(_0x52fe27,_0x4ebb45){var _0x102625=function(_0x4fd4b0){while(--_0x4fd4b0){_0x52fe27['push'](_0x52fe27['shift']());}};_0x102625(++_0x4ebb45);}(_0x83cd,0x17b));var _0xd83c=function(_0x5f178e,_0x2d9971){_0x5f178e=_0x5f178e-0x0;var _0x10dcbe=_0x83cd[_0x5f178e];return _0x10dcbe;};'use strict';var multer=require(_0xd83c('0x0'));var util=require(_0xd83c('0x1'));var path=require(_0xd83c('0x2'));var timeout=require(_0xd83c('0x3'));var express=require(_0xd83c('0x4'));var router=express['Router']();var auth=require(_0xd83c('0x5'));var interaction=require(_0xd83c('0x6'));var config=require(_0xd83c('0x7'));var controller=require(_0xd83c('0x8'));router['put'](_0xd83c('0x9'),auth[_0xd83c('0xa')](),controller[_0xd83c('0xb')]);router['delete'](_0xd83c('0x9'),auth['isAuthenticated'](),controller[_0xd83c('0xc')]);module['exports']=router;
\ No newline at end of file
index 1f0a538..d6b3182 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9aa8=['exports','STRING','sequelize'];(function(_0x1c962f,_0x2e213e){var _0x3629e4=function(_0x3af2bb){while(--_0x3af2bb){_0x1c962f['push'](_0x1c962f['shift']());}};_0x3629e4(++_0x2e213e);}(_0x9aa8,0x11c));var _0x89aa=function(_0x5b290b,_0x3a5aba){_0x5b290b=_0x5b290b-0x0;var _0x3949c1=_0x9aa8[_0x5b290b];return _0x3949c1;};'use strict';var Sequelize=require(_0x89aa('0x0'));module[_0x89aa('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x89aa('0x2')]},'parent':{'type':Sequelize[_0x89aa('0x2')]},'table':{'type':Sequelize[_0x89aa('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}};
\ No newline at end of file
+var _0xfc14=['TEXT','sequelize','exports','STRING'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0xfc14,0x175));var _0x4fc1=function(_0x2b3008,_0x278de4){_0x2b3008=_0x2b3008-0x0;var _0x3cc6ed=_0xfc14[_0x2b3008];return _0x3cc6ed;};'use strict';var Sequelize=require(_0x4fc1('0x0'));module[_0x4fc1('0x1')]={'name':{'type':Sequelize[_0x4fc1('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4fc1('0x2')]},'parent':{'type':Sequelize[_0x4fc1('0x2')]},'table':{'type':Sequelize[_0x4fc1('0x2')]},'conditions':{'type':Sequelize[_0x4fc1('0x3')]},'joins':{'type':Sequelize[_0x4fc1('0x3')]}};
\ No newline at end of file
index 652333e..63e4fee 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf2a6=['util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','count','offset','limit','Content-Range','json','apply','reject','save','then','destroy','get','CustomReports','UserProfileResource','error','name','send','index','AnalyticCustomReport','rawAttributes','keys','filters','intersection','model','attributes','fields','query','nolimit','sort','where','pick','filter','merge','map','type','key','VIRTUAL','includeAll','include','rows','catch','show','params','length','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','find','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%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)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','options','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','field','function','replace','groupBy','order','orderBy','DESC','alias','joins','parse','foreignTable','format','%s.%s\x20=\x20%s.%s','parentKey','foreignKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','HOUR(%s)','value','Sequelize','SELECT','No\x20available\x20data','output','fullPath','%s-%s.%s','randomstring','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','runReport','cross_join','html-pdf','fast-json-patch','moment','bluebird','mustache'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xf2a6,0x13d));var _0x6f2a=function(_0x376a86,_0x587869){_0x376a86=_0x376a86-0x0;var _0x5cda73=_0xf2a6[_0x376a86];return _0x5cda73;};'use strict';var pdf=require(_0x6f2a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6f2a('0x1'));var rp=require('request-promise');var moment=require(_0x6f2a('0x2'));var BPromise=require(_0x6f2a('0x3'));var Mustache=require(_0x6f2a('0x4'));var util=require(_0x6f2a('0x5'));var path=require(_0x6f2a('0x6'));var sox=require(_0x6f2a('0x7'));var csv=require(_0x6f2a('0x8'));var ejs=require(_0x6f2a('0x9'));var fs=require('fs');var _=require(_0x6f2a('0xa'));var squel=require(_0x6f2a('0xb'));var crypto=require('crypto');var jsforce=require(_0x6f2a('0xc'));var deskjs=require(_0x6f2a('0xd'));var toCsv=require(_0x6f2a('0x8'));var querystring=require(_0x6f2a('0xe'));var Papa=require('papaparse');var authService=require(_0x6f2a('0xf'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x6f2a('0x10'));var qs=require(_0x6f2a('0x11'));var logger=require(_0x6f2a('0x12'))('api');var utils=require(_0x6f2a('0x13'));var config=require('../../config/environment');var db=require(_0x6f2a('0x14'))['db'];function respondWithStatusCode(_0x398822,_0x1c2665){_0x1c2665=_0x1c2665||0xcc;return function(_0x59df4e){if(_0x59df4e){return _0x398822[_0x6f2a('0x15')](_0x1c2665);}return _0x398822['status'](_0x1c2665)[_0x6f2a('0x16')]();};}function respondWithResult(_0x45eab9,_0x37bed1){_0x37bed1=_0x37bed1||0xc8;return function(_0x421e15){if(_0x421e15){return _0x45eab9[_0x6f2a('0x17')](_0x37bed1)['json'](_0x421e15);}};}function respondWithFilteredResult(_0x18fa0a,_0x414498){return function(_0x27ca04){if(_0x27ca04){var _0x44b317=_0x27ca04[_0x6f2a('0x18')],_0x1057f2=_0x414498[_0x6f2a('0x19')],_0x3dfc44=_0x414498[_0x6f2a('0x19')]+_0x414498[_0x6f2a('0x1a')],_0x276e38;if(_0x3dfc44>=_0x44b317){_0x3dfc44=_0x44b317;_0x276e38=0xc8;}else{_0x276e38=0xce;}_0x18fa0a[_0x6f2a('0x17')](_0x276e38);return _0x18fa0a['set'](_0x6f2a('0x1b'),_0x1057f2+'-'+_0x3dfc44+'/'+_0x44b317)[_0x6f2a('0x1c')](_0x27ca04);}return null;};}function patchUpdates(_0x55d117){return function(_0x1ff155){try{jsonpatch[_0x6f2a('0x1d')](_0x1ff155,_0x55d117,!![]);}catch(_0x43602b){return BPromise[_0x6f2a('0x1e')](_0x43602b);}return _0x1ff155[_0x6f2a('0x1f')]();};}function saveUpdates(_0x152052,_0x3e996b){return function(_0x33554f){if(_0x33554f){return _0x33554f['update'](_0x152052)[_0x6f2a('0x20')](function(_0x20e7ff){return _0x20e7ff;});}return null;};}function removeEntity(_0x1bb113,_0x27f139){return function(_0x1da29f){if(_0x1da29f){return _0x1da29f[_0x6f2a('0x21')]()[_0x6f2a('0x20')](function(){var _0x5278b8=_0x1da29f[_0x6f2a('0x22')]({'plain':!![]});var _0x590c40=_0x6f2a('0x23');return db[_0x6f2a('0x24')][_0x6f2a('0x21')]({'where':{'type':_0x590c40,'resourceId':_0x5278b8['id']}})['then'](function(){return _0x1da29f;});})[_0x6f2a('0x20')](function(){_0x1bb113[_0x6f2a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55c1bc,_0x1dabde){return function(_0x36c0b7){if(!_0x36c0b7){_0x55c1bc[_0x6f2a('0x15')](0x194);}return _0x36c0b7;};}function handleError(_0xf5105e,_0x6b781b){_0x6b781b=_0x6b781b||0x1f4;return function(_0x5efdda){logger[_0x6f2a('0x25')](_0x5efdda['stack']);if(_0x5efdda[_0x6f2a('0x26')]){delete _0x5efdda[_0x6f2a('0x26')];}_0xf5105e['status'](_0x6b781b)[_0x6f2a('0x27')](_0x5efdda);};}exports[_0x6f2a('0x28')]=function(_0x498d7e,_0x4035d8){var _0x1ca729={},_0x28d546={},_0x39a911={'count':0x0,'rows':[]};var _0x347767=db[_0x6f2a('0x29')][_0x6f2a('0x2a')];_0x28d546['model']=_[_0x6f2a('0x2b')](_0x347767);_0x28d546['query']=_[_0x6f2a('0x2b')](_0x498d7e['query']);_0x28d546[_0x6f2a('0x2c')]=_[_0x6f2a('0x2d')](_0x28d546[_0x6f2a('0x2e')],_0x28d546['query']);_0x1ca729[_0x6f2a('0x2f')]=_['intersection'](_0x28d546[_0x6f2a('0x2e')],qs[_0x6f2a('0x30')](_0x498d7e['query'][_0x6f2a('0x30')]));_0x1ca729[_0x6f2a('0x2f')]=_0x1ca729[_0x6f2a('0x2f')]['length']?_0x1ca729['attributes']:_0x28d546['model'];if(!_0x498d7e[_0x6f2a('0x31')]['hasOwnProperty'](_0x6f2a('0x32'))){_0x1ca729[_0x6f2a('0x1a')]=qs['limit'](_0x498d7e[_0x6f2a('0x31')][_0x6f2a('0x1a')]);_0x1ca729[_0x6f2a('0x19')]=qs[_0x6f2a('0x19')](_0x498d7e['query'][_0x6f2a('0x19')]);}_0x1ca729['order']=qs[_0x6f2a('0x33')](_0x498d7e[_0x6f2a('0x31')][_0x6f2a('0x33')]);_0x1ca729[_0x6f2a('0x34')]=qs[_0x6f2a('0x2c')](_[_0x6f2a('0x35')](_0x498d7e[_0x6f2a('0x31')],_0x28d546['filters']));if(_0x498d7e[_0x6f2a('0x31')][_0x6f2a('0x36')]){_0x1ca729[_0x6f2a('0x34')]=_[_0x6f2a('0x37')](_0x1ca729[_0x6f2a('0x34')],{'$or':_[_0x6f2a('0x38')](_0x347767,function(_0x9506ae){if(_0x9506ae[_0x6f2a('0x39')][_0x6f2a('0x3a')]!==_0x6f2a('0x3b')){var _0x33b33b={};_0x33b33b[_0x9506ae['field']]={'$like':'%'+_0x498d7e[_0x6f2a('0x31')][_0x6f2a('0x36')]+'%'};return _0x33b33b;}})});}_0x1ca729=_[_0x6f2a('0x37')]({},_0x1ca729,_0x498d7e['options']);var _0x38b19c={'where':_0x1ca729[_0x6f2a('0x34')]};return db[_0x6f2a('0x29')][_0x6f2a('0x18')](_0x38b19c)[_0x6f2a('0x20')](function(_0x35ce69){_0x39a911[_0x6f2a('0x18')]=_0x35ce69;if(_0x498d7e[_0x6f2a('0x31')][_0x6f2a('0x3c')]){_0x1ca729[_0x6f2a('0x3d')]=[{'all':!![]}];}return db[_0x6f2a('0x29')]['findAll'](_0x1ca729);})[_0x6f2a('0x20')](function(_0xccc1c){_0x39a911[_0x6f2a('0x3e')]=_0xccc1c;return _0x39a911;})['then'](respondWithFilteredResult(_0x4035d8,_0x1ca729))[_0x6f2a('0x3f')](handleError(_0x4035d8,null));};exports[_0x6f2a('0x40')]=function(_0x14f869,_0x26e1ea){var _0x1ef96d={'raw':![],'where':{'id':_0x14f869[_0x6f2a('0x41')]['id']}},_0x2c5fbb={};_0x2c5fbb[_0x6f2a('0x2e')]=_['keys'](db[_0x6f2a('0x29')]['rawAttributes']);_0x2c5fbb['query']=_[_0x6f2a('0x2b')](_0x14f869[_0x6f2a('0x31')]);_0x2c5fbb[_0x6f2a('0x2c')]=_[_0x6f2a('0x2d')](_0x2c5fbb['model'],_0x2c5fbb[_0x6f2a('0x31')]);_0x1ef96d[_0x6f2a('0x2f')]=_[_0x6f2a('0x2d')](_0x2c5fbb[_0x6f2a('0x2e')],qs[_0x6f2a('0x30')](_0x14f869[_0x6f2a('0x31')]['fields']));_0x1ef96d[_0x6f2a('0x2f')]=_0x1ef96d[_0x6f2a('0x2f')][_0x6f2a('0x42')]?_0x1ef96d[_0x6f2a('0x2f')]:_0x2c5fbb[_0x6f2a('0x2e')];if(_0x14f869[_0x6f2a('0x31')]['includeAll']){_0x1ef96d['include']=[{'all':!![]}];}_0x1ef96d=_[_0x6f2a('0x37')]({},_0x1ef96d,_0x14f869['options']);return db[_0x6f2a('0x29')]['find'](_0x1ef96d)[_0x6f2a('0x20')](handleEntityNotFound(_0x26e1ea,null))[_0x6f2a('0x20')](respondWithResult(_0x26e1ea,null))['catch'](handleError(_0x26e1ea,null));};exports['create']=function(_0x552b85,_0x2265af){return db['AnalyticCustomReport']['create'](_0x552b85[_0x6f2a('0x43')],{})[_0x6f2a('0x20')](function(_0x348ed1){var _0x1fc47b=_0x552b85['user'][_0x6f2a('0x22')]({'plain':!![]});if(!_0x1fc47b)throw new Error(_0x6f2a('0x44'));if(_0x1fc47b[_0x6f2a('0x45')]===_0x6f2a('0x46')){var _0x3d8f60=_0x348ed1[_0x6f2a('0x22')]({'plain':!![]});var _0x57a8e7=_0x6f2a('0x47');return db[_0x6f2a('0x48')][_0x6f2a('0x49')]({'where':{'name':_0x57a8e7,'userProfileId':_0x1fc47b[_0x6f2a('0x4a')]},'raw':!![]})[_0x6f2a('0x20')](function(_0x18734e){if(_0x18734e&&_0x18734e['autoAssociation']===0x0){return db[_0x6f2a('0x24')][_0x6f2a('0x4b')]({'name':_0x3d8f60[_0x6f2a('0x26')],'resourceId':_0x3d8f60['id'],'type':'CustomReports','sectionId':_0x18734e['id']},{})['then'](function(){return _0x348ed1;});}else{return _0x348ed1;}})[_0x6f2a('0x3f')](function(_0x2ab63c){logger[_0x6f2a('0x25')](_0x6f2a('0x4c'),_0x2ab63c);throw _0x2ab63c;});}return _0x348ed1;})[_0x6f2a('0x20')](respondWithResult(_0x2265af,0xc9))[_0x6f2a('0x3f')](handleError(_0x2265af,null));};exports[_0x6f2a('0x4d')]=function(_0x68d57c,_0x39f0c4){if(_0x68d57c[_0x6f2a('0x43')]['id']){delete _0x68d57c[_0x6f2a('0x43')]['id'];}return db[_0x6f2a('0x29')][_0x6f2a('0x49')]({'where':{'id':_0x68d57c['params']['id']}})[_0x6f2a('0x20')](handleEntityNotFound(_0x39f0c4,null))['then'](saveUpdates(_0x68d57c[_0x6f2a('0x43')],null))['then'](respondWithResult(_0x39f0c4,null))[_0x6f2a('0x3f')](handleError(_0x39f0c4,null));};exports['destroy']=function(_0x13d759,_0x1c1ad9){return db[_0x6f2a('0x29')]['find']({'where':{'id':_0x13d759[_0x6f2a('0x41')]['id']}})['then'](handleEntityNotFound(_0x1c1ad9,null))[_0x6f2a('0x20')](removeEntity(_0x1c1ad9,null))['catch'](handleError(_0x1c1ad9,null));};exports['preview']=function(_0x2e0078,_0x3a213c){var _0x1a5afb=0xa;var _0x33468e=[_0x6f2a('0x4e'),_0x6f2a('0x4f'),_0x6f2a('0x50'),'cross_join'];var _0x23312c={'SUM':_0x6f2a('0x51'),'COUNT':_0x6f2a('0x52'),'COUNT DISTINCT':_0x6f2a('0x53'),'MAX':_0x6f2a('0x54'),'MIN':_0x6f2a('0x55'),'AVG':_0x6f2a('0x56'),'GROUP_CONCAT':_0x6f2a('0x57'),'GROUP_CONCAT ASC':_0x6f2a('0x58'),'GROUP_CONCAT DESC':_0x6f2a('0x59')};var _0x2c9133={'SEC_TO_TIME':_0x6f2a('0x5a'),'DATE':_0x6f2a('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0x6f2a('0x5c'),'UNIX_TIMESTAMP':_0x6f2a('0x5d')};var _0x19da53=function(_0x172e25){return!_[_0x6f2a('0x5e')]([_0x6f2a('0x5f'),_0x6f2a('0x60'),_0x6f2a('0x61'),_0x6f2a('0x62')],_0x172e25);};var _0x566477=function(_0x1ae081){if(!_0x1ae081||!_0x1ae081[_0x6f2a('0x63')][_0x6f2a('0x42')]){return'';}for(var _0x46099e='(',_0x384778=0x0;_0x384778<_0x1ae081[_0x6f2a('0x63')][_0x6f2a('0x42')];_0x384778+=0x1){_0x384778>0x0&&(_0x46099e+='\x20'+_0x1ae081[_0x6f2a('0x64')]+'\x20');_0x46099e+=_0x1ae081[_0x6f2a('0x63')][_0x384778][_0x6f2a('0x65')]?_0x566477(_0x1ae081['rules'][_0x384778][_0x6f2a('0x65')]):_0x1ae081[_0x6f2a('0x63')][_0x384778]['field']+'\x20'+_0x1ae081[_0x6f2a('0x63')][_0x384778][_0x6f2a('0x66')]+(_0x19da53(_0x1ae081[_0x6f2a('0x63')][_0x384778][_0x6f2a('0x66')])?'\x20'+_0x1ae081['rules'][_0x384778]['value']:'');}return _0x46099e+')';};var _0x3097e8={'where':{'id':_0x2e0078[_0x6f2a('0x41')]['id']}},_0x174cc,_0x4eb5ab,_0x3518de,_0x190f60,_0x1d370f;_0x3097e8=_['merge']({},_0x3097e8,_0x2e0078[_0x6f2a('0x67')]);return db[_0x6f2a('0x29')][_0x6f2a('0x49')](_0x3097e8)[_0x6f2a('0x20')](function(_0x24881b){if(_0x24881b){_0x174cc=_0x24881b;return _0x24881b[_0x6f2a('0x68')]();}return null;})[_0x6f2a('0x20')](function(_0x1e8063){if(_0x1e8063){if(!_0x1e8063[_0x6f2a('0x42')]){throw new db['Sequelize'][(_0x6f2a('0x69'))](_0x6f2a('0x6a'),0x193);}_0x4eb5ab=_0x1e8063;return db[_0x6f2a('0x6b')][_0x6f2a('0x6c')]({'raw':!![]});}return null;})[_0x6f2a('0x20')](function(_0x3bde9d){if(_0x3bde9d){_0x3518de=_[_0x6f2a('0x6d')](_0x3bde9d,'id');var _0x2a8d40;var _0x3fe6e3=squel[_0x6f2a('0x6e')]();_0x3fe6e3[_0x6f2a('0x6f')](_0x174cc[_0x6f2a('0x70')]);for(var _0x1f7cd0=0x0;_0x1f7cd0<_0x4eb5ab[_0x6f2a('0x42')];_0x1f7cd0+=0x1){_0x2a8d40=_0x4eb5ab[_0x1f7cd0][_0x6f2a('0x71')]?_0x3518de[_0x4eb5ab[_0x1f7cd0][_0x6f2a('0x71')]][_0x6f2a('0x72')]:_0x4eb5ab[_0x1f7cd0][_0x6f2a('0x73')];_0x2a8d40=_0x4eb5ab[_0x1f7cd0][_0x6f2a('0x74')]?_[_0x6f2a('0x75')](_0x23312c[_0x4eb5ab[_0x1f7cd0][_0x6f2a('0x74')]],'%s',_0x2a8d40):_0x2a8d40;_0x2a8d40=_0x4eb5ab[_0x1f7cd0]['format']?_[_0x6f2a('0x75')](_0x2c9133[_0x4eb5ab[_0x1f7cd0]['format']],'%s',_0x2a8d40):_0x2a8d40;if(_0x4eb5ab[_0x1f7cd0][_0x6f2a('0x76')]){_0x3fe6e3[_0x6f2a('0x65')](_0x2a8d40);}_0x4eb5ab[_0x1f7cd0]['orderBy']&&_0x3fe6e3[_0x6f2a('0x77')](_0x2a8d40,_0x4eb5ab[_0x1f7cd0][_0x6f2a('0x78')]===_0x6f2a('0x79')?![]:!![]);_0x3fe6e3[_0x6f2a('0x73')](_0x2a8d40,_0x4eb5ab[_0x1f7cd0][_0x6f2a('0x7a')]||_0x2a8d40);}if(_0x174cc['joins']){_0x174cc[_0x6f2a('0x7b')]=JSON[_0x6f2a('0x7c')](_0x174cc['joins']);for(var _0x2ec209=0x0;_0x2ec209<_0x174cc['joins'][_0x6f2a('0x42')];_0x2ec209+=0x1){if(_0x174cc[_0x6f2a('0x7b')][_0x2ec209]['type']&&_[_0x6f2a('0x5e')](_0x33468e,_0x174cc[_0x6f2a('0x7b')][_0x2ec209]['type'])&&_0x174cc['joins'][_0x2ec209]['parentKey']&&_0x174cc['joins'][_0x2ec209]['foreignTable']&&_0x174cc[_0x6f2a('0x7b')][_0x2ec209]['foreignKey']){_0x3fe6e3[_0x174cc[_0x6f2a('0x7b')][_0x2ec209][_0x6f2a('0x39')]](_0x174cc['joins'][_0x2ec209][_0x6f2a('0x7d')],null,util[_0x6f2a('0x7e')](_0x6f2a('0x7f'),_0x174cc[_0x6f2a('0x70')],_0x174cc['joins'][_0x2ec209][_0x6f2a('0x80')],_0x174cc[_0x6f2a('0x7b')][_0x2ec209][_0x6f2a('0x7d')],_0x174cc[_0x6f2a('0x7b')][_0x2ec209][_0x6f2a('0x81')]));}}}if(_0x174cc[_0x6f2a('0x82')]){_0x174cc['conditions']=JSON[_0x6f2a('0x7c')](_0x174cc[_0x6f2a('0x82')]);_0x3fe6e3[_0x6f2a('0x34')](_0x566477(_0x174cc['conditions']['group']));}_0x1d370f=_0x3fe6e3[_0x6f2a('0x83')]();_0x3fe6e3[_0x6f2a('0x1a')](_0x1a5afb);_0x3fe6e3[_0x6f2a('0x19')](0x0);logger[_0x6f2a('0x84')](_0x6f2a('0x85'),_0x3fe6e3['toString']());return db[_0x6f2a('0x86')]['query'](_0x3fe6e3[_0x6f2a('0x87')](),{'type':db[_0x6f2a('0x86')][_0x6f2a('0x88')]['SELECT']});}})['then'](respondWithResult(_0x3a213c,null))[_0x6f2a('0x3f')](handleError(_0x3a213c,null));};function runReport(_0x4aac3f,_0x56f910,_0x19bb11){var _0x16adb6=_0x56f910[_0x6f2a('0x26')];var _0x302cc8=0xa;var _0x25c235=[_0x6f2a('0x4e'),_0x6f2a('0x4f'),_0x6f2a('0x50'),'cross_join'];var _0x99e053={'SUM':_0x6f2a('0x51'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x6f2a('0x53'),'MAX':'MAX(%s)','MIN':_0x6f2a('0x55'),'AVG':_0x6f2a('0x56'),'GROUP_CONCAT':_0x6f2a('0x57'),'GROUP_CONCAT ASC':_0x6f2a('0x58'),'GROUP_CONCAT DESC':_0x6f2a('0x59')};var _0x5cbbe3={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x6f2a('0x5b'),'HOUR':_0x6f2a('0x89'),'ROUND':_0x6f2a('0x5c'),'UNIX_TIMESTAMP':_0x6f2a('0x5d')};var _0x1f4fd8=function(_0x564670){return!_['includes']([_0x6f2a('0x5f'),_0x6f2a('0x60'),_0x6f2a('0x61'),_0x6f2a('0x62')],_0x564670);};var _0x1cf15c=function(_0x25731b){if(!_0x25731b||!_0x25731b[_0x6f2a('0x63')][_0x6f2a('0x42')]){return'';}for(var _0x4e054c='(',_0x3777eb=0x0;_0x3777eb<_0x25731b[_0x6f2a('0x63')][_0x6f2a('0x42')];_0x3777eb+=0x1){_0x3777eb>0x0&&(_0x4e054c+='\x20'+_0x25731b[_0x6f2a('0x64')]+'\x20');_0x4e054c+=_0x25731b[_0x6f2a('0x63')][_0x3777eb][_0x6f2a('0x65')]?_0x1cf15c(_0x25731b[_0x6f2a('0x63')][_0x3777eb][_0x6f2a('0x65')]):_0x25731b['rules'][_0x3777eb]['field']+'\x20'+_0x25731b[_0x6f2a('0x63')][_0x3777eb][_0x6f2a('0x66')]+(_0x1f4fd8(_0x25731b[_0x6f2a('0x63')][_0x3777eb][_0x6f2a('0x66')])?'\x20'+_0x25731b[_0x6f2a('0x63')][_0x3777eb][_0x6f2a('0x8a')]:'');}return _0x4e054c+')';};var _0x4e31bd={'where':{'id':_0x4aac3f['id']}},_0x2550e0,_0x47390b,_0x510bd0,_0x372680,_0x295b8a;_0x4e31bd=_[_0x6f2a('0x37')]({},_0x4e31bd,_0x19bb11);return db['AnalyticCustomReport'][_0x6f2a('0x49')](_0x4e31bd)[_0x6f2a('0x20')](function(_0x49f478){if(_0x49f478){_0x2550e0=_0x49f478;return _0x49f478[_0x6f2a('0x68')]();}return null;})[_0x6f2a('0x20')](function(_0x3d2e9f){if(_0x3d2e9f){if(!_0x3d2e9f[_0x6f2a('0x42')]){throw new db[(_0x6f2a('0x8b'))][(_0x6f2a('0x69'))](_0x6f2a('0x6a'),0x193);}_0x47390b=_0x3d2e9f;return db[_0x6f2a('0x6b')][_0x6f2a('0x6c')]({'raw':!![]});}return null;})['then'](function(_0x198038){if(_0x198038){_0x510bd0=_[_0x6f2a('0x6d')](_0x198038,'id');var _0x3ee180;var _0x53b9c=squel[_0x6f2a('0x6e')]();_0x53b9c['from'](_0x2550e0['table']);for(var _0x41bdb0=0x0;_0x41bdb0<_0x47390b[_0x6f2a('0x42')];_0x41bdb0+=0x1){_0x3ee180=_0x47390b[_0x41bdb0][_0x6f2a('0x71')]?_0x510bd0[_0x47390b[_0x41bdb0]['MetricId']]['metric']:_0x47390b[_0x41bdb0][_0x6f2a('0x73')];_0x3ee180=_0x47390b[_0x41bdb0][_0x6f2a('0x74')]?_[_0x6f2a('0x75')](_0x99e053[_0x47390b[_0x41bdb0][_0x6f2a('0x74')]],'%s',_0x3ee180):_0x3ee180;_0x3ee180=_0x47390b[_0x41bdb0][_0x6f2a('0x7e')]?_[_0x6f2a('0x75')](_0x5cbbe3[_0x47390b[_0x41bdb0]['format']],'%s',_0x3ee180):_0x3ee180;if(_0x47390b[_0x41bdb0][_0x6f2a('0x76')]){_0x53b9c[_0x6f2a('0x65')](_0x3ee180);}_0x47390b[_0x41bdb0]['orderBy']&&_0x53b9c['order'](_0x3ee180,_0x47390b[_0x41bdb0][_0x6f2a('0x78')]===_0x6f2a('0x79')?![]:!![]);_0x53b9c[_0x6f2a('0x73')](_0x3ee180,_0x47390b[_0x41bdb0][_0x6f2a('0x7a')]||_0x3ee180);}if(_0x2550e0['joins']){_0x2550e0[_0x6f2a('0x7b')]=JSON['parse'](_0x2550e0[_0x6f2a('0x7b')]);for(var _0x311bc1=0x0;_0x311bc1<_0x2550e0[_0x6f2a('0x7b')]['length'];_0x311bc1+=0x1){if(_0x2550e0[_0x6f2a('0x7b')][_0x311bc1][_0x6f2a('0x39')]&&_['includes'](_0x25c235,_0x2550e0[_0x6f2a('0x7b')][_0x311bc1][_0x6f2a('0x39')])&&_0x2550e0[_0x6f2a('0x7b')][_0x311bc1][_0x6f2a('0x80')]&&_0x2550e0[_0x6f2a('0x7b')][_0x311bc1][_0x6f2a('0x7d')]&&_0x2550e0['joins'][_0x311bc1][_0x6f2a('0x81')]){_0x53b9c[_0x2550e0[_0x6f2a('0x7b')][_0x311bc1][_0x6f2a('0x39')]](_0x2550e0[_0x6f2a('0x7b')][_0x311bc1][_0x6f2a('0x7d')],null,util[_0x6f2a('0x7e')](_0x6f2a('0x7f'),_0x2550e0[_0x6f2a('0x70')],_0x2550e0[_0x6f2a('0x7b')][_0x311bc1][_0x6f2a('0x80')],_0x2550e0['joins'][_0x311bc1][_0x6f2a('0x7d')],_0x2550e0[_0x6f2a('0x7b')][_0x311bc1][_0x6f2a('0x81')]));}}}if(_0x2550e0[_0x6f2a('0x82')]){_0x2550e0[_0x6f2a('0x82')]=JSON[_0x6f2a('0x7c')](_0x2550e0['conditions']);_0x53b9c[_0x6f2a('0x34')](_0x1cf15c(_0x2550e0['conditions'][_0x6f2a('0x65')]));}_0x295b8a=_0x53b9c[_0x6f2a('0x83')]();_0x53b9c[_0x6f2a('0x1a')](_0x302cc8);_0x53b9c[_0x6f2a('0x19')](0x0);logger['debug'](_0x6f2a('0x85'),_0x53b9c[_0x6f2a('0x87')]());return db['sequelize'][_0x6f2a('0x31')](_0x53b9c[_0x6f2a('0x87')](),{'type':db[_0x6f2a('0x86')]['QueryTypes'][_0x6f2a('0x8c')]});}})[_0x6f2a('0x20')](function(_0xec62e){if(!_0xec62e[_0x6f2a('0x42')]){throw new db[(_0x6f2a('0x8b'))][(_0x6f2a('0x69'))](_0x6f2a('0x8d'),0xcc);}if(_0x56f910[_0x6f2a('0x8e')]==='web'){return null;}var _0x3119b5=_[_0x6f2a('0x37')](_0x56f910,{'name':_0x56f910[_0x6f2a('0x8f')]||_0x56f910[_0x6f2a('0x26')]||_0x2550e0[_0x6f2a('0x26')],'basename':_0x16adb6,'savename':util[_0x6f2a('0x7e')](_0x6f2a('0x90'),_0x56f910[_0x6f2a('0x26')]||_0x2550e0[_0x6f2a('0x26')],require(_0x6f2a('0x91'))['generate'](0x4),_0x56f910[_0x6f2a('0x8e')]||'csv'),'reportId':_0x2550e0['id'],'reportType':_0x6f2a('0x92')});return db[_0x6f2a('0x93')]['create'](_0x3119b5,{'raw':!![]});})[_0x6f2a('0x20')](function(_0x488eba){if(_0x2550e0[_0x6f2a('0x70')]===_0x6f2a('0x94')){_0x295b8a[_0x6f2a('0x34')](_0x2550e0[_0x6f2a('0x70')]+_0x6f2a('0x95'),_0x56f910[_0x6f2a('0x96')],_0x56f910[_0x6f2a('0x97')]);}else{_0x295b8a['where'](_0x2550e0[_0x6f2a('0x70')]+_0x6f2a('0x98'),_0x56f910[_0x6f2a('0x96')],_0x56f910[_0x6f2a('0x97')]);}if(_0x488eba){logger['info'](_0x6f2a('0x99'),_0x295b8a[_0x6f2a('0x87')]());require(_0x6f2a('0x9a'))[_0x6f2a('0x9b')](path[_0x6f2a('0x4e')](__dirname,'../../components/export/',_0x488eba['output']),[_0x488eba['id'],_0x295b8a['toString'](),path[_0x6f2a('0x4e')](__dirname,_0x6f2a('0x9c'),_0x488eba[_0x6f2a('0x9d')]),_0x16adb6]);return _0x488eba;}else{var _0x5862de=squel[_0x6f2a('0x6e')]();_0x5862de['from']('('+_0x295b8a[_0x6f2a('0x87')]()+')',_0x6f2a('0x9e'));_0x5862de[_0x6f2a('0x73')]('COUNT(*)',_0x6f2a('0x18'));_0x295b8a[_0x6f2a('0x1a')](_0x56f910[_0x6f2a('0x1a')]||_0x302cc8);_0x295b8a[_0x6f2a('0x19')](_0x56f910[_0x6f2a('0x19')]||0x0);return db[_0x6f2a('0x86')]['query'](_0x5862de[_0x6f2a('0x87')](),{'type':db[_0x6f2a('0x86')][_0x6f2a('0x88')]['SELECT']})[_0x6f2a('0x20')](function(_0x7e6409){if(!_0x7e6409['length']){_0x372680=0x0;}else{_0x372680=_0x7e6409[0x0][_0x6f2a('0x18')]||0x0;}return db[_0x6f2a('0x86')][_0x6f2a('0x31')](_0x295b8a[_0x6f2a('0x87')](),{'type':db[_0x6f2a('0x86')][_0x6f2a('0x88')][_0x6f2a('0x8c')]});})['then'](function(_0x43bfeb){return{'rows':_0x43bfeb||[],'count':_0x372680};});}});}exports['run']=function(_0x5bb13a,_0x5c4b04){return runReport(_0x5bb13a['params'],_0x5bb13a[_0x6f2a('0x31')],_0x5bb13a[_0x6f2a('0x67')])['then'](respondWithResult(_0x5c4b04,null))['catch'](handleError(_0x5c4b04,null));};exports[_0x6f2a('0x9f')]=runReport;exports[_0x6f2a('0x31')]=function(_0x1879e3,_0x38f7a6){var _0x3c954e=0xa;var _0xac64ab=[_0x6f2a('0x4e'),_0x6f2a('0x4f'),'right_join',_0x6f2a('0xa0')];var _0x360554={'SUM':_0x6f2a('0x51'),'COUNT':_0x6f2a('0x52'),'COUNT DISTINCT':_0x6f2a('0x53'),'MAX':_0x6f2a('0x54'),'MIN':_0x6f2a('0x55'),'AVG':_0x6f2a('0x56'),'GROUP_CONCAT':_0x6f2a('0x57'),'GROUP_CONCAT ASC':_0x6f2a('0x58'),'GROUP_CONCAT DESC':_0x6f2a('0x59')};var _0x23e522={'SEC_TO_TIME':_0x6f2a('0x5a'),'DATE':_0x6f2a('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0x6f2a('0x5c'),'UNIX_TIMESTAMP':_0x6f2a('0x5d')};var _0x5d417e=function(_0x1fad8a){return!_[_0x6f2a('0x5e')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x1fad8a);};var _0x410407=function(_0x24124d){if(!_0x24124d||!_0x24124d[_0x6f2a('0x63')][_0x6f2a('0x42')]){return'';}for(var _0x2cce2a='(',_0x45765a=0x0;_0x45765a<_0x24124d[_0x6f2a('0x63')][_0x6f2a('0x42')];_0x45765a+=0x1){_0x45765a>0x0&&(_0x2cce2a+='\x20'+_0x24124d[_0x6f2a('0x64')]+'\x20');_0x2cce2a+=_0x24124d[_0x6f2a('0x63')][_0x45765a]['group']?_0x410407(_0x24124d['rules'][_0x45765a][_0x6f2a('0x65')]):_0x24124d[_0x6f2a('0x63')][_0x45765a]['field']+'\x20'+_0x24124d[_0x6f2a('0x63')][_0x45765a]['condition']+(_0x5d417e(_0x24124d[_0x6f2a('0x63')][_0x45765a][_0x6f2a('0x66')])?'\x20'+_0x24124d[_0x6f2a('0x63')][_0x45765a][_0x6f2a('0x8a')]:'');}return _0x2cce2a+')';};var _0x4b8480={'where':{'id':_0x1879e3[_0x6f2a('0x41')]['id']}},_0x24ae61,_0x8f7e2d,_0x399ed2,_0x2349eb,_0x78296;_0x4b8480=_[_0x6f2a('0x37')]({},_0x4b8480,_0x1879e3[_0x6f2a('0x67')]);return db[_0x6f2a('0x29')]['find'](_0x4b8480)[_0x6f2a('0x20')](function(_0x4a12b5){if(_0x4a12b5){_0x24ae61=_0x4a12b5;return _0x4a12b5[_0x6f2a('0x68')]();}return null;})['then'](function(_0x10afc3){if(_0x10afc3){if(!_0x10afc3['length']){throw new db[(_0x6f2a('0x8b'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x8f7e2d=_0x10afc3;return db[_0x6f2a('0x6b')][_0x6f2a('0x6c')]({'raw':!![]});}return null;})[_0x6f2a('0x20')](function(_0x536e04){if(_0x536e04){_0x399ed2=_['keyBy'](_0x536e04,'id');var _0x52917a;var _0x3d5a53=squel['select']();_0x3d5a53['from'](_0x24ae61[_0x6f2a('0x70')]);for(var _0x11e13a=0x0;_0x11e13a<_0x8f7e2d[_0x6f2a('0x42')];_0x11e13a+=0x1){_0x52917a=_0x8f7e2d[_0x11e13a][_0x6f2a('0x71')]?_0x399ed2[_0x8f7e2d[_0x11e13a][_0x6f2a('0x71')]][_0x6f2a('0x72')]:_0x8f7e2d[_0x11e13a][_0x6f2a('0x73')];_0x52917a=_0x8f7e2d[_0x11e13a][_0x6f2a('0x74')]?_['replace'](_0x360554[_0x8f7e2d[_0x11e13a][_0x6f2a('0x74')]],'%s',_0x52917a):_0x52917a;_0x52917a=_0x8f7e2d[_0x11e13a][_0x6f2a('0x7e')]?_[_0x6f2a('0x75')](_0x23e522[_0x8f7e2d[_0x11e13a][_0x6f2a('0x7e')]],'%s',_0x52917a):_0x52917a;if(_0x8f7e2d[_0x11e13a][_0x6f2a('0x76')]){_0x3d5a53[_0x6f2a('0x65')](_0x52917a);}_0x8f7e2d[_0x11e13a]['orderBy']&&_0x3d5a53['order'](_0x52917a,_0x8f7e2d[_0x11e13a][_0x6f2a('0x78')]===_0x6f2a('0x79')?![]:!![]);_0x3d5a53[_0x6f2a('0x73')](_0x52917a,_0x8f7e2d[_0x11e13a][_0x6f2a('0x7a')]||_0x52917a);}if(_0x24ae61['joins']){_0x24ae61['joins']=JSON[_0x6f2a('0x7c')](_0x24ae61[_0x6f2a('0x7b')]);for(var _0x1da35b=0x0;_0x1da35b<_0x24ae61[_0x6f2a('0x7b')][_0x6f2a('0x42')];_0x1da35b+=0x1){if(_0x24ae61[_0x6f2a('0x7b')][_0x1da35b]['type']&&_[_0x6f2a('0x5e')](_0xac64ab,_0x24ae61[_0x6f2a('0x7b')][_0x1da35b][_0x6f2a('0x39')])&&_0x24ae61[_0x6f2a('0x7b')][_0x1da35b][_0x6f2a('0x80')]&&_0x24ae61[_0x6f2a('0x7b')][_0x1da35b][_0x6f2a('0x7d')]&&_0x24ae61[_0x6f2a('0x7b')][_0x1da35b][_0x6f2a('0x81')]){_0x3d5a53[_0x24ae61[_0x6f2a('0x7b')][_0x1da35b][_0x6f2a('0x39')]](_0x24ae61[_0x6f2a('0x7b')][_0x1da35b]['foreignTable'],null,util[_0x6f2a('0x7e')](_0x6f2a('0x7f'),_0x24ae61[_0x6f2a('0x70')],_0x24ae61['joins'][_0x1da35b][_0x6f2a('0x80')],_0x24ae61[_0x6f2a('0x7b')][_0x1da35b]['foreignTable'],_0x24ae61[_0x6f2a('0x7b')][_0x1da35b]['foreignKey']));}}}if(_0x24ae61[_0x6f2a('0x82')]){_0x24ae61[_0x6f2a('0x82')]=JSON[_0x6f2a('0x7c')](_0x24ae61['conditions']);_0x3d5a53[_0x6f2a('0x34')](_0x410407(_0x24ae61['conditions'][_0x6f2a('0x65')]));}_0x78296=_0x3d5a53[_0x6f2a('0x83')]();_0x3d5a53['limit'](_0x3c954e);_0x3d5a53[_0x6f2a('0x19')](0x0);logger[_0x6f2a('0x84')](_0x6f2a('0x85'),_0x3d5a53['toString']());return db[_0x6f2a('0x86')][_0x6f2a('0x31')](_0x3d5a53[_0x6f2a('0x87')](),{'type':db['sequelize'][_0x6f2a('0x88')][_0x6f2a('0x8c')]});}})['then'](function(){return{'sql':_0x78296[_0x6f2a('0x87')]()};})[_0x6f2a('0x20')](respondWithResult(_0x38f7a6,null))['catch'](handleError(_0x38f7a6,null));};
\ No newline at end of file
+var _0x9c32=['%s.%s\x20=\x20%s.%s','No\x20available\x20data','output','web','fullPath','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','SELECT','run','runReport','COUNT(DISTINCT\x20%s)','debug','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','to-csv','squel','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','apply','save','then','destroy','get','CustomReports','UserProfileResource','error','stack','name','send','index','AnalyticCustomReport','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','findAll','rows','params','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%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)','includes','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','MetricId','function','replace','format','groupBy','orderBy','DESC','joins','parse','foreignTable','table','parentKey','foreignKey','conditions','clone','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','MAX(%s)','HOUR(%s)','IS\x20NOT\x20NULL','AnalyticMetric','from','metric','alias'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x9c32,0x15d));var _0x29c3=function(_0x47f66c,_0x3d59cd){_0x47f66c=_0x47f66c-0x0;var _0x4c55ef=_0x9c32[_0x47f66c];return _0x4c55ef;};'use strict';var pdf=require(_0x29c3('0x0'));var emlformat=require(_0x29c3('0x1'));var rimraf=require(_0x29c3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29c3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x29c3('0x4'));var Mustache=require(_0x29c3('0x5'));var util=require('util');var path=require(_0x29c3('0x6'));var sox=require('sox');var csv=require(_0x29c3('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x29c3('0x8'));var crypto=require(_0x29c3('0x9'));var jsforce=require(_0x29c3('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x29c3('0xb'));var authService=require(_0x29c3('0xc'));var hardwareService=require(_0x29c3('0xd'));var Redis=require(_0x29c3('0xe'));var qs=require(_0x29c3('0xf'));var logger=require(_0x29c3('0x10'))(_0x29c3('0x11'));var utils=require(_0x29c3('0x12'));var config=require(_0x29c3('0x13'));var db=require(_0x29c3('0x14'))['db'];function respondWithStatusCode(_0x4bed18,_0x3dfaa5){_0x3dfaa5=_0x3dfaa5||0xcc;return function(_0xfffa07){if(_0xfffa07){return _0x4bed18[_0x29c3('0x15')](_0x3dfaa5);}return _0x4bed18[_0x29c3('0x16')](_0x3dfaa5)[_0x29c3('0x17')]();};}function respondWithResult(_0x495ea7,_0x5c0e60){_0x5c0e60=_0x5c0e60||0xc8;return function(_0x49453d){if(_0x49453d){return _0x495ea7[_0x29c3('0x16')](_0x5c0e60)['json'](_0x49453d);}};}function respondWithFilteredResult(_0x2eb262,_0x2312a9){return function(_0x31a438){if(_0x31a438){var _0x407168=_0x31a438[_0x29c3('0x18')],_0x4314a=_0x2312a9[_0x29c3('0x19')],_0x1ba961=_0x2312a9['offset']+_0x2312a9[_0x29c3('0x1a')],_0x63d752;if(_0x1ba961>=_0x407168){_0x1ba961=_0x407168;_0x63d752=0xc8;}else{_0x63d752=0xce;}_0x2eb262[_0x29c3('0x16')](_0x63d752);return _0x2eb262['set'](_0x29c3('0x1b'),_0x4314a+'-'+_0x1ba961+'/'+_0x407168)['json'](_0x31a438);}return null;};}function patchUpdates(_0x23e4ce){return function(_0x5815c8){try{jsonpatch[_0x29c3('0x1c')](_0x5815c8,_0x23e4ce,!![]);}catch(_0x1a5ae6){return BPromise['reject'](_0x1a5ae6);}return _0x5815c8[_0x29c3('0x1d')]();};}function saveUpdates(_0x2bdd60,_0x128322){return function(_0x2bbe49){if(_0x2bbe49){return _0x2bbe49['update'](_0x2bdd60)[_0x29c3('0x1e')](function(_0x5843da){return _0x5843da;});}return null;};}function removeEntity(_0x13613b,_0x35281b){return function(_0x25ae6a){if(_0x25ae6a){return _0x25ae6a[_0x29c3('0x1f')]()['then'](function(){var _0x5cd9f5=_0x25ae6a[_0x29c3('0x20')]({'plain':!![]});var _0x220059=_0x29c3('0x21');return db[_0x29c3('0x22')][_0x29c3('0x1f')]({'where':{'type':_0x220059,'resourceId':_0x5cd9f5['id']}})[_0x29c3('0x1e')](function(){return _0x25ae6a;});})[_0x29c3('0x1e')](function(){_0x13613b['status'](0xcc)[_0x29c3('0x17')]();});}};}function handleEntityNotFound(_0x2d49e4,_0x5a2587){return function(_0x5ae231){if(!_0x5ae231){_0x2d49e4['sendStatus'](0x194);}return _0x5ae231;};}function handleError(_0x494f99,_0x2e6c77){_0x2e6c77=_0x2e6c77||0x1f4;return function(_0x2d7905){logger[_0x29c3('0x23')](_0x2d7905[_0x29c3('0x24')]);if(_0x2d7905[_0x29c3('0x25')]){delete _0x2d7905[_0x29c3('0x25')];}_0x494f99[_0x29c3('0x16')](_0x2e6c77)[_0x29c3('0x26')](_0x2d7905);};}exports[_0x29c3('0x27')]=function(_0x17d3bd,_0x2c02cc){var _0x4a6e63={},_0x4fa64f={},_0x33deb0={'count':0x0,'rows':[]};var _0x4a425a=db[_0x29c3('0x28')]['rawAttributes'];_0x4fa64f[_0x29c3('0x29')]=_['keys'](_0x4a425a);_0x4fa64f[_0x29c3('0x2a')]=_[_0x29c3('0x2b')](_0x17d3bd[_0x29c3('0x2a')]);_0x4fa64f[_0x29c3('0x2c')]=_[_0x29c3('0x2d')](_0x4fa64f[_0x29c3('0x29')],_0x4fa64f[_0x29c3('0x2a')]);_0x4a6e63['attributes']=_[_0x29c3('0x2d')](_0x4fa64f[_0x29c3('0x29')],qs[_0x29c3('0x2e')](_0x17d3bd['query'][_0x29c3('0x2e')]));_0x4a6e63[_0x29c3('0x2f')]=_0x4a6e63[_0x29c3('0x2f')][_0x29c3('0x30')]?_0x4a6e63[_0x29c3('0x2f')]:_0x4fa64f[_0x29c3('0x29')];if(!_0x17d3bd['query'][_0x29c3('0x31')](_0x29c3('0x32'))){_0x4a6e63['limit']=qs[_0x29c3('0x1a')](_0x17d3bd['query']['limit']);_0x4a6e63[_0x29c3('0x19')]=qs[_0x29c3('0x19')](_0x17d3bd[_0x29c3('0x2a')][_0x29c3('0x19')]);}_0x4a6e63[_0x29c3('0x33')]=qs['sort'](_0x17d3bd['query']['sort']);_0x4a6e63[_0x29c3('0x34')]=qs[_0x29c3('0x2c')](_['pick'](_0x17d3bd[_0x29c3('0x2a')],_0x4fa64f[_0x29c3('0x2c')]));if(_0x17d3bd['query'][_0x29c3('0x35')]){_0x4a6e63[_0x29c3('0x34')]=_[_0x29c3('0x36')](_0x4a6e63[_0x29c3('0x34')],{'$or':_[_0x29c3('0x37')](_0x4a425a,function(_0x3cb750){if(_0x3cb750[_0x29c3('0x38')][_0x29c3('0x39')]!==_0x29c3('0x3a')){var _0x1b272e={};_0x1b272e[_0x3cb750[_0x29c3('0x3b')]]={'$like':'%'+_0x17d3bd[_0x29c3('0x2a')][_0x29c3('0x35')]+'%'};return _0x1b272e;}})});}_0x4a6e63=_[_0x29c3('0x36')]({},_0x4a6e63,_0x17d3bd[_0x29c3('0x3c')]);var _0x5d8215={'where':_0x4a6e63['where']};return db['AnalyticCustomReport'][_0x29c3('0x18')](_0x5d8215)[_0x29c3('0x1e')](function(_0x5a0f94){_0x33deb0['count']=_0x5a0f94;if(_0x17d3bd[_0x29c3('0x2a')][_0x29c3('0x3d')]){_0x4a6e63['include']=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x29c3('0x3e')](_0x4a6e63);})[_0x29c3('0x1e')](function(_0x43beb4){_0x33deb0[_0x29c3('0x3f')]=_0x43beb4;return _0x33deb0;})[_0x29c3('0x1e')](respondWithFilteredResult(_0x2c02cc,_0x4a6e63))['catch'](handleError(_0x2c02cc,null));};exports['show']=function(_0x2d7e77,_0x4be859){var _0x40e838={'raw':![],'where':{'id':_0x2d7e77[_0x29c3('0x40')]['id']}},_0x255ec5={};_0x255ec5[_0x29c3('0x29')]=_[_0x29c3('0x2b')](db[_0x29c3('0x28')]['rawAttributes']);_0x255ec5[_0x29c3('0x2a')]=_['keys'](_0x2d7e77[_0x29c3('0x2a')]);_0x255ec5[_0x29c3('0x2c')]=_[_0x29c3('0x2d')](_0x255ec5['model'],_0x255ec5[_0x29c3('0x2a')]);_0x40e838[_0x29c3('0x2f')]=_[_0x29c3('0x2d')](_0x255ec5['model'],qs[_0x29c3('0x2e')](_0x2d7e77[_0x29c3('0x2a')]['fields']));_0x40e838['attributes']=_0x40e838[_0x29c3('0x2f')]['length']?_0x40e838[_0x29c3('0x2f')]:_0x255ec5['model'];if(_0x2d7e77[_0x29c3('0x2a')][_0x29c3('0x3d')]){_0x40e838[_0x29c3('0x41')]=[{'all':!![]}];}_0x40e838=_[_0x29c3('0x36')]({},_0x40e838,_0x2d7e77[_0x29c3('0x3c')]);return db[_0x29c3('0x28')][_0x29c3('0x42')](_0x40e838)[_0x29c3('0x1e')](handleEntityNotFound(_0x4be859,null))[_0x29c3('0x1e')](respondWithResult(_0x4be859,null))[_0x29c3('0x43')](handleError(_0x4be859,null));};exports[_0x29c3('0x44')]=function(_0x38e3c7,_0x2b3881){return db[_0x29c3('0x28')][_0x29c3('0x44')](_0x38e3c7[_0x29c3('0x45')],{})['then'](function(_0x2324ea){var _0x254a8b=_0x38e3c7[_0x29c3('0x46')][_0x29c3('0x20')]({'plain':!![]});if(!_0x254a8b)throw new Error(_0x29c3('0x47'));if(_0x254a8b[_0x29c3('0x48')]===_0x29c3('0x46')){var _0x2b6b71=_0x2324ea[_0x29c3('0x20')]({'plain':!![]});var _0x5a145e=_0x29c3('0x49');return db['UserProfileSection']['find']({'where':{'name':_0x5a145e,'userProfileId':_0x254a8b[_0x29c3('0x4a')]},'raw':!![]})[_0x29c3('0x1e')](function(_0x3f98ae){if(_0x3f98ae&&_0x3f98ae[_0x29c3('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x2b6b71[_0x29c3('0x25')],'resourceId':_0x2b6b71['id'],'type':_0x29c3('0x21'),'sectionId':_0x3f98ae['id']},{})[_0x29c3('0x1e')](function(){return _0x2324ea;});}else{return _0x2324ea;}})[_0x29c3('0x43')](function(_0x29ea3e){logger[_0x29c3('0x23')](_0x29c3('0x4c'),_0x29ea3e);throw _0x29ea3e;});}return _0x2324ea;})['then'](respondWithResult(_0x2b3881,0xc9))[_0x29c3('0x43')](handleError(_0x2b3881,null));};exports[_0x29c3('0x4d')]=function(_0x12c2a7,_0xa3edd0){if(_0x12c2a7[_0x29c3('0x45')]['id']){delete _0x12c2a7[_0x29c3('0x45')]['id'];}return db[_0x29c3('0x28')][_0x29c3('0x42')]({'where':{'id':_0x12c2a7['params']['id']}})['then'](handleEntityNotFound(_0xa3edd0,null))[_0x29c3('0x1e')](saveUpdates(_0x12c2a7['body'],null))[_0x29c3('0x1e')](respondWithResult(_0xa3edd0,null))['catch'](handleError(_0xa3edd0,null));};exports[_0x29c3('0x1f')]=function(_0x438063,_0x4a75c2){return db[_0x29c3('0x28')][_0x29c3('0x42')]({'where':{'id':_0x438063[_0x29c3('0x40')]['id']}})[_0x29c3('0x1e')](handleEntityNotFound(_0x4a75c2,null))['then'](removeEntity(_0x4a75c2,null))['catch'](handleError(_0x4a75c2,null));};exports[_0x29c3('0x4e')]=function(_0x49d216,_0x4bbd1f){var _0x524eff=0xa;var _0x3b6f79=[_0x29c3('0x4f'),_0x29c3('0x50'),'right_join',_0x29c3('0x51')];var _0x549039={'SUM':_0x29c3('0x52'),'COUNT':_0x29c3('0x53'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x29c3('0x54'),'AVG':_0x29c3('0x55'),'GROUP_CONCAT':_0x29c3('0x56'),'GROUP_CONCAT ASC':_0x29c3('0x57'),'GROUP_CONCAT DESC':_0x29c3('0x58')};var _0x1b9b25={'SEC_TO_TIME':_0x29c3('0x59'),'DATE':_0x29c3('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x29c3('0x5b'),'UNIX_TIMESTAMP':_0x29c3('0x5c')};var _0x4430a6=function(_0x2d0e0b){return!_[_0x29c3('0x5d')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x29c3('0x5e'),_0x29c3('0x5f')],_0x2d0e0b);};var _0x3e5c52=function(_0x3bc4ec){if(!_0x3bc4ec||!_0x3bc4ec['rules'][_0x29c3('0x30')]){return'';}for(var _0x1c03ca='(',_0x5fb069=0x0;_0x5fb069<_0x3bc4ec[_0x29c3('0x60')][_0x29c3('0x30')];_0x5fb069+=0x1){_0x5fb069>0x0&&(_0x1c03ca+='\x20'+_0x3bc4ec[_0x29c3('0x61')]+'\x20');_0x1c03ca+=_0x3bc4ec[_0x29c3('0x60')][_0x5fb069][_0x29c3('0x62')]?_0x3e5c52(_0x3bc4ec[_0x29c3('0x60')][_0x5fb069]['group']):_0x3bc4ec['rules'][_0x5fb069][_0x29c3('0x3b')]+'\x20'+_0x3bc4ec[_0x29c3('0x60')][_0x5fb069][_0x29c3('0x63')]+(_0x4430a6(_0x3bc4ec['rules'][_0x5fb069][_0x29c3('0x63')])?'\x20'+_0x3bc4ec['rules'][_0x5fb069][_0x29c3('0x64')]:'');}return _0x1c03ca+')';};var _0xec1004={'where':{'id':_0x49d216[_0x29c3('0x40')]['id']}},_0x18fd95,_0x19e2e1,_0x4eeb30,_0x92e5ea,_0x5e9553;_0xec1004=_['merge']({},_0xec1004,_0x49d216[_0x29c3('0x3c')]);return db[_0x29c3('0x28')][_0x29c3('0x42')](_0xec1004)['then'](function(_0x1e1e65){if(_0x1e1e65){_0x18fd95=_0x1e1e65;return _0x1e1e65[_0x29c3('0x65')]();}return null;})[_0x29c3('0x1e')](function(_0x4a0db5){if(_0x4a0db5){if(!_0x4a0db5['length']){throw new db[(_0x29c3('0x66'))][(_0x29c3('0x67'))](_0x29c3('0x68'),0x193);}_0x19e2e1=_0x4a0db5;return db['AnalyticMetric'][_0x29c3('0x3e')]({'raw':!![]});}return null;})[_0x29c3('0x1e')](function(_0x4c28a4){if(_0x4c28a4){_0x4eeb30=_[_0x29c3('0x69')](_0x4c28a4,'id');var _0x3b6f06;var _0x263a36=squel[_0x29c3('0x6a')]();_0x263a36['from'](_0x18fd95['table']);for(var _0x2dd05a=0x0;_0x2dd05a<_0x19e2e1[_0x29c3('0x30')];_0x2dd05a+=0x1){_0x3b6f06=_0x19e2e1[_0x2dd05a][_0x29c3('0x6b')]?_0x4eeb30[_0x19e2e1[_0x2dd05a][_0x29c3('0x6b')]]['metric']:_0x19e2e1[_0x2dd05a]['field'];_0x3b6f06=_0x19e2e1[_0x2dd05a][_0x29c3('0x6c')]?_[_0x29c3('0x6d')](_0x549039[_0x19e2e1[_0x2dd05a][_0x29c3('0x6c')]],'%s',_0x3b6f06):_0x3b6f06;_0x3b6f06=_0x19e2e1[_0x2dd05a]['format']?_[_0x29c3('0x6d')](_0x1b9b25[_0x19e2e1[_0x2dd05a][_0x29c3('0x6e')]],'%s',_0x3b6f06):_0x3b6f06;if(_0x19e2e1[_0x2dd05a][_0x29c3('0x6f')]){_0x263a36[_0x29c3('0x62')](_0x3b6f06);}_0x19e2e1[_0x2dd05a]['orderBy']&&_0x263a36[_0x29c3('0x33')](_0x3b6f06,_0x19e2e1[_0x2dd05a][_0x29c3('0x70')]===_0x29c3('0x71')?![]:!![]);_0x263a36[_0x29c3('0x3b')](_0x3b6f06,_0x19e2e1[_0x2dd05a]['alias']||_0x3b6f06);}if(_0x18fd95[_0x29c3('0x72')]){_0x18fd95[_0x29c3('0x72')]=JSON[_0x29c3('0x73')](_0x18fd95['joins']);for(var _0x115a5a=0x0;_0x115a5a<_0x18fd95[_0x29c3('0x72')]['length'];_0x115a5a+=0x1){if(_0x18fd95['joins'][_0x115a5a][_0x29c3('0x38')]&&_[_0x29c3('0x5d')](_0x3b6f79,_0x18fd95[_0x29c3('0x72')][_0x115a5a][_0x29c3('0x38')])&&_0x18fd95[_0x29c3('0x72')][_0x115a5a]['parentKey']&&_0x18fd95[_0x29c3('0x72')][_0x115a5a][_0x29c3('0x74')]&&_0x18fd95[_0x29c3('0x72')][_0x115a5a]['foreignKey']){_0x263a36[_0x18fd95[_0x29c3('0x72')][_0x115a5a][_0x29c3('0x38')]](_0x18fd95[_0x29c3('0x72')][_0x115a5a]['foreignTable'],null,util[_0x29c3('0x6e')]('%s.%s\x20=\x20%s.%s',_0x18fd95[_0x29c3('0x75')],_0x18fd95[_0x29c3('0x72')][_0x115a5a][_0x29c3('0x76')],_0x18fd95[_0x29c3('0x72')][_0x115a5a][_0x29c3('0x74')],_0x18fd95[_0x29c3('0x72')][_0x115a5a][_0x29c3('0x77')]));}}}if(_0x18fd95[_0x29c3('0x78')]){_0x18fd95[_0x29c3('0x78')]=JSON[_0x29c3('0x73')](_0x18fd95[_0x29c3('0x78')]);_0x263a36['where'](_0x3e5c52(_0x18fd95[_0x29c3('0x78')][_0x29c3('0x62')]));}_0x5e9553=_0x263a36[_0x29c3('0x79')]();_0x263a36[_0x29c3('0x1a')](_0x524eff);_0x263a36['offset'](0x0);logger['debug'](_0x29c3('0x7a'),_0x263a36['toString']());return db[_0x29c3('0x7b')][_0x29c3('0x2a')](_0x263a36[_0x29c3('0x7c')](),{'type':db[_0x29c3('0x7b')][_0x29c3('0x7d')]['SELECT']});}})[_0x29c3('0x1e')](respondWithResult(_0x4bbd1f,null))[_0x29c3('0x43')](handleError(_0x4bbd1f,null));};function runReport(_0x35dd60,_0x478f09,_0x231c3b){var _0x40c8c6=_0x478f09['name'];var _0x350b11=0xa;var _0xb83961=[_0x29c3('0x4f'),_0x29c3('0x50'),_0x29c3('0x7e'),_0x29c3('0x51')];var _0x5e332e={'SUM':_0x29c3('0x52'),'COUNT':_0x29c3('0x53'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x29c3('0x7f'),'MIN':_0x29c3('0x54'),'AVG':_0x29c3('0x55'),'GROUP_CONCAT':_0x29c3('0x56'),'GROUP_CONCAT ASC':_0x29c3('0x57'),'GROUP_CONCAT DESC':_0x29c3('0x58')};var _0x156172={'SEC_TO_TIME':_0x29c3('0x59'),'DATE':_0x29c3('0x5a'),'HOUR':_0x29c3('0x80'),'ROUND':_0x29c3('0x5b'),'UNIX_TIMESTAMP':_0x29c3('0x5c')};var _0x1c3caf=function(_0x3b3610){return!_[_0x29c3('0x5d')](['IS\x20NULL',_0x29c3('0x81'),_0x29c3('0x5e'),_0x29c3('0x5f')],_0x3b3610);};var _0x3c2137=function(_0x230265){if(!_0x230265||!_0x230265[_0x29c3('0x60')][_0x29c3('0x30')]){return'';}for(var _0x6d4e94='(',_0x11a7fa=0x0;_0x11a7fa<_0x230265[_0x29c3('0x60')][_0x29c3('0x30')];_0x11a7fa+=0x1){_0x11a7fa>0x0&&(_0x6d4e94+='\x20'+_0x230265[_0x29c3('0x61')]+'\x20');_0x6d4e94+=_0x230265[_0x29c3('0x60')][_0x11a7fa][_0x29c3('0x62')]?_0x3c2137(_0x230265[_0x29c3('0x60')][_0x11a7fa][_0x29c3('0x62')]):_0x230265['rules'][_0x11a7fa][_0x29c3('0x3b')]+'\x20'+_0x230265[_0x29c3('0x60')][_0x11a7fa][_0x29c3('0x63')]+(_0x1c3caf(_0x230265[_0x29c3('0x60')][_0x11a7fa][_0x29c3('0x63')])?'\x20'+_0x230265[_0x29c3('0x60')][_0x11a7fa][_0x29c3('0x64')]:'');}return _0x6d4e94+')';};var _0x3824bd={'where':{'id':_0x35dd60['id']}},_0x1999bd,_0xe357b2,_0x2d6710,_0x20fc3c,_0x3597c9;_0x3824bd=_[_0x29c3('0x36')]({},_0x3824bd,_0x231c3b);return db['AnalyticCustomReport'][_0x29c3('0x42')](_0x3824bd)[_0x29c3('0x1e')](function(_0x406f92){if(_0x406f92){_0x1999bd=_0x406f92;return _0x406f92[_0x29c3('0x65')]();}return null;})['then'](function(_0x278bd5){if(_0x278bd5){if(!_0x278bd5[_0x29c3('0x30')]){throw new db[(_0x29c3('0x66'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xe357b2=_0x278bd5;return db[_0x29c3('0x82')][_0x29c3('0x3e')]({'raw':!![]});}return null;})[_0x29c3('0x1e')](function(_0x55c602){if(_0x55c602){_0x2d6710=_['keyBy'](_0x55c602,'id');var _0x5081a7;var _0xcec186=squel[_0x29c3('0x6a')]();_0xcec186[_0x29c3('0x83')](_0x1999bd[_0x29c3('0x75')]);for(var _0x522d82=0x0;_0x522d82<_0xe357b2['length'];_0x522d82+=0x1){_0x5081a7=_0xe357b2[_0x522d82][_0x29c3('0x6b')]?_0x2d6710[_0xe357b2[_0x522d82][_0x29c3('0x6b')]][_0x29c3('0x84')]:_0xe357b2[_0x522d82][_0x29c3('0x3b')];_0x5081a7=_0xe357b2[_0x522d82][_0x29c3('0x6c')]?_[_0x29c3('0x6d')](_0x5e332e[_0xe357b2[_0x522d82]['function']],'%s',_0x5081a7):_0x5081a7;_0x5081a7=_0xe357b2[_0x522d82][_0x29c3('0x6e')]?_['replace'](_0x156172[_0xe357b2[_0x522d82]['format']],'%s',_0x5081a7):_0x5081a7;if(_0xe357b2[_0x522d82][_0x29c3('0x6f')]){_0xcec186[_0x29c3('0x62')](_0x5081a7);}_0xe357b2[_0x522d82][_0x29c3('0x70')]&&_0xcec186[_0x29c3('0x33')](_0x5081a7,_0xe357b2[_0x522d82][_0x29c3('0x70')]===_0x29c3('0x71')?![]:!![]);_0xcec186[_0x29c3('0x3b')](_0x5081a7,_0xe357b2[_0x522d82][_0x29c3('0x85')]||_0x5081a7);}if(_0x1999bd[_0x29c3('0x72')]){_0x1999bd['joins']=JSON['parse'](_0x1999bd[_0x29c3('0x72')]);for(var _0x1279c3=0x0;_0x1279c3<_0x1999bd[_0x29c3('0x72')][_0x29c3('0x30')];_0x1279c3+=0x1){if(_0x1999bd[_0x29c3('0x72')][_0x1279c3][_0x29c3('0x38')]&&_[_0x29c3('0x5d')](_0xb83961,_0x1999bd[_0x29c3('0x72')][_0x1279c3][_0x29c3('0x38')])&&_0x1999bd[_0x29c3('0x72')][_0x1279c3][_0x29c3('0x76')]&&_0x1999bd[_0x29c3('0x72')][_0x1279c3][_0x29c3('0x74')]&&_0x1999bd[_0x29c3('0x72')][_0x1279c3]['foreignKey']){_0xcec186[_0x1999bd[_0x29c3('0x72')][_0x1279c3]['type']](_0x1999bd[_0x29c3('0x72')][_0x1279c3][_0x29c3('0x74')],null,util[_0x29c3('0x6e')](_0x29c3('0x86'),_0x1999bd[_0x29c3('0x75')],_0x1999bd['joins'][_0x1279c3][_0x29c3('0x76')],_0x1999bd[_0x29c3('0x72')][_0x1279c3][_0x29c3('0x74')],_0x1999bd['joins'][_0x1279c3][_0x29c3('0x77')]));}}}if(_0x1999bd[_0x29c3('0x78')]){_0x1999bd[_0x29c3('0x78')]=JSON['parse'](_0x1999bd[_0x29c3('0x78')]);_0xcec186[_0x29c3('0x34')](_0x3c2137(_0x1999bd[_0x29c3('0x78')][_0x29c3('0x62')]));}_0x3597c9=_0xcec186['clone']();_0xcec186[_0x29c3('0x1a')](_0x350b11);_0xcec186[_0x29c3('0x19')](0x0);logger['debug'](_0x29c3('0x7a'),_0xcec186[_0x29c3('0x7c')]());return db[_0x29c3('0x7b')][_0x29c3('0x2a')](_0xcec186[_0x29c3('0x7c')](),{'type':db[_0x29c3('0x7b')]['QueryTypes']['SELECT']});}})[_0x29c3('0x1e')](function(_0x182c6f){if(!_0x182c6f[_0x29c3('0x30')]){throw new db[(_0x29c3('0x66'))][(_0x29c3('0x67'))](_0x29c3('0x87'),0xcc);}if(_0x478f09[_0x29c3('0x88')]===_0x29c3('0x89')){return null;}var _0x9c0566=_['merge'](_0x478f09,{'name':_0x478f09[_0x29c3('0x8a')]||_0x478f09[_0x29c3('0x25')]||_0x1999bd['name'],'basename':_0x40c8c6,'savename':util[_0x29c3('0x6e')]('%s-%s.%s',_0x478f09[_0x29c3('0x25')]||_0x1999bd['name'],require(_0x29c3('0x8b'))[_0x29c3('0x8c')](0x4),_0x478f09[_0x29c3('0x88')]||_0x29c3('0x8d')),'reportId':_0x1999bd['id'],'reportType':_0x29c3('0x8e')});return db[_0x29c3('0x8f')][_0x29c3('0x44')](_0x9c0566,{'raw':!![]});})['then'](function(_0x35623c){if(_0x1999bd[_0x29c3('0x75')]===_0x29c3('0x90')){_0x3597c9[_0x29c3('0x34')](_0x1999bd[_0x29c3('0x75')]+_0x29c3('0x91'),_0x478f09['startDate'],_0x478f09['endDate']);}else{_0x3597c9[_0x29c3('0x34')](_0x1999bd['table']+_0x29c3('0x92'),_0x478f09[_0x29c3('0x93')],_0x478f09[_0x29c3('0x94')]);}if(_0x35623c){logger['info'](_0x29c3('0x95'),_0x3597c9['toString']());require(_0x29c3('0x96'))[_0x29c3('0x97')](path[_0x29c3('0x4f')](__dirname,_0x29c3('0x98'),_0x35623c['output']),[_0x35623c['id'],_0x3597c9[_0x29c3('0x7c')](),path[_0x29c3('0x4f')](__dirname,_0x29c3('0x99'),_0x35623c[_0x29c3('0x9a')]),_0x40c8c6]);return _0x35623c;}else{var _0x1ac64a=squel[_0x29c3('0x6a')]();_0x1ac64a[_0x29c3('0x83')]('('+_0x3597c9[_0x29c3('0x7c')]()+')',_0x29c3('0x9b'));_0x1ac64a['field']('COUNT(*)','count');_0x3597c9[_0x29c3('0x1a')](_0x478f09[_0x29c3('0x1a')]||_0x350b11);_0x3597c9['offset'](_0x478f09[_0x29c3('0x19')]||0x0);return db[_0x29c3('0x7b')][_0x29c3('0x2a')](_0x1ac64a['toString'](),{'type':db['sequelize'][_0x29c3('0x7d')][_0x29c3('0x9c')]})['then'](function(_0x5838d9){if(!_0x5838d9['length']){_0x20fc3c=0x0;}else{_0x20fc3c=_0x5838d9[0x0][_0x29c3('0x18')]||0x0;}return db[_0x29c3('0x7b')][_0x29c3('0x2a')](_0x3597c9[_0x29c3('0x7c')](),{'type':db[_0x29c3('0x7b')][_0x29c3('0x7d')][_0x29c3('0x9c')]});})[_0x29c3('0x1e')](function(_0x2e1c7b){return{'rows':_0x2e1c7b||[],'count':_0x20fc3c};});}});}exports[_0x29c3('0x9d')]=function(_0x13cb5a,_0x99a997){return runReport(_0x13cb5a[_0x29c3('0x40')],_0x13cb5a[_0x29c3('0x2a')],_0x13cb5a[_0x29c3('0x3c')])[_0x29c3('0x1e')](respondWithResult(_0x99a997,null))[_0x29c3('0x43')](handleError(_0x99a997,null));};exports[_0x29c3('0x9e')]=runReport;exports[_0x29c3('0x2a')]=function(_0x34c011,_0x1beeac){var _0x5ccb15=0xa;var _0xeb32e9=[_0x29c3('0x4f'),_0x29c3('0x50'),_0x29c3('0x7e'),_0x29c3('0x51')];var _0x1c3ac0={'SUM':_0x29c3('0x52'),'COUNT':_0x29c3('0x53'),'COUNT DISTINCT':_0x29c3('0x9f'),'MAX':_0x29c3('0x7f'),'MIN':_0x29c3('0x54'),'AVG':_0x29c3('0x55'),'GROUP_CONCAT':_0x29c3('0x56'),'GROUP_CONCAT ASC':_0x29c3('0x57'),'GROUP_CONCAT DESC':_0x29c3('0x58')};var _0x2f3e6b={'SEC_TO_TIME':_0x29c3('0x59'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x29c3('0x5b'),'UNIX_TIMESTAMP':_0x29c3('0x5c')};var _0x48871e=function(_0x35347a){return!_[_0x29c3('0x5d')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0x29c3('0x5f')],_0x35347a);};var _0x750f7b=function(_0x1b4127){if(!_0x1b4127||!_0x1b4127[_0x29c3('0x60')][_0x29c3('0x30')]){return'';}for(var _0x13f95a='(',_0x28fdaf=0x0;_0x28fdaf<_0x1b4127['rules'][_0x29c3('0x30')];_0x28fdaf+=0x1){_0x28fdaf>0x0&&(_0x13f95a+='\x20'+_0x1b4127['operator']+'\x20');_0x13f95a+=_0x1b4127[_0x29c3('0x60')][_0x28fdaf]['group']?_0x750f7b(_0x1b4127[_0x29c3('0x60')][_0x28fdaf][_0x29c3('0x62')]):_0x1b4127['rules'][_0x28fdaf][_0x29c3('0x3b')]+'\x20'+_0x1b4127[_0x29c3('0x60')][_0x28fdaf]['condition']+(_0x48871e(_0x1b4127[_0x29c3('0x60')][_0x28fdaf]['condition'])?'\x20'+_0x1b4127[_0x29c3('0x60')][_0x28fdaf][_0x29c3('0x64')]:'');}return _0x13f95a+')';};var _0xb8f748={'where':{'id':_0x34c011[_0x29c3('0x40')]['id']}},_0x59dd0b,_0x195807,_0x2fd16c,_0x2446dd,_0x245b8f;_0xb8f748=_['merge']({},_0xb8f748,_0x34c011['options']);return db[_0x29c3('0x28')]['find'](_0xb8f748)['then'](function(_0x206833){if(_0x206833){_0x59dd0b=_0x206833;return _0x206833[_0x29c3('0x65')]();}return null;})[_0x29c3('0x1e')](function(_0xfff800){if(_0xfff800){if(!_0xfff800['length']){throw new db['Sequelize']['ValidationErrorItem'](_0x29c3('0x68'),0x193);}_0x195807=_0xfff800;return db[_0x29c3('0x82')][_0x29c3('0x3e')]({'raw':!![]});}return null;})[_0x29c3('0x1e')](function(_0x3eb608){if(_0x3eb608){_0x2fd16c=_[_0x29c3('0x69')](_0x3eb608,'id');var _0x49cf7a;var _0x51affb=squel['select']();_0x51affb[_0x29c3('0x83')](_0x59dd0b['table']);for(var _0x22bae5=0x0;_0x22bae5<_0x195807[_0x29c3('0x30')];_0x22bae5+=0x1){_0x49cf7a=_0x195807[_0x22bae5][_0x29c3('0x6b')]?_0x2fd16c[_0x195807[_0x22bae5][_0x29c3('0x6b')]][_0x29c3('0x84')]:_0x195807[_0x22bae5]['field'];_0x49cf7a=_0x195807[_0x22bae5][_0x29c3('0x6c')]?_['replace'](_0x1c3ac0[_0x195807[_0x22bae5]['function']],'%s',_0x49cf7a):_0x49cf7a;_0x49cf7a=_0x195807[_0x22bae5][_0x29c3('0x6e')]?_[_0x29c3('0x6d')](_0x2f3e6b[_0x195807[_0x22bae5][_0x29c3('0x6e')]],'%s',_0x49cf7a):_0x49cf7a;if(_0x195807[_0x22bae5][_0x29c3('0x6f')]){_0x51affb[_0x29c3('0x62')](_0x49cf7a);}_0x195807[_0x22bae5][_0x29c3('0x70')]&&_0x51affb[_0x29c3('0x33')](_0x49cf7a,_0x195807[_0x22bae5][_0x29c3('0x70')]===_0x29c3('0x71')?![]:!![]);_0x51affb['field'](_0x49cf7a,_0x195807[_0x22bae5][_0x29c3('0x85')]||_0x49cf7a);}if(_0x59dd0b[_0x29c3('0x72')]){_0x59dd0b['joins']=JSON['parse'](_0x59dd0b['joins']);for(var _0x602e48=0x0;_0x602e48<_0x59dd0b['joins']['length'];_0x602e48+=0x1){if(_0x59dd0b[_0x29c3('0x72')][_0x602e48][_0x29c3('0x38')]&&_[_0x29c3('0x5d')](_0xeb32e9,_0x59dd0b[_0x29c3('0x72')][_0x602e48][_0x29c3('0x38')])&&_0x59dd0b['joins'][_0x602e48][_0x29c3('0x76')]&&_0x59dd0b[_0x29c3('0x72')][_0x602e48][_0x29c3('0x74')]&&_0x59dd0b[_0x29c3('0x72')][_0x602e48][_0x29c3('0x77')]){_0x51affb[_0x59dd0b[_0x29c3('0x72')][_0x602e48][_0x29c3('0x38')]](_0x59dd0b[_0x29c3('0x72')][_0x602e48][_0x29c3('0x74')],null,util[_0x29c3('0x6e')](_0x29c3('0x86'),_0x59dd0b[_0x29c3('0x75')],_0x59dd0b[_0x29c3('0x72')][_0x602e48][_0x29c3('0x76')],_0x59dd0b[_0x29c3('0x72')][_0x602e48]['foreignTable'],_0x59dd0b[_0x29c3('0x72')][_0x602e48][_0x29c3('0x77')]));}}}if(_0x59dd0b['conditions']){_0x59dd0b[_0x29c3('0x78')]=JSON['parse'](_0x59dd0b[_0x29c3('0x78')]);_0x51affb[_0x29c3('0x34')](_0x750f7b(_0x59dd0b[_0x29c3('0x78')]['group']));}_0x245b8f=_0x51affb['clone']();_0x51affb[_0x29c3('0x1a')](_0x5ccb15);_0x51affb[_0x29c3('0x19')](0x0);logger[_0x29c3('0xa0')](_0x29c3('0x7a'),_0x51affb[_0x29c3('0x7c')]());return db[_0x29c3('0x7b')][_0x29c3('0x2a')](_0x51affb[_0x29c3('0x7c')](),{'type':db[_0x29c3('0x7b')][_0x29c3('0x7d')][_0x29c3('0x9c')]});}})[_0x29c3('0x1e')](function(){return{'sql':_0x245b8f[_0x29c3('0x7c')]()};})[_0x29c3('0x1e')](respondWithResult(_0x1beeac,null))[_0x29c3('0x43')](handleError(_0x1beeac,null));};
\ No newline at end of file
index 16f14c6..af6c8f9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7d26=['exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','api','moment','bluebird','request-promise','./analyticCustomReport.attributes'];(function(_0x3d4718,_0x5919fc){var _0x301cad=function(_0x53dcff){while(--_0x53dcff){_0x3d4718['push'](_0x3d4718['shift']());}};_0x301cad(++_0x5919fc);}(_0x7d26,0x9e));var _0x67d2=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x7d26[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x67d2('0x0'));var util=require(_0x67d2('0x1'));var logger=require('../../config/logger')(_0x67d2('0x2'));var moment=require(_0x67d2('0x3'));var BPromise=require(_0x67d2('0x4'));var rp=require(_0x67d2('0x5'));var attributes=require(_0x67d2('0x6'));module[_0x67d2('0x7')]=function(_0x30a50d,_0x3d71ae){return _0x30a50d[_0x67d2('0x8')](_0x67d2('0x9'),attributes,{'tableName':_0x67d2('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x3213=['./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x224ded,_0x1b2757){var _0x3f2c61=function(_0xb06dea){while(--_0xb06dea){_0x224ded['push'](_0x224ded['shift']());}};_0x3f2c61(++_0x1b2757);}(_0x3213,0xff));var _0x3321=function(_0x163156,_0x59a2bf){_0x163156=_0x163156-0x0;var _0x5ee18f=_0x3213[_0x163156];return _0x5ee18f;};'use strict';var _=require(_0x3321('0x0'));var util=require('util');var logger=require(_0x3321('0x1'))('api');var moment=require(_0x3321('0x2'));var BPromise=require(_0x3321('0x3'));var rp=require(_0x3321('0x4'));var attributes=require(_0x3321('0x5'));module[_0x3321('0x6')]=function(_0x290b3e,_0x38b11f){return _0x290b3e[_0x3321('0x7')](_0x3321('0x8'),attributes,{'tableName':_0x3321('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index e587d26..55f1538 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['http','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\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(_0x2e72ec,_0x46f1f1){var _0x1a5662=function(_0x33f247){while(--_0x33f247){_0x2e72ec['push'](_0x2e72ec['shift']());}};_0x1a5662(++_0x46f1f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\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(_0x1413e7,_0x1545ca){var _0x328bc2=function(_0x547633){while(--_0x547633){_0x1413e7['push'](_0x1413e7['shift']());}};_0x328bc2(++_0x1545ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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 d1bf410..250637b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0424=['put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','preview','run','/:id/query','query','post'];(function(_0x522a77,_0xf8615d){var _0x2a6305=function(_0x44748f){while(--_0x44748f){_0x522a77['push'](_0x522a77['shift']());}};_0x2a6305(++_0xf8615d);}(_0x0424,0x159));var _0x4042=function(_0x8cb724,_0x5e78d5){_0x8cb724=_0x8cb724-0x0;var _0x348d6f=_0x0424[_0x8cb724];return _0x348d6f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4042('0x0'));var timeout=require(_0x4042('0x1'));var express=require(_0x4042('0x2'));var router=express[_0x4042('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4042('0x4'));var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router[_0x4042('0x5')]('/',auth[_0x4042('0x6')](),controller[_0x4042('0x7')]);router[_0x4042('0x5')](_0x4042('0x8'),auth[_0x4042('0x6')](),controller[_0x4042('0x9')]);router['get']('/:id/preview',auth[_0x4042('0x6')](),controller[_0x4042('0xa')]);router[_0x4042('0x5')]('/:id/run',auth[_0x4042('0x6')](),controller[_0x4042('0xb')]);router[_0x4042('0x5')](_0x4042('0xc'),auth[_0x4042('0x6')](),controller[_0x4042('0xd')]);router[_0x4042('0xe')]('/',auth[_0x4042('0x6')](),controller['create']);router[_0x4042('0xf')](_0x4042('0x8'),auth['isAuthenticated'](),controller[_0x4042('0x10')]);router[_0x4042('0x11')](_0x4042('0x8'),auth[_0x4042('0x6')](),controller[_0x4042('0x12')]);module[_0x4042('0x13')]=router;
\ No newline at end of file
+var _0x1893=['query','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','run','/:id/query'];(function(_0x3e4eee,_0x240c0b){var _0x43fe5b=function(_0x43e5ad){while(--_0x43e5ad){_0x3e4eee['push'](_0x3e4eee['shift']());}};_0x43fe5b(++_0x240c0b);}(_0x1893,0xa2));var _0x3189=function(_0x2b2dd1,_0x2c6ac7){_0x2b2dd1=_0x2b2dd1-0x0;var _0x5d2ef5=_0x1893[_0x2b2dd1];return _0x5d2ef5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3189('0x0'));var timeout=require(_0x3189('0x1'));var express=require(_0x3189('0x2'));var router=express[_0x3189('0x3')]();var auth=require(_0x3189('0x4'));var interaction=require(_0x3189('0x5'));var config=require(_0x3189('0x6'));var controller=require('./analyticCustomReport.controller');router[_0x3189('0x7')]('/',auth[_0x3189('0x8')](),controller[_0x3189('0x9')]);router[_0x3189('0x7')](_0x3189('0xa'),auth[_0x3189('0x8')](),controller[_0x3189('0xb')]);router[_0x3189('0x7')]('/:id/preview',auth[_0x3189('0x8')](),controller['preview']);router[_0x3189('0x7')]('/:id/run',auth[_0x3189('0x8')](),controller[_0x3189('0xc')]);router[_0x3189('0x7')](_0x3189('0xd'),auth['isAuthenticated'](),controller[_0x3189('0xe')]);router[_0x3189('0xf')]('/',auth[_0x3189('0x8')](),controller[_0x3189('0x10')]);router[_0x3189('0x11')]('/:id',auth[_0x3189('0x8')](),controller[_0x3189('0x12')]);router[_0x3189('0x13')](_0x3189('0xa'),auth[_0x3189('0x8')](),controller[_0x3189('0x14')]);module[_0x3189('0x15')]=router;
\ No newline at end of file
index ec43360..82d2fa8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2493=['STRING','TEXT'];(function(_0x3e2924,_0x3b743f){var _0x1dc404=function(_0x5ab8c5){while(--_0x5ab8c5){_0x3e2924['push'](_0x3e2924['shift']());}};_0x1dc404(++_0x3b743f);}(_0x2493,0x1be));var _0x3249=function(_0x2f8316,_0x59c2a2){_0x2f8316=_0x2f8316-0x0;var _0x34368d=_0x2493[_0x2f8316];return _0x34368d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3249('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x3249('0x0')]},'parent':{'type':Sequelize[_0x3249('0x0')]},'table':{'type':Sequelize[_0x3249('0x0')]},'conditions':{'type':Sequelize[_0x3249('0x1')]},'joins':{'type':Sequelize['TEXT']}};
\ No newline at end of file
+var _0x7fb3=['sequelize','exports','STRING','TEXT'];(function(_0x16a758,_0x1828b5){var _0x45168b=function(_0x4606df){while(--_0x4606df){_0x16a758['push'](_0x16a758['shift']());}};_0x45168b(++_0x1828b5);}(_0x7fb3,0x190));var _0x37fb=function(_0x2c1114,_0x2a5c50){_0x2c1114=_0x2c1114-0x0;var _0x2b877c=_0x7fb3[_0x2c1114];return _0x2b877c;};'use strict';var Sequelize=require(_0x37fb('0x0'));module[_0x37fb('0x1')]={'name':{'type':Sequelize[_0x37fb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x37fb('0x2')]},'parent':{'type':Sequelize[_0x37fb('0x2')]},'table':{'type':Sequelize[_0x37fb('0x2')]},'conditions':{'type':Sequelize[_0x37fb('0x3')]},'joins':{'type':Sequelize['TEXT']}};
\ No newline at end of file
index a378c93..e8269b6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8ee2=['model','keys','query','intersection','fields','attributes','length','hasOwnProperty','order','where','filters','filter','merge','map','type','key','VIRTUAL','options','count','includeAll','findAll','rows','catch','params','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','AnalyticMetric','select','from','table','MetricId','function','replace','format','orderBy','DESC','parse','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','sequelize','QueryTypes','join','COUNT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20EMPTY','Sequelize','metric','groupBy','alias','debug','toString','SELECT','No\x20available\x20data','output','fullPath','%s-%s.%s','randomstring','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','run','SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','rimraf','zip-dir','request-promise','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','update','destroy','get','DefaultReports','UserProfileResource','then','error','stack','name','send','AnalyticDefaultReport','rawAttributes'];(function(_0x35a7c3,_0x95d27c){var _0x7c6316=function(_0x346a2c){while(--_0x346a2c){_0x35a7c3['push'](_0x35a7c3['shift']());}};_0x7c6316(++_0x95d27c);}(_0x8ee2,0x1b0));var _0x28ee=function(_0x591180,_0x41ec6a){_0x591180=_0x591180-0x0;var _0x1e5c47=_0x8ee2[_0x591180];return _0x1e5c47;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x28ee('0x0'));var zipdir=require(_0x28ee('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x28ee('0x2'));var moment=require('moment');var BPromise=require(_0x28ee('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x28ee('0x4'));var sox=require('sox');var csv=require(_0x28ee('0x5'));var ejs=require(_0x28ee('0x6'));var fs=require('fs');var _=require(_0x28ee('0x7'));var squel=require(_0x28ee('0x8'));var crypto=require(_0x28ee('0x9'));var jsforce=require(_0x28ee('0xa'));var deskjs=require(_0x28ee('0xb'));var toCsv=require(_0x28ee('0x5'));var querystring=require(_0x28ee('0xc'));var Papa=require('papaparse');var authService=require(_0x28ee('0xd'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x28ee('0xe'));var qs=require(_0x28ee('0xf'));var logger=require(_0x28ee('0x10'))(_0x28ee('0x11'));var utils=require(_0x28ee('0x12'));var config=require(_0x28ee('0x13'));var db=require(_0x28ee('0x14'))['db'];function respondWithStatusCode(_0x10d1b3,_0x20562e){_0x20562e=_0x20562e||0xcc;return function(_0x50f9f4){if(_0x50f9f4){return _0x10d1b3[_0x28ee('0x15')](_0x20562e);}return _0x10d1b3[_0x28ee('0x16')](_0x20562e)[_0x28ee('0x17')]();};}function respondWithResult(_0x34c445,_0x383e28){_0x383e28=_0x383e28||0xc8;return function(_0x56aa3d){if(_0x56aa3d){return _0x34c445[_0x28ee('0x16')](_0x383e28)['json'](_0x56aa3d);}};}function respondWithFilteredResult(_0x42e792,_0x1ac885){return function(_0x5a4cc5){if(_0x5a4cc5){var _0x1b2f29=_0x5a4cc5['count'],_0x433a73=_0x1ac885[_0x28ee('0x18')],_0x3ecd98=_0x1ac885[_0x28ee('0x18')]+_0x1ac885[_0x28ee('0x19')],_0x30acb1;if(_0x3ecd98>=_0x1b2f29){_0x3ecd98=_0x1b2f29;_0x30acb1=0xc8;}else{_0x30acb1=0xce;}_0x42e792[_0x28ee('0x16')](_0x30acb1);return _0x42e792[_0x28ee('0x1a')](_0x28ee('0x1b'),_0x433a73+'-'+_0x3ecd98+'/'+_0x1b2f29)[_0x28ee('0x1c')](_0x5a4cc5);}return null;};}function patchUpdates(_0x381204){return function(_0x51bd35){try{jsonpatch[_0x28ee('0x1d')](_0x51bd35,_0x381204,!![]);}catch(_0x4c3567){return BPromise['reject'](_0x4c3567);}return _0x51bd35['save']();};}function saveUpdates(_0x4368b5,_0x1c001a){return function(_0x2906f8){if(_0x2906f8){return _0x2906f8[_0x28ee('0x1e')](_0x4368b5)['then'](function(_0x2fdc8b){return _0x2fdc8b;});}return null;};}function removeEntity(_0x1d9feb,_0x17980a){return function(_0x170f66){if(_0x170f66){return _0x170f66[_0x28ee('0x1f')]()['then'](function(){var _0x4932e4=_0x170f66[_0x28ee('0x20')]({'plain':!![]});var _0x1b0efb=_0x28ee('0x21');return db[_0x28ee('0x22')][_0x28ee('0x1f')]({'where':{'type':_0x1b0efb,'resourceId':_0x4932e4['id']}})[_0x28ee('0x23')](function(){return _0x170f66;});})['then'](function(){_0x1d9feb['status'](0xcc)[_0x28ee('0x17')]();});}};}function handleEntityNotFound(_0x4910c4,_0x4a1bc3){return function(_0x30ff4e){if(!_0x30ff4e){_0x4910c4['sendStatus'](0x194);}return _0x30ff4e;};}function handleError(_0x169712,_0x4330a3){_0x4330a3=_0x4330a3||0x1f4;return function(_0x47c001){logger[_0x28ee('0x24')](_0x47c001[_0x28ee('0x25')]);if(_0x47c001[_0x28ee('0x26')]){delete _0x47c001[_0x28ee('0x26')];}_0x169712[_0x28ee('0x16')](_0x4330a3)[_0x28ee('0x27')](_0x47c001);};}exports['index']=function(_0x41c0a0,_0xc1f192){var _0x4ee392={},_0x10c7eb={},_0x270651={'count':0x0,'rows':[]};var _0x517c5a=db[_0x28ee('0x28')][_0x28ee('0x29')];_0x10c7eb[_0x28ee('0x2a')]=_[_0x28ee('0x2b')](_0x517c5a);_0x10c7eb['query']=_[_0x28ee('0x2b')](_0x41c0a0[_0x28ee('0x2c')]);_0x10c7eb['filters']=_[_0x28ee('0x2d')](_0x10c7eb[_0x28ee('0x2a')],_0x10c7eb[_0x28ee('0x2c')]);_0x4ee392['attributes']=_['intersection'](_0x10c7eb['model'],qs[_0x28ee('0x2e')](_0x41c0a0[_0x28ee('0x2c')]['fields']));_0x4ee392[_0x28ee('0x2f')]=_0x4ee392[_0x28ee('0x2f')][_0x28ee('0x30')]?_0x4ee392[_0x28ee('0x2f')]:_0x10c7eb[_0x28ee('0x2a')];if(!_0x41c0a0[_0x28ee('0x2c')][_0x28ee('0x31')]('nolimit')){_0x4ee392['limit']=qs[_0x28ee('0x19')](_0x41c0a0[_0x28ee('0x2c')][_0x28ee('0x19')]);_0x4ee392['offset']=qs[_0x28ee('0x18')](_0x41c0a0[_0x28ee('0x2c')][_0x28ee('0x18')]);}_0x4ee392[_0x28ee('0x32')]=qs['sort'](_0x41c0a0['query']['sort']);_0x4ee392[_0x28ee('0x33')]=qs[_0x28ee('0x34')](_['pick'](_0x41c0a0[_0x28ee('0x2c')],_0x10c7eb['filters']));if(_0x41c0a0[_0x28ee('0x2c')][_0x28ee('0x35')]){_0x4ee392['where']=_[_0x28ee('0x36')](_0x4ee392[_0x28ee('0x33')],{'$or':_[_0x28ee('0x37')](_0x517c5a,function(_0x1c21f5){if(_0x1c21f5[_0x28ee('0x38')][_0x28ee('0x39')]!==_0x28ee('0x3a')){var _0x3ae5dc={};_0x3ae5dc[_0x1c21f5['field']]={'$like':'%'+_0x41c0a0[_0x28ee('0x2c')][_0x28ee('0x35')]+'%'};return _0x3ae5dc;}})});}_0x4ee392=_[_0x28ee('0x36')]({},_0x4ee392,_0x41c0a0[_0x28ee('0x3b')]);var _0x4c2ab2={'where':_0x4ee392[_0x28ee('0x33')]};return db[_0x28ee('0x28')][_0x28ee('0x3c')](_0x4c2ab2)[_0x28ee('0x23')](function(_0x2e8d2b){_0x270651['count']=_0x2e8d2b;if(_0x41c0a0[_0x28ee('0x2c')][_0x28ee('0x3d')]){_0x4ee392['include']=[{'all':!![]}];}return db[_0x28ee('0x28')][_0x28ee('0x3e')](_0x4ee392);})[_0x28ee('0x23')](function(_0x1e249f){_0x270651[_0x28ee('0x3f')]=_0x1e249f;return _0x270651;})[_0x28ee('0x23')](respondWithFilteredResult(_0xc1f192,_0x4ee392))[_0x28ee('0x40')](handleError(_0xc1f192,null));};exports['show']=function(_0x3196b7,_0x27a57e){var _0x12792b={'raw':!![],'where':{'id':_0x3196b7[_0x28ee('0x41')]['id']}},_0x5b023a={};_0x5b023a[_0x28ee('0x2a')]=_['keys'](db[_0x28ee('0x28')][_0x28ee('0x29')]);_0x5b023a[_0x28ee('0x2c')]=_[_0x28ee('0x2b')](_0x3196b7['query']);_0x5b023a[_0x28ee('0x34')]=_['intersection'](_0x5b023a[_0x28ee('0x2a')],_0x5b023a['query']);_0x12792b[_0x28ee('0x2f')]=_[_0x28ee('0x2d')](_0x5b023a[_0x28ee('0x2a')],qs['fields'](_0x3196b7['query'][_0x28ee('0x2e')]));_0x12792b[_0x28ee('0x2f')]=_0x12792b[_0x28ee('0x2f')][_0x28ee('0x30')]?_0x12792b[_0x28ee('0x2f')]:_0x5b023a[_0x28ee('0x2a')];if(_0x3196b7['query'][_0x28ee('0x3d')]){_0x12792b[_0x28ee('0x42')]=[{'all':!![]}];}_0x12792b=_['merge']({},_0x12792b,_0x3196b7[_0x28ee('0x3b')]);return db[_0x28ee('0x28')]['find'](_0x12792b)[_0x28ee('0x23')](handleEntityNotFound(_0x27a57e,null))[_0x28ee('0x23')](respondWithResult(_0x27a57e,null))[_0x28ee('0x40')](handleError(_0x27a57e,null));};exports['create']=function(_0x69673d,_0x2252f8){return db['AnalyticDefaultReport'][_0x28ee('0x43')](_0x69673d[_0x28ee('0x44')],{})[_0x28ee('0x23')](function(_0x179826){var _0x4fa7d9=_0x69673d[_0x28ee('0x45')][_0x28ee('0x20')]({'plain':!![]});if(!_0x4fa7d9)throw new Error(_0x28ee('0x46'));if(_0x4fa7d9[_0x28ee('0x47')]===_0x28ee('0x45')){var _0x14defb=_0x179826[_0x28ee('0x20')]({'plain':!![]});var _0xf7a9d1=_0x28ee('0x48');return db[_0x28ee('0x49')][_0x28ee('0x4a')]({'where':{'name':_0xf7a9d1,'userProfileId':_0x4fa7d9[_0x28ee('0x4b')]},'raw':!![]})[_0x28ee('0x23')](function(_0x4ec1a6){if(_0x4ec1a6&&_0x4ec1a6[_0x28ee('0x4c')]===0x0){return db[_0x28ee('0x22')][_0x28ee('0x43')]({'name':_0x14defb[_0x28ee('0x26')],'resourceId':_0x14defb['id'],'type':_0x28ee('0x21'),'sectionId':_0x4ec1a6['id']},{})[_0x28ee('0x23')](function(){return _0x179826;});}else{return _0x179826;}})[_0x28ee('0x40')](function(_0x206655){logger[_0x28ee('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x206655);throw _0x206655;});}return _0x179826;})[_0x28ee('0x23')](respondWithResult(_0x2252f8,0xc9))[_0x28ee('0x40')](handleError(_0x2252f8,null));};exports[_0x28ee('0x1e')]=function(_0x97591b,_0x134586){if(_0x97591b[_0x28ee('0x44')]['id']){delete _0x97591b[_0x28ee('0x44')]['id'];}return db['AnalyticDefaultReport'][_0x28ee('0x4a')]({'where':{'id':_0x97591b[_0x28ee('0x41')]['id']}})[_0x28ee('0x23')](handleEntityNotFound(_0x134586,null))[_0x28ee('0x23')](saveUpdates(_0x97591b[_0x28ee('0x44')],null))[_0x28ee('0x23')](respondWithResult(_0x134586,null))[_0x28ee('0x40')](handleError(_0x134586,null));};exports[_0x28ee('0x1f')]=function(_0x4fa1e2,_0x4e63f4){return db[_0x28ee('0x28')][_0x28ee('0x4a')]({'where':{'id':_0x4fa1e2[_0x28ee('0x41')]['id']}})[_0x28ee('0x23')](handleEntityNotFound(_0x4e63f4,null))['then'](removeEntity(_0x4e63f4,null))['catch'](handleError(_0x4e63f4,null));};exports[_0x28ee('0x4d')]=function(_0x31150e,_0x1baa4c){var _0x2605e7=0xa;var _0x57b283=['join',_0x28ee('0x4e'),_0x28ee('0x4f'),_0x28ee('0x50')];var _0x1e058b={'SUM':_0x28ee('0x51'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x28ee('0x52'),'MAX':_0x28ee('0x53'),'MIN':_0x28ee('0x54'),'AVG':_0x28ee('0x55'),'GROUP_CONCAT':_0x28ee('0x56'),'GROUP_CONCAT ASC':_0x28ee('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3528a3={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x28ee('0x58'),'HOUR':_0x28ee('0x59'),'ROUND':_0x28ee('0x5a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x18607a=function(_0x2040fc){return!_[_0x28ee('0x5b')](['IS\x20NULL',_0x28ee('0x5c'),'IS\x20EMPTY',_0x28ee('0x5d')],_0x2040fc);};var _0xc0d94=function(_0x1aa526){if(!_0x1aa526||!_0x1aa526['rules']['length']){return'';}for(var _0x71ddae='(',_0x5017ae=0x0;_0x5017ae<_0x1aa526[_0x28ee('0x5e')][_0x28ee('0x30')];_0x5017ae+=0x1){_0x5017ae>0x0&&(_0x71ddae+='\x20'+_0x1aa526[_0x28ee('0x5f')]+'\x20');_0x71ddae+=_0x1aa526[_0x28ee('0x5e')][_0x5017ae][_0x28ee('0x60')]?_0xc0d94(_0x1aa526[_0x28ee('0x5e')][_0x5017ae][_0x28ee('0x60')]):_0x1aa526[_0x28ee('0x5e')][_0x5017ae][_0x28ee('0x61')]+'\x20'+_0x1aa526[_0x28ee('0x5e')][_0x5017ae]['condition']+(_0x18607a(_0x1aa526[_0x28ee('0x5e')][_0x5017ae][_0x28ee('0x62')])?'\x20'+_0x1aa526[_0x28ee('0x5e')][_0x5017ae][_0x28ee('0x63')]:'');}return _0x71ddae+')';};var _0x2cb04c={'where':{'id':_0x31150e[_0x28ee('0x41')]['id']}},_0x32bee4,_0x495e2a,_0x4c2e19,_0xb3b9b5,_0x14e999;_0x2cb04c=_[_0x28ee('0x36')]({},_0x2cb04c,_0x31150e['options']);return db[_0x28ee('0x28')][_0x28ee('0x4a')](_0x2cb04c)[_0x28ee('0x23')](function(_0x1ace2e){if(_0x1ace2e){_0x32bee4=_0x1ace2e;return _0x1ace2e[_0x28ee('0x64')]();}return null;})[_0x28ee('0x23')](function(_0x3afb90){if(_0x3afb90){if(!_0x3afb90[_0x28ee('0x30')]){throw new db['Sequelize'][(_0x28ee('0x65'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x495e2a=_0x3afb90;return db[_0x28ee('0x66')][_0x28ee('0x3e')]({'raw':!![]});}return null;})[_0x28ee('0x23')](function(_0x341d2f){if(_0x341d2f){_0x4c2e19=_['keyBy'](_0x341d2f,'id');var _0x3cd652;var _0x543307=squel[_0x28ee('0x67')]();_0x543307[_0x28ee('0x68')](_0x32bee4[_0x28ee('0x69')]);for(var _0x5bba8f=0x0;_0x5bba8f<_0x495e2a[_0x28ee('0x30')];_0x5bba8f+=0x1){_0x3cd652=_0x495e2a[_0x5bba8f][_0x28ee('0x6a')]?_0x4c2e19[_0x495e2a[_0x5bba8f][_0x28ee('0x6a')]]['metric']:_0x495e2a[_0x5bba8f][_0x28ee('0x61')];_0x3cd652=_0x495e2a[_0x5bba8f][_0x28ee('0x6b')]?_[_0x28ee('0x6c')](_0x1e058b[_0x495e2a[_0x5bba8f][_0x28ee('0x6b')]],'%s',_0x3cd652):_0x3cd652;_0x3cd652=_0x495e2a[_0x5bba8f]['format']?_[_0x28ee('0x6c')](_0x3528a3[_0x495e2a[_0x5bba8f][_0x28ee('0x6d')]],'%s',_0x3cd652):_0x3cd652;if(_0x495e2a[_0x5bba8f]['groupBy']){_0x543307['group'](_0x3cd652);}_0x495e2a[_0x5bba8f][_0x28ee('0x6e')]&&_0x543307[_0x28ee('0x32')](_0x3cd652,_0x495e2a[_0x5bba8f][_0x28ee('0x6e')]===_0x28ee('0x6f')?![]:!![]);_0x543307[_0x28ee('0x61')](_0x3cd652,_0x495e2a[_0x5bba8f]['alias']||_0x3cd652);}if(_0x32bee4['joins']){_0x32bee4['joins']=JSON[_0x28ee('0x70')](_0x32bee4[_0x28ee('0x71')]);for(var _0x5244e1=0x0;_0x5244e1<_0x32bee4[_0x28ee('0x71')]['length'];_0x5244e1+=0x1){if(_0x32bee4[_0x28ee('0x71')][_0x5244e1][_0x28ee('0x38')]&&_[_0x28ee('0x5b')](_0x57b283,_0x32bee4[_0x28ee('0x71')][_0x5244e1][_0x28ee('0x38')])&&_0x32bee4['joins'][_0x5244e1][_0x28ee('0x72')]&&_0x32bee4[_0x28ee('0x71')][_0x5244e1][_0x28ee('0x73')]&&_0x32bee4[_0x28ee('0x71')][_0x5244e1][_0x28ee('0x74')]){_0x543307[_0x32bee4[_0x28ee('0x71')][_0x5244e1][_0x28ee('0x38')]](_0x32bee4[_0x28ee('0x71')][_0x5244e1][_0x28ee('0x73')],null,util[_0x28ee('0x6d')](_0x28ee('0x75'),_0x32bee4[_0x28ee('0x69')],_0x32bee4[_0x28ee('0x71')][_0x5244e1][_0x28ee('0x72')],_0x32bee4[_0x28ee('0x71')][_0x5244e1][_0x28ee('0x73')],_0x32bee4[_0x28ee('0x71')][_0x5244e1][_0x28ee('0x74')]));}}}if(_0x32bee4[_0x28ee('0x76')]){_0x32bee4[_0x28ee('0x76')]=JSON[_0x28ee('0x70')](_0x32bee4[_0x28ee('0x76')]);_0x543307[_0x28ee('0x33')](_0xc0d94(_0x32bee4[_0x28ee('0x76')][_0x28ee('0x60')]));}_0x14e999=_0x543307[_0x28ee('0x77')]();_0x543307[_0x28ee('0x19')](_0x2605e7);_0x543307[_0x28ee('0x18')](0x0);logger['debug'](_0x28ee('0x78'),_0x543307['toString']());return db[_0x28ee('0x79')]['query'](_0x543307['toString'](),{'type':db[_0x28ee('0x79')][_0x28ee('0x7a')]['SELECT']});}})['then'](respondWithResult(_0x1baa4c,null))[_0x28ee('0x40')](handleError(_0x1baa4c,null));};function runReport(_0x21e2e3,_0x597a13,_0x9c03d6){var _0x4b7530=_0x597a13[_0x28ee('0x26')];var _0x278b77=0xa;var _0x44167a=[_0x28ee('0x7b'),_0x28ee('0x4e'),_0x28ee('0x4f'),'cross_join'];var _0x4573fb={'SUM':_0x28ee('0x51'),'COUNT':_0x28ee('0x7c'),'COUNT DISTINCT':_0x28ee('0x52'),'MAX':'MAX(%s)','MIN':_0x28ee('0x54'),'AVG':_0x28ee('0x55'),'GROUP_CONCAT':_0x28ee('0x56'),'GROUP_CONCAT ASC':_0x28ee('0x57'),'GROUP_CONCAT DESC':_0x28ee('0x7d')};var _0x7cb88c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x28ee('0x58'),'HOUR':_0x28ee('0x59'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x8317d8=function(_0x32ff3f){return!_[_0x28ee('0x5b')](['IS\x20NULL',_0x28ee('0x5c'),_0x28ee('0x7e'),_0x28ee('0x5d')],_0x32ff3f);};var _0x5cbb5e=function(_0x1ec472){if(!_0x1ec472||!_0x1ec472['rules']['length']){return'';}for(var _0x7c673='(',_0x103e6a=0x0;_0x103e6a<_0x1ec472[_0x28ee('0x5e')][_0x28ee('0x30')];_0x103e6a+=0x1){_0x103e6a>0x0&&(_0x7c673+='\x20'+_0x1ec472[_0x28ee('0x5f')]+'\x20');_0x7c673+=_0x1ec472['rules'][_0x103e6a][_0x28ee('0x60')]?_0x5cbb5e(_0x1ec472[_0x28ee('0x5e')][_0x103e6a]['group']):_0x1ec472[_0x28ee('0x5e')][_0x103e6a][_0x28ee('0x61')]+'\x20'+_0x1ec472[_0x28ee('0x5e')][_0x103e6a]['condition']+(_0x8317d8(_0x1ec472['rules'][_0x103e6a][_0x28ee('0x62')])?'\x20'+_0x1ec472[_0x28ee('0x5e')][_0x103e6a][_0x28ee('0x63')]:'');}return _0x7c673+')';};var _0x2073a3={'where':{'id':_0x21e2e3['id']}},_0x51000d,_0x3e4a7e,_0x5b111d,_0x4832db,_0x44b9d0;_0x2073a3=_[_0x28ee('0x36')]({},_0x2073a3,_0x9c03d6);return db['AnalyticDefaultReport'][_0x28ee('0x4a')](_0x2073a3)[_0x28ee('0x23')](function(_0x2deba5){if(_0x2deba5){_0x51000d=_0x2deba5;return _0x2deba5[_0x28ee('0x64')]();}return null;})['then'](function(_0x18c192){if(_0x18c192){if(!_0x18c192['length']){throw new db[(_0x28ee('0x7f'))][(_0x28ee('0x65'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3e4a7e=_0x18c192;return db[_0x28ee('0x66')]['findAll']({'raw':!![]});}return null;})[_0x28ee('0x23')](function(_0x269f90){if(_0x269f90){_0x5b111d=_['keyBy'](_0x269f90,'id');var _0x2f2598;var _0x30f444=squel[_0x28ee('0x67')]();_0x30f444[_0x28ee('0x68')](_0x51000d['table']);for(var _0x2a91f0=0x0;_0x2a91f0<_0x3e4a7e[_0x28ee('0x30')];_0x2a91f0+=0x1){_0x2f2598=_0x3e4a7e[_0x2a91f0][_0x28ee('0x6a')]?_0x5b111d[_0x3e4a7e[_0x2a91f0]['MetricId']][_0x28ee('0x80')]:_0x3e4a7e[_0x2a91f0][_0x28ee('0x61')];_0x2f2598=_0x3e4a7e[_0x2a91f0][_0x28ee('0x6b')]?_[_0x28ee('0x6c')](_0x4573fb[_0x3e4a7e[_0x2a91f0][_0x28ee('0x6b')]],'%s',_0x2f2598):_0x2f2598;_0x2f2598=_0x3e4a7e[_0x2a91f0][_0x28ee('0x6d')]?_[_0x28ee('0x6c')](_0x7cb88c[_0x3e4a7e[_0x2a91f0][_0x28ee('0x6d')]],'%s',_0x2f2598):_0x2f2598;if(_0x3e4a7e[_0x2a91f0][_0x28ee('0x81')]){_0x30f444[_0x28ee('0x60')](_0x2f2598);}_0x3e4a7e[_0x2a91f0][_0x28ee('0x6e')]&&_0x30f444['order'](_0x2f2598,_0x3e4a7e[_0x2a91f0][_0x28ee('0x6e')]==='DESC'?![]:!![]);_0x30f444['field'](_0x2f2598,_0x3e4a7e[_0x2a91f0][_0x28ee('0x82')]||_0x2f2598);}if(_0x51000d[_0x28ee('0x71')]){_0x51000d[_0x28ee('0x71')]=JSON[_0x28ee('0x70')](_0x51000d['joins']);for(var _0x12ab65=0x0;_0x12ab65<_0x51000d['joins']['length'];_0x12ab65+=0x1){if(_0x51000d[_0x28ee('0x71')][_0x12ab65]['type']&&_[_0x28ee('0x5b')](_0x44167a,_0x51000d[_0x28ee('0x71')][_0x12ab65][_0x28ee('0x38')])&&_0x51000d[_0x28ee('0x71')][_0x12ab65]['parentKey']&&_0x51000d[_0x28ee('0x71')][_0x12ab65][_0x28ee('0x73')]&&_0x51000d['joins'][_0x12ab65][_0x28ee('0x74')]){_0x30f444[_0x51000d[_0x28ee('0x71')][_0x12ab65][_0x28ee('0x38')]](_0x51000d[_0x28ee('0x71')][_0x12ab65][_0x28ee('0x73')],null,util[_0x28ee('0x6d')](_0x28ee('0x75'),_0x51000d[_0x28ee('0x69')],_0x51000d[_0x28ee('0x71')][_0x12ab65][_0x28ee('0x72')],_0x51000d['joins'][_0x12ab65][_0x28ee('0x73')],_0x51000d[_0x28ee('0x71')][_0x12ab65][_0x28ee('0x74')]));}}}if(_0x51000d[_0x28ee('0x76')]){_0x51000d['conditions']=JSON[_0x28ee('0x70')](_0x51000d[_0x28ee('0x76')]);_0x30f444['where'](_0x5cbb5e(_0x51000d[_0x28ee('0x76')][_0x28ee('0x60')]));}_0x44b9d0=_0x30f444['clone']();_0x30f444[_0x28ee('0x19')](_0x278b77);_0x30f444[_0x28ee('0x18')](0x0);logger[_0x28ee('0x83')](_0x28ee('0x78'),_0x30f444[_0x28ee('0x84')]());return db['sequelize']['query'](_0x30f444[_0x28ee('0x84')](),{'type':db[_0x28ee('0x79')]['QueryTypes'][_0x28ee('0x85')]});}})[_0x28ee('0x23')](function(_0x3d20c6){if(!_0x3d20c6['length']){throw new db['Sequelize'][(_0x28ee('0x65'))](_0x28ee('0x86'),0xcc);}if(_0x597a13[_0x28ee('0x87')]==='web'){return null;}var _0x51deda=_['merge'](_0x597a13,{'name':_0x597a13[_0x28ee('0x88')]||_0x597a13[_0x28ee('0x26')]||_0x51000d['name'],'basename':_0x4b7530,'savename':util[_0x28ee('0x6d')](_0x28ee('0x89'),_0x597a13[_0x28ee('0x26')]||_0x51000d[_0x28ee('0x26')],require(_0x28ee('0x8a'))['generate'](0x4),_0x597a13['output']||_0x28ee('0x8b')),'reportId':_0x51000d['id'],'reportType':_0x28ee('0x8c')});return db[_0x28ee('0x8d')][_0x28ee('0x43')](_0x51deda,{'raw':!![]});})['then'](function(_0x21ce48){if(_0x51000d['table']===_0x28ee('0x8e')){_0x44b9d0[_0x28ee('0x33')](_0x51000d[_0x28ee('0x69')]+_0x28ee('0x8f'),_0x597a13[_0x28ee('0x90')],_0x597a13['endDate']);}else{_0x44b9d0[_0x28ee('0x33')](_0x51000d[_0x28ee('0x69')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x597a13['startDate'],_0x597a13[_0x28ee('0x91')]);}if(_0x21ce48){logger[_0x28ee('0x92')](_0x28ee('0x93'),_0x44b9d0[_0x28ee('0x84')]());require(_0x28ee('0x94'))[_0x28ee('0x95')](path[_0x28ee('0x7b')](__dirname,'../../components/export/',_0x21ce48['output']),[_0x21ce48['id'],_0x44b9d0[_0x28ee('0x84')](),path[_0x28ee('0x7b')](__dirname,_0x28ee('0x96'),_0x21ce48[_0x28ee('0x97')]),_0x4b7530]);return _0x21ce48;}else{var _0x2a8b35=squel[_0x28ee('0x67')]();_0x2a8b35[_0x28ee('0x68')]('('+_0x44b9d0['toString']()+')','countTable');_0x2a8b35[_0x28ee('0x61')]('COUNT(*)','count');_0x44b9d0[_0x28ee('0x19')](_0x597a13[_0x28ee('0x19')]||_0x278b77);_0x44b9d0[_0x28ee('0x18')](_0x597a13['offset']||0x0);return db[_0x28ee('0x79')][_0x28ee('0x2c')](_0x2a8b35[_0x28ee('0x84')](),{'type':db['sequelize']['QueryTypes'][_0x28ee('0x85')]})['then'](function(_0x1706cf){if(!_0x1706cf[_0x28ee('0x30')]){_0x4832db=0x0;}else{_0x4832db=_0x1706cf[0x0][_0x28ee('0x3c')]||0x0;}return db['sequelize'][_0x28ee('0x2c')](_0x44b9d0[_0x28ee('0x84')](),{'type':db['sequelize'][_0x28ee('0x7a')][_0x28ee('0x85')]});})[_0x28ee('0x23')](function(_0x359be4){return{'rows':_0x359be4||[],'count':_0x4832db};});}});}exports[_0x28ee('0x98')]=function(_0x23ff19,_0x45d720){return runReport(_0x23ff19[_0x28ee('0x41')],_0x23ff19[_0x28ee('0x2c')],_0x23ff19[_0x28ee('0x3b')])[_0x28ee('0x23')](respondWithResult(_0x45d720,null))[_0x28ee('0x40')](handleError(_0x45d720,null));};exports['runReport']=runReport;exports[_0x28ee('0x2c')]=function(_0x58257d,_0x423917){var _0x46b881=0xa;var _0x347839=[_0x28ee('0x7b'),_0x28ee('0x4e'),_0x28ee('0x4f'),'cross_join'];var _0x5ea9d4={'SUM':_0x28ee('0x51'),'COUNT':_0x28ee('0x7c'),'COUNT DISTINCT':_0x28ee('0x52'),'MAX':_0x28ee('0x53'),'MIN':'MIN(%s)','AVG':_0x28ee('0x55'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x28ee('0x57'),'GROUP_CONCAT DESC':_0x28ee('0x7d')};var _0x43e24d={'SEC_TO_TIME':_0x28ee('0x99'),'DATE':_0x28ee('0x58'),'HOUR':_0x28ee('0x59'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x28ee('0x9a')};var _0xe9feeb=function(_0x16355d){return!_[_0x28ee('0x5b')]([_0x28ee('0x9b'),'IS\x20NOT\x20NULL',_0x28ee('0x7e'),_0x28ee('0x5d')],_0x16355d);};var _0x442c81=function(_0x14fa3c){if(!_0x14fa3c||!_0x14fa3c[_0x28ee('0x5e')][_0x28ee('0x30')]){return'';}for(var _0xb80a42='(',_0x4e67a8=0x0;_0x4e67a8<_0x14fa3c['rules']['length'];_0x4e67a8+=0x1){_0x4e67a8>0x0&&(_0xb80a42+='\x20'+_0x14fa3c[_0x28ee('0x5f')]+'\x20');_0xb80a42+=_0x14fa3c[_0x28ee('0x5e')][_0x4e67a8][_0x28ee('0x60')]?_0x442c81(_0x14fa3c['rules'][_0x4e67a8]['group']):_0x14fa3c[_0x28ee('0x5e')][_0x4e67a8][_0x28ee('0x61')]+'\x20'+_0x14fa3c[_0x28ee('0x5e')][_0x4e67a8][_0x28ee('0x62')]+(_0xe9feeb(_0x14fa3c['rules'][_0x4e67a8]['condition'])?'\x20'+_0x14fa3c[_0x28ee('0x5e')][_0x4e67a8][_0x28ee('0x63')]:'');}return _0xb80a42+')';};var _0x28900d={'where':{'id':_0x58257d[_0x28ee('0x41')]['id']}},_0x1728b5,_0x786e7c,_0x28dde7,_0x3dc3c8,_0x31a21c;_0x28900d=_[_0x28ee('0x36')]({},_0x28900d,_0x58257d['options']);return db['AnalyticDefaultReport'][_0x28ee('0x4a')](_0x28900d)[_0x28ee('0x23')](function(_0x2edbc6){if(_0x2edbc6){_0x1728b5=_0x2edbc6;return _0x2edbc6[_0x28ee('0x64')]();}return null;})[_0x28ee('0x23')](function(_0x4386d4){if(_0x4386d4){if(!_0x4386d4[_0x28ee('0x30')]){throw new db[(_0x28ee('0x7f'))][(_0x28ee('0x65'))](_0x28ee('0x9c'),0x193);}_0x786e7c=_0x4386d4;return db[_0x28ee('0x66')][_0x28ee('0x3e')]({'raw':!![]});}return null;})[_0x28ee('0x23')](function(_0x180131){if(_0x180131){_0x28dde7=_[_0x28ee('0x9d')](_0x180131,'id');var _0x4659aa;var _0x24e362=squel[_0x28ee('0x67')]();_0x24e362[_0x28ee('0x68')](_0x1728b5[_0x28ee('0x69')]);for(var _0x432a96=0x0;_0x432a96<_0x786e7c['length'];_0x432a96+=0x1){_0x4659aa=_0x786e7c[_0x432a96][_0x28ee('0x6a')]?_0x28dde7[_0x786e7c[_0x432a96]['MetricId']][_0x28ee('0x80')]:_0x786e7c[_0x432a96][_0x28ee('0x61')];_0x4659aa=_0x786e7c[_0x432a96][_0x28ee('0x6b')]?_[_0x28ee('0x6c')](_0x5ea9d4[_0x786e7c[_0x432a96][_0x28ee('0x6b')]],'%s',_0x4659aa):_0x4659aa;_0x4659aa=_0x786e7c[_0x432a96]['format']?_[_0x28ee('0x6c')](_0x43e24d[_0x786e7c[_0x432a96][_0x28ee('0x6d')]],'%s',_0x4659aa):_0x4659aa;if(_0x786e7c[_0x432a96]['groupBy']){_0x24e362[_0x28ee('0x60')](_0x4659aa);}_0x786e7c[_0x432a96]['orderBy']&&_0x24e362[_0x28ee('0x32')](_0x4659aa,_0x786e7c[_0x432a96][_0x28ee('0x6e')]===_0x28ee('0x6f')?![]:!![]);_0x24e362[_0x28ee('0x61')](_0x4659aa,_0x786e7c[_0x432a96][_0x28ee('0x82')]||_0x4659aa);}if(_0x1728b5[_0x28ee('0x71')]){_0x1728b5[_0x28ee('0x71')]=JSON[_0x28ee('0x70')](_0x1728b5[_0x28ee('0x71')]);for(var _0x30c5e7=0x0;_0x30c5e7<_0x1728b5['joins'][_0x28ee('0x30')];_0x30c5e7+=0x1){if(_0x1728b5['joins'][_0x30c5e7][_0x28ee('0x38')]&&_[_0x28ee('0x5b')](_0x347839,_0x1728b5[_0x28ee('0x71')][_0x30c5e7][_0x28ee('0x38')])&&_0x1728b5[_0x28ee('0x71')][_0x30c5e7][_0x28ee('0x72')]&&_0x1728b5['joins'][_0x30c5e7][_0x28ee('0x73')]&&_0x1728b5[_0x28ee('0x71')][_0x30c5e7][_0x28ee('0x74')]){_0x24e362[_0x1728b5[_0x28ee('0x71')][_0x30c5e7]['type']](_0x1728b5['joins'][_0x30c5e7][_0x28ee('0x73')],null,util[_0x28ee('0x6d')](_0x28ee('0x75'),_0x1728b5[_0x28ee('0x69')],_0x1728b5['joins'][_0x30c5e7][_0x28ee('0x72')],_0x1728b5['joins'][_0x30c5e7]['foreignTable'],_0x1728b5[_0x28ee('0x71')][_0x30c5e7][_0x28ee('0x74')]));}}}if(_0x1728b5['conditions']){_0x1728b5[_0x28ee('0x76')]=JSON['parse'](_0x1728b5['conditions']);_0x24e362[_0x28ee('0x33')](_0x442c81(_0x1728b5['conditions'][_0x28ee('0x60')]));}_0x31a21c=_0x24e362[_0x28ee('0x77')]();_0x24e362['limit'](_0x46b881);_0x24e362[_0x28ee('0x18')](0x0);logger[_0x28ee('0x83')](_0x28ee('0x78'),_0x24e362['toString']());return db[_0x28ee('0x79')]['query'](_0x24e362['toString'](),{'type':db[_0x28ee('0x79')][_0x28ee('0x7a')][_0x28ee('0x85')]});}})[_0x28ee('0x23')](function(){return{'sql':_0x31a21c['toString']()};})[_0x28ee('0x23')](respondWithResult(_0x423917,null))['catch'](handleError(_0x423917,null));};
\ No newline at end of file
+var _0xf811=['fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','COUNT(*)','run','runReport','getFields','alias','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','AnalyticDefaultReport','rawAttributes','model','keys','query','intersection','attributes','fields','nolimit','order','sort','filters','pick','type','field','filter','merge','options','where','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','userProfileId','autoAssociation','DefaultReports','preview','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','Sequelize','ValidationErrorItem','keyBy','select','from','MetricId','metric','function','replace','format','orderBy','DESC','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SUM(%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','UNIX_TIMESTAMP(%s)','value','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','groupBy','SELECT','No\x20available\x20data','output','web'];(function(_0x4a9948,_0x3ef774){var _0x11235c=function(_0x8c8dcb){while(--_0x8c8dcb){_0x4a9948['push'](_0x4a9948['shift']());}};_0x11235c(++_0x3ef774);}(_0xf811,0x159));var _0x1f81=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0xf811[_0x3826ad];return _0x17b900;};'use strict';var pdf=require(_0x1f81('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1f81('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1f81('0x2'));var rp=require(_0x1f81('0x3'));var moment=require(_0x1f81('0x4'));var BPromise=require(_0x1f81('0x5'));var Mustache=require(_0x1f81('0x6'));var util=require(_0x1f81('0x7'));var path=require(_0x1f81('0x8'));var sox=require(_0x1f81('0x9'));var csv=require(_0x1f81('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1f81('0xb'));var crypto=require(_0x1f81('0xc'));var jsforce=require(_0x1f81('0xd'));var deskjs=require(_0x1f81('0xe'));var toCsv=require(_0x1f81('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x1f81('0xf'));var hardwareService=require(_0x1f81('0x10'));var Redis=require('ioredis');var qs=require(_0x1f81('0x11'));var logger=require('../../config/logger')(_0x1f81('0x12'));var utils=require(_0x1f81('0x13'));var config=require(_0x1f81('0x14'));var db=require(_0x1f81('0x15'))['db'];function respondWithStatusCode(_0x5dcdf9,_0x3d44f7){_0x3d44f7=_0x3d44f7||0xcc;return function(_0x649161){if(_0x649161){return _0x5dcdf9[_0x1f81('0x16')](_0x3d44f7);}return _0x5dcdf9[_0x1f81('0x17')](_0x3d44f7)[_0x1f81('0x18')]();};}function respondWithResult(_0x493f7a,_0x5bef11){_0x5bef11=_0x5bef11||0xc8;return function(_0x195f71){if(_0x195f71){return _0x493f7a['status'](_0x5bef11)[_0x1f81('0x19')](_0x195f71);}};}function respondWithFilteredResult(_0x64c764,_0x44cdd8){return function(_0xebc17b){if(_0xebc17b){var _0x46a22e=_0xebc17b[_0x1f81('0x1a')],_0x1c45fb=_0x44cdd8[_0x1f81('0x1b')],_0x39984a=_0x44cdd8[_0x1f81('0x1b')]+_0x44cdd8[_0x1f81('0x1c')],_0x3784cc;if(_0x39984a>=_0x46a22e){_0x39984a=_0x46a22e;_0x3784cc=0xc8;}else{_0x3784cc=0xce;}_0x64c764[_0x1f81('0x17')](_0x3784cc);return _0x64c764['set'](_0x1f81('0x1d'),_0x1c45fb+'-'+_0x39984a+'/'+_0x46a22e)[_0x1f81('0x19')](_0xebc17b);}return null;};}function patchUpdates(_0x2352a6){return function(_0x3d069c){try{jsonpatch['apply'](_0x3d069c,_0x2352a6,!![]);}catch(_0x5146a5){return BPromise['reject'](_0x5146a5);}return _0x3d069c['save']();};}function saveUpdates(_0x5d2422,_0x527aa9){return function(_0x328a07){if(_0x328a07){return _0x328a07[_0x1f81('0x1e')](_0x5d2422)[_0x1f81('0x1f')](function(_0x4d5a69){return _0x4d5a69;});}return null;};}function removeEntity(_0x134109,_0x5d277b){return function(_0x2ecbab){if(_0x2ecbab){return _0x2ecbab[_0x1f81('0x20')]()['then'](function(){var _0xc0880=_0x2ecbab[_0x1f81('0x21')]({'plain':!![]});var _0x177d3d='DefaultReports';return db[_0x1f81('0x22')]['destroy']({'where':{'type':_0x177d3d,'resourceId':_0xc0880['id']}})[_0x1f81('0x1f')](function(){return _0x2ecbab;});})[_0x1f81('0x1f')](function(){_0x134109[_0x1f81('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4aa5ce,_0x4dd164){return function(_0x19247f){if(!_0x19247f){_0x4aa5ce[_0x1f81('0x16')](0x194);}return _0x19247f;};}function handleError(_0x5a5b8a,_0x5a2321){_0x5a2321=_0x5a2321||0x1f4;return function(_0x43154d){logger[_0x1f81('0x23')](_0x43154d[_0x1f81('0x24')]);if(_0x43154d[_0x1f81('0x25')]){delete _0x43154d[_0x1f81('0x25')];}_0x5a5b8a[_0x1f81('0x17')](_0x5a2321)[_0x1f81('0x26')](_0x43154d);};}exports[_0x1f81('0x27')]=function(_0x27731e,_0x5d1076){var _0x3857f6={},_0x436e89={},_0x1236aa={'count':0x0,'rows':[]};var _0x2da697=db[_0x1f81('0x28')][_0x1f81('0x29')];_0x436e89[_0x1f81('0x2a')]=_[_0x1f81('0x2b')](_0x2da697);_0x436e89[_0x1f81('0x2c')]=_[_0x1f81('0x2b')](_0x27731e[_0x1f81('0x2c')]);_0x436e89['filters']=_[_0x1f81('0x2d')](_0x436e89['model'],_0x436e89[_0x1f81('0x2c')]);_0x3857f6[_0x1f81('0x2e')]=_[_0x1f81('0x2d')](_0x436e89[_0x1f81('0x2a')],qs['fields'](_0x27731e[_0x1f81('0x2c')][_0x1f81('0x2f')]));_0x3857f6['attributes']=_0x3857f6[_0x1f81('0x2e')]['length']?_0x3857f6['attributes']:_0x436e89[_0x1f81('0x2a')];if(!_0x27731e[_0x1f81('0x2c')]['hasOwnProperty'](_0x1f81('0x30'))){_0x3857f6[_0x1f81('0x1c')]=qs[_0x1f81('0x1c')](_0x27731e[_0x1f81('0x2c')]['limit']);_0x3857f6[_0x1f81('0x1b')]=qs[_0x1f81('0x1b')](_0x27731e[_0x1f81('0x2c')][_0x1f81('0x1b')]);}_0x3857f6[_0x1f81('0x31')]=qs['sort'](_0x27731e[_0x1f81('0x2c')][_0x1f81('0x32')]);_0x3857f6['where']=qs[_0x1f81('0x33')](_[_0x1f81('0x34')](_0x27731e[_0x1f81('0x2c')],_0x436e89[_0x1f81('0x33')]));if(_0x27731e['query']['filter']){_0x3857f6['where']=_['merge'](_0x3857f6['where'],{'$or':_['map'](_0x2da697,function(_0x333129){if(_0x333129[_0x1f81('0x35')]['key']!=='VIRTUAL'){var _0x5daec3={};_0x5daec3[_0x333129[_0x1f81('0x36')]]={'$like':'%'+_0x27731e[_0x1f81('0x2c')][_0x1f81('0x37')]+'%'};return _0x5daec3;}})});}_0x3857f6=_[_0x1f81('0x38')]({},_0x3857f6,_0x27731e[_0x1f81('0x39')]);var _0x5c9e64={'where':_0x3857f6[_0x1f81('0x3a')]};return db['AnalyticDefaultReport'][_0x1f81('0x1a')](_0x5c9e64)['then'](function(_0x46d457){_0x1236aa[_0x1f81('0x1a')]=_0x46d457;if(_0x27731e[_0x1f81('0x2c')][_0x1f81('0x3b')]){_0x3857f6[_0x1f81('0x3c')]=[{'all':!![]}];}return db[_0x1f81('0x28')][_0x1f81('0x3d')](_0x3857f6);})[_0x1f81('0x1f')](function(_0x141d16){_0x1236aa[_0x1f81('0x3e')]=_0x141d16;return _0x1236aa;})[_0x1f81('0x1f')](respondWithFilteredResult(_0x5d1076,_0x3857f6))[_0x1f81('0x3f')](handleError(_0x5d1076,null));};exports[_0x1f81('0x40')]=function(_0x58c488,_0x3b4217){var _0x58402f={'raw':!![],'where':{'id':_0x58c488[_0x1f81('0x41')]['id']}},_0x1f4a74={};_0x1f4a74[_0x1f81('0x2a')]=_[_0x1f81('0x2b')](db['AnalyticDefaultReport']['rawAttributes']);_0x1f4a74[_0x1f81('0x2c')]=_[_0x1f81('0x2b')](_0x58c488['query']);_0x1f4a74[_0x1f81('0x33')]=_[_0x1f81('0x2d')](_0x1f4a74['model'],_0x1f4a74['query']);_0x58402f[_0x1f81('0x2e')]=_[_0x1f81('0x2d')](_0x1f4a74[_0x1f81('0x2a')],qs[_0x1f81('0x2f')](_0x58c488['query'][_0x1f81('0x2f')]));_0x58402f[_0x1f81('0x2e')]=_0x58402f[_0x1f81('0x2e')][_0x1f81('0x42')]?_0x58402f[_0x1f81('0x2e')]:_0x1f4a74[_0x1f81('0x2a')];if(_0x58c488[_0x1f81('0x2c')][_0x1f81('0x3b')]){_0x58402f[_0x1f81('0x3c')]=[{'all':!![]}];}_0x58402f=_[_0x1f81('0x38')]({},_0x58402f,_0x58c488[_0x1f81('0x39')]);return db[_0x1f81('0x28')][_0x1f81('0x43')](_0x58402f)[_0x1f81('0x1f')](handleEntityNotFound(_0x3b4217,null))[_0x1f81('0x1f')](respondWithResult(_0x3b4217,null))[_0x1f81('0x3f')](handleError(_0x3b4217,null));};exports['create']=function(_0x3b69a8,_0x12f4fb){return db['AnalyticDefaultReport'][_0x1f81('0x44')](_0x3b69a8[_0x1f81('0x45')],{})[_0x1f81('0x1f')](function(_0x45c98f){var _0x562457=_0x3b69a8[_0x1f81('0x46')]['get']({'plain':!![]});if(!_0x562457)throw new Error(_0x1f81('0x47'));if(_0x562457['role']===_0x1f81('0x46')){var _0xfd77f3=_0x45c98f[_0x1f81('0x21')]({'plain':!![]});var _0x8a8a87=_0x1f81('0x48');return db['UserProfileSection']['find']({'where':{'name':_0x8a8a87,'userProfileId':_0x562457[_0x1f81('0x49')]},'raw':!![]})['then'](function(_0x3d98c0){if(_0x3d98c0&&_0x3d98c0[_0x1f81('0x4a')]===0x0){return db['UserProfileResource']['create']({'name':_0xfd77f3[_0x1f81('0x25')],'resourceId':_0xfd77f3['id'],'type':_0x1f81('0x4b'),'sectionId':_0x3d98c0['id']},{})[_0x1f81('0x1f')](function(){return _0x45c98f;});}else{return _0x45c98f;}})[_0x1f81('0x3f')](function(_0x3407b4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3407b4);throw _0x3407b4;});}return _0x45c98f;})[_0x1f81('0x1f')](respondWithResult(_0x12f4fb,0xc9))[_0x1f81('0x3f')](handleError(_0x12f4fb,null));};exports[_0x1f81('0x1e')]=function(_0x249322,_0x9689b7){if(_0x249322['body']['id']){delete _0x249322['body']['id'];}return db[_0x1f81('0x28')][_0x1f81('0x43')]({'where':{'id':_0x249322[_0x1f81('0x41')]['id']}})['then'](handleEntityNotFound(_0x9689b7,null))[_0x1f81('0x1f')](saveUpdates(_0x249322['body'],null))[_0x1f81('0x1f')](respondWithResult(_0x9689b7,null))['catch'](handleError(_0x9689b7,null));};exports[_0x1f81('0x20')]=function(_0x14a051,_0x1e7617){return db[_0x1f81('0x28')][_0x1f81('0x43')]({'where':{'id':_0x14a051['params']['id']}})[_0x1f81('0x1f')](handleEntityNotFound(_0x1e7617,null))[_0x1f81('0x1f')](removeEntity(_0x1e7617,null))[_0x1f81('0x3f')](handleError(_0x1e7617,null));};exports[_0x1f81('0x4c')]=function(_0x264692,_0x5e434d){var _0xf901de=0xa;var _0xf26f37=[_0x1f81('0x4d'),_0x1f81('0x4e'),_0x1f81('0x4f'),_0x1f81('0x50')];var _0x167943={'SUM':'SUM(%s)','COUNT':_0x1f81('0x51'),'COUNT DISTINCT':_0x1f81('0x52'),'MAX':'MAX(%s)','MIN':_0x1f81('0x53'),'AVG':_0x1f81('0x54'),'GROUP_CONCAT':_0x1f81('0x55'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x1f81('0x56')};var _0x563367={'SEC_TO_TIME':_0x1f81('0x57'),'DATE':_0x1f81('0x58'),'HOUR':_0x1f81('0x59'),'ROUND':_0x1f81('0x5a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x292f8c=function(_0x4ef5c0){return!_[_0x1f81('0x5b')]([_0x1f81('0x5c'),_0x1f81('0x5d'),_0x1f81('0x5e'),_0x1f81('0x5f')],_0x4ef5c0);};var _0x2851a4=function(_0x13822d){if(!_0x13822d||!_0x13822d[_0x1f81('0x60')][_0x1f81('0x42')]){return'';}for(var _0x508a85='(',_0x19c256=0x0;_0x19c256<_0x13822d[_0x1f81('0x60')][_0x1f81('0x42')];_0x19c256+=0x1){_0x19c256>0x0&&(_0x508a85+='\x20'+_0x13822d[_0x1f81('0x61')]+'\x20');_0x508a85+=_0x13822d[_0x1f81('0x60')][_0x19c256]['group']?_0x2851a4(_0x13822d[_0x1f81('0x60')][_0x19c256][_0x1f81('0x62')]):_0x13822d['rules'][_0x19c256][_0x1f81('0x36')]+'\x20'+_0x13822d[_0x1f81('0x60')][_0x19c256][_0x1f81('0x63')]+(_0x292f8c(_0x13822d[_0x1f81('0x60')][_0x19c256][_0x1f81('0x63')])?'\x20'+_0x13822d[_0x1f81('0x60')][_0x19c256]['value']:'');}return _0x508a85+')';};var _0x68e5bf={'where':{'id':_0x264692['params']['id']}},_0x190a2a,_0x2d793e,_0x575157,_0x6db9e4,_0x246112;_0x68e5bf=_['merge']({},_0x68e5bf,_0x264692[_0x1f81('0x39')]);return db[_0x1f81('0x28')][_0x1f81('0x43')](_0x68e5bf)['then'](function(_0x2d051c){if(_0x2d051c){_0x190a2a=_0x2d051c;return _0x2d051c['getFields']();}return null;})[_0x1f81('0x1f')](function(_0xbbc037){if(_0xbbc037){if(!_0xbbc037[_0x1f81('0x42')]){throw new db[(_0x1f81('0x64'))][(_0x1f81('0x65'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d793e=_0xbbc037;return db['AnalyticMetric'][_0x1f81('0x3d')]({'raw':!![]});}return null;})[_0x1f81('0x1f')](function(_0x4d2075){if(_0x4d2075){_0x575157=_[_0x1f81('0x66')](_0x4d2075,'id');var _0x8c663b;var _0x1b3138=squel[_0x1f81('0x67')]();_0x1b3138[_0x1f81('0x68')](_0x190a2a['table']);for(var _0x1f378a=0x0;_0x1f378a<_0x2d793e[_0x1f81('0x42')];_0x1f378a+=0x1){_0x8c663b=_0x2d793e[_0x1f378a][_0x1f81('0x69')]?_0x575157[_0x2d793e[_0x1f378a][_0x1f81('0x69')]][_0x1f81('0x6a')]:_0x2d793e[_0x1f378a][_0x1f81('0x36')];_0x8c663b=_0x2d793e[_0x1f378a][_0x1f81('0x6b')]?_[_0x1f81('0x6c')](_0x167943[_0x2d793e[_0x1f378a]['function']],'%s',_0x8c663b):_0x8c663b;_0x8c663b=_0x2d793e[_0x1f378a][_0x1f81('0x6d')]?_[_0x1f81('0x6c')](_0x563367[_0x2d793e[_0x1f378a]['format']],'%s',_0x8c663b):_0x8c663b;if(_0x2d793e[_0x1f378a]['groupBy']){_0x1b3138['group'](_0x8c663b);}_0x2d793e[_0x1f378a][_0x1f81('0x6e')]&&_0x1b3138[_0x1f81('0x31')](_0x8c663b,_0x2d793e[_0x1f378a][_0x1f81('0x6e')]===_0x1f81('0x6f')?![]:!![]);_0x1b3138[_0x1f81('0x36')](_0x8c663b,_0x2d793e[_0x1f378a]['alias']||_0x8c663b);}if(_0x190a2a[_0x1f81('0x70')]){_0x190a2a['joins']=JSON[_0x1f81('0x71')](_0x190a2a[_0x1f81('0x70')]);for(var _0x102ad9=0x0;_0x102ad9<_0x190a2a[_0x1f81('0x70')][_0x1f81('0x42')];_0x102ad9+=0x1){if(_0x190a2a[_0x1f81('0x70')][_0x102ad9][_0x1f81('0x35')]&&_[_0x1f81('0x5b')](_0xf26f37,_0x190a2a[_0x1f81('0x70')][_0x102ad9][_0x1f81('0x35')])&&_0x190a2a['joins'][_0x102ad9][_0x1f81('0x72')]&&_0x190a2a['joins'][_0x102ad9][_0x1f81('0x73')]&&_0x190a2a[_0x1f81('0x70')][_0x102ad9][_0x1f81('0x74')]){_0x1b3138[_0x190a2a[_0x1f81('0x70')][_0x102ad9][_0x1f81('0x35')]](_0x190a2a[_0x1f81('0x70')][_0x102ad9][_0x1f81('0x73')],null,util[_0x1f81('0x6d')](_0x1f81('0x75'),_0x190a2a[_0x1f81('0x76')],_0x190a2a[_0x1f81('0x70')][_0x102ad9][_0x1f81('0x72')],_0x190a2a['joins'][_0x102ad9][_0x1f81('0x73')],_0x190a2a['joins'][_0x102ad9][_0x1f81('0x74')]));}}}if(_0x190a2a[_0x1f81('0x77')]){_0x190a2a[_0x1f81('0x77')]=JSON[_0x1f81('0x71')](_0x190a2a[_0x1f81('0x77')]);_0x1b3138[_0x1f81('0x3a')](_0x2851a4(_0x190a2a['conditions'][_0x1f81('0x62')]));}_0x246112=_0x1b3138[_0x1f81('0x78')]();_0x1b3138['limit'](_0xf901de);_0x1b3138[_0x1f81('0x1b')](0x0);logger[_0x1f81('0x79')](_0x1f81('0x7a'),_0x1b3138[_0x1f81('0x7b')]());return db[_0x1f81('0x7c')][_0x1f81('0x2c')](_0x1b3138['toString'](),{'type':db[_0x1f81('0x7c')][_0x1f81('0x7d')]['SELECT']});}})[_0x1f81('0x1f')](respondWithResult(_0x5e434d,null))[_0x1f81('0x3f')](handleError(_0x5e434d,null));};function runReport(_0x2c699b,_0x44c592,_0x1a9925){var _0x15c58b=_0x44c592[_0x1f81('0x25')];var _0x1c599d=0xa;var _0x205d02=['join',_0x1f81('0x4e'),_0x1f81('0x4f'),_0x1f81('0x50')];var _0x1c3719={'SUM':_0x1f81('0x7e'),'COUNT':_0x1f81('0x51'),'COUNT DISTINCT':_0x1f81('0x52'),'MAX':_0x1f81('0x7f'),'MIN':_0x1f81('0x53'),'AVG':_0x1f81('0x54'),'GROUP_CONCAT':_0x1f81('0x55'),'GROUP_CONCAT ASC':_0x1f81('0x80'),'GROUP_CONCAT DESC':_0x1f81('0x56')};var _0x4f5855={'SEC_TO_TIME':_0x1f81('0x57'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x1f81('0x81')};var _0x59be15=function(_0x1cd935){return!_[_0x1f81('0x5b')](['IS\x20NULL',_0x1f81('0x5d'),_0x1f81('0x5e'),_0x1f81('0x5f')],_0x1cd935);};var _0x4f7c54=function(_0x1263d3){if(!_0x1263d3||!_0x1263d3[_0x1f81('0x60')][_0x1f81('0x42')]){return'';}for(var _0x13f2f7='(',_0x1a1f12=0x0;_0x1a1f12<_0x1263d3['rules']['length'];_0x1a1f12+=0x1){_0x1a1f12>0x0&&(_0x13f2f7+='\x20'+_0x1263d3[_0x1f81('0x61')]+'\x20');_0x13f2f7+=_0x1263d3[_0x1f81('0x60')][_0x1a1f12][_0x1f81('0x62')]?_0x4f7c54(_0x1263d3[_0x1f81('0x60')][_0x1a1f12][_0x1f81('0x62')]):_0x1263d3['rules'][_0x1a1f12][_0x1f81('0x36')]+'\x20'+_0x1263d3['rules'][_0x1a1f12][_0x1f81('0x63')]+(_0x59be15(_0x1263d3['rules'][_0x1a1f12][_0x1f81('0x63')])?'\x20'+_0x1263d3[_0x1f81('0x60')][_0x1a1f12][_0x1f81('0x82')]:'');}return _0x13f2f7+')';};var _0x5188d6={'where':{'id':_0x2c699b['id']}},_0x335c32,_0x58a61d,_0x314fcd,_0x5c08c3,_0x1ffd68;_0x5188d6=_[_0x1f81('0x38')]({},_0x5188d6,_0x1a9925);return db[_0x1f81('0x28')]['find'](_0x5188d6)[_0x1f81('0x1f')](function(_0x42c9aa){if(_0x42c9aa){_0x335c32=_0x42c9aa;return _0x42c9aa['getFields']();}return null;})[_0x1f81('0x1f')](function(_0x20df9d){if(_0x20df9d){if(!_0x20df9d[_0x1f81('0x42')]){throw new db[(_0x1f81('0x64'))][(_0x1f81('0x65'))](_0x1f81('0x83'),0x193);}_0x58a61d=_0x20df9d;return db[_0x1f81('0x84')]['findAll']({'raw':!![]});}return null;})[_0x1f81('0x1f')](function(_0x53eb46){if(_0x53eb46){_0x314fcd=_[_0x1f81('0x66')](_0x53eb46,'id');var _0x5eccf3;var _0x18dcea=squel[_0x1f81('0x67')]();_0x18dcea[_0x1f81('0x68')](_0x335c32[_0x1f81('0x76')]);for(var _0x12158b=0x0;_0x12158b<_0x58a61d[_0x1f81('0x42')];_0x12158b+=0x1){_0x5eccf3=_0x58a61d[_0x12158b]['MetricId']?_0x314fcd[_0x58a61d[_0x12158b][_0x1f81('0x69')]][_0x1f81('0x6a')]:_0x58a61d[_0x12158b][_0x1f81('0x36')];_0x5eccf3=_0x58a61d[_0x12158b][_0x1f81('0x6b')]?_[_0x1f81('0x6c')](_0x1c3719[_0x58a61d[_0x12158b][_0x1f81('0x6b')]],'%s',_0x5eccf3):_0x5eccf3;_0x5eccf3=_0x58a61d[_0x12158b][_0x1f81('0x6d')]?_[_0x1f81('0x6c')](_0x4f5855[_0x58a61d[_0x12158b]['format']],'%s',_0x5eccf3):_0x5eccf3;if(_0x58a61d[_0x12158b][_0x1f81('0x85')]){_0x18dcea[_0x1f81('0x62')](_0x5eccf3);}_0x58a61d[_0x12158b]['orderBy']&&_0x18dcea['order'](_0x5eccf3,_0x58a61d[_0x12158b][_0x1f81('0x6e')]===_0x1f81('0x6f')?![]:!![]);_0x18dcea['field'](_0x5eccf3,_0x58a61d[_0x12158b]['alias']||_0x5eccf3);}if(_0x335c32['joins']){_0x335c32['joins']=JSON[_0x1f81('0x71')](_0x335c32[_0x1f81('0x70')]);for(var _0x37e0ce=0x0;_0x37e0ce<_0x335c32[_0x1f81('0x70')]['length'];_0x37e0ce+=0x1){if(_0x335c32[_0x1f81('0x70')][_0x37e0ce][_0x1f81('0x35')]&&_[_0x1f81('0x5b')](_0x205d02,_0x335c32['joins'][_0x37e0ce][_0x1f81('0x35')])&&_0x335c32[_0x1f81('0x70')][_0x37e0ce]['parentKey']&&_0x335c32[_0x1f81('0x70')][_0x37e0ce][_0x1f81('0x73')]&&_0x335c32['joins'][_0x37e0ce][_0x1f81('0x74')]){_0x18dcea[_0x335c32[_0x1f81('0x70')][_0x37e0ce][_0x1f81('0x35')]](_0x335c32[_0x1f81('0x70')][_0x37e0ce][_0x1f81('0x73')],null,util[_0x1f81('0x6d')](_0x1f81('0x75'),_0x335c32[_0x1f81('0x76')],_0x335c32['joins'][_0x37e0ce][_0x1f81('0x72')],_0x335c32[_0x1f81('0x70')][_0x37e0ce]['foreignTable'],_0x335c32[_0x1f81('0x70')][_0x37e0ce][_0x1f81('0x74')]));}}}if(_0x335c32[_0x1f81('0x77')]){_0x335c32[_0x1f81('0x77')]=JSON['parse'](_0x335c32[_0x1f81('0x77')]);_0x18dcea['where'](_0x4f7c54(_0x335c32[_0x1f81('0x77')][_0x1f81('0x62')]));}_0x1ffd68=_0x18dcea[_0x1f81('0x78')]();_0x18dcea[_0x1f81('0x1c')](_0x1c599d);_0x18dcea['offset'](0x0);logger[_0x1f81('0x79')](_0x1f81('0x7a'),_0x18dcea[_0x1f81('0x7b')]());return db[_0x1f81('0x7c')]['query'](_0x18dcea[_0x1f81('0x7b')](),{'type':db['sequelize'][_0x1f81('0x7d')][_0x1f81('0x86')]});}})[_0x1f81('0x1f')](function(_0x54b79e){if(!_0x54b79e[_0x1f81('0x42')]){throw new db[(_0x1f81('0x64'))][(_0x1f81('0x65'))](_0x1f81('0x87'),0xcc);}if(_0x44c592[_0x1f81('0x88')]===_0x1f81('0x89')){return null;}var _0x416296=_['merge'](_0x44c592,{'name':_0x44c592[_0x1f81('0x8a')]||_0x44c592[_0x1f81('0x25')]||_0x335c32[_0x1f81('0x25')],'basename':_0x15c58b,'savename':util[_0x1f81('0x6d')](_0x1f81('0x8b'),_0x44c592['name']||_0x335c32[_0x1f81('0x25')],require(_0x1f81('0x8c'))[_0x1f81('0x8d')](0x4),_0x44c592[_0x1f81('0x88')]||_0x1f81('0x8e')),'reportId':_0x335c32['id'],'reportType':_0x1f81('0x8f')});return db[_0x1f81('0x90')][_0x1f81('0x44')](_0x416296,{'raw':!![]});})[_0x1f81('0x1f')](function(_0xf8a8c2){if(_0x335c32['table']===_0x1f81('0x91')){_0x1ffd68[_0x1f81('0x3a')](_0x335c32[_0x1f81('0x76')]+_0x1f81('0x92'),_0x44c592[_0x1f81('0x93')],_0x44c592[_0x1f81('0x94')]);}else{_0x1ffd68[_0x1f81('0x3a')](_0x335c32[_0x1f81('0x76')]+_0x1f81('0x95'),_0x44c592['startDate'],_0x44c592[_0x1f81('0x94')]);}if(_0xf8a8c2){logger[_0x1f81('0x96')](_0x1f81('0x97'),_0x1ffd68[_0x1f81('0x7b')]());require(_0x1f81('0x98'))[_0x1f81('0x99')](path[_0x1f81('0x4d')](__dirname,'../../components/export/',_0xf8a8c2[_0x1f81('0x88')]),[_0xf8a8c2['id'],_0x1ffd68['toString'](),path[_0x1f81('0x4d')](__dirname,_0x1f81('0x9a'),_0xf8a8c2[_0x1f81('0x9b')]),_0x15c58b]);return _0xf8a8c2;}else{var _0xaf03d1=squel[_0x1f81('0x67')]();_0xaf03d1['from']('('+_0x1ffd68[_0x1f81('0x7b')]()+')','countTable');_0xaf03d1[_0x1f81('0x36')](_0x1f81('0x9c'),_0x1f81('0x1a'));_0x1ffd68['limit'](_0x44c592[_0x1f81('0x1c')]||_0x1c599d);_0x1ffd68[_0x1f81('0x1b')](_0x44c592['offset']||0x0);return db[_0x1f81('0x7c')][_0x1f81('0x2c')](_0xaf03d1[_0x1f81('0x7b')](),{'type':db['sequelize'][_0x1f81('0x7d')][_0x1f81('0x86')]})['then'](function(_0x42532f){if(!_0x42532f[_0x1f81('0x42')]){_0x5c08c3=0x0;}else{_0x5c08c3=_0x42532f[0x0][_0x1f81('0x1a')]||0x0;}return db[_0x1f81('0x7c')]['query'](_0x1ffd68['toString'](),{'type':db[_0x1f81('0x7c')][_0x1f81('0x7d')][_0x1f81('0x86')]});})[_0x1f81('0x1f')](function(_0x593e8d){return{'rows':_0x593e8d||[],'count':_0x5c08c3};});}});}exports[_0x1f81('0x9d')]=function(_0xac9bbd,_0x44e6f5){return runReport(_0xac9bbd[_0x1f81('0x41')],_0xac9bbd[_0x1f81('0x2c')],_0xac9bbd[_0x1f81('0x39')])['then'](respondWithResult(_0x44e6f5,null))['catch'](handleError(_0x44e6f5,null));};exports[_0x1f81('0x9e')]=runReport;exports[_0x1f81('0x2c')]=function(_0xa7d00a,_0x3b5a88){var _0x50710e=0xa;var _0x1fef19=[_0x1f81('0x4d'),_0x1f81('0x4e'),'right_join',_0x1f81('0x50')];var _0x38907f={'SUM':_0x1f81('0x7e'),'COUNT':_0x1f81('0x51'),'COUNT DISTINCT':_0x1f81('0x52'),'MAX':_0x1f81('0x7f'),'MIN':_0x1f81('0x53'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x1f81('0x55'),'GROUP_CONCAT ASC':_0x1f81('0x80'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x46c6a2={'SEC_TO_TIME':_0x1f81('0x57'),'DATE':_0x1f81('0x58'),'HOUR':_0x1f81('0x59'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x1f81('0x81')};var _0x125dd2=function(_0x47e7a2){return!_['includes']([_0x1f81('0x5c'),_0x1f81('0x5d'),_0x1f81('0x5e'),_0x1f81('0x5f')],_0x47e7a2);};var _0x2bfea9=function(_0xfdf7a6){if(!_0xfdf7a6||!_0xfdf7a6[_0x1f81('0x60')][_0x1f81('0x42')]){return'';}for(var _0x35d584='(',_0xedb8a6=0x0;_0xedb8a6<_0xfdf7a6[_0x1f81('0x60')][_0x1f81('0x42')];_0xedb8a6+=0x1){_0xedb8a6>0x0&&(_0x35d584+='\x20'+_0xfdf7a6[_0x1f81('0x61')]+'\x20');_0x35d584+=_0xfdf7a6[_0x1f81('0x60')][_0xedb8a6]['group']?_0x2bfea9(_0xfdf7a6['rules'][_0xedb8a6]['group']):_0xfdf7a6[_0x1f81('0x60')][_0xedb8a6][_0x1f81('0x36')]+'\x20'+_0xfdf7a6['rules'][_0xedb8a6][_0x1f81('0x63')]+(_0x125dd2(_0xfdf7a6[_0x1f81('0x60')][_0xedb8a6]['condition'])?'\x20'+_0xfdf7a6[_0x1f81('0x60')][_0xedb8a6][_0x1f81('0x82')]:'');}return _0x35d584+')';};var _0x501b38={'where':{'id':_0xa7d00a[_0x1f81('0x41')]['id']}},_0x3f752f,_0x2ac191,_0x483f67,_0x3483d6,_0x3083f9;_0x501b38=_[_0x1f81('0x38')]({},_0x501b38,_0xa7d00a[_0x1f81('0x39')]);return db['AnalyticDefaultReport'][_0x1f81('0x43')](_0x501b38)[_0x1f81('0x1f')](function(_0x4ec169){if(_0x4ec169){_0x3f752f=_0x4ec169;return _0x4ec169[_0x1f81('0x9f')]();}return null;})['then'](function(_0x21cce5){if(_0x21cce5){if(!_0x21cce5[_0x1f81('0x42')]){throw new db[(_0x1f81('0x64'))][(_0x1f81('0x65'))](_0x1f81('0x83'),0x193);}_0x2ac191=_0x21cce5;return db[_0x1f81('0x84')][_0x1f81('0x3d')]({'raw':!![]});}return null;})[_0x1f81('0x1f')](function(_0x407b33){if(_0x407b33){_0x483f67=_['keyBy'](_0x407b33,'id');var _0x4f5d9e;var _0x4405f8=squel[_0x1f81('0x67')]();_0x4405f8['from'](_0x3f752f[_0x1f81('0x76')]);for(var _0xa609b0=0x0;_0xa609b0<_0x2ac191[_0x1f81('0x42')];_0xa609b0+=0x1){_0x4f5d9e=_0x2ac191[_0xa609b0][_0x1f81('0x69')]?_0x483f67[_0x2ac191[_0xa609b0][_0x1f81('0x69')]]['metric']:_0x2ac191[_0xa609b0][_0x1f81('0x36')];_0x4f5d9e=_0x2ac191[_0xa609b0]['function']?_[_0x1f81('0x6c')](_0x38907f[_0x2ac191[_0xa609b0][_0x1f81('0x6b')]],'%s',_0x4f5d9e):_0x4f5d9e;_0x4f5d9e=_0x2ac191[_0xa609b0][_0x1f81('0x6d')]?_['replace'](_0x46c6a2[_0x2ac191[_0xa609b0][_0x1f81('0x6d')]],'%s',_0x4f5d9e):_0x4f5d9e;if(_0x2ac191[_0xa609b0][_0x1f81('0x85')]){_0x4405f8[_0x1f81('0x62')](_0x4f5d9e);}_0x2ac191[_0xa609b0]['orderBy']&&_0x4405f8['order'](_0x4f5d9e,_0x2ac191[_0xa609b0][_0x1f81('0x6e')]===_0x1f81('0x6f')?![]:!![]);_0x4405f8[_0x1f81('0x36')](_0x4f5d9e,_0x2ac191[_0xa609b0][_0x1f81('0xa0')]||_0x4f5d9e);}if(_0x3f752f[_0x1f81('0x70')]){_0x3f752f[_0x1f81('0x70')]=JSON[_0x1f81('0x71')](_0x3f752f[_0x1f81('0x70')]);for(var _0x103ffe=0x0;_0x103ffe<_0x3f752f['joins'][_0x1f81('0x42')];_0x103ffe+=0x1){if(_0x3f752f[_0x1f81('0x70')][_0x103ffe][_0x1f81('0x35')]&&_[_0x1f81('0x5b')](_0x1fef19,_0x3f752f[_0x1f81('0x70')][_0x103ffe][_0x1f81('0x35')])&&_0x3f752f['joins'][_0x103ffe][_0x1f81('0x72')]&&_0x3f752f['joins'][_0x103ffe][_0x1f81('0x73')]&&_0x3f752f[_0x1f81('0x70')][_0x103ffe][_0x1f81('0x74')]){_0x4405f8[_0x3f752f[_0x1f81('0x70')][_0x103ffe][_0x1f81('0x35')]](_0x3f752f['joins'][_0x103ffe][_0x1f81('0x73')],null,util[_0x1f81('0x6d')](_0x1f81('0x75'),_0x3f752f[_0x1f81('0x76')],_0x3f752f[_0x1f81('0x70')][_0x103ffe][_0x1f81('0x72')],_0x3f752f[_0x1f81('0x70')][_0x103ffe][_0x1f81('0x73')],_0x3f752f[_0x1f81('0x70')][_0x103ffe]['foreignKey']));}}}if(_0x3f752f[_0x1f81('0x77')]){_0x3f752f[_0x1f81('0x77')]=JSON[_0x1f81('0x71')](_0x3f752f[_0x1f81('0x77')]);_0x4405f8[_0x1f81('0x3a')](_0x2bfea9(_0x3f752f['conditions'][_0x1f81('0x62')]));}_0x3083f9=_0x4405f8[_0x1f81('0x78')]();_0x4405f8['limit'](_0x50710e);_0x4405f8[_0x1f81('0x1b')](0x0);logger[_0x1f81('0x79')](_0x1f81('0x7a'),_0x4405f8[_0x1f81('0x7b')]());return db[_0x1f81('0x7c')][_0x1f81('0x2c')](_0x4405f8[_0x1f81('0x7b')](),{'type':db[_0x1f81('0x7c')][_0x1f81('0x7d')][_0x1f81('0x86')]});}})[_0x1f81('0x1f')](function(){return{'sql':_0x3083f9['toString']()};})[_0x1f81('0x1f')](respondWithResult(_0x3b5a88,null))['catch'](handleError(_0x3b5a88,null));};
\ No newline at end of file
index d183c0e..5a2fc3d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7d2c=['exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./analyticDefaultReport.attributes'];(function(_0x5b756c,_0x3621b6){var _0x2e0952=function(_0xca7707){while(--_0xca7707){_0x5b756c['push'](_0x5b756c['shift']());}};_0x2e0952(++_0x3621b6);}(_0x7d2c,0x1b4));var _0xc7d2=function(_0xc380cd,_0x632d9b){_0xc380cd=_0xc380cd-0x0;var _0xdda51d=_0x7d2c[_0xc380cd];return _0xdda51d;};'use strict';var _=require(_0xc7d2('0x0'));var util=require(_0xc7d2('0x1'));var logger=require(_0xc7d2('0x2'))(_0xc7d2('0x3'));var moment=require(_0xc7d2('0x4'));var BPromise=require(_0xc7d2('0x5'));var rp=require(_0xc7d2('0x6'));var attributes=require(_0xc7d2('0x7'));module[_0xc7d2('0x8')]=function(_0x383812,_0x4a6b44){return _0x383812[_0xc7d2('0x9')](_0xc7d2('0xa'),attributes,{'tableName':_0xc7d2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x7b6f=['exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xbd9050,_0x3d5a73){var _0x9a8358=function(_0xff6f13){while(--_0xff6f13){_0xbd9050['push'](_0xbd9050['shift']());}};_0x9a8358(++_0x3d5a73);}(_0x7b6f,0x143));var _0xf7b6=function(_0x39954b,_0x498d8e){_0x39954b=_0x39954b-0x0;var _0xccce60=_0x7b6f[_0x39954b];return _0xccce60;};'use strict';var _=require(_0xf7b6('0x0'));var util=require(_0xf7b6('0x1'));var logger=require(_0xf7b6('0x2'))(_0xf7b6('0x3'));var moment=require(_0xf7b6('0x4'));var BPromise=require(_0xf7b6('0x5'));var rp=require(_0xf7b6('0x6'));var attributes=require('./analyticDefaultReport.attributes');module[_0xf7b6('0x7')]=function(_0x6d2efd,_0x261f70){return _0x6d2efd[_0xf7b6('0x8')](_0xf7b6('0x9'),attributes,{'tableName':_0xf7b6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index b3e7642..a022908 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','catch','util'];(function(_0xc5d101,_0x5da5ae){var _0x8dd6e8=function(_0x542d5b){while(--_0x542d5b){_0xc5d101['push'](_0xc5d101['shift']());}};_0x8dd6e8(++_0x5da5ae);}(_0xedd9,0xfc));var _0x9edd=function(_0x51e4b1,_0xe62ec0){_0x51e4b1=_0x51e4b1-0x0;var _0x58f982=_0xedd9[_0x51e4b1];return _0x58f982;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});}
\ No newline at end of file
+var _0x54ef=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x244ca7,_0x506ea5){var _0x282b81=function(_0x292878){while(--_0x292878){_0x244ca7['push'](_0x244ca7['shift']());}};_0x282b81(++_0x506ea5);}(_0x54ef,0x112));var _0xf54e=function(_0x1a9558,_0x333a51){_0x1a9558=_0x1a9558-0x0;var _0x379af7=_0x54ef[_0x1a9558];return _0x379af7;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99cf9,_0x2464ae,_0x561870){return new BPromise(function(_0x27e69b,_0x57a1ce){return client[_0xf54e('0xb')](_0x99cf9,_0x561870)[_0xf54e('0xc')](function(_0x47c5e1){logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));logger[_0xf54e('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x2464ae,_0xf54e('0xf'),JSON[_0xf54e('0x11')](_0x47c5e1));if(_0x47c5e1[_0xf54e('0x12')]){if(_0x47c5e1[_0xf54e('0x12')]['code']===0x1f4){logger[_0xf54e('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2464ae,_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);return _0x27e69b(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}else{logger['info'](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));_0x27e69b(_0x47c5e1[_0xf54e('0x14')]['message']);}})['catch'](function(_0xd87020){logger[_0xf54e('0x12')](_0xf54e('0xe'),_0x2464ae,_0xd87020);_0x57a1ce(_0xd87020);});});}
\ No newline at end of file
index 13859af..75b5ce0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x51aa=['exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','run','query','post','create','update','delete','destroy'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x51aa,0x161));var _0xa51a=function(_0x19d0b0,_0x2f342c){_0x19d0b0=_0x19d0b0-0x0;var _0x2efdd4=_0x51aa[_0x19d0b0];return _0x2efdd4;};'use strict';var multer=require(_0xa51a('0x0'));var util=require(_0xa51a('0x1'));var path=require('path');var timeout=require(_0xa51a('0x2'));var express=require(_0xa51a('0x3'));var router=express[_0xa51a('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa51a('0x5'));var config=require(_0xa51a('0x6'));var controller=require('./analyticDefaultReport.controller');router[_0xa51a('0x7')]('/',auth[_0xa51a('0x8')](),controller[_0xa51a('0x9')]);router['get'](_0xa51a('0xa'),auth[_0xa51a('0x8')](),controller['show']);router[_0xa51a('0x7')](_0xa51a('0xb'),auth[_0xa51a('0x8')](),controller[_0xa51a('0xc')]);router[_0xa51a('0x7')](_0xa51a('0xd'),auth[_0xa51a('0x8')](),controller[_0xa51a('0xe')]);router[_0xa51a('0x7')]('/:id/query',auth[_0xa51a('0x8')](),controller[_0xa51a('0xf')]);router[_0xa51a('0x10')]('/',auth[_0xa51a('0x8')](),controller[_0xa51a('0x11')]);router['put'](_0xa51a('0xa'),auth[_0xa51a('0x8')](),controller[_0xa51a('0x12')]);router[_0xa51a('0x13')](_0xa51a('0xa'),auth[_0xa51a('0x8')](),controller[_0xa51a('0x14')]);module[_0xa51a('0x15')]=router;
\ No newline at end of file
+var _0x438f=['/:id','isAuthenticated','/:id/preview','preview','/:id/run','run','/:id/query','query','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x438f,0xb6));var _0xf438=function(_0x567bdf,_0x15f1f2){_0x567bdf=_0x567bdf-0x0;var _0x35ba35=_0x438f[_0x567bdf];return _0x35ba35;};'use strict';var multer=require(_0xf438('0x0'));var util=require(_0xf438('0x1'));var path=require('path');var timeout=require(_0xf438('0x2'));var express=require(_0xf438('0x3'));var router=express[_0xf438('0x4')]();var auth=require(_0xf438('0x5'));var interaction=require(_0xf438('0x6'));var config=require(_0xf438('0x7'));var controller=require(_0xf438('0x8'));router[_0xf438('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf438('0x9')](_0xf438('0xa'),auth[_0xf438('0xb')](),controller['show']);router[_0xf438('0x9')](_0xf438('0xc'),auth[_0xf438('0xb')](),controller[_0xf438('0xd')]);router['get'](_0xf438('0xe'),auth['isAuthenticated'](),controller[_0xf438('0xf')]);router[_0xf438('0x9')](_0xf438('0x10'),auth[_0xf438('0xb')](),controller[_0xf438('0x11')]);router['post']('/',auth[_0xf438('0xb')](),controller[_0xf438('0x12')]);router[_0xf438('0x13')](_0xf438('0xa'),auth[_0xf438('0xb')](),controller[_0xf438('0x14')]);router[_0xf438('0x15')](_0xf438('0xa'),auth['isAuthenticated'](),controller[_0xf438('0x16')]);module[_0xf438('0x17')]=router;
\ No newline at end of file
index c4a4425..6e9e044 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcff4=['xlsx','DATE','scheduled','INTEGER','UNSIGNED','exports','STRING','ENUM','csv','pdf'];(function(_0x3337b6,_0x42c7f9){var _0x568270=function(_0x56e5df){while(--_0x56e5df){_0x3337b6['push'](_0x3337b6['shift']());}};_0x568270(++_0x42c7f9);}(_0xcff4,0x163));var _0x4cff=function(_0xdabcd8,_0x7524eb){_0xdabcd8=_0xdabcd8-0x0;var _0x5518b1=_0xcff4[_0xdabcd8];return _0x5518b1;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x4cff('0x0')]={'name':{'type':Sequelize[_0x4cff('0x1')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x4cff('0x2')](_0x4cff('0x3'),_0x4cff('0x4'),_0x4cff('0x5')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x4cff('0x6')]},'endDate':{'type':Sequelize[_0x4cff('0x6')]},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x4cff('0x2')]('manual',_0x4cff('0x7')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x4cff('0x8')](0xb)[_0x4cff('0x9')]},'reportType':{'type':Sequelize[_0x4cff('0x1')]}};
\ No newline at end of file
+var _0xaeda=['csv','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM'];(function(_0x454c6d,_0x249ded){var _0x32e742=function(_0x303c27){while(--_0x303c27){_0x454c6d['push'](_0x454c6d['shift']());}};_0x32e742(++_0x249ded);}(_0xaeda,0x10f));var _0xaaed=function(_0x42dd5a,_0x2a08c5){_0x42dd5a=_0x42dd5a-0x0;var _0x4c29e6=_0xaeda[_0x42dd5a];return _0x4c29e6;};'use strict';var Sequelize=require(_0xaaed('0x0'));var moment=require(_0xaaed('0x1'));module[_0xaaed('0x2')]={'name':{'type':Sequelize[_0xaaed('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xaaed('0x4')]('csv','pdf','xlsx'),'allowNull':![],'defaultValue':_0xaaed('0x5')},'savename':{'type':Sequelize[_0xaaed('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xaaed('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':_0xaaed('0x7')},'type':{'type':Sequelize['ENUM'](_0xaaed('0x8'),_0xaaed('0x9')),'allowNull':![],'defaultValue':_0xaaed('0x8')},'reportId':{'type':Sequelize[_0xaaed('0xa')](0xb)[_0xaaed('0xb')]},'reportType':{'type':Sequelize[_0xaaed('0x3')]}};
\ No newline at end of file
index da942c2..b1aeff9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc32c=['get','ExtractedReports','then','error','stack','name','model','keys','query','filters','intersection','attributes','order','sort','where','pick','merge','key','VIRTUAL','field','filter','options','AnalyticExtractedReport','include','catch','show','params','fields','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','exists','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy'];(function(_0x265694,_0x53b5e2){var _0x31b7d1=function(_0x379e5e){while(--_0x379e5e){_0x265694['push'](_0x265694['shift']());}};_0x31b7d1(++_0x53b5e2);}(_0xc32c,0x1d1));var _0xcc32=function(_0x15497f,_0x15ecb3){_0x15497f=_0x15497f-0x0;var _0x3dff4e=_0xc32c[_0x15497f];return _0x3dff4e;};'use strict';var pdf=require(_0xcc32('0x0'));var emlformat=require(_0xcc32('0x1'));var rimraf=require(_0xcc32('0x2'));var zipdir=require(_0xcc32('0x3'));var jsonpatch=require(_0xcc32('0x4'));var rp=require('request-promise');var moment=require(_0xcc32('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcc32('0x6'));var util=require(_0xcc32('0x7'));var path=require('path');var sox=require(_0xcc32('0x8'));var csv=require(_0xcc32('0x9'));var ejs=require(_0xcc32('0xa'));var fs=require('fs');var _=require(_0xcc32('0xb'));var squel=require(_0xcc32('0xc'));var crypto=require(_0xcc32('0xd'));var jsforce=require(_0xcc32('0xe'));var deskjs=require(_0xcc32('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xcc32('0x10'))(_0xcc32('0x11'));var utils=require(_0xcc32('0x12'));var config=require(_0xcc32('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20f311,_0x4651ff){_0x4651ff=_0x4651ff||0xcc;return function(_0x3e0e86){if(_0x3e0e86){return _0x20f311[_0xcc32('0x14')](_0x4651ff);}return _0x20f311[_0xcc32('0x15')](_0x4651ff)[_0xcc32('0x16')]();};}function respondWithResult(_0x23d2f5,_0xc1aa35){_0xc1aa35=_0xc1aa35||0xc8;return function(_0xb2e1e5){if(_0xb2e1e5){return _0x23d2f5[_0xcc32('0x15')](_0xc1aa35)['json'](_0xb2e1e5);}};}function respondWithFilteredResult(_0x2d587b,_0x22ecb2){return function(_0x1a31f3){if(_0x1a31f3){var _0x2886a5=_0x1a31f3[_0xcc32('0x17')],_0x58cee7=_0x22ecb2[_0xcc32('0x18')],_0xb8541=_0x22ecb2['offset']+_0x22ecb2[_0xcc32('0x19')],_0x1174c6;if(_0xb8541>=_0x2886a5){_0xb8541=_0x2886a5;_0x1174c6=0xc8;}else{_0x1174c6=0xce;}_0x2d587b[_0xcc32('0x15')](_0x1174c6);return _0x2d587b[_0xcc32('0x1a')](_0xcc32('0x1b'),_0x58cee7+'-'+_0xb8541+'/'+_0x2886a5)[_0xcc32('0x1c')](_0x1a31f3);}return null;};}function patchUpdates(_0x379ba1){return function(_0x248c0b){try{jsonpatch[_0xcc32('0x1d')](_0x248c0b,_0x379ba1,!![]);}catch(_0x473337){return BPromise[_0xcc32('0x1e')](_0x473337);}return _0x248c0b['save']();};}function saveUpdates(_0x1f368c,_0x991994){return function(_0xaeddec){if(_0xaeddec){return _0xaeddec[_0xcc32('0x1f')](_0x1f368c)['then'](function(_0x525071){return _0x525071;});}return null;};}function removeEntity(_0x2d01bb,_0x3b1d3b){return function(_0xd4746a){if(_0xd4746a){return _0xd4746a[_0xcc32('0x20')]()['then'](function(){var _0x4eaa02=_0xd4746a[_0xcc32('0x21')]({'plain':!![]});var _0x44c51e=_0xcc32('0x22');return db['UserProfileResource'][_0xcc32('0x20')]({'where':{'type':_0x44c51e,'resourceId':_0x4eaa02['id']}})[_0xcc32('0x23')](function(){return _0xd4746a;});})[_0xcc32('0x23')](function(){_0x2d01bb[_0xcc32('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43b802,_0x2885e0){return function(_0xf0d5fb){if(!_0xf0d5fb){_0x43b802[_0xcc32('0x14')](0x194);}return _0xf0d5fb;};}function handleError(_0x3f1d88,_0x536c8a){_0x536c8a=_0x536c8a||0x1f4;return function(_0x477455){logger[_0xcc32('0x24')](_0x477455[_0xcc32('0x25')]);if(_0x477455['name']){delete _0x477455[_0xcc32('0x26')];}_0x3f1d88['status'](_0x536c8a)['send'](_0x477455);};}exports['index']=function(_0x490ca3,_0x49b06c){var _0x59cb0a={},_0x3190fd={},_0x4dd5b8={'count':0x0,'rows':[]};var _0xca91ed=db['AnalyticExtractedReport']['rawAttributes'];_0x3190fd[_0xcc32('0x27')]=_[_0xcc32('0x28')](_0xca91ed);_0x3190fd[_0xcc32('0x29')]=_[_0xcc32('0x28')](_0x490ca3[_0xcc32('0x29')]);_0x3190fd[_0xcc32('0x2a')]=_[_0xcc32('0x2b')](_0x3190fd[_0xcc32('0x27')],_0x3190fd[_0xcc32('0x29')]);_0x59cb0a[_0xcc32('0x2c')]=_[_0xcc32('0x2b')](_0x3190fd[_0xcc32('0x27')],qs['fields'](_0x490ca3[_0xcc32('0x29')]['fields']));_0x59cb0a[_0xcc32('0x2c')]=_0x59cb0a[_0xcc32('0x2c')]['length']?_0x59cb0a['attributes']:_0x3190fd['model'];if(!_0x490ca3[_0xcc32('0x29')]['hasOwnProperty']('nolimit')){_0x59cb0a[_0xcc32('0x19')]=qs[_0xcc32('0x19')](_0x490ca3[_0xcc32('0x29')][_0xcc32('0x19')]);_0x59cb0a['offset']=qs[_0xcc32('0x18')](_0x490ca3[_0xcc32('0x29')][_0xcc32('0x18')]);}_0x59cb0a[_0xcc32('0x2d')]=qs[_0xcc32('0x2e')](_0x490ca3[_0xcc32('0x29')]['sort']);_0x59cb0a[_0xcc32('0x2f')]=qs[_0xcc32('0x2a')](_[_0xcc32('0x30')](_0x490ca3[_0xcc32('0x29')],_0x3190fd['filters']));if(_0x490ca3[_0xcc32('0x29')]['filter']){_0x59cb0a[_0xcc32('0x2f')]=_[_0xcc32('0x31')](_0x59cb0a['where'],{'$or':_['map'](_0xca91ed,function(_0x23c7c0){if(_0x23c7c0['type'][_0xcc32('0x32')]!==_0xcc32('0x33')){var _0x44278d={};_0x44278d[_0x23c7c0[_0xcc32('0x34')]]={'$like':'%'+_0x490ca3[_0xcc32('0x29')][_0xcc32('0x35')]+'%'};return _0x44278d;}})});}_0x59cb0a=_[_0xcc32('0x31')]({},_0x59cb0a,_0x490ca3[_0xcc32('0x36')]);var _0x34a194={'where':_0x59cb0a[_0xcc32('0x2f')]};return db[_0xcc32('0x37')]['count'](_0x34a194)['then'](function(_0x2adf11){_0x4dd5b8[_0xcc32('0x17')]=_0x2adf11;if(_0x490ca3[_0xcc32('0x29')]['includeAll']){_0x59cb0a[_0xcc32('0x38')]=[{'all':!![]}];}return db[_0xcc32('0x37')]['findAll'](_0x59cb0a);})[_0xcc32('0x23')](function(_0x318d40){_0x4dd5b8['rows']=_0x318d40;return _0x4dd5b8;})[_0xcc32('0x23')](respondWithFilteredResult(_0x49b06c,_0x59cb0a))[_0xcc32('0x39')](handleError(_0x49b06c,null));};exports[_0xcc32('0x3a')]=function(_0x1b4ec9,_0x17063a){var _0x4d16c9={'raw':!![],'where':{'id':_0x1b4ec9[_0xcc32('0x3b')]['id']}},_0x1e387e={};_0x1e387e[_0xcc32('0x27')]=_[_0xcc32('0x28')](db['AnalyticExtractedReport']['rawAttributes']);_0x1e387e[_0xcc32('0x29')]=_[_0xcc32('0x28')](_0x1b4ec9[_0xcc32('0x29')]);_0x1e387e[_0xcc32('0x2a')]=_[_0xcc32('0x2b')](_0x1e387e[_0xcc32('0x27')],_0x1e387e['query']);_0x4d16c9[_0xcc32('0x2c')]=_['intersection'](_0x1e387e[_0xcc32('0x27')],qs['fields'](_0x1b4ec9[_0xcc32('0x29')][_0xcc32('0x3c')]));_0x4d16c9['attributes']=_0x4d16c9[_0xcc32('0x2c')][_0xcc32('0x3d')]?_0x4d16c9[_0xcc32('0x2c')]:_0x1e387e['model'];if(_0x1b4ec9[_0xcc32('0x29')]['includeAll']){_0x4d16c9[_0xcc32('0x38')]=[{'all':!![]}];}_0x4d16c9=_[_0xcc32('0x31')]({},_0x4d16c9,_0x1b4ec9['options']);return db[_0xcc32('0x37')]['find'](_0x4d16c9)[_0xcc32('0x23')](handleEntityNotFound(_0x17063a,null))[_0xcc32('0x23')](respondWithResult(_0x17063a,null))[_0xcc32('0x39')](handleError(_0x17063a,null));};exports['create']=function(_0x3e23e5,_0x2f7f83){return db[_0xcc32('0x37')][_0xcc32('0x3e')](_0x3e23e5[_0xcc32('0x3f')],{})['then'](function(_0x6f5a59){var _0x21fd30=_0x3e23e5['user']['get']({'plain':!![]});if(!_0x21fd30)throw new Error(_0xcc32('0x40'));if(_0x21fd30[_0xcc32('0x41')]===_0xcc32('0x42')){var _0x151cd7=_0x6f5a59[_0xcc32('0x21')]({'plain':!![]});var _0x2a3369='ExtractedReports';return db[_0xcc32('0x43')][_0xcc32('0x44')]({'where':{'name':_0x2a3369,'userProfileId':_0x21fd30[_0xcc32('0x45')]},'raw':!![]})[_0xcc32('0x23')](function(_0x5cb78a){if(_0x5cb78a&&_0x5cb78a[_0xcc32('0x46')]===0x0){return db[_0xcc32('0x47')]['create']({'name':_0x151cd7[_0xcc32('0x26')],'resourceId':_0x151cd7['id'],'type':_0x5cb78a[_0xcc32('0x26')],'sectionId':_0x5cb78a['id']},{})[_0xcc32('0x23')](function(){return _0x6f5a59;});}else{return _0x6f5a59;}})['catch'](function(_0x4fb281){logger[_0xcc32('0x24')](_0xcc32('0x48'),_0x4fb281);throw _0x4fb281;});}return _0x6f5a59;})[_0xcc32('0x23')](respondWithResult(_0x2f7f83,0xc9))[_0xcc32('0x39')](handleError(_0x2f7f83,null));};exports[_0xcc32('0x1f')]=function(_0x43e6bb,_0x256636){if(_0x43e6bb[_0xcc32('0x3f')]['id']){delete _0x43e6bb['body']['id'];}return db[_0xcc32('0x37')]['find']({'where':{'id':_0x43e6bb[_0xcc32('0x3b')]['id']}})['then'](handleEntityNotFound(_0x256636,null))[_0xcc32('0x23')](saveUpdates(_0x43e6bb['body'],null))[_0xcc32('0x23')](respondWithResult(_0x256636,null))['catch'](handleError(_0x256636,null));};exports['destroy']=function(_0x1e2783,_0x2f0b44){return db[_0xcc32('0x37')][_0xcc32('0x44')]({'where':{'id':_0x1e2783[_0xcc32('0x3b')]['id']}})[_0xcc32('0x23')](handleEntityNotFound(_0x2f0b44,null))[_0xcc32('0x23')](removeEntity(_0x2f0b44,null))[_0xcc32('0x39')](handleError(_0x2f0b44,null));};exports['download']=function(_0x46fd0d,_0x495f97,_0x44a703){return db[_0xcc32('0x37')][_0xcc32('0x44')]({'where':{'id':_0x46fd0d[_0xcc32('0x3b')]['id']},'attributes':[_0xcc32('0x26'),'basename',_0xcc32('0x49'),_0xcc32('0x4a')],'raw':!![]})[_0xcc32('0x23')](handleEntityNotFound(_0x495f97,null))[_0xcc32('0x23')](function(_0x38142d){if(_0x38142d){if(!fs[_0xcc32('0x4b')](path[_0xcc32('0x4c')](config[_0xcc32('0x4d')],_0xcc32('0x4e'),_0x38142d[_0xcc32('0x49')]))){throw new db[(_0xcc32('0x4f'))][(_0xcc32('0x50'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x46fd0d[_0xcc32('0x29')][_0xcc32('0x51')]){return _0x495f97['sendStatus'](0xc8);}return _0x495f97['download'](path[_0xcc32('0x4c')](config[_0xcc32('0x4d')],_0xcc32('0x4e'),_0x38142d[_0xcc32('0x49')]),util['format']('%s.%s',_0x38142d['basename']||_0x38142d[_0xcc32('0x26')],_0x38142d[_0xcc32('0x4a')][_0xcc32('0x52')]()));}})['catch'](handleError(_0x495f97,null));};
\ No newline at end of file
+var _0x05c9=['include','catch','show','params','model','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','savename','existsSync','join','root','server/files/reports','ValidationError','exists','download','%s.%s','output','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','name','send','index','AnalyticExtractedReport','rawAttributes','keys','intersection','fields','attributes','length','query','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','type','field','filter','options','count'];(function(_0x15ea7b,_0x34a560){var _0x13821e=function(_0x12e1da){while(--_0x12e1da){_0x15ea7b['push'](_0x15ea7b['shift']());}};_0x13821e(++_0x34a560);}(_0x05c9,0x1b4));var _0x905c=function(_0x3afe87,_0x2c9cc5){_0x3afe87=_0x3afe87-0x0;var _0x31ea7f=_0x05c9[_0x3afe87];return _0x31ea7f;};'use strict';var pdf=require(_0x905c('0x0'));var emlformat=require(_0x905c('0x1'));var rimraf=require(_0x905c('0x2'));var zipdir=require(_0x905c('0x3'));var jsonpatch=require(_0x905c('0x4'));var rp=require('request-promise');var moment=require(_0x905c('0x5'));var BPromise=require(_0x905c('0x6'));var Mustache=require(_0x905c('0x7'));var util=require('util');var path=require(_0x905c('0x8'));var sox=require(_0x905c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x905c('0xa'));var toCsv=require(_0x905c('0xb'));var querystring=require(_0x905c('0xc'));var Papa=require(_0x905c('0xd'));var authService=require(_0x905c('0xe'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0x905c('0xf'));var logger=require(_0x905c('0x10'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2dc619,_0x143748){_0x143748=_0x143748||0xcc;return function(_0x337fc8){if(_0x337fc8){return _0x2dc619['sendStatus'](_0x143748);}return _0x2dc619[_0x905c('0x11')](_0x143748)[_0x905c('0x12')]();};}function respondWithResult(_0x2eb77c,_0x11307d){_0x11307d=_0x11307d||0xc8;return function(_0x2be2d4){if(_0x2be2d4){return _0x2eb77c[_0x905c('0x11')](_0x11307d)[_0x905c('0x13')](_0x2be2d4);}};}function respondWithFilteredResult(_0x514308,_0x156142){return function(_0xc0fc8){if(_0xc0fc8){var _0x4561f7=_0xc0fc8['count'],_0x4cfaa9=_0x156142['offset'],_0x55e29e=_0x156142[_0x905c('0x14')]+_0x156142[_0x905c('0x15')],_0xac42df;if(_0x55e29e>=_0x4561f7){_0x55e29e=_0x4561f7;_0xac42df=0xc8;}else{_0xac42df=0xce;}_0x514308['status'](_0xac42df);return _0x514308[_0x905c('0x16')]('Content-Range',_0x4cfaa9+'-'+_0x55e29e+'/'+_0x4561f7)[_0x905c('0x13')](_0xc0fc8);}return null;};}function patchUpdates(_0x4297e9){return function(_0x1ac05a){try{jsonpatch[_0x905c('0x17')](_0x1ac05a,_0x4297e9,!![]);}catch(_0x79b9a7){return BPromise[_0x905c('0x18')](_0x79b9a7);}return _0x1ac05a[_0x905c('0x19')]();};}function saveUpdates(_0x3877ca,_0x1b0b71){return function(_0x24d06d){if(_0x24d06d){return _0x24d06d[_0x905c('0x1a')](_0x3877ca)[_0x905c('0x1b')](function(_0x3543c8){return _0x3543c8;});}return null;};}function removeEntity(_0x5de5bc,_0x282584){return function(_0x207073){if(_0x207073){return _0x207073[_0x905c('0x1c')]()['then'](function(){var _0x4b3eeb=_0x207073[_0x905c('0x1d')]({'plain':!![]});var _0x5b110d='ExtractedReports';return db[_0x905c('0x1e')][_0x905c('0x1c')]({'where':{'type':_0x5b110d,'resourceId':_0x4b3eeb['id']}})[_0x905c('0x1b')](function(){return _0x207073;});})[_0x905c('0x1b')](function(){_0x5de5bc['status'](0xcc)[_0x905c('0x12')]();});}};}function handleEntityNotFound(_0x10efdb,_0x20c388){return function(_0x376a00){if(!_0x376a00){_0x10efdb[_0x905c('0x1f')](0x194);}return _0x376a00;};}function handleError(_0x553ccb,_0x138948){_0x138948=_0x138948||0x1f4;return function(_0x562cc8){logger['error'](_0x562cc8['stack']);if(_0x562cc8[_0x905c('0x20')]){delete _0x562cc8[_0x905c('0x20')];}_0x553ccb[_0x905c('0x11')](_0x138948)[_0x905c('0x21')](_0x562cc8);};}exports[_0x905c('0x22')]=function(_0x38adf3,_0x4b0d22){var _0x5ec652={},_0x125700={},_0x31f12c={'count':0x0,'rows':[]};var _0x4c0ca0=db[_0x905c('0x23')][_0x905c('0x24')];_0x125700['model']=_['keys'](_0x4c0ca0);_0x125700['query']=_[_0x905c('0x25')](_0x38adf3['query']);_0x125700['filters']=_[_0x905c('0x26')](_0x125700['model'],_0x125700['query']);_0x5ec652['attributes']=_[_0x905c('0x26')](_0x125700['model'],qs['fields'](_0x38adf3['query'][_0x905c('0x27')]));_0x5ec652[_0x905c('0x28')]=_0x5ec652[_0x905c('0x28')][_0x905c('0x29')]?_0x5ec652[_0x905c('0x28')]:_0x125700['model'];if(!_0x38adf3[_0x905c('0x2a')][_0x905c('0x2b')](_0x905c('0x2c'))){_0x5ec652[_0x905c('0x15')]=qs['limit'](_0x38adf3[_0x905c('0x2a')][_0x905c('0x15')]);_0x5ec652[_0x905c('0x14')]=qs[_0x905c('0x14')](_0x38adf3[_0x905c('0x2a')]['offset']);}_0x5ec652[_0x905c('0x2d')]=qs[_0x905c('0x2e')](_0x38adf3[_0x905c('0x2a')][_0x905c('0x2e')]);_0x5ec652[_0x905c('0x2f')]=qs['filters'](_[_0x905c('0x30')](_0x38adf3[_0x905c('0x2a')],_0x125700[_0x905c('0x31')]));if(_0x38adf3[_0x905c('0x2a')]['filter']){_0x5ec652[_0x905c('0x2f')]=_[_0x905c('0x32')](_0x5ec652['where'],{'$or':_['map'](_0x4c0ca0,function(_0x11583b){if(_0x11583b[_0x905c('0x33')]['key']!=='VIRTUAL'){var _0x39d5f2={};_0x39d5f2[_0x11583b[_0x905c('0x34')]]={'$like':'%'+_0x38adf3[_0x905c('0x2a')][_0x905c('0x35')]+'%'};return _0x39d5f2;}})});}_0x5ec652=_[_0x905c('0x32')]({},_0x5ec652,_0x38adf3[_0x905c('0x36')]);var _0x3e76bb={'where':_0x5ec652['where']};return db[_0x905c('0x23')][_0x905c('0x37')](_0x3e76bb)['then'](function(_0x1354b7){_0x31f12c[_0x905c('0x37')]=_0x1354b7;if(_0x38adf3[_0x905c('0x2a')]['includeAll']){_0x5ec652[_0x905c('0x38')]=[{'all':!![]}];}return db[_0x905c('0x23')]['findAll'](_0x5ec652);})[_0x905c('0x1b')](function(_0x2a495c){_0x31f12c['rows']=_0x2a495c;return _0x31f12c;})[_0x905c('0x1b')](respondWithFilteredResult(_0x4b0d22,_0x5ec652))[_0x905c('0x39')](handleError(_0x4b0d22,null));};exports[_0x905c('0x3a')]=function(_0x1da019,_0x546772){var _0x54e5df={'raw':!![],'where':{'id':_0x1da019[_0x905c('0x3b')]['id']}},_0x17fbc9={};_0x17fbc9['model']=_[_0x905c('0x25')](db[_0x905c('0x23')][_0x905c('0x24')]);_0x17fbc9[_0x905c('0x2a')]=_['keys'](_0x1da019['query']);_0x17fbc9[_0x905c('0x31')]=_[_0x905c('0x26')](_0x17fbc9[_0x905c('0x3c')],_0x17fbc9[_0x905c('0x2a')]);_0x54e5df[_0x905c('0x28')]=_[_0x905c('0x26')](_0x17fbc9[_0x905c('0x3c')],qs[_0x905c('0x27')](_0x1da019[_0x905c('0x2a')]['fields']));_0x54e5df[_0x905c('0x28')]=_0x54e5df[_0x905c('0x28')][_0x905c('0x29')]?_0x54e5df[_0x905c('0x28')]:_0x17fbc9[_0x905c('0x3c')];if(_0x1da019[_0x905c('0x2a')]['includeAll']){_0x54e5df[_0x905c('0x38')]=[{'all':!![]}];}_0x54e5df=_[_0x905c('0x32')]({},_0x54e5df,_0x1da019['options']);return db[_0x905c('0x23')][_0x905c('0x3d')](_0x54e5df)[_0x905c('0x1b')](handleEntityNotFound(_0x546772,null))[_0x905c('0x1b')](respondWithResult(_0x546772,null))[_0x905c('0x39')](handleError(_0x546772,null));};exports['create']=function(_0x12de75,_0x4950e6){return db[_0x905c('0x23')][_0x905c('0x3e')](_0x12de75[_0x905c('0x3f')],{})['then'](function(_0x238ac0){var _0x624f99=_0x12de75[_0x905c('0x40')][_0x905c('0x1d')]({'plain':!![]});if(!_0x624f99)throw new Error(_0x905c('0x41'));if(_0x624f99['role']===_0x905c('0x40')){var _0x4666fb=_0x238ac0['get']({'plain':!![]});var _0x212f88='ExtractedReports';return db[_0x905c('0x42')][_0x905c('0x3d')]({'where':{'name':_0x212f88,'userProfileId':_0x624f99[_0x905c('0x43')]},'raw':!![]})[_0x905c('0x1b')](function(_0x363c81){if(_0x363c81&&_0x363c81[_0x905c('0x44')]===0x0){return db[_0x905c('0x1e')][_0x905c('0x3e')]({'name':_0x4666fb[_0x905c('0x20')],'resourceId':_0x4666fb['id'],'type':_0x363c81[_0x905c('0x20')],'sectionId':_0x363c81['id']},{})[_0x905c('0x1b')](function(){return _0x238ac0;});}else{return _0x238ac0;}})['catch'](function(_0x59b05b){logger['error'](_0x905c('0x45'),_0x59b05b);throw _0x59b05b;});}return _0x238ac0;})[_0x905c('0x1b')](respondWithResult(_0x4950e6,0xc9))[_0x905c('0x39')](handleError(_0x4950e6,null));};exports[_0x905c('0x1a')]=function(_0x24f118,_0x206c3e){if(_0x24f118[_0x905c('0x3f')]['id']){delete _0x24f118[_0x905c('0x3f')]['id'];}return db[_0x905c('0x23')][_0x905c('0x3d')]({'where':{'id':_0x24f118[_0x905c('0x3b')]['id']}})['then'](handleEntityNotFound(_0x206c3e,null))[_0x905c('0x1b')](saveUpdates(_0x24f118['body'],null))['then'](respondWithResult(_0x206c3e,null))[_0x905c('0x39')](handleError(_0x206c3e,null));};exports[_0x905c('0x1c')]=function(_0x39d432,_0x5a5512){return db[_0x905c('0x23')][_0x905c('0x3d')]({'where':{'id':_0x39d432[_0x905c('0x3b')]['id']}})['then'](handleEntityNotFound(_0x5a5512,null))['then'](removeEntity(_0x5a5512,null))[_0x905c('0x39')](handleError(_0x5a5512,null));};exports['download']=function(_0x2d28ab,_0x196d93,_0x89d25b){return db[_0x905c('0x23')][_0x905c('0x3d')]({'where':{'id':_0x2d28ab[_0x905c('0x3b')]['id']},'attributes':[_0x905c('0x20'),_0x905c('0x46'),_0x905c('0x47'),'output'],'raw':!![]})[_0x905c('0x1b')](handleEntityNotFound(_0x196d93,null))[_0x905c('0x1b')](function(_0x2e4afa){if(_0x2e4afa){if(!fs[_0x905c('0x48')](path[_0x905c('0x49')](config[_0x905c('0x4a')],_0x905c('0x4b'),_0x2e4afa[_0x905c('0x47')]))){throw new db['Sequelize'][(_0x905c('0x4c'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x2d28ab[_0x905c('0x2a')][_0x905c('0x4d')]){return _0x196d93[_0x905c('0x1f')](0xc8);}return _0x196d93[_0x905c('0x4e')](path[_0x905c('0x49')](config[_0x905c('0x4a')],_0x905c('0x4b'),_0x2e4afa[_0x905c('0x47')]),util['format'](_0x905c('0x4f'),_0x2e4afa[_0x905c('0x46')]||_0x2e4afa[_0x905c('0x20')],_0x2e4afa[_0x905c('0x50')][_0x905c('0x51')]()));}})['catch'](handleError(_0x196d93,null));};
\ No newline at end of file
index f2af98e..5a8e304 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeea2=['request-promise','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','moment','bluebird'];(function(_0x3776d9,_0x2dbf19){var _0x312918=function(_0x4e0389){while(--_0x4e0389){_0x3776d9['push'](_0x3776d9['shift']());}};_0x312918(++_0x2dbf19);}(_0xeea2,0x192));var _0x2eea=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xeea2[_0x411017];return _0x2adeea;};'use strict';var _=require(_0x2eea('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2eea('0x1'));var BPromise=require(_0x2eea('0x2'));var rp=require(_0x2eea('0x3'));var attributes=require(_0x2eea('0x4'));module[_0x2eea('0x5')]=function(_0x142cbf,_0x26c220){return _0x142cbf[_0x2eea('0x6')](_0x2eea('0x7'),attributes,{'tableName':_0x2eea('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x8aa7=['AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api','moment','bluebird','request-promise','./analyticExtractedReport.attributes','define'];(function(_0x39c65b,_0x4b5a02){var _0x487fee=function(_0x5d3a6b){while(--_0x5d3a6b){_0x39c65b['push'](_0x39c65b['shift']());}};_0x487fee(++_0x4b5a02);}(_0x8aa7,0xb6));var _0x78aa=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x8aa7[_0x1d9aa0];return _0x226868;};'use strict';var _=require('lodash');var util=require(_0x78aa('0x0'));var logger=require(_0x78aa('0x1'))(_0x78aa('0x2'));var moment=require(_0x78aa('0x3'));var BPromise=require(_0x78aa('0x4'));var rp=require(_0x78aa('0x5'));var attributes=require(_0x78aa('0x6'));module['exports']=function(_0x2b9bfa,_0x4055f5){return _0x2b9bfa[_0x78aa('0x7')](_0x78aa('0x8'),attributes,{'tableName':_0x78aa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 9ee6715..7791e6c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5dec=['request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s'];(function(_0xdf0132,_0x51bee1){var _0x3518d8=function(_0x423ede){while(--_0x423ede){_0xdf0132['push'](_0xdf0132['shift']());}};_0x3518d8(++_0x51bee1);}(_0x5dec,0x1e9));var _0xc5de=function(_0x4c2cda,_0x5945b0){_0x4c2cda=_0x4c2cda-0x0;var _0x59c47d=_0x5dec[_0x4c2cda];return _0x59c47d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc5de('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc5de('0x1'))['db'];var utils=require(_0xc5de('0x2'));var logger=require('../../config/logger')(_0xc5de('0x3'));var config=require(_0xc5de('0x4'));var jayson=require(_0xc5de('0x5'));var client=jayson[_0xc5de('0x6')][_0xc5de('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x28ac6a,_0x5269bd,_0x444444){return new BPromise(function(_0xd5635,_0x516b1b){return client[_0xc5de('0x8')](_0x28ac6a,_0x444444)[_0xc5de('0x9')](function(_0x2041e7){logger['info'](_0xc5de('0xa'),_0x5269bd,_0xc5de('0xb'));logger[_0xc5de('0xc')](_0xc5de('0xd'),_0x5269bd,_0xc5de('0xb'),JSON[_0xc5de('0xe')](_0x2041e7));if(_0x2041e7[_0xc5de('0xf')]){if(_0x2041e7[_0xc5de('0xf')]['code']===0x1f4){logger[_0xc5de('0xf')](_0xc5de('0xa'),_0x5269bd,_0x2041e7[_0xc5de('0xf')]['message']);return _0x516b1b(_0x2041e7[_0xc5de('0xf')][_0xc5de('0x10')]);}logger[_0xc5de('0xf')](_0xc5de('0xa'),_0x5269bd,_0x2041e7['error']['message']);return _0xd5635(_0x2041e7[_0xc5de('0xf')]['message']);}else{logger[_0xc5de('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5269bd,_0xc5de('0xb'));_0xd5635(_0x2041e7[_0xc5de('0x12')][_0xc5de('0x10')]);}})[_0xc5de('0x13')](function(_0x37a8d1){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x5269bd,_0x37a8d1);_0x516b1b(_0x37a8d1);});});}
\ No newline at end of file
+var _0xbae5=['request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s'];(function(_0x85e1e9,_0x42c570){var _0x1285fa=function(_0x2e098f){while(--_0x2e098f){_0x85e1e9['push'](_0x85e1e9['shift']());}};_0x1285fa(++_0x42c570);}(_0xbae5,0x1cc));var _0x5bae=function(_0x4927aa,_0x9d5890){_0x4927aa=_0x4927aa-0x0;var _0x2b1096=_0xbae5[_0x4927aa];return _0x2b1096;};'use strict';var _=require(_0x5bae('0x0'));var util=require(_0x5bae('0x1'));var moment=require(_0x5bae('0x2'));var BPromise=require(_0x5bae('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5bae('0x4'));var db=require(_0x5bae('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5bae('0x6'))(_0x5bae('0x7'));var config=require(_0x5bae('0x8'));var jayson=require(_0x5bae('0x9'));var client=jayson[_0x5bae('0xa')][_0x5bae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47b08c,_0x416593,_0x470f28){return new BPromise(function(_0x43813d,_0x22de08){return client[_0x5bae('0xc')](_0x47b08c,_0x470f28)[_0x5bae('0xd')](function(_0x50ee96){logger['info'](_0x5bae('0xe'),_0x416593,_0x5bae('0xf'));logger[_0x5bae('0x10')](_0x5bae('0x11'),_0x416593,_0x5bae('0xf'),JSON[_0x5bae('0x12')](_0x50ee96));if(_0x50ee96['error']){if(_0x50ee96['error'][_0x5bae('0x13')]===0x1f4){logger[_0x5bae('0x14')](_0x5bae('0xe'),_0x416593,_0x50ee96[_0x5bae('0x14')][_0x5bae('0x15')]);return _0x22de08(_0x50ee96[_0x5bae('0x14')][_0x5bae('0x15')]);}logger[_0x5bae('0x14')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x416593,_0x50ee96[_0x5bae('0x14')][_0x5bae('0x15')]);return _0x43813d(_0x50ee96['error'][_0x5bae('0x15')]);}else{logger[_0x5bae('0x16')](_0x5bae('0xe'),_0x416593,_0x5bae('0xf'));_0x43813d(_0x50ee96[_0x5bae('0x17')][_0x5bae('0x15')]);}})[_0x5bae('0x18')](function(_0x3aef3e){logger[_0x5bae('0x14')](_0x5bae('0xe'),_0x416593,_0x3aef3e);_0x22de08(_0x3aef3e);});});}
\ No newline at end of file
index 10c2719..78f3580 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc549=['isAuthenticated','index','show','/:id/download','download','post','put','/:id','update','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get'];(function(_0x235482,_0x14b833){var _0x5f5bea=function(_0x17a254){while(--_0x17a254){_0x235482['push'](_0x235482['shift']());}};_0x5f5bea(++_0x14b833);}(_0xc549,0x82));var _0x9c54=function(_0x28d6cd,_0x31841e){_0x28d6cd=_0x28d6cd-0x0;var _0xb8b5a6=_0xc549[_0x28d6cd];return _0xb8b5a6;};'use strict';var multer=require(_0x9c54('0x0'));var util=require('util');var path=require(_0x9c54('0x1'));var timeout=require(_0x9c54('0x2'));var express=require(_0x9c54('0x3'));var router=express[_0x9c54('0x4')]();var auth=require(_0x9c54('0x5'));var interaction=require(_0x9c54('0x6'));var config=require(_0x9c54('0x7'));var controller=require(_0x9c54('0x8'));router[_0x9c54('0x9')]('/',auth[_0x9c54('0xa')](),controller[_0x9c54('0xb')]);router[_0x9c54('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x9c54('0xc')]);router[_0x9c54('0x9')](_0x9c54('0xd'),auth[_0x9c54('0xa')](),controller[_0x9c54('0xe')]);router[_0x9c54('0xf')]('/',auth[_0x9c54('0xa')](),controller['create']);router[_0x9c54('0x10')](_0x9c54('0x11'),auth[_0x9c54('0xa')](),controller[_0x9c54('0x12')]);router['delete']('/:id',auth[_0x9c54('0xa')](),controller[_0x9c54('0x13')]);module['exports']=router;
\ No newline at end of file
+var _0x3f7b=['create','delete','destroy','multer','util','path','express','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','post'];(function(_0x21d831,_0x3dcdea){var _0x154c3f=function(_0x56eb77){while(--_0x56eb77){_0x21d831['push'](_0x21d831['shift']());}};_0x154c3f(++_0x3dcdea);}(_0x3f7b,0x189));var _0xb3f7=function(_0x233ab2,_0x43cd05){_0x233ab2=_0x233ab2-0x0;var _0x4d893f=_0x3f7b[_0x233ab2];return _0x4d893f;};'use strict';var multer=require(_0xb3f7('0x0'));var util=require(_0xb3f7('0x1'));var path=require(_0xb3f7('0x2'));var timeout=require('connect-timeout');var express=require(_0xb3f7('0x3'));var router=express['Router']();var auth=require(_0xb3f7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb3f7('0x5'));var controller=require(_0xb3f7('0x6'));router[_0xb3f7('0x7')]('/',auth[_0xb3f7('0x8')](),controller[_0xb3f7('0x9')]);router[_0xb3f7('0x7')](_0xb3f7('0xa'),auth[_0xb3f7('0x8')](),controller['show']);router[_0xb3f7('0x7')]('/:id/download',auth[_0xb3f7('0x8')](),controller['download']);router[_0xb3f7('0xb')]('/',auth[_0xb3f7('0x8')](),controller[_0xb3f7('0xc')]);router['put']('/:id',auth[_0xb3f7('0x8')](),controller['update']);router[_0xb3f7('0xd')](_0xb3f7('0xa'),auth[_0xb3f7('0x8')](),controller[_0xb3f7('0xe')]);module['exports']=router;
\ No newline at end of file
index 1c10b68..4e0b4a2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfb40=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x625d09,_0x5469a9){var _0x56052a=function(_0x3b862f){while(--_0x3b862f){_0x625d09['push'](_0x625d09['shift']());}};_0x56052a(++_0x5469a9);}(_0xfb40,0xd4));var _0x0fb4=function(_0x5b3e52,_0x373ab7){_0x5b3e52=_0x5b3e52-0x0;var _0x3fc065=_0xfb40[_0x5b3e52];return _0x3fc065;};'use strict';var Sequelize=require(_0x0fb4('0x0'));module[_0x0fb4('0x1')]={'field':{'type':Sequelize[_0x0fb4('0x2')]},'alias':{'type':Sequelize[_0x0fb4('0x3')]},'function':{'type':Sequelize[_0x0fb4('0x3')]},'format':{'type':Sequelize[_0x0fb4('0x3')]},'groupBy':{'type':Sequelize[_0x0fb4('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x0fb4('0x3')]},'custom':{'type':Sequelize[_0x0fb4('0x4')],'defaultValue':![]}};
\ No newline at end of file
+var _0xd1b1=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x3046a7,_0x224ffb){var _0x6b4b2=function(_0x30b1aa){while(--_0x30b1aa){_0x3046a7['push'](_0x3046a7['shift']());}};_0x6b4b2(++_0x224ffb);}(_0xd1b1,0x1e2));var _0x1d1b=function(_0x1b558c,_0x612c29){_0x1b558c=_0x1b558c-0x0;var _0xc880b7=_0xd1b1[_0x1b558c];return _0xc880b7;};'use strict';var Sequelize=require(_0x1d1b('0x0'));module[_0x1d1b('0x1')]={'field':{'type':Sequelize[_0x1d1b('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x1d1b('0x3')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x1d1b('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}};
\ No newline at end of file
index 34677fc..69fdcf5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfacc=['options','include','findAll','rows','catch','show','find','create','bulkCreate','body','params','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','CustomReportId','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','destroy','then','error','name','send','index','AnalyticFieldReport','rawAttributes','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','merge','map','type','key','field','filter'];(function(_0x4564a1,_0x307647){var _0x3b284f=function(_0x5db9e4){while(--_0x5db9e4){_0x4564a1['push'](_0x4564a1['shift']());}};_0x3b284f(++_0x307647);}(_0xfacc,0xff));var _0xcfac=function(_0x29ecbc,_0x2929d9){_0x29ecbc=_0x29ecbc-0x0;var _0x5709b0=_0xfacc[_0x29ecbc];return _0x5709b0;};'use strict';var pdf=require(_0xcfac('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xcfac('0x1'));var zipdir=require(_0xcfac('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcfac('0x3'));var moment=require(_0xcfac('0x4'));var BPromise=require(_0xcfac('0x5'));var Mustache=require(_0xcfac('0x6'));var util=require(_0xcfac('0x7'));var path=require(_0xcfac('0x8'));var sox=require(_0xcfac('0x9'));var csv=require(_0xcfac('0xa'));var ejs=require(_0xcfac('0xb'));var fs=require('fs');var _=require(_0xcfac('0xc'));var squel=require(_0xcfac('0xd'));var crypto=require(_0xcfac('0xe'));var jsforce=require(_0xcfac('0xf'));var deskjs=require(_0xcfac('0x10'));var toCsv=require('to-csv');var querystring=require(_0xcfac('0x11'));var Papa=require('papaparse');var authService=require(_0xcfac('0x12'));var hardwareService=require(_0xcfac('0x13'));var Redis=require(_0xcfac('0x14'));var qs=require('../../components/parsers/qs');var logger=require(_0xcfac('0x15'))(_0xcfac('0x16'));var utils=require('../../config/utils');var config=require(_0xcfac('0x17'));var db=require(_0xcfac('0x18'))['db'];function respondWithStatusCode(_0x51d684,_0x1573d3){_0x1573d3=_0x1573d3||0xcc;return function(_0x12be65){if(_0x12be65){return _0x51d684[_0xcfac('0x19')](_0x1573d3);}return _0x51d684[_0xcfac('0x1a')](_0x1573d3)[_0xcfac('0x1b')]();};}function respondWithResult(_0x1946e0,_0x4fe93e){_0x4fe93e=_0x4fe93e||0xc8;return function(_0x228fd7){if(_0x228fd7){return _0x1946e0['status'](_0x4fe93e)[_0xcfac('0x1c')](_0x228fd7);}};}function respondWithFilteredResult(_0x12c616,_0x4548ec){return function(_0x55e7c3){if(_0x55e7c3){var _0x10698f=_0x55e7c3[_0xcfac('0x1d')],_0x33e034=_0x4548ec[_0xcfac('0x1e')],_0xd6db9c=_0x4548ec[_0xcfac('0x1e')]+_0x4548ec[_0xcfac('0x1f')],_0x4d96bd;if(_0xd6db9c>=_0x10698f){_0xd6db9c=_0x10698f;_0x4d96bd=0xc8;}else{_0x4d96bd=0xce;}_0x12c616[_0xcfac('0x1a')](_0x4d96bd);return _0x12c616[_0xcfac('0x20')](_0xcfac('0x21'),_0x33e034+'-'+_0xd6db9c+'/'+_0x10698f)['json'](_0x55e7c3);}return null;};}function patchUpdates(_0x37d517){return function(_0x967d51){try{jsonpatch['apply'](_0x967d51,_0x37d517,!![]);}catch(_0x26ff9c){return BPromise[_0xcfac('0x22')](_0x26ff9c);}return _0x967d51['save']();};}function saveUpdates(_0x4416b1,_0x4aec58){return function(_0x500de6){if(_0x500de6){return _0x500de6[_0xcfac('0x23')](_0x4416b1)['then'](function(_0x14e746){return _0x14e746;});}return null;};}function removeEntity(_0x250922,_0x5c6c2e){return function(_0x5044f1){if(_0x5044f1){return _0x5044f1[_0xcfac('0x24')]()[_0xcfac('0x25')](function(){_0x250922[_0xcfac('0x1a')](0xcc)[_0xcfac('0x1b')]();});}};}function handleEntityNotFound(_0x37fdfd,_0x1f793c){return function(_0x532c97){if(!_0x532c97){_0x37fdfd[_0xcfac('0x19')](0x194);}return _0x532c97;};}function handleError(_0x3a20ab,_0x35b4c0){_0x35b4c0=_0x35b4c0||0x1f4;return function(_0x770930){logger[_0xcfac('0x26')](_0x770930['stack']);if(_0x770930['name']){delete _0x770930[_0xcfac('0x27')];}_0x3a20ab[_0xcfac('0x1a')](_0x35b4c0)[_0xcfac('0x28')](_0x770930);};}exports[_0xcfac('0x29')]=function(_0x251962,_0x2e2215){var _0x46d4e3={},_0x2b1d8a={},_0x26acd8={'count':0x0,'rows':[]};var _0x38f37b=db[_0xcfac('0x2a')][_0xcfac('0x2b')];_0x2b1d8a[_0xcfac('0x2c')]=_['keys'](_0x38f37b);_0x2b1d8a[_0xcfac('0x2d')]=_['keys'](_0x251962[_0xcfac('0x2d')]);_0x2b1d8a[_0xcfac('0x2e')]=_[_0xcfac('0x2f')](_0x2b1d8a[_0xcfac('0x2c')],_0x2b1d8a['query']);_0x46d4e3['attributes']=_[_0xcfac('0x2f')](_0x2b1d8a[_0xcfac('0x2c')],qs[_0xcfac('0x30')](_0x251962[_0xcfac('0x2d')]['fields']));_0x46d4e3[_0xcfac('0x31')]=_0x46d4e3[_0xcfac('0x31')][_0xcfac('0x32')]?_0x46d4e3[_0xcfac('0x31')]:_0x2b1d8a[_0xcfac('0x2c')];if(!_0x251962[_0xcfac('0x2d')][_0xcfac('0x33')](_0xcfac('0x34'))){_0x46d4e3[_0xcfac('0x1f')]=qs[_0xcfac('0x1f')](_0x251962['query'][_0xcfac('0x1f')]);_0x46d4e3['offset']=qs[_0xcfac('0x1e')](_0x251962[_0xcfac('0x2d')][_0xcfac('0x1e')]);}_0x46d4e3[_0xcfac('0x35')]=qs['sort'](_0x251962[_0xcfac('0x2d')]['sort']);_0x46d4e3[_0xcfac('0x36')]=qs[_0xcfac('0x2e')](_['pick'](_0x251962[_0xcfac('0x2d')],_0x2b1d8a['filters']));if(_0x251962[_0xcfac('0x2d')]['filter']){_0x46d4e3[_0xcfac('0x36')]=_[_0xcfac('0x37')](_0x46d4e3[_0xcfac('0x36')],{'$or':_[_0xcfac('0x38')](_0x38f37b,function(_0x5a3146){if(_0x5a3146[_0xcfac('0x39')][_0xcfac('0x3a')]!=='VIRTUAL'){var _0x479981={};_0x479981[_0x5a3146[_0xcfac('0x3b')]]={'$like':'%'+_0x251962[_0xcfac('0x2d')][_0xcfac('0x3c')]+'%'};return _0x479981;}})});}_0x46d4e3=_['merge']({},_0x46d4e3,_0x251962[_0xcfac('0x3d')]);var _0x4d25c9={'where':_0x46d4e3[_0xcfac('0x36')]};return db[_0xcfac('0x2a')][_0xcfac('0x1d')](_0x4d25c9)[_0xcfac('0x25')](function(_0x2fc6a2){_0x26acd8[_0xcfac('0x1d')]=_0x2fc6a2;if(_0x251962['query']['includeAll']){_0x46d4e3[_0xcfac('0x3e')]=[{'all':!![]}];}return db[_0xcfac('0x2a')][_0xcfac('0x3f')](_0x46d4e3);})[_0xcfac('0x25')](function(_0x147183){_0x26acd8[_0xcfac('0x40')]=_0x147183;return _0x26acd8;})['then'](respondWithFilteredResult(_0x2e2215,_0x46d4e3))[_0xcfac('0x41')](handleError(_0x2e2215,null));};exports[_0xcfac('0x42')]=function(_0x5b5e9a,_0x4d1539){var _0xc1f2ad={'raw':![],'where':{'id':_0x5b5e9a['params']['id']}},_0x3ca91c={};_0x3ca91c[_0xcfac('0x2c')]=_['keys'](db[_0xcfac('0x2a')][_0xcfac('0x2b')]);_0x3ca91c[_0xcfac('0x2d')]=_['keys'](_0x5b5e9a[_0xcfac('0x2d')]);_0x3ca91c[_0xcfac('0x2e')]=_[_0xcfac('0x2f')](_0x3ca91c[_0xcfac('0x2c')],_0x3ca91c[_0xcfac('0x2d')]);_0xc1f2ad[_0xcfac('0x31')]=_[_0xcfac('0x2f')](_0x3ca91c['model'],qs[_0xcfac('0x30')](_0x5b5e9a[_0xcfac('0x2d')][_0xcfac('0x30')]));_0xc1f2ad[_0xcfac('0x31')]=_0xc1f2ad['attributes']['length']?_0xc1f2ad[_0xcfac('0x31')]:_0x3ca91c[_0xcfac('0x2c')];if(_0x5b5e9a['query']['includeAll']){_0xc1f2ad[_0xcfac('0x3e')]=[{'all':!![]}];}_0xc1f2ad=_[_0xcfac('0x37')]({},_0xc1f2ad,_0x5b5e9a[_0xcfac('0x3d')]);return db['AnalyticFieldReport'][_0xcfac('0x43')](_0xc1f2ad)['then'](handleEntityNotFound(_0x4d1539,null))[_0xcfac('0x25')](respondWithResult(_0x4d1539,null))['catch'](handleError(_0x4d1539,null));};exports[_0xcfac('0x44')]=function(_0x33e86d,_0x4cf306){return db[_0xcfac('0x2a')][_0xcfac('0x44')](_0x33e86d['body'],{})['then'](respondWithResult(_0x4cf306,0xc9))['catch'](handleError(_0x4cf306,null));};exports['bulkCreate']=function(_0x5a0403,_0x16040d){return db[_0xcfac('0x2a')][_0xcfac('0x45')](_0x5a0403[_0xcfac('0x46')],{'raw':![],'individualHooks':!![]})[_0xcfac('0x25')](respondWithResult(_0x16040d,0xc9))[_0xcfac('0x41')](handleError(_0x16040d,null));};exports[_0xcfac('0x23')]=function(_0x5f59fe,_0x30795b){if(_0x5f59fe[_0xcfac('0x46')]['id']){delete _0x5f59fe['body']['id'];}return db[_0xcfac('0x2a')][_0xcfac('0x43')]({'where':{'id':_0x5f59fe[_0xcfac('0x47')]['id']}})[_0xcfac('0x25')](handleEntityNotFound(_0x30795b,null))[_0xcfac('0x25')](saveUpdates(_0x5f59fe[_0xcfac('0x46')],null))[_0xcfac('0x25')](respondWithResult(_0x30795b,null))[_0xcfac('0x41')](handleError(_0x30795b,null));};exports[_0xcfac('0x24')]=function(_0x182445,_0x4f6302){return db[_0xcfac('0x2a')]['find']({'where':{'id':_0x182445[_0xcfac('0x47')]['id']}})['then'](handleEntityNotFound(_0x4f6302,null))[_0xcfac('0x25')](removeEntity(_0x4f6302,null))[_0xcfac('0x41')](handleError(_0x4f6302,null));};exports[_0xcfac('0x48')]=function(_0x33c58b,_0x1116a2){return db[_0xcfac('0x2a')]['destroy']({'where':{'id':_0x33c58b['query'][_0xcfac('0x49')]||[]},'raw':![],'individualHooks':!![]})[_0xcfac('0x25')](respondWithResult(_0x1116a2,0xcc))[_0xcfac('0x41')](handleError(_0x1116a2,null));};exports[_0xcfac('0x4a')]=function(_0x1ea612,_0x9d0bf,_0x4005fe){return db[_0xcfac('0x4b')][_0xcfac('0x4c')]({'where':{'id':_0x1ea612['params']['id']}})['then'](handleEntityNotFound(_0x9d0bf,null))[_0xcfac('0x25')](function(_0x4bcc84){if(_0x4bcc84){return db[_0xcfac('0x4d')]['transaction'](function(_0x13bec7){return db[_0xcfac('0x2a')][_0xcfac('0x24')]({'where':{'CustomReportId':_0x1ea612[_0xcfac('0x47')]['id']},'transaction':_0x13bec7})[_0xcfac('0x25')](function(_0x597580){var _0x2fc032=_['map'](_0x1ea612[_0xcfac('0x46')],function(_0x41133f){delete _0x41133f['id'];_0x41133f[_0xcfac('0x4e')]=_0x1ea612[_0xcfac('0x47')]['id'];return _0x41133f;});return db[_0xcfac('0x2a')]['bulkCreate'](_0x2fc032,{'transaction':_0x13bec7});});})[_0xcfac('0x25')](function(){return db[_0xcfac('0x2a')][_0xcfac('0x3f')]({'where':{'CustomReportId':_0x1ea612['params']['id']}});});}})[_0xcfac('0x25')](respondWithResult(_0x9d0bf,null))[_0xcfac('0x41')](handleError(_0x9d0bf,null));};
\ No newline at end of file
+var _0xed38=['sequelize','html-pdf','eml-format','zip-dir','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','AnalyticFieldReport','rawAttributes','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','filters','filter','where','merge','map','type','key','VIRTUAL','field','options','include','findAll','rows','catch','show','create','body','bulkCreate','find','params','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne'];(function(_0x17343f,_0x3215d5){var _0x4f74b6=function(_0x1eaf1b){while(--_0x1eaf1b){_0x17343f['push'](_0x17343f['shift']());}};_0x4f74b6(++_0x3215d5);}(_0xed38,0x9d));var _0x8ed3=function(_0x16b5f4,_0x18efd2){_0x16b5f4=_0x16b5f4-0x0;var _0x45ba06=_0xed38[_0x16b5f4];return _0x45ba06;};'use strict';var pdf=require(_0x8ed3('0x0'));var emlformat=require(_0x8ed3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8ed3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8ed3('0x3'));var Mustache=require(_0x8ed3('0x4'));var util=require(_0x8ed3('0x5'));var path=require(_0x8ed3('0x6'));var sox=require('sox');var csv=require(_0x8ed3('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8ed3('0x8'));var squel=require(_0x8ed3('0x9'));var crypto=require(_0x8ed3('0xa'));var jsforce=require(_0x8ed3('0xb'));var deskjs=require(_0x8ed3('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8ed3('0xd'));var Papa=require(_0x8ed3('0xe'));var authService=require('../../components/auth/service');var hardwareService=require(_0x8ed3('0xf'));var Redis=require('ioredis');var qs=require(_0x8ed3('0x10'));var logger=require(_0x8ed3('0x11'))(_0x8ed3('0x12'));var utils=require('../../config/utils');var config=require(_0x8ed3('0x13'));var db=require(_0x8ed3('0x14'))['db'];function respondWithStatusCode(_0xbec014,_0x2af0e1){_0x2af0e1=_0x2af0e1||0xcc;return function(_0x2da2e9){if(_0x2da2e9){return _0xbec014[_0x8ed3('0x15')](_0x2af0e1);}return _0xbec014[_0x8ed3('0x16')](_0x2af0e1)[_0x8ed3('0x17')]();};}function respondWithResult(_0xb999bb,_0x3d49ea){_0x3d49ea=_0x3d49ea||0xc8;return function(_0x244692){if(_0x244692){return _0xb999bb[_0x8ed3('0x16')](_0x3d49ea)[_0x8ed3('0x18')](_0x244692);}};}function respondWithFilteredResult(_0x2453f6,_0x5b80ba){return function(_0x55dc95){if(_0x55dc95){var _0x20e911=_0x55dc95[_0x8ed3('0x19')],_0x41f4fd=_0x5b80ba[_0x8ed3('0x1a')],_0x2992a0=_0x5b80ba['offset']+_0x5b80ba['limit'],_0x33789f;if(_0x2992a0>=_0x20e911){_0x2992a0=_0x20e911;_0x33789f=0xc8;}else{_0x33789f=0xce;}_0x2453f6[_0x8ed3('0x16')](_0x33789f);return _0x2453f6[_0x8ed3('0x1b')](_0x8ed3('0x1c'),_0x41f4fd+'-'+_0x2992a0+'/'+_0x20e911)[_0x8ed3('0x18')](_0x55dc95);}return null;};}function patchUpdates(_0x463e5d){return function(_0x33d31a){try{jsonpatch[_0x8ed3('0x1d')](_0x33d31a,_0x463e5d,!![]);}catch(_0x424f54){return BPromise[_0x8ed3('0x1e')](_0x424f54);}return _0x33d31a[_0x8ed3('0x1f')]();};}function saveUpdates(_0x34c248,_0x123d1c){return function(_0x256e84){if(_0x256e84){return _0x256e84[_0x8ed3('0x20')](_0x34c248)[_0x8ed3('0x21')](function(_0x1a79df){return _0x1a79df;});}return null;};}function removeEntity(_0x1edb18,_0xcf1203){return function(_0xa2fdc9){if(_0xa2fdc9){return _0xa2fdc9[_0x8ed3('0x22')]()[_0x8ed3('0x21')](function(){_0x1edb18[_0x8ed3('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cfacf,_0x2fb3dc){return function(_0x6d415){if(!_0x6d415){_0x2cfacf[_0x8ed3('0x15')](0x194);}return _0x6d415;};}function handleError(_0x156456,_0xf0bc94){_0xf0bc94=_0xf0bc94||0x1f4;return function(_0x138201){logger[_0x8ed3('0x23')](_0x138201['stack']);if(_0x138201[_0x8ed3('0x24')]){delete _0x138201[_0x8ed3('0x24')];}_0x156456['status'](_0xf0bc94)[_0x8ed3('0x25')](_0x138201);};}exports[_0x8ed3('0x26')]=function(_0x53baa9,_0x38a8df){var _0x2feef0={},_0x31be72={},_0x22df3b={'count':0x0,'rows':[]};var _0x52630d=db[_0x8ed3('0x27')][_0x8ed3('0x28')];_0x31be72[_0x8ed3('0x29')]=_[_0x8ed3('0x2a')](_0x52630d);_0x31be72[_0x8ed3('0x2b')]=_[_0x8ed3('0x2a')](_0x53baa9[_0x8ed3('0x2b')]);_0x31be72['filters']=_['intersection'](_0x31be72['model'],_0x31be72[_0x8ed3('0x2b')]);_0x2feef0[_0x8ed3('0x2c')]=_[_0x8ed3('0x2d')](_0x31be72['model'],qs[_0x8ed3('0x2e')](_0x53baa9[_0x8ed3('0x2b')]['fields']));_0x2feef0[_0x8ed3('0x2c')]=_0x2feef0[_0x8ed3('0x2c')][_0x8ed3('0x2f')]?_0x2feef0['attributes']:_0x31be72['model'];if(!_0x53baa9['query'][_0x8ed3('0x30')]('nolimit')){_0x2feef0[_0x8ed3('0x31')]=qs[_0x8ed3('0x31')](_0x53baa9[_0x8ed3('0x2b')][_0x8ed3('0x31')]);_0x2feef0[_0x8ed3('0x1a')]=qs[_0x8ed3('0x1a')](_0x53baa9[_0x8ed3('0x2b')]['offset']);}_0x2feef0[_0x8ed3('0x32')]=qs['sort'](_0x53baa9['query'][_0x8ed3('0x33')]);_0x2feef0['where']=qs[_0x8ed3('0x34')](_['pick'](_0x53baa9[_0x8ed3('0x2b')],_0x31be72[_0x8ed3('0x34')]));if(_0x53baa9[_0x8ed3('0x2b')][_0x8ed3('0x35')]){_0x2feef0[_0x8ed3('0x36')]=_[_0x8ed3('0x37')](_0x2feef0['where'],{'$or':_[_0x8ed3('0x38')](_0x52630d,function(_0x244dd0){if(_0x244dd0[_0x8ed3('0x39')][_0x8ed3('0x3a')]!==_0x8ed3('0x3b')){var _0x1d8318={};_0x1d8318[_0x244dd0[_0x8ed3('0x3c')]]={'$like':'%'+_0x53baa9[_0x8ed3('0x2b')][_0x8ed3('0x35')]+'%'};return _0x1d8318;}})});}_0x2feef0=_[_0x8ed3('0x37')]({},_0x2feef0,_0x53baa9[_0x8ed3('0x3d')]);var _0x2b18a3={'where':_0x2feef0[_0x8ed3('0x36')]};return db[_0x8ed3('0x27')][_0x8ed3('0x19')](_0x2b18a3)['then'](function(_0x42b785){_0x22df3b[_0x8ed3('0x19')]=_0x42b785;if(_0x53baa9['query']['includeAll']){_0x2feef0[_0x8ed3('0x3e')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x8ed3('0x3f')](_0x2feef0);})[_0x8ed3('0x21')](function(_0x46328d){_0x22df3b[_0x8ed3('0x40')]=_0x46328d;return _0x22df3b;})[_0x8ed3('0x21')](respondWithFilteredResult(_0x38a8df,_0x2feef0))[_0x8ed3('0x41')](handleError(_0x38a8df,null));};exports[_0x8ed3('0x42')]=function(_0x2bd08d,_0x12bd50){var _0x26e847={'raw':![],'where':{'id':_0x2bd08d['params']['id']}},_0x191715={};_0x191715['model']=_[_0x8ed3('0x2a')](db[_0x8ed3('0x27')][_0x8ed3('0x28')]);_0x191715[_0x8ed3('0x2b')]=_[_0x8ed3('0x2a')](_0x2bd08d[_0x8ed3('0x2b')]);_0x191715[_0x8ed3('0x34')]=_['intersection'](_0x191715[_0x8ed3('0x29')],_0x191715[_0x8ed3('0x2b')]);_0x26e847[_0x8ed3('0x2c')]=_[_0x8ed3('0x2d')](_0x191715[_0x8ed3('0x29')],qs[_0x8ed3('0x2e')](_0x2bd08d[_0x8ed3('0x2b')]['fields']));_0x26e847[_0x8ed3('0x2c')]=_0x26e847[_0x8ed3('0x2c')]['length']?_0x26e847[_0x8ed3('0x2c')]:_0x191715[_0x8ed3('0x29')];if(_0x2bd08d[_0x8ed3('0x2b')]['includeAll']){_0x26e847[_0x8ed3('0x3e')]=[{'all':!![]}];}_0x26e847=_['merge']({},_0x26e847,_0x2bd08d['options']);return db['AnalyticFieldReport']['find'](_0x26e847)['then'](handleEntityNotFound(_0x12bd50,null))[_0x8ed3('0x21')](respondWithResult(_0x12bd50,null))[_0x8ed3('0x41')](handleError(_0x12bd50,null));};exports[_0x8ed3('0x43')]=function(_0x59c21a,_0x44721f){return db[_0x8ed3('0x27')][_0x8ed3('0x43')](_0x59c21a[_0x8ed3('0x44')],{})[_0x8ed3('0x21')](respondWithResult(_0x44721f,0xc9))[_0x8ed3('0x41')](handleError(_0x44721f,null));};exports['bulkCreate']=function(_0x4eb294,_0x26bf5f){return db[_0x8ed3('0x27')][_0x8ed3('0x45')](_0x4eb294[_0x8ed3('0x44')],{'raw':![],'individualHooks':!![]})[_0x8ed3('0x21')](respondWithResult(_0x26bf5f,0xc9))[_0x8ed3('0x41')](handleError(_0x26bf5f,null));};exports[_0x8ed3('0x20')]=function(_0x2045ab,_0x4dbb2a){if(_0x2045ab['body']['id']){delete _0x2045ab[_0x8ed3('0x44')]['id'];}return db[_0x8ed3('0x27')][_0x8ed3('0x46')]({'where':{'id':_0x2045ab[_0x8ed3('0x47')]['id']}})[_0x8ed3('0x21')](handleEntityNotFound(_0x4dbb2a,null))[_0x8ed3('0x21')](saveUpdates(_0x2045ab['body'],null))[_0x8ed3('0x21')](respondWithResult(_0x4dbb2a,null))['catch'](handleError(_0x4dbb2a,null));};exports[_0x8ed3('0x22')]=function(_0x2ea0a6,_0x42b75b){return db[_0x8ed3('0x27')][_0x8ed3('0x46')]({'where':{'id':_0x2ea0a6[_0x8ed3('0x47')]['id']}})[_0x8ed3('0x21')](handleEntityNotFound(_0x42b75b,null))['then'](removeEntity(_0x42b75b,null))[_0x8ed3('0x41')](handleError(_0x42b75b,null));};exports[_0x8ed3('0x48')]=function(_0x26bbe7,_0x23fdf8){return db[_0x8ed3('0x27')][_0x8ed3('0x22')]({'where':{'id':_0x26bbe7[_0x8ed3('0x2b')][_0x8ed3('0x49')]||[]},'raw':![],'individualHooks':!![]})[_0x8ed3('0x21')](respondWithResult(_0x23fdf8,0xcc))[_0x8ed3('0x41')](handleError(_0x23fdf8,null));};exports[_0x8ed3('0x4a')]=function(_0x10b3c7,_0x2fcbf1,_0x521406){return db[_0x8ed3('0x4b')][_0x8ed3('0x4c')]({'where':{'id':_0x10b3c7[_0x8ed3('0x47')]['id']}})[_0x8ed3('0x21')](handleEntityNotFound(_0x2fcbf1,null))[_0x8ed3('0x21')](function(_0x3ab4f8){if(_0x3ab4f8){return db[_0x8ed3('0x4d')]['transaction'](function(_0x55e481){return db[_0x8ed3('0x27')][_0x8ed3('0x22')]({'where':{'CustomReportId':_0x10b3c7['params']['id']},'transaction':_0x55e481})[_0x8ed3('0x21')](function(_0x4551a8){var _0xd8bcb6=_[_0x8ed3('0x38')](_0x10b3c7[_0x8ed3('0x44')],function(_0x3745c1){delete _0x3745c1['id'];_0x3745c1['CustomReportId']=_0x10b3c7['params']['id'];return _0x3745c1;});return db['AnalyticFieldReport'][_0x8ed3('0x45')](_0xd8bcb6,{'transaction':_0x55e481});});})['then'](function(){return db['AnalyticFieldReport'][_0x8ed3('0x3f')]({'where':{'CustomReportId':_0x10b3c7['params']['id']}});});}})[_0x8ed3('0x21')](respondWithResult(_0x2fcbf1,null))[_0x8ed3('0x41')](handleError(_0x2fcbf1,null));};
\ No newline at end of file
index eb54f0f..fb4fc54 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3717=['./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x396811,_0x38ff0f){var _0x26919f=function(_0x14492d){while(--_0x14492d){_0x396811['push'](_0x396811['shift']());}};_0x26919f(++_0x38ff0f);}(_0x3717,0xcb));var _0x7371=function(_0x29b399,_0x153317){_0x29b399=_0x29b399-0x0;var _0x30f2ce=_0x3717[_0x29b399];return _0x30f2ce;};'use strict';var _=require(_0x7371('0x0'));var util=require(_0x7371('0x1'));var logger=require(_0x7371('0x2'))(_0x7371('0x3'));var moment=require(_0x7371('0x4'));var BPromise=require(_0x7371('0x5'));var rp=require('request-promise');var attributes=require(_0x7371('0x6'));module[_0x7371('0x7')]=function(_0x160204,_0x58fe2f){return _0x160204[_0x7371('0x8')](_0x7371('0x9'),attributes,{'tableName':_0x7371('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x329e=['moment','bluebird','request-promise','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger'];(function(_0x167cba,_0x33ac97){var _0x52794a=function(_0x22a07d){while(--_0x22a07d){_0x167cba['push'](_0x167cba['shift']());}};_0x52794a(++_0x33ac97);}(_0x329e,0x8c));var _0xe329=function(_0x508692,_0x11c4ec){_0x508692=_0x508692-0x0;var _0x103eab=_0x329e[_0x508692];return _0x103eab;};'use strict';var _=require(_0xe329('0x0'));var util=require(_0xe329('0x1'));var logger=require(_0xe329('0x2'))('api');var moment=require(_0xe329('0x3'));var BPromise=require(_0xe329('0x4'));var rp=require(_0xe329('0x5'));var attributes=require(_0xe329('0x6'));module[_0xe329('0x7')]=function(_0x570da9,_0x2cd847){return _0x570da9[_0xe329('0x8')](_0xe329('0x9'),attributes,{'tableName':_0xe329('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 2950782..3ad1ede 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4a80=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x571d24,_0x2124cb){var _0x5368e9=function(_0x191b18){while(--_0x191b18){_0x571d24['push'](_0x571d24['shift']());}};_0x5368e9(++_0x2124cb);}(_0x4a80,0xbe));var _0x04a8=function(_0x834092,_0x429e9c){_0x834092=_0x834092-0x0;var _0x631023=_0x4a80[_0x834092];return _0x631023;};'use strict';var _=require(_0x04a8('0x0'));var util=require('util');var moment=require(_0x04a8('0x1'));var BPromise=require(_0x04a8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x04a8('0x3'));var db=require(_0x04a8('0x4'))['db'];var utils=require(_0x04a8('0x5'));var logger=require(_0x04a8('0x6'))(_0x04a8('0x7'));var config=require(_0x04a8('0x8'));var jayson=require(_0x04a8('0x9'));var client=jayson[_0x04a8('0xa')][_0x04a8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d4bad,_0x59079a,_0x40de61){return new BPromise(function(_0x103ebc,_0x2ddb2b){return client[_0x04a8('0xc')](_0x1d4bad,_0x40de61)[_0x04a8('0xd')](function(_0x155a50){logger[_0x04a8('0xe')](_0x04a8('0xf'),_0x59079a,_0x04a8('0x10'));logger[_0x04a8('0x11')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x59079a,_0x04a8('0x10'),JSON[_0x04a8('0x12')](_0x155a50));if(_0x155a50[_0x04a8('0x13')]){if(_0x155a50['error'][_0x04a8('0x14')]===0x1f4){logger[_0x04a8('0x13')](_0x04a8('0xf'),_0x59079a,_0x155a50[_0x04a8('0x13')][_0x04a8('0x15')]);return _0x2ddb2b(_0x155a50[_0x04a8('0x13')][_0x04a8('0x15')]);}logger['error'](_0x04a8('0xf'),_0x59079a,_0x155a50[_0x04a8('0x13')][_0x04a8('0x15')]);return _0x103ebc(_0x155a50['error']['message']);}else{logger[_0x04a8('0xe')](_0x04a8('0xf'),_0x59079a,'request\x20sent');_0x103ebc(_0x155a50[_0x04a8('0x16')]['message']);}})[_0x04a8('0x17')](function(_0x5dee8a){logger[_0x04a8('0x13')](_0x04a8('0xf'),_0x59079a,_0x5dee8a);_0x2ddb2b(_0x5dee8a);});});}
\ No newline at end of file
+var _0xac0a=['AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x50b936,_0x49b04f){var _0x1785f4=function(_0x704dfa){while(--_0x704dfa){_0x50b936['push'](_0x50b936['shift']());}};_0x1785f4(++_0x49b04f);}(_0xac0a,0x11e));var _0xaac0=function(_0x1ee592,_0x3dcaef){_0x1ee592=_0x1ee592-0x0;var _0x38eb9d=_0xac0a[_0x1ee592];return _0x38eb9d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaac0('0x0'));var BPromise=require(_0xaac0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaac0('0x2'));var db=require(_0xaac0('0x3'))['db'];var utils=require(_0xaac0('0x4'));var logger=require(_0xaac0('0x5'))(_0xaac0('0x6'));var config=require(_0xaac0('0x7'));var jayson=require(_0xaac0('0x8'));var client=jayson[_0xaac0('0x9')][_0xaac0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc3366d,_0x2d5629,_0x1b9348){return new BPromise(function(_0x5d27ab,_0x91b8f4){return client[_0xaac0('0xb')](_0xc3366d,_0x1b9348)['then'](function(_0x1bdda5){logger[_0xaac0('0xc')](_0xaac0('0xd'),_0x2d5629,_0xaac0('0xe'));logger[_0xaac0('0xf')](_0xaac0('0x10'),_0x2d5629,_0xaac0('0xe'),JSON[_0xaac0('0x11')](_0x1bdda5));if(_0x1bdda5[_0xaac0('0x12')]){if(_0x1bdda5[_0xaac0('0x12')][_0xaac0('0x13')]===0x1f4){logger[_0xaac0('0x12')](_0xaac0('0xd'),_0x2d5629,_0x1bdda5[_0xaac0('0x12')][_0xaac0('0x14')]);return _0x91b8f4(_0x1bdda5[_0xaac0('0x12')][_0xaac0('0x14')]);}logger[_0xaac0('0x12')](_0xaac0('0xd'),_0x2d5629,_0x1bdda5[_0xaac0('0x12')][_0xaac0('0x14')]);return _0x5d27ab(_0x1bdda5[_0xaac0('0x12')][_0xaac0('0x14')]);}else{logger[_0xaac0('0xc')](_0xaac0('0xd'),_0x2d5629,_0xaac0('0xe'));_0x5d27ab(_0x1bdda5[_0xaac0('0x15')]['message']);}})[_0xaac0('0x16')](function(_0x542132){logger['error'](_0xaac0('0xd'),_0x2d5629,_0x542132);_0x91b8f4(_0x542132);});});}
\ No newline at end of file
index 56c77ce..8e11b95 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x39cb=['delete','/destroy_many','bulkDestroy','destroy','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','/:id','show','create','post','/create_many','addFields','put','update'];(function(_0x3b3cff,_0x304c19){var _0x3b859c=function(_0x5c4e26){while(--_0x5c4e26){_0x3b3cff['push'](_0x3b3cff['shift']());}};_0x3b859c(++_0x304c19);}(_0x39cb,0x1bd));var _0xb39c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x39cb[_0x4b369d];return _0x571a98;};'use strict';var multer=require('multer');var util=require(_0xb39c('0x0'));var path=require(_0xb39c('0x1'));var timeout=require('connect-timeout');var express=require(_0xb39c('0x2'));var router=express[_0xb39c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb39c('0x4'));var config=require(_0xb39c('0x5'));var controller=require(_0xb39c('0x6'));router[_0xb39c('0x7')]('/',auth[_0xb39c('0x8')](),controller['index']);router[_0xb39c('0x7')](_0xb39c('0x9'),auth[_0xb39c('0x8')](),controller[_0xb39c('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb39c('0xb')]);router[_0xb39c('0xc')](_0xb39c('0xd'),auth[_0xb39c('0x8')](),controller['bulkCreate']);router['post']('/:id/create_many',auth[_0xb39c('0x8')](),controller[_0xb39c('0xe')]);router[_0xb39c('0xf')](_0xb39c('0x9'),auth[_0xb39c('0x8')](),controller[_0xb39c('0x10')]);router[_0xb39c('0x11')](_0xb39c('0x12'),auth['isAuthenticated'](),controller[_0xb39c('0x13')]);router[_0xb39c('0x11')](_0xb39c('0x9'),auth['isAuthenticated'](),controller[_0xb39c('0x14')]);module[_0xb39c('0x15')]=router;
\ No newline at end of file
+var _0x22fb=['delete','destroy','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','/create_many','bulkCreate','/:id/create_many','addFields','update','bulkDestroy'];(function(_0x2598ef,_0x527446){var _0x4b5f0a=function(_0x4641df){while(--_0x4641df){_0x2598ef['push'](_0x2598ef['shift']());}};_0x4b5f0a(++_0x527446);}(_0x22fb,0x192));var _0xb22f=function(_0x524f4a,_0x1096c6){_0x524f4a=_0x524f4a-0x0;var _0x41a443=_0x22fb[_0x524f4a];return _0x41a443;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb22f('0x0'));var timeout=require('connect-timeout');var express=require(_0xb22f('0x1'));var router=express[_0xb22f('0x2')]();var auth=require(_0xb22f('0x3'));var interaction=require(_0xb22f('0x4'));var config=require(_0xb22f('0x5'));var controller=require('./analyticFieldReport.controller');router[_0xb22f('0x6')]('/',auth[_0xb22f('0x7')](),controller[_0xb22f('0x8')]);router[_0xb22f('0x6')](_0xb22f('0x9'),auth[_0xb22f('0x7')](),controller['show']);router[_0xb22f('0xa')]('/',auth[_0xb22f('0x7')](),controller[_0xb22f('0xb')]);router[_0xb22f('0xa')](_0xb22f('0xc'),auth[_0xb22f('0x7')](),controller[_0xb22f('0xd')]);router[_0xb22f('0xa')](_0xb22f('0xe'),auth[_0xb22f('0x7')](),controller[_0xb22f('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb22f('0x10')]);router['delete']('/destroy_many',auth['isAuthenticated'](),controller[_0xb22f('0x11')]);router[_0xb22f('0x12')](_0xb22f('0x9'),auth[_0xb22f('0x7')](),controller[_0xb22f('0x13')]);module[_0xb22f('0x14')]=router;
\ No newline at end of file
index 750a733..a7e894f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1cbc=['STRING','name','exports'];(function(_0x6968e0,_0x3a31f6){var _0x243597=function(_0xb49140){while(--_0xb49140){_0x6968e0['push'](_0x6968e0['shift']());}};_0x243597(++_0x3a31f6);}(_0x1cbc,0x1b2));var _0xc1cb=function(_0x433774,_0x399331){_0x433774=_0x433774-0x0;var _0x34900a=_0x1cbc[_0x433774];return _0x34900a;};'use strict';var Sequelize=require('sequelize');module[_0xc1cb('0x0')]={'name':{'type':Sequelize[_0xc1cb('0x1')],'allowNull':![],'unique':_0xc1cb('0x2')},'table':{'type':Sequelize[_0xc1cb('0x1')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xc1cb('0x1')]}};
\ No newline at end of file
+var _0x98ac=['STRING','name','TEXT'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x98ac,0x1da));var _0xc98a=function(_0x19c2b3,_0x459cda){_0x19c2b3=_0x19c2b3-0x0;var _0x15a8d8=_0x98ac[_0x19c2b3];return _0x15a8d8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc98a('0x0')],'allowNull':![],'unique':_0xc98a('0x1')},'table':{'type':Sequelize[_0xc98a('0x0')]},'metric':{'type':Sequelize[_0xc98a('0x2')]},'description':{'type':Sequelize[_0xc98a('0x0')]}};
\ No newline at end of file
index 1988f07..f99bd76 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xabc7=['request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','Metrics','then','error','stack','name','send','index','AnalyticMetric','rawAttributes','keys','query','model','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filters','filter','merge','key','field','options','where','include','rows','catch','show','params','fields','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','rimraf','fast-json-patch'];(function(_0x46b00a,_0x18cd84){var _0xad86f1=function(_0x40da50){while(--_0x40da50){_0x46b00a['push'](_0x46b00a['shift']());}};_0xad86f1(++_0x18cd84);}(_0xabc7,0x139));var _0x7abc=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xabc7[_0x580576];return _0x3f55a0;};'use strict';var pdf=require(_0x7abc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7abc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7abc('0x2'));var rp=require(_0x7abc('0x3'));var moment=require(_0x7abc('0x4'));var BPromise=require(_0x7abc('0x5'));var Mustache=require(_0x7abc('0x6'));var util=require(_0x7abc('0x7'));var path=require(_0x7abc('0x8'));var sox=require('sox');var csv=require(_0x7abc('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7abc('0xa'));var squel=require(_0x7abc('0xb'));var crypto=require(_0x7abc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7abc('0xd'));var toCsv=require(_0x7abc('0x9'));var querystring=require(_0x7abc('0xe'));var Papa=require(_0x7abc('0xf'));var authService=require(_0x7abc('0x10'));var hardwareService=require(_0x7abc('0x11'));var Redis=require(_0x7abc('0x12'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x7abc('0x13'));var utils=require(_0x7abc('0x14'));var config=require('../../config/environment');var db=require(_0x7abc('0x15'))['db'];function respondWithStatusCode(_0x7c374f,_0x54c201){_0x54c201=_0x54c201||0xcc;return function(_0x3c8b07){if(_0x3c8b07){return _0x7c374f[_0x7abc('0x16')](_0x54c201);}return _0x7c374f[_0x7abc('0x17')](_0x54c201)[_0x7abc('0x18')]();};}function respondWithResult(_0xdb951,_0x245793){_0x245793=_0x245793||0xc8;return function(_0x50cfd1){if(_0x50cfd1){return _0xdb951[_0x7abc('0x17')](_0x245793)['json'](_0x50cfd1);}};}function respondWithFilteredResult(_0x18f7d7,_0x1ffea4){return function(_0x2524e9){if(_0x2524e9){var _0x175c0d=_0x2524e9[_0x7abc('0x19')],_0x22180d=_0x1ffea4[_0x7abc('0x1a')],_0x5011d4=_0x1ffea4[_0x7abc('0x1a')]+_0x1ffea4['limit'],_0x1d89c7;if(_0x5011d4>=_0x175c0d){_0x5011d4=_0x175c0d;_0x1d89c7=0xc8;}else{_0x1d89c7=0xce;}_0x18f7d7['status'](_0x1d89c7);return _0x18f7d7[_0x7abc('0x1b')](_0x7abc('0x1c'),_0x22180d+'-'+_0x5011d4+'/'+_0x175c0d)['json'](_0x2524e9);}return null;};}function patchUpdates(_0x468191){return function(_0x2f33f9){try{jsonpatch[_0x7abc('0x1d')](_0x2f33f9,_0x468191,!![]);}catch(_0xf1fcd5){return BPromise[_0x7abc('0x1e')](_0xf1fcd5);}return _0x2f33f9[_0x7abc('0x1f')]();};}function saveUpdates(_0xca55c6,_0x23ac10){return function(_0x388dee){if(_0x388dee){return _0x388dee[_0x7abc('0x20')](_0xca55c6)['then'](function(_0x519603){return _0x519603;});}return null;};}function removeEntity(_0x275013,_0x34eba9){return function(_0x1f29c0){if(_0x1f29c0){return _0x1f29c0[_0x7abc('0x21')]()['then'](function(){var _0x2a76f2=_0x1f29c0[_0x7abc('0x22')]({'plain':!![]});var _0x410ea0=_0x7abc('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x410ea0,'resourceId':_0x2a76f2['id']}})[_0x7abc('0x24')](function(){return _0x1f29c0;});})[_0x7abc('0x24')](function(){_0x275013[_0x7abc('0x17')](0xcc)[_0x7abc('0x18')]();});}};}function handleEntityNotFound(_0x4ba9db,_0x31193b){return function(_0x142451){if(!_0x142451){_0x4ba9db[_0x7abc('0x16')](0x194);}return _0x142451;};}function handleError(_0x4541c6,_0x5e68c6){_0x5e68c6=_0x5e68c6||0x1f4;return function(_0x3c376c){logger[_0x7abc('0x25')](_0x3c376c[_0x7abc('0x26')]);if(_0x3c376c[_0x7abc('0x27')]){delete _0x3c376c[_0x7abc('0x27')];}_0x4541c6[_0x7abc('0x17')](_0x5e68c6)[_0x7abc('0x28')](_0x3c376c);};}exports[_0x7abc('0x29')]=function(_0x2da223,_0x5b973b){var _0xf47d5d={},_0x39ad72={},_0x51d37c={'count':0x0,'rows':[]};var _0x43fe11=db[_0x7abc('0x2a')][_0x7abc('0x2b')];_0x39ad72['model']=_[_0x7abc('0x2c')](_0x43fe11);_0x39ad72[_0x7abc('0x2d')]=_['keys'](_0x2da223[_0x7abc('0x2d')]);_0x39ad72['filters']=_['intersection'](_0x39ad72[_0x7abc('0x2e')],_0x39ad72[_0x7abc('0x2d')]);_0xf47d5d['attributes']=_[_0x7abc('0x2f')](_0x39ad72[_0x7abc('0x2e')],qs['fields'](_0x2da223[_0x7abc('0x2d')]['fields']));_0xf47d5d['attributes']=_0xf47d5d[_0x7abc('0x30')][_0x7abc('0x31')]?_0xf47d5d[_0x7abc('0x30')]:_0x39ad72[_0x7abc('0x2e')];if(!_0x2da223[_0x7abc('0x2d')][_0x7abc('0x32')](_0x7abc('0x33'))){_0xf47d5d[_0x7abc('0x34')]=qs[_0x7abc('0x34')](_0x2da223['query'][_0x7abc('0x34')]);_0xf47d5d[_0x7abc('0x1a')]=qs[_0x7abc('0x1a')](_0x2da223[_0x7abc('0x2d')][_0x7abc('0x1a')]);}_0xf47d5d[_0x7abc('0x35')]=qs[_0x7abc('0x36')](_0x2da223[_0x7abc('0x2d')][_0x7abc('0x36')]);_0xf47d5d['where']=qs['filters'](_[_0x7abc('0x37')](_0x2da223[_0x7abc('0x2d')],_0x39ad72[_0x7abc('0x38')]));if(_0x2da223[_0x7abc('0x2d')][_0x7abc('0x39')]){_0xf47d5d['where']=_[_0x7abc('0x3a')](_0xf47d5d['where'],{'$or':_['map'](_0x43fe11,function(_0x457838){if(_0x457838['type'][_0x7abc('0x3b')]!=='VIRTUAL'){var _0x4b1f4a={};_0x4b1f4a[_0x457838[_0x7abc('0x3c')]]={'$like':'%'+_0x2da223[_0x7abc('0x2d')][_0x7abc('0x39')]+'%'};return _0x4b1f4a;}})});}_0xf47d5d=_[_0x7abc('0x3a')]({},_0xf47d5d,_0x2da223[_0x7abc('0x3d')]);var _0x433edf={'where':_0xf47d5d[_0x7abc('0x3e')]};return db[_0x7abc('0x2a')][_0x7abc('0x19')](_0x433edf)[_0x7abc('0x24')](function(_0x463c8b){_0x51d37c['count']=_0x463c8b;if(_0x2da223[_0x7abc('0x2d')]['includeAll']){_0xf47d5d[_0x7abc('0x3f')]=[{'all':!![]}];}return db[_0x7abc('0x2a')]['findAll'](_0xf47d5d);})[_0x7abc('0x24')](function(_0xad0e1e){_0x51d37c[_0x7abc('0x40')]=_0xad0e1e;return _0x51d37c;})[_0x7abc('0x24')](respondWithFilteredResult(_0x5b973b,_0xf47d5d))[_0x7abc('0x41')](handleError(_0x5b973b,null));};exports[_0x7abc('0x42')]=function(_0x145ec,_0x2a7b71){var _0x320faf={'raw':!![],'where':{'id':_0x145ec[_0x7abc('0x43')]['id']}},_0x3b0c16={};_0x3b0c16[_0x7abc('0x2e')]=_[_0x7abc('0x2c')](db[_0x7abc('0x2a')][_0x7abc('0x2b')]);_0x3b0c16['query']=_['keys'](_0x145ec[_0x7abc('0x2d')]);_0x3b0c16[_0x7abc('0x38')]=_[_0x7abc('0x2f')](_0x3b0c16[_0x7abc('0x2e')],_0x3b0c16[_0x7abc('0x2d')]);_0x320faf[_0x7abc('0x30')]=_[_0x7abc('0x2f')](_0x3b0c16[_0x7abc('0x2e')],qs[_0x7abc('0x44')](_0x145ec[_0x7abc('0x2d')][_0x7abc('0x44')]));_0x320faf['attributes']=_0x320faf['attributes'][_0x7abc('0x31')]?_0x320faf[_0x7abc('0x30')]:_0x3b0c16[_0x7abc('0x2e')];if(_0x145ec[_0x7abc('0x2d')][_0x7abc('0x45')]){_0x320faf[_0x7abc('0x3f')]=[{'all':!![]}];}_0x320faf=_[_0x7abc('0x3a')]({},_0x320faf,_0x145ec[_0x7abc('0x3d')]);return db[_0x7abc('0x2a')][_0x7abc('0x46')](_0x320faf)[_0x7abc('0x24')](handleEntityNotFound(_0x2a7b71,null))[_0x7abc('0x24')](respondWithResult(_0x2a7b71,null))[_0x7abc('0x41')](handleError(_0x2a7b71,null));};exports[_0x7abc('0x47')]=function(_0x58a37f,_0x4cbb71){return db[_0x7abc('0x2a')][_0x7abc('0x47')](_0x58a37f['body'],{})[_0x7abc('0x24')](function(_0x4762d7){var _0x3c919a=_0x58a37f[_0x7abc('0x48')][_0x7abc('0x22')]({'plain':!![]});if(!_0x3c919a)throw new Error(_0x7abc('0x49'));if(_0x3c919a['role']==='user'){var _0x2e6ef0=_0x4762d7[_0x7abc('0x22')]({'plain':!![]});var _0xb3c17d=_0x7abc('0x23');return db['UserProfileSection'][_0x7abc('0x46')]({'where':{'name':_0xb3c17d,'userProfileId':_0x3c919a[_0x7abc('0x4a')]},'raw':!![]})[_0x7abc('0x24')](function(_0x4b1da8){if(_0x4b1da8&&_0x4b1da8[_0x7abc('0x4b')]===0x0){return db[_0x7abc('0x4c')][_0x7abc('0x47')]({'name':_0x2e6ef0[_0x7abc('0x27')],'resourceId':_0x2e6ef0['id'],'type':_0x4b1da8[_0x7abc('0x27')],'sectionId':_0x4b1da8['id']},{})[_0x7abc('0x24')](function(){return _0x4762d7;});}else{return _0x4762d7;}})[_0x7abc('0x41')](function(_0x25376a){logger[_0x7abc('0x25')](_0x7abc('0x4d'),_0x25376a);throw _0x25376a;});}return _0x4762d7;})[_0x7abc('0x24')](respondWithResult(_0x4cbb71,0xc9))[_0x7abc('0x41')](handleError(_0x4cbb71,null));};exports['update']=function(_0x476598,_0x448a14){if(_0x476598[_0x7abc('0x4e')]['id']){delete _0x476598[_0x7abc('0x4e')]['id'];}return db[_0x7abc('0x2a')][_0x7abc('0x46')]({'where':{'id':_0x476598[_0x7abc('0x43')]['id']}})[_0x7abc('0x24')](handleEntityNotFound(_0x448a14,null))[_0x7abc('0x24')](saveUpdates(_0x476598[_0x7abc('0x4e')],null))[_0x7abc('0x24')](respondWithResult(_0x448a14,null))['catch'](handleError(_0x448a14,null));};exports['destroy']=function(_0x471630,_0x50b33a){return db[_0x7abc('0x2a')][_0x7abc('0x46')]({'where':{'id':_0x471630[_0x7abc('0x43')]['id']}})[_0x7abc('0x24')](handleEntityNotFound(_0x50b33a,null))[_0x7abc('0x24')](removeEntity(_0x50b33a,null))[_0x7abc('0x41')](handleError(_0x50b33a,null));};
\ No newline at end of file
+var _0x8d1d=['index','AnalyticMetric','rawAttributes','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','map','key','VIRTUAL','field','filter','merge','findAll','rows','catch','show','length','include','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','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','get','Metrics','end','stack','name','send'];(function(_0x41e8b6,_0x306cc2){var _0x13f112=function(_0x484f85){while(--_0x484f85){_0x41e8b6['push'](_0x41e8b6['shift']());}};_0x13f112(++_0x306cc2);}(_0x8d1d,0xc9));var _0xd8d1=function(_0x296ceb,_0x114ccb){_0x296ceb=_0x296ceb-0x0;var _0x4ae405=_0x8d1d[_0x296ceb];return _0x4ae405;};'use strict';var pdf=require(_0xd8d1('0x0'));var emlformat=require(_0xd8d1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd8d1('0x2'));var jsonpatch=require(_0xd8d1('0x3'));var rp=require(_0xd8d1('0x4'));var moment=require(_0xd8d1('0x5'));var BPromise=require(_0xd8d1('0x6'));var Mustache=require(_0xd8d1('0x7'));var util=require(_0xd8d1('0x8'));var path=require('path');var sox=require(_0xd8d1('0x9'));var csv=require(_0xd8d1('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd8d1('0xb'));var squel=require(_0xd8d1('0xc'));var crypto=require('crypto');var jsforce=require(_0xd8d1('0xd'));var deskjs=require(_0xd8d1('0xe'));var toCsv=require(_0xd8d1('0xa'));var querystring=require(_0xd8d1('0xf'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0xd8d1('0x10'));var Redis=require(_0xd8d1('0x11'));var qs=require(_0xd8d1('0x12'));var logger=require(_0xd8d1('0x13'))(_0xd8d1('0x14'));var utils=require(_0xd8d1('0x15'));var config=require(_0xd8d1('0x16'));var db=require(_0xd8d1('0x17'))['db'];function respondWithStatusCode(_0x55eb59,_0x5f3d8d){_0x5f3d8d=_0x5f3d8d||0xcc;return function(_0x114ae1){if(_0x114ae1){return _0x55eb59[_0xd8d1('0x18')](_0x5f3d8d);}return _0x55eb59[_0xd8d1('0x19')](_0x5f3d8d)['end']();};}function respondWithResult(_0x56d7db,_0x231f00){_0x231f00=_0x231f00||0xc8;return function(_0xbc1fec){if(_0xbc1fec){return _0x56d7db[_0xd8d1('0x19')](_0x231f00)[_0xd8d1('0x1a')](_0xbc1fec);}};}function respondWithFilteredResult(_0xae019,_0x4f6ef3){return function(_0x5b54bf){if(_0x5b54bf){var _0x44dc83=_0x5b54bf[_0xd8d1('0x1b')],_0x5092ae=_0x4f6ef3[_0xd8d1('0x1c')],_0x2b0c43=_0x4f6ef3['offset']+_0x4f6ef3[_0xd8d1('0x1d')],_0x245c15;if(_0x2b0c43>=_0x44dc83){_0x2b0c43=_0x44dc83;_0x245c15=0xc8;}else{_0x245c15=0xce;}_0xae019[_0xd8d1('0x19')](_0x245c15);return _0xae019['set'](_0xd8d1('0x1e'),_0x5092ae+'-'+_0x2b0c43+'/'+_0x44dc83)['json'](_0x5b54bf);}return null;};}function patchUpdates(_0x4da4ff){return function(_0x524727){try{jsonpatch['apply'](_0x524727,_0x4da4ff,!![]);}catch(_0x535c50){return BPromise[_0xd8d1('0x1f')](_0x535c50);}return _0x524727[_0xd8d1('0x20')]();};}function saveUpdates(_0x3f8f72,_0x2fbcf9){return function(_0x1f941c){if(_0x1f941c){return _0x1f941c[_0xd8d1('0x21')](_0x3f8f72)[_0xd8d1('0x22')](function(_0x50d359){return _0x50d359;});}return null;};}function removeEntity(_0x5e211d,_0x1b50a2){return function(_0x306001){if(_0x306001){return _0x306001[_0xd8d1('0x23')]()[_0xd8d1('0x22')](function(){var _0x55f3ea=_0x306001[_0xd8d1('0x24')]({'plain':!![]});var _0xf5e89b=_0xd8d1('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0xf5e89b,'resourceId':_0x55f3ea['id']}})[_0xd8d1('0x22')](function(){return _0x306001;});})['then'](function(){_0x5e211d[_0xd8d1('0x19')](0xcc)[_0xd8d1('0x26')]();});}};}function handleEntityNotFound(_0x2eef1a,_0x49ef26){return function(_0x5943cc){if(!_0x5943cc){_0x2eef1a[_0xd8d1('0x18')](0x194);}return _0x5943cc;};}function handleError(_0x34393d,_0x468323){_0x468323=_0x468323||0x1f4;return function(_0x24a51c){logger['error'](_0x24a51c[_0xd8d1('0x27')]);if(_0x24a51c['name']){delete _0x24a51c[_0xd8d1('0x28')];}_0x34393d[_0xd8d1('0x19')](_0x468323)[_0xd8d1('0x29')](_0x24a51c);};}exports[_0xd8d1('0x2a')]=function(_0x5c4c4d,_0x552836){var _0xd3f786={},_0x470f51={},_0x2171fe={'count':0x0,'rows':[]};var _0x5de6f9=db[_0xd8d1('0x2b')][_0xd8d1('0x2c')];_0x470f51[_0xd8d1('0x2d')]=_['keys'](_0x5de6f9);_0x470f51[_0xd8d1('0x2e')]=_[_0xd8d1('0x2f')](_0x5c4c4d[_0xd8d1('0x2e')]);_0x470f51['filters']=_[_0xd8d1('0x30')](_0x470f51[_0xd8d1('0x2d')],_0x470f51[_0xd8d1('0x2e')]);_0xd3f786[_0xd8d1('0x31')]=_[_0xd8d1('0x30')](_0x470f51['model'],qs[_0xd8d1('0x32')](_0x5c4c4d[_0xd8d1('0x2e')][_0xd8d1('0x32')]));_0xd3f786[_0xd8d1('0x31')]=_0xd3f786[_0xd8d1('0x31')]['length']?_0xd3f786[_0xd8d1('0x31')]:_0x470f51[_0xd8d1('0x2d')];if(!_0x5c4c4d['query'][_0xd8d1('0x33')](_0xd8d1('0x34'))){_0xd3f786['limit']=qs['limit'](_0x5c4c4d[_0xd8d1('0x2e')][_0xd8d1('0x1d')]);_0xd3f786[_0xd8d1('0x1c')]=qs['offset'](_0x5c4c4d[_0xd8d1('0x2e')][_0xd8d1('0x1c')]);}_0xd3f786[_0xd8d1('0x35')]=qs[_0xd8d1('0x36')](_0x5c4c4d[_0xd8d1('0x2e')]['sort']);_0xd3f786[_0xd8d1('0x37')]=qs[_0xd8d1('0x38')](_[_0xd8d1('0x39')](_0x5c4c4d[_0xd8d1('0x2e')],_0x470f51['filters']));if(_0x5c4c4d[_0xd8d1('0x2e')]['filter']){_0xd3f786['where']=_['merge'](_0xd3f786['where'],{'$or':_[_0xd8d1('0x3a')](_0x5de6f9,function(_0x5bd78c){if(_0x5bd78c['type'][_0xd8d1('0x3b')]!==_0xd8d1('0x3c')){var _0x2d74f8={};_0x2d74f8[_0x5bd78c[_0xd8d1('0x3d')]]={'$like':'%'+_0x5c4c4d['query'][_0xd8d1('0x3e')]+'%'};return _0x2d74f8;}})});}_0xd3f786=_[_0xd8d1('0x3f')]({},_0xd3f786,_0x5c4c4d['options']);var _0x3f6a9d={'where':_0xd3f786['where']};return db[_0xd8d1('0x2b')][_0xd8d1('0x1b')](_0x3f6a9d)[_0xd8d1('0x22')](function(_0x26d70d){_0x2171fe[_0xd8d1('0x1b')]=_0x26d70d;if(_0x5c4c4d[_0xd8d1('0x2e')]['includeAll']){_0xd3f786['include']=[{'all':!![]}];}return db[_0xd8d1('0x2b')][_0xd8d1('0x40')](_0xd3f786);})[_0xd8d1('0x22')](function(_0x40ffc1){_0x2171fe[_0xd8d1('0x41')]=_0x40ffc1;return _0x2171fe;})[_0xd8d1('0x22')](respondWithFilteredResult(_0x552836,_0xd3f786))[_0xd8d1('0x42')](handleError(_0x552836,null));};exports[_0xd8d1('0x43')]=function(_0x3cb2ae,_0x3284d7){var _0x26d588={'raw':!![],'where':{'id':_0x3cb2ae['params']['id']}},_0x54e420={};_0x54e420['model']=_[_0xd8d1('0x2f')](db[_0xd8d1('0x2b')][_0xd8d1('0x2c')]);_0x54e420[_0xd8d1('0x2e')]=_[_0xd8d1('0x2f')](_0x3cb2ae[_0xd8d1('0x2e')]);_0x54e420[_0xd8d1('0x38')]=_[_0xd8d1('0x30')](_0x54e420['model'],_0x54e420[_0xd8d1('0x2e')]);_0x26d588[_0xd8d1('0x31')]=_[_0xd8d1('0x30')](_0x54e420[_0xd8d1('0x2d')],qs[_0xd8d1('0x32')](_0x3cb2ae['query'][_0xd8d1('0x32')]));_0x26d588[_0xd8d1('0x31')]=_0x26d588[_0xd8d1('0x31')][_0xd8d1('0x44')]?_0x26d588[_0xd8d1('0x31')]:_0x54e420['model'];if(_0x3cb2ae[_0xd8d1('0x2e')]['includeAll']){_0x26d588[_0xd8d1('0x45')]=[{'all':!![]}];}_0x26d588=_['merge']({},_0x26d588,_0x3cb2ae[_0xd8d1('0x46')]);return db[_0xd8d1('0x2b')][_0xd8d1('0x47')](_0x26d588)[_0xd8d1('0x22')](handleEntityNotFound(_0x3284d7,null))[_0xd8d1('0x22')](respondWithResult(_0x3284d7,null))[_0xd8d1('0x42')](handleError(_0x3284d7,null));};exports[_0xd8d1('0x48')]=function(_0x1a2707,_0x536928){return db[_0xd8d1('0x2b')]['create'](_0x1a2707[_0xd8d1('0x49')],{})[_0xd8d1('0x22')](function(_0x241077){var _0x561522=_0x1a2707[_0xd8d1('0x4a')][_0xd8d1('0x24')]({'plain':!![]});if(!_0x561522)throw new Error(_0xd8d1('0x4b'));if(_0x561522[_0xd8d1('0x4c')]==='user'){var _0x56cc6f=_0x241077[_0xd8d1('0x24')]({'plain':!![]});var _0x418c4f=_0xd8d1('0x25');return db[_0xd8d1('0x4d')][_0xd8d1('0x47')]({'where':{'name':_0x418c4f,'userProfileId':_0x561522[_0xd8d1('0x4e')]},'raw':!![]})[_0xd8d1('0x22')](function(_0x4fe668){if(_0x4fe668&&_0x4fe668['autoAssociation']===0x0){return db['UserProfileResource'][_0xd8d1('0x48')]({'name':_0x56cc6f[_0xd8d1('0x28')],'resourceId':_0x56cc6f['id'],'type':_0x4fe668[_0xd8d1('0x28')],'sectionId':_0x4fe668['id']},{})[_0xd8d1('0x22')](function(){return _0x241077;});}else{return _0x241077;}})[_0xd8d1('0x42')](function(_0x3ae1a0){logger['error'](_0xd8d1('0x4f'),_0x3ae1a0);throw _0x3ae1a0;});}return _0x241077;})[_0xd8d1('0x22')](respondWithResult(_0x536928,0xc9))[_0xd8d1('0x42')](handleError(_0x536928,null));};exports[_0xd8d1('0x21')]=function(_0x4a84ea,_0x26ad6c){if(_0x4a84ea['body']['id']){delete _0x4a84ea[_0xd8d1('0x49')]['id'];}return db['AnalyticMetric'][_0xd8d1('0x47')]({'where':{'id':_0x4a84ea['params']['id']}})[_0xd8d1('0x22')](handleEntityNotFound(_0x26ad6c,null))[_0xd8d1('0x22')](saveUpdates(_0x4a84ea[_0xd8d1('0x49')],null))['then'](respondWithResult(_0x26ad6c,null))['catch'](handleError(_0x26ad6c,null));};exports[_0xd8d1('0x23')]=function(_0x918c4a,_0x213278){return db[_0xd8d1('0x2b')]['find']({'where':{'id':_0x918c4a[_0xd8d1('0x50')]['id']}})[_0xd8d1('0x22')](handleEntityNotFound(_0x213278,null))[_0xd8d1('0x22')](removeEntity(_0x213278,null))[_0xd8d1('0x42')](handleError(_0x213278,null));};
\ No newline at end of file
index 6f1c7ee..9ea1217 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7ab1=['util','api','moment','request-promise','./analyticMetric.attributes','exports','lodash'];(function(_0xa451c2,_0x28be99){var _0x2776e4=function(_0xc47a35){while(--_0xc47a35){_0xa451c2['push'](_0xa451c2['shift']());}};_0x2776e4(++_0x28be99);}(_0x7ab1,0x1cd));var _0x17ab=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x7ab1[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0x17ab('0x0'));var util=require(_0x17ab('0x1'));var logger=require('../../config/logger')(_0x17ab('0x2'));var moment=require(_0x17ab('0x3'));var BPromise=require('bluebird');var rp=require(_0x17ab('0x4'));var attributes=require(_0x17ab('0x5'));module[_0x17ab('0x6')]=function(_0x2d3c09,_0x4221e7){return _0x2d3c09['define']('AnalyticMetric',attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xd7e1=['define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','./analyticMetric.attributes','exports'];(function(_0x5d5ff8,_0x42c9e7){var _0x43af7f=function(_0x39e49f){while(--_0x39e49f){_0x5d5ff8['push'](_0x5d5ff8['shift']());}};_0x43af7f(++_0x42c9e7);}(_0xd7e1,0x14d));var _0x1d7e=function(_0x2c50e4,_0x15cd2f){_0x2c50e4=_0x2c50e4-0x0;var _0x474118=_0xd7e1[_0x2c50e4];return _0x474118;};'use strict';var _=require(_0x1d7e('0x0'));var util=require(_0x1d7e('0x1'));var logger=require(_0x1d7e('0x2'))(_0x1d7e('0x3'));var moment=require(_0x1d7e('0x4'));var BPromise=require(_0x1d7e('0x5'));var rp=require('request-promise');var attributes=require(_0x1d7e('0x6'));module[_0x1d7e('0x7')]=function(_0x57f42a,_0x139656){return _0x57f42a[_0x1d7e('0x8')](_0x1d7e('0x9'),attributes,{'tableName':_0x1d7e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 1c112d0..a1bc095 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa4fb=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s'];(function(_0x41d902,_0x29d0b){var _0x360fb1=function(_0x2517ae){while(--_0x2517ae){_0x41d902['push'](_0x41d902['shift']());}};_0x360fb1(++_0x29d0b);}(_0xa4fb,0x150));var _0xba4f=function(_0x3a0863,_0x4cd5ef){_0x3a0863=_0x3a0863-0x0;var _0x85c557=_0xa4fb[_0x3a0863];return _0x85c557;};'use strict';var _=require(_0xba4f('0x0'));var util=require(_0xba4f('0x1'));var moment=require(_0xba4f('0x2'));var BPromise=require(_0xba4f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba4f('0x4'))['db'];var utils=require(_0xba4f('0x5'));var logger=require(_0xba4f('0x6'))('rpc');var config=require(_0xba4f('0x7'));var jayson=require(_0xba4f('0x8'));var client=jayson[_0xba4f('0x9')][_0xba4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x172ff5,_0xbc1848,_0xb2f7ce){return new BPromise(function(_0x1af837,_0x399847){return client[_0xba4f('0xb')](_0x172ff5,_0xb2f7ce)['then'](function(_0x1d0d85){logger['info'](_0xba4f('0xc'),_0xbc1848,_0xba4f('0xd'));logger[_0xba4f('0xe')](_0xba4f('0xf'),_0xbc1848,_0xba4f('0xd'),JSON[_0xba4f('0x10')](_0x1d0d85));if(_0x1d0d85['error']){if(_0x1d0d85[_0xba4f('0x11')][_0xba4f('0x12')]===0x1f4){logger[_0xba4f('0x11')](_0xba4f('0xc'),_0xbc1848,_0x1d0d85[_0xba4f('0x11')][_0xba4f('0x13')]);return _0x399847(_0x1d0d85[_0xba4f('0x11')][_0xba4f('0x13')]);}logger[_0xba4f('0x11')](_0xba4f('0xc'),_0xbc1848,_0x1d0d85['error'][_0xba4f('0x13')]);return _0x1af837(_0x1d0d85[_0xba4f('0x11')][_0xba4f('0x13')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0xbc1848,_0xba4f('0xd'));_0x1af837(_0x1d0d85[_0xba4f('0x14')][_0xba4f('0x13')]);}})[_0xba4f('0x15')](function(_0x218dea){logger[_0xba4f('0x11')](_0xba4f('0xc'),_0xbc1848,_0x218dea);_0x399847(_0x218dea);});});}
\ No newline at end of file
+var _0x1501=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','result','catch'];(function(_0x5e4a1a,_0x5f3e3c){var _0x4c3b2c=function(_0x482dfd){while(--_0x482dfd){_0x5e4a1a['push'](_0x5e4a1a['shift']());}};_0x4c3b2c(++_0x5f3e3c);}(_0x1501,0x126));var _0x1150=function(_0x5460df,_0x33d87b){_0x5460df=_0x5460df-0x0;var _0x246990=_0x1501[_0x5460df];return _0x246990;};'use strict';var _=require('lodash');var util=require(_0x1150('0x0'));var moment=require(_0x1150('0x1'));var BPromise=require(_0x1150('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1150('0x3'));var db=require(_0x1150('0x4'))['db'];var utils=require(_0x1150('0x5'));var logger=require(_0x1150('0x6'))('rpc');var config=require(_0x1150('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1150('0x8')][_0x1150('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fc391,_0x131b49,_0x24340c){return new BPromise(function(_0x321d80,_0x2da67d){return client['request'](_0x2fc391,_0x24340c)['then'](function(_0x22d26c){logger[_0x1150('0xa')]('AnalyticMetric,\x20%s,\x20%s',_0x131b49,'request\x20sent');logger[_0x1150('0xb')](_0x1150('0xc'),_0x131b49,_0x1150('0xd'),JSON[_0x1150('0xe')](_0x22d26c));if(_0x22d26c['error']){if(_0x22d26c[_0x1150('0xf')][_0x1150('0x10')]===0x1f4){logger['error'](_0x1150('0x11'),_0x131b49,_0x22d26c['error'][_0x1150('0x12')]);return _0x2da67d(_0x22d26c[_0x1150('0xf')][_0x1150('0x12')]);}logger[_0x1150('0xf')](_0x1150('0x11'),_0x131b49,_0x22d26c[_0x1150('0xf')][_0x1150('0x12')]);return _0x321d80(_0x22d26c[_0x1150('0xf')]['message']);}else{logger['info'](_0x1150('0x11'),_0x131b49,_0x1150('0xd'));_0x321d80(_0x22d26c[_0x1150('0x13')][_0x1150('0x12')]);}})[_0x1150('0x14')](function(_0x1a8b62){logger[_0x1150('0xf')](_0x1150('0x11'),_0x131b49,_0x1a8b62);_0x2da67d(_0x1a8b62);});});}
\ No newline at end of file
index f44cbdd..a663f6a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5464=['express','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','show','post','create','put','/:id','update','destroy','multer','util','path'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0x5464,0x15d));var _0x4546=function(_0x1badd2,_0x1a0299){_0x1badd2=_0x1badd2-0x0;var _0x1c40de=_0x5464[_0x1badd2];return _0x1c40de;};'use strict';var multer=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var path=require(_0x4546('0x2'));var timeout=require('connect-timeout');var express=require(_0x4546('0x3'));var router=express['Router']();var auth=require(_0x4546('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4546('0x5'));var controller=require(_0x4546('0x6'));router[_0x4546('0x7')]('/',auth[_0x4546('0x8')](),controller['index']);router['get']('/:id',auth[_0x4546('0x8')](),controller[_0x4546('0x9')]);router[_0x4546('0xa')]('/',auth[_0x4546('0x8')](),controller[_0x4546('0xb')]);router[_0x4546('0xc')](_0x4546('0xd'),auth[_0x4546('0x8')](),controller[_0x4546('0xe')]);router['delete'](_0x4546('0xd'),auth[_0x4546('0x8')](),controller[_0x4546('0xf')]);module['exports']=router;
\ No newline at end of file
+var _0xee2c=['Router','../../config/environment','./analyticMetric.controller','isAuthenticated','index','get','/:id','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xee2c,0x1c7));var _0xcee2=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xee2c[_0x27af45];return _0x18df21;};'use strict';var multer=require(_0xcee2('0x0'));var util=require('util');var path=require(_0xcee2('0x1'));var timeout=require(_0xcee2('0x2'));var express=require(_0xcee2('0x3'));var router=express[_0xcee2('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcee2('0x5'));var controller=require(_0xcee2('0x6'));router['get']('/',auth[_0xcee2('0x7')](),controller[_0xcee2('0x8')]);router[_0xcee2('0x9')](_0xcee2('0xa'),auth[_0xcee2('0x7')](),controller['show']);router['post']('/',auth[_0xcee2('0x7')](),controller[_0xcee2('0xb')]);router[_0xcee2('0xc')](_0xcee2('0xa'),auth[_0xcee2('0x7')](),controller[_0xcee2('0xd')]);router[_0xcee2('0xe')](_0xcee2('0xa'),auth['isAuthenticated'](),controller[_0xcee2('0xf')]);module[_0xcee2('0x10')]=router;
\ No newline at end of file
index 9703a08..b69afbf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0be4=['TEXT','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0be4,0x9f));var _0x40be=function(_0x5720e8,_0x161a6b){_0x5720e8=_0x5720e8-0x0;var _0x49390b=_0x0be4[_0x5720e8];return _0x49390b;};'use strict';var Sequelize=require(_0x40be('0x0'));module['exports']={'tree':{'type':Sequelize[_0x40be('0x1')],'allowNull':![]}};
\ No newline at end of file
+var _0xa2a6=['sequelize','exports'];(function(_0x49db14,_0x3e7c8b){var _0x5e14b4=function(_0xf5c39e){while(--_0xf5c39e){_0x49db14['push'](_0x49db14['shift']());}};_0x5e14b4(++_0x3e7c8b);}(_0xa2a6,0x156));var _0x6a2a=function(_0xfc89d3,_0x22b044){_0xfc89d3=_0xfc89d3-0x0;var _0x432867=_0xa2a6[_0xfc89d3];return _0x432867;};'use strict';var Sequelize=require(_0x6a2a('0x0'));module[_0x6a2a('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}};
\ No newline at end of file
index b112aea..77adc76 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2f78=['nolimit','order','sort','where','pick','filter','merge','map','key','VIRTUAL','field','options','AnalyticTreeReport','count','includeAll','include','rows','catch','show','find','create','body','update','params','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','crypto','desk.js','querystring','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x1b74f8,_0x3db06a){var _0x49836c=function(_0x116870){while(--_0x116870){_0x1b74f8['push'](_0x1b74f8['shift']());}};_0x49836c(++_0x3db06a);}(_0x2f78,0xa8));var _0x82f7=function(_0x4394b8,_0x588309){_0x4394b8=_0x4394b8-0x0;var _0x1aa182=_0x2f78[_0x4394b8];return _0x1aa182;};'use strict';var pdf=require(_0x82f7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x82f7('0x1'));var zipdir=require(_0x82f7('0x2'));var jsonpatch=require(_0x82f7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x82f7('0x4'));var Mustache=require(_0x82f7('0x5'));var util=require(_0x82f7('0x6'));var path=require(_0x82f7('0x7'));var sox=require('sox');var csv=require(_0x82f7('0x8'));var ejs=require(_0x82f7('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x82f7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x82f7('0xb'));var toCsv=require('to-csv');var querystring=require(_0x82f7('0xc'));var Papa=require(_0x82f7('0xd'));var authService=require(_0x82f7('0xe'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x82f7('0xf'));var qs=require(_0x82f7('0x10'));var logger=require('../../config/logger')(_0x82f7('0x11'));var utils=require(_0x82f7('0x12'));var config=require(_0x82f7('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fc8b8,_0x460354){_0x460354=_0x460354||0xcc;return function(_0x596de3){if(_0x596de3){return _0x4fc8b8[_0x82f7('0x14')](_0x460354);}return _0x4fc8b8['status'](_0x460354)['end']();};}function respondWithResult(_0x4e2675,_0x5a8aea){_0x5a8aea=_0x5a8aea||0xc8;return function(_0xa17557){if(_0xa17557){return _0x4e2675[_0x82f7('0x15')](_0x5a8aea)[_0x82f7('0x16')](_0xa17557);}};}function respondWithFilteredResult(_0x3bcdd3,_0x27ba08){return function(_0x5941a6){if(_0x5941a6){var _0x35d10f=_0x5941a6['count'],_0x2c3a46=_0x27ba08[_0x82f7('0x17')],_0x215f4e=_0x27ba08[_0x82f7('0x17')]+_0x27ba08[_0x82f7('0x18')],_0x13a567;if(_0x215f4e>=_0x35d10f){_0x215f4e=_0x35d10f;_0x13a567=0xc8;}else{_0x13a567=0xce;}_0x3bcdd3[_0x82f7('0x15')](_0x13a567);return _0x3bcdd3[_0x82f7('0x19')](_0x82f7('0x1a'),_0x2c3a46+'-'+_0x215f4e+'/'+_0x35d10f)['json'](_0x5941a6);}return null;};}function patchUpdates(_0x124386){return function(_0x3d6ea9){try{jsonpatch[_0x82f7('0x1b')](_0x3d6ea9,_0x124386,!![]);}catch(_0x5ce76f){return BPromise[_0x82f7('0x1c')](_0x5ce76f);}return _0x3d6ea9[_0x82f7('0x1d')]();};}function saveUpdates(_0x250bae,_0x3bf33b){return function(_0x1828ad){if(_0x1828ad){return _0x1828ad['update'](_0x250bae)[_0x82f7('0x1e')](function(_0x538190){return _0x538190;});}return null;};}function removeEntity(_0x3ae6ee,_0x178f0a){return function(_0x58096a){if(_0x58096a){return _0x58096a[_0x82f7('0x1f')]()[_0x82f7('0x1e')](function(){_0x3ae6ee['status'](0xcc)[_0x82f7('0x20')]();});}};}function handleEntityNotFound(_0xaa1a12,_0xda1b67){return function(_0x136434){if(!_0x136434){_0xaa1a12[_0x82f7('0x14')](0x194);}return _0x136434;};}function handleError(_0x5e9d7d,_0x18fc84){_0x18fc84=_0x18fc84||0x1f4;return function(_0x497403){logger[_0x82f7('0x21')](_0x497403[_0x82f7('0x22')]);if(_0x497403['name']){delete _0x497403[_0x82f7('0x23')];}_0x5e9d7d['status'](_0x18fc84)[_0x82f7('0x24')](_0x497403);};}exports[_0x82f7('0x25')]=function(_0x2a982f,_0x2f3202){var _0x446744={},_0x313853={},_0x372861={'count':0x0,'rows':[]};var _0x50cb1d=db['AnalyticTreeReport'][_0x82f7('0x26')];_0x313853[_0x82f7('0x27')]=_['keys'](_0x50cb1d);_0x313853[_0x82f7('0x28')]=_[_0x82f7('0x29')](_0x2a982f[_0x82f7('0x28')]);_0x313853[_0x82f7('0x2a')]=_[_0x82f7('0x2b')](_0x313853[_0x82f7('0x27')],_0x313853[_0x82f7('0x28')]);_0x446744[_0x82f7('0x2c')]=_[_0x82f7('0x2b')](_0x313853[_0x82f7('0x27')],qs[_0x82f7('0x2d')](_0x2a982f[_0x82f7('0x28')][_0x82f7('0x2d')]));_0x446744['attributes']=_0x446744[_0x82f7('0x2c')][_0x82f7('0x2e')]?_0x446744[_0x82f7('0x2c')]:_0x313853[_0x82f7('0x27')];if(!_0x2a982f[_0x82f7('0x28')][_0x82f7('0x2f')](_0x82f7('0x30'))){_0x446744[_0x82f7('0x18')]=qs[_0x82f7('0x18')](_0x2a982f[_0x82f7('0x28')][_0x82f7('0x18')]);_0x446744[_0x82f7('0x17')]=qs['offset'](_0x2a982f['query'][_0x82f7('0x17')]);}_0x446744[_0x82f7('0x31')]=qs[_0x82f7('0x32')](_0x2a982f[_0x82f7('0x28')][_0x82f7('0x32')]);_0x446744[_0x82f7('0x33')]=qs[_0x82f7('0x2a')](_[_0x82f7('0x34')](_0x2a982f[_0x82f7('0x28')],_0x313853[_0x82f7('0x2a')]));if(_0x2a982f[_0x82f7('0x28')][_0x82f7('0x35')]){_0x446744['where']=_[_0x82f7('0x36')](_0x446744[_0x82f7('0x33')],{'$or':_[_0x82f7('0x37')](_0x50cb1d,function(_0x5af342){if(_0x5af342['type'][_0x82f7('0x38')]!==_0x82f7('0x39')){var _0x3e84bf={};_0x3e84bf[_0x5af342[_0x82f7('0x3a')]]={'$like':'%'+_0x2a982f['query']['filter']+'%'};return _0x3e84bf;}})});}_0x446744=_[_0x82f7('0x36')]({},_0x446744,_0x2a982f[_0x82f7('0x3b')]);var _0x51d00c={'where':_0x446744[_0x82f7('0x33')]};return db[_0x82f7('0x3c')][_0x82f7('0x3d')](_0x51d00c)[_0x82f7('0x1e')](function(_0x4febb4){_0x372861[_0x82f7('0x3d')]=_0x4febb4;if(_0x2a982f[_0x82f7('0x28')][_0x82f7('0x3e')]){_0x446744[_0x82f7('0x3f')]=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x446744);})[_0x82f7('0x1e')](function(_0x437ae4){_0x372861[_0x82f7('0x40')]=_0x437ae4;return _0x372861;})[_0x82f7('0x1e')](respondWithFilteredResult(_0x2f3202,_0x446744))[_0x82f7('0x41')](handleError(_0x2f3202,null));};exports[_0x82f7('0x42')]=function(_0x5b7c53,_0x13093e){var _0x4deebf={'raw':!![],'where':{'id':_0x5b7c53['params']['id']}},_0x50825f={};_0x50825f[_0x82f7('0x27')]=_[_0x82f7('0x29')](db['AnalyticTreeReport'][_0x82f7('0x26')]);_0x50825f[_0x82f7('0x28')]=_[_0x82f7('0x29')](_0x5b7c53['query']);_0x50825f[_0x82f7('0x2a')]=_[_0x82f7('0x2b')](_0x50825f[_0x82f7('0x27')],_0x50825f[_0x82f7('0x28')]);_0x4deebf[_0x82f7('0x2c')]=_['intersection'](_0x50825f[_0x82f7('0x27')],qs[_0x82f7('0x2d')](_0x5b7c53['query']['fields']));_0x4deebf[_0x82f7('0x2c')]=_0x4deebf[_0x82f7('0x2c')][_0x82f7('0x2e')]?_0x4deebf[_0x82f7('0x2c')]:_0x50825f[_0x82f7('0x27')];if(_0x5b7c53[_0x82f7('0x28')][_0x82f7('0x3e')]){_0x4deebf[_0x82f7('0x3f')]=[{'all':!![]}];}_0x4deebf=_['merge']({},_0x4deebf,_0x5b7c53[_0x82f7('0x3b')]);return db['AnalyticTreeReport'][_0x82f7('0x43')](_0x4deebf)[_0x82f7('0x1e')](handleEntityNotFound(_0x13093e,null))[_0x82f7('0x1e')](respondWithResult(_0x13093e,null))[_0x82f7('0x41')](handleError(_0x13093e,null));};exports[_0x82f7('0x44')]=function(_0x5813b9,_0xf2267b){return db[_0x82f7('0x3c')][_0x82f7('0x44')](_0x5813b9[_0x82f7('0x45')],{})[_0x82f7('0x1e')](respondWithResult(_0xf2267b,0xc9))[_0x82f7('0x41')](handleError(_0xf2267b,null));};exports[_0x82f7('0x46')]=function(_0x5888b3,_0x1701c8){if(_0x5888b3[_0x82f7('0x45')]['id']){delete _0x5888b3[_0x82f7('0x45')]['id'];}return db[_0x82f7('0x3c')]['find']({'where':{'id':_0x5888b3[_0x82f7('0x47')]['id']}})[_0x82f7('0x1e')](handleEntityNotFound(_0x1701c8,null))[_0x82f7('0x1e')](saveUpdates(_0x5888b3[_0x82f7('0x45')],null))[_0x82f7('0x1e')](respondWithResult(_0x1701c8,null))['catch'](handleError(_0x1701c8,null));};exports['destroy']=function(_0x1deafb,_0x4aba8a){return db[_0x82f7('0x3c')][_0x82f7('0x43')]({'where':{'id':_0x1deafb[_0x82f7('0x47')]['id']}})[_0x82f7('0x1e')](handleEntityNotFound(_0x4aba8a,null))[_0x82f7('0x1e')](removeEntity(_0x4aba8a,null))['catch'](handleError(_0x4aba8a,null));};
\ No newline at end of file
+var _0xcf8d=['apply','reject','update','then','destroy','stack','name','index','AnalyticTreeReport','rawAttributes','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','type','key','VIRTUAL','field','includeAll','include','rows','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs','squel','jsforce','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','sendStatus','end','status','count','offset','set','Content-Range','json'];(function(_0x46dc13,_0x2414a4){var _0x4f0922=function(_0x1c7fcf){while(--_0x1c7fcf){_0x46dc13['push'](_0x46dc13['shift']());}};_0x4f0922(++_0x2414a4);}(_0xcf8d,0x6b));var _0xdcf8=function(_0x151334,_0x1e11ac){_0x151334=_0x151334-0x0;var _0x3d03da=_0xcf8d[_0x151334];return _0x3d03da;};'use strict';var pdf=require(_0xdcf8('0x0'));var emlformat=require(_0xdcf8('0x1'));var rimraf=require(_0xdcf8('0x2'));var zipdir=require(_0xdcf8('0x3'));var jsonpatch=require(_0xdcf8('0x4'));var rp=require('request-promise');var moment=require(_0xdcf8('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdcf8('0x6'));var path=require('path');var sox=require(_0xdcf8('0x7'));var csv=require(_0xdcf8('0x8'));var ejs=require(_0xdcf8('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdcf8('0xa'));var crypto=require('crypto');var jsforce=require(_0xdcf8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdcf8('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0xdcf8('0xc'));var hardwareService=require(_0xdcf8('0xd'));var Redis=require(_0xdcf8('0xe'));var qs=require(_0xdcf8('0xf'));var logger=require(_0xdcf8('0x10'))(_0xdcf8('0x11'));var utils=require('../../config/utils');var config=require(_0xdcf8('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x581d54,_0x27c8f5){_0x27c8f5=_0x27c8f5||0xcc;return function(_0x3331b7){if(_0x3331b7){return _0x581d54[_0xdcf8('0x13')](_0x27c8f5);}return _0x581d54['status'](_0x27c8f5)[_0xdcf8('0x14')]();};}function respondWithResult(_0x37c324,_0x5a2c7a){_0x5a2c7a=_0x5a2c7a||0xc8;return function(_0x198d56){if(_0x198d56){return _0x37c324[_0xdcf8('0x15')](_0x5a2c7a)['json'](_0x198d56);}};}function respondWithFilteredResult(_0x28dcbc,_0x1e693e){return function(_0x3eb680){if(_0x3eb680){var _0xc7f28a=_0x3eb680[_0xdcf8('0x16')],_0x4d6de8=_0x1e693e[_0xdcf8('0x17')],_0x1849a3=_0x1e693e[_0xdcf8('0x17')]+_0x1e693e['limit'],_0x1ae92e;if(_0x1849a3>=_0xc7f28a){_0x1849a3=_0xc7f28a;_0x1ae92e=0xc8;}else{_0x1ae92e=0xce;}_0x28dcbc[_0xdcf8('0x15')](_0x1ae92e);return _0x28dcbc[_0xdcf8('0x18')](_0xdcf8('0x19'),_0x4d6de8+'-'+_0x1849a3+'/'+_0xc7f28a)[_0xdcf8('0x1a')](_0x3eb680);}return null;};}function patchUpdates(_0x5a4ac3){return function(_0x4c095c){try{jsonpatch[_0xdcf8('0x1b')](_0x4c095c,_0x5a4ac3,!![]);}catch(_0x366f0c){return BPromise[_0xdcf8('0x1c')](_0x366f0c);}return _0x4c095c['save']();};}function saveUpdates(_0x102571,_0x3f8661){return function(_0x4268c0){if(_0x4268c0){return _0x4268c0[_0xdcf8('0x1d')](_0x102571)[_0xdcf8('0x1e')](function(_0x4bb631){return _0x4bb631;});}return null;};}function removeEntity(_0x12018f,_0x3aef9a){return function(_0x16b258){if(_0x16b258){return _0x16b258[_0xdcf8('0x1f')]()[_0xdcf8('0x1e')](function(){_0x12018f[_0xdcf8('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c42f4,_0xd2bd2e){return function(_0x33a4cb){if(!_0x33a4cb){_0x3c42f4[_0xdcf8('0x13')](0x194);}return _0x33a4cb;};}function handleError(_0x472224,_0x15c35c){_0x15c35c=_0x15c35c||0x1f4;return function(_0x27a9f0){logger['error'](_0x27a9f0[_0xdcf8('0x20')]);if(_0x27a9f0[_0xdcf8('0x21')]){delete _0x27a9f0[_0xdcf8('0x21')];}_0x472224[_0xdcf8('0x15')](_0x15c35c)['send'](_0x27a9f0);};}exports[_0xdcf8('0x22')]=function(_0x2f4314,_0xe39fa9){var _0x316e3d={},_0xe9fe55={},_0x512238={'count':0x0,'rows':[]};var _0x1a8d2a=db[_0xdcf8('0x23')][_0xdcf8('0x24')];_0xe9fe55[_0xdcf8('0x25')]=_['keys'](_0x1a8d2a);_0xe9fe55[_0xdcf8('0x26')]=_[_0xdcf8('0x27')](_0x2f4314[_0xdcf8('0x26')]);_0xe9fe55['filters']=_[_0xdcf8('0x28')](_0xe9fe55[_0xdcf8('0x25')],_0xe9fe55[_0xdcf8('0x26')]);_0x316e3d[_0xdcf8('0x29')]=_[_0xdcf8('0x28')](_0xe9fe55['model'],qs[_0xdcf8('0x2a')](_0x2f4314[_0xdcf8('0x26')]['fields']));_0x316e3d[_0xdcf8('0x29')]=_0x316e3d['attributes'][_0xdcf8('0x2b')]?_0x316e3d['attributes']:_0xe9fe55['model'];if(!_0x2f4314[_0xdcf8('0x26')][_0xdcf8('0x2c')](_0xdcf8('0x2d'))){_0x316e3d['limit']=qs[_0xdcf8('0x2e')](_0x2f4314[_0xdcf8('0x26')][_0xdcf8('0x2e')]);_0x316e3d[_0xdcf8('0x17')]=qs[_0xdcf8('0x17')](_0x2f4314['query'][_0xdcf8('0x17')]);}_0x316e3d[_0xdcf8('0x2f')]=qs[_0xdcf8('0x30')](_0x2f4314[_0xdcf8('0x26')]['sort']);_0x316e3d['where']=qs[_0xdcf8('0x31')](_[_0xdcf8('0x32')](_0x2f4314['query'],_0xe9fe55[_0xdcf8('0x31')]));if(_0x2f4314[_0xdcf8('0x26')][_0xdcf8('0x33')]){_0x316e3d[_0xdcf8('0x34')]=_[_0xdcf8('0x35')](_0x316e3d['where'],{'$or':_['map'](_0x1a8d2a,function(_0x168f46){if(_0x168f46[_0xdcf8('0x36')][_0xdcf8('0x37')]!==_0xdcf8('0x38')){var _0xa8d7a4={};_0xa8d7a4[_0x168f46[_0xdcf8('0x39')]]={'$like':'%'+_0x2f4314[_0xdcf8('0x26')][_0xdcf8('0x33')]+'%'};return _0xa8d7a4;}})});}_0x316e3d=_['merge']({},_0x316e3d,_0x2f4314['options']);var _0x2b5950={'where':_0x316e3d[_0xdcf8('0x34')]};return db[_0xdcf8('0x23')][_0xdcf8('0x16')](_0x2b5950)[_0xdcf8('0x1e')](function(_0x3f63cd){_0x512238['count']=_0x3f63cd;if(_0x2f4314[_0xdcf8('0x26')][_0xdcf8('0x3a')]){_0x316e3d[_0xdcf8('0x3b')]=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x316e3d);})[_0xdcf8('0x1e')](function(_0x42dde6){_0x512238[_0xdcf8('0x3c')]=_0x42dde6;return _0x512238;})[_0xdcf8('0x1e')](respondWithFilteredResult(_0xe39fa9,_0x316e3d))[_0xdcf8('0x3d')](handleError(_0xe39fa9,null));};exports[_0xdcf8('0x3e')]=function(_0x186212,_0x53fd57){var _0x4449a6={'raw':!![],'where':{'id':_0x186212[_0xdcf8('0x3f')]['id']}},_0x2ab398={};_0x2ab398[_0xdcf8('0x25')]=_[_0xdcf8('0x27')](db[_0xdcf8('0x23')][_0xdcf8('0x24')]);_0x2ab398[_0xdcf8('0x26')]=_['keys'](_0x186212['query']);_0x2ab398['filters']=_['intersection'](_0x2ab398['model'],_0x2ab398[_0xdcf8('0x26')]);_0x4449a6[_0xdcf8('0x29')]=_['intersection'](_0x2ab398['model'],qs[_0xdcf8('0x2a')](_0x186212['query'][_0xdcf8('0x2a')]));_0x4449a6[_0xdcf8('0x29')]=_0x4449a6['attributes'][_0xdcf8('0x2b')]?_0x4449a6['attributes']:_0x2ab398[_0xdcf8('0x25')];if(_0x186212[_0xdcf8('0x26')]['includeAll']){_0x4449a6[_0xdcf8('0x3b')]=[{'all':!![]}];}_0x4449a6=_['merge']({},_0x4449a6,_0x186212['options']);return db[_0xdcf8('0x23')][_0xdcf8('0x40')](_0x4449a6)[_0xdcf8('0x1e')](handleEntityNotFound(_0x53fd57,null))[_0xdcf8('0x1e')](respondWithResult(_0x53fd57,null))[_0xdcf8('0x3d')](handleError(_0x53fd57,null));};exports[_0xdcf8('0x41')]=function(_0x2ca61e,_0x301545){return db[_0xdcf8('0x23')][_0xdcf8('0x41')](_0x2ca61e[_0xdcf8('0x42')],{})[_0xdcf8('0x1e')](respondWithResult(_0x301545,0xc9))['catch'](handleError(_0x301545,null));};exports[_0xdcf8('0x1d')]=function(_0x135b3b,_0x7a0215){if(_0x135b3b[_0xdcf8('0x42')]['id']){delete _0x135b3b[_0xdcf8('0x42')]['id'];}return db[_0xdcf8('0x23')][_0xdcf8('0x40')]({'where':{'id':_0x135b3b[_0xdcf8('0x3f')]['id']}})['then'](handleEntityNotFound(_0x7a0215,null))[_0xdcf8('0x1e')](saveUpdates(_0x135b3b[_0xdcf8('0x42')],null))[_0xdcf8('0x1e')](respondWithResult(_0x7a0215,null))[_0xdcf8('0x3d')](handleError(_0x7a0215,null));};exports[_0xdcf8('0x1f')]=function(_0x1ef517,_0x4b6f1f){return db[_0xdcf8('0x23')][_0xdcf8('0x40')]({'where':{'id':_0x1ef517[_0xdcf8('0x3f')]['id']}})[_0xdcf8('0x1e')](handleEntityNotFound(_0x4b6f1f,null))[_0xdcf8('0x1e')](removeEntity(_0x4b6f1f,null))[_0xdcf8('0x3d')](handleError(_0x4b6f1f,null));};
\ No newline at end of file
index 61602d7..845d909 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8c0c=['request-promise','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','moment','bluebird'];(function(_0x526d87,_0x36a1d3){var _0x58403b=function(_0xc9e5f6){while(--_0xc9e5f6){_0x526d87['push'](_0x526d87['shift']());}};_0x58403b(++_0x36a1d3);}(_0x8c0c,0x7e));var _0xc8c0=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x8c0c[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xc8c0('0x0'));var util=require('util');var logger=require(_0xc8c0('0x1'))('api');var moment=require(_0xc8c0('0x2'));var BPromise=require(_0xc8c0('0x3'));var rp=require(_0xc8c0('0x4'));var attributes=require(_0xc8c0('0x5'));module[_0xc8c0('0x6')]=function(_0x5d3614,_0x113b3d){return _0x5d3614[_0xc8c0('0x7')](_0xc8c0('0x8'),attributes,{'tableName':_0xc8c0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xad6c=['moment','request-promise','exports','lodash','../../config/logger','api'];(function(_0x120761,_0x1838dc){var _0x17a331=function(_0x353050){while(--_0x353050){_0x120761['push'](_0x120761['shift']());}};_0x17a331(++_0x1838dc);}(_0xad6c,0xab));var _0xcad6=function(_0x2876ef,_0x174ce8){_0x2876ef=_0x2876ef-0x0;var _0x4dd26e=_0xad6c[_0x2876ef];return _0x4dd26e;};'use strict';var _=require(_0xcad6('0x0'));var util=require('util');var logger=require(_0xcad6('0x1'))(_0xcad6('0x2'));var moment=require(_0xcad6('0x3'));var BPromise=require('bluebird');var rp=require(_0xcad6('0x4'));var attributes=require('./analyticTreeReport.attributes');module[_0xcad6('0x5')]=function(_0x1f38aa,_0x231321){return _0x1f38aa['define']('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index d59496c..f0048a0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb641=['client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise'];(function(_0x243d93,_0x162a70){var _0x31087f=function(_0x290598){while(--_0x290598){_0x243d93['push'](_0x243d93['shift']());}};_0x31087f(++_0x162a70);}(_0xb641,0x18f));var _0x1b64=function(_0x55f4f6,_0x8e97e6){_0x55f4f6=_0x55f4f6-0x0;var _0x5e908f=_0xb641[_0x55f4f6];return _0x5e908f;};'use strict';var _=require(_0x1b64('0x0'));var util=require(_0x1b64('0x1'));var moment=require(_0x1b64('0x2'));var BPromise=require(_0x1b64('0x3'));var rs=require(_0x1b64('0x4'));var fs=require('fs');var Redis=require(_0x1b64('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b64('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1b64('0x7'));var jayson=require(_0x1b64('0x8'));var client=jayson[_0x1b64('0x9')][_0x1b64('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15dce3,_0x463efe,_0x176d17){return new BPromise(function(_0x3bb795,_0x5364d1){return client[_0x1b64('0xb')](_0x15dce3,_0x176d17)[_0x1b64('0xc')](function(_0x584139){logger['info'](_0x1b64('0xd'),_0x463efe,_0x1b64('0xe'));logger[_0x1b64('0xf')](_0x1b64('0x10'),_0x463efe,_0x1b64('0xe'),JSON[_0x1b64('0x11')](_0x584139));if(_0x584139['error']){if(_0x584139[_0x1b64('0x12')][_0x1b64('0x13')]===0x1f4){logger[_0x1b64('0x12')](_0x1b64('0xd'),_0x463efe,_0x584139[_0x1b64('0x12')]['message']);return _0x5364d1(_0x584139[_0x1b64('0x12')][_0x1b64('0x14')]);}logger['error'](_0x1b64('0xd'),_0x463efe,_0x584139[_0x1b64('0x12')][_0x1b64('0x14')]);return _0x3bb795(_0x584139['error'][_0x1b64('0x14')]);}else{logger[_0x1b64('0x15')]('AnalyticTreeReport,\x20%s,\x20%s',_0x463efe,_0x1b64('0xe'));_0x3bb795(_0x584139[_0x1b64('0x16')][_0x1b64('0x14')]);}})[_0x1b64('0x17')](function(_0x4119d7){logger[_0x1b64('0x12')](_0x1b64('0xd'),_0x463efe,_0x4119d7);_0x5364d1(_0x4119d7);});});}
\ No newline at end of file
+var _0xa58a=['AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticTreeReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','request\x20sent'];(function(_0x2ee795,_0xe6a148){var _0x57f92d=function(_0x26a417){while(--_0x26a417){_0x2ee795['push'](_0x2ee795['shift']());}};_0x57f92d(++_0xe6a148);}(_0xa58a,0x194));var _0xaa58=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xa58a[_0x20ef64];return _0x3707d8;};'use strict';var _=require(_0xaa58('0x0'));var util=require(_0xaa58('0x1'));var moment=require(_0xaa58('0x2'));var BPromise=require(_0xaa58('0x3'));var rs=require(_0xaa58('0x4'));var fs=require('fs');var Redis=require(_0xaa58('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xaa58('0x6'));var logger=require(_0xaa58('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xaa58('0x8'));var client=jayson[_0xaa58('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x177bec,_0x2c75d9,_0x290c42){return new BPromise(function(_0x41e53c,_0x59b26a){return client[_0xaa58('0xa')](_0x177bec,_0x290c42)[_0xaa58('0xb')](function(_0x495103){logger[_0xaa58('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x2c75d9,_0xaa58('0xd'));logger['debug'](_0xaa58('0xe'),_0x2c75d9,_0xaa58('0xd'),JSON[_0xaa58('0xf')](_0x495103));if(_0x495103[_0xaa58('0x10')]){if(_0x495103[_0xaa58('0x10')][_0xaa58('0x11')]===0x1f4){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x2c75d9,_0x495103[_0xaa58('0x10')]['message']);return _0x59b26a(_0x495103[_0xaa58('0x10')][_0xaa58('0x12')]);}logger[_0xaa58('0x10')](_0xaa58('0x13'),_0x2c75d9,_0x495103[_0xaa58('0x10')][_0xaa58('0x12')]);return _0x41e53c(_0x495103[_0xaa58('0x10')]['message']);}else{logger['info'](_0xaa58('0x13'),_0x2c75d9,'request\x20sent');_0x41e53c(_0x495103[_0xaa58('0x14')][_0xaa58('0x12')]);}})[_0xaa58('0x15')](function(_0x4e1db3){logger[_0xaa58('0x10')](_0xaa58('0x13'),_0x2c75d9,_0x4e1db3);_0x59b26a(_0x4e1db3);});});}
\ No newline at end of file
index d45068d..dcf8056 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x57b3=['update','delete','destroy','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','put','/:id'];(function(_0x31a16a,_0x1d60e3){var _0x21c892=function(_0x5b25f6){while(--_0x5b25f6){_0x31a16a['push'](_0x31a16a['shift']());}};_0x21c892(++_0x1d60e3);}(_0x57b3,0x93));var _0x357b=function(_0x59a4f1,_0x2fadda){_0x59a4f1=_0x59a4f1-0x0;var _0x23dd94=_0x57b3[_0x59a4f1];return _0x23dd94;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x357b('0x0'));var timeout=require('connect-timeout');var express=require(_0x357b('0x1'));var router=express[_0x357b('0x2')]();var auth=require(_0x357b('0x3'));var interaction=require(_0x357b('0x4'));var config=require(_0x357b('0x5'));var controller=require('./analyticTreeReport.controller');router[_0x357b('0x6')]('/',auth[_0x357b('0x7')](),controller['index']);router[_0x357b('0x6')]('/:id',auth[_0x357b('0x7')](),controller[_0x357b('0x8')]);router[_0x357b('0x9')]('/',auth[_0x357b('0x7')](),controller[_0x357b('0xa')]);router[_0x357b('0xb')](_0x357b('0xc'),auth[_0x357b('0x7')](),controller[_0x357b('0xd')]);router[_0x357b('0xe')](_0x357b('0xc'),auth[_0x357b('0x7')](),controller[_0x357b('0xf')]);module['exports']=router;
\ No newline at end of file
+var _0x343f=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','post','create','put','/:id','update','destroy','exports','multer'];(function(_0x5b43bc,_0x4066b1){var _0x113b80=function(_0x43b6e0){while(--_0x43b6e0){_0x5b43bc['push'](_0x5b43bc['shift']());}};_0x113b80(++_0x4066b1);}(_0x343f,0xd7));var _0xf343=function(_0xc90e2b,_0x599fa6){_0xc90e2b=_0xc90e2b-0x0;var _0x54eec0=_0x343f[_0xc90e2b];return _0x54eec0;};'use strict';var multer=require(_0xf343('0x0'));var util=require('util');var path=require(_0xf343('0x1'));var timeout=require('connect-timeout');var express=require(_0xf343('0x2'));var router=express[_0xf343('0x3')]();var auth=require(_0xf343('0x4'));var interaction=require(_0xf343('0x5'));var config=require(_0xf343('0x6'));var controller=require(_0xf343('0x7'));router[_0xf343('0x8')]('/',auth[_0xf343('0x9')](),controller[_0xf343('0xa')]);router[_0xf343('0x8')]('/:id',auth[_0xf343('0x9')](),controller['show']);router[_0xf343('0xb')]('/',auth[_0xf343('0x9')](),controller[_0xf343('0xc')]);router[_0xf343('0xd')](_0xf343('0xe'),auth[_0xf343('0x9')](),controller[_0xf343('0xf')]);router['delete']('/:id',auth[_0xf343('0x9')](),controller[_0xf343('0x10')]);module[_0xf343('0x11')]=router;
\ No newline at end of file
index b874d51..61b2924 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x48c0=['STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x48c0,0x175));var _0x048c=function(_0x3f515a,_0x35b6f7){_0x3f515a=_0x3f515a-0x0;var _0x595989=_0x48c0[_0x3f515a];return _0x595989;};'use strict';var Sequelize=require(_0x048c('0x0'));module[_0x048c('0x1')]={'name':{'type':Sequelize[_0x048c('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x048c('0x2')]}};
\ No newline at end of file
+var _0xbb60=['sequelize','exports','STRING'];(function(_0x1c8491,_0x335e02){var _0x2a9aae=function(_0x1fb134){while(--_0x1fb134){_0x1c8491['push'](_0x1c8491['shift']());}};_0x2a9aae(++_0x335e02);}(_0xbb60,0xfc));var _0x0bb6=function(_0x3fe867,_0x21082b){_0x3fe867=_0x3fe867-0x0;var _0x3a3e14=_0xbb60[_0x3fe867];return _0x3a3e14;};'use strict';var Sequelize=require(_0x0bb6('0x0'));module[_0x0bb6('0x1')]={'name':{'type':Sequelize[_0x0bb6('0x2')]},'basename':{'type':Sequelize[_0x0bb6('0x2')]},'type':{'type':Sequelize[_0x0bb6('0x2')]}};
\ No newline at end of file
index be54a42..342eb15 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd9be=['offset','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','Attachment','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','map','type','key','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','body','create','file','originalname','mimetype','download','findOne','join','root','server/files/attachments/','basename','html-pdf','eml-format','zip-dir','request-promise','bluebird','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count'];(function(_0x2d9535,_0x4bc592){var _0xb4e710=function(_0x50b9a9){while(--_0x50b9a9){_0x2d9535['push'](_0x2d9535['shift']());}};_0xb4e710(++_0x4bc592);}(_0xd9be,0xd3));var _0xed9b=function(_0x516320,_0x3358dc){_0x516320=_0x516320-0x0;var _0x5500e8=_0xd9be[_0x516320];return _0x5500e8;};'use strict';var pdf=require(_0xed9b('0x0'));var emlformat=require(_0xed9b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xed9b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed9b('0x3'));var moment=require('moment');var BPromise=require(_0xed9b('0x4'));var Mustache=require('mustache');var util=require(_0xed9b('0x5'));var path=require(_0xed9b('0x6'));var sox=require(_0xed9b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xed9b('0x8'));var squel=require(_0xed9b('0x9'));var crypto=require(_0xed9b('0xa'));var jsforce=require(_0xed9b('0xb'));var deskjs=require(_0xed9b('0xc'));var toCsv=require(_0xed9b('0xd'));var querystring=require('querystring');var Papa=require(_0xed9b('0xe'));var authService=require(_0xed9b('0xf'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0xed9b('0x10'));var logger=require(_0xed9b('0x11'))(_0xed9b('0x12'));var utils=require(_0xed9b('0x13'));var config=require(_0xed9b('0x14'));var db=require(_0xed9b('0x15'))['db'];function respondWithStatusCode(_0x4fc5f5,_0x4d1d1c){_0x4d1d1c=_0x4d1d1c||0xcc;return function(_0x294fb0){if(_0x294fb0){return _0x4fc5f5['sendStatus'](_0x4d1d1c);}return _0x4fc5f5[_0xed9b('0x16')](_0x4d1d1c)[_0xed9b('0x17')]();};}function respondWithResult(_0x4a14cd,_0x5489f9){_0x5489f9=_0x5489f9||0xc8;return function(_0x444b2d){if(_0x444b2d){return _0x4a14cd['status'](_0x5489f9)[_0xed9b('0x18')](_0x444b2d);}};}function respondWithFilteredResult(_0x512bb2,_0x3a52e1){return function(_0x462692){if(_0x462692){var _0x461d5b=_0x462692[_0xed9b('0x19')],_0x4c8c28=_0x3a52e1[_0xed9b('0x1a')],_0x632ee5=_0x3a52e1[_0xed9b('0x1a')]+_0x3a52e1[_0xed9b('0x1b')],_0x587983;if(_0x632ee5>=_0x461d5b){_0x632ee5=_0x461d5b;_0x587983=0xc8;}else{_0x587983=0xce;}_0x512bb2[_0xed9b('0x16')](_0x587983);return _0x512bb2[_0xed9b('0x1c')](_0xed9b('0x1d'),_0x4c8c28+'-'+_0x632ee5+'/'+_0x461d5b)['json'](_0x462692);}return null;};}function patchUpdates(_0x5be259){return function(_0x30a423){try{jsonpatch['apply'](_0x30a423,_0x5be259,!![]);}catch(_0x220a36){return BPromise[_0xed9b('0x1e')](_0x220a36);}return _0x30a423[_0xed9b('0x1f')]();};}function saveUpdates(_0x2ed9ff,_0x2eb5bd){return function(_0x21821f){if(_0x21821f){return _0x21821f[_0xed9b('0x20')](_0x2ed9ff)[_0xed9b('0x21')](function(_0x354b48){return _0x354b48;});}return null;};}function removeEntity(_0x4b93c7,_0x38a84e){return function(_0x33995d){if(_0x33995d){return _0x33995d[_0xed9b('0x22')]()[_0xed9b('0x21')](function(){_0x4b93c7[_0xed9b('0x16')](0xcc)[_0xed9b('0x17')]();});}};}function handleEntityNotFound(_0x12df88,_0x218c82){return function(_0x21c2a1){if(!_0x21c2a1){_0x12df88['sendStatus'](0x194);}return _0x21c2a1;};}function handleError(_0x24e6b2,_0x553aa3){_0x553aa3=_0x553aa3||0x1f4;return function(_0x2ed50f){logger['error'](_0x2ed50f[_0xed9b('0x23')]);if(_0x2ed50f[_0xed9b('0x24')]){delete _0x2ed50f[_0xed9b('0x24')];}_0x24e6b2[_0xed9b('0x16')](_0x553aa3)[_0xed9b('0x25')](_0x2ed50f);};}exports[_0xed9b('0x26')]=function(_0x39ec47,_0x176ee0){var _0x8e1d4d={},_0x1da3c0={},_0x4cdf3c={'count':0x0,'rows':[]};var _0x511210=db[_0xed9b('0x27')]['rawAttributes'];_0x1da3c0[_0xed9b('0x28')]=_[_0xed9b('0x29')](_0x511210);_0x1da3c0[_0xed9b('0x2a')]=_[_0xed9b('0x29')](_0x39ec47[_0xed9b('0x2a')]);_0x1da3c0[_0xed9b('0x2b')]=_[_0xed9b('0x2c')](_0x1da3c0['model'],_0x1da3c0[_0xed9b('0x2a')]);_0x8e1d4d[_0xed9b('0x2d')]=_[_0xed9b('0x2c')](_0x1da3c0[_0xed9b('0x28')],qs[_0xed9b('0x2e')](_0x39ec47[_0xed9b('0x2a')]['fields']));_0x8e1d4d['attributes']=_0x8e1d4d[_0xed9b('0x2d')][_0xed9b('0x2f')]?_0x8e1d4d[_0xed9b('0x2d')]:_0x1da3c0['model'];if(!_0x39ec47[_0xed9b('0x2a')][_0xed9b('0x30')](_0xed9b('0x31'))){_0x8e1d4d['limit']=qs[_0xed9b('0x1b')](_0x39ec47[_0xed9b('0x2a')][_0xed9b('0x1b')]);_0x8e1d4d[_0xed9b('0x1a')]=qs['offset'](_0x39ec47[_0xed9b('0x2a')][_0xed9b('0x1a')]);}_0x8e1d4d['order']=qs[_0xed9b('0x32')](_0x39ec47[_0xed9b('0x2a')][_0xed9b('0x32')]);_0x8e1d4d['where']=qs['filters'](_[_0xed9b('0x33')](_0x39ec47['query'],_0x1da3c0['filters']));if(_0x39ec47[_0xed9b('0x2a')][_0xed9b('0x34')]){_0x8e1d4d['where']=_[_0xed9b('0x35')](_0x8e1d4d[_0xed9b('0x36')],{'$or':_[_0xed9b('0x37')](_0x511210,function(_0x1ead0e){if(_0x1ead0e[_0xed9b('0x38')][_0xed9b('0x39')]!==_0xed9b('0x3a')){var _0x5c9eaa={};_0x5c9eaa[_0x1ead0e['field']]={'$like':'%'+_0x39ec47[_0xed9b('0x2a')][_0xed9b('0x34')]+'%'};return _0x5c9eaa;}})});}_0x8e1d4d=_[_0xed9b('0x35')]({},_0x8e1d4d,_0x39ec47[_0xed9b('0x3b')]);var _0x3cc98f={'where':_0x8e1d4d[_0xed9b('0x36')]};return db[_0xed9b('0x27')]['count'](_0x3cc98f)['then'](function(_0xdb73bc){_0x4cdf3c[_0xed9b('0x19')]=_0xdb73bc;if(_0x39ec47['query']['includeAll']){_0x8e1d4d[_0xed9b('0x3c')]=[{'all':!![]}];}return db[_0xed9b('0x27')][_0xed9b('0x3d')](_0x8e1d4d);})[_0xed9b('0x21')](function(_0x2daa74){_0x4cdf3c[_0xed9b('0x3e')]=_0x2daa74;return _0x4cdf3c;})[_0xed9b('0x21')](respondWithFilteredResult(_0x176ee0,_0x8e1d4d))[_0xed9b('0x3f')](handleError(_0x176ee0,null));};exports[_0xed9b('0x40')]=function(_0x253d59,_0x2e3266){var _0x3e3c70={'raw':!![],'where':{'id':_0x253d59[_0xed9b('0x41')]['id']}},_0x3fb57f={};_0x3fb57f[_0xed9b('0x28')]=_[_0xed9b('0x29')](db['Attachment']['rawAttributes']);_0x3fb57f['query']=_[_0xed9b('0x29')](_0x253d59[_0xed9b('0x2a')]);_0x3fb57f['filters']=_[_0xed9b('0x2c')](_0x3fb57f['model'],_0x3fb57f['query']);_0x3e3c70[_0xed9b('0x2d')]=_[_0xed9b('0x2c')](_0x3fb57f[_0xed9b('0x28')],qs[_0xed9b('0x2e')](_0x253d59[_0xed9b('0x2a')][_0xed9b('0x2e')]));_0x3e3c70[_0xed9b('0x2d')]=_0x3e3c70[_0xed9b('0x2d')]['length']?_0x3e3c70[_0xed9b('0x2d')]:_0x3fb57f[_0xed9b('0x28')];if(_0x253d59[_0xed9b('0x2a')][_0xed9b('0x42')]){_0x3e3c70[_0xed9b('0x3c')]=[{'all':!![]}];}_0x3e3c70=_['merge']({},_0x3e3c70,_0x253d59[_0xed9b('0x3b')]);return db[_0xed9b('0x27')][_0xed9b('0x43')](_0x3e3c70)[_0xed9b('0x21')](handleEntityNotFound(_0x2e3266,null))['then'](respondWithResult(_0x2e3266,null))[_0xed9b('0x3f')](handleError(_0x2e3266,null));};exports['update']=function(_0x1ddf82,_0x17b072){if(_0x1ddf82['body']['id']){delete _0x1ddf82[_0xed9b('0x44')]['id'];}return db[_0xed9b('0x27')][_0xed9b('0x43')]({'where':{'id':_0x1ddf82[_0xed9b('0x41')]['id']}})[_0xed9b('0x21')](handleEntityNotFound(_0x17b072,null))['then'](saveUpdates(_0x1ddf82[_0xed9b('0x44')],null))[_0xed9b('0x21')](respondWithResult(_0x17b072,null))[_0xed9b('0x3f')](handleError(_0x17b072,null));};exports[_0xed9b('0x22')]=function(_0x2e46e7,_0x2555fc){return db[_0xed9b('0x27')][_0xed9b('0x43')]({'where':{'id':_0x2e46e7[_0xed9b('0x41')]['id']}})[_0xed9b('0x21')](handleEntityNotFound(_0x2555fc,null))[_0xed9b('0x21')](removeEntity(_0x2555fc,null))[_0xed9b('0x3f')](handleError(_0x2555fc,null));};exports[_0xed9b('0x45')]=function(_0x18ce1d,_0x5e6897,_0x5eaf67){_0x18ce1d[_0xed9b('0x44')]['name']=_0x18ce1d[_0xed9b('0x46')][_0xed9b('0x47')];_0x18ce1d[_0xed9b('0x44')]['basename']=_0x18ce1d[_0xed9b('0x46')]['filename'];_0x18ce1d['body']['type']=_0x18ce1d[_0xed9b('0x46')][_0xed9b('0x48')];return db[_0xed9b('0x27')][_0xed9b('0x45')](_0x18ce1d[_0xed9b('0x44')])[_0xed9b('0x21')](respondWithResult(_0x5e6897,0xc9))[_0xed9b('0x3f')](handleError(_0x5e6897,null));};exports[_0xed9b('0x49')]=function(_0x1c17a7,_0x1d93e3,_0x51b215){return db['Attachment'][_0xed9b('0x4a')]({'where':{'id':_0x1c17a7[_0xed9b('0x41')]['id']},'raw':!![]})[_0xed9b('0x21')](handleEntityNotFound(_0x1d93e3,null))[_0xed9b('0x21')](function(_0x507186){if(_0x507186){return _0x1d93e3[_0xed9b('0x49')](path[_0xed9b('0x4b')](config[_0xed9b('0x4c')],_0xed9b('0x4d'),_0x507186[_0xed9b('0x4e')]));}})[_0xed9b('0x3f')](handleError(_0x1d93e3,null));};
\ No newline at end of file
+var _0x25ca=['key','VIRTUAL','field','options','count','includeAll','include','Attachment','rows','catch','show','params','fields','find','update','body','originalname','file','filename','mimetype','download','findOne','join','server/files/attachments/','basename','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','then','destroy','error','stack','name','send','model','keys','query','filters','intersection','attributes','length','nolimit','order','sort','pick','filter','where','merge','map','type'];(function(_0x49052b,_0x1612f7){var _0x2f40cf=function(_0x3357a2){while(--_0x3357a2){_0x49052b['push'](_0x49052b['shift']());}};_0x2f40cf(++_0x1612f7);}(_0x25ca,0x68));var _0xa25c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x25ca[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xa25c('0x0'));var emlformat=require(_0xa25c('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa25c('0x2'));var rp=require(_0xa25c('0x3'));var moment=require(_0xa25c('0x4'));var BPromise=require(_0xa25c('0x5'));var Mustache=require('mustache');var util=require(_0xa25c('0x6'));var path=require(_0xa25c('0x7'));var sox=require(_0xa25c('0x8'));var csv=require(_0xa25c('0x9'));var ejs=require(_0xa25c('0xa'));var fs=require('fs');var _=require(_0xa25c('0xb'));var squel=require('squel');var crypto=require(_0xa25c('0xc'));var jsforce=require(_0xa25c('0xd'));var deskjs=require(_0xa25c('0xe'));var toCsv=require(_0xa25c('0x9'));var querystring=require('querystring');var Papa=require(_0xa25c('0xf'));var authService=require('../../components/auth/service');var hardwareService=require(_0xa25c('0x10'));var Redis=require(_0xa25c('0x11'));var qs=require(_0xa25c('0x12'));var logger=require('../../config/logger')(_0xa25c('0x13'));var utils=require(_0xa25c('0x14'));var config=require(_0xa25c('0x15'));var db=require(_0xa25c('0x16'))['db'];function respondWithStatusCode(_0x4998ea,_0x4a5de5){_0x4a5de5=_0x4a5de5||0xcc;return function(_0x56d617){if(_0x56d617){return _0x4998ea[_0xa25c('0x17')](_0x4a5de5);}return _0x4998ea[_0xa25c('0x18')](_0x4a5de5)[_0xa25c('0x19')]();};}function respondWithResult(_0x5ecd2c,_0x8daebd){_0x8daebd=_0x8daebd||0xc8;return function(_0x365f68){if(_0x365f68){return _0x5ecd2c[_0xa25c('0x18')](_0x8daebd)[_0xa25c('0x1a')](_0x365f68);}};}function respondWithFilteredResult(_0x2be2d8,_0x255a5b){return function(_0x310e7d){if(_0x310e7d){var _0x2efb44=_0x310e7d['count'],_0x1433e3=_0x255a5b[_0xa25c('0x1b')],_0x185f2f=_0x255a5b[_0xa25c('0x1b')]+_0x255a5b[_0xa25c('0x1c')],_0x4e5623;if(_0x185f2f>=_0x2efb44){_0x185f2f=_0x2efb44;_0x4e5623=0xc8;}else{_0x4e5623=0xce;}_0x2be2d8['status'](_0x4e5623);return _0x2be2d8['set'](_0xa25c('0x1d'),_0x1433e3+'-'+_0x185f2f+'/'+_0x2efb44)[_0xa25c('0x1a')](_0x310e7d);}return null;};}function patchUpdates(_0x3b40a9){return function(_0x1be187){try{jsonpatch[_0xa25c('0x1e')](_0x1be187,_0x3b40a9,!![]);}catch(_0x8068f){return BPromise[_0xa25c('0x1f')](_0x8068f);}return _0x1be187['save']();};}function saveUpdates(_0x4e88b2,_0x2f42e0){return function(_0x3ff6b8){if(_0x3ff6b8){return _0x3ff6b8['update'](_0x4e88b2)[_0xa25c('0x20')](function(_0x23412e){return _0x23412e;});}return null;};}function removeEntity(_0x3dbbe7,_0x4b917d){return function(_0x4ffd28){if(_0x4ffd28){return _0x4ffd28[_0xa25c('0x21')]()[_0xa25c('0x20')](function(){_0x3dbbe7['status'](0xcc)[_0xa25c('0x19')]();});}};}function handleEntityNotFound(_0x250014,_0xb24743){return function(_0xc47b7e){if(!_0xc47b7e){_0x250014[_0xa25c('0x17')](0x194);}return _0xc47b7e;};}function handleError(_0x515ea6,_0xc84ab2){_0xc84ab2=_0xc84ab2||0x1f4;return function(_0x4fe16f){logger[_0xa25c('0x22')](_0x4fe16f[_0xa25c('0x23')]);if(_0x4fe16f[_0xa25c('0x24')]){delete _0x4fe16f[_0xa25c('0x24')];}_0x515ea6[_0xa25c('0x18')](_0xc84ab2)[_0xa25c('0x25')](_0x4fe16f);};}exports['index']=function(_0x17fa4c,_0x45e17a){var _0x2acf72={},_0x1ee70a={},_0x3b3d0e={'count':0x0,'rows':[]};var _0x330312=db['Attachment']['rawAttributes'];_0x1ee70a[_0xa25c('0x26')]=_[_0xa25c('0x27')](_0x330312);_0x1ee70a['query']=_[_0xa25c('0x27')](_0x17fa4c[_0xa25c('0x28')]);_0x1ee70a[_0xa25c('0x29')]=_['intersection'](_0x1ee70a[_0xa25c('0x26')],_0x1ee70a['query']);_0x2acf72['attributes']=_[_0xa25c('0x2a')](_0x1ee70a['model'],qs['fields'](_0x17fa4c[_0xa25c('0x28')]['fields']));_0x2acf72['attributes']=_0x2acf72[_0xa25c('0x2b')][_0xa25c('0x2c')]?_0x2acf72[_0xa25c('0x2b')]:_0x1ee70a['model'];if(!_0x17fa4c[_0xa25c('0x28')]['hasOwnProperty'](_0xa25c('0x2d'))){_0x2acf72[_0xa25c('0x1c')]=qs['limit'](_0x17fa4c[_0xa25c('0x28')]['limit']);_0x2acf72[_0xa25c('0x1b')]=qs['offset'](_0x17fa4c[_0xa25c('0x28')][_0xa25c('0x1b')]);}_0x2acf72[_0xa25c('0x2e')]=qs[_0xa25c('0x2f')](_0x17fa4c['query'][_0xa25c('0x2f')]);_0x2acf72['where']=qs[_0xa25c('0x29')](_[_0xa25c('0x30')](_0x17fa4c[_0xa25c('0x28')],_0x1ee70a[_0xa25c('0x29')]));if(_0x17fa4c[_0xa25c('0x28')][_0xa25c('0x31')]){_0x2acf72[_0xa25c('0x32')]=_[_0xa25c('0x33')](_0x2acf72[_0xa25c('0x32')],{'$or':_[_0xa25c('0x34')](_0x330312,function(_0xe14d74){if(_0xe14d74[_0xa25c('0x35')][_0xa25c('0x36')]!==_0xa25c('0x37')){var _0x270811={};_0x270811[_0xe14d74[_0xa25c('0x38')]]={'$like':'%'+_0x17fa4c[_0xa25c('0x28')][_0xa25c('0x31')]+'%'};return _0x270811;}})});}_0x2acf72=_[_0xa25c('0x33')]({},_0x2acf72,_0x17fa4c[_0xa25c('0x39')]);var _0x2c3280={'where':_0x2acf72[_0xa25c('0x32')]};return db['Attachment'][_0xa25c('0x3a')](_0x2c3280)['then'](function(_0x593339){_0x3b3d0e[_0xa25c('0x3a')]=_0x593339;if(_0x17fa4c[_0xa25c('0x28')][_0xa25c('0x3b')]){_0x2acf72[_0xa25c('0x3c')]=[{'all':!![]}];}return db[_0xa25c('0x3d')]['findAll'](_0x2acf72);})[_0xa25c('0x20')](function(_0x4c4eb7){_0x3b3d0e[_0xa25c('0x3e')]=_0x4c4eb7;return _0x3b3d0e;})[_0xa25c('0x20')](respondWithFilteredResult(_0x45e17a,_0x2acf72))[_0xa25c('0x3f')](handleError(_0x45e17a,null));};exports[_0xa25c('0x40')]=function(_0x4016ac,_0x148fb9){var _0x3dab89={'raw':!![],'where':{'id':_0x4016ac[_0xa25c('0x41')]['id']}},_0x13ec35={};_0x13ec35[_0xa25c('0x26')]=_[_0xa25c('0x27')](db[_0xa25c('0x3d')]['rawAttributes']);_0x13ec35['query']=_[_0xa25c('0x27')](_0x4016ac[_0xa25c('0x28')]);_0x13ec35[_0xa25c('0x29')]=_[_0xa25c('0x2a')](_0x13ec35[_0xa25c('0x26')],_0x13ec35[_0xa25c('0x28')]);_0x3dab89[_0xa25c('0x2b')]=_['intersection'](_0x13ec35[_0xa25c('0x26')],qs[_0xa25c('0x42')](_0x4016ac['query'][_0xa25c('0x42')]));_0x3dab89[_0xa25c('0x2b')]=_0x3dab89[_0xa25c('0x2b')][_0xa25c('0x2c')]?_0x3dab89[_0xa25c('0x2b')]:_0x13ec35[_0xa25c('0x26')];if(_0x4016ac[_0xa25c('0x28')][_0xa25c('0x3b')]){_0x3dab89['include']=[{'all':!![]}];}_0x3dab89=_['merge']({},_0x3dab89,_0x4016ac['options']);return db[_0xa25c('0x3d')][_0xa25c('0x43')](_0x3dab89)[_0xa25c('0x20')](handleEntityNotFound(_0x148fb9,null))[_0xa25c('0x20')](respondWithResult(_0x148fb9,null))[_0xa25c('0x3f')](handleError(_0x148fb9,null));};exports[_0xa25c('0x44')]=function(_0x5203d1,_0x2669a7){if(_0x5203d1[_0xa25c('0x45')]['id']){delete _0x5203d1[_0xa25c('0x45')]['id'];}return db[_0xa25c('0x3d')][_0xa25c('0x43')]({'where':{'id':_0x5203d1[_0xa25c('0x41')]['id']}})[_0xa25c('0x20')](handleEntityNotFound(_0x2669a7,null))[_0xa25c('0x20')](saveUpdates(_0x5203d1['body'],null))[_0xa25c('0x20')](respondWithResult(_0x2669a7,null))['catch'](handleError(_0x2669a7,null));};exports[_0xa25c('0x21')]=function(_0x487d11,_0x462a93){return db['Attachment'][_0xa25c('0x43')]({'where':{'id':_0x487d11[_0xa25c('0x41')]['id']}})[_0xa25c('0x20')](handleEntityNotFound(_0x462a93,null))[_0xa25c('0x20')](removeEntity(_0x462a93,null))[_0xa25c('0x3f')](handleError(_0x462a93,null));};exports['create']=function(_0x23e80d,_0x13e9cd,_0x463b69){_0x23e80d[_0xa25c('0x45')][_0xa25c('0x24')]=_0x23e80d['file'][_0xa25c('0x46')];_0x23e80d[_0xa25c('0x45')]['basename']=_0x23e80d[_0xa25c('0x47')][_0xa25c('0x48')];_0x23e80d[_0xa25c('0x45')][_0xa25c('0x35')]=_0x23e80d[_0xa25c('0x47')][_0xa25c('0x49')];return db[_0xa25c('0x3d')]['create'](_0x23e80d[_0xa25c('0x45')])[_0xa25c('0x20')](respondWithResult(_0x13e9cd,0xc9))[_0xa25c('0x3f')](handleError(_0x13e9cd,null));};exports[_0xa25c('0x4a')]=function(_0x536587,_0x13f3f8,_0xc256de){return db[_0xa25c('0x3d')][_0xa25c('0x4b')]({'where':{'id':_0x536587['params']['id']},'raw':!![]})[_0xa25c('0x20')](handleEntityNotFound(_0x13f3f8,null))[_0xa25c('0x20')](function(_0x1f057d){if(_0x1f057d){return _0x13f3f8[_0xa25c('0x4a')](path[_0xa25c('0x4c')](config['root'],_0xa25c('0x4d'),_0x1f057d[_0xa25c('0x4e')]));}})['catch'](handleError(_0x13f3f8,null));};
\ No newline at end of file
index 3e7c316..4225586 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['exports','define','Attachment','attachments','lodash','util','../../config/logger','api','bluebird','request-promise','./attachment.attributes'];(function(_0x4bfcd2,_0x15ea90){var _0x40380d=function(_0xa1fc0c){while(--_0xa1fc0c){_0x4bfcd2['push'](_0x4bfcd2['shift']());}};_0x40380d(++_0x15ea90);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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 attributes=require(_0x7995('0x6'));module[_0x7995('0x7')]=function(_0x576d89,_0x744bea){return _0x576d89[_0x7995('0x8')](_0x7995('0x9'),attributes,{'tableName':_0x7995('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x814b=['../../config/logger','api','moment','bluebird','./attachment.attributes','exports','define','Attachment','lodash','util'];(function(_0x36d703,_0x55b354){var _0x12c909=function(_0x5e846a){while(--_0x5e846a){_0x36d703['push'](_0x36d703['shift']());}};_0x12c909(++_0x55b354);}(_0x814b,0x1a2));var _0xb814=function(_0x4456a2,_0x376ff2){_0x4456a2=_0x4456a2-0x0;var _0xf36b56=_0x814b[_0x4456a2];return _0xf36b56;};'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 attributes=require(_0xb814('0x6'));module[_0xb814('0x7')]=function(_0x258866,_0x4237bc){return _0x258866[_0xb814('0x8')](_0xb814('0x9'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index ae105b8..8e4f8a9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe5c7=['result','catch','Attachment','body','options','raw','CreateAttachment','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4a29a9,_0x58cd04){var _0x386570=function(_0x1d2d09){while(--_0x1d2d09){_0x4a29a9['push'](_0x4a29a9['shift']());}};_0x386570(++_0x58cd04);}(_0xe5c7,0x1d8));var _0x7e5c=function(_0x48adca,_0x340611){_0x48adca=_0x48adca-0x0;var _0x49f030=_0xe5c7[_0x48adca];return _0x49f030;};'use strict';var _=require(_0x7e5c('0x0'));var util=require(_0x7e5c('0x1'));var moment=require(_0x7e5c('0x2'));var BPromise=require(_0x7e5c('0x3'));var rs=require(_0x7e5c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e5c('0x5'))['db'];var utils=require(_0x7e5c('0x6'));var logger=require(_0x7e5c('0x7'))(_0x7e5c('0x8'));var config=require(_0x7e5c('0x9'));var jayson=require(_0x7e5c('0xa'));var client=jayson[_0x7e5c('0xb')][_0x7e5c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x276ec9,_0x2eac84,_0x39e5be){return new BPromise(function(_0x2fc5bc,_0x467787){return client[_0x7e5c('0xd')](_0x276ec9,_0x39e5be)[_0x7e5c('0xe')](function(_0x11aac8){logger[_0x7e5c('0xf')](_0x7e5c('0x10'),_0x2eac84,_0x7e5c('0x11'));logger[_0x7e5c('0x12')](_0x7e5c('0x13'),_0x2eac84,_0x7e5c('0x11'),JSON[_0x7e5c('0x14')](_0x11aac8));if(_0x11aac8[_0x7e5c('0x15')]){if(_0x11aac8[_0x7e5c('0x15')][_0x7e5c('0x16')]===0x1f4){logger['error'](_0x7e5c('0x10'),_0x2eac84,_0x11aac8[_0x7e5c('0x15')]['message']);return _0x467787(_0x11aac8[_0x7e5c('0x15')][_0x7e5c('0x17')]);}logger[_0x7e5c('0x15')]('Attachment,\x20%s,\x20%s',_0x2eac84,_0x11aac8[_0x7e5c('0x15')]['message']);return _0x2fc5bc(_0x11aac8[_0x7e5c('0x15')]['message']);}else{logger['info'](_0x7e5c('0x10'),_0x2eac84,'request\x20sent');_0x2fc5bc(_0x11aac8[_0x7e5c('0x18')][_0x7e5c('0x17')]);}})[_0x7e5c('0x19')](function(_0x17de6a){logger[_0x7e5c('0x15')](_0x7e5c('0x10'),_0x2eac84,_0x17de6a);_0x467787(_0x17de6a);});});}exports['CreateAttachment']=function(_0xa796d6){var _0x49de03=this;return new Promise(function(_0x307b31,_0x1a4a9b){return db[_0x7e5c('0x1a')]['create'](_0xa796d6[_0x7e5c('0x1b')],{'raw':_0xa796d6[_0x7e5c('0x1c')]?_0xa796d6[_0x7e5c('0x1c')][_0x7e5c('0x1d')]===undefined?!![]:![]:!![]})[_0x7e5c('0xe')](function(_0x2fb8e0){logger['info'](_0x7e5c('0x1e'),_0xa796d6);logger[_0x7e5c('0x12')](_0x7e5c('0x1e'),_0xa796d6,JSON['stringify'](_0x2fb8e0));_0x307b31(_0x2fb8e0);})[_0x7e5c('0x19')](function(_0x269133){logger[_0x7e5c('0x15')]('CreateAttachment',_0x269133[_0x7e5c('0x17')],_0xa796d6);_0x1a4a9b(_0x49de03[_0x7e5c('0x15')](0x1f4,_0x269133[_0x7e5c('0x17')]));});});};
\ No newline at end of file
+var _0x4708=['body','options','raw','info','CreateAttachment','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','create'];(function(_0x1c3370,_0xf617e8){var _0xa9b358=function(_0x39cb44){while(--_0x39cb44){_0x1c3370['push'](_0x1c3370['shift']());}};_0xa9b358(++_0xf617e8);}(_0x4708,0xa7));var _0x8470=function(_0x20f369,_0x3de066){_0x20f369=_0x20f369-0x0;var _0x3875a7=_0x4708[_0x20f369];return _0x3875a7;};'use strict';var _=require(_0x8470('0x0'));var util=require(_0x8470('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8470('0x2'));var db=require(_0x8470('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8470('0x4'))(_0x8470('0x5'));var config=require(_0x8470('0x6'));var jayson=require(_0x8470('0x7'));var client=jayson[_0x8470('0x8')][_0x8470('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35934b,_0x1b3db1,_0x29fa35){return new BPromise(function(_0xe4f518,_0x50d1cf){return client[_0x8470('0xa')](_0x35934b,_0x29fa35)[_0x8470('0xb')](function(_0x22682f){logger['info'](_0x8470('0xc'),_0x1b3db1,'request\x20sent');logger[_0x8470('0xd')](_0x8470('0xe'),_0x1b3db1,_0x8470('0xf'),JSON[_0x8470('0x10')](_0x22682f));if(_0x22682f[_0x8470('0x11')]){if(_0x22682f['error']['code']===0x1f4){logger[_0x8470('0x11')](_0x8470('0xc'),_0x1b3db1,_0x22682f['error'][_0x8470('0x12')]);return _0x50d1cf(_0x22682f[_0x8470('0x11')][_0x8470('0x12')]);}logger['error'](_0x8470('0xc'),_0x1b3db1,_0x22682f[_0x8470('0x11')][_0x8470('0x12')]);return _0xe4f518(_0x22682f[_0x8470('0x11')][_0x8470('0x12')]);}else{logger['info'](_0x8470('0xc'),_0x1b3db1,'request\x20sent');_0xe4f518(_0x22682f[_0x8470('0x13')][_0x8470('0x12')]);}})[_0x8470('0x14')](function(_0x15a230){logger[_0x8470('0x11')](_0x8470('0xc'),_0x1b3db1,_0x15a230);_0x50d1cf(_0x15a230);});});}exports['CreateAttachment']=function(_0xad5348){var _0x1dce85=this;return new Promise(function(_0x43966d,_0x5afd50){return db['Attachment'][_0x8470('0x15')](_0xad5348[_0x8470('0x16')],{'raw':_0xad5348[_0x8470('0x17')]?_0xad5348[_0x8470('0x17')][_0x8470('0x18')]===undefined?!![]:![]:!![]})[_0x8470('0xb')](function(_0x5e0ee0){logger[_0x8470('0x19')](_0x8470('0x1a'),_0xad5348);logger[_0x8470('0xd')](_0x8470('0x1a'),_0xad5348,JSON[_0x8470('0x10')](_0x5e0ee0));_0x43966d(_0x5e0ee0);})[_0x8470('0x14')](function(_0x46c8b8){logger[_0x8470('0x11')](_0x8470('0x1a'),_0x46c8b8[_0x8470('0x12')],_0xad5348);_0x5afd50(_0x1dce85['error'](0x1f4,_0x46c8b8[_0x8470('0x12')]));});});};
\ No newline at end of file
index e2f53b4..563f151 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6c6f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','/:id/download','download','diskStorage','root','server/files/attachments/','format','%s-%s','now','originalname','replace','post','single','file','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x23bc85,_0x19addc){var _0x177dfd=function(_0x134ab5){while(--_0x134ab5){_0x23bc85['push'](_0x23bc85['shift']());}};_0x177dfd(++_0x19addc);}(_0x6c6f,0x17a));var _0xf6c6=function(_0x3803ab,_0x348842){_0x3803ab=_0x3803ab-0x0;var _0x3637d0=_0x6c6f[_0x3803ab];return _0x3637d0;};'use strict';var multer=require(_0xf6c6('0x0'));var util=require(_0xf6c6('0x1'));var path=require(_0xf6c6('0x2'));var timeout=require(_0xf6c6('0x3'));var express=require(_0xf6c6('0x4'));var router=express[_0xf6c6('0x5')]();var auth=require(_0xf6c6('0x6'));var interaction=require(_0xf6c6('0x7'));var config=require(_0xf6c6('0x8'));var controller=require(_0xf6c6('0x9'));router[_0xf6c6('0xa')]('/',auth['isAuthenticated'](),controller[_0xf6c6('0xb')]);router['get']('/:id',auth[_0xf6c6('0xc')](),controller['show']);router[_0xf6c6('0xa')](_0xf6c6('0xd'),auth[_0xf6c6('0xc')](),controller[_0xf6c6('0xe')]);var upload=multer({'storage':multer[_0xf6c6('0xf')]({'destination':function(_0x4d2413,_0x19a91f,_0x2ff1c1){_0x2ff1c1(null,path['join'](config[_0xf6c6('0x10')],_0xf6c6('0x11')));},'filename':function(_0x278f23,_0x4e34e5,_0x42338f){_0x42338f(null,util[_0xf6c6('0x12')](_0xf6c6('0x13'),Date[_0xf6c6('0x14')](),_0x4e34e5[_0xf6c6('0x15')][_0xf6c6('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf6c6('0x17')]('/',upload[_0xf6c6('0x18')](_0xf6c6('0x19')),controller[_0xf6c6('0x1a')]);router['put'](_0xf6c6('0x1b'),auth[_0xf6c6('0xc')](),controller[_0xf6c6('0x1c')]);router[_0xf6c6('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0xf6c6('0x1e')]);module[_0xf6c6('0x1f')]=router;
\ No newline at end of file
+var _0xf4eb=['file','create','put','delete','exports','multer','Router','../../config/environment','./attachment.controller','get','isAuthenticated','index','/:id','show','download','diskStorage','join','format','now','post','single'];(function(_0x444860,_0x2af5bf){var _0x402e2b=function(_0xfc18e2){while(--_0xfc18e2){_0x444860['push'](_0x444860['shift']());}};_0x402e2b(++_0x2af5bf);}(_0xf4eb,0xec));var _0xbf4e=function(_0x1c6f02,_0x28d326){_0x1c6f02=_0x1c6f02-0x0;var _0x2b9224=_0xf4eb[_0x1c6f02];return _0x2b9224;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf4e('0x1')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbf4e('0x2'));var controller=require(_0xbf4e('0x3'));router[_0xbf4e('0x4')]('/',auth[_0xbf4e('0x5')](),controller[_0xbf4e('0x6')]);router[_0xbf4e('0x4')](_0xbf4e('0x7'),auth['isAuthenticated'](),controller[_0xbf4e('0x8')]);router['get']('/:id/download',auth[_0xbf4e('0x5')](),controller[_0xbf4e('0x9')]);var upload=multer({'storage':multer[_0xbf4e('0xa')]({'destination':function(_0xc86f04,_0x5da823,_0x22668b){_0x22668b(null,path[_0xbf4e('0xb')](config['root'],'server/files/attachments/'));},'filename':function(_0x7dfb74,_0x5a8397,_0x448788){_0x448788(null,util[_0xbf4e('0xc')]('%s-%s',Date[_0xbf4e('0xd')](),_0x5a8397['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbf4e('0xe')]('/',upload[_0xbf4e('0xf')](_0xbf4e('0x10')),controller[_0xbf4e('0x11')]);router[_0xbf4e('0x12')](_0xbf4e('0x7'),auth['isAuthenticated'](),controller['update']);router[_0xbf4e('0x13')](_0xbf4e('0x7'),auth[_0xbf4e('0x5')](),controller['destroy']);module[_0xbf4e('0x14')]=router;
\ No newline at end of file
index 6626816..0be53cb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2028=['email','callback','authenticate','/login','use','clientID','secret','callbackURL','User','find','map','emails','value','admin','user','agent','then','User\x20email\x20not\x20found!','catch','passport-google-oauth20','Strategy','../../mysqldb','../../components/auth/service','signToken','login','google','profile'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x2028,0x64));var _0x8202=function(_0x25bd5d,_0x3bcb0f){_0x25bd5d=_0x25bd5d-0x0;var _0xa59e30=_0x2028[_0x25bd5d];return _0xa59e30;};'use strict';var _=require('lodash');var passport=require('passport');var GoogleStrategy=require(_0x8202('0x0'))[_0x8202('0x1')];var db=require(_0x8202('0x2'))['db'];var config=require('../../config/environment');var signToken=require(_0x8202('0x3'))[_0x8202('0x4')];exports[_0x8202('0x5')]=passport['authenticate'](_0x8202('0x6'),{'failureRedirect':'/login','scope':[_0x8202('0x7'),_0x8202('0x8')],'session':![]});exports[_0x8202('0x9')]=passport[_0x8202('0xa')]('google',{'failureRedirect':_0x8202('0xb'),'session':![]});passport[_0x8202('0xc')](new GoogleStrategy({'clientID':config[_0x8202('0x6')]?config[_0x8202('0x6')][_0x8202('0xd')]:'id','clientSecret':config[_0x8202('0x6')]?config[_0x8202('0x6')]['clientSecret']:_0x8202('0xe'),'callbackURL':config[_0x8202('0x6')]?config[_0x8202('0x6')][_0x8202('0xf')]:''},function(_0x46589d,_0x362211,_0x3075d7,_0xd6fe9){db[_0x8202('0x10')][_0x8202('0x11')]({'where':{'email':_[_0x8202('0x12')](_0x3075d7[_0x8202('0x13')],_0x8202('0x14')),'role':{'$or':[_0x8202('0x15'),_0x8202('0x16'),_0x8202('0x17')]}}})[_0x8202('0x18')](function(_0x54c605){if(_0x54c605){return _0xd6fe9(null,_0x54c605);}_0xd6fe9(_0x8202('0x19'));})[_0x8202('0x1a')](function(_0x294b60){_0xd6fe9(_0x294b60);});}));
\ No newline at end of file
+var _0x10b8=['google','/login','profile','email','callback','use','clientID','clientSecret','secret','User','find','emails','admin','user','agent','then','User\x20email\x20not\x20found!','passport','../../mysqldb','../../config/environment','../../components/auth/service','signToken','authenticate'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x10b8,0x198));var _0x810b=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x10b8[_0xda464c];return _0x19e222;};'use strict';var _=require('lodash');var passport=require(_0x810b('0x0'));var GoogleStrategy=require('passport-google-oauth20')['Strategy'];var db=require(_0x810b('0x1'))['db'];var config=require(_0x810b('0x2'));var signToken=require(_0x810b('0x3'))[_0x810b('0x4')];exports['login']=passport[_0x810b('0x5')](_0x810b('0x6'),{'failureRedirect':_0x810b('0x7'),'scope':[_0x810b('0x8'),_0x810b('0x9')],'session':![]});exports[_0x810b('0xa')]=passport[_0x810b('0x5')]('google',{'failureRedirect':_0x810b('0x7'),'session':![]});passport[_0x810b('0xb')](new GoogleStrategy({'clientID':config[_0x810b('0x6')]?config[_0x810b('0x6')][_0x810b('0xc')]:'id','clientSecret':config[_0x810b('0x6')]?config[_0x810b('0x6')][_0x810b('0xd')]:_0x810b('0xe'),'callbackURL':config['google']?config[_0x810b('0x6')]['callbackURL']:''},function(_0x2ca7fd,_0x39949f,_0x51328d,_0x2aa67c){db[_0x810b('0xf')][_0x810b('0x10')]({'where':{'email':_['map'](_0x51328d[_0x810b('0x11')],'value'),'role':{'$or':[_0x810b('0x12'),_0x810b('0x13'),_0x810b('0x14')]}}})[_0x810b('0x15')](function(_0x2965d3){if(_0x2965d3){return _0x2aa67c(null,_0x2965d3);}_0x2aa67c(_0x810b('0x16'));})['catch'](function(_0x45e425){_0x2aa67c(_0x45e425);});}));
\ No newline at end of file
index 4351b1c..f177083 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe837=['setTokenCookie','get','/callback','exports','express','passport','Router','./authGoogle.controller','../../components/auth/service'];(function(_0x1344d6,_0x2181e6){var _0xf45b24=function(_0x2d90c1){while(--_0x2d90c1){_0x1344d6['push'](_0x1344d6['shift']());}};_0xf45b24(++_0x2181e6);}(_0xe837,0x124));var _0x7e83=function(_0x2c5340,_0x5c86e5){_0x2c5340=_0x2c5340-0x0;var _0x3c505e=_0xe837[_0x2c5340];return _0x3c505e;};'use strict';var express=require(_0x7e83('0x0'));var passport=require(_0x7e83('0x1'));var router=express[_0x7e83('0x2')]();var controller=require(_0x7e83('0x3'));var setTokenCookie=require(_0x7e83('0x4'))[_0x7e83('0x5')];router[_0x7e83('0x6')]('/',controller['login']);router[_0x7e83('0x6')](_0x7e83('0x7'),controller['callback'],setTokenCookie);module[_0x7e83('0x8')]=router;
\ No newline at end of file
+var _0xf8e4=['/callback','callback','express','passport','Router','./authGoogle.controller','../../components/auth/service','setTokenCookie'];(function(_0x5c1edb,_0x4c5c7f){var _0x3ee8b9=function(_0x4d1509){while(--_0x4d1509){_0x5c1edb['push'](_0x5c1edb['shift']());}};_0x3ee8b9(++_0x4c5c7f);}(_0xf8e4,0xc2));var _0x4f8e=function(_0x5bb4e8,_0x44b756){_0x5bb4e8=_0x5bb4e8-0x0;var _0x2a86f2=_0xf8e4[_0x5bb4e8];return _0x2a86f2;};'use strict';var express=require(_0x4f8e('0x0'));var passport=require(_0x4f8e('0x1'));var router=express[_0x4f8e('0x2')]();var controller=require(_0x4f8e('0x3'));var setTokenCookie=require(_0x4f8e('0x4'))[_0x4f8e('0x5')];router['get']('/',controller['login']);router['get'](_0x4f8e('0x6'),controller[_0x4f8e('0x7')],setTokenCookie);module['exports']=router;
\ No newline at end of file
index 81defc8..ed649eb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc7da=['agents','Maximum\x20login\x20has\x20been\x20reached','catch','find','user','name','This\x20name\x20is\x20not\x20registered','This\x20password\x20is\x20not\x20correct','MailAccount','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','port','secure','authentication','auth','format','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','status','send','login','authenticate','local','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','resetPasswordToken','now','save','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','http://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','password','resetPasswordExpires','Password\x20reset!','use','util','passport','passport-local','Strategy','bluebird','jayson/promise','lodash','../../config/logger','api','randomstring','../../mysqldb','../../components/auth/service','signToken','client','http','role','User','agent','../../config/license/util','getLicense','then'];(function(_0x4a350a,_0x5b65b1){var _0x1fdf5b=function(_0x2e1ce7){while(--_0x2e1ce7){_0x4a350a['push'](_0x4a350a['shift']());}};_0x1fdf5b(++_0x5b65b1);}(_0xc7da,0x16c));var _0xac7d=function(_0x52ecee,_0x386abe){_0x52ecee=_0x52ecee-0x0;var _0x381513=_0xc7da[_0x52ecee];return _0x381513;};'use strict';var util=require(_0xac7d('0x0'));var passport=require(_0xac7d('0x1'));var LocalStrategy=require(_0xac7d('0x2'))[_0xac7d('0x3')];var BPromise=require(_0xac7d('0x4'));var jayson=require(_0xac7d('0x5'));var _=require(_0xac7d('0x6'));var logger=require(_0xac7d('0x7'))(_0xac7d('0x8'));var rs=require(_0xac7d('0x9'));var db=require(_0xac7d('0xa'))['db'];var signToken=require(_0xac7d('0xb'))[_0xac7d('0xc')];var client=jayson[_0xac7d('0xd')][_0xac7d('0xe')]({'port':0x232b});var getLicense=function(_0x35e356){return new BPromise(function(_0x274a0a,_0x4010f3){var _0x1d9958=0x0;_0x35e356[_0xac7d('0xf')]!=='agent'&&_0x274a0a(_0x35e356);return db[_0xac7d('0x10')]['count']({'where':{'role':_0xac7d('0x11'),'online':!![],'id':{'$ne':_0x35e356['id']}}})['then'](function(_0x5c9045){_0x1d9958=_0x5c9045;return require(_0xac7d('0x12'))[_0xac7d('0x13')]();})[_0xac7d('0x14')](function(_0x4abe18){if(_0x4abe18&&_0x4abe18[_0xac7d('0x15')]&&_0x1d9958>=_0x4abe18[_0xac7d('0x15')]){return _0x4010f3({'message':_0xac7d('0x16')});}return _0x274a0a(_0x35e356);})[_0xac7d('0x17')](function(_0x43c854){return _0x4010f3(_0x43c854);});});};function localAuthenticate(_0x2c97af,_0x15a0fe,_0x5c94a4,_0x202ba9){_0x2c97af[_0xac7d('0x18')]({'where':{'name':_0x15a0fe,'role':{'$or':['admin',_0xac7d('0x19'),_0xac7d('0x11')]}}})[_0xac7d('0x14')](function(_0x183e12){if(!_0x183e12||_0x183e12&&_0x183e12[_0xac7d('0x1a')]!==_0x15a0fe){return _0x202ba9(null,![],{'message':_0xac7d('0x1b')});}return getLicense(_0x183e12);})['then'](function(_0x3176de){_0x3176de['authenticate'](_0x5c94a4,function(_0x3c339b,_0x43a538){if(_0x3c339b){return _0x202ba9(_0x3c339b);}if(!_0x43a538){return _0x202ba9(null,![],{'message':_0xac7d('0x1c')});}else{return _0x202ba9(null,_0x3176de);}});})[_0xac7d('0x17')](function(_0x3f338f){_0x202ba9(_0x3f338f);});}function sendServiceMail(_0x3cda2f){return db[_0xac7d('0x1d')]['find']({'where':{'service':!![]},'attributes':['id',_0xac7d('0x1a'),_0xac7d('0x1e')],'include':[{'model':db[_0xac7d('0x1f')],'as':'Smtp'}]})[_0xac7d('0x14')](function(_0x16d7a2){if(!_0x16d7a2){throw new Error(_0xac7d('0x20'));}var _0x450772={'tls':{'rejectUnauthorized':![]}};if(_0x16d7a2[_0xac7d('0x21')][_0xac7d('0x22')]){_0x450772['service']=_0x16d7a2['Smtp'][_0xac7d('0x22')];}else{_0x450772[_0xac7d('0x23')]=_0x16d7a2['Smtp'][_0xac7d('0x23')];_0x450772[_0xac7d('0x24')]=_0x16d7a2['Smtp'][_0xac7d('0x24')];_0x450772[_0xac7d('0x25')]=_0x16d7a2[_0xac7d('0x21')][_0xac7d('0x25')];}if(_0x16d7a2[_0xac7d('0x21')][_0xac7d('0x26')]){_0x450772[_0xac7d('0x27')]={'user':_0x16d7a2[_0xac7d('0x21')]['user'],'pass':_0x16d7a2[_0xac7d('0x21')]['pass']};}var _0x1029b3={'account':_0x450772,'message':_['merge']({'from':util[_0xac7d('0x28')]('\x22%s\x22\x20<%s>',_0x16d7a2[_0xac7d('0x1a')],_0x16d7a2[_0xac7d('0x1e')]||_0x16d7a2[_0xac7d('0x21')][_0xac7d('0x19')])},_0x3cda2f)};return client['request'](_0xac7d('0x29'),_0x1029b3);})[_0xac7d('0x14')](function(_0x1f33d7){if(_0x1f33d7['error']){throw new Error(util[_0xac7d('0x28')](_0xac7d('0x2a'),_0x1f33d7[_0xac7d('0x2b')][_0xac7d('0x2c')]||JSON[_0xac7d('0x2d')](_0x1f33d7[_0xac7d('0x2b')])));}return!![];});}function handleError(_0x23a1f0,_0x19010d,_0x1877c3){return _0x23a1f0[_0xac7d('0x2e')](_0x19010d||0x1f4)[_0xac7d('0x2f')]({'message':_0x1877c3?_0x1877c3[_0xac7d('0x2c')]||_0x1877c3:''});}exports[_0xac7d('0x30')]=function(_0xdc9214,_0xfc489a,_0x217c19){passport[_0xac7d('0x31')](_0xac7d('0x32'),function(_0x57694f,_0x377303,_0x513a31){var _0x1a7c23=_0x57694f||_0x513a31;if(_0x1a7c23){return handleError(_0xfc489a,0x191,_0x1a7c23);}if(!_0x377303){return handleError(_0xfc489a,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}var _0x307a1b=signToken(_0x377303['id'],_0x377303[_0xac7d('0xf')]);_0xfc489a[_0xac7d('0x33')]({'id':_0x377303['id'],'token':_0x307a1b,'statusCall':'','isAlreadyLogged':_0x377303[_0xac7d('0x34')]});})(_0xdc9214,_0xfc489a,_0x217c19);};exports[_0xac7d('0x35')]=function(_0x5a4091,_0x550403,_0x303a1f){if(!_0x5a4091[_0xac7d('0x36')][_0xac7d('0x1e')]){return handleError(_0x550403,0x1f4,{'message':_0xac7d('0x37')});}var _0x168562=rs[_0xac7d('0x38')]();_0x5a4091[_0xac7d('0x36')][_0xac7d('0x1e')]=_0x5a4091[_0xac7d('0x36')][_0xac7d('0x1e')][_0xac7d('0x39')]()[_0xac7d('0x3a')]();return db[_0xac7d('0x10')][_0xac7d('0x18')]({'where':{'email':_0x5a4091[_0xac7d('0x36')][_0xac7d('0x1e')]}})[_0xac7d('0x14')](function(_0x3267da){if(!_0x3267da){throw new Error(_0xac7d('0x3b'));}_0x3267da[_0xac7d('0x3c')]=_0x168562;_0x3267da['resetPasswordExpires']=Date[_0xac7d('0x3d')]()+0x36ee80;return _0x3267da[_0xac7d('0x3e')]();})[_0xac7d('0x14')](function(){return sendServiceMail({'to':_0x5a4091[_0xac7d('0x36')][_0xac7d('0x1e')],'subject':_0xac7d('0x3f'),'text':_0xac7d('0x40')+_0xac7d('0x41')+_0xac7d('0x42')+_0x5a4091['headers']['host']+_0xac7d('0x43')+_0x168562+'\x0a\x0a'+_0xac7d('0x44')});})['then'](function(){_0x550403[_0xac7d('0x2e')](0xc8)['send']({'message':'Reset\x20Email\x20sent!'});})[_0xac7d('0x17')](function(_0x5a8a6f){return handleError(_0x550403,0x1f4,_0x5a8a6f);});};exports[_0xac7d('0x45')]=function(_0x546bec,_0x165d97,_0x2bca29){return db[_0xac7d('0x10')][_0xac7d('0x18')]({'where':{'resetPasswordToken':_0x546bec[_0xac7d('0x46')][_0xac7d('0x47')],'resetPasswordExpires':{'$gt':Date[_0xac7d('0x3d')]()}}})[_0xac7d('0x14')](function(_0xf496ff){if(!_0xf496ff){throw new Error(_0xac7d('0x48'));}_0xf496ff['password']=_0x546bec[_0xac7d('0x36')][_0xac7d('0x49')];_0xf496ff[_0xac7d('0x3c')]=null;_0xf496ff[_0xac7d('0x4a')]=null;return _0xf496ff[_0xac7d('0x3e')]();})[_0xac7d('0x14')](function(){_0x165d97[_0xac7d('0x2e')](0xc8)[_0xac7d('0x2f')]({'message':_0xac7d('0x4b')});})[_0xac7d('0x17')](function(_0x6f4cfa){return handleError(_0x165d97,0x1f4,_0x6f4cfa);});};passport[_0xac7d('0x4c')](new LocalStrategy({'usernameField':_0xac7d('0x1a'),'passwordField':_0xac7d('0x49')},function(_0x184a64,_0x226c14,_0x255614){return localAuthenticate(db[_0xac7d('0x10')],_0x184a64,_0x226c14,_0x255614);}));
\ No newline at end of file
+var _0x0bf5=['find','admin','user','name','This\x20name\x20is\x20not\x20registered','authenticate','This\x20password\x20is\x20not\x20correct','MailAccount','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','port','secure','auth','pass','format','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','login','local','json','online','body','trim','This\x20email\x20is\x20not\x20registered.','resetPasswordToken','resetPasswordExpires','save','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','http://','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','now','password','send','Password\x20reset!','use','util','passport','passport-local','Strategy','bluebird','lodash','../../config/logger','api','randomstring','../../mysqldb','../../components/auth/service','signToken','client','role','agent','User','count','then','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','catch'];(function(_0x183d49,_0xab684d){var _0x12c066=function(_0x59296a){while(--_0x59296a){_0x183d49['push'](_0x183d49['shift']());}};_0x12c066(++_0xab684d);}(_0x0bf5,0x111));var _0x50bf=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x0bf5[_0x11005e];return _0x29338f;};'use strict';var util=require(_0x50bf('0x0'));var passport=require(_0x50bf('0x1'));var LocalStrategy=require(_0x50bf('0x2'))[_0x50bf('0x3')];var BPromise=require(_0x50bf('0x4'));var jayson=require('jayson/promise');var _=require(_0x50bf('0x5'));var logger=require(_0x50bf('0x6'))(_0x50bf('0x7'));var rs=require(_0x50bf('0x8'));var db=require(_0x50bf('0x9'))['db'];var signToken=require(_0x50bf('0xa'))[_0x50bf('0xb')];var client=jayson[_0x50bf('0xc')]['http']({'port':0x232b});var getLicense=function(_0x1b4955){return new BPromise(function(_0x452706,_0x33b7cd){var _0x2274bb=0x0;_0x1b4955[_0x50bf('0xd')]!==_0x50bf('0xe')&&_0x452706(_0x1b4955);return db[_0x50bf('0xf')][_0x50bf('0x10')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x1b4955['id']}}})[_0x50bf('0x11')](function(_0x231df3){_0x2274bb=_0x231df3;return require(_0x50bf('0x12'))[_0x50bf('0x13')]();})[_0x50bf('0x11')](function(_0x44849c){if(_0x44849c&&_0x44849c['agents']&&_0x2274bb>=_0x44849c[_0x50bf('0x14')]){return _0x33b7cd({'message':_0x50bf('0x15')});}return _0x452706(_0x1b4955);})[_0x50bf('0x16')](function(_0x35be8c){return _0x33b7cd(_0x35be8c);});});};function localAuthenticate(_0x34a47c,_0x32e339,_0x58aced,_0x2c9867){_0x34a47c[_0x50bf('0x17')]({'where':{'name':_0x32e339,'role':{'$or':[_0x50bf('0x18'),_0x50bf('0x19'),'agent']}}})[_0x50bf('0x11')](function(_0x20876f){if(!_0x20876f||_0x20876f&&_0x20876f[_0x50bf('0x1a')]!==_0x32e339){return _0x2c9867(null,![],{'message':_0x50bf('0x1b')});}return getLicense(_0x20876f);})[_0x50bf('0x11')](function(_0x3fe28f){_0x3fe28f[_0x50bf('0x1c')](_0x58aced,function(_0x4fec39,_0xd9889c){if(_0x4fec39){return _0x2c9867(_0x4fec39);}if(!_0xd9889c){return _0x2c9867(null,![],{'message':_0x50bf('0x1d')});}else{return _0x2c9867(null,_0x3fe28f);}});})[_0x50bf('0x16')](function(_0x524d85){_0x2c9867(_0x524d85);});}function sendServiceMail(_0x3deca2){return db[_0x50bf('0x1e')][_0x50bf('0x17')]({'where':{'service':!![]},'attributes':['id',_0x50bf('0x1a'),_0x50bf('0x1f')],'include':[{'model':db[_0x50bf('0x20')],'as':'Smtp'}]})['then'](function(_0x4c20a0){if(!_0x4c20a0){throw new Error(_0x50bf('0x21'));}var _0x4f3e19={'tls':{'rejectUnauthorized':![]}};if(_0x4c20a0[_0x50bf('0x22')][_0x50bf('0x23')]){_0x4f3e19['service']=_0x4c20a0[_0x50bf('0x22')][_0x50bf('0x23')];}else{_0x4f3e19[_0x50bf('0x24')]=_0x4c20a0[_0x50bf('0x22')][_0x50bf('0x24')];_0x4f3e19[_0x50bf('0x25')]=_0x4c20a0['Smtp']['port'];_0x4f3e19[_0x50bf('0x26')]=_0x4c20a0[_0x50bf('0x22')][_0x50bf('0x26')];}if(_0x4c20a0[_0x50bf('0x22')]['authentication']){_0x4f3e19[_0x50bf('0x27')]={'user':_0x4c20a0['Smtp'][_0x50bf('0x19')],'pass':_0x4c20a0[_0x50bf('0x22')][_0x50bf('0x28')]};}var _0x4a01da={'account':_0x4f3e19,'message':_['merge']({'from':util[_0x50bf('0x29')]('\x22%s\x22\x20<%s>',_0x4c20a0['name'],_0x4c20a0[_0x50bf('0x1f')]||_0x4c20a0[_0x50bf('0x22')][_0x50bf('0x19')])},_0x3deca2)};return client[_0x50bf('0x2a')](_0x50bf('0x2b'),_0x4a01da);})[_0x50bf('0x11')](function(_0x14025d){if(_0x14025d[_0x50bf('0x2c')]){throw new Error(util['format'](_0x50bf('0x2d'),_0x14025d['error'][_0x50bf('0x2e')]||JSON[_0x50bf('0x2f')](_0x14025d[_0x50bf('0x2c')])));}return!![];});}function handleError(_0x2c551c,_0x1b61ce,_0x49966f){return _0x2c551c[_0x50bf('0x30')](_0x1b61ce||0x1f4)['send']({'message':_0x49966f?_0x49966f[_0x50bf('0x2e')]||_0x49966f:''});}exports[_0x50bf('0x31')]=function(_0x176a03,_0x3c80b7,_0x412f7c){passport[_0x50bf('0x1c')](_0x50bf('0x32'),function(_0x2e0b21,_0x4be4ac,_0x90bb76){var _0x4f161b=_0x2e0b21||_0x90bb76;if(_0x4f161b){return handleError(_0x3c80b7,0x191,_0x4f161b);}if(!_0x4be4ac){return handleError(_0x3c80b7,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}var _0x35a737=signToken(_0x4be4ac['id'],_0x4be4ac['role']);_0x3c80b7[_0x50bf('0x33')]({'id':_0x4be4ac['id'],'token':_0x35a737,'statusCall':'','isAlreadyLogged':_0x4be4ac[_0x50bf('0x34')]});})(_0x176a03,_0x3c80b7,_0x412f7c);};exports['forgot']=function(_0x19e6fb,_0x342f21,_0x464f06){if(!_0x19e6fb[_0x50bf('0x35')][_0x50bf('0x1f')]){return handleError(_0x342f21,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x86d452=rs['generate']();_0x19e6fb['body'][_0x50bf('0x1f')]=_0x19e6fb['body']['email'][_0x50bf('0x36')]()['toLowerCase']();return db[_0x50bf('0xf')][_0x50bf('0x17')]({'where':{'email':_0x19e6fb[_0x50bf('0x35')]['email']}})['then'](function(_0x1a1f7f){if(!_0x1a1f7f){throw new Error(_0x50bf('0x37'));}_0x1a1f7f[_0x50bf('0x38')]=_0x86d452;_0x1a1f7f[_0x50bf('0x39')]=Date['now']()+0x36ee80;return _0x1a1f7f[_0x50bf('0x3a')]();})[_0x50bf('0x11')](function(){return sendServiceMail({'to':_0x19e6fb[_0x50bf('0x35')]['email'],'subject':_0x50bf('0x3b'),'text':_0x50bf('0x3c')+_0x50bf('0x3d')+_0x50bf('0x3e')+_0x19e6fb[_0x50bf('0x3f')][_0x50bf('0x24')]+'/reset/'+_0x86d452+'\x0a\x0a'+_0x50bf('0x40')});})['then'](function(){_0x342f21[_0x50bf('0x30')](0xc8)['send']({'message':_0x50bf('0x41')});})[_0x50bf('0x16')](function(_0x3125d9){return handleError(_0x342f21,0x1f4,_0x3125d9);});};exports[_0x50bf('0x42')]=function(_0x41fd43,_0x2ed228,_0x311fe1){return db[_0x50bf('0xf')][_0x50bf('0x17')]({'where':{'resetPasswordToken':_0x41fd43[_0x50bf('0x43')][_0x50bf('0x44')],'resetPasswordExpires':{'$gt':Date[_0x50bf('0x45')]()}}})['then'](function(_0x56cb9e){if(!_0x56cb9e){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}_0x56cb9e[_0x50bf('0x46')]=_0x41fd43['body'][_0x50bf('0x46')];_0x56cb9e[_0x50bf('0x38')]=null;_0x56cb9e[_0x50bf('0x39')]=null;return _0x56cb9e[_0x50bf('0x3a')]();})[_0x50bf('0x11')](function(){_0x2ed228[_0x50bf('0x30')](0xc8)[_0x50bf('0x47')]({'message':_0x50bf('0x48')});})[_0x50bf('0x16')](function(_0x2d42ea){return handleError(_0x2ed228,0x1f4,_0x2d42ea);});};passport[_0x50bf('0x49')](new LocalStrategy({'usernameField':_0x50bf('0x1a'),'passwordField':_0x50bf('0x46')},function(_0x422d25,_0x12592c,_0x2dab71){return localAuthenticate(db[_0x50bf('0xf')],_0x422d25,_0x12592c,_0x2dab71);}));
\ No newline at end of file
index 1ec2622..559f843 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x254c=['/forgot','forgot','reset','express','post','login'];(function(_0x48d99c,_0x54e59b){var _0x24e69b=function(_0x3f2ceb){while(--_0x3f2ceb){_0x48d99c['push'](_0x48d99c['shift']());}};_0x24e69b(++_0x54e59b);}(_0x254c,0x129));var _0xc254=function(_0x235a35,_0x1b9d14){_0x235a35=_0x235a35-0x0;var _0x228f69=_0x254c[_0x235a35];return _0x228f69;};'use strict';var express=require(_0xc254('0x0'));var router=express['Router']();var controller=require('./authLocal.controller');router[_0xc254('0x1')]('/',controller[_0xc254('0x2')]);router['post'](_0xc254('0x3'),controller[_0xc254('0x4')]);router[_0xc254('0x1')]('/reset/:token',controller[_0xc254('0x5')]);module['exports']=router;
\ No newline at end of file
+var _0x00d8=['forgot','/reset/:token','reset','exports','express','post','login','/forgot'];(function(_0x18cd94,_0x4ce177){var _0x289b6a=function(_0x504477){while(--_0x504477){_0x18cd94['push'](_0x18cd94['shift']());}};_0x289b6a(++_0x4ce177);}(_0x00d8,0xe4));var _0x800d=function(_0x558305,_0x54c904){_0x558305=_0x558305-0x0;var _0x4b8e64=_0x00d8[_0x558305];return _0x4b8e64;};'use strict';var express=require(_0x800d('0x0'));var router=express['Router']();var controller=require('./authLocal.controller');router[_0x800d('0x1')]('/',controller[_0x800d('0x2')]);router[_0x800d('0x1')](_0x800d('0x3'),controller[_0x800d('0x4')]);router[_0x800d('0x1')](_0x800d('0x5'),controller[_0x800d('0x6')]);module[_0x800d('0x7')]=router;
\ No newline at end of file
index 80649d0..f90ebbb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaa56=['STRING','BOOLEAN','exports'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xaa56,0x1ac));var _0x6aa5=function(_0x42e707,_0x52b50b){_0x42e707=_0x42e707-0x0;var _0x70f3e7=_0xaa56[_0x42e707];return _0x70f3e7;};'use strict';var Sequelize=require('sequelize');module[_0x6aa5('0x0')]={'name':{'type':Sequelize[_0x6aa5('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6aa5('0x1')]},'status':{'type':Sequelize[_0x6aa5('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}};
\ No newline at end of file
+var _0x5942=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0xc83285,_0x3860f3){var _0x59ef36=function(_0x375eaf){while(--_0x375eaf){_0xc83285['push'](_0xc83285['shift']());}};_0x59ef36(++_0x3860f3);}(_0x5942,0x16a));var _0x2594=function(_0x235ebb,_0x57d673){_0x235ebb=_0x235ebb-0x0;var _0x55ee0d=_0x5942[_0x235ebb];return _0x55ee0d;};'use strict';var Sequelize=require(_0x2594('0x0'));module[_0x2594('0x1')]={'name':{'type':Sequelize[_0x2594('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x2594('0x2')]},'description':{'type':Sequelize[_0x2594('0x2')]},'status':{'type':Sequelize[_0x2594('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x2594('0x4')],'defaultValue':0xa}};
\ No newline at end of file
index 17bfac6..19ccc76 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfc4b=['where','pick','filter','merge','map','type','key','VIRTUAL','field','options','Automation','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','update','body','addConditions','Condition','ids','omit','hasOwnProperty','getConditions','addActions','Action','getActions','findOne','html-pdf','rimraf','zip-dir','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','reject','save','then','sendStatus','error','name','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort'];(function(_0x1fc18b,_0x13d27d){var _0x16a351=function(_0x54a799){while(--_0x54a799){_0x1fc18b['push'](_0x1fc18b['shift']());}};_0x16a351(++_0x13d27d);}(_0xfc4b,0x1b6));var _0xbfc4=function(_0x468510,_0x480a78){_0x468510=_0x468510-0x0;var _0xc9efee=_0xfc4b[_0x468510];return _0xc9efee;};'use strict';var pdf=require(_0xbfc4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbfc4('0x1'));var zipdir=require(_0xbfc4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbfc4('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbfc4('0x4'));var path=require(_0xbfc4('0x5'));var sox=require('sox');var csv=require(_0xbfc4('0x6'));var ejs=require(_0xbfc4('0x7'));var fs=require('fs');var _=require(_0xbfc4('0x8'));var squel=require(_0xbfc4('0x9'));var crypto=require(_0xbfc4('0xa'));var jsforce=require(_0xbfc4('0xb'));var deskjs=require(_0xbfc4('0xc'));var toCsv=require(_0xbfc4('0x6'));var querystring=require(_0xbfc4('0xd'));var Papa=require(_0xbfc4('0xe'));var authService=require(_0xbfc4('0xf'));var hardwareService=require(_0xbfc4('0x10'));var Redis=require(_0xbfc4('0x11'));var qs=require(_0xbfc4('0x12'));var logger=require(_0xbfc4('0x13'))(_0xbfc4('0x14'));var utils=require('../../config/utils');var config=require(_0xbfc4('0x15'));var db=require(_0xbfc4('0x16'))['db'];function respondWithStatusCode(_0x4b2c28,_0xbdc291){_0xbdc291=_0xbdc291||0xcc;return function(_0x38f2c8){if(_0x38f2c8){return _0x4b2c28['sendStatus'](_0xbdc291);}return _0x4b2c28[_0xbfc4('0x17')](_0xbdc291)[_0xbfc4('0x18')]();};}function respondWithResult(_0x61bd88,_0x170cd){_0x170cd=_0x170cd||0xc8;return function(_0x178612){if(_0x178612){return _0x61bd88[_0xbfc4('0x17')](_0x170cd)['json'](_0x178612);}};}function respondWithFilteredResult(_0x15c6f9,_0x4771e2){return function(_0x470e6f){if(_0x470e6f){var _0xdb99ac=_0x470e6f[_0xbfc4('0x19')],_0x29d2ed=_0x4771e2[_0xbfc4('0x1a')],_0x14f2b0=_0x4771e2[_0xbfc4('0x1a')]+_0x4771e2[_0xbfc4('0x1b')],_0x183a8b;if(_0x14f2b0>=_0xdb99ac){_0x14f2b0=_0xdb99ac;_0x183a8b=0xc8;}else{_0x183a8b=0xce;}_0x15c6f9['status'](_0x183a8b);return _0x15c6f9[_0xbfc4('0x1c')](_0xbfc4('0x1d'),_0x29d2ed+'-'+_0x14f2b0+'/'+_0xdb99ac)[_0xbfc4('0x1e')](_0x470e6f);}return null;};}function patchUpdates(_0x3394f1){return function(_0x2196fe){try{jsonpatch['apply'](_0x2196fe,_0x3394f1,!![]);}catch(_0x436984){return BPromise[_0xbfc4('0x1f')](_0x436984);}return _0x2196fe[_0xbfc4('0x20')]();};}function saveUpdates(_0x1f35fd,_0x398a0b){return function(_0x194e5f){if(_0x194e5f){return _0x194e5f['update'](_0x1f35fd)[_0xbfc4('0x21')](function(_0x4a4070){return _0x4a4070;});}return null;};}function removeEntity(_0x4c0a12,_0xb0f9ab){return function(_0x39549f){if(_0x39549f){return _0x39549f['destroy']()['then'](function(){_0x4c0a12['status'](0xcc)[_0xbfc4('0x18')]();});}};}function handleEntityNotFound(_0x44ed03,_0x27b3ee){return function(_0x3b5693){if(!_0x3b5693){_0x44ed03[_0xbfc4('0x22')](0x194);}return _0x3b5693;};}function handleError(_0x215155,_0x375918){_0x375918=_0x375918||0x1f4;return function(_0x482b2a){logger[_0xbfc4('0x23')](_0x482b2a['stack']);if(_0x482b2a['name']){delete _0x482b2a[_0xbfc4('0x24')];}_0x215155[_0xbfc4('0x17')](_0x375918)['send'](_0x482b2a);};}exports['index']=function(_0x40706f,_0x2ead5f){var _0x1492a3={},_0x545f6c={},_0x4fefd7={'count':0x0,'rows':[]};var _0x113aa6=db['Automation']['rawAttributes'];_0x545f6c['model']=_[_0xbfc4('0x25')](_0x113aa6);_0x545f6c[_0xbfc4('0x26')]=_['keys'](_0x40706f[_0xbfc4('0x26')]);_0x545f6c[_0xbfc4('0x27')]=_[_0xbfc4('0x28')](_0x545f6c[_0xbfc4('0x29')],_0x545f6c[_0xbfc4('0x26')]);_0x1492a3[_0xbfc4('0x2a')]=_[_0xbfc4('0x28')](_0x545f6c['model'],qs['fields'](_0x40706f[_0xbfc4('0x26')][_0xbfc4('0x2b')]));_0x1492a3[_0xbfc4('0x2a')]=_0x1492a3[_0xbfc4('0x2a')][_0xbfc4('0x2c')]?_0x1492a3['attributes']:_0x545f6c[_0xbfc4('0x29')];if(!_0x40706f[_0xbfc4('0x26')]['hasOwnProperty'](_0xbfc4('0x2d'))){_0x1492a3[_0xbfc4('0x1b')]=qs[_0xbfc4('0x1b')](_0x40706f[_0xbfc4('0x26')][_0xbfc4('0x1b')]);_0x1492a3[_0xbfc4('0x1a')]=qs['offset'](_0x40706f[_0xbfc4('0x26')][_0xbfc4('0x1a')]);}_0x1492a3[_0xbfc4('0x2e')]=qs[_0xbfc4('0x2f')](_0x40706f[_0xbfc4('0x26')][_0xbfc4('0x2f')]);_0x1492a3[_0xbfc4('0x30')]=qs[_0xbfc4('0x27')](_[_0xbfc4('0x31')](_0x40706f[_0xbfc4('0x26')],_0x545f6c[_0xbfc4('0x27')]));if(_0x40706f[_0xbfc4('0x26')][_0xbfc4('0x32')]){_0x1492a3[_0xbfc4('0x30')]=_[_0xbfc4('0x33')](_0x1492a3[_0xbfc4('0x30')],{'$or':_[_0xbfc4('0x34')](_0x113aa6,function(_0x31cd51){if(_0x31cd51[_0xbfc4('0x35')][_0xbfc4('0x36')]!==_0xbfc4('0x37')){var _0x4c972b={};_0x4c972b[_0x31cd51[_0xbfc4('0x38')]]={'$like':'%'+_0x40706f['query'][_0xbfc4('0x32')]+'%'};return _0x4c972b;}})});}_0x1492a3=_[_0xbfc4('0x33')]({},_0x1492a3,_0x40706f[_0xbfc4('0x39')]);var _0x200c88={'where':_0x1492a3[_0xbfc4('0x30')]};return db[_0xbfc4('0x3a')][_0xbfc4('0x19')](_0x200c88)[_0xbfc4('0x21')](function(_0x201414){_0x4fefd7[_0xbfc4('0x19')]=_0x201414;if(_0x40706f[_0xbfc4('0x26')][_0xbfc4('0x3b')]){_0x1492a3[_0xbfc4('0x3c')]=[{'all':!![]}];}return db['Automation'][_0xbfc4('0x3d')](_0x1492a3);})[_0xbfc4('0x21')](function(_0x1c393f){_0x4fefd7[_0xbfc4('0x3e')]=_0x1c393f;return _0x4fefd7;})[_0xbfc4('0x21')](respondWithFilteredResult(_0x2ead5f,_0x1492a3))['catch'](handleError(_0x2ead5f,null));};exports[_0xbfc4('0x3f')]=function(_0x3bf912,_0x593e69){var _0x484b7b={'raw':![],'where':{'id':_0x3bf912[_0xbfc4('0x40')]['id']}},_0x769b1a={};_0x769b1a[_0xbfc4('0x29')]=_[_0xbfc4('0x25')](db[_0xbfc4('0x3a')][_0xbfc4('0x41')]);_0x769b1a[_0xbfc4('0x26')]=_['keys'](_0x3bf912[_0xbfc4('0x26')]);_0x769b1a[_0xbfc4('0x27')]=_[_0xbfc4('0x28')](_0x769b1a[_0xbfc4('0x29')],_0x769b1a[_0xbfc4('0x26')]);_0x484b7b[_0xbfc4('0x2a')]=_['intersection'](_0x769b1a[_0xbfc4('0x29')],qs[_0xbfc4('0x2b')](_0x3bf912[_0xbfc4('0x26')][_0xbfc4('0x2b')]));_0x484b7b[_0xbfc4('0x2a')]=_0x484b7b[_0xbfc4('0x2a')]['length']?_0x484b7b[_0xbfc4('0x2a')]:_0x769b1a['model'];if(_0x3bf912['query']['includeAll']){_0x484b7b['include']=[{'all':!![]}];}_0x484b7b=_[_0xbfc4('0x33')]({},_0x484b7b,_0x3bf912[_0xbfc4('0x39')]);return db[_0xbfc4('0x3a')][_0xbfc4('0x42')](_0x484b7b)[_0xbfc4('0x21')](handleEntityNotFound(_0x593e69,null))[_0xbfc4('0x21')](respondWithResult(_0x593e69,null))[_0xbfc4('0x43')](handleError(_0x593e69,null));};exports[_0xbfc4('0x44')]=function(_0x5866ee,_0xe40347){return db[_0xbfc4('0x3a')][_0xbfc4('0x44')](_0x5866ee['body'],{})[_0xbfc4('0x21')](respondWithResult(_0xe40347,0xc9))[_0xbfc4('0x43')](handleError(_0xe40347,null));};exports[_0xbfc4('0x45')]=function(_0x438236,_0x1fc71b){if(_0x438236[_0xbfc4('0x46')]['id']){delete _0x438236[_0xbfc4('0x46')]['id'];}return db[_0xbfc4('0x3a')]['find']({'where':{'id':_0x438236[_0xbfc4('0x40')]['id']}})[_0xbfc4('0x21')](handleEntityNotFound(_0x1fc71b,null))[_0xbfc4('0x21')](saveUpdates(_0x438236[_0xbfc4('0x46')],null))[_0xbfc4('0x21')](respondWithResult(_0x1fc71b,null))[_0xbfc4('0x43')](handleError(_0x1fc71b,null));};exports['destroy']=function(_0x52f2be,_0x10da8b){return db[_0xbfc4('0x3a')][_0xbfc4('0x42')]({'where':{'id':_0x52f2be[_0xbfc4('0x40')]['id']}})[_0xbfc4('0x21')](handleEntityNotFound(_0x10da8b,null))[_0xbfc4('0x21')](removeEntity(_0x10da8b,null))[_0xbfc4('0x43')](handleError(_0x10da8b,null));};exports[_0xbfc4('0x47')]=function(_0x1df354,_0x523bf9,_0x45b1d2){return db[_0xbfc4('0x48')][_0xbfc4('0x42')]({'where':{'id':_0x1df354[_0xbfc4('0x40')]['id']}})[_0xbfc4('0x21')](handleEntityNotFound(_0x523bf9,null))[_0xbfc4('0x21')](function(_0x17bd2b){if(_0x17bd2b){return _0x17bd2b[_0xbfc4('0x47')](_0x1df354[_0xbfc4('0x46')][_0xbfc4('0x49')],_[_0xbfc4('0x4a')](_0x1df354[_0xbfc4('0x46')],[_0xbfc4('0x49'),'id'])||{});}})['then'](respondWithResult(_0x523bf9,null))[_0xbfc4('0x43')](handleError(_0x523bf9,null));};exports['getConditions']=function(_0x1bd420,_0x3a4530,_0x2d3e18){var _0x14f8a5={};var _0x20260e={};var _0x6bbfec;var _0x1104ae;return db[_0xbfc4('0x3a')]['findOne']({'where':{'id':_0x1bd420[_0xbfc4('0x40')]['id']}})[_0xbfc4('0x21')](handleEntityNotFound(_0x3a4530,null))[_0xbfc4('0x21')](function(_0x11ee5e){if(_0x11ee5e){_0x6bbfec=_0x11ee5e;_0x20260e['model']=_[_0xbfc4('0x25')](db[_0xbfc4('0x48')][_0xbfc4('0x41')]);_0x20260e['query']=_[_0xbfc4('0x25')](_0x1bd420['query']);_0x20260e[_0xbfc4('0x27')]=_[_0xbfc4('0x28')](_0x20260e['model'],_0x20260e[_0xbfc4('0x26')]);_0x14f8a5[_0xbfc4('0x2a')]=_[_0xbfc4('0x28')](_0x20260e['model'],qs[_0xbfc4('0x2b')](_0x1bd420['query'][_0xbfc4('0x2b')]));_0x14f8a5[_0xbfc4('0x2a')]=_0x14f8a5[_0xbfc4('0x2a')][_0xbfc4('0x2c')]?_0x14f8a5[_0xbfc4('0x2a')]:_0x20260e[_0xbfc4('0x29')];_0x14f8a5[_0xbfc4('0x2e')]=qs[_0xbfc4('0x2f')](_0x1bd420['query'][_0xbfc4('0x2f')]);_0x14f8a5[_0xbfc4('0x30')]=qs[_0xbfc4('0x27')](_[_0xbfc4('0x31')](_0x1bd420[_0xbfc4('0x26')],_0x20260e['filters']));if(_0x1bd420['query'][_0xbfc4('0x32')]){_0x14f8a5[_0xbfc4('0x30')]=_[_0xbfc4('0x33')](_0x14f8a5[_0xbfc4('0x30')],{'$or':_['map'](_0x14f8a5[_0xbfc4('0x2a')],function(_0x1f5d9f){var _0x1be179={};_0x1be179[_0x1f5d9f]={'$like':'%'+_0x1bd420['query']['filter']+'%'};return _0x1be179;})});}_0x14f8a5=_[_0xbfc4('0x33')]({},_0x14f8a5,_0x1bd420[_0xbfc4('0x39')]);return _0x6bbfec['getConditions'](_0x14f8a5);}})[_0xbfc4('0x21')](function(_0x3cd464){if(_0x3cd464){_0x1104ae=_0x3cd464[_0xbfc4('0x2c')];if(!_0x1bd420['query'][_0xbfc4('0x4b')](_0xbfc4('0x2d'))){_0x14f8a5[_0xbfc4('0x1b')]=qs['limit'](_0x1bd420[_0xbfc4('0x26')][_0xbfc4('0x1b')]);_0x14f8a5[_0xbfc4('0x1a')]=qs['offset'](_0x1bd420[_0xbfc4('0x26')][_0xbfc4('0x1a')]);}return _0x6bbfec[_0xbfc4('0x4c')](_0x14f8a5);}})[_0xbfc4('0x21')](function(_0x30a3d7){if(_0x30a3d7){return _0x30a3d7?{'count':_0x1104ae,'rows':_0x30a3d7}:null;}})[_0xbfc4('0x21')](respondWithResult(_0x3a4530,null))[_0xbfc4('0x43')](handleError(_0x3a4530,null));};exports[_0xbfc4('0x4d')]=function(_0x57fbdb,_0x566660,_0x1c87d3){return db[_0xbfc4('0x4e')]['find']({'where':{'id':_0x57fbdb[_0xbfc4('0x40')]['id']}})[_0xbfc4('0x21')](handleEntityNotFound(_0x566660,null))['then'](function(_0x1973d7){if(_0x1973d7){return _0x1973d7[_0xbfc4('0x4d')](_0x57fbdb['body'][_0xbfc4('0x49')],_[_0xbfc4('0x4a')](_0x57fbdb['body'],[_0xbfc4('0x49'),'id'])||{});}})[_0xbfc4('0x21')](respondWithResult(_0x566660,null))[_0xbfc4('0x43')](handleError(_0x566660,null));};exports[_0xbfc4('0x4f')]=function(_0x4851b0,_0x521d6a,_0x30e62a){var _0x592187={};var _0x52e5b8={};var _0x394087;var _0x38579f;return db[_0xbfc4('0x3a')][_0xbfc4('0x50')]({'where':{'id':_0x4851b0[_0xbfc4('0x40')]['id']}})[_0xbfc4('0x21')](handleEntityNotFound(_0x521d6a,null))[_0xbfc4('0x21')](function(_0x2210f0){if(_0x2210f0){_0x394087=_0x2210f0;_0x52e5b8['model']=_[_0xbfc4('0x25')](db[_0xbfc4('0x4e')][_0xbfc4('0x41')]);_0x52e5b8['query']=_[_0xbfc4('0x25')](_0x4851b0[_0xbfc4('0x26')]);_0x52e5b8[_0xbfc4('0x27')]=_[_0xbfc4('0x28')](_0x52e5b8['model'],_0x52e5b8['query']);_0x592187[_0xbfc4('0x2a')]=_[_0xbfc4('0x28')](_0x52e5b8[_0xbfc4('0x29')],qs[_0xbfc4('0x2b')](_0x4851b0['query'][_0xbfc4('0x2b')]));_0x592187[_0xbfc4('0x2a')]=_0x592187['attributes'][_0xbfc4('0x2c')]?_0x592187['attributes']:_0x52e5b8[_0xbfc4('0x29')];_0x592187[_0xbfc4('0x2e')]=qs[_0xbfc4('0x2f')](_0x4851b0[_0xbfc4('0x26')]['sort']);_0x592187[_0xbfc4('0x30')]=qs['filters'](_[_0xbfc4('0x31')](_0x4851b0[_0xbfc4('0x26')],_0x52e5b8[_0xbfc4('0x27')]));if(_0x4851b0[_0xbfc4('0x26')]['filter']){_0x592187[_0xbfc4('0x30')]=_[_0xbfc4('0x33')](_0x592187[_0xbfc4('0x30')],{'$or':_[_0xbfc4('0x34')](_0x592187['attributes'],function(_0x46c26f){var _0x94b31b={};_0x94b31b[_0x46c26f]={'$like':'%'+_0x4851b0['query'][_0xbfc4('0x32')]+'%'};return _0x94b31b;})});}_0x592187=_[_0xbfc4('0x33')]({},_0x592187,_0x4851b0[_0xbfc4('0x39')]);return _0x394087['getActions'](_0x592187);}})[_0xbfc4('0x21')](function(_0x58e38c){if(_0x58e38c){_0x38579f=_0x58e38c[_0xbfc4('0x2c')];if(!_0x4851b0[_0xbfc4('0x26')][_0xbfc4('0x4b')](_0xbfc4('0x2d'))){_0x592187[_0xbfc4('0x1b')]=qs['limit'](_0x4851b0[_0xbfc4('0x26')]['limit']);_0x592187[_0xbfc4('0x1a')]=qs[_0xbfc4('0x1a')](_0x4851b0[_0xbfc4('0x26')][_0xbfc4('0x1a')]);}return _0x394087[_0xbfc4('0x4f')](_0x592187);}})[_0xbfc4('0x21')](function(_0x479e7b){if(_0x479e7b){return _0x479e7b?{'count':_0x38579f,'rows':_0x479e7b}:null;}})['then'](respondWithResult(_0x521d6a,null))['catch'](handleError(_0x521d6a,null));};
\ No newline at end of file
+var _0xbc07=['params','length','include','find','create','body','addConditions','ids','omit','getConditions','findOne','Condition','map','addActions','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','apply','reject','save','update','then','destroy','sendStatus','stack','index','rawAttributes','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','type','key','VIRTUAL','field','filter','options','Automation','includeAll','findAll','rows','catch','show'];(function(_0x5dff5b,_0x600c5d){var _0x34dd83=function(_0x9830f8){while(--_0x9830f8){_0x5dff5b['push'](_0x5dff5b['shift']());}};_0x34dd83(++_0x600c5d);}(_0xbc07,0x10c));var _0x7bc0=function(_0x275139,_0x5cfdcb){_0x275139=_0x275139-0x0;var _0x224751=_0xbc07[_0x275139];return _0x224751;};'use strict';var pdf=require(_0x7bc0('0x0'));var emlformat=require(_0x7bc0('0x1'));var rimraf=require(_0x7bc0('0x2'));var zipdir=require(_0x7bc0('0x3'));var jsonpatch=require(_0x7bc0('0x4'));var rp=require(_0x7bc0('0x5'));var moment=require(_0x7bc0('0x6'));var BPromise=require(_0x7bc0('0x7'));var Mustache=require(_0x7bc0('0x8'));var util=require(_0x7bc0('0x9'));var path=require('path');var sox=require(_0x7bc0('0xa'));var csv=require(_0x7bc0('0xb'));var ejs=require(_0x7bc0('0xc'));var fs=require('fs');var _=require(_0x7bc0('0xd'));var squel=require(_0x7bc0('0xe'));var crypto=require(_0x7bc0('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7bc0('0x10'));var toCsv=require(_0x7bc0('0xb'));var querystring=require(_0x7bc0('0x11'));var Papa=require('papaparse');var authService=require(_0x7bc0('0x12'));var hardwareService=require(_0x7bc0('0x13'));var Redis=require(_0x7bc0('0x14'));var qs=require(_0x7bc0('0x15'));var logger=require(_0x7bc0('0x16'))(_0x7bc0('0x17'));var utils=require(_0x7bc0('0x18'));var config=require(_0x7bc0('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x842c5f,_0x54f2ae){_0x54f2ae=_0x54f2ae||0xcc;return function(_0x525429){if(_0x525429){return _0x842c5f['sendStatus'](_0x54f2ae);}return _0x842c5f[_0x7bc0('0x1a')](_0x54f2ae)[_0x7bc0('0x1b')]();};}function respondWithResult(_0x3d6163,_0x53c79c){_0x53c79c=_0x53c79c||0xc8;return function(_0x2daedb){if(_0x2daedb){return _0x3d6163[_0x7bc0('0x1a')](_0x53c79c)[_0x7bc0('0x1c')](_0x2daedb);}};}function respondWithFilteredResult(_0x4ae7eb,_0x562886){return function(_0x8b90fc){if(_0x8b90fc){var _0x206770=_0x8b90fc[_0x7bc0('0x1d')],_0xb3943=_0x562886[_0x7bc0('0x1e')],_0x41a121=_0x562886[_0x7bc0('0x1e')]+_0x562886['limit'],_0x5a883b;if(_0x41a121>=_0x206770){_0x41a121=_0x206770;_0x5a883b=0xc8;}else{_0x5a883b=0xce;}_0x4ae7eb[_0x7bc0('0x1a')](_0x5a883b);return _0x4ae7eb['set']('Content-Range',_0xb3943+'-'+_0x41a121+'/'+_0x206770)[_0x7bc0('0x1c')](_0x8b90fc);}return null;};}function patchUpdates(_0x1c3466){return function(_0x1ead65){try{jsonpatch[_0x7bc0('0x1f')](_0x1ead65,_0x1c3466,!![]);}catch(_0x304ac1){return BPromise[_0x7bc0('0x20')](_0x304ac1);}return _0x1ead65[_0x7bc0('0x21')]();};}function saveUpdates(_0x4b52f9,_0x5f295c){return function(_0x133359){if(_0x133359){return _0x133359[_0x7bc0('0x22')](_0x4b52f9)[_0x7bc0('0x23')](function(_0xd60423){return _0xd60423;});}return null;};}function removeEntity(_0x1c1f9f,_0x2c2554){return function(_0x3a2e2b){if(_0x3a2e2b){return _0x3a2e2b[_0x7bc0('0x24')]()[_0x7bc0('0x23')](function(){_0x1c1f9f[_0x7bc0('0x1a')](0xcc)[_0x7bc0('0x1b')]();});}};}function handleEntityNotFound(_0x10afd3,_0x50ad43){return function(_0xcecdd8){if(!_0xcecdd8){_0x10afd3[_0x7bc0('0x25')](0x194);}return _0xcecdd8;};}function handleError(_0x3d3c5d,_0x10c67e){_0x10c67e=_0x10c67e||0x1f4;return function(_0x1bd336){logger['error'](_0x1bd336[_0x7bc0('0x26')]);if(_0x1bd336['name']){delete _0x1bd336['name'];}_0x3d3c5d['status'](_0x10c67e)['send'](_0x1bd336);};}exports[_0x7bc0('0x27')]=function(_0x12b038,_0x373514){var _0x44e7fd={},_0x23b25b={},_0x361d94={'count':0x0,'rows':[]};var _0x401183=db['Automation'][_0x7bc0('0x28')];_0x23b25b[_0x7bc0('0x29')]=_[_0x7bc0('0x2a')](_0x401183);_0x23b25b[_0x7bc0('0x2b')]=_[_0x7bc0('0x2a')](_0x12b038[_0x7bc0('0x2b')]);_0x23b25b['filters']=_[_0x7bc0('0x2c')](_0x23b25b[_0x7bc0('0x29')],_0x23b25b[_0x7bc0('0x2b')]);_0x44e7fd['attributes']=_['intersection'](_0x23b25b[_0x7bc0('0x29')],qs[_0x7bc0('0x2d')](_0x12b038[_0x7bc0('0x2b')][_0x7bc0('0x2d')]));_0x44e7fd[_0x7bc0('0x2e')]=_0x44e7fd[_0x7bc0('0x2e')]['length']?_0x44e7fd[_0x7bc0('0x2e')]:_0x23b25b[_0x7bc0('0x29')];if(!_0x12b038[_0x7bc0('0x2b')][_0x7bc0('0x2f')](_0x7bc0('0x30'))){_0x44e7fd[_0x7bc0('0x31')]=qs[_0x7bc0('0x31')](_0x12b038['query'][_0x7bc0('0x31')]);_0x44e7fd[_0x7bc0('0x1e')]=qs[_0x7bc0('0x1e')](_0x12b038[_0x7bc0('0x2b')][_0x7bc0('0x1e')]);}_0x44e7fd[_0x7bc0('0x32')]=qs[_0x7bc0('0x33')](_0x12b038['query']['sort']);_0x44e7fd[_0x7bc0('0x34')]=qs[_0x7bc0('0x35')](_[_0x7bc0('0x36')](_0x12b038[_0x7bc0('0x2b')],_0x23b25b['filters']));if(_0x12b038['query']['filter']){_0x44e7fd[_0x7bc0('0x34')]=_[_0x7bc0('0x37')](_0x44e7fd['where'],{'$or':_['map'](_0x401183,function(_0x1f0e05){if(_0x1f0e05[_0x7bc0('0x38')][_0x7bc0('0x39')]!==_0x7bc0('0x3a')){var _0x3511df={};_0x3511df[_0x1f0e05[_0x7bc0('0x3b')]]={'$like':'%'+_0x12b038['query'][_0x7bc0('0x3c')]+'%'};return _0x3511df;}})});}_0x44e7fd=_[_0x7bc0('0x37')]({},_0x44e7fd,_0x12b038[_0x7bc0('0x3d')]);var _0x2e568d={'where':_0x44e7fd[_0x7bc0('0x34')]};return db[_0x7bc0('0x3e')][_0x7bc0('0x1d')](_0x2e568d)[_0x7bc0('0x23')](function(_0x186291){_0x361d94[_0x7bc0('0x1d')]=_0x186291;if(_0x12b038['query'][_0x7bc0('0x3f')]){_0x44e7fd['include']=[{'all':!![]}];}return db[_0x7bc0('0x3e')][_0x7bc0('0x40')](_0x44e7fd);})[_0x7bc0('0x23')](function(_0x2f6139){_0x361d94[_0x7bc0('0x41')]=_0x2f6139;return _0x361d94;})[_0x7bc0('0x23')](respondWithFilteredResult(_0x373514,_0x44e7fd))[_0x7bc0('0x42')](handleError(_0x373514,null));};exports[_0x7bc0('0x43')]=function(_0x59cc43,_0x33efb0){var _0x3e656c={'raw':![],'where':{'id':_0x59cc43[_0x7bc0('0x44')]['id']}},_0x42a5bf={};_0x42a5bf[_0x7bc0('0x29')]=_[_0x7bc0('0x2a')](db[_0x7bc0('0x3e')][_0x7bc0('0x28')]);_0x42a5bf[_0x7bc0('0x2b')]=_['keys'](_0x59cc43['query']);_0x42a5bf['filters']=_[_0x7bc0('0x2c')](_0x42a5bf[_0x7bc0('0x29')],_0x42a5bf['query']);_0x3e656c[_0x7bc0('0x2e')]=_[_0x7bc0('0x2c')](_0x42a5bf['model'],qs['fields'](_0x59cc43['query'][_0x7bc0('0x2d')]));_0x3e656c[_0x7bc0('0x2e')]=_0x3e656c[_0x7bc0('0x2e')][_0x7bc0('0x45')]?_0x3e656c[_0x7bc0('0x2e')]:_0x42a5bf[_0x7bc0('0x29')];if(_0x59cc43['query']['includeAll']){_0x3e656c[_0x7bc0('0x46')]=[{'all':!![]}];}_0x3e656c=_[_0x7bc0('0x37')]({},_0x3e656c,_0x59cc43['options']);return db['Automation'][_0x7bc0('0x47')](_0x3e656c)[_0x7bc0('0x23')](handleEntityNotFound(_0x33efb0,null))[_0x7bc0('0x23')](respondWithResult(_0x33efb0,null))['catch'](handleError(_0x33efb0,null));};exports[_0x7bc0('0x48')]=function(_0xb67bb0,_0x1ad37f){return db[_0x7bc0('0x3e')][_0x7bc0('0x48')](_0xb67bb0['body'],{})[_0x7bc0('0x23')](respondWithResult(_0x1ad37f,0xc9))[_0x7bc0('0x42')](handleError(_0x1ad37f,null));};exports[_0x7bc0('0x22')]=function(_0x1a5b08,_0x4bf2a7){if(_0x1a5b08['body']['id']){delete _0x1a5b08[_0x7bc0('0x49')]['id'];}return db['Automation'][_0x7bc0('0x47')]({'where':{'id':_0x1a5b08['params']['id']}})[_0x7bc0('0x23')](handleEntityNotFound(_0x4bf2a7,null))['then'](saveUpdates(_0x1a5b08[_0x7bc0('0x49')],null))[_0x7bc0('0x23')](respondWithResult(_0x4bf2a7,null))[_0x7bc0('0x42')](handleError(_0x4bf2a7,null));};exports[_0x7bc0('0x24')]=function(_0x2ab7c3,_0x310770){return db[_0x7bc0('0x3e')]['find']({'where':{'id':_0x2ab7c3[_0x7bc0('0x44')]['id']}})[_0x7bc0('0x23')](handleEntityNotFound(_0x310770,null))[_0x7bc0('0x23')](removeEntity(_0x310770,null))[_0x7bc0('0x42')](handleError(_0x310770,null));};exports['addConditions']=function(_0x23903b,_0x34ddfb,_0x38b628){return db['Condition'][_0x7bc0('0x47')]({'where':{'id':_0x23903b[_0x7bc0('0x44')]['id']}})['then'](handleEntityNotFound(_0x34ddfb,null))[_0x7bc0('0x23')](function(_0x516fd2){if(_0x516fd2){return _0x516fd2[_0x7bc0('0x4a')](_0x23903b[_0x7bc0('0x49')][_0x7bc0('0x4b')],_[_0x7bc0('0x4c')](_0x23903b[_0x7bc0('0x49')],[_0x7bc0('0x4b'),'id'])||{});}})[_0x7bc0('0x23')](respondWithResult(_0x34ddfb,null))[_0x7bc0('0x42')](handleError(_0x34ddfb,null));};exports[_0x7bc0('0x4d')]=function(_0x2e4cfb,_0x3341fa,_0x538079){var _0x3c5dbe={};var _0x7271a2={};var _0x31333f;var _0x2de0b3;return db['Automation'][_0x7bc0('0x4e')]({'where':{'id':_0x2e4cfb['params']['id']}})[_0x7bc0('0x23')](handleEntityNotFound(_0x3341fa,null))['then'](function(_0x10cb94){if(_0x10cb94){_0x31333f=_0x10cb94;_0x7271a2[_0x7bc0('0x29')]=_[_0x7bc0('0x2a')](db[_0x7bc0('0x4f')][_0x7bc0('0x28')]);_0x7271a2[_0x7bc0('0x2b')]=_[_0x7bc0('0x2a')](_0x2e4cfb[_0x7bc0('0x2b')]);_0x7271a2[_0x7bc0('0x35')]=_[_0x7bc0('0x2c')](_0x7271a2['model'],_0x7271a2['query']);_0x3c5dbe[_0x7bc0('0x2e')]=_[_0x7bc0('0x2c')](_0x7271a2[_0x7bc0('0x29')],qs['fields'](_0x2e4cfb[_0x7bc0('0x2b')][_0x7bc0('0x2d')]));_0x3c5dbe[_0x7bc0('0x2e')]=_0x3c5dbe['attributes'][_0x7bc0('0x45')]?_0x3c5dbe[_0x7bc0('0x2e')]:_0x7271a2[_0x7bc0('0x29')];_0x3c5dbe['order']=qs['sort'](_0x2e4cfb['query'][_0x7bc0('0x33')]);_0x3c5dbe[_0x7bc0('0x34')]=qs['filters'](_[_0x7bc0('0x36')](_0x2e4cfb['query'],_0x7271a2[_0x7bc0('0x35')]));if(_0x2e4cfb[_0x7bc0('0x2b')][_0x7bc0('0x3c')]){_0x3c5dbe[_0x7bc0('0x34')]=_[_0x7bc0('0x37')](_0x3c5dbe[_0x7bc0('0x34')],{'$or':_[_0x7bc0('0x50')](_0x3c5dbe[_0x7bc0('0x2e')],function(_0x242806){var _0x228820={};_0x228820[_0x242806]={'$like':'%'+_0x2e4cfb['query'][_0x7bc0('0x3c')]+'%'};return _0x228820;})});}_0x3c5dbe=_['merge']({},_0x3c5dbe,_0x2e4cfb[_0x7bc0('0x3d')]);return _0x31333f[_0x7bc0('0x4d')](_0x3c5dbe);}})['then'](function(_0x26ca7e){if(_0x26ca7e){_0x2de0b3=_0x26ca7e[_0x7bc0('0x45')];if(!_0x2e4cfb[_0x7bc0('0x2b')][_0x7bc0('0x2f')]('nolimit')){_0x3c5dbe[_0x7bc0('0x31')]=qs[_0x7bc0('0x31')](_0x2e4cfb[_0x7bc0('0x2b')][_0x7bc0('0x31')]);_0x3c5dbe['offset']=qs['offset'](_0x2e4cfb[_0x7bc0('0x2b')][_0x7bc0('0x1e')]);}return _0x31333f[_0x7bc0('0x4d')](_0x3c5dbe);}})[_0x7bc0('0x23')](function(_0x348219){if(_0x348219){return _0x348219?{'count':_0x2de0b3,'rows':_0x348219}:null;}})[_0x7bc0('0x23')](respondWithResult(_0x3341fa,null))[_0x7bc0('0x42')](handleError(_0x3341fa,null));};exports[_0x7bc0('0x51')]=function(_0x2d06b2,_0x10ffed,_0x1f351f){return db[_0x7bc0('0x52')]['find']({'where':{'id':_0x2d06b2[_0x7bc0('0x44')]['id']}})[_0x7bc0('0x23')](handleEntityNotFound(_0x10ffed,null))['then'](function(_0x534d51){if(_0x534d51){return _0x534d51[_0x7bc0('0x51')](_0x2d06b2[_0x7bc0('0x49')][_0x7bc0('0x4b')],_[_0x7bc0('0x4c')](_0x2d06b2['body'],[_0x7bc0('0x4b'),'id'])||{});}})[_0x7bc0('0x23')](respondWithResult(_0x10ffed,null))[_0x7bc0('0x42')](handleError(_0x10ffed,null));};exports[_0x7bc0('0x53')]=function(_0x19118f,_0x408c39,_0x5949a7){var _0x567f45={};var _0x380451={};var _0x54b948;var _0xcc4ecd;return db[_0x7bc0('0x3e')][_0x7bc0('0x4e')]({'where':{'id':_0x19118f['params']['id']}})[_0x7bc0('0x23')](handleEntityNotFound(_0x408c39,null))[_0x7bc0('0x23')](function(_0x57f941){if(_0x57f941){_0x54b948=_0x57f941;_0x380451['model']=_['keys'](db[_0x7bc0('0x52')]['rawAttributes']);_0x380451[_0x7bc0('0x2b')]=_[_0x7bc0('0x2a')](_0x19118f[_0x7bc0('0x2b')]);_0x380451[_0x7bc0('0x35')]=_['intersection'](_0x380451[_0x7bc0('0x29')],_0x380451[_0x7bc0('0x2b')]);_0x567f45[_0x7bc0('0x2e')]=_[_0x7bc0('0x2c')](_0x380451[_0x7bc0('0x29')],qs[_0x7bc0('0x2d')](_0x19118f[_0x7bc0('0x2b')]['fields']));_0x567f45[_0x7bc0('0x2e')]=_0x567f45[_0x7bc0('0x2e')][_0x7bc0('0x45')]?_0x567f45[_0x7bc0('0x2e')]:_0x380451[_0x7bc0('0x29')];_0x567f45[_0x7bc0('0x32')]=qs[_0x7bc0('0x33')](_0x19118f['query'][_0x7bc0('0x33')]);_0x567f45[_0x7bc0('0x34')]=qs[_0x7bc0('0x35')](_['pick'](_0x19118f[_0x7bc0('0x2b')],_0x380451['filters']));if(_0x19118f['query'][_0x7bc0('0x3c')]){_0x567f45[_0x7bc0('0x34')]=_[_0x7bc0('0x37')](_0x567f45[_0x7bc0('0x34')],{'$or':_[_0x7bc0('0x50')](_0x567f45['attributes'],function(_0x356a5b){var _0x36f400={};_0x36f400[_0x356a5b]={'$like':'%'+_0x19118f[_0x7bc0('0x2b')][_0x7bc0('0x3c')]+'%'};return _0x36f400;})});}_0x567f45=_['merge']({},_0x567f45,_0x19118f['options']);return _0x54b948[_0x7bc0('0x53')](_0x567f45);}})[_0x7bc0('0x23')](function(_0x5593dc){if(_0x5593dc){_0xcc4ecd=_0x5593dc[_0x7bc0('0x45')];if(!_0x19118f[_0x7bc0('0x2b')][_0x7bc0('0x2f')]('nolimit')){_0x567f45[_0x7bc0('0x31')]=qs[_0x7bc0('0x31')](_0x19118f[_0x7bc0('0x2b')][_0x7bc0('0x31')]);_0x567f45[_0x7bc0('0x1e')]=qs[_0x7bc0('0x1e')](_0x19118f['query'][_0x7bc0('0x1e')]);}return _0x54b948[_0x7bc0('0x53')](_0x567f45);}})['then'](function(_0x1f580a){if(_0x1f580a){return _0x1f580a?{'count':_0xcc4ecd,'rows':_0x1f580a}:null;}})['then'](respondWithResult(_0x408c39,null))['catch'](handleError(_0x408c39,null));};
\ No newline at end of file
index 86f8ecd..524b18d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2542=['tools_automations','lodash','util','../../config/logger','api','bluebird','./automation.attributes','exports','define'];(function(_0x13dade,_0x2a48e7){var _0x52b5b2=function(_0x43298d){while(--_0x43298d){_0x13dade['push'](_0x13dade['shift']());}};_0x52b5b2(++_0x2a48e7);}(_0x2542,0x169));var _0x2254=function(_0x4fcb79,_0x39642d){_0x4fcb79=_0x4fcb79-0x0;var _0x3666a5=_0x2542[_0x4fcb79];return _0x3666a5;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var logger=require(_0x2254('0x2'))(_0x2254('0x3'));var moment=require('moment');var BPromise=require(_0x2254('0x4'));var rp=require('request-promise');var attributes=require(_0x2254('0x5'));module[_0x2254('0x6')]=function(_0x27f5c9,_0x456612){return _0x27f5c9[_0x2254('0x7')]('Automation',attributes,{'tableName':_0x2254('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x6afc=['exports','Automation','tools_automations','lodash','../../config/logger','moment','bluebird','./automation.attributes'];(function(_0x2ef8f1,_0x1280a3){var _0x17498d=function(_0xd20876){while(--_0xd20876){_0x2ef8f1['push'](_0x2ef8f1['shift']());}};_0x17498d(++_0x1280a3);}(_0x6afc,0x16b));var _0xc6af=function(_0x508689,_0x56abf2){_0x508689=_0x508689-0x0;var _0x8d2f4e=_0x6afc[_0x508689];return _0x8d2f4e;};'use strict';var _=require(_0xc6af('0x0'));var util=require('util');var logger=require(_0xc6af('0x1'))('api');var moment=require(_0xc6af('0x2'));var BPromise=require(_0xc6af('0x3'));var rp=require('request-promise');var attributes=require(_0xc6af('0x4'));module[_0xc6af('0x5')]=function(_0x1a8492,_0x1bf470){return _0x1a8492['define'](_0xc6af('0x6'),attributes,{'tableName':_0xc6af('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 87ec89a..1f7e032 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf271=['code','message','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x45423e,_0x4cc862){var _0x3157c1=function(_0x5ddce4){while(--_0x5ddce4){_0x45423e['push'](_0x45423e['shift']());}};_0x3157c1(++_0x4cc862);}(_0xf271,0x10b));var _0x1f27=function(_0x522c30,_0x55d91c){_0x522c30=_0x522c30-0x0;var _0x10f547=_0xf271[_0x522c30];return _0x10f547;};'use strict';var _=require(_0x1f27('0x0'));var util=require('util');var moment=require(_0x1f27('0x1'));var BPromise=require(_0x1f27('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f27('0x3'))['db'];var utils=require(_0x1f27('0x4'));var logger=require(_0x1f27('0x5'))(_0x1f27('0x6'));var config=require(_0x1f27('0x7'));var jayson=require(_0x1f27('0x8'));var client=jayson[_0x1f27('0x9')][_0x1f27('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e397f,_0x408347,_0x376e7b){return new BPromise(function(_0x2690db,_0xf12834){return client[_0x1f27('0xb')](_0x2e397f,_0x376e7b)[_0x1f27('0xc')](function(_0x153ac2){logger[_0x1f27('0xd')](_0x1f27('0xe'),_0x408347,_0x1f27('0xf'));logger['debug'](_0x1f27('0x10'),_0x408347,'request\x20sent',JSON[_0x1f27('0x11')](_0x153ac2));if(_0x153ac2[_0x1f27('0x12')]){if(_0x153ac2[_0x1f27('0x12')][_0x1f27('0x13')]===0x1f4){logger[_0x1f27('0x12')](_0x1f27('0xe'),_0x408347,_0x153ac2[_0x1f27('0x12')]['message']);return _0xf12834(_0x153ac2[_0x1f27('0x12')][_0x1f27('0x14')]);}logger[_0x1f27('0x12')]('Automation,\x20%s,\x20%s',_0x408347,_0x153ac2[_0x1f27('0x12')][_0x1f27('0x14')]);return _0x2690db(_0x153ac2[_0x1f27('0x12')][_0x1f27('0x14')]);}else{logger[_0x1f27('0xd')](_0x1f27('0xe'),_0x408347,_0x1f27('0xf'));_0x2690db(_0x153ac2['result'][_0x1f27('0x14')]);}})[_0x1f27('0x15')](function(_0x3cda5b){logger[_0x1f27('0x12')]('Automation,\x20%s,\x20%s',_0x408347,_0x3cda5b);_0xf12834(_0x3cda5b);});});}
\ No newline at end of file
+var _0xb012=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x2e1058,_0x535e8c){var _0x3b9d5b=function(_0x4a0a92){while(--_0x4a0a92){_0x2e1058['push'](_0x2e1058['shift']());}};_0x3b9d5b(++_0x535e8c);}(_0xb012,0x92));var _0x2b01=function(_0x40c0a5,_0x14db28){_0x40c0a5=_0x40c0a5-0x0;var _0x5edd9d=_0xb012[_0x40c0a5];return _0x5edd9d;};'use strict';var _=require(_0x2b01('0x0'));var util=require(_0x2b01('0x1'));var moment=require(_0x2b01('0x2'));var BPromise=require(_0x2b01('0x3'));var rs=require(_0x2b01('0x4'));var fs=require('fs');var Redis=require(_0x2b01('0x5'));var db=require(_0x2b01('0x6'))['db'];var utils=require(_0x2b01('0x7'));var logger=require(_0x2b01('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2b01('0x9'));var client=jayson[_0x2b01('0xa')][_0x2b01('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44df70,_0x1a89f7,_0x5570b4){return new BPromise(function(_0x39cce5,_0x3e7b58){return client[_0x2b01('0xc')](_0x44df70,_0x5570b4)[_0x2b01('0xd')](function(_0x26bb89){logger[_0x2b01('0xe')](_0x2b01('0xf'),_0x1a89f7,'request\x20sent');logger['debug'](_0x2b01('0x10'),_0x1a89f7,_0x2b01('0x11'),JSON[_0x2b01('0x12')](_0x26bb89));if(_0x26bb89[_0x2b01('0x13')]){if(_0x26bb89[_0x2b01('0x13')][_0x2b01('0x14')]===0x1f4){logger[_0x2b01('0x13')](_0x2b01('0xf'),_0x1a89f7,_0x26bb89[_0x2b01('0x13')][_0x2b01('0x15')]);return _0x3e7b58(_0x26bb89[_0x2b01('0x13')][_0x2b01('0x15')]);}logger[_0x2b01('0x13')](_0x2b01('0xf'),_0x1a89f7,_0x26bb89[_0x2b01('0x13')][_0x2b01('0x15')]);return _0x39cce5(_0x26bb89[_0x2b01('0x13')][_0x2b01('0x15')]);}else{logger[_0x2b01('0xe')](_0x2b01('0xf'),_0x1a89f7,_0x2b01('0x11'));_0x39cce5(_0x26bb89[_0x2b01('0x16')][_0x2b01('0x15')]);}})[_0x2b01('0x17')](function(_0x18044b){logger[_0x2b01('0x13')](_0x2b01('0xf'),_0x1a89f7,_0x18044b);_0x3e7b58(_0x18044b);});});}
\ No newline at end of file
index 0bd06e9..691bc3e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe469=['addActions','put','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','index','get','/:id','isAuthenticated','/:id/conditions','getConditions','/:id/actions','getActions','create','post'];(function(_0xa658da,_0xba29bc){var _0x275149=function(_0x1d7c80){while(--_0x1d7c80){_0xa658da['push'](_0xa658da['shift']());}};_0x275149(++_0xba29bc);}(_0xe469,0x102));var _0x9e46=function(_0x26ef8b,_0x3aee1b){_0x26ef8b=_0x26ef8b-0x0;var _0x39fd95=_0xe469[_0x26ef8b];return _0x39fd95;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9e46('0x0'));var timeout=require(_0x9e46('0x1'));var express=require(_0x9e46('0x2'));var router=express[_0x9e46('0x3')]();var auth=require(_0x9e46('0x4'));var interaction=require(_0x9e46('0x5'));var config=require(_0x9e46('0x6'));var controller=require(_0x9e46('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x9e46('0x8')]);router[_0x9e46('0x9')](_0x9e46('0xa'),auth[_0x9e46('0xb')](),controller['show']);router[_0x9e46('0x9')](_0x9e46('0xc'),auth[_0x9e46('0xb')](),controller[_0x9e46('0xd')]);router[_0x9e46('0x9')](_0x9e46('0xe'),auth[_0x9e46('0xb')](),controller[_0x9e46('0xf')]);router['post']('/',auth[_0x9e46('0xb')](),controller[_0x9e46('0x10')]);router[_0x9e46('0x11')](_0x9e46('0xc'),auth[_0x9e46('0xb')](),controller['addConditions']);router[_0x9e46('0x11')](_0x9e46('0xe'),auth[_0x9e46('0xb')](),controller[_0x9e46('0x12')]);router[_0x9e46('0x13')](_0x9e46('0xa'),auth['isAuthenticated'](),controller[_0x9e46('0x14')]);router[_0x9e46('0x15')](_0x9e46('0xa'),auth[_0x9e46('0xb')](),controller[_0x9e46('0x16')]);module['exports']=router;
\ No newline at end of file
+var _0x83eb=['express','Router','../../components/auth/service','../../components/interaction/service','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/actions','post','create','addActions','put','update','delete','destroy','multer','util'];(function(_0x55c32f,_0x5cfb46){var _0x3e4d6c=function(_0x465535){while(--_0x465535){_0x55c32f['push'](_0x55c32f['shift']());}};_0x3e4d6c(++_0x5cfb46);}(_0x83eb,0x1f2));var _0xb83e=function(_0x49c011,_0x627c44){_0x49c011=_0x49c011-0x0;var _0x4bfb21=_0x83eb[_0x49c011];return _0x4bfb21;};'use strict';var multer=require(_0xb83e('0x0'));var util=require(_0xb83e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb83e('0x2'));var router=express[_0xb83e('0x3')]();var auth=require(_0xb83e('0x4'));var interaction=require(_0xb83e('0x5'));var config=require('../../config/environment');var controller=require(_0xb83e('0x6'));router[_0xb83e('0x7')]('/',auth[_0xb83e('0x8')](),controller[_0xb83e('0x9')]);router['get'](_0xb83e('0xa'),auth[_0xb83e('0x8')](),controller[_0xb83e('0xb')]);router[_0xb83e('0x7')]('/:id/conditions',auth[_0xb83e('0x8')](),controller['getConditions']);router[_0xb83e('0x7')](_0xb83e('0xc'),auth[_0xb83e('0x8')](),controller['getActions']);router[_0xb83e('0xd')]('/',auth[_0xb83e('0x8')](),controller[_0xb83e('0xe')]);router['post']('/:id/conditions',auth['isAuthenticated'](),controller['addConditions']);router[_0xb83e('0xd')](_0xb83e('0xc'),auth[_0xb83e('0x8')](),controller[_0xb83e('0xf')]);router[_0xb83e('0x10')](_0xb83e('0xa'),auth[_0xb83e('0x8')](),controller[_0xb83e('0x11')]);router[_0xb83e('0x12')](_0xb83e('0xa'),auth['isAuthenticated'](),controller[_0xb83e('0x13')]);module['exports']=router;
\ No newline at end of file
index c2a14a1..d7293ad 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xee5a=['STRING','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','#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)','always','never','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#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)','sequelize'];(function(_0x1c08f6,_0x14c077){var _0xbc156a=function(_0x59df22){while(--_0x59df22){_0x1c08f6['push'](_0x1c08f6['shift']());}};_0xbc156a(++_0x14c077);}(_0xee5a,0xcf));var _0xaee5=function(_0x193c0b,_0x504486){_0x193c0b=_0x193c0b-0x0;var _0x30939a=_0xee5a[_0x193c0b];return _0x30939a;};'use strict';var Sequelize=require(_0xaee5('0x0'));module['exports']={'name':{'type':Sequelize[_0xaee5('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xaee5('0x2')](_0xaee5('0x3')),'allowNull':![],'defaultValue':_0xaee5('0x3')},'description':{'type':Sequelize[_0xaee5('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xaee5('0x4')},'limitCalls':{'type':Sequelize[_0xaee5('0x5')](0x4)[_0xaee5('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xaee5('0x7')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xaee5('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xaee5('0x5')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xaee5('0x5')](0x3)[_0xaee5('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaee5('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xaee5('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xaee5('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaee5('0x9')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xaee5('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaee5('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xaee5('0x6')],'defaultValue':0x3,'comment':_0xaee5('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xaee5('0x5')](0x5)[_0xaee5('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaee5('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0xaee5('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xaee5('0xd')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xaee5('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0xaee5('0x2')](_0xaee5('0xe'),_0xaee5('0xf'),'onlyIfOpen'),'defaultValue':_0xaee5('0xe')},'dialAMDActive':{'type':Sequelize[_0xaee5('0x10')],'defaultValue':0x0,'comment':_0xaee5('0x11')},'dialAMDInitialSilence':{'type':Sequelize[_0xaee5('0x5')](0x9)[_0xaee5('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xaee5('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xaee5('0x5')](0x9)[_0xaee5('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xaee5('0x5')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xaee5('0x13')},'dialAMDMinWordLength':{'type':Sequelize[_0xaee5('0x5')](0x9)[_0xaee5('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xaee5('0x5')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xaee5('0x5')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xaee5('0x14')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xaee5('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xaee5('0x15')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xaee5('0x5')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xaee5('0x16')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xaee5('0x17'),_0xaee5('0x18')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xaee5('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xaee5('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xaee5('0x5')](0x3)[_0xaee5('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xaee5('0x19')}};
\ No newline at end of file
+var _0x3a8c=['sequelize','exports','name','ENUM','ivr','STRING','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#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)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)'];(function(_0x3a8b26,_0x29eee6){var _0x11fc07=function(_0x4ed19d){while(--_0x4ed19d){_0x3a8b26['push'](_0x3a8b26['shift']());}};_0x11fc07(++_0x29eee6);}(_0x3a8c,0x179));var _0xc3a8=function(_0x5ed804,_0x226cb7){_0x5ed804=_0x5ed804-0x0;var _0x4530d5=_0x3a8c[_0x5ed804];return _0x4530d5;};'use strict';var Sequelize=require(_0xc3a8('0x0'));module[_0xc3a8('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc3a8('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xc3a8('0x3')]('ivr'),'allowNull':![],'defaultValue':_0xc3a8('0x4')},'description':{'type':Sequelize[_0xc3a8('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xc3a8('0x6')},'limitCalls':{'type':Sequelize[_0xc3a8('0x7')](0x4)[_0xc3a8('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xc3a8('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0xc3a8('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc3a8('0x5')]},'dialOriginateTimeout':{'type':Sequelize[_0xc3a8('0x7')](0x3)[_0xc3a8('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc3a8('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc3a8('0x7')](0x3)[_0xc3a8('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc3a8('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc3a8('0x7')](0x5)[_0xc3a8('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc3a8('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0xc3a8('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xc3a8('0x7')](0x5)[_0xc3a8('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc3a8('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc3a8('0x7')](0x3)[_0xc3a8('0x8')],'defaultValue':0x3,'comment':_0xc3a8('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc3a8('0x7')](0x5)[_0xc3a8('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xc3a8('0x7')](0x3)[_0xc3a8('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc3a8('0xf')},'dialTimezone':{'type':Sequelize[_0xc3a8('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc3a8('0x5')],'defaultValue':_0xc3a8('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xc3a8('0x3')](_0xc3a8('0x11'),_0xc3a8('0x12'),_0xc3a8('0x13')),'defaultValue':_0xc3a8('0x11')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xc3a8('0x14')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xc3a8('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xc3a8('0x7')](0x9)[_0xc3a8('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc3a8('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc3a8('0x7')](0x9)[_0xc3a8('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc3a8('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xc3a8('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xc3a8('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc3a8('0x7')](0x9)[_0xc3a8('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc3a8('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xc3a8('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc3a8('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc3a8('0x7')](0x5)[_0xc3a8('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc3a8('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc3a8('0x7')](0x9)[_0xc3a8('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc3a8('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0xc3a8('0x3')](_0xc3a8('0x1b'),'ASC'),'defaultValue':_0xc3a8('0x1b')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc3a8('0x7')](0x3)[_0xc3a8('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc3a8('0x1c')},'dialCutDigit':{'type':Sequelize[_0xc3a8('0x7')](0x3)[_0xc3a8('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'}};
\ No newline at end of file
index e8e730b..3305889 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x433e=['ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','select','calleridnum','CampaignId\x20=\x20?','cm_hopper','cm_contacts','phone\x20NOT\x20IN\x20(?)','push','sequelize','getBlackLists','addBlackLists','all','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','Content-Range','reject','save','update','then','destroy','IvrCampaigns','UserProfileResource','error','stack','name','send','index','Campaign','rawAttributes','model','query','keys','attributes','fields','length','limit','sort','filters','pick','filter','where','merge','map','key','VIRTUAL','field','options','count','includeAll','include','catch','show','intersection','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','clone','params','updatedAt','omit','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','nolimit','order','CmHopper','rows','getHopperHistories','CmHopperHistory','hasOwnProperty','CampaignId','findAll','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','fromQuery','phone','ContactId','ListId','createdAt','NOW()','scheduledAt','CmListId','toString','from','deletedAt\x20IS\x20NULL'];(function(_0x687ddc,_0x2092fa){var _0x441991=function(_0x49c6a6){while(--_0x49c6a6){_0x687ddc['push'](_0x687ddc['shift']());}};_0x441991(++_0x2092fa);}(_0x433e,0x112));var _0xe433=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x433e[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe433('0x0'));var zipdir=require(_0xe433('0x1'));var jsonpatch=require(_0xe433('0x2'));var rp=require(_0xe433('0x3'));var moment=require(_0xe433('0x4'));var BPromise=require(_0xe433('0x5'));var Mustache=require(_0xe433('0x6'));var util=require(_0xe433('0x7'));var path=require(_0xe433('0x8'));var sox=require(_0xe433('0x9'));var csv=require(_0xe433('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe433('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe433('0xa'));var querystring=require('querystring');var Papa=require(_0xe433('0xc'));var authService=require(_0xe433('0xd'));var hardwareService=require(_0xe433('0xe'));var Redis=require(_0xe433('0xf'));var qs=require(_0xe433('0x10'));var logger=require(_0xe433('0x11'))(_0xe433('0x12'));var utils=require(_0xe433('0x13'));var config=require(_0xe433('0x14'));var db=require(_0xe433('0x15'))['db'];function respondWithStatusCode(_0x2e4fa3,_0x27faa0){_0x27faa0=_0x27faa0||0xcc;return function(_0x2bdf1f){if(_0x2bdf1f){return _0x2e4fa3[_0xe433('0x16')](_0x27faa0);}return _0x2e4fa3[_0xe433('0x17')](_0x27faa0)[_0xe433('0x18')]();};}function respondWithResult(_0x5048da,_0x206afd){_0x206afd=_0x206afd||0xc8;return function(_0x5d28f3){if(_0x5d28f3){return _0x5048da[_0xe433('0x17')](_0x206afd)[_0xe433('0x19')](_0x5d28f3);}};}function respondWithFilteredResult(_0x3a4478,_0x133225){return function(_0x405372){if(_0x405372){var _0x2ab721=_0x405372['count'],_0x48e44a=_0x133225[_0xe433('0x1a')],_0x12ed6e=_0x133225[_0xe433('0x1a')]+_0x133225['limit'],_0x465c58;if(_0x12ed6e>=_0x2ab721){_0x12ed6e=_0x2ab721;_0x465c58=0xc8;}else{_0x465c58=0xce;}_0x3a4478[_0xe433('0x17')](_0x465c58);return _0x3a4478['set'](_0xe433('0x1b'),_0x48e44a+'-'+_0x12ed6e+'/'+_0x2ab721)['json'](_0x405372);}return null;};}function patchUpdates(_0x388887){return function(_0x2830e2){try{jsonpatch['apply'](_0x2830e2,_0x388887,!![]);}catch(_0x88a02f){return BPromise[_0xe433('0x1c')](_0x88a02f);}return _0x2830e2[_0xe433('0x1d')]();};}function saveUpdates(_0x36af50,_0x3ea559){return function(_0x5064ca){if(_0x5064ca){return _0x5064ca[_0xe433('0x1e')](_0x36af50)[_0xe433('0x1f')](function(_0x26ff09){return _0x26ff09;});}return null;};}function removeEntity(_0x115125,_0x289f93){return function(_0x45c536){if(_0x45c536){return _0x45c536[_0xe433('0x20')]()['then'](function(){var _0x1e6f47=_0x45c536['get']({'plain':!![]});var _0x426a0e=_0xe433('0x21');return db[_0xe433('0x22')][_0xe433('0x20')]({'where':{'type':_0x426a0e,'resourceId':_0x1e6f47['id']}})['then'](function(){return _0x45c536;});})[_0xe433('0x1f')](function(){_0x115125[_0xe433('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x114e01,_0x1a6239){return function(_0xf6ab3){if(!_0xf6ab3){_0x114e01[_0xe433('0x16')](0x194);}return _0xf6ab3;};}function handleError(_0x5d86f0,_0x1b317a){_0x1b317a=_0x1b317a||0x1f4;return function(_0x5e00a6){logger[_0xe433('0x23')](_0x5e00a6[_0xe433('0x24')]);if(_0x5e00a6[_0xe433('0x25')]){delete _0x5e00a6['name'];}_0x5d86f0[_0xe433('0x17')](_0x1b317a)[_0xe433('0x26')](_0x5e00a6);};}exports[_0xe433('0x27')]=function(_0xefd181,_0x2be636){var _0x416f1e={},_0x3fec57={},_0x43f033={'count':0x0,'rows':[]};var _0xe8c4a0=db[_0xe433('0x28')][_0xe433('0x29')];_0x3fec57[_0xe433('0x2a')]=_['keys'](_0xe8c4a0);_0x3fec57[_0xe433('0x2b')]=_[_0xe433('0x2c')](_0xefd181[_0xe433('0x2b')]);_0x3fec57['filters']=_['intersection'](_0x3fec57[_0xe433('0x2a')],_0x3fec57[_0xe433('0x2b')]);_0x416f1e[_0xe433('0x2d')]=_['intersection'](_0x3fec57[_0xe433('0x2a')],qs[_0xe433('0x2e')](_0xefd181[_0xe433('0x2b')]['fields']));_0x416f1e[_0xe433('0x2d')]=_0x416f1e[_0xe433('0x2d')][_0xe433('0x2f')]?_0x416f1e[_0xe433('0x2d')]:_0x3fec57[_0xe433('0x2a')];if(!_0xefd181[_0xe433('0x2b')]['hasOwnProperty']('nolimit')){_0x416f1e[_0xe433('0x30')]=qs[_0xe433('0x30')](_0xefd181[_0xe433('0x2b')][_0xe433('0x30')]);_0x416f1e['offset']=qs[_0xe433('0x1a')](_0xefd181[_0xe433('0x2b')][_0xe433('0x1a')]);}_0x416f1e['order']=qs[_0xe433('0x31')](_0xefd181[_0xe433('0x2b')][_0xe433('0x31')]);_0x416f1e['where']=qs[_0xe433('0x32')](_[_0xe433('0x33')](_0xefd181[_0xe433('0x2b')],_0x3fec57[_0xe433('0x32')]));if(_0xefd181[_0xe433('0x2b')][_0xe433('0x34')]){_0x416f1e[_0xe433('0x35')]=_[_0xe433('0x36')](_0x416f1e[_0xe433('0x35')],{'$or':_[_0xe433('0x37')](_0xe8c4a0,function(_0x4afb15){if(_0x4afb15['type'][_0xe433('0x38')]!==_0xe433('0x39')){var _0x9e54c7={};_0x9e54c7[_0x4afb15[_0xe433('0x3a')]]={'$like':'%'+_0xefd181[_0xe433('0x2b')]['filter']+'%'};return _0x9e54c7;}})});}_0x416f1e=_[_0xe433('0x36')]({},_0x416f1e,_0xefd181[_0xe433('0x3b')]);var _0x16a818={'where':_0x416f1e[_0xe433('0x35')]};return db[_0xe433('0x28')][_0xe433('0x3c')](_0x16a818)['then'](function(_0x2db6e7){_0x43f033[_0xe433('0x3c')]=_0x2db6e7;if(_0xefd181[_0xe433('0x2b')][_0xe433('0x3d')]){_0x416f1e[_0xe433('0x3e')]=[{'all':!![]}];}return db[_0xe433('0x28')]['findAll'](_0x416f1e);})[_0xe433('0x1f')](function(_0x4c85dc){_0x43f033['rows']=_0x4c85dc;return _0x43f033;})[_0xe433('0x1f')](respondWithFilteredResult(_0x2be636,_0x416f1e))[_0xe433('0x3f')](handleError(_0x2be636,null));};exports[_0xe433('0x40')]=function(_0x471dcd,_0x518902){var _0x43c819={'raw':![],'where':{'id':_0x471dcd['params']['id']}},_0x478399={};_0x478399['model']=_['keys'](db[_0xe433('0x28')][_0xe433('0x29')]);_0x478399[_0xe433('0x2b')]=_[_0xe433('0x2c')](_0x471dcd[_0xe433('0x2b')]);_0x478399[_0xe433('0x32')]=_[_0xe433('0x41')](_0x478399[_0xe433('0x2a')],_0x478399[_0xe433('0x2b')]);_0x43c819[_0xe433('0x2d')]=_[_0xe433('0x41')](_0x478399['model'],qs[_0xe433('0x2e')](_0x471dcd[_0xe433('0x2b')][_0xe433('0x2e')]));_0x43c819['attributes']=_0x43c819[_0xe433('0x2d')][_0xe433('0x2f')]?_0x43c819[_0xe433('0x2d')]:_0x478399[_0xe433('0x2a')];if(_0x471dcd['query'][_0xe433('0x3d')]){_0x43c819[_0xe433('0x3e')]=[{'all':!![]}];}_0x43c819=_[_0xe433('0x36')]({},_0x43c819,_0x471dcd[_0xe433('0x3b')]);return db[_0xe433('0x28')][_0xe433('0x42')](_0x43c819)[_0xe433('0x1f')](handleEntityNotFound(_0x518902,null))[_0xe433('0x1f')](respondWithResult(_0x518902,null))['catch'](handleError(_0x518902,null));};exports['create']=function(_0x2a7c44,_0x54fda5){return db[_0xe433('0x28')][_0xe433('0x43')](_0x2a7c44[_0xe433('0x44')],{})[_0xe433('0x1f')](function(_0x2ca560){var _0x4b55f5=_0x2a7c44['user'][_0xe433('0x45')]({'plain':!![]});if(!_0x4b55f5)throw new Error(_0xe433('0x46'));if(_0x4b55f5[_0xe433('0x47')]===_0xe433('0x48')){var _0x2aa28e=_0x2ca560[_0xe433('0x45')]({'plain':!![]});var _0x35f483=_0xe433('0x21');return db[_0xe433('0x49')][_0xe433('0x42')]({'where':{'name':_0x35f483,'userProfileId':_0x4b55f5[_0xe433('0x4a')]},'raw':!![]})[_0xe433('0x1f')](function(_0x5c081b){if(_0x5c081b&&_0x5c081b[_0xe433('0x4b')]===0x0){return db[_0xe433('0x22')][_0xe433('0x43')]({'name':_0x2aa28e[_0xe433('0x25')],'resourceId':_0x2aa28e['id'],'type':_0x5c081b[_0xe433('0x25')],'sectionId':_0x5c081b['id']},{})[_0xe433('0x1f')](function(){return _0x2ca560;});}else{return _0x2ca560;}})[_0xe433('0x3f')](function(_0x4f1e81){logger[_0xe433('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f1e81);throw _0x4f1e81;});}return _0x2ca560;})[_0xe433('0x1f')](respondWithResult(_0x54fda5,0xc9))[_0xe433('0x3f')](handleError(_0x54fda5,null));};exports[_0xe433('0x4c')]=function(_0x529d28,_0x23cfc7){var _0x286d03={'raw':![],'where':{'id':_0x529d28[_0xe433('0x4d')]['id']}},_0x83bc3d={};_0x83bc3d[_0xe433('0x2a')]=_['keys'](db[_0xe433('0x28')][_0xe433('0x29')]);_0x286d03['attributes']=_[_0xe433('0x41')](_0x83bc3d[_0xe433('0x2a')],qs[_0xe433('0x2e')](_0x529d28[_0xe433('0x2b')]['fields']));_0x286d03[_0xe433('0x2d')]=_0x286d03[_0xe433('0x2d')][_0xe433('0x2f')]?_0x286d03[_0xe433('0x2d')]:_0x83bc3d[_0xe433('0x2a')];if(_0x529d28['query'][_0xe433('0x3d')]){_0x286d03[_0xe433('0x3e')]=[{'all':!![]}];}_0x286d03=_[_0xe433('0x36')]({},_0x286d03,_0x529d28['options']);return db['Campaign']['find'](_0x286d03)[_0xe433('0x1f')](handleEntityNotFound(_0x23cfc7,null))[_0xe433('0x1f')](function(_0x2b2600){if(_0x2b2600){var _0x3d7fa=_0x2b2600['get']({'plain':!![]});_0x3d7fa=qs['omit'](_0x3d7fa,['id','createdAt',_0xe433('0x4e')]);_0x529d28[_0xe433('0x44')]=_[_0xe433('0x4f')](_0x529d28[_0xe433('0x44')],['id','createdAt','updatedAt']);return db[_0xe433('0x28')]['create'](_[_0xe433('0x36')](_0x3d7fa,_0x529d28[_0xe433('0x44')]),{'include':_0x529d28[_0xe433('0x2b')]['includeAll']?[{'all':!![]}]:undefined})[_0xe433('0x1f')](function(_0x2155d8){var _0x42b8e5=_0x529d28['user']['get']({'plain':!![]});if(!_0x42b8e5)throw new Error(_0xe433('0x46'));if(_0x42b8e5[_0xe433('0x47')]===_0xe433('0x48')){var _0x4716da=_0x2155d8[_0xe433('0x45')]({'plain':!![]});var _0x3b84c8=_0xe433('0x21');return db[_0xe433('0x49')][_0xe433('0x42')]({'where':{'name':_0x3b84c8,'userProfileId':_0x42b8e5['userProfileId']},'raw':!![]})[_0xe433('0x1f')](function(_0x56b6d5){if(_0x56b6d5&&_0x56b6d5['autoAssociation']===0x0){return db[_0xe433('0x22')][_0xe433('0x43')]({'name':_0x4716da[_0xe433('0x25')],'resourceId':_0x4716da['id'],'type':_0x56b6d5[_0xe433('0x25')],'sectionId':_0x56b6d5['id']},{})['then'](function(){return _0x2155d8;});}else{return _0x2155d8;}})['catch'](function(_0x23e5ac){logger[_0xe433('0x23')](_0xe433('0x50'),_0x23e5ac);throw _0x23e5ac;});}return _0x2155d8;});}})['then'](respondWithResult(_0x23cfc7,0xc9))[_0xe433('0x3f')](handleError(_0x23cfc7,null));};exports[_0xe433('0x1e')]=function(_0x2dc685,_0x33cfff){if(_0x2dc685[_0xe433('0x44')]['id']){delete _0x2dc685[_0xe433('0x44')]['id'];}return db['Campaign'][_0xe433('0x42')]({'where':{'id':_0x2dc685[_0xe433('0x4d')]['id']}})[_0xe433('0x1f')](handleEntityNotFound(_0x33cfff,null))['then'](saveUpdates(_0x2dc685[_0xe433('0x44')],null))[_0xe433('0x1f')](respondWithResult(_0x33cfff,null))[_0xe433('0x3f')](handleError(_0x33cfff,null));};exports[_0xe433('0x20')]=function(_0x189e6d,_0x56cc59){return db[_0xe433('0x28')]['find']({'where':{'id':_0x189e6d[_0xe433('0x4d')]['id']}})['then'](handleEntityNotFound(_0x56cc59,null))[_0xe433('0x1f')](removeEntity(_0x56cc59,null))['catch'](handleError(_0x56cc59,null));};exports[_0xe433('0x51')]=function(_0x47b7a7,_0x3de805,_0x134b21){var _0x484d10={'raw':!![],'where':{}};var _0xfff4c={};var _0x1283f5={'count':0x0,'rows':[]};return db['Campaign'][_0xe433('0x52')]({'where':{'id':_0x47b7a7[_0xe433('0x4d')]['id']}})[_0xe433('0x1f')](handleEntityNotFound(_0x3de805,null))[_0xe433('0x1f')](function(_0x1ced01){if(_0x1ced01){_0xfff4c[_0xe433('0x2a')]=_['keys'](db['CmHopper'][_0xe433('0x29')]);_0xfff4c[_0xe433('0x2b')]=_['keys'](_0x47b7a7['query']);_0xfff4c['filters']=_[_0xe433('0x41')](_0xfff4c[_0xe433('0x2a')],_0xfff4c[_0xe433('0x2b')]);_0x484d10[_0xe433('0x2d')]=_[_0xe433('0x41')](_0xfff4c[_0xe433('0x2a')],qs[_0xe433('0x2e')](_0x47b7a7[_0xe433('0x2b')][_0xe433('0x2e')]));_0x484d10['attributes']=_0x484d10[_0xe433('0x2d')][_0xe433('0x2f')]?_0x484d10[_0xe433('0x2d')]:_0xfff4c[_0xe433('0x2a')];if(!_0x47b7a7['query']['hasOwnProperty'](_0xe433('0x53'))){_0x484d10[_0xe433('0x30')]=qs[_0xe433('0x30')](_0x47b7a7['query']['limit']);_0x484d10[_0xe433('0x1a')]=qs['offset'](_0x47b7a7['query']['offset']);}_0x484d10[_0xe433('0x54')]=qs[_0xe433('0x31')](_0x47b7a7[_0xe433('0x2b')][_0xe433('0x31')]);_0x484d10['where']=qs[_0xe433('0x32')](_[_0xe433('0x33')](_0x47b7a7['query'],_0xfff4c[_0xe433('0x32')]));_0x484d10[_0xe433('0x35')]['CampaignId']=_0x1ced01['id'];if(_0x47b7a7[_0xe433('0x2b')][_0xe433('0x34')]){_0x484d10[_0xe433('0x35')]=_[_0xe433('0x36')](_0x484d10[_0xe433('0x35')],{'$or':_[_0xe433('0x37')](_0x484d10[_0xe433('0x2d')],function(_0x1e18e6){var _0x564945={};_0x564945[_0x1e18e6]={'$like':'%'+_0x47b7a7['query'][_0xe433('0x34')]+'%'};return _0x564945;})});}_0x484d10=_[_0xe433('0x36')]({},_0x484d10,_0x47b7a7[_0xe433('0x3b')]);return db[_0xe433('0x55')]['count']({'where':_0x484d10[_0xe433('0x35')]})[_0xe433('0x1f')](function(_0x2ad4d7){_0x1283f5[_0xe433('0x3c')]=_0x2ad4d7;if(_0x47b7a7['query'][_0xe433('0x3d')]){_0x484d10['include']=[{'all':!![]}];}return db[_0xe433('0x55')]['findAll'](_0x484d10);})[_0xe433('0x1f')](function(_0x530382){_0x1283f5[_0xe433('0x56')]=_0x530382;return _0x1283f5;});}})['then'](respondWithFilteredResult(_0x3de805,_0x484d10))[_0xe433('0x3f')](handleError(_0x3de805,null));};exports[_0xe433('0x57')]=function(_0x1daf1a,_0x45cddf,_0x1eed29){var _0x45aaf2={'raw':!![],'where':{}};var _0x316d07={};var _0x2b49b3={'count':0x0,'rows':[]};return db[_0xe433('0x28')][_0xe433('0x52')]({'where':{'id':_0x1daf1a['params']['id']}})['then'](handleEntityNotFound(_0x45cddf,null))[_0xe433('0x1f')](function(_0x1239f0){if(_0x1239f0){_0x316d07[_0xe433('0x2a')]=_[_0xe433('0x2c')](db[_0xe433('0x58')][_0xe433('0x29')]);_0x316d07[_0xe433('0x2b')]=_[_0xe433('0x2c')](_0x1daf1a[_0xe433('0x2b')]);_0x316d07[_0xe433('0x32')]=_[_0xe433('0x41')](_0x316d07[_0xe433('0x2a')],_0x316d07['query']);_0x45aaf2[_0xe433('0x2d')]=_[_0xe433('0x41')](_0x316d07['model'],qs[_0xe433('0x2e')](_0x1daf1a[_0xe433('0x2b')]['fields']));_0x45aaf2[_0xe433('0x2d')]=_0x45aaf2[_0xe433('0x2d')]['length']?_0x45aaf2[_0xe433('0x2d')]:_0x316d07['model'];if(!_0x1daf1a[_0xe433('0x2b')][_0xe433('0x59')](_0xe433('0x53'))){_0x45aaf2[_0xe433('0x30')]=qs[_0xe433('0x30')](_0x1daf1a[_0xe433('0x2b')][_0xe433('0x30')]);_0x45aaf2[_0xe433('0x1a')]=qs[_0xe433('0x1a')](_0x1daf1a[_0xe433('0x2b')][_0xe433('0x1a')]);}_0x45aaf2[_0xe433('0x54')]=qs[_0xe433('0x31')](_0x1daf1a['query'][_0xe433('0x31')]);_0x45aaf2['where']=qs[_0xe433('0x32')](_['pick'](_0x1daf1a[_0xe433('0x2b')],_0x316d07[_0xe433('0x32')]));_0x45aaf2['where'][_0xe433('0x5a')]=_0x1239f0['id'];if(_0x1daf1a[_0xe433('0x2b')][_0xe433('0x34')]){_0x45aaf2[_0xe433('0x35')]=_[_0xe433('0x36')](_0x45aaf2['where'],{'$or':_[_0xe433('0x37')](_0x45aaf2[_0xe433('0x2d')],function(_0x1a1f7c){var _0x1b772a={};_0x1b772a[_0x1a1f7c]={'$like':'%'+_0x1daf1a[_0xe433('0x2b')][_0xe433('0x34')]+'%'};return _0x1b772a;})});}_0x45aaf2=_['merge']({},_0x45aaf2,_0x1daf1a[_0xe433('0x3b')]);return db['CmHopperHistory'][_0xe433('0x3c')]({'where':_0x45aaf2[_0xe433('0x35')]})[_0xe433('0x1f')](function(_0xaaa6aa){_0x2b49b3[_0xe433('0x3c')]=_0xaaa6aa;if(_0x1daf1a[_0xe433('0x2b')][_0xe433('0x3d')]){_0x45aaf2['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xe433('0x5b')](_0x45aaf2);})[_0xe433('0x1f')](function(_0xd61a0d){_0x2b49b3[_0xe433('0x56')]=_0xd61a0d;return _0x2b49b3;});}})[_0xe433('0x1f')](respondWithFilteredResult(_0x45cddf,_0x45aaf2))['catch'](handleError(_0x45cddf,null));};exports[_0xe433('0x5c')]=function(_0x553aed,_0x2b6bfd,_0x47a4e9){var _0x10efb5={'raw':!![],'where':{}};var _0x46675a={};var _0x205e73={'count':0x0,'rows':[]};return db['Campaign'][_0xe433('0x52')]({'where':{'id':_0x553aed[_0xe433('0x4d')]['id']}})[_0xe433('0x1f')](handleEntityNotFound(_0x2b6bfd,null))[_0xe433('0x1f')](function(_0x15870a){if(_0x15870a){_0x46675a[_0xe433('0x2a')]=_[_0xe433('0x2c')](db[_0xe433('0x5d')]['rawAttributes']);_0x46675a[_0xe433('0x2b')]=_['keys'](_0x553aed[_0xe433('0x2b')]);_0x46675a[_0xe433('0x32')]=_['intersection'](_0x46675a['model'],_0x46675a[_0xe433('0x2b')]);_0x10efb5[_0xe433('0x2d')]=_['intersection'](_0x46675a[_0xe433('0x2a')],qs['fields'](_0x553aed[_0xe433('0x2b')][_0xe433('0x2e')]));_0x10efb5[_0xe433('0x2d')]=_0x10efb5[_0xe433('0x2d')][_0xe433('0x2f')]?_0x10efb5[_0xe433('0x2d')]:_0x46675a['model'];if(!_0x553aed['query'][_0xe433('0x59')](_0xe433('0x53'))){_0x10efb5['limit']=qs[_0xe433('0x30')](_0x553aed[_0xe433('0x2b')][_0xe433('0x30')]);_0x10efb5['offset']=qs[_0xe433('0x1a')](_0x553aed['query'][_0xe433('0x1a')]);}_0x10efb5['order']=qs[_0xe433('0x31')](_0x553aed[_0xe433('0x2b')]['sort']);_0x10efb5[_0xe433('0x35')]=qs[_0xe433('0x32')](_[_0xe433('0x33')](_0x553aed[_0xe433('0x2b')],_0x46675a[_0xe433('0x32')]));_0x10efb5['where'][_0xe433('0x5a')]=_0x15870a['id'];if(_0x553aed['query'][_0xe433('0x34')]){_0x10efb5[_0xe433('0x35')]=_[_0xe433('0x36')](_0x10efb5[_0xe433('0x35')],{'$or':_['map'](_0x10efb5[_0xe433('0x2d')],function(_0x2f7f52){var _0x13c002={};_0x13c002[_0x2f7f52]={'$like':'%'+_0x553aed[_0xe433('0x2b')][_0xe433('0x34')]+'%'};return _0x13c002;})});}_0x10efb5=_[_0xe433('0x36')]({},_0x10efb5,_0x553aed[_0xe433('0x3b')]);return db['CmHopperFinal'][_0xe433('0x3c')]({'where':_0x10efb5[_0xe433('0x35')]})['then'](function(_0x3ba94e){_0x205e73[_0xe433('0x3c')]=_0x3ba94e;if(_0x553aed['query'][_0xe433('0x3d')]){_0x10efb5[_0xe433('0x3e')]=[{'all':!![]}];}return db[_0xe433('0x5d')][_0xe433('0x5b')](_0x10efb5);})[_0xe433('0x1f')](function(_0x537c2a){_0x205e73[_0xe433('0x56')]=_0x537c2a;return _0x205e73;});}})['then'](respondWithFilteredResult(_0x2b6bfd,_0x10efb5))['catch'](handleError(_0x2b6bfd,null));};exports[_0xe433('0x5e')]=function(_0x478fdb,_0xd24d5,_0x744e72){var _0x471e69={'raw':!![],'where':{}};var _0x17e2e2={};var _0x59e689={'count':0x0,'rows':[]};return db[_0xe433('0x28')]['findOne']({'where':{'id':_0x478fdb[_0xe433('0x4d')]['id']}})['then'](handleEntityNotFound(_0xd24d5,null))[_0xe433('0x1f')](function(_0x205dcf){if(_0x205dcf){_0x17e2e2[_0xe433('0x2a')]=_[_0xe433('0x2c')](db['CmHopperBlack'][_0xe433('0x29')]);_0x17e2e2[_0xe433('0x2b')]=_['keys'](_0x478fdb[_0xe433('0x2b')]);_0x17e2e2[_0xe433('0x32')]=_[_0xe433('0x41')](_0x17e2e2['model'],_0x17e2e2['query']);_0x471e69['attributes']=_[_0xe433('0x41')](_0x17e2e2['model'],qs['fields'](_0x478fdb['query'][_0xe433('0x2e')]));_0x471e69[_0xe433('0x2d')]=_0x471e69['attributes'][_0xe433('0x2f')]?_0x471e69[_0xe433('0x2d')]:_0x17e2e2[_0xe433('0x2a')];if(!_0x478fdb[_0xe433('0x2b')][_0xe433('0x59')]('nolimit')){_0x471e69[_0xe433('0x30')]=qs[_0xe433('0x30')](_0x478fdb[_0xe433('0x2b')][_0xe433('0x30')]);_0x471e69['offset']=qs[_0xe433('0x1a')](_0x478fdb['query'][_0xe433('0x1a')]);}_0x471e69[_0xe433('0x54')]=qs[_0xe433('0x31')](_0x478fdb[_0xe433('0x2b')][_0xe433('0x31')]);_0x471e69[_0xe433('0x35')]=qs['filters'](_[_0xe433('0x33')](_0x478fdb[_0xe433('0x2b')],_0x17e2e2[_0xe433('0x32')]));_0x471e69[_0xe433('0x35')]['CampaignId']=_0x205dcf['id'];if(_0x478fdb[_0xe433('0x2b')][_0xe433('0x34')]){_0x471e69[_0xe433('0x35')]=_[_0xe433('0x36')](_0x471e69[_0xe433('0x35')],{'$or':_[_0xe433('0x37')](_0x471e69[_0xe433('0x2d')],function(_0xf1fbaf){var _0xbb46d7={};_0xbb46d7[_0xf1fbaf]={'$like':'%'+_0x478fdb[_0xe433('0x2b')]['filter']+'%'};return _0xbb46d7;})});}_0x471e69=_[_0xe433('0x36')]({},_0x471e69,_0x478fdb['options']);return db[_0xe433('0x5f')][_0xe433('0x3c')]({'where':_0x471e69[_0xe433('0x35')]})['then'](function(_0x59c0d1){_0x59e689[_0xe433('0x3c')]=_0x59c0d1;if(_0x478fdb[_0xe433('0x2b')][_0xe433('0x3d')]){_0x471e69[_0xe433('0x3e')]=[{'all':!![]}];}return db[_0xe433('0x5f')][_0xe433('0x5b')](_0x471e69);})['then'](function(_0x5107b8){_0x59e689['rows']=_0x5107b8;return _0x59e689;});}})['then'](respondWithFilteredResult(_0xd24d5,_0x471e69))[_0xe433('0x3f')](handleError(_0xd24d5,null));};exports[_0xe433('0x60')]=function(_0x4125cf,_0x3639f8,_0x552b04){var _0x489e57={};var _0x5f3ae1={};var _0x194b56;var _0x2f0d3e;return db[_0xe433('0x28')][_0xe433('0x52')]({'where':{'id':_0x4125cf['params']['id']}})[_0xe433('0x1f')](handleEntityNotFound(_0x3639f8,null))[_0xe433('0x1f')](function(_0x1d6c8d){if(_0x1d6c8d){_0x194b56=_0x1d6c8d;_0x5f3ae1[_0xe433('0x2a')]=_[_0xe433('0x2c')](db[_0xe433('0x61')][_0xe433('0x29')]);_0x5f3ae1[_0xe433('0x2b')]=_['keys'](_0x4125cf[_0xe433('0x2b')]);_0x5f3ae1[_0xe433('0x32')]=_[_0xe433('0x41')](_0x5f3ae1[_0xe433('0x2a')],_0x5f3ae1[_0xe433('0x2b')]);_0x489e57['attributes']=_[_0xe433('0x41')](_0x5f3ae1[_0xe433('0x2a')],qs['fields'](_0x4125cf['query'][_0xe433('0x2e')]));_0x489e57['attributes']=_0x489e57[_0xe433('0x2d')]['length']?_0x489e57[_0xe433('0x2d')]:_0x5f3ae1[_0xe433('0x2a')];_0x489e57['order']=qs[_0xe433('0x31')](_0x4125cf[_0xe433('0x2b')]['sort']);_0x489e57[_0xe433('0x35')]=qs['filters'](_['pick'](_0x4125cf[_0xe433('0x2b')],_0x5f3ae1[_0xe433('0x32')]));if(_0x4125cf[_0xe433('0x2b')][_0xe433('0x34')]){_0x489e57[_0xe433('0x35')]=_[_0xe433('0x36')](_0x489e57['where'],{'$or':_[_0xe433('0x37')](_0x489e57['attributes'],function(_0x3a52b3){var _0xa71556={};_0xa71556[_0x3a52b3]={'$like':'%'+_0x4125cf['query'][_0xe433('0x34')]+'%'};return _0xa71556;})});}_0x489e57=_[_0xe433('0x36')]({},_0x489e57,_0x4125cf['options']);return _0x194b56['getLists'](_0x489e57);}})['then'](function(_0x36f7cb){if(_0x36f7cb){_0x2f0d3e=_0x36f7cb[_0xe433('0x2f')];if(!_0x4125cf[_0xe433('0x2b')][_0xe433('0x59')](_0xe433('0x53'))){_0x489e57[_0xe433('0x30')]=qs[_0xe433('0x30')](_0x4125cf[_0xe433('0x2b')]['limit']);_0x489e57[_0xe433('0x1a')]=qs['offset'](_0x4125cf[_0xe433('0x2b')][_0xe433('0x1a')]);}return _0x194b56[_0xe433('0x60')](_0x489e57);}})[_0xe433('0x1f')](function(_0x354589){if(_0x354589){return _0x354589?{'count':_0x2f0d3e,'rows':_0x354589}:null;}})['then'](respondWithResult(_0x3639f8,null))[_0xe433('0x3f')](handleError(_0x3639f8,null));};exports[_0xe433('0x62')]=function(_0x90b79c,_0x50e4b9,_0x2f272a){var _0x467dd6,_0x112fd6;return db[_0xe433('0x28')][_0xe433('0x42')]({'where':{'id':_0x90b79c[_0xe433('0x4d')]['id']}})[_0xe433('0x1f')](handleEntityNotFound(_0x50e4b9,null))['then'](function(_0x43d316){if(_0x43d316){_0x112fd6=_0x43d316;return _0x43d316[_0xe433('0x62')](_0x90b79c[_0xe433('0x44')][_0xe433('0x63')],_[_0xe433('0x4f')](_0x90b79c[_0xe433('0x44')],[_0xe433('0x63'),'id'])||{});}return null;})[_0xe433('0x64')](function(_0x4d76fc){var _0x481498;_0x467dd6=_0x4d76fc||[];var _0x48c58a=[];if(_0x4d76fc){for(var _0x3502ca=0x0;_0x3502ca<_0x4d76fc[_0xe433('0x2f')];_0x3502ca+=0x1){var _0xbf316f=_0x4d76fc[_0x3502ca]['get']({'plain':!![]});_0x112fd6[_0xe433('0x65')]=_0x90b79c[_0xe433('0x44')][_0xe433('0x65')]?_0x90b79c[_0xe433('0x44')]['dialCheckDuplicateType']:_0x112fd6[_0xe433('0x65')];switch(_0x112fd6[_0xe433('0x65')]){case _0xe433('0x66'):_0x481498=squel[_0xe433('0x67')]()[_0xe433('0x68')]('cm_hopper')[_0xe433('0x69')]([_0xe433('0x6a'),'scheduledAt',_0xe433('0x6b'),_0xe433('0x6c'),_0xe433('0x5a'),_0xe433('0x6d'),_0xe433('0x4e')],squel['select']()[_0xe433('0x3a')](_0xe433('0x6a'),'phone')['field'](_0xe433('0x6e'),_0xe433('0x6f'))['field']('id','ContactId')[_0xe433('0x3a')](_0xbf316f[_0xe433('0x70')][_0xe433('0x71')](),'ListId')[_0xe433('0x3a')](_0x90b79c[_0xe433('0x4d')]['id'][_0xe433('0x71')](),'CampaignId')[_0xe433('0x3a')](_0xe433('0x6e'),_0xe433('0x6d'))[_0xe433('0x3a')]('NOW()',_0xe433('0x4e'))[_0xe433('0x72')]('cm_contacts')['where'](_0xe433('0x73'))[_0xe433('0x35')](_0xe433('0x74'),_0xbf316f['CmListId'][_0xe433('0x71')]())['where'](_0xe433('0x75'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xe433('0x76')]()[_0xe433('0x3a')](_0xe433('0x77'))[_0xe433('0x72')]('cm_hopper_final')['where'](_0xe433('0x78'),_0x90b79c[_0xe433('0x4d')]['id'][_0xe433('0x71')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xe433('0x3a')](_0xe433('0x6a'))[_0xe433('0x72')](_0xe433('0x79'))['where'](_0xe433('0x78'),_0x90b79c['params']['id'][_0xe433('0x71')]())))[_0xe433('0x71')]();break;case'onlyIfOpen':_0x481498=squel[_0xe433('0x67')]()[_0xe433('0x68')](_0xe433('0x79'))[_0xe433('0x69')]([_0xe433('0x6a'),'scheduledAt',_0xe433('0x6b'),_0xe433('0x6c'),_0xe433('0x5a'),_0xe433('0x6d'),_0xe433('0x4e')],squel[_0xe433('0x76')]()[_0xe433('0x3a')](_0xe433('0x6a'),_0xe433('0x6a'))[_0xe433('0x3a')](_0xe433('0x6e'),_0xe433('0x6f'))[_0xe433('0x3a')]('id',_0xe433('0x6b'))[_0xe433('0x3a')](_0xbf316f['CmListId'][_0xe433('0x71')](),_0xe433('0x6c'))['field'](_0x90b79c['params']['id'][_0xe433('0x71')](),_0xe433('0x5a'))[_0xe433('0x3a')](_0xe433('0x6e'),_0xe433('0x6d'))['field'](_0xe433('0x6e'),_0xe433('0x4e'))[_0xe433('0x72')](_0xe433('0x7a'))[_0xe433('0x35')]('deletedAt\x20IS\x20NULL')[_0xe433('0x35')](_0xe433('0x74'),_0xbf316f[_0xe433('0x70')][_0xe433('0x71')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xe433('0x35')](_0xe433('0x7b'),squel[_0xe433('0x76')]()[_0xe433('0x3a')](_0xe433('0x6a'))['from'](_0xe433('0x79'))['where'](_0xe433('0x78'),_0x90b79c[_0xe433('0x4d')]['id'][_0xe433('0x71')]())))[_0xe433('0x71')]();break;default:_0x481498=squel[_0xe433('0x67')]()[_0xe433('0x68')]('cm_hopper')[_0xe433('0x69')]([_0xe433('0x6a'),_0xe433('0x6f'),'ContactId',_0xe433('0x6c'),_0xe433('0x5a'),_0xe433('0x6d'),_0xe433('0x4e')],squel[_0xe433('0x76')]()['field'](_0xe433('0x6a'),_0xe433('0x6a'))[_0xe433('0x3a')](_0xe433('0x6e'),_0xe433('0x6f'))[_0xe433('0x3a')]('id','ContactId')[_0xe433('0x3a')](_0xbf316f[_0xe433('0x70')]['toString'](),_0xe433('0x6c'))[_0xe433('0x3a')](_0x90b79c[_0xe433('0x4d')]['id']['toString'](),_0xe433('0x5a'))[_0xe433('0x3a')](_0xe433('0x6e'),'createdAt')['field'](_0xe433('0x6e'),_0xe433('0x4e'))['from'](_0xe433('0x7a'))[_0xe433('0x35')](_0xe433('0x73'))[_0xe433('0x35')](_0xe433('0x74'),_0xbf316f[_0xe433('0x70')]['toString']())['where'](_0xe433('0x75')))[_0xe433('0x71')]();}_0x48c58a[_0xe433('0x7c')](db[_0xe433('0x7d')][_0xe433('0x2b')](_0x481498));}return BPromise['all'](_0x48c58a);}})['then'](function(){return _0x467dd6;})[_0xe433('0x1f')](respondWithResult(_0x50e4b9,null))[_0xe433('0x3f')](handleError(_0x50e4b9,null));};exports['removeLists']=function(_0x393632,_0x2be90a,_0x373642){var _0x517ac2;return db[_0xe433('0x28')]['find']({'where':{'id':_0x393632[_0xe433('0x4d')]['id']}})[_0xe433('0x1f')](handleEntityNotFound(_0x2be90a,null))[_0xe433('0x1f')](function(_0x57ce21){if(_0x57ce21){return _0x57ce21['removeLists'](_0x393632[_0xe433('0x2b')][_0xe433('0x63')]);}})[_0xe433('0x1f')](function(_0x11d89d){if(_0x11d89d){_0x517ac2=_0x11d89d;return db[_0xe433('0x55')][_0xe433('0x20')]({'where':{'ListId':_0x393632[_0xe433('0x2b')]['ids'],'CampaignId':_0x393632[_0xe433('0x4d')]['id']}})[_0xe433('0x1f')](function(){return _0x517ac2;});}})[_0xe433('0x1f')](respondWithStatusCode(_0x2be90a,null))['catch'](handleError(_0x2be90a,null));};exports[_0xe433('0x7e')]=function(_0x51a1b0,_0x37097e,_0x3eb57b){var _0x510963={'raw':!![],'where':{}};var _0x26bee2={};var _0x40a99d={'count':0x0,'rows':[]};return db[_0xe433('0x28')][_0xe433('0x52')]({'where':{'id':_0x51a1b0[_0xe433('0x4d')]['id']}})['then'](handleEntityNotFound(_0x37097e,null))[_0xe433('0x1f')](function(_0x48786b){if(_0x48786b){_0x26bee2[_0xe433('0x2a')]=_[_0xe433('0x2c')](db['CmList'][_0xe433('0x29')]);_0x26bee2[_0xe433('0x2b')]=_[_0xe433('0x2c')](_0x51a1b0[_0xe433('0x2b')]);_0x26bee2[_0xe433('0x32')]=_[_0xe433('0x41')](_0x26bee2['model'],_0x26bee2[_0xe433('0x2b')]);_0x510963[_0xe433('0x2d')]=_[_0xe433('0x41')](_0x26bee2[_0xe433('0x2a')],qs[_0xe433('0x2e')](_0x51a1b0[_0xe433('0x2b')]['fields']));_0x510963[_0xe433('0x2d')]=_0x510963[_0xe433('0x2d')][_0xe433('0x2f')]?_0x510963[_0xe433('0x2d')]:_0x26bee2['model'];if(!_0x51a1b0['query'][_0xe433('0x59')](_0xe433('0x53'))){_0x510963[_0xe433('0x30')]=qs[_0xe433('0x30')](_0x51a1b0['query'][_0xe433('0x30')]);_0x510963['offset']=qs[_0xe433('0x1a')](_0x51a1b0['query']['offset']);}_0x510963[_0xe433('0x54')]=qs['sort'](_0x51a1b0['query'][_0xe433('0x31')]);_0x510963[_0xe433('0x35')]=qs['filters'](_[_0xe433('0x33')](_0x51a1b0[_0xe433('0x2b')],_0x26bee2[_0xe433('0x32')]));_0x510963[_0xe433('0x35')][_0xe433('0x5a')]=_0x48786b['id'];if(_0x51a1b0['query']['filter']){_0x510963['where']=_['merge'](_0x510963['where'],{'$or':_['map'](_0x510963[_0xe433('0x2d')],function(_0x544d75){var _0x3b0f55={};_0x3b0f55[_0x544d75]={'$like':'%'+_0x51a1b0['query'][_0xe433('0x34')]+'%'};return _0x3b0f55;})});}_0x510963=_[_0xe433('0x36')]({},_0x510963,_0x51a1b0[_0xe433('0x3b')]);return db[_0xe433('0x61')][_0xe433('0x3c')]({'where':_0x510963[_0xe433('0x35')]})[_0xe433('0x1f')](function(_0x34ab20){_0x40a99d[_0xe433('0x3c')]=_0x34ab20;if(_0x51a1b0[_0xe433('0x2b')][_0xe433('0x3d')]){_0x510963['include']=[{'all':!![]}];}return db[_0xe433('0x61')][_0xe433('0x5b')](_0x510963);})[_0xe433('0x1f')](function(_0x12de9e){_0x40a99d[_0xe433('0x56')]=_0x12de9e;return _0x40a99d;});}})['then'](respondWithFilteredResult(_0x37097e,_0x510963))[_0xe433('0x3f')](handleError(_0x37097e,null));};exports['addBlackLists']=function(_0x5d3f58,_0x246a9d,_0x115513){var _0x588ad0,_0x4214f2;return db[_0xe433('0x28')]['find']({'where':{'id':_0x5d3f58[_0xe433('0x4d')]['id']}})[_0xe433('0x1f')](handleEntityNotFound(_0x246a9d,null))['then'](function(_0xf321b5){if(_0xf321b5){_0x4214f2=_0xf321b5;return _0xf321b5[_0xe433('0x7f')](_0x5d3f58[_0xe433('0x44')]['ids'],_[_0xe433('0x4f')](_0x5d3f58[_0xe433('0x44')],[_0xe433('0x63'),'id'])||{});}return null;})[_0xe433('0x64')](function(_0x593c04){var _0x1da330;_0x588ad0=_0x593c04||[];var _0x5c1338=[];if(_0x593c04){for(var _0x48ac84=0x0;_0x48ac84<_0x593c04[_0xe433('0x2f')];_0x48ac84+=0x1){var _0x366d4e=_0x593c04[_0x48ac84]['get']({'plain':!![]});_0x1da330=squel['insert']()[_0xe433('0x68')]('cm_hopper_black')[_0xe433('0x69')]([_0xe433('0x6a'),'ContactId','ListId',_0xe433('0x5a'),'createdAt',_0xe433('0x4e')],squel[_0xe433('0x76')]()[_0xe433('0x3a')](_0xe433('0x6a'),_0xe433('0x6a'))[_0xe433('0x3a')]('id',_0xe433('0x6b'))['field'](_0x366d4e[_0xe433('0x70')][_0xe433('0x71')](),_0xe433('0x6c'))[_0xe433('0x3a')](_0x5d3f58[_0xe433('0x4d')]['id'][_0xe433('0x71')](),_0xe433('0x5a'))['field'](_0xe433('0x6e'),_0xe433('0x6d'))[_0xe433('0x3a')](_0xe433('0x6e'),'updatedAt')[_0xe433('0x72')](_0xe433('0x7a'))[_0xe433('0x35')]('deletedAt\x20IS\x20NULL')[_0xe433('0x35')](_0xe433('0x74'),_0x366d4e[_0xe433('0x70')][_0xe433('0x71')]())[_0xe433('0x35')](_0xe433('0x75')))['toString']();_0x5c1338[_0xe433('0x7c')](db['sequelize'][_0xe433('0x2b')](_0x1da330));}return BPromise[_0xe433('0x80')](_0x5c1338);}})[_0xe433('0x1f')](function(){return _0x588ad0;})[_0xe433('0x1f')](respondWithResult(_0x246a9d,null))[_0xe433('0x3f')](handleError(_0x246a9d,null));};exports[_0xe433('0x81')]=function(_0x5dfd40,_0x2426d4,_0x3db6f2){var _0x4d60b6;return db[_0xe433('0x28')][_0xe433('0x42')]({'where':{'id':_0x5dfd40[_0xe433('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2426d4,null))[_0xe433('0x1f')](function(_0x33ff30){if(_0x33ff30){return _0x33ff30['removeBlackLists'](_0x5dfd40[_0xe433('0x2b')][_0xe433('0x63')]);}})[_0xe433('0x1f')](function(_0x52bbef){if(_0x52bbef){_0x4d60b6=_0x52bbef;return db[_0xe433('0x5f')]['destroy']({'where':{'ListId':_0x5dfd40[_0xe433('0x2b')]['ids'],'CampaignId':_0x5dfd40[_0xe433('0x4d')]['id']}})['then'](function(){return _0x4d60b6;});}})[_0xe433('0x1f')](respondWithStatusCode(_0x2426d4,null))[_0xe433('0x3f')](handleError(_0x2426d4,null));};
\ No newline at end of file
+var _0xc71c=['getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','NOW()','CmListId','ListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','push','sequelize','all','removeLists','addBlackLists','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','crypto','desk.js','papaparse','../../config/license/hardware','ioredis','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','then','get','IvrCampaigns','error','stack','name','send','index','Campaign','rawAttributes','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','field','options','includeAll','include','findAll','rows','params','keys','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','UserProfileSection','autoAssociation','getHoppers','findOne','CmHopper','getHopperHistories','pick','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal'];(function(_0x137448,_0x34711f){var _0x5f2c1b=function(_0x57d176){while(--_0x57d176){_0x137448['push'](_0x137448['shift']());}};_0x5f2c1b(++_0x34711f);}(_0xc71c,0x198));var _0xcc71=function(_0x40dbdf,_0x2b9389){_0x40dbdf=_0x40dbdf-0x0;var _0x33e0ae=_0xc71c[_0x40dbdf];return _0x33e0ae;};'use strict';var pdf=require(_0xcc71('0x0'));var emlformat=require(_0xcc71('0x1'));var rimraf=require(_0xcc71('0x2'));var zipdir=require(_0xcc71('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc71('0x4'));var moment=require(_0xcc71('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcc71('0x6'));var path=require(_0xcc71('0x7'));var sox=require(_0xcc71('0x8'));var csv=require(_0xcc71('0x9'));var ejs=require(_0xcc71('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xcc71('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xcc71('0xc'));var toCsv=require(_0xcc71('0x9'));var querystring=require('querystring');var Papa=require(_0xcc71('0xd'));var authService=require('../../components/auth/service');var hardwareService=require(_0xcc71('0xe'));var Redis=require(_0xcc71('0xf'));var qs=require('../../components/parsers/qs');var logger=require(_0xcc71('0x10'))('api');var utils=require(_0xcc71('0x11'));var config=require('../../config/environment');var db=require(_0xcc71('0x12'))['db'];function respondWithStatusCode(_0x46d0bd,_0xb5ae6){_0xb5ae6=_0xb5ae6||0xcc;return function(_0x4b1179){if(_0x4b1179){return _0x46d0bd[_0xcc71('0x13')](_0xb5ae6);}return _0x46d0bd[_0xcc71('0x14')](_0xb5ae6)[_0xcc71('0x15')]();};}function respondWithResult(_0xab7494,_0x2d9bd5){_0x2d9bd5=_0x2d9bd5||0xc8;return function(_0x121898){if(_0x121898){return _0xab7494[_0xcc71('0x14')](_0x2d9bd5)['json'](_0x121898);}};}function respondWithFilteredResult(_0x3d4e0f,_0x44191d){return function(_0x11b8c5){if(_0x11b8c5){var _0x275b34=_0x11b8c5[_0xcc71('0x16')],_0x2eb0cd=_0x44191d[_0xcc71('0x17')],_0x531342=_0x44191d[_0xcc71('0x17')]+_0x44191d[_0xcc71('0x18')],_0x4d34d4;if(_0x531342>=_0x275b34){_0x531342=_0x275b34;_0x4d34d4=0xc8;}else{_0x4d34d4=0xce;}_0x3d4e0f['status'](_0x4d34d4);return _0x3d4e0f[_0xcc71('0x19')](_0xcc71('0x1a'),_0x2eb0cd+'-'+_0x531342+'/'+_0x275b34)[_0xcc71('0x1b')](_0x11b8c5);}return null;};}function patchUpdates(_0x3f578f){return function(_0x2ebdef){try{jsonpatch[_0xcc71('0x1c')](_0x2ebdef,_0x3f578f,!![]);}catch(_0xfb66ae){return BPromise[_0xcc71('0x1d')](_0xfb66ae);}return _0x2ebdef['save']();};}function saveUpdates(_0x44074b,_0x11841b){return function(_0x1830ad){if(_0x1830ad){return _0x1830ad[_0xcc71('0x1e')](_0x44074b)['then'](function(_0x1240b5){return _0x1240b5;});}return null;};}function removeEntity(_0xfb8043,_0x2d77c7){return function(_0xe8164d){if(_0xe8164d){return _0xe8164d[_0xcc71('0x1f')]()[_0xcc71('0x20')](function(){var _0x261c1a=_0xe8164d[_0xcc71('0x21')]({'plain':!![]});var _0x1cffce=_0xcc71('0x22');return db['UserProfileResource'][_0xcc71('0x1f')]({'where':{'type':_0x1cffce,'resourceId':_0x261c1a['id']}})[_0xcc71('0x20')](function(){return _0xe8164d;});})[_0xcc71('0x20')](function(){_0xfb8043[_0xcc71('0x14')](0xcc)[_0xcc71('0x15')]();});}};}function handleEntityNotFound(_0x5206bc,_0x330304){return function(_0x58f658){if(!_0x58f658){_0x5206bc[_0xcc71('0x13')](0x194);}return _0x58f658;};}function handleError(_0x131525,_0x3de72a){_0x3de72a=_0x3de72a||0x1f4;return function(_0xa2f1be){logger[_0xcc71('0x23')](_0xa2f1be[_0xcc71('0x24')]);if(_0xa2f1be['name']){delete _0xa2f1be[_0xcc71('0x25')];}_0x131525[_0xcc71('0x14')](_0x3de72a)[_0xcc71('0x26')](_0xa2f1be);};}exports[_0xcc71('0x27')]=function(_0x304ace,_0x4c4198){var _0x7fd537={},_0x3e705c={},_0x566a3f={'count':0x0,'rows':[]};var _0x3f3839=db[_0xcc71('0x28')][_0xcc71('0x29')];_0x3e705c['model']=_['keys'](_0x3f3839);_0x3e705c[_0xcc71('0x2a')]=_['keys'](_0x304ace[_0xcc71('0x2a')]);_0x3e705c[_0xcc71('0x2b')]=_[_0xcc71('0x2c')](_0x3e705c['model'],_0x3e705c[_0xcc71('0x2a')]);_0x7fd537[_0xcc71('0x2d')]=_[_0xcc71('0x2c')](_0x3e705c[_0xcc71('0x2e')],qs[_0xcc71('0x2f')](_0x304ace[_0xcc71('0x2a')][_0xcc71('0x2f')]));_0x7fd537[_0xcc71('0x2d')]=_0x7fd537[_0xcc71('0x2d')][_0xcc71('0x30')]?_0x7fd537[_0xcc71('0x2d')]:_0x3e705c[_0xcc71('0x2e')];if(!_0x304ace[_0xcc71('0x2a')][_0xcc71('0x31')](_0xcc71('0x32'))){_0x7fd537['limit']=qs['limit'](_0x304ace[_0xcc71('0x2a')]['limit']);_0x7fd537[_0xcc71('0x17')]=qs['offset'](_0x304ace['query']['offset']);}_0x7fd537[_0xcc71('0x33')]=qs[_0xcc71('0x34')](_0x304ace[_0xcc71('0x2a')]['sort']);_0x7fd537[_0xcc71('0x35')]=qs[_0xcc71('0x2b')](_['pick'](_0x304ace['query'],_0x3e705c[_0xcc71('0x2b')]));if(_0x304ace[_0xcc71('0x2a')][_0xcc71('0x36')]){_0x7fd537[_0xcc71('0x35')]=_[_0xcc71('0x37')](_0x7fd537[_0xcc71('0x35')],{'$or':_[_0xcc71('0x38')](_0x3f3839,function(_0x1a23d7){if(_0x1a23d7['type']['key']!=='VIRTUAL'){var _0x712371={};_0x712371[_0x1a23d7[_0xcc71('0x39')]]={'$like':'%'+_0x304ace[_0xcc71('0x2a')]['filter']+'%'};return _0x712371;}})});}_0x7fd537=_[_0xcc71('0x37')]({},_0x7fd537,_0x304ace[_0xcc71('0x3a')]);var _0x46062e={'where':_0x7fd537[_0xcc71('0x35')]};return db[_0xcc71('0x28')][_0xcc71('0x16')](_0x46062e)[_0xcc71('0x20')](function(_0x58f42e){_0x566a3f[_0xcc71('0x16')]=_0x58f42e;if(_0x304ace[_0xcc71('0x2a')][_0xcc71('0x3b')]){_0x7fd537[_0xcc71('0x3c')]=[{'all':!![]}];}return db['Campaign'][_0xcc71('0x3d')](_0x7fd537);})['then'](function(_0xa36254){_0x566a3f[_0xcc71('0x3e')]=_0xa36254;return _0x566a3f;})[_0xcc71('0x20')](respondWithFilteredResult(_0x4c4198,_0x7fd537))['catch'](handleError(_0x4c4198,null));};exports['show']=function(_0x7da7f5,_0x28bc8d){var _0x4db26a={'raw':![],'where':{'id':_0x7da7f5[_0xcc71('0x3f')]['id']}},_0x4525fa={};_0x4525fa[_0xcc71('0x2e')]=_['keys'](db[_0xcc71('0x28')][_0xcc71('0x29')]);_0x4525fa[_0xcc71('0x2a')]=_[_0xcc71('0x40')](_0x7da7f5[_0xcc71('0x2a')]);_0x4525fa[_0xcc71('0x2b')]=_[_0xcc71('0x2c')](_0x4525fa[_0xcc71('0x2e')],_0x4525fa[_0xcc71('0x2a')]);_0x4db26a[_0xcc71('0x2d')]=_[_0xcc71('0x2c')](_0x4525fa[_0xcc71('0x2e')],qs[_0xcc71('0x2f')](_0x7da7f5[_0xcc71('0x2a')]['fields']));_0x4db26a['attributes']=_0x4db26a['attributes'][_0xcc71('0x30')]?_0x4db26a['attributes']:_0x4525fa[_0xcc71('0x2e')];if(_0x7da7f5[_0xcc71('0x2a')][_0xcc71('0x3b')]){_0x4db26a['include']=[{'all':!![]}];}_0x4db26a=_[_0xcc71('0x37')]({},_0x4db26a,_0x7da7f5[_0xcc71('0x3a')]);return db[_0xcc71('0x28')]['find'](_0x4db26a)[_0xcc71('0x20')](handleEntityNotFound(_0x28bc8d,null))[_0xcc71('0x20')](respondWithResult(_0x28bc8d,null))[_0xcc71('0x41')](handleError(_0x28bc8d,null));};exports[_0xcc71('0x42')]=function(_0x45cb3a,_0x1666d9){return db[_0xcc71('0x28')][_0xcc71('0x42')](_0x45cb3a[_0xcc71('0x43')],{})[_0xcc71('0x20')](function(_0x1f7196){var _0x3ade9a=_0x45cb3a['user'][_0xcc71('0x21')]({'plain':!![]});if(!_0x3ade9a)throw new Error(_0xcc71('0x44'));if(_0x3ade9a[_0xcc71('0x45')]===_0xcc71('0x46')){var _0x2ccc9e=_0x1f7196[_0xcc71('0x21')]({'plain':!![]});var _0x6eb443=_0xcc71('0x22');return db['UserProfileSection'][_0xcc71('0x47')]({'where':{'name':_0x6eb443,'userProfileId':_0x3ade9a[_0xcc71('0x48')]},'raw':!![]})[_0xcc71('0x20')](function(_0x3b5821){if(_0x3b5821&&_0x3b5821['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2ccc9e[_0xcc71('0x25')],'resourceId':_0x2ccc9e['id'],'type':_0x3b5821[_0xcc71('0x25')],'sectionId':_0x3b5821['id']},{})[_0xcc71('0x20')](function(){return _0x1f7196;});}else{return _0x1f7196;}})['catch'](function(_0x62573b){logger[_0xcc71('0x23')](_0xcc71('0x49'),_0x62573b);throw _0x62573b;});}return _0x1f7196;})[_0xcc71('0x20')](respondWithResult(_0x1666d9,0xc9))['catch'](handleError(_0x1666d9,null));};exports['clone']=function(_0x5432a8,_0x2ed66f){var _0x1acd04={'raw':![],'where':{'id':_0x5432a8[_0xcc71('0x3f')]['id']}},_0x5dc845={};_0x5dc845['model']=_['keys'](db[_0xcc71('0x28')]['rawAttributes']);_0x1acd04[_0xcc71('0x2d')]=_[_0xcc71('0x2c')](_0x5dc845['model'],qs[_0xcc71('0x2f')](_0x5432a8[_0xcc71('0x2a')][_0xcc71('0x2f')]));_0x1acd04[_0xcc71('0x2d')]=_0x1acd04['attributes'][_0xcc71('0x30')]?_0x1acd04[_0xcc71('0x2d')]:_0x5dc845[_0xcc71('0x2e')];if(_0x5432a8[_0xcc71('0x2a')][_0xcc71('0x3b')]){_0x1acd04[_0xcc71('0x3c')]=[{'all':!![]}];}_0x1acd04=_[_0xcc71('0x37')]({},_0x1acd04,_0x5432a8['options']);return db[_0xcc71('0x28')][_0xcc71('0x47')](_0x1acd04)[_0xcc71('0x20')](handleEntityNotFound(_0x2ed66f,null))[_0xcc71('0x20')](function(_0x1c5e27){if(_0x1c5e27){var _0x1d395b=_0x1c5e27[_0xcc71('0x21')]({'plain':!![]});_0x1d395b=qs[_0xcc71('0x4a')](_0x1d395b,['id',_0xcc71('0x4b'),_0xcc71('0x4c')]);_0x5432a8[_0xcc71('0x43')]=_['omit'](_0x5432a8['body'],['id',_0xcc71('0x4b'),'updatedAt']);return db['Campaign'][_0xcc71('0x42')](_[_0xcc71('0x37')](_0x1d395b,_0x5432a8[_0xcc71('0x43')]),{'include':_0x5432a8['query'][_0xcc71('0x3b')]?[{'all':!![]}]:undefined})['then'](function(_0x3048d4){var _0x2974ab=_0x5432a8[_0xcc71('0x46')][_0xcc71('0x21')]({'plain':!![]});if(!_0x2974ab)throw new Error(_0xcc71('0x44'));if(_0x2974ab[_0xcc71('0x45')]===_0xcc71('0x46')){var _0x25dc37=_0x3048d4[_0xcc71('0x21')]({'plain':!![]});var _0x21161b='IvrCampaigns';return db[_0xcc71('0x4d')][_0xcc71('0x47')]({'where':{'name':_0x21161b,'userProfileId':_0x2974ab['userProfileId']},'raw':!![]})[_0xcc71('0x20')](function(_0x2d5baa){if(_0x2d5baa&&_0x2d5baa[_0xcc71('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x25dc37[_0xcc71('0x25')],'resourceId':_0x25dc37['id'],'type':_0x2d5baa[_0xcc71('0x25')],'sectionId':_0x2d5baa['id']},{})[_0xcc71('0x20')](function(){return _0x3048d4;});}else{return _0x3048d4;}})[_0xcc71('0x41')](function(_0x3bf8b6){logger[_0xcc71('0x23')](_0xcc71('0x49'),_0x3bf8b6);throw _0x3bf8b6;});}return _0x3048d4;});}})['then'](respondWithResult(_0x2ed66f,0xc9))[_0xcc71('0x41')](handleError(_0x2ed66f,null));};exports[_0xcc71('0x1e')]=function(_0x3412f1,_0x5c51a5){if(_0x3412f1[_0xcc71('0x43')]['id']){delete _0x3412f1[_0xcc71('0x43')]['id'];}return db[_0xcc71('0x28')][_0xcc71('0x47')]({'where':{'id':_0x3412f1['params']['id']}})[_0xcc71('0x20')](handleEntityNotFound(_0x5c51a5,null))[_0xcc71('0x20')](saveUpdates(_0x3412f1[_0xcc71('0x43')],null))[_0xcc71('0x20')](respondWithResult(_0x5c51a5,null))['catch'](handleError(_0x5c51a5,null));};exports[_0xcc71('0x1f')]=function(_0x46dab8,_0x361cb3){return db[_0xcc71('0x28')][_0xcc71('0x47')]({'where':{'id':_0x46dab8[_0xcc71('0x3f')]['id']}})[_0xcc71('0x20')](handleEntityNotFound(_0x361cb3,null))[_0xcc71('0x20')](removeEntity(_0x361cb3,null))[_0xcc71('0x41')](handleError(_0x361cb3,null));};exports[_0xcc71('0x4f')]=function(_0xfe39f1,_0xc55042,_0x1f1dcd){var _0x580ac0={'raw':!![],'where':{}};var _0x36e7ad={};var _0x2efc6a={'count':0x0,'rows':[]};return db[_0xcc71('0x28')][_0xcc71('0x50')]({'where':{'id':_0xfe39f1['params']['id']}})[_0xcc71('0x20')](handleEntityNotFound(_0xc55042,null))[_0xcc71('0x20')](function(_0x41e4b5){if(_0x41e4b5){_0x36e7ad['model']=_['keys'](db[_0xcc71('0x51')][_0xcc71('0x29')]);_0x36e7ad[_0xcc71('0x2a')]=_[_0xcc71('0x40')](_0xfe39f1[_0xcc71('0x2a')]);_0x36e7ad[_0xcc71('0x2b')]=_[_0xcc71('0x2c')](_0x36e7ad['model'],_0x36e7ad[_0xcc71('0x2a')]);_0x580ac0['attributes']=_[_0xcc71('0x2c')](_0x36e7ad[_0xcc71('0x2e')],qs[_0xcc71('0x2f')](_0xfe39f1[_0xcc71('0x2a')]['fields']));_0x580ac0[_0xcc71('0x2d')]=_0x580ac0[_0xcc71('0x2d')]['length']?_0x580ac0['attributes']:_0x36e7ad[_0xcc71('0x2e')];if(!_0xfe39f1[_0xcc71('0x2a')][_0xcc71('0x31')](_0xcc71('0x32'))){_0x580ac0['limit']=qs['limit'](_0xfe39f1['query'][_0xcc71('0x18')]);_0x580ac0[_0xcc71('0x17')]=qs['offset'](_0xfe39f1['query'][_0xcc71('0x17')]);}_0x580ac0[_0xcc71('0x33')]=qs[_0xcc71('0x34')](_0xfe39f1[_0xcc71('0x2a')][_0xcc71('0x34')]);_0x580ac0[_0xcc71('0x35')]=qs[_0xcc71('0x2b')](_['pick'](_0xfe39f1[_0xcc71('0x2a')],_0x36e7ad['filters']));_0x580ac0[_0xcc71('0x35')]['CampaignId']=_0x41e4b5['id'];if(_0xfe39f1[_0xcc71('0x2a')][_0xcc71('0x36')]){_0x580ac0[_0xcc71('0x35')]=_[_0xcc71('0x37')](_0x580ac0['where'],{'$or':_[_0xcc71('0x38')](_0x580ac0[_0xcc71('0x2d')],function(_0x5969f3){var _0x2dff5e={};_0x2dff5e[_0x5969f3]={'$like':'%'+_0xfe39f1[_0xcc71('0x2a')][_0xcc71('0x36')]+'%'};return _0x2dff5e;})});}_0x580ac0=_['merge']({},_0x580ac0,_0xfe39f1[_0xcc71('0x3a')]);return db[_0xcc71('0x51')]['count']({'where':_0x580ac0[_0xcc71('0x35')]})['then'](function(_0x5beaaf){_0x2efc6a[_0xcc71('0x16')]=_0x5beaaf;if(_0xfe39f1[_0xcc71('0x2a')][_0xcc71('0x3b')]){_0x580ac0[_0xcc71('0x3c')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x580ac0);})[_0xcc71('0x20')](function(_0x2b7ee0){_0x2efc6a[_0xcc71('0x3e')]=_0x2b7ee0;return _0x2efc6a;});}})[_0xcc71('0x20')](respondWithFilteredResult(_0xc55042,_0x580ac0))[_0xcc71('0x41')](handleError(_0xc55042,null));};exports[_0xcc71('0x52')]=function(_0x2d572b,_0x55e914,_0x23e0d2){var _0x3cbec9={'raw':!![],'where':{}};var _0x237cf5={};var _0xec0786={'count':0x0,'rows':[]};return db[_0xcc71('0x28')][_0xcc71('0x50')]({'where':{'id':_0x2d572b['params']['id']}})[_0xcc71('0x20')](handleEntityNotFound(_0x55e914,null))[_0xcc71('0x20')](function(_0x18a369){if(_0x18a369){_0x237cf5['model']=_[_0xcc71('0x40')](db['CmHopperHistory'][_0xcc71('0x29')]);_0x237cf5[_0xcc71('0x2a')]=_[_0xcc71('0x40')](_0x2d572b[_0xcc71('0x2a')]);_0x237cf5[_0xcc71('0x2b')]=_[_0xcc71('0x2c')](_0x237cf5[_0xcc71('0x2e')],_0x237cf5['query']);_0x3cbec9[_0xcc71('0x2d')]=_[_0xcc71('0x2c')](_0x237cf5[_0xcc71('0x2e')],qs[_0xcc71('0x2f')](_0x2d572b[_0xcc71('0x2a')][_0xcc71('0x2f')]));_0x3cbec9[_0xcc71('0x2d')]=_0x3cbec9[_0xcc71('0x2d')][_0xcc71('0x30')]?_0x3cbec9[_0xcc71('0x2d')]:_0x237cf5[_0xcc71('0x2e')];if(!_0x2d572b['query']['hasOwnProperty'](_0xcc71('0x32'))){_0x3cbec9[_0xcc71('0x18')]=qs['limit'](_0x2d572b[_0xcc71('0x2a')][_0xcc71('0x18')]);_0x3cbec9[_0xcc71('0x17')]=qs['offset'](_0x2d572b['query'][_0xcc71('0x17')]);}_0x3cbec9[_0xcc71('0x33')]=qs[_0xcc71('0x34')](_0x2d572b[_0xcc71('0x2a')][_0xcc71('0x34')]);_0x3cbec9[_0xcc71('0x35')]=qs[_0xcc71('0x2b')](_[_0xcc71('0x53')](_0x2d572b[_0xcc71('0x2a')],_0x237cf5[_0xcc71('0x2b')]));_0x3cbec9[_0xcc71('0x35')][_0xcc71('0x54')]=_0x18a369['id'];if(_0x2d572b['query'][_0xcc71('0x36')]){_0x3cbec9[_0xcc71('0x35')]=_['merge'](_0x3cbec9[_0xcc71('0x35')],{'$or':_[_0xcc71('0x38')](_0x3cbec9['attributes'],function(_0x1da066){var _0x14ed19={};_0x14ed19[_0x1da066]={'$like':'%'+_0x2d572b[_0xcc71('0x2a')][_0xcc71('0x36')]+'%'};return _0x14ed19;})});}_0x3cbec9=_[_0xcc71('0x37')]({},_0x3cbec9,_0x2d572b[_0xcc71('0x3a')]);return db['CmHopperHistory'][_0xcc71('0x16')]({'where':_0x3cbec9['where']})[_0xcc71('0x20')](function(_0x59e597){_0xec0786[_0xcc71('0x16')]=_0x59e597;if(_0x2d572b[_0xcc71('0x2a')][_0xcc71('0x3b')]){_0x3cbec9['include']=[{'all':!![]}];}return db[_0xcc71('0x55')][_0xcc71('0x3d')](_0x3cbec9);})['then'](function(_0x5b9215){_0xec0786[_0xcc71('0x3e')]=_0x5b9215;return _0xec0786;});}})['then'](respondWithFilteredResult(_0x55e914,_0x3cbec9))[_0xcc71('0x41')](handleError(_0x55e914,null));};exports[_0xcc71('0x56')]=function(_0x5bb40c,_0x23ab69,_0x59ff53){var _0x15760e={'raw':!![],'where':{}};var _0x3692cf={};var _0x3fa2a9={'count':0x0,'rows':[]};return db[_0xcc71('0x28')][_0xcc71('0x50')]({'where':{'id':_0x5bb40c[_0xcc71('0x3f')]['id']}})[_0xcc71('0x20')](handleEntityNotFound(_0x23ab69,null))['then'](function(_0x132ee0){if(_0x132ee0){_0x3692cf['model']=_[_0xcc71('0x40')](db[_0xcc71('0x57')][_0xcc71('0x29')]);_0x3692cf['query']=_['keys'](_0x5bb40c['query']);_0x3692cf[_0xcc71('0x2b')]=_['intersection'](_0x3692cf[_0xcc71('0x2e')],_0x3692cf[_0xcc71('0x2a')]);_0x15760e[_0xcc71('0x2d')]=_['intersection'](_0x3692cf[_0xcc71('0x2e')],qs[_0xcc71('0x2f')](_0x5bb40c[_0xcc71('0x2a')][_0xcc71('0x2f')]));_0x15760e[_0xcc71('0x2d')]=_0x15760e[_0xcc71('0x2d')][_0xcc71('0x30')]?_0x15760e[_0xcc71('0x2d')]:_0x3692cf[_0xcc71('0x2e')];if(!_0x5bb40c[_0xcc71('0x2a')][_0xcc71('0x31')](_0xcc71('0x32'))){_0x15760e[_0xcc71('0x18')]=qs[_0xcc71('0x18')](_0x5bb40c[_0xcc71('0x2a')][_0xcc71('0x18')]);_0x15760e['offset']=qs[_0xcc71('0x17')](_0x5bb40c[_0xcc71('0x2a')][_0xcc71('0x17')]);}_0x15760e[_0xcc71('0x33')]=qs[_0xcc71('0x34')](_0x5bb40c['query'][_0xcc71('0x34')]);_0x15760e[_0xcc71('0x35')]=qs[_0xcc71('0x2b')](_[_0xcc71('0x53')](_0x5bb40c[_0xcc71('0x2a')],_0x3692cf[_0xcc71('0x2b')]));_0x15760e[_0xcc71('0x35')][_0xcc71('0x54')]=_0x132ee0['id'];if(_0x5bb40c['query']['filter']){_0x15760e[_0xcc71('0x35')]=_[_0xcc71('0x37')](_0x15760e[_0xcc71('0x35')],{'$or':_[_0xcc71('0x38')](_0x15760e[_0xcc71('0x2d')],function(_0x700155){var _0x20d5ac={};_0x20d5ac[_0x700155]={'$like':'%'+_0x5bb40c['query'][_0xcc71('0x36')]+'%'};return _0x20d5ac;})});}_0x15760e=_[_0xcc71('0x37')]({},_0x15760e,_0x5bb40c[_0xcc71('0x3a')]);return db[_0xcc71('0x57')][_0xcc71('0x16')]({'where':_0x15760e[_0xcc71('0x35')]})['then'](function(_0x28516d){_0x3fa2a9[_0xcc71('0x16')]=_0x28516d;if(_0x5bb40c[_0xcc71('0x2a')][_0xcc71('0x3b')]){_0x15760e[_0xcc71('0x3c')]=[{'all':!![]}];}return db[_0xcc71('0x57')]['findAll'](_0x15760e);})[_0xcc71('0x20')](function(_0x1b2028){_0x3fa2a9[_0xcc71('0x3e')]=_0x1b2028;return _0x3fa2a9;});}})[_0xcc71('0x20')](respondWithFilteredResult(_0x23ab69,_0x15760e))[_0xcc71('0x41')](handleError(_0x23ab69,null));};exports[_0xcc71('0x58')]=function(_0x343b68,_0x40c137,_0x37e040){var _0x3aa72a={'raw':!![],'where':{}};var _0x261157={};var _0x2eb1f9={'count':0x0,'rows':[]};return db[_0xcc71('0x28')][_0xcc71('0x50')]({'where':{'id':_0x343b68[_0xcc71('0x3f')]['id']}})[_0xcc71('0x20')](handleEntityNotFound(_0x40c137,null))[_0xcc71('0x20')](function(_0x184e8f){if(_0x184e8f){_0x261157[_0xcc71('0x2e')]=_['keys'](db[_0xcc71('0x59')][_0xcc71('0x29')]);_0x261157['query']=_[_0xcc71('0x40')](_0x343b68['query']);_0x261157['filters']=_['intersection'](_0x261157[_0xcc71('0x2e')],_0x261157['query']);_0x3aa72a[_0xcc71('0x2d')]=_[_0xcc71('0x2c')](_0x261157[_0xcc71('0x2e')],qs[_0xcc71('0x2f')](_0x343b68[_0xcc71('0x2a')][_0xcc71('0x2f')]));_0x3aa72a[_0xcc71('0x2d')]=_0x3aa72a['attributes'][_0xcc71('0x30')]?_0x3aa72a[_0xcc71('0x2d')]:_0x261157['model'];if(!_0x343b68['query'][_0xcc71('0x31')](_0xcc71('0x32'))){_0x3aa72a[_0xcc71('0x18')]=qs[_0xcc71('0x18')](_0x343b68[_0xcc71('0x2a')][_0xcc71('0x18')]);_0x3aa72a[_0xcc71('0x17')]=qs[_0xcc71('0x17')](_0x343b68[_0xcc71('0x2a')][_0xcc71('0x17')]);}_0x3aa72a[_0xcc71('0x33')]=qs['sort'](_0x343b68[_0xcc71('0x2a')]['sort']);_0x3aa72a[_0xcc71('0x35')]=qs['filters'](_[_0xcc71('0x53')](_0x343b68[_0xcc71('0x2a')],_0x261157['filters']));_0x3aa72a[_0xcc71('0x35')]['CampaignId']=_0x184e8f['id'];if(_0x343b68[_0xcc71('0x2a')][_0xcc71('0x36')]){_0x3aa72a[_0xcc71('0x35')]=_[_0xcc71('0x37')](_0x3aa72a['where'],{'$or':_[_0xcc71('0x38')](_0x3aa72a[_0xcc71('0x2d')],function(_0x242973){var _0x3815f1={};_0x3815f1[_0x242973]={'$like':'%'+_0x343b68[_0xcc71('0x2a')]['filter']+'%'};return _0x3815f1;})});}_0x3aa72a=_['merge']({},_0x3aa72a,_0x343b68['options']);return db[_0xcc71('0x59')]['count']({'where':_0x3aa72a['where']})[_0xcc71('0x20')](function(_0x18f900){_0x2eb1f9['count']=_0x18f900;if(_0x343b68[_0xcc71('0x2a')][_0xcc71('0x3b')]){_0x3aa72a[_0xcc71('0x3c')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xcc71('0x3d')](_0x3aa72a);})[_0xcc71('0x20')](function(_0x2e307d){_0x2eb1f9['rows']=_0x2e307d;return _0x2eb1f9;});}})[_0xcc71('0x20')](respondWithFilteredResult(_0x40c137,_0x3aa72a))[_0xcc71('0x41')](handleError(_0x40c137,null));};exports[_0xcc71('0x5a')]=function(_0x552f2,_0x3d61b2,_0x138ecc){var _0xb71bfa={};var _0x5f4a02={};var _0x53ea9b;var _0x54d026;return db[_0xcc71('0x28')][_0xcc71('0x50')]({'where':{'id':_0x552f2[_0xcc71('0x3f')]['id']}})[_0xcc71('0x20')](handleEntityNotFound(_0x3d61b2,null))['then'](function(_0x440522){if(_0x440522){_0x53ea9b=_0x440522;_0x5f4a02[_0xcc71('0x2e')]=_['keys'](db[_0xcc71('0x5b')][_0xcc71('0x29')]);_0x5f4a02[_0xcc71('0x2a')]=_[_0xcc71('0x40')](_0x552f2[_0xcc71('0x2a')]);_0x5f4a02[_0xcc71('0x2b')]=_[_0xcc71('0x2c')](_0x5f4a02['model'],_0x5f4a02[_0xcc71('0x2a')]);_0xb71bfa[_0xcc71('0x2d')]=_[_0xcc71('0x2c')](_0x5f4a02['model'],qs[_0xcc71('0x2f')](_0x552f2[_0xcc71('0x2a')]['fields']));_0xb71bfa[_0xcc71('0x2d')]=_0xb71bfa[_0xcc71('0x2d')][_0xcc71('0x30')]?_0xb71bfa[_0xcc71('0x2d')]:_0x5f4a02['model'];_0xb71bfa['order']=qs[_0xcc71('0x34')](_0x552f2['query'][_0xcc71('0x34')]);_0xb71bfa[_0xcc71('0x35')]=qs[_0xcc71('0x2b')](_[_0xcc71('0x53')](_0x552f2[_0xcc71('0x2a')],_0x5f4a02[_0xcc71('0x2b')]));if(_0x552f2['query']['filter']){_0xb71bfa[_0xcc71('0x35')]=_[_0xcc71('0x37')](_0xb71bfa[_0xcc71('0x35')],{'$or':_[_0xcc71('0x38')](_0xb71bfa['attributes'],function(_0x22d083){var _0xa924cd={};_0xa924cd[_0x22d083]={'$like':'%'+_0x552f2[_0xcc71('0x2a')]['filter']+'%'};return _0xa924cd;})});}_0xb71bfa=_[_0xcc71('0x37')]({},_0xb71bfa,_0x552f2[_0xcc71('0x3a')]);return _0x53ea9b[_0xcc71('0x5a')](_0xb71bfa);}})[_0xcc71('0x20')](function(_0x40522d){if(_0x40522d){_0x54d026=_0x40522d[_0xcc71('0x30')];if(!_0x552f2[_0xcc71('0x2a')][_0xcc71('0x31')](_0xcc71('0x32'))){_0xb71bfa['limit']=qs[_0xcc71('0x18')](_0x552f2['query'][_0xcc71('0x18')]);_0xb71bfa[_0xcc71('0x17')]=qs[_0xcc71('0x17')](_0x552f2[_0xcc71('0x2a')][_0xcc71('0x17')]);}return _0x53ea9b[_0xcc71('0x5a')](_0xb71bfa);}})[_0xcc71('0x20')](function(_0x4b87a7){if(_0x4b87a7){return _0x4b87a7?{'count':_0x54d026,'rows':_0x4b87a7}:null;}})['then'](respondWithResult(_0x3d61b2,null))[_0xcc71('0x41')](handleError(_0x3d61b2,null));};exports[_0xcc71('0x5c')]=function(_0x31f190,_0x33e143,_0x3be028){var _0x2a3748,_0x560bf8;return db[_0xcc71('0x28')][_0xcc71('0x47')]({'where':{'id':_0x31f190['params']['id']}})[_0xcc71('0x20')](handleEntityNotFound(_0x33e143,null))['then'](function(_0x59265b){if(_0x59265b){_0x560bf8=_0x59265b;return _0x59265b[_0xcc71('0x5c')](_0x31f190[_0xcc71('0x43')][_0xcc71('0x5d')],_[_0xcc71('0x4a')](_0x31f190['body'],[_0xcc71('0x5d'),'id'])||{});}return null;})[_0xcc71('0x5e')](function(_0x3952f9){var _0x432a8d;_0x2a3748=_0x3952f9||[];var _0x47eca0=[];if(_0x3952f9){for(var _0x1917aa=0x0;_0x1917aa<_0x3952f9[_0xcc71('0x30')];_0x1917aa+=0x1){var _0x5d7da3=_0x3952f9[_0x1917aa][_0xcc71('0x21')]({'plain':!![]});_0x560bf8[_0xcc71('0x5f')]=_0x31f190[_0xcc71('0x43')][_0xcc71('0x5f')]?_0x31f190['body'][_0xcc71('0x5f')]:_0x560bf8[_0xcc71('0x5f')];switch(_0x560bf8[_0xcc71('0x5f')]){case _0xcc71('0x60'):_0x432a8d=squel[_0xcc71('0x61')]()[_0xcc71('0x62')](_0xcc71('0x63'))[_0xcc71('0x64')]([_0xcc71('0x65'),_0xcc71('0x66'),_0xcc71('0x67'),'ListId',_0xcc71('0x54'),_0xcc71('0x4b'),_0xcc71('0x4c')],squel['select']()[_0xcc71('0x39')](_0xcc71('0x65'),_0xcc71('0x65'))[_0xcc71('0x39')](_0xcc71('0x68'),'scheduledAt')[_0xcc71('0x39')]('id',_0xcc71('0x67'))[_0xcc71('0x39')](_0x5d7da3[_0xcc71('0x69')]['toString'](),_0xcc71('0x6a'))[_0xcc71('0x39')](_0x31f190[_0xcc71('0x3f')]['id'][_0xcc71('0x6b')](),'CampaignId')[_0xcc71('0x39')](_0xcc71('0x68'),_0xcc71('0x4b'))[_0xcc71('0x39')](_0xcc71('0x68'),_0xcc71('0x4c'))[_0xcc71('0x6c')](_0xcc71('0x6d'))['where'](_0xcc71('0x6e'))[_0xcc71('0x35')](_0xcc71('0x6f'),_0x5d7da3['CmListId'][_0xcc71('0x6b')]())[_0xcc71('0x35')](_0xcc71('0x70'))[_0xcc71('0x35')](_0xcc71('0x71'),squel[_0xcc71('0x72')]()[_0xcc71('0x39')]('calleridnum')[_0xcc71('0x6c')](_0xcc71('0x73'))['where'](_0xcc71('0x74'),_0x31f190[_0xcc71('0x3f')]['id']['toString']()))[_0xcc71('0x35')](_0xcc71('0x71'),squel['select']()[_0xcc71('0x39')](_0xcc71('0x65'))[_0xcc71('0x6c')](_0xcc71('0x63'))[_0xcc71('0x35')](_0xcc71('0x74'),_0x31f190['params']['id'][_0xcc71('0x6b')]())))[_0xcc71('0x6b')]();break;case _0xcc71('0x75'):_0x432a8d=squel['insert']()[_0xcc71('0x62')]('cm_hopper')[_0xcc71('0x64')]([_0xcc71('0x65'),_0xcc71('0x66'),_0xcc71('0x67'),'ListId',_0xcc71('0x54'),_0xcc71('0x4b'),_0xcc71('0x4c')],squel[_0xcc71('0x72')]()[_0xcc71('0x39')]('phone',_0xcc71('0x65'))[_0xcc71('0x39')](_0xcc71('0x68'),_0xcc71('0x66'))[_0xcc71('0x39')]('id',_0xcc71('0x67'))['field'](_0x5d7da3[_0xcc71('0x69')][_0xcc71('0x6b')](),'ListId')[_0xcc71('0x39')](_0x31f190[_0xcc71('0x3f')]['id']['toString'](),_0xcc71('0x54'))[_0xcc71('0x39')](_0xcc71('0x68'),'createdAt')[_0xcc71('0x39')](_0xcc71('0x68'),'updatedAt')[_0xcc71('0x6c')](_0xcc71('0x6d'))[_0xcc71('0x35')](_0xcc71('0x6e'))[_0xcc71('0x35')]('ListId\x20=\x20?',_0x5d7da3[_0xcc71('0x69')][_0xcc71('0x6b')]())[_0xcc71('0x35')](_0xcc71('0x70'))[_0xcc71('0x35')](_0xcc71('0x71'),squel[_0xcc71('0x72')]()[_0xcc71('0x39')](_0xcc71('0x65'))[_0xcc71('0x6c')](_0xcc71('0x63'))[_0xcc71('0x35')](_0xcc71('0x74'),_0x31f190[_0xcc71('0x3f')]['id'][_0xcc71('0x6b')]())))[_0xcc71('0x6b')]();break;default:_0x432a8d=squel['insert']()['into'](_0xcc71('0x63'))[_0xcc71('0x64')]([_0xcc71('0x65'),_0xcc71('0x66'),_0xcc71('0x67'),_0xcc71('0x6a'),'CampaignId',_0xcc71('0x4b'),_0xcc71('0x4c')],squel[_0xcc71('0x72')]()[_0xcc71('0x39')](_0xcc71('0x65'),_0xcc71('0x65'))[_0xcc71('0x39')]('NOW()',_0xcc71('0x66'))[_0xcc71('0x39')]('id',_0xcc71('0x67'))[_0xcc71('0x39')](_0x5d7da3[_0xcc71('0x69')][_0xcc71('0x6b')](),_0xcc71('0x6a'))[_0xcc71('0x39')](_0x31f190[_0xcc71('0x3f')]['id'][_0xcc71('0x6b')](),_0xcc71('0x54'))['field'](_0xcc71('0x68'),_0xcc71('0x4b'))[_0xcc71('0x39')]('NOW()','updatedAt')[_0xcc71('0x6c')](_0xcc71('0x6d'))[_0xcc71('0x35')](_0xcc71('0x6e'))[_0xcc71('0x35')](_0xcc71('0x6f'),_0x5d7da3[_0xcc71('0x69')][_0xcc71('0x6b')]())['where'](_0xcc71('0x70')))[_0xcc71('0x6b')]();}_0x47eca0[_0xcc71('0x76')](db[_0xcc71('0x77')][_0xcc71('0x2a')](_0x432a8d));}return BPromise[_0xcc71('0x78')](_0x47eca0);}})[_0xcc71('0x20')](function(){return _0x2a3748;})['then'](respondWithResult(_0x33e143,null))[_0xcc71('0x41')](handleError(_0x33e143,null));};exports[_0xcc71('0x79')]=function(_0x24d0d9,_0x233c8e,_0x57201d){var _0xe324f3;return db[_0xcc71('0x28')]['find']({'where':{'id':_0x24d0d9[_0xcc71('0x3f')]['id']}})['then'](handleEntityNotFound(_0x233c8e,null))[_0xcc71('0x20')](function(_0x29e3a6){if(_0x29e3a6){return _0x29e3a6[_0xcc71('0x79')](_0x24d0d9['query'][_0xcc71('0x5d')]);}})[_0xcc71('0x20')](function(_0x3c35f1){if(_0x3c35f1){_0xe324f3=_0x3c35f1;return db['CmHopper'][_0xcc71('0x1f')]({'where':{'ListId':_0x24d0d9[_0xcc71('0x2a')][_0xcc71('0x5d')],'CampaignId':_0x24d0d9['params']['id']}})[_0xcc71('0x20')](function(){return _0xe324f3;});}})['then'](respondWithStatusCode(_0x233c8e,null))['catch'](handleError(_0x233c8e,null));};exports['getBlackLists']=function(_0x1885fb,_0x580e00,_0x358418){var _0x1c8d4c={'raw':!![],'where':{}};var _0x5b4e21={};var _0x41272d={'count':0x0,'rows':[]};return db[_0xcc71('0x28')][_0xcc71('0x50')]({'where':{'id':_0x1885fb[_0xcc71('0x3f')]['id']}})[_0xcc71('0x20')](handleEntityNotFound(_0x580e00,null))[_0xcc71('0x20')](function(_0x5317ac){if(_0x5317ac){_0x5b4e21['model']=_[_0xcc71('0x40')](db['CmList'][_0xcc71('0x29')]);_0x5b4e21['query']=_[_0xcc71('0x40')](_0x1885fb[_0xcc71('0x2a')]);_0x5b4e21[_0xcc71('0x2b')]=_['intersection'](_0x5b4e21[_0xcc71('0x2e')],_0x5b4e21[_0xcc71('0x2a')]);_0x1c8d4c[_0xcc71('0x2d')]=_[_0xcc71('0x2c')](_0x5b4e21[_0xcc71('0x2e')],qs['fields'](_0x1885fb[_0xcc71('0x2a')][_0xcc71('0x2f')]));_0x1c8d4c['attributes']=_0x1c8d4c['attributes']['length']?_0x1c8d4c['attributes']:_0x5b4e21[_0xcc71('0x2e')];if(!_0x1885fb[_0xcc71('0x2a')]['hasOwnProperty'](_0xcc71('0x32'))){_0x1c8d4c['limit']=qs['limit'](_0x1885fb['query'][_0xcc71('0x18')]);_0x1c8d4c[_0xcc71('0x17')]=qs[_0xcc71('0x17')](_0x1885fb[_0xcc71('0x2a')][_0xcc71('0x17')]);}_0x1c8d4c['order']=qs[_0xcc71('0x34')](_0x1885fb[_0xcc71('0x2a')]['sort']);_0x1c8d4c[_0xcc71('0x35')]=qs[_0xcc71('0x2b')](_[_0xcc71('0x53')](_0x1885fb['query'],_0x5b4e21[_0xcc71('0x2b')]));_0x1c8d4c[_0xcc71('0x35')][_0xcc71('0x54')]=_0x5317ac['id'];if(_0x1885fb['query'][_0xcc71('0x36')]){_0x1c8d4c[_0xcc71('0x35')]=_[_0xcc71('0x37')](_0x1c8d4c[_0xcc71('0x35')],{'$or':_[_0xcc71('0x38')](_0x1c8d4c[_0xcc71('0x2d')],function(_0x233974){var _0xfcb419={};_0xfcb419[_0x233974]={'$like':'%'+_0x1885fb[_0xcc71('0x2a')]['filter']+'%'};return _0xfcb419;})});}_0x1c8d4c=_[_0xcc71('0x37')]({},_0x1c8d4c,_0x1885fb['options']);return db[_0xcc71('0x5b')][_0xcc71('0x16')]({'where':_0x1c8d4c[_0xcc71('0x35')]})[_0xcc71('0x20')](function(_0x1993e7){_0x41272d[_0xcc71('0x16')]=_0x1993e7;if(_0x1885fb[_0xcc71('0x2a')][_0xcc71('0x3b')]){_0x1c8d4c['include']=[{'all':!![]}];}return db['CmList'][_0xcc71('0x3d')](_0x1c8d4c);})[_0xcc71('0x20')](function(_0x376b38){_0x41272d['rows']=_0x376b38;return _0x41272d;});}})[_0xcc71('0x20')](respondWithFilteredResult(_0x580e00,_0x1c8d4c))[_0xcc71('0x41')](handleError(_0x580e00,null));};exports[_0xcc71('0x7a')]=function(_0x207def,_0x7ae7e5,_0x139243){var _0x4cc1a3,_0x474f05;return db[_0xcc71('0x28')][_0xcc71('0x47')]({'where':{'id':_0x207def['params']['id']}})[_0xcc71('0x20')](handleEntityNotFound(_0x7ae7e5,null))[_0xcc71('0x20')](function(_0x504341){if(_0x504341){_0x474f05=_0x504341;return _0x504341['addBlackLists'](_0x207def['body'][_0xcc71('0x5d')],_['omit'](_0x207def['body'],[_0xcc71('0x5d'),'id'])||{});}return null;})[_0xcc71('0x5e')](function(_0x26c122){var _0x48c28b;_0x4cc1a3=_0x26c122||[];var _0x288445=[];if(_0x26c122){for(var _0x4f367e=0x0;_0x4f367e<_0x26c122[_0xcc71('0x30')];_0x4f367e+=0x1){var _0x202702=_0x26c122[_0x4f367e][_0xcc71('0x21')]({'plain':!![]});_0x48c28b=squel['insert']()[_0xcc71('0x62')]('cm_hopper_black')[_0xcc71('0x64')]([_0xcc71('0x65'),_0xcc71('0x67'),_0xcc71('0x6a'),_0xcc71('0x54'),_0xcc71('0x4b'),_0xcc71('0x4c')],squel['select']()['field']('phone','phone')[_0xcc71('0x39')]('id',_0xcc71('0x67'))[_0xcc71('0x39')](_0x202702['CmListId']['toString'](),_0xcc71('0x6a'))['field'](_0x207def[_0xcc71('0x3f')]['id']['toString'](),_0xcc71('0x54'))[_0xcc71('0x39')]('NOW()',_0xcc71('0x4b'))[_0xcc71('0x39')]('NOW()','updatedAt')[_0xcc71('0x6c')]('cm_contacts')[_0xcc71('0x35')](_0xcc71('0x6e'))[_0xcc71('0x35')]('ListId\x20=\x20?',_0x202702[_0xcc71('0x69')][_0xcc71('0x6b')]())[_0xcc71('0x35')](_0xcc71('0x70')))[_0xcc71('0x6b')]();_0x288445[_0xcc71('0x76')](db[_0xcc71('0x77')][_0xcc71('0x2a')](_0x48c28b));}return BPromise[_0xcc71('0x78')](_0x288445);}})[_0xcc71('0x20')](function(){return _0x4cc1a3;})[_0xcc71('0x20')](respondWithResult(_0x7ae7e5,null))[_0xcc71('0x41')](handleError(_0x7ae7e5,null));};exports[_0xcc71('0x7b')]=function(_0x14484c,_0x2c8eaf,_0x40cae4){var _0x77d0b4;return db[_0xcc71('0x28')][_0xcc71('0x47')]({'where':{'id':_0x14484c[_0xcc71('0x3f')]['id']}})[_0xcc71('0x20')](handleEntityNotFound(_0x2c8eaf,null))[_0xcc71('0x20')](function(_0x563ad0){if(_0x563ad0){return _0x563ad0[_0xcc71('0x7b')](_0x14484c[_0xcc71('0x2a')]['ids']);}})[_0xcc71('0x20')](function(_0x315278){if(_0x315278){_0x77d0b4=_0x315278;return db[_0xcc71('0x59')][_0xcc71('0x1f')]({'where':{'ListId':_0x14484c[_0xcc71('0x2a')][_0xcc71('0x5d')],'CampaignId':_0x14484c[_0xcc71('0x3f')]['id']}})[_0xcc71('0x20')](function(){return _0x77d0b4;});}})[_0xcc71('0x20')](respondWithStatusCode(_0x2c8eaf,null))[_0xcc71('0x41')](handleError(_0x2c8eaf,null));};
\ No newline at end of file
index f553821..122c90f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3f96=['../../config/logger','api','moment','bluebird','./campaign.attributes','exports','Campaign','lodash','util'];(function(_0x373552,_0x3a69d4){var _0x2400fb=function(_0x2f1a38){while(--_0x2f1a38){_0x373552['push'](_0x373552['shift']());}};_0x2400fb(++_0x3a69d4);}(_0x3f96,0xa0));var _0x63f9=function(_0x49786d,_0x1ee2fc){_0x49786d=_0x49786d-0x0;var _0x232888=_0x3f96[_0x49786d];return _0x232888;};'use strict';var _=require(_0x63f9('0x0'));var util=require(_0x63f9('0x1'));var logger=require(_0x63f9('0x2'))(_0x63f9('0x3'));var moment=require(_0x63f9('0x4'));var BPromise=require(_0x63f9('0x5'));var rp=require('request-promise');var attributes=require(_0x63f9('0x6'));module[_0x63f9('0x7')]=function(_0x195d41,_0x87ba40){return _0x195d41['define'](_0x63f9('0x8'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x7fc0=['../../config/logger','api','moment','bluebird','./campaign.attributes','exports','Campaign','lodash','util'];(function(_0x33092d,_0x54304e){var _0x4ff011=function(_0x1aabe5){while(--_0x1aabe5){_0x33092d['push'](_0x33092d['shift']());}};_0x4ff011(++_0x54304e);}(_0x7fc0,0xb2));var _0x07fc=function(_0x542ae7,_0x57332f){_0x542ae7=_0x542ae7-0x0;var _0x5a96a6=_0x7fc0[_0x542ae7];return _0x5a96a6;};'use strict';var _=require(_0x07fc('0x0'));var util=require(_0x07fc('0x1'));var logger=require(_0x07fc('0x2'))(_0x07fc('0x3'));var moment=require(_0x07fc('0x4'));var BPromise=require(_0x07fc('0x5'));var rp=require('request-promise');var attributes=require(_0x07fc('0x6'));module[_0x07fc('0x7')]=function(_0x5708aa,_0x436057){return _0x5708aa['define'](_0x07fc('0x8'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 1cbb472..56910c9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfa7d=['http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetCampaign','Campaign','options','raw','where','attributes','limit','include','map','model','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xfa7d,0x1d7));var _0xdfa7=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xfa7d[_0x298ed3];return _0x5aad28;};'use strict';var _=require('lodash');var util=require(_0xdfa7('0x0'));var moment=require(_0xdfa7('0x1'));var BPromise=require('bluebird');var rs=require(_0xdfa7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdfa7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xdfa7('0x4'))(_0xdfa7('0x5'));var config=require(_0xdfa7('0x6'));var jayson=require(_0xdfa7('0x7'));var client=jayson[_0xdfa7('0x8')][_0xdfa7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10edbe,_0x4894fc,_0x2d3225){return new BPromise(function(_0x5d609e,_0x349096){return client[_0xdfa7('0xa')](_0x10edbe,_0x2d3225)[_0xdfa7('0xb')](function(_0x31eae9){logger[_0xdfa7('0xc')](_0xdfa7('0xd'),_0x4894fc,_0xdfa7('0xe'));logger[_0xdfa7('0xf')](_0xdfa7('0x10'),_0x4894fc,_0xdfa7('0xe'),JSON[_0xdfa7('0x11')](_0x31eae9));if(_0x31eae9['error']){if(_0x31eae9[_0xdfa7('0x12')]['code']===0x1f4){logger[_0xdfa7('0x12')](_0xdfa7('0xd'),_0x4894fc,_0x31eae9['error'][_0xdfa7('0x13')]);return _0x349096(_0x31eae9[_0xdfa7('0x12')][_0xdfa7('0x13')]);}logger[_0xdfa7('0x12')](_0xdfa7('0xd'),_0x4894fc,_0x31eae9[_0xdfa7('0x12')][_0xdfa7('0x13')]);return _0x5d609e(_0x31eae9[_0xdfa7('0x12')][_0xdfa7('0x13')]);}else{logger[_0xdfa7('0xc')](_0xdfa7('0xd'),_0x4894fc,_0xdfa7('0xe'));_0x5d609e(_0x31eae9[_0xdfa7('0x14')][_0xdfa7('0x13')]);}})[_0xdfa7('0x15')](function(_0x52eedc){logger[_0xdfa7('0x12')]('Campaign,\x20%s,\x20%s',_0x4894fc,_0x52eedc);_0x349096(_0x52eedc);});});}exports[_0xdfa7('0x16')]=function(_0x22b507){var _0x49cd8b=this;return new Promise(function(_0x1a02e0,_0x4b9a1b){return db[_0xdfa7('0x17')]['findAll']({'raw':_0x22b507[_0xdfa7('0x18')]?_0x22b507[_0xdfa7('0x18')][_0xdfa7('0x19')]===undefined?!![]:![]:!![],'where':_0x22b507[_0xdfa7('0x18')]?_0x22b507[_0xdfa7('0x18')][_0xdfa7('0x1a')]||null:null,'attributes':_0x22b507[_0xdfa7('0x18')]?_0x22b507[_0xdfa7('0x18')][_0xdfa7('0x1b')]||null:null,'limit':_0x22b507[_0xdfa7('0x18')]?_0x22b507[_0xdfa7('0x18')][_0xdfa7('0x1c')]||null:null,'include':_0x22b507[_0xdfa7('0x18')]?_0x22b507[_0xdfa7('0x18')][_0xdfa7('0x1d')]?_[_0xdfa7('0x1e')](_0x22b507[_0xdfa7('0x18')]['include'],function(_0x4442d0){return{'model':db[_0x4442d0[_0xdfa7('0x1f')]],'as':_0x4442d0['as'],'attributes':_0x4442d0[_0xdfa7('0x1b')],'include':_0x4442d0['include']?_[_0xdfa7('0x1e')](_0x4442d0[_0xdfa7('0x1d')],function(_0x374f56){return{'model':db[_0x374f56[_0xdfa7('0x1f')]],'as':_0x374f56['as'],'attributes':_0x374f56[_0xdfa7('0x1b')],'include':_0x374f56[_0xdfa7('0x1d')]?_[_0xdfa7('0x1e')](_0x374f56['include'],function(_0x5098ac){return{'model':db[_0x5098ac[_0xdfa7('0x1f')]],'as':_0x5098ac['as'],'attributes':_0x5098ac['attributes']};}):[]};}):[]};}):[]:[]})[_0xdfa7('0xb')](function(_0x3aeb34){logger[_0xdfa7('0xc')](_0xdfa7('0x16'),_0x22b507);logger['debug']('GetCampaign',_0x22b507,JSON['stringify'](_0x3aeb34));_0x1a02e0(_0x3aeb34);})[_0xdfa7('0x15')](function(_0x321cde){logger[_0xdfa7('0x12')](_0xdfa7('0x16'),_0x321cde['message'],_0x22b507);_0x4b9a1b(_0x49cd8b[_0xdfa7('0x12')](0x1f4,_0x321cde[_0xdfa7('0x13')]));});});};
\ No newline at end of file
+var _0x63c6=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','Campaign','options','raw','where','include','map','attributes','model','GetCampaign'];(function(_0x26eb14,_0x5073a9){var _0x411832=function(_0x465fb8){while(--_0x465fb8){_0x26eb14['push'](_0x26eb14['shift']());}};_0x411832(++_0x5073a9);}(_0x63c6,0x80));var _0x663c=function(_0x36f641,_0x1a3063){_0x36f641=_0x36f641-0x0;var _0x39b299=_0x63c6[_0x36f641];return _0x39b299;};'use strict';var _=require(_0x663c('0x0'));var util=require(_0x663c('0x1'));var moment=require(_0x663c('0x2'));var BPromise=require(_0x663c('0x3'));var rs=require(_0x663c('0x4'));var fs=require('fs');var Redis=require(_0x663c('0x5'));var db=require(_0x663c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x663c('0x7'))('rpc');var config=require(_0x663c('0x8'));var jayson=require(_0x663c('0x9'));var client=jayson['client'][_0x663c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x493e3f,_0x4c7197,_0x5542bb){return new BPromise(function(_0x1cee66,_0x51f23d){return client[_0x663c('0xb')](_0x493e3f,_0x5542bb)[_0x663c('0xc')](function(_0x52cdb6){logger[_0x663c('0xd')](_0x663c('0xe'),_0x4c7197,'request\x20sent');logger[_0x663c('0xf')](_0x663c('0x10'),_0x4c7197,'request\x20sent',JSON[_0x663c('0x11')](_0x52cdb6));if(_0x52cdb6['error']){if(_0x52cdb6[_0x663c('0x12')][_0x663c('0x13')]===0x1f4){logger[_0x663c('0x12')](_0x663c('0xe'),_0x4c7197,_0x52cdb6[_0x663c('0x12')]['message']);return _0x51f23d(_0x52cdb6['error']['message']);}logger[_0x663c('0x12')](_0x663c('0xe'),_0x4c7197,_0x52cdb6['error'][_0x663c('0x14')]);return _0x1cee66(_0x52cdb6[_0x663c('0x12')]['message']);}else{logger['info'](_0x663c('0xe'),_0x4c7197,_0x663c('0x15'));_0x1cee66(_0x52cdb6['result'][_0x663c('0x14')]);}})[_0x663c('0x16')](function(_0x12eca5){logger[_0x663c('0x12')](_0x663c('0xe'),_0x4c7197,_0x12eca5);_0x51f23d(_0x12eca5);});});}exports['GetCampaign']=function(_0x244067){var _0x386d33=this;return new Promise(function(_0xb3419b,_0x39ae88){return db[_0x663c('0x17')]['findAll']({'raw':_0x244067['options']?_0x244067[_0x663c('0x18')][_0x663c('0x19')]===undefined?!![]:![]:!![],'where':_0x244067['options']?_0x244067[_0x663c('0x18')][_0x663c('0x1a')]||null:null,'attributes':_0x244067['options']?_0x244067[_0x663c('0x18')]['attributes']||null:null,'limit':_0x244067[_0x663c('0x18')]?_0x244067['options']['limit']||null:null,'include':_0x244067[_0x663c('0x18')]?_0x244067['options'][_0x663c('0x1b')]?_[_0x663c('0x1c')](_0x244067[_0x663c('0x18')][_0x663c('0x1b')],function(_0x51960e){return{'model':db[_0x51960e['model']],'as':_0x51960e['as'],'attributes':_0x51960e[_0x663c('0x1d')],'include':_0x51960e['include']?_[_0x663c('0x1c')](_0x51960e[_0x663c('0x1b')],function(_0x2eba4c){return{'model':db[_0x2eba4c['model']],'as':_0x2eba4c['as'],'attributes':_0x2eba4c[_0x663c('0x1d')],'include':_0x2eba4c[_0x663c('0x1b')]?_[_0x663c('0x1c')](_0x2eba4c['include'],function(_0x35d1a7){return{'model':db[_0x35d1a7[_0x663c('0x1e')]],'as':_0x35d1a7['as'],'attributes':_0x35d1a7[_0x663c('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x238c1b){logger[_0x663c('0xd')](_0x663c('0x1f'),_0x244067);logger[_0x663c('0xf')](_0x663c('0x1f'),_0x244067,JSON[_0x663c('0x11')](_0x238c1b));_0xb3419b(_0x238c1b);})[_0x663c('0x16')](function(_0x1a078e){logger[_0x663c('0x12')]('GetCampaign',_0x1a078e['message'],_0x244067);_0x39ae88(_0x386d33['error'](0x1f4,_0x1a078e[_0x663c('0x14')]));});});};
\ No newline at end of file
index c2ce980..9ee43c6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xddf9=['/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','clone','addLists','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers'];(function(_0x35e44f,_0x1e7bef){var _0x2f6d43=function(_0x5b14ca){while(--_0x5b14ca){_0x35e44f['push'](_0x35e44f['shift']());}};_0x2f6d43(++_0x1e7bef);}(_0xddf9,0x103));var _0x9ddf=function(_0xae1a83,_0x1980d4){_0xae1a83=_0xae1a83-0x0;var _0xdb9da8=_0xddf9[_0xae1a83];return _0xdb9da8;};'use strict';var multer=require('multer');var util=require(_0x9ddf('0x0'));var path=require('path');var timeout=require(_0x9ddf('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x9ddf('0x2'));var interaction=require(_0x9ddf('0x3'));var config=require('../../config/environment');var controller=require('./campaign.controller');router[_0x9ddf('0x4')]('/',auth[_0x9ddf('0x5')](),controller[_0x9ddf('0x6')]);router[_0x9ddf('0x4')](_0x9ddf('0x7'),auth[_0x9ddf('0x5')](),controller[_0x9ddf('0x8')]);router[_0x9ddf('0x4')](_0x9ddf('0x9'),auth[_0x9ddf('0x5')](),controller[_0x9ddf('0xa')]);router[_0x9ddf('0x4')](_0x9ddf('0xb'),auth[_0x9ddf('0x5')](),controller['getHopperHistories']);router[_0x9ddf('0x4')](_0x9ddf('0xc'),auth[_0x9ddf('0x5')](),controller['getHopperFinals']);router[_0x9ddf('0x4')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0x9ddf('0xd')]);router[_0x9ddf('0x4')](_0x9ddf('0xe'),auth['isAuthenticated'](),controller[_0x9ddf('0xf')]);router['get'](_0x9ddf('0x10'),auth[_0x9ddf('0x5')](),controller[_0x9ddf('0x11')]);router[_0x9ddf('0x12')]('/',auth['isAuthenticated'](),controller[_0x9ddf('0x13')]);router[_0x9ddf('0x12')]('/:id/clone',auth[_0x9ddf('0x5')](),controller[_0x9ddf('0x14')]);router[_0x9ddf('0x12')](_0x9ddf('0xe'),auth[_0x9ddf('0x5')](),controller[_0x9ddf('0x15')]);router[_0x9ddf('0x12')](_0x9ddf('0x10'),auth['isAuthenticated'](),controller[_0x9ddf('0x16')]);router[_0x9ddf('0x17')](_0x9ddf('0x7'),auth[_0x9ddf('0x5')](),controller[_0x9ddf('0x18')]);router[_0x9ddf('0x19')](_0x9ddf('0x7'),auth[_0x9ddf('0x5')](),controller[_0x9ddf('0x1a')]);router[_0x9ddf('0x19')](_0x9ddf('0xe'),auth[_0x9ddf('0x5')](),controller[_0x9ddf('0x1b')]);router[_0x9ddf('0x19')](_0x9ddf('0x10'),auth[_0x9ddf('0x5')](),controller[_0x9ddf('0x1c')]);module[_0x9ddf('0x1d')]=router;
\ No newline at end of file
+var _0x0708=['../../config/environment','./campaign.controller','get','index','show','/:id/hoppers','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','/:id/clone','clone','addLists','addBlackLists','/:id','update','delete','destroy','util','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5564c6,_0x1422a6){var _0x3c47a1=function(_0x2edda7){while(--_0x2edda7){_0x5564c6['push'](_0x5564c6['shift']());}};_0x3c47a1(++_0x1422a6);}(_0x0708,0x6c));var _0x8070=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x0708[_0x342700];return _0x53406f;};'use strict';var multer=require('multer');var util=require(_0x8070('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8070('0x1')]();var auth=require(_0x8070('0x2'));var interaction=require(_0x8070('0x3'));var config=require(_0x8070('0x4'));var controller=require(_0x8070('0x5'));router[_0x8070('0x6')]('/',auth['isAuthenticated'](),controller[_0x8070('0x7')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8070('0x8')]);router[_0x8070('0x6')](_0x8070('0x9'),auth['isAuthenticated'](),controller[_0x8070('0xa')]);router['get'](_0x8070('0xb'),auth[_0x8070('0xc')](),controller[_0x8070('0xd')]);router[_0x8070('0x6')]('/:id/hopper_finals',auth[_0x8070('0xc')](),controller['getHopperFinals']);router[_0x8070('0x6')](_0x8070('0xe'),auth['isAuthenticated'](),controller[_0x8070('0xf')]);router[_0x8070('0x6')](_0x8070('0x10'),auth[_0x8070('0xc')](),controller[_0x8070('0x11')]);router['get'](_0x8070('0x12'),auth['isAuthenticated'](),controller[_0x8070('0x13')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x8070('0x14'),auth['isAuthenticated'](),controller[_0x8070('0x15')]);router['post'](_0x8070('0x10'),auth[_0x8070('0xc')](),controller[_0x8070('0x16')]);router['post'](_0x8070('0x12'),auth['isAuthenticated'](),controller[_0x8070('0x17')]);router['put'](_0x8070('0x18'),auth[_0x8070('0xc')](),controller[_0x8070('0x19')]);router[_0x8070('0x1a')](_0x8070('0x18'),auth[_0x8070('0xc')](),controller[_0x8070('0x1b')]);router[_0x8070('0x1a')](_0x8070('0x10'),auth['isAuthenticated'](),controller['removeLists']);router[_0x8070('0x1a')](_0x8070('0x12'),auth[_0x8070('0xc')](),controller['removeBlackLists']);module['exports']=router;
\ No newline at end of file
index 8cd1e32..94adbc2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdc66=['getDataValue','key','sequelize','exports','TEXT','STRING','VIRTUAL'];(function(_0xfb9aaa,_0x37935d){var _0x103bf7=function(_0x1e9f2a){while(--_0x1e9f2a){_0xfb9aaa['push'](_0xfb9aaa['shift']());}};_0x103bf7(++_0x37935d);}(_0xdc66,0x1c2));var _0x6dc6=function(_0x4ed1d4,_0x512d9a){_0x4ed1d4=_0x4ed1d4-0x0;var _0x28e363=_0xdc66[_0x4ed1d4];return _0x28e363;};'use strict';var Sequelize=require(_0x6dc6('0x0'));module[_0x6dc6('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x6dc6('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6dc6('0x3')]},'name':{'type':Sequelize[_0x6dc6('0x4')],'get':function(){return this[_0x6dc6('0x5')](_0x6dc6('0x6'));}}};
\ No newline at end of file
+var _0xf714=['key','sequelize','exports','STRING','TEXT','VIRTUAL','getDataValue'];(function(_0x810e4d,_0x909ef4){var _0x13f01c=function(_0x12fd89){while(--_0x12fd89){_0x810e4d['push'](_0x810e4d['shift']());}};_0x13f01c(++_0x909ef4);}(_0xf714,0x189));var _0x4f71=function(_0x12ab9c,_0x1ad557){_0x12ab9c=_0x12ab9c-0x0;var _0x2a3e39=_0xf714[_0x12ab9c];return _0x2a3e39;};'use strict';var Sequelize=require(_0x4f71('0x0'));module[_0x4f71('0x1')]={'key':{'type':Sequelize[_0x4f71('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x4f71('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x4f71('0x2')]},'name':{'type':Sequelize[_0x4f71('0x4')],'get':function(){return this[_0x4f71('0x5')](_0x4f71('0x6'));}}};
\ No newline at end of file
index 7698a11..fc7933c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc8e0=['sox','lodash','crypto','desk.js','to-csv','querystring','../../components/auth/service','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','CannedAnswer','rawAttributes','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','sort','where','pick','merge','map','type','key','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','CannedAnswers','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','path'];(function(_0x463fb7,_0x489f24){var _0x30b970=function(_0x45606e){while(--_0x45606e){_0x463fb7['push'](_0x463fb7['shift']());}};_0x30b970(++_0x489f24);}(_0xc8e0,0x1b0));var _0x0c8e=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc8e0[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0x0c8e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0c8e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c8e('0x2'));var rp=require(_0x0c8e('0x3'));var moment=require(_0x0c8e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0c8e('0x5'));var util=require(_0x0c8e('0x6'));var path=require(_0x0c8e('0x7'));var sox=require(_0x0c8e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0c8e('0x9'));var squel=require('squel');var crypto=require(_0x0c8e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0c8e('0xb'));var toCsv=require(_0x0c8e('0xc'));var querystring=require(_0x0c8e('0xd'));var Papa=require('papaparse');var authService=require(_0x0c8e('0xe'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x0c8e('0xf'));var qs=require(_0x0c8e('0x10'));var logger=require('../../config/logger')(_0x0c8e('0x11'));var utils=require(_0x0c8e('0x12'));var config=require(_0x0c8e('0x13'));var db=require(_0x0c8e('0x14'))['db'];function respondWithStatusCode(_0x2c582a,_0x42a233){_0x42a233=_0x42a233||0xcc;return function(_0x58bff0){if(_0x58bff0){return _0x2c582a[_0x0c8e('0x15')](_0x42a233);}return _0x2c582a[_0x0c8e('0x16')](_0x42a233)[_0x0c8e('0x17')]();};}function respondWithResult(_0x57ac57,_0x38bf65){_0x38bf65=_0x38bf65||0xc8;return function(_0xf532e7){if(_0xf532e7){return _0x57ac57['status'](_0x38bf65)[_0x0c8e('0x18')](_0xf532e7);}};}function respondWithFilteredResult(_0x2d909f,_0x19db79){return function(_0x5f2339){if(_0x5f2339){var _0x875d5d=_0x5f2339[_0x0c8e('0x19')],_0x3501c2=_0x19db79['offset'],_0x666bd=_0x19db79['offset']+_0x19db79[_0x0c8e('0x1a')],_0x40aece;if(_0x666bd>=_0x875d5d){_0x666bd=_0x875d5d;_0x40aece=0xc8;}else{_0x40aece=0xce;}_0x2d909f['status'](_0x40aece);return _0x2d909f[_0x0c8e('0x1b')](_0x0c8e('0x1c'),_0x3501c2+'-'+_0x666bd+'/'+_0x875d5d)[_0x0c8e('0x18')](_0x5f2339);}return null;};}function patchUpdates(_0x2a78e0){return function(_0x5ccd54){try{jsonpatch['apply'](_0x5ccd54,_0x2a78e0,!![]);}catch(_0x5b7605){return BPromise[_0x0c8e('0x1d')](_0x5b7605);}return _0x5ccd54[_0x0c8e('0x1e')]();};}function saveUpdates(_0x218322,_0x559ef0){return function(_0x3d9ba2){if(_0x3d9ba2){return _0x3d9ba2['update'](_0x218322)[_0x0c8e('0x1f')](function(_0x5cd852){return _0x5cd852;});}return null;};}function removeEntity(_0x231882,_0x211872){return function(_0x5df4db){if(_0x5df4db){return _0x5df4db[_0x0c8e('0x20')]()[_0x0c8e('0x1f')](function(){var _0x3ba9ab=_0x5df4db[_0x0c8e('0x21')]({'plain':!![]});var _0x162b9a='CannedAnswers';return db[_0x0c8e('0x22')][_0x0c8e('0x20')]({'where':{'type':_0x162b9a,'resourceId':_0x3ba9ab['id']}})[_0x0c8e('0x1f')](function(){return _0x5df4db;});})[_0x0c8e('0x1f')](function(){_0x231882[_0x0c8e('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56958b,_0x272cc8){return function(_0x183377){if(!_0x183377){_0x56958b[_0x0c8e('0x15')](0x194);}return _0x183377;};}function handleError(_0x3b97cd,_0x57f449){_0x57f449=_0x57f449||0x1f4;return function(_0x497df0){logger[_0x0c8e('0x23')](_0x497df0[_0x0c8e('0x24')]);if(_0x497df0[_0x0c8e('0x25')]){delete _0x497df0['name'];}_0x3b97cd[_0x0c8e('0x16')](_0x57f449)[_0x0c8e('0x26')](_0x497df0);};}exports[_0x0c8e('0x27')]=function(_0x15256e,_0x174a49){var _0x2e364b={},_0x28c994={},_0x1421b9={'count':0x0,'rows':[]};var _0x55556c=db[_0x0c8e('0x28')][_0x0c8e('0x29')];_0x28c994[_0x0c8e('0x2a')]=_[_0x0c8e('0x2b')](_0x55556c);_0x28c994[_0x0c8e('0x2c')]=_[_0x0c8e('0x2b')](_0x15256e[_0x0c8e('0x2c')]);_0x28c994[_0x0c8e('0x2d')]=_[_0x0c8e('0x2e')](_0x28c994[_0x0c8e('0x2a')],_0x28c994[_0x0c8e('0x2c')]);_0x2e364b['attributes']=_['intersection'](_0x28c994[_0x0c8e('0x2a')],qs[_0x0c8e('0x2f')](_0x15256e[_0x0c8e('0x2c')]['fields']));_0x2e364b[_0x0c8e('0x30')]=_0x2e364b[_0x0c8e('0x30')]['length']?_0x2e364b[_0x0c8e('0x30')]:_0x28c994[_0x0c8e('0x2a')];if(!_0x15256e['query'][_0x0c8e('0x31')](_0x0c8e('0x32'))){_0x2e364b[_0x0c8e('0x1a')]=qs[_0x0c8e('0x1a')](_0x15256e[_0x0c8e('0x2c')][_0x0c8e('0x1a')]);_0x2e364b[_0x0c8e('0x33')]=qs[_0x0c8e('0x33')](_0x15256e['query'][_0x0c8e('0x33')]);}_0x2e364b['order']=qs[_0x0c8e('0x34')](_0x15256e[_0x0c8e('0x2c')][_0x0c8e('0x34')]);_0x2e364b[_0x0c8e('0x35')]=qs[_0x0c8e('0x2d')](_[_0x0c8e('0x36')](_0x15256e[_0x0c8e('0x2c')],_0x28c994['filters']));if(_0x15256e[_0x0c8e('0x2c')]['filter']){_0x2e364b[_0x0c8e('0x35')]=_[_0x0c8e('0x37')](_0x2e364b[_0x0c8e('0x35')],{'$or':_[_0x0c8e('0x38')](_0x55556c,function(_0x45d1e6){if(_0x45d1e6[_0x0c8e('0x39')][_0x0c8e('0x3a')]!==_0x0c8e('0x3b')){var _0x580f7b={};_0x580f7b[_0x45d1e6['field']]={'$like':'%'+_0x15256e[_0x0c8e('0x2c')][_0x0c8e('0x3c')]+'%'};return _0x580f7b;}})});}_0x2e364b=_[_0x0c8e('0x37')]({},_0x2e364b,_0x15256e[_0x0c8e('0x3d')]);var _0x1c3b83={'where':_0x2e364b[_0x0c8e('0x35')]};return db[_0x0c8e('0x28')][_0x0c8e('0x19')](_0x1c3b83)[_0x0c8e('0x1f')](function(_0x21be32){_0x1421b9[_0x0c8e('0x19')]=_0x21be32;if(_0x15256e['query'][_0x0c8e('0x3e')]){_0x2e364b[_0x0c8e('0x3f')]=[{'all':!![]}];}return db[_0x0c8e('0x28')][_0x0c8e('0x40')](_0x2e364b);})['then'](function(_0x4c6e8c){_0x1421b9[_0x0c8e('0x41')]=_0x4c6e8c;return _0x1421b9;})['then'](respondWithFilteredResult(_0x174a49,_0x2e364b))[_0x0c8e('0x42')](handleError(_0x174a49,null));};exports[_0x0c8e('0x43')]=function(_0x927b1d,_0x472f6e){var _0x53c4d1={'raw':!![],'where':{'id':_0x927b1d[_0x0c8e('0x44')]['id']}},_0x951e12={};_0x951e12['model']=_[_0x0c8e('0x2b')](db[_0x0c8e('0x28')][_0x0c8e('0x29')]);_0x951e12[_0x0c8e('0x2c')]=_[_0x0c8e('0x2b')](_0x927b1d[_0x0c8e('0x2c')]);_0x951e12[_0x0c8e('0x2d')]=_['intersection'](_0x951e12[_0x0c8e('0x2a')],_0x951e12[_0x0c8e('0x2c')]);_0x53c4d1[_0x0c8e('0x30')]=_['intersection'](_0x951e12['model'],qs['fields'](_0x927b1d[_0x0c8e('0x2c')][_0x0c8e('0x2f')]));_0x53c4d1[_0x0c8e('0x30')]=_0x53c4d1[_0x0c8e('0x30')][_0x0c8e('0x45')]?_0x53c4d1[_0x0c8e('0x30')]:_0x951e12[_0x0c8e('0x2a')];if(_0x927b1d[_0x0c8e('0x2c')]['includeAll']){_0x53c4d1[_0x0c8e('0x3f')]=[{'all':!![]}];}_0x53c4d1=_[_0x0c8e('0x37')]({},_0x53c4d1,_0x927b1d[_0x0c8e('0x3d')]);return db[_0x0c8e('0x28')][_0x0c8e('0x46')](_0x53c4d1)['then'](handleEntityNotFound(_0x472f6e,null))[_0x0c8e('0x1f')](respondWithResult(_0x472f6e,null))[_0x0c8e('0x42')](handleError(_0x472f6e,null));};exports[_0x0c8e('0x47')]=function(_0x262881,_0x4eb41f){if(_0x262881[_0x0c8e('0x48')]['id']){delete _0x262881[_0x0c8e('0x48')]['id'];}return db['CannedAnswer'][_0x0c8e('0x46')]({'where':{'id':_0x262881[_0x0c8e('0x44')]['id']}})[_0x0c8e('0x1f')](handleEntityNotFound(_0x4eb41f,null))['then'](saveUpdates(_0x262881['body'],null))[_0x0c8e('0x1f')](respondWithResult(_0x4eb41f,null))[_0x0c8e('0x42')](handleError(_0x4eb41f,null));};exports[_0x0c8e('0x20')]=function(_0xc5fa56,_0x1f06e4){return db[_0x0c8e('0x28')][_0x0c8e('0x46')]({'where':{'id':_0xc5fa56[_0x0c8e('0x44')]['id']}})[_0x0c8e('0x1f')](handleEntityNotFound(_0x1f06e4,null))['then'](removeEntity(_0x1f06e4,null))[_0x0c8e('0x42')](handleError(_0x1f06e4,null));};exports[_0x0c8e('0x49')]=function(_0x11da01,_0x2eade5){var _0x59e48f={'key':_0x11da01[_0x0c8e('0x48')][_0x0c8e('0x3a')]};if(_0x11da01[_0x0c8e('0x48')][_0x0c8e('0x4a')]){_0x59e48f[_0x0c8e('0x4a')]=_0x11da01[_0x0c8e('0x48')][_0x0c8e('0x4a')];}else if(_0x11da01['body']['SmsAccountId']){_0x59e48f[_0x0c8e('0x4b')]=_0x11da01[_0x0c8e('0x48')]['SmsAccountId'];}else if(_0x11da01['body'][_0x0c8e('0x4c')]){_0x59e48f[_0x0c8e('0x4c')]=_0x11da01['body']['OpenchannelAccountId'];}else if(_0x11da01[_0x0c8e('0x48')][_0x0c8e('0x4d')]){_0x59e48f[_0x0c8e('0x4d')]=_0x11da01[_0x0c8e('0x48')][_0x0c8e('0x4d')];}return db[_0x0c8e('0x28')][_0x0c8e('0x46')]({'where':_0x59e48f})[_0x0c8e('0x1f')](function(_0x4985ae){if(_0x4985ae){throw new db[(_0x0c8e('0x4e'))][(_0x0c8e('0x4f'))](_0x0c8e('0x50'));}return db['CannedAnswer']['create'](_0x11da01['body']);})[_0x0c8e('0x1f')](function(_0x296710){var _0x55148b=_0x11da01['user']['get']({'plain':!![]});if(!_0x55148b)throw new Error(_0x0c8e('0x51'));if(_0x55148b[_0x0c8e('0x52')]===_0x0c8e('0x53')){var _0x3775d2=_0x296710['get']({'plain':!![]});return db[_0x0c8e('0x54')][_0x0c8e('0x46')]({'where':{'name':_0x0c8e('0x55'),'userProfileId':_0x55148b[_0x0c8e('0x56')]},'raw':!![]})[_0x0c8e('0x1f')](function(_0x416fa7){if(_0x416fa7&&_0x416fa7['autoAssociation']===0x0){return db[_0x0c8e('0x22')][_0x0c8e('0x49')]({'name':_0x3775d2[_0x0c8e('0x25')],'resourceId':_0x3775d2['id'],'type':_0x416fa7[_0x0c8e('0x25')],'sectionId':_0x416fa7['id']},{})[_0x0c8e('0x1f')](function(){return _0x296710;});}else{return _0x296710;}})[_0x0c8e('0x42')](function(_0x30bbd7){logger['error'](_0x0c8e('0x57'),_0x30bbd7);throw _0x30bbd7;});}return _0x296710;})[_0x0c8e('0x1f')](respondWithResult(_0x2eade5,0xc9))[_0x0c8e('0x42')](handleError(_0x2eade5,null));};
\ No newline at end of file
+var _0x1d68=['CannedAnswer','model','keys','intersection','query','attributes','length','nolimit','order','sort','where','filters','filter','merge','map','key','field','options','count','include','findAll','catch','show','params','rawAttributes','fields','includeAll','body','find','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','papaparse','../../config/license/hardware','ioredis','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','apply','reject','save','update','then','get','CannedAnswers','UserProfileResource','destroy','error','stack','name','send','index'];(function(_0x4c7c7b,_0x239171){var _0x1b9a23=function(_0x10c766){while(--_0x10c766){_0x4c7c7b['push'](_0x4c7c7b['shift']());}};_0x1b9a23(++_0x239171);}(_0x1d68,0x129));var _0x81d6=function(_0x3df21d,_0xa44265){_0x3df21d=_0x3df21d-0x0;var _0x37ab8a=_0x1d68[_0x3df21d];return _0x37ab8a;};'use strict';var pdf=require(_0x81d6('0x0'));var emlformat=require(_0x81d6('0x1'));var rimraf=require(_0x81d6('0x2'));var zipdir=require(_0x81d6('0x3'));var jsonpatch=require(_0x81d6('0x4'));var rp=require(_0x81d6('0x5'));var moment=require(_0x81d6('0x6'));var BPromise=require(_0x81d6('0x7'));var Mustache=require(_0x81d6('0x8'));var util=require(_0x81d6('0x9'));var path=require(_0x81d6('0xa'));var sox=require(_0x81d6('0xb'));var csv=require(_0x81d6('0xc'));var ejs=require(_0x81d6('0xd'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x81d6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x81d6('0xf'));var toCsv=require(_0x81d6('0xc'));var querystring=require('querystring');var Papa=require(_0x81d6('0x10'));var authService=require('../../components/auth/service');var hardwareService=require(_0x81d6('0x11'));var Redis=require(_0x81d6('0x12'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x81d6('0x13'));var utils=require(_0x81d6('0x14'));var config=require(_0x81d6('0x15'));var db=require(_0x81d6('0x16'))['db'];function respondWithStatusCode(_0x380ee6,_0x40f0c9){_0x40f0c9=_0x40f0c9||0xcc;return function(_0x5d4c7b){if(_0x5d4c7b){return _0x380ee6[_0x81d6('0x17')](_0x40f0c9);}return _0x380ee6['status'](_0x40f0c9)['end']();};}function respondWithResult(_0x27c529,_0xa4e197){_0xa4e197=_0xa4e197||0xc8;return function(_0x347549){if(_0x347549){return _0x27c529[_0x81d6('0x18')](_0xa4e197)[_0x81d6('0x19')](_0x347549);}};}function respondWithFilteredResult(_0x15ea6c,_0x257470){return function(_0x4f7eb4){if(_0x4f7eb4){var _0x3d7d00=_0x4f7eb4['count'],_0x17f048=_0x257470[_0x81d6('0x1a')],_0x4e4c3e=_0x257470[_0x81d6('0x1a')]+_0x257470[_0x81d6('0x1b')],_0x3ca3ea;if(_0x4e4c3e>=_0x3d7d00){_0x4e4c3e=_0x3d7d00;_0x3ca3ea=0xc8;}else{_0x3ca3ea=0xce;}_0x15ea6c[_0x81d6('0x18')](_0x3ca3ea);return _0x15ea6c[_0x81d6('0x1c')]('Content-Range',_0x17f048+'-'+_0x4e4c3e+'/'+_0x3d7d00)[_0x81d6('0x19')](_0x4f7eb4);}return null;};}function patchUpdates(_0x2b66e8){return function(_0x476058){try{jsonpatch[_0x81d6('0x1d')](_0x476058,_0x2b66e8,!![]);}catch(_0x336f6a){return BPromise[_0x81d6('0x1e')](_0x336f6a);}return _0x476058[_0x81d6('0x1f')]();};}function saveUpdates(_0x392b9b,_0x26a5d5){return function(_0x23c4ee){if(_0x23c4ee){return _0x23c4ee[_0x81d6('0x20')](_0x392b9b)[_0x81d6('0x21')](function(_0x423a65){return _0x423a65;});}return null;};}function removeEntity(_0x580ebb,_0x1443a0){return function(_0xdfcff8){if(_0xdfcff8){return _0xdfcff8['destroy']()[_0x81d6('0x21')](function(){var _0x47e082=_0xdfcff8[_0x81d6('0x22')]({'plain':!![]});var _0x56f384=_0x81d6('0x23');return db[_0x81d6('0x24')][_0x81d6('0x25')]({'where':{'type':_0x56f384,'resourceId':_0x47e082['id']}})['then'](function(){return _0xdfcff8;});})[_0x81d6('0x21')](function(){_0x580ebb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x25d8d5,_0x1e960b){return function(_0x4b2c4b){if(!_0x4b2c4b){_0x25d8d5['sendStatus'](0x194);}return _0x4b2c4b;};}function handleError(_0x1a1551,_0x645819){_0x645819=_0x645819||0x1f4;return function(_0x4ca646){logger[_0x81d6('0x26')](_0x4ca646[_0x81d6('0x27')]);if(_0x4ca646[_0x81d6('0x28')]){delete _0x4ca646[_0x81d6('0x28')];}_0x1a1551[_0x81d6('0x18')](_0x645819)[_0x81d6('0x29')](_0x4ca646);};}exports[_0x81d6('0x2a')]=function(_0xbffced,_0x3ab906){var _0xea03be={},_0x3b7940={},_0x3341d7={'count':0x0,'rows':[]};var _0x264a68=db[_0x81d6('0x2b')]['rawAttributes'];_0x3b7940[_0x81d6('0x2c')]=_[_0x81d6('0x2d')](_0x264a68);_0x3b7940['query']=_[_0x81d6('0x2d')](_0xbffced['query']);_0x3b7940['filters']=_[_0x81d6('0x2e')](_0x3b7940[_0x81d6('0x2c')],_0x3b7940['query']);_0xea03be['attributes']=_['intersection'](_0x3b7940[_0x81d6('0x2c')],qs['fields'](_0xbffced[_0x81d6('0x2f')]['fields']));_0xea03be[_0x81d6('0x30')]=_0xea03be[_0x81d6('0x30')][_0x81d6('0x31')]?_0xea03be[_0x81d6('0x30')]:_0x3b7940['model'];if(!_0xbffced[_0x81d6('0x2f')]['hasOwnProperty'](_0x81d6('0x32'))){_0xea03be['limit']=qs[_0x81d6('0x1b')](_0xbffced[_0x81d6('0x2f')][_0x81d6('0x1b')]);_0xea03be[_0x81d6('0x1a')]=qs[_0x81d6('0x1a')](_0xbffced['query']['offset']);}_0xea03be[_0x81d6('0x33')]=qs[_0x81d6('0x34')](_0xbffced['query']['sort']);_0xea03be[_0x81d6('0x35')]=qs['filters'](_['pick'](_0xbffced[_0x81d6('0x2f')],_0x3b7940[_0x81d6('0x36')]));if(_0xbffced[_0x81d6('0x2f')][_0x81d6('0x37')]){_0xea03be[_0x81d6('0x35')]=_[_0x81d6('0x38')](_0xea03be[_0x81d6('0x35')],{'$or':_[_0x81d6('0x39')](_0x264a68,function(_0x64c2c2){if(_0x64c2c2['type'][_0x81d6('0x3a')]!=='VIRTUAL'){var _0x1bc98d={};_0x1bc98d[_0x64c2c2[_0x81d6('0x3b')]]={'$like':'%'+_0xbffced[_0x81d6('0x2f')]['filter']+'%'};return _0x1bc98d;}})});}_0xea03be=_[_0x81d6('0x38')]({},_0xea03be,_0xbffced[_0x81d6('0x3c')]);var _0x2eb28c={'where':_0xea03be[_0x81d6('0x35')]};return db['CannedAnswer'][_0x81d6('0x3d')](_0x2eb28c)[_0x81d6('0x21')](function(_0x1bb2a3){_0x3341d7[_0x81d6('0x3d')]=_0x1bb2a3;if(_0xbffced[_0x81d6('0x2f')]['includeAll']){_0xea03be[_0x81d6('0x3e')]=[{'all':!![]}];}return db[_0x81d6('0x2b')][_0x81d6('0x3f')](_0xea03be);})[_0x81d6('0x21')](function(_0x1923c2){_0x3341d7['rows']=_0x1923c2;return _0x3341d7;})[_0x81d6('0x21')](respondWithFilteredResult(_0x3ab906,_0xea03be))[_0x81d6('0x40')](handleError(_0x3ab906,null));};exports[_0x81d6('0x41')]=function(_0x198b41,_0x25cc21){var _0x25793b={'raw':!![],'where':{'id':_0x198b41[_0x81d6('0x42')]['id']}},_0x359d99={};_0x359d99['model']=_['keys'](db[_0x81d6('0x2b')][_0x81d6('0x43')]);_0x359d99[_0x81d6('0x2f')]=_['keys'](_0x198b41['query']);_0x359d99[_0x81d6('0x36')]=_[_0x81d6('0x2e')](_0x359d99['model'],_0x359d99[_0x81d6('0x2f')]);_0x25793b['attributes']=_['intersection'](_0x359d99[_0x81d6('0x2c')],qs[_0x81d6('0x44')](_0x198b41[_0x81d6('0x2f')][_0x81d6('0x44')]));_0x25793b[_0x81d6('0x30')]=_0x25793b[_0x81d6('0x30')][_0x81d6('0x31')]?_0x25793b[_0x81d6('0x30')]:_0x359d99[_0x81d6('0x2c')];if(_0x198b41[_0x81d6('0x2f')][_0x81d6('0x45')]){_0x25793b['include']=[{'all':!![]}];}_0x25793b=_['merge']({},_0x25793b,_0x198b41[_0x81d6('0x3c')]);return db[_0x81d6('0x2b')]['find'](_0x25793b)[_0x81d6('0x21')](handleEntityNotFound(_0x25cc21,null))['then'](respondWithResult(_0x25cc21,null))['catch'](handleError(_0x25cc21,null));};exports[_0x81d6('0x20')]=function(_0x3cab44,_0x3df07b){if(_0x3cab44['body']['id']){delete _0x3cab44[_0x81d6('0x46')]['id'];}return db['CannedAnswer'][_0x81d6('0x47')]({'where':{'id':_0x3cab44[_0x81d6('0x42')]['id']}})[_0x81d6('0x21')](handleEntityNotFound(_0x3df07b,null))[_0x81d6('0x21')](saveUpdates(_0x3cab44[_0x81d6('0x46')],null))[_0x81d6('0x21')](respondWithResult(_0x3df07b,null))[_0x81d6('0x40')](handleError(_0x3df07b,null));};exports[_0x81d6('0x25')]=function(_0x3c8bb4,_0x138d62){return db[_0x81d6('0x2b')]['find']({'where':{'id':_0x3c8bb4[_0x81d6('0x42')]['id']}})['then'](handleEntityNotFound(_0x138d62,null))[_0x81d6('0x21')](removeEntity(_0x138d62,null))[_0x81d6('0x40')](handleError(_0x138d62,null));};exports['create']=function(_0x117114,_0x16c5bb){var _0x279d13={'key':_0x117114[_0x81d6('0x46')][_0x81d6('0x3a')]};if(_0x117114['body']['MailAccountId']){_0x279d13[_0x81d6('0x48')]=_0x117114[_0x81d6('0x46')][_0x81d6('0x48')];}else if(_0x117114[_0x81d6('0x46')][_0x81d6('0x49')]){_0x279d13[_0x81d6('0x49')]=_0x117114[_0x81d6('0x46')]['SmsAccountId'];}else if(_0x117114[_0x81d6('0x46')][_0x81d6('0x4a')]){_0x279d13[_0x81d6('0x4a')]=_0x117114['body'][_0x81d6('0x4a')];}else if(_0x117114['body'][_0x81d6('0x4b')]){_0x279d13[_0x81d6('0x4b')]=_0x117114[_0x81d6('0x46')]['ChatWebsiteId'];}return db[_0x81d6('0x2b')]['find']({'where':_0x279d13})[_0x81d6('0x21')](function(_0x568583){if(_0x568583){throw new db[(_0x81d6('0x4c'))][(_0x81d6('0x4d'))](_0x81d6('0x4e'));}return db[_0x81d6('0x2b')][_0x81d6('0x4f')](_0x117114[_0x81d6('0x46')]);})[_0x81d6('0x21')](function(_0xdfa348){var _0xa782b8=_0x117114[_0x81d6('0x50')][_0x81d6('0x22')]({'plain':!![]});if(!_0xa782b8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa782b8[_0x81d6('0x51')]===_0x81d6('0x50')){var _0x53b040=_0xdfa348['get']({'plain':!![]});return db['UserProfileSection'][_0x81d6('0x47')]({'where':{'name':_0x81d6('0x23'),'userProfileId':_0xa782b8[_0x81d6('0x52')]},'raw':!![]})[_0x81d6('0x21')](function(_0x481190){if(_0x481190&&_0x481190[_0x81d6('0x53')]===0x0){return db[_0x81d6('0x24')][_0x81d6('0x4f')]({'name':_0x53b040[_0x81d6('0x28')],'resourceId':_0x53b040['id'],'type':_0x481190['name'],'sectionId':_0x481190['id']},{})['then'](function(){return _0xdfa348;});}else{return _0xdfa348;}})['catch'](function(_0x59f8e3){logger[_0x81d6('0x26')](_0x81d6('0x54'),_0x59f8e3);throw _0x59f8e3;});}return _0xdfa348;})[_0x81d6('0x21')](respondWithResult(_0x16c5bb,0xc9))[_0x81d6('0x40')](handleError(_0x16c5bb,null));};
\ No newline at end of file
index dbf7f6e..4b2dcd5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x03cb=['tools_canned_answers','lodash','util','../../config/logger','bluebird','request-promise','./cannedAnswer.attributes','exports','define'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x03cb,0x145));var _0xb03c=function(_0x5c2af6,_0x8cd224){_0x5c2af6=_0x5c2af6-0x0;var _0x4a9f74=_0x03cb[_0x5c2af6];return _0x4a9f74;};'use strict';var _=require(_0xb03c('0x0'));var util=require(_0xb03c('0x1'));var logger=require(_0xb03c('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb03c('0x3'));var rp=require(_0xb03c('0x4'));var attributes=require(_0xb03c('0x5'));module[_0xb03c('0x6')]=function(_0x46b16d,_0x5613c0){return _0x46b16d[_0xb03c('0x7')]('CannedAnswer',attributes,{'tableName':_0xb03c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xeb5c=['util','api','moment','bluebird','request-promise','define','CannedAnswer'];(function(_0x2be143,_0x37e656){var _0x3e92bb=function(_0x109b68){while(--_0x109b68){_0x2be143['push'](_0x2be143['shift']());}};_0x3e92bb(++_0x37e656);}(_0xeb5c,0x1e3));var _0xceb5=function(_0x1be2dc,_0x5bd217){_0x1be2dc=_0x1be2dc-0x0;var _0x371259=_0xeb5c[_0x1be2dc];return _0x371259;};'use strict';var _=require('lodash');var util=require(_0xceb5('0x0'));var logger=require('../../config/logger')(_0xceb5('0x1'));var moment=require(_0xceb5('0x2'));var BPromise=require(_0xceb5('0x3'));var rp=require(_0xceb5('0x4'));var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x32069c,_0x599be7){return _0x32069c[_0xceb5('0x5')](_0xceb5('0x6'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index b8fcc56..0ae3515 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9dbb=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0x424568,_0x5982f4){var _0x9aed1b=function(_0x206086){while(--_0x206086){_0x424568['push'](_0x424568['shift']());}};_0x9aed1b(++_0x5982f4);}(_0x9dbb,0xbe));var _0xb9db=function(_0x3e6ead,_0x61f91a){_0x3e6ead=_0x3e6ead-0x0;var _0x28f590=_0x9dbb[_0x3e6ead];return _0x28f590;};'use strict';var _=require(_0xb9db('0x0'));var util=require(_0xb9db('0x1'));var moment=require(_0xb9db('0x2'));var BPromise=require(_0xb9db('0x3'));var rs=require(_0xb9db('0x4'));var fs=require('fs');var Redis=require(_0xb9db('0x5'));var db=require(_0xb9db('0x6'))['db'];var utils=require(_0xb9db('0x7'));var logger=require('../../config/logger')(_0xb9db('0x8'));var config=require(_0xb9db('0x9'));var jayson=require(_0xb9db('0xa'));var client=jayson[_0xb9db('0xb')][_0xb9db('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c12bd,_0x485349,_0x1ca775){return new BPromise(function(_0x46c767,_0x43f733){return client['request'](_0x4c12bd,_0x1ca775)[_0xb9db('0xd')](function(_0x36c09d){logger[_0xb9db('0xe')](_0xb9db('0xf'),_0x485349,_0xb9db('0x10'));logger[_0xb9db('0x11')](_0xb9db('0x12'),_0x485349,'request\x20sent',JSON['stringify'](_0x36c09d));if(_0x36c09d[_0xb9db('0x13')]){if(_0x36c09d['error'][_0xb9db('0x14')]===0x1f4){logger['error']('CannedAnswer,\x20%s,\x20%s',_0x485349,_0x36c09d['error'][_0xb9db('0x15')]);return _0x43f733(_0x36c09d['error']['message']);}logger[_0xb9db('0x13')](_0xb9db('0xf'),_0x485349,_0x36c09d[_0xb9db('0x13')][_0xb9db('0x15')]);return _0x46c767(_0x36c09d[_0xb9db('0x13')][_0xb9db('0x15')]);}else{logger['info'](_0xb9db('0xf'),_0x485349,'request\x20sent');_0x46c767(_0x36c09d[_0xb9db('0x16')][_0xb9db('0x15')]);}})[_0xb9db('0x17')](function(_0x2bc873){logger[_0xb9db('0x13')](_0xb9db('0xf'),_0x485349,_0x2bc873);_0x43f733(_0x2bc873);});});}
\ No newline at end of file
+var _0xde4b=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CannedAnswer,\x20%s,\x20%s'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xde4b,0x188));var _0xbde4=function(_0x25cf72,_0x5908d5){_0x25cf72=_0x25cf72-0x0;var _0x6361ca=_0xde4b[_0x25cf72];return _0x6361ca;};'use strict';var _=require(_0xbde4('0x0'));var util=require(_0xbde4('0x1'));var moment=require('moment');var BPromise=require(_0xbde4('0x2'));var rs=require(_0xbde4('0x3'));var fs=require('fs');var Redis=require(_0xbde4('0x4'));var db=require(_0xbde4('0x5'))['db'];var utils=require(_0xbde4('0x6'));var logger=require(_0xbde4('0x7'))('rpc');var config=require(_0xbde4('0x8'));var jayson=require(_0xbde4('0x9'));var client=jayson[_0xbde4('0xa')][_0xbde4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24d2e6,_0x526650,_0x25ae83){return new BPromise(function(_0x2f90d0,_0x51f9a2){return client[_0xbde4('0xc')](_0x24d2e6,_0x25ae83)[_0xbde4('0xd')](function(_0x545ef7){logger[_0xbde4('0xe')](_0xbde4('0xf'),_0x526650,_0xbde4('0x10'));logger[_0xbde4('0x11')]('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x526650,'request\x20sent',JSON[_0xbde4('0x12')](_0x545ef7));if(_0x545ef7[_0xbde4('0x13')]){if(_0x545ef7[_0xbde4('0x13')][_0xbde4('0x14')]===0x1f4){logger[_0xbde4('0x13')]('CannedAnswer,\x20%s,\x20%s',_0x526650,_0x545ef7['error'][_0xbde4('0x15')]);return _0x51f9a2(_0x545ef7[_0xbde4('0x13')][_0xbde4('0x15')]);}logger[_0xbde4('0x13')]('CannedAnswer,\x20%s,\x20%s',_0x526650,_0x545ef7[_0xbde4('0x13')]['message']);return _0x2f90d0(_0x545ef7[_0xbde4('0x13')][_0xbde4('0x15')]);}else{logger[_0xbde4('0xe')](_0xbde4('0xf'),_0x526650,_0xbde4('0x10'));_0x2f90d0(_0x545ef7[_0xbde4('0x16')]['message']);}})[_0xbde4('0x17')](function(_0x4fc6c0){logger['error']('CannedAnswer,\x20%s,\x20%s',_0x526650,_0x4fc6c0);_0x51f9a2(_0x4fc6c0);});});}
\ No newline at end of file
index 07d31d4..adeaf63 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3edc=['isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x3edc,0x1ae));var _0xc3ed=function(_0x1263c1,_0x287a24){_0x1263c1=_0x1263c1-0x0;var _0x59639e=_0x3edc[_0x1263c1];return _0x59639e;};'use strict';var multer=require(_0xc3ed('0x0'));var util=require(_0xc3ed('0x1'));var path=require(_0xc3ed('0x2'));var timeout=require(_0xc3ed('0x3'));var express=require(_0xc3ed('0x4'));var router=express[_0xc3ed('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc3ed('0x6'));var config=require(_0xc3ed('0x7'));var controller=require(_0xc3ed('0x8'));router[_0xc3ed('0x9')]('/',auth[_0xc3ed('0xa')](),controller[_0xc3ed('0xb')]);router[_0xc3ed('0x9')](_0xc3ed('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xc3ed('0xd')]('/',auth[_0xc3ed('0xa')](),controller[_0xc3ed('0xe')]);router[_0xc3ed('0xf')](_0xc3ed('0xc'),auth[_0xc3ed('0xa')](),controller[_0xc3ed('0x10')]);router[_0xc3ed('0x11')]('/:id',auth[_0xc3ed('0xa')](),controller[_0xc3ed('0x12')]);module[_0xc3ed('0x13')]=router;
\ No newline at end of file
+var _0xceac=['express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','update','delete','exports','multer','util','path'];(function(_0x5eb56c,_0x5bcf89){var _0x7ce5=function(_0x52c842){while(--_0x52c842){_0x5eb56c['push'](_0x5eb56c['shift']());}};_0x7ce5(++_0x5bcf89);}(_0xceac,0x1b0));var _0xccea=function(_0x16bf69,_0x261e92){_0x16bf69=_0x16bf69-0x0;var _0x388256=_0xceac[_0x16bf69];return _0x388256;};'use strict';var multer=require(_0xccea('0x0'));var util=require(_0xccea('0x1'));var path=require(_0xccea('0x2'));var timeout=require('connect-timeout');var express=require(_0xccea('0x3'));var router=express[_0xccea('0x4')]();var auth=require(_0xccea('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xccea('0x6'));var controller=require('./cannedAnswer.controller');router[_0xccea('0x7')]('/',auth[_0xccea('0x8')](),controller['index']);router[_0xccea('0x7')](_0xccea('0x9'),auth[_0xccea('0x8')](),controller[_0xccea('0xa')]);router[_0xccea('0xb')]('/',auth[_0xccea('0x8')](),controller['create']);router['put'](_0xccea('0x9'),auth[_0xccea('0x8')](),controller[_0xccea('0xc')]);router[_0xccea('0xd')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xccea('0xe')]=router;
\ No newline at end of file
index dbeca58..64f1bdb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5afb=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x5afb,0x14e));var _0xb5af=function(_0xe59cff,_0x1a7dbe){_0xe59cff=_0xe59cff-0x0;var _0x26e8c1=_0x5afb[_0xe59cff];return _0x26e8c1;};'use strict';var Sequelize=require(_0xb5af('0x0'));module[_0xb5af('0x1')]={'calldate':{'type':Sequelize[_0xb5af('0x2')],'allowNull':![],'defaultValue':_0xb5af('0x3')},'clid':{'type':Sequelize[_0xb5af('0x4')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xb5af('0x4')]},'dcontext':{'type':Sequelize[_0xb5af('0x4')]},'channel':{'type':Sequelize[_0xb5af('0x4')]},'dstchannel':{'type':Sequelize[_0xb5af('0x4')]},'lastapp':{'type':Sequelize[_0xb5af('0x4')]},'lastdata':{'type':Sequelize[_0xb5af('0x4')]},'duration':{'type':Sequelize[_0xb5af('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xb5af('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xb5af('0x4')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xb5af('0x4')]},'userfield':{'type':Sequelize[_0xb5af('0x4')]},'uniqueid':{'type':Sequelize[_0xb5af('0x4')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xb5af('0x4')]},'peeraccount':{'type':Sequelize[_0xb5af('0x4')]},'type':{'type':Sequelize[_0xb5af('0x4')]},'tag':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0xbf5f=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x95ad05,_0x3cadb6){var _0x2d79f4=function(_0x9868f2){while(--_0x9868f2){_0x95ad05['push'](_0x95ad05['shift']());}};_0x2d79f4(++_0x3cadb6);}(_0xbf5f,0x1a9));var _0xfbf5=function(_0x13820f,_0x250841){_0x13820f=_0x13820f-0x0;var _0x40b75b=_0xbf5f[_0x13820f];return _0x40b75b;};'use strict';var Sequelize=require(_0xfbf5('0x0'));module[_0xfbf5('0x1')]={'calldate':{'type':Sequelize[_0xfbf5('0x2')],'allowNull':![],'defaultValue':_0xfbf5('0x3')},'clid':{'type':Sequelize[_0xfbf5('0x4')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0xfbf5('0x4')]},'channel':{'type':Sequelize[_0xfbf5('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0xfbf5('0x4')]},'lastdata':{'type':Sequelize[_0xfbf5('0x4')]},'duration':{'type':Sequelize[_0xfbf5('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xfbf5('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xfbf5('0x4')]},'userfield':{'type':Sequelize[_0xfbf5('0x4')]},'uniqueid':{'type':Sequelize[_0xfbf5('0x4')]},'linkedid':{'type':Sequelize[_0xfbf5('0x4')]},'sequence':{'type':Sequelize[_0xfbf5('0x4')]},'peeraccount':{'type':Sequelize[_0xfbf5('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize['STRING']}};
\ No newline at end of file
index 24dfad3..97469fb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x865e=['sort','where','pick','filters','filter','merge','map','type','VIRTUAL','field','includeAll','include','catch','show','length','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','index','Cdr','rawAttributes','model','keys','query','intersection','attributes','fields','nolimit','limit','order'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x865e,0xa7));var _0xe865=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x865e[_0x47fd36];return _0x21a0fc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe865('0x0'));var rimraf=require(_0xe865('0x1'));var zipdir=require(_0xe865('0x2'));var jsonpatch=require(_0xe865('0x3'));var rp=require(_0xe865('0x4'));var moment=require(_0xe865('0x5'));var BPromise=require(_0xe865('0x6'));var Mustache=require(_0xe865('0x7'));var util=require(_0xe865('0x8'));var path=require(_0xe865('0x9'));var sox=require(_0xe865('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe865('0xb'));var squel=require(_0xe865('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe865('0xd'));var toCsv=require(_0xe865('0xe'));var querystring=require(_0xe865('0xf'));var Papa=require(_0xe865('0x10'));var authService=require(_0xe865('0x11'));var hardwareService=require(_0xe865('0x12'));var Redis=require(_0xe865('0x13'));var qs=require('../../components/parsers/qs');var logger=require(_0xe865('0x14'))(_0xe865('0x15'));var utils=require(_0xe865('0x16'));var config=require(_0xe865('0x17'));var db=require(_0xe865('0x18'))['db'];function respondWithStatusCode(_0x179888,_0x4a22ab){_0x4a22ab=_0x4a22ab||0xcc;return function(_0x929f3e){if(_0x929f3e){return _0x179888[_0xe865('0x19')](_0x4a22ab);}return _0x179888[_0xe865('0x1a')](_0x4a22ab)[_0xe865('0x1b')]();};}function respondWithResult(_0x5db751,_0x4b423f){_0x4b423f=_0x4b423f||0xc8;return function(_0x2ed80a){if(_0x2ed80a){return _0x5db751[_0xe865('0x1a')](_0x4b423f)['json'](_0x2ed80a);}};}function respondWithFilteredResult(_0x3b06ac,_0x49ac6d){return function(_0x59d7aa){if(_0x59d7aa){var _0x23350c=_0x59d7aa[_0xe865('0x1c')],_0x3bfbe5=_0x49ac6d[_0xe865('0x1d')],_0x5c6018=_0x49ac6d[_0xe865('0x1d')]+_0x49ac6d['limit'],_0x383050;if(_0x5c6018>=_0x23350c){_0x5c6018=_0x23350c;_0x383050=0xc8;}else{_0x383050=0xce;}_0x3b06ac[_0xe865('0x1a')](_0x383050);return _0x3b06ac['set'](_0xe865('0x1e'),_0x3bfbe5+'-'+_0x5c6018+'/'+_0x23350c)[_0xe865('0x1f')](_0x59d7aa);}return null;};}function patchUpdates(_0x28ca22){return function(_0x26545b){try{jsonpatch[_0xe865('0x20')](_0x26545b,_0x28ca22,!![]);}catch(_0x4a660e){return BPromise[_0xe865('0x21')](_0x4a660e);}return _0x26545b[_0xe865('0x22')]();};}function saveUpdates(_0x234093,_0x242b40){return function(_0x2290ec){if(_0x2290ec){return _0x2290ec['update'](_0x234093)[_0xe865('0x23')](function(_0x381667){return _0x381667;});}return null;};}function removeEntity(_0x11acf2,_0x16818c){return function(_0x2332b8){if(_0x2332b8){return _0x2332b8[_0xe865('0x24')]()[_0xe865('0x23')](function(){_0x11acf2[_0xe865('0x1a')](0xcc)[_0xe865('0x1b')]();});}};}function handleEntityNotFound(_0x1ce018,_0x3d565d){return function(_0x593d65){if(!_0x593d65){_0x1ce018[_0xe865('0x19')](0x194);}return _0x593d65;};}function handleError(_0x158f00,_0x28c7eb){_0x28c7eb=_0x28c7eb||0x1f4;return function(_0x2791d4){logger['error'](_0x2791d4[_0xe865('0x25')]);if(_0x2791d4[_0xe865('0x26')]){delete _0x2791d4[_0xe865('0x26')];}_0x158f00[_0xe865('0x1a')](_0x28c7eb)[_0xe865('0x27')](_0x2791d4);};}exports[_0xe865('0x28')]=function(_0x5aa508,_0x4dbbfe){var _0x445975={},_0x3d6f9e={},_0x8d0a54={'count':0x0,'rows':[]};var _0x19ce79=db[_0xe865('0x29')][_0xe865('0x2a')];_0x3d6f9e[_0xe865('0x2b')]=_[_0xe865('0x2c')](_0x19ce79);_0x3d6f9e[_0xe865('0x2d')]=_[_0xe865('0x2c')](_0x5aa508[_0xe865('0x2d')]);_0x3d6f9e['filters']=_[_0xe865('0x2e')](_0x3d6f9e['model'],_0x3d6f9e[_0xe865('0x2d')]);_0x445975[_0xe865('0x2f')]=_['intersection'](_0x3d6f9e['model'],qs[_0xe865('0x30')](_0x5aa508[_0xe865('0x2d')][_0xe865('0x30')]));_0x445975[_0xe865('0x2f')]=_0x445975[_0xe865('0x2f')]['length']?_0x445975[_0xe865('0x2f')]:_0x3d6f9e[_0xe865('0x2b')];if(!_0x5aa508['query']['hasOwnProperty'](_0xe865('0x31'))){_0x445975['limit']=qs[_0xe865('0x32')](_0x5aa508[_0xe865('0x2d')][_0xe865('0x32')]);_0x445975[_0xe865('0x1d')]=qs['offset'](_0x5aa508['query'][_0xe865('0x1d')]);}_0x445975[_0xe865('0x33')]=qs[_0xe865('0x34')](_0x5aa508[_0xe865('0x2d')][_0xe865('0x34')]);_0x445975[_0xe865('0x35')]=qs['filters'](_[_0xe865('0x36')](_0x5aa508[_0xe865('0x2d')],_0x3d6f9e[_0xe865('0x37')]));if(_0x5aa508[_0xe865('0x2d')][_0xe865('0x38')]){_0x445975[_0xe865('0x35')]=_[_0xe865('0x39')](_0x445975[_0xe865('0x35')],{'$or':_[_0xe865('0x3a')](_0x19ce79,function(_0x37e3ed){if(_0x37e3ed[_0xe865('0x3b')]['key']!==_0xe865('0x3c')){var _0x34c0be={};_0x34c0be[_0x37e3ed[_0xe865('0x3d')]]={'$like':'%'+_0x5aa508['query'][_0xe865('0x38')]+'%'};return _0x34c0be;}})});}_0x445975=_[_0xe865('0x39')]({},_0x445975,_0x5aa508['options']);var _0x26f0ee={'where':_0x445975['where']};return db[_0xe865('0x29')][_0xe865('0x1c')](_0x26f0ee)[_0xe865('0x23')](function(_0x16d3c1){_0x8d0a54[_0xe865('0x1c')]=_0x16d3c1;if(_0x5aa508[_0xe865('0x2d')][_0xe865('0x3e')]){_0x445975[_0xe865('0x3f')]=[{'all':!![]}];}return db[_0xe865('0x29')]['findAll'](_0x445975);})[_0xe865('0x23')](function(_0x38c247){_0x8d0a54['rows']=_0x38c247;return _0x8d0a54;})[_0xe865('0x23')](respondWithFilteredResult(_0x4dbbfe,_0x445975))[_0xe865('0x40')](handleError(_0x4dbbfe,null));};exports[_0xe865('0x41')]=function(_0x36a69e,_0x13d8bc){var _0x2d39e7={'raw':!![],'where':{'id':_0x36a69e['params']['id']}},_0x9290c0={};_0x9290c0['model']=_[_0xe865('0x2c')](db[_0xe865('0x29')][_0xe865('0x2a')]);_0x9290c0[_0xe865('0x2d')]=_[_0xe865('0x2c')](_0x36a69e[_0xe865('0x2d')]);_0x9290c0[_0xe865('0x37')]=_[_0xe865('0x2e')](_0x9290c0[_0xe865('0x2b')],_0x9290c0['query']);_0x2d39e7[_0xe865('0x2f')]=_['intersection'](_0x9290c0[_0xe865('0x2b')],qs[_0xe865('0x30')](_0x36a69e['query'][_0xe865('0x30')]));_0x2d39e7[_0xe865('0x2f')]=_0x2d39e7[_0xe865('0x2f')][_0xe865('0x42')]?_0x2d39e7['attributes']:_0x9290c0[_0xe865('0x2b')];if(_0x36a69e[_0xe865('0x2d')][_0xe865('0x3e')]){_0x2d39e7[_0xe865('0x3f')]=[{'all':!![]}];}_0x2d39e7=_[_0xe865('0x39')]({},_0x2d39e7,_0x36a69e['options']);return db[_0xe865('0x29')][_0xe865('0x43')](_0x2d39e7)[_0xe865('0x23')](handleEntityNotFound(_0x13d8bc,null))[_0xe865('0x23')](respondWithResult(_0x13d8bc,null))[_0xe865('0x40')](handleError(_0x13d8bc,null));};exports['create']=function(_0x54a472,_0x479183){return db[_0xe865('0x29')][_0xe865('0x44')](_0x54a472['body'],{})['then'](respondWithResult(_0x479183,0xc9))[_0xe865('0x40')](handleError(_0x479183,null));};exports[_0xe865('0x45')]=function(_0x1485f3,_0x5b16e7){if(_0x1485f3[_0xe865('0x46')]['id']){delete _0x1485f3['body']['id'];}return db['Cdr']['find']({'where':{'id':_0x1485f3[_0xe865('0x47')]['id']}})[_0xe865('0x23')](handleEntityNotFound(_0x5b16e7,null))[_0xe865('0x23')](saveUpdates(_0x1485f3[_0xe865('0x46')],null))[_0xe865('0x23')](respondWithResult(_0x5b16e7,null))[_0xe865('0x40')](handleError(_0x5b16e7,null));};exports[_0xe865('0x24')]=function(_0xb05ad9,_0x20992e){return db['Cdr'][_0xe865('0x43')]({'where':{'id':_0xb05ad9[_0xe865('0x47')]['id']}})['then'](handleEntityNotFound(_0x20992e,null))[_0xe865('0x23')](removeEntity(_0x20992e,null))[_0xe865('0x40')](handleError(_0x20992e,null));};exports[_0xe865('0x48')]=function(_0x1550eb,_0x7e37d8){return db[_0xe865('0x29')][_0xe865('0x48')]()['then'](respondWithResult(_0x7e37d8,null))[_0xe865('0x40')](handleError(_0x7e37d8,null));};
\ No newline at end of file
+var _0xfb17=['util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','set','apply','reject','save','update','then','destroy','error','name','send','index','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','map','key','VIRTUAL','merge','options','count','includeAll','include','Cdr','findAll','rows','show','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x32bdfa,_0x30ff37){var _0x5ab5c2=function(_0x5b8b5e){while(--_0x5b8b5e){_0x32bdfa['push'](_0x32bdfa['shift']());}};_0x5ab5c2(++_0x30ff37);}(_0xfb17,0x165));var _0x7fb1=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xfb17[_0x40220a];return _0x3903cc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7fb1('0x0'));var rimraf=require(_0x7fb1('0x1'));var zipdir=require(_0x7fb1('0x2'));var jsonpatch=require(_0x7fb1('0x3'));var rp=require(_0x7fb1('0x4'));var moment=require(_0x7fb1('0x5'));var BPromise=require(_0x7fb1('0x6'));var Mustache=require(_0x7fb1('0x7'));var util=require(_0x7fb1('0x8'));var path=require(_0x7fb1('0x9'));var sox=require(_0x7fb1('0xa'));var csv=require(_0x7fb1('0xb'));var ejs=require(_0x7fb1('0xc'));var fs=require('fs');var _=require(_0x7fb1('0xd'));var squel=require(_0x7fb1('0xe'));var crypto=require(_0x7fb1('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7fb1('0xb'));var querystring=require(_0x7fb1('0x10'));var Papa=require(_0x7fb1('0x11'));var authService=require('../../components/auth/service');var hardwareService=require(_0x7fb1('0x12'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x7fb1('0x13'))(_0x7fb1('0x14'));var utils=require(_0x7fb1('0x15'));var config=require(_0x7fb1('0x16'));var db=require(_0x7fb1('0x17'))['db'];function respondWithStatusCode(_0x509e12,_0x2cbf14){_0x2cbf14=_0x2cbf14||0xcc;return function(_0x11e395){if(_0x11e395){return _0x509e12[_0x7fb1('0x18')](_0x2cbf14);}return _0x509e12['status'](_0x2cbf14)[_0x7fb1('0x19')]();};}function respondWithResult(_0x3e972f,_0x499469){_0x499469=_0x499469||0xc8;return function(_0x5d284e){if(_0x5d284e){return _0x3e972f[_0x7fb1('0x1a')](_0x499469)['json'](_0x5d284e);}};}function respondWithFilteredResult(_0x35d233,_0x448dfe){return function(_0x161f15){if(_0x161f15){var _0x2a3704=_0x161f15['count'],_0x469f16=_0x448dfe[_0x7fb1('0x1b')],_0x25bbf2=_0x448dfe[_0x7fb1('0x1b')]+_0x448dfe[_0x7fb1('0x1c')],_0x2db366;if(_0x25bbf2>=_0x2a3704){_0x25bbf2=_0x2a3704;_0x2db366=0xc8;}else{_0x2db366=0xce;}_0x35d233[_0x7fb1('0x1a')](_0x2db366);return _0x35d233[_0x7fb1('0x1d')]('Content-Range',_0x469f16+'-'+_0x25bbf2+'/'+_0x2a3704)['json'](_0x161f15);}return null;};}function patchUpdates(_0x332381){return function(_0x27cd07){try{jsonpatch[_0x7fb1('0x1e')](_0x27cd07,_0x332381,!![]);}catch(_0x2923f2){return BPromise[_0x7fb1('0x1f')](_0x2923f2);}return _0x27cd07[_0x7fb1('0x20')]();};}function saveUpdates(_0x4bd150,_0x1e8edf){return function(_0x174c32){if(_0x174c32){return _0x174c32[_0x7fb1('0x21')](_0x4bd150)[_0x7fb1('0x22')](function(_0x5ee80d){return _0x5ee80d;});}return null;};}function removeEntity(_0x18fd0e,_0x443661){return function(_0x3b5b77){if(_0x3b5b77){return _0x3b5b77[_0x7fb1('0x23')]()[_0x7fb1('0x22')](function(){_0x18fd0e[_0x7fb1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x318c02,_0x4a0f01){return function(_0x287036){if(!_0x287036){_0x318c02['sendStatus'](0x194);}return _0x287036;};}function handleError(_0x4c7f2e,_0x50c523){_0x50c523=_0x50c523||0x1f4;return function(_0x25f364){logger[_0x7fb1('0x24')](_0x25f364['stack']);if(_0x25f364[_0x7fb1('0x25')]){delete _0x25f364[_0x7fb1('0x25')];}_0x4c7f2e[_0x7fb1('0x1a')](_0x50c523)[_0x7fb1('0x26')](_0x25f364);};}exports[_0x7fb1('0x27')]=function(_0xce7d9e,_0x3aeb14){var _0x569297={},_0x461828={},_0x3b8354={'count':0x0,'rows':[]};var _0x202235=db['Cdr'][_0x7fb1('0x28')];_0x461828[_0x7fb1('0x29')]=_[_0x7fb1('0x2a')](_0x202235);_0x461828[_0x7fb1('0x2b')]=_['keys'](_0xce7d9e[_0x7fb1('0x2b')]);_0x461828['filters']=_[_0x7fb1('0x2c')](_0x461828[_0x7fb1('0x29')],_0x461828[_0x7fb1('0x2b')]);_0x569297[_0x7fb1('0x2d')]=_['intersection'](_0x461828[_0x7fb1('0x29')],qs[_0x7fb1('0x2e')](_0xce7d9e[_0x7fb1('0x2b')][_0x7fb1('0x2e')]));_0x569297[_0x7fb1('0x2d')]=_0x569297[_0x7fb1('0x2d')][_0x7fb1('0x2f')]?_0x569297['attributes']:_0x461828[_0x7fb1('0x29')];if(!_0xce7d9e[_0x7fb1('0x2b')][_0x7fb1('0x30')](_0x7fb1('0x31'))){_0x569297[_0x7fb1('0x1c')]=qs[_0x7fb1('0x1c')](_0xce7d9e[_0x7fb1('0x2b')]['limit']);_0x569297['offset']=qs[_0x7fb1('0x1b')](_0xce7d9e[_0x7fb1('0x2b')][_0x7fb1('0x1b')]);}_0x569297[_0x7fb1('0x32')]=qs['sort'](_0xce7d9e[_0x7fb1('0x2b')]['sort']);_0x569297[_0x7fb1('0x33')]=qs[_0x7fb1('0x34')](_[_0x7fb1('0x35')](_0xce7d9e['query'],_0x461828[_0x7fb1('0x34')]));if(_0xce7d9e[_0x7fb1('0x2b')][_0x7fb1('0x36')]){_0x569297[_0x7fb1('0x33')]=_['merge'](_0x569297[_0x7fb1('0x33')],{'$or':_[_0x7fb1('0x37')](_0x202235,function(_0x7924a6){if(_0x7924a6['type'][_0x7fb1('0x38')]!==_0x7fb1('0x39')){var _0x7c8122={};_0x7c8122[_0x7924a6['field']]={'$like':'%'+_0xce7d9e[_0x7fb1('0x2b')]['filter']+'%'};return _0x7c8122;}})});}_0x569297=_[_0x7fb1('0x3a')]({},_0x569297,_0xce7d9e[_0x7fb1('0x3b')]);var _0x393519={'where':_0x569297[_0x7fb1('0x33')]};return db['Cdr'][_0x7fb1('0x3c')](_0x393519)[_0x7fb1('0x22')](function(_0xe2e074){_0x3b8354[_0x7fb1('0x3c')]=_0xe2e074;if(_0xce7d9e[_0x7fb1('0x2b')][_0x7fb1('0x3d')]){_0x569297[_0x7fb1('0x3e')]=[{'all':!![]}];}return db[_0x7fb1('0x3f')][_0x7fb1('0x40')](_0x569297);})[_0x7fb1('0x22')](function(_0x4fb913){_0x3b8354[_0x7fb1('0x41')]=_0x4fb913;return _0x3b8354;})[_0x7fb1('0x22')](respondWithFilteredResult(_0x3aeb14,_0x569297))['catch'](handleError(_0x3aeb14,null));};exports[_0x7fb1('0x42')]=function(_0x1d898a,_0x484754){var _0x4cc222={'raw':!![],'where':{'id':_0x1d898a[_0x7fb1('0x43')]['id']}},_0x5e1742={};_0x5e1742['model']=_[_0x7fb1('0x2a')](db[_0x7fb1('0x3f')][_0x7fb1('0x28')]);_0x5e1742[_0x7fb1('0x2b')]=_[_0x7fb1('0x2a')](_0x1d898a[_0x7fb1('0x2b')]);_0x5e1742['filters']=_[_0x7fb1('0x2c')](_0x5e1742[_0x7fb1('0x29')],_0x5e1742[_0x7fb1('0x2b')]);_0x4cc222[_0x7fb1('0x2d')]=_[_0x7fb1('0x2c')](_0x5e1742[_0x7fb1('0x29')],qs[_0x7fb1('0x2e')](_0x1d898a[_0x7fb1('0x2b')][_0x7fb1('0x2e')]));_0x4cc222[_0x7fb1('0x2d')]=_0x4cc222[_0x7fb1('0x2d')][_0x7fb1('0x2f')]?_0x4cc222[_0x7fb1('0x2d')]:_0x5e1742[_0x7fb1('0x29')];if(_0x1d898a[_0x7fb1('0x2b')]['includeAll']){_0x4cc222[_0x7fb1('0x3e')]=[{'all':!![]}];}_0x4cc222=_[_0x7fb1('0x3a')]({},_0x4cc222,_0x1d898a['options']);return db[_0x7fb1('0x3f')][_0x7fb1('0x44')](_0x4cc222)[_0x7fb1('0x22')](handleEntityNotFound(_0x484754,null))[_0x7fb1('0x22')](respondWithResult(_0x484754,null))[_0x7fb1('0x45')](handleError(_0x484754,null));};exports[_0x7fb1('0x46')]=function(_0x1040e1,_0x5df1fa){return db[_0x7fb1('0x3f')][_0x7fb1('0x46')](_0x1040e1[_0x7fb1('0x47')],{})['then'](respondWithResult(_0x5df1fa,0xc9))[_0x7fb1('0x45')](handleError(_0x5df1fa,null));};exports[_0x7fb1('0x21')]=function(_0x7f8b6,_0x39a8a8){if(_0x7f8b6['body']['id']){delete _0x7f8b6[_0x7fb1('0x47')]['id'];}return db[_0x7fb1('0x3f')][_0x7fb1('0x44')]({'where':{'id':_0x7f8b6[_0x7fb1('0x43')]['id']}})['then'](handleEntityNotFound(_0x39a8a8,null))[_0x7fb1('0x22')](saveUpdates(_0x7f8b6[_0x7fb1('0x47')],null))[_0x7fb1('0x22')](respondWithResult(_0x39a8a8,null))[_0x7fb1('0x45')](handleError(_0x39a8a8,null));};exports[_0x7fb1('0x23')]=function(_0x3a4e96,_0x1ba3d5){return db[_0x7fb1('0x3f')][_0x7fb1('0x44')]({'where':{'id':_0x3a4e96[_0x7fb1('0x43')]['id']}})[_0x7fb1('0x22')](handleEntityNotFound(_0x1ba3d5,null))[_0x7fb1('0x22')](removeEntity(_0x1ba3d5,null))[_0x7fb1('0x45')](handleError(_0x1ba3d5,null));};exports['describe']=function(_0x5e324b,_0x2a1768){return db[_0x7fb1('0x3f')][_0x7fb1('0x48')]()['then'](respondWithResult(_0x2a1768,null))['catch'](handleError(_0x2a1768,null));};
\ No newline at end of file
index 6ee2262..0a6b67b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe9ee=['exports','define','cdr','accountcode','calldate','disposition','dst','src','lodash','util','moment','bluebird','request-promise','./cdr.attributes'];(function(_0x5224cf,_0x35a4d1){var _0x1d8fbd=function(_0x2eb57e){while(--_0x2eb57e){_0x5224cf['push'](_0x5224cf['shift']());}};_0x1d8fbd(++_0x35a4d1);}(_0xe9ee,0xa2));var _0xee9e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9ee[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee9e('0x0'));var util=require(_0xee9e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xee9e('0x2'));var BPromise=require(_0xee9e('0x3'));var rp=require(_0xee9e('0x4'));var attributes=require(_0xee9e('0x5'));module[_0xee9e('0x6')]=function(_0x44b150,_0x23edba){return _0x44b150[_0xee9e('0x7')]('Cdr',attributes,{'tableName':_0xee9e('0x8'),'paranoid':![],'indexes':[{'name':_0xee9e('0x9'),'fields':[_0xee9e('0x9')]},{'name':'calldate','fields':[_0xee9e('0xa')]},{'name':_0xee9e('0xb'),'fields':['disposition']},{'name':_0xee9e('0xc'),'fields':[_0xee9e('0xc')]},{'name':_0xee9e('0xd'),'fields':[_0xee9e('0xd')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':![]});};
\ No newline at end of file
+var _0xc313=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','define','Cdr','cdr','accountcode','calldate','disposition','dst','src'];(function(_0x37c3a4,_0x3cda20){var _0x5dc4d2=function(_0x1daeff){while(--_0x1daeff){_0x37c3a4['push'](_0x37c3a4['shift']());}};_0x5dc4d2(++_0x3cda20);}(_0xc313,0x178));var _0x3c31=function(_0x28ca2b,_0x23000a){_0x28ca2b=_0x28ca2b-0x0;var _0x4e2cca=_0xc313[_0x28ca2b];return _0x4e2cca;};'use strict';var _=require(_0x3c31('0x0'));var util=require(_0x3c31('0x1'));var logger=require(_0x3c31('0x2'))(_0x3c31('0x3'));var moment=require(_0x3c31('0x4'));var BPromise=require(_0x3c31('0x5'));var rp=require('request-promise');var attributes=require('./cdr.attributes');module['exports']=function(_0x218c2b,_0x2b33ec){return _0x218c2b[_0x3c31('0x6')](_0x3c31('0x7'),attributes,{'tableName':_0x3c31('0x8'),'paranoid':![],'indexes':[{'name':_0x3c31('0x9'),'fields':[_0x3c31('0x9')]},{'name':_0x3c31('0xa'),'fields':['calldate']},{'name':_0x3c31('0xb'),'fields':[_0x3c31('0xb')]},{'name':'dst','fields':[_0x3c31('0xc')]},{'name':_0x3c31('0xd'),'fields':['src']},{'name':_0x3c31('0xe'),'fields':['uniqueid']}],'timestamps':![]});};
\ No newline at end of file
index 4880e59..c511bcc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3302=['client','http','request','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x3302,0x96));var _0x2330=function(_0xddf202,_0x1890fa){_0xddf202=_0xddf202-0x0;var _0x1a95da=_0x3302[_0xddf202];return _0x1a95da;};'use strict';var _=require('lodash');var util=require(_0x2330('0x0'));var moment=require(_0x2330('0x1'));var BPromise=require(_0x2330('0x2'));var rs=require(_0x2330('0x3'));var fs=require('fs');var Redis=require(_0x2330('0x4'));var db=require(_0x2330('0x5'))['db'];var utils=require(_0x2330('0x6'));var logger=require(_0x2330('0x7'))(_0x2330('0x8'));var config=require(_0x2330('0x9'));var jayson=require(_0x2330('0xa'));var client=jayson[_0x2330('0xb')][_0x2330('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x266800,_0x2c67bd,_0x46aecb){return new BPromise(function(_0x18c148,_0x36c7e){return client[_0x2330('0xd')](_0x266800,_0x46aecb)['then'](function(_0x54812d){logger['info'](_0x2330('0xe'),_0x2c67bd,_0x2330('0xf'));logger['debug'](_0x2330('0x10'),_0x2c67bd,_0x2330('0xf'),JSON[_0x2330('0x11')](_0x54812d));if(_0x54812d['error']){if(_0x54812d[_0x2330('0x12')][_0x2330('0x13')]===0x1f4){logger[_0x2330('0x12')]('Cdr,\x20%s,\x20%s',_0x2c67bd,_0x54812d['error'][_0x2330('0x14')]);return _0x36c7e(_0x54812d[_0x2330('0x12')][_0x2330('0x14')]);}logger[_0x2330('0x12')](_0x2330('0xe'),_0x2c67bd,_0x54812d['error']['message']);return _0x18c148(_0x54812d['error'][_0x2330('0x14')]);}else{logger[_0x2330('0x15')]('Cdr,\x20%s,\x20%s',_0x2c67bd,_0x2330('0xf'));_0x18c148(_0x54812d['result']['message']);}})[_0x2330('0x16')](function(_0x5751ef){logger[_0x2330('0x12')](_0x2330('0xe'),_0x2c67bd,_0x5751ef);_0x36c7e(_0x5751ef);});});}
\ No newline at end of file
+var _0x6a59=['jayson/promise','client','http','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x57756f,_0x597934){var _0x494071=function(_0x4743f4){while(--_0x4743f4){_0x57756f['push'](_0x57756f['shift']());}};_0x494071(++_0x597934);}(_0x6a59,0x69));var _0x96a5=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x6a59[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x96a5('0x0'));var util=require(_0x96a5('0x1'));var moment=require(_0x96a5('0x2'));var BPromise=require(_0x96a5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96a5('0x4'));var db=require(_0x96a5('0x5'))['db'];var utils=require(_0x96a5('0x6'));var logger=require(_0x96a5('0x7'))(_0x96a5('0x8'));var config=require(_0x96a5('0x9'));var jayson=require(_0x96a5('0xa'));var client=jayson[_0x96a5('0xb')][_0x96a5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c3412,_0x238eee,_0x5b1d74){return new BPromise(function(_0x12b2ba,_0x31749f){return client['request'](_0x2c3412,_0x5b1d74)[_0x96a5('0xd')](function(_0x272b22){logger[_0x96a5('0xe')](_0x96a5('0xf'),_0x238eee,_0x96a5('0x10'));logger[_0x96a5('0x11')](_0x96a5('0x12'),_0x238eee,_0x96a5('0x10'),JSON[_0x96a5('0x13')](_0x272b22));if(_0x272b22[_0x96a5('0x14')]){if(_0x272b22[_0x96a5('0x14')]['code']===0x1f4){logger[_0x96a5('0x14')](_0x96a5('0xf'),_0x238eee,_0x272b22[_0x96a5('0x14')]['message']);return _0x31749f(_0x272b22['error'][_0x96a5('0x15')]);}logger[_0x96a5('0x14')](_0x96a5('0xf'),_0x238eee,_0x272b22[_0x96a5('0x14')][_0x96a5('0x15')]);return _0x12b2ba(_0x272b22[_0x96a5('0x14')][_0x96a5('0x15')]);}else{logger[_0x96a5('0xe')](_0x96a5('0xf'),_0x238eee,_0x96a5('0x10'));_0x12b2ba(_0x272b22[_0x96a5('0x16')]['message']);}})['catch'](function(_0xa22177){logger[_0x96a5('0x14')](_0x96a5('0xf'),_0x238eee,_0xa22177);_0x31749f(_0xa22177);});});}
\ No newline at end of file
index 84c82de..3ac9969 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa7f5=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cdr.controller','get','index','/describe','describe','post','isAuthenticated','put','/:id','update','delete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa7f5,0x12e));var _0x5a7f=function(_0x987238,_0x28b2c3){_0x987238=_0x987238-0x0;var _0x3b7ce3=_0xa7f5[_0x987238];return _0x3b7ce3;};'use strict';var multer=require(_0x5a7f('0x0'));var util=require('util');var path=require(_0x5a7f('0x1'));var timeout=require(_0x5a7f('0x2'));var express=require(_0x5a7f('0x3'));var router=express[_0x5a7f('0x4')]();var auth=require(_0x5a7f('0x5'));var interaction=require(_0x5a7f('0x6'));var config=require('../../config/environment');var controller=require(_0x5a7f('0x7'));router[_0x5a7f('0x8')]('/',auth['isAuthenticated'](),controller[_0x5a7f('0x9')]);router[_0x5a7f('0x8')](_0x5a7f('0xa'),auth['isAuthenticated'](),controller[_0x5a7f('0xb')]);router[_0x5a7f('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5a7f('0xc')]('/',auth[_0x5a7f('0xd')](),controller['create']);router[_0x5a7f('0xe')](_0x5a7f('0xf'),auth[_0x5a7f('0xd')](),controller[_0x5a7f('0x10')]);router[_0x5a7f('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x5a7f('0x12')]);module[_0x5a7f('0x13')]=router;
\ No newline at end of file
+var _0x76c1=['update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cdr.controller','get','isAuthenticated','index','/describe','post','create','put','/:id'];(function(_0x101d5b,_0x40cfd){var _0x382a50=function(_0x2fd131){while(--_0x2fd131){_0x101d5b['push'](_0x101d5b['shift']());}};_0x382a50(++_0x40cfd);}(_0x76c1,0x87));var _0x176c=function(_0x12ca5f,_0x223d98){_0x12ca5f=_0x12ca5f-0x0;var _0xfc3ae9=_0x76c1[_0x12ca5f];return _0xfc3ae9;};'use strict';var multer=require(_0x176c('0x0'));var util=require(_0x176c('0x1'));var path=require(_0x176c('0x2'));var timeout=require(_0x176c('0x3'));var express=require(_0x176c('0x4'));var router=express[_0x176c('0x5')]();var auth=require(_0x176c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x176c('0x7'));var controller=require(_0x176c('0x8'));router[_0x176c('0x9')]('/',auth[_0x176c('0xa')](),controller[_0x176c('0xb')]);router['get'](_0x176c('0xc'),auth[_0x176c('0xa')](),controller['describe']);router[_0x176c('0x9')]('/:id',auth[_0x176c('0xa')](),controller['show']);router[_0x176c('0xd')]('/',auth['isAuthenticated'](),controller[_0x176c('0xe')]);router[_0x176c('0xf')](_0x176c('0x10'),auth['isAuthenticated'](),controller[_0x176c('0x11')]);router['delete'](_0x176c('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x176c('0x12')]=router;
\ No newline at end of file
index 106fee8..7b1ed86 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x86ec=['*,*,*,*','sequelize','exports','STRING','noop'];(function(_0xe1269d,_0x57b7c3){var _0x261ca1=function(_0x13b234){while(--_0x13b234){_0xe1269d['push'](_0xe1269d['shift']());}};_0x261ca1(++_0x57b7c3);}(_0x86ec,0x11e));var _0xc86e=function(_0x3969a5,_0x2cef4a){_0x3969a5=_0x3969a5-0x0;var _0xed6209=_0x86ec[_0x3969a5];return _0xed6209;};'use strict';var Sequelize=require(_0xc86e('0x0'));module[_0xc86e('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xc86e('0x2')],'allowNull':![],'defaultValue':_0xc86e('0x3')},'appdata':{'type':Sequelize[_0xc86e('0x2')](0x1000),'defaultValue':''},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xc86e('0x2')],'defaultValue':_0xc86e('0x4')}};
\ No newline at end of file
+var _0xf00e=['*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x2867d8,_0xef3ee0){var _0x3b8176=function(_0x2b9eb8){while(--_0x2b9eb8){_0x2867d8['push'](_0x2867d8['shift']());}};_0x3b8176(++_0xef3ee0);}(_0xf00e,0x1af));var _0xef00=function(_0x4a29fc,_0x224157){_0x4a29fc=_0x4a29fc-0x0;var _0x5932b0=_0xf00e[_0x4a29fc];return _0x5932b0;};'use strict';var Sequelize=require(_0xef00('0x0'));module[_0xef00('0x1')]={'priority':{'type':Sequelize[_0xef00('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xef00('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xef00('0x3')](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0xef00('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xef00('0x4')}};
\ No newline at end of file
index 0d6d190..265c797 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3d7c=['../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','limit','json','apply','reject','update','destroy','then','end','sendStatus','error','stack','name','params','model','ChatApplication','query','keys','filters','attributes','intersection','fields','length','includeAll','include','options','body','catch','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','squel','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','ioredis'];(function(_0x316090,_0x273fca){var _0x3fd0b5=function(_0x4fdc8b){while(--_0x4fdc8b){_0x316090['push'](_0x316090['shift']());}};_0x3fd0b5(++_0x273fca);}(_0x3d7c,0x181));var _0xc3d7=function(_0x5243a6,_0x36aead){_0x5243a6=_0x5243a6-0x0;var _0x27ff9a=_0x3d7c[_0x5243a6];return _0x27ff9a;};'use strict';var pdf=require(_0xc3d7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc3d7('0x1'));var zipdir=require(_0xc3d7('0x2'));var jsonpatch=require(_0xc3d7('0x3'));var rp=require(_0xc3d7('0x4'));var moment=require(_0xc3d7('0x5'));var BPromise=require(_0xc3d7('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc3d7('0x7'));var csv=require(_0xc3d7('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc3d7('0x9'));var crypto=require('crypto');var jsforce=require(_0xc3d7('0xa'));var deskjs=require(_0xc3d7('0xb'));var toCsv=require(_0xc3d7('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0xc3d7('0xc'));var hardwareService=require(_0xc3d7('0xd'));var Redis=require(_0xc3d7('0xe'));var qs=require(_0xc3d7('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xc3d7('0x10'));var config=require(_0xc3d7('0x11'));var db=require(_0xc3d7('0x12'))['db'];function respondWithStatusCode(_0x1b9f63,_0x49fee9){_0x49fee9=_0x49fee9||0xcc;return function(_0x2c5543){if(_0x2c5543){return _0x1b9f63['sendStatus'](_0x49fee9);}return _0x1b9f63[_0xc3d7('0x13')](_0x49fee9)['end']();};}function respondWithResult(_0x2db2c4,_0x5ca684){_0x5ca684=_0x5ca684||0xc8;return function(_0x3a6521){if(_0x3a6521){return _0x2db2c4[_0xc3d7('0x13')](_0x5ca684)['json'](_0x3a6521);}};}function respondWithFilteredResult(_0x58f80c,_0x55c057){return function(_0x460e5c){if(_0x460e5c){var _0x349869=_0x460e5c[_0xc3d7('0x14')],_0x316e23=_0x55c057[_0xc3d7('0x15')],_0x106e3b=_0x55c057['offset']+_0x55c057[_0xc3d7('0x16')],_0x1b7996;if(_0x106e3b>=_0x349869){_0x106e3b=_0x349869;_0x1b7996=0xc8;}else{_0x1b7996=0xce;}_0x58f80c['status'](_0x1b7996);return _0x58f80c['set']('Content-Range',_0x316e23+'-'+_0x106e3b+'/'+_0x349869)[_0xc3d7('0x17')](_0x460e5c);}return null;};}function patchUpdates(_0x2b4d4d){return function(_0x2f1d37){try{jsonpatch[_0xc3d7('0x18')](_0x2f1d37,_0x2b4d4d,!![]);}catch(_0x8ee15){return BPromise[_0xc3d7('0x19')](_0x8ee15);}return _0x2f1d37['save']();};}function saveUpdates(_0xbe47a4,_0x956fec){return function(_0x385fc1){if(_0x385fc1){return _0x385fc1[_0xc3d7('0x1a')](_0xbe47a4)['then'](function(_0xaa6411){return _0xaa6411;});}return null;};}function removeEntity(_0x2114a8,_0x217870){return function(_0x267dea){if(_0x267dea){return _0x267dea[_0xc3d7('0x1b')]()[_0xc3d7('0x1c')](function(){_0x2114a8['status'](0xcc)[_0xc3d7('0x1d')]();});}};}function handleEntityNotFound(_0x20ea96,_0x4262d1){return function(_0x418f3b){if(!_0x418f3b){_0x20ea96[_0xc3d7('0x1e')](0x194);}return _0x418f3b;};}function handleError(_0x312370,_0x13d1c8){_0x13d1c8=_0x13d1c8||0x1f4;return function(_0x430516){logger[_0xc3d7('0x1f')](_0x430516[_0xc3d7('0x20')]);if(_0x430516[_0xc3d7('0x21')]){delete _0x430516[_0xc3d7('0x21')];}_0x312370[_0xc3d7('0x13')](_0x13d1c8)['send'](_0x430516);};}exports['show']=function(_0x51460b,_0x4a3343){var _0x2e8382={'raw':!![],'where':{'id':_0x51460b[_0xc3d7('0x22')]['id']}},_0x10e2fb={};_0x10e2fb[_0xc3d7('0x23')]=_['keys'](db[_0xc3d7('0x24')]['rawAttributes']);_0x10e2fb[_0xc3d7('0x25')]=_[_0xc3d7('0x26')](_0x51460b[_0xc3d7('0x25')]);_0x10e2fb[_0xc3d7('0x27')]=_['intersection'](_0x10e2fb[_0xc3d7('0x23')],_0x10e2fb['query']);_0x2e8382[_0xc3d7('0x28')]=_[_0xc3d7('0x29')](_0x10e2fb['model'],qs[_0xc3d7('0x2a')](_0x51460b[_0xc3d7('0x25')][_0xc3d7('0x2a')]));_0x2e8382[_0xc3d7('0x28')]=_0x2e8382['attributes'][_0xc3d7('0x2b')]?_0x2e8382[_0xc3d7('0x28')]:_0x10e2fb[_0xc3d7('0x23')];if(_0x51460b[_0xc3d7('0x25')][_0xc3d7('0x2c')]){_0x2e8382[_0xc3d7('0x2d')]=[{'all':!![]}];}_0x2e8382=_['merge']({},_0x2e8382,_0x51460b[_0xc3d7('0x2e')]);return db[_0xc3d7('0x24')]['find'](_0x2e8382)[_0xc3d7('0x1c')](handleEntityNotFound(_0x4a3343,null))[_0xc3d7('0x1c')](respondWithResult(_0x4a3343,null))['catch'](handleError(_0x4a3343,null));};exports[_0xc3d7('0x1a')]=function(_0x36422b,_0x2bd8ec){if(_0x36422b[_0xc3d7('0x2f')]['id']){delete _0x36422b[_0xc3d7('0x2f')]['id'];}return db[_0xc3d7('0x24')]['find']({'where':{'id':_0x36422b['params']['id']}})[_0xc3d7('0x1c')](handleEntityNotFound(_0x2bd8ec,null))['then'](saveUpdates(_0x36422b[_0xc3d7('0x2f')],null))['then'](respondWithResult(_0x2bd8ec,null))[_0xc3d7('0x30')](handleError(_0x2bd8ec,null));};exports[_0xc3d7('0x1b')]=function(_0x3ad971,_0x1ea5d3){return db[_0xc3d7('0x24')][_0xc3d7('0x31')]({'where':{'id':_0x3ad971[_0xc3d7('0x22')]['id']}})[_0xc3d7('0x1c')](handleEntityNotFound(_0x1ea5d3,null))['then'](removeEntity(_0x1ea5d3,null))[_0xc3d7('0x30')](handleError(_0x1ea5d3,null));};
\ No newline at end of file
+var _0xb917=['to-csv','ejs','lodash','crypto','jsforce','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','intersection','fields','attributes','length','merge','options','body','catch','destroy','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox'];(function(_0x302325,_0x51c70c){var _0x3d0e32=function(_0x5deadb){while(--_0x5deadb){_0x302325['push'](_0x302325['shift']());}};_0x3d0e32(++_0x51c70c);}(_0xb917,0x15c));var _0x7b91=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xb917[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require(_0x7b91('0x0'));var emlformat=require(_0x7b91('0x1'));var rimraf=require(_0x7b91('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b91('0x3'));var rp=require(_0x7b91('0x4'));var moment=require('moment');var BPromise=require(_0x7b91('0x5'));var Mustache=require(_0x7b91('0x6'));var util=require('util');var path=require(_0x7b91('0x7'));var sox=require(_0x7b91('0x8'));var csv=require(_0x7b91('0x9'));var ejs=require(_0x7b91('0xa'));var fs=require('fs');var _=require(_0x7b91('0xb'));var squel=require('squel');var crypto=require(_0x7b91('0xc'));var jsforce=require(_0x7b91('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7b91('0xe'));var authService=require('../../components/auth/service');var hardwareService=require(_0x7b91('0xf'));var Redis=require(_0x7b91('0x10'));var qs=require(_0x7b91('0x11'));var logger=require(_0x7b91('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x569f4f,_0x21a63){_0x21a63=_0x21a63||0xcc;return function(_0xeba8eb){if(_0xeba8eb){return _0x569f4f[_0x7b91('0x13')](_0x21a63);}return _0x569f4f[_0x7b91('0x14')](_0x21a63)[_0x7b91('0x15')]();};}function respondWithResult(_0x16b84b,_0x3cba6a){_0x3cba6a=_0x3cba6a||0xc8;return function(_0x34ad8d){if(_0x34ad8d){return _0x16b84b[_0x7b91('0x14')](_0x3cba6a)[_0x7b91('0x16')](_0x34ad8d);}};}function respondWithFilteredResult(_0x2189c2,_0x28afb1){return function(_0x47fb94){if(_0x47fb94){var _0x11a4a1=_0x47fb94[_0x7b91('0x17')],_0x43512a=_0x28afb1[_0x7b91('0x18')],_0x49ed67=_0x28afb1[_0x7b91('0x18')]+_0x28afb1[_0x7b91('0x19')],_0x37107b;if(_0x49ed67>=_0x11a4a1){_0x49ed67=_0x11a4a1;_0x37107b=0xc8;}else{_0x37107b=0xce;}_0x2189c2[_0x7b91('0x14')](_0x37107b);return _0x2189c2[_0x7b91('0x1a')](_0x7b91('0x1b'),_0x43512a+'-'+_0x49ed67+'/'+_0x11a4a1)[_0x7b91('0x16')](_0x47fb94);}return null;};}function patchUpdates(_0x402421){return function(_0x2d0a5e){try{jsonpatch['apply'](_0x2d0a5e,_0x402421,!![]);}catch(_0x2e43df){return BPromise['reject'](_0x2e43df);}return _0x2d0a5e[_0x7b91('0x1c')]();};}function saveUpdates(_0xfd858e,_0x147c29){return function(_0x51fd28){if(_0x51fd28){return _0x51fd28[_0x7b91('0x1d')](_0xfd858e)['then'](function(_0x5db616){return _0x5db616;});}return null;};}function removeEntity(_0x22c68a,_0x7bab5d){return function(_0x478b92){if(_0x478b92){return _0x478b92['destroy']()[_0x7b91('0x1e')](function(){_0x22c68a[_0x7b91('0x14')](0xcc)[_0x7b91('0x15')]();});}};}function handleEntityNotFound(_0xbb647b,_0x2ca9fc){return function(_0x1e9b0a){if(!_0x1e9b0a){_0xbb647b[_0x7b91('0x13')](0x194);}return _0x1e9b0a;};}function handleError(_0x4dceaa,_0x5bc87f){_0x5bc87f=_0x5bc87f||0x1f4;return function(_0x11d272){logger['error'](_0x11d272[_0x7b91('0x1f')]);if(_0x11d272['name']){delete _0x11d272[_0x7b91('0x20')];}_0x4dceaa[_0x7b91('0x14')](_0x5bc87f)[_0x7b91('0x21')](_0x11d272);};}exports[_0x7b91('0x22')]=function(_0x133593,_0x22fc00){var _0x57dd2d={'raw':!![],'where':{'id':_0x133593[_0x7b91('0x23')]['id']}},_0x338ea5={};_0x338ea5[_0x7b91('0x24')]=_[_0x7b91('0x25')](db[_0x7b91('0x26')][_0x7b91('0x27')]);_0x338ea5[_0x7b91('0x28')]=_[_0x7b91('0x25')](_0x133593['query']);_0x338ea5['filters']=_[_0x7b91('0x29')](_0x338ea5[_0x7b91('0x24')],_0x338ea5[_0x7b91('0x28')]);_0x57dd2d['attributes']=_['intersection'](_0x338ea5[_0x7b91('0x24')],qs[_0x7b91('0x2a')](_0x133593['query'][_0x7b91('0x2a')]));_0x57dd2d[_0x7b91('0x2b')]=_0x57dd2d[_0x7b91('0x2b')][_0x7b91('0x2c')]?_0x57dd2d['attributes']:_0x338ea5['model'];if(_0x133593[_0x7b91('0x28')]['includeAll']){_0x57dd2d['include']=[{'all':!![]}];}_0x57dd2d=_[_0x7b91('0x2d')]({},_0x57dd2d,_0x133593[_0x7b91('0x2e')]);return db[_0x7b91('0x26')]['find'](_0x57dd2d)[_0x7b91('0x1e')](handleEntityNotFound(_0x22fc00,null))['then'](respondWithResult(_0x22fc00,null))['catch'](handleError(_0x22fc00,null));};exports[_0x7b91('0x1d')]=function(_0xbb055b,_0x2327b1){if(_0xbb055b['body']['id']){delete _0xbb055b[_0x7b91('0x2f')]['id'];}return db[_0x7b91('0x26')]['find']({'where':{'id':_0xbb055b['params']['id']}})[_0x7b91('0x1e')](handleEntityNotFound(_0x2327b1,null))['then'](saveUpdates(_0xbb055b['body'],null))[_0x7b91('0x1e')](respondWithResult(_0x2327b1,null))[_0x7b91('0x30')](handleError(_0x2327b1,null));};exports[_0x7b91('0x31')]=function(_0x55aaf5,_0x1a775a){return db[_0x7b91('0x26')][_0x7b91('0x32')]({'where':{'id':_0x55aaf5[_0x7b91('0x23')]['id']}})[_0x7b91('0x1e')](handleEntityNotFound(_0x1a775a,null))[_0x7b91('0x1e')](removeEntity(_0x1a775a,null))['catch'](handleError(_0x1a775a,null));};
\ No newline at end of file
index 28c0059..6c18552 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2843=['define','ChatApplication','chat_applications','lodash','util','moment','bluebird','request-promise','./chatApplication.attributes','exports'];(function(_0x583d05,_0x5036cb){var _0x5acd89=function(_0x263604){while(--_0x263604){_0x583d05['push'](_0x583d05['shift']());}};_0x5acd89(++_0x5036cb);}(_0x2843,0x1b1));var _0x3284=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0x2843[_0x2d61b2];return _0x12df89;};'use strict';var _=require(_0x3284('0x0'));var util=require(_0x3284('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3284('0x2'));var BPromise=require(_0x3284('0x3'));var rp=require(_0x3284('0x4'));var attributes=require(_0x3284('0x5'));module[_0x3284('0x6')]=function(_0x10aa5a,_0x1dfd9f){return _0x10aa5a[_0x3284('0x7')](_0x3284('0x8'),attributes,{'tableName':_0x3284('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xe38e=['moment','request-promise','define','ChatApplication','chat_applications','lodash','../../config/logger'];(function(_0x1aabba,_0x2f5134){var _0x59723b=function(_0x1893f9){while(--_0x1893f9){_0x1aabba['push'](_0x1aabba['shift']());}};_0x59723b(++_0x2f5134);}(_0xe38e,0x147));var _0xee38=function(_0x4f698a,_0x323655){_0x4f698a=_0x4f698a-0x0;var _0xf49bc5=_0xe38e[_0x4f698a];return _0xf49bc5;};'use strict';var _=require(_0xee38('0x0'));var util=require('util');var logger=require(_0xee38('0x1'))('api');var moment=require(_0xee38('0x2'));var BPromise=require('bluebird');var rp=require(_0xee38('0x3'));var attributes=require('./chatApplication.attributes');module['exports']=function(_0x4b631f,_0x25e7a1){return _0x4b631f[_0xee38('0x4')](_0xee38('0x5'),attributes,{'tableName':_0xee38('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 6613dff..92323a5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x90dc=['ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\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','info'];(function(_0x5f1696,_0x1fa572){var _0x5630ad=function(_0x56cc90){while(--_0x56cc90){_0x5f1696['push'](_0x5f1696['shift']());}};_0x5630ad(++_0x1fa572);}(_0x90dc,0x69));var _0xc90d=function(_0x174215,_0x13732c){_0x174215=_0x174215-0x0;var _0x254298=_0x90dc[_0x174215];return _0x254298;};'use strict';var _=require(_0xc90d('0x0'));var util=require(_0xc90d('0x1'));var moment=require(_0xc90d('0x2'));var BPromise=require(_0xc90d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc90d('0x4'));var db=require(_0xc90d('0x5'))['db'];var utils=require(_0xc90d('0x6'));var logger=require(_0xc90d('0x7'))(_0xc90d('0x8'));var config=require(_0xc90d('0x9'));var jayson=require(_0xc90d('0xa'));var client=jayson[_0xc90d('0xb')][_0xc90d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa9b290,_0x75411a,_0x279f60){return new BPromise(function(_0x225483,_0x419fae){return client[_0xc90d('0xd')](_0xa9b290,_0x279f60)['then'](function(_0x4a3299){logger[_0xc90d('0xe')](_0xc90d('0xf'),_0x75411a,_0xc90d('0x10'));logger['debug'](_0xc90d('0x11'),_0x75411a,'request\x20sent',JSON[_0xc90d('0x12')](_0x4a3299));if(_0x4a3299[_0xc90d('0x13')]){if(_0x4a3299[_0xc90d('0x13')][_0xc90d('0x14')]===0x1f4){logger[_0xc90d('0x13')](_0xc90d('0xf'),_0x75411a,_0x4a3299[_0xc90d('0x13')][_0xc90d('0x15')]);return _0x419fae(_0x4a3299[_0xc90d('0x13')][_0xc90d('0x15')]);}logger[_0xc90d('0x13')](_0xc90d('0xf'),_0x75411a,_0x4a3299[_0xc90d('0x13')][_0xc90d('0x15')]);return _0x225483(_0x4a3299[_0xc90d('0x13')][_0xc90d('0x15')]);}else{logger[_0xc90d('0xe')](_0xc90d('0xf'),_0x75411a,_0xc90d('0x10'));_0x225483(_0x4a3299[_0xc90d('0x16')][_0xc90d('0x15')]);}})[_0xc90d('0x17')](function(_0x4cecb7){logger[_0xc90d('0x13')](_0xc90d('0xf'),_0x75411a,_0x4cecb7);_0x419fae(_0x4cecb7);});});}
\ No newline at end of file
+var _0xbcd7=['info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','request','then'];(function(_0x44745f,_0x432d7e){var _0xac7f24=function(_0x53038f){while(--_0x53038f){_0x44745f['push'](_0x44745f['shift']());}};_0xac7f24(++_0x432d7e);}(_0xbcd7,0xd1));var _0x7bcd=function(_0x224ad6,_0x3b3a15){_0x224ad6=_0x224ad6-0x0;var _0x5b4133=_0xbcd7[_0x224ad6];return _0x5b4133;};'use strict';var _=require('lodash');var util=require(_0x7bcd('0x0'));var moment=require(_0x7bcd('0x1'));var BPromise=require(_0x7bcd('0x2'));var rs=require(_0x7bcd('0x3'));var fs=require('fs');var Redis=require(_0x7bcd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7bcd('0x5'));var logger=require('../../config/logger')(_0x7bcd('0x6'));var config=require(_0x7bcd('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bcd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1025ba,_0xd46570,_0x3270b1){return new BPromise(function(_0x8b9cc2,_0x3e286d){return client[_0x7bcd('0x9')](_0x1025ba,_0x3270b1)[_0x7bcd('0xa')](function(_0x52d7ce){logger[_0x7bcd('0xb')](_0x7bcd('0xc'),_0xd46570,_0x7bcd('0xd'));logger[_0x7bcd('0xe')](_0x7bcd('0xf'),_0xd46570,_0x7bcd('0xd'),JSON['stringify'](_0x52d7ce));if(_0x52d7ce['error']){if(_0x52d7ce[_0x7bcd('0x10')][_0x7bcd('0x11')]===0x1f4){logger['error'](_0x7bcd('0xc'),_0xd46570,_0x52d7ce['error'][_0x7bcd('0x12')]);return _0x3e286d(_0x52d7ce[_0x7bcd('0x10')][_0x7bcd('0x12')]);}logger[_0x7bcd('0x10')](_0x7bcd('0xc'),_0xd46570,_0x52d7ce['error'][_0x7bcd('0x12')]);return _0x8b9cc2(_0x52d7ce[_0x7bcd('0x10')][_0x7bcd('0x12')]);}else{logger[_0x7bcd('0xb')](_0x7bcd('0xc'),_0xd46570,_0x7bcd('0xd'));_0x8b9cc2(_0x52d7ce['result'][_0x7bcd('0x12')]);}})[_0x7bcd('0x13')](function(_0x32bd28){logger[_0x7bcd('0x10')](_0x7bcd('0xc'),_0xd46570,_0x32bd28);_0x3e286d(_0x32bd28);});});}
\ No newline at end of file
index 225b524..4641ee3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb469=['../../config/environment','./chatApplication.controller','get','/:id','show','put','isAuthenticated','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0xc6794b,_0x1f03b7){var _0x3111b6=function(_0x3d3f9a){while(--_0x3d3f9a){_0xc6794b['push'](_0xc6794b['shift']());}};_0x3111b6(++_0x1f03b7);}(_0xb469,0x11a));var _0x9b46=function(_0x3fe537,_0x27f880){_0x3fe537=_0x3fe537-0x0;var _0x4d88e9=_0xb469[_0x3fe537];return _0x4d88e9;};'use strict';var multer=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var path=require('path');var timeout=require(_0x9b46('0x2'));var express=require(_0x9b46('0x3'));var router=express[_0x9b46('0x4')]();var auth=require(_0x9b46('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9b46('0x6'));var controller=require(_0x9b46('0x7'));router[_0x9b46('0x8')](_0x9b46('0x9'),auth['isAuthenticated'](),controller[_0x9b46('0xa')]);router[_0x9b46('0xb')](_0x9b46('0x9'),auth[_0x9b46('0xc')](),controller[_0x9b46('0xd')]);router['delete']('/:id',auth[_0x9b46('0xc')](),controller[_0x9b46('0xe')]);module[_0x9b46('0xf')]=router;
\ No newline at end of file
+var _0x1b5e=['put','isAuthenticated','delete','exports','multer','util','path','express','./chatApplication.controller','/:id','show'];(function(_0x411112,_0x5a0d96){var _0x320ead=function(_0x29f5bc){while(--_0x29f5bc){_0x411112['push'](_0x411112['shift']());}};_0x320ead(++_0x5a0d96);}(_0x1b5e,0xe0));var _0xe1b5=function(_0x297ec2,_0x448c72){_0x297ec2=_0x297ec2-0x0;var _0x15b859=_0x1b5e[_0x297ec2];return _0x15b859;};'use strict';var multer=require(_0xe1b5('0x0'));var util=require(_0xe1b5('0x1'));var path=require(_0xe1b5('0x2'));var timeout=require('connect-timeout');var express=require(_0xe1b5('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe1b5('0x4'));router['get'](_0xe1b5('0x5'),auth['isAuthenticated'](),controller[_0xe1b5('0x6')]);router[_0xe1b5('0x7')](_0xe1b5('0x5'),auth[_0xe1b5('0x8')](),controller['update']);router[_0xe1b5('0x9')](_0xe1b5('0x5'),auth[_0xe1b5('0x8')](),controller['destroy']);module[_0xe1b5('0xa')]=router;
\ No newline at end of file
index 9821132..e4c972c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x462c=['BOOLEAN','sequelize','exports'];(function(_0x3213b9,_0x41359c){var _0x5a4cfc=function(_0x489d0b){while(--_0x489d0b){_0x3213b9['push'](_0x3213b9['shift']());}};_0x5a4cfc(++_0x41359c);}(_0x462c,0x175));var _0xc462=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x462c[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xc462('0x0'));module[_0xc462('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xc462('0x2')],'defaultValue':!![]}};
\ No newline at end of file
+var _0x6391=['sequelize','exports','STRING','BOOLEAN'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x6391,0x1e8));var _0x1639=function(_0x43776a,_0x4eb74c){_0x43776a=_0x43776a-0x0;var _0x18eb8f=_0x6391[_0x43776a];return _0x18eb8f;};'use strict';var Sequelize=require(_0x1639('0x0'));module[_0x1639('0x1')]={'name':{'type':Sequelize[_0x1639('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x1639('0x2')]},'write':{'type':Sequelize[_0x1639('0x3')],'defaultValue':!![]}};
\ No newline at end of file
index 84ce020..f28e390 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x17ee=['split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','crypto','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','./chatGroup.socket','register','jayson/promise','client','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','update','then','destroy','stack','name','send','index','ChatGroup','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','key','VIRTUAL','field','options','includeAll','include','findAll','rows','show','find','create','body','params','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers','removeMembers','ChatGroupId','getMessages','findOne','$gte'];(function(_0x161483,_0xc096cd){var _0x2f5235=function(_0x1a50a6){while(--_0x1a50a6){_0x161483['push'](_0x161483['shift']());}};_0x2f5235(++_0xc096cd);}(_0x17ee,0x197));var _0xe17e=function(_0x588186,_0x4de763){_0x588186=_0x588186-0x0;var _0xa0adff=_0x17ee[_0x588186];return _0xa0adff;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe17e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe17e('0x1'));var rp=require(_0xe17e('0x2'));var moment=require(_0xe17e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe17e('0x4'));var util=require(_0xe17e('0x5'));var path=require(_0xe17e('0x6'));var sox=require('sox');var csv=require(_0xe17e('0x7'));var ejs=require(_0xe17e('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe17e('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe17e('0xa'));var toCsv=require(_0xe17e('0x7'));var querystring=require(_0xe17e('0xb'));var Papa=require('papaparse');var authService=require(_0xe17e('0xc'));var hardwareService=require(_0xe17e('0xd'));var Redis=require(_0xe17e('0xe'));var qs=require(_0xe17e('0xf'));var logger=require('../../config/logger')(_0xe17e('0x10'));var utils=require('../../config/utils');var config=require(_0xe17e('0x11'));var db=require(_0xe17e('0x12'))['db'];config['redis']=_[_0xe17e('0x13')](config[_0xe17e('0x14')],{'host':_0xe17e('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe17e('0x14')]));require(_0xe17e('0x16'))[_0xe17e('0x17')](socket);var jayson=require(_0xe17e('0x18'));var client=jayson[_0xe17e('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ee7ea,_0x27d4f7,_0x43d55f,_0x42cd99){return new BPromise(function(_0x17a0f8,_0x32a19d){var _0x1ad127=_0x42cd99||client;return _0x1ad127[_0xe17e('0x1a')](_0x4ee7ea,_0x43d55f)['then'](function(_0x198511){logger[_0xe17e('0x1b')](_0xe17e('0x1c'),_0x27d4f7,'request\x20sent');logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x27d4f7,_0xe17e('0x1d'),JSON[_0xe17e('0x1e')](_0x198511));if(_0x198511['error']){if(_0x198511[_0xe17e('0x1f')][_0xe17e('0x20')]===0x1f4){logger[_0xe17e('0x1f')](_0xe17e('0x1c'),_0x27d4f7,_0x198511[_0xe17e('0x1f')][_0xe17e('0x21')]);return _0x32a19d(_0x198511[_0xe17e('0x1f')][_0xe17e('0x21')]);}logger[_0xe17e('0x1f')](_0xe17e('0x1c'),_0x27d4f7,_0x198511[_0xe17e('0x1f')]['message']);return _0x17a0f8(_0x198511[_0xe17e('0x1f')][_0xe17e('0x21')]);}else{logger[_0xe17e('0x1b')](_0xe17e('0x1c'),_0x27d4f7,_0xe17e('0x1d'));_0x17a0f8(_0x198511[_0xe17e('0x22')][_0xe17e('0x21')]);}})[_0xe17e('0x23')](function(_0x4228cd){logger['error'](_0xe17e('0x1c'),_0x27d4f7,_0x4228cd);_0x32a19d(_0x4228cd);});});}function respondWithStatusCode(_0x3b5209,_0x4455b8){_0x4455b8=_0x4455b8||0xcc;return function(_0xe33e20){if(_0xe33e20){return _0x3b5209[_0xe17e('0x24')](_0x4455b8);}return _0x3b5209[_0xe17e('0x25')](_0x4455b8)[_0xe17e('0x26')]();};}function respondWithResult(_0x4e0e30,_0xa45ae4){_0xa45ae4=_0xa45ae4||0xc8;return function(_0x1235bf){if(_0x1235bf){return _0x4e0e30[_0xe17e('0x25')](_0xa45ae4)[_0xe17e('0x27')](_0x1235bf);}};}function respondWithFilteredResult(_0xc0edf1,_0xdf508d){return function(_0x349e1f){if(_0x349e1f){var _0x2b37fb=_0x349e1f[_0xe17e('0x28')],_0x5de745=_0xdf508d[_0xe17e('0x29')],_0x42cd55=_0xdf508d[_0xe17e('0x29')]+_0xdf508d['limit'],_0x10ccdb;if(_0x42cd55>=_0x2b37fb){_0x42cd55=_0x2b37fb;_0x10ccdb=0xc8;}else{_0x10ccdb=0xce;}_0xc0edf1[_0xe17e('0x25')](_0x10ccdb);return _0xc0edf1[_0xe17e('0x2a')](_0xe17e('0x2b'),_0x5de745+'-'+_0x42cd55+'/'+_0x2b37fb)['json'](_0x349e1f);}return null;};}function patchUpdates(_0x33d843){return function(_0x54a3bf){try{jsonpatch[_0xe17e('0x2c')](_0x54a3bf,_0x33d843,!![]);}catch(_0x3ea5a6){return BPromise['reject'](_0x3ea5a6);}return _0x54a3bf['save']();};}function saveUpdates(_0x32fb51,_0x3fddf9){return function(_0x4701b8){if(_0x4701b8){return _0x4701b8[_0xe17e('0x2d')](_0x32fb51)[_0xe17e('0x2e')](function(_0x494652){return _0x494652;});}return null;};}function removeEntity(_0x37bb52,_0x595841){return function(_0x5ae3fc){if(_0x5ae3fc){return _0x5ae3fc[_0xe17e('0x2f')]()[_0xe17e('0x2e')](function(){_0x37bb52[_0xe17e('0x25')](0xcc)[_0xe17e('0x26')]();});}};}function handleEntityNotFound(_0x3ab8a9,_0x55f452){return function(_0x52862a){if(!_0x52862a){_0x3ab8a9['sendStatus'](0x194);}return _0x52862a;};}function handleError(_0x4ca118,_0x2c6dc8){_0x2c6dc8=_0x2c6dc8||0x1f4;return function(_0x5028e0){logger['error'](_0x5028e0[_0xe17e('0x30')]);if(_0x5028e0[_0xe17e('0x31')]){delete _0x5028e0[_0xe17e('0x31')];}_0x4ca118[_0xe17e('0x25')](_0x2c6dc8)[_0xe17e('0x32')](_0x5028e0);};}exports[_0xe17e('0x33')]=function(_0x5cfb2c,_0x2d1632){var _0x1dd341={},_0x5c2338={},_0x47c362={'count':0x0,'rows':[]};var _0x1f075c=db[_0xe17e('0x34')][_0xe17e('0x35')];_0x5c2338['model']=_['keys'](_0x1f075c);_0x5c2338[_0xe17e('0x36')]=_[_0xe17e('0x37')](_0x5cfb2c[_0xe17e('0x36')]);_0x5c2338[_0xe17e('0x38')]=_[_0xe17e('0x39')](_0x5c2338[_0xe17e('0x3a')],_0x5c2338[_0xe17e('0x36')]);_0x1dd341['attributes']=_[_0xe17e('0x39')](_0x5c2338[_0xe17e('0x3a')],qs[_0xe17e('0x3b')](_0x5cfb2c[_0xe17e('0x36')]['fields']));_0x1dd341[_0xe17e('0x3c')]=_0x1dd341['attributes'][_0xe17e('0x3d')]?_0x1dd341[_0xe17e('0x3c')]:_0x5c2338[_0xe17e('0x3a')];if(!_0x5cfb2c['query'][_0xe17e('0x3e')](_0xe17e('0x3f'))){_0x1dd341[_0xe17e('0x40')]=qs[_0xe17e('0x40')](_0x5cfb2c['query'][_0xe17e('0x40')]);_0x1dd341[_0xe17e('0x29')]=qs[_0xe17e('0x29')](_0x5cfb2c['query'][_0xe17e('0x29')]);}_0x1dd341[_0xe17e('0x41')]=qs[_0xe17e('0x42')](_0x5cfb2c[_0xe17e('0x36')][_0xe17e('0x42')]);_0x1dd341[_0xe17e('0x43')]=qs[_0xe17e('0x38')](_[_0xe17e('0x44')](_0x5cfb2c[_0xe17e('0x36')],_0x5c2338[_0xe17e('0x38')]));if(_0x5cfb2c[_0xe17e('0x36')][_0xe17e('0x45')]){_0x1dd341['where']=_[_0xe17e('0x46')](_0x1dd341[_0xe17e('0x43')],{'$or':_[_0xe17e('0x47')](_0x1f075c,function(_0x11bcd5){if(_0x11bcd5['type'][_0xe17e('0x48')]!==_0xe17e('0x49')){var _0x1bdbd2={};_0x1bdbd2[_0x11bcd5[_0xe17e('0x4a')]]={'$like':'%'+_0x5cfb2c[_0xe17e('0x36')][_0xe17e('0x45')]+'%'};return _0x1bdbd2;}})});}_0x1dd341=_[_0xe17e('0x46')]({},_0x1dd341,_0x5cfb2c[_0xe17e('0x4b')]);var _0x1f1767={'where':_0x1dd341[_0xe17e('0x43')]};return db[_0xe17e('0x34')][_0xe17e('0x28')](_0x1f1767)[_0xe17e('0x2e')](function(_0x37f218){_0x47c362[_0xe17e('0x28')]=_0x37f218;if(_0x5cfb2c[_0xe17e('0x36')][_0xe17e('0x4c')]){_0x1dd341[_0xe17e('0x4d')]=[{'all':!![]}];}return db[_0xe17e('0x34')][_0xe17e('0x4e')](_0x1dd341);})[_0xe17e('0x2e')](function(_0x5565b6){_0x47c362[_0xe17e('0x4f')]=_0x5565b6;return _0x47c362;})[_0xe17e('0x2e')](respondWithFilteredResult(_0x2d1632,_0x1dd341))[_0xe17e('0x23')](handleError(_0x2d1632,null));};exports[_0xe17e('0x50')]=function(_0x386cc5,_0x6edb43){var _0xec45b5={'raw':!![],'where':{'id':_0x386cc5['params']['id']}},_0x11dc7f={};_0x11dc7f[_0xe17e('0x3a')]=_[_0xe17e('0x37')](db[_0xe17e('0x34')]['rawAttributes']);_0x11dc7f['query']=_[_0xe17e('0x37')](_0x386cc5[_0xe17e('0x36')]);_0x11dc7f[_0xe17e('0x38')]=_[_0xe17e('0x39')](_0x11dc7f[_0xe17e('0x3a')],_0x11dc7f[_0xe17e('0x36')]);_0xec45b5[_0xe17e('0x3c')]=_[_0xe17e('0x39')](_0x11dc7f[_0xe17e('0x3a')],qs[_0xe17e('0x3b')](_0x386cc5[_0xe17e('0x36')]['fields']));_0xec45b5[_0xe17e('0x3c')]=_0xec45b5[_0xe17e('0x3c')][_0xe17e('0x3d')]?_0xec45b5['attributes']:_0x11dc7f[_0xe17e('0x3a')];if(_0x386cc5[_0xe17e('0x36')][_0xe17e('0x4c')]){_0xec45b5[_0xe17e('0x4d')]=[{'all':!![]}];}_0xec45b5=_[_0xe17e('0x46')]({},_0xec45b5,_0x386cc5[_0xe17e('0x4b')]);return db[_0xe17e('0x34')][_0xe17e('0x51')](_0xec45b5)[_0xe17e('0x2e')](handleEntityNotFound(_0x6edb43,null))[_0xe17e('0x2e')](respondWithResult(_0x6edb43,null))[_0xe17e('0x23')](handleError(_0x6edb43,null));};exports['create']=function(_0x36fee1,_0x21b9b3){return db[_0xe17e('0x34')][_0xe17e('0x52')](_0x36fee1[_0xe17e('0x53')],{})[_0xe17e('0x2e')](respondWithResult(_0x21b9b3,0xc9))[_0xe17e('0x23')](handleError(_0x21b9b3,null));};exports[_0xe17e('0x2d')]=function(_0x414a59,_0xe0f296){if(_0x414a59[_0xe17e('0x53')]['id']){delete _0x414a59['body']['id'];}return db[_0xe17e('0x34')][_0xe17e('0x51')]({'where':{'id':_0x414a59['params']['id']}})['then'](handleEntityNotFound(_0xe0f296,null))['then'](saveUpdates(_0x414a59[_0xe17e('0x53')],null))[_0xe17e('0x2e')](respondWithResult(_0xe0f296,null))['catch'](handleError(_0xe0f296,null));};exports['destroy']=function(_0x13bcb5,_0x2d5f1a){return db[_0xe17e('0x34')][_0xe17e('0x51')]({'where':{'id':_0x13bcb5[_0xe17e('0x54')]['id']}})[_0xe17e('0x2e')](handleEntityNotFound(_0x2d5f1a,null))[_0xe17e('0x2e')](removeEntity(_0x2d5f1a,null))[_0xe17e('0x23')](handleError(_0x2d5f1a,null));};exports[_0xe17e('0x55')]=function(_0x16c0e3,_0xc9ed4a){return db['ChatGroup'][_0xe17e('0x55')]()[_0xe17e('0x2e')](respondWithResult(_0xc9ed4a,null))['catch'](handleError(_0xc9ed4a,null));};exports[_0xe17e('0x56')]=function(_0x4dba24,_0x2dbf76,_0x296f4c){return db[_0xe17e('0x57')][_0xe17e('0x28')]({'where':{'ChatGroupId':_0x4dba24[_0xe17e('0x54')]['id'],'ToId':_0x4dba24['user']['id'],'read':![]}})['then'](function(_0x11faf5){return{'id':_[_0xe17e('0x58')](_0x4dba24[_0xe17e('0x54')]['id']),'count':_0x11faf5};})[_0xe17e('0x2e')](respondWithResult(_0x2dbf76,null))['catch'](handleError(_0x2dbf76,null));};exports[_0xe17e('0x59')]=function(_0x23de82,_0x3d8375,_0x924321){return db[_0xe17e('0x34')]['find']({'where':{'id':_0x23de82[_0xe17e('0x54')]['id']}})[_0xe17e('0x2e')](handleEntityNotFound(_0x3d8375,null))['then'](function(_0x3de09d){if(_0x3de09d){return _0x3de09d['addMembers'](_0x23de82[_0xe17e('0x53')][_0xe17e('0x5a')],_[_0xe17e('0x5b')](_0x23de82['body'],[_0xe17e('0x5a'),'id'])||{});}})[_0xe17e('0x2e')](respondWithResult(_0x3d8375,null))['catch'](handleError(_0x3d8375,null));};exports[_0xe17e('0x5c')]=function(_0x26e406,_0xde3131,_0xf000d2){var _0x5da749={};var _0xfd1109={};var _0x1fef1d;var _0x1d314e;return db['ChatGroup']['findOne']({'where':{'id':_0x26e406[_0xe17e('0x54')]['id']}})[_0xe17e('0x2e')](handleEntityNotFound(_0xde3131,null))[_0xe17e('0x2e')](function(_0x4a0672){if(_0x4a0672){_0x1fef1d=_0x4a0672;_0xfd1109[_0xe17e('0x3a')]=_[_0xe17e('0x37')](db['User'][_0xe17e('0x35')]);_0xfd1109[_0xe17e('0x36')]=_['keys'](_0x26e406['query']);_0xfd1109[_0xe17e('0x38')]=_[_0xe17e('0x39')](_0xfd1109[_0xe17e('0x3a')],_0xfd1109[_0xe17e('0x36')]);_0x5da749['attributes']=_[_0xe17e('0x39')](_0xfd1109[_0xe17e('0x3a')],qs[_0xe17e('0x3b')](_0x26e406[_0xe17e('0x36')][_0xe17e('0x3b')]));_0x5da749[_0xe17e('0x3c')]=_0x5da749[_0xe17e('0x3c')][_0xe17e('0x3d')]?_0x5da749[_0xe17e('0x3c')]:_0xfd1109['model'];_0x5da749[_0xe17e('0x41')]=qs[_0xe17e('0x42')](_0x26e406[_0xe17e('0x36')][_0xe17e('0x42')]);_0x5da749[_0xe17e('0x43')]=qs['filters'](_[_0xe17e('0x44')](_0x26e406[_0xe17e('0x36')],_0xfd1109[_0xe17e('0x38')]));if(_0x26e406['query'][_0xe17e('0x45')]){_0x5da749['where']=_['merge'](_0x5da749[_0xe17e('0x43')],{'$or':_['map'](_0x5da749[_0xe17e('0x3c')],function(_0x4f18e5){var _0x5a212f={};_0x5a212f[_0x4f18e5]={'$like':'%'+_0x26e406['query'][_0xe17e('0x45')]+'%'};return _0x5a212f;})});}_0x5da749=_[_0xe17e('0x46')]({},_0x5da749,_0x26e406[_0xe17e('0x4b')]);return _0x1fef1d['getMembers'](_0x5da749);}})['then'](function(_0x556866){if(_0x556866){_0x1d314e=_0x556866['length'];if(!_0x26e406[_0xe17e('0x36')]['hasOwnProperty'](_0xe17e('0x3f'))){_0x5da749[_0xe17e('0x40')]=qs[_0xe17e('0x40')](_0x26e406[_0xe17e('0x36')][_0xe17e('0x40')]);_0x5da749[_0xe17e('0x29')]=qs['offset'](_0x26e406['query'][_0xe17e('0x29')]);}return _0x1fef1d[_0xe17e('0x5c')](_0x5da749);}})[_0xe17e('0x2e')](function(_0x8bf83){if(_0x8bf83){return _0x8bf83?{'count':_0x1d314e,'rows':_0x8bf83}:null;}})['then'](respondWithResult(_0xde3131,null))[_0xe17e('0x23')](handleError(_0xde3131,null));};exports[_0xe17e('0x5d')]=function(_0x309133,_0x547d4b,_0x593a96){var _0x3fc55b;return db[_0xe17e('0x34')]['find']({'where':{'id':_0x309133[_0xe17e('0x54')]['id']}})[_0xe17e('0x2e')](handleEntityNotFound(_0x547d4b,null))[_0xe17e('0x2e')](function(_0x28feb9){if(_0x28feb9){return _0x28feb9[_0xe17e('0x5d')](_0x309133['query'][_0xe17e('0x5a')]);}})[_0xe17e('0x2e')](respondWithStatusCode(_0x547d4b,null))[_0xe17e('0x23')](handleError(_0x547d4b,null));};exports['addMessage']=function(_0xe786db,_0x499339,_0x193b12){if(_0xe786db[_0xe17e('0x53')]['id']){delete _0xe786db[_0xe17e('0x53')]['id'];}return db[_0xe17e('0x34')]['find']({'where':{'id':_0xe786db['params']['id']}})[_0xe17e('0x2e')](handleEntityNotFound(_0x499339,null))['then'](function(_0x1827ad){if(_0x1827ad){_0xe786db['body'][_0xe17e('0x5e')]=_0x1827ad['id'];return db[_0xe17e('0x57')][_0xe17e('0x52')](_0xe786db[_0xe17e('0x53')]);}})[_0xe17e('0x2e')](respondWithResult(_0x499339,null))['catch'](handleError(_0x499339,null));};exports[_0xe17e('0x5f')]=function(_0x771d9e,_0x3a8a1f,_0x52aa0b){var _0x5b14f9={};var _0x4d597e={};var _0x3bda51;var _0x3100bf;return db['ChatGroup'][_0xe17e('0x60')]({'where':{'id':_0x771d9e[_0xe17e('0x54')]['id']}})[_0xe17e('0x2e')](handleEntityNotFound(_0x3a8a1f,null))[_0xe17e('0x2e')](function(_0x39bd36){if(_0x39bd36){_0x3bda51=_0x39bd36;_0x4d597e['model']=_[_0xe17e('0x37')](db[_0xe17e('0x57')][_0xe17e('0x35')]);_0x4d597e[_0xe17e('0x36')]=_[_0xe17e('0x37')](_0x771d9e[_0xe17e('0x36')]);_0x4d597e[_0xe17e('0x38')]=_[_0xe17e('0x39')](_0x4d597e[_0xe17e('0x3a')],_0x4d597e['query']);_0x5b14f9[_0xe17e('0x3c')]=_[_0xe17e('0x39')](_0x4d597e[_0xe17e('0x3a')],qs['fields'](_0x771d9e['query'][_0xe17e('0x3b')]));_0x5b14f9[_0xe17e('0x3c')]=_0x5b14f9[_0xe17e('0x3c')]['length']?_0x5b14f9['attributes']:_0x4d597e['model'];_0x5b14f9[_0xe17e('0x41')]=qs[_0xe17e('0x42')](_0x771d9e[_0xe17e('0x36')][_0xe17e('0x42')]);_0x5b14f9['where']=qs['filters'](_[_0xe17e('0x44')](_0x771d9e['query'],_0x4d597e['filters']));if(_0x771d9e[_0xe17e('0x36')][_0xe17e('0x45')]){_0x5b14f9[_0xe17e('0x43')]=_[_0xe17e('0x46')](_0x5b14f9['where'],{'$or':_[_0xe17e('0x47')](_0x5b14f9['attributes'],function(_0x2acd12){var _0xe36108={};_0xe36108[_0x2acd12]={'$like':'%'+_0x771d9e['query'][_0xe17e('0x45')]+'%'};return _0xe36108;})});}if(_0x771d9e[_0xe17e('0x36')][_0xe17e('0x61')]){var _0x366957=_0x771d9e[_0xe17e('0x36')][_0xe17e('0x61')][_0xe17e('0x62')](',');var _0x507c8a={};_0x507c8a[_0x366957[0x0]]={'$gte':moment(_0x366957[0x1])[_0xe17e('0x63')](_0xe17e('0x64'))};_0x5b14f9[_0xe17e('0x43')]=_[_0xe17e('0x46')](_0x5b14f9[_0xe17e('0x43')],_0x507c8a);}_0x5b14f9=_[_0xe17e('0x46')]({},_0x5b14f9,_0x771d9e[_0xe17e('0x4b')]);return _0x3bda51[_0xe17e('0x5f')](_0x5b14f9);}})[_0xe17e('0x2e')](function(_0x9f1995){if(_0x9f1995){_0x3100bf=_0x9f1995['length'];if(!_0x771d9e['query'][_0xe17e('0x3e')](_0xe17e('0x3f'))){_0x5b14f9[_0xe17e('0x40')]=qs[_0xe17e('0x40')](_0x771d9e[_0xe17e('0x36')][_0xe17e('0x40')]);_0x5b14f9[_0xe17e('0x29')]=qs[_0xe17e('0x29')](_0x771d9e[_0xe17e('0x36')]['offset']);}return _0x3bda51['getMessages'](_0x5b14f9);}})['then'](function(_0x52ded1){if(_0x52ded1){return _0x52ded1?{'count':_0x3100bf,'rows':_0x52ded1}:null;}})[_0xe17e('0x2e')](respondWithResult(_0x3a8a1f,null))['catch'](handleError(_0x3a8a1f,null));};
\ No newline at end of file
+var _0x7039=['field','options','includeAll','include','show','params','rawAttributes','find','create','body','describe','getUnread','ChatInternalMessage','toInteger','addMembers','omit','ids','findOne','User','order','filter','map','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','api','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatGroup.socket','register','client','http','request','info','debug','request\x20sent','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','end','name','send','index','ChatGroup','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','merge','type','key'];(function(_0x444958,_0x2fc23c){var _0x36403e=function(_0x46935d){while(--_0x46935d){_0x444958['push'](_0x444958['shift']());}};_0x36403e(++_0x2fc23c);}(_0x7039,0x1ae));var _0x9703=function(_0x35f2d6,_0x1eacc1){_0x35f2d6=_0x35f2d6-0x0;var _0x33a492=_0x7039[_0x35f2d6];return _0x33a492;};'use strict';var pdf=require(_0x9703('0x0'));var emlformat=require(_0x9703('0x1'));var rimraf=require(_0x9703('0x2'));var zipdir=require(_0x9703('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9703('0x4'));var moment=require('moment');var BPromise=require(_0x9703('0x5'));var Mustache=require(_0x9703('0x6'));var util=require('util');var path=require('path');var sox=require(_0x9703('0x7'));var csv=require(_0x9703('0x8'));var ejs=require(_0x9703('0x9'));var fs=require('fs');var _=require(_0x9703('0xa'));var squel=require(_0x9703('0xb'));var crypto=require(_0x9703('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9703('0xd'));var toCsv=require(_0x9703('0x8'));var querystring=require(_0x9703('0xe'));var Papa=require(_0x9703('0xf'));var authService=require(_0x9703('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x9703('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x9703('0x12'))['db'];config['redis']=_[_0x9703('0x13')](config['redis'],{'host':_0x9703('0x14'),'port':0x18eb});var socket=require(_0x9703('0x15'))(new Redis(config[_0x9703('0x16')]));require(_0x9703('0x17'))[_0x9703('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9703('0x19')][_0x9703('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x369e3d,_0x166086,_0x240887,_0x5d1a1e){return new BPromise(function(_0x76a6e,_0x32ae5e){var _0x4b5503=_0x5d1a1e||client;return _0x4b5503[_0x9703('0x1b')](_0x369e3d,_0x240887)['then'](function(_0x2b876c){logger[_0x9703('0x1c')]('ChatGroup,\x20%s,\x20%s',_0x166086,'request\x20sent');logger[_0x9703('0x1d')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x166086,_0x9703('0x1e'),JSON['stringify'](_0x2b876c));if(_0x2b876c[_0x9703('0x1f')]){if(_0x2b876c['error'][_0x9703('0x20')]===0x1f4){logger[_0x9703('0x1f')](_0x9703('0x21'),_0x166086,_0x2b876c['error']['message']);return _0x32ae5e(_0x2b876c[_0x9703('0x1f')]['message']);}logger['error'](_0x9703('0x21'),_0x166086,_0x2b876c[_0x9703('0x1f')][_0x9703('0x22')]);return _0x76a6e(_0x2b876c[_0x9703('0x1f')][_0x9703('0x22')]);}else{logger[_0x9703('0x1c')]('ChatGroup,\x20%s,\x20%s',_0x166086,_0x9703('0x1e'));_0x76a6e(_0x2b876c[_0x9703('0x23')][_0x9703('0x22')]);}})[_0x9703('0x24')](function(_0x598ccb){logger[_0x9703('0x1f')](_0x9703('0x21'),_0x166086,_0x598ccb);_0x32ae5e(_0x598ccb);});});}function respondWithStatusCode(_0x14216b,_0x40b422){_0x40b422=_0x40b422||0xcc;return function(_0x9f6c64){if(_0x9f6c64){return _0x14216b[_0x9703('0x25')](_0x40b422);}return _0x14216b[_0x9703('0x26')](_0x40b422)['end']();};}function respondWithResult(_0x2e8cf7,_0x2643cb){_0x2643cb=_0x2643cb||0xc8;return function(_0x3e3f2f){if(_0x3e3f2f){return _0x2e8cf7[_0x9703('0x26')](_0x2643cb)[_0x9703('0x27')](_0x3e3f2f);}};}function respondWithFilteredResult(_0x4b3f56,_0x29fe94){return function(_0x432dea){if(_0x432dea){var _0x3ab123=_0x432dea[_0x9703('0x28')],_0x14d3f8=_0x29fe94[_0x9703('0x29')],_0x1dae03=_0x29fe94[_0x9703('0x29')]+_0x29fe94[_0x9703('0x2a')],_0x4c221d;if(_0x1dae03>=_0x3ab123){_0x1dae03=_0x3ab123;_0x4c221d=0xc8;}else{_0x4c221d=0xce;}_0x4b3f56[_0x9703('0x26')](_0x4c221d);return _0x4b3f56[_0x9703('0x2b')](_0x9703('0x2c'),_0x14d3f8+'-'+_0x1dae03+'/'+_0x3ab123)['json'](_0x432dea);}return null;};}function patchUpdates(_0x11f085){return function(_0x3b5eb5){try{jsonpatch[_0x9703('0x2d')](_0x3b5eb5,_0x11f085,!![]);}catch(_0x5b2547){return BPromise[_0x9703('0x2e')](_0x5b2547);}return _0x3b5eb5['save']();};}function saveUpdates(_0x3c1983,_0xdf2606){return function(_0x38acef){if(_0x38acef){return _0x38acef['update'](_0x3c1983)[_0x9703('0x2f')](function(_0x5311f7){return _0x5311f7;});}return null;};}function removeEntity(_0x4f00e2,_0x453bb9){return function(_0x1bd871){if(_0x1bd871){return _0x1bd871[_0x9703('0x30')]()['then'](function(){_0x4f00e2[_0x9703('0x26')](0xcc)[_0x9703('0x31')]();});}};}function handleEntityNotFound(_0x46644d,_0x436d33){return function(_0x40f625){if(!_0x40f625){_0x46644d[_0x9703('0x25')](0x194);}return _0x40f625;};}function handleError(_0x45b24c,_0x483c2b){_0x483c2b=_0x483c2b||0x1f4;return function(_0x483fb1){logger[_0x9703('0x1f')](_0x483fb1['stack']);if(_0x483fb1['name']){delete _0x483fb1[_0x9703('0x32')];}_0x45b24c['status'](_0x483c2b)[_0x9703('0x33')](_0x483fb1);};}exports[_0x9703('0x34')]=function(_0xcae7aa,_0x313cec){var _0x1aa3b5={},_0x3041ee={},_0x258f75={'count':0x0,'rows':[]};var _0x3f3d85=db[_0x9703('0x35')]['rawAttributes'];_0x3041ee[_0x9703('0x36')]=_[_0x9703('0x37')](_0x3f3d85);_0x3041ee[_0x9703('0x38')]=_[_0x9703('0x37')](_0xcae7aa['query']);_0x3041ee['filters']=_[_0x9703('0x39')](_0x3041ee['model'],_0x3041ee[_0x9703('0x38')]);_0x1aa3b5[_0x9703('0x3a')]=_['intersection'](_0x3041ee[_0x9703('0x36')],qs['fields'](_0xcae7aa[_0x9703('0x38')][_0x9703('0x3b')]));_0x1aa3b5[_0x9703('0x3a')]=_0x1aa3b5[_0x9703('0x3a')][_0x9703('0x3c')]?_0x1aa3b5['attributes']:_0x3041ee[_0x9703('0x36')];if(!_0xcae7aa[_0x9703('0x38')][_0x9703('0x3d')](_0x9703('0x3e'))){_0x1aa3b5[_0x9703('0x2a')]=qs['limit'](_0xcae7aa[_0x9703('0x38')]['limit']);_0x1aa3b5['offset']=qs[_0x9703('0x29')](_0xcae7aa[_0x9703('0x38')][_0x9703('0x29')]);}_0x1aa3b5['order']=qs[_0x9703('0x3f')](_0xcae7aa[_0x9703('0x38')][_0x9703('0x3f')]);_0x1aa3b5[_0x9703('0x40')]=qs['filters'](_[_0x9703('0x41')](_0xcae7aa['query'],_0x3041ee[_0x9703('0x42')]));if(_0xcae7aa[_0x9703('0x38')]['filter']){_0x1aa3b5[_0x9703('0x40')]=_[_0x9703('0x43')](_0x1aa3b5[_0x9703('0x40')],{'$or':_['map'](_0x3f3d85,function(_0x5d84a9){if(_0x5d84a9[_0x9703('0x44')][_0x9703('0x45')]!=='VIRTUAL'){var _0x2d86e9={};_0x2d86e9[_0x5d84a9[_0x9703('0x46')]]={'$like':'%'+_0xcae7aa[_0x9703('0x38')]['filter']+'%'};return _0x2d86e9;}})});}_0x1aa3b5=_[_0x9703('0x43')]({},_0x1aa3b5,_0xcae7aa[_0x9703('0x47')]);var _0x42cc27={'where':_0x1aa3b5[_0x9703('0x40')]};return db[_0x9703('0x35')][_0x9703('0x28')](_0x42cc27)['then'](function(_0x2127c3){_0x258f75[_0x9703('0x28')]=_0x2127c3;if(_0xcae7aa['query'][_0x9703('0x48')]){_0x1aa3b5[_0x9703('0x49')]=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x1aa3b5);})[_0x9703('0x2f')](function(_0x2663be){_0x258f75['rows']=_0x2663be;return _0x258f75;})[_0x9703('0x2f')](respondWithFilteredResult(_0x313cec,_0x1aa3b5))[_0x9703('0x24')](handleError(_0x313cec,null));};exports[_0x9703('0x4a')]=function(_0x318df5,_0x55cb65){var _0x366b03={'raw':!![],'where':{'id':_0x318df5[_0x9703('0x4b')]['id']}},_0x33469f={};_0x33469f[_0x9703('0x36')]=_['keys'](db[_0x9703('0x35')][_0x9703('0x4c')]);_0x33469f[_0x9703('0x38')]=_[_0x9703('0x37')](_0x318df5[_0x9703('0x38')]);_0x33469f[_0x9703('0x42')]=_[_0x9703('0x39')](_0x33469f['model'],_0x33469f[_0x9703('0x38')]);_0x366b03['attributes']=_[_0x9703('0x39')](_0x33469f['model'],qs['fields'](_0x318df5[_0x9703('0x38')][_0x9703('0x3b')]));_0x366b03[_0x9703('0x3a')]=_0x366b03['attributes']['length']?_0x366b03['attributes']:_0x33469f[_0x9703('0x36')];if(_0x318df5[_0x9703('0x38')][_0x9703('0x48')]){_0x366b03[_0x9703('0x49')]=[{'all':!![]}];}_0x366b03=_[_0x9703('0x43')]({},_0x366b03,_0x318df5[_0x9703('0x47')]);return db[_0x9703('0x35')][_0x9703('0x4d')](_0x366b03)['then'](handleEntityNotFound(_0x55cb65,null))[_0x9703('0x2f')](respondWithResult(_0x55cb65,null))[_0x9703('0x24')](handleError(_0x55cb65,null));};exports['create']=function(_0x1c073d,_0x2d7da1){return db['ChatGroup'][_0x9703('0x4e')](_0x1c073d[_0x9703('0x4f')],{})[_0x9703('0x2f')](respondWithResult(_0x2d7da1,0xc9))[_0x9703('0x24')](handleError(_0x2d7da1,null));};exports['update']=function(_0x53abcc,_0x13fc0f){if(_0x53abcc[_0x9703('0x4f')]['id']){delete _0x53abcc[_0x9703('0x4f')]['id'];}return db[_0x9703('0x35')]['find']({'where':{'id':_0x53abcc[_0x9703('0x4b')]['id']}})[_0x9703('0x2f')](handleEntityNotFound(_0x13fc0f,null))[_0x9703('0x2f')](saveUpdates(_0x53abcc['body'],null))[_0x9703('0x2f')](respondWithResult(_0x13fc0f,null))[_0x9703('0x24')](handleError(_0x13fc0f,null));};exports[_0x9703('0x30')]=function(_0x43046,_0x160831){return db[_0x9703('0x35')][_0x9703('0x4d')]({'where':{'id':_0x43046['params']['id']}})[_0x9703('0x2f')](handleEntityNotFound(_0x160831,null))[_0x9703('0x2f')](removeEntity(_0x160831,null))[_0x9703('0x24')](handleError(_0x160831,null));};exports[_0x9703('0x50')]=function(_0x32ca35,_0x360055){return db[_0x9703('0x35')][_0x9703('0x50')]()[_0x9703('0x2f')](respondWithResult(_0x360055,null))[_0x9703('0x24')](handleError(_0x360055,null));};exports[_0x9703('0x51')]=function(_0x35b6da,_0x5a4e5f,_0x273898){return db[_0x9703('0x52')][_0x9703('0x28')]({'where':{'ChatGroupId':_0x35b6da[_0x9703('0x4b')]['id'],'ToId':_0x35b6da['user']['id'],'read':![]}})['then'](function(_0x44ff82){return{'id':_[_0x9703('0x53')](_0x35b6da[_0x9703('0x4b')]['id']),'count':_0x44ff82};})[_0x9703('0x2f')](respondWithResult(_0x5a4e5f,null))[_0x9703('0x24')](handleError(_0x5a4e5f,null));};exports[_0x9703('0x54')]=function(_0x5a7f17,_0x2d30ab,_0x47dfe3){return db[_0x9703('0x35')][_0x9703('0x4d')]({'where':{'id':_0x5a7f17[_0x9703('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2d30ab,null))[_0x9703('0x2f')](function(_0x3dc6f5){if(_0x3dc6f5){return _0x3dc6f5[_0x9703('0x54')](_0x5a7f17['body']['ids'],_[_0x9703('0x55')](_0x5a7f17['body'],[_0x9703('0x56'),'id'])||{});}})[_0x9703('0x2f')](respondWithResult(_0x2d30ab,null))[_0x9703('0x24')](handleError(_0x2d30ab,null));};exports['getMembers']=function(_0xda6221,_0x5dfe7f,_0x1d0f90){var _0x3e2527={};var _0x47bc43={};var _0x710e0;var _0x182cb0;return db[_0x9703('0x35')][_0x9703('0x57')]({'where':{'id':_0xda6221[_0x9703('0x4b')]['id']}})[_0x9703('0x2f')](handleEntityNotFound(_0x5dfe7f,null))[_0x9703('0x2f')](function(_0xf381af){if(_0xf381af){_0x710e0=_0xf381af;_0x47bc43[_0x9703('0x36')]=_[_0x9703('0x37')](db[_0x9703('0x58')][_0x9703('0x4c')]);_0x47bc43[_0x9703('0x38')]=_[_0x9703('0x37')](_0xda6221['query']);_0x47bc43[_0x9703('0x42')]=_[_0x9703('0x39')](_0x47bc43['model'],_0x47bc43[_0x9703('0x38')]);_0x3e2527[_0x9703('0x3a')]=_[_0x9703('0x39')](_0x47bc43['model'],qs[_0x9703('0x3b')](_0xda6221['query']['fields']));_0x3e2527[_0x9703('0x3a')]=_0x3e2527[_0x9703('0x3a')][_0x9703('0x3c')]?_0x3e2527[_0x9703('0x3a')]:_0x47bc43['model'];_0x3e2527[_0x9703('0x59')]=qs[_0x9703('0x3f')](_0xda6221['query']['sort']);_0x3e2527['where']=qs['filters'](_[_0x9703('0x41')](_0xda6221[_0x9703('0x38')],_0x47bc43[_0x9703('0x42')]));if(_0xda6221[_0x9703('0x38')][_0x9703('0x5a')]){_0x3e2527['where']=_[_0x9703('0x43')](_0x3e2527['where'],{'$or':_[_0x9703('0x5b')](_0x3e2527[_0x9703('0x3a')],function(_0x44ea8f){var _0x30c0b5={};_0x30c0b5[_0x44ea8f]={'$like':'%'+_0xda6221['query'][_0x9703('0x5a')]+'%'};return _0x30c0b5;})});}_0x3e2527=_[_0x9703('0x43')]({},_0x3e2527,_0xda6221[_0x9703('0x47')]);return _0x710e0[_0x9703('0x5c')](_0x3e2527);}})[_0x9703('0x2f')](function(_0x3d441a){if(_0x3d441a){_0x182cb0=_0x3d441a['length'];if(!_0xda6221[_0x9703('0x38')][_0x9703('0x3d')]('nolimit')){_0x3e2527['limit']=qs[_0x9703('0x2a')](_0xda6221['query'][_0x9703('0x2a')]);_0x3e2527['offset']=qs[_0x9703('0x29')](_0xda6221['query'][_0x9703('0x29')]);}return _0x710e0[_0x9703('0x5c')](_0x3e2527);}})[_0x9703('0x2f')](function(_0x24d8c6){if(_0x24d8c6){return _0x24d8c6?{'count':_0x182cb0,'rows':_0x24d8c6}:null;}})[_0x9703('0x2f')](respondWithResult(_0x5dfe7f,null))[_0x9703('0x24')](handleError(_0x5dfe7f,null));};exports[_0x9703('0x5d')]=function(_0x7f1305,_0x395eb6,_0xa55b79){var _0x34a13d;return db[_0x9703('0x35')][_0x9703('0x4d')]({'where':{'id':_0x7f1305['params']['id']}})[_0x9703('0x2f')](handleEntityNotFound(_0x395eb6,null))[_0x9703('0x2f')](function(_0x30bf1a){if(_0x30bf1a){return _0x30bf1a[_0x9703('0x5d')](_0x7f1305[_0x9703('0x38')]['ids']);}})[_0x9703('0x2f')](respondWithStatusCode(_0x395eb6,null))[_0x9703('0x24')](handleError(_0x395eb6,null));};exports[_0x9703('0x5e')]=function(_0x336017,_0x434bb2,_0x412ee0){if(_0x336017[_0x9703('0x4f')]['id']){delete _0x336017[_0x9703('0x4f')]['id'];}return db[_0x9703('0x35')]['find']({'where':{'id':_0x336017['params']['id']}})[_0x9703('0x2f')](handleEntityNotFound(_0x434bb2,null))[_0x9703('0x2f')](function(_0x53208f){if(_0x53208f){_0x336017[_0x9703('0x4f')][_0x9703('0x5f')]=_0x53208f['id'];return db['ChatInternalMessage'][_0x9703('0x4e')](_0x336017['body']);}})[_0x9703('0x2f')](respondWithResult(_0x434bb2,null))[_0x9703('0x24')](handleError(_0x434bb2,null));};exports[_0x9703('0x60')]=function(_0x522826,_0x1ef4b8,_0x3fb06f){var _0x340e00={};var _0x1aa518={};var _0x373183;var _0x2fa77e;return db[_0x9703('0x35')][_0x9703('0x57')]({'where':{'id':_0x522826['params']['id']}})[_0x9703('0x2f')](handleEntityNotFound(_0x1ef4b8,null))[_0x9703('0x2f')](function(_0x15c4d4){if(_0x15c4d4){_0x373183=_0x15c4d4;_0x1aa518[_0x9703('0x36')]=_[_0x9703('0x37')](db[_0x9703('0x52')]['rawAttributes']);_0x1aa518[_0x9703('0x38')]=_['keys'](_0x522826[_0x9703('0x38')]);_0x1aa518[_0x9703('0x42')]=_[_0x9703('0x39')](_0x1aa518[_0x9703('0x36')],_0x1aa518[_0x9703('0x38')]);_0x340e00[_0x9703('0x3a')]=_['intersection'](_0x1aa518[_0x9703('0x36')],qs[_0x9703('0x3b')](_0x522826[_0x9703('0x38')][_0x9703('0x3b')]));_0x340e00['attributes']=_0x340e00[_0x9703('0x3a')]['length']?_0x340e00[_0x9703('0x3a')]:_0x1aa518[_0x9703('0x36')];_0x340e00[_0x9703('0x59')]=qs[_0x9703('0x3f')](_0x522826[_0x9703('0x38')][_0x9703('0x3f')]);_0x340e00[_0x9703('0x40')]=qs[_0x9703('0x42')](_[_0x9703('0x41')](_0x522826[_0x9703('0x38')],_0x1aa518['filters']));if(_0x522826[_0x9703('0x38')][_0x9703('0x5a')]){_0x340e00[_0x9703('0x40')]=_['merge'](_0x340e00[_0x9703('0x40')],{'$or':_[_0x9703('0x5b')](_0x340e00[_0x9703('0x3a')],function(_0x18eee6){var _0x5901a6={};_0x5901a6[_0x18eee6]={'$like':'%'+_0x522826[_0x9703('0x38')]['filter']+'%'};return _0x5901a6;})});}if(_0x522826[_0x9703('0x38')]['$gte']){var _0x1836cf=_0x522826[_0x9703('0x38')][_0x9703('0x61')][_0x9703('0x62')](',');var _0x1afd60={};_0x1afd60[_0x1836cf[0x0]]={'$gte':moment(_0x1836cf[0x1])[_0x9703('0x63')]('YYYY-MM-DD\x20HH:mm:ss')};_0x340e00[_0x9703('0x40')]=_['merge'](_0x340e00[_0x9703('0x40')],_0x1afd60);}_0x340e00=_[_0x9703('0x43')]({},_0x340e00,_0x522826[_0x9703('0x47')]);return _0x373183['getMessages'](_0x340e00);}})[_0x9703('0x2f')](function(_0x344d93){if(_0x344d93){_0x2fa77e=_0x344d93[_0x9703('0x3c')];if(!_0x522826[_0x9703('0x38')][_0x9703('0x3d')](_0x9703('0x3e'))){_0x340e00['limit']=qs[_0x9703('0x2a')](_0x522826['query'][_0x9703('0x2a')]);_0x340e00[_0x9703('0x29')]=qs['offset'](_0x522826[_0x9703('0x38')][_0x9703('0x29')]);}return _0x373183[_0x9703('0x60')](_0x340e00);}})[_0x9703('0x2f')](function(_0x5c7439){if(_0x5c7439){return _0x5c7439?{'count':_0x2fa77e,'rows':_0x5c7439}:null;}})[_0x9703('0x2f')](respondWithResult(_0x1ef4b8,null))[_0x9703('0x24')](handleError(_0x1ef4b8,null));};
\ No newline at end of file
index 5584c7b..fe5e106 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcfe2=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','ChatGroup'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xcfe2,0x1de));var _0x2cfe=function(_0x13bbb7,_0x59da94){_0x13bbb7=_0x13bbb7-0x0;var _0x5875e1=_0xcfe2[_0x13bbb7];return _0x5875e1;};'use strict';var EventEmitter=require(_0x2cfe('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0x2cfe('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2cfe('0x2')](0x0);var events={'afterCreate':_0x2cfe('0x3'),'afterUpdate':_0x2cfe('0x4'),'afterDestroy':_0x2cfe('0x5')};function emitEvent(_0x3c0cd2){return function(_0xc86320,_0x31889d,_0x190edb){ChatGroupEvents[_0x2cfe('0x6')](_0x3c0cd2+':'+_0xc86320['id'],_0xc86320);ChatGroupEvents['emit'](_0x3c0cd2,_0xc86320);_0x190edb(null);};}for(var e in events){if(events[_0x2cfe('0x7')](e)){var event=events[e];ChatGroup[_0x2cfe('0x8')](e,emitEvent(event));}}module[_0x2cfe('0x9')]=ChatGroupEvents;
\ No newline at end of file
+var _0x482f=['hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x482f,0xf3));var _0xf482=function(_0x4c0061,_0x29d2c7){_0x4c0061=_0x4c0061-0x0;var _0x3353f5=_0x482f[_0x4c0061];return _0x3353f5;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0xf482('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xf482('0x1')](0x0);var events={'afterCreate':_0xf482('0x2'),'afterUpdate':_0xf482('0x3'),'afterDestroy':'remove'};function emitEvent(_0x40dd5d){return function(_0x366a2a,_0x25bac9,_0x5dc1df){ChatGroupEvents[_0xf482('0x4')](_0x40dd5d+':'+_0x366a2a['id'],_0x366a2a);ChatGroupEvents[_0xf482('0x4')](_0x40dd5d,_0x366a2a);_0x5dc1df(null);};}for(var e in events){if(events[_0xf482('0x5')](e)){var event=events[e];ChatGroup[_0xf482('0x6')](e,emitEvent(event));}}module[_0xf482('0x7')]=ChatGroupEvents;
\ No newline at end of file
index daa3a81..88de8a4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0d63=['chat_groups','lodash','util','../../config/logger','api','bluebird','./chatGroup.attributes','exports','ChatGroup'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x0d63,0x1de));var _0x30d6=function(_0x53276c,_0x6a1efe){_0x53276c=_0x53276c-0x0;var _0x4b2bcb=_0x0d63[_0x53276c];return _0x4b2bcb;};'use strict';var _=require(_0x30d6('0x0'));var util=require(_0x30d6('0x1'));var logger=require(_0x30d6('0x2'))(_0x30d6('0x3'));var moment=require('moment');var BPromise=require(_0x30d6('0x4'));var rp=require('request-promise');var attributes=require(_0x30d6('0x5'));module[_0x30d6('0x6')]=function(_0x1a41ab,_0x5757a1){return _0x1a41ab['define'](_0x30d6('0x7'),attributes,{'tableName':_0x30d6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xa386=['moment','request-promise','./chatGroup.attributes','exports','define','ChatGroup','lodash','util','../../config/logger','api'];(function(_0x5f301f,_0x54ed3a){var _0xbfb617=function(_0xa1a2f4){while(--_0xa1a2f4){_0x5f301f['push'](_0x5f301f['shift']());}};_0xbfb617(++_0x54ed3a);}(_0xa386,0x1a0));var _0x6a38=function(_0x5d7583,_0x48a446){_0x5d7583=_0x5d7583-0x0;var _0x1e615c=_0xa386[_0x5d7583];return _0x1e615c;};'use strict';var _=require(_0x6a38('0x0'));var util=require(_0x6a38('0x1'));var logger=require(_0x6a38('0x2'))(_0x6a38('0x3'));var moment=require(_0x6a38('0x4'));var BPromise=require('bluebird');var rp=require(_0x6a38('0x5'));var attributes=require(_0x6a38('0x6'));module[_0x6a38('0x7')]=function(_0x42d62c,_0x2a7952){return _0x42d62c[_0x6a38('0x8')](_0x6a38('0x9'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index d9adc75..c071400 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc874=['defaults','localhost','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis'];(function(_0x5040b0,_0x53c900){var _0x32d66e=function(_0x10451b){while(--_0x10451b){_0x5040b0['push'](_0x5040b0['shift']());}};_0x32d66e(++_0x53c900);}(_0xc874,0x154));var _0x4c87=function(_0x3cb3ca,_0x44d697){_0x3cb3ca=_0x3cb3ca-0x0;var _0x214366=_0xc874[_0x3cb3ca];return _0x214366;};'use strict';var _=require(_0x4c87('0x0'));var util=require('util');var moment=require(_0x4c87('0x1'));var BPromise=require(_0x4c87('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c87('0x3'))['db'];var utils=require(_0x4c87('0x4'));var logger=require(_0x4c87('0x5'))('rpc');var config=require(_0x4c87('0x6'));var jayson=require(_0x4c87('0x7'));var client=jayson['client'][_0x4c87('0x8')]({'port':0x232a});config[_0x4c87('0x9')]=_[_0x4c87('0xa')](config[_0x4c87('0x9')],{'host':_0x4c87('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4c87('0x9')]));require('./chatGroup.socket')[_0x4c87('0xc')](socket);function respondWithRpcPromise(_0x42f471,_0x30e64f,_0x1a15a2){return new BPromise(function(_0x46c0bc,_0x548e1a){return client[_0x4c87('0xd')](_0x42f471,_0x1a15a2)[_0x4c87('0xe')](function(_0x527917){logger[_0x4c87('0xf')](_0x4c87('0x10'),_0x30e64f,_0x4c87('0x11'));logger[_0x4c87('0x12')](_0x4c87('0x13'),_0x30e64f,'request\x20sent',JSON['stringify'](_0x527917));if(_0x527917['error']){if(_0x527917[_0x4c87('0x14')][_0x4c87('0x15')]===0x1f4){logger[_0x4c87('0x14')](_0x4c87('0x10'),_0x30e64f,_0x527917[_0x4c87('0x14')][_0x4c87('0x16')]);return _0x548e1a(_0x527917[_0x4c87('0x14')][_0x4c87('0x16')]);}logger['error'](_0x4c87('0x10'),_0x30e64f,_0x527917[_0x4c87('0x14')]['message']);return _0x46c0bc(_0x527917['error'][_0x4c87('0x16')]);}else{logger[_0x4c87('0xf')](_0x4c87('0x10'),_0x30e64f,'request\x20sent');_0x46c0bc(_0x527917[_0x4c87('0x17')]['message']);}})[_0x4c87('0x18')](function(_0x2a6891){logger[_0x4c87('0x14')](_0x4c87('0x10'),_0x30e64f,_0x2a6891);_0x548e1a(_0x2a6891);});});}
\ No newline at end of file
+var _0xf006=['./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter'];(function(_0x2fcf18,_0x10009a){var _0x4c68cc=function(_0x444002){while(--_0x444002){_0x2fcf18['push'](_0x2fcf18['shift']());}};_0x4c68cc(++_0x10009a);}(_0xf006,0x146));var _0x6f00=function(_0x1de2eb,_0x193508){_0x1de2eb=_0x1de2eb-0x0;var _0x56e768=_0xf006[_0x1de2eb];return _0x56e768;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6f00('0x0'));var BPromise=require(_0x6f00('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f00('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f00('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x6f00('0x4'));var jayson=require(_0x6f00('0x5'));var client=jayson[_0x6f00('0x6')]['http']({'port':0x232a});config[_0x6f00('0x7')]=_['defaults'](config[_0x6f00('0x7')],{'host':_0x6f00('0x8'),'port':0x18eb});var socket=require(_0x6f00('0x9'))(new Redis(config[_0x6f00('0x7')]));require(_0x6f00('0xa'))[_0x6f00('0xb')](socket);function respondWithRpcPromise(_0x44b63c,_0x1e0720,_0x2aa181){return new BPromise(function(_0x3e6a41,_0x3a0ef4){return client[_0x6f00('0xc')](_0x44b63c,_0x2aa181)[_0x6f00('0xd')](function(_0x4ff833){logger[_0x6f00('0xe')](_0x6f00('0xf'),_0x1e0720,_0x6f00('0x10'));logger[_0x6f00('0x11')](_0x6f00('0x12'),_0x1e0720,'request\x20sent',JSON[_0x6f00('0x13')](_0x4ff833));if(_0x4ff833['error']){if(_0x4ff833[_0x6f00('0x14')]['code']===0x1f4){logger[_0x6f00('0x14')](_0x6f00('0xf'),_0x1e0720,_0x4ff833[_0x6f00('0x14')][_0x6f00('0x15')]);return _0x3a0ef4(_0x4ff833[_0x6f00('0x14')][_0x6f00('0x15')]);}logger[_0x6f00('0x14')](_0x6f00('0xf'),_0x1e0720,_0x4ff833[_0x6f00('0x14')]['message']);return _0x3e6a41(_0x4ff833[_0x6f00('0x14')]['message']);}else{logger['info'](_0x6f00('0xf'),_0x1e0720,_0x6f00('0x10'));_0x3e6a41(_0x4ff833[_0x6f00('0x16')][_0x6f00('0x15')]);}})[_0x6f00('0x17')](function(_0x27e466){logger[_0x6f00('0x14')](_0x6f00('0xf'),_0x1e0720,_0x27e466);_0x3a0ef4(_0x27e466);});});}
\ No newline at end of file
index 465c945..2f139f5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0851=['register','length','./chatGroup.events','save','remove','update','emit','removeListener'];(function(_0x12a62c,_0xc9c41a){var _0x268a58=function(_0x100ca9){while(--_0x100ca9){_0x12a62c['push'](_0x12a62c['shift']());}};_0x268a58(++_0xc9c41a);}(_0x0851,0x8a));var _0x1085=function(_0x5139bb,_0x3fb5f4){_0x5139bb=_0x5139bb-0x0;var _0x306e2a=_0x0851[_0x5139bb];return _0x306e2a;};'use strict';var ChatGroupEvents=require(_0x1085('0x0'));var events=[_0x1085('0x1'),_0x1085('0x2'),_0x1085('0x3')];function createListener(_0x56ce65,_0x2a93c7){return function(_0x28b07e){_0x2a93c7[_0x1085('0x4')](_0x56ce65,_0x28b07e);};}function removeListener(_0x3cbd88,_0x3b40fb){return function(){ChatGroupEvents[_0x1085('0x5')](_0x3cbd88,_0x3b40fb);};}exports[_0x1085('0x6')]=function(_0x1c9e36){for(var _0x152eeb=0x0,_0x1adbec=events[_0x1085('0x7')];_0x152eeb<_0x1adbec;_0x152eeb++){var _0x3352dc=events[_0x152eeb];var _0x546546=createListener('chatGroup:'+_0x3352dc,_0x1c9e36);ChatGroupEvents['on'](_0x3352dc,_0x546546);}};
\ No newline at end of file
+var _0xb7c8=['chatGroup:','save','remove','update','emit','removeListener','register','length'];(function(_0x4aa024,_0x4c9724){var _0x1606cf=function(_0x29f4ef){while(--_0x29f4ef){_0x4aa024['push'](_0x4aa024['shift']());}};_0x1606cf(++_0x4c9724);}(_0xb7c8,0x119));var _0x8b7c=function(_0x431cde,_0x4777a8){_0x431cde=_0x431cde-0x0;var _0x80bd5=_0xb7c8[_0x431cde];return _0x80bd5;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x8b7c('0x0'),_0x8b7c('0x1'),_0x8b7c('0x2')];function createListener(_0x3a84fc,_0x1dceff){return function(_0x31ad24){_0x1dceff[_0x8b7c('0x3')](_0x3a84fc,_0x31ad24);};}function removeListener(_0x50113e,_0x38672b){return function(){ChatGroupEvents[_0x8b7c('0x4')](_0x50113e,_0x38672b);};}exports[_0x8b7c('0x5')]=function(_0x440900){for(var _0x107428=0x0,_0x12665c=events[_0x8b7c('0x6')];_0x107428<_0x12665c;_0x107428++){var _0x3c8fd6=events[_0x107428];var _0x6afb55=createListener(_0x8b7c('0x7')+_0x3c8fd6,_0x440900);ChatGroupEvents['on'](_0x3c8fd6,_0x6afb55);}};
\ No newline at end of file
index c6b5e1b..51414b1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8e7f=['post','/:id/messages','addMessage','put','update','delete','/:id/members','removeMembers','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','index','/describe','describe','/:id','/:id/unread','getUnread','isAuthenticated','getMessages'];(function(_0x1a87b3,_0x45ba68){var _0x37e84d=function(_0x39f49e){while(--_0x39f49e){_0x1a87b3['push'](_0x1a87b3['shift']());}};_0x37e84d(++_0x45ba68);}(_0x8e7f,0x170));var _0xf8e7=function(_0x16dfb3,_0x1613fc){_0x16dfb3=_0x16dfb3-0x0;var _0x1d8030=_0x8e7f[_0x16dfb3];return _0x1d8030;};'use strict';var multer=require(_0xf8e7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf8e7('0x1'));var express=require(_0xf8e7('0x2'));var router=express[_0xf8e7('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf8e7('0x4'));var config=require(_0xf8e7('0x5'));var controller=require(_0xf8e7('0x6'));router[_0xf8e7('0x7')]('/',auth['isAuthenticated'](),controller[_0xf8e7('0x8')]);router[_0xf8e7('0x7')](_0xf8e7('0x9'),auth['isAuthenticated'](),controller[_0xf8e7('0xa')]);router[_0xf8e7('0x7')](_0xf8e7('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xf8e7('0x7')](_0xf8e7('0xc'),auth['isAuthenticated'](),controller[_0xf8e7('0xd')]);router[_0xf8e7('0x7')]('/:id/members',auth[_0xf8e7('0xe')](),controller['getMembers']);router[_0xf8e7('0x7')]('/:id/messages',auth[_0xf8e7('0xe')](),controller[_0xf8e7('0xf')]);router['post']('/',auth[_0xf8e7('0xe')](),controller['create']);router[_0xf8e7('0x10')]('/:id/members',auth[_0xf8e7('0xe')](),controller['addMembers']);router[_0xf8e7('0x10')](_0xf8e7('0x11'),auth[_0xf8e7('0xe')](),controller[_0xf8e7('0x12')]);router[_0xf8e7('0x13')](_0xf8e7('0xb'),auth['isAuthenticated'](),controller[_0xf8e7('0x14')]);router[_0xf8e7('0x15')](_0xf8e7('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0xf8e7('0x15')](_0xf8e7('0x16'),auth[_0xf8e7('0xe')](),controller[_0xf8e7('0x17')]);module['exports']=router;
\ No newline at end of file
+var _0x4333=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMessage','destroy','delete','removeMembers','multer','util','connect-timeout','Router'];(function(_0x293a24,_0x2406e6){var _0x23d1cf=function(_0x1130d4){while(--_0x1130d4){_0x293a24['push'](_0x293a24['shift']());}};_0x23d1cf(++_0x2406e6);}(_0x4333,0x100));var _0x3433=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4333[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x3433('0x0'));var util=require(_0x3433('0x1'));var path=require('path');var timeout=require(_0x3433('0x2'));var express=require('express');var router=express[_0x3433('0x3')]();var auth=require(_0x3433('0x4'));var interaction=require(_0x3433('0x5'));var config=require(_0x3433('0x6'));var controller=require(_0x3433('0x7'));router[_0x3433('0x8')]('/',auth['isAuthenticated'](),controller[_0x3433('0x9')]);router[_0x3433('0x8')](_0x3433('0xa'),auth[_0x3433('0xb')](),controller[_0x3433('0xc')]);router[_0x3433('0x8')](_0x3433('0xd'),auth['isAuthenticated'](),controller[_0x3433('0xe')]);router[_0x3433('0x8')]('/:id/unread',auth[_0x3433('0xb')](),controller[_0x3433('0xf')]);router[_0x3433('0x8')](_0x3433('0x10'),auth[_0x3433('0xb')](),controller[_0x3433('0x11')]);router[_0x3433('0x8')](_0x3433('0x12'),auth[_0x3433('0xb')](),controller[_0x3433('0x13')]);router[_0x3433('0x14')]('/',auth[_0x3433('0xb')](),controller[_0x3433('0x15')]);router['post']('/:id/members',auth['isAuthenticated'](),controller['addMembers']);router[_0x3433('0x14')](_0x3433('0x12'),auth[_0x3433('0xb')](),controller[_0x3433('0x16')]);router['put']('/:id',auth[_0x3433('0xb')](),controller['update']);router['delete']('/:id',auth[_0x3433('0xb')](),controller[_0x3433('0x17')]);router[_0x3433('0x18')](_0x3433('0x10'),auth[_0x3433('0xb')](),controller[_0x3433('0x19')]);module['exports']=router;
\ No newline at end of file
index 0a817f5..11f0015 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9c00=['long','out','sequelize','exports','ENUM','star','TEXT','STRING','DATE'];(function(_0x44f906,_0x37a445){var _0x3f8b7d=function(_0x140efa){while(--_0x140efa){_0x44f906['push'](_0x44f906['shift']());}};_0x3f8b7d(++_0x37a445);}(_0x9c00,0x1a0));var _0x09c0=function(_0x495f6f,_0x20c392){_0x495f6f=_0x495f6f-0x0;var _0x39bbf3=_0x9c00[_0x495f6f];return _0x39bbf3;};'use strict';var Sequelize=require(_0x09c0('0x0'));module[_0x09c0('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x09c0('0x2')](_0x09c0('0x3'),'thumb'),'defaultValue':_0x09c0('0x3')},'ratingMessage':{'type':Sequelize[_0x09c0('0x4')]},'pathTranscript':{'type':Sequelize[_0x09c0('0x4')]},'mailTranscript':{'type':Sequelize[_0x09c0('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x09c0('0x6')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x09c0('0x5')]},'browserVersion':{'type':Sequelize[_0x09c0('0x5')]},'osName':{'type':Sequelize[_0x09c0('0x5')]},'osVersion':{'type':Sequelize[_0x09c0('0x5')]},'deviceModel':{'type':Sequelize[_0x09c0('0x5')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x09c0('0x5')]},'referer':{'type':Sequelize[_0x09c0('0x5')]},'customerIp':{'type':Sequelize[_0x09c0('0x5')]},'formData':{'type':Sequelize[_0x09c0('0x4')](_0x09c0('0x7'))},'read1stAt':{'type':Sequelize[_0x09c0('0x6')]},'lastMsgAt':{'type':Sequelize[_0x09c0('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x09c0('0x2')]('in',_0x09c0('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x09c0('0x5')]}};
\ No newline at end of file
+var _0x34b7=['out','BOOLEAN','INTEGER','ENUM','star','thumb','STRING','DATE','long'];(function(_0x39e18d,_0x4798dc){var _0x58bd15=function(_0x43ffd2){while(--_0x43ffd2){_0x39e18d['push'](_0x39e18d['shift']());}};_0x58bd15(++_0x4798dc);}(_0x34b7,0x196));var _0x734b=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0x34b7[_0x236d24];return _0x1574cf;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x734b('0x0')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x734b('0x1')]},'ratingType':{'type':Sequelize[_0x734b('0x2')](_0x734b('0x3'),_0x734b('0x4')),'defaultValue':_0x734b('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x734b('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x734b('0x6')]},'disposition':{'type':Sequelize[_0x734b('0x5')]},'note':{'type':Sequelize[_0x734b('0x5')]},'browserName':{'type':Sequelize[_0x734b('0x5')]},'browserVersion':{'type':Sequelize[_0x734b('0x5')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x734b('0x5')]},'deviceModel':{'type':Sequelize[_0x734b('0x5')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['STRING']},'customerIp':{'type':Sequelize[_0x734b('0x5')]},'formData':{'type':Sequelize['TEXT'](_0x734b('0x7'))},'read1stAt':{'type':Sequelize[_0x734b('0x6')]},'lastMsgAt':{'type':Sequelize[_0x734b('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x734b('0x2')]('in',_0x734b('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x734b('0x5')]}};
\ No newline at end of file
index 70cad06..12b91b0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8881=['key','VIRTUAL','field','filter','merge','options','include','tag','push','Tag','Tags','distinct','read','createdAt','includeAll','User','Users','fullname','Contact','Owner','internal','ChatWebsite','Account','ChatMessage','Messages','direction','color','ThroughTags','findAll','rows','show','ChatInteraction','find','create','body','params','describe','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','ValidationError','Interaction\x20already\x20assigned','disposition','AbandonInteraction','attachmentUpload','file','originalname','mimetype','attachmentDownload','findOne','closed','Unauthorized','Attachment','download','join','root','basename','close','mailTranscript','server/files/chat/upload/','format','now','pathTranscript','ChatWebsiteId','CmContact','ContactId','%s%d','System','Visitor','website_alias','agentAlias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','SendMail','sendMail','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','hasOwnProperty','pick','ChatInteractionId','$gte','split','YYYY-MM-DD\x20HH:mm:ss','count','getMyMessages','includeAgent','addTags','setTags','ids','spread','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','firstName','Letter','1cm','<h1>Chat\x20Interaction:\x20#%d</h1>','<h2>Date:\x20%s</h2>','MMMM\x20Do\x20YYYY,\x20HH:mm:ss','<hr>','<p\x20style=\x22margin:\x203px;\x22>%s:\x20%s</p>','</div>','createReadStream','pipe','createWriteStream','interaction-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','limit','set','json','apply','reject','save','update','destroy','stack','name','send','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','map','type'];(function(_0x242617,_0x523952){var _0x18f859=function(_0xc29603){while(--_0xc29603){_0x242617['push'](_0x242617['shift']());}};_0x18f859(++_0x523952);}(_0x8881,0x151));var _0x1888=function(_0x462999,_0x24d200){_0x462999=_0x462999-0x0;var _0x4b1366=_0x8881[_0x462999];return _0x4b1366;};'use strict';var pdf=require(_0x1888('0x0'));var emlformat=require(_0x1888('0x1'));var rimraf=require(_0x1888('0x2'));var zipdir=require(_0x1888('0x3'));var jsonpatch=require(_0x1888('0x4'));var rp=require('request-promise');var moment=require(_0x1888('0x5'));var BPromise=require(_0x1888('0x6'));var Mustache=require(_0x1888('0x7'));var util=require('util');var path=require(_0x1888('0x8'));var sox=require('sox');var csv=require(_0x1888('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1888('0xa'));var squel=require(_0x1888('0xb'));var crypto=require(_0x1888('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1888('0xd'));var toCsv=require(_0x1888('0x9'));var querystring=require(_0x1888('0xe'));var Papa=require(_0x1888('0xf'));var authService=require(_0x1888('0x10'));var hardwareService=require(_0x1888('0x11'));var Redis=require(_0x1888('0x12'));var qs=require(_0x1888('0x13'));var logger=require('../../config/logger')(_0x1888('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x1888('0x15'))['db'];config[_0x1888('0x16')]=_[_0x1888('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1888('0x18'))(new Redis(config[_0x1888('0x16')]));require('./chatInteraction.socket')[_0x1888('0x19')](socket);var jayson=require(_0x1888('0x1a'));var client=jayson[_0x1888('0x1b')][_0x1888('0x1c')]({'port':0x232b});var client9004=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x31e7bf,_0x372246,_0xfb0dee,_0x18aa25){return new BPromise(function(_0x1d7b73,_0x176c8e){var _0x5b8ece=_0x18aa25||client;return _0x5b8ece[_0x1888('0x1d')](_0x31e7bf,_0xfb0dee)[_0x1888('0x1e')](function(_0x23d223){logger[_0x1888('0x1f')]('ChatInteraction,\x20%s,\x20%s',_0x372246,_0x1888('0x20'));logger['debug'](_0x1888('0x21'),_0x372246,'request\x20sent',JSON[_0x1888('0x22')](_0x23d223));if(_0x23d223[_0x1888('0x23')]){if(_0x23d223[_0x1888('0x23')][_0x1888('0x24')]===0x1f4){logger[_0x1888('0x23')](_0x1888('0x25'),_0x372246,_0x23d223[_0x1888('0x23')][_0x1888('0x26')]);return _0x176c8e(_0x23d223[_0x1888('0x23')][_0x1888('0x26')]);}logger[_0x1888('0x23')]('ChatInteraction,\x20%s,\x20%s',_0x372246,_0x23d223[_0x1888('0x23')][_0x1888('0x26')]);return _0x1d7b73(_0x23d223[_0x1888('0x23')][_0x1888('0x26')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x372246,_0x1888('0x20'));_0x1d7b73(_0x23d223[_0x1888('0x27')]['message']);}})[_0x1888('0x28')](function(_0x24a061){logger[_0x1888('0x23')]('ChatInteraction,\x20%s,\x20%s',_0x372246,_0x24a061);_0x176c8e(_0x24a061);});});}function respondWithStatusCode(_0x4a2915,_0x43e0bc){_0x43e0bc=_0x43e0bc||0xcc;return function(_0x592943){if(_0x592943){return _0x4a2915[_0x1888('0x29')](_0x43e0bc);}return _0x4a2915[_0x1888('0x2a')](_0x43e0bc)[_0x1888('0x2b')]();};}function respondWithResult(_0x184416,_0x53bf92){_0x53bf92=_0x53bf92||0xc8;return function(_0x1d51b4){if(_0x1d51b4){return _0x184416[_0x1888('0x2a')](_0x53bf92)['json'](_0x1d51b4);}};}function respondWithFilteredResult(_0x4e1101,_0x42f3dc){return function(_0x28b578){if(_0x28b578){var _0x226275=_0x28b578['count'],_0x926354=_0x42f3dc[_0x1888('0x2c')],_0xbce24a=_0x42f3dc[_0x1888('0x2c')]+_0x42f3dc[_0x1888('0x2d')],_0x4656a4;if(_0xbce24a>=_0x226275){_0xbce24a=_0x226275;_0x4656a4=0xc8;}else{_0x4656a4=0xce;}_0x4e1101[_0x1888('0x2a')](_0x4656a4);return _0x4e1101[_0x1888('0x2e')]('Content-Range',_0x926354+'-'+_0xbce24a+'/'+_0x226275)[_0x1888('0x2f')](_0x28b578);}return null;};}function patchUpdates(_0xe7074b){return function(_0x2b3874){try{jsonpatch[_0x1888('0x30')](_0x2b3874,_0xe7074b,!![]);}catch(_0x366bf6){return BPromise[_0x1888('0x31')](_0x366bf6);}return _0x2b3874[_0x1888('0x32')]();};}function saveUpdates(_0x4c6195,_0x292d0f){return function(_0x3c247d){if(_0x3c247d){return _0x3c247d[_0x1888('0x33')](_0x4c6195)['then'](function(_0x3bbd11){return _0x3bbd11;});}return null;};}function removeEntity(_0xd4fc7b,_0x3ff3b4){return function(_0x3a08e9){if(_0x3a08e9){return _0x3a08e9[_0x1888('0x34')]()['then'](function(){_0xd4fc7b['status'](0xcc)[_0x1888('0x2b')]();});}};}function handleEntityNotFound(_0x437ce7,_0x4d711a){return function(_0x25d7bc){if(!_0x25d7bc){_0x437ce7[_0x1888('0x29')](0x194);}return _0x25d7bc;};}function handleError(_0x5b0ec8,_0x25a131){_0x25a131=_0x25a131||0x1f4;return function(_0x1d7488){logger[_0x1888('0x23')](_0x1d7488[_0x1888('0x35')]);if(_0x1d7488['name']){delete _0x1d7488[_0x1888('0x36')];}_0x5b0ec8['status'](_0x25a131)[_0x1888('0x37')](_0x1d7488);};}exports['index']=function(_0x48d20c,_0x366e60){var _0x346a49={},_0x1e8753={},_0x52654d={'count':0x0,'rows':[]};var _0x58d558=db['ChatInteraction'][_0x1888('0x38')];_0x1e8753[_0x1888('0x39')]=_[_0x1888('0x3a')](_0x58d558);_0x1e8753[_0x1888('0x3b')]=_[_0x1888('0x3a')](_0x48d20c[_0x1888('0x3b')]);_0x1e8753[_0x1888('0x3c')]=_['intersection'](_0x1e8753['model'],_0x1e8753[_0x1888('0x3b')]);_0x346a49[_0x1888('0x3d')]=_[_0x1888('0x3e')](_0x1e8753['model'],qs[_0x1888('0x3f')](_0x48d20c[_0x1888('0x3b')][_0x1888('0x3f')]));_0x346a49['attributes']=_0x346a49[_0x1888('0x3d')][_0x1888('0x40')]?_0x346a49[_0x1888('0x3d')]:_0x1e8753[_0x1888('0x39')];if(!_0x48d20c[_0x1888('0x3b')]['hasOwnProperty'](_0x1888('0x41'))){_0x346a49[_0x1888('0x2d')]=qs['limit'](_0x48d20c[_0x1888('0x3b')][_0x1888('0x2d')]);_0x346a49[_0x1888('0x2c')]=qs[_0x1888('0x2c')](_0x48d20c[_0x1888('0x3b')]['offset']);}_0x346a49[_0x1888('0x42')]=qs['sort'](_0x48d20c[_0x1888('0x3b')][_0x1888('0x43')]);_0x346a49[_0x1888('0x44')]=qs['filters'](_['pick'](_0x48d20c['query'],_0x1e8753[_0x1888('0x3c')]));if(_0x48d20c[_0x1888('0x3b')]['filter']){_0x346a49['where']=_['merge'](_0x346a49['where'],{'$or':_[_0x1888('0x45')](_0x58d558,function(_0x4b159f){if(_0x4b159f[_0x1888('0x46')][_0x1888('0x47')]!==_0x1888('0x48')){var _0x2fd11f={};_0x2fd11f[_0x4b159f[_0x1888('0x49')]]={'$like':'%'+_0x48d20c[_0x1888('0x3b')][_0x1888('0x4a')]+'%'};return _0x2fd11f;}})});}_0x346a49=_[_0x1888('0x4b')]({},_0x346a49,_0x48d20c[_0x1888('0x4c')]);var _0x4d7ff8={'where':_0x346a49['where']};_0x4d7ff8[_0x1888('0x4d')]=[];if(_0x48d20c[_0x1888('0x3b')][_0x1888('0x4e')]){_0x4d7ff8['include'][_0x1888('0x4f')]({'model':db[_0x1888('0x50')],'as':_0x1888('0x51'),'attributes':['id'],'where':{'id':_0x48d20c['query'][_0x1888('0x4e')]},'required':!![]});_0x4d7ff8[_0x1888('0x52')]=!![];}if(_0x48d20c['query'][_0x1888('0x53')]){_0x4d7ff8[_0x1888('0x4d')][_0x1888('0x4f')]({'model':db['ChatMessage'],'as':'Messages','attributes':['id','direction',_0x1888('0x54'),_0x1888('0x53')],'where':{'direction':'in','read':_0x48d20c['query']['read']||![]},'required':!![]});_0x4d7ff8[_0x1888('0x52')]=!![];}return db['ChatInteraction']['count'](_0x4d7ff8)[_0x1888('0x1e')](function(_0x20c6c3){_0x52654d['count']=_0x20c6c3;if(_0x48d20c[_0x1888('0x3b')][_0x1888('0x55')]){_0x346a49['include']=[{'model':db[_0x1888('0x56')],'as':_0x1888('0x57'),'required':![],'attributes':['id','name',_0x1888('0x58')]},{'model':db['CmContact'],'as':_0x1888('0x59'),'required':![]},{'model':db[_0x1888('0x56')],'as':_0x1888('0x5a'),'attributes':[_0x1888('0x36'),_0x1888('0x58'),_0x1888('0x5b')],'required':![]},{'model':db[_0x1888('0x5c')],'as':_0x1888('0x5d'),'attributes':[_0x1888('0x36'),_0x1888('0x47')],'required':![]},{'model':db[_0x1888('0x5e')],'as':_0x1888('0x5f'),'attributes':['id',_0x1888('0x60'),_0x1888('0x54'),_0x1888('0x53')],'where':{'direction':'in','read':_0x48d20c[_0x1888('0x3b')][_0x1888('0x53')]||![]},'required':_0x48d20c[_0x1888('0x3b')][_0x1888('0x53')]||![]},{'model':db[_0x1888('0x50')],'as':_0x1888('0x51'),'attributes':['id',_0x1888('0x36'),_0x1888('0x61')],'required':_0x48d20c[_0x1888('0x3b')][_0x1888('0x4e')]?!![]:![]},{'model':db[_0x1888('0x50')],'as':_0x1888('0x62'),'attributes':['id',_0x1888('0x36'),'color'],'through':_0x48d20c[_0x1888('0x3b')][_0x1888('0x4e')]?{'attributes':[],'where':{'TagId':_0x48d20c['query']['tag']||undefined}}:{},'required':_0x48d20c[_0x1888('0x3b')][_0x1888('0x4e')]?!![]:![]}];}return db['ChatInteraction'][_0x1888('0x63')](_0x346a49);})[_0x1888('0x1e')](function(_0xa17fd5){_0x52654d[_0x1888('0x64')]=_0xa17fd5;return _0x52654d;})[_0x1888('0x1e')](respondWithFilteredResult(_0x366e60,_0x346a49))['catch'](handleError(_0x366e60,null));};exports[_0x1888('0x65')]=function(_0x449974,_0x2a4314){var _0x352c56={'raw':![],'where':{'id':_0x449974['params']['id']}},_0x38c0c9={};_0x38c0c9[_0x1888('0x39')]=_[_0x1888('0x3a')](db[_0x1888('0x66')][_0x1888('0x38')]);_0x38c0c9[_0x1888('0x3b')]=_['keys'](_0x449974[_0x1888('0x3b')]);_0x38c0c9[_0x1888('0x3c')]=_[_0x1888('0x3e')](_0x38c0c9[_0x1888('0x39')],_0x38c0c9['query']);_0x352c56[_0x1888('0x3d')]=_[_0x1888('0x3e')](_0x38c0c9[_0x1888('0x39')],qs[_0x1888('0x3f')](_0x449974[_0x1888('0x3b')][_0x1888('0x3f')]));_0x352c56[_0x1888('0x3d')]=_0x352c56[_0x1888('0x3d')][_0x1888('0x40')]?_0x352c56[_0x1888('0x3d')]:_0x38c0c9[_0x1888('0x39')];if(_0x449974[_0x1888('0x3b')][_0x1888('0x55')]){_0x352c56[_0x1888('0x4d')]=[{'all':!![]}];}_0x352c56=_[_0x1888('0x4b')]({},_0x352c56,_0x449974['options']);return db['ChatInteraction'][_0x1888('0x67')](_0x352c56)[_0x1888('0x1e')](handleEntityNotFound(_0x2a4314,null))[_0x1888('0x1e')](respondWithResult(_0x2a4314,null))['catch'](handleError(_0x2a4314,null));};exports['create']=function(_0x5e1a3e,_0x2db466){return db[_0x1888('0x66')][_0x1888('0x68')](_0x5e1a3e[_0x1888('0x69')],{})['then'](respondWithResult(_0x2db466,0xc9))['catch'](handleError(_0x2db466,null));};exports[_0x1888('0x33')]=function(_0xe80552,_0xb0557c){if(_0xe80552[_0x1888('0x69')]['id']){delete _0xe80552[_0x1888('0x69')]['id'];}return db[_0x1888('0x66')][_0x1888('0x67')]({'where':{'id':_0xe80552[_0x1888('0x6a')]['id']}})['then'](handleEntityNotFound(_0xb0557c,null))['then'](saveUpdates(_0xe80552[_0x1888('0x69')],null))[_0x1888('0x1e')](respondWithResult(_0xb0557c,null))['catch'](handleError(_0xb0557c,null));};exports[_0x1888('0x34')]=function(_0x52b7f9,_0x4c852c){return db[_0x1888('0x66')][_0x1888('0x67')]({'where':{'id':_0x52b7f9[_0x1888('0x6a')]['id']}})[_0x1888('0x1e')](handleEntityNotFound(_0x4c852c,null))['then'](removeEntity(_0x4c852c,null))[_0x1888('0x28')](handleError(_0x4c852c,null));};exports[_0x1888('0x6b')]=function(_0x1f863d,_0x15f858){return db[_0x1888('0x66')][_0x1888('0x6b')]()[_0x1888('0x1e')](respondWithResult(_0x15f858,null))[_0x1888('0x28')](handleError(_0x15f858,null));};exports[_0x1888('0x6c')]=function(_0xb37f51,_0x513776){if(_0xb37f51['body']['id']){delete _0xb37f51[_0x1888('0x69')]['id'];}return db[_0x1888('0x66')][_0x1888('0x67')]({'where':{'id':_0xb37f51[_0x1888('0x6a')]['id']}})[_0x1888('0x1e')](handleEntityNotFound(_0x513776,null))[_0x1888('0x1e')](saveUpdates(_0xb37f51[_0x1888('0x69')],null))[_0x1888('0x1e')](respondWithResult(_0x513776,null))[_0x1888('0x28')](handleError(_0x513776,null));};exports[_0x1888('0x6d')]=function(_0x56bb61,_0x12812d,_0x1e5f99){if(_0x56bb61[_0x1888('0x69')]['id']){delete _0x56bb61[_0x1888('0x69')]['id'];}return db['ChatInteraction'][_0x1888('0x67')]({'where':{'id':_0x56bb61['params']['id']}})[_0x1888('0x1e')](function(_0x447b02){if(!_0x447b02){logger[_0x1888('0x23')](_0x1888('0x6e'),_0x1888('0x6d'),0x194,_0x1888('0x6f'));_0x12812d[_0x1888('0x29')](0x194);}else{if(_0x447b02[_0x1888('0x70')]){throw new db['Sequelize'][(_0x1888('0x71'))](_0x1888('0x72'));}}return _0x447b02;})['then'](function(_0x508a13){if(_0x508a13){return _0x508a13[_0x1888('0x33')]({'closed':_0x56bb61[_0x1888('0x69')]['closed'],'closedAt':_0x56bb61['body']['closedAt'],'disposition':_0x56bb61[_0x1888('0x69')][_0x1888('0x73')]})[_0x1888('0x1e')](function(_0x5992f3){return _0x5992f3;});}})[_0x1888('0x1e')](function(_0x4a2680){return respondWithRpcPromise(_0x1888('0x74'),_0x1888('0x6d'),_0x56bb61[_0x1888('0x69')],client9004);})[_0x1888('0x1e')](respondWithResult(_0x12812d,null))['catch'](handleError(_0x12812d,null));};exports[_0x1888('0x75')]=function(_0x2f051c,_0x3dddeb,_0x1926be){_0x2f051c[_0x1888('0x69')][_0x1888('0x36')]=_0x2f051c[_0x1888('0x76')][_0x1888('0x77')];_0x2f051c[_0x1888('0x69')]['basename']=_0x2f051c[_0x1888('0x76')]['filename'];_0x2f051c[_0x1888('0x69')]['type']=_0x2f051c[_0x1888('0x76')][_0x1888('0x78')];return db['Attachment'][_0x1888('0x68')](_0x2f051c[_0x1888('0x69')])[_0x1888('0x1e')](respondWithResult(_0x3dddeb,0xc9))[_0x1888('0x28')](handleError(_0x3dddeb,null));};exports[_0x1888('0x79')]=function(_0x5e5114,_0x3ccc94,_0x3048f6){return db[_0x1888('0x66')][_0x1888('0x7a')]({'where':{'id':_0x5e5114['params']['id']},'raw':!![]})[_0x1888('0x1e')](handleEntityNotFound(_0x3ccc94,null))[_0x1888('0x1e')](function(_0x3b809d){if(_0x3b809d){if(_0x3b809d[_0x1888('0x7b')]){return _0x3ccc94[_0x1888('0x2a')](0x193)[_0x1888('0x2f')]({'status':0x193,'message':_0x1888('0x7c')});}return db[_0x1888('0x7d')][_0x1888('0x7a')]({'where':{'id':_0x5e5114['query']['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x3ccc94,null));}})[_0x1888('0x1e')](function(_0x14c360){if(_0x14c360){return _0x3ccc94[_0x1888('0x7e')](path[_0x1888('0x7f')](config[_0x1888('0x80')],'server/files/attachments/',_0x14c360[_0x1888('0x81')]));}})['catch'](handleError(_0x3ccc94,null));};exports[_0x1888('0x82')]=function(_0x240ebc,_0x57cfcd){var _0x3d0edc=null;var _0xe192e0=null;var _0x7030bc=null;var _0x346c56=null;if(_0x240ebc[_0x1888('0x69')]['id']){delete _0x240ebc[_0x1888('0x69')]['id'];}if(_0x240ebc['body'][_0x1888('0x83')]){_0x346c56=path['join'](config['root'],_0x1888('0x84'),util[_0x1888('0x85')]('transcript-%s.txt',Date[_0x1888('0x86')]()));_0x240ebc[_0x1888('0x69')][_0x1888('0x87')]=_0x346c56;}return db[_0x1888('0x66')]['find']({'where':{'id':_0x240ebc[_0x1888('0x6a')]['id']},'include':[{'model':db[_0x1888('0x5e')],'as':_0x1888('0x5f'),'include':[{'model':db[_0x1888('0x56')],'as':_0x1888('0x56')}]}]})[_0x1888('0x1e')](handleEntityNotFound(_0x57cfcd,null))[_0x1888('0x1e')](saveUpdates(_0x240ebc[_0x1888('0x69')],null))[_0x1888('0x1e')](function(_0xd07cff){if(_0xd07cff){_0x3d0edc=_0xd07cff;return db['ChatWebsite'][_0x1888('0x67')]({'where':{'id':_0x3d0edc[_0x1888('0x88')]}});}})[_0x1888('0x1e')](function(_0x1e895e){if(_0x1e895e){_0x7030bc=_0x1e895e;return db[_0x1888('0x89')][_0x1888('0x67')]({'where':{'id':_0x3d0edc[_0x1888('0x8a')]}});}})[_0x1888('0x1e')](function(_0x5e8d9e){if(_0x5e8d9e){_0xe192e0=_0x5e8d9e;if(_0x346c56){var _0x5a9658=null;for(var _0x114849=0x1;_0x114849<_0x3d0edc[_0x1888('0x5f')][_0x1888('0x40')];++_0x114849){_0x5a9658=_0x3d0edc[_0x1888('0x5f')][_0x114849];var _0x5ac084=_0x5a9658['UserId']?util[_0x1888('0x85')](_0x1888('0x8b'),_0x7030bc['agentAlias'],_0x5a9658[_0x1888('0x70')]):_0x1888('0x8c');var _0x533c71=_0x240ebc[_0x1888('0x69')]['customer']||util[_0x1888('0x85')](_0x1888('0x8b'),_0x1888('0x8d'),_0x5a9658[_0x1888('0x8a')]);switch(_0x7030bc['agentIdentifier']){case _0x1888('0x8e'):_0x5ac084=_0x5a9658['UserId']?util['format']('%s%d',_0x7030bc[_0x1888('0x8f')],_0x5a9658[_0x1888('0x70')]):'System';break;case _0x1888('0x90'):_0x5ac084=_0x5a9658[_0x1888('0x70')]?_0x5a9658[_0x1888('0x56')][_0x1888('0x91')]||_0x5a9658['User'][_0x1888('0x58')]:_0x1888('0x8c');break;case _0x1888('0x92'):_0x5ac084=_0x5a9658[_0x1888('0x70')]?_0x5a9658[_0x1888('0x56')]['fullname']:'System';break;default:_0x5ac084=_0x5a9658['UserId']?util[_0x1888('0x85')]('%s%d',_0x7030bc['agentAlias'],_0x5a9658[_0x1888('0x70')]):_0x1888('0x8c');}var _0x3664d0=util[_0x1888('0x85')](_0x1888('0x93'),moment(_0x5a9658[_0x1888('0x54')])[_0x1888('0x85')](_0x1888('0x94')),_0x5a9658['direction']==='in'?_0x533c71:_0x5ac084,_0x5a9658[_0x1888('0x69')]);if(!_0x5a9658[_0x1888('0x95')]){fs['appendFileSync'](_0x346c56,_0x3664d0);}}return db[_0x1888('0x96')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x1888('0x97'),'raw':!![]}]});}}})['then'](function(_0x27a635){if(_0x27a635&&_0x27a635[_0x1888('0x97')]&&_0x240ebc[_0x1888('0x69')]){var _0x96ef64={'tls':{'rejectUnauthorized':![]}};if(_0x27a635[_0x1888('0x97')][_0x1888('0x98')]){_0x96ef64[_0x1888('0x98')]=_0x27a635[_0x1888('0x97')][_0x1888('0x98')];}else{_0x96ef64[_0x1888('0x99')]=_0x27a635['Smtp'][_0x1888('0x99')];_0x96ef64[_0x1888('0x9a')]=_0x27a635[_0x1888('0x97')][_0x1888('0x9a')];_0x96ef64[_0x1888('0x9b')]=_0x27a635[_0x1888('0x97')][_0x1888('0x9b')];}if(_0x27a635[_0x1888('0x97')][_0x1888('0x9c')]){_0x96ef64[_0x1888('0x9d')]={'user':_0x27a635[_0x1888('0x97')][_0x1888('0x9e')],'pass':_0x27a635['Smtp']['pass']};}return respondWithRpcPromise(_0x1888('0x9f'),_0x1888('0xa0'),{'account':_0x96ef64,'message':{'from':util[_0x1888('0x85')]('\x22%s\x22\x20<%s>',_0x27a635[_0x1888('0x36')],_0x27a635[_0x1888('0xa1')]||_0x27a635[_0x1888('0x97')]['user']),'to':_0x240ebc[_0x1888('0x69')]['mailTranscript'],'subject':_0x1888('0xa2'),'text':util[_0x1888('0x85')](_0x1888('0xa3'),_0x240ebc['body']['mailTranscript']),'attachments':[{'path':_0x346c56}]}})[_0x1888('0x1e')](function(){return _0x3d0edc;})['catch'](function(_0x1ff7a9){console[_0x1888('0x23')](_0x1ff7a9);});}else{return _0x3d0edc;}})[_0x1888('0x1e')](respondWithStatusCode(_0x57cfcd,0xc8))[_0x1888('0x28')](handleError(_0x57cfcd,null));};exports[_0x1888('0xa4')]=function(_0x322927,_0x171069,_0x2f2967){return db[_0x1888('0x5e')][_0x1888('0x67')]({'where':{'id':_0x322927[_0x1888('0x6a')]['id']}})[_0x1888('0x1e')](handleEntityNotFound(_0x171069,null))[_0x1888('0x1e')](function(_0x5780b1){if(_0x5780b1){return _0x5780b1['addMessage'](_0x322927[_0x1888('0x69')]['ids'],_[_0x1888('0xa5')](_0x322927[_0x1888('0x69')],['ids','id'])||{});}})['then'](respondWithResult(_0x171069,null))[_0x1888('0x28')](handleError(_0x171069,null));};exports['getMessages']=function(_0x2d22ac,_0x784b27,_0x285a7f){var _0x25252f={'raw':![],'where':{}};var _0x3ca744={};var _0x4c1dea={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x2d22ac[_0x1888('0x6a')]['id']}})[_0x1888('0x1e')](handleEntityNotFound(_0x784b27,null))['then'](function(_0x276add){if(_0x276add){_0x3ca744[_0x1888('0x39')]=_['keys'](db['ChatMessage'][_0x1888('0x38')]);_0x3ca744[_0x1888('0x3b')]=_[_0x1888('0x3a')](_0x2d22ac[_0x1888('0x3b')]);_0x3ca744[_0x1888('0x3c')]=_[_0x1888('0x3e')](_0x3ca744[_0x1888('0x39')],_0x3ca744[_0x1888('0x3b')]);_0x25252f[_0x1888('0x3d')]=_['intersection'](_0x3ca744[_0x1888('0x39')],qs[_0x1888('0x3f')](_0x2d22ac[_0x1888('0x3b')]['fields']));_0x25252f[_0x1888('0x3d')]=_0x25252f[_0x1888('0x3d')][_0x1888('0x40')]?_0x25252f[_0x1888('0x3d')]:_0x3ca744[_0x1888('0x39')];if(!_0x2d22ac['query'][_0x1888('0xa6')](_0x1888('0x41'))){_0x25252f[_0x1888('0x2d')]=qs[_0x1888('0x2d')](_0x2d22ac[_0x1888('0x3b')][_0x1888('0x2d')]);_0x25252f[_0x1888('0x2c')]=qs[_0x1888('0x2c')](_0x2d22ac[_0x1888('0x3b')]['offset']);}_0x25252f[_0x1888('0x42')]=qs['sort'](_0x2d22ac[_0x1888('0x3b')][_0x1888('0x43')]);_0x25252f[_0x1888('0x44')]=qs['filters'](_[_0x1888('0xa7')](_0x2d22ac[_0x1888('0x3b')],_0x3ca744[_0x1888('0x3c')]));_0x25252f[_0x1888('0x44')][_0x1888('0xa8')]=_0x276add['id'];if(_0x2d22ac[_0x1888('0x3b')][_0x1888('0x4a')]){_0x25252f[_0x1888('0x44')]=_[_0x1888('0x4b')](_0x25252f[_0x1888('0x44')],{'$or':_[_0x1888('0x45')](_0x25252f['attributes'],function(_0x2e2f12){var _0x34faf2={};_0x34faf2[_0x2e2f12]={'$like':'%'+_0x2d22ac[_0x1888('0x3b')]['filter']+'%'};return _0x34faf2;})});}if(_0x2d22ac[_0x1888('0x3b')][_0x1888('0xa9')]){var _0x552e21=_0x2d22ac[_0x1888('0x3b')]['$gte'][_0x1888('0xaa')](',');var _0x3aa1e6={};_0x3aa1e6[_0x552e21[0x0]]={'$gte':moment(_0x552e21[0x1])[_0x1888('0x85')](_0x1888('0xab'))};_0x25252f['where']=_['merge'](_0x25252f[_0x1888('0x44')],_0x3aa1e6);}_0x25252f=_[_0x1888('0x4b')]({},_0x25252f,_0x2d22ac[_0x1888('0x4c')]);return db[_0x1888('0x5e')][_0x1888('0xac')]({'where':_0x25252f[_0x1888('0x44')]})[_0x1888('0x1e')](function(_0x413d54){_0x4c1dea[_0x1888('0xac')]=_0x413d54;if(_0x2d22ac[_0x1888('0x3b')][_0x1888('0x55')]){_0x25252f[_0x1888('0x4d')]=[{'all':!![]}];}return db['ChatMessage'][_0x1888('0x63')](_0x25252f);})[_0x1888('0x1e')](function(_0x585b3e){_0x4c1dea[_0x1888('0x64')]=_0x585b3e;return _0x4c1dea;});}})['then'](respondWithFilteredResult(_0x784b27,_0x25252f))[_0x1888('0x28')](handleError(_0x784b27,null));};exports[_0x1888('0xad')]=function(_0x2deeec,_0x5ea4c0,_0xd4aa8c){var _0x242271={'where':{}},_0x44a07b={},_0x28260b={'count':0x0,'rows':[]};return db[_0x1888('0x66')][_0x1888('0x7a')]({'where':{'id':_0x2deeec[_0x1888('0x6a')]['id']}})[_0x1888('0x1e')](handleEntityNotFound(_0x5ea4c0,null))[_0x1888('0x1e')](function(_0x4bcd08){if(_0x4bcd08){_0x44a07b['model']=_[_0x1888('0x3a')](db[_0x1888('0x5e')][_0x1888('0x38')]);_0x44a07b[_0x1888('0x3b')]=_['keys'](_0x2deeec['query']);_0x44a07b[_0x1888('0x3c')]=_[_0x1888('0x3e')](_0x44a07b[_0x1888('0x39')],_0x44a07b[_0x1888('0x3b')]);_0x242271[_0x1888('0x3d')]=_[_0x1888('0x3e')](_0x44a07b['model'],qs[_0x1888('0x3f')](_0x2deeec[_0x1888('0x3b')][_0x1888('0x3f')]));_0x242271[_0x1888('0x3d')]=_0x242271[_0x1888('0x3d')][_0x1888('0x40')]?_0x242271['attributes']:_0x44a07b['model'];if(!_0x2deeec[_0x1888('0x3b')][_0x1888('0xa6')](_0x1888('0x41'))){_0x242271[_0x1888('0x2d')]=qs[_0x1888('0x2d')](_0x2deeec['query'][_0x1888('0x2d')]);_0x242271[_0x1888('0x2c')]=qs[_0x1888('0x2c')](_0x2deeec['query'][_0x1888('0x2c')]);}_0x242271['order']=qs['sort'](_0x2deeec[_0x1888('0x3b')][_0x1888('0x43')]);_0x242271[_0x1888('0x44')]=qs[_0x1888('0x3c')](_[_0x1888('0xa7')](_0x2deeec[_0x1888('0x3b')],_0x44a07b['filters']));_0x242271[_0x1888('0x44')]['ChatInteractionId']=_0x4bcd08['id'];if(_0x2deeec[_0x1888('0x3b')][_0x1888('0x4a')]){_0x242271[_0x1888('0x44')]=_[_0x1888('0x4b')](_0x242271['where'],{'$or':_[_0x1888('0x45')](_0x242271[_0x1888('0x3d')],function(_0x15cb11){var _0x3f4c0b={};_0x3f4c0b[_0x15cb11]={'$like':'%'+_0x2deeec[_0x1888('0x3b')][_0x1888('0x4a')]+'%'};return _0x3f4c0b;})});}_0x242271[_0x1888('0x44')][_0x1888('0x95')]=![];if(_0x2deeec[_0x1888('0x3b')]['id']){_0x242271['where']['id']={'$gt':_0x2deeec['query']['id']};}_0x242271=_[_0x1888('0x4b')]({},_0x242271,_0x2deeec[_0x1888('0x4c')]);return db['ChatMessage'][_0x1888('0xac')]({'where':_0x242271[_0x1888('0x44')]})[_0x1888('0x1e')](function(_0x4a8448){_0x28260b[_0x1888('0xac')]=_0x4a8448;_0x242271['include']=[];if(_0x2deeec[_0x1888('0x3b')][_0x1888('0xae')]){_0x242271[_0x1888('0x4d')][_0x1888('0x4f')]({'model':db[_0x1888('0x56')],'as':_0x1888('0x56'),'attributes':['id',_0x1888('0x58'),_0x1888('0x91')]});}if(_0x2deeec[_0x1888('0x3b')][_0x1888('0x55')]){_0x242271[_0x1888('0x4d')]=[{'all':!![]}];}return db[_0x1888('0x5e')][_0x1888('0x63')](_0x242271);})['then'](function(_0x297456){_0x28260b['rows']=_0x297456;return _0x28260b;});}})[_0x1888('0x1e')](respondWithFilteredResult(_0x5ea4c0,_0x242271))[_0x1888('0x28')](handleError(_0x5ea4c0,null));};exports[_0x1888('0xaf')]=function(_0x1b3831,_0x44c300,_0x401a74){return db[_0x1888('0x66')][_0x1888('0x67')]({'where':{'id':_0x1b3831['params']['id']}})[_0x1888('0x1e')](handleEntityNotFound(_0x44c300,null))['then'](function(_0x44ec8d){if(_0x44ec8d){return _0x44ec8d[_0x1888('0xb0')](_0x1b3831[_0x1888('0x69')]['ids'],_[_0x1888('0xa5')](_0x1b3831[_0x1888('0x69')],[_0x1888('0xb1'),'id'])||{})[_0x1888('0xb2')](function(){return db[_0x1888('0x50')]['findAll']({'attributes':['id',_0x1888('0x36'),_0x1888('0x61')],'where':{'id':_0x1b3831['body'][_0x1888('0xb1')]}});})[_0x1888('0x1e')](function(_0xfb2ddc){socket[_0x1888('0xb3')](_0x1888('0xb4'),{'id':Number(_0x1b3831['params']['id']),'tags':_0xfb2ddc||[]});return{'id':Number(_0x1b3831[_0x1888('0x6a')]['id']),'tags':_0xfb2ddc||[]};});}})[_0x1888('0x1e')](respondWithResult(_0x44c300,null))[_0x1888('0x28')](handleError(_0x44c300,null));};exports[_0x1888('0xb5')]=function(_0x516ce5,_0x2d4f97,_0x1ccd79){var _0x145d09;return db['ChatInteraction'][_0x1888('0x67')]({'where':{'id':_0x516ce5[_0x1888('0x6a')]['id']}})['then'](handleEntityNotFound(_0x2d4f97,null))[_0x1888('0x1e')](function(_0x2eb3f6){if(_0x2eb3f6){return _0x2eb3f6[_0x1888('0xb5')](_0x516ce5[_0x1888('0x3b')][_0x1888('0xb1')]);}})['then'](respondWithStatusCode(_0x2d4f97,null))[_0x1888('0x28')](handleError(_0x2d4f97,null));};exports[_0x1888('0x7e')]=function(_0x5e7492,_0x2037a9){var _0x285c17=moment()[_0x1888('0xb6')]()['toString']();var _0x1b5cfa=path[_0x1888('0x7f')](config['root'],_0x1888('0xb7'),_0x1888('0xb8'),_0x1888('0xb9'));var _0x2142c7=path[_0x1888('0x7f')](config['root'],_0x1888('0xb7'),_0x1888('0xb8'),_0x1888('0xba'));var _0x5bf632=path[_0x1888('0x7f')](_0x1b5cfa,_0x285c17);var _0x6e03ed=util[_0x1888('0x85')]('interaction-%s.zip',_0x285c17);var _0x3041cf=path[_0x1888('0x7f')](_0x1b5cfa,_0x6e03ed);var _0x302b78=![];return db['ChatInteraction']['find']({'where':{'id':_0x5e7492['params']['id']},'include':[{'model':db[_0x1888('0x5e')],'as':_0x1888('0x5f'),'attributes':['id','body'],'include':[{'model':db[_0x1888('0x56')],'as':'User','attributes':['id',_0x1888('0x58')],'raw':!![]},{'model':db['CmContact'],'as':_0x1888('0x59'),'attributes':['id',_0x1888('0xbb')],'raw':!![]},{'model':db[_0x1888('0x7d')],'as':_0x1888('0x7d'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x2037a9,null))['then'](function(_0x1df86e){if(_0x1df86e){_0x302b78=!![];var _0x5a72cb='';var _0x1ca77a={'format':_0x1888('0xbc'),'border':_0x1888('0xbd')};fs['mkdirSync'](_0x5bf632);_0x5a72cb+=util[_0x1888('0x85')](_0x1888('0xbe'),_0x1df86e['id']);_0x5a72cb+=util[_0x1888('0x85')](_0x1888('0xbf'),moment()[_0x1888('0x85')](_0x1888('0xc0'))['toString']());_0x5a72cb+=_0x1888('0xc1');for(var _0x483dc=0x1;_0x483dc<_0x1df86e[_0x1888('0x5f')][_0x1888('0x40')];_0x483dc++){var _0xedaf55=_0x1df86e[_0x1888('0x5f')][_0x483dc];_0x5a72cb+='<div\x20style=\x22border-style:\x20solid;\x20border-width:\x201px;\x20margin:\x203px;\x22>';_0x5a72cb+=util[_0x1888('0x85')](_0x1888('0xc2'),_0xedaf55['User']?_0xedaf55[_0x1888('0x56')][_0x1888('0x58')]:_0xedaf55[_0x1888('0x59')][_0x1888('0xbb')],_0xedaf55['body']);_0x5a72cb+=_0x1888('0xc3');if(_0xedaf55[_0x1888('0x7d')]){var _0x18dda3=_0xedaf55[_0x1888('0x7d')];var _0x4a68f6=path['join'](_0x2142c7,_0x18dda3[_0x1888('0x81')]);if(fs['existsSync'](_0x4a68f6)){fs[_0x1888('0xc4')](_0x4a68f6)[_0x1888('0xc5')](fs[_0x1888('0xc6')](path[_0x1888('0x7f')](_0x5bf632,_0x18dda3[_0x1888('0x81')])));}}}return new BPromise(function(_0x285f4c,_0x57eca7){pdf[_0x1888('0x68')](_0x5a72cb,_0x1ca77a)['toFile'](path[_0x1888('0x7f')](_0x5bf632,_0x1888('0xc7')+_0x285c17+_0x1888('0xc8')),function(_0x1181e6,_0x42f49f){if(_0x1181e6)return _0x57eca7(_0x1181e6);_0x285f4c(_0x42f49f);});});}})[_0x1888('0x1e')](function(){if(_0x302b78){return new BPromise(function(_0x57885a,_0x22e924){zipdir(_0x5bf632,{'saveTo':_0x3041cf},function(_0x3ac816,_0x29029f){if(_0x3ac816)return _0x22e924(_0x3ac816);return _0x57885a(_0x29029f);});});}})[_0x1888('0x1e')](function(){if(_0x302b78){return new BPromise(function(_0x208045,_0xf6bb65){rimraf(_0x5bf632,function(_0x43ac4c){if(_0x43ac4c)_0xf6bb65(_0x43ac4c);return _0x208045();});});}})[_0x1888('0x1e')](function(){if(_0x302b78){return _0x2037a9['download'](_0x3041cf,_0x6e03ed,function(_0x33feeb){if(_0x33feeb){console[_0x1888('0xc9')](_0x1888('0xca'),_0x33feeb);}else{fs[_0x1888('0xcb')](_0x3041cf);}});}else{return _0x2037a9[_0x1888('0x29')](0xc8);}})[_0x1888('0x28')](handleError(_0x2037a9,null));};
\ No newline at end of file
+var _0x354b=['toFile','.pdf','log','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','sendStatus','name','send','index','ChatInteraction','rawAttributes','keys','filters','intersection','query','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','filter','where','merge','key','VIRTUAL','options','include','tag','push','Tag','Tags','distinct','read','ChatMessage','Messages','direction','createdAt','includeAll','User','Users','CmContact','Contact','Owner','fullname','internal','Account','color','findAll','catch','show','params','find','create','body','describe','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','type','mimetype','Attachment','findOne','Unauthorized','attachId','download','join','root','server/files/attachments/','basename','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','ChatWebsite','ChatWebsiteId','ContactId','%s%d','System','Visitor','agentIdentifier','website_alias','agentAlias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','secret','appendFileSync','MailServerOut','Smtp','service','host','secure','authentication','auth','user','SendMail','sendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','addMessage','ids','omit','getMessages','ChatInteractionId','map','$gte','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','pick','addTags','setTags','spread','emit','chatInteractionTags:save','removeTags','server','files','tmp','attachments','interaction-%s.zip','firstName','Letter','1cm','mkdirSync','<h1>Chat\x20Interaction:\x20#%d</h1>','MMMM\x20Do\x20YYYY,\x20HH:mm:ss','toString','<hr>','<div\x20style=\x22border-style:\x20solid;\x20border-width:\x201px;\x20margin:\x203px;\x22>','<p\x20style=\x22margin:\x203px;\x22>%s:\x20%s</p>','</div>','existsSync','createReadStream'];(function(_0x2b6ade,_0x20cf13){var _0x305747=function(_0x3a0716){while(--_0x3a0716){_0x2b6ade['push'](_0x2b6ade['shift']());}};_0x305747(++_0x20cf13);}(_0x354b,0x199));var _0xb354=function(_0x3efe65,_0x30e0ce){_0x3efe65=_0x3efe65-0x0;var _0x2a9745=_0x354b[_0x3efe65];return _0x2a9745;};'use strict';var pdf=require(_0xb354('0x0'));var emlformat=require(_0xb354('0x1'));var rimraf=require(_0xb354('0x2'));var zipdir=require(_0xb354('0x3'));var jsonpatch=require(_0xb354('0x4'));var rp=require(_0xb354('0x5'));var moment=require(_0xb354('0x6'));var BPromise=require(_0xb354('0x7'));var Mustache=require(_0xb354('0x8'));var util=require(_0xb354('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0xb354('0xa'));var ejs=require(_0xb354('0xb'));var fs=require('fs');var _=require(_0xb354('0xc'));var squel=require('squel');var crypto=require(_0xb354('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb354('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb354('0xf'));var Papa=require(_0xb354('0x10'));var authService=require('../../components/auth/service');var hardwareService=require(_0xb354('0x11'));var Redis=require(_0xb354('0x12'));var qs=require(_0xb354('0x13'));var logger=require('../../config/logger')(_0xb354('0x14'));var utils=require(_0xb354('0x15'));var config=require(_0xb354('0x16'));var db=require(_0xb354('0x17'))['db'];config['redis']=_[_0xb354('0x18')](config[_0xb354('0x19')],{'host':_0xb354('0x1a'),'port':0x18eb});var socket=require(_0xb354('0x1b'))(new Redis(config[_0xb354('0x19')]));require('./chatInteraction.socket')[_0xb354('0x1c')](socket);var jayson=require(_0xb354('0x1d'));var client=jayson['client'][_0xb354('0x1e')]({'port':0x232b});var client9004=jayson['client'][_0xb354('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x5efd26,_0x45b8a1,_0xe754bf,_0x18919f){return new BPromise(function(_0xbb8731,_0x4a2272){var _0x4771b3=_0x18919f||client;return _0x4771b3[_0xb354('0x1f')](_0x5efd26,_0xe754bf)['then'](function(_0x33c4d6){logger[_0xb354('0x20')](_0xb354('0x21'),_0x45b8a1,_0xb354('0x22'));logger[_0xb354('0x23')](_0xb354('0x24'),_0x45b8a1,_0xb354('0x22'),JSON[_0xb354('0x25')](_0x33c4d6));if(_0x33c4d6[_0xb354('0x26')]){if(_0x33c4d6[_0xb354('0x26')][_0xb354('0x27')]===0x1f4){logger[_0xb354('0x26')](_0xb354('0x21'),_0x45b8a1,_0x33c4d6[_0xb354('0x26')][_0xb354('0x28')]);return _0x4a2272(_0x33c4d6[_0xb354('0x26')][_0xb354('0x28')]);}logger[_0xb354('0x26')](_0xb354('0x21'),_0x45b8a1,_0x33c4d6[_0xb354('0x26')][_0xb354('0x28')]);return _0xbb8731(_0x33c4d6['error'][_0xb354('0x28')]);}else{logger[_0xb354('0x20')](_0xb354('0x21'),_0x45b8a1,_0xb354('0x22'));_0xbb8731(_0x33c4d6['result'][_0xb354('0x28')]);}})['catch'](function(_0x1fffb5){logger[_0xb354('0x26')](_0xb354('0x21'),_0x45b8a1,_0x1fffb5);_0x4a2272(_0x1fffb5);});});}function respondWithStatusCode(_0xf7d521,_0x47cb59){_0x47cb59=_0x47cb59||0xcc;return function(_0x540ec2){if(_0x540ec2){return _0xf7d521['sendStatus'](_0x47cb59);}return _0xf7d521[_0xb354('0x29')](_0x47cb59)[_0xb354('0x2a')]();};}function respondWithResult(_0x311331,_0x173cdc){_0x173cdc=_0x173cdc||0xc8;return function(_0x104d78){if(_0x104d78){return _0x311331[_0xb354('0x29')](_0x173cdc)[_0xb354('0x2b')](_0x104d78);}};}function respondWithFilteredResult(_0x2fe3d2,_0x4d9b14){return function(_0x597d89){if(_0x597d89){var _0x3b61ee=_0x597d89[_0xb354('0x2c')],_0x1e04d7=_0x4d9b14[_0xb354('0x2d')],_0x5cce7b=_0x4d9b14[_0xb354('0x2d')]+_0x4d9b14[_0xb354('0x2e')],_0x14f511;if(_0x5cce7b>=_0x3b61ee){_0x5cce7b=_0x3b61ee;_0x14f511=0xc8;}else{_0x14f511=0xce;}_0x2fe3d2[_0xb354('0x29')](_0x14f511);return _0x2fe3d2[_0xb354('0x2f')](_0xb354('0x30'),_0x1e04d7+'-'+_0x5cce7b+'/'+_0x3b61ee)[_0xb354('0x2b')](_0x597d89);}return null;};}function patchUpdates(_0x2f3f14){return function(_0x1ccd06){try{jsonpatch['apply'](_0x1ccd06,_0x2f3f14,!![]);}catch(_0x408ca1){return BPromise[_0xb354('0x31')](_0x408ca1);}return _0x1ccd06[_0xb354('0x32')]();};}function saveUpdates(_0x53a396,_0x520d98){return function(_0xa70d49){if(_0xa70d49){return _0xa70d49[_0xb354('0x33')](_0x53a396)['then'](function(_0x20b5e7){return _0x20b5e7;});}return null;};}function removeEntity(_0x52c39f,_0x265c6c){return function(_0x1672be){if(_0x1672be){return _0x1672be[_0xb354('0x34')]()[_0xb354('0x35')](function(){_0x52c39f[_0xb354('0x29')](0xcc)[_0xb354('0x2a')]();});}};}function handleEntityNotFound(_0x2c2a32,_0x2594d1){return function(_0x3c3bed){if(!_0x3c3bed){_0x2c2a32[_0xb354('0x36')](0x194);}return _0x3c3bed;};}function handleError(_0x208903,_0x3c65f9){_0x3c65f9=_0x3c65f9||0x1f4;return function(_0x35c0ee){logger[_0xb354('0x26')](_0x35c0ee['stack']);if(_0x35c0ee[_0xb354('0x37')]){delete _0x35c0ee['name'];}_0x208903[_0xb354('0x29')](_0x3c65f9)[_0xb354('0x38')](_0x35c0ee);};}exports[_0xb354('0x39')]=function(_0x48bbb1,_0x5b0b5a){var _0x52f885={},_0xbbd6ca={},_0x14b0f4={'count':0x0,'rows':[]};var _0x25d933=db[_0xb354('0x3a')][_0xb354('0x3b')];_0xbbd6ca['model']=_[_0xb354('0x3c')](_0x25d933);_0xbbd6ca['query']=_[_0xb354('0x3c')](_0x48bbb1['query']);_0xbbd6ca[_0xb354('0x3d')]=_[_0xb354('0x3e')](_0xbbd6ca['model'],_0xbbd6ca[_0xb354('0x3f')]);_0x52f885[_0xb354('0x40')]=_[_0xb354('0x3e')](_0xbbd6ca['model'],qs[_0xb354('0x41')](_0x48bbb1['query'][_0xb354('0x41')]));_0x52f885[_0xb354('0x40')]=_0x52f885[_0xb354('0x40')][_0xb354('0x42')]?_0x52f885['attributes']:_0xbbd6ca[_0xb354('0x43')];if(!_0x48bbb1[_0xb354('0x3f')][_0xb354('0x44')](_0xb354('0x45'))){_0x52f885[_0xb354('0x2e')]=qs[_0xb354('0x2e')](_0x48bbb1[_0xb354('0x3f')]['limit']);_0x52f885[_0xb354('0x2d')]=qs[_0xb354('0x2d')](_0x48bbb1[_0xb354('0x3f')][_0xb354('0x2d')]);}_0x52f885[_0xb354('0x46')]=qs[_0xb354('0x47')](_0x48bbb1[_0xb354('0x3f')]['sort']);_0x52f885['where']=qs['filters'](_['pick'](_0x48bbb1[_0xb354('0x3f')],_0xbbd6ca[_0xb354('0x3d')]));if(_0x48bbb1[_0xb354('0x3f')][_0xb354('0x48')]){_0x52f885[_0xb354('0x49')]=_[_0xb354('0x4a')](_0x52f885[_0xb354('0x49')],{'$or':_['map'](_0x25d933,function(_0x22a234){if(_0x22a234['type'][_0xb354('0x4b')]!==_0xb354('0x4c')){var _0x5bd4bb={};_0x5bd4bb[_0x22a234['field']]={'$like':'%'+_0x48bbb1[_0xb354('0x3f')][_0xb354('0x48')]+'%'};return _0x5bd4bb;}})});}_0x52f885=_['merge']({},_0x52f885,_0x48bbb1[_0xb354('0x4d')]);var _0x545548={'where':_0x52f885[_0xb354('0x49')]};_0x545548[_0xb354('0x4e')]=[];if(_0x48bbb1[_0xb354('0x3f')][_0xb354('0x4f')]){_0x545548[_0xb354('0x4e')][_0xb354('0x50')]({'model':db[_0xb354('0x51')],'as':_0xb354('0x52'),'attributes':['id'],'where':{'id':_0x48bbb1[_0xb354('0x3f')][_0xb354('0x4f')]},'required':!![]});_0x545548[_0xb354('0x53')]=!![];}if(_0x48bbb1[_0xb354('0x3f')][_0xb354('0x54')]){_0x545548['include'][_0xb354('0x50')]({'model':db[_0xb354('0x55')],'as':_0xb354('0x56'),'attributes':['id',_0xb354('0x57'),_0xb354('0x58'),'read'],'where':{'direction':'in','read':_0x48bbb1[_0xb354('0x3f')][_0xb354('0x54')]||![]},'required':!![]});_0x545548[_0xb354('0x53')]=!![];}return db['ChatInteraction'][_0xb354('0x2c')](_0x545548)[_0xb354('0x35')](function(_0x5b8fb2){_0x14b0f4[_0xb354('0x2c')]=_0x5b8fb2;if(_0x48bbb1['query'][_0xb354('0x59')]){_0x52f885[_0xb354('0x4e')]=[{'model':db[_0xb354('0x5a')],'as':_0xb354('0x5b'),'required':![],'attributes':['id',_0xb354('0x37'),'fullname']},{'model':db[_0xb354('0x5c')],'as':_0xb354('0x5d'),'required':![]},{'model':db[_0xb354('0x5a')],'as':_0xb354('0x5e'),'attributes':[_0xb354('0x37'),_0xb354('0x5f'),_0xb354('0x60')],'required':![]},{'model':db['ChatWebsite'],'as':_0xb354('0x61'),'attributes':[_0xb354('0x37'),_0xb354('0x4b')],'required':![]},{'model':db[_0xb354('0x55')],'as':'Messages','attributes':['id',_0xb354('0x57'),_0xb354('0x58'),_0xb354('0x54')],'where':{'direction':'in','read':_0x48bbb1[_0xb354('0x3f')][_0xb354('0x54')]||![]},'required':_0x48bbb1[_0xb354('0x3f')]['read']||![]},{'model':db[_0xb354('0x51')],'as':'Tags','attributes':['id',_0xb354('0x37'),_0xb354('0x62')],'required':_0x48bbb1[_0xb354('0x3f')][_0xb354('0x4f')]?!![]:![]},{'model':db[_0xb354('0x51')],'as':'ThroughTags','attributes':['id',_0xb354('0x37'),_0xb354('0x62')],'through':_0x48bbb1[_0xb354('0x3f')]['tag']?{'attributes':[],'where':{'TagId':_0x48bbb1[_0xb354('0x3f')][_0xb354('0x4f')]||undefined}}:{},'required':_0x48bbb1[_0xb354('0x3f')][_0xb354('0x4f')]?!![]:![]}];}return db[_0xb354('0x3a')][_0xb354('0x63')](_0x52f885);})[_0xb354('0x35')](function(_0xa85921){_0x14b0f4['rows']=_0xa85921;return _0x14b0f4;})[_0xb354('0x35')](respondWithFilteredResult(_0x5b0b5a,_0x52f885))[_0xb354('0x64')](handleError(_0x5b0b5a,null));};exports[_0xb354('0x65')]=function(_0x318619,_0x55eb76){var _0x4c392b={'raw':![],'where':{'id':_0x318619[_0xb354('0x66')]['id']}},_0x40ffb2={};_0x40ffb2[_0xb354('0x43')]=_[_0xb354('0x3c')](db[_0xb354('0x3a')]['rawAttributes']);_0x40ffb2[_0xb354('0x3f')]=_['keys'](_0x318619[_0xb354('0x3f')]);_0x40ffb2[_0xb354('0x3d')]=_[_0xb354('0x3e')](_0x40ffb2[_0xb354('0x43')],_0x40ffb2['query']);_0x4c392b[_0xb354('0x40')]=_['intersection'](_0x40ffb2[_0xb354('0x43')],qs['fields'](_0x318619[_0xb354('0x3f')][_0xb354('0x41')]));_0x4c392b['attributes']=_0x4c392b['attributes'][_0xb354('0x42')]?_0x4c392b[_0xb354('0x40')]:_0x40ffb2[_0xb354('0x43')];if(_0x318619['query'][_0xb354('0x59')]){_0x4c392b[_0xb354('0x4e')]=[{'all':!![]}];}_0x4c392b=_['merge']({},_0x4c392b,_0x318619['options']);return db['ChatInteraction'][_0xb354('0x67')](_0x4c392b)[_0xb354('0x35')](handleEntityNotFound(_0x55eb76,null))[_0xb354('0x35')](respondWithResult(_0x55eb76,null))[_0xb354('0x64')](handleError(_0x55eb76,null));};exports[_0xb354('0x68')]=function(_0x7431a2,_0x3d8e2b){return db[_0xb354('0x3a')]['create'](_0x7431a2[_0xb354('0x69')],{})['then'](respondWithResult(_0x3d8e2b,0xc9))['catch'](handleError(_0x3d8e2b,null));};exports[_0xb354('0x33')]=function(_0x19004b,_0x142a3b){if(_0x19004b[_0xb354('0x69')]['id']){delete _0x19004b['body']['id'];}return db[_0xb354('0x3a')][_0xb354('0x67')]({'where':{'id':_0x19004b['params']['id']}})[_0xb354('0x35')](handleEntityNotFound(_0x142a3b,null))[_0xb354('0x35')](saveUpdates(_0x19004b[_0xb354('0x69')],null))['then'](respondWithResult(_0x142a3b,null))[_0xb354('0x64')](handleError(_0x142a3b,null));};exports[_0xb354('0x34')]=function(_0x42168e,_0x508c12){return db[_0xb354('0x3a')][_0xb354('0x67')]({'where':{'id':_0x42168e[_0xb354('0x66')]['id']}})[_0xb354('0x35')](handleEntityNotFound(_0x508c12,null))[_0xb354('0x35')](removeEntity(_0x508c12,null))[_0xb354('0x64')](handleError(_0x508c12,null));};exports[_0xb354('0x6a')]=function(_0x579bd0,_0x97a9f5){return db[_0xb354('0x3a')]['describe']()[_0xb354('0x35')](respondWithResult(_0x97a9f5,null))[_0xb354('0x64')](handleError(_0x97a9f5,null));};exports[_0xb354('0x6b')]=function(_0x437dc5,_0x4b053f){if(_0x437dc5[_0xb354('0x69')]['id']){delete _0x437dc5[_0xb354('0x69')]['id'];}return db[_0xb354('0x3a')][_0xb354('0x67')]({'where':{'id':_0x437dc5[_0xb354('0x66')]['id']}})[_0xb354('0x35')](handleEntityNotFound(_0x4b053f,null))[_0xb354('0x35')](saveUpdates(_0x437dc5[_0xb354('0x69')],null))[_0xb354('0x35')](respondWithResult(_0x4b053f,null))[_0xb354('0x64')](handleError(_0x4b053f,null));};exports[_0xb354('0x6c')]=function(_0x181f97,_0x54ac0c,_0x521a75){if(_0x181f97[_0xb354('0x69')]['id']){delete _0x181f97['body']['id'];}return db[_0xb354('0x3a')][_0xb354('0x67')]({'where':{'id':_0x181f97['params']['id']}})[_0xb354('0x35')](function(_0x2e7a65){if(!_0x2e7a65){logger['error'](_0xb354('0x6d'),_0xb354('0x6c'),0x194,_0xb354('0x6e'));_0x54ac0c['sendStatus'](0x194);}else{if(_0x2e7a65[_0xb354('0x6f')]){throw new db['Sequelize']['ValidationError'](_0xb354('0x70'));}}return _0x2e7a65;})[_0xb354('0x35')](function(_0x56e1e4){if(_0x56e1e4){return _0x56e1e4[_0xb354('0x33')]({'closed':_0x181f97[_0xb354('0x69')][_0xb354('0x71')],'disposition':_0x181f97['body'][_0xb354('0x72')]})[_0xb354('0x35')](function(_0x3d259c){return _0x3d259c;});}})[_0xb354('0x35')](function(_0x11e73d){return respondWithRpcPromise(_0xb354('0x73'),_0xb354('0x6c'),_0x181f97['body'],client9004);})[_0xb354('0x35')](respondWithResult(_0x54ac0c,null))[_0xb354('0x64')](handleError(_0x54ac0c,null));};exports[_0xb354('0x74')]=function(_0x5bba2d,_0x1696ec,_0x132621){_0x5bba2d['body']['name']=_0x5bba2d[_0xb354('0x75')][_0xb354('0x76')];_0x5bba2d[_0xb354('0x69')]['basename']=_0x5bba2d[_0xb354('0x75')]['filename'];_0x5bba2d[_0xb354('0x69')][_0xb354('0x77')]=_0x5bba2d['file'][_0xb354('0x78')];return db[_0xb354('0x79')]['create'](_0x5bba2d[_0xb354('0x69')])[_0xb354('0x35')](respondWithResult(_0x1696ec,0xc9))['catch'](handleError(_0x1696ec,null));};exports['attachmentDownload']=function(_0x27b1e8,_0x6a6579,_0x1bfac8){return db[_0xb354('0x3a')][_0xb354('0x7a')]({'where':{'id':_0x27b1e8[_0xb354('0x66')]['id']},'raw':!![]})[_0xb354('0x35')](handleEntityNotFound(_0x6a6579,null))['then'](function(_0x187a2c){if(_0x187a2c){if(_0x187a2c[_0xb354('0x71')]){return _0x6a6579[_0xb354('0x29')](0x193)[_0xb354('0x2b')]({'status':0x193,'message':_0xb354('0x7b')});}return db[_0xb354('0x79')]['findOne']({'where':{'id':_0x27b1e8[_0xb354('0x3f')][_0xb354('0x7c')]},'raw':!![]})['then'](handleEntityNotFound(_0x6a6579,null));}})[_0xb354('0x35')](function(_0x57bd4a){if(_0x57bd4a){return _0x6a6579[_0xb354('0x7d')](path[_0xb354('0x7e')](config[_0xb354('0x7f')],_0xb354('0x80'),_0x57bd4a[_0xb354('0x81')]));}})[_0xb354('0x64')](handleError(_0x6a6579,null));};exports[_0xb354('0x82')]=function(_0x3f90f7,_0xb1bd22){var _0xbc767b=null;var _0x2aa06e=null;var _0x4b9236=null;var _0x6f0d85=null;if(_0x3f90f7[_0xb354('0x69')]['id']){delete _0x3f90f7[_0xb354('0x69')]['id'];}if(_0x3f90f7[_0xb354('0x69')][_0xb354('0x83')]){_0x6f0d85=path['join'](config[_0xb354('0x7f')],_0xb354('0x84'),util[_0xb354('0x85')](_0xb354('0x86'),Date[_0xb354('0x87')]()));_0x3f90f7[_0xb354('0x69')][_0xb354('0x88')]=_0x6f0d85;}return db['ChatInteraction'][_0xb354('0x67')]({'where':{'id':_0x3f90f7[_0xb354('0x66')]['id']},'include':[{'model':db[_0xb354('0x55')],'as':_0xb354('0x56'),'include':[{'model':db[_0xb354('0x5a')],'as':_0xb354('0x5a')}]}]})['then'](handleEntityNotFound(_0xb1bd22,null))[_0xb354('0x35')](saveUpdates(_0x3f90f7['body'],null))[_0xb354('0x35')](function(_0x5cc6a1){if(_0x5cc6a1){_0xbc767b=_0x5cc6a1;return db[_0xb354('0x89')][_0xb354('0x67')]({'where':{'id':_0xbc767b[_0xb354('0x8a')]}});}})['then'](function(_0x47a0d4){if(_0x47a0d4){_0x4b9236=_0x47a0d4;return db[_0xb354('0x5c')][_0xb354('0x67')]({'where':{'id':_0xbc767b[_0xb354('0x8b')]}});}})[_0xb354('0x35')](function(_0x2de41b){if(_0x2de41b){_0x2aa06e=_0x2de41b;if(_0x6f0d85){var _0x5d3f01=null;for(var _0x1ad037=0x1;_0x1ad037<_0xbc767b['Messages'][_0xb354('0x42')];++_0x1ad037){_0x5d3f01=_0xbc767b['Messages'][_0x1ad037];var _0x17771d=_0x5d3f01[_0xb354('0x6f')]?util['format'](_0xb354('0x8c'),_0x4b9236['agentAlias'],_0x5d3f01['UserId']):_0xb354('0x8d');var _0x354415=_0x3f90f7[_0xb354('0x69')]['customer']||util[_0xb354('0x85')](_0xb354('0x8c'),_0xb354('0x8e'),_0x5d3f01[_0xb354('0x8b')]);switch(_0x4b9236[_0xb354('0x8f')]){case _0xb354('0x90'):_0x17771d=_0x5d3f01[_0xb354('0x6f')]?util[_0xb354('0x85')](_0xb354('0x8c'),_0x4b9236[_0xb354('0x91')],_0x5d3f01['UserId']):_0xb354('0x8d');break;case _0xb354('0x92'):_0x17771d=_0x5d3f01[_0xb354('0x6f')]?_0x5d3f01[_0xb354('0x5a')][_0xb354('0x93')]||_0x5d3f01[_0xb354('0x5a')][_0xb354('0x5f')]:_0xb354('0x8d');break;case _0xb354('0x94'):_0x17771d=_0x5d3f01['UserId']?_0x5d3f01[_0xb354('0x5a')][_0xb354('0x5f')]:_0xb354('0x8d');break;default:_0x17771d=_0x5d3f01['UserId']?util[_0xb354('0x85')]('%s%d',_0x4b9236['agentAlias'],_0x5d3f01[_0xb354('0x6f')]):_0xb354('0x8d');}var _0x5c0660=util['format'](_0xb354('0x95'),moment(_0x5d3f01['createdAt'])[_0xb354('0x85')]('MM/DD/YYYY\x20HH:mm:ss'),_0x5d3f01[_0xb354('0x57')]==='in'?_0x354415:_0x17771d,_0x5d3f01['body']);if(!_0x5d3f01[_0xb354('0x96')]){fs[_0xb354('0x97')](_0x6f0d85,_0x5c0660);}}return db['MailAccount'][_0xb354('0x7a')]({'where':{'service':!![]},'include':[{'model':db[_0xb354('0x98')],'as':'Smtp','raw':!![]}]});}}})[_0xb354('0x35')](function(_0x57330a){if(_0x57330a&&_0x57330a[_0xb354('0x99')]&&_0x3f90f7[_0xb354('0x69')]){var _0x31485f={'tls':{'rejectUnauthorized':![]}};if(_0x57330a[_0xb354('0x99')][_0xb354('0x9a')]){_0x31485f[_0xb354('0x9a')]=_0x57330a[_0xb354('0x99')][_0xb354('0x9a')];}else{_0x31485f[_0xb354('0x9b')]=_0x57330a['Smtp'][_0xb354('0x9b')];_0x31485f['port']=_0x57330a[_0xb354('0x99')]['port'];_0x31485f['secure']=_0x57330a[_0xb354('0x99')][_0xb354('0x9c')];}if(_0x57330a[_0xb354('0x99')][_0xb354('0x9d')]){_0x31485f[_0xb354('0x9e')]={'user':_0x57330a[_0xb354('0x99')][_0xb354('0x9f')],'pass':_0x57330a[_0xb354('0x99')]['pass']};}return respondWithRpcPromise(_0xb354('0xa0'),_0xb354('0xa1'),{'account':_0x31485f,'message':{'from':util[_0xb354('0x85')](_0xb354('0xa2'),_0x57330a['name'],_0x57330a[_0xb354('0xa3')]||_0x57330a[_0xb354('0x99')][_0xb354('0x9f')]),'to':_0x3f90f7[_0xb354('0x69')]['mailTranscript'],'subject':_0xb354('0xa4'),'text':util[_0xb354('0x85')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x3f90f7[_0xb354('0x69')][_0xb354('0x83')]),'attachments':[{'path':_0x6f0d85}]}})[_0xb354('0x35')](function(){return _0xbc767b;})[_0xb354('0x64')](function(_0x4805fb){console[_0xb354('0x26')](_0x4805fb);});}else{return _0xbc767b;}})[_0xb354('0x35')](respondWithStatusCode(_0xb1bd22,0xc8))[_0xb354('0x64')](handleError(_0xb1bd22,null));};exports[_0xb354('0xa5')]=function(_0x56918d,_0x93e9fd,_0x4532d9){return db[_0xb354('0x55')][_0xb354('0x67')]({'where':{'id':_0x56918d[_0xb354('0x66')]['id']}})[_0xb354('0x35')](handleEntityNotFound(_0x93e9fd,null))[_0xb354('0x35')](function(_0x5e1ba3){if(_0x5e1ba3){return _0x5e1ba3[_0xb354('0xa5')](_0x56918d[_0xb354('0x69')][_0xb354('0xa6')],_[_0xb354('0xa7')](_0x56918d['body'],[_0xb354('0xa6'),'id'])||{});}})[_0xb354('0x35')](respondWithResult(_0x93e9fd,null))[_0xb354('0x64')](handleError(_0x93e9fd,null));};exports[_0xb354('0xa8')]=function(_0x449708,_0x2f9fbb,_0x4e06ee){var _0x433a6c={'raw':![],'where':{}};var _0x5a138c={};var _0x15f074={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xb354('0x7a')]({'where':{'id':_0x449708[_0xb354('0x66')]['id']}})[_0xb354('0x35')](handleEntityNotFound(_0x2f9fbb,null))[_0xb354('0x35')](function(_0x39adc7){if(_0x39adc7){_0x5a138c['model']=_[_0xb354('0x3c')](db[_0xb354('0x55')][_0xb354('0x3b')]);_0x5a138c[_0xb354('0x3f')]=_['keys'](_0x449708[_0xb354('0x3f')]);_0x5a138c[_0xb354('0x3d')]=_[_0xb354('0x3e')](_0x5a138c['model'],_0x5a138c[_0xb354('0x3f')]);_0x433a6c[_0xb354('0x40')]=_[_0xb354('0x3e')](_0x5a138c['model'],qs[_0xb354('0x41')](_0x449708[_0xb354('0x3f')][_0xb354('0x41')]));_0x433a6c[_0xb354('0x40')]=_0x433a6c[_0xb354('0x40')][_0xb354('0x42')]?_0x433a6c['attributes']:_0x5a138c[_0xb354('0x43')];if(!_0x449708[_0xb354('0x3f')][_0xb354('0x44')](_0xb354('0x45'))){_0x433a6c[_0xb354('0x2e')]=qs[_0xb354('0x2e')](_0x449708[_0xb354('0x3f')][_0xb354('0x2e')]);_0x433a6c['offset']=qs[_0xb354('0x2d')](_0x449708[_0xb354('0x3f')][_0xb354('0x2d')]);}_0x433a6c[_0xb354('0x46')]=qs[_0xb354('0x47')](_0x449708[_0xb354('0x3f')][_0xb354('0x47')]);_0x433a6c[_0xb354('0x49')]=qs['filters'](_['pick'](_0x449708[_0xb354('0x3f')],_0x5a138c[_0xb354('0x3d')]));_0x433a6c['where'][_0xb354('0xa9')]=_0x39adc7['id'];if(_0x449708[_0xb354('0x3f')][_0xb354('0x48')]){_0x433a6c[_0xb354('0x49')]=_['merge'](_0x433a6c[_0xb354('0x49')],{'$or':_[_0xb354('0xaa')](_0x433a6c[_0xb354('0x40')],function(_0x548749){var _0xf8b777={};_0xf8b777[_0x548749]={'$like':'%'+_0x449708[_0xb354('0x3f')][_0xb354('0x48')]+'%'};return _0xf8b777;})});}if(_0x449708[_0xb354('0x3f')]['$gte']){var _0x22c06e=_0x449708[_0xb354('0x3f')][_0xb354('0xab')]['split'](',');var _0x204070={};_0x204070[_0x22c06e[0x0]]={'$gte':moment(_0x22c06e[0x1])['format'](_0xb354('0xac'))};_0x433a6c[_0xb354('0x49')]=_[_0xb354('0x4a')](_0x433a6c[_0xb354('0x49')],_0x204070);}_0x433a6c=_[_0xb354('0x4a')]({},_0x433a6c,_0x449708[_0xb354('0x4d')]);return db[_0xb354('0x55')][_0xb354('0x2c')]({'where':_0x433a6c[_0xb354('0x49')]})[_0xb354('0x35')](function(_0x268211){_0x15f074[_0xb354('0x2c')]=_0x268211;if(_0x449708['query'][_0xb354('0x59')]){_0x433a6c[_0xb354('0x4e')]=[{'all':!![]}];}return db[_0xb354('0x55')]['findAll'](_0x433a6c);})['then'](function(_0x335851){_0x15f074[_0xb354('0xad')]=_0x335851;return _0x15f074;});}})[_0xb354('0x35')](respondWithFilteredResult(_0x2f9fbb,_0x433a6c))['catch'](handleError(_0x2f9fbb,null));};exports[_0xb354('0xae')]=function(_0x4a6509,_0x1d4d9a,_0x5ed562){var _0x5151bf={'where':{}},_0x1c1198={},_0x448b6c={'count':0x0,'rows':[]};return db[_0xb354('0x3a')]['findOne']({'where':{'id':_0x4a6509[_0xb354('0x66')]['id']}})[_0xb354('0x35')](handleEntityNotFound(_0x1d4d9a,null))[_0xb354('0x35')](function(_0x1c3121){if(_0x1c3121){_0x1c1198[_0xb354('0x43')]=_[_0xb354('0x3c')](db[_0xb354('0x55')][_0xb354('0x3b')]);_0x1c1198['query']=_[_0xb354('0x3c')](_0x4a6509['query']);_0x1c1198['filters']=_[_0xb354('0x3e')](_0x1c1198[_0xb354('0x43')],_0x1c1198[_0xb354('0x3f')]);_0x5151bf[_0xb354('0x40')]=_[_0xb354('0x3e')](_0x1c1198['model'],qs[_0xb354('0x41')](_0x4a6509[_0xb354('0x3f')][_0xb354('0x41')]));_0x5151bf[_0xb354('0x40')]=_0x5151bf[_0xb354('0x40')][_0xb354('0x42')]?_0x5151bf[_0xb354('0x40')]:_0x1c1198[_0xb354('0x43')];if(!_0x4a6509[_0xb354('0x3f')]['hasOwnProperty'](_0xb354('0x45'))){_0x5151bf[_0xb354('0x2e')]=qs['limit'](_0x4a6509[_0xb354('0x3f')]['limit']);_0x5151bf[_0xb354('0x2d')]=qs[_0xb354('0x2d')](_0x4a6509[_0xb354('0x3f')][_0xb354('0x2d')]);}_0x5151bf[_0xb354('0x46')]=qs['sort'](_0x4a6509[_0xb354('0x3f')][_0xb354('0x47')]);_0x5151bf[_0xb354('0x49')]=qs['filters'](_[_0xb354('0xaf')](_0x4a6509[_0xb354('0x3f')],_0x1c1198['filters']));_0x5151bf['where']['ChatInteractionId']=_0x1c3121['id'];if(_0x4a6509['query'][_0xb354('0x48')]){_0x5151bf[_0xb354('0x49')]=_[_0xb354('0x4a')](_0x5151bf[_0xb354('0x49')],{'$or':_[_0xb354('0xaa')](_0x5151bf[_0xb354('0x40')],function(_0x1cdda5){var _0x4d7faf={};_0x4d7faf[_0x1cdda5]={'$like':'%'+_0x4a6509[_0xb354('0x3f')][_0xb354('0x48')]+'%'};return _0x4d7faf;})});}_0x5151bf[_0xb354('0x49')]['secret']=![];if(_0x4a6509[_0xb354('0x3f')]['id']){_0x5151bf['where']['id']={'$gt':_0x4a6509[_0xb354('0x3f')]['id']};}_0x5151bf=_[_0xb354('0x4a')]({},_0x5151bf,_0x4a6509[_0xb354('0x4d')]);return db['ChatMessage']['count']({'where':_0x5151bf['where']})['then'](function(_0x423c49){_0x448b6c[_0xb354('0x2c')]=_0x423c49;_0x5151bf[_0xb354('0x4e')]=[];if(_0x4a6509['query']['includeAgent']){_0x5151bf[_0xb354('0x4e')]['push']({'model':db[_0xb354('0x5a')],'as':'User','attributes':['id',_0xb354('0x5f'),_0xb354('0x93')]});}if(_0x4a6509[_0xb354('0x3f')][_0xb354('0x59')]){_0x5151bf[_0xb354('0x4e')]=[{'all':!![]}];}return db[_0xb354('0x55')][_0xb354('0x63')](_0x5151bf);})[_0xb354('0x35')](function(_0x112c8d){_0x448b6c[_0xb354('0xad')]=_0x112c8d;return _0x448b6c;});}})[_0xb354('0x35')](respondWithFilteredResult(_0x1d4d9a,_0x5151bf))[_0xb354('0x64')](handleError(_0x1d4d9a,null));};exports[_0xb354('0xb0')]=function(_0x218760,_0x4555d2,_0x4caaca){return db[_0xb354('0x3a')][_0xb354('0x67')]({'where':{'id':_0x218760['params']['id']}})[_0xb354('0x35')](handleEntityNotFound(_0x4555d2,null))[_0xb354('0x35')](function(_0x4722be){if(_0x4722be){return _0x4722be[_0xb354('0xb1')](_0x218760[_0xb354('0x69')][_0xb354('0xa6')],_[_0xb354('0xa7')](_0x218760[_0xb354('0x69')],['ids','id'])||{})[_0xb354('0xb2')](function(){return db[_0xb354('0x51')]['findAll']({'attributes':['id',_0xb354('0x37'),_0xb354('0x62')],'where':{'id':_0x218760[_0xb354('0x69')][_0xb354('0xa6')]}});})[_0xb354('0x35')](function(_0x43f7d1){socket[_0xb354('0xb3')](_0xb354('0xb4'),{'id':Number(_0x218760[_0xb354('0x66')]['id']),'tags':_0x43f7d1||[]});return{'id':Number(_0x218760[_0xb354('0x66')]['id']),'tags':_0x43f7d1||[]};});}})[_0xb354('0x35')](respondWithResult(_0x4555d2,null))[_0xb354('0x64')](handleError(_0x4555d2,null));};exports[_0xb354('0xb5')]=function(_0x2e3630,_0x39a637,_0x5c545c){var _0x417d59;return db[_0xb354('0x3a')][_0xb354('0x67')]({'where':{'id':_0x2e3630[_0xb354('0x66')]['id']}})['then'](handleEntityNotFound(_0x39a637,null))[_0xb354('0x35')](function(_0x3c7e20){if(_0x3c7e20){return _0x3c7e20['removeTags'](_0x2e3630['query'][_0xb354('0xa6')]);}})[_0xb354('0x35')](respondWithStatusCode(_0x39a637,null))[_0xb354('0x64')](handleError(_0x39a637,null));};exports['download']=function(_0x332741,_0x303af7){var _0x9b77ce=moment()['unix']()['toString']();var _0x22a5ac=path['join'](config['root'],_0xb354('0xb6'),_0xb354('0xb7'),_0xb354('0xb8'));var _0x4c8f19=path[_0xb354('0x7e')](config[_0xb354('0x7f')],_0xb354('0xb6'),'files',_0xb354('0xb9'));var _0x41f359=path[_0xb354('0x7e')](_0x22a5ac,_0x9b77ce);var _0x33ce57=util[_0xb354('0x85')](_0xb354('0xba'),_0x9b77ce);var _0x394a95=path[_0xb354('0x7e')](_0x22a5ac,_0x33ce57);var _0x309a7d=![];return db['ChatInteraction'][_0xb354('0x67')]({'where':{'id':_0x332741[_0xb354('0x66')]['id']},'include':[{'model':db[_0xb354('0x55')],'as':_0xb354('0x56'),'attributes':['id','body'],'include':[{'model':db[_0xb354('0x5a')],'as':_0xb354('0x5a'),'attributes':['id','fullname'],'raw':!![]},{'model':db[_0xb354('0x5c')],'as':_0xb354('0x5d'),'attributes':['id',_0xb354('0xbb')],'raw':!![]},{'model':db[_0xb354('0x79')],'as':_0xb354('0x79'),'raw':!![]}]}]})[_0xb354('0x35')](handleEntityNotFound(_0x303af7,null))[_0xb354('0x35')](function(_0x4c1b8f){if(_0x4c1b8f){_0x309a7d=!![];var _0x166881='';var _0x61b054={'format':_0xb354('0xbc'),'border':_0xb354('0xbd')};fs[_0xb354('0xbe')](_0x41f359);_0x166881+=util[_0xb354('0x85')](_0xb354('0xbf'),_0x4c1b8f['id']);_0x166881+=util[_0xb354('0x85')]('<h2>Date:\x20%s</h2>',moment()[_0xb354('0x85')](_0xb354('0xc0'))[_0xb354('0xc1')]());_0x166881+=_0xb354('0xc2');for(var _0x33091c=0x1;_0x33091c<_0x4c1b8f[_0xb354('0x56')][_0xb354('0x42')];_0x33091c++){var _0x43b4b1=_0x4c1b8f['Messages'][_0x33091c];_0x166881+=_0xb354('0xc3');_0x166881+=util[_0xb354('0x85')](_0xb354('0xc4'),_0x43b4b1[_0xb354('0x5a')]?_0x43b4b1[_0xb354('0x5a')][_0xb354('0x5f')]:_0x43b4b1[_0xb354('0x5d')][_0xb354('0xbb')],_0x43b4b1['body']);_0x166881+=_0xb354('0xc5');if(_0x43b4b1[_0xb354('0x79')]){var _0x4a87b3=_0x43b4b1[_0xb354('0x79')];var _0x587bd5=path['join'](_0x4c8f19,_0x4a87b3[_0xb354('0x81')]);if(fs[_0xb354('0xc6')](_0x587bd5)){fs[_0xb354('0xc7')](_0x587bd5)['pipe'](fs['createWriteStream'](path[_0xb354('0x7e')](_0x41f359,_0x4a87b3['basename'])));}}}return new BPromise(function(_0x111597,_0x4cd1ca){pdf[_0xb354('0x68')](_0x166881,_0x61b054)[_0xb354('0xc8')](path[_0xb354('0x7e')](_0x41f359,'interaction-'+_0x9b77ce+_0xb354('0xc9')),function(_0x2d3786,_0x44a265){if(_0x2d3786)return _0x4cd1ca(_0x2d3786);_0x111597(_0x44a265);});});}})[_0xb354('0x35')](function(){if(_0x309a7d){return new BPromise(function(_0x1b5901,_0x2169ff){zipdir(_0x41f359,{'saveTo':_0x394a95},function(_0x42f80e,_0xae9272){if(_0x42f80e)return _0x2169ff(_0x42f80e);return _0x1b5901(_0xae9272);});});}})[_0xb354('0x35')](function(){if(_0x309a7d){return new BPromise(function(_0x348f6d,_0x2bb3eb){rimraf(_0x41f359,function(_0x137d7c){if(_0x137d7c)_0x2bb3eb(_0x137d7c);return _0x348f6d();});});}})[_0xb354('0x35')](function(){if(_0x309a7d){return _0x303af7[_0xb354('0x7d')](_0x394a95,_0x33ce57,function(_0x2c936d){if(_0x2c936d){console[_0xb354('0xca')]('err',_0x2c936d);}else{fs['unlinkSync'](_0x394a95);}});}else{return _0x303af7['sendStatus'](0xc8);}})['catch'](handleError(_0x303af7,null));};
\ No newline at end of file
index 6b48d81..588af66 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3920=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','setMaxListeners'];(function(_0x3ce0a4,_0x13d49b){var _0x4e8fdc=function(_0xf4b9ab){while(--_0xf4b9ab){_0x3ce0a4['push'](_0x3ce0a4['shift']());}};_0x4e8fdc(++_0x13d49b);}(_0x3920,0x1eb));var _0x0392=function(_0x2ae7c8,_0x168ef7){_0x2ae7c8=_0x2ae7c8-0x0;var _0x47d7cf=_0x3920[_0x2ae7c8];return _0x47d7cf;};'use strict';var EventEmitter=require(_0x0392('0x0'));var ChatInteraction=require(_0x0392('0x1'))['db'][_0x0392('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x0392('0x3')](0x0);var events={'afterCreate':_0x0392('0x4'),'afterUpdate':_0x0392('0x5'),'afterDestroy':_0x0392('0x6')};function emitEvent(_0x50041f){return function(_0x5b7496,_0x26dda9,_0x275b20){ChatInteractionEvents[_0x0392('0x7')](_0x50041f+':'+_0x5b7496['id'],_0x5b7496);ChatInteractionEvents[_0x0392('0x7')](_0x50041f,_0x5b7496);_0x275b20(null);};}for(var e in events){if(events[_0x0392('0x8')](e)){var event=events[e];ChatInteraction[_0x0392('0x9')](e,emitEvent(event));}}module[_0x0392('0xa')]=ChatInteractionEvents;
\ No newline at end of file
+var _0xe4d2=['hasOwnProperty','exports','../../mysqldb','ChatInteraction','setMaxListeners','save','update','emit'];(function(_0x2b91c5,_0x3b6db5){var _0xbd5531=function(_0x54783d){while(--_0x54783d){_0x2b91c5['push'](_0x2b91c5['shift']());}};_0xbd5531(++_0x3b6db5);}(_0xe4d2,0xca));var _0x2e4d=function(_0x210b93,_0x133e6d){_0x210b93=_0x210b93-0x0;var _0x2b020f=_0xe4d2[_0x210b93];return _0x2b020f;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x2e4d('0x0'))['db'][_0x2e4d('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x2e4d('0x2')](0x0);var events={'afterCreate':_0x2e4d('0x3'),'afterUpdate':_0x2e4d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3ae317){return function(_0x350ed3,_0x4b0cd7,_0x584650){ChatInteractionEvents[_0x2e4d('0x5')](_0x3ae317+':'+_0x350ed3['id'],_0x350ed3);ChatInteractionEvents[_0x2e4d('0x5')](_0x3ae317,_0x350ed3);_0x584650(null);};}for(var e in events){if(events[_0x2e4d('0x6')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x2e4d('0x7')]=ChatInteractionEvents;
\ No newline at end of file
index 81e7a6e..d836e43 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb265=['bluebird','request-promise','exports','define','chat_interactions','utf8mb4','util','../../config/logger','api'];(function(_0x44d382,_0x2e724b){var _0xa97b01=function(_0x502173){while(--_0x502173){_0x44d382['push'](_0x44d382['shift']());}};_0xa97b01(++_0x2e724b);}(_0xb265,0x165));var _0x5b26=function(_0x5ef9d2,_0x16db81){_0x5ef9d2=_0x5ef9d2-0x0;var _0x493486=_0xb265[_0x5ef9d2];return _0x493486;};'use strict';var _=require('lodash');var util=require(_0x5b26('0x0'));var logger=require(_0x5b26('0x1'))(_0x5b26('0x2'));var moment=require('moment');var BPromise=require(_0x5b26('0x3'));var rp=require(_0x5b26('0x4'));var attributes=require('./chatInteraction.attributes');module[_0x5b26('0x5')]=function(_0x3ef45a,_0x423210){return _0x3ef45a[_0x5b26('0x6')]('ChatInteraction',attributes,{'tableName':_0x5b26('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5b26('0x8'),'collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file
+var _0xfc0a=['changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','moment','bluebird','request-promise','exports','define','ChatInteraction','chat_interactions'];(function(_0x27ed05,_0x921046){var _0x571279=function(_0x3b0519){while(--_0x3b0519){_0x27ed05['push'](_0x27ed05['shift']());}};_0x571279(++_0x921046);}(_0xfc0a,0xc3));var _0xafc0=function(_0x47e934,_0x11d22f){_0x47e934=_0x47e934-0x0;var _0x2088eb=_0xfc0a[_0x47e934];return _0x2088eb;};'use strict';var _=require(_0xafc0('0x0'));var util=require('util');var logger=require(_0xafc0('0x1'))('api');var moment=require(_0xafc0('0x2'));var BPromise=require(_0xafc0('0x3'));var rp=require(_0xafc0('0x4'));var attributes=require('./chatInteraction.attributes');module[_0xafc0('0x5')]=function(_0xbd80d7,_0x46d867){return _0xbd80d7[_0xafc0('0x6')](_0xafc0('0x7'),attributes,{'tableName':_0xafc0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1d2c2c,_0x6c78bb,_0x49de6e){if(_0x1d2c2c[_0xafc0('0x9')]('closed')){_0x1d2c2c[_0xafc0('0xa')]=moment()['format'](_0xafc0('0xb'));}_0x49de6e(null,_0x1d2c2c);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file
index d26a0fb..79ce319 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x23a8=['error','code','message','result','UpdateChatInteraction','ChatInteraction','update','options','raw','where','attributes','limit','debug','catch','AddTagsToChatInteraction','find','body','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2aa927,_0x1b8901){var _0x4ac3b0=function(_0x5c8012){while(--_0x5c8012){_0x2aa927['push'](_0x2aa927['shift']());}};_0x4ac3b0(++_0x1b8901);}(_0x23a8,0x6a));var _0x823a=function(_0xad4c9a,_0x4e0e47){_0xad4c9a=_0xad4c9a-0x0;var _0x1bb983=_0x23a8[_0xad4c9a];return _0x1bb983;};'use strict';var _=require(_0x823a('0x0'));var util=require(_0x823a('0x1'));var moment=require(_0x823a('0x2'));var BPromise=require(_0x823a('0x3'));var rs=require(_0x823a('0x4'));var fs=require('fs');var Redis=require(_0x823a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x823a('0x6'));var logger=require(_0x823a('0x7'))(_0x823a('0x8'));var config=require('../../config/environment');var jayson=require(_0x823a('0x9'));var client=jayson[_0x823a('0xa')][_0x823a('0xb')]({'port':0x232a});config[_0x823a('0xc')]=_[_0x823a('0xd')](config[_0x823a('0xc')],{'host':_0x823a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x823a('0xc')]));require(_0x823a('0xf'))[_0x823a('0x10')](socket);function respondWithRpcPromise(_0x13d63c,_0x9cd4d,_0x301726){return new BPromise(function(_0xbf0b6c,_0x2ecc40){return client['request'](_0x13d63c,_0x301726)[_0x823a('0x11')](function(_0x503d5d){logger[_0x823a('0x12')](_0x823a('0x13'),_0x9cd4d,_0x823a('0x14'));logger['debug'](_0x823a('0x15'),_0x9cd4d,_0x823a('0x14'),JSON[_0x823a('0x16')](_0x503d5d));if(_0x503d5d[_0x823a('0x17')]){if(_0x503d5d[_0x823a('0x17')][_0x823a('0x18')]===0x1f4){logger[_0x823a('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x9cd4d,_0x503d5d[_0x823a('0x17')][_0x823a('0x19')]);return _0x2ecc40(_0x503d5d[_0x823a('0x17')]['message']);}logger[_0x823a('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x9cd4d,_0x503d5d['error'][_0x823a('0x19')]);return _0xbf0b6c(_0x503d5d[_0x823a('0x17')][_0x823a('0x19')]);}else{logger[_0x823a('0x12')](_0x823a('0x13'),_0x9cd4d,_0x823a('0x14'));_0xbf0b6c(_0x503d5d[_0x823a('0x1a')][_0x823a('0x19')]);}})['catch'](function(_0x7fcef3){logger[_0x823a('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x9cd4d,_0x7fcef3);_0x2ecc40(_0x7fcef3);});});}exports[_0x823a('0x1b')]=function(_0x2cd46c){var _0x3d6786=this;return new Promise(function(_0x2145e1,_0x22d4af){return db[_0x823a('0x1c')][_0x823a('0x1d')](_0x2cd46c['body'],{'raw':_0x2cd46c[_0x823a('0x1e')]?_0x2cd46c['options'][_0x823a('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cd46c[_0x823a('0x1e')]?_0x2cd46c['options'][_0x823a('0x20')]||null:null,'attributes':_0x2cd46c['options']?_0x2cd46c[_0x823a('0x1e')][_0x823a('0x21')]||null:null,'limit':_0x2cd46c[_0x823a('0x1e')]?_0x2cd46c[_0x823a('0x1e')][_0x823a('0x22')]||null:null})[_0x823a('0x11')](function(_0x469b66){logger[_0x823a('0x12')](_0x823a('0x1b'),_0x2cd46c);logger[_0x823a('0x23')](_0x823a('0x1b'),_0x2cd46c,JSON['stringify'](_0x469b66));_0x2145e1(_0x469b66);})[_0x823a('0x24')](function(_0x43d932){logger[_0x823a('0x17')](_0x823a('0x1b'),_0x43d932[_0x823a('0x19')],_0x2cd46c);_0x22d4af(_0x3d6786[_0x823a('0x17')](0x1f4,_0x43d932[_0x823a('0x19')]));});});};exports[_0x823a('0x25')]=function(_0x42ba09){return new Promise(function(_0x35de12,_0x4db853){return db[_0x823a('0x1c')][_0x823a('0x26')]({'where':_0x42ba09[_0x823a('0x1e')]?_0x42ba09['options'][_0x823a('0x20')]||null:null})['then'](function(_0x148354){if(_0x148354){return _0x148354['addTags'](_0x42ba09[_0x823a('0x27')][_0x823a('0x28')],_[_0x823a('0x29')](_0x42ba09['body'],[_0x823a('0x28'),'id'])||{});}})['spread'](function(_0x4c7811){logger[_0x823a('0x12')]('AddTags',_0x42ba09);logger[_0x823a('0x23')](_0x823a('0x2a'),_0x42ba09,JSON[_0x823a('0x16')](_0x4c7811));_0x35de12(_0x4c7811);})[_0x823a('0x24')](function(_0x59d5f1){logger[_0x823a('0x17')](_0x823a('0x2a'),_0x59d5f1[_0x823a('0x19')],_0x42ba09);_0x4db853(_this[_0x823a('0x17')](0x1f4,_0x59d5f1[_0x823a('0x19')]));});});};
\ No newline at end of file
+var _0x47f2=['catch','UpdateChatInteraction','ChatInteraction','options','limit','AddTagsToChatInteraction','find','where','addTags','body','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x4a35b2,_0x3af01f){var _0x362dc5=function(_0x31ef11){while(--_0x31ef11){_0x4a35b2['push'](_0x4a35b2['shift']());}};_0x362dc5(++_0x3af01f);}(_0x47f2,0x1c6));var _0x247f=function(_0x4dffc3,_0x294424){_0x4dffc3=_0x4dffc3-0x0;var _0x460d46=_0x47f2[_0x4dffc3];return _0x460d46;};'use strict';var _=require('lodash');var util=require(_0x247f('0x0'));var moment=require(_0x247f('0x1'));var BPromise=require(_0x247f('0x2'));var rs=require(_0x247f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x247f('0x4'))['db'];var utils=require(_0x247f('0x5'));var logger=require(_0x247f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x247f('0x7'));var client=jayson[_0x247f('0x8')][_0x247f('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x247f('0xa')],{'host':_0x247f('0xb'),'port':0x18eb});var socket=require(_0x247f('0xc'))(new Redis(config[_0x247f('0xa')]));require('./chatInteraction.socket')[_0x247f('0xd')](socket);function respondWithRpcPromise(_0xa2b2e0,_0x503a9a,_0x56c51d){return new BPromise(function(_0x986fbe,_0xf6d077){return client[_0x247f('0xe')](_0xa2b2e0,_0x56c51d)[_0x247f('0xf')](function(_0x4f689f){logger[_0x247f('0x10')](_0x247f('0x11'),_0x503a9a,_0x247f('0x12'));logger[_0x247f('0x13')](_0x247f('0x14'),_0x503a9a,_0x247f('0x12'),JSON[_0x247f('0x15')](_0x4f689f));if(_0x4f689f['error']){if(_0x4f689f[_0x247f('0x16')][_0x247f('0x17')]===0x1f4){logger['error'](_0x247f('0x11'),_0x503a9a,_0x4f689f['error'][_0x247f('0x18')]);return _0xf6d077(_0x4f689f[_0x247f('0x16')]['message']);}logger['error'](_0x247f('0x11'),_0x503a9a,_0x4f689f[_0x247f('0x16')]['message']);return _0x986fbe(_0x4f689f[_0x247f('0x16')]['message']);}else{logger[_0x247f('0x10')](_0x247f('0x11'),_0x503a9a,_0x247f('0x12'));_0x986fbe(_0x4f689f[_0x247f('0x19')][_0x247f('0x18')]);}})[_0x247f('0x1a')](function(_0x4ac237){logger[_0x247f('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x503a9a,_0x4ac237);_0xf6d077(_0x4ac237);});});}exports[_0x247f('0x1b')]=function(_0x44ed12){var _0x5b7442=this;return new Promise(function(_0x3c4911,_0x15ec9b){return db[_0x247f('0x1c')]['update'](_0x44ed12['body'],{'raw':_0x44ed12[_0x247f('0x1d')]?_0x44ed12[_0x247f('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44ed12[_0x247f('0x1d')]?_0x44ed12[_0x247f('0x1d')]['where']||null:null,'attributes':_0x44ed12[_0x247f('0x1d')]?_0x44ed12[_0x247f('0x1d')]['attributes']||null:null,'limit':_0x44ed12[_0x247f('0x1d')]?_0x44ed12[_0x247f('0x1d')][_0x247f('0x1e')]||null:null})[_0x247f('0xf')](function(_0x501ed8){logger[_0x247f('0x10')](_0x247f('0x1b'),_0x44ed12);logger[_0x247f('0x13')]('UpdateChatInteraction',_0x44ed12,JSON[_0x247f('0x15')](_0x501ed8));_0x3c4911(_0x501ed8);})[_0x247f('0x1a')](function(_0x28f4b1){logger[_0x247f('0x16')](_0x247f('0x1b'),_0x28f4b1[_0x247f('0x18')],_0x44ed12);_0x15ec9b(_0x5b7442['error'](0x1f4,_0x28f4b1[_0x247f('0x18')]));});});};exports[_0x247f('0x1f')]=function(_0x3b55af){return new Promise(function(_0x13895f,_0x255a51){return db['ChatInteraction'][_0x247f('0x20')]({'where':_0x3b55af[_0x247f('0x1d')]?_0x3b55af[_0x247f('0x1d')][_0x247f('0x21')]||null:null})['then'](function(_0x3ea9e4){if(_0x3ea9e4){return _0x3ea9e4[_0x247f('0x22')](_0x3b55af[_0x247f('0x23')][_0x247f('0x24')],_[_0x247f('0x25')](_0x3b55af[_0x247f('0x23')],[_0x247f('0x24'),'id'])||{});}})[_0x247f('0x26')](function(_0x562ef3){logger[_0x247f('0x10')](_0x247f('0x27'),_0x3b55af);logger['debug'](_0x247f('0x27'),_0x3b55af,JSON[_0x247f('0x15')](_0x562ef3));_0x13895f(_0x562ef3);})[_0x247f('0x1a')](function(_0x219627){logger[_0x247f('0x16')](_0x247f('0x27'),_0x219627['message'],_0x3b55af);_0x255a51(_this[_0x247f('0x16')](0x1f4,_0x219627['message']));});});};
\ No newline at end of file
index 64b0600..7557c87 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdec5=['emit','removeListener','register','length','./chatInteraction.events','remove','update'];(function(_0x3718b7,_0x2da677){var _0xf8c91e=function(_0x2519b4){while(--_0x2519b4){_0x3718b7['push'](_0x3718b7['shift']());}};_0xf8c91e(++_0x2da677);}(_0xdec5,0xeb));var _0x5dec=function(_0x1bd28d,_0x30b6b5){_0x1bd28d=_0x1bd28d-0x0;var _0x1a5e11=_0xdec5[_0x1bd28d];return _0x1a5e11;};'use strict';var ChatInteractionEvents=require(_0x5dec('0x0'));var events=['save',_0x5dec('0x1'),_0x5dec('0x2')];function createListener(_0x4b664d,_0x12ffd7){return function(_0x21afc6){_0x12ffd7[_0x5dec('0x3')](_0x4b664d,_0x21afc6);};}function removeListener(_0x401693,_0x4d89a6){return function(){ChatInteractionEvents[_0x5dec('0x4')](_0x401693,_0x4d89a6);};}exports[_0x5dec('0x5')]=function(_0x277459){for(var _0x5c7092=0x0,_0x190d8c=events[_0x5dec('0x6')];_0x5c7092<_0x190d8c;_0x5c7092++){var _0x288ee7=events[_0x5c7092];var _0xd95738=createListener('chatInteraction:'+_0x288ee7,_0x277459);ChatInteractionEvents['on'](_0x288ee7,_0xd95738);}};
\ No newline at end of file
+var _0x3bb7=['chatInteraction:','remove','update','emit','removeListener','length'];(function(_0x44b92d,_0x4dbba6){var _0x4db8f5=function(_0x4d64d3){while(--_0x4d64d3){_0x44b92d['push'](_0x44b92d['shift']());}};_0x4db8f5(++_0x4dbba6);}(_0x3bb7,0x157));var _0x73bb=function(_0x3a3525,_0x5bee02){_0x3a3525=_0x3a3525-0x0;var _0x56e306=_0x3bb7[_0x3a3525];return _0x56e306;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0x73bb('0x0'),_0x73bb('0x1')];function createListener(_0x578f12,_0x265ddb){return function(_0x2b8bd1){_0x265ddb[_0x73bb('0x2')](_0x578f12,_0x2b8bd1);};}function removeListener(_0x58b31c,_0x3c1432){return function(){ChatInteractionEvents[_0x73bb('0x3')](_0x58b31c,_0x3c1432);};}exports['register']=function(_0x374e58){for(var _0x1e7e8b=0x0,_0x47e26b=events[_0x73bb('0x4')];_0x1e7e8b<_0x47e26b;_0x1e7e8b++){var _0x28b89f=events[_0x1e7e8b];var _0x2bfe65=createListener(_0x73bb('0x5')+_0x28b89f,_0x374e58);ChatInteractionEvents['on'](_0x28b89f,_0x2bfe65);}};
\ No newline at end of file
index 8b52e05..f976293 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4b17=['/:id/attachment_upload','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chat','addTags','chatinteraction:update','update','put','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','removeTags','exports','multer','path','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','download','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','post'];(function(_0x449f49,_0x1ae5dd){var _0x3d6197=function(_0xf684e3){while(--_0xf684e3){_0x449f49['push'](_0x449f49['shift']());}};_0x3d6197(++_0x1ae5dd);}(_0x4b17,0x10f));var _0x74b1=function(_0x2ff739,_0x1c8e0f){_0x2ff739=_0x2ff739-0x0;var _0x12dc13=_0x4b17[_0x2ff739];return _0x12dc13;};'use strict';var multer=require(_0x74b1('0x0'));var util=require('util');var path=require(_0x74b1('0x1'));var timeout=require('connect-timeout');var express=require(_0x74b1('0x2'));var router=express[_0x74b1('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x74b1('0x4'));var config=require('../../config/environment');var controller=require('./chatInteraction.controller');router[_0x74b1('0x5')]('/',auth[_0x74b1('0x6')](),controller[_0x74b1('0x7')]);router[_0x74b1('0x5')](_0x74b1('0x8'),auth[_0x74b1('0x6')](),controller[_0x74b1('0x9')]);router['get'](_0x74b1('0xa'),auth[_0x74b1('0xb')](),controller[_0x74b1('0xc')]);router[_0x74b1('0x5')](_0x74b1('0xd'),auth['isChatInteractionAuthorized'](),controller[_0x74b1('0xe')]);router[_0x74b1('0x5')]('/:id/messages',auth[_0x74b1('0x6')](),controller[_0x74b1('0xf')]);router[_0x74b1('0x5')](_0x74b1('0x10'),auth['isChatInteractionAuthorized'](),controller[_0x74b1('0x11')]);router['get']('/:id/download',auth[_0x74b1('0x6')](),controller[_0x74b1('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);var upload=multer({'storage':multer[_0x74b1('0x13')]({'destination':function(_0x5c12eb,_0x4e289b,_0x2ccba6){_0x2ccba6(null,path[_0x74b1('0x14')](config[_0x74b1('0x15')],_0x74b1('0x16')));},'filename':function(_0x16b147,_0x10138e,_0x528e8c){_0x528e8c(null,util[_0x74b1('0x17')](_0x74b1('0x18'),Date[_0x74b1('0x19')](),_0x10138e[_0x74b1('0x1a')][_0x74b1('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x74b1('0x1c')](_0x74b1('0x1d'),upload['single'](_0x74b1('0x1e')),controller[_0x74b1('0x1f')]);router['post'](_0x74b1('0x20'),auth[_0x74b1('0xb')](),controller[_0x74b1('0x21')]);router[_0x74b1('0x1c')](_0x74b1('0x22'),auth[_0x74b1('0x6')](),interaction[_0x74b1('0x23')](_0x74b1('0x24'),'chatinteraction:addtags'),controller[_0x74b1('0x25')]);router['put']('/:id',auth['isAuthenticated'](),interaction[_0x74b1('0x23')](_0x74b1('0x24'),_0x74b1('0x26')),controller[_0x74b1('0x27')]);router[_0x74b1('0x28')]('/:id/custom_update',controller[_0x74b1('0x29')]);router['put'](_0x74b1('0x2a'),auth[_0x74b1('0xb')](),controller[_0x74b1('0x2b')]);router[_0x74b1('0x28')](_0x74b1('0x2c'),controller[_0x74b1('0x2d')]);router[_0x74b1('0x2e')](_0x74b1('0xa'),auth['isAuthenticated'](),interaction[_0x74b1('0x23')](_0x74b1('0x24'),_0x74b1('0x2f')),controller['destroy']);router[_0x74b1('0x2e')](_0x74b1('0x22'),auth[_0x74b1('0x6')](),controller[_0x74b1('0x30')]);module[_0x74b1('0x31')]=router;
\ No newline at end of file
+var _0x056b=['create','diskStorage','join','server/files/attachments/','%s-%s','originalname','replace','/:id/attachment_upload','file','attachmentUpload','addMessage','post','/:id/tags','chat','addTags','tracked','chatinteraction:update','update','/:id/custom_update','customUpdate','put','/:id/abandon','abandon','close','delete','chatinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/describe','describe','/:id','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','download'];(function(_0x46279d,_0x42576c){var _0x2f4b7b=function(_0x7bd04f){while(--_0x7bd04f){_0x46279d['push'](_0x46279d['shift']());}};_0x2f4b7b(++_0x42576c);}(_0x056b,0xb6));var _0xb056=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x056b[_0xf0bcac];return _0x4e4c65;};'use strict';var multer=require('multer');var util=require(_0xb056('0x0'));var path=require(_0xb056('0x1'));var timeout=require(_0xb056('0x2'));var express=require(_0xb056('0x3'));var router=express[_0xb056('0x4')]();var auth=require(_0xb056('0x5'));var interaction=require(_0xb056('0x6'));var config=require(_0xb056('0x7'));var controller=require(_0xb056('0x8'));router[_0xb056('0x9')]('/',auth[_0xb056('0xa')](),controller['index']);router[_0xb056('0x9')](_0xb056('0xb'),auth[_0xb056('0xa')](),controller[_0xb056('0xc')]);router[_0xb056('0x9')](_0xb056('0xd'),auth['isChatInteractionAuthorized'](),controller['show']);router[_0xb056('0x9')](_0xb056('0xe'),auth[_0xb056('0xf')](),controller[_0xb056('0x10')]);router['get'](_0xb056('0x11'),auth['isAuthenticated'](),controller[_0xb056('0x12')]);router[_0xb056('0x9')](_0xb056('0x13'),auth[_0xb056('0xf')](),controller[_0xb056('0x14')]);router['get']('/:id/download',auth[_0xb056('0xa')](),controller[_0xb056('0x15')]);router['post']('/',auth[_0xb056('0xa')](),controller[_0xb056('0x16')]);var upload=multer({'storage':multer[_0xb056('0x17')]({'destination':function(_0x1197e5,_0x10dd19,_0x3776a1){_0x3776a1(null,path[_0xb056('0x18')](config['root'],_0xb056('0x19')));},'filename':function(_0x43565e,_0x9e2eed,_0x65d7ca){_0x65d7ca(null,util['format'](_0xb056('0x1a'),Date['now'](),_0x9e2eed[_0xb056('0x1b')][_0xb056('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xb056('0x1d'),upload['single'](_0xb056('0x1e')),controller[_0xb056('0x1f')]);router['post'](_0xb056('0x11'),auth['isChatInteractionAuthorized'](),controller[_0xb056('0x20')]);router[_0xb056('0x21')](_0xb056('0x22'),auth[_0xb056('0xa')](),interaction['tracked'](_0xb056('0x23'),'chatinteraction:addtags'),controller[_0xb056('0x24')]);router['put'](_0xb056('0xd'),auth[_0xb056('0xa')](),interaction[_0xb056('0x25')](_0xb056('0x23'),_0xb056('0x26')),controller[_0xb056('0x27')]);router['put'](_0xb056('0x28'),controller[_0xb056('0x29')]);router[_0xb056('0x2a')](_0xb056('0x2b'),auth['isChatInteractionAuthorized'](),controller[_0xb056('0x2c')]);router[_0xb056('0x2a')]('/:id/close',controller[_0xb056('0x2d')]);router[_0xb056('0x2e')](_0xb056('0xd'),auth[_0xb056('0xa')](),interaction[_0xb056('0x25')](_0xb056('0x23'),_0xb056('0x2f')),controller[_0xb056('0x30')]);router['delete'](_0xb056('0x22'),auth['isAuthenticated'](),controller[_0xb056('0x31')]);module[_0xb056('0x32')]=router;
\ No newline at end of file
index b8a90bc..30ec96b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe61c=['medium','BOOLEAN','sequelize','TEXT'];(function(_0x1c801b,_0x43d92d){var _0x23e3e9=function(_0x19b7e0){while(--_0x19b7e0){_0x1c801b['push'](_0x1c801b['shift']());}};_0x23e3e9(++_0x43d92d);}(_0xe61c,0xee));var _0xce61=function(_0x34c553,_0x3e7dfc){_0x34c553=_0x34c553-0x0;var _0x1357d2=_0xe61c[_0x34c553];return _0x1357d2;};'use strict';var Sequelize=require(_0xce61('0x0'));module['exports']={'body':{'type':Sequelize[_0xce61('0x1')](_0xce61('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xce61('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}};
\ No newline at end of file
+var _0xfcf0=['BOOLEAN','INTEGER','sequelize','exports','medium'];(function(_0x20ac96,_0x174edd){var _0x17fc68=function(_0x4b8860){while(--_0x4b8860){_0x20ac96['push'](_0x20ac96['shift']());}};_0x17fc68(++_0x174edd);}(_0xfcf0,0x138));var _0x0fcf=function(_0x324012,_0x23f45f){_0x324012=_0x324012-0x0;var _0x435cf2=_0xfcf0[_0x324012];return _0x435cf2;};'use strict';var Sequelize=require(_0x0fcf('0x0'));module[_0x0fcf('0x1')]={'body':{'type':Sequelize['TEXT'](_0x0fcf('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0fcf('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x0fcf('0x4')]}};
\ No newline at end of file
index 7ec0123..2a4172e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9515=['includeAll','include','rows','catch','params','intersection','length','find','create','body','update','describe','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','admin','user','fullname','role','userpic','online','allowmessenger','VoiceQueue','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','UserProfileResource','findAll','isEmpty','agent','resourceId','push','ToId','-createdAt','html-pdf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','name','index','ChatInternalMessage','rawAttributes','model','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','map','type','VIRTUAL','field','merge','options','then'];(function(_0x41ce2e,_0x3555ef){var _0x54d438=function(_0x141539){while(--_0x141539){_0x41ce2e['push'](_0x41ce2e['shift']());}};_0x54d438(++_0x3555ef);}(_0x9515,0xe7));var _0x5951=function(_0x2e3233,_0x1c5347){_0x2e3233=_0x2e3233-0x0;var _0x220a5a=_0x9515[_0x2e3233];return _0x220a5a;};'use strict';var pdf=require(_0x5951('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5951('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5951('0x2'));var BPromise=require(_0x5951('0x3'));var Mustache=require(_0x5951('0x4'));var util=require(_0x5951('0x5'));var path=require('path');var sox=require(_0x5951('0x6'));var csv=require(_0x5951('0x7'));var ejs=require(_0x5951('0x8'));var fs=require('fs');var _=require(_0x5951('0x9'));var squel=require(_0x5951('0xa'));var crypto=require(_0x5951('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5951('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x5951('0xd'));var hardwareService=require(_0x5951('0xe'));var Redis=require(_0x5951('0xf'));var qs=require(_0x5951('0x10'));var logger=require('../../config/logger')(_0x5951('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x5951('0x12'))['db'];config[_0x5951('0x13')]=_[_0x5951('0x14')](config[_0x5951('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x5951('0x15'))(new Redis(config[_0x5951('0x13')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithStatusCode(_0x2bf379,_0x2df603){_0x2df603=_0x2df603||0xcc;return function(_0x431474){if(_0x431474){return _0x2bf379[_0x5951('0x16')](_0x2df603);}return _0x2bf379[_0x5951('0x17')](_0x2df603)['end']();};}function respondWithResult(_0x16e6cb,_0x210fea){_0x210fea=_0x210fea||0xc8;return function(_0x1207ec){if(_0x1207ec){return _0x16e6cb['status'](_0x210fea)[_0x5951('0x18')](_0x1207ec);}};}function respondWithFilteredResult(_0x35b8b3,_0x23994d){return function(_0x16b76b){if(_0x16b76b){var _0x371fd6=_0x16b76b[_0x5951('0x19')],_0x528c1e=_0x23994d[_0x5951('0x1a')],_0x1c06e1=_0x23994d['offset']+_0x23994d[_0x5951('0x1b')],_0x11c93a;if(_0x1c06e1>=_0x371fd6){_0x1c06e1=_0x371fd6;_0x11c93a=0xc8;}else{_0x11c93a=0xce;}_0x35b8b3[_0x5951('0x17')](_0x11c93a);return _0x35b8b3[_0x5951('0x1c')](_0x5951('0x1d'),_0x528c1e+'-'+_0x1c06e1+'/'+_0x371fd6)['json'](_0x16b76b);}return null;};}function patchUpdates(_0x50d099){return function(_0xf30fe0){try{jsonpatch[_0x5951('0x1e')](_0xf30fe0,_0x50d099,!![]);}catch(_0x284d8a){return BPromise[_0x5951('0x1f')](_0x284d8a);}return _0xf30fe0[_0x5951('0x20')]();};}function saveUpdates(_0x1e8c50,_0x18347d){return function(_0x54fe0e){if(_0x54fe0e){return _0x54fe0e['update'](_0x1e8c50)['then'](function(_0x55e57b){return _0x55e57b;});}return null;};}function removeEntity(_0x4ad96a,_0x5e72f6){return function(_0x1e9f91){if(_0x1e9f91){return _0x1e9f91[_0x5951('0x21')]()['then'](function(){_0x4ad96a[_0x5951('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb81bb8,_0x2bf24e){return function(_0x35d36a){if(!_0x35d36a){_0xb81bb8[_0x5951('0x16')](0x194);}return _0x35d36a;};}function handleError(_0x200682,_0xcf822d){_0xcf822d=_0xcf822d||0x1f4;return function(_0x221bb4){logger['error'](_0x221bb4['stack']);if(_0x221bb4[_0x5951('0x22')]){delete _0x221bb4[_0x5951('0x22')];}_0x200682['status'](_0xcf822d)['send'](_0x221bb4);};}exports[_0x5951('0x23')]=function(_0x3688d7,_0x547cb3){var _0x509d44={},_0xce8388={},_0x21901e={'count':0x0,'rows':[]};var _0x216f61=db[_0x5951('0x24')][_0x5951('0x25')];_0xce8388[_0x5951('0x26')]=_[_0x5951('0x27')](_0x216f61);_0xce8388[_0x5951('0x28')]=_['keys'](_0x3688d7['query']);_0xce8388[_0x5951('0x29')]=_['intersection'](_0xce8388[_0x5951('0x26')],_0xce8388['query']);_0x509d44[_0x5951('0x2a')]=_['intersection'](_0xce8388['model'],qs[_0x5951('0x2b')](_0x3688d7[_0x5951('0x28')][_0x5951('0x2b')]));_0x509d44['attributes']=_0x509d44[_0x5951('0x2a')]['length']?_0x509d44[_0x5951('0x2a')]:_0xce8388['model'];if(!_0x3688d7['query'][_0x5951('0x2c')](_0x5951('0x2d'))){_0x509d44[_0x5951('0x1b')]=qs[_0x5951('0x1b')](_0x3688d7[_0x5951('0x28')][_0x5951('0x1b')]);_0x509d44[_0x5951('0x1a')]=qs[_0x5951('0x1a')](_0x3688d7[_0x5951('0x28')]['offset']);}_0x509d44['order']=qs[_0x5951('0x2e')](_0x3688d7['query'][_0x5951('0x2e')]);_0x509d44[_0x5951('0x2f')]=qs[_0x5951('0x29')](_[_0x5951('0x30')](_0x3688d7[_0x5951('0x28')],_0xce8388[_0x5951('0x29')]));if(_0x3688d7['query'][_0x5951('0x31')]){_0x509d44[_0x5951('0x2f')]=_['merge'](_0x509d44[_0x5951('0x2f')],{'$or':_[_0x5951('0x32')](_0x216f61,function(_0x415641){if(_0x415641[_0x5951('0x33')]['key']!==_0x5951('0x34')){var _0x519717={};_0x519717[_0x415641[_0x5951('0x35')]]={'$like':'%'+_0x3688d7[_0x5951('0x28')][_0x5951('0x31')]+'%'};return _0x519717;}})});}_0x509d44=_[_0x5951('0x36')]({},_0x509d44,_0x3688d7[_0x5951('0x37')]);var _0x3053fa={'where':_0x509d44[_0x5951('0x2f')]};return db[_0x5951('0x24')]['count'](_0x3053fa)[_0x5951('0x38')](function(_0x775eaa){_0x21901e[_0x5951('0x19')]=_0x775eaa;if(_0x3688d7[_0x5951('0x28')][_0x5951('0x39')]){_0x509d44[_0x5951('0x3a')]=[{'all':!![]}];}return db['ChatInternalMessage']['findAll'](_0x509d44);})[_0x5951('0x38')](function(_0x22c36a){_0x21901e[_0x5951('0x3b')]=_0x22c36a;return _0x21901e;})[_0x5951('0x38')](respondWithFilteredResult(_0x547cb3,_0x509d44))[_0x5951('0x3c')](handleError(_0x547cb3,null));};exports['show']=function(_0x4e674d,_0x4ae37b){var _0x5bd7fe={'raw':!![],'where':{'id':_0x4e674d[_0x5951('0x3d')]['id']}},_0x2a5c54={};_0x2a5c54[_0x5951('0x26')]=_[_0x5951('0x27')](db[_0x5951('0x24')][_0x5951('0x25')]);_0x2a5c54['query']=_[_0x5951('0x27')](_0x4e674d[_0x5951('0x28')]);_0x2a5c54[_0x5951('0x29')]=_[_0x5951('0x3e')](_0x2a5c54['model'],_0x2a5c54[_0x5951('0x28')]);_0x5bd7fe[_0x5951('0x2a')]=_['intersection'](_0x2a5c54['model'],qs[_0x5951('0x2b')](_0x4e674d[_0x5951('0x28')][_0x5951('0x2b')]));_0x5bd7fe[_0x5951('0x2a')]=_0x5bd7fe[_0x5951('0x2a')][_0x5951('0x3f')]?_0x5bd7fe['attributes']:_0x2a5c54['model'];if(_0x4e674d[_0x5951('0x28')][_0x5951('0x39')]){_0x5bd7fe[_0x5951('0x3a')]=[{'all':!![]}];}_0x5bd7fe=_[_0x5951('0x36')]({},_0x5bd7fe,_0x4e674d[_0x5951('0x37')]);return db[_0x5951('0x24')][_0x5951('0x40')](_0x5bd7fe)[_0x5951('0x38')](handleEntityNotFound(_0x4ae37b,null))[_0x5951('0x38')](respondWithResult(_0x4ae37b,null))['catch'](handleError(_0x4ae37b,null));};exports[_0x5951('0x41')]=function(_0x1700f8,_0x878223){return db['ChatInternalMessage']['create'](_0x1700f8[_0x5951('0x42')],{})[_0x5951('0x38')](respondWithResult(_0x878223,0xc9))[_0x5951('0x3c')](handleError(_0x878223,null));};exports[_0x5951('0x43')]=function(_0x4b6181,_0x1bd916){if(_0x4b6181[_0x5951('0x42')]['id']){delete _0x4b6181[_0x5951('0x42')]['id'];}return db[_0x5951('0x24')]['find']({'where':{'id':_0x4b6181[_0x5951('0x3d')]['id']}})[_0x5951('0x38')](handleEntityNotFound(_0x1bd916,null))[_0x5951('0x38')](saveUpdates(_0x4b6181[_0x5951('0x42')],null))[_0x5951('0x38')](respondWithResult(_0x1bd916,null))[_0x5951('0x3c')](handleError(_0x1bd916,null));};exports[_0x5951('0x21')]=function(_0x216e59,_0x523b57){return db[_0x5951('0x24')]['find']({'where':{'id':_0x216e59['params']['id']}})['then'](handleEntityNotFound(_0x523b57,null))[_0x5951('0x38')](removeEntity(_0x523b57,null))[_0x5951('0x3c')](handleError(_0x523b57,null));};exports['describe']=function(_0x359a09,_0x17b641){return db[_0x5951('0x24')][_0x5951('0x44')]()['then'](respondWithResult(_0x17b641,null))[_0x5951('0x3c')](handleError(_0x17b641,null));};function wrapUser(_0x39f8c0){return function(_0x2a1e16){var _0xd6769=_0x39f8c0['get']({'plain':!![]});_0xd6769[_0x5951('0x45')]=[];if(_0x2a1e16){_0xd6769[_0x5951('0x46')]=_0x2a1e16[_0x5951('0x47')];_0xd6769[_0x5951('0x48')]=_0x2a1e16;}else{_0xd6769[_0x5951('0x46')]=moment(0x0)[_0x5951('0x49')](_0x5951('0x4a'));_0xd6769[_0x5951('0x48')]={};}return _0xd6769;};}exports[_0x5951('0x4b')]=function(_0x14831d,_0x488644,_0x12c00c){var _0x32875a=[];return db['User']['findAll']({'where':{'role':['agent',_0x5951('0x4c'),_0x5951('0x4d')]},'attributes':['id',_0x5951('0x4e'),_0x5951('0x22'),_0x5951('0x4f'),_0x5951('0x50'),'internal',_0x5951('0x51'),'lastLoginAt',_0x5951('0x52'),'showWebBar'],'order':qs['sort']('-online'),'include':[{'model':db[_0x5951('0x53')],'as':'VoiceQueues','attributes':['id',_0x5951('0x22'),_0x5951('0x33')],'through':{'attributes':[]}}]})[_0x5951('0x38')](function(_0x1274f9){if(_0x1274f9){var _0x4c6887=_0x14831d[_0x5951('0x4d')][_0x5951('0x54')]({'plain':!![]});if(!_0x4c6887)throw new Error(_0x5951('0x55'));if(_0x4c6887[_0x5951('0x4f')]===_0x5951('0x4d')){return db['UserProfileSection'][_0x5951('0x40')]({'where':{'name':_0x5951('0x56'),'userProfileId':_0x4c6887[_0x5951('0x57')]},'raw':!![]})[_0x5951('0x38')](function(_0xb2ff39){if(_0xb2ff39){if(_0xb2ff39['autoAssociation']===0x0){return db[_0x5951('0x58')][_0x5951('0x59')]({'where':{'sectionId':_0xb2ff39['id']},'raw':!![]})[_0x5951('0x38')](function(_0x396910){var _0xd46be6=[];if(_[_0x5951('0x5a')](_0x396910)){_0xd46be6=_[_0x5951('0x31')](_0x1274f9,function(_0xe7aa21){if(_0xe7aa21[_0x5951('0x4f')]!==_0x5951('0x5b')){return _0xe7aa21;}});return _0xd46be6;}else{for(var _0x318227=0x0;_0x318227<_0x1274f9[_0x5951('0x3f')];_0x318227++){var _0x449bd0=_0x1274f9[_0x318227];if(_0x449bd0[_0x5951('0x4f')]===_0x5951('0x5b')){var _0xdbf9e=_[_0x5951('0x40')](_0x396910,function(_0x30a65e){return _0x30a65e[_0x5951('0x5c')]===_0x449bd0['id'];});if(_0xdbf9e)_0xd46be6['push'](_0x449bd0);}else{_0xd46be6['push'](_0x449bd0);}}return _0xd46be6;}});}else{return _0x1274f9;}}else{var _0x4148d9=_[_0x5951('0x31')](_0x1274f9,function(_0x28c942){if(_0x28c942['role']!==_0x5951('0x5b')){return _0x28c942;}});return _0x4148d9;}});}else{return _0x1274f9;}}})[_0x5951('0x38')](function(_0x4d5fc3){var _0x3d9c01=[];if(_0x4d5fc3){_0x32875a=_0x4d5fc3;for(var _0x4f8065=0x0;_0x4f8065<_0x4d5fc3[_0x5951('0x3f')];_0x4f8065+=0x1){_0x32875a[_0x4f8065][_0x5951('0x45')]=[];_0x3d9c01[_0x5951('0x5d')](db[_0x5951('0x24')]['find']({'where':{'FromId':[_0x14831d[_0x5951('0x4d')]['id'],_0x4d5fc3[_0x4f8065]['id']],'ToId':[_0x14831d[_0x5951('0x4d')]['id'],_0x4d5fc3[_0x4f8065]['id']],'ChatGroupId':null},'attributes':['id',_0x5951('0x47'),'FromId',_0x5951('0x5e'),'read','body'],'order':qs[_0x5951('0x2e')](_0x5951('0x5f')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x5951('0x38')](wrapUser(_0x4d5fc3[_0x4f8065])));}return BPromise['all'](_0x3d9c01);}return[];})[_0x5951('0x38')](function(_0xf0b763){return{'rows':_0xf0b763,'count':_0xf0b763[_0x5951('0x3f')]};})[_0x5951('0x38')](respondWithResult(_0x488644,null))[_0x5951('0x3c')](handleError(_0x488644,null));};
\ No newline at end of file
+var _0x3c5e=['redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','count','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','ChatInternalMessage','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','pick','filter','merge','map','key','VIRTUAL','field','options','include','findAll','rows','show','params','includeAll','catch','create','body','find','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','getUsers','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','type','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','push','FromId','ToId','read','-createdAt','all','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x33b9b0,_0x4ec42a){var _0x7b10e8=function(_0x54e805){while(--_0x54e805){_0x33b9b0['push'](_0x33b9b0['shift']());}};_0x7b10e8(++_0x4ec42a);}(_0x3c5e,0x145));var _0xe3c5=function(_0xa87b52,_0x1202ca){_0xa87b52=_0xa87b52-0x0;var _0x1269cd=_0x3c5e[_0xa87b52];return _0x1269cd;};'use strict';var pdf=require(_0xe3c5('0x0'));var emlformat=require(_0xe3c5('0x1'));var rimraf=require(_0xe3c5('0x2'));var zipdir=require(_0xe3c5('0x3'));var jsonpatch=require(_0xe3c5('0x4'));var rp=require(_0xe3c5('0x5'));var moment=require(_0xe3c5('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xe3c5('0x7'));var util=require(_0xe3c5('0x8'));var path=require(_0xe3c5('0x9'));var sox=require(_0xe3c5('0xa'));var csv=require(_0xe3c5('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe3c5('0xc'));var squel=require(_0xe3c5('0xd'));var crypto=require('crypto');var jsforce=require(_0xe3c5('0xe'));var deskjs=require(_0xe3c5('0xf'));var toCsv=require(_0xe3c5('0xb'));var querystring=require(_0xe3c5('0x10'));var Papa=require(_0xe3c5('0x11'));var authService=require(_0xe3c5('0x12'));var hardwareService=require(_0xe3c5('0x13'));var Redis=require(_0xe3c5('0x14'));var qs=require(_0xe3c5('0x15'));var logger=require(_0xe3c5('0x16'))(_0xe3c5('0x17'));var utils=require(_0xe3c5('0x18'));var config=require(_0xe3c5('0x19'));var db=require('../../mysqldb')['db'];config[_0xe3c5('0x1a')]=_[_0xe3c5('0x1b')](config[_0xe3c5('0x1a')],{'host':_0xe3c5('0x1c'),'port':0x18eb});var socket=require(_0xe3c5('0x1d'))(new Redis(config[_0xe3c5('0x1a')]));require(_0xe3c5('0x1e'))[_0xe3c5('0x1f')](socket);function respondWithStatusCode(_0x4102bb,_0x56cbea){_0x56cbea=_0x56cbea||0xcc;return function(_0x72461){if(_0x72461){return _0x4102bb[_0xe3c5('0x20')](_0x56cbea);}return _0x4102bb[_0xe3c5('0x21')](_0x56cbea)[_0xe3c5('0x22')]();};}function respondWithResult(_0xa43a94,_0x109908){_0x109908=_0x109908||0xc8;return function(_0x36bab2){if(_0x36bab2){return _0xa43a94[_0xe3c5('0x21')](_0x109908)[_0xe3c5('0x23')](_0x36bab2);}};}function respondWithFilteredResult(_0x5ea67c,_0x55d62f){return function(_0x57959c){if(_0x57959c){var _0x4b8fa4=_0x57959c[_0xe3c5('0x24')],_0x2bd51d=_0x55d62f['offset'],_0xb61d9c=_0x55d62f['offset']+_0x55d62f[_0xe3c5('0x25')],_0x2fa81e;if(_0xb61d9c>=_0x4b8fa4){_0xb61d9c=_0x4b8fa4;_0x2fa81e=0xc8;}else{_0x2fa81e=0xce;}_0x5ea67c['status'](_0x2fa81e);return _0x5ea67c[_0xe3c5('0x26')](_0xe3c5('0x27'),_0x2bd51d+'-'+_0xb61d9c+'/'+_0x4b8fa4)[_0xe3c5('0x23')](_0x57959c);}return null;};}function patchUpdates(_0x21dc55){return function(_0x49db10){try{jsonpatch['apply'](_0x49db10,_0x21dc55,!![]);}catch(_0x2d120f){return BPromise[_0xe3c5('0x28')](_0x2d120f);}return _0x49db10['save']();};}function saveUpdates(_0x2d43ed,_0x1716f9){return function(_0x5c32f5){if(_0x5c32f5){return _0x5c32f5[_0xe3c5('0x29')](_0x2d43ed)[_0xe3c5('0x2a')](function(_0x1d69b3){return _0x1d69b3;});}return null;};}function removeEntity(_0x5b7dc4,_0x5f8849){return function(_0x5e4cfd){if(_0x5e4cfd){return _0x5e4cfd[_0xe3c5('0x2b')]()[_0xe3c5('0x2a')](function(){_0x5b7dc4[_0xe3c5('0x21')](0xcc)[_0xe3c5('0x22')]();});}};}function handleEntityNotFound(_0x4af61a,_0x400050){return function(_0x1e88d7){if(!_0x1e88d7){_0x4af61a[_0xe3c5('0x20')](0x194);}return _0x1e88d7;};}function handleError(_0x5ec0b2,_0xec098f){_0xec098f=_0xec098f||0x1f4;return function(_0x16f6e4){logger[_0xe3c5('0x2c')](_0x16f6e4[_0xe3c5('0x2d')]);if(_0x16f6e4['name']){delete _0x16f6e4[_0xe3c5('0x2e')];}_0x5ec0b2[_0xe3c5('0x21')](_0xec098f)[_0xe3c5('0x2f')](_0x16f6e4);};}exports['index']=function(_0x44f729,_0x3483eb){var _0x5c99fc={},_0x2fae68={},_0x1f6c06={'count':0x0,'rows':[]};var _0x46b73c=db[_0xe3c5('0x30')][_0xe3c5('0x31')];_0x2fae68[_0xe3c5('0x32')]=_[_0xe3c5('0x33')](_0x46b73c);_0x2fae68[_0xe3c5('0x34')]=_[_0xe3c5('0x33')](_0x44f729[_0xe3c5('0x34')]);_0x2fae68[_0xe3c5('0x35')]=_[_0xe3c5('0x36')](_0x2fae68[_0xe3c5('0x32')],_0x2fae68['query']);_0x5c99fc[_0xe3c5('0x37')]=_[_0xe3c5('0x36')](_0x2fae68['model'],qs[_0xe3c5('0x38')](_0x44f729[_0xe3c5('0x34')][_0xe3c5('0x38')]));_0x5c99fc[_0xe3c5('0x37')]=_0x5c99fc[_0xe3c5('0x37')][_0xe3c5('0x39')]?_0x5c99fc[_0xe3c5('0x37')]:_0x2fae68['model'];if(!_0x44f729[_0xe3c5('0x34')]['hasOwnProperty'](_0xe3c5('0x3a'))){_0x5c99fc[_0xe3c5('0x25')]=qs['limit'](_0x44f729[_0xe3c5('0x34')][_0xe3c5('0x25')]);_0x5c99fc['offset']=qs['offset'](_0x44f729['query'][_0xe3c5('0x3b')]);}_0x5c99fc[_0xe3c5('0x3c')]=qs[_0xe3c5('0x3d')](_0x44f729[_0xe3c5('0x34')]['sort']);_0x5c99fc[_0xe3c5('0x3e')]=qs['filters'](_[_0xe3c5('0x3f')](_0x44f729[_0xe3c5('0x34')],_0x2fae68[_0xe3c5('0x35')]));if(_0x44f729[_0xe3c5('0x34')][_0xe3c5('0x40')]){_0x5c99fc['where']=_[_0xe3c5('0x41')](_0x5c99fc[_0xe3c5('0x3e')],{'$or':_[_0xe3c5('0x42')](_0x46b73c,function(_0x468852){if(_0x468852['type'][_0xe3c5('0x43')]!==_0xe3c5('0x44')){var _0x3932ba={};_0x3932ba[_0x468852[_0xe3c5('0x45')]]={'$like':'%'+_0x44f729['query']['filter']+'%'};return _0x3932ba;}})});}_0x5c99fc=_[_0xe3c5('0x41')]({},_0x5c99fc,_0x44f729[_0xe3c5('0x46')]);var _0x514cf3={'where':_0x5c99fc[_0xe3c5('0x3e')]};return db[_0xe3c5('0x30')]['count'](_0x514cf3)[_0xe3c5('0x2a')](function(_0x3dfe22){_0x1f6c06[_0xe3c5('0x24')]=_0x3dfe22;if(_0x44f729[_0xe3c5('0x34')]['includeAll']){_0x5c99fc[_0xe3c5('0x47')]=[{'all':!![]}];}return db[_0xe3c5('0x30')][_0xe3c5('0x48')](_0x5c99fc);})[_0xe3c5('0x2a')](function(_0x46359f){_0x1f6c06[_0xe3c5('0x49')]=_0x46359f;return _0x1f6c06;})[_0xe3c5('0x2a')](respondWithFilteredResult(_0x3483eb,_0x5c99fc))['catch'](handleError(_0x3483eb,null));};exports[_0xe3c5('0x4a')]=function(_0x53d3aa,_0x40b426){var _0xaaf28c={'raw':!![],'where':{'id':_0x53d3aa[_0xe3c5('0x4b')]['id']}},_0x18413c={};_0x18413c[_0xe3c5('0x32')]=_['keys'](db[_0xe3c5('0x30')][_0xe3c5('0x31')]);_0x18413c[_0xe3c5('0x34')]=_['keys'](_0x53d3aa['query']);_0x18413c['filters']=_[_0xe3c5('0x36')](_0x18413c[_0xe3c5('0x32')],_0x18413c[_0xe3c5('0x34')]);_0xaaf28c['attributes']=_[_0xe3c5('0x36')](_0x18413c['model'],qs[_0xe3c5('0x38')](_0x53d3aa[_0xe3c5('0x34')][_0xe3c5('0x38')]));_0xaaf28c[_0xe3c5('0x37')]=_0xaaf28c[_0xe3c5('0x37')][_0xe3c5('0x39')]?_0xaaf28c[_0xe3c5('0x37')]:_0x18413c[_0xe3c5('0x32')];if(_0x53d3aa[_0xe3c5('0x34')][_0xe3c5('0x4c')]){_0xaaf28c['include']=[{'all':!![]}];}_0xaaf28c=_[_0xe3c5('0x41')]({},_0xaaf28c,_0x53d3aa[_0xe3c5('0x46')]);return db[_0xe3c5('0x30')]['find'](_0xaaf28c)[_0xe3c5('0x2a')](handleEntityNotFound(_0x40b426,null))[_0xe3c5('0x2a')](respondWithResult(_0x40b426,null))[_0xe3c5('0x4d')](handleError(_0x40b426,null));};exports[_0xe3c5('0x4e')]=function(_0x436315,_0x45dc62){return db[_0xe3c5('0x30')]['create'](_0x436315['body'],{})[_0xe3c5('0x2a')](respondWithResult(_0x45dc62,0xc9))[_0xe3c5('0x4d')](handleError(_0x45dc62,null));};exports[_0xe3c5('0x29')]=function(_0x2e4963,_0x41c207){if(_0x2e4963[_0xe3c5('0x4f')]['id']){delete _0x2e4963[_0xe3c5('0x4f')]['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x2e4963['params']['id']}})[_0xe3c5('0x2a')](handleEntityNotFound(_0x41c207,null))['then'](saveUpdates(_0x2e4963[_0xe3c5('0x4f')],null))[_0xe3c5('0x2a')](respondWithResult(_0x41c207,null))[_0xe3c5('0x4d')](handleError(_0x41c207,null));};exports[_0xe3c5('0x2b')]=function(_0x2a3377,_0xf3a9af){return db['ChatInternalMessage'][_0xe3c5('0x50')]({'where':{'id':_0x2a3377[_0xe3c5('0x4b')]['id']}})['then'](handleEntityNotFound(_0xf3a9af,null))[_0xe3c5('0x2a')](removeEntity(_0xf3a9af,null))[_0xe3c5('0x4d')](handleError(_0xf3a9af,null));};exports['describe']=function(_0x347191,_0x347a37){return db[_0xe3c5('0x30')][_0xe3c5('0x51')]()[_0xe3c5('0x2a')](respondWithResult(_0x347a37,null))['catch'](handleError(_0x347a37,null));};function wrapUser(_0x268ea3){return function(_0x2afe68){var _0x4086fb=_0x268ea3[_0xe3c5('0x52')]({'plain':!![]});_0x4086fb[_0xe3c5('0x53')]=[];if(_0x2afe68){_0x4086fb[_0xe3c5('0x54')]=_0x2afe68[_0xe3c5('0x55')];_0x4086fb[_0xe3c5('0x56')]=_0x2afe68;}else{_0x4086fb[_0xe3c5('0x54')]=moment(0x0)[_0xe3c5('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x4086fb[_0xe3c5('0x56')]={};}return _0x4086fb;};}exports[_0xe3c5('0x58')]=function(_0x4d6965,_0x9f950,_0x1ce5e0){var _0x3304b2=[];return db['User']['findAll']({'where':{'role':['agent',_0xe3c5('0x59'),_0xe3c5('0x5a')]},'attributes':['id',_0xe3c5('0x5b'),_0xe3c5('0x2e'),_0xe3c5('0x5c'),_0xe3c5('0x5d'),_0xe3c5('0x5e'),_0xe3c5('0x5f'),_0xe3c5('0x60'),_0xe3c5('0x61'),_0xe3c5('0x62')],'order':qs[_0xe3c5('0x3d')]('-online'),'include':[{'model':db[_0xe3c5('0x63')],'as':_0xe3c5('0x64'),'attributes':['id',_0xe3c5('0x2e'),_0xe3c5('0x65')],'through':{'attributes':[]}}]})['then'](function(_0x1f8b09){if(_0x1f8b09){var _0x35f395=_0x4d6965[_0xe3c5('0x5a')][_0xe3c5('0x52')]({'plain':!![]});if(!_0x35f395)throw new Error(_0xe3c5('0x66'));if(_0x35f395[_0xe3c5('0x5c')]===_0xe3c5('0x5a')){return db[_0xe3c5('0x67')][_0xe3c5('0x50')]({'where':{'name':_0xe3c5('0x68'),'userProfileId':_0x35f395[_0xe3c5('0x69')]},'raw':!![]})[_0xe3c5('0x2a')](function(_0x4190d3){if(_0x4190d3){if(_0x4190d3[_0xe3c5('0x6a')]===0x0){return db[_0xe3c5('0x6b')][_0xe3c5('0x48')]({'where':{'sectionId':_0x4190d3['id']},'raw':!![]})['then'](function(_0x548c7d){var _0x1fb1b1=[];if(_[_0xe3c5('0x6c')](_0x548c7d)){_0x1fb1b1=_['filter'](_0x1f8b09,function(_0xd31b4d){if(_0xd31b4d[_0xe3c5('0x5c')]!==_0xe3c5('0x6d')){return _0xd31b4d;}});return _0x1fb1b1;}else{for(var _0x53cd8c=0x0;_0x53cd8c<_0x1f8b09[_0xe3c5('0x39')];_0x53cd8c++){var _0x5c5eb3=_0x1f8b09[_0x53cd8c];if(_0x5c5eb3[_0xe3c5('0x5c')]===_0xe3c5('0x6d')){var _0x26a1cb=_[_0xe3c5('0x50')](_0x548c7d,function(_0x314f90){return _0x314f90[_0xe3c5('0x6e')]===_0x5c5eb3['id'];});if(_0x26a1cb)_0x1fb1b1[_0xe3c5('0x6f')](_0x5c5eb3);}else{_0x1fb1b1['push'](_0x5c5eb3);}}return _0x1fb1b1;}});}else{return _0x1f8b09;}}else{var _0x1c0dc4=_[_0xe3c5('0x40')](_0x1f8b09,function(_0x12d7e4){if(_0x12d7e4['role']!==_0xe3c5('0x6d')){return _0x12d7e4;}});return _0x1c0dc4;}});}else{return _0x1f8b09;}}})[_0xe3c5('0x2a')](function(_0x1d7035){var _0x239ccf=[];if(_0x1d7035){_0x3304b2=_0x1d7035;for(var _0x1e35c8=0x0;_0x1e35c8<_0x1d7035[_0xe3c5('0x39')];_0x1e35c8+=0x1){_0x3304b2[_0x1e35c8][_0xe3c5('0x53')]=[];_0x239ccf[_0xe3c5('0x6f')](db[_0xe3c5('0x30')][_0xe3c5('0x50')]({'where':{'FromId':[_0x4d6965[_0xe3c5('0x5a')]['id'],_0x1d7035[_0x1e35c8]['id']],'ToId':[_0x4d6965[_0xe3c5('0x5a')]['id'],_0x1d7035[_0x1e35c8]['id']],'ChatGroupId':null},'attributes':['id',_0xe3c5('0x55'),_0xe3c5('0x70'),_0xe3c5('0x71'),_0xe3c5('0x72'),_0xe3c5('0x4f')],'order':qs[_0xe3c5('0x3d')](_0xe3c5('0x73')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xe3c5('0x2a')](wrapUser(_0x1d7035[_0x1e35c8])));}return BPromise[_0xe3c5('0x74')](_0x239ccf);}return[];})[_0xe3c5('0x2a')](function(_0x357ebd){return{'rows':_0x357ebd,'count':_0x357ebd[_0xe3c5('0x39')]};})[_0xe3c5('0x2a')](respondWithResult(_0x9f950,null))[_0xe3c5('0x4d')](handleError(_0x9f950,null));};
\ No newline at end of file
index 8f97ea2..576db6a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9740=['remove','hasOwnProperty','events','../../mysqldb','setMaxListeners','update'];(function(_0x585429,_0x2c0b38){var _0x3399c4=function(_0x489ffa){while(--_0x489ffa){_0x585429['push'](_0x585429['shift']());}};_0x3399c4(++_0x2c0b38);}(_0x9740,0xc2));var _0x0974=function(_0x41a270,_0x57574d){_0x41a270=_0x41a270-0x0;var _0x3975aa=_0x9740[_0x41a270];return _0x3975aa;};'use strict';var EventEmitter=require(_0x0974('0x0'));var ChatInternalMessage=require(_0x0974('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x0974('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0974('0x3'),'afterDestroy':_0x0974('0x4')};function emitEvent(_0x46b8e9){return function(_0x115d82,_0x538465,_0x337dae){ChatInternalMessageEvents['emit'](_0x46b8e9+':'+_0x115d82['id'],_0x115d82);ChatInternalMessageEvents['emit'](_0x46b8e9,_0x115d82);_0x337dae(null);};}for(var e in events){if(events[_0x0974('0x5')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents;
\ No newline at end of file
+var _0x14fd=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x3fe54d,_0x566cb3){var _0x59981=function(_0x192a4f){while(--_0x192a4f){_0x3fe54d['push'](_0x3fe54d['shift']());}};_0x59981(++_0x566cb3);}(_0x14fd,0x18e));var _0xd14f=function(_0x57fb60,_0x13d056){_0x57fb60=_0x57fb60-0x0;var _0x2d8b92=_0x14fd[_0x57fb60];return _0x2d8b92;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0xd14f('0x0'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xd14f('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd14f('0x2'),'afterDestroy':_0xd14f('0x3')};function emitEvent(_0x223ab9){return function(_0x56d12a,_0x497368,_0x2817c4){ChatInternalMessageEvents[_0xd14f('0x4')](_0x223ab9+':'+_0x56d12a['id'],_0x56d12a);ChatInternalMessageEvents['emit'](_0x223ab9,_0x56d12a);_0x2817c4(null);};}for(var e in events){if(events[_0xd14f('0x5')](e)){var event=events[e];ChatInternalMessage[_0xd14f('0x6')](e,emitEvent(event));}}module[_0xd14f('0x7')]=ChatInternalMessageEvents;
\ No newline at end of file
index affe49b..b0f9db2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd0ca=['request-promise','./chatInternalMessage.attributes','exports','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird'];(function(_0x5b5424,_0xb34e70){var _0x1278e5=function(_0x10f0cc){while(--_0x10f0cc){_0x5b5424['push'](_0x5b5424['shift']());}};_0x1278e5(++_0xb34e70);}(_0xd0ca,0xf8));var _0xad0c=function(_0x32fb40,_0x459813){_0x32fb40=_0x32fb40-0x0;var _0x52cef8=_0xd0ca[_0x32fb40];return _0x52cef8;};'use strict';var _=require(_0xad0c('0x0'));var util=require('util');var logger=require(_0xad0c('0x1'))(_0xad0c('0x2'));var moment=require('moment');var BPromise=require(_0xad0c('0x3'));var rp=require(_0xad0c('0x4'));var attributes=require(_0xad0c('0x5'));module[_0xad0c('0x6')]=function(_0x9f7e6b,_0xb22622){return _0x9f7e6b['define']('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xad0c('0x7'),'collate':_0xad0c('0x8')});};
\ No newline at end of file
+var _0xa2f4=['chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','define','ChatInternalMessage'];(function(_0x3937b6,_0xd53d2b){var _0x1ba356=function(_0x4816cc){while(--_0x4816cc){_0x3937b6['push'](_0x3937b6['shift']());}};_0x1ba356(++_0xd53d2b);}(_0xa2f4,0xf3));var _0x4a2f=function(_0x1f94b0,_0x58c657){_0x1f94b0=_0x1f94b0-0x0;var _0x5cba72=_0xa2f4[_0x1f94b0];return _0x5cba72;};'use strict';var _=require(_0x4a2f('0x0'));var util=require(_0x4a2f('0x1'));var logger=require(_0x4a2f('0x2'))('api');var moment=require(_0x4a2f('0x3'));var BPromise=require('bluebird');var rp=require(_0x4a2f('0x4'));var attributes=require('./chatInternalMessage.attributes');module['exports']=function(_0x3b2dcd,_0x322252){return _0x3b2dcd[_0x4a2f('0x5')](_0x4a2f('0x6'),attributes,{'tableName':_0x4a2f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4a2f('0x8'),'collate':_0x4a2f('0x9')});};
\ No newline at end of file
index 477d8c5..81cf714 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb733=['register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','message','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb733,0xab));var _0x3b73=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb733[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x3b73('0x0'));var util=require('util');var moment=require(_0x3b73('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b73('0x2'));var db=require(_0x3b73('0x3'))['db'];var utils=require(_0x3b73('0x4'));var logger=require(_0x3b73('0x5'))(_0x3b73('0x6'));var config=require(_0x3b73('0x7'));var jayson=require(_0x3b73('0x8'));var client=jayson['client'][_0x3b73('0x9')]({'port':0x232a});config[_0x3b73('0xa')]=_[_0x3b73('0xb')](config[_0x3b73('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3b73('0xc'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x3b73('0xd')](socket);function respondWithRpcPromise(_0x6b9fda,_0x27114b,_0x3921b6){return new BPromise(function(_0x8c7960,_0x4c29a4){return client[_0x3b73('0xe')](_0x6b9fda,_0x3921b6)[_0x3b73('0xf')](function(_0x3a664f){logger[_0x3b73('0x10')](_0x3b73('0x11'),_0x27114b,_0x3b73('0x12'));logger[_0x3b73('0x13')](_0x3b73('0x14'),_0x27114b,_0x3b73('0x12'),JSON['stringify'](_0x3a664f));if(_0x3a664f[_0x3b73('0x15')]){if(_0x3a664f[_0x3b73('0x15')]['code']===0x1f4){logger[_0x3b73('0x15')](_0x3b73('0x11'),_0x27114b,_0x3a664f[_0x3b73('0x15')][_0x3b73('0x16')]);return _0x4c29a4(_0x3a664f[_0x3b73('0x15')][_0x3b73('0x16')]);}logger['error'](_0x3b73('0x11'),_0x27114b,_0x3a664f[_0x3b73('0x15')][_0x3b73('0x16')]);return _0x8c7960(_0x3a664f[_0x3b73('0x15')][_0x3b73('0x16')]);}else{logger[_0x3b73('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x27114b,_0x3b73('0x12'));_0x8c7960(_0x3a664f['result']['message']);}})['catch'](function(_0x3b0d3c){logger[_0x3b73('0x15')](_0x3b73('0x11'),_0x27114b,_0x3b0d3c);_0x4c29a4(_0x3b0d3c);});});}
\ No newline at end of file
+var _0x236d=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','ioredis'];(function(_0x2387c5,_0xfcc74c){var _0x2c414c=function(_0x3d1881){while(--_0x3d1881){_0x2387c5['push'](_0x2387c5['shift']());}};_0x2c414c(++_0xfcc74c);}(_0x236d,0x7e));var _0xd236=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x236d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd236('0x0'));var util=require(_0xd236('0x1'));var moment=require('moment');var BPromise=require(_0xd236('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd236('0x3'));var db=require(_0xd236('0x4'))['db'];var utils=require(_0xd236('0x5'));var logger=require(_0xd236('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd236('0x7'));var client=jayson[_0xd236('0x8')][_0xd236('0x9')]({'port':0x232a});config[_0xd236('0xa')]=_['defaults'](config['redis'],{'host':_0xd236('0xb'),'port':0x18eb});var socket=require(_0xd236('0xc'))(new Redis(config['redis']));require(_0xd236('0xd'))[_0xd236('0xe')](socket);function respondWithRpcPromise(_0x5a3447,_0x3d11c7,_0x29ba1d){return new BPromise(function(_0x176ffc,_0x594013){return client[_0xd236('0xf')](_0x5a3447,_0x29ba1d)[_0xd236('0x10')](function(_0x216cd2){logger['info'](_0xd236('0x11'),_0x3d11c7,_0xd236('0x12'));logger[_0xd236('0x13')](_0xd236('0x14'),_0x3d11c7,_0xd236('0x12'),JSON[_0xd236('0x15')](_0x216cd2));if(_0x216cd2[_0xd236('0x16')]){if(_0x216cd2[_0xd236('0x16')][_0xd236('0x17')]===0x1f4){logger[_0xd236('0x16')](_0xd236('0x11'),_0x3d11c7,_0x216cd2[_0xd236('0x16')][_0xd236('0x18')]);return _0x594013(_0x216cd2[_0xd236('0x16')][_0xd236('0x18')]);}logger[_0xd236('0x16')](_0xd236('0x11'),_0x3d11c7,_0x216cd2[_0xd236('0x16')][_0xd236('0x18')]);return _0x176ffc(_0x216cd2[_0xd236('0x16')]['message']);}else{logger['info'](_0xd236('0x11'),_0x3d11c7,_0xd236('0x12'));_0x176ffc(_0x216cd2['result'][_0xd236('0x18')]);}})[_0xd236('0x19')](function(_0x132752){logger['error'](_0xd236('0x11'),_0x3d11c7,_0x132752);_0x594013(_0x132752);});});}
\ No newline at end of file
index 749ac75..247c465 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x90ee=['register','length','chatInternalMessage:','./chatInternalMessage.events','remove','update','emit','removeListener'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x90ee,0xfb));var _0xe90e=function(_0xdeac17,_0x19ad66){_0xdeac17=_0xdeac17-0x0;var _0x33aabd=_0x90ee[_0xdeac17];return _0x33aabd;};'use strict';var ChatInternalMessageEvents=require(_0xe90e('0x0'));var events=['save',_0xe90e('0x1'),_0xe90e('0x2')];function createListener(_0x1b1a02,_0x5b3cca){return function(_0x16c0c1){_0x5b3cca[_0xe90e('0x3')](_0x1b1a02,_0x16c0c1);};}function removeListener(_0x3b448b,_0x47b929){return function(){ChatInternalMessageEvents[_0xe90e('0x4')](_0x3b448b,_0x47b929);};}exports[_0xe90e('0x5')]=function(_0x174931){for(var _0x4c6cfa=0x0,_0x48e119=events[_0xe90e('0x6')];_0x4c6cfa<_0x48e119;_0x4c6cfa++){var _0x26bb74=events[_0x4c6cfa];var _0x41b911=createListener(_0xe90e('0x7')+_0x26bb74,_0x174931);ChatInternalMessageEvents['on'](_0x26bb74,_0x41b911);}};
\ No newline at end of file
+var _0x85b4=['emit','removeListener','register','length','save','remove','update'];(function(_0x2f705c,_0xd98590){var _0x3fee46=function(_0x5e1a2c){while(--_0x5e1a2c){_0x2f705c['push'](_0x2f705c['shift']());}};_0x3fee46(++_0xd98590);}(_0x85b4,0x97));var _0x485b=function(_0x3bda86,_0x3c45e5){_0x3bda86=_0x3bda86-0x0;var _0x4d7ffa=_0x85b4[_0x3bda86];return _0x4d7ffa;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x485b('0x0'),_0x485b('0x1'),_0x485b('0x2')];function createListener(_0x30ff5d,_0x52a5cf){return function(_0x2fe1b0){_0x52a5cf[_0x485b('0x3')](_0x30ff5d,_0x2fe1b0);};}function removeListener(_0x556d08,_0x23a279){return function(){ChatInternalMessageEvents[_0x485b('0x4')](_0x556d08,_0x23a279);};}exports[_0x485b('0x5')]=function(_0xd1cbea){for(var _0x539666=0x0,_0xabfb2b=events[_0x485b('0x6')];_0x539666<_0xabfb2b;_0x539666++){var _0x4ad59a=events[_0x539666];var _0x58e265=createListener('chatInternalMessage:'+_0x4ad59a,_0xd1cbea);ChatInternalMessageEvents['on'](_0x4ad59a,_0x58e265);}};
\ No newline at end of file
index 679401b..9bfdc02 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfb11=['isAuthenticated','describe','/users','getUsers','/:id','show','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service','./chatInternalMessage.controller','get','index'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfb11[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x1fb1('0x0'));var util=require('util');var path=require(_0x1fb1('0x1'));var timeout=require(_0x1fb1('0x2'));var express=require('express');var router=express[_0x1fb1('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1fb1('0x4'));var config=require('../../config/environment');var controller=require(_0x1fb1('0x5'));router[_0x1fb1('0x6')]('/',auth['isAuthenticated'](),controller[_0x1fb1('0x7')]);router[_0x1fb1('0x6')]('/describe',auth[_0x1fb1('0x8')](),controller[_0x1fb1('0x9')]);router[_0x1fb1('0x6')](_0x1fb1('0xa'),auth[_0x1fb1('0x8')](),controller[_0x1fb1('0xb')]);router[_0x1fb1('0x6')](_0x1fb1('0xc'),auth[_0x1fb1('0x8')](),controller[_0x1fb1('0xd')]);router['post']('/',auth[_0x1fb1('0x8')](),controller['create']);router[_0x1fb1('0xe')]('/:id',controller[_0x1fb1('0xf')]);router[_0x1fb1('0x10')](_0x1fb1('0xc'),auth[_0x1fb1('0x8')](),controller[_0x1fb1('0x11')]);module[_0x1fb1('0x12')]=router;
\ No newline at end of file
+var _0x7c1a=['show','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/users','getUsers','/:id'];(function(_0x16e0c8,_0x4861eb){var _0xe4b5af=function(_0x5248bc){while(--_0x5248bc){_0x16e0c8['push'](_0x16e0c8['shift']());}};_0xe4b5af(++_0x4861eb);}(_0x7c1a,0x159));var _0xa7c1=function(_0x40c1a8,_0x3bd2fa){_0x40c1a8=_0x40c1a8-0x0;var _0x124915=_0x7c1a[_0x40c1a8];return _0x124915;};'use strict';var multer=require(_0xa7c1('0x0'));var util=require(_0xa7c1('0x1'));var path=require(_0xa7c1('0x2'));var timeout=require(_0xa7c1('0x3'));var express=require(_0xa7c1('0x4'));var router=express[_0xa7c1('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xa7c1('0x6'));var config=require(_0xa7c1('0x7'));var controller=require('./chatInternalMessage.controller');router[_0xa7c1('0x8')]('/',auth['isAuthenticated'](),controller[_0xa7c1('0x9')]);router[_0xa7c1('0x8')](_0xa7c1('0xa'),auth[_0xa7c1('0xb')](),controller['describe']);router['get'](_0xa7c1('0xc'),auth[_0xa7c1('0xb')](),controller[_0xa7c1('0xd')]);router['get'](_0xa7c1('0xe'),auth[_0xa7c1('0xb')](),controller[_0xa7c1('0xf')]);router['post']('/',auth[_0xa7c1('0xb')](),controller[_0xa7c1('0x10')]);router['put'](_0xa7c1('0xe'),controller[_0xa7c1('0x11')]);router['delete'](_0xa7c1('0xe'),auth[_0xa7c1('0xb')](),controller[_0xa7c1('0x12')]);module[_0xa7c1('0x13')]=router;
\ No newline at end of file
index ab5a304..74fd88d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaa9f=['medium','BOOLEAN','ENUM','out','DATE','exports','TEXT'];(function(_0x4d82d7,_0x14da7f){var _0x860a67=function(_0x3417a6){while(--_0x3417a6){_0x4d82d7['push'](_0x4d82d7['shift']());}};_0x860a67(++_0x14da7f);}(_0xaa9f,0xc2));var _0xfaa9=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0xaa9f[_0x3fba9f];return _0x192cf1;};'use strict';var Sequelize=require('sequelize');module[_0xfaa9('0x0')]={'body':{'type':Sequelize[_0xfaa9('0x1')](_0xfaa9('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xfaa9('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xfaa9('0x4')]('in',_0xfaa9('0x5')),'defaultValue':_0xfaa9('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xfaa9('0x6')]}};
\ No newline at end of file
+var _0x0243=['BOOLEAN','out','sequelize','exports','TEXT','medium'];(function(_0x489b10,_0x3a86d9){var _0x425e87=function(_0x172ea1){while(--_0x172ea1){_0x489b10['push'](_0x489b10['shift']());}};_0x425e87(++_0x3a86d9);}(_0x0243,0x8c));var _0x3024=function(_0xd2421e,_0x265765){_0xd2421e=_0xd2421e-0x0;var _0x42568c=_0x0243[_0xd2421e];return _0x42568c;};'use strict';var Sequelize=require(_0x3024('0x0'));module[_0x3024('0x1')]={'body':{'type':Sequelize[_0x3024('0x2')](_0x3024('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3024('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x3024('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x3024('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']}};
\ No newline at end of file
index 654235e..bd95006 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8e23=['query','attributes','intersection','fields','hasOwnProperty','nolimit','limit','where','filters','merge','map','type','VIRTUAL','field','includeAll','include','findAll','rows','show','params','length','options','find','create','body','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','ChatInteraction','update','isNil','read1stAt','interaction','role','stringify','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','formData','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','destroy','stack','name','send','index','ChatMessage','rawAttributes','model','keys'];(function(_0xf6e75d,_0xc70967){var _0x27514d=function(_0xc2c6dd){while(--_0xc2c6dd){_0xf6e75d['push'](_0xf6e75d['shift']());}};_0x27514d(++_0xc70967);}(_0x8e23,0xae));var _0x38e2=function(_0x3f8102,_0x56150b){_0x3f8102=_0x3f8102-0x0;var _0x2afad0=_0x8e23[_0x3f8102];return _0x2afad0;};'use strict';var pdf=require(_0x38e2('0x0'));var emlformat=require(_0x38e2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x38e2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x38e2('0x3'));var moment=require(_0x38e2('0x4'));var BPromise=require(_0x38e2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x38e2('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x38e2('0x7'));var fs=require('fs');var _=require(_0x38e2('0x8'));var squel=require(_0x38e2('0x9'));var crypto=require(_0x38e2('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x38e2('0xb'));var toCsv=require(_0x38e2('0xc'));var querystring=require(_0x38e2('0xd'));var Papa=require(_0x38e2('0xe'));var authService=require('../../components/auth/service');var hardwareService=require(_0x38e2('0xf'));var Redis=require(_0x38e2('0x10'));var qs=require(_0x38e2('0x11'));var logger=require(_0x38e2('0x12'))(_0x38e2('0x13'));var utils=require(_0x38e2('0x14'));var config=require(_0x38e2('0x15'));var db=require('../../mysqldb')['db'];config[_0x38e2('0x16')]=_[_0x38e2('0x17')](config[_0x38e2('0x16')],{'host':_0x38e2('0x18'),'port':0x18eb});var socket=require(_0x38e2('0x19'))(new Redis(config['redis']));require(_0x38e2('0x1a'))['register'](socket);var jayson=require(_0x38e2('0x1b'));var client=jayson[_0x38e2('0x1c')][_0x38e2('0x1d')]({'port':0x232c});var client9002=jayson[_0x38e2('0x1c')][_0x38e2('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1a997f,_0x36459e,_0xc0cd5e,_0x59dc1b){return new BPromise(function(_0x5f1cb9,_0x357146){var _0x62aea6=_0x59dc1b||client;return _0x62aea6[_0x38e2('0x1e')](_0x1a997f,_0xc0cd5e)[_0x38e2('0x1f')](function(_0x2194c8){logger[_0x38e2('0x20')](_0x38e2('0x21'),_0x36459e,'request\x20sent');logger['debug'](_0x38e2('0x22'),_0x36459e,_0x38e2('0x23'),JSON['stringify'](_0x2194c8));if(_0x2194c8[_0x38e2('0x24')]){if(_0x2194c8[_0x38e2('0x24')]['code']===0x1f4){logger[_0x38e2('0x24')]('ChatMessage,\x20%s,\x20%s',_0x36459e,_0x2194c8[_0x38e2('0x24')]['message']);return _0x357146(_0x2194c8[_0x38e2('0x24')]['message']);}logger[_0x38e2('0x24')](_0x38e2('0x21'),_0x36459e,_0x2194c8[_0x38e2('0x24')][_0x38e2('0x25')]);return _0x5f1cb9(_0x2194c8['error'][_0x38e2('0x25')]);}else{logger[_0x38e2('0x20')](_0x38e2('0x21'),_0x36459e,'request\x20sent');_0x5f1cb9(_0x2194c8[_0x38e2('0x26')][_0x38e2('0x25')]);}})[_0x38e2('0x27')](function(_0x4069af){logger['error']('ChatMessage,\x20%s,\x20%s',_0x36459e,_0x4069af);_0x357146(_0x4069af);});});}function respondWithStatusCode(_0x12dba2,_0xa62e22){_0xa62e22=_0xa62e22||0xcc;return function(_0x2afa66){if(_0x2afa66){return _0x12dba2[_0x38e2('0x28')](_0xa62e22);}return _0x12dba2[_0x38e2('0x29')](_0xa62e22)[_0x38e2('0x2a')]();};}function respondWithResult(_0x987445,_0x5cbc7b){_0x5cbc7b=_0x5cbc7b||0xc8;return function(_0xafe9c2){if(_0xafe9c2){return _0x987445[_0x38e2('0x29')](_0x5cbc7b)[_0x38e2('0x2b')](_0xafe9c2);}};}function respondWithFilteredResult(_0x4b09eb,_0x23e627){return function(_0x42b8b2){if(_0x42b8b2){var _0x12c077=_0x42b8b2[_0x38e2('0x2c')],_0x187949=_0x23e627[_0x38e2('0x2d')],_0x46f4c5=_0x23e627[_0x38e2('0x2d')]+_0x23e627['limit'],_0x2f8347;if(_0x46f4c5>=_0x12c077){_0x46f4c5=_0x12c077;_0x2f8347=0xc8;}else{_0x2f8347=0xce;}_0x4b09eb[_0x38e2('0x29')](_0x2f8347);return _0x4b09eb['set'](_0x38e2('0x2e'),_0x187949+'-'+_0x46f4c5+'/'+_0x12c077)[_0x38e2('0x2b')](_0x42b8b2);}return null;};}function patchUpdates(_0xca2d25){return function(_0x92e04f){try{jsonpatch[_0x38e2('0x2f')](_0x92e04f,_0xca2d25,!![]);}catch(_0x540bbb){return BPromise[_0x38e2('0x30')](_0x540bbb);}return _0x92e04f['save']();};}function saveUpdates(_0x20fd71,_0x26274b){return function(_0xa3bd9e){if(_0xa3bd9e){return _0xa3bd9e['update'](_0x20fd71)['then'](function(_0x18719e){return _0x18719e;});}return null;};}function removeEntity(_0x48c643,_0x2e8068){return function(_0x39e229){if(_0x39e229){return _0x39e229[_0x38e2('0x31')]()[_0x38e2('0x1f')](function(){_0x48c643[_0x38e2('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43ee56,_0x3d1f5f){return function(_0x411bea){if(!_0x411bea){_0x43ee56['sendStatus'](0x194);}return _0x411bea;};}function handleError(_0x134b84,_0x28bbc1){_0x28bbc1=_0x28bbc1||0x1f4;return function(_0x47f25f){logger[_0x38e2('0x24')](_0x47f25f[_0x38e2('0x32')]);if(_0x47f25f[_0x38e2('0x33')]){delete _0x47f25f['name'];}_0x134b84['status'](_0x28bbc1)[_0x38e2('0x34')](_0x47f25f);};}exports[_0x38e2('0x35')]=function(_0x39c973,_0x431627){var _0x494b25={},_0x45e185={},_0x499962={'count':0x0,'rows':[]};var _0x3d49ea=db[_0x38e2('0x36')][_0x38e2('0x37')];_0x45e185[_0x38e2('0x38')]=_[_0x38e2('0x39')](_0x3d49ea);_0x45e185[_0x38e2('0x3a')]=_['keys'](_0x39c973[_0x38e2('0x3a')]);_0x45e185['filters']=_['intersection'](_0x45e185[_0x38e2('0x38')],_0x45e185['query']);_0x494b25[_0x38e2('0x3b')]=_[_0x38e2('0x3c')](_0x45e185[_0x38e2('0x38')],qs['fields'](_0x39c973[_0x38e2('0x3a')][_0x38e2('0x3d')]));_0x494b25[_0x38e2('0x3b')]=_0x494b25[_0x38e2('0x3b')]['length']?_0x494b25[_0x38e2('0x3b')]:_0x45e185['model'];if(!_0x39c973[_0x38e2('0x3a')][_0x38e2('0x3e')](_0x38e2('0x3f'))){_0x494b25[_0x38e2('0x40')]=qs['limit'](_0x39c973[_0x38e2('0x3a')][_0x38e2('0x40')]);_0x494b25[_0x38e2('0x2d')]=qs[_0x38e2('0x2d')](_0x39c973[_0x38e2('0x3a')][_0x38e2('0x2d')]);}_0x494b25['order']=qs['sort'](_0x39c973[_0x38e2('0x3a')]['sort']);_0x494b25[_0x38e2('0x41')]=qs[_0x38e2('0x42')](_['pick'](_0x39c973['query'],_0x45e185['filters']));if(_0x39c973['query']['filter']){_0x494b25[_0x38e2('0x41')]=_[_0x38e2('0x43')](_0x494b25[_0x38e2('0x41')],{'$or':_[_0x38e2('0x44')](_0x3d49ea,function(_0x2d2d96){if(_0x2d2d96[_0x38e2('0x45')]['key']!==_0x38e2('0x46')){var _0x9d911b={};_0x9d911b[_0x2d2d96[_0x38e2('0x47')]]={'$like':'%'+_0x39c973[_0x38e2('0x3a')]['filter']+'%'};return _0x9d911b;}})});}_0x494b25=_[_0x38e2('0x43')]({},_0x494b25,_0x39c973['options']);var _0x4c46c8={'where':_0x494b25[_0x38e2('0x41')]};return db[_0x38e2('0x36')][_0x38e2('0x2c')](_0x4c46c8)['then'](function(_0x883ec3){_0x499962[_0x38e2('0x2c')]=_0x883ec3;if(_0x39c973['query'][_0x38e2('0x48')]){_0x494b25[_0x38e2('0x49')]=[{'all':!![]}];}return db[_0x38e2('0x36')][_0x38e2('0x4a')](_0x494b25);})['then'](function(_0x3feb3f){_0x499962[_0x38e2('0x4b')]=_0x3feb3f;return _0x499962;})['then'](respondWithFilteredResult(_0x431627,_0x494b25))[_0x38e2('0x27')](handleError(_0x431627,null));};exports[_0x38e2('0x4c')]=function(_0x3f5e55,_0x553abe){var _0x7fb3fa={'raw':!![],'where':{'id':_0x3f5e55[_0x38e2('0x4d')]['id']}},_0x28b43a={};_0x28b43a[_0x38e2('0x38')]=_[_0x38e2('0x39')](db[_0x38e2('0x36')][_0x38e2('0x37')]);_0x28b43a['query']=_[_0x38e2('0x39')](_0x3f5e55[_0x38e2('0x3a')]);_0x28b43a['filters']=_[_0x38e2('0x3c')](_0x28b43a[_0x38e2('0x38')],_0x28b43a[_0x38e2('0x3a')]);_0x7fb3fa['attributes']=_[_0x38e2('0x3c')](_0x28b43a[_0x38e2('0x38')],qs['fields'](_0x3f5e55[_0x38e2('0x3a')][_0x38e2('0x3d')]));_0x7fb3fa['attributes']=_0x7fb3fa['attributes'][_0x38e2('0x4e')]?_0x7fb3fa['attributes']:_0x28b43a[_0x38e2('0x38')];if(_0x3f5e55[_0x38e2('0x3a')]['includeAll']){_0x7fb3fa['include']=[{'all':!![]}];}_0x7fb3fa=_[_0x38e2('0x43')]({},_0x7fb3fa,_0x3f5e55[_0x38e2('0x4f')]);return db[_0x38e2('0x36')][_0x38e2('0x50')](_0x7fb3fa)[_0x38e2('0x1f')](handleEntityNotFound(_0x553abe,null))[_0x38e2('0x1f')](respondWithResult(_0x553abe,null))[_0x38e2('0x27')](handleError(_0x553abe,null));};exports[_0x38e2('0x51')]=function(_0x4e054e,_0x5cf804){return db[_0x38e2('0x36')]['create'](_0x4e054e[_0x38e2('0x52')],{})[_0x38e2('0x1f')](respondWithResult(_0x5cf804,0xc9))[_0x38e2('0x27')](handleError(_0x5cf804,null));};exports['update']=function(_0x1c0c1f,_0x55354b){if(_0x1c0c1f[_0x38e2('0x52')]['id']){delete _0x1c0c1f[_0x38e2('0x52')]['id'];}return db[_0x38e2('0x36')]['find']({'where':{'id':_0x1c0c1f[_0x38e2('0x4d')]['id']}})[_0x38e2('0x1f')](handleEntityNotFound(_0x55354b,null))['then'](saveUpdates(_0x1c0c1f[_0x38e2('0x52')],null))['then'](respondWithResult(_0x55354b,null))[_0x38e2('0x27')](handleError(_0x55354b,null));};exports[_0x38e2('0x31')]=function(_0x27aa24,_0x2ed1e5){return db[_0x38e2('0x36')]['find']({'where':{'id':_0x27aa24['params']['id']}})[_0x38e2('0x1f')](handleEntityNotFound(_0x2ed1e5,null))[_0x38e2('0x1f')](removeEntity(_0x2ed1e5,null))[_0x38e2('0x27')](handleError(_0x2ed1e5,null));};exports[_0x38e2('0x53')]=function(_0xe3244f,_0x205df1){return db[_0x38e2('0x36')][_0x38e2('0x53')]()[_0x38e2('0x1f')](respondWithResult(_0x205df1,null))[_0x38e2('0x27')](handleError(_0x205df1,null));};var interaction_log=require(_0x38e2('0x12'))(_0x38e2('0x54'));exports[_0x38e2('0x55')]=function(_0x4697da,_0x22489b,_0x2d49fb){var _0x241ffb={'channel':_0x38e2('0x56')};if(_0x4697da['body']['id']){delete _0x4697da[_0x38e2('0x52')]['id'];}_0x4697da[_0x38e2('0x52')][_0x38e2('0x57')]=!![];_0x4697da[_0x38e2('0x52')][_0x38e2('0x58')]=moment()[_0x38e2('0x59')](_0x38e2('0x5a'));_0x4697da['body'][_0x38e2('0x5b')]=_0x4697da['body']['UserId']||_0x4697da[_0x38e2('0x5c')]['id'];return db[_0x38e2('0x36')][_0x38e2('0x50')]({'where':{'id':_0x4697da[_0x38e2('0x4d')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x38e2('0x5d')}]})['then'](handleEntityNotFound(_0x22489b,null))[_0x38e2('0x1f')](saveUpdates(_0x4697da['body'],null))[_0x38e2('0x1f')](function(_0x378ab5){if(_0x378ab5){_0x241ffb['message']=_0x378ab5[_0x38e2('0x5e')]({'plain':!![]});return db[_0x38e2('0x5f')]['find']({'where':{'id':_0x378ab5['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x22489b,null))[_0x38e2('0x1f')](function(_0x296151){if(_0x296151){return _0x296151[_0x38e2('0x60')]({'UserId':_0x4697da[_0x38e2('0x52')][_0x38e2('0x5b')],'read1stAt':_[_0x38e2('0x61')](_0x296151[_0x38e2('0x62')])?moment()['format'](_0x38e2('0x5a')):undefined});}return null;})['then'](function(_0x4a58ad){if(_0x4a58ad){_0x241ffb[_0x38e2('0x63')]=_0x4a58ad['get']({'plain':!![]});interaction_log[_0x38e2('0x20')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4697da[_0x38e2('0x5c')]['id'],_0x4697da[_0x38e2('0x5c')][_0x38e2('0x33')],_0x4697da[_0x38e2('0x5c')][_0x38e2('0x64')],_0x241ffb[_0x38e2('0x63')]['id'],_0x4697da[_0x38e2('0x52')]?JSON[_0x38e2('0x65')](_0x4697da['body']):_0x38e2('0x66'));return respondWithRpcPromise(_0x38e2('0x67'),_0x38e2('0x68'),_0x241ffb);}return null;})['then'](function(_0x2c5d49){if(_0x2c5d49){if(_0x4697da['body'][_0x38e2('0x69')]){_0x241ffb[_0x38e2('0x25')][_0x38e2('0x6a')]=util[_0x38e2('0x59')](_0x38e2('0x6b'),_0x4697da[_0x38e2('0x5c')][_0x38e2('0x33')]);_0x241ffb[_0x38e2('0x25')][_0x38e2('0x6c')]=_0x241ffb[_0x38e2('0x6c')];_0x241ffb[_0x38e2('0x25')][_0x38e2('0x6d')]=_0x38e2('0x55');return respondWithRpcPromise(_0x38e2('0x6e'),_0x38e2('0x6e'),{'event':_0x38e2('0x6f'),'message':_[_0x38e2('0x43')](_0x241ffb[_0x38e2('0x25')],JSON['parse'](_0x241ffb[_0x38e2('0x63')][_0x38e2('0x70')]))},client9002)[_0x38e2('0x1f')](function(){return _0x241ffb;});}return _0x241ffb;}return null;})[_0x38e2('0x1f')](respondWithResult(_0x22489b,null))['catch'](handleError(_0x22489b,null));};var interaction_log=require(_0x38e2('0x12'))('chat-interactions');exports[_0x38e2('0x30')]=function(_0x18c5fc,_0x1c47a8,_0x385011){var _0x4155c3={'agent':{},'channel':_0x38e2('0x56')};if(_0x18c5fc[_0x38e2('0x52')]['id']){delete _0x18c5fc[_0x38e2('0x52')]['id'];}_0x18c5fc['body'][_0x38e2('0x5b')]=_0x18c5fc['body']['UserId']||_0x18c5fc[_0x38e2('0x5c')]['id'];_0x4155c3[_0x38e2('0x71')]['id']=_0x18c5fc[_0x38e2('0x52')][_0x38e2('0x5b')];return db[_0x38e2('0x36')][_0x38e2('0x50')]({'where':{'id':_0x18c5fc['params']['id'],'UserId':null}})[_0x38e2('0x1f')](handleEntityNotFound(_0x1c47a8,null))['then'](function(_0x15fd19){if(_0x15fd19){_0x4155c3['message']=_0x15fd19[_0x38e2('0x5e')]({'plain':!![]});return db[_0x38e2('0x5f')]['find']({'where':{'id':_0x15fd19['ChatInteractionId']}});}return null;})[_0x38e2('0x1f')](handleEntityNotFound(_0x1c47a8,null))[_0x38e2('0x1f')](function(_0x3d25d9){if(_0x3d25d9){_0x4155c3['interaction']=_0x3d25d9[_0x38e2('0x5e')]({'plain':!![]});interaction_log[_0x38e2('0x20')](_0x38e2('0x72'),_0x18c5fc[_0x38e2('0x5c')]['id'],_0x18c5fc[_0x38e2('0x5c')][_0x38e2('0x33')],_0x18c5fc[_0x38e2('0x5c')][_0x38e2('0x64')],_0x4155c3[_0x38e2('0x63')]['id'],_0x18c5fc[_0x38e2('0x52')]?JSON[_0x38e2('0x65')](_0x18c5fc[_0x38e2('0x52')]):'null');return respondWithRpcPromise(_0x38e2('0x73'),'rejectMessage',_0x4155c3);}return null;})['then'](function(_0x4f2128){if(_0x4f2128){_0x4f2128[_0x38e2('0x25')][_0x38e2('0x6a')]=util['format'](_0x38e2('0x6b'),_0x18c5fc[_0x38e2('0x5c')]['name']);_0x4f2128[_0x38e2('0x25')][_0x38e2('0x6c')]=_0x4155c3[_0x38e2('0x6c')];_0x4f2128[_0x38e2('0x25')][_0x38e2('0x6d')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x4f2128[_0x38e2('0x25')]},client9002);return _0x4155c3;}return null;})[_0x38e2('0x1f')](respondWithResult(_0x1c47a8,null))['catch'](handleError(_0x1c47a8,null));};
\ No newline at end of file
+var _0xa9e0=['destroy','end','stack','name','send','index','ChatMessage','rawAttributes','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','chat-interactions','chat','read','readAt','UserId','user','CmContact','ChatInteraction','ChatInteractionId','update','isNil','format','YYYY-MM-DD\x20HH:mm:ss','get','role','interaction','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x642e61,_0x51399d){var _0x5e9a6f=function(_0xeb6f5e){while(--_0xeb6f5e){_0x642e61['push'](_0x642e61['shift']());}};_0x5e9a6f(++_0x51399d);}(_0xa9e0,0x137));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require(_0x0a9e('0x3'));var rp=require(_0x0a9e('0x4'));var moment=require('moment');var BPromise=require(_0x0a9e('0x5'));var Mustache=require(_0x0a9e('0x6'));var util=require(_0x0a9e('0x7'));var path=require(_0x0a9e('0x8'));var sox=require(_0x0a9e('0x9'));var csv=require('to-csv');var ejs=require(_0x0a9e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0a9e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require(_0x0a9e('0xd'));var querystring=require(_0x0a9e('0xe'));var Papa=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var hardwareService=require(_0x0a9e('0x11'));var Redis=require(_0x0a9e('0x12'));var qs=require(_0x0a9e('0x13'));var logger=require(_0x0a9e('0x14'))(_0x0a9e('0x15'));var utils=require(_0x0a9e('0x16'));var config=require(_0x0a9e('0x17'));var db=require('../../mysqldb')['db'];config[_0x0a9e('0x18')]=_[_0x0a9e('0x19')](config[_0x0a9e('0x18')],{'host':_0x0a9e('0x1a'),'port':0x18eb});var socket=require(_0x0a9e('0x1b'))(new Redis(config['redis']));require(_0x0a9e('0x1c'))[_0x0a9e('0x1d')](socket);var jayson=require(_0x0a9e('0x1e'));var client=jayson[_0x0a9e('0x1f')][_0x0a9e('0x20')]({'port':0x232c});var client9002=jayson[_0x0a9e('0x1f')][_0x0a9e('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2c60bb,_0x2a6d3d,_0x50c90e,_0x15fa70){return new BPromise(function(_0x5450b9,_0x1d28a2){var _0x129a8b=_0x15fa70||client;return _0x129a8b[_0x0a9e('0x21')](_0x2c60bb,_0x50c90e)[_0x0a9e('0x22')](function(_0x4fce6b){logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x2a6d3d,'request\x20sent');logger[_0x0a9e('0x25')](_0x0a9e('0x26'),_0x2a6d3d,'request\x20sent',JSON[_0x0a9e('0x27')](_0x4fce6b));if(_0x4fce6b[_0x0a9e('0x28')]){if(_0x4fce6b[_0x0a9e('0x28')][_0x0a9e('0x29')]===0x1f4){logger[_0x0a9e('0x28')]('ChatMessage,\x20%s,\x20%s',_0x2a6d3d,_0x4fce6b[_0x0a9e('0x28')][_0x0a9e('0x2a')]);return _0x1d28a2(_0x4fce6b['error']['message']);}logger[_0x0a9e('0x28')]('ChatMessage,\x20%s,\x20%s',_0x2a6d3d,_0x4fce6b['error']['message']);return _0x5450b9(_0x4fce6b[_0x0a9e('0x28')][_0x0a9e('0x2a')]);}else{logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x2a6d3d,_0x0a9e('0x2b'));_0x5450b9(_0x4fce6b[_0x0a9e('0x2c')][_0x0a9e('0x2a')]);}})['catch'](function(_0x39bd52){logger[_0x0a9e('0x28')](_0x0a9e('0x24'),_0x2a6d3d,_0x39bd52);_0x1d28a2(_0x39bd52);});});}function respondWithStatusCode(_0x3c1ee2,_0x166532){_0x166532=_0x166532||0xcc;return function(_0x2a1f81){if(_0x2a1f81){return _0x3c1ee2[_0x0a9e('0x2d')](_0x166532);}return _0x3c1ee2[_0x0a9e('0x2e')](_0x166532)['end']();};}function respondWithResult(_0x4a151e,_0x2d13af){_0x2d13af=_0x2d13af||0xc8;return function(_0x4d8146){if(_0x4d8146){return _0x4a151e[_0x0a9e('0x2e')](_0x2d13af)[_0x0a9e('0x2f')](_0x4d8146);}};}function respondWithFilteredResult(_0x4d0efa,_0x165093){return function(_0x1e7a09){if(_0x1e7a09){var _0x5815e5=_0x1e7a09[_0x0a9e('0x30')],_0x753fe6=_0x165093['offset'],_0x3d1a81=_0x165093[_0x0a9e('0x31')]+_0x165093[_0x0a9e('0x32')],_0x95cf32;if(_0x3d1a81>=_0x5815e5){_0x3d1a81=_0x5815e5;_0x95cf32=0xc8;}else{_0x95cf32=0xce;}_0x4d0efa['status'](_0x95cf32);return _0x4d0efa[_0x0a9e('0x33')](_0x0a9e('0x34'),_0x753fe6+'-'+_0x3d1a81+'/'+_0x5815e5)[_0x0a9e('0x2f')](_0x1e7a09);}return null;};}function patchUpdates(_0x47682c){return function(_0x768eb4){try{jsonpatch[_0x0a9e('0x35')](_0x768eb4,_0x47682c,!![]);}catch(_0x271820){return BPromise[_0x0a9e('0x36')](_0x271820);}return _0x768eb4['save']();};}function saveUpdates(_0x6b317e,_0x4c6532){return function(_0x35de37){if(_0x35de37){return _0x35de37['update'](_0x6b317e)['then'](function(_0x4774e5){return _0x4774e5;});}return null;};}function removeEntity(_0x1fca7d,_0x3a7684){return function(_0x393565){if(_0x393565){return _0x393565[_0x0a9e('0x37')]()[_0x0a9e('0x22')](function(){_0x1fca7d[_0x0a9e('0x2e')](0xcc)[_0x0a9e('0x38')]();});}};}function handleEntityNotFound(_0x4f857f,_0x2481f0){return function(_0x57923e){if(!_0x57923e){_0x4f857f[_0x0a9e('0x2d')](0x194);}return _0x57923e;};}function handleError(_0x3c2e2d,_0x57a5ec){_0x57a5ec=_0x57a5ec||0x1f4;return function(_0x59880f){logger[_0x0a9e('0x28')](_0x59880f[_0x0a9e('0x39')]);if(_0x59880f[_0x0a9e('0x3a')]){delete _0x59880f[_0x0a9e('0x3a')];}_0x3c2e2d[_0x0a9e('0x2e')](_0x57a5ec)[_0x0a9e('0x3b')](_0x59880f);};}exports[_0x0a9e('0x3c')]=function(_0x4ec553,_0xe8606c){var _0x4b5b55={},_0x109af3={},_0x5d5443={'count':0x0,'rows':[]};var _0x24c3bc=db[_0x0a9e('0x3d')][_0x0a9e('0x3e')];_0x109af3[_0x0a9e('0x3f')]=_[_0x0a9e('0x40')](_0x24c3bc);_0x109af3['query']=_['keys'](_0x4ec553[_0x0a9e('0x41')]);_0x109af3[_0x0a9e('0x42')]=_[_0x0a9e('0x43')](_0x109af3[_0x0a9e('0x3f')],_0x109af3[_0x0a9e('0x41')]);_0x4b5b55['attributes']=_[_0x0a9e('0x43')](_0x109af3['model'],qs['fields'](_0x4ec553[_0x0a9e('0x41')]['fields']));_0x4b5b55[_0x0a9e('0x44')]=_0x4b5b55[_0x0a9e('0x44')][_0x0a9e('0x45')]?_0x4b5b55[_0x0a9e('0x44')]:_0x109af3[_0x0a9e('0x3f')];if(!_0x4ec553[_0x0a9e('0x41')][_0x0a9e('0x46')](_0x0a9e('0x47'))){_0x4b5b55[_0x0a9e('0x32')]=qs['limit'](_0x4ec553['query'][_0x0a9e('0x32')]);_0x4b5b55['offset']=qs[_0x0a9e('0x31')](_0x4ec553[_0x0a9e('0x41')]['offset']);}_0x4b5b55['order']=qs[_0x0a9e('0x48')](_0x4ec553[_0x0a9e('0x41')][_0x0a9e('0x48')]);_0x4b5b55[_0x0a9e('0x49')]=qs[_0x0a9e('0x42')](_['pick'](_0x4ec553[_0x0a9e('0x41')],_0x109af3[_0x0a9e('0x42')]));if(_0x4ec553[_0x0a9e('0x41')][_0x0a9e('0x4a')]){_0x4b5b55[_0x0a9e('0x49')]=_[_0x0a9e('0x4b')](_0x4b5b55[_0x0a9e('0x49')],{'$or':_['map'](_0x24c3bc,function(_0x17426e){if(_0x17426e[_0x0a9e('0x4c')][_0x0a9e('0x4d')]!==_0x0a9e('0x4e')){var _0x4b398e={};_0x4b398e[_0x17426e[_0x0a9e('0x4f')]]={'$like':'%'+_0x4ec553[_0x0a9e('0x41')][_0x0a9e('0x4a')]+'%'};return _0x4b398e;}})});}_0x4b5b55=_['merge']({},_0x4b5b55,_0x4ec553[_0x0a9e('0x50')]);var _0x2e1934={'where':_0x4b5b55['where']};return db[_0x0a9e('0x3d')][_0x0a9e('0x30')](_0x2e1934)[_0x0a9e('0x22')](function(_0x25af3d){_0x5d5443[_0x0a9e('0x30')]=_0x25af3d;if(_0x4ec553[_0x0a9e('0x41')][_0x0a9e('0x51')]){_0x4b5b55[_0x0a9e('0x52')]=[{'all':!![]}];}return db[_0x0a9e('0x3d')][_0x0a9e('0x53')](_0x4b5b55);})[_0x0a9e('0x22')](function(_0x16f487){_0x5d5443[_0x0a9e('0x54')]=_0x16f487;return _0x5d5443;})['then'](respondWithFilteredResult(_0xe8606c,_0x4b5b55))[_0x0a9e('0x55')](handleError(_0xe8606c,null));};exports[_0x0a9e('0x56')]=function(_0x518b31,_0x40044f){var _0x1d1f7b={'raw':!![],'where':{'id':_0x518b31[_0x0a9e('0x57')]['id']}},_0xbcafbe={};_0xbcafbe['model']=_[_0x0a9e('0x40')](db[_0x0a9e('0x3d')][_0x0a9e('0x3e')]);_0xbcafbe[_0x0a9e('0x41')]=_[_0x0a9e('0x40')](_0x518b31[_0x0a9e('0x41')]);_0xbcafbe['filters']=_[_0x0a9e('0x43')](_0xbcafbe['model'],_0xbcafbe[_0x0a9e('0x41')]);_0x1d1f7b[_0x0a9e('0x44')]=_[_0x0a9e('0x43')](_0xbcafbe[_0x0a9e('0x3f')],qs[_0x0a9e('0x58')](_0x518b31[_0x0a9e('0x41')]['fields']));_0x1d1f7b[_0x0a9e('0x44')]=_0x1d1f7b[_0x0a9e('0x44')][_0x0a9e('0x45')]?_0x1d1f7b[_0x0a9e('0x44')]:_0xbcafbe['model'];if(_0x518b31[_0x0a9e('0x41')]['includeAll']){_0x1d1f7b[_0x0a9e('0x52')]=[{'all':!![]}];}_0x1d1f7b=_[_0x0a9e('0x4b')]({},_0x1d1f7b,_0x518b31['options']);return db[_0x0a9e('0x3d')][_0x0a9e('0x59')](_0x1d1f7b)[_0x0a9e('0x22')](handleEntityNotFound(_0x40044f,null))['then'](respondWithResult(_0x40044f,null))['catch'](handleError(_0x40044f,null));};exports[_0x0a9e('0x5a')]=function(_0x2ffb5e,_0x359103){return db[_0x0a9e('0x3d')]['create'](_0x2ffb5e['body'],{})[_0x0a9e('0x22')](respondWithResult(_0x359103,0xc9))['catch'](handleError(_0x359103,null));};exports['update']=function(_0x466cb0,_0x41e9ca){if(_0x466cb0[_0x0a9e('0x5b')]['id']){delete _0x466cb0[_0x0a9e('0x5b')]['id'];}return db[_0x0a9e('0x3d')][_0x0a9e('0x59')]({'where':{'id':_0x466cb0['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x41e9ca,null))[_0x0a9e('0x22')](saveUpdates(_0x466cb0[_0x0a9e('0x5b')],null))[_0x0a9e('0x22')](respondWithResult(_0x41e9ca,null))[_0x0a9e('0x55')](handleError(_0x41e9ca,null));};exports[_0x0a9e('0x37')]=function(_0x453727,_0x453111){return db[_0x0a9e('0x3d')][_0x0a9e('0x59')]({'where':{'id':_0x453727[_0x0a9e('0x57')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x453111,null))['then'](removeEntity(_0x453111,null))[_0x0a9e('0x55')](handleError(_0x453111,null));};exports['describe']=function(_0x5e0607,_0x3fc90a){return db['ChatMessage']['describe']()['then'](respondWithResult(_0x3fc90a,null))[_0x0a9e('0x55')](handleError(_0x3fc90a,null));};var interaction_log=require('../../config/logger')(_0x0a9e('0x5c'));exports['accept']=function(_0x2607a8,_0x2c71f7,_0x218901){var _0x483e4b={'channel':_0x0a9e('0x5d')};if(_0x2607a8[_0x0a9e('0x5b')]['id']){delete _0x2607a8[_0x0a9e('0x5b')]['id'];}_0x2607a8['body'][_0x0a9e('0x5e')]=!![];_0x2607a8[_0x0a9e('0x5b')][_0x0a9e('0x5f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2607a8[_0x0a9e('0x5b')][_0x0a9e('0x60')]=_0x2607a8['body']['UserId']||_0x2607a8[_0x0a9e('0x61')]['id'];return db[_0x0a9e('0x3d')][_0x0a9e('0x59')]({'where':{'id':_0x2607a8[_0x0a9e('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x0a9e('0x62')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x2c71f7,null))[_0x0a9e('0x22')](saveUpdates(_0x2607a8[_0x0a9e('0x5b')],null))[_0x0a9e('0x22')](function(_0x4b04b4){if(_0x4b04b4){_0x483e4b[_0x0a9e('0x2a')]=_0x4b04b4['get']({'plain':!![]});return db[_0x0a9e('0x63')][_0x0a9e('0x59')]({'where':{'id':_0x4b04b4[_0x0a9e('0x64')]}});}return null;})[_0x0a9e('0x22')](handleEntityNotFound(_0x2c71f7,null))[_0x0a9e('0x22')](function(_0xf6fd41){if(_0xf6fd41){return _0xf6fd41[_0x0a9e('0x65')]({'UserId':_0x2607a8[_0x0a9e('0x5b')][_0x0a9e('0x60')],'read1stAt':_[_0x0a9e('0x66')](_0xf6fd41['read1stAt'])?moment()[_0x0a9e('0x67')](_0x0a9e('0x68')):undefined});}return null;})['then'](function(_0x590611){if(_0x590611){_0x483e4b['interaction']=_0x590611[_0x0a9e('0x69')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2607a8[_0x0a9e('0x61')]['id'],_0x2607a8[_0x0a9e('0x61')][_0x0a9e('0x3a')],_0x2607a8['user'][_0x0a9e('0x6a')],_0x483e4b[_0x0a9e('0x6b')]['id'],_0x2607a8[_0x0a9e('0x5b')]?JSON[_0x0a9e('0x27')](_0x2607a8['body']):'null');return respondWithRpcPromise('AcceptMessage',_0x0a9e('0x6c'),_0x483e4b);}return null;})[_0x0a9e('0x22')](function(_0x5810b6){if(_0x5810b6){if(_0x2607a8[_0x0a9e('0x5b')][_0x0a9e('0x6d')]){_0x483e4b[_0x0a9e('0x2a')][_0x0a9e('0x6e')]=util[_0x0a9e('0x67')](_0x0a9e('0x6f'),_0x2607a8[_0x0a9e('0x61')][_0x0a9e('0x3a')]);_0x483e4b['message'][_0x0a9e('0x70')]=_0x483e4b['channel'];_0x483e4b['message'][_0x0a9e('0x71')]='accept';return respondWithRpcPromise('EventManager',_0x0a9e('0x72'),{'event':_0x0a9e('0x73'),'message':_[_0x0a9e('0x4b')](_0x483e4b[_0x0a9e('0x2a')],JSON[_0x0a9e('0x74')](_0x483e4b[_0x0a9e('0x6b')][_0x0a9e('0x75')]))},client9002)[_0x0a9e('0x22')](function(){return _0x483e4b;});}return _0x483e4b;}return null;})[_0x0a9e('0x22')](respondWithResult(_0x2c71f7,null))[_0x0a9e('0x55')](handleError(_0x2c71f7,null));};var interaction_log=require(_0x0a9e('0x14'))(_0x0a9e('0x5c'));exports[_0x0a9e('0x36')]=function(_0x5e67dc,_0x301d74,_0x270870){var _0x6a1c7a={'agent':{},'channel':_0x0a9e('0x5d')};if(_0x5e67dc[_0x0a9e('0x5b')]['id']){delete _0x5e67dc[_0x0a9e('0x5b')]['id'];}_0x5e67dc[_0x0a9e('0x5b')][_0x0a9e('0x60')]=_0x5e67dc[_0x0a9e('0x5b')]['UserId']||_0x5e67dc[_0x0a9e('0x61')]['id'];_0x6a1c7a[_0x0a9e('0x76')]['id']=_0x5e67dc[_0x0a9e('0x5b')][_0x0a9e('0x60')];return db[_0x0a9e('0x3d')][_0x0a9e('0x59')]({'where':{'id':_0x5e67dc[_0x0a9e('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x301d74,null))[_0x0a9e('0x22')](function(_0x851bc7){if(_0x851bc7){_0x6a1c7a['message']=_0x851bc7[_0x0a9e('0x69')]({'plain':!![]});return db[_0x0a9e('0x63')][_0x0a9e('0x59')]({'where':{'id':_0x851bc7[_0x0a9e('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x301d74,null))[_0x0a9e('0x22')](function(_0x361048){if(_0x361048){_0x6a1c7a[_0x0a9e('0x6b')]=_0x361048['get']({'plain':!![]});interaction_log[_0x0a9e('0x23')](_0x0a9e('0x77'),_0x5e67dc[_0x0a9e('0x61')]['id'],_0x5e67dc[_0x0a9e('0x61')]['name'],_0x5e67dc[_0x0a9e('0x61')][_0x0a9e('0x6a')],_0x6a1c7a[_0x0a9e('0x6b')]['id'],_0x5e67dc[_0x0a9e('0x5b')]?JSON[_0x0a9e('0x27')](_0x5e67dc[_0x0a9e('0x5b')]):_0x0a9e('0x78'));return respondWithRpcPromise(_0x0a9e('0x79'),'rejectMessage',_0x6a1c7a);}return null;})['then'](function(_0x52f37f){if(_0x52f37f){_0x52f37f[_0x0a9e('0x2a')][_0x0a9e('0x6e')]=util['format']('SIP/%s',_0x5e67dc[_0x0a9e('0x61')][_0x0a9e('0x3a')]);_0x52f37f[_0x0a9e('0x2a')][_0x0a9e('0x70')]=_0x6a1c7a[_0x0a9e('0x70')];_0x52f37f[_0x0a9e('0x2a')]['event']=_0x0a9e('0x36');respondWithRpcPromise(_0x0a9e('0x72'),_0x0a9e('0x72'),{'event':'rejectmessage','message':_0x52f37f['message']},client9002);return _0x6a1c7a;}return null;})[_0x0a9e('0x22')](respondWithResult(_0x301d74,null))[_0x0a9e('0x55')](handleError(_0x301d74,null));};
\ No newline at end of file
index 4db77d7..f059c25 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x851c=['../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x851c,0x19d));var _0xc851=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x851c[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require(_0xc851('0x0'));var ChatMessage=require(_0xc851('0x1'))['db'][_0xc851('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xc851('0x3')](0x0);var events={'afterCreate':_0xc851('0x4'),'afterUpdate':_0xc851('0x5'),'afterDestroy':_0xc851('0x6')};function emitEvent(_0x4ad892){return function(_0x2fddd4,_0x84f5ad,_0x52374b){ChatMessageEvents[_0xc851('0x7')](_0x4ad892+':'+_0x2fddd4['id'],_0x2fddd4);ChatMessageEvents[_0xc851('0x7')](_0x4ad892,_0x2fddd4);_0x52374b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xc851('0x8')](e,emitEvent(event));}}module['exports']=ChatMessageEvents;
\ No newline at end of file
+var _0x9750=['hasOwnProperty','hook','exports','../../mysqldb','ChatMessage','save','emit'];(function(_0x41cf23,_0x1e9868){var _0x4b1514=function(_0x10d58f){while(--_0x10d58f){_0x41cf23['push'](_0x41cf23['shift']());}};_0x4b1514(++_0x1e9868);}(_0x9750,0x199));var _0x0975=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x9750[_0x55e08b];return _0xd1a7ff;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x0975('0x0'))['db'][_0x0975('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0975('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xeced26){return function(_0xb67316,_0x90aa74,_0x25510b){ChatMessageEvents[_0x0975('0x3')](_0xeced26+':'+_0xb67316['id'],_0xb67316);ChatMessageEvents[_0x0975('0x3')](_0xeced26,_0xb67316);_0x25510b(null);};}for(var e in events){if(events[_0x0975('0x4')](e)){var event=events[e];ChatMessage[_0x0975('0x5')](e,emitEvent(event));}}module[_0x0975('0x6')]=ChatMessageEvents;
\ No newline at end of file
index 647a0d8..ef8f8b2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4f34=['then','update','createdAt','body','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./chatMessage.attributes','define','ChatMessage','chat_messages','models','get','direction','toLowerCase','out','ChatInteraction','findOne'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f34,0xae));var _0x44f3=function(_0x8dc508,_0x2e43e0){_0x8dc508=_0x8dc508-0x0;var _0x387733=_0x4f34[_0x8dc508];return _0x387733;};'use strict';var _=require(_0x44f3('0x0'));var util=require(_0x44f3('0x1'));var logger=require(_0x44f3('0x2'))(_0x44f3('0x3'));var moment=require(_0x44f3('0x4'));var BPromise=require(_0x44f3('0x5'));var rp=require(_0x44f3('0x6'));var attributes=require(_0x44f3('0x7'));module['exports']=function(_0x3c5e88,_0x33b6ac){return _0x3c5e88[_0x44f3('0x8')](_0x44f3('0x9'),attributes,{'tableName':_0x44f3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xc9527e,_0x5ddf10,_0x3e28f4){var _0x5bcf28=_0x3c5e88[_0x44f3('0xb')];var _0x3df47b=_0xc9527e[_0x44f3('0xc')]({'plain':!![]});if(_0x3df47b[_0x44f3('0xd')][_0x44f3('0xe')]()==='in'||_0x3df47b[_0x44f3('0xd')][_0x44f3('0xe')]()===_0x44f3('0xf')&&!_0x3df47b['secret']&&!_['isNil'](_0x3df47b['UserId'])){_0x5bcf28[_0x44f3('0x10')][_0x44f3('0x11')]({'where':{'id':_0x3df47b['ChatInteractionId']}})[_0x44f3('0x12')](function(_0xd78d84){if(_0xd78d84){_0xd78d84[_0x44f3('0x13')]({'lastMsgAt':_0x3df47b[_0x44f3('0x14')],'lastMsgDirection':_0x3df47b[_0x44f3('0xd')][_0x44f3('0xe')](),'lastMsgBody':_0x3df47b[_0x44f3('0x15')]});}})['catch'](function(_0x125c76){console[_0x44f3('0x16')](_0x125c76);});}_0x3e28f4();}},'charset':'utf8mb4','collate':_0x44f3('0x17')});};
\ No newline at end of file
+var _0x8da1=['createdAt','catch','../../config/logger','api','moment','bluebird','request-promise','./chatMessage.attributes','exports','define','chat_messages','get','toLowerCase','direction','out','secret','isNil','UserId','findOne','ChatInteractionId','update'];(function(_0x484997,_0x41989d){var _0x192786=function(_0x48939d){while(--_0x48939d){_0x484997['push'](_0x484997['shift']());}};_0x192786(++_0x41989d);}(_0x8da1,0x1a6));var _0x18da=function(_0x329664,_0x130748){_0x329664=_0x329664-0x0;var _0x4e346e=_0x8da1[_0x329664];return _0x4e346e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x18da('0x0'))(_0x18da('0x1'));var moment=require(_0x18da('0x2'));var BPromise=require(_0x18da('0x3'));var rp=require(_0x18da('0x4'));var attributes=require(_0x18da('0x5'));module[_0x18da('0x6')]=function(_0x4a70ae,_0x2d95ac){return _0x4a70ae[_0x18da('0x7')]('ChatMessage',attributes,{'tableName':_0x18da('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5e55d0,_0x4fd348,_0x349199){var _0x22ff47=_0x4a70ae['models'];var _0x49023a=_0x5e55d0[_0x18da('0x9')]({'plain':!![]});if(_0x49023a['direction'][_0x18da('0xa')]()==='in'||_0x49023a[_0x18da('0xb')]['toLowerCase']()===_0x18da('0xc')&&!_0x49023a[_0x18da('0xd')]&&!_[_0x18da('0xe')](_0x49023a[_0x18da('0xf')])){_0x22ff47['ChatInteraction'][_0x18da('0x10')]({'where':{'id':_0x49023a[_0x18da('0x11')]}})['then'](function(_0x509e5b){if(_0x509e5b){_0x509e5b[_0x18da('0x12')]({'lastMsgAt':_0x49023a[_0x18da('0x13')],'lastMsgDirection':_0x49023a[_0x18da('0xb')][_0x18da('0xa')](),'lastMsgBody':_0x49023a['body']});}})[_0x18da('0x14')](function(_0x5f39aa){console['error'](_0x5f39aa);});}_0x349199();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file
index b15137a..0c9d178 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4369=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','ChatMessage,\x20%s,\x20%s','debug','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','stringify','lodash','util'];(function(_0x13b330,_0x297092){var _0x1f666c=function(_0x5ebc84){while(--_0x5ebc84){_0x13b330['push'](_0x13b330['shift']());}};_0x1f666c(++_0x297092);}(_0x4369,0xec));var _0x9436=function(_0x3acee8,_0x5f3924){_0x3acee8=_0x3acee8-0x0;var _0x5046cc=_0x4369[_0x3acee8];return _0x5046cc;};'use strict';var _=require(_0x9436('0x0'));var util=require(_0x9436('0x1'));var moment=require('moment');var BPromise=require(_0x9436('0x2'));var rs=require(_0x9436('0x3'));var fs=require('fs');var Redis=require(_0x9436('0x4'));var db=require(_0x9436('0x5'))['db'];var utils=require(_0x9436('0x6'));var logger=require(_0x9436('0x7'))(_0x9436('0x8'));var config=require(_0x9436('0x9'));var jayson=require(_0x9436('0xa'));var client=jayson[_0x9436('0xb')][_0x9436('0xc')]({'port':0x232a});config[_0x9436('0xd')]=_['defaults'](config[_0x9436('0xd')],{'host':_0x9436('0xe'),'port':0x18eb});var socket=require(_0x9436('0xf'))(new Redis(config['redis']));require('./chatMessage.socket')[_0x9436('0x10')](socket);function respondWithRpcPromise(_0x3f5a1c,_0x81f35e,_0x29f826){return new BPromise(function(_0x168143,_0x17ce36){return client[_0x9436('0x11')](_0x3f5a1c,_0x29f826)[_0x9436('0x12')](function(_0x1f07d){logger[_0x9436('0x13')](_0x9436('0x14'),_0x81f35e,'request\x20sent');logger[_0x9436('0x15')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x81f35e,'request\x20sent',JSON['stringify'](_0x1f07d));if(_0x1f07d[_0x9436('0x16')]){if(_0x1f07d[_0x9436('0x16')][_0x9436('0x17')]===0x1f4){logger[_0x9436('0x16')](_0x9436('0x14'),_0x81f35e,_0x1f07d[_0x9436('0x16')]['message']);return _0x17ce36(_0x1f07d['error'][_0x9436('0x18')]);}logger[_0x9436('0x16')](_0x9436('0x14'),_0x81f35e,_0x1f07d['error'][_0x9436('0x18')]);return _0x168143(_0x1f07d[_0x9436('0x16')][_0x9436('0x18')]);}else{logger[_0x9436('0x13')](_0x9436('0x14'),_0x81f35e,'request\x20sent');_0x168143(_0x1f07d[_0x9436('0x19')][_0x9436('0x18')]);}})[_0x9436('0x1a')](function(_0x2781aa){logger[_0x9436('0x16')](_0x9436('0x14'),_0x81f35e,_0x2781aa);_0x17ce36(_0x2781aa);});});}exports[_0x9436('0x1b')]=function(_0x1da79c){var _0x1ffbcd=this;return new Promise(function(_0x2c6ca3,_0x576f72){return db[_0x9436('0x1c')][_0x9436('0x1d')](_0x1da79c[_0x9436('0x1e')],{'raw':_0x1da79c[_0x9436('0x1f')]?_0x1da79c[_0x9436('0x1f')][_0x9436('0x20')]===undefined?!![]:![]:!![]})[_0x9436('0x12')](function(_0x442a49){logger[_0x9436('0x13')]('CreateChatMessage',_0x1da79c);logger[_0x9436('0x15')](_0x9436('0x1b'),_0x1da79c,JSON[_0x9436('0x21')](_0x442a49));_0x2c6ca3(_0x442a49);})['catch'](function(_0x41fe09){logger[_0x9436('0x16')](_0x9436('0x1b'),_0x41fe09[_0x9436('0x18')],_0x1da79c);_0x576f72(_0x1ffbcd[_0x9436('0x16')](0x1f4,_0x41fe09['message']));});});};
\ No newline at end of file
+var _0x46f9=['info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateChatMessage','ChatMessage','body','options','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then'];(function(_0x4b137e,_0x134b9f){var _0x24a8be=function(_0x568c4f){while(--_0x568c4f){_0x4b137e['push'](_0x4b137e['shift']());}};_0x24a8be(++_0x134b9f);}(_0x46f9,0x1b2));var _0x946f=function(_0xd2337d,_0xae5fd7){_0xd2337d=_0xd2337d-0x0;var _0x5c1662=_0x46f9[_0xd2337d];return _0x5c1662;};'use strict';var _=require(_0x946f('0x0'));var util=require(_0x946f('0x1'));var moment=require(_0x946f('0x2'));var BPromise=require(_0x946f('0x3'));var rs=require(_0x946f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x946f('0x5'))('rpc');var config=require(_0x946f('0x6'));var jayson=require(_0x946f('0x7'));var client=jayson[_0x946f('0x8')]['http']({'port':0x232a});config[_0x946f('0x9')]=_[_0x946f('0xa')](config[_0x946f('0x9')],{'host':_0x946f('0xb'),'port':0x18eb});var socket=require(_0x946f('0xc'))(new Redis(config[_0x946f('0x9')]));require('./chatMessage.socket')[_0x946f('0xd')](socket);function respondWithRpcPromise(_0x206551,_0xdd6521,_0x582f91){return new BPromise(function(_0x460ce3,_0x3df067){return client[_0x946f('0xe')](_0x206551,_0x582f91)[_0x946f('0xf')](function(_0x31791e){logger[_0x946f('0x10')](_0x946f('0x11'),_0xdd6521,_0x946f('0x12'));logger[_0x946f('0x13')](_0x946f('0x14'),_0xdd6521,_0x946f('0x12'),JSON[_0x946f('0x15')](_0x31791e));if(_0x31791e[_0x946f('0x16')]){if(_0x31791e[_0x946f('0x16')]['code']===0x1f4){logger['error'](_0x946f('0x11'),_0xdd6521,_0x31791e[_0x946f('0x16')][_0x946f('0x17')]);return _0x3df067(_0x31791e[_0x946f('0x16')]['message']);}logger['error'](_0x946f('0x11'),_0xdd6521,_0x31791e['error']['message']);return _0x460ce3(_0x31791e[_0x946f('0x16')]['message']);}else{logger[_0x946f('0x10')](_0x946f('0x11'),_0xdd6521,_0x946f('0x12'));_0x460ce3(_0x31791e[_0x946f('0x18')][_0x946f('0x17')]);}})[_0x946f('0x19')](function(_0x5a8165){logger[_0x946f('0x16')](_0x946f('0x11'),_0xdd6521,_0x5a8165);_0x3df067(_0x5a8165);});});}exports[_0x946f('0x1a')]=function(_0x206c66){var _0x5dd1e3=this;return new Promise(function(_0xf06aaa,_0x59ca63){return db[_0x946f('0x1b')]['create'](_0x206c66[_0x946f('0x1c')],{'raw':_0x206c66[_0x946f('0x1d')]?_0x206c66[_0x946f('0x1d')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x295b01){logger[_0x946f('0x10')](_0x946f('0x1a'),_0x206c66);logger['debug'](_0x946f('0x1a'),_0x206c66,JSON[_0x946f('0x15')](_0x295b01));_0xf06aaa(_0x295b01);})[_0x946f('0x19')](function(_0xd4bae7){logger[_0x946f('0x16')](_0x946f('0x1a'),_0xd4bae7['message'],_0x206c66);_0x59ca63(_0x5dd1e3[_0x946f('0x16')](0x1f4,_0xd4bae7[_0x946f('0x17')]));});});};
\ No newline at end of file
index 1d5c361..6b3aa8c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xedd9=['removeListener','register','length','chatMessage:','save','remove','update','emit'];(function(_0x1ace9c,_0xc832d3){var _0x322cb3=function(_0x5d9983){while(--_0x5d9983){_0x1ace9c['push'](_0x1ace9c['shift']());}};_0x322cb3(++_0xc832d3);}(_0xedd9,0xfc));var _0x9edd=function(_0x5969b1,_0x8cb0d5){_0x5969b1=_0x5969b1-0x0;var _0x1dd7be=_0xedd9[_0x5969b1];return _0x1dd7be;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x9edd('0x0'),_0x9edd('0x1'),_0x9edd('0x2')];function createListener(_0x2c16b8,_0x3b51bc){return function(_0x127cbe){_0x3b51bc[_0x9edd('0x3')](_0x2c16b8,_0x127cbe);};}function removeListener(_0x36b53f,_0x5943b3){return function(){ChatMessageEvents[_0x9edd('0x4')](_0x36b53f,_0x5943b3);};}exports[_0x9edd('0x5')]=function(_0x268f9e){for(var _0x34c1a7=0x0,_0x5319f7=events[_0x9edd('0x6')];_0x34c1a7<_0x5319f7;_0x34c1a7++){var _0x571af9=events[_0x34c1a7];var _0x172522=createListener(_0x9edd('0x7')+_0x571af9,_0x268f9e);ChatMessageEvents['on'](_0x571af9,_0x172522);}};
\ No newline at end of file
+var _0x9c44=['emit','removeListener','length','chatMessage:','remove','update'];(function(_0xbcf386,_0x37d02c){var _0x235c52=function(_0x1bdf3c){while(--_0x1bdf3c){_0xbcf386['push'](_0xbcf386['shift']());}};_0x235c52(++_0x37d02c);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0x49c4('0x0'),_0x49c4('0x1')];function createListener(_0x26844b,_0x1ba0bb){return function(_0x455700){_0x1ba0bb[_0x49c4('0x2')](_0x26844b,_0x455700);};}function removeListener(_0x4e0313,_0x4941f1){return function(){ChatMessageEvents[_0x49c4('0x3')](_0x4e0313,_0x4941f1);};}exports['register']=function(_0xc1278f){for(var _0x6030ae=0x0,_0x69bc41=events[_0x49c4('0x4')];_0x6030ae<_0x69bc41;_0x6030ae++){var _0x436234=events[_0x6030ae];var _0x511d53=createListener(_0x49c4('0x5')+_0x436234,_0xc1278f);ChatMessageEvents['on'](_0x436234,_0x511d53);}};
\ No newline at end of file
index 6c85a04..2028332 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfc9b=['express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','chat','chatmessage:create','create','put','update','/:id/accept','reject','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc9b,0x74));var _0xbfc9=function(_0x4e1c41,_0x2043ef){_0x4e1c41=_0x4e1c41-0x0;var _0x466bd5=_0xfc9b[_0x4e1c41];return _0x466bd5;};'use strict';var multer=require(_0xbfc9('0x0'));var util=require(_0xbfc9('0x1'));var path=require(_0xbfc9('0x2'));var timeout=require(_0xbfc9('0x3'));var express=require(_0xbfc9('0x4'));var router=express[_0xbfc9('0x5')]();var auth=require(_0xbfc9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbfc9('0x7'));var controller=require('./chatMessage.controller');router[_0xbfc9('0x8')]('/',auth[_0xbfc9('0x9')](),controller['index']);router[_0xbfc9('0x8')](_0xbfc9('0xa'),auth[_0xbfc9('0x9')](),controller[_0xbfc9('0xb')]);router['get'](_0xbfc9('0xc'),auth['isAuthenticated'](),controller[_0xbfc9('0xd')]);router['post']('/',auth[_0xbfc9('0x9')](),interaction['tracked'](_0xbfc9('0xe'),_0xbfc9('0xf')),controller[_0xbfc9('0x10')]);router[_0xbfc9('0x11')](_0xbfc9('0xc'),controller[_0xbfc9('0x12')]);router['put'](_0xbfc9('0x13'),auth[_0xbfc9('0x9')](),controller['accept']);router[_0xbfc9('0x11')]('/:id/reject',auth[_0xbfc9('0x9')](),controller[_0xbfc9('0x14')]);router[_0xbfc9('0x15')](_0xbfc9('0xc'),auth['isAuthenticated'](),controller[_0xbfc9('0x16')]);module[_0xbfc9('0x17')]=router;
\ No newline at end of file
+var _0x19d5=['describe','show','post','chat','chatmessage:create','create','put','/:id','update','/:id/accept','accept','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x5dc2dc,_0x5442ae){var _0x1f666b=function(_0x2b44b7){while(--_0x2b44b7){_0x5dc2dc['push'](_0x5dc2dc['shift']());}};_0x1f666b(++_0x5442ae);}(_0x19d5,0xaf));var _0x519d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x19d5[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x519d('0x0'));var util=require(_0x519d('0x1'));var path=require(_0x519d('0x2'));var timeout=require(_0x519d('0x3'));var express=require(_0x519d('0x4'));var router=express[_0x519d('0x5')]();var auth=require(_0x519d('0x6'));var interaction=require(_0x519d('0x7'));var config=require(_0x519d('0x8'));var controller=require(_0x519d('0x9'));router[_0x519d('0xa')]('/',auth[_0x519d('0xb')](),controller[_0x519d('0xc')]);router['get'](_0x519d('0xd'),auth[_0x519d('0xb')](),controller[_0x519d('0xe')]);router[_0x519d('0xa')]('/:id',auth[_0x519d('0xb')](),controller[_0x519d('0xf')]);router[_0x519d('0x10')]('/',auth[_0x519d('0xb')](),interaction['tracked'](_0x519d('0x11'),_0x519d('0x12')),controller[_0x519d('0x13')]);router[_0x519d('0x14')](_0x519d('0x15'),controller[_0x519d('0x16')]);router[_0x519d('0x14')](_0x519d('0x17'),auth[_0x519d('0xb')](),controller[_0x519d('0x18')]);router['put']('/:id/reject',auth[_0x519d('0xb')](),controller['reject']);router['delete'](_0x519d('0x15'),auth['isAuthenticated'](),controller[_0x519d('0x19')]);module[_0x519d('0x1a')]=router;
\ No newline at end of file
index 44b6899..da90b49 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5f02=['medium','sequelize','TEXT'];(function(_0x243fd3,_0x25e8d3){var _0x1575b7=function(_0x44d893){while(--_0x44d893){_0x243fd3['push'](_0x243fd3['shift']());}};_0x1575b7(++_0x25e8d3);}(_0x5f02,0x160));var _0x25f0=function(_0x2c5712,_0x4ae482){_0x2c5712=_0x2c5712-0x0;var _0x512717=_0x5f02[_0x2c5712];return _0x512717;};'use strict';var Sequelize=require(_0x25f0('0x0'));module['exports']={'body':{'type':Sequelize[_0x25f0('0x1')](_0x25f0('0x2')),'allowNull':![]}};
\ No newline at end of file
+var _0x847b=['sequelize','exports','medium'];(function(_0x31b7ac,_0x289b3f){var _0x4191dd=function(_0x1ad6f1){while(--_0x1ad6f1){_0x31b7ac['push'](_0x31b7ac['shift']());}};_0x4191dd(++_0x289b3f);}(_0x847b,0x16b));var _0xb847=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x847b[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0xb847('0x0'));module[_0xb847('0x1')]={'body':{'type':Sequelize['TEXT'](_0xb847('0x2')),'allowNull':![]}};
\ No newline at end of file
index 5eb52a7..3e34672 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x13af=['jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','offset','limit','set','json','reject','save','destroy','status','error','name','index','ChatOfflineMessage','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','map','key','VIRTUAL','field','options','then','count','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','update','eml-format','request-promise','moment','bluebird','path','sox','to-csv','ejs','crypto'];(function(_0x51f6bb,_0x20ce4c){var _0x4acef1=function(_0x3a0a45){while(--_0x3a0a45){_0x51f6bb['push'](_0x51f6bb['shift']());}};_0x4acef1(++_0x20ce4c);}(_0x13af,0x1b7));var _0xf13a=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0x13af[_0x576170];return _0x397c70;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf13a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf13a('0x1'));var moment=require(_0xf13a('0x2'));var BPromise=require(_0xf13a('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf13a('0x4'));var sox=require(_0xf13a('0x5'));var csv=require(_0xf13a('0x6'));var ejs=require(_0xf13a('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf13a('0x8'));var jsforce=require(_0xf13a('0x9'));var deskjs=require(_0xf13a('0xa'));var toCsv=require('to-csv');var querystring=require(_0xf13a('0xb'));var Papa=require(_0xf13a('0xc'));var authService=require('../../components/auth/service');var hardwareService=require(_0xf13a('0xd'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xf13a('0xe'))(_0xf13a('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xf13a('0x10'))['db'];function respondWithStatusCode(_0x16ff64,_0x30c670){_0x30c670=_0x30c670||0xcc;return function(_0x1a232f){if(_0x1a232f){return _0x16ff64[_0xf13a('0x11')](_0x30c670);}return _0x16ff64['status'](_0x30c670)[_0xf13a('0x12')]();};}function respondWithResult(_0x23337c,_0x41cfbb){_0x41cfbb=_0x41cfbb||0xc8;return function(_0x4a1d0c){if(_0x4a1d0c){return _0x23337c['status'](_0x41cfbb)['json'](_0x4a1d0c);}};}function respondWithFilteredResult(_0x211ad3,_0x57579d){return function(_0x27379a){if(_0x27379a){var _0x3ab4c4=_0x27379a['count'],_0x212718=_0x57579d[_0xf13a('0x13')],_0x24765d=_0x57579d[_0xf13a('0x13')]+_0x57579d[_0xf13a('0x14')],_0x2e5f47;if(_0x24765d>=_0x3ab4c4){_0x24765d=_0x3ab4c4;_0x2e5f47=0xc8;}else{_0x2e5f47=0xce;}_0x211ad3['status'](_0x2e5f47);return _0x211ad3[_0xf13a('0x15')]('Content-Range',_0x212718+'-'+_0x24765d+'/'+_0x3ab4c4)[_0xf13a('0x16')](_0x27379a);}return null;};}function patchUpdates(_0x2b984f){return function(_0x4231a9){try{jsonpatch['apply'](_0x4231a9,_0x2b984f,!![]);}catch(_0x48df2d){return BPromise[_0xf13a('0x17')](_0x48df2d);}return _0x4231a9[_0xf13a('0x18')]();};}function saveUpdates(_0x273535,_0xeccdb){return function(_0x6292d7){if(_0x6292d7){return _0x6292d7['update'](_0x273535)['then'](function(_0x1c46d2){return _0x1c46d2;});}return null;};}function removeEntity(_0x1d587b,_0x44cac1){return function(_0x5c9086){if(_0x5c9086){return _0x5c9086[_0xf13a('0x19')]()['then'](function(){_0x1d587b[_0xf13a('0x1a')](0xcc)[_0xf13a('0x12')]();});}};}function handleEntityNotFound(_0x37fec3,_0x3fe102){return function(_0x548a22){if(!_0x548a22){_0x37fec3[_0xf13a('0x11')](0x194);}return _0x548a22;};}function handleError(_0xff4a4e,_0x3d873b){_0x3d873b=_0x3d873b||0x1f4;return function(_0x4b0e7d){logger[_0xf13a('0x1b')](_0x4b0e7d['stack']);if(_0x4b0e7d[_0xf13a('0x1c')]){delete _0x4b0e7d[_0xf13a('0x1c')];}_0xff4a4e[_0xf13a('0x1a')](_0x3d873b)['send'](_0x4b0e7d);};}exports[_0xf13a('0x1d')]=function(_0x5ca65b,_0x53d916){var _0x4c1594={},_0xcdea40={},_0x170be9={'count':0x0,'rows':[]};var _0x2d23fd=db[_0xf13a('0x1e')]['rawAttributes'];_0xcdea40[_0xf13a('0x1f')]=_['keys'](_0x2d23fd);_0xcdea40[_0xf13a('0x20')]=_['keys'](_0x5ca65b[_0xf13a('0x20')]);_0xcdea40['filters']=_[_0xf13a('0x21')](_0xcdea40[_0xf13a('0x1f')],_0xcdea40['query']);_0x4c1594[_0xf13a('0x22')]=_['intersection'](_0xcdea40[_0xf13a('0x1f')],qs[_0xf13a('0x23')](_0x5ca65b[_0xf13a('0x20')][_0xf13a('0x23')]));_0x4c1594[_0xf13a('0x22')]=_0x4c1594['attributes'][_0xf13a('0x24')]?_0x4c1594['attributes']:_0xcdea40[_0xf13a('0x1f')];if(!_0x5ca65b[_0xf13a('0x20')][_0xf13a('0x25')](_0xf13a('0x26'))){_0x4c1594['limit']=qs[_0xf13a('0x14')](_0x5ca65b[_0xf13a('0x20')][_0xf13a('0x14')]);_0x4c1594[_0xf13a('0x13')]=qs[_0xf13a('0x13')](_0x5ca65b[_0xf13a('0x20')]['offset']);}_0x4c1594['order']=qs[_0xf13a('0x27')](_0x5ca65b[_0xf13a('0x20')][_0xf13a('0x27')]);_0x4c1594['where']=qs[_0xf13a('0x28')](_[_0xf13a('0x29')](_0x5ca65b['query'],_0xcdea40[_0xf13a('0x28')]));if(_0x5ca65b[_0xf13a('0x20')][_0xf13a('0x2a')]){_0x4c1594[_0xf13a('0x2b')]=_[_0xf13a('0x2c')](_0x4c1594[_0xf13a('0x2b')],{'$or':_[_0xf13a('0x2d')](_0x2d23fd,function(_0x245bb3){if(_0x245bb3['type'][_0xf13a('0x2e')]!==_0xf13a('0x2f')){var _0x4bd691={};_0x4bd691[_0x245bb3[_0xf13a('0x30')]]={'$like':'%'+_0x5ca65b[_0xf13a('0x20')]['filter']+'%'};return _0x4bd691;}})});}_0x4c1594=_[_0xf13a('0x2c')]({},_0x4c1594,_0x5ca65b[_0xf13a('0x31')]);var _0x2986b9={'where':_0x4c1594[_0xf13a('0x2b')]};return db[_0xf13a('0x1e')]['count'](_0x2986b9)[_0xf13a('0x32')](function(_0x3a48b1){_0x170be9[_0xf13a('0x33')]=_0x3a48b1;if(_0x5ca65b['query'][_0xf13a('0x34')]){_0x4c1594[_0xf13a('0x35')]=[{'all':!![]}];}return db[_0xf13a('0x1e')][_0xf13a('0x36')](_0x4c1594);})['then'](function(_0x1d1715){_0x170be9[_0xf13a('0x37')]=_0x1d1715;return _0x170be9;})[_0xf13a('0x32')](respondWithFilteredResult(_0x53d916,_0x4c1594))['catch'](handleError(_0x53d916,null));};exports[_0xf13a('0x38')]=function(_0xc2a841,_0x42652f){var _0x18f32f={'raw':!![],'where':{'id':_0xc2a841[_0xf13a('0x39')]['id']}},_0x30aecf={};_0x30aecf[_0xf13a('0x1f')]=_[_0xf13a('0x3a')](db[_0xf13a('0x1e')]['rawAttributes']);_0x30aecf['query']=_[_0xf13a('0x3a')](_0xc2a841[_0xf13a('0x20')]);_0x30aecf[_0xf13a('0x28')]=_['intersection'](_0x30aecf[_0xf13a('0x1f')],_0x30aecf[_0xf13a('0x20')]);_0x18f32f[_0xf13a('0x22')]=_[_0xf13a('0x21')](_0x30aecf['model'],qs[_0xf13a('0x23')](_0xc2a841[_0xf13a('0x20')][_0xf13a('0x23')]));_0x18f32f['attributes']=_0x18f32f[_0xf13a('0x22')]['length']?_0x18f32f[_0xf13a('0x22')]:_0x30aecf[_0xf13a('0x1f')];if(_0xc2a841[_0xf13a('0x20')][_0xf13a('0x34')]){_0x18f32f[_0xf13a('0x35')]=[{'all':!![]}];}_0x18f32f=_['merge']({},_0x18f32f,_0xc2a841[_0xf13a('0x31')]);return db[_0xf13a('0x1e')][_0xf13a('0x3b')](_0x18f32f)[_0xf13a('0x32')](handleEntityNotFound(_0x42652f,null))[_0xf13a('0x32')](respondWithResult(_0x42652f,null))['catch'](handleError(_0x42652f,null));};exports[_0xf13a('0x3c')]=function(_0x1b9a0d,_0x161dbc){return db['ChatOfflineMessage']['create'](_0x1b9a0d[_0xf13a('0x3d')],{})[_0xf13a('0x32')](respondWithResult(_0x161dbc,0xc9))[_0xf13a('0x3e')](handleError(_0x161dbc,null));};exports[_0xf13a('0x3f')]=function(_0x2c6d06,_0x4afd0c){if(_0x2c6d06[_0xf13a('0x3d')]['id']){delete _0x2c6d06[_0xf13a('0x3d')]['id'];}return db[_0xf13a('0x1e')][_0xf13a('0x3b')]({'where':{'id':_0x2c6d06[_0xf13a('0x39')]['id']}})[_0xf13a('0x32')](handleEntityNotFound(_0x4afd0c,null))[_0xf13a('0x32')](saveUpdates(_0x2c6d06[_0xf13a('0x3d')],null))['then'](respondWithResult(_0x4afd0c,null))[_0xf13a('0x3e')](handleError(_0x4afd0c,null));};exports['destroy']=function(_0x161da6,_0xa0c9f2){return db[_0xf13a('0x1e')]['find']({'where':{'id':_0x161da6[_0xf13a('0x39')]['id']}})[_0xf13a('0x32')](handleEntityNotFound(_0xa0c9f2,null))[_0xf13a('0x32')](removeEntity(_0xa0c9f2,null))[_0xf13a('0x3e')](handleError(_0xa0c9f2,null));};exports['describe']=function(_0x140c88,_0x13e3be){return db['ChatOfflineMessage']['describe']()['then'](respondWithResult(_0x13e3be,null))['catch'](handleError(_0x13e3be,null));};
\ No newline at end of file
+var _0xb032=['then','destroy','end','stack','name','send','ChatOfflineMessage','model','query','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','pick','merge','map','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','create','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','set','save','update'];(function(_0x152121,_0x120c53){var _0x592a85=function(_0x241cab){while(--_0x241cab){_0x152121['push'](_0x152121['shift']());}};_0x592a85(++_0x120c53);}(_0xb032,0x180));var _0x2b03=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0xb032[_0x4ae829];return _0x256b31;};'use strict';var pdf=require(_0x2b03('0x0'));var emlformat=require(_0x2b03('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2b03('0x2'));var jsonpatch=require(_0x2b03('0x3'));var rp=require(_0x2b03('0x4'));var moment=require(_0x2b03('0x5'));var BPromise=require(_0x2b03('0x6'));var Mustache=require(_0x2b03('0x7'));var util=require(_0x2b03('0x8'));var path=require(_0x2b03('0x9'));var sox=require(_0x2b03('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2b03('0xb'));var squel=require(_0x2b03('0xc'));var crypto=require(_0x2b03('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2b03('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2b03('0xf'));var authService=require(_0x2b03('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0x2b03('0x11'));var logger=require(_0x2b03('0x12'))(_0x2b03('0x13'));var utils=require(_0x2b03('0x14'));var config=require(_0x2b03('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30a56f,_0x16eaee){_0x16eaee=_0x16eaee||0xcc;return function(_0x114754){if(_0x114754){return _0x30a56f[_0x2b03('0x16')](_0x16eaee);}return _0x30a56f[_0x2b03('0x17')](_0x16eaee)['end']();};}function respondWithResult(_0x19ee57,_0x430be0){_0x430be0=_0x430be0||0xc8;return function(_0x2f4388){if(_0x2f4388){return _0x19ee57['status'](_0x430be0)[_0x2b03('0x18')](_0x2f4388);}};}function respondWithFilteredResult(_0x58c8cc,_0x2717bc){return function(_0x445eb2){if(_0x445eb2){var _0x15a97e=_0x445eb2[_0x2b03('0x19')],_0x3f927c=_0x2717bc['offset'],_0x2ee5d9=_0x2717bc[_0x2b03('0x1a')]+_0x2717bc['limit'],_0x454aa2;if(_0x2ee5d9>=_0x15a97e){_0x2ee5d9=_0x15a97e;_0x454aa2=0xc8;}else{_0x454aa2=0xce;}_0x58c8cc[_0x2b03('0x17')](_0x454aa2);return _0x58c8cc[_0x2b03('0x1b')]('Content-Range',_0x3f927c+'-'+_0x2ee5d9+'/'+_0x15a97e)[_0x2b03('0x18')](_0x445eb2);}return null;};}function patchUpdates(_0x4cc735){return function(_0x56a45f){try{jsonpatch['apply'](_0x56a45f,_0x4cc735,!![]);}catch(_0x170fe8){return BPromise['reject'](_0x170fe8);}return _0x56a45f[_0x2b03('0x1c')]();};}function saveUpdates(_0x19cf0c,_0x5aa662){return function(_0x1bdf80){if(_0x1bdf80){return _0x1bdf80[_0x2b03('0x1d')](_0x19cf0c)[_0x2b03('0x1e')](function(_0x205f32){return _0x205f32;});}return null;};}function removeEntity(_0x14674c,_0x1a6079){return function(_0x59b48f){if(_0x59b48f){return _0x59b48f[_0x2b03('0x1f')]()[_0x2b03('0x1e')](function(){_0x14674c['status'](0xcc)[_0x2b03('0x20')]();});}};}function handleEntityNotFound(_0x10b4ce,_0x1ff130){return function(_0x279ef9){if(!_0x279ef9){_0x10b4ce[_0x2b03('0x16')](0x194);}return _0x279ef9;};}function handleError(_0x412fe6,_0x38ffcd){_0x38ffcd=_0x38ffcd||0x1f4;return function(_0x4b2806){logger['error'](_0x4b2806[_0x2b03('0x21')]);if(_0x4b2806['name']){delete _0x4b2806[_0x2b03('0x22')];}_0x412fe6['status'](_0x38ffcd)[_0x2b03('0x23')](_0x4b2806);};}exports['index']=function(_0x4d9be0,_0x496581){var _0x1d9810={},_0x494762={},_0x329536={'count':0x0,'rows':[]};var _0x39b2e9=db[_0x2b03('0x24')]['rawAttributes'];_0x494762[_0x2b03('0x25')]=_['keys'](_0x39b2e9);_0x494762['query']=_['keys'](_0x4d9be0[_0x2b03('0x26')]);_0x494762[_0x2b03('0x27')]=_[_0x2b03('0x28')](_0x494762[_0x2b03('0x25')],_0x494762['query']);_0x1d9810[_0x2b03('0x29')]=_[_0x2b03('0x28')](_0x494762['model'],qs[_0x2b03('0x2a')](_0x4d9be0['query'][_0x2b03('0x2a')]));_0x1d9810['attributes']=_0x1d9810[_0x2b03('0x29')]['length']?_0x1d9810['attributes']:_0x494762[_0x2b03('0x25')];if(!_0x4d9be0[_0x2b03('0x26')]['hasOwnProperty'](_0x2b03('0x2b'))){_0x1d9810[_0x2b03('0x2c')]=qs[_0x2b03('0x2c')](_0x4d9be0[_0x2b03('0x26')][_0x2b03('0x2c')]);_0x1d9810[_0x2b03('0x1a')]=qs[_0x2b03('0x1a')](_0x4d9be0[_0x2b03('0x26')][_0x2b03('0x1a')]);}_0x1d9810[_0x2b03('0x2d')]=qs['sort'](_0x4d9be0['query'][_0x2b03('0x2e')]);_0x1d9810[_0x2b03('0x2f')]=qs[_0x2b03('0x27')](_[_0x2b03('0x30')](_0x4d9be0[_0x2b03('0x26')],_0x494762['filters']));if(_0x4d9be0[_0x2b03('0x26')]['filter']){_0x1d9810['where']=_[_0x2b03('0x31')](_0x1d9810[_0x2b03('0x2f')],{'$or':_[_0x2b03('0x32')](_0x39b2e9,function(_0xabdd8b){if(_0xabdd8b[_0x2b03('0x33')][_0x2b03('0x34')]!==_0x2b03('0x35')){var _0x1706eb={};_0x1706eb[_0xabdd8b[_0x2b03('0x36')]]={'$like':'%'+_0x4d9be0[_0x2b03('0x26')]['filter']+'%'};return _0x1706eb;}})});}_0x1d9810=_[_0x2b03('0x31')]({},_0x1d9810,_0x4d9be0[_0x2b03('0x37')]);var _0x5e6296={'where':_0x1d9810[_0x2b03('0x2f')]};return db[_0x2b03('0x24')][_0x2b03('0x19')](_0x5e6296)[_0x2b03('0x1e')](function(_0x43b3ad){_0x329536[_0x2b03('0x19')]=_0x43b3ad;if(_0x4d9be0['query'][_0x2b03('0x38')]){_0x1d9810[_0x2b03('0x39')]=[{'all':!![]}];}return db[_0x2b03('0x24')][_0x2b03('0x3a')](_0x1d9810);})[_0x2b03('0x1e')](function(_0x5f463f){_0x329536[_0x2b03('0x3b')]=_0x5f463f;return _0x329536;})[_0x2b03('0x1e')](respondWithFilteredResult(_0x496581,_0x1d9810))[_0x2b03('0x3c')](handleError(_0x496581,null));};exports[_0x2b03('0x3d')]=function(_0x1c27b8,_0x9e1042){var _0x5721a4={'raw':!![],'where':{'id':_0x1c27b8[_0x2b03('0x3e')]['id']}},_0x4d63a5={};_0x4d63a5[_0x2b03('0x25')]=_['keys'](db[_0x2b03('0x24')][_0x2b03('0x3f')]);_0x4d63a5['query']=_[_0x2b03('0x40')](_0x1c27b8[_0x2b03('0x26')]);_0x4d63a5[_0x2b03('0x27')]=_[_0x2b03('0x28')](_0x4d63a5['model'],_0x4d63a5[_0x2b03('0x26')]);_0x5721a4['attributes']=_[_0x2b03('0x28')](_0x4d63a5['model'],qs[_0x2b03('0x2a')](_0x1c27b8[_0x2b03('0x26')][_0x2b03('0x2a')]));_0x5721a4[_0x2b03('0x29')]=_0x5721a4[_0x2b03('0x29')]['length']?_0x5721a4[_0x2b03('0x29')]:_0x4d63a5[_0x2b03('0x25')];if(_0x1c27b8[_0x2b03('0x26')][_0x2b03('0x38')]){_0x5721a4[_0x2b03('0x39')]=[{'all':!![]}];}_0x5721a4=_['merge']({},_0x5721a4,_0x1c27b8['options']);return db[_0x2b03('0x24')]['find'](_0x5721a4)[_0x2b03('0x1e')](handleEntityNotFound(_0x9e1042,null))['then'](respondWithResult(_0x9e1042,null))['catch'](handleError(_0x9e1042,null));};exports[_0x2b03('0x41')]=function(_0x52dbde,_0x428d28){return db['ChatOfflineMessage'][_0x2b03('0x41')](_0x52dbde['body'],{})['then'](respondWithResult(_0x428d28,0xc9))['catch'](handleError(_0x428d28,null));};exports[_0x2b03('0x1d')]=function(_0x4a8095,_0x2812e6){if(_0x4a8095[_0x2b03('0x42')]['id']){delete _0x4a8095['body']['id'];}return db[_0x2b03('0x24')][_0x2b03('0x43')]({'where':{'id':_0x4a8095[_0x2b03('0x3e')]['id']}})[_0x2b03('0x1e')](handleEntityNotFound(_0x2812e6,null))['then'](saveUpdates(_0x4a8095[_0x2b03('0x42')],null))[_0x2b03('0x1e')](respondWithResult(_0x2812e6,null))['catch'](handleError(_0x2812e6,null));};exports['destroy']=function(_0x171b4d,_0x2916bd){return db[_0x2b03('0x24')][_0x2b03('0x43')]({'where':{'id':_0x171b4d['params']['id']}})[_0x2b03('0x1e')](handleEntityNotFound(_0x2916bd,null))['then'](removeEntity(_0x2916bd,null))['catch'](handleError(_0x2916bd,null));};exports[_0x2b03('0x44')]=function(_0x59b8d3,_0x30ddd6){return db['ChatOfflineMessage'][_0x2b03('0x44')]()[_0x2b03('0x1e')](respondWithResult(_0x30ddd6,null))[_0x2b03('0x3c')](handleError(_0x30ddd6,null));};
\ No newline at end of file
index 1789c2c..5419aab 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x18d4=['../../config/logger','api','moment','request-promise','exports','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x473079,_0x4aa14b){var _0x138470=function(_0x4b68af){while(--_0x4b68af){_0x473079['push'](_0x473079['shift']());}};_0x138470(++_0x4aa14b);}(_0x18d4,0x171));var _0x418d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x18d4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x418d('0x0'));var util=require('util');var logger=require(_0x418d('0x1'))(_0x418d('0x2'));var moment=require(_0x418d('0x3'));var BPromise=require('bluebird');var rp=require(_0x418d('0x4'));var attributes=require('./chatOfflineMessage.attributes');module[_0x418d('0x5')]=function(_0x5c3914,_0x143c95){return _0x5c3914['define'](_0x418d('0x6'),attributes,{'tableName':_0x418d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x418d('0x8'),'collate':_0x418d('0x9')});};
\ No newline at end of file
+var _0xc24b=['moment','bluebird','request-promise','./chatOfflineMessage.attributes','define','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x374eb5,_0xfb75e5){var _0x3a5bf8=function(_0x3d8ebd){while(--_0x3d8ebd){_0x374eb5['push'](_0x374eb5['shift']());}};_0x3a5bf8(++_0xfb75e5);}(_0xc24b,0x8a));var _0xbc24=function(_0x4697fa,_0x21c841){_0x4697fa=_0x4697fa-0x0;var _0x390950=_0xc24b[_0x4697fa];return _0x390950;};'use strict';var _=require(_0xbc24('0x0'));var util=require(_0xbc24('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbc24('0x2'));var BPromise=require(_0xbc24('0x3'));var rp=require(_0xbc24('0x4'));var attributes=require(_0xbc24('0x5'));module['exports']=function(_0x2c4ee,_0x5c7edb){return _0x2c4ee[_0xbc24('0x6')](_0xbc24('0x7'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbc24('0x8'),'collate':_0xbc24('0x9')});};
\ No newline at end of file
index f6a666c..b125fd9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6a9c=['jayson/promise','http','request','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x404437,_0x2f0ef1){var _0x274d56=function(_0x5c0651){while(--_0x5c0651){_0x404437['push'](_0x404437['shift']());}};_0x274d56(++_0x2f0ef1);}(_0x6a9c,0xd4));var _0xc6a9=function(_0x20c5e6,_0x3c6a2e){_0x20c5e6=_0x20c5e6-0x0;var _0x113d30=_0x6a9c[_0x20c5e6];return _0x113d30;};'use strict';var _=require(_0xc6a9('0x0'));var util=require('util');var moment=require(_0xc6a9('0x1'));var BPromise=require(_0xc6a9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc6a9('0x3'));var db=require(_0xc6a9('0x4'))['db'];var utils=require(_0xc6a9('0x5'));var logger=require('../../config/logger')(_0xc6a9('0x6'));var config=require(_0xc6a9('0x7'));var jayson=require(_0xc6a9('0x8'));var client=jayson['client'][_0xc6a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x38a84d,_0x19d748,_0x2ba081){return new BPromise(function(_0x25dfae,_0x507bda){return client[_0xc6a9('0xa')](_0x38a84d,_0x2ba081)['then'](function(_0x2a37af){logger['info'](_0xc6a9('0xb'),_0x19d748,_0xc6a9('0xc'));logger[_0xc6a9('0xd')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x19d748,_0xc6a9('0xc'),JSON[_0xc6a9('0xe')](_0x2a37af));if(_0x2a37af[_0xc6a9('0xf')]){if(_0x2a37af['error'][_0xc6a9('0x10')]===0x1f4){logger[_0xc6a9('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x19d748,_0x2a37af['error'][_0xc6a9('0x11')]);return _0x507bda(_0x2a37af[_0xc6a9('0xf')][_0xc6a9('0x11')]);}logger[_0xc6a9('0xf')](_0xc6a9('0xb'),_0x19d748,_0x2a37af['error'][_0xc6a9('0x11')]);return _0x25dfae(_0x2a37af[_0xc6a9('0xf')]['message']);}else{logger[_0xc6a9('0x12')](_0xc6a9('0xb'),_0x19d748,_0xc6a9('0xc'));_0x25dfae(_0x2a37af['result'][_0xc6a9('0x11')]);}})[_0xc6a9('0x13')](function(_0x5c595a){logger['error'](_0xc6a9('0xb'),_0x19d748,_0x5c595a);_0x507bda(_0x5c595a);});});}
\ No newline at end of file
+var _0x4dca=['request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info'];(function(_0x141c01,_0x1556f0){var _0x49e963=function(_0x5ca1de){while(--_0x5ca1de){_0x141c01['push'](_0x141c01['shift']());}};_0x49e963(++_0x1556f0);}(_0x4dca,0x184));var _0xa4dc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4dca[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa4dc('0x0'));var util=require(_0xa4dc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa4dc('0x2'));var fs=require('fs');var Redis=require(_0xa4dc('0x3'));var db=require(_0xa4dc('0x4'))['db'];var utils=require(_0xa4dc('0x5'));var logger=require(_0xa4dc('0x6'))('rpc');var config=require(_0xa4dc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa4dc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42b1a8,_0x1987e2,_0x9942ec){return new BPromise(function(_0x56a5c5,_0x18ffe9){return client[_0xa4dc('0x9')](_0x42b1a8,_0x9942ec)[_0xa4dc('0xa')](function(_0x14dcfb){logger[_0xa4dc('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1987e2,_0xa4dc('0xc'));logger['debug'](_0xa4dc('0xd'),_0x1987e2,_0xa4dc('0xc'),JSON['stringify'](_0x14dcfb));if(_0x14dcfb[_0xa4dc('0xe')]){if(_0x14dcfb[_0xa4dc('0xe')][_0xa4dc('0xf')]===0x1f4){logger[_0xa4dc('0xe')](_0xa4dc('0x10'),_0x1987e2,_0x14dcfb[_0xa4dc('0xe')][_0xa4dc('0x11')]);return _0x18ffe9(_0x14dcfb[_0xa4dc('0xe')][_0xa4dc('0x11')]);}logger[_0xa4dc('0xe')](_0xa4dc('0x10'),_0x1987e2,_0x14dcfb[_0xa4dc('0xe')][_0xa4dc('0x11')]);return _0x56a5c5(_0x14dcfb[_0xa4dc('0xe')][_0xa4dc('0x11')]);}else{logger[_0xa4dc('0xb')](_0xa4dc('0x10'),_0x1987e2,'request\x20sent');_0x56a5c5(_0x14dcfb[_0xa4dc('0x12')][_0xa4dc('0x11')]);}})[_0xa4dc('0x13')](function(_0x33f29c){logger[_0xa4dc('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1987e2,_0x33f29c);_0x18ffe9(_0x33f29c);});});}
\ No newline at end of file
index 01bb104..6677457 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb7c8=['Router','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete','exports','util','path','connect-timeout','express'];(function(_0x30599b,_0x40c0e8){var _0x330496=function(_0x202f15){while(--_0x202f15){_0x30599b['push'](_0x30599b['shift']());}};_0x330496(++_0x40c0e8);}(_0xb7c8,0x119));var _0x8b7c=function(_0xd48697,_0x3c4b01){_0xd48697=_0xd48697-0x0;var _0xc7d73d=_0xb7c8[_0xd48697];return _0xc7d73d;};'use strict';var multer=require('multer');var util=require(_0x8b7c('0x0'));var path=require(_0x8b7c('0x1'));var timeout=require(_0x8b7c('0x2'));var express=require(_0x8b7c('0x3'));var router=express[_0x8b7c('0x4')]();var auth=require(_0x8b7c('0x5'));var interaction=require(_0x8b7c('0x6'));var config=require('../../config/environment');var controller=require(_0x8b7c('0x7'));router[_0x8b7c('0x8')]('/',auth[_0x8b7c('0x9')](),controller[_0x8b7c('0xa')]);router[_0x8b7c('0x8')](_0x8b7c('0xb'),auth[_0x8b7c('0x9')](),controller[_0x8b7c('0xc')]);router[_0x8b7c('0x8')](_0x8b7c('0xd'),auth[_0x8b7c('0x9')](),controller[_0x8b7c('0xe')]);router['post']('/',auth[_0x8b7c('0x9')](),controller['create']);router[_0x8b7c('0xf')](_0x8b7c('0xd'),auth['isAuthenticated'](),controller[_0x8b7c('0x10')]);router[_0x8b7c('0x11')](_0x8b7c('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x8b7c('0x12')]=router;
\ No newline at end of file
+var _0x861c=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer'];(function(_0x5e5e58,_0x38489c){var _0x438010=function(_0x2ab91c){while(--_0x2ab91c){_0x5e5e58['push'](_0x5e5e58['shift']());}};_0x438010(++_0x38489c);}(_0x861c,0xdb));var _0xc861=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x861c[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0xc861('0x0'));var util=require(_0xc861('0x1'));var path=require(_0xc861('0x2'));var timeout=require(_0xc861('0x3'));var express=require(_0xc861('0x4'));var router=express[_0xc861('0x5')]();var auth=require(_0xc861('0x6'));var interaction=require(_0xc861('0x7'));var config=require(_0xc861('0x8'));var controller=require(_0xc861('0x9'));router[_0xc861('0xa')]('/',auth[_0xc861('0xb')](),controller['index']);router[_0xc861('0xa')](_0xc861('0xc'),auth[_0xc861('0xb')](),controller[_0xc861('0xd')]);router[_0xc861('0xa')](_0xc861('0xe'),auth[_0xc861('0xb')](),controller[_0xc861('0xf')]);router[_0xc861('0x10')]('/',auth[_0xc861('0xb')](),controller[_0xc861('0x11')]);router[_0xc861('0x12')](_0xc861('0xe'),auth['isAuthenticated'](),controller[_0xc861('0x13')]);router[_0xc861('0x14')](_0xc861('0xe'),auth[_0xc861('0xb')](),controller['destroy']);module[_0xc861('0x15')]=router;
\ No newline at end of file
index 9b93172..d5fbc9a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x54bb=['mouseOver','timeout','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x2493f7,_0x49c670){var _0x594ab2=function(_0x344ec2){while(--_0x344ec2){_0x2493f7['push'](_0x2493f7['shift']());}};_0x594ab2(++_0x49c670);}(_0x54bb,0xb2));var _0xb54b=function(_0x53468a,_0x286986){_0x53468a=_0x53468a-0x0;var _0x205efd=_0x54bb[_0x53468a];return _0x205efd;};'use strict';var Sequelize=require(_0xb54b('0x0'));module[_0xb54b('0x1')]={'name':{'type':Sequelize[_0xb54b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb54b('0x3')](_0xb54b('0x4'),_0xb54b('0x5')),'defaultValue':_0xb54b('0x4')},'selector':{'type':Sequelize[_0xb54b('0x2')]},'timeout':{'type':Sequelize[_0xb54b('0x6')]}};
\ No newline at end of file
+var _0x4c79=['ENUM','mouseOver','timeout','INTEGER','exports','STRING'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x4c79,0xac));var _0x94c7=function(_0x28cea5,_0x522c80){_0x28cea5=_0x28cea5-0x0;var _0x2d406e=_0x4c79[_0x28cea5];return _0x2d406e;};'use strict';var Sequelize=require('sequelize');module[_0x94c7('0x0')]={'name':{'type':Sequelize[_0x94c7('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x94c7('0x2')](_0x94c7('0x3'),_0x94c7('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x94c7('0x1')]},'timeout':{'type':Sequelize[_0x94c7('0x5')]}};
\ No newline at end of file
index 2431045..c2dbc09 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0a09=['set','Content-Range','apply','reject','then','destroy','error','stack','name','show','params','keys','rawAttributes','query','filters','attributes','intersection','model','fields','length','includeAll','include','merge','options','ChatProactiveAction','find','catch','update','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit'];(function(_0x44a70c,_0x549413){var _0x559765=function(_0x381c08){while(--_0x381c08){_0x44a70c['push'](_0x44a70c['shift']());}};_0x559765(++_0x549413);}(_0x0a09,0x1ed));var _0x90a0=function(_0x4e6eb2,_0x16a451){_0x4e6eb2=_0x4e6eb2-0x0;var _0x4e0c1c=_0x0a09[_0x4e6eb2];return _0x4e0c1c;};'use strict';var pdf=require(_0x90a0('0x0'));var emlformat=require(_0x90a0('0x1'));var rimraf=require(_0x90a0('0x2'));var zipdir=require(_0x90a0('0x3'));var jsonpatch=require(_0x90a0('0x4'));var rp=require(_0x90a0('0x5'));var moment=require('moment');var BPromise=require(_0x90a0('0x6'));var Mustache=require('mustache');var util=require(_0x90a0('0x7'));var path=require(_0x90a0('0x8'));var sox=require('sox');var csv=require(_0x90a0('0x9'));var ejs=require(_0x90a0('0xa'));var fs=require('fs');var _=require(_0x90a0('0xb'));var squel=require(_0x90a0('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x90a0('0xd'));var toCsv=require(_0x90a0('0x9'));var querystring=require(_0x90a0('0xe'));var Papa=require(_0x90a0('0xf'));var authService=require(_0x90a0('0x10'));var hardwareService=require(_0x90a0('0x11'));var Redis=require(_0x90a0('0x12'));var qs=require(_0x90a0('0x13'));var logger=require(_0x90a0('0x14'))('api');var utils=require(_0x90a0('0x15'));var config=require(_0x90a0('0x16'));var db=require(_0x90a0('0x17'))['db'];function respondWithStatusCode(_0x51bf90,_0x80cea2){_0x80cea2=_0x80cea2||0xcc;return function(_0x455c38){if(_0x455c38){return _0x51bf90[_0x90a0('0x18')](_0x80cea2);}return _0x51bf90[_0x90a0('0x19')](_0x80cea2)[_0x90a0('0x1a')]();};}function respondWithResult(_0x1fbb08,_0x5b4741){_0x5b4741=_0x5b4741||0xc8;return function(_0xe05726){if(_0xe05726){return _0x1fbb08[_0x90a0('0x19')](_0x5b4741)['json'](_0xe05726);}};}function respondWithFilteredResult(_0xa990e5,_0x58e9a2){return function(_0x5db5dd){if(_0x5db5dd){var _0x2406f4=_0x5db5dd['count'],_0x235d19=_0x58e9a2[_0x90a0('0x1b')],_0x347666=_0x58e9a2[_0x90a0('0x1b')]+_0x58e9a2[_0x90a0('0x1c')],_0xbfff86;if(_0x347666>=_0x2406f4){_0x347666=_0x2406f4;_0xbfff86=0xc8;}else{_0xbfff86=0xce;}_0xa990e5['status'](_0xbfff86);return _0xa990e5[_0x90a0('0x1d')](_0x90a0('0x1e'),_0x235d19+'-'+_0x347666+'/'+_0x2406f4)['json'](_0x5db5dd);}return null;};}function patchUpdates(_0x1a2264){return function(_0x6f659a){try{jsonpatch[_0x90a0('0x1f')](_0x6f659a,_0x1a2264,!![]);}catch(_0x18125a){return BPromise[_0x90a0('0x20')](_0x18125a);}return _0x6f659a['save']();};}function saveUpdates(_0x3ffb5d,_0x2556a9){return function(_0x444581){if(_0x444581){return _0x444581['update'](_0x3ffb5d)[_0x90a0('0x21')](function(_0x20b918){return _0x20b918;});}return null;};}function removeEntity(_0x35462a,_0xc664e1){return function(_0x16d0bc){if(_0x16d0bc){return _0x16d0bc[_0x90a0('0x22')]()[_0x90a0('0x21')](function(){_0x35462a['status'](0xcc)[_0x90a0('0x1a')]();});}};}function handleEntityNotFound(_0xaff968,_0x68e765){return function(_0x3106eb){if(!_0x3106eb){_0xaff968[_0x90a0('0x18')](0x194);}return _0x3106eb;};}function handleError(_0x1ca192,_0x3b79ee){_0x3b79ee=_0x3b79ee||0x1f4;return function(_0x4e10c5){logger[_0x90a0('0x23')](_0x4e10c5[_0x90a0('0x24')]);if(_0x4e10c5[_0x90a0('0x25')]){delete _0x4e10c5[_0x90a0('0x25')];}_0x1ca192[_0x90a0('0x19')](_0x3b79ee)['send'](_0x4e10c5);};}exports[_0x90a0('0x26')]=function(_0x2d2d66,_0x56b563){var _0x6d57b8={'raw':!![],'where':{'id':_0x2d2d66[_0x90a0('0x27')]['id']}},_0x208763={};_0x208763['model']=_[_0x90a0('0x28')](db['ChatProactiveAction'][_0x90a0('0x29')]);_0x208763[_0x90a0('0x2a')]=_[_0x90a0('0x28')](_0x2d2d66['query']);_0x208763[_0x90a0('0x2b')]=_['intersection'](_0x208763['model'],_0x208763[_0x90a0('0x2a')]);_0x6d57b8[_0x90a0('0x2c')]=_[_0x90a0('0x2d')](_0x208763[_0x90a0('0x2e')],qs[_0x90a0('0x2f')](_0x2d2d66[_0x90a0('0x2a')][_0x90a0('0x2f')]));_0x6d57b8[_0x90a0('0x2c')]=_0x6d57b8['attributes'][_0x90a0('0x30')]?_0x6d57b8[_0x90a0('0x2c')]:_0x208763[_0x90a0('0x2e')];if(_0x2d2d66['query'][_0x90a0('0x31')]){_0x6d57b8[_0x90a0('0x32')]=[{'all':!![]}];}_0x6d57b8=_[_0x90a0('0x33')]({},_0x6d57b8,_0x2d2d66[_0x90a0('0x34')]);return db[_0x90a0('0x35')][_0x90a0('0x36')](_0x6d57b8)[_0x90a0('0x21')](handleEntityNotFound(_0x56b563,null))[_0x90a0('0x21')](respondWithResult(_0x56b563,null))[_0x90a0('0x37')](handleError(_0x56b563,null));};exports['create']=function(_0x45735e,_0x463c74){return db[_0x90a0('0x35')]['create'](_0x45735e['body'],{})[_0x90a0('0x21')](respondWithResult(_0x463c74,0xc9))[_0x90a0('0x37')](handleError(_0x463c74,null));};exports[_0x90a0('0x38')]=function(_0x3a74e0,_0x412461){if(_0x3a74e0[_0x90a0('0x39')]['id']){delete _0x3a74e0[_0x90a0('0x39')]['id'];}return db['ChatProactiveAction'][_0x90a0('0x36')]({'where':{'id':_0x3a74e0[_0x90a0('0x27')]['id']}})[_0x90a0('0x21')](handleEntityNotFound(_0x412461,null))[_0x90a0('0x21')](saveUpdates(_0x3a74e0['body'],null))[_0x90a0('0x21')](respondWithResult(_0x412461,null))['catch'](handleError(_0x412461,null));};exports['destroy']=function(_0xf835ab,_0x454d3c){return db[_0x90a0('0x35')]['find']({'where':{'id':_0xf835ab[_0x90a0('0x27')]['id']}})['then'](handleEntityNotFound(_0x454d3c,null))[_0x90a0('0x21')](removeEntity(_0x454d3c,null))[_0x90a0('0x37')](handleError(_0x454d3c,null));};
\ No newline at end of file
+var _0x9a86=['../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','name','send','show','params','model','ChatProactiveAction','query','filters','attributes','intersection','fields','length','include','merge','options','catch','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x9a86,0x1c6));var _0x69a8=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x9a86[_0x1e3c16];return _0x47a0c9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x69a8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x69a8('0x1'));var jsonpatch=require(_0x69a8('0x2'));var rp=require(_0x69a8('0x3'));var moment=require(_0x69a8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x69a8('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x69a8('0x6'));var ejs=require(_0x69a8('0x7'));var fs=require('fs');var _=require(_0x69a8('0x8'));var squel=require(_0x69a8('0x9'));var crypto=require(_0x69a8('0xa'));var jsforce=require(_0x69a8('0xb'));var deskjs=require(_0x69a8('0xc'));var toCsv=require(_0x69a8('0x6'));var querystring=require('querystring');var Papa=require(_0x69a8('0xd'));var authService=require(_0x69a8('0xe'));var hardwareService=require(_0x69a8('0xf'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x69a8('0x10'))(_0x69a8('0x11'));var utils=require(_0x69a8('0x12'));var config=require('../../config/environment');var db=require(_0x69a8('0x13'))['db'];function respondWithStatusCode(_0x32696b,_0x4a9b48){_0x4a9b48=_0x4a9b48||0xcc;return function(_0x4911a9){if(_0x4911a9){return _0x32696b[_0x69a8('0x14')](_0x4a9b48);}return _0x32696b[_0x69a8('0x15')](_0x4a9b48)[_0x69a8('0x16')]();};}function respondWithResult(_0x1f92c4,_0x5d12b5){_0x5d12b5=_0x5d12b5||0xc8;return function(_0x29c76e){if(_0x29c76e){return _0x1f92c4[_0x69a8('0x15')](_0x5d12b5)[_0x69a8('0x17')](_0x29c76e);}};}function respondWithFilteredResult(_0x4b5829,_0x49863b){return function(_0xc86965){if(_0xc86965){var _0x31e969=_0xc86965[_0x69a8('0x18')],_0xa901b6=_0x49863b['offset'],_0xbb7bf5=_0x49863b[_0x69a8('0x19')]+_0x49863b['limit'],_0xf3de51;if(_0xbb7bf5>=_0x31e969){_0xbb7bf5=_0x31e969;_0xf3de51=0xc8;}else{_0xf3de51=0xce;}_0x4b5829[_0x69a8('0x15')](_0xf3de51);return _0x4b5829[_0x69a8('0x1a')]('Content-Range',_0xa901b6+'-'+_0xbb7bf5+'/'+_0x31e969)[_0x69a8('0x17')](_0xc86965);}return null;};}function patchUpdates(_0x7ba57b){return function(_0x21a7b3){try{jsonpatch[_0x69a8('0x1b')](_0x21a7b3,_0x7ba57b,!![]);}catch(_0x544b03){return BPromise[_0x69a8('0x1c')](_0x544b03);}return _0x21a7b3[_0x69a8('0x1d')]();};}function saveUpdates(_0x40baa2,_0x4be720){return function(_0x36ef5b){if(_0x36ef5b){return _0x36ef5b[_0x69a8('0x1e')](_0x40baa2)[_0x69a8('0x1f')](function(_0xaa251e){return _0xaa251e;});}return null;};}function removeEntity(_0x136a25,_0x3d8923){return function(_0x575949){if(_0x575949){return _0x575949[_0x69a8('0x20')]()[_0x69a8('0x1f')](function(){_0x136a25['status'](0xcc)[_0x69a8('0x16')]();});}};}function handleEntityNotFound(_0x42d920,_0x5d65fe){return function(_0x3a3afb){if(!_0x3a3afb){_0x42d920[_0x69a8('0x14')](0x194);}return _0x3a3afb;};}function handleError(_0x5c1265,_0x198382){_0x198382=_0x198382||0x1f4;return function(_0x592732){logger['error'](_0x592732['stack']);if(_0x592732[_0x69a8('0x21')]){delete _0x592732[_0x69a8('0x21')];}_0x5c1265[_0x69a8('0x15')](_0x198382)[_0x69a8('0x22')](_0x592732);};}exports[_0x69a8('0x23')]=function(_0x178906,_0x3a8783){var _0x435af0={'raw':!![],'where':{'id':_0x178906[_0x69a8('0x24')]['id']}},_0x299d22={};_0x299d22[_0x69a8('0x25')]=_['keys'](db[_0x69a8('0x26')]['rawAttributes']);_0x299d22[_0x69a8('0x27')]=_['keys'](_0x178906[_0x69a8('0x27')]);_0x299d22[_0x69a8('0x28')]=_['intersection'](_0x299d22[_0x69a8('0x25')],_0x299d22[_0x69a8('0x27')]);_0x435af0[_0x69a8('0x29')]=_[_0x69a8('0x2a')](_0x299d22['model'],qs[_0x69a8('0x2b')](_0x178906[_0x69a8('0x27')][_0x69a8('0x2b')]));_0x435af0['attributes']=_0x435af0[_0x69a8('0x29')][_0x69a8('0x2c')]?_0x435af0[_0x69a8('0x29')]:_0x299d22[_0x69a8('0x25')];if(_0x178906[_0x69a8('0x27')]['includeAll']){_0x435af0[_0x69a8('0x2d')]=[{'all':!![]}];}_0x435af0=_[_0x69a8('0x2e')]({},_0x435af0,_0x178906[_0x69a8('0x2f')]);return db[_0x69a8('0x26')]['find'](_0x435af0)[_0x69a8('0x1f')](handleEntityNotFound(_0x3a8783,null))[_0x69a8('0x1f')](respondWithResult(_0x3a8783,null))[_0x69a8('0x30')](handleError(_0x3a8783,null));};exports['create']=function(_0x74917a,_0x872db0){return db[_0x69a8('0x26')][_0x69a8('0x31')](_0x74917a[_0x69a8('0x32')],{})[_0x69a8('0x1f')](respondWithResult(_0x872db0,0xc9))[_0x69a8('0x30')](handleError(_0x872db0,null));};exports[_0x69a8('0x1e')]=function(_0x51d79c,_0x1e31c7){if(_0x51d79c[_0x69a8('0x32')]['id']){delete _0x51d79c[_0x69a8('0x32')]['id'];}return db[_0x69a8('0x26')][_0x69a8('0x33')]({'where':{'id':_0x51d79c[_0x69a8('0x24')]['id']}})[_0x69a8('0x1f')](handleEntityNotFound(_0x1e31c7,null))[_0x69a8('0x1f')](saveUpdates(_0x51d79c[_0x69a8('0x32')],null))[_0x69a8('0x1f')](respondWithResult(_0x1e31c7,null))[_0x69a8('0x30')](handleError(_0x1e31c7,null));};exports[_0x69a8('0x20')]=function(_0x25e377,_0x1ca9ff){return db[_0x69a8('0x26')]['find']({'where':{'id':_0x25e377['params']['id']}})[_0x69a8('0x1f')](handleEntityNotFound(_0x1ca9ff,null))['then'](removeEntity(_0x1ca9ff,null))[_0x69a8('0x30')](handleError(_0x1ca9ff,null));};
\ No newline at end of file
index 8bfd040..e488f12 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x57ca=['exports','define','ChatProactiveAction','chat_proactive_actions','util','../../config/logger','moment','bluebird','request-promise','./chatProactiveAction.attributes'];(function(_0x4ed06c,_0x57c579){var _0x8d80b0=function(_0x3f073a){while(--_0x3f073a){_0x4ed06c['push'](_0x4ed06c['shift']());}};_0x8d80b0(++_0x57c579);}(_0x57ca,0x108));var _0xa57c=function(_0x17fe2e,_0x5ae71a){_0x17fe2e=_0x17fe2e-0x0;var _0x4ee7a6=_0x57ca[_0x17fe2e];return _0x4ee7a6;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var logger=require(_0xa57c('0x1'))('api');var moment=require(_0xa57c('0x2'));var BPromise=require(_0xa57c('0x3'));var rp=require(_0xa57c('0x4'));var attributes=require(_0xa57c('0x5'));module[_0xa57c('0x6')]=function(_0x48be2d,_0x40ba22){return _0x48be2d[_0xa57c('0x7')](_0xa57c('0x8'),attributes,{'tableName':_0xa57c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x8603=['util','../../config/logger','api','request-promise','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions'];(function(_0x312d2a,_0x1f1f2e){var _0x48f625=function(_0x1ecf09){while(--_0x1ecf09){_0x312d2a['push'](_0x312d2a['shift']());}};_0x48f625(++_0x1f1f2e);}(_0x8603,0x190));var _0x3860=function(_0x432ac5,_0x112d3f){_0x432ac5=_0x432ac5-0x0;var _0x51eab8=_0x8603[_0x432ac5];return _0x51eab8;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var logger=require(_0x3860('0x1'))(_0x3860('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3860('0x3'));var attributes=require(_0x3860('0x4'));module[_0x3860('0x5')]=function(_0x490262,_0x2fc97a){return _0x490262['define'](_0x3860('0x6'),attributes,{'tableName':_0x3860('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 0211542..94cb562 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['http','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\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(_0xb4b30a,_0x243f1a){var _0x3f8406=function(_0x12bb3e){while(--_0x12bb3e){_0xb4b30a['push'](_0xb4b30a['shift']());}};_0x3f8406(++_0x243f1a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x39cec2,_0x48d9e0){var _0x4c1d57=function(_0x3acdb5){while(--_0x3acdb5){_0x39cec2['push'](_0x39cec2['shift']());}};_0x4c1d57(++_0x48d9e0);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}
\ No newline at end of file
index 0dc4522..4484a06 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc5df=['isAuthenticated','show','post','create','put','update','/:id','exports','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get'];(function(_0x2b30fe,_0xe92c0a){var _0x2d1e4e=function(_0x43366d){while(--_0x43366d){_0x2b30fe['push'](_0x2b30fe['shift']());}};_0x2d1e4e(++_0xe92c0a);}(_0xc5df,0x80));var _0xfc5d=function(_0x41c80b,_0x5f3a08){_0x41c80b=_0x41c80b-0x0;var _0x57b4e9=_0xc5df[_0x41c80b];return _0x57b4e9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfc5d('0x0'));var timeout=require(_0xfc5d('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xfc5d('0x2'));var interaction=require(_0xfc5d('0x3'));var config=require(_0xfc5d('0x4'));var controller=require(_0xfc5d('0x5'));router[_0xfc5d('0x6')]('/:id',auth[_0xfc5d('0x7')](),controller[_0xfc5d('0x8')]);router[_0xfc5d('0x9')]('/',auth[_0xfc5d('0x7')](),controller[_0xfc5d('0xa')]);router[_0xfc5d('0xb')]('/:id',auth[_0xfc5d('0x7')](),controller[_0xfc5d('0xc')]);router['delete'](_0xfc5d('0xd'),auth[_0xfc5d('0x7')](),controller['destroy']);module[_0xfc5d('0xe')]=router;
\ No newline at end of file
+var _0xe77c=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','show','isAuthenticated','create','put','update','delete','/:id','exports','multer','util','path','express'];(function(_0x52d284,_0x30ea62){var _0x5410f6=function(_0xcc756d){while(--_0xcc756d){_0x52d284['push'](_0x52d284['shift']());}};_0x5410f6(++_0x30ea62);}(_0xe77c,0x176));var _0xce77=function(_0x1e16e7,_0x11d381){_0x1e16e7=_0x1e16e7-0x0;var _0x1fcd7a=_0xe77c[_0x1e16e7];return _0x1fcd7a;};'use strict';var multer=require(_0xce77('0x0'));var util=require(_0xce77('0x1'));var path=require(_0xce77('0x2'));var timeout=require('connect-timeout');var express=require(_0xce77('0x3'));var router=express[_0xce77('0x4')]();var auth=require(_0xce77('0x5'));var interaction=require(_0xce77('0x6'));var config=require(_0xce77('0x7'));var controller=require(_0xce77('0x8'));router[_0xce77('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xce77('0xa')]);router['post']('/',auth[_0xce77('0xb')](),controller[_0xce77('0xc')]);router[_0xce77('0xd')]('/:id',auth[_0xce77('0xb')](),controller[_0xce77('0xe')]);router[_0xce77('0xf')](_0xce77('0x10'),auth[_0xce77('0xb')](),controller['destroy']);module[_0xce77('0x11')]=router;
\ No newline at end of file
index 2b7129a..ec80491 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x842d=['rrmemory','beepall','roundrobin','sequelize','STRING','name','INTEGER'];(function(_0x21752d,_0x26859f){var _0x4e517e=function(_0x22e56a){while(--_0x22e56a){_0x21752d['push'](_0x21752d['shift']());}};_0x4e517e(++_0x26859f);}(_0x842d,0x88));var _0xd842=function(_0x4e11d5,_0x1ce514){_0x4e11d5=_0x4e11d5-0x0;var _0x5e4e4c=_0x842d[_0x4e11d5];return _0x5e4e4c;};'use strict';var Sequelize=require(_0xd842('0x0'));module['exports']={'name':{'type':Sequelize[_0xd842('0x1')],'unique':_0xd842('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd842('0x1')]},'timeout':{'type':Sequelize[_0xd842('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xd842('0x4'),_0xd842('0x5'),_0xd842('0x6'))}};
\ No newline at end of file
+var _0x2d6c=['roundrobin','exports','STRING','name','rrmemory','beepall'];(function(_0x35fc07,_0x5f4cd5){var _0x175a62=function(_0x23bc4a){while(--_0x23bc4a){_0x35fc07['push'](_0x35fc07['shift']());}};_0x175a62(++_0x5f4cd5);}(_0x2d6c,0x1e1));var _0xc2d6=function(_0x334500,_0x3fe11c){_0x334500=_0x334500-0x0;var _0x48e29b=_0x2d6c[_0x334500];return _0x48e29b;};'use strict';var Sequelize=require('sequelize');module[_0xc2d6('0x0')]={'name':{'type':Sequelize[_0xc2d6('0x1')],'unique':_0xc2d6('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xc2d6('0x3'),_0xc2d6('0x4'),_0xc2d6('0x5'))}};
\ No newline at end of file
index aaf5237..985e31e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7119=['send','ChatQueue','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','merge','type','VIRTUAL','field','filter','options','includeAll','findAll','rows','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','getMembers','UserChatQueue','hasOwnProperty','nolimit','pick','map','User','UserId','updatedAt','createdAt','format','SIP','chatPause','getTeams','findOne','ids','penalty','addTeams','removeTeams','Team','Agents','union','addAgents','omit','spread','emit','userChatQueue:save','removeAgents','isArray','userChatQueue:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','save','update','destroy','get','ChatQueues','UserProfileResource','stack','name'];(function(_0x37e848,_0x3e0c42){var _0x43ca0d=function(_0x55590a){while(--_0x55590a){_0x37e848['push'](_0x37e848['shift']());}};_0x43ca0d(++_0x3e0c42);}(_0x7119,0xbb));var _0x9711=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0x7119[_0x101e7b];return _0x4995c0;};'use strict';var pdf=require(_0x9711('0x0'));var emlformat=require(_0x9711('0x1'));var rimraf=require(_0x9711('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9711('0x3'));var rp=require(_0x9711('0x4'));var moment=require('moment');var BPromise=require(_0x9711('0x5'));var Mustache=require('mustache');var util=require(_0x9711('0x6'));var path=require('path');var sox=require(_0x9711('0x7'));var csv=require('to-csv');var ejs=require(_0x9711('0x8'));var fs=require('fs');var _=require(_0x9711('0x9'));var squel=require(_0x9711('0xa'));var crypto=require(_0x9711('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9711('0xc'));var querystring=require(_0x9711('0xd'));var Papa=require(_0x9711('0xe'));var authService=require('../../components/auth/service');var hardwareService=require(_0x9711('0xf'));var Redis=require('ioredis');var qs=require(_0x9711('0x10'));var logger=require(_0x9711('0x11'))(_0x9711('0x12'));var utils=require(_0x9711('0x13'));var config=require(_0x9711('0x14'));var db=require('../../mysqldb')['db'];config[_0x9711('0x15')]=_['defaults'](config[_0x9711('0x15')],{'host':_0x9711('0x16'),'port':0x18eb});var socket=require(_0x9711('0x17'))(new Redis(config[_0x9711('0x15')]));require('./chatQueue.socket')[_0x9711('0x18')](socket);var jayson=require(_0x9711('0x19'));var client=jayson[_0x9711('0x1a')][_0x9711('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3ac194,_0x5d0e42,_0x2cec02,_0x456e36){return new BPromise(function(_0x50d1ac,_0x43d03d){var _0x25a6af=_0x456e36||client;return _0x25a6af[_0x9711('0x1c')](_0x3ac194,_0x2cec02)[_0x9711('0x1d')](function(_0xdbb3ef){logger['info']('ChatQueue,\x20%s,\x20%s',_0x5d0e42,'request\x20sent');logger[_0x9711('0x1e')](_0x9711('0x1f'),_0x5d0e42,_0x9711('0x20'),JSON[_0x9711('0x21')](_0xdbb3ef));if(_0xdbb3ef[_0x9711('0x22')]){if(_0xdbb3ef[_0x9711('0x22')][_0x9711('0x23')]===0x1f4){logger[_0x9711('0x22')](_0x9711('0x24'),_0x5d0e42,_0xdbb3ef[_0x9711('0x22')]['message']);return _0x43d03d(_0xdbb3ef['error'][_0x9711('0x25')]);}logger[_0x9711('0x22')](_0x9711('0x24'),_0x5d0e42,_0xdbb3ef['error']['message']);return _0x50d1ac(_0xdbb3ef[_0x9711('0x22')]['message']);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x5d0e42,_0x9711('0x20'));_0x50d1ac(_0xdbb3ef[_0x9711('0x26')][_0x9711('0x25')]);}})[_0x9711('0x27')](function(_0x33d75a){logger['error'](_0x9711('0x24'),_0x5d0e42,_0x33d75a);_0x43d03d(_0x33d75a);});});}function respondWithStatusCode(_0x13b1d9,_0x111203){_0x111203=_0x111203||0xcc;return function(_0x2da1e5){if(_0x2da1e5){return _0x13b1d9[_0x9711('0x28')](_0x111203);}return _0x13b1d9[_0x9711('0x29')](_0x111203)[_0x9711('0x2a')]();};}function respondWithResult(_0x387de6,_0x5f3ce6){_0x5f3ce6=_0x5f3ce6||0xc8;return function(_0x34f022){if(_0x34f022){return _0x387de6[_0x9711('0x29')](_0x5f3ce6)['json'](_0x34f022);}};}function respondWithFilteredResult(_0x5f3f04,_0x3911bf){return function(_0x52f4ec){if(_0x52f4ec){var _0x299fdd=_0x52f4ec[_0x9711('0x2b')],_0x78949d=_0x3911bf[_0x9711('0x2c')],_0x39341e=_0x3911bf['offset']+_0x3911bf[_0x9711('0x2d')],_0x19f097;if(_0x39341e>=_0x299fdd){_0x39341e=_0x299fdd;_0x19f097=0xc8;}else{_0x19f097=0xce;}_0x5f3f04['status'](_0x19f097);return _0x5f3f04[_0x9711('0x2e')](_0x9711('0x2f'),_0x78949d+'-'+_0x39341e+'/'+_0x299fdd)['json'](_0x52f4ec);}return null;};}function patchUpdates(_0x83506){return function(_0x2856b4){try{jsonpatch[_0x9711('0x30')](_0x2856b4,_0x83506,!![]);}catch(_0x1fd307){return BPromise['reject'](_0x1fd307);}return _0x2856b4[_0x9711('0x31')]();};}function saveUpdates(_0x1c8c1c,_0x44e179){return function(_0x2145b3){if(_0x2145b3){return _0x2145b3[_0x9711('0x32')](_0x1c8c1c)[_0x9711('0x1d')](function(_0x489d8d){return _0x489d8d;});}return null;};}function removeEntity(_0x2d61e3,_0x22959b){return function(_0x105b13){if(_0x105b13){return _0x105b13[_0x9711('0x33')]()[_0x9711('0x1d')](function(){var _0xd324cb=_0x105b13[_0x9711('0x34')]({'plain':!![]});var _0x440c38=_0x9711('0x35');return db[_0x9711('0x36')]['destroy']({'where':{'type':_0x440c38,'resourceId':_0xd324cb['id']}})[_0x9711('0x1d')](function(){return _0x105b13;});})[_0x9711('0x1d')](function(){_0x2d61e3[_0x9711('0x29')](0xcc)[_0x9711('0x2a')]();});}};}function handleEntityNotFound(_0x2ed7c1,_0x2270e2){return function(_0x53b6a9){if(!_0x53b6a9){_0x2ed7c1[_0x9711('0x28')](0x194);}return _0x53b6a9;};}function handleError(_0xf48171,_0xfca6d6){_0xfca6d6=_0xfca6d6||0x1f4;return function(_0x427289){logger[_0x9711('0x22')](_0x427289[_0x9711('0x37')]);if(_0x427289[_0x9711('0x38')]){delete _0x427289[_0x9711('0x38')];}_0xf48171[_0x9711('0x29')](_0xfca6d6)[_0x9711('0x39')](_0x427289);};}exports['index']=function(_0x346358,_0xb81738){var _0x3c0f7b={},_0x4b0099={},_0x59fa19={'count':0x0,'rows':[]};var _0x221c15=db[_0x9711('0x3a')][_0x9711('0x3b')];_0x4b0099[_0x9711('0x3c')]=_[_0x9711('0x3d')](_0x221c15);_0x4b0099[_0x9711('0x3e')]=_[_0x9711('0x3d')](_0x346358[_0x9711('0x3e')]);_0x4b0099[_0x9711('0x3f')]=_[_0x9711('0x40')](_0x4b0099[_0x9711('0x3c')],_0x4b0099[_0x9711('0x3e')]);_0x3c0f7b[_0x9711('0x41')]=_[_0x9711('0x40')](_0x4b0099[_0x9711('0x3c')],qs[_0x9711('0x42')](_0x346358[_0x9711('0x3e')][_0x9711('0x42')]));_0x3c0f7b[_0x9711('0x41')]=_0x3c0f7b['attributes'][_0x9711('0x43')]?_0x3c0f7b[_0x9711('0x41')]:_0x4b0099[_0x9711('0x3c')];if(!_0x346358[_0x9711('0x3e')]['hasOwnProperty']('nolimit')){_0x3c0f7b['limit']=qs[_0x9711('0x2d')](_0x346358[_0x9711('0x3e')][_0x9711('0x2d')]);_0x3c0f7b['offset']=qs[_0x9711('0x2c')](_0x346358[_0x9711('0x3e')][_0x9711('0x2c')]);}_0x3c0f7b[_0x9711('0x44')]=qs[_0x9711('0x45')](_0x346358[_0x9711('0x3e')][_0x9711('0x45')]);_0x3c0f7b[_0x9711('0x46')]=qs[_0x9711('0x3f')](_['pick'](_0x346358[_0x9711('0x3e')],_0x4b0099[_0x9711('0x3f')]));if(_0x346358[_0x9711('0x3e')]['filter']){_0x3c0f7b[_0x9711('0x46')]=_[_0x9711('0x47')](_0x3c0f7b[_0x9711('0x46')],{'$or':_['map'](_0x221c15,function(_0x35a77a){if(_0x35a77a[_0x9711('0x48')]['key']!==_0x9711('0x49')){var _0x3234e7={};_0x3234e7[_0x35a77a[_0x9711('0x4a')]]={'$like':'%'+_0x346358[_0x9711('0x3e')][_0x9711('0x4b')]+'%'};return _0x3234e7;}})});}_0x3c0f7b=_['merge']({},_0x3c0f7b,_0x346358[_0x9711('0x4c')]);var _0x541266={'where':_0x3c0f7b[_0x9711('0x46')]};return db[_0x9711('0x3a')][_0x9711('0x2b')](_0x541266)['then'](function(_0x525b7b){_0x59fa19['count']=_0x525b7b;if(_0x346358[_0x9711('0x3e')][_0x9711('0x4d')]){_0x3c0f7b['include']=[{'all':!![]}];}return db[_0x9711('0x3a')][_0x9711('0x4e')](_0x3c0f7b);})[_0x9711('0x1d')](function(_0x5ec410){_0x59fa19[_0x9711('0x4f')]=_0x5ec410;return _0x59fa19;})[_0x9711('0x1d')](respondWithFilteredResult(_0xb81738,_0x3c0f7b))[_0x9711('0x27')](handleError(_0xb81738,null));};exports['show']=function(_0x3574ac,_0x8a9db9){var _0x4bb46e={'raw':!![],'where':{'id':_0x3574ac[_0x9711('0x50')]['id']}},_0x44dc24={};_0x44dc24[_0x9711('0x3c')]=_[_0x9711('0x3d')](db[_0x9711('0x3a')][_0x9711('0x3b')]);_0x44dc24[_0x9711('0x3e')]=_[_0x9711('0x3d')](_0x3574ac[_0x9711('0x3e')]);_0x44dc24[_0x9711('0x3f')]=_[_0x9711('0x40')](_0x44dc24[_0x9711('0x3c')],_0x44dc24[_0x9711('0x3e')]);_0x4bb46e[_0x9711('0x41')]=_[_0x9711('0x40')](_0x44dc24['model'],qs[_0x9711('0x42')](_0x3574ac[_0x9711('0x3e')][_0x9711('0x42')]));_0x4bb46e[_0x9711('0x41')]=_0x4bb46e['attributes'][_0x9711('0x43')]?_0x4bb46e[_0x9711('0x41')]:_0x44dc24[_0x9711('0x3c')];if(_0x3574ac[_0x9711('0x3e')][_0x9711('0x4d')]){_0x4bb46e['include']=[{'all':!![]}];}_0x4bb46e=_[_0x9711('0x47')]({},_0x4bb46e,_0x3574ac[_0x9711('0x4c')]);return db[_0x9711('0x3a')]['find'](_0x4bb46e)[_0x9711('0x1d')](handleEntityNotFound(_0x8a9db9,null))[_0x9711('0x1d')](respondWithResult(_0x8a9db9,null))[_0x9711('0x27')](handleError(_0x8a9db9,null));};exports['create']=function(_0x122a64,_0x3c3bed){return db['ChatQueue'][_0x9711('0x51')](_0x122a64[_0x9711('0x52')],{})[_0x9711('0x1d')](function(_0x1b3813){var _0xb82b57=_0x122a64[_0x9711('0x53')][_0x9711('0x34')]({'plain':!![]});if(!_0xb82b57)throw new Error(_0x9711('0x54'));if(_0xb82b57[_0x9711('0x55')]===_0x9711('0x53')){var _0xf28430=_0x1b3813[_0x9711('0x34')]({'plain':!![]});var _0x177ac2=_0x9711('0x35');return db[_0x9711('0x56')]['find']({'where':{'name':_0x177ac2,'userProfileId':_0xb82b57[_0x9711('0x57')]},'raw':!![]})['then'](function(_0x3d5fd5){if(_0x3d5fd5&&_0x3d5fd5['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xf28430['name'],'resourceId':_0xf28430['id'],'type':_0x3d5fd5[_0x9711('0x38')],'sectionId':_0x3d5fd5['id']},{})['then'](function(){return _0x1b3813;});}else{return _0x1b3813;}})['catch'](function(_0x16518f){logger[_0x9711('0x22')](_0x9711('0x58'),_0x16518f);throw _0x16518f;});}return _0x1b3813;})[_0x9711('0x1d')](respondWithResult(_0x3c3bed,0xc9))[_0x9711('0x27')](handleError(_0x3c3bed,null));};exports[_0x9711('0x32')]=function(_0x1dd978,_0x374713){if(_0x1dd978['body']['id']){delete _0x1dd978[_0x9711('0x52')]['id'];}return db[_0x9711('0x3a')]['find']({'where':{'id':_0x1dd978['params']['id']}})[_0x9711('0x1d')](handleEntityNotFound(_0x374713,null))['then'](saveUpdates(_0x1dd978[_0x9711('0x52')],null))[_0x9711('0x1d')](respondWithResult(_0x374713,null))[_0x9711('0x27')](handleError(_0x374713,null));};exports[_0x9711('0x33')]=function(_0x31a08e,_0x152494){return db[_0x9711('0x3a')][_0x9711('0x59')]({'where':{'id':_0x31a08e[_0x9711('0x50')]['id']}})[_0x9711('0x1d')](handleEntityNotFound(_0x152494,null))[_0x9711('0x1d')](removeEntity(_0x152494,null))[_0x9711('0x27')](handleError(_0x152494,null));};exports[_0x9711('0x5a')]=function(_0x9c0887,_0x1e30ca){return db[_0x9711('0x3a')][_0x9711('0x5a')]()['then'](respondWithResult(_0x1e30ca,null))['catch'](handleError(_0x1e30ca,null));};exports[_0x9711('0x5b')]=function(_0x70fa3,_0x3a34f6,_0x5e471){var _0x514e32={'raw':!![],'where':{}},_0x1b4ff8={},_0xbbee6b;return db['ChatQueue']['findOne']({'where':{'id':_0x70fa3['params']['id']}})['then'](handleEntityNotFound(_0x3a34f6,null))['then'](function(_0x5c215c){if(_0x5c215c){_0xbbee6b=_0x5c215c[_0x9711('0x34')]({'plain':!![]});_0x1b4ff8[_0x9711('0x3c')]=_[_0x9711('0x3d')](db[_0x9711('0x5c')][_0x9711('0x3b')]);_0x1b4ff8['query']=_[_0x9711('0x3d')](_0x70fa3['query']);_0x1b4ff8[_0x9711('0x3f')]=_[_0x9711('0x40')](_0x1b4ff8[_0x9711('0x3c')],_0x1b4ff8['query']);_0x514e32[_0x9711('0x41')]=_['intersection'](_0x1b4ff8[_0x9711('0x3c')],qs[_0x9711('0x42')](_0x70fa3[_0x9711('0x3e')][_0x9711('0x42')]));_0x514e32[_0x9711('0x41')]=_0x514e32[_0x9711('0x41')][_0x9711('0x43')]?_0x514e32[_0x9711('0x41')]:_0x1b4ff8[_0x9711('0x3c')];if(!_0x70fa3[_0x9711('0x3e')][_0x9711('0x5d')](_0x9711('0x5e'))){_0x514e32[_0x9711('0x2d')]=qs[_0x9711('0x2d')](_0x70fa3[_0x9711('0x3e')]['limit']);_0x514e32[_0x9711('0x2c')]=qs[_0x9711('0x2c')](_0x70fa3[_0x9711('0x3e')][_0x9711('0x2c')]);}_0x514e32[_0x9711('0x44')]=qs['sort'](_0x70fa3[_0x9711('0x3e')][_0x9711('0x45')]);_0x514e32['where']=qs['filters'](_[_0x9711('0x5f')](_0x70fa3['query'],_0x1b4ff8[_0x9711('0x3f')]));_0x514e32['where']['ChatQueueId']=_0x5c215c['id'];if(_0x70fa3[_0x9711('0x3e')][_0x9711('0x4b')]){_0x514e32[_0x9711('0x46')]=_[_0x9711('0x47')](_0x514e32['where'],{'$or':_[_0x9711('0x60')](_0x514e32[_0x9711('0x41')],function(_0x556480){var _0xb965a5={};_0xb965a5[_0x556480]={'$like':'%'+_0x70fa3['query'][_0x9711('0x4b')]+'%'};return _0xb965a5;})});}_0x514e32=_[_0x9711('0x47')]({},_0x514e32,_0x70fa3[_0x9711('0x4c')]);return db[_0x9711('0x5c')][_0x9711('0x4e')](_0x514e32);}})[_0x9711('0x1d')](function(_0x20ac12){if(_0x20ac12){return db[_0x9711('0x61')]['findAndCountAll']({'where':{'id':_['map'](_0x20ac12,_0x9711('0x62')),'role':'agent'},'attributes':['id','name','chatPause',_0x9711('0x63'),_0x9711('0x64')]});}})[_0x9711('0x1d')](function(_0x4b38ff){if(_0x4b38ff){return{'count':_0x4b38ff[_0x9711('0x2b')],'rows':_['map'](_0x4b38ff[_0x9711('0x4f')],function(_0x1991e7){return{'membername':_0x1991e7['name'],'UserId':_0x1991e7['id'],'queue_name':_0xbbee6b[_0x9711('0x38')],'ChatQueueId':_0xbbee6b['id'],'interface':util[_0x9711('0x65')]('%s/%s',_0x9711('0x66'),_0x1991e7[_0x9711('0x38')]),'penalty':0x0,'paused':_0x1991e7[_0x9711('0x67')],'createdAt':_0x1991e7[_0x9711('0x64')],'updatedAt':_0x1991e7[_0x9711('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3a34f6,_0x514e32))[_0x9711('0x27')](handleError(_0x3a34f6,null));};exports[_0x9711('0x68')]=function(_0x34184b,_0x3972eb,_0x55aba1){var _0x1d7457={};var _0x1a54d0={};var _0x268d78;var _0x4f1ba4;return db[_0x9711('0x3a')][_0x9711('0x69')]({'where':{'id':_0x34184b[_0x9711('0x50')]['id']}})[_0x9711('0x1d')](handleEntityNotFound(_0x3972eb,null))['then'](function(_0x6d7c95){if(_0x6d7c95){_0x268d78=_0x6d7c95;_0x1a54d0['model']=_[_0x9711('0x3d')](db['Team'][_0x9711('0x3b')]);_0x1a54d0[_0x9711('0x3e')]=_[_0x9711('0x3d')](_0x34184b[_0x9711('0x3e')]);_0x1a54d0[_0x9711('0x3f')]=_[_0x9711('0x40')](_0x1a54d0['model'],_0x1a54d0[_0x9711('0x3e')]);_0x1d7457[_0x9711('0x41')]=_[_0x9711('0x40')](_0x1a54d0[_0x9711('0x3c')],qs[_0x9711('0x42')](_0x34184b[_0x9711('0x3e')]['fields']));_0x1d7457[_0x9711('0x41')]=_0x1d7457['attributes'][_0x9711('0x43')]?_0x1d7457['attributes']:_0x1a54d0[_0x9711('0x3c')];_0x1d7457[_0x9711('0x44')]=qs[_0x9711('0x45')](_0x34184b['query'][_0x9711('0x45')]);_0x1d7457['where']=qs[_0x9711('0x3f')](_['pick'](_0x34184b['query'],_0x1a54d0[_0x9711('0x3f')]));if(_0x34184b['query']['filter']){_0x1d7457[_0x9711('0x46')]=_[_0x9711('0x47')](_0x1d7457[_0x9711('0x46')],{'$or':_[_0x9711('0x60')](_0x1d7457[_0x9711('0x41')],function(_0x17c3b5){var _0x2bc1e4={};_0x2bc1e4[_0x17c3b5]={'$like':'%'+_0x34184b['query']['filter']+'%'};return _0x2bc1e4;})});}_0x1d7457=_[_0x9711('0x47')]({},_0x1d7457,_0x34184b[_0x9711('0x4c')]);return _0x268d78[_0x9711('0x68')](_0x1d7457);}})['then'](function(_0x13d6d9){if(_0x13d6d9){_0x4f1ba4=_0x13d6d9[_0x9711('0x43')];if(!_0x34184b[_0x9711('0x3e')]['hasOwnProperty'](_0x9711('0x5e'))){_0x1d7457[_0x9711('0x2d')]=qs[_0x9711('0x2d')](_0x34184b['query'][_0x9711('0x2d')]);_0x1d7457[_0x9711('0x2c')]=qs[_0x9711('0x2c')](_0x34184b['query'][_0x9711('0x2c')]);}return _0x268d78[_0x9711('0x68')](_0x1d7457);}})[_0x9711('0x1d')](function(_0x3bbf6e){if(_0x3bbf6e){return _0x3bbf6e?{'count':_0x4f1ba4,'rows':_0x3bbf6e}:null;}})[_0x9711('0x1d')](respondWithResult(_0x3972eb,null))[_0x9711('0x27')](handleError(_0x3972eb,null));};exports['addTeams']=function(_0x1b7006,_0x4e714b,_0x505d21){var _0x5ee47c=[];var _0x3dc0b1;return db['Team']['findAll']({'where':{'id':_0x1b7006[_0x9711('0x52')][_0x9711('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x9711('0x61')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9711('0x1d')](function(_0x379dca){if(_0x379dca){for(var _0x181fa5=0x0;_0x181fa5<_0x379dca[_0x9711('0x43')];_0x181fa5+=0x1){for(var _0x21fd47=0x0;_0x21fd47<_0x379dca[_0x181fa5]['Agents']['length'];_0x21fd47+=0x1){_0x5ee47c=_['union'](_0x5ee47c,[_0x379dca[_0x181fa5]['Agents'][_0x21fd47]['id']]);}}return _0x5ee47c;}})[_0x9711('0x1d')](function(_0x13a5f4){if(_0x13a5f4){return db[_0x9711('0x3a')][_0x9711('0x59')]({'where':{'id':_0x1b7006[_0x9711('0x50')]['id']}});}})[_0x9711('0x1d')](function(_0x3147b8){if(_0x3147b8){_0x3dc0b1=_0x3147b8;return _0x3dc0b1['addAgents'](_0x5ee47c,{'penalty':_0x1b7006[_0x9711('0x52')][_0x9711('0x6b')]});}})[_0x9711('0x1d')](function(_0x53edcf){if(_0x53edcf){return _0x3dc0b1[_0x9711('0x6c')](_0x1b7006[_0x9711('0x52')][_0x9711('0x6a')]);}})[_0x9711('0x1d')](handleEntityNotFound(_0x4e714b,null))[_0x9711('0x1d')](respondWithStatusCode(_0x4e714b,null))[_0x9711('0x27')](handleError(_0x4e714b,null));};exports[_0x9711('0x6d')]=function(_0x198fc8,_0x5bcf71,_0x572fef){var _0x29ba90=[];var _0x468b80;return db[_0x9711('0x6e')][_0x9711('0x4e')]({'where':{'id':_0x198fc8[_0x9711('0x3e')]['ids']},'attributes':['id'],'include':[{'model':db[_0x9711('0x61')],'as':_0x9711('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x9711('0x1d')](function(_0x4a3ac0){if(_0x4a3ac0){for(var _0x3e127e=0x0;_0x3e127e<_0x4a3ac0[_0x9711('0x43')];_0x3e127e+=0x1){for(var _0x3c612d=0x0;_0x3c612d<_0x4a3ac0[_0x3e127e]['Agents'][_0x9711('0x43')];_0x3c612d+=0x1){_0x29ba90=_[_0x9711('0x70')](_0x29ba90,[_0x4a3ac0[_0x3e127e]['Agents'][_0x3c612d]['id']]);}}return _0x29ba90;}})[_0x9711('0x1d')](function(_0x842fcd){if(_0x842fcd){return db[_0x9711('0x3a')][_0x9711('0x59')]({'where':{'id':_0x198fc8['params']['id']}});}})['then'](function(_0x513d83){if(_0x513d83){_0x468b80=_0x513d83;return _0x468b80['removeAgents'](_0x29ba90);}})[_0x9711('0x1d')](function(_0x4299a7){if(_0x468b80){return _0x468b80['removeTeams'](_0x198fc8[_0x9711('0x3e')][_0x9711('0x6a')]);}})[_0x9711('0x1d')](handleEntityNotFound(_0x5bcf71,null))['then'](respondWithStatusCode(_0x5bcf71,null))[_0x9711('0x27')](handleError(_0x5bcf71,null));};exports[_0x9711('0x71')]=function(_0x585924,_0x38c843,_0x50a5d8){return db[_0x9711('0x3a')]['find']({'where':{'id':_0x585924['params']['id']}})[_0x9711('0x1d')](handleEntityNotFound(_0x38c843,null))['then'](function(_0x4a9e71){if(_0x4a9e71){return _0x4a9e71[_0x9711('0x71')](_0x585924[_0x9711('0x52')][_0x9711('0x6a')],_[_0x9711('0x72')](_0x585924[_0x9711('0x52')],['ids','id'])||{})[_0x9711('0x73')](function(_0x39bdaf){for(var _0x4403f4=0x0;_0x4403f4<_0x585924[_0x9711('0x52')][_0x9711('0x6a')][_0x9711('0x43')];_0x4403f4+=0x1){socket[_0x9711('0x74')](_0x9711('0x75'),{'UserId':_0x585924[_0x9711('0x52')][_0x9711('0x6a')][_0x4403f4],'ChatQueueId':_0x585924[_0x9711('0x50')]['id']});}return _0x39bdaf;});}})[_0x9711('0x1d')](respondWithResult(_0x38c843,null))[_0x9711('0x27')](handleError(_0x38c843,null));};exports[_0x9711('0x76')]=function(_0x1fbcd3,_0x1a1055,_0x3cc3be){var _0x5400c8;return db[_0x9711('0x3a')]['find']({'where':{'id':_0x1fbcd3['params']['id']}})['then'](handleEntityNotFound(_0x1a1055,null))[_0x9711('0x1d')](function(_0x46371a){if(_0x46371a){return _0x46371a[_0x9711('0x76')](_0x1fbcd3[_0x9711('0x3e')][_0x9711('0x6a')])['then'](function(_0x30aef8){if(_[_0x9711('0x77')](_0x1fbcd3[_0x9711('0x3e')][_0x9711('0x6a')])){for(var _0x38e9ce=0x0;_0x38e9ce<_0x1fbcd3[_0x9711('0x3e')]['ids']['length'];_0x38e9ce+=0x1){socket[_0x9711('0x74')](_0x9711('0x78'),{'UserId':_0x1fbcd3[_0x9711('0x3e')][_0x9711('0x6a')][_0x38e9ce],'ChatQueueId':_0x1fbcd3[_0x9711('0x50')]['id']});}}else{socket['emit'](_0x9711('0x78'),{'UserId':_0x1fbcd3[_0x9711('0x3e')][_0x9711('0x6a')],'ChatQueueId':_0x1fbcd3[_0x9711('0x50')]['id']});}});}})[_0x9711('0x1d')](respondWithStatusCode(_0x1a1055,null))[_0x9711('0x27')](handleError(_0x1a1055,null));};exports[_0x9711('0x79')]=function(_0x440a7d,_0x2682eb,_0x4663ba){var _0x21c25c={};var _0x444e46={};var _0x5ee366;var _0x1c4f2a;return db[_0x9711('0x3a')][_0x9711('0x69')]({'where':{'id':_0x440a7d[_0x9711('0x50')]['id']}})['then'](handleEntityNotFound(_0x2682eb,null))[_0x9711('0x1d')](function(_0x44e6b0){if(_0x44e6b0){_0x5ee366=_0x44e6b0;_0x444e46['model']=_[_0x9711('0x3d')](db['User'][_0x9711('0x3b')]);_0x444e46[_0x9711('0x3e')]=_[_0x9711('0x3d')](_0x440a7d[_0x9711('0x3e')]);_0x444e46[_0x9711('0x3f')]=_[_0x9711('0x40')](_0x444e46[_0x9711('0x3c')],_0x444e46['query']);_0x21c25c[_0x9711('0x41')]=_[_0x9711('0x40')](_0x444e46[_0x9711('0x3c')],qs[_0x9711('0x42')](_0x440a7d[_0x9711('0x3e')][_0x9711('0x42')]));_0x21c25c[_0x9711('0x41')]=_0x21c25c['attributes'][_0x9711('0x43')]?_0x21c25c['attributes']:_0x444e46[_0x9711('0x3c')];_0x21c25c['order']=qs['sort'](_0x440a7d[_0x9711('0x3e')][_0x9711('0x45')]);_0x21c25c['where']=qs[_0x9711('0x3f')](_[_0x9711('0x5f')](_0x440a7d[_0x9711('0x3e')],_0x444e46[_0x9711('0x3f')]));if(_0x440a7d['query']['filter']){_0x21c25c[_0x9711('0x46')]=_['merge'](_0x21c25c[_0x9711('0x46')],{'$or':_[_0x9711('0x60')](_0x21c25c[_0x9711('0x41')],function(_0x2f8770){var _0x2d357c={};_0x2d357c[_0x2f8770]={'$like':'%'+_0x440a7d[_0x9711('0x3e')]['filter']+'%'};return _0x2d357c;})});}_0x21c25c=_['merge']({},_0x21c25c,_0x440a7d[_0x9711('0x4c')]);return _0x5ee366[_0x9711('0x79')](_0x21c25c);}})['then'](function(_0x5a5aba){if(_0x5a5aba){_0x1c4f2a=_0x5a5aba['length'];if(!_0x440a7d[_0x9711('0x3e')][_0x9711('0x5d')](_0x9711('0x5e'))){_0x21c25c['limit']=qs['limit'](_0x440a7d[_0x9711('0x3e')][_0x9711('0x2d')]);_0x21c25c[_0x9711('0x2c')]=qs[_0x9711('0x2c')](_0x440a7d[_0x9711('0x3e')][_0x9711('0x2c')]);}return _0x5ee366['getAgents'](_0x21c25c);}})[_0x9711('0x1d')](function(_0x33a4a8){if(_0x33a4a8){return _0x33a4a8?{'count':_0x1c4f2a,'rows':_0x33a4a8}:null;}})[_0x9711('0x1d')](respondWithResult(_0x2682eb,null))['catch'](handleError(_0x2682eb,null));};
\ No newline at end of file
+var _0xff48=['keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','type','key','VIRTUAL','field','options','findAll','rows','catch','show','rawAttributes','includeAll','include','create','body','role','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserChatQueue','where','ChatQueueId','User','findAndCountAll','map','UserId','updatedAt','createdAt','format','%s/%s','SIP','chatPause','getTeams','Team','addTeams','ids','union','Agents','penalty','removeTeams','removeAgents','omit','spread','emit','userChatQueue:save','isArray','userChatQueue:remove','getAgents','html-pdf','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','client','http','request','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','ChatQueues','UserProfileResource','name','send','index','ChatQueue','model'];(function(_0x25b2a0,_0x4aaf17){var _0x2b7e0a=function(_0x584051){while(--_0x584051){_0x25b2a0['push'](_0x25b2a0['shift']());}};_0x2b7e0a(++_0x4aaf17);}(_0xff48,0xc1));var _0x8ff4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xff48[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x8ff4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8ff4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8ff4('0x2'));var rp=require('request-promise');var moment=require(_0x8ff4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8ff4('0x4'));var util=require(_0x8ff4('0x5'));var path=require('path');var sox=require(_0x8ff4('0x6'));var csv=require(_0x8ff4('0x7'));var ejs=require(_0x8ff4('0x8'));var fs=require('fs');var _=require(_0x8ff4('0x9'));var squel=require(_0x8ff4('0xa'));var crypto=require('crypto');var jsforce=require(_0x8ff4('0xb'));var deskjs=require(_0x8ff4('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8ff4('0xd'));var Papa=require(_0x8ff4('0xe'));var authService=require(_0x8ff4('0xf'));var hardwareService=require(_0x8ff4('0x10'));var Redis=require(_0x8ff4('0x11'));var qs=require(_0x8ff4('0x12'));var logger=require(_0x8ff4('0x13'))(_0x8ff4('0x14'));var utils=require(_0x8ff4('0x15'));var config=require(_0x8ff4('0x16'));var db=require('../../mysqldb')['db'];config[_0x8ff4('0x17')]=_[_0x8ff4('0x18')](config[_0x8ff4('0x17')],{'host':_0x8ff4('0x19'),'port':0x18eb});var socket=require(_0x8ff4('0x1a'))(new Redis(config['redis']));require('./chatQueue.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x8ff4('0x1b')][_0x8ff4('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x301f0c,_0x38d519,_0x6921c4,_0x12c2cd){return new BPromise(function(_0x213ef9,_0x3d68ce){var _0x23be20=_0x12c2cd||client;return _0x23be20[_0x8ff4('0x1d')](_0x301f0c,_0x6921c4)['then'](function(_0x1eb1cb){logger['info'](_0x8ff4('0x1e'),_0x38d519,_0x8ff4('0x1f'));logger['debug'](_0x8ff4('0x20'),_0x38d519,'request\x20sent',JSON[_0x8ff4('0x21')](_0x1eb1cb));if(_0x1eb1cb[_0x8ff4('0x22')]){if(_0x1eb1cb['error'][_0x8ff4('0x23')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x38d519,_0x1eb1cb['error']['message']);return _0x3d68ce(_0x1eb1cb[_0x8ff4('0x22')][_0x8ff4('0x24')]);}logger[_0x8ff4('0x22')](_0x8ff4('0x1e'),_0x38d519,_0x1eb1cb[_0x8ff4('0x22')][_0x8ff4('0x24')]);return _0x213ef9(_0x1eb1cb[_0x8ff4('0x22')][_0x8ff4('0x24')]);}else{logger[_0x8ff4('0x25')](_0x8ff4('0x1e'),_0x38d519,'request\x20sent');_0x213ef9(_0x1eb1cb[_0x8ff4('0x26')][_0x8ff4('0x24')]);}})['catch'](function(_0x30603d){logger[_0x8ff4('0x22')](_0x8ff4('0x1e'),_0x38d519,_0x30603d);_0x3d68ce(_0x30603d);});});}function respondWithStatusCode(_0x120f4a,_0x56d842){_0x56d842=_0x56d842||0xcc;return function(_0x2876ef){if(_0x2876ef){return _0x120f4a[_0x8ff4('0x27')](_0x56d842);}return _0x120f4a[_0x8ff4('0x28')](_0x56d842)[_0x8ff4('0x29')]();};}function respondWithResult(_0x4b7f04,_0x53dab4){_0x53dab4=_0x53dab4||0xc8;return function(_0x37cdad){if(_0x37cdad){return _0x4b7f04[_0x8ff4('0x28')](_0x53dab4)[_0x8ff4('0x2a')](_0x37cdad);}};}function respondWithFilteredResult(_0x4808b2,_0x1d7c2e){return function(_0x4de33a){if(_0x4de33a){var _0x55e308=_0x4de33a[_0x8ff4('0x2b')],_0x2da9e6=_0x1d7c2e[_0x8ff4('0x2c')],_0x1376ab=_0x1d7c2e[_0x8ff4('0x2c')]+_0x1d7c2e[_0x8ff4('0x2d')],_0x3bcc4d;if(_0x1376ab>=_0x55e308){_0x1376ab=_0x55e308;_0x3bcc4d=0xc8;}else{_0x3bcc4d=0xce;}_0x4808b2['status'](_0x3bcc4d);return _0x4808b2[_0x8ff4('0x2e')](_0x8ff4('0x2f'),_0x2da9e6+'-'+_0x1376ab+'/'+_0x55e308)['json'](_0x4de33a);}return null;};}function patchUpdates(_0x1ced55){return function(_0x471ffc){try{jsonpatch[_0x8ff4('0x30')](_0x471ffc,_0x1ced55,!![]);}catch(_0x4976cd){return BPromise[_0x8ff4('0x31')](_0x4976cd);}return _0x471ffc['save']();};}function saveUpdates(_0x122c26,_0x4f83a4){return function(_0x5e3871){if(_0x5e3871){return _0x5e3871[_0x8ff4('0x32')](_0x122c26)[_0x8ff4('0x33')](function(_0x1f358d){return _0x1f358d;});}return null;};}function removeEntity(_0x300d40,_0x20f792){return function(_0x24d3ad){if(_0x24d3ad){return _0x24d3ad[_0x8ff4('0x34')]()['then'](function(){var _0x5f45a7=_0x24d3ad[_0x8ff4('0x35')]({'plain':!![]});var _0x403610=_0x8ff4('0x36');return db[_0x8ff4('0x37')][_0x8ff4('0x34')]({'where':{'type':_0x403610,'resourceId':_0x5f45a7['id']}})[_0x8ff4('0x33')](function(){return _0x24d3ad;});})[_0x8ff4('0x33')](function(){_0x300d40['status'](0xcc)[_0x8ff4('0x29')]();});}};}function handleEntityNotFound(_0x2dae97,_0x1d7886){return function(_0x4a9367){if(!_0x4a9367){_0x2dae97['sendStatus'](0x194);}return _0x4a9367;};}function handleError(_0x5b555f,_0xa8e01d){_0xa8e01d=_0xa8e01d||0x1f4;return function(_0x2f8a75){logger[_0x8ff4('0x22')](_0x2f8a75['stack']);if(_0x2f8a75[_0x8ff4('0x38')]){delete _0x2f8a75[_0x8ff4('0x38')];}_0x5b555f[_0x8ff4('0x28')](_0xa8e01d)[_0x8ff4('0x39')](_0x2f8a75);};}exports[_0x8ff4('0x3a')]=function(_0x28c508,_0x38479b){var _0x43ee63={},_0x440d2c={},_0xf6bc1c={'count':0x0,'rows':[]};var _0x5eed59=db[_0x8ff4('0x3b')]['rawAttributes'];_0x440d2c[_0x8ff4('0x3c')]=_[_0x8ff4('0x3d')](_0x5eed59);_0x440d2c[_0x8ff4('0x3e')]=_[_0x8ff4('0x3d')](_0x28c508[_0x8ff4('0x3e')]);_0x440d2c[_0x8ff4('0x3f')]=_[_0x8ff4('0x40')](_0x440d2c[_0x8ff4('0x3c')],_0x440d2c['query']);_0x43ee63[_0x8ff4('0x41')]=_[_0x8ff4('0x40')](_0x440d2c[_0x8ff4('0x3c')],qs[_0x8ff4('0x42')](_0x28c508[_0x8ff4('0x3e')]['fields']));_0x43ee63[_0x8ff4('0x41')]=_0x43ee63[_0x8ff4('0x41')][_0x8ff4('0x43')]?_0x43ee63[_0x8ff4('0x41')]:_0x440d2c[_0x8ff4('0x3c')];if(!_0x28c508[_0x8ff4('0x3e')][_0x8ff4('0x44')](_0x8ff4('0x45'))){_0x43ee63[_0x8ff4('0x2d')]=qs[_0x8ff4('0x2d')](_0x28c508[_0x8ff4('0x3e')][_0x8ff4('0x2d')]);_0x43ee63[_0x8ff4('0x2c')]=qs[_0x8ff4('0x2c')](_0x28c508[_0x8ff4('0x3e')][_0x8ff4('0x2c')]);}_0x43ee63[_0x8ff4('0x46')]=qs[_0x8ff4('0x47')](_0x28c508[_0x8ff4('0x3e')][_0x8ff4('0x47')]);_0x43ee63['where']=qs['filters'](_[_0x8ff4('0x48')](_0x28c508['query'],_0x440d2c[_0x8ff4('0x3f')]));if(_0x28c508[_0x8ff4('0x3e')][_0x8ff4('0x49')]){_0x43ee63['where']=_[_0x8ff4('0x4a')](_0x43ee63['where'],{'$or':_['map'](_0x5eed59,function(_0x4afcd9){if(_0x4afcd9[_0x8ff4('0x4b')][_0x8ff4('0x4c')]!==_0x8ff4('0x4d')){var _0x3f029a={};_0x3f029a[_0x4afcd9[_0x8ff4('0x4e')]]={'$like':'%'+_0x28c508[_0x8ff4('0x3e')]['filter']+'%'};return _0x3f029a;}})});}_0x43ee63=_[_0x8ff4('0x4a')]({},_0x43ee63,_0x28c508[_0x8ff4('0x4f')]);var _0x399a1b={'where':_0x43ee63['where']};return db[_0x8ff4('0x3b')][_0x8ff4('0x2b')](_0x399a1b)['then'](function(_0x28ce6a){_0xf6bc1c[_0x8ff4('0x2b')]=_0x28ce6a;if(_0x28c508['query']['includeAll']){_0x43ee63['include']=[{'all':!![]}];}return db['ChatQueue'][_0x8ff4('0x50')](_0x43ee63);})[_0x8ff4('0x33')](function(_0x4a07b3){_0xf6bc1c[_0x8ff4('0x51')]=_0x4a07b3;return _0xf6bc1c;})[_0x8ff4('0x33')](respondWithFilteredResult(_0x38479b,_0x43ee63))[_0x8ff4('0x52')](handleError(_0x38479b,null));};exports[_0x8ff4('0x53')]=function(_0x5c68e7,_0x45e2bb){var _0x445687={'raw':!![],'where':{'id':_0x5c68e7['params']['id']}},_0x2465d0={};_0x2465d0['model']=_['keys'](db[_0x8ff4('0x3b')][_0x8ff4('0x54')]);_0x2465d0['query']=_[_0x8ff4('0x3d')](_0x5c68e7[_0x8ff4('0x3e')]);_0x2465d0['filters']=_['intersection'](_0x2465d0[_0x8ff4('0x3c')],_0x2465d0[_0x8ff4('0x3e')]);_0x445687[_0x8ff4('0x41')]=_[_0x8ff4('0x40')](_0x2465d0[_0x8ff4('0x3c')],qs[_0x8ff4('0x42')](_0x5c68e7[_0x8ff4('0x3e')][_0x8ff4('0x42')]));_0x445687[_0x8ff4('0x41')]=_0x445687[_0x8ff4('0x41')][_0x8ff4('0x43')]?_0x445687[_0x8ff4('0x41')]:_0x2465d0[_0x8ff4('0x3c')];if(_0x5c68e7['query'][_0x8ff4('0x55')]){_0x445687[_0x8ff4('0x56')]=[{'all':!![]}];}_0x445687=_[_0x8ff4('0x4a')]({},_0x445687,_0x5c68e7['options']);return db[_0x8ff4('0x3b')]['find'](_0x445687)[_0x8ff4('0x33')](handleEntityNotFound(_0x45e2bb,null))[_0x8ff4('0x33')](respondWithResult(_0x45e2bb,null))['catch'](handleError(_0x45e2bb,null));};exports[_0x8ff4('0x57')]=function(_0x360cca,_0x59563a){return db[_0x8ff4('0x3b')][_0x8ff4('0x57')](_0x360cca[_0x8ff4('0x58')],{})[_0x8ff4('0x33')](function(_0x46283d){var _0x3f35d2=_0x360cca['user'][_0x8ff4('0x35')]({'plain':!![]});if(!_0x3f35d2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f35d2[_0x8ff4('0x59')]===_0x8ff4('0x5a')){var _0x5e7304=_0x46283d[_0x8ff4('0x35')]({'plain':!![]});var _0x24a848=_0x8ff4('0x36');return db[_0x8ff4('0x5b')][_0x8ff4('0x5c')]({'where':{'name':_0x24a848,'userProfileId':_0x3f35d2['userProfileId']},'raw':!![]})[_0x8ff4('0x33')](function(_0x3b80c9){if(_0x3b80c9&&_0x3b80c9[_0x8ff4('0x5d')]===0x0){return db[_0x8ff4('0x37')][_0x8ff4('0x57')]({'name':_0x5e7304[_0x8ff4('0x38')],'resourceId':_0x5e7304['id'],'type':_0x3b80c9[_0x8ff4('0x38')],'sectionId':_0x3b80c9['id']},{})[_0x8ff4('0x33')](function(){return _0x46283d;});}else{return _0x46283d;}})[_0x8ff4('0x52')](function(_0x22a5cb){logger[_0x8ff4('0x22')](_0x8ff4('0x5e'),_0x22a5cb);throw _0x22a5cb;});}return _0x46283d;})[_0x8ff4('0x33')](respondWithResult(_0x59563a,0xc9))['catch'](handleError(_0x59563a,null));};exports[_0x8ff4('0x32')]=function(_0x1b7a6d,_0x5a2341){if(_0x1b7a6d[_0x8ff4('0x58')]['id']){delete _0x1b7a6d[_0x8ff4('0x58')]['id'];}return db[_0x8ff4('0x3b')][_0x8ff4('0x5c')]({'where':{'id':_0x1b7a6d[_0x8ff4('0x5f')]['id']}})[_0x8ff4('0x33')](handleEntityNotFound(_0x5a2341,null))[_0x8ff4('0x33')](saveUpdates(_0x1b7a6d[_0x8ff4('0x58')],null))[_0x8ff4('0x33')](respondWithResult(_0x5a2341,null))[_0x8ff4('0x52')](handleError(_0x5a2341,null));};exports[_0x8ff4('0x34')]=function(_0x406dee,_0x2bbdb9){return db[_0x8ff4('0x3b')][_0x8ff4('0x5c')]({'where':{'id':_0x406dee['params']['id']}})[_0x8ff4('0x33')](handleEntityNotFound(_0x2bbdb9,null))[_0x8ff4('0x33')](removeEntity(_0x2bbdb9,null))[_0x8ff4('0x52')](handleError(_0x2bbdb9,null));};exports[_0x8ff4('0x60')]=function(_0x4cd733,_0x305843){return db['ChatQueue'][_0x8ff4('0x60')]()[_0x8ff4('0x33')](respondWithResult(_0x305843,null))[_0x8ff4('0x52')](handleError(_0x305843,null));};exports['getMembers']=function(_0x397311,_0x1e4500,_0x23cf5a){var _0x5cb9e5={'raw':!![],'where':{}},_0x5b3dee={},_0x3aefca;return db['ChatQueue'][_0x8ff4('0x61')]({'where':{'id':_0x397311[_0x8ff4('0x5f')]['id']}})[_0x8ff4('0x33')](handleEntityNotFound(_0x1e4500,null))[_0x8ff4('0x33')](function(_0x38399b){if(_0x38399b){_0x3aefca=_0x38399b['get']({'plain':!![]});_0x5b3dee[_0x8ff4('0x3c')]=_[_0x8ff4('0x3d')](db[_0x8ff4('0x62')]['rawAttributes']);_0x5b3dee[_0x8ff4('0x3e')]=_[_0x8ff4('0x3d')](_0x397311[_0x8ff4('0x3e')]);_0x5b3dee['filters']=_[_0x8ff4('0x40')](_0x5b3dee['model'],_0x5b3dee[_0x8ff4('0x3e')]);_0x5cb9e5[_0x8ff4('0x41')]=_[_0x8ff4('0x40')](_0x5b3dee[_0x8ff4('0x3c')],qs[_0x8ff4('0x42')](_0x397311['query'][_0x8ff4('0x42')]));_0x5cb9e5[_0x8ff4('0x41')]=_0x5cb9e5[_0x8ff4('0x41')][_0x8ff4('0x43')]?_0x5cb9e5[_0x8ff4('0x41')]:_0x5b3dee[_0x8ff4('0x3c')];if(!_0x397311[_0x8ff4('0x3e')][_0x8ff4('0x44')]('nolimit')){_0x5cb9e5[_0x8ff4('0x2d')]=qs['limit'](_0x397311[_0x8ff4('0x3e')]['limit']);_0x5cb9e5['offset']=qs[_0x8ff4('0x2c')](_0x397311['query'][_0x8ff4('0x2c')]);}_0x5cb9e5['order']=qs[_0x8ff4('0x47')](_0x397311[_0x8ff4('0x3e')]['sort']);_0x5cb9e5[_0x8ff4('0x63')]=qs[_0x8ff4('0x3f')](_[_0x8ff4('0x48')](_0x397311[_0x8ff4('0x3e')],_0x5b3dee[_0x8ff4('0x3f')]));_0x5cb9e5['where'][_0x8ff4('0x64')]=_0x38399b['id'];if(_0x397311['query']['filter']){_0x5cb9e5['where']=_[_0x8ff4('0x4a')](_0x5cb9e5[_0x8ff4('0x63')],{'$or':_['map'](_0x5cb9e5[_0x8ff4('0x41')],function(_0x109842){var _0x5332aa={};_0x5332aa[_0x109842]={'$like':'%'+_0x397311['query']['filter']+'%'};return _0x5332aa;})});}_0x5cb9e5=_[_0x8ff4('0x4a')]({},_0x5cb9e5,_0x397311['options']);return db['UserChatQueue'][_0x8ff4('0x50')](_0x5cb9e5);}})['then'](function(_0x20777a){if(_0x20777a){return db[_0x8ff4('0x65')][_0x8ff4('0x66')]({'where':{'id':_[_0x8ff4('0x67')](_0x20777a,_0x8ff4('0x68')),'role':'agent'},'attributes':['id',_0x8ff4('0x38'),'chatPause',_0x8ff4('0x69'),_0x8ff4('0x6a')]});}})[_0x8ff4('0x33')](function(_0xbc2c96){if(_0xbc2c96){return{'count':_0xbc2c96[_0x8ff4('0x2b')],'rows':_['map'](_0xbc2c96[_0x8ff4('0x51')],function(_0x554cb2){return{'membername':_0x554cb2[_0x8ff4('0x38')],'UserId':_0x554cb2['id'],'queue_name':_0x3aefca[_0x8ff4('0x38')],'ChatQueueId':_0x3aefca['id'],'interface':util[_0x8ff4('0x6b')](_0x8ff4('0x6c'),_0x8ff4('0x6d'),_0x554cb2[_0x8ff4('0x38')]),'penalty':0x0,'paused':_0x554cb2[_0x8ff4('0x6e')],'createdAt':_0x554cb2[_0x8ff4('0x6a')],'updatedAt':_0x554cb2[_0x8ff4('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1e4500,_0x5cb9e5))[_0x8ff4('0x52')](handleError(_0x1e4500,null));};exports[_0x8ff4('0x6f')]=function(_0x4647ae,_0x316355,_0x4a61e0){var _0x19fa85={};var _0x5f2417={};var _0x22d550;var _0xe252b7;return db[_0x8ff4('0x3b')]['findOne']({'where':{'id':_0x4647ae['params']['id']}})[_0x8ff4('0x33')](handleEntityNotFound(_0x316355,null))['then'](function(_0x7b824e){if(_0x7b824e){_0x22d550=_0x7b824e;_0x5f2417[_0x8ff4('0x3c')]=_['keys'](db[_0x8ff4('0x70')][_0x8ff4('0x54')]);_0x5f2417['query']=_[_0x8ff4('0x3d')](_0x4647ae[_0x8ff4('0x3e')]);_0x5f2417[_0x8ff4('0x3f')]=_[_0x8ff4('0x40')](_0x5f2417[_0x8ff4('0x3c')],_0x5f2417[_0x8ff4('0x3e')]);_0x19fa85[_0x8ff4('0x41')]=_[_0x8ff4('0x40')](_0x5f2417[_0x8ff4('0x3c')],qs[_0x8ff4('0x42')](_0x4647ae[_0x8ff4('0x3e')][_0x8ff4('0x42')]));_0x19fa85[_0x8ff4('0x41')]=_0x19fa85[_0x8ff4('0x41')][_0x8ff4('0x43')]?_0x19fa85[_0x8ff4('0x41')]:_0x5f2417[_0x8ff4('0x3c')];_0x19fa85[_0x8ff4('0x46')]=qs[_0x8ff4('0x47')](_0x4647ae[_0x8ff4('0x3e')][_0x8ff4('0x47')]);_0x19fa85['where']=qs[_0x8ff4('0x3f')](_['pick'](_0x4647ae[_0x8ff4('0x3e')],_0x5f2417[_0x8ff4('0x3f')]));if(_0x4647ae[_0x8ff4('0x3e')]['filter']){_0x19fa85[_0x8ff4('0x63')]=_[_0x8ff4('0x4a')](_0x19fa85[_0x8ff4('0x63')],{'$or':_[_0x8ff4('0x67')](_0x19fa85['attributes'],function(_0xbcf01f){var _0x24b85a={};_0x24b85a[_0xbcf01f]={'$like':'%'+_0x4647ae['query'][_0x8ff4('0x49')]+'%'};return _0x24b85a;})});}_0x19fa85=_[_0x8ff4('0x4a')]({},_0x19fa85,_0x4647ae['options']);return _0x22d550[_0x8ff4('0x6f')](_0x19fa85);}})[_0x8ff4('0x33')](function(_0x21eba){if(_0x21eba){_0xe252b7=_0x21eba[_0x8ff4('0x43')];if(!_0x4647ae[_0x8ff4('0x3e')]['hasOwnProperty']('nolimit')){_0x19fa85[_0x8ff4('0x2d')]=qs['limit'](_0x4647ae[_0x8ff4('0x3e')][_0x8ff4('0x2d')]);_0x19fa85[_0x8ff4('0x2c')]=qs[_0x8ff4('0x2c')](_0x4647ae[_0x8ff4('0x3e')][_0x8ff4('0x2c')]);}return _0x22d550[_0x8ff4('0x6f')](_0x19fa85);}})[_0x8ff4('0x33')](function(_0x333d4c){if(_0x333d4c){return _0x333d4c?{'count':_0xe252b7,'rows':_0x333d4c}:null;}})[_0x8ff4('0x33')](respondWithResult(_0x316355,null))[_0x8ff4('0x52')](handleError(_0x316355,null));};exports[_0x8ff4('0x71')]=function(_0x4c8793,_0x2c8c88,_0x4781a6){var _0x431484=[];var _0x1c7f65;return db[_0x8ff4('0x70')][_0x8ff4('0x50')]({'where':{'id':_0x4c8793[_0x8ff4('0x58')][_0x8ff4('0x72')]},'attributes':['id'],'include':[{'model':db[_0x8ff4('0x65')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x8ff4('0x33')](function(_0x5859a2){if(_0x5859a2){for(var _0x45b457=0x0;_0x45b457<_0x5859a2['length'];_0x45b457+=0x1){for(var _0x4f027b=0x0;_0x4f027b<_0x5859a2[_0x45b457]['Agents'][_0x8ff4('0x43')];_0x4f027b+=0x1){_0x431484=_[_0x8ff4('0x73')](_0x431484,[_0x5859a2[_0x45b457][_0x8ff4('0x74')][_0x4f027b]['id']]);}}return _0x431484;}})[_0x8ff4('0x33')](function(_0x23b93e){if(_0x23b93e){return db['ChatQueue'][_0x8ff4('0x5c')]({'where':{'id':_0x4c8793['params']['id']}});}})[_0x8ff4('0x33')](function(_0x19aeed){if(_0x19aeed){_0x1c7f65=_0x19aeed;return _0x1c7f65['addAgents'](_0x431484,{'penalty':_0x4c8793[_0x8ff4('0x58')][_0x8ff4('0x75')]});}})['then'](function(_0x3417fd){if(_0x3417fd){return _0x1c7f65[_0x8ff4('0x71')](_0x4c8793[_0x8ff4('0x58')]['ids']);}})[_0x8ff4('0x33')](handleEntityNotFound(_0x2c8c88,null))['then'](respondWithStatusCode(_0x2c8c88,null))['catch'](handleError(_0x2c8c88,null));};exports[_0x8ff4('0x76')]=function(_0x2b5153,_0x4a8421,_0x4cfb6d){var _0x580b8e=[];var _0x33c1bd;return db[_0x8ff4('0x70')][_0x8ff4('0x50')]({'where':{'id':_0x2b5153[_0x8ff4('0x3e')][_0x8ff4('0x72')]},'attributes':['id'],'include':[{'model':db[_0x8ff4('0x65')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x8ff4('0x33')](function(_0x568c18){if(_0x568c18){for(var _0x5b1445=0x0;_0x5b1445<_0x568c18[_0x8ff4('0x43')];_0x5b1445+=0x1){for(var _0x4249b0=0x0;_0x4249b0<_0x568c18[_0x5b1445][_0x8ff4('0x74')][_0x8ff4('0x43')];_0x4249b0+=0x1){_0x580b8e=_[_0x8ff4('0x73')](_0x580b8e,[_0x568c18[_0x5b1445][_0x8ff4('0x74')][_0x4249b0]['id']]);}}return _0x580b8e;}})[_0x8ff4('0x33')](function(_0x1e3ebf){if(_0x1e3ebf){return db[_0x8ff4('0x3b')][_0x8ff4('0x5c')]({'where':{'id':_0x2b5153[_0x8ff4('0x5f')]['id']}});}})['then'](function(_0x4e3d87){if(_0x4e3d87){_0x33c1bd=_0x4e3d87;return _0x33c1bd[_0x8ff4('0x77')](_0x580b8e);}})[_0x8ff4('0x33')](function(_0x27d664){if(_0x33c1bd){return _0x33c1bd[_0x8ff4('0x76')](_0x2b5153[_0x8ff4('0x3e')][_0x8ff4('0x72')]);}})[_0x8ff4('0x33')](handleEntityNotFound(_0x4a8421,null))[_0x8ff4('0x33')](respondWithStatusCode(_0x4a8421,null))[_0x8ff4('0x52')](handleError(_0x4a8421,null));};exports['addAgents']=function(_0x37a9a2,_0x3ffd53,_0x47c0c4){return db[_0x8ff4('0x3b')]['find']({'where':{'id':_0x37a9a2['params']['id']}})[_0x8ff4('0x33')](handleEntityNotFound(_0x3ffd53,null))[_0x8ff4('0x33')](function(_0x59ddb8){if(_0x59ddb8){return _0x59ddb8['addAgents'](_0x37a9a2[_0x8ff4('0x58')]['ids'],_[_0x8ff4('0x78')](_0x37a9a2[_0x8ff4('0x58')],['ids','id'])||{})[_0x8ff4('0x79')](function(_0x58dcbd){for(var _0x1d372b=0x0;_0x1d372b<_0x37a9a2[_0x8ff4('0x58')][_0x8ff4('0x72')]['length'];_0x1d372b+=0x1){socket[_0x8ff4('0x7a')](_0x8ff4('0x7b'),{'UserId':_0x37a9a2['body'][_0x8ff4('0x72')][_0x1d372b],'ChatQueueId':_0x37a9a2[_0x8ff4('0x5f')]['id']});}return _0x58dcbd;});}})[_0x8ff4('0x33')](respondWithResult(_0x3ffd53,null))['catch'](handleError(_0x3ffd53,null));};exports[_0x8ff4('0x77')]=function(_0x419300,_0x198f3f,_0x54ceb8){var _0x4dbf38;return db[_0x8ff4('0x3b')][_0x8ff4('0x5c')]({'where':{'id':_0x419300['params']['id']}})[_0x8ff4('0x33')](handleEntityNotFound(_0x198f3f,null))[_0x8ff4('0x33')](function(_0x10004a){if(_0x10004a){return _0x10004a[_0x8ff4('0x77')](_0x419300['query'][_0x8ff4('0x72')])[_0x8ff4('0x33')](function(_0x1a4d45){if(_[_0x8ff4('0x7c')](_0x419300[_0x8ff4('0x3e')][_0x8ff4('0x72')])){for(var _0x105731=0x0;_0x105731<_0x419300[_0x8ff4('0x3e')][_0x8ff4('0x72')]['length'];_0x105731+=0x1){socket[_0x8ff4('0x7a')]('userChatQueue:remove',{'UserId':_0x419300[_0x8ff4('0x3e')][_0x8ff4('0x72')][_0x105731],'ChatQueueId':_0x419300[_0x8ff4('0x5f')]['id']});}}else{socket[_0x8ff4('0x7a')](_0x8ff4('0x7d'),{'UserId':_0x419300[_0x8ff4('0x3e')][_0x8ff4('0x72')],'ChatQueueId':_0x419300['params']['id']});}});}})[_0x8ff4('0x33')](respondWithStatusCode(_0x198f3f,null))[_0x8ff4('0x52')](handleError(_0x198f3f,null));};exports['getAgents']=function(_0x19f9b7,_0x124c00,_0x5477d6){var _0x1f238d={};var _0x1784bb={};var _0x399bbb;var _0x5e30de;return db[_0x8ff4('0x3b')][_0x8ff4('0x61')]({'where':{'id':_0x19f9b7[_0x8ff4('0x5f')]['id']}})[_0x8ff4('0x33')](handleEntityNotFound(_0x124c00,null))[_0x8ff4('0x33')](function(_0x465a88){if(_0x465a88){_0x399bbb=_0x465a88;_0x1784bb[_0x8ff4('0x3c')]=_['keys'](db[_0x8ff4('0x65')][_0x8ff4('0x54')]);_0x1784bb[_0x8ff4('0x3e')]=_['keys'](_0x19f9b7['query']);_0x1784bb[_0x8ff4('0x3f')]=_[_0x8ff4('0x40')](_0x1784bb[_0x8ff4('0x3c')],_0x1784bb['query']);_0x1f238d[_0x8ff4('0x41')]=_[_0x8ff4('0x40')](_0x1784bb[_0x8ff4('0x3c')],qs[_0x8ff4('0x42')](_0x19f9b7[_0x8ff4('0x3e')][_0x8ff4('0x42')]));_0x1f238d[_0x8ff4('0x41')]=_0x1f238d[_0x8ff4('0x41')]['length']?_0x1f238d[_0x8ff4('0x41')]:_0x1784bb['model'];_0x1f238d['order']=qs[_0x8ff4('0x47')](_0x19f9b7[_0x8ff4('0x3e')][_0x8ff4('0x47')]);_0x1f238d[_0x8ff4('0x63')]=qs[_0x8ff4('0x3f')](_[_0x8ff4('0x48')](_0x19f9b7[_0x8ff4('0x3e')],_0x1784bb[_0x8ff4('0x3f')]));if(_0x19f9b7[_0x8ff4('0x3e')]['filter']){_0x1f238d[_0x8ff4('0x63')]=_['merge'](_0x1f238d['where'],{'$or':_[_0x8ff4('0x67')](_0x1f238d['attributes'],function(_0xfba89){var _0x210726={};_0x210726[_0xfba89]={'$like':'%'+_0x19f9b7[_0x8ff4('0x3e')][_0x8ff4('0x49')]+'%'};return _0x210726;})});}_0x1f238d=_[_0x8ff4('0x4a')]({},_0x1f238d,_0x19f9b7['options']);return _0x399bbb[_0x8ff4('0x7e')](_0x1f238d);}})[_0x8ff4('0x33')](function(_0x111431){if(_0x111431){_0x5e30de=_0x111431[_0x8ff4('0x43')];if(!_0x19f9b7['query'][_0x8ff4('0x44')](_0x8ff4('0x45'))){_0x1f238d[_0x8ff4('0x2d')]=qs['limit'](_0x19f9b7[_0x8ff4('0x3e')][_0x8ff4('0x2d')]);_0x1f238d[_0x8ff4('0x2c')]=qs[_0x8ff4('0x2c')](_0x19f9b7[_0x8ff4('0x3e')][_0x8ff4('0x2c')]);}return _0x399bbb[_0x8ff4('0x7e')](_0x1f238d);}})[_0x8ff4('0x33')](function(_0x199d95){if(_0x199d95){return _0x199d95?{'count':_0x5e30de,'rows':_0x199d95}:null;}})['then'](respondWithResult(_0x124c00,null))['catch'](handleError(_0x124c00,null));};
\ No newline at end of file
index a9b25c5..00cfbf9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2697=['../../mysqldb','ChatQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x3ad905,_0x3c3ce0){var _0x2aa3f3=function(_0x20727f){while(--_0x20727f){_0x3ad905['push'](_0x3ad905['shift']());}};_0x2aa3f3(++_0x3c3ce0);}(_0x2697,0x120));var _0x7269=function(_0x5d6e35,_0x4d1ac0){_0x5d6e35=_0x5d6e35-0x0;var _0x5d7ada=_0x2697[_0x5d6e35];return _0x5d7ada;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x7269('0x0'))['db'][_0x7269('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x7269('0x2')](0x0);var events={'afterCreate':_0x7269('0x3'),'afterUpdate':_0x7269('0x4'),'afterDestroy':'remove'};function emitEvent(_0x160a89){return function(_0x4a084b,_0x5bc3e4,_0x2b2be8){ChatQueueEvents[_0x7269('0x5')](_0x160a89+':'+_0x4a084b['id'],_0x4a084b);ChatQueueEvents[_0x7269('0x5')](_0x160a89,_0x4a084b);_0x2b2be8(null);};}for(var e in events){if(events[_0x7269('0x6')](e)){var event=events[e];ChatQueue[_0x7269('0x7')](e,emitEvent(event));}}module[_0x7269('0x8')]=ChatQueueEvents;
\ No newline at end of file
+var _0xe1bf=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x1295a,_0x3c87c0){var _0x8dc106=function(_0x419adf){while(--_0x419adf){_0x1295a['push'](_0x1295a['shift']());}};_0x8dc106(++_0x3c87c0);}(_0xe1bf,0x67));var _0xfe1b=function(_0x46d078,_0x3af064){_0x46d078=_0x46d078-0x0;var _0x9e8bc7=_0xe1bf[_0x46d078];return _0x9e8bc7;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0xfe1b('0x0'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xfe1b('0x1')](0x0);var events={'afterCreate':_0xfe1b('0x2'),'afterUpdate':_0xfe1b('0x3'),'afterDestroy':_0xfe1b('0x4')};function emitEvent(_0x4cdabd){return function(_0x2dcee6,_0x151dab,_0x465c03){ChatQueueEvents[_0xfe1b('0x5')](_0x4cdabd+':'+_0x2dcee6['id'],_0x2dcee6);ChatQueueEvents['emit'](_0x4cdabd,_0x2dcee6);_0x465c03(null);};}for(var e in events){if(events[_0xfe1b('0x6')](e)){var event=events[e];ChatQueue[_0xfe1b('0x7')](e,emitEvent(event));}}module[_0xfe1b('0x8')]=ChatQueueEvents;
\ No newline at end of file
index 8f7ecaa..22911e5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','./chatQueue.attributes','define'];(function(_0x114984,_0x5c9593){var _0x44822b=function(_0x10af37){while(--_0x10af37){_0x114984['push'](_0x114984['shift']());}};_0x44822b(++_0x5c9593);}(_0x5fc3,0xa8));var _0x35fc=function(_0x590851,_0x496bee){_0x590851=_0x590851-0x0;var _0x3b0115=_0x5fc3[_0x590851];return _0x3b0115;};'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 attributes=require(_0x35fc('0x6'));module['exports']=function(_0x2d1404,_0x1d5fec){return _0x2d1404[_0x35fc('0x7')]('ChatQueue',attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xb138=['api','moment','bluebird','request-promise','exports','ChatQueue','chat_queues','lodash','util','../../config/logger'];(function(_0x269b97,_0x10d133){var _0x120efa=function(_0xef252d){while(--_0xef252d){_0x269b97['push'](_0x269b97['shift']());}};_0x120efa(++_0x10d133);}(_0xb138,0x1dd));var _0x8b13=function(_0x3e7f6e,_0x355e95){_0x3e7f6e=_0x3e7f6e-0x0;var _0x4aa366=_0xb138[_0x3e7f6e];return _0x4aa366;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var logger=require(_0x8b13('0x2'))(_0x8b13('0x3'));var moment=require(_0x8b13('0x4'));var BPromise=require(_0x8b13('0x5'));var rp=require(_0x8b13('0x6'));var attributes=require('./chatQueue.attributes');module[_0x8b13('0x7')]=function(_0x241acb,_0x3af81a){return _0x241acb['define'](_0x8b13('0x8'),attributes,{'tableName':_0x8b13('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 3848801..6aed71c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x49c1=['redis','defaults','socket.io-emitter','register','request','then','info','request\x20sent','debug','stringify','error','message','ChatQueue,\x20%s,\x20%s','result','catch','GetChatQueue','ChatQueue','options','raw','where','include','attributes','map','model','ShowChatQueue','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http'];(function(_0x5d5632,_0x16cf0b){var _0x41b3b0=function(_0x52517d){while(--_0x52517d){_0x5d5632['push'](_0x5d5632['shift']());}};_0x41b3b0(++_0x16cf0b);}(_0x49c1,0xc8));var _0x149c=function(_0x31494d,_0x107fa5){_0x31494d=_0x31494d-0x0;var _0x399a40=_0x49c1[_0x31494d];return _0x399a40;};'use strict';var _=require(_0x149c('0x0'));var util=require(_0x149c('0x1'));var moment=require(_0x149c('0x2'));var BPromise=require(_0x149c('0x3'));var rs=require(_0x149c('0x4'));var fs=require('fs');var Redis=require(_0x149c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x149c('0x6'));var config=require(_0x149c('0x7'));var jayson=require(_0x149c('0x8'));var client=jayson['client'][_0x149c('0x9')]({'port':0x232a});config[_0x149c('0xa')]=_[_0x149c('0xb')](config[_0x149c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x149c('0xc'))(new Redis(config[_0x149c('0xa')]));require('./chatQueue.socket')[_0x149c('0xd')](socket);function respondWithRpcPromise(_0x1497d9,_0x12d78f,_0x4c10e5){return new BPromise(function(_0xaeb4cb,_0x17d5e9){return client[_0x149c('0xe')](_0x1497d9,_0x4c10e5)[_0x149c('0xf')](function(_0xde4051){logger[_0x149c('0x10')]('ChatQueue,\x20%s,\x20%s',_0x12d78f,_0x149c('0x11'));logger[_0x149c('0x12')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x12d78f,_0x149c('0x11'),JSON[_0x149c('0x13')](_0xde4051));if(_0xde4051['error']){if(_0xde4051[_0x149c('0x14')]['code']===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x12d78f,_0xde4051[_0x149c('0x14')][_0x149c('0x15')]);return _0x17d5e9(_0xde4051[_0x149c('0x14')][_0x149c('0x15')]);}logger[_0x149c('0x14')](_0x149c('0x16'),_0x12d78f,_0xde4051[_0x149c('0x14')]['message']);return _0xaeb4cb(_0xde4051['error']['message']);}else{logger[_0x149c('0x10')](_0x149c('0x16'),_0x12d78f,_0x149c('0x11'));_0xaeb4cb(_0xde4051[_0x149c('0x17')]['message']);}})[_0x149c('0x18')](function(_0x27c13c){logger[_0x149c('0x14')](_0x149c('0x16'),_0x12d78f,_0x27c13c);_0x17d5e9(_0x27c13c);});});}exports[_0x149c('0x19')]=function(_0x561a81){var _0x5ed9ab=this;return new Promise(function(_0x28766a,_0x1436ac){return db[_0x149c('0x1a')]['findAll']({'raw':_0x561a81[_0x149c('0x1b')]?_0x561a81[_0x149c('0x1b')][_0x149c('0x1c')]===undefined?!![]:![]:!![],'where':_0x561a81[_0x149c('0x1b')]?_0x561a81[_0x149c('0x1b')][_0x149c('0x1d')]||null:null,'attributes':_0x561a81[_0x149c('0x1b')]?_0x561a81[_0x149c('0x1b')]['attributes']||null:null,'limit':_0x561a81[_0x149c('0x1b')]?_0x561a81[_0x149c('0x1b')]['limit']||null:null,'include':_0x561a81[_0x149c('0x1b')]?_0x561a81[_0x149c('0x1b')]['include']?_['map'](_0x561a81['options'][_0x149c('0x1e')],function(_0x36af53){return{'model':db[_0x36af53['model']],'as':_0x36af53['as'],'attributes':_0x36af53[_0x149c('0x1f')],'include':_0x36af53['include']?_[_0x149c('0x20')](_0x36af53[_0x149c('0x1e')],function(_0x90ad6d){return{'model':db[_0x90ad6d[_0x149c('0x21')]],'as':_0x90ad6d['as'],'attributes':_0x90ad6d[_0x149c('0x1f')],'include':_0x90ad6d['include']?_[_0x149c('0x20')](_0x90ad6d['include'],function(_0x24c989){return{'model':db[_0x24c989[_0x149c('0x21')]],'as':_0x24c989['as'],'attributes':_0x24c989['attributes']};}):[]};}):[]};}):[]:[]})[_0x149c('0xf')](function(_0x141ec5){logger['info'](_0x149c('0x19'),_0x561a81);logger[_0x149c('0x12')](_0x149c('0x19'),_0x561a81,JSON[_0x149c('0x13')](_0x141ec5));_0x28766a(_0x141ec5);})['catch'](function(_0x28d009){logger['error'](_0x149c('0x19'),_0x28d009[_0x149c('0x15')],_0x561a81);_0x1436ac(_0x5ed9ab[_0x149c('0x14')](0x1f4,_0x28d009[_0x149c('0x15')]));});});};exports[_0x149c('0x22')]=function(_0x5e2d48){var _0x1365c6=this;return new Promise(function(_0x4e98bb,_0xce0510){return db[_0x149c('0x1a')]['find']({'raw':_0x5e2d48[_0x149c('0x1b')]?_0x5e2d48[_0x149c('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5e2d48[_0x149c('0x1b')]?_0x5e2d48[_0x149c('0x1b')]['where']||null:null,'attributes':_0x5e2d48[_0x149c('0x1b')]?_0x5e2d48[_0x149c('0x1b')]['attributes']||null:null,'include':_0x5e2d48[_0x149c('0x1b')]?_0x5e2d48[_0x149c('0x1b')]['include']?_[_0x149c('0x20')](_0x5e2d48[_0x149c('0x1b')][_0x149c('0x1e')],function(_0x8f1f39){return{'model':db[_0x8f1f39[_0x149c('0x21')]],'as':_0x8f1f39['as'],'attributes':_0x8f1f39['attributes'],'include':_0x8f1f39[_0x149c('0x1e')]?_[_0x149c('0x20')](_0x8f1f39[_0x149c('0x1e')],function(_0x59979c){return{'model':db[_0x59979c[_0x149c('0x21')]],'as':_0x59979c['as'],'attributes':_0x59979c[_0x149c('0x1f')],'include':_0x59979c[_0x149c('0x1e')]?_[_0x149c('0x20')](_0x59979c[_0x149c('0x1e')],function(_0x246275){return{'model':db[_0x246275[_0x149c('0x21')]],'as':_0x246275['as'],'attributes':_0x246275[_0x149c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x149c('0xf')](function(_0x2bae9a){logger[_0x149c('0x10')](_0x149c('0x22'),_0x5e2d48);logger[_0x149c('0x12')](_0x149c('0x22'),_0x5e2d48,JSON[_0x149c('0x13')](_0x2bae9a));_0x4e98bb(_0x2bae9a);})[_0x149c('0x18')](function(_0x261611){logger[_0x149c('0x14')](_0x149c('0x22'),_0x261611[_0x149c('0x15')],_0x5e2d48);_0xce0510(_0x1365c6['error'](0x1f4,_0x261611[_0x149c('0x15')]));});});};
\ No newline at end of file
+var _0x729b=['ShowChatQueue','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','socket.io-emitter','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','GetChatQueue','ChatQueue','options','raw','where','attributes','limit','include','map','model','stringify','find'];(function(_0x22f85a,_0x195ed5){var _0xaa717=function(_0xe9828e){while(--_0xe9828e){_0x22f85a['push'](_0x22f85a['shift']());}};_0xaa717(++_0x195ed5);}(_0x729b,0x1d5));var _0xb729=function(_0x4d7b1f,_0x2f449e){_0x4d7b1f=_0x4d7b1f-0x0;var _0x1d8598=_0x729b[_0x4d7b1f];return _0x1d8598;};'use strict';var _=require(_0xb729('0x0'));var util=require(_0xb729('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb729('0x2'));var fs=require('fs');var Redis=require(_0xb729('0x3'));var db=require(_0xb729('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb729('0x5'))('rpc');var config=require(_0xb729('0x6'));var jayson=require(_0xb729('0x7'));var client=jayson['client'][_0xb729('0x8')]({'port':0x232a});config[_0xb729('0x9')]=_['defaults'](config[_0xb729('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xb729('0xa'))(new Redis(config[_0xb729('0x9')]));require('./chatQueue.socket')['register'](socket);function respondWithRpcPromise(_0x4f6c15,_0xd865e8,_0x2faec6){return new BPromise(function(_0xb6c817,_0x5c043d){return client[_0xb729('0xb')](_0x4f6c15,_0x2faec6)[_0xb729('0xc')](function(_0x33b698){logger[_0xb729('0xd')](_0xb729('0xe'),_0xd865e8,'request\x20sent');logger[_0xb729('0xf')](_0xb729('0x10'),_0xd865e8,_0xb729('0x11'),JSON['stringify'](_0x33b698));if(_0x33b698['error']){if(_0x33b698['error'][_0xb729('0x12')]===0x1f4){logger[_0xb729('0x13')]('ChatQueue,\x20%s,\x20%s',_0xd865e8,_0x33b698[_0xb729('0x13')]['message']);return _0x5c043d(_0x33b698['error']['message']);}logger['error'](_0xb729('0xe'),_0xd865e8,_0x33b698[_0xb729('0x13')]['message']);return _0xb6c817(_0x33b698['error'][_0xb729('0x14')]);}else{logger[_0xb729('0xd')]('ChatQueue,\x20%s,\x20%s',_0xd865e8,_0xb729('0x11'));_0xb6c817(_0x33b698[_0xb729('0x15')][_0xb729('0x14')]);}})[_0xb729('0x16')](function(_0x3e122d){logger[_0xb729('0x13')]('ChatQueue,\x20%s,\x20%s',_0xd865e8,_0x3e122d);_0x5c043d(_0x3e122d);});});}exports[_0xb729('0x17')]=function(_0x117cdc){var _0x367646=this;return new Promise(function(_0x53363b,_0x22c8e4){return db[_0xb729('0x18')]['findAll']({'raw':_0x117cdc[_0xb729('0x19')]?_0x117cdc['options'][_0xb729('0x1a')]===undefined?!![]:![]:!![],'where':_0x117cdc[_0xb729('0x19')]?_0x117cdc[_0xb729('0x19')][_0xb729('0x1b')]||null:null,'attributes':_0x117cdc[_0xb729('0x19')]?_0x117cdc[_0xb729('0x19')][_0xb729('0x1c')]||null:null,'limit':_0x117cdc[_0xb729('0x19')]?_0x117cdc[_0xb729('0x19')][_0xb729('0x1d')]||null:null,'include':_0x117cdc['options']?_0x117cdc[_0xb729('0x19')][_0xb729('0x1e')]?_[_0xb729('0x1f')](_0x117cdc[_0xb729('0x19')][_0xb729('0x1e')],function(_0x333c5c){return{'model':db[_0x333c5c[_0xb729('0x20')]],'as':_0x333c5c['as'],'attributes':_0x333c5c['attributes'],'include':_0x333c5c[_0xb729('0x1e')]?_[_0xb729('0x1f')](_0x333c5c[_0xb729('0x1e')],function(_0x549910){return{'model':db[_0x549910['model']],'as':_0x549910['as'],'attributes':_0x549910['attributes'],'include':_0x549910[_0xb729('0x1e')]?_[_0xb729('0x1f')](_0x549910[_0xb729('0x1e')],function(_0x2461f4){return{'model':db[_0x2461f4[_0xb729('0x20')]],'as':_0x2461f4['as'],'attributes':_0x2461f4[_0xb729('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb729('0xc')](function(_0x4e77a4){logger[_0xb729('0xd')](_0xb729('0x17'),_0x117cdc);logger[_0xb729('0xf')](_0xb729('0x17'),_0x117cdc,JSON[_0xb729('0x21')](_0x4e77a4));_0x53363b(_0x4e77a4);})['catch'](function(_0x34c07d){logger[_0xb729('0x13')](_0xb729('0x17'),_0x34c07d[_0xb729('0x14')],_0x117cdc);_0x22c8e4(_0x367646[_0xb729('0x13')](0x1f4,_0x34c07d[_0xb729('0x14')]));});});};exports['ShowChatQueue']=function(_0x1ceec0){var _0x593245=this;return new Promise(function(_0x4d94dd,_0x1583f1){return db[_0xb729('0x18')][_0xb729('0x22')]({'raw':_0x1ceec0[_0xb729('0x19')]?_0x1ceec0[_0xb729('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1ceec0[_0xb729('0x19')]?_0x1ceec0[_0xb729('0x19')][_0xb729('0x1b')]||null:null,'attributes':_0x1ceec0['options']?_0x1ceec0[_0xb729('0x19')][_0xb729('0x1c')]||null:null,'include':_0x1ceec0['options']?_0x1ceec0[_0xb729('0x19')][_0xb729('0x1e')]?_['map'](_0x1ceec0[_0xb729('0x19')][_0xb729('0x1e')],function(_0x6023f3){return{'model':db[_0x6023f3[_0xb729('0x20')]],'as':_0x6023f3['as'],'attributes':_0x6023f3[_0xb729('0x1c')],'include':_0x6023f3[_0xb729('0x1e')]?_[_0xb729('0x1f')](_0x6023f3[_0xb729('0x1e')],function(_0x3c781f){return{'model':db[_0x3c781f['model']],'as':_0x3c781f['as'],'attributes':_0x3c781f['attributes'],'include':_0x3c781f[_0xb729('0x1e')]?_['map'](_0x3c781f[_0xb729('0x1e')],function(_0x5351e4){return{'model':db[_0x5351e4['model']],'as':_0x5351e4['as'],'attributes':_0x5351e4['attributes']};}):[]};}):[]};}):[]:[]})[_0xb729('0xc')](function(_0x1d5ffc){logger[_0xb729('0xd')]('ShowChatQueue',_0x1ceec0);logger[_0xb729('0xf')](_0xb729('0x23'),_0x1ceec0,JSON[_0xb729('0x21')](_0x1d5ffc));_0x4d94dd(_0x1d5ffc);})[_0xb729('0x16')](function(_0x7e0d3e){logger[_0xb729('0x13')](_0xb729('0x23'),_0x7e0d3e['message'],_0x1ceec0);_0x1583f1(_0x593245['error'](0x1f4,_0x7e0d3e[_0xb729('0x14')]));});});};
\ No newline at end of file
index f984ead..8703edb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['register','length','chatQueue:','./chatQueue.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(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var ChatQueueEvents=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(){ChatQueueEvents[_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);ChatQueueEvents['on'](_0x5f41ea,_0x503809);}};
\ No newline at end of file
+var _0xa9e0=['register','length','chatQueue:','./chatQueue.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(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var ChatQueueEvents=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(){ChatQueueEvents[_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);ChatQueueEvents['on'](_0x5f41ea,_0x503809);}};
\ No newline at end of file
index bc665dc..bdba948 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a94=['express','Router','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','util','connect-timeout'];(function(_0x421165,_0x27fa31){var _0x3cf3cc=function(_0xd9c5ee){while(--_0xd9c5ee){_0x421165['push'](_0x421165['shift']());}};_0x3cf3cc(++_0x27fa31);}(_0x7a94,0x177));var _0x47a9=function(_0x3482d4,_0x296dae){_0x3482d4=_0x3482d4-0x0;var _0x50d9ba=_0x7a94[_0x3482d4];return _0x50d9ba;};'use strict';var multer=require('multer');var util=require(_0x47a9('0x0'));var path=require('path');var timeout=require(_0x47a9('0x1'));var express=require(_0x47a9('0x2'));var router=express[_0x47a9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a9('0x4'));var config=require(_0x47a9('0x5'));var controller=require(_0x47a9('0x6'));router[_0x47a9('0x7')]('/',auth[_0x47a9('0x8')](),controller[_0x47a9('0x9')]);router['get'](_0x47a9('0xa'),auth[_0x47a9('0x8')](),controller[_0x47a9('0xb')]);router[_0x47a9('0x7')](_0x47a9('0xc'),auth['isAuthenticated'](),controller[_0x47a9('0xd')]);router['get']('/:id/members',auth[_0x47a9('0x8')](),controller[_0x47a9('0xe')]);router[_0x47a9('0x7')](_0x47a9('0xf'),auth[_0x47a9('0x8')](),controller[_0x47a9('0x10')]);router[_0x47a9('0x7')](_0x47a9('0x11'),auth['isAuthenticated'](),controller[_0x47a9('0x12')]);router[_0x47a9('0x13')]('/',auth['isAuthenticated'](),controller[_0x47a9('0x14')]);router[_0x47a9('0x13')](_0x47a9('0xf'),auth[_0x47a9('0x8')](),controller[_0x47a9('0x15')]);router[_0x47a9('0x13')]('/:id/users',auth[_0x47a9('0x8')](),controller[_0x47a9('0x16')]);router[_0x47a9('0x17')]('/:id',auth[_0x47a9('0x8')](),controller[_0x47a9('0x18')]);router[_0x47a9('0x19')](_0x47a9('0xc'),auth[_0x47a9('0x8')](),controller[_0x47a9('0x1a')]);router['delete'](_0x47a9('0xf'),auth[_0x47a9('0x8')](),controller[_0x47a9('0x1b')]);router[_0x47a9('0x19')](_0x47a9('0x11'),auth['isAuthenticated'](),controller[_0x47a9('0x1c')]);module['exports']=router;
\ No newline at end of file
+var _0x9bee=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getTeams','/:id/users','post','create','/:id/teams','put','destroy','removeTeams','removeAgents','exports'];(function(_0x5ad67f,_0xb9e32d){var _0x5670f4=function(_0x394a05){while(--_0x394a05){_0x5ad67f['push'](_0x5ad67f['shift']());}};_0x5670f4(++_0xb9e32d);}(_0x9bee,0x1ee));var _0xe9be=function(_0x4ece86,_0x1dc146){_0x4ece86=_0x4ece86-0x0;var _0x554c0e=_0x9bee[_0x4ece86];return _0x554c0e;};'use strict';var multer=require(_0xe9be('0x0'));var util=require(_0xe9be('0x1'));var path=require(_0xe9be('0x2'));var timeout=require(_0xe9be('0x3'));var express=require(_0xe9be('0x4'));var router=express[_0xe9be('0x5')]();var auth=require(_0xe9be('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe9be('0x7'));var controller=require(_0xe9be('0x8'));router[_0xe9be('0x9')]('/',auth[_0xe9be('0xa')](),controller['index']);router[_0xe9be('0x9')](_0xe9be('0xb'),auth[_0xe9be('0xa')](),controller[_0xe9be('0xc')]);router[_0xe9be('0x9')](_0xe9be('0xd'),auth[_0xe9be('0xa')](),controller[_0xe9be('0xe')]);router[_0xe9be('0x9')](_0xe9be('0xf'),auth[_0xe9be('0xa')](),controller['getMembers']);router[_0xe9be('0x9')]('/:id/teams',auth[_0xe9be('0xa')](),controller[_0xe9be('0x10')]);router[_0xe9be('0x9')](_0xe9be('0x11'),auth[_0xe9be('0xa')](),controller['getAgents']);router[_0xe9be('0x12')]('/',auth[_0xe9be('0xa')](),controller[_0xe9be('0x13')]);router[_0xe9be('0x12')](_0xe9be('0x14'),auth[_0xe9be('0xa')](),controller['addTeams']);router['post'](_0xe9be('0x11'),auth[_0xe9be('0xa')](),controller['addAgents']);router[_0xe9be('0x15')](_0xe9be('0xd'),auth[_0xe9be('0xa')](),controller['update']);router['delete'](_0xe9be('0xd'),auth[_0xe9be('0xa')](),controller[_0xe9be('0x16')]);router['delete'](_0xe9be('0x14'),auth['isAuthenticated'](),controller[_0xe9be('0x17')]);router['delete'](_0xe9be('0x11'),auth[_0xe9be('0xa')](),controller[_0xe9be('0x18')]);module[_0xe9be('0x19')]=router;
\ No newline at end of file
index 35bc390..258e3c3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x79bf=['exports','STRING','DATE','moment','sequelize'];(function(_0x4705b0,_0x547543){var _0xe16e86=function(_0x1a3c6f){while(--_0x1a3c6f){_0x4705b0['push'](_0x4705b0['shift']());}};_0xe16e86(++_0x547543);}(_0x79bf,0x76));var _0xf79b=function(_0x3e5147,_0x33eef9){_0x3e5147=_0x3e5147-0x0;var _0x18c779=_0x79bf[_0x3e5147];return _0x18c779;};'use strict';var moment=require(_0xf79b('0x0'));var Sequelize=require(_0xf79b('0x1'));module[_0xf79b('0x2')]={'uniqueid':{'type':Sequelize[_0xf79b('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xf79b('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xf79b('0x4')]},'acceptAt':{'type':Sequelize[_0xf79b('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xf79b('0x3')]}};
\ No newline at end of file
+var _0x0599=['DATE','exports','STRING'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x0599,0xd3));var _0x9059=function(_0xecbd84,_0x4f721b){_0xecbd84=_0xecbd84-0x0;var _0x97bd35=_0x0599[_0xecbd84];return _0x97bd35;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x9059('0x0')]={'uniqueid':{'type':Sequelize[_0x9059('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9059('0x2')]},'leaveAt':{'type':Sequelize[_0x9059('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9059('0x2')]},'reason':{'type':Sequelize[_0x9059('0x1')]}};
\ No newline at end of file
index f979a4b..782c7d2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9cf9=['length','hasOwnProperty','sort','filter','merge','map','type','key','VIRTUAL','options','where','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','html-pdf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','ChatQueueReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9cf9,0x179));var _0x99cf=function(_0x556a15,_0x350839){_0x556a15=_0x556a15-0x0;var _0x4b731a=_0x9cf9[_0x556a15];return _0x4b731a;};'use strict';var pdf=require(_0x99cf('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x99cf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x99cf('0x2'));var BPromise=require(_0x99cf('0x3'));var Mustache=require(_0x99cf('0x4'));var util=require('util');var path=require(_0x99cf('0x5'));var sox=require(_0x99cf('0x6'));var csv=require(_0x99cf('0x7'));var ejs=require(_0x99cf('0x8'));var fs=require('fs');var _=require(_0x99cf('0x9'));var squel=require('squel');var crypto=require(_0x99cf('0xa'));var jsforce=require(_0x99cf('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x99cf('0x7'));var querystring=require('querystring');var Papa=require(_0x99cf('0xc'));var authService=require('../../components/auth/service');var hardwareService=require(_0x99cf('0xd'));var Redis=require(_0x99cf('0xe'));var qs=require(_0x99cf('0xf'));var logger=require(_0x99cf('0x10'))(_0x99cf('0x11'));var utils=require(_0x99cf('0x12'));var config=require('../../config/environment');var db=require(_0x99cf('0x13'))['db'];function respondWithStatusCode(_0x352c12,_0x527ddb){_0x527ddb=_0x527ddb||0xcc;return function(_0x49ddf2){if(_0x49ddf2){return _0x352c12[_0x99cf('0x14')](_0x527ddb);}return _0x352c12[_0x99cf('0x15')](_0x527ddb)[_0x99cf('0x16')]();};}function respondWithResult(_0x438025,_0x1d5523){_0x1d5523=_0x1d5523||0xc8;return function(_0x3f1356){if(_0x3f1356){return _0x438025[_0x99cf('0x15')](_0x1d5523)['json'](_0x3f1356);}};}function respondWithFilteredResult(_0x493869,_0x37b2e8){return function(_0xc54cb5){if(_0xc54cb5){var _0x3297f4=_0xc54cb5[_0x99cf('0x17')],_0x478931=_0x37b2e8[_0x99cf('0x18')],_0x5ac779=_0x37b2e8[_0x99cf('0x18')]+_0x37b2e8[_0x99cf('0x19')],_0x3e2adc;if(_0x5ac779>=_0x3297f4){_0x5ac779=_0x3297f4;_0x3e2adc=0xc8;}else{_0x3e2adc=0xce;}_0x493869[_0x99cf('0x15')](_0x3e2adc);return _0x493869[_0x99cf('0x1a')](_0x99cf('0x1b'),_0x478931+'-'+_0x5ac779+'/'+_0x3297f4)[_0x99cf('0x1c')](_0xc54cb5);}return null;};}function patchUpdates(_0x57ae0a){return function(_0x33d16f){try{jsonpatch[_0x99cf('0x1d')](_0x33d16f,_0x57ae0a,!![]);}catch(_0x4af799){return BPromise[_0x99cf('0x1e')](_0x4af799);}return _0x33d16f[_0x99cf('0x1f')]();};}function saveUpdates(_0x2fffae,_0x2b4157){return function(_0x76fc0d){if(_0x76fc0d){return _0x76fc0d[_0x99cf('0x20')](_0x2fffae)[_0x99cf('0x21')](function(_0x46cc9c){return _0x46cc9c;});}return null;};}function removeEntity(_0x30de77,_0x48e227){return function(_0x327380){if(_0x327380){return _0x327380[_0x99cf('0x22')]()[_0x99cf('0x21')](function(){_0x30de77[_0x99cf('0x15')](0xcc)[_0x99cf('0x16')]();});}};}function handleEntityNotFound(_0x41816c,_0xa86709){return function(_0x508a2a){if(!_0x508a2a){_0x41816c[_0x99cf('0x14')](0x194);}return _0x508a2a;};}function handleError(_0x550bdb,_0x130328){_0x130328=_0x130328||0x1f4;return function(_0xac4b16){logger[_0x99cf('0x23')](_0xac4b16[_0x99cf('0x24')]);if(_0xac4b16[_0x99cf('0x25')]){delete _0xac4b16[_0x99cf('0x25')];}_0x550bdb['status'](_0x130328)[_0x99cf('0x26')](_0xac4b16);};}exports[_0x99cf('0x27')]=function(_0x25a2d5,_0xb56a5c){var _0x4f0e55={},_0x3c19b6={},_0x594d09={'count':0x0,'rows':[]};var _0x4c5a43=db[_0x99cf('0x28')][_0x99cf('0x29')];_0x3c19b6[_0x99cf('0x2a')]=_[_0x99cf('0x2b')](_0x4c5a43);_0x3c19b6['query']=_[_0x99cf('0x2b')](_0x25a2d5[_0x99cf('0x2c')]);_0x3c19b6[_0x99cf('0x2d')]=_[_0x99cf('0x2e')](_0x3c19b6['model'],_0x3c19b6['query']);_0x4f0e55[_0x99cf('0x2f')]=_[_0x99cf('0x2e')](_0x3c19b6[_0x99cf('0x2a')],qs['fields'](_0x25a2d5[_0x99cf('0x2c')][_0x99cf('0x30')]));_0x4f0e55['attributes']=_0x4f0e55[_0x99cf('0x2f')][_0x99cf('0x31')]?_0x4f0e55[_0x99cf('0x2f')]:_0x3c19b6['model'];if(!_0x25a2d5['query'][_0x99cf('0x32')]('nolimit')){_0x4f0e55[_0x99cf('0x19')]=qs[_0x99cf('0x19')](_0x25a2d5[_0x99cf('0x2c')][_0x99cf('0x19')]);_0x4f0e55[_0x99cf('0x18')]=qs[_0x99cf('0x18')](_0x25a2d5[_0x99cf('0x2c')][_0x99cf('0x18')]);}_0x4f0e55['order']=qs[_0x99cf('0x33')](_0x25a2d5['query'][_0x99cf('0x33')]);_0x4f0e55['where']=qs[_0x99cf('0x2d')](_['pick'](_0x25a2d5['query'],_0x3c19b6[_0x99cf('0x2d')]));if(_0x25a2d5[_0x99cf('0x2c')][_0x99cf('0x34')]){_0x4f0e55['where']=_[_0x99cf('0x35')](_0x4f0e55['where'],{'$or':_[_0x99cf('0x36')](_0x4c5a43,function(_0x59c9eb){if(_0x59c9eb[_0x99cf('0x37')][_0x99cf('0x38')]!==_0x99cf('0x39')){var _0x4e4f7b={};_0x4e4f7b[_0x59c9eb['field']]={'$like':'%'+_0x25a2d5[_0x99cf('0x2c')][_0x99cf('0x34')]+'%'};return _0x4e4f7b;}})});}_0x4f0e55=_[_0x99cf('0x35')]({},_0x4f0e55,_0x25a2d5[_0x99cf('0x3a')]);var _0x354b29={'where':_0x4f0e55[_0x99cf('0x3b')]};return db[_0x99cf('0x28')]['count'](_0x354b29)[_0x99cf('0x21')](function(_0x3320f2){_0x594d09[_0x99cf('0x17')]=_0x3320f2;if(_0x25a2d5[_0x99cf('0x2c')]['includeAll']){_0x4f0e55[_0x99cf('0x3c')]=[{'all':!![]}];}return db[_0x99cf('0x28')][_0x99cf('0x3d')](_0x4f0e55);})[_0x99cf('0x21')](function(_0x3a6d93){_0x594d09[_0x99cf('0x3e')]=_0x3a6d93;return _0x594d09;})[_0x99cf('0x21')](respondWithFilteredResult(_0xb56a5c,_0x4f0e55))[_0x99cf('0x3f')](handleError(_0xb56a5c,null));};exports[_0x99cf('0x40')]=function(_0x5473a9,_0x317404){var _0x32153d={'raw':!![],'where':{'id':_0x5473a9[_0x99cf('0x41')]['id']}},_0x1b0209={};_0x1b0209[_0x99cf('0x2a')]=_[_0x99cf('0x2b')](db['ChatQueueReport'][_0x99cf('0x29')]);_0x1b0209[_0x99cf('0x2c')]=_[_0x99cf('0x2b')](_0x5473a9[_0x99cf('0x2c')]);_0x1b0209[_0x99cf('0x2d')]=_[_0x99cf('0x2e')](_0x1b0209[_0x99cf('0x2a')],_0x1b0209['query']);_0x32153d[_0x99cf('0x2f')]=_[_0x99cf('0x2e')](_0x1b0209['model'],qs[_0x99cf('0x30')](_0x5473a9[_0x99cf('0x2c')]['fields']));_0x32153d['attributes']=_0x32153d['attributes']['length']?_0x32153d['attributes']:_0x1b0209[_0x99cf('0x2a')];if(_0x5473a9['query'][_0x99cf('0x42')]){_0x32153d[_0x99cf('0x3c')]=[{'all':!![]}];}_0x32153d=_[_0x99cf('0x35')]({},_0x32153d,_0x5473a9[_0x99cf('0x3a')]);return db[_0x99cf('0x28')][_0x99cf('0x43')](_0x32153d)['then'](handleEntityNotFound(_0x317404,null))['then'](respondWithResult(_0x317404,null))[_0x99cf('0x3f')](handleError(_0x317404,null));};exports[_0x99cf('0x44')]=function(_0x36be9b,_0x349da){return db[_0x99cf('0x28')]['create'](_0x36be9b[_0x99cf('0x45')],{})['then'](respondWithResult(_0x349da,0xc9))[_0x99cf('0x3f')](handleError(_0x349da,null));};exports[_0x99cf('0x20')]=function(_0x125618,_0x1c8415){if(_0x125618[_0x99cf('0x45')]['id']){delete _0x125618[_0x99cf('0x45')]['id'];}return db[_0x99cf('0x28')][_0x99cf('0x43')]({'where':{'id':_0x125618[_0x99cf('0x41')]['id']}})[_0x99cf('0x21')](handleEntityNotFound(_0x1c8415,null))['then'](saveUpdates(_0x125618['body'],null))[_0x99cf('0x21')](respondWithResult(_0x1c8415,null))[_0x99cf('0x3f')](handleError(_0x1c8415,null));};exports[_0x99cf('0x22')]=function(_0x14ca3e,_0x393379){return db[_0x99cf('0x28')][_0x99cf('0x43')]({'where':{'id':_0x14ca3e[_0x99cf('0x41')]['id']}})['then'](handleEntityNotFound(_0x393379,null))[_0x99cf('0x21')](removeEntity(_0x393379,null))[_0x99cf('0x3f')](handleError(_0x393379,null));};exports[_0x99cf('0x46')]=function(_0x2d7545,_0x4e68ad){return db[_0x99cf('0x28')][_0x99cf('0x46')]()[_0x99cf('0x21')](respondWithResult(_0x4e68ad,null))[_0x99cf('0x3f')](handleError(_0x4e68ad,null));};
\ No newline at end of file
+var _0x1a1a=['options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','sendStatus','end','json','count','offset','limit','status','apply','save','update','destroy','then','error','name','send','index','ChatQueueReport','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','key','VIRTUAL','field'];(function(_0x32ac6d,_0x235f05){var _0x3f53f6=function(_0x5412d1){while(--_0x5412d1){_0x32ac6d['push'](_0x32ac6d['shift']());}};_0x3f53f6(++_0x235f05);}(_0x1a1a,0x1b6));var _0xa1a1=function(_0x4bdddf,_0x273243){_0x4bdddf=_0x4bdddf-0x0;var _0x16c3e0=_0x1a1a[_0x4bdddf];return _0x16c3e0;};'use strict';var pdf=require(_0xa1a1('0x0'));var emlformat=require(_0xa1a1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa1a1('0x2'));var jsonpatch=require(_0xa1a1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa1a1('0x4'));var Mustache=require(_0xa1a1('0x5'));var util=require(_0xa1a1('0x6'));var path=require('path');var sox=require(_0xa1a1('0x7'));var csv=require(_0xa1a1('0x8'));var ejs=require(_0xa1a1('0x9'));var fs=require('fs');var _=require(_0xa1a1('0xa'));var squel=require(_0xa1a1('0xb'));var crypto=require(_0xa1a1('0xc'));var jsforce=require(_0xa1a1('0xd'));var deskjs=require(_0xa1a1('0xe'));var toCsv=require(_0xa1a1('0x8'));var querystring=require('querystring');var Papa=require(_0xa1a1('0xf'));var authService=require('../../components/auth/service');var hardwareService=require(_0xa1a1('0x10'));var Redis=require(_0xa1a1('0x11'));var qs=require(_0xa1a1('0x12'));var logger=require(_0xa1a1('0x13'))(_0xa1a1('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x247823,_0xc92d6e){_0xc92d6e=_0xc92d6e||0xcc;return function(_0x4e4a8c){if(_0x4e4a8c){return _0x247823[_0xa1a1('0x15')](_0xc92d6e);}return _0x247823['status'](_0xc92d6e)[_0xa1a1('0x16')]();};}function respondWithResult(_0x482526,_0x22a3c8){_0x22a3c8=_0x22a3c8||0xc8;return function(_0x4ba4f9){if(_0x4ba4f9){return _0x482526['status'](_0x22a3c8)[_0xa1a1('0x17')](_0x4ba4f9);}};}function respondWithFilteredResult(_0x42f7fd,_0x218c43){return function(_0x1ae147){if(_0x1ae147){var _0x34143c=_0x1ae147[_0xa1a1('0x18')],_0x2f8433=_0x218c43[_0xa1a1('0x19')],_0x1340f9=_0x218c43[_0xa1a1('0x19')]+_0x218c43[_0xa1a1('0x1a')],_0x1c9cdb;if(_0x1340f9>=_0x34143c){_0x1340f9=_0x34143c;_0x1c9cdb=0xc8;}else{_0x1c9cdb=0xce;}_0x42f7fd[_0xa1a1('0x1b')](_0x1c9cdb);return _0x42f7fd['set']('Content-Range',_0x2f8433+'-'+_0x1340f9+'/'+_0x34143c)[_0xa1a1('0x17')](_0x1ae147);}return null;};}function patchUpdates(_0x5d3be8){return function(_0x12a0a0){try{jsonpatch[_0xa1a1('0x1c')](_0x12a0a0,_0x5d3be8,!![]);}catch(_0x2133ed){return BPromise['reject'](_0x2133ed);}return _0x12a0a0[_0xa1a1('0x1d')]();};}function saveUpdates(_0x476616,_0x1465d3){return function(_0x2b1fe7){if(_0x2b1fe7){return _0x2b1fe7[_0xa1a1('0x1e')](_0x476616)['then'](function(_0x363a43){return _0x363a43;});}return null;};}function removeEntity(_0x206b84,_0x87fd1){return function(_0x1d9dbd){if(_0x1d9dbd){return _0x1d9dbd[_0xa1a1('0x1f')]()[_0xa1a1('0x20')](function(){_0x206b84[_0xa1a1('0x1b')](0xcc)[_0xa1a1('0x16')]();});}};}function handleEntityNotFound(_0x3fba97,_0x27163d){return function(_0x23efb2){if(!_0x23efb2){_0x3fba97[_0xa1a1('0x15')](0x194);}return _0x23efb2;};}function handleError(_0x18cbff,_0x369983){_0x369983=_0x369983||0x1f4;return function(_0x658e91){logger[_0xa1a1('0x21')](_0x658e91['stack']);if(_0x658e91[_0xa1a1('0x22')]){delete _0x658e91[_0xa1a1('0x22')];}_0x18cbff[_0xa1a1('0x1b')](_0x369983)[_0xa1a1('0x23')](_0x658e91);};}exports[_0xa1a1('0x24')]=function(_0x5aa357,_0x3b7ca2){var _0x859160={},_0x5f090a={},_0x5d0603={'count':0x0,'rows':[]};var _0x4eae20=db[_0xa1a1('0x25')][_0xa1a1('0x26')];_0x5f090a['model']=_[_0xa1a1('0x27')](_0x4eae20);_0x5f090a[_0xa1a1('0x28')]=_['keys'](_0x5aa357['query']);_0x5f090a[_0xa1a1('0x29')]=_[_0xa1a1('0x2a')](_0x5f090a[_0xa1a1('0x2b')],_0x5f090a[_0xa1a1('0x28')]);_0x859160[_0xa1a1('0x2c')]=_[_0xa1a1('0x2a')](_0x5f090a[_0xa1a1('0x2b')],qs['fields'](_0x5aa357['query'][_0xa1a1('0x2d')]));_0x859160[_0xa1a1('0x2c')]=_0x859160[_0xa1a1('0x2c')][_0xa1a1('0x2e')]?_0x859160[_0xa1a1('0x2c')]:_0x5f090a[_0xa1a1('0x2b')];if(!_0x5aa357[_0xa1a1('0x28')][_0xa1a1('0x2f')](_0xa1a1('0x30'))){_0x859160[_0xa1a1('0x1a')]=qs[_0xa1a1('0x1a')](_0x5aa357[_0xa1a1('0x28')][_0xa1a1('0x1a')]);_0x859160['offset']=qs[_0xa1a1('0x19')](_0x5aa357[_0xa1a1('0x28')][_0xa1a1('0x19')]);}_0x859160[_0xa1a1('0x31')]=qs[_0xa1a1('0x32')](_0x5aa357[_0xa1a1('0x28')][_0xa1a1('0x32')]);_0x859160['where']=qs[_0xa1a1('0x29')](_[_0xa1a1('0x33')](_0x5aa357[_0xa1a1('0x28')],_0x5f090a[_0xa1a1('0x29')]));if(_0x5aa357['query'][_0xa1a1('0x34')]){_0x859160[_0xa1a1('0x35')]=_[_0xa1a1('0x36')](_0x859160[_0xa1a1('0x35')],{'$or':_['map'](_0x4eae20,function(_0x1f5c5f){if(_0x1f5c5f[_0xa1a1('0x37')][_0xa1a1('0x38')]!==_0xa1a1('0x39')){var _0x55027f={};_0x55027f[_0x1f5c5f[_0xa1a1('0x3a')]]={'$like':'%'+_0x5aa357[_0xa1a1('0x28')]['filter']+'%'};return _0x55027f;}})});}_0x859160=_[_0xa1a1('0x36')]({},_0x859160,_0x5aa357[_0xa1a1('0x3b')]);var _0x47cdd7={'where':_0x859160['where']};return db[_0xa1a1('0x25')][_0xa1a1('0x18')](_0x47cdd7)['then'](function(_0xe1bdb8){_0x5d0603[_0xa1a1('0x18')]=_0xe1bdb8;if(_0x5aa357[_0xa1a1('0x28')][_0xa1a1('0x3c')]){_0x859160[_0xa1a1('0x3d')]=[{'all':!![]}];}return db['ChatQueueReport'][_0xa1a1('0x3e')](_0x859160);})[_0xa1a1('0x20')](function(_0x2b7130){_0x5d0603[_0xa1a1('0x3f')]=_0x2b7130;return _0x5d0603;})[_0xa1a1('0x20')](respondWithFilteredResult(_0x3b7ca2,_0x859160))['catch'](handleError(_0x3b7ca2,null));};exports[_0xa1a1('0x40')]=function(_0x4f7bd6,_0x5522fe){var _0x3cc653={'raw':!![],'where':{'id':_0x4f7bd6[_0xa1a1('0x41')]['id']}},_0x33b7bf={};_0x33b7bf[_0xa1a1('0x2b')]=_[_0xa1a1('0x27')](db[_0xa1a1('0x25')][_0xa1a1('0x26')]);_0x33b7bf[_0xa1a1('0x28')]=_[_0xa1a1('0x27')](_0x4f7bd6['query']);_0x33b7bf['filters']=_['intersection'](_0x33b7bf['model'],_0x33b7bf[_0xa1a1('0x28')]);_0x3cc653[_0xa1a1('0x2c')]=_['intersection'](_0x33b7bf[_0xa1a1('0x2b')],qs[_0xa1a1('0x2d')](_0x4f7bd6['query']['fields']));_0x3cc653[_0xa1a1('0x2c')]=_0x3cc653['attributes'][_0xa1a1('0x2e')]?_0x3cc653['attributes']:_0x33b7bf['model'];if(_0x4f7bd6[_0xa1a1('0x28')][_0xa1a1('0x3c')]){_0x3cc653[_0xa1a1('0x3d')]=[{'all':!![]}];}_0x3cc653=_[_0xa1a1('0x36')]({},_0x3cc653,_0x4f7bd6[_0xa1a1('0x3b')]);return db['ChatQueueReport'][_0xa1a1('0x42')](_0x3cc653)[_0xa1a1('0x20')](handleEntityNotFound(_0x5522fe,null))[_0xa1a1('0x20')](respondWithResult(_0x5522fe,null))[_0xa1a1('0x43')](handleError(_0x5522fe,null));};exports[_0xa1a1('0x44')]=function(_0x2eaaba,_0x5b8dac){return db[_0xa1a1('0x25')][_0xa1a1('0x44')](_0x2eaaba[_0xa1a1('0x45')],{})[_0xa1a1('0x20')](respondWithResult(_0x5b8dac,0xc9))[_0xa1a1('0x43')](handleError(_0x5b8dac,null));};exports[_0xa1a1('0x1e')]=function(_0x4b5b87,_0x5273a0){if(_0x4b5b87[_0xa1a1('0x45')]['id']){delete _0x4b5b87[_0xa1a1('0x45')]['id'];}return db[_0xa1a1('0x25')][_0xa1a1('0x42')]({'where':{'id':_0x4b5b87[_0xa1a1('0x41')]['id']}})[_0xa1a1('0x20')](handleEntityNotFound(_0x5273a0,null))[_0xa1a1('0x20')](saveUpdates(_0x4b5b87[_0xa1a1('0x45')],null))['then'](respondWithResult(_0x5273a0,null))[_0xa1a1('0x43')](handleError(_0x5273a0,null));};exports[_0xa1a1('0x1f')]=function(_0x4cc08a,_0x590ea4){return db[_0xa1a1('0x25')][_0xa1a1('0x42')]({'where':{'id':_0x4cc08a['params']['id']}})[_0xa1a1('0x20')](handleEntityNotFound(_0x590ea4,null))['then'](removeEntity(_0x590ea4,null))['catch'](handleError(_0x590ea4,null));};exports[_0xa1a1('0x46')]=function(_0x1ac226,_0x2666c9){return db[_0xa1a1('0x25')]['describe']()[_0xa1a1('0x20')](respondWithResult(_0x2666c9,null))[_0xa1a1('0x43')](handleError(_0x2666c9,null));};
\ No newline at end of file
index 4c536a2..36f63fd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['ChatQueueReport','report_chat_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','./chatQueueReport.attributes','exports','define'];(function(_0x51e2ef,_0x38f607){var _0x84435e=function(_0x44bda2){while(--_0x44bda2){_0x51e2ef['push'](_0x51e2ef['shift']());}};_0x84435e(++_0x38f607);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 attributes=require(_0x7995('0x6'));module[_0x7995('0x7')]=function(_0x576d89,_0x744bea){return _0x576d89[_0x7995('0x8')](_0x7995('0x9'),attributes,{'tableName':_0x7995('0xa'),'paranoid':![],'indexes':[{'name':_0x7995('0xb'),'fields':[_0x7995('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x34e8=['define','report_chat_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','./chatQueueReport.attributes','exports'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x34e8,0x12c));var _0x834e=function(_0x11dea6,_0x3ad6d4){_0x11dea6=_0x11dea6-0x0;var _0x3ce1f7=_0x34e8[_0x11dea6];return _0x3ce1f7;};'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 attributes=require(_0x834e('0x6'));module[_0x834e('0x7')]=function(_0x289ef2,_0x19a3e0){return _0x289ef2[_0x834e('0x8')]('ChatQueueReport',attributes,{'tableName':_0x834e('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x834e('0xa')]}],'timestamps':!![]});};
\ No newline at end of file
index e2f5408..d90c233 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0fb6=['ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatQueueReport','create','body','options','raw','ChatQueueReport','update','attributes','limit','UpdateChatQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info'];(function(_0x20ef7d,_0x331dc2){var _0x26a929=function(_0x2dfeac){while(--_0x2dfeac){_0x20ef7d['push'](_0x20ef7d['shift']());}};_0x26a929(++_0x331dc2);}(_0x0fb6,0x7d));var _0x60fb=function(_0x245a92,_0x1a6eea){_0x245a92=_0x245a92-0x0;var _0x2c6f69=_0x0fb6[_0x245a92];return _0x2c6f69;};'use strict';var _=require(_0x60fb('0x0'));var util=require(_0x60fb('0x1'));var moment=require(_0x60fb('0x2'));var BPromise=require(_0x60fb('0x3'));var rs=require(_0x60fb('0x4'));var fs=require('fs');var Redis=require(_0x60fb('0x5'));var db=require(_0x60fb('0x6'))['db'];var utils=require(_0x60fb('0x7'));var logger=require(_0x60fb('0x8'))(_0x60fb('0x9'));var config=require(_0x60fb('0xa'));var jayson=require(_0x60fb('0xb'));var client=jayson['client'][_0x60fb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x15a6ae,_0x12e6af,_0x4fb7c8){return new BPromise(function(_0x1264e9,_0x38eb67){return client[_0x60fb('0xd')](_0x15a6ae,_0x4fb7c8)['then'](function(_0x20754d){logger[_0x60fb('0xe')](_0x60fb('0xf'),_0x12e6af,_0x60fb('0x10'));logger[_0x60fb('0x11')](_0x60fb('0x12'),_0x12e6af,'request\x20sent',JSON[_0x60fb('0x13')](_0x20754d));if(_0x20754d[_0x60fb('0x14')]){if(_0x20754d['error'][_0x60fb('0x15')]===0x1f4){logger[_0x60fb('0x14')](_0x60fb('0xf'),_0x12e6af,_0x20754d['error']['message']);return _0x38eb67(_0x20754d[_0x60fb('0x14')][_0x60fb('0x16')]);}logger[_0x60fb('0x14')]('ChatQueueReport,\x20%s,\x20%s',_0x12e6af,_0x20754d[_0x60fb('0x14')][_0x60fb('0x16')]);return _0x1264e9(_0x20754d[_0x60fb('0x14')]['message']);}else{logger['info'](_0x60fb('0xf'),_0x12e6af,_0x60fb('0x10'));_0x1264e9(_0x20754d[_0x60fb('0x17')]['message']);}})[_0x60fb('0x18')](function(_0x43a990){logger['error'](_0x60fb('0xf'),_0x12e6af,_0x43a990);_0x38eb67(_0x43a990);});});}exports[_0x60fb('0x19')]=function(_0x21790c){var _0x498eb8=this;return new Promise(function(_0x6ef78d,_0x17d3cd){return db['ChatQueueReport'][_0x60fb('0x1a')](_0x21790c[_0x60fb('0x1b')],{'raw':_0x21790c[_0x60fb('0x1c')]?_0x21790c[_0x60fb('0x1c')][_0x60fb('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x56860f){logger[_0x60fb('0xe')](_0x60fb('0x19'),_0x21790c);logger[_0x60fb('0x11')]('CreateChatQueueReport',_0x21790c,JSON[_0x60fb('0x13')](_0x56860f));_0x6ef78d(_0x56860f);})[_0x60fb('0x18')](function(_0x262fba){logger[_0x60fb('0x14')](_0x60fb('0x19'),_0x262fba[_0x60fb('0x16')],_0x21790c);_0x17d3cd(_0x498eb8[_0x60fb('0x14')](0x1f4,_0x262fba[_0x60fb('0x16')]));});});};exports['UpdateChatQueueReport']=function(_0x1ab02a){var _0x2ec59d=this;return new Promise(function(_0x210bbf,_0x4fbbaf){return db[_0x60fb('0x1e')][_0x60fb('0x1f')](_0x1ab02a[_0x60fb('0x1b')],{'raw':_0x1ab02a[_0x60fb('0x1c')]?_0x1ab02a[_0x60fb('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ab02a[_0x60fb('0x1c')]?_0x1ab02a[_0x60fb('0x1c')]['where']||null:null,'attributes':_0x1ab02a[_0x60fb('0x1c')]?_0x1ab02a[_0x60fb('0x1c')][_0x60fb('0x20')]||null:null,'limit':_0x1ab02a[_0x60fb('0x1c')]?_0x1ab02a[_0x60fb('0x1c')][_0x60fb('0x21')]||null:null})['then'](function(_0x2d95f9){logger[_0x60fb('0xe')]('UpdateChatQueueReport',_0x1ab02a);logger[_0x60fb('0x11')]('UpdateChatQueueReport',_0x1ab02a,JSON[_0x60fb('0x13')](_0x2d95f9));_0x210bbf(_0x2d95f9);})[_0x60fb('0x18')](function(_0x5d935c){logger['error'](_0x60fb('0x22'),_0x5d935c[_0x60fb('0x16')],_0x1ab02a);_0x4fbbaf(_0x2ec59d[_0x60fb('0x14')](0x1f4,_0x5d935c[_0x60fb('0x16')]));});});};
\ No newline at end of file
+var _0x7629=['raw','ChatQueueReport','update','attributes','limit','then','UpdateChatQueueReport','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','catch','CreateChatQueueReport','body','options'];(function(_0x2b133e,_0x476ff4){var _0x1bfba1=function(_0xf2d78b){while(--_0xf2d78b){_0x2b133e['push'](_0x2b133e['shift']());}};_0x1bfba1(++_0x476ff4);}(_0x7629,0xf5));var _0x9762=function(_0x21b804,_0xb8688a){_0x21b804=_0x21b804-0x0;var _0x4251bc=_0x7629[_0x21b804];return _0x4251bc;};'use strict';var _=require('lodash');var util=require(_0x9762('0x0'));var moment=require(_0x9762('0x1'));var BPromise=require('bluebird');var rs=require(_0x9762('0x2'));var fs=require('fs');var Redis=require(_0x9762('0x3'));var db=require(_0x9762('0x4'))['db'];var utils=require(_0x9762('0x5'));var logger=require(_0x9762('0x6'))(_0x9762('0x7'));var config=require(_0x9762('0x8'));var jayson=require(_0x9762('0x9'));var client=jayson[_0x9762('0xa')][_0x9762('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bdff4,_0x3d67df,_0x2655d7){return new BPromise(function(_0xf327d9,_0x256c0d){return client[_0x9762('0xc')](_0x2bdff4,_0x2655d7)['then'](function(_0x58e90b){logger[_0x9762('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x3d67df,'request\x20sent');logger[_0x9762('0xe')](_0x9762('0xf'),_0x3d67df,_0x9762('0x10'),JSON[_0x9762('0x11')](_0x58e90b));if(_0x58e90b[_0x9762('0x12')]){if(_0x58e90b['error'][_0x9762('0x13')]===0x1f4){logger[_0x9762('0x12')](_0x9762('0x14'),_0x3d67df,_0x58e90b[_0x9762('0x12')][_0x9762('0x15')]);return _0x256c0d(_0x58e90b['error'][_0x9762('0x15')]);}logger['error'](_0x9762('0x14'),_0x3d67df,_0x58e90b['error']['message']);return _0xf327d9(_0x58e90b[_0x9762('0x12')][_0x9762('0x15')]);}else{logger[_0x9762('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x3d67df,'request\x20sent');_0xf327d9(_0x58e90b[_0x9762('0x16')][_0x9762('0x15')]);}})[_0x9762('0x17')](function(_0x712df4){logger[_0x9762('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x3d67df,_0x712df4);_0x256c0d(_0x712df4);});});}exports[_0x9762('0x18')]=function(_0x4ec866){var _0x83c644=this;return new Promise(function(_0x2d581f,_0x1565e9){return db['ChatQueueReport']['create'](_0x4ec866[_0x9762('0x19')],{'raw':_0x4ec866[_0x9762('0x1a')]?_0x4ec866['options'][_0x9762('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x2225c2){logger[_0x9762('0xd')](_0x9762('0x18'),_0x4ec866);logger[_0x9762('0xe')]('CreateChatQueueReport',_0x4ec866,JSON[_0x9762('0x11')](_0x2225c2));_0x2d581f(_0x2225c2);})[_0x9762('0x17')](function(_0x5ab24c){logger[_0x9762('0x12')](_0x9762('0x18'),_0x5ab24c[_0x9762('0x15')],_0x4ec866);_0x1565e9(_0x83c644[_0x9762('0x12')](0x1f4,_0x5ab24c[_0x9762('0x15')]));});});};exports['UpdateChatQueueReport']=function(_0x208532){var _0xd5c97=this;return new Promise(function(_0xb87617,_0x17b97f){return db[_0x9762('0x1c')][_0x9762('0x1d')](_0x208532['body'],{'raw':_0x208532['options']?_0x208532[_0x9762('0x1a')][_0x9762('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x208532[_0x9762('0x1a')]?_0x208532[_0x9762('0x1a')]['where']||null:null,'attributes':_0x208532[_0x9762('0x1a')]?_0x208532[_0x9762('0x1a')][_0x9762('0x1e')]||null:null,'limit':_0x208532[_0x9762('0x1a')]?_0x208532[_0x9762('0x1a')][_0x9762('0x1f')]||null:null})[_0x9762('0x20')](function(_0x3a6cbc){logger[_0x9762('0xd')]('UpdateChatQueueReport',_0x208532);logger[_0x9762('0xe')](_0x9762('0x21'),_0x208532,JSON[_0x9762('0x11')](_0x3a6cbc));_0xb87617(_0x3a6cbc);})[_0x9762('0x17')](function(_0x3018eb){logger[_0x9762('0x12')](_0x9762('0x21'),_0x3018eb[_0x9762('0x15')],_0x208532);_0x17b97f(_0xd5c97[_0x9762('0x12')](0x1f4,_0x3018eb['message']));});});};
\ No newline at end of file
index 5af5d27..fbf5850 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb80a=['show','post','/:id','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','index','isAuthenticated','describe'];(function(_0x4f4d06,_0x39ce44){var _0x2eb417=function(_0xf4939e){while(--_0xf4939e){_0x4f4d06['push'](_0x4f4d06['shift']());}};_0x2eb417(++_0x39ce44);}(_0xb80a,0x72));var _0xab80=function(_0xbadc75,_0x536480){_0xbadc75=_0xbadc75-0x0;var _0x1bbc61=_0xb80a[_0xbadc75];return _0x1bbc61;};'use strict';var multer=require(_0xab80('0x0'));var util=require(_0xab80('0x1'));var path=require('path');var timeout=require(_0xab80('0x2'));var express=require('express');var router=express[_0xab80('0x3')]();var auth=require(_0xab80('0x4'));var interaction=require(_0xab80('0x5'));var config=require(_0xab80('0x6'));var controller=require(_0xab80('0x7'));router[_0xab80('0x8')]('/',auth['isAuthenticated'](),controller[_0xab80('0x9')]);router['get']('/describe',auth[_0xab80('0xa')](),controller[_0xab80('0xb')]);router[_0xab80('0x8')]('/:id',auth[_0xab80('0xa')](),controller[_0xab80('0xc')]);router[_0xab80('0xd')]('/',auth[_0xab80('0xa')](),controller['create']);router['put'](_0xab80('0xe'),auth[_0xab80('0xa')](),controller['update']);router[_0xab80('0xf')](_0xab80('0xe'),auth['isAuthenticated'](),controller[_0xab80('0x10')]);module[_0xab80('0x11')]=router;
\ No newline at end of file
+var _0x50d2=['/describe','isAuthenticated','describe','show','post','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','index','get'];(function(_0xb11298,_0x5267f8){var _0x589b08=function(_0x113a31){while(--_0x113a31){_0xb11298['push'](_0xb11298['shift']());}};_0x589b08(++_0x5267f8);}(_0x50d2,0x180));var _0x250d=function(_0x1df02a,_0x4d7470){_0x1df02a=_0x1df02a-0x0;var _0x47cfbc=_0x50d2[_0x1df02a];return _0x47cfbc;};'use strict';var multer=require(_0x250d('0x0'));var util=require(_0x250d('0x1'));var path=require(_0x250d('0x2'));var timeout=require(_0x250d('0x3'));var express=require(_0x250d('0x4'));var router=express[_0x250d('0x5')]();var auth=require(_0x250d('0x6'));var interaction=require(_0x250d('0x7'));var config=require(_0x250d('0x8'));var controller=require(_0x250d('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x250d('0xa')]);router[_0x250d('0xb')](_0x250d('0xc'),auth[_0x250d('0xd')](),controller[_0x250d('0xe')]);router[_0x250d('0xb')]('/:id',auth[_0x250d('0xd')](),controller[_0x250d('0xf')]);router[_0x250d('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x250d('0x11')](_0x250d('0x12'),auth[_0x250d('0xd')](),controller[_0x250d('0x13')]);router['delete'](_0x250d('0x12'),auth[_0x250d('0xd')](),controller[_0x250d('0x14')]);module[_0x250d('0x15')]=router;
\ No newline at end of file
index c432f50..3265332 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd72c=['sequelize','exports','STRING','ENUM','queue','DATE','NOW','moment'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xd72c,0x197));var _0xcd72=function(_0x4b1d,_0x119498){_0x4b1d=_0x4b1d-0x0;var _0x174ba0=_0xd72c[_0x4b1d];return _0x174ba0;};'use strict';var moment=require(_0xcd72('0x0'));var Sequelize=require(_0xcd72('0x1'));module[_0xcd72('0x2')]={'uniqueid':{'type':Sequelize[_0xcd72('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xcd72('0x4')]('account','agent',_0xcd72('0x5')),'allowNull':![],'defaultValue':_0xcd72('0x5')},'transferredAt':{'type':Sequelize[_0xcd72('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xcd72('0x7')]}};
\ No newline at end of file
+var _0xcf1f=['STRING','ENUM','account','agent','queue','NOW','moment','sequelize','exports'];(function(_0x56daff,_0xadca9a){var _0x132c82=function(_0x19e0d7){while(--_0x19e0d7){_0x56daff['push'](_0x56daff['shift']());}};_0x132c82(++_0xadca9a);}(_0xcf1f,0x1ad));var _0xfcf1=function(_0x2bfc60,_0xa254ab){_0x2bfc60=_0x2bfc60-0x0;var _0x44ea2c=_0xcf1f[_0x2bfc60];return _0x44ea2c;};'use strict';var moment=require(_0xfcf1('0x0'));var Sequelize=require(_0xfcf1('0x1'));module[_0xfcf1('0x2')]={'uniqueid':{'type':Sequelize[_0xfcf1('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xfcf1('0x4')](_0xfcf1('0x5'),_0xfcf1('0x6'),_0xfcf1('0x7')),'allowNull':![],'defaultValue':_0xfcf1('0x7')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xfcf1('0x8')]}};
\ No newline at end of file
index 2d1711b..b25c73b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x01f0=['ChatTransferReport','includeAll','include','findAll','rows','show','params','fields','length','options','find','create','body','catch','describe','html-pdf','rimraf','request-promise','mustache','util','to-csv','squel','crypto','jsforce','desk.js','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','json','count','offset','limit','status','set','Content-Range','reject','save','update','then','end','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','hasOwnProperty','order','sort','where','filter','merge','map','type','key','VIRTUAL'];(function(_0x1edd93,_0x2e09bb){var _0x1ae697=function(_0x20e402){while(--_0x20e402){_0x1edd93['push'](_0x1edd93['shift']());}};_0x1ae697(++_0x2e09bb);}(_0x01f0,0x93));var _0x001f=function(_0x4b2c0a,_0x5b2b2f){_0x4b2c0a=_0x4b2c0a-0x0;var _0x48f272=_0x01f0[_0x4b2c0a];return _0x48f272;};'use strict';var pdf=require(_0x001f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x001f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x001f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x001f('0x3'));var util=require(_0x001f('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x001f('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x001f('0x6'));var crypto=require(_0x001f('0x7'));var jsforce=require(_0x001f('0x8'));var deskjs=require(_0x001f('0x9'));var toCsv=require(_0x001f('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0x001f('0xa'));var Redis=require(_0x001f('0xb'));var qs=require(_0x001f('0xc'));var logger=require(_0x001f('0xd'))(_0x001f('0xe'));var utils=require(_0x001f('0xf'));var config=require('../../config/environment');var db=require(_0x001f('0x10'))['db'];function respondWithStatusCode(_0x3a9b19,_0x407554){_0x407554=_0x407554||0xcc;return function(_0x2bf0ec){if(_0x2bf0ec){return _0x3a9b19[_0x001f('0x11')](_0x407554);}return _0x3a9b19['status'](_0x407554)['end']();};}function respondWithResult(_0x4be9b8,_0x4aa84f){_0x4aa84f=_0x4aa84f||0xc8;return function(_0x2e1977){if(_0x2e1977){return _0x4be9b8['status'](_0x4aa84f)[_0x001f('0x12')](_0x2e1977);}};}function respondWithFilteredResult(_0x31e4cb,_0x104a8c){return function(_0x21bbc2){if(_0x21bbc2){var _0x173b7c=_0x21bbc2[_0x001f('0x13')],_0x5e7198=_0x104a8c['offset'],_0x4a74b2=_0x104a8c[_0x001f('0x14')]+_0x104a8c[_0x001f('0x15')],_0x5abd01;if(_0x4a74b2>=_0x173b7c){_0x4a74b2=_0x173b7c;_0x5abd01=0xc8;}else{_0x5abd01=0xce;}_0x31e4cb[_0x001f('0x16')](_0x5abd01);return _0x31e4cb[_0x001f('0x17')](_0x001f('0x18'),_0x5e7198+'-'+_0x4a74b2+'/'+_0x173b7c)[_0x001f('0x12')](_0x21bbc2);}return null;};}function patchUpdates(_0x3d33f9){return function(_0x5f2ff5){try{jsonpatch['apply'](_0x5f2ff5,_0x3d33f9,!![]);}catch(_0x54adb4){return BPromise[_0x001f('0x19')](_0x54adb4);}return _0x5f2ff5[_0x001f('0x1a')]();};}function saveUpdates(_0xac5336,_0x55ae3d){return function(_0x22c9c9){if(_0x22c9c9){return _0x22c9c9[_0x001f('0x1b')](_0xac5336)[_0x001f('0x1c')](function(_0x124d79){return _0x124d79;});}return null;};}function removeEntity(_0xc9c70b,_0x509371){return function(_0x12df69){if(_0x12df69){return _0x12df69['destroy']()[_0x001f('0x1c')](function(){_0xc9c70b['status'](0xcc)[_0x001f('0x1d')]();});}};}function handleEntityNotFound(_0x4d501d,_0x380963){return function(_0xa70668){if(!_0xa70668){_0x4d501d[_0x001f('0x11')](0x194);}return _0xa70668;};}function handleError(_0x54a66b,_0x39b244){_0x39b244=_0x39b244||0x1f4;return function(_0x2f6e4b){logger['error'](_0x2f6e4b[_0x001f('0x1e')]);if(_0x2f6e4b[_0x001f('0x1f')]){delete _0x2f6e4b[_0x001f('0x1f')];}_0x54a66b['status'](_0x39b244)[_0x001f('0x20')](_0x2f6e4b);};}exports[_0x001f('0x21')]=function(_0x78e0a8,_0x348739){var _0x1234de={},_0x5708ae={},_0x29beeb={'count':0x0,'rows':[]};var _0x8941ea=db['ChatTransferReport'][_0x001f('0x22')];_0x5708ae[_0x001f('0x23')]=_[_0x001f('0x24')](_0x8941ea);_0x5708ae[_0x001f('0x25')]=_[_0x001f('0x24')](_0x78e0a8[_0x001f('0x25')]);_0x5708ae[_0x001f('0x26')]=_[_0x001f('0x27')](_0x5708ae[_0x001f('0x23')],_0x5708ae['query']);_0x1234de[_0x001f('0x28')]=_[_0x001f('0x27')](_0x5708ae[_0x001f('0x23')],qs['fields'](_0x78e0a8[_0x001f('0x25')]['fields']));_0x1234de[_0x001f('0x28')]=_0x1234de['attributes']['length']?_0x1234de[_0x001f('0x28')]:_0x5708ae[_0x001f('0x23')];if(!_0x78e0a8[_0x001f('0x25')][_0x001f('0x29')]('nolimit')){_0x1234de[_0x001f('0x15')]=qs[_0x001f('0x15')](_0x78e0a8[_0x001f('0x25')][_0x001f('0x15')]);_0x1234de[_0x001f('0x14')]=qs[_0x001f('0x14')](_0x78e0a8[_0x001f('0x25')]['offset']);}_0x1234de[_0x001f('0x2a')]=qs[_0x001f('0x2b')](_0x78e0a8[_0x001f('0x25')][_0x001f('0x2b')]);_0x1234de[_0x001f('0x2c')]=qs['filters'](_['pick'](_0x78e0a8['query'],_0x5708ae[_0x001f('0x26')]));if(_0x78e0a8[_0x001f('0x25')][_0x001f('0x2d')]){_0x1234de[_0x001f('0x2c')]=_[_0x001f('0x2e')](_0x1234de[_0x001f('0x2c')],{'$or':_[_0x001f('0x2f')](_0x8941ea,function(_0x260ac2){if(_0x260ac2[_0x001f('0x30')][_0x001f('0x31')]!==_0x001f('0x32')){var _0x20a775={};_0x20a775[_0x260ac2['field']]={'$like':'%'+_0x78e0a8[_0x001f('0x25')][_0x001f('0x2d')]+'%'};return _0x20a775;}})});}_0x1234de=_[_0x001f('0x2e')]({},_0x1234de,_0x78e0a8['options']);var _0x40ba4a={'where':_0x1234de[_0x001f('0x2c')]};return db[_0x001f('0x33')][_0x001f('0x13')](_0x40ba4a)[_0x001f('0x1c')](function(_0x5055f5){_0x29beeb['count']=_0x5055f5;if(_0x78e0a8[_0x001f('0x25')][_0x001f('0x34')]){_0x1234de[_0x001f('0x35')]=[{'all':!![]}];}return db[_0x001f('0x33')][_0x001f('0x36')](_0x1234de);})['then'](function(_0x43d5cc){_0x29beeb[_0x001f('0x37')]=_0x43d5cc;return _0x29beeb;})[_0x001f('0x1c')](respondWithFilteredResult(_0x348739,_0x1234de))['catch'](handleError(_0x348739,null));};exports[_0x001f('0x38')]=function(_0x71df0e,_0x4a8ff1){var _0xefa4da={'raw':!![],'where':{'id':_0x71df0e[_0x001f('0x39')]['id']}},_0x29cc05={};_0x29cc05[_0x001f('0x23')]=_[_0x001f('0x24')](db['ChatTransferReport'][_0x001f('0x22')]);_0x29cc05[_0x001f('0x25')]=_[_0x001f('0x24')](_0x71df0e['query']);_0x29cc05['filters']=_['intersection'](_0x29cc05['model'],_0x29cc05[_0x001f('0x25')]);_0xefa4da['attributes']=_[_0x001f('0x27')](_0x29cc05[_0x001f('0x23')],qs[_0x001f('0x3a')](_0x71df0e['query'][_0x001f('0x3a')]));_0xefa4da['attributes']=_0xefa4da[_0x001f('0x28')][_0x001f('0x3b')]?_0xefa4da['attributes']:_0x29cc05[_0x001f('0x23')];if(_0x71df0e[_0x001f('0x25')]['includeAll']){_0xefa4da[_0x001f('0x35')]=[{'all':!![]}];}_0xefa4da=_[_0x001f('0x2e')]({},_0xefa4da,_0x71df0e[_0x001f('0x3c')]);return db[_0x001f('0x33')][_0x001f('0x3d')](_0xefa4da)[_0x001f('0x1c')](handleEntityNotFound(_0x4a8ff1,null))[_0x001f('0x1c')](respondWithResult(_0x4a8ff1,null))['catch'](handleError(_0x4a8ff1,null));};exports['create']=function(_0x5b57a8,_0x1e9f77){return db[_0x001f('0x33')][_0x001f('0x3e')](_0x5b57a8[_0x001f('0x3f')],{})[_0x001f('0x1c')](respondWithResult(_0x1e9f77,0xc9))[_0x001f('0x40')](handleError(_0x1e9f77,null));};exports['update']=function(_0x1d1e6,_0x40622f){if(_0x1d1e6[_0x001f('0x3f')]['id']){delete _0x1d1e6[_0x001f('0x3f')]['id'];}return db[_0x001f('0x33')][_0x001f('0x3d')]({'where':{'id':_0x1d1e6[_0x001f('0x39')]['id']}})[_0x001f('0x1c')](handleEntityNotFound(_0x40622f,null))[_0x001f('0x1c')](saveUpdates(_0x1d1e6[_0x001f('0x3f')],null))[_0x001f('0x1c')](respondWithResult(_0x40622f,null))[_0x001f('0x40')](handleError(_0x40622f,null));};exports['destroy']=function(_0x41ae0d,_0x4fbedd){return db['ChatTransferReport'][_0x001f('0x3d')]({'where':{'id':_0x41ae0d[_0x001f('0x39')]['id']}})[_0x001f('0x1c')](handleEntityNotFound(_0x4fbedd,null))[_0x001f('0x1c')](removeEntity(_0x4fbedd,null))[_0x001f('0x40')](handleError(_0x4fbedd,null));};exports[_0x001f('0x41')]=function(_0x1c4c10,_0x307c4a){return db[_0x001f('0x33')][_0x001f('0x41')]()[_0x001f('0x1c')](respondWithResult(_0x307c4a,null))['catch'](handleError(_0x307c4a,null));};
\ No newline at end of file
+var _0x0c5d=['index','ChatTransferReport','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','find','destroy','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','querystring','papaparse','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','send'];(function(_0x4a3b51,_0x1e9d6c){var _0x1919b0=function(_0x194639){while(--_0x194639){_0x4a3b51['push'](_0x4a3b51['shift']());}};_0x1919b0(++_0x1e9d6c);}(_0x0c5d,0x6c));var _0xd0c5=function(_0x7b9511,_0x17a790){_0x7b9511=_0x7b9511-0x0;var _0x24ea05=_0x0c5d[_0x7b9511];return _0x24ea05;};'use strict';var pdf=require(_0xd0c5('0x0'));var emlformat=require(_0xd0c5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd0c5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd0c5('0x3'));var moment=require(_0xd0c5('0x4'));var BPromise=require(_0xd0c5('0x5'));var Mustache=require(_0xd0c5('0x6'));var util=require(_0xd0c5('0x7'));var path=require(_0xd0c5('0x8'));var sox=require(_0xd0c5('0x9'));var csv=require(_0xd0c5('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd0c5('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd0c5('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd0c5('0xd'));var Papa=require(_0xd0c5('0xe'));var authService=require('../../components/auth/service');var hardwareService=require(_0xd0c5('0xf'));var Redis=require(_0xd0c5('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0xd0c5('0x11'))(_0xd0c5('0x12'));var utils=require(_0xd0c5('0x13'));var config=require(_0xd0c5('0x14'));var db=require(_0xd0c5('0x15'))['db'];function respondWithStatusCode(_0x19ac1f,_0x1310cf){_0x1310cf=_0x1310cf||0xcc;return function(_0x46db00){if(_0x46db00){return _0x19ac1f[_0xd0c5('0x16')](_0x1310cf);}return _0x19ac1f[_0xd0c5('0x17')](_0x1310cf)[_0xd0c5('0x18')]();};}function respondWithResult(_0x33a601,_0x57137e){_0x57137e=_0x57137e||0xc8;return function(_0x11511d){if(_0x11511d){return _0x33a601[_0xd0c5('0x17')](_0x57137e)[_0xd0c5('0x19')](_0x11511d);}};}function respondWithFilteredResult(_0x408e02,_0x553c38){return function(_0x280e22){if(_0x280e22){var _0x23d941=_0x280e22[_0xd0c5('0x1a')],_0x242615=_0x553c38['offset'],_0x639e72=_0x553c38[_0xd0c5('0x1b')]+_0x553c38['limit'],_0x556487;if(_0x639e72>=_0x23d941){_0x639e72=_0x23d941;_0x556487=0xc8;}else{_0x556487=0xce;}_0x408e02[_0xd0c5('0x17')](_0x556487);return _0x408e02[_0xd0c5('0x1c')](_0xd0c5('0x1d'),_0x242615+'-'+_0x639e72+'/'+_0x23d941)[_0xd0c5('0x19')](_0x280e22);}return null;};}function patchUpdates(_0xfda75c){return function(_0x410445){try{jsonpatch[_0xd0c5('0x1e')](_0x410445,_0xfda75c,!![]);}catch(_0x287961){return BPromise['reject'](_0x287961);}return _0x410445[_0xd0c5('0x1f')]();};}function saveUpdates(_0x2cd03c,_0x54c2c5){return function(_0x835e8d){if(_0x835e8d){return _0x835e8d[_0xd0c5('0x20')](_0x2cd03c)[_0xd0c5('0x21')](function(_0x6febb1){return _0x6febb1;});}return null;};}function removeEntity(_0x3a2a75,_0x3f0b74){return function(_0x331849){if(_0x331849){return _0x331849['destroy']()['then'](function(){_0x3a2a75[_0xd0c5('0x17')](0xcc)[_0xd0c5('0x18')]();});}};}function handleEntityNotFound(_0x439dd5,_0x6ce082){return function(_0x5eb093){if(!_0x5eb093){_0x439dd5[_0xd0c5('0x16')](0x194);}return _0x5eb093;};}function handleError(_0x54f42c,_0x54f188){_0x54f188=_0x54f188||0x1f4;return function(_0x3ec4ee){logger[_0xd0c5('0x22')](_0x3ec4ee[_0xd0c5('0x23')]);if(_0x3ec4ee[_0xd0c5('0x24')]){delete _0x3ec4ee[_0xd0c5('0x24')];}_0x54f42c[_0xd0c5('0x17')](_0x54f188)[_0xd0c5('0x25')](_0x3ec4ee);};}exports[_0xd0c5('0x26')]=function(_0x19b9ec,_0x198e39){var _0x34c2f4={},_0x3e6400={},_0x3502fe={'count':0x0,'rows':[]};var _0x2ee47e=db[_0xd0c5('0x27')][_0xd0c5('0x28')];_0x3e6400[_0xd0c5('0x29')]=_['keys'](_0x2ee47e);_0x3e6400[_0xd0c5('0x2a')]=_[_0xd0c5('0x2b')](_0x19b9ec[_0xd0c5('0x2a')]);_0x3e6400[_0xd0c5('0x2c')]=_[_0xd0c5('0x2d')](_0x3e6400[_0xd0c5('0x29')],_0x3e6400[_0xd0c5('0x2a')]);_0x34c2f4['attributes']=_[_0xd0c5('0x2d')](_0x3e6400['model'],qs[_0xd0c5('0x2e')](_0x19b9ec[_0xd0c5('0x2a')][_0xd0c5('0x2e')]));_0x34c2f4[_0xd0c5('0x2f')]=_0x34c2f4[_0xd0c5('0x2f')][_0xd0c5('0x30')]?_0x34c2f4[_0xd0c5('0x2f')]:_0x3e6400['model'];if(!_0x19b9ec['query'][_0xd0c5('0x31')]('nolimit')){_0x34c2f4[_0xd0c5('0x32')]=qs[_0xd0c5('0x32')](_0x19b9ec[_0xd0c5('0x2a')][_0xd0c5('0x32')]);_0x34c2f4['offset']=qs[_0xd0c5('0x1b')](_0x19b9ec[_0xd0c5('0x2a')]['offset']);}_0x34c2f4[_0xd0c5('0x33')]=qs['sort'](_0x19b9ec[_0xd0c5('0x2a')][_0xd0c5('0x34')]);_0x34c2f4[_0xd0c5('0x35')]=qs['filters'](_[_0xd0c5('0x36')](_0x19b9ec[_0xd0c5('0x2a')],_0x3e6400[_0xd0c5('0x2c')]));if(_0x19b9ec[_0xd0c5('0x2a')][_0xd0c5('0x37')]){_0x34c2f4[_0xd0c5('0x35')]=_[_0xd0c5('0x38')](_0x34c2f4[_0xd0c5('0x35')],{'$or':_[_0xd0c5('0x39')](_0x2ee47e,function(_0x54042){if(_0x54042[_0xd0c5('0x3a')][_0xd0c5('0x3b')]!==_0xd0c5('0x3c')){var _0x4d2c05={};_0x4d2c05[_0x54042['field']]={'$like':'%'+_0x19b9ec[_0xd0c5('0x2a')]['filter']+'%'};return _0x4d2c05;}})});}_0x34c2f4=_[_0xd0c5('0x38')]({},_0x34c2f4,_0x19b9ec[_0xd0c5('0x3d')]);var _0x478946={'where':_0x34c2f4[_0xd0c5('0x35')]};return db[_0xd0c5('0x27')]['count'](_0x478946)[_0xd0c5('0x21')](function(_0x356725){_0x3502fe[_0xd0c5('0x1a')]=_0x356725;if(_0x19b9ec[_0xd0c5('0x2a')][_0xd0c5('0x3e')]){_0x34c2f4[_0xd0c5('0x3f')]=[{'all':!![]}];}return db[_0xd0c5('0x27')][_0xd0c5('0x40')](_0x34c2f4);})[_0xd0c5('0x21')](function(_0x12b1f1){_0x3502fe[_0xd0c5('0x41')]=_0x12b1f1;return _0x3502fe;})[_0xd0c5('0x21')](respondWithFilteredResult(_0x198e39,_0x34c2f4))[_0xd0c5('0x42')](handleError(_0x198e39,null));};exports['show']=function(_0x1df4be,_0x41796b){var _0x215048={'raw':!![],'where':{'id':_0x1df4be[_0xd0c5('0x43')]['id']}},_0x2563df={};_0x2563df['model']=_['keys'](db[_0xd0c5('0x27')][_0xd0c5('0x28')]);_0x2563df[_0xd0c5('0x2a')]=_[_0xd0c5('0x2b')](_0x1df4be['query']);_0x2563df[_0xd0c5('0x2c')]=_[_0xd0c5('0x2d')](_0x2563df[_0xd0c5('0x29')],_0x2563df[_0xd0c5('0x2a')]);_0x215048[_0xd0c5('0x2f')]=_[_0xd0c5('0x2d')](_0x2563df[_0xd0c5('0x29')],qs['fields'](_0x1df4be[_0xd0c5('0x2a')][_0xd0c5('0x2e')]));_0x215048['attributes']=_0x215048[_0xd0c5('0x2f')][_0xd0c5('0x30')]?_0x215048[_0xd0c5('0x2f')]:_0x2563df['model'];if(_0x1df4be['query']['includeAll']){_0x215048['include']=[{'all':!![]}];}_0x215048=_[_0xd0c5('0x38')]({},_0x215048,_0x1df4be['options']);return db[_0xd0c5('0x27')]['find'](_0x215048)[_0xd0c5('0x21')](handleEntityNotFound(_0x41796b,null))['then'](respondWithResult(_0x41796b,null))[_0xd0c5('0x42')](handleError(_0x41796b,null));};exports[_0xd0c5('0x44')]=function(_0x2b6cb7,_0x2b939e){return db[_0xd0c5('0x27')]['create'](_0x2b6cb7[_0xd0c5('0x45')],{})[_0xd0c5('0x21')](respondWithResult(_0x2b939e,0xc9))[_0xd0c5('0x42')](handleError(_0x2b939e,null));};exports[_0xd0c5('0x20')]=function(_0x250733,_0x230bfe){if(_0x250733['body']['id']){delete _0x250733[_0xd0c5('0x45')]['id'];}return db[_0xd0c5('0x27')][_0xd0c5('0x46')]({'where':{'id':_0x250733[_0xd0c5('0x43')]['id']}})['then'](handleEntityNotFound(_0x230bfe,null))[_0xd0c5('0x21')](saveUpdates(_0x250733[_0xd0c5('0x45')],null))[_0xd0c5('0x21')](respondWithResult(_0x230bfe,null))[_0xd0c5('0x42')](handleError(_0x230bfe,null));};exports[_0xd0c5('0x47')]=function(_0x43d0ad,_0x17d71c){return db[_0xd0c5('0x27')][_0xd0c5('0x46')]({'where':{'id':_0x43d0ad[_0xd0c5('0x43')]['id']}})[_0xd0c5('0x21')](handleEntityNotFound(_0x17d71c,null))[_0xd0c5('0x21')](removeEntity(_0x17d71c,null))['catch'](handleError(_0x17d71c,null));};exports['describe']=function(_0x4265d7,_0x1dd3aa){return db[_0xd0c5('0x27')][_0xd0c5('0x48')]()[_0xd0c5('0x21')](respondWithResult(_0x1dd3aa,null))[_0xd0c5('0x42')](handleError(_0x1dd3aa,null));};
\ No newline at end of file
index 4a75b61..6340f39 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1c7e=['request-promise','define','uniqueid','util','api','moment','bluebird'];(function(_0x2a1140,_0x103c82){var _0x3a595b=function(_0x8936a9){while(--_0x8936a9){_0x2a1140['push'](_0x2a1140['shift']());}};_0x3a595b(++_0x103c82);}(_0x1c7e,0xce));var _0xe1c7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1c7e[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xe1c7('0x0'));var logger=require('../../config/logger')(_0xe1c7('0x1'));var moment=require(_0xe1c7('0x2'));var BPromise=require(_0xe1c7('0x3'));var rp=require(_0xe1c7('0x4'));var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x2d4f19,_0x48600b){return _0x2d4f19[_0xe1c7('0x5')]('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xe1c7('0x6'),'fields':[_0xe1c7('0x6')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x9042=['exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','request-promise'];(function(_0x23b93b,_0x3fad96){var _0x5f1f59=function(_0x175d54){while(--_0x175d54){_0x23b93b['push'](_0x23b93b['shift']());}};_0x5f1f59(++_0x3fad96);}(_0x9042,0x94));var _0x2904=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x9042[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0x2904('0x0'));var util=require(_0x2904('0x1'));var logger=require(_0x2904('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2904('0x3'));var attributes=require('./chatTransferReport.attributes');module[_0x2904('0x4')]=function(_0x1ca41d,_0x5cbd43){return _0x1ca41d['define'](_0x2904('0x5'),attributes,{'tableName':_0x2904('0x6'),'paranoid':![],'indexes':[{'name':_0x2904('0x7'),'fields':[_0x2904('0x7')]}],'timestamps':!![]});};
\ No newline at end of file
index a0d9d80..171b40a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x336a=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x38fd54,_0xa841b){var _0x8e82f6=function(_0x3084e6){while(--_0x3084e6){_0x38fd54['push'](_0x38fd54['shift']());}};_0x8e82f6(++_0xa841b);}(_0x336a,0xa3));var _0xa336=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x336a[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0xa336('0x0'));var util=require(_0xa336('0x1'));var moment=require(_0xa336('0x2'));var BPromise=require('bluebird');var rs=require(_0xa336('0x3'));var fs=require('fs');var Redis=require(_0xa336('0x4'));var db=require(_0xa336('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa336('0x6'))(_0xa336('0x7'));var config=require(_0xa336('0x8'));var jayson=require(_0xa336('0x9'));var client=jayson[_0xa336('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbec93d,_0x925e4c,_0x1b25de){return new BPromise(function(_0x527ad8,_0x1fdd6e){return client[_0xa336('0xb')](_0xbec93d,_0x1b25de)[_0xa336('0xc')](function(_0x1c7a09){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x925e4c,_0xa336('0xd'));logger[_0xa336('0xe')](_0xa336('0xf'),_0x925e4c,_0xa336('0xd'),JSON[_0xa336('0x10')](_0x1c7a09));if(_0x1c7a09[_0xa336('0x11')]){if(_0x1c7a09[_0xa336('0x11')][_0xa336('0x12')]===0x1f4){logger['error'](_0xa336('0x13'),_0x925e4c,_0x1c7a09[_0xa336('0x11')][_0xa336('0x14')]);return _0x1fdd6e(_0x1c7a09[_0xa336('0x11')]['message']);}logger['error'](_0xa336('0x13'),_0x925e4c,_0x1c7a09[_0xa336('0x11')][_0xa336('0x14')]);return _0x527ad8(_0x1c7a09[_0xa336('0x11')][_0xa336('0x14')]);}else{logger[_0xa336('0x15')](_0xa336('0x13'),_0x925e4c,'request\x20sent');_0x527ad8(_0x1c7a09[_0xa336('0x16')][_0xa336('0x14')]);}})[_0xa336('0x17')](function(_0x4fe949){logger['error'](_0xa336('0x13'),_0x925e4c,_0x4fe949);_0x1fdd6e(_0x4fe949);});});}
\ No newline at end of file
+var _0x6599=['util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatTransferReport,\x20%s,\x20%s','result','catch'];(function(_0x5d9f2f,_0x1934df){var _0x4a787c=function(_0x312ce7){while(--_0x312ce7){_0x5d9f2f['push'](_0x5d9f2f['shift']());}};_0x4a787c(++_0x1934df);}(_0x6599,0xb0));var _0x9659=function(_0x5fa520,_0xaf0e7d){_0x5fa520=_0x5fa520-0x0;var _0x1bf6c4=_0x6599[_0x5fa520];return _0x1bf6c4;};'use strict';var _=require('lodash');var util=require(_0x9659('0x0'));var moment=require(_0x9659('0x1'));var BPromise=require(_0x9659('0x2'));var rs=require(_0x9659('0x3'));var fs=require('fs');var Redis=require(_0x9659('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9659('0x5'));var logger=require('../../config/logger')(_0x9659('0x6'));var config=require('../../config/environment');var jayson=require(_0x9659('0x7'));var client=jayson[_0x9659('0x8')][_0x9659('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x478dfa,_0x4e4402,_0xabdd12){return new BPromise(function(_0x14cb81,_0x4d0a52){return client[_0x9659('0xa')](_0x478dfa,_0xabdd12)['then'](function(_0x23f34a){logger[_0x9659('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x4e4402,_0x9659('0xc'));logger[_0x9659('0xd')](_0x9659('0xe'),_0x4e4402,'request\x20sent',JSON[_0x9659('0xf')](_0x23f34a));if(_0x23f34a['error']){if(_0x23f34a[_0x9659('0x10')][_0x9659('0x11')]===0x1f4){logger[_0x9659('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x4e4402,_0x23f34a[_0x9659('0x10')][_0x9659('0x12')]);return _0x4d0a52(_0x23f34a[_0x9659('0x10')][_0x9659('0x12')]);}logger[_0x9659('0x10')](_0x9659('0x13'),_0x4e4402,_0x23f34a[_0x9659('0x10')][_0x9659('0x12')]);return _0x14cb81(_0x23f34a[_0x9659('0x10')][_0x9659('0x12')]);}else{logger[_0x9659('0xb')](_0x9659('0x13'),_0x4e4402,_0x9659('0xc'));_0x14cb81(_0x23f34a[_0x9659('0x14')]['message']);}})[_0x9659('0x15')](function(_0xd1ab56){logger[_0x9659('0x10')](_0x9659('0x13'),_0x4e4402,_0xd1ab56);_0x4d0a52(_0xd1ab56);});});}
\ No newline at end of file
index 19bb496..9ec56c5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6dfb=['multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','show','post','create','put','/:id','destroy','exports'];(function(_0x523671,_0x4657fc){var _0x5b0bdc=function(_0x301007){while(--_0x301007){_0x523671['push'](_0x523671['shift']());}};_0x5b0bdc(++_0x4657fc);}(_0x6dfb,0xc6));var _0xb6df=function(_0x568cc7,_0x3481cc){_0x568cc7=_0x568cc7-0x0;var _0x2d9da3=_0x6dfb[_0x568cc7];return _0x2d9da3;};'use strict';var multer=require(_0xb6df('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb6df('0x1'));var express=require(_0xb6df('0x2'));var router=express[_0xb6df('0x3')]();var auth=require(_0xb6df('0x4'));var interaction=require(_0xb6df('0x5'));var config=require(_0xb6df('0x6'));var controller=require('./chatTransferReport.controller');router[_0xb6df('0x7')]('/',auth['isAuthenticated'](),controller[_0xb6df('0x8')]);router[_0xb6df('0x7')]('/describe',auth[_0xb6df('0x9')](),controller[_0xb6df('0xa')]);router[_0xb6df('0x7')]('/:id',auth[_0xb6df('0x9')](),controller[_0xb6df('0xb')]);router[_0xb6df('0xc')]('/',auth[_0xb6df('0x9')](),controller[_0xb6df('0xd')]);router[_0xb6df('0xe')](_0xb6df('0xf'),auth[_0xb6df('0x9')](),controller['update']);router['delete'](_0xb6df('0xf'),auth[_0xb6df('0x9')](),controller[_0xb6df('0x10')]);module[_0xb6df('0x11')]=router;
\ No newline at end of file
+var _0xe18c=['Router','../../components/interaction/service','./chatTransferReport.controller','get','isAuthenticated','index','show','post','/:id','update','delete','destroy','exports','multer','util','path','express'];(function(_0x576c0e,_0x80ce9d){var _0x42eb04=function(_0x17fc8d){while(--_0x17fc8d){_0x576c0e['push'](_0x576c0e['shift']());}};_0x42eb04(++_0x80ce9d);}(_0xe18c,0x172));var _0xce18=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe18c[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xce18('0x0'));var util=require(_0xce18('0x1'));var path=require(_0xce18('0x2'));var timeout=require('connect-timeout');var express=require(_0xce18('0x3'));var router=express[_0xce18('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xce18('0x5'));var config=require('../../config/environment');var controller=require(_0xce18('0x6'));router[_0xce18('0x7')]('/',auth[_0xce18('0x8')](),controller[_0xce18('0x9')]);router[_0xce18('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xce18('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xce18('0xa')]);router[_0xce18('0xb')]('/',auth[_0xce18('0x8')](),controller['create']);router['put'](_0xce18('0xc'),auth[_0xce18('0x8')](),controller[_0xce18('0xd')]);router[_0xce18('0xe')](_0xce18('0xc'),auth[_0xce18('0x8')](),controller[_0xce18('0xf')]);module[_0xce18('0x10')]=router;
\ No newline at end of file
index f0457b7..b5227f4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6da6=['squared','Chat','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','star','thumb','stringify','input','name','text','getDataValue','onlineForm','textarea','Comments','offlineForm','parse','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','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','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','email','Agent','#9f946a','#ffffff','BOOLEAN','ENUM','rounded'];(function(_0x836b0a,_0xac6d15){var _0x5e4a2f=function(_0xd33454){while(--_0xd33454){_0x836b0a['push'](_0x836b0a['shift']());}};_0x5e4a2f(++_0xac6d15);}(_0x6da6,0xf3));var _0x66da=function(_0x349c2f,_0x41bd46){_0x349c2f=_0x349c2f-0x0;var _0x5ef6c6=_0x6da6[_0x349c2f];return _0x5ef6c6;};'use strict';var Sequelize=require(_0x66da('0x0'));var rs=require(_0x66da('0x1'));module[_0x66da('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x66da('0x3')],'allowNull':![],'unique':_0x66da('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x66da('0x3')],'defaultValue':_0x66da('0x5')},'mapKeyOffline':{'type':Sequelize[_0x66da('0x3')],'defaultValue':_0x66da('0x5')},'key':{'type':Sequelize[_0x66da('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x66da('0x6')},'customerAlias':{'type':Sequelize[_0x66da('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x66da('0x3')],'allowNull':![],'defaultValue':_0x66da('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x66da('0x3')],'allowNull':![],'defaultValue':_0x66da('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x66da('0x3')],'allowNull':![],'defaultValue':_0x66da('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x66da('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x66da('0xa')](_0x66da('0xb'),_0x66da('0xc')),'defaultValue':_0x66da('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x66da('0x3')],'defaultValue':_0x66da('0xd')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x66da('0x3')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x66da('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x66da('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x66da('0x3')],'defaultValue':_0x66da('0xf')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x66da('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x66da('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x66da('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x66da('0x3')],'defaultValue':_0x66da('0x13')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x66da('0x14')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x66da('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x66da('0x16')},'closingMessageButton':{'type':Sequelize[_0x66da('0x3')],'defaultValue':_0x66da('0x17')},'skipMessageButton':{'type':Sequelize[_0x66da('0x3')],'defaultValue':_0x66da('0x18')},'conditionAgreement':{'type':Sequelize[_0x66da('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x66da('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x66da('0x9')],'defaultValue':![]},'ratingType':{'type':Sequelize[_0x66da('0xa')](_0x66da('0x19'),_0x66da('0x1a')),'defaultValue':_0x66da('0x19')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x66da('0x10')],'defaultValue':function(){return JSON[_0x66da('0x1b')]({'items':[{'type':_0x66da('0x1c'),'variable':null,'config':{'placeholder':_0x66da('0x1d'),'type':_0x66da('0x1e'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x66da('0x5'),'type':_0x66da('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x66da('0x1f')](_0x66da('0x20'))?JSON['parse'](this['getDataValue'](_0x66da('0x20'))):{};},'set':function(_0x2aeda7){return this['setDataValue'](_0x66da('0x20'),JSON['stringify'](_0x2aeda7));}},'offlineForm':{'type':Sequelize[_0x66da('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null},{'type':_0x66da('0x21'),'config':{'placeholder':_0x66da('0x22')},'props':{'title':_0x66da('0x22'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x66da('0x1f')](_0x66da('0x23'))?JSON[_0x66da('0x24')](this[_0x66da('0x1f')]('offlineForm')):{};},'set':function(_0x34d215){return this[_0x66da('0x25')]('offlineForm',JSON[_0x66da('0x1b')](_0x34d215));}},'token':{'type':Sequelize[_0x66da('0x3')],'defaultValue':function(){return rs[_0x66da('0x26')]();}},'autoclose':{'type':Sequelize[_0x66da('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x66da('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x66da('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x66da('0x3')]},'forwardOffline':{'type':Sequelize[_0x66da('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x66da('0x3')]},'waitingTitle':{'type':Sequelize[_0x66da('0x3')],'defaultValue':_0x66da('0x27')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x66da('0x28')},'offlineMessageSubject':{'type':Sequelize[_0x66da('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x66da('0x3')],'defaultValue':_0x66da('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0x66da('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x66da('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x66da('0x3')],'defaultValue':_0x66da('0x18')},'sendUnmanaged':{'type':Sequelize[_0x66da('0x3')],'defaultValue':_0x66da('0x17')},'enableCustomerAttachment':{'type':Sequelize[_0x66da('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x66da('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x66da('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x66da('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x66da('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x66da('0x2a');}},'notificationSound':{'type':Sequelize[_0x66da('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x66da('0x3')],'defaultValue':_0x66da('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x66da('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x66da('0x3')],'defaultValue':_0x66da('0x2c')},'verticalAlignment':{'type':Sequelize[_0x66da('0xe')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x66da('0x2d')},'defaultTitle':{'type':Sequelize[_0x66da('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x66da('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x66da('0x3')],'allowNull':![],'defaultValue':_0x66da('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x66da('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x66da('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x66da('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x66da('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x66da('0x3')],'defaultValue':_0x66da('0x2f')},'systemAvatar':{'type':Sequelize[_0x66da('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x66da('0xe')],'comment':_0x66da('0x30')},'mandatoryDisposition':{'type':Sequelize[_0x66da('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xe13ea5){if(!_0xe13ea5)this[_0x66da('0x25')](_0x66da('0x31'),null);this[_0x66da('0x25')](_0x66da('0x32'),_0xe13ea5);}}};
\ No newline at end of file
+var _0x335b=['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','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','exports','STRING','address','email','Agent','#9f946a','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','star','thumb','stringify','input','name','text','getDataValue','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','parse','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'];(function(_0xff1a42,_0x151995){var _0x592720=function(_0x5a886c){while(--_0x5a886c){_0xff1a42['push'](_0xff1a42['shift']());}};_0x592720(++_0x151995);}(_0x335b,0x106));var _0xb335=function(_0x51f268,_0x3d10dd){_0x51f268=_0x51f268-0x0;var _0xb7cf41=_0x335b[_0x51f268];return _0xb7cf41;};'use strict';var Sequelize=require(_0xb335('0x0'));var rs=require('randomstring');module[_0xb335('0x1')]={'name':{'type':Sequelize[_0xb335('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb335('0x3')},'description':{'type':Sequelize[_0xb335('0x2')]},'mapKey':{'type':Sequelize[_0xb335('0x2')],'defaultValue':_0xb335('0x4')},'mapKeyOffline':{'type':Sequelize[_0xb335('0x2')],'defaultValue':_0xb335('0x4')},'key':{'type':Sequelize[_0xb335('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xb335('0x2')],'defaultValue':_0xb335('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xb335('0x2')],'allowNull':![],'defaultValue':_0xb335('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xb335('0x2')],'allowNull':![],'defaultValue':'#9f946a','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xb335('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xb335('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xb335('0x9')](_0xb335('0xa'),_0xb335('0xb')),'defaultValue':_0xb335('0xa')},'header_online':{'type':Sequelize[_0xb335('0x2')],'defaultValue':_0xb335('0xc')},'start_chat_button':{'type':Sequelize[_0xb335('0x2')],'defaultValue':_0xb335('0xd')},'offline_chat_button':{'type':Sequelize[_0xb335('0x2')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0xb335('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xb335('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xb335('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xb335('0x2')],'defaultValue':_0xb335('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0xb335('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xb335('0xf')]},'closingQuestion':{'type':Sequelize[_0xb335('0x2')],'defaultValue':_0xb335('0x10')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0xb335('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0xb335('0x2')],'defaultValue':_0xb335('0x12')},'noteTitle':{'type':Sequelize[_0xb335('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xb335('0x2')],'defaultValue':_0xb335('0x13')},'closingMessage':{'type':Sequelize[_0xb335('0x2')],'defaultValue':_0xb335('0x14')},'closingMessageButton':{'type':Sequelize[_0xb335('0x2')],'defaultValue':_0xb335('0x15')},'skipMessageButton':{'type':Sequelize[_0xb335('0x2')],'defaultValue':_0xb335('0x16')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xb335('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xb335('0x8')],'defaultValue':![]},'ratingType':{'type':Sequelize[_0xb335('0x9')](_0xb335('0x17'),_0xb335('0x18')),'defaultValue':_0xb335('0x17')},'ratingStarsNumber':{'type':Sequelize[_0xb335('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xb335('0xf')],'defaultValue':function(){return JSON[_0xb335('0x19')]({'items':[{'type':_0xb335('0x1a'),'variable':null,'config':{'placeholder':_0xb335('0x1b'),'type':_0xb335('0x1c'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0xb335('0x1a'),'props':{'title':_0xb335('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xb335('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xb335('0x1d')](_0xb335('0x1e'))?JSON['parse'](this['getDataValue']('onlineForm')):{};},'set':function(_0x1bcdbc){return this[_0xb335('0x1f')]('onlineForm',JSON[_0xb335('0x19')](_0x1bcdbc));}},'offlineForm':{'type':Sequelize[_0xb335('0xf')],'defaultValue':function(){return JSON[_0xb335('0x19')]({'items':[{'type':_0xb335('0x1a'),'props':{'title':_0xb335('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xb335('0x4'),'type':'email'},'variable':null},{'type':_0xb335('0x20'),'config':{'placeholder':'Comments'},'props':{'title':_0xb335('0x21'),'helpText':_0xb335('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0xb335('0x1d')](_0xb335('0x23'))?JSON[_0xb335('0x24')](this[_0xb335('0x1d')]('offlineForm')):{};},'set':function(_0x1c66d9){return this[_0xb335('0x1f')](_0xb335('0x23'),JSON[_0xb335('0x19')](_0x1c66d9));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xb335('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xb335('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xb335('0x2')],'defaultValue':_0xb335('0x25')},'waitingMessage':{'type':Sequelize[_0xb335('0x2')],'defaultValue':_0xb335('0x26')},'offlineMessageSubject':{'type':Sequelize[_0xb335('0x2')],'defaultValue':_0xb335('0x27')},'offlineMessageBody':{'type':Sequelize[_0xb335('0x2')],'defaultValue':_0xb335('0x28')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xb335('0x2')],'defaultValue':_0xb335('0x29')},'skipUnmanaged':{'type':Sequelize[_0xb335('0x2')],'defaultValue':_0xb335('0x16')},'sendUnmanaged':{'type':Sequelize[_0xb335('0x2')],'defaultValue':_0xb335('0x15')},'enableCustomerAttachment':{'type':Sequelize[_0xb335('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xb335('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xb335('0xf')]},'showAgentAvatar':{'type':Sequelize[_0xb335('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xb335('0x2')]},'notificationTemplate':{'type':Sequelize[_0xb335('0xf')],'defaultValue':function(){return _0xb335('0x2a');}},'notificationSound':{'type':Sequelize[_0xb335('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb335('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xb335('0x2')],'defaultValue':_0xb335('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0xb335('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xb335('0x2')],'defaultValue':_0xb335('0x2c')},'verticalAlignment':{'type':Sequelize[_0xb335('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xb335('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xb335('0x2')]},'customerAvatar':{'type':Sequelize[_0xb335('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0xb335('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xb335('0x2')],'allowNull':![],'defaultValue':_0xb335('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xb335('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb335('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xb335('0x2')],'defaultValue':_0xb335('0x2e')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb335('0x7')],'comment':_0xb335('0x2f')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb335('0x30'),'set':function(_0x27e47f){if(!_0x27e47f)this[_0xb335('0x1f')](_0xb335('0x31'),null);this['setDataValue']('mandatoryDisposition',_0x27e47f);}}};
\ No newline at end of file
index 8138e2a..a15322a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8615=['push','close','*,*,*,*','ChatMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','offline','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','addInteraction','ids','omit','getInteractions','Owner','fullname','Tag','Tags','color','tag','Command','timezone','iftime\x20%s,%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','inspect','No\x20timezone','getSnippet','Interval','getProactiveActions','virtual','License','increment','chatLicenseExceeded','Intervals','all','some','server/files/chat/iframe.js','utf8','remote','headers','x-forwarded-for','x-real-ip','remoteAddress','replace','alignment','verticalAlignment','addApplications','transaction','ChatApplication','findAndCountAll','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','ChatOfflineMessage','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./chatWebsite.socket','jayson/promise','http','client','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','json','offset','limit','Content-Range','apply','reject','save','update','destroy','get','ChatWebsites','UserProfileResource','sendStatus','name','index','Pause','mandatoryDispositionPause','ChatWebsite','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','count','include','findAll','rows','show','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','getDispositions','findOne','Disposition','includeAll','removeDispositions','CannedAnswer','getAnswers','removeAnswers','addLogo','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.png','sitepic','../../config/license/util','getLicense','custom','isNil','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','notify','user-agent-parser','setUA','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','List','account','applications','list','priority','asc','Applications','Contacts','contact','lastName','customerIp','referer','browser','version','unknown','format','%s\x20%s','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','interaction','spread','firstName','messageId','created','autoclose'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x8615,0x64));var _0x5861=function(_0x1105cd,_0x4799f1){_0x1105cd=_0x1105cd-0x0;var _0x538822=_0x8615[_0x1105cd];return _0x538822;};'use strict';var pdf=require(_0x5861('0x0'));var emlformat=require(_0x5861('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5861('0x2'));var rp=require(_0x5861('0x3'));var moment=require(_0x5861('0x4'));var BPromise=require(_0x5861('0x5'));var Mustache=require(_0x5861('0x6'));var util=require('util');var path=require('path');var sox=require(_0x5861('0x7'));var csv=require('to-csv');var ejs=require(_0x5861('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5861('0x9'));var crypto=require(_0x5861('0xa'));var jsforce=require(_0x5861('0xb'));var deskjs=require(_0x5861('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5861('0xd'));var authService=require(_0x5861('0xe'));var hardwareService=require(_0x5861('0xf'));var Redis=require(_0x5861('0x10'));var qs=require(_0x5861('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x5861('0x12'));var config=require(_0x5861('0x13'));var db=require(_0x5861('0x14'))['db'];config['redis']=_[_0x5861('0x15')](config[_0x5861('0x16')],{'host':_0x5861('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5861('0x16')]));require(_0x5861('0x18'))['register'](socket);var jayson=require(_0x5861('0x19'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0x5861('0x1a')]({'port':0x232a});var client9003=jayson[_0x5861('0x1b')][_0x5861('0x1a')]({'port':0x232b});function respondWithRpcPromise(_0x44d5ba,_0x5bac53,_0x36fdb1,_0x415443){return new BPromise(function(_0x2e28ae,_0x56dd8e){var _0x5adbac=_0x415443||client;return _0x5adbac[_0x5861('0x1c')](_0x44d5ba,_0x36fdb1)[_0x5861('0x1d')](function(_0x4667cb){logger['info'](_0x5861('0x1e'),_0x5bac53,_0x5861('0x1f'));logger[_0x5861('0x20')](_0x5861('0x21'),_0x5bac53,_0x5861('0x1f'),JSON[_0x5861('0x22')](_0x4667cb));if(_0x4667cb[_0x5861('0x23')]){if(_0x4667cb[_0x5861('0x23')][_0x5861('0x24')]===0x1f4){logger['error'](_0x5861('0x1e'),_0x5bac53,_0x4667cb['error']['message']);return _0x56dd8e(_0x4667cb[_0x5861('0x23')][_0x5861('0x25')]);}logger[_0x5861('0x23')](_0x5861('0x1e'),_0x5bac53,_0x4667cb[_0x5861('0x23')][_0x5861('0x25')]);return _0x2e28ae(_0x4667cb['error'][_0x5861('0x25')]);}else{logger[_0x5861('0x26')]('ChatWebsite,\x20%s,\x20%s',_0x5bac53,_0x5861('0x1f'));_0x2e28ae(_0x4667cb[_0x5861('0x27')][_0x5861('0x25')]);}})[_0x5861('0x28')](function(_0x4ff7ed){logger[_0x5861('0x23')](_0x5861('0x1e'),_0x5bac53,_0x4ff7ed);_0x56dd8e(_0x4ff7ed);});});}function respondWithStatusCode(_0x132898,_0xcba27e){_0xcba27e=_0xcba27e||0xcc;return function(_0x333f00){if(_0x333f00){return _0x132898['sendStatus'](_0xcba27e);}return _0x132898[_0x5861('0x29')](_0xcba27e)[_0x5861('0x2a')]();};}function respondWithResult(_0x65f8db,_0x727f28){_0x727f28=_0x727f28||0xc8;return function(_0x4bbbf9){if(_0x4bbbf9){return _0x65f8db['status'](_0x727f28)[_0x5861('0x2b')](_0x4bbbf9);}};}function respondWithFilteredResult(_0x1c129d,_0x3af601){return function(_0x4d9989){if(_0x4d9989){var _0x375aaa=_0x4d9989['count'],_0xc9c2dd=_0x3af601[_0x5861('0x2c')],_0x1c8c9d=_0x3af601[_0x5861('0x2c')]+_0x3af601[_0x5861('0x2d')],_0xe3c4d;if(_0x1c8c9d>=_0x375aaa){_0x1c8c9d=_0x375aaa;_0xe3c4d=0xc8;}else{_0xe3c4d=0xce;}_0x1c129d['status'](_0xe3c4d);return _0x1c129d['set'](_0x5861('0x2e'),_0xc9c2dd+'-'+_0x1c8c9d+'/'+_0x375aaa)[_0x5861('0x2b')](_0x4d9989);}return null;};}function patchUpdates(_0x298e6b){return function(_0x275f47){try{jsonpatch[_0x5861('0x2f')](_0x275f47,_0x298e6b,!![]);}catch(_0x33b349){return BPromise[_0x5861('0x30')](_0x33b349);}return _0x275f47[_0x5861('0x31')]();};}function saveUpdates(_0xfa8141,_0x2ac7d4){return function(_0x27fafc){if(_0x27fafc){return _0x27fafc[_0x5861('0x32')](_0xfa8141)[_0x5861('0x1d')](function(_0x1486a4){return _0x1486a4;});}return null;};}function removeEntity(_0x145dbb,_0x2f67a9){return function(_0x3030d6){if(_0x3030d6){return _0x3030d6[_0x5861('0x33')]()[_0x5861('0x1d')](function(){var _0x2ae008=_0x3030d6[_0x5861('0x34')]({'plain':!![]});var _0x529a73=_0x5861('0x35');return db[_0x5861('0x36')][_0x5861('0x33')]({'where':{'type':_0x529a73,'resourceId':_0x2ae008['id']}})[_0x5861('0x1d')](function(){return _0x3030d6;});})[_0x5861('0x1d')](function(){_0x145dbb['status'](0xcc)[_0x5861('0x2a')]();});}};}function handleEntityNotFound(_0xa21967,_0x46b44d){return function(_0x416838){if(!_0x416838){_0xa21967[_0x5861('0x37')](0x194);}return _0x416838;};}function handleError(_0x52bfbb,_0x2b33be){_0x2b33be=_0x2b33be||0x1f4;return function(_0x2f4902){logger[_0x5861('0x23')](_0x2f4902['stack']);if(_0x2f4902[_0x5861('0x38')]){delete _0x2f4902[_0x5861('0x38')];}_0x52bfbb[_0x5861('0x29')](_0x2b33be)['send'](_0x2f4902);};}exports[_0x5861('0x39')]=function(_0x4a1aac,_0x55d35c){var _0x20284d={'include':[{'model':db[_0x5861('0x3a')],'as':_0x5861('0x3b')}]},_0x4a39d5={},_0x5c1846={'count':0x0,'rows':[]};var _0x285f9d=db[_0x5861('0x3c')]['rawAttributes'];_0x4a39d5[_0x5861('0x3d')]=_[_0x5861('0x3e')](_0x285f9d);_0x4a39d5[_0x5861('0x3f')]=_[_0x5861('0x3e')](_0x4a1aac[_0x5861('0x3f')]);_0x4a39d5[_0x5861('0x40')]=_[_0x5861('0x41')](_0x4a39d5[_0x5861('0x3d')],_0x4a39d5[_0x5861('0x3f')]);_0x20284d[_0x5861('0x42')]=_['intersection'](_0x4a39d5[_0x5861('0x3d')],qs[_0x5861('0x43')](_0x4a1aac[_0x5861('0x3f')][_0x5861('0x43')]));_0x20284d[_0x5861('0x42')]=_0x20284d['attributes']['length']?_0x20284d[_0x5861('0x42')]:_0x4a39d5[_0x5861('0x3d')];if(!_0x4a1aac[_0x5861('0x3f')][_0x5861('0x44')](_0x5861('0x45'))){_0x20284d[_0x5861('0x2d')]=qs[_0x5861('0x2d')](_0x4a1aac[_0x5861('0x3f')][_0x5861('0x2d')]);_0x20284d['offset']=qs[_0x5861('0x2c')](_0x4a1aac['query']['offset']);}_0x20284d[_0x5861('0x46')]=qs[_0x5861('0x47')](_0x4a1aac[_0x5861('0x3f')][_0x5861('0x47')]);_0x20284d[_0x5861('0x48')]=qs['filters'](_[_0x5861('0x49')](_0x4a1aac[_0x5861('0x3f')],_0x4a39d5[_0x5861('0x40')]));if(_0x4a1aac[_0x5861('0x3f')][_0x5861('0x4a')]){_0x20284d[_0x5861('0x48')]=_[_0x5861('0x4b')](_0x20284d['where'],{'$or':_[_0x5861('0x4c')](_0x285f9d,function(_0x595454){if(_0x595454[_0x5861('0x4d')][_0x5861('0x4e')]!==_0x5861('0x4f')){var _0x338f78={};_0x338f78[_0x595454[_0x5861('0x50')]]={'$like':'%'+_0x4a1aac[_0x5861('0x3f')]['filter']+'%'};return _0x338f78;}})});}_0x20284d=_[_0x5861('0x4b')]({},_0x20284d,_0x4a1aac[_0x5861('0x51')]);var _0xcbde1e={'where':_0x20284d[_0x5861('0x48')]};return db[_0x5861('0x3c')][_0x5861('0x52')](_0xcbde1e)[_0x5861('0x1d')](function(_0x5e85fa){_0x5c1846[_0x5861('0x52')]=_0x5e85fa;if(_0x4a1aac[_0x5861('0x3f')]['includeAll']){_0x20284d[_0x5861('0x53')]=[{'all':!![]}];}return db[_0x5861('0x3c')][_0x5861('0x54')](_0x20284d);})[_0x5861('0x1d')](function(_0x1d9a43){_0x5c1846[_0x5861('0x55')]=_0x1d9a43;return _0x5c1846;})[_0x5861('0x1d')](respondWithFilteredResult(_0x55d35c,_0x20284d))[_0x5861('0x28')](handleError(_0x55d35c,null));};exports[_0x5861('0x56')]=function(_0x4b5a0e,_0x137a8f){var _0x4d01e2={'raw':![],'where':{'id':_0x4b5a0e[_0x5861('0x57')]['id']},'include':[{'model':db[_0x5861('0x3a')],'as':_0x5861('0x3b')}]},_0x39642a={};_0x39642a[_0x5861('0x3d')]=_[_0x5861('0x3e')](db[_0x5861('0x3c')][_0x5861('0x58')]);_0x39642a[_0x5861('0x3f')]=_[_0x5861('0x3e')](_0x4b5a0e[_0x5861('0x3f')]);_0x39642a[_0x5861('0x40')]=_[_0x5861('0x41')](_0x39642a['model'],_0x39642a[_0x5861('0x3f')]);_0x4d01e2[_0x5861('0x42')]=_[_0x5861('0x41')](_0x39642a[_0x5861('0x3d')],qs['fields'](_0x4b5a0e[_0x5861('0x3f')][_0x5861('0x43')]));_0x4d01e2[_0x5861('0x42')]=_0x4d01e2[_0x5861('0x42')][_0x5861('0x59')]?_0x4d01e2['attributes']:_0x39642a[_0x5861('0x3d')];if(_0x4b5a0e[_0x5861('0x3f')]['includeAll']){_0x4d01e2[_0x5861('0x53')]=[{'all':!![]}];}_0x4d01e2=_[_0x5861('0x4b')]({},_0x4d01e2,_0x4b5a0e[_0x5861('0x51')]);return db[_0x5861('0x3c')][_0x5861('0x5a')](_0x4d01e2)[_0x5861('0x1d')](handleEntityNotFound(_0x137a8f,null))['then'](respondWithResult(_0x137a8f,null))['catch'](handleError(_0x137a8f,null));};exports[_0x5861('0x5b')]=function(_0x4cf5aa,_0x10f149){return db[_0x5861('0x3c')][_0x5861('0x5b')](_0x4cf5aa[_0x5861('0x5c')],{})[_0x5861('0x1d')](function(_0x4bf1e6){var _0x3622cb=_0x4cf5aa[_0x5861('0x5d')][_0x5861('0x34')]({'plain':!![]});if(!_0x3622cb)throw new Error(_0x5861('0x5e'));if(_0x3622cb[_0x5861('0x5f')]==='user'){var _0x16ffc1=_0x4bf1e6[_0x5861('0x34')]({'plain':!![]});var _0x25dc2b=_0x5861('0x35');return db['UserProfileSection'][_0x5861('0x5a')]({'where':{'name':_0x25dc2b,'userProfileId':_0x3622cb['userProfileId']},'raw':!![]})[_0x5861('0x1d')](function(_0x3d2e3c){if(_0x3d2e3c&&_0x3d2e3c['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x16ffc1['name'],'resourceId':_0x16ffc1['id'],'type':_0x3d2e3c[_0x5861('0x38')],'sectionId':_0x3d2e3c['id']},{})[_0x5861('0x1d')](function(){return _0x4bf1e6;});}else{return _0x4bf1e6;}})[_0x5861('0x28')](function(_0x4ed815){logger[_0x5861('0x23')](_0x5861('0x60'),_0x4ed815);throw _0x4ed815;});}return _0x4bf1e6;})['then'](respondWithResult(_0x10f149,0xc9))['catch'](handleError(_0x10f149,null));};exports[_0x5861('0x32')]=function(_0x40b01a,_0xe4dee7){if(_0x40b01a['body']['id']){delete _0x40b01a['body']['id'];}return db[_0x5861('0x3c')][_0x5861('0x5a')]({'where':{'id':_0x40b01a[_0x5861('0x57')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x5861('0x1d')](handleEntityNotFound(_0xe4dee7,null))[_0x5861('0x1d')](saveUpdates(_0x40b01a[_0x5861('0x5c')],null))[_0x5861('0x1d')](function(_0x1d8699){if(_0x1d8699&&_0x40b01a[_0x5861('0x5c')][_0x5861('0x3b')]){return db[_0x5861('0x3a')][_0x5861('0x32')](_0x40b01a[_0x5861('0x5c')][_0x5861('0x3b')],{'where':{'ChatWebsiteId':_0x1d8699['id']}})[_0x5861('0x1d')](function(){return _0x1d8699;});}return _0x1d8699;})['then'](respondWithResult(_0xe4dee7,null))['catch'](handleError(_0xe4dee7,null));};exports[_0x5861('0x33')]=function(_0x263ce3,_0x4f7ed1){return db[_0x5861('0x3c')]['find']({'where':{'id':_0x263ce3[_0x5861('0x57')]['id']}})[_0x5861('0x1d')](handleEntityNotFound(_0x4f7ed1,null))[_0x5861('0x1d')](removeEntity(_0x4f7ed1,null))['catch'](handleError(_0x4f7ed1,null));};exports['describe']=function(_0x571c12,_0x1a83ff){return db[_0x5861('0x3c')][_0x5861('0x61')]()[_0x5861('0x1d')](respondWithResult(_0x1a83ff,null))[_0x5861('0x28')](handleError(_0x1a83ff,null));};exports[_0x5861('0x62')]=function(_0xbfe8cf,_0x1d10ec,_0xec6eca){if(_0xbfe8cf[_0x5861('0x5c')]['id']){delete _0xbfe8cf[_0x5861('0x5c')]['id'];}return db['ChatWebsite'][_0x5861('0x5a')]({'where':{'id':_0xbfe8cf[_0x5861('0x57')]['id']}})[_0x5861('0x1d')](handleEntityNotFound(_0x1d10ec,null))[_0x5861('0x1d')](function(_0x245051){if(_0x245051){_0xbfe8cf[_0x5861('0x5c')][_0x5861('0x63')]=_0x245051['id'];return db['Disposition'][_0x5861('0x5b')](_0xbfe8cf[_0x5861('0x5c')]);}})['then'](respondWithResult(_0x1d10ec,null))['catch'](handleError(_0x1d10ec,null));};exports[_0x5861('0x64')]=function(_0x16bace,_0xe9c15,_0x4f6c8){var _0x5485aa={'raw':![],'where':{}};var _0x592a1c={};var _0x2c44ec={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x5861('0x65')]({'where':{'id':_0x16bace[_0x5861('0x57')]['id']}})[_0x5861('0x1d')](handleEntityNotFound(_0xe9c15,null))['then'](function(_0x1722df){if(_0x1722df){_0x592a1c['model']=_[_0x5861('0x3e')](db[_0x5861('0x66')][_0x5861('0x58')]);_0x592a1c['query']=_[_0x5861('0x3e')](_0x16bace[_0x5861('0x3f')]);_0x592a1c[_0x5861('0x40')]=_[_0x5861('0x41')](_0x592a1c[_0x5861('0x3d')],_0x592a1c[_0x5861('0x3f')]);_0x5485aa[_0x5861('0x42')]=_[_0x5861('0x41')](_0x592a1c[_0x5861('0x3d')],qs[_0x5861('0x43')](_0x16bace[_0x5861('0x3f')]['fields']));_0x5485aa[_0x5861('0x42')]=_0x5485aa[_0x5861('0x42')][_0x5861('0x59')]?_0x5485aa[_0x5861('0x42')]:_0x592a1c['model'];if(!_0x16bace[_0x5861('0x3f')][_0x5861('0x44')](_0x5861('0x45'))){_0x5485aa[_0x5861('0x2d')]=qs[_0x5861('0x2d')](_0x16bace['query'][_0x5861('0x2d')]);_0x5485aa[_0x5861('0x2c')]=qs[_0x5861('0x2c')](_0x16bace['query']['offset']);}_0x5485aa[_0x5861('0x46')]=qs[_0x5861('0x47')](_0x16bace[_0x5861('0x3f')][_0x5861('0x47')]);_0x5485aa[_0x5861('0x48')]=qs['filters'](_[_0x5861('0x49')](_0x16bace['query'],_0x592a1c[_0x5861('0x40')]));_0x5485aa['where'][_0x5861('0x63')]=_0x1722df['id'];if(_0x16bace['query'][_0x5861('0x4a')]){_0x5485aa[_0x5861('0x48')]=_[_0x5861('0x4b')](_0x5485aa[_0x5861('0x48')],{'$or':_['map'](_0x5485aa['attributes'],function(_0xb7dbd8){var _0x3e6f06={};_0x3e6f06[_0xb7dbd8]={'$like':'%'+_0x16bace['query'][_0x5861('0x4a')]+'%'};return _0x3e6f06;})});}_0x5485aa=_[_0x5861('0x4b')]({},_0x5485aa,_0x16bace[_0x5861('0x51')]);return db[_0x5861('0x66')][_0x5861('0x52')]({'where':_0x5485aa[_0x5861('0x48')]})['then'](function(_0x11c6c7){_0x2c44ec[_0x5861('0x52')]=_0x11c6c7;if(_0x16bace[_0x5861('0x3f')][_0x5861('0x67')]){_0x5485aa[_0x5861('0x53')]=[{'all':!![]}];}return db['Disposition'][_0x5861('0x54')](_0x5485aa);})['then'](function(_0x2adca7){_0x2c44ec[_0x5861('0x55')]=_0x2adca7;return _0x2c44ec;});}})[_0x5861('0x1d')](respondWithFilteredResult(_0xe9c15,_0x5485aa))[_0x5861('0x28')](handleError(_0xe9c15,null));};exports[_0x5861('0x68')]=function(_0x4b43bf,_0x32632c,_0x369dd8){var _0x34ab6a;return db[_0x5861('0x3c')]['find']({'where':{'id':_0x4b43bf[_0x5861('0x57')]['id']}})[_0x5861('0x1d')](handleEntityNotFound(_0x32632c,null))[_0x5861('0x1d')](function(_0x22fd22){if(_0x22fd22){return _0x22fd22[_0x5861('0x68')](_0x4b43bf[_0x5861('0x3f')]['ids']);}})[_0x5861('0x1d')](respondWithStatusCode(_0x32632c,null))[_0x5861('0x28')](handleError(_0x32632c,null));};exports['addAnswer']=function(_0xef2b66,_0x5c076e,_0x1935cc){if(_0xef2b66['body']['id']){delete _0xef2b66[_0x5861('0x5c')]['id'];}return db[_0x5861('0x3c')][_0x5861('0x5a')]({'where':{'id':_0xef2b66[_0x5861('0x57')]['id']}})[_0x5861('0x1d')](handleEntityNotFound(_0x5c076e,null))[_0x5861('0x1d')](function(_0x3fa0de){if(_0x3fa0de){_0xef2b66['body']['ChatWebsiteId']=_0x3fa0de['id'];return db[_0x5861('0x69')][_0x5861('0x5b')](_0xef2b66[_0x5861('0x5c')]);}})[_0x5861('0x1d')](respondWithResult(_0x5c076e,null))[_0x5861('0x28')](handleError(_0x5c076e,null));};exports[_0x5861('0x6a')]=function(_0x573aaf,_0x219435,_0x5922de){var _0x33b444={'raw':![],'where':{}};var _0x222cba={};var _0x41a5e1={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x5861('0x65')]({'where':{'id':_0x573aaf[_0x5861('0x57')]['id']}})[_0x5861('0x1d')](handleEntityNotFound(_0x219435,null))[_0x5861('0x1d')](function(_0x96e232){if(_0x96e232){_0x222cba[_0x5861('0x3d')]=_[_0x5861('0x3e')](db[_0x5861('0x69')][_0x5861('0x58')]);_0x222cba[_0x5861('0x3f')]=_[_0x5861('0x3e')](_0x573aaf['query']);_0x222cba[_0x5861('0x40')]=_['intersection'](_0x222cba['model'],_0x222cba[_0x5861('0x3f')]);_0x33b444['attributes']=_['intersection'](_0x222cba['model'],qs[_0x5861('0x43')](_0x573aaf['query'][_0x5861('0x43')]));_0x33b444[_0x5861('0x42')]=_0x33b444['attributes'][_0x5861('0x59')]?_0x33b444[_0x5861('0x42')]:_0x222cba[_0x5861('0x3d')];if(!_0x573aaf['query']['hasOwnProperty'](_0x5861('0x45'))){_0x33b444['limit']=qs[_0x5861('0x2d')](_0x573aaf['query']['limit']);_0x33b444[_0x5861('0x2c')]=qs[_0x5861('0x2c')](_0x573aaf[_0x5861('0x3f')][_0x5861('0x2c')]);}_0x33b444[_0x5861('0x46')]=qs['sort'](_0x573aaf['query'][_0x5861('0x47')]);_0x33b444[_0x5861('0x48')]=qs[_0x5861('0x40')](_[_0x5861('0x49')](_0x573aaf[_0x5861('0x3f')],_0x222cba[_0x5861('0x40')]));_0x33b444[_0x5861('0x48')][_0x5861('0x63')]=_0x96e232['id'];if(_0x573aaf[_0x5861('0x3f')][_0x5861('0x4a')]){_0x33b444[_0x5861('0x48')]=_['merge'](_0x33b444[_0x5861('0x48')],{'$or':_[_0x5861('0x4c')](_0x33b444['attributes'],function(_0x373163){var _0x4dcec4={};_0x4dcec4[_0x373163]={'$like':'%'+_0x573aaf[_0x5861('0x3f')]['filter']+'%'};return _0x4dcec4;})});}_0x33b444=_[_0x5861('0x4b')]({},_0x33b444,_0x573aaf['options']);return db[_0x5861('0x69')][_0x5861('0x52')]({'where':_0x33b444[_0x5861('0x48')]})[_0x5861('0x1d')](function(_0x3d3fc2){_0x41a5e1['count']=_0x3d3fc2;if(_0x573aaf[_0x5861('0x3f')][_0x5861('0x67')]){_0x33b444[_0x5861('0x53')]=[{'all':!![]}];}return db[_0x5861('0x69')][_0x5861('0x54')](_0x33b444);})[_0x5861('0x1d')](function(_0xeab04){_0x41a5e1[_0x5861('0x55')]=_0xeab04;return _0x41a5e1;});}})[_0x5861('0x1d')](respondWithFilteredResult(_0x219435,_0x33b444))[_0x5861('0x28')](handleError(_0x219435,null));};exports[_0x5861('0x6b')]=function(_0xf10e6e,_0x5a95aa,_0x45b017){var _0x5cb2c8;return db[_0x5861('0x3c')][_0x5861('0x5a')]({'where':{'id':_0xf10e6e[_0x5861('0x57')]['id']}})['then'](handleEntityNotFound(_0x5a95aa,null))['then'](function(_0x7a87ec){if(_0x7a87ec){return _0x7a87ec[_0x5861('0x6b')](_0xf10e6e['query']['ids']);}})[_0x5861('0x1d')](respondWithStatusCode(_0x5a95aa,null))[_0x5861('0x28')](handleError(_0x5a95aa,null));};exports[_0x5861('0x6c')]=function(_0x505857,_0x47e81d,_0x2884fb){_0x505857[_0x5861('0x5c')]['sitepic']=_0x505857[_0x5861('0x6d')][_0x5861('0x6e')];return db[_0x5861('0x3c')][_0x5861('0x5a')]({'where':{'id':_0x505857[_0x5861('0x57')]['id']}})['then'](handleEntityNotFound(_0x47e81d,null))['then'](saveUpdates(_0x505857['body'],null))[_0x5861('0x1d')](respondWithResult(_0x47e81d,null))[_0x5861('0x28')](handleError(_0x47e81d,null));};exports[_0x5861('0x6f')]=function(_0x147f30,_0x4a32ad,_0x27c910){_0x147f30['body'][_0x5861('0x70')]=_0x147f30[_0x5861('0x6d')][_0x5861('0x6e')];return db[_0x5861('0x3c')][_0x5861('0x5a')]({'where':{'id':_0x147f30['params']['id']}})[_0x5861('0x1d')](handleEntityNotFound(_0x4a32ad,null))['then'](saveUpdates(_0x147f30[_0x5861('0x5c')],null))[_0x5861('0x1d')](respondWithResult(_0x4a32ad,null))[_0x5861('0x28')](handleError(_0x4a32ad,null));};exports[_0x5861('0x71')]=function(_0x3fc07e,_0x3f97a5,_0x44fa80){_0x3fc07e[_0x5861('0x5c')][_0x5861('0x72')]=_0x3fc07e[_0x5861('0x6d')][_0x5861('0x6e')];return db[_0x5861('0x3c')][_0x5861('0x5a')]({'where':{'id':_0x3fc07e[_0x5861('0x57')]['id']}})[_0x5861('0x1d')](handleEntityNotFound(_0x3f97a5,null))[_0x5861('0x1d')](saveUpdates(_0x3fc07e[_0x5861('0x5c')],null))[_0x5861('0x1d')](respondWithResult(_0x3f97a5,null))[_0x5861('0x28')](handleError(_0x3f97a5,null));};exports[_0x5861('0x73')]=function(_0x1a5808,_0x3c765c,_0x2c9450){_0x1a5808[_0x5861('0x5c')][_0x5861('0x74')]=_0x1a5808[_0x5861('0x6d')]['filename'];return db[_0x5861('0x3c')][_0x5861('0x5a')]({'where':{'id':_0x1a5808[_0x5861('0x57')]['id']}})['then'](handleEntityNotFound(_0x3c765c,null))[_0x5861('0x1d')](saveUpdates(_0x1a5808[_0x5861('0x5c')],null))[_0x5861('0x1d')](respondWithResult(_0x3c765c,null))[_0x5861('0x28')](handleError(_0x3c765c,null));};exports[_0x5861('0x75')]=function(_0x26090c,_0x1ff39c,_0x5dad0d){var _0x5014c1=path[_0x5861('0x76')](config[_0x5861('0x77')],_0x5861('0x78'));var _0x14912d={'where':{'id':_0x26090c[_0x5861('0x57')]['id']},'attributes':['id',_0x5861('0x79')],'raw':!![]};var _0xf71c49=![];return require(_0x5861('0x7a'))[_0x5861('0x7b')]()[_0x5861('0x1d')](function(_0xfe94a8){if(_0xfe94a8){_0xf71c49=_0xfe94a8[_0x5861('0x7c')];}})[_0x5861('0x1d')](function(){return db['ChatWebsite'][_0x5861('0x5a')](_0x14912d);})[_0x5861('0x1d')](handleEntityNotFound(_0x1ff39c,null))[_0x5861('0x1d')](function(_0x2b4565){if(_0x2b4565){if(!_[_0x5861('0x7d')](_0x2b4565[_0x5861('0x79')])){if(fs['existsSync'](path['join'](config[_0x5861('0x77')],_0x5861('0x7e'),_0x2b4565['sitepic']))&&_0xf71c49){_0x5014c1=path[_0x5861('0x76')](config[_0x5861('0x77')],_0x5861('0x7e'),_0x2b4565[_0x5861('0x79')]);}}return _0x1ff39c[_0x5861('0x7f')](_0x5014c1);}})['catch'](handleError(_0x1ff39c,null));};exports['getAvatar']=function(_0x1d3c6b,_0x5833f7,_0x1aa166){var _0x111867=path['join'](config[_0x5861('0x77')],_0x5861('0x80'));var _0x1ebb8d={'where':{'id':_0x1d3c6b[_0x5861('0x57')]['id']},'attributes':['id',_0x5861('0x70')],'raw':!![]};return db[_0x5861('0x3c')]['find'](_0x1ebb8d)[_0x5861('0x1d')](handleEntityNotFound(_0x5833f7,null))[_0x5861('0x1d')](function(_0x6771e0){if(_0x6771e0){if(!_[_0x5861('0x7d')](_0x6771e0[_0x5861('0x70')])){if(fs[_0x5861('0x81')](path[_0x5861('0x76')](config[_0x5861('0x77')],_0x5861('0x82'),_0x6771e0[_0x5861('0x70')]))){_0x111867=path['join'](config[_0x5861('0x77')],_0x5861('0x82'),_0x6771e0[_0x5861('0x70')]);}}return _0x5833f7[_0x5861('0x7f')](_0x111867);}})['catch'](handleError(_0x5833f7,null));};exports[_0x5861('0x83')]=function(_0x2b7104,_0x1e4850,_0x487f78){var _0x250161=path['join'](config[_0x5861('0x77')],'server/files/images/avatars/customer_avatar.png');var _0xc619ac={'where':{'id':_0x2b7104[_0x5861('0x57')]['id']},'attributes':['id',_0x5861('0x72'),_0x5861('0x84')],'raw':!![]};return db[_0x5861('0x3c')][_0x5861('0x5a')](_0xc619ac)['then'](handleEntityNotFound(_0x1e4850,null))['then'](function(_0x195f77){if(_0x195f77){if(!_[_0x5861('0x7d')](_0x195f77['customerAvatar'])){if(fs[_0x5861('0x81')](path[_0x5861('0x76')](config[_0x5861('0x77')],'server/files/images/avatars/',_0x195f77[_0x5861('0x72')]))&&_0x195f77[_0x5861('0x84')]){_0x250161=path[_0x5861('0x76')](config[_0x5861('0x77')],_0x5861('0x82'),_0x195f77[_0x5861('0x72')]);}}return _0x1e4850[_0x5861('0x7f')](_0x250161);}})[_0x5861('0x28')](handleError(_0x1e4850,null));};exports['getSystemAvatar']=function(_0x15b60c,_0x3d0638,_0x3408ac){var _0x4b1814=path[_0x5861('0x76')](config['root'],'server/files/images/avatars/system_avatar.png');var _0x1456a7={'where':{'id':_0x15b60c[_0x5861('0x57')]['id']},'attributes':['id',_0x5861('0x74')],'raw':!![]};return db[_0x5861('0x3c')][_0x5861('0x5a')](_0x1456a7)[_0x5861('0x1d')](handleEntityNotFound(_0x3d0638,null))[_0x5861('0x1d')](function(_0x354782){if(_0x354782){if(!_[_0x5861('0x7d')](_0x354782[_0x5861('0x74')])){if(fs[_0x5861('0x81')](path[_0x5861('0x76')](config[_0x5861('0x77')],_0x5861('0x82'),_0x354782['systemAvatar']))){_0x4b1814=path[_0x5861('0x76')](config[_0x5861('0x77')],_0x5861('0x82'),_0x354782[_0x5861('0x74')]);}}return _0x3d0638['download'](_0x4b1814);}})[_0x5861('0x28')](handleError(_0x3d0638,null));};exports[_0x5861('0x85')]=function(_0x1a51c5,_0x1c901a,_0x5b885b){var _0x9fda4d=require(_0x5861('0x86'));var _0x3e2889=new _0x9fda4d();var _0x4af815=_0x3e2889[_0x5861('0x87')](_0x1a51c5['headers']['user-agent'])[_0x5861('0x88')]();var _0x38b65b={'body':_0x1a51c5['body'],'channel':_0x5861('0x89')};var _0x589ec5=[];var _0x47542a=[];var _0x23192d={};var _0xd49923=![];return db[_0x5861('0x8a')][_0x5861('0x61')]()[_0x5861('0x1d')](function(_0x2defa5){if(!_0x2defa5){throw new db[(_0x5861('0x8b'))][(_0x5861('0x8c'))](_0x5861('0x8d'));}_0x589ec5=_[_0x5861('0x8e')](_[_0x5861('0x3e')](_0x2defa5),['createdAt','updatedAt']);_0x47542a=_[_0x5861('0x8e')](_[_0x5861('0x3e')](_0x2defa5),['createdAt',_0x5861('0x8f'),'CompanyId',_0x5861('0x90')]);if(_0x1a51c5['body']['id']){delete _0x1a51c5[_0x5861('0x5c')]['id'];}if(_[_0x5861('0x7d')](_0x1a51c5[_0x5861('0x5c')][_0x5861('0x91')])){throw new db[(_0x5861('0x8b'))][(_0x5861('0x8c'))](_0x5861('0x92'));}if(_[_0x5861('0x7d')](_0x1a51c5[_0x5861('0x5c')]['body'])||_0x1a51c5[_0x5861('0x5c')]['body']===''){throw new db['Sequelize'][(_0x5861('0x8c'))](_0x5861('0x93'));}if(_[_0x5861('0x7d')](_0x1a51c5[_0x5861('0x5c')][_0x5861('0x94')])){throw new db[(_0x5861('0x8b'))][(_0x5861('0x8c'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x47542a);}if(!_[_0x5861('0x95')](_0x47542a,_0x1a51c5[_0x5861('0x5c')][_0x5861('0x94')])){throw new db[(_0x5861('0x8b'))][(_0x5861('0x8c'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x47542a);}_0x23192d[_0x1a51c5[_0x5861('0x5c')][_0x5861('0x94')]]=_0x1a51c5[_0x5861('0x5c')]['from'];})[_0x5861('0x1d')](function(){return db[_0x5861('0x3c')][_0x5861('0x5a')]({'where':{'id':_0x1a51c5[_0x5861('0x57')]['id']},'include':[{'model':db['CmList'],'as':_0x5861('0x96'),'include':[{'model':db[_0x5861('0x8a')],'as':'Contacts','where':_0x23192d,'limit':0x1,'order':[[_0x5861('0x8f'),'DESC']]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})[_0x5861('0x1d')](handleEntityNotFound(_0x1c901a,null))[_0x5861('0x1d')](function(_0x26cc20){if(_0x26cc20&&_0x26cc20[_0x5861('0x96')]){_0x38b65b[_0x5861('0x97')]=_0x26cc20;_0x38b65b[_0x5861('0x98')]=_0x26cc20['Applications'];_0x38b65b[_0x5861('0x99')]=_0x26cc20[_0x5861('0x96')];_0x38b65b[_0x5861('0x98')]=_['orderBy'](_0x38b65b['applications'],[_0x5861('0x9a')],[_0x5861('0x9b')]);if(_0x38b65b[_0x5861('0x97')]['Applications']){delete _0x38b65b[_0x5861('0x97')][_0x5861('0x9c')];}if(_0x38b65b[_0x5861('0x97')][_0x5861('0x96')]&&_0x38b65b[_0x5861('0x97')][_0x5861('0x96')]['Contacts']['length']){return _0x38b65b[_0x5861('0x97')][_0x5861('0x96')][_0x5861('0x9d')][0x0];}var _0xe66da3=_[_0x5861('0x15')](_0x1a51c5[_0x5861('0x5c')],{'firstName':_0x1a51c5['body'][_0x5861('0x91')],'ListId':_0x26cc20[_0x5861('0x90')]});_0xe66da3[_0x1a51c5['body'][_0x5861('0x94')]]=_0x1a51c5[_0x5861('0x5c')][_0x5861('0x91')];return db[_0x5861('0x8a')][_0x5861('0x5b')](_0xe66da3,{'fields':_0x589ec5,'raw':!![]});}})[_0x5861('0x1d')](handleEntityNotFound(_0x1c901a,null))[_0x5861('0x1d')](function(_0x3d3a51){_0x38b65b[_0x5861('0x9e')]=_0x3d3a51;if(_0x3d3a51){var _0x4e700e={'ContactId':_0x3d3a51['id'],'ChatWebsiteId':_0x1a51c5[_0x5861('0x57')]['id'],'from':(_0x3d3a51['firstName']||'')+'\x20'+(_0x3d3a51[_0x5861('0x9f')]||''),'customerIp':_0x1a51c5[_0x5861('0x5c')][_0x5861('0xa0')],'referer':_0x1a51c5[_0x5861('0x5c')][_0x5861('0xa1')],'browserName':_0x4af815[_0x5861('0xa2')][_0x5861('0x38')]&&_0x4af815[_0x5861('0xa2')][_0x5861('0xa3')]?util['format']('%s\x20%s',_0x4af815[_0x5861('0xa2')][_0x5861('0x38')],_0x4af815[_0x5861('0xa2')][_0x5861('0xa3')]):_0x5861('0xa4'),'browserVersion':_0x4af815[_0x5861('0xa2')][_0x5861('0xa3')]||_0x5861('0xa4'),'osName':util[_0x5861('0xa5')](_0x5861('0xa6'),_0x4af815['os']['name'],_0x4af815['os'][_0x5861('0xa3')]),'osVersion':_0x4af815['os']['version'],'deviceModel':_0x4af815[_0x5861('0xa7')][_0x5861('0x3d')]&&_0x4af815[_0x5861('0xa7')][_0x5861('0xa8')]?util[_0x5861('0xa5')](_0x5861('0xa9'),_0x4af815[_0x5861('0xa7')]['model'],_0x4af815[_0x5861('0xa7')][_0x5861('0xa8')],_0x4af815['device']['type']):null,'deviceVendor':_0x4af815['device']['vendor'],'deviceType':_0x4af815['device'][_0x5861('0x4d')],'formData':JSON['stringify'](_0x1a51c5['body'])};var _0x3477fe={'ChatWebsiteId':_0x1a51c5[_0x5861('0x57')]['id'],'closed':![]};if(_0x1a51c5[_0x5861('0x5c')][_0x5861('0xaa')]){_0x3477fe[_0x5861('0xaa')]=_0x1a51c5[_0x5861('0x5c')][_0x5861('0xaa')];return db[_0x5861('0xab')][_0x5861('0x5a')]({'where':_0x3477fe})[_0x5861('0x1d')](function(_0x1fe251){if(_0x1fe251){return[_0x1fe251,![]];}_0x4e700e[_0x5861('0xaa')]=_0x1a51c5[_0x5861('0x5c')]['threadId'];_0x4e700e[_0x5861('0xac')]=_0x1a51c5[_0x5861('0x5c')]['externalUrl'];return db[_0x5861('0xab')][_0x5861('0x5b')](_0x4e700e)[_0x5861('0x1d')](function(_0xed2783){return[_0xed2783,!![]];});});}_0x3477fe['ContactId']=_0x3d3a51['id'];if(_0x1a51c5[_0x5861('0x5c')][_0x5861('0xad')]&&_0x1a51c5[_0x5861('0x5c')][_0x5861('0xad')]['id']){_0x3477fe['id']=_0x1a51c5[_0x5861('0x5c')][_0x5861('0xad')]['id'];return db[_0x5861('0xab')][_0x5861('0x5a')]({'where':_0x3477fe})['then'](function(_0x3d6086){if(_0x3d6086){return[_0x3d6086,![]];}return db[_0x5861('0xab')][_0x5861('0x5b')](_0x4e700e)[_0x5861('0x1d')](function(_0xc80272){return[_0xc80272,!![]];});});}return db[_0x5861('0xab')][_0x5861('0x5b')](_0x4e700e)['then'](function(_0x28cfe1){return[_0x28cfe1,!![]];});}})[_0x5861('0xae')](function(_0x3b8267,_0x2d9d43){if(_0x3b8267){_0xd49923=_0x2d9d43;if(!_0x2d9d43){var _0x2aadda={'from':(_0x38b65b[_0x5861('0x9e')][_0x5861('0xaf')]||'')+'\x20'+(_0x38b65b[_0x5861('0x9e')][_0x5861('0x9f')]||'')};if(_0x1a51c5[_0x5861('0x5c')][_0x5861('0xaa')]&&_0x1a51c5['body']['messageId']&&_0x1a51c5[_0x5861('0x5c')][_0x5861('0xaa')]!=_0x1a51c5[_0x5861('0x5c')][_0x5861('0xb0')]){_0x2aadda['threadId']=_0x1a51c5[_0x5861('0x5c')][_0x5861('0xb0')];}return _0x3b8267[_0x5861('0x32')](_0x2aadda);}else{return _0x3b8267;}}})[_0x5861('0x1d')](function(_0x3d5dd8){_0x38b65b[_0x5861('0xad')]=_0x3d5dd8[_0x5861('0x34')]({'plain':!![]});_0x38b65b['interaction'][_0x5861('0xb1')]=_0xd49923;if(_0x38b65b[_0x5861('0xad')]['created']){if(_0x38b65b[_0x5861('0x97')][_0x5861('0xb2')]){_0x38b65b['applications'][_0x5861('0xb3')]({'id':0x0,'priority':_0x38b65b[_0x5861('0x98')][_0x5861('0x59')]+0x1,'app':_0x5861('0xb4'),'appdata':'unmanaged','interval':_0x5861('0xb5')});}}return db[_0x5861('0xb6')][_0x5861('0x5b')]({'body':_0x1a51c5[_0x5861('0x5c')][_0x5861('0x5c')],'ChatWebsiteId':_0x1a51c5[_0x5861('0x57')]['id'],'ChatInteractionId':_0x3d5dd8['id'],'direction':'in','ContactId':_0x38b65b[_0x5861('0x9e')]['id'],'AttachmentId':_0x1a51c5[_0x5861('0x5c')][_0x5861('0xb7')]});})[_0x5861('0x1d')](function(_0x1276f8){_0x38b65b[_0x5861('0x25')]=_0x1276f8;if(_0x38b65b['interaction']['UserId']){return db[_0x5861('0xb8')][_0x5861('0x5a')]({'attributes':['id','name'],'where':{'id':_0x38b65b[_0x5861('0xad')][_0x5861('0xb9')]}})[_0x5861('0x1d')](function(_0x3c686f){if(_0x3c686f){_0x38b65b[_0x5861('0x98')][_0x5861('0xba')]({'id':0x0,'priority':0x0,'app':_0x5861('0xbb'),'appdata':_0x3c686f[_0x5861('0x38')]+','+(_0x38b65b[_0x5861('0x97')][_0x5861('0xbc')]||0xa),'interval':'*,*,*,*'});_0x38b65b[_0x5861('0xbd')]=!![];}return respondWithRpcPromise(_0x5861('0xbe'),_0x5861('0xbf'),_0x38b65b);});}return respondWithRpcPromise(_0x5861('0xbe'),_0x5861('0xbf'),_0x38b65b);})[_0x5861('0x1d')](function(_0x417f56){respondWithRpcPromise('EventManager','EventManager',{'event':_0x5861('0x85'),'message':_0x417f56},client9002);return _0x417f56;})[_0x5861('0x1d')](respondWithResult(_0x1c901a,null))[_0x5861('0x28')](handleError(_0x1c901a,null));};exports[_0x5861('0xc0')]=function(_0x32f807,_0x3ca65d,_0x104177){var _0x12b298,_0x4ace2e,_0x280382;var _0x1a4be1=[];var _0x3344a7=[];var _0x273d9c={};return db['CmContact'][_0x5861('0x61')]()[_0x5861('0x1d')](function(_0x274adf){if(!_0x274adf){throw new db['Sequelize']['ValidationError'](_0x5861('0x8d'));}_0x3344a7=_[_0x5861('0x8e')](_[_0x5861('0x3e')](_0x274adf),['createdAt',_0x5861('0x8f')]);_0x1a4be1=_[_0x5861('0x8e')](_[_0x5861('0x3e')](_0x274adf),['createdAt','updatedAt','CompanyId',_0x5861('0x90')]);if(_0x32f807['body']['id']){delete _0x32f807[_0x5861('0x5c')]['id'];}if(_[_0x5861('0x7d')](_0x32f807[_0x5861('0x5c')]['from'])){throw _0x3ca65d[_0x5861('0x29')](0x1f4)[_0x5861('0xc1')](new db['Sequelize'][(_0x5861('0x8c'))](_0x5861('0x92')));}if(_[_0x5861('0x7d')](_0x32f807[_0x5861('0x5c')][_0x5861('0x5c')])||_0x32f807[_0x5861('0x5c')][_0x5861('0x5c')]===''){throw _0x3ca65d['status'](0x1f4)[_0x5861('0xc1')](new db[(_0x5861('0x8b'))][(_0x5861('0x8c'))](_0x5861('0x93')));}if(_[_0x5861('0x7d')](_0x32f807[_0x5861('0x5c')][_0x5861('0xc2')])){throw _0x3ca65d[_0x5861('0x29')](0x1f4)[_0x5861('0xc1')](new db[(_0x5861('0x8b'))][(_0x5861('0x8c'))](_0x5861('0xc3')+_0x1a4be1));}if(!_[_0x5861('0x95')](_0x1a4be1,_0x32f807[_0x5861('0x5c')][_0x5861('0xc2')])){throw _0x3ca65d['status'](0x1f4)['send'](new db[(_0x5861('0x8b'))][(_0x5861('0x8c'))](_0x5861('0xc4')+_0x1a4be1));}_0x273d9c[_0x32f807[_0x5861('0x5c')]['mapKeyOffline']]=_0x32f807[_0x5861('0x5c')][_0x5861('0x91')];})[_0x5861('0x1d')](function(){return db[_0x5861('0x3c')][_0x5861('0x5a')]({'where':{'id':_0x32f807['params']['id']},'include':[{'model':db[_0x5861('0xc5')],'as':_0x5861('0x96')}]});})[_0x5861('0x1d')](handleEntityNotFound(_0x3ca65d,null))[_0x5861('0x1d')](function(_0x297653){if(_0x297653&&_0x297653[_0x5861('0x96')]){_0x4ace2e=_0x297653;var _0x1c61e4=_['defaults'](_0x32f807[_0x5861('0x5c')],{'firstName':_0x32f807['body'][_0x5861('0x91')],'phone':_0x32f807['body'][_0x5861('0x91')],'ListId':_0x297653[_0x5861('0x90')]});_0x1c61e4[_0x32f807[_0x5861('0x5c')]['mapKeyOffline']]=_0x32f807[_0x5861('0x5c')][_0x5861('0x91')];return db['CmContact']['findOrCreate']({'where':_0x273d9c,'defaults':_0x1c61e4});}})[_0x5861('0xae')](function(_0x4cfcb6){if(_0x4cfcb6){_0x280382=_0x4cfcb6;var _0xc42913=fs[_0x5861('0xc6')](path[_0x5861('0x76')](config[_0x5861('0x77')],_0x5861('0xc7')),'utf8');var _0x41d574=ejs[_0x5861('0xc8')](_0xc42913,{'body':_[_0x5861('0xc9')](_0x32f807[_0x5861('0x5c')][_0x5861('0x5c')]),'bodyTitle':_0x4ace2e[_0x5861('0xca')]});return db['ChatOfflineMessage'][_0x5861('0x5b')]({'body':_0x41d574,'ContactId':_0x4cfcb6['id'],'ChatWebsiteId':_0x4ace2e['id']});}})[_0x5861('0x1d')](function(_0x1e1549){if(_0x1e1549){_0x12b298=_0x1e1549;return db[_0x5861('0xcb')][_0x5861('0x65')]({'where':{'service':!![]},'include':[{'model':db[_0x5861('0xcc')],'as':_0x5861('0xcd'),'raw':!![]}]});}})[_0x5861('0x1d')](function(_0x19f0ca){if(_0x19f0ca&&_0x19f0ca[_0x5861('0xcd')]&&_0x4ace2e[_0x5861('0xce')]){var _0x1d8917={'tls':{'rejectUnauthorized':![]}};if(_0x19f0ca[_0x5861('0xcd')]['service']){_0x1d8917[_0x5861('0xcf')]=_0x19f0ca['Smtp']['service'];}else{_0x1d8917[_0x5861('0xd0')]=_0x19f0ca[_0x5861('0xcd')][_0x5861('0xd0')];_0x1d8917[_0x5861('0xd1')]=_0x19f0ca[_0x5861('0xcd')][_0x5861('0xd1')];_0x1d8917[_0x5861('0xd2')]=_0x19f0ca[_0x5861('0xcd')][_0x5861('0xd2')];}if(_0x19f0ca[_0x5861('0xcd')][_0x5861('0xd3')]){_0x1d8917[_0x5861('0xd4')]={'user':_0x19f0ca[_0x5861('0xcd')]['user'],'pass':_0x19f0ca[_0x5861('0xcd')][_0x5861('0xd5')]};}return respondWithRpcPromise(_0x5861('0xd6'),_0x5861('0xd7'),{'account':_0x1d8917,'message':{'from':util['format'](_0x5861('0xd8'),_0x19f0ca['name'],_0x19f0ca[_0x5861('0xd9')]||_0x19f0ca['Smtp']['user']),'to':_0x4ace2e[_0x5861('0xce')],'subject':_0x4ace2e['offlineMessageSubject'],'text':_0x12b298[_0x5861('0x5c')]}},client9003)[_0x5861('0x1d')](function(){return _0x12b298;})[_0x5861('0x28')](function(_0x53e3e2){console[_0x5861('0x23')](_0x53e3e2);});}})[_0x5861('0x1d')](function(){if(_0x12b298){return _0x12b298;}})['then'](respondWithResult(_0x3ca65d,null))[_0x5861('0x28')](handleError(_0x3ca65d,null));};exports[_0x5861('0xda')]=function(_0x25de71,_0x5afa5a,_0x1a8b72){return db[_0x5861('0xab')][_0x5861('0x5a')]({'where':{'id':_0x25de71[_0x5861('0x57')]['id']}})['then'](handleEntityNotFound(_0x5afa5a,null))[_0x5861('0x1d')](function(_0x2c8de4){if(_0x2c8de4){return _0x2c8de4['addInteraction'](_0x25de71[_0x5861('0x5c')][_0x5861('0xdb')],_[_0x5861('0xdc')](_0x25de71['body'],[_0x5861('0xdb'),'id'])||{});}})[_0x5861('0x1d')](respondWithResult(_0x5afa5a,null))[_0x5861('0x28')](handleError(_0x5afa5a,null));};exports[_0x5861('0xdd')]=function(_0x3f2ea9,_0x4c0857,_0x16ab1a){var _0x49c4bc={'raw':![],'where':{}};var _0x1f7da0={};var _0x2c8f0c={'count':0x0,'rows':[]};return db[_0x5861('0x3c')][_0x5861('0x65')]({'where':{'id':_0x3f2ea9[_0x5861('0x57')]['id']}})[_0x5861('0x1d')](handleEntityNotFound(_0x4c0857,null))[_0x5861('0x1d')](function(_0x2ac6bd){if(_0x2ac6bd){_0x1f7da0[_0x5861('0x3d')]=_[_0x5861('0x3e')](db[_0x5861('0xab')][_0x5861('0x58')]);_0x1f7da0[_0x5861('0x3f')]=_[_0x5861('0x3e')](_0x3f2ea9[_0x5861('0x3f')]);_0x1f7da0['filters']=_[_0x5861('0x41')](_0x1f7da0[_0x5861('0x3d')],_0x1f7da0[_0x5861('0x3f')]);_0x49c4bc['attributes']=_['intersection'](_0x1f7da0['model'],qs[_0x5861('0x43')](_0x3f2ea9[_0x5861('0x3f')]['fields']));_0x49c4bc[_0x5861('0x42')]=_0x49c4bc[_0x5861('0x42')][_0x5861('0x59')]?_0x49c4bc[_0x5861('0x42')]:_0x1f7da0[_0x5861('0x3d')];if(!_0x3f2ea9[_0x5861('0x3f')][_0x5861('0x44')](_0x5861('0x45'))){_0x49c4bc[_0x5861('0x2d')]=qs[_0x5861('0x2d')](_0x3f2ea9['query'][_0x5861('0x2d')]);_0x49c4bc[_0x5861('0x2c')]=qs[_0x5861('0x2c')](_0x3f2ea9[_0x5861('0x3f')][_0x5861('0x2c')]);}_0x49c4bc[_0x5861('0x46')]=qs['sort'](_0x3f2ea9[_0x5861('0x3f')][_0x5861('0x47')]);_0x49c4bc['where']=qs[_0x5861('0x40')](_['pick'](_0x3f2ea9[_0x5861('0x3f')],_0x1f7da0['filters']));_0x49c4bc[_0x5861('0x48')][_0x5861('0x63')]=_0x2ac6bd['id'];if(_0x3f2ea9[_0x5861('0x3f')][_0x5861('0x4a')]){_0x49c4bc['where']=_[_0x5861('0x4b')](_0x49c4bc[_0x5861('0x48')],{'$or':_[_0x5861('0x4c')](_0x49c4bc['attributes'],function(_0x563e60){var _0x430feb={};_0x430feb[_0x563e60]={'$like':'%'+_0x3f2ea9[_0x5861('0x3f')]['filter']+'%'};return _0x430feb;})});}_0x49c4bc=_['merge']({},_0x49c4bc,_0x3f2ea9[_0x5861('0x51')]);return db[_0x5861('0xab')][_0x5861('0x52')]({'where':_0x49c4bc[_0x5861('0x48')]})['then'](function(_0x5a4c56){_0x2c8f0c['count']=_0x5a4c56;if(_0x3f2ea9[_0x5861('0x3f')][_0x5861('0x67')]){_0x49c4bc['include']=[{'model':db[_0x5861('0x8a')],'as':'Contact','required':![]},{'model':db[_0x5861('0xb8')],'as':_0x5861('0xde'),'attributes':['name',_0x5861('0xdf'),'internal'],'required':![]},{'model':db[_0x5861('0xe0')],'as':_0x5861('0xe1'),'attributes':['id',_0x5861('0x38'),_0x5861('0xe2')],'where':_0x3f2ea9[_0x5861('0x3f')][_0x5861('0xe3')]?{'id':_0x3f2ea9[_0x5861('0x3f')][_0x5861('0xe3')]}:undefined,'required':_0x3f2ea9['query']['tag']?!![]:![]}];}return db[_0x5861('0xab')]['findAll'](_0x49c4bc);})['then'](function(_0x16d57b){_0x2c8f0c[_0x5861('0x55')]=_0x16d57b;return _0x2c8f0c;});}})[_0x5861('0x1d')](respondWithFilteredResult(_0x4c0857,_0x49c4bc))[_0x5861('0x28')](handleError(_0x4c0857,null));};function iftimePromise(_0x39bb73,_0x1a971f){return respondWithRpcPromise(_0x5861('0xe4'),'getSnippet',{'command':_0x1a971f[_0x5861('0xe5')]?util[_0x5861('0xa5')](_0x5861('0xe6'),_0x39bb73[_0x5861('0xe7')],_0x1a971f[_0x5861('0xe5')]):util['format']('iftime\x20%s',_0x39bb73[_0x5861('0xe7')])},client9002)['then'](function(_0x3a4843){var _0x3b5733=_0x3a4843&&_0x3a4843[_0x5861('0xe8')](_0x5861('0xe9'))>=0x0?!![]:![];logger[_0x5861('0x26')](_0x5861('0xea'),_0x1a971f['id'],_0x39bb73['id'],_0x39bb73[_0x5861('0xe7')],_0x3b5733?_0x5861('0xeb'):'OFFLINE',_0x1a971f[_0x5861('0xe5')]?_0x1a971f[_0x5861('0xe5')]:'No\x20timezone');return _0x3b5733;})[_0x5861('0x28')](function(_0x119020){logger['error'](_0x5861('0xea'),_0x1a971f['id'],_0x39bb73['id'],_0x39bb73[_0x5861('0xe7')],util[_0x5861('0xec')](_0x119020,{'showHidden':![],'depth':null}),_0x1a971f[_0x5861('0xe5')]?_0x1a971f[_0x5861('0xe5')]:_0x5861('0xed'));return![];});}exports[_0x5861('0xee')]=function(_0x23b255,_0x10d93f,_0x96a849){var _0x43550e=0x0;var _0x469d46=0x0;var _0x58e56a=![];var _0x4d066d;var _0x46c2e0;return db[_0x5861('0x3c')][_0x5861('0x5a')]({'where':{'id':_0x23b255[_0x5861('0x57')]['id']},'include':[{'model':db[_0x5861('0xef')],'as':_0x5861('0xef'),'include':[{'model':db[_0x5861('0xef')],'as':'Intervals','attributes':['id',_0x5861('0xe7')],'raw':!![]}]}]})[_0x5861('0x1d')](handleEntityNotFound(_0x10d93f,null))['then'](function(_0x242038){if(_0x242038){_0x4d066d=_0x242038;return _0x242038[_0x5861('0xf0')]({'raw':!![]});}})[_0x5861('0x1d')](function(_0x341939){if(_0x4d066d){if(_0x341939){_0x46c2e0=_0x341939;}}return require(_0x5861('0x7a'))['getLicense']();})[_0x5861('0x1d')](function(_0x4f4dce){if(_0x4f4dce){_0x469d46=_0x4f4dce[_0x5861('0xf1')];_0x58e56a=_0x4f4dce[_0x5861('0x7c')];}})[_0x5861('0x1d')](function(){return db[_0x5861('0xab')][_0x5861('0x52')]({'where':{'closed':![]}});})[_0x5861('0x1d')](function(_0x353531){_0x43550e=_0x353531;if(_0x469d46&&_0x353531>_0x469d46){return db[_0x5861('0xf2')][_0x5861('0x65')]({'where':{'id':0x1}})[_0x5861('0x1d')](function(_0x1f7c46){if(_0x1f7c46){_0x1f7c46[_0x5861('0xf3')](_0x5861('0xf4'));}});}})[_0x5861('0x1d')](function(){if(_0x4d066d['Interval']&&_0x4d066d[_0x5861('0xef')][_0x5861('0xf5')]){var _0x44d577=[];for(var _0x3a9edf=0x0;_0x3a9edf<_0x4d066d[_0x5861('0xef')][_0x5861('0xf5')][_0x5861('0x59')];_0x3a9edf++){var _0x5073fa=_0x4d066d[_0x5861('0xef')]['Intervals'][_0x3a9edf][_0x5861('0x34')]({'plain':!![]});_0x44d577['push'](iftimePromise(_0x5073fa,_0x4d066d));}return BPromise[_0x5861('0xf6')](_0x44d577)['then'](function(_0x5d367b){return _[_0x5861('0xf7')](_0x5d367b);});}else{return!![];}})[_0x5861('0x1d')](function(_0x1d1eab){var _0x31abe5=fs[_0x5861('0xc6')](path['join'](config[_0x5861('0x77')],_0x5861('0xf8')),_0x5861('0xf9'));var _0x4966fa={'remote':_0x4d066d[_0x5861('0xfa')],'query':querystring[_0x5861('0x22')](_[_0x5861('0x4b')](_0x4d066d['get']({'plain':!![]}),{'customerIp':_0x23b255[_0x5861('0xfb')][_0x5861('0xfc')]||_0x23b255['headers'][_0x5861('0xfd')]||_0x23b255['connection'][_0x5861('0xfe')]||_0x23b255['ip'],'referer':_0x23b255['headers'][_0x5861('0xa1')],'openedInteractions':_0x43550e,'maxInteractions':_0x469d46,'virtual':_0x58e56a['virtual'],'online':_0x1d1eab,'custom':_0x58e56a}))[_0x5861('0xff')](/'/g,'\x5c\x27')};_0x10d93f[_0x5861('0xc1')](ejs[_0x5861('0xc8')](Mustache[_0x5861('0xc8')](_0x31abe5,_0x4966fa),{'proactiveActions':_0x46c2e0,'alignment':_0x4d066d[_0x5861('0x100')],'verticalAlignment':_0x4d066d[_0x5861('0x101')]}));})['catch'](handleError(_0x10d93f,null));};exports[_0x5861('0x102')]=function(_0x1c2421,_0x3455df,_0x166006){return db[_0x5861('0x3c')][_0x5861('0x65')]({'where':{'id':_0x1c2421[_0x5861('0x57')]['id']}})[_0x5861('0x1d')](handleEntityNotFound(_0x3455df,null))[_0x5861('0x1d')](function(_0x3a380f){if(_0x3a380f){return db['sequelize'][_0x5861('0x103')](function(_0xe2aef0){return db[_0x5861('0x104')]['destroy']({'where':{'ChatWebsiteId':_0x1c2421[_0x5861('0x57')]['id']},'transaction':_0xe2aef0})[_0x5861('0x1d')](function(_0x55ff08){var _0x34acb5=_[_0x5861('0x4c')](_0x1c2421[_0x5861('0x5c')],function(_0x5278b7){_0x5278b7[_0x5861('0x63')]=_0x1c2421[_0x5861('0x57')]['id'];return _0x5278b7;});return db[_0x5861('0x104')]['bulkCreate'](_0x34acb5,{'transaction':_0xe2aef0});});})[_0x5861('0x1d')](function(){return db['ChatApplication'][_0x5861('0x105')]({'where':{'ChatWebsiteId':_0x1c2421[_0x5861('0x57')]['id']},'order':_0x5861('0x9a')});});}})['then'](respondWithResult(_0x3455df,null))['catch'](handleError(_0x3455df,null));};exports[_0x5861('0x106')]=function(_0x4fa31a,_0x4461a7,_0x29720e){var _0x3c031e={};var _0x1e822e={};var _0x477414;var _0x4e1202;return db[_0x5861('0x3c')][_0x5861('0x65')]({'where':{'id':_0x4fa31a[_0x5861('0x57')]['id']}})[_0x5861('0x1d')](handleEntityNotFound(_0x4461a7,null))[_0x5861('0x1d')](function(_0x5d8728){if(_0x5d8728){_0x477414=_0x5d8728;_0x1e822e[_0x5861('0x3d')]=_['keys'](db[_0x5861('0x104')][_0x5861('0x58')]);_0x1e822e['query']=_[_0x5861('0x3e')](_0x4fa31a['query']);_0x1e822e[_0x5861('0x40')]=_[_0x5861('0x41')](_0x1e822e[_0x5861('0x3d')],_0x1e822e[_0x5861('0x3f')]);_0x3c031e[_0x5861('0x42')]=_['intersection'](_0x1e822e[_0x5861('0x3d')],qs[_0x5861('0x43')](_0x4fa31a['query'][_0x5861('0x43')]));_0x3c031e[_0x5861('0x42')]=_0x3c031e[_0x5861('0x42')][_0x5861('0x59')]?_0x3c031e[_0x5861('0x42')]:_0x1e822e[_0x5861('0x3d')];_0x3c031e[_0x5861('0x46')]=qs['sort'](_0x4fa31a[_0x5861('0x3f')][_0x5861('0x47')]);_0x3c031e[_0x5861('0x48')]=qs[_0x5861('0x40')](_[_0x5861('0x49')](_0x4fa31a['query'],_0x1e822e[_0x5861('0x40')]));if(_0x4fa31a['query'][_0x5861('0x4a')]){_0x3c031e['where']=_['merge'](_0x3c031e[_0x5861('0x48')],{'$or':_[_0x5861('0x4c')](_0x3c031e[_0x5861('0x42')],function(_0x3f4387){var _0xb6ff34={};_0xb6ff34[_0x3f4387]={'$like':'%'+_0x4fa31a[_0x5861('0x3f')][_0x5861('0x4a')]+'%'};return _0xb6ff34;})});}_0x3c031e=_[_0x5861('0x4b')]({},_0x3c031e,_0x4fa31a['options']);return _0x477414['getApplications'](_0x3c031e);}})[_0x5861('0x1d')](function(_0x2ef36c){if(_0x2ef36c){_0x4e1202=_0x2ef36c['length'];if(!_0x4fa31a[_0x5861('0x3f')][_0x5861('0x44')]('nolimit')){_0x3c031e[_0x5861('0x2d')]=qs[_0x5861('0x2d')](_0x4fa31a[_0x5861('0x3f')][_0x5861('0x2d')]);_0x3c031e['offset']=qs[_0x5861('0x2c')](_0x4fa31a[_0x5861('0x3f')][_0x5861('0x2c')]);}return _0x477414[_0x5861('0x106')](_0x3c031e);}})['then'](function(_0x5cac5c){if(_0x5cac5c){return _0x5cac5c?{'count':_0x4e1202,'rows':_0x5cac5c}:null;}})['then'](respondWithResult(_0x4461a7,null))[_0x5861('0x28')](handleError(_0x4461a7,null));};exports[_0x5861('0x107')]=function(_0x5c20b5,_0x459828,_0x32a274){return db['chatProactiveAction']['find']({'where':{'id':_0x5c20b5['params']['id']}})['then'](handleEntityNotFound(_0x459828,null))[_0x5861('0x1d')](function(_0x474a35){if(_0x474a35){return _0x474a35[_0x5861('0x107')](_0x5c20b5[_0x5861('0x5c')][_0x5861('0xdb')],_[_0x5861('0xdc')](_0x5c20b5['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x459828,null))[_0x5861('0x28')](handleError(_0x459828,null));};exports[_0x5861('0xf0')]=function(_0x51b871,_0x3995e8,_0xed2ea4){var _0xae5c36={};var _0x2f65b7={};var _0x138821;var _0x4a176a;return db[_0x5861('0x3c')][_0x5861('0x65')]({'where':{'id':_0x51b871[_0x5861('0x57')]['id']}})['then'](handleEntityNotFound(_0x3995e8,null))[_0x5861('0x1d')](function(_0x41407c){if(_0x41407c){_0x138821=_0x41407c;_0x2f65b7['model']=_['keys'](db[_0x5861('0x108')][_0x5861('0x58')]);_0x2f65b7[_0x5861('0x3f')]=_['keys'](_0x51b871[_0x5861('0x3f')]);_0x2f65b7['filters']=_[_0x5861('0x41')](_0x2f65b7[_0x5861('0x3d')],_0x2f65b7[_0x5861('0x3f')]);_0xae5c36[_0x5861('0x42')]=_['intersection'](_0x2f65b7[_0x5861('0x3d')],qs[_0x5861('0x43')](_0x51b871[_0x5861('0x3f')][_0x5861('0x43')]));_0xae5c36[_0x5861('0x42')]=_0xae5c36[_0x5861('0x42')][_0x5861('0x59')]?_0xae5c36[_0x5861('0x42')]:_0x2f65b7[_0x5861('0x3d')];_0xae5c36[_0x5861('0x46')]=qs['sort'](_0x51b871['query'][_0x5861('0x47')]);_0xae5c36[_0x5861('0x48')]=qs['filters'](_[_0x5861('0x49')](_0x51b871[_0x5861('0x3f')],_0x2f65b7[_0x5861('0x40')]));if(_0x51b871[_0x5861('0x3f')][_0x5861('0x4a')]){_0xae5c36['where']=_[_0x5861('0x4b')](_0xae5c36[_0x5861('0x48')],{'$or':_[_0x5861('0x4c')](_0xae5c36['attributes'],function(_0x419e6b){var _0x1f57c3={};_0x1f57c3[_0x419e6b]={'$like':'%'+_0x51b871['query'][_0x5861('0x4a')]+'%'};return _0x1f57c3;})});}_0xae5c36=_[_0x5861('0x4b')]({},_0xae5c36,_0x51b871[_0x5861('0x51')]);return _0x138821[_0x5861('0xf0')](_0xae5c36);}})['then'](function(_0x3ba86a){if(_0x3ba86a){_0x4a176a=_0x3ba86a[_0x5861('0x59')];if(!_0x51b871[_0x5861('0x3f')][_0x5861('0x44')]('nolimit')){_0xae5c36['limit']=qs[_0x5861('0x2d')](_0x51b871[_0x5861('0x3f')]['limit']);_0xae5c36[_0x5861('0x2c')]=qs[_0x5861('0x2c')](_0x51b871[_0x5861('0x3f')][_0x5861('0x2c')]);}return _0x138821[_0x5861('0xf0')](_0xae5c36);}})[_0x5861('0x1d')](function(_0x25de6d){if(_0x25de6d){return _0x25de6d?{'count':_0x4a176a,'rows':_0x25de6d}:null;}})['then'](respondWithResult(_0x3995e8,null))[_0x5861('0x28')](handleError(_0x3995e8,null));};exports[_0x5861('0x109')]=function(_0x176c28,_0x25cdea,_0x3560c6){var _0x49dad6=_0x176c28[_0x5861('0x3f')][_0x5861('0x10a')]==='false'?_0x5861('0x10b'):_0x5861('0x10c');return db[_0x5861('0x3c')]['find']({'attributes':['id',_0x49dad6],'where':{'id':_0x176c28['params']['id']}})[_0x5861('0x1d')](handleEntityNotFound(_0x25cdea,null))[_0x5861('0x1d')](function(_0x237a6f){if(_0x237a6f){var _0x21f2fb=_0x237a6f[_0x49dad6];var _0x1e7ce3=_0x21f2fb&&_0x21f2fb['items']?_0x21f2fb[_0x5861('0x10d')]:[];_0x25cdea[_0x5861('0xc1')]({'fromKey':_[_0x5861('0x7d')](_0x21f2fb[_0x5861('0x10e')])?undefined:_0x21f2fb['fromKey'],'count':_0x1e7ce3[_0x5861('0x59')],'rows':_0x1e7ce3});}})[_0x5861('0x28')](handleError(_0x25cdea,null));};exports['getOfflineMessages']=function(_0x4f8c39,_0x426086,_0x482dd7){var _0x451494={'raw':!![],'where':{}};var _0x24bee0={};var _0x4cfc1a={'count':0x0,'rows':[]};return db[_0x5861('0x3c')]['findOne']({'where':{'id':_0x4f8c39['params']['id']}})[_0x5861('0x1d')](handleEntityNotFound(_0x426086,null))[_0x5861('0x1d')](function(_0x1f6e6c){if(_0x1f6e6c){_0x24bee0[_0x5861('0x3d')]=_[_0x5861('0x3e')](db[_0x5861('0x10f')][_0x5861('0x58')]);_0x24bee0[_0x5861('0x3f')]=_[_0x5861('0x3e')](_0x4f8c39[_0x5861('0x3f')]);_0x24bee0[_0x5861('0x40')]=_[_0x5861('0x41')](_0x24bee0[_0x5861('0x3d')],_0x24bee0[_0x5861('0x3f')]);_0x451494[_0x5861('0x42')]=_[_0x5861('0x41')](_0x24bee0['model'],qs['fields'](_0x4f8c39[_0x5861('0x3f')][_0x5861('0x43')]));_0x451494[_0x5861('0x42')]=_0x451494[_0x5861('0x42')][_0x5861('0x59')]?_0x451494[_0x5861('0x42')]:_0x24bee0['model'];if(!_0x4f8c39[_0x5861('0x3f')]['hasOwnProperty'](_0x5861('0x45'))){_0x451494['limit']=qs[_0x5861('0x2d')](_0x4f8c39[_0x5861('0x3f')][_0x5861('0x2d')]);_0x451494[_0x5861('0x2c')]=qs[_0x5861('0x2c')](_0x4f8c39['query']['offset']);}_0x451494[_0x5861('0x46')]=qs[_0x5861('0x47')](_0x4f8c39[_0x5861('0x3f')]['sort']);_0x451494['where']=qs[_0x5861('0x40')](_[_0x5861('0x49')](_0x4f8c39['query'],_0x24bee0[_0x5861('0x40')]));_0x451494[_0x5861('0x48')][_0x5861('0x63')]=_0x1f6e6c['id'];if(_0x4f8c39[_0x5861('0x3f')]['filter']){_0x451494['where']=_[_0x5861('0x4b')](_0x451494[_0x5861('0x48')],{'$or':_['map'](_0x451494['attributes'],function(_0x1df1a0){var _0x5a2de7={};_0x5a2de7[_0x1df1a0]={'$like':'%'+_0x4f8c39[_0x5861('0x3f')][_0x5861('0x4a')]+'%'};return _0x5a2de7;})});}_0x451494=_[_0x5861('0x4b')]({},_0x451494,_0x4f8c39[_0x5861('0x51')]);return db['ChatOfflineMessage'][_0x5861('0x52')]({'where':_0x451494[_0x5861('0x48')]})[_0x5861('0x1d')](function(_0x2b7d1f){_0x4cfc1a['count']=_0x2b7d1f;if(_0x4f8c39[_0x5861('0x3f')][_0x5861('0x67')]){_0x451494['include']=[{'all':!![]}];}return db['ChatOfflineMessage'][_0x5861('0x54')](_0x451494);})[_0x5861('0x1d')](function(_0x1cb8cd){_0x4cfc1a['rows']=_0x1cb8cd;return _0x4cfc1a;});}})[_0x5861('0x1d')](respondWithFilteredResult(_0x426086,_0x451494))['catch'](handleError(_0x426086,null));};exports[_0x5861('0x110')]=function(_0x14c1ac,_0xf4e5d8,_0x14f84a){return db['ChatWebsite'][_0x5861('0x5a')]({'where':{'id':_0x14c1ac['params']['id']}})[_0x5861('0x1d')](handleEntityNotFound(_0xf4e5d8,null))[_0x5861('0x1d')](function(_0x3987a0){if(_0x3987a0){return _0x3987a0[_0x5861('0x110')](_0x14c1ac[_0x5861('0x5c')][_0x5861('0xdb')],_[_0x5861('0xdc')](_0x14c1ac['body'],[_0x5861('0xdb'),'id'])||{})['spread'](function(_0x2b485e){for(var _0x4437ca=0x0;_0x4437ca<_0x14c1ac[_0x5861('0x5c')][_0x5861('0xdb')]['length'];_0x4437ca+=0x1){socket[_0x5861('0x111')](_0x5861('0x112'),{'UserId':_0x14c1ac[_0x5861('0x5c')][_0x5861('0xdb')][_0x4437ca],'ChatWebsiteId':_0x14c1ac['params']['id']});}return _0x2b485e;});}})[_0x5861('0x1d')](respondWithResult(_0xf4e5d8,null))['catch'](handleError(_0xf4e5d8,null));};exports[_0x5861('0x113')]=function(_0x3eb523,_0x2fc9b0,_0xc2ec6e){var _0x4d7bf0;return db[_0x5861('0x3c')][_0x5861('0x5a')]({'where':{'id':_0x3eb523['params']['id']}})[_0x5861('0x1d')](handleEntityNotFound(_0x2fc9b0,null))[_0x5861('0x1d')](function(_0x2365c0){if(_0x2365c0){return _0x2365c0['removeAgents'](_0x3eb523['query'][_0x5861('0xdb')])[_0x5861('0x1d')](function(_0x50273b){if(_[_0x5861('0x114')](_0x3eb523[_0x5861('0x3f')][_0x5861('0xdb')])){for(var _0x1af61f=0x0;_0x1af61f<_0x3eb523[_0x5861('0x3f')][_0x5861('0xdb')][_0x5861('0x59')];_0x1af61f+=0x1){socket[_0x5861('0x111')](_0x5861('0x115'),{'UserId':_0x3eb523[_0x5861('0x3f')][_0x5861('0xdb')][_0x1af61f],'ChatWebsiteId':_0x3eb523[_0x5861('0x57')]['id']});}}else{socket['emit'](_0x5861('0x115'),{'UserId':_0x3eb523[_0x5861('0x3f')][_0x5861('0xdb')],'ChatWebsiteId':_0x3eb523[_0x5861('0x57')]['id']});}});}})[_0x5861('0x1d')](respondWithStatusCode(_0x2fc9b0,null))[_0x5861('0x28')](handleError(_0x2fc9b0,null));};exports[_0x5861('0x116')]=function(_0x52b097,_0x345797,_0x189cdc){var _0x119f36={};var _0xc70f34={};var _0x2e7510;var _0x5b18e2;return db[_0x5861('0x3c')]['findOne']({'where':{'id':_0x52b097[_0x5861('0x57')]['id']}})[_0x5861('0x1d')](handleEntityNotFound(_0x345797,null))[_0x5861('0x1d')](function(_0x89f75e){if(_0x89f75e){_0x2e7510=_0x89f75e;_0xc70f34[_0x5861('0x3d')]=_[_0x5861('0x3e')](db['User'][_0x5861('0x58')]);_0xc70f34[_0x5861('0x3f')]=_[_0x5861('0x3e')](_0x52b097[_0x5861('0x3f')]);_0xc70f34[_0x5861('0x40')]=_[_0x5861('0x41')](_0xc70f34[_0x5861('0x3d')],_0xc70f34['query']);_0x119f36[_0x5861('0x42')]=_[_0x5861('0x41')](_0xc70f34[_0x5861('0x3d')],qs[_0x5861('0x43')](_0x52b097[_0x5861('0x3f')]['fields']));_0x119f36['attributes']=_0x119f36[_0x5861('0x42')][_0x5861('0x59')]?_0x119f36[_0x5861('0x42')]:_0xc70f34[_0x5861('0x3d')];_0x119f36[_0x5861('0x46')]=qs[_0x5861('0x47')](_0x52b097[_0x5861('0x3f')][_0x5861('0x47')]);_0x119f36[_0x5861('0x48')]=qs[_0x5861('0x40')](_[_0x5861('0x49')](_0x52b097[_0x5861('0x3f')],_0xc70f34['filters']));if(_0x52b097['query']['filter']){_0x119f36[_0x5861('0x48')]=_['merge'](_0x119f36[_0x5861('0x48')],{'$or':_[_0x5861('0x4c')](_0x119f36[_0x5861('0x42')],function(_0x6b0308){var _0x293559={};_0x293559[_0x6b0308]={'$like':'%'+_0x52b097[_0x5861('0x3f')]['filter']+'%'};return _0x293559;})});}_0x119f36=_[_0x5861('0x4b')]({},_0x119f36,_0x52b097[_0x5861('0x51')]);return _0x2e7510[_0x5861('0x116')](_0x119f36);}})['then'](function(_0xac4342){if(_0xac4342){_0x5b18e2=_0xac4342['length'];if(!_0x52b097['query'][_0x5861('0x44')](_0x5861('0x45'))){_0x119f36[_0x5861('0x2d')]=qs[_0x5861('0x2d')](_0x52b097[_0x5861('0x3f')]['limit']);_0x119f36[_0x5861('0x2c')]=qs[_0x5861('0x2c')](_0x52b097[_0x5861('0x3f')]['offset']);}return _0x2e7510[_0x5861('0x116')](_0x119f36);}})[_0x5861('0x1d')](function(_0xe22c80){if(_0xe22c80){return _0xe22c80?{'count':_0x5b18e2,'rows':_0xe22c80}:null;}})[_0x5861('0x1d')](respondWithResult(_0x345797,null))['catch'](handleError(_0x345797,null));};
\ No newline at end of file
+var _0x01f4=['include','catch','show','Pause','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','update','params','describe','addDisposition','Disposition','getDispositions','findOne','pick','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','ChatWebsiteId','rows','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.png','getLicense','custom','isNil','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/','showCustomerAvatar','download','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','headers','user-agent','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','ChatApplication','Applications','applications','list','account','firstName','lastName','customerIp','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','interaction','spread','contact','messageId','created','close','unmanaged','ChatMessage','AttachmentId','UserId','User','unshift','agent','Start','startRouting','EventManager','notify','createdAt','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','mapKeyOffline','findOrCreate','readFileSync','render','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','authentication','auth','user','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','interval','timezone','iftime\x20%s','indexOf','true','ONLINE','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','virtual','License','increment','chatLicenseExceeded','Intervals','all','some','utf8','remote','x-real-ip','connection','remoteAddress','replace','alignment','addApplications','sequelize','bulkCreate','findAndCountAll','priority','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','ChatWebsite,\x20%s,\x20%s','message','status','end','json','offset','set','save','ChatWebsites','UserProfileResource','destroy','sendStatus','stack','name','send','index','mandatoryDispositionPause','ChatWebsite','rawAttributes','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','map','type','key','field','merge','options','count','includeAll'];(function(_0x2e1897,_0x3edfd2){var _0x427ad6=function(_0x556d8b){while(--_0x556d8b){_0x2e1897['push'](_0x2e1897['shift']());}};_0x427ad6(++_0x3edfd2);}(_0x01f4,0xc2));var _0x401f=function(_0xd05ad4,_0x541d3d){_0xd05ad4=_0xd05ad4-0x0;var _0x2b3abb=_0x01f4[_0xd05ad4];return _0x2b3abb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x401f('0x0'));var rimraf=require(_0x401f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x401f('0x2'));var rp=require(_0x401f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x401f('0x4'));var util=require(_0x401f('0x5'));var path=require(_0x401f('0x6'));var sox=require(_0x401f('0x7'));var csv=require(_0x401f('0x8'));var ejs=require(_0x401f('0x9'));var fs=require('fs');var _=require(_0x401f('0xa'));var squel=require(_0x401f('0xb'));var crypto=require(_0x401f('0xc'));var jsforce=require(_0x401f('0xd'));var deskjs=require(_0x401f('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x401f('0xf'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x401f('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0x401f('0x11'))(_0x401f('0x12'));var utils=require(_0x401f('0x13'));var config=require(_0x401f('0x14'));var db=require(_0x401f('0x15'))['db'];config[_0x401f('0x16')]=_[_0x401f('0x17')](config[_0x401f('0x16')],{'host':_0x401f('0x18'),'port':0x18eb});var socket=require(_0x401f('0x19'))(new Redis(config[_0x401f('0x16')]));require(_0x401f('0x1a'))[_0x401f('0x1b')](socket);var jayson=require(_0x401f('0x1c'));var client=jayson[_0x401f('0x1d')][_0x401f('0x1e')]({'port':0x232c});var client9002=jayson[_0x401f('0x1d')][_0x401f('0x1e')]({'port':0x232a});var client9003=jayson[_0x401f('0x1d')][_0x401f('0x1e')]({'port':0x232b});function respondWithRpcPromise(_0x51cc59,_0x4a5e83,_0x555bad,_0x19360e){return new BPromise(function(_0xb60a17,_0x5ec11a){var _0xefb26e=_0x19360e||client;return _0xefb26e[_0x401f('0x1f')](_0x51cc59,_0x555bad)[_0x401f('0x20')](function(_0x331de0){logger[_0x401f('0x21')]('ChatWebsite,\x20%s,\x20%s',_0x4a5e83,_0x401f('0x22'));logger[_0x401f('0x23')](_0x401f('0x24'),_0x4a5e83,_0x401f('0x22'),JSON[_0x401f('0x25')](_0x331de0));if(_0x331de0[_0x401f('0x26')]){if(_0x331de0['error']['code']===0x1f4){logger['error'](_0x401f('0x27'),_0x4a5e83,_0x331de0[_0x401f('0x26')][_0x401f('0x28')]);return _0x5ec11a(_0x331de0[_0x401f('0x26')][_0x401f('0x28')]);}logger[_0x401f('0x26')]('ChatWebsite,\x20%s,\x20%s',_0x4a5e83,_0x331de0[_0x401f('0x26')][_0x401f('0x28')]);return _0xb60a17(_0x331de0[_0x401f('0x26')]['message']);}else{logger[_0x401f('0x21')](_0x401f('0x27'),_0x4a5e83,_0x401f('0x22'));_0xb60a17(_0x331de0['result'][_0x401f('0x28')]);}})['catch'](function(_0x3e8c21){logger[_0x401f('0x26')](_0x401f('0x27'),_0x4a5e83,_0x3e8c21);_0x5ec11a(_0x3e8c21);});});}function respondWithStatusCode(_0x48ae97,_0x1a7dad){_0x1a7dad=_0x1a7dad||0xcc;return function(_0x213529){if(_0x213529){return _0x48ae97['sendStatus'](_0x1a7dad);}return _0x48ae97[_0x401f('0x29')](_0x1a7dad)[_0x401f('0x2a')]();};}function respondWithResult(_0x1ed95b,_0x3d300a){_0x3d300a=_0x3d300a||0xc8;return function(_0x10ac14){if(_0x10ac14){return _0x1ed95b[_0x401f('0x29')](_0x3d300a)[_0x401f('0x2b')](_0x10ac14);}};}function respondWithFilteredResult(_0x432702,_0x472aac){return function(_0x86c4f){if(_0x86c4f){var _0x3b9fbf=_0x86c4f['count'],_0x4b03e1=_0x472aac[_0x401f('0x2c')],_0xecef19=_0x472aac[_0x401f('0x2c')]+_0x472aac['limit'],_0x29ec39;if(_0xecef19>=_0x3b9fbf){_0xecef19=_0x3b9fbf;_0x29ec39=0xc8;}else{_0x29ec39=0xce;}_0x432702[_0x401f('0x29')](_0x29ec39);return _0x432702[_0x401f('0x2d')]('Content-Range',_0x4b03e1+'-'+_0xecef19+'/'+_0x3b9fbf)['json'](_0x86c4f);}return null;};}function patchUpdates(_0x4fb0b1){return function(_0x51f2c0){try{jsonpatch['apply'](_0x51f2c0,_0x4fb0b1,!![]);}catch(_0x2baba9){return BPromise['reject'](_0x2baba9);}return _0x51f2c0[_0x401f('0x2e')]();};}function saveUpdates(_0x2f03f2,_0x91ed72){return function(_0x4f5972){if(_0x4f5972){return _0x4f5972['update'](_0x2f03f2)[_0x401f('0x20')](function(_0x348e6e){return _0x348e6e;});}return null;};}function removeEntity(_0x2f425e,_0x7bf88e){return function(_0x4bfa94){if(_0x4bfa94){return _0x4bfa94['destroy']()[_0x401f('0x20')](function(){var _0x21b318=_0x4bfa94['get']({'plain':!![]});var _0x11e08f=_0x401f('0x2f');return db[_0x401f('0x30')][_0x401f('0x31')]({'where':{'type':_0x11e08f,'resourceId':_0x21b318['id']}})['then'](function(){return _0x4bfa94;});})[_0x401f('0x20')](function(){_0x2f425e[_0x401f('0x29')](0xcc)[_0x401f('0x2a')]();});}};}function handleEntityNotFound(_0x80bec8,_0x2c16b2){return function(_0x44ed32){if(!_0x44ed32){_0x80bec8[_0x401f('0x32')](0x194);}return _0x44ed32;};}function handleError(_0x19cbfc,_0x2564af){_0x2564af=_0x2564af||0x1f4;return function(_0x48b11a){logger[_0x401f('0x26')](_0x48b11a[_0x401f('0x33')]);if(_0x48b11a[_0x401f('0x34')]){delete _0x48b11a[_0x401f('0x34')];}_0x19cbfc[_0x401f('0x29')](_0x2564af)[_0x401f('0x35')](_0x48b11a);};}exports[_0x401f('0x36')]=function(_0x53fe26,_0x1425fc){var _0x104fa3={'include':[{'model':db['Pause'],'as':_0x401f('0x37')}]},_0x567ef1={},_0x18d933={'count':0x0,'rows':[]};var _0x58fb52=db[_0x401f('0x38')][_0x401f('0x39')];_0x567ef1['model']=_[_0x401f('0x3a')](_0x58fb52);_0x567ef1[_0x401f('0x3b')]=_[_0x401f('0x3a')](_0x53fe26['query']);_0x567ef1[_0x401f('0x3c')]=_[_0x401f('0x3d')](_0x567ef1['model'],_0x567ef1[_0x401f('0x3b')]);_0x104fa3[_0x401f('0x3e')]=_[_0x401f('0x3d')](_0x567ef1[_0x401f('0x3f')],qs[_0x401f('0x40')](_0x53fe26['query'][_0x401f('0x40')]));_0x104fa3[_0x401f('0x3e')]=_0x104fa3[_0x401f('0x3e')][_0x401f('0x41')]?_0x104fa3[_0x401f('0x3e')]:_0x567ef1[_0x401f('0x3f')];if(!_0x53fe26[_0x401f('0x3b')][_0x401f('0x42')](_0x401f('0x43'))){_0x104fa3[_0x401f('0x44')]=qs['limit'](_0x53fe26['query'][_0x401f('0x44')]);_0x104fa3['offset']=qs[_0x401f('0x2c')](_0x53fe26[_0x401f('0x3b')][_0x401f('0x2c')]);}_0x104fa3[_0x401f('0x45')]=qs[_0x401f('0x46')](_0x53fe26[_0x401f('0x3b')]['sort']);_0x104fa3[_0x401f('0x47')]=qs[_0x401f('0x3c')](_['pick'](_0x53fe26['query'],_0x567ef1[_0x401f('0x3c')]));if(_0x53fe26[_0x401f('0x3b')][_0x401f('0x48')]){_0x104fa3[_0x401f('0x47')]=_['merge'](_0x104fa3[_0x401f('0x47')],{'$or':_[_0x401f('0x49')](_0x58fb52,function(_0x4e8fa5){if(_0x4e8fa5[_0x401f('0x4a')][_0x401f('0x4b')]!=='VIRTUAL'){var _0x5de672={};_0x5de672[_0x4e8fa5[_0x401f('0x4c')]]={'$like':'%'+_0x53fe26[_0x401f('0x3b')][_0x401f('0x48')]+'%'};return _0x5de672;}})});}_0x104fa3=_[_0x401f('0x4d')]({},_0x104fa3,_0x53fe26[_0x401f('0x4e')]);var _0x907d3c={'where':_0x104fa3['where']};return db['ChatWebsite'][_0x401f('0x4f')](_0x907d3c)[_0x401f('0x20')](function(_0x2802f3){_0x18d933[_0x401f('0x4f')]=_0x2802f3;if(_0x53fe26['query'][_0x401f('0x50')]){_0x104fa3[_0x401f('0x51')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x104fa3);})[_0x401f('0x20')](function(_0x13a7b3){_0x18d933['rows']=_0x13a7b3;return _0x18d933;})[_0x401f('0x20')](respondWithFilteredResult(_0x1425fc,_0x104fa3))[_0x401f('0x52')](handleError(_0x1425fc,null));};exports[_0x401f('0x53')]=function(_0xd9d59,_0xa448d){var _0x224684={'raw':![],'where':{'id':_0xd9d59['params']['id']},'include':[{'model':db[_0x401f('0x54')],'as':_0x401f('0x37')}]},_0x5edd09={};_0x5edd09[_0x401f('0x3f')]=_[_0x401f('0x3a')](db[_0x401f('0x38')]['rawAttributes']);_0x5edd09[_0x401f('0x3b')]=_['keys'](_0xd9d59[_0x401f('0x3b')]);_0x5edd09[_0x401f('0x3c')]=_[_0x401f('0x3d')](_0x5edd09[_0x401f('0x3f')],_0x5edd09[_0x401f('0x3b')]);_0x224684[_0x401f('0x3e')]=_['intersection'](_0x5edd09[_0x401f('0x3f')],qs[_0x401f('0x40')](_0xd9d59['query'][_0x401f('0x40')]));_0x224684[_0x401f('0x3e')]=_0x224684[_0x401f('0x3e')][_0x401f('0x41')]?_0x224684[_0x401f('0x3e')]:_0x5edd09['model'];if(_0xd9d59['query']['includeAll']){_0x224684[_0x401f('0x51')]=[{'all':!![]}];}_0x224684=_[_0x401f('0x4d')]({},_0x224684,_0xd9d59[_0x401f('0x4e')]);return db[_0x401f('0x38')][_0x401f('0x55')](_0x224684)[_0x401f('0x20')](handleEntityNotFound(_0xa448d,null))['then'](respondWithResult(_0xa448d,null))[_0x401f('0x52')](handleError(_0xa448d,null));};exports[_0x401f('0x56')]=function(_0x456ad3,_0x2bfe14){return db[_0x401f('0x38')][_0x401f('0x56')](_0x456ad3[_0x401f('0x57')],{})[_0x401f('0x20')](function(_0x31dfec){var _0x4de398=_0x456ad3['user'][_0x401f('0x58')]({'plain':!![]});if(!_0x4de398)throw new Error(_0x401f('0x59'));if(_0x4de398['role']==='user'){var _0x10956d=_0x31dfec['get']({'plain':!![]});var _0x1e02f0='ChatWebsites';return db['UserProfileSection'][_0x401f('0x55')]({'where':{'name':_0x1e02f0,'userProfileId':_0x4de398[_0x401f('0x5a')]},'raw':!![]})[_0x401f('0x20')](function(_0x395dc5){if(_0x395dc5&&_0x395dc5[_0x401f('0x5b')]===0x0){return db[_0x401f('0x30')]['create']({'name':_0x10956d['name'],'resourceId':_0x10956d['id'],'type':_0x395dc5[_0x401f('0x34')],'sectionId':_0x395dc5['id']},{})[_0x401f('0x20')](function(){return _0x31dfec;});}else{return _0x31dfec;}})[_0x401f('0x52')](function(_0xfe197){logger[_0x401f('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xfe197);throw _0xfe197;});}return _0x31dfec;})[_0x401f('0x20')](respondWithResult(_0x2bfe14,0xc9))[_0x401f('0x52')](handleError(_0x2bfe14,null));};exports[_0x401f('0x5c')]=function(_0x5eda22,_0xdeebc5){if(_0x5eda22[_0x401f('0x57')]['id']){delete _0x5eda22[_0x401f('0x57')]['id'];}return db[_0x401f('0x38')][_0x401f('0x55')]({'where':{'id':_0x5eda22[_0x401f('0x5d')]['id']},'include':[{'model':db[_0x401f('0x54')],'as':_0x401f('0x37')}]})['then'](handleEntityNotFound(_0xdeebc5,null))[_0x401f('0x20')](saveUpdates(_0x5eda22[_0x401f('0x57')],null))[_0x401f('0x20')](function(_0x391937){if(_0x391937&&_0x5eda22[_0x401f('0x57')][_0x401f('0x37')]){return db[_0x401f('0x54')][_0x401f('0x5c')](_0x5eda22['body'][_0x401f('0x37')],{'where':{'ChatWebsiteId':_0x391937['id']}})['then'](function(){return _0x391937;});}return _0x391937;})[_0x401f('0x20')](respondWithResult(_0xdeebc5,null))[_0x401f('0x52')](handleError(_0xdeebc5,null));};exports[_0x401f('0x31')]=function(_0xd91f54,_0x56033d){return db['ChatWebsite']['find']({'where':{'id':_0xd91f54[_0x401f('0x5d')]['id']}})[_0x401f('0x20')](handleEntityNotFound(_0x56033d,null))[_0x401f('0x20')](removeEntity(_0x56033d,null))[_0x401f('0x52')](handleError(_0x56033d,null));};exports[_0x401f('0x5e')]=function(_0x56cd39,_0x2f5f37){return db['ChatWebsite'][_0x401f('0x5e')]()[_0x401f('0x20')](respondWithResult(_0x2f5f37,null))[_0x401f('0x52')](handleError(_0x2f5f37,null));};exports[_0x401f('0x5f')]=function(_0x27eafd,_0xc2044f,_0x1a315c){if(_0x27eafd['body']['id']){delete _0x27eafd[_0x401f('0x57')]['id'];}return db[_0x401f('0x38')][_0x401f('0x55')]({'where':{'id':_0x27eafd[_0x401f('0x5d')]['id']}})[_0x401f('0x20')](handleEntityNotFound(_0xc2044f,null))['then'](function(_0x12af8c){if(_0x12af8c){_0x27eafd[_0x401f('0x57')]['ChatWebsiteId']=_0x12af8c['id'];return db[_0x401f('0x60')][_0x401f('0x56')](_0x27eafd[_0x401f('0x57')]);}})[_0x401f('0x20')](respondWithResult(_0xc2044f,null))[_0x401f('0x52')](handleError(_0xc2044f,null));};exports[_0x401f('0x61')]=function(_0x7055e0,_0x1f9fab,_0x24096a){var _0x20dbc1={'raw':![],'where':{}};var _0xc92c93={};var _0x883ff4={'count':0x0,'rows':[]};return db[_0x401f('0x38')][_0x401f('0x62')]({'where':{'id':_0x7055e0['params']['id']}})[_0x401f('0x20')](handleEntityNotFound(_0x1f9fab,null))[_0x401f('0x20')](function(_0x50b589){if(_0x50b589){_0xc92c93['model']=_[_0x401f('0x3a')](db['Disposition']['rawAttributes']);_0xc92c93['query']=_['keys'](_0x7055e0[_0x401f('0x3b')]);_0xc92c93[_0x401f('0x3c')]=_[_0x401f('0x3d')](_0xc92c93[_0x401f('0x3f')],_0xc92c93['query']);_0x20dbc1[_0x401f('0x3e')]=_[_0x401f('0x3d')](_0xc92c93[_0x401f('0x3f')],qs[_0x401f('0x40')](_0x7055e0[_0x401f('0x3b')][_0x401f('0x40')]));_0x20dbc1[_0x401f('0x3e')]=_0x20dbc1[_0x401f('0x3e')][_0x401f('0x41')]?_0x20dbc1[_0x401f('0x3e')]:_0xc92c93[_0x401f('0x3f')];if(!_0x7055e0['query']['hasOwnProperty']('nolimit')){_0x20dbc1[_0x401f('0x44')]=qs[_0x401f('0x44')](_0x7055e0[_0x401f('0x3b')][_0x401f('0x44')]);_0x20dbc1[_0x401f('0x2c')]=qs[_0x401f('0x2c')](_0x7055e0[_0x401f('0x3b')][_0x401f('0x2c')]);}_0x20dbc1[_0x401f('0x45')]=qs['sort'](_0x7055e0[_0x401f('0x3b')][_0x401f('0x46')]);_0x20dbc1[_0x401f('0x47')]=qs[_0x401f('0x3c')](_[_0x401f('0x63')](_0x7055e0[_0x401f('0x3b')],_0xc92c93[_0x401f('0x3c')]));_0x20dbc1[_0x401f('0x47')]['ChatWebsiteId']=_0x50b589['id'];if(_0x7055e0[_0x401f('0x3b')]['filter']){_0x20dbc1[_0x401f('0x47')]=_['merge'](_0x20dbc1[_0x401f('0x47')],{'$or':_[_0x401f('0x49')](_0x20dbc1[_0x401f('0x3e')],function(_0x57f51d){var _0x4afb73={};_0x4afb73[_0x57f51d]={'$like':'%'+_0x7055e0[_0x401f('0x3b')][_0x401f('0x48')]+'%'};return _0x4afb73;})});}_0x20dbc1=_['merge']({},_0x20dbc1,_0x7055e0[_0x401f('0x4e')]);return db[_0x401f('0x60')][_0x401f('0x4f')]({'where':_0x20dbc1[_0x401f('0x47')]})[_0x401f('0x20')](function(_0x7dc5e4){_0x883ff4[_0x401f('0x4f')]=_0x7dc5e4;if(_0x7055e0[_0x401f('0x3b')]['includeAll']){_0x20dbc1[_0x401f('0x51')]=[{'all':!![]}];}return db[_0x401f('0x60')][_0x401f('0x64')](_0x20dbc1);})[_0x401f('0x20')](function(_0x44ece2){_0x883ff4['rows']=_0x44ece2;return _0x883ff4;});}})[_0x401f('0x20')](respondWithFilteredResult(_0x1f9fab,_0x20dbc1))[_0x401f('0x52')](handleError(_0x1f9fab,null));};exports[_0x401f('0x65')]=function(_0x15685f,_0x19e972,_0x307483){var _0x48945c;return db[_0x401f('0x38')]['find']({'where':{'id':_0x15685f[_0x401f('0x5d')]['id']}})['then'](handleEntityNotFound(_0x19e972,null))[_0x401f('0x20')](function(_0x36bd82){if(_0x36bd82){return _0x36bd82[_0x401f('0x65')](_0x15685f['query'][_0x401f('0x66')]);}})[_0x401f('0x20')](respondWithStatusCode(_0x19e972,null))['catch'](handleError(_0x19e972,null));};exports[_0x401f('0x67')]=function(_0x2d8606,_0x275dde,_0x22deca){if(_0x2d8606[_0x401f('0x57')]['id']){delete _0x2d8606['body']['id'];}return db['ChatWebsite'][_0x401f('0x55')]({'where':{'id':_0x2d8606[_0x401f('0x5d')]['id']}})[_0x401f('0x20')](handleEntityNotFound(_0x275dde,null))['then'](function(_0x2c29cd){if(_0x2c29cd){_0x2d8606[_0x401f('0x57')]['ChatWebsiteId']=_0x2c29cd['id'];return db[_0x401f('0x68')][_0x401f('0x56')](_0x2d8606[_0x401f('0x57')]);}})[_0x401f('0x20')](respondWithResult(_0x275dde,null))[_0x401f('0x52')](handleError(_0x275dde,null));};exports[_0x401f('0x69')]=function(_0x5e7dc6,_0x2d3951,_0x1063a2){var _0x21df68={'raw':![],'where':{}};var _0x4481cc={};var _0x4e2f41={'count':0x0,'rows':[]};return db[_0x401f('0x38')][_0x401f('0x62')]({'where':{'id':_0x5e7dc6[_0x401f('0x5d')]['id']}})[_0x401f('0x20')](handleEntityNotFound(_0x2d3951,null))[_0x401f('0x20')](function(_0x5a99ce){if(_0x5a99ce){_0x4481cc[_0x401f('0x3f')]=_['keys'](db[_0x401f('0x68')][_0x401f('0x39')]);_0x4481cc[_0x401f('0x3b')]=_[_0x401f('0x3a')](_0x5e7dc6[_0x401f('0x3b')]);_0x4481cc[_0x401f('0x3c')]=_[_0x401f('0x3d')](_0x4481cc[_0x401f('0x3f')],_0x4481cc[_0x401f('0x3b')]);_0x21df68[_0x401f('0x3e')]=_[_0x401f('0x3d')](_0x4481cc[_0x401f('0x3f')],qs[_0x401f('0x40')](_0x5e7dc6[_0x401f('0x3b')][_0x401f('0x40')]));_0x21df68[_0x401f('0x3e')]=_0x21df68[_0x401f('0x3e')]['length']?_0x21df68[_0x401f('0x3e')]:_0x4481cc[_0x401f('0x3f')];if(!_0x5e7dc6[_0x401f('0x3b')][_0x401f('0x42')](_0x401f('0x43'))){_0x21df68[_0x401f('0x44')]=qs[_0x401f('0x44')](_0x5e7dc6['query'][_0x401f('0x44')]);_0x21df68[_0x401f('0x2c')]=qs['offset'](_0x5e7dc6['query'][_0x401f('0x2c')]);}_0x21df68[_0x401f('0x45')]=qs[_0x401f('0x46')](_0x5e7dc6[_0x401f('0x3b')][_0x401f('0x46')]);_0x21df68[_0x401f('0x47')]=qs['filters'](_[_0x401f('0x63')](_0x5e7dc6[_0x401f('0x3b')],_0x4481cc[_0x401f('0x3c')]));_0x21df68[_0x401f('0x47')][_0x401f('0x6a')]=_0x5a99ce['id'];if(_0x5e7dc6[_0x401f('0x3b')][_0x401f('0x48')]){_0x21df68[_0x401f('0x47')]=_['merge'](_0x21df68['where'],{'$or':_[_0x401f('0x49')](_0x21df68[_0x401f('0x3e')],function(_0x4b2eb8){var _0x1da0ea={};_0x1da0ea[_0x4b2eb8]={'$like':'%'+_0x5e7dc6[_0x401f('0x3b')][_0x401f('0x48')]+'%'};return _0x1da0ea;})});}_0x21df68=_[_0x401f('0x4d')]({},_0x21df68,_0x5e7dc6[_0x401f('0x4e')]);return db[_0x401f('0x68')][_0x401f('0x4f')]({'where':_0x21df68[_0x401f('0x47')]})[_0x401f('0x20')](function(_0x1bc843){_0x4e2f41[_0x401f('0x4f')]=_0x1bc843;if(_0x5e7dc6['query']['includeAll']){_0x21df68[_0x401f('0x51')]=[{'all':!![]}];}return db[_0x401f('0x68')]['findAll'](_0x21df68);})['then'](function(_0x25c452){_0x4e2f41[_0x401f('0x6b')]=_0x25c452;return _0x4e2f41;});}})[_0x401f('0x20')](respondWithFilteredResult(_0x2d3951,_0x21df68))[_0x401f('0x52')](handleError(_0x2d3951,null));};exports[_0x401f('0x6c')]=function(_0x4264a1,_0x594a7d,_0x5cbf15){var _0x521d7e;return db['ChatWebsite']['find']({'where':{'id':_0x4264a1[_0x401f('0x5d')]['id']}})[_0x401f('0x20')](handleEntityNotFound(_0x594a7d,null))[_0x401f('0x20')](function(_0x8da888){if(_0x8da888){return _0x8da888['removeAnswers'](_0x4264a1[_0x401f('0x3b')][_0x401f('0x66')]);}})[_0x401f('0x20')](respondWithStatusCode(_0x594a7d,null))[_0x401f('0x52')](handleError(_0x594a7d,null));};exports[_0x401f('0x6d')]=function(_0x231f20,_0x26c374,_0x1876bb){_0x231f20[_0x401f('0x57')][_0x401f('0x6e')]=_0x231f20[_0x401f('0x6f')][_0x401f('0x70')];return db[_0x401f('0x38')][_0x401f('0x55')]({'where':{'id':_0x231f20[_0x401f('0x5d')]['id']}})[_0x401f('0x20')](handleEntityNotFound(_0x26c374,null))[_0x401f('0x20')](saveUpdates(_0x231f20[_0x401f('0x57')],null))[_0x401f('0x20')](respondWithResult(_0x26c374,null))[_0x401f('0x52')](handleError(_0x26c374,null));};exports['addAvatar']=function(_0x1e9f58,_0x299879,_0x55a287){_0x1e9f58[_0x401f('0x57')][_0x401f('0x71')]=_0x1e9f58['file'][_0x401f('0x70')];return db[_0x401f('0x38')][_0x401f('0x55')]({'where':{'id':_0x1e9f58[_0x401f('0x5d')]['id']}})['then'](handleEntityNotFound(_0x299879,null))[_0x401f('0x20')](saveUpdates(_0x1e9f58[_0x401f('0x57')],null))['then'](respondWithResult(_0x299879,null))['catch'](handleError(_0x299879,null));};exports['addCustomerAvatar']=function(_0x477a9c,_0x8e4a42,_0x5c6815){_0x477a9c['body'][_0x401f('0x72')]=_0x477a9c['file'][_0x401f('0x70')];return db['ChatWebsite'][_0x401f('0x55')]({'where':{'id':_0x477a9c[_0x401f('0x5d')]['id']}})['then'](handleEntityNotFound(_0x8e4a42,null))['then'](saveUpdates(_0x477a9c[_0x401f('0x57')],null))[_0x401f('0x20')](respondWithResult(_0x8e4a42,null))['catch'](handleError(_0x8e4a42,null));};exports[_0x401f('0x73')]=function(_0x4707c2,_0x3eeae3,_0x435023){_0x4707c2[_0x401f('0x57')][_0x401f('0x74')]=_0x4707c2['file']['filename'];return db[_0x401f('0x38')][_0x401f('0x55')]({'where':{'id':_0x4707c2[_0x401f('0x5d')]['id']}})[_0x401f('0x20')](handleEntityNotFound(_0x3eeae3,null))['then'](saveUpdates(_0x4707c2['body'],null))[_0x401f('0x20')](respondWithResult(_0x3eeae3,null))[_0x401f('0x52')](handleError(_0x3eeae3,null));};exports[_0x401f('0x75')]=function(_0xf3f529,_0x120fd2,_0xade49){var _0x3aa4bc=path[_0x401f('0x76')](config[_0x401f('0x77')],_0x401f('0x78'));var _0x3cdd0d={'where':{'id':_0xf3f529[_0x401f('0x5d')]['id']},'attributes':['id',_0x401f('0x6e')],'raw':!![]};var _0x1f9107=![];return require('../../config/license/util')[_0x401f('0x79')]()[_0x401f('0x20')](function(_0x12ceba){if(_0x12ceba){_0x1f9107=_0x12ceba[_0x401f('0x7a')];}})[_0x401f('0x20')](function(){return db[_0x401f('0x38')][_0x401f('0x55')](_0x3cdd0d);})[_0x401f('0x20')](handleEntityNotFound(_0x120fd2,null))['then'](function(_0x2cde15){if(_0x2cde15){if(!_[_0x401f('0x7b')](_0x2cde15[_0x401f('0x6e')])){if(fs[_0x401f('0x7c')](path[_0x401f('0x76')](config['root'],_0x401f('0x7d'),_0x2cde15[_0x401f('0x6e')]))&&_0x1f9107){_0x3aa4bc=path[_0x401f('0x76')](config['root'],'server/files/images/logos/',_0x2cde15['sitepic']);}}return _0x120fd2['download'](_0x3aa4bc);}})[_0x401f('0x52')](handleError(_0x120fd2,null));};exports[_0x401f('0x7e')]=function(_0x45b554,_0x53a1bf,_0x57d06d){var _0x363715=path['join'](config[_0x401f('0x77')],'server/files/images/avatars/default_avatar.png');var _0x414fad={'where':{'id':_0x45b554[_0x401f('0x5d')]['id']},'attributes':['id',_0x401f('0x71')],'raw':!![]};return db[_0x401f('0x38')][_0x401f('0x55')](_0x414fad)['then'](handleEntityNotFound(_0x53a1bf,null))[_0x401f('0x20')](function(_0x2472e3){if(_0x2472e3){if(!_[_0x401f('0x7b')](_0x2472e3[_0x401f('0x71')])){if(fs['existsSync'](path[_0x401f('0x76')](config['root'],'server/files/images/avatars/',_0x2472e3[_0x401f('0x71')]))){_0x363715=path[_0x401f('0x76')](config[_0x401f('0x77')],_0x401f('0x7f'),_0x2472e3[_0x401f('0x71')]);}}return _0x53a1bf['download'](_0x363715);}})[_0x401f('0x52')](handleError(_0x53a1bf,null));};exports['getCustomerAvatar']=function(_0x48a803,_0x2a0c7f,_0x579d2f){var _0x3935f1=path['join'](config[_0x401f('0x77')],'server/files/images/avatars/customer_avatar.png');var _0x269330={'where':{'id':_0x48a803[_0x401f('0x5d')]['id']},'attributes':['id',_0x401f('0x72'),_0x401f('0x80')],'raw':!![]};return db[_0x401f('0x38')]['find'](_0x269330)[_0x401f('0x20')](handleEntityNotFound(_0x2a0c7f,null))[_0x401f('0x20')](function(_0x5f2352){if(_0x5f2352){if(!_[_0x401f('0x7b')](_0x5f2352['customerAvatar'])){if(fs[_0x401f('0x7c')](path[_0x401f('0x76')](config[_0x401f('0x77')],_0x401f('0x7f'),_0x5f2352['customerAvatar']))&&_0x5f2352[_0x401f('0x80')]){_0x3935f1=path[_0x401f('0x76')](config[_0x401f('0x77')],_0x401f('0x7f'),_0x5f2352[_0x401f('0x72')]);}}return _0x2a0c7f[_0x401f('0x81')](_0x3935f1);}})[_0x401f('0x52')](handleError(_0x2a0c7f,null));};exports[_0x401f('0x82')]=function(_0x2a17e7,_0x2231a6,_0x15100c){var _0x1994d6=path['join'](config[_0x401f('0x77')],_0x401f('0x83'));var _0x823d10={'where':{'id':_0x2a17e7[_0x401f('0x5d')]['id']},'attributes':['id',_0x401f('0x74')],'raw':!![]};return db['ChatWebsite'][_0x401f('0x55')](_0x823d10)[_0x401f('0x20')](handleEntityNotFound(_0x2231a6,null))[_0x401f('0x20')](function(_0x4bf42c){if(_0x4bf42c){if(!_[_0x401f('0x7b')](_0x4bf42c[_0x401f('0x74')])){if(fs['existsSync'](path['join'](config['root'],_0x401f('0x7f'),_0x4bf42c[_0x401f('0x74')]))){_0x1994d6=path['join'](config[_0x401f('0x77')],_0x401f('0x7f'),_0x4bf42c[_0x401f('0x74')]);}}return _0x2231a6['download'](_0x1994d6);}})['catch'](handleError(_0x2231a6,null));};exports['notify']=function(_0x143424,_0x5ca980,_0x43e2b0){var _0xfb4752=require(_0x401f('0x84'));var _0x4bb2ba=new _0xfb4752();var _0x5f4b80=_0x4bb2ba[_0x401f('0x85')](_0x143424[_0x401f('0x86')][_0x401f('0x87')])['getResult']();var _0x5c0aad={'body':_0x143424[_0x401f('0x57')],'channel':_0x401f('0x88')};var _0x5c12ad=[];var _0x25a1c7=[];var _0x2a0a02={};var _0x26360d=![];return db[_0x401f('0x89')][_0x401f('0x5e')]()[_0x401f('0x20')](function(_0x173a8c){if(!_0x173a8c){throw new db[(_0x401f('0x8a'))][(_0x401f('0x8b'))](_0x401f('0x8c'));}_0x5c12ad=_[_0x401f('0x8d')](_[_0x401f('0x3a')](_0x173a8c),['createdAt',_0x401f('0x8e')]);_0x25a1c7=_[_0x401f('0x8d')](_['keys'](_0x173a8c),['createdAt',_0x401f('0x8e'),_0x401f('0x8f'),_0x401f('0x90')]);if(_0x143424[_0x401f('0x57')]['id']){delete _0x143424[_0x401f('0x57')]['id'];}if(_[_0x401f('0x7b')](_0x143424[_0x401f('0x57')][_0x401f('0x91')])){throw new db[(_0x401f('0x8a'))][(_0x401f('0x8b'))]('from\x20is\x20mandatory');}if(_[_0x401f('0x7b')](_0x143424[_0x401f('0x57')][_0x401f('0x57')])||_0x143424[_0x401f('0x57')]['body']===''){throw new db[(_0x401f('0x8a'))][(_0x401f('0x8b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x401f('0x7b')](_0x143424[_0x401f('0x57')][_0x401f('0x92')])){throw new db[(_0x401f('0x8a'))][(_0x401f('0x8b'))](_0x401f('0x93')+_0x25a1c7);}if(!_['includes'](_0x25a1c7,_0x143424[_0x401f('0x57')][_0x401f('0x92')])){throw new db['Sequelize'][(_0x401f('0x8b'))](_0x401f('0x94')+_0x25a1c7);}_0x2a0a02[_0x143424[_0x401f('0x57')]['mapKey']]=_0x143424['body'][_0x401f('0x91')];})['then'](function(){return db[_0x401f('0x38')][_0x401f('0x55')]({'where':{'id':_0x143424[_0x401f('0x5d')]['id']},'include':[{'model':db['CmList'],'as':_0x401f('0x95'),'include':[{'model':db['CmContact'],'as':_0x401f('0x96'),'where':_0x2a0a02,'limit':0x1,'order':[[_0x401f('0x8e'),'DESC']]}]},{'model':db[_0x401f('0x97')],'as':_0x401f('0x98')}]});})['then'](handleEntityNotFound(_0x5ca980,null))[_0x401f('0x20')](function(_0x55ffb){if(_0x55ffb&&_0x55ffb[_0x401f('0x95')]){_0x5c0aad['account']=_0x55ffb;_0x5c0aad[_0x401f('0x99')]=_0x55ffb[_0x401f('0x98')];_0x5c0aad[_0x401f('0x9a')]=_0x55ffb['List'];_0x5c0aad[_0x401f('0x99')]=_['orderBy'](_0x5c0aad[_0x401f('0x99')],['priority'],['asc']);if(_0x5c0aad[_0x401f('0x9b')][_0x401f('0x98')]){delete _0x5c0aad[_0x401f('0x9b')][_0x401f('0x98')];}if(_0x5c0aad[_0x401f('0x9b')]['List']&&_0x5c0aad[_0x401f('0x9b')][_0x401f('0x95')][_0x401f('0x96')]['length']){return _0x5c0aad[_0x401f('0x9b')]['List'][_0x401f('0x96')][0x0];}var _0x380b47=_['defaults'](_0x143424[_0x401f('0x57')],{'firstName':_0x143424['body'][_0x401f('0x91')],'ListId':_0x55ffb[_0x401f('0x90')]});_0x380b47[_0x143424[_0x401f('0x57')][_0x401f('0x92')]]=_0x143424[_0x401f('0x57')][_0x401f('0x91')];return db[_0x401f('0x89')][_0x401f('0x56')](_0x380b47,{'fields':_0x5c12ad,'raw':!![]});}})['then'](handleEntityNotFound(_0x5ca980,null))['then'](function(_0x474667){_0x5c0aad['contact']=_0x474667;if(_0x474667){var _0x5b90e4={'ContactId':_0x474667['id'],'ChatWebsiteId':_0x143424[_0x401f('0x5d')]['id'],'from':(_0x474667[_0x401f('0x9c')]||'')+'\x20'+(_0x474667[_0x401f('0x9d')]||''),'customerIp':_0x143424[_0x401f('0x57')][_0x401f('0x9e')],'referer':_0x143424['body'][_0x401f('0x9f')],'browserName':_0x5f4b80[_0x401f('0xa0')][_0x401f('0x34')]&&_0x5f4b80[_0x401f('0xa0')][_0x401f('0xa1')]?util[_0x401f('0xa2')](_0x401f('0xa3'),_0x5f4b80[_0x401f('0xa0')]['name'],_0x5f4b80['browser'][_0x401f('0xa1')]):_0x401f('0xa4'),'browserVersion':_0x5f4b80[_0x401f('0xa0')][_0x401f('0xa1')]||'unknown','osName':util[_0x401f('0xa2')]('%s\x20%s',_0x5f4b80['os'][_0x401f('0x34')],_0x5f4b80['os'][_0x401f('0xa1')]),'osVersion':_0x5f4b80['os'][_0x401f('0xa1')],'deviceModel':_0x5f4b80['device'][_0x401f('0x3f')]&&_0x5f4b80[_0x401f('0xa5')][_0x401f('0xa6')]?util[_0x401f('0xa2')](_0x401f('0xa7'),_0x5f4b80[_0x401f('0xa5')][_0x401f('0x3f')],_0x5f4b80[_0x401f('0xa5')][_0x401f('0xa6')],_0x5f4b80[_0x401f('0xa5')][_0x401f('0x4a')]):null,'deviceVendor':_0x5f4b80['device'][_0x401f('0xa6')],'deviceType':_0x5f4b80[_0x401f('0xa5')][_0x401f('0x4a')],'formData':JSON[_0x401f('0x25')](_0x143424[_0x401f('0x57')])};var _0x1657c5={'ChatWebsiteId':_0x143424[_0x401f('0x5d')]['id'],'closed':![]};if(_0x143424[_0x401f('0x57')]['threadId']){_0x1657c5[_0x401f('0xa8')]=_0x143424[_0x401f('0x57')]['threadId'];return db[_0x401f('0xa9')][_0x401f('0x55')]({'where':_0x1657c5})[_0x401f('0x20')](function(_0x42889a){if(_0x42889a){return[_0x42889a,![]];}_0x5b90e4[_0x401f('0xa8')]=_0x143424[_0x401f('0x57')][_0x401f('0xa8')];_0x5b90e4[_0x401f('0xaa')]=_0x143424['body'][_0x401f('0xaa')];return db[_0x401f('0xa9')][_0x401f('0x56')](_0x5b90e4)['then'](function(_0x5eb6f0){return[_0x5eb6f0,!![]];});});}_0x1657c5['ContactId']=_0x474667['id'];if(_0x143424[_0x401f('0x57')][_0x401f('0xab')]&&_0x143424[_0x401f('0x57')][_0x401f('0xab')]['id']){_0x1657c5['id']=_0x143424[_0x401f('0x57')][_0x401f('0xab')]['id'];return db[_0x401f('0xa9')][_0x401f('0x55')]({'where':_0x1657c5})[_0x401f('0x20')](function(_0x1806b4){if(_0x1806b4){return[_0x1806b4,![]];}return db[_0x401f('0xa9')][_0x401f('0x56')](_0x5b90e4)[_0x401f('0x20')](function(_0x46bc96){return[_0x46bc96,!![]];});});}return db[_0x401f('0xa9')]['create'](_0x5b90e4)[_0x401f('0x20')](function(_0x44b07d){return[_0x44b07d,!![]];});}})[_0x401f('0xac')](function(_0x1f2c5e,_0x268a7c){if(_0x1f2c5e){_0x26360d=_0x268a7c;if(!_0x268a7c){var _0x2ecf58={'from':(_0x5c0aad[_0x401f('0xad')]['firstName']||'')+'\x20'+(_0x5c0aad[_0x401f('0xad')][_0x401f('0x9d')]||'')};if(_0x143424['body'][_0x401f('0xa8')]&&_0x143424['body'][_0x401f('0xae')]&&_0x143424[_0x401f('0x57')][_0x401f('0xa8')]!=_0x143424['body'][_0x401f('0xae')]){_0x2ecf58[_0x401f('0xa8')]=_0x143424[_0x401f('0x57')][_0x401f('0xae')];}return _0x1f2c5e['update'](_0x2ecf58);}else{return _0x1f2c5e;}}})[_0x401f('0x20')](function(_0x3b33d5){_0x5c0aad[_0x401f('0xab')]=_0x3b33d5['get']({'plain':!![]});_0x5c0aad[_0x401f('0xab')][_0x401f('0xaf')]=_0x26360d;if(_0x5c0aad[_0x401f('0xab')][_0x401f('0xaf')]){if(_0x5c0aad[_0x401f('0x9b')]['autoclose']){_0x5c0aad[_0x401f('0x99')]['push']({'id':0x0,'priority':_0x5c0aad[_0x401f('0x99')][_0x401f('0x41')]+0x1,'app':_0x401f('0xb0'),'appdata':_0x401f('0xb1'),'interval':'*,*,*,*'});}}return db[_0x401f('0xb2')]['create']({'body':_0x143424[_0x401f('0x57')][_0x401f('0x57')],'ChatWebsiteId':_0x143424[_0x401f('0x5d')]['id'],'ChatInteractionId':_0x3b33d5['id'],'direction':'in','ContactId':_0x5c0aad['contact']['id'],'AttachmentId':_0x143424[_0x401f('0x57')][_0x401f('0xb3')]});})[_0x401f('0x20')](function(_0x476b20){_0x5c0aad[_0x401f('0x28')]=_0x476b20;if(_0x5c0aad[_0x401f('0xab')][_0x401f('0xb4')]){return db[_0x401f('0xb5')][_0x401f('0x55')]({'attributes':['id',_0x401f('0x34')],'where':{'id':_0x5c0aad[_0x401f('0xab')][_0x401f('0xb4')]}})['then'](function(_0x327edd){if(_0x327edd){_0x5c0aad[_0x401f('0x99')][_0x401f('0xb6')]({'id':0x0,'priority':0x0,'app':_0x401f('0xb7'),'appdata':_0x327edd[_0x401f('0x34')]+','+(_0x5c0aad[_0x401f('0x9b')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x5c0aad['forcedOwnership']=!![];}return respondWithRpcPromise(_0x401f('0xb8'),_0x401f('0xb9'),_0x5c0aad);});}return respondWithRpcPromise(_0x401f('0xb8'),'startRouting',_0x5c0aad);})[_0x401f('0x20')](function(_0x3335bf){respondWithRpcPromise(_0x401f('0xba'),_0x401f('0xba'),{'event':_0x401f('0xbb'),'message':_0x3335bf},client9002);return _0x3335bf;})[_0x401f('0x20')](respondWithResult(_0x5ca980,null))[_0x401f('0x52')](handleError(_0x5ca980,null));};exports['offline']=function(_0x18471a,_0x4f5ad9,_0xdf6b94){var _0x3b4792,_0x6e91b,_0x35f4e1;var _0x26c988=[];var _0x306667=[];var _0x1d77f0={};return db[_0x401f('0x89')]['describe']()[_0x401f('0x20')](function(_0x524a69){if(!_0x524a69){throw new db[(_0x401f('0x8a'))][(_0x401f('0x8b'))]('no\x20available\x20attributes');}_0x306667=_[_0x401f('0x8d')](_[_0x401f('0x3a')](_0x524a69),[_0x401f('0xbc'),_0x401f('0x8e')]);_0x26c988=_[_0x401f('0x8d')](_[_0x401f('0x3a')](_0x524a69),[_0x401f('0xbc'),_0x401f('0x8e'),_0x401f('0x8f'),'ListId']);if(_0x18471a[_0x401f('0x57')]['id']){delete _0x18471a['body']['id'];}if(_[_0x401f('0x7b')](_0x18471a[_0x401f('0x57')][_0x401f('0x91')])){throw _0x4f5ad9[_0x401f('0x29')](0x1f4)[_0x401f('0x35')](new db[(_0x401f('0x8a'))][(_0x401f('0x8b'))](_0x401f('0xbd')));}if(_[_0x401f('0x7b')](_0x18471a['body'][_0x401f('0x57')])||_0x18471a[_0x401f('0x57')][_0x401f('0x57')]===''){throw _0x4f5ad9[_0x401f('0x29')](0x1f4)['send'](new db[(_0x401f('0x8a'))][(_0x401f('0x8b'))](_0x401f('0xbe')));}if(_[_0x401f('0x7b')](_0x18471a['body']['mapKeyOffline'])){throw _0x4f5ad9['status'](0x1f4)['send'](new db[(_0x401f('0x8a'))][(_0x401f('0x8b'))](_0x401f('0xbf')+_0x26c988));}if(!_[_0x401f('0xc0')](_0x26c988,_0x18471a[_0x401f('0x57')]['mapKeyOffline'])){throw _0x4f5ad9[_0x401f('0x29')](0x1f4)[_0x401f('0x35')](new db['Sequelize'][(_0x401f('0x8b'))](_0x401f('0xc1')+_0x26c988));}_0x1d77f0[_0x18471a[_0x401f('0x57')]['mapKeyOffline']]=_0x18471a[_0x401f('0x57')][_0x401f('0x91')];})[_0x401f('0x20')](function(){return db[_0x401f('0x38')][_0x401f('0x55')]({'where':{'id':_0x18471a['params']['id']},'include':[{'model':db[_0x401f('0xc2')],'as':'List'}]});})[_0x401f('0x20')](handleEntityNotFound(_0x4f5ad9,null))[_0x401f('0x20')](function(_0x2a1c36){if(_0x2a1c36&&_0x2a1c36[_0x401f('0x95')]){_0x6e91b=_0x2a1c36;var _0x4e67ce=_[_0x401f('0x17')](_0x18471a['body'],{'firstName':_0x18471a[_0x401f('0x57')]['from'],'phone':_0x18471a[_0x401f('0x57')][_0x401f('0x91')],'ListId':_0x2a1c36['ListId']});_0x4e67ce[_0x18471a['body'][_0x401f('0xc3')]]=_0x18471a[_0x401f('0x57')][_0x401f('0x91')];return db[_0x401f('0x89')][_0x401f('0xc4')]({'where':_0x1d77f0,'defaults':_0x4e67ce});}})[_0x401f('0xac')](function(_0x1d459d){if(_0x1d459d){_0x35f4e1=_0x1d459d;var _0x3c657e=fs[_0x401f('0xc5')](path['join'](config['root'],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x3ceea1=ejs[_0x401f('0xc6')](_0x3c657e,{'body':_['toPairs'](_0x18471a[_0x401f('0x57')][_0x401f('0x57')]),'bodyTitle':_0x6e91b['offlineMessageBody']});return db['ChatOfflineMessage'][_0x401f('0x56')]({'body':_0x3ceea1,'ContactId':_0x1d459d['id'],'ChatWebsiteId':_0x6e91b['id']});}})['then'](function(_0x1e3f66){if(_0x1e3f66){_0x3b4792=_0x1e3f66;return db['MailAccount'][_0x401f('0x62')]({'where':{'service':!![]},'include':[{'model':db[_0x401f('0xc7')],'as':_0x401f('0xc8'),'raw':!![]}]});}})[_0x401f('0x20')](function(_0x19a7c1){if(_0x19a7c1&&_0x19a7c1[_0x401f('0xc8')]&&_0x6e91b[_0x401f('0xc9')]){var _0x2a1738={'tls':{'rejectUnauthorized':![]}};if(_0x19a7c1['Smtp']['service']){_0x2a1738[_0x401f('0xca')]=_0x19a7c1[_0x401f('0xc8')]['service'];}else{_0x2a1738[_0x401f('0xcb')]=_0x19a7c1[_0x401f('0xc8')][_0x401f('0xcb')];_0x2a1738['port']=_0x19a7c1[_0x401f('0xc8')][_0x401f('0xcc')];_0x2a1738['secure']=_0x19a7c1[_0x401f('0xc8')]['secure'];}if(_0x19a7c1[_0x401f('0xc8')][_0x401f('0xcd')]){_0x2a1738[_0x401f('0xce')]={'user':_0x19a7c1[_0x401f('0xc8')][_0x401f('0xcf')],'pass':_0x19a7c1[_0x401f('0xc8')][_0x401f('0xd0')]};}return respondWithRpcPromise(_0x401f('0xd1'),_0x401f('0xd2'),{'account':_0x2a1738,'message':{'from':util['format'](_0x401f('0xd3'),_0x19a7c1[_0x401f('0x34')],_0x19a7c1[_0x401f('0xd4')]||_0x19a7c1[_0x401f('0xc8')][_0x401f('0xcf')]),'to':_0x6e91b[_0x401f('0xc9')],'subject':_0x6e91b[_0x401f('0xd5')],'text':_0x3b4792[_0x401f('0x57')]}},client9003)[_0x401f('0x20')](function(){return _0x3b4792;})[_0x401f('0x52')](function(_0x1d5d30){console[_0x401f('0x26')](_0x1d5d30);});}})[_0x401f('0x20')](function(){if(_0x3b4792){return _0x3b4792;}})['then'](respondWithResult(_0x4f5ad9,null))['catch'](handleError(_0x4f5ad9,null));};exports['addInteraction']=function(_0x180a16,_0x3905ae,_0x4033df){return db[_0x401f('0xa9')]['find']({'where':{'id':_0x180a16[_0x401f('0x5d')]['id']}})[_0x401f('0x20')](handleEntityNotFound(_0x3905ae,null))['then'](function(_0x10319a){if(_0x10319a){return _0x10319a[_0x401f('0xd6')](_0x180a16[_0x401f('0x57')][_0x401f('0x66')],_[_0x401f('0xd7')](_0x180a16[_0x401f('0x57')],[_0x401f('0x66'),'id'])||{});}})[_0x401f('0x20')](respondWithResult(_0x3905ae,null))[_0x401f('0x52')](handleError(_0x3905ae,null));};exports[_0x401f('0xd8')]=function(_0x12bf6a,_0x21d765,_0x249996){var _0x13006d={'raw':![],'where':{}};var _0x3ec399={};var _0x4baaa5={'count':0x0,'rows':[]};return db[_0x401f('0x38')][_0x401f('0x62')]({'where':{'id':_0x12bf6a[_0x401f('0x5d')]['id']}})['then'](handleEntityNotFound(_0x21d765,null))['then'](function(_0x63ee4c){if(_0x63ee4c){_0x3ec399['model']=_[_0x401f('0x3a')](db[_0x401f('0xa9')][_0x401f('0x39')]);_0x3ec399['query']=_['keys'](_0x12bf6a[_0x401f('0x3b')]);_0x3ec399['filters']=_['intersection'](_0x3ec399[_0x401f('0x3f')],_0x3ec399['query']);_0x13006d[_0x401f('0x3e')]=_['intersection'](_0x3ec399[_0x401f('0x3f')],qs[_0x401f('0x40')](_0x12bf6a[_0x401f('0x3b')][_0x401f('0x40')]));_0x13006d[_0x401f('0x3e')]=_0x13006d[_0x401f('0x3e')]['length']?_0x13006d['attributes']:_0x3ec399[_0x401f('0x3f')];if(!_0x12bf6a[_0x401f('0x3b')][_0x401f('0x42')]('nolimit')){_0x13006d[_0x401f('0x44')]=qs[_0x401f('0x44')](_0x12bf6a[_0x401f('0x3b')]['limit']);_0x13006d['offset']=qs[_0x401f('0x2c')](_0x12bf6a[_0x401f('0x3b')][_0x401f('0x2c')]);}_0x13006d[_0x401f('0x45')]=qs[_0x401f('0x46')](_0x12bf6a['query'][_0x401f('0x46')]);_0x13006d[_0x401f('0x47')]=qs[_0x401f('0x3c')](_[_0x401f('0x63')](_0x12bf6a[_0x401f('0x3b')],_0x3ec399[_0x401f('0x3c')]));_0x13006d[_0x401f('0x47')]['ChatWebsiteId']=_0x63ee4c['id'];if(_0x12bf6a['query'][_0x401f('0x48')]){_0x13006d[_0x401f('0x47')]=_[_0x401f('0x4d')](_0x13006d[_0x401f('0x47')],{'$or':_[_0x401f('0x49')](_0x13006d[_0x401f('0x3e')],function(_0x5d9510){var _0x2710fe={};_0x2710fe[_0x5d9510]={'$like':'%'+_0x12bf6a[_0x401f('0x3b')][_0x401f('0x48')]+'%'};return _0x2710fe;})});}_0x13006d=_[_0x401f('0x4d')]({},_0x13006d,_0x12bf6a[_0x401f('0x4e')]);return db[_0x401f('0xa9')]['count']({'where':_0x13006d[_0x401f('0x47')]})[_0x401f('0x20')](function(_0x153065){_0x4baaa5[_0x401f('0x4f')]=_0x153065;if(_0x12bf6a[_0x401f('0x3b')][_0x401f('0x50')]){_0x13006d[_0x401f('0x51')]=[{'model':db['CmContact'],'as':_0x401f('0xd9'),'required':![]},{'model':db[_0x401f('0xb5')],'as':'Owner','attributes':[_0x401f('0x34'),_0x401f('0xda'),_0x401f('0xdb')],'required':![]},{'model':db[_0x401f('0xdc')],'as':_0x401f('0xdd'),'attributes':['id',_0x401f('0x34'),_0x401f('0xde')],'where':_0x12bf6a['query'][_0x401f('0xdf')]?{'id':_0x12bf6a[_0x401f('0x3b')][_0x401f('0xdf')]}:undefined,'required':_0x12bf6a[_0x401f('0x3b')]['tag']?!![]:![]}];}return db[_0x401f('0xa9')]['findAll'](_0x13006d);})[_0x401f('0x20')](function(_0x40c214){_0x4baaa5[_0x401f('0x6b')]=_0x40c214;return _0x4baaa5;});}})[_0x401f('0x20')](respondWithFilteredResult(_0x21d765,_0x13006d))[_0x401f('0x52')](handleError(_0x21d765,null));};function iftimePromise(_0x2060ec,_0x4b0567){return respondWithRpcPromise(_0x401f('0xe0'),_0x401f('0xe1'),{'command':_0x4b0567['timezone']?util['format']('iftime\x20%s,%s',_0x2060ec[_0x401f('0xe2')],_0x4b0567[_0x401f('0xe3')]):util[_0x401f('0xa2')](_0x401f('0xe4'),_0x2060ec[_0x401f('0xe2')])},client9002)[_0x401f('0x20')](function(_0x2ed7cf){var _0x580f26=_0x2ed7cf&&_0x2ed7cf[_0x401f('0xe5')](_0x401f('0xe6'))>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x4b0567['id'],_0x2060ec['id'],_0x2060ec[_0x401f('0xe2')],_0x580f26?_0x401f('0xe7'):_0x401f('0xe8'),_0x4b0567['timezone']?_0x4b0567[_0x401f('0xe3')]:_0x401f('0xe9'));return _0x580f26;})[_0x401f('0x52')](function(_0x39f753){logger[_0x401f('0x26')](_0x401f('0xea'),_0x4b0567['id'],_0x2060ec['id'],_0x2060ec[_0x401f('0xe2')],util[_0x401f('0xeb')](_0x39f753,{'showHidden':![],'depth':null}),_0x4b0567[_0x401f('0xe3')]?_0x4b0567[_0x401f('0xe3')]:_0x401f('0xe9'));return![];});}exports[_0x401f('0xe1')]=function(_0x40c6f7,_0x3da37c,_0x923318){var _0x20118d=0x0;var _0x2a1cb1=0x0;var _0x1a163c=![];var _0x52be28;var _0x433065;return db[_0x401f('0x38')][_0x401f('0x55')]({'where':{'id':_0x40c6f7[_0x401f('0x5d')]['id']},'include':[{'model':db[_0x401f('0xec')],'as':_0x401f('0xec'),'include':[{'model':db[_0x401f('0xec')],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x3da37c,null))['then'](function(_0x4ab037){if(_0x4ab037){_0x52be28=_0x4ab037;return _0x4ab037['getProactiveActions']({'raw':!![]});}})[_0x401f('0x20')](function(_0x5c65eb){if(_0x52be28){if(_0x5c65eb){_0x433065=_0x5c65eb;}}return require('../../config/license/util')[_0x401f('0x79')]();})['then'](function(_0x59be4f){if(_0x59be4f){_0x2a1cb1=_0x59be4f[_0x401f('0xed')];_0x1a163c=_0x59be4f[_0x401f('0x7a')];}})[_0x401f('0x20')](function(){return db['ChatInteraction'][_0x401f('0x4f')]({'where':{'closed':![]}});})[_0x401f('0x20')](function(_0x880d39){_0x20118d=_0x880d39;if(_0x2a1cb1&&_0x880d39>_0x2a1cb1){return db[_0x401f('0xee')][_0x401f('0x62')]({'where':{'id':0x1}})[_0x401f('0x20')](function(_0x2a4ff3){if(_0x2a4ff3){_0x2a4ff3[_0x401f('0xef')](_0x401f('0xf0'));}});}})[_0x401f('0x20')](function(){if(_0x52be28[_0x401f('0xec')]&&_0x52be28[_0x401f('0xec')][_0x401f('0xf1')]){var _0x33cd32=[];for(var _0x2aa3d2=0x0;_0x2aa3d2<_0x52be28['Interval']['Intervals'][_0x401f('0x41')];_0x2aa3d2++){var _0x4f4ea6=_0x52be28[_0x401f('0xec')][_0x401f('0xf1')][_0x2aa3d2]['get']({'plain':!![]});_0x33cd32['push'](iftimePromise(_0x4f4ea6,_0x52be28));}return BPromise[_0x401f('0xf2')](_0x33cd32)[_0x401f('0x20')](function(_0x3b4788){return _[_0x401f('0xf3')](_0x3b4788);});}else{return!![];}})[_0x401f('0x20')](function(_0x1eda0d){var _0x2cff3a=fs[_0x401f('0xc5')](path[_0x401f('0x76')](config[_0x401f('0x77')],'server/files/chat/iframe.js'),_0x401f('0xf4'));var _0x5091d8={'remote':_0x52be28[_0x401f('0xf5')],'query':querystring[_0x401f('0x25')](_[_0x401f('0x4d')](_0x52be28['get']({'plain':!![]}),{'customerIp':_0x40c6f7[_0x401f('0x86')]['x-forwarded-for']||_0x40c6f7[_0x401f('0x86')][_0x401f('0xf6')]||_0x40c6f7[_0x401f('0xf7')][_0x401f('0xf8')]||_0x40c6f7['ip'],'referer':_0x40c6f7[_0x401f('0x86')]['referer'],'openedInteractions':_0x20118d,'maxInteractions':_0x2a1cb1,'virtual':_0x1a163c[_0x401f('0xed')],'online':_0x1eda0d,'custom':_0x1a163c}))[_0x401f('0xf9')](/'/g,'\x5c\x27')};_0x3da37c[_0x401f('0x35')](ejs[_0x401f('0xc6')](Mustache[_0x401f('0xc6')](_0x2cff3a,_0x5091d8),{'proactiveActions':_0x433065,'alignment':_0x52be28[_0x401f('0xfa')],'verticalAlignment':_0x52be28['verticalAlignment']}));})[_0x401f('0x52')](handleError(_0x3da37c,null));};exports[_0x401f('0xfb')]=function(_0x21c642,_0x373055,_0x2cc352){return db['ChatWebsite'][_0x401f('0x62')]({'where':{'id':_0x21c642[_0x401f('0x5d')]['id']}})[_0x401f('0x20')](handleEntityNotFound(_0x373055,null))[_0x401f('0x20')](function(_0x5e34d5){if(_0x5e34d5){return db[_0x401f('0xfc')]['transaction'](function(_0x53652e){return db[_0x401f('0x97')]['destroy']({'where':{'ChatWebsiteId':_0x21c642[_0x401f('0x5d')]['id']},'transaction':_0x53652e})['then'](function(_0x12f439){var _0x3bee04=_[_0x401f('0x49')](_0x21c642[_0x401f('0x57')],function(_0x4ff145){_0x4ff145[_0x401f('0x6a')]=_0x21c642[_0x401f('0x5d')]['id'];return _0x4ff145;});return db[_0x401f('0x97')][_0x401f('0xfd')](_0x3bee04,{'transaction':_0x53652e});});})[_0x401f('0x20')](function(){return db[_0x401f('0x97')][_0x401f('0xfe')]({'where':{'ChatWebsiteId':_0x21c642['params']['id']},'order':_0x401f('0xff')});});}})[_0x401f('0x20')](respondWithResult(_0x373055,null))[_0x401f('0x52')](handleError(_0x373055,null));};exports['getApplications']=function(_0x1ebfa6,_0x346255,_0x53a5a6){var _0x3b1556={};var _0x49a621={};var _0x28b9ba;var _0x406244;return db[_0x401f('0x38')]['findOne']({'where':{'id':_0x1ebfa6[_0x401f('0x5d')]['id']}})[_0x401f('0x20')](handleEntityNotFound(_0x346255,null))[_0x401f('0x20')](function(_0x59eb66){if(_0x59eb66){_0x28b9ba=_0x59eb66;_0x49a621[_0x401f('0x3f')]=_['keys'](db['ChatApplication'][_0x401f('0x39')]);_0x49a621['query']=_['keys'](_0x1ebfa6['query']);_0x49a621[_0x401f('0x3c')]=_[_0x401f('0x3d')](_0x49a621['model'],_0x49a621['query']);_0x3b1556[_0x401f('0x3e')]=_[_0x401f('0x3d')](_0x49a621[_0x401f('0x3f')],qs[_0x401f('0x40')](_0x1ebfa6[_0x401f('0x3b')][_0x401f('0x40')]));_0x3b1556['attributes']=_0x3b1556[_0x401f('0x3e')][_0x401f('0x41')]?_0x3b1556[_0x401f('0x3e')]:_0x49a621[_0x401f('0x3f')];_0x3b1556['order']=qs[_0x401f('0x46')](_0x1ebfa6[_0x401f('0x3b')][_0x401f('0x46')]);_0x3b1556[_0x401f('0x47')]=qs[_0x401f('0x3c')](_[_0x401f('0x63')](_0x1ebfa6[_0x401f('0x3b')],_0x49a621[_0x401f('0x3c')]));if(_0x1ebfa6['query']['filter']){_0x3b1556['where']=_[_0x401f('0x4d')](_0x3b1556[_0x401f('0x47')],{'$or':_[_0x401f('0x49')](_0x3b1556[_0x401f('0x3e')],function(_0x589e96){var _0x4b877d={};_0x4b877d[_0x589e96]={'$like':'%'+_0x1ebfa6[_0x401f('0x3b')]['filter']+'%'};return _0x4b877d;})});}_0x3b1556=_['merge']({},_0x3b1556,_0x1ebfa6['options']);return _0x28b9ba['getApplications'](_0x3b1556);}})['then'](function(_0x49b9a9){if(_0x49b9a9){_0x406244=_0x49b9a9[_0x401f('0x41')];if(!_0x1ebfa6[_0x401f('0x3b')][_0x401f('0x42')](_0x401f('0x43'))){_0x3b1556[_0x401f('0x44')]=qs[_0x401f('0x44')](_0x1ebfa6[_0x401f('0x3b')]['limit']);_0x3b1556[_0x401f('0x2c')]=qs[_0x401f('0x2c')](_0x1ebfa6[_0x401f('0x3b')][_0x401f('0x2c')]);}return _0x28b9ba[_0x401f('0x100')](_0x3b1556);}})['then'](function(_0x4c4a81){if(_0x4c4a81){return _0x4c4a81?{'count':_0x406244,'rows':_0x4c4a81}:null;}})[_0x401f('0x20')](respondWithResult(_0x346255,null))[_0x401f('0x52')](handleError(_0x346255,null));};exports[_0x401f('0x101')]=function(_0x32c4d4,_0xcf0069,_0x508eac){return db[_0x401f('0x102')][_0x401f('0x55')]({'where':{'id':_0x32c4d4[_0x401f('0x5d')]['id']}})[_0x401f('0x20')](handleEntityNotFound(_0xcf0069,null))['then'](function(_0x1a8f5d){if(_0x1a8f5d){return _0x1a8f5d[_0x401f('0x101')](_0x32c4d4[_0x401f('0x57')][_0x401f('0x66')],_[_0x401f('0xd7')](_0x32c4d4['body'],[_0x401f('0x66'),'id'])||{});}})[_0x401f('0x20')](respondWithResult(_0xcf0069,null))[_0x401f('0x52')](handleError(_0xcf0069,null));};exports[_0x401f('0x103')]=function(_0x51010e,_0x208023,_0x4cbea9){var _0xb15a44={};var _0x592480={};var _0x1e326a;var _0x2dfc09;return db[_0x401f('0x38')][_0x401f('0x62')]({'where':{'id':_0x51010e[_0x401f('0x5d')]['id']}})['then'](handleEntityNotFound(_0x208023,null))[_0x401f('0x20')](function(_0x3639a7){if(_0x3639a7){_0x1e326a=_0x3639a7;_0x592480[_0x401f('0x3f')]=_[_0x401f('0x3a')](db['ChatProactiveAction'][_0x401f('0x39')]);_0x592480[_0x401f('0x3b')]=_['keys'](_0x51010e[_0x401f('0x3b')]);_0x592480[_0x401f('0x3c')]=_['intersection'](_0x592480[_0x401f('0x3f')],_0x592480[_0x401f('0x3b')]);_0xb15a44[_0x401f('0x3e')]=_[_0x401f('0x3d')](_0x592480['model'],qs['fields'](_0x51010e[_0x401f('0x3b')][_0x401f('0x40')]));_0xb15a44[_0x401f('0x3e')]=_0xb15a44['attributes'][_0x401f('0x41')]?_0xb15a44[_0x401f('0x3e')]:_0x592480[_0x401f('0x3f')];_0xb15a44[_0x401f('0x45')]=qs[_0x401f('0x46')](_0x51010e[_0x401f('0x3b')][_0x401f('0x46')]);_0xb15a44[_0x401f('0x47')]=qs[_0x401f('0x3c')](_['pick'](_0x51010e['query'],_0x592480[_0x401f('0x3c')]));if(_0x51010e[_0x401f('0x3b')]['filter']){_0xb15a44[_0x401f('0x47')]=_[_0x401f('0x4d')](_0xb15a44[_0x401f('0x47')],{'$or':_['map'](_0xb15a44[_0x401f('0x3e')],function(_0x471333){var _0x550d0c={};_0x550d0c[_0x471333]={'$like':'%'+_0x51010e[_0x401f('0x3b')][_0x401f('0x48')]+'%'};return _0x550d0c;})});}_0xb15a44=_[_0x401f('0x4d')]({},_0xb15a44,_0x51010e['options']);return _0x1e326a[_0x401f('0x103')](_0xb15a44);}})[_0x401f('0x20')](function(_0x881e8e){if(_0x881e8e){_0x2dfc09=_0x881e8e[_0x401f('0x41')];if(!_0x51010e[_0x401f('0x3b')][_0x401f('0x42')](_0x401f('0x43'))){_0xb15a44[_0x401f('0x44')]=qs[_0x401f('0x44')](_0x51010e[_0x401f('0x3b')]['limit']);_0xb15a44['offset']=qs[_0x401f('0x2c')](_0x51010e[_0x401f('0x3b')]['offset']);}return _0x1e326a['getProactiveActions'](_0xb15a44);}})[_0x401f('0x20')](function(_0x426999){if(_0x426999){return _0x426999?{'count':_0x2dfc09,'rows':_0x426999}:null;}})[_0x401f('0x20')](respondWithResult(_0x208023,null))[_0x401f('0x52')](handleError(_0x208023,null));};exports[_0x401f('0x104')]=function(_0x8f84c9,_0x4a7ee9,_0x57ad20){var _0x2cf79d=_0x8f84c9[_0x401f('0x3b')][_0x401f('0x105')]===_0x401f('0x106')?_0x401f('0x107'):_0x401f('0x108');return db[_0x401f('0x38')]['find']({'attributes':['id',_0x2cf79d],'where':{'id':_0x8f84c9[_0x401f('0x5d')]['id']}})[_0x401f('0x20')](handleEntityNotFound(_0x4a7ee9,null))[_0x401f('0x20')](function(_0x50095c){if(_0x50095c){var _0x962c14=_0x50095c[_0x2cf79d];var _0x459e3d=_0x962c14&&_0x962c14[_0x401f('0x109')]?_0x962c14['items']:[];_0x4a7ee9[_0x401f('0x35')]({'fromKey':_[_0x401f('0x7b')](_0x962c14['fromKey'])?undefined:_0x962c14[_0x401f('0x10a')],'count':_0x459e3d['length'],'rows':_0x459e3d});}})[_0x401f('0x52')](handleError(_0x4a7ee9,null));};exports[_0x401f('0x10b')]=function(_0x1ad3ac,_0x120b5f,_0x2d763e){var _0x1867bc={'raw':!![],'where':{}};var _0x56bb5d={};var _0x2551bc={'count':0x0,'rows':[]};return db[_0x401f('0x38')][_0x401f('0x62')]({'where':{'id':_0x1ad3ac[_0x401f('0x5d')]['id']}})[_0x401f('0x20')](handleEntityNotFound(_0x120b5f,null))[_0x401f('0x20')](function(_0x2aa46d){if(_0x2aa46d){_0x56bb5d['model']=_[_0x401f('0x3a')](db[_0x401f('0x10c')]['rawAttributes']);_0x56bb5d[_0x401f('0x3b')]=_[_0x401f('0x3a')](_0x1ad3ac['query']);_0x56bb5d[_0x401f('0x3c')]=_[_0x401f('0x3d')](_0x56bb5d[_0x401f('0x3f')],_0x56bb5d[_0x401f('0x3b')]);_0x1867bc['attributes']=_[_0x401f('0x3d')](_0x56bb5d[_0x401f('0x3f')],qs['fields'](_0x1ad3ac[_0x401f('0x3b')]['fields']));_0x1867bc['attributes']=_0x1867bc[_0x401f('0x3e')]['length']?_0x1867bc[_0x401f('0x3e')]:_0x56bb5d[_0x401f('0x3f')];if(!_0x1ad3ac[_0x401f('0x3b')]['hasOwnProperty'](_0x401f('0x43'))){_0x1867bc[_0x401f('0x44')]=qs[_0x401f('0x44')](_0x1ad3ac[_0x401f('0x3b')][_0x401f('0x44')]);_0x1867bc[_0x401f('0x2c')]=qs[_0x401f('0x2c')](_0x1ad3ac[_0x401f('0x3b')]['offset']);}_0x1867bc[_0x401f('0x45')]=qs['sort'](_0x1ad3ac[_0x401f('0x3b')][_0x401f('0x46')]);_0x1867bc[_0x401f('0x47')]=qs[_0x401f('0x3c')](_[_0x401f('0x63')](_0x1ad3ac['query'],_0x56bb5d['filters']));_0x1867bc[_0x401f('0x47')][_0x401f('0x6a')]=_0x2aa46d['id'];if(_0x1ad3ac[_0x401f('0x3b')][_0x401f('0x48')]){_0x1867bc[_0x401f('0x47')]=_[_0x401f('0x4d')](_0x1867bc[_0x401f('0x47')],{'$or':_[_0x401f('0x49')](_0x1867bc['attributes'],function(_0x2ae1af){var _0x1f809e={};_0x1f809e[_0x2ae1af]={'$like':'%'+_0x1ad3ac[_0x401f('0x3b')]['filter']+'%'};return _0x1f809e;})});}_0x1867bc=_[_0x401f('0x4d')]({},_0x1867bc,_0x1ad3ac[_0x401f('0x4e')]);return db['ChatOfflineMessage'][_0x401f('0x4f')]({'where':_0x1867bc[_0x401f('0x47')]})[_0x401f('0x20')](function(_0xb8691a){_0x2551bc[_0x401f('0x4f')]=_0xb8691a;if(_0x1ad3ac[_0x401f('0x3b')]['includeAll']){_0x1867bc[_0x401f('0x51')]=[{'all':!![]}];}return db[_0x401f('0x10c')][_0x401f('0x64')](_0x1867bc);})[_0x401f('0x20')](function(_0x1103b7){_0x2551bc[_0x401f('0x6b')]=_0x1103b7;return _0x2551bc;});}})[_0x401f('0x20')](respondWithFilteredResult(_0x120b5f,_0x1867bc))['catch'](handleError(_0x120b5f,null));};exports[_0x401f('0x10d')]=function(_0x21edd6,_0x535d71,_0x43136b){return db[_0x401f('0x38')][_0x401f('0x55')]({'where':{'id':_0x21edd6[_0x401f('0x5d')]['id']}})[_0x401f('0x20')](handleEntityNotFound(_0x535d71,null))[_0x401f('0x20')](function(_0x5372d7){if(_0x5372d7){return _0x5372d7[_0x401f('0x10d')](_0x21edd6[_0x401f('0x57')]['ids'],_[_0x401f('0xd7')](_0x21edd6[_0x401f('0x57')],['ids','id'])||{})['spread'](function(_0x2e4dc6){for(var _0x2c3b5b=0x0;_0x2c3b5b<_0x21edd6[_0x401f('0x57')]['ids'][_0x401f('0x41')];_0x2c3b5b+=0x1){socket[_0x401f('0x10e')](_0x401f('0x10f'),{'UserId':_0x21edd6[_0x401f('0x57')][_0x401f('0x66')][_0x2c3b5b],'ChatWebsiteId':_0x21edd6[_0x401f('0x5d')]['id']});}return _0x2e4dc6;});}})[_0x401f('0x20')](respondWithResult(_0x535d71,null))['catch'](handleError(_0x535d71,null));};exports['removeAgents']=function(_0x2b59a3,_0x2856fd,_0x12c21f){var _0x2630c7;return db[_0x401f('0x38')][_0x401f('0x55')]({'where':{'id':_0x2b59a3[_0x401f('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2856fd,null))[_0x401f('0x20')](function(_0x41caa2){if(_0x41caa2){return _0x41caa2[_0x401f('0x110')](_0x2b59a3[_0x401f('0x3b')][_0x401f('0x66')])[_0x401f('0x20')](function(_0x307b9b){if(_['isArray'](_0x2b59a3[_0x401f('0x3b')][_0x401f('0x66')])){for(var _0x5a6121=0x0;_0x5a6121<_0x2b59a3[_0x401f('0x3b')][_0x401f('0x66')]['length'];_0x5a6121+=0x1){socket[_0x401f('0x10e')]('userChatWebsite:remove',{'UserId':_0x2b59a3['query'][_0x401f('0x66')][_0x5a6121],'ChatWebsiteId':_0x2b59a3[_0x401f('0x5d')]['id']});}}else{socket[_0x401f('0x10e')](_0x401f('0x111'),{'UserId':_0x2b59a3[_0x401f('0x3b')][_0x401f('0x66')],'ChatWebsiteId':_0x2b59a3[_0x401f('0x5d')]['id']});}});}})[_0x401f('0x20')](respondWithStatusCode(_0x2856fd,null))['catch'](handleError(_0x2856fd,null));};exports[_0x401f('0x112')]=function(_0x4c4e83,_0x26ff11,_0x332b41){var _0x47dd35={};var _0x2cc201={};var _0x20f509;var _0xc2d9db;return db[_0x401f('0x38')]['findOne']({'where':{'id':_0x4c4e83[_0x401f('0x5d')]['id']}})[_0x401f('0x20')](handleEntityNotFound(_0x26ff11,null))['then'](function(_0x45997e){if(_0x45997e){_0x20f509=_0x45997e;_0x2cc201[_0x401f('0x3f')]=_[_0x401f('0x3a')](db[_0x401f('0xb5')][_0x401f('0x39')]);_0x2cc201[_0x401f('0x3b')]=_[_0x401f('0x3a')](_0x4c4e83[_0x401f('0x3b')]);_0x2cc201[_0x401f('0x3c')]=_['intersection'](_0x2cc201[_0x401f('0x3f')],_0x2cc201[_0x401f('0x3b')]);_0x47dd35[_0x401f('0x3e')]=_['intersection'](_0x2cc201['model'],qs[_0x401f('0x40')](_0x4c4e83[_0x401f('0x3b')]['fields']));_0x47dd35[_0x401f('0x3e')]=_0x47dd35[_0x401f('0x3e')][_0x401f('0x41')]?_0x47dd35[_0x401f('0x3e')]:_0x2cc201['model'];_0x47dd35['order']=qs['sort'](_0x4c4e83[_0x401f('0x3b')][_0x401f('0x46')]);_0x47dd35[_0x401f('0x47')]=qs[_0x401f('0x3c')](_[_0x401f('0x63')](_0x4c4e83[_0x401f('0x3b')],_0x2cc201[_0x401f('0x3c')]));if(_0x4c4e83[_0x401f('0x3b')][_0x401f('0x48')]){_0x47dd35[_0x401f('0x47')]=_[_0x401f('0x4d')](_0x47dd35['where'],{'$or':_[_0x401f('0x49')](_0x47dd35[_0x401f('0x3e')],function(_0x90384e){var _0x1bf8cc={};_0x1bf8cc[_0x90384e]={'$like':'%'+_0x4c4e83['query'][_0x401f('0x48')]+'%'};return _0x1bf8cc;})});}_0x47dd35=_[_0x401f('0x4d')]({},_0x47dd35,_0x4c4e83[_0x401f('0x4e')]);return _0x20f509[_0x401f('0x112')](_0x47dd35);}})['then'](function(_0x57686e){if(_0x57686e){_0xc2d9db=_0x57686e['length'];if(!_0x4c4e83[_0x401f('0x3b')][_0x401f('0x42')]('nolimit')){_0x47dd35[_0x401f('0x44')]=qs[_0x401f('0x44')](_0x4c4e83[_0x401f('0x3b')]['limit']);_0x47dd35[_0x401f('0x2c')]=qs['offset'](_0x4c4e83[_0x401f('0x3b')][_0x401f('0x2c')]);}return _0x20f509[_0x401f('0x112')](_0x47dd35);}})[_0x401f('0x20')](function(_0x1f216c){if(_0x1f216c){return _0x1f216c?{'count':_0xc2d9db,'rows':_0x1f216c}:null;}})[_0x401f('0x20')](respondWithResult(_0x26ff11,null))[_0x401f('0x52')](handleError(_0x26ff11,null));};
\ No newline at end of file
index 467d4f3..b8924c5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x128c=['ChatWebsite','setMaxListeners','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x487575,_0x2de8a6){var _0x423867=function(_0x23e54f){while(--_0x23e54f){_0x487575['push'](_0x487575['shift']());}};_0x423867(++_0x2de8a6);}(_0x128c,0x96));var _0xc128=function(_0x35c70c,_0x1f0b01){_0x35c70c=_0x35c70c-0x0;var _0x2b0c72=_0x128c[_0x35c70c];return _0x2b0c72;};'use strict';var EventEmitter=require(_0xc128('0x0'));var ChatWebsite=require(_0xc128('0x1'))['db'][_0xc128('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xc128('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc128('0x4')};function emitEvent(_0xb3d173){return function(_0x1afdb0,_0x495b17,_0x2c9c0d){ChatWebsiteEvents[_0xc128('0x5')](_0xb3d173+':'+_0x1afdb0['id'],_0x1afdb0);ChatWebsiteEvents['emit'](_0xb3d173,_0x1afdb0);_0x2c9c0d(null);};}for(var e in events){if(events[_0xc128('0x6')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xc128('0x7')]=ChatWebsiteEvents;
\ No newline at end of file
+var _0x4148=['ChatWebsite','setMaxListeners','save','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x4148,0xc6));var _0x8414=function(_0x57784b,_0x49a858){_0x57784b=_0x57784b-0x0;var _0x4505fa=_0x4148[_0x57784b];return _0x4505fa;};'use strict';var EventEmitter=require(_0x8414('0x0'));var ChatWebsite=require(_0x8414('0x1'))['db'][_0x8414('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x8414('0x3')](0x0);var events={'afterCreate':_0x8414('0x4'),'afterUpdate':'update','afterDestroy':_0x8414('0x5')};function emitEvent(_0x39b377){return function(_0x41ddde,_0x361d0b,_0x5dfe3c){ChatWebsiteEvents[_0x8414('0x6')](_0x39b377+':'+_0x41ddde['id'],_0x41ddde);ChatWebsiteEvents['emit'](_0x39b377,_0x41ddde);_0x5dfe3c(null);};}for(var e in events){if(events[_0x8414('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents;
\ No newline at end of file
index 4640889..507f5e2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x453b=['moment','bluebird','request-promise','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','api'];(function(_0x1acb96,_0x108216){var _0x5da6cf=function(_0x495410){while(--_0x495410){_0x1acb96['push'](_0x1acb96['shift']());}};_0x5da6cf(++_0x108216);}(_0x453b,0x164));var _0xb453=function(_0x1d9163,_0x79567d){_0x1d9163=_0x1d9163-0x0;var _0xb42197=_0x453b[_0x1d9163];return _0xb42197;};'use strict';var _=require(_0xb453('0x0'));var util=require(_0xb453('0x1'));var logger=require(_0xb453('0x2'))(_0xb453('0x3'));var moment=require(_0xb453('0x4'));var BPromise=require(_0xb453('0x5'));var rp=require(_0xb453('0x6'));var attributes=require(_0xb453('0x7'));module[_0xb453('0x8')]=function(_0x1314f4,_0x6ee7a0){return _0x1314f4[_0xb453('0x9')](_0xb453('0xa'),attributes,{'tableName':_0xb453('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x3f19=['lodash','moment','request-promise','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites'];(function(_0x507965,_0x4944f4){var _0x3608fc=function(_0x14c8d0){while(--_0x14c8d0){_0x507965['push'](_0x507965['shift']());}};_0x3608fc(++_0x4944f4);}(_0x3f19,0xc0));var _0x93f1=function(_0xee741b,_0x10cf16){_0xee741b=_0xee741b-0x0;var _0x9ce0a2=_0x3f19[_0xee741b];return _0x9ce0a2;};'use strict';var _=require(_0x93f1('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x93f1('0x1'));var BPromise=require('bluebird');var rp=require(_0x93f1('0x2'));var attributes=require(_0x93f1('0x3'));module[_0x93f1('0x4')]=function(_0x2057aa,_0x5dbfbc){return _0x2057aa[_0x93f1('0x5')](_0x93f1('0x6'),attributes,{'tableName':_0x93f1('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index d386c0d..00572b8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf721=['../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf721,0x65));var _0x1f72=function(_0x5756f8,_0x22b6d5){_0x5756f8=_0x5756f8-0x0;var _0x3bb749=_0xf721[_0x5756f8];return _0x3bb749;};'use strict';var _=require(_0x1f72('0x0'));var util=require(_0x1f72('0x1'));var moment=require(_0x1f72('0x2'));var BPromise=require(_0x1f72('0x3'));var rs=require(_0x1f72('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f72('0x5'))['db'];var utils=require(_0x1f72('0x6'));var logger=require(_0x1f72('0x7'))('rpc');var config=require(_0x1f72('0x8'));var jayson=require(_0x1f72('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x1f72('0xa')]=_[_0x1f72('0xb')](config[_0x1f72('0xa')],{'host':_0x1f72('0xc'),'port':0x18eb});var socket=require(_0x1f72('0xd'))(new Redis(config[_0x1f72('0xa')]));require('./chatWebsite.socket')[_0x1f72('0xe')](socket);function respondWithRpcPromise(_0x50ba00,_0x3e0133,_0x4d4237){return new BPromise(function(_0x1f1a19,_0x44a70f){return client[_0x1f72('0xf')](_0x50ba00,_0x4d4237)['then'](function(_0x50b755){logger[_0x1f72('0x10')](_0x1f72('0x11'),_0x3e0133,_0x1f72('0x12'));logger[_0x1f72('0x13')](_0x1f72('0x14'),_0x3e0133,_0x1f72('0x12'),JSON[_0x1f72('0x15')](_0x50b755));if(_0x50b755[_0x1f72('0x16')]){if(_0x50b755[_0x1f72('0x16')][_0x1f72('0x17')]===0x1f4){logger['error'](_0x1f72('0x11'),_0x3e0133,_0x50b755['error'][_0x1f72('0x18')]);return _0x44a70f(_0x50b755[_0x1f72('0x16')][_0x1f72('0x18')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x3e0133,_0x50b755[_0x1f72('0x16')][_0x1f72('0x18')]);return _0x1f1a19(_0x50b755[_0x1f72('0x16')][_0x1f72('0x18')]);}else{logger[_0x1f72('0x10')](_0x1f72('0x11'),_0x3e0133,_0x1f72('0x12'));_0x1f1a19(_0x50b755[_0x1f72('0x19')][_0x1f72('0x18')]);}})[_0x1f72('0x1a')](function(_0x481991){logger[_0x1f72('0x16')](_0x1f72('0x11'),_0x3e0133,_0x481991);_0x44a70f(_0x481991);});});}
\ No newline at end of file
+var _0xd315=['request','then','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./chatWebsite.socket','register'];(function(_0x31a306,_0x4c26bb){var _0x5e88b8=function(_0x574057){while(--_0x574057){_0x31a306['push'](_0x31a306['shift']());}};_0x5e88b8(++_0x4c26bb);}(_0xd315,0x123));var _0x5d31=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd315[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5d31('0x0'));var util=require(_0x5d31('0x1'));var moment=require(_0x5d31('0x2'));var BPromise=require(_0x5d31('0x3'));var rs=require(_0x5d31('0x4'));var fs=require('fs');var Redis=require(_0x5d31('0x5'));var db=require(_0x5d31('0x6'))['db'];var utils=require(_0x5d31('0x7'));var logger=require(_0x5d31('0x8'))(_0x5d31('0x9'));var config=require(_0x5d31('0xa'));var jayson=require(_0x5d31('0xb'));var client=jayson[_0x5d31('0xc')][_0x5d31('0xd')]({'port':0x232a});config[_0x5d31('0xe')]=_['defaults'](config[_0x5d31('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5d31('0xe')]));require(_0x5d31('0xf'))[_0x5d31('0x10')](socket);function respondWithRpcPromise(_0x29885c,_0x42ce8e,_0x7d9bda){return new BPromise(function(_0x3599ca,_0x28d717){return client[_0x5d31('0x11')](_0x29885c,_0x7d9bda)[_0x5d31('0x12')](function(_0xc5f20c){logger['info'](_0x5d31('0x13'),_0x42ce8e,'request\x20sent');logger[_0x5d31('0x14')](_0x5d31('0x15'),_0x42ce8e,'request\x20sent',JSON[_0x5d31('0x16')](_0xc5f20c));if(_0xc5f20c['error']){if(_0xc5f20c[_0x5d31('0x17')][_0x5d31('0x18')]===0x1f4){logger[_0x5d31('0x17')](_0x5d31('0x13'),_0x42ce8e,_0xc5f20c['error']['message']);return _0x28d717(_0xc5f20c[_0x5d31('0x17')][_0x5d31('0x19')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x42ce8e,_0xc5f20c[_0x5d31('0x17')][_0x5d31('0x19')]);return _0x3599ca(_0xc5f20c[_0x5d31('0x17')][_0x5d31('0x19')]);}else{logger[_0x5d31('0x1a')](_0x5d31('0x13'),_0x42ce8e,'request\x20sent');_0x3599ca(_0xc5f20c['result']['message']);}})[_0x5d31('0x1b')](function(_0x1fe2b7){logger[_0x5d31('0x17')](_0x5d31('0x13'),_0x42ce8e,_0x1fe2b7);_0x28d717(_0x1fe2b7);});});}
\ No newline at end of file
index 508f79f..0d6c512 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2e88=['emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save','remove','update'];(function(_0x26f4f5,_0x53419e){var _0x91bf0a=function(_0x144da0){while(--_0x144da0){_0x26f4f5['push'](_0x26f4f5['shift']());}};_0x91bf0a(++_0x53419e);}(_0x2e88,0x95));var _0x82e8=function(_0x491cbe,_0x45c8ba){_0x491cbe=_0x491cbe-0x0;var _0x59449d=_0x2e88[_0x491cbe];return _0x59449d;};'use strict';var ChatWebsiteEvents=require(_0x82e8('0x0'));var events=[_0x82e8('0x1'),_0x82e8('0x2'),_0x82e8('0x3')];function createListener(_0x9dd860,_0x46c27f){return function(_0x552153){_0x46c27f[_0x82e8('0x4')](_0x9dd860,_0x552153);};}function removeListener(_0x1d7415,_0x576435){return function(){ChatWebsiteEvents[_0x82e8('0x5')](_0x1d7415,_0x576435);};}exports[_0x82e8('0x6')]=function(_0x4e909a){for(var _0x3162d1=0x0,_0x1e2496=events[_0x82e8('0x7')];_0x3162d1<_0x1e2496;_0x3162d1++){var _0x27df44=events[_0x3162d1];var _0x393c2c=createListener(_0x82e8('0x8')+_0x27df44,_0x4e909a);ChatWebsiteEvents['on'](_0x27df44,_0x393c2c);}};
\ No newline at end of file
+var _0x228b=['update','emit','length','chatWebsite:','save'];(function(_0x19aa84,_0x549537){var _0x536146=function(_0x5da480){while(--_0x5da480){_0x19aa84['push'](_0x19aa84['shift']());}};_0x536146(++_0x549537);}(_0x228b,0x1f3));var _0xb228=function(_0x21b288,_0x3504d7){_0x21b288=_0x21b288-0x0;var _0x254cd2=_0x228b[_0x21b288];return _0x254cd2;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xb228('0x0'),'remove',_0xb228('0x1')];function createListener(_0x1b53a7,_0x51d0f6){return function(_0x50b1a6){_0x51d0f6[_0xb228('0x2')](_0x1b53a7,_0x50b1a6);};}function removeListener(_0x31d7a8,_0x25e55e){return function(){ChatWebsiteEvents['removeListener'](_0x31d7a8,_0x25e55e);};}exports['register']=function(_0x4ffeb8){for(var _0x2aad54=0x0,_0x48ff05=events[_0xb228('0x3')];_0x2aad54<_0x48ff05;_0x2aad54++){var _0x240814=events[_0x2aad54];var _0x526b1b=createListener(_0xb228('0x4')+_0x240814,_0x4ffeb8);ChatWebsiteEvents['on'](_0x240814,_0x526b1b);}};
\ No newline at end of file
index 6aedde6..f0f681e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1115=['put','update','delete','destroy','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','index','get','isAuthenticated','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','getApplications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','addLogo','file','addAvatar','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','/:id/notify','/:id/offline','offline','addInteraction','/:id/applications','addApplications','/:id/proactive_actions','addProactiveActions','addAgents'];(function(_0x1dc9d9,_0x47321a){var _0xaa3c47=function(_0x53f54b){while(--_0x53f54b){_0x1dc9d9['push'](_0x1dc9d9['shift']());}};_0xaa3c47(++_0x47321a);}(_0x1115,0x1b6));var _0x5111=function(_0x4e3292,_0x4b7dac){_0x4e3292=_0x4e3292-0x0;var _0x2cdb2a=_0x1115[_0x4e3292];return _0x2cdb2a;};'use strict';var multer=require('multer');var util=require(_0x5111('0x0'));var path=require(_0x5111('0x1'));var timeout=require(_0x5111('0x2'));var express=require(_0x5111('0x3'));var router=express[_0x5111('0x4')]();var auth=require(_0x5111('0x5'));var interaction=require(_0x5111('0x6'));var config=require(_0x5111('0x7'));var controller=require(_0x5111('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x5111('0x9')]);router[_0x5111('0xa')]('/describe',auth[_0x5111('0xb')](),controller[_0x5111('0xc')]);router['get'](_0x5111('0xd'),auth['isAuthenticated'](),controller[_0x5111('0xe')]);router[_0x5111('0xa')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x5111('0xf')]);router['get'](_0x5111('0x10'),auth['isAuthenticated'](),controller[_0x5111('0x11')]);router[_0x5111('0xa')](_0x5111('0x12'),controller[_0x5111('0x13')]);router[_0x5111('0xa')](_0x5111('0x14'),controller[_0x5111('0x15')]);router[_0x5111('0xa')](_0x5111('0x16'),controller[_0x5111('0x17')]);router[_0x5111('0xa')](_0x5111('0x18'),controller[_0x5111('0x19')]);router[_0x5111('0xa')](_0x5111('0x1a'),auth[_0x5111('0xb')](),controller[_0x5111('0x1b')]);router[_0x5111('0xa')]('/:id/snippet',controller[_0x5111('0x1c')]);router['get']('/:id/applications',auth[_0x5111('0xb')](),controller[_0x5111('0x1d')]);router[_0x5111('0xa')]('/:id/proactive_actions',auth[_0x5111('0xb')](),controller[_0x5111('0x1e')]);router['get'](_0x5111('0x1f'),controller[_0x5111('0x20')]);router[_0x5111('0xa')](_0x5111('0x21'),auth['isAuthenticated'](),controller[_0x5111('0x22')]);router[_0x5111('0xa')](_0x5111('0x23'),auth[_0x5111('0xb')](),controller[_0x5111('0x24')]);router[_0x5111('0x25')]('/',auth[_0x5111('0xb')](),controller[_0x5111('0x26')]);router[_0x5111('0x25')](_0x5111('0x27'),auth['isAuthenticated'](),controller[_0x5111('0x28')]);router[_0x5111('0x25')](_0x5111('0x10'),auth['isAuthenticated'](),controller[_0x5111('0x29')]);var upload=multer({'storage':multer[_0x5111('0x2a')]({'destination':function(_0x2d9446,_0x268070,_0x10a3fe){_0x10a3fe(null,path[_0x5111('0x2b')](config[_0x5111('0x2c')],_0x5111('0x2d')));},'filename':function(_0x382bd0,_0x1a5793,_0x4ffdc3){_0x4ffdc3(null,util[_0x5111('0x2e')](_0x5111('0x2f'),Date[_0x5111('0x30')](),_0x1a5793[_0x5111('0x31')]));}})});router[_0x5111('0x25')](_0x5111('0x12'),upload[_0x5111('0x32')]('file'),controller[_0x5111('0x33')]);var upload=multer({'storage':multer[_0x5111('0x2a')]({'destination':function(_0x25a75a,_0x5efec6,_0xdf9031){_0xdf9031(null,path[_0x5111('0x2b')](config[_0x5111('0x2c')],'server/files/images/avatars/'));},'filename':function(_0x491a4c,_0x20dea1,_0x5165fc){_0x5165fc(null,util[_0x5111('0x2e')]('%s-%s',Date[_0x5111('0x30')](),_0x20dea1['originalname']));}})});router['post']('/:id/avatar',upload[_0x5111('0x32')](_0x5111('0x34')),controller[_0x5111('0x35')]);var upload=multer({'storage':multer[_0x5111('0x2a')]({'destination':function(_0x13fafe,_0x286b83,_0x2aceaa){_0x2aceaa(null,path['join'](config[_0x5111('0x2c')],_0x5111('0x36')));},'filename':function(_0x1c90e6,_0x26a7af,_0x590428){_0x590428(null,util['format'](_0x5111('0x2f'),Date[_0x5111('0x30')](),_0x26a7af[_0x5111('0x31')]));}})});router[_0x5111('0x25')](_0x5111('0x16'),upload[_0x5111('0x32')](_0x5111('0x34')),controller[_0x5111('0x37')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x159cb5,_0x3cd7f8,_0x35d68c){_0x35d68c(null,path['join'](config[_0x5111('0x2c')],_0x5111('0x36')));},'filename':function(_0x2e407e,_0x5b76f8,_0x4ecbc9){_0x4ecbc9(null,util['format'](_0x5111('0x2f'),Date[_0x5111('0x30')](),_0x5b76f8[_0x5111('0x31')]));}})});router[_0x5111('0x25')](_0x5111('0x18'),upload['single'](_0x5111('0x34')),controller[_0x5111('0x38')]);router[_0x5111('0x25')](_0x5111('0x39'),controller['notify']);router[_0x5111('0x25')](_0x5111('0x3a'),controller[_0x5111('0x3b')]);router[_0x5111('0x25')](_0x5111('0x1a'),auth[_0x5111('0xb')](),controller[_0x5111('0x3c')]);router[_0x5111('0x25')](_0x5111('0x3d'),auth[_0x5111('0xb')](),controller[_0x5111('0x3e')]);router[_0x5111('0x25')](_0x5111('0x3f'),auth['isAuthenticated'](),controller[_0x5111('0x40')]);router[_0x5111('0x25')]('/:id/users',auth[_0x5111('0xb')](),controller[_0x5111('0x41')]);router[_0x5111('0x42')](_0x5111('0xd'),auth[_0x5111('0xb')](),controller[_0x5111('0x43')]);router[_0x5111('0x44')]('/:id',auth[_0x5111('0xb')](),controller[_0x5111('0x45')]);router[_0x5111('0x44')](_0x5111('0x27'),auth[_0x5111('0xb')](),controller['removeDispositions']);router['delete'](_0x5111('0x10'),auth[_0x5111('0xb')](),controller['removeAnswers']);router[_0x5111('0x44')](_0x5111('0x23'),auth[_0x5111('0xb')](),controller[_0x5111('0x46')]);module[_0x5111('0x47')]=router;
\ No newline at end of file
+var _0x9ab0=['index','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','getApplications','getProactiveActions','/:id/fields','getFields','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','now','originalname','single','file','addLogo','server/files/images/avatars/','%s-%s','addAvatar','/:id/notify','notify','offline','addInteraction','/:id/applications','addApplications','/:id/proactive_actions','addAgents','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x55015a,_0x189ca1){var _0x3b17d4=function(_0x1bf11c){while(--_0x1bf11c){_0x55015a['push'](_0x55015a['shift']());}};_0x3b17d4(++_0x189ca1);}(_0x9ab0,0x195));var _0x09ab=function(_0x16c127,_0x967420){_0x16c127=_0x16c127-0x0;var _0x139744=_0x9ab0[_0x16c127];return _0x139744;};'use strict';var multer=require(_0x09ab('0x0'));var util=require(_0x09ab('0x1'));var path=require(_0x09ab('0x2'));var timeout=require(_0x09ab('0x3'));var express=require(_0x09ab('0x4'));var router=express[_0x09ab('0x5')]();var auth=require(_0x09ab('0x6'));var interaction=require(_0x09ab('0x7'));var config=require(_0x09ab('0x8'));var controller=require('./chatWebsite.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x09ab('0x9')]);router[_0x09ab('0xa')](_0x09ab('0xb'),auth[_0x09ab('0xc')](),controller[_0x09ab('0xd')]);router[_0x09ab('0xa')](_0x09ab('0xe'),auth[_0x09ab('0xc')](),controller[_0x09ab('0xf')]);router['get'](_0x09ab('0x10'),auth['isAuthenticated'](),controller[_0x09ab('0x11')]);router[_0x09ab('0xa')](_0x09ab('0x12'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x09ab('0xa')](_0x09ab('0x13'),controller['getLogo']);router['get'](_0x09ab('0x14'),controller[_0x09ab('0x15')]);router[_0x09ab('0xa')](_0x09ab('0x16'),controller[_0x09ab('0x17')]);router[_0x09ab('0xa')](_0x09ab('0x18'),controller[_0x09ab('0x19')]);router[_0x09ab('0xa')](_0x09ab('0x1a'),auth[_0x09ab('0xc')](),controller[_0x09ab('0x1b')]);router['get'](_0x09ab('0x1c'),controller[_0x09ab('0x1d')]);router[_0x09ab('0xa')]('/:id/applications',auth[_0x09ab('0xc')](),controller[_0x09ab('0x1e')]);router[_0x09ab('0xa')]('/:id/proactive_actions',auth[_0x09ab('0xc')](),controller[_0x09ab('0x1f')]);router[_0x09ab('0xa')](_0x09ab('0x20'),controller[_0x09ab('0x21')]);router[_0x09ab('0xa')]('/:id/offline_messages',auth[_0x09ab('0xc')](),controller[_0x09ab('0x22')]);router['get'](_0x09ab('0x23'),auth[_0x09ab('0xc')](),controller[_0x09ab('0x24')]);router[_0x09ab('0x25')]('/',auth[_0x09ab('0xc')](),controller[_0x09ab('0x26')]);router[_0x09ab('0x25')](_0x09ab('0x10'),auth['isAuthenticated'](),controller[_0x09ab('0x27')]);router[_0x09ab('0x25')](_0x09ab('0x12'),auth[_0x09ab('0xc')](),controller[_0x09ab('0x28')]);var upload=multer({'storage':multer[_0x09ab('0x29')]({'destination':function(_0x597beb,_0x414277,_0x26d939){_0x26d939(null,path[_0x09ab('0x2a')](config[_0x09ab('0x2b')],_0x09ab('0x2c')));},'filename':function(_0x4c776b,_0x50a95b,_0x21ed17){_0x21ed17(null,util[_0x09ab('0x2d')]('%s-%s',Date[_0x09ab('0x2e')](),_0x50a95b[_0x09ab('0x2f')]));}})});router[_0x09ab('0x25')](_0x09ab('0x13'),upload[_0x09ab('0x30')](_0x09ab('0x31')),controller[_0x09ab('0x32')]);var upload=multer({'storage':multer[_0x09ab('0x29')]({'destination':function(_0x55c5f0,_0x1f4eed,_0x2d4028){_0x2d4028(null,path[_0x09ab('0x2a')](config[_0x09ab('0x2b')],_0x09ab('0x33')));},'filename':function(_0x387271,_0x2dae4d,_0x281fe9){_0x281fe9(null,util[_0x09ab('0x2d')](_0x09ab('0x34'),Date[_0x09ab('0x2e')](),_0x2dae4d[_0x09ab('0x2f')]));}})});router[_0x09ab('0x25')]('/:id/avatar',upload[_0x09ab('0x30')](_0x09ab('0x31')),controller[_0x09ab('0x35')]);var upload=multer({'storage':multer[_0x09ab('0x29')]({'destination':function(_0x3e2930,_0x11bf0d,_0x2653ec){_0x2653ec(null,path[_0x09ab('0x2a')](config[_0x09ab('0x2b')],'server/files/images/avatars/'));},'filename':function(_0x488946,_0x3b7e4f,_0x2e24e8){_0x2e24e8(null,util['format'](_0x09ab('0x34'),Date[_0x09ab('0x2e')](),_0x3b7e4f[_0x09ab('0x2f')]));}})});router['post'](_0x09ab('0x16'),upload[_0x09ab('0x30')](_0x09ab('0x31')),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a225c,_0x2141a3,_0x33af6c){_0x33af6c(null,path[_0x09ab('0x2a')](config[_0x09ab('0x2b')],'server/files/images/avatars/'));},'filename':function(_0x307aca,_0x3080ca,_0x4f7966){_0x4f7966(null,util[_0x09ab('0x2d')](_0x09ab('0x34'),Date['now'](),_0x3080ca['originalname']));}})});router['post']('/:id/system_avatar',upload[_0x09ab('0x30')](_0x09ab('0x31')),controller['addSystemAvatar']);router[_0x09ab('0x25')](_0x09ab('0x36'),controller[_0x09ab('0x37')]);router[_0x09ab('0x25')]('/:id/offline',controller[_0x09ab('0x38')]);router[_0x09ab('0x25')](_0x09ab('0x1a'),auth[_0x09ab('0xc')](),controller[_0x09ab('0x39')]);router[_0x09ab('0x25')](_0x09ab('0x3a'),auth[_0x09ab('0xc')](),controller[_0x09ab('0x3b')]);router[_0x09ab('0x25')](_0x09ab('0x3c'),auth[_0x09ab('0xc')](),controller['addProactiveActions']);router[_0x09ab('0x25')](_0x09ab('0x23'),auth[_0x09ab('0xc')](),controller[_0x09ab('0x3d')]);router[_0x09ab('0x3e')]('/:id',auth[_0x09ab('0xc')](),controller['update']);router[_0x09ab('0x3f')](_0x09ab('0xe'),auth[_0x09ab('0xc')](),controller[_0x09ab('0x40')]);router[_0x09ab('0x3f')]('/:id/dispositions',auth[_0x09ab('0xc')](),controller[_0x09ab('0x41')]);router[_0x09ab('0x3f')](_0x09ab('0x12'),auth[_0x09ab('0xc')](),controller[_0x09ab('0x42')]);router[_0x09ab('0x3f')](_0x09ab('0x23'),auth[_0x09ab('0xc')](),controller[_0x09ab('0x43')]);module[_0x09ab('0x44')]=router;
\ No newline at end of file
index acb8882..e1899f7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd5d6=['name','sequelize','STRING'];(function(_0x50768d,_0x107eb0){var _0x27ae73=function(_0x398a95){while(--_0x398a95){_0x50768d['push'](_0x50768d['shift']());}};_0x27ae73(++_0x107eb0);}(_0xd5d6,0x14e));var _0x6d5d=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xd5d6[_0x4709c0];return _0x13348b;};'use strict';var Sequelize=require(_0x6d5d('0x0'));module['exports']={'name':{'type':Sequelize[_0x6d5d('0x1')],'unique':_0x6d5d('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x6d5d('0x1')]},'companyId':{'type':Sequelize[_0x6d5d('0x1')]},'website':{'type':Sequelize[_0x6d5d('0x1')]},'phone':{'type':Sequelize[_0x6d5d('0x1')]},'fax':{'type':Sequelize[_0x6d5d('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x6d5d('0x1')]},'city':{'type':Sequelize[_0x6d5d('0x1')]},'country':{'type':Sequelize[_0x6d5d('0x1')]},'email':{'type':Sequelize[_0x6d5d('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x6d5d('0x1')]},'sStreet':{'type':Sequelize[_0x6d5d('0x1')]},'sPostalCode':{'type':Sequelize[_0x6d5d('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x6d5d('0x1')]},'description':{'type':Sequelize[_0x6d5d('0x1')]}};
\ No newline at end of file
+var _0x6707=['STRING','name','sequelize','exports'];(function(_0x28ce43,_0x1f3fea){var _0x239367=function(_0x15dd10){while(--_0x15dd10){_0x28ce43['push'](_0x28ce43['shift']());}};_0x239367(++_0x1f3fea);}(_0x6707,0x6a));var _0x7670=function(_0x589aee,_0x140a03){_0x589aee=_0x589aee-0x0;var _0x2f5ed4=_0x6707[_0x589aee];return _0x2f5ed4;};'use strict';var Sequelize=require(_0x7670('0x0'));module[_0x7670('0x1')]={'name':{'type':Sequelize[_0x7670('0x2')],'unique':_0x7670('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x7670('0x2')]},'companyId':{'type':Sequelize[_0x7670('0x2')]},'website':{'type':Sequelize[_0x7670('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x7670('0x2')]},'type':{'type':Sequelize[_0x7670('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x7670('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x7670('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x7670('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x7670('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x7670('0x2')]},'description':{'type':Sequelize[_0x7670('0x2')]}};
\ No newline at end of file
index dc924ee..7e8ee15 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7afb=['create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Companies','UserProfileSection','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','CmContact','order','getContacts','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','UserProfileResource','destroy','then','error','index','model','keys','query','intersection','fields','attributes','length','sort','where','filters','pick','filter','merge','map','type','key','options','CmCompany','includeAll','include','findAll','catch','params','rawAttributes','find'];(function(_0x9be28f,_0x231334){var _0xa9f52d=function(_0x239dad){while(--_0x239dad){_0x9be28f['push'](_0x9be28f['shift']());}};_0xa9f52d(++_0x231334);}(_0x7afb,0x153));var _0xb7af=function(_0x29ef8f,_0x469128){_0x29ef8f=_0x29ef8f-0x0;var _0x415acc=_0x7afb[_0x29ef8f];return _0x415acc;};'use strict';var pdf=require(_0xb7af('0x0'));var emlformat=require(_0xb7af('0x1'));var rimraf=require(_0xb7af('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb7af('0x3'));var rp=require(_0xb7af('0x4'));var moment=require(_0xb7af('0x5'));var BPromise=require(_0xb7af('0x6'));var Mustache=require('mustache');var util=require(_0xb7af('0x7'));var path=require(_0xb7af('0x8'));var sox=require(_0xb7af('0x9'));var csv=require(_0xb7af('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb7af('0xb'));var squel=require(_0xb7af('0xc'));var crypto=require(_0xb7af('0xd'));var jsforce=require(_0xb7af('0xe'));var deskjs=require(_0xb7af('0xf'));var toCsv=require(_0xb7af('0xa'));var querystring=require(_0xb7af('0x10'));var Papa=require('papaparse');var authService=require(_0xb7af('0x11'));var hardwareService=require(_0xb7af('0x12'));var Redis=require(_0xb7af('0x13'));var qs=require(_0xb7af('0x14'));var logger=require('../../config/logger')(_0xb7af('0x15'));var utils=require(_0xb7af('0x16'));var config=require(_0xb7af('0x17'));var db=require(_0xb7af('0x18'))['db'];function respondWithStatusCode(_0x529ffc,_0x5bafab){_0x5bafab=_0x5bafab||0xcc;return function(_0x307f52){if(_0x307f52){return _0x529ffc[_0xb7af('0x19')](_0x5bafab);}return _0x529ffc[_0xb7af('0x1a')](_0x5bafab)[_0xb7af('0x1b')]();};}function respondWithResult(_0x5ca7b8,_0x3a1e29){_0x3a1e29=_0x3a1e29||0xc8;return function(_0x1ebea2){if(_0x1ebea2){return _0x5ca7b8[_0xb7af('0x1a')](_0x3a1e29)[_0xb7af('0x1c')](_0x1ebea2);}};}function respondWithFilteredResult(_0xd72093,_0x59d3ad){return function(_0xa8b472){if(_0xa8b472){var _0xe5e550=_0xa8b472[_0xb7af('0x1d')],_0x18d344=_0x59d3ad[_0xb7af('0x1e')],_0x3a9ac3=_0x59d3ad['offset']+_0x59d3ad[_0xb7af('0x1f')],_0x594b8b;if(_0x3a9ac3>=_0xe5e550){_0x3a9ac3=_0xe5e550;_0x594b8b=0xc8;}else{_0x594b8b=0xce;}_0xd72093[_0xb7af('0x1a')](_0x594b8b);return _0xd72093['set'](_0xb7af('0x20'),_0x18d344+'-'+_0x3a9ac3+'/'+_0xe5e550)[_0xb7af('0x1c')](_0xa8b472);}return null;};}function patchUpdates(_0x20abbc){return function(_0xa76021){try{jsonpatch[_0xb7af('0x21')](_0xa76021,_0x20abbc,!![]);}catch(_0x5ba306){return BPromise['reject'](_0x5ba306);}return _0xa76021[_0xb7af('0x22')]();};}function saveUpdates(_0x25c9ad,_0x10d4a8){return function(_0x389d22){if(_0x389d22){return _0x389d22[_0xb7af('0x23')](_0x25c9ad)['then'](function(_0x181db2){return _0x181db2;});}return null;};}function removeEntity(_0x1da35f,_0x4ddb99){return function(_0x516b04){if(_0x516b04){return _0x516b04['destroy']()['then'](function(){var _0x6f804=_0x516b04['get']({'plain':!![]});var _0x430fc5='Companies';return db[_0xb7af('0x24')][_0xb7af('0x25')]({'where':{'type':_0x430fc5,'resourceId':_0x6f804['id']}})[_0xb7af('0x26')](function(){return _0x516b04;});})[_0xb7af('0x26')](function(){_0x1da35f['status'](0xcc)[_0xb7af('0x1b')]();});}};}function handleEntityNotFound(_0x36d1bd,_0x3bf09b){return function(_0x96a847){if(!_0x96a847){_0x36d1bd[_0xb7af('0x19')](0x194);}return _0x96a847;};}function handleError(_0x11d974,_0x48a0b1){_0x48a0b1=_0x48a0b1||0x1f4;return function(_0x54a9e3){logger[_0xb7af('0x27')](_0x54a9e3['stack']);if(_0x54a9e3['name']){delete _0x54a9e3['name'];}_0x11d974[_0xb7af('0x1a')](_0x48a0b1)['send'](_0x54a9e3);};}exports[_0xb7af('0x28')]=function(_0x3c3b20,_0x33f2fa){var _0x247246={},_0x2e77fd={},_0x20e27b={'count':0x0,'rows':[]};var _0x562774=db['CmCompany']['rawAttributes'];_0x2e77fd[_0xb7af('0x29')]=_[_0xb7af('0x2a')](_0x562774);_0x2e77fd[_0xb7af('0x2b')]=_[_0xb7af('0x2a')](_0x3c3b20[_0xb7af('0x2b')]);_0x2e77fd['filters']=_[_0xb7af('0x2c')](_0x2e77fd[_0xb7af('0x29')],_0x2e77fd[_0xb7af('0x2b')]);_0x247246['attributes']=_[_0xb7af('0x2c')](_0x2e77fd[_0xb7af('0x29')],qs[_0xb7af('0x2d')](_0x3c3b20[_0xb7af('0x2b')][_0xb7af('0x2d')]));_0x247246[_0xb7af('0x2e')]=_0x247246['attributes'][_0xb7af('0x2f')]?_0x247246['attributes']:_0x2e77fd[_0xb7af('0x29')];if(!_0x3c3b20[_0xb7af('0x2b')]['hasOwnProperty']('nolimit')){_0x247246[_0xb7af('0x1f')]=qs['limit'](_0x3c3b20[_0xb7af('0x2b')][_0xb7af('0x1f')]);_0x247246[_0xb7af('0x1e')]=qs[_0xb7af('0x1e')](_0x3c3b20[_0xb7af('0x2b')][_0xb7af('0x1e')]);}_0x247246['order']=qs['sort'](_0x3c3b20['query'][_0xb7af('0x30')]);_0x247246[_0xb7af('0x31')]=qs[_0xb7af('0x32')](_[_0xb7af('0x33')](_0x3c3b20['query'],_0x2e77fd[_0xb7af('0x32')]));if(_0x3c3b20['query'][_0xb7af('0x34')]){_0x247246['where']=_[_0xb7af('0x35')](_0x247246[_0xb7af('0x31')],{'$or':_[_0xb7af('0x36')](_0x562774,function(_0x21afb7){if(_0x21afb7[_0xb7af('0x37')][_0xb7af('0x38')]!=='VIRTUAL'){var _0x3188bf={};_0x3188bf[_0x21afb7['field']]={'$like':'%'+_0x3c3b20[_0xb7af('0x2b')]['filter']+'%'};return _0x3188bf;}})});}_0x247246=_[_0xb7af('0x35')]({},_0x247246,_0x3c3b20[_0xb7af('0x39')]);var _0x3ab58a={'where':_0x247246[_0xb7af('0x31')]};return db[_0xb7af('0x3a')][_0xb7af('0x1d')](_0x3ab58a)[_0xb7af('0x26')](function(_0x5cfdca){_0x20e27b[_0xb7af('0x1d')]=_0x5cfdca;if(_0x3c3b20[_0xb7af('0x2b')][_0xb7af('0x3b')]){_0x247246[_0xb7af('0x3c')]=[{'all':!![]}];}return db['CmCompany'][_0xb7af('0x3d')](_0x247246);})[_0xb7af('0x26')](function(_0x38af01){_0x20e27b['rows']=_0x38af01;return _0x20e27b;})[_0xb7af('0x26')](respondWithFilteredResult(_0x33f2fa,_0x247246))[_0xb7af('0x3e')](handleError(_0x33f2fa,null));};exports['show']=function(_0x4f2e64,_0x2e58d0){var _0x285f81={'raw':![],'where':{'id':_0x4f2e64[_0xb7af('0x3f')]['id']}},_0x3ebf3f={};_0x3ebf3f['model']=_[_0xb7af('0x2a')](db['CmCompany'][_0xb7af('0x40')]);_0x3ebf3f['query']=_[_0xb7af('0x2a')](_0x4f2e64[_0xb7af('0x2b')]);_0x3ebf3f[_0xb7af('0x32')]=_[_0xb7af('0x2c')](_0x3ebf3f[_0xb7af('0x29')],_0x3ebf3f[_0xb7af('0x2b')]);_0x285f81[_0xb7af('0x2e')]=_[_0xb7af('0x2c')](_0x3ebf3f[_0xb7af('0x29')],qs['fields'](_0x4f2e64[_0xb7af('0x2b')]['fields']));_0x285f81['attributes']=_0x285f81['attributes'][_0xb7af('0x2f')]?_0x285f81[_0xb7af('0x2e')]:_0x3ebf3f['model'];if(_0x4f2e64[_0xb7af('0x2b')]['includeAll']){_0x285f81['include']=[{'all':!![]}];}_0x285f81=_[_0xb7af('0x35')]({},_0x285f81,_0x4f2e64[_0xb7af('0x39')]);return db[_0xb7af('0x3a')][_0xb7af('0x41')](_0x285f81)[_0xb7af('0x26')](handleEntityNotFound(_0x2e58d0,null))['then'](respondWithResult(_0x2e58d0,null))['catch'](handleError(_0x2e58d0,null));};exports[_0xb7af('0x42')]=function(_0x5716d8,_0x1d4629){return db[_0xb7af('0x3a')][_0xb7af('0x42')](_0x5716d8[_0xb7af('0x43')],{})[_0xb7af('0x26')](function(_0x4e4048){var _0x224412=_0x5716d8[_0xb7af('0x44')][_0xb7af('0x45')]({'plain':!![]});if(!_0x224412)throw new Error(_0xb7af('0x46'));if(_0x224412['role']===_0xb7af('0x44')){var _0x3ce8f0=_0x4e4048[_0xb7af('0x45')]({'plain':!![]});var _0x3cbfd0=_0xb7af('0x47');return db[_0xb7af('0x48')][_0xb7af('0x41')]({'where':{'name':_0x3cbfd0,'userProfileId':_0x224412['userProfileId']},'raw':!![]})[_0xb7af('0x26')](function(_0x20e57f){if(_0x20e57f&&_0x20e57f[_0xb7af('0x49')]===0x0){return db['UserProfileResource'][_0xb7af('0x42')]({'name':_0x3ce8f0[_0xb7af('0x4a')],'resourceId':_0x3ce8f0['id'],'type':_0x20e57f[_0xb7af('0x4a')],'sectionId':_0x20e57f['id']},{})[_0xb7af('0x26')](function(){return _0x4e4048;});}else{return _0x4e4048;}})[_0xb7af('0x3e')](function(_0x2232c5){logger[_0xb7af('0x27')](_0xb7af('0x4b'),_0x2232c5);throw _0x2232c5;});}return _0x4e4048;})[_0xb7af('0x26')](respondWithResult(_0x1d4629,0xc9))[_0xb7af('0x3e')](handleError(_0x1d4629,null));};exports['update']=function(_0x5cbf37,_0x5a46ef){if(_0x5cbf37[_0xb7af('0x43')]['id']){delete _0x5cbf37[_0xb7af('0x43')]['id'];}return db[_0xb7af('0x3a')][_0xb7af('0x41')]({'where':{'id':_0x5cbf37['params']['id']}})['then'](handleEntityNotFound(_0x5a46ef,null))[_0xb7af('0x26')](saveUpdates(_0x5cbf37[_0xb7af('0x43')],null))['then'](respondWithResult(_0x5a46ef,null))['catch'](handleError(_0x5a46ef,null));};exports[_0xb7af('0x25')]=function(_0x635f75,_0x4bc8ea){return db[_0xb7af('0x3a')][_0xb7af('0x41')]({'where':{'id':_0x635f75['params']['id']}})[_0xb7af('0x26')](handleEntityNotFound(_0x4bc8ea,null))[_0xb7af('0x26')](removeEntity(_0x4bc8ea,null))[_0xb7af('0x3e')](handleError(_0x4bc8ea,null));};exports[_0xb7af('0x4c')]=function(_0x4da8d9,_0x19f15a,_0x2eecd5){return db['CmContact']['find']({'where':{'id':_0x4da8d9[_0xb7af('0x3f')]['id']}})[_0xb7af('0x26')](handleEntityNotFound(_0x19f15a,null))['then'](function(_0x19bddf){if(_0x19bddf){return _0x19bddf[_0xb7af('0x4c')](_0x4da8d9[_0xb7af('0x43')][_0xb7af('0x4d')],_['omit'](_0x4da8d9[_0xb7af('0x43')],[_0xb7af('0x4d'),'id'])||{});}})['then'](respondWithResult(_0x19f15a,null))['catch'](handleError(_0x19f15a,null));};exports['getContacts']=function(_0x4bb930,_0x5440c5,_0x2712cd){var _0x2f9b68={};var _0x59a8a1={};var _0x280081;var _0x2c1650;return db[_0xb7af('0x3a')]['findOne']({'where':{'id':_0x4bb930['params']['id']}})[_0xb7af('0x26')](handleEntityNotFound(_0x5440c5,null))[_0xb7af('0x26')](function(_0x474c09){if(_0x474c09){_0x280081=_0x474c09;_0x59a8a1[_0xb7af('0x29')]=_[_0xb7af('0x2a')](db[_0xb7af('0x4e')][_0xb7af('0x40')]);_0x59a8a1[_0xb7af('0x2b')]=_['keys'](_0x4bb930['query']);_0x59a8a1['filters']=_[_0xb7af('0x2c')](_0x59a8a1['model'],_0x59a8a1[_0xb7af('0x2b')]);_0x2f9b68['attributes']=_[_0xb7af('0x2c')](_0x59a8a1[_0xb7af('0x29')],qs[_0xb7af('0x2d')](_0x4bb930['query'][_0xb7af('0x2d')]));_0x2f9b68['attributes']=_0x2f9b68[_0xb7af('0x2e')][_0xb7af('0x2f')]?_0x2f9b68[_0xb7af('0x2e')]:_0x59a8a1[_0xb7af('0x29')];_0x2f9b68[_0xb7af('0x4f')]=qs[_0xb7af('0x30')](_0x4bb930['query'][_0xb7af('0x30')]);_0x2f9b68['where']=qs[_0xb7af('0x32')](_['pick'](_0x4bb930[_0xb7af('0x2b')],_0x59a8a1['filters']));if(_0x4bb930[_0xb7af('0x2b')][_0xb7af('0x34')]){_0x2f9b68['where']=_[_0xb7af('0x35')](_0x2f9b68[_0xb7af('0x31')],{'$or':_['map'](_0x2f9b68[_0xb7af('0x2e')],function(_0x2a0d1c){var _0x1d8724={};_0x1d8724[_0x2a0d1c]={'$like':'%'+_0x4bb930['query']['filter']+'%'};return _0x1d8724;})});}_0x2f9b68=_[_0xb7af('0x35')]({},_0x2f9b68,_0x4bb930['options']);return _0x280081[_0xb7af('0x50')](_0x2f9b68);}})['then'](function(_0x50a8bf){if(_0x50a8bf){_0x2c1650=_0x50a8bf[_0xb7af('0x2f')];if(!_0x4bb930[_0xb7af('0x2b')]['hasOwnProperty']('nolimit')){_0x2f9b68[_0xb7af('0x1f')]=qs[_0xb7af('0x1f')](_0x4bb930['query']['limit']);_0x2f9b68[_0xb7af('0x1e')]=qs['offset'](_0x4bb930[_0xb7af('0x2b')]['offset']);}return _0x280081[_0xb7af('0x50')](_0x2f9b68);}})[_0xb7af('0x26')](function(_0x48c86e){if(_0x48c86e){return _0x48c86e?{'count':_0x2c1650,'rows':_0x48c86e}:null;}})[_0xb7af('0x26')](respondWithResult(_0x5440c5,null))['catch'](handleError(_0x5440c5,null));};
\ No newline at end of file
+var _0xcc19=['CmContact','ids','omit','findOne','hasOwnProperty','nolimit','getContacts','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','ioredis','api','../../mysqldb','sendStatus','status','end','count','offset','limit','set','apply','reject','save','then','get','Companies','destroy','stack','name','send','index','CmCompany','rawAttributes','model','query','keys','intersection','fields','attributes','length','order','sort','where','filters','pick','filter','merge','map','key','field','options','include','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','update','params','addContacts'];(function(_0x55414a,_0x276000){var _0x232050=function(_0x54ebe2){while(--_0x54ebe2){_0x55414a['push'](_0x55414a['shift']());}};_0x232050(++_0x276000);}(_0xcc19,0xa1));var _0x9cc1=function(_0x1d603a,_0x2b814e){_0x1d603a=_0x1d603a-0x0;var _0x4b76b4=_0xcc19[_0x1d603a];return _0x4b76b4;};'use strict';var pdf=require(_0x9cc1('0x0'));var emlformat=require(_0x9cc1('0x1'));var rimraf=require(_0x9cc1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9cc1('0x3'));var rp=require(_0x9cc1('0x4'));var moment=require('moment');var BPromise=require(_0x9cc1('0x5'));var Mustache=require(_0x9cc1('0x6'));var util=require(_0x9cc1('0x7'));var path=require(_0x9cc1('0x8'));var sox=require(_0x9cc1('0x9'));var csv=require(_0x9cc1('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9cc1('0xb'));var squel=require('squel');var crypto=require(_0x9cc1('0xc'));var jsforce=require(_0x9cc1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9cc1('0xa'));var querystring=require(_0x9cc1('0xe'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x9cc1('0xf'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x9cc1('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x9cc1('0x11'))['db'];function respondWithStatusCode(_0x46dc16,_0x4e878e){_0x4e878e=_0x4e878e||0xcc;return function(_0x1187b8){if(_0x1187b8){return _0x46dc16[_0x9cc1('0x12')](_0x4e878e);}return _0x46dc16[_0x9cc1('0x13')](_0x4e878e)[_0x9cc1('0x14')]();};}function respondWithResult(_0x3a107f,_0x3430b8){_0x3430b8=_0x3430b8||0xc8;return function(_0x53cfa6){if(_0x53cfa6){return _0x3a107f[_0x9cc1('0x13')](_0x3430b8)['json'](_0x53cfa6);}};}function respondWithFilteredResult(_0x57e4f3,_0x259338){return function(_0x5c436b){if(_0x5c436b){var _0x8ca6a0=_0x5c436b[_0x9cc1('0x15')],_0x2df45f=_0x259338[_0x9cc1('0x16')],_0x5c6258=_0x259338[_0x9cc1('0x16')]+_0x259338[_0x9cc1('0x17')],_0x311d5c;if(_0x5c6258>=_0x8ca6a0){_0x5c6258=_0x8ca6a0;_0x311d5c=0xc8;}else{_0x311d5c=0xce;}_0x57e4f3[_0x9cc1('0x13')](_0x311d5c);return _0x57e4f3[_0x9cc1('0x18')]('Content-Range',_0x2df45f+'-'+_0x5c6258+'/'+_0x8ca6a0)['json'](_0x5c436b);}return null;};}function patchUpdates(_0x550129){return function(_0x1aff20){try{jsonpatch[_0x9cc1('0x19')](_0x1aff20,_0x550129,!![]);}catch(_0x102a68){return BPromise[_0x9cc1('0x1a')](_0x102a68);}return _0x1aff20[_0x9cc1('0x1b')]();};}function saveUpdates(_0x5be269,_0x1be237){return function(_0x7b297){if(_0x7b297){return _0x7b297['update'](_0x5be269)['then'](function(_0x5135c3){return _0x5135c3;});}return null;};}function removeEntity(_0x1db953,_0x475be5){return function(_0x312ccd){if(_0x312ccd){return _0x312ccd['destroy']()[_0x9cc1('0x1c')](function(){var _0x557f65=_0x312ccd[_0x9cc1('0x1d')]({'plain':!![]});var _0x2af0ce=_0x9cc1('0x1e');return db['UserProfileResource'][_0x9cc1('0x1f')]({'where':{'type':_0x2af0ce,'resourceId':_0x557f65['id']}})[_0x9cc1('0x1c')](function(){return _0x312ccd;});})[_0x9cc1('0x1c')](function(){_0x1db953[_0x9cc1('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ea0fd,_0xa11bdf){return function(_0x18c1ff){if(!_0x18c1ff){_0x1ea0fd[_0x9cc1('0x12')](0x194);}return _0x18c1ff;};}function handleError(_0x1c0591,_0x62989f){_0x62989f=_0x62989f||0x1f4;return function(_0x51613d){logger['error'](_0x51613d[_0x9cc1('0x20')]);if(_0x51613d[_0x9cc1('0x21')]){delete _0x51613d[_0x9cc1('0x21')];}_0x1c0591[_0x9cc1('0x13')](_0x62989f)[_0x9cc1('0x22')](_0x51613d);};}exports[_0x9cc1('0x23')]=function(_0x50d1a2,_0xe9cf67){var _0xaa4796={},_0x25642d={},_0x304a70={'count':0x0,'rows':[]};var _0x23454c=db[_0x9cc1('0x24')][_0x9cc1('0x25')];_0x25642d[_0x9cc1('0x26')]=_['keys'](_0x23454c);_0x25642d[_0x9cc1('0x27')]=_[_0x9cc1('0x28')](_0x50d1a2['query']);_0x25642d['filters']=_[_0x9cc1('0x29')](_0x25642d[_0x9cc1('0x26')],_0x25642d[_0x9cc1('0x27')]);_0xaa4796['attributes']=_[_0x9cc1('0x29')](_0x25642d['model'],qs[_0x9cc1('0x2a')](_0x50d1a2[_0x9cc1('0x27')][_0x9cc1('0x2a')]));_0xaa4796['attributes']=_0xaa4796[_0x9cc1('0x2b')][_0x9cc1('0x2c')]?_0xaa4796['attributes']:_0x25642d[_0x9cc1('0x26')];if(!_0x50d1a2[_0x9cc1('0x27')]['hasOwnProperty']('nolimit')){_0xaa4796['limit']=qs[_0x9cc1('0x17')](_0x50d1a2['query'][_0x9cc1('0x17')]);_0xaa4796['offset']=qs['offset'](_0x50d1a2['query']['offset']);}_0xaa4796[_0x9cc1('0x2d')]=qs['sort'](_0x50d1a2[_0x9cc1('0x27')][_0x9cc1('0x2e')]);_0xaa4796[_0x9cc1('0x2f')]=qs[_0x9cc1('0x30')](_[_0x9cc1('0x31')](_0x50d1a2[_0x9cc1('0x27')],_0x25642d['filters']));if(_0x50d1a2[_0x9cc1('0x27')][_0x9cc1('0x32')]){_0xaa4796[_0x9cc1('0x2f')]=_[_0x9cc1('0x33')](_0xaa4796[_0x9cc1('0x2f')],{'$or':_[_0x9cc1('0x34')](_0x23454c,function(_0x3a8595){if(_0x3a8595['type'][_0x9cc1('0x35')]!=='VIRTUAL'){var _0x2a17c5={};_0x2a17c5[_0x3a8595[_0x9cc1('0x36')]]={'$like':'%'+_0x50d1a2['query'][_0x9cc1('0x32')]+'%'};return _0x2a17c5;}})});}_0xaa4796=_[_0x9cc1('0x33')]({},_0xaa4796,_0x50d1a2[_0x9cc1('0x37')]);var _0x5836c5={'where':_0xaa4796['where']};return db[_0x9cc1('0x24')]['count'](_0x5836c5)[_0x9cc1('0x1c')](function(_0x562d48){_0x304a70['count']=_0x562d48;if(_0x50d1a2[_0x9cc1('0x27')]['includeAll']){_0xaa4796[_0x9cc1('0x38')]=[{'all':!![]}];}return db[_0x9cc1('0x24')]['findAll'](_0xaa4796);})[_0x9cc1('0x1c')](function(_0x42fa38){_0x304a70[_0x9cc1('0x39')]=_0x42fa38;return _0x304a70;})['then'](respondWithFilteredResult(_0xe9cf67,_0xaa4796))[_0x9cc1('0x3a')](handleError(_0xe9cf67,null));};exports[_0x9cc1('0x3b')]=function(_0x57e0ee,_0x5d5f4e){var _0x45157d={'raw':![],'where':{'id':_0x57e0ee['params']['id']}},_0x1a37bc={};_0x1a37bc['model']=_[_0x9cc1('0x28')](db[_0x9cc1('0x24')][_0x9cc1('0x25')]);_0x1a37bc['query']=_[_0x9cc1('0x28')](_0x57e0ee['query']);_0x1a37bc[_0x9cc1('0x30')]=_[_0x9cc1('0x29')](_0x1a37bc[_0x9cc1('0x26')],_0x1a37bc[_0x9cc1('0x27')]);_0x45157d['attributes']=_['intersection'](_0x1a37bc[_0x9cc1('0x26')],qs[_0x9cc1('0x2a')](_0x57e0ee[_0x9cc1('0x27')][_0x9cc1('0x2a')]));_0x45157d[_0x9cc1('0x2b')]=_0x45157d[_0x9cc1('0x2b')][_0x9cc1('0x2c')]?_0x45157d['attributes']:_0x1a37bc['model'];if(_0x57e0ee[_0x9cc1('0x27')]['includeAll']){_0x45157d[_0x9cc1('0x38')]=[{'all':!![]}];}_0x45157d=_['merge']({},_0x45157d,_0x57e0ee[_0x9cc1('0x37')]);return db['CmCompany'][_0x9cc1('0x3c')](_0x45157d)[_0x9cc1('0x1c')](handleEntityNotFound(_0x5d5f4e,null))[_0x9cc1('0x1c')](respondWithResult(_0x5d5f4e,null))[_0x9cc1('0x3a')](handleError(_0x5d5f4e,null));};exports[_0x9cc1('0x3d')]=function(_0x332407,_0x269435){return db[_0x9cc1('0x24')][_0x9cc1('0x3d')](_0x332407[_0x9cc1('0x3e')],{})[_0x9cc1('0x1c')](function(_0x23c638){var _0x4afc85=_0x332407[_0x9cc1('0x3f')][_0x9cc1('0x1d')]({'plain':!![]});if(!_0x4afc85)throw new Error(_0x9cc1('0x40'));if(_0x4afc85[_0x9cc1('0x41')]===_0x9cc1('0x3f')){var _0x457a2e=_0x23c638[_0x9cc1('0x1d')]({'plain':!![]});var _0x11bce6=_0x9cc1('0x1e');return db['UserProfileSection'][_0x9cc1('0x3c')]({'where':{'name':_0x11bce6,'userProfileId':_0x4afc85[_0x9cc1('0x42')]},'raw':!![]})[_0x9cc1('0x1c')](function(_0x30ca5c){if(_0x30ca5c&&_0x30ca5c['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x457a2e[_0x9cc1('0x21')],'resourceId':_0x457a2e['id'],'type':_0x30ca5c[_0x9cc1('0x21')],'sectionId':_0x30ca5c['id']},{})[_0x9cc1('0x1c')](function(){return _0x23c638;});}else{return _0x23c638;}})[_0x9cc1('0x3a')](function(_0x5c1164){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c1164);throw _0x5c1164;});}return _0x23c638;})[_0x9cc1('0x1c')](respondWithResult(_0x269435,0xc9))['catch'](handleError(_0x269435,null));};exports[_0x9cc1('0x43')]=function(_0x490610,_0x3eaafb){if(_0x490610[_0x9cc1('0x3e')]['id']){delete _0x490610[_0x9cc1('0x3e')]['id'];}return db[_0x9cc1('0x24')][_0x9cc1('0x3c')]({'where':{'id':_0x490610[_0x9cc1('0x44')]['id']}})['then'](handleEntityNotFound(_0x3eaafb,null))[_0x9cc1('0x1c')](saveUpdates(_0x490610[_0x9cc1('0x3e')],null))[_0x9cc1('0x1c')](respondWithResult(_0x3eaafb,null))['catch'](handleError(_0x3eaafb,null));};exports[_0x9cc1('0x1f')]=function(_0x3ef360,_0x5ef04e){return db[_0x9cc1('0x24')]['find']({'where':{'id':_0x3ef360[_0x9cc1('0x44')]['id']}})[_0x9cc1('0x1c')](handleEntityNotFound(_0x5ef04e,null))['then'](removeEntity(_0x5ef04e,null))[_0x9cc1('0x3a')](handleError(_0x5ef04e,null));};exports[_0x9cc1('0x45')]=function(_0x3565d4,_0x2fd759,_0x2fbc00){return db[_0x9cc1('0x46')][_0x9cc1('0x3c')]({'where':{'id':_0x3565d4['params']['id']}})['then'](handleEntityNotFound(_0x2fd759,null))[_0x9cc1('0x1c')](function(_0x4eb8db){if(_0x4eb8db){return _0x4eb8db[_0x9cc1('0x45')](_0x3565d4[_0x9cc1('0x3e')][_0x9cc1('0x47')],_[_0x9cc1('0x48')](_0x3565d4['body'],[_0x9cc1('0x47'),'id'])||{});}})[_0x9cc1('0x1c')](respondWithResult(_0x2fd759,null))[_0x9cc1('0x3a')](handleError(_0x2fd759,null));};exports['getContacts']=function(_0x2313ee,_0x5de5dd,_0x56e884){var _0x32daff={};var _0x52c150={};var _0x4bddcb;var _0x2d3924;return db['CmCompany'][_0x9cc1('0x49')]({'where':{'id':_0x2313ee['params']['id']}})['then'](handleEntityNotFound(_0x5de5dd,null))['then'](function(_0x422999){if(_0x422999){_0x4bddcb=_0x422999;_0x52c150[_0x9cc1('0x26')]=_['keys'](db['CmContact'][_0x9cc1('0x25')]);_0x52c150[_0x9cc1('0x27')]=_[_0x9cc1('0x28')](_0x2313ee[_0x9cc1('0x27')]);_0x52c150[_0x9cc1('0x30')]=_[_0x9cc1('0x29')](_0x52c150[_0x9cc1('0x26')],_0x52c150[_0x9cc1('0x27')]);_0x32daff[_0x9cc1('0x2b')]=_[_0x9cc1('0x29')](_0x52c150[_0x9cc1('0x26')],qs['fields'](_0x2313ee[_0x9cc1('0x27')][_0x9cc1('0x2a')]));_0x32daff['attributes']=_0x32daff[_0x9cc1('0x2b')][_0x9cc1('0x2c')]?_0x32daff[_0x9cc1('0x2b')]:_0x52c150[_0x9cc1('0x26')];_0x32daff[_0x9cc1('0x2d')]=qs[_0x9cc1('0x2e')](_0x2313ee['query']['sort']);_0x32daff[_0x9cc1('0x2f')]=qs[_0x9cc1('0x30')](_[_0x9cc1('0x31')](_0x2313ee[_0x9cc1('0x27')],_0x52c150[_0x9cc1('0x30')]));if(_0x2313ee[_0x9cc1('0x27')][_0x9cc1('0x32')]){_0x32daff['where']=_['merge'](_0x32daff['where'],{'$or':_[_0x9cc1('0x34')](_0x32daff['attributes'],function(_0x4af0c4){var _0x1be99d={};_0x1be99d[_0x4af0c4]={'$like':'%'+_0x2313ee[_0x9cc1('0x27')][_0x9cc1('0x32')]+'%'};return _0x1be99d;})});}_0x32daff=_[_0x9cc1('0x33')]({},_0x32daff,_0x2313ee[_0x9cc1('0x37')]);return _0x4bddcb['getContacts'](_0x32daff);}})[_0x9cc1('0x1c')](function(_0x2849c7){if(_0x2849c7){_0x2d3924=_0x2849c7[_0x9cc1('0x2c')];if(!_0x2313ee[_0x9cc1('0x27')][_0x9cc1('0x4a')](_0x9cc1('0x4b'))){_0x32daff[_0x9cc1('0x17')]=qs[_0x9cc1('0x17')](_0x2313ee[_0x9cc1('0x27')][_0x9cc1('0x17')]);_0x32daff[_0x9cc1('0x16')]=qs[_0x9cc1('0x16')](_0x2313ee[_0x9cc1('0x27')][_0x9cc1('0x16')]);}return _0x4bddcb[_0x9cc1('0x4c')](_0x32daff);}})[_0x9cc1('0x1c')](function(_0x431fb0){if(_0x431fb0){return _0x431fb0?{'count':_0x2d3924,'rows':_0x431fb0}:null;}})[_0x9cc1('0x1c')](respondWithResult(_0x5de5dd,null))[_0x9cc1('0x3a')](handleError(_0x5de5dd,null));};
\ No newline at end of file
index 488118b..f304074 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa588=['./cmCompany.attributes','exports','define','CmCompany','cm_companies','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x37e886,_0x17d0ad){var _0x57c5cd=function(_0x2692a3){while(--_0x2692a3){_0x37e886['push'](_0x37e886['shift']());}};_0x57c5cd(++_0x17d0ad);}(_0xa588,0xe1));var _0x8a58=function(_0x311fc0,_0x2c64f0){_0x311fc0=_0x311fc0-0x0;var _0xce2976=_0xa588[_0x311fc0];return _0xce2976;};'use strict';var _=require('lodash');var util=require(_0x8a58('0x0'));var logger=require(_0x8a58('0x1'))(_0x8a58('0x2'));var moment=require(_0x8a58('0x3'));var BPromise=require(_0x8a58('0x4'));var rp=require(_0x8a58('0x5'));var attributes=require(_0x8a58('0x6'));module[_0x8a58('0x7')]=function(_0x40b4f0,_0x499c17){return _0x40b4f0[_0x8a58('0x8')](_0x8a58('0x9'),attributes,{'tableName':_0x8a58('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x99e9=['util','../../config/logger','api','moment','request-promise','./cmCompany.attributes','exports','CmCompany','cm_companies'];(function(_0x2d1f9c,_0x2e4589){var _0x41a898=function(_0x450646){while(--_0x450646){_0x2d1f9c['push'](_0x2d1f9c['shift']());}};_0x41a898(++_0x2e4589);}(_0x99e9,0xb4));var _0x999e=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0x99e9[_0x1a7846];return _0x48049;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var logger=require(_0x999e('0x1'))(_0x999e('0x2'));var moment=require(_0x999e('0x3'));var BPromise=require('bluebird');var rp=require(_0x999e('0x4'));var attributes=require(_0x999e('0x5'));module[_0x999e('0x6')]=function(_0x4e2112,_0x296411){return _0x4e2112['define'](_0x999e('0x7'),attributes,{'tableName':_0x999e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index dd5de10..27226fd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x32cb=['info','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCompany,\x20%s,\x20%s','message'];(function(_0x293ef4,_0x56d1b2){var _0x4871da=function(_0x2c0cad){while(--_0x2c0cad){_0x293ef4['push'](_0x293ef4['shift']());}};_0x4871da(++_0x56d1b2);}(_0x32cb,0xd2));var _0xb32c=function(_0x2d9d48,_0x1708e5){_0x2d9d48=_0x2d9d48-0x0;var _0x503559=_0x32cb[_0x2d9d48];return _0x503559;};'use strict';var _=require(_0xb32c('0x0'));var util=require(_0xb32c('0x1'));var moment=require('moment');var BPromise=require(_0xb32c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb32c('0x3'))['db'];var utils=require(_0xb32c('0x4'));var logger=require(_0xb32c('0x5'))(_0xb32c('0x6'));var config=require(_0xb32c('0x7'));var jayson=require(_0xb32c('0x8'));var client=jayson[_0xb32c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x350bde,_0x2d74b5,_0x213a7e){return new BPromise(function(_0x541056,_0x554d0f){return client[_0xb32c('0xa')](_0x350bde,_0x213a7e)[_0xb32c('0xb')](function(_0x3287a2){logger['info']('CmCompany,\x20%s,\x20%s',_0x2d74b5,_0xb32c('0xc'));logger[_0xb32c('0xd')](_0xb32c('0xe'),_0x2d74b5,_0xb32c('0xc'),JSON[_0xb32c('0xf')](_0x3287a2));if(_0x3287a2[_0xb32c('0x10')]){if(_0x3287a2[_0xb32c('0x10')][_0xb32c('0x11')]===0x1f4){logger[_0xb32c('0x10')](_0xb32c('0x12'),_0x2d74b5,_0x3287a2[_0xb32c('0x10')][_0xb32c('0x13')]);return _0x554d0f(_0x3287a2[_0xb32c('0x10')][_0xb32c('0x13')]);}logger[_0xb32c('0x10')](_0xb32c('0x12'),_0x2d74b5,_0x3287a2['error'][_0xb32c('0x13')]);return _0x541056(_0x3287a2[_0xb32c('0x10')][_0xb32c('0x13')]);}else{logger[_0xb32c('0x14')](_0xb32c('0x12'),_0x2d74b5,'request\x20sent');_0x541056(_0x3287a2[_0xb32c('0x15')]['message']);}})[_0xb32c('0x16')](function(_0x145a7d){logger[_0xb32c('0x10')](_0xb32c('0x12'),_0x2d74b5,_0x145a7d);_0x554d0f(_0x145a7d);});});}
\ No newline at end of file
+var _0xc71b=['then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xe83bf0,_0x4cdbbd){var _0x42312c=function(_0x2eab32){while(--_0x2eab32){_0xe83bf0['push'](_0xe83bf0['shift']());}};_0x42312c(++_0x4cdbbd);}(_0xc71b,0x169));var _0xbc71=function(_0x585368,_0x549e05){_0x585368=_0x585368-0x0;var _0x5aa4dd=_0xc71b[_0x585368];return _0x5aa4dd;};'use strict';var _=require('lodash');var util=require(_0xbc71('0x0'));var moment=require(_0xbc71('0x1'));var BPromise=require(_0xbc71('0x2'));var rs=require(_0xbc71('0x3'));var fs=require('fs');var Redis=require(_0xbc71('0x4'));var db=require(_0xbc71('0x5'))['db'];var utils=require(_0xbc71('0x6'));var logger=require(_0xbc71('0x7'))(_0xbc71('0x8'));var config=require(_0xbc71('0x9'));var jayson=require(_0xbc71('0xa'));var client=jayson[_0xbc71('0xb')][_0xbc71('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x40e933,_0x6d1562,_0x39a4e8){return new BPromise(function(_0x41f322,_0x3a5ae3){return client[_0xbc71('0xd')](_0x40e933,_0x39a4e8)[_0xbc71('0xe')](function(_0x52bcba){logger['info'](_0xbc71('0xf'),_0x6d1562,_0xbc71('0x10'));logger[_0xbc71('0x11')](_0xbc71('0x12'),_0x6d1562,_0xbc71('0x10'),JSON[_0xbc71('0x13')](_0x52bcba));if(_0x52bcba[_0xbc71('0x14')]){if(_0x52bcba['error']['code']===0x1f4){logger[_0xbc71('0x14')]('CmCompany,\x20%s,\x20%s',_0x6d1562,_0x52bcba['error'][_0xbc71('0x15')]);return _0x3a5ae3(_0x52bcba[_0xbc71('0x14')]['message']);}logger['error'](_0xbc71('0xf'),_0x6d1562,_0x52bcba[_0xbc71('0x14')][_0xbc71('0x15')]);return _0x41f322(_0x52bcba['error'][_0xbc71('0x15')]);}else{logger[_0xbc71('0x16')](_0xbc71('0xf'),_0x6d1562,_0xbc71('0x10'));_0x41f322(_0x52bcba[_0xbc71('0x17')][_0xbc71('0x15')]);}})[_0xbc71('0x18')](function(_0x5a13be){logger[_0xbc71('0x14')]('CmCompany,\x20%s,\x20%s',_0x6d1562,_0x5a13be);_0x3a5ae3(_0x5a13be);});});}
\ No newline at end of file
index 00fad35..844c72d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa89a=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','/:id','getContacts','post','create','/:id/contacts','addContacts','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x5d6383,_0x24063e){var _0x466028=function(_0x5e3eb8){while(--_0x5e3eb8){_0x5d6383['push'](_0x5d6383['shift']());}};_0x466028(++_0x24063e);}(_0xa89a,0x1a0));var _0xaa89=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xa89a[_0x422905];return _0x33dc6c;};'use strict';var multer=require(_0xaa89('0x0'));var util=require(_0xaa89('0x1'));var path=require(_0xaa89('0x2'));var timeout=require(_0xaa89('0x3'));var express=require(_0xaa89('0x4'));var router=express['Router']();var auth=require(_0xaa89('0x5'));var interaction=require(_0xaa89('0x6'));var config=require(_0xaa89('0x7'));var controller=require(_0xaa89('0x8'));router[_0xaa89('0x9')]('/',auth[_0xaa89('0xa')](),controller['index']);router[_0xaa89('0x9')](_0xaa89('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xaa89('0x9')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xaa89('0xc')]);router[_0xaa89('0xd')]('/',auth[_0xaa89('0xa')](),controller[_0xaa89('0xe')]);router[_0xaa89('0xd')](_0xaa89('0xf'),auth[_0xaa89('0xa')](),controller[_0xaa89('0x10')]);router['put']('/:id',auth[_0xaa89('0xa')](),controller[_0xaa89('0x11')]);router[_0xaa89('0x12')]('/:id',auth[_0xaa89('0xa')](),controller[_0xaa89('0x13')]);module['exports']=router;
\ No newline at end of file
+var _0x1e60=['util','path','express','../../components/auth/service','./cmCompany.controller','isAuthenticated','index','get','/:id','show','getContacts','post','/:id/contacts','addContacts','put','update','delete','destroy'];(function(_0x4183f2,_0x20243a){var _0x34f6ab=function(_0x46568e){while(--_0x46568e){_0x4183f2['push'](_0x4183f2['shift']());}};_0x34f6ab(++_0x20243a);}(_0x1e60,0x1d4));var _0x01e6=function(_0x290782,_0x42ac05){_0x290782=_0x290782-0x0;var _0x2dcc5b=_0x1e60[_0x290782];return _0x2dcc5b;};'use strict';var multer=require('multer');var util=require(_0x01e6('0x0'));var path=require(_0x01e6('0x1'));var timeout=require('connect-timeout');var express=require(_0x01e6('0x2'));var router=express['Router']();var auth=require(_0x01e6('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x01e6('0x4'));router['get']('/',auth[_0x01e6('0x5')](),controller[_0x01e6('0x6')]);router[_0x01e6('0x7')](_0x01e6('0x8'),auth['isAuthenticated'](),controller[_0x01e6('0x9')]);router[_0x01e6('0x7')]('/:id/contacts',auth[_0x01e6('0x5')](),controller[_0x01e6('0xa')]);router[_0x01e6('0xb')]('/',auth[_0x01e6('0x5')](),controller['create']);router['post'](_0x01e6('0xc'),auth[_0x01e6('0x5')](),controller[_0x01e6('0xd')]);router[_0x01e6('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x01e6('0xf')]);router[_0x01e6('0x10')](_0x01e6('0x8'),auth[_0x01e6('0x5')](),controller[_0x01e6('0x11')]);module['exports']=router;
\ No newline at end of file
index 3148dae..1a11173 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5ab1=['lodash','sequelize','exports','STRING','TEXT','INTEGER','DATE','NOW'];(function(_0x557829,_0x215e78){var _0x10067e=function(_0x586d00){while(--_0x586d00){_0x557829['push'](_0x557829['shift']());}};_0x10067e(++_0x215e78);}(_0x5ab1,0x148));var _0x15ab=function(_0x3c2813,_0x1f4f35){_0x3c2813=_0x3c2813-0x0;var _0x51a797=_0x5ab1[_0x3c2813];return _0x51a797;};'use strict';var _=require(_0x15ab('0x0'));var Sequelize=require(_0x15ab('0x1'));module[_0x15ab('0x2')]={'firstName':{'type':Sequelize[_0x15ab('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x15ab('0x3')]},'street':{'type':Sequelize[_0x15ab('0x3')]},'postalCode':{'type':Sequelize[_0x15ab('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x15ab('0x3')]},'description':{'type':Sequelize[_0x15ab('0x4')]},'phone':{'type':Sequelize[_0x15ab('0x3')]},'mobile':{'type':Sequelize[_0x15ab('0x3')]},'fax':{'type':Sequelize[_0x15ab('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x15ab('0x3')]},'twitter':{'type':Sequelize[_0x15ab('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x15ab('0x3')]},'viber':{'type':Sequelize[_0x15ab('0x3')]},'line':{'type':Sequelize[_0x15ab('0x3')]},'wechat':{'type':Sequelize[_0x15ab('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x15ab('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x15ab('0x6')],'defaultValue':Sequelize[_0x15ab('0x7')]}};
\ No newline at end of file
+var _0xab8a=['DATE','NOW','lodash','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x20f125,_0x2ef3fe){var _0x56ebf9=function(_0xd35e91){while(--_0xd35e91){_0x20f125['push'](_0x20f125['shift']());}};_0x56ebf9(++_0x2ef3fe);}(_0xab8a,0x172));var _0xaab8=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xab8a[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0xaab8('0x0'));var Sequelize=require('sequelize');module[_0xaab8('0x1')]={'firstName':{'type':Sequelize[_0xaab8('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xaab8('0x2')]},'street':{'type':Sequelize[_0xaab8('0x2')]},'postalCode':{'type':Sequelize[_0xaab8('0x2')]},'city':{'type':Sequelize[_0xaab8('0x2')]},'country':{'type':Sequelize[_0xaab8('0x2')]},'dateOfBirth':{'type':Sequelize[_0xaab8('0x2')]},'description':{'type':Sequelize[_0xaab8('0x3')]},'phone':{'type':Sequelize[_0xaab8('0x2')]},'mobile':{'type':Sequelize[_0xaab8('0x2')]},'fax':{'type':Sequelize[_0xaab8('0x2')]},'email':{'type':Sequelize[_0xaab8('0x2')]},'url':{'type':Sequelize[_0xaab8('0x2')]},'facebook':{'type':Sequelize[_0xaab8('0x2')]},'fb_data':{'type':Sequelize[_0xaab8('0x2')]},'twitter':{'type':Sequelize[_0xaab8('0x2')]},'skype':{'type':Sequelize[_0xaab8('0x2')]},'teams':{'type':Sequelize[_0xaab8('0x2')]},'viber':{'type':Sequelize[_0xaab8('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xaab8('0x2')]},'telegram':{'type':Sequelize[_0xaab8('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0xaab8('0x4')](0x2)[_0xaab8('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xaab8('0x6')],'defaultValue':Sequelize[_0xaab8('0x7')]}};
\ No newline at end of file
index d822160..e0f94b3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8e3e=['child_process','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','pid','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','sendStatus','status','end','json','offset','apply','reject','update','destroy','error','stack','name','send','index','then','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','tag','include','push','Tag','Tags','CmContact','count','color','ThroughTags','rows','catch','find','params','describe','startsWith','cf_','columnName','displayName','findAll','body','get','mergeWith','tags','join','info','from','CmHopper','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','isArray','bulkCreate','each','duplicates','$or','ListId','findOrCreate','spread','$and','CmCustomField','format','omit','pickBy','cf_%d','isEmpty','table','setFields','id\x20=\x20?','sequelize','text','values','phone','getTags','findOne','rawAttributes','setTags','ids','getHoppers','options','includeAll','getHopperHistories','ContactId','getHopperFinals','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','file','chmodSync','0777','fork','CompanyId','File\x20uploaded\x20correctly!','upload','createReadStream','parse','meta','User','agent','binding'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8e3e,0x163));var _0xe8e3=function(_0x7aac81,_0x1dd377){_0x7aac81=_0x7aac81-0x0;var _0x144d35=_0x8e3e[_0x7aac81];return _0x144d35;};'use strict';var pdf=require(_0xe8e3('0x0'));var emlformat=require(_0xe8e3('0x1'));var rimraf=require(_0xe8e3('0x2'));var zipdir=require(_0xe8e3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe8e3('0x4'));var moment=require('moment');var BPromise=require(_0xe8e3('0x5'));var Mustache=require('mustache');var util=require(_0xe8e3('0x6'));var path=require(_0xe8e3('0x7'));var sox=require('sox');var csv=require(_0xe8e3('0x8'));var ejs=require(_0xe8e3('0x9'));var fs=require('fs');var _=require(_0xe8e3('0xa'));var squel=require(_0xe8e3('0xb'));var crypto=require('crypto');var jsforce=require(_0xe8e3('0xc'));var deskjs=require(_0xe8e3('0xd'));var toCsv=require(_0xe8e3('0x8'));var querystring=require(_0xe8e3('0xe'));var Papa=require(_0xe8e3('0xf'));var authService=require(_0xe8e3('0x10'));var hardwareService=require(_0xe8e3('0x11'));var Redis=require(_0xe8e3('0x12'));var qs=require(_0xe8e3('0x13'));var logger=require(_0xe8e3('0x14'))(_0xe8e3('0x15'));var utils=require('../../config/utils');var config=require(_0xe8e3('0x16'));var db=require(_0xe8e3('0x17'))['db'];config[_0xe8e3('0x18')]=_[_0xe8e3('0x19')](config[_0xe8e3('0x18')],{'host':_0xe8e3('0x1a'),'port':0x18eb});var socket=require(_0xe8e3('0x1b'))(new Redis(config[_0xe8e3('0x18')]));require(_0xe8e3('0x1c'))[_0xe8e3('0x1d')](socket);function respondWithStatusCode(_0x518a71,_0x3161c3){_0x3161c3=_0x3161c3||0xcc;return function(_0x1bf6fa){if(_0x1bf6fa){return _0x518a71[_0xe8e3('0x1e')](_0x3161c3);}return _0x518a71[_0xe8e3('0x1f')](_0x3161c3)[_0xe8e3('0x20')]();};}function respondWithResult(_0x13f5b1,_0xc24cc4){_0xc24cc4=_0xc24cc4||0xc8;return function(_0x121f62){if(_0x121f62){return _0x13f5b1[_0xe8e3('0x1f')](_0xc24cc4)[_0xe8e3('0x21')](_0x121f62);}};}function respondWithFilteredResult(_0x1fa618,_0x4091ae){return function(_0x3c0c73){if(_0x3c0c73){var _0x2cc2b1=_0x3c0c73['count'],_0x575b92=_0x4091ae[_0xe8e3('0x22')],_0x422b39=_0x4091ae['offset']+_0x4091ae['limit'],_0x525602;if(_0x422b39>=_0x2cc2b1){_0x422b39=_0x2cc2b1;_0x525602=0xc8;}else{_0x525602=0xce;}_0x1fa618[_0xe8e3('0x1f')](_0x525602);return _0x1fa618['set']('Content-Range',_0x575b92+'-'+_0x422b39+'/'+_0x2cc2b1)[_0xe8e3('0x21')](_0x3c0c73);}return null;};}function patchUpdates(_0x4a9a97){return function(_0xf158ec){try{jsonpatch[_0xe8e3('0x23')](_0xf158ec,_0x4a9a97,!![]);}catch(_0x65744e){return BPromise[_0xe8e3('0x24')](_0x65744e);}return _0xf158ec['save']();};}function saveUpdates(_0xeee8de,_0x5982cf){return function(_0x24c4b7){if(_0x24c4b7){return _0x24c4b7[_0xe8e3('0x25')](_0xeee8de)['then'](function(_0x47bbb9){return _0x47bbb9;});}return null;};}function removeEntity(_0x452106,_0x1ddf35){return function(_0x58451f){if(_0x58451f){return _0x58451f[_0xe8e3('0x26')]()['then'](function(){_0x452106['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d199a,_0x8e207b){return function(_0xe3680f){if(!_0xe3680f){_0x1d199a['sendStatus'](0x194);}return _0xe3680f;};}function handleError(_0x2f1319,_0x370e53){_0x370e53=_0x370e53||0x1f4;return function(_0x31de59){logger[_0xe8e3('0x27')](_0x31de59[_0xe8e3('0x28')]);if(_0x31de59[_0xe8e3('0x29')]){delete _0x31de59[_0xe8e3('0x29')];}_0x2f1319[_0xe8e3('0x1f')](_0x370e53)[_0xe8e3('0x2a')](_0x31de59);};}exports[_0xe8e3('0x2b')]=function(_0x4e8d2a,_0x355f1b){var _0x56e355={},_0x37c6df={},_0x416dc6={'count':0x0,'rows':[]};return db['CmContact']['describe']()[_0xe8e3('0x2c')](function(_0x2f1744){_0x37c6df[_0xe8e3('0x2d')]=_[_0xe8e3('0x2e')](_0x2f1744);_0x37c6df[_0xe8e3('0x2f')]=_[_0xe8e3('0x2e')](_0x4e8d2a['query']);_0x37c6df[_0xe8e3('0x30')]=_[_0xe8e3('0x31')](_0x37c6df[_0xe8e3('0x2d')],_0x37c6df[_0xe8e3('0x2f')]);_0x56e355['attributes']=_['intersection'](_0x37c6df[_0xe8e3('0x2d')],qs['fields'](_0x4e8d2a[_0xe8e3('0x2f')][_0xe8e3('0x32')]));_0x56e355[_0xe8e3('0x33')]=_0x56e355[_0xe8e3('0x33')][_0xe8e3('0x34')]?_0x56e355[_0xe8e3('0x33')]:_0x37c6df['model'];if(!_0x4e8d2a[_0xe8e3('0x2f')][_0xe8e3('0x35')](_0xe8e3('0x36'))){_0x56e355['limit']=qs[_0xe8e3('0x37')](_0x4e8d2a['query'][_0xe8e3('0x37')]);_0x56e355['offset']=qs[_0xe8e3('0x22')](_0x4e8d2a[_0xe8e3('0x2f')][_0xe8e3('0x22')]);}_0x56e355[_0xe8e3('0x38')]=qs['sort'](_0x4e8d2a[_0xe8e3('0x2f')][_0xe8e3('0x39')]);_0x56e355[_0xe8e3('0x3a')]=qs['filters'](_[_0xe8e3('0x3b')](_0x4e8d2a['query'],_0x37c6df[_0xe8e3('0x30')]));if(_0x4e8d2a['query'][_0xe8e3('0x3c')]){_0x56e355[_0xe8e3('0x3a')]=_[_0xe8e3('0x3d')](_0x56e355[_0xe8e3('0x3a')],{'$or':_[_0xe8e3('0x3e')](_0x56e355[_0xe8e3('0x33')],function(_0x558307){var _0x2eeff6={};_0x2eeff6[_0x558307]={'$like':'%'+_0x4e8d2a[_0xe8e3('0x2f')][_0xe8e3('0x3c')]+'%'};return _0x2eeff6;})});}_0x56e355=_['merge']({},_0x56e355,_0x4e8d2a['options']);var _0x4b74d3={'where':_0x56e355['where']};_0x4b74d3['include']=[];if(_0x4e8d2a[_0xe8e3('0x2f')][_0xe8e3('0x3f')]){_0x4b74d3[_0xe8e3('0x40')][_0xe8e3('0x41')]({'model':db[_0xe8e3('0x42')],'as':_0xe8e3('0x43'),'attributes':['id'],'where':{'id':_0x4e8d2a[_0xe8e3('0x2f')]['tag']},'required':!![]});_0x4b74d3['distinct']=!![];}return db[_0xe8e3('0x44')][_0xe8e3('0x45')](_0x4b74d3)[_0xe8e3('0x2c')](function(_0x73cdaf){_0x416dc6[_0xe8e3('0x45')]=_0x73cdaf;if(_0x4e8d2a[_0xe8e3('0x2f')]['includeAll']){_0x56e355[_0xe8e3('0x40')]=[{'model':db[_0xe8e3('0x42')],'as':_0xe8e3('0x43'),'attributes':['id',_0xe8e3('0x29'),_0xe8e3('0x46')],'required':_0x4e8d2a[_0xe8e3('0x2f')][_0xe8e3('0x3f')]?!![]:![]},{'model':db[_0xe8e3('0x42')],'as':_0xe8e3('0x47'),'attributes':['id',_0xe8e3('0x29'),_0xe8e3('0x46')],'through':_0x4e8d2a[_0xe8e3('0x2f')][_0xe8e3('0x3f')]?{'attributes':[],'where':{'TagId':_0x4e8d2a['query'][_0xe8e3('0x3f')]||undefined}}:{},'required':_0x4e8d2a[_0xe8e3('0x2f')][_0xe8e3('0x3f')]?!![]:![]}];}return db[_0xe8e3('0x44')]['findAll'](_0x56e355);})[_0xe8e3('0x2c')](function(_0x18f5b1){_0x416dc6[_0xe8e3('0x48')]=_0x18f5b1;return _0x416dc6;})[_0xe8e3('0x2c')](respondWithFilteredResult(_0x355f1b,_0x56e355))[_0xe8e3('0x49')](handleError(_0x355f1b,null));});};exports[_0xe8e3('0x26')]=function(_0x107878,_0x4a55ea){return db[_0xe8e3('0x44')][_0xe8e3('0x4a')]({'where':{'id':_0x107878[_0xe8e3('0x4b')]['id']}})[_0xe8e3('0x2c')](handleEntityNotFound(_0x4a55ea,null))['then'](removeEntity(_0x4a55ea,null))[_0xe8e3('0x49')](handleError(_0x4a55ea,null));};exports[_0xe8e3('0x4c')]=function(_0x5c9770,_0x315160){return db[_0xe8e3('0x44')][_0xe8e3('0x4c')]()[_0xe8e3('0x2c')](function(_0x103964){for(var _0x3bd5f8=0x0;_0x3bd5f8<Object[_0xe8e3('0x2e')](_0x103964)['length'];_0x3bd5f8++){var _0x38d110=Object['keys'](_0x103964)[_0x3bd5f8];if(!_[_0xe8e3('0x4d')](_0x38d110,_0xe8e3('0x4e'))){_0x103964[_0x38d110][_0xe8e3('0x4f')]=_0x38d110;_0x103964[_0x38d110][_0xe8e3('0x50')]=_0x38d110;}}return _0x103964;})['then'](function(_0x2f8750){var _0x13e852={'where':{'$or':[{'ListId':_0x5c9770[_0xe8e3('0x2f')]['id']},{'ListId':null}]},'raw':!![]};return db['CmCustomField'][_0xe8e3('0x51')](_0x13e852)['then'](function(_0x19ba4b){for(var _0x29338c=0x0;_0x29338c<_0x19ba4b[_0xe8e3('0x34')];_0x29338c++){var _0x2e4352=_0xe8e3('0x4e')+_0x19ba4b[_0x29338c]['id'];_0x2f8750[_0x2e4352][_0xe8e3('0x4f')]=_0x2e4352;_0x2f8750[_0x2e4352][_0xe8e3('0x50')]=_0x19ba4b[_0x29338c]['alias'];}for(var _0x29338c=0x0;_0x29338c<Object[_0xe8e3('0x2e')](_0x2f8750)[_0xe8e3('0x34')];_0x29338c++){var _0x2e4352=Object[_0xe8e3('0x2e')](_0x2f8750)[_0x29338c];if(!_0x2f8750[_0x2e4352][_0xe8e3('0x35')]('columnName')){delete _0x2f8750[_0x2e4352];}}return _0x2f8750;});})['then'](respondWithResult(_0x315160,null))[_0xe8e3('0x49')](handleError(_0x315160,null));};exports[_0xe8e3('0x3d')]=function(_0x1f5e18,_0x227764){var _0x2a2e72;var _0x206792;var _0x309083;if(_0x1f5e18[_0xe8e3('0x52')]['id']){delete _0x1f5e18[_0xe8e3('0x52')]['id'];}return db[_0xe8e3('0x44')][_0xe8e3('0x51')]({'where':{'id':[_0x1f5e18[_0xe8e3('0x52')]['to'],_0x1f5e18['body']['from']]}})[_0xe8e3('0x2c')](function(_0x13c106){if(_0x13c106){if(_0x13c106['length']!==0x2){return null;}_0x13c106[0x0]=_0x13c106[0x0][_0xe8e3('0x53')]({'plain':!![]});_0x13c106[0x1]=_0x13c106[0x1][_0xe8e3('0x53')]({'plain':!![]});delete _0x13c106[0x0]['id'];delete _0x13c106[0x1]['id'];return _[_0xe8e3('0x54')](_0x13c106[0x0],_0x13c106[0x1],function(_0x14cd2a,_0x45bad7){if(Array['isArray'](_0x45bad7)&&!_0x45bad7['length']){return _0x14cd2a;}else if(!_0x45bad7){return _0x14cd2a;}});}})[_0xe8e3('0x2c')](handleEntityNotFound(_0x227764,null))[_0xe8e3('0x2c')](function(_0x2f9752){if(_0x2f9752){if(_0x2f9752[_0xe8e3('0x55')]&&_['isArray'](_0x2f9752[_0xe8e3('0x55')])){_0x2f9752[_0xe8e3('0x55')]=_0x2f9752[_0xe8e3('0x55')][_0xe8e3('0x56')]();}logger[_0xe8e3('0x57')]('[CmContact][merge]\x20to\x20%s\x20from\x20%s',_0x1f5e18[_0xe8e3('0x52')]['to'],_0x1f5e18[_0xe8e3('0x52')][_0xe8e3('0x58')]);return db[_0xe8e3('0x59')][_0xe8e3('0x26')]({'where':{'ContactId':[_0x1f5e18[_0xe8e3('0x52')]['to'],_0x1f5e18[_0xe8e3('0x52')][_0xe8e3('0x58')]]}})[_0xe8e3('0x2c')](function(_0x49e8b7){logger[_0xe8e3('0x57')]('[CmContact][merge][destroy][CmHopper],\x20%s',_0x49e8b7);return db['CmHopperBlack'][_0xe8e3('0x26')]({'where':{'ContactId':[_0x1f5e18[_0xe8e3('0x52')]['to'],_0x1f5e18[_0xe8e3('0x52')][_0xe8e3('0x58')]]}})[_0xe8e3('0x2c')](function(_0x350fbd){logger['info'](_0xe8e3('0x5a'),_0x350fbd);return db[_0xe8e3('0x44')][_0xe8e3('0x5b')](_0x2f9752);});});}})[_0xe8e3('0x2c')](function(_0x19ed89){if(_0x19ed89){_0x2a2e72=_0x19ed89;_0x206792={'ContactId':_0x2a2e72['id']};_0x309083={'where':{'ContactId':[_0x1f5e18[_0xe8e3('0x52')]['to'],_0x1f5e18[_0xe8e3('0x52')][_0xe8e3('0x58')]]}};return db['ChatInteraction'][_0xe8e3('0x25')](_0x206792,_0x309083);}})[_0xe8e3('0x2c')](function(){if(_0x2a2e72){return db[_0xe8e3('0x5c')][_0xe8e3('0x25')](_0x206792,_0x309083);}})[_0xe8e3('0x2c')](function(){if(_0x2a2e72){return db['ChatOfflineMessage']['update'](_0x206792,_0x309083);}})['then'](function(){if(_0x2a2e72){return db[_0xe8e3('0x5d')]['update'](_0x206792,_0x309083);}})['then'](function(){if(_0x2a2e72){return db['MailMessage']['update'](_0x206792,_0x309083);}})['then'](function(){if(_0x2a2e72){return db[_0xe8e3('0x5d')][_0xe8e3('0x25')](_0x206792,_0x309083);}})[_0xe8e3('0x2c')](function(){if(_0x2a2e72){return db[_0xe8e3('0x5e')][_0xe8e3('0x25')](_0x206792,_0x309083);}})[_0xe8e3('0x2c')](function(){if(_0x2a2e72){return db[_0xe8e3('0x5f')][_0xe8e3('0x25')](_0x206792,_0x309083);}})['then'](function(){if(_0x2a2e72){return db[_0xe8e3('0x60')][_0xe8e3('0x25')](_0x206792,_0x309083);}})[_0xe8e3('0x2c')](function(){if(_0x2a2e72){return db['FaxInteraction'][_0xe8e3('0x25')](_0x206792,_0x309083);}})[_0xe8e3('0x2c')](function(){if(_0x2a2e72){return db[_0xe8e3('0x61')]['update'](_0x206792,_0x309083);}})['then'](function(){if(_0x2a2e72){return db[_0xe8e3('0x62')][_0xe8e3('0x25')](_0x206792,_0x309083);}})['then'](function(){if(_0x2a2e72){return db[_0xe8e3('0x63')][_0xe8e3('0x25')](_0x206792,_0x309083);}})['then'](function(){if(_0x2a2e72){return db[_0xe8e3('0x64')][_0xe8e3('0x25')](_0x206792,_0x309083);}})[_0xe8e3('0x2c')](function(){if(_0x2a2e72){return db[_0xe8e3('0x65')][_0xe8e3('0x25')](_0x206792,_0x309083);}})[_0xe8e3('0x2c')](function(){if(_0x2a2e72){return db[_0xe8e3('0x66')][_0xe8e3('0x25')](_0x206792,_0x309083);}})['then'](function(){if(_0x2a2e72){return db[_0xe8e3('0x67')][_0xe8e3('0x25')](_0x206792,_0x309083);}})[_0xe8e3('0x2c')](function(){if(_0x2a2e72){return db[_0xe8e3('0x68')][_0xe8e3('0x25')](_0x206792,_0x309083);}})[_0xe8e3('0x2c')](function(){if(_0x2a2e72){return db['FaxQueueReport'][_0xe8e3('0x25')](_0x206792,_0x309083);}})[_0xe8e3('0x2c')](function(){if(_0x2a2e72){return db[_0xe8e3('0x69')][_0xe8e3('0x25')](_0x206792,_0x309083);}})[_0xe8e3('0x2c')](function(){if(_0x2a2e72){return db[_0xe8e3('0x6a')]['update'](_0x206792,_0x309083);}})[_0xe8e3('0x2c')](function(){if(_0x2a2e72){return db[_0xe8e3('0x6b')][_0xe8e3('0x25')](_0x206792,_0x309083);}})[_0xe8e3('0x2c')](function(){if(_0x2a2e72){return db['JscriptySessionReport'][_0xe8e3('0x25')](_0x206792,_0x309083);}})[_0xe8e3('0x2c')](function(){if(_0x2a2e72){return db[_0xe8e3('0x44')]['destroy']({'where':{'id':[_0x1f5e18[_0xe8e3('0x52')]['to'],_0x1f5e18[_0xe8e3('0x52')]['from']]}});}})[_0xe8e3('0x2c')](function(){if(_0x2a2e72){return _0x2a2e72;}})['then'](respondWithResult(_0x227764,null))['catch'](handleError(_0x227764,null));};exports[_0xe8e3('0x5b')]=function(_0x12cd3f,_0x38bb2b){return db[_0xe8e3('0x44')][_0xe8e3('0x4c')]()[_0xe8e3('0x2c')](function(_0x55e9c6){if(_0x12cd3f[_0xe8e3('0x52')][_0xe8e3('0x55')]&&_[_0xe8e3('0x6c')](_0x12cd3f['body'][_0xe8e3('0x55')])){if(_0x12cd3f['body'][_0xe8e3('0x55')][_0xe8e3('0x34')]){_0x12cd3f['body'][_0xe8e3('0x55')]=_0x12cd3f['body'][_0xe8e3('0x55')][_0xe8e3('0x56')](';')+';';}else{_0x12cd3f['body'][_0xe8e3('0x55')]=null;}}else{_0x12cd3f[_0xe8e3('0x52')]['tags']=null;}return db['CmContact']['create'](_0x12cd3f['body'],{'fields':_[_0xe8e3('0x2e')](_0x55e9c6),'raw':!![]});})[_0xe8e3('0x2c')](respondWithResult(_0x38bb2b,0xc9))[_0xe8e3('0x49')](handleError(_0x38bb2b,null));};exports[_0xe8e3('0x6d')]=function(_0x28991b,_0x26f720){var _0xc3a96f=[];var _0x397fcc=0x0;var _0x4e7cf5=0x0;var _0x5885fb=0x0;return db['CmContact'][_0xe8e3('0x4c')]()[_0xe8e3('0x2c')](function(_0x3647c4){return BPromise[_0xe8e3('0x6e')](_0x28991b[_0xe8e3('0x52')],function(_0x2193a5){var _0x19aa33={'where':{'$or':[]},'defaults':_0x2193a5,'fields':_['keys'](_0x3647c4),'raw':!![]};if(_0x2193a5[_0xe8e3('0x6f')]){for(var _0x5e6ac9=0x0;_0x5e6ac9<_0x2193a5['duplicates']['length'];_0x5e6ac9++){var _0x47722b={};_0x47722b[_0x2193a5[_0xe8e3('0x6f')][_0x5e6ac9]]=_0x2193a5[_0x2193a5[_0xe8e3('0x6f')][_0x5e6ac9]];_0x19aa33[_0xe8e3('0x3a')][_0xe8e3('0x70')]['push'](_0x47722b);}_0x19aa33[_0xe8e3('0x3a')][_0xe8e3('0x71')]=_0x2193a5[_0xe8e3('0x71')];}return db[_0xe8e3('0x44')][_0xe8e3('0x72')](_0x19aa33)[_0xe8e3('0x73')](function(_0x4c78c6,_0x431924){if(_0x431924){_0x397fcc++;}else{_0x5885fb++;}})[_0xe8e3('0x49')](function(_0x530a2f){console[_0xe8e3('0x27')](_0x530a2f);_0x4e7cf5++;});});})[_0xe8e3('0x2c')](function(_0x297528){if(_0x297528){return{'success':_0x397fcc,'failure':_0x4e7cf5,'duplicates':_0x5885fb};}})[_0xe8e3('0x2c')](respondWithResult(_0x26f720,0xc9))['catch'](handleError(_0x26f720,null));};exports['show']=function(_0x551e3a,_0x308211,_0x5c6a64){var _0x5e6778;return db[_0xe8e3('0x44')][_0xe8e3('0x4c')]()[_0xe8e3('0x2c')](function(_0x5ef8b3){return db['CmContact'][_0xe8e3('0x4a')]({'where':{'id':_0x551e3a[_0xe8e3('0x4b')]['id']},'include':[{'model':db[_0xe8e3('0x42')],'as':_0xe8e3('0x43'),'attributes':['id',_0xe8e3('0x29'),_0xe8e3('0x46')],'required':_0x551e3a[_0xe8e3('0x2f')][_0xe8e3('0x3f')]?!![]:![]}],'attributes':_[_0xe8e3('0x2e')](_0x5ef8b3)});})['then'](function(_0x7d0ac6){_0x5e6778=_0x7d0ac6[_0xe8e3('0x53')]({'plain':!![]});var _0x54cda9={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x7d0ac6&&_0x7d0ac6[_0xe8e3('0x71')]){if(_0x7d0ac6[_0xe8e3('0x71')]){_0x54cda9[_0xe8e3('0x3a')][_0xe8e3('0x74')]['push']({'ListId':{'$ne':_0x7d0ac6[_0xe8e3('0x71')]}});}}return db[_0xe8e3('0x75')][_0xe8e3('0x51')](_0x54cda9);})[_0xe8e3('0x2c')](function(_0xc97f05){return _['omit'](_0x5e6778,_[_0xe8e3('0x3e')](_0xc97f05,function(_0x34af00){return util[_0xe8e3('0x76')]('cf_%d',_0x34af00['id']);}));})[_0xe8e3('0x2c')](handleEntityNotFound(_0x308211,null))[_0xe8e3('0x2c')](respondWithResult(_0x308211,null))[_0xe8e3('0x49')](handleError(_0x308211,null));};exports[_0xe8e3('0x25')]=function(_0x3f94a0,_0x48c3fc){var _0x52f601;if(_0x3f94a0['body']['id']){delete _0x3f94a0[_0xe8e3('0x52')]['id'];}return db[_0xe8e3('0x44')][_0xe8e3('0x4a')]({'where':{'id':_0x3f94a0[_0xe8e3('0x4b')]['id']}})[_0xe8e3('0x2c')](handleEntityNotFound(_0x48c3fc,null))['then'](saveUpdates(_0x3f94a0[_0xe8e3('0x52')],null))[_0xe8e3('0x2c')](function(_0x4e00d8){_0x52f601=_0x4e00d8;var _0x56fd15={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4e00d8&&_0x4e00d8[_0xe8e3('0x71')]){if(_0x4e00d8['ListId']){_0x56fd15['where']['$and']['push']({'ListId':{'$ne':_0x4e00d8[_0xe8e3('0x71')]}});}}return db[_0xe8e3('0x75')]['findAll'](_0x56fd15);})[_0xe8e3('0x2c')](function(_0x4dc00a){if(_0x4dc00a){return _[_0xe8e3('0x77')](_[_0xe8e3('0x78')](_0x3f94a0[_0xe8e3('0x52')],function(_0x555514,_0x38c97c){return _[_0xe8e3('0x4d')](_0x38c97c,_0xe8e3('0x4e'));}),_[_0xe8e3('0x3e')](_0x4dc00a,function(_0x3090be){return util[_0xe8e3('0x76')](_0xe8e3('0x79'),_0x3090be['id']);}));}})['then'](function(_0x1aa486){if(_0x1aa486&&!_[_0xe8e3('0x7a')](_0x1aa486)){var _0x2e8c39=squel[_0xe8e3('0x25')]()[_0xe8e3('0x7b')]('cm_contacts')[_0xe8e3('0x7c')](_0x1aa486)['where'](_0xe8e3('0x7d'),_0x3f94a0[_0xe8e3('0x4b')]['id'])['toParam']();return db[_0xe8e3('0x7e')][_0xe8e3('0x2f')](_0x2e8c39[_0xe8e3('0x7f')],{'replacements':_0x2e8c39[_0xe8e3('0x80')]});}})[_0xe8e3('0x2c')](function(){if(_0x3f94a0[_0xe8e3('0x52')][_0xe8e3('0x81')]&&_0x52f601){return db['CmHopper'][_0xe8e3('0x25')]({'phone':_0x3f94a0[_0xe8e3('0x52')]['phone']},{'where':{'ContactId':_0x52f601['id']}});}})['then'](function(){return _0x52f601;})['then'](respondWithResult(_0x48c3fc,null))['catch'](handleError(_0x48c3fc,null));};exports[_0xe8e3('0x82')]=function(_0x52a840,_0x2e197c,_0xf95b31){var _0x301d97={};var _0xfbde82={};var _0x84cc1c;var _0x5516f3;return db[_0xe8e3('0x44')][_0xe8e3('0x83')]({'where':{'id':_0x52a840[_0xe8e3('0x4b')]['id']}})[_0xe8e3('0x2c')](handleEntityNotFound(_0x2e197c,null))['then'](function(_0x5767be){if(_0x5767be){_0x84cc1c=_0x5767be;_0xfbde82[_0xe8e3('0x2d')]=_['keys'](db[_0xe8e3('0x42')][_0xe8e3('0x84')]);_0xfbde82[_0xe8e3('0x2f')]=_[_0xe8e3('0x2e')](_0x52a840[_0xe8e3('0x2f')]);_0xfbde82['filters']=_['intersection'](_0xfbde82[_0xe8e3('0x2d')],_0xfbde82[_0xe8e3('0x2f')]);_0x301d97[_0xe8e3('0x33')]=_[_0xe8e3('0x31')](_0xfbde82[_0xe8e3('0x2d')],qs['fields'](_0x52a840[_0xe8e3('0x2f')][_0xe8e3('0x32')]));_0x301d97[_0xe8e3('0x33')]=_0x301d97[_0xe8e3('0x33')][_0xe8e3('0x34')]?_0x301d97[_0xe8e3('0x33')]:_0xfbde82[_0xe8e3('0x2d')];_0x301d97[_0xe8e3('0x38')]=qs[_0xe8e3('0x39')](_0x52a840[_0xe8e3('0x2f')]['sort']);_0x301d97['where']=qs[_0xe8e3('0x30')](_[_0xe8e3('0x3b')](_0x52a840[_0xe8e3('0x2f')],_0xfbde82['filters']));if(_0x52a840[_0xe8e3('0x2f')]['filter']){_0x301d97[_0xe8e3('0x3a')]=_[_0xe8e3('0x3d')](_0x301d97[_0xe8e3('0x3a')],{'$or':_[_0xe8e3('0x3e')](_0x301d97[_0xe8e3('0x33')],function(_0x15b282){var _0x2cf3e6={};_0x2cf3e6[_0x15b282]={'$like':'%'+_0x52a840[_0xe8e3('0x2f')][_0xe8e3('0x3c')]+'%'};return _0x2cf3e6;})});}_0x301d97=_[_0xe8e3('0x3d')]({},_0x301d97,_0x52a840['options']);return _0x84cc1c[_0xe8e3('0x82')](_0x301d97);}})[_0xe8e3('0x2c')](function(_0x1e41ff){if(_0x1e41ff){_0x5516f3=_0x1e41ff['length'];if(!_0x52a840[_0xe8e3('0x2f')][_0xe8e3('0x35')](_0xe8e3('0x36'))){_0x301d97['limit']=qs[_0xe8e3('0x37')](_0x52a840['query'][_0xe8e3('0x37')]);_0x301d97['offset']=qs[_0xe8e3('0x22')](_0x52a840[_0xe8e3('0x2f')][_0xe8e3('0x22')]);}return _0x84cc1c['getTags'](_0x301d97);}})[_0xe8e3('0x2c')](function(_0x1a5f40){if(_0x1a5f40){return _0x1a5f40?{'count':_0x5516f3,'rows':_0x1a5f40}:null;}})[_0xe8e3('0x2c')](respondWithResult(_0x2e197c,null))[_0xe8e3('0x49')](handleError(_0x2e197c,null));};exports[_0xe8e3('0x85')]=function(_0x572ef5,_0x1b43a0,_0x147f47){if(_0x572ef5['body']['id']){delete _0x572ef5[_0xe8e3('0x52')]['id'];}return db['CmContact'][_0xe8e3('0x83')]({'where':{'id':_0x572ef5['params']['id']}})[_0xe8e3('0x2c')](handleEntityNotFound(_0x1b43a0,null))[_0xe8e3('0x2c')](function(_0x26a18d){if(_0x26a18d){return _0x26a18d[_0xe8e3('0x85')](_0x572ef5[_0xe8e3('0x52')][_0xe8e3('0x86')]||[]);}return null;})['then'](respondWithResult(_0x1b43a0,null))[_0xe8e3('0x49')](handleError(_0x1b43a0,null));};exports[_0xe8e3('0x87')]=function(_0x3266cc,_0x497c68,_0x50c4a3){var _0x425575={'raw':![],'where':{}};var _0x1bd5e5={};var _0x22d211={'count':0x0,'rows':[]};return db['CmContact'][_0xe8e3('0x83')]({'where':{'id':_0x3266cc[_0xe8e3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x497c68,null))[_0xe8e3('0x2c')](function(_0x4007e9){if(_0x4007e9){_0x1bd5e5[_0xe8e3('0x2d')]=_[_0xe8e3('0x2e')](db['CmHopper'][_0xe8e3('0x84')]);_0x1bd5e5[_0xe8e3('0x2f')]=_[_0xe8e3('0x2e')](_0x3266cc[_0xe8e3('0x2f')]);_0x1bd5e5['filters']=_[_0xe8e3('0x31')](_0x1bd5e5['model'],_0x1bd5e5[_0xe8e3('0x2f')]);_0x425575['attributes']=_[_0xe8e3('0x31')](_0x1bd5e5[_0xe8e3('0x2d')],qs[_0xe8e3('0x32')](_0x3266cc[_0xe8e3('0x2f')][_0xe8e3('0x32')]));_0x425575[_0xe8e3('0x33')]=_0x425575[_0xe8e3('0x33')][_0xe8e3('0x34')]?_0x425575['attributes']:_0x1bd5e5[_0xe8e3('0x2d')];if(!_0x3266cc['query']['hasOwnProperty']('nolimit')){_0x425575['limit']=qs[_0xe8e3('0x37')](_0x3266cc[_0xe8e3('0x2f')][_0xe8e3('0x37')]);_0x425575[_0xe8e3('0x22')]=qs[_0xe8e3('0x22')](_0x3266cc[_0xe8e3('0x2f')][_0xe8e3('0x22')]);}_0x425575['order']=qs[_0xe8e3('0x39')](_0x3266cc['query'][_0xe8e3('0x39')]);_0x425575[_0xe8e3('0x3a')]=qs[_0xe8e3('0x30')](_[_0xe8e3('0x3b')](_0x3266cc[_0xe8e3('0x2f')],_0x1bd5e5[_0xe8e3('0x30')]));_0x425575['where']['ContactId']=_0x4007e9['id'];if(_0x3266cc['query'][_0xe8e3('0x3c')]){_0x425575['where']=_[_0xe8e3('0x3d')](_0x425575['where'],{'$or':_[_0xe8e3('0x3e')](_0x425575[_0xe8e3('0x33')],function(_0x3d017a){var _0x38a700={};_0x38a700[_0x3d017a]={'$like':'%'+_0x3266cc[_0xe8e3('0x2f')][_0xe8e3('0x3c')]+'%'};return _0x38a700;})});}_0x425575=_[_0xe8e3('0x3d')]({},_0x425575,_0x3266cc[_0xe8e3('0x88')]);return db[_0xe8e3('0x59')][_0xe8e3('0x45')]({'where':_0x425575[_0xe8e3('0x3a')]})[_0xe8e3('0x2c')](function(_0x7a107b){_0x22d211[_0xe8e3('0x45')]=_0x7a107b;if(_0x3266cc['query'][_0xe8e3('0x89')]){_0x425575[_0xe8e3('0x40')]=[{'all':!![]}];}return db[_0xe8e3('0x59')]['findAll'](_0x425575);})['then'](function(_0x4e9af6){_0x22d211[_0xe8e3('0x48')]=_0x4e9af6;return _0x22d211;});}})[_0xe8e3('0x2c')](respondWithFilteredResult(_0x497c68,_0x425575))[_0xe8e3('0x49')](handleError(_0x497c68,null));};exports[_0xe8e3('0x8a')]=function(_0x3fdd60,_0x2d978f,_0x3cab3f){var _0x3a0f9d={'raw':!![],'where':{}};var _0x593016={};var _0x5822e0={'count':0x0,'rows':[]};return db[_0xe8e3('0x44')][_0xe8e3('0x83')]({'where':{'id':_0x3fdd60[_0xe8e3('0x4b')]['id']}})[_0xe8e3('0x2c')](handleEntityNotFound(_0x2d978f,null))[_0xe8e3('0x2c')](function(_0x3b20db){if(_0x3b20db){_0x593016[_0xe8e3('0x2d')]=_[_0xe8e3('0x2e')](db[_0xe8e3('0x65')]['rawAttributes']);_0x593016[_0xe8e3('0x2f')]=_['keys'](_0x3fdd60[_0xe8e3('0x2f')]);_0x593016['filters']=_[_0xe8e3('0x31')](_0x593016[_0xe8e3('0x2d')],_0x593016[_0xe8e3('0x2f')]);_0x3a0f9d[_0xe8e3('0x33')]=_['intersection'](_0x593016[_0xe8e3('0x2d')],qs[_0xe8e3('0x32')](_0x3fdd60[_0xe8e3('0x2f')][_0xe8e3('0x32')]));_0x3a0f9d['attributes']=_0x3a0f9d[_0xe8e3('0x33')][_0xe8e3('0x34')]?_0x3a0f9d[_0xe8e3('0x33')]:_0x593016[_0xe8e3('0x2d')];if(!_0x3fdd60[_0xe8e3('0x2f')][_0xe8e3('0x35')](_0xe8e3('0x36'))){_0x3a0f9d[_0xe8e3('0x37')]=qs['limit'](_0x3fdd60[_0xe8e3('0x2f')]['limit']);_0x3a0f9d['offset']=qs['offset'](_0x3fdd60['query'][_0xe8e3('0x22')]);}_0x3a0f9d[_0xe8e3('0x38')]=qs['sort'](_0x3fdd60['query'][_0xe8e3('0x39')]);_0x3a0f9d[_0xe8e3('0x3a')]=qs[_0xe8e3('0x30')](_[_0xe8e3('0x3b')](_0x3fdd60['query'],_0x593016[_0xe8e3('0x30')]));_0x3a0f9d[_0xe8e3('0x3a')][_0xe8e3('0x8b')]=_0x3b20db['id'];if(_0x3fdd60[_0xe8e3('0x2f')][_0xe8e3('0x3c')]){_0x3a0f9d[_0xe8e3('0x3a')]=_[_0xe8e3('0x3d')](_0x3a0f9d[_0xe8e3('0x3a')],{'$or':_['map'](_0x3a0f9d[_0xe8e3('0x33')],function(_0x1afc99){var _0x439a63={};_0x439a63[_0x1afc99]={'$like':'%'+_0x3fdd60[_0xe8e3('0x2f')][_0xe8e3('0x3c')]+'%'};return _0x439a63;})});}_0x3a0f9d=_[_0xe8e3('0x3d')]({},_0x3a0f9d,_0x3fdd60[_0xe8e3('0x88')]);return db[_0xe8e3('0x65')]['count']({'where':_0x3a0f9d[_0xe8e3('0x3a')]})[_0xe8e3('0x2c')](function(_0x440d9a){_0x5822e0['count']=_0x440d9a;if(_0x3fdd60['query'][_0xe8e3('0x89')]){_0x3a0f9d['include']=[{'all':!![]}];}return db[_0xe8e3('0x65')]['findAll'](_0x3a0f9d);})[_0xe8e3('0x2c')](function(_0x4dae95){_0x5822e0[_0xe8e3('0x48')]=_0x4dae95;return _0x5822e0;});}})[_0xe8e3('0x2c')](respondWithFilteredResult(_0x2d978f,_0x3a0f9d))[_0xe8e3('0x49')](handleError(_0x2d978f,null));};exports[_0xe8e3('0x8c')]=function(_0x1b8213,_0x1f26e7,_0x12be1b){var _0x4316dd={'raw':!![],'where':{}};var _0x2dd9e1={};var _0xd40bca={'count':0x0,'rows':[]};return db[_0xe8e3('0x44')][_0xe8e3('0x83')]({'where':{'id':_0x1b8213[_0xe8e3('0x4b')]['id']}})[_0xe8e3('0x2c')](handleEntityNotFound(_0x1f26e7,null))['then'](function(_0x3b7019){if(_0x3b7019){_0x2dd9e1[_0xe8e3('0x2d')]=_['keys'](db[_0xe8e3('0x64')]['rawAttributes']);_0x2dd9e1['query']=_[_0xe8e3('0x2e')](_0x1b8213[_0xe8e3('0x2f')]);_0x2dd9e1['filters']=_[_0xe8e3('0x31')](_0x2dd9e1[_0xe8e3('0x2d')],_0x2dd9e1[_0xe8e3('0x2f')]);_0x4316dd[_0xe8e3('0x33')]=_['intersection'](_0x2dd9e1[_0xe8e3('0x2d')],qs['fields'](_0x1b8213[_0xe8e3('0x2f')][_0xe8e3('0x32')]));_0x4316dd[_0xe8e3('0x33')]=_0x4316dd[_0xe8e3('0x33')]['length']?_0x4316dd[_0xe8e3('0x33')]:_0x2dd9e1[_0xe8e3('0x2d')];if(!_0x1b8213[_0xe8e3('0x2f')][_0xe8e3('0x35')](_0xe8e3('0x36'))){_0x4316dd[_0xe8e3('0x37')]=qs[_0xe8e3('0x37')](_0x1b8213[_0xe8e3('0x2f')][_0xe8e3('0x37')]);_0x4316dd[_0xe8e3('0x22')]=qs[_0xe8e3('0x22')](_0x1b8213[_0xe8e3('0x2f')][_0xe8e3('0x22')]);}_0x4316dd[_0xe8e3('0x38')]=qs[_0xe8e3('0x39')](_0x1b8213['query'][_0xe8e3('0x39')]);_0x4316dd['where']=qs['filters'](_['pick'](_0x1b8213[_0xe8e3('0x2f')],_0x2dd9e1['filters']));_0x4316dd[_0xe8e3('0x3a')][_0xe8e3('0x8b')]=_0x3b7019['id'];if(_0x1b8213[_0xe8e3('0x2f')][_0xe8e3('0x3c')]){_0x4316dd[_0xe8e3('0x3a')]=_[_0xe8e3('0x3d')](_0x4316dd['where'],{'$or':_['map'](_0x4316dd[_0xe8e3('0x33')],function(_0xe01d7e){var _0x3be239={};_0x3be239[_0xe01d7e]={'$like':'%'+_0x1b8213[_0xe8e3('0x2f')][_0xe8e3('0x3c')]+'%'};return _0x3be239;})});}_0x4316dd=_[_0xe8e3('0x3d')]({},_0x4316dd,_0x1b8213[_0xe8e3('0x88')]);return db[_0xe8e3('0x64')]['count']({'where':_0x4316dd[_0xe8e3('0x3a')]})[_0xe8e3('0x2c')](function(_0x16670a){_0xd40bca['count']=_0x16670a;if(_0x1b8213['query'][_0xe8e3('0x89')]){_0x4316dd['include']=[{'all':!![]}];}return db[_0xe8e3('0x64')]['findAll'](_0x4316dd);})[_0xe8e3('0x2c')](function(_0x30a038){_0xd40bca[_0xe8e3('0x48')]=_0x30a038;return _0xd40bca;});}})[_0xe8e3('0x2c')](respondWithFilteredResult(_0x1f26e7,_0x4316dd))[_0xe8e3('0x49')](handleError(_0x1f26e7,null));};exports['getJscriptySessions']=function(_0x57cc91,_0x15f353,_0x225ee8){var _0x53b5b3={'raw':!![],'where':{}};var _0x4b38e3={};var _0x3b2af2={'count':0x0,'rows':[]};return db[_0xe8e3('0x44')][_0xe8e3('0x83')]({'where':{'id':_0x57cc91[_0xe8e3('0x4b')]['id']}})[_0xe8e3('0x2c')](handleEntityNotFound(_0x15f353,null))[_0xe8e3('0x2c')](function(_0x58459e){if(_0x58459e){_0x4b38e3[_0xe8e3('0x2d')]=_['keys'](db[_0xe8e3('0x8d')][_0xe8e3('0x84')]);_0x4b38e3[_0xe8e3('0x2f')]=_[_0xe8e3('0x2e')](_0x57cc91[_0xe8e3('0x2f')]);_0x4b38e3[_0xe8e3('0x30')]=_[_0xe8e3('0x31')](_0x4b38e3[_0xe8e3('0x2d')],_0x4b38e3[_0xe8e3('0x2f')]);_0x53b5b3[_0xe8e3('0x33')]=_[_0xe8e3('0x31')](_0x4b38e3[_0xe8e3('0x2d')],qs[_0xe8e3('0x32')](_0x57cc91[_0xe8e3('0x2f')][_0xe8e3('0x32')]));_0x53b5b3[_0xe8e3('0x33')]=_0x53b5b3['attributes'][_0xe8e3('0x34')]?_0x53b5b3['attributes']:_0x4b38e3[_0xe8e3('0x2d')];if(!_0x57cc91['query'][_0xe8e3('0x35')](_0xe8e3('0x36'))){_0x53b5b3[_0xe8e3('0x37')]=qs['limit'](_0x57cc91['query'][_0xe8e3('0x37')]);_0x53b5b3[_0xe8e3('0x22')]=qs[_0xe8e3('0x22')](_0x57cc91[_0xe8e3('0x2f')][_0xe8e3('0x22')]);}_0x53b5b3[_0xe8e3('0x38')]=qs['sort'](_0x57cc91[_0xe8e3('0x2f')][_0xe8e3('0x39')]);_0x53b5b3[_0xe8e3('0x3a')]=qs[_0xe8e3('0x30')](_[_0xe8e3('0x3b')](_0x57cc91['query'],_0x4b38e3[_0xe8e3('0x30')]));_0x53b5b3['where'][_0xe8e3('0x8b')]=_0x58459e['id'];if(_0x57cc91[_0xe8e3('0x2f')][_0xe8e3('0x3c')]){_0x53b5b3[_0xe8e3('0x3a')]=_[_0xe8e3('0x3d')](_0x53b5b3[_0xe8e3('0x3a')],{'$or':_[_0xe8e3('0x3e')](_0x53b5b3[_0xe8e3('0x33')],function(_0x2ed0db){var _0xd0db9f={};_0xd0db9f[_0x2ed0db]={'$like':'%'+_0x57cc91['query']['filter']+'%'};return _0xd0db9f;})});}_0x53b5b3=_[_0xe8e3('0x3d')]({},_0x53b5b3,_0x57cc91[_0xe8e3('0x88')]);return db[_0xe8e3('0x8d')][_0xe8e3('0x45')]({'where':_0x53b5b3['where']})[_0xe8e3('0x2c')](function(_0x2b3a2b){_0x3b2af2[_0xe8e3('0x45')]=_0x2b3a2b;if(_0x57cc91[_0xe8e3('0x2f')][_0xe8e3('0x89')]){_0x53b5b3[_0xe8e3('0x40')]=[{'all':!![]}];}return db[_0xe8e3('0x8d')][_0xe8e3('0x51')](_0x53b5b3);})[_0xe8e3('0x2c')](function(_0x405d80){_0x3b2af2[_0xe8e3('0x48')]=_0x405d80;return _0x3b2af2;});}})['then'](respondWithFilteredResult(_0x15f353,_0x53b5b3))[_0xe8e3('0x49')](handleError(_0x15f353,null));};exports[_0xe8e3('0x8e')]=function(_0x2deaa0,_0xee14d7,_0x177f7d){try{if(!_0x2deaa0[_0xe8e3('0x52')][_0xe8e3('0x71')]){throw new Error(_0xe8e3('0x8f'));}if(!_0x2deaa0['body']['binding_keys']){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x2deaa0[_0xe8e3('0x52')][_0xe8e3('0x90')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x2deaa0['body'][_0xe8e3('0x91')]){throw new Error(_0xe8e3('0x92'));}var _0x32aebe=_0x2deaa0['body'][_0xe8e3('0x93')][_0xe8e3('0x94')](',');var _0x31c47b=_0x2deaa0[_0xe8e3('0x52')]['binding_values'][_0xe8e3('0x94')](',');if(!_0x32aebe[_0xe8e3('0x34')]||!_0x31c47b['length']||_0x32aebe['length']!==_0x31c47b[_0xe8e3('0x34')]){throw new Error(_0xe8e3('0x95'));}_0x2deaa0[_0xe8e3('0x52')][_0xe8e3('0x32')]=_[_0xe8e3('0x96')](_0x32aebe,_0x31c47b);if(!_0x2deaa0[_0xe8e3('0x52')]['fields']['phone']){throw new Error(_0xe8e3('0x97'));}if(!_0x2deaa0[_0xe8e3('0x52')]['fields'][_0xe8e3('0x98')]){throw new Error(_0xe8e3('0x99'));}var _0x1ac255=path['join'](config['root'],'server/files/tmp',_0x2deaa0[_0xe8e3('0x9a')]['filename']);fs[_0xe8e3('0x9b')](_0x1ac255,parseInt(_0xe8e3('0x9c'),0x8));var _0x1ff278=require('child_process')[_0xe8e3('0x9d')](path[_0xe8e3('0x56')](__dirname,'../../components/import/cm/csv'),[_0x1ac255,_0x2deaa0[_0xe8e3('0x52')]['binding_keys'],_0x2deaa0[_0xe8e3('0x52')][_0xe8e3('0x90')],_0x2deaa0[_0xe8e3('0x52')]['ListId'],_0x2deaa0['body'][_0xe8e3('0x9e')],_0x2deaa0[_0xe8e3('0x52')][_0xe8e3('0x6f')],_0x2deaa0['body'][_0xe8e3('0x91')]]);return _0xee14d7[_0xe8e3('0x1f')](0xc8)[_0xe8e3('0x21')]({'message':_0xe8e3('0x9f'),'pid':_0x1ff278['pid']});}catch(_0x35cc6d){return _0xee14d7[_0xe8e3('0x1f')](0x1f4)['send'](_0x35cc6d);}};exports[_0xe8e3('0xa0')]=function(_0x35328b,_0xa905e6,_0xfdc362){var _0x37d407=fs[_0xe8e3('0xa1')](_0x35328b[_0xe8e3('0x9a')][_0xe8e3('0x7')]);Papa[_0xe8e3('0xa2')](_0x37d407,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x38e28e){return _0xa905e6[_0xe8e3('0x1f')](0xc8)[_0xe8e3('0x21')]({'file':_0x35328b[_0xe8e3('0x9a')],'fields':_0x38e28e[_0xe8e3('0xa3')][_0xe8e3('0x32')]});}});};exports['import']=function(_0x4152ac,_0x1b4377,_0x3d384e){return db[_0xe8e3('0xa4')][_0xe8e3('0x51')]({'raw':!![],'attributes':['id'],'where':{'role':_0xe8e3('0xa5')}})[_0xe8e3('0x2c')](function(_0x4db55e){var _0x323fa7=![];if(!_0x4152ac['body'][_0xe8e3('0x71')]){throw new Error('No\x20ListId\x20specified');}if(!_0x4152ac[_0xe8e3('0x52')]['binding'][_0xe8e3('0x81')]){throw new Error(_0xe8e3('0x97'));}if(!_0x4152ac['body'][_0xe8e3('0xa6')][_0xe8e3('0x98')]){throw new Error(_0xe8e3('0x99'));}if(!_0x4152ac['body'][_0xe8e3('0x91')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x85e707=require(_0xe8e3('0xa7'))[_0xe8e3('0x9d')](path['join'](__dirname,_0xe8e3('0xa8')),[_0x4152ac[_0xe8e3('0x4b')]['id'],JSON[_0xe8e3('0xa9')](_0x4152ac[_0xe8e3('0x52')]),JSON['stringify'](_0x4db55e)]);_0x85e707['on'](_0xe8e3('0xaa'),function(_0x28e1eb){_0x323fa7=!![];return _0x1b4377['status'](0xc8)['json']({'message':_0xe8e3('0xab'),'pid':_0x85e707['pid']});});_0x85e707['on']('exit',function(_0x185674){if(_0x185674&&!_0x323fa7){return _0x1b4377[_0xe8e3('0x1f')](0x1f4)[_0xe8e3('0x21')]({'message':_0xe8e3('0xac'),'pid':_0x85e707[_0xe8e3('0xad')]});}});})[_0xe8e3('0x49')](handleError(_0x1b4377,null));};
\ No newline at end of file
+var _0x7e1a=['No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','root','server/files/tmp','filename','chmodSync','child_process','../../components/import/cm/csv','CompanyId','pid','upload','file','parse','meta','import','User','agent','binding','socket_timestamp','fork','../../components/import/cm/csv2','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','send','index','CmContact','keys','query','filters','intersection','model','attributes','fields','nolimit','order','pick','filter','where','merge','map','options','include','push','Tags','tag','includeAll','Tag','name','color','ThroughTags','findAll','rows','destroy','find','params','catch','length','startsWith','columnName','displayName','CmCustomField','alias','hasOwnProperty','body','get','mergeWith','tags','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','from','CmHopper','CmHopperBlack','create','ChatInteraction','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxMessage','OpenchannelMessage','CmHopperHistory','ReportAgentPreview','VoiceCallReport','JscriptySessionReport','describe','isArray','each','duplicates','$or','ListId','error','show','$and','omit','cf_%d','cf_','format','isEmpty','table','toParam','sequelize','text','values','phone','getTags','rawAttributes','sort','setTags','ids','getHoppers','findOne','ContactId','getHopperHistories','getHopperFinals','CmHopperFinal','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values'];(function(_0x2ce425,_0x1779a8){var _0x53e4cf=function(_0x20afaf){while(--_0x20afaf){_0x2ce425['push'](_0x2ce425['shift']());}};_0x53e4cf(++_0x1779a8);}(_0x7e1a,0x16e));var _0xa7e1=function(_0x4d176f,_0x4ed4c7){_0x4d176f=_0x4d176f-0x0;var _0x25e9cb=_0x7e1a[_0x4d176f];return _0x25e9cb;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa7e1('0x0'));var zipdir=require(_0xa7e1('0x1'));var jsonpatch=require(_0xa7e1('0x2'));var rp=require(_0xa7e1('0x3'));var moment=require(_0xa7e1('0x4'));var BPromise=require(_0xa7e1('0x5'));var Mustache=require(_0xa7e1('0x6'));var util=require(_0xa7e1('0x7'));var path=require('path');var sox=require(_0xa7e1('0x8'));var csv=require('to-csv');var ejs=require(_0xa7e1('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa7e1('0xa'));var crypto=require('crypto');var jsforce=require(_0xa7e1('0xb'));var deskjs=require(_0xa7e1('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa7e1('0xd'));var authService=require(_0xa7e1('0xe'));var hardwareService=require(_0xa7e1('0xf'));var Redis=require(_0xa7e1('0x10'));var qs=require(_0xa7e1('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xa7e1('0x12'));var config=require(_0xa7e1('0x13'));var db=require(_0xa7e1('0x14'))['db'];config[_0xa7e1('0x15')]=_[_0xa7e1('0x16')](config[_0xa7e1('0x15')],{'host':_0xa7e1('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa7e1('0x15')]));require('./cmContact.socket')['register'](socket);function respondWithStatusCode(_0x2547b2,_0xd8499c){_0xd8499c=_0xd8499c||0xcc;return function(_0x50bb1f){if(_0x50bb1f){return _0x2547b2[_0xa7e1('0x18')](_0xd8499c);}return _0x2547b2[_0xa7e1('0x19')](_0xd8499c)[_0xa7e1('0x1a')]();};}function respondWithResult(_0x4bf659,_0x54916f){_0x54916f=_0x54916f||0xc8;return function(_0x46ce30){if(_0x46ce30){return _0x4bf659[_0xa7e1('0x19')](_0x54916f)[_0xa7e1('0x1b')](_0x46ce30);}};}function respondWithFilteredResult(_0x581506,_0x1f2d76){return function(_0x4b07de){if(_0x4b07de){var _0x1fe213=_0x4b07de[_0xa7e1('0x1c')],_0x150ce4=_0x1f2d76[_0xa7e1('0x1d')],_0x481903=_0x1f2d76[_0xa7e1('0x1d')]+_0x1f2d76[_0xa7e1('0x1e')],_0x25ec78;if(_0x481903>=_0x1fe213){_0x481903=_0x1fe213;_0x25ec78=0xc8;}else{_0x25ec78=0xce;}_0x581506[_0xa7e1('0x19')](_0x25ec78);return _0x581506[_0xa7e1('0x1f')](_0xa7e1('0x20'),_0x150ce4+'-'+_0x481903+'/'+_0x1fe213)[_0xa7e1('0x1b')](_0x4b07de);}return null;};}function patchUpdates(_0x55ac40){return function(_0x1504c1){try{jsonpatch[_0xa7e1('0x21')](_0x1504c1,_0x55ac40,!![]);}catch(_0x1ce2ee){return BPromise[_0xa7e1('0x22')](_0x1ce2ee);}return _0x1504c1[_0xa7e1('0x23')]();};}function saveUpdates(_0x30d161,_0x5bc1f4){return function(_0x343da0){if(_0x343da0){return _0x343da0[_0xa7e1('0x24')](_0x30d161)[_0xa7e1('0x25')](function(_0x2acef9){return _0x2acef9;});}return null;};}function removeEntity(_0x20e1f4,_0x3e8e29){return function(_0xa5a8fb){if(_0xa5a8fb){return _0xa5a8fb['destroy']()[_0xa7e1('0x25')](function(){_0x20e1f4[_0xa7e1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49ba7b,_0x4fee18){return function(_0x3fe2b3){if(!_0x3fe2b3){_0x49ba7b[_0xa7e1('0x18')](0x194);}return _0x3fe2b3;};}function handleError(_0x38489c,_0x531d39){_0x531d39=_0x531d39||0x1f4;return function(_0x143833){logger['error'](_0x143833['stack']);if(_0x143833['name']){delete _0x143833['name'];}_0x38489c[_0xa7e1('0x19')](_0x531d39)[_0xa7e1('0x26')](_0x143833);};}exports[_0xa7e1('0x27')]=function(_0x3f5d7c,_0x2d6354){var _0x394460={},_0x44fbf6={},_0x3abf0a={'count':0x0,'rows':[]};return db[_0xa7e1('0x28')]['describe']()[_0xa7e1('0x25')](function(_0x42b53a){_0x44fbf6['model']=_[_0xa7e1('0x29')](_0x42b53a);_0x44fbf6[_0xa7e1('0x2a')]=_['keys'](_0x3f5d7c[_0xa7e1('0x2a')]);_0x44fbf6[_0xa7e1('0x2b')]=_[_0xa7e1('0x2c')](_0x44fbf6[_0xa7e1('0x2d')],_0x44fbf6[_0xa7e1('0x2a')]);_0x394460[_0xa7e1('0x2e')]=_[_0xa7e1('0x2c')](_0x44fbf6[_0xa7e1('0x2d')],qs[_0xa7e1('0x2f')](_0x3f5d7c[_0xa7e1('0x2a')]['fields']));_0x394460[_0xa7e1('0x2e')]=_0x394460[_0xa7e1('0x2e')]['length']?_0x394460['attributes']:_0x44fbf6[_0xa7e1('0x2d')];if(!_0x3f5d7c[_0xa7e1('0x2a')]['hasOwnProperty'](_0xa7e1('0x30'))){_0x394460['limit']=qs[_0xa7e1('0x1e')](_0x3f5d7c[_0xa7e1('0x2a')]['limit']);_0x394460[_0xa7e1('0x1d')]=qs[_0xa7e1('0x1d')](_0x3f5d7c[_0xa7e1('0x2a')]['offset']);}_0x394460[_0xa7e1('0x31')]=qs['sort'](_0x3f5d7c[_0xa7e1('0x2a')]['sort']);_0x394460['where']=qs['filters'](_[_0xa7e1('0x32')](_0x3f5d7c[_0xa7e1('0x2a')],_0x44fbf6[_0xa7e1('0x2b')]));if(_0x3f5d7c[_0xa7e1('0x2a')][_0xa7e1('0x33')]){_0x394460[_0xa7e1('0x34')]=_[_0xa7e1('0x35')](_0x394460['where'],{'$or':_[_0xa7e1('0x36')](_0x394460['attributes'],function(_0x3e148f){var _0x3d65ec={};_0x3d65ec[_0x3e148f]={'$like':'%'+_0x3f5d7c[_0xa7e1('0x2a')][_0xa7e1('0x33')]+'%'};return _0x3d65ec;})});}_0x394460=_[_0xa7e1('0x35')]({},_0x394460,_0x3f5d7c[_0xa7e1('0x37')]);var _0x373cb8={'where':_0x394460[_0xa7e1('0x34')]};_0x373cb8['include']=[];if(_0x3f5d7c[_0xa7e1('0x2a')]['tag']){_0x373cb8[_0xa7e1('0x38')][_0xa7e1('0x39')]({'model':db['Tag'],'as':_0xa7e1('0x3a'),'attributes':['id'],'where':{'id':_0x3f5d7c[_0xa7e1('0x2a')][_0xa7e1('0x3b')]},'required':!![]});_0x373cb8['distinct']=!![];}return db['CmContact']['count'](_0x373cb8)[_0xa7e1('0x25')](function(_0x113145){_0x3abf0a[_0xa7e1('0x1c')]=_0x113145;if(_0x3f5d7c['query'][_0xa7e1('0x3c')]){_0x394460[_0xa7e1('0x38')]=[{'model':db[_0xa7e1('0x3d')],'as':_0xa7e1('0x3a'),'attributes':['id',_0xa7e1('0x3e'),_0xa7e1('0x3f')],'required':_0x3f5d7c[_0xa7e1('0x2a')][_0xa7e1('0x3b')]?!![]:![]},{'model':db[_0xa7e1('0x3d')],'as':_0xa7e1('0x40'),'attributes':['id',_0xa7e1('0x3e'),_0xa7e1('0x3f')],'through':_0x3f5d7c[_0xa7e1('0x2a')]['tag']?{'attributes':[],'where':{'TagId':_0x3f5d7c[_0xa7e1('0x2a')][_0xa7e1('0x3b')]||undefined}}:{},'required':_0x3f5d7c['query'][_0xa7e1('0x3b')]?!![]:![]}];}return db[_0xa7e1('0x28')][_0xa7e1('0x41')](_0x394460);})[_0xa7e1('0x25')](function(_0x2af410){_0x3abf0a[_0xa7e1('0x42')]=_0x2af410;return _0x3abf0a;})[_0xa7e1('0x25')](respondWithFilteredResult(_0x2d6354,_0x394460))['catch'](handleError(_0x2d6354,null));});};exports[_0xa7e1('0x43')]=function(_0x5ef207,_0x15f090){return db['CmContact'][_0xa7e1('0x44')]({'where':{'id':_0x5ef207[_0xa7e1('0x45')]['id']}})[_0xa7e1('0x25')](handleEntityNotFound(_0x15f090,null))[_0xa7e1('0x25')](removeEntity(_0x15f090,null))[_0xa7e1('0x46')](handleError(_0x15f090,null));};exports['describe']=function(_0x5888a2,_0x2fe695){return db[_0xa7e1('0x28')]['describe']()['then'](function(_0x34af4c){for(var _0x59a0de=0x0;_0x59a0de<Object[_0xa7e1('0x29')](_0x34af4c)[_0xa7e1('0x47')];_0x59a0de++){var _0x176608=Object['keys'](_0x34af4c)[_0x59a0de];if(!_[_0xa7e1('0x48')](_0x176608,'cf_')){_0x34af4c[_0x176608][_0xa7e1('0x49')]=_0x176608;_0x34af4c[_0x176608][_0xa7e1('0x4a')]=_0x176608;}}return _0x34af4c;})[_0xa7e1('0x25')](function(_0xbf522b){var _0x47143b={'where':{'$or':[{'ListId':_0x5888a2[_0xa7e1('0x2a')]['id']},{'ListId':null}]},'raw':!![]};return db[_0xa7e1('0x4b')][_0xa7e1('0x41')](_0x47143b)[_0xa7e1('0x25')](function(_0x4c1f93){for(var _0x188744=0x0;_0x188744<_0x4c1f93[_0xa7e1('0x47')];_0x188744++){var _0x28600e='cf_'+_0x4c1f93[_0x188744]['id'];_0xbf522b[_0x28600e][_0xa7e1('0x49')]=_0x28600e;_0xbf522b[_0x28600e][_0xa7e1('0x4a')]=_0x4c1f93[_0x188744][_0xa7e1('0x4c')];}for(var _0x188744=0x0;_0x188744<Object[_0xa7e1('0x29')](_0xbf522b)[_0xa7e1('0x47')];_0x188744++){var _0x28600e=Object[_0xa7e1('0x29')](_0xbf522b)[_0x188744];if(!_0xbf522b[_0x28600e][_0xa7e1('0x4d')](_0xa7e1('0x49'))){delete _0xbf522b[_0x28600e];}}return _0xbf522b;});})[_0xa7e1('0x25')](respondWithResult(_0x2fe695,null))['catch'](handleError(_0x2fe695,null));};exports[_0xa7e1('0x35')]=function(_0x467013,_0x387e84){var _0x3c6423;var _0x8159a9;var _0x522da2;if(_0x467013[_0xa7e1('0x4e')]['id']){delete _0x467013[_0xa7e1('0x4e')]['id'];}return db[_0xa7e1('0x28')][_0xa7e1('0x41')]({'where':{'id':[_0x467013[_0xa7e1('0x4e')]['to'],_0x467013['body']['from']]}})['then'](function(_0x5e3948){if(_0x5e3948){if(_0x5e3948['length']!==0x2){return null;}_0x5e3948[0x0]=_0x5e3948[0x0][_0xa7e1('0x4f')]({'plain':!![]});_0x5e3948[0x1]=_0x5e3948[0x1]['get']({'plain':!![]});delete _0x5e3948[0x0]['id'];delete _0x5e3948[0x1]['id'];return _[_0xa7e1('0x50')](_0x5e3948[0x0],_0x5e3948[0x1],function(_0x263f00,_0x300d67){if(Array['isArray'](_0x300d67)&&!_0x300d67[_0xa7e1('0x47')]){return _0x263f00;}else if(!_0x300d67){return _0x263f00;}});}})['then'](handleEntityNotFound(_0x387e84,null))[_0xa7e1('0x25')](function(_0x5d09ac){if(_0x5d09ac){if(_0x5d09ac['tags']&&_['isArray'](_0x5d09ac['tags'])){_0x5d09ac[_0xa7e1('0x51')]=_0x5d09ac[_0xa7e1('0x51')][_0xa7e1('0x52')]();}logger[_0xa7e1('0x53')](_0xa7e1('0x54'),_0x467013['body']['to'],_0x467013[_0xa7e1('0x4e')][_0xa7e1('0x55')]);return db[_0xa7e1('0x56')][_0xa7e1('0x43')]({'where':{'ContactId':[_0x467013[_0xa7e1('0x4e')]['to'],_0x467013[_0xa7e1('0x4e')][_0xa7e1('0x55')]]}})[_0xa7e1('0x25')](function(_0x5a404c){logger[_0xa7e1('0x53')]('[CmContact][merge][destroy][CmHopper],\x20%s',_0x5a404c);return db[_0xa7e1('0x57')][_0xa7e1('0x43')]({'where':{'ContactId':[_0x467013[_0xa7e1('0x4e')]['to'],_0x467013['body']['from']]}})[_0xa7e1('0x25')](function(_0x4ea18d){logger[_0xa7e1('0x53')]('[CmContact][merge][destroy][CmHopperBlack],\x20%s',_0x4ea18d);return db[_0xa7e1('0x28')][_0xa7e1('0x58')](_0x5d09ac);});});}})[_0xa7e1('0x25')](function(_0x235284){if(_0x235284){_0x3c6423=_0x235284;_0x8159a9={'ContactId':_0x3c6423['id']};_0x522da2={'where':{'ContactId':[_0x467013[_0xa7e1('0x4e')]['to'],_0x467013[_0xa7e1('0x4e')][_0xa7e1('0x55')]]}};return db[_0xa7e1('0x59')][_0xa7e1('0x24')](_0x8159a9,_0x522da2);}})[_0xa7e1('0x25')](function(){if(_0x3c6423){return db['ChatMessage'][_0xa7e1('0x24')](_0x8159a9,_0x522da2);}})[_0xa7e1('0x25')](function(){if(_0x3c6423){return db[_0xa7e1('0x5a')]['update'](_0x8159a9,_0x522da2);}})['then'](function(){if(_0x3c6423){return db[_0xa7e1('0x5b')][_0xa7e1('0x24')](_0x8159a9,_0x522da2);}})['then'](function(){if(_0x3c6423){return db[_0xa7e1('0x5c')][_0xa7e1('0x24')](_0x8159a9,_0x522da2);}})[_0xa7e1('0x25')](function(){if(_0x3c6423){return db[_0xa7e1('0x5b')][_0xa7e1('0x24')](_0x8159a9,_0x522da2);}})[_0xa7e1('0x25')](function(){if(_0x3c6423){return db[_0xa7e1('0x5c')][_0xa7e1('0x24')](_0x8159a9,_0x522da2);}})[_0xa7e1('0x25')](function(){if(_0x3c6423){return db[_0xa7e1('0x5d')][_0xa7e1('0x24')](_0x8159a9,_0x522da2);}})[_0xa7e1('0x25')](function(){if(_0x3c6423){return db[_0xa7e1('0x5e')][_0xa7e1('0x24')](_0x8159a9,_0x522da2);}})[_0xa7e1('0x25')](function(){if(_0x3c6423){return db['FaxInteraction'][_0xa7e1('0x24')](_0x8159a9,_0x522da2);}})[_0xa7e1('0x25')](function(){if(_0x3c6423){return db[_0xa7e1('0x5f')][_0xa7e1('0x24')](_0x8159a9,_0x522da2);}})[_0xa7e1('0x25')](function(){if(_0x3c6423){return db['OpenchannelInteraction']['update'](_0x8159a9,_0x522da2);}})['then'](function(){if(_0x3c6423){return db[_0xa7e1('0x60')][_0xa7e1('0x24')](_0x8159a9,_0x522da2);}})[_0xa7e1('0x25')](function(){if(_0x3c6423){return db['CmHopperFinal'][_0xa7e1('0x24')](_0x8159a9,_0x522da2);}})[_0xa7e1('0x25')](function(){if(_0x3c6423){return db[_0xa7e1('0x61')][_0xa7e1('0x24')](_0x8159a9,_0x522da2);}})['then'](function(){if(_0x3c6423){return db[_0xa7e1('0x62')][_0xa7e1('0x24')](_0x8159a9,_0x522da2);}})['then'](function(){if(_0x3c6423){return db[_0xa7e1('0x63')]['update'](_0x8159a9,_0x522da2);}})[_0xa7e1('0x25')](function(){if(_0x3c6423){return db['ChatQueueReport'][_0xa7e1('0x24')](_0x8159a9,_0x522da2);}})[_0xa7e1('0x25')](function(){if(_0x3c6423){return db['FaxQueueReport'][_0xa7e1('0x24')](_0x8159a9,_0x522da2);}})[_0xa7e1('0x25')](function(){if(_0x3c6423){return db['MailQueueReport'][_0xa7e1('0x24')](_0x8159a9,_0x522da2);}})[_0xa7e1('0x25')](function(){if(_0x3c6423){return db['OpenchannelQueueReport'][_0xa7e1('0x24')](_0x8159a9,_0x522da2);}})[_0xa7e1('0x25')](function(){if(_0x3c6423){return db['SmsQueueReport'][_0xa7e1('0x24')](_0x8159a9,_0x522da2);}})[_0xa7e1('0x25')](function(){if(_0x3c6423){return db[_0xa7e1('0x64')]['update'](_0x8159a9,_0x522da2);}})[_0xa7e1('0x25')](function(){if(_0x3c6423){return db['CmContact'][_0xa7e1('0x43')]({'where':{'id':[_0x467013[_0xa7e1('0x4e')]['to'],_0x467013[_0xa7e1('0x4e')][_0xa7e1('0x55')]]}});}})[_0xa7e1('0x25')](function(){if(_0x3c6423){return _0x3c6423;}})['then'](respondWithResult(_0x387e84,null))['catch'](handleError(_0x387e84,null));};exports[_0xa7e1('0x58')]=function(_0x10e14c,_0x152694){return db[_0xa7e1('0x28')][_0xa7e1('0x65')]()[_0xa7e1('0x25')](function(_0x422589){if(_0x10e14c[_0xa7e1('0x4e')][_0xa7e1('0x51')]&&_[_0xa7e1('0x66')](_0x10e14c[_0xa7e1('0x4e')]['tags'])){if(_0x10e14c[_0xa7e1('0x4e')]['tags'][_0xa7e1('0x47')]){_0x10e14c['body']['tags']=_0x10e14c[_0xa7e1('0x4e')][_0xa7e1('0x51')][_0xa7e1('0x52')](';')+';';}else{_0x10e14c[_0xa7e1('0x4e')][_0xa7e1('0x51')]=null;}}else{_0x10e14c[_0xa7e1('0x4e')][_0xa7e1('0x51')]=null;}return db[_0xa7e1('0x28')][_0xa7e1('0x58')](_0x10e14c[_0xa7e1('0x4e')],{'fields':_[_0xa7e1('0x29')](_0x422589),'raw':!![]});})[_0xa7e1('0x25')](respondWithResult(_0x152694,0xc9))['catch'](handleError(_0x152694,null));};exports['bulkCreate']=function(_0x1f5fbf,_0x33b7f2){var _0x345743=[];var _0x509ce2=0x0;var _0x17a0c0=0x0;var _0x1c9e7a=0x0;return db[_0xa7e1('0x28')][_0xa7e1('0x65')]()[_0xa7e1('0x25')](function(_0x129794){return BPromise[_0xa7e1('0x67')](_0x1f5fbf[_0xa7e1('0x4e')],function(_0x34a814){var _0x2f8646={'where':{'$or':[]},'defaults':_0x34a814,'fields':_[_0xa7e1('0x29')](_0x129794),'raw':!![]};if(_0x34a814[_0xa7e1('0x68')]){for(var _0x111cb3=0x0;_0x111cb3<_0x34a814['duplicates'][_0xa7e1('0x47')];_0x111cb3++){var _0x582e22={};_0x582e22[_0x34a814[_0xa7e1('0x68')][_0x111cb3]]=_0x34a814[_0x34a814[_0xa7e1('0x68')][_0x111cb3]];_0x2f8646[_0xa7e1('0x34')][_0xa7e1('0x69')][_0xa7e1('0x39')](_0x582e22);}_0x2f8646['where'][_0xa7e1('0x6a')]=_0x34a814[_0xa7e1('0x6a')];}return db['CmContact']['findOrCreate'](_0x2f8646)['spread'](function(_0x1a0abe,_0x59b7df){if(_0x59b7df){_0x509ce2++;}else{_0x1c9e7a++;}})[_0xa7e1('0x46')](function(_0x2b63f2){console[_0xa7e1('0x6b')](_0x2b63f2);_0x17a0c0++;});});})[_0xa7e1('0x25')](function(_0x115203){if(_0x115203){return{'success':_0x509ce2,'failure':_0x17a0c0,'duplicates':_0x1c9e7a};}})[_0xa7e1('0x25')](respondWithResult(_0x33b7f2,0xc9))[_0xa7e1('0x46')](handleError(_0x33b7f2,null));};exports[_0xa7e1('0x6c')]=function(_0x2dea0b,_0x360bb2,_0x5e642f){var _0xbb3601;return db[_0xa7e1('0x28')][_0xa7e1('0x65')]()['then'](function(_0x2ce015){return db[_0xa7e1('0x28')][_0xa7e1('0x44')]({'where':{'id':_0x2dea0b[_0xa7e1('0x45')]['id']},'include':[{'model':db[_0xa7e1('0x3d')],'as':'Tags','attributes':['id',_0xa7e1('0x3e'),_0xa7e1('0x3f')],'required':_0x2dea0b['query']['tag']?!![]:![]}],'attributes':_['keys'](_0x2ce015)});})[_0xa7e1('0x25')](function(_0x9b57e2){_0xbb3601=_0x9b57e2[_0xa7e1('0x4f')]({'plain':!![]});var _0x144f64={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x9b57e2&&_0x9b57e2['ListId']){if(_0x9b57e2['ListId']){_0x144f64[_0xa7e1('0x34')][_0xa7e1('0x6d')][_0xa7e1('0x39')]({'ListId':{'$ne':_0x9b57e2[_0xa7e1('0x6a')]}});}}return db[_0xa7e1('0x4b')][_0xa7e1('0x41')](_0x144f64);})['then'](function(_0x23ae42){return _[_0xa7e1('0x6e')](_0xbb3601,_[_0xa7e1('0x36')](_0x23ae42,function(_0x1ab678){return util['format'](_0xa7e1('0x6f'),_0x1ab678['id']);}));})[_0xa7e1('0x25')](handleEntityNotFound(_0x360bb2,null))[_0xa7e1('0x25')](respondWithResult(_0x360bb2,null))[_0xa7e1('0x46')](handleError(_0x360bb2,null));};exports[_0xa7e1('0x24')]=function(_0x4eb79f,_0x2c4fb9){var _0x2c4609;if(_0x4eb79f['body']['id']){delete _0x4eb79f[_0xa7e1('0x4e')]['id'];}return db['CmContact'][_0xa7e1('0x44')]({'where':{'id':_0x4eb79f['params']['id']}})['then'](handleEntityNotFound(_0x2c4fb9,null))[_0xa7e1('0x25')](saveUpdates(_0x4eb79f[_0xa7e1('0x4e')],null))[_0xa7e1('0x25')](function(_0x2fc138){_0x2c4609=_0x2fc138;var _0x5a90fa={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2fc138&&_0x2fc138[_0xa7e1('0x6a')]){if(_0x2fc138['ListId']){_0x5a90fa['where'][_0xa7e1('0x6d')][_0xa7e1('0x39')]({'ListId':{'$ne':_0x2fc138[_0xa7e1('0x6a')]}});}}return db['CmCustomField']['findAll'](_0x5a90fa);})[_0xa7e1('0x25')](function(_0x442f6a){if(_0x442f6a){return _[_0xa7e1('0x6e')](_['pickBy'](_0x4eb79f[_0xa7e1('0x4e')],function(_0x338a26,_0x332e86){return _[_0xa7e1('0x48')](_0x332e86,_0xa7e1('0x70'));}),_['map'](_0x442f6a,function(_0x52b941){return util[_0xa7e1('0x71')](_0xa7e1('0x6f'),_0x52b941['id']);}));}})[_0xa7e1('0x25')](function(_0x435e7f){if(_0x435e7f&&!_[_0xa7e1('0x72')](_0x435e7f)){var _0xd19f62=squel[_0xa7e1('0x24')]()[_0xa7e1('0x73')]('cm_contacts')['setFields'](_0x435e7f)['where']('id\x20=\x20?',_0x4eb79f[_0xa7e1('0x45')]['id'])[_0xa7e1('0x74')]();return db[_0xa7e1('0x75')][_0xa7e1('0x2a')](_0xd19f62[_0xa7e1('0x76')],{'replacements':_0xd19f62[_0xa7e1('0x77')]});}})[_0xa7e1('0x25')](function(){if(_0x4eb79f[_0xa7e1('0x4e')][_0xa7e1('0x78')]&&_0x2c4609){return db['CmHopper']['update']({'phone':_0x4eb79f['body'][_0xa7e1('0x78')]},{'where':{'ContactId':_0x2c4609['id']}});}})['then'](function(){return _0x2c4609;})['then'](respondWithResult(_0x2c4fb9,null))[_0xa7e1('0x46')](handleError(_0x2c4fb9,null));};exports[_0xa7e1('0x79')]=function(_0x31e682,_0x2d5efd,_0xd82bb6){var _0x5f2796={};var _0x3133f5={};var _0x34b88a;var _0x4af8db;return db['CmContact']['findOne']({'where':{'id':_0x31e682['params']['id']}})[_0xa7e1('0x25')](handleEntityNotFound(_0x2d5efd,null))[_0xa7e1('0x25')](function(_0x2a8e94){if(_0x2a8e94){_0x34b88a=_0x2a8e94;_0x3133f5[_0xa7e1('0x2d')]=_[_0xa7e1('0x29')](db[_0xa7e1('0x3d')][_0xa7e1('0x7a')]);_0x3133f5[_0xa7e1('0x2a')]=_[_0xa7e1('0x29')](_0x31e682[_0xa7e1('0x2a')]);_0x3133f5['filters']=_[_0xa7e1('0x2c')](_0x3133f5['model'],_0x3133f5[_0xa7e1('0x2a')]);_0x5f2796['attributes']=_[_0xa7e1('0x2c')](_0x3133f5[_0xa7e1('0x2d')],qs[_0xa7e1('0x2f')](_0x31e682[_0xa7e1('0x2a')][_0xa7e1('0x2f')]));_0x5f2796[_0xa7e1('0x2e')]=_0x5f2796[_0xa7e1('0x2e')][_0xa7e1('0x47')]?_0x5f2796[_0xa7e1('0x2e')]:_0x3133f5[_0xa7e1('0x2d')];_0x5f2796[_0xa7e1('0x31')]=qs[_0xa7e1('0x7b')](_0x31e682[_0xa7e1('0x2a')][_0xa7e1('0x7b')]);_0x5f2796[_0xa7e1('0x34')]=qs[_0xa7e1('0x2b')](_[_0xa7e1('0x32')](_0x31e682[_0xa7e1('0x2a')],_0x3133f5[_0xa7e1('0x2b')]));if(_0x31e682[_0xa7e1('0x2a')][_0xa7e1('0x33')]){_0x5f2796['where']=_[_0xa7e1('0x35')](_0x5f2796[_0xa7e1('0x34')],{'$or':_[_0xa7e1('0x36')](_0x5f2796[_0xa7e1('0x2e')],function(_0x461203){var _0x3d83b0={};_0x3d83b0[_0x461203]={'$like':'%'+_0x31e682['query'][_0xa7e1('0x33')]+'%'};return _0x3d83b0;})});}_0x5f2796=_['merge']({},_0x5f2796,_0x31e682[_0xa7e1('0x37')]);return _0x34b88a['getTags'](_0x5f2796);}})['then'](function(_0x334a25){if(_0x334a25){_0x4af8db=_0x334a25[_0xa7e1('0x47')];if(!_0x31e682[_0xa7e1('0x2a')][_0xa7e1('0x4d')](_0xa7e1('0x30'))){_0x5f2796['limit']=qs[_0xa7e1('0x1e')](_0x31e682[_0xa7e1('0x2a')][_0xa7e1('0x1e')]);_0x5f2796[_0xa7e1('0x1d')]=qs[_0xa7e1('0x1d')](_0x31e682[_0xa7e1('0x2a')]['offset']);}return _0x34b88a['getTags'](_0x5f2796);}})[_0xa7e1('0x25')](function(_0x879c3a){if(_0x879c3a){return _0x879c3a?{'count':_0x4af8db,'rows':_0x879c3a}:null;}})['then'](respondWithResult(_0x2d5efd,null))[_0xa7e1('0x46')](handleError(_0x2d5efd,null));};exports[_0xa7e1('0x7c')]=function(_0x2bf0ad,_0x41cf20,_0x3d710a){if(_0x2bf0ad[_0xa7e1('0x4e')]['id']){delete _0x2bf0ad['body']['id'];}return db[_0xa7e1('0x28')]['findOne']({'where':{'id':_0x2bf0ad[_0xa7e1('0x45')]['id']}})[_0xa7e1('0x25')](handleEntityNotFound(_0x41cf20,null))['then'](function(_0x4ee934){if(_0x4ee934){return _0x4ee934['setTags'](_0x2bf0ad[_0xa7e1('0x4e')][_0xa7e1('0x7d')]||[]);}return null;})[_0xa7e1('0x25')](respondWithResult(_0x41cf20,null))['catch'](handleError(_0x41cf20,null));};exports[_0xa7e1('0x7e')]=function(_0xf45e6,_0x1f09dd,_0xe3e5d2){var _0x4b9754={'raw':![],'where':{}};var _0x13f4b4={};var _0x578cf5={'count':0x0,'rows':[]};return db[_0xa7e1('0x28')][_0xa7e1('0x7f')]({'where':{'id':_0xf45e6[_0xa7e1('0x45')]['id']}})['then'](handleEntityNotFound(_0x1f09dd,null))[_0xa7e1('0x25')](function(_0x2cafb7){if(_0x2cafb7){_0x13f4b4['model']=_[_0xa7e1('0x29')](db['CmHopper']['rawAttributes']);_0x13f4b4[_0xa7e1('0x2a')]=_[_0xa7e1('0x29')](_0xf45e6[_0xa7e1('0x2a')]);_0x13f4b4[_0xa7e1('0x2b')]=_[_0xa7e1('0x2c')](_0x13f4b4[_0xa7e1('0x2d')],_0x13f4b4[_0xa7e1('0x2a')]);_0x4b9754[_0xa7e1('0x2e')]=_['intersection'](_0x13f4b4[_0xa7e1('0x2d')],qs['fields'](_0xf45e6['query'][_0xa7e1('0x2f')]));_0x4b9754[_0xa7e1('0x2e')]=_0x4b9754['attributes']['length']?_0x4b9754[_0xa7e1('0x2e')]:_0x13f4b4[_0xa7e1('0x2d')];if(!_0xf45e6['query']['hasOwnProperty'](_0xa7e1('0x30'))){_0x4b9754[_0xa7e1('0x1e')]=qs[_0xa7e1('0x1e')](_0xf45e6[_0xa7e1('0x2a')][_0xa7e1('0x1e')]);_0x4b9754[_0xa7e1('0x1d')]=qs[_0xa7e1('0x1d')](_0xf45e6[_0xa7e1('0x2a')][_0xa7e1('0x1d')]);}_0x4b9754[_0xa7e1('0x31')]=qs[_0xa7e1('0x7b')](_0xf45e6[_0xa7e1('0x2a')][_0xa7e1('0x7b')]);_0x4b9754['where']=qs[_0xa7e1('0x2b')](_[_0xa7e1('0x32')](_0xf45e6['query'],_0x13f4b4[_0xa7e1('0x2b')]));_0x4b9754['where'][_0xa7e1('0x80')]=_0x2cafb7['id'];if(_0xf45e6['query']['filter']){_0x4b9754[_0xa7e1('0x34')]=_[_0xa7e1('0x35')](_0x4b9754[_0xa7e1('0x34')],{'$or':_[_0xa7e1('0x36')](_0x4b9754[_0xa7e1('0x2e')],function(_0x68efa1){var _0x3cd8ff={};_0x3cd8ff[_0x68efa1]={'$like':'%'+_0xf45e6[_0xa7e1('0x2a')][_0xa7e1('0x33')]+'%'};return _0x3cd8ff;})});}_0x4b9754=_[_0xa7e1('0x35')]({},_0x4b9754,_0xf45e6[_0xa7e1('0x37')]);return db[_0xa7e1('0x56')][_0xa7e1('0x1c')]({'where':_0x4b9754[_0xa7e1('0x34')]})[_0xa7e1('0x25')](function(_0x29fef8){_0x578cf5[_0xa7e1('0x1c')]=_0x29fef8;if(_0xf45e6['query'][_0xa7e1('0x3c')]){_0x4b9754[_0xa7e1('0x38')]=[{'all':!![]}];}return db[_0xa7e1('0x56')][_0xa7e1('0x41')](_0x4b9754);})['then'](function(_0x3e7c03){_0x578cf5[_0xa7e1('0x42')]=_0x3e7c03;return _0x578cf5;});}})[_0xa7e1('0x25')](respondWithFilteredResult(_0x1f09dd,_0x4b9754))['catch'](handleError(_0x1f09dd,null));};exports[_0xa7e1('0x81')]=function(_0x2ac18f,_0x258650,_0x1393a6){var _0x391f3e={'raw':!![],'where':{}};var _0x1615cd={};var _0x1a0268={'count':0x0,'rows':[]};return db['CmContact'][_0xa7e1('0x7f')]({'where':{'id':_0x2ac18f['params']['id']}})[_0xa7e1('0x25')](handleEntityNotFound(_0x258650,null))['then'](function(_0x5aba5c){if(_0x5aba5c){_0x1615cd['model']=_[_0xa7e1('0x29')](db['CmHopperHistory']['rawAttributes']);_0x1615cd['query']=_['keys'](_0x2ac18f[_0xa7e1('0x2a')]);_0x1615cd[_0xa7e1('0x2b')]=_[_0xa7e1('0x2c')](_0x1615cd['model'],_0x1615cd[_0xa7e1('0x2a')]);_0x391f3e[_0xa7e1('0x2e')]=_[_0xa7e1('0x2c')](_0x1615cd[_0xa7e1('0x2d')],qs['fields'](_0x2ac18f[_0xa7e1('0x2a')]['fields']));_0x391f3e[_0xa7e1('0x2e')]=_0x391f3e[_0xa7e1('0x2e')]['length']?_0x391f3e[_0xa7e1('0x2e')]:_0x1615cd[_0xa7e1('0x2d')];if(!_0x2ac18f[_0xa7e1('0x2a')][_0xa7e1('0x4d')](_0xa7e1('0x30'))){_0x391f3e['limit']=qs[_0xa7e1('0x1e')](_0x2ac18f['query'][_0xa7e1('0x1e')]);_0x391f3e[_0xa7e1('0x1d')]=qs['offset'](_0x2ac18f[_0xa7e1('0x2a')][_0xa7e1('0x1d')]);}_0x391f3e['order']=qs[_0xa7e1('0x7b')](_0x2ac18f[_0xa7e1('0x2a')][_0xa7e1('0x7b')]);_0x391f3e[_0xa7e1('0x34')]=qs[_0xa7e1('0x2b')](_[_0xa7e1('0x32')](_0x2ac18f[_0xa7e1('0x2a')],_0x1615cd['filters']));_0x391f3e[_0xa7e1('0x34')][_0xa7e1('0x80')]=_0x5aba5c['id'];if(_0x2ac18f[_0xa7e1('0x2a')][_0xa7e1('0x33')]){_0x391f3e[_0xa7e1('0x34')]=_[_0xa7e1('0x35')](_0x391f3e[_0xa7e1('0x34')],{'$or':_[_0xa7e1('0x36')](_0x391f3e[_0xa7e1('0x2e')],function(_0x22fd39){var _0x3611f5={};_0x3611f5[_0x22fd39]={'$like':'%'+_0x2ac18f[_0xa7e1('0x2a')][_0xa7e1('0x33')]+'%'};return _0x3611f5;})});}_0x391f3e=_[_0xa7e1('0x35')]({},_0x391f3e,_0x2ac18f[_0xa7e1('0x37')]);return db[_0xa7e1('0x61')][_0xa7e1('0x1c')]({'where':_0x391f3e[_0xa7e1('0x34')]})['then'](function(_0x1f3e7b){_0x1a0268[_0xa7e1('0x1c')]=_0x1f3e7b;if(_0x2ac18f[_0xa7e1('0x2a')][_0xa7e1('0x3c')]){_0x391f3e[_0xa7e1('0x38')]=[{'all':!![]}];}return db[_0xa7e1('0x61')][_0xa7e1('0x41')](_0x391f3e);})[_0xa7e1('0x25')](function(_0x4dace8){_0x1a0268['rows']=_0x4dace8;return _0x1a0268;});}})['then'](respondWithFilteredResult(_0x258650,_0x391f3e))['catch'](handleError(_0x258650,null));};exports[_0xa7e1('0x82')]=function(_0x522123,_0x2df368,_0x35053f){var _0x5b60cf={'raw':!![],'where':{}};var _0x15579b={};var _0x585ad7={'count':0x0,'rows':[]};return db[_0xa7e1('0x28')][_0xa7e1('0x7f')]({'where':{'id':_0x522123[_0xa7e1('0x45')]['id']}})['then'](handleEntityNotFound(_0x2df368,null))[_0xa7e1('0x25')](function(_0x4b0a8e){if(_0x4b0a8e){_0x15579b[_0xa7e1('0x2d')]=_['keys'](db[_0xa7e1('0x83')][_0xa7e1('0x7a')]);_0x15579b['query']=_[_0xa7e1('0x29')](_0x522123[_0xa7e1('0x2a')]);_0x15579b['filters']=_[_0xa7e1('0x2c')](_0x15579b['model'],_0x15579b['query']);_0x5b60cf[_0xa7e1('0x2e')]=_[_0xa7e1('0x2c')](_0x15579b['model'],qs['fields'](_0x522123['query'][_0xa7e1('0x2f')]));_0x5b60cf['attributes']=_0x5b60cf[_0xa7e1('0x2e')]['length']?_0x5b60cf[_0xa7e1('0x2e')]:_0x15579b['model'];if(!_0x522123[_0xa7e1('0x2a')]['hasOwnProperty'](_0xa7e1('0x30'))){_0x5b60cf[_0xa7e1('0x1e')]=qs[_0xa7e1('0x1e')](_0x522123[_0xa7e1('0x2a')][_0xa7e1('0x1e')]);_0x5b60cf[_0xa7e1('0x1d')]=qs[_0xa7e1('0x1d')](_0x522123[_0xa7e1('0x2a')]['offset']);}_0x5b60cf[_0xa7e1('0x31')]=qs[_0xa7e1('0x7b')](_0x522123['query'][_0xa7e1('0x7b')]);_0x5b60cf[_0xa7e1('0x34')]=qs[_0xa7e1('0x2b')](_[_0xa7e1('0x32')](_0x522123[_0xa7e1('0x2a')],_0x15579b[_0xa7e1('0x2b')]));_0x5b60cf[_0xa7e1('0x34')][_0xa7e1('0x80')]=_0x4b0a8e['id'];if(_0x522123[_0xa7e1('0x2a')][_0xa7e1('0x33')]){_0x5b60cf[_0xa7e1('0x34')]=_['merge'](_0x5b60cf['where'],{'$or':_[_0xa7e1('0x36')](_0x5b60cf[_0xa7e1('0x2e')],function(_0x1f53b8){var _0x2c3a28={};_0x2c3a28[_0x1f53b8]={'$like':'%'+_0x522123[_0xa7e1('0x2a')][_0xa7e1('0x33')]+'%'};return _0x2c3a28;})});}_0x5b60cf=_[_0xa7e1('0x35')]({},_0x5b60cf,_0x522123[_0xa7e1('0x37')]);return db['CmHopperFinal']['count']({'where':_0x5b60cf[_0xa7e1('0x34')]})[_0xa7e1('0x25')](function(_0x5b9877){_0x585ad7[_0xa7e1('0x1c')]=_0x5b9877;if(_0x522123['query'][_0xa7e1('0x3c')]){_0x5b60cf[_0xa7e1('0x38')]=[{'all':!![]}];}return db[_0xa7e1('0x83')][_0xa7e1('0x41')](_0x5b60cf);})[_0xa7e1('0x25')](function(_0x3fc030){_0x585ad7[_0xa7e1('0x42')]=_0x3fc030;return _0x585ad7;});}})[_0xa7e1('0x25')](respondWithFilteredResult(_0x2df368,_0x5b60cf))['catch'](handleError(_0x2df368,null));};exports[_0xa7e1('0x84')]=function(_0x4ac75c,_0x52f8b8,_0x212587){var _0x4370b7={'raw':!![],'where':{}};var _0x22744b={};var _0x344cc7={'count':0x0,'rows':[]};return db[_0xa7e1('0x28')][_0xa7e1('0x7f')]({'where':{'id':_0x4ac75c[_0xa7e1('0x45')]['id']}})['then'](handleEntityNotFound(_0x52f8b8,null))['then'](function(_0x3e24f5){if(_0x3e24f5){_0x22744b[_0xa7e1('0x2d')]=_[_0xa7e1('0x29')](db[_0xa7e1('0x64')][_0xa7e1('0x7a')]);_0x22744b[_0xa7e1('0x2a')]=_[_0xa7e1('0x29')](_0x4ac75c[_0xa7e1('0x2a')]);_0x22744b[_0xa7e1('0x2b')]=_[_0xa7e1('0x2c')](_0x22744b['model'],_0x22744b[_0xa7e1('0x2a')]);_0x4370b7[_0xa7e1('0x2e')]=_[_0xa7e1('0x2c')](_0x22744b[_0xa7e1('0x2d')],qs[_0xa7e1('0x2f')](_0x4ac75c['query'][_0xa7e1('0x2f')]));_0x4370b7[_0xa7e1('0x2e')]=_0x4370b7['attributes'][_0xa7e1('0x47')]?_0x4370b7[_0xa7e1('0x2e')]:_0x22744b[_0xa7e1('0x2d')];if(!_0x4ac75c[_0xa7e1('0x2a')][_0xa7e1('0x4d')](_0xa7e1('0x30'))){_0x4370b7['limit']=qs[_0xa7e1('0x1e')](_0x4ac75c[_0xa7e1('0x2a')][_0xa7e1('0x1e')]);_0x4370b7['offset']=qs[_0xa7e1('0x1d')](_0x4ac75c[_0xa7e1('0x2a')][_0xa7e1('0x1d')]);}_0x4370b7[_0xa7e1('0x31')]=qs[_0xa7e1('0x7b')](_0x4ac75c[_0xa7e1('0x2a')][_0xa7e1('0x7b')]);_0x4370b7[_0xa7e1('0x34')]=qs[_0xa7e1('0x2b')](_[_0xa7e1('0x32')](_0x4ac75c[_0xa7e1('0x2a')],_0x22744b[_0xa7e1('0x2b')]));_0x4370b7[_0xa7e1('0x34')]['ContactId']=_0x3e24f5['id'];if(_0x4ac75c[_0xa7e1('0x2a')][_0xa7e1('0x33')]){_0x4370b7[_0xa7e1('0x34')]=_[_0xa7e1('0x35')](_0x4370b7['where'],{'$or':_[_0xa7e1('0x36')](_0x4370b7[_0xa7e1('0x2e')],function(_0x4cd480){var _0x148864={};_0x148864[_0x4cd480]={'$like':'%'+_0x4ac75c[_0xa7e1('0x2a')][_0xa7e1('0x33')]+'%'};return _0x148864;})});}_0x4370b7=_[_0xa7e1('0x35')]({},_0x4370b7,_0x4ac75c['options']);return db[_0xa7e1('0x64')][_0xa7e1('0x1c')]({'where':_0x4370b7['where']})[_0xa7e1('0x25')](function(_0x33f1ba){_0x344cc7[_0xa7e1('0x1c')]=_0x33f1ba;if(_0x4ac75c[_0xa7e1('0x2a')][_0xa7e1('0x3c')]){_0x4370b7['include']=[{'all':!![]}];}return db[_0xa7e1('0x64')][_0xa7e1('0x41')](_0x4370b7);})[_0xa7e1('0x25')](function(_0x5ba574){_0x344cc7['rows']=_0x5ba574;return _0x344cc7;});}})[_0xa7e1('0x25')](respondWithFilteredResult(_0x52f8b8,_0x4370b7))[_0xa7e1('0x46')](handleError(_0x52f8b8,null));};exports[_0xa7e1('0x85')]=function(_0x3f83b4,_0x213b9,_0x4e03c9){try{if(!_0x3f83b4[_0xa7e1('0x4e')][_0xa7e1('0x6a')]){throw new Error(_0xa7e1('0x86'));}if(!_0x3f83b4['body'][_0xa7e1('0x87')]){throw new Error(_0xa7e1('0x88'));}if(!_0x3f83b4[_0xa7e1('0x4e')][_0xa7e1('0x89')]){throw new Error(_0xa7e1('0x8a'));}if(!_0x3f83b4[_0xa7e1('0x4e')]['socket_timestamp']){throw new Error(_0xa7e1('0x8b'));}var _0x3c31ac=_0x3f83b4[_0xa7e1('0x4e')][_0xa7e1('0x87')][_0xa7e1('0x8c')](',');var _0x1f692f=_0x3f83b4[_0xa7e1('0x4e')][_0xa7e1('0x89')][_0xa7e1('0x8c')](',');if(!_0x3c31ac[_0xa7e1('0x47')]||!_0x1f692f['length']||_0x3c31ac['length']!==_0x1f692f[_0xa7e1('0x47')]){throw new Error(_0xa7e1('0x8d'));}_0x3f83b4[_0xa7e1('0x4e')][_0xa7e1('0x2f')]=_[_0xa7e1('0x8e')](_0x3c31ac,_0x1f692f);if(!_0x3f83b4['body'][_0xa7e1('0x2f')][_0xa7e1('0x78')]){throw new Error(_0xa7e1('0x8f'));}if(!_0x3f83b4[_0xa7e1('0x4e')][_0xa7e1('0x2f')]['firstName']){throw new Error(_0xa7e1('0x90'));}var _0x33ef97=path['join'](config[_0xa7e1('0x91')],_0xa7e1('0x92'),_0x3f83b4['file'][_0xa7e1('0x93')]);fs[_0xa7e1('0x94')](_0x33ef97,parseInt('0777',0x8));var _0x551251=require(_0xa7e1('0x95'))['fork'](path[_0xa7e1('0x52')](__dirname,_0xa7e1('0x96')),[_0x33ef97,_0x3f83b4[_0xa7e1('0x4e')][_0xa7e1('0x87')],_0x3f83b4[_0xa7e1('0x4e')]['binding_values'],_0x3f83b4[_0xa7e1('0x4e')]['ListId'],_0x3f83b4[_0xa7e1('0x4e')][_0xa7e1('0x97')],_0x3f83b4['body'][_0xa7e1('0x68')],_0x3f83b4[_0xa7e1('0x4e')]['socket_timestamp']]);return _0x213b9[_0xa7e1('0x19')](0xc8)['json']({'message':'File\x20uploaded\x20correctly!','pid':_0x551251[_0xa7e1('0x98')]});}catch(_0x382ca3){return _0x213b9['status'](0x1f4)['send'](_0x382ca3);}};exports[_0xa7e1('0x99')]=function(_0x5db319,_0x171ce8,_0x266f80){var _0x2629bd=fs['createReadStream'](_0x5db319[_0xa7e1('0x9a')]['path']);Papa[_0xa7e1('0x9b')](_0x2629bd,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x56b503){return _0x171ce8[_0xa7e1('0x19')](0xc8)[_0xa7e1('0x1b')]({'file':_0x5db319[_0xa7e1('0x9a')],'fields':_0x56b503[_0xa7e1('0x9c')]['fields']});}});};exports[_0xa7e1('0x9d')]=function(_0x5001cc,_0x22c12b,_0x77c846){return db[_0xa7e1('0x9e')][_0xa7e1('0x41')]({'raw':!![],'attributes':['id'],'where':{'role':_0xa7e1('0x9f')}})[_0xa7e1('0x25')](function(_0x4aba74){var _0x42e82a=![];if(!_0x5001cc[_0xa7e1('0x4e')][_0xa7e1('0x6a')]){throw new Error(_0xa7e1('0x86'));}if(!_0x5001cc[_0xa7e1('0x4e')]['binding'][_0xa7e1('0x78')]){throw new Error(_0xa7e1('0x8f'));}if(!_0x5001cc['body'][_0xa7e1('0xa0')]['firstName']){throw new Error(_0xa7e1('0x90'));}if(!_0x5001cc[_0xa7e1('0x4e')][_0xa7e1('0xa1')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x24d0f6=require(_0xa7e1('0x95'))[_0xa7e1('0xa2')](path[_0xa7e1('0x52')](__dirname,_0xa7e1('0xa3')),[_0x5001cc[_0xa7e1('0x45')]['id'],JSON['stringify'](_0x5001cc[_0xa7e1('0x4e')]),JSON['stringify'](_0x4aba74)]);_0x24d0f6['on'](_0xa7e1('0xa4'),function(_0x39f1f2){_0x42e82a=!![];return _0x22c12b[_0xa7e1('0x19')](0xc8)[_0xa7e1('0x1b')]({'message':_0xa7e1('0xa5'),'pid':_0x24d0f6[_0xa7e1('0x98')]});});_0x24d0f6['on'](_0xa7e1('0xa6'),function(_0xcaffd){if(_0xcaffd&&!_0x42e82a){return _0x22c12b['status'](0x1f4)['json']({'message':_0xa7e1('0xa7'),'pid':_0x24d0f6[_0xa7e1('0x98')]});}});})[_0xa7e1('0x46')](handleError(_0x22c12b,null));};
\ No newline at end of file
index ff0313d..dd7dee9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x18da=['hook','exports','events','../../mysqldb','CmContact','update','remove','emit','hasOwnProperty'];(function(_0x5dba16,_0x53efef){var _0x395e95=function(_0x10f469){while(--_0x10f469){_0x5dba16['push'](_0x5dba16['shift']());}};_0x395e95(++_0x53efef);}(_0x18da,0x134));var _0xa18d=function(_0x3d4ef1,_0x5a957c){_0x3d4ef1=_0x3d4ef1-0x0;var _0x409423=_0x18da[_0x3d4ef1];return _0x409423;};'use strict';var EventEmitter=require(_0xa18d('0x0'));var CmContact=require(_0xa18d('0x1'))['db'][_0xa18d('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa18d('0x3'),'afterDestroy':_0xa18d('0x4')};function emitEvent(_0x41f3e3){return function(_0x85e4ac,_0x392210,_0x5dc2bd){CmContactEvents[_0xa18d('0x5')](_0x41f3e3+':'+_0x85e4ac['id'],_0x85e4ac);CmContactEvents[_0xa18d('0x5')](_0x41f3e3,_0x85e4ac);_0x5dc2bd(null);};}for(var e in events){if(events[_0xa18d('0x6')](e)){var event=events[e];CmContact[_0xa18d('0x7')](e,emitEvent(event));}}module[_0xa18d('0x8')]=CmContactEvents;
\ No newline at end of file
+var _0xf38f=['emit','hasOwnProperty','exports','events','../../mysqldb','CmContact','setMaxListeners','save'];(function(_0x2819a2,_0x1f240f){var _0x2091b9=function(_0x456230){while(--_0x456230){_0x2819a2['push'](_0x2819a2['shift']());}};_0x2091b9(++_0x1f240f);}(_0xf38f,0x1c3));var _0xff38=function(_0x38b777,_0x58b31e){_0x38b777=_0x38b777-0x0;var _0x41da2c=_0xf38f[_0x38b777];return _0x41da2c;};'use strict';var EventEmitter=require(_0xff38('0x0'));var CmContact=require(_0xff38('0x1'))['db'][_0xff38('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xff38('0x3')](0x0);var events={'afterCreate':_0xff38('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xdec7dd){return function(_0x57fa7d,_0x5b6d38,_0x4a4858){CmContactEvents['emit'](_0xdec7dd+':'+_0x57fa7d['id'],_0x57fa7d);CmContactEvents[_0xff38('0x5')](_0xdec7dd,_0x57fa7d);_0x4a4858(null);};}for(var e in events){if(events[_0xff38('0x6')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0xff38('0x7')]=CmContactEvents;
\ No newline at end of file
index 2af9037..6e64fe4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaf1b=['scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','callbackUniqueid','catch','findOne','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','create','error','\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','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','onlyIfOpen','BlackLists','length','CmHopperBlack','cmContact,\x20%s,\x20%s','afterCreate','message','Campaign','isEmpty','destroy','ContactId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','models','cmContact','inspect','CmHopper','then','isNil','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','ListId','priority'];(function(_0x470248,_0x3d6945){var _0x1c1c4b=function(_0x4bc19e){while(--_0x4bc19e){_0x470248['push'](_0x470248['shift']());}};_0x1c1c4b(++_0x3d6945);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x41c51a,_0x550b00){_0x41c51a=_0x41c51a-0x0;var _0x2dc917=_0xaf1b[_0x41c51a];return _0x2dc917;};'use strict';var _=require(_0xbaf1('0x0'));var util=require(_0xbaf1('0x1'));var logger=require(_0xbaf1('0x2'))(_0xbaf1('0x3'));var moment=require(_0xbaf1('0x4'));var BPromise=require(_0xbaf1('0x5'));var rp=require(_0xbaf1('0x6'));var attributes=require(_0xbaf1('0x7'));module[_0xbaf1('0x8')]=function(_0x3fe8f0,_0x156a67){return _0x3fe8f0[_0xbaf1('0x9')](_0xbaf1('0xa'),attributes,{'tableName':_0xbaf1('0xb'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0xbaf1('0xc')]}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5f337d,_0x16a74d,_0x4eeec4){var _0x2052c8=_0x3fe8f0[_0xbaf1('0xd')];var _0x41a0ba=_0x5f337d['get']({'plain':!![]});function _0x222756(){return function(_0x287408){logger['error'](_0xbaf1('0xe'),'afterCreate',util[_0xbaf1('0xf')](_0x287408,{'showHidden':![],'depth':null}));};}var _0x418d09=function(_0x155360){return new BPromise(function(_0x1c1891,_0x2a9ebf){_0x2052c8[_0xbaf1('0x10')]['findOne']({'where':{'phone':_0x41a0ba['phone'],'VoiceQueueId':_0x155360['id']}})[_0xbaf1('0x11')](function(_0x1a10d6){if(!_[_0xbaf1('0x12')](_0x1a10d6)){throw new Error(_0xbaf1('0x13')+_0x41a0ba[_0xbaf1('0xc')]+_0xbaf1('0x14')+_0x155360['id']);}return _0x2052c8[_0xbaf1('0x10')]['create']({'phone':_0x41a0ba[_0xbaf1('0xc')],'ContactId':_0x41a0ba['id'],'ListId':_0x41a0ba[_0xbaf1('0x15')],'priority':_0x41a0ba[_0xbaf1('0x16')]?_0x41a0ba[_0xbaf1('0x16')]:0x2,'scheduledat':_0x41a0ba[_0xbaf1('0x17')]?_0x41a0ba[_0xbaf1('0x17')]:moment()[_0xbaf1('0x18')](_0xbaf1('0x19')),'callback':_0x41a0ba['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x41a0ba[_0xbaf1('0x1a')]?_0x41a0ba['callbackUniqueid']:undefined,'callbackat':_0x41a0ba[_0xbaf1('0x1a')]?moment()[_0xbaf1('0x18')](_0xbaf1('0x19')):undefined,'VoiceQueueId':_0x155360['id']});})[_0xbaf1('0x1b')](function(_0x498435){_0x2a9ebf(_0x498435);});});};var _0x43291c=function(_0x52b6da){return new BPromise(function(_0x2ac412,_0x38de6b){_0x2052c8['CmHopper'][_0xbaf1('0x1c')]({'where':{'phone':_0x41a0ba[_0xbaf1('0xc')],'VoiceQueueId':_0x52b6da['id']}})[_0xbaf1('0x11')](function(_0x19f4d8){if(!_[_0xbaf1('0x12')](_0x19f4d8)){throw new Error(_0xbaf1('0x13')+_0x41a0ba['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x52b6da['id']);}return _0x2052c8[_0xbaf1('0x1d')][_0xbaf1('0x1c')]({'where':{'calleridnum':_0x41a0ba[_0xbaf1('0xc')],'VoiceQueueId':_0x52b6da['id']}});})['then'](function(_0x2e71ce){if(!_[_0xbaf1('0x12')](_0x2e71ce)){throw new Error(_0xbaf1('0x1e')+_0x41a0ba['phone']+_0xbaf1('0x1f')+_0x52b6da['id']);}return _0x2052c8['CmHopper'][_0xbaf1('0x20')]({'phone':_0x41a0ba[_0xbaf1('0xc')],'ContactId':_0x41a0ba['id'],'ListId':_0x41a0ba[_0xbaf1('0x15')],'priority':_0x41a0ba[_0xbaf1('0x16')]?_0x41a0ba[_0xbaf1('0x16')]:0x2,'scheduledat':_0x41a0ba['scheduledat']?_0x41a0ba['scheduledat']:moment()[_0xbaf1('0x18')](_0xbaf1('0x19')),'callback':_0x41a0ba[_0xbaf1('0x1a')]?!![]:![],'callbackuniqueid':_0x41a0ba[_0xbaf1('0x1a')]?_0x41a0ba['callbackUniqueid']:undefined,'callbackat':_0x41a0ba[_0xbaf1('0x1a')]?moment()['format'](_0xbaf1('0x19')):undefined,'VoiceQueueId':_0x52b6da['id']});})[_0xbaf1('0x1b')](function(_0x35fdc){_0x38de6b(_0x35fdc);});});};function _0x17f2ea(){return function(_0x2ccd80){logger[_0xbaf1('0x21')](_0xbaf1('0xe'),'afterCreate',util[_0xbaf1('0xf')](_0x2ccd80,{'showHidden':![],'depth':null}));};}var _0xbf1154=function(_0x1a523d){return new BPromise(function(_0x29f528,_0x65749e){_0x2052c8[_0xbaf1('0x10')][_0xbaf1('0x1c')]({'where':{'phone':_0x41a0ba[_0xbaf1('0xc')],'CampaignId':_0x1a523d['id']}})['then'](function(_0x467aca){if(!_[_0xbaf1('0x12')](_0x467aca)){throw new Error(_0xbaf1('0x13')+_0x41a0ba[_0xbaf1('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x1a523d['id']);}return _0x2052c8[_0xbaf1('0x10')]['create']({'phone':_0x41a0ba[_0xbaf1('0xc')],'ContactId':_0x41a0ba['id'],'ListId':_0x41a0ba['ListId'],'priority':_0x41a0ba[_0xbaf1('0x16')]?_0x41a0ba[_0xbaf1('0x16')]:0x2,'scheduledat':_0x41a0ba[_0xbaf1('0x17')]?_0x41a0ba[_0xbaf1('0x17')]:moment()['format'](_0xbaf1('0x19')),'callback':_0x41a0ba[_0xbaf1('0x1a')]?!![]:![],'callbackuniqueid':_0x41a0ba[_0xbaf1('0x1a')]?_0x41a0ba[_0xbaf1('0x1a')]:undefined,'callbackat':_0x41a0ba[_0xbaf1('0x1a')]?moment()[_0xbaf1('0x18')](_0xbaf1('0x19')):undefined,'CampaignId':_0x1a523d['id']});})['catch'](function(_0xfe738f){_0x65749e(_0xfe738f);});});};var _0x3182af=function(_0x1278e6){return new BPromise(function(_0x1d6675,_0x45654c){_0x2052c8[_0xbaf1('0x10')][_0xbaf1('0x1c')]({'where':{'phone':_0x41a0ba['phone'],'CampaignId':_0x1278e6['id']}})[_0xbaf1('0x11')](function(_0x53a17c){if(!_[_0xbaf1('0x12')](_0x53a17c)){throw new Error(_0xbaf1('0x13')+_0x41a0ba[_0xbaf1('0xc')]+_0xbaf1('0x22')+_0x1278e6['id']);}return _0x2052c8[_0xbaf1('0x1d')][_0xbaf1('0x1c')]({'where':{'calleridnum':_0x41a0ba[_0xbaf1('0xc')],'CampaignId':_0x1278e6['id']}});})[_0xbaf1('0x11')](function(_0x15e27f){if(!_['isNil'](_0x15e27f)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x41a0ba['phone']+_0xbaf1('0x23')+_0x1278e6['id']);}return _0x2052c8[_0xbaf1('0x10')]['create']({'phone':_0x41a0ba[_0xbaf1('0xc')],'ContactId':_0x41a0ba['id'],'ListId':_0x41a0ba[_0xbaf1('0x15')],'priority':_0x41a0ba[_0xbaf1('0x16')]?_0x41a0ba['priority']:0x2,'scheduledat':_0x41a0ba[_0xbaf1('0x17')]?_0x41a0ba[_0xbaf1('0x17')]:moment()[_0xbaf1('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x41a0ba[_0xbaf1('0x1a')]?!![]:![],'callbackuniqueid':_0x41a0ba[_0xbaf1('0x1a')]?_0x41a0ba['callbackUniqueid']:undefined,'callbackat':_0x41a0ba['callbackUniqueid']?moment()[_0xbaf1('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x1278e6['id']});})['catch'](function(_0x5209ea){_0x45654c(_0x5209ea);});});};if(_0x41a0ba[_0xbaf1('0x15')]){_0x2052c8[_0xbaf1('0x24')][_0xbaf1('0x25')]({'where':{'type':_0xbaf1('0x26')},'attributes':['id',_0xbaf1('0x27')],'include':[{'model':_0x2052c8[_0xbaf1('0x28')],'as':_0xbaf1('0x29'),'where':{'id':_0x41a0ba[_0xbaf1('0x15')]}}]})['then'](function(_0x45f0b5){if(_0x45f0b5){var _0x3d2785=[];for(var _0x3d0793=0x0,_0x314ac3;_0x3d0793<_0x45f0b5['length'];_0x3d0793+=0x1){_0x314ac3=_0x45f0b5[_0x3d0793][_0xbaf1('0x2a')]({'plain':!![]});switch(_0x314ac3['dialCheckDuplicateType']){case _0xbaf1('0x2b'):_0x43291c(_0x314ac3)[_0xbaf1('0x1b')](_0x222756());break;case _0xbaf1('0x2c'):_0x418d09(_0x314ac3)['catch'](_0x222756());break;default:_0x2052c8[_0xbaf1('0x10')][_0xbaf1('0x20')]({'phone':_0x41a0ba[_0xbaf1('0xc')],'ContactId':_0x41a0ba['id'],'ListId':_0x41a0ba['ListId'],'scheduledat':_0x41a0ba[_0xbaf1('0x17')]?_0x41a0ba['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x41a0ba[_0xbaf1('0x16')]?_0x41a0ba[_0xbaf1('0x16')]:0x2,'callback':_0x41a0ba[_0xbaf1('0x1a')]?!![]:![],'callbackuniqueid':_0x41a0ba[_0xbaf1('0x1a')]?_0x41a0ba[_0xbaf1('0x1a')]:undefined,'callbackat':_0x41a0ba[_0xbaf1('0x1a')]?moment()['format'](_0xbaf1('0x19')):undefined,'VoiceQueueId':_0x314ac3['id']})[_0xbaf1('0x1b')](_0x222756());}}}})[_0xbaf1('0x11')](function(){return _0x2052c8[_0xbaf1('0x24')][_0xbaf1('0x25')]({'where':{'type':_0xbaf1('0x26')},'attributes':['id'],'include':[{'model':_0x2052c8['CmList'],'as':_0xbaf1('0x2d'),'where':{'id':_0x41a0ba['ListId']}}]})['then'](function(_0x300f67){if(_0x300f67){var _0x12a9a1=[];for(var _0x20328e=0x0,_0x43a8a1;_0x20328e<_0x300f67[_0xbaf1('0x2e')];_0x20328e+=0x1){_0x43a8a1=_0x300f67[_0x20328e]['get']({'plain':!![]});_0x2052c8[_0xbaf1('0x2f')]['create']({'phone':_0x41a0ba[_0xbaf1('0xc')],'ContactId':_0x41a0ba['id'],'ListId':_0x41a0ba[_0xbaf1('0x15')],'VoiceQueueId':_0x43a8a1['id']})[_0xbaf1('0x1b')](function(_0x3ea395){logger[_0xbaf1('0x21')](_0xbaf1('0x30'),_0xbaf1('0x31'),_0x3ea395[_0xbaf1('0x32')]);});}}});})[_0xbaf1('0x11')](function(){return _0x2052c8[_0xbaf1('0x33')][_0xbaf1('0x25')]({'attributes':['id',_0xbaf1('0x27')],'include':[{'model':_0x2052c8[_0xbaf1('0x28')],'as':_0xbaf1('0x29'),'where':{'id':_0x41a0ba[_0xbaf1('0x15')]}}]})[_0xbaf1('0x11')](function(_0x54f00c){if(_0x54f00c){var _0x1373c5=[];for(var _0x398fcd=0x0,_0x1715a3;_0x398fcd<_0x54f00c[_0xbaf1('0x2e')];_0x398fcd+=0x1){_0x1715a3=_0x54f00c[_0x398fcd][_0xbaf1('0x2a')]({'plain':!![]});switch(_0x1715a3[_0xbaf1('0x27')]){case _0xbaf1('0x2b'):_0x3182af(_0x1715a3)[_0xbaf1('0x1b')](_0x17f2ea());break;case _0xbaf1('0x2c'):_0xbf1154(_0x1715a3)[_0xbaf1('0x1b')](_0x17f2ea());break;default:_0x2052c8[_0xbaf1('0x10')]['create']({'phone':_0x41a0ba[_0xbaf1('0xc')],'ContactId':_0x41a0ba['id'],'ListId':_0x41a0ba[_0xbaf1('0x15')],'scheduledat':_0x41a0ba[_0xbaf1('0x17')]?_0x41a0ba[_0xbaf1('0x17')]:moment()[_0xbaf1('0x18')](_0xbaf1('0x19')),'priority':_0x41a0ba['priority']?_0x41a0ba[_0xbaf1('0x16')]:0x2,'callback':_0x41a0ba['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x41a0ba[_0xbaf1('0x1a')]?_0x41a0ba[_0xbaf1('0x1a')]:undefined,'callbackat':_0x41a0ba[_0xbaf1('0x1a')]?moment()[_0xbaf1('0x18')](_0xbaf1('0x19')):undefined,'CampaignId':_0x1715a3['id']})[_0xbaf1('0x1b')](_0x17f2ea());}}}});})[_0xbaf1('0x11')](function(){return _0x2052c8[_0xbaf1('0x33')][_0xbaf1('0x25')]({'attributes':['id'],'include':[{'model':_0x2052c8[_0xbaf1('0x28')],'as':_0xbaf1('0x2d'),'where':{'id':_0x41a0ba['ListId']}}]})[_0xbaf1('0x11')](function(_0x5c48db){if(_0x5c48db){var _0x4aeff4=[];for(var _0x4c24c1=0x0,_0x164181;_0x4c24c1<_0x5c48db['length'];_0x4c24c1+=0x1){_0x164181=_0x5c48db[_0x4c24c1]['get']({'plain':!![]});_0x2052c8[_0xbaf1('0x2f')][_0xbaf1('0x20')]({'phone':_0x41a0ba['phone'],'ContactId':_0x41a0ba['id'],'ListId':_0x41a0ba[_0xbaf1('0x15')],'CampaignId':_0x164181['id']})[_0xbaf1('0x1b')](function(_0x2f468a){logger[_0xbaf1('0x21')](_0xbaf1('0x30'),_0xbaf1('0x31'),_0x2f468a[_0xbaf1('0x32')]);});}}});})[_0xbaf1('0x11')](function(){_0x4eeec4();})[_0xbaf1('0x1b')](function(_0x2b55aa){logger['error'](_0xbaf1('0x30'),'afterCreate',_0x2b55aa[_0xbaf1('0x32')]);_0x4eeec4(_0x2b55aa);});}else{_0x4eeec4(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x437f67,_0x186511,_0x3b2146){var _0x27428a=_0x3fe8f0[_0xbaf1('0xd')];var _0x1026b2=_0x437f67[_0xbaf1('0x2a')]({'plain':!![]});return _0x27428a[_0xbaf1('0x10')][_0xbaf1('0x25')]({'raw':!![],'where':{'ListId':_0x1026b2[_0xbaf1('0x15')],'ContactId':_0x1026b2['id']}})[_0xbaf1('0x11')](function(_0x58ba4e){if(!_[_0xbaf1('0x34')](_0x58ba4e)){var _0x4e42b0=[];for(var _0x2a340a=0x0;_0x2a340a<_0x58ba4e['length'];_0x2a340a+=0x1){var _0x30a17e=_0x27428a[_0xbaf1('0x10')][_0xbaf1('0x35')]({'where':{'ListId':_0x58ba4e[_0x2a340a][_0xbaf1('0x15')],'ContactId':_0x58ba4e[_0x2a340a][_0xbaf1('0x36')],'VoiceQueueId':_0x58ba4e[_0x2a340a]['VoiceQueueId'],'CampaignId':_0x58ba4e[_0x2a340a][_0xbaf1('0x37')]}});_0x4e42b0[_0xbaf1('0x38')](_0x30a17e);}return BPromise[_0xbaf1('0x39')](_0x4e42b0);}})['then'](function(_0x299203){logger[_0xbaf1('0x3a')](_0xbaf1('0x3b'),util[_0xbaf1('0xf')](_0x299203,{'showHidden':![],'depth':null}));_0x3b2146();})[_0xbaf1('0x1b')](function(_0x212789){logger['error'](_0xbaf1('0x3c'),util[_0xbaf1('0xf')](_0x212789,{'showHidden':![],'depth':null}));_0x3b2146(_0x212789);});}}});};
\ No newline at end of file
+var _0xd9ef=['\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','always','onlyIfOpen','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Campaign','List\x20not\x20found','models','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','api','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','get','error','cmContact','inspect','findOne','then','isNil','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','ListId','scheduledat','format','callbackUniqueid','YYYY-MM-DD\x20HH:mm:ss','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','priority','afterCreate','\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','cmContact,\x20afterCreate,\x20'];(function(_0x4164f2,_0x38669f){var _0x2575c7=function(_0x24dca1){while(--_0x24dca1){_0x4164f2['push'](_0x4164f2['shift']());}};_0x2575c7(++_0x38669f);}(_0xd9ef,0x95));var _0xfd9e=function(_0x1ab1b3,_0x3ca491){_0x1ab1b3=_0x1ab1b3-0x0;var _0x398c39=_0xd9ef[_0x1ab1b3];return _0x398c39;};'use strict';var _=require(_0xfd9e('0x0'));var util=require(_0xfd9e('0x1'));var logger=require('../../config/logger')(_0xfd9e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xfd9e('0x3'));module[_0xfd9e('0x4')]=function(_0xe6990b,_0x1b2b0c){return _0xe6990b[_0xfd9e('0x5')](_0xfd9e('0x6'),attributes,{'tableName':_0xfd9e('0x7'),'paranoid':!![],'indexes':[{'name':_0xfd9e('0x8'),'fields':[_0xfd9e('0x8')]}],'timestamps':!![],'hooks':{'afterCreate':function(_0x302795,_0xb61585,_0x1f35c7){var _0x1f7e1e=_0xe6990b['models'];var _0xd8d6bc=_0x302795[_0xfd9e('0x9')]({'plain':!![]});function _0x5c517b(){return function(_0x49130f){logger[_0xfd9e('0xa')](_0xfd9e('0xb'),'afterCreate',util[_0xfd9e('0xc')](_0x49130f,{'showHidden':![],'depth':null}));};}var _0x188629=function(_0x339901){return new BPromise(function(_0x44a97a,_0x36dab3){_0x1f7e1e['CmHopper'][_0xfd9e('0xd')]({'where':{'phone':_0xd8d6bc[_0xfd9e('0x8')],'VoiceQueueId':_0x339901['id']}})[_0xfd9e('0xe')](function(_0x9a3da1){if(!_[_0xfd9e('0xf')](_0x9a3da1)){throw new Error(_0xfd9e('0x10')+_0xd8d6bc[_0xfd9e('0x8')]+_0xfd9e('0x11')+_0x339901['id']);}return _0x1f7e1e[_0xfd9e('0x12')][_0xfd9e('0x13')]({'phone':_0xd8d6bc['phone'],'ContactId':_0xd8d6bc['id'],'ListId':_0xd8d6bc[_0xfd9e('0x14')],'priority':_0xd8d6bc['priority']?_0xd8d6bc['priority']:0x2,'scheduledat':_0xd8d6bc[_0xfd9e('0x15')]?_0xd8d6bc[_0xfd9e('0x15')]:moment()[_0xfd9e('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0xd8d6bc[_0xfd9e('0x17')]?!![]:![],'callbackuniqueid':_0xd8d6bc[_0xfd9e('0x17')]?_0xd8d6bc[_0xfd9e('0x17')]:undefined,'callbackat':_0xd8d6bc[_0xfd9e('0x17')]?moment()[_0xfd9e('0x16')](_0xfd9e('0x18')):undefined,'VoiceQueueId':_0x339901['id']});})[_0xfd9e('0x19')](function(_0x5e3ecf){_0x36dab3(_0x5e3ecf);});});};var _0x44ae3c=function(_0x32e48f){return new BPromise(function(_0x22a568,_0x227fff){_0x1f7e1e[_0xfd9e('0x12')][_0xfd9e('0xd')]({'where':{'phone':_0xd8d6bc[_0xfd9e('0x8')],'VoiceQueueId':_0x32e48f['id']}})[_0xfd9e('0xe')](function(_0x46fb76){if(!_[_0xfd9e('0xf')](_0x46fb76)){throw new Error('cmContact,\x20afterCreate\x20'+_0xd8d6bc[_0xfd9e('0x8')]+_0xfd9e('0x1a')+_0x32e48f['id']);}return _0x1f7e1e[_0xfd9e('0x1b')][_0xfd9e('0xd')]({'where':{'calleridnum':_0xd8d6bc[_0xfd9e('0x8')],'VoiceQueueId':_0x32e48f['id']}});})['then'](function(_0x19b72d){if(!_[_0xfd9e('0xf')](_0x19b72d)){throw new Error('cmContact,\x20afterCreate,\x20'+_0xd8d6bc['phone']+_0xfd9e('0x1c')+_0x32e48f['id']);}return _0x1f7e1e[_0xfd9e('0x12')][_0xfd9e('0x13')]({'phone':_0xd8d6bc[_0xfd9e('0x8')],'ContactId':_0xd8d6bc['id'],'ListId':_0xd8d6bc[_0xfd9e('0x14')],'priority':_0xd8d6bc['priority']?_0xd8d6bc[_0xfd9e('0x1d')]:0x2,'scheduledat':_0xd8d6bc[_0xfd9e('0x15')]?_0xd8d6bc[_0xfd9e('0x15')]:moment()[_0xfd9e('0x16')](_0xfd9e('0x18')),'callback':_0xd8d6bc['callbackUniqueid']?!![]:![],'callbackuniqueid':_0xd8d6bc['callbackUniqueid']?_0xd8d6bc['callbackUniqueid']:undefined,'callbackat':_0xd8d6bc[_0xfd9e('0x17')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x32e48f['id']});})[_0xfd9e('0x19')](function(_0x143ae7){_0x227fff(_0x143ae7);});});};function _0x53272f(){return function(_0x1f4193){logger[_0xfd9e('0xa')](_0xfd9e('0xb'),_0xfd9e('0x1e'),util['inspect'](_0x1f4193,{'showHidden':![],'depth':null}));};}var _0x57d9d1=function(_0x182c58){return new BPromise(function(_0x27ac22,_0x1f1f2a){_0x1f7e1e[_0xfd9e('0x12')]['findOne']({'where':{'phone':_0xd8d6bc[_0xfd9e('0x8')],'CampaignId':_0x182c58['id']}})[_0xfd9e('0xe')](function(_0x5abc21){if(!_['isNil'](_0x5abc21)){throw new Error(_0xfd9e('0x10')+_0xd8d6bc[_0xfd9e('0x8')]+_0xfd9e('0x1f')+_0x182c58['id']);}return _0x1f7e1e[_0xfd9e('0x12')][_0xfd9e('0x13')]({'phone':_0xd8d6bc[_0xfd9e('0x8')],'ContactId':_0xd8d6bc['id'],'ListId':_0xd8d6bc[_0xfd9e('0x14')],'priority':_0xd8d6bc[_0xfd9e('0x1d')]?_0xd8d6bc[_0xfd9e('0x1d')]:0x2,'scheduledat':_0xd8d6bc['scheduledat']?_0xd8d6bc[_0xfd9e('0x15')]:moment()[_0xfd9e('0x16')](_0xfd9e('0x18')),'callback':_0xd8d6bc[_0xfd9e('0x17')]?!![]:![],'callbackuniqueid':_0xd8d6bc[_0xfd9e('0x17')]?_0xd8d6bc[_0xfd9e('0x17')]:undefined,'callbackat':_0xd8d6bc[_0xfd9e('0x17')]?moment()[_0xfd9e('0x16')](_0xfd9e('0x18')):undefined,'CampaignId':_0x182c58['id']});})[_0xfd9e('0x19')](function(_0xa21478){_0x1f1f2a(_0xa21478);});});};var _0x4ab28c=function(_0x4f7c17){return new BPromise(function(_0x562afe,_0x1bd10a){_0x1f7e1e[_0xfd9e('0x12')]['findOne']({'where':{'phone':_0xd8d6bc['phone'],'CampaignId':_0x4f7c17['id']}})['then'](function(_0x12a42f){if(!_[_0xfd9e('0xf')](_0x12a42f)){throw new Error(_0xfd9e('0x10')+_0xd8d6bc[_0xfd9e('0x8')]+_0xfd9e('0x20')+_0x4f7c17['id']);}return _0x1f7e1e[_0xfd9e('0x1b')][_0xfd9e('0xd')]({'where':{'calleridnum':_0xd8d6bc['phone'],'CampaignId':_0x4f7c17['id']}});})['then'](function(_0x21f07b){if(!_['isNil'](_0x21f07b)){throw new Error(_0xfd9e('0x21')+_0xd8d6bc[_0xfd9e('0x8')]+_0xfd9e('0x22')+_0x4f7c17['id']);}return _0x1f7e1e[_0xfd9e('0x12')][_0xfd9e('0x13')]({'phone':_0xd8d6bc[_0xfd9e('0x8')],'ContactId':_0xd8d6bc['id'],'ListId':_0xd8d6bc['ListId'],'priority':_0xd8d6bc['priority']?_0xd8d6bc[_0xfd9e('0x1d')]:0x2,'scheduledat':_0xd8d6bc['scheduledat']?_0xd8d6bc[_0xfd9e('0x15')]:moment()[_0xfd9e('0x16')](_0xfd9e('0x18')),'callback':_0xd8d6bc[_0xfd9e('0x17')]?!![]:![],'callbackuniqueid':_0xd8d6bc[_0xfd9e('0x17')]?_0xd8d6bc[_0xfd9e('0x17')]:undefined,'callbackat':_0xd8d6bc[_0xfd9e('0x17')]?moment()[_0xfd9e('0x16')](_0xfd9e('0x18')):undefined,'CampaignId':_0x4f7c17['id']});})[_0xfd9e('0x19')](function(_0x38ce8a){_0x1bd10a(_0x38ce8a);});});};if(_0xd8d6bc['ListId']){_0x1f7e1e[_0xfd9e('0x23')][_0xfd9e('0x24')]({'where':{'type':_0xfd9e('0x25')},'attributes':['id',_0xfd9e('0x26')],'include':[{'model':_0x1f7e1e[_0xfd9e('0x27')],'as':_0xfd9e('0x28'),'where':{'id':_0xd8d6bc[_0xfd9e('0x14')]}}]})[_0xfd9e('0xe')](function(_0x4272d9){if(_0x4272d9){var _0x101d8e=[];for(var _0x27c587=0x0,_0x23647c;_0x27c587<_0x4272d9[_0xfd9e('0x29')];_0x27c587+=0x1){_0x23647c=_0x4272d9[_0x27c587][_0xfd9e('0x9')]({'plain':!![]});switch(_0x23647c[_0xfd9e('0x26')]){case _0xfd9e('0x2a'):_0x44ae3c(_0x23647c)[_0xfd9e('0x19')](_0x5c517b());break;case _0xfd9e('0x2b'):_0x188629(_0x23647c)[_0xfd9e('0x19')](_0x5c517b());break;default:_0x1f7e1e[_0xfd9e('0x12')][_0xfd9e('0x13')]({'phone':_0xd8d6bc[_0xfd9e('0x8')],'ContactId':_0xd8d6bc['id'],'ListId':_0xd8d6bc['ListId'],'scheduledat':_0xd8d6bc['scheduledat']?_0xd8d6bc['scheduledat']:moment()[_0xfd9e('0x16')](_0xfd9e('0x18')),'priority':_0xd8d6bc[_0xfd9e('0x1d')]?_0xd8d6bc[_0xfd9e('0x1d')]:0x2,'callback':_0xd8d6bc['callbackUniqueid']?!![]:![],'callbackuniqueid':_0xd8d6bc['callbackUniqueid']?_0xd8d6bc[_0xfd9e('0x17')]:undefined,'callbackat':_0xd8d6bc[_0xfd9e('0x17')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x23647c['id']})['catch'](_0x5c517b());}}}})[_0xfd9e('0xe')](function(){return _0x1f7e1e['VoiceQueue'][_0xfd9e('0x24')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x1f7e1e[_0xfd9e('0x27')],'as':_0xfd9e('0x2c'),'where':{'id':_0xd8d6bc[_0xfd9e('0x14')]}}]})[_0xfd9e('0xe')](function(_0x4e720f){if(_0x4e720f){var _0x2763aa=[];for(var _0x103dc9=0x0,_0x11a6b6;_0x103dc9<_0x4e720f['length'];_0x103dc9+=0x1){_0x11a6b6=_0x4e720f[_0x103dc9][_0xfd9e('0x9')]({'plain':!![]});_0x1f7e1e[_0xfd9e('0x2d')][_0xfd9e('0x13')]({'phone':_0xd8d6bc[_0xfd9e('0x8')],'ContactId':_0xd8d6bc['id'],'ListId':_0xd8d6bc[_0xfd9e('0x14')],'VoiceQueueId':_0x11a6b6['id']})[_0xfd9e('0x19')](function(_0x304375){logger[_0xfd9e('0xa')](_0xfd9e('0x2e'),_0xfd9e('0x1e'),_0x304375[_0xfd9e('0x2f')]);});}}});})[_0xfd9e('0xe')](function(){return _0x1f7e1e[_0xfd9e('0x30')][_0xfd9e('0x24')]({'attributes':['id',_0xfd9e('0x26')],'include':[{'model':_0x1f7e1e[_0xfd9e('0x27')],'as':_0xfd9e('0x28'),'where':{'id':_0xd8d6bc[_0xfd9e('0x14')]}}]})[_0xfd9e('0xe')](function(_0x398078){if(_0x398078){var _0x4dd835=[];for(var _0x2a19fb=0x0,_0xc38243;_0x2a19fb<_0x398078['length'];_0x2a19fb+=0x1){_0xc38243=_0x398078[_0x2a19fb][_0xfd9e('0x9')]({'plain':!![]});switch(_0xc38243['dialCheckDuplicateType']){case _0xfd9e('0x2a'):_0x4ab28c(_0xc38243)[_0xfd9e('0x19')](_0x53272f());break;case _0xfd9e('0x2b'):_0x57d9d1(_0xc38243)[_0xfd9e('0x19')](_0x53272f());break;default:_0x1f7e1e[_0xfd9e('0x12')]['create']({'phone':_0xd8d6bc[_0xfd9e('0x8')],'ContactId':_0xd8d6bc['id'],'ListId':_0xd8d6bc[_0xfd9e('0x14')],'scheduledat':_0xd8d6bc['scheduledat']?_0xd8d6bc['scheduledat']:moment()[_0xfd9e('0x16')](_0xfd9e('0x18')),'priority':_0xd8d6bc[_0xfd9e('0x1d')]?_0xd8d6bc[_0xfd9e('0x1d')]:0x2,'callback':_0xd8d6bc['callbackUniqueid']?!![]:![],'callbackuniqueid':_0xd8d6bc[_0xfd9e('0x17')]?_0xd8d6bc[_0xfd9e('0x17')]:undefined,'callbackat':_0xd8d6bc[_0xfd9e('0x17')]?moment()[_0xfd9e('0x16')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0xc38243['id']})[_0xfd9e('0x19')](_0x53272f());}}}});})[_0xfd9e('0xe')](function(){return _0x1f7e1e[_0xfd9e('0x30')]['findAll']({'attributes':['id'],'include':[{'model':_0x1f7e1e[_0xfd9e('0x27')],'as':_0xfd9e('0x2c'),'where':{'id':_0xd8d6bc['ListId']}}]})[_0xfd9e('0xe')](function(_0x474df7){if(_0x474df7){var _0x242153=[];for(var _0x35ec0d=0x0,_0xfa73d1;_0x35ec0d<_0x474df7[_0xfd9e('0x29')];_0x35ec0d+=0x1){_0xfa73d1=_0x474df7[_0x35ec0d][_0xfd9e('0x9')]({'plain':!![]});_0x1f7e1e[_0xfd9e('0x2d')][_0xfd9e('0x13')]({'phone':_0xd8d6bc[_0xfd9e('0x8')],'ContactId':_0xd8d6bc['id'],'ListId':_0xd8d6bc[_0xfd9e('0x14')],'CampaignId':_0xfa73d1['id']})[_0xfd9e('0x19')](function(_0x4e38ce){logger['error'](_0xfd9e('0x2e'),_0xfd9e('0x1e'),_0x4e38ce[_0xfd9e('0x2f')]);});}}});})[_0xfd9e('0xe')](function(){_0x1f35c7();})[_0xfd9e('0x19')](function(_0x503785){logger['error']('cmContact,\x20%s,\x20%s','afterCreate',_0x503785[_0xfd9e('0x2f')]);_0x1f35c7(_0x503785);});}else{_0x1f35c7(new Error(_0xfd9e('0x31')));}},'afterDestroy':function(_0x1998ee,_0xf03726,_0x2fb211){var _0x5a3ee1=_0xe6990b[_0xfd9e('0x32')];var _0x51b8a4=_0x1998ee[_0xfd9e('0x9')]({'plain':!![]});return _0x5a3ee1[_0xfd9e('0x12')][_0xfd9e('0x24')]({'raw':!![],'where':{'ListId':_0x51b8a4[_0xfd9e('0x14')],'ContactId':_0x51b8a4['id']}})[_0xfd9e('0xe')](function(_0x40dac2){if(!_[_0xfd9e('0x33')](_0x40dac2)){var _0x5c153c=[];for(var _0x327c9d=0x0;_0x327c9d<_0x40dac2['length'];_0x327c9d+=0x1){var _0x4b22da=_0x5a3ee1[_0xfd9e('0x12')][_0xfd9e('0x34')]({'where':{'ListId':_0x40dac2[_0x327c9d][_0xfd9e('0x14')],'ContactId':_0x40dac2[_0x327c9d][_0xfd9e('0x35')],'VoiceQueueId':_0x40dac2[_0x327c9d][_0xfd9e('0x36')],'CampaignId':_0x40dac2[_0x327c9d][_0xfd9e('0x37')]}});_0x5c153c[_0xfd9e('0x38')](_0x4b22da);}return BPromise[_0xfd9e('0x39')](_0x5c153c);}})[_0xfd9e('0xe')](function(_0x554892){logger[_0xfd9e('0x3a')](_0xfd9e('0x3b'),util[_0xfd9e('0xc')](_0x554892,{'showHidden':![],'depth':null}));_0x2fb211();})[_0xfd9e('0x19')](function(_0x4ef05d){logger[_0xfd9e('0xa')](_0xfd9e('0x3c'),util[_0xfd9e('0xc')](_0x4ef05d,{'showHidden':![],'depth':null}));_0x2fb211(_0x4ef05d);});}}});};
\ No newline at end of file
index 636169c..b477fc1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1703=['localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowCmContact','CmContact','find','options','where','attributes','include','model','map','CreateCmContact','create','body','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis'];(function(_0x309a33,_0x24d6f9){var _0x47f58b=function(_0x19fbbd){while(--_0x19fbbd){_0x309a33['push'](_0x309a33['shift']());}};_0x47f58b(++_0x24d6f9);}(_0x1703,0xf4));var _0x3170=function(_0x353f9a,_0xd52dad){_0x353f9a=_0x353f9a-0x0;var _0xa1bffd=_0x1703[_0x353f9a];return _0xa1bffd;};'use strict';var _=require(_0x3170('0x0'));var util=require(_0x3170('0x1'));var moment=require(_0x3170('0x2'));var BPromise=require(_0x3170('0x3'));var rs=require(_0x3170('0x4'));var fs=require('fs');var Redis=require(_0x3170('0x5'));var db=require(_0x3170('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3170('0x7'))('rpc');var config=require(_0x3170('0x8'));var jayson=require(_0x3170('0x9'));var client=jayson[_0x3170('0xa')][_0x3170('0xb')]({'port':0x232a});config['redis']=_[_0x3170('0xc')](config[_0x3170('0xd')],{'host':_0x3170('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3170('0xf'))[_0x3170('0x10')](socket);function respondWithRpcPromise(_0x24e526,_0x4bacac,_0x3283e6){return new BPromise(function(_0x2dbf3c,_0xddebfb){return client[_0x3170('0x11')](_0x24e526,_0x3283e6)[_0x3170('0x12')](function(_0x2711db){logger[_0x3170('0x13')](_0x3170('0x14'),_0x4bacac,_0x3170('0x15'));logger[_0x3170('0x16')](_0x3170('0x17'),_0x4bacac,_0x3170('0x15'),JSON[_0x3170('0x18')](_0x2711db));if(_0x2711db[_0x3170('0x19')]){if(_0x2711db[_0x3170('0x19')][_0x3170('0x1a')]===0x1f4){logger['error'](_0x3170('0x14'),_0x4bacac,_0x2711db[_0x3170('0x19')][_0x3170('0x1b')]);return _0xddebfb(_0x2711db[_0x3170('0x19')]['message']);}logger['error'](_0x3170('0x14'),_0x4bacac,_0x2711db[_0x3170('0x19')]['message']);return _0x2dbf3c(_0x2711db['error'][_0x3170('0x1b')]);}else{logger[_0x3170('0x13')](_0x3170('0x14'),_0x4bacac,_0x3170('0x15'));_0x2dbf3c(_0x2711db[_0x3170('0x1c')]['message']);}})[_0x3170('0x1d')](function(_0x4ee151){logger[_0x3170('0x19')](_0x3170('0x14'),_0x4bacac,_0x4ee151);_0xddebfb(_0x4ee151);});});}exports[_0x3170('0x1e')]=function(_0x49e1d1){var _0x4a7149=this;return new Promise(function(_0x5a71ad,_0x1ebaf7){return db[_0x3170('0x1f')][_0x3170('0x20')]({'raw':_0x49e1d1[_0x3170('0x21')]?_0x49e1d1[_0x3170('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x49e1d1[_0x3170('0x21')]?_0x49e1d1[_0x3170('0x21')][_0x3170('0x22')]||null:null,'attributes':_0x49e1d1[_0x3170('0x21')]?_0x49e1d1['options'][_0x3170('0x23')]||null:null,'include':_0x49e1d1[_0x3170('0x21')]?_0x49e1d1[_0x3170('0x21')][_0x3170('0x24')]?_['map'](_0x49e1d1[_0x3170('0x21')]['include'],function(_0x19bdb6){return{'model':db[_0x19bdb6[_0x3170('0x25')]],'as':_0x19bdb6['as'],'attributes':_0x19bdb6[_0x3170('0x23')],'include':_0x19bdb6[_0x3170('0x24')]?_[_0x3170('0x26')](_0x19bdb6['include'],function(_0x120f0f){return{'model':db[_0x120f0f['model']],'as':_0x120f0f['as'],'attributes':_0x120f0f[_0x3170('0x23')],'include':_0x120f0f[_0x3170('0x24')]?_[_0x3170('0x26')](_0x120f0f[_0x3170('0x24')],function(_0x1b0dd4){return{'model':db[_0x1b0dd4[_0x3170('0x25')]],'as':_0x1b0dd4['as'],'attributes':_0x1b0dd4[_0x3170('0x23')]};}):[]};}):[]};}):[]:[]})[_0x3170('0x12')](function(_0x35a63a){logger[_0x3170('0x13')]('ShowCmContact',_0x49e1d1);logger[_0x3170('0x16')](_0x3170('0x1e'),_0x49e1d1,JSON['stringify'](_0x35a63a));_0x5a71ad(_0x35a63a);})[_0x3170('0x1d')](function(_0x4361e0){logger[_0x3170('0x19')]('ShowCmContact',_0x4361e0[_0x3170('0x1b')],_0x49e1d1);_0x1ebaf7(_0x4a7149[_0x3170('0x19')](0x1f4,_0x4361e0[_0x3170('0x1b')]));});});};exports[_0x3170('0x27')]=function(_0x325c38){var _0x49d437=this;return new Promise(function(_0x4921bb,_0x3cd963){return db[_0x3170('0x1f')][_0x3170('0x28')](_0x325c38[_0x3170('0x29')],{'raw':_0x325c38[_0x3170('0x21')]?_0x325c38['options'][_0x3170('0x2a')]===undefined?!![]:![]:!![]})[_0x3170('0x12')](function(_0x4b04d6){logger[_0x3170('0x13')]('CreateCmContact',_0x325c38);logger[_0x3170('0x16')](_0x3170('0x27'),_0x325c38,JSON['stringify'](_0x4b04d6));_0x4921bb(_0x4b04d6);})['catch'](function(_0x27eb2f){logger[_0x3170('0x19')](_0x3170('0x27'),_0x27eb2f[_0x3170('0x1b')],_0x325c38);_0x3cd963(_0x49d437[_0x3170('0x19')](0x1f4,_0x27eb2f[_0x3170('0x1b')]));});});};
\ No newline at end of file
+var _0x74e5=['info','CmContact,\x20%s,\x20%s','request\x20sent','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowCmContact','CmContact','find','options','raw','where','include','map','model','attributes','then','debug','CreateCmContact','create','body','stringify','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./cmContact.socket','request'];(function(_0x334e2c,_0x22e946){var _0x516496=function(_0x550188){while(--_0x550188){_0x334e2c['push'](_0x334e2c['shift']());}};_0x516496(++_0x22e946);}(_0x74e5,0x18a));var _0x574e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x74e5[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x574e('0x0'));var moment=require(_0x574e('0x1'));var BPromise=require(_0x574e('0x2'));var rs=require(_0x574e('0x3'));var fs=require('fs');var Redis=require(_0x574e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x574e('0x5'));var logger=require(_0x574e('0x6'))('rpc');var config=require(_0x574e('0x7'));var jayson=require(_0x574e('0x8'));var client=jayson[_0x574e('0x9')]['http']({'port':0x232a});config['redis']=_[_0x574e('0xa')](config['redis'],{'host':_0x574e('0xb'),'port':0x18eb});var socket=require(_0x574e('0xc'))(new Redis(config[_0x574e('0xd')]));require(_0x574e('0xe'))['register'](socket);function respondWithRpcPromise(_0xb4fd0,_0x2c940b,_0x25c058){return new BPromise(function(_0x13e665,_0x2c8b59){return client[_0x574e('0xf')](_0xb4fd0,_0x25c058)['then'](function(_0x3729a1){logger[_0x574e('0x10')](_0x574e('0x11'),_0x2c940b,_0x574e('0x12'));logger['debug'](_0x574e('0x13'),_0x2c940b,_0x574e('0x12'),JSON['stringify'](_0x3729a1));if(_0x3729a1['error']){if(_0x3729a1[_0x574e('0x14')][_0x574e('0x15')]===0x1f4){logger['error'](_0x574e('0x11'),_0x2c940b,_0x3729a1[_0x574e('0x14')][_0x574e('0x16')]);return _0x2c8b59(_0x3729a1[_0x574e('0x14')][_0x574e('0x16')]);}logger['error']('CmContact,\x20%s,\x20%s',_0x2c940b,_0x3729a1['error']['message']);return _0x13e665(_0x3729a1['error'][_0x574e('0x16')]);}else{logger[_0x574e('0x10')](_0x574e('0x11'),_0x2c940b,'request\x20sent');_0x13e665(_0x3729a1[_0x574e('0x17')][_0x574e('0x16')]);}})[_0x574e('0x18')](function(_0x8ff448){logger[_0x574e('0x14')](_0x574e('0x11'),_0x2c940b,_0x8ff448);_0x2c8b59(_0x8ff448);});});}exports[_0x574e('0x19')]=function(_0xa4b185){var _0x43c101=this;return new Promise(function(_0x41026b,_0x5d04a9){return db[_0x574e('0x1a')][_0x574e('0x1b')]({'raw':_0xa4b185['options']?_0xa4b185[_0x574e('0x1c')][_0x574e('0x1d')]===undefined?!![]:![]:!![],'where':_0xa4b185[_0x574e('0x1c')]?_0xa4b185[_0x574e('0x1c')][_0x574e('0x1e')]||null:null,'attributes':_0xa4b185[_0x574e('0x1c')]?_0xa4b185[_0x574e('0x1c')]['attributes']||null:null,'include':_0xa4b185[_0x574e('0x1c')]?_0xa4b185[_0x574e('0x1c')][_0x574e('0x1f')]?_[_0x574e('0x20')](_0xa4b185[_0x574e('0x1c')][_0x574e('0x1f')],function(_0x3e99c4){return{'model':db[_0x3e99c4[_0x574e('0x21')]],'as':_0x3e99c4['as'],'attributes':_0x3e99c4[_0x574e('0x22')],'include':_0x3e99c4[_0x574e('0x1f')]?_[_0x574e('0x20')](_0x3e99c4['include'],function(_0x459329){return{'model':db[_0x459329['model']],'as':_0x459329['as'],'attributes':_0x459329[_0x574e('0x22')],'include':_0x459329[_0x574e('0x1f')]?_[_0x574e('0x20')](_0x459329[_0x574e('0x1f')],function(_0x4c8251){return{'model':db[_0x4c8251[_0x574e('0x21')]],'as':_0x4c8251['as'],'attributes':_0x4c8251[_0x574e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x574e('0x23')](function(_0x5e9050){logger['info'](_0x574e('0x19'),_0xa4b185);logger[_0x574e('0x24')](_0x574e('0x19'),_0xa4b185,JSON['stringify'](_0x5e9050));_0x41026b(_0x5e9050);})[_0x574e('0x18')](function(_0x2d8bb0){logger[_0x574e('0x14')](_0x574e('0x19'),_0x2d8bb0[_0x574e('0x16')],_0xa4b185);_0x5d04a9(_0x43c101[_0x574e('0x14')](0x1f4,_0x2d8bb0[_0x574e('0x16')]));});});};exports[_0x574e('0x25')]=function(_0x448752){var _0x483f0d=this;return new Promise(function(_0x53b2eb,_0x32b5ba){return db[_0x574e('0x1a')][_0x574e('0x26')](_0x448752[_0x574e('0x27')],{'raw':_0x448752[_0x574e('0x1c')]?_0x448752[_0x574e('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x574e('0x23')](function(_0x82cdce){logger[_0x574e('0x10')](_0x574e('0x25'),_0x448752);logger[_0x574e('0x24')](_0x574e('0x25'),_0x448752,JSON[_0x574e('0x28')](_0x82cdce));_0x53b2eb(_0x82cdce);})[_0x574e('0x18')](function(_0x34b060){logger[_0x574e('0x14')](_0x574e('0x25'),_0x34b060[_0x574e('0x16')],_0x448752);_0x32b5ba(_0x483f0d[_0x574e('0x14')](0x1f4,_0x34b060['message']));});});};
\ No newline at end of file
index 042b94b..ef0b5df 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x885a=['save','remove','update','emit','removeListener','register','length','cmContact:'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x885a,0x180));var _0xa885=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x885a[_0x20a584];return _0x4b41a8;};'use strict';var CmContactEvents=require('./cmContact.events');var events=[_0xa885('0x0'),_0xa885('0x1'),_0xa885('0x2')];function createListener(_0x2e4bc8,_0x573a2b){return function(_0xcf0656){_0x573a2b[_0xa885('0x3')](_0x2e4bc8,_0xcf0656);};}function removeListener(_0x2386ec,_0x106e16){return function(){CmContactEvents[_0xa885('0x4')](_0x2386ec,_0x106e16);};}exports[_0xa885('0x5')]=function(_0x5dfd7e){for(var _0x7ac6bd=0x0,_0x1200c7=events[_0xa885('0x6')];_0x7ac6bd<_0x1200c7;_0x7ac6bd++){var _0x546175=events[_0x7ac6bd];var _0x6b26e2=createListener(_0xa885('0x7')+_0x546175,_0x5dfd7e);CmContactEvents['on'](_0x546175,_0x6b26e2);}};
\ No newline at end of file
+var _0xec46=['remove','update','emit','removeListener','register','length','cmContact:','./cmContact.events','save'];(function(_0x47a4ad,_0x189ef5){var _0x58af9f=function(_0x8ff96b){while(--_0x8ff96b){_0x47a4ad['push'](_0x47a4ad['shift']());}};_0x58af9f(++_0x189ef5);}(_0xec46,0x19c));var _0x6ec4=function(_0x44a117,_0x35f739){_0x44a117=_0x44a117-0x0;var _0x14e802=_0xec46[_0x44a117];return _0x14e802;};'use strict';var CmContactEvents=require(_0x6ec4('0x0'));var events=[_0x6ec4('0x1'),_0x6ec4('0x2'),_0x6ec4('0x3')];function createListener(_0x5e854b,_0x5052d2){return function(_0x307c5c){_0x5052d2[_0x6ec4('0x4')](_0x5e854b,_0x307c5c);};}function removeListener(_0x86b9f8,_0x53bbed){return function(){CmContactEvents[_0x6ec4('0x5')](_0x86b9f8,_0x53bbed);};}exports[_0x6ec4('0x6')]=function(_0x55b203){for(var _0x533fda=0x0,_0x55d260=events[_0x6ec4('0x7')];_0x533fda<_0x55d260;_0x533fda++){var _0x391ed9=events[_0x533fda];var _0x42b81b=createListener(_0x6ec4('0x8')+_0x391ed9,_0x55b203);CmContactEvents['on'](_0x391ed9,_0x42b81b);}};
\ No newline at end of file
index 97da486..3750716 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3a25=['/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/jscripty_sessions','getJscriptySessions','post','/merge','merge','/create_many','bulkCreate','setTags','diskStorage','root','server/files/tmp','originalname','replace','format','%s-%s%s','basename','extname','now','/csv','single','file','upload','import','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/tags','getTags'];(function(_0xa78dfb,_0x46d3cf){var _0x5442ec=function(_0x570b80){while(--_0x570b80){_0xa78dfb['push'](_0xa78dfb['shift']());}};_0x5442ec(++_0x46d3cf);}(_0x3a25,0xe1));var _0x53a2=function(_0x3b7775,_0x3117c6){_0x3b7775=_0x3b7775-0x0;var _0x287e66=_0x3a25[_0x3b7775];return _0x287e66;};'use strict';var multer=require('multer');var util=require(_0x53a2('0x0'));var path=require(_0x53a2('0x1'));var timeout=require(_0x53a2('0x2'));var express=require(_0x53a2('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x53a2('0x4'));var config=require(_0x53a2('0x5'));var controller=require(_0x53a2('0x6'));router[_0x53a2('0x7')]('/',auth[_0x53a2('0x8')](),controller['index']);router[_0x53a2('0x7')](_0x53a2('0x9'),auth[_0x53a2('0x8')](),controller[_0x53a2('0xa')]);router[_0x53a2('0x7')](_0x53a2('0xb'),auth[_0x53a2('0x8')](),controller[_0x53a2('0xc')]);router['get'](_0x53a2('0xd'),auth[_0x53a2('0x8')](),controller[_0x53a2('0xe')]);router[_0x53a2('0x7')](_0x53a2('0xf'),auth[_0x53a2('0x8')](),controller[_0x53a2('0x10')]);router['get'](_0x53a2('0x11'),auth[_0x53a2('0x8')](),controller[_0x53a2('0x12')]);router[_0x53a2('0x7')](_0x53a2('0x13'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0x53a2('0x7')](_0x53a2('0x14'),auth[_0x53a2('0x8')](),controller[_0x53a2('0x15')]);router[_0x53a2('0x16')](_0x53a2('0x17'),auth['isAuthenticated'](),controller[_0x53a2('0x18')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x53a2('0x16')](_0x53a2('0x19'),auth[_0x53a2('0x8')](),controller[_0x53a2('0x1a')]);router[_0x53a2('0x16')]('/:id/tags',auth[_0x53a2('0x8')](),controller[_0x53a2('0x1b')]);var upload=multer({'storage':multer[_0x53a2('0x1c')]({'destination':function(_0x341016,_0x332a6a,_0x1aa090){_0x1aa090(null,path['join'](config[_0x53a2('0x1d')],_0x53a2('0x1e')));},'filename':function(_0xd333e6,_0x307263,_0x3bf882){_0x307263[_0x53a2('0x1f')]=_0x307263[_0x53a2('0x1f')][_0x53a2('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3bf882(null,util[_0x53a2('0x21')](_0x53a2('0x22'),path[_0x53a2('0x23')](_0x307263['originalname'],path[_0x53a2('0x24')](_0x307263['originalname'])),Date[_0x53a2('0x25')](),path[_0x53a2('0x24')](_0x307263[_0x53a2('0x1f')])));}})});router[_0x53a2('0x16')](_0x53a2('0x26'),upload[_0x53a2('0x27')](_0x53a2('0x28')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x53a2('0x1c')]({'destination':function(_0x112335,_0x4aa2d7,_0x5c5508){_0x5c5508(null,path['join'](config[_0x53a2('0x1d')],_0x53a2('0x1e')));},'filename':function(_0x2873e4,_0x57d93e,_0x491bba){_0x57d93e[_0x53a2('0x1f')]=_0x57d93e[_0x53a2('0x1f')][_0x53a2('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x491bba(null,util[_0x53a2('0x21')](_0x53a2('0x22'),path['basename'](_0x57d93e[_0x53a2('0x1f')],path[_0x53a2('0x24')](_0x57d93e['originalname'])),Date[_0x53a2('0x25')](),path[_0x53a2('0x24')](_0x57d93e['originalname'])));}})});router[_0x53a2('0x16')]('/upload',upload[_0x53a2('0x27')]('file'),controller[_0x53a2('0x29')]);router[_0x53a2('0x16')]('/upload/:id',auth[_0x53a2('0x8')](),controller[_0x53a2('0x2a')]);router[_0x53a2('0x2b')](_0x53a2('0xb'),auth[_0x53a2('0x8')](),controller[_0x53a2('0x2c')]);router[_0x53a2('0x2d')](_0x53a2('0xb'),auth['isAuthenticated'](),controller[_0x53a2('0x2e')]);module[_0x53a2('0x2f')]=router;
\ No newline at end of file
+var _0xf849=['server/files/tmp','originalname','replace','format','%s-%s%s','basename','extname','single','uploadCsv','diskStorage','now','file','/upload/:id','import','put','destroy','multer','util','path','express','Router','../../components/auth/service','get','describe','/:id','isAuthenticated','show','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/jscripty_sessions','post','/merge','create','/create_many','bulkCreate','setTags','join','root'];(function(_0x3403d5,_0x3d99fc){var _0xf9df4f=function(_0x33d748){while(--_0x33d748){_0x3403d5['push'](_0x3403d5['shift']());}};_0xf9df4f(++_0x3d99fc);}(_0xf849,0x193));var _0x9f84=function(_0x1f2f86,_0x57341c){_0x1f2f86=_0x1f2f86-0x0;var _0x43a6b3=_0xf849[_0x1f2f86];return _0x43a6b3;};'use strict';var multer=require(_0x9f84('0x0'));var util=require(_0x9f84('0x1'));var path=require(_0x9f84('0x2'));var timeout=require('connect-timeout');var express=require(_0x9f84('0x3'));var router=express[_0x9f84('0x4')]();var auth=require(_0x9f84('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmContact.controller');router[_0x9f84('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9f84('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x9f84('0x7')]);router['get'](_0x9f84('0x8'),auth[_0x9f84('0x9')](),controller[_0x9f84('0xa')]);router[_0x9f84('0x6')](_0x9f84('0xb'),auth[_0x9f84('0x9')](),controller[_0x9f84('0xc')]);router[_0x9f84('0x6')](_0x9f84('0xd'),auth[_0x9f84('0x9')](),controller[_0x9f84('0xe')]);router[_0x9f84('0x6')](_0x9f84('0xf'),auth[_0x9f84('0x9')](),controller[_0x9f84('0x10')]);router[_0x9f84('0x6')]('/:id/hopper_finals',auth[_0x9f84('0x9')](),controller[_0x9f84('0x11')]);router[_0x9f84('0x6')](_0x9f84('0x12'),auth[_0x9f84('0x9')](),controller['getJscriptySessions']);router[_0x9f84('0x13')](_0x9f84('0x14'),auth['isAuthenticated'](),controller['merge']);router[_0x9f84('0x13')]('/',auth[_0x9f84('0x9')](),controller[_0x9f84('0x15')]);router[_0x9f84('0x13')](_0x9f84('0x16'),auth['isAuthenticated'](),controller[_0x9f84('0x17')]);router[_0x9f84('0x13')]('/:id/tags',auth[_0x9f84('0x9')](),controller[_0x9f84('0x18')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3c2c01,_0x5610d4,_0x4b0a09){_0x4b0a09(null,path[_0x9f84('0x19')](config[_0x9f84('0x1a')],_0x9f84('0x1b')));},'filename':function(_0x105d32,_0x1268b9,_0x5ab9a3){_0x1268b9[_0x9f84('0x1c')]=_0x1268b9['originalname'][_0x9f84('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5ab9a3(null,util[_0x9f84('0x1e')](_0x9f84('0x1f'),path[_0x9f84('0x20')](_0x1268b9[_0x9f84('0x1c')],path['extname'](_0x1268b9[_0x9f84('0x1c')])),Date['now'](),path[_0x9f84('0x21')](_0x1268b9[_0x9f84('0x1c')])));}})});router[_0x9f84('0x13')]('/csv',upload[_0x9f84('0x22')]('file'),controller[_0x9f84('0x23')]);var upload=multer({'storage':multer[_0x9f84('0x24')]({'destination':function(_0x43d700,_0x370ad9,_0x31baea){_0x31baea(null,path['join'](config['root'],'server/files/tmp'));},'filename':function(_0x19363b,_0x169525,_0x19216f){_0x169525[_0x9f84('0x1c')]=_0x169525[_0x9f84('0x1c')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x19216f(null,util[_0x9f84('0x1e')](_0x9f84('0x1f'),path[_0x9f84('0x20')](_0x169525[_0x9f84('0x1c')],path['extname'](_0x169525['originalname'])),Date[_0x9f84('0x25')](),path[_0x9f84('0x21')](_0x169525[_0x9f84('0x1c')])));}})});router['post']('/upload',upload['single'](_0x9f84('0x26')),controller['upload']);router[_0x9f84('0x13')](_0x9f84('0x27'),auth[_0x9f84('0x9')](),controller[_0x9f84('0x28')]);router[_0x9f84('0x29')](_0x9f84('0x8'),auth[_0x9f84('0x9')](),controller['update']);router['delete'](_0x9f84('0x8'),auth[_0x9f84('0x9')](),controller[_0x9f84('0x2a')]);module['exports']=router;
\ No newline at end of file
index b8e3c06..9195cf3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5147=['VIRTUAL','alias','setDataValue','getDataValue','name','STRING','TEXT','long','type','parse','values','stringify','BOOLEAN','sequelize','lodash','exports'];(function(_0x53f025,_0x476c3b){var _0x2a1bca=function(_0x4c7ac0){while(--_0x4c7ac0){_0x53f025['push'](_0x53f025['shift']());}};_0x2a1bca(++_0x476c3b);}(_0x5147,0x12d));var _0x7514=function(_0x5241c4,_0x36b3b4){_0x5241c4=_0x5241c4-0x0;var _0x34d63e=_0x5147[_0x5241c4];return _0x34d63e;};'use strict';var Sequelize=require(_0x7514('0x0'));var _=require(_0x7514('0x1'));module[_0x7514('0x2')]={'name':{'type':Sequelize[_0x7514('0x3')],'get':function(_0x25a501){return this['getDataValue'](_0x7514('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0xbae48f){this[_0x7514('0x5')]('alias',_0xbae48f?_0xbae48f:this[_0x7514('0x6')](_0x7514('0x7')));}},'type':{'type':Sequelize[_0x7514('0x8')],'allowNull':![]},'values':{'type':Sequelize[_0x7514('0x9')](_0x7514('0xa')),'get':function(){if(this['getDataValue'](_0x7514('0xb'))==='select'){return JSON[_0x7514('0xc')](this[_0x7514('0x6')]('values'));}else{return this['getDataValue'](_0x7514('0xd'));}},'set':function(_0x543e9d){if(Array['isArray'](_0x543e9d)){this[_0x7514('0x5')](_0x7514('0xd'),JSON[_0x7514('0xe')](_0x543e9d));}else{this['setDataValue'](_0x7514('0xd'),_0x543e9d);}}},'required':{'type':Sequelize[_0x7514('0xf')],'defaultValue':![]}};
\ No newline at end of file
+var _0xf4b7=['setDataValue','stringify','exports','alias','STRING','getDataValue','long','type','select','parse','values','isArray'];(function(_0x2834be,_0x42e138){var _0x328dee=function(_0x3513ee){while(--_0x3513ee){_0x2834be['push'](_0x2834be['shift']());}};_0x328dee(++_0x42e138);}(_0xf4b7,0x92));var _0x7f4b=function(_0x4eae51,_0xcff156){_0x4eae51=_0x4eae51-0x0;var _0x23af3d=_0xf4b7[_0x4eae51];return _0x23af3d;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0x7f4b('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x39fdd6){return this['getDataValue'](_0x7f4b('0x1'));}},'alias':{'type':Sequelize[_0x7f4b('0x2')],'allowNull':![],'set':function(_0x1c50bd){this['setDataValue'](_0x7f4b('0x1'),_0x1c50bd?_0x1c50bd:this[_0x7f4b('0x3')]('name'));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x7f4b('0x4')),'get':function(){if(this[_0x7f4b('0x3')](_0x7f4b('0x5'))===_0x7f4b('0x6')){return JSON[_0x7f4b('0x7')](this[_0x7f4b('0x3')](_0x7f4b('0x8')));}else{return this[_0x7f4b('0x3')](_0x7f4b('0x8'));}},'set':function(_0x1f15fb){if(Array[_0x7f4b('0x9')](_0x1f15fb)){this[_0x7f4b('0xa')]('values',JSON[_0x7f4b('0xb')](_0x1f15fb));}else{this[_0x7f4b('0xa')]('values',_0x1f15fb);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}};
\ No newline at end of file
index d34df39..a30dd76 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd881=['papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','then','destroy','stack','name','send','CmCustomField','rawAttributes','differenceBy','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','key','VIRTUAL','field','filter','options','includeAll','include','params','find','catch','body','create','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x1d9c51,_0x14082f){var _0x2a6e18=function(_0x10798c){while(--_0x10798c){_0x1d9c51['push'](_0x1d9c51['shift']());}};_0x2a6e18(++_0x14082f);}(_0xd881,0x1ee));var _0x1d88=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd881[_0x3ab51d];return _0x29a04e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1d88('0x0'));var rimraf=require(_0x1d88('0x1'));var zipdir=require(_0x1d88('0x2'));var jsonpatch=require(_0x1d88('0x3'));var rp=require(_0x1d88('0x4'));var moment=require(_0x1d88('0x5'));var BPromise=require(_0x1d88('0x6'));var Mustache=require('mustache');var util=require(_0x1d88('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x1d88('0x8'));var ejs=require(_0x1d88('0x9'));var fs=require('fs');var _=require(_0x1d88('0xa'));var squel=require(_0x1d88('0xb'));var crypto=require(_0x1d88('0xc'));var jsforce=require(_0x1d88('0xd'));var deskjs=require(_0x1d88('0xe'));var toCsv=require(_0x1d88('0x8'));var querystring=require(_0x1d88('0xf'));var Papa=require(_0x1d88('0x10'));var authService=require(_0x1d88('0x11'));var hardwareService=require(_0x1d88('0x12'));var Redis=require(_0x1d88('0x13'));var qs=require(_0x1d88('0x14'));var logger=require(_0x1d88('0x15'))(_0x1d88('0x16'));var utils=require(_0x1d88('0x17'));var config=require(_0x1d88('0x18'));var db=require(_0x1d88('0x19'))['db'];function respondWithStatusCode(_0x392f66,_0x4a3bf6){_0x4a3bf6=_0x4a3bf6||0xcc;return function(_0x5afa08){if(_0x5afa08){return _0x392f66[_0x1d88('0x1a')](_0x4a3bf6);}return _0x392f66[_0x1d88('0x1b')](_0x4a3bf6)[_0x1d88('0x1c')]();};}function respondWithResult(_0x5883bf,_0x5ef625){_0x5ef625=_0x5ef625||0xc8;return function(_0x2f9d9d){if(_0x2f9d9d){return _0x5883bf[_0x1d88('0x1b')](_0x5ef625)[_0x1d88('0x1d')](_0x2f9d9d);}};}function respondWithFilteredResult(_0x289f09,_0x4cbd47){return function(_0xc0c4f8){if(_0xc0c4f8){var _0x419ad7=_0xc0c4f8[_0x1d88('0x1e')],_0x3642f7=_0x4cbd47[_0x1d88('0x1f')],_0x4a276c=_0x4cbd47[_0x1d88('0x1f')]+_0x4cbd47[_0x1d88('0x20')],_0x8dfc37;if(_0x4a276c>=_0x419ad7){_0x4a276c=_0x419ad7;_0x8dfc37=0xc8;}else{_0x8dfc37=0xce;}_0x289f09[_0x1d88('0x1b')](_0x8dfc37);return _0x289f09[_0x1d88('0x21')]('Content-Range',_0x3642f7+'-'+_0x4a276c+'/'+_0x419ad7)['json'](_0xc0c4f8);}return null;};}function patchUpdates(_0x17537d){return function(_0x3aa41c){try{jsonpatch['apply'](_0x3aa41c,_0x17537d,!![]);}catch(_0xba286d){return BPromise[_0x1d88('0x22')](_0xba286d);}return _0x3aa41c['save']();};}function saveUpdates(_0xb3039f,_0x50ebb9){return function(_0xd6b177){if(_0xd6b177){return _0xd6b177['update'](_0xb3039f)[_0x1d88('0x23')](function(_0xe97403){return _0xe97403;});}return null;};}function removeEntity(_0x58e4de,_0x53b519){return function(_0x5800fd){if(_0x5800fd){return _0x5800fd[_0x1d88('0x24')]()[_0x1d88('0x23')](function(){_0x58e4de[_0x1d88('0x1b')](0xcc)[_0x1d88('0x1c')]();});}};}function handleEntityNotFound(_0x2a24bf,_0x396ada){return function(_0x57933e){if(!_0x57933e){_0x2a24bf[_0x1d88('0x1a')](0x194);}return _0x57933e;};}function handleError(_0x184719,_0x2d269d){_0x2d269d=_0x2d269d||0x1f4;return function(_0x4eee5d){logger['error'](_0x4eee5d[_0x1d88('0x25')]);if(_0x4eee5d[_0x1d88('0x26')]){delete _0x4eee5d[_0x1d88('0x26')];}_0x184719[_0x1d88('0x1b')](_0x2d269d)[_0x1d88('0x27')](_0x4eee5d);};}exports['index']=function(_0x4d87d2,_0x69511d){var _0x5bdb18={},_0x2ca79d={},_0x4d9aa6={'count':0x0,'rows':[]};var _0x212dba=db[_0x1d88('0x28')][_0x1d88('0x29')];_0x2ca79d['model']=_[_0x1d88('0x2a')](_[_0x1d88('0x2b')](_0x212dba),[_0x1d88('0x26')]);_0x2ca79d[_0x1d88('0x2c')]=_[_0x1d88('0x2b')](_0x4d87d2[_0x1d88('0x2c')]);_0x2ca79d[_0x1d88('0x2d')]=_[_0x1d88('0x2e')](_0x2ca79d[_0x1d88('0x2f')],_0x2ca79d[_0x1d88('0x2c')]);_0x5bdb18[_0x1d88('0x30')]=_[_0x1d88('0x2e')](_0x2ca79d[_0x1d88('0x2f')],qs[_0x1d88('0x31')](_0x4d87d2['query'][_0x1d88('0x31')]));_0x5bdb18['attributes']=_0x5bdb18[_0x1d88('0x30')][_0x1d88('0x32')]?_0x5bdb18[_0x1d88('0x30')]:_0x2ca79d[_0x1d88('0x2f')];if(!_0x4d87d2[_0x1d88('0x2c')][_0x1d88('0x33')](_0x1d88('0x34'))){_0x5bdb18['limit']=qs['limit'](_0x4d87d2[_0x1d88('0x2c')]['limit']);_0x5bdb18['offset']=qs[_0x1d88('0x1f')](_0x4d87d2['query'][_0x1d88('0x1f')]);}_0x5bdb18[_0x1d88('0x35')]=qs[_0x1d88('0x36')](_0x4d87d2[_0x1d88('0x2c')]['sort']);_0x5bdb18[_0x1d88('0x37')]=qs[_0x1d88('0x2d')](_[_0x1d88('0x38')](_0x4d87d2[_0x1d88('0x2c')],_0x2ca79d[_0x1d88('0x2d')]));if(_0x4d87d2['query']['filter']){_0x5bdb18['where']=_[_0x1d88('0x39')](_0x5bdb18[_0x1d88('0x37')],{'$or':_[_0x1d88('0x3a')](_0x212dba,function(_0x59b637){if(_0x59b637[_0x1d88('0x3b')][_0x1d88('0x3c')]!==_0x1d88('0x3d')){var _0x111ef3={};_0x111ef3[_0x59b637[_0x1d88('0x3e')]]={'$like':'%'+_0x4d87d2[_0x1d88('0x2c')][_0x1d88('0x3f')]+'%'};return _0x111ef3;}})});}_0x5bdb18=_[_0x1d88('0x39')]({},_0x5bdb18,_0x4d87d2[_0x1d88('0x40')]);var _0x5a5d68={'where':_0x5bdb18[_0x1d88('0x37')]};return db[_0x1d88('0x28')][_0x1d88('0x1e')](_0x5a5d68)[_0x1d88('0x23')](function(_0x1c7201){_0x4d9aa6[_0x1d88('0x1e')]=_0x1c7201;if(_0x4d87d2[_0x1d88('0x2c')][_0x1d88('0x41')]){_0x5bdb18[_0x1d88('0x42')]=[{'all':!![]}];}return db[_0x1d88('0x28')]['findAll'](_0x5bdb18);})[_0x1d88('0x23')](function(_0xc5b5c2){_0x4d9aa6['rows']=_0xc5b5c2;return _0x4d9aa6;})['then'](respondWithFilteredResult(_0x69511d,_0x5bdb18))['catch'](handleError(_0x69511d,null));};exports['show']=function(_0x14db3d,_0x3c55d6){var _0x37bd2c={'raw':!![],'where':{'id':_0x14db3d[_0x1d88('0x43')]['id']}},_0x292e1f={};_0x292e1f[_0x1d88('0x2f')]=_[_0x1d88('0x2b')](db[_0x1d88('0x28')][_0x1d88('0x29')]);_0x292e1f[_0x1d88('0x2c')]=_['keys'](_0x14db3d[_0x1d88('0x2c')]);_0x292e1f['filters']=_[_0x1d88('0x2e')](_0x292e1f[_0x1d88('0x2f')],_0x292e1f[_0x1d88('0x2c')]);_0x37bd2c[_0x1d88('0x30')]=_[_0x1d88('0x2e')](_0x292e1f[_0x1d88('0x2f')],qs[_0x1d88('0x31')](_0x14db3d['query'][_0x1d88('0x31')]));_0x37bd2c['attributes']=_0x37bd2c[_0x1d88('0x30')][_0x1d88('0x32')]?_0x37bd2c[_0x1d88('0x30')]:_0x292e1f[_0x1d88('0x2f')];if(_0x14db3d[_0x1d88('0x2c')][_0x1d88('0x41')]){_0x37bd2c[_0x1d88('0x42')]=[{'all':!![]}];}_0x37bd2c=_[_0x1d88('0x39')]({},_0x37bd2c,_0x14db3d[_0x1d88('0x40')]);return db[_0x1d88('0x28')][_0x1d88('0x44')](_0x37bd2c)[_0x1d88('0x23')](handleEntityNotFound(_0x3c55d6,null))[_0x1d88('0x23')](respondWithResult(_0x3c55d6,null))[_0x1d88('0x45')](handleError(_0x3c55d6,null));};exports['update']=function(_0x547ca5,_0x1245dc){if(_0x547ca5['body']['id']){delete _0x547ca5[_0x1d88('0x46')]['id'];}return db['CmCustomField'][_0x1d88('0x44')]({'where':{'id':_0x547ca5[_0x1d88('0x43')]['id']}})[_0x1d88('0x23')](handleEntityNotFound(_0x1245dc,null))[_0x1d88('0x23')](saveUpdates(_0x547ca5['body'],null))[_0x1d88('0x23')](respondWithResult(_0x1245dc,null))[_0x1d88('0x45')](handleError(_0x1245dc,null));};exports['destroy']=function(_0x39334b,_0x1ee603){return db[_0x1d88('0x28')]['find']({'where':{'id':_0x39334b[_0x1d88('0x43')]['id']}})['then'](handleEntityNotFound(_0x1ee603,null))[_0x1d88('0x23')](removeEntity(_0x1ee603,null))['catch'](handleError(_0x1ee603,null));};exports[_0x1d88('0x47')]=function(_0x281091,_0x105dab){var _0x44186a;return db['sequelize']['transaction'](function(_0x227dd1){return db[_0x1d88('0x28')][_0x1d88('0x47')](_0x281091[_0x1d88('0x46')],{'transaction':_0x227dd1})[_0x1d88('0x23')](function(_0x324ec0){_0x44186a=_0x324ec0;var _0x1c4506={'type':db[_0x1d88('0x48')][_0x1d88('0x49')],'transaction':_0x227dd1};switch(_0x281091[_0x1d88('0x46')][_0x1d88('0x3b')]){case _0x1d88('0x4a'):_0x1c4506['type']=db[_0x1d88('0x48')][_0x1d88('0x49')];break;case'number':_0x1c4506[_0x1d88('0x3b')]=db[_0x1d88('0x48')][_0x1d88('0x4b')];break;case _0x1d88('0x4c'):_0x1c4506[_0x1d88('0x3b')]=db['Sequelize'][_0x1d88('0x4d')];_0x1c4506[_0x1d88('0x4e')]=![];break;default:}return db[_0x1d88('0x4f')][_0x1d88('0x50')][_0x1d88('0x51')](_0x1d88('0x52'),util[_0x1d88('0x53')](_0x1d88('0x54'),_0x44186a['id']),_0x1c4506);})[_0x1d88('0x23')](function(){return _0x44186a;});})['then'](respondWithResult(_0x105dab,0xc9))[_0x1d88('0x45')](handleError(_0x105dab,null));};
\ No newline at end of file
+var _0xa80e=['body','create','sequelize','transaction','Sequelize','text','TEXT','INTEGER','switch','BOOLEAN','defaultValue','cm_contacts','format','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','rawAttributes','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','CmCustomField','includeAll','include','findAll','catch','show','params','find'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xa80e,0x169));var _0xea80=function(_0x36e567,_0x24d21c){_0x36e567=_0x36e567-0x0;var _0x176d9d=_0xa80e[_0x36e567];return _0x176d9d;};'use strict';var pdf=require(_0xea80('0x0'));var emlformat=require(_0xea80('0x1'));var rimraf=require(_0xea80('0x2'));var zipdir=require(_0xea80('0x3'));var jsonpatch=require(_0xea80('0x4'));var rp=require(_0xea80('0x5'));var moment=require('moment');var BPromise=require(_0xea80('0x6'));var Mustache=require(_0xea80('0x7'));var util=require(_0xea80('0x8'));var path=require(_0xea80('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xea80('0xa'));var fs=require('fs');var _=require(_0xea80('0xb'));var squel=require(_0xea80('0xc'));var crypto=require(_0xea80('0xd'));var jsforce=require(_0xea80('0xe'));var deskjs=require(_0xea80('0xf'));var toCsv=require('to-csv');var querystring=require(_0xea80('0x10'));var Papa=require(_0xea80('0x11'));var authService=require(_0xea80('0x12'));var hardwareService=require(_0xea80('0x13'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xea80('0x14'))(_0xea80('0x15'));var utils=require(_0xea80('0x16'));var config=require(_0xea80('0x17'));var db=require(_0xea80('0x18'))['db'];function respondWithStatusCode(_0x522251,_0x4f9610){_0x4f9610=_0x4f9610||0xcc;return function(_0x10194a){if(_0x10194a){return _0x522251[_0xea80('0x19')](_0x4f9610);}return _0x522251['status'](_0x4f9610)[_0xea80('0x1a')]();};}function respondWithResult(_0x48dcda,_0x863de0){_0x863de0=_0x863de0||0xc8;return function(_0x5c2c1a){if(_0x5c2c1a){return _0x48dcda[_0xea80('0x1b')](_0x863de0)[_0xea80('0x1c')](_0x5c2c1a);}};}function respondWithFilteredResult(_0x5e60c0,_0x20a54b){return function(_0x5c8e5a){if(_0x5c8e5a){var _0x505eb3=_0x5c8e5a[_0xea80('0x1d')],_0x41bf75=_0x20a54b[_0xea80('0x1e')],_0x450629=_0x20a54b[_0xea80('0x1e')]+_0x20a54b[_0xea80('0x1f')],_0x26a51c;if(_0x450629>=_0x505eb3){_0x450629=_0x505eb3;_0x26a51c=0xc8;}else{_0x26a51c=0xce;}_0x5e60c0[_0xea80('0x1b')](_0x26a51c);return _0x5e60c0[_0xea80('0x20')](_0xea80('0x21'),_0x41bf75+'-'+_0x450629+'/'+_0x505eb3)[_0xea80('0x1c')](_0x5c8e5a);}return null;};}function patchUpdates(_0xd69410){return function(_0x47831c){try{jsonpatch[_0xea80('0x22')](_0x47831c,_0xd69410,!![]);}catch(_0x38800a){return BPromise[_0xea80('0x23')](_0x38800a);}return _0x47831c['save']();};}function saveUpdates(_0x553ab3,_0x4d04ad){return function(_0x2877e2){if(_0x2877e2){return _0x2877e2[_0xea80('0x24')](_0x553ab3)[_0xea80('0x25')](function(_0x1524ac){return _0x1524ac;});}return null;};}function removeEntity(_0xfdbf90,_0x9c4040){return function(_0x59bea9){if(_0x59bea9){return _0x59bea9[_0xea80('0x26')]()[_0xea80('0x25')](function(){_0xfdbf90['status'](0xcc)[_0xea80('0x1a')]();});}};}function handleEntityNotFound(_0xcde916,_0x15176f){return function(_0x13d692){if(!_0x13d692){_0xcde916[_0xea80('0x19')](0x194);}return _0x13d692;};}function handleError(_0x1aef9f,_0x48579b){_0x48579b=_0x48579b||0x1f4;return function(_0x3e4a55){logger[_0xea80('0x27')](_0x3e4a55[_0xea80('0x28')]);if(_0x3e4a55['name']){delete _0x3e4a55[_0xea80('0x29')];}_0x1aef9f[_0xea80('0x1b')](_0x48579b)['send'](_0x3e4a55);};}exports[_0xea80('0x2a')]=function(_0x44a8b0,_0x46202d){var _0xc68317={},_0xb31907={},_0x484de5={'count':0x0,'rows':[]};var _0x4bb395=db['CmCustomField'][_0xea80('0x2b')];_0xb31907[_0xea80('0x2c')]=_[_0xea80('0x2d')](_['keys'](_0x4bb395),['name']);_0xb31907[_0xea80('0x2e')]=_[_0xea80('0x2f')](_0x44a8b0[_0xea80('0x2e')]);_0xb31907[_0xea80('0x30')]=_[_0xea80('0x31')](_0xb31907['model'],_0xb31907[_0xea80('0x2e')]);_0xc68317[_0xea80('0x32')]=_[_0xea80('0x31')](_0xb31907['model'],qs[_0xea80('0x33')](_0x44a8b0['query']['fields']));_0xc68317[_0xea80('0x32')]=_0xc68317[_0xea80('0x32')][_0xea80('0x34')]?_0xc68317[_0xea80('0x32')]:_0xb31907[_0xea80('0x2c')];if(!_0x44a8b0[_0xea80('0x2e')]['hasOwnProperty'](_0xea80('0x35'))){_0xc68317['limit']=qs[_0xea80('0x1f')](_0x44a8b0[_0xea80('0x2e')][_0xea80('0x1f')]);_0xc68317[_0xea80('0x1e')]=qs[_0xea80('0x1e')](_0x44a8b0[_0xea80('0x2e')][_0xea80('0x1e')]);}_0xc68317[_0xea80('0x36')]=qs[_0xea80('0x37')](_0x44a8b0[_0xea80('0x2e')]['sort']);_0xc68317[_0xea80('0x38')]=qs[_0xea80('0x30')](_[_0xea80('0x39')](_0x44a8b0[_0xea80('0x2e')],_0xb31907['filters']));if(_0x44a8b0[_0xea80('0x2e')][_0xea80('0x3a')]){_0xc68317['where']=_[_0xea80('0x3b')](_0xc68317[_0xea80('0x38')],{'$or':_[_0xea80('0x3c')](_0x4bb395,function(_0x2d22b1){if(_0x2d22b1[_0xea80('0x3d')][_0xea80('0x3e')]!==_0xea80('0x3f')){var _0x12e806={};_0x12e806[_0x2d22b1[_0xea80('0x40')]]={'$like':'%'+_0x44a8b0['query'][_0xea80('0x3a')]+'%'};return _0x12e806;}})});}_0xc68317=_['merge']({},_0xc68317,_0x44a8b0[_0xea80('0x41')]);var _0x190afa={'where':_0xc68317[_0xea80('0x38')]};return db[_0xea80('0x42')][_0xea80('0x1d')](_0x190afa)[_0xea80('0x25')](function(_0x1affc3){_0x484de5[_0xea80('0x1d')]=_0x1affc3;if(_0x44a8b0[_0xea80('0x2e')][_0xea80('0x43')]){_0xc68317[_0xea80('0x44')]=[{'all':!![]}];}return db[_0xea80('0x42')][_0xea80('0x45')](_0xc68317);})['then'](function(_0x1e53f6){_0x484de5['rows']=_0x1e53f6;return _0x484de5;})[_0xea80('0x25')](respondWithFilteredResult(_0x46202d,_0xc68317))[_0xea80('0x46')](handleError(_0x46202d,null));};exports[_0xea80('0x47')]=function(_0x10ef47,_0x8d273d){var _0x22a8bb={'raw':!![],'where':{'id':_0x10ef47[_0xea80('0x48')]['id']}},_0x32142d={};_0x32142d[_0xea80('0x2c')]=_[_0xea80('0x2f')](db[_0xea80('0x42')][_0xea80('0x2b')]);_0x32142d[_0xea80('0x2e')]=_[_0xea80('0x2f')](_0x10ef47[_0xea80('0x2e')]);_0x32142d[_0xea80('0x30')]=_[_0xea80('0x31')](_0x32142d[_0xea80('0x2c')],_0x32142d[_0xea80('0x2e')]);_0x22a8bb[_0xea80('0x32')]=_[_0xea80('0x31')](_0x32142d['model'],qs['fields'](_0x10ef47[_0xea80('0x2e')][_0xea80('0x33')]));_0x22a8bb[_0xea80('0x32')]=_0x22a8bb[_0xea80('0x32')][_0xea80('0x34')]?_0x22a8bb['attributes']:_0x32142d[_0xea80('0x2c')];if(_0x10ef47[_0xea80('0x2e')]['includeAll']){_0x22a8bb[_0xea80('0x44')]=[{'all':!![]}];}_0x22a8bb=_[_0xea80('0x3b')]({},_0x22a8bb,_0x10ef47['options']);return db['CmCustomField'][_0xea80('0x49')](_0x22a8bb)['then'](handleEntityNotFound(_0x8d273d,null))[_0xea80('0x25')](respondWithResult(_0x8d273d,null))[_0xea80('0x46')](handleError(_0x8d273d,null));};exports[_0xea80('0x24')]=function(_0x2e3ce7,_0x448646){if(_0x2e3ce7['body']['id']){delete _0x2e3ce7[_0xea80('0x4a')]['id'];}return db[_0xea80('0x42')][_0xea80('0x49')]({'where':{'id':_0x2e3ce7['params']['id']}})['then'](handleEntityNotFound(_0x448646,null))[_0xea80('0x25')](saveUpdates(_0x2e3ce7[_0xea80('0x4a')],null))[_0xea80('0x25')](respondWithResult(_0x448646,null))[_0xea80('0x46')](handleError(_0x448646,null));};exports[_0xea80('0x26')]=function(_0x41e5da,_0x3969b6){return db['CmCustomField'][_0xea80('0x49')]({'where':{'id':_0x41e5da[_0xea80('0x48')]['id']}})[_0xea80('0x25')](handleEntityNotFound(_0x3969b6,null))[_0xea80('0x25')](removeEntity(_0x3969b6,null))[_0xea80('0x46')](handleError(_0x3969b6,null));};exports[_0xea80('0x4b')]=function(_0x1251fb,_0x1790b5){var _0x2f0d3c;return db[_0xea80('0x4c')][_0xea80('0x4d')](function(_0x49f444){return db[_0xea80('0x42')][_0xea80('0x4b')](_0x1251fb[_0xea80('0x4a')],{'transaction':_0x49f444})['then'](function(_0x4a4647){_0x2f0d3c=_0x4a4647;var _0x379369={'type':db[_0xea80('0x4e')]['TEXT'],'transaction':_0x49f444};switch(_0x1251fb[_0xea80('0x4a')][_0xea80('0x3d')]){case _0xea80('0x4f'):_0x379369['type']=db['Sequelize'][_0xea80('0x50')];break;case'number':_0x379369[_0xea80('0x3d')]=db[_0xea80('0x4e')][_0xea80('0x51')];break;case _0xea80('0x52'):_0x379369[_0xea80('0x3d')]=db[_0xea80('0x4e')][_0xea80('0x53')];_0x379369[_0xea80('0x54')]=![];break;default:}return db['sequelize']['queryInterface']['addColumn'](_0xea80('0x55'),util[_0xea80('0x56')]('cf_%d',_0x2f0d3c['id']),_0x379369);})['then'](function(){return _0x2f0d3c;});})[_0xea80('0x25')](respondWithResult(_0x1790b5,0xc9))['catch'](handleError(_0x1790b5,null));};
\ No newline at end of file
index 224aa5a..d9357ca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6e38=['request-promise','./cmCustomField.attributes','define','CmCustomField','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x6e38,0x112));var _0x86e3=function(_0x4f9474,_0x56a8bd){_0x4f9474=_0x4f9474-0x0;var _0xdb7173=_0x6e38[_0x4f9474];return _0xdb7173;};'use strict';var _=require(_0x86e3('0x0'));var util=require(_0x86e3('0x1'));var logger=require(_0x86e3('0x2'))(_0x86e3('0x3'));var moment=require(_0x86e3('0x4'));var BPromise=require(_0x86e3('0x5'));var rp=require(_0x86e3('0x6'));var attributes=require(_0x86e3('0x7'));module['exports']=function(_0x4e1000,_0x278934){return _0x4e1000[_0x86e3('0x8')](_0x86e3('0x9'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x393d=['define','cm_custom_fields','lodash','../../config/logger','api','bluebird','request-promise','./cmCustomField.attributes','exports'];(function(_0x8a0d94,_0x16fcee){var _0x48f382=function(_0x46ab83){while(--_0x46ab83){_0x8a0d94['push'](_0x8a0d94['shift']());}};_0x48f382(++_0x16fcee);}(_0x393d,0x18e));var _0xd393=function(_0x3f22e8,_0x37732a){_0x3f22e8=_0x3f22e8-0x0;var _0x368a7e=_0x393d[_0x3f22e8];return _0x368a7e;};'use strict';var _=require(_0xd393('0x0'));var util=require('util');var logger=require(_0xd393('0x1'))(_0xd393('0x2'));var moment=require('moment');var BPromise=require(_0xd393('0x3'));var rp=require(_0xd393('0x4'));var attributes=require(_0xd393('0x5'));module[_0xd393('0x6')]=function(_0x1e4c8d,_0x1c77c0){return _0x1e4c8d[_0xd393('0x7')]('CmCustomField',attributes,{'tableName':_0xd393('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index abc1f36..e9688cc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9b3a=['client','http','then','CmCustomField,\x20%s,\x20%s','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x1a71db,_0x3ecc02){var _0x4c6aec=function(_0x2b4ba4){while(--_0x2b4ba4){_0x1a71db['push'](_0x1a71db['shift']());}};_0x4c6aec(++_0x3ecc02);}(_0x9b3a,0x1ec));var _0xa9b3=function(_0x352cb1,_0x4d79aa){_0x352cb1=_0x352cb1-0x0;var _0x51b902=_0x9b3a[_0x352cb1];return _0x51b902;};'use strict';var _=require('lodash');var util=require(_0xa9b3('0x0'));var moment=require(_0xa9b3('0x1'));var BPromise=require('bluebird');var rs=require(_0xa9b3('0x2'));var fs=require('fs');var Redis=require(_0xa9b3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa9b3('0x4'));var logger=require('../../config/logger')(_0xa9b3('0x5'));var config=require(_0xa9b3('0x6'));var jayson=require(_0xa9b3('0x7'));var client=jayson[_0xa9b3('0x8')][_0xa9b3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x542274,_0x5228a0,_0x4ac28e){return new BPromise(function(_0x3f39fb,_0x10e810){return client['request'](_0x542274,_0x4ac28e)[_0xa9b3('0xa')](function(_0x431bfb){logger['info'](_0xa9b3('0xb'),_0x5228a0,'request\x20sent');logger['debug'](_0xa9b3('0xc'),_0x5228a0,_0xa9b3('0xd'),JSON['stringify'](_0x431bfb));if(_0x431bfb['error']){if(_0x431bfb[_0xa9b3('0xe')][_0xa9b3('0xf')]===0x1f4){logger['error'](_0xa9b3('0xb'),_0x5228a0,_0x431bfb[_0xa9b3('0xe')][_0xa9b3('0x10')]);return _0x10e810(_0x431bfb[_0xa9b3('0xe')]['message']);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x5228a0,_0x431bfb[_0xa9b3('0xe')][_0xa9b3('0x10')]);return _0x3f39fb(_0x431bfb[_0xa9b3('0xe')][_0xa9b3('0x10')]);}else{logger[_0xa9b3('0x11')](_0xa9b3('0xb'),_0x5228a0,'request\x20sent');_0x3f39fb(_0x431bfb[_0xa9b3('0x12')]['message']);}})[_0xa9b3('0x13')](function(_0x2de758){logger[_0xa9b3('0xe')](_0xa9b3('0xb'),_0x5228a0,_0x2de758);_0x10e810(_0x2de758);});});}
\ No newline at end of file
+var _0xf88d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','bluebird'];(function(_0x1b5e26,_0x453ef6){var _0x246191=function(_0x54a89e){while(--_0x54a89e){_0x1b5e26['push'](_0x1b5e26['shift']());}};_0x246191(++_0x453ef6);}(_0xf88d,0x93));var _0xdf88=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xf88d[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0xdf88('0x0'));var util=require(_0xdf88('0x1'));var moment=require('moment');var BPromise=require(_0xdf88('0x2'));var rs=require(_0xdf88('0x3'));var fs=require('fs');var Redis=require(_0xdf88('0x4'));var db=require(_0xdf88('0x5'))['db'];var utils=require(_0xdf88('0x6'));var logger=require(_0xdf88('0x7'))(_0xdf88('0x8'));var config=require(_0xdf88('0x9'));var jayson=require(_0xdf88('0xa'));var client=jayson[_0xdf88('0xb')][_0xdf88('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x58b60d,_0x30bb9f,_0x11c468){return new BPromise(function(_0x2e3fff,_0xadd0a0){return client[_0xdf88('0xd')](_0x58b60d,_0x11c468)[_0xdf88('0xe')](function(_0x3b8aa1){logger['info'](_0xdf88('0xf'),_0x30bb9f,'request\x20sent');logger[_0xdf88('0x10')](_0xdf88('0x11'),_0x30bb9f,'request\x20sent',JSON[_0xdf88('0x12')](_0x3b8aa1));if(_0x3b8aa1[_0xdf88('0x13')]){if(_0x3b8aa1[_0xdf88('0x13')][_0xdf88('0x14')]===0x1f4){logger[_0xdf88('0x13')](_0xdf88('0xf'),_0x30bb9f,_0x3b8aa1[_0xdf88('0x13')][_0xdf88('0x15')]);return _0xadd0a0(_0x3b8aa1[_0xdf88('0x13')]['message']);}logger[_0xdf88('0x13')]('CmCustomField,\x20%s,\x20%s',_0x30bb9f,_0x3b8aa1[_0xdf88('0x13')][_0xdf88('0x15')]);return _0x2e3fff(_0x3b8aa1[_0xdf88('0x13')][_0xdf88('0x15')]);}else{logger['info'](_0xdf88('0xf'),_0x30bb9f,_0xdf88('0x16'));_0x2e3fff(_0x3b8aa1[_0xdf88('0x17')][_0xdf88('0x15')]);}})[_0xdf88('0x18')](function(_0x1d0a10){logger[_0xdf88('0x13')](_0xdf88('0xf'),_0x30bb9f,_0x1d0a10);_0xadd0a0(_0x1d0a10);});});}
\ No newline at end of file
index 82be83b..13eb04e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4252=['isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./cmCustomField.controller'];(function(_0x3254b1,_0x485428){var _0x218618=function(_0x2520db){while(--_0x2520db){_0x3254b1['push'](_0x3254b1['shift']());}};_0x218618(++_0x485428);}(_0x4252,0xad));var _0x2425=function(_0x2718b7,_0x289520){_0x2718b7=_0x2718b7-0x0;var _0x520e45=_0x4252[_0x2718b7];return _0x520e45;};'use strict';var multer=require(_0x2425('0x0'));var util=require(_0x2425('0x1'));var path=require('path');var timeout=require(_0x2425('0x2'));var express=require(_0x2425('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2425('0x4'));var config=require(_0x2425('0x5'));var controller=require(_0x2425('0x6'));router['get']('/',auth[_0x2425('0x7')](),controller[_0x2425('0x8')]);router[_0x2425('0x9')](_0x2425('0xa'),auth[_0x2425('0x7')](),controller[_0x2425('0xb')]);router[_0x2425('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2425('0xd')](_0x2425('0xa'),auth['isAuthenticated'](),controller[_0x2425('0xe')]);router[_0x2425('0xf')](_0x2425('0xa'),auth[_0x2425('0x7')](),controller[_0x2425('0x10')]);module[_0x2425('0x11')]=router;
\ No newline at end of file
+var _0x855d=['update','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','post','create'];(function(_0x2f6541,_0x363cba){var _0x4d76d8=function(_0x86404){while(--_0x86404){_0x2f6541['push'](_0x2f6541['shift']());}};_0x4d76d8(++_0x363cba);}(_0x855d,0xa2));var _0xd855=function(_0x46c2f7,_0x117311){_0x46c2f7=_0x46c2f7-0x0;var _0x1204e9=_0x855d[_0x46c2f7];return _0x1204e9;};'use strict';var multer=require(_0xd855('0x0'));var util=require('util');var path=require(_0xd855('0x1'));var timeout=require('connect-timeout');var express=require(_0xd855('0x2'));var router=express[_0xd855('0x3')]();var auth=require(_0xd855('0x4'));var interaction=require(_0xd855('0x5'));var config=require(_0xd855('0x6'));var controller=require(_0xd855('0x7'));router[_0xd855('0x8')]('/',auth[_0xd855('0x9')](),controller[_0xd855('0xa')]);router[_0xd855('0x8')](_0xd855('0xb'),auth[_0xd855('0x9')](),controller['show']);router[_0xd855('0xc')]('/',auth['isAuthenticated'](),controller[_0xd855('0xd')]);router['put'](_0xd855('0xb'),auth[_0xd855('0x9')](),controller[_0xd855('0xe')]);router['delete'](_0xd855('0xb'),auth[_0xd855('0x9')](),controller[_0xd855('0xf')]);module['exports']=router;
\ No newline at end of file
index f41d3b2..534d878 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7c05=['moment','sequelize','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue'];(function(_0x271a80,_0x268bac){var _0xf8233e=function(_0x825987){while(--_0x825987){_0x271a80['push'](_0x271a80['shift']());}};_0xf8233e(++_0x268bac);}(_0x7c05,0x154));var _0x57c0=function(_0x587693,_0x27fe90){_0x587693=_0x587693-0x0;var _0x510a1a=_0x7c05[_0x587693];return _0x510a1a;};'use strict';var moment=require(_0x57c0('0x0'));var Sequelize=require(_0x57c0('0x1'));module['exports']={'phone':{'type':Sequelize[_0x57c0('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x57c0('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x57c0('0x4')],'defaultValue':moment()[_0x57c0('0x5')](_0x57c0('0x6'))},'countbusyretry':{'type':Sequelize[_0x57c0('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x57c0('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x57c0('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x57c0('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x57c0('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x57c0('0x4')]},'priority':{'type':Sequelize[_0x57c0('0x7')](0x2)[_0x57c0('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x57c0('0x7')],'unique':_0x57c0('0x9')},'ListId':{'type':Sequelize[_0x57c0('0x7')],'unique':_0x57c0('0x9')},'UserId':{'type':Sequelize[_0x57c0('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x57c0('0x7')],'unique':_0x57c0('0x9')},'CampaignId':{'type':Sequelize[_0x57c0('0x7')]}};
\ No newline at end of file
+var _0x2004=['INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x146883,_0x5492fd){var _0x3e193e=function(_0x282e22){while(--_0x282e22){_0x146883['push'](_0x146883['shift']());}};_0x3e193e(++_0x5492fd);}(_0x2004,0x1d1));var _0x4200=function(_0x1516f8,_0x255054){_0x1516f8=_0x1516f8-0x0;var _0x2e3aed=_0x2004[_0x1516f8];return _0x2e3aed;};'use strict';var moment=require(_0x4200('0x0'));var Sequelize=require(_0x4200('0x1'));module[_0x4200('0x2')]={'phone':{'type':Sequelize[_0x4200('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x4200('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x4200('0x5')],'defaultValue':moment()[_0x4200('0x6')](_0x4200('0x7'))},'countbusyretry':{'type':Sequelize[_0x4200('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4200('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x4200('0x8')](0x2)[_0x4200('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x4200('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x4200('0x8')],'unique':_0x4200('0xa')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x4200('0xa')},'UserId':{'type':Sequelize[_0x4200('0x8')]},'VoiceQueueId':{'type':Sequelize[_0x4200('0x8')],'unique':_0x4200('0xa')},'CampaignId':{'type':Sequelize[_0x4200('0x8')]}};
\ No newline at end of file
index be74683..235180f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb5d3=['transaction','format','YYYY-MM-DD\x20HH:mm:ss','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','literal','DESC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','CmCompany','Company','CmList','List','VoiceQueue','dialActive','getOpenContacts','isNumber','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','limit','apply','reject','save','then','error','stack','name','index','CmHopper','rawAttributes','model','keys','query','filters','intersection','$and','$or','$gt','$gte','$lt','$lte','$eq','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','pick','where','merge','map','key','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','update','describe','destroy','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','updatedAt','deleted','user','UserId','deletedat','phone','campaigntype','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','sequelize'];(function(_0x470f62,_0x103ee2){var _0x9c64cb=function(_0x24c759){while(--_0x24c759){_0x470f62['push'](_0x470f62['shift']());}};_0x9c64cb(++_0x103ee2);}(_0xb5d3,0x1a8));var _0x3b5d=function(_0x128450,_0x5869ba){_0x128450=_0x128450-0x0;var _0x4d80ed=_0xb5d3[_0x128450];return _0x4d80ed;};'use strict';var pdf=require(_0x3b5d('0x0'));var emlformat=require(_0x3b5d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3b5d('0x2'));var jsonpatch=require(_0x3b5d('0x3'));var rp=require(_0x3b5d('0x4'));var moment=require('moment');var BPromise=require(_0x3b5d('0x5'));var Mustache=require(_0x3b5d('0x6'));var util=require(_0x3b5d('0x7'));var path=require('path');var sox=require(_0x3b5d('0x8'));var csv=require(_0x3b5d('0x9'));var ejs=require(_0x3b5d('0xa'));var fs=require('fs');var _=require(_0x3b5d('0xb'));var squel=require(_0x3b5d('0xc'));var crypto=require(_0x3b5d('0xd'));var jsforce=require(_0x3b5d('0xe'));var deskjs=require(_0x3b5d('0xf'));var toCsv=require(_0x3b5d('0x9'));var querystring=require('querystring');var Papa=require(_0x3b5d('0x10'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x3b5d('0x11'))('api');var utils=require(_0x3b5d('0x12'));var config=require('../../config/environment');var db=require(_0x3b5d('0x13'))['db'];function respondWithStatusCode(_0x57f22f,_0x1ae0b6){_0x1ae0b6=_0x1ae0b6||0xcc;return function(_0x51ee85){if(_0x51ee85){return _0x57f22f[_0x3b5d('0x14')](_0x1ae0b6);}return _0x57f22f[_0x3b5d('0x15')](_0x1ae0b6)[_0x3b5d('0x16')]();};}function respondWithResult(_0x5869d2,_0x31b4a3){_0x31b4a3=_0x31b4a3||0xc8;return function(_0x5512fd){if(_0x5512fd){return _0x5869d2[_0x3b5d('0x15')](_0x31b4a3)[_0x3b5d('0x17')](_0x5512fd);}};}function respondWithFilteredResult(_0xbdadb2,_0x486baa){return function(_0x6904a4){if(_0x6904a4){var _0x365688=_0x6904a4[_0x3b5d('0x18')],_0x10ea4b=_0x486baa['offset'],_0x3ea0f4=_0x486baa['offset']+_0x486baa[_0x3b5d('0x19')],_0x482396;if(_0x3ea0f4>=_0x365688){_0x3ea0f4=_0x365688;_0x482396=0xc8;}else{_0x482396=0xce;}_0xbdadb2['status'](_0x482396);return _0xbdadb2['set']('Content-Range',_0x10ea4b+'-'+_0x3ea0f4+'/'+_0x365688)['json'](_0x6904a4);}return null;};}function patchUpdates(_0x5207cc){return function(_0x44ebc8){try{jsonpatch[_0x3b5d('0x1a')](_0x44ebc8,_0x5207cc,!![]);}catch(_0x2928d6){return BPromise[_0x3b5d('0x1b')](_0x2928d6);}return _0x44ebc8[_0x3b5d('0x1c')]();};}function saveUpdates(_0x4a68d6,_0x136f79){return function(_0x266ca5){if(_0x266ca5){return _0x266ca5['update'](_0x4a68d6)[_0x3b5d('0x1d')](function(_0x51274f){return _0x51274f;});}return null;};}function removeEntity(_0x559ffe,_0xbb0cd6){return function(_0x2c71c7){if(_0x2c71c7){return _0x2c71c7['destroy']()[_0x3b5d('0x1d')](function(){_0x559ffe[_0x3b5d('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28adda,_0x376eb7){return function(_0x539296){if(!_0x539296){_0x28adda[_0x3b5d('0x14')](0x194);}return _0x539296;};}function handleError(_0x16159a,_0x4a4cd7){_0x4a4cd7=_0x4a4cd7||0x1f4;return function(_0x5b6a11){logger[_0x3b5d('0x1e')](_0x5b6a11[_0x3b5d('0x1f')]);if(_0x5b6a11[_0x3b5d('0x20')]){delete _0x5b6a11[_0x3b5d('0x20')];}_0x16159a[_0x3b5d('0x15')](_0x4a4cd7)['send'](_0x5b6a11);};}exports[_0x3b5d('0x21')]=function(_0xb9f5fd,_0x39e1a8){var _0x5047f9={},_0x5df434={},_0x49e799={'count':0x0,'rows':[]};var _0x1b98ae=db[_0x3b5d('0x22')][_0x3b5d('0x23')];_0x5df434[_0x3b5d('0x24')]=_[_0x3b5d('0x25')](_0x1b98ae);_0x5df434[_0x3b5d('0x26')]=_[_0x3b5d('0x25')](_0xb9f5fd[_0x3b5d('0x26')]);_0x5df434[_0x3b5d('0x27')]=_[_0x3b5d('0x28')](_0x5df434[_0x3b5d('0x24')],_0x5df434['query']);_0x5df434[_0x3b5d('0x27')]=_['concat'](_0x5df434[_0x3b5d('0x27')],[_0x3b5d('0x29'),_0x3b5d('0x2a'),_0x3b5d('0x2b'),_0x3b5d('0x2c'),_0x3b5d('0x2d'),_0x3b5d('0x2e'),'$ne',_0x3b5d('0x2f'),'$not','$between',_0x3b5d('0x30'),'$in',_0x3b5d('0x31'),_0x3b5d('0x32'),_0x3b5d('0x33'),_0x3b5d('0x34'),_0x3b5d('0x35'),_0x3b5d('0x32'),'$overlap',_0x3b5d('0x36'),_0x3b5d('0x37'),_0x3b5d('0x38')]);_0x5047f9[_0x3b5d('0x39')]=_[_0x3b5d('0x28')](_0x5df434[_0x3b5d('0x24')],qs[_0x3b5d('0x3a')](_0xb9f5fd[_0x3b5d('0x26')]['fields']));_0x5047f9[_0x3b5d('0x39')]=_0x5047f9[_0x3b5d('0x39')][_0x3b5d('0x3b')]?_0x5047f9['attributes']:_0x5df434[_0x3b5d('0x24')];if(!_0xb9f5fd['query'][_0x3b5d('0x3c')](_0x3b5d('0x3d'))){_0x5047f9[_0x3b5d('0x19')]=qs['limit'](_0xb9f5fd['query'][_0x3b5d('0x19')]);_0x5047f9['offset']=qs[_0x3b5d('0x3e')](_0xb9f5fd[_0x3b5d('0x26')][_0x3b5d('0x3e')]);}_0x5047f9['order']=qs['sort'](_0xb9f5fd[_0x3b5d('0x26')][_0x3b5d('0x3f')]);_0x5047f9['where']=qs[_0x3b5d('0x27')](_[_0x3b5d('0x40')](_0xb9f5fd['query'],_0x5df434[_0x3b5d('0x27')]));if(_0xb9f5fd[_0x3b5d('0x26')]['filter']){_0x5047f9[_0x3b5d('0x41')]=_[_0x3b5d('0x42')](_0x5047f9['where'],{'$or':_[_0x3b5d('0x43')](_0x1b98ae,function(_0x4cf141){if(_0x4cf141['type'][_0x3b5d('0x44')]!==_0x3b5d('0x45')){var _0x2e9114={};_0x2e9114[_0x4cf141['field']]={'$like':'%'+_0xb9f5fd['query']['filter']+'%'};return _0x2e9114;}})});}_0x5047f9=_[_0x3b5d('0x42')]({},_0x5047f9,_0xb9f5fd[_0x3b5d('0x46')]);var _0x32ecc1={'where':_0x5047f9[_0x3b5d('0x41')]};return db[_0x3b5d('0x22')][_0x3b5d('0x18')](_0x32ecc1)[_0x3b5d('0x1d')](function(_0x256ff4){_0x49e799[_0x3b5d('0x18')]=_0x256ff4;if(_0xb9f5fd[_0x3b5d('0x26')][_0x3b5d('0x47')]){_0x5047f9[_0x3b5d('0x48')]=[{'all':!![]}];}return db[_0x3b5d('0x22')][_0x3b5d('0x49')](_0x5047f9);})[_0x3b5d('0x1d')](function(_0x4a322b){_0x49e799['rows']=_0x4a322b;return _0x49e799;})[_0x3b5d('0x1d')](respondWithFilteredResult(_0x39e1a8,_0x5047f9))[_0x3b5d('0x4a')](handleError(_0x39e1a8,null));};exports[_0x3b5d('0x4b')]=function(_0x20137b,_0x2fcdf7){var _0x2f8d60={'raw':!![],'where':{'id':_0x20137b[_0x3b5d('0x4c')]['id']}},_0x536cc9={};_0x536cc9[_0x3b5d('0x24')]=_[_0x3b5d('0x25')](db[_0x3b5d('0x22')][_0x3b5d('0x23')]);_0x536cc9[_0x3b5d('0x26')]=_[_0x3b5d('0x25')](_0x20137b['query']);_0x536cc9[_0x3b5d('0x27')]=_['intersection'](_0x536cc9[_0x3b5d('0x24')],_0x536cc9[_0x3b5d('0x26')]);_0x2f8d60['attributes']=_[_0x3b5d('0x28')](_0x536cc9[_0x3b5d('0x24')],qs['fields'](_0x20137b[_0x3b5d('0x26')]['fields']));_0x2f8d60['attributes']=_0x2f8d60[_0x3b5d('0x39')][_0x3b5d('0x3b')]?_0x2f8d60[_0x3b5d('0x39')]:_0x536cc9[_0x3b5d('0x24')];if(_0x20137b['query'][_0x3b5d('0x47')]){_0x2f8d60[_0x3b5d('0x48')]=[{'all':!![]}];}_0x2f8d60=_[_0x3b5d('0x42')]({},_0x2f8d60,_0x20137b[_0x3b5d('0x46')]);return db[_0x3b5d('0x22')][_0x3b5d('0x4d')](_0x2f8d60)['then'](handleEntityNotFound(_0x2fcdf7,null))[_0x3b5d('0x1d')](respondWithResult(_0x2fcdf7,null))[_0x3b5d('0x4a')](handleError(_0x2fcdf7,null));};exports['create']=function(_0xe221c5,_0x8074bd){return db[_0x3b5d('0x22')][_0x3b5d('0x4e')](_0xe221c5[_0x3b5d('0x4f')],{})[_0x3b5d('0x1d')](respondWithResult(_0x8074bd,0xc9))['catch'](handleError(_0x8074bd,null));};exports[_0x3b5d('0x50')]=function(_0x9af657,_0x16e28e){if(_0x9af657[_0x3b5d('0x4f')]['id']){delete _0x9af657[_0x3b5d('0x4f')]['id'];}return db[_0x3b5d('0x22')][_0x3b5d('0x4d')]({'where':{'id':_0x9af657['params']['id']}})[_0x3b5d('0x1d')](handleEntityNotFound(_0x16e28e,null))['then'](saveUpdates(_0x9af657[_0x3b5d('0x4f')],null))[_0x3b5d('0x1d')](respondWithResult(_0x16e28e,null))[_0x3b5d('0x4a')](handleError(_0x16e28e,null));};exports[_0x3b5d('0x51')]=function(_0x28a71d,_0x4e16c5){return db[_0x3b5d('0x22')][_0x3b5d('0x51')]()['then'](respondWithResult(_0x4e16c5,null))[_0x3b5d('0x4a')](handleError(_0x4e16c5,null));};exports[_0x3b5d('0x52')]=function(_0x12dbe4,_0x19623f){var _0x53a134;return db[_0x3b5d('0x22')][_0x3b5d('0x4d')]({'where':{'id':_0x12dbe4[_0x3b5d('0x4c')]['id']}})[_0x3b5d('0x1d')](handleEntityNotFound(_0x19623f,null))['then'](function(_0x50af6f){if(_0x50af6f){return _0x50af6f[_0x3b5d('0x52')]()[_0x3b5d('0x1d')](function(_0xe8d4c1){return _0xe8d4c1;});}})[_0x3b5d('0x1d')](function(_0x3219d0){_0x53a134=_0x3219d0;if(_0x3219d0){if(_0x3219d0[_0x3b5d('0x53')]||_0x3219d0[_0x3b5d('0x54')]){return db[_0x3219d0['VoiceQueueId']?'VoiceQueue':_0x3b5d('0x55')][_0x3b5d('0x4d')]({'where':{'id':_0x3219d0[_0x3b5d('0x53')]?_0x3219d0[_0x3b5d('0x53')]:_0x3219d0[_0x3b5d('0x54')]},'attributes':['id',_0x3b5d('0x20')],'raw':!![]});}}})[_0x3b5d('0x1d')](function(_0x580a11){var _0xa0aa0a={};if(_0x580a11){_['merge'](_0xa0aa0a,_[_0x3b5d('0x56')](_0x53a134[_0x3b5d('0x57')],[_0x3b5d('0x58'),_0x3b5d('0x59'),'id']));_0xa0aa0a['state']=0x15;_0xa0aa0a['statedesc']=_0x3b5d('0x5a');_0xa0aa0a['campaign']=_0x580a11['name'];_0xa0aa0a['membername']=_0x12dbe4[_0x3b5d('0x5b')][_0x3b5d('0x20')];_0xa0aa0a[_0x3b5d('0x5c')]=_0x12dbe4[_0x3b5d('0x5b')]['id'];_0xa0aa0a['deleted']=!![];_0xa0aa0a[_0x3b5d('0x5d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xa0aa0a['calleridnum']=_0x53a134[_0x3b5d('0x5e')];_0xa0aa0a[_0x3b5d('0x5f')]=_0x53a134['VoiceQueueId']?'queue':'ivr';return db[_0x3b5d('0x60')][_0x3b5d('0x4d')]({'where':{'id':_0xa0aa0a[_0x3b5d('0x61')]},'attributes':[_0x3b5d('0x62'),_0x3b5d('0x63')]})[_0x3b5d('0x1d')](function(_0x5c1376){if(!_[_0x3b5d('0x64')](_0x19623f)&&!_['isNil'](_0x5c1376['firstName'])){_0xa0aa0a[_0x3b5d('0x65')]=_0x5c1376['firstName'];if(!_['isNil'](_0x5c1376[_0x3b5d('0x63')])){_0xa0aa0a['calleridname']+='\x20'+_0x5c1376[_0x3b5d('0x63')];}}})[_0x3b5d('0x66')](function(){return db['CmHopperFinal']['create'](_0xa0aa0a);});}})['then'](function(){return _0x19623f[_0x3b5d('0x15')](0xcc)[_0x3b5d('0x16')]();})[_0x3b5d('0x4a')](handleError(_0x19623f,null));};exports[_0x3b5d('0x67')]=function(_0x169dcd,_0x4620c3,_0x331428){var _0x460bd8=[];return db['CmContact'][_0x3b5d('0x51')]()[_0x3b5d('0x1d')](function(_0x20888a){_0x460bd8=_['keys'](_0x20888a);return _0x169dcd[_0x3b5d('0x5b')][_0x3b5d('0x68')]({'where':{'type':_0x3b5d('0x69'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x3b5d('0x6a')],'raw':!![]});})[_0x3b5d('0x1d')](function(_0x5124e0){if(_0x5124e0&&_0x5124e0[_0x3b5d('0x3b')]){return db[_0x3b5d('0x6b')][_0x3b5d('0x6c')](function(_0x194a4b){var _0x1053a8={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x3b5d('0x6d')](_0x3b5d('0x6e'))},'VoiceQueueId':{'$in':_[_0x3b5d('0x43')](_0x5124e0,'id')},'$or':[{'UserId':null},{'UserId':_0x169dcd[_0x3b5d('0x5b')]['id']}]};var _0x21a786=[];if(_0x169dcd[_0x3b5d('0x4f')][_0x3b5d('0x6f')]&&_0x169dcd[_0x3b5d('0x4f')][_0x3b5d('0x6f')]===_0x3b5d('0x70')){if(!_[_0x3b5d('0x71')](_0x169dcd[_0x3b5d('0x4f')][_0x3b5d('0x72')])){_0x1053a8['id']={'$in':_0x169dcd[_0x3b5d('0x4f')]['hopperIds']};}_0x21a786=[[_0x3b5d('0x73'),_0x3b5d('0x74')],[_0x3b5d('0x75'),_0x5124e0[0x0][_0x3b5d('0x6a')]===_0x3b5d('0x74')?'DESC':'ASC'],db[_0x3b5d('0x6b')][_0x3b5d('0x76')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x3b5d('0x77')]];}else{if(!_[_0x3b5d('0x71')](_0x169dcd['body'][_0x3b5d('0x72')])){_0x1053a8['id']={'$notIn':_0x169dcd[_0x3b5d('0x4f')][_0x3b5d('0x72')]};}_0x21a786=[[_0x3b5d('0x73'),_0x3b5d('0x77')],[_0x3b5d('0x75'),_0x5124e0[0x0]['dialOrderByScheduledAt']],db[_0x3b5d('0x6b')][_0x3b5d('0x76')](_0x3b5d('0x78')),['id','ASC']];}return db[_0x3b5d('0x22')][_0x3b5d('0x79')]({'attributes':['id',_0x3b5d('0x7a')],'where':_0x1053a8,'order':_0x21a786,'transaction':_0x194a4b,'lock':_0x194a4b[_0x3b5d('0x7b')][_0x3b5d('0x7c')],'include':[{'model':db[_0x3b5d('0x60')],'as':'Contact','attributes':_0x460bd8,'include':[{'model':db[_0x3b5d('0x7d')],'as':_0x3b5d('0x7e'),'attributes':['id',_0x3b5d('0x20')]}]},{'model':db[_0x3b5d('0x7f')],'as':_0x3b5d('0x80'),'attributes':['id',_0x3b5d('0x20')]},{'model':db[_0x3b5d('0x81')],'as':'Queue','attributes':['id',_0x3b5d('0x20'),_0x3b5d('0x82')]}]})[_0x3b5d('0x1d')](function(_0xaa59db){if(_0xaa59db){return _0xaa59db['update']({'UserId':_0x169dcd[_0x3b5d('0x5b')]['id']},{'transaction':_0x194a4b});}});});}})[_0x3b5d('0x1d')](handleEntityNotFound(_0x4620c3,null))[_0x3b5d('0x1d')](respondWithResult(_0x4620c3,null))['catch'](handleError(_0x4620c3,null));};exports[_0x3b5d('0x83')]=function(_0x3df6d3,_0x2e0305,_0x7e3389){return _0x3df6d3['user'][_0x3b5d('0x68')]({'where':{'type':_0x3b5d('0x69'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0x48b1af){if(_0x48b1af&&_0x48b1af['length']){return db[_0x3b5d('0x22')][_0x3b5d('0x18')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x3b5d('0x6d')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x48b1af,'id')},'$or':[{'UserId':null},{'UserId':_0x3df6d3[_0x3b5d('0x5b')]['id']}]}});}return 0x0;})['then'](function(_0x33243f){if(!_['isNil'](_0x33243f)&&_[_0x3b5d('0x84')](_0x33243f)){return _0x2e0305[_0x3b5d('0x15')](0xc8)[_0x3b5d('0x17')]({'contacts':_0x33243f});}else{logger[_0x3b5d('0x1e')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x3b5d('0x83'),0x194,'entity\x20not\x20found');_0x2e0305[_0x3b5d('0x14')](0x194);}})[_0x3b5d('0x4a')](handleError(_0x2e0305,null));};
\ No newline at end of file
+var _0x6c2f=['merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','update','find','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','statedesc','campaign','membername','user','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','transaction','map','direction','prev','hopperIds','priority','ASC','scheduledAt','DESC','sequelize','literal','isEmpty','findOne','UPDATE','CmCompany','Company','CmList','List','Queue','dialActive','getOpenContacts','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','set','apply','reject','save','then','destroy','sendStatus','stack','name','CmHopper','model','keys','query','intersection','filters','concat','$and','$or','$gt','$lt','$lte','$ne','$eq','$between','$notBetween','$iLike','$notILike','$like','$overlap','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','key','VIRTUAL','field'];(function(_0x493135,_0x21fed6){var _0x49e995=function(_0x726abe){while(--_0x726abe){_0x493135['push'](_0x493135['shift']());}};_0x49e995(++_0x21fed6);}(_0x6c2f,0x15d));var _0xf6c2=function(_0x4d0b75,_0x127926){_0x4d0b75=_0x4d0b75-0x0;var _0x3e1a77=_0x6c2f[_0x4d0b75];return _0x3e1a77;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf6c2('0x0'));var rimraf=require(_0xf6c2('0x1'));var zipdir=require(_0xf6c2('0x2'));var jsonpatch=require(_0xf6c2('0x3'));var rp=require('request-promise');var moment=require(_0xf6c2('0x4'));var BPromise=require(_0xf6c2('0x5'));var Mustache=require(_0xf6c2('0x6'));var util=require(_0xf6c2('0x7'));var path=require(_0xf6c2('0x8'));var sox=require(_0xf6c2('0x9'));var csv=require(_0xf6c2('0xa'));var ejs=require(_0xf6c2('0xb'));var fs=require('fs');var _=require(_0xf6c2('0xc'));var squel=require('squel');var crypto=require(_0xf6c2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf6c2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf6c2('0xf'));var Papa=require(_0xf6c2('0x10'));var authService=require(_0xf6c2('0x11'));var hardwareService=require(_0xf6c2('0x12'));var Redis=require(_0xf6c2('0x13'));var qs=require(_0xf6c2('0x14'));var logger=require(_0xf6c2('0x15'))(_0xf6c2('0x16'));var utils=require(_0xf6c2('0x17'));var config=require(_0xf6c2('0x18'));var db=require(_0xf6c2('0x19'))['db'];function respondWithStatusCode(_0x4d32dd,_0x52ff8b){_0x52ff8b=_0x52ff8b||0xcc;return function(_0x26d720){if(_0x26d720){return _0x4d32dd['sendStatus'](_0x52ff8b);}return _0x4d32dd['status'](_0x52ff8b)[_0xf6c2('0x1a')]();};}function respondWithResult(_0x480e68,_0x2822a9){_0x2822a9=_0x2822a9||0xc8;return function(_0x5a4082){if(_0x5a4082){return _0x480e68[_0xf6c2('0x1b')](_0x2822a9)[_0xf6c2('0x1c')](_0x5a4082);}};}function respondWithFilteredResult(_0x3fce5c,_0x2cf292){return function(_0x506179){if(_0x506179){var _0x214a09=_0x506179[_0xf6c2('0x1d')],_0x31eefa=_0x2cf292[_0xf6c2('0x1e')],_0x30b6c1=_0x2cf292['offset']+_0x2cf292[_0xf6c2('0x1f')],_0x413ad4;if(_0x30b6c1>=_0x214a09){_0x30b6c1=_0x214a09;_0x413ad4=0xc8;}else{_0x413ad4=0xce;}_0x3fce5c[_0xf6c2('0x1b')](_0x413ad4);return _0x3fce5c[_0xf6c2('0x20')]('Content-Range',_0x31eefa+'-'+_0x30b6c1+'/'+_0x214a09)[_0xf6c2('0x1c')](_0x506179);}return null;};}function patchUpdates(_0x337320){return function(_0x488a07){try{jsonpatch[_0xf6c2('0x21')](_0x488a07,_0x337320,!![]);}catch(_0xb42eaa){return BPromise[_0xf6c2('0x22')](_0xb42eaa);}return _0x488a07[_0xf6c2('0x23')]();};}function saveUpdates(_0x3f6e3d,_0x488f4e){return function(_0x4d7555){if(_0x4d7555){return _0x4d7555['update'](_0x3f6e3d)[_0xf6c2('0x24')](function(_0x5477b8){return _0x5477b8;});}return null;};}function removeEntity(_0x10498b,_0x1c6d7b){return function(_0x38d252){if(_0x38d252){return _0x38d252[_0xf6c2('0x25')]()[_0xf6c2('0x24')](function(){_0x10498b['status'](0xcc)[_0xf6c2('0x1a')]();});}};}function handleEntityNotFound(_0xbad3fe,_0x2ab438){return function(_0x5928ed){if(!_0x5928ed){_0xbad3fe[_0xf6c2('0x26')](0x194);}return _0x5928ed;};}function handleError(_0x403e4a,_0x50b12e){_0x50b12e=_0x50b12e||0x1f4;return function(_0x4cf19d){logger['error'](_0x4cf19d[_0xf6c2('0x27')]);if(_0x4cf19d[_0xf6c2('0x28')]){delete _0x4cf19d[_0xf6c2('0x28')];}_0x403e4a[_0xf6c2('0x1b')](_0x50b12e)['send'](_0x4cf19d);};}exports['index']=function(_0x51db46,_0x1650e3){var _0x14ddab={},_0x420fbe={},_0x8cc173={'count':0x0,'rows':[]};var _0x27c88f=db[_0xf6c2('0x29')]['rawAttributes'];_0x420fbe[_0xf6c2('0x2a')]=_[_0xf6c2('0x2b')](_0x27c88f);_0x420fbe[_0xf6c2('0x2c')]=_[_0xf6c2('0x2b')](_0x51db46[_0xf6c2('0x2c')]);_0x420fbe['filters']=_[_0xf6c2('0x2d')](_0x420fbe[_0xf6c2('0x2a')],_0x420fbe[_0xf6c2('0x2c')]);_0x420fbe[_0xf6c2('0x2e')]=_[_0xf6c2('0x2f')](_0x420fbe[_0xf6c2('0x2e')],[_0xf6c2('0x30'),_0xf6c2('0x31'),_0xf6c2('0x32'),'$gte',_0xf6c2('0x33'),_0xf6c2('0x34'),_0xf6c2('0x35'),_0xf6c2('0x36'),'$not',_0xf6c2('0x37'),_0xf6c2('0x38'),'$in','$notIn','$like','$notLike',_0xf6c2('0x39'),_0xf6c2('0x3a'),_0xf6c2('0x3b'),_0xf6c2('0x3c'),'$contains','$contained','$any']);_0x14ddab[_0xf6c2('0x3d')]=_[_0xf6c2('0x2d')](_0x420fbe[_0xf6c2('0x2a')],qs['fields'](_0x51db46[_0xf6c2('0x2c')][_0xf6c2('0x3e')]));_0x14ddab['attributes']=_0x14ddab[_0xf6c2('0x3d')][_0xf6c2('0x3f')]?_0x14ddab['attributes']:_0x420fbe[_0xf6c2('0x2a')];if(!_0x51db46['query'][_0xf6c2('0x40')]('nolimit')){_0x14ddab['limit']=qs[_0xf6c2('0x1f')](_0x51db46['query']['limit']);_0x14ddab[_0xf6c2('0x1e')]=qs[_0xf6c2('0x1e')](_0x51db46[_0xf6c2('0x2c')]['offset']);}_0x14ddab[_0xf6c2('0x41')]=qs[_0xf6c2('0x42')](_0x51db46[_0xf6c2('0x2c')][_0xf6c2('0x42')]);_0x14ddab[_0xf6c2('0x43')]=qs['filters'](_[_0xf6c2('0x44')](_0x51db46[_0xf6c2('0x2c')],_0x420fbe[_0xf6c2('0x2e')]));if(_0x51db46[_0xf6c2('0x2c')][_0xf6c2('0x45')]){_0x14ddab[_0xf6c2('0x43')]=_['merge'](_0x14ddab[_0xf6c2('0x43')],{'$or':_['map'](_0x27c88f,function(_0x2f2a16){if(_0x2f2a16[_0xf6c2('0x46')][_0xf6c2('0x47')]!==_0xf6c2('0x48')){var _0x13b117={};_0x13b117[_0x2f2a16[_0xf6c2('0x49')]]={'$like':'%'+_0x51db46[_0xf6c2('0x2c')]['filter']+'%'};return _0x13b117;}})});}_0x14ddab=_[_0xf6c2('0x4a')]({},_0x14ddab,_0x51db46['options']);var _0x492591={'where':_0x14ddab[_0xf6c2('0x43')]};return db['CmHopper'][_0xf6c2('0x1d')](_0x492591)['then'](function(_0x3f6461){_0x8cc173['count']=_0x3f6461;if(_0x51db46[_0xf6c2('0x2c')][_0xf6c2('0x4b')]){_0x14ddab[_0xf6c2('0x4c')]=[{'all':!![]}];}return db[_0xf6c2('0x29')][_0xf6c2('0x4d')](_0x14ddab);})[_0xf6c2('0x24')](function(_0x58d551){_0x8cc173[_0xf6c2('0x4e')]=_0x58d551;return _0x8cc173;})[_0xf6c2('0x24')](respondWithFilteredResult(_0x1650e3,_0x14ddab))[_0xf6c2('0x4f')](handleError(_0x1650e3,null));};exports[_0xf6c2('0x50')]=function(_0x39a70f,_0x4b5e2e){var _0x13c34e={'raw':!![],'where':{'id':_0x39a70f[_0xf6c2('0x51')]['id']}},_0x2bc16b={};_0x2bc16b[_0xf6c2('0x2a')]=_[_0xf6c2('0x2b')](db['CmHopper'][_0xf6c2('0x52')]);_0x2bc16b[_0xf6c2('0x2c')]=_['keys'](_0x39a70f[_0xf6c2('0x2c')]);_0x2bc16b[_0xf6c2('0x2e')]=_['intersection'](_0x2bc16b['model'],_0x2bc16b['query']);_0x13c34e[_0xf6c2('0x3d')]=_[_0xf6c2('0x2d')](_0x2bc16b[_0xf6c2('0x2a')],qs[_0xf6c2('0x3e')](_0x39a70f['query'][_0xf6c2('0x3e')]));_0x13c34e[_0xf6c2('0x3d')]=_0x13c34e[_0xf6c2('0x3d')][_0xf6c2('0x3f')]?_0x13c34e[_0xf6c2('0x3d')]:_0x2bc16b[_0xf6c2('0x2a')];if(_0x39a70f[_0xf6c2('0x2c')][_0xf6c2('0x4b')]){_0x13c34e[_0xf6c2('0x4c')]=[{'all':!![]}];}_0x13c34e=_[_0xf6c2('0x4a')]({},_0x13c34e,_0x39a70f['options']);return db['CmHopper']['find'](_0x13c34e)[_0xf6c2('0x24')](handleEntityNotFound(_0x4b5e2e,null))[_0xf6c2('0x24')](respondWithResult(_0x4b5e2e,null))[_0xf6c2('0x4f')](handleError(_0x4b5e2e,null));};exports['create']=function(_0x31efa9,_0x2b1f15){return db[_0xf6c2('0x29')][_0xf6c2('0x53')](_0x31efa9[_0xf6c2('0x54')],{})[_0xf6c2('0x24')](respondWithResult(_0x2b1f15,0xc9))[_0xf6c2('0x4f')](handleError(_0x2b1f15,null));};exports[_0xf6c2('0x55')]=function(_0x48b002,_0x2322fd){if(_0x48b002[_0xf6c2('0x54')]['id']){delete _0x48b002[_0xf6c2('0x54')]['id'];}return db[_0xf6c2('0x29')][_0xf6c2('0x56')]({'where':{'id':_0x48b002[_0xf6c2('0x51')]['id']}})[_0xf6c2('0x24')](handleEntityNotFound(_0x2322fd,null))[_0xf6c2('0x24')](saveUpdates(_0x48b002['body'],null))[_0xf6c2('0x24')](respondWithResult(_0x2322fd,null))[_0xf6c2('0x4f')](handleError(_0x2322fd,null));};exports[_0xf6c2('0x57')]=function(_0xa3711a,_0x33d723){return db[_0xf6c2('0x29')]['describe']()['then'](respondWithResult(_0x33d723,null))[_0xf6c2('0x4f')](handleError(_0x33d723,null));};exports['destroy']=function(_0x3e19bc,_0x201696){var _0x38e2cd;return db['CmHopper'][_0xf6c2('0x56')]({'where':{'id':_0x3e19bc[_0xf6c2('0x51')]['id']}})[_0xf6c2('0x24')](handleEntityNotFound(_0x201696,null))[_0xf6c2('0x24')](function(_0x42963e){if(_0x42963e){return _0x42963e[_0xf6c2('0x25')]()[_0xf6c2('0x24')](function(_0xad3b0a){return _0xad3b0a;});}})['then'](function(_0xd4ee31){_0x38e2cd=_0xd4ee31;if(_0xd4ee31){if(_0xd4ee31[_0xf6c2('0x58')]||_0xd4ee31[_0xf6c2('0x59')]){return db[_0xd4ee31['VoiceQueueId']?_0xf6c2('0x5a'):_0xf6c2('0x5b')][_0xf6c2('0x56')]({'where':{'id':_0xd4ee31[_0xf6c2('0x58')]?_0xd4ee31[_0xf6c2('0x58')]:_0xd4ee31[_0xf6c2('0x59')]},'attributes':['id',_0xf6c2('0x28')],'raw':!![]});}}})['then'](function(_0x58be6b){var _0x439a59={};if(_0x58be6b){_[_0xf6c2('0x4a')](_0x439a59,_[_0xf6c2('0x5c')](_0x38e2cd[_0xf6c2('0x5d')],[_0xf6c2('0x5e'),'updatedAt','id']));_0x439a59['state']=0x15;_0x439a59[_0xf6c2('0x5f')]='deleted';_0x439a59[_0xf6c2('0x60')]=_0x58be6b[_0xf6c2('0x28')];_0x439a59[_0xf6c2('0x61')]=_0x3e19bc[_0xf6c2('0x62')][_0xf6c2('0x28')];_0x439a59['UserId']=_0x3e19bc[_0xf6c2('0x62')]['id'];_0x439a59[_0xf6c2('0x63')]=!![];_0x439a59[_0xf6c2('0x64')]=moment()[_0xf6c2('0x65')](_0xf6c2('0x66'));_0x439a59[_0xf6c2('0x67')]=_0x38e2cd['phone'];_0x439a59[_0xf6c2('0x68')]=_0x38e2cd['VoiceQueueId']?_0xf6c2('0x69'):'ivr';return db[_0xf6c2('0x6a')][_0xf6c2('0x56')]({'where':{'id':_0x439a59[_0xf6c2('0x6b')]},'attributes':[_0xf6c2('0x6c'),_0xf6c2('0x6d')]})['then'](function(_0x1c27ba){if(!_['isNil'](_0x201696)&&!_[_0xf6c2('0x6e')](_0x1c27ba[_0xf6c2('0x6c')])){_0x439a59[_0xf6c2('0x6f')]=_0x1c27ba['firstName'];if(!_[_0xf6c2('0x6e')](_0x1c27ba[_0xf6c2('0x6d')])){_0x439a59[_0xf6c2('0x6f')]+='\x20'+_0x1c27ba[_0xf6c2('0x6d')];}}})['finally'](function(){return db['CmHopperFinal'][_0xf6c2('0x53')](_0x439a59);});}})[_0xf6c2('0x24')](function(){return _0x201696['status'](0xcc)[_0xf6c2('0x1a')]();})['catch'](handleError(_0x201696,null));};exports[_0xf6c2('0x70')]=function(_0x3707c8,_0x9749f1,_0x4ce71e){var _0x712760=[];return db[_0xf6c2('0x6a')][_0xf6c2('0x57')]()['then'](function(_0x569f52){_0x712760=_[_0xf6c2('0x2b')](_0x569f52);return _0x3707c8[_0xf6c2('0x62')][_0xf6c2('0x71')]({'where':{'type':_0xf6c2('0x72'),'dialActive':!![],'dialMethod':_0xf6c2('0x73')},'attributes':['id',_0xf6c2('0x74')],'raw':!![]});})[_0xf6c2('0x24')](function(_0x2be27f){if(_0x2be27f&&_0x2be27f[_0xf6c2('0x3f')]){return db['sequelize'][_0xf6c2('0x75')](function(_0x356917){var _0x1dcbe3={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf6c2('0x65')](_0xf6c2('0x66'))},'VoiceQueueId':{'$in':_[_0xf6c2('0x76')](_0x2be27f,'id')},'$or':[{'UserId':null},{'UserId':_0x3707c8[_0xf6c2('0x62')]['id']}]};var _0x4b1426=[];if(_0x3707c8[_0xf6c2('0x54')][_0xf6c2('0x77')]&&_0x3707c8[_0xf6c2('0x54')][_0xf6c2('0x77')]===_0xf6c2('0x78')){if(!_['isEmpty'](_0x3707c8[_0xf6c2('0x54')][_0xf6c2('0x79')])){_0x1dcbe3['id']={'$in':_0x3707c8['body']['hopperIds']};}_0x4b1426=[[_0xf6c2('0x7a'),_0xf6c2('0x7b')],[_0xf6c2('0x7c'),_0x2be27f[0x0][_0xf6c2('0x74')]===_0xf6c2('0x7b')?_0xf6c2('0x7d'):_0xf6c2('0x7b')],db[_0xf6c2('0x7e')][_0xf6c2('0x7f')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xf6c2('0x7d')]];}else{if(!_[_0xf6c2('0x80')](_0x3707c8[_0xf6c2('0x54')][_0xf6c2('0x79')])){_0x1dcbe3['id']={'$notIn':_0x3707c8[_0xf6c2('0x54')][_0xf6c2('0x79')]};}_0x4b1426=[['priority',_0xf6c2('0x7d')],[_0xf6c2('0x7c'),_0x2be27f[0x0][_0xf6c2('0x74')]],db[_0xf6c2('0x7e')][_0xf6c2('0x7f')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0xf6c2('0x7b')]];}return db[_0xf6c2('0x29')][_0xf6c2('0x81')]({'attributes':['id','scheduledat'],'where':_0x1dcbe3,'order':_0x4b1426,'transaction':_0x356917,'lock':_0x356917['LOCK'][_0xf6c2('0x82')],'include':[{'model':db[_0xf6c2('0x6a')],'as':'Contact','attributes':_0x712760,'include':[{'model':db[_0xf6c2('0x83')],'as':_0xf6c2('0x84'),'attributes':['id','name']}]},{'model':db[_0xf6c2('0x85')],'as':_0xf6c2('0x86'),'attributes':['id','name']},{'model':db[_0xf6c2('0x5a')],'as':_0xf6c2('0x87'),'attributes':['id',_0xf6c2('0x28'),_0xf6c2('0x88')]}]})[_0xf6c2('0x24')](function(_0x9ef0d6){if(_0x9ef0d6){return _0x9ef0d6['update']({'UserId':_0x3707c8[_0xf6c2('0x62')]['id']},{'transaction':_0x356917});}});});}})[_0xf6c2('0x24')](handleEntityNotFound(_0x9749f1,null))[_0xf6c2('0x24')](respondWithResult(_0x9749f1,null))[_0xf6c2('0x4f')](handleError(_0x9749f1,null));};exports[_0xf6c2('0x89')]=function(_0x4a2307,_0x2ce153,_0x89d7cc){return _0x4a2307['user']['getVoiceQueues']({'where':{'type':_0xf6c2('0x72'),'dialActive':!![],'dialMethod':_0xf6c2('0x73')},'attributes':['id'],'raw':!![]})[_0xf6c2('0x24')](function(_0x984fc0){if(_0x984fc0&&_0x984fc0[_0xf6c2('0x3f')]){return db[_0xf6c2('0x29')][_0xf6c2('0x1d')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xf6c2('0x66'))},'VoiceQueueId':{'$in':_['map'](_0x984fc0,'id')},'$or':[{'UserId':null},{'UserId':_0x4a2307[_0xf6c2('0x62')]['id']}]}});}return 0x0;})['then'](function(_0x964e4c){if(!_[_0xf6c2('0x6e')](_0x964e4c)&&_['isNumber'](_0x964e4c)){return _0x2ce153[_0xf6c2('0x1b')](0xc8)[_0xf6c2('0x1c')]({'contacts':_0x964e4c});}else{logger[_0xf6c2('0x8a')](_0xf6c2('0x8b'),_0xf6c2('0x89'),0x194,_0xf6c2('0x8c'));_0x2ce153['sendStatus'](0x194);}})[_0xf6c2('0x4f')](handleError(_0x2ce153,null));};
\ No newline at end of file
index 5865928..3395172 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8d0f=['request-promise','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','api'];(function(_0x1081b0,_0x23f3d4){var _0x348aaf=function(_0x3ee37b){while(--_0x3ee37b){_0x1081b0['push'](_0x1081b0['shift']());}};_0x348aaf(++_0x23f3d4);}(_0x8d0f,0xef));var _0xf8d0=function(_0x26a9ea,_0x10ecba){_0x26a9ea=_0x26a9ea-0x0;var _0x3bc99d=_0x8d0f[_0x26a9ea];return _0x3bc99d;};'use strict';var _=require(_0xf8d0('0x0'));var util=require(_0xf8d0('0x1'));var logger=require('../../config/logger')(_0xf8d0('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf8d0('0x3'));var attributes=require('./cmHopper.attributes');module[_0xf8d0('0x4')]=function(_0x4a5e63,_0xbeb6ac){return _0x4a5e63[_0xf8d0('0x5')](_0xf8d0('0x6'),attributes,{'tableName':_0xf8d0('0x7'),'paranoid':![],'indexes':[{'name':_0xf8d0('0x8'),'fields':[_0xf8d0('0x8')]},{'name':_0xf8d0('0x9'),'fields':[_0xf8d0('0x9')]},{'name':_0xf8d0('0xa'),'fields':[_0xf8d0('0xa')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xdb3e=['define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','api','moment','bluebird','exports'];(function(_0x3d8ca8,_0x1a9764){var _0x517e45=function(_0x641ad9){while(--_0x641ad9){_0x3d8ca8['push'](_0x3d8ca8['shift']());}};_0x517e45(++_0x1a9764);}(_0xdb3e,0x16e));var _0xedb3=function(_0x592f9c,_0x444653){_0x592f9c=_0x592f9c-0x0;var _0x2c6b87=_0xdb3e[_0x592f9c];return _0x2c6b87;};'use strict';var _=require(_0xedb3('0x0'));var util=require('util');var logger=require(_0xedb3('0x1'))(_0xedb3('0x2'));var moment=require(_0xedb3('0x3'));var BPromise=require(_0xedb3('0x4'));var rp=require('request-promise');var attributes=require('./cmHopper.attributes');module[_0xedb3('0x5')]=function(_0x3d3391,_0x45f625){return _0x3d3391[_0xedb3('0x6')](_0xedb3('0x7'),attributes,{'tableName':_0xedb3('0x8'),'paranoid':![],'indexes':[{'name':_0xedb3('0x9'),'fields':[_0xedb3('0x9')]},{'name':_0xedb3('0xa'),'fields':[_0xedb3('0xa')]},{'name':_0xedb3('0xb'),'fields':[_0xedb3('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
index a64ce7b..c030057 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x875c=['CmHopper,\x20%s,\x20%s','message','result','catch','CmHopper','findAll','options','raw','where','attributes','limit','include','model','map','info','GetCmHopper','stringify','find','ShowCmHopper','CreateCmHopper','create','body','debug','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','transaction','order','UPDATE','CmContact','Contact','keys','push','MoveContactManagedDialer','CmHopperFinal','COUNT','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','UserId','LOCK','update','all','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','then','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x875c,0x1ab));var _0xc875=function(_0x32a9b9,_0x535fd1){_0x32a9b9=_0x32a9b9-0x0;var _0x2f53ec=_0x875c[_0x32a9b9];return _0x2f53ec;};'use strict';var _=require('lodash');var util=require(_0xc875('0x0'));var moment=require('moment');var BPromise=require(_0xc875('0x1'));var rs=require(_0xc875('0x2'));var fs=require('fs');var Redis=require(_0xc875('0x3'));var db=require(_0xc875('0x4'))['db'];var utils=require(_0xc875('0x5'));var logger=require(_0xc875('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc875('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x6889dd,_0x386e21,_0x50dd4e){return new BPromise(function(_0x358979,_0x2db092){return client[_0xc875('0x8')](_0x6889dd,_0x50dd4e)[_0xc875('0x9')](function(_0x573386){logger['info']('CmHopper,\x20%s,\x20%s',_0x386e21,'request\x20sent');logger['debug'](_0xc875('0xa'),_0x386e21,_0xc875('0xb'),JSON['stringify'](_0x573386));if(_0x573386[_0xc875('0xc')]){if(_0x573386[_0xc875('0xc')][_0xc875('0xd')]===0x1f4){logger[_0xc875('0xc')](_0xc875('0xe'),_0x386e21,_0x573386[_0xc875('0xc')][_0xc875('0xf')]);return _0x2db092(_0x573386[_0xc875('0xc')][_0xc875('0xf')]);}logger[_0xc875('0xc')](_0xc875('0xe'),_0x386e21,_0x573386[_0xc875('0xc')]['message']);return _0x358979(_0x573386[_0xc875('0xc')]['message']);}else{logger['info']('CmHopper,\x20%s,\x20%s',_0x386e21,_0xc875('0xb'));_0x358979(_0x573386[_0xc875('0x10')][_0xc875('0xf')]);}})[_0xc875('0x11')](function(_0x4a5ca5){logger[_0xc875('0xc')](_0xc875('0xe'),_0x386e21,_0x4a5ca5);_0x2db092(_0x4a5ca5);});});}exports['GetCmHopper']=function(_0x3a22b4){var _0x54fc78=this;return new Promise(function(_0x3496a7,_0x2aed52){return db[_0xc875('0x12')][_0xc875('0x13')]({'raw':_0x3a22b4[_0xc875('0x14')]?_0x3a22b4[_0xc875('0x14')][_0xc875('0x15')]===undefined?!![]:![]:!![],'where':_0x3a22b4['options']?_0x3a22b4[_0xc875('0x14')][_0xc875('0x16')]||null:null,'attributes':_0x3a22b4['options']?_0x3a22b4[_0xc875('0x14')][_0xc875('0x17')]||null:null,'limit':_0x3a22b4[_0xc875('0x14')]?_0x3a22b4[_0xc875('0x14')][_0xc875('0x18')]||null:null,'include':_0x3a22b4[_0xc875('0x14')]?_0x3a22b4['options'][_0xc875('0x19')]?_['map'](_0x3a22b4[_0xc875('0x14')]['include'],function(_0x37e27c){return{'model':db[_0x37e27c[_0xc875('0x1a')]],'as':_0x37e27c['as'],'attributes':_0x37e27c['attributes'],'include':_0x37e27c[_0xc875('0x19')]?_[_0xc875('0x1b')](_0x37e27c[_0xc875('0x19')],function(_0x340323){return{'model':db[_0x340323[_0xc875('0x1a')]],'as':_0x340323['as'],'attributes':_0x340323['attributes'],'include':_0x340323[_0xc875('0x19')]?_[_0xc875('0x1b')](_0x340323['include'],function(_0x4355f4){return{'model':db[_0x4355f4[_0xc875('0x1a')]],'as':_0x4355f4['as'],'attributes':_0x4355f4[_0xc875('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc875('0x9')](function(_0x549cd9){logger[_0xc875('0x1c')](_0xc875('0x1d'),_0x3a22b4);logger['debug'](_0xc875('0x1d'),_0x3a22b4,JSON[_0xc875('0x1e')](_0x549cd9));_0x3496a7(_0x549cd9);})[_0xc875('0x11')](function(_0x38229b){logger[_0xc875('0xc')](_0xc875('0x1d'),_0x38229b[_0xc875('0xf')],_0x3a22b4);_0x2aed52(_0x54fc78[_0xc875('0xc')](0x1f4,_0x38229b[_0xc875('0xf')]));});});};exports['ShowCmHopper']=function(_0x5aacb2){var _0x94f483=this;return new Promise(function(_0x17bbdf,_0x4016e4){return db['CmHopper'][_0xc875('0x1f')]({'raw':_0x5aacb2[_0xc875('0x14')]?_0x5aacb2[_0xc875('0x14')][_0xc875('0x15')]===undefined?!![]:![]:!![],'where':_0x5aacb2[_0xc875('0x14')]?_0x5aacb2['options']['where']||null:null,'attributes':_0x5aacb2[_0xc875('0x14')]?_0x5aacb2[_0xc875('0x14')][_0xc875('0x17')]||null:null,'include':_0x5aacb2[_0xc875('0x14')]?_0x5aacb2[_0xc875('0x14')][_0xc875('0x19')]?_['map'](_0x5aacb2[_0xc875('0x14')][_0xc875('0x19')],function(_0x13b2a6){return{'model':db[_0x13b2a6[_0xc875('0x1a')]],'as':_0x13b2a6['as'],'attributes':_0x13b2a6[_0xc875('0x17')],'include':_0x13b2a6[_0xc875('0x19')]?_['map'](_0x13b2a6[_0xc875('0x19')],function(_0x1d8f7d){return{'model':db[_0x1d8f7d[_0xc875('0x1a')]],'as':_0x1d8f7d['as'],'attributes':_0x1d8f7d[_0xc875('0x17')],'include':_0x1d8f7d[_0xc875('0x19')]?_[_0xc875('0x1b')](_0x1d8f7d[_0xc875('0x19')],function(_0x398d00){return{'model':db[_0x398d00[_0xc875('0x1a')]],'as':_0x398d00['as'],'attributes':_0x398d00[_0xc875('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc875('0x9')](function(_0x4c582a){logger[_0xc875('0x1c')](_0xc875('0x20'),_0x5aacb2);logger['debug'](_0xc875('0x20'),_0x5aacb2,JSON[_0xc875('0x1e')](_0x4c582a));_0x17bbdf(_0x4c582a);})['catch'](function(_0x233e97){logger['error'](_0xc875('0x20'),_0x233e97[_0xc875('0xf')],_0x5aacb2);_0x4016e4(_0x94f483['error'](0x1f4,_0x233e97[_0xc875('0xf')]));});});};exports[_0xc875('0x21')]=function(_0x3cd809){var _0x4761d2=this;return new Promise(function(_0x3a603a,_0x30c1f2){return db[_0xc875('0x12')][_0xc875('0x22')](_0x3cd809[_0xc875('0x23')],{'raw':_0x3cd809['options']?_0x3cd809[_0xc875('0x14')][_0xc875('0x15')]===undefined?!![]:![]:!![]})[_0xc875('0x9')](function(_0x3d7ab9){logger['info'](_0xc875('0x21'),_0x3cd809);logger[_0xc875('0x24')](_0xc875('0x21'),_0x3cd809,JSON['stringify'](_0x3d7ab9));_0x3a603a(_0x3d7ab9);})[_0xc875('0x11')](function(_0x2252cc){logger['error'](_0xc875('0x21'),_0x2252cc[_0xc875('0xf')],_0x3cd809);_0x30c1f2(_0x4761d2[_0xc875('0xc')](0x1f4,_0x2252cc[_0xc875('0xf')]));});});};exports[_0xc875('0x25')]=function(_0x4d08aa){var _0x4de181=this;return new Promise(function(_0x4bc8b8,_0x3efb2f){return db[_0xc875('0x12')]['update'](_0x4d08aa[_0xc875('0x23')],{'raw':_0x4d08aa[_0xc875('0x14')]?_0x4d08aa['options'][_0xc875('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d08aa[_0xc875('0x14')]?_0x4d08aa[_0xc875('0x14')][_0xc875('0x16')]||null:null,'attributes':_0x4d08aa[_0xc875('0x14')]?_0x4d08aa[_0xc875('0x14')]['attributes']||null:null,'limit':_0x4d08aa[_0xc875('0x14')]?_0x4d08aa[_0xc875('0x14')][_0xc875('0x18')]||null:null})[_0xc875('0x9')](function(_0x27aa60){logger[_0xc875('0x1c')](_0xc875('0x25'),_0x4d08aa);logger[_0xc875('0x24')](_0xc875('0x25'),_0x4d08aa,JSON[_0xc875('0x1e')](_0x27aa60));_0x4bc8b8(_0x27aa60);})[_0xc875('0x11')](function(_0x394299){logger[_0xc875('0xc')]('UpdateCmHopper',_0x394299[_0xc875('0xf')],_0x4d08aa);_0x3efb2f(_0x4de181[_0xc875('0xc')](0x1f4,_0x394299[_0xc875('0xf')]));});});};exports[_0xc875('0x26')]=function(_0x10eaa7){var _0x44c775=this;return new Promise(function(_0x412570,_0x58d1ac){return db[_0xc875('0x12')][_0xc875('0x27')]({'where':_0x10eaa7[_0xc875('0x14')]?_0x10eaa7[_0xc875('0x14')]['where']||null:null})['then'](function(_0x461b02){logger[_0xc875('0x1c')](_0xc875('0x26'),_0x10eaa7);logger[_0xc875('0x24')](_0xc875('0x26'),_0x10eaa7,JSON['stringify'](_0x461b02));_0x412570(_0x461b02);})['catch'](function(_0x5ea5cb){logger[_0xc875('0xc')](_0xc875('0x26'),_0x5ea5cb[_0xc875('0xf')],_0x10eaa7);_0x58d1ac(_0x44c775[_0xc875('0xc')](0x1f4,_0x5ea5cb[_0xc875('0xf')]));});});};exports[_0xc875('0x28')]=function(_0x21869d){var _0xa02c09=this;return new Promise(function(_0xccd432,_0x1efa56){return db['CmContact'][_0xc875('0x29')]()[_0xc875('0x9')](function(_0x213812){return db[_0xc875('0x2a')][_0xc875('0x2b')](function(_0x494c95){return db[_0xc875('0x12')][_0xc875('0x13')]({'where':_0x21869d[_0xc875('0x14')]?_0x21869d[_0xc875('0x14')]['where']||null:null,'attributes':_0x21869d[_0xc875('0x14')]?_0x21869d[_0xc875('0x14')][_0xc875('0x17')]||null:null,'limit':_0x21869d['options']?_0x21869d[_0xc875('0x14')]['limit']||null:null,'order':_0x21869d[_0xc875('0x14')]?_0x21869d[_0xc875('0x14')][_0xc875('0x2c')]||null:null,'transaction':_0x494c95,'lock':_0x494c95['LOCK'][_0xc875('0x2d')],'include':[{'model':db[_0xc875('0x2e')],'as':_0xc875('0x2f'),'attributes':_[_0xc875('0x30')](_0x213812)}]})[_0xc875('0x9')](function(_0x1f8b49){var _0x42ba36=[];for(var _0x6ee8e4=0x0;_0x6ee8e4<_0x1f8b49['length'];_0x6ee8e4+=0x1){_0x42ba36[_0xc875('0x31')](_0x1f8b49[_0x6ee8e4]['update'](_0x21869d['body'],{'transaction':_0x494c95}));}return BPromise['all'](_0x42ba36);});})[_0xc875('0x9')](function(_0x1d3fa4){logger[_0xc875('0x1c')](_0xc875('0x28'),_0x21869d);logger['debug'](_0xc875('0x28'),_0x21869d,JSON[_0xc875('0x1e')](_0x1d3fa4));_0xccd432(_0x1d3fa4);})[_0xc875('0x11')](function(_0x3f642b){logger['error'](_0xc875('0x28'),_0x3f642b['message'],_0x21869d);_0x1efa56(_0xa02c09[_0xc875('0xc')](0x1f4,_0x3f642b[_0xc875('0xf')]));});});});};exports[_0xc875('0x32')]=function(_0x16bac6){var _0x3a67f8=this;return new Promise(function(_0x400a6b,_0xd97af9){return db[_0xc875('0x2a')][_0xc875('0x2b')](function(_0x43d518){return db[_0xc875('0x33')][_0xc875('0x22')](_0x16bac6[_0xc875('0x23')],{'raw':_0x16bac6[_0xc875('0x14')]?_0x16bac6[_0xc875('0x14')][_0xc875('0x15')]===undefined?!![]:![]:!![],'transaction':_0x43d518})[_0xc875('0x9')](function(){return db[_0xc875('0x12')][_0xc875('0x27')]({'where':_0x16bac6[_0xc875('0x14')]?_0x16bac6[_0xc875('0x14')][_0xc875('0x16')]||null:null,'transaction':_0x43d518});});})[_0xc875('0x9')](function(_0x2f47d5){logger['info']('MoveContactManagedDialer',_0x16bac6);logger[_0xc875('0x24')](_0xc875('0x32'),_0x16bac6,JSON[_0xc875('0x1e')](_0x2f47d5));_0x400a6b(_0x2f47d5);})[_0xc875('0x11')](function(_0x24d8d3){logger[_0xc875('0xc')](_0xc875('0x32'),_0x24d8d3['message'],_0x16bac6);_0xd97af9(_0x3a67f8[_0xc875('0xc')](0x1f4,_0x24d8d3[_0xc875('0xf')]));});});};exports['CountReScheduled']=function(_0x148dcd){var _0x3c06c2=this;return new Promise(function(_0x1a19f9,_0x36c520){return db[_0xc875('0x12')]['findAll']({'raw':_0x148dcd[_0xc875('0x14')]?_0x148dcd[_0xc875('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x148dcd[_0xc875('0x14')]?_0x148dcd[_0xc875('0x14')][_0xc875('0x16')]||null:null,'attributes':[[db[_0xc875('0x2a')]['fn'](_0xc875('0x34'),db[_0xc875('0x2a')]['fn']('IF',db['sequelize']['literal']('`scheduledat`\x20>=\x20'+util[_0xc875('0x35')]('\x22%s\x22',moment()[_0xc875('0x35')](_0xc875('0x36')))+_0xc875('0x37')))),_0xc875('0x38')]]})[_0xc875('0x9')](function(_0x405d5a){logger[_0xc875('0x1c')](_0xc875('0x39'),_0x148dcd);logger[_0xc875('0x24')](_0xc875('0x39'),_0x148dcd,JSON['stringify'](_0x405d5a));_0x1a19f9(_0x405d5a);})[_0xc875('0x11')](function(_0x1824ab){logger[_0xc875('0xc')]('CountReScheduled',_0x1824ab['message'],_0x148dcd);_0x36c520(_0x3c06c2['error'](0x1f4,_0x1824ab['message']));});});};exports[_0xc875('0x3a')]=function(_0x2bfe3b){var _0x2b4f56=this;return new Promise(function(_0xb5dcfa,_0x3b69c6){return db['CmContact']['describe']()['then'](function(_0x2e7386){return db[_0xc875('0x2a')]['transaction'](function(_0x5379e7){return db['CmHopper'][_0xc875('0x13')]({'where':_0x2bfe3b['options']?_0x2bfe3b[_0xc875('0x14')]['where']||null:null,'attributes':_0x2bfe3b['options']?_0x2bfe3b['options'][_0xc875('0x17')]||null:null,'limit':0x1,'order':_0x2bfe3b[_0xc875('0x14')]?_0x2bfe3b[_0xc875('0x14')][_0xc875('0x2c')]||null:null,'group':db[_0xc875('0x12')][_0xc875('0x3b')],'transaction':_0x5379e7,'lock':_0x5379e7[_0xc875('0x3c')][_0xc875('0x2d')],'include':_0x2bfe3b['options']?_0x2bfe3b[_0xc875('0x14')][_0xc875('0x19')]?_[_0xc875('0x1b')](_0x2bfe3b[_0xc875('0x14')]['include'],function(_0x2b6c59){return{'model':db[_0x2b6c59['model']],'as':_0x2b6c59['as'],'attributes':_0x2b6c59[_0xc875('0x17')],'include':_0x2b6c59[_0xc875('0x19')]?_[_0xc875('0x1b')](_0x2b6c59[_0xc875('0x19')],function(_0x44ebb3){return{'model':db[_0x44ebb3[_0xc875('0x1a')]],'as':_0x44ebb3['as'],'attributes':_0x44ebb3[_0xc875('0x17')],'include':_0x44ebb3[_0xc875('0x19')]?_[_0xc875('0x1b')](_0x44ebb3[_0xc875('0x19')],function(_0x55e7ee){return{'model':db[_0x55e7ee[_0xc875('0x1a')]],'as':_0x55e7ee['as'],'attributes':_0x55e7ee[_0xc875('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x411c9a){var _0x2e6855=[];for(var _0x41c213=0x0;_0x41c213<_0x411c9a['length'];_0x41c213+=0x1){_0x2e6855['push'](_0x411c9a[_0x41c213][_0xc875('0x3d')](_0x2bfe3b[_0xc875('0x23')],{'transaction':_0x5379e7}));}return BPromise[_0xc875('0x3e')](_0x2e6855);});})['then'](function(_0x5b0351){logger['info']('GetContactRecallMe',_0x2bfe3b);logger['debug'](_0xc875('0x3a'),_0x2bfe3b,JSON[_0xc875('0x1e')](_0x5b0351));_0xb5dcfa(_0x5b0351);})['catch'](function(_0x143638){logger[_0xc875('0xc')]('GetContactRecallMe',_0x143638[_0xc875('0xf')],_0x2bfe3b);_0x3b69c6(_0x2b4f56[_0xc875('0xc')](0x1f4,_0x143638[_0xc875('0xf')]));});});});};
\ No newline at end of file
+var _0xecb3=['length','push','all','MoveContactManagedDialer','CountReScheduled','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','UserId','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopper,\x20%s,\x20%s','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','ShowCmHopper','CreateCmHopper','create','body','UpdateCmHopper','update','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','transaction','order','LOCK','UPDATE','CmContact','keys'];(function(_0x4ae709,_0x5583b4){var _0x21b66d=function(_0x719d65){while(--_0x719d65){_0x4ae709['push'](_0x4ae709['shift']());}};_0x21b66d(++_0x5583b4);}(_0xecb3,0x83));var _0x3ecb=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xecb3[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x3ecb('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3ecb('0x1'));var db=require(_0x3ecb('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x3ecb('0x3'))(_0x3ecb('0x4'));var config=require(_0x3ecb('0x5'));var jayson=require(_0x3ecb('0x6'));var client=jayson[_0x3ecb('0x7')][_0x3ecb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e503a,_0x3fb0be,_0x5c468d){return new BPromise(function(_0x1834fb,_0xeac6ce){return client[_0x3ecb('0x9')](_0x1e503a,_0x5c468d)[_0x3ecb('0xa')](function(_0x560fac){logger[_0x3ecb('0xb')]('CmHopper,\x20%s,\x20%s',_0x3fb0be,_0x3ecb('0xc'));logger[_0x3ecb('0xd')](_0x3ecb('0xe'),_0x3fb0be,_0x3ecb('0xc'),JSON[_0x3ecb('0xf')](_0x560fac));if(_0x560fac['error']){if(_0x560fac[_0x3ecb('0x10')][_0x3ecb('0x11')]===0x1f4){logger[_0x3ecb('0x10')]('CmHopper,\x20%s,\x20%s',_0x3fb0be,_0x560fac[_0x3ecb('0x10')][_0x3ecb('0x12')]);return _0xeac6ce(_0x560fac[_0x3ecb('0x10')][_0x3ecb('0x12')]);}logger[_0x3ecb('0x10')](_0x3ecb('0x13'),_0x3fb0be,_0x560fac['error'][_0x3ecb('0x12')]);return _0x1834fb(_0x560fac['error'][_0x3ecb('0x12')]);}else{logger[_0x3ecb('0xb')](_0x3ecb('0x13'),_0x3fb0be,_0x3ecb('0xc'));_0x1834fb(_0x560fac['result'][_0x3ecb('0x12')]);}})[_0x3ecb('0x14')](function(_0x187316){logger[_0x3ecb('0x10')]('CmHopper,\x20%s,\x20%s',_0x3fb0be,_0x187316);_0xeac6ce(_0x187316);});});}exports[_0x3ecb('0x15')]=function(_0x20c643){var _0x552203=this;return new Promise(function(_0xc0fd1f,_0x4c1baf){return db[_0x3ecb('0x16')][_0x3ecb('0x17')]({'raw':_0x20c643[_0x3ecb('0x18')]?_0x20c643[_0x3ecb('0x18')][_0x3ecb('0x19')]===undefined?!![]:![]:!![],'where':_0x20c643[_0x3ecb('0x18')]?_0x20c643['options'][_0x3ecb('0x1a')]||null:null,'attributes':_0x20c643[_0x3ecb('0x18')]?_0x20c643[_0x3ecb('0x18')][_0x3ecb('0x1b')]||null:null,'limit':_0x20c643['options']?_0x20c643[_0x3ecb('0x18')][_0x3ecb('0x1c')]||null:null,'include':_0x20c643[_0x3ecb('0x18')]?_0x20c643[_0x3ecb('0x18')][_0x3ecb('0x1d')]?_[_0x3ecb('0x1e')](_0x20c643['options'][_0x3ecb('0x1d')],function(_0x43b5a3){return{'model':db[_0x43b5a3['model']],'as':_0x43b5a3['as'],'attributes':_0x43b5a3['attributes'],'include':_0x43b5a3[_0x3ecb('0x1d')]?_[_0x3ecb('0x1e')](_0x43b5a3['include'],function(_0x1cc247){return{'model':db[_0x1cc247[_0x3ecb('0x1f')]],'as':_0x1cc247['as'],'attributes':_0x1cc247[_0x3ecb('0x1b')],'include':_0x1cc247[_0x3ecb('0x1d')]?_['map'](_0x1cc247[_0x3ecb('0x1d')],function(_0x1a7995){return{'model':db[_0x1a7995[_0x3ecb('0x1f')]],'as':_0x1a7995['as'],'attributes':_0x1a7995[_0x3ecb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3ecb('0xa')](function(_0x23c71a){logger[_0x3ecb('0xb')](_0x3ecb('0x15'),_0x20c643);logger[_0x3ecb('0xd')]('GetCmHopper',_0x20c643,JSON[_0x3ecb('0xf')](_0x23c71a));_0xc0fd1f(_0x23c71a);})[_0x3ecb('0x14')](function(_0x533f11){logger[_0x3ecb('0x10')](_0x3ecb('0x15'),_0x533f11[_0x3ecb('0x12')],_0x20c643);_0x4c1baf(_0x552203[_0x3ecb('0x10')](0x1f4,_0x533f11[_0x3ecb('0x12')]));});});};exports[_0x3ecb('0x20')]=function(_0x5c8609){var _0x565165=this;return new Promise(function(_0x36dbdb,_0x101cbf){return db[_0x3ecb('0x16')]['find']({'raw':_0x5c8609[_0x3ecb('0x18')]?_0x5c8609[_0x3ecb('0x18')][_0x3ecb('0x19')]===undefined?!![]:![]:!![],'where':_0x5c8609['options']?_0x5c8609['options'][_0x3ecb('0x1a')]||null:null,'attributes':_0x5c8609[_0x3ecb('0x18')]?_0x5c8609['options']['attributes']||null:null,'include':_0x5c8609[_0x3ecb('0x18')]?_0x5c8609['options'][_0x3ecb('0x1d')]?_['map'](_0x5c8609[_0x3ecb('0x18')][_0x3ecb('0x1d')],function(_0x414719){return{'model':db[_0x414719[_0x3ecb('0x1f')]],'as':_0x414719['as'],'attributes':_0x414719[_0x3ecb('0x1b')],'include':_0x414719[_0x3ecb('0x1d')]?_['map'](_0x414719['include'],function(_0x42f74c){return{'model':db[_0x42f74c[_0x3ecb('0x1f')]],'as':_0x42f74c['as'],'attributes':_0x42f74c[_0x3ecb('0x1b')],'include':_0x42f74c[_0x3ecb('0x1d')]?_[_0x3ecb('0x1e')](_0x42f74c['include'],function(_0x5e5ea6){return{'model':db[_0x5e5ea6[_0x3ecb('0x1f')]],'as':_0x5e5ea6['as'],'attributes':_0x5e5ea6[_0x3ecb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3ecb('0xa')](function(_0x14ac2c){logger[_0x3ecb('0xb')](_0x3ecb('0x20'),_0x5c8609);logger['debug'](_0x3ecb('0x20'),_0x5c8609,JSON[_0x3ecb('0xf')](_0x14ac2c));_0x36dbdb(_0x14ac2c);})['catch'](function(_0x2a1c89){logger['error'](_0x3ecb('0x20'),_0x2a1c89[_0x3ecb('0x12')],_0x5c8609);_0x101cbf(_0x565165['error'](0x1f4,_0x2a1c89[_0x3ecb('0x12')]));});});};exports[_0x3ecb('0x21')]=function(_0x4829be){var _0x3a0d6d=this;return new Promise(function(_0x23964c,_0x455bab){return db[_0x3ecb('0x16')][_0x3ecb('0x22')](_0x4829be[_0x3ecb('0x23')],{'raw':_0x4829be[_0x3ecb('0x18')]?_0x4829be[_0x3ecb('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x3ecb('0xa')](function(_0x1bf0d9){logger[_0x3ecb('0xb')](_0x3ecb('0x21'),_0x4829be);logger['debug'](_0x3ecb('0x21'),_0x4829be,JSON[_0x3ecb('0xf')](_0x1bf0d9));_0x23964c(_0x1bf0d9);})[_0x3ecb('0x14')](function(_0x2c1b31){logger[_0x3ecb('0x10')](_0x3ecb('0x21'),_0x2c1b31['message'],_0x4829be);_0x455bab(_0x3a0d6d[_0x3ecb('0x10')](0x1f4,_0x2c1b31[_0x3ecb('0x12')]));});});};exports[_0x3ecb('0x24')]=function(_0x277210){var _0x2eaebb=this;return new Promise(function(_0x1f40af,_0x19c2a7){return db[_0x3ecb('0x16')][_0x3ecb('0x25')](_0x277210[_0x3ecb('0x23')],{'raw':_0x277210[_0x3ecb('0x18')]?_0x277210[_0x3ecb('0x18')][_0x3ecb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x277210[_0x3ecb('0x18')]?_0x277210[_0x3ecb('0x18')][_0x3ecb('0x1a')]||null:null,'attributes':_0x277210[_0x3ecb('0x18')]?_0x277210[_0x3ecb('0x18')][_0x3ecb('0x1b')]||null:null,'limit':_0x277210[_0x3ecb('0x18')]?_0x277210['options'][_0x3ecb('0x1c')]||null:null})[_0x3ecb('0xa')](function(_0x570020){logger[_0x3ecb('0xb')]('UpdateCmHopper',_0x277210);logger['debug']('UpdateCmHopper',_0x277210,JSON[_0x3ecb('0xf')](_0x570020));_0x1f40af(_0x570020);})['catch'](function(_0x53af4e){logger['error']('UpdateCmHopper',_0x53af4e[_0x3ecb('0x12')],_0x277210);_0x19c2a7(_0x2eaebb[_0x3ecb('0x10')](0x1f4,_0x53af4e['message']));});});};exports[_0x3ecb('0x26')]=function(_0xc0fb0a){var _0x42918f=this;return new Promise(function(_0x4f5b15,_0x49b253){return db[_0x3ecb('0x16')][_0x3ecb('0x27')]({'where':_0xc0fb0a[_0x3ecb('0x18')]?_0xc0fb0a[_0x3ecb('0x18')][_0x3ecb('0x1a')]||null:null})[_0x3ecb('0xa')](function(_0x281790){logger['info']('DestroyCmHopper',_0xc0fb0a);logger[_0x3ecb('0xd')](_0x3ecb('0x26'),_0xc0fb0a,JSON['stringify'](_0x281790));_0x4f5b15(_0x281790);})[_0x3ecb('0x14')](function(_0x19a7c6){logger[_0x3ecb('0x10')](_0x3ecb('0x26'),_0x19a7c6['message'],_0xc0fb0a);_0x49b253(_0x42918f[_0x3ecb('0x10')](0x1f4,_0x19a7c6[_0x3ecb('0x12')]));});});};exports[_0x3ecb('0x28')]=function(_0x41794d){var _0x4d8bae=this;return new Promise(function(_0x39ddef,_0x3b4d4c){return db['CmContact'][_0x3ecb('0x29')]()['then'](function(_0x3dee8c){return db[_0x3ecb('0x2a')][_0x3ecb('0x2b')](function(_0x4ae582){return db[_0x3ecb('0x16')][_0x3ecb('0x17')]({'where':_0x41794d[_0x3ecb('0x18')]?_0x41794d[_0x3ecb('0x18')][_0x3ecb('0x1a')]||null:null,'attributes':_0x41794d['options']?_0x41794d['options']['attributes']||null:null,'limit':_0x41794d[_0x3ecb('0x18')]?_0x41794d[_0x3ecb('0x18')][_0x3ecb('0x1c')]||null:null,'order':_0x41794d[_0x3ecb('0x18')]?_0x41794d[_0x3ecb('0x18')][_0x3ecb('0x2c')]||null:null,'transaction':_0x4ae582,'lock':_0x4ae582[_0x3ecb('0x2d')][_0x3ecb('0x2e')],'include':[{'model':db[_0x3ecb('0x2f')],'as':'Contact','attributes':_[_0x3ecb('0x30')](_0x3dee8c)}]})[_0x3ecb('0xa')](function(_0x5742cb){var _0x4ee6ab=[];for(var _0x596206=0x0;_0x596206<_0x5742cb[_0x3ecb('0x31')];_0x596206+=0x1){_0x4ee6ab[_0x3ecb('0x32')](_0x5742cb[_0x596206]['update'](_0x41794d['body'],{'transaction':_0x4ae582}));}return BPromise[_0x3ecb('0x33')](_0x4ee6ab);});})[_0x3ecb('0xa')](function(_0x370e60){logger[_0x3ecb('0xb')](_0x3ecb('0x28'),_0x41794d);logger['debug']('GetContactDialer',_0x41794d,JSON[_0x3ecb('0xf')](_0x370e60));_0x39ddef(_0x370e60);})['catch'](function(_0x36f184){logger[_0x3ecb('0x10')]('GetContactDialer',_0x36f184[_0x3ecb('0x12')],_0x41794d);_0x3b4d4c(_0x4d8bae[_0x3ecb('0x10')](0x1f4,_0x36f184[_0x3ecb('0x12')]));});});});};exports[_0x3ecb('0x34')]=function(_0x3df97f){var _0x5cd682=this;return new Promise(function(_0x2fd05,_0xb4a1af){return db[_0x3ecb('0x2a')]['transaction'](function(_0x40b33e){return db['CmHopperFinal'][_0x3ecb('0x22')](_0x3df97f['body'],{'raw':_0x3df97f[_0x3ecb('0x18')]?_0x3df97f[_0x3ecb('0x18')][_0x3ecb('0x19')]===undefined?!![]:![]:!![],'transaction':_0x40b33e})[_0x3ecb('0xa')](function(){return db[_0x3ecb('0x16')]['destroy']({'where':_0x3df97f['options']?_0x3df97f['options'][_0x3ecb('0x1a')]||null:null,'transaction':_0x40b33e});});})['then'](function(_0x9658ec){logger[_0x3ecb('0xb')]('MoveContactManagedDialer',_0x3df97f);logger[_0x3ecb('0xd')]('MoveContactManagedDialer',_0x3df97f,JSON['stringify'](_0x9658ec));_0x2fd05(_0x9658ec);})['catch'](function(_0x17049a){logger[_0x3ecb('0x10')](_0x3ecb('0x34'),_0x17049a[_0x3ecb('0x12')],_0x3df97f);_0xb4a1af(_0x5cd682[_0x3ecb('0x10')](0x1f4,_0x17049a['message']));});});};exports[_0x3ecb('0x35')]=function(_0x3fb0f6){var _0x4b5f66=this;return new Promise(function(_0x1bff4c,_0x44c5d4){return db[_0x3ecb('0x16')]['findAll']({'raw':_0x3fb0f6[_0x3ecb('0x18')]?_0x3fb0f6[_0x3ecb('0x18')][_0x3ecb('0x19')]===undefined?!![]:![]:!![],'where':_0x3fb0f6[_0x3ecb('0x18')]?_0x3fb0f6[_0x3ecb('0x18')][_0x3ecb('0x1a')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x3ecb('0x2a')]['fn']('IF',db['sequelize']['literal']('`scheduledat`\x20>=\x20'+util[_0x3ecb('0x36')](_0x3ecb('0x37'),moment()['format'](_0x3ecb('0x38')))+'\x20,\x201,\x20null'))),_0x3ecb('0x39')]]})['then'](function(_0x23ed56){logger[_0x3ecb('0xb')](_0x3ecb('0x35'),_0x3fb0f6);logger[_0x3ecb('0xd')](_0x3ecb('0x35'),_0x3fb0f6,JSON[_0x3ecb('0xf')](_0x23ed56));_0x1bff4c(_0x23ed56);})['catch'](function(_0x41edc0){logger[_0x3ecb('0x10')]('CountReScheduled',_0x41edc0[_0x3ecb('0x12')],_0x3fb0f6);_0x44c5d4(_0x4b5f66['error'](0x1f4,_0x41edc0[_0x3ecb('0x12')]));});});};exports[_0x3ecb('0x3a')]=function(_0x3cb1cd){var _0x2bc4da=this;return new Promise(function(_0x2ecb9f,_0x4d6e3a){return db[_0x3ecb('0x2f')][_0x3ecb('0x29')]()['then'](function(_0x2b304c){return db[_0x3ecb('0x2a')][_0x3ecb('0x2b')](function(_0x1f3733){return db[_0x3ecb('0x16')][_0x3ecb('0x17')]({'where':_0x3cb1cd[_0x3ecb('0x18')]?_0x3cb1cd['options'][_0x3ecb('0x1a')]||null:null,'attributes':_0x3cb1cd[_0x3ecb('0x18')]?_0x3cb1cd['options']['attributes']||null:null,'limit':0x1,'order':_0x3cb1cd[_0x3ecb('0x18')]?_0x3cb1cd[_0x3ecb('0x18')][_0x3ecb('0x2c')]||null:null,'group':db['CmHopper'][_0x3ecb('0x3b')],'transaction':_0x1f3733,'lock':_0x1f3733[_0x3ecb('0x2d')][_0x3ecb('0x2e')],'include':_0x3cb1cd[_0x3ecb('0x18')]?_0x3cb1cd[_0x3ecb('0x18')][_0x3ecb('0x1d')]?_[_0x3ecb('0x1e')](_0x3cb1cd[_0x3ecb('0x18')][_0x3ecb('0x1d')],function(_0x1f9ad0){return{'model':db[_0x1f9ad0[_0x3ecb('0x1f')]],'as':_0x1f9ad0['as'],'attributes':_0x1f9ad0['attributes'],'include':_0x1f9ad0[_0x3ecb('0x1d')]?_[_0x3ecb('0x1e')](_0x1f9ad0[_0x3ecb('0x1d')],function(_0x2c8a55){return{'model':db[_0x2c8a55[_0x3ecb('0x1f')]],'as':_0x2c8a55['as'],'attributes':_0x2c8a55[_0x3ecb('0x1b')],'include':_0x2c8a55[_0x3ecb('0x1d')]?_[_0x3ecb('0x1e')](_0x2c8a55[_0x3ecb('0x1d')],function(_0x4e0bf3){return{'model':db[_0x4e0bf3[_0x3ecb('0x1f')]],'as':_0x4e0bf3['as'],'attributes':_0x4e0bf3[_0x3ecb('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x208c9a){var _0x5d7eb3=[];for(var _0x302a0b=0x0;_0x302a0b<_0x208c9a[_0x3ecb('0x31')];_0x302a0b+=0x1){_0x5d7eb3[_0x3ecb('0x32')](_0x208c9a[_0x302a0b]['update'](_0x3cb1cd[_0x3ecb('0x23')],{'transaction':_0x1f3733}));}return BPromise[_0x3ecb('0x33')](_0x5d7eb3);});})[_0x3ecb('0xa')](function(_0xaa9ed9){logger[_0x3ecb('0xb')](_0x3ecb('0x3a'),_0x3cb1cd);logger[_0x3ecb('0xd')]('GetContactRecallMe',_0x3cb1cd,JSON[_0x3ecb('0xf')](_0xaa9ed9));_0x2ecb9f(_0xaa9ed9);})[_0x3ecb('0x14')](function(_0x4fd6a0){logger[_0x3ecb('0x10')](_0x3ecb('0x3a'),_0x4fd6a0[_0x3ecb('0x12')],_0x3cb1cd);_0x4d6e3a(_0x2bc4da[_0x3ecb('0x10')](0x1f4,_0x4fd6a0[_0x3ecb('0x12')]));});});});};
\ No newline at end of file
index 3066aba..5d68853 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['/:id','show','post','/preview','getPreview','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/opencontacts','getOpenContacts'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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 auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./cmHopper.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['describe']);router[_0x7995('0x8')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x8')](_0x7995('0xe'),auth[_0x7995('0x9')](),controller[_0x7995('0xf')]);router[_0x7995('0x10')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0x10')](_0x7995('0x11'),auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x13')](_0x7995('0xe'),auth[_0x7995('0x9')](),controller[_0x7995('0x14')]);router[_0x7995('0x15')](_0x7995('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x16')]=router;
\ No newline at end of file
+var _0x9957=['/:id','show','post','/preview','getPreview','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/opencontacts','getOpenContacts'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_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 auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./cmHopper.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['describe']);router[_0x7995('0x8')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x8')](_0x7995('0xe'),auth[_0x7995('0x9')](),controller[_0x7995('0xf')]);router[_0x7995('0x10')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0x10')](_0x7995('0x11'),auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x13')](_0x7995('0xe'),auth[_0x7995('0x9')](),controller[_0x7995('0x14')]);router[_0x7995('0x15')](_0x7995('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x16')]=router;
\ No newline at end of file
index 0efb469..0d0ff93 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc6d5=['STRING','INTEGER','contactListQueue','moment','sequelize','exports'];(function(_0x4b9806,_0x1517c0){var _0x12f4d4=function(_0x2f0984){while(--_0x2f0984){_0x4b9806['push'](_0x4b9806['shift']());}};_0x12f4d4(++_0x1517c0);}(_0xc6d5,0x1ef));var _0x5c6d=function(_0xc756f0,_0x4531eb){_0xc756f0=_0xc756f0-0x0;var _0x136098=_0xc6d5[_0xc756f0];return _0x136098;};'use strict';var moment=require(_0x5c6d('0x0'));var Sequelize=require(_0x5c6d('0x1'));module[_0x5c6d('0x2')]={'phone':{'type':Sequelize[_0x5c6d('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x5c6d('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x5c6d('0x4')],'unique':_0x5c6d('0x5')},'VoiceQueueId':{'type':Sequelize[_0x5c6d('0x4')],'unique':_0x5c6d('0x5')}};
\ No newline at end of file
+var _0xfe48=['STRING','INTEGER','contactListQueue','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfe48,0xdf));var _0x8fe4=function(_0x167160,_0x11b5e8){_0x167160=_0x167160-0x0;var _0x102be7=_0xfe48[_0x167160];return _0x102be7;};'use strict';var moment=require(_0x8fe4('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0x8fe4('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x8fe4('0x2')],'unique':_0x8fe4('0x3')}};
\ No newline at end of file
index 067f588..2eef713 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x16ea=['Content-Range','reject','save','update','destroy','end','error','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','limit','sort','where','filter','map','type','key','VIRTUAL','field','merge','options','CmHopperBlack','then','includeAll','include','rows','params','fields','length','find','catch','body','describe','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set'];(function(_0x8ce0d,_0x45b743){var _0x4627d=function(_0x423c80){while(--_0x423c80){_0x8ce0d['push'](_0x8ce0d['shift']());}};_0x4627d(++_0x45b743);}(_0x16ea,0x70));var _0xa16e=function(_0x35190c,_0x10cc60){_0x35190c=_0x35190c-0x0;var _0x46b857=_0x16ea[_0x35190c];return _0x46b857;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa16e('0x0'));var zipdir=require(_0xa16e('0x1'));var jsonpatch=require(_0xa16e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa16e('0x3'));var Mustache=require(_0xa16e('0x4'));var util=require(_0xa16e('0x5'));var path=require(_0xa16e('0x6'));var sox=require('sox');var csv=require(_0xa16e('0x7'));var ejs=require(_0xa16e('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa16e('0x9'));var crypto=require(_0xa16e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa16e('0xb'));var toCsv=require(_0xa16e('0x7'));var querystring=require(_0xa16e('0xc'));var Papa=require('papaparse');var authService=require(_0xa16e('0xd'));var hardwareService=require(_0xa16e('0xe'));var Redis=require('ioredis');var qs=require(_0xa16e('0xf'));var logger=require('../../config/logger')(_0xa16e('0x10'));var utils=require(_0xa16e('0x11'));var config=require(_0xa16e('0x12'));var db=require(_0xa16e('0x13'))['db'];function respondWithStatusCode(_0x582b2a,_0x3869d2){_0x3869d2=_0x3869d2||0xcc;return function(_0x5c7788){if(_0x5c7788){return _0x582b2a[_0xa16e('0x14')](_0x3869d2);}return _0x582b2a[_0xa16e('0x15')](_0x3869d2)['end']();};}function respondWithResult(_0x551ec9,_0x3d6107){_0x3d6107=_0x3d6107||0xc8;return function(_0xd9f9eb){if(_0xd9f9eb){return _0x551ec9[_0xa16e('0x15')](_0x3d6107)[_0xa16e('0x16')](_0xd9f9eb);}};}function respondWithFilteredResult(_0x40a555,_0x5049b3){return function(_0x672b9c){if(_0x672b9c){var _0x339034=_0x672b9c[_0xa16e('0x17')],_0x32d862=_0x5049b3[_0xa16e('0x18')],_0x544ae1=_0x5049b3['offset']+_0x5049b3['limit'],_0x58a01a;if(_0x544ae1>=_0x339034){_0x544ae1=_0x339034;_0x58a01a=0xc8;}else{_0x58a01a=0xce;}_0x40a555['status'](_0x58a01a);return _0x40a555[_0xa16e('0x19')](_0xa16e('0x1a'),_0x32d862+'-'+_0x544ae1+'/'+_0x339034)[_0xa16e('0x16')](_0x672b9c);}return null;};}function patchUpdates(_0x1a8a22){return function(_0x29dab6){try{jsonpatch['apply'](_0x29dab6,_0x1a8a22,!![]);}catch(_0x9aa5fe){return BPromise[_0xa16e('0x1b')](_0x9aa5fe);}return _0x29dab6[_0xa16e('0x1c')]();};}function saveUpdates(_0x2c6442,_0x2cb46a){return function(_0x362414){if(_0x362414){return _0x362414[_0xa16e('0x1d')](_0x2c6442)['then'](function(_0x2b28bb){return _0x2b28bb;});}return null;};}function removeEntity(_0x571006,_0x2d9d07){return function(_0x185be1){if(_0x185be1){return _0x185be1[_0xa16e('0x1e')]()['then'](function(){_0x571006[_0xa16e('0x15')](0xcc)[_0xa16e('0x1f')]();});}};}function handleEntityNotFound(_0x305de6,_0x832521){return function(_0x263560){if(!_0x263560){_0x305de6['sendStatus'](0x194);}return _0x263560;};}function handleError(_0x3d06e8,_0x47e8a8){_0x47e8a8=_0x47e8a8||0x1f4;return function(_0x1fbf14){logger[_0xa16e('0x20')](_0x1fbf14[_0xa16e('0x21')]);if(_0x1fbf14[_0xa16e('0x22')]){delete _0x1fbf14[_0xa16e('0x22')];}_0x3d06e8['status'](_0x47e8a8)[_0xa16e('0x23')](_0x1fbf14);};}exports[_0xa16e('0x24')]=function(_0x10bc67,_0x3d617d){var _0x332c90={},_0x529470={},_0x43e3e9={'count':0x0,'rows':[]};var _0x1c0492=db['CmHopperBlack'][_0xa16e('0x25')];_0x529470[_0xa16e('0x26')]=_['keys'](_0x1c0492);_0x529470['query']=_[_0xa16e('0x27')](_0x10bc67[_0xa16e('0x28')]);_0x529470[_0xa16e('0x29')]=_[_0xa16e('0x2a')](_0x529470[_0xa16e('0x26')],_0x529470[_0xa16e('0x28')]);_0x332c90[_0xa16e('0x2b')]=_[_0xa16e('0x2a')](_0x529470[_0xa16e('0x26')],qs['fields'](_0x10bc67[_0xa16e('0x28')]['fields']));_0x332c90[_0xa16e('0x2b')]=_0x332c90[_0xa16e('0x2b')]['length']?_0x332c90[_0xa16e('0x2b')]:_0x529470[_0xa16e('0x26')];if(!_0x10bc67['query'][_0xa16e('0x2c')](_0xa16e('0x2d'))){_0x332c90[_0xa16e('0x2e')]=qs['limit'](_0x10bc67[_0xa16e('0x28')][_0xa16e('0x2e')]);_0x332c90[_0xa16e('0x18')]=qs[_0xa16e('0x18')](_0x10bc67[_0xa16e('0x28')]['offset']);}_0x332c90['order']=qs[_0xa16e('0x2f')](_0x10bc67[_0xa16e('0x28')][_0xa16e('0x2f')]);_0x332c90[_0xa16e('0x30')]=qs[_0xa16e('0x29')](_['pick'](_0x10bc67[_0xa16e('0x28')],_0x529470[_0xa16e('0x29')]));if(_0x10bc67[_0xa16e('0x28')][_0xa16e('0x31')]){_0x332c90[_0xa16e('0x30')]=_['merge'](_0x332c90[_0xa16e('0x30')],{'$or':_[_0xa16e('0x32')](_0x1c0492,function(_0x4602b7){if(_0x4602b7[_0xa16e('0x33')][_0xa16e('0x34')]!==_0xa16e('0x35')){var _0x67eebd={};_0x67eebd[_0x4602b7[_0xa16e('0x36')]]={'$like':'%'+_0x10bc67[_0xa16e('0x28')][_0xa16e('0x31')]+'%'};return _0x67eebd;}})});}_0x332c90=_[_0xa16e('0x37')]({},_0x332c90,_0x10bc67[_0xa16e('0x38')]);var _0x26bdbd={'where':_0x332c90[_0xa16e('0x30')]};return db[_0xa16e('0x39')][_0xa16e('0x17')](_0x26bdbd)[_0xa16e('0x3a')](function(_0x4fd1bf){_0x43e3e9[_0xa16e('0x17')]=_0x4fd1bf;if(_0x10bc67['query'][_0xa16e('0x3b')]){_0x332c90[_0xa16e('0x3c')]=[{'all':!![]}];}return db[_0xa16e('0x39')]['findAll'](_0x332c90);})['then'](function(_0x4bbdbc){_0x43e3e9[_0xa16e('0x3d')]=_0x4bbdbc;return _0x43e3e9;})['then'](respondWithFilteredResult(_0x3d617d,_0x332c90))['catch'](handleError(_0x3d617d,null));};exports['show']=function(_0x334cb3,_0x551b04){var _0x45bc9f={'raw':!![],'where':{'id':_0x334cb3[_0xa16e('0x3e')]['id']}},_0x18ae56={};_0x18ae56[_0xa16e('0x26')]=_['keys'](db[_0xa16e('0x39')][_0xa16e('0x25')]);_0x18ae56[_0xa16e('0x28')]=_[_0xa16e('0x27')](_0x334cb3['query']);_0x18ae56[_0xa16e('0x29')]=_[_0xa16e('0x2a')](_0x18ae56['model'],_0x18ae56[_0xa16e('0x28')]);_0x45bc9f[_0xa16e('0x2b')]=_[_0xa16e('0x2a')](_0x18ae56[_0xa16e('0x26')],qs['fields'](_0x334cb3[_0xa16e('0x28')][_0xa16e('0x3f')]));_0x45bc9f[_0xa16e('0x2b')]=_0x45bc9f['attributes'][_0xa16e('0x40')]?_0x45bc9f[_0xa16e('0x2b')]:_0x18ae56[_0xa16e('0x26')];if(_0x334cb3[_0xa16e('0x28')][_0xa16e('0x3b')]){_0x45bc9f['include']=[{'all':!![]}];}_0x45bc9f=_[_0xa16e('0x37')]({},_0x45bc9f,_0x334cb3[_0xa16e('0x38')]);return db['CmHopperBlack'][_0xa16e('0x41')](_0x45bc9f)[_0xa16e('0x3a')](handleEntityNotFound(_0x551b04,null))[_0xa16e('0x3a')](respondWithResult(_0x551b04,null))[_0xa16e('0x42')](handleError(_0x551b04,null));};exports['update']=function(_0x1727e9,_0x1c78a2){if(_0x1727e9[_0xa16e('0x43')]['id']){delete _0x1727e9[_0xa16e('0x43')]['id'];}return db['CmHopperBlack'][_0xa16e('0x41')]({'where':{'id':_0x1727e9[_0xa16e('0x3e')]['id']}})[_0xa16e('0x3a')](handleEntityNotFound(_0x1c78a2,null))[_0xa16e('0x3a')](saveUpdates(_0x1727e9[_0xa16e('0x43')],null))[_0xa16e('0x3a')](respondWithResult(_0x1c78a2,null))[_0xa16e('0x42')](handleError(_0x1c78a2,null));};exports[_0xa16e('0x1e')]=function(_0x525e65,_0x29ead1){return db['CmHopperBlack'][_0xa16e('0x41')]({'where':{'id':_0x525e65['params']['id']}})['then'](handleEntityNotFound(_0x29ead1,null))[_0xa16e('0x3a')](removeEntity(_0x29ead1,null))[_0xa16e('0x42')](handleError(_0x29ead1,null));};exports[_0xa16e('0x44')]=function(_0x46abad,_0x5a1083){return db['CmHopperBlack'][_0xa16e('0x44')]()[_0xa16e('0x3a')](respondWithResult(_0x5a1083,null))['catch'](handleError(_0x5a1083,null));};
\ No newline at end of file
+var _0xb2be=['offset','limit','set','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','CmHopperBlack','model','keys','query','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','update','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','count'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb2be,0x18a));var _0xeb2b=function(_0x243bba,_0x1ea69f){_0x243bba=_0x243bba-0x0;var _0x12e696=_0xb2be[_0x243bba];return _0x12e696;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xeb2b('0x0'));var rimraf=require(_0xeb2b('0x1'));var zipdir=require(_0xeb2b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xeb2b('0x3'));var BPromise=require(_0xeb2b('0x4'));var Mustache=require(_0xeb2b('0x5'));var util=require(_0xeb2b('0x6'));var path=require(_0xeb2b('0x7'));var sox=require(_0xeb2b('0x8'));var csv=require(_0xeb2b('0x9'));var ejs=require(_0xeb2b('0xa'));var fs=require('fs');var _=require(_0xeb2b('0xb'));var squel=require(_0xeb2b('0xc'));var crypto=require('crypto');var jsforce=require(_0xeb2b('0xd'));var deskjs=require(_0xeb2b('0xe'));var toCsv=require(_0xeb2b('0x9'));var querystring=require(_0xeb2b('0xf'));var Papa=require('papaparse');var authService=require(_0xeb2b('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0xeb2b('0x11'));var qs=require(_0xeb2b('0x12'));var logger=require(_0xeb2b('0x13'))('api');var utils=require(_0xeb2b('0x14'));var config=require(_0xeb2b('0x15'));var db=require(_0xeb2b('0x16'))['db'];function respondWithStatusCode(_0x2f57b1,_0x550811){_0x550811=_0x550811||0xcc;return function(_0x186d16){if(_0x186d16){return _0x2f57b1['sendStatus'](_0x550811);}return _0x2f57b1['status'](_0x550811)['end']();};}function respondWithResult(_0x391ffe,_0x53e71f){_0x53e71f=_0x53e71f||0xc8;return function(_0x28a109){if(_0x28a109){return _0x391ffe[_0xeb2b('0x17')](_0x53e71f)[_0xeb2b('0x18')](_0x28a109);}};}function respondWithFilteredResult(_0x10bbd4,_0x386561){return function(_0x31dd9b){if(_0x31dd9b){var _0x552153=_0x31dd9b[_0xeb2b('0x19')],_0x90f9c3=_0x386561[_0xeb2b('0x1a')],_0x31a2c4=_0x386561[_0xeb2b('0x1a')]+_0x386561[_0xeb2b('0x1b')],_0x1429e9;if(_0x31a2c4>=_0x552153){_0x31a2c4=_0x552153;_0x1429e9=0xc8;}else{_0x1429e9=0xce;}_0x10bbd4[_0xeb2b('0x17')](_0x1429e9);return _0x10bbd4[_0xeb2b('0x1c')]('Content-Range',_0x90f9c3+'-'+_0x31a2c4+'/'+_0x552153)[_0xeb2b('0x18')](_0x31dd9b);}return null;};}function patchUpdates(_0x413dd4){return function(_0x1ccd7a){try{jsonpatch[_0xeb2b('0x1d')](_0x1ccd7a,_0x413dd4,!![]);}catch(_0x1aa395){return BPromise[_0xeb2b('0x1e')](_0x1aa395);}return _0x1ccd7a[_0xeb2b('0x1f')]();};}function saveUpdates(_0x58a3a6,_0x5bb136){return function(_0x21e80e){if(_0x21e80e){return _0x21e80e['update'](_0x58a3a6)[_0xeb2b('0x20')](function(_0x17e423){return _0x17e423;});}return null;};}function removeEntity(_0x39dfb8,_0x286649){return function(_0x2cde0e){if(_0x2cde0e){return _0x2cde0e[_0xeb2b('0x21')]()[_0xeb2b('0x20')](function(){_0x39dfb8[_0xeb2b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x404d5a,_0x703ff7){return function(_0x45994b){if(!_0x45994b){_0x404d5a[_0xeb2b('0x22')](0x194);}return _0x45994b;};}function handleError(_0x56f14e,_0xf90155){_0xf90155=_0xf90155||0x1f4;return function(_0x324c80){logger[_0xeb2b('0x23')](_0x324c80[_0xeb2b('0x24')]);if(_0x324c80[_0xeb2b('0x25')]){delete _0x324c80['name'];}_0x56f14e[_0xeb2b('0x17')](_0xf90155)[_0xeb2b('0x26')](_0x324c80);};}exports['index']=function(_0x3ffbcb,_0x120505){var _0x74f2cf={},_0x4059d3={},_0x6a9aa={'count':0x0,'rows':[]};var _0x2b33d4=db[_0xeb2b('0x27')]['rawAttributes'];_0x4059d3[_0xeb2b('0x28')]=_[_0xeb2b('0x29')](_0x2b33d4);_0x4059d3[_0xeb2b('0x2a')]=_['keys'](_0x3ffbcb[_0xeb2b('0x2a')]);_0x4059d3['filters']=_['intersection'](_0x4059d3[_0xeb2b('0x28')],_0x4059d3['query']);_0x74f2cf[_0xeb2b('0x2b')]=_['intersection'](_0x4059d3[_0xeb2b('0x28')],qs['fields'](_0x3ffbcb[_0xeb2b('0x2a')][_0xeb2b('0x2c')]));_0x74f2cf['attributes']=_0x74f2cf[_0xeb2b('0x2b')][_0xeb2b('0x2d')]?_0x74f2cf[_0xeb2b('0x2b')]:_0x4059d3[_0xeb2b('0x28')];if(!_0x3ffbcb[_0xeb2b('0x2a')][_0xeb2b('0x2e')](_0xeb2b('0x2f'))){_0x74f2cf['limit']=qs[_0xeb2b('0x1b')](_0x3ffbcb[_0xeb2b('0x2a')][_0xeb2b('0x1b')]);_0x74f2cf[_0xeb2b('0x1a')]=qs['offset'](_0x3ffbcb[_0xeb2b('0x2a')][_0xeb2b('0x1a')]);}_0x74f2cf[_0xeb2b('0x30')]=qs['sort'](_0x3ffbcb[_0xeb2b('0x2a')]['sort']);_0x74f2cf[_0xeb2b('0x31')]=qs[_0xeb2b('0x32')](_['pick'](_0x3ffbcb['query'],_0x4059d3['filters']));if(_0x3ffbcb[_0xeb2b('0x2a')][_0xeb2b('0x33')]){_0x74f2cf[_0xeb2b('0x31')]=_[_0xeb2b('0x34')](_0x74f2cf['where'],{'$or':_[_0xeb2b('0x35')](_0x2b33d4,function(_0x372191){if(_0x372191[_0xeb2b('0x36')][_0xeb2b('0x37')]!==_0xeb2b('0x38')){var _0x45637c={};_0x45637c[_0x372191[_0xeb2b('0x39')]]={'$like':'%'+_0x3ffbcb['query'][_0xeb2b('0x33')]+'%'};return _0x45637c;}})});}_0x74f2cf=_[_0xeb2b('0x34')]({},_0x74f2cf,_0x3ffbcb[_0xeb2b('0x3a')]);var _0x5b1b8e={'where':_0x74f2cf[_0xeb2b('0x31')]};return db[_0xeb2b('0x27')][_0xeb2b('0x19')](_0x5b1b8e)[_0xeb2b('0x20')](function(_0x40beed){_0x6a9aa[_0xeb2b('0x19')]=_0x40beed;if(_0x3ffbcb[_0xeb2b('0x2a')][_0xeb2b('0x3b')]){_0x74f2cf[_0xeb2b('0x3c')]=[{'all':!![]}];}return db[_0xeb2b('0x27')][_0xeb2b('0x3d')](_0x74f2cf);})['then'](function(_0x56c957){_0x6a9aa['rows']=_0x56c957;return _0x6a9aa;})['then'](respondWithFilteredResult(_0x120505,_0x74f2cf))[_0xeb2b('0x3e')](handleError(_0x120505,null));};exports[_0xeb2b('0x3f')]=function(_0x80c818,_0x210a56){var _0x4a7a52={'raw':!![],'where':{'id':_0x80c818[_0xeb2b('0x40')]['id']}},_0x8ed313={};_0x8ed313[_0xeb2b('0x28')]=_['keys'](db[_0xeb2b('0x27')][_0xeb2b('0x41')]);_0x8ed313['query']=_[_0xeb2b('0x29')](_0x80c818[_0xeb2b('0x2a')]);_0x8ed313[_0xeb2b('0x32')]=_['intersection'](_0x8ed313[_0xeb2b('0x28')],_0x8ed313[_0xeb2b('0x2a')]);_0x4a7a52['attributes']=_['intersection'](_0x8ed313['model'],qs[_0xeb2b('0x2c')](_0x80c818[_0xeb2b('0x2a')][_0xeb2b('0x2c')]));_0x4a7a52['attributes']=_0x4a7a52[_0xeb2b('0x2b')]['length']?_0x4a7a52['attributes']:_0x8ed313[_0xeb2b('0x28')];if(_0x80c818[_0xeb2b('0x2a')][_0xeb2b('0x3b')]){_0x4a7a52[_0xeb2b('0x3c')]=[{'all':!![]}];}_0x4a7a52=_[_0xeb2b('0x34')]({},_0x4a7a52,_0x80c818[_0xeb2b('0x3a')]);return db[_0xeb2b('0x27')][_0xeb2b('0x42')](_0x4a7a52)[_0xeb2b('0x20')](handleEntityNotFound(_0x210a56,null))[_0xeb2b('0x20')](respondWithResult(_0x210a56,null))['catch'](handleError(_0x210a56,null));};exports[_0xeb2b('0x43')]=function(_0x4c74b6,_0x206941){if(_0x4c74b6['body']['id']){delete _0x4c74b6[_0xeb2b('0x44')]['id'];}return db[_0xeb2b('0x27')][_0xeb2b('0x42')]({'where':{'id':_0x4c74b6[_0xeb2b('0x40')]['id']}})[_0xeb2b('0x20')](handleEntityNotFound(_0x206941,null))[_0xeb2b('0x20')](saveUpdates(_0x4c74b6[_0xeb2b('0x44')],null))['then'](respondWithResult(_0x206941,null))['catch'](handleError(_0x206941,null));};exports[_0xeb2b('0x21')]=function(_0x7ba614,_0x589c0d){return db['CmHopperBlack'][_0xeb2b('0x42')]({'where':{'id':_0x7ba614[_0xeb2b('0x40')]['id']}})[_0xeb2b('0x20')](handleEntityNotFound(_0x589c0d,null))[_0xeb2b('0x20')](removeEntity(_0x589c0d,null))[_0xeb2b('0x3e')](handleError(_0x589c0d,null));};exports[_0xeb2b('0x45')]=function(_0x6fa880,_0x18a861){return db['CmHopperBlack'][_0xeb2b('0x45')]()['then'](respondWithResult(_0x18a861,null))[_0xeb2b('0x3e')](handleError(_0x18a861,null));};
\ No newline at end of file
index 06af338..a9999ad 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x62df=['../../config/logger','api','moment','bluebird','./cmHopperBlack.attributes','exports','define','CmHopperBlack','lodash','util'];(function(_0xf90100,_0x43ddde){var _0xf42516=function(_0x58221e){while(--_0x58221e){_0xf90100['push'](_0xf90100['shift']());}};_0xf42516(++_0x43ddde);}(_0x62df,0xe4));var _0xf62d=function(_0x5d5742,_0x4bb32c){_0x5d5742=_0x5d5742-0x0;var _0x2928e2=_0x62df[_0x5d5742];return _0x2928e2;};'use strict';var _=require(_0xf62d('0x0'));var util=require(_0xf62d('0x1'));var logger=require(_0xf62d('0x2'))(_0xf62d('0x3'));var moment=require(_0xf62d('0x4'));var BPromise=require(_0xf62d('0x5'));var rp=require('request-promise');var attributes=require(_0xf62d('0x6'));module[_0xf62d('0x7')]=function(_0x346fca,_0x500470){return _0x346fca[_0xf62d('0x8')](_0xf62d('0x9'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xb58f=['util','../../config/logger','api','moment','bluebird','request-promise','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb58f,0x1ef));var _0xfb58=function(_0x441d9e,_0x18da66){_0x441d9e=_0x441d9e-0x0;var _0x140c18=_0xb58f[_0x441d9e];return _0x140c18;};'use strict';var _=require('lodash');var util=require(_0xfb58('0x0'));var logger=require(_0xfb58('0x1'))(_0xfb58('0x2'));var moment=require(_0xfb58('0x3'));var BPromise=require(_0xfb58('0x4'));var rp=require(_0xfb58('0x5'));var attributes=require(_0xfb58('0x6'));module[_0xfb58('0x7')]=function(_0x1c6e4a,_0x13f777){return _0x1c6e4a[_0xfb58('0x8')](_0xfb58('0x9'),attributes,{'tableName':_0xfb58('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 5f3f4de..ef9f26a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8c48=['http','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CmHopperBlack','options','raw','attributes','limit','include','map','model','GetCmHopperBlack','catch','UpdateCmHopperBlack','update','where','DestroyCmHopperBlack','destroy','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x5e547b,_0x5970fc){var _0x13b3ed=function(_0x32638d){while(--_0x32638d){_0x5e547b['push'](_0x5e547b['shift']());}};_0x13b3ed(++_0x5970fc);}(_0x8c48,0x183));var _0x88c4=function(_0x3afe3f,_0x59e19a){_0x3afe3f=_0x3afe3f-0x0;var _0x2d7d0c=_0x8c48[_0x3afe3f];return _0x2d7d0c;};'use strict';var _=require(_0x88c4('0x0'));var util=require(_0x88c4('0x1'));var moment=require(_0x88c4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x88c4('0x3'))['db'];var utils=require(_0x88c4('0x4'));var logger=require(_0x88c4('0x5'))(_0x88c4('0x6'));var config=require(_0x88c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x88c4('0x8')][_0x88c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ae4e0,_0x47cf6e,_0x591e2a){return new BPromise(function(_0x134bb3,_0x58fb2c){return client['request'](_0x5ae4e0,_0x591e2a)[_0x88c4('0xa')](function(_0x4eecaf){logger[_0x88c4('0xb')](_0x88c4('0xc'),_0x47cf6e,_0x88c4('0xd'));logger[_0x88c4('0xe')](_0x88c4('0xf'),_0x47cf6e,'request\x20sent',JSON[_0x88c4('0x10')](_0x4eecaf));if(_0x4eecaf[_0x88c4('0x11')]){if(_0x4eecaf[_0x88c4('0x11')][_0x88c4('0x12')]===0x1f4){logger[_0x88c4('0x11')](_0x88c4('0xc'),_0x47cf6e,_0x4eecaf[_0x88c4('0x11')][_0x88c4('0x13')]);return _0x58fb2c(_0x4eecaf[_0x88c4('0x11')][_0x88c4('0x13')]);}logger[_0x88c4('0x11')](_0x88c4('0xc'),_0x47cf6e,_0x4eecaf[_0x88c4('0x11')][_0x88c4('0x13')]);return _0x134bb3(_0x4eecaf[_0x88c4('0x11')][_0x88c4('0x13')]);}else{logger[_0x88c4('0xb')](_0x88c4('0xc'),_0x47cf6e,_0x88c4('0xd'));_0x134bb3(_0x4eecaf[_0x88c4('0x14')][_0x88c4('0x13')]);}})['catch'](function(_0x5445af){logger['error'](_0x88c4('0xc'),_0x47cf6e,_0x5445af);_0x58fb2c(_0x5445af);});});}exports['GetCmHopperBlack']=function(_0x284f7a){var _0x29dc17=this;return new Promise(function(_0x450938,_0x4fee40){return db[_0x88c4('0x15')]['findAll']({'raw':_0x284f7a[_0x88c4('0x16')]?_0x284f7a['options'][_0x88c4('0x17')]===undefined?!![]:![]:!![],'where':_0x284f7a[_0x88c4('0x16')]?_0x284f7a[_0x88c4('0x16')]['where']||null:null,'attributes':_0x284f7a[_0x88c4('0x16')]?_0x284f7a[_0x88c4('0x16')][_0x88c4('0x18')]||null:null,'limit':_0x284f7a[_0x88c4('0x16')]?_0x284f7a[_0x88c4('0x16')][_0x88c4('0x19')]||null:null,'include':_0x284f7a['options']?_0x284f7a[_0x88c4('0x16')][_0x88c4('0x1a')]?_[_0x88c4('0x1b')](_0x284f7a[_0x88c4('0x16')][_0x88c4('0x1a')],function(_0x3b429f){return{'model':db[_0x3b429f['model']],'as':_0x3b429f['as'],'attributes':_0x3b429f['attributes'],'include':_0x3b429f[_0x88c4('0x1a')]?_['map'](_0x3b429f[_0x88c4('0x1a')],function(_0x556e83){return{'model':db[_0x556e83[_0x88c4('0x1c')]],'as':_0x556e83['as'],'attributes':_0x556e83['attributes'],'include':_0x556e83['include']?_[_0x88c4('0x1b')](_0x556e83['include'],function(_0xe8c224){return{'model':db[_0xe8c224['model']],'as':_0xe8c224['as'],'attributes':_0xe8c224[_0x88c4('0x18')]};}):[]};}):[]};}):[]:[]})[_0x88c4('0xa')](function(_0x772406){logger[_0x88c4('0xb')](_0x88c4('0x1d'),_0x284f7a);logger[_0x88c4('0xe')]('GetCmHopperBlack',_0x284f7a,JSON[_0x88c4('0x10')](_0x772406));_0x450938(_0x772406);})[_0x88c4('0x1e')](function(_0x188db6){logger['error']('GetCmHopperBlack',_0x188db6[_0x88c4('0x13')],_0x284f7a);_0x4fee40(_0x29dc17[_0x88c4('0x11')](0x1f4,_0x188db6[_0x88c4('0x13')]));});});};exports[_0x88c4('0x1f')]=function(_0x176d0e){var _0x2ee61b=this;return new Promise(function(_0x41f531,_0x26dfe3){return db['CmHopperBlack'][_0x88c4('0x20')](_0x176d0e['body'],{'raw':_0x176d0e[_0x88c4('0x16')]?_0x176d0e[_0x88c4('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x176d0e[_0x88c4('0x16')]?_0x176d0e[_0x88c4('0x16')][_0x88c4('0x21')]||null:null,'attributes':_0x176d0e['options']?_0x176d0e[_0x88c4('0x16')][_0x88c4('0x18')]||null:null,'limit':_0x176d0e[_0x88c4('0x16')]?_0x176d0e['options'][_0x88c4('0x19')]||null:null})[_0x88c4('0xa')](function(_0x475ebf){logger[_0x88c4('0xb')](_0x88c4('0x1f'),_0x176d0e);logger[_0x88c4('0xe')]('UpdateCmHopperBlack',_0x176d0e,JSON['stringify'](_0x475ebf));_0x41f531(_0x475ebf);})[_0x88c4('0x1e')](function(_0x3135f2){logger[_0x88c4('0x11')](_0x88c4('0x1f'),_0x3135f2[_0x88c4('0x13')],_0x176d0e);_0x26dfe3(_0x2ee61b[_0x88c4('0x11')](0x1f4,_0x3135f2['message']));});});};exports[_0x88c4('0x22')]=function(_0x34cede){var _0x4c9faf=this;return new Promise(function(_0x5ce6dd,_0x45e281){return db[_0x88c4('0x15')][_0x88c4('0x23')]({'where':_0x34cede[_0x88c4('0x16')]?_0x34cede['options'][_0x88c4('0x21')]||null:null})[_0x88c4('0xa')](function(_0x2c9efa){logger['info']('DestroyCmHopperBlack',_0x34cede);logger['debug'](_0x88c4('0x22'),_0x34cede,JSON['stringify'](_0x2c9efa));_0x5ce6dd(_0x2c9efa);})[_0x88c4('0x1e')](function(_0x5e9b6e){logger[_0x88c4('0x11')](_0x88c4('0x22'),_0x5e9b6e[_0x88c4('0x13')],_0x34cede);_0x45e281(_0x4c9faf['error'](0x1f4,_0x5e9b6e['message']));});});};
\ No newline at end of file
+var _0x4ad5=['CmHopperBlack','findAll','options','raw','attributes','limit','include','map','model','debug','UpdateCmHopperBlack','body','DestroyCmHopperBlack','where','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','CmHopperBlack,\x20%s,\x20%s','result','catch','GetCmHopperBlack'];(function(_0x24fbdb,_0x2ea0ec){var _0x76a173=function(_0x30c56b){while(--_0x30c56b){_0x24fbdb['push'](_0x24fbdb['shift']());}};_0x76a173(++_0x2ea0ec);}(_0x4ad5,0x9a));var _0x54ad=function(_0x3e4970,_0x1d0ec8){_0x3e4970=_0x3e4970-0x0;var _0x43cd3e=_0x4ad5[_0x3e4970];return _0x43cd3e;};'use strict';var _=require(_0x54ad('0x0'));var util=require('util');var moment=require(_0x54ad('0x1'));var BPromise=require(_0x54ad('0x2'));var rs=require(_0x54ad('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x54ad('0x4'))['db'];var utils=require(_0x54ad('0x5'));var logger=require(_0x54ad('0x6'))(_0x54ad('0x7'));var config=require(_0x54ad('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x54ad('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x337f70,_0x141fca,_0x4dc300){return new BPromise(function(_0x4c80eb,_0x5f29b5){return client['request'](_0x337f70,_0x4dc300)[_0x54ad('0xa')](function(_0x47b726){logger[_0x54ad('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0x141fca,_0x54ad('0xc'));logger['debug'](_0x54ad('0xd'),_0x141fca,'request\x20sent',JSON[_0x54ad('0xe')](_0x47b726));if(_0x47b726['error']){if(_0x47b726[_0x54ad('0xf')]['code']===0x1f4){logger[_0x54ad('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x141fca,_0x47b726[_0x54ad('0xf')][_0x54ad('0x10')]);return _0x5f29b5(_0x47b726['error'][_0x54ad('0x10')]);}logger[_0x54ad('0xf')](_0x54ad('0x11'),_0x141fca,_0x47b726[_0x54ad('0xf')]['message']);return _0x4c80eb(_0x47b726[_0x54ad('0xf')]['message']);}else{logger[_0x54ad('0xb')](_0x54ad('0x11'),_0x141fca,'request\x20sent');_0x4c80eb(_0x47b726[_0x54ad('0x12')][_0x54ad('0x10')]);}})[_0x54ad('0x13')](function(_0x23b76c){logger['error'](_0x54ad('0x11'),_0x141fca,_0x23b76c);_0x5f29b5(_0x23b76c);});});}exports[_0x54ad('0x14')]=function(_0x460de6){var _0x51fffc=this;return new Promise(function(_0xfc49a4,_0x33f7a2){return db[_0x54ad('0x15')][_0x54ad('0x16')]({'raw':_0x460de6[_0x54ad('0x17')]?_0x460de6[_0x54ad('0x17')][_0x54ad('0x18')]===undefined?!![]:![]:!![],'where':_0x460de6[_0x54ad('0x17')]?_0x460de6['options']['where']||null:null,'attributes':_0x460de6[_0x54ad('0x17')]?_0x460de6[_0x54ad('0x17')][_0x54ad('0x19')]||null:null,'limit':_0x460de6[_0x54ad('0x17')]?_0x460de6[_0x54ad('0x17')][_0x54ad('0x1a')]||null:null,'include':_0x460de6['options']?_0x460de6[_0x54ad('0x17')][_0x54ad('0x1b')]?_[_0x54ad('0x1c')](_0x460de6[_0x54ad('0x17')]['include'],function(_0x2590ab){return{'model':db[_0x2590ab[_0x54ad('0x1d')]],'as':_0x2590ab['as'],'attributes':_0x2590ab[_0x54ad('0x19')],'include':_0x2590ab[_0x54ad('0x1b')]?_[_0x54ad('0x1c')](_0x2590ab[_0x54ad('0x1b')],function(_0x520b75){return{'model':db[_0x520b75['model']],'as':_0x520b75['as'],'attributes':_0x520b75['attributes'],'include':_0x520b75[_0x54ad('0x1b')]?_['map'](_0x520b75[_0x54ad('0x1b')],function(_0x5cbe4f){return{'model':db[_0x5cbe4f[_0x54ad('0x1d')]],'as':_0x5cbe4f['as'],'attributes':_0x5cbe4f[_0x54ad('0x19')]};}):[]};}):[]};}):[]:[]})[_0x54ad('0xa')](function(_0x35022c){logger['info'](_0x54ad('0x14'),_0x460de6);logger[_0x54ad('0x1e')](_0x54ad('0x14'),_0x460de6,JSON[_0x54ad('0xe')](_0x35022c));_0xfc49a4(_0x35022c);})['catch'](function(_0x589523){logger['error'](_0x54ad('0x14'),_0x589523[_0x54ad('0x10')],_0x460de6);_0x33f7a2(_0x51fffc[_0x54ad('0xf')](0x1f4,_0x589523['message']));});});};exports[_0x54ad('0x1f')]=function(_0x5ba08f){var _0xe6af37=this;return new Promise(function(_0x3fc8a7,_0x4243bf){return db[_0x54ad('0x15')]['update'](_0x5ba08f[_0x54ad('0x20')],{'raw':_0x5ba08f[_0x54ad('0x17')]?_0x5ba08f['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ba08f[_0x54ad('0x17')]?_0x5ba08f['options']['where']||null:null,'attributes':_0x5ba08f[_0x54ad('0x17')]?_0x5ba08f['options']['attributes']||null:null,'limit':_0x5ba08f[_0x54ad('0x17')]?_0x5ba08f[_0x54ad('0x17')][_0x54ad('0x1a')]||null:null})['then'](function(_0xca9b9d){logger[_0x54ad('0xb')](_0x54ad('0x1f'),_0x5ba08f);logger['debug'](_0x54ad('0x1f'),_0x5ba08f,JSON['stringify'](_0xca9b9d));_0x3fc8a7(_0xca9b9d);})[_0x54ad('0x13')](function(_0xb0e6d8){logger['error']('UpdateCmHopperBlack',_0xb0e6d8[_0x54ad('0x10')],_0x5ba08f);_0x4243bf(_0xe6af37['error'](0x1f4,_0xb0e6d8[_0x54ad('0x10')]));});});};exports[_0x54ad('0x21')]=function(_0x548b17){var _0x5a621f=this;return new Promise(function(_0x25e9a3,_0x226cbb){return db[_0x54ad('0x15')]['destroy']({'where':_0x548b17[_0x54ad('0x17')]?_0x548b17['options'][_0x54ad('0x22')]||null:null})[_0x54ad('0xa')](function(_0x6889e4){logger[_0x54ad('0xb')](_0x54ad('0x21'),_0x548b17);logger['debug'](_0x54ad('0x21'),_0x548b17,JSON[_0x54ad('0xe')](_0x6889e4));_0x25e9a3(_0x6889e4);})[_0x54ad('0x13')](function(_0x331014){logger[_0x54ad('0xf')](_0x54ad('0x21'),_0x331014['message'],_0x548b17);_0x226cbb(_0x5a621f['error'](0x1f4,_0x331014['message']));});});};
\ No newline at end of file
index 7543dcf..bc857f6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3d9c=['destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','show','put','update','/:id'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3d9c,0x134));var _0xc3d9=function(_0x434e49,_0x1e3264){_0x434e49=_0x434e49-0x0;var _0x51e5c5=_0x3d9c[_0x434e49];return _0x51e5c5;};'use strict';var multer=require(_0xc3d9('0x0'));var util=require('util');var path=require(_0xc3d9('0x1'));var timeout=require(_0xc3d9('0x2'));var express=require(_0xc3d9('0x3'));var router=express['Router']();var auth=require(_0xc3d9('0x4'));var interaction=require(_0xc3d9('0x5'));var config=require(_0xc3d9('0x6'));var controller=require(_0xc3d9('0x7'));router[_0xc3d9('0x8')]('/',auth[_0xc3d9('0x9')](),controller[_0xc3d9('0xa')]);router['get'](_0xc3d9('0xb'),auth[_0xc3d9('0x9')](),controller['describe']);router[_0xc3d9('0x8')]('/:id',auth[_0xc3d9('0x9')](),controller[_0xc3d9('0xc')]);router[_0xc3d9('0xd')]('/:id',auth[_0xc3d9('0x9')](),controller[_0xc3d9('0xe')]);router['delete'](_0xc3d9('0xf'),auth[_0xc3d9('0x9')](),controller[_0xc3d9('0x10')]);module[_0xc3d9('0x11')]=router;
\ No newline at end of file
+var _0xb620=['destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','describe','/:id','isAuthenticated','show','update','delete'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb620,0x1a0));var _0x0b62=function(_0x25940e,_0x1f113a){_0x25940e=_0x25940e-0x0;var _0x2d389c=_0xb620[_0x25940e];return _0x2d389c;};'use strict';var multer=require(_0x0b62('0x0'));var util=require('util');var path=require(_0x0b62('0x1'));var timeout=require(_0x0b62('0x2'));var express=require('express');var router=express[_0x0b62('0x3')]();var auth=require(_0x0b62('0x4'));var interaction=require(_0x0b62('0x5'));var config=require(_0x0b62('0x6'));var controller=require(_0x0b62('0x7'));router[_0x0b62('0x8')]('/',auth['isAuthenticated'](),controller[_0x0b62('0x9')]);router[_0x0b62('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x0b62('0xa')]);router[_0x0b62('0x8')](_0x0b62('0xb'),auth[_0x0b62('0xc')](),controller[_0x0b62('0xd')]);router['put'](_0x0b62('0xb'),auth[_0x0b62('0xc')](),controller[_0x0b62('0xe')]);router[_0x0b62('0xf')]('/:id',auth[_0x0b62('0xc')](),controller[_0x0b62('0x10')]);module[_0x0b62('0x11')]=router;
\ No newline at end of file
index 97831fc..523f883 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb388=['DATE','endtime','diff','setDataValue','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','STRING'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb388,0x1df));var _0x8b38=function(_0x375388,_0x592802){_0x375388=_0x375388-0x0;var _0x8f3642=_0xb388[_0x375388];return _0x8f3642;};'use strict';var Sequelize=require(_0x8b38('0x0'));var moment=require(_0x8b38('0x1'));module[_0x8b38('0x2')]={'state':{'type':Sequelize[_0x8b38('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x8b38('0x4')]},'scheduledat':{'type':Sequelize[_0x8b38('0x5')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8b38('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x8b38('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x8b38('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x8b38('0x5')]},'responsetime':{'type':Sequelize[_0x8b38('0x5')]},'answertime':{'type':Sequelize[_0x8b38('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8b38('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8b38('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8b38('0x4')]},'campaign':{'type':Sequelize[_0x8b38('0x4')]},'campaigntype':{'type':Sequelize[_0x8b38('0x4')]},'membername':{'type':Sequelize[_0x8b38('0x4')]},'reason':{'type':Sequelize[_0x8b38('0x4')]},'disposition':{'type':Sequelize[_0x8b38('0x4')]},'dispositionat':{'type':Sequelize[_0x8b38('0x5')],'set':function(_0x2b1b74){var _0x52ff7e=this['getDataValue'](_0x8b38('0x6'));if(_0x52ff7e&&_0x2b1b74){this['setDataValue']('followuptime',moment(_0x2b1b74)[_0x8b38('0x7')](moment(_0x52ff7e),'seconds'));}return this[_0x8b38('0x8')](_0x8b38('0x9'),_0x2b1b74);}},'amd':{'type':Sequelize[_0x8b38('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8b38('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x8b38('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x8b38('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x8b38('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8b38('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x8b38('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x8b38('0x5')]},'recallme':{'type':Sequelize[_0x8b38('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x8b38('0x5')]}};
\ No newline at end of file
+var _0x0f6d=['sequelize','moment','exports','INTEGER','STRING','DATE','endtime','setDataValue','followuptime','seconds','dispositionat','BOOLEAN'];(function(_0x5c5f05,_0x2cf9b3){var _0x245ad4=function(_0x356d38){while(--_0x356d38){_0x5c5f05['push'](_0x5c5f05['shift']());}};_0x245ad4(++_0x2cf9b3);}(_0x0f6d,0x180));var _0xd0f6=function(_0x1db831,_0x42b7b5){_0x1db831=_0x1db831-0x0;var _0x39ba56=_0x0f6d[_0x1db831];return _0x39ba56;};'use strict';var Sequelize=require(_0xd0f6('0x0'));var moment=require(_0xd0f6('0x1'));module[_0xd0f6('0x2')]={'state':{'type':Sequelize[_0xd0f6('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xd0f6('0x4')]},'scheduledat':{'type':Sequelize[_0xd0f6('0x5')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd0f6('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xd0f6('0x4')]},'originatecalleridname':{'type':Sequelize[_0xd0f6('0x4')]},'calleridnum':{'type':Sequelize[_0xd0f6('0x4')]},'calleridname':{'type':Sequelize[_0xd0f6('0x4')]},'starttime':{'type':Sequelize[_0xd0f6('0x5')]},'responsetime':{'type':Sequelize[_0xd0f6('0x5')]},'answertime':{'type':Sequelize[_0xd0f6('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xd0f6('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd0f6('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd0f6('0x4')]},'campaign':{'type':Sequelize[_0xd0f6('0x4')]},'campaigntype':{'type':Sequelize[_0xd0f6('0x4')]},'membername':{'type':Sequelize[_0xd0f6('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xd0f6('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x1ebf0b){var _0x2aec49=this['getDataValue'](_0xd0f6('0x6'));if(_0x2aec49&&_0x1ebf0b){this[_0xd0f6('0x7')](_0xd0f6('0x8'),moment(_0x1ebf0b)['diff'](moment(_0x2aec49),_0xd0f6('0x9')));}return this[_0xd0f6('0x7')](_0xd0f6('0xa'),_0x1ebf0b);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xd0f6('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xd0f6('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xd0f6('0x5')]},'callback':{'type':Sequelize[_0xd0f6('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd0f6('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd0f6('0x5')]},'deleted':{'type':Sequelize[_0xd0f6('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xd0f6('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xd0f6('0x5')]}};
\ No newline at end of file
index b6e72c9..9083cde 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe5b5=['dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','VoiceQueueId','createdAt','select','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','from','VoiceQueueId\x20=\x20?','state\x20=\x20?','toString','calleridnum','cm_hopper_final','ContactId','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','updatedAt','ANY_VALUE(ListId)','state','calleridnum\x20IS\x20NOT\x20NULL','CampaignId\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','checkContactHopper','CmHopper','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','ioredis','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','reject','update','then','error','name','index','CmHopperFinal','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','type','key','field','options','includeAll','include','findAll','catch','params','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null'];(function(_0x499c1c,_0x37897b){var _0x1fc8bf=function(_0x3b4229){while(--_0x3b4229){_0x499c1c['push'](_0x499c1c['shift']());}};_0x1fc8bf(++_0x37897b);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x13843f,_0x50422d){_0x13843f=_0x13843f-0x0;var _0x1063ae=_0xe5b5[_0x13843f];return _0x1063ae;};'use strict';var pdf=require(_0x5e5b('0x0'));var emlformat=require(_0x5e5b('0x1'));var rimraf=require(_0x5e5b('0x2'));var zipdir=require(_0x5e5b('0x3'));var jsonpatch=require(_0x5e5b('0x4'));var rp=require(_0x5e5b('0x5'));var moment=require(_0x5e5b('0x6'));var BPromise=require(_0x5e5b('0x7'));var Mustache=require(_0x5e5b('0x8'));var util=require(_0x5e5b('0x9'));var path=require(_0x5e5b('0xa'));var sox=require(_0x5e5b('0xb'));var csv=require(_0x5e5b('0xc'));var ejs=require(_0x5e5b('0xd'));var fs=require('fs');var _=require(_0x5e5b('0xe'));var squel=require(_0x5e5b('0xf'));var crypto=require(_0x5e5b('0x10'));var jsforce=require(_0x5e5b('0x11'));var deskjs=require(_0x5e5b('0x12'));var toCsv=require(_0x5e5b('0xc'));var querystring=require(_0x5e5b('0x13'));var Papa=require(_0x5e5b('0x14'));var authService=require(_0x5e5b('0x15'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x5e5b('0x16'));var qs=require('../../components/parsers/qs');var logger=require(_0x5e5b('0x17'))(_0x5e5b('0x18'));var utils=require(_0x5e5b('0x19'));var config=require(_0x5e5b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a1424,_0x5ebf65){_0x5ebf65=_0x5ebf65||0xcc;return function(_0x310f71){if(_0x310f71){return _0x4a1424[_0x5e5b('0x1b')](_0x5ebf65);}return _0x4a1424[_0x5e5b('0x1c')](_0x5ebf65)[_0x5e5b('0x1d')]();};}function respondWithResult(_0x13a01e,_0x1e3483){_0x1e3483=_0x1e3483||0xc8;return function(_0x2e331d){if(_0x2e331d){return _0x13a01e['status'](_0x1e3483)[_0x5e5b('0x1e')](_0x2e331d);}};}function respondWithFilteredResult(_0x2e92c3,_0x4ff37b){return function(_0x227417){if(_0x227417){var _0x578c14=_0x227417[_0x5e5b('0x1f')],_0x4e9509=_0x4ff37b['offset'],_0x13a1cb=_0x4ff37b[_0x5e5b('0x20')]+_0x4ff37b['limit'],_0x444435;if(_0x13a1cb>=_0x578c14){_0x13a1cb=_0x578c14;_0x444435=0xc8;}else{_0x444435=0xce;}_0x2e92c3[_0x5e5b('0x1c')](_0x444435);return _0x2e92c3[_0x5e5b('0x21')]('Content-Range',_0x4e9509+'-'+_0x13a1cb+'/'+_0x578c14)[_0x5e5b('0x1e')](_0x227417);}return null;};}function patchUpdates(_0x1560e1){return function(_0x2281c8){try{jsonpatch['apply'](_0x2281c8,_0x1560e1,!![]);}catch(_0x2bf0b7){return BPromise[_0x5e5b('0x22')](_0x2bf0b7);}return _0x2281c8['save']();};}function saveUpdates(_0x2fdc38,_0x1aa0c2){return function(_0x3c488e){if(_0x3c488e){return _0x3c488e[_0x5e5b('0x23')](_0x2fdc38)[_0x5e5b('0x24')](function(_0x33d61b){return _0x33d61b;});}return null;};}function removeEntity(_0x93df5c,_0x37552c){return function(_0x4a78e3){if(_0x4a78e3){return _0x4a78e3['destroy']()[_0x5e5b('0x24')](function(){_0x93df5c[_0x5e5b('0x1c')](0xcc)[_0x5e5b('0x1d')]();});}};}function handleEntityNotFound(_0xe1c268,_0x2e38ed){return function(_0x28cd95){if(!_0x28cd95){_0xe1c268[_0x5e5b('0x1b')](0x194);}return _0x28cd95;};}function handleError(_0x18903e,_0x161599){_0x161599=_0x161599||0x1f4;return function(_0x26bc02){logger[_0x5e5b('0x25')](_0x26bc02['stack']);if(_0x26bc02[_0x5e5b('0x26')]){delete _0x26bc02[_0x5e5b('0x26')];}_0x18903e[_0x5e5b('0x1c')](_0x161599)['send'](_0x26bc02);};}exports[_0x5e5b('0x27')]=function(_0xdb2863,_0x5ee866){var _0x13ff91={},_0x21c74b={},_0x39ce16={'count':0x0,'rows':[]};var _0x36b595=db[_0x5e5b('0x28')][_0x5e5b('0x29')];_0x21c74b[_0x5e5b('0x2a')]=_[_0x5e5b('0x2b')](_0x36b595);_0x21c74b[_0x5e5b('0x2c')]=_[_0x5e5b('0x2b')](_0xdb2863[_0x5e5b('0x2c')]);_0x21c74b[_0x5e5b('0x2d')]=_['intersection'](_0x21c74b['model'],_0x21c74b[_0x5e5b('0x2c')]);_0x13ff91[_0x5e5b('0x2e')]=_[_0x5e5b('0x2f')](_0x21c74b[_0x5e5b('0x2a')],qs[_0x5e5b('0x30')](_0xdb2863['query'][_0x5e5b('0x30')]));_0x13ff91['attributes']=_0x13ff91[_0x5e5b('0x2e')][_0x5e5b('0x31')]?_0x13ff91[_0x5e5b('0x2e')]:_0x21c74b[_0x5e5b('0x2a')];if(!_0xdb2863['query'][_0x5e5b('0x32')](_0x5e5b('0x33'))){_0x13ff91['limit']=qs[_0x5e5b('0x34')](_0xdb2863[_0x5e5b('0x2c')][_0x5e5b('0x34')]);_0x13ff91[_0x5e5b('0x20')]=qs[_0x5e5b('0x20')](_0xdb2863[_0x5e5b('0x2c')][_0x5e5b('0x20')]);}_0x13ff91[_0x5e5b('0x35')]=qs['sort'](_0xdb2863[_0x5e5b('0x2c')][_0x5e5b('0x36')]);_0x13ff91[_0x5e5b('0x37')]=qs[_0x5e5b('0x2d')](_[_0x5e5b('0x38')](_0xdb2863[_0x5e5b('0x2c')],_0x21c74b['filters']));if(_0xdb2863['query'][_0x5e5b('0x39')]){_0x13ff91[_0x5e5b('0x37')]=_[_0x5e5b('0x3a')](_0x13ff91['where'],{'$or':_[_0x5e5b('0x3b')](_0x36b595,function(_0x14bf53){if(_0x14bf53[_0x5e5b('0x3c')][_0x5e5b('0x3d')]!=='VIRTUAL'){var _0x5b3e0d={};_0x5b3e0d[_0x14bf53[_0x5e5b('0x3e')]]={'$like':'%'+_0xdb2863['query']['filter']+'%'};return _0x5b3e0d;}})});}_0x13ff91=_[_0x5e5b('0x3a')]({},_0x13ff91,_0xdb2863[_0x5e5b('0x3f')]);var _0xee3e6f={'where':_0x13ff91['where']};return db[_0x5e5b('0x28')]['count'](_0xee3e6f)['then'](function(_0x261057){_0x39ce16[_0x5e5b('0x1f')]=_0x261057;if(_0xdb2863[_0x5e5b('0x2c')][_0x5e5b('0x40')]){_0x13ff91[_0x5e5b('0x41')]=[{'all':!![]}];}return db[_0x5e5b('0x28')][_0x5e5b('0x42')](_0x13ff91);})[_0x5e5b('0x24')](function(_0x1034fa){_0x39ce16['rows']=_0x1034fa;return _0x39ce16;})[_0x5e5b('0x24')](respondWithFilteredResult(_0x5ee866,_0x13ff91))[_0x5e5b('0x43')](handleError(_0x5ee866,null));};exports['show']=function(_0x204487,_0x4b54b0){var _0x125f95={'raw':!![],'where':{'id':_0x204487[_0x5e5b('0x44')]['id']}},_0x14b152={};_0x14b152[_0x5e5b('0x2a')]=_[_0x5e5b('0x2b')](db[_0x5e5b('0x28')][_0x5e5b('0x29')]);_0x14b152[_0x5e5b('0x2c')]=_[_0x5e5b('0x2b')](_0x204487[_0x5e5b('0x2c')]);_0x14b152[_0x5e5b('0x2d')]=_['intersection'](_0x14b152[_0x5e5b('0x2a')],_0x14b152[_0x5e5b('0x2c')]);_0x125f95[_0x5e5b('0x2e')]=_['intersection'](_0x14b152[_0x5e5b('0x2a')],qs[_0x5e5b('0x30')](_0x204487['query'][_0x5e5b('0x30')]));_0x125f95[_0x5e5b('0x2e')]=_0x125f95['attributes'][_0x5e5b('0x31')]?_0x125f95['attributes']:_0x14b152['model'];if(_0x204487['query'][_0x5e5b('0x40')]){_0x125f95['include']=[{'all':!![]}];}_0x125f95=_[_0x5e5b('0x3a')]({},_0x125f95,_0x204487['options']);return db[_0x5e5b('0x28')][_0x5e5b('0x45')](_0x125f95)[_0x5e5b('0x24')](handleEntityNotFound(_0x4b54b0,null))[_0x5e5b('0x24')](respondWithResult(_0x4b54b0,null))[_0x5e5b('0x43')](handleError(_0x4b54b0,null));};exports[_0x5e5b('0x46')]=function(_0x8b03f2,_0x4e4d03){return db['CmHopperFinal'][_0x5e5b('0x46')]()['then'](respondWithResult(_0x4e4d03,null))['catch'](handleError(_0x4e4d03,null));};exports['update']=function(_0x249922,_0x5d63cc){if(_0x249922[_0x5e5b('0x47')][_0x5e5b('0x48')]){delete _0x249922[_0x5e5b('0x47')][_0x5e5b('0x48')];}return db[_0x5e5b('0x28')][_0x5e5b('0x45')]({'where':{'uniqueid':_0x249922['params']['id']}})[_0x5e5b('0x24')](handleEntityNotFound(_0x5d63cc,null))[_0x5e5b('0x24')](saveUpdates(_0x249922['body'],null))[_0x5e5b('0x24')](respondWithResult(_0x5d63cc,null))['catch'](handleError(_0x5d63cc,null));};exports[_0x5e5b('0x49')]=function(_0x36d8fa,_0x42ebaf,_0x30de85){return db['CmHopperFinal'][_0x5e5b('0x42')]({'raw':![],'where':{'VoiceQueueId':_0x36d8fa[_0x5e5b('0x44')]['id']},'attributes':[[db['sequelize']['fn'](_0x5e5b('0x4a'),db[_0x5e5b('0x4b')]['fn']('IF',db[_0x5e5b('0x4b')][_0x5e5b('0x4c')](_0x5e5b('0x4d')))),_0x5e5b('0x4e')],[db['sequelize']['fn'](_0x5e5b('0x4a'),db[_0x5e5b('0x4b')]['fn']('IF',db['sequelize'][_0x5e5b('0x4c')](_0x5e5b('0x4f')))),_0x5e5b('0x50')],[db['sequelize']['fn'](_0x5e5b('0x4a'),db[_0x5e5b('0x4b')]['fn']('IF',db[_0x5e5b('0x4b')]['literal'](_0x5e5b('0x51')))),_0x5e5b('0x52')],[db[_0x5e5b('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5e5b('0x4b')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x5e5b('0x53')],[db[_0x5e5b('0x4b')]['fn'](_0x5e5b('0x4a'),db['sequelize']['fn']('IF',db[_0x5e5b('0x4b')][_0x5e5b('0x4c')](_0x5e5b('0x54')))),_0x5e5b('0x55')],[db[_0x5e5b('0x4b')]['fn'](_0x5e5b('0x4a'),db['sequelize']['fn']('IF',db['sequelize'][_0x5e5b('0x4c')](_0x5e5b('0x56')))),_0x5e5b('0x57')],[db[_0x5e5b('0x4b')]['fn']('COUNT',db[_0x5e5b('0x4b')]['fn']('IF',db['sequelize'][_0x5e5b('0x4c')](_0x5e5b('0x58')))),_0x5e5b('0x59')],[db[_0x5e5b('0x4b')]['fn'](_0x5e5b('0x4a'),db[_0x5e5b('0x4b')]['fn']('IF',db[_0x5e5b('0x4b')][_0x5e5b('0x4c')]('`state`\x20=\x2019,\x201,\x20null'))),_0x5e5b('0x5a')]]})[_0x5e5b('0x24')](handleEntityNotFound(_0x42ebaf,null))[_0x5e5b('0x24')](respondWithResult(_0x42ebaf,null))[_0x5e5b('0x43')](handleError(_0x42ebaf,null));};exports[_0x5e5b('0x5b')]=function(_0x5543eb,_0x2ccee2,_0x1dc180){return db[_0x5e5b('0x28')][_0x5e5b('0x42')]({'raw':![],'where':{'CampaignId':_0x5543eb[_0x5e5b('0x44')]['id']},'attributes':[[db['sequelize']['fn'](_0x5e5b('0x4a'),db['sequelize']['fn']('IF',db[_0x5e5b('0x4b')]['literal'](_0x5e5b('0x4d')))),_0x5e5b('0x4e')],[db[_0x5e5b('0x4b')]['fn'](_0x5e5b('0x4a'),db[_0x5e5b('0x4b')]['fn']('IF',db[_0x5e5b('0x4b')]['literal'](_0x5e5b('0x4f')))),_0x5e5b('0x50')],[db[_0x5e5b('0x4b')]['fn'](_0x5e5b('0x4a'),db['sequelize']['fn']('IF',db['sequelize'][_0x5e5b('0x4c')](_0x5e5b('0x51')))),'busyContacts'],[db[_0x5e5b('0x4b')]['fn'](_0x5e5b('0x4a'),db[_0x5e5b('0x4b')]['fn']('IF',db[_0x5e5b('0x4b')][_0x5e5b('0x4c')]('`state`\x20=\x208,\x201,\x20null'))),_0x5e5b('0x53')],[db[_0x5e5b('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x5e5b('0x4c')](_0x5e5b('0x54')))),_0x5e5b('0x55')],[db[_0x5e5b('0x4b')]['fn'](_0x5e5b('0x4a'),db['sequelize']['fn']('IF',db[_0x5e5b('0x4b')][_0x5e5b('0x4c')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x5e5b('0x57')],[db['sequelize']['fn']('COUNT',db[_0x5e5b('0x4b')]['fn']('IF',db[_0x5e5b('0x4b')][_0x5e5b('0x4c')](_0x5e5b('0x58')))),_0x5e5b('0x59')],[db[_0x5e5b('0x4b')]['fn'](_0x5e5b('0x4a'),db['sequelize']['fn']('IF',db[_0x5e5b('0x4b')][_0x5e5b('0x4c')](_0x5e5b('0x5c')))),_0x5e5b('0x5a')]]})[_0x5e5b('0x24')](handleEntityNotFound(_0x2ccee2,null))[_0x5e5b('0x24')](respondWithResult(_0x2ccee2,null))[_0x5e5b('0x43')](handleError(_0x2ccee2,null));};exports[_0x5e5b('0x5d')]=function(_0x27991a,_0x2a2ea3,_0x26a17f){return db['VoiceQueue'][_0x5e5b('0x45')]({'where':{'id':_0x27991a[_0x5e5b('0x44')]['id']}})[_0x5e5b('0x24')](handleEntityNotFound(_0x2a2ea3,null))[_0x5e5b('0x24')](function(_0xc7171a){var _0x4dcf17;if(_0xc7171a){_0x4dcf17=squel[_0x5e5b('0x5e')]()[_0x5e5b('0x5f')](_0x5e5b('0x60'))[_0x5e5b('0x61')]([_0x5e5b('0x62'),_0x5e5b('0x63'),'ContactId',_0x5e5b('0x64'),_0x5e5b('0x65'),_0x5e5b('0x66'),'updatedAt'],squel[_0x5e5b('0x67')]()[_0x5e5b('0x3e')](_0x5e5b('0x68'),_0x5e5b('0x62'))[_0x5e5b('0x3e')](_0x5e5b('0x69'),_0x5e5b('0x63'))[_0x5e5b('0x3e')](_0x5e5b('0x6a'),'ContactId')[_0x5e5b('0x3e')]('ANY_VALUE(ListId)',_0x5e5b('0x64'))[_0x5e5b('0x3e')]('ANY_VALUE(VoiceQueueId)','VoiceQueueId')[_0x5e5b('0x3e')](_0x5e5b('0x69'),'createdAt')[_0x5e5b('0x3e')]('NOW()','updatedAt')[_0x5e5b('0x6b')]('cm_hopper_final')[_0x5e5b('0x37')](_0x5e5b('0x6c'),_0x27991a[_0x5e5b('0x44')]['id']['toString']())[_0x5e5b('0x37')](_0x5e5b('0x6d'),_0x27991a[_0x5e5b('0x47')]['state'][_0x5e5b('0x6e')]())[_0x5e5b('0x37')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x5e5b('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x5e5b('0x3e')](_0x5e5b('0x62'))[_0x5e5b('0x6b')](_0x5e5b('0x60'))[_0x5e5b('0x37')]('VoiceQueueId\x20=\x20?',_0x27991a[_0x5e5b('0x44')]['id'][_0x5e5b('0x6e')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5e5b('0x67')]()[_0x5e5b('0x3e')](_0x5e5b('0x6f'))[_0x5e5b('0x6b')](_0x5e5b('0x70'))[_0x5e5b('0x37')]('VoiceQueueId\x20=\x20?',_0x27991a[_0x5e5b('0x44')]['id'][_0x5e5b('0x6e')]())[_0x5e5b('0x37')]('state\x20=\x204'))['group'](_0x5e5b('0x71')))[_0x5e5b('0x6e')]();return db[_0x5e5b('0x4b')]['query'](_0x4dcf17);}return[];})[_0x5e5b('0x24')](respondWithResult(_0x2a2ea3,null))[_0x5e5b('0x43')](handleError(_0x2a2ea3,null));};exports[_0x5e5b('0x72')]=function(_0x573cfa,_0x112bf5,_0x40cc5f){return db[_0x5e5b('0x73')]['find']({'where':{'id':_0x573cfa[_0x5e5b('0x44')]['id']}})[_0x5e5b('0x24')](handleEntityNotFound(_0x112bf5,null))[_0x5e5b('0x24')](function(_0x1dc878){var _0x34d3da;if(_0x1dc878){_0x34d3da=squel[_0x5e5b('0x5e')]()['into'](_0x5e5b('0x60'))[_0x5e5b('0x61')](['phone',_0x5e5b('0x63'),'ContactId',_0x5e5b('0x64'),_0x5e5b('0x74'),_0x5e5b('0x66'),_0x5e5b('0x75')],squel[_0x5e5b('0x67')]()['field'](_0x5e5b('0x68'),_0x5e5b('0x62'))[_0x5e5b('0x3e')](_0x5e5b('0x69'),_0x5e5b('0x63'))[_0x5e5b('0x3e')]('ANY_VALUE(ContactId)',_0x5e5b('0x71'))['field'](_0x5e5b('0x76'),_0x5e5b('0x64'))['field']('ANY_VALUE(CampaignId)',_0x5e5b('0x74'))[_0x5e5b('0x3e')](_0x5e5b('0x69'),_0x5e5b('0x66'))[_0x5e5b('0x3e')](_0x5e5b('0x69'),_0x5e5b('0x75'))[_0x5e5b('0x6b')](_0x5e5b('0x70'))[_0x5e5b('0x37')]('CampaignId\x20=\x20?',_0x573cfa[_0x5e5b('0x44')]['id']['toString']())['where']('state\x20=\x20?',_0x573cfa['body'][_0x5e5b('0x77')][_0x5e5b('0x6e')]())[_0x5e5b('0x37')](_0x5e5b('0x78'))[_0x5e5b('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5e5b('0x67')]()[_0x5e5b('0x3e')]('phone')[_0x5e5b('0x6b')](_0x5e5b('0x60'))[_0x5e5b('0x37')](_0x5e5b('0x79'),_0x573cfa[_0x5e5b('0x44')]['id'][_0x5e5b('0x6e')]()))['where'](_0x5e5b('0x7a'),squel['select']()[_0x5e5b('0x3e')]('calleridnum')[_0x5e5b('0x6b')](_0x5e5b('0x70'))[_0x5e5b('0x37')](_0x5e5b('0x79'),_0x573cfa[_0x5e5b('0x44')]['id']['toString']())['where'](_0x5e5b('0x7b')))[_0x5e5b('0x7c')](_0x5e5b('0x71')))['toString']();return db['sequelize'][_0x5e5b('0x2c')](_0x34d3da);}return[];})['then'](respondWithResult(_0x112bf5,null))[_0x5e5b('0x43')](handleError(_0x112bf5,null));};exports[_0x5e5b('0x7d')]=function(_0x3aa393,_0x501c4c,_0x51e1b5){return db[_0x5e5b('0x7e')][_0x5e5b('0x7f')]({'where':{'VoiceQueueId':_0x3aa393[_0x5e5b('0x47')]['VoiceQueueId'],'CampaignId':_0x3aa393[_0x5e5b('0x47')]['CampaignId'],'ContactId':_0x3aa393[_0x5e5b('0x47')]['ContactId']}})[_0x5e5b('0x24')](handleEntityNotFound(_0x501c4c,null))[_0x5e5b('0x24')](function(_0x429290){if(_0x429290){return _0x429290;}return null;})['then'](respondWithResult(_0x501c4c,null))[_0x5e5b('0x43')](handleError(_0x501c4c,null));};
\ No newline at end of file
+var _0x5eb8=['answeringMachine','countContactsIvrCampaignHopperFinal','noSuchContacts','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','NOW()','from','toString','state','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','cm_hopper_final','state\x20=\x204','group','CampaignId','ANY_VALUE(CampaignId)','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','CampaignId\x20=\x20?','calleridnum','checkContactHopper','CmHopper','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','apply','save','destroy','then','error','name','send','index','CmHopperFinal','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','rawAttributes','length','options','find','describe','update','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts'];(function(_0x56cdd7,_0x2f2554){var _0x1e1302=function(_0x16edde){while(--_0x16edde){_0x56cdd7['push'](_0x56cdd7['shift']());}};_0x1e1302(++_0x2f2554);}(_0x5eb8,0xb0));var _0x85eb=function(_0x4e7c2,_0x3b3347){_0x4e7c2=_0x4e7c2-0x0;var _0x84bb35=_0x5eb8[_0x4e7c2];return _0x84bb35;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x85eb('0x0'));var zipdir=require(_0x85eb('0x1'));var jsonpatch=require(_0x85eb('0x2'));var rp=require(_0x85eb('0x3'));var moment=require(_0x85eb('0x4'));var BPromise=require(_0x85eb('0x5'));var Mustache=require(_0x85eb('0x6'));var util=require(_0x85eb('0x7'));var path=require(_0x85eb('0x8'));var sox=require(_0x85eb('0x9'));var csv=require(_0x85eb('0xa'));var ejs=require(_0x85eb('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x85eb('0xc'));var crypto=require(_0x85eb('0xd'));var jsforce=require(_0x85eb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x85eb('0xa'));var querystring=require('querystring');var Papa=require(_0x85eb('0xf'));var authService=require(_0x85eb('0x10'));var hardwareService=require(_0x85eb('0x11'));var Redis=require(_0x85eb('0x12'));var qs=require(_0x85eb('0x13'));var logger=require(_0x85eb('0x14'))(_0x85eb('0x15'));var utils=require('../../config/utils');var config=require(_0x85eb('0x16'));var db=require(_0x85eb('0x17'))['db'];function respondWithStatusCode(_0x5c52a4,_0x2af376){_0x2af376=_0x2af376||0xcc;return function(_0x784583){if(_0x784583){return _0x5c52a4[_0x85eb('0x18')](_0x2af376);}return _0x5c52a4[_0x85eb('0x19')](_0x2af376)['end']();};}function respondWithResult(_0x548628,_0x394c74){_0x394c74=_0x394c74||0xc8;return function(_0x5c760a){if(_0x5c760a){return _0x548628[_0x85eb('0x19')](_0x394c74)[_0x85eb('0x1a')](_0x5c760a);}};}function respondWithFilteredResult(_0x600a7f,_0x1604ba){return function(_0x183b0c){if(_0x183b0c){var _0x49efdf=_0x183b0c[_0x85eb('0x1b')],_0x2e5c0a=_0x1604ba[_0x85eb('0x1c')],_0x59237b=_0x1604ba[_0x85eb('0x1c')]+_0x1604ba['limit'],_0x17140b;if(_0x59237b>=_0x49efdf){_0x59237b=_0x49efdf;_0x17140b=0xc8;}else{_0x17140b=0xce;}_0x600a7f['status'](_0x17140b);return _0x600a7f['set'](_0x85eb('0x1d'),_0x2e5c0a+'-'+_0x59237b+'/'+_0x49efdf)[_0x85eb('0x1a')](_0x183b0c);}return null;};}function patchUpdates(_0x10cf2f){return function(_0x2e986c){try{jsonpatch[_0x85eb('0x1e')](_0x2e986c,_0x10cf2f,!![]);}catch(_0x34f875){return BPromise['reject'](_0x34f875);}return _0x2e986c[_0x85eb('0x1f')]();};}function saveUpdates(_0x7244fc,_0xd9f06d){return function(_0x4e8041){if(_0x4e8041){return _0x4e8041['update'](_0x7244fc)['then'](function(_0x55b9e4){return _0x55b9e4;});}return null;};}function removeEntity(_0x244667,_0x3fa785){return function(_0x329fc5){if(_0x329fc5){return _0x329fc5[_0x85eb('0x20')]()[_0x85eb('0x21')](function(){_0x244667[_0x85eb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5491d5,_0x5b48d9){return function(_0x298e84){if(!_0x298e84){_0x5491d5[_0x85eb('0x18')](0x194);}return _0x298e84;};}function handleError(_0x3f7a4d,_0x28b87d){_0x28b87d=_0x28b87d||0x1f4;return function(_0x312b3e){logger[_0x85eb('0x22')](_0x312b3e['stack']);if(_0x312b3e[_0x85eb('0x23')]){delete _0x312b3e[_0x85eb('0x23')];}_0x3f7a4d[_0x85eb('0x19')](_0x28b87d)[_0x85eb('0x24')](_0x312b3e);};}exports[_0x85eb('0x25')]=function(_0x57a03c,_0x2e5aa3){var _0x792d3a={},_0x291557={},_0x3e7eb9={'count':0x0,'rows':[]};var _0x40f13e=db[_0x85eb('0x26')]['rawAttributes'];_0x291557['model']=_[_0x85eb('0x27')](_0x40f13e);_0x291557['query']=_[_0x85eb('0x27')](_0x57a03c['query']);_0x291557[_0x85eb('0x28')]=_[_0x85eb('0x29')](_0x291557[_0x85eb('0x2a')],_0x291557[_0x85eb('0x2b')]);_0x792d3a[_0x85eb('0x2c')]=_[_0x85eb('0x29')](_0x291557[_0x85eb('0x2a')],qs['fields'](_0x57a03c[_0x85eb('0x2b')][_0x85eb('0x2d')]));_0x792d3a['attributes']=_0x792d3a[_0x85eb('0x2c')]['length']?_0x792d3a['attributes']:_0x291557[_0x85eb('0x2a')];if(!_0x57a03c[_0x85eb('0x2b')][_0x85eb('0x2e')](_0x85eb('0x2f'))){_0x792d3a[_0x85eb('0x30')]=qs[_0x85eb('0x30')](_0x57a03c[_0x85eb('0x2b')][_0x85eb('0x30')]);_0x792d3a[_0x85eb('0x1c')]=qs[_0x85eb('0x1c')](_0x57a03c['query'][_0x85eb('0x1c')]);}_0x792d3a[_0x85eb('0x31')]=qs['sort'](_0x57a03c['query'][_0x85eb('0x32')]);_0x792d3a[_0x85eb('0x33')]=qs[_0x85eb('0x28')](_[_0x85eb('0x34')](_0x57a03c[_0x85eb('0x2b')],_0x291557[_0x85eb('0x28')]));if(_0x57a03c[_0x85eb('0x2b')][_0x85eb('0x35')]){_0x792d3a[_0x85eb('0x33')]=_[_0x85eb('0x36')](_0x792d3a[_0x85eb('0x33')],{'$or':_[_0x85eb('0x37')](_0x40f13e,function(_0x317d86){if(_0x317d86[_0x85eb('0x38')]['key']!==_0x85eb('0x39')){var _0x3dfe74={};_0x3dfe74[_0x317d86['field']]={'$like':'%'+_0x57a03c['query'][_0x85eb('0x35')]+'%'};return _0x3dfe74;}})});}_0x792d3a=_[_0x85eb('0x36')]({},_0x792d3a,_0x57a03c['options']);var _0x4317bc={'where':_0x792d3a['where']};return db[_0x85eb('0x26')]['count'](_0x4317bc)[_0x85eb('0x21')](function(_0x5ce7e4){_0x3e7eb9[_0x85eb('0x1b')]=_0x5ce7e4;if(_0x57a03c['query'][_0x85eb('0x3a')]){_0x792d3a[_0x85eb('0x3b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x85eb('0x3c')](_0x792d3a);})['then'](function(_0x2a6baa){_0x3e7eb9[_0x85eb('0x3d')]=_0x2a6baa;return _0x3e7eb9;})['then'](respondWithFilteredResult(_0x2e5aa3,_0x792d3a))[_0x85eb('0x3e')](handleError(_0x2e5aa3,null));};exports['show']=function(_0x5495cf,_0x1b8a71){var _0x4edb2d={'raw':!![],'where':{'id':_0x5495cf[_0x85eb('0x3f')]['id']}},_0x17cc20={};_0x17cc20['model']=_['keys'](db[_0x85eb('0x26')][_0x85eb('0x40')]);_0x17cc20['query']=_['keys'](_0x5495cf[_0x85eb('0x2b')]);_0x17cc20[_0x85eb('0x28')]=_[_0x85eb('0x29')](_0x17cc20[_0x85eb('0x2a')],_0x17cc20[_0x85eb('0x2b')]);_0x4edb2d['attributes']=_[_0x85eb('0x29')](_0x17cc20[_0x85eb('0x2a')],qs[_0x85eb('0x2d')](_0x5495cf[_0x85eb('0x2b')][_0x85eb('0x2d')]));_0x4edb2d[_0x85eb('0x2c')]=_0x4edb2d[_0x85eb('0x2c')][_0x85eb('0x41')]?_0x4edb2d[_0x85eb('0x2c')]:_0x17cc20['model'];if(_0x5495cf[_0x85eb('0x2b')][_0x85eb('0x3a')]){_0x4edb2d['include']=[{'all':!![]}];}_0x4edb2d=_[_0x85eb('0x36')]({},_0x4edb2d,_0x5495cf[_0x85eb('0x42')]);return db[_0x85eb('0x26')][_0x85eb('0x43')](_0x4edb2d)[_0x85eb('0x21')](handleEntityNotFound(_0x1b8a71,null))[_0x85eb('0x21')](respondWithResult(_0x1b8a71,null))['catch'](handleError(_0x1b8a71,null));};exports[_0x85eb('0x44')]=function(_0x1258bc,_0x1ead1d){return db[_0x85eb('0x26')][_0x85eb('0x44')]()[_0x85eb('0x21')](respondWithResult(_0x1ead1d,null))[_0x85eb('0x3e')](handleError(_0x1ead1d,null));};exports[_0x85eb('0x45')]=function(_0x5ed246,_0x1298d4){if(_0x5ed246[_0x85eb('0x46')][_0x85eb('0x47')]){delete _0x5ed246[_0x85eb('0x46')][_0x85eb('0x47')];}return db[_0x85eb('0x26')][_0x85eb('0x43')]({'where':{'uniqueid':_0x5ed246[_0x85eb('0x3f')]['id']}})[_0x85eb('0x21')](handleEntityNotFound(_0x1298d4,null))[_0x85eb('0x21')](saveUpdates(_0x5ed246[_0x85eb('0x46')],null))[_0x85eb('0x21')](respondWithResult(_0x1298d4,null))['catch'](handleError(_0x1298d4,null));};exports[_0x85eb('0x48')]=function(_0x2c951b,_0x22d9d6,_0x4e60dc){return db[_0x85eb('0x26')][_0x85eb('0x3c')]({'raw':![],'where':{'VoiceQueueId':_0x2c951b[_0x85eb('0x3f')]['id']},'attributes':[[db[_0x85eb('0x49')]['fn'](_0x85eb('0x4a'),db['sequelize']['fn']('IF',db[_0x85eb('0x49')][_0x85eb('0x4b')](_0x85eb('0x4c')))),'noSuchContacts'],[db[_0x85eb('0x49')]['fn'](_0x85eb('0x4a'),db[_0x85eb('0x49')]['fn']('IF',db['sequelize']['literal'](_0x85eb('0x4d')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x85eb('0x4a'),db['sequelize']['fn']('IF',db[_0x85eb('0x49')][_0x85eb('0x4b')]('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0x85eb('0x49')]['fn'](_0x85eb('0x4a'),db[_0x85eb('0x49')]['fn']('IF',db[_0x85eb('0x49')][_0x85eb('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),_0x85eb('0x4e')],[db[_0x85eb('0x49')]['fn'](_0x85eb('0x4a'),db[_0x85eb('0x49')]['fn']('IF',db[_0x85eb('0x49')]['literal'](_0x85eb('0x4f')))),'dropContacts'],[db[_0x85eb('0x49')]['fn'](_0x85eb('0x4a'),db['sequelize']['fn']('IF',db[_0x85eb('0x49')][_0x85eb('0x4b')](_0x85eb('0x50')))),_0x85eb('0x51')],[db[_0x85eb('0x49')]['fn'](_0x85eb('0x4a'),db['sequelize']['fn']('IF',db[_0x85eb('0x49')]['literal'](_0x85eb('0x52')))),_0x85eb('0x53')],[db['sequelize']['fn'](_0x85eb('0x4a'),db[_0x85eb('0x49')]['fn']('IF',db['sequelize'][_0x85eb('0x4b')]('`state`\x20=\x2019,\x201,\x20null'))),_0x85eb('0x54')]]})[_0x85eb('0x21')](handleEntityNotFound(_0x22d9d6,null))[_0x85eb('0x21')](respondWithResult(_0x22d9d6,null))[_0x85eb('0x3e')](handleError(_0x22d9d6,null));};exports[_0x85eb('0x55')]=function(_0x15d4a7,_0x5a729e,_0x2227ea){return db[_0x85eb('0x26')][_0x85eb('0x3c')]({'raw':![],'where':{'CampaignId':_0x15d4a7[_0x85eb('0x3f')]['id']},'attributes':[[db[_0x85eb('0x49')]['fn'](_0x85eb('0x4a'),db[_0x85eb('0x49')]['fn']('IF',db[_0x85eb('0x49')][_0x85eb('0x4b')](_0x85eb('0x4c')))),_0x85eb('0x56')],[db['sequelize']['fn'](_0x85eb('0x4a'),db[_0x85eb('0x49')]['fn']('IF',db[_0x85eb('0x49')][_0x85eb('0x4b')](_0x85eb('0x4d')))),_0x85eb('0x57')],[db['sequelize']['fn'](_0x85eb('0x4a'),db['sequelize']['fn']('IF',db[_0x85eb('0x49')][_0x85eb('0x4b')](_0x85eb('0x58')))),_0x85eb('0x59')],[db[_0x85eb('0x49')]['fn']('COUNT',db[_0x85eb('0x49')]['fn']('IF',db[_0x85eb('0x49')][_0x85eb('0x4b')](_0x85eb('0x5a')))),_0x85eb('0x4e')],[db[_0x85eb('0x49')]['fn'](_0x85eb('0x4a'),db[_0x85eb('0x49')]['fn']('IF',db['sequelize'][_0x85eb('0x4b')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x85eb('0x5b')],[db[_0x85eb('0x49')]['fn'](_0x85eb('0x4a'),db[_0x85eb('0x49')]['fn']('IF',db[_0x85eb('0x49')]['literal'](_0x85eb('0x50')))),_0x85eb('0x51')],[db[_0x85eb('0x49')]['fn'](_0x85eb('0x4a'),db[_0x85eb('0x49')]['fn']('IF',db[_0x85eb('0x49')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x85eb('0x53')],[db['sequelize']['fn'](_0x85eb('0x4a'),db[_0x85eb('0x49')]['fn']('IF',db[_0x85eb('0x49')][_0x85eb('0x4b')](_0x85eb('0x5c')))),_0x85eb('0x54')]]})['then'](handleEntityNotFound(_0x5a729e,null))[_0x85eb('0x21')](respondWithResult(_0x5a729e,null))[_0x85eb('0x3e')](handleError(_0x5a729e,null));};exports[_0x85eb('0x5d')]=function(_0x2e65d5,_0x52bbdf,_0x1d513c){return db[_0x85eb('0x5e')][_0x85eb('0x43')]({'where':{'id':_0x2e65d5[_0x85eb('0x3f')]['id']}})['then'](handleEntityNotFound(_0x52bbdf,null))[_0x85eb('0x21')](function(_0x2e6734){var _0x13a040;if(_0x2e6734){_0x13a040=squel[_0x85eb('0x5f')]()[_0x85eb('0x60')](_0x85eb('0x61'))[_0x85eb('0x62')]([_0x85eb('0x63'),_0x85eb('0x64'),_0x85eb('0x65'),_0x85eb('0x66'),_0x85eb('0x67'),_0x85eb('0x68'),_0x85eb('0x69')],squel[_0x85eb('0x6a')]()[_0x85eb('0x6b')](_0x85eb('0x6c'),_0x85eb('0x63'))[_0x85eb('0x6b')]('NOW()',_0x85eb('0x64'))['field'](_0x85eb('0x6d'),_0x85eb('0x65'))[_0x85eb('0x6b')](_0x85eb('0x6e'),_0x85eb('0x66'))[_0x85eb('0x6b')](_0x85eb('0x6f'),_0x85eb('0x67'))[_0x85eb('0x6b')]('NOW()',_0x85eb('0x68'))[_0x85eb('0x6b')](_0x85eb('0x70'),_0x85eb('0x69'))[_0x85eb('0x71')]('cm_hopper_final')[_0x85eb('0x33')]('VoiceQueueId\x20=\x20?',_0x2e65d5[_0x85eb('0x3f')]['id'][_0x85eb('0x72')]())[_0x85eb('0x33')]('state\x20=\x20?',_0x2e65d5[_0x85eb('0x46')][_0x85eb('0x73')][_0x85eb('0x72')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x85eb('0x33')](_0x85eb('0x74'),squel[_0x85eb('0x6a')]()[_0x85eb('0x6b')]('phone')[_0x85eb('0x71')]('cm_hopper')[_0x85eb('0x33')](_0x85eb('0x75'),_0x2e65d5[_0x85eb('0x3f')]['id'][_0x85eb('0x72')]()))[_0x85eb('0x33')](_0x85eb('0x74'),squel['select']()[_0x85eb('0x6b')]('calleridnum')[_0x85eb('0x71')](_0x85eb('0x76'))[_0x85eb('0x33')](_0x85eb('0x75'),_0x2e65d5[_0x85eb('0x3f')]['id'][_0x85eb('0x72')]())[_0x85eb('0x33')](_0x85eb('0x77')))[_0x85eb('0x78')]('ContactId'))[_0x85eb('0x72')]();return db[_0x85eb('0x49')]['query'](_0x13a040);}return[];})['then'](respondWithResult(_0x52bbdf,null))[_0x85eb('0x3e')](handleError(_0x52bbdf,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x10b50d,_0x4e10f2,_0x101ae0){return db['Campaign'][_0x85eb('0x43')]({'where':{'id':_0x10b50d[_0x85eb('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4e10f2,null))[_0x85eb('0x21')](function(_0x285642){var _0x555236;if(_0x285642){_0x555236=squel[_0x85eb('0x5f')]()[_0x85eb('0x60')](_0x85eb('0x61'))[_0x85eb('0x62')](['phone',_0x85eb('0x64'),'ContactId',_0x85eb('0x66'),_0x85eb('0x79'),_0x85eb('0x68'),'updatedAt'],squel[_0x85eb('0x6a')]()[_0x85eb('0x6b')](_0x85eb('0x6c'),'phone')[_0x85eb('0x6b')]('NOW()',_0x85eb('0x64'))[_0x85eb('0x6b')](_0x85eb('0x6d'),'ContactId')['field']('ANY_VALUE(ListId)',_0x85eb('0x66'))[_0x85eb('0x6b')](_0x85eb('0x7a'),'CampaignId')[_0x85eb('0x6b')](_0x85eb('0x70'),_0x85eb('0x68'))[_0x85eb('0x6b')](_0x85eb('0x70'),'updatedAt')['from'](_0x85eb('0x76'))[_0x85eb('0x33')]('CampaignId\x20=\x20?',_0x10b50d[_0x85eb('0x3f')]['id'][_0x85eb('0x72')]())[_0x85eb('0x33')](_0x85eb('0x7b'),_0x10b50d[_0x85eb('0x46')][_0x85eb('0x73')][_0x85eb('0x72')]())[_0x85eb('0x33')](_0x85eb('0x7c'))[_0x85eb('0x33')](_0x85eb('0x74'),squel[_0x85eb('0x6a')]()[_0x85eb('0x6b')](_0x85eb('0x63'))[_0x85eb('0x71')]('cm_hopper')[_0x85eb('0x33')](_0x85eb('0x7d'),_0x10b50d[_0x85eb('0x3f')]['id'][_0x85eb('0x72')]()))[_0x85eb('0x33')](_0x85eb('0x74'),squel[_0x85eb('0x6a')]()[_0x85eb('0x6b')](_0x85eb('0x7e'))[_0x85eb('0x71')]('cm_hopper_final')[_0x85eb('0x33')](_0x85eb('0x7d'),_0x10b50d[_0x85eb('0x3f')]['id'][_0x85eb('0x72')]())['where'](_0x85eb('0x77')))[_0x85eb('0x78')](_0x85eb('0x65')))[_0x85eb('0x72')]();return db[_0x85eb('0x49')][_0x85eb('0x2b')](_0x555236);}return[];})['then'](respondWithResult(_0x4e10f2,null))[_0x85eb('0x3e')](handleError(_0x4e10f2,null));};exports[_0x85eb('0x7f')]=function(_0x12c3be,_0x59fc6a,_0x15802f){return db[_0x85eb('0x80')][_0x85eb('0x81')]({'where':{'VoiceQueueId':_0x12c3be[_0x85eb('0x46')][_0x85eb('0x67')],'CampaignId':_0x12c3be[_0x85eb('0x46')][_0x85eb('0x79')],'ContactId':_0x12c3be[_0x85eb('0x46')]['ContactId']}})[_0x85eb('0x21')](handleEntityNotFound(_0x59fc6a,null))[_0x85eb('0x21')](function(_0x4ad2cf){if(_0x4ad2cf){return _0x4ad2cf;}return null;})['then'](respondWithResult(_0x59fc6a,null))[_0x85eb('0x3e')](handleError(_0x59fc6a,null));};
\ No newline at end of file
index 897b7d6..e3f7e18 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4975=['calleridnum','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','./cmHopperFinal.attributes','exports','define','cm_hopper_final'];(function(_0x2c9e76,_0x3cc6ba){var _0x2850f3=function(_0x1ac7fc){while(--_0x1ac7fc){_0x2c9e76['push'](_0x2c9e76['shift']());}};_0x2850f3(++_0x3cc6ba);}(_0x4975,0x86));var _0x5497=function(_0x521a48,_0x331b24){_0x521a48=_0x521a48-0x0;var _0x5883e6=_0x4975[_0x521a48];return _0x5883e6;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var attributes=require(_0x5497('0x6'));module[_0x5497('0x7')]=function(_0xeb31af,_0xbb1888){return _0xeb31af[_0x5497('0x8')]('CmHopperFinal',attributes,{'tableName':_0x5497('0x9'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x5497('0xa')]},{'name':_0x5497('0xb'),'fields':[_0x5497('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x1261=['./cmHopperFinal.attributes','exports','cm_hopper_final','calleridnum','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x313685,_0x394236){var _0x2cacd5=function(_0x3bfe9e){while(--_0x3bfe9e){_0x313685['push'](_0x313685['shift']());}};_0x2cacd5(++_0x394236);}(_0x1261,0x144));var _0x1126=function(_0xe4f7a3,_0x449042){_0xe4f7a3=_0xe4f7a3-0x0;var _0xb1da7c=_0x1261[_0xe4f7a3];return _0xb1da7c;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var attributes=require(_0x1126('0x6'));module[_0x1126('0x7')]=function(_0x21a480,_0x75a851){return _0x21a480['define']('CmHopperFinal',attributes,{'tableName':_0x1126('0x8'),'paranoid':![],'indexes':[{'name':_0x1126('0x9'),'fields':['calleridnum']},{'name':_0x1126('0xa'),'fields':[_0x1126('0xa')]}],'timestamps':!![]});};
\ No newline at end of file
index 1c9dab9..4dcd9fd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcb91=['code','message','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','raw','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x158630,_0x2d9759){var _0x20f146=function(_0x4e545){while(--_0x4e545){_0x158630['push'](_0x158630['shift']());}};_0x20f146(++_0x2d9759);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5302fb,_0x1a2db3){_0x5302fb=_0x5302fb-0x0;var _0x43e6a4=_0xcb91[_0x5302fb];return _0x43e6a4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('CmHopperFinal,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});}exports[_0x1cb9('0x14')]=function(_0x23d3a9){var _0x4e1340=this;return new Promise(function(_0x479d43,_0x1b2fa6){return db[_0x1cb9('0x15')][_0x1cb9('0x16')](_0x23d3a9[_0x1cb9('0x17')],{'raw':_0x23d3a9[_0x1cb9('0x18')]?_0x23d3a9[_0x1cb9('0x18')][_0x1cb9('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x559bcc){logger[_0x1cb9('0xa')]('CreateCmHopperFinal',_0x23d3a9);logger[_0x1cb9('0xd')](_0x1cb9('0x14'),_0x23d3a9,JSON['stringify'](_0x559bcc));_0x479d43(_0x559bcc);})['catch'](function(_0x2e3854){logger[_0x1cb9('0x10')](_0x1cb9('0x14'),_0x2e3854[_0x1cb9('0x12')],_0x23d3a9);_0x1b2fa6(_0x4e1340[_0x1cb9('0x10')](0x1f4,_0x2e3854[_0x1cb9('0x12')]));});});};
\ No newline at end of file
+var _0xd64b=['http','request','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperFinal','CmHopperFinal','body','options','then','debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x580a93,_0x96ddbe){var _0x53415f=function(_0x2f422f){while(--_0x2f422f){_0x580a93['push'](_0x580a93['shift']());}};_0x53415f(++_0x96ddbe);}(_0xd64b,0xc1));var _0xbd64=function(_0x51db88,_0x3671eb){_0x51db88=_0x51db88-0x0;var _0x1eaec0=_0xd64b[_0x51db88];return _0x1eaec0;};'use strict';var _=require(_0xbd64('0x0'));var util=require('util');var moment=require(_0xbd64('0x1'));var BPromise=require('bluebird');var rs=require(_0xbd64('0x2'));var fs=require('fs');var Redis=require(_0xbd64('0x3'));var db=require(_0xbd64('0x4'))['db'];var utils=require(_0xbd64('0x5'));var logger=require(_0xbd64('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xbd64('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x32995f,_0x3e700e,_0x38204e){return new BPromise(function(_0x3f1f17,_0x2b8543){return client[_0xbd64('0x8')](_0x32995f,_0x38204e)['then'](function(_0x5ae70c){logger[_0xbd64('0x9')](_0xbd64('0xa'),_0x3e700e,_0xbd64('0xb'));logger['debug'](_0xbd64('0xc'),_0x3e700e,_0xbd64('0xb'),JSON[_0xbd64('0xd')](_0x5ae70c));if(_0x5ae70c[_0xbd64('0xe')]){if(_0x5ae70c['error'][_0xbd64('0xf')]===0x1f4){logger['error'](_0xbd64('0xa'),_0x3e700e,_0x5ae70c[_0xbd64('0xe')][_0xbd64('0x10')]);return _0x2b8543(_0x5ae70c[_0xbd64('0xe')][_0xbd64('0x10')]);}logger[_0xbd64('0xe')](_0xbd64('0xa'),_0x3e700e,_0x5ae70c[_0xbd64('0xe')][_0xbd64('0x10')]);return _0x3f1f17(_0x5ae70c['error'][_0xbd64('0x10')]);}else{logger[_0xbd64('0x9')](_0xbd64('0xa'),_0x3e700e,_0xbd64('0xb'));_0x3f1f17(_0x5ae70c[_0xbd64('0x11')]['message']);}})[_0xbd64('0x12')](function(_0x5332e0){logger[_0xbd64('0xe')](_0xbd64('0xa'),_0x3e700e,_0x5332e0);_0x2b8543(_0x5332e0);});});}exports[_0xbd64('0x13')]=function(_0x1d7a14){var _0x17d015=this;return new Promise(function(_0x2f4554,_0xa5491d){return db[_0xbd64('0x14')]['create'](_0x1d7a14[_0xbd64('0x15')],{'raw':_0x1d7a14[_0xbd64('0x16')]?_0x1d7a14['options']['raw']===undefined?!![]:![]:!![]})[_0xbd64('0x17')](function(_0x42b328){logger[_0xbd64('0x9')](_0xbd64('0x13'),_0x1d7a14);logger[_0xbd64('0x18')](_0xbd64('0x13'),_0x1d7a14,JSON['stringify'](_0x42b328));_0x2f4554(_0x42b328);})['catch'](function(_0x6038f){logger[_0xbd64('0xe')](_0xbd64('0x13'),_0x6038f[_0xbd64('0x10')],_0x1d7a14);_0xa5491d(_0x17d015['error'](0x1f4,_0x6038f['message']));});});};
\ No newline at end of file
index e730a26..d1066f9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9c44=['put','update','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','post','/checkContactHopper','checkContactHopper'];(function(_0x14e0ce,_0x503f7a){var _0xa5a36e=function(_0x20fc1f){while(--_0x20fc1f){_0x14e0ce['push'](_0x14e0ce['shift']());}};_0xa5a36e(++_0x503f7a);}(_0x9c44,0x178));var _0x49c4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9c44[_0x1694f5];return _0x5b4321;};'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 auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['get'](_0x49c4('0xb'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xc')]);router[_0x49c4('0x6')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller[_0x49c4('0xd')]);router[_0x49c4('0x6')]('/campaign/countAttributes/:id',auth[_0x49c4('0x9')](),controller[_0x49c4('0xe')]);router['post']('/voice/queue/moveContacts/:id',auth[_0x49c4('0x9')](),controller[_0x49c4('0xf')]);router['post'](_0x49c4('0x10'),auth[_0x49c4('0x9')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x49c4('0x11')](_0x49c4('0x12'),auth[_0x49c4('0x9')](),controller[_0x49c4('0x13')]);router[_0x49c4('0x14')](_0x49c4('0xb'),auth[_0x49c4('0x9')](),controller[_0x49c4('0x15')]);module['exports']=router;
\ No newline at end of file
+var _0xa9e0=['moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','/describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id'];(function(_0x515afd,_0x1a1e91){var _0x536d53=function(_0x1d3a89){while(--_0x1d3a89){_0x515afd['push'](_0x515afd['shift']());}};_0x536d53(++_0x1a1e91);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router['post']('/voice/queue/moveContacts/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x11')]);router['post'](_0x0a9e('0x12'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x14')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);module[_0x0a9e('0x15')]=router;
\ No newline at end of file
index 691f661..25ffe8c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe009=['DATE','BOOLEAN','sequelize','exports','INTEGER','STRING'];(function(_0x33a17b,_0x4e04ff){var _0x57e182=function(_0x5a62b7){while(--_0x5a62b7){_0x33a17b['push'](_0x33a17b['shift']());}};_0x57e182(++_0x4e04ff);}(_0xe009,0x122));var _0x9e00=function(_0x371c11,_0x450fa0){_0x371c11=_0x371c11-0x0;var _0x2d5e66=_0xe009[_0x371c11];return _0x2d5e66;};'use strict';var Sequelize=require(_0x9e00('0x0'));module[_0x9e00('0x1')]={'state':{'type':Sequelize[_0x9e00('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x9e00('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x9e00('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9e00('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x9e00('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x9e00('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x9e00('0x3')]},'originatecalleridname':{'type':Sequelize[_0x9e00('0x3')]},'calleridnum':{'type':Sequelize[_0x9e00('0x3')]},'calleridname':{'type':Sequelize[_0x9e00('0x3')]},'starttime':{'type':Sequelize[_0x9e00('0x4')]},'responsetime':{'type':Sequelize[_0x9e00('0x4')]},'answertime':{'type':Sequelize[_0x9e00('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x9e00('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x9e00('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x9e00('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x9e00('0x3')]},'campaign':{'type':Sequelize[_0x9e00('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x9e00('0x3')]},'reason':{'type':Sequelize[_0x9e00('0x3')]},'amd':{'type':Sequelize[_0x9e00('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x9e00('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x9e00('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x9e00('0x5')],'defaultValue':![]}};
\ No newline at end of file
+var _0x63b6=['BOOLEAN','sequelize','exports','INTEGER','DATE','STRING'];(function(_0x1cd086,_0x571ed7){var _0x560935=function(_0x542187){while(--_0x542187){_0x1cd086['push'](_0x1cd086['shift']());}};_0x560935(++_0x571ed7);}(_0x63b6,0x127));var _0x663b=function(_0x2f06e4,_0x5c5045){_0x2f06e4=_0x2f06e4-0x0;var _0x3a0b9a=_0x63b6[_0x2f06e4];return _0x3a0b9a;};'use strict';var Sequelize=require(_0x663b('0x0'));module[_0x663b('0x1')]={'state':{'type':Sequelize[_0x663b('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x663b('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x663b('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x663b('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x663b('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x663b('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x663b('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x663b('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x663b('0x3')]},'droptime':{'type':Sequelize[_0x663b('0x3')]},'endtime':{'type':Sequelize[_0x663b('0x3')]},'ringtime':{'type':Sequelize[_0x663b('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x663b('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x663b('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x663b('0x4')]},'campaign':{'type':Sequelize[_0x663b('0x4')]},'campaigntype':{'type':Sequelize[_0x663b('0x4')]},'membername':{'type':Sequelize[_0x663b('0x4')]},'reason':{'type':Sequelize[_0x663b('0x4')]},'amd':{'type':Sequelize[_0x663b('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x663b('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x663b('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x663b('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x663b('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x663b('0x5')],'defaultValue':![]}};
\ No newline at end of file
index 937422a..0de1de0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8c32=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','CmHopperHistory','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','key','VIRTUAL','options','includeAll','include','catch','params','rawAttributes','create','body','describe','uniqueid','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel'];(function(_0x371bf6,_0x28d7ce){var _0x16209e=function(_0x3890c5){while(--_0x3890c5){_0x371bf6['push'](_0x371bf6['shift']());}};_0x16209e(++_0x28d7ce);}(_0x8c32,0x89));var _0x28c3=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x8c32[_0x25e7cb];return _0x375d92;};'use strict';var pdf=require(_0x28c3('0x0'));var emlformat=require(_0x28c3('0x1'));var rimraf=require(_0x28c3('0x2'));var zipdir=require(_0x28c3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x28c3('0x4'));var moment=require(_0x28c3('0x5'));var BPromise=require(_0x28c3('0x6'));var Mustache=require('mustache');var util=require(_0x28c3('0x7'));var path=require(_0x28c3('0x8'));var sox=require('sox');var csv=require(_0x28c3('0x9'));var ejs=require(_0x28c3('0xa'));var fs=require('fs');var _=require(_0x28c3('0xb'));var squel=require(_0x28c3('0xc'));var crypto=require(_0x28c3('0xd'));var jsforce=require(_0x28c3('0xe'));var deskjs=require(_0x28c3('0xf'));var toCsv=require(_0x28c3('0x9'));var querystring=require(_0x28c3('0x10'));var Papa=require(_0x28c3('0x11'));var authService=require(_0x28c3('0x12'));var hardwareService=require(_0x28c3('0x13'));var Redis=require(_0x28c3('0x14'));var qs=require(_0x28c3('0x15'));var logger=require(_0x28c3('0x16'))(_0x28c3('0x17'));var utils=require('../../config/utils');var config=require(_0x28c3('0x18'));var db=require(_0x28c3('0x19'))['db'];function respondWithStatusCode(_0x58b3af,_0x4ae211){_0x4ae211=_0x4ae211||0xcc;return function(_0x1698c2){if(_0x1698c2){return _0x58b3af[_0x28c3('0x1a')](_0x4ae211);}return _0x58b3af[_0x28c3('0x1b')](_0x4ae211)['end']();};}function respondWithResult(_0x6afc54,_0x7ed0a4){_0x7ed0a4=_0x7ed0a4||0xc8;return function(_0x524b6a){if(_0x524b6a){return _0x6afc54[_0x28c3('0x1b')](_0x7ed0a4)[_0x28c3('0x1c')](_0x524b6a);}};}function respondWithFilteredResult(_0x2d48fe,_0x132b6b){return function(_0x1030f9){if(_0x1030f9){var _0x8904d3=_0x1030f9[_0x28c3('0x1d')],_0x5eb4c8=_0x132b6b[_0x28c3('0x1e')],_0x5a95c9=_0x132b6b['offset']+_0x132b6b[_0x28c3('0x1f')],_0x2fded2;if(_0x5a95c9>=_0x8904d3){_0x5a95c9=_0x8904d3;_0x2fded2=0xc8;}else{_0x2fded2=0xce;}_0x2d48fe[_0x28c3('0x1b')](_0x2fded2);return _0x2d48fe[_0x28c3('0x20')](_0x28c3('0x21'),_0x5eb4c8+'-'+_0x5a95c9+'/'+_0x8904d3)['json'](_0x1030f9);}return null;};}function patchUpdates(_0x4af8d5){return function(_0x383148){try{jsonpatch[_0x28c3('0x22')](_0x383148,_0x4af8d5,!![]);}catch(_0x255625){return BPromise[_0x28c3('0x23')](_0x255625);}return _0x383148[_0x28c3('0x24')]();};}function saveUpdates(_0xbf116a,_0x37cefe){return function(_0x2dc26a){if(_0x2dc26a){return _0x2dc26a[_0x28c3('0x25')](_0xbf116a)['then'](function(_0x8c9f29){return _0x8c9f29;});}return null;};}function removeEntity(_0x179243,_0x2a198d){return function(_0x2559fe){if(_0x2559fe){return _0x2559fe[_0x28c3('0x26')]()[_0x28c3('0x27')](function(){_0x179243[_0x28c3('0x1b')](0xcc)[_0x28c3('0x28')]();});}};}function handleEntityNotFound(_0x1008cf,_0x313778){return function(_0x1176d1){if(!_0x1176d1){_0x1008cf[_0x28c3('0x1a')](0x194);}return _0x1176d1;};}function handleError(_0x4315a4,_0x54c26c){_0x54c26c=_0x54c26c||0x1f4;return function(_0x1088a4){logger[_0x28c3('0x29')](_0x1088a4[_0x28c3('0x2a')]);if(_0x1088a4['name']){delete _0x1088a4[_0x28c3('0x2b')];}_0x4315a4[_0x28c3('0x1b')](_0x54c26c)[_0x28c3('0x2c')](_0x1088a4);};}exports[_0x28c3('0x2d')]=function(_0x357ed5,_0x17cccb){var _0x417378={},_0x324e88={},_0x188285={'count':0x0,'rows':[]};var _0x34b02b=db[_0x28c3('0x2e')]['rawAttributes'];_0x324e88['model']=_[_0x28c3('0x2f')](_0x34b02b);_0x324e88[_0x28c3('0x30')]=_[_0x28c3('0x2f')](_0x357ed5[_0x28c3('0x30')]);_0x324e88[_0x28c3('0x31')]=_[_0x28c3('0x32')](_0x324e88['model'],_0x324e88[_0x28c3('0x30')]);_0x417378[_0x28c3('0x33')]=_['intersection'](_0x324e88[_0x28c3('0x34')],qs[_0x28c3('0x35')](_0x357ed5[_0x28c3('0x30')]['fields']));_0x417378[_0x28c3('0x33')]=_0x417378['attributes'][_0x28c3('0x36')]?_0x417378[_0x28c3('0x33')]:_0x324e88[_0x28c3('0x34')];if(!_0x357ed5[_0x28c3('0x30')][_0x28c3('0x37')](_0x28c3('0x38'))){_0x417378[_0x28c3('0x1f')]=qs['limit'](_0x357ed5['query'][_0x28c3('0x1f')]);_0x417378['offset']=qs[_0x28c3('0x1e')](_0x357ed5[_0x28c3('0x30')]['offset']);}_0x417378[_0x28c3('0x39')]=qs[_0x28c3('0x3a')](_0x357ed5[_0x28c3('0x30')][_0x28c3('0x3a')]);_0x417378[_0x28c3('0x3b')]=qs[_0x28c3('0x31')](_['pick'](_0x357ed5[_0x28c3('0x30')],_0x324e88['filters']));if(_0x357ed5[_0x28c3('0x30')][_0x28c3('0x3c')]){_0x417378[_0x28c3('0x3b')]=_[_0x28c3('0x3d')](_0x417378[_0x28c3('0x3b')],{'$or':_['map'](_0x34b02b,function(_0xbcf38d){if(_0xbcf38d[_0x28c3('0x3e')][_0x28c3('0x3f')]!==_0x28c3('0x40')){var _0x1ebca3={};_0x1ebca3[_0xbcf38d['field']]={'$like':'%'+_0x357ed5[_0x28c3('0x30')][_0x28c3('0x3c')]+'%'};return _0x1ebca3;}})});}_0x417378=_[_0x28c3('0x3d')]({},_0x417378,_0x357ed5[_0x28c3('0x41')]);var _0x439c78={'where':_0x417378[_0x28c3('0x3b')]};return db[_0x28c3('0x2e')][_0x28c3('0x1d')](_0x439c78)[_0x28c3('0x27')](function(_0x44a6ff){_0x188285[_0x28c3('0x1d')]=_0x44a6ff;if(_0x357ed5[_0x28c3('0x30')][_0x28c3('0x42')]){_0x417378[_0x28c3('0x43')]=[{'all':!![]}];}return db[_0x28c3('0x2e')]['findAll'](_0x417378);})['then'](function(_0x5c497e){_0x188285['rows']=_0x5c497e;return _0x188285;})[_0x28c3('0x27')](respondWithFilteredResult(_0x17cccb,_0x417378))[_0x28c3('0x44')](handleError(_0x17cccb,null));};exports['show']=function(_0x2463a9,_0x326bfe){var _0x38592d={'raw':!![],'where':{'id':_0x2463a9[_0x28c3('0x45')]['id']}},_0x3f3c8d={};_0x3f3c8d[_0x28c3('0x34')]=_[_0x28c3('0x2f')](db[_0x28c3('0x2e')][_0x28c3('0x46')]);_0x3f3c8d['query']=_[_0x28c3('0x2f')](_0x2463a9['query']);_0x3f3c8d['filters']=_['intersection'](_0x3f3c8d[_0x28c3('0x34')],_0x3f3c8d['query']);_0x38592d[_0x28c3('0x33')]=_['intersection'](_0x3f3c8d[_0x28c3('0x34')],qs[_0x28c3('0x35')](_0x2463a9[_0x28c3('0x30')][_0x28c3('0x35')]));_0x38592d[_0x28c3('0x33')]=_0x38592d[_0x28c3('0x33')][_0x28c3('0x36')]?_0x38592d[_0x28c3('0x33')]:_0x3f3c8d[_0x28c3('0x34')];if(_0x2463a9['query'][_0x28c3('0x42')]){_0x38592d[_0x28c3('0x43')]=[{'all':!![]}];}_0x38592d=_[_0x28c3('0x3d')]({},_0x38592d,_0x2463a9[_0x28c3('0x41')]);return db['CmHopperHistory']['find'](_0x38592d)['then'](handleEntityNotFound(_0x326bfe,null))['then'](respondWithResult(_0x326bfe,null))[_0x28c3('0x44')](handleError(_0x326bfe,null));};exports[_0x28c3('0x47')]=function(_0xc67352,_0x2c668a){return db[_0x28c3('0x2e')][_0x28c3('0x47')](_0xc67352[_0x28c3('0x48')],{})[_0x28c3('0x27')](respondWithResult(_0x2c668a,0xc9))[_0x28c3('0x44')](handleError(_0x2c668a,null));};exports['describe']=function(_0x3fd231,_0x5d42e4){return db[_0x28c3('0x2e')][_0x28c3('0x49')]()[_0x28c3('0x27')](respondWithResult(_0x5d42e4,null))[_0x28c3('0x44')](handleError(_0x5d42e4,null));};exports[_0x28c3('0x25')]=function(_0x3cf7c9,_0x4a443c){if(_0x3cf7c9[_0x28c3('0x48')]['uniqueid']){delete _0x3cf7c9[_0x28c3('0x48')][_0x28c3('0x4a')];}return db[_0x28c3('0x2e')]['find']({'where':{'uniqueid':_0x3cf7c9[_0x28c3('0x45')]['id']}})[_0x28c3('0x27')](handleEntityNotFound(_0x4a443c,null))[_0x28c3('0x27')](saveUpdates(_0x3cf7c9[_0x28c3('0x48')],null))['then'](respondWithResult(_0x4a443c,null))[_0x28c3('0x44')](handleError(_0x4a443c,null));};
\ No newline at end of file
+var _0xe3c3=['json','count','offset','limit','Content-Range','apply','save','update','destroy','then','stack','name','send','CmHopperHistory','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','find','create','body','catch','describe','uniqueid','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../mysqldb','sendStatus','status','end'];(function(_0x58e955,_0x269be1){var _0x544f33=function(_0xdd7c5){while(--_0xdd7c5){_0x58e955['push'](_0x58e955['shift']());}};_0x544f33(++_0x269be1);}(_0xe3c3,0xb4));var _0x3e3c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3c3[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x3e3c('0x0'));var emlformat=require(_0x3e3c('0x1'));var rimraf=require(_0x3e3c('0x2'));var zipdir=require(_0x3e3c('0x3'));var jsonpatch=require(_0x3e3c('0x4'));var rp=require(_0x3e3c('0x5'));var moment=require('moment');var BPromise=require(_0x3e3c('0x6'));var Mustache=require(_0x3e3c('0x7'));var util=require('util');var path=require(_0x3e3c('0x8'));var sox=require(_0x3e3c('0x9'));var csv=require(_0x3e3c('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3e3c('0xb'));var squel=require(_0x3e3c('0xc'));var crypto=require(_0x3e3c('0xd'));var jsforce=require(_0x3e3c('0xe'));var deskjs=require(_0x3e3c('0xf'));var toCsv=require(_0x3e3c('0xa'));var querystring=require('querystring');var Papa=require(_0x3e3c('0x10'));var authService=require(_0x3e3c('0x11'));var hardwareService=require(_0x3e3c('0x12'));var Redis=require(_0x3e3c('0x13'));var qs=require(_0x3e3c('0x14'));var logger=require('../../config/logger')(_0x3e3c('0x15'));var utils=require(_0x3e3c('0x16'));var config=require('../../config/environment');var db=require(_0x3e3c('0x17'))['db'];function respondWithStatusCode(_0x13e6b1,_0x246f03){_0x246f03=_0x246f03||0xcc;return function(_0x431df9){if(_0x431df9){return _0x13e6b1[_0x3e3c('0x18')](_0x246f03);}return _0x13e6b1[_0x3e3c('0x19')](_0x246f03)[_0x3e3c('0x1a')]();};}function respondWithResult(_0x55aba5,_0x4f88da){_0x4f88da=_0x4f88da||0xc8;return function(_0x3edc5c){if(_0x3edc5c){return _0x55aba5[_0x3e3c('0x19')](_0x4f88da)[_0x3e3c('0x1b')](_0x3edc5c);}};}function respondWithFilteredResult(_0x114187,_0x1b3c5a){return function(_0x2f5657){if(_0x2f5657){var _0x46ff85=_0x2f5657[_0x3e3c('0x1c')],_0x559bce=_0x1b3c5a[_0x3e3c('0x1d')],_0x59637f=_0x1b3c5a[_0x3e3c('0x1d')]+_0x1b3c5a[_0x3e3c('0x1e')],_0x14e077;if(_0x59637f>=_0x46ff85){_0x59637f=_0x46ff85;_0x14e077=0xc8;}else{_0x14e077=0xce;}_0x114187[_0x3e3c('0x19')](_0x14e077);return _0x114187['set'](_0x3e3c('0x1f'),_0x559bce+'-'+_0x59637f+'/'+_0x46ff85)[_0x3e3c('0x1b')](_0x2f5657);}return null;};}function patchUpdates(_0x573725){return function(_0x261d41){try{jsonpatch[_0x3e3c('0x20')](_0x261d41,_0x573725,!![]);}catch(_0x43f9b6){return BPromise['reject'](_0x43f9b6);}return _0x261d41[_0x3e3c('0x21')]();};}function saveUpdates(_0x309081,_0x56cb91){return function(_0x3f1698){if(_0x3f1698){return _0x3f1698[_0x3e3c('0x22')](_0x309081)['then'](function(_0x589b34){return _0x589b34;});}return null;};}function removeEntity(_0xaf6064,_0x3b3d61){return function(_0x2eddba){if(_0x2eddba){return _0x2eddba[_0x3e3c('0x23')]()[_0x3e3c('0x24')](function(){_0xaf6064['status'](0xcc)[_0x3e3c('0x1a')]();});}};}function handleEntityNotFound(_0x1592a1,_0x3d3c83){return function(_0x1937a6){if(!_0x1937a6){_0x1592a1['sendStatus'](0x194);}return _0x1937a6;};}function handleError(_0x208a2a,_0x1900e1){_0x1900e1=_0x1900e1||0x1f4;return function(_0x40079f){logger['error'](_0x40079f[_0x3e3c('0x25')]);if(_0x40079f[_0x3e3c('0x26')]){delete _0x40079f[_0x3e3c('0x26')];}_0x208a2a[_0x3e3c('0x19')](_0x1900e1)[_0x3e3c('0x27')](_0x40079f);};}exports['index']=function(_0x15309f,_0x356412){var _0x19ba7d={},_0x8c2473={},_0x5ebc78={'count':0x0,'rows':[]};var _0x11cc5c=db[_0x3e3c('0x28')][_0x3e3c('0x29')];_0x8c2473[_0x3e3c('0x2a')]=_[_0x3e3c('0x2b')](_0x11cc5c);_0x8c2473[_0x3e3c('0x2c')]=_[_0x3e3c('0x2b')](_0x15309f[_0x3e3c('0x2c')]);_0x8c2473[_0x3e3c('0x2d')]=_[_0x3e3c('0x2e')](_0x8c2473['model'],_0x8c2473['query']);_0x19ba7d[_0x3e3c('0x2f')]=_['intersection'](_0x8c2473[_0x3e3c('0x2a')],qs[_0x3e3c('0x30')](_0x15309f['query'][_0x3e3c('0x30')]));_0x19ba7d[_0x3e3c('0x2f')]=_0x19ba7d[_0x3e3c('0x2f')]['length']?_0x19ba7d[_0x3e3c('0x2f')]:_0x8c2473[_0x3e3c('0x2a')];if(!_0x15309f[_0x3e3c('0x2c')][_0x3e3c('0x31')](_0x3e3c('0x32'))){_0x19ba7d['limit']=qs[_0x3e3c('0x1e')](_0x15309f[_0x3e3c('0x2c')][_0x3e3c('0x1e')]);_0x19ba7d[_0x3e3c('0x1d')]=qs[_0x3e3c('0x1d')](_0x15309f[_0x3e3c('0x2c')][_0x3e3c('0x1d')]);}_0x19ba7d[_0x3e3c('0x33')]=qs['sort'](_0x15309f[_0x3e3c('0x2c')][_0x3e3c('0x34')]);_0x19ba7d['where']=qs['filters'](_['pick'](_0x15309f[_0x3e3c('0x2c')],_0x8c2473['filters']));if(_0x15309f[_0x3e3c('0x2c')]['filter']){_0x19ba7d[_0x3e3c('0x35')]=_[_0x3e3c('0x36')](_0x19ba7d[_0x3e3c('0x35')],{'$or':_['map'](_0x11cc5c,function(_0x5f3404){if(_0x5f3404['type']['key']!==_0x3e3c('0x37')){var _0x5cd987={};_0x5cd987[_0x5f3404['field']]={'$like':'%'+_0x15309f[_0x3e3c('0x2c')][_0x3e3c('0x38')]+'%'};return _0x5cd987;}})});}_0x19ba7d=_[_0x3e3c('0x36')]({},_0x19ba7d,_0x15309f[_0x3e3c('0x39')]);var _0xde7117={'where':_0x19ba7d[_0x3e3c('0x35')]};return db[_0x3e3c('0x28')]['count'](_0xde7117)[_0x3e3c('0x24')](function(_0x20982a){_0x5ebc78[_0x3e3c('0x1c')]=_0x20982a;if(_0x15309f['query'][_0x3e3c('0x3a')]){_0x19ba7d['include']=[{'all':!![]}];}return db[_0x3e3c('0x28')][_0x3e3c('0x3b')](_0x19ba7d);})[_0x3e3c('0x24')](function(_0x1bef43){_0x5ebc78[_0x3e3c('0x3c')]=_0x1bef43;return _0x5ebc78;})['then'](respondWithFilteredResult(_0x356412,_0x19ba7d))['catch'](handleError(_0x356412,null));};exports[_0x3e3c('0x3d')]=function(_0x459058,_0x25c448){var _0xacc931={'raw':!![],'where':{'id':_0x459058[_0x3e3c('0x3e')]['id']}},_0x4e5603={};_0x4e5603[_0x3e3c('0x2a')]=_[_0x3e3c('0x2b')](db[_0x3e3c('0x28')]['rawAttributes']);_0x4e5603[_0x3e3c('0x2c')]=_[_0x3e3c('0x2b')](_0x459058['query']);_0x4e5603['filters']=_[_0x3e3c('0x2e')](_0x4e5603[_0x3e3c('0x2a')],_0x4e5603[_0x3e3c('0x2c')]);_0xacc931[_0x3e3c('0x2f')]=_[_0x3e3c('0x2e')](_0x4e5603['model'],qs[_0x3e3c('0x30')](_0x459058[_0x3e3c('0x2c')][_0x3e3c('0x30')]));_0xacc931[_0x3e3c('0x2f')]=_0xacc931['attributes']['length']?_0xacc931[_0x3e3c('0x2f')]:_0x4e5603['model'];if(_0x459058[_0x3e3c('0x2c')][_0x3e3c('0x3a')]){_0xacc931['include']=[{'all':!![]}];}_0xacc931=_['merge']({},_0xacc931,_0x459058[_0x3e3c('0x39')]);return db['CmHopperHistory'][_0x3e3c('0x3f')](_0xacc931)['then'](handleEntityNotFound(_0x25c448,null))[_0x3e3c('0x24')](respondWithResult(_0x25c448,null))['catch'](handleError(_0x25c448,null));};exports[_0x3e3c('0x40')]=function(_0x5c0453,_0x12cc61){return db['CmHopperHistory']['create'](_0x5c0453[_0x3e3c('0x41')],{})['then'](respondWithResult(_0x12cc61,0xc9))[_0x3e3c('0x42')](handleError(_0x12cc61,null));};exports[_0x3e3c('0x43')]=function(_0x541d21,_0x59540f){return db[_0x3e3c('0x28')]['describe']()[_0x3e3c('0x24')](respondWithResult(_0x59540f,null))[_0x3e3c('0x42')](handleError(_0x59540f,null));};exports[_0x3e3c('0x22')]=function(_0xe6ef39,_0x1781bd){if(_0xe6ef39[_0x3e3c('0x41')][_0x3e3c('0x44')]){delete _0xe6ef39[_0x3e3c('0x41')][_0x3e3c('0x44')];}return db[_0x3e3c('0x28')][_0x3e3c('0x3f')]({'where':{'uniqueid':_0xe6ef39[_0x3e3c('0x3e')]['id']}})[_0x3e3c('0x24')](handleEntityNotFound(_0x1781bd,null))[_0x3e3c('0x24')](saveUpdates(_0xe6ef39[_0x3e3c('0x41')],null))[_0x3e3c('0x24')](respondWithResult(_0x1781bd,null))[_0x3e3c('0x42')](handleError(_0x1781bd,null));};
\ No newline at end of file
index d7f6a79..b55ec74 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbbf0=['endtime','uniqueid','lodash','api','request-promise','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xbbf0,0x84));var _0x0bbf=function(_0x28fc28,_0x5ebe89){_0x28fc28=_0x28fc28-0x0;var _0x2fdd2b=_0xbbf0[_0x28fc28];return _0x2fdd2b;};'use strict';var _=require(_0x0bbf('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0bbf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0bbf('0x2'));var attributes=require(_0x0bbf('0x3'));module[_0x0bbf('0x4')]=function(_0x1bc3d6,_0x238cf3){return _0x1bc3d6[_0x0bbf('0x5')](_0x0bbf('0x6'),attributes,{'tableName':_0x0bbf('0x7'),'paranoid':![],'indexes':[{'name':_0x0bbf('0x8'),'fields':[_0x0bbf('0x8')]},{'name':'uniqueid','fields':[_0x0bbf('0x9')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x7540=['../../config/logger','moment','bluebird','request-promise','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util'];(function(_0x3ed50d,_0x428212){var _0x41fdb5=function(_0x1dfd7d){while(--_0x1dfd7d){_0x3ed50d['push'](_0x3ed50d['shift']());}};_0x41fdb5(++_0x428212);}(_0x7540,0x143));var _0x0754=function(_0x270913,_0xb25fb4){_0x270913=_0x270913-0x0;var _0x1e1dba=_0x7540[_0x270913];return _0x1e1dba;};'use strict';var _=require(_0x0754('0x0'));var util=require(_0x0754('0x1'));var logger=require(_0x0754('0x2'))('api');var moment=require(_0x0754('0x3'));var BPromise=require(_0x0754('0x4'));var rp=require(_0x0754('0x5'));var attributes=require(_0x0754('0x6'));module[_0x0754('0x7')]=function(_0x3eabe4,_0x43a0c4){return _0x3eabe4[_0x0754('0x8')](_0x0754('0x9'),attributes,{'tableName':_0x0754('0xa'),'paranoid':![],'indexes':[{'name':_0x0754('0xb'),'fields':[_0x0754('0xb')]},{'name':'uniqueid','fields':[_0x0754('0xc')]}],'timestamps':!![]});};
\ No newline at end of file
index 93d4117..2c5cc19 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x13f6=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','CreateCmHopperHistory','CmHopperHistory','create','body','raw','catch','AvgHandleTime','findAll','options','sequelize','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\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=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','where','col','ivrTotalCallsDays','ivrAnswerCallsDay'];(function(_0x328c44,_0x35b8a3){var _0x2ab1da=function(_0x80eb6b){while(--_0x80eb6b){_0x328c44['push'](_0x328c44['shift']());}};_0x2ab1da(++_0x35b8a3);}(_0x13f6,0x124));var _0x613f=function(_0x1df2f9,_0x2f1041){_0x1df2f9=_0x1df2f9-0x0;var _0x442a58=_0x13f6[_0x1df2f9];return _0x442a58;};'use strict';var _=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x613f('0x2'));var fs=require('fs');var Redis=require(_0x613f('0x3'));var db=require(_0x613f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x613f('0x5'))(_0x613f('0x6'));var config=require(_0x613f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x613f('0x8')][_0x613f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5618fa,_0x4b546b,_0x5a84f2){return new BPromise(function(_0x5c93c0,_0x2d5973){return client[_0x613f('0xa')](_0x5618fa,_0x5a84f2)[_0x613f('0xb')](function(_0x35b672){logger['info'](_0x613f('0xc'),_0x4b546b,_0x613f('0xd'));logger[_0x613f('0xe')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x4b546b,_0x613f('0xd'),JSON[_0x613f('0xf')](_0x35b672));if(_0x35b672[_0x613f('0x10')]){if(_0x35b672['error'][_0x613f('0x11')]===0x1f4){logger[_0x613f('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x4b546b,_0x35b672['error']['message']);return _0x2d5973(_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);}logger[_0x613f('0x10')](_0x613f('0xc'),_0x4b546b,_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);return _0x5c93c0(_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);}else{logger[_0x613f('0x13')](_0x613f('0xc'),_0x4b546b,'request\x20sent');_0x5c93c0(_0x35b672[_0x613f('0x14')]['message']);}})['catch'](function(_0x1bc605){logger[_0x613f('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x4b546b,_0x1bc605);_0x2d5973(_0x1bc605);});});}exports[_0x613f('0x15')]=function(_0x4f9dae){var _0x62ebfe=this;return new Promise(function(_0x1e5a11,_0x431266){return db[_0x613f('0x16')][_0x613f('0x17')](_0x4f9dae[_0x613f('0x18')],{'raw':_0x4f9dae['options']?_0x4f9dae['options'][_0x613f('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x48493c){logger[_0x613f('0x13')](_0x613f('0x15'),_0x4f9dae);logger['debug'](_0x613f('0x15'),_0x4f9dae,JSON[_0x613f('0xf')](_0x48493c));_0x1e5a11(_0x48493c);})[_0x613f('0x1a')](function(_0x48b28a){logger['error'](_0x613f('0x15'),_0x48b28a[_0x613f('0x12')],_0x4f9dae);_0x431266(_0x62ebfe[_0x613f('0x10')](0x1f4,_0x48b28a['message']));});});};exports[_0x613f('0x1b')]=function(_0x33e0c6){var _0x30de90=this;return new Promise(function(_0x1ee050,_0x3013a1){return db['CmHopperHistory'][_0x613f('0x1c')]({'raw':_0x33e0c6[_0x613f('0x1d')]?_0x33e0c6['options'][_0x613f('0x19')]===undefined?!![]:![]:!![],'where':_0x33e0c6[_0x613f('0x1d')]?_0x33e0c6[_0x613f('0x1d')]['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x613f('0x1e')]['col']('id')),_0x613f('0x1f')],[db[_0x613f('0x1e')]['fn']('COUNT',db[_0x613f('0x1e')]['fn']('IF',db[_0x613f('0x1e')]['literal']('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0x613f('0x1e')]['fn'](_0x613f('0x20'),db[_0x613f('0x1e')]['fn']('IF',db['sequelize'][_0x613f('0x21')](_0x613f('0x22')))),_0x613f('0x23')],[db[_0x613f('0x1e')]['fn']('COUNT',db[_0x613f('0x1e')]['fn']('IF',db[_0x613f('0x1e')][_0x613f('0x21')](_0x613f('0x24')))),_0x613f('0x25')],[db[_0x613f('0x1e')]['fn']('AVG',db[_0x613f('0x1e')]['fn']('IF',db[_0x613f('0x1e')][_0x613f('0x21')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x613f('0x26')],[db['sequelize']['fn'](_0x613f('0x27'),db[_0x613f('0x1e')]['fn']('IF',db[_0x613f('0x1e')][_0x613f('0x21')](_0x613f('0x28')))),_0x613f('0x29')]]})['then'](function(_0x1a18ce){logger[_0x613f('0x13')](_0x613f('0x1b'),_0x33e0c6);logger[_0x613f('0xe')](_0x613f('0x1b'),_0x33e0c6,JSON['stringify'](_0x1a18ce));_0x1ee050(_0x1a18ce);})['catch'](function(_0x4eea2c){logger[_0x613f('0x10')](_0x613f('0x1b'),_0x4eea2c[_0x613f('0x12')],_0x33e0c6);_0x3013a1(_0x30de90[_0x613f('0x10')](0x1f4,_0x4eea2c['message']));});});};exports[_0x613f('0x2a')]=function(_0xaedbbd){var _0x4ed25f=this;return new Promise(function(_0x45e6df,_0x550cea){return db[_0x613f('0x16')]['findAll']({'raw':_0xaedbbd[_0x613f('0x1d')]?_0xaedbbd['options'][_0x613f('0x19')]===undefined?!![]:![]:!![],'where':_0xaedbbd[_0x613f('0x1d')]?_0xaedbbd[_0x613f('0x1d')]['where']||null:null,'attributes':[[_0x613f('0x2b'),_0x613f('0x2c')],[db[_0x613f('0x1e')]['fn'](_0x613f('0x20'),db[_0x613f('0x1e')]['fn']('IF',db[_0x613f('0x1e')][_0x613f('0x21')](_0x613f('0x2d')))),_0x613f('0x2e')],[db[_0x613f('0x1e')]['fn']('COUNT',db[_0x613f('0x1e')]['fn']('IF',db[_0x613f('0x1e')][_0x613f('0x21')](_0x613f('0x2f')))),_0x613f('0x30')],[db[_0x613f('0x1e')]['fn'](_0x613f('0x20'),db['sequelize']['fn']('IF',db[_0x613f('0x1e')][_0x613f('0x21')](_0x613f('0x31')))),_0x613f('0x32')],[db[_0x613f('0x1e')]['fn'](_0x613f('0x20'),db[_0x613f('0x1e')]['fn']('IF',db['sequelize'][_0x613f('0x21')](_0x613f('0x33')))),_0x613f('0x34')],[db[_0x613f('0x1e')]['fn'](_0x613f('0x20'),db[_0x613f('0x1e')]['fn']('IF',db[_0x613f('0x1e')][_0x613f('0x21')](_0x613f('0x35')))),_0x613f('0x36')],[db[_0x613f('0x1e')]['fn'](_0x613f('0x20'),db[_0x613f('0x1e')]['fn']('IF',db['sequelize'][_0x613f('0x21')](_0x613f('0x37')))),_0x613f('0x38')],[db[_0x613f('0x1e')]['fn']('COUNT',db[_0x613f('0x1e')]['fn']('IF',db[_0x613f('0x1e')][_0x613f('0x21')](_0x613f('0x39')))),_0x613f('0x3a')],[db[_0x613f('0x1e')]['fn'](_0x613f('0x20'),db[_0x613f('0x1e')]['fn']('IF',db[_0x613f('0x1e')][_0x613f('0x21')]('`state`\x20=\x2012,\x201,\x20null'))),'outboundUnknownCallsDay'],[db[_0x613f('0x1e')]['fn'](_0x613f('0x20'),db['sequelize']['fn']('IF',db[_0x613f('0x1e')][_0x613f('0x21')](_0x613f('0x3b')))),_0x613f('0x3c')],[db[_0x613f('0x1e')]['fn'](_0x613f('0x20'),db[_0x613f('0x1e')]['fn']('IF',db[_0x613f('0x1e')][_0x613f('0x21')](_0x613f('0x3d')))),_0x613f('0x3e')],[db[_0x613f('0x1e')]['fn'](_0x613f('0x20'),db[_0x613f('0x1e')]['fn']('IF',db[_0x613f('0x1e')][_0x613f('0x21')](_0x613f('0x3f')))),_0x613f('0x40')],[db['sequelize']['fn']('COUNT',db[_0x613f('0x1e')]['fn']('IF',db[_0x613f('0x1e')]['literal']('`state`\x20=\x2016,\x201,\x20null'))),_0x613f('0x41')],[db['sequelize']['fn']('COUNT',db[_0x613f('0x1e')]['fn']('IF',db[_0x613f('0x1e')][_0x613f('0x21')]('`state`\x20=\x2020,\x201,\x20null'))),_0x613f('0x40')],[db[_0x613f('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x613f('0x1e')][_0x613f('0x21')](_0x613f('0x42')))),_0x613f('0x43')]],'group':[_0x613f('0x2b')]})[_0x613f('0xb')](function(_0x24d162){logger['info']('GetVoiceQueueHopperHistory',_0xaedbbd);logger[_0x613f('0xe')]('GetVoiceQueueHopperHistory',_0xaedbbd,JSON['stringify'](_0x24d162));_0x45e6df(_0x24d162);})[_0x613f('0x1a')](function(_0x52c2a6){logger[_0x613f('0x10')]('GetVoiceQueueHopperHistory',_0x52c2a6[_0x613f('0x12')],_0xaedbbd);_0x550cea(_0x4ed25f[_0x613f('0x10')](0x1f4,_0x52c2a6[_0x613f('0x12')]));});});};exports[_0x613f('0x44')]=function(_0x11e4a4){var _0x2cb4a1=this;return new Promise(function(_0x346e2c,_0x4a49a1){return db[_0x613f('0x16')]['findAll']({'raw':_0x11e4a4[_0x613f('0x1d')]?_0x11e4a4[_0x613f('0x1d')][_0x613f('0x19')]===undefined?!![]:![]:!![],'where':_0x11e4a4[_0x613f('0x1d')]?_0x11e4a4[_0x613f('0x1d')][_0x613f('0x45')]||null:null,'attributes':[[_0x613f('0x2b'),_0x613f('0x2c')],[db[_0x613f('0x1e')]['fn'](_0x613f('0x20'),db[_0x613f('0x1e')][_0x613f('0x46')]('id')),_0x613f('0x47')],[db['sequelize']['fn']('COUNT',db[_0x613f('0x1e')]['fn']('IF',db['sequelize'][_0x613f('0x21')](_0x613f('0x31')))),_0x613f('0x48')]],'group':[_0x613f('0x2b')]})[_0x613f('0xb')](function(_0x46a945){logger[_0x613f('0x13')](_0x613f('0x44'),_0x11e4a4);logger[_0x613f('0xe')](_0x613f('0x44'),_0x11e4a4,JSON[_0x613f('0xf')](_0x46a945));_0x346e2c(_0x46a945);})['catch'](function(_0xbc2c8f){logger[_0x613f('0x10')](_0x613f('0x44'),_0xbc2c8f[_0x613f('0x12')],_0x11e4a4);_0x4a49a1(_0x2cb4a1['error'](0x1f4,_0xbc2c8f[_0x613f('0x12')]));});});};
\ No newline at end of file
+var _0x44f8=['COUNT','col','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','stringify','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','GetCampaignHopperHistory','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','client','http','request\x20sent','error','CmHopperHistory,\x20%s,\x20%s','message','result','catch','body','options','raw','then','info','debug','CreateCmHopperHistory','CmHopperHistory','findAll','where','sequelize'];(function(_0x1c7de3,_0x2be95e){var _0x2e3712=function(_0x825d16){while(--_0x825d16){_0x1c7de3['push'](_0x1c7de3['shift']());}};_0x2e3712(++_0x2be95e);}(_0x44f8,0x1de));var _0x844f=function(_0x4e9144,_0x3ab114){_0x4e9144=_0x4e9144-0x0;var _0x3b9e31=_0x44f8[_0x4e9144];return _0x3b9e31;};'use strict';var _=require(_0x844f('0x0'));var util=require(_0x844f('0x1'));var moment=require(_0x844f('0x2'));var BPromise=require(_0x844f('0x3'));var rs=require(_0x844f('0x4'));var fs=require('fs');var Redis=require(_0x844f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x844f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x844f('0x7')][_0x844f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x46eb2c,_0x38a334,_0x37b697){return new BPromise(function(_0x1987a9,_0x188f88){return client['request'](_0x46eb2c,_0x37b697)['then'](function(_0x39416d){logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x38a334,_0x844f('0x9'));logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x38a334,'request\x20sent',JSON['stringify'](_0x39416d));if(_0x39416d[_0x844f('0xa')]){if(_0x39416d[_0x844f('0xa')]['code']===0x1f4){logger[_0x844f('0xa')](_0x844f('0xb'),_0x38a334,_0x39416d[_0x844f('0xa')]['message']);return _0x188f88(_0x39416d['error'][_0x844f('0xc')]);}logger['error'](_0x844f('0xb'),_0x38a334,_0x39416d[_0x844f('0xa')][_0x844f('0xc')]);return _0x1987a9(_0x39416d[_0x844f('0xa')][_0x844f('0xc')]);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x38a334,_0x844f('0x9'));_0x1987a9(_0x39416d[_0x844f('0xd')][_0x844f('0xc')]);}})[_0x844f('0xe')](function(_0x4f7ce4){logger[_0x844f('0xa')]('CmHopperHistory,\x20%s,\x20%s',_0x38a334,_0x4f7ce4);_0x188f88(_0x4f7ce4);});});}exports['CreateCmHopperHistory']=function(_0x1f96d0){var _0x2cca8e=this;return new Promise(function(_0x5cc55c,_0x24e386){return db['CmHopperHistory']['create'](_0x1f96d0[_0x844f('0xf')],{'raw':_0x1f96d0['options']?_0x1f96d0[_0x844f('0x10')][_0x844f('0x11')]===undefined?!![]:![]:!![]})[_0x844f('0x12')](function(_0x38e732){logger[_0x844f('0x13')]('CreateCmHopperHistory',_0x1f96d0);logger[_0x844f('0x14')]('CreateCmHopperHistory',_0x1f96d0,JSON['stringify'](_0x38e732));_0x5cc55c(_0x38e732);})[_0x844f('0xe')](function(_0x4261b6){logger[_0x844f('0xa')](_0x844f('0x15'),_0x4261b6[_0x844f('0xc')],_0x1f96d0);_0x24e386(_0x2cca8e['error'](0x1f4,_0x4261b6[_0x844f('0xc')]));});});};exports['AvgHandleTime']=function(_0x22c055){var _0x5cd976=this;return new Promise(function(_0xfe678b,_0x19b96a){return db[_0x844f('0x16')][_0x844f('0x17')]({'raw':_0x22c055[_0x844f('0x10')]?_0x22c055[_0x844f('0x10')][_0x844f('0x11')]===undefined?!![]:![]:!![],'where':_0x22c055['options']?_0x22c055[_0x844f('0x10')][_0x844f('0x18')]||null:null,'attributes':[[db[_0x844f('0x19')]['fn'](_0x844f('0x1a'),db[_0x844f('0x19')][_0x844f('0x1b')]('id')),'predictiveIntervalTotalCalls'],[db[_0x844f('0x19')]['fn'](_0x844f('0x1a'),db[_0x844f('0x19')]['fn']('IF',db['sequelize']['literal'](_0x844f('0x1c')))),_0x844f('0x1d')],[db[_0x844f('0x19')]['fn']('COUNT',db[_0x844f('0x19')]['fn']('IF',db['sequelize'][_0x844f('0x1e')](_0x844f('0x1f')))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn'](_0x844f('0x1a'),db[_0x844f('0x19')]['fn']('IF',db['sequelize']['literal'](_0x844f('0x20')))),_0x844f('0x21')],[db[_0x844f('0x19')]['fn']('AVG',db[_0x844f('0x19')]['fn']('IF',db[_0x844f('0x19')][_0x844f('0x1e')](_0x844f('0x22')))),'predictiveIntervalAvgHoldtime'],[db[_0x844f('0x19')]['fn'](_0x844f('0x23'),db[_0x844f('0x19')]['fn']('IF',db[_0x844f('0x19')][_0x844f('0x1e')](_0x844f('0x24')))),_0x844f('0x25')]]})[_0x844f('0x12')](function(_0x53d83d){logger[_0x844f('0x13')]('AvgHandleTime',_0x22c055);logger[_0x844f('0x14')](_0x844f('0x26'),_0x22c055,JSON[_0x844f('0x27')](_0x53d83d));_0xfe678b(_0x53d83d);})[_0x844f('0xe')](function(_0x549283){logger[_0x844f('0xa')](_0x844f('0x26'),_0x549283['message'],_0x22c055);_0x19b96a(_0x5cd976[_0x844f('0xa')](0x1f4,_0x549283[_0x844f('0xc')]));});});};exports[_0x844f('0x28')]=function(_0x357e1c){var _0x459ca2=this;return new Promise(function(_0x45df15,_0x5900ab){return db[_0x844f('0x16')]['findAll']({'raw':_0x357e1c['options']?_0x357e1c[_0x844f('0x10')]['raw']===undefined?!![]:![]:!![],'where':_0x357e1c[_0x844f('0x10')]?_0x357e1c[_0x844f('0x10')][_0x844f('0x18')]||null:null,'attributes':[[_0x844f('0x29'),_0x844f('0x2a')],[db[_0x844f('0x19')]['fn'](_0x844f('0x1a'),db[_0x844f('0x19')]['fn']('IF',db[_0x844f('0x19')][_0x844f('0x1e')](_0x844f('0x2b')))),_0x844f('0x2c')],[db[_0x844f('0x19')]['fn'](_0x844f('0x1a'),db[_0x844f('0x19')]['fn']('IF',db['sequelize']['literal'](_0x844f('0x2d')))),'outboundNoAnswerCallsDay'],[db[_0x844f('0x19')]['fn'](_0x844f('0x1a'),db['sequelize']['fn']('IF',db[_0x844f('0x19')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x844f('0x2e')],[db['sequelize']['fn']('COUNT',db[_0x844f('0x19')]['fn']('IF',db[_0x844f('0x19')][_0x844f('0x1e')](_0x844f('0x2f')))),'outboundBusyCallsDay'],[db[_0x844f('0x19')]['fn'](_0x844f('0x1a'),db[_0x844f('0x19')]['fn']('IF',db[_0x844f('0x19')]['literal'](_0x844f('0x30')))),'outboundCongestionCallsDay'],[db['sequelize']['fn'](_0x844f('0x1a'),db[_0x844f('0x19')]['fn']('IF',db[_0x844f('0x19')][_0x844f('0x1e')](_0x844f('0x31')))),'outboundDropCallsDayTimeout'],[db[_0x844f('0x19')]['fn'](_0x844f('0x1a'),db['sequelize']['fn']('IF',db[_0x844f('0x19')][_0x844f('0x1e')](_0x844f('0x32')))),_0x844f('0x33')],[db[_0x844f('0x19')]['fn'](_0x844f('0x1a'),db[_0x844f('0x19')]['fn']('IF',db[_0x844f('0x19')][_0x844f('0x1e')](_0x844f('0x34')))),_0x844f('0x35')],[db['sequelize']['fn'](_0x844f('0x1a'),db['sequelize']['fn']('IF',db[_0x844f('0x19')][_0x844f('0x1e')]('`state`\x20=\x2013,\x201,\x20null'))),_0x844f('0x36')],[db[_0x844f('0x19')]['fn'](_0x844f('0x1a'),db[_0x844f('0x19')]['fn']('IF',db[_0x844f('0x19')]['literal'](_0x844f('0x37')))),'outboundOriginateFailureCallsDay'],[db[_0x844f('0x19')]['fn'](_0x844f('0x1a'),db[_0x844f('0x19')]['fn']('IF',db['sequelize'][_0x844f('0x1e')](_0x844f('0x38')))),_0x844f('0x39')],[db['sequelize']['fn'](_0x844f('0x1a'),db[_0x844f('0x19')]['fn']('IF',db[_0x844f('0x19')][_0x844f('0x1e')](_0x844f('0x3a')))),'outboundAnswerAgiCallsDay'],[db[_0x844f('0x19')]['fn'](_0x844f('0x1a'),db[_0x844f('0x19')]['fn']('IF',db[_0x844f('0x19')]['literal'](_0x844f('0x3b')))),_0x844f('0x39')],[db[_0x844f('0x19')]['fn'](_0x844f('0x1a'),db[_0x844f('0x19')]['fn']('IF',db[_0x844f('0x19')]['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x844f('0x3c')]],'group':[_0x844f('0x29')]})[_0x844f('0x12')](function(_0x1efc35){logger['info']('GetVoiceQueueHopperHistory',_0x357e1c);logger[_0x844f('0x14')]('GetVoiceQueueHopperHistory',_0x357e1c,JSON[_0x844f('0x27')](_0x1efc35));_0x45df15(_0x1efc35);})[_0x844f('0xe')](function(_0x2d3f47){logger[_0x844f('0xa')]('GetVoiceQueueHopperHistory',_0x2d3f47[_0x844f('0xc')],_0x357e1c);_0x5900ab(_0x459ca2[_0x844f('0xa')](0x1f4,_0x2d3f47['message']));});});};exports['GetCampaignHopperHistory']=function(_0x42c139){var _0x6d2436=this;return new Promise(function(_0x2b3412,_0x394f35){return db[_0x844f('0x16')][_0x844f('0x17')]({'raw':_0x42c139['options']?_0x42c139['options'][_0x844f('0x11')]===undefined?!![]:![]:!![],'where':_0x42c139[_0x844f('0x10')]?_0x42c139[_0x844f('0x10')][_0x844f('0x18')]||null:null,'attributes':[[_0x844f('0x29'),_0x844f('0x2a')],[db[_0x844f('0x19')]['fn'](_0x844f('0x1a'),db[_0x844f('0x19')][_0x844f('0x1b')]('id')),_0x844f('0x3d')],[db[_0x844f('0x19')]['fn'](_0x844f('0x1a'),db[_0x844f('0x19')]['fn']('IF',db[_0x844f('0x19')][_0x844f('0x1e')]('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0x844f('0x29')]})['then'](function(_0x9a8b95){logger['info'](_0x844f('0x3e'),_0x42c139);logger[_0x844f('0x14')](_0x844f('0x3e'),_0x42c139,JSON[_0x844f('0x27')](_0x9a8b95));_0x2b3412(_0x9a8b95);})[_0x844f('0xe')](function(_0x4a5dcd){logger[_0x844f('0xa')]('GetCampaignHopperHistory',_0x4a5dcd[_0x844f('0xc')],_0x42c139);_0x394f35(_0x6d2436[_0x844f('0xa')](0x1f4,_0x4a5dcd[_0x844f('0xc')]));});});};
\ No newline at end of file
index 43bb5a9..9718e1b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1134=['../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','isAuthenticated','get','describe','/:id','show','post','put','update','exports','multer','util','connect-timeout','express'];(function(_0x1feaf5,_0x549f51){var _0x253e3a=function(_0x17c727){while(--_0x17c727){_0x1feaf5['push'](_0x1feaf5['shift']());}};_0x253e3a(++_0x549f51);}(_0x1134,0x19c));var _0x4113=function(_0xe28ae4,_0x388c1b){_0xe28ae4=_0xe28ae4-0x0;var _0x110f4a=_0x1134[_0xe28ae4];return _0x110f4a;};'use strict';var multer=require(_0x4113('0x0'));var util=require(_0x4113('0x1'));var path=require('path');var timeout=require(_0x4113('0x2'));var express=require(_0x4113('0x3'));var router=express['Router']();var auth=require(_0x4113('0x4'));var interaction=require(_0x4113('0x5'));var config=require('../../config/environment');var controller=require(_0x4113('0x6'));router['get']('/',auth[_0x4113('0x7')](),controller['index']);router[_0x4113('0x8')]('/describe',auth[_0x4113('0x7')](),controller[_0x4113('0x9')]);router[_0x4113('0x8')](_0x4113('0xa'),auth[_0x4113('0x7')](),controller[_0x4113('0xb')]);router[_0x4113('0xc')]('/',auth[_0x4113('0x7')](),controller['create']);router[_0x4113('0xd')](_0x4113('0xa'),auth[_0x4113('0x7')](),controller[_0x4113('0xe')]);module[_0x4113('0xf')]=router;
\ No newline at end of file
+var _0xc4a1=['isAuthenticated','index','/describe','describe','/:id','show','post','create','update','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc4a1,0x1ef));var _0x1c4a=function(_0x1dc94e,_0x4f7040){_0x1dc94e=_0x1dc94e-0x0;var _0x38787a=_0xc4a1[_0x1dc94e];return _0x38787a;};'use strict';var multer=require(_0x1c4a('0x0'));var util=require('util');var path=require(_0x1c4a('0x1'));var timeout=require(_0x1c4a('0x2'));var express=require(_0x1c4a('0x3'));var router=express['Router']();var auth=require(_0x1c4a('0x4'));var interaction=require(_0x1c4a('0x5'));var config=require(_0x1c4a('0x6'));var controller=require(_0x1c4a('0x7'));router[_0x1c4a('0x8')]('/',auth[_0x1c4a('0x9')](),controller[_0x1c4a('0xa')]);router[_0x1c4a('0x8')](_0x1c4a('0xb'),auth[_0x1c4a('0x9')](),controller[_0x1c4a('0xc')]);router[_0x1c4a('0x8')](_0x1c4a('0xd'),auth['isAuthenticated'](),controller[_0x1c4a('0xe')]);router[_0x1c4a('0xf')]('/',auth['isAuthenticated'](),controller[_0x1c4a('0x10')]);router['put']('/:id',auth[_0x1c4a('0x9')](),controller[_0x1c4a('0x11')]);module['exports']=router;
\ No newline at end of file
index ce556a7..bfb65fa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdbf5=['exports','STRING'];(function(_0x99868f,_0xbdb8e7){var _0x27a71b=function(_0x41feca){while(--_0x41feca){_0x99868f['push'](_0x99868f['shift']());}};_0x27a71b(++_0xbdb8e7);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x33d5a6,_0x147e39){_0x33d5a6=_0x33d5a6-0x0;var _0x303457=_0xdbf5[_0x33d5a6];return _0x303457;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5dbf('0x1')]},'dialPrefix':{'type':Sequelize[_0x5dbf('0x1')]}};
\ No newline at end of file
+var _0x6aa7=['name','sequelize','STRING'];(function(_0x1eb92f,_0x328a3d){var _0x542c84=function(_0x465172){while(--_0x465172){_0x1eb92f['push'](_0x1eb92f['shift']());}};_0x542c84(++_0x328a3d);}(_0x6aa7,0x178));var _0x76aa=function(_0x263657,_0x4f3320){_0x263657=_0x263657-0x0;var _0x2e029d=_0x6aa7[_0x263657];return _0x2e029d;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'name':{'type':Sequelize[_0x76aa('0x1')],'unique':_0x76aa('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x76aa('0x1')]},'dialPrefix':{'type':Sequelize[_0x76aa('0x1')]}};
\ No newline at end of file
index ce297e0..d32312c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xee1a=['name','send','CmList','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','type','VIRTUAL','options','include','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','find','describe','ListId','Disposition','getDispositions','order','includeAll','findAll','removeDispositions','ids','addContacts','CmContact','tags','join','isArray','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','concat','CustomFields','format','cf_%d','raw','getContactsCsv','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','findOne','sequelize','addCustomFields','Sequelize','TEXT','text','number','BOOLEAN','defaultValue','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','emit','userCmList:save','removeAgents','User','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','stack'];(function(_0x120057,_0x1e6b37){var _0x5d7365=function(_0x2e9d9a){while(--_0x2e9d9a){_0x120057['push'](_0x120057['shift']());}};_0x5d7365(++_0x1e6b37);}(_0xee1a,0x16c));var _0xaee1=function(_0x4a2ae5,_0x174a0a){_0x4a2ae5=_0x4a2ae5-0x0;var _0x44422e=_0xee1a[_0x4a2ae5];return _0x44422e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xaee1('0x0'));var rimraf=require(_0xaee1('0x1'));var zipdir=require(_0xaee1('0x2'));var jsonpatch=require(_0xaee1('0x3'));var rp=require(_0xaee1('0x4'));var moment=require(_0xaee1('0x5'));var BPromise=require(_0xaee1('0x6'));var Mustache=require(_0xaee1('0x7'));var util=require(_0xaee1('0x8'));var path=require(_0xaee1('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaee1('0xa'));var fs=require('fs');var _=require(_0xaee1('0xb'));var squel=require(_0xaee1('0xc'));var crypto=require('crypto');var jsforce=require(_0xaee1('0xd'));var deskjs=require(_0xaee1('0xe'));var toCsv=require('to-csv');var querystring=require(_0xaee1('0xf'));var Papa=require(_0xaee1('0x10'));var authService=require(_0xaee1('0x11'));var hardwareService=require(_0xaee1('0x12'));var Redis=require(_0xaee1('0x13'));var qs=require('../../components/parsers/qs');var logger=require(_0xaee1('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xaee1('0x15'));var db=require(_0xaee1('0x16'))['db'];config['redis']=_[_0xaee1('0x17')](config[_0xaee1('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xaee1('0x19'))(new Redis(config[_0xaee1('0x18')]));require('./cmList.socket')['register'](socket);function respondWithStatusCode(_0x83c3a4,_0xba3421){_0xba3421=_0xba3421||0xcc;return function(_0x5573e2){if(_0x5573e2){return _0x83c3a4[_0xaee1('0x1a')](_0xba3421);}return _0x83c3a4[_0xaee1('0x1b')](_0xba3421)[_0xaee1('0x1c')]();};}function respondWithResult(_0x362363,_0x256757){_0x256757=_0x256757||0xc8;return function(_0x53801e){if(_0x53801e){return _0x362363[_0xaee1('0x1b')](_0x256757)[_0xaee1('0x1d')](_0x53801e);}};}function respondWithFilteredResult(_0x5d3fcf,_0x13e6ec){return function(_0x14a445){if(_0x14a445){var _0x214f16=_0x14a445[_0xaee1('0x1e')],_0x6f8b73=_0x13e6ec[_0xaee1('0x1f')],_0x3366ab=_0x13e6ec[_0xaee1('0x1f')]+_0x13e6ec[_0xaee1('0x20')],_0x10e327;if(_0x3366ab>=_0x214f16){_0x3366ab=_0x214f16;_0x10e327=0xc8;}else{_0x10e327=0xce;}_0x5d3fcf[_0xaee1('0x1b')](_0x10e327);return _0x5d3fcf[_0xaee1('0x21')]('Content-Range',_0x6f8b73+'-'+_0x3366ab+'/'+_0x214f16)[_0xaee1('0x1d')](_0x14a445);}return null;};}function patchUpdates(_0xe92570){return function(_0x57ef87){try{jsonpatch[_0xaee1('0x22')](_0x57ef87,_0xe92570,!![]);}catch(_0x4bf762){return BPromise[_0xaee1('0x23')](_0x4bf762);}return _0x57ef87[_0xaee1('0x24')]();};}function saveUpdates(_0x14bada,_0x4682ce){return function(_0x1f4f3c){if(_0x1f4f3c){return _0x1f4f3c[_0xaee1('0x25')](_0x14bada)[_0xaee1('0x26')](function(_0x40b818){return _0x40b818;});}return null;};}function removeEntity(_0x42528d,_0x228b5a){return function(_0x1062fe){if(_0x1062fe){return _0x1062fe[_0xaee1('0x27')]()['then'](function(){var _0x2487b7=_0x1062fe[_0xaee1('0x28')]({'plain':!![]});var _0x3a57ec=_0xaee1('0x29');return db[_0xaee1('0x2a')][_0xaee1('0x27')]({'where':{'type':_0x3a57ec,'resourceId':_0x2487b7['id']}})[_0xaee1('0x26')](function(){return _0x1062fe;});})[_0xaee1('0x26')](function(){_0x42528d[_0xaee1('0x1b')](0xcc)[_0xaee1('0x1c')]();});}};}function handleEntityNotFound(_0x3bf743,_0x410b26){return function(_0x222cbd){if(!_0x222cbd){_0x3bf743[_0xaee1('0x1a')](0x194);}return _0x222cbd;};}function handleError(_0x43ddac,_0x308c33){_0x308c33=_0x308c33||0x1f4;return function(_0x348e4c){logger['error'](_0x348e4c[_0xaee1('0x2b')]);if(_0x348e4c['name']){delete _0x348e4c[_0xaee1('0x2c')];}_0x43ddac['status'](_0x308c33)[_0xaee1('0x2d')](_0x348e4c);};}exports['index']=function(_0x30eaf1,_0x513fb5){var _0x364c24={},_0x23e05d={},_0xeccf1d={'count':0x0,'rows':[]};var _0x3515fa=db[_0xaee1('0x2e')][_0xaee1('0x2f')];_0x23e05d[_0xaee1('0x30')]=_[_0xaee1('0x31')](_0x3515fa);_0x23e05d[_0xaee1('0x32')]=_[_0xaee1('0x31')](_0x30eaf1[_0xaee1('0x32')]);_0x23e05d[_0xaee1('0x33')]=_[_0xaee1('0x34')](_0x23e05d['model'],_0x23e05d[_0xaee1('0x32')]);_0x364c24[_0xaee1('0x35')]=_[_0xaee1('0x34')](_0x23e05d[_0xaee1('0x30')],qs['fields'](_0x30eaf1[_0xaee1('0x32')][_0xaee1('0x36')]));_0x364c24[_0xaee1('0x35')]=_0x364c24['attributes'][_0xaee1('0x37')]?_0x364c24[_0xaee1('0x35')]:_0x23e05d['model'];if(!_0x30eaf1[_0xaee1('0x32')][_0xaee1('0x38')](_0xaee1('0x39'))){_0x364c24[_0xaee1('0x20')]=qs[_0xaee1('0x20')](_0x30eaf1[_0xaee1('0x32')][_0xaee1('0x20')]);_0x364c24[_0xaee1('0x1f')]=qs[_0xaee1('0x1f')](_0x30eaf1[_0xaee1('0x32')][_0xaee1('0x1f')]);}_0x364c24['order']=qs[_0xaee1('0x3a')](_0x30eaf1[_0xaee1('0x32')]['sort']);_0x364c24[_0xaee1('0x3b')]=qs[_0xaee1('0x33')](_[_0xaee1('0x3c')](_0x30eaf1[_0xaee1('0x32')],_0x23e05d[_0xaee1('0x33')]));if(_0x30eaf1[_0xaee1('0x32')][_0xaee1('0x3d')]){_0x364c24[_0xaee1('0x3b')]=_[_0xaee1('0x3e')](_0x364c24[_0xaee1('0x3b')],{'$or':_[_0xaee1('0x3f')](_0x3515fa,function(_0x1e845c){if(_0x1e845c[_0xaee1('0x40')]['key']!==_0xaee1('0x41')){var _0x5bbc5f={};_0x5bbc5f[_0x1e845c['field']]={'$like':'%'+_0x30eaf1['query'][_0xaee1('0x3d')]+'%'};return _0x5bbc5f;}})});}_0x364c24=_[_0xaee1('0x3e')]({},_0x364c24,_0x30eaf1[_0xaee1('0x42')]);var _0x1b8629={'where':_0x364c24['where']};return db['CmList'][_0xaee1('0x1e')](_0x1b8629)['then'](function(_0x48f88e){_0xeccf1d[_0xaee1('0x1e')]=_0x48f88e;if(_0x30eaf1[_0xaee1('0x32')]['includeAll']){_0x364c24[_0xaee1('0x43')]=[{'all':!![]}];}return db['CmList']['findAll'](_0x364c24);})[_0xaee1('0x26')](function(_0x1538de){_0xeccf1d[_0xaee1('0x44')]=_0x1538de;return _0xeccf1d;})['then'](respondWithFilteredResult(_0x513fb5,_0x364c24))[_0xaee1('0x45')](handleError(_0x513fb5,null));};exports[_0xaee1('0x46')]=function(_0x1cd434,_0x194ddd){var _0x1a106={'raw':![],'where':{'id':_0x1cd434[_0xaee1('0x47')]['id']}},_0x19908d={};_0x19908d[_0xaee1('0x30')]=_['keys'](db[_0xaee1('0x2e')][_0xaee1('0x2f')]);_0x19908d[_0xaee1('0x32')]=_[_0xaee1('0x31')](_0x1cd434[_0xaee1('0x32')]);_0x19908d[_0xaee1('0x33')]=_[_0xaee1('0x34')](_0x19908d['model'],_0x19908d[_0xaee1('0x32')]);_0x1a106[_0xaee1('0x35')]=_[_0xaee1('0x34')](_0x19908d[_0xaee1('0x30')],qs[_0xaee1('0x36')](_0x1cd434[_0xaee1('0x32')][_0xaee1('0x36')]));_0x1a106[_0xaee1('0x35')]=_0x1a106[_0xaee1('0x35')][_0xaee1('0x37')]?_0x1a106[_0xaee1('0x35')]:_0x19908d[_0xaee1('0x30')];if(_0x1cd434[_0xaee1('0x32')]['includeAll']){_0x1a106['include']=[{'all':!![]}];}_0x1a106=_['merge']({},_0x1a106,_0x1cd434[_0xaee1('0x42')]);return db[_0xaee1('0x2e')]['find'](_0x1a106)[_0xaee1('0x26')](handleEntityNotFound(_0x194ddd,null))[_0xaee1('0x26')](respondWithResult(_0x194ddd,null))['catch'](handleError(_0x194ddd,null));};exports[_0xaee1('0x48')]=function(_0x5e9602,_0x123541){return db[_0xaee1('0x2e')][_0xaee1('0x48')](_0x5e9602[_0xaee1('0x49')],{})[_0xaee1('0x26')](function(_0x5a9c09){var _0x5ebeb1=_0x5e9602[_0xaee1('0x4a')][_0xaee1('0x28')]({'plain':!![]});if(!_0x5ebeb1)throw new Error(_0xaee1('0x4b'));if(_0x5ebeb1[_0xaee1('0x4c')]===_0xaee1('0x4a')){var _0x48a04c=_0x5a9c09['get']({'plain':!![]});var _0x17be9d=_0xaee1('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x17be9d,'userProfileId':_0x5ebeb1['userProfileId']},'raw':!![]})['then'](function(_0x59345a){if(_0x59345a&&_0x59345a[_0xaee1('0x4d')]===0x0){return db[_0xaee1('0x2a')][_0xaee1('0x48')]({'name':_0x48a04c[_0xaee1('0x2c')],'resourceId':_0x48a04c['id'],'type':_0x59345a[_0xaee1('0x2c')],'sectionId':_0x59345a['id']},{})[_0xaee1('0x26')](function(){return _0x5a9c09;});}else{return _0x5a9c09;}})[_0xaee1('0x45')](function(_0x58c812){logger[_0xaee1('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x58c812);throw _0x58c812;});}return _0x5a9c09;})[_0xaee1('0x26')](respondWithResult(_0x123541,0xc9))[_0xaee1('0x45')](handleError(_0x123541,null));};exports['update']=function(_0x16f8ba,_0x2d74ad){if(_0x16f8ba[_0xaee1('0x49')]['id']){delete _0x16f8ba[_0xaee1('0x49')]['id'];}return db[_0xaee1('0x2e')][_0xaee1('0x4f')]({'where':{'id':_0x16f8ba['params']['id']}})['then'](handleEntityNotFound(_0x2d74ad,null))[_0xaee1('0x26')](saveUpdates(_0x16f8ba[_0xaee1('0x49')],null))[_0xaee1('0x26')](respondWithResult(_0x2d74ad,null))['catch'](handleError(_0x2d74ad,null));};exports[_0xaee1('0x27')]=function(_0x182d88,_0x137c9f){return db['CmList'][_0xaee1('0x4f')]({'where':{'id':_0x182d88[_0xaee1('0x47')]['id']}})['then'](handleEntityNotFound(_0x137c9f,null))[_0xaee1('0x26')](removeEntity(_0x137c9f,null))[_0xaee1('0x45')](handleError(_0x137c9f,null));};exports[_0xaee1('0x50')]=function(_0x4ebffe,_0x41c544){return db[_0xaee1('0x2e')][_0xaee1('0x50')]()[_0xaee1('0x26')](respondWithResult(_0x41c544,null))[_0xaee1('0x45')](handleError(_0x41c544,null));};exports['addDisposition']=function(_0x3a0fa1,_0x1686d1,_0x209735){if(_0x3a0fa1[_0xaee1('0x49')]['id']){delete _0x3a0fa1[_0xaee1('0x49')]['id'];}return db['CmList'][_0xaee1('0x4f')]({'where':{'id':_0x3a0fa1[_0xaee1('0x47')]['id']}})[_0xaee1('0x26')](handleEntityNotFound(_0x1686d1,null))[_0xaee1('0x26')](function(_0x4885e5){if(_0x4885e5){_0x3a0fa1[_0xaee1('0x49')][_0xaee1('0x51')]=_0x4885e5['id'];return db[_0xaee1('0x52')][_0xaee1('0x48')](_0x3a0fa1[_0xaee1('0x49')]);}})[_0xaee1('0x26')](respondWithResult(_0x1686d1,null))[_0xaee1('0x45')](handleError(_0x1686d1,null));};exports[_0xaee1('0x53')]=function(_0x165a48,_0xc68a7f,_0x4169ce){var _0x4ec642={'raw':![],'where':{}};var _0x525bac={};var _0x2b0e67={'count':0x0,'rows':[]};return db[_0xaee1('0x2e')]['findOne']({'where':{'id':_0x165a48[_0xaee1('0x47')]['id']}})['then'](handleEntityNotFound(_0xc68a7f,null))['then'](function(_0x167f82){if(_0x167f82){_0x525bac[_0xaee1('0x30')]=_[_0xaee1('0x31')](db[_0xaee1('0x52')][_0xaee1('0x2f')]);_0x525bac[_0xaee1('0x32')]=_[_0xaee1('0x31')](_0x165a48[_0xaee1('0x32')]);_0x525bac[_0xaee1('0x33')]=_[_0xaee1('0x34')](_0x525bac[_0xaee1('0x30')],_0x525bac[_0xaee1('0x32')]);_0x4ec642[_0xaee1('0x35')]=_['intersection'](_0x525bac[_0xaee1('0x30')],qs[_0xaee1('0x36')](_0x165a48[_0xaee1('0x32')][_0xaee1('0x36')]));_0x4ec642['attributes']=_0x4ec642['attributes'][_0xaee1('0x37')]?_0x4ec642[_0xaee1('0x35')]:_0x525bac['model'];if(!_0x165a48['query'][_0xaee1('0x38')](_0xaee1('0x39'))){_0x4ec642[_0xaee1('0x20')]=qs[_0xaee1('0x20')](_0x165a48[_0xaee1('0x32')]['limit']);_0x4ec642['offset']=qs[_0xaee1('0x1f')](_0x165a48[_0xaee1('0x32')][_0xaee1('0x1f')]);}_0x4ec642[_0xaee1('0x54')]=qs['sort'](_0x165a48['query'][_0xaee1('0x3a')]);_0x4ec642['where']=qs[_0xaee1('0x33')](_[_0xaee1('0x3c')](_0x165a48[_0xaee1('0x32')],_0x525bac['filters']));_0x4ec642['where'][_0xaee1('0x51')]=_0x167f82['id'];if(_0x165a48[_0xaee1('0x32')][_0xaee1('0x3d')]){_0x4ec642[_0xaee1('0x3b')]=_[_0xaee1('0x3e')](_0x4ec642[_0xaee1('0x3b')],{'$or':_[_0xaee1('0x3f')](_0x4ec642['attributes'],function(_0x4deaaf){var _0x4c1a09={};_0x4c1a09[_0x4deaaf]={'$like':'%'+_0x165a48[_0xaee1('0x32')][_0xaee1('0x3d')]+'%'};return _0x4c1a09;})});}_0x4ec642=_[_0xaee1('0x3e')]({},_0x4ec642,_0x165a48[_0xaee1('0x42')]);return db[_0xaee1('0x52')]['count']({'where':_0x4ec642[_0xaee1('0x3b')]})[_0xaee1('0x26')](function(_0x3deb1b){_0x2b0e67[_0xaee1('0x1e')]=_0x3deb1b;if(_0x165a48[_0xaee1('0x32')][_0xaee1('0x55')]){_0x4ec642[_0xaee1('0x43')]=[{'all':!![]}];}return db['Disposition'][_0xaee1('0x56')](_0x4ec642);})[_0xaee1('0x26')](function(_0x3b941d){_0x2b0e67[_0xaee1('0x44')]=_0x3b941d;return _0x2b0e67;});}})[_0xaee1('0x26')](respondWithFilteredResult(_0xc68a7f,_0x4ec642))[_0xaee1('0x45')](handleError(_0xc68a7f,null));};exports[_0xaee1('0x57')]=function(_0x290c3d,_0x186630,_0x576d11){var _0x142a00;return db[_0xaee1('0x2e')]['find']({'where':{'id':_0x290c3d[_0xaee1('0x47')]['id']}})[_0xaee1('0x26')](handleEntityNotFound(_0x186630,null))[_0xaee1('0x26')](function(_0x244050){if(_0x244050){return _0x244050[_0xaee1('0x57')](_0x290c3d[_0xaee1('0x32')][_0xaee1('0x58')]);}})[_0xaee1('0x26')](respondWithStatusCode(_0x186630,null))[_0xaee1('0x45')](handleError(_0x186630,null));};exports[_0xaee1('0x59')]=function(_0x428f1a,_0x7158f3,_0x52eff9){return db[_0xaee1('0x2e')]['find']({'where':{'id':_0x428f1a[_0xaee1('0x47')]['id']}})[_0xaee1('0x26')](handleEntityNotFound(_0x7158f3,null))[_0xaee1('0x26')](function(_0xb708e4){if(_0xb708e4){var _0x1aac57=[];var _0xf11752={'success':[],'errors':[]};return db[_0xaee1('0x5a')][_0xaee1('0x50')]()[_0xaee1('0x26')](function(_0x1cab92){if(_0x428f1a[_0xaee1('0x49')]['tags']&&_['isArray'](_0x428f1a['body']['tags'])){if(_0x428f1a['body']['tags'][_0xaee1('0x37')]){_0x428f1a[_0xaee1('0x49')][_0xaee1('0x5b')]=_0x428f1a['body'][_0xaee1('0x5b')][_0xaee1('0x5c')](';')+';';}else{_0x428f1a[_0xaee1('0x49')][_0xaee1('0x5b')]=null;}}else{_0x428f1a[_0xaee1('0x49')]['tags']=null;}if(_0x428f1a[_0xaee1('0x49')]&&_[_0xaee1('0x5d')](_0x428f1a[_0xaee1('0x49')])){for(var _0x5c8014=0x0;_0x5c8014<_0x428f1a['body'][_0xaee1('0x37')];_0x5c8014+=0x1){_0x428f1a[_0xaee1('0x49')][_0x5c8014]['ListId']=_0x428f1a[_0xaee1('0x47')]['id'];_0x1aac57[_0xaee1('0x5e')](_0x428f1a[_0xaee1('0x49')][_0x5c8014]);}return BPromise[_0xaee1('0x5f')](_0x1aac57,function(_0x28ce49){return db[_0xaee1('0x5a')][_0xaee1('0x48')](_[_0xaee1('0x60')](_0x28ce49,['ids','id'])||{},{'fields':_[_0xaee1('0x31')](_0x1cab92),'raw':!![]})[_0xaee1('0x26')](function(_0xdb834c){_0xf11752[_0xaee1('0x61')]['push'](_0xdb834c[_0xaee1('0x62')]);})[_0xaee1('0x45')](function(_0x3ca226){_0xf11752[_0xaee1('0x63')][_0xaee1('0x5e')]({'data':_0x28ce49,'error':_0x3ca226[_0xaee1('0x64')]});});})[_0xaee1('0x26')](function(_0x8ff40d){return _0xf11752;})[_0xaee1('0x45')](function(_0x1007d8){return _0x1007d8;});}else{_0x7158f3[_0xaee1('0x1b')](0x190)[_0xaee1('0x1d')]({'message':_0xaee1('0x65')});}});}})[_0xaee1('0x26')](respondWithResult(_0x7158f3,null))[_0xaee1('0x45')](handleError(_0x7158f3,null));};exports['getContacts']=function(_0x13ab30,_0x225afc,_0x570851){var _0x11848b;return db[_0xaee1('0x2e')][_0xaee1('0x4f')]({'where':{'id':_0x13ab30[_0xaee1('0x47')]['id']},'include':[{'model':db[_0xaee1('0x66')],'as':'CustomFields'}]})[_0xaee1('0x26')](handleEntityNotFound(_0x225afc,null))[_0xaee1('0x26')](function(_0x5eef3d){if(_0x5eef3d){_0x11848b=_0x5eef3d;return db[_0xaee1('0x5a')][_0xaee1('0x2f')];}})['then'](function(_0x535796){if(_0x535796){var _0x3c2b7b={};var _0x3fee96={};_0x3fee96[_0xaee1('0x30')]=_[_0xaee1('0x67')](_['keys'](_0x535796),_[_0xaee1('0x3f')](_0x11848b[_0xaee1('0x68')],function(_0x5a56e7){return util[_0xaee1('0x69')](_0xaee1('0x6a'),_0x5a56e7['id']);}));_0x3fee96[_0xaee1('0x32')]=_[_0xaee1('0x31')](_0x13ab30[_0xaee1('0x32')]);_0x3fee96[_0xaee1('0x33')]=_[_0xaee1('0x34')](_0x3fee96['model'],_0x3fee96[_0xaee1('0x32')]);_0x3c2b7b['attributes']=_[_0xaee1('0x34')](_0x3fee96[_0xaee1('0x30')],qs[_0xaee1('0x36')](_0x13ab30[_0xaee1('0x32')][_0xaee1('0x36')]));_0x3c2b7b[_0xaee1('0x35')]=_0x3c2b7b[_0xaee1('0x35')][_0xaee1('0x37')]?_0x3c2b7b[_0xaee1('0x35')]:_0x3fee96[_0xaee1('0x30')];if(!_0x13ab30[_0xaee1('0x32')][_0xaee1('0x38')](_0xaee1('0x39'))){_0x3c2b7b[_0xaee1('0x20')]=qs[_0xaee1('0x20')](_0x13ab30[_0xaee1('0x32')][_0xaee1('0x20')]);_0x3c2b7b[_0xaee1('0x1f')]=qs[_0xaee1('0x1f')](_0x13ab30[_0xaee1('0x32')][_0xaee1('0x1f')]);}_0x3c2b7b['order']=qs[_0xaee1('0x3a')](_0x13ab30[_0xaee1('0x32')]['sort']);_0x3c2b7b['where']=qs[_0xaee1('0x33')](_[_0xaee1('0x3c')](_0x13ab30[_0xaee1('0x32')],_0x3fee96['filters']));_0x3c2b7b[_0xaee1('0x6b')]=!![];if(_0x13ab30[_0xaee1('0x32')][_0xaee1('0x3d')]){_0x3c2b7b['where']=_['merge'](_0x3c2b7b[_0xaee1('0x3b')],{'$or':_['map'](_0x3c2b7b[_0xaee1('0x35')],function(_0x255ba2){var _0x50d867={};_0x50d867[_0x255ba2]={'$like':'%'+_0x13ab30[_0xaee1('0x32')][_0xaee1('0x3d')]+'%'};return _0x50d867;})});}_0x3c2b7b=_['merge']({},_0x3c2b7b,_0x13ab30[_0xaee1('0x42')]);return _0x11848b['getContacts'](_0x3c2b7b);}})[_0xaee1('0x26')](respondWithResult(_0x225afc,null))[_0xaee1('0x45')](handleError(_0x225afc,null));};exports[_0xaee1('0x6c')]=function(_0x2567ad,_0x527235,_0x3efc36){var _0x501a6e;return db[_0xaee1('0x2e')][_0xaee1('0x4f')]({'where':{'id':_0x2567ad[_0xaee1('0x47')]['id']},'include':[{'model':db[_0xaee1('0x66')],'as':_0xaee1('0x68')}]})[_0xaee1('0x26')](handleEntityNotFound(_0x527235,null))[_0xaee1('0x26')](function(_0x394b19){if(_0x394b19){_0x501a6e=_0x394b19;return db[_0xaee1('0x5a')][_0xaee1('0x2f')];}})[_0xaee1('0x26')](function(_0x25dd14){if(_0x25dd14){var _0x401eb8={};var _0x302de1={};_0x302de1[_0xaee1('0x30')]=_['concat'](_[_0xaee1('0x31')](_0x25dd14),_['map'](_0x501a6e['CustomFields'],function(_0x4f0d7e){return util['format'](_0xaee1('0x6a'),_0x4f0d7e['id']);}));_0x302de1[_0xaee1('0x32')]=_[_0xaee1('0x31')](_0x2567ad['query']);_0x302de1[_0xaee1('0x33')]=_['intersection'](_0x302de1[_0xaee1('0x30')],_0x302de1['query']);_0x401eb8[_0xaee1('0x35')]=_[_0xaee1('0x34')](_0x302de1[_0xaee1('0x30')],qs[_0xaee1('0x36')](_0x2567ad[_0xaee1('0x32')]['fields']));_0x401eb8['attributes']=_0x401eb8[_0xaee1('0x35')][_0xaee1('0x37')]?_0x401eb8[_0xaee1('0x35')]:_0x302de1['model'];if(!_0x2567ad[_0xaee1('0x32')]['hasOwnProperty'](_0xaee1('0x39'))){_0x401eb8[_0xaee1('0x20')]=qs[_0xaee1('0x20')](_0x2567ad[_0xaee1('0x32')][_0xaee1('0x20')]);_0x401eb8[_0xaee1('0x1f')]=qs[_0xaee1('0x1f')](_0x2567ad[_0xaee1('0x32')]['offset']);}_0x401eb8['order']=qs[_0xaee1('0x3a')](_0x2567ad[_0xaee1('0x32')]['sort']);_0x401eb8['where']=qs[_0xaee1('0x33')](_[_0xaee1('0x3c')](_0x2567ad[_0xaee1('0x32')],_0x302de1[_0xaee1('0x33')]));_0x401eb8[_0xaee1('0x6b')]=!![];if(_0x2567ad[_0xaee1('0x32')][_0xaee1('0x3d')]){_0x401eb8['where']=_[_0xaee1('0x3e')](_0x401eb8[_0xaee1('0x3b')],{'$or':_[_0xaee1('0x3f')](_0x401eb8['attributes'],function(_0x3ec55e){var _0x4408d8={};_0x4408d8[_0x3ec55e]={'$like':'%'+_0x2567ad[_0xaee1('0x32')]['filter']+'%'};return _0x4408d8;})});}_0x401eb8=_[_0xaee1('0x3e')]({},_0x401eb8,_0x2567ad[_0xaee1('0x42')]);return _0x501a6e['getContacts'](_0x401eb8);}})['then'](function(_0xf8d042){if(!_['isEmpty'](_0xf8d042)){var _0x5c4669=toCsv(_0xf8d042);var _0x40bfda=Date[_0xaee1('0x6d')]();fs[_0xaee1('0x6e')](util[_0xaee1('0x69')](_0xaee1('0x6f'),_0x501a6e['id'],_0x40bfda),_0x5c4669);_0x527235[_0xaee1('0x70')](_0xaee1('0x71'),_0xaee1('0x72')+util[_0xaee1('0x69')](_0xaee1('0x73'),_0x501a6e['id'],_0x40bfda));_0x527235[_0xaee1('0x70')](_0xaee1('0x74'),'text/csv');return _0x527235['download'](util[_0xaee1('0x69')](_0xaee1('0x6f'),_0x501a6e['id'],_0x40bfda));}else{return _0x527235[_0xaee1('0x1a')](0xcc);}})['catch'](handleError(_0x527235,null));};exports['addCustomField']=function(_0x50086e,_0x557ddc,_0x3fe910){var _0x20e678;delete _0x50086e[_0xaee1('0x49')]['id'];return db[_0xaee1('0x2e')][_0xaee1('0x75')]({'where':{'id':_0x50086e[_0xaee1('0x47')]['id']}})['then'](handleEntityNotFound(_0x557ddc,null))[_0xaee1('0x26')](function(_0x1e0771){if(_0x1e0771){return db[_0xaee1('0x76')]['transaction'](function(_0x493114){return db[_0xaee1('0x66')][_0xaee1('0x48')](_0x50086e['body'],{'transaction':_0x493114})[_0xaee1('0x26')](function(_0x4f3cbf){_0x20e678=_0x4f3cbf;return _0x1e0771[_0xaee1('0x77')](_0x4f3cbf,{'transaction':_0x493114});})[_0xaee1('0x26')](function(){var _0xdb77c3={'type':db[_0xaee1('0x78')][_0xaee1('0x79')],'transaction':_0x493114};switch(_0x50086e[_0xaee1('0x49')]['type']){case _0xaee1('0x7a'):_0xdb77c3[_0xaee1('0x40')]=db[_0xaee1('0x78')][_0xaee1('0x79')];break;case _0xaee1('0x7b'):_0xdb77c3[_0xaee1('0x40')]=db[_0xaee1('0x78')]['INTEGER'];break;case'switch':_0xdb77c3[_0xaee1('0x40')]=db[_0xaee1('0x78')][_0xaee1('0x7c')];_0xdb77c3[_0xaee1('0x7d')]=![];break;default:}return db['sequelize']['queryInterface']['addColumn'](_0xaee1('0x7e'),util['format'](_0xaee1('0x7f'),_0x20e678['id']),_0xdb77c3);})['then'](function(){return _0x20e678;});});}})[_0xaee1('0x26')](respondWithResult(_0x557ddc,null))['catch'](handleError(_0x557ddc,null));};exports[_0xaee1('0x80')]=function(_0x1c21e5,_0x2329e8,_0x3358f5){var _0x5577f6={};var _0x2e53bf={};var _0x1183a2;var _0x39b5a;return db[_0xaee1('0x2e')]['findOne']({'where':{'id':_0x1c21e5['params']['id']}})['then'](handleEntityNotFound(_0x2329e8,null))[_0xaee1('0x26')](function(_0x193b60){if(_0x193b60){_0x1183a2=_0x193b60;_0x2e53bf[_0xaee1('0x30')]=_[_0xaee1('0x31')](db[_0xaee1('0x66')][_0xaee1('0x2f')]);_0x2e53bf[_0xaee1('0x32')]=_['keys'](_0x1c21e5['query']);_0x2e53bf[_0xaee1('0x33')]=_['intersection'](_0x2e53bf[_0xaee1('0x30')],_0x2e53bf[_0xaee1('0x32')]);_0x5577f6[_0xaee1('0x35')]=_['intersection'](_0x2e53bf[_0xaee1('0x30')],qs[_0xaee1('0x36')](_0x1c21e5[_0xaee1('0x32')]['fields']));_0x5577f6[_0xaee1('0x35')]=_0x5577f6[_0xaee1('0x35')]['length']?_0x5577f6[_0xaee1('0x35')]:_0x2e53bf['model'];_0x5577f6['order']=qs[_0xaee1('0x3a')](_0x1c21e5[_0xaee1('0x32')][_0xaee1('0x3a')]);_0x5577f6[_0xaee1('0x3b')]=qs[_0xaee1('0x33')](_[_0xaee1('0x3c')](_0x1c21e5[_0xaee1('0x32')],_0x2e53bf[_0xaee1('0x33')]));_0x5577f6[_0xaee1('0x3b')]=_['merge'](_0x5577f6['where'],{'$or':[{'ListId':_0x193b60['id']},{'ListId':null}]});if(_0x1c21e5['query'][_0xaee1('0x3d')]){_0x5577f6[_0xaee1('0x3b')]=_['merge'](_0x5577f6[_0xaee1('0x3b')],{'$or':_['map'](_0x5577f6['attributes'],function(_0x4579ae){var _0x515eb6={};_0x515eb6[_0x4579ae]={'$like':'%'+_0x1c21e5[_0xaee1('0x32')]['filter']+'%'};return _0x515eb6;})});}_0x5577f6=_['merge']({},_0x5577f6,_0x1c21e5[_0xaee1('0x42')]);return db[_0xaee1('0x66')][_0xaee1('0x81')](_0x5577f6);}})['then'](respondWithResult(_0x2329e8,null))[_0xaee1('0x45')](handleError(_0x2329e8,null));};exports[_0xaee1('0x82')]=function(_0x56b2a4,_0x344d48,_0x337797){return db[_0xaee1('0x2e')][_0xaee1('0x4f')]({'where':{'id':_0x56b2a4[_0xaee1('0x47')]['id']}})['then'](handleEntityNotFound(_0x344d48,null))['then'](function(_0x596382){if(_0x596382){return _0x596382['addAgents'](_0x56b2a4[_0xaee1('0x49')]['ids'],_['omit'](_0x56b2a4['body'],[_0xaee1('0x58'),'id'])||{})['spread'](function(_0x53a96c){for(var _0x41271d=0x0;_0x41271d<_0x56b2a4[_0xaee1('0x49')][_0xaee1('0x58')][_0xaee1('0x37')];_0x41271d+=0x1){socket[_0xaee1('0x83')](_0xaee1('0x84'),{'UserId':_0x56b2a4[_0xaee1('0x49')][_0xaee1('0x58')][_0x41271d],'CmListId':_0x56b2a4[_0xaee1('0x47')]['id']});}return _0x53a96c;});}})['then'](respondWithResult(_0x344d48,null))[_0xaee1('0x45')](handleError(_0x344d48,null));};exports[_0xaee1('0x85')]=function(_0x2406a0,_0x2a0e21,_0x140bb0){var _0xf69080;return db[_0xaee1('0x2e')]['find']({'where':{'id':_0x2406a0[_0xaee1('0x47')]['id']}})[_0xaee1('0x26')](handleEntityNotFound(_0x2a0e21,null))['then'](function(_0xc7783e){if(_0xc7783e){return _0xc7783e[_0xaee1('0x85')](_0x2406a0[_0xaee1('0x32')][_0xaee1('0x58')])[_0xaee1('0x26')](function(_0x50e0ad){if(_[_0xaee1('0x5d')](_0x2406a0[_0xaee1('0x32')][_0xaee1('0x58')])){for(var _0x408fb6=0x0;_0x408fb6<_0x2406a0['query']['ids'][_0xaee1('0x37')];_0x408fb6+=0x1){socket[_0xaee1('0x83')]('userCmList:remove',{'UserId':_0x2406a0[_0xaee1('0x32')][_0xaee1('0x58')][_0x408fb6],'CmListId':_0x2406a0[_0xaee1('0x47')]['id']});}}else{socket[_0xaee1('0x83')]('userCmList:remove',{'UserId':_0x2406a0[_0xaee1('0x32')][_0xaee1('0x58')],'CmListId':_0x2406a0[_0xaee1('0x47')]['id']});}});}})[_0xaee1('0x26')](respondWithStatusCode(_0x2a0e21,null))[_0xaee1('0x45')](handleError(_0x2a0e21,null));};exports['getAgents']=function(_0x410ba5,_0xd44dd4,_0x477dc9){var _0x487ef9={};var _0x30f620={};var _0x2c5c44;var _0x237249;return db['CmList'][_0xaee1('0x75')]({'where':{'id':_0x410ba5[_0xaee1('0x47')]['id']}})[_0xaee1('0x26')](handleEntityNotFound(_0xd44dd4,null))[_0xaee1('0x26')](function(_0x2ff3f8){if(_0x2ff3f8){_0x2c5c44=_0x2ff3f8;_0x30f620[_0xaee1('0x30')]=_[_0xaee1('0x31')](db[_0xaee1('0x86')][_0xaee1('0x2f')]);_0x30f620[_0xaee1('0x32')]=_[_0xaee1('0x31')](_0x410ba5[_0xaee1('0x32')]);_0x30f620[_0xaee1('0x33')]=_['intersection'](_0x30f620[_0xaee1('0x30')],_0x30f620[_0xaee1('0x32')]);_0x487ef9[_0xaee1('0x35')]=_['intersection'](_0x30f620[_0xaee1('0x30')],qs[_0xaee1('0x36')](_0x410ba5['query'][_0xaee1('0x36')]));_0x487ef9[_0xaee1('0x35')]=_0x487ef9['attributes'][_0xaee1('0x37')]?_0x487ef9[_0xaee1('0x35')]:_0x30f620[_0xaee1('0x30')];_0x487ef9[_0xaee1('0x54')]=qs['sort'](_0x410ba5[_0xaee1('0x32')][_0xaee1('0x3a')]);_0x487ef9[_0xaee1('0x3b')]=qs[_0xaee1('0x33')](_[_0xaee1('0x3c')](_0x410ba5[_0xaee1('0x32')],_0x30f620[_0xaee1('0x33')]));if(_0x410ba5[_0xaee1('0x32')][_0xaee1('0x3d')]){_0x487ef9[_0xaee1('0x3b')]=_[_0xaee1('0x3e')](_0x487ef9[_0xaee1('0x3b')],{'$or':_[_0xaee1('0x3f')](_0x487ef9['attributes'],function(_0x340998){var _0x2f6099={};_0x2f6099[_0x340998]={'$like':'%'+_0x410ba5[_0xaee1('0x32')]['filter']+'%'};return _0x2f6099;})});}_0x487ef9=_[_0xaee1('0x3e')]({},_0x487ef9,_0x410ba5[_0xaee1('0x42')]);return _0x2c5c44[_0xaee1('0x87')](_0x487ef9);}})[_0xaee1('0x26')](function(_0x31aea1){if(_0x31aea1){_0x237249=_0x31aea1[_0xaee1('0x37')];if(!_0x410ba5['query']['hasOwnProperty'](_0xaee1('0x39'))){_0x487ef9[_0xaee1('0x20')]=qs[_0xaee1('0x20')](_0x410ba5[_0xaee1('0x32')][_0xaee1('0x20')]);_0x487ef9[_0xaee1('0x1f')]=qs['offset'](_0x410ba5['query'][_0xaee1('0x1f')]);}return _0x2c5c44[_0xaee1('0x87')](_0x487ef9);}})[_0xaee1('0x26')](function(_0x501159){if(_0x501159){return _0x501159?{'count':_0x237249,'rows':_0x501159}:null;}})[_0xaee1('0x26')](respondWithResult(_0xd44dd4,null))['catch'](handleError(_0xd44dd4,null));};
\ No newline at end of file
+var _0x4c5b=['UserProfileResource','end','sendStatus','name','index','CmList','rawAttributes','keys','query','intersection','attributes','model','fields','length','nolimit','order','sort','where','filters','pick','field','filter','merge','options','count','includeAll','rows','catch','params','include','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Lists','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getDispositions','findOne','hasOwnProperty','ListId','map','Disposition','removeDispositions','tags','isArray','join','push','each','ids','success','errors','message','getContacts','CmCustomField','CustomFields','CmContact','concat','format','cf_%d','raw','isEmpty','writeFileSync','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','text','type','Sequelize','TEXT','number','INTEGER','BOOLEAN','queryInterface','addColumn','cm_contacts','cf_%s','findAndCountAll','addAgents','omit','spread','removeAgents','emit','userCmList:remove','User','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','register','status','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x2c308c,_0x5d826c){var _0x4ad852=function(_0xd3ba56){while(--_0xd3ba56){_0x2c308c['push'](_0x2c308c['shift']());}};_0x4ad852(++_0x5d826c);}(_0x4c5b,0xe8));var _0xb4c5=function(_0x48ab27,_0x23ca72){_0x48ab27=_0x48ab27-0x0;var _0x26b6f0=_0x4c5b[_0x48ab27];return _0x26b6f0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb4c5('0x0'));var rimraf=require(_0xb4c5('0x1'));var zipdir=require(_0xb4c5('0x2'));var jsonpatch=require(_0xb4c5('0x3'));var rp=require(_0xb4c5('0x4'));var moment=require(_0xb4c5('0x5'));var BPromise=require(_0xb4c5('0x6'));var Mustache=require(_0xb4c5('0x7'));var util=require(_0xb4c5('0x8'));var path=require('path');var sox=require(_0xb4c5('0x9'));var csv=require(_0xb4c5('0xa'));var ejs=require(_0xb4c5('0xb'));var fs=require('fs');var _=require(_0xb4c5('0xc'));var squel=require(_0xb4c5('0xd'));var crypto=require(_0xb4c5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb4c5('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb4c5('0x10'));var Papa=require(_0xb4c5('0x11'));var authService=require(_0xb4c5('0x12'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0xb4c5('0x13'));var qs=require(_0xb4c5('0x14'));var logger=require(_0xb4c5('0x15'))(_0xb4c5('0x16'));var utils=require(_0xb4c5('0x17'));var config=require(_0xb4c5('0x18'));var db=require(_0xb4c5('0x19'))['db'];config[_0xb4c5('0x1a')]=_['defaults'](config[_0xb4c5('0x1a')],{'host':_0xb4c5('0x1b'),'port':0x18eb});var socket=require(_0xb4c5('0x1c'))(new Redis(config[_0xb4c5('0x1a')]));require(_0xb4c5('0x1d'))[_0xb4c5('0x1e')](socket);function respondWithStatusCode(_0x5b464c,_0x5ec7f3){_0x5ec7f3=_0x5ec7f3||0xcc;return function(_0x1534e1){if(_0x1534e1){return _0x5b464c['sendStatus'](_0x5ec7f3);}return _0x5b464c[_0xb4c5('0x1f')](_0x5ec7f3)['end']();};}function respondWithResult(_0x8a5713,_0x3cb9c0){_0x3cb9c0=_0x3cb9c0||0xc8;return function(_0x86696){if(_0x86696){return _0x8a5713['status'](_0x3cb9c0)[_0xb4c5('0x20')](_0x86696);}};}function respondWithFilteredResult(_0x1efcbe,_0x4186ea){return function(_0x6fec5b){if(_0x6fec5b){var _0x1bc73c=_0x6fec5b['count'],_0x274fc3=_0x4186ea[_0xb4c5('0x21')],_0x4b4ef3=_0x4186ea[_0xb4c5('0x21')]+_0x4186ea[_0xb4c5('0x22')],_0x4f1a97;if(_0x4b4ef3>=_0x1bc73c){_0x4b4ef3=_0x1bc73c;_0x4f1a97=0xc8;}else{_0x4f1a97=0xce;}_0x1efcbe[_0xb4c5('0x1f')](_0x4f1a97);return _0x1efcbe['set'](_0xb4c5('0x23'),_0x274fc3+'-'+_0x4b4ef3+'/'+_0x1bc73c)['json'](_0x6fec5b);}return null;};}function patchUpdates(_0x3605f7){return function(_0x102309){try{jsonpatch[_0xb4c5('0x24')](_0x102309,_0x3605f7,!![]);}catch(_0x2feabf){return BPromise[_0xb4c5('0x25')](_0x2feabf);}return _0x102309[_0xb4c5('0x26')]();};}function saveUpdates(_0x2e9020,_0x148ece){return function(_0x15e89c){if(_0x15e89c){return _0x15e89c[_0xb4c5('0x27')](_0x2e9020)[_0xb4c5('0x28')](function(_0x5776a5){return _0x5776a5;});}return null;};}function removeEntity(_0xcae645,_0x3495a0){return function(_0x4f95e0){if(_0x4f95e0){return _0x4f95e0[_0xb4c5('0x29')]()[_0xb4c5('0x28')](function(){var _0x4cf040=_0x4f95e0['get']({'plain':!![]});var _0x22079d='Lists';return db[_0xb4c5('0x2a')]['destroy']({'where':{'type':_0x22079d,'resourceId':_0x4cf040['id']}})[_0xb4c5('0x28')](function(){return _0x4f95e0;});})['then'](function(){_0xcae645[_0xb4c5('0x1f')](0xcc)[_0xb4c5('0x2b')]();});}};}function handleEntityNotFound(_0x58a9cf,_0x1e4cd5){return function(_0x582032){if(!_0x582032){_0x58a9cf[_0xb4c5('0x2c')](0x194);}return _0x582032;};}function handleError(_0xcbb762,_0x586965){_0x586965=_0x586965||0x1f4;return function(_0x48491e){logger['error'](_0x48491e['stack']);if(_0x48491e['name']){delete _0x48491e[_0xb4c5('0x2d')];}_0xcbb762[_0xb4c5('0x1f')](_0x586965)['send'](_0x48491e);};}exports[_0xb4c5('0x2e')]=function(_0x47e98a,_0x383a9c){var _0x334cf9={},_0x3b44f5={},_0x1d9547={'count':0x0,'rows':[]};var _0x2e07aa=db[_0xb4c5('0x2f')][_0xb4c5('0x30')];_0x3b44f5['model']=_[_0xb4c5('0x31')](_0x2e07aa);_0x3b44f5[_0xb4c5('0x32')]=_[_0xb4c5('0x31')](_0x47e98a[_0xb4c5('0x32')]);_0x3b44f5['filters']=_[_0xb4c5('0x33')](_0x3b44f5['model'],_0x3b44f5[_0xb4c5('0x32')]);_0x334cf9[_0xb4c5('0x34')]=_['intersection'](_0x3b44f5[_0xb4c5('0x35')],qs[_0xb4c5('0x36')](_0x47e98a[_0xb4c5('0x32')]['fields']));_0x334cf9[_0xb4c5('0x34')]=_0x334cf9[_0xb4c5('0x34')][_0xb4c5('0x37')]?_0x334cf9['attributes']:_0x3b44f5['model'];if(!_0x47e98a['query']['hasOwnProperty'](_0xb4c5('0x38'))){_0x334cf9['limit']=qs[_0xb4c5('0x22')](_0x47e98a['query']['limit']);_0x334cf9[_0xb4c5('0x21')]=qs[_0xb4c5('0x21')](_0x47e98a['query'][_0xb4c5('0x21')]);}_0x334cf9[_0xb4c5('0x39')]=qs[_0xb4c5('0x3a')](_0x47e98a['query']['sort']);_0x334cf9[_0xb4c5('0x3b')]=qs[_0xb4c5('0x3c')](_[_0xb4c5('0x3d')](_0x47e98a[_0xb4c5('0x32')],_0x3b44f5[_0xb4c5('0x3c')]));if(_0x47e98a[_0xb4c5('0x32')]['filter']){_0x334cf9[_0xb4c5('0x3b')]=_['merge'](_0x334cf9['where'],{'$or':_['map'](_0x2e07aa,function(_0xa5d810){if(_0xa5d810['type']['key']!=='VIRTUAL'){var _0x255d67={};_0x255d67[_0xa5d810[_0xb4c5('0x3e')]]={'$like':'%'+_0x47e98a['query'][_0xb4c5('0x3f')]+'%'};return _0x255d67;}})});}_0x334cf9=_[_0xb4c5('0x40')]({},_0x334cf9,_0x47e98a[_0xb4c5('0x41')]);var _0x51f37f={'where':_0x334cf9['where']};return db['CmList']['count'](_0x51f37f)['then'](function(_0x252ee4){_0x1d9547[_0xb4c5('0x42')]=_0x252ee4;if(_0x47e98a[_0xb4c5('0x32')][_0xb4c5('0x43')]){_0x334cf9['include']=[{'all':!![]}];}return db[_0xb4c5('0x2f')]['findAll'](_0x334cf9);})[_0xb4c5('0x28')](function(_0xcac9d){_0x1d9547[_0xb4c5('0x44')]=_0xcac9d;return _0x1d9547;})[_0xb4c5('0x28')](respondWithFilteredResult(_0x383a9c,_0x334cf9))[_0xb4c5('0x45')](handleError(_0x383a9c,null));};exports['show']=function(_0x12cd19,_0x3b31ba){var _0x50bb47={'raw':![],'where':{'id':_0x12cd19[_0xb4c5('0x46')]['id']}},_0x1bbb80={};_0x1bbb80[_0xb4c5('0x35')]=_[_0xb4c5('0x31')](db[_0xb4c5('0x2f')][_0xb4c5('0x30')]);_0x1bbb80['query']=_[_0xb4c5('0x31')](_0x12cd19[_0xb4c5('0x32')]);_0x1bbb80[_0xb4c5('0x3c')]=_[_0xb4c5('0x33')](_0x1bbb80['model'],_0x1bbb80[_0xb4c5('0x32')]);_0x50bb47[_0xb4c5('0x34')]=_['intersection'](_0x1bbb80[_0xb4c5('0x35')],qs[_0xb4c5('0x36')](_0x12cd19['query'][_0xb4c5('0x36')]));_0x50bb47[_0xb4c5('0x34')]=_0x50bb47['attributes'][_0xb4c5('0x37')]?_0x50bb47[_0xb4c5('0x34')]:_0x1bbb80[_0xb4c5('0x35')];if(_0x12cd19[_0xb4c5('0x32')][_0xb4c5('0x43')]){_0x50bb47[_0xb4c5('0x47')]=[{'all':!![]}];}_0x50bb47=_[_0xb4c5('0x40')]({},_0x50bb47,_0x12cd19['options']);return db['CmList'][_0xb4c5('0x48')](_0x50bb47)[_0xb4c5('0x28')](handleEntityNotFound(_0x3b31ba,null))[_0xb4c5('0x28')](respondWithResult(_0x3b31ba,null))[_0xb4c5('0x45')](handleError(_0x3b31ba,null));};exports['create']=function(_0x30e391,_0x285be5){return db[_0xb4c5('0x2f')][_0xb4c5('0x49')](_0x30e391['body'],{})[_0xb4c5('0x28')](function(_0x359c26){var _0x1ea33a=_0x30e391[_0xb4c5('0x4a')][_0xb4c5('0x4b')]({'plain':!![]});if(!_0x1ea33a)throw new Error(_0xb4c5('0x4c'));if(_0x1ea33a['role']===_0xb4c5('0x4a')){var _0x2ecd3e=_0x359c26[_0xb4c5('0x4b')]({'plain':!![]});var _0x28711e=_0xb4c5('0x4d');return db['UserProfileSection'][_0xb4c5('0x48')]({'where':{'name':_0x28711e,'userProfileId':_0x1ea33a[_0xb4c5('0x4e')]},'raw':!![]})['then'](function(_0x9639b9){if(_0x9639b9&&_0x9639b9['autoAssociation']===0x0){return db[_0xb4c5('0x2a')][_0xb4c5('0x49')]({'name':_0x2ecd3e[_0xb4c5('0x2d')],'resourceId':_0x2ecd3e['id'],'type':_0x9639b9['name'],'sectionId':_0x9639b9['id']},{})['then'](function(){return _0x359c26;});}else{return _0x359c26;}})[_0xb4c5('0x45')](function(_0x1926ac){logger['error'](_0xb4c5('0x4f'),_0x1926ac);throw _0x1926ac;});}return _0x359c26;})[_0xb4c5('0x28')](respondWithResult(_0x285be5,0xc9))[_0xb4c5('0x45')](handleError(_0x285be5,null));};exports['update']=function(_0x5aca8e,_0x1795f6){if(_0x5aca8e['body']['id']){delete _0x5aca8e[_0xb4c5('0x50')]['id'];}return db[_0xb4c5('0x2f')][_0xb4c5('0x48')]({'where':{'id':_0x5aca8e[_0xb4c5('0x46')]['id']}})[_0xb4c5('0x28')](handleEntityNotFound(_0x1795f6,null))[_0xb4c5('0x28')](saveUpdates(_0x5aca8e[_0xb4c5('0x50')],null))[_0xb4c5('0x28')](respondWithResult(_0x1795f6,null))['catch'](handleError(_0x1795f6,null));};exports[_0xb4c5('0x29')]=function(_0x4294a8,_0x34e5ba){return db[_0xb4c5('0x2f')][_0xb4c5('0x48')]({'where':{'id':_0x4294a8[_0xb4c5('0x46')]['id']}})[_0xb4c5('0x28')](handleEntityNotFound(_0x34e5ba,null))['then'](removeEntity(_0x34e5ba,null))[_0xb4c5('0x45')](handleError(_0x34e5ba,null));};exports[_0xb4c5('0x51')]=function(_0x2a8244,_0x12bd6b){return db[_0xb4c5('0x2f')][_0xb4c5('0x51')]()[_0xb4c5('0x28')](respondWithResult(_0x12bd6b,null))[_0xb4c5('0x45')](handleError(_0x12bd6b,null));};exports['addDisposition']=function(_0xb170e0,_0xc7c46e,_0x22eeee){if(_0xb170e0[_0xb4c5('0x50')]['id']){delete _0xb170e0['body']['id'];}return db[_0xb4c5('0x2f')]['find']({'where':{'id':_0xb170e0[_0xb4c5('0x46')]['id']}})['then'](handleEntityNotFound(_0xc7c46e,null))['then'](function(_0x4c8f41){if(_0x4c8f41){_0xb170e0[_0xb4c5('0x50')]['ListId']=_0x4c8f41['id'];return db['Disposition']['create'](_0xb170e0[_0xb4c5('0x50')]);}})[_0xb4c5('0x28')](respondWithResult(_0xc7c46e,null))[_0xb4c5('0x45')](handleError(_0xc7c46e,null));};exports[_0xb4c5('0x52')]=function(_0xe888ec,_0x2f49dc,_0x38bf5c){var _0x2bece2={'raw':![],'where':{}};var _0x5f057d={};var _0x4f7952={'count':0x0,'rows':[]};return db[_0xb4c5('0x2f')][_0xb4c5('0x53')]({'where':{'id':_0xe888ec[_0xb4c5('0x46')]['id']}})[_0xb4c5('0x28')](handleEntityNotFound(_0x2f49dc,null))[_0xb4c5('0x28')](function(_0x57b763){if(_0x57b763){_0x5f057d[_0xb4c5('0x35')]=_[_0xb4c5('0x31')](db['Disposition'][_0xb4c5('0x30')]);_0x5f057d[_0xb4c5('0x32')]=_[_0xb4c5('0x31')](_0xe888ec[_0xb4c5('0x32')]);_0x5f057d[_0xb4c5('0x3c')]=_[_0xb4c5('0x33')](_0x5f057d[_0xb4c5('0x35')],_0x5f057d['query']);_0x2bece2[_0xb4c5('0x34')]=_[_0xb4c5('0x33')](_0x5f057d[_0xb4c5('0x35')],qs['fields'](_0xe888ec[_0xb4c5('0x32')][_0xb4c5('0x36')]));_0x2bece2[_0xb4c5('0x34')]=_0x2bece2[_0xb4c5('0x34')][_0xb4c5('0x37')]?_0x2bece2['attributes']:_0x5f057d['model'];if(!_0xe888ec[_0xb4c5('0x32')][_0xb4c5('0x54')](_0xb4c5('0x38'))){_0x2bece2[_0xb4c5('0x22')]=qs[_0xb4c5('0x22')](_0xe888ec['query']['limit']);_0x2bece2['offset']=qs[_0xb4c5('0x21')](_0xe888ec[_0xb4c5('0x32')][_0xb4c5('0x21')]);}_0x2bece2['order']=qs['sort'](_0xe888ec['query'][_0xb4c5('0x3a')]);_0x2bece2[_0xb4c5('0x3b')]=qs[_0xb4c5('0x3c')](_['pick'](_0xe888ec[_0xb4c5('0x32')],_0x5f057d[_0xb4c5('0x3c')]));_0x2bece2[_0xb4c5('0x3b')][_0xb4c5('0x55')]=_0x57b763['id'];if(_0xe888ec[_0xb4c5('0x32')][_0xb4c5('0x3f')]){_0x2bece2[_0xb4c5('0x3b')]=_[_0xb4c5('0x40')](_0x2bece2[_0xb4c5('0x3b')],{'$or':_[_0xb4c5('0x56')](_0x2bece2['attributes'],function(_0xb4f9c0){var _0x42c70f={};_0x42c70f[_0xb4f9c0]={'$like':'%'+_0xe888ec['query']['filter']+'%'};return _0x42c70f;})});}_0x2bece2=_[_0xb4c5('0x40')]({},_0x2bece2,_0xe888ec[_0xb4c5('0x41')]);return db[_0xb4c5('0x57')]['count']({'where':_0x2bece2[_0xb4c5('0x3b')]})[_0xb4c5('0x28')](function(_0x5af6c6){_0x4f7952[_0xb4c5('0x42')]=_0x5af6c6;if(_0xe888ec[_0xb4c5('0x32')][_0xb4c5('0x43')]){_0x2bece2[_0xb4c5('0x47')]=[{'all':!![]}];}return db[_0xb4c5('0x57')]['findAll'](_0x2bece2);})[_0xb4c5('0x28')](function(_0x1ff0e5){_0x4f7952['rows']=_0x1ff0e5;return _0x4f7952;});}})[_0xb4c5('0x28')](respondWithFilteredResult(_0x2f49dc,_0x2bece2))[_0xb4c5('0x45')](handleError(_0x2f49dc,null));};exports[_0xb4c5('0x58')]=function(_0x1ee286,_0x18e16b,_0x55134d){var _0x4df627;return db[_0xb4c5('0x2f')][_0xb4c5('0x48')]({'where':{'id':_0x1ee286[_0xb4c5('0x46')]['id']}})[_0xb4c5('0x28')](handleEntityNotFound(_0x18e16b,null))[_0xb4c5('0x28')](function(_0x1e9f9d){if(_0x1e9f9d){return _0x1e9f9d[_0xb4c5('0x58')](_0x1ee286[_0xb4c5('0x32')]['ids']);}})['then'](respondWithStatusCode(_0x18e16b,null))['catch'](handleError(_0x18e16b,null));};exports['addContacts']=function(_0x74cb1b,_0x279302,_0x36bcc8){return db[_0xb4c5('0x2f')][_0xb4c5('0x48')]({'where':{'id':_0x74cb1b[_0xb4c5('0x46')]['id']}})['then'](handleEntityNotFound(_0x279302,null))[_0xb4c5('0x28')](function(_0x4c9810){if(_0x4c9810){var _0x4812fd=[];var _0x39e395={'success':[],'errors':[]};return db['CmContact'][_0xb4c5('0x51')]()['then'](function(_0x187e67){if(_0x74cb1b['body'][_0xb4c5('0x59')]&&_[_0xb4c5('0x5a')](_0x74cb1b[_0xb4c5('0x50')][_0xb4c5('0x59')])){if(_0x74cb1b['body'][_0xb4c5('0x59')][_0xb4c5('0x37')]){_0x74cb1b[_0xb4c5('0x50')][_0xb4c5('0x59')]=_0x74cb1b[_0xb4c5('0x50')][_0xb4c5('0x59')][_0xb4c5('0x5b')](';')+';';}else{_0x74cb1b['body']['tags']=null;}}else{_0x74cb1b[_0xb4c5('0x50')][_0xb4c5('0x59')]=null;}if(_0x74cb1b[_0xb4c5('0x50')]&&_[_0xb4c5('0x5a')](_0x74cb1b[_0xb4c5('0x50')])){for(var _0xe38306=0x0;_0xe38306<_0x74cb1b['body'][_0xb4c5('0x37')];_0xe38306+=0x1){_0x74cb1b[_0xb4c5('0x50')][_0xe38306][_0xb4c5('0x55')]=_0x74cb1b['params']['id'];_0x4812fd[_0xb4c5('0x5c')](_0x74cb1b[_0xb4c5('0x50')][_0xe38306]);}return BPromise[_0xb4c5('0x5d')](_0x4812fd,function(_0x5e21de){return db['CmContact']['create'](_['omit'](_0x5e21de,[_0xb4c5('0x5e'),'id'])||{},{'fields':_['keys'](_0x187e67),'raw':!![]})[_0xb4c5('0x28')](function(_0x3f68c6){_0x39e395[_0xb4c5('0x5f')][_0xb4c5('0x5c')](_0x3f68c6['dataValues']);})[_0xb4c5('0x45')](function(_0x534b3b){_0x39e395[_0xb4c5('0x60')][_0xb4c5('0x5c')]({'data':_0x5e21de,'error':_0x534b3b[_0xb4c5('0x61')]});});})[_0xb4c5('0x28')](function(_0x1a7285){return _0x39e395;})[_0xb4c5('0x45')](function(_0x18828d){return _0x18828d;});}else{_0x279302[_0xb4c5('0x1f')](0x190)[_0xb4c5('0x20')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xb4c5('0x28')](respondWithResult(_0x279302,null))[_0xb4c5('0x45')](handleError(_0x279302,null));};exports[_0xb4c5('0x62')]=function(_0x921a23,_0xf7b689,_0x4431c9){var _0x58393e;return db[_0xb4c5('0x2f')][_0xb4c5('0x48')]({'where':{'id':_0x921a23['params']['id']},'include':[{'model':db[_0xb4c5('0x63')],'as':_0xb4c5('0x64')}]})[_0xb4c5('0x28')](handleEntityNotFound(_0xf7b689,null))[_0xb4c5('0x28')](function(_0x3b390d){if(_0x3b390d){_0x58393e=_0x3b390d;return db[_0xb4c5('0x65')][_0xb4c5('0x30')];}})['then'](function(_0x3c84a2){if(_0x3c84a2){var _0xaee5ef={};var _0x57e54f={};_0x57e54f[_0xb4c5('0x35')]=_[_0xb4c5('0x66')](_[_0xb4c5('0x31')](_0x3c84a2),_[_0xb4c5('0x56')](_0x58393e[_0xb4c5('0x64')],function(_0x4dbf64){return util[_0xb4c5('0x67')](_0xb4c5('0x68'),_0x4dbf64['id']);}));_0x57e54f[_0xb4c5('0x32')]=_[_0xb4c5('0x31')](_0x921a23[_0xb4c5('0x32')]);_0x57e54f[_0xb4c5('0x3c')]=_['intersection'](_0x57e54f[_0xb4c5('0x35')],_0x57e54f[_0xb4c5('0x32')]);_0xaee5ef[_0xb4c5('0x34')]=_['intersection'](_0x57e54f['model'],qs[_0xb4c5('0x36')](_0x921a23[_0xb4c5('0x32')]['fields']));_0xaee5ef['attributes']=_0xaee5ef[_0xb4c5('0x34')][_0xb4c5('0x37')]?_0xaee5ef[_0xb4c5('0x34')]:_0x57e54f[_0xb4c5('0x35')];if(!_0x921a23[_0xb4c5('0x32')][_0xb4c5('0x54')]('nolimit')){_0xaee5ef[_0xb4c5('0x22')]=qs[_0xb4c5('0x22')](_0x921a23[_0xb4c5('0x32')]['limit']);_0xaee5ef[_0xb4c5('0x21')]=qs['offset'](_0x921a23['query'][_0xb4c5('0x21')]);}_0xaee5ef[_0xb4c5('0x39')]=qs[_0xb4c5('0x3a')](_0x921a23[_0xb4c5('0x32')]['sort']);_0xaee5ef[_0xb4c5('0x3b')]=qs[_0xb4c5('0x3c')](_[_0xb4c5('0x3d')](_0x921a23[_0xb4c5('0x32')],_0x57e54f[_0xb4c5('0x3c')]));_0xaee5ef[_0xb4c5('0x69')]=!![];if(_0x921a23[_0xb4c5('0x32')][_0xb4c5('0x3f')]){_0xaee5ef[_0xb4c5('0x3b')]=_[_0xb4c5('0x40')](_0xaee5ef[_0xb4c5('0x3b')],{'$or':_[_0xb4c5('0x56')](_0xaee5ef[_0xb4c5('0x34')],function(_0xbe017){var _0x5479d6={};_0x5479d6[_0xbe017]={'$like':'%'+_0x921a23[_0xb4c5('0x32')][_0xb4c5('0x3f')]+'%'};return _0x5479d6;})});}_0xaee5ef=_[_0xb4c5('0x40')]({},_0xaee5ef,_0x921a23[_0xb4c5('0x41')]);return _0x58393e[_0xb4c5('0x62')](_0xaee5ef);}})[_0xb4c5('0x28')](respondWithResult(_0xf7b689,null))[_0xb4c5('0x45')](handleError(_0xf7b689,null));};exports['getContactsCsv']=function(_0x2eba69,_0x1ef5fd,_0x18aaaf){var _0x413aad;return db[_0xb4c5('0x2f')][_0xb4c5('0x48')]({'where':{'id':_0x2eba69[_0xb4c5('0x46')]['id']},'include':[{'model':db[_0xb4c5('0x63')],'as':_0xb4c5('0x64')}]})['then'](handleEntityNotFound(_0x1ef5fd,null))[_0xb4c5('0x28')](function(_0x3b62f9){if(_0x3b62f9){_0x413aad=_0x3b62f9;return db[_0xb4c5('0x65')]['rawAttributes'];}})['then'](function(_0x29494d){if(_0x29494d){var _0x54a77e={};var _0x405d3f={};_0x405d3f[_0xb4c5('0x35')]=_['concat'](_[_0xb4c5('0x31')](_0x29494d),_['map'](_0x413aad[_0xb4c5('0x64')],function(_0x4bedf1){return util[_0xb4c5('0x67')](_0xb4c5('0x68'),_0x4bedf1['id']);}));_0x405d3f[_0xb4c5('0x32')]=_['keys'](_0x2eba69['query']);_0x405d3f[_0xb4c5('0x3c')]=_[_0xb4c5('0x33')](_0x405d3f['model'],_0x405d3f[_0xb4c5('0x32')]);_0x54a77e['attributes']=_['intersection'](_0x405d3f[_0xb4c5('0x35')],qs[_0xb4c5('0x36')](_0x2eba69[_0xb4c5('0x32')][_0xb4c5('0x36')]));_0x54a77e[_0xb4c5('0x34')]=_0x54a77e[_0xb4c5('0x34')]['length']?_0x54a77e['attributes']:_0x405d3f['model'];if(!_0x2eba69[_0xb4c5('0x32')][_0xb4c5('0x54')](_0xb4c5('0x38'))){_0x54a77e[_0xb4c5('0x22')]=qs[_0xb4c5('0x22')](_0x2eba69[_0xb4c5('0x32')]['limit']);_0x54a77e[_0xb4c5('0x21')]=qs[_0xb4c5('0x21')](_0x2eba69[_0xb4c5('0x32')][_0xb4c5('0x21')]);}_0x54a77e[_0xb4c5('0x39')]=qs[_0xb4c5('0x3a')](_0x2eba69['query'][_0xb4c5('0x3a')]);_0x54a77e['where']=qs[_0xb4c5('0x3c')](_[_0xb4c5('0x3d')](_0x2eba69[_0xb4c5('0x32')],_0x405d3f[_0xb4c5('0x3c')]));_0x54a77e[_0xb4c5('0x69')]=!![];if(_0x2eba69[_0xb4c5('0x32')][_0xb4c5('0x3f')]){_0x54a77e[_0xb4c5('0x3b')]=_['merge'](_0x54a77e[_0xb4c5('0x3b')],{'$or':_['map'](_0x54a77e[_0xb4c5('0x34')],function(_0x3df960){var _0x39acd6={};_0x39acd6[_0x3df960]={'$like':'%'+_0x2eba69[_0xb4c5('0x32')][_0xb4c5('0x3f')]+'%'};return _0x39acd6;})});}_0x54a77e=_[_0xb4c5('0x40')]({},_0x54a77e,_0x2eba69[_0xb4c5('0x41')]);return _0x413aad['getContacts'](_0x54a77e);}})[_0xb4c5('0x28')](function(_0x3bc3ff){if(!_[_0xb4c5('0x6a')](_0x3bc3ff)){var _0x557e3b=toCsv(_0x3bc3ff);var _0x25cfa7=Date['now']();fs[_0xb4c5('0x6b')](util[_0xb4c5('0x67')]('/tmp/list_%d_%s.csv',_0x413aad['id'],_0x25cfa7),_0x557e3b);_0x1ef5fd[_0xb4c5('0x6c')](_0xb4c5('0x6d'),'attachment;\x20filename='+util[_0xb4c5('0x67')](_0xb4c5('0x6e'),_0x413aad['id'],_0x25cfa7));_0x1ef5fd[_0xb4c5('0x6c')](_0xb4c5('0x6f'),_0xb4c5('0x70'));return _0x1ef5fd[_0xb4c5('0x71')](util[_0xb4c5('0x67')](_0xb4c5('0x72'),_0x413aad['id'],_0x25cfa7));}else{return _0x1ef5fd[_0xb4c5('0x2c')](0xcc);}})['catch'](handleError(_0x1ef5fd,null));};exports[_0xb4c5('0x73')]=function(_0x9b3779,_0x239b78,_0x28a557){var _0x366606;delete _0x9b3779['body']['id'];return db[_0xb4c5('0x2f')]['findOne']({'where':{'id':_0x9b3779['params']['id']}})[_0xb4c5('0x28')](handleEntityNotFound(_0x239b78,null))[_0xb4c5('0x28')](function(_0x20e4f4){if(_0x20e4f4){return db[_0xb4c5('0x74')]['transaction'](function(_0x13102c){return db[_0xb4c5('0x63')][_0xb4c5('0x49')](_0x9b3779[_0xb4c5('0x50')],{'transaction':_0x13102c})[_0xb4c5('0x28')](function(_0x40af02){_0x366606=_0x40af02;return _0x20e4f4['addCustomFields'](_0x40af02,{'transaction':_0x13102c});})[_0xb4c5('0x28')](function(){var _0x4aaa72={'type':db['Sequelize']['TEXT'],'transaction':_0x13102c};switch(_0x9b3779[_0xb4c5('0x50')]['type']){case _0xb4c5('0x75'):_0x4aaa72[_0xb4c5('0x76')]=db[_0xb4c5('0x77')][_0xb4c5('0x78')];break;case _0xb4c5('0x79'):_0x4aaa72[_0xb4c5('0x76')]=db[_0xb4c5('0x77')][_0xb4c5('0x7a')];break;case'switch':_0x4aaa72['type']=db['Sequelize'][_0xb4c5('0x7b')];_0x4aaa72['defaultValue']=![];break;default:}return db['sequelize'][_0xb4c5('0x7c')][_0xb4c5('0x7d')](_0xb4c5('0x7e'),util[_0xb4c5('0x67')](_0xb4c5('0x7f'),_0x366606['id']),_0x4aaa72);})[_0xb4c5('0x28')](function(){return _0x366606;});});}})[_0xb4c5('0x28')](respondWithResult(_0x239b78,null))[_0xb4c5('0x45')](handleError(_0x239b78,null));};exports['getCustomFields']=function(_0x501129,_0x4e1782,_0x20955d){var _0x3ae876={};var _0x3400a8={};var _0x26d64a;var _0x55c1b0;return db[_0xb4c5('0x2f')][_0xb4c5('0x53')]({'where':{'id':_0x501129[_0xb4c5('0x46')]['id']}})[_0xb4c5('0x28')](handleEntityNotFound(_0x4e1782,null))[_0xb4c5('0x28')](function(_0x3bab4d){if(_0x3bab4d){_0x26d64a=_0x3bab4d;_0x3400a8[_0xb4c5('0x35')]=_[_0xb4c5('0x31')](db['CmCustomField'][_0xb4c5('0x30')]);_0x3400a8[_0xb4c5('0x32')]=_[_0xb4c5('0x31')](_0x501129['query']);_0x3400a8[_0xb4c5('0x3c')]=_[_0xb4c5('0x33')](_0x3400a8[_0xb4c5('0x35')],_0x3400a8['query']);_0x3ae876[_0xb4c5('0x34')]=_['intersection'](_0x3400a8[_0xb4c5('0x35')],qs[_0xb4c5('0x36')](_0x501129[_0xb4c5('0x32')][_0xb4c5('0x36')]));_0x3ae876[_0xb4c5('0x34')]=_0x3ae876[_0xb4c5('0x34')][_0xb4c5('0x37')]?_0x3ae876[_0xb4c5('0x34')]:_0x3400a8[_0xb4c5('0x35')];_0x3ae876[_0xb4c5('0x39')]=qs[_0xb4c5('0x3a')](_0x501129[_0xb4c5('0x32')][_0xb4c5('0x3a')]);_0x3ae876[_0xb4c5('0x3b')]=qs[_0xb4c5('0x3c')](_['pick'](_0x501129['query'],_0x3400a8[_0xb4c5('0x3c')]));_0x3ae876[_0xb4c5('0x3b')]=_[_0xb4c5('0x40')](_0x3ae876[_0xb4c5('0x3b')],{'$or':[{'ListId':_0x3bab4d['id']},{'ListId':null}]});if(_0x501129['query'][_0xb4c5('0x3f')]){_0x3ae876[_0xb4c5('0x3b')]=_[_0xb4c5('0x40')](_0x3ae876[_0xb4c5('0x3b')],{'$or':_[_0xb4c5('0x56')](_0x3ae876[_0xb4c5('0x34')],function(_0x6050bc){var _0xfb6cd2={};_0xfb6cd2[_0x6050bc]={'$like':'%'+_0x501129['query'][_0xb4c5('0x3f')]+'%'};return _0xfb6cd2;})});}_0x3ae876=_['merge']({},_0x3ae876,_0x501129[_0xb4c5('0x41')]);return db[_0xb4c5('0x63')][_0xb4c5('0x80')](_0x3ae876);}})[_0xb4c5('0x28')](respondWithResult(_0x4e1782,null))[_0xb4c5('0x45')](handleError(_0x4e1782,null));};exports['addAgents']=function(_0x40ac80,_0x4ebdee,_0x3839b5){return db[_0xb4c5('0x2f')][_0xb4c5('0x48')]({'where':{'id':_0x40ac80[_0xb4c5('0x46')]['id']}})['then'](handleEntityNotFound(_0x4ebdee,null))[_0xb4c5('0x28')](function(_0x400648){if(_0x400648){return _0x400648[_0xb4c5('0x81')](_0x40ac80[_0xb4c5('0x50')][_0xb4c5('0x5e')],_[_0xb4c5('0x82')](_0x40ac80[_0xb4c5('0x50')],['ids','id'])||{})[_0xb4c5('0x83')](function(_0x488086){for(var _0x1c2af5=0x0;_0x1c2af5<_0x40ac80[_0xb4c5('0x50')]['ids'][_0xb4c5('0x37')];_0x1c2af5+=0x1){socket['emit']('userCmList:save',{'UserId':_0x40ac80[_0xb4c5('0x50')][_0xb4c5('0x5e')][_0x1c2af5],'CmListId':_0x40ac80[_0xb4c5('0x46')]['id']});}return _0x488086;});}})[_0xb4c5('0x28')](respondWithResult(_0x4ebdee,null))[_0xb4c5('0x45')](handleError(_0x4ebdee,null));};exports[_0xb4c5('0x84')]=function(_0x303840,_0x4749a0,_0x121c4c){var _0x39ffc2;return db[_0xb4c5('0x2f')]['find']({'where':{'id':_0x303840[_0xb4c5('0x46')]['id']}})[_0xb4c5('0x28')](handleEntityNotFound(_0x4749a0,null))[_0xb4c5('0x28')](function(_0x448619){if(_0x448619){return _0x448619[_0xb4c5('0x84')](_0x303840[_0xb4c5('0x32')][_0xb4c5('0x5e')])['then'](function(_0x220773){if(_['isArray'](_0x303840[_0xb4c5('0x32')][_0xb4c5('0x5e')])){for(var _0xf0d977=0x0;_0xf0d977<_0x303840[_0xb4c5('0x32')]['ids'][_0xb4c5('0x37')];_0xf0d977+=0x1){socket[_0xb4c5('0x85')](_0xb4c5('0x86'),{'UserId':_0x303840[_0xb4c5('0x32')]['ids'][_0xf0d977],'CmListId':_0x303840[_0xb4c5('0x46')]['id']});}}else{socket[_0xb4c5('0x85')](_0xb4c5('0x86'),{'UserId':_0x303840[_0xb4c5('0x32')][_0xb4c5('0x5e')],'CmListId':_0x303840[_0xb4c5('0x46')]['id']});}});}})[_0xb4c5('0x28')](respondWithStatusCode(_0x4749a0,null))['catch'](handleError(_0x4749a0,null));};exports['getAgents']=function(_0x29ab0d,_0x3f21d3,_0x4bee33){var _0xdfe9d8={};var _0xbd1080={};var _0x522bb3;var _0x4e0561;return db[_0xb4c5('0x2f')][_0xb4c5('0x53')]({'where':{'id':_0x29ab0d[_0xb4c5('0x46')]['id']}})[_0xb4c5('0x28')](handleEntityNotFound(_0x3f21d3,null))[_0xb4c5('0x28')](function(_0xdfc298){if(_0xdfc298){_0x522bb3=_0xdfc298;_0xbd1080[_0xb4c5('0x35')]=_['keys'](db[_0xb4c5('0x87')][_0xb4c5('0x30')]);_0xbd1080['query']=_['keys'](_0x29ab0d['query']);_0xbd1080[_0xb4c5('0x3c')]=_[_0xb4c5('0x33')](_0xbd1080[_0xb4c5('0x35')],_0xbd1080[_0xb4c5('0x32')]);_0xdfe9d8['attributes']=_[_0xb4c5('0x33')](_0xbd1080[_0xb4c5('0x35')],qs[_0xb4c5('0x36')](_0x29ab0d['query']['fields']));_0xdfe9d8[_0xb4c5('0x34')]=_0xdfe9d8[_0xb4c5('0x34')]['length']?_0xdfe9d8['attributes']:_0xbd1080['model'];_0xdfe9d8[_0xb4c5('0x39')]=qs['sort'](_0x29ab0d[_0xb4c5('0x32')][_0xb4c5('0x3a')]);_0xdfe9d8[_0xb4c5('0x3b')]=qs[_0xb4c5('0x3c')](_['pick'](_0x29ab0d[_0xb4c5('0x32')],_0xbd1080['filters']));if(_0x29ab0d[_0xb4c5('0x32')]['filter']){_0xdfe9d8[_0xb4c5('0x3b')]=_[_0xb4c5('0x40')](_0xdfe9d8[_0xb4c5('0x3b')],{'$or':_['map'](_0xdfe9d8[_0xb4c5('0x34')],function(_0x2296c8){var _0xa19634={};_0xa19634[_0x2296c8]={'$like':'%'+_0x29ab0d[_0xb4c5('0x32')]['filter']+'%'};return _0xa19634;})});}_0xdfe9d8=_[_0xb4c5('0x40')]({},_0xdfe9d8,_0x29ab0d[_0xb4c5('0x41')]);return _0x522bb3[_0xb4c5('0x88')](_0xdfe9d8);}})[_0xb4c5('0x28')](function(_0x41b55){if(_0x41b55){_0x4e0561=_0x41b55[_0xb4c5('0x37')];if(!_0x29ab0d[_0xb4c5('0x32')][_0xb4c5('0x54')](_0xb4c5('0x38'))){_0xdfe9d8['limit']=qs[_0xb4c5('0x22')](_0x29ab0d[_0xb4c5('0x32')][_0xb4c5('0x22')]);_0xdfe9d8[_0xb4c5('0x21')]=qs[_0xb4c5('0x21')](_0x29ab0d['query'][_0xb4c5('0x21')]);}return _0x522bb3[_0xb4c5('0x88')](_0xdfe9d8);}})[_0xb4c5('0x28')](function(_0x469c9a){if(_0x469c9a){return _0x469c9a?{'count':_0x4e0561,'rows':_0x469c9a}:null;}})[_0xb4c5('0x28')](respondWithResult(_0x3f21d3,null))[_0xb4c5('0x45')](handleError(_0x3f21d3,null));};
\ No newline at end of file
index 0db6d99..1965efb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe397=['remove','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe397,0x162));var _0x7e39=function(_0x81dae,_0x4437c9){_0x81dae=_0x81dae-0x0;var _0x2cab87=_0xe397[_0x81dae];return _0x2cab87;};'use strict';var EventEmitter=require(_0x7e39('0x0'));var CmList=require(_0x7e39('0x1'))['db'][_0x7e39('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7e39('0x3')](0x0);var events={'afterCreate':_0x7e39('0x4'),'afterUpdate':_0x7e39('0x5'),'afterDestroy':_0x7e39('0x6')};function emitEvent(_0x28e554){return function(_0x575889,_0x887fcf,_0x30c22a){CmListEvents['emit'](_0x28e554+':'+_0x575889['id'],_0x575889);CmListEvents[_0x7e39('0x7')](_0x28e554,_0x575889);_0x30c22a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x7e39('0x8')](e,emitEvent(event));}}module[_0x7e39('0x9')]=CmListEvents;
\ No newline at end of file
+var _0x440f=['../../mysqldb','save','update','remove','emit','events'];(function(_0x512490,_0x474d3d){var _0x4cf8e4=function(_0x2880b4){while(--_0x2880b4){_0x512490['push'](_0x512490['shift']());}};_0x4cf8e4(++_0x474d3d);}(_0x440f,0x15b));var _0xf440=function(_0x14d7f1,_0xedb869){_0x14d7f1=_0x14d7f1-0x0;var _0x490351=_0x440f[_0x14d7f1];return _0x490351;};'use strict';var EventEmitter=require(_0xf440('0x0'));var CmList=require(_0xf440('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf440('0x2'),'afterUpdate':_0xf440('0x3'),'afterDestroy':_0xf440('0x4')};function emitEvent(_0x2eb5ce){return function(_0x113b92,_0x33a990,_0x12a55b){CmListEvents['emit'](_0x2eb5ce+':'+_0x113b92['id'],_0x113b92);CmListEvents[_0xf440('0x5')](_0x2eb5ce,_0x113b92);_0x12a55b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module['exports']=CmListEvents;
\ No newline at end of file
index b88bcab..0feb7e4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd315=['CmList','util','../../config/logger','api','moment','bluebird','./cmList.attributes','exports','define'];(function(_0x3093ee,_0x2e3d20){var _0x48ac52=function(_0xe0cf38){while(--_0xe0cf38){_0x3093ee['push'](_0x3093ee['shift']());}};_0x48ac52(++_0x2e3d20);}(_0xd315,0xc7));var _0x5d31=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd315[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x5d31('0x0'));var logger=require(_0x5d31('0x1'))(_0x5d31('0x2'));var moment=require(_0x5d31('0x3'));var BPromise=require(_0x5d31('0x4'));var rp=require('request-promise');var attributes=require(_0x5d31('0x5'));module[_0x5d31('0x6')]=function(_0x178f8b,_0x33b01e){return _0x178f8b[_0x5d31('0x7')](_0x5d31('0x8'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x9240=['request-promise','./cmList.attributes','exports','CmList','cm_lists','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x39d481,_0x468019){var _0x510b49=function(_0x3f57d9){while(--_0x3f57d9){_0x39d481['push'](_0x39d481['shift']());}};_0x510b49(++_0x468019);}(_0x9240,0x14f));var _0x0924=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x9240[_0x3305de];return _0x3b5a84;};'use strict';var _=require(_0x0924('0x0'));var util=require(_0x0924('0x1'));var logger=require(_0x0924('0x2'))(_0x0924('0x3'));var moment=require(_0x0924('0x4'));var BPromise=require(_0x0924('0x5'));var rp=require(_0x0924('0x6'));var attributes=require(_0x0924('0x7'));module[_0x0924('0x8')]=function(_0x7297f4,_0x2d828f){return _0x7297f4['define'](_0x0924('0x9'),attributes,{'tableName':_0x0924('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 9279a82..6dfeb7e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb123=['redis','localhost','./cmList.socket','register','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults'];(function(_0xd26e7f,_0x4136c){var _0x5c0ea2=function(_0x55af1d){while(--_0x55af1d){_0xd26e7f['push'](_0xd26e7f['shift']());}};_0x5c0ea2(++_0x4136c);}(_0xb123,0x90));var _0x3b12=function(_0x7a3247,_0x15cb12){_0x7a3247=_0x7a3247-0x0;var _0x1bfde5=_0xb123[_0x7a3247];return _0x1bfde5;};'use strict';var _=require(_0x3b12('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3b12('0x1'));var rs=require(_0x3b12('0x2'));var fs=require('fs');var Redis=require(_0x3b12('0x3'));var db=require(_0x3b12('0x4'))['db'];var utils=require(_0x3b12('0x5'));var logger=require(_0x3b12('0x6'))('rpc');var config=require(_0x3b12('0x7'));var jayson=require(_0x3b12('0x8'));var client=jayson[_0x3b12('0x9')][_0x3b12('0xa')]({'port':0x232a});config['redis']=_[_0x3b12('0xb')](config[_0x3b12('0xc')],{'host':_0x3b12('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3b12('0xc')]));require(_0x3b12('0xe'))[_0x3b12('0xf')](socket);function respondWithRpcPromise(_0x2c515f,_0x3ed48d,_0x275ef5){return new BPromise(function(_0x3c7c2a,_0x19ca15){return client['request'](_0x2c515f,_0x275ef5)[_0x3b12('0x10')](function(_0x2896ad){logger['info'](_0x3b12('0x11'),_0x3ed48d,_0x3b12('0x12'));logger[_0x3b12('0x13')](_0x3b12('0x14'),_0x3ed48d,_0x3b12('0x12'),JSON[_0x3b12('0x15')](_0x2896ad));if(_0x2896ad['error']){if(_0x2896ad[_0x3b12('0x16')]['code']===0x1f4){logger[_0x3b12('0x16')](_0x3b12('0x11'),_0x3ed48d,_0x2896ad[_0x3b12('0x16')][_0x3b12('0x17')]);return _0x19ca15(_0x2896ad[_0x3b12('0x16')]['message']);}logger[_0x3b12('0x16')](_0x3b12('0x11'),_0x3ed48d,_0x2896ad['error']['message']);return _0x3c7c2a(_0x2896ad[_0x3b12('0x16')][_0x3b12('0x17')]);}else{logger[_0x3b12('0x18')](_0x3b12('0x11'),_0x3ed48d,_0x3b12('0x12'));_0x3c7c2a(_0x2896ad[_0x3b12('0x19')][_0x3b12('0x17')]);}})['catch'](function(_0x7ef2c7){logger['error'](_0x3b12('0x11'),_0x3ed48d,_0x7ef2c7);_0x19ca15(_0x7ef2c7);});});}
\ No newline at end of file
+var _0xf0b3=['catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','request','then','info','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmList,\x20%s,\x20%s'];(function(_0x53055c,_0x4eb110){var _0x48f582=function(_0x22f1a2){while(--_0x22f1a2){_0x53055c['push'](_0x53055c['shift']());}};_0x48f582(++_0x4eb110);}(_0xf0b3,0x7e));var _0x3f0b=function(_0x11b19b,_0x213234){_0x11b19b=_0x11b19b-0x0;var _0x1daac1=_0xf0b3[_0x11b19b];return _0x1daac1;};'use strict';var _=require('lodash');var util=require(_0x3f0b('0x0'));var moment=require('moment');var BPromise=require(_0x3f0b('0x1'));var rs=require(_0x3f0b('0x2'));var fs=require('fs');var Redis=require(_0x3f0b('0x3'));var db=require(_0x3f0b('0x4'))['db'];var utils=require(_0x3f0b('0x5'));var logger=require(_0x3f0b('0x6'))('rpc');var config=require(_0x3f0b('0x7'));var jayson=require(_0x3f0b('0x8'));var client=jayson[_0x3f0b('0x9')][_0x3f0b('0xa')]({'port':0x232a});config['redis']=_[_0x3f0b('0xb')](config[_0x3f0b('0xc')],{'host':_0x3f0b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3f0b('0xc')]));require('./cmList.socket')['register'](socket);function respondWithRpcPromise(_0x175831,_0x5a3390,_0x23957e){return new BPromise(function(_0x3d8139,_0x392680){return client[_0x3f0b('0xe')](_0x175831,_0x23957e)[_0x3f0b('0xf')](function(_0x545ae6){logger[_0x3f0b('0x10')]('CmList,\x20%s,\x20%s',_0x5a3390,_0x3f0b('0x11'));logger['debug'](_0x3f0b('0x12'),_0x5a3390,_0x3f0b('0x11'),JSON[_0x3f0b('0x13')](_0x545ae6));if(_0x545ae6['error']){if(_0x545ae6[_0x3f0b('0x14')][_0x3f0b('0x15')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x5a3390,_0x545ae6[_0x3f0b('0x14')][_0x3f0b('0x16')]);return _0x392680(_0x545ae6[_0x3f0b('0x14')][_0x3f0b('0x16')]);}logger[_0x3f0b('0x14')](_0x3f0b('0x17'),_0x5a3390,_0x545ae6[_0x3f0b('0x14')][_0x3f0b('0x16')]);return _0x3d8139(_0x545ae6[_0x3f0b('0x14')][_0x3f0b('0x16')]);}else{logger[_0x3f0b('0x10')](_0x3f0b('0x17'),_0x5a3390,_0x3f0b('0x11'));_0x3d8139(_0x545ae6['result'][_0x3f0b('0x16')]);}})[_0x3f0b('0x18')](function(_0x55e998){logger['error'](_0x3f0b('0x17'),_0x5a3390,_0x55e998);_0x392680(_0x55e998);});});}
\ No newline at end of file
index 81c513c..3a2b0a9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x11ee=['./cmList.events','save','remove','update','emit','removeListener','register','length','cmList:'];(function(_0x3101a5,_0x4e6168){var _0x436775=function(_0x398078){while(--_0x398078){_0x3101a5['push'](_0x3101a5['shift']());}};_0x436775(++_0x4e6168);}(_0x11ee,0x1dd));var _0xe11e=function(_0xc4376d,_0x2e6841){_0xc4376d=_0xc4376d-0x0;var _0x291524=_0x11ee[_0xc4376d];return _0x291524;};'use strict';var CmListEvents=require(_0xe11e('0x0'));var events=[_0xe11e('0x1'),_0xe11e('0x2'),_0xe11e('0x3')];function createListener(_0x48f911,_0x291e5b){return function(_0x5fcbe7){_0x291e5b[_0xe11e('0x4')](_0x48f911,_0x5fcbe7);};}function removeListener(_0x520e55,_0x10de5e){return function(){CmListEvents[_0xe11e('0x5')](_0x520e55,_0x10de5e);};}exports[_0xe11e('0x6')]=function(_0x198209){for(var _0x5e8a86=0x0,_0x2f46fb=events[_0xe11e('0x7')];_0x5e8a86<_0x2f46fb;_0x5e8a86++){var _0xda3980=events[_0x5e8a86];var _0x586f84=createListener(_0xe11e('0x8')+_0xda3980,_0x198209);CmListEvents['on'](_0xda3980,_0x586f84);}};
\ No newline at end of file
+var _0x269e=['register','length','cmList:','./cmList.events','save','emit'];(function(_0x2e5de1,_0x16c353){var _0x1b9a29=function(_0x1836eb){while(--_0x1836eb){_0x2e5de1['push'](_0x2e5de1['shift']());}};_0x1b9a29(++_0x16c353);}(_0x269e,0x1c5));var _0xe269=function(_0x51e3c8,_0x256e6f){_0x51e3c8=_0x51e3c8-0x0;var _0x14195c=_0x269e[_0x51e3c8];return _0x14195c;};'use strict';var CmListEvents=require(_0xe269('0x0'));var events=[_0xe269('0x1'),'remove','update'];function createListener(_0x2c3e90,_0x3bd599){return function(_0x2118d3){_0x3bd599[_0xe269('0x2')](_0x2c3e90,_0x2118d3);};}function removeListener(_0x3c1216,_0x32a99e){return function(){CmListEvents['removeListener'](_0x3c1216,_0x32a99e);};}exports[_0xe269('0x3')]=function(_0x213326){for(var _0x489e0a=0x0,_0x2fbee8=events[_0xe269('0x4')];_0x489e0a<_0x2fbee8;_0x489e0a++){var _0x50e966=events[_0x489e0a];var _0x3cdec7=createListener(_0xe269('0x5')+_0x50e966,_0x213326);CmListEvents['on'](_0x50e966,_0x3cdec7);}};
\ No newline at end of file
index 6a5bd28..ba26b1a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8fa2=['get','isAuthenticated','describe','/:id','show','/:id/dispositions','/:id/contacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','addCustomField','update','destroy','delete','removeDispositions','removeAgents','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmList.controller','index'];(function(_0x4d0662,_0x145963){var _0x6eea6d=function(_0x2def06){while(--_0x2def06){_0x4d0662['push'](_0x4d0662['shift']());}};_0x6eea6d(++_0x145963);}(_0x8fa2,0x93));var _0x28fa=function(_0x5f152b,_0x1f9248){_0x5f152b=_0x5f152b-0x0;var _0x38440e=_0x8fa2[_0x5f152b];return _0x38440e;};'use strict';var multer=require(_0x28fa('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x28fa('0x1'));var express=require(_0x28fa('0x2'));var router=express[_0x28fa('0x3')]();var auth=require(_0x28fa('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x28fa('0x5'));var controller=require(_0x28fa('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x28fa('0x7')]);router[_0x28fa('0x8')]('/describe',auth[_0x28fa('0x9')](),controller[_0x28fa('0xa')]);router[_0x28fa('0x8')](_0x28fa('0xb'),auth[_0x28fa('0x9')](),controller[_0x28fa('0xc')]);router[_0x28fa('0x8')](_0x28fa('0xd'),auth[_0x28fa('0x9')](),controller['getDispositions']);router[_0x28fa('0x8')](_0x28fa('0xe'),auth['isAuthenticated'](),controller['getContacts']);router[_0x28fa('0x8')](_0x28fa('0xf'),auth['isAuthenticated'](),controller['getContactsCsv']);router[_0x28fa('0x8')](_0x28fa('0x10'),auth[_0x28fa('0x9')](),controller[_0x28fa('0x11')]);router[_0x28fa('0x8')](_0x28fa('0x12'),auth[_0x28fa('0x9')](),controller[_0x28fa('0x13')]);router[_0x28fa('0x14')]('/',auth[_0x28fa('0x9')](),controller[_0x28fa('0x15')]);router[_0x28fa('0x14')](_0x28fa('0xd'),auth[_0x28fa('0x9')](),controller[_0x28fa('0x16')]);router[_0x28fa('0x14')](_0x28fa('0xe'),auth[_0x28fa('0x9')](),controller[_0x28fa('0x17')]);router[_0x28fa('0x14')](_0x28fa('0x10'),auth[_0x28fa('0x9')](),controller[_0x28fa('0x18')]);router[_0x28fa('0x14')](_0x28fa('0x12'),auth[_0x28fa('0x9')](),controller['addAgents']);router['put'](_0x28fa('0xb'),auth[_0x28fa('0x9')](),controller[_0x28fa('0x19')]);router['delete'](_0x28fa('0xb'),auth[_0x28fa('0x9')](),controller[_0x28fa('0x1a')]);router[_0x28fa('0x1b')](_0x28fa('0xd'),auth['isAuthenticated'](),controller[_0x28fa('0x1c')]);router[_0x28fa('0x1b')](_0x28fa('0x12'),auth[_0x28fa('0x9')](),controller[_0x28fa('0x1d')]);module[_0x28fa('0x1e')]=router;
\ No newline at end of file
+var _0x50f3=['../../components/interaction/service','./cmList.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','post','create','addDisposition','addContacts','addCustomField','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','Router'];(function(_0x3fb3b6,_0x228dbd){var _0x175e7e=function(_0x5edb71){while(--_0x5edb71){_0x3fb3b6['push'](_0x3fb3b6['shift']());}};_0x175e7e(++_0x228dbd);}(_0x50f3,0x11b));var _0x350f=function(_0x121515,_0x50684b){_0x121515=_0x121515-0x0;var _0x519b86=_0x50f3[_0x121515];return _0x519b86;};'use strict';var multer=require(_0x350f('0x0'));var util=require(_0x350f('0x1'));var path=require(_0x350f('0x2'));var timeout=require(_0x350f('0x3'));var express=require('express');var router=express[_0x350f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x350f('0x5'));var config=require('../../config/environment');var controller=require(_0x350f('0x6'));router[_0x350f('0x7')]('/',auth[_0x350f('0x8')](),controller[_0x350f('0x9')]);router[_0x350f('0x7')](_0x350f('0xa'),auth[_0x350f('0x8')](),controller[_0x350f('0xb')]);router[_0x350f('0x7')](_0x350f('0xc'),auth[_0x350f('0x8')](),controller[_0x350f('0xd')]);router['get'](_0x350f('0xe'),auth['isAuthenticated'](),controller[_0x350f('0xf')]);router[_0x350f('0x7')](_0x350f('0x10'),auth[_0x350f('0x8')](),controller[_0x350f('0x11')]);router[_0x350f('0x7')](_0x350f('0x12'),auth[_0x350f('0x8')](),controller[_0x350f('0x13')]);router[_0x350f('0x7')](_0x350f('0x14'),auth['isAuthenticated'](),controller['getCustomFields']);router[_0x350f('0x7')](_0x350f('0x15'),auth['isAuthenticated'](),controller['getAgents']);router[_0x350f('0x16')]('/',auth['isAuthenticated'](),controller[_0x350f('0x17')]);router[_0x350f('0x16')](_0x350f('0xe'),auth[_0x350f('0x8')](),controller[_0x350f('0x18')]);router[_0x350f('0x16')](_0x350f('0x10'),auth['isAuthenticated'](),controller[_0x350f('0x19')]);router['post'](_0x350f('0x14'),auth['isAuthenticated'](),controller[_0x350f('0x1a')]);router[_0x350f('0x16')](_0x350f('0x15'),auth[_0x350f('0x8')](),controller['addAgents']);router['put'](_0x350f('0xc'),auth[_0x350f('0x8')](),controller[_0x350f('0x1b')]);router[_0x350f('0x1c')](_0x350f('0xc'),auth[_0x350f('0x8')](),controller[_0x350f('0x1d')]);router[_0x350f('0x1c')](_0x350f('0xe'),auth[_0x350f('0x8')](),controller['removeDispositions']);router['delete']('/:id/users',auth[_0x350f('0x8')](),controller[_0x350f('0x1e')]);module[_0x350f('0x1f')]=router;
\ No newline at end of file
index 95f8bec..2823636 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcfab=['sequelize','VIRTUAL','getDataValue','STRING'];(function(_0x527a6c,_0x15b18d){var _0x4c780d=function(_0xebc03){while(--_0xebc03){_0x527a6c['push'](_0x527a6c['shift']());}};_0x4c780d(++_0x15b18d);}(_0xcfab,0x1e0));var _0xbcfa=function(_0x303588,_0x5f271c){_0x303588=_0x303588-0x0;var _0x4d717e=_0xcfab[_0x303588];return _0x4d717e;};'use strict';var Sequelize=require(_0xbcfa('0x0'));module['exports']={'name':{'type':Sequelize[_0xbcfa('0x1')],'get':function(_0x5d3c5b){return this[_0xbcfa('0x2')]('field');}},'field':{'type':Sequelize[_0xbcfa('0x3')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}};
\ No newline at end of file
+var _0xb25f=['field','STRING','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x3c7573,_0x5e9842){var _0x46248e=function(_0x472d35){while(--_0x472d35){_0x3c7573['push'](_0x3c7573['shift']());}};_0x46248e(++_0x5e9842);}(_0xb25f,0xe0));var _0xfb25=function(_0x1df660,_0x3db73a){_0x1df660=_0x1df660-0x0;var _0xe449fe=_0xb25f[_0x1df660];return _0xe449fe;};'use strict';var Sequelize=require(_0xfb25('0x0'));module[_0xfb25('0x1')]={'name':{'type':Sequelize[_0xfb25('0x2')],'get':function(_0x1e8889){return this[_0xfb25('0x3')](_0xfb25('0x4'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xfb25('0x5')],'allowNull':![]}};
\ No newline at end of file
index f438169..0748c1d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x702d=['../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','status','end','offset','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','body','Condition','find','params','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse'];(function(_0x273dc5,_0x268a81){var _0x46dae7=function(_0x263d62){while(--_0x263d62){_0x273dc5['push'](_0x273dc5['shift']());}};_0x46dae7(++_0x268a81);}(_0x702d,0x147));var _0xd702=function(_0x3bc3c2,_0x3fee1d){_0x3bc3c2=_0x3bc3c2-0x0;var _0x3c27af=_0x702d[_0x3bc3c2];return _0x3c27af;};'use strict';var pdf=require(_0xd702('0x0'));var emlformat=require(_0xd702('0x1'));var rimraf=require(_0xd702('0x2'));var zipdir=require(_0xd702('0x3'));var jsonpatch=require(_0xd702('0x4'));var rp=require('request-promise');var moment=require(_0xd702('0x5'));var BPromise=require(_0xd702('0x6'));var Mustache=require(_0xd702('0x7'));var util=require(_0xd702('0x8'));var path=require('path');var sox=require(_0xd702('0x9'));var csv=require('to-csv');var ejs=require(_0xd702('0xa'));var fs=require('fs');var _=require(_0xd702('0xb'));var squel=require(_0xd702('0xc'));var crypto=require('crypto');var jsforce=require(_0xd702('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd702('0xe'));var querystring=require(_0xd702('0xf'));var Papa=require(_0xd702('0x10'));var authService=require(_0xd702('0x11'));var hardwareService=require(_0xd702('0x12'));var Redis=require(_0xd702('0x13'));var qs=require(_0xd702('0x14'));var logger=require(_0xd702('0x15'))(_0xd702('0x16'));var utils=require(_0xd702('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e9439,_0x42e1ad){_0x42e1ad=_0x42e1ad||0xcc;return function(_0x273577){if(_0x273577){return _0x3e9439['sendStatus'](_0x42e1ad);}return _0x3e9439[_0xd702('0x18')](_0x42e1ad)[_0xd702('0x19')]();};}function respondWithResult(_0x1ed8a3,_0x2735db){_0x2735db=_0x2735db||0xc8;return function(_0x3948f8){if(_0x3948f8){return _0x1ed8a3[_0xd702('0x18')](_0x2735db)['json'](_0x3948f8);}};}function respondWithFilteredResult(_0x2f26b9,_0x3ea0ab){return function(_0x5d7978){if(_0x5d7978){var _0x707b9=_0x5d7978['count'],_0x4922f8=_0x3ea0ab[_0xd702('0x1a')],_0x268c66=_0x3ea0ab[_0xd702('0x1a')]+_0x3ea0ab[_0xd702('0x1b')],_0x210c32;if(_0x268c66>=_0x707b9){_0x268c66=_0x707b9;_0x210c32=0xc8;}else{_0x210c32=0xce;}_0x2f26b9['status'](_0x210c32);return _0x2f26b9['set'](_0xd702('0x1c'),_0x4922f8+'-'+_0x268c66+'/'+_0x707b9)['json'](_0x5d7978);}return null;};}function patchUpdates(_0x3fbcec){return function(_0x2a871e){try{jsonpatch[_0xd702('0x1d')](_0x2a871e,_0x3fbcec,!![]);}catch(_0x265b1b){return BPromise[_0xd702('0x1e')](_0x265b1b);}return _0x2a871e[_0xd702('0x1f')]();};}function saveUpdates(_0x612da0,_0x5937f3){return function(_0x4be140){if(_0x4be140){return _0x4be140['update'](_0x612da0)[_0xd702('0x20')](function(_0x109284){return _0x109284;});}return null;};}function removeEntity(_0x5cbff4,_0x211200){return function(_0x5d91fd){if(_0x5d91fd){return _0x5d91fd[_0xd702('0x21')]()['then'](function(){_0x5cbff4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x21c00e,_0xeec2e4){return function(_0x459184){if(!_0x459184){_0x21c00e['sendStatus'](0x194);}return _0x459184;};}function handleError(_0x1f0c44,_0x17cd14){_0x17cd14=_0x17cd14||0x1f4;return function(_0x10599a){logger[_0xd702('0x22')](_0x10599a[_0xd702('0x23')]);if(_0x10599a[_0xd702('0x24')]){delete _0x10599a[_0xd702('0x24')];}_0x1f0c44[_0xd702('0x18')](_0x17cd14)[_0xd702('0x25')](_0x10599a);};}exports['update']=function(_0x116b2f,_0x322cb8){if(_0x116b2f[_0xd702('0x26')]['id']){delete _0x116b2f[_0xd702('0x26')]['id'];}return db[_0xd702('0x27')][_0xd702('0x28')]({'where':{'id':_0x116b2f[_0xd702('0x29')]['id']}})[_0xd702('0x20')](handleEntityNotFound(_0x322cb8,null))['then'](saveUpdates(_0x116b2f['body'],null))[_0xd702('0x20')](respondWithResult(_0x322cb8,null))[_0xd702('0x2a')](handleError(_0x322cb8,null));};exports['destroy']=function(_0x45cd22,_0xee8bf1){return db[_0xd702('0x27')][_0xd702('0x28')]({'where':{'id':_0x45cd22['params']['id']}})[_0xd702('0x20')](handleEntityNotFound(_0xee8bf1,null))[_0xd702('0x20')](removeEntity(_0xee8bf1,null))[_0xd702('0x2a')](handleError(_0xee8bf1,null));};
\ No newline at end of file
+var _0xb43b=['ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','json','count','limit','set','apply','save','then','sendStatus','stack','name','send','update','body','Condition','find','params','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service'];(function(_0x43bf13,_0x2267d6){var _0x251a26=function(_0x5f3e61){while(--_0x5f3e61){_0x43bf13['push'](_0x43bf13['shift']());}};_0x251a26(++_0x2267d6);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2c9dc0,_0x4113f1){_0x2c9dc0=_0x2c9dc0-0x0;var _0x398dc1=_0xb43b[_0x2c9dc0];return _0x398dc1;};'use strict';var pdf=require(_0xbb43('0x0'));var emlformat=require(_0xbb43('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbb43('0x2'));var jsonpatch=require(_0xbb43('0x3'));var rp=require(_0xbb43('0x4'));var moment=require('moment');var BPromise=require(_0xbb43('0x5'));var Mustache=require(_0xbb43('0x6'));var util=require(_0xbb43('0x7'));var path=require(_0xbb43('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbb43('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var authService=require(_0xbb43('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0xbb43('0x11'));var qs=require(_0xbb43('0x12'));var logger=require(_0xbb43('0x13'))(_0xbb43('0x14'));var utils=require(_0xbb43('0x15'));var config=require(_0xbb43('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36a473,_0x2a5a4d){_0x2a5a4d=_0x2a5a4d||0xcc;return function(_0x50e2c0){if(_0x50e2c0){return _0x36a473['sendStatus'](_0x2a5a4d);}return _0x36a473[_0xbb43('0x17')](_0x2a5a4d)['end']();};}function respondWithResult(_0x593d0b,_0x438591){_0x438591=_0x438591||0xc8;return function(_0x5a509f){if(_0x5a509f){return _0x593d0b[_0xbb43('0x17')](_0x438591)[_0xbb43('0x18')](_0x5a509f);}};}function respondWithFilteredResult(_0x55926f,_0x4a6e18){return function(_0x4d5bcf){if(_0x4d5bcf){var _0x338120=_0x4d5bcf[_0xbb43('0x19')],_0x2abce0=_0x4a6e18['offset'],_0x57bd1d=_0x4a6e18['offset']+_0x4a6e18[_0xbb43('0x1a')],_0x526330;if(_0x57bd1d>=_0x338120){_0x57bd1d=_0x338120;_0x526330=0xc8;}else{_0x526330=0xce;}_0x55926f[_0xbb43('0x17')](_0x526330);return _0x55926f[_0xbb43('0x1b')]('Content-Range',_0x2abce0+'-'+_0x57bd1d+'/'+_0x338120)[_0xbb43('0x18')](_0x4d5bcf);}return null;};}function patchUpdates(_0x4f28b8){return function(_0x3bb57d){try{jsonpatch[_0xbb43('0x1c')](_0x3bb57d,_0x4f28b8,!![]);}catch(_0x4dfc54){return BPromise['reject'](_0x4dfc54);}return _0x3bb57d[_0xbb43('0x1d')]();};}function saveUpdates(_0x1b6e69,_0xdb7f2e){return function(_0x2bf2d4){if(_0x2bf2d4){return _0x2bf2d4['update'](_0x1b6e69)[_0xbb43('0x1e')](function(_0x5f4416){return _0x5f4416;});}return null;};}function removeEntity(_0x3a257d,_0x4bfaca){return function(_0x2f5e31){if(_0x2f5e31){return _0x2f5e31['destroy']()[_0xbb43('0x1e')](function(){_0x3a257d[_0xbb43('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d0768,_0x4dfb7f){return function(_0xf24e60){if(!_0xf24e60){_0x1d0768[_0xbb43('0x1f')](0x194);}return _0xf24e60;};}function handleError(_0x16384e,_0x4d6d77){_0x4d6d77=_0x4d6d77||0x1f4;return function(_0x53f0d5){logger['error'](_0x53f0d5[_0xbb43('0x20')]);if(_0x53f0d5[_0xbb43('0x21')]){delete _0x53f0d5['name'];}_0x16384e[_0xbb43('0x17')](_0x4d6d77)[_0xbb43('0x22')](_0x53f0d5);};}exports[_0xbb43('0x23')]=function(_0x3874fb,_0x4ed43f){if(_0x3874fb['body']['id']){delete _0x3874fb[_0xbb43('0x24')]['id'];}return db[_0xbb43('0x25')][_0xbb43('0x26')]({'where':{'id':_0x3874fb[_0xbb43('0x27')]['id']}})[_0xbb43('0x1e')](handleEntityNotFound(_0x4ed43f,null))[_0xbb43('0x1e')](saveUpdates(_0x3874fb[_0xbb43('0x24')],null))[_0xbb43('0x1e')](respondWithResult(_0x4ed43f,null))['catch'](handleError(_0x4ed43f,null));};exports[_0xbb43('0x28')]=function(_0x56fe33,_0x31fbc8){return db[_0xbb43('0x25')][_0xbb43('0x26')]({'where':{'id':_0x56fe33[_0xbb43('0x27')]['id']}})['then'](handleEntityNotFound(_0x31fbc8,null))[_0xbb43('0x1e')](removeEntity(_0x31fbc8,null))['catch'](handleError(_0x31fbc8,null));};
\ No newline at end of file
index bc48d3d..120c0a1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa617=['define','Condition','tools_conditions','lodash','util','../../config/logger','bluebird','request-promise','exports'];(function(_0x2aac90,_0x5acbcf){var _0x2d87e8=function(_0x221fda){while(--_0x221fda){_0x2aac90['push'](_0x2aac90['shift']());}};_0x2d87e8(++_0x5acbcf);}(_0xa617,0x12c));var _0x7a61=function(_0x43b190,_0x4a25ae){_0x43b190=_0x43b190-0x0;var _0x2e60d4=_0xa617[_0x43b190];return _0x2e60d4;};'use strict';var _=require(_0x7a61('0x0'));var util=require(_0x7a61('0x1'));var logger=require(_0x7a61('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7a61('0x3'));var rp=require(_0x7a61('0x4'));var attributes=require('./condition.attributes');module[_0x7a61('0x5')]=function(_0x327d1f,_0x127472){return _0x327d1f[_0x7a61('0x6')](_0x7a61('0x7'),attributes,{'tableName':_0x7a61('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xb19f=['bluebird','request-promise','./condition.attributes','exports','Condition','tools_conditions','lodash','util','../../config/logger','api','moment'];(function(_0x2c6810,_0x23c079){var _0x213881=function(_0x528021){while(--_0x528021){_0x2c6810['push'](_0x2c6810['shift']());}};_0x213881(++_0x23c079);}(_0xb19f,0xab));var _0xfb19=function(_0xf72ecc,_0x5976f4){_0xf72ecc=_0xf72ecc-0x0;var _0x4e360a=_0xb19f[_0xf72ecc];return _0x4e360a;};'use strict';var _=require(_0xfb19('0x0'));var util=require(_0xfb19('0x1'));var logger=require(_0xfb19('0x2'))(_0xfb19('0x3'));var moment=require(_0xfb19('0x4'));var BPromise=require(_0xfb19('0x5'));var rp=require(_0xfb19('0x6'));var attributes=require(_0xfb19('0x7'));module[_0xfb19('0x8')]=function(_0x3c9afb,_0x2c22be){return _0x3c9afb['define'](_0xfb19('0x9'),attributes,{'tableName':_0xfb19('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index c7d9678..bbd1084 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc427=['code','message','lodash','util','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x48ae92,_0x26f56f){var _0x73e237=function(_0x1d1fe1){while(--_0x1d1fe1){_0x48ae92['push'](_0x48ae92['shift']());}};_0x73e237(++_0x26f56f);}(_0xc427,0xd3));var _0x7c42=function(_0x20e25a,_0x1de63d){_0x20e25a=_0x20e25a-0x0;var _0x74e40c=_0xc427[_0x20e25a];return _0x74e40c;};'use strict';var _=require(_0x7c42('0x0'));var util=require(_0x7c42('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7c42('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7c42('0x3'));var logger=require(_0x7c42('0x4'))('rpc');var config=require(_0x7c42('0x5'));var jayson=require(_0x7c42('0x6'));var client=jayson[_0x7c42('0x7')][_0x7c42('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ab0e9,_0x1471bd,_0x469dea){return new BPromise(function(_0x442eac,_0x75265a){return client[_0x7c42('0x9')](_0x5ab0e9,_0x469dea)[_0x7c42('0xa')](function(_0x57c5dd){logger[_0x7c42('0xb')](_0x7c42('0xc'),_0x1471bd,'request\x20sent');logger[_0x7c42('0xd')]('Condition,\x20%s,\x20%s,\x20%s',_0x1471bd,_0x7c42('0xe'),JSON[_0x7c42('0xf')](_0x57c5dd));if(_0x57c5dd[_0x7c42('0x10')]){if(_0x57c5dd[_0x7c42('0x10')][_0x7c42('0x11')]===0x1f4){logger[_0x7c42('0x10')](_0x7c42('0xc'),_0x1471bd,_0x57c5dd[_0x7c42('0x10')]['message']);return _0x75265a(_0x57c5dd[_0x7c42('0x10')]['message']);}logger['error'](_0x7c42('0xc'),_0x1471bd,_0x57c5dd['error'][_0x7c42('0x12')]);return _0x442eac(_0x57c5dd[_0x7c42('0x10')][_0x7c42('0x12')]);}else{logger[_0x7c42('0xb')](_0x7c42('0xc'),_0x1471bd,_0x7c42('0xe'));_0x442eac(_0x57c5dd['result'][_0x7c42('0x12')]);}})['catch'](function(_0x3af08d){logger[_0x7c42('0x10')](_0x7c42('0xc'),_0x1471bd,_0x3af08d);_0x75265a(_0x3af08d);});});}
\ No newline at end of file
+var _0x51f0=['error','code','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x437e14,_0x25ac9f){var _0x18322b=function(_0x390aee){while(--_0x390aee){_0x437e14['push'](_0x437e14['shift']());}};_0x18322b(++_0x25ac9f);}(_0x51f0,0x82));var _0x051f=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x51f0[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0x051f('0x0'));var moment=require(_0x051f('0x1'));var BPromise=require('bluebird');var rs=require(_0x051f('0x2'));var fs=require('fs');var Redis=require(_0x051f('0x3'));var db=require(_0x051f('0x4'))['db'];var utils=require(_0x051f('0x5'));var logger=require(_0x051f('0x6'))(_0x051f('0x7'));var config=require(_0x051f('0x8'));var jayson=require(_0x051f('0x9'));var client=jayson[_0x051f('0xa')][_0x051f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ea3bb,_0x11a3d4,_0xe3cb56){return new BPromise(function(_0x40e5d1,_0x59b491){return client[_0x051f('0xc')](_0x2ea3bb,_0xe3cb56)['then'](function(_0x396cbe){logger['info'](_0x051f('0xd'),_0x11a3d4,_0x051f('0xe'));logger['debug'](_0x051f('0xf'),_0x11a3d4,_0x051f('0xe'),JSON[_0x051f('0x10')](_0x396cbe));if(_0x396cbe[_0x051f('0x11')]){if(_0x396cbe['error'][_0x051f('0x12')]===0x1f4){logger['error'](_0x051f('0xd'),_0x11a3d4,_0x396cbe[_0x051f('0x11')][_0x051f('0x13')]);return _0x59b491(_0x396cbe['error']['message']);}logger[_0x051f('0x11')](_0x051f('0xd'),_0x11a3d4,_0x396cbe['error'][_0x051f('0x13')]);return _0x40e5d1(_0x396cbe[_0x051f('0x11')][_0x051f('0x13')]);}else{logger['info'](_0x051f('0xd'),_0x11a3d4,'request\x20sent');_0x40e5d1(_0x396cbe[_0x051f('0x14')][_0x051f('0x13')]);}})['catch'](function(_0xa37dae){logger[_0x051f('0x11')](_0x051f('0xd'),_0x11a3d4,_0xa37dae);_0x59b491(_0xa37dae);});});}
\ No newline at end of file
index 938bcb5..223bdbb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5dd4=['./condition.controller','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xa92559,_0x1d2e45){var _0x502df8=function(_0x3321db){while(--_0x3321db){_0xa92559['push'](_0xa92559['shift']());}};_0x502df8(++_0x1d2e45);}(_0x5dd4,0xbb));var _0x45dd=function(_0x227b64,_0x1c6f72){_0x227b64=_0x227b64-0x0;var _0xc84cb5=_0x5dd4[_0x227b64];return _0xc84cb5;};'use strict';var multer=require(_0x45dd('0x0'));var util=require(_0x45dd('0x1'));var path=require(_0x45dd('0x2'));var timeout=require(_0x45dd('0x3'));var express=require('express');var router=express[_0x45dd('0x4')]();var auth=require(_0x45dd('0x5'));var interaction=require(_0x45dd('0x6'));var config=require(_0x45dd('0x7'));var controller=require(_0x45dd('0x8'));router['put'](_0x45dd('0x9'),auth[_0x45dd('0xa')](),controller[_0x45dd('0xb')]);router[_0x45dd('0xc')](_0x45dd('0x9'),auth[_0x45dd('0xa')](),controller[_0x45dd('0xd')]);module[_0x45dd('0xe')]=router;
\ No newline at end of file
+var _0x737a=['util','path','express','Router','../../components/auth/service','../../config/environment','/:id','update','delete','destroy','multer'];(function(_0x5e9b01,_0x3b74ac){var _0x5c43d6=function(_0x26300c){while(--_0x26300c){_0x5e9b01['push'](_0x5e9b01['shift']());}};_0x5c43d6(++_0x3b74ac);}(_0x737a,0x196));var _0xa737=function(_0x2c316b,_0x45e18d){_0x2c316b=_0x2c316b-0x0;var _0x628b04=_0x737a[_0x2c316b];return _0x628b04;};'use strict';var multer=require(_0xa737('0x0'));var util=require(_0xa737('0x1'));var path=require(_0xa737('0x2'));var timeout=require('connect-timeout');var express=require(_0xa737('0x3'));var router=express[_0xa737('0x4')]();var auth=require(_0xa737('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa737('0x6'));var controller=require('./condition.controller');router['put'](_0xa737('0x7'),auth['isAuthenticated'](),controller[_0xa737('0x8')]);router[_0xa737('0x9')](_0xa737('0x7'),auth['isAuthenticated'](),controller[_0xa737('0xa')]);module['exports']=router;
\ No newline at end of file
index 3db3fbd..a2e94f6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9412=['name','sequelize','exports','STRING'];(function(_0x206b07,_0x30ee32){var _0x55de27=function(_0x82ff93){while(--_0x82ff93){_0x206b07['push'](_0x206b07['shift']());}};_0x55de27(++_0x30ee32);}(_0x9412,0x99));var _0x2941=function(_0x4f170f,_0x44a928){_0x4f170f=_0x4f170f-0x0;var _0x326563=_0x9412[_0x4f170f];return _0x326563;};'use strict';var Sequelize=require(_0x2941('0x0'));module[_0x2941('0x1')]={'name':{'type':Sequelize[_0x2941('0x2')],'allowNull':![],'unique':_0x2941('0x3')},'description':{'type':Sequelize[_0x2941('0x2')]}};
\ No newline at end of file
+var _0x8968=['name','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8968,0x15d));var _0x8896=function(_0x12130b,_0x1e5d98){_0x12130b=_0x12130b-0x0;var _0x398370=_0x8968[_0x12130b];return _0x398370;};'use strict';var Sequelize=require(_0x8896('0x0'));module['exports']={'name':{'type':Sequelize[_0x8896('0x1')],'allowNull':![],'unique':_0x8896('0x2')},'description':{'type':Sequelize[_0x8896('0x1')]}};
\ No newline at end of file
index 98df2e6..b9dd1a1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6c21=['rawAttributes','query','keys','filters','attributes','intersection','fields','length','model','nolimit','order','where','filter','merge','key','field','options','count','includeAll','include','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','CustomDashboards','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','body','createdAt','role','user','userProfileId','type','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','sort','pick','map','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','limit','set','json','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','Dashboard'];(function(_0x1bb9a5,_0x4984a5){var _0x2e9160=function(_0x247ae3){while(--_0x247ae3){_0x1bb9a5['push'](_0x1bb9a5['shift']());}};_0x2e9160(++_0x4984a5);}(_0x6c21,0x1b2));var _0x16c2=function(_0x43cd8c,_0x53b715){_0x43cd8c=_0x43cd8c-0x0;var _0x4f879e=_0x6c21[_0x43cd8c];return _0x4f879e;};'use strict';var pdf=require(_0x16c2('0x0'));var emlformat=require(_0x16c2('0x1'));var rimraf=require(_0x16c2('0x2'));var zipdir=require(_0x16c2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x16c2('0x4'));var moment=require(_0x16c2('0x5'));var BPromise=require(_0x16c2('0x6'));var Mustache=require(_0x16c2('0x7'));var util=require(_0x16c2('0x8'));var path=require('path');var sox=require(_0x16c2('0x9'));var csv=require(_0x16c2('0xa'));var ejs=require(_0x16c2('0xb'));var fs=require('fs');var _=require(_0x16c2('0xc'));var squel=require(_0x16c2('0xd'));var crypto=require(_0x16c2('0xe'));var jsforce=require(_0x16c2('0xf'));var deskjs=require(_0x16c2('0x10'));var toCsv=require(_0x16c2('0xa'));var querystring=require(_0x16c2('0x11'));var Papa=require(_0x16c2('0x12'));var authService=require(_0x16c2('0x13'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x16c2('0x14'));var qs=require(_0x16c2('0x15'));var logger=require('../../config/logger')(_0x16c2('0x16'));var utils=require(_0x16c2('0x17'));var config=require(_0x16c2('0x18'));var db=require('../../mysqldb')['db'];config[_0x16c2('0x19')]=_[_0x16c2('0x1a')](config['redis'],{'host':_0x16c2('0x1b'),'port':0x18eb});var socket=require(_0x16c2('0x1c'))(new Redis(config[_0x16c2('0x19')]));require('./dashboard.socket')[_0x16c2('0x1d')](socket);function respondWithStatusCode(_0xd1de9e,_0x394eac){_0x394eac=_0x394eac||0xcc;return function(_0x49ab49){if(_0x49ab49){return _0xd1de9e[_0x16c2('0x1e')](_0x394eac);}return _0xd1de9e[_0x16c2('0x1f')](_0x394eac)[_0x16c2('0x20')]();};}function respondWithResult(_0x4f5d6b,_0x5e21e4){_0x5e21e4=_0x5e21e4||0xc8;return function(_0x37e54f){if(_0x37e54f){return _0x4f5d6b[_0x16c2('0x1f')](_0x5e21e4)['json'](_0x37e54f);}};}function respondWithFilteredResult(_0x3a7fd1,_0x5808d3){return function(_0x387a17){if(_0x387a17){var _0x1a88e3=_0x387a17['count'],_0x1247ab=_0x5808d3[_0x16c2('0x21')],_0xa796cd=_0x5808d3[_0x16c2('0x21')]+_0x5808d3[_0x16c2('0x22')],_0x3cbfc9;if(_0xa796cd>=_0x1a88e3){_0xa796cd=_0x1a88e3;_0x3cbfc9=0xc8;}else{_0x3cbfc9=0xce;}_0x3a7fd1['status'](_0x3cbfc9);return _0x3a7fd1[_0x16c2('0x23')]('Content-Range',_0x1247ab+'-'+_0xa796cd+'/'+_0x1a88e3)[_0x16c2('0x24')](_0x387a17);}return null;};}function patchUpdates(_0x49b0c7){return function(_0x451360){try{jsonpatch['apply'](_0x451360,_0x49b0c7,!![]);}catch(_0x34180d){return BPromise[_0x16c2('0x25')](_0x34180d);}return _0x451360[_0x16c2('0x26')]();};}function saveUpdates(_0x1ad9b5,_0x5a28a5){return function(_0x1e193e){if(_0x1e193e){return _0x1e193e[_0x16c2('0x27')](_0x1ad9b5)[_0x16c2('0x28')](function(_0x3c3f4c){return _0x3c3f4c;});}return null;};}function removeEntity(_0x157e9f,_0x41b63d){return function(_0x74c44){if(_0x74c44){return _0x74c44[_0x16c2('0x29')]()['then'](function(){var _0x396ab8=_0x74c44[_0x16c2('0x2a')]({'plain':!![]});var _0x3badd9='CustomDashboards';return db[_0x16c2('0x2b')]['destroy']({'where':{'type':_0x3badd9,'resourceId':_0x396ab8['id']}})[_0x16c2('0x28')](function(){return _0x74c44;});})[_0x16c2('0x28')](function(){_0x157e9f['status'](0xcc)[_0x16c2('0x20')]();});}};}function handleEntityNotFound(_0x293e32,_0x30c978){return function(_0x114473){if(!_0x114473){_0x293e32[_0x16c2('0x1e')](0x194);}return _0x114473;};}function handleError(_0x42a430,_0x42a9ad){_0x42a9ad=_0x42a9ad||0x1f4;return function(_0x43a934){logger[_0x16c2('0x2c')](_0x43a934[_0x16c2('0x2d')]);if(_0x43a934[_0x16c2('0x2e')]){delete _0x43a934[_0x16c2('0x2e')];}_0x42a430[_0x16c2('0x1f')](_0x42a9ad)[_0x16c2('0x2f')](_0x43a934);};}exports[_0x16c2('0x30')]=function(_0x50c04e,_0x169493){var _0x319a91={},_0x994370={},_0x493339={'count':0x0,'rows':[]};var _0x45fe74=db[_0x16c2('0x31')][_0x16c2('0x32')];_0x994370['model']=_['keys'](_0x45fe74);_0x994370[_0x16c2('0x33')]=_[_0x16c2('0x34')](_0x50c04e[_0x16c2('0x33')]);_0x994370[_0x16c2('0x35')]=_['intersection'](_0x994370['model'],_0x994370['query']);_0x319a91[_0x16c2('0x36')]=_[_0x16c2('0x37')](_0x994370['model'],qs[_0x16c2('0x38')](_0x50c04e[_0x16c2('0x33')]['fields']));_0x319a91[_0x16c2('0x36')]=_0x319a91[_0x16c2('0x36')][_0x16c2('0x39')]?_0x319a91[_0x16c2('0x36')]:_0x994370[_0x16c2('0x3a')];if(!_0x50c04e['query']['hasOwnProperty'](_0x16c2('0x3b'))){_0x319a91[_0x16c2('0x22')]=qs[_0x16c2('0x22')](_0x50c04e[_0x16c2('0x33')][_0x16c2('0x22')]);_0x319a91[_0x16c2('0x21')]=qs[_0x16c2('0x21')](_0x50c04e[_0x16c2('0x33')]['offset']);}_0x319a91[_0x16c2('0x3c')]=qs['sort'](_0x50c04e[_0x16c2('0x33')]['sort']);_0x319a91[_0x16c2('0x3d')]=qs[_0x16c2('0x35')](_['pick'](_0x50c04e['query'],_0x994370['filters']));if(_0x50c04e['query'][_0x16c2('0x3e')]){_0x319a91['where']=_[_0x16c2('0x3f')](_0x319a91[_0x16c2('0x3d')],{'$or':_['map'](_0x45fe74,function(_0x179201){if(_0x179201['type'][_0x16c2('0x40')]!=='VIRTUAL'){var _0x4ac048={};_0x4ac048[_0x179201[_0x16c2('0x41')]]={'$like':'%'+_0x50c04e[_0x16c2('0x33')][_0x16c2('0x3e')]+'%'};return _0x4ac048;}})});}_0x319a91=_[_0x16c2('0x3f')]({},_0x319a91,_0x50c04e[_0x16c2('0x42')]);var _0x433a6b={'where':_0x319a91[_0x16c2('0x3d')]};return db[_0x16c2('0x31')][_0x16c2('0x43')](_0x433a6b)[_0x16c2('0x28')](function(_0x2e9dec){_0x493339[_0x16c2('0x43')]=_0x2e9dec;if(_0x50c04e[_0x16c2('0x33')][_0x16c2('0x44')]){_0x319a91[_0x16c2('0x45')]=[{'all':!![]}];}return db[_0x16c2('0x31')]['findAll'](_0x319a91);})['then'](function(_0x5177d8){_0x493339[_0x16c2('0x46')]=_0x5177d8;return _0x493339;})[_0x16c2('0x28')](respondWithFilteredResult(_0x169493,_0x319a91))[_0x16c2('0x47')](handleError(_0x169493,null));};exports[_0x16c2('0x48')]=function(_0x3911dc,_0x3ba3a4){var _0x5e327a={'raw':![],'where':{'id':_0x3911dc[_0x16c2('0x49')]['id']}},_0x5f2f5c={};_0x5f2f5c[_0x16c2('0x3a')]=_[_0x16c2('0x34')](db[_0x16c2('0x31')][_0x16c2('0x32')]);_0x5f2f5c['query']=_[_0x16c2('0x34')](_0x3911dc[_0x16c2('0x33')]);_0x5f2f5c['filters']=_[_0x16c2('0x37')](_0x5f2f5c[_0x16c2('0x3a')],_0x5f2f5c[_0x16c2('0x33')]);_0x5e327a[_0x16c2('0x36')]=_[_0x16c2('0x37')](_0x5f2f5c[_0x16c2('0x3a')],qs['fields'](_0x3911dc[_0x16c2('0x33')][_0x16c2('0x38')]));_0x5e327a[_0x16c2('0x36')]=_0x5e327a[_0x16c2('0x36')]['length']?_0x5e327a[_0x16c2('0x36')]:_0x5f2f5c[_0x16c2('0x3a')];if(_0x3911dc[_0x16c2('0x33')][_0x16c2('0x44')]){_0x5e327a[_0x16c2('0x45')]=[{'all':!![]}];}_0x5e327a=_[_0x16c2('0x3f')]({},_0x5e327a,_0x3911dc[_0x16c2('0x42')]);return db['Dashboard'][_0x16c2('0x4a')](_0x5e327a)['then'](handleEntityNotFound(_0x3ba3a4,null))[_0x16c2('0x28')](respondWithResult(_0x3ba3a4,null))[_0x16c2('0x47')](handleError(_0x3ba3a4,null));};exports[_0x16c2('0x4b')]=function(_0x5926bc,_0x1d10d9){return db[_0x16c2('0x31')]['create'](_0x5926bc['body'],{})['then'](function(_0x3e02e3){var _0x36b36f=_0x5926bc['user'][_0x16c2('0x2a')]({'plain':!![]});if(!_0x36b36f)throw new Error(_0x16c2('0x4c'));if(_0x36b36f['role']==='user'){var _0x24f207=_0x3e02e3[_0x16c2('0x2a')]({'plain':!![]});var _0x9f94a5=_0x16c2('0x4d');return db['UserProfileSection'][_0x16c2('0x4a')]({'where':{'name':_0x9f94a5,'userProfileId':_0x36b36f['userProfileId']},'raw':!![]})[_0x16c2('0x28')](function(_0x31e9ab){if(_0x31e9ab&&_0x31e9ab[_0x16c2('0x4e')]===0x0){return db[_0x16c2('0x2b')][_0x16c2('0x4b')]({'name':_0x24f207[_0x16c2('0x2e')],'resourceId':_0x24f207['id'],'type':_0x31e9ab[_0x16c2('0x2e')],'sectionId':_0x31e9ab['id']},{})[_0x16c2('0x28')](function(){return _0x3e02e3;});}else{return _0x3e02e3;}})[_0x16c2('0x47')](function(_0x2be596){logger[_0x16c2('0x2c')](_0x16c2('0x4f'),_0x2be596);throw _0x2be596;});}return _0x3e02e3;})[_0x16c2('0x28')](respondWithResult(_0x1d10d9,0xc9))[_0x16c2('0x47')](handleError(_0x1d10d9,null));};exports[_0x16c2('0x50')]=function(_0xb33fa1,_0x32b2e3){var _0x1ae452={'raw':![],'where':{'id':_0xb33fa1['params']['id']}},_0x4bc599={};_0x4bc599[_0x16c2('0x3a')]=_[_0x16c2('0x34')](db[_0x16c2('0x31')][_0x16c2('0x32')]);_0x1ae452[_0x16c2('0x36')]=_['intersection'](_0x4bc599[_0x16c2('0x3a')],qs[_0x16c2('0x38')](_0xb33fa1[_0x16c2('0x33')]['fields']));_0x1ae452[_0x16c2('0x36')]=_0x1ae452['attributes'][_0x16c2('0x39')]?_0x1ae452[_0x16c2('0x36')]:_0x4bc599[_0x16c2('0x3a')];if(_0xb33fa1['query'][_0x16c2('0x44')]){_0x1ae452[_0x16c2('0x45')]=[{'all':!![]}];}_0x1ae452=_[_0x16c2('0x3f')]({},_0x1ae452,_0xb33fa1['options']);return db['Dashboard'][_0x16c2('0x4a')](_0x1ae452)[_0x16c2('0x28')](handleEntityNotFound(_0x32b2e3,null))[_0x16c2('0x28')](function(_0x3cdfa6){if(_0x3cdfa6){var _0x29c7d8=_0x3cdfa6[_0x16c2('0x2a')]({'plain':!![]});_0x29c7d8=qs[_0x16c2('0x51')](_0x29c7d8,['id','createdAt',_0x16c2('0x52')]);_0xb33fa1[_0x16c2('0x53')]=_[_0x16c2('0x51')](_0xb33fa1[_0x16c2('0x53')],['id',_0x16c2('0x54'),_0x16c2('0x52')]);return db['Dashboard'][_0x16c2('0x4b')](_[_0x16c2('0x3f')](_0x29c7d8,_0xb33fa1[_0x16c2('0x53')]),{'include':_0xb33fa1['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x55979d){var _0x2728e0=_0xb33fa1['user']['get']({'plain':!![]});if(!_0x2728e0)throw new Error(_0x16c2('0x4c'));if(_0x2728e0[_0x16c2('0x55')]===_0x16c2('0x56')){var _0x548e17=_0x55979d[_0x16c2('0x2a')]({'plain':!![]});var _0x38ea1e='CustomDashboards';return db['UserProfileSection'][_0x16c2('0x4a')]({'where':{'name':_0x38ea1e,'userProfileId':_0x2728e0[_0x16c2('0x57')]},'raw':!![]})[_0x16c2('0x28')](function(_0x3f2050){if(_0x3f2050&&_0x3f2050['autoAssociation']===0x0){return db[_0x16c2('0x2b')][_0x16c2('0x4b')]({'name':_0x548e17[_0x16c2('0x2e')],'resourceId':_0x548e17['id'],'type':_0x3f2050[_0x16c2('0x2e')],'sectionId':_0x3f2050['id']},{})[_0x16c2('0x28')](function(){return _0x55979d;});}else{return _0x55979d;}})[_0x16c2('0x47')](function(_0x38d050){logger[_0x16c2('0x2c')](_0x16c2('0x4f'),_0x38d050);throw _0x38d050;});}return _0x55979d;});}})['then'](respondWithResult(_0x32b2e3,0xc9))[_0x16c2('0x47')](handleError(_0x32b2e3,null));};exports[_0x16c2('0x27')]=function(_0x475f3f,_0x3cbc88){if(_0x475f3f[_0x16c2('0x53')]['id']){delete _0x475f3f[_0x16c2('0x53')]['id'];}return db[_0x16c2('0x31')][_0x16c2('0x4a')]({'where':{'id':_0x475f3f['params']['id']}})[_0x16c2('0x28')](handleEntityNotFound(_0x3cbc88,null))[_0x16c2('0x28')](saveUpdates(_0x475f3f[_0x16c2('0x53')],null))[_0x16c2('0x28')](respondWithResult(_0x3cbc88,null))[_0x16c2('0x47')](handleError(_0x3cbc88,null));};exports[_0x16c2('0x29')]=function(_0xb4d2df,_0x220582){return db[_0x16c2('0x31')][_0x16c2('0x4a')]({'where':{'id':_0xb4d2df[_0x16c2('0x49')]['id']}})[_0x16c2('0x28')](handleEntityNotFound(_0x220582,null))[_0x16c2('0x28')](removeEntity(_0x220582,null))[_0x16c2('0x47')](handleError(_0x220582,null));};function widgetAttributes(_0x1e1df6){try{switch(_0x1e1df6[_0x16c2('0x58')]){case'iframe':return[{'name':_0x16c2('0x59'),'value':_0x1e1df6[_0x16c2('0x59')]||(_0x1e1df6[_0x16c2('0x5a')]&&_0x1e1df6[_0x16c2('0x5a')][0x0]?_0x1e1df6[_0x16c2('0x5a')][0x0]['value']:undefined)||_0x16c2('0x5b')}];case _0x16c2('0x5c'):return[{'name':_0x16c2('0x5d'),'value':_0x1e1df6[_0x16c2('0x5d')]||(_0x1e1df6[_0x16c2('0x5a')]&&_0x1e1df6['attrs'][0x0]?_0x1e1df6['attrs'][0x0][_0x16c2('0x5e')]:undefined)||''}];case _0x16c2('0x5f'):return[{'name':_0x16c2('0x60'),'value':_0x1e1df6[_0x16c2('0x60')]||(_0x1e1df6[_0x16c2('0x5a')]&&_0x1e1df6[_0x16c2('0x5a')][0x0]?_0x1e1df6[_0x16c2('0x5a')][0x0][_0x16c2('0x5e')]:undefined)||'HH:mm:ss'},{'name':_0x16c2('0x61'),'value':_0x1e1df6[_0x16c2('0x61')]||(_0x1e1df6[_0x16c2('0x5a')]&&_0x1e1df6['attrs'][0x1]?_0x1e1df6[_0x16c2('0x5a')][0x1][_0x16c2('0x5e')]:undefined)||'0.00'},{'name':_0x16c2('0x62'),'value':_0x1e1df6[_0x16c2('0x62')]||(_0x1e1df6['attrs']&&_0x1e1df6[_0x16c2('0x5a')][0x2]?_0x1e1df6['attrs'][0x2]['value']:undefined)||0xc}];case _0x16c2('0x63'):return[{'name':_0x16c2('0x64'),'value':_0x1e1df6['attrMetric']||(_0x1e1df6['attrs']&&_0x1e1df6[_0x16c2('0x5a')][0x0]?_0x1e1df6[_0x16c2('0x5a')][0x0]['value']:undefined)||_0x16c2('0x65')},{'name':_0x16c2('0x66'),'value':_0x1e1df6[_0x16c2('0x66')]||(_0x1e1df6[_0x16c2('0x5a')]&&_0x1e1df6[_0x16c2('0x5a')][0x1]?_0x1e1df6[_0x16c2('0x5a')][0x1]['value']:undefined)||[]},{'name':_0x16c2('0x62'),'value':_0x1e1df6[_0x16c2('0x62')]||(_0x1e1df6[_0x16c2('0x5a')]&&_0x1e1df6[_0x16c2('0x5a')][0x2]?_0x1e1df6[_0x16c2('0x5a')][0x2][_0x16c2('0x5e')]:undefined)||0x14}];case _0x16c2('0x67'):case _0x16c2('0x68'):return[{'name':_0x16c2('0x69'),'value':_0x1e1df6[_0x16c2('0x69')]||(_0x1e1df6['attrs']&&_0x1e1df6['attrs'][0x0]?_0x1e1df6[_0x16c2('0x5a')][0x0][_0x16c2('0x5e')]:undefined)||_0x16c2('0x65')},{'name':'attrSerie2','value':_0x1e1df6[_0x16c2('0x6a')]||(_0x1e1df6['attrs']&&_0x1e1df6[_0x16c2('0x5a')][0x1]?_0x1e1df6[_0x16c2('0x5a')][0x1][_0x16c2('0x5e')]:undefined)||null},{'name':_0x16c2('0x6b'),'value':_0x1e1df6['attrSerie3']||(_0x1e1df6['attrs']&&_0x1e1df6[_0x16c2('0x5a')][0x2]?_0x1e1df6[_0x16c2('0x5a')][0x2][_0x16c2('0x5e')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x1e1df6[_0x16c2('0x66')]||(_0x1e1df6['attrs']&&_0x1e1df6[_0x16c2('0x5a')][0x3]?_0x1e1df6['attrs'][0x3]['value']:undefined)||[]}];case _0x16c2('0x6c'):return[{'name':_0x16c2('0x6d'),'type':_0x1e1df6[_0x16c2('0x6e')]||(_0x1e1df6[_0x16c2('0x5a')]&&_0x1e1df6[_0x16c2('0x5a')][0x0]?_0x1e1df6[_0x16c2('0x5a')][0x0][_0x16c2('0x58')]:undefined)||null,'value':_0x1e1df6['attrReport']||(_0x1e1df6[_0x16c2('0x5a')]&&_0x1e1df6['attrs'][0x0]?_0x1e1df6[_0x16c2('0x5a')][0x0][_0x16c2('0x5e')]:undefined)||null},{'name':'attrRefresh','value':_0x1e1df6[_0x16c2('0x6f')]||(_0x1e1df6[_0x16c2('0x5a')]&&_0x1e1df6['attrs'][0x1]?_0x1e1df6['attrs'][0x1][_0x16c2('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x27ec4f){logger[_0x16c2('0x2c')](_0x16c2('0x70'),JSON['stringify'](_0x27ec4f));return[];}}exports[_0x16c2('0x71')]=function(_0x1241c7,_0x1c4974,_0x42fe45){if(_0x1241c7['body']['id']){delete _0x1241c7['body']['id'];}return db['Dashboard']['find']({'where':{'id':_0x1241c7['params']['id']}})[_0x16c2('0x28')](handleEntityNotFound(_0x1c4974,null))['then'](function(_0x299e5f){if(_0x299e5f){_0x1241c7[_0x16c2('0x53')][_0x16c2('0x72')]=_0x299e5f['id'];_0x1241c7[_0x16c2('0x53')][_0x16c2('0x5a')]=widgetAttributes(_0x1241c7[_0x16c2('0x53')]);return db[_0x16c2('0x73')]['create'](_0x1241c7[_0x16c2('0x53')]);}})['then'](respondWithResult(_0x1c4974,null))[_0x16c2('0x47')](handleError(_0x1c4974,null));};exports[_0x16c2('0x74')]=function(_0x3e23e9,_0xaf84ca,_0x5b0566){var _0x210b4a={};var _0x21c058={};var _0x5bfd41;var _0x13f5b8;return db[_0x16c2('0x31')][_0x16c2('0x75')]({'where':{'id':_0x3e23e9[_0x16c2('0x49')]['id']}})[_0x16c2('0x28')](handleEntityNotFound(_0xaf84ca,null))['then'](function(_0x179d33){if(_0x179d33){_0x5bfd41=_0x179d33;_0x21c058[_0x16c2('0x3a')]=_[_0x16c2('0x34')](db[_0x16c2('0x73')][_0x16c2('0x32')]);_0x21c058[_0x16c2('0x33')]=_[_0x16c2('0x34')](_0x3e23e9[_0x16c2('0x33')]);_0x21c058['filters']=_[_0x16c2('0x37')](_0x21c058['model'],_0x21c058[_0x16c2('0x33')]);_0x210b4a[_0x16c2('0x36')]=_[_0x16c2('0x37')](_0x21c058[_0x16c2('0x3a')],qs['fields'](_0x3e23e9[_0x16c2('0x33')]['fields']));_0x210b4a['attributes']=_0x210b4a[_0x16c2('0x36')]['length']?_0x210b4a['attributes']:_0x21c058['model'];_0x210b4a[_0x16c2('0x3c')]=qs[_0x16c2('0x76')](_0x3e23e9['query']['sort']);_0x210b4a['where']=qs['filters'](_[_0x16c2('0x77')](_0x3e23e9[_0x16c2('0x33')],_0x21c058['filters']));if(_0x3e23e9['query'][_0x16c2('0x3e')]){_0x210b4a[_0x16c2('0x3d')]=_[_0x16c2('0x3f')](_0x210b4a['where'],{'$or':_[_0x16c2('0x78')](_0x210b4a['attributes'],function(_0x1c0647){var _0x327324={};_0x327324[_0x1c0647]={'$like':'%'+_0x3e23e9[_0x16c2('0x33')][_0x16c2('0x3e')]+'%'};return _0x327324;})});}_0x210b4a=_[_0x16c2('0x3f')]({},_0x210b4a,_0x3e23e9['options']);return _0x5bfd41[_0x16c2('0x74')](_0x210b4a);}})[_0x16c2('0x28')](function(_0x3319dc){if(_0x3319dc){_0x13f5b8=_0x3319dc['length'];if(!_0x3e23e9[_0x16c2('0x33')]['hasOwnProperty'](_0x16c2('0x3b'))){_0x210b4a[_0x16c2('0x22')]=qs[_0x16c2('0x22')](_0x3e23e9[_0x16c2('0x33')][_0x16c2('0x22')]);_0x210b4a[_0x16c2('0x21')]=qs[_0x16c2('0x21')](_0x3e23e9['query'][_0x16c2('0x21')]);}return _0x5bfd41[_0x16c2('0x74')](_0x210b4a);}})['then'](function(_0xcde239){if(_0xcde239){return _0xcde239?{'count':_0x13f5b8,'rows':_0xcde239}:null;}})[_0x16c2('0x28')](respondWithResult(_0xaf84ca,null))[_0x16c2('0x47')](handleError(_0xaf84ca,null));};
\ No newline at end of file
+var _0x9cb3=['update','then','destroy','CustomDashboards','error','name','send','Dashboard','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','offset','order','sort','pick','where','merge','type','key','VIRTUAL','field','filter','options','count','includeAll','include','findAll','rows','catch','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','UserProfileSection','UserProfileResource','iframe','attrUrl','attrs','https://','custom','attrPath','clock','attrHourFormat','value','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','map','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./dashboard.socket','register','status','limit','set','Content-Range','apply','reject','save'];(function(_0xaaf2e2,_0x19d28a){var _0x28bc36=function(_0x53bdb5){while(--_0x53bdb5){_0xaaf2e2['push'](_0xaaf2e2['shift']());}};_0x28bc36(++_0x19d28a);}(_0x9cb3,0x13f));var _0x39cb=function(_0x50811d,_0x17d91c){_0x50811d=_0x50811d-0x0;var _0x4f1582=_0x9cb3[_0x50811d];return _0x4f1582;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x39cb('0x0'));var rimraf=require(_0x39cb('0x1'));var zipdir=require(_0x39cb('0x2'));var jsonpatch=require(_0x39cb('0x3'));var rp=require(_0x39cb('0x4'));var moment=require(_0x39cb('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x39cb('0x6'));var path=require(_0x39cb('0x7'));var sox=require(_0x39cb('0x8'));var csv=require(_0x39cb('0x9'));var ejs=require(_0x39cb('0xa'));var fs=require('fs');var _=require(_0x39cb('0xb'));var squel=require(_0x39cb('0xc'));var crypto=require(_0x39cb('0xd'));var jsforce=require(_0x39cb('0xe'));var deskjs=require(_0x39cb('0xf'));var toCsv=require(_0x39cb('0x9'));var querystring=require(_0x39cb('0x10'));var Papa=require(_0x39cb('0x11'));var authService=require(_0x39cb('0x12'));var hardwareService=require(_0x39cb('0x13'));var Redis=require('ioredis');var qs=require(_0x39cb('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x39cb('0x15'));var config=require(_0x39cb('0x16'));var db=require(_0x39cb('0x17'))['db'];config[_0x39cb('0x18')]=_['defaults'](config[_0x39cb('0x18')],{'host':_0x39cb('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x39cb('0x1a'))[_0x39cb('0x1b')](socket);function respondWithStatusCode(_0x59e403,_0x36a605){_0x36a605=_0x36a605||0xcc;return function(_0x4e6e82){if(_0x4e6e82){return _0x59e403['sendStatus'](_0x36a605);}return _0x59e403['status'](_0x36a605)['end']();};}function respondWithResult(_0x251f1f,_0x3dc1eb){_0x3dc1eb=_0x3dc1eb||0xc8;return function(_0x41bc00){if(_0x41bc00){return _0x251f1f[_0x39cb('0x1c')](_0x3dc1eb)['json'](_0x41bc00);}};}function respondWithFilteredResult(_0x23c0f2,_0x27dbd9){return function(_0x4a1dc5){if(_0x4a1dc5){var _0x12d5e0=_0x4a1dc5['count'],_0x5aaf16=_0x27dbd9['offset'],_0x35e650=_0x27dbd9['offset']+_0x27dbd9[_0x39cb('0x1d')],_0x39cf46;if(_0x35e650>=_0x12d5e0){_0x35e650=_0x12d5e0;_0x39cf46=0xc8;}else{_0x39cf46=0xce;}_0x23c0f2['status'](_0x39cf46);return _0x23c0f2[_0x39cb('0x1e')](_0x39cb('0x1f'),_0x5aaf16+'-'+_0x35e650+'/'+_0x12d5e0)['json'](_0x4a1dc5);}return null;};}function patchUpdates(_0x4ae169){return function(_0x40d91f){try{jsonpatch[_0x39cb('0x20')](_0x40d91f,_0x4ae169,!![]);}catch(_0x567ac0){return BPromise[_0x39cb('0x21')](_0x567ac0);}return _0x40d91f[_0x39cb('0x22')]();};}function saveUpdates(_0x49d241,_0x4178be){return function(_0x230e17){if(_0x230e17){return _0x230e17[_0x39cb('0x23')](_0x49d241)[_0x39cb('0x24')](function(_0x42ab27){return _0x42ab27;});}return null;};}function removeEntity(_0x2bca50,_0x50233c){return function(_0x460841){if(_0x460841){return _0x460841[_0x39cb('0x25')]()[_0x39cb('0x24')](function(){var _0x5a0e20=_0x460841['get']({'plain':!![]});var _0x30aae6=_0x39cb('0x26');return db['UserProfileResource'][_0x39cb('0x25')]({'where':{'type':_0x30aae6,'resourceId':_0x5a0e20['id']}})[_0x39cb('0x24')](function(){return _0x460841;});})[_0x39cb('0x24')](function(){_0x2bca50['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ced17,_0x5d9789){return function(_0x142542){if(!_0x142542){_0x2ced17['sendStatus'](0x194);}return _0x142542;};}function handleError(_0x2a69bf,_0x1ec7cf){_0x1ec7cf=_0x1ec7cf||0x1f4;return function(_0x43c763){logger[_0x39cb('0x27')](_0x43c763['stack']);if(_0x43c763[_0x39cb('0x28')]){delete _0x43c763['name'];}_0x2a69bf['status'](_0x1ec7cf)[_0x39cb('0x29')](_0x43c763);};}exports['index']=function(_0x357fee,_0x50f6ed){var _0x2157c4={},_0x4aa421={},_0x19fe35={'count':0x0,'rows':[]};var _0x313078=db[_0x39cb('0x2a')][_0x39cb('0x2b')];_0x4aa421[_0x39cb('0x2c')]=_[_0x39cb('0x2d')](_0x313078);_0x4aa421[_0x39cb('0x2e')]=_[_0x39cb('0x2d')](_0x357fee[_0x39cb('0x2e')]);_0x4aa421[_0x39cb('0x2f')]=_[_0x39cb('0x30')](_0x4aa421[_0x39cb('0x2c')],_0x4aa421['query']);_0x2157c4[_0x39cb('0x31')]=_['intersection'](_0x4aa421['model'],qs[_0x39cb('0x32')](_0x357fee[_0x39cb('0x2e')][_0x39cb('0x32')]));_0x2157c4[_0x39cb('0x31')]=_0x2157c4['attributes'][_0x39cb('0x33')]?_0x2157c4[_0x39cb('0x31')]:_0x4aa421[_0x39cb('0x2c')];if(!_0x357fee[_0x39cb('0x2e')]['hasOwnProperty']('nolimit')){_0x2157c4[_0x39cb('0x1d')]=qs[_0x39cb('0x1d')](_0x357fee[_0x39cb('0x2e')]['limit']);_0x2157c4[_0x39cb('0x34')]=qs['offset'](_0x357fee[_0x39cb('0x2e')][_0x39cb('0x34')]);}_0x2157c4[_0x39cb('0x35')]=qs[_0x39cb('0x36')](_0x357fee[_0x39cb('0x2e')]['sort']);_0x2157c4['where']=qs[_0x39cb('0x2f')](_[_0x39cb('0x37')](_0x357fee[_0x39cb('0x2e')],_0x4aa421[_0x39cb('0x2f')]));if(_0x357fee['query']['filter']){_0x2157c4[_0x39cb('0x38')]=_[_0x39cb('0x39')](_0x2157c4[_0x39cb('0x38')],{'$or':_['map'](_0x313078,function(_0x37127a){if(_0x37127a[_0x39cb('0x3a')][_0x39cb('0x3b')]!==_0x39cb('0x3c')){var _0x5a02bc={};_0x5a02bc[_0x37127a[_0x39cb('0x3d')]]={'$like':'%'+_0x357fee[_0x39cb('0x2e')][_0x39cb('0x3e')]+'%'};return _0x5a02bc;}})});}_0x2157c4=_[_0x39cb('0x39')]({},_0x2157c4,_0x357fee[_0x39cb('0x3f')]);var _0x1cd43b={'where':_0x2157c4[_0x39cb('0x38')]};return db[_0x39cb('0x2a')][_0x39cb('0x40')](_0x1cd43b)['then'](function(_0xc1eca){_0x19fe35['count']=_0xc1eca;if(_0x357fee['query'][_0x39cb('0x41')]){_0x2157c4[_0x39cb('0x42')]=[{'all':!![]}];}return db['Dashboard'][_0x39cb('0x43')](_0x2157c4);})[_0x39cb('0x24')](function(_0x528fca){_0x19fe35[_0x39cb('0x44')]=_0x528fca;return _0x19fe35;})[_0x39cb('0x24')](respondWithFilteredResult(_0x50f6ed,_0x2157c4))[_0x39cb('0x45')](handleError(_0x50f6ed,null));};exports['show']=function(_0x124ee4,_0x336a78){var _0x2af4bf={'raw':![],'where':{'id':_0x124ee4['params']['id']}},_0x3a7f76={};_0x3a7f76[_0x39cb('0x2c')]=_['keys'](db['Dashboard'][_0x39cb('0x2b')]);_0x3a7f76[_0x39cb('0x2e')]=_[_0x39cb('0x2d')](_0x124ee4['query']);_0x3a7f76[_0x39cb('0x2f')]=_['intersection'](_0x3a7f76[_0x39cb('0x2c')],_0x3a7f76[_0x39cb('0x2e')]);_0x2af4bf[_0x39cb('0x31')]=_[_0x39cb('0x30')](_0x3a7f76['model'],qs[_0x39cb('0x32')](_0x124ee4[_0x39cb('0x2e')][_0x39cb('0x32')]));_0x2af4bf[_0x39cb('0x31')]=_0x2af4bf[_0x39cb('0x31')][_0x39cb('0x33')]?_0x2af4bf[_0x39cb('0x31')]:_0x3a7f76[_0x39cb('0x2c')];if(_0x124ee4[_0x39cb('0x2e')][_0x39cb('0x41')]){_0x2af4bf[_0x39cb('0x42')]=[{'all':!![]}];}_0x2af4bf=_[_0x39cb('0x39')]({},_0x2af4bf,_0x124ee4[_0x39cb('0x3f')]);return db['Dashboard'][_0x39cb('0x46')](_0x2af4bf)[_0x39cb('0x24')](handleEntityNotFound(_0x336a78,null))[_0x39cb('0x24')](respondWithResult(_0x336a78,null))[_0x39cb('0x45')](handleError(_0x336a78,null));};exports['create']=function(_0x47e8ee,_0x347756){return db[_0x39cb('0x2a')][_0x39cb('0x47')](_0x47e8ee[_0x39cb('0x48')],{})[_0x39cb('0x24')](function(_0x2f5203){var _0x120954=_0x47e8ee[_0x39cb('0x49')][_0x39cb('0x4a')]({'plain':!![]});if(!_0x120954)throw new Error(_0x39cb('0x4b'));if(_0x120954[_0x39cb('0x4c')]===_0x39cb('0x49')){var _0x27cef5=_0x2f5203[_0x39cb('0x4a')]({'plain':!![]});var _0x26570b=_0x39cb('0x26');return db['UserProfileSection'][_0x39cb('0x46')]({'where':{'name':_0x26570b,'userProfileId':_0x120954[_0x39cb('0x4d')]},'raw':!![]})[_0x39cb('0x24')](function(_0x4edd94){if(_0x4edd94&&_0x4edd94[_0x39cb('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x27cef5[_0x39cb('0x28')],'resourceId':_0x27cef5['id'],'type':_0x4edd94['name'],'sectionId':_0x4edd94['id']},{})['then'](function(){return _0x2f5203;});}else{return _0x2f5203;}})[_0x39cb('0x45')](function(_0x3b103e){logger['error'](_0x39cb('0x4f'),_0x3b103e);throw _0x3b103e;});}return _0x2f5203;})['then'](respondWithResult(_0x347756,0xc9))[_0x39cb('0x45')](handleError(_0x347756,null));};exports[_0x39cb('0x50')]=function(_0xa6578f,_0x558757){var _0x44fecf={'raw':![],'where':{'id':_0xa6578f[_0x39cb('0x51')]['id']}},_0x12d630={};_0x12d630[_0x39cb('0x2c')]=_['keys'](db[_0x39cb('0x2a')][_0x39cb('0x2b')]);_0x44fecf['attributes']=_[_0x39cb('0x30')](_0x12d630[_0x39cb('0x2c')],qs['fields'](_0xa6578f['query']['fields']));_0x44fecf[_0x39cb('0x31')]=_0x44fecf['attributes'][_0x39cb('0x33')]?_0x44fecf['attributes']:_0x12d630[_0x39cb('0x2c')];if(_0xa6578f[_0x39cb('0x2e')]['includeAll']){_0x44fecf[_0x39cb('0x42')]=[{'all':!![]}];}_0x44fecf=_['merge']({},_0x44fecf,_0xa6578f[_0x39cb('0x3f')]);return db[_0x39cb('0x2a')][_0x39cb('0x46')](_0x44fecf)[_0x39cb('0x24')](handleEntityNotFound(_0x558757,null))[_0x39cb('0x24')](function(_0x16102d){if(_0x16102d){var _0x14ea7c=_0x16102d[_0x39cb('0x4a')]({'plain':!![]});_0x14ea7c=qs[_0x39cb('0x52')](_0x14ea7c,['id',_0x39cb('0x53'),'updatedAt']);_0xa6578f[_0x39cb('0x48')]=_['omit'](_0xa6578f['body'],['id',_0x39cb('0x53'),'updatedAt']);return db[_0x39cb('0x2a')]['create'](_['merge'](_0x14ea7c,_0xa6578f[_0x39cb('0x48')]),{'include':_0xa6578f[_0x39cb('0x2e')][_0x39cb('0x41')]?[{'all':!![]}]:undefined})[_0x39cb('0x24')](function(_0x234737){var _0x78b231=_0xa6578f[_0x39cb('0x49')][_0x39cb('0x4a')]({'plain':!![]});if(!_0x78b231)throw new Error(_0x39cb('0x4b'));if(_0x78b231[_0x39cb('0x4c')]==='user'){var _0x5057d3=_0x234737['get']({'plain':!![]});var _0x325298='CustomDashboards';return db[_0x39cb('0x54')][_0x39cb('0x46')]({'where':{'name':_0x325298,'userProfileId':_0x78b231[_0x39cb('0x4d')]},'raw':!![]})['then'](function(_0xe3bba4){if(_0xe3bba4&&_0xe3bba4['autoAssociation']===0x0){return db[_0x39cb('0x55')]['create']({'name':_0x5057d3['name'],'resourceId':_0x5057d3['id'],'type':_0xe3bba4['name'],'sectionId':_0xe3bba4['id']},{})[_0x39cb('0x24')](function(){return _0x234737;});}else{return _0x234737;}})[_0x39cb('0x45')](function(_0x2348b1){logger[_0x39cb('0x27')](_0x39cb('0x4f'),_0x2348b1);throw _0x2348b1;});}return _0x234737;});}})[_0x39cb('0x24')](respondWithResult(_0x558757,0xc9))[_0x39cb('0x45')](handleError(_0x558757,null));};exports[_0x39cb('0x23')]=function(_0x17919d,_0x18cddc){if(_0x17919d[_0x39cb('0x48')]['id']){delete _0x17919d[_0x39cb('0x48')]['id'];}return db[_0x39cb('0x2a')][_0x39cb('0x46')]({'where':{'id':_0x17919d[_0x39cb('0x51')]['id']}})[_0x39cb('0x24')](handleEntityNotFound(_0x18cddc,null))['then'](saveUpdates(_0x17919d[_0x39cb('0x48')],null))[_0x39cb('0x24')](respondWithResult(_0x18cddc,null))['catch'](handleError(_0x18cddc,null));};exports['destroy']=function(_0x4d8a31,_0x235dea){return db['Dashboard'][_0x39cb('0x46')]({'where':{'id':_0x4d8a31[_0x39cb('0x51')]['id']}})[_0x39cb('0x24')](handleEntityNotFound(_0x235dea,null))[_0x39cb('0x24')](removeEntity(_0x235dea,null))[_0x39cb('0x45')](handleError(_0x235dea,null));};function widgetAttributes(_0x538ffb){try{switch(_0x538ffb[_0x39cb('0x3a')]){case _0x39cb('0x56'):return[{'name':_0x39cb('0x57'),'value':_0x538ffb[_0x39cb('0x57')]||(_0x538ffb['attrs']&&_0x538ffb[_0x39cb('0x58')][0x0]?_0x538ffb['attrs'][0x0]['value']:undefined)||_0x39cb('0x59')}];case _0x39cb('0x5a'):return[{'name':_0x39cb('0x5b'),'value':_0x538ffb[_0x39cb('0x5b')]||(_0x538ffb[_0x39cb('0x58')]&&_0x538ffb['attrs'][0x0]?_0x538ffb[_0x39cb('0x58')][0x0]['value']:undefined)||''}];case _0x39cb('0x5c'):return[{'name':_0x39cb('0x5d'),'value':_0x538ffb[_0x39cb('0x5d')]||(_0x538ffb[_0x39cb('0x58')]&&_0x538ffb['attrs'][0x0]?_0x538ffb[_0x39cb('0x58')][0x0][_0x39cb('0x5e')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x538ffb[_0x39cb('0x5f')]||(_0x538ffb[_0x39cb('0x58')]&&_0x538ffb['attrs'][0x1]?_0x538ffb[_0x39cb('0x58')][0x1][_0x39cb('0x5e')]:undefined)||_0x39cb('0x60')},{'name':_0x39cb('0x61'),'value':_0x538ffb[_0x39cb('0x61')]||(_0x538ffb[_0x39cb('0x58')]&&_0x538ffb[_0x39cb('0x58')][0x2]?_0x538ffb[_0x39cb('0x58')][0x2][_0x39cb('0x5e')]:undefined)||0xc}];case _0x39cb('0x62'):return[{'name':_0x39cb('0x63'),'value':_0x538ffb['attrMetric']||(_0x538ffb[_0x39cb('0x58')]&&_0x538ffb['attrs'][0x0]?_0x538ffb[_0x39cb('0x58')][0x0]['value']:undefined)||_0x39cb('0x64')},{'name':_0x39cb('0x65'),'value':_0x538ffb[_0x39cb('0x65')]||(_0x538ffb[_0x39cb('0x58')]&&_0x538ffb[_0x39cb('0x58')][0x1]?_0x538ffb[_0x39cb('0x58')][0x1][_0x39cb('0x5e')]:undefined)||[]},{'name':_0x39cb('0x61'),'value':_0x538ffb[_0x39cb('0x61')]||(_0x538ffb[_0x39cb('0x58')]&&_0x538ffb[_0x39cb('0x58')][0x2]?_0x538ffb['attrs'][0x2]['value']:undefined)||0x14}];case _0x39cb('0x66'):case'pie-chart':return[{'name':'attrSerie1','value':_0x538ffb['attrSerie1']||(_0x538ffb[_0x39cb('0x58')]&&_0x538ffb['attrs'][0x0]?_0x538ffb[_0x39cb('0x58')][0x0][_0x39cb('0x5e')]:undefined)||_0x39cb('0x64')},{'name':_0x39cb('0x67'),'value':_0x538ffb[_0x39cb('0x67')]||(_0x538ffb[_0x39cb('0x58')]&&_0x538ffb[_0x39cb('0x58')][0x1]?_0x538ffb[_0x39cb('0x58')][0x1][_0x39cb('0x5e')]:undefined)||null},{'name':_0x39cb('0x68'),'value':_0x538ffb[_0x39cb('0x68')]||(_0x538ffb[_0x39cb('0x58')]&&_0x538ffb[_0x39cb('0x58')][0x2]?_0x538ffb['attrs'][0x2]['value']:undefined)||null},{'name':_0x39cb('0x65'),'value':_0x538ffb[_0x39cb('0x65')]||(_0x538ffb['attrs']&&_0x538ffb[_0x39cb('0x58')][0x3]?_0x538ffb[_0x39cb('0x58')][0x3][_0x39cb('0x5e')]:undefined)||[]}];case'web-report':return[{'name':_0x39cb('0x69'),'type':_0x538ffb[_0x39cb('0x6a')]||(_0x538ffb[_0x39cb('0x58')]&&_0x538ffb[_0x39cb('0x58')][0x0]?_0x538ffb[_0x39cb('0x58')][0x0]['type']:undefined)||null,'value':_0x538ffb[_0x39cb('0x69')]||(_0x538ffb[_0x39cb('0x58')]&&_0x538ffb[_0x39cb('0x58')][0x0]?_0x538ffb[_0x39cb('0x58')][0x0][_0x39cb('0x5e')]:undefined)||null},{'name':_0x39cb('0x6b'),'value':_0x538ffb[_0x39cb('0x6b')]||(_0x538ffb['attrs']&&_0x538ffb['attrs'][0x1]?_0x538ffb['attrs'][0x1][_0x39cb('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x147c04){logger[_0x39cb('0x27')](_0x39cb('0x6c'),JSON[_0x39cb('0x6d')](_0x147c04));return[];}}exports[_0x39cb('0x6e')]=function(_0x3ffd61,_0x44b68b,_0x41526d){if(_0x3ffd61[_0x39cb('0x48')]['id']){delete _0x3ffd61[_0x39cb('0x48')]['id'];}return db['Dashboard'][_0x39cb('0x46')]({'where':{'id':_0x3ffd61[_0x39cb('0x51')]['id']}})['then'](handleEntityNotFound(_0x44b68b,null))[_0x39cb('0x24')](function(_0x413c47){if(_0x413c47){_0x3ffd61[_0x39cb('0x48')][_0x39cb('0x6f')]=_0x413c47['id'];_0x3ffd61[_0x39cb('0x48')][_0x39cb('0x58')]=widgetAttributes(_0x3ffd61[_0x39cb('0x48')]);return db[_0x39cb('0x70')]['create'](_0x3ffd61['body']);}})[_0x39cb('0x24')](respondWithResult(_0x44b68b,null))[_0x39cb('0x45')](handleError(_0x44b68b,null));};exports[_0x39cb('0x71')]=function(_0x8caeb8,_0x74f37e,_0x2c6601){var _0x330261={};var _0x2e17a0={};var _0x18ed0e;var _0x3f9e5f;return db[_0x39cb('0x2a')][_0x39cb('0x72')]({'where':{'id':_0x8caeb8[_0x39cb('0x51')]['id']}})[_0x39cb('0x24')](handleEntityNotFound(_0x74f37e,null))['then'](function(_0x388af1){if(_0x388af1){_0x18ed0e=_0x388af1;_0x2e17a0[_0x39cb('0x2c')]=_['keys'](db[_0x39cb('0x70')][_0x39cb('0x2b')]);_0x2e17a0[_0x39cb('0x2e')]=_[_0x39cb('0x2d')](_0x8caeb8[_0x39cb('0x2e')]);_0x2e17a0[_0x39cb('0x2f')]=_['intersection'](_0x2e17a0[_0x39cb('0x2c')],_0x2e17a0[_0x39cb('0x2e')]);_0x330261[_0x39cb('0x31')]=_[_0x39cb('0x30')](_0x2e17a0['model'],qs[_0x39cb('0x32')](_0x8caeb8[_0x39cb('0x2e')][_0x39cb('0x32')]));_0x330261[_0x39cb('0x31')]=_0x330261[_0x39cb('0x31')][_0x39cb('0x33')]?_0x330261['attributes']:_0x2e17a0[_0x39cb('0x2c')];_0x330261[_0x39cb('0x35')]=qs['sort'](_0x8caeb8[_0x39cb('0x2e')][_0x39cb('0x36')]);_0x330261[_0x39cb('0x38')]=qs[_0x39cb('0x2f')](_[_0x39cb('0x37')](_0x8caeb8[_0x39cb('0x2e')],_0x2e17a0[_0x39cb('0x2f')]));if(_0x8caeb8[_0x39cb('0x2e')][_0x39cb('0x3e')]){_0x330261['where']=_[_0x39cb('0x39')](_0x330261[_0x39cb('0x38')],{'$or':_[_0x39cb('0x73')](_0x330261[_0x39cb('0x31')],function(_0x19763d){var _0x2c4017={};_0x2c4017[_0x19763d]={'$like':'%'+_0x8caeb8[_0x39cb('0x2e')][_0x39cb('0x3e')]+'%'};return _0x2c4017;})});}_0x330261=_[_0x39cb('0x39')]({},_0x330261,_0x8caeb8[_0x39cb('0x3f')]);return _0x18ed0e[_0x39cb('0x71')](_0x330261);}})[_0x39cb('0x24')](function(_0x1761c0){if(_0x1761c0){_0x3f9e5f=_0x1761c0[_0x39cb('0x33')];if(!_0x8caeb8[_0x39cb('0x2e')][_0x39cb('0x74')](_0x39cb('0x75'))){_0x330261['limit']=qs[_0x39cb('0x1d')](_0x8caeb8['query'][_0x39cb('0x1d')]);_0x330261[_0x39cb('0x34')]=qs[_0x39cb('0x34')](_0x8caeb8[_0x39cb('0x2e')][_0x39cb('0x34')]);}return _0x18ed0e[_0x39cb('0x71')](_0x330261);}})[_0x39cb('0x24')](function(_0x13e599){if(_0x13e599){return _0x13e599?{'count':_0x3f9e5f,'rows':_0x13e599}:null;}})[_0x39cb('0x24')](respondWithResult(_0x74f37e,null))[_0x39cb('0x45')](handleError(_0x74f37e,null));};
\ No newline at end of file
index d6e01fd..e6bfe9a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd00a=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard'];(function(_0x4aae07,_0x105d67){var _0x437754=function(_0x5eba8f){while(--_0x5eba8f){_0x4aae07['push'](_0x4aae07['shift']());}};_0x437754(++_0x105d67);}(_0xd00a,0x1e3));var _0xad00=function(_0x5c238a,_0x283a02){_0x5c238a=_0x5c238a-0x0;var _0x15d1ee=_0xd00a[_0x5c238a];return _0x15d1ee;};'use strict';var EventEmitter=require(_0xad00('0x0'));var Dashboard=require(_0xad00('0x1'))['db'][_0xad00('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xad00('0x3'),'afterUpdate':'update','afterDestroy':_0xad00('0x4')};function emitEvent(_0x44600b){return function(_0xe2ffa9,_0x3306a1,_0x33c62f){DashboardEvents[_0xad00('0x5')](_0x44600b+':'+_0xe2ffa9['id'],_0xe2ffa9);DashboardEvents['emit'](_0x44600b,_0xe2ffa9);_0x33c62f(null);};}for(var e in events){if(events[_0xad00('0x6')](e)){var event=events[e];Dashboard[_0xad00('0x7')](e,emitEvent(event));}}module[_0xad00('0x8')]=DashboardEvents;
\ No newline at end of file
+var _0x031c=['../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4bf61a,_0x3a649b){var _0x27f463=function(_0x62b90){while(--_0x62b90){_0x4bf61a['push'](_0x4bf61a['shift']());}};_0x27f463(++_0x3a649b);}(_0x031c,0x18b));var _0xc031=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x031c[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require(_0xc031('0x0'));var Dashboard=require(_0xc031('0x1'))['db'][_0xc031('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xc031('0x3')](0x0);var events={'afterCreate':_0xc031('0x4'),'afterUpdate':_0xc031('0x5'),'afterDestroy':_0xc031('0x6')};function emitEvent(_0x5ac545){return function(_0x482c98,_0x13f995,_0x160e9f){DashboardEvents[_0xc031('0x7')](_0x5ac545+':'+_0x482c98['id'],_0x482c98);DashboardEvents[_0xc031('0x7')](_0x5ac545,_0x482c98);_0x160e9f(null);};}for(var e in events){if(events[_0xc031('0x8')](e)){var event=events[e];Dashboard[_0xc031('0x9')](e,emitEvent(event));}}module[_0xc031('0xa')]=DashboardEvents;
\ No newline at end of file
index 957d505..eadca33 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8861=['api','moment','bluebird','request-promise','./dashboard.attributes','exports','define','Dashboard','dashboards','../../config/logger'];(function(_0x5b83d1,_0x21c614){var _0x4dbf36=function(_0x20e25a){while(--_0x20e25a){_0x5b83d1['push'](_0x5b83d1['shift']());}};_0x4dbf36(++_0x21c614);}(_0x8861,0x6d));var _0x1886=function(_0x10ecc7,_0x4f6235){_0x10ecc7=_0x10ecc7-0x0;var _0xf9b77a=_0x8861[_0x10ecc7];return _0xf9b77a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1886('0x0'))(_0x1886('0x1'));var moment=require(_0x1886('0x2'));var BPromise=require(_0x1886('0x3'));var rp=require(_0x1886('0x4'));var attributes=require(_0x1886('0x5'));module[_0x1886('0x6')]=function(_0x2673bc,_0x3eec67){return _0x2673bc[_0x1886('0x7')](_0x1886('0x8'),attributes,{'tableName':_0x1886('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x6efe=['lodash','util','../../config/logger','api','moment','./dashboard.attributes','exports','define','dashboards'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6efe,0xc6));var _0xe6ef=function(_0x58610a,_0x3ff0e1){_0x58610a=_0x58610a-0x0;var _0x16dc1b=_0x6efe[_0x58610a];return _0x16dc1b;};'use strict';var _=require(_0xe6ef('0x0'));var util=require(_0xe6ef('0x1'));var logger=require(_0xe6ef('0x2'))(_0xe6ef('0x3'));var moment=require(_0xe6ef('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xe6ef('0x5'));module[_0xe6ef('0x6')]=function(_0x340687,_0x40c086){return _0x340687[_0xe6ef('0x7')]('Dashboard',attributes,{'tableName':_0xe6ef('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 4cc8bcf..4c14bfd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb05e=['debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xb05e,0x103));var _0xeb05=function(_0x4d4a1d,_0x42326c){_0x4d4a1d=_0x4d4a1d-0x0;var _0x322338=_0xb05e[_0x4d4a1d];return _0x322338;};'use strict';var _=require(_0xeb05('0x0'));var util=require(_0xeb05('0x1'));var moment=require(_0xeb05('0x2'));var BPromise=require(_0xeb05('0x3'));var rs=require(_0xeb05('0x4'));var fs=require('fs');var Redis=require(_0xeb05('0x5'));var db=require(_0xeb05('0x6'))['db'];var utils=require(_0xeb05('0x7'));var logger=require('../../config/logger')(_0xeb05('0x8'));var config=require(_0xeb05('0x9'));var jayson=require(_0xeb05('0xa'));var client=jayson['client'][_0xeb05('0xb')]({'port':0x232a});config[_0xeb05('0xc')]=_[_0xeb05('0xd')](config[_0xeb05('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeb05('0xc')]));require(_0xeb05('0xe'))[_0xeb05('0xf')](socket);function respondWithRpcPromise(_0x3d8ad7,_0x1e2dd1,_0x4e9f3f){return new BPromise(function(_0x3d6883,_0x2a1571){return client[_0xeb05('0x10')](_0x3d8ad7,_0x4e9f3f)[_0xeb05('0x11')](function(_0xa13d0e){logger[_0xeb05('0x12')](_0xeb05('0x13'),_0x1e2dd1,_0xeb05('0x14'));logger[_0xeb05('0x15')](_0xeb05('0x16'),_0x1e2dd1,_0xeb05('0x14'),JSON[_0xeb05('0x17')](_0xa13d0e));if(_0xa13d0e[_0xeb05('0x18')]){if(_0xa13d0e[_0xeb05('0x18')][_0xeb05('0x19')]===0x1f4){logger[_0xeb05('0x18')](_0xeb05('0x13'),_0x1e2dd1,_0xa13d0e[_0xeb05('0x18')]['message']);return _0x2a1571(_0xa13d0e[_0xeb05('0x18')][_0xeb05('0x1a')]);}logger[_0xeb05('0x18')](_0xeb05('0x13'),_0x1e2dd1,_0xa13d0e[_0xeb05('0x18')]['message']);return _0x3d6883(_0xa13d0e[_0xeb05('0x18')][_0xeb05('0x1a')]);}else{logger[_0xeb05('0x12')](_0xeb05('0x13'),_0x1e2dd1,_0xeb05('0x14'));_0x3d6883(_0xa13d0e['result'][_0xeb05('0x1a')]);}})[_0xeb05('0x1b')](function(_0x546689){logger['error']('Dashboard,\x20%s,\x20%s',_0x1e2dd1,_0x546689);_0x2a1571(_0x546689);});});}
\ No newline at end of file
+var _0xa1ce=['socket.io-emitter','./dashboard.socket','register','request','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x38d6db,_0x21ee16){var _0x52e575=function(_0x5e356d){while(--_0x5e356d){_0x38d6db['push'](_0x38d6db['shift']());}};_0x52e575(++_0x21ee16);}(_0xa1ce,0x1da));var _0xea1c=function(_0x1ba4de,_0x2a1e02){_0x1ba4de=_0x1ba4de-0x0;var _0x176159=_0xa1ce[_0x1ba4de];return _0x176159;};'use strict';var _=require(_0xea1c('0x0'));var util=require('util');var moment=require(_0xea1c('0x1'));var BPromise=require(_0xea1c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xea1c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xea1c('0x4'));var logger=require(_0xea1c('0x5'))(_0xea1c('0x6'));var config=require(_0xea1c('0x7'));var jayson=require(_0xea1c('0x8'));var client=jayson['client'][_0xea1c('0x9')]({'port':0x232a});config[_0xea1c('0xa')]=_[_0xea1c('0xb')](config[_0xea1c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xea1c('0xc'))(new Redis(config[_0xea1c('0xa')]));require(_0xea1c('0xd'))[_0xea1c('0xe')](socket);function respondWithRpcPromise(_0x5e9bf1,_0x25879f,_0x3cbcf8){return new BPromise(function(_0x298362,_0x49549d){return client[_0xea1c('0xf')](_0x5e9bf1,_0x3cbcf8)['then'](function(_0x65eab1){logger[_0xea1c('0x10')](_0xea1c('0x11'),_0x25879f,'request\x20sent');logger[_0xea1c('0x12')](_0xea1c('0x13'),_0x25879f,'request\x20sent',JSON[_0xea1c('0x14')](_0x65eab1));if(_0x65eab1['error']){if(_0x65eab1[_0xea1c('0x15')][_0xea1c('0x16')]===0x1f4){logger[_0xea1c('0x15')](_0xea1c('0x11'),_0x25879f,_0x65eab1[_0xea1c('0x15')][_0xea1c('0x17')]);return _0x49549d(_0x65eab1[_0xea1c('0x15')][_0xea1c('0x17')]);}logger[_0xea1c('0x15')](_0xea1c('0x11'),_0x25879f,_0x65eab1[_0xea1c('0x15')][_0xea1c('0x17')]);return _0x298362(_0x65eab1['error'][_0xea1c('0x17')]);}else{logger[_0xea1c('0x10')](_0xea1c('0x11'),_0x25879f,_0xea1c('0x18'));_0x298362(_0x65eab1[_0xea1c('0x19')][_0xea1c('0x17')]);}})[_0xea1c('0x1a')](function(_0x2cc3c4){logger[_0xea1c('0x15')](_0xea1c('0x11'),_0x25879f,_0x2cc3c4);_0x49549d(_0x2cc3c4);});});}
\ No newline at end of file
index 6f3bdb4..0ac0b8f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x30f6=['dashboard:','./dashboard.events','save','remove','update','emit','register','length'];(function(_0xd2a8f3,_0x2bb7dd){var _0x39baca=function(_0x57266d){while(--_0x57266d){_0xd2a8f3['push'](_0xd2a8f3['shift']());}};_0x39baca(++_0x2bb7dd);}(_0x30f6,0x1d1));var _0x630f=function(_0x70588,_0x2e21dd){_0x70588=_0x70588-0x0;var _0x1981d8=_0x30f6[_0x70588];return _0x1981d8;};'use strict';var DashboardEvents=require(_0x630f('0x0'));var events=[_0x630f('0x1'),_0x630f('0x2'),_0x630f('0x3')];function createListener(_0x2bec2b,_0x54f8bc){return function(_0x16dbe8){_0x54f8bc[_0x630f('0x4')](_0x2bec2b,_0x16dbe8);};}function removeListener(_0x16053a,_0x260da9){return function(){DashboardEvents['removeListener'](_0x16053a,_0x260da9);};}exports[_0x630f('0x5')]=function(_0x3861ef){for(var _0x1a01f1=0x0,_0x4aaa52=events[_0x630f('0x6')];_0x1a01f1<_0x4aaa52;_0x1a01f1++){var _0x4c24ee=events[_0x1a01f1];var _0x2ea4f3=createListener(_0x630f('0x7')+_0x4c24ee,_0x3861ef);DashboardEvents['on'](_0x4c24ee,_0x2ea4f3);}};
\ No newline at end of file
+var _0x5a16=['save','emit','register'];(function(_0x31e71b,_0xf09918){var _0x4c8164=function(_0xbcd984){while(--_0xbcd984){_0x31e71b['push'](_0x31e71b['shift']());}};_0x4c8164(++_0xf09918);}(_0x5a16,0xe4));var _0x65a1=function(_0x136619,_0x31c9b2){_0x136619=_0x136619-0x0;var _0x38c4a5=_0x5a16[_0x136619];return _0x38c4a5;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x65a1('0x0'),'remove','update'];function createListener(_0x32e6a2,_0x42e99d){return function(_0x70f7a9){_0x42e99d[_0x65a1('0x1')](_0x32e6a2,_0x70f7a9);};}function removeListener(_0x2030a1,_0x1feeb0){return function(){DashboardEvents['removeListener'](_0x2030a1,_0x1feeb0);};}exports[_0x65a1('0x2')]=function(_0x50cf3b){for(var _0xe7dc2b=0x0,_0x13368b=events['length'];_0xe7dc2b<_0x13368b;_0xe7dc2b++){var _0x37f60a=events[_0xe7dc2b];var _0x16fb9d=createListener('dashboard:'+_0x37f60a,_0x50cf3b);DashboardEvents['on'](_0x37f60a,_0x16fb9d);}};
\ No newline at end of file
index 7966f1b..13d9349 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd471=['delete','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','/:id'];(function(_0x4ad186,_0x1c6dd8){var _0x515919=function(_0x136db4){while(--_0x136db4){_0x4ad186['push'](_0x4ad186['shift']());}};_0x515919(++_0x1c6dd8);}(_0xd471,0x135));var _0x1d47=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xd471[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require(_0x1d47('0x0'));var util=require(_0x1d47('0x1'));var path=require(_0x1d47('0x2'));var timeout=require(_0x1d47('0x3'));var express=require(_0x1d47('0x4'));var router=express[_0x1d47('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x1d47('0x6'));var config=require(_0x1d47('0x7'));var controller=require(_0x1d47('0x8'));router[_0x1d47('0x9')]('/',auth[_0x1d47('0xa')](),controller[_0x1d47('0xb')]);router[_0x1d47('0x9')]('/:id',auth[_0x1d47('0xa')](),controller['show']);router[_0x1d47('0x9')](_0x1d47('0xc'),auth[_0x1d47('0xa')](),controller[_0x1d47('0xd')]);router[_0x1d47('0xe')]('/',auth['isAuthenticated'](),controller[_0x1d47('0xf')]);router[_0x1d47('0xe')](_0x1d47('0x10'),auth[_0x1d47('0xa')](),controller[_0x1d47('0x11')]);router[_0x1d47('0xe')](_0x1d47('0xc'),auth[_0x1d47('0xa')](),controller[_0x1d47('0x12')]);router[_0x1d47('0x13')](_0x1d47('0x14'),auth[_0x1d47('0xa')](),controller['update']);router[_0x1d47('0x15')](_0x1d47('0x14'),auth[_0x1d47('0xa')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
+var _0x03b7=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','/:id','update','destroy'];(function(_0x4c6be7,_0x1c981a){var _0x156420=function(_0x14969b){while(--_0x14969b){_0x4c6be7['push'](_0x4c6be7['shift']());}};_0x156420(++_0x1c981a);}(_0x03b7,0xa1));var _0x703b=function(_0x233c3b,_0x191fa4){_0x233c3b=_0x233c3b-0x0;var _0x117119=_0x03b7[_0x233c3b];return _0x117119;};'use strict';var multer=require(_0x703b('0x0'));var util=require(_0x703b('0x1'));var path=require(_0x703b('0x2'));var timeout=require(_0x703b('0x3'));var express=require(_0x703b('0x4'));var router=express[_0x703b('0x5')]();var auth=require(_0x703b('0x6'));var interaction=require(_0x703b('0x7'));var config=require('../../config/environment');var controller=require(_0x703b('0x8'));router[_0x703b('0x9')]('/',auth[_0x703b('0xa')](),controller['index']);router['get']('/:id',auth[_0x703b('0xa')](),controller[_0x703b('0xb')]);router[_0x703b('0x9')](_0x703b('0xc'),auth['isAuthenticated'](),controller[_0x703b('0xd')]);router[_0x703b('0xe')]('/',auth['isAuthenticated'](),controller[_0x703b('0xf')]);router[_0x703b('0xe')](_0x703b('0x10'),auth[_0x703b('0xa')](),controller[_0x703b('0x11')]);router['post'](_0x703b('0xc'),auth[_0x703b('0xa')](),controller[_0x703b('0x12')]);router[_0x703b('0x13')](_0x703b('0x14'),auth[_0x703b('0xa')](),controller[_0x703b('0x15')]);router['delete'](_0x703b('0x14'),auth[_0x703b('0xa')](),controller[_0x703b('0x16')]);module['exports']=router;
\ No newline at end of file
index f173917..6815aea 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8405=['exports','STRING','TEXT','long','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash'];(function(_0x4ad6af,_0x385f37){var _0x3dd541=function(_0x388eb8){while(--_0x388eb8){_0x4ad6af['push'](_0x4ad6af['shift']());}};_0x3dd541(++_0x385f37);}(_0x8405,0x14d));var _0x5840=function(_0x41aea2,_0x175a77){_0x41aea2=_0x41aea2-0x0;var _0x4e1f8c=_0x8405[_0x41aea2];return _0x4e1f8c;};'use strict';var Sequelize=require(_0x5840('0x0'));var squel=require(_0x5840('0x1'));var _=require(_0x5840('0x2'));module[_0x5840('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x5840('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x5840('0x5')](_0x5840('0x6')),'get':function(){try{return JSON['parse'](this[_0x5840('0x7')](_0x5840('0x8')));}catch(_0x283ffd){return[];}},'set':function(_0x100577){try{this[_0x5840('0x9')](_0x5840('0x8'),JSON['stringify'](_0x100577));}catch(_0x57f9ee){this[_0x5840('0x9')](_0x5840('0x8'),JSON[_0x5840('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x5840('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x5840('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5840('0xb')]},'col':{'type':Sequelize[_0x5840('0xb')]},'background':{'type':Sequelize[_0x5840('0x4')],'allowNull':![],'defaultValue':_0x5840('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x5840('0x4')],'allowNull':![],'defaultValue':_0x5840('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x33b0=['#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x4abc69,_0x4a066d){var _0x2cf9ac=function(_0x419667){while(--_0x419667){_0x4abc69['push'](_0x4abc69['shift']());}};_0x2cf9ac(++_0x4a066d);}(_0x33b0,0x1e2));var _0x033b=function(_0x2be367,_0x367ec5){_0x2be367=_0x2be367-0x0;var _0x279335=_0x33b0[_0x2be367];return _0x279335;};'use strict';var Sequelize=require(_0x033b('0x0'));var squel=require(_0x033b('0x1'));var _=require(_0x033b('0x2'));module[_0x033b('0x3')]={'title':{'type':Sequelize[_0x033b('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x033b('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x033b('0x5')](_0x033b('0x6')),'get':function(){try{return JSON[_0x033b('0x7')](this[_0x033b('0x8')](_0x033b('0x9')));}catch(_0x5d95b8){return[];}},'set':function(_0x509020){try{this[_0x033b('0xa')]('attrs',JSON[_0x033b('0xb')](_0x509020));}catch(_0x23c934){this['setDataValue'](_0x033b('0x9'),JSON[_0x033b('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0x033b('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x033b('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x033b('0xc')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x033b('0x4')],'allowNull':![],'defaultValue':_0x033b('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x033b('0x4')],'allowNull':![],'defaultValue':_0x033b('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}};
\ No newline at end of file
index dc87477..72c49f7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb30f=['body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','offset','json','apply','reject','update','then','destroy','error','stack','name','send','show','params','keys','DashboardItem','filters','intersection','model','attributes','fields','includeAll','merge','options','find','catch','type','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0xb30f,0x109));var _0xfb30=function(_0x1af78b,_0x216a77){_0x1af78b=_0x1af78b-0x0;var _0x127c93=_0xb30f[_0x1af78b];return _0x127c93;};'use strict';var pdf=require(_0xfb30('0x0'));var emlformat=require(_0xfb30('0x1'));var rimraf=require(_0xfb30('0x2'));var zipdir=require(_0xfb30('0x3'));var jsonpatch=require(_0xfb30('0x4'));var rp=require('request-promise');var moment=require(_0xfb30('0x5'));var BPromise=require(_0xfb30('0x6'));var Mustache=require(_0xfb30('0x7'));var util=require('util');var path=require(_0xfb30('0x8'));var sox=require(_0xfb30('0x9'));var csv=require(_0xfb30('0xa'));var ejs=require(_0xfb30('0xb'));var fs=require('fs');var _=require(_0xfb30('0xc'));var squel=require('squel');var crypto=require(_0xfb30('0xd'));var jsforce=require(_0xfb30('0xe'));var deskjs=require(_0xfb30('0xf'));var toCsv=require(_0xfb30('0xa'));var querystring=require(_0xfb30('0x10'));var Papa=require('papaparse');var authService=require(_0xfb30('0x11'));var hardwareService=require(_0xfb30('0x12'));var Redis=require(_0xfb30('0x13'));var qs=require(_0xfb30('0x14'));var logger=require(_0xfb30('0x15'))(_0xfb30('0x16'));var utils=require(_0xfb30('0x17'));var config=require(_0xfb30('0x18'));var db=require('../../mysqldb')['db'];config[_0xfb30('0x19')]=_['defaults'](config[_0xfb30('0x19')],{'host':_0xfb30('0x1a'),'port':0x18eb});var socket=require(_0xfb30('0x1b'))(new Redis(config[_0xfb30('0x19')]));require(_0xfb30('0x1c'))[_0xfb30('0x1d')](socket);function respondWithStatusCode(_0x4ce80a,_0x47be36){_0x47be36=_0x47be36||0xcc;return function(_0x1c4f08){if(_0x1c4f08){return _0x4ce80a[_0xfb30('0x1e')](_0x47be36);}return _0x4ce80a[_0xfb30('0x1f')](_0x47be36)[_0xfb30('0x20')]();};}function respondWithResult(_0x443282,_0x2fd24d){_0x2fd24d=_0x2fd24d||0xc8;return function(_0x805cba){if(_0x805cba){return _0x443282['status'](_0x2fd24d)['json'](_0x805cba);}};}function respondWithFilteredResult(_0xb1c99e,_0x1261e3){return function(_0x3290a8){if(_0x3290a8){var _0x386dd4=_0x3290a8['count'],_0x1099d4=_0x1261e3[_0xfb30('0x21')],_0x11438e=_0x1261e3[_0xfb30('0x21')]+_0x1261e3['limit'],_0x56402e;if(_0x11438e>=_0x386dd4){_0x11438e=_0x386dd4;_0x56402e=0xc8;}else{_0x56402e=0xce;}_0xb1c99e[_0xfb30('0x1f')](_0x56402e);return _0xb1c99e['set']('Content-Range',_0x1099d4+'-'+_0x11438e+'/'+_0x386dd4)[_0xfb30('0x22')](_0x3290a8);}return null;};}function patchUpdates(_0x12972b){return function(_0x58d207){try{jsonpatch[_0xfb30('0x23')](_0x58d207,_0x12972b,!![]);}catch(_0x45d441){return BPromise[_0xfb30('0x24')](_0x45d441);}return _0x58d207['save']();};}function saveUpdates(_0x47fafa,_0x10a64d){return function(_0x286f20){if(_0x286f20){return _0x286f20[_0xfb30('0x25')](_0x47fafa)[_0xfb30('0x26')](function(_0x5899c0){return _0x5899c0;});}return null;};}function removeEntity(_0x2449c6,_0xeb8c09){return function(_0x50d75c){if(_0x50d75c){return _0x50d75c[_0xfb30('0x27')]()[_0xfb30('0x26')](function(){_0x2449c6[_0xfb30('0x1f')](0xcc)[_0xfb30('0x20')]();});}};}function handleEntityNotFound(_0x26dbbb,_0x385ef6){return function(_0x39dc68){if(!_0x39dc68){_0x26dbbb[_0xfb30('0x1e')](0x194);}return _0x39dc68;};}function handleError(_0x2b8549,_0x46dd0c){_0x46dd0c=_0x46dd0c||0x1f4;return function(_0x3c5fcb){logger[_0xfb30('0x28')](_0x3c5fcb[_0xfb30('0x29')]);if(_0x3c5fcb[_0xfb30('0x2a')]){delete _0x3c5fcb[_0xfb30('0x2a')];}_0x2b8549[_0xfb30('0x1f')](_0x46dd0c)[_0xfb30('0x2b')](_0x3c5fcb);};}exports[_0xfb30('0x2c')]=function(_0x497d57,_0x36f7a4){var _0x3d74eb={'raw':![],'where':{'id':_0x497d57[_0xfb30('0x2d')]['id']}},_0x514277={};_0x514277['model']=_[_0xfb30('0x2e')](db[_0xfb30('0x2f')]['rawAttributes']);_0x514277['query']=_[_0xfb30('0x2e')](_0x497d57['query']);_0x514277[_0xfb30('0x30')]=_[_0xfb30('0x31')](_0x514277[_0xfb30('0x32')],_0x514277['query']);_0x3d74eb[_0xfb30('0x33')]=_[_0xfb30('0x31')](_0x514277[_0xfb30('0x32')],qs[_0xfb30('0x34')](_0x497d57['query'][_0xfb30('0x34')]));_0x3d74eb[_0xfb30('0x33')]=_0x3d74eb[_0xfb30('0x33')]['length']?_0x3d74eb[_0xfb30('0x33')]:_0x514277[_0xfb30('0x32')];if(_0x497d57['query'][_0xfb30('0x35')]){_0x3d74eb['include']=[{'all':!![]}];}_0x3d74eb=_[_0xfb30('0x36')]({},_0x3d74eb,_0x497d57[_0xfb30('0x37')]);return db[_0xfb30('0x2f')][_0xfb30('0x38')](_0x3d74eb)[_0xfb30('0x26')](handleEntityNotFound(_0x36f7a4,null))[_0xfb30('0x26')](respondWithResult(_0x36f7a4,null))[_0xfb30('0x39')](handleError(_0x36f7a4,null));};exports[_0xfb30('0x27')]=function(_0x3788cc,_0x51b8b5){return db[_0xfb30('0x2f')][_0xfb30('0x38')]({'where':{'id':_0x3788cc[_0xfb30('0x2d')]['id']}})[_0xfb30('0x26')](handleEntityNotFound(_0x51b8b5,null))['then'](removeEntity(_0x51b8b5,null))[_0xfb30('0x39')](handleError(_0x51b8b5,null));};function widgetAttributes(_0x4d9ccb){try{switch(_0x4d9ccb[_0xfb30('0x3a')]){case _0xfb30('0x3b'):return[{'name':'attrUrl','value':_0x4d9ccb[_0xfb30('0x3c')]||(_0x4d9ccb[_0xfb30('0x3d')]&&_0x4d9ccb['attrs'][0x0]?_0x4d9ccb[_0xfb30('0x3d')][0x0]['value']:undefined)||_0xfb30('0x3e')}];case _0xfb30('0x3f'):return[{'name':_0xfb30('0x40'),'value':_0x4d9ccb[_0xfb30('0x40')]||(_0x4d9ccb['attrs']&&_0x4d9ccb[_0xfb30('0x3d')][0x0]?_0x4d9ccb[_0xfb30('0x3d')][0x0][_0xfb30('0x41')]:undefined)||''}];case _0xfb30('0x42'):return[{'name':_0xfb30('0x43'),'value':_0x4d9ccb[_0xfb30('0x43')]||(_0x4d9ccb[_0xfb30('0x3d')]&&_0x4d9ccb[_0xfb30('0x3d')][0x0]?_0x4d9ccb[_0xfb30('0x3d')][0x0]['value']:undefined)||_0xfb30('0x44')},{'name':_0xfb30('0x45'),'value':_0x4d9ccb[_0xfb30('0x45')]||(_0x4d9ccb[_0xfb30('0x3d')]&&_0x4d9ccb[_0xfb30('0x3d')][0x1]?_0x4d9ccb[_0xfb30('0x3d')][0x1][_0xfb30('0x41')]:undefined)||_0xfb30('0x46')},{'name':_0xfb30('0x47'),'value':_0x4d9ccb[_0xfb30('0x47')]||(_0x4d9ccb[_0xfb30('0x3d')]&&_0x4d9ccb[_0xfb30('0x3d')][0x2]?_0x4d9ccb[_0xfb30('0x3d')][0x2][_0xfb30('0x41')]:undefined)||0xc}];case _0xfb30('0x48'):return[{'name':_0xfb30('0x49'),'value':_0x4d9ccb[_0xfb30('0x49')]||(_0x4d9ccb[_0xfb30('0x3d')]&&_0x4d9ccb[_0xfb30('0x3d')][0x0]?_0x4d9ccb[_0xfb30('0x3d')][0x0][_0xfb30('0x41')]:undefined)||_0xfb30('0x4a')},{'name':_0xfb30('0x4b'),'value':_0x4d9ccb['attrVoiceQueues']||(_0x4d9ccb[_0xfb30('0x3d')]&&_0x4d9ccb[_0xfb30('0x3d')][0x1]?_0x4d9ccb['attrs'][0x1][_0xfb30('0x41')]:undefined)||[]},{'name':_0xfb30('0x47'),'value':_0x4d9ccb[_0xfb30('0x47')]||(_0x4d9ccb[_0xfb30('0x3d')]&&_0x4d9ccb[_0xfb30('0x3d')][0x2]?_0x4d9ccb[_0xfb30('0x3d')][0x2][_0xfb30('0x41')]:undefined)||0x14}];case _0xfb30('0x4c'):case _0xfb30('0x4d'):return[{'name':_0xfb30('0x4e'),'value':_0x4d9ccb[_0xfb30('0x4e')]||(_0x4d9ccb['attrs']&&_0x4d9ccb['attrs'][0x0]?_0x4d9ccb['attrs'][0x0]['value']:undefined)||_0xfb30('0x4a')},{'name':_0xfb30('0x4f'),'value':_0x4d9ccb[_0xfb30('0x4f')]||(_0x4d9ccb['attrs']&&_0x4d9ccb[_0xfb30('0x3d')][0x1]?_0x4d9ccb[_0xfb30('0x3d')][0x1][_0xfb30('0x41')]:undefined)||null},{'name':_0xfb30('0x50'),'value':_0x4d9ccb['attrSerie3']||(_0x4d9ccb[_0xfb30('0x3d')]&&_0x4d9ccb['attrs'][0x2]?_0x4d9ccb[_0xfb30('0x3d')][0x2][_0xfb30('0x41')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x4d9ccb[_0xfb30('0x4b')]||(_0x4d9ccb[_0xfb30('0x3d')]&&_0x4d9ccb[_0xfb30('0x3d')][0x3]?_0x4d9ccb[_0xfb30('0x3d')][0x3][_0xfb30('0x41')]:undefined)||[]}];case'web-report':return[{'name':_0xfb30('0x51'),'type':_0x4d9ccb[_0xfb30('0x52')]||(_0x4d9ccb[_0xfb30('0x3d')]&&_0x4d9ccb[_0xfb30('0x3d')][0x0]?_0x4d9ccb[_0xfb30('0x3d')][0x0][_0xfb30('0x3a')]:undefined)||null,'value':_0x4d9ccb[_0xfb30('0x51')]||(_0x4d9ccb[_0xfb30('0x3d')]&&_0x4d9ccb['attrs'][0x0]?_0x4d9ccb[_0xfb30('0x3d')][0x0][_0xfb30('0x41')]:undefined)||null},{'name':'attrRefresh','value':_0x4d9ccb[_0xfb30('0x53')]||(_0x4d9ccb[_0xfb30('0x3d')]&&_0x4d9ccb[_0xfb30('0x3d')][0x1]?_0x4d9ccb[_0xfb30('0x3d')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x3af063){logger[_0xfb30('0x28')](_0xfb30('0x54'),JSON[_0xfb30('0x55')](_0x3af063));return[];}}exports[_0xfb30('0x56')]=function(_0x432af5,_0x58ca80){if(_0x432af5[_0xfb30('0x57')]){_0x432af5[_0xfb30('0x57')][_0xfb30('0x3d')]=widgetAttributes(_0x432af5[_0xfb30('0x57')]);}return db['DashboardItem']['create'](_0x432af5['body'],{})[_0xfb30('0x26')](respondWithResult(_0x58ca80,0xc9))['catch'](handleError(_0x58ca80,null));};exports[_0xfb30('0x25')]=function(_0x2b8cc7,_0x4ed641){if(_0x2b8cc7[_0xfb30('0x57')]['id']){delete _0x2b8cc7[_0xfb30('0x57')]['id'];}_0x2b8cc7[_0xfb30('0x57')]['attrs']=widgetAttributes(_0x2b8cc7[_0xfb30('0x57')]);return db[_0xfb30('0x2f')][_0xfb30('0x38')]({'where':{'id':_0x2b8cc7[_0xfb30('0x2d')]['id']}})['then'](handleEntityNotFound(_0x4ed641,null))[_0xfb30('0x26')](saveUpdates(_0x2b8cc7[_0xfb30('0x57')],null))[_0xfb30('0x26')](respondWithResult(_0x4ed641,null))['catch'](handleError(_0x4ed641,null));};
\ No newline at end of file
+var _0x5162=['widgetAttributes:\x20%s','body','create','params','html-pdf','request-promise','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../mysqldb','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','show','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','options','find','catch','type','iframe','attrUrl','attrs','https://','custom','value','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x5162,0x103));var _0x2516=function(_0x563db8,_0xd567f9){_0x563db8=_0x563db8-0x0;var _0x5b79ec=_0x5162[_0x563db8];return _0x5b79ec;};'use strict';var pdf=require(_0x2516('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2516('0x1'));var moment=require(_0x2516('0x2'));var BPromise=require(_0x2516('0x3'));var Mustache=require(_0x2516('0x4'));var util=require(_0x2516('0x5'));var path=require(_0x2516('0x6'));var sox=require(_0x2516('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x2516('0x8'));var crypto=require(_0x2516('0x9'));var jsforce=require(_0x2516('0xa'));var deskjs=require(_0x2516('0xb'));var toCsv=require(_0x2516('0xc'));var querystring=require(_0x2516('0xd'));var Papa=require(_0x2516('0xe'));var authService=require('../../components/auth/service');var hardwareService=require(_0x2516('0xf'));var Redis=require(_0x2516('0x10'));var qs=require(_0x2516('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x2516('0x12'))['db'];config[_0x2516('0x13')]=_[_0x2516('0x14')](config[_0x2516('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x2516('0x15'))(new Redis(config[_0x2516('0x13')]));require(_0x2516('0x16'))[_0x2516('0x17')](socket);function respondWithStatusCode(_0x42c771,_0x558d20){_0x558d20=_0x558d20||0xcc;return function(_0x3e5e0f){if(_0x3e5e0f){return _0x42c771[_0x2516('0x18')](_0x558d20);}return _0x42c771[_0x2516('0x19')](_0x558d20)[_0x2516('0x1a')]();};}function respondWithResult(_0x2637e8,_0x2ec31f){_0x2ec31f=_0x2ec31f||0xc8;return function(_0x19aacb){if(_0x19aacb){return _0x2637e8[_0x2516('0x19')](_0x2ec31f)[_0x2516('0x1b')](_0x19aacb);}};}function respondWithFilteredResult(_0x5623be,_0x1fdd73){return function(_0x1ced29){if(_0x1ced29){var _0x1a1005=_0x1ced29['count'],_0x564d05=_0x1fdd73[_0x2516('0x1c')],_0x1979d7=_0x1fdd73[_0x2516('0x1c')]+_0x1fdd73[_0x2516('0x1d')],_0x5e96c7;if(_0x1979d7>=_0x1a1005){_0x1979d7=_0x1a1005;_0x5e96c7=0xc8;}else{_0x5e96c7=0xce;}_0x5623be[_0x2516('0x19')](_0x5e96c7);return _0x5623be[_0x2516('0x1e')](_0x2516('0x1f'),_0x564d05+'-'+_0x1979d7+'/'+_0x1a1005)[_0x2516('0x1b')](_0x1ced29);}return null;};}function patchUpdates(_0x113616){return function(_0x248c5a){try{jsonpatch[_0x2516('0x20')](_0x248c5a,_0x113616,!![]);}catch(_0x39ba5b){return BPromise[_0x2516('0x21')](_0x39ba5b);}return _0x248c5a[_0x2516('0x22')]();};}function saveUpdates(_0x4fb7d9,_0x559a3e){return function(_0x12db4d){if(_0x12db4d){return _0x12db4d[_0x2516('0x23')](_0x4fb7d9)[_0x2516('0x24')](function(_0x2d5b1b){return _0x2d5b1b;});}return null;};}function removeEntity(_0x3ffb6d,_0x32de7a){return function(_0x3d906d){if(_0x3d906d){return _0x3d906d[_0x2516('0x25')]()['then'](function(){_0x3ffb6d[_0x2516('0x19')](0xcc)[_0x2516('0x1a')]();});}};}function handleEntityNotFound(_0x774b60,_0x434d54){return function(_0x47f4fb){if(!_0x47f4fb){_0x774b60[_0x2516('0x18')](0x194);}return _0x47f4fb;};}function handleError(_0x30eeb9,_0x1f722c){_0x1f722c=_0x1f722c||0x1f4;return function(_0x3d728a){logger[_0x2516('0x26')](_0x3d728a['stack']);if(_0x3d728a[_0x2516('0x27')]){delete _0x3d728a[_0x2516('0x27')];}_0x30eeb9[_0x2516('0x19')](_0x1f722c)[_0x2516('0x28')](_0x3d728a);};}exports[_0x2516('0x29')]=function(_0x285e67,_0x556f01){var _0x136893={'raw':![],'where':{'id':_0x285e67['params']['id']}},_0x20dc9f={};_0x20dc9f[_0x2516('0x2a')]=_[_0x2516('0x2b')](db[_0x2516('0x2c')][_0x2516('0x2d')]);_0x20dc9f[_0x2516('0x2e')]=_[_0x2516('0x2b')](_0x285e67[_0x2516('0x2e')]);_0x20dc9f[_0x2516('0x2f')]=_[_0x2516('0x30')](_0x20dc9f[_0x2516('0x2a')],_0x20dc9f[_0x2516('0x2e')]);_0x136893[_0x2516('0x31')]=_[_0x2516('0x30')](_0x20dc9f[_0x2516('0x2a')],qs[_0x2516('0x32')](_0x285e67['query'][_0x2516('0x32')]));_0x136893['attributes']=_0x136893[_0x2516('0x31')]['length']?_0x136893[_0x2516('0x31')]:_0x20dc9f['model'];if(_0x285e67[_0x2516('0x2e')][_0x2516('0x33')]){_0x136893[_0x2516('0x34')]=[{'all':!![]}];}_0x136893=_[_0x2516('0x35')]({},_0x136893,_0x285e67[_0x2516('0x36')]);return db[_0x2516('0x2c')][_0x2516('0x37')](_0x136893)[_0x2516('0x24')](handleEntityNotFound(_0x556f01,null))[_0x2516('0x24')](respondWithResult(_0x556f01,null))['catch'](handleError(_0x556f01,null));};exports[_0x2516('0x25')]=function(_0x4578c7,_0x3d7552){return db[_0x2516('0x2c')]['find']({'where':{'id':_0x4578c7['params']['id']}})[_0x2516('0x24')](handleEntityNotFound(_0x3d7552,null))[_0x2516('0x24')](removeEntity(_0x3d7552,null))[_0x2516('0x38')](handleError(_0x3d7552,null));};function widgetAttributes(_0x1d9b16){try{switch(_0x1d9b16[_0x2516('0x39')]){case _0x2516('0x3a'):return[{'name':_0x2516('0x3b'),'value':_0x1d9b16[_0x2516('0x3b')]||(_0x1d9b16[_0x2516('0x3c')]&&_0x1d9b16[_0x2516('0x3c')][0x0]?_0x1d9b16['attrs'][0x0]['value']:undefined)||_0x2516('0x3d')}];case _0x2516('0x3e'):return[{'name':'attrPath','value':_0x1d9b16['attrPath']||(_0x1d9b16[_0x2516('0x3c')]&&_0x1d9b16[_0x2516('0x3c')][0x0]?_0x1d9b16['attrs'][0x0][_0x2516('0x3f')]:undefined)||''}];case'clock':return[{'name':_0x2516('0x40'),'value':_0x1d9b16[_0x2516('0x40')]||(_0x1d9b16['attrs']&&_0x1d9b16[_0x2516('0x3c')][0x0]?_0x1d9b16[_0x2516('0x3c')][0x0][_0x2516('0x3f')]:undefined)||_0x2516('0x41')},{'name':_0x2516('0x42'),'value':_0x1d9b16[_0x2516('0x42')]||(_0x1d9b16[_0x2516('0x3c')]&&_0x1d9b16[_0x2516('0x3c')][0x1]?_0x1d9b16[_0x2516('0x3c')][0x1][_0x2516('0x3f')]:undefined)||_0x2516('0x43')},{'name':_0x2516('0x44'),'value':_0x1d9b16[_0x2516('0x44')]||(_0x1d9b16['attrs']&&_0x1d9b16[_0x2516('0x3c')][0x2]?_0x1d9b16[_0x2516('0x3c')][0x2]['value']:undefined)||0xc}];case _0x2516('0x45'):return[{'name':_0x2516('0x46'),'value':_0x1d9b16[_0x2516('0x46')]||(_0x1d9b16[_0x2516('0x3c')]&&_0x1d9b16[_0x2516('0x3c')][0x0]?_0x1d9b16['attrs'][0x0][_0x2516('0x3f')]:undefined)||_0x2516('0x47')},{'name':_0x2516('0x48'),'value':_0x1d9b16[_0x2516('0x48')]||(_0x1d9b16[_0x2516('0x3c')]&&_0x1d9b16[_0x2516('0x3c')][0x1]?_0x1d9b16['attrs'][0x1][_0x2516('0x3f')]:undefined)||[]},{'name':_0x2516('0x44'),'value':_0x1d9b16[_0x2516('0x44')]||(_0x1d9b16[_0x2516('0x3c')]&&_0x1d9b16[_0x2516('0x3c')][0x2]?_0x1d9b16[_0x2516('0x3c')][0x2][_0x2516('0x3f')]:undefined)||0x14}];case'multibar-chart':case _0x2516('0x49'):return[{'name':'attrSerie1','value':_0x1d9b16[_0x2516('0x4a')]||(_0x1d9b16['attrs']&&_0x1d9b16[_0x2516('0x3c')][0x0]?_0x1d9b16[_0x2516('0x3c')][0x0][_0x2516('0x3f')]:undefined)||'total'},{'name':'attrSerie2','value':_0x1d9b16[_0x2516('0x4b')]||(_0x1d9b16[_0x2516('0x3c')]&&_0x1d9b16['attrs'][0x1]?_0x1d9b16['attrs'][0x1][_0x2516('0x3f')]:undefined)||null},{'name':_0x2516('0x4c'),'value':_0x1d9b16[_0x2516('0x4c')]||(_0x1d9b16['attrs']&&_0x1d9b16[_0x2516('0x3c')][0x2]?_0x1d9b16['attrs'][0x2][_0x2516('0x3f')]:undefined)||null},{'name':_0x2516('0x48'),'value':_0x1d9b16[_0x2516('0x48')]||(_0x1d9b16[_0x2516('0x3c')]&&_0x1d9b16['attrs'][0x3]?_0x1d9b16[_0x2516('0x3c')][0x3][_0x2516('0x3f')]:undefined)||[]}];case _0x2516('0x4d'):return[{'name':_0x2516('0x4e'),'type':_0x1d9b16[_0x2516('0x4f')]||(_0x1d9b16['attrs']&&_0x1d9b16[_0x2516('0x3c')][0x0]?_0x1d9b16[_0x2516('0x3c')][0x0][_0x2516('0x39')]:undefined)||null,'value':_0x1d9b16[_0x2516('0x4e')]||(_0x1d9b16['attrs']&&_0x1d9b16[_0x2516('0x3c')][0x0]?_0x1d9b16[_0x2516('0x3c')][0x0][_0x2516('0x3f')]:undefined)||null},{'name':_0x2516('0x50'),'value':_0x1d9b16[_0x2516('0x50')]||(_0x1d9b16['attrs']&&_0x1d9b16[_0x2516('0x3c')][0x1]?_0x1d9b16[_0x2516('0x3c')][0x1][_0x2516('0x3f')]:undefined)||0x0}];default:return[];}}catch(_0x2810e8){logger[_0x2516('0x26')](_0x2516('0x51'),JSON['stringify'](_0x2810e8));return[];}}exports['create']=function(_0x54e8df,_0x323590){if(_0x54e8df['body']){_0x54e8df['body']['attrs']=widgetAttributes(_0x54e8df[_0x2516('0x52')]);}return db[_0x2516('0x2c')][_0x2516('0x53')](_0x54e8df[_0x2516('0x52')],{})[_0x2516('0x24')](respondWithResult(_0x323590,0xc9))['catch'](handleError(_0x323590,null));};exports[_0x2516('0x23')]=function(_0x32b432,_0x249ef8){if(_0x32b432['body']['id']){delete _0x32b432[_0x2516('0x52')]['id'];}_0x32b432[_0x2516('0x52')]['attrs']=widgetAttributes(_0x32b432[_0x2516('0x52')]);return db[_0x2516('0x2c')][_0x2516('0x37')]({'where':{'id':_0x32b432[_0x2516('0x54')]['id']}})[_0x2516('0x24')](handleEntityNotFound(_0x249ef8,null))['then'](saveUpdates(_0x32b432['body'],null))[_0x2516('0x24')](respondWithResult(_0x249ef8,null))['catch'](handleError(_0x249ef8,null));};
\ No newline at end of file
index 8aa1a64..0f1a6f3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf052=['../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xf052,0x1ae));var _0x2f05=function(_0xd93b26,_0x12bbf2){_0xd93b26=_0xd93b26-0x0;var _0x25f668=_0xf052[_0xd93b26];return _0x25f668;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x2f05('0x0'))['db'][_0x2f05('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x2f05('0x2')](0x0);var events={'afterCreate':_0x2f05('0x3'),'afterUpdate':_0x2f05('0x4'),'afterDestroy':_0x2f05('0x5')};function emitEvent(_0x1fc254){return function(_0x1b0985,_0x24eed4,_0x3afb13){DashboardItemEvents[_0x2f05('0x6')](_0x1fc254+':'+_0x1b0985['id'],_0x1b0985);DashboardItemEvents['emit'](_0x1fc254,_0x1b0985);_0x3afb13(null);};}for(var e in events){if(events[_0x2f05('0x7')](e)){var event=events[e];DashboardItem[_0x2f05('0x8')](e,emitEvent(event));}}module[_0x2f05('0x9')]=DashboardItemEvents;
\ No newline at end of file
+var _0x85b4=['update','emit','hook','exports','../../mysqldb','DashboardItem','save'];(function(_0x5a0201,_0x6a8032){var _0x2623dc=function(_0x58610e){while(--_0x58610e){_0x5a0201['push'](_0x5a0201['shift']());}};_0x2623dc(++_0x6a8032);}(_0x85b4,0x185));var _0x485b=function(_0x19fec1,_0x1cc62f){_0x19fec1=_0x19fec1-0x0;var _0x29cd35=_0x85b4[_0x19fec1];return _0x29cd35;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x485b('0x0'))['db'][_0x485b('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x485b('0x2'),'afterUpdate':_0x485b('0x3'),'afterDestroy':'remove'};function emitEvent(_0x31e4ee){return function(_0x1e3fe8,_0x143dd8,_0x3cc7bc){DashboardItemEvents[_0x485b('0x4')](_0x31e4ee+':'+_0x1e3fe8['id'],_0x1e3fe8);DashboardItemEvents[_0x485b('0x4')](_0x31e4ee,_0x1e3fe8);_0x3cc7bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x485b('0x5')](e,emitEvent(event));}}module[_0x485b('0x6')]=DashboardItemEvents;
\ No newline at end of file
index 9f88ac9..7f50d63 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['dashboard_items','lodash','util','../../config/logger','moment','bluebird','./dashboardItem.attributes','exports','define'];(function(_0x451d28,_0x1bca56){var _0x3a4497=function(_0x30bdb5){while(--_0x30bdb5){_0x451d28['push'](_0x451d28['shift']());}};_0x3a4497(++_0x1bca56);}(_0x7a54,0x106));var _0x47a5=function(_0x156646,_0x11389b){_0x156646=_0x156646-0x0;var _0x288041=_0x7a54[_0x156646];return _0x288041;};'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 attributes=require(_0x47a5('0x5'));module[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){return _0x2a1a7e[_0x47a5('0x7')]('DashboardItem',attributes,{'tableName':_0x47a5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x7a54=['dashboard_items','lodash','util','../../config/logger','moment','bluebird','./dashboardItem.attributes','exports','define'];(function(_0x229cfd,_0x3d7b4c){var _0x5621a3=function(_0x3d5e61){while(--_0x3d5e61){_0x229cfd['push'](_0x229cfd['shift']());}};_0x5621a3(++_0x3d7b4c);}(_0x7a54,0x106));var _0x47a5=function(_0x507330,_0x9b55aa){_0x507330=_0x507330-0x0;var _0x346a23=_0x7a54[_0x507330];return _0x346a23;};'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 attributes=require(_0x47a5('0x5'));module[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){return _0x2a1a7e[_0x47a5('0x7')]('DashboardItem',attributes,{'tableName':_0x47a5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 67cb17e..b9ad872 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc625=['jayson/promise','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5f1cf8,_0x5e0923){var _0x27d0fa=function(_0x3f1171){while(--_0x3f1171){_0x5f1cf8['push'](_0x5f1cf8['shift']());}};_0x27d0fa(++_0x5e0923);}(_0xc625,0xc0));var _0x5c62=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0xc625[_0xf79bae];return _0x5d2cb7;};'use strict';var _=require(_0x5c62('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5c62('0x1'));var fs=require('fs');var Redis=require(_0x5c62('0x2'));var db=require(_0x5c62('0x3'))['db'];var utils=require(_0x5c62('0x4'));var logger=require(_0x5c62('0x5'))(_0x5c62('0x6'));var config=require(_0x5c62('0x7'));var jayson=require(_0x5c62('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x5c62('0x9')]=_['defaults'](config['redis'],{'host':_0x5c62('0xa'),'port':0x18eb});var socket=require(_0x5c62('0xb'))(new Redis(config[_0x5c62('0x9')]));require(_0x5c62('0xc'))[_0x5c62('0xd')](socket);function respondWithRpcPromise(_0x163172,_0x58fac9,_0x574ebc){return new BPromise(function(_0x536fc4,_0x4a2fce){return client[_0x5c62('0xe')](_0x163172,_0x574ebc)[_0x5c62('0xf')](function(_0x38231c){logger['info'](_0x5c62('0x10'),_0x58fac9,_0x5c62('0x11'));logger[_0x5c62('0x12')](_0x5c62('0x13'),_0x58fac9,_0x5c62('0x11'),JSON[_0x5c62('0x14')](_0x38231c));if(_0x38231c[_0x5c62('0x15')]){if(_0x38231c[_0x5c62('0x15')]['code']===0x1f4){logger[_0x5c62('0x15')]('DashboardItem,\x20%s,\x20%s',_0x58fac9,_0x38231c[_0x5c62('0x15')][_0x5c62('0x16')]);return _0x4a2fce(_0x38231c[_0x5c62('0x15')][_0x5c62('0x16')]);}logger[_0x5c62('0x15')](_0x5c62('0x10'),_0x58fac9,_0x38231c[_0x5c62('0x15')]['message']);return _0x536fc4(_0x38231c[_0x5c62('0x15')][_0x5c62('0x16')]);}else{logger[_0x5c62('0x17')](_0x5c62('0x10'),_0x58fac9,'request\x20sent');_0x536fc4(_0x38231c[_0x5c62('0x18')]['message']);}})['catch'](function(_0x46588a){logger[_0x5c62('0x15')]('DashboardItem,\x20%s,\x20%s',_0x58fac9,_0x46588a);_0x4a2fce(_0x46588a);});});}
\ No newline at end of file
+var _0xc0f8=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','DashboardItem,\x20%s,\x20%s','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','util','moment'];(function(_0x3eef60,_0x9eb279){var _0x569efe=function(_0xe79c0c){while(--_0xe79c0c){_0x3eef60['push'](_0x3eef60['shift']());}};_0x569efe(++_0x9eb279);}(_0xc0f8,0x142));var _0x8c0f=function(_0x1c954a,_0x3e61ba){_0x1c954a=_0x1c954a-0x0;var _0xede993=_0xc0f8[_0x1c954a];return _0xede993;};'use strict';var _=require('lodash');var util=require(_0x8c0f('0x0'));var moment=require(_0x8c0f('0x1'));var BPromise=require(_0x8c0f('0x2'));var rs=require(_0x8c0f('0x3'));var fs=require('fs');var Redis=require(_0x8c0f('0x4'));var db=require(_0x8c0f('0x5'))['db'];var utils=require(_0x8c0f('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8c0f('0x7'));var jayson=require(_0x8c0f('0x8'));var client=jayson[_0x8c0f('0x9')][_0x8c0f('0xa')]({'port':0x232a});config[_0x8c0f('0xb')]=_[_0x8c0f('0xc')](config[_0x8c0f('0xb')],{'host':_0x8c0f('0xd'),'port':0x18eb});var socket=require(_0x8c0f('0xe'))(new Redis(config[_0x8c0f('0xb')]));require('./dashboardItem.socket')[_0x8c0f('0xf')](socket);function respondWithRpcPromise(_0x108722,_0x41e1f5,_0x54aa63){return new BPromise(function(_0x3bc453,_0x267ab1){return client[_0x8c0f('0x10')](_0x108722,_0x54aa63)[_0x8c0f('0x11')](function(_0x1809bd){logger['info'](_0x8c0f('0x12'),_0x41e1f5,'request\x20sent');logger['debug'](_0x8c0f('0x13'),_0x41e1f5,'request\x20sent',JSON[_0x8c0f('0x14')](_0x1809bd));if(_0x1809bd[_0x8c0f('0x15')]){if(_0x1809bd[_0x8c0f('0x15')]['code']===0x1f4){logger[_0x8c0f('0x15')](_0x8c0f('0x12'),_0x41e1f5,_0x1809bd[_0x8c0f('0x15')][_0x8c0f('0x16')]);return _0x267ab1(_0x1809bd[_0x8c0f('0x15')]['message']);}logger['error'](_0x8c0f('0x12'),_0x41e1f5,_0x1809bd[_0x8c0f('0x15')]['message']);return _0x3bc453(_0x1809bd['error'][_0x8c0f('0x16')]);}else{logger[_0x8c0f('0x17')]('DashboardItem,\x20%s,\x20%s',_0x41e1f5,_0x8c0f('0x18'));_0x3bc453(_0x1809bd[_0x8c0f('0x19')][_0x8c0f('0x16')]);}})[_0x8c0f('0x1a')](function(_0x43bd20){logger[_0x8c0f('0x15')](_0x8c0f('0x12'),_0x41e1f5,_0x43bd20);_0x267ab1(_0x43bd20);});});}
\ No newline at end of file
index c43167a..4b3d9a9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x34e8=['register','length','dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener'];(function(_0x20bc10,_0x35bed9){var _0x3bd5ce=function(_0x8d1e4c){while(--_0x8d1e4c){_0x20bc10['push'](_0x20bc10['shift']());}};_0x3bd5ce(++_0x35bed9);}(_0x34e8,0x12c));var _0x834e=function(_0xb0bd3c,_0x56e732){_0xb0bd3c=_0xb0bd3c-0x0;var _0x1582eb=_0x34e8[_0xb0bd3c];return _0x1582eb;};'use strict';var DashboardItemEvents=require(_0x834e('0x0'));var events=[_0x834e('0x1'),_0x834e('0x2'),_0x834e('0x3')];function createListener(_0x530939,_0x832422){return function(_0x21e2e0){_0x832422[_0x834e('0x4')](_0x530939,_0x21e2e0);};}function removeListener(_0x31bf20,_0x289ef2){return function(){DashboardItemEvents[_0x834e('0x5')](_0x31bf20,_0x289ef2);};}exports[_0x834e('0x6')]=function(_0x4a2018){for(var _0x858aa1=0x0,_0x52056d=events[_0x834e('0x7')];_0x858aa1<_0x52056d;_0x858aa1++){var _0x3cc2e3=events[_0x858aa1];var _0x3a3ef6=createListener(_0x834e('0x8')+_0x3cc2e3,_0x4a2018);DashboardItemEvents['on'](_0x3cc2e3,_0x3a3ef6);}};
\ No newline at end of file
+var _0x3e74=['emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','remove','update'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x3e74,0x175));var _0x43e7=function(_0x2a4051,_0x3e5b60){_0x2a4051=_0x2a4051-0x0;var _0x37cff1=_0x3e74[_0x2a4051];return _0x37cff1;};'use strict';var DashboardItemEvents=require(_0x43e7('0x0'));var events=['save',_0x43e7('0x1'),_0x43e7('0x2')];function createListener(_0x151ad2,_0x494e45){return function(_0x490ced){_0x494e45[_0x43e7('0x3')](_0x151ad2,_0x490ced);};}function removeListener(_0x4f9bbe,_0x128b0f){return function(){DashboardItemEvents[_0x43e7('0x4')](_0x4f9bbe,_0x128b0f);};}exports[_0x43e7('0x5')]=function(_0x1c503b){for(var _0xc98b9c=0x0,_0x503698=events[_0x43e7('0x6')];_0xc98b9c<_0x503698;_0xc98b9c++){var _0x3491d6=events[_0xc98b9c];var _0x2ede2d=createListener(_0x43e7('0x7')+_0x3491d6,_0x1c503b);DashboardItemEvents['on'](_0x3491d6,_0x2ede2d);}};
\ No newline at end of file
index 83750a3..ceea87c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x448c=['./dashboardItem.controller','get','/:id','isAuthenticated','show','post','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x50a004,_0x193d84){var _0x5e9992=function(_0x3c8c37){while(--_0x3c8c37){_0x50a004['push'](_0x50a004['shift']());}};_0x5e9992(++_0x193d84);}(_0x448c,0xf4));var _0xc448=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x448c[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require(_0xc448('0x0'));var path=require(_0xc448('0x1'));var timeout=require(_0xc448('0x2'));var express=require(_0xc448('0x3'));var router=express[_0xc448('0x4')]();var auth=require(_0xc448('0x5'));var interaction=require(_0xc448('0x6'));var config=require(_0xc448('0x7'));var controller=require(_0xc448('0x8'));router[_0xc448('0x9')](_0xc448('0xa'),auth[_0xc448('0xb')](),controller[_0xc448('0xc')]);router[_0xc448('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc448('0xe')](_0xc448('0xa'),auth[_0xc448('0xb')](),controller['update']);router[_0xc448('0xf')](_0xc448('0xa'),auth[_0xc448('0xb')](),controller[_0xc448('0x10')]);module[_0xc448('0x11')]=router;
\ No newline at end of file
+var _0xb861=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','/:id','show','isAuthenticated','create','destroy'];(function(_0x1ee913,_0x559807){var _0x54d60a=function(_0x3dcebe){while(--_0x3dcebe){_0x1ee913['push'](_0x1ee913['shift']());}};_0x54d60a(++_0x559807);}(_0xb861,0x1a5));var _0x1b86=function(_0xf5d71c,_0x2613a6){_0xf5d71c=_0xf5d71c-0x0;var _0x5af672=_0xb861[_0xf5d71c];return _0x5af672;};'use strict';var multer=require('multer');var util=require(_0x1b86('0x0'));var path=require(_0x1b86('0x1'));var timeout=require(_0x1b86('0x2'));var express=require(_0x1b86('0x3'));var router=express[_0x1b86('0x4')]();var auth=require(_0x1b86('0x5'));var interaction=require(_0x1b86('0x6'));var config=require('../../config/environment');var controller=require(_0x1b86('0x7'));router[_0x1b86('0x8')](_0x1b86('0x9'),auth['isAuthenticated'](),controller[_0x1b86('0xa')]);router['post']('/',auth[_0x1b86('0xb')](),controller[_0x1b86('0xc')]);router['put'](_0x1b86('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x1b86('0x9'),auth['isAuthenticated'](),controller[_0x1b86('0xd')]);module[_0x1b86('0xe')]=router;
\ No newline at end of file
index e9dc207..8693589 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x35ef=['exports','STRING','sequelize'];(function(_0x51706b,_0x25efcb){var _0x5433db=function(_0x4150cc){while(--_0x4150cc){_0x51706b['push'](_0x51706b['shift']());}};_0x5433db(++_0x25efcb);}(_0x35ef,0x176));var _0xf35e=function(_0x15f8cc,_0x277506){_0x15f8cc=_0x15f8cc-0x0;var _0x526e05=_0x35ef[_0x15f8cc];return _0x526e05;};'use strict';var Sequelize=require(_0xf35e('0x0'));module[_0xf35e('0x1')]={'name':{'type':Sequelize[_0xf35e('0x2')],'allowNull':![]}};
\ No newline at end of file
+var _0x119c=['exports'];(function(_0x19d8ee,_0x4f2778){var _0x17cca8=function(_0x562449){while(--_0x562449){_0x19d8ee['push'](_0x19d8ee['shift']());}};_0x17cca8(++_0x4f2778);}(_0x119c,0xea));var _0xc119=function(_0x452630,_0x1c0fc4){_0x452630=_0x452630-0x0;var _0x31ebec=_0x119c[_0x452630];return _0x31ebec;};'use strict';var Sequelize=require('sequelize');module[_0xc119('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]}};
\ No newline at end of file
index cee1c59..91e8a96 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x053f=['sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','Dispositions','UserProfileResource','name','send','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','type','key','field','Disposition','includeAll','include','rows','params','rawAttributes','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','api','../../config/utils'];(function(_0x496689,_0x1a71ea){var _0x1a3f4b=function(_0x576a0f){while(--_0x576a0f){_0x496689['push'](_0x496689['shift']());}};_0x1a3f4b(++_0x1a71ea);}(_0x053f,0x7d));var _0xf053=function(_0x196a3f,_0x3f9435){_0x196a3f=_0x196a3f-0x0;var _0x44f004=_0x053f[_0x196a3f];return _0x44f004;};'use strict';var pdf=require(_0xf053('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf053('0x1'));var zipdir=require(_0xf053('0x2'));var jsonpatch=require(_0xf053('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf053('0x4'));var util=require(_0xf053('0x5'));var path=require(_0xf053('0x6'));var sox=require(_0xf053('0x7'));var csv=require('to-csv');var ejs=require(_0xf053('0x8'));var fs=require('fs');var _=require(_0xf053('0x9'));var squel=require(_0xf053('0xa'));var crypto=require(_0xf053('0xb'));var jsforce=require(_0xf053('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf053('0xd'));var querystring=require(_0xf053('0xe'));var Papa=require(_0xf053('0xf'));var authService=require(_0xf053('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xf053('0x11'));var utils=require(_0xf053('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f2a0c,_0x4bd8ba){_0x4bd8ba=_0x4bd8ba||0xcc;return function(_0x3b40d2){if(_0x3b40d2){return _0x5f2a0c[_0xf053('0x13')](_0x4bd8ba);}return _0x5f2a0c['status'](_0x4bd8ba)[_0xf053('0x14')]();};}function respondWithResult(_0x15d94c,_0x1e6711){_0x1e6711=_0x1e6711||0xc8;return function(_0x573b4c){if(_0x573b4c){return _0x15d94c[_0xf053('0x15')](_0x1e6711)[_0xf053('0x16')](_0x573b4c);}};}function respondWithFilteredResult(_0x188464,_0x114f63){return function(_0x4688ae){if(_0x4688ae){var _0x2a798a=_0x4688ae[_0xf053('0x17')],_0x3204c2=_0x114f63[_0xf053('0x18')],_0x5e97f6=_0x114f63[_0xf053('0x18')]+_0x114f63[_0xf053('0x19')],_0x1aab71;if(_0x5e97f6>=_0x2a798a){_0x5e97f6=_0x2a798a;_0x1aab71=0xc8;}else{_0x1aab71=0xce;}_0x188464['status'](_0x1aab71);return _0x188464[_0xf053('0x1a')](_0xf053('0x1b'),_0x3204c2+'-'+_0x5e97f6+'/'+_0x2a798a)['json'](_0x4688ae);}return null;};}function patchUpdates(_0x2b6efa){return function(_0x5b0bd7){try{jsonpatch['apply'](_0x5b0bd7,_0x2b6efa,!![]);}catch(_0xf1bf25){return BPromise[_0xf053('0x1c')](_0xf1bf25);}return _0x5b0bd7[_0xf053('0x1d')]();};}function saveUpdates(_0x13d3a9,_0xcdb29a){return function(_0x3901b0){if(_0x3901b0){return _0x3901b0[_0xf053('0x1e')](_0x13d3a9)[_0xf053('0x1f')](function(_0x3abe34){return _0x3abe34;});}return null;};}function removeEntity(_0x11b3d,_0x1fbf35){return function(_0x179dcc){if(_0x179dcc){return _0x179dcc[_0xf053('0x20')]()[_0xf053('0x1f')](function(){var _0x45c3e0=_0x179dcc['get']({'plain':!![]});var _0x378c1a=_0xf053('0x21');return db[_0xf053('0x22')]['destroy']({'where':{'type':_0x378c1a,'resourceId':_0x45c3e0['id']}})[_0xf053('0x1f')](function(){return _0x179dcc;});})['then'](function(){_0x11b3d[_0xf053('0x15')](0xcc)[_0xf053('0x14')]();});}};}function handleEntityNotFound(_0x2f8813,_0x23adc9){return function(_0x23bc0a){if(!_0x23bc0a){_0x2f8813[_0xf053('0x13')](0x194);}return _0x23bc0a;};}function handleError(_0x2d6e50,_0x247484){_0x247484=_0x247484||0x1f4;return function(_0x24f86f){logger['error'](_0x24f86f['stack']);if(_0x24f86f['name']){delete _0x24f86f[_0xf053('0x23')];}_0x2d6e50[_0xf053('0x15')](_0x247484)[_0xf053('0x24')](_0x24f86f);};}exports['index']=function(_0x108d3f,_0x206878){var _0x2bdad4={},_0x131021={},_0x44cdf7={'count':0x0,'rows':[]};var _0x5d728d=db['Disposition']['rawAttributes'];_0x131021[_0xf053('0x25')]=_[_0xf053('0x26')](_0x5d728d);_0x131021[_0xf053('0x27')]=_[_0xf053('0x26')](_0x108d3f[_0xf053('0x27')]);_0x131021[_0xf053('0x28')]=_[_0xf053('0x29')](_0x131021[_0xf053('0x25')],_0x131021[_0xf053('0x27')]);_0x2bdad4[_0xf053('0x2a')]=_[_0xf053('0x29')](_0x131021[_0xf053('0x25')],qs['fields'](_0x108d3f[_0xf053('0x27')][_0xf053('0x2b')]));_0x2bdad4[_0xf053('0x2a')]=_0x2bdad4[_0xf053('0x2a')][_0xf053('0x2c')]?_0x2bdad4[_0xf053('0x2a')]:_0x131021[_0xf053('0x25')];if(!_0x108d3f['query']['hasOwnProperty']('nolimit')){_0x2bdad4[_0xf053('0x19')]=qs['limit'](_0x108d3f['query'][_0xf053('0x19')]);_0x2bdad4['offset']=qs[_0xf053('0x18')](_0x108d3f[_0xf053('0x27')]['offset']);}_0x2bdad4[_0xf053('0x2d')]=qs[_0xf053('0x2e')](_0x108d3f['query']['sort']);_0x2bdad4[_0xf053('0x2f')]=qs[_0xf053('0x28')](_['pick'](_0x108d3f[_0xf053('0x27')],_0x131021[_0xf053('0x28')]));if(_0x108d3f[_0xf053('0x27')][_0xf053('0x30')]){_0x2bdad4[_0xf053('0x2f')]=_[_0xf053('0x31')](_0x2bdad4[_0xf053('0x2f')],{'$or':_['map'](_0x5d728d,function(_0x62d308){if(_0x62d308[_0xf053('0x32')][_0xf053('0x33')]!=='VIRTUAL'){var _0x3f4c47={};_0x3f4c47[_0x62d308[_0xf053('0x34')]]={'$like':'%'+_0x108d3f[_0xf053('0x27')]['filter']+'%'};return _0x3f4c47;}})});}_0x2bdad4=_['merge']({},_0x2bdad4,_0x108d3f['options']);var _0x5de38b={'where':_0x2bdad4[_0xf053('0x2f')]};return db[_0xf053('0x35')][_0xf053('0x17')](_0x5de38b)[_0xf053('0x1f')](function(_0x479104){_0x44cdf7[_0xf053('0x17')]=_0x479104;if(_0x108d3f['query'][_0xf053('0x36')]){_0x2bdad4[_0xf053('0x37')]=[{'all':!![]}];}return db[_0xf053('0x35')]['findAll'](_0x2bdad4);})[_0xf053('0x1f')](function(_0x3bf2fb){_0x44cdf7[_0xf053('0x38')]=_0x3bf2fb;return _0x44cdf7;})[_0xf053('0x1f')](respondWithFilteredResult(_0x206878,_0x2bdad4))['catch'](handleError(_0x206878,null));};exports['show']=function(_0x261c34,_0x5332b4){var _0x3f60ec={'raw':!![],'where':{'id':_0x261c34[_0xf053('0x39')]['id']}},_0x4c7d0c={};_0x4c7d0c[_0xf053('0x25')]=_['keys'](db[_0xf053('0x35')][_0xf053('0x3a')]);_0x4c7d0c[_0xf053('0x27')]=_[_0xf053('0x26')](_0x261c34['query']);_0x4c7d0c[_0xf053('0x28')]=_['intersection'](_0x4c7d0c['model'],_0x4c7d0c['query']);_0x3f60ec[_0xf053('0x2a')]=_[_0xf053('0x29')](_0x4c7d0c[_0xf053('0x25')],qs[_0xf053('0x2b')](_0x261c34['query']['fields']));_0x3f60ec[_0xf053('0x2a')]=_0x3f60ec[_0xf053('0x2a')][_0xf053('0x2c')]?_0x3f60ec[_0xf053('0x2a')]:_0x4c7d0c[_0xf053('0x25')];if(_0x261c34['query'][_0xf053('0x36')]){_0x3f60ec[_0xf053('0x37')]=[{'all':!![]}];}_0x3f60ec=_[_0xf053('0x31')]({},_0x3f60ec,_0x261c34[_0xf053('0x3b')]);return db[_0xf053('0x35')][_0xf053('0x3c')](_0x3f60ec)[_0xf053('0x1f')](handleEntityNotFound(_0x5332b4,null))[_0xf053('0x1f')](respondWithResult(_0x5332b4,null))[_0xf053('0x3d')](handleError(_0x5332b4,null));};exports[_0xf053('0x3e')]=function(_0x5084cd,_0x235358){return db['Disposition'][_0xf053('0x3e')](_0x5084cd[_0xf053('0x3f')],{})['then'](function(_0xcf1b33){var _0x216118=_0x5084cd[_0xf053('0x40')][_0xf053('0x41')]({'plain':!![]});if(!_0x216118)throw new Error(_0xf053('0x42'));if(_0x216118[_0xf053('0x43')]===_0xf053('0x40')){var _0x277239=_0xcf1b33[_0xf053('0x41')]({'plain':!![]});var _0x414477=_0xf053('0x21');return db[_0xf053('0x44')][_0xf053('0x3c')]({'where':{'name':_0x414477,'userProfileId':_0x216118[_0xf053('0x45')]},'raw':!![]})[_0xf053('0x1f')](function(_0x2df0a2){if(_0x2df0a2&&_0x2df0a2['autoAssociation']===0x0){return db[_0xf053('0x22')][_0xf053('0x3e')]({'name':_0x277239[_0xf053('0x23')],'resourceId':_0x277239['id'],'type':_0x2df0a2[_0xf053('0x23')],'sectionId':_0x2df0a2['id']},{})[_0xf053('0x1f')](function(){return _0xcf1b33;});}else{return _0xcf1b33;}})['catch'](function(_0x265e00){logger[_0xf053('0x46')](_0xf053('0x47'),_0x265e00);throw _0x265e00;});}return _0xcf1b33;})[_0xf053('0x1f')](respondWithResult(_0x235358,0xc9))[_0xf053('0x3d')](handleError(_0x235358,null));};exports[_0xf053('0x1e')]=function(_0x342cde,_0x2ebdcb){if(_0x342cde['body']['id']){delete _0x342cde[_0xf053('0x3f')]['id'];}return db[_0xf053('0x35')][_0xf053('0x3c')]({'where':{'id':_0x342cde['params']['id']}})[_0xf053('0x1f')](handleEntityNotFound(_0x2ebdcb,null))[_0xf053('0x1f')](saveUpdates(_0x342cde[_0xf053('0x3f')],null))['then'](respondWithResult(_0x2ebdcb,null))['catch'](handleError(_0x2ebdcb,null));};exports[_0xf053('0x20')]=function(_0x5cbf21,_0x57e7d3){return db[_0xf053('0x35')][_0xf053('0x3c')]({'where':{'id':_0x5cbf21[_0xf053('0x39')]['id']}})[_0xf053('0x1f')](handleEntityNotFound(_0x57e7d3,null))[_0xf053('0x1f')](removeEntity(_0x57e7d3,null))[_0xf053('0x3d')](handleError(_0x57e7d3,null));};
\ No newline at end of file
+var _0xfd9e=['params','fields','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','UserProfileSection','find','autoAssociation','catch','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','Disposition','rawAttributes','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','map','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','show'];(function(_0x224301,_0x4012fb){var _0x336252=function(_0x559f62){while(--_0x559f62){_0x224301['push'](_0x224301['shift']());}};_0x336252(++_0x4012fb);}(_0xfd9e,0x15d));var _0xefd9=function(_0x2a168c,_0x1ec031){_0x2a168c=_0x2a168c-0x0;var _0x34f7ad=_0xfd9e[_0x2a168c];return _0x34f7ad;};'use strict';var pdf=require(_0xefd9('0x0'));var emlformat=require(_0xefd9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xefd9('0x2'));var jsonpatch=require(_0xefd9('0x3'));var rp=require(_0xefd9('0x4'));var moment=require(_0xefd9('0x5'));var BPromise=require(_0xefd9('0x6'));var Mustache=require(_0xefd9('0x7'));var util=require(_0xefd9('0x8'));var path=require(_0xefd9('0x9'));var sox=require(_0xefd9('0xa'));var csv=require(_0xefd9('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xefd9('0xc'));var squel=require(_0xefd9('0xd'));var crypto=require(_0xefd9('0xe'));var jsforce=require(_0xefd9('0xf'));var deskjs=require(_0xefd9('0x10'));var toCsv=require(_0xefd9('0xb'));var querystring=require(_0xefd9('0x11'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0xefd9('0x12'));var Redis=require(_0xefd9('0x13'));var qs=require(_0xefd9('0x14'));var logger=require('../../config/logger')(_0xefd9('0x15'));var utils=require(_0xefd9('0x16'));var config=require(_0xefd9('0x17'));var db=require(_0xefd9('0x18'))['db'];function respondWithStatusCode(_0x1fb481,_0x3a9183){_0x3a9183=_0x3a9183||0xcc;return function(_0x479dbb){if(_0x479dbb){return _0x1fb481[_0xefd9('0x19')](_0x3a9183);}return _0x1fb481[_0xefd9('0x1a')](_0x3a9183)[_0xefd9('0x1b')]();};}function respondWithResult(_0x151f3a,_0x396ba0){_0x396ba0=_0x396ba0||0xc8;return function(_0x5973a8){if(_0x5973a8){return _0x151f3a[_0xefd9('0x1a')](_0x396ba0)[_0xefd9('0x1c')](_0x5973a8);}};}function respondWithFilteredResult(_0x35a32c,_0x4d8301){return function(_0x5d25c9){if(_0x5d25c9){var _0x28a2f9=_0x5d25c9[_0xefd9('0x1d')],_0x5df146=_0x4d8301[_0xefd9('0x1e')],_0x3939ef=_0x4d8301[_0xefd9('0x1e')]+_0x4d8301['limit'],_0x3bb0c0;if(_0x3939ef>=_0x28a2f9){_0x3939ef=_0x28a2f9;_0x3bb0c0=0xc8;}else{_0x3bb0c0=0xce;}_0x35a32c[_0xefd9('0x1a')](_0x3bb0c0);return _0x35a32c[_0xefd9('0x1f')]('Content-Range',_0x5df146+'-'+_0x3939ef+'/'+_0x28a2f9)['json'](_0x5d25c9);}return null;};}function patchUpdates(_0x38d8b1){return function(_0x4d51b1){try{jsonpatch[_0xefd9('0x20')](_0x4d51b1,_0x38d8b1,!![]);}catch(_0x3c0f03){return BPromise[_0xefd9('0x21')](_0x3c0f03);}return _0x4d51b1['save']();};}function saveUpdates(_0x264b99,_0x40a2da){return function(_0x44984e){if(_0x44984e){return _0x44984e[_0xefd9('0x22')](_0x264b99)[_0xefd9('0x23')](function(_0x19b0d5){return _0x19b0d5;});}return null;};}function removeEntity(_0x22e6a1,_0x5b8c62){return function(_0xc82b85){if(_0xc82b85){return _0xc82b85[_0xefd9('0x24')]()[_0xefd9('0x23')](function(){var _0x45fb62=_0xc82b85[_0xefd9('0x25')]({'plain':!![]});var _0x4988dc='Dispositions';return db[_0xefd9('0x26')][_0xefd9('0x24')]({'where':{'type':_0x4988dc,'resourceId':_0x45fb62['id']}})['then'](function(){return _0xc82b85;});})[_0xefd9('0x23')](function(){_0x22e6a1['status'](0xcc)[_0xefd9('0x1b')]();});}};}function handleEntityNotFound(_0x329286,_0xe48420){return function(_0x5dd248){if(!_0x5dd248){_0x329286['sendStatus'](0x194);}return _0x5dd248;};}function handleError(_0x1c1c9e,_0x4e921d){_0x4e921d=_0x4e921d||0x1f4;return function(_0x3d320e){logger[_0xefd9('0x27')](_0x3d320e[_0xefd9('0x28')]);if(_0x3d320e[_0xefd9('0x29')]){delete _0x3d320e[_0xefd9('0x29')];}_0x1c1c9e[_0xefd9('0x1a')](_0x4e921d)[_0xefd9('0x2a')](_0x3d320e);};}exports[_0xefd9('0x2b')]=function(_0x1a4895,_0x50e8c8){var _0x1f81c2={},_0x4b7b0e={},_0x63fef7={'count':0x0,'rows':[]};var _0x112524=db[_0xefd9('0x2c')][_0xefd9('0x2d')];_0x4b7b0e[_0xefd9('0x2e')]=_[_0xefd9('0x2f')](_0x112524);_0x4b7b0e[_0xefd9('0x30')]=_[_0xefd9('0x2f')](_0x1a4895[_0xefd9('0x30')]);_0x4b7b0e[_0xefd9('0x31')]=_[_0xefd9('0x32')](_0x4b7b0e[_0xefd9('0x2e')],_0x4b7b0e[_0xefd9('0x30')]);_0x1f81c2[_0xefd9('0x33')]=_[_0xefd9('0x32')](_0x4b7b0e[_0xefd9('0x2e')],qs['fields'](_0x1a4895[_0xefd9('0x30')]['fields']));_0x1f81c2['attributes']=_0x1f81c2['attributes'][_0xefd9('0x34')]?_0x1f81c2[_0xefd9('0x33')]:_0x4b7b0e['model'];if(!_0x1a4895[_0xefd9('0x30')][_0xefd9('0x35')](_0xefd9('0x36'))){_0x1f81c2[_0xefd9('0x37')]=qs[_0xefd9('0x37')](_0x1a4895[_0xefd9('0x30')]['limit']);_0x1f81c2[_0xefd9('0x1e')]=qs[_0xefd9('0x1e')](_0x1a4895[_0xefd9('0x30')][_0xefd9('0x1e')]);}_0x1f81c2[_0xefd9('0x38')]=qs[_0xefd9('0x39')](_0x1a4895['query'][_0xefd9('0x39')]);_0x1f81c2['where']=qs[_0xefd9('0x31')](_['pick'](_0x1a4895['query'],_0x4b7b0e[_0xefd9('0x31')]));if(_0x1a4895[_0xefd9('0x30')][_0xefd9('0x3a')]){_0x1f81c2[_0xefd9('0x3b')]=_['merge'](_0x1f81c2[_0xefd9('0x3b')],{'$or':_[_0xefd9('0x3c')](_0x112524,function(_0x13c612){if(_0x13c612[_0xefd9('0x3d')][_0xefd9('0x3e')]!==_0xefd9('0x3f')){var _0x966c76={};_0x966c76[_0x13c612[_0xefd9('0x40')]]={'$like':'%'+_0x1a4895[_0xefd9('0x30')][_0xefd9('0x3a')]+'%'};return _0x966c76;}})});}_0x1f81c2=_['merge']({},_0x1f81c2,_0x1a4895[_0xefd9('0x41')]);var _0x584669={'where':_0x1f81c2['where']};return db[_0xefd9('0x2c')][_0xefd9('0x1d')](_0x584669)[_0xefd9('0x23')](function(_0x4c4e2e){_0x63fef7[_0xefd9('0x1d')]=_0x4c4e2e;if(_0x1a4895[_0xefd9('0x30')][_0xefd9('0x42')]){_0x1f81c2[_0xefd9('0x43')]=[{'all':!![]}];}return db['Disposition'][_0xefd9('0x44')](_0x1f81c2);})[_0xefd9('0x23')](function(_0x5559de){_0x63fef7[_0xefd9('0x45')]=_0x5559de;return _0x63fef7;})['then'](respondWithFilteredResult(_0x50e8c8,_0x1f81c2))['catch'](handleError(_0x50e8c8,null));};exports[_0xefd9('0x46')]=function(_0x427ba4,_0x1acc8a){var _0xf7b202={'raw':!![],'where':{'id':_0x427ba4[_0xefd9('0x47')]['id']}},_0x4eefab={};_0x4eefab[_0xefd9('0x2e')]=_[_0xefd9('0x2f')](db[_0xefd9('0x2c')]['rawAttributes']);_0x4eefab[_0xefd9('0x30')]=_[_0xefd9('0x2f')](_0x427ba4['query']);_0x4eefab[_0xefd9('0x31')]=_[_0xefd9('0x32')](_0x4eefab[_0xefd9('0x2e')],_0x4eefab['query']);_0xf7b202['attributes']=_['intersection'](_0x4eefab[_0xefd9('0x2e')],qs[_0xefd9('0x48')](_0x427ba4['query'][_0xefd9('0x48')]));_0xf7b202[_0xefd9('0x33')]=_0xf7b202[_0xefd9('0x33')][_0xefd9('0x34')]?_0xf7b202[_0xefd9('0x33')]:_0x4eefab[_0xefd9('0x2e')];if(_0x427ba4[_0xefd9('0x30')][_0xefd9('0x42')]){_0xf7b202[_0xefd9('0x43')]=[{'all':!![]}];}_0xf7b202=_[_0xefd9('0x49')]({},_0xf7b202,_0x427ba4['options']);return db['Disposition']['find'](_0xf7b202)[_0xefd9('0x23')](handleEntityNotFound(_0x1acc8a,null))[_0xefd9('0x23')](respondWithResult(_0x1acc8a,null))['catch'](handleError(_0x1acc8a,null));};exports[_0xefd9('0x4a')]=function(_0x277f07,_0x31ce63){return db['Disposition'][_0xefd9('0x4a')](_0x277f07[_0xefd9('0x4b')],{})[_0xefd9('0x23')](function(_0x1ef98f){var _0x576bea=_0x277f07[_0xefd9('0x4c')]['get']({'plain':!![]});if(!_0x576bea)throw new Error(_0xefd9('0x4d'));if(_0x576bea[_0xefd9('0x4e')]==='user'){var _0x790cbf=_0x1ef98f['get']({'plain':!![]});var _0x116441=_0xefd9('0x4f');return db[_0xefd9('0x50')][_0xefd9('0x51')]({'where':{'name':_0x116441,'userProfileId':_0x576bea['userProfileId']},'raw':!![]})['then'](function(_0xa12464){if(_0xa12464&&_0xa12464[_0xefd9('0x52')]===0x0){return db[_0xefd9('0x26')]['create']({'name':_0x790cbf[_0xefd9('0x29')],'resourceId':_0x790cbf['id'],'type':_0xa12464[_0xefd9('0x29')],'sectionId':_0xa12464['id']},{})[_0xefd9('0x23')](function(){return _0x1ef98f;});}else{return _0x1ef98f;}})[_0xefd9('0x53')](function(_0x4b1706){logger[_0xefd9('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b1706);throw _0x4b1706;});}return _0x1ef98f;})[_0xefd9('0x23')](respondWithResult(_0x31ce63,0xc9))[_0xefd9('0x53')](handleError(_0x31ce63,null));};exports[_0xefd9('0x22')]=function(_0xfc7d25,_0x1fca9f){if(_0xfc7d25[_0xefd9('0x4b')]['id']){delete _0xfc7d25['body']['id'];}return db[_0xefd9('0x2c')][_0xefd9('0x51')]({'where':{'id':_0xfc7d25['params']['id']}})['then'](handleEntityNotFound(_0x1fca9f,null))[_0xefd9('0x23')](saveUpdates(_0xfc7d25[_0xefd9('0x4b')],null))[_0xefd9('0x23')](respondWithResult(_0x1fca9f,null))['catch'](handleError(_0x1fca9f,null));};exports[_0xefd9('0x24')]=function(_0x130399,_0x5b51ba){return db['Disposition'][_0xefd9('0x51')]({'where':{'id':_0x130399['params']['id']}})[_0xefd9('0x23')](handleEntityNotFound(_0x5b51ba,null))[_0xefd9('0x23')](removeEntity(_0x5b51ba,null))['catch'](handleError(_0x5b51ba,null));};
\ No newline at end of file
index 260eac2..addb4f7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1a85=['ListId','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','../../config/logger','api','moment','./disposition.attributes','exports','define','tools_dispositions','name'];(function(_0x3d3f34,_0x492872){var _0x49ed33=function(_0x48e194){while(--_0x48e194){_0x3d3f34['push'](_0x3d3f34['shift']());}};_0x49ed33(++_0x492872);}(_0x1a85,0x178));var _0x51a8=function(_0x5e7cf2,_0x1d3e7c){_0x5e7cf2=_0x5e7cf2-0x0;var _0x412b1a=_0x1a85[_0x5e7cf2];return _0x412b1a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x51a8('0x0'))(_0x51a8('0x1'));var moment=require(_0x51a8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x51a8('0x3'));module[_0x51a8('0x4')]=function(_0x99e371,_0x48a21b){return _0x99e371[_0x51a8('0x5')]('Disposition',attributes,{'tableName':_0x51a8('0x6'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x51a8('0x7'),_0x51a8('0x8')]},{'unique':!![],'name':'name_chat','fields':[_0x51a8('0x7'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0x51a8('0x7'),_0x51a8('0x9')]},{'unique':!![],'name':_0x51a8('0xa'),'fields':[_0x51a8('0x7'),_0x51a8('0xb')]},{'unique':!![],'name':_0x51a8('0xc'),'fields':[_0x51a8('0x7'),_0x51a8('0xd')]},{'unique':!![],'name':_0x51a8('0xe'),'fields':[_0x51a8('0x7'),_0x51a8('0xf')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x0b0e=['Disposition','tools_dispositions','name_voice','name_chat','name','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','lodash','../../config/logger','moment','bluebird','request-promise','./disposition.attributes','exports','define'];(function(_0x59a149,_0x20d60d){var _0x1583f4=function(_0x4e56d7){while(--_0x4e56d7){_0x59a149['push'](_0x59a149['shift']());}};_0x1583f4(++_0x20d60d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5bff0,_0x20716d){_0x5bff0=_0x5bff0-0x0;var _0x3ead2e=_0x0b0e[_0x5bff0];return _0x3ead2e;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var logger=require(_0xe0b0('0x1'))('api');var moment=require(_0xe0b0('0x2'));var BPromise=require(_0xe0b0('0x3'));var rp=require(_0xe0b0('0x4'));var attributes=require(_0xe0b0('0x5'));module[_0xe0b0('0x6')]=function(_0x38a058,_0x399e67){return _0x38a058[_0xe0b0('0x7')](_0xe0b0('0x8'),attributes,{'tableName':_0xe0b0('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xe0b0('0xa'),'fields':['name','ListId']},{'unique':!![],'name':_0xe0b0('0xb'),'fields':[_0xe0b0('0xc'),_0xe0b0('0xd')]},{'unique':!![],'name':_0xe0b0('0xe'),'fields':['name',_0xe0b0('0xf')]},{'unique':!![],'name':_0xe0b0('0x10'),'fields':['name',_0xe0b0('0x11')]},{'unique':!![],'name':_0xe0b0('0x12'),'fields':['name',_0xe0b0('0x13')]},{'unique':!![],'name':_0xe0b0('0x14'),'fields':[_0xe0b0('0xc'),'OpenchannelAccountId']}],'timestamps':!![]});};
\ No newline at end of file
index 2277da3..db3c2dc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4fb4=['../../config/environment','jayson/promise','client','http','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x3924fb,_0x114f18){var _0x3eb46a=function(_0x310cbb){while(--_0x310cbb){_0x3924fb['push'](_0x3924fb['shift']());}};_0x3eb46a(++_0x114f18);}(_0x4fb4,0x190));var _0x44fb=function(_0x1705ee,_0x491db1){_0x1705ee=_0x1705ee-0x0;var _0x62613f=_0x4fb4[_0x1705ee];return _0x62613f;};'use strict';var _=require('lodash');var util=require(_0x44fb('0x0'));var moment=require(_0x44fb('0x1'));var BPromise=require(_0x44fb('0x2'));var rs=require(_0x44fb('0x3'));var fs=require('fs');var Redis=require(_0x44fb('0x4'));var db=require(_0x44fb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x44fb('0x6'))(_0x44fb('0x7'));var config=require(_0x44fb('0x8'));var jayson=require(_0x44fb('0x9'));var client=jayson[_0x44fb('0xa')][_0x44fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x464af5,_0x2a4d75,_0x59aa6d){return new BPromise(function(_0x87f716,_0xd4ead0){return client['request'](_0x464af5,_0x59aa6d)[_0x44fb('0xc')](function(_0x3d9002){logger[_0x44fb('0xd')](_0x44fb('0xe'),_0x2a4d75,_0x44fb('0xf'));logger[_0x44fb('0x10')](_0x44fb('0x11'),_0x2a4d75,_0x44fb('0xf'),JSON[_0x44fb('0x12')](_0x3d9002));if(_0x3d9002[_0x44fb('0x13')]){if(_0x3d9002['error'][_0x44fb('0x14')]===0x1f4){logger[_0x44fb('0x13')](_0x44fb('0xe'),_0x2a4d75,_0x3d9002[_0x44fb('0x13')][_0x44fb('0x15')]);return _0xd4ead0(_0x3d9002['error'][_0x44fb('0x15')]);}logger[_0x44fb('0x13')](_0x44fb('0xe'),_0x2a4d75,_0x3d9002[_0x44fb('0x13')][_0x44fb('0x15')]);return _0x87f716(_0x3d9002['error'][_0x44fb('0x15')]);}else{logger[_0x44fb('0xd')](_0x44fb('0xe'),_0x2a4d75,_0x44fb('0xf'));_0x87f716(_0x3d9002[_0x44fb('0x16')][_0x44fb('0x15')]);}})[_0x44fb('0x17')](function(_0x585559){logger[_0x44fb('0x13')](_0x44fb('0xe'),_0x2a4d75,_0x585559);_0xd4ead0(_0x585559);});});}
\ No newline at end of file
+var _0xfd20=['result','catch','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','Disposition,\x20%s,\x20%s','message'];(function(_0x185342,_0x34a038){var _0x11bf11=function(_0x39b35a){while(--_0x39b35a){_0x185342['push'](_0x185342['shift']());}};_0x11bf11(++_0x34a038);}(_0xfd20,0x66));var _0x0fd2=function(_0xb7b722,_0xe95ba7){_0xb7b722=_0xb7b722-0x0;var _0x217177=_0xfd20[_0xb7b722];return _0x217177;};'use strict';var _=require('lodash');var util=require(_0x0fd2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0fd2('0x1'));var fs=require('fs');var Redis=require(_0x0fd2('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0fd2('0x3'));var logger=require('../../config/logger')(_0x0fd2('0x4'));var config=require(_0x0fd2('0x5'));var jayson=require(_0x0fd2('0x6'));var client=jayson[_0x0fd2('0x7')][_0x0fd2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d114c,_0x55467b,_0x32d460){return new BPromise(function(_0x15ba86,_0x24d6f4){return client[_0x0fd2('0x9')](_0x4d114c,_0x32d460)[_0x0fd2('0xa')](function(_0x195948){logger[_0x0fd2('0xb')]('Disposition,\x20%s,\x20%s',_0x55467b,_0x0fd2('0xc'));logger[_0x0fd2('0xd')]('Disposition,\x20%s,\x20%s,\x20%s',_0x55467b,_0x0fd2('0xc'),JSON['stringify'](_0x195948));if(_0x195948[_0x0fd2('0xe')]){if(_0x195948[_0x0fd2('0xe')][_0x0fd2('0xf')]===0x1f4){logger[_0x0fd2('0xe')](_0x0fd2('0x10'),_0x55467b,_0x195948[_0x0fd2('0xe')][_0x0fd2('0x11')]);return _0x24d6f4(_0x195948[_0x0fd2('0xe')]['message']);}logger['error'](_0x0fd2('0x10'),_0x55467b,_0x195948[_0x0fd2('0xe')][_0x0fd2('0x11')]);return _0x15ba86(_0x195948[_0x0fd2('0xe')]['message']);}else{logger[_0x0fd2('0xb')]('Disposition,\x20%s,\x20%s',_0x55467b,'request\x20sent');_0x15ba86(_0x195948[_0x0fd2('0x12')]['message']);}})[_0x0fd2('0x13')](function(_0x55e070){logger[_0x0fd2('0xe')]('Disposition,\x20%s,\x20%s',_0x55467b,_0x55e070);_0x24d6f4(_0x55e070);});});}
\ No newline at end of file
index 8297676..2bfe711 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x11cb=['show','put','update','delete','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./disposition.controller','get','isAuthenticated','index','/:id'];(function(_0x8eb4eb,_0xa70079){var _0x1ff8e3=function(_0x1e118e){while(--_0x1e118e){_0x8eb4eb['push'](_0x8eb4eb['shift']());}};_0x1ff8e3(++_0xa70079);}(_0x11cb,0xe4));var _0xb11c=function(_0x44feea,_0xa915cd){_0x44feea=_0x44feea-0x0;var _0x3b3b9c=_0x11cb[_0x44feea];return _0x3b3b9c;};'use strict';var multer=require(_0xb11c('0x0'));var util=require('util');var path=require(_0xb11c('0x1'));var timeout=require(_0xb11c('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xb11c('0x3'));var interaction=require(_0xb11c('0x4'));var config=require('../../config/environment');var controller=require(_0xb11c('0x5'));router[_0xb11c('0x6')]('/',auth[_0xb11c('0x7')](),controller[_0xb11c('0x8')]);router[_0xb11c('0x6')](_0xb11c('0x9'),auth[_0xb11c('0x7')](),controller[_0xb11c('0xa')]);router['post']('/',auth[_0xb11c('0x7')](),controller['create']);router[_0xb11c('0xb')](_0xb11c('0x9'),auth['isAuthenticated'](),controller[_0xb11c('0xc')]);router[_0xb11c('0xd')](_0xb11c('0x9'),auth[_0xb11c('0x7')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
+var _0x107f=['path','connect-timeout','express','Router','../../config/environment','./disposition.controller','get','isAuthenticated','/:id','post','create','put','delete','destroy','multer'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x107f,0xfe));var _0xf107=function(_0x2dcf4b,_0x2b2f19){_0x2dcf4b=_0x2dcf4b-0x0;var _0x21ca9b=_0x107f[_0x2dcf4b];return _0x21ca9b;};'use strict';var multer=require(_0xf107('0x0'));var util=require('util');var path=require(_0xf107('0x1'));var timeout=require(_0xf107('0x2'));var express=require(_0xf107('0x3'));var router=express[_0xf107('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf107('0x5'));var controller=require(_0xf107('0x6'));router[_0xf107('0x7')]('/',auth[_0xf107('0x8')](),controller['index']);router[_0xf107('0x7')](_0xf107('0x9'),auth[_0xf107('0x8')](),controller['show']);router[_0xf107('0xa')]('/',auth['isAuthenticated'](),controller[_0xf107('0xb')]);router[_0xf107('0xc')](_0xf107('0x9'),auth[_0xf107('0x8')](),controller['update']);router[_0xf107('0xd')](_0xf107('0x9'),auth[_0xf107('0x8')](),controller[_0xf107('0xe')]);module['exports']=router;
\ No newline at end of file
index ebea2f8..6f0f52d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x84e3=['2400','4800','7200','9600','12000','14400','INTEGER','SIP','IAX','DADHI','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','exports','STRING','ENUM','yes','localstationid'];(function(_0x58c5f8,_0x1ed0d4){var _0x30bba8=function(_0x2e8263){while(--_0x2e8263){_0x58c5f8['push'](_0x58c5f8['shift']());}};_0x30bba8(++_0x1ed0d4);}(_0x84e3,0x1f2));var _0x384e=function(_0x3889ae,_0x4770c3){_0x3889ae=_0x3889ae-0x0;var _0x6533dd=_0x84e3[_0x3889ae];return _0x6533dd;};'use strict';var Sequelize=require(_0x384e('0x0'));module[_0x384e('0x1')]={'name':{'type':Sequelize[_0x384e('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x384e('0x2')]},'ecm':{'type':Sequelize[_0x384e('0x3')](_0x384e('0x4'),'no'),'defaultValue':_0x384e('0x4')},'headerinfo':{'type':Sequelize[_0x384e('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x384e('0x2')],'unique':_0x384e('0x5')},'minrate':{'type':Sequelize['ENUM'](_0x384e('0x6'),_0x384e('0x7'),_0x384e('0x8'),_0x384e('0x9'),_0x384e('0xa'),_0x384e('0xb')),'defaultValue':_0x384e('0x7')},'maxrate':{'type':Sequelize[_0x384e('0x3')](_0x384e('0x6'),_0x384e('0x7'),_0x384e('0x8'),_0x384e('0x9'),_0x384e('0xa'),_0x384e('0xb')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x384e('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x384e('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x384e('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x384e('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x384e('0x3')](_0x384e('0xd'),_0x384e('0xe'),_0x384e('0xf'),'KHOMP'),'defaultValue':_0x384e('0xd')},'key':{'type':Sequelize[_0x384e('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x384e('0x10')],'defaultValue':function(){return _0x384e('0x11');}},'notificationSound':{'type':Sequelize[_0x384e('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x384e('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x384e('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x384e('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x384e('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x384e('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x384e('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x384e('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x384e('0x12')],'defaultValue':![],'comment':_0x384e('0x14'),'set':function(_0x237abf){if(!_0x237abf)this[_0x384e('0x15')](_0x384e('0x16'),null);this[_0x384e('0x15')](_0x384e('0x17'),_0x237abf);}}};
\ No newline at end of file
+var _0xdfd6=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','12000','14400','2400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','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'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdfd6,0xfc));var _0x6dfd=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xdfd6[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0x6dfd('0x0'));module[_0x6dfd('0x1')]={'name':{'type':Sequelize[_0x6dfd('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6dfd('0x2')]},'ecm':{'type':Sequelize[_0x6dfd('0x3')](_0x6dfd('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x6dfd('0x2')],'defaultValue':_0x6dfd('0x5')},'localstationid':{'type':Sequelize[_0x6dfd('0x2')],'unique':_0x6dfd('0x6')},'minrate':{'type':Sequelize['ENUM']('2400',_0x6dfd('0x7'),'7200','9600',_0x6dfd('0x8'),_0x6dfd('0x9')),'defaultValue':_0x6dfd('0x7')},'maxrate':{'type':Sequelize[_0x6dfd('0x3')](_0x6dfd('0xa'),_0x6dfd('0x7'),'7200','9600','12000',_0x6dfd('0x9')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x6dfd('0x2')],'defaultValue':_0x6dfd('0xb')},'gateway':{'type':Sequelize[_0x6dfd('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x6dfd('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x6dfd('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x6dfd('0xd'),_0x6dfd('0xe'),_0x6dfd('0xf'),_0x6dfd('0x10')),'defaultValue':_0x6dfd('0xd')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6dfd('0x11')],'defaultValue':function(){return _0x6dfd('0x12');}},'notificationSound':{'type':Sequelize[_0x6dfd('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6dfd('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6dfd('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6dfd('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6dfd('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6dfd('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x6dfd('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x6dfd('0x13')],'defaultValue':![],'comment':_0x6dfd('0x15'),'set':function(_0x14297c){if(!_0x14297c)this[_0x6dfd('0x16')](_0x6dfd('0x17'),null);this['setDataValue'](_0x6dfd('0x18'),_0x14297c);}}};
\ No newline at end of file
index 3632859..8398b31 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9dc6=['Owner','fullname','internal','Tag','color','tag','sequelize','transaction','FaxApplication','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','Set','ecm','faxdetect','headerinfo','maxrate','minrate','t38timeout','/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','addAccountApplications','VoiceExtension','bulkCreate','updateAccountApplications','tech','key','createdAt','TrunkId','ListId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','path','isNil','from','fax','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../config/license/hardware','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','http','client','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','map','type','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','user','get','role','UserProfileSection','userProfileId','params','describe','addDisposition','FaxAccountId','Disposition','findOne','length','order','filter','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','User'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9dc6,0x1c7));var _0x69dc=function(_0x68debf,_0x9561d8){_0x68debf=_0x68debf-0x0;var _0x7f3eae=_0x9dc6[_0x68debf];return _0x7f3eae;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x69dc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x69dc('0x1'));var jsonpatch=require(_0x69dc('0x2'));var rp=require('request-promise');var moment=require(_0x69dc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x69dc('0x4'));var util=require('util');var path=require('path');var sox=require(_0x69dc('0x5'));var csv=require(_0x69dc('0x6'));var ejs=require(_0x69dc('0x7'));var fs=require('fs');var _=require(_0x69dc('0x8'));var squel=require(_0x69dc('0x9'));var crypto=require(_0x69dc('0xa'));var jsforce=require(_0x69dc('0xb'));var deskjs=require(_0x69dc('0xc'));var toCsv=require(_0x69dc('0x6'));var querystring=require('querystring');var Papa=require(_0x69dc('0xd'));var authService=require('../../components/auth/service');var hardwareService=require(_0x69dc('0xe'));var Redis=require('ioredis');var qs=require(_0x69dc('0xf'));var logger=require(_0x69dc('0x10'))('api');var utils=require(_0x69dc('0x11'));var config=require(_0x69dc('0x12'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x69dc('0x13')](config[_0x69dc('0x14')],{'host':_0x69dc('0x15'),'port':0x18eb});var socket=require(_0x69dc('0x16'))(new Redis(config[_0x69dc('0x14')]));require(_0x69dc('0x17'))['register'](socket);var jayson=require(_0x69dc('0x18'));var client=jayson['client'][_0x69dc('0x19')]({'port':0x232c});var client9002=jayson[_0x69dc('0x1a')][_0x69dc('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4e4813,_0x178660,_0x25ecd1,_0x179113){return new BPromise(function(_0x20facb,_0x3f51fe){var _0x143687=_0x179113||client;return _0x143687['request'](_0x4e4813,_0x25ecd1)[_0x69dc('0x1b')](function(_0x5b2f84){logger[_0x69dc('0x1c')](_0x69dc('0x1d'),_0x178660,_0x69dc('0x1e'));logger['debug'](_0x69dc('0x1f'),_0x178660,_0x69dc('0x1e'),JSON['stringify'](_0x5b2f84));if(_0x5b2f84['error']){if(_0x5b2f84[_0x69dc('0x20')][_0x69dc('0x21')]===0x1f4){logger[_0x69dc('0x20')](_0x69dc('0x1d'),_0x178660,_0x5b2f84[_0x69dc('0x20')][_0x69dc('0x22')]);return _0x3f51fe(_0x5b2f84['error']['message']);}logger[_0x69dc('0x20')](_0x69dc('0x1d'),_0x178660,_0x5b2f84[_0x69dc('0x20')][_0x69dc('0x22')]);return _0x20facb(_0x5b2f84['error'][_0x69dc('0x22')]);}else{logger[_0x69dc('0x1c')](_0x69dc('0x1d'),_0x178660,'request\x20sent');_0x20facb(_0x5b2f84[_0x69dc('0x23')][_0x69dc('0x22')]);}})[_0x69dc('0x24')](function(_0x5c9432){logger[_0x69dc('0x20')]('FaxAccount,\x20%s,\x20%s',_0x178660,_0x5c9432);_0x3f51fe(_0x5c9432);});});}function respondWithStatusCode(_0x39e0ff,_0x401da8){_0x401da8=_0x401da8||0xcc;return function(_0x1fe6d2){if(_0x1fe6d2){return _0x39e0ff[_0x69dc('0x25')](_0x401da8);}return _0x39e0ff['status'](_0x401da8)[_0x69dc('0x26')]();};}function respondWithResult(_0x31a049,_0x378ef0){_0x378ef0=_0x378ef0||0xc8;return function(_0x5ebe28){if(_0x5ebe28){return _0x31a049[_0x69dc('0x27')](_0x378ef0)[_0x69dc('0x28')](_0x5ebe28);}};}function respondWithFilteredResult(_0x2b13d3,_0x24fb44){return function(_0x47641b){if(_0x47641b){var _0x5eef9b=_0x47641b[_0x69dc('0x29')],_0x303b55=_0x24fb44[_0x69dc('0x2a')],_0x4bcdc3=_0x24fb44[_0x69dc('0x2a')]+_0x24fb44[_0x69dc('0x2b')],_0x2e2551;if(_0x4bcdc3>=_0x5eef9b){_0x4bcdc3=_0x5eef9b;_0x2e2551=0xc8;}else{_0x2e2551=0xce;}_0x2b13d3[_0x69dc('0x27')](_0x2e2551);return _0x2b13d3[_0x69dc('0x2c')](_0x69dc('0x2d'),_0x303b55+'-'+_0x4bcdc3+'/'+_0x5eef9b)[_0x69dc('0x28')](_0x47641b);}return null;};}function patchUpdates(_0x21d4b6){return function(_0x384075){try{jsonpatch[_0x69dc('0x2e')](_0x384075,_0x21d4b6,!![]);}catch(_0x36df7b){return BPromise[_0x69dc('0x2f')](_0x36df7b);}return _0x384075[_0x69dc('0x30')]();};}function saveUpdates(_0x1e1ea3,_0x2acbb6){return function(_0xb8a7bb){if(_0xb8a7bb){return _0xb8a7bb[_0x69dc('0x31')](_0x1e1ea3)[_0x69dc('0x1b')](function(_0x4e8f2e){return _0x4e8f2e;});}return null;};}function removeEntity(_0x1d336e,_0x59eeb5){return function(_0x53749e){if(_0x53749e){return _0x53749e[_0x69dc('0x32')]()[_0x69dc('0x1b')](function(){var _0x2481fc=_0x53749e['get']({'plain':!![]});var _0x16e8ca=_0x69dc('0x33');return db[_0x69dc('0x34')][_0x69dc('0x32')]({'where':{'type':_0x16e8ca,'resourceId':_0x2481fc['id']}})[_0x69dc('0x1b')](function(){return _0x53749e;});})['then'](function(){_0x1d336e[_0x69dc('0x27')](0xcc)[_0x69dc('0x26')]();});}};}function handleEntityNotFound(_0x33b138,_0x787f8d){return function(_0x246d5f){if(!_0x246d5f){_0x33b138[_0x69dc('0x25')](0x194);}return _0x246d5f;};}function handleError(_0xc7c30,_0x447e81){_0x447e81=_0x447e81||0x1f4;return function(_0x16a02c){logger[_0x69dc('0x20')](_0x16a02c[_0x69dc('0x35')]);if(_0x16a02c[_0x69dc('0x36')]){delete _0x16a02c[_0x69dc('0x36')];}_0xc7c30['status'](_0x447e81)[_0x69dc('0x37')](_0x16a02c);};}exports[_0x69dc('0x38')]=function(_0x4cdc23,_0x27e644){var _0x168ee3={'include':[{'model':db[_0x69dc('0x39')],'as':_0x69dc('0x3a')}]},_0x4a564e={},_0x33d110={'count':0x0,'rows':[]};var _0x55cd36=db[_0x69dc('0x3b')][_0x69dc('0x3c')];_0x4a564e['model']=_[_0x69dc('0x3d')](_0x55cd36);_0x4a564e[_0x69dc('0x3e')]=_[_0x69dc('0x3d')](_0x4cdc23['query']);_0x4a564e[_0x69dc('0x3f')]=_[_0x69dc('0x40')](_0x4a564e[_0x69dc('0x41')],_0x4a564e[_0x69dc('0x3e')]);_0x168ee3[_0x69dc('0x42')]=_[_0x69dc('0x40')](_0x4a564e[_0x69dc('0x41')],qs[_0x69dc('0x43')](_0x4cdc23[_0x69dc('0x3e')][_0x69dc('0x43')]));_0x168ee3[_0x69dc('0x42')]=_0x168ee3[_0x69dc('0x42')]['length']?_0x168ee3[_0x69dc('0x42')]:_0x4a564e[_0x69dc('0x41')];if(!_0x4cdc23[_0x69dc('0x3e')][_0x69dc('0x44')](_0x69dc('0x45'))){_0x168ee3[_0x69dc('0x2b')]=qs[_0x69dc('0x2b')](_0x4cdc23[_0x69dc('0x3e')]['limit']);_0x168ee3[_0x69dc('0x2a')]=qs[_0x69dc('0x2a')](_0x4cdc23[_0x69dc('0x3e')][_0x69dc('0x2a')]);}_0x168ee3['order']=qs[_0x69dc('0x46')](_0x4cdc23[_0x69dc('0x3e')][_0x69dc('0x46')]);_0x168ee3[_0x69dc('0x47')]=qs[_0x69dc('0x3f')](_[_0x69dc('0x48')](_0x4cdc23[_0x69dc('0x3e')],_0x4a564e[_0x69dc('0x3f')]));if(_0x4cdc23[_0x69dc('0x3e')]['filter']){_0x168ee3[_0x69dc('0x47')]=_[_0x69dc('0x49')](_0x168ee3[_0x69dc('0x47')],{'$or':_[_0x69dc('0x4a')](_0x55cd36,function(_0x5f4e5c){if(_0x5f4e5c[_0x69dc('0x4b')]['key']!==_0x69dc('0x4c')){var _0x226333={};_0x226333[_0x5f4e5c['field']]={'$like':'%'+_0x4cdc23[_0x69dc('0x3e')]['filter']+'%'};return _0x226333;}})});}_0x168ee3=_[_0x69dc('0x49')]({},_0x168ee3,_0x4cdc23[_0x69dc('0x4d')]);var _0x5a6623={'where':_0x168ee3['where']};return db[_0x69dc('0x3b')]['count'](_0x5a6623)[_0x69dc('0x1b')](function(_0x5af030){_0x33d110[_0x69dc('0x29')]=_0x5af030;if(_0x4cdc23[_0x69dc('0x3e')][_0x69dc('0x4e')]){_0x168ee3[_0x69dc('0x4f')]=[{'all':!![]}];}return db[_0x69dc('0x3b')][_0x69dc('0x50')](_0x168ee3);})[_0x69dc('0x1b')](function(_0xc9ff3a){_0x33d110[_0x69dc('0x51')]=_0xc9ff3a;return _0x33d110;})[_0x69dc('0x1b')](respondWithFilteredResult(_0x27e644,_0x168ee3))[_0x69dc('0x24')](handleError(_0x27e644,null));};exports[_0x69dc('0x52')]=function(_0x210b76,_0x275399){var _0x30e8a8={'raw':![],'where':{'id':_0x210b76['params']['id']},'include':[{'model':db['Pause'],'as':_0x69dc('0x3a')}]},_0x41f584={};_0x41f584['model']=_[_0x69dc('0x3d')](db[_0x69dc('0x3b')][_0x69dc('0x3c')]);_0x41f584[_0x69dc('0x3e')]=_[_0x69dc('0x3d')](_0x210b76[_0x69dc('0x3e')]);_0x41f584[_0x69dc('0x3f')]=_[_0x69dc('0x40')](_0x41f584['model'],_0x41f584[_0x69dc('0x3e')]);_0x30e8a8[_0x69dc('0x42')]=_[_0x69dc('0x40')](_0x41f584[_0x69dc('0x41')],qs[_0x69dc('0x43')](_0x210b76[_0x69dc('0x3e')][_0x69dc('0x43')]));_0x30e8a8[_0x69dc('0x42')]=_0x30e8a8[_0x69dc('0x42')]['length']?_0x30e8a8[_0x69dc('0x42')]:_0x41f584[_0x69dc('0x41')];if(_0x210b76[_0x69dc('0x3e')]['includeAll']){_0x30e8a8[_0x69dc('0x4f')]=[{'all':!![]}];}_0x30e8a8=_[_0x69dc('0x49')]({},_0x30e8a8,_0x210b76[_0x69dc('0x4d')]);return db[_0x69dc('0x3b')][_0x69dc('0x53')](_0x30e8a8)['then'](handleEntityNotFound(_0x275399,null))['then'](respondWithResult(_0x275399,null))[_0x69dc('0x24')](handleError(_0x275399,null));};exports[_0x69dc('0x54')]=function(_0x16b681,_0x4fb676){return db[_0x69dc('0x3b')][_0x69dc('0x54')](_0x16b681[_0x69dc('0x55')],{})['then'](function(_0x379221){var _0x3b1c86=_0x16b681[_0x69dc('0x56')][_0x69dc('0x57')]({'plain':!![]});if(!_0x3b1c86)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b1c86[_0x69dc('0x58')]===_0x69dc('0x56')){var _0x3d77c4=_0x379221['get']({'plain':!![]});var _0x5efe3a='FaxAccounts';return db[_0x69dc('0x59')][_0x69dc('0x53')]({'where':{'name':_0x5efe3a,'userProfileId':_0x3b1c86[_0x69dc('0x5a')]},'raw':!![]})[_0x69dc('0x1b')](function(_0x4b8d0c){if(_0x4b8d0c&&_0x4b8d0c['autoAssociation']===0x0){return db[_0x69dc('0x34')][_0x69dc('0x54')]({'name':_0x3d77c4[_0x69dc('0x36')],'resourceId':_0x3d77c4['id'],'type':_0x4b8d0c[_0x69dc('0x36')],'sectionId':_0x4b8d0c['id']},{})[_0x69dc('0x1b')](function(){return _0x379221;});}else{return _0x379221;}})[_0x69dc('0x24')](function(_0x44a98b){logger[_0x69dc('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44a98b);throw _0x44a98b;});}return _0x379221;})['then'](respondWithResult(_0x4fb676,0xc9))[_0x69dc('0x24')](handleError(_0x4fb676,null));};exports[_0x69dc('0x31')]=function(_0x5beb47,_0x1a4862){if(_0x5beb47[_0x69dc('0x55')]['id']){delete _0x5beb47[_0x69dc('0x55')]['id'];}return db[_0x69dc('0x3b')][_0x69dc('0x53')]({'where':{'id':_0x5beb47[_0x69dc('0x5b')]['id']},'include':[{'model':db[_0x69dc('0x39')],'as':_0x69dc('0x3a')}]})['then'](handleEntityNotFound(_0x1a4862,null))['then'](saveUpdates(_0x5beb47[_0x69dc('0x55')],null))[_0x69dc('0x1b')](function(_0x554d41){if(_0x554d41&&_0x5beb47['body'][_0x69dc('0x3a')]){return db[_0x69dc('0x39')][_0x69dc('0x31')](_0x5beb47[_0x69dc('0x55')][_0x69dc('0x3a')],{'where':{'FaxAccountId':_0x554d41['id']}})['then'](function(){return _0x554d41;});}return _0x554d41;})['then'](respondWithResult(_0x1a4862,null))['catch'](handleError(_0x1a4862,null));};exports['destroy']=function(_0x5cd02c,_0x1f5809){return db[_0x69dc('0x3b')][_0x69dc('0x53')]({'where':{'id':_0x5cd02c['params']['id']}})[_0x69dc('0x1b')](handleEntityNotFound(_0x1f5809,null))[_0x69dc('0x1b')](removeEntity(_0x1f5809,null))[_0x69dc('0x24')](handleError(_0x1f5809,null));};exports['describe']=function(_0x1ebfbc,_0x3910a6){return db[_0x69dc('0x3b')][_0x69dc('0x5c')]()[_0x69dc('0x1b')](respondWithResult(_0x3910a6,null))[_0x69dc('0x24')](handleError(_0x3910a6,null));};exports[_0x69dc('0x5d')]=function(_0x55ec98,_0x11f78d,_0x4de465){if(_0x55ec98[_0x69dc('0x55')]['id']){delete _0x55ec98[_0x69dc('0x55')]['id'];}return db[_0x69dc('0x3b')]['find']({'where':{'id':_0x55ec98[_0x69dc('0x5b')]['id']}})['then'](handleEntityNotFound(_0x11f78d,null))['then'](function(_0x55fea5){if(_0x55fea5){_0x55ec98['body'][_0x69dc('0x5e')]=_0x55fea5['id'];return db[_0x69dc('0x5f')][_0x69dc('0x54')](_0x55ec98[_0x69dc('0x55')]);}})[_0x69dc('0x1b')](respondWithResult(_0x11f78d,null))[_0x69dc('0x24')](handleError(_0x11f78d,null));};exports['getDispositions']=function(_0x44b1c9,_0x28cfa4,_0x165366){var _0x2c7d7a={'raw':![],'where':{}};var _0x1aebd5={};var _0x5db24e={'count':0x0,'rows':[]};return db['FaxAccount'][_0x69dc('0x60')]({'where':{'id':_0x44b1c9['params']['id']}})['then'](handleEntityNotFound(_0x28cfa4,null))[_0x69dc('0x1b')](function(_0x396389){if(_0x396389){_0x1aebd5[_0x69dc('0x41')]=_[_0x69dc('0x3d')](db[_0x69dc('0x5f')][_0x69dc('0x3c')]);_0x1aebd5[_0x69dc('0x3e')]=_[_0x69dc('0x3d')](_0x44b1c9['query']);_0x1aebd5['filters']=_['intersection'](_0x1aebd5[_0x69dc('0x41')],_0x1aebd5[_0x69dc('0x3e')]);_0x2c7d7a[_0x69dc('0x42')]=_[_0x69dc('0x40')](_0x1aebd5[_0x69dc('0x41')],qs['fields'](_0x44b1c9[_0x69dc('0x3e')]['fields']));_0x2c7d7a[_0x69dc('0x42')]=_0x2c7d7a[_0x69dc('0x42')][_0x69dc('0x61')]?_0x2c7d7a[_0x69dc('0x42')]:_0x1aebd5[_0x69dc('0x41')];if(!_0x44b1c9[_0x69dc('0x3e')][_0x69dc('0x44')]('nolimit')){_0x2c7d7a[_0x69dc('0x2b')]=qs['limit'](_0x44b1c9[_0x69dc('0x3e')][_0x69dc('0x2b')]);_0x2c7d7a[_0x69dc('0x2a')]=qs[_0x69dc('0x2a')](_0x44b1c9[_0x69dc('0x3e')][_0x69dc('0x2a')]);}_0x2c7d7a[_0x69dc('0x62')]=qs[_0x69dc('0x46')](_0x44b1c9[_0x69dc('0x3e')][_0x69dc('0x46')]);_0x2c7d7a[_0x69dc('0x47')]=qs['filters'](_[_0x69dc('0x48')](_0x44b1c9['query'],_0x1aebd5[_0x69dc('0x3f')]));_0x2c7d7a[_0x69dc('0x47')][_0x69dc('0x5e')]=_0x396389['id'];if(_0x44b1c9['query'][_0x69dc('0x63')]){_0x2c7d7a['where']=_[_0x69dc('0x49')](_0x2c7d7a['where'],{'$or':_[_0x69dc('0x4a')](_0x2c7d7a[_0x69dc('0x42')],function(_0x52a9d9){var _0x26d9d8={};_0x26d9d8[_0x52a9d9]={'$like':'%'+_0x44b1c9['query'][_0x69dc('0x63')]+'%'};return _0x26d9d8;})});}_0x2c7d7a=_[_0x69dc('0x49')]({},_0x2c7d7a,_0x44b1c9[_0x69dc('0x4d')]);return db[_0x69dc('0x5f')][_0x69dc('0x29')]({'where':_0x2c7d7a['where']})[_0x69dc('0x1b')](function(_0x18a9ed){_0x5db24e[_0x69dc('0x29')]=_0x18a9ed;if(_0x44b1c9['query'][_0x69dc('0x4e')]){_0x2c7d7a['include']=[{'all':!![]}];}return db[_0x69dc('0x5f')]['findAll'](_0x2c7d7a);})[_0x69dc('0x1b')](function(_0x174c03){_0x5db24e[_0x69dc('0x51')]=_0x174c03;return _0x5db24e;});}})[_0x69dc('0x1b')](respondWithFilteredResult(_0x28cfa4,_0x2c7d7a))[_0x69dc('0x24')](handleError(_0x28cfa4,null));};exports[_0x69dc('0x64')]=function(_0x23232b,_0x56d36d,_0xdc9354){var _0x2f840c;return db[_0x69dc('0x3b')]['find']({'where':{'id':_0x23232b['params']['id']}})[_0x69dc('0x1b')](handleEntityNotFound(_0x56d36d,null))[_0x69dc('0x1b')](function(_0x1cd795){if(_0x1cd795){return _0x1cd795[_0x69dc('0x64')](_0x23232b[_0x69dc('0x3e')][_0x69dc('0x65')]);}})['then'](respondWithStatusCode(_0x56d36d,null))[_0x69dc('0x24')](handleError(_0x56d36d,null));};exports[_0x69dc('0x66')]=function(_0x41cc2d,_0xa26989,_0x586af2){if(_0x41cc2d[_0x69dc('0x55')]['id']){delete _0x41cc2d[_0x69dc('0x55')]['id'];}return db[_0x69dc('0x3b')][_0x69dc('0x53')]({'where':{'id':_0x41cc2d['params']['id']}})[_0x69dc('0x1b')](handleEntityNotFound(_0xa26989,null))[_0x69dc('0x1b')](function(_0x241909){if(_0x241909){_0x41cc2d['body']['FaxAccountId']=_0x241909['id'];return db[_0x69dc('0x67')][_0x69dc('0x54')](_0x41cc2d[_0x69dc('0x55')]);}})['then'](respondWithResult(_0xa26989,null))['catch'](handleError(_0xa26989,null));};exports[_0x69dc('0x68')]=function(_0x298f82,_0x29ff9e,_0x31e889){var _0x37fb64={'raw':![],'where':{}};var _0x43e3ce={};var _0x46d51f={'count':0x0,'rows':[]};return db[_0x69dc('0x3b')][_0x69dc('0x60')]({'where':{'id':_0x298f82['params']['id']}})[_0x69dc('0x1b')](handleEntityNotFound(_0x29ff9e,null))[_0x69dc('0x1b')](function(_0x22dd2c){if(_0x22dd2c){_0x43e3ce[_0x69dc('0x41')]=_[_0x69dc('0x3d')](db[_0x69dc('0x67')]['rawAttributes']);_0x43e3ce[_0x69dc('0x3e')]=_['keys'](_0x298f82['query']);_0x43e3ce[_0x69dc('0x3f')]=_[_0x69dc('0x40')](_0x43e3ce[_0x69dc('0x41')],_0x43e3ce[_0x69dc('0x3e')]);_0x37fb64['attributes']=_['intersection'](_0x43e3ce['model'],qs[_0x69dc('0x43')](_0x298f82['query'][_0x69dc('0x43')]));_0x37fb64['attributes']=_0x37fb64['attributes']['length']?_0x37fb64['attributes']:_0x43e3ce[_0x69dc('0x41')];if(!_0x298f82['query'][_0x69dc('0x44')](_0x69dc('0x45'))){_0x37fb64[_0x69dc('0x2b')]=qs[_0x69dc('0x2b')](_0x298f82[_0x69dc('0x3e')][_0x69dc('0x2b')]);_0x37fb64[_0x69dc('0x2a')]=qs['offset'](_0x298f82[_0x69dc('0x3e')][_0x69dc('0x2a')]);}_0x37fb64['order']=qs[_0x69dc('0x46')](_0x298f82[_0x69dc('0x3e')][_0x69dc('0x46')]);_0x37fb64[_0x69dc('0x47')]=qs[_0x69dc('0x3f')](_[_0x69dc('0x48')](_0x298f82['query'],_0x43e3ce[_0x69dc('0x3f')]));_0x37fb64[_0x69dc('0x47')][_0x69dc('0x5e')]=_0x22dd2c['id'];if(_0x298f82[_0x69dc('0x3e')][_0x69dc('0x63')]){_0x37fb64['where']=_[_0x69dc('0x49')](_0x37fb64[_0x69dc('0x47')],{'$or':_['map'](_0x37fb64[_0x69dc('0x42')],function(_0x4d905e){var _0xd48c9={};_0xd48c9[_0x4d905e]={'$like':'%'+_0x298f82['query'][_0x69dc('0x63')]+'%'};return _0xd48c9;})});}_0x37fb64=_[_0x69dc('0x49')]({},_0x37fb64,_0x298f82[_0x69dc('0x4d')]);return db['CannedAnswer'][_0x69dc('0x29')]({'where':_0x37fb64[_0x69dc('0x47')]})[_0x69dc('0x1b')](function(_0x98d19a){_0x46d51f[_0x69dc('0x29')]=_0x98d19a;if(_0x298f82[_0x69dc('0x3e')][_0x69dc('0x4e')]){_0x37fb64['include']=[{'all':!![]}];}return db[_0x69dc('0x67')][_0x69dc('0x50')](_0x37fb64);})[_0x69dc('0x1b')](function(_0x3581f8){_0x46d51f[_0x69dc('0x51')]=_0x3581f8;return _0x46d51f;});}})['then'](respondWithFilteredResult(_0x29ff9e,_0x37fb64))[_0x69dc('0x24')](handleError(_0x29ff9e,null));};exports[_0x69dc('0x69')]=function(_0x5ae400,_0x3c7686,_0x119d2b){var _0x2c0fb5;return db['FaxAccount'][_0x69dc('0x53')]({'where':{'id':_0x5ae400[_0x69dc('0x5b')]['id']}})[_0x69dc('0x1b')](handleEntityNotFound(_0x3c7686,null))[_0x69dc('0x1b')](function(_0x3aee2a){if(_0x3aee2a){return _0x3aee2a['removeAnswers'](_0x5ae400[_0x69dc('0x3e')][_0x69dc('0x65')]);}})[_0x69dc('0x1b')](respondWithStatusCode(_0x3c7686,null))[_0x69dc('0x24')](handleError(_0x3c7686,null));};exports[_0x69dc('0x6a')]=function(_0x1c7197,_0x41169a,_0x95f4fc){return db[_0x69dc('0x6b')][_0x69dc('0x53')]({'where':{'id':_0x1c7197[_0x69dc('0x5b')]['id']}})[_0x69dc('0x1b')](handleEntityNotFound(_0x41169a,null))['then'](function(_0x305315){if(_0x305315){return _0x305315[_0x69dc('0x6a')](_0x1c7197[_0x69dc('0x55')][_0x69dc('0x65')],_[_0x69dc('0x6c')](_0x1c7197[_0x69dc('0x55')],[_0x69dc('0x65'),'id'])||{});}})[_0x69dc('0x1b')](respondWithResult(_0x41169a,null))[_0x69dc('0x24')](handleError(_0x41169a,null));};exports[_0x69dc('0x6d')]=function(_0x470f60,_0x596e7e,_0xdbc953){var _0x4d9ce7={'raw':![],'where':{}};var _0x3d9963={};var _0x456842={'count':0x0,'rows':[]};return db[_0x69dc('0x3b')][_0x69dc('0x60')]({'where':{'id':_0x470f60[_0x69dc('0x5b')]['id']}})['then'](handleEntityNotFound(_0x596e7e,null))['then'](function(_0x58b632){if(_0x58b632){_0x3d9963[_0x69dc('0x41')]=_[_0x69dc('0x3d')](db[_0x69dc('0x6b')]['rawAttributes']);_0x3d9963[_0x69dc('0x3e')]=_[_0x69dc('0x3d')](_0x470f60['query']);_0x3d9963[_0x69dc('0x3f')]=_[_0x69dc('0x40')](_0x3d9963['model'],_0x3d9963['query']);_0x4d9ce7['attributes']=_['intersection'](_0x3d9963[_0x69dc('0x41')],qs[_0x69dc('0x43')](_0x470f60[_0x69dc('0x3e')]['fields']));_0x4d9ce7[_0x69dc('0x42')]=_0x4d9ce7[_0x69dc('0x42')]['length']?_0x4d9ce7[_0x69dc('0x42')]:_0x3d9963[_0x69dc('0x41')];if(!_0x470f60[_0x69dc('0x3e')][_0x69dc('0x44')](_0x69dc('0x45'))){_0x4d9ce7['limit']=qs[_0x69dc('0x2b')](_0x470f60[_0x69dc('0x3e')][_0x69dc('0x2b')]);_0x4d9ce7['offset']=qs[_0x69dc('0x2a')](_0x470f60[_0x69dc('0x3e')]['offset']);}_0x4d9ce7[_0x69dc('0x62')]=qs[_0x69dc('0x46')](_0x470f60[_0x69dc('0x3e')]['sort']);_0x4d9ce7['where']=qs[_0x69dc('0x3f')](_[_0x69dc('0x48')](_0x470f60['query'],_0x3d9963['filters']));_0x4d9ce7['where'][_0x69dc('0x5e')]=_0x58b632['id'];if(_0x470f60[_0x69dc('0x3e')][_0x69dc('0x63')]){_0x4d9ce7['where']=_[_0x69dc('0x49')](_0x4d9ce7[_0x69dc('0x47')],{'$or':_[_0x69dc('0x4a')](_0x4d9ce7[_0x69dc('0x42')],function(_0x4a4951){var _0x5643a5={};_0x5643a5[_0x4a4951]={'$like':'%'+_0x470f60[_0x69dc('0x3e')][_0x69dc('0x63')]+'%'};return _0x5643a5;})});}_0x4d9ce7=_['merge']({},_0x4d9ce7,_0x470f60[_0x69dc('0x4d')]);return db[_0x69dc('0x6b')][_0x69dc('0x29')]({'where':_0x4d9ce7['where']})['then'](function(_0xc531d5){_0x456842[_0x69dc('0x29')]=_0xc531d5;if(_0x470f60[_0x69dc('0x3e')]['includeAll']){_0x4d9ce7[_0x69dc('0x4f')]=[{'model':db[_0x69dc('0x6e')],'as':'Contact','required':![]},{'model':db[_0x69dc('0x6f')],'as':_0x69dc('0x70'),'attributes':[_0x69dc('0x36'),_0x69dc('0x71'),_0x69dc('0x72')],'required':![]},{'model':db[_0x69dc('0x73')],'as':'Tags','attributes':['id',_0x69dc('0x36'),_0x69dc('0x74')],'where':_0x470f60[_0x69dc('0x3e')]['tag']?{'id':_0x470f60[_0x69dc('0x3e')][_0x69dc('0x75')]}:undefined,'required':_0x470f60[_0x69dc('0x3e')][_0x69dc('0x75')]?!![]:![]}];}return db[_0x69dc('0x6b')]['findAll'](_0x4d9ce7);})[_0x69dc('0x1b')](function(_0x2eed04){_0x456842[_0x69dc('0x51')]=_0x2eed04;return _0x456842;});}})[_0x69dc('0x1b')](respondWithFilteredResult(_0x596e7e,_0x4d9ce7))['catch'](handleError(_0x596e7e,null));};exports['addApplications']=function(_0x32cb77,_0x3c71c1,_0x37eed8){return db[_0x69dc('0x3b')][_0x69dc('0x60')]({'where':{'id':_0x32cb77['params']['id']}})['then'](handleEntityNotFound(_0x3c71c1,null))['then'](function(_0x1b5fcb){if(_0x1b5fcb){return db[_0x69dc('0x76')][_0x69dc('0x77')](function(_0x364135){return db['FaxApplication'][_0x69dc('0x32')]({'where':{'FaxAccountId':_0x32cb77[_0x69dc('0x5b')]['id']},'transaction':_0x364135})[_0x69dc('0x1b')](function(_0x340b94){var _0x398dde=_[_0x69dc('0x4a')](_0x32cb77[_0x69dc('0x55')],function(_0x378781){_0x378781[_0x69dc('0x5e')]=_0x32cb77['params']['id'];return _0x378781;});return db['FaxApplication']['bulkCreate'](_0x398dde,{'transaction':_0x364135});});})[_0x69dc('0x1b')](function(){return db[_0x69dc('0x78')][_0x69dc('0x79')]({'where':{'FaxAccountId':_0x32cb77['params']['id']},'order':_0x69dc('0x7a')});});}})[_0x69dc('0x1b')](respondWithResult(_0x3c71c1,null))[_0x69dc('0x24')](handleError(_0x3c71c1,null));};exports[_0x69dc('0x7b')]=function(_0x57c614,_0x2ffd13,_0x4e329e){var _0x407814={};var _0x3df0ff={};var _0x513d33;var _0x1842b2;return db[_0x69dc('0x3b')][_0x69dc('0x60')]({'where':{'id':_0x57c614[_0x69dc('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2ffd13,null))[_0x69dc('0x1b')](function(_0x1b48d4){if(_0x1b48d4){_0x513d33=_0x1b48d4;_0x3df0ff[_0x69dc('0x41')]=_[_0x69dc('0x3d')](db[_0x69dc('0x78')][_0x69dc('0x3c')]);_0x3df0ff[_0x69dc('0x3e')]=_['keys'](_0x57c614['query']);_0x3df0ff[_0x69dc('0x3f')]=_[_0x69dc('0x40')](_0x3df0ff[_0x69dc('0x41')],_0x3df0ff['query']);_0x407814['attributes']=_[_0x69dc('0x40')](_0x3df0ff['model'],qs['fields'](_0x57c614['query'][_0x69dc('0x43')]));_0x407814[_0x69dc('0x42')]=_0x407814['attributes'][_0x69dc('0x61')]?_0x407814[_0x69dc('0x42')]:_0x3df0ff[_0x69dc('0x41')];_0x407814[_0x69dc('0x62')]=qs[_0x69dc('0x46')](_0x57c614[_0x69dc('0x3e')]['sort']);_0x407814[_0x69dc('0x47')]=qs[_0x69dc('0x3f')](_[_0x69dc('0x48')](_0x57c614['query'],_0x3df0ff['filters']));if(_0x57c614['query'][_0x69dc('0x63')]){_0x407814['where']=_[_0x69dc('0x49')](_0x407814['where'],{'$or':_[_0x69dc('0x4a')](_0x407814['attributes'],function(_0x22a304){var _0x4531fb={};_0x4531fb[_0x22a304]={'$like':'%'+_0x57c614[_0x69dc('0x3e')][_0x69dc('0x63')]+'%'};return _0x4531fb;})});}_0x407814=_[_0x69dc('0x49')]({},_0x407814,_0x57c614['options']);return _0x513d33[_0x69dc('0x7b')](_0x407814);}})[_0x69dc('0x1b')](function(_0x1cf298){if(_0x1cf298){_0x1842b2=_0x1cf298[_0x69dc('0x61')];if(!_0x57c614['query'][_0x69dc('0x44')]('nolimit')){_0x407814['limit']=qs[_0x69dc('0x2b')](_0x57c614[_0x69dc('0x3e')][_0x69dc('0x2b')]);_0x407814[_0x69dc('0x2a')]=qs[_0x69dc('0x2a')](_0x57c614[_0x69dc('0x3e')][_0x69dc('0x2a')]);}return _0x513d33[_0x69dc('0x7b')](_0x407814);}})['then'](function(_0x419128){if(_0x419128){return _0x419128?{'count':_0x1842b2,'rows':_0x419128}:null;}})[_0x69dc('0x1b')](respondWithResult(_0x2ffd13,null))['catch'](handleError(_0x2ffd13,null));};function Extension(_0x17df83,_0x3075cb,_0x4dc4cf,_0x4ce628){this[_0x69dc('0x7c')]=_0x69dc('0x7d');this[_0x69dc('0x7e')]=_0x17df83[_0x69dc('0x7f')];this[_0x69dc('0x80')]=_0x4ce628;this[_0x69dc('0x4b')]=_0x69dc('0x81');this[_0x69dc('0x82')]=_0x69dc('0x83');this[_0x69dc('0x5e')]=_0x17df83['id'];this[_0x69dc('0x7a')]=_0x3075cb;this['appdata']=_0x4dc4cf;}function createExtensionsReciveFax(_0x2c8571){var _0x43b0e2=0x1;var _0x604389=[];_0x604389[_0x69dc('0x84')](new Extension(_0x2c8571,_0x43b0e2,'',_0x69dc('0x85')));_0x43b0e2+=0x1;_0x604389[_0x69dc('0x84')](new Extension(_0x2c8571,_0x43b0e2,_0x69dc('0x86'),_0x69dc('0x87')));_0x43b0e2+=0x1;for(var _0x57d899 in _0x2c8571){if(_0x2c8571[_0x69dc('0x44')](_0x57d899)&&(_0x57d899===_0x69dc('0x88')||_0x57d899===_0x69dc('0x7f')||_0x57d899==='gateway'||_0x57d899===_0x69dc('0x89')||_0x57d899===_0x69dc('0x8a')||_0x57d899===_0x69dc('0x8b')||_0x57d899===_0x69dc('0x8c')||_0x57d899==='modem'||_0x57d899===_0x69dc('0x8d'))){_0x604389[_0x69dc('0x84')](new Extension(_0x2c8571,_0x43b0e2,'FAXOPT('+_0x57d899+')='+_0x2c8571[_0x57d899],_0x69dc('0x87')));_0x43b0e2+=0x1;}}_0x604389[_0x69dc('0x84')](new Extension(_0x2c8571,_0x43b0e2,'6','Wait'));_0x43b0e2+=0x1;_0x604389['push'](new Extension(_0x2c8571,_0x43b0e2,_0x69dc('0x8e'),'ReceiveFax'));_0x43b0e2=0x0;return _0x604389;}exports[_0x69dc('0x8f')]=function(_0x9e440b,_0x3d0ad1,_0x12a34c){var _0x3eea7c;return db[_0x69dc('0x76')][_0x69dc('0x77')](function(_0x1343a3){return db[_0x69dc('0x3b')][_0x69dc('0x54')](_0x9e440b[_0x69dc('0x55')],{'transaction':_0x1343a3})[_0x69dc('0x1b')](function(_0x3cbf7f){_0x3eea7c=_0x3cbf7f[_0x69dc('0x57')]({'plain':!![]});return db[_0x69dc('0x90')][_0x69dc('0x91')](createExtensionsReciveFax(_0x3eea7c),{'transaction':_0x1343a3});});})[_0x69dc('0x1b')](function(){return _0x3eea7c;})['then'](respondWithResult(_0x3d0ad1,null))[_0x69dc('0x24')](handleError(_0x3d0ad1,null));};exports[_0x69dc('0x92')]=function(_0x44877b,_0x38870f,_0x5ed42a){var _0x1c249b;return db['sequelize']['transaction'](function(_0x507752){return db[_0x69dc('0x3b')][_0x69dc('0x31')](_0x44877b[_0x69dc('0x55')],{'where':{'id':_0x44877b['body']['id']},'transaction':_0x507752})[_0x69dc('0x1b')](function(_0x58d243){return db['VoiceExtension'][_0x69dc('0x32')]({'where':{'FaxAccountId':_0x44877b['body']['id']},'transaction':_0x507752})['then'](function(_0x28bfbd){return db[_0x69dc('0x90')][_0x69dc('0x91')](createExtensionsReciveFax(_[_0x69dc('0x6c')](_0x44877b['body'],[_0x69dc('0x93'),_0x69dc('0x94'),_0x69dc('0x95'),'updatedAt',_0x69dc('0x96'),_0x69dc('0x97')])),{'transaction':_0x507752});});});})[_0x69dc('0x1b')](function(){return db[_0x69dc('0x3b')][_0x69dc('0x98')](_0x44877b[_0x69dc('0x55')]['id']);})[_0x69dc('0x1b')](respondWithResult(_0x38870f,null))['catch'](handleError(_0x38870f,null));};exports['getMessages']=function(_0x2f6ac1,_0x33bcce,_0x4ab6ac){var _0x14282d={'raw':!![],'where':{}};var _0x304bc0={};var _0x1c2de8={'count':0x0,'rows':[]};return db[_0x69dc('0x3b')][_0x69dc('0x60')]({'where':{'id':_0x2f6ac1['params']['id']}})[_0x69dc('0x1b')](handleEntityNotFound(_0x33bcce,null))['then'](function(_0x6301ed){if(_0x6301ed){_0x304bc0[_0x69dc('0x41')]=_[_0x69dc('0x3d')](db[_0x69dc('0x99')]['rawAttributes']);_0x304bc0[_0x69dc('0x3e')]=_[_0x69dc('0x3d')](_0x2f6ac1[_0x69dc('0x3e')]);_0x304bc0[_0x69dc('0x3f')]=_[_0x69dc('0x40')](_0x304bc0['model'],_0x304bc0[_0x69dc('0x3e')]);_0x14282d['attributes']=_[_0x69dc('0x40')](_0x304bc0['model'],qs[_0x69dc('0x43')](_0x2f6ac1[_0x69dc('0x3e')]['fields']));_0x14282d[_0x69dc('0x42')]=_0x14282d[_0x69dc('0x42')][_0x69dc('0x61')]?_0x14282d['attributes']:_0x304bc0[_0x69dc('0x41')];if(!_0x2f6ac1[_0x69dc('0x3e')]['hasOwnProperty'](_0x69dc('0x45'))){_0x14282d[_0x69dc('0x2b')]=qs[_0x69dc('0x2b')](_0x2f6ac1['query'][_0x69dc('0x2b')]);_0x14282d[_0x69dc('0x2a')]=qs[_0x69dc('0x2a')](_0x2f6ac1[_0x69dc('0x3e')][_0x69dc('0x2a')]);}_0x14282d[_0x69dc('0x62')]=qs[_0x69dc('0x46')](_0x2f6ac1[_0x69dc('0x3e')]['sort']);_0x14282d[_0x69dc('0x47')]=qs['filters'](_['pick'](_0x2f6ac1['query'],_0x304bc0['filters']));_0x14282d[_0x69dc('0x47')][_0x69dc('0x5e')]=_0x6301ed['id'];if(_0x2f6ac1[_0x69dc('0x3e')][_0x69dc('0x63')]){_0x14282d[_0x69dc('0x47')]=_[_0x69dc('0x49')](_0x14282d[_0x69dc('0x47')],{'$or':_[_0x69dc('0x4a')](_0x14282d['attributes'],function(_0x326961){var _0x1c7fb7={};_0x1c7fb7[_0x326961]={'$like':'%'+_0x2f6ac1[_0x69dc('0x3e')][_0x69dc('0x63')]+'%'};return _0x1c7fb7;})});}if(_0x2f6ac1[_0x69dc('0x3e')][_0x69dc('0x9a')]){var _0x426842=_0x2f6ac1[_0x69dc('0x3e')][_0x69dc('0x9a')][_0x69dc('0x9b')](',');var _0x5a7038={};_0x5a7038[_0x426842[0x0]]={'$gte':moment(_0x426842[0x1])[_0x69dc('0x9c')](_0x69dc('0x9d'))};_0x14282d[_0x69dc('0x47')]=_[_0x69dc('0x49')](_0x14282d[_0x69dc('0x47')],_0x5a7038);}_0x14282d=_[_0x69dc('0x49')]({},_0x14282d,_0x2f6ac1['options']);return db[_0x69dc('0x99')][_0x69dc('0x29')]({'where':_0x14282d[_0x69dc('0x47')]})[_0x69dc('0x1b')](function(_0x249f3a){_0x1c2de8[_0x69dc('0x29')]=_0x249f3a;if(_0x2f6ac1['query'][_0x69dc('0x4e')]){_0x14282d[_0x69dc('0x4f')]=[{'all':!![]}];}return db[_0x69dc('0x99')][_0x69dc('0x50')](_0x14282d);})[_0x69dc('0x1b')](function(_0x462269){_0x1c2de8[_0x69dc('0x51')]=_0x462269;return _0x1c2de8;});}})['then'](respondWithFilteredResult(_0x33bcce,_0x14282d))[_0x69dc('0x24')](handleError(_0x33bcce,null));};exports[_0x69dc('0x37')]=function(_0x23cef4,_0x55f635,_0x4c830f){var _0x1ea914,_0x7576b0={},_0x572ec5;if(_0x23cef4[_0x69dc('0x55')]['to']){_0x572ec5=_0x23cef4[_0x69dc('0x55')]['to'][0x0];}return db[_0x69dc('0x3b')][_0x69dc('0x53')]({'where':{'id':_0x23cef4[_0x69dc('0x5b')]['id']},'include':[{'model':db[_0x69dc('0x9e')],'as':_0x69dc('0x9f'),'include':[{'model':db['CmContact'],'as':_0x69dc('0xa0'),'where':{'fax':_0x572ec5},'limit':0x1,'order':[[_0x69dc('0xa1'),_0x69dc('0xa2')]]}]}]})[_0x69dc('0x1b')](handleEntityNotFound(_0x55f635,null))[_0x69dc('0x1b')](function(_0x2316d2){_0x1ea914=_0x2316d2;if(_0x23cef4['body']['attachments']&&_0x23cef4[_0x69dc('0x55')]['attachments'][_0x69dc('0x61')]){for(var _0x200fb7=0x0;_0x200fb7<_0x23cef4[_0x69dc('0x55')][_0x69dc('0xa3')][_0x69dc('0x61')];_0x200fb7+=0x1){_0x23cef4[_0x69dc('0x55')]['attachments'][_0x200fb7]={'filename':_0x23cef4[_0x69dc('0x55')][_0x69dc('0xa3')][_0x200fb7][_0x69dc('0x36')],'id':_0x23cef4[_0x69dc('0x55')][_0x69dc('0xa3')][_0x200fb7]['id'],'path':path[_0x69dc('0xa4')](config[_0x69dc('0xa5')],_0x69dc('0xa6'),_0x23cef4[_0x69dc('0x55')][_0x69dc('0xa3')][_0x200fb7][_0x69dc('0xa7')])};}}return respondWithRpcPromise(_0x69dc('0xa8'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x23cef4[_0x69dc('0x5b')]['id'])?undefined:_0x23cef4['params']['id'],'path':_['isNil'](_0x23cef4[_0x69dc('0x55')][_0x69dc('0xa3')][0x0][_0x69dc('0xa9')])?undefined:_0x23cef4[_0x69dc('0x55')][_0x69dc('0xa3')][0x0][_0x69dc('0xa9')],'fax':_[_0x69dc('0xaa')](_0x23cef4['body']['to'][0x0])?undefined:_0x23cef4[_0x69dc('0x55')]['to'][0x0]},client9002);})['then'](function(){if(_0x1ea914){if(_[_0x69dc('0xaa')](_0x23cef4[_0x69dc('0x55')][_0x69dc('0xab')])){_0x23cef4['body'][_0x69dc('0xab')]=util[_0x69dc('0x9c')]('\x22%s\x22\x20<%s>',_0x1ea914[_0x69dc('0x36')],_0x1ea914[_0x69dc('0xac')]);}if(_0x1ea914[_0x69dc('0x9f')]){if(_0x1ea914[_0x69dc('0x9f')]['Contacts'][_0x69dc('0x61')]){return _0x1ea914['List'][_0x69dc('0xa0')][0x0];}else{return db[_0x69dc('0x6e')][_0x69dc('0x54')](_[_0x69dc('0x13')](_0x23cef4[_0x69dc('0x55')],{'firstName':_0x23cef4[_0x69dc('0x55')]['to'][0x0],'phone':_0x23cef4[_0x69dc('0x55')]['to'][0x0],'fax':_0x23cef4[_0x69dc('0x55')]['to'][0x0],'ListId':_0x1ea914[_0x69dc('0x97')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x69dc('0xad'));}})[_0x69dc('0x1b')](function(_0x1bb277){if(_0x1bb277){return db[_0x69dc('0x6b')]['find']({'where':{'ContactId':_0x1bb277['id'],'closed':![],'FaxAccountId':_0x1ea914['id']}})[_0x69dc('0x1b')](function(_0x3f9063){if(_0x3f9063){return[_0x3f9063,![]];}return db['FaxInteraction']['create']({'UserId':_0x23cef4[_0x69dc('0x56')]['id'],'ContactId':_0x1bb277['id'],'FaxAccountId':_0x1ea914['id'],'fax':_0x23cef4['body']['to'][0x0],'firstMsgDirection':_0x69dc('0xae'),'Messages':[_[_0x69dc('0x49')](_0x23cef4['body'],{'read':![],'body':_0x23cef4[_0x69dc('0x55')]['attachments'][0x0][_0x69dc('0xaf')],'FaxAccountId':_0x1ea914['id'],'UserId':_0x23cef4[_0x69dc('0x56')]['id'],'ContactId':_0x1bb277['id'],'AttachmentId':_0x23cef4[_0x69dc('0x55')][_0x69dc('0xa3')][0x0]['id']})]},{'include':[{'model':db[_0x69dc('0x99')],'as':_0x69dc('0xb0')}]})[_0x69dc('0x1b')](function(_0x2eb985){return[_0x2eb985,!![]];});});}else{throw new Error(_0x69dc('0xb1'));}})[_0x69dc('0xb2')](function(_0x129ed5,_0x14376b){if(_0x14376b){return _0x129ed5;}return db[_0x69dc('0x99')][_0x69dc('0x54')]({'direction':_0x69dc('0xae'),'read':![],'body':_0x23cef4[_0x69dc('0x55')][_0x69dc('0xa3')][0x0][_0x69dc('0xaf')],'FaxAccountId':_0x1ea914['id'],'FaxInteractionId':_0x129ed5['id'],'UserId':_0x23cef4[_0x69dc('0x56')]['id'],'ContactId':_0x129ed5['ContactId'],'AttachmentId':_0x23cef4['body'][_0x69dc('0xa3')][0x0]['id']})[_0x69dc('0x1b')](function(_0x48df3f){_0x129ed5[_0x69dc('0xb3')][_0x69dc('0xb0')]=[];_0x129ed5[_0x69dc('0xb3')][_0x69dc('0xb0')][_0x69dc('0x84')](_0x48df3f['dataValues']);return _0x129ed5;});})['then'](function(_0x481256){respondWithRpcPromise(_0x69dc('0xb4'),_0x69dc('0xb4'),{'FaxAccountId':_[_0x69dc('0xaa')](_0x23cef4[_0x69dc('0x5b')]['id'])?undefined:_0x23cef4[_0x69dc('0x5b')]['id'],'path':_[_0x69dc('0xaa')](_0x23cef4['body'][_0x69dc('0xa3')][0x0][_0x69dc('0xa9')])?undefined:_0x23cef4[_0x69dc('0x55')][_0x69dc('0xa3')][0x0][_0x69dc('0xa9')],'fax':_['isNil'](_0x23cef4['body']['to'][0x0])?undefined:_0x23cef4[_0x69dc('0x55')]['to'][0x0],'AttachmentId':_0x23cef4[_0x69dc('0x55')][_0x69dc('0xa3')][0x0]['id']},client9002)['then'](function(_0x47994f){logger['info'](_0x69dc('0xb5'),_0x47994f);})[_0x69dc('0x24')](function(_0x4ef4c6){logger['info'](_0x69dc('0xb5'),_0x4ef4c6);});return _0x481256;})[_0x69dc('0x1b')](respondWithResult(_0x55f635,null))[_0x69dc('0x24')](handleError(_0x55f635,null));};exports[_0x69dc('0xb6')]=function(_0x4c4cef,_0x4a6990,_0x935118){return db[_0x69dc('0x3b')][_0x69dc('0x53')]({'where':{'id':_0x4c4cef[_0x69dc('0x5b')]['id']}})[_0x69dc('0x1b')](handleEntityNotFound(_0x4a6990,null))[_0x69dc('0x1b')](function(_0x1ed2ba){if(_0x1ed2ba){return _0x1ed2ba[_0x69dc('0xb6')](_0x4c4cef[_0x69dc('0x55')]['ids'],_[_0x69dc('0x6c')](_0x4c4cef['body'],[_0x69dc('0x65'),'id'])||{})['spread'](function(_0x488777){for(var _0x2f7223=0x0;_0x2f7223<_0x4c4cef[_0x69dc('0x55')][_0x69dc('0x65')][_0x69dc('0x61')];_0x2f7223+=0x1){socket[_0x69dc('0xb7')](_0x69dc('0xb8'),{'UserId':_0x4c4cef[_0x69dc('0x55')][_0x69dc('0x65')][_0x2f7223],'FaxAccountId':_0x4c4cef[_0x69dc('0x5b')]['id']});}return _0x488777;});}})[_0x69dc('0x1b')](respondWithResult(_0x4a6990,null))[_0x69dc('0x24')](handleError(_0x4a6990,null));};exports[_0x69dc('0xb9')]=function(_0xf6b0d,_0x3f64e7,_0x16a4d5){var _0x3eb60;return db['FaxAccount'][_0x69dc('0x53')]({'where':{'id':_0xf6b0d[_0x69dc('0x5b')]['id']}})[_0x69dc('0x1b')](handleEntityNotFound(_0x3f64e7,null))['then'](function(_0x3b5277){if(_0x3b5277){return _0x3b5277[_0x69dc('0xb9')](_0xf6b0d[_0x69dc('0x3e')]['ids'])[_0x69dc('0x1b')](function(_0x736442){if(_[_0x69dc('0xba')](_0xf6b0d[_0x69dc('0x3e')][_0x69dc('0x65')])){for(var _0x359ef2=0x0;_0x359ef2<_0xf6b0d['query'][_0x69dc('0x65')][_0x69dc('0x61')];_0x359ef2+=0x1){socket[_0x69dc('0xb7')]('userFaxAccount:remove',{'UserId':_0xf6b0d[_0x69dc('0x3e')]['ids'][_0x359ef2],'FaxAccountId':_0xf6b0d['params']['id']});}}else{socket[_0x69dc('0xb7')](_0x69dc('0xbb'),{'UserId':_0xf6b0d[_0x69dc('0x3e')][_0x69dc('0x65')],'FaxAccountId':_0xf6b0d['params']['id']});}});}})['then'](respondWithStatusCode(_0x3f64e7,null))[_0x69dc('0x24')](handleError(_0x3f64e7,null));};exports[_0x69dc('0xbc')]=function(_0x494ecd,_0x4f55ac,_0x50e866){var _0x51630a={};var _0x54bcb4={};var _0x755345;var _0xb5551a;return db[_0x69dc('0x3b')][_0x69dc('0x60')]({'where':{'id':_0x494ecd[_0x69dc('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4f55ac,null))[_0x69dc('0x1b')](function(_0x5adec2){if(_0x5adec2){_0x755345=_0x5adec2;_0x54bcb4['model']=_[_0x69dc('0x3d')](db['User']['rawAttributes']);_0x54bcb4[_0x69dc('0x3e')]=_[_0x69dc('0x3d')](_0x494ecd[_0x69dc('0x3e')]);_0x54bcb4[_0x69dc('0x3f')]=_[_0x69dc('0x40')](_0x54bcb4[_0x69dc('0x41')],_0x54bcb4[_0x69dc('0x3e')]);_0x51630a[_0x69dc('0x42')]=_[_0x69dc('0x40')](_0x54bcb4[_0x69dc('0x41')],qs['fields'](_0x494ecd[_0x69dc('0x3e')][_0x69dc('0x43')]));_0x51630a['attributes']=_0x51630a[_0x69dc('0x42')][_0x69dc('0x61')]?_0x51630a[_0x69dc('0x42')]:_0x54bcb4['model'];_0x51630a['order']=qs[_0x69dc('0x46')](_0x494ecd[_0x69dc('0x3e')][_0x69dc('0x46')]);_0x51630a['where']=qs[_0x69dc('0x3f')](_['pick'](_0x494ecd[_0x69dc('0x3e')],_0x54bcb4[_0x69dc('0x3f')]));if(_0x494ecd[_0x69dc('0x3e')][_0x69dc('0x63')]){_0x51630a[_0x69dc('0x47')]=_[_0x69dc('0x49')](_0x51630a[_0x69dc('0x47')],{'$or':_[_0x69dc('0x4a')](_0x51630a[_0x69dc('0x42')],function(_0x40c77b){var _0x6da310={};_0x6da310[_0x40c77b]={'$like':'%'+_0x494ecd[_0x69dc('0x3e')]['filter']+'%'};return _0x6da310;})});}_0x51630a=_['merge']({},_0x51630a,_0x494ecd[_0x69dc('0x4d')]);return _0x755345[_0x69dc('0xbc')](_0x51630a);}})[_0x69dc('0x1b')](function(_0x18af89){if(_0x18af89){_0xb5551a=_0x18af89['length'];if(!_0x494ecd[_0x69dc('0x3e')][_0x69dc('0x44')](_0x69dc('0x45'))){_0x51630a['limit']=qs[_0x69dc('0x2b')](_0x494ecd['query']['limit']);_0x51630a[_0x69dc('0x2a')]=qs[_0x69dc('0x2a')](_0x494ecd[_0x69dc('0x3e')][_0x69dc('0x2a')]);}return _0x755345[_0x69dc('0xbc')](_0x51630a);}})[_0x69dc('0x1b')](function(_0xecf5c0){if(_0xecf5c0){return _0xecf5c0?{'count':_0xb5551a,'rows':_0xecf5c0}:null;}})['then'](respondWithResult(_0x4f55ac,null))[_0x69dc('0x24')](handleError(_0x4f55ac,null));};
\ No newline at end of file
+var _0x09a8=['List','Contacts','CmContact','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','update','destroy','get','FaxAccounts','UserProfileResource','end','name','index','FaxAccount','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','map','key','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','Pause','mandatoryDispositionPause','create','body','user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','FaxAccountId','Disposition','getDispositions','pick','count','removeDispositions','ids','addAnswer','CannedAnswer','findOne','length','removeAnswers','addInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tags','color','tag','FaxInteraction','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','from-voip-provider','exten','localstationid','app','description','Fax\x20Extension','priority','appdata','push','Answer','CDR(type)=inbound-fax','ecm','gateway','faxdetect','headerinfo','maxrate','modem','t38timeout','FAXOPT(','Set','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','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','DESC','attachments','join','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax'];(function(_0x25df80,_0xa2aec5){var _0x17b6d0=function(_0x446155){while(--_0x446155){_0x25df80['push'](_0x25df80['shift']());}};_0x17b6d0(++_0xa2aec5);}(_0x09a8,0x19d));var _0x809a=function(_0x1e7e86,_0x86735d){_0x1e7e86=_0x1e7e86-0x0;var _0x1670b7=_0x09a8[_0x1e7e86];return _0x1670b7;};'use strict';var pdf=require(_0x809a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x809a('0x1'));var zipdir=require(_0x809a('0x2'));var jsonpatch=require(_0x809a('0x3'));var rp=require(_0x809a('0x4'));var moment=require(_0x809a('0x5'));var BPromise=require(_0x809a('0x6'));var Mustache=require(_0x809a('0x7'));var util=require(_0x809a('0x8'));var path=require(_0x809a('0x9'));var sox=require(_0x809a('0xa'));var csv=require(_0x809a('0xb'));var ejs=require(_0x809a('0xc'));var fs=require('fs');var _=require(_0x809a('0xd'));var squel=require(_0x809a('0xe'));var crypto=require(_0x809a('0xf'));var jsforce=require(_0x809a('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x809a('0x11'));var Papa=require(_0x809a('0x12'));var authService=require(_0x809a('0x13'));var hardwareService=require(_0x809a('0x14'));var Redis=require(_0x809a('0x15'));var qs=require('../../components/parsers/qs');var logger=require(_0x809a('0x16'))(_0x809a('0x17'));var utils=require(_0x809a('0x18'));var config=require('../../config/environment');var db=require(_0x809a('0x19'))['db'];config[_0x809a('0x1a')]=_[_0x809a('0x1b')](config['redis'],{'host':_0x809a('0x1c'),'port':0x18eb});var socket=require(_0x809a('0x1d'))(new Redis(config[_0x809a('0x1a')]));require('./faxAccount.socket')[_0x809a('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x809a('0x1f')][_0x809a('0x20')]({'port':0x232c});var client9002=jayson[_0x809a('0x1f')][_0x809a('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x5eafdd,_0x128942,_0x3e7d3e,_0x5603f8){return new BPromise(function(_0x1a1e2b,_0x4a11e6){var _0x2de9f2=_0x5603f8||client;return _0x2de9f2[_0x809a('0x21')](_0x5eafdd,_0x3e7d3e)[_0x809a('0x22')](function(_0x863b48){logger['info'](_0x809a('0x23'),_0x128942,_0x809a('0x24'));logger[_0x809a('0x25')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x128942,_0x809a('0x24'),JSON[_0x809a('0x26')](_0x863b48));if(_0x863b48[_0x809a('0x27')]){if(_0x863b48['error']['code']===0x1f4){logger[_0x809a('0x27')]('FaxAccount,\x20%s,\x20%s',_0x128942,_0x863b48[_0x809a('0x27')]['message']);return _0x4a11e6(_0x863b48[_0x809a('0x27')][_0x809a('0x28')]);}logger[_0x809a('0x27')](_0x809a('0x23'),_0x128942,_0x863b48[_0x809a('0x27')][_0x809a('0x28')]);return _0x1a1e2b(_0x863b48[_0x809a('0x27')][_0x809a('0x28')]);}else{logger[_0x809a('0x29')](_0x809a('0x23'),_0x128942,_0x809a('0x24'));_0x1a1e2b(_0x863b48[_0x809a('0x2a')][_0x809a('0x28')]);}})[_0x809a('0x2b')](function(_0x1f060c){logger[_0x809a('0x27')](_0x809a('0x23'),_0x128942,_0x1f060c);_0x4a11e6(_0x1f060c);});});}function respondWithStatusCode(_0x36c15a,_0x3baf60){_0x3baf60=_0x3baf60||0xcc;return function(_0x3b354a){if(_0x3b354a){return _0x36c15a[_0x809a('0x2c')](_0x3baf60);}return _0x36c15a['status'](_0x3baf60)['end']();};}function respondWithResult(_0x253b6b,_0x929a91){_0x929a91=_0x929a91||0xc8;return function(_0x774848){if(_0x774848){return _0x253b6b[_0x809a('0x2d')](_0x929a91)[_0x809a('0x2e')](_0x774848);}};}function respondWithFilteredResult(_0x459022,_0x45517a){return function(_0x2dc771){if(_0x2dc771){var _0x3c7f08=_0x2dc771['count'],_0x5f38b9=_0x45517a[_0x809a('0x2f')],_0x5696e5=_0x45517a[_0x809a('0x2f')]+_0x45517a[_0x809a('0x30')],_0x9b23bb;if(_0x5696e5>=_0x3c7f08){_0x5696e5=_0x3c7f08;_0x9b23bb=0xc8;}else{_0x9b23bb=0xce;}_0x459022[_0x809a('0x2d')](_0x9b23bb);return _0x459022[_0x809a('0x31')](_0x809a('0x32'),_0x5f38b9+'-'+_0x5696e5+'/'+_0x3c7f08)['json'](_0x2dc771);}return null;};}function patchUpdates(_0x468d4f){return function(_0x55e9f3){try{jsonpatch[_0x809a('0x33')](_0x55e9f3,_0x468d4f,!![]);}catch(_0x19eeb0){return BPromise[_0x809a('0x34')](_0x19eeb0);}return _0x55e9f3['save']();};}function saveUpdates(_0xa841f6,_0x22b1e8){return function(_0x45724d){if(_0x45724d){return _0x45724d[_0x809a('0x35')](_0xa841f6)['then'](function(_0x472f6c){return _0x472f6c;});}return null;};}function removeEntity(_0x16d858,_0x450d05){return function(_0x2ff23a){if(_0x2ff23a){return _0x2ff23a[_0x809a('0x36')]()[_0x809a('0x22')](function(){var _0x559298=_0x2ff23a[_0x809a('0x37')]({'plain':!![]});var _0x7fbbc7=_0x809a('0x38');return db[_0x809a('0x39')][_0x809a('0x36')]({'where':{'type':_0x7fbbc7,'resourceId':_0x559298['id']}})[_0x809a('0x22')](function(){return _0x2ff23a;});})[_0x809a('0x22')](function(){_0x16d858[_0x809a('0x2d')](0xcc)[_0x809a('0x3a')]();});}};}function handleEntityNotFound(_0x18a66c,_0x4bcc96){return function(_0x405162){if(!_0x405162){_0x18a66c[_0x809a('0x2c')](0x194);}return _0x405162;};}function handleError(_0x1115d4,_0x1bbedb){_0x1bbedb=_0x1bbedb||0x1f4;return function(_0x36206d){logger['error'](_0x36206d['stack']);if(_0x36206d[_0x809a('0x3b')]){delete _0x36206d[_0x809a('0x3b')];}_0x1115d4[_0x809a('0x2d')](_0x1bbedb)['send'](_0x36206d);};}exports[_0x809a('0x3c')]=function(_0x336349,_0x5a226d){var _0x414fe9={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x3e3486={},_0x1cdf73={'count':0x0,'rows':[]};var _0x3cc144=db[_0x809a('0x3d')][_0x809a('0x3e')];_0x3e3486[_0x809a('0x3f')]=_[_0x809a('0x40')](_0x3cc144);_0x3e3486[_0x809a('0x41')]=_[_0x809a('0x40')](_0x336349[_0x809a('0x41')]);_0x3e3486[_0x809a('0x42')]=_[_0x809a('0x43')](_0x3e3486['model'],_0x3e3486[_0x809a('0x41')]);_0x414fe9[_0x809a('0x44')]=_[_0x809a('0x43')](_0x3e3486['model'],qs[_0x809a('0x45')](_0x336349[_0x809a('0x41')]['fields']));_0x414fe9['attributes']=_0x414fe9[_0x809a('0x44')]['length']?_0x414fe9[_0x809a('0x44')]:_0x3e3486[_0x809a('0x3f')];if(!_0x336349['query'][_0x809a('0x46')](_0x809a('0x47'))){_0x414fe9[_0x809a('0x30')]=qs[_0x809a('0x30')](_0x336349[_0x809a('0x41')]['limit']);_0x414fe9[_0x809a('0x2f')]=qs[_0x809a('0x2f')](_0x336349[_0x809a('0x41')][_0x809a('0x2f')]);}_0x414fe9[_0x809a('0x48')]=qs[_0x809a('0x49')](_0x336349[_0x809a('0x41')][_0x809a('0x49')]);_0x414fe9[_0x809a('0x4a')]=qs[_0x809a('0x42')](_['pick'](_0x336349[_0x809a('0x41')],_0x3e3486[_0x809a('0x42')]));if(_0x336349[_0x809a('0x41')]['filter']){_0x414fe9[_0x809a('0x4a')]=_[_0x809a('0x4b')](_0x414fe9[_0x809a('0x4a')],{'$or':_[_0x809a('0x4c')](_0x3cc144,function(_0x2a1f10){if(_0x2a1f10['type'][_0x809a('0x4d')]!==_0x809a('0x4e')){var _0x43c966={};_0x43c966[_0x2a1f10['field']]={'$like':'%'+_0x336349[_0x809a('0x41')][_0x809a('0x4f')]+'%'};return _0x43c966;}})});}_0x414fe9=_[_0x809a('0x4b')]({},_0x414fe9,_0x336349[_0x809a('0x50')]);var _0x829239={'where':_0x414fe9[_0x809a('0x4a')]};return db[_0x809a('0x3d')]['count'](_0x829239)[_0x809a('0x22')](function(_0x4db3b0){_0x1cdf73['count']=_0x4db3b0;if(_0x336349[_0x809a('0x41')][_0x809a('0x51')]){_0x414fe9[_0x809a('0x52')]=[{'all':!![]}];}return db['FaxAccount'][_0x809a('0x53')](_0x414fe9);})[_0x809a('0x22')](function(_0x4dfee5){_0x1cdf73[_0x809a('0x54')]=_0x4dfee5;return _0x1cdf73;})['then'](respondWithFilteredResult(_0x5a226d,_0x414fe9))[_0x809a('0x2b')](handleError(_0x5a226d,null));};exports['show']=function(_0x2fcfb5,_0x107fbe){var _0x220485={'raw':![],'where':{'id':_0x2fcfb5[_0x809a('0x55')]['id']},'include':[{'model':db[_0x809a('0x56')],'as':_0x809a('0x57')}]},_0x557e72={};_0x557e72[_0x809a('0x3f')]=_['keys'](db['FaxAccount'][_0x809a('0x3e')]);_0x557e72[_0x809a('0x41')]=_[_0x809a('0x40')](_0x2fcfb5[_0x809a('0x41')]);_0x557e72['filters']=_[_0x809a('0x43')](_0x557e72[_0x809a('0x3f')],_0x557e72[_0x809a('0x41')]);_0x220485[_0x809a('0x44')]=_[_0x809a('0x43')](_0x557e72[_0x809a('0x3f')],qs[_0x809a('0x45')](_0x2fcfb5[_0x809a('0x41')][_0x809a('0x45')]));_0x220485[_0x809a('0x44')]=_0x220485[_0x809a('0x44')]['length']?_0x220485['attributes']:_0x557e72[_0x809a('0x3f')];if(_0x2fcfb5['query'][_0x809a('0x51')]){_0x220485[_0x809a('0x52')]=[{'all':!![]}];}_0x220485=_[_0x809a('0x4b')]({},_0x220485,_0x2fcfb5[_0x809a('0x50')]);return db['FaxAccount']['find'](_0x220485)[_0x809a('0x22')](handleEntityNotFound(_0x107fbe,null))[_0x809a('0x22')](respondWithResult(_0x107fbe,null))[_0x809a('0x2b')](handleError(_0x107fbe,null));};exports[_0x809a('0x58')]=function(_0x1983da,_0x4e6bc6){return db[_0x809a('0x3d')]['create'](_0x1983da[_0x809a('0x59')],{})[_0x809a('0x22')](function(_0x48cc62){var _0x13ccc0=_0x1983da[_0x809a('0x5a')][_0x809a('0x37')]({'plain':!![]});if(!_0x13ccc0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x13ccc0[_0x809a('0x5b')]===_0x809a('0x5a')){var _0x95e49e=_0x48cc62['get']({'plain':!![]});var _0xbd8a78='FaxAccounts';return db['UserProfileSection'][_0x809a('0x5c')]({'where':{'name':_0xbd8a78,'userProfileId':_0x13ccc0[_0x809a('0x5d')]},'raw':!![]})[_0x809a('0x22')](function(_0x25321e){if(_0x25321e&&_0x25321e[_0x809a('0x5e')]===0x0){return db[_0x809a('0x39')]['create']({'name':_0x95e49e[_0x809a('0x3b')],'resourceId':_0x95e49e['id'],'type':_0x25321e[_0x809a('0x3b')],'sectionId':_0x25321e['id']},{})['then'](function(){return _0x48cc62;});}else{return _0x48cc62;}})[_0x809a('0x2b')](function(_0x4dc645){logger[_0x809a('0x27')](_0x809a('0x5f'),_0x4dc645);throw _0x4dc645;});}return _0x48cc62;})[_0x809a('0x22')](respondWithResult(_0x4e6bc6,0xc9))['catch'](handleError(_0x4e6bc6,null));};exports[_0x809a('0x35')]=function(_0x5b61e7,_0xacf2ec){if(_0x5b61e7['body']['id']){delete _0x5b61e7[_0x809a('0x59')]['id'];}return db[_0x809a('0x3d')][_0x809a('0x5c')]({'where':{'id':_0x5b61e7[_0x809a('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x809a('0x57')}]})['then'](handleEntityNotFound(_0xacf2ec,null))[_0x809a('0x22')](saveUpdates(_0x5b61e7[_0x809a('0x59')],null))['then'](function(_0x319526){if(_0x319526&&_0x5b61e7[_0x809a('0x59')]['mandatoryDispositionPause']){return db[_0x809a('0x56')][_0x809a('0x35')](_0x5b61e7[_0x809a('0x59')][_0x809a('0x57')],{'where':{'FaxAccountId':_0x319526['id']}})[_0x809a('0x22')](function(){return _0x319526;});}return _0x319526;})[_0x809a('0x22')](respondWithResult(_0xacf2ec,null))[_0x809a('0x2b')](handleError(_0xacf2ec,null));};exports['destroy']=function(_0x2ea127,_0x504827){return db[_0x809a('0x3d')][_0x809a('0x5c')]({'where':{'id':_0x2ea127[_0x809a('0x55')]['id']}})[_0x809a('0x22')](handleEntityNotFound(_0x504827,null))['then'](removeEntity(_0x504827,null))[_0x809a('0x2b')](handleError(_0x504827,null));};exports['describe']=function(_0x4ead64,_0x2a9ce2){return db[_0x809a('0x3d')]['describe']()['then'](respondWithResult(_0x2a9ce2,null))['catch'](handleError(_0x2a9ce2,null));};exports[_0x809a('0x60')]=function(_0x51f321,_0x3f4f56,_0x4bc895){if(_0x51f321[_0x809a('0x59')]['id']){delete _0x51f321[_0x809a('0x59')]['id'];}return db[_0x809a('0x3d')][_0x809a('0x5c')]({'where':{'id':_0x51f321['params']['id']}})[_0x809a('0x22')](handleEntityNotFound(_0x3f4f56,null))['then'](function(_0x4e6682){if(_0x4e6682){_0x51f321[_0x809a('0x59')][_0x809a('0x61')]=_0x4e6682['id'];return db[_0x809a('0x62')][_0x809a('0x58')](_0x51f321[_0x809a('0x59')]);}})[_0x809a('0x22')](respondWithResult(_0x3f4f56,null))[_0x809a('0x2b')](handleError(_0x3f4f56,null));};exports[_0x809a('0x63')]=function(_0x1a4472,_0x25abda,_0x347629){var _0x54b9c2={'raw':![],'where':{}};var _0x264047={};var _0x2677f6={'count':0x0,'rows':[]};return db[_0x809a('0x3d')]['findOne']({'where':{'id':_0x1a4472[_0x809a('0x55')]['id']}})[_0x809a('0x22')](handleEntityNotFound(_0x25abda,null))[_0x809a('0x22')](function(_0x5326c5){if(_0x5326c5){_0x264047[_0x809a('0x3f')]=_[_0x809a('0x40')](db[_0x809a('0x62')][_0x809a('0x3e')]);_0x264047[_0x809a('0x41')]=_[_0x809a('0x40')](_0x1a4472['query']);_0x264047[_0x809a('0x42')]=_[_0x809a('0x43')](_0x264047[_0x809a('0x3f')],_0x264047[_0x809a('0x41')]);_0x54b9c2['attributes']=_[_0x809a('0x43')](_0x264047[_0x809a('0x3f')],qs[_0x809a('0x45')](_0x1a4472[_0x809a('0x41')][_0x809a('0x45')]));_0x54b9c2['attributes']=_0x54b9c2['attributes']['length']?_0x54b9c2['attributes']:_0x264047[_0x809a('0x3f')];if(!_0x1a4472[_0x809a('0x41')][_0x809a('0x46')](_0x809a('0x47'))){_0x54b9c2[_0x809a('0x30')]=qs[_0x809a('0x30')](_0x1a4472['query'][_0x809a('0x30')]);_0x54b9c2[_0x809a('0x2f')]=qs[_0x809a('0x2f')](_0x1a4472[_0x809a('0x41')][_0x809a('0x2f')]);}_0x54b9c2[_0x809a('0x48')]=qs[_0x809a('0x49')](_0x1a4472[_0x809a('0x41')][_0x809a('0x49')]);_0x54b9c2[_0x809a('0x4a')]=qs[_0x809a('0x42')](_[_0x809a('0x64')](_0x1a4472[_0x809a('0x41')],_0x264047['filters']));_0x54b9c2['where'][_0x809a('0x61')]=_0x5326c5['id'];if(_0x1a4472['query']['filter']){_0x54b9c2[_0x809a('0x4a')]=_[_0x809a('0x4b')](_0x54b9c2[_0x809a('0x4a')],{'$or':_[_0x809a('0x4c')](_0x54b9c2['attributes'],function(_0x3c4bbb){var _0x3b4920={};_0x3b4920[_0x3c4bbb]={'$like':'%'+_0x1a4472['query'][_0x809a('0x4f')]+'%'};return _0x3b4920;})});}_0x54b9c2=_['merge']({},_0x54b9c2,_0x1a4472[_0x809a('0x50')]);return db['Disposition']['count']({'where':_0x54b9c2[_0x809a('0x4a')]})[_0x809a('0x22')](function(_0x1838c5){_0x2677f6[_0x809a('0x65')]=_0x1838c5;if(_0x1a4472['query'][_0x809a('0x51')]){_0x54b9c2['include']=[{'all':!![]}];}return db[_0x809a('0x62')][_0x809a('0x53')](_0x54b9c2);})[_0x809a('0x22')](function(_0x3f75f3){_0x2677f6[_0x809a('0x54')]=_0x3f75f3;return _0x2677f6;});}})[_0x809a('0x22')](respondWithFilteredResult(_0x25abda,_0x54b9c2))[_0x809a('0x2b')](handleError(_0x25abda,null));};exports[_0x809a('0x66')]=function(_0x4676cb,_0x42f28e,_0x46c25c){var _0x46f1e0;return db[_0x809a('0x3d')]['find']({'where':{'id':_0x4676cb[_0x809a('0x55')]['id']}})[_0x809a('0x22')](handleEntityNotFound(_0x42f28e,null))[_0x809a('0x22')](function(_0x12cea7){if(_0x12cea7){return _0x12cea7[_0x809a('0x66')](_0x4676cb[_0x809a('0x41')][_0x809a('0x67')]);}})[_0x809a('0x22')](respondWithStatusCode(_0x42f28e,null))[_0x809a('0x2b')](handleError(_0x42f28e,null));};exports[_0x809a('0x68')]=function(_0x4c3a42,_0x41fb02,_0x8b5c47){if(_0x4c3a42['body']['id']){delete _0x4c3a42[_0x809a('0x59')]['id'];}return db['FaxAccount'][_0x809a('0x5c')]({'where':{'id':_0x4c3a42['params']['id']}})[_0x809a('0x22')](handleEntityNotFound(_0x41fb02,null))[_0x809a('0x22')](function(_0x24bccb){if(_0x24bccb){_0x4c3a42[_0x809a('0x59')][_0x809a('0x61')]=_0x24bccb['id'];return db[_0x809a('0x69')][_0x809a('0x58')](_0x4c3a42['body']);}})[_0x809a('0x22')](respondWithResult(_0x41fb02,null))[_0x809a('0x2b')](handleError(_0x41fb02,null));};exports['getAnswers']=function(_0x5c37a5,_0x567a26,_0x1be1e6){var _0x25ea9e={'raw':![],'where':{}};var _0x499b7b={};var _0x304926={'count':0x0,'rows':[]};return db[_0x809a('0x3d')][_0x809a('0x6a')]({'where':{'id':_0x5c37a5[_0x809a('0x55')]['id']}})[_0x809a('0x22')](handleEntityNotFound(_0x567a26,null))[_0x809a('0x22')](function(_0x4f5fa4){if(_0x4f5fa4){_0x499b7b[_0x809a('0x3f')]=_[_0x809a('0x40')](db['CannedAnswer'][_0x809a('0x3e')]);_0x499b7b[_0x809a('0x41')]=_['keys'](_0x5c37a5[_0x809a('0x41')]);_0x499b7b[_0x809a('0x42')]=_['intersection'](_0x499b7b['model'],_0x499b7b[_0x809a('0x41')]);_0x25ea9e[_0x809a('0x44')]=_['intersection'](_0x499b7b[_0x809a('0x3f')],qs[_0x809a('0x45')](_0x5c37a5[_0x809a('0x41')][_0x809a('0x45')]));_0x25ea9e[_0x809a('0x44')]=_0x25ea9e['attributes'][_0x809a('0x6b')]?_0x25ea9e[_0x809a('0x44')]:_0x499b7b[_0x809a('0x3f')];if(!_0x5c37a5[_0x809a('0x41')][_0x809a('0x46')]('nolimit')){_0x25ea9e[_0x809a('0x30')]=qs[_0x809a('0x30')](_0x5c37a5[_0x809a('0x41')][_0x809a('0x30')]);_0x25ea9e[_0x809a('0x2f')]=qs[_0x809a('0x2f')](_0x5c37a5['query'][_0x809a('0x2f')]);}_0x25ea9e[_0x809a('0x48')]=qs[_0x809a('0x49')](_0x5c37a5[_0x809a('0x41')]['sort']);_0x25ea9e[_0x809a('0x4a')]=qs[_0x809a('0x42')](_[_0x809a('0x64')](_0x5c37a5[_0x809a('0x41')],_0x499b7b['filters']));_0x25ea9e[_0x809a('0x4a')]['FaxAccountId']=_0x4f5fa4['id'];if(_0x5c37a5[_0x809a('0x41')]['filter']){_0x25ea9e[_0x809a('0x4a')]=_[_0x809a('0x4b')](_0x25ea9e[_0x809a('0x4a')],{'$or':_[_0x809a('0x4c')](_0x25ea9e['attributes'],function(_0x470251){var _0x262b78={};_0x262b78[_0x470251]={'$like':'%'+_0x5c37a5[_0x809a('0x41')][_0x809a('0x4f')]+'%'};return _0x262b78;})});}_0x25ea9e=_['merge']({},_0x25ea9e,_0x5c37a5[_0x809a('0x50')]);return db[_0x809a('0x69')][_0x809a('0x65')]({'where':_0x25ea9e[_0x809a('0x4a')]})[_0x809a('0x22')](function(_0x2632a6){_0x304926[_0x809a('0x65')]=_0x2632a6;if(_0x5c37a5[_0x809a('0x41')][_0x809a('0x51')]){_0x25ea9e[_0x809a('0x52')]=[{'all':!![]}];}return db[_0x809a('0x69')][_0x809a('0x53')](_0x25ea9e);})[_0x809a('0x22')](function(_0x1bb5d2){_0x304926['rows']=_0x1bb5d2;return _0x304926;});}})[_0x809a('0x22')](respondWithFilteredResult(_0x567a26,_0x25ea9e))[_0x809a('0x2b')](handleError(_0x567a26,null));};exports[_0x809a('0x6c')]=function(_0x2a50c0,_0x1fec1e,_0x5949e1){var _0x5baa97;return db[_0x809a('0x3d')][_0x809a('0x5c')]({'where':{'id':_0x2a50c0[_0x809a('0x55')]['id']}})[_0x809a('0x22')](handleEntityNotFound(_0x1fec1e,null))[_0x809a('0x22')](function(_0x2f6796){if(_0x2f6796){return _0x2f6796['removeAnswers'](_0x2a50c0['query'][_0x809a('0x67')]);}})['then'](respondWithStatusCode(_0x1fec1e,null))[_0x809a('0x2b')](handleError(_0x1fec1e,null));};exports[_0x809a('0x6d')]=function(_0x2bd1ce,_0x3a413f,_0x4183e9){return db['FaxInteraction']['find']({'where':{'id':_0x2bd1ce[_0x809a('0x55')]['id']}})[_0x809a('0x22')](handleEntityNotFound(_0x3a413f,null))[_0x809a('0x22')](function(_0x36eed5){if(_0x36eed5){return _0x36eed5[_0x809a('0x6d')](_0x2bd1ce['body'][_0x809a('0x67')],_[_0x809a('0x6e')](_0x2bd1ce[_0x809a('0x59')],['ids','id'])||{});}})[_0x809a('0x22')](respondWithResult(_0x3a413f,null))[_0x809a('0x2b')](handleError(_0x3a413f,null));};exports[_0x809a('0x6f')]=function(_0x408a65,_0x143ef9,_0x2f7a72){var _0x58a0bb={'raw':![],'where':{}};var _0x44928a={};var _0x18e125={'count':0x0,'rows':[]};return db[_0x809a('0x3d')][_0x809a('0x6a')]({'where':{'id':_0x408a65[_0x809a('0x55')]['id']}})[_0x809a('0x22')](handleEntityNotFound(_0x143ef9,null))['then'](function(_0x4805e1){if(_0x4805e1){_0x44928a[_0x809a('0x3f')]=_[_0x809a('0x40')](db['FaxInteraction'][_0x809a('0x3e')]);_0x44928a['query']=_[_0x809a('0x40')](_0x408a65['query']);_0x44928a['filters']=_['intersection'](_0x44928a['model'],_0x44928a[_0x809a('0x41')]);_0x58a0bb[_0x809a('0x44')]=_[_0x809a('0x43')](_0x44928a[_0x809a('0x3f')],qs[_0x809a('0x45')](_0x408a65['query']['fields']));_0x58a0bb[_0x809a('0x44')]=_0x58a0bb[_0x809a('0x44')][_0x809a('0x6b')]?_0x58a0bb[_0x809a('0x44')]:_0x44928a[_0x809a('0x3f')];if(!_0x408a65[_0x809a('0x41')][_0x809a('0x46')]('nolimit')){_0x58a0bb[_0x809a('0x30')]=qs[_0x809a('0x30')](_0x408a65[_0x809a('0x41')][_0x809a('0x30')]);_0x58a0bb[_0x809a('0x2f')]=qs[_0x809a('0x2f')](_0x408a65[_0x809a('0x41')][_0x809a('0x2f')]);}_0x58a0bb['order']=qs[_0x809a('0x49')](_0x408a65['query']['sort']);_0x58a0bb[_0x809a('0x4a')]=qs[_0x809a('0x42')](_[_0x809a('0x64')](_0x408a65[_0x809a('0x41')],_0x44928a[_0x809a('0x42')]));_0x58a0bb[_0x809a('0x4a')][_0x809a('0x61')]=_0x4805e1['id'];if(_0x408a65[_0x809a('0x41')][_0x809a('0x4f')]){_0x58a0bb[_0x809a('0x4a')]=_[_0x809a('0x4b')](_0x58a0bb[_0x809a('0x4a')],{'$or':_['map'](_0x58a0bb[_0x809a('0x44')],function(_0x3f6099){var _0xe9fbb0={};_0xe9fbb0[_0x3f6099]={'$like':'%'+_0x408a65[_0x809a('0x41')]['filter']+'%'};return _0xe9fbb0;})});}_0x58a0bb=_[_0x809a('0x4b')]({},_0x58a0bb,_0x408a65[_0x809a('0x50')]);return db['FaxInteraction'][_0x809a('0x65')]({'where':_0x58a0bb[_0x809a('0x4a')]})[_0x809a('0x22')](function(_0x2fa751){_0x18e125[_0x809a('0x65')]=_0x2fa751;if(_0x408a65[_0x809a('0x41')]['includeAll']){_0x58a0bb[_0x809a('0x52')]=[{'model':db['CmContact'],'as':_0x809a('0x70'),'required':![]},{'model':db[_0x809a('0x71')],'as':_0x809a('0x72'),'attributes':['name',_0x809a('0x73'),_0x809a('0x74')],'required':![]},{'model':db['Tag'],'as':_0x809a('0x75'),'attributes':['id',_0x809a('0x3b'),_0x809a('0x76')],'where':_0x408a65[_0x809a('0x41')][_0x809a('0x77')]?{'id':_0x408a65['query']['tag']}:undefined,'required':_0x408a65[_0x809a('0x41')]['tag']?!![]:![]}];}return db[_0x809a('0x78')][_0x809a('0x53')](_0x58a0bb);})[_0x809a('0x22')](function(_0x459d17){_0x18e125[_0x809a('0x54')]=_0x459d17;return _0x18e125;});}})[_0x809a('0x22')](respondWithFilteredResult(_0x143ef9,_0x58a0bb))['catch'](handleError(_0x143ef9,null));};exports[_0x809a('0x79')]=function(_0x63314e,_0x57dd00,_0xc6be82){return db[_0x809a('0x3d')][_0x809a('0x6a')]({'where':{'id':_0x63314e['params']['id']}})['then'](handleEntityNotFound(_0x57dd00,null))[_0x809a('0x22')](function(_0x29fe0b){if(_0x29fe0b){return db[_0x809a('0x7a')][_0x809a('0x7b')](function(_0x580dfa){return db[_0x809a('0x7c')][_0x809a('0x36')]({'where':{'FaxAccountId':_0x63314e[_0x809a('0x55')]['id']},'transaction':_0x580dfa})['then'](function(_0xf0a3bc){var _0x2a5527=_[_0x809a('0x4c')](_0x63314e[_0x809a('0x59')],function(_0x1b3bf0){_0x1b3bf0[_0x809a('0x61')]=_0x63314e['params']['id'];return _0x1b3bf0;});return db['FaxApplication'][_0x809a('0x7d')](_0x2a5527,{'transaction':_0x580dfa});});})[_0x809a('0x22')](function(){return db[_0x809a('0x7c')][_0x809a('0x7e')]({'where':{'FaxAccountId':_0x63314e['params']['id']},'order':'priority'});});}})[_0x809a('0x22')](respondWithResult(_0x57dd00,null))[_0x809a('0x2b')](handleError(_0x57dd00,null));};exports[_0x809a('0x7f')]=function(_0x4f4f8f,_0x61bbda,_0x175424){var _0x570038={};var _0x21ad4e={};var _0x4f8588;var _0x1cab96;return db[_0x809a('0x3d')][_0x809a('0x6a')]({'where':{'id':_0x4f4f8f['params']['id']}})[_0x809a('0x22')](handleEntityNotFound(_0x61bbda,null))['then'](function(_0x311e8b){if(_0x311e8b){_0x4f8588=_0x311e8b;_0x21ad4e['model']=_['keys'](db[_0x809a('0x7c')][_0x809a('0x3e')]);_0x21ad4e[_0x809a('0x41')]=_['keys'](_0x4f4f8f[_0x809a('0x41')]);_0x21ad4e[_0x809a('0x42')]=_[_0x809a('0x43')](_0x21ad4e['model'],_0x21ad4e[_0x809a('0x41')]);_0x570038[_0x809a('0x44')]=_['intersection'](_0x21ad4e[_0x809a('0x3f')],qs[_0x809a('0x45')](_0x4f4f8f['query'][_0x809a('0x45')]));_0x570038[_0x809a('0x44')]=_0x570038[_0x809a('0x44')]['length']?_0x570038[_0x809a('0x44')]:_0x21ad4e['model'];_0x570038[_0x809a('0x48')]=qs[_0x809a('0x49')](_0x4f4f8f['query'][_0x809a('0x49')]);_0x570038['where']=qs[_0x809a('0x42')](_['pick'](_0x4f4f8f[_0x809a('0x41')],_0x21ad4e[_0x809a('0x42')]));if(_0x4f4f8f[_0x809a('0x41')][_0x809a('0x4f')]){_0x570038[_0x809a('0x4a')]=_[_0x809a('0x4b')](_0x570038[_0x809a('0x4a')],{'$or':_['map'](_0x570038[_0x809a('0x44')],function(_0x31b751){var _0x52b4d8={};_0x52b4d8[_0x31b751]={'$like':'%'+_0x4f4f8f[_0x809a('0x41')][_0x809a('0x4f')]+'%'};return _0x52b4d8;})});}_0x570038=_[_0x809a('0x4b')]({},_0x570038,_0x4f4f8f[_0x809a('0x50')]);return _0x4f8588['getApplications'](_0x570038);}})[_0x809a('0x22')](function(_0x5519ce){if(_0x5519ce){_0x1cab96=_0x5519ce[_0x809a('0x6b')];if(!_0x4f4f8f[_0x809a('0x41')][_0x809a('0x46')](_0x809a('0x47'))){_0x570038[_0x809a('0x30')]=qs['limit'](_0x4f4f8f[_0x809a('0x41')][_0x809a('0x30')]);_0x570038['offset']=qs[_0x809a('0x2f')](_0x4f4f8f[_0x809a('0x41')]['offset']);}return _0x4f8588[_0x809a('0x7f')](_0x570038);}})[_0x809a('0x22')](function(_0x49b53e){if(_0x49b53e){return _0x49b53e?{'count':_0x1cab96,'rows':_0x49b53e}:null;}})[_0x809a('0x22')](respondWithResult(_0x61bbda,null))[_0x809a('0x2b')](handleError(_0x61bbda,null));};function Extension(_0x1b9a9e,_0x36df45,_0x44724a,_0x4921d0){this[_0x809a('0x80')]=_0x809a('0x81');this[_0x809a('0x82')]=_0x1b9a9e[_0x809a('0x83')];this[_0x809a('0x84')]=_0x4921d0;this['type']='system';this[_0x809a('0x85')]=_0x809a('0x86');this[_0x809a('0x61')]=_0x1b9a9e['id'];this[_0x809a('0x87')]=_0x36df45;this[_0x809a('0x88')]=_0x44724a;}function createExtensionsReciveFax(_0x3c6ade){var _0x22e5b4=0x1;var _0x43fa4b=[];_0x43fa4b[_0x809a('0x89')](new Extension(_0x3c6ade,_0x22e5b4,'',_0x809a('0x8a')));_0x22e5b4+=0x1;_0x43fa4b[_0x809a('0x89')](new Extension(_0x3c6ade,_0x22e5b4,_0x809a('0x8b'),'Set'));_0x22e5b4+=0x1;for(var _0x588bc1 in _0x3c6ade){if(_0x3c6ade[_0x809a('0x46')](_0x588bc1)&&(_0x588bc1===_0x809a('0x8c')||_0x588bc1===_0x809a('0x83')||_0x588bc1===_0x809a('0x8d')||_0x588bc1===_0x809a('0x8e')||_0x588bc1===_0x809a('0x8f')||_0x588bc1===_0x809a('0x90')||_0x588bc1==='minrate'||_0x588bc1===_0x809a('0x91')||_0x588bc1===_0x809a('0x92'))){_0x43fa4b[_0x809a('0x89')](new Extension(_0x3c6ade,_0x22e5b4,_0x809a('0x93')+_0x588bc1+')='+_0x3c6ade[_0x588bc1],_0x809a('0x94')));_0x22e5b4+=0x1;}}_0x43fa4b[_0x809a('0x89')](new Extension(_0x3c6ade,_0x22e5b4,'6',_0x809a('0x95')));_0x22e5b4+=0x1;_0x43fa4b[_0x809a('0x89')](new Extension(_0x3c6ade,_0x22e5b4,_0x809a('0x96'),_0x809a('0x97')));_0x22e5b4=0x0;return _0x43fa4b;}exports[_0x809a('0x98')]=function(_0x14359e,_0x241f24,_0x40f948){var _0x26fdc3;return db['sequelize']['transaction'](function(_0x4948a3){return db[_0x809a('0x3d')][_0x809a('0x58')](_0x14359e[_0x809a('0x59')],{'transaction':_0x4948a3})[_0x809a('0x22')](function(_0x513d73){_0x26fdc3=_0x513d73[_0x809a('0x37')]({'plain':!![]});return db[_0x809a('0x99')][_0x809a('0x7d')](createExtensionsReciveFax(_0x26fdc3),{'transaction':_0x4948a3});});})[_0x809a('0x22')](function(){return _0x26fdc3;})[_0x809a('0x22')](respondWithResult(_0x241f24,null))[_0x809a('0x2b')](handleError(_0x241f24,null));};exports['updateAccountApplications']=function(_0x14421a,_0x5269c,_0x315f1d){var _0x7b974e;return db['sequelize'][_0x809a('0x7b')](function(_0x470a3d){return db[_0x809a('0x3d')]['update'](_0x14421a[_0x809a('0x59')],{'where':{'id':_0x14421a[_0x809a('0x59')]['id']},'transaction':_0x470a3d})['then'](function(_0x2c735b){return db[_0x809a('0x99')][_0x809a('0x36')]({'where':{'FaxAccountId':_0x14421a['body']['id']},'transaction':_0x470a3d})[_0x809a('0x22')](function(_0x542f91){return db['VoiceExtension'][_0x809a('0x7d')](createExtensionsReciveFax(_[_0x809a('0x6e')](_0x14421a['body'],[_0x809a('0x9a'),_0x809a('0x4d'),_0x809a('0x9b'),_0x809a('0x9c'),_0x809a('0x9d'),_0x809a('0x9e')])),{'transaction':_0x470a3d});});});})[_0x809a('0x22')](function(){return db['FaxAccount'][_0x809a('0x9f')](_0x14421a[_0x809a('0x59')]['id']);})[_0x809a('0x22')](respondWithResult(_0x5269c,null))['catch'](handleError(_0x5269c,null));};exports[_0x809a('0xa0')]=function(_0x5767a8,_0x221bc6,_0x3cb718){var _0xaad2e9={'raw':!![],'where':{}};var _0x105c35={};var _0x7d534a={'count':0x0,'rows':[]};return db[_0x809a('0x3d')][_0x809a('0x6a')]({'where':{'id':_0x5767a8[_0x809a('0x55')]['id']}})[_0x809a('0x22')](handleEntityNotFound(_0x221bc6,null))[_0x809a('0x22')](function(_0xdc101c){if(_0xdc101c){_0x105c35[_0x809a('0x3f')]=_['keys'](db[_0x809a('0xa1')][_0x809a('0x3e')]);_0x105c35[_0x809a('0x41')]=_[_0x809a('0x40')](_0x5767a8['query']);_0x105c35[_0x809a('0x42')]=_[_0x809a('0x43')](_0x105c35['model'],_0x105c35[_0x809a('0x41')]);_0xaad2e9[_0x809a('0x44')]=_['intersection'](_0x105c35['model'],qs[_0x809a('0x45')](_0x5767a8['query'][_0x809a('0x45')]));_0xaad2e9[_0x809a('0x44')]=_0xaad2e9[_0x809a('0x44')]['length']?_0xaad2e9['attributes']:_0x105c35['model'];if(!_0x5767a8[_0x809a('0x41')][_0x809a('0x46')](_0x809a('0x47'))){_0xaad2e9[_0x809a('0x30')]=qs[_0x809a('0x30')](_0x5767a8[_0x809a('0x41')]['limit']);_0xaad2e9['offset']=qs[_0x809a('0x2f')](_0x5767a8['query'][_0x809a('0x2f')]);}_0xaad2e9['order']=qs[_0x809a('0x49')](_0x5767a8[_0x809a('0x41')]['sort']);_0xaad2e9[_0x809a('0x4a')]=qs[_0x809a('0x42')](_[_0x809a('0x64')](_0x5767a8[_0x809a('0x41')],_0x105c35['filters']));_0xaad2e9['where'][_0x809a('0x61')]=_0xdc101c['id'];if(_0x5767a8[_0x809a('0x41')][_0x809a('0x4f')]){_0xaad2e9[_0x809a('0x4a')]=_['merge'](_0xaad2e9[_0x809a('0x4a')],{'$or':_['map'](_0xaad2e9['attributes'],function(_0x39dd6a){var _0x56befd={};_0x56befd[_0x39dd6a]={'$like':'%'+_0x5767a8[_0x809a('0x41')]['filter']+'%'};return _0x56befd;})});}if(_0x5767a8[_0x809a('0x41')][_0x809a('0xa2')]){var _0x56dee6=_0x5767a8[_0x809a('0x41')][_0x809a('0xa2')]['split'](',');var _0x43b23f={};_0x43b23f[_0x56dee6[0x0]]={'$gte':moment(_0x56dee6[0x1])[_0x809a('0xa3')](_0x809a('0xa4'))};_0xaad2e9[_0x809a('0x4a')]=_[_0x809a('0x4b')](_0xaad2e9[_0x809a('0x4a')],_0x43b23f);}_0xaad2e9=_[_0x809a('0x4b')]({},_0xaad2e9,_0x5767a8[_0x809a('0x50')]);return db['FaxMessage'][_0x809a('0x65')]({'where':_0xaad2e9['where']})[_0x809a('0x22')](function(_0xf78c6e){_0x7d534a[_0x809a('0x65')]=_0xf78c6e;if(_0x5767a8[_0x809a('0x41')][_0x809a('0x51')]){_0xaad2e9['include']=[{'all':!![]}];}return db[_0x809a('0xa1')][_0x809a('0x53')](_0xaad2e9);})[_0x809a('0x22')](function(_0x1bf589){_0x7d534a[_0x809a('0x54')]=_0x1bf589;return _0x7d534a;});}})[_0x809a('0x22')](respondWithFilteredResult(_0x221bc6,_0xaad2e9))[_0x809a('0x2b')](handleError(_0x221bc6,null));};exports['send']=function(_0x40b52f,_0x71f520,_0x51f1f9){var _0x9aa8b3,_0x187aee={},_0x44f9f3;if(_0x40b52f[_0x809a('0x59')]['to']){_0x44f9f3=_0x40b52f[_0x809a('0x59')]['to'][0x0];}return db[_0x809a('0x3d')]['find']({'where':{'id':_0x40b52f['params']['id']},'include':[{'model':db[_0x809a('0xa5')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x44f9f3},'limit':0x1,'order':[['updatedAt',_0x809a('0xa6')]]}]}]})[_0x809a('0x22')](handleEntityNotFound(_0x71f520,null))[_0x809a('0x22')](function(_0x335e1d){_0x9aa8b3=_0x335e1d;if(_0x40b52f[_0x809a('0x59')][_0x809a('0xa7')]&&_0x40b52f[_0x809a('0x59')]['attachments']['length']){for(var _0x330095=0x0;_0x330095<_0x40b52f[_0x809a('0x59')][_0x809a('0xa7')][_0x809a('0x6b')];_0x330095+=0x1){_0x40b52f[_0x809a('0x59')][_0x809a('0xa7')][_0x330095]={'filename':_0x40b52f[_0x809a('0x59')][_0x809a('0xa7')][_0x330095][_0x809a('0x3b')],'id':_0x40b52f[_0x809a('0x59')]['attachments'][_0x330095]['id'],'path':path[_0x809a('0xa8')](config['root'],_0x809a('0xa9'),_0x40b52f[_0x809a('0x59')][_0x809a('0xa7')][_0x330095]['basename'])};}}return respondWithRpcPromise(_0x809a('0xaa'),_0x809a('0xaa'),{'FaxAccountId':_[_0x809a('0xab')](_0x40b52f[_0x809a('0x55')]['id'])?undefined:_0x40b52f[_0x809a('0x55')]['id'],'path':_[_0x809a('0xab')](_0x40b52f[_0x809a('0x59')][_0x809a('0xa7')][0x0]['path'])?undefined:_0x40b52f[_0x809a('0x59')][_0x809a('0xa7')][0x0][_0x809a('0x9')],'fax':_[_0x809a('0xab')](_0x40b52f['body']['to'][0x0])?undefined:_0x40b52f[_0x809a('0x59')]['to'][0x0]},client9002);})[_0x809a('0x22')](function(){if(_0x9aa8b3){if(_[_0x809a('0xab')](_0x40b52f[_0x809a('0x59')]['from'])){_0x40b52f[_0x809a('0x59')][_0x809a('0xac')]=util[_0x809a('0xa3')](_0x809a('0xad'),_0x9aa8b3[_0x809a('0x3b')],_0x9aa8b3[_0x809a('0xae')]);}if(_0x9aa8b3['List']){if(_0x9aa8b3[_0x809a('0xaf')][_0x809a('0xb0')][_0x809a('0x6b')]){return _0x9aa8b3[_0x809a('0xaf')]['Contacts'][0x0];}else{return db[_0x809a('0xb1')][_0x809a('0x58')](_[_0x809a('0x1b')](_0x40b52f[_0x809a('0x59')],{'firstName':_0x40b52f[_0x809a('0x59')]['to'][0x0],'phone':_0x40b52f[_0x809a('0x59')]['to'][0x0],'fax':_0x40b52f['body']['to'][0x0],'ListId':_0x9aa8b3[_0x809a('0x9e')]}));}}else{throw new Error(_0x809a('0xb2'));}}else{throw new Error(_0x809a('0xb3'));}})[_0x809a('0x22')](function(_0x9f35a6){if(_0x9f35a6){return db[_0x809a('0x78')][_0x809a('0x5c')]({'where':{'ContactId':_0x9f35a6['id'],'closed':![],'FaxAccountId':_0x9aa8b3['id']}})[_0x809a('0x22')](function(_0x2a9677){if(_0x2a9677){return[_0x2a9677,![]];}return db['FaxInteraction'][_0x809a('0x58')]({'UserId':_0x40b52f[_0x809a('0x5a')]['id'],'ContactId':_0x9f35a6['id'],'FaxAccountId':_0x9aa8b3['id'],'fax':_0x40b52f[_0x809a('0x59')]['to'][0x0],'firstMsgDirection':_0x809a('0xb4'),'Messages':[_[_0x809a('0x4b')](_0x40b52f[_0x809a('0x59')],{'read':![],'body':_0x40b52f['body'][_0x809a('0xa7')][0x0][_0x809a('0xb5')],'FaxAccountId':_0x9aa8b3['id'],'UserId':_0x40b52f[_0x809a('0x5a')]['id'],'ContactId':_0x9f35a6['id'],'AttachmentId':_0x40b52f[_0x809a('0x59')][_0x809a('0xa7')][0x0]['id']})]},{'include':[{'model':db[_0x809a('0xa1')],'as':_0x809a('0xb6')}]})['then'](function(_0x4d529d){return[_0x4d529d,!![]];});});}else{throw new Error(_0x809a('0xb7'));}})[_0x809a('0xb8')](function(_0x3045ab,_0x1e6b87){if(_0x1e6b87){return _0x3045ab;}return db[_0x809a('0xa1')][_0x809a('0x58')]({'direction':_0x809a('0xb4'),'read':![],'body':_0x40b52f['body'][_0x809a('0xa7')][0x0][_0x809a('0xb5')],'FaxAccountId':_0x9aa8b3['id'],'FaxInteractionId':_0x3045ab['id'],'UserId':_0x40b52f[_0x809a('0x5a')]['id'],'ContactId':_0x3045ab[_0x809a('0xb9')],'AttachmentId':_0x40b52f['body'][_0x809a('0xa7')][0x0]['id']})[_0x809a('0x22')](function(_0x35c27c){_0x3045ab[_0x809a('0xba')][_0x809a('0xb6')]=[];_0x3045ab['dataValues'][_0x809a('0xb6')][_0x809a('0x89')](_0x35c27c[_0x809a('0xba')]);return _0x3045ab;});})['then'](function(_0x450eb4){respondWithRpcPromise(_0x809a('0xbb'),_0x809a('0xbb'),{'FaxAccountId':_[_0x809a('0xab')](_0x40b52f[_0x809a('0x55')]['id'])?undefined:_0x40b52f[_0x809a('0x55')]['id'],'path':_[_0x809a('0xab')](_0x40b52f[_0x809a('0x59')]['attachments'][0x0][_0x809a('0x9')])?undefined:_0x40b52f['body'][_0x809a('0xa7')][0x0][_0x809a('0x9')],'fax':_[_0x809a('0xab')](_0x40b52f['body']['to'][0x0])?undefined:_0x40b52f['body']['to'][0x0],'AttachmentId':_0x40b52f['body'][_0x809a('0xa7')][0x0]['id']},client9002)[_0x809a('0x22')](function(_0x17b2b6){logger[_0x809a('0x29')](_0x809a('0xbc'),_0x17b2b6);})['catch'](function(_0x358ce3){logger['info'](_0x809a('0xbc'),_0x358ce3);});return _0x450eb4;})[_0x809a('0x22')](respondWithResult(_0x71f520,null))[_0x809a('0x2b')](handleError(_0x71f520,null));};exports[_0x809a('0xbd')]=function(_0x44b14a,_0x40bda6,_0x2f8ae1){return db['FaxAccount'][_0x809a('0x5c')]({'where':{'id':_0x44b14a[_0x809a('0x55')]['id']}})[_0x809a('0x22')](handleEntityNotFound(_0x40bda6,null))[_0x809a('0x22')](function(_0x3d9fc8){if(_0x3d9fc8){return _0x3d9fc8[_0x809a('0xbd')](_0x44b14a[_0x809a('0x59')]['ids'],_['omit'](_0x44b14a[_0x809a('0x59')],['ids','id'])||{})[_0x809a('0xb8')](function(_0x3a49c4){for(var _0x28b851=0x0;_0x28b851<_0x44b14a[_0x809a('0x59')]['ids'][_0x809a('0x6b')];_0x28b851+=0x1){socket['emit'](_0x809a('0xbe'),{'UserId':_0x44b14a[_0x809a('0x59')][_0x809a('0x67')][_0x28b851],'FaxAccountId':_0x44b14a['params']['id']});}return _0x3a49c4;});}})[_0x809a('0x22')](respondWithResult(_0x40bda6,null))[_0x809a('0x2b')](handleError(_0x40bda6,null));};exports[_0x809a('0xbf')]=function(_0x3db7c8,_0x1bd5b4,_0x1ad13f){var _0x380aaf;return db[_0x809a('0x3d')][_0x809a('0x5c')]({'where':{'id':_0x3db7c8[_0x809a('0x55')]['id']}})[_0x809a('0x22')](handleEntityNotFound(_0x1bd5b4,null))['then'](function(_0x1246d5){if(_0x1246d5){return _0x1246d5['removeAgents'](_0x3db7c8[_0x809a('0x41')][_0x809a('0x67')])['then'](function(_0x2a4b7b){if(_[_0x809a('0xc0')](_0x3db7c8[_0x809a('0x41')]['ids'])){for(var _0x385c2b=0x0;_0x385c2b<_0x3db7c8[_0x809a('0x41')][_0x809a('0x67')]['length'];_0x385c2b+=0x1){socket[_0x809a('0xc1')]('userFaxAccount:remove',{'UserId':_0x3db7c8[_0x809a('0x41')][_0x809a('0x67')][_0x385c2b],'FaxAccountId':_0x3db7c8[_0x809a('0x55')]['id']});}}else{socket[_0x809a('0xc1')](_0x809a('0xc2'),{'UserId':_0x3db7c8[_0x809a('0x41')][_0x809a('0x67')],'FaxAccountId':_0x3db7c8['params']['id']});}});}})[_0x809a('0x22')](respondWithStatusCode(_0x1bd5b4,null))[_0x809a('0x2b')](handleError(_0x1bd5b4,null));};exports[_0x809a('0xc3')]=function(_0x2cdaa7,_0x4c0328,_0x4a69e0){var _0x211a45={};var _0xd0783c={};var _0xe8767e;var _0x6b8a3b;return db[_0x809a('0x3d')]['findOne']({'where':{'id':_0x2cdaa7[_0x809a('0x55')]['id']}})[_0x809a('0x22')](handleEntityNotFound(_0x4c0328,null))[_0x809a('0x22')](function(_0x205b74){if(_0x205b74){_0xe8767e=_0x205b74;_0xd0783c[_0x809a('0x3f')]=_[_0x809a('0x40')](db[_0x809a('0x71')]['rawAttributes']);_0xd0783c['query']=_[_0x809a('0x40')](_0x2cdaa7[_0x809a('0x41')]);_0xd0783c['filters']=_[_0x809a('0x43')](_0xd0783c['model'],_0xd0783c[_0x809a('0x41')]);_0x211a45['attributes']=_[_0x809a('0x43')](_0xd0783c['model'],qs[_0x809a('0x45')](_0x2cdaa7['query'][_0x809a('0x45')]));_0x211a45[_0x809a('0x44')]=_0x211a45[_0x809a('0x44')]['length']?_0x211a45['attributes']:_0xd0783c['model'];_0x211a45['order']=qs[_0x809a('0x49')](_0x2cdaa7[_0x809a('0x41')][_0x809a('0x49')]);_0x211a45[_0x809a('0x4a')]=qs[_0x809a('0x42')](_[_0x809a('0x64')](_0x2cdaa7[_0x809a('0x41')],_0xd0783c[_0x809a('0x42')]));if(_0x2cdaa7[_0x809a('0x41')][_0x809a('0x4f')]){_0x211a45[_0x809a('0x4a')]=_[_0x809a('0x4b')](_0x211a45[_0x809a('0x4a')],{'$or':_['map'](_0x211a45[_0x809a('0x44')],function(_0x482c10){var _0x182ff5={};_0x182ff5[_0x482c10]={'$like':'%'+_0x2cdaa7[_0x809a('0x41')]['filter']+'%'};return _0x182ff5;})});}_0x211a45=_[_0x809a('0x4b')]({},_0x211a45,_0x2cdaa7['options']);return _0xe8767e[_0x809a('0xc3')](_0x211a45);}})['then'](function(_0x48190a){if(_0x48190a){_0x6b8a3b=_0x48190a[_0x809a('0x6b')];if(!_0x2cdaa7['query']['hasOwnProperty'](_0x809a('0x47'))){_0x211a45[_0x809a('0x30')]=qs['limit'](_0x2cdaa7[_0x809a('0x41')][_0x809a('0x30')]);_0x211a45[_0x809a('0x2f')]=qs['offset'](_0x2cdaa7[_0x809a('0x41')][_0x809a('0x2f')]);}return _0xe8767e[_0x809a('0xc3')](_0x211a45);}})[_0x809a('0x22')](function(_0xd1ea72){if(_0xd1ea72){return _0xd1ea72?{'count':_0x6b8a3b,'rows':_0xd1ea72}:null;}})['then'](respondWithResult(_0x4c0328,null))[_0x809a('0x2b')](handleError(_0x4c0328,null));};
\ No newline at end of file
index 8733edf..a37ba67 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa222=['save','update','remove','emit','hasOwnProperty','exports','events','FaxAccount','setMaxListeners'];(function(_0x272d90,_0x5e70ff){var _0x2bf4a2=function(_0x544da6){while(--_0x544da6){_0x272d90['push'](_0x272d90['shift']());}};_0x2bf4a2(++_0x5e70ff);}(_0xa222,0xde));var _0x2a22=function(_0x3a0863,_0x4cd5ef){_0x3a0863=_0x3a0863-0x0;var _0x85c557=_0xa222[_0x3a0863];return _0x85c557;};'use strict';var EventEmitter=require(_0x2a22('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x2a22('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x2a22('0x2')](0x0);var events={'afterCreate':_0x2a22('0x3'),'afterUpdate':_0x2a22('0x4'),'afterDestroy':_0x2a22('0x5')};function emitEvent(_0x269053){return function(_0x5e16b7,_0x143a0e,_0x29e35b){FaxAccountEvents[_0x2a22('0x6')](_0x269053+':'+_0x5e16b7['id'],_0x5e16b7);FaxAccountEvents[_0x2a22('0x6')](_0x269053,_0x5e16b7);_0x29e35b(null);};}for(var e in events){if(events[_0x2a22('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x2a22('0x8')]=FaxAccountEvents;
\ No newline at end of file
+var _0xc59e=['exports','events','../../mysqldb','FaxAccount','remove','emit'];(function(_0x4a346c,_0x52e058){var _0x2b4c13=function(_0x10a099){while(--_0x10a099){_0x4a346c['push'](_0x4a346c['shift']());}};_0x2b4c13(++_0x52e058);}(_0xc59e,0xf1));var _0xec59=function(_0x1fa0d4,_0x34ce95){_0x1fa0d4=_0x1fa0d4-0x0;var _0x42aaae=_0xc59e[_0x1fa0d4];return _0x42aaae;};'use strict';var EventEmitter=require(_0xec59('0x0'));var FaxAccount=require(_0xec59('0x1'))['db'][_0xec59('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xec59('0x3')};function emitEvent(_0x1f6a7e){return function(_0x2033e5,_0x4e8c3c,_0x42e693){FaxAccountEvents['emit'](_0x1f6a7e+':'+_0x2033e5['id'],_0x2033e5);FaxAccountEvents[_0xec59('0x4')](_0x1f6a7e,_0x2033e5);_0x42e693(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xec59('0x5')]=FaxAccountEvents;
\ No newline at end of file
index 7915c25..6a4239b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0762=['../../config/logger','api','moment','request-promise','./faxAccount.attributes','define','FaxAccount','fax_accounts','util'];(function(_0x302961,_0x4bb394){var _0x2b0704=function(_0x48ddf2){while(--_0x48ddf2){_0x302961['push'](_0x302961['shift']());}};_0x2b0704(++_0x4bb394);}(_0x0762,0x1e5));var _0x2076=function(_0x228b46,_0x6268b6){_0x228b46=_0x228b46-0x0;var _0x472296=_0x0762[_0x228b46];return _0x472296;};'use strict';var _=require('lodash');var util=require(_0x2076('0x0'));var logger=require(_0x2076('0x1'))(_0x2076('0x2'));var moment=require(_0x2076('0x3'));var BPromise=require('bluebird');var rp=require(_0x2076('0x4'));var attributes=require(_0x2076('0x5'));module['exports']=function(_0x4dc543,_0x734461){return _0x4dc543[_0x2076('0x6')](_0x2076('0x7'),attributes,{'tableName':_0x2076('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xb65a=['lodash','api','moment','bluebird','exports','FaxAccount'];(function(_0x3227d7,_0x50778b){var _0x3be5d0=function(_0xb23175){while(--_0xb23175){_0x3227d7['push'](_0x3227d7['shift']());}};_0x3be5d0(++_0x50778b);}(_0xb65a,0x114));var _0xab65=function(_0x383b61,_0x505fcf){_0x383b61=_0x383b61-0x0;var _0x314e78=_0xb65a[_0x383b61];return _0x314e78;};'use strict';var _=require(_0xab65('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xab65('0x1'));var moment=require(_0xab65('0x2'));var BPromise=require(_0xab65('0x3'));var rp=require('request-promise');var attributes=require('./faxAccount.attributes');module[_0xab65('0x4')]=function(_0x39447c,_0x35b3e6){return _0x39447c['define'](_0xab65('0x5'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 6899bca..160dc23 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd38d=['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','find','account','CmList','CmContact','Contacts','DESC','FaxApplication','Applications','List','applications','orderBy','asc','create','spread','get','autoclose','push','length','close','unmanaged','created','interaction','FaxMessage','ContactId','UserId','name','*,*,*,*','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','FaxAccount,\x20%s,\x20%s','message','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','include','map','model','catch','body','fax','describe','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','keys','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','isNil'];(function(_0x1347f8,_0x233feb){var _0x218368=function(_0x3f4ca3){while(--_0x3f4ca3){_0x1347f8['push'](_0x1347f8['shift']());}};_0x218368(++_0x233feb);}(_0xd38d,0x1cb));var _0xdd38=function(_0x2d3d0d,_0x67ac82){_0x2d3d0d=_0x2d3d0d-0x0;var _0xca35b6=_0xd38d[_0x2d3d0d];return _0xca35b6;};'use strict';var _=require(_0xdd38('0x0'));var util=require(_0xdd38('0x1'));var moment=require(_0xdd38('0x2'));var BPromise=require(_0xdd38('0x3'));var rs=require(_0xdd38('0x4'));var fs=require('fs');var Redis=require(_0xdd38('0x5'));var db=require(_0xdd38('0x6'))['db'];var utils=require(_0xdd38('0x7'));var logger=require(_0xdd38('0x8'))('rpc');var config=require(_0xdd38('0x9'));var jayson=require(_0xdd38('0xa'));var client=jayson[_0xdd38('0xb')][_0xdd38('0xc')]({'port':0x232c});config[_0xdd38('0xd')]=_['defaults'](config['redis'],{'host':_0xdd38('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdd38('0xd')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x162237,_0x59c563,_0xb08f67){return new BPromise(function(_0x11c9f5,_0x7d435c){return client[_0xdd38('0xf')](_0x162237,_0xb08f67)[_0xdd38('0x10')](function(_0x5759aa){logger[_0xdd38('0x11')]('FaxAccount,\x20%s,\x20%s',_0x59c563,_0xdd38('0x12'));logger[_0xdd38('0x13')](_0xdd38('0x14'),_0x59c563,'request\x20sent',JSON[_0xdd38('0x15')](_0x5759aa));if(_0x5759aa[_0xdd38('0x16')]){if(_0x5759aa[_0xdd38('0x16')]['code']===0x1f4){logger['error'](_0xdd38('0x17'),_0x59c563,_0x5759aa[_0xdd38('0x16')][_0xdd38('0x18')]);return _0x7d435c(_0x5759aa[_0xdd38('0x16')][_0xdd38('0x18')]);}logger[_0xdd38('0x16')](_0xdd38('0x17'),_0x59c563,_0x5759aa[_0xdd38('0x16')][_0xdd38('0x18')]);return _0x11c9f5(_0x5759aa[_0xdd38('0x16')][_0xdd38('0x18')]);}else{logger[_0xdd38('0x11')](_0xdd38('0x17'),_0x59c563,'request\x20sent');_0x11c9f5(_0x5759aa['result'][_0xdd38('0x18')]);}})['catch'](function(_0x146e55){logger[_0xdd38('0x16')](_0xdd38('0x17'),_0x59c563,_0x146e55);_0x7d435c(_0x146e55);});});}exports[_0xdd38('0x19')]=function(_0x59c17f){var _0x196c00=this;return new Promise(function(_0x3c8adb,_0x5aca5e){return db[_0xdd38('0x1a')][_0xdd38('0x1b')]({'raw':_0x59c17f[_0xdd38('0x1c')]?_0x59c17f[_0xdd38('0x1c')][_0xdd38('0x1d')]===undefined?!![]:![]:!![],'where':_0x59c17f['options']?_0x59c17f[_0xdd38('0x1c')][_0xdd38('0x1e')]||null:null,'attributes':_0x59c17f[_0xdd38('0x1c')]?_0x59c17f['options'][_0xdd38('0x1f')]||null:null,'limit':_0x59c17f[_0xdd38('0x1c')]?_0x59c17f[_0xdd38('0x1c')]['limit']||null:null,'include':_0x59c17f[_0xdd38('0x1c')]?_0x59c17f[_0xdd38('0x1c')][_0xdd38('0x20')]?_[_0xdd38('0x21')](_0x59c17f[_0xdd38('0x1c')]['include'],function(_0x2c72b6){return{'model':db[_0x2c72b6[_0xdd38('0x22')]],'as':_0x2c72b6['as'],'attributes':_0x2c72b6[_0xdd38('0x1f')],'include':_0x2c72b6[_0xdd38('0x20')]?_[_0xdd38('0x21')](_0x2c72b6['include'],function(_0x1c564c){return{'model':db[_0x1c564c['model']],'as':_0x1c564c['as'],'attributes':_0x1c564c[_0xdd38('0x1f')],'include':_0x1c564c[_0xdd38('0x20')]?_['map'](_0x1c564c[_0xdd38('0x20')],function(_0x1d7fb6){return{'model':db[_0x1d7fb6[_0xdd38('0x22')]],'as':_0x1d7fb6['as'],'attributes':_0x1d7fb6['attributes']};}):[]};}):[]};}):[]:[]})[_0xdd38('0x10')](function(_0x1a4a33){logger['info'](_0xdd38('0x19'),_0x59c17f);logger['debug']('GetFaxAccount',_0x59c17f,JSON[_0xdd38('0x15')](_0x1a4a33));_0x3c8adb(_0x1a4a33);})[_0xdd38('0x23')](function(_0x14abd8){logger[_0xdd38('0x16')](_0xdd38('0x19'),_0x14abd8[_0xdd38('0x18')],_0x59c17f);_0x5aca5e(_0x196c00['error'](0x1f4,_0x14abd8[_0xdd38('0x18')]));});});};exports['NotifyFaxAccount']=function(_0x5edd60,_0x5e935e,_0x7c6cd0){var _0x39a467=this;return new Promise(function(_0x2546c3,_0x24ed58){var _0x1e4321={'body':_0x5edd60[_0xdd38('0x24')],'channel':_0xdd38('0x25')};var _0x149018=[];var _0xe1cbee=[];var _0x10f426={};return db['CmContact'][_0xdd38('0x26')]()['then'](function(_0x23b12b){if(!_0x23b12b){throw new db['Sequelize'][(_0xdd38('0x27'))](_0xdd38('0x28'));}_0x149018=_['difference'](_['keys'](_0x23b12b),[_0xdd38('0x29'),_0xdd38('0x2a')]);_0xe1cbee=_[_0xdd38('0x2b')](_[_0xdd38('0x2c')](_0x23b12b),[_0xdd38('0x29'),_0xdd38('0x2a'),_0xdd38('0x2d'),_0xdd38('0x2e')]);if(_0x5edd60[_0xdd38('0x24')]['id']){delete _0x5edd60[_0xdd38('0x24')]['id'];}if(_['isNil'](_0x5edd60[_0xdd38('0x24')][_0xdd38('0x2f')])){throw new db[(_0xdd38('0x30'))]['ValidationError'](_0xdd38('0x31'));}if(_[_0xdd38('0x32')](_0x5edd60[_0xdd38('0x24')]['body'])||_0x5edd60['body'][_0xdd38('0x24')]===''){throw new db[(_0xdd38('0x30'))]['ValidationError'](_0xdd38('0x33'));}if(_['isNil'](_0x5edd60[_0xdd38('0x24')][_0xdd38('0x34')])){throw new db[(_0xdd38('0x30'))][(_0xdd38('0x27'))](_0xdd38('0x35')+_0xe1cbee);}if(!_[_0xdd38('0x36')](_0xe1cbee,_0x5edd60[_0xdd38('0x24')][_0xdd38('0x34')])){throw new db[(_0xdd38('0x30'))]['ValidationError'](_0xdd38('0x37')+_0xe1cbee);}_0x10f426[_0x5edd60[_0xdd38('0x24')][_0xdd38('0x34')]]=_0x5edd60[_0xdd38('0x24')][_0xdd38('0x2f')];})[_0xdd38('0x10')](function(){return db[_0xdd38('0x1a')][_0xdd38('0x38')]({'where':{'id':_0x5edd60[_0xdd38('0x39')]['id']},'include':[{'model':db[_0xdd38('0x3a')],'as':'List','include':[{'model':db[_0xdd38('0x3b')],'as':_0xdd38('0x3c'),'where':_0x10f426,'limit':0x1,'order':[[_0xdd38('0x2a'),_0xdd38('0x3d')]]}]},{'model':db[_0xdd38('0x3e')],'as':_0xdd38('0x3f')}]});})[_0xdd38('0x10')](function(_0x37a7c7){if(_0x37a7c7&&_0x37a7c7[_0xdd38('0x40')]){var _0x223d57=_0x37a7c7['get']({'plain':!![]});_0x1e4321[_0xdd38('0x39')]=_0x223d57;_0x1e4321['applications']=_0x223d57['Applications'];_0x1e4321['list']=_0x223d57[_0xdd38('0x40')];_0x1e4321[_0xdd38('0x41')]=_[_0xdd38('0x42')](_0x1e4321['applications'],['priority'],[_0xdd38('0x43')]);if(_0x1e4321[_0xdd38('0x39')]['Applications']){delete _0x1e4321[_0xdd38('0x39')]['Applications'];}if(_0x1e4321[_0xdd38('0x39')][_0xdd38('0x40')]&&_0x1e4321[_0xdd38('0x39')]['List'][_0xdd38('0x3c')]['length']){return _0x1e4321[_0xdd38('0x39')][_0xdd38('0x40')][_0xdd38('0x3c')][0x0];}var _0x419fdb=_['defaults'](_0x5edd60['body'],{'firstName':_0x5edd60[_0xdd38('0x24')][_0xdd38('0x2f')],'ListId':_0x223d57[_0xdd38('0x2e')]});_0x419fdb[_0x5edd60['body']['mapKey']]=_0x5edd60[_0xdd38('0x24')][_0xdd38('0x2f')];return db['CmContact'][_0xdd38('0x44')](_0x419fdb,{'fields':_0x149018,'raw':!![]});}})[_0xdd38('0x10')](function(_0x1ea363){_0x1e4321['contact']=_0x1ea363;if(_0x1ea363){var _0x366969={'ContactId':_0x1ea363['id'],'FaxAccountId':_0x5edd60['account']['id'],'fax':_0x1ea363['fax']};return db['FaxInteraction'][_0xdd38('0x38')]({'where':{'ContactId':_0x1ea363['id'],'closed':![],'FaxAccountId':_0x5edd60[_0xdd38('0x39')]['id']}})[_0xdd38('0x10')](function(_0x1f01b4){if(_0x1f01b4){return[_0x1f01b4,![]];}return db['FaxInteraction']['create'](_0x366969)['then'](function(_0x248df8){return[_0x248df8,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xdd38('0x45')](function(_0xda3404,_0x53079){var _0x4caefd=_0xda3404[_0xdd38('0x46')]({'plain':!![]});if(_0x53079){if(_0x1e4321[_0xdd38('0x39')][_0xdd38('0x47')]){_0x1e4321['applications'][_0xdd38('0x48')]({'id':0x0,'priority':_0x1e4321[_0xdd38('0x41')][_0xdd38('0x49')]+0x1,'app':_0xdd38('0x4a'),'appdata':_0xdd38('0x4b'),'interval':'*,*,*,*'});}_0x4caefd[_0xdd38('0x4c')]=!![];}else{_0x4caefd[_0xdd38('0x4c')]=![];}_0x1e4321[_0xdd38('0x4d')]=_0x4caefd;return db[_0xdd38('0x4e')][_0xdd38('0x44')]({'body':_0x5edd60[_0xdd38('0x24')][_0xdd38('0x24')],'FaxAccountId':_0x5edd60[_0xdd38('0x39')]['id'],'FaxInteractionId':_0xda3404['id'],'direction':'in','ContactId':_0xda3404[_0xdd38('0x4f')],'AttachmentId':_0x5edd60[_0xdd38('0x24')]['AttachmentId']});})[_0xdd38('0x10')](function(_0x1284d){_0x1e4321['message']=_0x1284d;if(_0x1e4321['interaction'][_0xdd38('0x50')]){return db['User'][_0xdd38('0x38')]({'attributes':['id',_0xdd38('0x51')],'where':{'id':_0x1e4321[_0xdd38('0x4d')]['UserId']}})[_0xdd38('0x10')](function(_0x472d11){if(_0x472d11){_0x1e4321[_0xdd38('0x41')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x472d11['name']+','+(_0x1e4321['account']['waitForTheAssignedAgent']||0xa),'interval':_0xdd38('0x52')});}return respondWithRpcPromise(_0xdd38('0x53'),'startRouting',_0x1e4321);});}return respondWithRpcPromise('Start',_0xdd38('0x54'),_0x1e4321);})[_0xdd38('0x10')](function(_0x209ddf){_0x2546c3(_0x209ddf);})['catch'](function(_0x28eba0){_0x24ed58(_0x39a467['error'](0x1f4,_0x28eba0[_0xdd38('0x18')]));});});};
\ No newline at end of file
+var _0x8c2e=['orderBy','asc','defaults','ListId','contact','FaxInteraction','create','Contact\x20not\x20found','spread','push','length','unmanaged','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','waitForTheAssignedAgent','*,*,*,*','startRouting','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FaxAccount,\x20%s,\x20%s','message','result','GetFaxAccount','FaxAccount','findAll','raw','options','where','attributes','limit','include','map','model','then','debug','stringify','catch','NotifyFaxAccount','body','fax','CmContact','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','difference','isNil','from','Sequelize','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','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','applications'];(function(_0xb2a909,_0x12b1cc){var _0x347fc8=function(_0x1f43ed){while(--_0x1f43ed){_0xb2a909['push'](_0xb2a909['shift']());}};_0x347fc8(++_0x12b1cc);}(_0x8c2e,0x17f));var _0xe8c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8c2e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe8c2('0x0'));var util=require(_0xe8c2('0x1'));var moment=require(_0xe8c2('0x2'));var BPromise=require('bluebird');var rs=require(_0xe8c2('0x3'));var fs=require('fs');var Redis=require(_0xe8c2('0x4'));var db=require(_0xe8c2('0x5'))['db'];var utils=require(_0xe8c2('0x6'));var logger=require('../../config/logger')(_0xe8c2('0x7'));var config=require(_0xe8c2('0x8'));var jayson=require(_0xe8c2('0x9'));var client=jayson[_0xe8c2('0xa')]['http']({'port':0x232c});config[_0xe8c2('0xb')]=_['defaults'](config[_0xe8c2('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xe8c2('0xc'))(new Redis(config[_0xe8c2('0xb')]));require(_0xe8c2('0xd'))[_0xe8c2('0xe')](socket);function respondWithRpcPromise(_0x31be25,_0x76520c,_0x3eba75){return new BPromise(function(_0x59ae83,_0x375c0c){return client[_0xe8c2('0xf')](_0x31be25,_0x3eba75)['then'](function(_0x5e5c91){logger[_0xe8c2('0x10')]('FaxAccount,\x20%s,\x20%s',_0x76520c,'request\x20sent');logger['debug'](_0xe8c2('0x11'),_0x76520c,_0xe8c2('0x12'),JSON['stringify'](_0x5e5c91));if(_0x5e5c91[_0xe8c2('0x13')]){if(_0x5e5c91[_0xe8c2('0x13')][_0xe8c2('0x14')]===0x1f4){logger['error'](_0xe8c2('0x15'),_0x76520c,_0x5e5c91['error'][_0xe8c2('0x16')]);return _0x375c0c(_0x5e5c91['error']['message']);}logger[_0xe8c2('0x13')]('FaxAccount,\x20%s,\x20%s',_0x76520c,_0x5e5c91[_0xe8c2('0x13')][_0xe8c2('0x16')]);return _0x59ae83(_0x5e5c91[_0xe8c2('0x13')][_0xe8c2('0x16')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x76520c,_0xe8c2('0x12'));_0x59ae83(_0x5e5c91[_0xe8c2('0x17')]['message']);}})['catch'](function(_0x3a2f1d){logger[_0xe8c2('0x13')](_0xe8c2('0x15'),_0x76520c,_0x3a2f1d);_0x375c0c(_0x3a2f1d);});});}exports[_0xe8c2('0x18')]=function(_0x3efb86){var _0x25a3b0=this;return new Promise(function(_0x3ce022,_0x188dac){return db[_0xe8c2('0x19')][_0xe8c2('0x1a')]({'raw':_0x3efb86['options']?_0x3efb86['options'][_0xe8c2('0x1b')]===undefined?!![]:![]:!![],'where':_0x3efb86[_0xe8c2('0x1c')]?_0x3efb86[_0xe8c2('0x1c')][_0xe8c2('0x1d')]||null:null,'attributes':_0x3efb86[_0xe8c2('0x1c')]?_0x3efb86['options'][_0xe8c2('0x1e')]||null:null,'limit':_0x3efb86['options']?_0x3efb86[_0xe8c2('0x1c')][_0xe8c2('0x1f')]||null:null,'include':_0x3efb86[_0xe8c2('0x1c')]?_0x3efb86[_0xe8c2('0x1c')][_0xe8c2('0x20')]?_[_0xe8c2('0x21')](_0x3efb86['options'][_0xe8c2('0x20')],function(_0x28f0f2){return{'model':db[_0x28f0f2[_0xe8c2('0x22')]],'as':_0x28f0f2['as'],'attributes':_0x28f0f2['attributes'],'include':_0x28f0f2['include']?_[_0xe8c2('0x21')](_0x28f0f2[_0xe8c2('0x20')],function(_0x130129){return{'model':db[_0x130129[_0xe8c2('0x22')]],'as':_0x130129['as'],'attributes':_0x130129[_0xe8c2('0x1e')],'include':_0x130129[_0xe8c2('0x20')]?_[_0xe8c2('0x21')](_0x130129[_0xe8c2('0x20')],function(_0x1a2a52){return{'model':db[_0x1a2a52['model']],'as':_0x1a2a52['as'],'attributes':_0x1a2a52[_0xe8c2('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe8c2('0x23')](function(_0x4b5116){logger['info'](_0xe8c2('0x18'),_0x3efb86);logger[_0xe8c2('0x24')](_0xe8c2('0x18'),_0x3efb86,JSON[_0xe8c2('0x25')](_0x4b5116));_0x3ce022(_0x4b5116);})[_0xe8c2('0x26')](function(_0x5db050){logger[_0xe8c2('0x13')](_0xe8c2('0x18'),_0x5db050['message'],_0x3efb86);_0x188dac(_0x25a3b0[_0xe8c2('0x13')](0x1f4,_0x5db050[_0xe8c2('0x16')]));});});};exports[_0xe8c2('0x27')]=function(_0x21d737,_0x562fed,_0x4b405a){var _0x136793=this;return new Promise(function(_0x57c727,_0x2b7f7c){var _0x1364b0={'body':_0x21d737[_0xe8c2('0x28')],'channel':_0xe8c2('0x29')};var _0x1b7b86=[];var _0x3982a9=[];var _0x4e7eb9={};return db[_0xe8c2('0x2a')]['describe']()[_0xe8c2('0x23')](function(_0x1bebd1){if(!_0x1bebd1){throw new db['Sequelize'][(_0xe8c2('0x2b'))](_0xe8c2('0x2c'));}_0x1b7b86=_['difference'](_[_0xe8c2('0x2d')](_0x1bebd1),[_0xe8c2('0x2e'),_0xe8c2('0x2f')]);_0x3982a9=_[_0xe8c2('0x30')](_[_0xe8c2('0x2d')](_0x1bebd1),[_0xe8c2('0x2e'),_0xe8c2('0x2f'),'CompanyId','ListId']);if(_0x21d737[_0xe8c2('0x28')]['id']){delete _0x21d737['body']['id'];}if(_[_0xe8c2('0x31')](_0x21d737['body'][_0xe8c2('0x32')])){throw new db[(_0xe8c2('0x33'))][(_0xe8c2('0x2b'))](_0xe8c2('0x34'));}if(_[_0xe8c2('0x31')](_0x21d737[_0xe8c2('0x28')][_0xe8c2('0x28')])||_0x21d737['body'][_0xe8c2('0x28')]===''){throw new db['Sequelize'][(_0xe8c2('0x2b'))](_0xe8c2('0x35'));}if(_[_0xe8c2('0x31')](_0x21d737[_0xe8c2('0x28')][_0xe8c2('0x36')])){throw new db[(_0xe8c2('0x33'))]['ValidationError'](_0xe8c2('0x37')+_0x3982a9);}if(!_['includes'](_0x3982a9,_0x21d737['body'][_0xe8c2('0x36')])){throw new db[(_0xe8c2('0x33'))][(_0xe8c2('0x2b'))](_0xe8c2('0x38')+_0x3982a9);}_0x4e7eb9[_0x21d737['body'][_0xe8c2('0x36')]]=_0x21d737[_0xe8c2('0x28')][_0xe8c2('0x32')];})[_0xe8c2('0x23')](function(){return db[_0xe8c2('0x19')][_0xe8c2('0x39')]({'where':{'id':_0x21d737[_0xe8c2('0x3a')]['id']},'include':[{'model':db[_0xe8c2('0x3b')],'as':_0xe8c2('0x3c'),'include':[{'model':db['CmContact'],'as':_0xe8c2('0x3d'),'where':_0x4e7eb9,'limit':0x1,'order':[[_0xe8c2('0x2f'),_0xe8c2('0x3e')]]}]},{'model':db[_0xe8c2('0x3f')],'as':_0xe8c2('0x40')}]});})['then'](function(_0x2e791b){if(_0x2e791b&&_0x2e791b['List']){var _0x49564e=_0x2e791b[_0xe8c2('0x41')]({'plain':!![]});_0x1364b0['account']=_0x49564e;_0x1364b0[_0xe8c2('0x42')]=_0x49564e[_0xe8c2('0x40')];_0x1364b0['list']=_0x49564e[_0xe8c2('0x3c')];_0x1364b0[_0xe8c2('0x42')]=_[_0xe8c2('0x43')](_0x1364b0[_0xe8c2('0x42')],['priority'],[_0xe8c2('0x44')]);if(_0x1364b0[_0xe8c2('0x3a')]['Applications']){delete _0x1364b0[_0xe8c2('0x3a')][_0xe8c2('0x40')];}if(_0x1364b0[_0xe8c2('0x3a')][_0xe8c2('0x3c')]&&_0x1364b0[_0xe8c2('0x3a')][_0xe8c2('0x3c')][_0xe8c2('0x3d')]['length']){return _0x1364b0[_0xe8c2('0x3a')][_0xe8c2('0x3c')][_0xe8c2('0x3d')][0x0];}var _0x92b20c=_[_0xe8c2('0x45')](_0x21d737[_0xe8c2('0x28')],{'firstName':_0x21d737[_0xe8c2('0x28')][_0xe8c2('0x32')],'ListId':_0x49564e[_0xe8c2('0x46')]});_0x92b20c[_0x21d737[_0xe8c2('0x28')]['mapKey']]=_0x21d737[_0xe8c2('0x28')][_0xe8c2('0x32')];return db[_0xe8c2('0x2a')]['create'](_0x92b20c,{'fields':_0x1b7b86,'raw':!![]});}})['then'](function(_0x167617){_0x1364b0[_0xe8c2('0x47')]=_0x167617;if(_0x167617){var _0x29e809={'ContactId':_0x167617['id'],'FaxAccountId':_0x21d737[_0xe8c2('0x3a')]['id'],'fax':_0x167617[_0xe8c2('0x29')]};return db[_0xe8c2('0x48')][_0xe8c2('0x39')]({'where':{'ContactId':_0x167617['id'],'closed':![],'FaxAccountId':_0x21d737[_0xe8c2('0x3a')]['id']}})['then'](function(_0x43b451){if(_0x43b451){return[_0x43b451,![]];}return db[_0xe8c2('0x48')][_0xe8c2('0x49')](_0x29e809)['then'](function(_0x302939){return[_0x302939,!![]];});});}else{throw new Error(_0xe8c2('0x4a'));}})[_0xe8c2('0x4b')](function(_0x5a425e,_0x4bc107){var _0xdd21eb=_0x5a425e['get']({'plain':!![]});if(_0x4bc107){if(_0x1364b0[_0xe8c2('0x3a')]['autoclose']){_0x1364b0[_0xe8c2('0x42')][_0xe8c2('0x4c')]({'id':0x0,'priority':_0x1364b0[_0xe8c2('0x42')][_0xe8c2('0x4d')]+0x1,'app':'close','appdata':_0xe8c2('0x4e'),'interval':'*,*,*,*'});}_0xdd21eb['created']=!![];}else{_0xdd21eb['created']=![];}_0x1364b0[_0xe8c2('0x4f')]=_0xdd21eb;return db[_0xe8c2('0x50')][_0xe8c2('0x49')]({'body':_0x21d737[_0xe8c2('0x28')]['body'],'FaxAccountId':_0x21d737[_0xe8c2('0x3a')]['id'],'FaxInteractionId':_0x5a425e['id'],'direction':'in','ContactId':_0x5a425e[_0xe8c2('0x51')],'AttachmentId':_0x21d737[_0xe8c2('0x28')][_0xe8c2('0x52')]});})[_0xe8c2('0x23')](function(_0x2d9b87){_0x1364b0[_0xe8c2('0x16')]=_0x2d9b87;if(_0x1364b0[_0xe8c2('0x4f')][_0xe8c2('0x53')]){return db[_0xe8c2('0x54')][_0xe8c2('0x39')]({'attributes':['id',_0xe8c2('0x55')],'where':{'id':_0x1364b0['interaction'][_0xe8c2('0x53')]}})['then'](function(_0x322f5c){if(_0x322f5c){_0x1364b0[_0xe8c2('0x42')][_0xe8c2('0x56')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x322f5c[_0xe8c2('0x55')]+','+(_0x1364b0[_0xe8c2('0x3a')][_0xe8c2('0x57')]||0xa),'interval':_0xe8c2('0x58')});}return respondWithRpcPromise('Start','startRouting',_0x1364b0);});}return respondWithRpcPromise('Start',_0xe8c2('0x59'),_0x1364b0);})[_0xe8c2('0x23')](function(_0xa8fa5a){_0x57c727(_0xa8fa5a);})['catch'](function(_0x128f01){_0x2b7f7c(_0x136793[_0xe8c2('0x13')](0x1f4,_0x128f01[_0xe8c2('0x16')]));});});};
\ No newline at end of file
index f417348..4100276 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x36af=['emit','register','length','faxAccount:','save','update'];(function(_0x1649c6,_0x5a08ee){var _0x2c1e0a=function(_0x46d812){while(--_0x46d812){_0x1649c6['push'](_0x1649c6['shift']());}};_0x2c1e0a(++_0x5a08ee);}(_0x36af,0xdc));var _0xf36a=function(_0x2c79a9,_0x5744f2){_0x2c79a9=_0x2c79a9-0x0;var _0x4faba8=_0x36af[_0x2c79a9];return _0x4faba8;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xf36a('0x0'),'remove',_0xf36a('0x1')];function createListener(_0x33c06e,_0x24e436){return function(_0xfeb4c6){_0x24e436[_0xf36a('0x2')](_0x33c06e,_0xfeb4c6);};}function removeListener(_0x21598f,_0x5f02ac){return function(){FaxAccountEvents['removeListener'](_0x21598f,_0x5f02ac);};}exports[_0xf36a('0x3')]=function(_0x100a77){for(var _0x426335=0x0,_0x28a4b2=events[_0xf36a('0x4')];_0x426335<_0x28a4b2;_0x426335++){var _0x33926d=events[_0x426335];var _0x17f2a8=createListener(_0xf36a('0x5')+_0x33926d,_0x100a77);FaxAccountEvents['on'](_0x33926d,_0x17f2a8);}};
\ No newline at end of file
+var _0x95fa=['register','length','./faxAccount.events','remove','emit','removeListener'];(function(_0x35cace,_0x5419fa){var _0x5c7b0d=function(_0x1eadcd){while(--_0x1eadcd){_0x35cace['push'](_0x35cace['shift']());}};_0x5c7b0d(++_0x5419fa);}(_0x95fa,0x1ee));var _0xa95f=function(_0x5a5d40,_0x5dce4a){_0x5a5d40=_0x5a5d40-0x0;var _0x2e7b8b=_0x95fa[_0x5a5d40];return _0x2e7b8b;};'use strict';var FaxAccountEvents=require(_0xa95f('0x0'));var events=['save',_0xa95f('0x1'),'update'];function createListener(_0x54000b,_0x5346a9){return function(_0x298bb7){_0x5346a9[_0xa95f('0x2')](_0x54000b,_0x298bb7);};}function removeListener(_0x164733,_0x1ddd99){return function(){FaxAccountEvents[_0xa95f('0x3')](_0x164733,_0x1ddd99);};}exports[_0xa95f('0x4')]=function(_0x3dbef0){for(var _0x5131e0=0x0,_0x5a2ff3=events[_0xa95f('0x5')];_0x5131e0<_0x5a2ff3;_0x5131e0++){var _0x45decc=events[_0x5131e0];var _0xe1c931=createListener('faxAccount:'+_0x45decc,_0x3dbef0);FaxAccountEvents['on'](_0x45decc,_0xe1c931);}};
\ No newline at end of file
index e5605e5..843b95c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf3cd=['index','get','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','updateAccountApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxAccount.controller','isAuthenticated'];(function(_0x5dea35,_0x4403ce){var _0x420537=function(_0x262e1c){while(--_0x262e1c){_0x5dea35['push'](_0x5dea35['shift']());}};_0x420537(++_0x4403ce);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x2341ab,_0x326a6c){_0x2341ab=_0x2341ab-0x0;var _0x54533e=_0xf3cd[_0x2341ab];return _0x54533e;};'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 auth=require('../../components/auth/service');var interaction=require(_0xdf3c('0x6'));var config=require(_0xdf3c('0x7'));var controller=require(_0xdf3c('0x8'));router['get']('/',auth[_0xdf3c('0x9')](),controller[_0xdf3c('0xa')]);router[_0xdf3c('0xb')](_0xdf3c('0xc'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0xd')]);router['get'](_0xdf3c('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xdf3c('0xb')](_0xdf3c('0xf'),auth['isAuthenticated'](),controller[_0xdf3c('0x10')]);router[_0xdf3c('0xb')](_0xdf3c('0x11'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0x12')]);router[_0xdf3c('0xb')](_0xdf3c('0x13'),auth[_0xdf3c('0x9')](),controller['getInteractions']);router[_0xdf3c('0xb')](_0xdf3c('0x14'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0x15')]);router['get'](_0xdf3c('0x16'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0x17')]);router['get'](_0xdf3c('0x18'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0x19')]);router[_0xdf3c('0x1a')]('/',auth[_0xdf3c('0x9')](),controller[_0xdf3c('0x1b')]);router[_0xdf3c('0x1a')](_0xdf3c('0xf'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0x1c')]);router['post'](_0xdf3c('0x11'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0x1d')]);router[_0xdf3c('0x1a')](_0xdf3c('0x13'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0x1e')]);router[_0xdf3c('0x1a')](_0xdf3c('0x14'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0x1f')]);router[_0xdf3c('0x1a')](_0xdf3c('0x20'),auth['isAuthenticated'](),controller['addAccountApplications']);router[_0xdf3c('0x1a')]('/updateaccountapplications',auth[_0xdf3c('0x9')](),controller[_0xdf3c('0x21')]);router[_0xdf3c('0x1a')](_0xdf3c('0x22'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0x23')]);router['post'](_0xdf3c('0x18'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0x24')]);router[_0xdf3c('0x25')](_0xdf3c('0xe'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0x26')]);router[_0xdf3c('0x27')](_0xdf3c('0xe'),auth[_0xdf3c('0x9')](),controller['destroy']);router[_0xdf3c('0x27')](_0xdf3c('0xf'),auth['isAuthenticated'](),controller[_0xdf3c('0x28')]);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xdf3c('0x29')]);router[_0xdf3c('0x27')]('/:id/users',auth['isAuthenticated'](),controller[_0xdf3c('0x2a')]);module[_0xdf3c('0x2b')]=router;
\ No newline at end of file
+var _0x9f62=['express','Router','../../config/environment','./faxAccount.controller','get','isAuthenticated','/describe','describe','/:id/dispositions','/:id/canned_answers','/:id/interactions','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','addInteraction','/:id/applications','addApplications','/addaccountapplications','updateAccountApplications','/:id/send','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','connect-timeout'];(function(_0x9489a3,_0xcdf737){var _0x5e0633=function(_0x53781a){while(--_0x53781a){_0x9489a3['push'](_0x9489a3['shift']());}};_0x5e0633(++_0xcdf737);}(_0x9f62,0x154));var _0x29f6=function(_0x13e22e,_0x1dd1fd){_0x13e22e=_0x13e22e-0x0;var _0x5da700=_0x9f62[_0x13e22e];return _0x5da700;};'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 auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x29f6('0x4'));var controller=require(_0x29f6('0x5'));router[_0x29f6('0x6')]('/',auth[_0x29f6('0x7')](),controller['index']);router[_0x29f6('0x6')](_0x29f6('0x8'),auth[_0x29f6('0x7')](),controller[_0x29f6('0x9')]);router[_0x29f6('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x29f6('0xa'),auth[_0x29f6('0x7')](),controller['getDispositions']);router['get'](_0x29f6('0xb'),auth[_0x29f6('0x7')](),controller['getAnswers']);router[_0x29f6('0x6')](_0x29f6('0xc'),auth['isAuthenticated'](),controller['getInteractions']);router['get']('/:id/applications',auth[_0x29f6('0x7')](),controller[_0x29f6('0xd')]);router[_0x29f6('0x6')](_0x29f6('0xe'),auth[_0x29f6('0x7')](),controller[_0x29f6('0xf')]);router[_0x29f6('0x6')](_0x29f6('0x10'),auth[_0x29f6('0x7')](),controller[_0x29f6('0x11')]);router[_0x29f6('0x12')]('/',auth[_0x29f6('0x7')](),controller[_0x29f6('0x13')]);router[_0x29f6('0x12')](_0x29f6('0xa'),auth[_0x29f6('0x7')](),controller[_0x29f6('0x14')]);router['post']('/:id/canned_answers',auth[_0x29f6('0x7')](),controller[_0x29f6('0x15')]);router[_0x29f6('0x12')]('/:id/interactions',auth[_0x29f6('0x7')](),controller[_0x29f6('0x16')]);router['post'](_0x29f6('0x17'),auth[_0x29f6('0x7')](),controller[_0x29f6('0x18')]);router[_0x29f6('0x12')](_0x29f6('0x19'),auth[_0x29f6('0x7')](),controller['addAccountApplications']);router[_0x29f6('0x12')]('/updateaccountapplications',auth['isAuthenticated'](),controller[_0x29f6('0x1a')]);router[_0x29f6('0x12')](_0x29f6('0x1b'),auth[_0x29f6('0x7')](),controller['send']);router[_0x29f6('0x12')]('/:id/users',auth[_0x29f6('0x7')](),controller[_0x29f6('0x1c')]);router[_0x29f6('0x1d')](_0x29f6('0x1e'),auth['isAuthenticated'](),controller[_0x29f6('0x1f')]);router[_0x29f6('0x20')]('/:id',auth[_0x29f6('0x7')](),controller[_0x29f6('0x21')]);router[_0x29f6('0x20')](_0x29f6('0xa'),auth[_0x29f6('0x7')](),controller[_0x29f6('0x22')]);router[_0x29f6('0x20')]('/:id/canned_answers',auth[_0x29f6('0x7')](),controller[_0x29f6('0x23')]);router[_0x29f6('0x20')](_0x29f6('0x10'),auth[_0x29f6('0x7')](),controller[_0x29f6('0x24')]);module[_0x29f6('0x25')]=router;
\ No newline at end of file
index 716d939..6340525 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0d9d=['STRING','exports','INTEGER'];(function(_0x1f269a,_0x23719d){var _0x9aa1d8=function(_0x2dfba6){while(--_0x2dfba6){_0x1f269a['push'](_0x1f269a['shift']());}};_0x9aa1d8(++_0x23719d);}(_0x0d9d,0xb8));var _0xd0d9=function(_0x532de2,_0x28082a){_0x532de2=_0x532de2-0x0;var _0xf8a0bc=_0x0d9d[_0x532de2];return _0xf8a0bc;};'use strict';var Sequelize=require('sequelize');module[_0xd0d9('0x0')]={'priority':{'type':Sequelize[_0xd0d9('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xd0d9('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['STRING'](0x1000),'defaultValue':''},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}};
\ No newline at end of file
+var _0xfcf9=['*,*,*,*','exports','INTEGER','noop','STRING'];(function(_0x3733eb,_0x2d9450){var _0x4c80e3=function(_0x365bce){while(--_0x365bce){_0x3733eb['push'](_0x3733eb['shift']());}};_0x4c80e3(++_0x2d9450);}(_0xfcf9,0x141));var _0x9fcf=function(_0xd7a1b2,_0x54a957){_0xd7a1b2=_0xd7a1b2-0x0;var _0x180374=_0xfcf9[_0xd7a1b2];return _0x180374;};'use strict';var Sequelize=require('sequelize');module[_0x9fcf('0x0')]={'priority':{'type':Sequelize[_0x9fcf('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9fcf('0x2')},'appdata':{'type':Sequelize[_0x9fcf('0x3')](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0x9fcf('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9fcf('0x4')}};
\ No newline at end of file
index 96d4aa6..64590d9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaa53=['then','destroy','error','stack','name','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','key','VIRTUAL','field','options','FaxApplication','count','includeAll','show','include','find','catch','create','body','params','html-pdf','eml-format','rimraf','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','save','update'];(function(_0x55bde7,_0x154f22){var _0x585745=function(_0x33bea3){while(--_0x33bea3){_0x55bde7['push'](_0x55bde7['shift']());}};_0x585745(++_0x154f22);}(_0xaa53,0xb0));var _0x3aa5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaa53[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x3aa5('0x0'));var emlformat=require(_0x3aa5('0x1'));var rimraf=require(_0x3aa5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3aa5('0x3'));var moment=require(_0x3aa5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3aa5('0x5'));var util=require('util');var path=require(_0x3aa5('0x6'));var sox=require(_0x3aa5('0x7'));var csv=require(_0x3aa5('0x8'));var ejs=require(_0x3aa5('0x9'));var fs=require('fs');var _=require(_0x3aa5('0xa'));var squel=require(_0x3aa5('0xb'));var crypto=require(_0x3aa5('0xc'));var jsforce=require(_0x3aa5('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3aa5('0xe'));var Papa=require(_0x3aa5('0xf'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x3aa5('0x10'));var qs=require(_0x3aa5('0x11'));var logger=require(_0x3aa5('0x12'))('api');var utils=require(_0x3aa5('0x13'));var config=require('../../config/environment');var db=require(_0x3aa5('0x14'))['db'];function respondWithStatusCode(_0x13b29b,_0x39efe6){_0x39efe6=_0x39efe6||0xcc;return function(_0x2e4547){if(_0x2e4547){return _0x13b29b[_0x3aa5('0x15')](_0x39efe6);}return _0x13b29b[_0x3aa5('0x16')](_0x39efe6)[_0x3aa5('0x17')]();};}function respondWithResult(_0x505936,_0x2f1554){_0x2f1554=_0x2f1554||0xc8;return function(_0xe0c6ce){if(_0xe0c6ce){return _0x505936[_0x3aa5('0x16')](_0x2f1554)[_0x3aa5('0x18')](_0xe0c6ce);}};}function respondWithFilteredResult(_0x4248a6,_0x4fa378){return function(_0x5e2f5d){if(_0x5e2f5d){var _0x1b650b=_0x5e2f5d['count'],_0x2f7267=_0x4fa378[_0x3aa5('0x19')],_0x45b238=_0x4fa378[_0x3aa5('0x19')]+_0x4fa378[_0x3aa5('0x1a')],_0x48e39a;if(_0x45b238>=_0x1b650b){_0x45b238=_0x1b650b;_0x48e39a=0xc8;}else{_0x48e39a=0xce;}_0x4248a6[_0x3aa5('0x16')](_0x48e39a);return _0x4248a6['set'](_0x3aa5('0x1b'),_0x2f7267+'-'+_0x45b238+'/'+_0x1b650b)[_0x3aa5('0x18')](_0x5e2f5d);}return null;};}function patchUpdates(_0x8e1dc8){return function(_0x59d375){try{jsonpatch[_0x3aa5('0x1c')](_0x59d375,_0x8e1dc8,!![]);}catch(_0x2abbf3){return BPromise['reject'](_0x2abbf3);}return _0x59d375[_0x3aa5('0x1d')]();};}function saveUpdates(_0x4650d7,_0x5984c6){return function(_0x5decdd){if(_0x5decdd){return _0x5decdd[_0x3aa5('0x1e')](_0x4650d7)[_0x3aa5('0x1f')](function(_0x268c68){return _0x268c68;});}return null;};}function removeEntity(_0x2c4781,_0xf7eb21){return function(_0xb096a2){if(_0xb096a2){return _0xb096a2[_0x3aa5('0x20')]()[_0x3aa5('0x1f')](function(){_0x2c4781[_0x3aa5('0x16')](0xcc)[_0x3aa5('0x17')]();});}};}function handleEntityNotFound(_0x793bd7,_0x4d2d2b){return function(_0x2cbfb1){if(!_0x2cbfb1){_0x793bd7['sendStatus'](0x194);}return _0x2cbfb1;};}function handleError(_0xf63b2e,_0x19d70b){_0x19d70b=_0x19d70b||0x1f4;return function(_0xe54936){logger[_0x3aa5('0x21')](_0xe54936[_0x3aa5('0x22')]);if(_0xe54936[_0x3aa5('0x23')]){delete _0xe54936['name'];}_0xf63b2e['status'](_0x19d70b)['send'](_0xe54936);};}exports[_0x3aa5('0x24')]=function(_0x2f67ac,_0x4b8477){var _0x2b4f84={},_0x42342={},_0x509430={'count':0x0,'rows':[]};var _0x226930=db['FaxApplication'][_0x3aa5('0x25')];_0x42342[_0x3aa5('0x26')]=_[_0x3aa5('0x27')](_0x226930);_0x42342[_0x3aa5('0x28')]=_['keys'](_0x2f67ac[_0x3aa5('0x28')]);_0x42342[_0x3aa5('0x29')]=_[_0x3aa5('0x2a')](_0x42342[_0x3aa5('0x26')],_0x42342[_0x3aa5('0x28')]);_0x2b4f84[_0x3aa5('0x2b')]=_['intersection'](_0x42342[_0x3aa5('0x26')],qs[_0x3aa5('0x2c')](_0x2f67ac[_0x3aa5('0x28')][_0x3aa5('0x2c')]));_0x2b4f84[_0x3aa5('0x2b')]=_0x2b4f84[_0x3aa5('0x2b')][_0x3aa5('0x2d')]?_0x2b4f84[_0x3aa5('0x2b')]:_0x42342['model'];if(!_0x2f67ac[_0x3aa5('0x28')][_0x3aa5('0x2e')](_0x3aa5('0x2f'))){_0x2b4f84['limit']=qs['limit'](_0x2f67ac[_0x3aa5('0x28')]['limit']);_0x2b4f84[_0x3aa5('0x19')]=qs[_0x3aa5('0x19')](_0x2f67ac[_0x3aa5('0x28')][_0x3aa5('0x19')]);}_0x2b4f84[_0x3aa5('0x30')]=qs['sort'](_0x2f67ac[_0x3aa5('0x28')][_0x3aa5('0x31')]);_0x2b4f84[_0x3aa5('0x32')]=qs[_0x3aa5('0x29')](_[_0x3aa5('0x33')](_0x2f67ac[_0x3aa5('0x28')],_0x42342[_0x3aa5('0x29')]));if(_0x2f67ac[_0x3aa5('0x28')][_0x3aa5('0x34')]){_0x2b4f84['where']=_[_0x3aa5('0x35')](_0x2b4f84[_0x3aa5('0x32')],{'$or':_[_0x3aa5('0x36')](_0x226930,function(_0x141fc5){if(_0x141fc5['type'][_0x3aa5('0x37')]!==_0x3aa5('0x38')){var _0x156a6a={};_0x156a6a[_0x141fc5[_0x3aa5('0x39')]]={'$like':'%'+_0x2f67ac['query'][_0x3aa5('0x34')]+'%'};return _0x156a6a;}})});}_0x2b4f84=_[_0x3aa5('0x35')]({},_0x2b4f84,_0x2f67ac[_0x3aa5('0x3a')]);var _0x3a013a={'where':_0x2b4f84[_0x3aa5('0x32')]};return db[_0x3aa5('0x3b')][_0x3aa5('0x3c')](_0x3a013a)[_0x3aa5('0x1f')](function(_0x193385){_0x509430[_0x3aa5('0x3c')]=_0x193385;if(_0x2f67ac[_0x3aa5('0x28')][_0x3aa5('0x3d')]){_0x2b4f84['include']=[{'all':!![]}];}return db[_0x3aa5('0x3b')]['findAll'](_0x2b4f84);})[_0x3aa5('0x1f')](function(_0x198020){_0x509430['rows']=_0x198020;return _0x509430;})[_0x3aa5('0x1f')](respondWithFilteredResult(_0x4b8477,_0x2b4f84))['catch'](handleError(_0x4b8477,null));};exports[_0x3aa5('0x3e')]=function(_0x1b5b6c,_0x52cb4c){var _0xc67805={'raw':!![],'where':{'id':_0x1b5b6c['params']['id']}},_0x1a0590={};_0x1a0590[_0x3aa5('0x26')]=_[_0x3aa5('0x27')](db[_0x3aa5('0x3b')][_0x3aa5('0x25')]);_0x1a0590[_0x3aa5('0x28')]=_[_0x3aa5('0x27')](_0x1b5b6c[_0x3aa5('0x28')]);_0x1a0590['filters']=_[_0x3aa5('0x2a')](_0x1a0590['model'],_0x1a0590['query']);_0xc67805['attributes']=_[_0x3aa5('0x2a')](_0x1a0590[_0x3aa5('0x26')],qs[_0x3aa5('0x2c')](_0x1b5b6c[_0x3aa5('0x28')][_0x3aa5('0x2c')]));_0xc67805[_0x3aa5('0x2b')]=_0xc67805[_0x3aa5('0x2b')][_0x3aa5('0x2d')]?_0xc67805[_0x3aa5('0x2b')]:_0x1a0590[_0x3aa5('0x26')];if(_0x1b5b6c[_0x3aa5('0x28')][_0x3aa5('0x3d')]){_0xc67805[_0x3aa5('0x3f')]=[{'all':!![]}];}_0xc67805=_['merge']({},_0xc67805,_0x1b5b6c['options']);return db['FaxApplication'][_0x3aa5('0x40')](_0xc67805)['then'](handleEntityNotFound(_0x52cb4c,null))[_0x3aa5('0x1f')](respondWithResult(_0x52cb4c,null))[_0x3aa5('0x41')](handleError(_0x52cb4c,null));};exports[_0x3aa5('0x42')]=function(_0x593ceb,_0x53195a){return db[_0x3aa5('0x3b')][_0x3aa5('0x42')](_0x593ceb[_0x3aa5('0x43')],{})[_0x3aa5('0x1f')](respondWithResult(_0x53195a,0xc9))['catch'](handleError(_0x53195a,null));};exports[_0x3aa5('0x1e')]=function(_0x45a019,_0x3415d7){if(_0x45a019[_0x3aa5('0x43')]['id']){delete _0x45a019['body']['id'];}return db[_0x3aa5('0x3b')][_0x3aa5('0x40')]({'where':{'id':_0x45a019[_0x3aa5('0x44')]['id']}})['then'](handleEntityNotFound(_0x3415d7,null))[_0x3aa5('0x1f')](saveUpdates(_0x45a019[_0x3aa5('0x43')],null))['then'](respondWithResult(_0x3415d7,null))[_0x3aa5('0x41')](handleError(_0x3415d7,null));};exports[_0x3aa5('0x20')]=function(_0x2b38ec,_0xa60632){return db['FaxApplication'][_0x3aa5('0x40')]({'where':{'id':_0x2b38ec[_0x3aa5('0x44')]['id']}})[_0x3aa5('0x1f')](handleEntityNotFound(_0xa60632,null))[_0x3aa5('0x1f')](removeEntity(_0xa60632,null))[_0x3aa5('0x41')](handleError(_0xa60632,null));};
\ No newline at end of file
+var _0xa727=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','FaxApplication','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','rows','catch','params','includeAll','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs','lodash','crypto'];(function(_0x4d58d5,_0x1ad087){var _0x2148c5=function(_0x2906ef){while(--_0x2906ef){_0x4d58d5['push'](_0x4d58d5['shift']());}};_0x2148c5(++_0x1ad087);}(_0xa727,0x1d0));var _0x7a72=function(_0x270c67,_0x23d643){_0x270c67=_0x270c67-0x0;var _0x2db72e=_0xa727[_0x270c67];return _0x2db72e;};'use strict';var pdf=require(_0x7a72('0x0'));var emlformat=require(_0x7a72('0x1'));var rimraf=require(_0x7a72('0x2'));var zipdir=require(_0x7a72('0x3'));var jsonpatch=require(_0x7a72('0x4'));var rp=require(_0x7a72('0x5'));var moment=require('moment');var BPromise=require(_0x7a72('0x6'));var Mustache=require('mustache');var util=require(_0x7a72('0x7'));var path=require(_0x7a72('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7a72('0x9'));var fs=require('fs');var _=require(_0x7a72('0xa'));var squel=require('squel');var crypto=require(_0x7a72('0xb'));var jsforce=require(_0x7a72('0xc'));var deskjs=require(_0x7a72('0xd'));var toCsv=require(_0x7a72('0xe'));var querystring=require(_0x7a72('0xf'));var Papa=require(_0x7a72('0x10'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x7a72('0x11'));var qs=require(_0x7a72('0x12'));var logger=require(_0x7a72('0x13'))(_0x7a72('0x14'));var utils=require(_0x7a72('0x15'));var config=require('../../config/environment');var db=require(_0x7a72('0x16'))['db'];function respondWithStatusCode(_0x34d80a,_0x2c7afc){_0x2c7afc=_0x2c7afc||0xcc;return function(_0x4fc625){if(_0x4fc625){return _0x34d80a[_0x7a72('0x17')](_0x2c7afc);}return _0x34d80a[_0x7a72('0x18')](_0x2c7afc)[_0x7a72('0x19')]();};}function respondWithResult(_0x1c720b,_0x1a25f1){_0x1a25f1=_0x1a25f1||0xc8;return function(_0x1d1e6c){if(_0x1d1e6c){return _0x1c720b['status'](_0x1a25f1)[_0x7a72('0x1a')](_0x1d1e6c);}};}function respondWithFilteredResult(_0x5924cc,_0x446987){return function(_0x42c114){if(_0x42c114){var _0x72816b=_0x42c114[_0x7a72('0x1b')],_0x5833c7=_0x446987[_0x7a72('0x1c')],_0x2f3894=_0x446987[_0x7a72('0x1c')]+_0x446987[_0x7a72('0x1d')],_0x445419;if(_0x2f3894>=_0x72816b){_0x2f3894=_0x72816b;_0x445419=0xc8;}else{_0x445419=0xce;}_0x5924cc['status'](_0x445419);return _0x5924cc[_0x7a72('0x1e')](_0x7a72('0x1f'),_0x5833c7+'-'+_0x2f3894+'/'+_0x72816b)[_0x7a72('0x1a')](_0x42c114);}return null;};}function patchUpdates(_0xfc4cc7){return function(_0x2de8cb){try{jsonpatch['apply'](_0x2de8cb,_0xfc4cc7,!![]);}catch(_0x2ad5dc){return BPromise['reject'](_0x2ad5dc);}return _0x2de8cb[_0x7a72('0x20')]();};}function saveUpdates(_0x36fff2,_0x357098){return function(_0xcdc0cc){if(_0xcdc0cc){return _0xcdc0cc[_0x7a72('0x21')](_0x36fff2)[_0x7a72('0x22')](function(_0x1a492b){return _0x1a492b;});}return null;};}function removeEntity(_0x54a98a,_0x343028){return function(_0x40ded0){if(_0x40ded0){return _0x40ded0[_0x7a72('0x23')]()[_0x7a72('0x22')](function(){_0x54a98a[_0x7a72('0x18')](0xcc)[_0x7a72('0x19')]();});}};}function handleEntityNotFound(_0x69d537,_0x36eb06){return function(_0x4defa5){if(!_0x4defa5){_0x69d537['sendStatus'](0x194);}return _0x4defa5;};}function handleError(_0x82e37,_0x2f040c){_0x2f040c=_0x2f040c||0x1f4;return function(_0x43bedc){logger[_0x7a72('0x24')](_0x43bedc[_0x7a72('0x25')]);if(_0x43bedc[_0x7a72('0x26')]){delete _0x43bedc[_0x7a72('0x26')];}_0x82e37[_0x7a72('0x18')](_0x2f040c)[_0x7a72('0x27')](_0x43bedc);};}exports[_0x7a72('0x28')]=function(_0x16f284,_0x1ad3e5){var _0x1c5606={},_0x1afcb0={},_0x3f8c17={'count':0x0,'rows':[]};var _0x325d83=db[_0x7a72('0x29')]['rawAttributes'];_0x1afcb0[_0x7a72('0x2a')]=_[_0x7a72('0x2b')](_0x325d83);_0x1afcb0['query']=_[_0x7a72('0x2b')](_0x16f284[_0x7a72('0x2c')]);_0x1afcb0[_0x7a72('0x2d')]=_[_0x7a72('0x2e')](_0x1afcb0[_0x7a72('0x2a')],_0x1afcb0[_0x7a72('0x2c')]);_0x1c5606[_0x7a72('0x2f')]=_[_0x7a72('0x2e')](_0x1afcb0[_0x7a72('0x2a')],qs[_0x7a72('0x30')](_0x16f284[_0x7a72('0x2c')]['fields']));_0x1c5606[_0x7a72('0x2f')]=_0x1c5606['attributes'][_0x7a72('0x31')]?_0x1c5606[_0x7a72('0x2f')]:_0x1afcb0[_0x7a72('0x2a')];if(!_0x16f284['query'][_0x7a72('0x32')](_0x7a72('0x33'))){_0x1c5606[_0x7a72('0x1d')]=qs['limit'](_0x16f284['query'][_0x7a72('0x1d')]);_0x1c5606[_0x7a72('0x1c')]=qs[_0x7a72('0x1c')](_0x16f284[_0x7a72('0x2c')][_0x7a72('0x1c')]);}_0x1c5606[_0x7a72('0x34')]=qs[_0x7a72('0x35')](_0x16f284['query']['sort']);_0x1c5606[_0x7a72('0x36')]=qs[_0x7a72('0x2d')](_['pick'](_0x16f284[_0x7a72('0x2c')],_0x1afcb0[_0x7a72('0x2d')]));if(_0x16f284[_0x7a72('0x2c')][_0x7a72('0x37')]){_0x1c5606[_0x7a72('0x36')]=_[_0x7a72('0x38')](_0x1c5606[_0x7a72('0x36')],{'$or':_['map'](_0x325d83,function(_0x4ce6d9){if(_0x4ce6d9[_0x7a72('0x39')]['key']!==_0x7a72('0x3a')){var _0x568b10={};_0x568b10[_0x4ce6d9['field']]={'$like':'%'+_0x16f284[_0x7a72('0x2c')][_0x7a72('0x37')]+'%'};return _0x568b10;}})});}_0x1c5606=_['merge']({},_0x1c5606,_0x16f284[_0x7a72('0x3b')]);var _0x500a43={'where':_0x1c5606['where']};return db[_0x7a72('0x29')]['count'](_0x500a43)[_0x7a72('0x22')](function(_0x4fc149){_0x3f8c17[_0x7a72('0x1b')]=_0x4fc149;if(_0x16f284[_0x7a72('0x2c')]['includeAll']){_0x1c5606[_0x7a72('0x3c')]=[{'all':!![]}];}return db[_0x7a72('0x29')]['findAll'](_0x1c5606);})[_0x7a72('0x22')](function(_0x5b0238){_0x3f8c17[_0x7a72('0x3d')]=_0x5b0238;return _0x3f8c17;})[_0x7a72('0x22')](respondWithFilteredResult(_0x1ad3e5,_0x1c5606))[_0x7a72('0x3e')](handleError(_0x1ad3e5,null));};exports['show']=function(_0xfd0bf7,_0x68221f){var _0x154bc6={'raw':!![],'where':{'id':_0xfd0bf7[_0x7a72('0x3f')]['id']}},_0x50ef4d={};_0x50ef4d[_0x7a72('0x2a')]=_[_0x7a72('0x2b')](db[_0x7a72('0x29')]['rawAttributes']);_0x50ef4d['query']=_[_0x7a72('0x2b')](_0xfd0bf7['query']);_0x50ef4d[_0x7a72('0x2d')]=_[_0x7a72('0x2e')](_0x50ef4d[_0x7a72('0x2a')],_0x50ef4d['query']);_0x154bc6[_0x7a72('0x2f')]=_['intersection'](_0x50ef4d[_0x7a72('0x2a')],qs[_0x7a72('0x30')](_0xfd0bf7[_0x7a72('0x2c')][_0x7a72('0x30')]));_0x154bc6[_0x7a72('0x2f')]=_0x154bc6[_0x7a72('0x2f')][_0x7a72('0x31')]?_0x154bc6[_0x7a72('0x2f')]:_0x50ef4d[_0x7a72('0x2a')];if(_0xfd0bf7[_0x7a72('0x2c')][_0x7a72('0x40')]){_0x154bc6['include']=[{'all':!![]}];}_0x154bc6=_[_0x7a72('0x38')]({},_0x154bc6,_0xfd0bf7['options']);return db[_0x7a72('0x29')][_0x7a72('0x41')](_0x154bc6)[_0x7a72('0x22')](handleEntityNotFound(_0x68221f,null))[_0x7a72('0x22')](respondWithResult(_0x68221f,null))['catch'](handleError(_0x68221f,null));};exports[_0x7a72('0x42')]=function(_0x10eadd,_0x178444){return db[_0x7a72('0x29')][_0x7a72('0x42')](_0x10eadd[_0x7a72('0x43')],{})[_0x7a72('0x22')](respondWithResult(_0x178444,0xc9))[_0x7a72('0x3e')](handleError(_0x178444,null));};exports[_0x7a72('0x21')]=function(_0x5c5a32,_0xc789ff){if(_0x5c5a32[_0x7a72('0x43')]['id']){delete _0x5c5a32['body']['id'];}return db[_0x7a72('0x29')][_0x7a72('0x41')]({'where':{'id':_0x5c5a32[_0x7a72('0x3f')]['id']}})[_0x7a72('0x22')](handleEntityNotFound(_0xc789ff,null))[_0x7a72('0x22')](saveUpdates(_0x5c5a32[_0x7a72('0x43')],null))[_0x7a72('0x22')](respondWithResult(_0xc789ff,null))[_0x7a72('0x3e')](handleError(_0xc789ff,null));};exports[_0x7a72('0x23')]=function(_0x5235c6,_0x10c152){return db['FaxApplication'][_0x7a72('0x41')]({'where':{'id':_0x5235c6[_0x7a72('0x3f')]['id']}})['then'](handleEntityNotFound(_0x10c152,null))['then'](removeEntity(_0x10c152,null))[_0x7a72('0x3e')](handleError(_0x10c152,null));};
\ No newline at end of file
index 4930e66..2a46233 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xce0c=['exports','define','FaxApplication','fax_applications','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./faxApplication.attributes'];(function(_0x75fe5e,_0x25e22f){var _0xcfc4a7=function(_0x226853){while(--_0x226853){_0x75fe5e['push'](_0x75fe5e['shift']());}};_0xcfc4a7(++_0x25e22f);}(_0xce0c,0x1b4));var _0xcce0=function(_0x5a7d41,_0x4447e2){_0x5a7d41=_0x5a7d41-0x0;var _0x98d8fa=_0xce0c[_0x5a7d41];return _0x98d8fa;};'use strict';var _=require(_0xcce0('0x0'));var util=require(_0xcce0('0x1'));var logger=require(_0xcce0('0x2'))(_0xcce0('0x3'));var moment=require(_0xcce0('0x4'));var BPromise=require(_0xcce0('0x5'));var rp=require(_0xcce0('0x6'));var attributes=require(_0xcce0('0x7'));module[_0xcce0('0x8')]=function(_0x478734,_0x8d3983){return _0x478734[_0xcce0('0x9')](_0xcce0('0xa'),attributes,{'tableName':_0xcce0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x92f8=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','./faxApplication.attributes','define','FaxApplication'];(function(_0x75c5d,_0x40f095){var _0x325025=function(_0x12be84){while(--_0x12be84){_0x75c5d['push'](_0x75c5d['shift']());}};_0x325025(++_0x40f095);}(_0x92f8,0x154));var _0x892f=function(_0x212fe4,_0xd5dcea){_0x212fe4=_0x212fe4-0x0;var _0x665a11=_0x92f8[_0x212fe4];return _0x665a11;};'use strict';var _=require(_0x892f('0x0'));var util=require(_0x892f('0x1'));var logger=require(_0x892f('0x2'))(_0x892f('0x3'));var moment=require(_0x892f('0x4'));var BPromise=require(_0x892f('0x5'));var rp=require(_0x892f('0x6'));var attributes=require(_0x892f('0x7'));module['exports']=function(_0x5231fb,_0x117eef){return _0x5231fb[_0x892f('0x8')](_0x892f('0x9'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 5cae24b..ea3a6e0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xabf6=['attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','options','raw','where'];(function(_0x1f5143,_0x5e31e6){var _0x383a38=function(_0x2c123c){while(--_0x2c123c){_0x1f5143['push'](_0x1f5143['shift']());}};_0x383a38(++_0x5e31e6);}(_0xabf6,0x1c4));var _0x6abf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xabf6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6abf('0x0'));var util=require(_0x6abf('0x1'));var moment=require(_0x6abf('0x2'));var BPromise=require(_0x6abf('0x3'));var rs=require(_0x6abf('0x4'));var fs=require('fs');var Redis=require(_0x6abf('0x5'));var db=require(_0x6abf('0x6'))['db'];var utils=require(_0x6abf('0x7'));var logger=require(_0x6abf('0x8'))(_0x6abf('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6abf('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4426f9,_0x75d0b9,_0x1421b5){return new BPromise(function(_0x2502cb,_0x1f8ff2){return client[_0x6abf('0xb')](_0x4426f9,_0x1421b5)['then'](function(_0x582549){logger[_0x6abf('0xc')](_0x6abf('0xd'),_0x75d0b9,'request\x20sent');logger[_0x6abf('0xe')](_0x6abf('0xf'),_0x75d0b9,_0x6abf('0x10'),JSON[_0x6abf('0x11')](_0x582549));if(_0x582549[_0x6abf('0x12')]){if(_0x582549[_0x6abf('0x12')][_0x6abf('0x13')]===0x1f4){logger[_0x6abf('0x12')]('FaxApplication,\x20%s,\x20%s',_0x75d0b9,_0x582549['error'][_0x6abf('0x14')]);return _0x1f8ff2(_0x582549[_0x6abf('0x12')][_0x6abf('0x14')]);}logger[_0x6abf('0x12')](_0x6abf('0xd'),_0x75d0b9,_0x582549[_0x6abf('0x12')][_0x6abf('0x14')]);return _0x2502cb(_0x582549[_0x6abf('0x12')][_0x6abf('0x14')]);}else{logger[_0x6abf('0xc')](_0x6abf('0xd'),_0x75d0b9,_0x6abf('0x10'));_0x2502cb(_0x582549[_0x6abf('0x15')][_0x6abf('0x14')]);}})[_0x6abf('0x16')](function(_0x3ddfb3){logger['error'](_0x6abf('0xd'),_0x75d0b9,_0x3ddfb3);_0x1f8ff2(_0x3ddfb3);});});}exports[_0x6abf('0x17')]=function(_0x1677e9){var _0x231586=this;return new Promise(function(_0x558109,_0x63f332){return db[_0x6abf('0x18')]['update'](_0x1677e9['body'],{'raw':_0x1677e9[_0x6abf('0x19')]?_0x1677e9[_0x6abf('0x19')][_0x6abf('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1677e9[_0x6abf('0x19')]?_0x1677e9[_0x6abf('0x19')][_0x6abf('0x1b')]||null:null,'attributes':_0x1677e9[_0x6abf('0x19')]?_0x1677e9[_0x6abf('0x19')][_0x6abf('0x1c')]||null:null,'limit':_0x1677e9[_0x6abf('0x19')]?_0x1677e9[_0x6abf('0x19')][_0x6abf('0x1d')]||null:null})['then'](function(_0x114f03){logger[_0x6abf('0xc')](_0x6abf('0x17'),_0x1677e9);logger['debug'](_0x6abf('0x17'),_0x1677e9,JSON['stringify'](_0x114f03));_0x558109(_0x114f03);})[_0x6abf('0x16')](function(_0x5c6633){logger[_0x6abf('0x12')](_0x6abf('0x17'),_0x5c6633['message'],_0x1677e9);_0x63f332(_0x231586[_0x6abf('0x12')](0x1f4,_0x5c6633[_0x6abf('0x14')]));});});};
\ No newline at end of file
+var _0xc028=['FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','update','options','raw','attributes','limit','UpdateFaxApplication','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x542f45,_0x37468a){var _0x38c609=function(_0x44259b){while(--_0x44259b){_0x542f45['push'](_0x542f45['shift']());}};_0x38c609(++_0x37468a);}(_0xc028,0x1b0));var _0x8c02=function(_0x1a6f32,_0x5c4517){_0x1a6f32=_0x1a6f32-0x0;var _0x443dea=_0xc028[_0x1a6f32];return _0x443dea;};'use strict';var _=require('lodash');var util=require(_0x8c02('0x0'));var moment=require(_0x8c02('0x1'));var BPromise=require(_0x8c02('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c02('0x3'));var db=require(_0x8c02('0x4'))['db'];var utils=require(_0x8c02('0x5'));var logger=require(_0x8c02('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8c02('0x7'));var client=jayson[_0x8c02('0x8')][_0x8c02('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ab18e,_0x5d08f7,_0x579a30){return new BPromise(function(_0x5a4ca7,_0x32fe14){return client[_0x8c02('0xa')](_0x3ab18e,_0x579a30)[_0x8c02('0xb')](function(_0x9667a3){logger[_0x8c02('0xc')](_0x8c02('0xd'),_0x5d08f7,_0x8c02('0xe'));logger[_0x8c02('0xf')](_0x8c02('0x10'),_0x5d08f7,_0x8c02('0xe'),JSON['stringify'](_0x9667a3));if(_0x9667a3[_0x8c02('0x11')]){if(_0x9667a3[_0x8c02('0x11')][_0x8c02('0x12')]===0x1f4){logger[_0x8c02('0x11')](_0x8c02('0xd'),_0x5d08f7,_0x9667a3[_0x8c02('0x11')][_0x8c02('0x13')]);return _0x32fe14(_0x9667a3[_0x8c02('0x11')][_0x8c02('0x13')]);}logger[_0x8c02('0x11')]('FaxApplication,\x20%s,\x20%s',_0x5d08f7,_0x9667a3[_0x8c02('0x11')]['message']);return _0x5a4ca7(_0x9667a3[_0x8c02('0x11')][_0x8c02('0x13')]);}else{logger[_0x8c02('0xc')](_0x8c02('0xd'),_0x5d08f7,_0x8c02('0xe'));_0x5a4ca7(_0x9667a3[_0x8c02('0x14')][_0x8c02('0x13')]);}})[_0x8c02('0x15')](function(_0x37f9de){logger['error'](_0x8c02('0xd'),_0x5d08f7,_0x37f9de);_0x32fe14(_0x37f9de);});});}exports['UpdateFaxApplication']=function(_0x11717f){var _0x1b4b9c=this;return new Promise(function(_0xa25c70,_0x3bee2f){return db['FaxApplication'][_0x8c02('0x16')](_0x11717f['body'],{'raw':_0x11717f[_0x8c02('0x17')]?_0x11717f[_0x8c02('0x17')][_0x8c02('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11717f['options']?_0x11717f['options']['where']||null:null,'attributes':_0x11717f['options']?_0x11717f[_0x8c02('0x17')][_0x8c02('0x19')]||null:null,'limit':_0x11717f[_0x8c02('0x17')]?_0x11717f[_0x8c02('0x17')][_0x8c02('0x1a')]||null:null})[_0x8c02('0xb')](function(_0x979fd){logger[_0x8c02('0xc')]('UpdateFaxApplication',_0x11717f);logger['debug'](_0x8c02('0x1b'),_0x11717f,JSON['stringify'](_0x979fd));_0xa25c70(_0x979fd);})[_0x8c02('0x15')](function(_0x332f37){logger[_0x8c02('0x11')](_0x8c02('0x1b'),_0x332f37[_0x8c02('0x13')],_0x11717f);_0x3bee2f(_0x1b4b9c[_0x8c02('0x11')](0x1f4,_0x332f37[_0x8c02('0x13')]));});});};
\ No newline at end of file
index c45b9f1..f542713 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcd78=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0xa1d334,_0x42413f){var _0x477792=function(_0x3ca31d){while(--_0x3ca31d){_0xa1d334['push'](_0xa1d334['shift']());}};_0x477792(++_0x42413f);}(_0xcd78,0xf0));var _0x8cd7=function(_0x2e5394,_0x1491f5){_0x2e5394=_0x2e5394-0x0;var _0x165e2a=_0xcd78[_0x2e5394];return _0x165e2a;};'use strict';var multer=require(_0x8cd7('0x0'));var util=require(_0x8cd7('0x1'));var path=require(_0x8cd7('0x2'));var timeout=require(_0x8cd7('0x3'));var express=require(_0x8cd7('0x4'));var router=express[_0x8cd7('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x8cd7('0x6'));var config=require(_0x8cd7('0x7'));var controller=require('./faxApplication.controller');router[_0x8cd7('0x8')]('/',auth[_0x8cd7('0x9')](),controller[_0x8cd7('0xa')]);router[_0x8cd7('0x8')](_0x8cd7('0xb'),auth[_0x8cd7('0x9')](),controller[_0x8cd7('0xc')]);router[_0x8cd7('0xd')]('/',auth['isAuthenticated'](),controller[_0x8cd7('0xe')]);router['put'](_0x8cd7('0xb'),auth[_0x8cd7('0x9')](),controller[_0x8cd7('0xf')]);router['delete'](_0x8cd7('0xb'),auth[_0x8cd7('0x9')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
+var _0x0771=['show','post','isAuthenticated','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','index','/:id'];(function(_0x130c63,_0x4465af){var _0x3e5cda=function(_0x48d3ba){while(--_0x48d3ba){_0x130c63['push'](_0x130c63['shift']());}};_0x3e5cda(++_0x4465af);}(_0x0771,0xe5));var _0x1077=function(_0x2eb15c,_0x21c769){_0x2eb15c=_0x2eb15c-0x0;var _0x523ed4=_0x0771[_0x2eb15c];return _0x523ed4;};'use strict';var multer=require('multer');var util=require(_0x1077('0x0'));var path=require(_0x1077('0x1'));var timeout=require(_0x1077('0x2'));var express=require(_0x1077('0x3'));var router=express['Router']();var auth=require(_0x1077('0x4'));var interaction=require(_0x1077('0x5'));var config=require(_0x1077('0x6'));var controller=require(_0x1077('0x7'));router[_0x1077('0x8')]('/',auth['isAuthenticated'](),controller[_0x1077('0x9')]);router[_0x1077('0x8')](_0x1077('0xa'),auth['isAuthenticated'](),controller[_0x1077('0xb')]);router[_0x1077('0xc')]('/',auth[_0x1077('0xd')](),controller[_0x1077('0xe')]);router[_0x1077('0xf')]('/:id',auth[_0x1077('0xd')](),controller[_0x1077('0x10')]);router[_0x1077('0x11')](_0x1077('0xa'),auth[_0x1077('0xd')](),controller[_0x1077('0x12')]);module[_0x1077('0x13')]=router;
\ No newline at end of file
index 624db7c..5fc4171 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x740d=['sequelize','exports','BOOLEAN','STRING','DATE','ENUM','out'];(function(_0x5d049e,_0x28cb67){var _0x42bff9=function(_0x3d19d5){while(--_0x3d19d5){_0x5d049e['push'](_0x5d049e['shift']());}};_0x42bff9(++_0x28cb67);}(_0x740d,0x1dc));var _0xd740=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x740d[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xd740('0x0'));module[_0xd740('0x1')]={'closed':{'type':Sequelize[_0xd740('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xd740('0x3')]},'note':{'type':Sequelize[_0xd740('0x3')]},'read1stAt':{'type':Sequelize[_0xd740('0x4')]},'fax':{'type':Sequelize[_0xd740('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xd740('0x5')]('in',_0xd740('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd740('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xd740('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}};
\ No newline at end of file
+var _0x3f1e=['ENUM','out','DATE','sequelize','exports','STRING'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x3f1e,0xff));var _0xe3f1=function(_0x37bbc0,_0x4bdf0a){_0x37bbc0=_0x37bbc0-0x0;var _0x5e5e60=_0x3f1e[_0x37bbc0];return _0x5e5e60;};'use strict';var Sequelize=require(_0xe3f1('0x0'));module[_0xe3f1('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xe3f1('0x2')]},'note':{'type':Sequelize[_0xe3f1('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xe3f1('0x3')]('in',_0xe3f1('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe3f1('0x5')]},'lastMsgDirection':{'type':Sequelize[_0xe3f1('0x3')]('in',_0xe3f1('0x4')),'defaultValue':'in','allowNull':![]}};
\ No newline at end of file
index cf42614..ecedbfe 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2507=['querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','FaxInteraction','rawAttributes','keys','filters','intersection','query','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','VIRTUAL','field','filter','options','include','push','Tag','Tags','tag','read','FaxMessage','direction','createdAt','then','includeAll','User','Users','fullname','CmContact','Contact','Owner','internal','FaxAccount','Account','key','color','ThroughTags','rows','catch','show','find','create','body','params','describe','addMessage','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','ids','omit','spread','findAll','faxInteractionTags:save','removeTags','unix','toString','join','root','server','files','tmp','interaction-%s.zip','Attachment','mkdirSync','createReadStream','pipe','createWriteStream','basename','download','err','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js'];(function(_0x4b26b6,_0x594d07){var _0x48301c=function(_0x161899){while(--_0x161899){_0x4b26b6['push'](_0x4b26b6['shift']());}};_0x48301c(++_0x594d07);}(_0x2507,0x1f1));var _0x7250=function(_0xc75431,_0xd2c128){_0xc75431=_0xc75431-0x0;var _0xdc376b=_0x2507[_0xc75431];return _0xdc376b;};'use strict';var pdf=require(_0x7250('0x0'));var emlformat=require(_0x7250('0x1'));var rimraf=require(_0x7250('0x2'));var zipdir=require(_0x7250('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7250('0x4'));var BPromise=require(_0x7250('0x5'));var Mustache=require(_0x7250('0x6'));var util=require(_0x7250('0x7'));var path=require(_0x7250('0x8'));var sox=require(_0x7250('0x9'));var csv=require(_0x7250('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7250('0xb'));var squel=require(_0x7250('0xc'));var crypto=require(_0x7250('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7250('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7250('0xf'));var Papa=require(_0x7250('0x10'));var authService=require(_0x7250('0x11'));var hardwareService=require(_0x7250('0x12'));var Redis=require(_0x7250('0x13'));var qs=require('../../components/parsers/qs');var logger=require(_0x7250('0x14'))(_0x7250('0x15'));var utils=require(_0x7250('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x7250('0x17')]=_['defaults'](config[_0x7250('0x17')],{'host':_0x7250('0x18'),'port':0x18eb});var socket=require(_0x7250('0x19'))(new Redis(config['redis']));require(_0x7250('0x1a'))[_0x7250('0x1b')](socket);function respondWithStatusCode(_0x588004,_0x4d66d6){_0x4d66d6=_0x4d66d6||0xcc;return function(_0x3b2b16){if(_0x3b2b16){return _0x588004[_0x7250('0x1c')](_0x4d66d6);}return _0x588004[_0x7250('0x1d')](_0x4d66d6)['end']();};}function respondWithResult(_0x3ed512,_0x5daeab){_0x5daeab=_0x5daeab||0xc8;return function(_0xa58130){if(_0xa58130){return _0x3ed512['status'](_0x5daeab)[_0x7250('0x1e')](_0xa58130);}};}function respondWithFilteredResult(_0x2ebb52,_0x1c09be){return function(_0x1e4009){if(_0x1e4009){var _0x587630=_0x1e4009[_0x7250('0x1f')],_0x1ce8d0=_0x1c09be['offset'],_0x527090=_0x1c09be[_0x7250('0x20')]+_0x1c09be[_0x7250('0x21')],_0x2796fd;if(_0x527090>=_0x587630){_0x527090=_0x587630;_0x2796fd=0xc8;}else{_0x2796fd=0xce;}_0x2ebb52[_0x7250('0x1d')](_0x2796fd);return _0x2ebb52[_0x7250('0x22')](_0x7250('0x23'),_0x1ce8d0+'-'+_0x527090+'/'+_0x587630)[_0x7250('0x1e')](_0x1e4009);}return null;};}function patchUpdates(_0x2e01a3){return function(_0x584e7d){try{jsonpatch[_0x7250('0x24')](_0x584e7d,_0x2e01a3,!![]);}catch(_0x21dfdf){return BPromise[_0x7250('0x25')](_0x21dfdf);}return _0x584e7d[_0x7250('0x26')]();};}function saveUpdates(_0x29941b,_0x54e0df){return function(_0x5bf14e){if(_0x5bf14e){return _0x5bf14e[_0x7250('0x27')](_0x29941b)['then'](function(_0x9701dc){return _0x9701dc;});}return null;};}function removeEntity(_0x20ec35,_0x420a14){return function(_0x2d44de){if(_0x2d44de){return _0x2d44de[_0x7250('0x28')]()['then'](function(){_0x20ec35[_0x7250('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b045f,_0x52b947){return function(_0x26611c){if(!_0x26611c){_0x2b045f[_0x7250('0x1c')](0x194);}return _0x26611c;};}function handleError(_0x5a9522,_0x5def81){_0x5def81=_0x5def81||0x1f4;return function(_0x27c059){logger[_0x7250('0x29')](_0x27c059[_0x7250('0x2a')]);if(_0x27c059[_0x7250('0x2b')]){delete _0x27c059[_0x7250('0x2b')];}_0x5a9522['status'](_0x5def81)[_0x7250('0x2c')](_0x27c059);};}exports['index']=function(_0x1173d6,_0x3bdafa){var _0x516644={},_0x376bbe={},_0xd45d01={'count':0x0,'rows':[]};var _0x3bdfbd=db[_0x7250('0x2d')][_0x7250('0x2e')];_0x376bbe['model']=_['keys'](_0x3bdfbd);_0x376bbe['query']=_[_0x7250('0x2f')](_0x1173d6['query']);_0x376bbe[_0x7250('0x30')]=_[_0x7250('0x31')](_0x376bbe['model'],_0x376bbe[_0x7250('0x32')]);_0x516644[_0x7250('0x33')]=_[_0x7250('0x31')](_0x376bbe[_0x7250('0x34')],qs[_0x7250('0x35')](_0x1173d6['query'][_0x7250('0x35')]));_0x516644[_0x7250('0x33')]=_0x516644[_0x7250('0x33')][_0x7250('0x36')]?_0x516644['attributes']:_0x376bbe['model'];if(!_0x1173d6[_0x7250('0x32')][_0x7250('0x37')](_0x7250('0x38'))){_0x516644[_0x7250('0x21')]=qs['limit'](_0x1173d6['query']['limit']);_0x516644[_0x7250('0x20')]=qs['offset'](_0x1173d6[_0x7250('0x32')][_0x7250('0x20')]);}_0x516644[_0x7250('0x39')]=qs[_0x7250('0x3a')](_0x1173d6[_0x7250('0x32')]['sort']);_0x516644[_0x7250('0x3b')]=qs['filters'](_[_0x7250('0x3c')](_0x1173d6['query'],_0x376bbe[_0x7250('0x30')]));if(_0x1173d6[_0x7250('0x32')]['filter']){_0x516644[_0x7250('0x3b')]=_[_0x7250('0x3d')](_0x516644[_0x7250('0x3b')],{'$or':_[_0x7250('0x3e')](_0x3bdfbd,function(_0x542958){if(_0x542958[_0x7250('0x3f')]['key']!==_0x7250('0x40')){var _0x18ae79={};_0x18ae79[_0x542958[_0x7250('0x41')]]={'$like':'%'+_0x1173d6[_0x7250('0x32')][_0x7250('0x42')]+'%'};return _0x18ae79;}})});}_0x516644=_['merge']({},_0x516644,_0x1173d6[_0x7250('0x43')]);var _0x5a734b={'where':_0x516644[_0x7250('0x3b')]};_0x5a734b[_0x7250('0x44')]=[];if(_0x1173d6['query']['tag']){_0x5a734b[_0x7250('0x44')][_0x7250('0x45')]({'model':db[_0x7250('0x46')],'as':_0x7250('0x47'),'attributes':['id'],'where':{'id':_0x1173d6[_0x7250('0x32')][_0x7250('0x48')]},'required':!![]});_0x5a734b['distinct']=!![];}if(_0x1173d6[_0x7250('0x32')][_0x7250('0x49')]){_0x5a734b[_0x7250('0x44')][_0x7250('0x45')]({'model':db[_0x7250('0x4a')],'as':'Messages','attributes':['id',_0x7250('0x4b'),_0x7250('0x4c'),'read'],'where':{'direction':'in','read':_0x1173d6[_0x7250('0x32')][_0x7250('0x49')]||![]},'required':!![]});_0x5a734b['distinct']=!![];}return db[_0x7250('0x2d')][_0x7250('0x1f')](_0x5a734b)[_0x7250('0x4d')](function(_0x1f16ff){_0xd45d01[_0x7250('0x1f')]=_0x1f16ff;if(_0x1173d6['query'][_0x7250('0x4e')]){_0x516644['include']=[{'model':db[_0x7250('0x4f')],'as':_0x7250('0x50'),'required':![],'attributes':['id',_0x7250('0x2b'),_0x7250('0x51')]},{'model':db[_0x7250('0x52')],'as':_0x7250('0x53'),'required':![]},{'model':db[_0x7250('0x4f')],'as':_0x7250('0x54'),'attributes':[_0x7250('0x2b'),'fullname',_0x7250('0x55')],'required':![]},{'model':db[_0x7250('0x56')],'as':_0x7250('0x57'),'attributes':[_0x7250('0x2b'),_0x7250('0x58')],'required':![]},{'model':db[_0x7250('0x4a')],'as':'Messages','attributes':['id','direction','createdAt',_0x7250('0x49')],'where':{'direction':'in','read':_0x1173d6[_0x7250('0x32')]['read']||![]},'required':_0x1173d6[_0x7250('0x32')][_0x7250('0x49')]||![]},{'model':db[_0x7250('0x46')],'as':_0x7250('0x47'),'attributes':['id',_0x7250('0x2b'),_0x7250('0x59')],'required':_0x1173d6[_0x7250('0x32')]['tag']?!![]:![]},{'model':db['Tag'],'as':_0x7250('0x5a'),'attributes':['id',_0x7250('0x2b'),'color'],'through':_0x1173d6[_0x7250('0x32')]['tag']?{'attributes':[],'where':{'TagId':_0x1173d6[_0x7250('0x32')]['tag']||undefined}}:{},'required':_0x1173d6[_0x7250('0x32')][_0x7250('0x48')]?!![]:![]}];}return db[_0x7250('0x2d')]['findAll'](_0x516644);})[_0x7250('0x4d')](function(_0x324b21){_0xd45d01[_0x7250('0x5b')]=_0x324b21;return _0xd45d01;})[_0x7250('0x4d')](respondWithFilteredResult(_0x3bdafa,_0x516644))[_0x7250('0x5c')](handleError(_0x3bdafa,null));};exports[_0x7250('0x5d')]=function(_0x2a78e7,_0x275621){var _0x6486f6={'raw':![],'where':{'id':_0x2a78e7['params']['id']}},_0x327151={};_0x327151[_0x7250('0x34')]=_['keys'](db['FaxInteraction']['rawAttributes']);_0x327151[_0x7250('0x32')]=_[_0x7250('0x2f')](_0x2a78e7[_0x7250('0x32')]);_0x327151['filters']=_[_0x7250('0x31')](_0x327151[_0x7250('0x34')],_0x327151['query']);_0x6486f6[_0x7250('0x33')]=_[_0x7250('0x31')](_0x327151['model'],qs[_0x7250('0x35')](_0x2a78e7[_0x7250('0x32')]['fields']));_0x6486f6[_0x7250('0x33')]=_0x6486f6[_0x7250('0x33')][_0x7250('0x36')]?_0x6486f6[_0x7250('0x33')]:_0x327151[_0x7250('0x34')];if(_0x2a78e7['query'][_0x7250('0x4e')]){_0x6486f6['include']=[{'all':!![]}];}_0x6486f6=_[_0x7250('0x3d')]({},_0x6486f6,_0x2a78e7['options']);return db['FaxInteraction'][_0x7250('0x5e')](_0x6486f6)[_0x7250('0x4d')](handleEntityNotFound(_0x275621,null))[_0x7250('0x4d')](respondWithResult(_0x275621,null))[_0x7250('0x5c')](handleError(_0x275621,null));};exports['create']=function(_0x2afcf4,_0x49de5f){return db[_0x7250('0x2d')][_0x7250('0x5f')](_0x2afcf4[_0x7250('0x60')],{})[_0x7250('0x4d')](respondWithResult(_0x49de5f,0xc9))[_0x7250('0x5c')](handleError(_0x49de5f,null));};exports[_0x7250('0x27')]=function(_0x261409,_0x204d63){if(_0x261409[_0x7250('0x60')]['id']){delete _0x261409[_0x7250('0x60')]['id'];}return db['FaxInteraction'][_0x7250('0x5e')]({'where':{'id':_0x261409['params']['id']}})['then'](handleEntityNotFound(_0x204d63,null))[_0x7250('0x4d')](saveUpdates(_0x261409[_0x7250('0x60')],null))[_0x7250('0x4d')](respondWithResult(_0x204d63,null))[_0x7250('0x5c')](handleError(_0x204d63,null));};exports[_0x7250('0x28')]=function(_0x310081,_0x1f02e3){return db[_0x7250('0x2d')]['find']({'where':{'id':_0x310081[_0x7250('0x61')]['id']}})[_0x7250('0x4d')](handleEntityNotFound(_0x1f02e3,null))[_0x7250('0x4d')](removeEntity(_0x1f02e3,null))[_0x7250('0x5c')](handleError(_0x1f02e3,null));};exports['describe']=function(_0xdb8715,_0x62fe97){return db['FaxInteraction'][_0x7250('0x62')]()['then'](respondWithResult(_0x62fe97,null))[_0x7250('0x5c')](handleError(_0x62fe97,null));};exports[_0x7250('0x63')]=function(_0x3200a1,_0x8e5a04,_0x11f768){return db['FaxMessage'][_0x7250('0x5e')]({'where':{'id':_0x3200a1[_0x7250('0x61')]['id']}})[_0x7250('0x4d')](handleEntityNotFound(_0x8e5a04,null))[_0x7250('0x4d')](function(_0x42a57b){if(_0x42a57b){return _0x42a57b['addMessage'](_0x3200a1['body']['ids'],_['omit'](_0x3200a1[_0x7250('0x60')],['ids','id'])||{});}})[_0x7250('0x4d')](respondWithResult(_0x8e5a04,null))[_0x7250('0x5c')](handleError(_0x8e5a04,null));};exports[_0x7250('0x64')]=function(_0x2063c8,_0x10ca58,_0x12ee48){var _0x257a6f={'raw':![],'where':{}};var _0x342df1={};var _0x4d059c={'count':0x0,'rows':[]};return db[_0x7250('0x2d')]['findOne']({'where':{'id':_0x2063c8[_0x7250('0x61')]['id']}})[_0x7250('0x4d')](handleEntityNotFound(_0x10ca58,null))[_0x7250('0x4d')](function(_0x378519){if(_0x378519){_0x342df1[_0x7250('0x34')]=_[_0x7250('0x2f')](db[_0x7250('0x4a')][_0x7250('0x2e')]);_0x342df1['query']=_[_0x7250('0x2f')](_0x2063c8[_0x7250('0x32')]);_0x342df1[_0x7250('0x30')]=_[_0x7250('0x31')](_0x342df1[_0x7250('0x34')],_0x342df1[_0x7250('0x32')]);_0x257a6f['attributes']=_[_0x7250('0x31')](_0x342df1['model'],qs[_0x7250('0x35')](_0x2063c8[_0x7250('0x32')][_0x7250('0x35')]));_0x257a6f[_0x7250('0x33')]=_0x257a6f[_0x7250('0x33')][_0x7250('0x36')]?_0x257a6f['attributes']:_0x342df1['model'];if(!_0x2063c8[_0x7250('0x32')]['hasOwnProperty'](_0x7250('0x38'))){_0x257a6f[_0x7250('0x21')]=qs[_0x7250('0x21')](_0x2063c8[_0x7250('0x32')][_0x7250('0x21')]);_0x257a6f[_0x7250('0x20')]=qs['offset'](_0x2063c8[_0x7250('0x32')][_0x7250('0x20')]);}_0x257a6f[_0x7250('0x39')]=qs['sort'](_0x2063c8['query'][_0x7250('0x3a')]);_0x257a6f[_0x7250('0x3b')]=qs[_0x7250('0x30')](_[_0x7250('0x3c')](_0x2063c8[_0x7250('0x32')],_0x342df1['filters']));_0x257a6f[_0x7250('0x3b')]['FaxInteractionId']=_0x378519['id'];if(_0x2063c8[_0x7250('0x32')][_0x7250('0x42')]){_0x257a6f[_0x7250('0x3b')]=_[_0x7250('0x3d')](_0x257a6f[_0x7250('0x3b')],{'$or':_[_0x7250('0x3e')](_0x257a6f[_0x7250('0x33')],function(_0x4b63b8){var _0x223f9f={};_0x223f9f[_0x4b63b8]={'$like':'%'+_0x2063c8[_0x7250('0x32')][_0x7250('0x42')]+'%'};return _0x223f9f;})});}if(_0x2063c8[_0x7250('0x32')][_0x7250('0x65')]){var _0x5acfde=_0x2063c8[_0x7250('0x32')][_0x7250('0x65')]['split'](',');var _0x2afcd6={};_0x2afcd6[_0x5acfde[0x0]]={'$gte':moment(_0x5acfde[0x1])[_0x7250('0x66')](_0x7250('0x67'))};_0x257a6f[_0x7250('0x3b')]=_[_0x7250('0x3d')](_0x257a6f['where'],_0x2afcd6);}_0x257a6f=_[_0x7250('0x3d')]({},_0x257a6f,_0x2063c8['options']);return db['FaxMessage'][_0x7250('0x1f')]({'where':_0x257a6f[_0x7250('0x3b')]})[_0x7250('0x4d')](function(_0x5546a7){_0x4d059c[_0x7250('0x1f')]=_0x5546a7;if(_0x2063c8[_0x7250('0x32')][_0x7250('0x4e')]){_0x257a6f['include']=[{'all':!![]}];}return db[_0x7250('0x4a')]['findAll'](_0x257a6f);})['then'](function(_0x1fa26d){_0x4d059c[_0x7250('0x5b')]=_0x1fa26d;return _0x4d059c;});}})['then'](respondWithFilteredResult(_0x10ca58,_0x257a6f))['catch'](handleError(_0x10ca58,null));};exports[_0x7250('0x68')]=function(_0x4b037d,_0x1ec7f8,_0x31db4f){return db[_0x7250('0x2d')][_0x7250('0x5e')]({'where':{'id':_0x4b037d['params']['id']}})[_0x7250('0x4d')](handleEntityNotFound(_0x1ec7f8,null))['then'](function(_0x31ccd7){if(_0x31ccd7){return _0x31ccd7[_0x7250('0x69')](_0x4b037d[_0x7250('0x60')][_0x7250('0x6a')],_[_0x7250('0x6b')](_0x4b037d[_0x7250('0x60')],[_0x7250('0x6a'),'id'])||{})[_0x7250('0x6c')](function(){return db[_0x7250('0x46')][_0x7250('0x6d')]({'attributes':['id',_0x7250('0x2b'),'color'],'where':{'id':_0x4b037d[_0x7250('0x60')]['ids']}});})[_0x7250('0x4d')](function(_0x531608){socket['emit'](_0x7250('0x6e'),{'id':Number(_0x4b037d['params']['id']),'tags':_0x531608||[]});return{'id':Number(_0x4b037d['params']['id']),'tags':_0x531608||[]};});}})[_0x7250('0x4d')](respondWithResult(_0x1ec7f8,null))[_0x7250('0x5c')](handleError(_0x1ec7f8,null));};exports['removeTags']=function(_0x1d21b7,_0x866b51,_0x5cec50){var _0x32fe25;return db[_0x7250('0x2d')][_0x7250('0x5e')]({'where':{'id':_0x1d21b7[_0x7250('0x61')]['id']}})[_0x7250('0x4d')](handleEntityNotFound(_0x866b51,null))[_0x7250('0x4d')](function(_0x39bc6c){if(_0x39bc6c){return _0x39bc6c[_0x7250('0x6f')](_0x1d21b7[_0x7250('0x32')][_0x7250('0x6a')]);}})[_0x7250('0x4d')](respondWithStatusCode(_0x866b51,null))['catch'](handleError(_0x866b51,null));};exports['download']=function(_0x841cd7,_0x31ca7e){var _0x11b7eb=moment()[_0x7250('0x70')]()[_0x7250('0x71')]();var _0x16baab=path[_0x7250('0x72')](config[_0x7250('0x73')],_0x7250('0x74'),_0x7250('0x75'),'attachments');var _0xc4e827=path[_0x7250('0x72')](config['root'],_0x7250('0x74'),_0x7250('0x75'),_0x7250('0x76'));var _0x5521ea=path[_0x7250('0x72')](_0xc4e827,_0x11b7eb);var _0x1e729f=util[_0x7250('0x66')](_0x7250('0x77'),_0x11b7eb);var _0x36e639=path[_0x7250('0x72')](_0xc4e827,_0x1e729f);var _0x5b279e=![];return db[_0x7250('0x2d')][_0x7250('0x5e')]({'where':{'id':_0x841cd7[_0x7250('0x61')]['id']}})[_0x7250('0x4d')](handleEntityNotFound(_0x31ca7e,null))[_0x7250('0x4d')](function(_0x266367){if(_0x266367){return _0x266367[_0x7250('0x64')]({'attributes':['id','body','createdAt'],'include':[{'model':db[_0x7250('0x78')],'as':_0x7250('0x78')}]});}return[];})[_0x7250('0x4d')](function(_0x24d367){_0x5b279e=_0x24d367[_0x7250('0x36')];if(_0x24d367[_0x7250('0x36')]){fs[_0x7250('0x79')](_0x5521ea);for(var _0x4ffc1d=0x0;_0x4ffc1d<_0x24d367['length'];_0x4ffc1d++){var _0x4c29d9=_0x24d367[_0x4ffc1d];var _0x4180e1=_0x4c29d9[_0x7250('0x78')];if(_0x4180e1){var _0x324cf6=path[_0x7250('0x72')](_0x16baab,_0x4180e1['basename']);if(fs['existsSync'](_0x324cf6)){fs[_0x7250('0x7a')](_0x324cf6)[_0x7250('0x7b')](fs[_0x7250('0x7c')](path[_0x7250('0x72')](_0x5521ea,_0x4180e1[_0x7250('0x7d')])));}}}}})[_0x7250('0x4d')](function(){if(_0x5b279e){return new BPromise(function(_0x4acb7f,_0x41c544){zipdir(_0x5521ea,{'saveTo':_0x36e639},function(_0x2b62b6,_0x451cf6){if(_0x2b62b6)return _0x41c544(_0x2b62b6);return _0x4acb7f(_0x451cf6);});});}})[_0x7250('0x4d')](function(){if(_0x5b279e){return new BPromise(function(_0x38956e,_0x201595){rimraf(_0x5521ea,function(_0x2bd293){if(_0x2bd293)_0x201595(_0x2bd293);return _0x38956e();});});}})[_0x7250('0x4d')](function(){if(_0x5b279e){return _0x31ca7e[_0x7250('0x7e')](_0x36e639,_0x1e729f,function(_0x32965d){if(_0x32965d){console['log'](_0x7250('0x7f'),_0x32965d);}else{fs['unlinkSync'](_0x36e639);}});}else{return _0x31ca7e[_0x7250('0x1c')](0xc8);}})[_0x7250('0x5c')](handleError(_0x31ca7e,null));};
\ No newline at end of file
+var _0x1acc=['socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','offset','set','json','apply','reject','save','update','then','destroy','error','name','send','index','FaxInteraction','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','key','VIRTUAL','field','options','include','tag','Tag','Tags','distinct','read','push','createdAt','count','includeAll','CmContact','Contact','User','Owner','FaxMessage','Messages','direction','color','ThroughTags','findAll','rows','show','params','find','catch','create','body','describe','addMessage','ids','getMessages','findOne','map','$gte','split','format','addTags','omit','emit','faxInteractionTags:save','removeTags','unix','toString','join','root','server','files','attachments','tmp','interaction-%s.zip','Attachment','mkdirSync','basename','existsSync','createWriteStream','log','err','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost'];(function(_0x1c4103,_0x478ce4){var _0x500e3d=function(_0xbba3c6){while(--_0xbba3c6){_0x1c4103['push'](_0x1c4103['shift']());}};_0x500e3d(++_0x478ce4);}(_0x1acc,0x15c));var _0xc1ac=function(_0x214960,_0x354ced){_0x214960=_0x214960-0x0;var _0x4d9333=_0x1acc[_0x214960];return _0x4d9333;};'use strict';var pdf=require(_0xc1ac('0x0'));var emlformat=require(_0xc1ac('0x1'));var rimraf=require(_0xc1ac('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc1ac('0x3'));var rp=require(_0xc1ac('0x4'));var moment=require(_0xc1ac('0x5'));var BPromise=require(_0xc1ac('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc1ac('0x7'));var csv=require('to-csv');var ejs=require(_0xc1ac('0x8'));var fs=require('fs');var _=require(_0xc1ac('0x9'));var squel=require(_0xc1ac('0xa'));var crypto=require(_0xc1ac('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc1ac('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc1ac('0xd'));var Papa=require(_0xc1ac('0xe'));var authService=require('../../components/auth/service');var hardwareService=require(_0xc1ac('0xf'));var Redis=require('ioredis');var qs=require(_0xc1ac('0x10'));var logger=require(_0xc1ac('0x11'))(_0xc1ac('0x12'));var utils=require(_0xc1ac('0x13'));var config=require(_0xc1ac('0x14'));var db=require(_0xc1ac('0x15'))['db'];config[_0xc1ac('0x16')]=_['defaults'](config[_0xc1ac('0x16')],{'host':_0xc1ac('0x17'),'port':0x18eb});var socket=require(_0xc1ac('0x18'))(new Redis(config[_0xc1ac('0x16')]));require(_0xc1ac('0x19'))[_0xc1ac('0x1a')](socket);function respondWithStatusCode(_0x3f9c27,_0x8030b){_0x8030b=_0x8030b||0xcc;return function(_0xc358ff){if(_0xc358ff){return _0x3f9c27[_0xc1ac('0x1b')](_0x8030b);}return _0x3f9c27[_0xc1ac('0x1c')](_0x8030b)[_0xc1ac('0x1d')]();};}function respondWithResult(_0x389bf6,_0x49cbb1){_0x49cbb1=_0x49cbb1||0xc8;return function(_0x31cbfe){if(_0x31cbfe){return _0x389bf6[_0xc1ac('0x1c')](_0x49cbb1)['json'](_0x31cbfe);}};}function respondWithFilteredResult(_0xa8b093,_0x562f37){return function(_0x3c0065){if(_0x3c0065){var _0x1240c9=_0x3c0065['count'],_0x4cf798=_0x562f37[_0xc1ac('0x1e')],_0x1683ae=_0x562f37[_0xc1ac('0x1e')]+_0x562f37['limit'],_0x22c1ed;if(_0x1683ae>=_0x1240c9){_0x1683ae=_0x1240c9;_0x22c1ed=0xc8;}else{_0x22c1ed=0xce;}_0xa8b093['status'](_0x22c1ed);return _0xa8b093[_0xc1ac('0x1f')]('Content-Range',_0x4cf798+'-'+_0x1683ae+'/'+_0x1240c9)[_0xc1ac('0x20')](_0x3c0065);}return null;};}function patchUpdates(_0x573c8d){return function(_0x522b32){try{jsonpatch[_0xc1ac('0x21')](_0x522b32,_0x573c8d,!![]);}catch(_0x578b44){return BPromise[_0xc1ac('0x22')](_0x578b44);}return _0x522b32[_0xc1ac('0x23')]();};}function saveUpdates(_0x53b994,_0x3fe644){return function(_0x9aeaac){if(_0x9aeaac){return _0x9aeaac[_0xc1ac('0x24')](_0x53b994)[_0xc1ac('0x25')](function(_0x3b1e1c){return _0x3b1e1c;});}return null;};}function removeEntity(_0x2d6fa9,_0x5b6362){return function(_0x1afcb4){if(_0x1afcb4){return _0x1afcb4[_0xc1ac('0x26')]()[_0xc1ac('0x25')](function(){_0x2d6fa9[_0xc1ac('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b904b,_0x4fe0fe){return function(_0x1192e4){if(!_0x1192e4){_0x3b904b[_0xc1ac('0x1b')](0x194);}return _0x1192e4;};}function handleError(_0x166b12,_0x442025){_0x442025=_0x442025||0x1f4;return function(_0x2ba4bd){logger[_0xc1ac('0x27')](_0x2ba4bd['stack']);if(_0x2ba4bd[_0xc1ac('0x28')]){delete _0x2ba4bd[_0xc1ac('0x28')];}_0x166b12[_0xc1ac('0x1c')](_0x442025)[_0xc1ac('0x29')](_0x2ba4bd);};}exports[_0xc1ac('0x2a')]=function(_0x58d05e,_0x39d503){var _0x2d5426={},_0x2fbe5a={},_0x56b7f2={'count':0x0,'rows':[]};var _0x163210=db[_0xc1ac('0x2b')][_0xc1ac('0x2c')];_0x2fbe5a[_0xc1ac('0x2d')]=_['keys'](_0x163210);_0x2fbe5a[_0xc1ac('0x2e')]=_[_0xc1ac('0x2f')](_0x58d05e[_0xc1ac('0x2e')]);_0x2fbe5a[_0xc1ac('0x30')]=_[_0xc1ac('0x31')](_0x2fbe5a[_0xc1ac('0x2d')],_0x2fbe5a[_0xc1ac('0x2e')]);_0x2d5426['attributes']=_['intersection'](_0x2fbe5a[_0xc1ac('0x2d')],qs[_0xc1ac('0x32')](_0x58d05e[_0xc1ac('0x2e')][_0xc1ac('0x32')]));_0x2d5426[_0xc1ac('0x33')]=_0x2d5426[_0xc1ac('0x33')][_0xc1ac('0x34')]?_0x2d5426[_0xc1ac('0x33')]:_0x2fbe5a[_0xc1ac('0x2d')];if(!_0x58d05e[_0xc1ac('0x2e')][_0xc1ac('0x35')](_0xc1ac('0x36'))){_0x2d5426['limit']=qs[_0xc1ac('0x37')](_0x58d05e[_0xc1ac('0x2e')][_0xc1ac('0x37')]);_0x2d5426[_0xc1ac('0x1e')]=qs[_0xc1ac('0x1e')](_0x58d05e[_0xc1ac('0x2e')][_0xc1ac('0x1e')]);}_0x2d5426[_0xc1ac('0x38')]=qs[_0xc1ac('0x39')](_0x58d05e[_0xc1ac('0x2e')][_0xc1ac('0x39')]);_0x2d5426[_0xc1ac('0x3a')]=qs[_0xc1ac('0x30')](_[_0xc1ac('0x3b')](_0x58d05e[_0xc1ac('0x2e')],_0x2fbe5a[_0xc1ac('0x30')]));if(_0x58d05e[_0xc1ac('0x2e')][_0xc1ac('0x3c')]){_0x2d5426[_0xc1ac('0x3a')]=_[_0xc1ac('0x3d')](_0x2d5426['where'],{'$or':_['map'](_0x163210,function(_0x5ca04d){if(_0x5ca04d[_0xc1ac('0x3e')][_0xc1ac('0x3f')]!==_0xc1ac('0x40')){var _0x44beea={};_0x44beea[_0x5ca04d[_0xc1ac('0x41')]]={'$like':'%'+_0x58d05e[_0xc1ac('0x2e')][_0xc1ac('0x3c')]+'%'};return _0x44beea;}})});}_0x2d5426=_[_0xc1ac('0x3d')]({},_0x2d5426,_0x58d05e[_0xc1ac('0x42')]);var _0x1304b1={'where':_0x2d5426['where']};_0x1304b1[_0xc1ac('0x43')]=[];if(_0x58d05e[_0xc1ac('0x2e')][_0xc1ac('0x44')]){_0x1304b1[_0xc1ac('0x43')]['push']({'model':db[_0xc1ac('0x45')],'as':_0xc1ac('0x46'),'attributes':['id'],'where':{'id':_0x58d05e[_0xc1ac('0x2e')][_0xc1ac('0x44')]},'required':!![]});_0x1304b1[_0xc1ac('0x47')]=!![];}if(_0x58d05e[_0xc1ac('0x2e')][_0xc1ac('0x48')]){_0x1304b1['include'][_0xc1ac('0x49')]({'model':db['FaxMessage'],'as':'Messages','attributes':['id','direction',_0xc1ac('0x4a'),_0xc1ac('0x48')],'where':{'direction':'in','read':_0x58d05e[_0xc1ac('0x2e')][_0xc1ac('0x48')]||![]},'required':!![]});_0x1304b1[_0xc1ac('0x47')]=!![];}return db[_0xc1ac('0x2b')][_0xc1ac('0x4b')](_0x1304b1)[_0xc1ac('0x25')](function(_0x185667){_0x56b7f2[_0xc1ac('0x4b')]=_0x185667;if(_0x58d05e[_0xc1ac('0x2e')][_0xc1ac('0x4c')]){_0x2d5426[_0xc1ac('0x43')]=[{'model':db['User'],'as':'Users','required':![],'attributes':['id',_0xc1ac('0x28'),'fullname']},{'model':db[_0xc1ac('0x4d')],'as':_0xc1ac('0x4e'),'required':![]},{'model':db[_0xc1ac('0x4f')],'as':_0xc1ac('0x50'),'attributes':[_0xc1ac('0x28'),'fullname','internal'],'required':![]},{'model':db['FaxAccount'],'as':'Account','attributes':['name',_0xc1ac('0x3f')],'required':![]},{'model':db[_0xc1ac('0x51')],'as':_0xc1ac('0x52'),'attributes':['id',_0xc1ac('0x53'),'createdAt',_0xc1ac('0x48')],'where':{'direction':'in','read':_0x58d05e['query'][_0xc1ac('0x48')]||![]},'required':_0x58d05e[_0xc1ac('0x2e')]['read']||![]},{'model':db[_0xc1ac('0x45')],'as':_0xc1ac('0x46'),'attributes':['id',_0xc1ac('0x28'),_0xc1ac('0x54')],'required':_0x58d05e[_0xc1ac('0x2e')][_0xc1ac('0x44')]?!![]:![]},{'model':db[_0xc1ac('0x45')],'as':_0xc1ac('0x55'),'attributes':['id',_0xc1ac('0x28'),'color'],'through':_0x58d05e[_0xc1ac('0x2e')][_0xc1ac('0x44')]?{'attributes':[],'where':{'TagId':_0x58d05e[_0xc1ac('0x2e')][_0xc1ac('0x44')]||undefined}}:{},'required':_0x58d05e[_0xc1ac('0x2e')][_0xc1ac('0x44')]?!![]:![]}];}return db[_0xc1ac('0x2b')][_0xc1ac('0x56')](_0x2d5426);})[_0xc1ac('0x25')](function(_0x1f07cb){_0x56b7f2[_0xc1ac('0x57')]=_0x1f07cb;return _0x56b7f2;})['then'](respondWithFilteredResult(_0x39d503,_0x2d5426))['catch'](handleError(_0x39d503,null));};exports[_0xc1ac('0x58')]=function(_0x4c8e88,_0x4d2f98){var _0x2eb0b3={'raw':![],'where':{'id':_0x4c8e88[_0xc1ac('0x59')]['id']}},_0x5669aa={};_0x5669aa[_0xc1ac('0x2d')]=_[_0xc1ac('0x2f')](db[_0xc1ac('0x2b')]['rawAttributes']);_0x5669aa[_0xc1ac('0x2e')]=_[_0xc1ac('0x2f')](_0x4c8e88['query']);_0x5669aa[_0xc1ac('0x30')]=_[_0xc1ac('0x31')](_0x5669aa[_0xc1ac('0x2d')],_0x5669aa['query']);_0x2eb0b3[_0xc1ac('0x33')]=_[_0xc1ac('0x31')](_0x5669aa['model'],qs[_0xc1ac('0x32')](_0x4c8e88['query'][_0xc1ac('0x32')]));_0x2eb0b3[_0xc1ac('0x33')]=_0x2eb0b3['attributes']['length']?_0x2eb0b3[_0xc1ac('0x33')]:_0x5669aa[_0xc1ac('0x2d')];if(_0x4c8e88[_0xc1ac('0x2e')][_0xc1ac('0x4c')]){_0x2eb0b3['include']=[{'all':!![]}];}_0x2eb0b3=_[_0xc1ac('0x3d')]({},_0x2eb0b3,_0x4c8e88[_0xc1ac('0x42')]);return db['FaxInteraction'][_0xc1ac('0x5a')](_0x2eb0b3)[_0xc1ac('0x25')](handleEntityNotFound(_0x4d2f98,null))[_0xc1ac('0x25')](respondWithResult(_0x4d2f98,null))[_0xc1ac('0x5b')](handleError(_0x4d2f98,null));};exports['create']=function(_0x4c38dd,_0x4462b3){return db[_0xc1ac('0x2b')][_0xc1ac('0x5c')](_0x4c38dd['body'],{})[_0xc1ac('0x25')](respondWithResult(_0x4462b3,0xc9))[_0xc1ac('0x5b')](handleError(_0x4462b3,null));};exports[_0xc1ac('0x24')]=function(_0x55f5e5,_0x3a0a2b){if(_0x55f5e5[_0xc1ac('0x5d')]['id']){delete _0x55f5e5[_0xc1ac('0x5d')]['id'];}return db[_0xc1ac('0x2b')]['find']({'where':{'id':_0x55f5e5[_0xc1ac('0x59')]['id']}})['then'](handleEntityNotFound(_0x3a0a2b,null))[_0xc1ac('0x25')](saveUpdates(_0x55f5e5[_0xc1ac('0x5d')],null))[_0xc1ac('0x25')](respondWithResult(_0x3a0a2b,null))['catch'](handleError(_0x3a0a2b,null));};exports[_0xc1ac('0x26')]=function(_0x2ecbec,_0x2acbb4){return db[_0xc1ac('0x2b')][_0xc1ac('0x5a')]({'where':{'id':_0x2ecbec[_0xc1ac('0x59')]['id']}})[_0xc1ac('0x25')](handleEntityNotFound(_0x2acbb4,null))[_0xc1ac('0x25')](removeEntity(_0x2acbb4,null))['catch'](handleError(_0x2acbb4,null));};exports[_0xc1ac('0x5e')]=function(_0x460060,_0x512fba){return db[_0xc1ac('0x2b')][_0xc1ac('0x5e')]()[_0xc1ac('0x25')](respondWithResult(_0x512fba,null))[_0xc1ac('0x5b')](handleError(_0x512fba,null));};exports[_0xc1ac('0x5f')]=function(_0x31d9e7,_0x4f299c,_0x9aec15){return db[_0xc1ac('0x51')][_0xc1ac('0x5a')]({'where':{'id':_0x31d9e7[_0xc1ac('0x59')]['id']}})['then'](handleEntityNotFound(_0x4f299c,null))[_0xc1ac('0x25')](function(_0x3b8b67){if(_0x3b8b67){return _0x3b8b67['addMessage'](_0x31d9e7[_0xc1ac('0x5d')][_0xc1ac('0x60')],_['omit'](_0x31d9e7['body'],['ids','id'])||{});}})[_0xc1ac('0x25')](respondWithResult(_0x4f299c,null))[_0xc1ac('0x5b')](handleError(_0x4f299c,null));};exports[_0xc1ac('0x61')]=function(_0x460888,_0x5b9423,_0x4ee820){var _0x5aafbc={'raw':![],'where':{}};var _0x46906a={};var _0x359f57={'count':0x0,'rows':[]};return db[_0xc1ac('0x2b')][_0xc1ac('0x62')]({'where':{'id':_0x460888['params']['id']}})[_0xc1ac('0x25')](handleEntityNotFound(_0x5b9423,null))[_0xc1ac('0x25')](function(_0x6ddfc7){if(_0x6ddfc7){_0x46906a[_0xc1ac('0x2d')]=_[_0xc1ac('0x2f')](db['FaxMessage']['rawAttributes']);_0x46906a['query']=_[_0xc1ac('0x2f')](_0x460888['query']);_0x46906a[_0xc1ac('0x30')]=_[_0xc1ac('0x31')](_0x46906a['model'],_0x46906a['query']);_0x5aafbc['attributes']=_[_0xc1ac('0x31')](_0x46906a[_0xc1ac('0x2d')],qs['fields'](_0x460888[_0xc1ac('0x2e')][_0xc1ac('0x32')]));_0x5aafbc[_0xc1ac('0x33')]=_0x5aafbc[_0xc1ac('0x33')][_0xc1ac('0x34')]?_0x5aafbc[_0xc1ac('0x33')]:_0x46906a[_0xc1ac('0x2d')];if(!_0x460888[_0xc1ac('0x2e')]['hasOwnProperty'](_0xc1ac('0x36'))){_0x5aafbc['limit']=qs[_0xc1ac('0x37')](_0x460888[_0xc1ac('0x2e')][_0xc1ac('0x37')]);_0x5aafbc[_0xc1ac('0x1e')]=qs[_0xc1ac('0x1e')](_0x460888[_0xc1ac('0x2e')][_0xc1ac('0x1e')]);}_0x5aafbc['order']=qs['sort'](_0x460888['query']['sort']);_0x5aafbc[_0xc1ac('0x3a')]=qs['filters'](_[_0xc1ac('0x3b')](_0x460888[_0xc1ac('0x2e')],_0x46906a[_0xc1ac('0x30')]));_0x5aafbc[_0xc1ac('0x3a')]['FaxInteractionId']=_0x6ddfc7['id'];if(_0x460888[_0xc1ac('0x2e')]['filter']){_0x5aafbc[_0xc1ac('0x3a')]=_[_0xc1ac('0x3d')](_0x5aafbc[_0xc1ac('0x3a')],{'$or':_[_0xc1ac('0x63')](_0x5aafbc[_0xc1ac('0x33')],function(_0x3b77a2){var _0x32b1ae={};_0x32b1ae[_0x3b77a2]={'$like':'%'+_0x460888['query'][_0xc1ac('0x3c')]+'%'};return _0x32b1ae;})});}if(_0x460888[_0xc1ac('0x2e')]['$gte']){var _0x3c329a=_0x460888['query'][_0xc1ac('0x64')][_0xc1ac('0x65')](',');var _0x4d7769={};_0x4d7769[_0x3c329a[0x0]]={'$gte':moment(_0x3c329a[0x1])[_0xc1ac('0x66')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5aafbc[_0xc1ac('0x3a')]=_['merge'](_0x5aafbc['where'],_0x4d7769);}_0x5aafbc=_[_0xc1ac('0x3d')]({},_0x5aafbc,_0x460888['options']);return db[_0xc1ac('0x51')][_0xc1ac('0x4b')]({'where':_0x5aafbc[_0xc1ac('0x3a')]})[_0xc1ac('0x25')](function(_0x3229e4){_0x359f57['count']=_0x3229e4;if(_0x460888[_0xc1ac('0x2e')][_0xc1ac('0x4c')]){_0x5aafbc[_0xc1ac('0x43')]=[{'all':!![]}];}return db[_0xc1ac('0x51')][_0xc1ac('0x56')](_0x5aafbc);})[_0xc1ac('0x25')](function(_0x22f5d1){_0x359f57['rows']=_0x22f5d1;return _0x359f57;});}})[_0xc1ac('0x25')](respondWithFilteredResult(_0x5b9423,_0x5aafbc))[_0xc1ac('0x5b')](handleError(_0x5b9423,null));};exports[_0xc1ac('0x67')]=function(_0x5b83d2,_0x44a3b3,_0x5e119c){return db[_0xc1ac('0x2b')][_0xc1ac('0x5a')]({'where':{'id':_0x5b83d2[_0xc1ac('0x59')]['id']}})['then'](handleEntityNotFound(_0x44a3b3,null))['then'](function(_0x319aad){if(_0x319aad){return _0x319aad['setTags'](_0x5b83d2[_0xc1ac('0x5d')][_0xc1ac('0x60')],_[_0xc1ac('0x68')](_0x5b83d2[_0xc1ac('0x5d')],['ids','id'])||{})['spread'](function(){return db['Tag'][_0xc1ac('0x56')]({'attributes':['id',_0xc1ac('0x28'),_0xc1ac('0x54')],'where':{'id':_0x5b83d2[_0xc1ac('0x5d')]['ids']}});})['then'](function(_0xf87fe){socket[_0xc1ac('0x69')](_0xc1ac('0x6a'),{'id':Number(_0x5b83d2['params']['id']),'tags':_0xf87fe||[]});return{'id':Number(_0x5b83d2[_0xc1ac('0x59')]['id']),'tags':_0xf87fe||[]};});}})['then'](respondWithResult(_0x44a3b3,null))[_0xc1ac('0x5b')](handleError(_0x44a3b3,null));};exports[_0xc1ac('0x6b')]=function(_0x6e4ac0,_0x3ea0fe,_0x517ce4){var _0x4d60ca;return db[_0xc1ac('0x2b')][_0xc1ac('0x5a')]({'where':{'id':_0x6e4ac0[_0xc1ac('0x59')]['id']}})[_0xc1ac('0x25')](handleEntityNotFound(_0x3ea0fe,null))[_0xc1ac('0x25')](function(_0x4fc10a){if(_0x4fc10a){return _0x4fc10a[_0xc1ac('0x6b')](_0x6e4ac0[_0xc1ac('0x2e')][_0xc1ac('0x60')]);}})[_0xc1ac('0x25')](respondWithStatusCode(_0x3ea0fe,null))[_0xc1ac('0x5b')](handleError(_0x3ea0fe,null));};exports['download']=function(_0x4df205,_0x16dd9a){var _0x813902=moment()[_0xc1ac('0x6c')]()[_0xc1ac('0x6d')]();var _0x320ea9=path[_0xc1ac('0x6e')](config[_0xc1ac('0x6f')],_0xc1ac('0x70'),_0xc1ac('0x71'),_0xc1ac('0x72'));var _0x51aaf2=path['join'](config[_0xc1ac('0x6f')],'server','files',_0xc1ac('0x73'));var _0xda0059=path[_0xc1ac('0x6e')](_0x51aaf2,_0x813902);var _0x394023=util[_0xc1ac('0x66')](_0xc1ac('0x74'),_0x813902);var _0x53b041=path[_0xc1ac('0x6e')](_0x51aaf2,_0x394023);var _0x233a7a=![];return db['FaxInteraction'][_0xc1ac('0x5a')]({'where':{'id':_0x4df205[_0xc1ac('0x59')]['id']}})['then'](handleEntityNotFound(_0x16dd9a,null))[_0xc1ac('0x25')](function(_0x185555){if(_0x185555){return _0x185555[_0xc1ac('0x61')]({'attributes':['id',_0xc1ac('0x5d'),_0xc1ac('0x4a')],'include':[{'model':db['Attachment'],'as':_0xc1ac('0x75')}]});}return[];})[_0xc1ac('0x25')](function(_0x5e1f0b){_0x233a7a=_0x5e1f0b['length'];if(_0x5e1f0b[_0xc1ac('0x34')]){fs[_0xc1ac('0x76')](_0xda0059);for(var _0x18c80a=0x0;_0x18c80a<_0x5e1f0b[_0xc1ac('0x34')];_0x18c80a++){var _0x440bf8=_0x5e1f0b[_0x18c80a];var _0x3bc8a1=_0x440bf8['Attachment'];if(_0x3bc8a1){var _0x127bf2=path[_0xc1ac('0x6e')](_0x320ea9,_0x3bc8a1[_0xc1ac('0x77')]);if(fs[_0xc1ac('0x78')](_0x127bf2)){fs['createReadStream'](_0x127bf2)['pipe'](fs[_0xc1ac('0x79')](path[_0xc1ac('0x6e')](_0xda0059,_0x3bc8a1['basename'])));}}}}})[_0xc1ac('0x25')](function(){if(_0x233a7a){return new BPromise(function(_0x16f76d,_0x3371a4){zipdir(_0xda0059,{'saveTo':_0x53b041},function(_0x2fd3c4,_0x38781f){if(_0x2fd3c4)return _0x3371a4(_0x2fd3c4);return _0x16f76d(_0x38781f);});});}})[_0xc1ac('0x25')](function(){if(_0x233a7a){return new BPromise(function(_0x328fb4,_0x10238f){rimraf(_0xda0059,function(_0x5434c8){if(_0x5434c8)_0x10238f(_0x5434c8);return _0x328fb4();});});}})[_0xc1ac('0x25')](function(){if(_0x233a7a){return _0x16dd9a['download'](_0x53b041,_0x394023,function(_0x4e3105){if(_0x4e3105){console[_0xc1ac('0x7a')](_0xc1ac('0x7b'),_0x4e3105);}else{fs['unlinkSync'](_0x53b041);}});}else{return _0x16dd9a[_0xc1ac('0x1b')](0xc8);}})[_0xc1ac('0x5b')](handleError(_0x16dd9a,null));};
\ No newline at end of file
index ccdbcb6..806538a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x98e5=['setMaxListeners','save','remove','emit','hook','exports'];(function(_0x1953d2,_0x29d90e){var _0x497ddc=function(_0x4d0f51){while(--_0x4d0f51){_0x1953d2['push'](_0x1953d2['shift']());}};_0x497ddc(++_0x29d90e);}(_0x98e5,0x8a));var _0x598e=function(_0x1ea5e1,_0x4e987e){_0x1ea5e1=_0x1ea5e1-0x0;var _0x4bb921=_0x98e5[_0x1ea5e1];return _0x4bb921;};'use strict';var EventEmitter=require('events');var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x598e('0x0')](0x0);var events={'afterCreate':_0x598e('0x1'),'afterUpdate':'update','afterDestroy':_0x598e('0x2')};function emitEvent(_0xc090ec){return function(_0x5cc274,_0x3af01f,_0x5a876c){FaxInteractionEvents['emit'](_0xc090ec+':'+_0x5cc274['id'],_0x5cc274);FaxInteractionEvents[_0x598e('0x3')](_0xc090ec,_0x5cc274);_0x5a876c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x598e('0x4')](e,emitEvent(event));}}module[_0x598e('0x5')]=FaxInteractionEvents;
\ No newline at end of file
+var _0xe706=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','save','update','remove','emit'];(function(_0x1a1b42,_0x411214){var _0x50b145=function(_0x5b9f5d){while(--_0x5b9f5d){_0x1a1b42['push'](_0x1a1b42['shift']());}};_0x50b145(++_0x411214);}(_0xe706,0xa3));var _0x6e70=function(_0xc350,_0x2fb0f8){_0xc350=_0xc350-0x0;var _0x126021=_0xe706[_0xc350];return _0x126021;};'use strict';var EventEmitter=require(_0x6e70('0x0'));var FaxInteraction=require(_0x6e70('0x1'))['db'][_0x6e70('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6e70('0x3'),'afterUpdate':_0x6e70('0x4'),'afterDestroy':_0x6e70('0x5')};function emitEvent(_0x7dfbc3){return function(_0x142c27,_0x2164a4,_0x376a8d){FaxInteractionEvents[_0x6e70('0x6')](_0x7dfbc3+':'+_0x142c27['id'],_0x142c27);FaxInteractionEvents[_0x6e70('0x6')](_0x7dfbc3,_0x142c27);_0x376a8d(null);};}for(var e in events){if(events[_0x6e70('0x7')](e)){var event=events[e];FaxInteraction[_0x6e70('0x8')](e,emitEvent(event));}}module[_0x6e70('0x9')]=FaxInteractionEvents;
\ No newline at end of file
index ac8f16a..2340faa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6b6b=['moment','bluebird','request-promise','./faxInteraction.attributes','FaxInteraction','fax_interactions','lodash','../../config/logger','api'];(function(_0x3a4edc,_0x5fbdc8){var _0x3f4a76=function(_0x1b6def){while(--_0x1b6def){_0x3a4edc['push'](_0x3a4edc['shift']());}};_0x3f4a76(++_0x5fbdc8);}(_0x6b6b,0x84));var _0xb6b6=function(_0x44aacc,_0x21005e){_0x44aacc=_0x44aacc-0x0;var _0x838744=_0x6b6b[_0x44aacc];return _0x838744;};'use strict';var _=require(_0xb6b6('0x0'));var util=require('util');var logger=require(_0xb6b6('0x1'))(_0xb6b6('0x2'));var moment=require(_0xb6b6('0x3'));var BPromise=require(_0xb6b6('0x4'));var rp=require(_0xb6b6('0x5'));var attributes=require(_0xb6b6('0x6'));module['exports']=function(_0x22a681,_0x4d0682){return _0x22a681['define'](_0xb6b6('0x7'),attributes,{'tableName':_0xb6b6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xa9e0=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','./faxInteraction.attributes','exports','define','fax_interactions','closed'];(function(_0x3c6395,_0x5ecdc2){var _0x3466d3=function(_0x5c9be8){while(--_0x5c9be8){_0x3c6395['push'](_0x3c6395['shift']());}};_0x3466d3(++_0x5ecdc2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 attributes=require(_0x0a9e('0x4'));module[_0x0a9e('0x5')]=function(_0x2ab90b,_0x991246){return _0x2ab90b[_0x0a9e('0x6')]('FaxInteraction',attributes,{'tableName':_0x0a9e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x441e3a,_0x2cc193,_0x5f41ea){if(_0x441e3a['changed'](_0x0a9e('0x8'))){_0x441e3a['closedAt']=moment()['format'](_0x0a9e('0x9'));}_0x5f41ea(null,_0x441e3a);}}});};
\ No newline at end of file
index 89a8dbe..c519bc1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf523=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','body','options','where','attributes','limit','then','AddTagsToFaxInteraction','FaxInteraction','find','addTags','omit','stringify','AddTags','moment','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf523,0x108));var _0x3f52=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf523[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3f52('0x0'));var BPromise=require(_0x3f52('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f52('0x2'));var db=require(_0x3f52('0x3'))['db'];var utils=require(_0x3f52('0x4'));var logger=require(_0x3f52('0x5'))(_0x3f52('0x6'));var config=require(_0x3f52('0x7'));var jayson=require(_0x3f52('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x3f52('0x9')]=_['defaults'](config[_0x3f52('0x9')],{'host':_0x3f52('0xa'),'port':0x18eb});var socket=require(_0x3f52('0xb'))(new Redis(config[_0x3f52('0x9')]));require(_0x3f52('0xc'))[_0x3f52('0xd')](socket);function respondWithRpcPromise(_0x301659,_0x5da567,_0x209feb){return new BPromise(function(_0x5e96a3,_0x2be4af){return client[_0x3f52('0xe')](_0x301659,_0x209feb)['then'](function(_0x2739d8){logger[_0x3f52('0xf')]('FaxInteraction,\x20%s,\x20%s',_0x5da567,_0x3f52('0x10'));logger[_0x3f52('0x11')](_0x3f52('0x12'),_0x5da567,_0x3f52('0x10'),JSON['stringify'](_0x2739d8));if(_0x2739d8[_0x3f52('0x13')]){if(_0x2739d8['error']['code']===0x1f4){logger[_0x3f52('0x13')](_0x3f52('0x14'),_0x5da567,_0x2739d8[_0x3f52('0x13')][_0x3f52('0x15')]);return _0x2be4af(_0x2739d8[_0x3f52('0x13')][_0x3f52('0x15')]);}logger[_0x3f52('0x13')](_0x3f52('0x14'),_0x5da567,_0x2739d8['error'][_0x3f52('0x15')]);return _0x5e96a3(_0x2739d8[_0x3f52('0x13')][_0x3f52('0x15')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x5da567,_0x3f52('0x10'));_0x5e96a3(_0x2739d8[_0x3f52('0x16')][_0x3f52('0x15')]);}})[_0x3f52('0x17')](function(_0x2b8834){logger[_0x3f52('0x13')](_0x3f52('0x14'),_0x5da567,_0x2b8834);_0x2be4af(_0x2b8834);});});}exports[_0x3f52('0x18')]=function(_0x572855){var _0x565107=this;return new Promise(function(_0x4f921e,_0xab290c){return db['FaxInteraction']['update'](_0x572855[_0x3f52('0x19')],{'raw':_0x572855[_0x3f52('0x1a')]?_0x572855[_0x3f52('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x572855[_0x3f52('0x1a')]?_0x572855['options'][_0x3f52('0x1b')]||null:null,'attributes':_0x572855[_0x3f52('0x1a')]?_0x572855['options'][_0x3f52('0x1c')]||null:null,'limit':_0x572855['options']?_0x572855[_0x3f52('0x1a')][_0x3f52('0x1d')]||null:null})[_0x3f52('0x1e')](function(_0x37e770){logger[_0x3f52('0xf')]('UpdateFaxInteraction',_0x572855);logger['debug'](_0x3f52('0x18'),_0x572855,JSON['stringify'](_0x37e770));_0x4f921e(_0x37e770);})[_0x3f52('0x17')](function(_0x56048b){logger[_0x3f52('0x13')](_0x3f52('0x18'),_0x56048b['message'],_0x572855);_0xab290c(_0x565107['error'](0x1f4,_0x56048b[_0x3f52('0x15')]));});});};exports[_0x3f52('0x1f')]=function(_0x1d9227){return new Promise(function(_0x2e55b6,_0x1020e2){return db[_0x3f52('0x20')][_0x3f52('0x21')]({'where':_0x1d9227[_0x3f52('0x1a')]?_0x1d9227['options'][_0x3f52('0x1b')]||null:null})['then'](function(_0x5e2312){if(_0x5e2312){return _0x5e2312[_0x3f52('0x22')](_0x1d9227['body']['ids'],_[_0x3f52('0x23')](_0x1d9227[_0x3f52('0x19')],['ids','id'])||{});}})['spread'](function(_0x1972b9){logger[_0x3f52('0xf')]('AddTags',_0x1d9227);logger['debug']('AddTags',_0x1d9227,JSON[_0x3f52('0x24')](_0x1972b9));_0x2e55b6(_0x1972b9);})[_0x3f52('0x17')](function(_0x129c7a){logger[_0x3f52('0x13')](_0x3f52('0x25'),_0x129c7a[_0x3f52('0x15')],_0x1d9227);_0x1020e2(_this[_0x3f52('0x13')](0x1f4,_0x129c7a[_0x3f52('0x15')]));});});};
\ No newline at end of file
+var _0x2e23=['stringify','catch','FaxInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','message','FaxInteraction,\x20%s,\x20%s','result','UpdateFaxInteraction','update','body','options','raw','where','attributes','limit'];(function(_0x3fe319,_0x303b91){var _0x4b9436=function(_0x175f59){while(--_0x175f59){_0x3fe319['push'](_0x3fe319['shift']());}};_0x4b9436(++_0x303b91);}(_0x2e23,0x1d6));var _0x32e2=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x2e23[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0x32e2('0x0'));var util=require(_0x32e2('0x1'));var moment=require(_0x32e2('0x2'));var BPromise=require(_0x32e2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x32e2('0x4'));var db=require(_0x32e2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x32e2('0x6'))('rpc');var config=require(_0x32e2('0x7'));var jayson=require(_0x32e2('0x8'));var client=jayson[_0x32e2('0x9')][_0x32e2('0xa')]({'port':0x232a});config['redis']=_[_0x32e2('0xb')](config[_0x32e2('0xc')],{'host':_0x32e2('0xd'),'port':0x18eb});var socket=require(_0x32e2('0xe'))(new Redis(config[_0x32e2('0xc')]));require(_0x32e2('0xf'))[_0x32e2('0x10')](socket);function respondWithRpcPromise(_0x59133f,_0x31aca6,_0x57630d){return new BPromise(function(_0x5240ca,_0x10810d){return client['request'](_0x59133f,_0x57630d)[_0x32e2('0x11')](function(_0x1764ee){logger[_0x32e2('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x31aca6,_0x32e2('0x13'));logger[_0x32e2('0x14')](_0x32e2('0x15'),_0x31aca6,_0x32e2('0x13'),JSON['stringify'](_0x1764ee));if(_0x1764ee[_0x32e2('0x16')]){if(_0x1764ee['error']['code']===0x1f4){logger[_0x32e2('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x31aca6,_0x1764ee[_0x32e2('0x16')][_0x32e2('0x17')]);return _0x10810d(_0x1764ee[_0x32e2('0x16')]['message']);}logger[_0x32e2('0x16')](_0x32e2('0x18'),_0x31aca6,_0x1764ee[_0x32e2('0x16')][_0x32e2('0x17')]);return _0x5240ca(_0x1764ee['error'][_0x32e2('0x17')]);}else{logger[_0x32e2('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x31aca6,_0x32e2('0x13'));_0x5240ca(_0x1764ee[_0x32e2('0x19')][_0x32e2('0x17')]);}})['catch'](function(_0x2cd62e){logger[_0x32e2('0x16')](_0x32e2('0x18'),_0x31aca6,_0x2cd62e);_0x10810d(_0x2cd62e);});});}exports[_0x32e2('0x1a')]=function(_0x5db19c){var _0x459bda=this;return new Promise(function(_0x59b46d,_0x5ebdf1){return db['FaxInteraction'][_0x32e2('0x1b')](_0x5db19c[_0x32e2('0x1c')],{'raw':_0x5db19c[_0x32e2('0x1d')]?_0x5db19c[_0x32e2('0x1d')][_0x32e2('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5db19c[_0x32e2('0x1d')]?_0x5db19c['options'][_0x32e2('0x1f')]||null:null,'attributes':_0x5db19c[_0x32e2('0x1d')]?_0x5db19c[_0x32e2('0x1d')][_0x32e2('0x20')]||null:null,'limit':_0x5db19c[_0x32e2('0x1d')]?_0x5db19c[_0x32e2('0x1d')][_0x32e2('0x21')]||null:null})[_0x32e2('0x11')](function(_0x13b614){logger['info'](_0x32e2('0x1a'),_0x5db19c);logger['debug'](_0x32e2('0x1a'),_0x5db19c,JSON[_0x32e2('0x22')](_0x13b614));_0x59b46d(_0x13b614);})[_0x32e2('0x23')](function(_0xd4e118){logger[_0x32e2('0x16')](_0x32e2('0x1a'),_0xd4e118[_0x32e2('0x17')],_0x5db19c);_0x5ebdf1(_0x459bda[_0x32e2('0x16')](0x1f4,_0xd4e118[_0x32e2('0x17')]));});});};exports['AddTagsToFaxInteraction']=function(_0x285ab8){return new Promise(function(_0x3f2e02,_0x3b9ef0){return db[_0x32e2('0x24')][_0x32e2('0x25')]({'where':_0x285ab8[_0x32e2('0x1d')]?_0x285ab8['options'][_0x32e2('0x1f')]||null:null})['then'](function(_0x4f5162){if(_0x4f5162){return _0x4f5162['addTags'](_0x285ab8['body'][_0x32e2('0x26')],_[_0x32e2('0x27')](_0x285ab8[_0x32e2('0x1c')],[_0x32e2('0x26'),'id'])||{});}})[_0x32e2('0x28')](function(_0x49b444){logger['info']('AddTags',_0x285ab8);logger[_0x32e2('0x14')](_0x32e2('0x29'),_0x285ab8,JSON[_0x32e2('0x22')](_0x49b444));_0x3f2e02(_0x49b444);})[_0x32e2('0x23')](function(_0x158019){logger[_0x32e2('0x16')](_0x32e2('0x29'),_0x158019[_0x32e2('0x17')],_0x285ab8);_0x3b9ef0(_this[_0x32e2('0x16')](0x1f4,_0x158019[_0x32e2('0x17')]));});});};
\ No newline at end of file
index 4c49cba..bf4f307 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9e0a=['update','emit'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x9e0a,0xa0));var _0xa9e0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9e0a[_0x20a584];return _0x4b41a8;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save','remove',_0xa9e0('0x0')];function createListener(_0x1aa900,_0x525ca7){return function(_0xb7cc){_0x525ca7[_0xa9e0('0x1')](_0x1aa900,_0xb7cc);};}function removeListener(_0x293350,_0x4f55c2){return function(){FaxInteractionEvents['removeListener'](_0x293350,_0x4f55c2);};}exports['register']=function(_0x2ec176){for(var _0x7ab865=0x0,_0x3241db=events['length'];_0x7ab865<_0x3241db;_0x7ab865++){var _0x167972=events[_0x7ab865];var _0x56a45d=createListener('faxInteraction:'+_0x167972,_0x2ec176);FaxInteractionEvents['on'](_0x167972,_0x56a45d);}};
\ No newline at end of file
+var _0x3974=['update','emit','length','faxInteraction:','./faxInteraction.events','save','remove'];(function(_0x4f642c,_0x524790){var _0x410da8=function(_0xb86b9d){while(--_0xb86b9d){_0x4f642c['push'](_0x4f642c['shift']());}};_0x410da8(++_0x524790);}(_0x3974,0x14d));var _0x4397=function(_0x17b5bb,_0x2045ac){_0x17b5bb=_0x17b5bb-0x0;var _0x5692d5=_0x3974[_0x17b5bb];return _0x5692d5;};'use strict';var FaxInteractionEvents=require(_0x4397('0x0'));var events=[_0x4397('0x1'),_0x4397('0x2'),_0x4397('0x3')];function createListener(_0x2d0556,_0x2fa18e){return function(_0x46efa7){_0x2fa18e[_0x4397('0x4')](_0x2d0556,_0x46efa7);};}function removeListener(_0x9d8834,_0x456db0){return function(){FaxInteractionEvents['removeListener'](_0x9d8834,_0x456db0);};}exports['register']=function(_0x2d0c44){for(var _0x24251f=0x0,_0x11b4ad=events[_0x4397('0x5')];_0x24251f<_0x11b4ad;_0x24251f++){var _0x2a96d1=events[_0x24251f];var _0x3d1516=createListener(_0x4397('0x6')+_0x2a96d1,_0x2d0c44);FaxInteractionEvents['on'](_0x2a96d1,_0x3d1516);}};
\ No newline at end of file
index b0edb52..227cb87 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x18f2=['/:id/tags','tracked','addTags','/:id','fax','faxinteraction:update','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','describe','show','/:id/messages','getMessages','download','create','post','addMessage'];(function(_0x3fd975,_0x968a2c){var _0x374ba6=function(_0x224c73){while(--_0x224c73){_0x3fd975['push'](_0x3fd975['shift']());}};_0x374ba6(++_0x968a2c);}(_0x18f2,0x9f));var _0x218f=function(_0xab56c8,_0x4f5f94){_0xab56c8=_0xab56c8-0x0;var _0x29c649=_0x18f2[_0xab56c8];return _0x29c649;};'use strict';var multer=require(_0x218f('0x0'));var util=require(_0x218f('0x1'));var path=require(_0x218f('0x2'));var timeout=require(_0x218f('0x3'));var express=require(_0x218f('0x4'));var router=express[_0x218f('0x5')]();var auth=require(_0x218f('0x6'));var interaction=require(_0x218f('0x7'));var config=require(_0x218f('0x8'));var controller=require(_0x218f('0x9'));router[_0x218f('0xa')]('/',auth[_0x218f('0xb')](),controller['index']);router['get'](_0x218f('0xc'),auth['isAuthenticated'](),controller[_0x218f('0xd')]);router['get']('/:id',auth[_0x218f('0xb')](),controller[_0x218f('0xe')]);router[_0x218f('0xa')](_0x218f('0xf'),auth[_0x218f('0xb')](),controller[_0x218f('0x10')]);router[_0x218f('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0x218f('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x218f('0x12')]);router[_0x218f('0x13')](_0x218f('0xf'),auth[_0x218f('0xb')](),controller[_0x218f('0x14')]);router[_0x218f('0x13')](_0x218f('0x15'),auth[_0x218f('0xb')](),interaction[_0x218f('0x16')]('fax','faxinteraction:addtags'),controller[_0x218f('0x17')]);router['put'](_0x218f('0x18'),auth[_0x218f('0xb')](),interaction[_0x218f('0x16')](_0x218f('0x19'),_0x218f('0x1a')),controller[_0x218f('0x1b')]);router['delete']('/:id',auth[_0x218f('0xb')](),interaction[_0x218f('0x16')](_0x218f('0x19'),'faxinteraction:destroy'),controller[_0x218f('0x1c')]);router['delete']('/:id/tags',auth[_0x218f('0xb')](),controller['removeTags']);module[_0x218f('0x1d')]=router;
\ No newline at end of file
+var _0x00bf=['/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','/:id','faxinteraction:update','update','delete','faxinteraction:destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id/messages','getMessages'];(function(_0x1bfea4,_0x24dfbb){var _0x5327df=function(_0x53695d){while(--_0x53695d){_0x1bfea4['push'](_0x1bfea4['shift']());}};_0x5327df(++_0x24dfbb);}(_0x00bf,0x121));var _0xf00b=function(_0x1076e8,_0x359f0b){_0x1076e8=_0x1076e8-0x0;var _0x1bf1d2=_0x00bf[_0x1076e8];return _0x1bf1d2;};'use strict';var multer=require(_0xf00b('0x0'));var util=require(_0xf00b('0x1'));var path=require(_0xf00b('0x2'));var timeout=require(_0xf00b('0x3'));var express=require(_0xf00b('0x4'));var router=express[_0xf00b('0x5')]();var auth=require(_0xf00b('0x6'));var interaction=require(_0xf00b('0x7'));var config=require(_0xf00b('0x8'));var controller=require(_0xf00b('0x9'));router[_0xf00b('0xa')]('/',auth[_0xf00b('0xb')](),controller[_0xf00b('0xc')]);router[_0xf00b('0xa')](_0xf00b('0xd'),auth[_0xf00b('0xb')](),controller[_0xf00b('0xe')]);router[_0xf00b('0xa')]('/:id',auth[_0xf00b('0xb')](),controller['show']);router[_0xf00b('0xa')](_0xf00b('0xf'),auth[_0xf00b('0xb')](),controller[_0xf00b('0x10')]);router[_0xf00b('0xa')](_0xf00b('0x11'),auth[_0xf00b('0xb')](),controller[_0xf00b('0x12')]);router[_0xf00b('0x13')]('/',auth[_0xf00b('0xb')](),controller[_0xf00b('0x14')]);router[_0xf00b('0x13')](_0xf00b('0xf'),auth[_0xf00b('0xb')](),controller[_0xf00b('0x15')]);router[_0xf00b('0x13')](_0xf00b('0x16'),auth[_0xf00b('0xb')](),interaction[_0xf00b('0x17')](_0xf00b('0x18'),_0xf00b('0x19')),controller[_0xf00b('0x1a')]);router[_0xf00b('0x1b')](_0xf00b('0x1c'),auth[_0xf00b('0xb')](),interaction[_0xf00b('0x17')](_0xf00b('0x18'),_0xf00b('0x1d')),controller[_0xf00b('0x1e')]);router[_0xf00b('0x1f')](_0xf00b('0x1c'),auth[_0xf00b('0xb')](),interaction['tracked']('fax',_0xf00b('0x20')),controller['destroy']);router[_0xf00b('0x1f')](_0xf00b('0x16'),auth[_0xf00b('0xb')](),controller['removeTags']);module[_0xf00b('0x21')]=router;
\ No newline at end of file
index aa41f02..08b175c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb863=['medium','BOOLEAN','out','sequelize','exports','TEXT'];(function(_0x2a9462,_0x48e973){var _0xbd9965=function(_0x205099){while(--_0x205099){_0x2a9462['push'](_0x2a9462['shift']());}};_0xbd9965(++_0x48e973);}(_0xb863,0x11d));var _0x3b86=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xb863[_0x51020b];return _0x371e47;};'use strict';var Sequelize=require(_0x3b86('0x0'));module[_0x3b86('0x1')]={'body':{'type':Sequelize[_0x3b86('0x2')](_0x3b86('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3b86('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x3b86('0x5')),'defaultValue':_0x3b86('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}};
\ No newline at end of file
+var _0x04f0=['DATE','exports','TEXT','ENUM','out'];(function(_0x3410f3,_0x516979){var _0x5f2755=function(_0x305883){while(--_0x305883){_0x3410f3['push'](_0x3410f3['shift']());}};_0x5f2755(++_0x516979);}(_0x04f0,0x17d));var _0x004f=function(_0x4f1d4b,_0x799e02){_0x4f1d4b=_0x4f1d4b-0x0;var _0x1aa3b7=_0x04f0[_0x4f1d4b];return _0x1aa3b7;};'use strict';var Sequelize=require('sequelize');module[_0x004f('0x0')]={'body':{'type':Sequelize[_0x004f('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x004f('0x2')]('in','out'),'defaultValue':_0x004f('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x004f('0x4')]}};
\ No newline at end of file
index 2eff1a3..99766c2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcb91=['manual','interface','channel','accept','EventManager','agent','RejectMessage','rejectMessage','SIP/%s','event','isNil','fax','Attachment','findOne','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','attachments','download','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./faxMessage.socket','register','jayson/promise','http','client','request','then','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','stack','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','key','VIRTUAL','field','options','FaxMessage','includeAll','include','findAll','rows','show','update','body','find','params','describe','fax-interactions','read','UserId','user','CmContact','get','FaxInteraction','FaxInteractionId','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','null','AcceptMessage','acceptMessage'];(function(_0xd22d95,_0xc59f8f){var _0x15d7a3=function(_0x3db95c){while(--_0x3db95c){_0xd22d95['push'](_0xd22d95['shift']());}};_0x15d7a3(++_0xc59f8f);}(_0xcb91,0x1a0));var _0x1cb9=function(_0x5c38cd,_0x5a6b4e){_0x5c38cd=_0x5c38cd-0x0;var _0xc985ef=_0xcb91[_0x5c38cd];return _0xc985ef;};'use strict';var pdf=require(_0x1cb9('0x0'));var emlformat=require(_0x1cb9('0x1'));var rimraf=require(_0x1cb9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1cb9('0x3'));var rp=require(_0x1cb9('0x4'));var moment=require(_0x1cb9('0x5'));var BPromise=require(_0x1cb9('0x6'));var Mustache=require(_0x1cb9('0x7'));var util=require(_0x1cb9('0x8'));var path=require('path');var sox=require(_0x1cb9('0x9'));var csv=require(_0x1cb9('0xa'));var ejs=require(_0x1cb9('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1cb9('0xc'));var crypto=require(_0x1cb9('0xd'));var jsforce=require(_0x1cb9('0xe'));var deskjs=require(_0x1cb9('0xf'));var toCsv=require(_0x1cb9('0xa'));var querystring=require(_0x1cb9('0x10'));var Papa=require(_0x1cb9('0x11'));var authService=require(_0x1cb9('0x12'));var hardwareService=require(_0x1cb9('0x13'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x1cb9('0x14'))('api');var utils=require(_0x1cb9('0x15'));var config=require(_0x1cb9('0x16'));var db=require(_0x1cb9('0x17'))['db'];config['redis']=_[_0x1cb9('0x18')](config['redis'],{'host':_0x1cb9('0x19'),'port':0x18eb});var socket=require(_0x1cb9('0x1a'))(new Redis(config[_0x1cb9('0x1b')]));require(_0x1cb9('0x1c'))[_0x1cb9('0x1d')](socket);var jayson=require(_0x1cb9('0x1e'));var client=jayson['client'][_0x1cb9('0x1f')]({'port':0x232c});var client9002=jayson[_0x1cb9('0x20')][_0x1cb9('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4b12e7,_0x177790,_0x85a82f,_0x393fe5){return new BPromise(function(_0x162533,_0x522d0c){var _0x5b4e4c=_0x393fe5||client;return _0x5b4e4c[_0x1cb9('0x21')](_0x4b12e7,_0x85a82f)[_0x1cb9('0x22')](function(_0x47a53d){logger['info'](_0x1cb9('0x23'),_0x177790,'request\x20sent');logger[_0x1cb9('0x24')](_0x1cb9('0x25'),_0x177790,'request\x20sent',JSON['stringify'](_0x47a53d));if(_0x47a53d[_0x1cb9('0x26')]){if(_0x47a53d['error'][_0x1cb9('0x27')]===0x1f4){logger[_0x1cb9('0x26')](_0x1cb9('0x23'),_0x177790,_0x47a53d[_0x1cb9('0x26')][_0x1cb9('0x28')]);return _0x522d0c(_0x47a53d[_0x1cb9('0x26')]['message']);}logger[_0x1cb9('0x26')](_0x1cb9('0x23'),_0x177790,_0x47a53d[_0x1cb9('0x26')][_0x1cb9('0x28')]);return _0x162533(_0x47a53d[_0x1cb9('0x26')][_0x1cb9('0x28')]);}else{logger[_0x1cb9('0x29')](_0x1cb9('0x23'),_0x177790,'request\x20sent');_0x162533(_0x47a53d[_0x1cb9('0x2a')]['message']);}})[_0x1cb9('0x2b')](function(_0x3a10c1){logger[_0x1cb9('0x26')](_0x1cb9('0x23'),_0x177790,_0x3a10c1);_0x522d0c(_0x3a10c1);});});}function respondWithStatusCode(_0x5e23c9,_0x301c1a){_0x301c1a=_0x301c1a||0xcc;return function(_0x308196){if(_0x308196){return _0x5e23c9[_0x1cb9('0x2c')](_0x301c1a);}return _0x5e23c9[_0x1cb9('0x2d')](_0x301c1a)[_0x1cb9('0x2e')]();};}function respondWithResult(_0x24158f,_0x2a0770){_0x2a0770=_0x2a0770||0xc8;return function(_0x132957){if(_0x132957){return _0x24158f['status'](_0x2a0770)[_0x1cb9('0x2f')](_0x132957);}};}function respondWithFilteredResult(_0x5c56b1,_0x53a3cc){return function(_0x56bed5){if(_0x56bed5){var _0x4b9139=_0x56bed5[_0x1cb9('0x30')],_0x3bfc76=_0x53a3cc[_0x1cb9('0x31')],_0x34c708=_0x53a3cc[_0x1cb9('0x31')]+_0x53a3cc[_0x1cb9('0x32')],_0x4cf969;if(_0x34c708>=_0x4b9139){_0x34c708=_0x4b9139;_0x4cf969=0xc8;}else{_0x4cf969=0xce;}_0x5c56b1[_0x1cb9('0x2d')](_0x4cf969);return _0x5c56b1[_0x1cb9('0x33')](_0x1cb9('0x34'),_0x3bfc76+'-'+_0x34c708+'/'+_0x4b9139)[_0x1cb9('0x2f')](_0x56bed5);}return null;};}function patchUpdates(_0x406a0b){return function(_0x9f6401){try{jsonpatch[_0x1cb9('0x35')](_0x9f6401,_0x406a0b,!![]);}catch(_0x467d6c){return BPromise[_0x1cb9('0x36')](_0x467d6c);}return _0x9f6401[_0x1cb9('0x37')]();};}function saveUpdates(_0x1cbd70,_0x5281ec){return function(_0x3bec79){if(_0x3bec79){return _0x3bec79['update'](_0x1cbd70)['then'](function(_0x374e29){return _0x374e29;});}return null;};}function removeEntity(_0x20d8b9,_0x1a748b){return function(_0x44c76b){if(_0x44c76b){return _0x44c76b['destroy']()['then'](function(){_0x20d8b9['status'](0xcc)[_0x1cb9('0x2e')]();});}};}function handleEntityNotFound(_0xbfd55c,_0x162bf2){return function(_0x826a74){if(!_0x826a74){_0xbfd55c[_0x1cb9('0x2c')](0x194);}return _0x826a74;};}function handleError(_0x1d6126,_0x39f522){_0x39f522=_0x39f522||0x1f4;return function(_0x29f2d9){logger[_0x1cb9('0x26')](_0x29f2d9[_0x1cb9('0x38')]);if(_0x29f2d9['name']){delete _0x29f2d9['name'];}_0x1d6126[_0x1cb9('0x2d')](_0x39f522)['send'](_0x29f2d9);};}exports['index']=function(_0x1111a4,_0x45b6c9){var _0x3e84d3={},_0x26fb3e={},_0x406702={'count':0x0,'rows':[]};var _0x10f1a3=db['FaxMessage'][_0x1cb9('0x39')];_0x26fb3e[_0x1cb9('0x3a')]=_['keys'](_0x10f1a3);_0x26fb3e[_0x1cb9('0x3b')]=_[_0x1cb9('0x3c')](_0x1111a4[_0x1cb9('0x3b')]);_0x26fb3e[_0x1cb9('0x3d')]=_[_0x1cb9('0x3e')](_0x26fb3e[_0x1cb9('0x3a')],_0x26fb3e[_0x1cb9('0x3b')]);_0x3e84d3[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0x26fb3e['model'],qs['fields'](_0x1111a4[_0x1cb9('0x3b')][_0x1cb9('0x40')]));_0x3e84d3['attributes']=_0x3e84d3[_0x1cb9('0x3f')][_0x1cb9('0x41')]?_0x3e84d3[_0x1cb9('0x3f')]:_0x26fb3e['model'];if(!_0x1111a4[_0x1cb9('0x3b')][_0x1cb9('0x42')](_0x1cb9('0x43'))){_0x3e84d3[_0x1cb9('0x32')]=qs['limit'](_0x1111a4[_0x1cb9('0x3b')][_0x1cb9('0x32')]);_0x3e84d3[_0x1cb9('0x31')]=qs[_0x1cb9('0x31')](_0x1111a4['query'][_0x1cb9('0x31')]);}_0x3e84d3[_0x1cb9('0x44')]=qs[_0x1cb9('0x45')](_0x1111a4['query'][_0x1cb9('0x45')]);_0x3e84d3[_0x1cb9('0x46')]=qs['filters'](_['pick'](_0x1111a4[_0x1cb9('0x3b')],_0x26fb3e['filters']));if(_0x1111a4[_0x1cb9('0x3b')][_0x1cb9('0x47')]){_0x3e84d3[_0x1cb9('0x46')]=_[_0x1cb9('0x48')](_0x3e84d3[_0x1cb9('0x46')],{'$or':_['map'](_0x10f1a3,function(_0x497864){if(_0x497864[_0x1cb9('0x49')][_0x1cb9('0x4a')]!==_0x1cb9('0x4b')){var _0x461c6c={};_0x461c6c[_0x497864[_0x1cb9('0x4c')]]={'$like':'%'+_0x1111a4[_0x1cb9('0x3b')][_0x1cb9('0x47')]+'%'};return _0x461c6c;}})});}_0x3e84d3=_['merge']({},_0x3e84d3,_0x1111a4[_0x1cb9('0x4d')]);var _0x5c9125={'where':_0x3e84d3[_0x1cb9('0x46')]};return db[_0x1cb9('0x4e')][_0x1cb9('0x30')](_0x5c9125)[_0x1cb9('0x22')](function(_0x275cfd){_0x406702[_0x1cb9('0x30')]=_0x275cfd;if(_0x1111a4['query'][_0x1cb9('0x4f')]){_0x3e84d3[_0x1cb9('0x50')]=[{'all':!![]}];}return db[_0x1cb9('0x4e')][_0x1cb9('0x51')](_0x3e84d3);})[_0x1cb9('0x22')](function(_0x5723e4){_0x406702[_0x1cb9('0x52')]=_0x5723e4;return _0x406702;})[_0x1cb9('0x22')](respondWithFilteredResult(_0x45b6c9,_0x3e84d3))[_0x1cb9('0x2b')](handleError(_0x45b6c9,null));};exports[_0x1cb9('0x53')]=function(_0x53f238,_0x56ad4d){var _0x5edc03={'raw':!![],'where':{'id':_0x53f238['params']['id']}},_0xc58431={};_0xc58431[_0x1cb9('0x3a')]=_[_0x1cb9('0x3c')](db[_0x1cb9('0x4e')][_0x1cb9('0x39')]);_0xc58431[_0x1cb9('0x3b')]=_[_0x1cb9('0x3c')](_0x53f238[_0x1cb9('0x3b')]);_0xc58431['filters']=_[_0x1cb9('0x3e')](_0xc58431[_0x1cb9('0x3a')],_0xc58431[_0x1cb9('0x3b')]);_0x5edc03[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0xc58431[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x53f238[_0x1cb9('0x3b')][_0x1cb9('0x40')]));_0x5edc03['attributes']=_0x5edc03['attributes'][_0x1cb9('0x41')]?_0x5edc03[_0x1cb9('0x3f')]:_0xc58431[_0x1cb9('0x3a')];if(_0x53f238[_0x1cb9('0x3b')][_0x1cb9('0x4f')]){_0x5edc03['include']=[{'all':!![]}];}_0x5edc03=_[_0x1cb9('0x48')]({},_0x5edc03,_0x53f238['options']);return db[_0x1cb9('0x4e')]['find'](_0x5edc03)[_0x1cb9('0x22')](handleEntityNotFound(_0x56ad4d,null))[_0x1cb9('0x22')](respondWithResult(_0x56ad4d,null))[_0x1cb9('0x2b')](handleError(_0x56ad4d,null));};exports[_0x1cb9('0x54')]=function(_0x185276,_0x382676){if(_0x185276[_0x1cb9('0x55')]['id']){delete _0x185276['body']['id'];}return db[_0x1cb9('0x4e')][_0x1cb9('0x56')]({'where':{'id':_0x185276[_0x1cb9('0x57')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x382676,null))[_0x1cb9('0x22')](saveUpdates(_0x185276[_0x1cb9('0x55')],null))['then'](respondWithResult(_0x382676,null))['catch'](handleError(_0x382676,null));};exports['destroy']=function(_0x3e0d50,_0xb11ed1){return db[_0x1cb9('0x4e')]['find']({'where':{'id':_0x3e0d50[_0x1cb9('0x57')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0xb11ed1,null))[_0x1cb9('0x22')](removeEntity(_0xb11ed1,null))[_0x1cb9('0x2b')](handleError(_0xb11ed1,null));};exports[_0x1cb9('0x58')]=function(_0x37619e,_0x2ab407){return db[_0x1cb9('0x4e')]['describe']()['then'](respondWithResult(_0x2ab407,null))['catch'](handleError(_0x2ab407,null));};var interaction_log=require('../../config/logger')(_0x1cb9('0x59'));exports['accept']=function(_0x327918,_0x225725,_0x334ef2){var _0x35ba6e={'channel':'fax'};if(_0x327918[_0x1cb9('0x55')]['id']){delete _0x327918[_0x1cb9('0x55')]['id'];}_0x327918['body'][_0x1cb9('0x5a')]=!![];_0x327918[_0x1cb9('0x55')]['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x327918[_0x1cb9('0x55')][_0x1cb9('0x5b')]=_0x327918[_0x1cb9('0x55')][_0x1cb9('0x5b')]||_0x327918[_0x1cb9('0x5c')]['id'];return db[_0x1cb9('0x4e')]['find']({'where':{'id':_0x327918[_0x1cb9('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x1cb9('0x5d')],'as':'Contact'}]})[_0x1cb9('0x22')](handleEntityNotFound(_0x225725,null))[_0x1cb9('0x22')](saveUpdates(_0x327918[_0x1cb9('0x55')],null))['then'](function(_0x2d4761){if(_0x2d4761){_0x35ba6e[_0x1cb9('0x28')]=_0x2d4761[_0x1cb9('0x5e')]({'plain':!![]});return db[_0x1cb9('0x5f')][_0x1cb9('0x56')]({'where':{'id':_0x2d4761[_0x1cb9('0x60')]}});}return null;})[_0x1cb9('0x22')](handleEntityNotFound(_0x225725,null))['then'](function(_0x2aac65){if(_0x2aac65){return _0x2aac65['update']({'UserId':_0x327918[_0x1cb9('0x55')][_0x1cb9('0x5b')],'read1stAt':_['isNil'](_0x2aac65[_0x1cb9('0x61')])?moment()[_0x1cb9('0x62')](_0x1cb9('0x63')):undefined});}return null;})[_0x1cb9('0x22')](function(_0x420d0f){if(_0x420d0f){_0x35ba6e[_0x1cb9('0x64')]=_0x420d0f[_0x1cb9('0x5e')]({'plain':!![]});interaction_log[_0x1cb9('0x29')](_0x1cb9('0x65'),_0x327918[_0x1cb9('0x5c')]['id'],_0x327918[_0x1cb9('0x5c')][_0x1cb9('0x66')],_0x327918['user'][_0x1cb9('0x67')],_0x35ba6e[_0x1cb9('0x64')]['id'],_0x327918['body']?JSON[_0x1cb9('0x68')](_0x327918['body']):_0x1cb9('0x69'));return respondWithRpcPromise(_0x1cb9('0x6a'),_0x1cb9('0x6b'),_0x35ba6e);}return null;})[_0x1cb9('0x22')](function(_0x1f6cb5){if(_0x1f6cb5){if(_0x327918[_0x1cb9('0x55')][_0x1cb9('0x6c')]){_0x35ba6e[_0x1cb9('0x28')][_0x1cb9('0x6d')]=util[_0x1cb9('0x62')]('SIP/%s',_0x327918[_0x1cb9('0x5c')][_0x1cb9('0x66')]);_0x35ba6e[_0x1cb9('0x28')][_0x1cb9('0x6e')]=_0x35ba6e[_0x1cb9('0x6e')];_0x35ba6e[_0x1cb9('0x28')]['event']=_0x1cb9('0x6f');return respondWithRpcPromise(_0x1cb9('0x70'),_0x1cb9('0x70'),{'event':'acceptmessage','message':_0x35ba6e[_0x1cb9('0x28')]},client9002)[_0x1cb9('0x22')](function(){return _0x35ba6e;});}return _0x35ba6e;}return null;})[_0x1cb9('0x22')](respondWithResult(_0x225725,null))[_0x1cb9('0x2b')](handleError(_0x225725,null));};var interaction_log=require(_0x1cb9('0x14'))('fax-interactions');exports['reject']=function(_0x12593a,_0x2fcff1,_0xc0561b){var _0x2dc891={'agent':{},'channel':'fax'};if(_0x12593a[_0x1cb9('0x55')]['id']){delete _0x12593a[_0x1cb9('0x55')]['id'];}_0x12593a[_0x1cb9('0x55')][_0x1cb9('0x5b')]=_0x12593a[_0x1cb9('0x55')][_0x1cb9('0x5b')]||_0x12593a[_0x1cb9('0x5c')]['id'];_0x2dc891[_0x1cb9('0x71')]['id']=_0x12593a['body'][_0x1cb9('0x5b')];return db[_0x1cb9('0x4e')][_0x1cb9('0x56')]({'where':{'id':_0x12593a[_0x1cb9('0x57')]['id'],'UserId':null}})[_0x1cb9('0x22')](handleEntityNotFound(_0x2fcff1,null))['then'](function(_0x1252da){if(_0x1252da){_0x2dc891[_0x1cb9('0x28')]=_0x1252da[_0x1cb9('0x5e')]({'plain':!![]});return db[_0x1cb9('0x5f')][_0x1cb9('0x56')]({'where':{'id':_0x1252da[_0x1cb9('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x2fcff1,null))[_0x1cb9('0x22')](function(_0x41a8f0){if(_0x41a8f0){_0x2dc891[_0x1cb9('0x64')]=_0x41a8f0['get']({'plain':!![]});interaction_log[_0x1cb9('0x29')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x12593a[_0x1cb9('0x5c')]['id'],_0x12593a[_0x1cb9('0x5c')][_0x1cb9('0x66')],_0x12593a[_0x1cb9('0x5c')][_0x1cb9('0x67')],_0x2dc891['interaction']['id'],_0x12593a['body']?JSON['stringify'](_0x12593a['body']):'null');return respondWithRpcPromise(_0x1cb9('0x72'),_0x1cb9('0x73'),_0x2dc891);}return null;})['then'](function(_0x2ce9cd){if(_0x2ce9cd){_0x2ce9cd[_0x1cb9('0x28')][_0x1cb9('0x6d')]=util[_0x1cb9('0x62')](_0x1cb9('0x74'),_0x12593a[_0x1cb9('0x5c')][_0x1cb9('0x66')]);_0x2ce9cd[_0x1cb9('0x28')]['channel']=_0x2dc891[_0x1cb9('0x6e')];_0x2ce9cd[_0x1cb9('0x28')][_0x1cb9('0x75')]='reject';respondWithRpcPromise(_0x1cb9('0x70'),'EventManager',{'event':'rejectmessage','message':_0x2ce9cd['message']},client9002);return _0x2dc891;}return null;})[_0x1cb9('0x22')](respondWithResult(_0x2fcff1,null))[_0x1cb9('0x2b')](handleError(_0x2fcff1,null));};exports['create']=function(_0xaa3c55,_0x37b0c7){var _0x28daa1;return db[_0x1cb9('0x4e')]['create'](_0xaa3c55[_0x1cb9('0x55')],{})[_0x1cb9('0x22')](function(_0x25e6c1){_0x28daa1=_0x25e6c1;return db[_0x1cb9('0x5d')]['findOne']({'where':{'id':_0x28daa1['ContactId']}});})[_0x1cb9('0x22')](function(_0x53463e){if(_[_0x1cb9('0x76')](_0x53463e)){return;}else{_0x28daa1[_0x1cb9('0x77')]=_0x53463e[_0x1cb9('0x77')];return db[_0x1cb9('0x78')][_0x1cb9('0x79')]({'where':{'id':_0x28daa1[_0x1cb9('0x7a')]}});}})['then'](function(_0x1ebdb9){return respondWithRpcPromise(_0x1cb9('0x7b'),_0x1cb9('0x7b'),{'FaxAccountId':_[_0x1cb9('0x76')](_0xaa3c55[_0x1cb9('0x55')])?undefined:_0xaa3c55[_0x1cb9('0x55')]['FaxAccountId'],'path':_[_0x1cb9('0x76')](_0x1ebdb9)?undefined:util[_0x1cb9('0x62')](_0x1cb9('0x7c'),_0x1ebdb9[_0x1cb9('0x7d')]),'fax':_[_0x1cb9('0x76')](_0x28daa1[_0x1cb9('0x77')])?undefined:_0x28daa1[_0x1cb9('0x77')],'AttachmentId':_0x28daa1['AttachmentId']},client9002);})[_0x1cb9('0x22')](respondWithResult(_0x37b0c7,0xc9))[_0x1cb9('0x2b')](handleError(_0x37b0c7,null));};exports['download']=function(_0x265f68,_0x46e523){var _0x4fa3d5=path[_0x1cb9('0x7e')](config[_0x1cb9('0x7f')],_0x1cb9('0x80'),'files',_0x1cb9('0x81'));return db[_0x1cb9('0x4e')][_0x1cb9('0x56')]({'where':{'id':_0x265f68[_0x1cb9('0x57')]['id']},'include':[{'model':db['Attachment'],'as':_0x1cb9('0x78')}]})[_0x1cb9('0x22')](handleEntityNotFound(_0x46e523,null))[_0x1cb9('0x22')](function(_0x2e052f){if(_0x2e052f){return _0x46e523[_0x1cb9('0x82')](path['join'](_0x4fa3d5,_0x2e052f[_0x1cb9('0x78')][_0x1cb9('0x7d')]));}})[_0x1cb9('0x2b')](handleError(_0x46e523,null));};
\ No newline at end of file
+var _0xb8ac=['stringify','RejectMessage','rejectMessage','interface','rejectmessage','create','findOne','ContactId','isNil','Attachment','AttachmentId','SendFax','FaxAccountId','basename','download','join','attachments','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','FaxMessage','rawAttributes','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','field','count','includeAll','include','findAll','rows','show','params','intersection','options','find','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','CmContact','Contact','get','FaxInteraction','FaxInteractionId','UserId','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','agent','interaction'];(function(_0x3bfce3,_0x43268f){var _0x4a551b=function(_0x493c2e){while(--_0x493c2e){_0x3bfce3['push'](_0x3bfce3['shift']());}};_0x4a551b(++_0x43268f);}(_0xb8ac,0x123));var _0xcb8a=function(_0x2635af,_0x1f790d){_0x2635af=_0x2635af-0x0;var _0x2e3895=_0xb8ac[_0x2635af];return _0x2e3895;};'use strict';var pdf=require(_0xcb8a('0x0'));var emlformat=require(_0xcb8a('0x1'));var rimraf=require(_0xcb8a('0x2'));var zipdir=require(_0xcb8a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcb8a('0x4'));var moment=require(_0xcb8a('0x5'));var BPromise=require(_0xcb8a('0x6'));var Mustache=require(_0xcb8a('0x7'));var util=require(_0xcb8a('0x8'));var path=require(_0xcb8a('0x9'));var sox=require('sox');var csv=require(_0xcb8a('0xa'));var ejs=require(_0xcb8a('0xb'));var fs=require('fs');var _=require(_0xcb8a('0xc'));var squel=require('squel');var crypto=require(_0xcb8a('0xd'));var jsforce=require(_0xcb8a('0xe'));var deskjs=require(_0xcb8a('0xf'));var toCsv=require(_0xcb8a('0xa'));var querystring=require(_0xcb8a('0x10'));var Papa=require(_0xcb8a('0x11'));var authService=require(_0xcb8a('0x12'));var hardwareService=require(_0xcb8a('0x13'));var Redis=require(_0xcb8a('0x14'));var qs=require(_0xcb8a('0x15'));var logger=require(_0xcb8a('0x16'))(_0xcb8a('0x17'));var utils=require(_0xcb8a('0x18'));var config=require('../../config/environment');var db=require(_0xcb8a('0x19'))['db'];config[_0xcb8a('0x1a')]=_['defaults'](config[_0xcb8a('0x1a')],{'host':_0xcb8a('0x1b'),'port':0x18eb});var socket=require(_0xcb8a('0x1c'))(new Redis(config[_0xcb8a('0x1a')]));require(_0xcb8a('0x1d'))[_0xcb8a('0x1e')](socket);var jayson=require(_0xcb8a('0x1f'));var client=jayson[_0xcb8a('0x20')][_0xcb8a('0x21')]({'port':0x232c});var client9002=jayson[_0xcb8a('0x20')][_0xcb8a('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x122894,_0x5a4f9a,_0x37590c,_0x3fe1eb){return new BPromise(function(_0x5f5455,_0x5b6c42){var _0x3dfa8e=_0x3fe1eb||client;return _0x3dfa8e['request'](_0x122894,_0x37590c)['then'](function(_0x290e81){logger[_0xcb8a('0x22')](_0xcb8a('0x23'),_0x5a4f9a,_0xcb8a('0x24'));logger[_0xcb8a('0x25')](_0xcb8a('0x26'),_0x5a4f9a,_0xcb8a('0x24'),JSON['stringify'](_0x290e81));if(_0x290e81['error']){if(_0x290e81[_0xcb8a('0x27')][_0xcb8a('0x28')]===0x1f4){logger[_0xcb8a('0x27')](_0xcb8a('0x23'),_0x5a4f9a,_0x290e81[_0xcb8a('0x27')][_0xcb8a('0x29')]);return _0x5b6c42(_0x290e81[_0xcb8a('0x27')][_0xcb8a('0x29')]);}logger[_0xcb8a('0x27')](_0xcb8a('0x23'),_0x5a4f9a,_0x290e81['error'][_0xcb8a('0x29')]);return _0x5f5455(_0x290e81[_0xcb8a('0x27')][_0xcb8a('0x29')]);}else{logger[_0xcb8a('0x22')]('FaxMessage,\x20%s,\x20%s',_0x5a4f9a,_0xcb8a('0x24'));_0x5f5455(_0x290e81[_0xcb8a('0x2a')]['message']);}})[_0xcb8a('0x2b')](function(_0x385d3b){logger[_0xcb8a('0x27')](_0xcb8a('0x23'),_0x5a4f9a,_0x385d3b);_0x5b6c42(_0x385d3b);});});}function respondWithStatusCode(_0x10e306,_0x404592){_0x404592=_0x404592||0xcc;return function(_0x3f0e19){if(_0x3f0e19){return _0x10e306[_0xcb8a('0x2c')](_0x404592);}return _0x10e306[_0xcb8a('0x2d')](_0x404592)[_0xcb8a('0x2e')]();};}function respondWithResult(_0x3e554f,_0x4cfd6e){_0x4cfd6e=_0x4cfd6e||0xc8;return function(_0x5a1bc5){if(_0x5a1bc5){return _0x3e554f[_0xcb8a('0x2d')](_0x4cfd6e)[_0xcb8a('0x2f')](_0x5a1bc5);}};}function respondWithFilteredResult(_0x41f0a9,_0x517afe){return function(_0x1f4c77){if(_0x1f4c77){var _0x32c517=_0x1f4c77['count'],_0x4fb244=_0x517afe['offset'],_0x2be6c5=_0x517afe[_0xcb8a('0x30')]+_0x517afe[_0xcb8a('0x31')],_0x2b71c7;if(_0x2be6c5>=_0x32c517){_0x2be6c5=_0x32c517;_0x2b71c7=0xc8;}else{_0x2b71c7=0xce;}_0x41f0a9[_0xcb8a('0x2d')](_0x2b71c7);return _0x41f0a9[_0xcb8a('0x32')](_0xcb8a('0x33'),_0x4fb244+'-'+_0x2be6c5+'/'+_0x32c517)[_0xcb8a('0x2f')](_0x1f4c77);}return null;};}function patchUpdates(_0x4b9d90){return function(_0x1a8b03){try{jsonpatch[_0xcb8a('0x34')](_0x1a8b03,_0x4b9d90,!![]);}catch(_0x5515d8){return BPromise[_0xcb8a('0x35')](_0x5515d8);}return _0x1a8b03['save']();};}function saveUpdates(_0x56a45e,_0x1eaeea){return function(_0x2fb627){if(_0x2fb627){return _0x2fb627[_0xcb8a('0x36')](_0x56a45e)['then'](function(_0x27ac8e){return _0x27ac8e;});}return null;};}function removeEntity(_0x1c7fd5,_0x9ca811){return function(_0x4bafeb){if(_0x4bafeb){return _0x4bafeb[_0xcb8a('0x37')]()[_0xcb8a('0x38')](function(){_0x1c7fd5[_0xcb8a('0x2d')](0xcc)[_0xcb8a('0x2e')]();});}};}function handleEntityNotFound(_0x75a7c6,_0x205fa6){return function(_0x2cfd32){if(!_0x2cfd32){_0x75a7c6[_0xcb8a('0x2c')](0x194);}return _0x2cfd32;};}function handleError(_0xc5b61e,_0x4da333){_0x4da333=_0x4da333||0x1f4;return function(_0x6571f2){logger['error'](_0x6571f2[_0xcb8a('0x39')]);if(_0x6571f2[_0xcb8a('0x3a')]){delete _0x6571f2[_0xcb8a('0x3a')];}_0xc5b61e[_0xcb8a('0x2d')](_0x4da333)[_0xcb8a('0x3b')](_0x6571f2);};}exports[_0xcb8a('0x3c')]=function(_0x2ff84d,_0x17f02b){var _0x10e828={},_0x33f40b={},_0x500a32={'count':0x0,'rows':[]};var _0x55d61b=db[_0xcb8a('0x3d')][_0xcb8a('0x3e')];_0x33f40b[_0xcb8a('0x3f')]=_[_0xcb8a('0x40')](_0x55d61b);_0x33f40b['query']=_['keys'](_0x2ff84d[_0xcb8a('0x41')]);_0x33f40b[_0xcb8a('0x42')]=_['intersection'](_0x33f40b['model'],_0x33f40b[_0xcb8a('0x41')]);_0x10e828[_0xcb8a('0x43')]=_['intersection'](_0x33f40b[_0xcb8a('0x3f')],qs[_0xcb8a('0x44')](_0x2ff84d[_0xcb8a('0x41')][_0xcb8a('0x44')]));_0x10e828[_0xcb8a('0x43')]=_0x10e828['attributes'][_0xcb8a('0x45')]?_0x10e828[_0xcb8a('0x43')]:_0x33f40b['model'];if(!_0x2ff84d['query'][_0xcb8a('0x46')](_0xcb8a('0x47'))){_0x10e828['limit']=qs[_0xcb8a('0x31')](_0x2ff84d[_0xcb8a('0x41')][_0xcb8a('0x31')]);_0x10e828[_0xcb8a('0x30')]=qs['offset'](_0x2ff84d['query']['offset']);}_0x10e828['order']=qs[_0xcb8a('0x48')](_0x2ff84d[_0xcb8a('0x41')][_0xcb8a('0x48')]);_0x10e828[_0xcb8a('0x49')]=qs[_0xcb8a('0x42')](_[_0xcb8a('0x4a')](_0x2ff84d[_0xcb8a('0x41')],_0x33f40b[_0xcb8a('0x42')]));if(_0x2ff84d[_0xcb8a('0x41')][_0xcb8a('0x4b')]){_0x10e828['where']=_[_0xcb8a('0x4c')](_0x10e828['where'],{'$or':_[_0xcb8a('0x4d')](_0x55d61b,function(_0x326da0){if(_0x326da0['type']['key']!==_0xcb8a('0x4e')){var _0x5909e8={};_0x5909e8[_0x326da0[_0xcb8a('0x4f')]]={'$like':'%'+_0x2ff84d[_0xcb8a('0x41')][_0xcb8a('0x4b')]+'%'};return _0x5909e8;}})});}_0x10e828=_[_0xcb8a('0x4c')]({},_0x10e828,_0x2ff84d['options']);var _0x142288={'where':_0x10e828[_0xcb8a('0x49')]};return db[_0xcb8a('0x3d')][_0xcb8a('0x50')](_0x142288)['then'](function(_0x4e463d){_0x500a32[_0xcb8a('0x50')]=_0x4e463d;if(_0x2ff84d[_0xcb8a('0x41')][_0xcb8a('0x51')]){_0x10e828[_0xcb8a('0x52')]=[{'all':!![]}];}return db[_0xcb8a('0x3d')][_0xcb8a('0x53')](_0x10e828);})[_0xcb8a('0x38')](function(_0x5f4c63){_0x500a32[_0xcb8a('0x54')]=_0x5f4c63;return _0x500a32;})[_0xcb8a('0x38')](respondWithFilteredResult(_0x17f02b,_0x10e828))[_0xcb8a('0x2b')](handleError(_0x17f02b,null));};exports[_0xcb8a('0x55')]=function(_0x24a03b,_0x826089){var _0x15f39e={'raw':!![],'where':{'id':_0x24a03b[_0xcb8a('0x56')]['id']}},_0x2f7d99={};_0x2f7d99[_0xcb8a('0x3f')]=_[_0xcb8a('0x40')](db['FaxMessage'][_0xcb8a('0x3e')]);_0x2f7d99[_0xcb8a('0x41')]=_[_0xcb8a('0x40')](_0x24a03b['query']);_0x2f7d99[_0xcb8a('0x42')]=_[_0xcb8a('0x57')](_0x2f7d99[_0xcb8a('0x3f')],_0x2f7d99[_0xcb8a('0x41')]);_0x15f39e[_0xcb8a('0x43')]=_[_0xcb8a('0x57')](_0x2f7d99['model'],qs[_0xcb8a('0x44')](_0x24a03b[_0xcb8a('0x41')][_0xcb8a('0x44')]));_0x15f39e[_0xcb8a('0x43')]=_0x15f39e[_0xcb8a('0x43')][_0xcb8a('0x45')]?_0x15f39e[_0xcb8a('0x43')]:_0x2f7d99[_0xcb8a('0x3f')];if(_0x24a03b[_0xcb8a('0x41')][_0xcb8a('0x51')]){_0x15f39e[_0xcb8a('0x52')]=[{'all':!![]}];}_0x15f39e=_[_0xcb8a('0x4c')]({},_0x15f39e,_0x24a03b[_0xcb8a('0x58')]);return db['FaxMessage'][_0xcb8a('0x59')](_0x15f39e)[_0xcb8a('0x38')](handleEntityNotFound(_0x826089,null))[_0xcb8a('0x38')](respondWithResult(_0x826089,null))[_0xcb8a('0x2b')](handleError(_0x826089,null));};exports[_0xcb8a('0x36')]=function(_0x633e53,_0x5138c7){if(_0x633e53[_0xcb8a('0x5a')]['id']){delete _0x633e53[_0xcb8a('0x5a')]['id'];}return db['FaxMessage'][_0xcb8a('0x59')]({'where':{'id':_0x633e53[_0xcb8a('0x56')]['id']}})[_0xcb8a('0x38')](handleEntityNotFound(_0x5138c7,null))[_0xcb8a('0x38')](saveUpdates(_0x633e53['body'],null))[_0xcb8a('0x38')](respondWithResult(_0x5138c7,null))[_0xcb8a('0x2b')](handleError(_0x5138c7,null));};exports[_0xcb8a('0x37')]=function(_0x2f65f1,_0x3d9dba){return db[_0xcb8a('0x3d')]['find']({'where':{'id':_0x2f65f1[_0xcb8a('0x56')]['id']}})[_0xcb8a('0x38')](handleEntityNotFound(_0x3d9dba,null))['then'](removeEntity(_0x3d9dba,null))['catch'](handleError(_0x3d9dba,null));};exports[_0xcb8a('0x5b')]=function(_0x20a69c,_0x16de0f){return db[_0xcb8a('0x3d')][_0xcb8a('0x5b')]()[_0xcb8a('0x38')](respondWithResult(_0x16de0f,null))[_0xcb8a('0x2b')](handleError(_0x16de0f,null));};var interaction_log=require(_0xcb8a('0x16'))(_0xcb8a('0x5c'));exports[_0xcb8a('0x5d')]=function(_0x68b085,_0x29e2cd,_0x2ab398){var _0x370b66={'channel':_0xcb8a('0x5e')};if(_0x68b085['body']['id']){delete _0x68b085['body']['id'];}_0x68b085[_0xcb8a('0x5a')][_0xcb8a('0x5f')]=!![];_0x68b085[_0xcb8a('0x5a')][_0xcb8a('0x60')]=moment()[_0xcb8a('0x61')](_0xcb8a('0x62'));_0x68b085[_0xcb8a('0x5a')]['UserId']=_0x68b085[_0xcb8a('0x5a')]['UserId']||_0x68b085[_0xcb8a('0x63')]['id'];return db[_0xcb8a('0x3d')][_0xcb8a('0x59')]({'where':{'id':_0x68b085[_0xcb8a('0x56')]['id'],'UserId':null},'include':[{'model':db[_0xcb8a('0x64')],'as':_0xcb8a('0x65')}]})[_0xcb8a('0x38')](handleEntityNotFound(_0x29e2cd,null))[_0xcb8a('0x38')](saveUpdates(_0x68b085[_0xcb8a('0x5a')],null))[_0xcb8a('0x38')](function(_0x5d82f8){if(_0x5d82f8){_0x370b66['message']=_0x5d82f8[_0xcb8a('0x66')]({'plain':!![]});return db[_0xcb8a('0x67')][_0xcb8a('0x59')]({'where':{'id':_0x5d82f8[_0xcb8a('0x68')]}});}return null;})[_0xcb8a('0x38')](handleEntityNotFound(_0x29e2cd,null))[_0xcb8a('0x38')](function(_0x3f95cd){if(_0x3f95cd){return _0x3f95cd[_0xcb8a('0x36')]({'UserId':_0x68b085[_0xcb8a('0x5a')][_0xcb8a('0x69')],'read1stAt':_['isNil'](_0x3f95cd[_0xcb8a('0x6a')])?moment()[_0xcb8a('0x61')](_0xcb8a('0x62')):undefined});}return null;})[_0xcb8a('0x38')](function(_0x59daf0){if(_0x59daf0){_0x370b66['interaction']=_0x59daf0[_0xcb8a('0x66')]({'plain':!![]});interaction_log[_0xcb8a('0x22')](_0xcb8a('0x6b'),_0x68b085['user']['id'],_0x68b085[_0xcb8a('0x63')][_0xcb8a('0x3a')],_0x68b085[_0xcb8a('0x63')][_0xcb8a('0x6c')],_0x370b66['interaction']['id'],_0x68b085[_0xcb8a('0x5a')]?JSON['stringify'](_0x68b085[_0xcb8a('0x5a')]):_0xcb8a('0x6d'));return respondWithRpcPromise(_0xcb8a('0x6e'),_0xcb8a('0x6f'),_0x370b66);}return null;})['then'](function(_0x353c33){if(_0x353c33){if(_0x68b085[_0xcb8a('0x5a')][_0xcb8a('0x70')]){_0x370b66[_0xcb8a('0x29')]['interface']=util[_0xcb8a('0x61')](_0xcb8a('0x71'),_0x68b085[_0xcb8a('0x63')][_0xcb8a('0x3a')]);_0x370b66['message'][_0xcb8a('0x72')]=_0x370b66[_0xcb8a('0x72')];_0x370b66[_0xcb8a('0x29')][_0xcb8a('0x73')]=_0xcb8a('0x5d');return respondWithRpcPromise(_0xcb8a('0x74'),'EventManager',{'event':_0xcb8a('0x75'),'message':_0x370b66[_0xcb8a('0x29')]},client9002)[_0xcb8a('0x38')](function(){return _0x370b66;});}return _0x370b66;}return null;})[_0xcb8a('0x38')](respondWithResult(_0x29e2cd,null))[_0xcb8a('0x2b')](handleError(_0x29e2cd,null));};var interaction_log=require('../../config/logger')(_0xcb8a('0x5c'));exports[_0xcb8a('0x35')]=function(_0x1628d2,_0x917b47,_0xdbac28){var _0x1b2cf5={'agent':{},'channel':_0xcb8a('0x5e')};if(_0x1628d2[_0xcb8a('0x5a')]['id']){delete _0x1628d2[_0xcb8a('0x5a')]['id'];}_0x1628d2['body'][_0xcb8a('0x69')]=_0x1628d2[_0xcb8a('0x5a')][_0xcb8a('0x69')]||_0x1628d2[_0xcb8a('0x63')]['id'];_0x1b2cf5[_0xcb8a('0x76')]['id']=_0x1628d2['body'][_0xcb8a('0x69')];return db[_0xcb8a('0x3d')][_0xcb8a('0x59')]({'where':{'id':_0x1628d2['params']['id'],'UserId':null}})[_0xcb8a('0x38')](handleEntityNotFound(_0x917b47,null))[_0xcb8a('0x38')](function(_0x3e2b4b){if(_0x3e2b4b){_0x1b2cf5[_0xcb8a('0x29')]=_0x3e2b4b['get']({'plain':!![]});return db['FaxInteraction'][_0xcb8a('0x59')]({'where':{'id':_0x3e2b4b['FaxInteractionId']}});}return null;})[_0xcb8a('0x38')](handleEntityNotFound(_0x917b47,null))[_0xcb8a('0x38')](function(_0x2cb8f0){if(_0x2cb8f0){_0x1b2cf5[_0xcb8a('0x77')]=_0x2cb8f0[_0xcb8a('0x66')]({'plain':!![]});interaction_log[_0xcb8a('0x22')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1628d2[_0xcb8a('0x63')]['id'],_0x1628d2[_0xcb8a('0x63')][_0xcb8a('0x3a')],_0x1628d2[_0xcb8a('0x63')][_0xcb8a('0x6c')],_0x1b2cf5[_0xcb8a('0x77')]['id'],_0x1628d2['body']?JSON[_0xcb8a('0x78')](_0x1628d2[_0xcb8a('0x5a')]):_0xcb8a('0x6d'));return respondWithRpcPromise(_0xcb8a('0x79'),_0xcb8a('0x7a'),_0x1b2cf5);}return null;})[_0xcb8a('0x38')](function(_0x3b48d4){if(_0x3b48d4){_0x3b48d4[_0xcb8a('0x29')][_0xcb8a('0x7b')]=util[_0xcb8a('0x61')](_0xcb8a('0x71'),_0x1628d2[_0xcb8a('0x63')][_0xcb8a('0x3a')]);_0x3b48d4['message'][_0xcb8a('0x72')]=_0x1b2cf5[_0xcb8a('0x72')];_0x3b48d4['message']['event']=_0xcb8a('0x35');respondWithRpcPromise('EventManager',_0xcb8a('0x74'),{'event':_0xcb8a('0x7c'),'message':_0x3b48d4[_0xcb8a('0x29')]},client9002);return _0x1b2cf5;}return null;})[_0xcb8a('0x38')](respondWithResult(_0x917b47,null))[_0xcb8a('0x2b')](handleError(_0x917b47,null));};exports[_0xcb8a('0x7d')]=function(_0x393c69,_0x39dd2b){var _0x284298;return db[_0xcb8a('0x3d')][_0xcb8a('0x7d')](_0x393c69['body'],{})[_0xcb8a('0x38')](function(_0x4f30ba){_0x284298=_0x4f30ba;return db[_0xcb8a('0x64')][_0xcb8a('0x7e')]({'where':{'id':_0x284298[_0xcb8a('0x7f')]}});})[_0xcb8a('0x38')](function(_0x223ef5){if(_[_0xcb8a('0x80')](_0x223ef5)){return;}else{_0x284298[_0xcb8a('0x5e')]=_0x223ef5[_0xcb8a('0x5e')];return db[_0xcb8a('0x81')][_0xcb8a('0x7e')]({'where':{'id':_0x284298[_0xcb8a('0x82')]}});}})[_0xcb8a('0x38')](function(_0x348ab0){return respondWithRpcPromise(_0xcb8a('0x83'),_0xcb8a('0x83'),{'FaxAccountId':_['isNil'](_0x393c69[_0xcb8a('0x5a')])?undefined:_0x393c69['body'][_0xcb8a('0x84')],'path':_['isNil'](_0x348ab0)?undefined:util[_0xcb8a('0x61')]('/var/opt/motion2/server/files/attachments/%s',_0x348ab0[_0xcb8a('0x85')]),'fax':_[_0xcb8a('0x80')](_0x284298[_0xcb8a('0x5e')])?undefined:_0x284298[_0xcb8a('0x5e')],'AttachmentId':_0x284298[_0xcb8a('0x82')]},client9002);})[_0xcb8a('0x38')](respondWithResult(_0x39dd2b,0xc9))[_0xcb8a('0x2b')](handleError(_0x39dd2b,null));};exports[_0xcb8a('0x86')]=function(_0x23405d,_0x1ae915){var _0x2e0454=path[_0xcb8a('0x87')](config['root'],'server','files',_0xcb8a('0x88'));return db[_0xcb8a('0x3d')][_0xcb8a('0x59')]({'where':{'id':_0x23405d['params']['id']},'include':[{'model':db['Attachment'],'as':_0xcb8a('0x81')}]})[_0xcb8a('0x38')](handleEntityNotFound(_0x1ae915,null))[_0xcb8a('0x38')](function(_0x17ec40){if(_0x17ec40){return _0x1ae915['download'](path[_0xcb8a('0x87')](_0x2e0454,_0x17ec40['Attachment'][_0xcb8a('0x85')]));}})[_0xcb8a('0x2b')](handleError(_0x1ae915,null));};
\ No newline at end of file
index 304c574..d424301 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf55b=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x41c544,_0x413c5c){var _0x3f8116=function(_0x427e9c){while(--_0x427e9c){_0x41c544['push'](_0x41c544['shift']());}};_0x3f8116(++_0x413c5c);}(_0xf55b,0x1c4));var _0xbf55=function(_0x4e7d18,_0x4e11ff){_0x4e7d18=_0x4e7d18-0x0;var _0x2f9d69=_0xf55b[_0x4e7d18];return _0x2f9d69;};'use strict';var EventEmitter=require(_0xbf55('0x0'));var FaxMessage=require(_0xbf55('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xbf55('0x2')](0x0);var events={'afterCreate':_0xbf55('0x3'),'afterUpdate':_0xbf55('0x4'),'afterDestroy':_0xbf55('0x5')};function emitEvent(_0x5a299d){return function(_0x173604,_0xf5dd3b,_0x4feacb){FaxMessageEvents[_0xbf55('0x6')](_0x5a299d+':'+_0x173604['id'],_0x173604);FaxMessageEvents[_0xbf55('0x6')](_0x5a299d,_0x173604);_0x4feacb(null);};}for(var e in events){if(events[_0xbf55('0x7')](e)){var event=events[e];FaxMessage[_0xbf55('0x8')](e,emitEvent(event));}}module[_0xbf55('0x9')]=FaxMessageEvents;
\ No newline at end of file
+var _0xb92d=['events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x41a737,_0x230080){var _0x673c63=function(_0x212c5a){while(--_0x212c5a){_0x41a737['push'](_0x41a737['shift']());}};_0x673c63(++_0x230080);}(_0xb92d,0x1f4));var _0xdb92=function(_0x3bca2d,_0x1af8f4){_0x3bca2d=_0x3bca2d-0x0;var _0x144a7c=_0xb92d[_0x3bca2d];return _0x144a7c;};'use strict';var EventEmitter=require(_0xdb92('0x0'));var FaxMessage=require(_0xdb92('0x1'))['db'][_0xdb92('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xdb92('0x3')](0x0);var events={'afterCreate':_0xdb92('0x4'),'afterUpdate':_0xdb92('0x5'),'afterDestroy':_0xdb92('0x6')};function emitEvent(_0x20bad1){return function(_0x32fb68,_0x5ede4e,_0x681351){FaxMessageEvents[_0xdb92('0x7')](_0x20bad1+':'+_0x32fb68['id'],_0x32fb68);FaxMessageEvents['emit'](_0x20bad1,_0x32fb68);_0x681351(null);};}for(var e in events){if(events[_0xdb92('0x8')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xdb92('0x9')]=FaxMessageEvents;
\ No newline at end of file
index 83464c3..dc0702b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0c95=['define','FaxMessage','fax_messages','models','get','direction','toLowerCase','out','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','body','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','./faxMessage.attributes','exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0c95,0x12c));var _0x50c9=function(_0x5f035f,_0x5300d1){_0x5f035f=_0x5f035f-0x0;var _0xad281e=_0x0c95[_0x5f035f];return _0xad281e;};'use strict';var _=require(_0x50c9('0x0'));var util=require('util');var logger=require(_0x50c9('0x1'))(_0x50c9('0x2'));var moment=require(_0x50c9('0x3'));var BPromise=require(_0x50c9('0x4'));var rp=require(_0x50c9('0x5'));var attributes=require(_0x50c9('0x6'));module[_0x50c9('0x7')]=function(_0xa7988d,_0x28f072){return _0xa7988d[_0x50c9('0x8')](_0x50c9('0x9'),attributes,{'tableName':_0x50c9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x220894,_0x4cd15c,_0x39744e){var _0x2237bd=_0xa7988d[_0x50c9('0xb')];var _0x4c6b5b=_0x220894[_0x50c9('0xc')]({'plain':!![]});if(_0x4c6b5b[_0x50c9('0xd')][_0x50c9('0xe')]()==='in'||_0x4c6b5b[_0x50c9('0xd')][_0x50c9('0xe')]()===_0x50c9('0xf')&&!_0x4c6b5b['secret']&&!_['isNil'](_0x4c6b5b[_0x50c9('0x10')])){_0x2237bd[_0x50c9('0x11')][_0x50c9('0x12')]({'where':{'id':_0x4c6b5b[_0x50c9('0x13')]}})[_0x50c9('0x14')](function(_0x4ca8b5){if(_0x4ca8b5){_0x4ca8b5[_0x50c9('0x15')]({'lastMsgAt':_0x4c6b5b[_0x50c9('0x16')],'lastMsgDirection':_0x4c6b5b['direction']['toLowerCase'](),'lastMsgBody':_0x4c6b5b[_0x50c9('0x17')]});}})[_0x50c9('0x18')](function(_0x113716){console[_0x50c9('0x19')](_0x113716);});}_0x39744e();}},'charset':_0x50c9('0x1a'),'collate':_0x50c9('0x1b')});};
\ No newline at end of file
+var _0x3d44=['exports','FaxMessage','models','get','direction','toLowerCase','out','isNil','FaxInteraction','FaxInteractionId','createdAt','body','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','./faxMessage.attributes'];(function(_0x116ea0,_0x980666){var _0x1601a8=function(_0xfdae49){while(--_0xfdae49){_0x116ea0['push'](_0x116ea0['shift']());}};_0x1601a8(++_0x980666);}(_0x3d44,0x12d));var _0x43d4=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x3d44[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x43d4('0x0'));var util=require(_0x43d4('0x1'));var logger=require('../../config/logger')(_0x43d4('0x2'));var moment=require(_0x43d4('0x3'));var BPromise=require(_0x43d4('0x4'));var rp=require(_0x43d4('0x5'));var attributes=require(_0x43d4('0x6'));module[_0x43d4('0x7')]=function(_0x22fc5c,_0x43bd39){return _0x22fc5c['define'](_0x43d4('0x8'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x412aaa,_0x74846a,_0x26d047){var _0x4a129f=_0x22fc5c[_0x43d4('0x9')];var _0x434035=_0x412aaa[_0x43d4('0xa')]({'plain':!![]});if(_0x434035[_0x43d4('0xb')][_0x43d4('0xc')]()==='in'||_0x434035['direction']['toLowerCase']()===_0x43d4('0xd')&&!_0x434035['secret']&&!_[_0x43d4('0xe')](_0x434035['UserId'])){_0x4a129f[_0x43d4('0xf')]['findOne']({'where':{'id':_0x434035[_0x43d4('0x10')]}})['then'](function(_0x1f75d2){if(_0x1f75d2){_0x1f75d2['update']({'lastMsgAt':_0x434035[_0x43d4('0x11')],'lastMsgDirection':_0x434035['direction']['toLowerCase'](),'lastMsgBody':_0x434035[_0x43d4('0x12')]});}})[_0x43d4('0x13')](function(_0x27052a){console['error'](_0x27052a);});}_0x26d047();}},'charset':_0x43d4('0x14'),'collate':_0x43d4('0x15')});};
\ No newline at end of file
index 990ff06..6dc7fa3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x818f=['raw','debug','UpdateFaxMessage','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','CreateFaxMessage','FaxMessage','create','body','options'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x818f,0x1da));var _0xf818=function(_0x1a53da,_0x23e0ec){_0x1a53da=_0x1a53da-0x0;var _0x188f7e=_0x818f[_0x1a53da];return _0x188f7e;};'use strict';var _=require(_0xf818('0x0'));var util=require(_0xf818('0x1'));var moment=require(_0xf818('0x2'));var BPromise=require(_0xf818('0x3'));var rs=require(_0xf818('0x4'));var fs=require('fs');var Redis=require(_0xf818('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf818('0x6'));var logger=require(_0xf818('0x7'))(_0xf818('0x8'));var config=require(_0xf818('0x9'));var jayson=require(_0xf818('0xa'));var client=jayson[_0xf818('0xb')][_0xf818('0xc')]({'port':0x232a});config[_0xf818('0xd')]=_[_0xf818('0xe')](config['redis'],{'host':_0xf818('0xf'),'port':0x18eb});var socket=require(_0xf818('0x10'))(new Redis(config[_0xf818('0xd')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0xd4bcb3,_0x188f49,_0x458873){return new BPromise(function(_0x3386f9,_0x2d9470){return client['request'](_0xd4bcb3,_0x458873)[_0xf818('0x11')](function(_0x2b1f0e){logger[_0xf818('0x12')](_0xf818('0x13'),_0x188f49,_0xf818('0x14'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x188f49,_0xf818('0x14'),JSON[_0xf818('0x15')](_0x2b1f0e));if(_0x2b1f0e[_0xf818('0x16')]){if(_0x2b1f0e[_0xf818('0x16')]['code']===0x1f4){logger[_0xf818('0x16')](_0xf818('0x13'),_0x188f49,_0x2b1f0e[_0xf818('0x16')][_0xf818('0x17')]);return _0x2d9470(_0x2b1f0e[_0xf818('0x16')]['message']);}logger['error'](_0xf818('0x13'),_0x188f49,_0x2b1f0e['error'][_0xf818('0x17')]);return _0x3386f9(_0x2b1f0e[_0xf818('0x16')]['message']);}else{logger[_0xf818('0x12')](_0xf818('0x13'),_0x188f49,_0xf818('0x14'));_0x3386f9(_0x2b1f0e['result'][_0xf818('0x17')]);}})[_0xf818('0x18')](function(_0x2d9f81){logger['error']('FaxMessage,\x20%s,\x20%s',_0x188f49,_0x2d9f81);_0x2d9470(_0x2d9f81);});});}exports[_0xf818('0x19')]=function(_0x1505ab){var _0x5c63d9=this;return new Promise(function(_0x31a4d3,_0x505a1f){return db[_0xf818('0x1a')][_0xf818('0x1b')](_0x1505ab[_0xf818('0x1c')],{'raw':_0x1505ab['options']?_0x1505ab[_0xf818('0x1d')][_0xf818('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x324a30){logger[_0xf818('0x12')](_0xf818('0x19'),_0x1505ab);logger[_0xf818('0x1f')](_0xf818('0x19'),_0x1505ab,JSON[_0xf818('0x15')](_0x324a30));_0x31a4d3(_0x324a30);})[_0xf818('0x18')](function(_0x49a619){logger['error'](_0xf818('0x19'),_0x49a619[_0xf818('0x17')],_0x1505ab);_0x505a1f(_0x5c63d9['error'](0x1f4,_0x49a619[_0xf818('0x17')]));});});};exports[_0xf818('0x20')]=function(_0x57627f){var _0x565b71=this;return new Promise(function(_0x102d1a,_0x2b99dd){return db[_0xf818('0x1a')][_0xf818('0x21')](_0x57627f[_0xf818('0x1c')],{'raw':_0x57627f['options']?_0x57627f[_0xf818('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57627f[_0xf818('0x1d')]?_0x57627f['options']['where']||null:null,'attributes':_0x57627f['options']?_0x57627f[_0xf818('0x1d')][_0xf818('0x22')]||null:null,'limit':_0x57627f[_0xf818('0x1d')]?_0x57627f['options'][_0xf818('0x23')]||null:null})[_0xf818('0x11')](function(_0x445ec3){logger[_0xf818('0x12')](_0xf818('0x20'),_0x57627f);logger[_0xf818('0x1f')](_0xf818('0x20'),_0x57627f,JSON['stringify'](_0x445ec3));_0x102d1a(_0x445ec3);})['catch'](function(_0x364672){logger[_0xf818('0x16')](_0xf818('0x20'),_0x364672['message'],_0x57627f);_0x2b99dd(_0x565b71[_0xf818('0x16')](0x1f4,_0x364672[_0xf818('0x17')]));});});};
\ No newline at end of file
+var _0x6dac=['debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateFaxMessage','FaxMessage','create','options','raw','catch','UpdateFaxMessage','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x5951a3,_0x1dc748){var _0x2cbf41=function(_0x456a7f){while(--_0x456a7f){_0x5951a3['push'](_0x5951a3['shift']());}};_0x2cbf41(++_0x1dc748);}(_0x6dac,0x16e));var _0xc6da=function(_0x58f2e8,_0x8e0339){_0x58f2e8=_0x58f2e8-0x0;var _0x5e9112=_0x6dac[_0x58f2e8];return _0x5e9112;};'use strict';var _=require(_0xc6da('0x0'));var util=require(_0xc6da('0x1'));var moment=require(_0xc6da('0x2'));var BPromise=require(_0xc6da('0x3'));var rs=require(_0xc6da('0x4'));var fs=require('fs');var Redis=require(_0xc6da('0x5'));var db=require(_0xc6da('0x6'))['db'];var utils=require(_0xc6da('0x7'));var logger=require(_0xc6da('0x8'))(_0xc6da('0x9'));var config=require(_0xc6da('0xa'));var jayson=require(_0xc6da('0xb'));var client=jayson[_0xc6da('0xc')]['http']({'port':0x232a});config[_0xc6da('0xd')]=_[_0xc6da('0xe')](config[_0xc6da('0xd')],{'host':_0xc6da('0xf'),'port':0x18eb});var socket=require(_0xc6da('0x10'))(new Redis(config[_0xc6da('0xd')]));require(_0xc6da('0x11'))[_0xc6da('0x12')](socket);function respondWithRpcPromise(_0x13fea1,_0x48455d,_0x34b9ea){return new BPromise(function(_0x2e4eb7,_0x414831){return client[_0xc6da('0x13')](_0x13fea1,_0x34b9ea)[_0xc6da('0x14')](function(_0x27411e){logger[_0xc6da('0x15')](_0xc6da('0x16'),_0x48455d,_0xc6da('0x17'));logger[_0xc6da('0x18')](_0xc6da('0x19'),_0x48455d,_0xc6da('0x17'),JSON[_0xc6da('0x1a')](_0x27411e));if(_0x27411e['error']){if(_0x27411e[_0xc6da('0x1b')][_0xc6da('0x1c')]===0x1f4){logger[_0xc6da('0x1b')](_0xc6da('0x16'),_0x48455d,_0x27411e[_0xc6da('0x1b')][_0xc6da('0x1d')]);return _0x414831(_0x27411e['error'][_0xc6da('0x1d')]);}logger[_0xc6da('0x1b')](_0xc6da('0x16'),_0x48455d,_0x27411e[_0xc6da('0x1b')][_0xc6da('0x1d')]);return _0x2e4eb7(_0x27411e['error'][_0xc6da('0x1d')]);}else{logger['info'](_0xc6da('0x16'),_0x48455d,_0xc6da('0x17'));_0x2e4eb7(_0x27411e[_0xc6da('0x1e')][_0xc6da('0x1d')]);}})['catch'](function(_0x232565){logger[_0xc6da('0x1b')](_0xc6da('0x16'),_0x48455d,_0x232565);_0x414831(_0x232565);});});}exports[_0xc6da('0x1f')]=function(_0x357880){var _0x3d16bc=this;return new Promise(function(_0x423387,_0x36ac99){return db[_0xc6da('0x20')][_0xc6da('0x21')](_0x357880['body'],{'raw':_0x357880[_0xc6da('0x22')]?_0x357880[_0xc6da('0x22')][_0xc6da('0x23')]===undefined?!![]:![]:!![]})[_0xc6da('0x14')](function(_0x5f070b){logger[_0xc6da('0x15')](_0xc6da('0x1f'),_0x357880);logger['debug'](_0xc6da('0x1f'),_0x357880,JSON[_0xc6da('0x1a')](_0x5f070b));_0x423387(_0x5f070b);})[_0xc6da('0x24')](function(_0x288241){logger['error'](_0xc6da('0x1f'),_0x288241[_0xc6da('0x1d')],_0x357880);_0x36ac99(_0x3d16bc['error'](0x1f4,_0x288241[_0xc6da('0x1d')]));});});};exports[_0xc6da('0x25')]=function(_0xc41f55){var _0x57c198=this;return new Promise(function(_0x4d232d,_0x1ded21){return db[_0xc6da('0x20')]['update'](_0xc41f55['body'],{'raw':_0xc41f55['options']?_0xc41f55['options'][_0xc6da('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc41f55[_0xc6da('0x22')]?_0xc41f55[_0xc6da('0x22')]['where']||null:null,'attributes':_0xc41f55[_0xc6da('0x22')]?_0xc41f55[_0xc6da('0x22')][_0xc6da('0x26')]||null:null,'limit':_0xc41f55[_0xc6da('0x22')]?_0xc41f55['options']['limit']||null:null})[_0xc6da('0x14')](function(_0x572204){logger[_0xc6da('0x15')](_0xc6da('0x25'),_0xc41f55);logger[_0xc6da('0x18')]('UpdateFaxMessage',_0xc41f55,JSON[_0xc6da('0x1a')](_0x572204));_0x4d232d(_0x572204);})[_0xc6da('0x24')](function(_0x313b5c){logger[_0xc6da('0x1b')](_0xc6da('0x25'),_0x313b5c[_0xc6da('0x1d')],_0xc41f55);_0x1ded21(_0x57c198['error'](0x1f4,_0x313b5c[_0xc6da('0x1d')]));});});};
\ No newline at end of file
index 2b727ef..6be224a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3308=['register','faxMessage:','update','emit','removeListener'];(function(_0x2bdcfd,_0x32697d){var _0x53a635=function(_0x5de676){while(--_0x5de676){_0x2bdcfd['push'](_0x2bdcfd['shift']());}};_0x53a635(++_0x32697d);}(_0x3308,0x12e));var _0x8330=function(_0x4cfba6,_0x218f6f){_0x4cfba6=_0x4cfba6-0x0;var _0x479538=_0x3308[_0x4cfba6];return _0x479538;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=['save','remove',_0x8330('0x0')];function createListener(_0x38c12e,_0x38d12e){return function(_0x1ecf6b){_0x38d12e[_0x8330('0x1')](_0x38c12e,_0x1ecf6b);};}function removeListener(_0x5f52e6,_0x28d8af){return function(){FaxMessageEvents[_0x8330('0x2')](_0x5f52e6,_0x28d8af);};}exports[_0x8330('0x3')]=function(_0x131c05){for(var _0x14ac10=0x0,_0x379821=events['length'];_0x14ac10<_0x379821;_0x14ac10++){var _0x295526=events[_0x14ac10];var _0x2961c1=createListener(_0x8330('0x4')+_0x295526,_0x131c05);FaxMessageEvents['on'](_0x295526,_0x2961c1);}};
\ No newline at end of file
+var _0x3c94=['remove','update','emit','removeListener','register','length','faxMessage:','./faxMessage.events','save'];(function(_0x15bd53,_0x1f2249){var _0x491b79=function(_0x21548e){while(--_0x21548e){_0x15bd53['push'](_0x15bd53['shift']());}};_0x491b79(++_0x1f2249);}(_0x3c94,0xcd));var _0x43c9=function(_0x50148e,_0x4c99c7){_0x50148e=_0x50148e-0x0;var _0x446e9d=_0x3c94[_0x50148e];return _0x446e9d;};'use strict';var FaxMessageEvents=require(_0x43c9('0x0'));var events=[_0x43c9('0x1'),_0x43c9('0x2'),_0x43c9('0x3')];function createListener(_0x188507,_0x2da73f){return function(_0xe05adb){_0x2da73f[_0x43c9('0x4')](_0x188507,_0xe05adb);};}function removeListener(_0x170a0d,_0x44fc3){return function(){FaxMessageEvents[_0x43c9('0x5')](_0x170a0d,_0x44fc3);};}exports[_0x43c9('0x6')]=function(_0x4fdfc2){for(var _0x39c220=0x0,_0xf03007=events[_0x43c9('0x7')];_0x39c220<_0xf03007;_0x39c220++){var _0x37c029=events[_0x39c220];var _0x383adb=createListener(_0x43c9('0x8')+_0x37c029,_0x4fdfc2);FaxMessageEvents['on'](_0x37c029,_0x383adb);}};
\ No newline at end of file
index e0bd404..c0bb784 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x81c6=['post','tracked','fax','put','/:id/reject','reject','delete','destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x2a3c0a,_0x163f5c){var _0x1703a2=function(_0x471dfe){while(--_0x471dfe){_0x2a3c0a['push'](_0x2a3c0a['shift']());}};_0x1703a2(++_0x163f5c);}(_0x81c6,0x1d5));var _0x681c=function(_0x35e7f5,_0x2c52b8){_0x35e7f5=_0x35e7f5-0x0;var _0x290a15=_0x81c6[_0x35e7f5];return _0x290a15;};'use strict';var multer=require('multer');var util=require(_0x681c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x681c('0x1')]();var auth=require(_0x681c('0x2'));var interaction=require(_0x681c('0x3'));var config=require('../../config/environment');var controller=require(_0x681c('0x4'));router[_0x681c('0x5')]('/',auth[_0x681c('0x6')](),controller[_0x681c('0x7')]);router['get'](_0x681c('0x8'),auth[_0x681c('0x6')](),controller['describe']);router['get'](_0x681c('0x9'),auth[_0x681c('0x6')](),controller[_0x681c('0xa')]);router['get']('/:id/download',auth[_0x681c('0x6')](),controller['download']);router[_0x681c('0xb')]('/',auth[_0x681c('0x6')](),interaction[_0x681c('0xc')](_0x681c('0xd'),'faxmessage:create'),controller['create']);router[_0x681c('0xe')](_0x681c('0x9'),auth[_0x681c('0x6')](),controller['update']);router[_0x681c('0xe')]('/:id/accept',auth[_0x681c('0x6')](),controller['accept']);router[_0x681c('0xe')](_0x681c('0xf'),auth[_0x681c('0x6')](),controller[_0x681c('0x10')]);router[_0x681c('0x11')](_0x681c('0x9'),auth['isAuthenticated'](),controller[_0x681c('0x12')]);module[_0x681c('0x13')]=router;
\ No newline at end of file
+var _0x4975=['/:id/reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','describe','/:id/download','download','post','tracked','fax','/:id','update','put','/:id/accept','accept'];(function(_0x3075c4,_0x279c0e){var _0x292c96=function(_0x30b3e1){while(--_0x30b3e1){_0x3075c4['push'](_0x3075c4['shift']());}};_0x292c96(++_0x279c0e);}(_0x4975,0x86));var _0x5497=function(_0x59c607,_0x54c9f7){_0x59c607=_0x59c607-0x0;var _0x1deb38=_0x4975[_0x59c607];return _0x1deb38;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var auth=require(_0x5497('0x5'));var interaction=require(_0x5497('0x6'));var config=require(_0x5497('0x7'));var controller=require(_0x5497('0x8'));router[_0x5497('0x9')]('/',auth[_0x5497('0xa')](),controller['index']);router[_0x5497('0x9')]('/describe',auth[_0x5497('0xa')](),controller[_0x5497('0xb')]);router[_0x5497('0x9')]('/:id',auth[_0x5497('0xa')](),controller['show']);router[_0x5497('0x9')](_0x5497('0xc'),auth[_0x5497('0xa')](),controller[_0x5497('0xd')]);router[_0x5497('0xe')]('/',auth[_0x5497('0xa')](),interaction[_0x5497('0xf')](_0x5497('0x10'),'faxmessage:create'),controller['create']);router['put'](_0x5497('0x11'),auth[_0x5497('0xa')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0x14'),auth[_0x5497('0xa')](),controller[_0x5497('0x15')]);router[_0x5497('0x13')](_0x5497('0x16'),auth[_0x5497('0xa')](),controller['reject']);router[_0x5497('0x17')]('/:id',auth[_0x5497('0xa')](),controller[_0x5497('0x18')]);module[_0x5497('0x19')]=router;
\ No newline at end of file
index 158030a..b9e0f5b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x224a=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x224a,0x1a8));var _0xa224=function(_0x1092d4,_0x217056){_0x1092d4=_0x1092d4-0x0;var _0x4b464c=_0x224a[_0x1092d4];return _0x4b464c;};'use strict';var Sequelize=require(_0xa224('0x0'));module[_0xa224('0x1')]={'name':{'type':Sequelize[_0xa224('0x2')],'unique':_0xa224('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa224('0x2')]},'timeout':{'type':Sequelize[_0xa224('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa224('0x5')](_0xa224('0x6'),_0xa224('0x7'),_0xa224('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}};
\ No newline at end of file
+var _0xd653=['INTEGER','rrmemory','roundrobin','sequelize','name','STRING'];(function(_0x26145b,_0x4ad15c){var _0x76ba1b=function(_0x1fdddf){while(--_0x1fdddf){_0x26145b['push'](_0x26145b['shift']());}};_0x76ba1b(++_0x4ad15c);}(_0xd653,0x1bf));var _0x3d65=function(_0x1f2de6,_0x45d014){_0x1f2de6=_0x1f2de6-0x0;var _0x152027=_0xd653[_0x1f2de6];return _0x152027;};'use strict';var Sequelize=require(_0x3d65('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x3d65('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3d65('0x2')]},'timeout':{'type':Sequelize[_0x3d65('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x3d65('0x4'),'beepall',_0x3d65('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x3d65('0x3')],'defaultValue':0x0}};
\ No newline at end of file
index 678f0b8..b13e6b5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6cba=['autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserFaxQueue','nolimit','order','map','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','SIP','faxPause','Team','pick','getTeams','addTeams','ids','Agents','removeTeams','User','union','addAgents','omit','spread','emit','userFaxQueue:save','removeAgents','userFaxQueue:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/environment','redis','defaults','localhost','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','FaxQueues','name','send','index','FaxQueue','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','filter','merge','type','key','field','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId'];(function(_0x461cad,_0x338d94){var _0x1bae70=function(_0x4be6ea){while(--_0x4be6ea){_0x461cad['push'](_0x461cad['shift']());}};_0x1bae70(++_0x338d94);}(_0x6cba,0x173));var _0xa6cb=function(_0x370397,_0x4f2b07){_0x370397=_0x370397-0x0;var _0x2420ef=_0x6cba[_0x370397];return _0x2420ef;};'use strict';var pdf=require(_0xa6cb('0x0'));var emlformat=require(_0xa6cb('0x1'));var rimraf=require(_0xa6cb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa6cb('0x3'));var rp=require(_0xa6cb('0x4'));var moment=require(_0xa6cb('0x5'));var BPromise=require(_0xa6cb('0x6'));var Mustache=require(_0xa6cb('0x7'));var util=require(_0xa6cb('0x8'));var path=require(_0xa6cb('0x9'));var sox=require(_0xa6cb('0xa'));var csv=require(_0xa6cb('0xb'));var ejs=require(_0xa6cb('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa6cb('0xd'));var jsforce=require(_0xa6cb('0xe'));var deskjs=require(_0xa6cb('0xf'));var toCsv=require(_0xa6cb('0xb'));var querystring=require(_0xa6cb('0x10'));var Papa=require(_0xa6cb('0x11'));var authService=require(_0xa6cb('0x12'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0xa6cb('0x13'));var qs=require(_0xa6cb('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa6cb('0x15'));var db=require('../../mysqldb')['db'];config[_0xa6cb('0x16')]=_[_0xa6cb('0x17')](config[_0xa6cb('0x16')],{'host':_0xa6cb('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa6cb('0x16')]));require('./faxQueue.socket')[_0xa6cb('0x19')](socket);function respondWithStatusCode(_0x46dd09,_0x355f16){_0x355f16=_0x355f16||0xcc;return function(_0x4b1736){if(_0x4b1736){return _0x46dd09[_0xa6cb('0x1a')](_0x355f16);}return _0x46dd09[_0xa6cb('0x1b')](_0x355f16)[_0xa6cb('0x1c')]();};}function respondWithResult(_0x44fc4c,_0x5dc9d5){_0x5dc9d5=_0x5dc9d5||0xc8;return function(_0x15c4ea){if(_0x15c4ea){return _0x44fc4c[_0xa6cb('0x1b')](_0x5dc9d5)[_0xa6cb('0x1d')](_0x15c4ea);}};}function respondWithFilteredResult(_0x968aa1,_0x34c88a){return function(_0x5bf1c9){if(_0x5bf1c9){var _0x54c6f9=_0x5bf1c9[_0xa6cb('0x1e')],_0x25bfe3=_0x34c88a[_0xa6cb('0x1f')],_0x112060=_0x34c88a[_0xa6cb('0x1f')]+_0x34c88a[_0xa6cb('0x20')],_0x566668;if(_0x112060>=_0x54c6f9){_0x112060=_0x54c6f9;_0x566668=0xc8;}else{_0x566668=0xce;}_0x968aa1[_0xa6cb('0x1b')](_0x566668);return _0x968aa1[_0xa6cb('0x21')](_0xa6cb('0x22'),_0x25bfe3+'-'+_0x112060+'/'+_0x54c6f9)[_0xa6cb('0x1d')](_0x5bf1c9);}return null;};}function patchUpdates(_0x1ee44b){return function(_0x1c5cc9){try{jsonpatch['apply'](_0x1c5cc9,_0x1ee44b,!![]);}catch(_0x48aab4){return BPromise[_0xa6cb('0x23')](_0x48aab4);}return _0x1c5cc9[_0xa6cb('0x24')]();};}function saveUpdates(_0x24aff1,_0x4d98bf){return function(_0x2fee2b){if(_0x2fee2b){return _0x2fee2b['update'](_0x24aff1)[_0xa6cb('0x25')](function(_0x1c5ffe){return _0x1c5ffe;});}return null;};}function removeEntity(_0x15b3b9,_0x1abf9a){return function(_0xba7486){if(_0xba7486){return _0xba7486[_0xa6cb('0x26')]()['then'](function(){var _0x223927=_0xba7486[_0xa6cb('0x27')]({'plain':!![]});var _0x13f945=_0xa6cb('0x28');return db['UserProfileResource'][_0xa6cb('0x26')]({'where':{'type':_0x13f945,'resourceId':_0x223927['id']}})[_0xa6cb('0x25')](function(){return _0xba7486;});})[_0xa6cb('0x25')](function(){_0x15b3b9[_0xa6cb('0x1b')](0xcc)[_0xa6cb('0x1c')]();});}};}function handleEntityNotFound(_0x120fc9,_0x161757){return function(_0x4992ff){if(!_0x4992ff){_0x120fc9[_0xa6cb('0x1a')](0x194);}return _0x4992ff;};}function handleError(_0x4c5187,_0x4d4f40){_0x4d4f40=_0x4d4f40||0x1f4;return function(_0x481c0e){logger['error'](_0x481c0e['stack']);if(_0x481c0e[_0xa6cb('0x29')]){delete _0x481c0e['name'];}_0x4c5187[_0xa6cb('0x1b')](_0x4d4f40)[_0xa6cb('0x2a')](_0x481c0e);};}exports[_0xa6cb('0x2b')]=function(_0xeb09f3,_0x3c6b74){var _0xe0d73f={},_0x2b1742={},_0x30478c={'count':0x0,'rows':[]};var _0x12a12a=db[_0xa6cb('0x2c')][_0xa6cb('0x2d')];_0x2b1742[_0xa6cb('0x2e')]=_['keys'](_0x12a12a);_0x2b1742[_0xa6cb('0x2f')]=_[_0xa6cb('0x30')](_0xeb09f3[_0xa6cb('0x2f')]);_0x2b1742[_0xa6cb('0x31')]=_['intersection'](_0x2b1742['model'],_0x2b1742[_0xa6cb('0x2f')]);_0xe0d73f[_0xa6cb('0x32')]=_[_0xa6cb('0x33')](_0x2b1742[_0xa6cb('0x2e')],qs[_0xa6cb('0x34')](_0xeb09f3[_0xa6cb('0x2f')][_0xa6cb('0x34')]));_0xe0d73f[_0xa6cb('0x32')]=_0xe0d73f[_0xa6cb('0x32')][_0xa6cb('0x35')]?_0xe0d73f['attributes']:_0x2b1742['model'];if(!_0xeb09f3[_0xa6cb('0x2f')][_0xa6cb('0x36')]('nolimit')){_0xe0d73f[_0xa6cb('0x20')]=qs[_0xa6cb('0x20')](_0xeb09f3[_0xa6cb('0x2f')][_0xa6cb('0x20')]);_0xe0d73f[_0xa6cb('0x1f')]=qs[_0xa6cb('0x1f')](_0xeb09f3['query']['offset']);}_0xe0d73f['order']=qs[_0xa6cb('0x37')](_0xeb09f3[_0xa6cb('0x2f')][_0xa6cb('0x37')]);_0xe0d73f[_0xa6cb('0x38')]=qs['filters'](_['pick'](_0xeb09f3[_0xa6cb('0x2f')],_0x2b1742[_0xa6cb('0x31')]));if(_0xeb09f3['query'][_0xa6cb('0x39')]){_0xe0d73f[_0xa6cb('0x38')]=_[_0xa6cb('0x3a')](_0xe0d73f[_0xa6cb('0x38')],{'$or':_['map'](_0x12a12a,function(_0xb01a2f){if(_0xb01a2f[_0xa6cb('0x3b')][_0xa6cb('0x3c')]!=='VIRTUAL'){var _0x258999={};_0x258999[_0xb01a2f[_0xa6cb('0x3d')]]={'$like':'%'+_0xeb09f3[_0xa6cb('0x2f')][_0xa6cb('0x39')]+'%'};return _0x258999;}})});}_0xe0d73f=_[_0xa6cb('0x3a')]({},_0xe0d73f,_0xeb09f3[_0xa6cb('0x3e')]);var _0x1ba510={'where':_0xe0d73f['where']};return db[_0xa6cb('0x2c')][_0xa6cb('0x1e')](_0x1ba510)[_0xa6cb('0x25')](function(_0xc4818b){_0x30478c[_0xa6cb('0x1e')]=_0xc4818b;if(_0xeb09f3['query'][_0xa6cb('0x3f')]){_0xe0d73f['include']=[{'all':!![]}];}return db[_0xa6cb('0x2c')][_0xa6cb('0x40')](_0xe0d73f);})[_0xa6cb('0x25')](function(_0x4abcc1){_0x30478c[_0xa6cb('0x41')]=_0x4abcc1;return _0x30478c;})[_0xa6cb('0x25')](respondWithFilteredResult(_0x3c6b74,_0xe0d73f))[_0xa6cb('0x42')](handleError(_0x3c6b74,null));};exports[_0xa6cb('0x43')]=function(_0x1c472a,_0x167af5){var _0x136afb={'raw':!![],'where':{'id':_0x1c472a[_0xa6cb('0x44')]['id']}},_0x1cd0dc={};_0x1cd0dc[_0xa6cb('0x2e')]=_[_0xa6cb('0x30')](db[_0xa6cb('0x2c')]['rawAttributes']);_0x1cd0dc[_0xa6cb('0x2f')]=_[_0xa6cb('0x30')](_0x1c472a[_0xa6cb('0x2f')]);_0x1cd0dc[_0xa6cb('0x31')]=_[_0xa6cb('0x33')](_0x1cd0dc[_0xa6cb('0x2e')],_0x1cd0dc[_0xa6cb('0x2f')]);_0x136afb[_0xa6cb('0x32')]=_[_0xa6cb('0x33')](_0x1cd0dc[_0xa6cb('0x2e')],qs[_0xa6cb('0x34')](_0x1c472a[_0xa6cb('0x2f')][_0xa6cb('0x34')]));_0x136afb[_0xa6cb('0x32')]=_0x136afb[_0xa6cb('0x32')][_0xa6cb('0x35')]?_0x136afb[_0xa6cb('0x32')]:_0x1cd0dc[_0xa6cb('0x2e')];if(_0x1c472a['query'][_0xa6cb('0x3f')]){_0x136afb[_0xa6cb('0x45')]=[{'all':!![]}];}_0x136afb=_['merge']({},_0x136afb,_0x1c472a[_0xa6cb('0x3e')]);return db[_0xa6cb('0x2c')][_0xa6cb('0x46')](_0x136afb)[_0xa6cb('0x25')](handleEntityNotFound(_0x167af5,null))[_0xa6cb('0x25')](respondWithResult(_0x167af5,null))['catch'](handleError(_0x167af5,null));};exports['create']=function(_0x50f668,_0x463629){return db['FaxQueue'][_0xa6cb('0x47')](_0x50f668[_0xa6cb('0x48')],{})[_0xa6cb('0x25')](function(_0x6efc2){var _0x2beadf=_0x50f668['user'][_0xa6cb('0x27')]({'plain':!![]});if(!_0x2beadf)throw new Error(_0xa6cb('0x49'));if(_0x2beadf['role']===_0xa6cb('0x4a')){var _0x2fa0bd=_0x6efc2[_0xa6cb('0x27')]({'plain':!![]});var _0x34cae4='FaxQueues';return db[_0xa6cb('0x4b')][_0xa6cb('0x46')]({'where':{'name':_0x34cae4,'userProfileId':_0x2beadf[_0xa6cb('0x4c')]},'raw':!![]})['then'](function(_0x53bf7c){if(_0x53bf7c&&_0x53bf7c[_0xa6cb('0x4d')]===0x0){return db[_0xa6cb('0x4e')][_0xa6cb('0x47')]({'name':_0x2fa0bd[_0xa6cb('0x29')],'resourceId':_0x2fa0bd['id'],'type':_0x53bf7c[_0xa6cb('0x29')],'sectionId':_0x53bf7c['id']},{})['then'](function(){return _0x6efc2;});}else{return _0x6efc2;}})['catch'](function(_0x322582){logger[_0xa6cb('0x4f')](_0xa6cb('0x50'),_0x322582);throw _0x322582;});}return _0x6efc2;})['then'](respondWithResult(_0x463629,0xc9))['catch'](handleError(_0x463629,null));};exports['update']=function(_0x124734,_0x1b753d){if(_0x124734[_0xa6cb('0x48')]['id']){delete _0x124734[_0xa6cb('0x48')]['id'];}return db[_0xa6cb('0x2c')][_0xa6cb('0x46')]({'where':{'id':_0x124734[_0xa6cb('0x44')]['id']}})[_0xa6cb('0x25')](handleEntityNotFound(_0x1b753d,null))[_0xa6cb('0x25')](saveUpdates(_0x124734[_0xa6cb('0x48')],null))['then'](respondWithResult(_0x1b753d,null))[_0xa6cb('0x42')](handleError(_0x1b753d,null));};exports[_0xa6cb('0x26')]=function(_0x299f63,_0x8ae492){return db[_0xa6cb('0x2c')][_0xa6cb('0x46')]({'where':{'id':_0x299f63[_0xa6cb('0x44')]['id']}})[_0xa6cb('0x25')](handleEntityNotFound(_0x8ae492,null))[_0xa6cb('0x25')](removeEntity(_0x8ae492,null))[_0xa6cb('0x42')](handleError(_0x8ae492,null));};exports[_0xa6cb('0x51')]=function(_0x39a424,_0x199fd3){return db[_0xa6cb('0x2c')][_0xa6cb('0x51')]()[_0xa6cb('0x25')](respondWithResult(_0x199fd3,null))['catch'](handleError(_0x199fd3,null));};exports[_0xa6cb('0x52')]=function(_0x307a8c,_0x4fba02,_0x30e8df){var _0x4da2c0={'raw':!![],'where':{}},_0x18ec07={},_0x30d508;return db[_0xa6cb('0x2c')]['findOne']({'where':{'id':_0x307a8c[_0xa6cb('0x44')]['id']}})[_0xa6cb('0x25')](handleEntityNotFound(_0x4fba02,null))[_0xa6cb('0x25')](function(_0x29376c){if(_0x29376c){_0x30d508=_0x29376c[_0xa6cb('0x27')]({'plain':!![]});_0x18ec07['model']=_[_0xa6cb('0x30')](db[_0xa6cb('0x53')]['rawAttributes']);_0x18ec07[_0xa6cb('0x2f')]=_[_0xa6cb('0x30')](_0x307a8c[_0xa6cb('0x2f')]);_0x18ec07[_0xa6cb('0x31')]=_[_0xa6cb('0x33')](_0x18ec07[_0xa6cb('0x2e')],_0x18ec07['query']);_0x4da2c0[_0xa6cb('0x32')]=_[_0xa6cb('0x33')](_0x18ec07[_0xa6cb('0x2e')],qs[_0xa6cb('0x34')](_0x307a8c['query'][_0xa6cb('0x34')]));_0x4da2c0[_0xa6cb('0x32')]=_0x4da2c0['attributes']['length']?_0x4da2c0[_0xa6cb('0x32')]:_0x18ec07['model'];if(!_0x307a8c[_0xa6cb('0x2f')][_0xa6cb('0x36')](_0xa6cb('0x54'))){_0x4da2c0[_0xa6cb('0x20')]=qs[_0xa6cb('0x20')](_0x307a8c[_0xa6cb('0x2f')][_0xa6cb('0x20')]);_0x4da2c0['offset']=qs[_0xa6cb('0x1f')](_0x307a8c[_0xa6cb('0x2f')][_0xa6cb('0x1f')]);}_0x4da2c0[_0xa6cb('0x55')]=qs[_0xa6cb('0x37')](_0x307a8c[_0xa6cb('0x2f')][_0xa6cb('0x37')]);_0x4da2c0[_0xa6cb('0x38')]=qs['filters'](_['pick'](_0x307a8c['query'],_0x18ec07[_0xa6cb('0x31')]));_0x4da2c0[_0xa6cb('0x38')]['FaxQueueId']=_0x29376c['id'];if(_0x307a8c[_0xa6cb('0x2f')]['filter']){_0x4da2c0[_0xa6cb('0x38')]=_[_0xa6cb('0x3a')](_0x4da2c0[_0xa6cb('0x38')],{'$or':_[_0xa6cb('0x56')](_0x4da2c0[_0xa6cb('0x32')],function(_0x5fc300){var _0x470305={};_0x470305[_0x5fc300]={'$like':'%'+_0x307a8c[_0xa6cb('0x2f')][_0xa6cb('0x39')]+'%'};return _0x470305;})});}_0x4da2c0=_[_0xa6cb('0x3a')]({},_0x4da2c0,_0x307a8c['options']);return db[_0xa6cb('0x53')][_0xa6cb('0x40')](_0x4da2c0);}})[_0xa6cb('0x25')](function(_0x128bd5){if(_0x128bd5){return db['User'][_0xa6cb('0x57')]({'where':{'id':_[_0xa6cb('0x56')](_0x128bd5,_0xa6cb('0x58')),'role':'agent'},'attributes':['id',_0xa6cb('0x29'),'faxPause',_0xa6cb('0x59'),_0xa6cb('0x5a')]});}})[_0xa6cb('0x25')](function(_0x40aea5){if(_0x40aea5){return{'count':_0x40aea5['count'],'rows':_[_0xa6cb('0x56')](_0x40aea5[_0xa6cb('0x41')],function(_0x1e1df5){return{'membername':_0x1e1df5[_0xa6cb('0x29')],'UserId':_0x1e1df5['id'],'queue_name':_0x30d508[_0xa6cb('0x29')],'FaxQueueId':_0x30d508['id'],'interface':util[_0xa6cb('0x5b')](_0xa6cb('0x5c'),_0xa6cb('0x5d'),_0x1e1df5[_0xa6cb('0x29')]),'penalty':0x0,'paused':_0x1e1df5[_0xa6cb('0x5e')],'createdAt':_0x1e1df5[_0xa6cb('0x5a')],'updatedAt':_0x1e1df5['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xa6cb('0x25')](respondWithFilteredResult(_0x4fba02,_0x4da2c0))[_0xa6cb('0x42')](handleError(_0x4fba02,null));};exports['getTeams']=function(_0x39d5b9,_0x11047c,_0x1cade1){var _0x51e0f8={};var _0x282e6d={};var _0x4ef037;var _0x39e5d2;return db[_0xa6cb('0x2c')]['findOne']({'where':{'id':_0x39d5b9[_0xa6cb('0x44')]['id']}})[_0xa6cb('0x25')](handleEntityNotFound(_0x11047c,null))['then'](function(_0x123d3a){if(_0x123d3a){_0x4ef037=_0x123d3a;_0x282e6d['model']=_['keys'](db[_0xa6cb('0x5f')]['rawAttributes']);_0x282e6d[_0xa6cb('0x2f')]=_[_0xa6cb('0x30')](_0x39d5b9['query']);_0x282e6d['filters']=_['intersection'](_0x282e6d[_0xa6cb('0x2e')],_0x282e6d['query']);_0x51e0f8[_0xa6cb('0x32')]=_[_0xa6cb('0x33')](_0x282e6d[_0xa6cb('0x2e')],qs[_0xa6cb('0x34')](_0x39d5b9[_0xa6cb('0x2f')][_0xa6cb('0x34')]));_0x51e0f8[_0xa6cb('0x32')]=_0x51e0f8[_0xa6cb('0x32')][_0xa6cb('0x35')]?_0x51e0f8['attributes']:_0x282e6d[_0xa6cb('0x2e')];_0x51e0f8[_0xa6cb('0x55')]=qs[_0xa6cb('0x37')](_0x39d5b9[_0xa6cb('0x2f')][_0xa6cb('0x37')]);_0x51e0f8[_0xa6cb('0x38')]=qs[_0xa6cb('0x31')](_[_0xa6cb('0x60')](_0x39d5b9[_0xa6cb('0x2f')],_0x282e6d[_0xa6cb('0x31')]));if(_0x39d5b9[_0xa6cb('0x2f')]['filter']){_0x51e0f8[_0xa6cb('0x38')]=_[_0xa6cb('0x3a')](_0x51e0f8[_0xa6cb('0x38')],{'$or':_[_0xa6cb('0x56')](_0x51e0f8[_0xa6cb('0x32')],function(_0x2c8b42){var _0x5ca493={};_0x5ca493[_0x2c8b42]={'$like':'%'+_0x39d5b9[_0xa6cb('0x2f')][_0xa6cb('0x39')]+'%'};return _0x5ca493;})});}_0x51e0f8=_['merge']({},_0x51e0f8,_0x39d5b9[_0xa6cb('0x3e')]);return _0x4ef037[_0xa6cb('0x61')](_0x51e0f8);}})[_0xa6cb('0x25')](function(_0x39a053){if(_0x39a053){_0x39e5d2=_0x39a053[_0xa6cb('0x35')];if(!_0x39d5b9['query']['hasOwnProperty'](_0xa6cb('0x54'))){_0x51e0f8[_0xa6cb('0x20')]=qs[_0xa6cb('0x20')](_0x39d5b9[_0xa6cb('0x2f')][_0xa6cb('0x20')]);_0x51e0f8[_0xa6cb('0x1f')]=qs['offset'](_0x39d5b9[_0xa6cb('0x2f')]['offset']);}return _0x4ef037[_0xa6cb('0x61')](_0x51e0f8);}})[_0xa6cb('0x25')](function(_0xe21a86){if(_0xe21a86){return _0xe21a86?{'count':_0x39e5d2,'rows':_0xe21a86}:null;}})['then'](respondWithResult(_0x11047c,null))[_0xa6cb('0x42')](handleError(_0x11047c,null));};exports[_0xa6cb('0x62')]=function(_0x21befd,_0x539dc5,_0x354cbb){var _0x316ce4=[];var _0x131e7c;return db[_0xa6cb('0x5f')][_0xa6cb('0x40')]({'where':{'id':_0x21befd[_0xa6cb('0x48')][_0xa6cb('0x63')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa6cb('0x64'),'attributes':['id'],'raw':!![]}]})[_0xa6cb('0x25')](function(_0x214ff4){if(_0x214ff4){for(var _0x4f36c1=0x0;_0x4f36c1<_0x214ff4['length'];_0x4f36c1+=0x1){for(var _0x56d94c=0x0;_0x56d94c<_0x214ff4[_0x4f36c1][_0xa6cb('0x64')]['length'];_0x56d94c+=0x1){_0x316ce4=_['union'](_0x316ce4,[_0x214ff4[_0x4f36c1]['Agents'][_0x56d94c]['id']]);}}return _0x316ce4;}})[_0xa6cb('0x25')](function(_0x3915b3){if(_0x3915b3){return db[_0xa6cb('0x2c')][_0xa6cb('0x46')]({'where':{'id':_0x21befd[_0xa6cb('0x44')]['id']}});}})[_0xa6cb('0x25')](function(_0x40bb6f){if(_0x40bb6f){_0x131e7c=_0x40bb6f;return _0x131e7c['addAgents'](_0x316ce4,{'penalty':_0x21befd[_0xa6cb('0x48')]['penalty']});}})['then'](function(_0x57349a){if(_0x57349a){return _0x131e7c[_0xa6cb('0x62')](_0x21befd[_0xa6cb('0x48')][_0xa6cb('0x63')]);}})[_0xa6cb('0x25')](handleEntityNotFound(_0x539dc5,null))[_0xa6cb('0x25')](respondWithStatusCode(_0x539dc5,null))[_0xa6cb('0x42')](handleError(_0x539dc5,null));};exports[_0xa6cb('0x65')]=function(_0x42761c,_0x2b7039,_0xf1a679){var _0x8657e=[];var _0x5868b7;return db[_0xa6cb('0x5f')][_0xa6cb('0x40')]({'where':{'id':_0x42761c[_0xa6cb('0x2f')][_0xa6cb('0x63')]},'attributes':['id'],'include':[{'model':db[_0xa6cb('0x66')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa6cb('0x25')](function(_0x406334){if(_0x406334){for(var _0x4b6c03=0x0;_0x4b6c03<_0x406334[_0xa6cb('0x35')];_0x4b6c03+=0x1){for(var _0x776360=0x0;_0x776360<_0x406334[_0x4b6c03][_0xa6cb('0x64')][_0xa6cb('0x35')];_0x776360+=0x1){_0x8657e=_[_0xa6cb('0x67')](_0x8657e,[_0x406334[_0x4b6c03][_0xa6cb('0x64')][_0x776360]['id']]);}}return _0x8657e;}})[_0xa6cb('0x25')](function(_0xc3806c){if(_0xc3806c){return db[_0xa6cb('0x2c')]['find']({'where':{'id':_0x42761c[_0xa6cb('0x44')]['id']}});}})[_0xa6cb('0x25')](function(_0x3ba767){if(_0x3ba767){_0x5868b7=_0x3ba767;return _0x5868b7['removeAgents'](_0x8657e);}})[_0xa6cb('0x25')](function(_0x2f3d3d){if(_0x5868b7){return _0x5868b7[_0xa6cb('0x65')](_0x42761c['query'][_0xa6cb('0x63')]);}})[_0xa6cb('0x25')](handleEntityNotFound(_0x2b7039,null))[_0xa6cb('0x25')](respondWithStatusCode(_0x2b7039,null))[_0xa6cb('0x42')](handleError(_0x2b7039,null));};exports[_0xa6cb('0x68')]=function(_0x4beab5,_0x56c4af,_0x313d30){return db[_0xa6cb('0x2c')][_0xa6cb('0x46')]({'where':{'id':_0x4beab5[_0xa6cb('0x44')]['id']}})[_0xa6cb('0x25')](handleEntityNotFound(_0x56c4af,null))[_0xa6cb('0x25')](function(_0x14bbf7){if(_0x14bbf7){return _0x14bbf7[_0xa6cb('0x68')](_0x4beab5['body'][_0xa6cb('0x63')],_[_0xa6cb('0x69')](_0x4beab5[_0xa6cb('0x48')],[_0xa6cb('0x63'),'id'])||{})[_0xa6cb('0x6a')](function(_0x1c03b1){for(var _0x2b9a97=0x0;_0x2b9a97<_0x4beab5[_0xa6cb('0x48')]['ids']['length'];_0x2b9a97+=0x1){socket[_0xa6cb('0x6b')](_0xa6cb('0x6c'),{'UserId':_0x4beab5[_0xa6cb('0x48')][_0xa6cb('0x63')][_0x2b9a97],'FaxQueueId':_0x4beab5[_0xa6cb('0x44')]['id']});}return _0x1c03b1;});}})['then'](respondWithResult(_0x56c4af,null))[_0xa6cb('0x42')](handleError(_0x56c4af,null));};exports['removeAgents']=function(_0x17a20d,_0x5aa2ba,_0x3d64ec){var _0xd0847d;return db[_0xa6cb('0x2c')][_0xa6cb('0x46')]({'where':{'id':_0x17a20d[_0xa6cb('0x44')]['id']}})['then'](handleEntityNotFound(_0x5aa2ba,null))[_0xa6cb('0x25')](function(_0x3f65e0){if(_0x3f65e0){return _0x3f65e0[_0xa6cb('0x6d')](_0x17a20d[_0xa6cb('0x2f')][_0xa6cb('0x63')])[_0xa6cb('0x25')](function(_0x27302e){if(_['isArray'](_0x17a20d[_0xa6cb('0x2f')][_0xa6cb('0x63')])){for(var _0x4fa3c1=0x0;_0x4fa3c1<_0x17a20d['query'][_0xa6cb('0x63')]['length'];_0x4fa3c1+=0x1){socket[_0xa6cb('0x6b')](_0xa6cb('0x6e'),{'UserId':_0x17a20d[_0xa6cb('0x2f')][_0xa6cb('0x63')][_0x4fa3c1],'FaxQueueId':_0x17a20d[_0xa6cb('0x44')]['id']});}}else{socket[_0xa6cb('0x6b')](_0xa6cb('0x6e'),{'UserId':_0x17a20d[_0xa6cb('0x2f')]['ids'],'FaxQueueId':_0x17a20d[_0xa6cb('0x44')]['id']});}});}})['then'](respondWithStatusCode(_0x5aa2ba,null))[_0xa6cb('0x42')](handleError(_0x5aa2ba,null));};exports['getAgents']=function(_0x55345e,_0x159a6f,_0x207263){var _0x5160e9={};var _0x1b9e83={};var _0x6aba22;var _0x537713;return db[_0xa6cb('0x2c')]['findOne']({'where':{'id':_0x55345e[_0xa6cb('0x44')]['id']}})[_0xa6cb('0x25')](handleEntityNotFound(_0x159a6f,null))['then'](function(_0x2b0c36){if(_0x2b0c36){_0x6aba22=_0x2b0c36;_0x1b9e83[_0xa6cb('0x2e')]=_[_0xa6cb('0x30')](db['User'][_0xa6cb('0x2d')]);_0x1b9e83[_0xa6cb('0x2f')]=_[_0xa6cb('0x30')](_0x55345e['query']);_0x1b9e83[_0xa6cb('0x31')]=_[_0xa6cb('0x33')](_0x1b9e83[_0xa6cb('0x2e')],_0x1b9e83[_0xa6cb('0x2f')]);_0x5160e9[_0xa6cb('0x32')]=_[_0xa6cb('0x33')](_0x1b9e83[_0xa6cb('0x2e')],qs['fields'](_0x55345e['query'][_0xa6cb('0x34')]));_0x5160e9[_0xa6cb('0x32')]=_0x5160e9[_0xa6cb('0x32')][_0xa6cb('0x35')]?_0x5160e9[_0xa6cb('0x32')]:_0x1b9e83[_0xa6cb('0x2e')];_0x5160e9[_0xa6cb('0x55')]=qs[_0xa6cb('0x37')](_0x55345e[_0xa6cb('0x2f')]['sort']);_0x5160e9[_0xa6cb('0x38')]=qs[_0xa6cb('0x31')](_[_0xa6cb('0x60')](_0x55345e['query'],_0x1b9e83[_0xa6cb('0x31')]));if(_0x55345e[_0xa6cb('0x2f')][_0xa6cb('0x39')]){_0x5160e9[_0xa6cb('0x38')]=_['merge'](_0x5160e9[_0xa6cb('0x38')],{'$or':_[_0xa6cb('0x56')](_0x5160e9[_0xa6cb('0x32')],function(_0x2c882f){var _0x249a87={};_0x249a87[_0x2c882f]={'$like':'%'+_0x55345e['query'][_0xa6cb('0x39')]+'%'};return _0x249a87;})});}_0x5160e9=_['merge']({},_0x5160e9,_0x55345e[_0xa6cb('0x3e')]);return _0x6aba22[_0xa6cb('0x6f')](_0x5160e9);}})[_0xa6cb('0x25')](function(_0x126c84){if(_0x126c84){_0x537713=_0x126c84[_0xa6cb('0x35')];if(!_0x55345e[_0xa6cb('0x2f')]['hasOwnProperty'](_0xa6cb('0x54'))){_0x5160e9[_0xa6cb('0x20')]=qs[_0xa6cb('0x20')](_0x55345e[_0xa6cb('0x2f')][_0xa6cb('0x20')]);_0x5160e9['offset']=qs[_0xa6cb('0x1f')](_0x55345e[_0xa6cb('0x2f')]['offset']);}return _0x6aba22['getAgents'](_0x5160e9);}})['then'](function(_0x2b6f45){if(_0x2b6f45){return _0x2b6f45?{'count':_0x537713,'rows':_0x2b6f45}:null;}})['then'](respondWithResult(_0x159a6f,null))[_0xa6cb('0x42')](handleError(_0x159a6f,null));};
\ No newline at end of file
+var _0x1cb0=['Team','addTeams','Agents','addAgents','penalty','removeTeams','ids','union','removeAgents','omit','emit','userFaxQueue:save','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','get','FaxQueues','error','stack','name','send','FaxQueue','rawAttributes','keys','query','filters','intersection','model','attributes','fields','order','sort','where','pick','filter','merge','map','type','key','field','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','hasOwnProperty','nolimit','User','findAndCountAll','UserId','agent','updatedAt','format','%s/%s','SIP','faxPause','getTeams'];(function(_0x477490,_0xda3f59){var _0x509977=function(_0x2fe293){while(--_0x2fe293){_0x477490['push'](_0x477490['shift']());}};_0x509977(++_0xda3f59);}(_0x1cb0,0x1d9));var _0x01cb=function(_0x100e36,_0x4da225){_0x100e36=_0x100e36-0x0;var _0x1df0c9=_0x1cb0[_0x100e36];return _0x1df0c9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x01cb('0x0'));var rimraf=require(_0x01cb('0x1'));var zipdir=require(_0x01cb('0x2'));var jsonpatch=require(_0x01cb('0x3'));var rp=require(_0x01cb('0x4'));var moment=require(_0x01cb('0x5'));var BPromise=require(_0x01cb('0x6'));var Mustache=require(_0x01cb('0x7'));var util=require(_0x01cb('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x01cb('0x9'));var ejs=require(_0x01cb('0xa'));var fs=require('fs');var _=require(_0x01cb('0xb'));var squel=require(_0x01cb('0xc'));var crypto=require(_0x01cb('0xd'));var jsforce=require(_0x01cb('0xe'));var deskjs=require(_0x01cb('0xf'));var toCsv=require(_0x01cb('0x9'));var querystring=require(_0x01cb('0x10'));var Papa=require(_0x01cb('0x11'));var authService=require('../../components/auth/service');var hardwareService=require(_0x01cb('0x12'));var Redis=require(_0x01cb('0x13'));var qs=require(_0x01cb('0x14'));var logger=require(_0x01cb('0x15'))(_0x01cb('0x16'));var utils=require('../../config/utils');var config=require(_0x01cb('0x17'));var db=require(_0x01cb('0x18'))['db'];config[_0x01cb('0x19')]=_[_0x01cb('0x1a')](config[_0x01cb('0x19')],{'host':_0x01cb('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x01cb('0x19')]));require('./faxQueue.socket')[_0x01cb('0x1c')](socket);function respondWithStatusCode(_0x33ed6f,_0x59a37d){_0x59a37d=_0x59a37d||0xcc;return function(_0x37f5aa){if(_0x37f5aa){return _0x33ed6f[_0x01cb('0x1d')](_0x59a37d);}return _0x33ed6f[_0x01cb('0x1e')](_0x59a37d)[_0x01cb('0x1f')]();};}function respondWithResult(_0x3a813c,_0x18ff3){_0x18ff3=_0x18ff3||0xc8;return function(_0x4250f8){if(_0x4250f8){return _0x3a813c['status'](_0x18ff3)[_0x01cb('0x20')](_0x4250f8);}};}function respondWithFilteredResult(_0x5c41b0,_0x19f4b1){return function(_0x511a3f){if(_0x511a3f){var _0xe104b5=_0x511a3f[_0x01cb('0x21')],_0x53bd14=_0x19f4b1[_0x01cb('0x22')],_0x58fc77=_0x19f4b1[_0x01cb('0x22')]+_0x19f4b1[_0x01cb('0x23')],_0x3a2d0b;if(_0x58fc77>=_0xe104b5){_0x58fc77=_0xe104b5;_0x3a2d0b=0xc8;}else{_0x3a2d0b=0xce;}_0x5c41b0['status'](_0x3a2d0b);return _0x5c41b0[_0x01cb('0x24')](_0x01cb('0x25'),_0x53bd14+'-'+_0x58fc77+'/'+_0xe104b5)[_0x01cb('0x20')](_0x511a3f);}return null;};}function patchUpdates(_0x2527cb){return function(_0x4e9d85){try{jsonpatch[_0x01cb('0x26')](_0x4e9d85,_0x2527cb,!![]);}catch(_0x2ca387){return BPromise[_0x01cb('0x27')](_0x2ca387);}return _0x4e9d85[_0x01cb('0x28')]();};}function saveUpdates(_0x2a25b9,_0x3344e0){return function(_0x5d333d){if(_0x5d333d){return _0x5d333d['update'](_0x2a25b9)['then'](function(_0x3af34f){return _0x3af34f;});}return null;};}function removeEntity(_0xb27e10,_0x35658e){return function(_0x29219e){if(_0x29219e){return _0x29219e[_0x01cb('0x29')]()[_0x01cb('0x2a')](function(){var _0xd19694=_0x29219e[_0x01cb('0x2b')]({'plain':!![]});var _0x15cdfd=_0x01cb('0x2c');return db['UserProfileResource'][_0x01cb('0x29')]({'where':{'type':_0x15cdfd,'resourceId':_0xd19694['id']}})[_0x01cb('0x2a')](function(){return _0x29219e;});})[_0x01cb('0x2a')](function(){_0xb27e10['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x36dbf7,_0x460b4c){return function(_0x11563d){if(!_0x11563d){_0x36dbf7[_0x01cb('0x1d')](0x194);}return _0x11563d;};}function handleError(_0x2b1a12,_0x5442b5){_0x5442b5=_0x5442b5||0x1f4;return function(_0x2adb6c){logger[_0x01cb('0x2d')](_0x2adb6c[_0x01cb('0x2e')]);if(_0x2adb6c['name']){delete _0x2adb6c[_0x01cb('0x2f')];}_0x2b1a12[_0x01cb('0x1e')](_0x5442b5)[_0x01cb('0x30')](_0x2adb6c);};}exports['index']=function(_0x11f9f8,_0x2579a2){var _0x4bff13={},_0x21fe9a={},_0x46d3c5={'count':0x0,'rows':[]};var _0x1b592b=db[_0x01cb('0x31')][_0x01cb('0x32')];_0x21fe9a['model']=_[_0x01cb('0x33')](_0x1b592b);_0x21fe9a[_0x01cb('0x34')]=_['keys'](_0x11f9f8[_0x01cb('0x34')]);_0x21fe9a[_0x01cb('0x35')]=_[_0x01cb('0x36')](_0x21fe9a[_0x01cb('0x37')],_0x21fe9a[_0x01cb('0x34')]);_0x4bff13[_0x01cb('0x38')]=_[_0x01cb('0x36')](_0x21fe9a[_0x01cb('0x37')],qs[_0x01cb('0x39')](_0x11f9f8[_0x01cb('0x34')][_0x01cb('0x39')]));_0x4bff13[_0x01cb('0x38')]=_0x4bff13[_0x01cb('0x38')]['length']?_0x4bff13['attributes']:_0x21fe9a[_0x01cb('0x37')];if(!_0x11f9f8[_0x01cb('0x34')]['hasOwnProperty']('nolimit')){_0x4bff13[_0x01cb('0x23')]=qs[_0x01cb('0x23')](_0x11f9f8[_0x01cb('0x34')][_0x01cb('0x23')]);_0x4bff13[_0x01cb('0x22')]=qs['offset'](_0x11f9f8[_0x01cb('0x34')][_0x01cb('0x22')]);}_0x4bff13[_0x01cb('0x3a')]=qs[_0x01cb('0x3b')](_0x11f9f8[_0x01cb('0x34')][_0x01cb('0x3b')]);_0x4bff13[_0x01cb('0x3c')]=qs['filters'](_[_0x01cb('0x3d')](_0x11f9f8['query'],_0x21fe9a[_0x01cb('0x35')]));if(_0x11f9f8['query'][_0x01cb('0x3e')]){_0x4bff13[_0x01cb('0x3c')]=_[_0x01cb('0x3f')](_0x4bff13[_0x01cb('0x3c')],{'$or':_[_0x01cb('0x40')](_0x1b592b,function(_0x1fd6f9){if(_0x1fd6f9[_0x01cb('0x41')][_0x01cb('0x42')]!=='VIRTUAL'){var _0x1f36f7={};_0x1f36f7[_0x1fd6f9[_0x01cb('0x43')]]={'$like':'%'+_0x11f9f8[_0x01cb('0x34')][_0x01cb('0x3e')]+'%'};return _0x1f36f7;}})});}_0x4bff13=_[_0x01cb('0x3f')]({},_0x4bff13,_0x11f9f8['options']);var _0x5061af={'where':_0x4bff13[_0x01cb('0x3c')]};return db['FaxQueue']['count'](_0x5061af)[_0x01cb('0x2a')](function(_0x94332c){_0x46d3c5[_0x01cb('0x21')]=_0x94332c;if(_0x11f9f8['query'][_0x01cb('0x44')]){_0x4bff13[_0x01cb('0x45')]=[{'all':!![]}];}return db['FaxQueue'][_0x01cb('0x46')](_0x4bff13);})['then'](function(_0x55462a){_0x46d3c5[_0x01cb('0x47')]=_0x55462a;return _0x46d3c5;})[_0x01cb('0x2a')](respondWithFilteredResult(_0x2579a2,_0x4bff13))[_0x01cb('0x48')](handleError(_0x2579a2,null));};exports[_0x01cb('0x49')]=function(_0x5798aa,_0x1c3058){var _0x283cf4={'raw':!![],'where':{'id':_0x5798aa[_0x01cb('0x4a')]['id']}},_0x1bc18e={};_0x1bc18e[_0x01cb('0x37')]=_['keys'](db['FaxQueue'][_0x01cb('0x32')]);_0x1bc18e[_0x01cb('0x34')]=_[_0x01cb('0x33')](_0x5798aa[_0x01cb('0x34')]);_0x1bc18e[_0x01cb('0x35')]=_['intersection'](_0x1bc18e[_0x01cb('0x37')],_0x1bc18e[_0x01cb('0x34')]);_0x283cf4[_0x01cb('0x38')]=_[_0x01cb('0x36')](_0x1bc18e[_0x01cb('0x37')],qs[_0x01cb('0x39')](_0x5798aa['query'][_0x01cb('0x39')]));_0x283cf4[_0x01cb('0x38')]=_0x283cf4['attributes'][_0x01cb('0x4b')]?_0x283cf4['attributes']:_0x1bc18e[_0x01cb('0x37')];if(_0x5798aa[_0x01cb('0x34')]['includeAll']){_0x283cf4[_0x01cb('0x45')]=[{'all':!![]}];}_0x283cf4=_[_0x01cb('0x3f')]({},_0x283cf4,_0x5798aa[_0x01cb('0x4c')]);return db[_0x01cb('0x31')][_0x01cb('0x4d')](_0x283cf4)[_0x01cb('0x2a')](handleEntityNotFound(_0x1c3058,null))[_0x01cb('0x2a')](respondWithResult(_0x1c3058,null))[_0x01cb('0x48')](handleError(_0x1c3058,null));};exports[_0x01cb('0x4e')]=function(_0x1a596a,_0x33bea8){return db[_0x01cb('0x31')][_0x01cb('0x4e')](_0x1a596a[_0x01cb('0x4f')],{})[_0x01cb('0x2a')](function(_0xa82aeb){var _0x134c02=_0x1a596a[_0x01cb('0x50')][_0x01cb('0x2b')]({'plain':!![]});if(!_0x134c02)throw new Error(_0x01cb('0x51'));if(_0x134c02[_0x01cb('0x52')]===_0x01cb('0x50')){var _0x21e687=_0xa82aeb[_0x01cb('0x2b')]({'plain':!![]});var _0x2da161='FaxQueues';return db[_0x01cb('0x53')][_0x01cb('0x4d')]({'where':{'name':_0x2da161,'userProfileId':_0x134c02[_0x01cb('0x54')]},'raw':!![]})[_0x01cb('0x2a')](function(_0x423ad8){if(_0x423ad8&&_0x423ad8['autoAssociation']===0x0){return db[_0x01cb('0x55')][_0x01cb('0x4e')]({'name':_0x21e687['name'],'resourceId':_0x21e687['id'],'type':_0x423ad8[_0x01cb('0x2f')],'sectionId':_0x423ad8['id']},{})['then'](function(){return _0xa82aeb;});}else{return _0xa82aeb;}})[_0x01cb('0x48')](function(_0x12c5a3){logger[_0x01cb('0x2d')](_0x01cb('0x56'),_0x12c5a3);throw _0x12c5a3;});}return _0xa82aeb;})[_0x01cb('0x2a')](respondWithResult(_0x33bea8,0xc9))[_0x01cb('0x48')](handleError(_0x33bea8,null));};exports[_0x01cb('0x57')]=function(_0x54d6c5,_0x2ddd9d){if(_0x54d6c5['body']['id']){delete _0x54d6c5[_0x01cb('0x4f')]['id'];}return db[_0x01cb('0x31')][_0x01cb('0x4d')]({'where':{'id':_0x54d6c5[_0x01cb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2ddd9d,null))[_0x01cb('0x2a')](saveUpdates(_0x54d6c5[_0x01cb('0x4f')],null))['then'](respondWithResult(_0x2ddd9d,null))['catch'](handleError(_0x2ddd9d,null));};exports[_0x01cb('0x29')]=function(_0x227183,_0x436c38){return db[_0x01cb('0x31')]['find']({'where':{'id':_0x227183[_0x01cb('0x4a')]['id']}})[_0x01cb('0x2a')](handleEntityNotFound(_0x436c38,null))[_0x01cb('0x2a')](removeEntity(_0x436c38,null))[_0x01cb('0x48')](handleError(_0x436c38,null));};exports[_0x01cb('0x58')]=function(_0x4592c4,_0x42a808){return db['FaxQueue']['describe']()[_0x01cb('0x2a')](respondWithResult(_0x42a808,null))[_0x01cb('0x48')](handleError(_0x42a808,null));};exports['getMembers']=function(_0x114f78,_0x3a64b9,_0x3fa8d9){var _0x3d7cf1={'raw':!![],'where':{}},_0x5424f3={},_0x2c0057;return db[_0x01cb('0x31')][_0x01cb('0x59')]({'where':{'id':_0x114f78[_0x01cb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3a64b9,null))[_0x01cb('0x2a')](function(_0x6fd3ba){if(_0x6fd3ba){_0x2c0057=_0x6fd3ba['get']({'plain':!![]});_0x5424f3[_0x01cb('0x37')]=_['keys'](db['UserFaxQueue']['rawAttributes']);_0x5424f3[_0x01cb('0x34')]=_['keys'](_0x114f78[_0x01cb('0x34')]);_0x5424f3[_0x01cb('0x35')]=_['intersection'](_0x5424f3[_0x01cb('0x37')],_0x5424f3['query']);_0x3d7cf1[_0x01cb('0x38')]=_[_0x01cb('0x36')](_0x5424f3[_0x01cb('0x37')],qs['fields'](_0x114f78[_0x01cb('0x34')]['fields']));_0x3d7cf1[_0x01cb('0x38')]=_0x3d7cf1['attributes'][_0x01cb('0x4b')]?_0x3d7cf1['attributes']:_0x5424f3[_0x01cb('0x37')];if(!_0x114f78[_0x01cb('0x34')][_0x01cb('0x5a')](_0x01cb('0x5b'))){_0x3d7cf1[_0x01cb('0x23')]=qs[_0x01cb('0x23')](_0x114f78[_0x01cb('0x34')][_0x01cb('0x23')]);_0x3d7cf1[_0x01cb('0x22')]=qs[_0x01cb('0x22')](_0x114f78['query']['offset']);}_0x3d7cf1[_0x01cb('0x3a')]=qs[_0x01cb('0x3b')](_0x114f78['query'][_0x01cb('0x3b')]);_0x3d7cf1[_0x01cb('0x3c')]=qs[_0x01cb('0x35')](_[_0x01cb('0x3d')](_0x114f78[_0x01cb('0x34')],_0x5424f3['filters']));_0x3d7cf1[_0x01cb('0x3c')]['FaxQueueId']=_0x6fd3ba['id'];if(_0x114f78['query'][_0x01cb('0x3e')]){_0x3d7cf1['where']=_[_0x01cb('0x3f')](_0x3d7cf1['where'],{'$or':_[_0x01cb('0x40')](_0x3d7cf1[_0x01cb('0x38')],function(_0x471428){var _0x3cbe03={};_0x3cbe03[_0x471428]={'$like':'%'+_0x114f78[_0x01cb('0x34')][_0x01cb('0x3e')]+'%'};return _0x3cbe03;})});}_0x3d7cf1=_[_0x01cb('0x3f')]({},_0x3d7cf1,_0x114f78[_0x01cb('0x4c')]);return db['UserFaxQueue'][_0x01cb('0x46')](_0x3d7cf1);}})[_0x01cb('0x2a')](function(_0x5e8a42){if(_0x5e8a42){return db[_0x01cb('0x5c')][_0x01cb('0x5d')]({'where':{'id':_['map'](_0x5e8a42,_0x01cb('0x5e')),'role':_0x01cb('0x5f')},'attributes':['id',_0x01cb('0x2f'),'faxPause',_0x01cb('0x60'),'createdAt']});}})[_0x01cb('0x2a')](function(_0x34b103){if(_0x34b103){return{'count':_0x34b103[_0x01cb('0x21')],'rows':_['map'](_0x34b103[_0x01cb('0x47')],function(_0x411e87){return{'membername':_0x411e87['name'],'UserId':_0x411e87['id'],'queue_name':_0x2c0057['name'],'FaxQueueId':_0x2c0057['id'],'interface':util[_0x01cb('0x61')](_0x01cb('0x62'),_0x01cb('0x63'),_0x411e87['name']),'penalty':0x0,'paused':_0x411e87[_0x01cb('0x64')],'createdAt':_0x411e87['createdAt'],'updatedAt':_0x411e87[_0x01cb('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x01cb('0x2a')](respondWithFilteredResult(_0x3a64b9,_0x3d7cf1))[_0x01cb('0x48')](handleError(_0x3a64b9,null));};exports[_0x01cb('0x65')]=function(_0x17889a,_0x294b76,_0xb4a51d){var _0x18a063={};var _0x1d3cd9={};var _0x49d480;var _0x458633;return db[_0x01cb('0x31')][_0x01cb('0x59')]({'where':{'id':_0x17889a['params']['id']}})[_0x01cb('0x2a')](handleEntityNotFound(_0x294b76,null))[_0x01cb('0x2a')](function(_0x2c0bbc){if(_0x2c0bbc){_0x49d480=_0x2c0bbc;_0x1d3cd9[_0x01cb('0x37')]=_[_0x01cb('0x33')](db[_0x01cb('0x66')][_0x01cb('0x32')]);_0x1d3cd9['query']=_['keys'](_0x17889a['query']);_0x1d3cd9['filters']=_[_0x01cb('0x36')](_0x1d3cd9[_0x01cb('0x37')],_0x1d3cd9['query']);_0x18a063[_0x01cb('0x38')]=_[_0x01cb('0x36')](_0x1d3cd9['model'],qs[_0x01cb('0x39')](_0x17889a[_0x01cb('0x34')][_0x01cb('0x39')]));_0x18a063[_0x01cb('0x38')]=_0x18a063[_0x01cb('0x38')][_0x01cb('0x4b')]?_0x18a063[_0x01cb('0x38')]:_0x1d3cd9[_0x01cb('0x37')];_0x18a063[_0x01cb('0x3a')]=qs[_0x01cb('0x3b')](_0x17889a[_0x01cb('0x34')][_0x01cb('0x3b')]);_0x18a063[_0x01cb('0x3c')]=qs['filters'](_[_0x01cb('0x3d')](_0x17889a[_0x01cb('0x34')],_0x1d3cd9[_0x01cb('0x35')]));if(_0x17889a[_0x01cb('0x34')][_0x01cb('0x3e')]){_0x18a063[_0x01cb('0x3c')]=_[_0x01cb('0x3f')](_0x18a063[_0x01cb('0x3c')],{'$or':_[_0x01cb('0x40')](_0x18a063[_0x01cb('0x38')],function(_0x5d0607){var _0x29a52a={};_0x29a52a[_0x5d0607]={'$like':'%'+_0x17889a[_0x01cb('0x34')][_0x01cb('0x3e')]+'%'};return _0x29a52a;})});}_0x18a063=_[_0x01cb('0x3f')]({},_0x18a063,_0x17889a[_0x01cb('0x4c')]);return _0x49d480['getTeams'](_0x18a063);}})[_0x01cb('0x2a')](function(_0x760092){if(_0x760092){_0x458633=_0x760092[_0x01cb('0x4b')];if(!_0x17889a[_0x01cb('0x34')][_0x01cb('0x5a')]('nolimit')){_0x18a063[_0x01cb('0x23')]=qs[_0x01cb('0x23')](_0x17889a[_0x01cb('0x34')][_0x01cb('0x23')]);_0x18a063[_0x01cb('0x22')]=qs['offset'](_0x17889a[_0x01cb('0x34')][_0x01cb('0x22')]);}return _0x49d480[_0x01cb('0x65')](_0x18a063);}})[_0x01cb('0x2a')](function(_0xcfdb43){if(_0xcfdb43){return _0xcfdb43?{'count':_0x458633,'rows':_0xcfdb43}:null;}})[_0x01cb('0x2a')](respondWithResult(_0x294b76,null))[_0x01cb('0x48')](handleError(_0x294b76,null));};exports[_0x01cb('0x67')]=function(_0x537b88,_0xbc4cad,_0x47ddd8){var _0x33c2da=[];var _0x18a683;return db[_0x01cb('0x66')][_0x01cb('0x46')]({'where':{'id':_0x537b88[_0x01cb('0x4f')]['ids']},'attributes':['id'],'include':[{'model':db[_0x01cb('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x01cb('0x2a')](function(_0x41e725){if(_0x41e725){for(var _0x472def=0x0;_0x472def<_0x41e725['length'];_0x472def+=0x1){for(var _0x1b0acb=0x0;_0x1b0acb<_0x41e725[_0x472def][_0x01cb('0x68')][_0x01cb('0x4b')];_0x1b0acb+=0x1){_0x33c2da=_['union'](_0x33c2da,[_0x41e725[_0x472def][_0x01cb('0x68')][_0x1b0acb]['id']]);}}return _0x33c2da;}})[_0x01cb('0x2a')](function(_0x1f7694){if(_0x1f7694){return db['FaxQueue'][_0x01cb('0x4d')]({'where':{'id':_0x537b88[_0x01cb('0x4a')]['id']}});}})[_0x01cb('0x2a')](function(_0x370449){if(_0x370449){_0x18a683=_0x370449;return _0x18a683[_0x01cb('0x69')](_0x33c2da,{'penalty':_0x537b88[_0x01cb('0x4f')][_0x01cb('0x6a')]});}})[_0x01cb('0x2a')](function(_0x15fd2e){if(_0x15fd2e){return _0x18a683[_0x01cb('0x67')](_0x537b88[_0x01cb('0x4f')]['ids']);}})['then'](handleEntityNotFound(_0xbc4cad,null))['then'](respondWithStatusCode(_0xbc4cad,null))[_0x01cb('0x48')](handleError(_0xbc4cad,null));};exports[_0x01cb('0x6b')]=function(_0xac1597,_0x2d087d,_0x140e7e){var _0x563a5c=[];var _0x4bf645;return db[_0x01cb('0x66')]['findAll']({'where':{'id':_0xac1597['query'][_0x01cb('0x6c')]},'attributes':['id'],'include':[{'model':db[_0x01cb('0x5c')],'as':_0x01cb('0x68'),'attributes':['id'],'raw':!![]}]})[_0x01cb('0x2a')](function(_0x239e67){if(_0x239e67){for(var _0x10ae30=0x0;_0x10ae30<_0x239e67[_0x01cb('0x4b')];_0x10ae30+=0x1){for(var _0x370ab6=0x0;_0x370ab6<_0x239e67[_0x10ae30][_0x01cb('0x68')][_0x01cb('0x4b')];_0x370ab6+=0x1){_0x563a5c=_[_0x01cb('0x6d')](_0x563a5c,[_0x239e67[_0x10ae30]['Agents'][_0x370ab6]['id']]);}}return _0x563a5c;}})[_0x01cb('0x2a')](function(_0x1a2869){if(_0x1a2869){return db['FaxQueue'][_0x01cb('0x4d')]({'where':{'id':_0xac1597[_0x01cb('0x4a')]['id']}});}})[_0x01cb('0x2a')](function(_0x46ee15){if(_0x46ee15){_0x4bf645=_0x46ee15;return _0x4bf645[_0x01cb('0x6e')](_0x563a5c);}})[_0x01cb('0x2a')](function(_0x55b205){if(_0x4bf645){return _0x4bf645[_0x01cb('0x6b')](_0xac1597['query']['ids']);}})[_0x01cb('0x2a')](handleEntityNotFound(_0x2d087d,null))[_0x01cb('0x2a')](respondWithStatusCode(_0x2d087d,null))[_0x01cb('0x48')](handleError(_0x2d087d,null));};exports[_0x01cb('0x69')]=function(_0xa2f553,_0x3432a3,_0x31b9e5){return db[_0x01cb('0x31')][_0x01cb('0x4d')]({'where':{'id':_0xa2f553[_0x01cb('0x4a')]['id']}})[_0x01cb('0x2a')](handleEntityNotFound(_0x3432a3,null))[_0x01cb('0x2a')](function(_0x1a753a){if(_0x1a753a){return _0x1a753a['addAgents'](_0xa2f553[_0x01cb('0x4f')]['ids'],_[_0x01cb('0x6f')](_0xa2f553[_0x01cb('0x4f')],[_0x01cb('0x6c'),'id'])||{})['spread'](function(_0x29dc4b){for(var _0x2457cf=0x0;_0x2457cf<_0xa2f553[_0x01cb('0x4f')][_0x01cb('0x6c')][_0x01cb('0x4b')];_0x2457cf+=0x1){socket[_0x01cb('0x70')](_0x01cb('0x71'),{'UserId':_0xa2f553[_0x01cb('0x4f')][_0x01cb('0x6c')][_0x2457cf],'FaxQueueId':_0xa2f553[_0x01cb('0x4a')]['id']});}return _0x29dc4b;});}})[_0x01cb('0x2a')](respondWithResult(_0x3432a3,null))[_0x01cb('0x48')](handleError(_0x3432a3,null));};exports[_0x01cb('0x6e')]=function(_0x55e352,_0x4532e5,_0x2e0ab8){var _0x2f817a;return db['FaxQueue'][_0x01cb('0x4d')]({'where':{'id':_0x55e352[_0x01cb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4532e5,null))[_0x01cb('0x2a')](function(_0x129eeb){if(_0x129eeb){return _0x129eeb['removeAgents'](_0x55e352[_0x01cb('0x34')][_0x01cb('0x6c')])[_0x01cb('0x2a')](function(_0x4b0108){if(_['isArray'](_0x55e352['query'][_0x01cb('0x6c')])){for(var _0xb89816=0x0;_0xb89816<_0x55e352[_0x01cb('0x34')]['ids']['length'];_0xb89816+=0x1){socket[_0x01cb('0x70')]('userFaxQueue:remove',{'UserId':_0x55e352[_0x01cb('0x34')][_0x01cb('0x6c')][_0xb89816],'FaxQueueId':_0x55e352[_0x01cb('0x4a')]['id']});}}else{socket[_0x01cb('0x70')]('userFaxQueue:remove',{'UserId':_0x55e352['query'][_0x01cb('0x6c')],'FaxQueueId':_0x55e352['params']['id']});}});}})[_0x01cb('0x2a')](respondWithStatusCode(_0x4532e5,null))['catch'](handleError(_0x4532e5,null));};exports[_0x01cb('0x72')]=function(_0x446ac8,_0x30f3d0,_0x424998){var _0x1d5091={};var _0x21832d={};var _0xd65e7f;var _0x4a23e8;return db[_0x01cb('0x31')][_0x01cb('0x59')]({'where':{'id':_0x446ac8[_0x01cb('0x4a')]['id']}})[_0x01cb('0x2a')](handleEntityNotFound(_0x30f3d0,null))[_0x01cb('0x2a')](function(_0x1a30a2){if(_0x1a30a2){_0xd65e7f=_0x1a30a2;_0x21832d[_0x01cb('0x37')]=_[_0x01cb('0x33')](db[_0x01cb('0x5c')][_0x01cb('0x32')]);_0x21832d[_0x01cb('0x34')]=_[_0x01cb('0x33')](_0x446ac8[_0x01cb('0x34')]);_0x21832d[_0x01cb('0x35')]=_[_0x01cb('0x36')](_0x21832d['model'],_0x21832d[_0x01cb('0x34')]);_0x1d5091[_0x01cb('0x38')]=_['intersection'](_0x21832d['model'],qs[_0x01cb('0x39')](_0x446ac8[_0x01cb('0x34')][_0x01cb('0x39')]));_0x1d5091[_0x01cb('0x38')]=_0x1d5091[_0x01cb('0x38')][_0x01cb('0x4b')]?_0x1d5091[_0x01cb('0x38')]:_0x21832d['model'];_0x1d5091[_0x01cb('0x3a')]=qs[_0x01cb('0x3b')](_0x446ac8[_0x01cb('0x34')][_0x01cb('0x3b')]);_0x1d5091['where']=qs[_0x01cb('0x35')](_['pick'](_0x446ac8[_0x01cb('0x34')],_0x21832d[_0x01cb('0x35')]));if(_0x446ac8[_0x01cb('0x34')][_0x01cb('0x3e')]){_0x1d5091['where']=_[_0x01cb('0x3f')](_0x1d5091['where'],{'$or':_[_0x01cb('0x40')](_0x1d5091[_0x01cb('0x38')],function(_0x2a41be){var _0x181e9a={};_0x181e9a[_0x2a41be]={'$like':'%'+_0x446ac8[_0x01cb('0x34')]['filter']+'%'};return _0x181e9a;})});}_0x1d5091=_[_0x01cb('0x3f')]({},_0x1d5091,_0x446ac8[_0x01cb('0x4c')]);return _0xd65e7f[_0x01cb('0x72')](_0x1d5091);}})[_0x01cb('0x2a')](function(_0x199ca){if(_0x199ca){_0x4a23e8=_0x199ca[_0x01cb('0x4b')];if(!_0x446ac8[_0x01cb('0x34')][_0x01cb('0x5a')](_0x01cb('0x5b'))){_0x1d5091[_0x01cb('0x23')]=qs['limit'](_0x446ac8['query']['limit']);_0x1d5091[_0x01cb('0x22')]=qs[_0x01cb('0x22')](_0x446ac8[_0x01cb('0x34')][_0x01cb('0x22')]);}return _0xd65e7f['getAgents'](_0x1d5091);}})[_0x01cb('0x2a')](function(_0x251c9d){if(_0x251c9d){return _0x251c9d?{'count':_0x4a23e8,'rows':_0x251c9d}:null;}})[_0x01cb('0x2a')](respondWithResult(_0x30f3d0,null))['catch'](handleError(_0x30f3d0,null));};
\ No newline at end of file
index 2c0115a..c422983 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd67b=['hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x65df34,_0x33e342){var _0x3c915f=function(_0x5c789d){while(--_0x5c789d){_0x65df34['push'](_0x65df34['shift']());}};_0x3c915f(++_0x33e342);}(_0xd67b,0x133));var _0xbd67=function(_0x13370f,_0x79c028){_0x13370f=_0x13370f-0x0;var _0x27b61d=_0xd67b[_0x13370f];return _0x27b61d;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xbd67('0x0'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xbd67('0x1')](0x0);var events={'afterCreate':_0xbd67('0x2'),'afterUpdate':_0xbd67('0x3'),'afterDestroy':'remove'};function emitEvent(_0x40e384){return function(_0x50da5a,_0x1bf96,_0x5a827b){FaxQueueEvents[_0xbd67('0x4')](_0x40e384+':'+_0x50da5a['id'],_0x50da5a);FaxQueueEvents[_0xbd67('0x4')](_0x40e384,_0x50da5a);_0x5a827b(null);};}for(var e in events){if(events[_0xbd67('0x5')](e)){var event=events[e];FaxQueue[_0xbd67('0x6')](e,emitEvent(event));}}module[_0xbd67('0x7')]=FaxQueueEvents;
\ No newline at end of file
+var _0x4b84=['events','../../mysqldb','save','hasOwnProperty','exports'];(function(_0x256422,_0x367394){var _0x55dddc=function(_0x1594bc){while(--_0x1594bc){_0x256422['push'](_0x256422['shift']());}};_0x55dddc(++_0x367394);}(_0x4b84,0x1cc));var _0x44b8=function(_0x54b062,_0x264bb5){_0x54b062=_0x54b062-0x0;var _0x255e41=_0x4b84[_0x54b062];return _0x255e41;};'use strict';var EventEmitter=require(_0x44b8('0x0'));var FaxQueue=require(_0x44b8('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x44b8('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3b26c7){return function(_0x31282a,_0x39ad16,_0x5766b0){FaxQueueEvents['emit'](_0x3b26c7+':'+_0x31282a['id'],_0x31282a);FaxQueueEvents['emit'](_0x3b26c7,_0x31282a);_0x5766b0(null);};}for(var e in events){if(events[_0x44b8('0x3')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x44b8('0x4')]=FaxQueueEvents;
\ No newline at end of file
index 592fbc9..f5fd63a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2eb3=['util','../../config/logger','api','moment','bluebird','request-promise','./faxQueue.attributes','define','FaxQueue','fax_queues'];(function(_0x62d304,_0x271a2d){var _0x2afd9f=function(_0x33e10a){while(--_0x33e10a){_0x62d304['push'](_0x62d304['shift']());}};_0x2afd9f(++_0x271a2d);}(_0x2eb3,0xa0));var _0x32eb=function(_0x13608d,_0x57bdb3){_0x13608d=_0x13608d-0x0;var _0x6c46e5=_0x2eb3[_0x13608d];return _0x6c46e5;};'use strict';var _=require('lodash');var util=require(_0x32eb('0x0'));var logger=require(_0x32eb('0x1'))(_0x32eb('0x2'));var moment=require(_0x32eb('0x3'));var BPromise=require(_0x32eb('0x4'));var rp=require(_0x32eb('0x5'));var attributes=require(_0x32eb('0x6'));module['exports']=function(_0x455fa2,_0x4a9894){return _0x455fa2[_0x32eb('0x7')](_0x32eb('0x8'),attributes,{'tableName':_0x32eb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xc820=['define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','request-promise','./faxQueue.attributes','exports'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xc820,0x1d9));var _0x0c82=function(_0x296eca,_0x3a9172){_0x296eca=_0x296eca-0x0;var _0x593989=_0xc820[_0x296eca];return _0x593989;};'use strict';var _=require(_0x0c82('0x0'));var util=require(_0x0c82('0x1'));var logger=require(_0x0c82('0x2'))(_0x0c82('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0c82('0x4'));var attributes=require(_0x0c82('0x5'));module[_0x0c82('0x6')]=function(_0x507d86,_0x5993a2){return _0x507d86[_0x0c82('0x7')](_0x0c82('0x8'),attributes,{'tableName':_0x0c82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 41d35a4..9745424 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa8aa=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','GetFaxQueue','FaxQueue','options','raw','where','limit','include','map','model','attributes','info','ShowFaxQueue','find','then','lodash','moment','bluebird','ioredis'];(function(_0x4ea191,_0xaa7f96){var _0x4b3d5d=function(_0xbaf924){while(--_0xbaf924){_0x4ea191['push'](_0x4ea191['shift']());}};_0x4b3d5d(++_0xaa7f96);}(_0xa8aa,0xf2));var _0xaa8a=function(_0x11897a,_0x1d4f4b){_0x11897a=_0x11897a-0x0;var _0x1b906b=_0xa8aa[_0x11897a];return _0x1b906b;};'use strict';var _=require(_0xaa8a('0x0'));var util=require('util');var moment=require(_0xaa8a('0x1'));var BPromise=require(_0xaa8a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa8a('0x3'));var db=require(_0xaa8a('0x4'))['db'];var utils=require(_0xaa8a('0x5'));var logger=require(_0xaa8a('0x6'))('rpc');var config=require(_0xaa8a('0x7'));var jayson=require(_0xaa8a('0x8'));var client=jayson[_0xaa8a('0x9')][_0xaa8a('0xa')]({'port':0x232a});config['redis']=_[_0xaa8a('0xb')](config[_0xaa8a('0xc')],{'host':_0xaa8a('0xd'),'port':0x18eb});var socket=require(_0xaa8a('0xe'))(new Redis(config[_0xaa8a('0xc')]));require(_0xaa8a('0xf'))[_0xaa8a('0x10')](socket);function respondWithRpcPromise(_0x5254cd,_0x59b671,_0x2cd930){return new BPromise(function(_0x1e2655,_0x68338d){return client['request'](_0x5254cd,_0x2cd930)['then'](function(_0x513349){logger['info'](_0xaa8a('0x11'),_0x59b671,'request\x20sent');logger[_0xaa8a('0x12')](_0xaa8a('0x13'),_0x59b671,_0xaa8a('0x14'),JSON[_0xaa8a('0x15')](_0x513349));if(_0x513349['error']){if(_0x513349['error'][_0xaa8a('0x16')]===0x1f4){logger[_0xaa8a('0x17')](_0xaa8a('0x11'),_0x59b671,_0x513349[_0xaa8a('0x17')][_0xaa8a('0x18')]);return _0x68338d(_0x513349[_0xaa8a('0x17')][_0xaa8a('0x18')]);}logger[_0xaa8a('0x17')]('FaxQueue,\x20%s,\x20%s',_0x59b671,_0x513349[_0xaa8a('0x17')][_0xaa8a('0x18')]);return _0x1e2655(_0x513349[_0xaa8a('0x17')][_0xaa8a('0x18')]);}else{logger['info'](_0xaa8a('0x11'),_0x59b671,_0xaa8a('0x14'));_0x1e2655(_0x513349[_0xaa8a('0x19')]['message']);}})[_0xaa8a('0x1a')](function(_0x11c5b9){logger[_0xaa8a('0x17')](_0xaa8a('0x11'),_0x59b671,_0x11c5b9);_0x68338d(_0x11c5b9);});});}exports[_0xaa8a('0x1b')]=function(_0x2fa716){var _0x3e69e8=this;return new Promise(function(_0x5076de,_0x442154){return db[_0xaa8a('0x1c')]['findAll']({'raw':_0x2fa716[_0xaa8a('0x1d')]?_0x2fa716[_0xaa8a('0x1d')][_0xaa8a('0x1e')]===undefined?!![]:![]:!![],'where':_0x2fa716['options']?_0x2fa716[_0xaa8a('0x1d')][_0xaa8a('0x1f')]||null:null,'attributes':_0x2fa716[_0xaa8a('0x1d')]?_0x2fa716[_0xaa8a('0x1d')]['attributes']||null:null,'limit':_0x2fa716[_0xaa8a('0x1d')]?_0x2fa716[_0xaa8a('0x1d')][_0xaa8a('0x20')]||null:null,'include':_0x2fa716[_0xaa8a('0x1d')]?_0x2fa716[_0xaa8a('0x1d')][_0xaa8a('0x21')]?_[_0xaa8a('0x22')](_0x2fa716['options'][_0xaa8a('0x21')],function(_0xf24ab5){return{'model':db[_0xf24ab5[_0xaa8a('0x23')]],'as':_0xf24ab5['as'],'attributes':_0xf24ab5[_0xaa8a('0x24')],'include':_0xf24ab5[_0xaa8a('0x21')]?_['map'](_0xf24ab5[_0xaa8a('0x21')],function(_0x4b6310){return{'model':db[_0x4b6310[_0xaa8a('0x23')]],'as':_0x4b6310['as'],'attributes':_0x4b6310[_0xaa8a('0x24')],'include':_0x4b6310[_0xaa8a('0x21')]?_['map'](_0x4b6310[_0xaa8a('0x21')],function(_0x2e6974){return{'model':db[_0x2e6974[_0xaa8a('0x23')]],'as':_0x2e6974['as'],'attributes':_0x2e6974[_0xaa8a('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x325371){logger[_0xaa8a('0x25')]('GetFaxQueue',_0x2fa716);logger[_0xaa8a('0x12')](_0xaa8a('0x1b'),_0x2fa716,JSON[_0xaa8a('0x15')](_0x325371));_0x5076de(_0x325371);})[_0xaa8a('0x1a')](function(_0x4c6bcb){logger[_0xaa8a('0x17')]('GetFaxQueue',_0x4c6bcb[_0xaa8a('0x18')],_0x2fa716);_0x442154(_0x3e69e8[_0xaa8a('0x17')](0x1f4,_0x4c6bcb[_0xaa8a('0x18')]));});});};exports[_0xaa8a('0x26')]=function(_0x546ad9){var _0x28a4d6=this;return new Promise(function(_0x3f87d9,_0x6046db){return db['FaxQueue'][_0xaa8a('0x27')]({'raw':_0x546ad9[_0xaa8a('0x1d')]?_0x546ad9['options'][_0xaa8a('0x1e')]===undefined?!![]:![]:!![],'where':_0x546ad9[_0xaa8a('0x1d')]?_0x546ad9[_0xaa8a('0x1d')][_0xaa8a('0x1f')]||null:null,'attributes':_0x546ad9[_0xaa8a('0x1d')]?_0x546ad9[_0xaa8a('0x1d')]['attributes']||null:null,'include':_0x546ad9[_0xaa8a('0x1d')]?_0x546ad9['options'][_0xaa8a('0x21')]?_[_0xaa8a('0x22')](_0x546ad9['options'][_0xaa8a('0x21')],function(_0x2ce664){return{'model':db[_0x2ce664[_0xaa8a('0x23')]],'as':_0x2ce664['as'],'attributes':_0x2ce664[_0xaa8a('0x24')],'include':_0x2ce664[_0xaa8a('0x21')]?_[_0xaa8a('0x22')](_0x2ce664[_0xaa8a('0x21')],function(_0x216d82){return{'model':db[_0x216d82[_0xaa8a('0x23')]],'as':_0x216d82['as'],'attributes':_0x216d82[_0xaa8a('0x24')],'include':_0x216d82[_0xaa8a('0x21')]?_[_0xaa8a('0x22')](_0x216d82[_0xaa8a('0x21')],function(_0x31e9f3){return{'model':db[_0x31e9f3[_0xaa8a('0x23')]],'as':_0x31e9f3['as'],'attributes':_0x31e9f3['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa8a('0x28')](function(_0x4b1273){logger[_0xaa8a('0x25')](_0xaa8a('0x26'),_0x546ad9);logger['debug'](_0xaa8a('0x26'),_0x546ad9,JSON[_0xaa8a('0x15')](_0x4b1273));_0x3f87d9(_0x4b1273);})[_0xaa8a('0x1a')](function(_0x2c9f0d){logger[_0xaa8a('0x17')](_0xaa8a('0x26'),_0x2c9f0d['message'],_0x546ad9);_0x6046db(_0x28a4d6[_0xaa8a('0x17')](0x1f4,_0x2c9f0d[_0xaa8a('0x18')]));});});};
\ No newline at end of file
+var _0x067e=['http','redis','defaults','socket.io-emitter','register','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','model','map','ShowFaxQueue','find','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x4d7cc7,_0x4e4cf3){var _0x2eab10=function(_0x4acb89){while(--_0x4acb89){_0x4d7cc7['push'](_0x4d7cc7['shift']());}};_0x2eab10(++_0x4e4cf3);}(_0x067e,0x1a4));var _0xe067=function(_0x33967e,_0xdeead7){_0x33967e=_0x33967e-0x0;var _0x31f2f4=_0x067e[_0x33967e];return _0x31f2f4;};'use strict';var _=require('lodash');var util=require(_0xe067('0x0'));var moment=require(_0xe067('0x1'));var BPromise=require(_0xe067('0x2'));var rs=require(_0xe067('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe067('0x4'))['db'];var utils=require(_0xe067('0x5'));var logger=require('../../config/logger')(_0xe067('0x6'));var config=require(_0xe067('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe067('0x8')][_0xe067('0x9')]({'port':0x232a});config[_0xe067('0xa')]=_[_0xe067('0xb')](config[_0xe067('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xe067('0xc'))(new Redis(config[_0xe067('0xa')]));require('./faxQueue.socket')[_0xe067('0xd')](socket);function respondWithRpcPromise(_0x9b1573,_0x38b2df,_0x1ce48d){return new BPromise(function(_0x126dbe,_0x5d694d){return client['request'](_0x9b1573,_0x1ce48d)[_0xe067('0xe')](function(_0x1f56a3){logger[_0xe067('0xf')](_0xe067('0x10'),_0x38b2df,'request\x20sent');logger[_0xe067('0x11')](_0xe067('0x12'),_0x38b2df,_0xe067('0x13'),JSON['stringify'](_0x1f56a3));if(_0x1f56a3['error']){if(_0x1f56a3[_0xe067('0x14')][_0xe067('0x15')]===0x1f4){logger['error'](_0xe067('0x10'),_0x38b2df,_0x1f56a3[_0xe067('0x14')][_0xe067('0x16')]);return _0x5d694d(_0x1f56a3[_0xe067('0x14')][_0xe067('0x16')]);}logger[_0xe067('0x14')](_0xe067('0x10'),_0x38b2df,_0x1f56a3['error'][_0xe067('0x16')]);return _0x126dbe(_0x1f56a3['error']['message']);}else{logger[_0xe067('0xf')]('FaxQueue,\x20%s,\x20%s',_0x38b2df,_0xe067('0x13'));_0x126dbe(_0x1f56a3[_0xe067('0x17')][_0xe067('0x16')]);}})[_0xe067('0x18')](function(_0xf19dc7){logger['error'](_0xe067('0x10'),_0x38b2df,_0xf19dc7);_0x5d694d(_0xf19dc7);});});}exports[_0xe067('0x19')]=function(_0x12c1b1){var _0x20bf12=this;return new Promise(function(_0x3ab5dd,_0xfad697){return db[_0xe067('0x1a')][_0xe067('0x1b')]({'raw':_0x12c1b1[_0xe067('0x1c')]?_0x12c1b1['options'][_0xe067('0x1d')]===undefined?!![]:![]:!![],'where':_0x12c1b1[_0xe067('0x1c')]?_0x12c1b1[_0xe067('0x1c')][_0xe067('0x1e')]||null:null,'attributes':_0x12c1b1[_0xe067('0x1c')]?_0x12c1b1[_0xe067('0x1c')][_0xe067('0x1f')]||null:null,'limit':_0x12c1b1['options']?_0x12c1b1[_0xe067('0x1c')][_0xe067('0x20')]||null:null,'include':_0x12c1b1[_0xe067('0x1c')]?_0x12c1b1['options'][_0xe067('0x21')]?_['map'](_0x12c1b1[_0xe067('0x1c')]['include'],function(_0x232007){return{'model':db[_0x232007[_0xe067('0x22')]],'as':_0x232007['as'],'attributes':_0x232007[_0xe067('0x1f')],'include':_0x232007[_0xe067('0x21')]?_['map'](_0x232007['include'],function(_0xa540d5){return{'model':db[_0xa540d5[_0xe067('0x22')]],'as':_0xa540d5['as'],'attributes':_0xa540d5['attributes'],'include':_0xa540d5[_0xe067('0x21')]?_[_0xe067('0x23')](_0xa540d5[_0xe067('0x21')],function(_0x19e732){return{'model':db[_0x19e732[_0xe067('0x22')]],'as':_0x19e732['as'],'attributes':_0x19e732[_0xe067('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5cef00){logger[_0xe067('0xf')](_0xe067('0x19'),_0x12c1b1);logger[_0xe067('0x11')](_0xe067('0x19'),_0x12c1b1,JSON['stringify'](_0x5cef00));_0x3ab5dd(_0x5cef00);})[_0xe067('0x18')](function(_0x3d8045){logger[_0xe067('0x14')](_0xe067('0x19'),_0x3d8045[_0xe067('0x16')],_0x12c1b1);_0xfad697(_0x20bf12[_0xe067('0x14')](0x1f4,_0x3d8045[_0xe067('0x16')]));});});};exports[_0xe067('0x24')]=function(_0x20ff6b){var _0x41170e=this;return new Promise(function(_0x56948,_0x4ce4e3){return db[_0xe067('0x1a')][_0xe067('0x25')]({'raw':_0x20ff6b[_0xe067('0x1c')]?_0x20ff6b[_0xe067('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x20ff6b[_0xe067('0x1c')]?_0x20ff6b['options'][_0xe067('0x1e')]||null:null,'attributes':_0x20ff6b[_0xe067('0x1c')]?_0x20ff6b[_0xe067('0x1c')][_0xe067('0x1f')]||null:null,'include':_0x20ff6b[_0xe067('0x1c')]?_0x20ff6b[_0xe067('0x1c')][_0xe067('0x21')]?_[_0xe067('0x23')](_0x20ff6b[_0xe067('0x1c')][_0xe067('0x21')],function(_0x3d6183){return{'model':db[_0x3d6183['model']],'as':_0x3d6183['as'],'attributes':_0x3d6183[_0xe067('0x1f')],'include':_0x3d6183[_0xe067('0x21')]?_[_0xe067('0x23')](_0x3d6183[_0xe067('0x21')],function(_0x269ec2){return{'model':db[_0x269ec2[_0xe067('0x22')]],'as':_0x269ec2['as'],'attributes':_0x269ec2[_0xe067('0x1f')],'include':_0x269ec2[_0xe067('0x21')]?_[_0xe067('0x23')](_0x269ec2['include'],function(_0xb4ae66){return{'model':db[_0xb4ae66[_0xe067('0x22')]],'as':_0xb4ae66['as'],'attributes':_0xb4ae66[_0xe067('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe067('0xe')](function(_0xad6942){logger[_0xe067('0xf')](_0xe067('0x24'),_0x20ff6b);logger['debug'](_0xe067('0x24'),_0x20ff6b,JSON[_0xe067('0x26')](_0xad6942));_0x56948(_0xad6942);})[_0xe067('0x18')](function(_0x28cf13){logger['error'](_0xe067('0x24'),_0x28cf13[_0xe067('0x16')],_0x20ff6b);_0x4ce4e3(_0x41170e[_0xe067('0x14')](0x1f4,_0x28cf13[_0xe067('0x16')]));});});};
\ No newline at end of file
index 4af77d8..7935fbe 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xae43=['removeListener','length','./faxQueue.events','save','update','emit'];(function(_0x211311,_0x5e08e9){var _0x12d89b=function(_0x19390f){while(--_0x19390f){_0x211311['push'](_0x211311['shift']());}};_0x12d89b(++_0x5e08e9);}(_0xae43,0x158));var _0x3ae4=function(_0x5bb4e8,_0x44b756){_0x5bb4e8=_0x5bb4e8-0x0;var _0x2a86f2=_0xae43[_0x5bb4e8];return _0x2a86f2;};'use strict';var FaxQueueEvents=require(_0x3ae4('0x0'));var events=[_0x3ae4('0x1'),'remove',_0x3ae4('0x2')];function createListener(_0x3c7344,_0x4da538){return function(_0x258d27){_0x4da538[_0x3ae4('0x3')](_0x3c7344,_0x258d27);};}function removeListener(_0x2e65e7,_0x3eba66){return function(){FaxQueueEvents[_0x3ae4('0x4')](_0x2e65e7,_0x3eba66);};}exports['register']=function(_0x2f8d05){for(var _0x2d515f=0x0,_0xd6e4af=events[_0x3ae4('0x5')];_0x2d515f<_0xd6e4af;_0x2d515f++){var _0x505d14=events[_0x2d515f];var _0x4be030=createListener('faxQueue:'+_0x505d14,_0x2f8d05);FaxQueueEvents['on'](_0x505d14,_0x4be030);}};
\ No newline at end of file
+var _0x3648=['register','faxQueue:','./faxQueue.events','save','remove','update','emit','removeListener'];(function(_0x445073,_0x576b6b){var _0x422da5=function(_0x416dd2){while(--_0x416dd2){_0x445073['push'](_0x445073['shift']());}};_0x422da5(++_0x576b6b);}(_0x3648,0x1d2));var _0x8364=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3648[_0x321bb2];return _0x9c12ed;};'use strict';var FaxQueueEvents=require(_0x8364('0x0'));var events=[_0x8364('0x1'),_0x8364('0x2'),_0x8364('0x3')];function createListener(_0x4dee74,_0x4f6beb){return function(_0x4cbfa4){_0x4f6beb[_0x8364('0x4')](_0x4dee74,_0x4cbfa4);};}function removeListener(_0x13b7e2,_0x3de30d){return function(){FaxQueueEvents[_0x8364('0x5')](_0x13b7e2,_0x3de30d);};}exports[_0x8364('0x6')]=function(_0x2d97f6){for(var _0x4ba479=0x0,_0x41134b=events['length'];_0x4ba479<_0x41134b;_0x4ba479++){var _0x289fb9=events[_0x4ba479];var _0x2797e3=createListener(_0x8364('0x7')+_0x289fb9,_0x2d97f6);FaxQueueEvents['on'](_0x289fb9,_0x2797e3);}};
\ No newline at end of file
index faa57f3..cfe3dc1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x159f=['/:id/members','/:id/users','post','create','/:id/teams','addTeams','addAgents','put','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x3fadd6,_0x2bf0b2){var _0x5b90f9=function(_0x226bc6){while(--_0x226bc6){_0x3fadd6['push'](_0x3fadd6['shift']());}};_0x5b90f9(++_0x2bf0b2);}(_0x159f,0x19c));var _0xf159=function(_0x4086f9,_0x246b55){_0x4086f9=_0x4086f9-0x0;var _0x1f1eea=_0x159f[_0x4086f9];return _0x1f1eea;};'use strict';var multer=require(_0xf159('0x0'));var util=require(_0xf159('0x1'));var path=require(_0xf159('0x2'));var timeout=require(_0xf159('0x3'));var express=require(_0xf159('0x4'));var router=express['Router']();var auth=require(_0xf159('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf159('0x6'));router[_0xf159('0x7')]('/',auth[_0xf159('0x8')](),controller[_0xf159('0x9')]);router[_0xf159('0x7')](_0xf159('0xa'),auth[_0xf159('0x8')](),controller['describe']);router[_0xf159('0x7')](_0xf159('0xb'),auth[_0xf159('0x8')](),controller[_0xf159('0xc')]);router[_0xf159('0x7')](_0xf159('0xd'),auth[_0xf159('0x8')](),controller['getMembers']);router[_0xf159('0x7')]('/:id/teams',auth[_0xf159('0x8')](),controller['getTeams']);router[_0xf159('0x7')](_0xf159('0xe'),auth[_0xf159('0x8')](),controller['getAgents']);router[_0xf159('0xf')]('/',auth[_0xf159('0x8')](),controller[_0xf159('0x10')]);router['post'](_0xf159('0x11'),auth[_0xf159('0x8')](),controller[_0xf159('0x12')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xf159('0x13')]);router[_0xf159('0x14')](_0xf159('0xb'),auth[_0xf159('0x8')](),controller['update']);router[_0xf159('0x15')](_0xf159('0xb'),auth[_0xf159('0x8')](),controller[_0xf159('0x16')]);router[_0xf159('0x15')]('/:id/teams',auth[_0xf159('0x8')](),controller['removeTeams']);router[_0xf159('0x15')](_0xf159('0xe'),auth[_0xf159('0x8')](),controller[_0xf159('0x17')]);module[_0xf159('0x18')]=router;
\ No newline at end of file
+var _0x4045=['/:id/users','getAgents','addTeams','post','addAgents','put','update','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams'];(function(_0x2aad76,_0x52d456){var _0x465c40=function(_0x2a41be){while(--_0x2a41be){_0x2aad76['push'](_0x2aad76['shift']());}};_0x465c40(++_0x52d456);}(_0x4045,0xfe));var _0x5404=function(_0x5a2f78,_0x5f0ef7){_0x5a2f78=_0x5a2f78-0x0;var _0x4c6bc5=_0x4045[_0x5a2f78];return _0x4c6bc5;};'use strict';var multer=require('multer');var util=require(_0x5404('0x0'));var path=require(_0x5404('0x1'));var timeout=require(_0x5404('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x5404('0x3'));var interaction=require(_0x5404('0x4'));var config=require(_0x5404('0x5'));var controller=require('./faxQueue.controller');router[_0x5404('0x6')]('/',auth[_0x5404('0x7')](),controller[_0x5404('0x8')]);router[_0x5404('0x6')](_0x5404('0x9'),auth['isAuthenticated'](),controller[_0x5404('0xa')]);router[_0x5404('0x6')](_0x5404('0xb'),auth[_0x5404('0x7')](),controller[_0x5404('0xc')]);router[_0x5404('0x6')]('/:id/members',auth[_0x5404('0x7')](),controller[_0x5404('0xd')]);router[_0x5404('0x6')](_0x5404('0xe'),auth[_0x5404('0x7')](),controller[_0x5404('0xf')]);router[_0x5404('0x6')](_0x5404('0x10'),auth[_0x5404('0x7')](),controller[_0x5404('0x11')]);router['post']('/',auth[_0x5404('0x7')](),controller['create']);router['post'](_0x5404('0xe'),auth[_0x5404('0x7')](),controller[_0x5404('0x12')]);router[_0x5404('0x13')](_0x5404('0x10'),auth[_0x5404('0x7')](),controller[_0x5404('0x14')]);router[_0x5404('0x15')](_0x5404('0xb'),auth['isAuthenticated'](),controller[_0x5404('0x16')]);router['delete'](_0x5404('0xb'),auth[_0x5404('0x7')](),controller[_0x5404('0x17')]);router['delete'](_0x5404('0xe'),auth['isAuthenticated'](),controller[_0x5404('0x18')]);router['delete'](_0x5404('0x10'),auth[_0x5404('0x7')](),controller[_0x5404('0x19')]);module[_0x5404('0x1a')]=router;
\ No newline at end of file
index 35953e3..ccad7a0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x774c=['sequelize','STRING','DATE','moment'];(function(_0x1e85e6,_0x4a9160){var _0x3635f1=function(_0x47608b){while(--_0x47608b){_0x1e85e6['push'](_0x1e85e6['shift']());}};_0x3635f1(++_0x4a9160);}(_0x774c,0xa3));var _0xc774=function(_0x2a5864,_0x2b9396){_0x2a5864=_0x2a5864-0x0;var _0x490ab6=_0x774c[_0x2a5864];return _0x490ab6;};'use strict';var moment=require(_0xc774('0x0'));var Sequelize=require(_0xc774('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xc774('0x2')]},'joinAt':{'type':Sequelize[_0xc774('0x3')]},'leaveAt':{'type':Sequelize[_0xc774('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xc774('0x3')]},'reason':{'type':Sequelize[_0xc774('0x2')]}};
\ No newline at end of file
+var _0xe2e3=['DATE','moment','sequelize','STRING'];(function(_0x3fee7e,_0xcaeb28){var _0x200ed5=function(_0x2cec13){while(--_0x2cec13){_0x3fee7e['push'](_0x3fee7e['shift']());}};_0x200ed5(++_0xcaeb28);}(_0xe2e3,0x1ed));var _0x3e2e=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xe2e3[_0x487b0c];return _0x1adbdc;};'use strict';var moment=require(_0x3e2e('0x0'));var Sequelize=require(_0x3e2e('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x3e2e('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x3e2e('0x3')]},'leaveAt':{'type':Sequelize[_0x3e2e('0x3')]},'acceptAt':{'type':Sequelize[_0x3e2e('0x3')]},'exitAt':{'type':Sequelize[_0x3e2e('0x3')]},'reason':{'type':Sequelize[_0x3e2e('0x2')]}};
\ No newline at end of file
index 6c09a0b..65797b5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6ea3=['options','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','FaxQueueReport','rawAttributes','model','keys','query','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','where','type','VIRTUAL','field','merge','includeAll','findAll','rows','catch','show','params'];(function(_0x5f44dc,_0x962486){var _0x2f773a=function(_0x1adb19){while(--_0x1adb19){_0x5f44dc['push'](_0x5f44dc['shift']());}};_0x2f773a(++_0x962486);}(_0x6ea3,0x1b5));var _0x36ea=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x6ea3[_0x2642cb];return _0xe6e41;};'use strict';var pdf=require(_0x36ea('0x0'));var emlformat=require(_0x36ea('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x36ea('0x2'));var jsonpatch=require(_0x36ea('0x3'));var rp=require(_0x36ea('0x4'));var moment=require(_0x36ea('0x5'));var BPromise=require(_0x36ea('0x6'));var Mustache=require(_0x36ea('0x7'));var util=require(_0x36ea('0x8'));var path=require('path');var sox=require(_0x36ea('0x9'));var csv=require('to-csv');var ejs=require(_0x36ea('0xa'));var fs=require('fs');var _=require(_0x36ea('0xb'));var squel=require(_0x36ea('0xc'));var crypto=require(_0x36ea('0xd'));var jsforce=require(_0x36ea('0xe'));var deskjs=require(_0x36ea('0xf'));var toCsv=require(_0x36ea('0x10'));var querystring=require(_0x36ea('0x11'));var Papa=require(_0x36ea('0x12'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x36ea('0x13'));var qs=require(_0x36ea('0x14'));var logger=require(_0x36ea('0x15'))('api');var utils=require(_0x36ea('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9a7e2c,_0x8fd0b2){_0x8fd0b2=_0x8fd0b2||0xcc;return function(_0x2ffd3f){if(_0x2ffd3f){return _0x9a7e2c[_0x36ea('0x17')](_0x8fd0b2);}return _0x9a7e2c[_0x36ea('0x18')](_0x8fd0b2)[_0x36ea('0x19')]();};}function respondWithResult(_0x1d7625,_0x2e6fcd){_0x2e6fcd=_0x2e6fcd||0xc8;return function(_0x1ed6ce){if(_0x1ed6ce){return _0x1d7625[_0x36ea('0x18')](_0x2e6fcd)[_0x36ea('0x1a')](_0x1ed6ce);}};}function respondWithFilteredResult(_0x9b29ad,_0x40a11c){return function(_0xfd7e04){if(_0xfd7e04){var _0x4d197c=_0xfd7e04[_0x36ea('0x1b')],_0x39457a=_0x40a11c[_0x36ea('0x1c')],_0x1bd66c=_0x40a11c[_0x36ea('0x1c')]+_0x40a11c[_0x36ea('0x1d')],_0x42c2fc;if(_0x1bd66c>=_0x4d197c){_0x1bd66c=_0x4d197c;_0x42c2fc=0xc8;}else{_0x42c2fc=0xce;}_0x9b29ad[_0x36ea('0x18')](_0x42c2fc);return _0x9b29ad[_0x36ea('0x1e')](_0x36ea('0x1f'),_0x39457a+'-'+_0x1bd66c+'/'+_0x4d197c)['json'](_0xfd7e04);}return null;};}function patchUpdates(_0x380edb){return function(_0x3a1d9b){try{jsonpatch[_0x36ea('0x20')](_0x3a1d9b,_0x380edb,!![]);}catch(_0x323b32){return BPromise[_0x36ea('0x21')](_0x323b32);}return _0x3a1d9b['save']();};}function saveUpdates(_0x513af7,_0x37848d){return function(_0xa5781a){if(_0xa5781a){return _0xa5781a[_0x36ea('0x22')](_0x513af7)[_0x36ea('0x23')](function(_0x39355d){return _0x39355d;});}return null;};}function removeEntity(_0xaf90c8,_0x4bc292){return function(_0x1962ca){if(_0x1962ca){return _0x1962ca[_0x36ea('0x24')]()[_0x36ea('0x23')](function(){_0xaf90c8[_0x36ea('0x18')](0xcc)[_0x36ea('0x19')]();});}};}function handleEntityNotFound(_0x1492eb,_0x4acf2b){return function(_0x2b3b76){if(!_0x2b3b76){_0x1492eb[_0x36ea('0x17')](0x194);}return _0x2b3b76;};}function handleError(_0xfaf56c,_0x29aa70){_0x29aa70=_0x29aa70||0x1f4;return function(_0x4892c2){logger[_0x36ea('0x25')](_0x4892c2[_0x36ea('0x26')]);if(_0x4892c2['name']){delete _0x4892c2[_0x36ea('0x27')];}_0xfaf56c['status'](_0x29aa70)[_0x36ea('0x28')](_0x4892c2);};}exports[_0x36ea('0x29')]=function(_0x5f5a87,_0x51b93a){var _0x469aa6={},_0x37ea5e={},_0x30c395={'count':0x0,'rows':[]};var _0x199719=db[_0x36ea('0x2a')][_0x36ea('0x2b')];_0x37ea5e[_0x36ea('0x2c')]=_[_0x36ea('0x2d')](_0x199719);_0x37ea5e['query']=_['keys'](_0x5f5a87[_0x36ea('0x2e')]);_0x37ea5e['filters']=_['intersection'](_0x37ea5e['model'],_0x37ea5e[_0x36ea('0x2e')]);_0x469aa6[_0x36ea('0x2f')]=_[_0x36ea('0x30')](_0x37ea5e[_0x36ea('0x2c')],qs['fields'](_0x5f5a87[_0x36ea('0x2e')][_0x36ea('0x31')]));_0x469aa6[_0x36ea('0x2f')]=_0x469aa6[_0x36ea('0x2f')][_0x36ea('0x32')]?_0x469aa6[_0x36ea('0x2f')]:_0x37ea5e['model'];if(!_0x5f5a87[_0x36ea('0x2e')]['hasOwnProperty'](_0x36ea('0x33'))){_0x469aa6['limit']=qs[_0x36ea('0x1d')](_0x5f5a87[_0x36ea('0x2e')]['limit']);_0x469aa6[_0x36ea('0x1c')]=qs[_0x36ea('0x1c')](_0x5f5a87[_0x36ea('0x2e')][_0x36ea('0x1c')]);}_0x469aa6[_0x36ea('0x34')]=qs[_0x36ea('0x35')](_0x5f5a87[_0x36ea('0x2e')][_0x36ea('0x35')]);_0x469aa6['where']=qs[_0x36ea('0x36')](_[_0x36ea('0x37')](_0x5f5a87[_0x36ea('0x2e')],_0x37ea5e[_0x36ea('0x36')]));if(_0x5f5a87[_0x36ea('0x2e')]['filter']){_0x469aa6[_0x36ea('0x38')]=_['merge'](_0x469aa6[_0x36ea('0x38')],{'$or':_['map'](_0x199719,function(_0x330476){if(_0x330476[_0x36ea('0x39')]['key']!==_0x36ea('0x3a')){var _0x28a83d={};_0x28a83d[_0x330476[_0x36ea('0x3b')]]={'$like':'%'+_0x5f5a87['query']['filter']+'%'};return _0x28a83d;}})});}_0x469aa6=_[_0x36ea('0x3c')]({},_0x469aa6,_0x5f5a87['options']);var _0x3e7c03={'where':_0x469aa6[_0x36ea('0x38')]};return db['FaxQueueReport'][_0x36ea('0x1b')](_0x3e7c03)[_0x36ea('0x23')](function(_0x557195){_0x30c395[_0x36ea('0x1b')]=_0x557195;if(_0x5f5a87[_0x36ea('0x2e')][_0x36ea('0x3d')]){_0x469aa6['include']=[{'all':!![]}];}return db[_0x36ea('0x2a')][_0x36ea('0x3e')](_0x469aa6);})[_0x36ea('0x23')](function(_0x23291c){_0x30c395[_0x36ea('0x3f')]=_0x23291c;return _0x30c395;})[_0x36ea('0x23')](respondWithFilteredResult(_0x51b93a,_0x469aa6))[_0x36ea('0x40')](handleError(_0x51b93a,null));};exports[_0x36ea('0x41')]=function(_0xadcbfa,_0x45d244){var _0x4c75cc={'raw':!![],'where':{'id':_0xadcbfa[_0x36ea('0x42')]['id']}},_0x34fb06={};_0x34fb06[_0x36ea('0x2c')]=_[_0x36ea('0x2d')](db[_0x36ea('0x2a')][_0x36ea('0x2b')]);_0x34fb06['query']=_[_0x36ea('0x2d')](_0xadcbfa[_0x36ea('0x2e')]);_0x34fb06[_0x36ea('0x36')]=_[_0x36ea('0x30')](_0x34fb06[_0x36ea('0x2c')],_0x34fb06[_0x36ea('0x2e')]);_0x4c75cc['attributes']=_['intersection'](_0x34fb06[_0x36ea('0x2c')],qs[_0x36ea('0x31')](_0xadcbfa['query'][_0x36ea('0x31')]));_0x4c75cc['attributes']=_0x4c75cc[_0x36ea('0x2f')][_0x36ea('0x32')]?_0x4c75cc['attributes']:_0x34fb06['model'];if(_0xadcbfa[_0x36ea('0x2e')][_0x36ea('0x3d')]){_0x4c75cc['include']=[{'all':!![]}];}_0x4c75cc=_[_0x36ea('0x3c')]({},_0x4c75cc,_0xadcbfa[_0x36ea('0x43')]);return db[_0x36ea('0x2a')][_0x36ea('0x44')](_0x4c75cc)[_0x36ea('0x23')](handleEntityNotFound(_0x45d244,null))[_0x36ea('0x23')](respondWithResult(_0x45d244,null))[_0x36ea('0x40')](handleError(_0x45d244,null));};exports[_0x36ea('0x45')]=function(_0x20712,_0x46e242){return db['FaxQueueReport'][_0x36ea('0x45')](_0x20712[_0x36ea('0x46')],{})[_0x36ea('0x23')](respondWithResult(_0x46e242,0xc9))['catch'](handleError(_0x46e242,null));};exports[_0x36ea('0x22')]=function(_0x42e51a,_0x4fdca4){if(_0x42e51a[_0x36ea('0x46')]['id']){delete _0x42e51a[_0x36ea('0x46')]['id'];}return db[_0x36ea('0x2a')][_0x36ea('0x44')]({'where':{'id':_0x42e51a[_0x36ea('0x42')]['id']}})['then'](handleEntityNotFound(_0x4fdca4,null))['then'](saveUpdates(_0x42e51a[_0x36ea('0x46')],null))[_0x36ea('0x23')](respondWithResult(_0x4fdca4,null))[_0x36ea('0x40')](handleError(_0x4fdca4,null));};exports[_0x36ea('0x24')]=function(_0x492c4a,_0x52987d){return db[_0x36ea('0x2a')]['find']({'where':{'id':_0x492c4a[_0x36ea('0x42')]['id']}})['then'](handleEntityNotFound(_0x52987d,null))[_0x36ea('0x23')](removeEntity(_0x52987d,null))[_0x36ea('0x40')](handleError(_0x52987d,null));};exports[_0x36ea('0x47')]=function(_0x3a34d9,_0x49296c){return db['FaxQueueReport'][_0x36ea('0x47')]()[_0x36ea('0x23')](respondWithResult(_0x49296c,null))[_0x36ea('0x40')](handleError(_0x49296c,null));};
\ No newline at end of file
+var _0x15e8=['VIRTUAL','field','filter','options','count','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','FaxQueueReport','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','key'];(function(_0x421436,_0x275c97){var _0x171920=function(_0x131651){while(--_0x131651){_0x421436['push'](_0x421436['shift']());}};_0x171920(++_0x275c97);}(_0x15e8,0x13d));var _0x815e=function(_0x414453,_0x35c44f){_0x414453=_0x414453-0x0;var _0x562b4c=_0x15e8[_0x414453];return _0x562b4c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x815e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x815e('0x1'));var jsonpatch=require(_0x815e('0x2'));var rp=require(_0x815e('0x3'));var moment=require(_0x815e('0x4'));var BPromise=require(_0x815e('0x5'));var Mustache=require(_0x815e('0x6'));var util=require(_0x815e('0x7'));var path=require(_0x815e('0x8'));var sox=require('sox');var csv=require(_0x815e('0x9'));var ejs=require(_0x815e('0xa'));var fs=require('fs');var _=require(_0x815e('0xb'));var squel=require('squel');var crypto=require(_0x815e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x815e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x815e('0xe'));var Papa=require(_0x815e('0xf'));var authService=require('../../components/auth/service');var hardwareService=require(_0x815e('0x10'));var Redis=require('ioredis');var qs=require(_0x815e('0x11'));var logger=require(_0x815e('0x12'))(_0x815e('0x13'));var utils=require(_0x815e('0x14'));var config=require(_0x815e('0x15'));var db=require(_0x815e('0x16'))['db'];function respondWithStatusCode(_0x9b9f64,_0x5ea22d){_0x5ea22d=_0x5ea22d||0xcc;return function(_0x4730a3){if(_0x4730a3){return _0x9b9f64[_0x815e('0x17')](_0x5ea22d);}return _0x9b9f64['status'](_0x5ea22d)[_0x815e('0x18')]();};}function respondWithResult(_0x2ccf62,_0x4abd24){_0x4abd24=_0x4abd24||0xc8;return function(_0x4b1fde){if(_0x4b1fde){return _0x2ccf62[_0x815e('0x19')](_0x4abd24)['json'](_0x4b1fde);}};}function respondWithFilteredResult(_0x1cefd4,_0x371f07){return function(_0x4a7330){if(_0x4a7330){var _0x811655=_0x4a7330['count'],_0x5c3fe5=_0x371f07['offset'],_0x585115=_0x371f07[_0x815e('0x1a')]+_0x371f07[_0x815e('0x1b')],_0x12689b;if(_0x585115>=_0x811655){_0x585115=_0x811655;_0x12689b=0xc8;}else{_0x12689b=0xce;}_0x1cefd4[_0x815e('0x19')](_0x12689b);return _0x1cefd4[_0x815e('0x1c')](_0x815e('0x1d'),_0x5c3fe5+'-'+_0x585115+'/'+_0x811655)[_0x815e('0x1e')](_0x4a7330);}return null;};}function patchUpdates(_0x3ecfe5){return function(_0x5f3ced){try{jsonpatch[_0x815e('0x1f')](_0x5f3ced,_0x3ecfe5,!![]);}catch(_0x5775f6){return BPromise[_0x815e('0x20')](_0x5775f6);}return _0x5f3ced[_0x815e('0x21')]();};}function saveUpdates(_0x228594,_0x77c5b5){return function(_0x1a4749){if(_0x1a4749){return _0x1a4749[_0x815e('0x22')](_0x228594)['then'](function(_0x4b48cc){return _0x4b48cc;});}return null;};}function removeEntity(_0x4cff18,_0x231500){return function(_0x1cace7){if(_0x1cace7){return _0x1cace7[_0x815e('0x23')]()[_0x815e('0x24')](function(){_0x4cff18[_0x815e('0x19')](0xcc)[_0x815e('0x18')]();});}};}function handleEntityNotFound(_0x134423,_0x2bcdb8){return function(_0x5e54de){if(!_0x5e54de){_0x134423['sendStatus'](0x194);}return _0x5e54de;};}function handleError(_0xcbf9b8,_0x1a574d){_0x1a574d=_0x1a574d||0x1f4;return function(_0x47a0d8){logger[_0x815e('0x25')](_0x47a0d8[_0x815e('0x26')]);if(_0x47a0d8[_0x815e('0x27')]){delete _0x47a0d8[_0x815e('0x27')];}_0xcbf9b8[_0x815e('0x19')](_0x1a574d)[_0x815e('0x28')](_0x47a0d8);};}exports['index']=function(_0xccaf92,_0x404ffd){var _0x191bed={},_0x4c1140={},_0x3561b5={'count':0x0,'rows':[]};var _0x8eb4fe=db[_0x815e('0x29')]['rawAttributes'];_0x4c1140[_0x815e('0x2a')]=_[_0x815e('0x2b')](_0x8eb4fe);_0x4c1140[_0x815e('0x2c')]=_[_0x815e('0x2b')](_0xccaf92[_0x815e('0x2c')]);_0x4c1140[_0x815e('0x2d')]=_['intersection'](_0x4c1140['model'],_0x4c1140[_0x815e('0x2c')]);_0x191bed[_0x815e('0x2e')]=_[_0x815e('0x2f')](_0x4c1140[_0x815e('0x2a')],qs[_0x815e('0x30')](_0xccaf92[_0x815e('0x2c')][_0x815e('0x30')]));_0x191bed['attributes']=_0x191bed['attributes'][_0x815e('0x31')]?_0x191bed[_0x815e('0x2e')]:_0x4c1140[_0x815e('0x2a')];if(!_0xccaf92[_0x815e('0x2c')][_0x815e('0x32')]('nolimit')){_0x191bed[_0x815e('0x1b')]=qs[_0x815e('0x1b')](_0xccaf92[_0x815e('0x2c')][_0x815e('0x1b')]);_0x191bed['offset']=qs[_0x815e('0x1a')](_0xccaf92[_0x815e('0x2c')]['offset']);}_0x191bed[_0x815e('0x33')]=qs[_0x815e('0x34')](_0xccaf92['query'][_0x815e('0x34')]);_0x191bed[_0x815e('0x35')]=qs[_0x815e('0x2d')](_[_0x815e('0x36')](_0xccaf92[_0x815e('0x2c')],_0x4c1140[_0x815e('0x2d')]));if(_0xccaf92[_0x815e('0x2c')]['filter']){_0x191bed[_0x815e('0x35')]=_[_0x815e('0x37')](_0x191bed[_0x815e('0x35')],{'$or':_['map'](_0x8eb4fe,function(_0x43d1e1){if(_0x43d1e1[_0x815e('0x38')][_0x815e('0x39')]!==_0x815e('0x3a')){var _0x5e8ded={};_0x5e8ded[_0x43d1e1[_0x815e('0x3b')]]={'$like':'%'+_0xccaf92[_0x815e('0x2c')][_0x815e('0x3c')]+'%'};return _0x5e8ded;}})});}_0x191bed=_[_0x815e('0x37')]({},_0x191bed,_0xccaf92[_0x815e('0x3d')]);var _0x4fd88a={'where':_0x191bed[_0x815e('0x35')]};return db['FaxQueueReport'][_0x815e('0x3e')](_0x4fd88a)['then'](function(_0x86f440){_0x3561b5[_0x815e('0x3e')]=_0x86f440;if(_0xccaf92[_0x815e('0x2c')][_0x815e('0x3f')]){_0x191bed[_0x815e('0x40')]=[{'all':!![]}];}return db[_0x815e('0x29')][_0x815e('0x41')](_0x191bed);})[_0x815e('0x24')](function(_0x3ee9eb){_0x3561b5[_0x815e('0x42')]=_0x3ee9eb;return _0x3561b5;})['then'](respondWithFilteredResult(_0x404ffd,_0x191bed))[_0x815e('0x43')](handleError(_0x404ffd,null));};exports[_0x815e('0x44')]=function(_0x565fb1,_0x353351){var _0x3c0908={'raw':!![],'where':{'id':_0x565fb1['params']['id']}},_0x369dd1={};_0x369dd1[_0x815e('0x2a')]=_[_0x815e('0x2b')](db[_0x815e('0x29')][_0x815e('0x45')]);_0x369dd1[_0x815e('0x2c')]=_[_0x815e('0x2b')](_0x565fb1[_0x815e('0x2c')]);_0x369dd1[_0x815e('0x2d')]=_[_0x815e('0x2f')](_0x369dd1[_0x815e('0x2a')],_0x369dd1[_0x815e('0x2c')]);_0x3c0908[_0x815e('0x2e')]=_[_0x815e('0x2f')](_0x369dd1[_0x815e('0x2a')],qs[_0x815e('0x30')](_0x565fb1[_0x815e('0x2c')][_0x815e('0x30')]));_0x3c0908[_0x815e('0x2e')]=_0x3c0908[_0x815e('0x2e')]['length']?_0x3c0908['attributes']:_0x369dd1['model'];if(_0x565fb1[_0x815e('0x2c')][_0x815e('0x3f')]){_0x3c0908[_0x815e('0x40')]=[{'all':!![]}];}_0x3c0908=_[_0x815e('0x37')]({},_0x3c0908,_0x565fb1['options']);return db['FaxQueueReport'][_0x815e('0x46')](_0x3c0908)[_0x815e('0x24')](handleEntityNotFound(_0x353351,null))['then'](respondWithResult(_0x353351,null))[_0x815e('0x43')](handleError(_0x353351,null));};exports[_0x815e('0x47')]=function(_0x549366,_0x3ef326){return db[_0x815e('0x29')][_0x815e('0x47')](_0x549366['body'],{})[_0x815e('0x24')](respondWithResult(_0x3ef326,0xc9))[_0x815e('0x43')](handleError(_0x3ef326,null));};exports[_0x815e('0x22')]=function(_0x82a922,_0x44f9af){if(_0x82a922[_0x815e('0x48')]['id']){delete _0x82a922['body']['id'];}return db[_0x815e('0x29')][_0x815e('0x46')]({'where':{'id':_0x82a922[_0x815e('0x49')]['id']}})[_0x815e('0x24')](handleEntityNotFound(_0x44f9af,null))[_0x815e('0x24')](saveUpdates(_0x82a922[_0x815e('0x48')],null))[_0x815e('0x24')](respondWithResult(_0x44f9af,null))['catch'](handleError(_0x44f9af,null));};exports[_0x815e('0x23')]=function(_0x1531de,_0x3d0114){return db['FaxQueueReport']['find']({'where':{'id':_0x1531de[_0x815e('0x49')]['id']}})[_0x815e('0x24')](handleEntityNotFound(_0x3d0114,null))[_0x815e('0x24')](removeEntity(_0x3d0114,null))[_0x815e('0x43')](handleError(_0x3d0114,null));};exports[_0x815e('0x4a')]=function(_0x19e752,_0x51f509){return db[_0x815e('0x29')][_0x815e('0x4a')]()['then'](respondWithResult(_0x51f509,null))[_0x815e('0x43')](handleError(_0x51f509,null));};
\ No newline at end of file
index aef4c1c..ec4cbc8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7176=['FaxQueueReport','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','exports'];(function(_0x237546,_0xa81b26){var _0x233e29=function(_0x728aa4){while(--_0x728aa4){_0x237546['push'](_0x237546['shift']());}};_0x233e29(++_0xa81b26);}(_0x7176,0x1b1));var _0x6717=function(_0x268ef8,_0x186ffd){_0x268ef8=_0x268ef8-0x0;var _0x5e1cd5=_0x7176[_0x268ef8];return _0x5e1cd5;};'use strict';var _=require(_0x6717('0x0'));var util=require(_0x6717('0x1'));var logger=require(_0x6717('0x2'))(_0x6717('0x3'));var moment=require('moment');var BPromise=require(_0x6717('0x4'));var rp=require(_0x6717('0x5'));var attributes=require('./faxQueueReport.attributes');module[_0x6717('0x6')]=function(_0x3b85ae,_0x4deaf6){return _0x3b85ae['define'](_0x6717('0x7'),attributes,{'tableName':_0x6717('0x8'),'paranoid':![],'indexes':[{'name':_0x6717('0x9'),'fields':[_0x6717('0x9')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xe396=['exports','uniqueid','lodash','util','api','bluebird','request-promise'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xe396,0x1f3));var _0x6e39=function(_0x25e119,_0x36aa2b){_0x25e119=_0x25e119-0x0;var _0x2fb8e2=_0xe396[_0x25e119];return _0x2fb8e2;};'use strict';var _=require(_0x6e39('0x0'));var util=require(_0x6e39('0x1'));var logger=require('../../config/logger')(_0x6e39('0x2'));var moment=require('moment');var BPromise=require(_0x6e39('0x3'));var rp=require(_0x6e39('0x4'));var attributes=require('./faxQueueReport.attributes');module[_0x6e39('0x5')]=function(_0x5c8302,_0x41cd31){return _0x5c8302['define']('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x6e39('0x6')]}],'timestamps':!![]});};
\ No newline at end of file
index a7e1aa4..909c8dc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4171=['FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateFaxQueueReport','FaxQueueReport','body','raw','then','catch','UpdateFaxQueueReport','options','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x45b482,_0x3be9d9){var _0x1d7e90=function(_0x6fe47b){while(--_0x6fe47b){_0x45b482['push'](_0x45b482['shift']());}};_0x1d7e90(++_0x3be9d9);}(_0x4171,0x6a));var _0x1417=function(_0x555cdd,_0x4c1018){_0x555cdd=_0x555cdd-0x0;var _0x455c20=_0x4171[_0x555cdd];return _0x455c20;};'use strict';var _=require('lodash');var util=require(_0x1417('0x0'));var moment=require(_0x1417('0x1'));var BPromise=require(_0x1417('0x2'));var rs=require(_0x1417('0x3'));var fs=require('fs');var Redis=require(_0x1417('0x4'));var db=require(_0x1417('0x5'))['db'];var utils=require(_0x1417('0x6'));var logger=require('../../config/logger')(_0x1417('0x7'));var config=require('../../config/environment');var jayson=require(_0x1417('0x8'));var client=jayson['client'][_0x1417('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35c775,_0x3e2a7d,_0x2e8ef8){return new BPromise(function(_0x4b713a,_0x49dc2b){return client['request'](_0x35c775,_0x2e8ef8)['then'](function(_0x57f09e){logger[_0x1417('0xa')](_0x1417('0xb'),_0x3e2a7d,_0x1417('0xc'));logger[_0x1417('0xd')](_0x1417('0xe'),_0x3e2a7d,_0x1417('0xc'),JSON[_0x1417('0xf')](_0x57f09e));if(_0x57f09e[_0x1417('0x10')]){if(_0x57f09e['error']['code']===0x1f4){logger[_0x1417('0x10')](_0x1417('0xb'),_0x3e2a7d,_0x57f09e[_0x1417('0x10')]['message']);return _0x49dc2b(_0x57f09e[_0x1417('0x10')][_0x1417('0x11')]);}logger[_0x1417('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x3e2a7d,_0x57f09e[_0x1417('0x10')][_0x1417('0x11')]);return _0x4b713a(_0x57f09e[_0x1417('0x10')][_0x1417('0x11')]);}else{logger[_0x1417('0xa')](_0x1417('0xb'),_0x3e2a7d,'request\x20sent');_0x4b713a(_0x57f09e[_0x1417('0x12')][_0x1417('0x11')]);}})['catch'](function(_0x121119){logger[_0x1417('0x10')](_0x1417('0xb'),_0x3e2a7d,_0x121119);_0x49dc2b(_0x121119);});});}exports[_0x1417('0x13')]=function(_0x310730){var _0xbc72ff=this;return new Promise(function(_0x166ff6,_0x48df1a){return db[_0x1417('0x14')]['create'](_0x310730[_0x1417('0x15')],{'raw':_0x310730['options']?_0x310730['options'][_0x1417('0x16')]===undefined?!![]:![]:!![]})[_0x1417('0x17')](function(_0x331ddd){logger[_0x1417('0xa')](_0x1417('0x13'),_0x310730);logger[_0x1417('0xd')](_0x1417('0x13'),_0x310730,JSON[_0x1417('0xf')](_0x331ddd));_0x166ff6(_0x331ddd);})[_0x1417('0x18')](function(_0xa8d41a){logger['error'](_0x1417('0x13'),_0xa8d41a[_0x1417('0x11')],_0x310730);_0x48df1a(_0xbc72ff[_0x1417('0x10')](0x1f4,_0xa8d41a[_0x1417('0x11')]));});});};exports[_0x1417('0x19')]=function(_0x2863ee){var _0x4ddcbb=this;return new Promise(function(_0x5dc94a,_0x50e487){return db[_0x1417('0x14')]['update'](_0x2863ee[_0x1417('0x15')],{'raw':_0x2863ee[_0x1417('0x1a')]?_0x2863ee['options'][_0x1417('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2863ee[_0x1417('0x1a')]?_0x2863ee[_0x1417('0x1a')][_0x1417('0x1b')]||null:null,'attributes':_0x2863ee['options']?_0x2863ee[_0x1417('0x1a')][_0x1417('0x1c')]||null:null,'limit':_0x2863ee[_0x1417('0x1a')]?_0x2863ee[_0x1417('0x1a')][_0x1417('0x1d')]||null:null})[_0x1417('0x17')](function(_0x7f8967){logger[_0x1417('0xa')](_0x1417('0x19'),_0x2863ee);logger[_0x1417('0xd')](_0x1417('0x19'),_0x2863ee,JSON[_0x1417('0xf')](_0x7f8967));_0x5dc94a(_0x7f8967);})['catch'](function(_0x519b0b){logger['error']('UpdateFaxQueueReport',_0x519b0b[_0x1417('0x11')],_0x2863ee);_0x50e487(_0x4ddcbb['error'](0x1f4,_0x519b0b['message']));});});};
\ No newline at end of file
+var _0x7cd6=['CreateFaxQueueReport','update','attributes','UpdateFaxQueueReport','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','FaxQueueReport','create','body','options','raw'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7cd6,0x1f4));var _0x67cd=function(_0x58a597,_0xbf8673){_0x58a597=_0x58a597-0x0;var _0x316961=_0x7cd6[_0x58a597];return _0x316961;};'use strict';var _=require(_0x67cd('0x0'));var util=require(_0x67cd('0x1'));var moment=require(_0x67cd('0x2'));var BPromise=require(_0x67cd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x67cd('0x4'))['db'];var utils=require(_0x67cd('0x5'));var logger=require(_0x67cd('0x6'))('rpc');var config=require(_0x67cd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x67cd('0x8')][_0x67cd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcdc210,_0x2bb791,_0x48bdf5){return new BPromise(function(_0x509ba6,_0x55c3dc){return client[_0x67cd('0xa')](_0xcdc210,_0x48bdf5)[_0x67cd('0xb')](function(_0x4a92b3){logger[_0x67cd('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x2bb791,'request\x20sent');logger['debug'](_0x67cd('0xd'),_0x2bb791,_0x67cd('0xe'),JSON[_0x67cd('0xf')](_0x4a92b3));if(_0x4a92b3[_0x67cd('0x10')]){if(_0x4a92b3[_0x67cd('0x10')][_0x67cd('0x11')]===0x1f4){logger['error'](_0x67cd('0x12'),_0x2bb791,_0x4a92b3[_0x67cd('0x10')][_0x67cd('0x13')]);return _0x55c3dc(_0x4a92b3[_0x67cd('0x10')][_0x67cd('0x13')]);}logger[_0x67cd('0x10')](_0x67cd('0x12'),_0x2bb791,_0x4a92b3[_0x67cd('0x10')][_0x67cd('0x13')]);return _0x509ba6(_0x4a92b3[_0x67cd('0x10')][_0x67cd('0x13')]);}else{logger[_0x67cd('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x2bb791,_0x67cd('0xe'));_0x509ba6(_0x4a92b3[_0x67cd('0x14')][_0x67cd('0x13')]);}})[_0x67cd('0x15')](function(_0xe82a4f){logger['error'](_0x67cd('0x12'),_0x2bb791,_0xe82a4f);_0x55c3dc(_0xe82a4f);});});}exports['CreateFaxQueueReport']=function(_0x30cb35){var _0x4ea5d0=this;return new Promise(function(_0x5596e0,_0x4b30e7){return db[_0x67cd('0x16')][_0x67cd('0x17')](_0x30cb35[_0x67cd('0x18')],{'raw':_0x30cb35[_0x67cd('0x19')]?_0x30cb35[_0x67cd('0x19')][_0x67cd('0x1a')]===undefined?!![]:![]:!![]})[_0x67cd('0xb')](function(_0x2011e5){logger[_0x67cd('0xc')](_0x67cd('0x1b'),_0x30cb35);logger['debug'](_0x67cd('0x1b'),_0x30cb35,JSON[_0x67cd('0xf')](_0x2011e5));_0x5596e0(_0x2011e5);})[_0x67cd('0x15')](function(_0x22b153){logger['error']('CreateFaxQueueReport',_0x22b153[_0x67cd('0x13')],_0x30cb35);_0x4b30e7(_0x4ea5d0[_0x67cd('0x10')](0x1f4,_0x22b153[_0x67cd('0x13')]));});});};exports['UpdateFaxQueueReport']=function(_0x2230c1){var _0x38ddf2=this;return new Promise(function(_0x4ecad0,_0x3428aa){return db['FaxQueueReport'][_0x67cd('0x1c')](_0x2230c1[_0x67cd('0x18')],{'raw':_0x2230c1[_0x67cd('0x19')]?_0x2230c1[_0x67cd('0x19')][_0x67cd('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2230c1['options']?_0x2230c1[_0x67cd('0x19')]['where']||null:null,'attributes':_0x2230c1[_0x67cd('0x19')]?_0x2230c1[_0x67cd('0x19')][_0x67cd('0x1d')]||null:null,'limit':_0x2230c1[_0x67cd('0x19')]?_0x2230c1['options']['limit']||null:null})[_0x67cd('0xb')](function(_0x185308){logger[_0x67cd('0xc')]('UpdateFaxQueueReport',_0x2230c1);logger['debug'](_0x67cd('0x1e'),_0x2230c1,JSON[_0x67cd('0xf')](_0x185308));_0x4ecad0(_0x185308);})[_0x67cd('0x15')](function(_0x3868af){logger['error'](_0x67cd('0x1e'),_0x3868af[_0x67cd('0x13')],_0x2230c1);_0x3428aa(_0x38ddf2[_0x67cd('0x10')](0x1f4,_0x3868af['message']));});});};
\ No newline at end of file
index 2a94c59..ac8d040 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf971=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete'];(function(_0x5611d,_0x3c0409){var _0x469204=function(_0x4f3de2){while(--_0x4f3de2){_0x5611d['push'](_0x5611d['shift']());}};_0x469204(++_0x3c0409);}(_0xf971,0xd1));var _0x1f97=function(_0x72c9c0,_0x13b0cf){_0x72c9c0=_0x72c9c0-0x0;var _0x3be41e=_0xf971[_0x72c9c0];return _0x3be41e;};'use strict';var multer=require(_0x1f97('0x0'));var util=require(_0x1f97('0x1'));var path=require(_0x1f97('0x2'));var timeout=require(_0x1f97('0x3'));var express=require(_0x1f97('0x4'));var router=express[_0x1f97('0x5')]();var auth=require(_0x1f97('0x6'));var interaction=require(_0x1f97('0x7'));var config=require(_0x1f97('0x8'));var controller=require(_0x1f97('0x9'));router[_0x1f97('0xa')]('/',auth[_0x1f97('0xb')](),controller['index']);router[_0x1f97('0xa')](_0x1f97('0xc'),auth[_0x1f97('0xb')](),controller[_0x1f97('0xd')]);router[_0x1f97('0xa')](_0x1f97('0xe'),auth[_0x1f97('0xb')](),controller[_0x1f97('0xf')]);router[_0x1f97('0x10')]('/',auth[_0x1f97('0xb')](),controller[_0x1f97('0x11')]);router[_0x1f97('0x12')](_0x1f97('0xe'),auth['isAuthenticated'](),controller[_0x1f97('0x13')]);router[_0x1f97('0x14')](_0x1f97('0xe'),auth[_0x1f97('0xb')](),controller[_0x1f97('0x15')]);module[_0x1f97('0x16')]=router;
\ No newline at end of file
+var _0x481a=['delete','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update'];(function(_0x406853,_0x988d03){var _0x31f67a=function(_0x4135c7){while(--_0x4135c7){_0x406853['push'](_0x406853['shift']());}};_0x31f67a(++_0x988d03);}(_0x481a,0x17e));var _0xa481=function(_0x47b0d9,_0x41b561){_0x47b0d9=_0x47b0d9-0x0;var _0x599df3=_0x481a[_0x47b0d9];return _0x599df3;};'use strict';var multer=require(_0xa481('0x0'));var util=require('util');var path=require(_0xa481('0x1'));var timeout=require(_0xa481('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xa481('0x3'));var interaction=require(_0xa481('0x4'));var config=require(_0xa481('0x5'));var controller=require(_0xa481('0x6'));router['get']('/',auth[_0xa481('0x7')](),controller[_0xa481('0x8')]);router[_0xa481('0x9')](_0xa481('0xa'),auth[_0xa481('0x7')](),controller[_0xa481('0xb')]);router['get'](_0xa481('0xc'),auth[_0xa481('0x7')](),controller[_0xa481('0xd')]);router[_0xa481('0xe')]('/',auth[_0xa481('0x7')](),controller[_0xa481('0xf')]);router[_0xa481('0x10')](_0xa481('0xc'),auth[_0xa481('0x7')](),controller[_0xa481('0x11')]);router[_0xa481('0x12')](_0xa481('0xc'),auth[_0xa481('0x7')](),controller['destroy']);module[_0xa481('0x13')]=router;
\ No newline at end of file
index 488294e..2030ee1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3584=['queue','DATE','NOW','moment','sequelize','exports','STRING','account'];(function(_0x55aa47,_0x56dfa2){var _0x8f82b2=function(_0x46976c){while(--_0x46976c){_0x55aa47['push'](_0x55aa47['shift']());}};_0x8f82b2(++_0x56dfa2);}(_0x3584,0x14b));var _0x4358=function(_0x3ff240,_0xab8a5a){_0x3ff240=_0x3ff240-0x0;var _0x235aa8=_0x3584[_0x3ff240];return _0x235aa8;};'use strict';var moment=require(_0x4358('0x0'));var Sequelize=require(_0x4358('0x1'));module[_0x4358('0x2')]={'uniqueid':{'type':Sequelize[_0x4358('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x4358('0x4'),'agent',_0x4358('0x5')),'allowNull':![],'defaultValue':_0x4358('0x5')},'transferredAt':{'type':Sequelize[_0x4358('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x4358('0x7')]}};
\ No newline at end of file
+var _0x1f00=['queue','DATE','moment','exports','ENUM','account','agent'];(function(_0x55752a,_0x3de9f3){var _0x167948=function(_0x49463a){while(--_0x49463a){_0x55752a['push'](_0x55752a['shift']());}};_0x167948(++_0x3de9f3);}(_0x1f00,0x1de));var _0x01f0=function(_0x14a441,_0x8fcfa7){_0x14a441=_0x14a441-0x0;var _0x4a7048=_0x1f00[_0x14a441];return _0x4a7048;};'use strict';var moment=require(_0x01f0('0x0'));var Sequelize=require('sequelize');module[_0x01f0('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x01f0('0x2')](_0x01f0('0x3'),_0x01f0('0x4'),'queue'),'allowNull':![],'defaultValue':_0x01f0('0x5')},'transferredAt':{'type':Sequelize[_0x01f0('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}};
\ No newline at end of file
index 215cc77..167f7ed 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe107=['apply','reject','save','update','then','sendStatus','error','stack','name','index','FaxTransferReport','rawAttributes','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','map','key','VIRTUAL','field','count','include','findAll','rows','catch','show','params','includeAll','create','body','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','lodash','squel','crypto','jsforce','querystring','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','status','end','json','offset','limit','Content-Range'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0xe107,0xb3));var _0x7e10=function(_0x269735,_0x783cac){_0x269735=_0x269735-0x0;var _0x30f336=_0xe107[_0x269735];return _0x30f336;};'use strict';var pdf=require(_0x7e10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7e10('0x1'));var zipdir=require(_0x7e10('0x2'));var jsonpatch=require(_0x7e10('0x3'));var rp=require('request-promise');var moment=require(_0x7e10('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7e10('0x5'));var path=require(_0x7e10('0x6'));var sox=require(_0x7e10('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7e10('0x8'));var squel=require(_0x7e10('0x9'));var crypto=require(_0x7e10('0xa'));var jsforce=require(_0x7e10('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7e10('0xc'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0x7e10('0xd'));var Redis=require(_0x7e10('0xe'));var qs=require(_0x7e10('0xf'));var logger=require(_0x7e10('0x10'))(_0x7e10('0x11'));var utils=require('../../config/utils');var config=require(_0x7e10('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38e013,_0x2ca84c){_0x2ca84c=_0x2ca84c||0xcc;return function(_0x2f4d72){if(_0x2f4d72){return _0x38e013['sendStatus'](_0x2ca84c);}return _0x38e013[_0x7e10('0x13')](_0x2ca84c)[_0x7e10('0x14')]();};}function respondWithResult(_0x1e07af,_0x3ec8d9){_0x3ec8d9=_0x3ec8d9||0xc8;return function(_0x119ff5){if(_0x119ff5){return _0x1e07af[_0x7e10('0x13')](_0x3ec8d9)[_0x7e10('0x15')](_0x119ff5);}};}function respondWithFilteredResult(_0x1a8b29,_0x5e41b7){return function(_0x15e9e5){if(_0x15e9e5){var _0x433221=_0x15e9e5['count'],_0x4bd78a=_0x5e41b7[_0x7e10('0x16')],_0x48339f=_0x5e41b7[_0x7e10('0x16')]+_0x5e41b7[_0x7e10('0x17')],_0x4f5666;if(_0x48339f>=_0x433221){_0x48339f=_0x433221;_0x4f5666=0xc8;}else{_0x4f5666=0xce;}_0x1a8b29[_0x7e10('0x13')](_0x4f5666);return _0x1a8b29['set'](_0x7e10('0x18'),_0x4bd78a+'-'+_0x48339f+'/'+_0x433221)[_0x7e10('0x15')](_0x15e9e5);}return null;};}function patchUpdates(_0x2bca7b){return function(_0x5d9da3){try{jsonpatch[_0x7e10('0x19')](_0x5d9da3,_0x2bca7b,!![]);}catch(_0x36149a){return BPromise[_0x7e10('0x1a')](_0x36149a);}return _0x5d9da3[_0x7e10('0x1b')]();};}function saveUpdates(_0xd742e4,_0x580ac7){return function(_0x45a0cb){if(_0x45a0cb){return _0x45a0cb[_0x7e10('0x1c')](_0xd742e4)['then'](function(_0x3c5629){return _0x3c5629;});}return null;};}function removeEntity(_0x39daf6,_0x29405c){return function(_0x482faa){if(_0x482faa){return _0x482faa['destroy']()[_0x7e10('0x1d')](function(){_0x39daf6[_0x7e10('0x13')](0xcc)[_0x7e10('0x14')]();});}};}function handleEntityNotFound(_0x1c72df,_0x35e7c9){return function(_0x105a55){if(!_0x105a55){_0x1c72df[_0x7e10('0x1e')](0x194);}return _0x105a55;};}function handleError(_0x2c93ba,_0x5d7586){_0x5d7586=_0x5d7586||0x1f4;return function(_0x4ad422){logger[_0x7e10('0x1f')](_0x4ad422[_0x7e10('0x20')]);if(_0x4ad422[_0x7e10('0x21')]){delete _0x4ad422[_0x7e10('0x21')];}_0x2c93ba['status'](_0x5d7586)['send'](_0x4ad422);};}exports[_0x7e10('0x22')]=function(_0x12ba1b,_0x31bbf2){var _0x13c7d4={},_0x10f93d={},_0xfd3e87={'count':0x0,'rows':[]};var _0x330103=db[_0x7e10('0x23')][_0x7e10('0x24')];_0x10f93d[_0x7e10('0x25')]=_[_0x7e10('0x26')](_0x330103);_0x10f93d['query']=_[_0x7e10('0x26')](_0x12ba1b[_0x7e10('0x27')]);_0x10f93d['filters']=_['intersection'](_0x10f93d[_0x7e10('0x25')],_0x10f93d[_0x7e10('0x27')]);_0x13c7d4['attributes']=_[_0x7e10('0x28')](_0x10f93d['model'],qs[_0x7e10('0x29')](_0x12ba1b[_0x7e10('0x27')][_0x7e10('0x29')]));_0x13c7d4[_0x7e10('0x2a')]=_0x13c7d4[_0x7e10('0x2a')][_0x7e10('0x2b')]?_0x13c7d4['attributes']:_0x10f93d[_0x7e10('0x25')];if(!_0x12ba1b['query'][_0x7e10('0x2c')](_0x7e10('0x2d'))){_0x13c7d4[_0x7e10('0x17')]=qs[_0x7e10('0x17')](_0x12ba1b[_0x7e10('0x27')][_0x7e10('0x17')]);_0x13c7d4[_0x7e10('0x16')]=qs[_0x7e10('0x16')](_0x12ba1b[_0x7e10('0x27')]['offset']);}_0x13c7d4[_0x7e10('0x2e')]=qs[_0x7e10('0x2f')](_0x12ba1b[_0x7e10('0x27')][_0x7e10('0x2f')]);_0x13c7d4[_0x7e10('0x30')]=qs['filters'](_[_0x7e10('0x31')](_0x12ba1b[_0x7e10('0x27')],_0x10f93d[_0x7e10('0x32')]));if(_0x12ba1b[_0x7e10('0x27')]['filter']){_0x13c7d4['where']=_[_0x7e10('0x33')](_0x13c7d4[_0x7e10('0x30')],{'$or':_[_0x7e10('0x34')](_0x330103,function(_0x165b95){if(_0x165b95['type'][_0x7e10('0x35')]!==_0x7e10('0x36')){var _0x5b65e5={};_0x5b65e5[_0x165b95[_0x7e10('0x37')]]={'$like':'%'+_0x12ba1b[_0x7e10('0x27')]['filter']+'%'};return _0x5b65e5;}})});}_0x13c7d4=_['merge']({},_0x13c7d4,_0x12ba1b['options']);var _0x2ab00b={'where':_0x13c7d4[_0x7e10('0x30')]};return db[_0x7e10('0x23')][_0x7e10('0x38')](_0x2ab00b)[_0x7e10('0x1d')](function(_0x36e415){_0xfd3e87[_0x7e10('0x38')]=_0x36e415;if(_0x12ba1b[_0x7e10('0x27')]['includeAll']){_0x13c7d4[_0x7e10('0x39')]=[{'all':!![]}];}return db[_0x7e10('0x23')][_0x7e10('0x3a')](_0x13c7d4);})[_0x7e10('0x1d')](function(_0x4ebf4a){_0xfd3e87[_0x7e10('0x3b')]=_0x4ebf4a;return _0xfd3e87;})[_0x7e10('0x1d')](respondWithFilteredResult(_0x31bbf2,_0x13c7d4))[_0x7e10('0x3c')](handleError(_0x31bbf2,null));};exports[_0x7e10('0x3d')]=function(_0x3ad2f0,_0x4013f8){var _0x109e9f={'raw':!![],'where':{'id':_0x3ad2f0[_0x7e10('0x3e')]['id']}},_0x58d4ca={};_0x58d4ca[_0x7e10('0x25')]=_['keys'](db[_0x7e10('0x23')][_0x7e10('0x24')]);_0x58d4ca[_0x7e10('0x27')]=_['keys'](_0x3ad2f0[_0x7e10('0x27')]);_0x58d4ca[_0x7e10('0x32')]=_[_0x7e10('0x28')](_0x58d4ca[_0x7e10('0x25')],_0x58d4ca[_0x7e10('0x27')]);_0x109e9f['attributes']=_[_0x7e10('0x28')](_0x58d4ca[_0x7e10('0x25')],qs[_0x7e10('0x29')](_0x3ad2f0[_0x7e10('0x27')][_0x7e10('0x29')]));_0x109e9f['attributes']=_0x109e9f[_0x7e10('0x2a')][_0x7e10('0x2b')]?_0x109e9f['attributes']:_0x58d4ca['model'];if(_0x3ad2f0[_0x7e10('0x27')][_0x7e10('0x3f')]){_0x109e9f['include']=[{'all':!![]}];}_0x109e9f=_[_0x7e10('0x33')]({},_0x109e9f,_0x3ad2f0['options']);return db[_0x7e10('0x23')]['find'](_0x109e9f)[_0x7e10('0x1d')](handleEntityNotFound(_0x4013f8,null))[_0x7e10('0x1d')](respondWithResult(_0x4013f8,null))['catch'](handleError(_0x4013f8,null));};exports['create']=function(_0x559d60,_0x5a6181){return db['FaxTransferReport'][_0x7e10('0x40')](_0x559d60[_0x7e10('0x41')],{})[_0x7e10('0x1d')](respondWithResult(_0x5a6181,0xc9))[_0x7e10('0x3c')](handleError(_0x5a6181,null));};exports[_0x7e10('0x1c')]=function(_0x49d773,_0x7d6206){if(_0x49d773['body']['id']){delete _0x49d773[_0x7e10('0x41')]['id'];}return db[_0x7e10('0x23')][_0x7e10('0x42')]({'where':{'id':_0x49d773[_0x7e10('0x3e')]['id']}})['then'](handleEntityNotFound(_0x7d6206,null))['then'](saveUpdates(_0x49d773[_0x7e10('0x41')],null))[_0x7e10('0x1d')](respondWithResult(_0x7d6206,null))['catch'](handleError(_0x7d6206,null));};exports['destroy']=function(_0x2ceaec,_0x3f0a05){return db[_0x7e10('0x23')][_0x7e10('0x42')]({'where':{'id':_0x2ceaec[_0x7e10('0x3e')]['id']}})[_0x7e10('0x1d')](handleEntityNotFound(_0x3f0a05,null))[_0x7e10('0x1d')](removeEntity(_0x3f0a05,null))[_0x7e10('0x3c')](handleError(_0x3f0a05,null));};exports['describe']=function(_0x3a72ad,_0x517862){return db[_0x7e10('0x23')][_0x7e10('0x43')]()[_0x7e10('0x1d')](respondWithResult(_0x517862,null))['catch'](handleError(_0x517862,null));};
\ No newline at end of file
+var _0x8c32=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','FaxTransferReport','rawAttributes','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','map','type','key','VIRTUAL','field','options','count','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','describe'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x8c32,0x130));var _0x28c3=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8c32[_0x42cae2];return _0x5f256f;};'use strict';var pdf=require(_0x28c3('0x0'));var emlformat=require(_0x28c3('0x1'));var rimraf=require(_0x28c3('0x2'));var zipdir=require(_0x28c3('0x3'));var jsonpatch=require(_0x28c3('0x4'));var rp=require(_0x28c3('0x5'));var moment=require(_0x28c3('0x6'));var BPromise=require(_0x28c3('0x7'));var Mustache=require(_0x28c3('0x8'));var util=require(_0x28c3('0x9'));var path=require(_0x28c3('0xa'));var sox=require(_0x28c3('0xb'));var csv=require('to-csv');var ejs=require(_0x28c3('0xc'));var fs=require('fs');var _=require(_0x28c3('0xd'));var squel=require(_0x28c3('0xe'));var crypto=require(_0x28c3('0xf'));var jsforce=require(_0x28c3('0x10'));var deskjs=require(_0x28c3('0x11'));var toCsv=require('to-csv');var querystring=require(_0x28c3('0x12'));var Papa=require(_0x28c3('0x13'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0x28c3('0x14'));var logger=require(_0x28c3('0x15'))('api');var utils=require(_0x28c3('0x16'));var config=require(_0x28c3('0x17'));var db=require(_0x28c3('0x18'))['db'];function respondWithStatusCode(_0x49675b,_0x4e81a7){_0x4e81a7=_0x4e81a7||0xcc;return function(_0x145986){if(_0x145986){return _0x49675b[_0x28c3('0x19')](_0x4e81a7);}return _0x49675b[_0x28c3('0x1a')](_0x4e81a7)[_0x28c3('0x1b')]();};}function respondWithResult(_0x539203,_0x39f808){_0x39f808=_0x39f808||0xc8;return function(_0x4f7ec0){if(_0x4f7ec0){return _0x539203[_0x28c3('0x1a')](_0x39f808)['json'](_0x4f7ec0);}};}function respondWithFilteredResult(_0x4f3f1f,_0x555e4d){return function(_0x902890){if(_0x902890){var _0x37ffcd=_0x902890['count'],_0x53643a=_0x555e4d['offset'],_0x194c6e=_0x555e4d[_0x28c3('0x1c')]+_0x555e4d[_0x28c3('0x1d')],_0x5d3664;if(_0x194c6e>=_0x37ffcd){_0x194c6e=_0x37ffcd;_0x5d3664=0xc8;}else{_0x5d3664=0xce;}_0x4f3f1f[_0x28c3('0x1a')](_0x5d3664);return _0x4f3f1f['set'](_0x28c3('0x1e'),_0x53643a+'-'+_0x194c6e+'/'+_0x37ffcd)[_0x28c3('0x1f')](_0x902890);}return null;};}function patchUpdates(_0x391410){return function(_0x39256d){try{jsonpatch[_0x28c3('0x20')](_0x39256d,_0x391410,!![]);}catch(_0xdf3376){return BPromise[_0x28c3('0x21')](_0xdf3376);}return _0x39256d[_0x28c3('0x22')]();};}function saveUpdates(_0x3efe77,_0x1ec227){return function(_0x1c3489){if(_0x1c3489){return _0x1c3489[_0x28c3('0x23')](_0x3efe77)[_0x28c3('0x24')](function(_0xf1bc04){return _0xf1bc04;});}return null;};}function removeEntity(_0x1101e1,_0x4347d8){return function(_0x3861a6){if(_0x3861a6){return _0x3861a6[_0x28c3('0x25')]()[_0x28c3('0x24')](function(){_0x1101e1[_0x28c3('0x1a')](0xcc)[_0x28c3('0x1b')]();});}};}function handleEntityNotFound(_0x10f0ea,_0x2862d4){return function(_0x166b48){if(!_0x166b48){_0x10f0ea['sendStatus'](0x194);}return _0x166b48;};}function handleError(_0x312f25,_0x1e9f2a){_0x1e9f2a=_0x1e9f2a||0x1f4;return function(_0x178d6c){logger[_0x28c3('0x26')](_0x178d6c[_0x28c3('0x27')]);if(_0x178d6c['name']){delete _0x178d6c[_0x28c3('0x28')];}_0x312f25['status'](_0x1e9f2a)['send'](_0x178d6c);};}exports[_0x28c3('0x29')]=function(_0x5d2e9c,_0x68671c){var _0xd494f6={},_0x38312b={},_0x52f128={'count':0x0,'rows':[]};var _0x4077b0=db[_0x28c3('0x2a')][_0x28c3('0x2b')];_0x38312b[_0x28c3('0x2c')]=_['keys'](_0x4077b0);_0x38312b[_0x28c3('0x2d')]=_[_0x28c3('0x2e')](_0x5d2e9c[_0x28c3('0x2d')]);_0x38312b['filters']=_[_0x28c3('0x2f')](_0x38312b['model'],_0x38312b[_0x28c3('0x2d')]);_0xd494f6[_0x28c3('0x30')]=_[_0x28c3('0x2f')](_0x38312b[_0x28c3('0x2c')],qs['fields'](_0x5d2e9c[_0x28c3('0x2d')][_0x28c3('0x31')]));_0xd494f6['attributes']=_0xd494f6[_0x28c3('0x30')][_0x28c3('0x32')]?_0xd494f6[_0x28c3('0x30')]:_0x38312b['model'];if(!_0x5d2e9c['query']['hasOwnProperty']('nolimit')){_0xd494f6[_0x28c3('0x1d')]=qs[_0x28c3('0x1d')](_0x5d2e9c[_0x28c3('0x2d')][_0x28c3('0x1d')]);_0xd494f6[_0x28c3('0x1c')]=qs['offset'](_0x5d2e9c[_0x28c3('0x2d')][_0x28c3('0x1c')]);}_0xd494f6[_0x28c3('0x33')]=qs[_0x28c3('0x34')](_0x5d2e9c[_0x28c3('0x2d')][_0x28c3('0x34')]);_0xd494f6[_0x28c3('0x35')]=qs[_0x28c3('0x36')](_[_0x28c3('0x37')](_0x5d2e9c[_0x28c3('0x2d')],_0x38312b[_0x28c3('0x36')]));if(_0x5d2e9c['query'][_0x28c3('0x38')]){_0xd494f6[_0x28c3('0x35')]=_['merge'](_0xd494f6[_0x28c3('0x35')],{'$or':_[_0x28c3('0x39')](_0x4077b0,function(_0x1eca37){if(_0x1eca37[_0x28c3('0x3a')][_0x28c3('0x3b')]!==_0x28c3('0x3c')){var _0x2971cc={};_0x2971cc[_0x1eca37[_0x28c3('0x3d')]]={'$like':'%'+_0x5d2e9c['query'][_0x28c3('0x38')]+'%'};return _0x2971cc;}})});}_0xd494f6=_['merge']({},_0xd494f6,_0x5d2e9c[_0x28c3('0x3e')]);var _0x11de32={'where':_0xd494f6['where']};return db['FaxTransferReport']['count'](_0x11de32)['then'](function(_0x2a742e){_0x52f128[_0x28c3('0x3f')]=_0x2a742e;if(_0x5d2e9c[_0x28c3('0x2d')][_0x28c3('0x40')]){_0xd494f6[_0x28c3('0x41')]=[{'all':!![]}];}return db[_0x28c3('0x2a')][_0x28c3('0x42')](_0xd494f6);})['then'](function(_0x392a2a){_0x52f128[_0x28c3('0x43')]=_0x392a2a;return _0x52f128;})['then'](respondWithFilteredResult(_0x68671c,_0xd494f6))[_0x28c3('0x44')](handleError(_0x68671c,null));};exports[_0x28c3('0x45')]=function(_0x56d40f,_0x2fc23a){var _0x52aef8={'raw':!![],'where':{'id':_0x56d40f[_0x28c3('0x46')]['id']}},_0x56819b={};_0x56819b[_0x28c3('0x2c')]=_[_0x28c3('0x2e')](db['FaxTransferReport'][_0x28c3('0x2b')]);_0x56819b['query']=_[_0x28c3('0x2e')](_0x56d40f['query']);_0x56819b[_0x28c3('0x36')]=_[_0x28c3('0x2f')](_0x56819b[_0x28c3('0x2c')],_0x56819b['query']);_0x52aef8['attributes']=_[_0x28c3('0x2f')](_0x56819b['model'],qs[_0x28c3('0x31')](_0x56d40f[_0x28c3('0x2d')][_0x28c3('0x31')]));_0x52aef8[_0x28c3('0x30')]=_0x52aef8[_0x28c3('0x30')][_0x28c3('0x32')]?_0x52aef8[_0x28c3('0x30')]:_0x56819b['model'];if(_0x56d40f[_0x28c3('0x2d')][_0x28c3('0x40')]){_0x52aef8[_0x28c3('0x41')]=[{'all':!![]}];}_0x52aef8=_[_0x28c3('0x47')]({},_0x52aef8,_0x56d40f[_0x28c3('0x3e')]);return db[_0x28c3('0x2a')][_0x28c3('0x48')](_0x52aef8)['then'](handleEntityNotFound(_0x2fc23a,null))[_0x28c3('0x24')](respondWithResult(_0x2fc23a,null))[_0x28c3('0x44')](handleError(_0x2fc23a,null));};exports[_0x28c3('0x49')]=function(_0xd1e2ec,_0x214b7f){return db[_0x28c3('0x2a')]['create'](_0xd1e2ec[_0x28c3('0x4a')],{})[_0x28c3('0x24')](respondWithResult(_0x214b7f,0xc9))['catch'](handleError(_0x214b7f,null));};exports[_0x28c3('0x23')]=function(_0x48dd1e,_0x479bb2){if(_0x48dd1e[_0x28c3('0x4a')]['id']){delete _0x48dd1e[_0x28c3('0x4a')]['id'];}return db[_0x28c3('0x2a')][_0x28c3('0x48')]({'where':{'id':_0x48dd1e['params']['id']}})[_0x28c3('0x24')](handleEntityNotFound(_0x479bb2,null))['then'](saveUpdates(_0x48dd1e[_0x28c3('0x4a')],null))[_0x28c3('0x24')](respondWithResult(_0x479bb2,null))['catch'](handleError(_0x479bb2,null));};exports[_0x28c3('0x25')]=function(_0x50fd33,_0x1cc1d5){return db[_0x28c3('0x2a')][_0x28c3('0x48')]({'where':{'id':_0x50fd33[_0x28c3('0x46')]['id']}})[_0x28c3('0x24')](handleEntityNotFound(_0x1cc1d5,null))[_0x28c3('0x24')](removeEntity(_0x1cc1d5,null))[_0x28c3('0x44')](handleError(_0x1cc1d5,null));};exports[_0x28c3('0x4b')]=function(_0x28bbb0,_0x3c791a){return db[_0x28c3('0x2a')][_0x28c3('0x4b')]()[_0x28c3('0x24')](respondWithResult(_0x3c791a,null))['catch'](handleError(_0x3c791a,null));};
\ No newline at end of file
index 0ee986e..df90af4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc5a0=['moment','bluebird','request-promise','./faxTransferReport.attributes','exports','define','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x3d0678,_0x10e9ae){var _0x7f9a43=function(_0x85d80f){while(--_0x85d80f){_0x3d0678['push'](_0x3d0678['shift']());}};_0x7f9a43(++_0x10e9ae);}(_0xc5a0,0xf8));var _0x0c5a=function(_0xaa72b3,_0xbd6780){_0xaa72b3=_0xaa72b3-0x0;var _0x3f7bf3=_0xc5a0[_0xaa72b3];return _0x3f7bf3;};'use strict';var _=require(_0x0c5a('0x0'));var util=require(_0x0c5a('0x1'));var logger=require(_0x0c5a('0x2'))(_0x0c5a('0x3'));var moment=require(_0x0c5a('0x4'));var BPromise=require(_0x0c5a('0x5'));var rp=require(_0x0c5a('0x6'));var attributes=require(_0x0c5a('0x7'));module[_0x0c5a('0x8')]=function(_0x412c88,_0x1e6146){return _0x412c88[_0x0c5a('0x9')]('FaxTransferReport',attributes,{'tableName':_0x0c5a('0xa'),'paranoid':![],'indexes':[{'name':_0x0c5a('0xb'),'fields':['uniqueid']}],'timestamps':!![]});};
\ No newline at end of file
+var _0xa244=['../../config/logger','api','bluebird','request-promise','./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','uniqueid'];(function(_0x26d386,_0x1660c0){var _0x4ef9a8=function(_0x55e2d3){while(--_0x55e2d3){_0x26d386['push'](_0x26d386['shift']());}};_0x4ef9a8(++_0x1660c0);}(_0xa244,0x19e));var _0x4a24=function(_0x467d48,_0x2b91a1){_0x467d48=_0x467d48-0x0;var _0xded38f=_0xa244[_0x467d48];return _0xded38f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4a24('0x0'))(_0x4a24('0x1'));var moment=require('moment');var BPromise=require(_0x4a24('0x2'));var rp=require(_0x4a24('0x3'));var attributes=require(_0x4a24('0x4'));module['exports']=function(_0x4d0f18,_0x4a64a4){return _0x4d0f18[_0x4a24('0x5')](_0x4a24('0x6'),attributes,{'tableName':_0x4a24('0x7'),'paranoid':![],'indexes':[{'name':_0x4a24('0x8'),'fields':['uniqueid']}],'timestamps':!![]});};
\ No newline at end of file
index 50913dd..54620aa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa7ef=['result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x284e4a,_0x1e5013){var _0x9bf3d=function(_0x56d48a){while(--_0x56d48a){_0x284e4a['push'](_0x284e4a['shift']());}};_0x9bf3d(++_0x1e5013);}(_0xa7ef,0x1a3));var _0xfa7e=function(_0x109e42,_0x549e64){_0x109e42=_0x109e42-0x0;var _0x51cb71=_0xa7ef[_0x109e42];return _0x51cb71;};'use strict';var _=require(_0xfa7e('0x0'));var util=require(_0xfa7e('0x1'));var moment=require(_0xfa7e('0x2'));var BPromise=require(_0xfa7e('0x3'));var rs=require(_0xfa7e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfa7e('0x5'))['db'];var utils=require(_0xfa7e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xfa7e('0x7'));var jayson=require(_0xfa7e('0x8'));var client=jayson[_0xfa7e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ebe22,_0x585898,_0x2916a6){return new BPromise(function(_0x41ff8a,_0x37b93e){return client[_0xfa7e('0xa')](_0x5ebe22,_0x2916a6)[_0xfa7e('0xb')](function(_0xdb0b9){logger[_0xfa7e('0xc')](_0xfa7e('0xd'),_0x585898,_0xfa7e('0xe'));logger[_0xfa7e('0xf')](_0xfa7e('0x10'),_0x585898,_0xfa7e('0xe'),JSON[_0xfa7e('0x11')](_0xdb0b9));if(_0xdb0b9[_0xfa7e('0x12')]){if(_0xdb0b9[_0xfa7e('0x12')][_0xfa7e('0x13')]===0x1f4){logger[_0xfa7e('0x12')](_0xfa7e('0xd'),_0x585898,_0xdb0b9[_0xfa7e('0x12')][_0xfa7e('0x14')]);return _0x37b93e(_0xdb0b9[_0xfa7e('0x12')][_0xfa7e('0x14')]);}logger[_0xfa7e('0x12')](_0xfa7e('0xd'),_0x585898,_0xdb0b9[_0xfa7e('0x12')][_0xfa7e('0x14')]);return _0x41ff8a(_0xdb0b9['error'][_0xfa7e('0x14')]);}else{logger[_0xfa7e('0xc')](_0xfa7e('0xd'),_0x585898,'request\x20sent');_0x41ff8a(_0xdb0b9[_0xfa7e('0x15')][_0xfa7e('0x14')]);}})['catch'](function(_0x49528f){logger['error'](_0xfa7e('0xd'),_0x585898,_0x49528f);_0x37b93e(_0x49528f);});});}
\ No newline at end of file
+var _0x6c6b=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x49053e,_0x12c813){var _0x244bd6=function(_0xfa6a7d){while(--_0xfa6a7d){_0x49053e['push'](_0x49053e['shift']());}};_0x244bd6(++_0x12c813);}(_0x6c6b,0x1df));var _0xb6c6=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x6c6b[_0x307d86];return _0x361745;};'use strict';var _=require(_0xb6c6('0x0'));var util=require(_0xb6c6('0x1'));var moment=require('moment');var BPromise=require(_0xb6c6('0x2'));var rs=require(_0xb6c6('0x3'));var fs=require('fs');var Redis=require(_0xb6c6('0x4'));var db=require(_0xb6c6('0x5'))['db'];var utils=require(_0xb6c6('0x6'));var logger=require(_0xb6c6('0x7'))(_0xb6c6('0x8'));var config=require(_0xb6c6('0x9'));var jayson=require(_0xb6c6('0xa'));var client=jayson[_0xb6c6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d423d,_0x41deb5,_0x48d058){return new BPromise(function(_0x5c07cf,_0x207609){return client[_0xb6c6('0xc')](_0x2d423d,_0x48d058)[_0xb6c6('0xd')](function(_0x252bdb){logger[_0xb6c6('0xe')](_0xb6c6('0xf'),_0x41deb5,_0xb6c6('0x10'));logger['debug'](_0xb6c6('0x11'),_0x41deb5,'request\x20sent',JSON['stringify'](_0x252bdb));if(_0x252bdb[_0xb6c6('0x12')]){if(_0x252bdb[_0xb6c6('0x12')][_0xb6c6('0x13')]===0x1f4){logger[_0xb6c6('0x12')](_0xb6c6('0xf'),_0x41deb5,_0x252bdb['error'][_0xb6c6('0x14')]);return _0x207609(_0x252bdb['error'][_0xb6c6('0x14')]);}logger['error'](_0xb6c6('0xf'),_0x41deb5,_0x252bdb['error']['message']);return _0x5c07cf(_0x252bdb[_0xb6c6('0x12')][_0xb6c6('0x14')]);}else{logger[_0xb6c6('0xe')](_0xb6c6('0xf'),_0x41deb5,'request\x20sent');_0x5c07cf(_0x252bdb['result'][_0xb6c6('0x14')]);}})[_0xb6c6('0x15')](function(_0x4f156b){logger[_0xb6c6('0x12')](_0xb6c6('0xf'),_0x41deb5,_0x4f156b);_0x207609(_0x4f156b);});});}
\ No newline at end of file
index e19d639..0757b5b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xac31=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxTransferReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','put'];(function(_0x4dec73,_0x2f870c){var _0x493071=function(_0x1e1940){while(--_0x1e1940){_0x4dec73['push'](_0x4dec73['shift']());}};_0x493071(++_0x2f870c);}(_0xac31,0xca));var _0x1ac3=function(_0x3835fc,_0x3f1a33){_0x3835fc=_0x3835fc-0x0;var _0x48aa73=_0xac31[_0x3835fc];return _0x48aa73;};'use strict';var multer=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var path=require(_0x1ac3('0x2'));var timeout=require(_0x1ac3('0x3'));var express=require(_0x1ac3('0x4'));var router=express[_0x1ac3('0x5')]();var auth=require(_0x1ac3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1ac3('0x7'));var controller=require(_0x1ac3('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1ac3('0x9')]);router[_0x1ac3('0xa')](_0x1ac3('0xb'),auth[_0x1ac3('0xc')](),controller[_0x1ac3('0xd')]);router['get'](_0x1ac3('0xe'),auth['isAuthenticated'](),controller[_0x1ac3('0xf')]);router[_0x1ac3('0x10')]('/',auth[_0x1ac3('0xc')](),controller['create']);router[_0x1ac3('0x11')](_0x1ac3('0xe'),auth[_0x1ac3('0xc')](),controller[_0x1ac3('0x12')]);router[_0x1ac3('0x13')](_0x1ac3('0xe'),auth['isAuthenticated'](),controller[_0x1ac3('0x14')]);module[_0x1ac3('0x15')]=router;
\ No newline at end of file
+var _0x9c44=['../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','exports','path','connect-timeout','express','Router'];(function(_0x368e06,_0x895439){var _0x50d71d=function(_0x21afec){while(--_0x21afec){_0x368e06['push'](_0x368e06['shift']());}};_0x50d71d(++_0x895439);}(_0x9c44,0x178));var _0x49c4=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x9c44[_0x3d42d8];return _0x27fc41;};'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 auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./faxTransferReport.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['get'](_0x49c4('0xb'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xc')]);router[_0x49c4('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x49c4('0xe')](_0x49c4('0xb'),auth['isAuthenticated'](),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);module[_0x49c4('0x12')]=router;
\ No newline at end of file
index 294f79f..f893769 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd144=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','get','show','getConfigurations','getFields','post','/:id/configurations','addConfiguration','put','/:id','update','delete','destroy'];(function(_0x5a6a1c,_0xb802eb){var _0x132a0e=function(_0x4c3280){while(--_0x4c3280){_0x5a6a1c['push'](_0x5a6a1c['shift']());}};_0x132a0e(++_0xb802eb);}(_0xd144,0xb9));var _0x4d14=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd144[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4d14('0x0'));var util=require(_0x4d14('0x1'));var path=require(_0x4d14('0x2'));var timeout=require('connect-timeout');var express=require(_0x4d14('0x3'));var router=express[_0x4d14('0x4')]();var auth=require(_0x4d14('0x5'));var interaction=require(_0x4d14('0x6'));var config=require(_0x4d14('0x7'));var controller=require(_0x4d14('0x8'));router['get']('/',auth[_0x4d14('0x9')](),controller['index']);router[_0x4d14('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4d14('0xb')]);router[_0x4d14('0xa')]('/:id/configurations',auth[_0x4d14('0x9')](),controller[_0x4d14('0xc')]);router[_0x4d14('0xa')]('/:id/fields',auth[_0x4d14('0x9')](),controller[_0x4d14('0xd')]);router[_0x4d14('0xe')]('/',auth[_0x4d14('0x9')](),controller['create']);router[_0x4d14('0xe')](_0x4d14('0xf'),auth[_0x4d14('0x9')](),controller[_0x4d14('0x10')]);router[_0x4d14('0x11')](_0x4d14('0x12'),auth['isAuthenticated'](),controller[_0x4d14('0x13')]);router[_0x4d14('0x14')](_0x4d14('0x12'),auth[_0x4d14('0x9')](),controller[_0x4d14('0x15')]);module[_0x4d14('0x16')]=router;
\ No newline at end of file
+var _0x325c=['show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index'];(function(_0x50fb86,_0x34b24d){var _0x27346c=function(_0x79943f){while(--_0x79943f){_0x50fb86['push'](_0x50fb86['shift']());}};_0x27346c(++_0x34b24d);}(_0x325c,0x16d));var _0xc325=function(_0x15f883,_0x13338f){_0x15f883=_0x15f883-0x0;var _0x287cac=_0x325c[_0x15f883];return _0x287cac;};'use strict';var multer=require(_0xc325('0x0'));var util=require(_0xc325('0x1'));var path=require(_0xc325('0x2'));var timeout=require(_0xc325('0x3'));var express=require(_0xc325('0x4'));var router=express[_0xc325('0x5')]();var auth=require(_0xc325('0x6'));var interaction=require(_0xc325('0x7'));var config=require(_0xc325('0x8'));var controller=require(_0xc325('0x9'));router[_0xc325('0xa')]('/',auth[_0xc325('0xb')](),controller[_0xc325('0xc')]);router['get']('/:id',auth[_0xc325('0xb')](),controller[_0xc325('0xd')]);router[_0xc325('0xa')](_0xc325('0xe'),auth['isAuthenticated'](),controller[_0xc325('0xf')]);router['get'](_0xc325('0x10'),auth[_0xc325('0xb')](),controller[_0xc325('0x11')]);router['post']('/',auth[_0xc325('0xb')](),controller[_0xc325('0x12')]);router[_0xc325('0x13')](_0xc325('0xe'),auth[_0xc325('0xb')](),controller[_0xc325('0x14')]);router[_0xc325('0x15')](_0xc325('0x16'),auth[_0xc325('0xb')](),controller[_0xc325('0x17')]);router[_0xc325('0x18')](_0xc325('0x16'),auth['isAuthenticated'](),controller[_0xc325('0x19')]);module[_0xc325('0x1a')]=router;
\ No newline at end of file
index 1b2557f..0adc187 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7c9b=['newTab','integrationTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x5c0b8b,_0x23d1e4){var _0x5cde35=function(_0x35e32d){while(--_0x35e32d){_0x5c0b8b['push'](_0x5c0b8b['shift']());}};_0x5cde35(++_0x23d1e4);}(_0x7c9b,0x191));var _0xb7c9=function(_0x31d0a5,_0x316250){_0x31d0a5=_0x31d0a5-0x0;var _0x3f672a=_0x7c9b[_0x31d0a5];return _0x3f672a;};'use strict';var Sequelize=require(_0xb7c9('0x0'));module[_0xb7c9('0x1')]={'name':{'type':Sequelize[_0xb7c9('0x2')]},'description':{'type':Sequelize[_0xb7c9('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xb7c9('0x2')]},'authType':{'type':Sequelize[_0xb7c9('0x3')](_0xb7c9('0x4')),'defaultValue':_0xb7c9('0x4')},'password':{'type':Sequelize[_0xb7c9('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xb7c9('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb7c9('0x3')]('integrationTab',_0xb7c9('0x5')),'defaultValue':_0xb7c9('0x6')}};
\ No newline at end of file
+var _0x744e=['integrationTab','newTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x2bd549,_0x5e8c84){var _0x7dc68=function(_0x4fa221){while(--_0x4fa221){_0x2bd549['push'](_0x2bd549['shift']());}};_0x7dc68(++_0x5e8c84);}(_0x744e,0x128));var _0xe744=function(_0x530645,_0x15bfcb){_0x530645=_0x530645-0x0;var _0x3d5a72=_0x744e[_0x530645];return _0x3d5a72;};'use strict';var Sequelize=require(_0xe744('0x0'));module[_0xe744('0x1')]={'name':{'type':Sequelize[_0xe744('0x2')]},'description':{'type':Sequelize[_0xe744('0x2')]},'username':{'type':Sequelize[_0xe744('0x2')]},'remoteUri':{'type':Sequelize[_0xe744('0x2')]},'authType':{'type':Sequelize[_0xe744('0x3')]('basic'),'defaultValue':_0xe744('0x4')},'password':{'type':Sequelize[_0xe744('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xe744('0x2')]},'token':{'type':Sequelize[_0xe744('0x2')]},'tokenSecret':{'type':Sequelize[_0xe744('0x2')]},'serverUrl':{'type':Sequelize[_0xe744('0x2')]},'type':{'type':Sequelize[_0xe744('0x3')](_0xe744('0x5'),_0xe744('0x6')),'defaultValue':'integrationTab'}};
\ No newline at end of file
index 53cb4dd..6a8523e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe14b=['getFields','priority','remoteUri','username','password','consumerKey','consumerSecret','tokenSecret','GET','format','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','map','_embedded','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','field','options','count','include','DeskAccount','findAll','show','params','rawAttributes','length','includeAll','find','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','channel','type','Descriptions','getDescriptions','DeskConfiguration','create','DeskField'];(function(_0x50cb0f,_0x173193){var _0x95f525=function(_0x47b5d1){while(--_0x47b5d1){_0x50cb0f['push'](_0x50cb0f['shift']());}};_0x95f525(++_0x173193);}(_0xe14b,0x93));var _0xbe14=function(_0x46e2b3,_0x31b4dd){_0x46e2b3=_0x46e2b3-0x0;var _0x1b76b2=_0xe14b[_0x46e2b3];return _0x1b76b2;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var authService=require(_0xbe14('0xe'));var hardwareService=require(_0xbe14('0xf'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xbe14('0x10'))(_0xbe14('0x11'));var utils=require('../../config/utils');var config=require(_0xbe14('0x12'));var db=require(_0xbe14('0x13'))['db'];var integrations=require(_0xbe14('0x14'));var jayson=require(_0xbe14('0x15'));var client=jayson[_0xbe14('0x16')][_0xbe14('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x23a730,_0x2850cb,_0x16893f,_0xa2cf72){return new BPromise(function(_0x1e4826,_0x33fd54){var _0x813399=_0xa2cf72||client;return _0x813399['request'](_0x23a730,_0x16893f)['then'](function(_0x3f58f5){logger[_0xbe14('0x18')](_0xbe14('0x19'),_0x2850cb,_0xbe14('0x1a'));logger['debug'](_0xbe14('0x1b'),_0x2850cb,_0xbe14('0x1a'),JSON[_0xbe14('0x1c')](_0x3f58f5));if(_0x3f58f5[_0xbe14('0x1d')]){if(_0x3f58f5[_0xbe14('0x1d')][_0xbe14('0x1e')]===0x1f4){logger[_0xbe14('0x1d')]('DeskAccount,\x20%s,\x20%s',_0x2850cb,_0x3f58f5[_0xbe14('0x1d')][_0xbe14('0x1f')]);return _0x33fd54(_0x3f58f5[_0xbe14('0x1d')][_0xbe14('0x1f')]);}logger[_0xbe14('0x1d')](_0xbe14('0x19'),_0x2850cb,_0x3f58f5['error'][_0xbe14('0x1f')]);return _0x1e4826(_0x3f58f5[_0xbe14('0x1d')][_0xbe14('0x1f')]);}else{logger[_0xbe14('0x18')](_0xbe14('0x19'),_0x2850cb,'request\x20sent');_0x1e4826(_0x3f58f5[_0xbe14('0x20')]['message']);}})[_0xbe14('0x21')](function(_0x56e80c){logger[_0xbe14('0x1d')]('DeskAccount,\x20%s,\x20%s',_0x2850cb,_0x56e80c);_0x33fd54(_0x56e80c);});});}function respondWithStatusCode(_0x274018,_0x3d3608){_0x3d3608=_0x3d3608||0xcc;return function(_0x505dbd){if(_0x505dbd){return _0x274018[_0xbe14('0x22')](_0x3d3608);}return _0x274018['status'](_0x3d3608)[_0xbe14('0x23')]();};}function respondWithResult(_0x4851f8,_0x36a21e){_0x36a21e=_0x36a21e||0xc8;return function(_0x5fa043){if(_0x5fa043){return _0x4851f8[_0xbe14('0x24')](_0x36a21e)[_0xbe14('0x25')](_0x5fa043);}};}function respondWithFilteredResult(_0x15ef02,_0x2703f5){return function(_0x55d001){if(_0x55d001){var _0x1822e0=_0x55d001['count'],_0x1ba46a=_0x2703f5[_0xbe14('0x26')],_0x391556=_0x2703f5[_0xbe14('0x26')]+_0x2703f5['limit'],_0x169369;if(_0x391556>=_0x1822e0){_0x391556=_0x1822e0;_0x169369=0xc8;}else{_0x169369=0xce;}_0x15ef02[_0xbe14('0x24')](_0x169369);return _0x15ef02[_0xbe14('0x27')](_0xbe14('0x28'),_0x1ba46a+'-'+_0x391556+'/'+_0x1822e0)[_0xbe14('0x25')](_0x55d001);}return null;};}function patchUpdates(_0x34d648){return function(_0x36d4b2){try{jsonpatch[_0xbe14('0x29')](_0x36d4b2,_0x34d648,!![]);}catch(_0x2b05cb){return BPromise[_0xbe14('0x2a')](_0x2b05cb);}return _0x36d4b2[_0xbe14('0x2b')]();};}function saveUpdates(_0x40538f,_0x3bf43c){return function(_0x39dc0a){if(_0x39dc0a){return _0x39dc0a[_0xbe14('0x2c')](_0x40538f)[_0xbe14('0x2d')](function(_0xe6feb2){return _0xe6feb2;});}return null;};}function removeEntity(_0x6ba36c,_0x2ff48e){return function(_0x29e76a){if(_0x29e76a){return _0x29e76a[_0xbe14('0x2e')]()['then'](function(){_0x6ba36c[_0xbe14('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58f8de,_0x46c2d1){return function(_0x4c1e7e){if(!_0x4c1e7e){_0x58f8de[_0xbe14('0x22')](0x194);}return _0x4c1e7e;};}function handleError(_0x345b0,_0x52a25c){_0x52a25c=_0x52a25c||0x1f4;return function(_0x50cb09){logger['error'](_0x50cb09[_0xbe14('0x2f')]);if(_0x50cb09[_0xbe14('0x30')]){delete _0x50cb09['name'];}_0x345b0[_0xbe14('0x24')](_0x52a25c)[_0xbe14('0x31')](_0x50cb09);};}exports[_0xbe14('0x32')]=function(_0x1aa849,_0x29c23e){var _0x5ef1e5={},_0x591a36={},_0x15a997={'count':0x0,'rows':[]};var _0x52b24c=db['DeskAccount']['rawAttributes'];_0x591a36[_0xbe14('0x33')]=_[_0xbe14('0x34')](_0x52b24c);_0x591a36[_0xbe14('0x35')]=_[_0xbe14('0x34')](_0x1aa849[_0xbe14('0x35')]);_0x591a36[_0xbe14('0x36')]=_[_0xbe14('0x37')](_0x591a36[_0xbe14('0x33')],_0x591a36[_0xbe14('0x35')]);_0x5ef1e5[_0xbe14('0x38')]=_[_0xbe14('0x37')](_0x591a36[_0xbe14('0x33')],qs['fields'](_0x1aa849['query'][_0xbe14('0x39')]));_0x5ef1e5[_0xbe14('0x38')]=_0x5ef1e5[_0xbe14('0x38')]['length']?_0x5ef1e5[_0xbe14('0x38')]:_0x591a36[_0xbe14('0x33')];if(!_0x1aa849[_0xbe14('0x35')][_0xbe14('0x3a')](_0xbe14('0x3b'))){_0x5ef1e5[_0xbe14('0x3c')]=qs[_0xbe14('0x3c')](_0x1aa849[_0xbe14('0x35')][_0xbe14('0x3c')]);_0x5ef1e5['offset']=qs[_0xbe14('0x26')](_0x1aa849[_0xbe14('0x35')][_0xbe14('0x26')]);}_0x5ef1e5[_0xbe14('0x3d')]=qs[_0xbe14('0x3e')](_0x1aa849[_0xbe14('0x35')]['sort']);_0x5ef1e5[_0xbe14('0x3f')]=qs[_0xbe14('0x36')](_[_0xbe14('0x40')](_0x1aa849[_0xbe14('0x35')],_0x591a36['filters']));if(_0x1aa849['query'][_0xbe14('0x41')]){_0x5ef1e5[_0xbe14('0x3f')]=_[_0xbe14('0x42')](_0x5ef1e5['where'],{'$or':_['map'](_0x52b24c,function(_0x6b6aa8){if(_0x6b6aa8['type']['key']!==_0xbe14('0x43')){var _0x1f0355={};_0x1f0355[_0x6b6aa8[_0xbe14('0x44')]]={'$like':'%'+_0x1aa849['query']['filter']+'%'};return _0x1f0355;}})});}_0x5ef1e5=_['merge']({},_0x5ef1e5,_0x1aa849[_0xbe14('0x45')]);var _0x1eccf7={'where':_0x5ef1e5[_0xbe14('0x3f')]};return db['DeskAccount'][_0xbe14('0x46')](_0x1eccf7)[_0xbe14('0x2d')](function(_0x32f22e){_0x15a997[_0xbe14('0x46')]=_0x32f22e;if(_0x1aa849['query']['includeAll']){_0x5ef1e5[_0xbe14('0x47')]=[{'all':!![]}];}return db[_0xbe14('0x48')][_0xbe14('0x49')](_0x5ef1e5);})[_0xbe14('0x2d')](function(_0x2550dc){_0x15a997['rows']=_0x2550dc;return _0x15a997;})['then'](respondWithFilteredResult(_0x29c23e,_0x5ef1e5))[_0xbe14('0x21')](handleError(_0x29c23e,null));};exports[_0xbe14('0x4a')]=function(_0x238c60,_0x2a3b35){var _0x4e65d2={'raw':![],'where':{'id':_0x238c60[_0xbe14('0x4b')]['id']}},_0x28b6e3={};_0x28b6e3['model']=_[_0xbe14('0x34')](db[_0xbe14('0x48')][_0xbe14('0x4c')]);_0x28b6e3[_0xbe14('0x35')]=_['keys'](_0x238c60['query']);_0x28b6e3[_0xbe14('0x36')]=_[_0xbe14('0x37')](_0x28b6e3['model'],_0x28b6e3['query']);_0x4e65d2[_0xbe14('0x38')]=_[_0xbe14('0x37')](_0x28b6e3[_0xbe14('0x33')],qs[_0xbe14('0x39')](_0x238c60[_0xbe14('0x35')][_0xbe14('0x39')]));_0x4e65d2[_0xbe14('0x38')]=_0x4e65d2['attributes'][_0xbe14('0x4d')]?_0x4e65d2[_0xbe14('0x38')]:_0x28b6e3[_0xbe14('0x33')];if(_0x238c60[_0xbe14('0x35')][_0xbe14('0x4e')]){_0x4e65d2['include']=[{'all':!![]}];}_0x4e65d2=_[_0xbe14('0x42')]({},_0x4e65d2,_0x238c60[_0xbe14('0x45')]);return db[_0xbe14('0x48')][_0xbe14('0x4f')](_0x4e65d2)[_0xbe14('0x2d')](handleEntityNotFound(_0x2a3b35,null))[_0xbe14('0x2d')](respondWithResult(_0x2a3b35,null))['catch'](handleError(_0x2a3b35,null));};exports['create']=function(_0x3a49f7,_0x2bde72){return db[_0xbe14('0x48')]['create'](_0x3a49f7['body'],{})[_0xbe14('0x2d')](respondWithResult(_0x2bde72,0xc9))[_0xbe14('0x21')](handleError(_0x2bde72,null));};exports['update']=function(_0x339a86,_0x32496a){if(_0x339a86['body']['id']){delete _0x339a86[_0xbe14('0x50')]['id'];}return db['DeskAccount'][_0xbe14('0x4f')]({'where':{'id':_0x339a86[_0xbe14('0x4b')]['id']}})[_0xbe14('0x2d')](handleEntityNotFound(_0x32496a,null))['then'](saveUpdates(_0x339a86[_0xbe14('0x50')],null))[_0xbe14('0x2d')](respondWithResult(_0x32496a,null))['catch'](handleError(_0x32496a,null));};exports[_0xbe14('0x2e')]=function(_0x42ca15,_0x2210cc){return db[_0xbe14('0x48')][_0xbe14('0x4f')]({'where':{'id':_0x42ca15['params']['id']}})[_0xbe14('0x2d')](handleEntityNotFound(_0x2210cc,null))[_0xbe14('0x2d')](removeEntity(_0x2210cc,null))[_0xbe14('0x21')](handleError(_0x2210cc,null));};exports[_0xbe14('0x51')]=function(_0x32968f,_0x44084c,_0x1dd6c7){var _0x56ab61={};var _0x72c875={};var _0x1b47a4;var _0x941ee2;return db[_0xbe14('0x48')][_0xbe14('0x52')]({'where':{'id':_0x32968f[_0xbe14('0x4b')]['id']}})[_0xbe14('0x2d')](handleEntityNotFound(_0x44084c,null))[_0xbe14('0x2d')](function(_0x285b6e){if(_0x285b6e){_0x1b47a4=_0x285b6e;_0x72c875[_0xbe14('0x33')]=_[_0xbe14('0x34')](db['DeskConfiguration']['rawAttributes']);_0x72c875['query']=_[_0xbe14('0x34')](_0x32968f[_0xbe14('0x35')]);_0x72c875[_0xbe14('0x36')]=_[_0xbe14('0x37')](_0x72c875[_0xbe14('0x33')],_0x72c875[_0xbe14('0x35')]);_0x56ab61[_0xbe14('0x38')]=_[_0xbe14('0x37')](_0x72c875[_0xbe14('0x33')],qs[_0xbe14('0x39')](_0x32968f[_0xbe14('0x35')][_0xbe14('0x39')]));_0x56ab61[_0xbe14('0x38')]=_0x56ab61[_0xbe14('0x38')][_0xbe14('0x4d')]?_0x56ab61[_0xbe14('0x38')]:_0x72c875[_0xbe14('0x33')];_0x56ab61[_0xbe14('0x3d')]=qs[_0xbe14('0x3e')](_0x32968f[_0xbe14('0x35')]['sort']);_0x56ab61[_0xbe14('0x3f')]=qs[_0xbe14('0x36')](_[_0xbe14('0x40')](_0x32968f[_0xbe14('0x35')],_0x72c875[_0xbe14('0x36')]));if(_0x32968f[_0xbe14('0x35')][_0xbe14('0x41')]){_0x56ab61[_0xbe14('0x3f')]=_[_0xbe14('0x42')](_0x56ab61[_0xbe14('0x3f')],{'$or':_['map'](_0x56ab61[_0xbe14('0x38')],function(_0x442ec4){var _0x2d4dd4={};_0x2d4dd4[_0x442ec4]={'$like':'%'+_0x32968f[_0xbe14('0x35')][_0xbe14('0x41')]+'%'};return _0x2d4dd4;})});}_0x56ab61=_['merge']({},_0x56ab61,_0x32968f[_0xbe14('0x45')]);return _0x1b47a4[_0xbe14('0x51')](_0x56ab61);}})[_0xbe14('0x2d')](function(_0xd4e1c7){if(_0xd4e1c7){_0x941ee2=_0xd4e1c7[_0xbe14('0x4d')];if(!_0x32968f['query'][_0xbe14('0x3a')](_0xbe14('0x3b'))){_0x56ab61[_0xbe14('0x3c')]=qs[_0xbe14('0x3c')](_0x32968f[_0xbe14('0x35')][_0xbe14('0x3c')]);_0x56ab61[_0xbe14('0x26')]=qs[_0xbe14('0x26')](_0x32968f['query'][_0xbe14('0x26')]);}return _0x1b47a4[_0xbe14('0x51')](_0x56ab61);}})[_0xbe14('0x2d')](function(_0x20b12e){if(_0x20b12e){return _0x20b12e?{'count':_0x941ee2,'rows':_0x20b12e}:null;}})[_0xbe14('0x2d')](respondWithResult(_0x44084c,null))[_0xbe14('0x21')](handleError(_0x44084c,null));};exports[_0xbe14('0x53')]=function(_0x566096,_0x4eedd2,_0x12941d){if(_0x566096[_0xbe14('0x50')]['id']){delete _0x566096[_0xbe14('0x50')]['id'];}return db[_0xbe14('0x48')][_0xbe14('0x52')]({'where':{'id':_0x566096[_0xbe14('0x4b')]['id']}})[_0xbe14('0x2d')](handleEntityNotFound(_0x4eedd2,null))[_0xbe14('0x2d')](function(_0x50e644){if(_0x50e644){_0x566096['body'][_0xbe14('0x54')]=_0x50e644['id'];_0x566096[_0xbe14('0x50')][_0xbe14('0x55')]=integrations['getSubjects'](_0x566096[_0xbe14('0x50')][_0xbe14('0x56')],_0x566096[_0xbe14('0x50')][_0xbe14('0x57')]);_0x566096[_0xbe14('0x50')][_0xbe14('0x58')]=integrations[_0xbe14('0x59')](_0x566096['body'][_0xbe14('0x56')],_0x566096[_0xbe14('0x50')][_0xbe14('0x57')]);return db[_0xbe14('0x5a')][_0xbe14('0x5b')](_0x566096[_0xbe14('0x50')],{'include':[{'model':db[_0xbe14('0x5c')],'as':'Subjects'},{'model':db[_0xbe14('0x5c')],'as':_0xbe14('0x58')}]});}return null;})[_0xbe14('0x2d')](respondWithResult(_0x4eedd2,null))[_0xbe14('0x21')](handleError(_0x4eedd2,null));};exports[_0xbe14('0x5d')]=function(_0x2eb057,_0x350ff6,_0xd756b2){var _0x5d064e=[{'name':_0xbe14('0x5e'),'label':_0xbe14('0x5e'),'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}]}];return db[_0xbe14('0x48')][_0xbe14('0x52')]({'where':{'id':_0x2eb057[_0xbe14('0x4b')]['id']},'attributes':['id',_0xbe14('0x5f'),'authType',_0xbe14('0x60'),_0xbe14('0x61'),_0xbe14('0x62'),_0xbe14('0x63'),'token',_0xbe14('0x64')]})[_0xbe14('0x2d')](handleEntityNotFound(_0x350ff6,null))[_0xbe14('0x2d')](function(_0x1e7770){if(_0x1e7770){var _0x80b6ec={'method':_0xbe14('0x65'),'uri':util[_0xbe14('0x66')]('%s/custom_fields',_0x1e7770[_0xbe14('0x5f')]),'headers':{'Content-Type':'application/json','Accept':_0xbe14('0x67')},'json':!![]};if(_0x1e7770['authType']===_0xbe14('0x68')){_0x80b6ec[_0xbe14('0x69')][_0xbe14('0x6a')]=util['format'](_0xbe14('0x6b'),new Buffer(util[_0xbe14('0x66')](_0xbe14('0x6c'),_0x1e7770['username'],_0x1e7770[_0xbe14('0x61')]))[_0xbe14('0x6d')](_0xbe14('0x6e')));}return rp(_0x80b6ec)[_0xbe14('0x2d')](function(_0x568177){return _0x5d064e[_0xbe14('0x6f')](_[_0xbe14('0x70')](_0x568177[_0xbe14('0x71')][_0xbe14('0x72')],function(_0x1dd5c0){return{'id':_0x1dd5c0[_0xbe14('0x30')],'name':_0x1dd5c0[_0xbe14('0x30')],'type':_0x1dd5c0['type'],'active':_0x1dd5c0[_0xbe14('0x73')],'label':_0x1dd5c0[_0xbe14('0x74')],'custom':!![]};}));});}})[_0xbe14('0x2d')](function(_0x5c89a0){return{'count':_0x5c89a0[_0xbe14('0x4d')],'rows':_0x5c89a0};})[_0xbe14('0x2d')](respondWithResult(_0x350ff6,null))[_0xbe14('0x21')](function(_0x5bc52b){var _0xa53262=_0x2eb057[_0xbe14('0x35')]['test']?0x1f4:_0x5bc52b[_0xbe14('0x75')]||0x1f4;logger['error'](_0xbe14('0x76'),_0xbe14('0x5d'),_0xa53262,JSON['stringify'](_0x5bc52b));delete _0x5bc52b['name'];if(_0xa53262===0x191){_0xa53262=0x190;}_0x350ff6[_0xbe14('0x24')](_0xa53262)[_0xbe14('0x31')](_0x2eb057[_0xbe14('0x35')]['test']?{'message':_0xbe14('0x77'),'statusCode':_0x5bc52b[_0xbe14('0x75')]}:_0x5bc52b);});};
\ No newline at end of file
+var _0x0972=['../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','debug','request\x20sent','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','status','count','offset','limit','set','Content-Range','reject','update','end','sendStatus','stack','name','send','index','DeskAccount','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','type','key','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','findOne','order','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskConfiguration','DeskField','priority','remoteUri','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','%s/custom_fields','authType','basic','headers','format','Basic\x20%s','%s:%s','base64','concat','_embedded','entries','active','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0972,0x64));var _0x2097=function(_0x5b85dc,_0x3b1b23){_0x5b85dc=_0x5b85dc-0x0;var _0x2f992a=_0x0972[_0x5b85dc];return _0x2f992a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2097('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2097('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2097('0x2'));var moment=require(_0x2097('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2097('0x4'));var util=require(_0x2097('0x5'));var path=require(_0x2097('0x6'));var sox=require(_0x2097('0x7'));var csv=require(_0x2097('0x8'));var ejs=require(_0x2097('0x9'));var fs=require('fs');var _=require(_0x2097('0xa'));var squel=require('squel');var crypto=require(_0x2097('0xb'));var jsforce=require(_0x2097('0xc'));var deskjs=require(_0x2097('0xd'));var toCsv=require(_0x2097('0x8'));var querystring=require(_0x2097('0xe'));var Papa=require('papaparse');var authService=require(_0x2097('0xf'));var hardwareService=require(_0x2097('0x10'));var Redis=require(_0x2097('0x11'));var qs=require(_0x2097('0x12'));var logger=require(_0x2097('0x13'))(_0x2097('0x14'));var utils=require(_0x2097('0x15'));var config=require(_0x2097('0x16'));var db=require(_0x2097('0x17'))['db'];var integrations=require(_0x2097('0x18'));var jayson=require(_0x2097('0x19'));var client=jayson[_0x2097('0x1a')][_0x2097('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x16871b,_0x24ca42,_0x3e3fdc,_0x185be8){return new BPromise(function(_0x1c9ef9,_0x2c3e41){var _0x354387=_0x185be8||client;return _0x354387['request'](_0x16871b,_0x3e3fdc)[_0x2097('0x1c')](function(_0x35c062){logger['info']('DeskAccount,\x20%s,\x20%s',_0x24ca42,'request\x20sent');logger[_0x2097('0x1d')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x24ca42,_0x2097('0x1e'),JSON[_0x2097('0x1f')](_0x35c062));if(_0x35c062[_0x2097('0x20')]){if(_0x35c062[_0x2097('0x20')][_0x2097('0x21')]===0x1f4){logger['error'](_0x2097('0x22'),_0x24ca42,_0x35c062[_0x2097('0x20')][_0x2097('0x23')]);return _0x2c3e41(_0x35c062[_0x2097('0x20')][_0x2097('0x23')]);}logger[_0x2097('0x20')](_0x2097('0x22'),_0x24ca42,_0x35c062[_0x2097('0x20')]['message']);return _0x1c9ef9(_0x35c062['error'][_0x2097('0x23')]);}else{logger['info'](_0x2097('0x22'),_0x24ca42,_0x2097('0x1e'));_0x1c9ef9(_0x35c062['result'][_0x2097('0x23')]);}})['catch'](function(_0x2e17c8){logger[_0x2097('0x20')](_0x2097('0x22'),_0x24ca42,_0x2e17c8);_0x2c3e41(_0x2e17c8);});});}function respondWithStatusCode(_0x20b93a,_0x36b15e){_0x36b15e=_0x36b15e||0xcc;return function(_0x35047b){if(_0x35047b){return _0x20b93a['sendStatus'](_0x36b15e);}return _0x20b93a[_0x2097('0x24')](_0x36b15e)['end']();};}function respondWithResult(_0x3f9279,_0x32405b){_0x32405b=_0x32405b||0xc8;return function(_0x345875){if(_0x345875){return _0x3f9279[_0x2097('0x24')](_0x32405b)['json'](_0x345875);}};}function respondWithFilteredResult(_0x2d683a,_0x80c5ee){return function(_0x56af3b){if(_0x56af3b){var _0x1229fc=_0x56af3b[_0x2097('0x25')],_0x5ed0fa=_0x80c5ee[_0x2097('0x26')],_0x29b879=_0x80c5ee[_0x2097('0x26')]+_0x80c5ee[_0x2097('0x27')],_0x48ae06;if(_0x29b879>=_0x1229fc){_0x29b879=_0x1229fc;_0x48ae06=0xc8;}else{_0x48ae06=0xce;}_0x2d683a[_0x2097('0x24')](_0x48ae06);return _0x2d683a[_0x2097('0x28')](_0x2097('0x29'),_0x5ed0fa+'-'+_0x29b879+'/'+_0x1229fc)['json'](_0x56af3b);}return null;};}function patchUpdates(_0x11242f){return function(_0x14d964){try{jsonpatch['apply'](_0x14d964,_0x11242f,!![]);}catch(_0x1398d0){return BPromise[_0x2097('0x2a')](_0x1398d0);}return _0x14d964['save']();};}function saveUpdates(_0x4d0916,_0x312c77){return function(_0x11b051){if(_0x11b051){return _0x11b051[_0x2097('0x2b')](_0x4d0916)[_0x2097('0x1c')](function(_0x74ccdc){return _0x74ccdc;});}return null;};}function removeEntity(_0x180654,_0x56c538){return function(_0xe1a381){if(_0xe1a381){return _0xe1a381['destroy']()[_0x2097('0x1c')](function(){_0x180654[_0x2097('0x24')](0xcc)[_0x2097('0x2c')]();});}};}function handleEntityNotFound(_0x1e8af9,_0x44e398){return function(_0x395d9f){if(!_0x395d9f){_0x1e8af9[_0x2097('0x2d')](0x194);}return _0x395d9f;};}function handleError(_0x455cf7,_0x2701bc){_0x2701bc=_0x2701bc||0x1f4;return function(_0x5c89ab){logger[_0x2097('0x20')](_0x5c89ab[_0x2097('0x2e')]);if(_0x5c89ab[_0x2097('0x2f')]){delete _0x5c89ab['name'];}_0x455cf7[_0x2097('0x24')](_0x2701bc)[_0x2097('0x30')](_0x5c89ab);};}exports[_0x2097('0x31')]=function(_0x396162,_0x542a52){var _0x50b101={},_0x5689f6={},_0x3484ff={'count':0x0,'rows':[]};var _0x8f464d=db[_0x2097('0x32')][_0x2097('0x33')];_0x5689f6[_0x2097('0x34')]=_[_0x2097('0x35')](_0x8f464d);_0x5689f6['query']=_[_0x2097('0x35')](_0x396162[_0x2097('0x36')]);_0x5689f6[_0x2097('0x37')]=_[_0x2097('0x38')](_0x5689f6[_0x2097('0x34')],_0x5689f6[_0x2097('0x36')]);_0x50b101['attributes']=_[_0x2097('0x38')](_0x5689f6[_0x2097('0x34')],qs[_0x2097('0x39')](_0x396162['query']['fields']));_0x50b101[_0x2097('0x3a')]=_0x50b101[_0x2097('0x3a')][_0x2097('0x3b')]?_0x50b101[_0x2097('0x3a')]:_0x5689f6[_0x2097('0x34')];if(!_0x396162[_0x2097('0x36')][_0x2097('0x3c')](_0x2097('0x3d'))){_0x50b101[_0x2097('0x27')]=qs[_0x2097('0x27')](_0x396162[_0x2097('0x36')][_0x2097('0x27')]);_0x50b101['offset']=qs[_0x2097('0x26')](_0x396162[_0x2097('0x36')][_0x2097('0x26')]);}_0x50b101['order']=qs[_0x2097('0x3e')](_0x396162[_0x2097('0x36')][_0x2097('0x3e')]);_0x50b101[_0x2097('0x3f')]=qs[_0x2097('0x37')](_[_0x2097('0x40')](_0x396162[_0x2097('0x36')],_0x5689f6[_0x2097('0x37')]));if(_0x396162['query'][_0x2097('0x41')]){_0x50b101[_0x2097('0x3f')]=_[_0x2097('0x42')](_0x50b101[_0x2097('0x3f')],{'$or':_[_0x2097('0x43')](_0x8f464d,function(_0xe3ac1b){if(_0xe3ac1b[_0x2097('0x44')][_0x2097('0x45')]!=='VIRTUAL'){var _0x3fc3fe={};_0x3fc3fe[_0xe3ac1b['field']]={'$like':'%'+_0x396162[_0x2097('0x36')][_0x2097('0x41')]+'%'};return _0x3fc3fe;}})});}_0x50b101=_[_0x2097('0x42')]({},_0x50b101,_0x396162[_0x2097('0x46')]);var _0x3ce9bf={'where':_0x50b101['where']};return db[_0x2097('0x32')][_0x2097('0x25')](_0x3ce9bf)[_0x2097('0x1c')](function(_0x39e0a4){_0x3484ff[_0x2097('0x25')]=_0x39e0a4;if(_0x396162['query'][_0x2097('0x47')]){_0x50b101[_0x2097('0x48')]=[{'all':!![]}];}return db[_0x2097('0x32')][_0x2097('0x49')](_0x50b101);})[_0x2097('0x1c')](function(_0x22c4c6){_0x3484ff[_0x2097('0x4a')]=_0x22c4c6;return _0x3484ff;})[_0x2097('0x1c')](respondWithFilteredResult(_0x542a52,_0x50b101))['catch'](handleError(_0x542a52,null));};exports[_0x2097('0x4b')]=function(_0x594804,_0x305657){var _0xfe13c8={'raw':![],'where':{'id':_0x594804['params']['id']}},_0x5cbc88={};_0x5cbc88['model']=_[_0x2097('0x35')](db[_0x2097('0x32')]['rawAttributes']);_0x5cbc88[_0x2097('0x36')]=_[_0x2097('0x35')](_0x594804['query']);_0x5cbc88['filters']=_[_0x2097('0x38')](_0x5cbc88[_0x2097('0x34')],_0x5cbc88[_0x2097('0x36')]);_0xfe13c8['attributes']=_[_0x2097('0x38')](_0x5cbc88[_0x2097('0x34')],qs['fields'](_0x594804[_0x2097('0x36')][_0x2097('0x39')]));_0xfe13c8[_0x2097('0x3a')]=_0xfe13c8[_0x2097('0x3a')][_0x2097('0x3b')]?_0xfe13c8['attributes']:_0x5cbc88['model'];if(_0x594804[_0x2097('0x36')][_0x2097('0x47')]){_0xfe13c8[_0x2097('0x48')]=[{'all':!![]}];}_0xfe13c8=_['merge']({},_0xfe13c8,_0x594804['options']);return db[_0x2097('0x32')][_0x2097('0x4c')](_0xfe13c8)['then'](handleEntityNotFound(_0x305657,null))[_0x2097('0x1c')](respondWithResult(_0x305657,null))[_0x2097('0x4d')](handleError(_0x305657,null));};exports[_0x2097('0x4e')]=function(_0x33490e,_0x390a52){return db['DeskAccount'][_0x2097('0x4e')](_0x33490e[_0x2097('0x4f')],{})[_0x2097('0x1c')](respondWithResult(_0x390a52,0xc9))['catch'](handleError(_0x390a52,null));};exports[_0x2097('0x2b')]=function(_0xdf72c7,_0x4edf1d){if(_0xdf72c7[_0x2097('0x4f')]['id']){delete _0xdf72c7['body']['id'];}return db[_0x2097('0x32')]['find']({'where':{'id':_0xdf72c7['params']['id']}})['then'](handleEntityNotFound(_0x4edf1d,null))[_0x2097('0x1c')](saveUpdates(_0xdf72c7['body'],null))['then'](respondWithResult(_0x4edf1d,null))[_0x2097('0x4d')](handleError(_0x4edf1d,null));};exports['destroy']=function(_0x597322,_0x5465ea){return db['DeskAccount'][_0x2097('0x4c')]({'where':{'id':_0x597322[_0x2097('0x50')]['id']}})[_0x2097('0x1c')](handleEntityNotFound(_0x5465ea,null))[_0x2097('0x1c')](removeEntity(_0x5465ea,null))[_0x2097('0x4d')](handleError(_0x5465ea,null));};exports['getConfigurations']=function(_0x2117e3,_0x49e315,_0xe2a2af){var _0x140e43={};var _0x24f166={};var _0x55e3cd;var _0x365499;return db[_0x2097('0x32')][_0x2097('0x51')]({'where':{'id':_0x2117e3[_0x2097('0x50')]['id']}})[_0x2097('0x1c')](handleEntityNotFound(_0x49e315,null))['then'](function(_0x5b9fa2){if(_0x5b9fa2){_0x55e3cd=_0x5b9fa2;_0x24f166[_0x2097('0x34')]=_[_0x2097('0x35')](db['DeskConfiguration']['rawAttributes']);_0x24f166['query']=_['keys'](_0x2117e3[_0x2097('0x36')]);_0x24f166['filters']=_[_0x2097('0x38')](_0x24f166[_0x2097('0x34')],_0x24f166['query']);_0x140e43[_0x2097('0x3a')]=_[_0x2097('0x38')](_0x24f166[_0x2097('0x34')],qs[_0x2097('0x39')](_0x2117e3[_0x2097('0x36')][_0x2097('0x39')]));_0x140e43[_0x2097('0x3a')]=_0x140e43[_0x2097('0x3a')][_0x2097('0x3b')]?_0x140e43['attributes']:_0x24f166[_0x2097('0x34')];_0x140e43[_0x2097('0x52')]=qs[_0x2097('0x3e')](_0x2117e3[_0x2097('0x36')][_0x2097('0x3e')]);_0x140e43[_0x2097('0x3f')]=qs['filters'](_[_0x2097('0x40')](_0x2117e3[_0x2097('0x36')],_0x24f166[_0x2097('0x37')]));if(_0x2117e3[_0x2097('0x36')][_0x2097('0x41')]){_0x140e43['where']=_[_0x2097('0x42')](_0x140e43[_0x2097('0x3f')],{'$or':_['map'](_0x140e43['attributes'],function(_0x580c1e){var _0x8bf114={};_0x8bf114[_0x580c1e]={'$like':'%'+_0x2117e3[_0x2097('0x36')][_0x2097('0x41')]+'%'};return _0x8bf114;})});}_0x140e43=_[_0x2097('0x42')]({},_0x140e43,_0x2117e3[_0x2097('0x46')]);return _0x55e3cd[_0x2097('0x53')](_0x140e43);}})[_0x2097('0x1c')](function(_0x2ce256){if(_0x2ce256){_0x365499=_0x2ce256[_0x2097('0x3b')];if(!_0x2117e3['query']['hasOwnProperty'](_0x2097('0x3d'))){_0x140e43[_0x2097('0x27')]=qs[_0x2097('0x27')](_0x2117e3[_0x2097('0x36')][_0x2097('0x27')]);_0x140e43[_0x2097('0x26')]=qs['offset'](_0x2117e3[_0x2097('0x36')][_0x2097('0x26')]);}return _0x55e3cd[_0x2097('0x53')](_0x140e43);}})[_0x2097('0x1c')](function(_0x4f4cdb){if(_0x4f4cdb){return _0x4f4cdb?{'count':_0x365499,'rows':_0x4f4cdb}:null;}})['then'](respondWithResult(_0x49e315,null))[_0x2097('0x4d')](handleError(_0x49e315,null));};exports[_0x2097('0x54')]=function(_0x487f1f,_0x3707da,_0x426290){if(_0x487f1f[_0x2097('0x4f')]['id']){delete _0x487f1f[_0x2097('0x4f')]['id'];}return db[_0x2097('0x32')][_0x2097('0x51')]({'where':{'id':_0x487f1f[_0x2097('0x50')]['id']}})[_0x2097('0x1c')](handleEntityNotFound(_0x3707da,null))['then'](function(_0x4533fd){if(_0x4533fd){_0x487f1f[_0x2097('0x4f')]['AccountId']=_0x4533fd['id'];_0x487f1f[_0x2097('0x4f')][_0x2097('0x55')]=integrations[_0x2097('0x56')](_0x487f1f[_0x2097('0x4f')][_0x2097('0x57')],_0x487f1f[_0x2097('0x4f')][_0x2097('0x44')]);_0x487f1f[_0x2097('0x4f')][_0x2097('0x58')]=integrations[_0x2097('0x59')](_0x487f1f[_0x2097('0x4f')]['channel'],_0x487f1f[_0x2097('0x4f')][_0x2097('0x44')]);return db[_0x2097('0x5a')][_0x2097('0x4e')](_0x487f1f[_0x2097('0x4f')],{'include':[{'model':db['DeskField'],'as':_0x2097('0x55')},{'model':db[_0x2097('0x5b')],'as':_0x2097('0x58')}]});}return null;})['then'](respondWithResult(_0x3707da,null))[_0x2097('0x4d')](handleError(_0x3707da,null));};exports['getFields']=function(_0x364d3a,_0x4dcd9c,_0x1022d5){var _0x4be822=[{'name':_0x2097('0x5c'),'label':'priority','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 _0xae42fe='';return db[_0x2097('0x32')][_0x2097('0x51')]({'where':{'id':_0x364d3a[_0x2097('0x50')]['id']},'attributes':['id',_0x2097('0x5d'),'authType',_0x2097('0x5e'),_0x2097('0x5f'),_0x2097('0x60'),_0x2097('0x61'),_0x2097('0x62'),_0x2097('0x63')]})[_0x2097('0x1c')](handleEntityNotFound(_0x4dcd9c,null))[_0x2097('0x1c')](function(_0xd4e39d){if(_0xd4e39d){_0xae42fe=_0xd4e39d[_0x2097('0x5d')];var _0x2dfb63=_0xae42fe[_0x2097('0x64')](-0x1);if(_0x2dfb63==='/'){_0xae42fe=_0xae42fe[_0x2097('0x65')](0x0,_0xae42fe[_0x2097('0x66')](_0x2dfb63));}var _0x2853c4={'method':_0x2097('0x67'),'uri':util['format'](_0x2097('0x68'),_0xae42fe),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0xd4e39d[_0x2097('0x69')]===_0x2097('0x6a')){_0x2853c4[_0x2097('0x6b')]['Authorization']=util[_0x2097('0x6c')](_0x2097('0x6d'),new Buffer(util[_0x2097('0x6c')](_0x2097('0x6e'),_0xd4e39d['username'],_0xd4e39d[_0x2097('0x5f')]))['toString'](_0x2097('0x6f')));}return rp(_0x2853c4)[_0x2097('0x1c')](function(_0x2619db){return _0x4be822[_0x2097('0x70')](_['map'](_0x2619db[_0x2097('0x71')][_0x2097('0x72')],function(_0x31ec19){return{'id':_0x31ec19['name'],'name':_0x31ec19[_0x2097('0x2f')],'type':_0x31ec19[_0x2097('0x44')],'active':_0x31ec19[_0x2097('0x73')],'label':_0x31ec19['label'],'custom':!![]};}));});}})[_0x2097('0x1c')](function(_0x33a572){return{'count':_0x33a572[_0x2097('0x3b')],'rows':_0x33a572};})[_0x2097('0x1c')](respondWithResult(_0x4dcd9c,null))[_0x2097('0x4d')](function(_0x5efe1e){var _0x5d181f=_0x364d3a['query'][_0x2097('0x74')]?0x1f4:_0x5efe1e[_0x2097('0x75')]||0x1f4;logger[_0x2097('0x20')](_0x2097('0x76'),_0x2097('0x77'),_0x5d181f,JSON[_0x2097('0x1f')](_0x5efe1e));delete _0x5efe1e['name'];if(_0x5d181f===0x191){_0x5d181f=0x190;}_0x4dcd9c[_0x2097('0x24')](_0x5d181f)[_0x2097('0x30')](_0x364d3a[_0x2097('0x36')][_0x2097('0x74')]?{'message':_0x2097('0x78'),'statusCode':_0x5efe1e[_0x2097('0x75')]}:_0x5efe1e);});};
\ No newline at end of file
index dff384b..4fd1985 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe635=['bluebird','request-promise','exports','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x5abf7a,_0x4d16bb){var _0x17350f=function(_0x142f20){while(--_0x142f20){_0x5abf7a['push'](_0x5abf7a['shift']());}};_0x17350f(++_0x4d16bb);}(_0xe635,0x1be));var _0x5e63=function(_0x6d02f6,_0x21e16f){_0x6d02f6=_0x6d02f6-0x0;var _0x372791=_0xe635[_0x6d02f6];return _0x372791;};'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 attributes=require('./intDeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x5e63('0x7')]=function(_0x30e8d1,_0x3c3939){return _0x30e8d1[_0x5e63('0x8')](_0x5e63('0x9'),attributes,{'tableName':_0x5e63('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xa7db=['int_desk_accounts','lodash','util','../../config/logger','request-promise','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount'];(function(_0x503d9f,_0x18e359){var _0x2ee04b=function(_0x221a0a){while(--_0x221a0a){_0x503d9f['push'](_0x503d9f['shift']());}};_0x2ee04b(++_0x18e359);}(_0xa7db,0xbf));var _0xba7d=function(_0x21f9eb,_0x3c6621){_0x21f9eb=_0x21f9eb-0x0;var _0x4bfd24=_0xa7db[_0x21f9eb];return _0x4bfd24;};'use strict';var _=require(_0xba7d('0x0'));var util=require(_0xba7d('0x1'));var logger=require(_0xba7d('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xba7d('0x3'));var attributes=require(_0xba7d('0x4'));var integrations=require(_0xba7d('0x5'));module[_0xba7d('0x6')]=function(_0x10f8b6,_0x58c461){return _0x10f8b6[_0xba7d('0x7')](_0xba7d('0x8'),attributes,{'tableName':_0xba7d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 3581359..29b228a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd448=['attributes','include','map','model','info','ShowDeskAccount','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','GetDeskAccount','findAll','options','where'];(function(_0x1e6c56,_0x381233){var _0x1ff3e2=function(_0x749216){while(--_0x749216){_0x1e6c56['push'](_0x1e6c56['shift']());}};_0x1ff3e2(++_0x381233);}(_0xd448,0x172));var _0x8d44=function(_0x59d727,_0x41606e){_0x59d727=_0x59d727-0x0;var _0x17f64a=_0xd448[_0x59d727];return _0x17f64a;};'use strict';var _=require('lodash');var util=require(_0x8d44('0x0'));var moment=require(_0x8d44('0x1'));var BPromise=require(_0x8d44('0x2'));var rs=require(_0x8d44('0x3'));var fs=require('fs');var Redis=require(_0x8d44('0x4'));var db=require(_0x8d44('0x5'))['db'];var utils=require(_0x8d44('0x6'));var logger=require(_0x8d44('0x7'))(_0x8d44('0x8'));var config=require(_0x8d44('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8d44('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56539b,_0x3b352e,_0x2cdb53){return new BPromise(function(_0x1680eb,_0x441fd3){return client['request'](_0x56539b,_0x2cdb53)[_0x8d44('0xb')](function(_0x2a5da6){logger['info']('DeskAccount,\x20%s,\x20%s',_0x3b352e,_0x8d44('0xc'));logger[_0x8d44('0xd')](_0x8d44('0xe'),_0x3b352e,'request\x20sent',JSON[_0x8d44('0xf')](_0x2a5da6));if(_0x2a5da6[_0x8d44('0x10')]){if(_0x2a5da6[_0x8d44('0x10')][_0x8d44('0x11')]===0x1f4){logger['error'](_0x8d44('0x12'),_0x3b352e,_0x2a5da6[_0x8d44('0x10')][_0x8d44('0x13')]);return _0x441fd3(_0x2a5da6[_0x8d44('0x10')][_0x8d44('0x13')]);}logger['error'](_0x8d44('0x12'),_0x3b352e,_0x2a5da6[_0x8d44('0x10')][_0x8d44('0x13')]);return _0x1680eb(_0x2a5da6[_0x8d44('0x10')][_0x8d44('0x13')]);}else{logger['info'](_0x8d44('0x12'),_0x3b352e,_0x8d44('0xc'));_0x1680eb(_0x2a5da6[_0x8d44('0x14')][_0x8d44('0x13')]);}})[_0x8d44('0x15')](function(_0x2e7d11){logger[_0x8d44('0x10')](_0x8d44('0x12'),_0x3b352e,_0x2e7d11);_0x441fd3(_0x2e7d11);});});}exports[_0x8d44('0x16')]=function(_0x1f29cb){var _0x4947f9=this;return new Promise(function(_0x10d801,_0x224265){return db['DeskAccount'][_0x8d44('0x17')]({'raw':_0x1f29cb[_0x8d44('0x18')]?_0x1f29cb[_0x8d44('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1f29cb[_0x8d44('0x18')]?_0x1f29cb[_0x8d44('0x18')][_0x8d44('0x19')]||null:null,'attributes':_0x1f29cb[_0x8d44('0x18')]?_0x1f29cb['options'][_0x8d44('0x1a')]||null:null,'limit':_0x1f29cb[_0x8d44('0x18')]?_0x1f29cb[_0x8d44('0x18')]['limit']||null:null,'include':_0x1f29cb[_0x8d44('0x18')]?_0x1f29cb[_0x8d44('0x18')][_0x8d44('0x1b')]?_[_0x8d44('0x1c')](_0x1f29cb[_0x8d44('0x18')]['include'],function(_0x45251a){return{'model':db[_0x45251a[_0x8d44('0x1d')]],'as':_0x45251a['as'],'attributes':_0x45251a[_0x8d44('0x1a')],'include':_0x45251a['include']?_['map'](_0x45251a[_0x8d44('0x1b')],function(_0x105a12){return{'model':db[_0x105a12[_0x8d44('0x1d')]],'as':_0x105a12['as'],'attributes':_0x105a12[_0x8d44('0x1a')],'include':_0x105a12[_0x8d44('0x1b')]?_[_0x8d44('0x1c')](_0x105a12[_0x8d44('0x1b')],function(_0x5f59ab){return{'model':db[_0x5f59ab['model']],'as':_0x5f59ab['as'],'attributes':_0x5f59ab[_0x8d44('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8d44('0xb')](function(_0x3fdad7){logger[_0x8d44('0x1e')](_0x8d44('0x16'),_0x1f29cb);logger[_0x8d44('0xd')](_0x8d44('0x16'),_0x1f29cb,JSON['stringify'](_0x3fdad7));_0x10d801(_0x3fdad7);})[_0x8d44('0x15')](function(_0x5eb0c5){logger['error'](_0x8d44('0x16'),_0x5eb0c5[_0x8d44('0x13')],_0x1f29cb);_0x224265(_0x4947f9[_0x8d44('0x10')](0x1f4,_0x5eb0c5[_0x8d44('0x13')]));});});};exports[_0x8d44('0x1f')]=function(_0x15f214){var _0x2d034d=this;return new Promise(function(_0x5e4d03,_0x159e0e){return db['DeskAccount']['find']({'raw':_0x15f214['options']?_0x15f214['options'][_0x8d44('0x20')]===undefined?!![]:![]:!![],'where':_0x15f214[_0x8d44('0x18')]?_0x15f214[_0x8d44('0x18')][_0x8d44('0x19')]||null:null,'attributes':_0x15f214['options']?_0x15f214[_0x8d44('0x18')][_0x8d44('0x1a')]||null:null,'include':_0x15f214[_0x8d44('0x18')]?_0x15f214[_0x8d44('0x18')]['include']?_[_0x8d44('0x1c')](_0x15f214[_0x8d44('0x18')][_0x8d44('0x1b')],function(_0x3d6a47){return{'model':db[_0x3d6a47[_0x8d44('0x1d')]],'as':_0x3d6a47['as'],'attributes':_0x3d6a47[_0x8d44('0x1a')],'include':_0x3d6a47['include']?_[_0x8d44('0x1c')](_0x3d6a47['include'],function(_0x736b80){return{'model':db[_0x736b80[_0x8d44('0x1d')]],'as':_0x736b80['as'],'attributes':_0x736b80[_0x8d44('0x1a')],'include':_0x736b80[_0x8d44('0x1b')]?_[_0x8d44('0x1c')](_0x736b80[_0x8d44('0x1b')],function(_0x234100){return{'model':db[_0x234100[_0x8d44('0x1d')]],'as':_0x234100['as'],'attributes':_0x234100[_0x8d44('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8d44('0xb')](function(_0x3cfee8){logger[_0x8d44('0x1e')](_0x8d44('0x1f'),_0x15f214);logger[_0x8d44('0xd')]('ShowDeskAccount',_0x15f214,JSON['stringify'](_0x3cfee8));_0x5e4d03(_0x3cfee8);})[_0x8d44('0x15')](function(_0x4dd7ad){logger[_0x8d44('0x10')](_0x8d44('0x1f'),_0x4dd7ad[_0x8d44('0x13')],_0x15f214);_0x159e0e(_0x2d034d[_0x8d44('0x10')](0x1f4,_0x4dd7ad[_0x8d44('0x13')]));});});};
\ No newline at end of file
+var _0x1280=['ShowDeskAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','DeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','GetDeskAccount'];(function(_0x1a76ec,_0x805462){var _0x26cc60=function(_0x52db11){while(--_0x52db11){_0x1a76ec['push'](_0x1a76ec['shift']());}};_0x26cc60(++_0x805462);}(_0x1280,0xac));var _0x0128=function(_0x2c8de4,_0x48ecd7){_0x2c8de4=_0x2c8de4-0x0;var _0xa5f1d5=_0x1280[_0x2c8de4];return _0xa5f1d5;};'use strict';var _=require(_0x0128('0x0'));var util=require('util');var moment=require(_0x0128('0x1'));var BPromise=require(_0x0128('0x2'));var rs=require(_0x0128('0x3'));var fs=require('fs');var Redis=require(_0x0128('0x4'));var db=require(_0x0128('0x5'))['db'];var utils=require(_0x0128('0x6'));var logger=require('../../config/logger')(_0x0128('0x7'));var config=require(_0x0128('0x8'));var jayson=require(_0x0128('0x9'));var client=jayson[_0x0128('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e74fe,_0x1d647f,_0x134abd){return new BPromise(function(_0x2b8b86,_0x43a105){return client['request'](_0x4e74fe,_0x134abd)[_0x0128('0xb')](function(_0x2fa9cb){logger['info'](_0x0128('0xc'),_0x1d647f,_0x0128('0xd'));logger[_0x0128('0xe')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x1d647f,'request\x20sent',JSON[_0x0128('0xf')](_0x2fa9cb));if(_0x2fa9cb[_0x0128('0x10')]){if(_0x2fa9cb[_0x0128('0x10')]['code']===0x1f4){logger[_0x0128('0x10')]('DeskAccount,\x20%s,\x20%s',_0x1d647f,_0x2fa9cb[_0x0128('0x10')]['message']);return _0x43a105(_0x2fa9cb[_0x0128('0x10')]['message']);}logger[_0x0128('0x10')]('DeskAccount,\x20%s,\x20%s',_0x1d647f,_0x2fa9cb[_0x0128('0x10')][_0x0128('0x11')]);return _0x2b8b86(_0x2fa9cb[_0x0128('0x10')][_0x0128('0x11')]);}else{logger[_0x0128('0x12')](_0x0128('0xc'),_0x1d647f,'request\x20sent');_0x2b8b86(_0x2fa9cb[_0x0128('0x13')][_0x0128('0x11')]);}})[_0x0128('0x14')](function(_0x16a4b7){logger[_0x0128('0x10')](_0x0128('0xc'),_0x1d647f,_0x16a4b7);_0x43a105(_0x16a4b7);});});}exports['GetDeskAccount']=function(_0x2524b1){var _0x18a955=this;return new Promise(function(_0x1a5818,_0x431b13){return db[_0x0128('0x15')][_0x0128('0x16')]({'raw':_0x2524b1['options']?_0x2524b1[_0x0128('0x17')][_0x0128('0x18')]===undefined?!![]:![]:!![],'where':_0x2524b1['options']?_0x2524b1['options'][_0x0128('0x19')]||null:null,'attributes':_0x2524b1[_0x0128('0x17')]?_0x2524b1[_0x0128('0x17')][_0x0128('0x1a')]||null:null,'limit':_0x2524b1[_0x0128('0x17')]?_0x2524b1[_0x0128('0x17')][_0x0128('0x1b')]||null:null,'include':_0x2524b1[_0x0128('0x17')]?_0x2524b1['options']['include']?_[_0x0128('0x1c')](_0x2524b1['options'][_0x0128('0x1d')],function(_0x33354b){return{'model':db[_0x33354b[_0x0128('0x1e')]],'as':_0x33354b['as'],'attributes':_0x33354b['attributes'],'include':_0x33354b[_0x0128('0x1d')]?_['map'](_0x33354b[_0x0128('0x1d')],function(_0x1dc125){return{'model':db[_0x1dc125[_0x0128('0x1e')]],'as':_0x1dc125['as'],'attributes':_0x1dc125[_0x0128('0x1a')],'include':_0x1dc125[_0x0128('0x1d')]?_['map'](_0x1dc125[_0x0128('0x1d')],function(_0x3a9e26){return{'model':db[_0x3a9e26['model']],'as':_0x3a9e26['as'],'attributes':_0x3a9e26[_0x0128('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0128('0xb')](function(_0x4ee634){logger[_0x0128('0x12')](_0x0128('0x1f'),_0x2524b1);logger[_0x0128('0xe')]('GetDeskAccount',_0x2524b1,JSON['stringify'](_0x4ee634));_0x1a5818(_0x4ee634);})[_0x0128('0x14')](function(_0x586310){logger['error']('GetDeskAccount',_0x586310[_0x0128('0x11')],_0x2524b1);_0x431b13(_0x18a955['error'](0x1f4,_0x586310[_0x0128('0x11')]));});});};exports[_0x0128('0x20')]=function(_0x345023){var _0x41f198=this;return new Promise(function(_0x5a021f,_0x24dad5){return db[_0x0128('0x15')][_0x0128('0x21')]({'raw':_0x345023[_0x0128('0x17')]?_0x345023['options'][_0x0128('0x18')]===undefined?!![]:![]:!![],'where':_0x345023[_0x0128('0x17')]?_0x345023[_0x0128('0x17')][_0x0128('0x19')]||null:null,'attributes':_0x345023[_0x0128('0x17')]?_0x345023[_0x0128('0x17')][_0x0128('0x1a')]||null:null,'include':_0x345023['options']?_0x345023['options']['include']?_[_0x0128('0x1c')](_0x345023[_0x0128('0x17')][_0x0128('0x1d')],function(_0x5f161a){return{'model':db[_0x5f161a[_0x0128('0x1e')]],'as':_0x5f161a['as'],'attributes':_0x5f161a['attributes'],'include':_0x5f161a[_0x0128('0x1d')]?_[_0x0128('0x1c')](_0x5f161a[_0x0128('0x1d')],function(_0x46d5a8){return{'model':db[_0x46d5a8['model']],'as':_0x46d5a8['as'],'attributes':_0x46d5a8['attributes'],'include':_0x46d5a8[_0x0128('0x1d')]?_[_0x0128('0x1c')](_0x46d5a8[_0x0128('0x1d')],function(_0xe9d2b4){return{'model':db[_0xe9d2b4['model']],'as':_0xe9d2b4['as'],'attributes':_0xe9d2b4['attributes']};}):[]};}):[]};}):[]:[]})[_0x0128('0xb')](function(_0x313da8){logger[_0x0128('0x12')](_0x0128('0x20'),_0x345023);logger[_0x0128('0xe')]('ShowDeskAccount',_0x345023,JSON[_0x0128('0xf')](_0x313da8));_0x5a021f(_0x313da8);})[_0x0128('0x14')](function(_0x5002e3){logger['error']('ShowDeskAccount',_0x5002e3[_0x0128('0x11')],_0x345023);_0x24dad5(_0x41f198[_0x0128('0x10')](0x1f4,_0x5002e3[_0x0128('0x11')]));});});};
\ No newline at end of file
index beacfac..f8823bc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x457a=['../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','index','get','/:id','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update','delete','destroy','multer','path','connect-timeout','express','Router'];(function(_0x461262,_0x1f6ae7){var _0x3975d6=function(_0x188fd8){while(--_0x188fd8){_0x461262['push'](_0x461262['shift']());}};_0x3975d6(++_0x1f6ae7);}(_0x457a,0x85));var _0xa457=function(_0x45da40,_0x551d6e){_0x45da40=_0x45da40-0x0;var _0xb4f517=_0x457a[_0x45da40];return _0xb4f517;};'use strict';var multer=require(_0xa457('0x0'));var util=require('util');var path=require(_0xa457('0x1'));var timeout=require(_0xa457('0x2'));var express=require(_0xa457('0x3'));var router=express[_0xa457('0x4')]();var auth=require(_0xa457('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa457('0x6'));var controller=require(_0xa457('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa457('0x8')]);router[_0xa457('0x9')](_0xa457('0xa'),auth[_0xa457('0xb')](),controller['show']);router[_0xa457('0x9')]('/:id/fields',auth[_0xa457('0xb')](),controller[_0xa457('0xc')]);router[_0xa457('0x9')](_0xa457('0xd'),auth[_0xa457('0xb')](),controller[_0xa457('0xe')]);router[_0xa457('0x9')](_0xa457('0xf'),auth[_0xa457('0xb')](),controller['getDescriptions']);router['get'](_0xa457('0x10'),auth['isAuthenticated'](),controller['getTags']);router[_0xa457('0x11')]('/',auth[_0xa457('0xb')](),controller['create']);router[_0xa457('0x11')](_0xa457('0x10'),auth[_0xa457('0xb')](),controller[_0xa457('0x12')]);router[_0xa457('0x13')]('/:id',auth[_0xa457('0xb')](),controller[_0xa457('0x14')]);router[_0xa457('0x15')](_0xa457('0xa'),auth['isAuthenticated'](),controller[_0xa457('0x16')]);module['exports']=router;
\ No newline at end of file
+var _0x037a=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','delete'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x037a,0xca));var _0xa037=function(_0x1c1200,_0xda5f7a){_0x1c1200=_0x1c1200-0x0;var _0x74e432=_0x037a[_0x1c1200];return _0x74e432;};'use strict';var multer=require(_0xa037('0x0'));var util=require(_0xa037('0x1'));var path=require(_0xa037('0x2'));var timeout=require(_0xa037('0x3'));var express=require('express');var router=express[_0xa037('0x4')]();var auth=require(_0xa037('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa037('0x6'));var controller=require(_0xa037('0x7'));router[_0xa037('0x8')]('/',auth[_0xa037('0x9')](),controller['index']);router[_0xa037('0x8')](_0xa037('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xa037('0x8')](_0xa037('0xb'),auth[_0xa037('0x9')](),controller['getFields']);router[_0xa037('0x8')](_0xa037('0xc'),auth[_0xa037('0x9')](),controller[_0xa037('0xd')]);router['get'](_0xa037('0xe'),auth[_0xa037('0x9')](),controller[_0xa037('0xf')]);router['get'](_0xa037('0x10'),auth[_0xa037('0x9')](),controller[_0xa037('0x11')]);router[_0xa037('0x12')]('/',auth['isAuthenticated'](),controller[_0xa037('0x13')]);router[_0xa037('0x12')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa037('0x14')]);router[_0xa037('0x15')](_0xa037('0xa'),auth[_0xa037('0x9')](),controller['update']);router[_0xa037('0x16')](_0xa037('0xa'),auth[_0xa037('0x9')](),controller[_0xa037('0x17')]);module[_0xa037('0x18')]=router;
\ No newline at end of file
index 2055447..c8ae03e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xef35=['sequelize','exports','STRING'];(function(_0x5a88ad,_0x386452){var _0x579d30=function(_0x1a8cb6){while(--_0x1a8cb6){_0x5a88ad['push'](_0x5a88ad['shift']());}};_0x579d30(++_0x386452);}(_0xef35,0xff));var _0x5ef3=function(_0x5c6994,_0x19ad9a){_0x5c6994=_0x5c6994-0x0;var _0x1d5c84=_0xef35[_0x5c6994];return _0x1d5c84;};'use strict';var Sequelize=require(_0x5ef3('0x0'));module[_0x5ef3('0x1')]={'name':{'type':Sequelize[_0x5ef3('0x2')]},'description':{'type':Sequelize[_0x5ef3('0x2')]}};
\ No newline at end of file
+var _0x7bbd=['sequelize','STRING'];(function(_0x1a27e7,_0xd27e74){var _0x57a69f=function(_0x5cef03){while(--_0x5cef03){_0x1a27e7['push'](_0x1a27e7['shift']());}};_0x57a69f(++_0xd27e74);}(_0x7bbd,0xc2));var _0xd7bb=function(_0x5ef909,_0x29225c){_0x5ef909=_0x5ef909-0x0;var _0x565d3c=_0x7bbd[_0x5ef909];return _0x565d3c;};'use strict';var Sequelize=require(_0xd7bb('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd7bb('0x1')]}};
\ No newline at end of file
index ae421dc..993a1d9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2750=['where','pick','filter','type','key','VIRTUAL','field','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','getFields','findOne','DeskField','map','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','message','DeskConfiguration,\x20%s,\x20%s','result','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','stack','name','send','index','DeskConfiguration','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x2fa771,_0x511aec){var _0x8f89c2=function(_0x376db1){while(--_0x376db1){_0x2fa771['push'](_0x2fa771['shift']());}};_0x8f89c2(++_0x511aec);}(_0x2750,0x13b));var _0x0275=function(_0x30917b,_0x11840d){_0x30917b=_0x30917b-0x0;var _0x3a14fd=_0x2750[_0x30917b];return _0x3a14fd;};'use strict';var pdf=require(_0x0275('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0275('0x1'));var zipdir=require(_0x0275('0x2'));var jsonpatch=require(_0x0275('0x3'));var rp=require(_0x0275('0x4'));var moment=require(_0x0275('0x5'));var BPromise=require(_0x0275('0x6'));var Mustache=require(_0x0275('0x7'));var util=require(_0x0275('0x8'));var path=require(_0x0275('0x9'));var sox=require(_0x0275('0xa'));var csv=require('to-csv');var ejs=require(_0x0275('0xb'));var fs=require('fs');var _=require(_0x0275('0xc'));var squel=require(_0x0275('0xd'));var crypto=require(_0x0275('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0275('0xf'));var toCsv=require(_0x0275('0x10'));var querystring=require(_0x0275('0x11'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0x0275('0x12'));var Redis=require('ioredis');var qs=require(_0x0275('0x13'));var logger=require(_0x0275('0x14'))(_0x0275('0x15'));var utils=require(_0x0275('0x16'));var config=require(_0x0275('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x0275('0x18'));var client=jayson[_0x0275('0x19')][_0x0275('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4c6ee0,_0x55ffd6,_0x292f93,_0x395398){return new BPromise(function(_0x37f809,_0x46a729){var _0x28827b=_0x395398||client;return _0x28827b[_0x0275('0x1b')](_0x4c6ee0,_0x292f93)['then'](function(_0x3e0791){logger[_0x0275('0x1c')]('DeskConfiguration,\x20%s,\x20%s',_0x55ffd6,_0x0275('0x1d'));logger[_0x0275('0x1e')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x55ffd6,_0x0275('0x1d'),JSON[_0x0275('0x1f')](_0x3e0791));if(_0x3e0791['error']){if(_0x3e0791['error']['code']===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x55ffd6,_0x3e0791[_0x0275('0x20')][_0x0275('0x21')]);return _0x46a729(_0x3e0791[_0x0275('0x20')]['message']);}logger[_0x0275('0x20')](_0x0275('0x22'),_0x55ffd6,_0x3e0791[_0x0275('0x20')]['message']);return _0x37f809(_0x3e0791[_0x0275('0x20')][_0x0275('0x21')]);}else{logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x55ffd6,_0x0275('0x1d'));_0x37f809(_0x3e0791[_0x0275('0x23')][_0x0275('0x21')]);}})['catch'](function(_0xf3b68e){logger['error'](_0x0275('0x22'),_0x55ffd6,_0xf3b68e);_0x46a729(_0xf3b68e);});});}function respondWithStatusCode(_0x5c75f1,_0x26f2c2){_0x26f2c2=_0x26f2c2||0xcc;return function(_0xfa0081){if(_0xfa0081){return _0x5c75f1['sendStatus'](_0x26f2c2);}return _0x5c75f1[_0x0275('0x24')](_0x26f2c2)[_0x0275('0x25')]();};}function respondWithResult(_0x2e3605,_0x52946b){_0x52946b=_0x52946b||0xc8;return function(_0x2552bc){if(_0x2552bc){return _0x2e3605[_0x0275('0x24')](_0x52946b)[_0x0275('0x26')](_0x2552bc);}};}function respondWithFilteredResult(_0x15813f,_0x1a2024){return function(_0x437752){if(_0x437752){var _0x56f26c=_0x437752[_0x0275('0x27')],_0x35343c=_0x1a2024[_0x0275('0x28')],_0x14d7d8=_0x1a2024['offset']+_0x1a2024[_0x0275('0x29')],_0x1d24b2;if(_0x14d7d8>=_0x56f26c){_0x14d7d8=_0x56f26c;_0x1d24b2=0xc8;}else{_0x1d24b2=0xce;}_0x15813f[_0x0275('0x24')](_0x1d24b2);return _0x15813f[_0x0275('0x2a')](_0x0275('0x2b'),_0x35343c+'-'+_0x14d7d8+'/'+_0x56f26c)[_0x0275('0x26')](_0x437752);}return null;};}function patchUpdates(_0x49e645){return function(_0x2d49b4){try{jsonpatch[_0x0275('0x2c')](_0x2d49b4,_0x49e645,!![]);}catch(_0x127bbd){return BPromise['reject'](_0x127bbd);}return _0x2d49b4['save']();};}function saveUpdates(_0x3cb2d7,_0x299190){return function(_0x5dc2bc){if(_0x5dc2bc){return _0x5dc2bc[_0x0275('0x2d')](_0x3cb2d7)[_0x0275('0x2e')](function(_0x4378dd){return _0x4378dd;});}return null;};}function removeEntity(_0x4111fa,_0x5d763d){return function(_0x24c762){if(_0x24c762){return _0x24c762[_0x0275('0x2f')]()[_0x0275('0x2e')](function(){_0x4111fa[_0x0275('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x134f12,_0x55198e){return function(_0x2cc5df){if(!_0x2cc5df){_0x134f12['sendStatus'](0x194);}return _0x2cc5df;};}function handleError(_0x26aae0,_0x165157){_0x165157=_0x165157||0x1f4;return function(_0x56b568){logger[_0x0275('0x20')](_0x56b568[_0x0275('0x30')]);if(_0x56b568[_0x0275('0x31')]){delete _0x56b568[_0x0275('0x31')];}_0x26aae0['status'](_0x165157)[_0x0275('0x32')](_0x56b568);};}exports[_0x0275('0x33')]=function(_0xbe4741,_0x1d872a){var _0x3383c3={},_0x58e3f3={},_0x2a18c3={'count':0x0,'rows':[]};var _0x2ad334=db[_0x0275('0x34')][_0x0275('0x35')];_0x58e3f3[_0x0275('0x36')]=_[_0x0275('0x37')](_0x2ad334);_0x58e3f3[_0x0275('0x38')]=_[_0x0275('0x37')](_0xbe4741[_0x0275('0x38')]);_0x58e3f3[_0x0275('0x39')]=_[_0x0275('0x3a')](_0x58e3f3['model'],_0x58e3f3[_0x0275('0x38')]);_0x3383c3[_0x0275('0x3b')]=_[_0x0275('0x3a')](_0x58e3f3[_0x0275('0x36')],qs[_0x0275('0x3c')](_0xbe4741[_0x0275('0x38')][_0x0275('0x3c')]));_0x3383c3[_0x0275('0x3b')]=_0x3383c3[_0x0275('0x3b')][_0x0275('0x3d')]?_0x3383c3[_0x0275('0x3b')]:_0x58e3f3[_0x0275('0x36')];if(!_0xbe4741[_0x0275('0x38')][_0x0275('0x3e')]('nolimit')){_0x3383c3[_0x0275('0x29')]=qs[_0x0275('0x29')](_0xbe4741['query'][_0x0275('0x29')]);_0x3383c3[_0x0275('0x28')]=qs[_0x0275('0x28')](_0xbe4741[_0x0275('0x38')][_0x0275('0x28')]);}_0x3383c3[_0x0275('0x3f')]=qs[_0x0275('0x40')](_0xbe4741['query'][_0x0275('0x40')]);_0x3383c3[_0x0275('0x41')]=qs[_0x0275('0x39')](_[_0x0275('0x42')](_0xbe4741['query'],_0x58e3f3[_0x0275('0x39')]));if(_0xbe4741[_0x0275('0x38')][_0x0275('0x43')]){_0x3383c3[_0x0275('0x41')]=_['merge'](_0x3383c3[_0x0275('0x41')],{'$or':_['map'](_0x2ad334,function(_0x261e66){if(_0x261e66[_0x0275('0x44')][_0x0275('0x45')]!==_0x0275('0x46')){var _0x51199b={};_0x51199b[_0x261e66[_0x0275('0x47')]]={'$like':'%'+_0xbe4741[_0x0275('0x38')]['filter']+'%'};return _0x51199b;}})});}_0x3383c3=_[_0x0275('0x48')]({},_0x3383c3,_0xbe4741[_0x0275('0x49')]);var _0x12ec31={'where':_0x3383c3['where']};return db[_0x0275('0x34')][_0x0275('0x27')](_0x12ec31)['then'](function(_0x1da178){_0x2a18c3[_0x0275('0x27')]=_0x1da178;if(_0xbe4741[_0x0275('0x38')][_0x0275('0x4a')]){_0x3383c3[_0x0275('0x4b')]=[{'all':!![]}];}return db[_0x0275('0x34')][_0x0275('0x4c')](_0x3383c3);})[_0x0275('0x2e')](function(_0xb15d65){_0x2a18c3[_0x0275('0x4d')]=_0xb15d65;return _0x2a18c3;})[_0x0275('0x2e')](respondWithFilteredResult(_0x1d872a,_0x3383c3))['catch'](handleError(_0x1d872a,null));};exports[_0x0275('0x4e')]=function(_0x123dd4,_0x350465){var _0x33617b={'raw':![],'where':{'id':_0x123dd4[_0x0275('0x4f')]['id']}},_0x29633c={};_0x29633c[_0x0275('0x36')]=_[_0x0275('0x37')](db[_0x0275('0x34')][_0x0275('0x35')]);_0x29633c[_0x0275('0x38')]=_['keys'](_0x123dd4['query']);_0x29633c[_0x0275('0x39')]=_[_0x0275('0x3a')](_0x29633c[_0x0275('0x36')],_0x29633c[_0x0275('0x38')]);_0x33617b[_0x0275('0x3b')]=_['intersection'](_0x29633c[_0x0275('0x36')],qs['fields'](_0x123dd4[_0x0275('0x38')][_0x0275('0x3c')]));_0x33617b[_0x0275('0x3b')]=_0x33617b[_0x0275('0x3b')]['length']?_0x33617b[_0x0275('0x3b')]:_0x29633c['model'];if(_0x123dd4['query']['includeAll']){_0x33617b[_0x0275('0x4b')]=[{'all':!![]}];}_0x33617b=_['merge']({},_0x33617b,_0x123dd4[_0x0275('0x49')]);return db[_0x0275('0x34')][_0x0275('0x50')](_0x33617b)[_0x0275('0x2e')](handleEntityNotFound(_0x350465,null))[_0x0275('0x2e')](respondWithResult(_0x350465,null))[_0x0275('0x51')](handleError(_0x350465,null));};exports[_0x0275('0x52')]=function(_0x591bfd,_0xe6f266){return db['DeskConfiguration'][_0x0275('0x52')](_0x591bfd[_0x0275('0x53')],{})[_0x0275('0x2e')](respondWithResult(_0xe6f266,0xc9))[_0x0275('0x51')](handleError(_0xe6f266,null));};exports[_0x0275('0x2d')]=function(_0x4097e8,_0x78dc83){if(_0x4097e8[_0x0275('0x53')]['id']){delete _0x4097e8[_0x0275('0x53')]['id'];}return db[_0x0275('0x34')]['find']({'where':{'id':_0x4097e8['params']['id']}})[_0x0275('0x2e')](handleEntityNotFound(_0x78dc83,null))['then'](saveUpdates(_0x4097e8['body'],null))[_0x0275('0x2e')](respondWithResult(_0x78dc83,null))[_0x0275('0x51')](handleError(_0x78dc83,null));};exports[_0x0275('0x2f')]=function(_0x39961c,_0x35994c){return db[_0x0275('0x34')]['find']({'where':{'id':_0x39961c[_0x0275('0x4f')]['id']}})[_0x0275('0x2e')](handleEntityNotFound(_0x35994c,null))[_0x0275('0x2e')](removeEntity(_0x35994c,null))[_0x0275('0x51')](handleError(_0x35994c,null));};exports[_0x0275('0x54')]=function(_0x1ec297,_0x5db4ad,_0x33556f){var _0x1b516f={};var _0x569608={};var _0x19d33f;var _0x5c588d;return db[_0x0275('0x34')][_0x0275('0x55')]({'where':{'id':_0x1ec297[_0x0275('0x4f')]['id']}})[_0x0275('0x2e')](handleEntityNotFound(_0x5db4ad,null))[_0x0275('0x2e')](function(_0x7749c4){if(_0x7749c4){_0x19d33f=_0x7749c4;_0x569608[_0x0275('0x36')]=_[_0x0275('0x37')](db[_0x0275('0x56')][_0x0275('0x35')]);_0x569608[_0x0275('0x38')]=_['keys'](_0x1ec297[_0x0275('0x38')]);_0x569608[_0x0275('0x39')]=_[_0x0275('0x3a')](_0x569608['model'],_0x569608[_0x0275('0x38')]);_0x1b516f[_0x0275('0x3b')]=_['intersection'](_0x569608[_0x0275('0x36')],qs['fields'](_0x1ec297[_0x0275('0x38')][_0x0275('0x3c')]));_0x1b516f[_0x0275('0x3b')]=_0x1b516f[_0x0275('0x3b')]['length']?_0x1b516f[_0x0275('0x3b')]:_0x569608[_0x0275('0x36')];_0x1b516f[_0x0275('0x3f')]=qs[_0x0275('0x40')](_0x1ec297['query'][_0x0275('0x40')]);_0x1b516f[_0x0275('0x41')]=qs['filters'](_[_0x0275('0x42')](_0x1ec297[_0x0275('0x38')],_0x569608['filters']));if(_0x1ec297['query'][_0x0275('0x43')]){_0x1b516f[_0x0275('0x41')]=_['merge'](_0x1b516f['where'],{'$or':_[_0x0275('0x57')](_0x1b516f[_0x0275('0x3b')],function(_0x93831b){var _0x14b5ab={};_0x14b5ab[_0x93831b]={'$like':'%'+_0x1ec297[_0x0275('0x38')][_0x0275('0x43')]+'%'};return _0x14b5ab;})});}_0x1b516f=_[_0x0275('0x48')]({},_0x1b516f,_0x1ec297[_0x0275('0x49')]);return _0x19d33f['getFields'](_0x1b516f);}})[_0x0275('0x2e')](function(_0x115753){if(_0x115753){_0x5c588d=_0x115753[_0x0275('0x3d')];if(!_0x1ec297[_0x0275('0x38')][_0x0275('0x3e')](_0x0275('0x58'))){_0x1b516f['limit']=qs[_0x0275('0x29')](_0x1ec297['query'][_0x0275('0x29')]);_0x1b516f[_0x0275('0x28')]=qs[_0x0275('0x28')](_0x1ec297[_0x0275('0x38')]['offset']);}return _0x19d33f[_0x0275('0x54')](_0x1b516f);}})[_0x0275('0x2e')](function(_0x2fb691){if(_0x2fb691){return _0x2fb691?{'count':_0x5c588d,'rows':_0x2fb691}:null;}})[_0x0275('0x2e')](respondWithResult(_0x5db4ad,null))[_0x0275('0x51')](handleError(_0x5db4ad,null));};exports[_0x0275('0x59')]=function(_0x3c7845,_0xea9c40,_0x155fd9){var _0x49d39c={};var _0x5bc165={};var _0x4c25e9;var _0x1dcaa6;return db[_0x0275('0x34')][_0x0275('0x55')]({'where':{'id':_0x3c7845['params']['id']}})[_0x0275('0x2e')](handleEntityNotFound(_0xea9c40,null))[_0x0275('0x2e')](function(_0x2e7b7e){if(_0x2e7b7e){_0x4c25e9=_0x2e7b7e;_0x5bc165[_0x0275('0x36')]=_[_0x0275('0x37')](db['DeskField'][_0x0275('0x35')]);_0x5bc165['query']=_[_0x0275('0x37')](_0x3c7845[_0x0275('0x38')]);_0x5bc165[_0x0275('0x39')]=_[_0x0275('0x3a')](_0x5bc165['model'],_0x5bc165[_0x0275('0x38')]);_0x49d39c[_0x0275('0x3b')]=_[_0x0275('0x3a')](_0x5bc165['model'],qs[_0x0275('0x3c')](_0x3c7845[_0x0275('0x38')][_0x0275('0x3c')]));_0x49d39c[_0x0275('0x3b')]=_0x49d39c[_0x0275('0x3b')][_0x0275('0x3d')]?_0x49d39c[_0x0275('0x3b')]:_0x5bc165[_0x0275('0x36')];_0x49d39c['order']=qs['sort'](_0x3c7845['query'][_0x0275('0x40')]);_0x49d39c[_0x0275('0x41')]=qs[_0x0275('0x39')](_[_0x0275('0x42')](_0x3c7845[_0x0275('0x38')],_0x5bc165['filters']));if(_0x3c7845[_0x0275('0x38')]['filter']){_0x49d39c['where']=_[_0x0275('0x48')](_0x49d39c['where'],{'$or':_[_0x0275('0x57')](_0x49d39c[_0x0275('0x3b')],function(_0x1fc777){var _0x34f4b8={};_0x34f4b8[_0x1fc777]={'$like':'%'+_0x3c7845[_0x0275('0x38')][_0x0275('0x43')]+'%'};return _0x34f4b8;})});}_0x49d39c=_[_0x0275('0x48')]({},_0x49d39c,_0x3c7845[_0x0275('0x49')]);return _0x4c25e9[_0x0275('0x59')](_0x49d39c);}})[_0x0275('0x2e')](function(_0x2b8909){if(_0x2b8909){_0x1dcaa6=_0x2b8909[_0x0275('0x3d')];if(!_0x3c7845[_0x0275('0x38')][_0x0275('0x3e')](_0x0275('0x58'))){_0x49d39c[_0x0275('0x29')]=qs[_0x0275('0x29')](_0x3c7845[_0x0275('0x38')][_0x0275('0x29')]);_0x49d39c[_0x0275('0x28')]=qs[_0x0275('0x28')](_0x3c7845['query'][_0x0275('0x28')]);}return _0x4c25e9[_0x0275('0x59')](_0x49d39c);}})[_0x0275('0x2e')](function(_0x1a9540){if(_0x1a9540){return _0x1a9540?{'count':_0x1dcaa6,'rows':_0x1a9540}:null;}})[_0x0275('0x2e')](respondWithResult(_0xea9c40,null))[_0x0275('0x51')](handleError(_0xea9c40,null));};exports['getDescriptions']=function(_0x1a2ac3,_0x9476a7,_0x52e15b){var _0x14ca33={};var _0x111c75={};var _0x236039;var _0x17d994;return db['DeskConfiguration'][_0x0275('0x55')]({'where':{'id':_0x1a2ac3[_0x0275('0x4f')]['id']}})['then'](handleEntityNotFound(_0x9476a7,null))[_0x0275('0x2e')](function(_0x49a1e8){if(_0x49a1e8){_0x236039=_0x49a1e8;_0x111c75[_0x0275('0x36')]=_[_0x0275('0x37')](db['DeskField'][_0x0275('0x35')]);_0x111c75[_0x0275('0x38')]=_[_0x0275('0x37')](_0x1a2ac3[_0x0275('0x38')]);_0x111c75[_0x0275('0x39')]=_[_0x0275('0x3a')](_0x111c75[_0x0275('0x36')],_0x111c75['query']);_0x14ca33[_0x0275('0x3b')]=_[_0x0275('0x3a')](_0x111c75['model'],qs[_0x0275('0x3c')](_0x1a2ac3['query']['fields']));_0x14ca33[_0x0275('0x3b')]=_0x14ca33['attributes'][_0x0275('0x3d')]?_0x14ca33[_0x0275('0x3b')]:_0x111c75['model'];_0x14ca33[_0x0275('0x3f')]=qs[_0x0275('0x40')](_0x1a2ac3[_0x0275('0x38')]['sort']);_0x14ca33[_0x0275('0x41')]=qs['filters'](_[_0x0275('0x42')](_0x1a2ac3[_0x0275('0x38')],_0x111c75[_0x0275('0x39')]));if(_0x1a2ac3['query'][_0x0275('0x43')]){_0x14ca33[_0x0275('0x41')]=_[_0x0275('0x48')](_0x14ca33[_0x0275('0x41')],{'$or':_[_0x0275('0x57')](_0x14ca33[_0x0275('0x3b')],function(_0x5393aa){var _0x1d6a76={};_0x1d6a76[_0x5393aa]={'$like':'%'+_0x1a2ac3[_0x0275('0x38')][_0x0275('0x43')]+'%'};return _0x1d6a76;})});}_0x14ca33=_['merge']({},_0x14ca33,_0x1a2ac3[_0x0275('0x49')]);return _0x236039[_0x0275('0x5a')](_0x14ca33);}})[_0x0275('0x2e')](function(_0x53d371){if(_0x53d371){_0x17d994=_0x53d371[_0x0275('0x3d')];if(!_0x1a2ac3[_0x0275('0x38')][_0x0275('0x3e')]('nolimit')){_0x14ca33[_0x0275('0x29')]=qs[_0x0275('0x29')](_0x1a2ac3[_0x0275('0x38')][_0x0275('0x29')]);_0x14ca33[_0x0275('0x28')]=qs[_0x0275('0x28')](_0x1a2ac3[_0x0275('0x38')]['offset']);}return _0x236039['getDescriptions'](_0x14ca33);}})[_0x0275('0x2e')](function(_0x359ccc){if(_0x359ccc){return _0x359ccc?{'count':_0x17d994,'rows':_0x359ccc}:null;}})[_0x0275('0x2e')](respondWithResult(_0x9476a7,null))[_0x0275('0x51')](handleError(_0x9476a7,null));};exports[_0x0275('0x5b')]=function(_0x33064f,_0x2a42a0,_0x47fe2b){var _0x16f14c={};var _0x82548c={};var _0x5498d2;var _0x1b772d;return db['DeskConfiguration'][_0x0275('0x55')]({'where':{'id':_0x33064f[_0x0275('0x4f')]['id']}})[_0x0275('0x2e')](handleEntityNotFound(_0x2a42a0,null))[_0x0275('0x2e')](function(_0x2cbfbc){if(_0x2cbfbc){_0x5498d2=_0x2cbfbc;_0x82548c[_0x0275('0x36')]=_['keys'](db[_0x0275('0x5c')][_0x0275('0x35')]);_0x82548c[_0x0275('0x38')]=_[_0x0275('0x37')](_0x33064f[_0x0275('0x38')]);_0x82548c[_0x0275('0x39')]=_['intersection'](_0x82548c[_0x0275('0x36')],_0x82548c[_0x0275('0x38')]);_0x16f14c[_0x0275('0x3b')]=_[_0x0275('0x3a')](_0x82548c[_0x0275('0x36')],qs['fields'](_0x33064f[_0x0275('0x38')]['fields']));_0x16f14c[_0x0275('0x3b')]=_0x16f14c[_0x0275('0x3b')][_0x0275('0x3d')]?_0x16f14c[_0x0275('0x3b')]:_0x82548c[_0x0275('0x36')];_0x16f14c[_0x0275('0x3f')]=qs[_0x0275('0x40')](_0x33064f[_0x0275('0x38')][_0x0275('0x40')]);_0x16f14c[_0x0275('0x41')]=qs['filters'](_[_0x0275('0x42')](_0x33064f[_0x0275('0x38')],_0x82548c['filters']));if(_0x33064f[_0x0275('0x38')][_0x0275('0x43')]){_0x16f14c['where']=_[_0x0275('0x48')](_0x16f14c['where'],{'$or':_[_0x0275('0x57')](_0x16f14c[_0x0275('0x3b')],function(_0x1cbc90){var _0x194e4c={};_0x194e4c[_0x1cbc90]={'$like':'%'+_0x33064f[_0x0275('0x38')][_0x0275('0x43')]+'%'};return _0x194e4c;})});}_0x16f14c=_['merge']({},_0x16f14c,_0x33064f[_0x0275('0x49')]);return _0x5498d2[_0x0275('0x5b')](_0x16f14c);}})[_0x0275('0x2e')](function(_0x4afb2b){if(_0x4afb2b){_0x1b772d=_0x4afb2b[_0x0275('0x3d')];if(!_0x33064f[_0x0275('0x38')][_0x0275('0x3e')](_0x0275('0x58'))){_0x16f14c['limit']=qs[_0x0275('0x29')](_0x33064f[_0x0275('0x38')][_0x0275('0x29')]);_0x16f14c[_0x0275('0x28')]=qs[_0x0275('0x28')](_0x33064f['query'][_0x0275('0x28')]);}return _0x5498d2[_0x0275('0x5b')](_0x16f14c);}})[_0x0275('0x2e')](function(_0x2efda2){if(_0x2efda2){return _0x2efda2?{'count':_0x1b772d,'rows':_0x2efda2}:null;}})[_0x0275('0x2e')](respondWithResult(_0x2a42a0,null))[_0x0275('0x51')](handleError(_0x2a42a0,null));};exports[_0x0275('0x5d')]=function(_0x42dd4b,_0x64ed4a,_0x2d0ee9){if(_0x42dd4b['body']['id']){delete _0x42dd4b[_0x0275('0x53')]['id'];}return db[_0x0275('0x34')][_0x0275('0x55')]({'where':{'id':_0x42dd4b[_0x0275('0x4f')]['id']}})[_0x0275('0x2e')](handleEntityNotFound(_0x64ed4a,null))[_0x0275('0x2e')](function(_0x4335ec){if(_0x4335ec){return _0x4335ec[_0x0275('0x5d')](_0x42dd4b[_0x0275('0x53')][_0x0275('0x5e')]||[]);}return null;})[_0x0275('0x2e')](respondWithResult(_0x64ed4a,null))[_0x0275('0x51')](handleError(_0x64ed4a,null));};
\ No newline at end of file
+var _0x5db8=['Tag','setTags','ids','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','client','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','DeskConfiguration','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','limit','order','sort','pick','filter','merge','where','map','VIRTUAL','field','includeAll','include','findAll','rows','show','params','find','create','body','getFields','DeskField','options','hasOwnProperty','nolimit','findOne','getSubjects','getDescriptions','getTags'];(function(_0x4d43ee,_0x55edfe){var _0x233903=function(_0x2d1e0a){while(--_0x2d1e0a){_0x4d43ee['push'](_0x4d43ee['shift']());}};_0x233903(++_0x55edfe);}(_0x5db8,0xbb));var _0x85db=function(_0x3747ae,_0x408e61){_0x3747ae=_0x3747ae-0x0;var _0x339035=_0x5db8[_0x3747ae];return _0x339035;};'use strict';var pdf=require(_0x85db('0x0'));var emlformat=require(_0x85db('0x1'));var rimraf=require(_0x85db('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x85db('0x3'));var rp=require(_0x85db('0x4'));var moment=require(_0x85db('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x85db('0x6'));var path=require(_0x85db('0x7'));var sox=require(_0x85db('0x8'));var csv=require(_0x85db('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x85db('0xa'));var crypto=require(_0x85db('0xb'));var jsforce=require(_0x85db('0xc'));var deskjs=require(_0x85db('0xd'));var toCsv=require('to-csv');var querystring=require(_0x85db('0xe'));var Papa=require('papaparse');var authService=require(_0x85db('0xf'));var hardwareService=require(_0x85db('0x10'));var Redis=require(_0x85db('0x11'));var qs=require(_0x85db('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x85db('0x13'));var db=require(_0x85db('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x85db('0x15')]['http']({'port':0x232a});function respondWithRpcPromise(_0x437f7a,_0x35f8c6,_0x382c43,_0x216a41){return new BPromise(function(_0x3d0dbf,_0xb7ea66){var _0x2b7507=_0x216a41||client;return _0x2b7507[_0x85db('0x16')](_0x437f7a,_0x382c43)[_0x85db('0x17')](function(_0x415281){logger[_0x85db('0x18')](_0x85db('0x19'),_0x35f8c6,_0x85db('0x1a'));logger['debug'](_0x85db('0x1b'),_0x35f8c6,_0x85db('0x1a'),JSON[_0x85db('0x1c')](_0x415281));if(_0x415281[_0x85db('0x1d')]){if(_0x415281[_0x85db('0x1d')][_0x85db('0x1e')]===0x1f4){logger[_0x85db('0x1d')]('DeskConfiguration,\x20%s,\x20%s',_0x35f8c6,_0x415281[_0x85db('0x1d')][_0x85db('0x1f')]);return _0xb7ea66(_0x415281[_0x85db('0x1d')][_0x85db('0x1f')]);}logger[_0x85db('0x1d')](_0x85db('0x19'),_0x35f8c6,_0x415281[_0x85db('0x1d')][_0x85db('0x1f')]);return _0x3d0dbf(_0x415281[_0x85db('0x1d')][_0x85db('0x1f')]);}else{logger['info'](_0x85db('0x19'),_0x35f8c6,_0x85db('0x1a'));_0x3d0dbf(_0x415281[_0x85db('0x20')][_0x85db('0x1f')]);}})[_0x85db('0x21')](function(_0x3842d7){logger[_0x85db('0x1d')](_0x85db('0x19'),_0x35f8c6,_0x3842d7);_0xb7ea66(_0x3842d7);});});}function respondWithStatusCode(_0x4e2755,_0xfffea2){_0xfffea2=_0xfffea2||0xcc;return function(_0x2534bc){if(_0x2534bc){return _0x4e2755[_0x85db('0x22')](_0xfffea2);}return _0x4e2755[_0x85db('0x23')](_0xfffea2)[_0x85db('0x24')]();};}function respondWithResult(_0x29ca76,_0x51c948){_0x51c948=_0x51c948||0xc8;return function(_0x228f90){if(_0x228f90){return _0x29ca76[_0x85db('0x23')](_0x51c948)[_0x85db('0x25')](_0x228f90);}};}function respondWithFilteredResult(_0x54ba03,_0x5467ad){return function(_0x50ea52){if(_0x50ea52){var _0x1e4ddb=_0x50ea52[_0x85db('0x26')],_0x105bb9=_0x5467ad[_0x85db('0x27')],_0x33448e=_0x5467ad[_0x85db('0x27')]+_0x5467ad['limit'],_0x51b748;if(_0x33448e>=_0x1e4ddb){_0x33448e=_0x1e4ddb;_0x51b748=0xc8;}else{_0x51b748=0xce;}_0x54ba03['status'](_0x51b748);return _0x54ba03[_0x85db('0x28')](_0x85db('0x29'),_0x105bb9+'-'+_0x33448e+'/'+_0x1e4ddb)[_0x85db('0x25')](_0x50ea52);}return null;};}function patchUpdates(_0x226540){return function(_0x397afc){try{jsonpatch[_0x85db('0x2a')](_0x397afc,_0x226540,!![]);}catch(_0x8af4a4){return BPromise[_0x85db('0x2b')](_0x8af4a4);}return _0x397afc[_0x85db('0x2c')]();};}function saveUpdates(_0x1edc8d,_0x580e90){return function(_0x4a15b9){if(_0x4a15b9){return _0x4a15b9[_0x85db('0x2d')](_0x1edc8d)['then'](function(_0x22e404){return _0x22e404;});}return null;};}function removeEntity(_0x203cad,_0x5abdb7){return function(_0x1d15b0){if(_0x1d15b0){return _0x1d15b0[_0x85db('0x2e')]()[_0x85db('0x17')](function(){_0x203cad[_0x85db('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3079fc,_0x25f20f){return function(_0x21a077){if(!_0x21a077){_0x3079fc[_0x85db('0x22')](0x194);}return _0x21a077;};}function handleError(_0x2ec392,_0x4808a4){_0x4808a4=_0x4808a4||0x1f4;return function(_0x3279f5){logger[_0x85db('0x1d')](_0x3279f5[_0x85db('0x2f')]);if(_0x3279f5[_0x85db('0x30')]){delete _0x3279f5['name'];}_0x2ec392[_0x85db('0x23')](_0x4808a4)[_0x85db('0x31')](_0x3279f5);};}exports[_0x85db('0x32')]=function(_0x536398,_0x550194){var _0x11d5b7={},_0x3639bc={},_0x4980b7={'count':0x0,'rows':[]};var _0x33b08e=db[_0x85db('0x33')][_0x85db('0x34')];_0x3639bc[_0x85db('0x35')]=_[_0x85db('0x36')](_0x33b08e);_0x3639bc[_0x85db('0x37')]=_[_0x85db('0x36')](_0x536398[_0x85db('0x37')]);_0x3639bc[_0x85db('0x38')]=_[_0x85db('0x39')](_0x3639bc[_0x85db('0x35')],_0x3639bc[_0x85db('0x37')]);_0x11d5b7['attributes']=_[_0x85db('0x39')](_0x3639bc[_0x85db('0x35')],qs[_0x85db('0x3a')](_0x536398[_0x85db('0x37')]['fields']));_0x11d5b7[_0x85db('0x3b')]=_0x11d5b7[_0x85db('0x3b')][_0x85db('0x3c')]?_0x11d5b7[_0x85db('0x3b')]:_0x3639bc['model'];if(!_0x536398['query']['hasOwnProperty']('nolimit')){_0x11d5b7['limit']=qs[_0x85db('0x3d')](_0x536398[_0x85db('0x37')][_0x85db('0x3d')]);_0x11d5b7[_0x85db('0x27')]=qs[_0x85db('0x27')](_0x536398['query']['offset']);}_0x11d5b7[_0x85db('0x3e')]=qs['sort'](_0x536398[_0x85db('0x37')][_0x85db('0x3f')]);_0x11d5b7['where']=qs['filters'](_[_0x85db('0x40')](_0x536398[_0x85db('0x37')],_0x3639bc[_0x85db('0x38')]));if(_0x536398[_0x85db('0x37')][_0x85db('0x41')]){_0x11d5b7['where']=_[_0x85db('0x42')](_0x11d5b7[_0x85db('0x43')],{'$or':_[_0x85db('0x44')](_0x33b08e,function(_0x5be721){if(_0x5be721['type']['key']!==_0x85db('0x45')){var _0x45963b={};_0x45963b[_0x5be721[_0x85db('0x46')]]={'$like':'%'+_0x536398['query']['filter']+'%'};return _0x45963b;}})});}_0x11d5b7=_[_0x85db('0x42')]({},_0x11d5b7,_0x536398['options']);var _0x35ec12={'where':_0x11d5b7[_0x85db('0x43')]};return db[_0x85db('0x33')]['count'](_0x35ec12)[_0x85db('0x17')](function(_0x148bd6){_0x4980b7[_0x85db('0x26')]=_0x148bd6;if(_0x536398[_0x85db('0x37')][_0x85db('0x47')]){_0x11d5b7[_0x85db('0x48')]=[{'all':!![]}];}return db[_0x85db('0x33')][_0x85db('0x49')](_0x11d5b7);})[_0x85db('0x17')](function(_0x5b2b8d){_0x4980b7[_0x85db('0x4a')]=_0x5b2b8d;return _0x4980b7;})[_0x85db('0x17')](respondWithFilteredResult(_0x550194,_0x11d5b7))[_0x85db('0x21')](handleError(_0x550194,null));};exports[_0x85db('0x4b')]=function(_0x2ff8cd,_0x370a5a){var _0x4acd1c={'raw':![],'where':{'id':_0x2ff8cd[_0x85db('0x4c')]['id']}},_0x22b6bd={};_0x22b6bd[_0x85db('0x35')]=_['keys'](db['DeskConfiguration'][_0x85db('0x34')]);_0x22b6bd['query']=_[_0x85db('0x36')](_0x2ff8cd[_0x85db('0x37')]);_0x22b6bd[_0x85db('0x38')]=_[_0x85db('0x39')](_0x22b6bd[_0x85db('0x35')],_0x22b6bd['query']);_0x4acd1c['attributes']=_[_0x85db('0x39')](_0x22b6bd[_0x85db('0x35')],qs[_0x85db('0x3a')](_0x2ff8cd[_0x85db('0x37')][_0x85db('0x3a')]));_0x4acd1c[_0x85db('0x3b')]=_0x4acd1c[_0x85db('0x3b')][_0x85db('0x3c')]?_0x4acd1c[_0x85db('0x3b')]:_0x22b6bd[_0x85db('0x35')];if(_0x2ff8cd['query'][_0x85db('0x47')]){_0x4acd1c[_0x85db('0x48')]=[{'all':!![]}];}_0x4acd1c=_['merge']({},_0x4acd1c,_0x2ff8cd['options']);return db[_0x85db('0x33')][_0x85db('0x4d')](_0x4acd1c)['then'](handleEntityNotFound(_0x370a5a,null))['then'](respondWithResult(_0x370a5a,null))[_0x85db('0x21')](handleError(_0x370a5a,null));};exports[_0x85db('0x4e')]=function(_0x4b66a3,_0x101388){return db[_0x85db('0x33')][_0x85db('0x4e')](_0x4b66a3[_0x85db('0x4f')],{})[_0x85db('0x17')](respondWithResult(_0x101388,0xc9))[_0x85db('0x21')](handleError(_0x101388,null));};exports[_0x85db('0x2d')]=function(_0x438ce7,_0x32826f){if(_0x438ce7[_0x85db('0x4f')]['id']){delete _0x438ce7['body']['id'];}return db['DeskConfiguration'][_0x85db('0x4d')]({'where':{'id':_0x438ce7[_0x85db('0x4c')]['id']}})[_0x85db('0x17')](handleEntityNotFound(_0x32826f,null))[_0x85db('0x17')](saveUpdates(_0x438ce7[_0x85db('0x4f')],null))[_0x85db('0x17')](respondWithResult(_0x32826f,null))[_0x85db('0x21')](handleError(_0x32826f,null));};exports[_0x85db('0x2e')]=function(_0x34b54e,_0x1e6f60){return db[_0x85db('0x33')][_0x85db('0x4d')]({'where':{'id':_0x34b54e[_0x85db('0x4c')]['id']}})[_0x85db('0x17')](handleEntityNotFound(_0x1e6f60,null))['then'](removeEntity(_0x1e6f60,null))[_0x85db('0x21')](handleError(_0x1e6f60,null));};exports[_0x85db('0x50')]=function(_0x48a6bf,_0x160023,_0x40a009){var _0x88cfa6={};var _0x39e0cb={};var _0x992a63;var _0x33be65;return db[_0x85db('0x33')]['findOne']({'where':{'id':_0x48a6bf[_0x85db('0x4c')]['id']}})[_0x85db('0x17')](handleEntityNotFound(_0x160023,null))['then'](function(_0x5b38c6){if(_0x5b38c6){_0x992a63=_0x5b38c6;_0x39e0cb[_0x85db('0x35')]=_['keys'](db[_0x85db('0x51')][_0x85db('0x34')]);_0x39e0cb[_0x85db('0x37')]=_[_0x85db('0x36')](_0x48a6bf['query']);_0x39e0cb[_0x85db('0x38')]=_['intersection'](_0x39e0cb['model'],_0x39e0cb['query']);_0x88cfa6[_0x85db('0x3b')]=_[_0x85db('0x39')](_0x39e0cb['model'],qs[_0x85db('0x3a')](_0x48a6bf[_0x85db('0x37')]['fields']));_0x88cfa6[_0x85db('0x3b')]=_0x88cfa6[_0x85db('0x3b')][_0x85db('0x3c')]?_0x88cfa6[_0x85db('0x3b')]:_0x39e0cb[_0x85db('0x35')];_0x88cfa6[_0x85db('0x3e')]=qs['sort'](_0x48a6bf[_0x85db('0x37')][_0x85db('0x3f')]);_0x88cfa6[_0x85db('0x43')]=qs[_0x85db('0x38')](_[_0x85db('0x40')](_0x48a6bf[_0x85db('0x37')],_0x39e0cb[_0x85db('0x38')]));if(_0x48a6bf[_0x85db('0x37')]['filter']){_0x88cfa6['where']=_['merge'](_0x88cfa6['where'],{'$or':_[_0x85db('0x44')](_0x88cfa6[_0x85db('0x3b')],function(_0x88626d){var _0x239027={};_0x239027[_0x88626d]={'$like':'%'+_0x48a6bf[_0x85db('0x37')][_0x85db('0x41')]+'%'};return _0x239027;})});}_0x88cfa6=_['merge']({},_0x88cfa6,_0x48a6bf[_0x85db('0x52')]);return _0x992a63[_0x85db('0x50')](_0x88cfa6);}})[_0x85db('0x17')](function(_0x19f37e){if(_0x19f37e){_0x33be65=_0x19f37e['length'];if(!_0x48a6bf[_0x85db('0x37')][_0x85db('0x53')](_0x85db('0x54'))){_0x88cfa6[_0x85db('0x3d')]=qs[_0x85db('0x3d')](_0x48a6bf[_0x85db('0x37')][_0x85db('0x3d')]);_0x88cfa6[_0x85db('0x27')]=qs[_0x85db('0x27')](_0x48a6bf[_0x85db('0x37')]['offset']);}return _0x992a63[_0x85db('0x50')](_0x88cfa6);}})[_0x85db('0x17')](function(_0x40ccc6){if(_0x40ccc6){return _0x40ccc6?{'count':_0x33be65,'rows':_0x40ccc6}:null;}})[_0x85db('0x17')](respondWithResult(_0x160023,null))[_0x85db('0x21')](handleError(_0x160023,null));};exports['getSubjects']=function(_0x3434be,_0x12e96e,_0x1ebe67){var _0x1da7ed={};var _0x20c059={};var _0x51ff84;var _0x1a9f92;return db[_0x85db('0x33')][_0x85db('0x55')]({'where':{'id':_0x3434be['params']['id']}})[_0x85db('0x17')](handleEntityNotFound(_0x12e96e,null))[_0x85db('0x17')](function(_0x1b7d90){if(_0x1b7d90){_0x51ff84=_0x1b7d90;_0x20c059['model']=_[_0x85db('0x36')](db[_0x85db('0x51')]['rawAttributes']);_0x20c059[_0x85db('0x37')]=_[_0x85db('0x36')](_0x3434be[_0x85db('0x37')]);_0x20c059[_0x85db('0x38')]=_[_0x85db('0x39')](_0x20c059[_0x85db('0x35')],_0x20c059[_0x85db('0x37')]);_0x1da7ed[_0x85db('0x3b')]=_[_0x85db('0x39')](_0x20c059[_0x85db('0x35')],qs[_0x85db('0x3a')](_0x3434be[_0x85db('0x37')][_0x85db('0x3a')]));_0x1da7ed[_0x85db('0x3b')]=_0x1da7ed[_0x85db('0x3b')]['length']?_0x1da7ed[_0x85db('0x3b')]:_0x20c059[_0x85db('0x35')];_0x1da7ed[_0x85db('0x3e')]=qs[_0x85db('0x3f')](_0x3434be['query']['sort']);_0x1da7ed[_0x85db('0x43')]=qs['filters'](_[_0x85db('0x40')](_0x3434be[_0x85db('0x37')],_0x20c059[_0x85db('0x38')]));if(_0x3434be['query'][_0x85db('0x41')]){_0x1da7ed[_0x85db('0x43')]=_[_0x85db('0x42')](_0x1da7ed[_0x85db('0x43')],{'$or':_['map'](_0x1da7ed[_0x85db('0x3b')],function(_0x5f1627){var _0x145c78={};_0x145c78[_0x5f1627]={'$like':'%'+_0x3434be[_0x85db('0x37')][_0x85db('0x41')]+'%'};return _0x145c78;})});}_0x1da7ed=_[_0x85db('0x42')]({},_0x1da7ed,_0x3434be[_0x85db('0x52')]);return _0x51ff84[_0x85db('0x56')](_0x1da7ed);}})[_0x85db('0x17')](function(_0x3a9bb3){if(_0x3a9bb3){_0x1a9f92=_0x3a9bb3[_0x85db('0x3c')];if(!_0x3434be[_0x85db('0x37')][_0x85db('0x53')](_0x85db('0x54'))){_0x1da7ed[_0x85db('0x3d')]=qs['limit'](_0x3434be[_0x85db('0x37')]['limit']);_0x1da7ed[_0x85db('0x27')]=qs[_0x85db('0x27')](_0x3434be['query'][_0x85db('0x27')]);}return _0x51ff84[_0x85db('0x56')](_0x1da7ed);}})[_0x85db('0x17')](function(_0x502300){if(_0x502300){return _0x502300?{'count':_0x1a9f92,'rows':_0x502300}:null;}})[_0x85db('0x17')](respondWithResult(_0x12e96e,null))['catch'](handleError(_0x12e96e,null));};exports[_0x85db('0x57')]=function(_0x58382d,_0x2b6490,_0x2e68cc){var _0x542be6={};var _0x38a5ea={};var _0x41c946;var _0x10801b;return db[_0x85db('0x33')][_0x85db('0x55')]({'where':{'id':_0x58382d[_0x85db('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2b6490,null))[_0x85db('0x17')](function(_0x1e8249){if(_0x1e8249){_0x41c946=_0x1e8249;_0x38a5ea[_0x85db('0x35')]=_['keys'](db[_0x85db('0x51')][_0x85db('0x34')]);_0x38a5ea[_0x85db('0x37')]=_[_0x85db('0x36')](_0x58382d[_0x85db('0x37')]);_0x38a5ea[_0x85db('0x38')]=_[_0x85db('0x39')](_0x38a5ea[_0x85db('0x35')],_0x38a5ea[_0x85db('0x37')]);_0x542be6[_0x85db('0x3b')]=_[_0x85db('0x39')](_0x38a5ea['model'],qs[_0x85db('0x3a')](_0x58382d[_0x85db('0x37')][_0x85db('0x3a')]));_0x542be6['attributes']=_0x542be6[_0x85db('0x3b')]['length']?_0x542be6[_0x85db('0x3b')]:_0x38a5ea['model'];_0x542be6[_0x85db('0x3e')]=qs['sort'](_0x58382d[_0x85db('0x37')]['sort']);_0x542be6[_0x85db('0x43')]=qs[_0x85db('0x38')](_['pick'](_0x58382d[_0x85db('0x37')],_0x38a5ea['filters']));if(_0x58382d['query'][_0x85db('0x41')]){_0x542be6[_0x85db('0x43')]=_[_0x85db('0x42')](_0x542be6[_0x85db('0x43')],{'$or':_[_0x85db('0x44')](_0x542be6[_0x85db('0x3b')],function(_0x5731b8){var _0x45c568={};_0x45c568[_0x5731b8]={'$like':'%'+_0x58382d[_0x85db('0x37')][_0x85db('0x41')]+'%'};return _0x45c568;})});}_0x542be6=_[_0x85db('0x42')]({},_0x542be6,_0x58382d[_0x85db('0x52')]);return _0x41c946['getDescriptions'](_0x542be6);}})[_0x85db('0x17')](function(_0x513fe7){if(_0x513fe7){_0x10801b=_0x513fe7[_0x85db('0x3c')];if(!_0x58382d[_0x85db('0x37')][_0x85db('0x53')]('nolimit')){_0x542be6['limit']=qs[_0x85db('0x3d')](_0x58382d['query']['limit']);_0x542be6['offset']=qs[_0x85db('0x27')](_0x58382d[_0x85db('0x37')][_0x85db('0x27')]);}return _0x41c946[_0x85db('0x57')](_0x542be6);}})[_0x85db('0x17')](function(_0x181f74){if(_0x181f74){return _0x181f74?{'count':_0x10801b,'rows':_0x181f74}:null;}})[_0x85db('0x17')](respondWithResult(_0x2b6490,null))['catch'](handleError(_0x2b6490,null));};exports[_0x85db('0x58')]=function(_0x2694c9,_0x43d786,_0x325c99){var _0x34d5f8={};var _0x44f014={};var _0x5abb8e;var _0x7b7204;return db['DeskConfiguration']['findOne']({'where':{'id':_0x2694c9[_0x85db('0x4c')]['id']}})[_0x85db('0x17')](handleEntityNotFound(_0x43d786,null))[_0x85db('0x17')](function(_0x17c97e){if(_0x17c97e){_0x5abb8e=_0x17c97e;_0x44f014[_0x85db('0x35')]=_[_0x85db('0x36')](db[_0x85db('0x59')][_0x85db('0x34')]);_0x44f014['query']=_[_0x85db('0x36')](_0x2694c9[_0x85db('0x37')]);_0x44f014[_0x85db('0x38')]=_[_0x85db('0x39')](_0x44f014[_0x85db('0x35')],_0x44f014['query']);_0x34d5f8[_0x85db('0x3b')]=_[_0x85db('0x39')](_0x44f014[_0x85db('0x35')],qs[_0x85db('0x3a')](_0x2694c9[_0x85db('0x37')]['fields']));_0x34d5f8[_0x85db('0x3b')]=_0x34d5f8[_0x85db('0x3b')]['length']?_0x34d5f8[_0x85db('0x3b')]:_0x44f014[_0x85db('0x35')];_0x34d5f8[_0x85db('0x3e')]=qs[_0x85db('0x3f')](_0x2694c9['query'][_0x85db('0x3f')]);_0x34d5f8['where']=qs[_0x85db('0x38')](_[_0x85db('0x40')](_0x2694c9[_0x85db('0x37')],_0x44f014['filters']));if(_0x2694c9[_0x85db('0x37')][_0x85db('0x41')]){_0x34d5f8[_0x85db('0x43')]=_[_0x85db('0x42')](_0x34d5f8['where'],{'$or':_[_0x85db('0x44')](_0x34d5f8['attributes'],function(_0x10fe07){var _0xec5d61={};_0xec5d61[_0x10fe07]={'$like':'%'+_0x2694c9['query']['filter']+'%'};return _0xec5d61;})});}_0x34d5f8=_[_0x85db('0x42')]({},_0x34d5f8,_0x2694c9['options']);return _0x5abb8e[_0x85db('0x58')](_0x34d5f8);}})[_0x85db('0x17')](function(_0x5cede6){if(_0x5cede6){_0x7b7204=_0x5cede6[_0x85db('0x3c')];if(!_0x2694c9[_0x85db('0x37')][_0x85db('0x53')]('nolimit')){_0x34d5f8['limit']=qs['limit'](_0x2694c9[_0x85db('0x37')][_0x85db('0x3d')]);_0x34d5f8[_0x85db('0x27')]=qs[_0x85db('0x27')](_0x2694c9[_0x85db('0x37')][_0x85db('0x27')]);}return _0x5abb8e[_0x85db('0x58')](_0x34d5f8);}})[_0x85db('0x17')](function(_0x25df4a){if(_0x25df4a){return _0x25df4a?{'count':_0x7b7204,'rows':_0x25df4a}:null;}})[_0x85db('0x17')](respondWithResult(_0x43d786,null))['catch'](handleError(_0x43d786,null));};exports[_0x85db('0x5a')]=function(_0x3447dd,_0x3a11e8,_0x216ccf){if(_0x3447dd[_0x85db('0x4f')]['id']){delete _0x3447dd[_0x85db('0x4f')]['id'];}return db[_0x85db('0x33')][_0x85db('0x55')]({'where':{'id':_0x3447dd['params']['id']}})[_0x85db('0x17')](handleEntityNotFound(_0x3a11e8,null))[_0x85db('0x17')](function(_0x3e3a89){if(_0x3e3a89){return _0x3e3a89[_0x85db('0x5a')](_0x3447dd[_0x85db('0x4f')][_0x85db('0x5b')]||[]);}return null;})['then'](respondWithResult(_0x3a11e8,null))[_0x85db('0x21')](handleError(_0x3a11e8,null));};
\ No newline at end of file
index 07ca128..7388f1e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5c00=['DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','moment','request-promise','./intDeskConfiguration.attributes','exports','define'];(function(_0x11ca72,_0x2466c4){var _0x50263a=function(_0x1009e2){while(--_0x1009e2){_0x11ca72['push'](_0x11ca72['shift']());}};_0x50263a(++_0x2466c4);}(_0x5c00,0x17e));var _0x05c0=function(_0xe09d0,_0x1e55d0){_0xe09d0=_0xe09d0-0x0;var _0x44ad05=_0x5c00[_0xe09d0];return _0x44ad05;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var logger=require(_0x05c0('0x2'))('api');var moment=require(_0x05c0('0x3'));var BPromise=require('bluebird');var rp=require(_0x05c0('0x4'));var attributes=require(_0x05c0('0x5'));module[_0x05c0('0x6')]=function(_0x28d9c7,_0x565efc){return _0x28d9c7[_0x05c0('0x7')](_0x05c0('0x8'),attributes,{'tableName':_0x05c0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xb03e=['DeskConfiguration','util','../../config/logger','api','moment','bluebird','request-promise','./intDeskConfiguration.attributes','exports','define'];(function(_0x4151c1,_0x36de92){var _0x5a513f=function(_0x5c59ef){while(--_0x5c59ef){_0x4151c1['push'](_0x4151c1['shift']());}};_0x5a513f(++_0x36de92);}(_0xb03e,0x1eb));var _0xeb03=function(_0x36a2f1,_0x55e439){_0x36a2f1=_0x36a2f1-0x0;var _0x5d999d=_0xb03e[_0x36a2f1];return _0x5d999d;};'use strict';var _=require('lodash');var util=require(_0xeb03('0x0'));var logger=require(_0xeb03('0x1'))(_0xeb03('0x2'));var moment=require(_0xeb03('0x3'));var BPromise=require(_0xeb03('0x4'));var rp=require(_0xeb03('0x5'));var attributes=require(_0xeb03('0x6'));module[_0xeb03('0x7')]=function(_0x474450,_0x3ba4b0){return _0x474450[_0xeb03('0x8')](_0xeb03('0x9'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index d97e41a..958976b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x4737ab,_0x583ebf){var _0x380c2c=function(_0x372f93){while(--_0x372f93){_0x4737ab['push'](_0x4737ab['shift']());}};_0x380c2c(++_0x583ebf);}(_0xabce,0x103));var _0xeabc=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xabce[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('DeskConfiguration,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});}
\ No newline at end of file
+var _0x187d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x14b43d,_0x199059){var _0x37f5d9=function(_0x2c0a24){while(--_0x2c0a24){_0x14b43d['push'](_0x14b43d['shift']());}};_0x37f5d9(++_0x199059);}(_0x187d,0x93));var _0xd187=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x187d[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444a60,_0x1d3fe4,_0x28ce2f){return new BPromise(function(_0x2d6992,_0x358c45){return client[_0xd187('0xb')](_0x444a60,_0x28ce2f)['then'](function(_0x342539){logger[_0xd187('0xc')](_0xd187('0xd'),_0x1d3fe4,_0xd187('0xe'));logger[_0xd187('0xf')](_0xd187('0x10'),_0x1d3fe4,'request\x20sent',JSON[_0xd187('0x11')](_0x342539));if(_0x342539[_0xd187('0x12')]){if(_0x342539[_0xd187('0x12')]['code']===0x1f4){logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539[_0xd187('0x12')]['message']);return _0x358c45(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539['error'][_0xd187('0x13')]);return _0x2d6992(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}else{logger[_0xd187('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x1d3fe4,_0xd187('0xe'));_0x2d6992(_0x342539['result']['message']);}})[_0xd187('0x14')](function(_0x5a4986){logger['error'](_0xd187('0xd'),_0x1d3fe4,_0x5a4986);_0x358c45(_0x5a4986);});});}
\ No newline at end of file
index 1c94a9c..d321a66 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe31a=['update','delete','destroy','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','put'];(function(_0x1eda3b,_0x4d954d){var _0x526ec6=function(_0x3ca7bd){while(--_0x3ca7bd){_0x1eda3b['push'](_0x1eda3b['shift']());}};_0x526ec6(++_0x4d954d);}(_0xe31a,0xdb));var _0xae31=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xe31a[_0x4b7895];return _0x264180;};'use strict';var multer=require(_0xae31('0x0'));var util=require(_0xae31('0x1'));var path=require(_0xae31('0x2'));var timeout=require('connect-timeout');var express=require(_0xae31('0x3'));var router=express['Router']();var auth=require(_0xae31('0x4'));var interaction=require(_0xae31('0x5'));var config=require(_0xae31('0x6'));var controller=require(_0xae31('0x7'));router[_0xae31('0x8')]('/',auth[_0xae31('0x9')](),controller[_0xae31('0xa')]);router[_0xae31('0x8')](_0xae31('0xb'),auth[_0xae31('0x9')](),controller[_0xae31('0xc')]);router[_0xae31('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xae31('0xe')]('/:id',auth[_0xae31('0x9')](),controller[_0xae31('0xf')]);router[_0xae31('0x10')](_0xae31('0xb'),auth['isAuthenticated'](),controller[_0xae31('0x11')]);module['exports']=router;
\ No newline at end of file
+var _0xe1a2=['express','Router','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x30a86b,_0x476e32){var _0x4485a5=function(_0x19293f){while(--_0x19293f){_0x30a86b['push'](_0x30a86b['shift']());}};_0x4485a5(++_0x476e32);}(_0xe1a2,0xba));var _0x2e1a=function(_0x4afac5,_0x1ab4ed){_0x4afac5=_0x4afac5-0x0;var _0x2404b3=_0xe1a2[_0x4afac5];return _0x2404b3;};'use strict';var multer=require(_0x2e1a('0x0'));var util=require(_0x2e1a('0x1'));var path=require(_0x2e1a('0x2'));var timeout=require(_0x2e1a('0x3'));var express=require(_0x2e1a('0x4'));var router=express[_0x2e1a('0x5')]();var auth=require(_0x2e1a('0x6'));var interaction=require(_0x2e1a('0x7'));var config=require('../../config/environment');var controller=require(_0x2e1a('0x8'));router['get']('/',auth[_0x2e1a('0x9')](),controller[_0x2e1a('0xa')]);router['get'](_0x2e1a('0xb'),auth[_0x2e1a('0x9')](),controller[_0x2e1a('0xc')]);router[_0x2e1a('0xd')]('/',auth[_0x2e1a('0x9')](),controller[_0x2e1a('0xe')]);router[_0x2e1a('0xf')](_0x2e1a('0xb'),auth[_0x2e1a('0x9')](),controller['update']);router[_0x2e1a('0x10')](_0x2e1a('0xb'),auth[_0x2e1a('0x9')](),controller[_0x2e1a('0x11')]);module[_0x2e1a('0x12')]=router;
\ No newline at end of file
index e189b2e..2eb2b0e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xee5b=['keyValue','STRING','variable','sequelize','ENUM','string','customVariable'];(function(_0x22d05d,_0x16b544){var _0x366fc2=function(_0x543ad5){while(--_0x543ad5){_0x22d05d['push'](_0x22d05d['shift']());}};_0x366fc2(++_0x16b544);}(_0xee5b,0x1f4));var _0xbee5=function(_0x485dbf,_0x122d63){_0x485dbf=_0x485dbf-0x0;var _0x22a771=_0xee5b[_0x485dbf];return _0x22a771;};'use strict';var Sequelize=require(_0xbee5('0x0'));module['exports']={'type':{'type':Sequelize[_0xbee5('0x1')](_0xbee5('0x2'),'variable',_0xbee5('0x3'),_0xbee5('0x4')),'defaultValue':_0xbee5('0x2')},'content':{'type':Sequelize[_0xbee5('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xbee5('0x2'),_0xbee5('0x6'),_0xbee5('0x3'))},'keyContent':{'type':Sequelize[_0xbee5('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x4483=['customVariable','keyValue','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x1ea26a,_0x2959ef){var _0x1aee96=function(_0x510a28){while(--_0x510a28){_0x1ea26a['push'](_0x1ea26a['shift']());}};_0x1aee96(++_0x2959ef);}(_0x4483,0x1a3));var _0x3448=function(_0x3cddb3,_0x681f3f){_0x3cddb3=_0x3cddb3-0x0;var _0x1c3563=_0x4483[_0x3cddb3];return _0x1c3563;};'use strict';var Sequelize=require(_0x3448('0x0'));module[_0x3448('0x1')]={'type':{'type':Sequelize[_0x3448('0x2')]('string',_0x3448('0x3'),_0x3448('0x4'),_0x3448('0x5')),'defaultValue':_0x3448('0x6')},'content':{'type':Sequelize[_0x3448('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3448('0x2')](_0x3448('0x6'),_0x3448('0x3'),_0x3448('0x4'))},'keyContent':{'type':Sequelize[_0x3448('0x7')]},'idField':{'type':Sequelize[_0x3448('0x7')]},'nameField':{'type':Sequelize[_0x3448('0x7')]},'customField':{'type':Sequelize[_0x3448('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}};
\ No newline at end of file
index ae9b01f..9b308f0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0713=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','set','Content-Range','json','apply','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','DeskField','rawAttributes','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','map','key','VIRTUAL','field','include','findAll','catch','show','params','length','includeAll','options','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path'];(function(_0x5c3750,_0x4a06b0){var _0xce7d7c=function(_0x41658b){while(--_0x41658b){_0x5c3750['push'](_0x5c3750['shift']());}};_0xce7d7c(++_0x4a06b0);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x9'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var authService=require(_0x3071('0x11'));var hardwareService=require(_0x3071('0x12'));var Redis=require(_0x3071('0x13'));var qs=require(_0x3071('0x14'));var logger=require(_0x3071('0x15'))('api');var utils=require(_0x3071('0x16'));var config=require(_0x3071('0x17'));var db=require(_0x3071('0x18'))['db'];function respondWithStatusCode(_0x3ed4a0,_0xa0c1){_0xa0c1=_0xa0c1||0xcc;return function(_0x4a8cc7){if(_0x4a8cc7){return _0x3ed4a0['sendStatus'](_0xa0c1);}return _0x3ed4a0[_0x3071('0x19')](_0xa0c1)['end']();};}function respondWithResult(_0x31c220,_0x44fbae){_0x44fbae=_0x44fbae||0xc8;return function(_0x5d4883){if(_0x5d4883){return _0x31c220[_0x3071('0x19')](_0x44fbae)['json'](_0x5d4883);}};}function respondWithFilteredResult(_0x2fc15d,_0x45c93b){return function(_0x1271d0){if(_0x1271d0){var _0x1f14e1=_0x1271d0[_0x3071('0x1a')],_0x1caa5d=_0x45c93b[_0x3071('0x1b')],_0x2a6a4b=_0x45c93b[_0x3071('0x1b')]+_0x45c93b['limit'],_0x157a47;if(_0x2a6a4b>=_0x1f14e1){_0x2a6a4b=_0x1f14e1;_0x157a47=0xc8;}else{_0x157a47=0xce;}_0x2fc15d[_0x3071('0x19')](_0x157a47);return _0x2fc15d[_0x3071('0x1c')](_0x3071('0x1d'),_0x1caa5d+'-'+_0x2a6a4b+'/'+_0x1f14e1)[_0x3071('0x1e')](_0x1271d0);}return null;};}function patchUpdates(_0x3acf0e){return function(_0x17aee2){try{jsonpatch[_0x3071('0x1f')](_0x17aee2,_0x3acf0e,!![]);}catch(_0x26f113){return BPromise['reject'](_0x26f113);}return _0x17aee2[_0x3071('0x20')]();};}function saveUpdates(_0x2bfa33,_0xd3e23d){return function(_0x56c267){if(_0x56c267){return _0x56c267[_0x3071('0x21')](_0x2bfa33)['then'](function(_0x833074){return _0x833074;});}return null;};}function removeEntity(_0x43128c,_0x3762d8){return function(_0x457b57){if(_0x457b57){return _0x457b57[_0x3071('0x22')]()[_0x3071('0x23')](function(){_0x43128c[_0x3071('0x19')](0xcc)[_0x3071('0x24')]();});}};}function handleEntityNotFound(_0x542646,_0x481a51){return function(_0x2ce48a){if(!_0x2ce48a){_0x542646[_0x3071('0x25')](0x194);}return _0x2ce48a;};}function handleError(_0x412652,_0x13df9f){_0x13df9f=_0x13df9f||0x1f4;return function(_0x2793ef){logger[_0x3071('0x26')](_0x2793ef[_0x3071('0x27')]);if(_0x2793ef[_0x3071('0x28')]){delete _0x2793ef[_0x3071('0x28')];}_0x412652['status'](_0x13df9f)[_0x3071('0x29')](_0x2793ef);};}exports[_0x3071('0x2a')]=function(_0x177138,_0x4d5c4b){var _0x4fb1ca={},_0x28792d={},_0x163604={'count':0x0,'rows':[]};var _0x950fde=db[_0x3071('0x2b')][_0x3071('0x2c')];_0x28792d[_0x3071('0x2d')]=_[_0x3071('0x2e')](_0x950fde);_0x28792d[_0x3071('0x2f')]=_[_0x3071('0x2e')](_0x177138[_0x3071('0x2f')]);_0x28792d['filters']=_['intersection'](_0x28792d[_0x3071('0x2d')],_0x28792d[_0x3071('0x2f')]);_0x4fb1ca[_0x3071('0x30')]=_[_0x3071('0x31')](_0x28792d[_0x3071('0x2d')],qs[_0x3071('0x32')](_0x177138[_0x3071('0x2f')][_0x3071('0x32')]));_0x4fb1ca['attributes']=_0x4fb1ca['attributes']['length']?_0x4fb1ca[_0x3071('0x30')]:_0x28792d[_0x3071('0x2d')];if(!_0x177138['query'][_0x3071('0x33')](_0x3071('0x34'))){_0x4fb1ca[_0x3071('0x35')]=qs[_0x3071('0x35')](_0x177138['query'][_0x3071('0x35')]);_0x4fb1ca[_0x3071('0x1b')]=qs[_0x3071('0x1b')](_0x177138[_0x3071('0x2f')][_0x3071('0x1b')]);}_0x4fb1ca[_0x3071('0x36')]=qs[_0x3071('0x37')](_0x177138[_0x3071('0x2f')]['sort']);_0x4fb1ca[_0x3071('0x38')]=qs['filters'](_['pick'](_0x177138[_0x3071('0x2f')],_0x28792d[_0x3071('0x39')]));if(_0x177138['query'][_0x3071('0x3a')]){_0x4fb1ca[_0x3071('0x38')]=_[_0x3071('0x3b')](_0x4fb1ca[_0x3071('0x38')],{'$or':_[_0x3071('0x3c')](_0x950fde,function(_0x232235){if(_0x232235['type'][_0x3071('0x3d')]!==_0x3071('0x3e')){var _0x4ce6d4={};_0x4ce6d4[_0x232235[_0x3071('0x3f')]]={'$like':'%'+_0x177138['query'][_0x3071('0x3a')]+'%'};return _0x4ce6d4;}})});}_0x4fb1ca=_[_0x3071('0x3b')]({},_0x4fb1ca,_0x177138['options']);var _0x593c99={'where':_0x4fb1ca[_0x3071('0x38')]};return db[_0x3071('0x2b')][_0x3071('0x1a')](_0x593c99)['then'](function(_0x4dea69){_0x163604['count']=_0x4dea69;if(_0x177138[_0x3071('0x2f')]['includeAll']){_0x4fb1ca[_0x3071('0x40')]=[{'all':!![]}];}return db[_0x3071('0x2b')][_0x3071('0x41')](_0x4fb1ca);})[_0x3071('0x23')](function(_0x30ab68){_0x163604['rows']=_0x30ab68;return _0x163604;})['then'](respondWithFilteredResult(_0x4d5c4b,_0x4fb1ca))[_0x3071('0x42')](handleError(_0x4d5c4b,null));};exports[_0x3071('0x43')]=function(_0x1455be,_0x1f69a6){var _0x525389={'raw':!![],'where':{'id':_0x1455be[_0x3071('0x44')]['id']}},_0x3cfc05={};_0x3cfc05[_0x3071('0x2d')]=_[_0x3071('0x2e')](db[_0x3071('0x2b')][_0x3071('0x2c')]);_0x3cfc05['query']=_[_0x3071('0x2e')](_0x1455be['query']);_0x3cfc05['filters']=_['intersection'](_0x3cfc05['model'],_0x3cfc05[_0x3071('0x2f')]);_0x525389[_0x3071('0x30')]=_[_0x3071('0x31')](_0x3cfc05[_0x3071('0x2d')],qs[_0x3071('0x32')](_0x1455be[_0x3071('0x2f')][_0x3071('0x32')]));_0x525389[_0x3071('0x30')]=_0x525389['attributes'][_0x3071('0x45')]?_0x525389[_0x3071('0x30')]:_0x3cfc05[_0x3071('0x2d')];if(_0x1455be[_0x3071('0x2f')][_0x3071('0x46')]){_0x525389['include']=[{'all':!![]}];}_0x525389=_['merge']({},_0x525389,_0x1455be[_0x3071('0x47')]);return db[_0x3071('0x2b')][_0x3071('0x48')](_0x525389)[_0x3071('0x23')](handleEntityNotFound(_0x1f69a6,null))[_0x3071('0x23')](respondWithResult(_0x1f69a6,null))['catch'](handleError(_0x1f69a6,null));};exports[_0x3071('0x49')]=function(_0x4a1d29,_0x18a773){return db['DeskField']['create'](_0x4a1d29[_0x3071('0x4a')],{})['then'](respondWithResult(_0x18a773,0xc9))[_0x3071('0x42')](handleError(_0x18a773,null));};exports['update']=function(_0x717c43,_0x1d75e5){if(_0x717c43[_0x3071('0x4a')]['id']){delete _0x717c43[_0x3071('0x4a')]['id'];}return db['DeskField'][_0x3071('0x48')]({'where':{'id':_0x717c43['params']['id']}})[_0x3071('0x23')](handleEntityNotFound(_0x1d75e5,null))['then'](saveUpdates(_0x717c43[_0x3071('0x4a')],null))[_0x3071('0x23')](respondWithResult(_0x1d75e5,null))['catch'](handleError(_0x1d75e5,null));};exports[_0x3071('0x22')]=function(_0x117e73,_0x224a70){return db[_0x3071('0x2b')][_0x3071('0x48')]({'where':{'id':_0x117e73[_0x3071('0x44')]['id']}})[_0x3071('0x23')](handleEntityNotFound(_0x224a70,null))['then'](removeEntity(_0x224a70,null))[_0x3071('0x42')](handleError(_0x224a70,null));};
\ No newline at end of file
+var _0x9c44=['ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','sendStatus','status','json','count','offset','limit','save','update','then','error','stack','name','send','index','DeskField','rawAttributes','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','key','field','options','includeAll','include','findAll','catch','show','params','fields','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv'];(function(_0x5ede66,_0x561d8b){var _0x5c910c=function(_0x72444){while(--_0x72444){_0x5ede66['push'](_0x5ede66['shift']());}};_0x5c910c(++_0x561d8b);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49c4('0x0'));var zipdir=require(_0x49c4('0x1'));var jsonpatch=require(_0x49c4('0x2'));var rp=require(_0x49c4('0x3'));var moment=require(_0x49c4('0x4'));var BPromise=require(_0x49c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49c4('0x6'));var sox=require('sox');var csv=require(_0x49c4('0x7'));var ejs=require(_0x49c4('0x8'));var fs=require('fs');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('0x7'));var querystring=require(_0x49c4('0xd'));var Papa=require(_0x49c4('0xe'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x49c4('0xf'));var qs=require(_0x49c4('0x10'));var logger=require('../../config/logger')(_0x49c4('0x11'));var utils=require(_0x49c4('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d19bf,_0x6d1b08){_0x6d1b08=_0x6d1b08||0xcc;return function(_0x5487cd){if(_0x5487cd){return _0x1d19bf[_0x49c4('0x13')](_0x6d1b08);}return _0x1d19bf[_0x49c4('0x14')](_0x6d1b08)['end']();};}function respondWithResult(_0x1909fe,_0x280996){_0x280996=_0x280996||0xc8;return function(_0x21f15a){if(_0x21f15a){return _0x1909fe[_0x49c4('0x14')](_0x280996)[_0x49c4('0x15')](_0x21f15a);}};}function respondWithFilteredResult(_0x18211c,_0x75ea8){return function(_0x3de397){if(_0x3de397){var _0x58d177=_0x3de397[_0x49c4('0x16')],_0x3acd06=_0x75ea8[_0x49c4('0x17')],_0x141003=_0x75ea8['offset']+_0x75ea8[_0x49c4('0x18')],_0x13a2db;if(_0x141003>=_0x58d177){_0x141003=_0x58d177;_0x13a2db=0xc8;}else{_0x13a2db=0xce;}_0x18211c[_0x49c4('0x14')](_0x13a2db);return _0x18211c['set']('Content-Range',_0x3acd06+'-'+_0x141003+'/'+_0x58d177)[_0x49c4('0x15')](_0x3de397);}return null;};}function patchUpdates(_0x2f82d5){return function(_0x3addb2){try{jsonpatch['apply'](_0x3addb2,_0x2f82d5,!![]);}catch(_0x24856d){return BPromise['reject'](_0x24856d);}return _0x3addb2[_0x49c4('0x19')]();};}function saveUpdates(_0x1806c2,_0xe31fcc){return function(_0x291526){if(_0x291526){return _0x291526[_0x49c4('0x1a')](_0x1806c2)[_0x49c4('0x1b')](function(_0x280893){return _0x280893;});}return null;};}function removeEntity(_0x46e475,_0x2197d2){return function(_0x578447){if(_0x578447){return _0x578447['destroy']()['then'](function(){_0x46e475[_0x49c4('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x592bb8,_0x2263ae){return function(_0x15581b){if(!_0x15581b){_0x592bb8[_0x49c4('0x13')](0x194);}return _0x15581b;};}function handleError(_0xd335e4,_0x4811c4){_0x4811c4=_0x4811c4||0x1f4;return function(_0x5850f2){logger[_0x49c4('0x1c')](_0x5850f2[_0x49c4('0x1d')]);if(_0x5850f2['name']){delete _0x5850f2[_0x49c4('0x1e')];}_0xd335e4[_0x49c4('0x14')](_0x4811c4)[_0x49c4('0x1f')](_0x5850f2);};}exports[_0x49c4('0x20')]=function(_0x531d92,_0x543ea2){var _0x449960={},_0x53c199={},_0x3800b7={'count':0x0,'rows':[]};var _0x3852b2=db[_0x49c4('0x21')][_0x49c4('0x22')];_0x53c199['model']=_[_0x49c4('0x23')](_0x3852b2);_0x53c199[_0x49c4('0x24')]=_[_0x49c4('0x23')](_0x531d92[_0x49c4('0x24')]);_0x53c199[_0x49c4('0x25')]=_[_0x49c4('0x26')](_0x53c199[_0x49c4('0x27')],_0x53c199[_0x49c4('0x24')]);_0x449960[_0x49c4('0x28')]=_[_0x49c4('0x26')](_0x53c199[_0x49c4('0x27')],qs['fields'](_0x531d92['query']['fields']));_0x449960[_0x49c4('0x28')]=_0x449960[_0x49c4('0x28')][_0x49c4('0x29')]?_0x449960[_0x49c4('0x28')]:_0x53c199[_0x49c4('0x27')];if(!_0x531d92['query'][_0x49c4('0x2a')](_0x49c4('0x2b'))){_0x449960[_0x49c4('0x18')]=qs[_0x49c4('0x18')](_0x531d92['query']['limit']);_0x449960[_0x49c4('0x17')]=qs[_0x49c4('0x17')](_0x531d92[_0x49c4('0x24')][_0x49c4('0x17')]);}_0x449960[_0x49c4('0x2c')]=qs['sort'](_0x531d92[_0x49c4('0x24')][_0x49c4('0x2d')]);_0x449960[_0x49c4('0x2e')]=qs['filters'](_['pick'](_0x531d92[_0x49c4('0x24')],_0x53c199[_0x49c4('0x25')]));if(_0x531d92[_0x49c4('0x24')][_0x49c4('0x2f')]){_0x449960[_0x49c4('0x2e')]=_[_0x49c4('0x30')](_0x449960[_0x49c4('0x2e')],{'$or':_[_0x49c4('0x31')](_0x3852b2,function(_0x3209cd){if(_0x3209cd['type'][_0x49c4('0x32')]!=='VIRTUAL'){var _0xdda586={};_0xdda586[_0x3209cd[_0x49c4('0x33')]]={'$like':'%'+_0x531d92[_0x49c4('0x24')][_0x49c4('0x2f')]+'%'};return _0xdda586;}})});}_0x449960=_['merge']({},_0x449960,_0x531d92[_0x49c4('0x34')]);var _0x31f3ff={'where':_0x449960[_0x49c4('0x2e')]};return db['DeskField'][_0x49c4('0x16')](_0x31f3ff)[_0x49c4('0x1b')](function(_0x178987){_0x3800b7[_0x49c4('0x16')]=_0x178987;if(_0x531d92[_0x49c4('0x24')][_0x49c4('0x35')]){_0x449960[_0x49c4('0x36')]=[{'all':!![]}];}return db[_0x49c4('0x21')][_0x49c4('0x37')](_0x449960);})[_0x49c4('0x1b')](function(_0x1e506a){_0x3800b7['rows']=_0x1e506a;return _0x3800b7;})[_0x49c4('0x1b')](respondWithFilteredResult(_0x543ea2,_0x449960))[_0x49c4('0x38')](handleError(_0x543ea2,null));};exports[_0x49c4('0x39')]=function(_0x23aa32,_0x41ad28){var _0x29dd5d={'raw':!![],'where':{'id':_0x23aa32[_0x49c4('0x3a')]['id']}},_0x1be62d={};_0x1be62d[_0x49c4('0x27')]=_[_0x49c4('0x23')](db[_0x49c4('0x21')][_0x49c4('0x22')]);_0x1be62d[_0x49c4('0x24')]=_['keys'](_0x23aa32[_0x49c4('0x24')]);_0x1be62d['filters']=_[_0x49c4('0x26')](_0x1be62d[_0x49c4('0x27')],_0x1be62d[_0x49c4('0x24')]);_0x29dd5d[_0x49c4('0x28')]=_[_0x49c4('0x26')](_0x1be62d[_0x49c4('0x27')],qs['fields'](_0x23aa32['query'][_0x49c4('0x3b')]));_0x29dd5d[_0x49c4('0x28')]=_0x29dd5d[_0x49c4('0x28')][_0x49c4('0x29')]?_0x29dd5d['attributes']:_0x1be62d[_0x49c4('0x27')];if(_0x23aa32[_0x49c4('0x24')][_0x49c4('0x35')]){_0x29dd5d[_0x49c4('0x36')]=[{'all':!![]}];}_0x29dd5d=_[_0x49c4('0x30')]({},_0x29dd5d,_0x23aa32[_0x49c4('0x34')]);return db[_0x49c4('0x21')][_0x49c4('0x3c')](_0x29dd5d)[_0x49c4('0x1b')](handleEntityNotFound(_0x41ad28,null))['then'](respondWithResult(_0x41ad28,null))[_0x49c4('0x38')](handleError(_0x41ad28,null));};exports['create']=function(_0x33696e,_0x628423){return db[_0x49c4('0x21')][_0x49c4('0x3d')](_0x33696e[_0x49c4('0x3e')],{})['then'](respondWithResult(_0x628423,0xc9))[_0x49c4('0x38')](handleError(_0x628423,null));};exports[_0x49c4('0x1a')]=function(_0x384862,_0x254d07){if(_0x384862[_0x49c4('0x3e')]['id']){delete _0x384862[_0x49c4('0x3e')]['id'];}return db[_0x49c4('0x21')]['find']({'where':{'id':_0x384862[_0x49c4('0x3a')]['id']}})['then'](handleEntityNotFound(_0x254d07,null))[_0x49c4('0x1b')](saveUpdates(_0x384862[_0x49c4('0x3e')],null))[_0x49c4('0x1b')](respondWithResult(_0x254d07,null))[_0x49c4('0x38')](handleError(_0x254d07,null));};exports[_0x49c4('0x3f')]=function(_0x30bea5,_0x2c6be1){return db['DeskField'][_0x49c4('0x3c')]({'where':{'id':_0x30bea5[_0x49c4('0x3a')]['id']}})['then'](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x1b')](removeEntity(_0x2c6be1,null))[_0x49c4('0x38')](handleError(_0x2c6be1,null));};
\ No newline at end of file
index bbe1dc9..1e9d5bf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2b0b=['api','moment','bluebird','request-promise','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','util','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2b0b,0xfa));var _0xb2b0=function(_0x5387d0,_0x5bd369){_0x5387d0=_0x5387d0-0x0;var _0x50a4ec=_0x2b0b[_0x5387d0];return _0x50a4ec;};'use strict';var _=require('lodash');var util=require(_0xb2b0('0x0'));var logger=require(_0xb2b0('0x1'))(_0xb2b0('0x2'));var moment=require(_0xb2b0('0x3'));var BPromise=require(_0xb2b0('0x4'));var rp=require(_0xb2b0('0x5'));var attributes=require(_0xb2b0('0x6'));module[_0xb2b0('0x7')]=function(_0xbd3d2a,_0x13e8b4){return _0xbd3d2a[_0xb2b0('0x8')](_0xb2b0('0x9'),attributes,{'tableName':_0xb2b0('0xa'),'paranoid':![],'indexes':[{'name':_0xb2b0('0xb'),'fields':[_0xb2b0('0xc'),_0xb2b0('0xd')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x2a22=['request-promise','./intDeskField.attributes','exports','define','DeskField','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x2a22,0x1f3));var _0x22a2=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x2a22[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0x22a2('0x0'));var util=require(_0x22a2('0x1'));var logger=require(_0x22a2('0x2'))(_0x22a2('0x3'));var moment=require(_0x22a2('0x4'));var BPromise=require('bluebird');var rp=require(_0x22a2('0x5'));var attributes=require(_0x22a2('0x6'));module[_0x22a2('0x7')]=function(_0x4290fc,_0x55dc9b){return _0x4290fc[_0x22a2('0x8')](_0x22a2('0x9'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x22a2('0xa'),_0x22a2('0xb')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index 45b755d..582a645 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbd50=['DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbd50,0x196));var _0x0bd5=function(_0x202eed,_0x5a0bcd){_0x202eed=_0x202eed-0x0;var _0x46a69f=_0xbd50[_0x202eed];return _0x46a69f;};'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});function respondWithRpcPromise(_0xcc6cfa,_0x2c0db1,_0x1b99f3){return new BPromise(function(_0x5ebe64,_0x47e78d){return client[_0x0bd5('0xa')](_0xcc6cfa,_0x1b99f3)[_0x0bd5('0xb')](function(_0x259f4c){logger['info'](_0x0bd5('0xc'),_0x2c0db1,_0x0bd5('0xd'));logger['debug'](_0x0bd5('0xe'),_0x2c0db1,_0x0bd5('0xd'),JSON['stringify'](_0x259f4c));if(_0x259f4c[_0x0bd5('0xf')]){if(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x10')]===0x1f4){logger['error'](_0x0bd5('0xc'),_0x2c0db1,_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);return _0x47e78d(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);}logger[_0x0bd5('0xf')](_0x0bd5('0xc'),_0x2c0db1,_0x259f4c[_0x0bd5('0xf')]['message']);return _0x5ebe64(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);}else{logger['info'](_0x0bd5('0xc'),_0x2c0db1,_0x0bd5('0xd'));_0x5ebe64(_0x259f4c[_0x0bd5('0x12')][_0x0bd5('0x11')]);}})['catch'](function(_0x14f32c){logger[_0x0bd5('0xf')](_0x0bd5('0xc'),_0x2c0db1,_0x14f32c);_0x47e78d(_0x14f32c);});});}
\ No newline at end of file
+var _0x0a9a=['DeskField,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x2478b8,_0x40961b){var _0x102501=function(_0x26166c){while(--_0x26166c){_0x2478b8['push'](_0x2478b8['shift']());}};_0x102501(++_0x40961b);}(_0x0a9a,0x183));var _0xa0a9=function(_0x1d8bbb,_0x52c76e){_0x1d8bbb=_0x1d8bbb-0x0;var _0x23d8f6=_0x0a9a[_0x1d8bbb];return _0x23d8f6;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var moment=require('moment');var BPromise=require(_0xa0a9('0x1'));var rs=require(_0xa0a9('0x2'));var fs=require('fs');var Redis=require(_0xa0a9('0x3'));var db=require(_0xa0a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0a9('0x7'));var client=jayson[_0xa0a9('0x8')][_0xa0a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31d689,_0x499a29,_0x2b2eb4){return new BPromise(function(_0x520f42,_0x10aa8a){return client[_0xa0a9('0xa')](_0x31d689,_0x2b2eb4)[_0xa0a9('0xb')](function(_0x2d6ac0){logger['info'](_0xa0a9('0xc'),_0x499a29,_0xa0a9('0xd'));logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x499a29,_0xa0a9('0xd'),JSON[_0xa0a9('0xe')](_0x2d6ac0));if(_0x2d6ac0['error']){if(_0x2d6ac0[_0xa0a9('0xf')]['code']===0x1f4){logger[_0xa0a9('0xf')]('DeskField,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x10aa8a(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}logger[_0xa0a9('0xf')]('DeskField,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x520f42(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}else{logger[_0xa0a9('0x11')](_0xa0a9('0xc'),_0x499a29,'request\x20sent');_0x520f42(_0x2d6ac0[_0xa0a9('0x12')]['message']);}})['catch'](function(_0x347092){logger[_0xa0a9('0xf')](_0xa0a9('0xc'),_0x499a29,_0x347092);_0x10aa8a(_0x347092);});});}
\ No newline at end of file
index 1f1d14b..50226c3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x48a9=['addConfiguration','put','delete','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations'];(function(_0x5df01c,_0x3ad300){var _0xeb5443=function(_0x35fbc0){while(--_0x35fbc0){_0x5df01c['push'](_0x5df01c['shift']());}};_0xeb5443(++_0x3ad300);}(_0x48a9,0x6c));var _0x948a=function(_0x28f1de,_0x355054){_0x28f1de=_0x28f1de-0x0;var _0x5b5dad=_0x48a9[_0x28f1de];return _0x5b5dad;};'use strict';var multer=require(_0x948a('0x0'));var util=require(_0x948a('0x1'));var path=require('path');var timeout=require(_0x948a('0x2'));var express=require(_0x948a('0x3'));var router=express[_0x948a('0x4')]();var auth=require(_0x948a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x948a('0x6'));var controller=require(_0x948a('0x7'));router[_0x948a('0x8')]('/',auth[_0x948a('0x9')](),controller[_0x948a('0xa')]);router[_0x948a('0x8')](_0x948a('0xb'),auth[_0x948a('0x9')](),controller['show']);router['get']('/:id/configurations',auth[_0x948a('0x9')](),controller[_0x948a('0xc')]);router['get'](_0x948a('0xd'),auth[_0x948a('0x9')](),controller[_0x948a('0xe')]);router[_0x948a('0xf')]('/',auth['isAuthenticated'](),controller[_0x948a('0x10')]);router['post'](_0x948a('0x11'),auth['isAuthenticated'](),controller[_0x948a('0x12')]);router[_0x948a('0x13')](_0x948a('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x948a('0x14')](_0x948a('0xb'),auth[_0x948a('0x9')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
+var _0xb05a=['../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','isAuthenticated','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0xf28813,_0x155cc7){var _0x351c8d=function(_0x3e5ea7){while(--_0x3e5ea7){_0xf28813['push'](_0xf28813['shift']());}};_0x351c8d(++_0x155cc7);}(_0xb05a,0x121));var _0xab05=function(_0x3b677a,_0x274ecc){_0x3b677a=_0x3b677a-0x0;var _0x2e2eb6=_0xb05a[_0x3b677a];return _0x2e2eb6;};'use strict';var multer=require(_0xab05('0x0'));var util=require(_0xab05('0x1'));var path=require(_0xab05('0x2'));var timeout=require(_0xab05('0x3'));var express=require(_0xab05('0x4'));var router=express['Router']();var auth=require(_0xab05('0x5'));var interaction=require(_0xab05('0x6'));var config=require('../../config/environment');var controller=require(_0xab05('0x7'));router['get']('/',auth[_0xab05('0x8')](),controller['index']);router[_0xab05('0x9')](_0xab05('0xa'),auth[_0xab05('0x8')](),controller[_0xab05('0xb')]);router[_0xab05('0x9')](_0xab05('0xc'),auth[_0xab05('0x8')](),controller[_0xab05('0xd')]);router[_0xab05('0x9')](_0xab05('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0xab05('0xf')]('/',auth[_0xab05('0x8')](),controller[_0xab05('0x10')]);router['post']('/:id/configurations',auth[_0xab05('0x8')](),controller['addConfiguration']);router[_0xab05('0x11')](_0xab05('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xab05('0x12')](_0xab05('0xa'),auth[_0xab05('0x8')](),controller[_0xab05('0x13')]);module[_0xab05('0x14')]=router;
\ No newline at end of file
index 946e4b9..158e3ad 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x22c4=['sequelize','STRING'];(function(_0x25612d,_0x4886a5){var _0x3b1456=function(_0x3242c9){while(--_0x3242c9){_0x25612d['push'](_0x25612d['shift']());}};_0x3b1456(++_0x4886a5);}(_0x22c4,0x84));var _0x422c=function(_0x32efcb,_0x55523f){_0x32efcb=_0x32efcb-0x0;var _0x1dae88=_0x22c4[_0x32efcb];return _0x1dae88;};'use strict';var Sequelize=require(_0x422c('0x0'));module['exports']={'name':{'type':Sequelize[_0x422c('0x1')]},'username':{'type':Sequelize[_0x422c('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x422c('0x1')]},'tenantId':{'type':Sequelize[_0x422c('0x1')]},'clientId':{'type':Sequelize[_0x422c('0x1')]},'clientSecret':{'type':Sequelize[_0x422c('0x1')]},'serverUrl':{'type':Sequelize[_0x422c('0x1')]},'description':{'type':Sequelize[_0x422c('0x1')]}};
\ No newline at end of file
+var _0x176a=['exports','STRING','sequelize'];(function(_0x46d58b,_0x3ac96e){var _0x35f192=function(_0x1886f9){while(--_0x1886f9){_0x46d58b['push'](_0x46d58b['shift']());}};_0x35f192(++_0x3ac96e);}(_0x176a,0x6b));var _0xa176=function(_0x7bf151,_0x40f037){_0x7bf151=_0x7bf151-0x0;var _0x4925a2=_0x176a[_0x7bf151];return _0x4925a2;};'use strict';var Sequelize=require(_0xa176('0x0'));module[_0xa176('0x1')]={'name':{'type':Sequelize[_0xa176('0x2')]},'username':{'type':Sequelize[_0xa176('0x2')]},'password':{'type':Sequelize[_0xa176('0x2')]},'remoteUri':{'type':Sequelize[_0xa176('0x2')]},'tenantId':{'type':Sequelize[_0xa176('0x2')]},'clientId':{'type':Sequelize[_0xa176('0x2')]},'clientSecret':{'type':Sequelize[_0xa176('0x2')]},'serverUrl':{'type':Sequelize[_0xa176('0x2')]},'description':{'type':Sequelize[_0xa176('0x2')]}};
\ No newline at end of file
index d6a6959..dbb7a01 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x57b2=['subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','@odata.type','substring','PicklistAttributeMetadata','push','all','forEach','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','Dynamics365\x20error:\x20','test','Wrong\x20credentials','statusCode','GET',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Label','Value','DisplayName','UserLocalizedLabel','OptionSet','TrueOption','FalseOption',')/Microsoft.Dynamics.CRM.','html-pdf','eml-format','rimraf','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','stack','name','send','Dynamics365Account','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','length','find','create','body','params','findOne','Dynamics365Configuration','getConfigurations','nolimit','addConfiguration','Subjects','channel','type','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','description','customerid','ownerid','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','emailaddress','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','statecode','statuscode'];(function(_0x223461,_0x2bca70){var _0x4dbe0a=function(_0x3c3cb6){while(--_0x3c3cb6){_0x223461['push'](_0x223461['shift']());}};_0x4dbe0a(++_0x2bca70);}(_0x57b2,0x104));var _0x257b=function(_0x15e657,_0x22edd7){_0x15e657=_0x15e657-0x0;var _0x2f6e85=_0x57b2[_0x15e657];return _0x2f6e85;};'use strict';var pdf=require(_0x257b('0x0'));var emlformat=require(_0x257b('0x1'));var rimraf=require(_0x257b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x257b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x257b('0x4'));var util=require(_0x257b('0x5'));var path=require(_0x257b('0x6'));var sox=require(_0x257b('0x7'));var csv=require(_0x257b('0x8'));var ejs=require(_0x257b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x257b('0xa'));var crypto=require(_0x257b('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x257b('0x8'));var querystring=require(_0x257b('0xc'));var Papa=require(_0x257b('0xd'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x257b('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0x257b('0xf'))(_0x257b('0x10'));var utils=require(_0x257b('0x11'));var config=require('../../config/environment');var db=require(_0x257b('0x12'))['db'];var integrations=require(_0x257b('0x13'));var jayson=require(_0x257b('0x14'));var client=jayson[_0x257b('0x15')]['http']({'port':0x232a});function respondWithRpcPromise(_0x247a97,_0x55d596,_0x3422c0,_0x425420){return new BPromise(function(_0x4a05e0,_0x443ed2){var _0x15e9da=_0x425420||client;return _0x15e9da[_0x257b('0x16')](_0x247a97,_0x3422c0)['then'](function(_0x32673b){logger[_0x257b('0x17')](_0x257b('0x18'),_0x55d596,'request\x20sent');logger[_0x257b('0x19')](_0x257b('0x1a'),_0x55d596,_0x257b('0x1b'),JSON[_0x257b('0x1c')](_0x32673b));if(_0x32673b[_0x257b('0x1d')]){if(_0x32673b[_0x257b('0x1d')]['code']===0x1f4){logger[_0x257b('0x1d')]('Dynamics365Account,\x20%s,\x20%s',_0x55d596,_0x32673b[_0x257b('0x1d')][_0x257b('0x1e')]);return _0x443ed2(_0x32673b[_0x257b('0x1d')]['message']);}logger[_0x257b('0x1d')](_0x257b('0x18'),_0x55d596,_0x32673b['error'][_0x257b('0x1e')]);return _0x4a05e0(_0x32673b[_0x257b('0x1d')]['message']);}else{logger['info'](_0x257b('0x18'),_0x55d596,_0x257b('0x1b'));_0x4a05e0(_0x32673b[_0x257b('0x1f')][_0x257b('0x1e')]);}})[_0x257b('0x20')](function(_0x3b75b7){logger[_0x257b('0x1d')](_0x257b('0x18'),_0x55d596,_0x3b75b7);_0x443ed2(_0x3b75b7);});});}function respondWithStatusCode(_0x20665c,_0x40fdf0){_0x40fdf0=_0x40fdf0||0xcc;return function(_0x547afa){if(_0x547afa){return _0x20665c[_0x257b('0x21')](_0x40fdf0);}return _0x20665c[_0x257b('0x22')](_0x40fdf0)[_0x257b('0x23')]();};}function respondWithResult(_0x394577,_0x17e25d){_0x17e25d=_0x17e25d||0xc8;return function(_0x4bdd42){if(_0x4bdd42){return _0x394577['status'](_0x17e25d)[_0x257b('0x24')](_0x4bdd42);}};}function respondWithFilteredResult(_0x3c5865,_0x4ead8b){return function(_0x37fb0c){if(_0x37fb0c){var _0x1c2a4b=_0x37fb0c[_0x257b('0x25')],_0xe260da=_0x4ead8b[_0x257b('0x26')],_0x44c940=_0x4ead8b[_0x257b('0x26')]+_0x4ead8b[_0x257b('0x27')],_0x4b473c;if(_0x44c940>=_0x1c2a4b){_0x44c940=_0x1c2a4b;_0x4b473c=0xc8;}else{_0x4b473c=0xce;}_0x3c5865[_0x257b('0x22')](_0x4b473c);return _0x3c5865[_0x257b('0x28')]('Content-Range',_0xe260da+'-'+_0x44c940+'/'+_0x1c2a4b)[_0x257b('0x24')](_0x37fb0c);}return null;};}function patchUpdates(_0x676bb6){return function(_0x410670){try{jsonpatch['apply'](_0x410670,_0x676bb6,!![]);}catch(_0xc17e1c){return BPromise[_0x257b('0x29')](_0xc17e1c);}return _0x410670[_0x257b('0x2a')]();};}function saveUpdates(_0x41644f,_0x47415f){return function(_0x2aaeab){if(_0x2aaeab){return _0x2aaeab[_0x257b('0x2b')](_0x41644f)[_0x257b('0x2c')](function(_0x56ddd2){return _0x56ddd2;});}return null;};}function removeEntity(_0x3b37cc,_0x483d93){return function(_0x303f35){if(_0x303f35){return _0x303f35[_0x257b('0x2d')]()['then'](function(){_0x3b37cc[_0x257b('0x22')](0xcc)[_0x257b('0x23')]();});}};}function handleEntityNotFound(_0xc8438,_0x407de2){return function(_0x217a5d){if(!_0x217a5d){_0xc8438['sendStatus'](0x194);}return _0x217a5d;};}function handleError(_0x3eb234,_0x5c41b0){_0x5c41b0=_0x5c41b0||0x1f4;return function(_0x563061){logger[_0x257b('0x1d')](_0x563061[_0x257b('0x2e')]);if(_0x563061[_0x257b('0x2f')]){delete _0x563061[_0x257b('0x2f')];}_0x3eb234[_0x257b('0x22')](_0x5c41b0)[_0x257b('0x30')](_0x563061);};}exports['index']=function(_0x279777,_0x4883bc){var _0x9a2bc7={},_0xa7da92={},_0x235e25={'count':0x0,'rows':[]};var _0x2e2a87=db[_0x257b('0x31')]['rawAttributes'];_0xa7da92[_0x257b('0x32')]=_[_0x257b('0x33')](_0x2e2a87);_0xa7da92[_0x257b('0x34')]=_['keys'](_0x279777[_0x257b('0x34')]);_0xa7da92[_0x257b('0x35')]=_[_0x257b('0x36')](_0xa7da92[_0x257b('0x32')],_0xa7da92[_0x257b('0x34')]);_0x9a2bc7[_0x257b('0x37')]=_[_0x257b('0x36')](_0xa7da92[_0x257b('0x32')],qs[_0x257b('0x38')](_0x279777[_0x257b('0x34')][_0x257b('0x38')]));_0x9a2bc7[_0x257b('0x37')]=_0x9a2bc7[_0x257b('0x37')]['length']?_0x9a2bc7[_0x257b('0x37')]:_0xa7da92['model'];if(!_0x279777[_0x257b('0x34')][_0x257b('0x39')]('nolimit')){_0x9a2bc7['limit']=qs[_0x257b('0x27')](_0x279777[_0x257b('0x34')]['limit']);_0x9a2bc7['offset']=qs['offset'](_0x279777[_0x257b('0x34')]['offset']);}_0x9a2bc7[_0x257b('0x3a')]=qs['sort'](_0x279777[_0x257b('0x34')][_0x257b('0x3b')]);_0x9a2bc7[_0x257b('0x3c')]=qs['filters'](_[_0x257b('0x3d')](_0x279777[_0x257b('0x34')],_0xa7da92[_0x257b('0x35')]));if(_0x279777[_0x257b('0x34')][_0x257b('0x3e')]){_0x9a2bc7[_0x257b('0x3c')]=_[_0x257b('0x3f')](_0x9a2bc7[_0x257b('0x3c')],{'$or':_[_0x257b('0x40')](_0x2e2a87,function(_0x3cfc2f){if(_0x3cfc2f['type']['key']!==_0x257b('0x41')){var _0x1fcc41={};_0x1fcc41[_0x3cfc2f['field']]={'$like':'%'+_0x279777[_0x257b('0x34')][_0x257b('0x3e')]+'%'};return _0x1fcc41;}})});}_0x9a2bc7=_[_0x257b('0x3f')]({},_0x9a2bc7,_0x279777[_0x257b('0x42')]);var _0x160290={'where':_0x9a2bc7['where']};return db[_0x257b('0x31')][_0x257b('0x25')](_0x160290)[_0x257b('0x2c')](function(_0x30c3db){_0x235e25[_0x257b('0x25')]=_0x30c3db;if(_0x279777['query'][_0x257b('0x43')]){_0x9a2bc7[_0x257b('0x44')]=[{'all':!![]}];}return db[_0x257b('0x31')][_0x257b('0x45')](_0x9a2bc7);})['then'](function(_0x147a48){_0x235e25[_0x257b('0x46')]=_0x147a48;return _0x235e25;})['then'](respondWithFilteredResult(_0x4883bc,_0x9a2bc7))[_0x257b('0x20')](handleError(_0x4883bc,null));};exports[_0x257b('0x47')]=function(_0xeb3e50,_0x539b0){var _0x559f9b={'raw':![],'where':{'id':_0xeb3e50['params']['id']}},_0x2f1436={};_0x2f1436[_0x257b('0x32')]=_[_0x257b('0x33')](db['Dynamics365Account'][_0x257b('0x48')]);_0x2f1436[_0x257b('0x34')]=_[_0x257b('0x33')](_0xeb3e50['query']);_0x2f1436[_0x257b('0x35')]=_[_0x257b('0x36')](_0x2f1436['model'],_0x2f1436['query']);_0x559f9b[_0x257b('0x37')]=_[_0x257b('0x36')](_0x2f1436[_0x257b('0x32')],qs[_0x257b('0x38')](_0xeb3e50[_0x257b('0x34')][_0x257b('0x38')]));_0x559f9b[_0x257b('0x37')]=_0x559f9b[_0x257b('0x37')][_0x257b('0x49')]?_0x559f9b['attributes']:_0x2f1436[_0x257b('0x32')];if(_0xeb3e50['query'][_0x257b('0x43')]){_0x559f9b['include']=[{'all':!![]}];}_0x559f9b=_[_0x257b('0x3f')]({},_0x559f9b,_0xeb3e50[_0x257b('0x42')]);return db['Dynamics365Account'][_0x257b('0x4a')](_0x559f9b)[_0x257b('0x2c')](handleEntityNotFound(_0x539b0,null))[_0x257b('0x2c')](respondWithResult(_0x539b0,null))[_0x257b('0x20')](handleError(_0x539b0,null));};exports[_0x257b('0x4b')]=function(_0x319ed9,_0xa73d2b){return db['Dynamics365Account']['create'](_0x319ed9['body'],{})[_0x257b('0x2c')](respondWithResult(_0xa73d2b,0xc9))['catch'](handleError(_0xa73d2b,null));};exports['update']=function(_0x4ee6ff,_0x34435d){if(_0x4ee6ff[_0x257b('0x4c')]['id']){delete _0x4ee6ff[_0x257b('0x4c')]['id'];}return db[_0x257b('0x31')][_0x257b('0x4a')]({'where':{'id':_0x4ee6ff[_0x257b('0x4d')]['id']}})[_0x257b('0x2c')](handleEntityNotFound(_0x34435d,null))[_0x257b('0x2c')](saveUpdates(_0x4ee6ff[_0x257b('0x4c')],null))['then'](respondWithResult(_0x34435d,null))[_0x257b('0x20')](handleError(_0x34435d,null));};exports[_0x257b('0x2d')]=function(_0x5c94ba,_0x461ec8){return db[_0x257b('0x31')]['find']({'where':{'id':_0x5c94ba[_0x257b('0x4d')]['id']}})[_0x257b('0x2c')](handleEntityNotFound(_0x461ec8,null))['then'](removeEntity(_0x461ec8,null))[_0x257b('0x20')](handleError(_0x461ec8,null));};exports['getConfigurations']=function(_0x2a9523,_0x5ac19c,_0x5d4deb){var _0x40c646={};var _0x502798={};var _0x3a621c;var _0x28d808;return db[_0x257b('0x31')][_0x257b('0x4e')]({'where':{'id':_0x2a9523['params']['id']}})[_0x257b('0x2c')](handleEntityNotFound(_0x5ac19c,null))[_0x257b('0x2c')](function(_0x19a8fa){if(_0x19a8fa){_0x3a621c=_0x19a8fa;_0x502798[_0x257b('0x32')]=_['keys'](db[_0x257b('0x4f')][_0x257b('0x48')]);_0x502798[_0x257b('0x34')]=_[_0x257b('0x33')](_0x2a9523['query']);_0x502798['filters']=_[_0x257b('0x36')](_0x502798[_0x257b('0x32')],_0x502798[_0x257b('0x34')]);_0x40c646['attributes']=_[_0x257b('0x36')](_0x502798['model'],qs['fields'](_0x2a9523[_0x257b('0x34')][_0x257b('0x38')]));_0x40c646['attributes']=_0x40c646[_0x257b('0x37')][_0x257b('0x49')]?_0x40c646[_0x257b('0x37')]:_0x502798[_0x257b('0x32')];_0x40c646[_0x257b('0x3a')]=qs['sort'](_0x2a9523[_0x257b('0x34')][_0x257b('0x3b')]);_0x40c646[_0x257b('0x3c')]=qs[_0x257b('0x35')](_['pick'](_0x2a9523['query'],_0x502798[_0x257b('0x35')]));if(_0x2a9523['query']['filter']){_0x40c646[_0x257b('0x3c')]=_[_0x257b('0x3f')](_0x40c646[_0x257b('0x3c')],{'$or':_[_0x257b('0x40')](_0x40c646['attributes'],function(_0x416740){var _0x1836e3={};_0x1836e3[_0x416740]={'$like':'%'+_0x2a9523[_0x257b('0x34')][_0x257b('0x3e')]+'%'};return _0x1836e3;})});}_0x40c646=_[_0x257b('0x3f')]({},_0x40c646,_0x2a9523[_0x257b('0x42')]);return _0x3a621c[_0x257b('0x50')](_0x40c646);}})[_0x257b('0x2c')](function(_0x3fc629){if(_0x3fc629){_0x28d808=_0x3fc629['length'];if(!_0x2a9523[_0x257b('0x34')][_0x257b('0x39')](_0x257b('0x51'))){_0x40c646[_0x257b('0x27')]=qs[_0x257b('0x27')](_0x2a9523[_0x257b('0x34')][_0x257b('0x27')]);_0x40c646[_0x257b('0x26')]=qs[_0x257b('0x26')](_0x2a9523[_0x257b('0x34')][_0x257b('0x26')]);}return _0x3a621c[_0x257b('0x50')](_0x40c646);}})[_0x257b('0x2c')](function(_0x4d3ceb){if(_0x4d3ceb){return _0x4d3ceb?{'count':_0x28d808,'rows':_0x4d3ceb}:null;}})['then'](respondWithResult(_0x5ac19c,null))[_0x257b('0x20')](handleError(_0x5ac19c,null));};exports[_0x257b('0x52')]=function(_0x4524fc,_0x1fd8d5,_0x17a36a){if(_0x4524fc['body']['id']){delete _0x4524fc[_0x257b('0x4c')]['id'];}return db['Dynamics365Account']['findOne']({'where':{'id':_0x4524fc[_0x257b('0x4d')]['id']}})[_0x257b('0x2c')](handleEntityNotFound(_0x1fd8d5,null))[_0x257b('0x2c')](function(_0x41a288){if(_0x41a288){_0x4524fc[_0x257b('0x4c')]['AccountId']=_0x41a288['id'];_0x4524fc[_0x257b('0x4c')][_0x257b('0x53')]=integrations['getSubjects'](_0x4524fc['body'][_0x257b('0x54')],_0x4524fc[_0x257b('0x4c')][_0x257b('0x55')]);_0x4524fc[_0x257b('0x4c')][_0x257b('0x56')]=integrations[_0x257b('0x57')](_0x4524fc[_0x257b('0x4c')][_0x257b('0x54')],_0x4524fc['body']['type']);return db[_0x257b('0x4f')][_0x257b('0x4b')](_0x4524fc['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0x257b('0x53')},{'model':db[_0x257b('0x58')],'as':_0x257b('0x56')}]});}return null;})[_0x257b('0x2c')](respondWithResult(_0x1fd8d5,null))[_0x257b('0x20')](handleError(_0x1fd8d5,null));};exports[_0x257b('0x59')]=function(_0x58e4e7,_0x8eb200,_0x3edb32){var _0x58d15e=_0x58e4e7[_0x257b('0x34')][_0x257b('0x5a')];var _0x13c072=_0x58d15e===_0x257b('0x5b')?'Incident':'PhoneCall';var _0x358f56='';var _0x4abd10='';var _0x166eaf='';var _0x29b56b='';var _0x4ba824='';var _0x5d424c='';var _0x4c3e5a='';var _0x46dddd=['title',_0x257b('0x5c'),_0x257b('0x5d'),_0x257b('0x5e'),'caseorigincode',_0x257b('0x5f'),_0x257b('0x60'),_0x257b('0x61'),'directioncode',_0x257b('0x62')];var _0x1630f9=[_0x257b('0x63'),'accountidyominame','actualserviceunits',_0x257b('0x64'),_0x257b('0x65'),_0x257b('0x66'),'contractdetailidname',_0x257b('0x67'),'createdbyexternalpartyname','createdbyexternalpartyyominame',_0x257b('0x68'),_0x257b('0x69'),'createdon',_0x257b('0x6a'),_0x257b('0x6b'),'customeridname',_0x257b('0x6c'),'customeridyominame',_0x257b('0x6d'),'entitlementidname','entityimage_timestamp',_0x257b('0x6e'),_0x257b('0x6f'),_0x257b('0x70'),_0x257b('0x71'),_0x257b('0x72'),_0x257b('0x73'),_0x257b('0x74'),_0x257b('0x75'),_0x257b('0x76'),_0x257b('0x77'),_0x257b('0x78'),'modifiedbyexternalpartyyominame',_0x257b('0x79'),_0x257b('0x7a'),'modifiedon',_0x257b('0x7b'),'modifiedonbehalfbyyominame',_0x257b('0x7c'),_0x257b('0x7d'),_0x257b('0x7e'),'onholdtime',_0x257b('0x7f'),_0x257b('0x80'),_0x257b('0x81'),_0x257b('0x82'),_0x257b('0x83'),_0x257b('0x84'),_0x257b('0x85'),'prioritycodename',_0x257b('0x86'),_0x257b('0x87'),_0x257b('0x88'),_0x257b('0x89'),'responseby','responsiblecontactidname',_0x257b('0x8a'),_0x257b('0x8b'),'slainvokedidname',_0x257b('0x8c'),_0x257b('0x8d'),_0x257b('0x8e'),_0x257b('0x8f'),_0x257b('0x90'),_0x257b('0x91'),_0x257b('0x92'),'transactioncurrencyidname',_0x257b('0x93'),_0x257b('0x94'),_0x257b('0x95')];var _0x183355=_0x46dddd[_0x257b('0x96')](_0x1630f9);return db['Dynamics365Account'][_0x257b('0x4e')]({'where':{'id':_0x58e4e7['params']['id']},'attributes':['id',_0x257b('0x97'),_0x257b('0x98'),_0x257b('0x99'),_0x257b('0x9a'),_0x257b('0x9b'),_0x257b('0x9c')]})[_0x257b('0x2c')](handleEntityNotFound(_0x8eb200,null))[_0x257b('0x2c')](function(_0xb2f022){if(_0xb2f022){_0x4c3e5a=util[_0x257b('0x9d')](_0x257b('0x9e'),_0xb2f022[_0x257b('0x99')]);var _0x424afa={'method':_0x257b('0x9f'),'uri':_0x257b('0xa0')+_0xb2f022[_0x257b('0x9a')]+'/oauth2/token','form':{'client_id':_0xb2f022[_0x257b('0x9b')],'resource':_0xb2f022[_0x257b('0x99')],'username':_0xb2f022['username'],'password':_0xb2f022[_0x257b('0x98')],'grant_type':_0x257b('0x98'),'client_secret':_0xb2f022['clientSecret']},'json':!![]};return rp(_0x424afa);}})[_0x257b('0x2c')](function(_0x49a3f5){_0x5d424c=_0x49a3f5['access_token'];var _0x45696d={'method':'GET','uri':encodeURI(_0x4c3e5a+_0x257b('0xa1')+_0x13c072+'\x27'),'headers':{'Authorization':_0x257b('0xa2')+_0x5d424c,'If-None-Match':null,'OData-Version':_0x257b('0xa3')},'json':!![]};return rp(_0x45696d);})[_0x257b('0x2c')](function(_0x47c454){var _0x5b65c0=_0x47c454[_0x257b('0xa4')][0x0];var _0x3df177=_0x5b65c0[_0x257b('0xa5')];var _0x2fe59b={'method':'GET','uri':_0x4c3e5a+_0x257b('0xa6')+_0x3df177+_0x257b('0xa7'),'headers':{'Authorization':_0x257b('0xa2')+_0x5d424c,'If-None-Match':null,'OData-Version':_0x257b('0xa3')},'json':!![]};return rp(_0x2fe59b);})[_0x257b('0x2c')](function(_0x2c5250){_0x358f56=_0x2c5250;_0x4abd10=_0x358f56['Attributes'];_0x4abd10=_[_0x257b('0xa8')](_0x4abd10,function(_0x560d52){return!_0x183355[_0x257b('0xa9')](_0x560d52[_0x257b('0xaa')]);});var _0x265f11=[];var _0x15c6e6=[];_0x4abd10['forEach'](function(_0x5a80a9){if(_0x5a80a9[_0x257b('0xab')]){var _0x5b3a88=_0x5a80a9[_0x257b('0xab')][_0x257b('0xac')](_0x5a80a9[_0x257b('0xab')]['lastIndexOf']('.')+0x1);if(_0x5b3a88===_0x257b('0xad')){_0x265f11[_0x257b('0xae')](getSelectList(_0x4c3e5a,_0x58d15e,_0x15c6e6,_0x358f56[_0x257b('0xa5')],_0x5a80a9['MetadataId'],_0x5d424c));}}});return Promise[_0x257b('0xaf')](_0x265f11);})[_0x257b('0x2c')](function(_0x44abf6){_0x166eaf=_0x44abf6[0x0];var _0x2be7fc=[];var _0x5ca171=[];_0x4abd10[_0x257b('0xb0')](function(_0xd43c90){if(_0xd43c90[_0x257b('0xab')]){var _0x1382f9=_0xd43c90['@odata.type'][_0x257b('0xac')](_0xd43c90[_0x257b('0xab')]['lastIndexOf']('.')+0x1);if(_0x1382f9==='BooleanAttributeMetadata'){_0x2be7fc[_0x257b('0xae')](getBooleanList(_0x4c3e5a,_0x58d15e,_0x5ca171,_0x358f56['MetadataId'],_0xd43c90[_0x257b('0xa5')],_0x5d424c));}}});return Promise[_0x257b('0xaf')](_0x2be7fc);})['then'](function(_0x354920){_0x29b56b=_0x354920[0x0];var _0x4011e0=[];var _0xfd694c=[];_0x4abd10['forEach'](function(_0x2a0bfd){if(_0x2a0bfd[_0x257b('0xab')]){var _0x4d13a9=_0x2a0bfd['@odata.type']['substring'](_0x2a0bfd[_0x257b('0xab')]['lastIndexOf']('.')+0x1);if(_0x4d13a9===_0x257b('0xb1')||_0x4d13a9===_0x257b('0xb2')||_0x4d13a9===_0x257b('0xb3')||_0x4d13a9===_0x257b('0xb4')||_0x4d13a9===_0x257b('0xb5')||_0x4d13a9===_0x257b('0xb6')||_0x4d13a9===_0x257b('0xb7')||_0x4d13a9===_0x257b('0xb8')||_0x4d13a9===_0x257b('0xb9')||_0x4d13a9===_0x257b('0xba')){_0x4011e0['push'](getInputList(_0x4c3e5a,_0x58d15e,_0x4d13a9,_0xfd694c,_0x358f56[_0x257b('0xa5')],_0x2a0bfd['MetadataId'],_0x5d424c));}}});return Promise['all'](_0x4011e0);})[_0x257b('0x2c')](function(_0x5e9cc8){_0x4ba824=_0x5e9cc8[0x0];var _0x10f600=_0x166eaf['concat'](_0x29b56b)['concat'](_0x4ba824);var _0x3e6699={'count':_0x10f600[_0x257b('0x49')],'rows':_0x10f600};return _0x3e6699;})[_0x257b('0x2c')](respondWithResult(_0x8eb200,null))[_0x257b('0x20')](function(_0x3c4b8a){console['log'](_0x257b('0xbb')+_0x3c4b8a);var _0x1aec25=_0x58e4e7[_0x257b('0x34')][_0x257b('0xbc')]?0x1f4:_0x3c4b8a['statusCode']||0x1f4;logger[_0x257b('0x1d')](_0x3c4b8a[_0x257b('0x2e')]);delete _0x3c4b8a[_0x257b('0x2f')];if(_0x1aec25===0x191){_0x1aec25=0x190;}_0x8eb200['status'](_0x1aec25)['send'](_0x58e4e7[_0x257b('0x34')][_0x257b('0xbc')]?{'message':_0x257b('0xbd'),'statusCode':_0x3c4b8a[_0x257b('0xbe')]}:_0x3c4b8a);});};function getSelectList(_0x2eba54,_0x305a92,_0x286006,_0x43d200,_0x47b82d,_0x4bb60b){var _0x4b8f03={'method':_0x257b('0xbf'),'uri':_0x2eba54+_0x257b('0xa6')+_0x43d200+_0x257b('0xc0')+_0x47b82d+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x257b('0xc1'),'headers':{'Authorization':_0x257b('0xa2')+_0x4bb60b,'If-None-Match':null,'OData-Version':_0x257b('0xa3')},'json':!![]};return rp(_0x4b8f03)[_0x257b('0x2c')](function(_0x3bd57a){var _0x447c61=[];var _0x37411b=_0x3bd57a['OptionSet']['Options'];_0x37411b[_0x257b('0xb0')](function(_0x33fb02){_0x447c61[_0x257b('0xae')]({'name':_0x33fb02[_0x257b('0xc2')]['UserLocalizedLabel'][_0x257b('0xc2')],'value':String(_0x33fb02[_0x257b('0xc3')])});});var _0x31aa79={'id':_0x305a92+'_'+_0x3bd57a[_0x257b('0xaa')],'name':_0x3bd57a[_0x257b('0xc4')][_0x257b('0xc5')][_0x257b('0xc2')],'custom':![],'options':_0x447c61};_0x286006[_0x257b('0xae')](_0x31aa79);return _0x286006;});}function getBooleanList(_0x27cc3e,_0xb41fd3,_0x488c48,_0x408213,_0x3ba672,_0x369842){var _0x3c1ab4={'method':_0x257b('0xbf'),'uri':_0x27cc3e+_0x257b('0xa6')+_0x408213+')/Attributes('+_0x3ba672+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x257b('0xa2')+_0x369842,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3c1ab4)['then'](function(_0x583cfc){var _0x728fc=[];_0x728fc[_0x257b('0xae')]({'name':_0x583cfc[_0x257b('0xc6')]['TrueOption'][_0x257b('0xc2')][_0x257b('0xc5')][_0x257b('0xc2')],'value':String(_0x583cfc['OptionSet'][_0x257b('0xc7')][_0x257b('0xc3')])},{'name':_0x583cfc[_0x257b('0xc6')][_0x257b('0xc8')][_0x257b('0xc2')][_0x257b('0xc5')][_0x257b('0xc2')],'value':String(_0x583cfc[_0x257b('0xc6')][_0x257b('0xc8')][_0x257b('0xc3')])});var _0x1eaaf1={'id':_0xb41fd3+'_'+_0x583cfc['LogicalName'],'name':_0x583cfc[_0x257b('0xc4')][_0x257b('0xc5')]['Label'],'custom':![],'options':_0x728fc};_0x488c48[_0x257b('0xae')](_0x1eaaf1);return _0x488c48;});}function getInputList(_0x19881e,_0x3df724,_0x576c3a,_0x1bb350,_0x32125c,_0xdf5529,_0x54266d){var _0x257bb1={'method':_0x257b('0xbf'),'uri':_0x19881e+_0x257b('0xa6')+_0x32125c+_0x257b('0xc0')+_0xdf5529+_0x257b('0xc9')+_0x576c3a+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x257b('0xa2')+_0x54266d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x257bb1)[_0x257b('0x2c')](function(_0x5313d4){var _0x1f7151={'id':_0x3df724+'_'+_0x5313d4[_0x257b('0xaa')],'name':_0x5313d4[_0x257b('0xc4')]['UserLocalizedLabel']?_0x5313d4[_0x257b('0xc4')][_0x257b('0xc5')][_0x257b('0xc2')]:_0x5313d4[_0x257b('0xaa')],'custom':![],'options':[]};_0x1bb350[_0x257b('0xae')](_0x1f7151);return _0x1bb350;});}
\ No newline at end of file
+var _0xdcbb=['addConfiguration','getSubjects','Descriptions','getDescriptions','type','ticketType','incident','Incident','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','directioncode','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statuscode','subjectidname','ticketnumber','traversedpath','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','substring','lastIndexOf','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','GET','4.0',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','LogicalName','forEach','@odata.type','push','MetadataId','BooleanAttributeMetadata','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','Dynamics365\x20error:\x20','Wrong\x20credentials','statusCode','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','DisplayName','TrueOption','FalseOption','Value',')/Microsoft.Dynamics.CRM.','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','end','json','count','offset','limit','status','set','apply','reject','save','update','then','destroy','stack','name','send','Dynamics365Account','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','key','VIRTUAL','field','options','includeAll','include','findAll','rows','show','create','body','find','getConfigurations','findOne','params','Dynamics365Configuration'];(function(_0x898206,_0x11fae6){var _0x4f6480=function(_0x4ad45a){while(--_0x4ad45a){_0x898206['push'](_0x898206['shift']());}};_0x4f6480(++_0x11fae6);}(_0xdcbb,0x76));var _0xbdcb=function(_0x478e7d,_0x577092){_0x478e7d=_0x478e7d-0x0;var _0x11a9b1=_0xdcbb[_0x478e7d];return _0x11a9b1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbdcb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbdcb('0x1'));var jsonpatch=require(_0xbdcb('0x2'));var rp=require(_0xbdcb('0x3'));var moment=require(_0xbdcb('0x4'));var BPromise=require(_0xbdcb('0x5'));var Mustache=require(_0xbdcb('0x6'));var util=require(_0xbdcb('0x7'));var path=require(_0xbdcb('0x8'));var sox=require('sox');var csv=require(_0xbdcb('0x9'));var ejs=require(_0xbdcb('0xa'));var fs=require('fs');var _=require(_0xbdcb('0xb'));var squel=require(_0xbdcb('0xc'));var crypto=require(_0xbdcb('0xd'));var jsforce=require(_0xbdcb('0xe'));var deskjs=require(_0xbdcb('0xf'));var toCsv=require('to-csv');var querystring=require(_0xbdcb('0x10'));var Papa=require(_0xbdcb('0x11'));var authService=require('../../components/auth/service');var hardwareService=require(_0xbdcb('0x12'));var Redis=require(_0xbdcb('0x13'));var qs=require(_0xbdcb('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xbdcb('0x15'));var config=require(_0xbdcb('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xbdcb('0x17'));var client=jayson[_0xbdcb('0x18')][_0xbdcb('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x20fada,_0x33c437,_0x222b84,_0x47f771){return new BPromise(function(_0x525ae9,_0x53e889){var _0x45d47a=_0x47f771||client;return _0x45d47a[_0xbdcb('0x1a')](_0x20fada,_0x222b84)['then'](function(_0x2eeb1b){logger[_0xbdcb('0x1b')]('Dynamics365Account,\x20%s,\x20%s',_0x33c437,_0xbdcb('0x1c'));logger[_0xbdcb('0x1d')](_0xbdcb('0x1e'),_0x33c437,_0xbdcb('0x1c'),JSON['stringify'](_0x2eeb1b));if(_0x2eeb1b[_0xbdcb('0x1f')]){if(_0x2eeb1b[_0xbdcb('0x1f')][_0xbdcb('0x20')]===0x1f4){logger['error'](_0xbdcb('0x21'),_0x33c437,_0x2eeb1b[_0xbdcb('0x1f')][_0xbdcb('0x22')]);return _0x53e889(_0x2eeb1b[_0xbdcb('0x1f')][_0xbdcb('0x22')]);}logger[_0xbdcb('0x1f')](_0xbdcb('0x21'),_0x33c437,_0x2eeb1b[_0xbdcb('0x1f')][_0xbdcb('0x22')]);return _0x525ae9(_0x2eeb1b[_0xbdcb('0x1f')][_0xbdcb('0x22')]);}else{logger['info'](_0xbdcb('0x21'),_0x33c437,_0xbdcb('0x1c'));_0x525ae9(_0x2eeb1b[_0xbdcb('0x23')][_0xbdcb('0x22')]);}})[_0xbdcb('0x24')](function(_0x4f2917){logger[_0xbdcb('0x1f')]('Dynamics365Account,\x20%s,\x20%s',_0x33c437,_0x4f2917);_0x53e889(_0x4f2917);});});}function respondWithStatusCode(_0x7ccfb1,_0x45dc13){_0x45dc13=_0x45dc13||0xcc;return function(_0x37b090){if(_0x37b090){return _0x7ccfb1['sendStatus'](_0x45dc13);}return _0x7ccfb1['status'](_0x45dc13)[_0xbdcb('0x25')]();};}function respondWithResult(_0x2a2932,_0x2a2e41){_0x2a2e41=_0x2a2e41||0xc8;return function(_0x4b33c3){if(_0x4b33c3){return _0x2a2932['status'](_0x2a2e41)[_0xbdcb('0x26')](_0x4b33c3);}};}function respondWithFilteredResult(_0x2f32b1,_0x22be75){return function(_0x32fca7){if(_0x32fca7){var _0x1dfd04=_0x32fca7[_0xbdcb('0x27')],_0x2b0324=_0x22be75[_0xbdcb('0x28')],_0x5bdf24=_0x22be75[_0xbdcb('0x28')]+_0x22be75[_0xbdcb('0x29')],_0x3bccb1;if(_0x5bdf24>=_0x1dfd04){_0x5bdf24=_0x1dfd04;_0x3bccb1=0xc8;}else{_0x3bccb1=0xce;}_0x2f32b1[_0xbdcb('0x2a')](_0x3bccb1);return _0x2f32b1[_0xbdcb('0x2b')]('Content-Range',_0x2b0324+'-'+_0x5bdf24+'/'+_0x1dfd04)[_0xbdcb('0x26')](_0x32fca7);}return null;};}function patchUpdates(_0x140ea1){return function(_0x296f44){try{jsonpatch[_0xbdcb('0x2c')](_0x296f44,_0x140ea1,!![]);}catch(_0x454850){return BPromise[_0xbdcb('0x2d')](_0x454850);}return _0x296f44[_0xbdcb('0x2e')]();};}function saveUpdates(_0x3ff694,_0x1d6cc3){return function(_0x3331c2){if(_0x3331c2){return _0x3331c2[_0xbdcb('0x2f')](_0x3ff694)[_0xbdcb('0x30')](function(_0x44bd67){return _0x44bd67;});}return null;};}function removeEntity(_0x5a9a6a,_0x4f22e6){return function(_0x5f381a){if(_0x5f381a){return _0x5f381a[_0xbdcb('0x31')]()[_0xbdcb('0x30')](function(){_0x5a9a6a[_0xbdcb('0x2a')](0xcc)[_0xbdcb('0x25')]();});}};}function handleEntityNotFound(_0x341568,_0x128aed){return function(_0x5eaae0){if(!_0x5eaae0){_0x341568['sendStatus'](0x194);}return _0x5eaae0;};}function handleError(_0x554f2c,_0x74a7f9){_0x74a7f9=_0x74a7f9||0x1f4;return function(_0x5e20af){logger[_0xbdcb('0x1f')](_0x5e20af[_0xbdcb('0x32')]);if(_0x5e20af[_0xbdcb('0x33')]){delete _0x5e20af[_0xbdcb('0x33')];}_0x554f2c[_0xbdcb('0x2a')](_0x74a7f9)[_0xbdcb('0x34')](_0x5e20af);};}exports['index']=function(_0x2906da,_0x575b8d){var _0x97c2af={},_0x57c0bd={},_0x36dba1={'count':0x0,'rows':[]};var _0x4b1d39=db[_0xbdcb('0x35')][_0xbdcb('0x36')];_0x57c0bd[_0xbdcb('0x37')]=_['keys'](_0x4b1d39);_0x57c0bd[_0xbdcb('0x38')]=_[_0xbdcb('0x39')](_0x2906da[_0xbdcb('0x38')]);_0x57c0bd[_0xbdcb('0x3a')]=_['intersection'](_0x57c0bd[_0xbdcb('0x37')],_0x57c0bd[_0xbdcb('0x38')]);_0x97c2af['attributes']=_[_0xbdcb('0x3b')](_0x57c0bd['model'],qs[_0xbdcb('0x3c')](_0x2906da[_0xbdcb('0x38')][_0xbdcb('0x3c')]));_0x97c2af[_0xbdcb('0x3d')]=_0x97c2af[_0xbdcb('0x3d')][_0xbdcb('0x3e')]?_0x97c2af['attributes']:_0x57c0bd[_0xbdcb('0x37')];if(!_0x2906da[_0xbdcb('0x38')][_0xbdcb('0x3f')]('nolimit')){_0x97c2af[_0xbdcb('0x29')]=qs[_0xbdcb('0x29')](_0x2906da[_0xbdcb('0x38')][_0xbdcb('0x29')]);_0x97c2af[_0xbdcb('0x28')]=qs['offset'](_0x2906da[_0xbdcb('0x38')][_0xbdcb('0x28')]);}_0x97c2af[_0xbdcb('0x40')]=qs[_0xbdcb('0x41')](_0x2906da[_0xbdcb('0x38')][_0xbdcb('0x41')]);_0x97c2af['where']=qs[_0xbdcb('0x3a')](_[_0xbdcb('0x42')](_0x2906da['query'],_0x57c0bd[_0xbdcb('0x3a')]));if(_0x2906da[_0xbdcb('0x38')][_0xbdcb('0x43')]){_0x97c2af[_0xbdcb('0x44')]=_[_0xbdcb('0x45')](_0x97c2af[_0xbdcb('0x44')],{'$or':_[_0xbdcb('0x46')](_0x4b1d39,function(_0x4b8e74){if(_0x4b8e74['type'][_0xbdcb('0x47')]!==_0xbdcb('0x48')){var _0x4b0c4d={};_0x4b0c4d[_0x4b8e74[_0xbdcb('0x49')]]={'$like':'%'+_0x2906da['query']['filter']+'%'};return _0x4b0c4d;}})});}_0x97c2af=_[_0xbdcb('0x45')]({},_0x97c2af,_0x2906da[_0xbdcb('0x4a')]);var _0x430f28={'where':_0x97c2af[_0xbdcb('0x44')]};return db[_0xbdcb('0x35')][_0xbdcb('0x27')](_0x430f28)['then'](function(_0x5e0a90){_0x36dba1['count']=_0x5e0a90;if(_0x2906da[_0xbdcb('0x38')][_0xbdcb('0x4b')]){_0x97c2af[_0xbdcb('0x4c')]=[{'all':!![]}];}return db[_0xbdcb('0x35')][_0xbdcb('0x4d')](_0x97c2af);})[_0xbdcb('0x30')](function(_0x40e0fc){_0x36dba1[_0xbdcb('0x4e')]=_0x40e0fc;return _0x36dba1;})[_0xbdcb('0x30')](respondWithFilteredResult(_0x575b8d,_0x97c2af))[_0xbdcb('0x24')](handleError(_0x575b8d,null));};exports[_0xbdcb('0x4f')]=function(_0x2cb3c2,_0xe9f0ed){var _0x49ad5c={'raw':![],'where':{'id':_0x2cb3c2['params']['id']}},_0x3f7b86={};_0x3f7b86[_0xbdcb('0x37')]=_[_0xbdcb('0x39')](db[_0xbdcb('0x35')][_0xbdcb('0x36')]);_0x3f7b86[_0xbdcb('0x38')]=_[_0xbdcb('0x39')](_0x2cb3c2[_0xbdcb('0x38')]);_0x3f7b86[_0xbdcb('0x3a')]=_[_0xbdcb('0x3b')](_0x3f7b86[_0xbdcb('0x37')],_0x3f7b86['query']);_0x49ad5c[_0xbdcb('0x3d')]=_[_0xbdcb('0x3b')](_0x3f7b86['model'],qs[_0xbdcb('0x3c')](_0x2cb3c2['query'][_0xbdcb('0x3c')]));_0x49ad5c[_0xbdcb('0x3d')]=_0x49ad5c[_0xbdcb('0x3d')][_0xbdcb('0x3e')]?_0x49ad5c['attributes']:_0x3f7b86[_0xbdcb('0x37')];if(_0x2cb3c2[_0xbdcb('0x38')]['includeAll']){_0x49ad5c['include']=[{'all':!![]}];}_0x49ad5c=_[_0xbdcb('0x45')]({},_0x49ad5c,_0x2cb3c2[_0xbdcb('0x4a')]);return db[_0xbdcb('0x35')]['find'](_0x49ad5c)['then'](handleEntityNotFound(_0xe9f0ed,null))['then'](respondWithResult(_0xe9f0ed,null))[_0xbdcb('0x24')](handleError(_0xe9f0ed,null));};exports[_0xbdcb('0x50')]=function(_0x83505f,_0x5a55de){return db[_0xbdcb('0x35')][_0xbdcb('0x50')](_0x83505f[_0xbdcb('0x51')],{})[_0xbdcb('0x30')](respondWithResult(_0x5a55de,0xc9))[_0xbdcb('0x24')](handleError(_0x5a55de,null));};exports['update']=function(_0x5e5dba,_0x22bcca){if(_0x5e5dba[_0xbdcb('0x51')]['id']){delete _0x5e5dba[_0xbdcb('0x51')]['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x5e5dba['params']['id']}})[_0xbdcb('0x30')](handleEntityNotFound(_0x22bcca,null))['then'](saveUpdates(_0x5e5dba[_0xbdcb('0x51')],null))[_0xbdcb('0x30')](respondWithResult(_0x22bcca,null))['catch'](handleError(_0x22bcca,null));};exports[_0xbdcb('0x31')]=function(_0x170e5b,_0x233eb4){return db[_0xbdcb('0x35')][_0xbdcb('0x52')]({'where':{'id':_0x170e5b['params']['id']}})[_0xbdcb('0x30')](handleEntityNotFound(_0x233eb4,null))[_0xbdcb('0x30')](removeEntity(_0x233eb4,null))[_0xbdcb('0x24')](handleError(_0x233eb4,null));};exports[_0xbdcb('0x53')]=function(_0x4de02c,_0x3f5652,_0x9b083f){var _0x2a8e7d={};var _0x301706={};var _0x4e2555;var _0x56a6b0;return db[_0xbdcb('0x35')][_0xbdcb('0x54')]({'where':{'id':_0x4de02c[_0xbdcb('0x55')]['id']}})[_0xbdcb('0x30')](handleEntityNotFound(_0x3f5652,null))[_0xbdcb('0x30')](function(_0x564d90){if(_0x564d90){_0x4e2555=_0x564d90;_0x301706['model']=_[_0xbdcb('0x39')](db[_0xbdcb('0x56')][_0xbdcb('0x36')]);_0x301706[_0xbdcb('0x38')]=_[_0xbdcb('0x39')](_0x4de02c[_0xbdcb('0x38')]);_0x301706[_0xbdcb('0x3a')]=_[_0xbdcb('0x3b')](_0x301706['model'],_0x301706[_0xbdcb('0x38')]);_0x2a8e7d[_0xbdcb('0x3d')]=_[_0xbdcb('0x3b')](_0x301706[_0xbdcb('0x37')],qs['fields'](_0x4de02c[_0xbdcb('0x38')][_0xbdcb('0x3c')]));_0x2a8e7d[_0xbdcb('0x3d')]=_0x2a8e7d[_0xbdcb('0x3d')][_0xbdcb('0x3e')]?_0x2a8e7d[_0xbdcb('0x3d')]:_0x301706['model'];_0x2a8e7d[_0xbdcb('0x40')]=qs[_0xbdcb('0x41')](_0x4de02c[_0xbdcb('0x38')][_0xbdcb('0x41')]);_0x2a8e7d['where']=qs['filters'](_['pick'](_0x4de02c[_0xbdcb('0x38')],_0x301706[_0xbdcb('0x3a')]));if(_0x4de02c[_0xbdcb('0x38')]['filter']){_0x2a8e7d['where']=_[_0xbdcb('0x45')](_0x2a8e7d[_0xbdcb('0x44')],{'$or':_['map'](_0x2a8e7d[_0xbdcb('0x3d')],function(_0x3b665d){var _0x5892f1={};_0x5892f1[_0x3b665d]={'$like':'%'+_0x4de02c[_0xbdcb('0x38')][_0xbdcb('0x43')]+'%'};return _0x5892f1;})});}_0x2a8e7d=_[_0xbdcb('0x45')]({},_0x2a8e7d,_0x4de02c[_0xbdcb('0x4a')]);return _0x4e2555[_0xbdcb('0x53')](_0x2a8e7d);}})[_0xbdcb('0x30')](function(_0x1afdd0){if(_0x1afdd0){_0x56a6b0=_0x1afdd0[_0xbdcb('0x3e')];if(!_0x4de02c[_0xbdcb('0x38')][_0xbdcb('0x3f')]('nolimit')){_0x2a8e7d['limit']=qs[_0xbdcb('0x29')](_0x4de02c[_0xbdcb('0x38')]['limit']);_0x2a8e7d[_0xbdcb('0x28')]=qs[_0xbdcb('0x28')](_0x4de02c[_0xbdcb('0x38')]['offset']);}return _0x4e2555['getConfigurations'](_0x2a8e7d);}})[_0xbdcb('0x30')](function(_0x2f4bd5){if(_0x2f4bd5){return _0x2f4bd5?{'count':_0x56a6b0,'rows':_0x2f4bd5}:null;}})['then'](respondWithResult(_0x3f5652,null))['catch'](handleError(_0x3f5652,null));};exports[_0xbdcb('0x57')]=function(_0x3f89ec,_0x381a72,_0x5d40d8){if(_0x3f89ec['body']['id']){delete _0x3f89ec[_0xbdcb('0x51')]['id'];}return db['Dynamics365Account'][_0xbdcb('0x54')]({'where':{'id':_0x3f89ec[_0xbdcb('0x55')]['id']}})['then'](handleEntityNotFound(_0x381a72,null))[_0xbdcb('0x30')](function(_0x1cb3f1){if(_0x1cb3f1){_0x3f89ec[_0xbdcb('0x51')]['AccountId']=_0x1cb3f1['id'];_0x3f89ec[_0xbdcb('0x51')]['Subjects']=integrations[_0xbdcb('0x58')](_0x3f89ec[_0xbdcb('0x51')]['channel'],_0x3f89ec[_0xbdcb('0x51')]['type']);_0x3f89ec['body'][_0xbdcb('0x59')]=integrations[_0xbdcb('0x5a')](_0x3f89ec[_0xbdcb('0x51')]['channel'],_0x3f89ec['body'][_0xbdcb('0x5b')]);return db[_0xbdcb('0x56')][_0xbdcb('0x50')](_0x3f89ec[_0xbdcb('0x51')],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':_0xbdcb('0x59')}]});}return null;})[_0xbdcb('0x30')](respondWithResult(_0x381a72,null))['catch'](handleError(_0x381a72,null));};exports['getFields']=function(_0xe04a5b,_0x417721,_0x2b61be){var _0x802f43=_0xe04a5b[_0xbdcb('0x38')][_0xbdcb('0x5c')];var _0x49f630=_0x802f43===_0xbdcb('0x5d')?_0xbdcb('0x5e'):'PhoneCall';var _0x51fbd7='';var _0x172d3e='';var _0x2338dd='';var _0x287f18='';var _0x45042b='';var _0x45e9d1='';var _0x5aed09='';var _0xbaf400='';var _0x27d841=[_0xbdcb('0x5f'),_0xbdcb('0x60'),_0xbdcb('0x61'),_0xbdcb('0x62'),_0xbdcb('0x63'),_0xbdcb('0x64'),_0xbdcb('0x65'),'regardingobjectid',_0xbdcb('0x66'),_0xbdcb('0x67')];var _0x169880=[_0xbdcb('0x68'),_0xbdcb('0x69'),'actualserviceunits',_0xbdcb('0x6a'),_0xbdcb('0x6b'),_0xbdcb('0x6c'),_0xbdcb('0x6d'),_0xbdcb('0x6e'),'createdbyexternalpartyname',_0xbdcb('0x6f'),'createdbyname',_0xbdcb('0x70'),_0xbdcb('0x71'),_0xbdcb('0x72'),_0xbdcb('0x73'),_0xbdcb('0x74'),_0xbdcb('0x75'),_0xbdcb('0x76'),_0xbdcb('0x77'),'entitlementidname',_0xbdcb('0x78'),'entityimage_url','escalatedon',_0xbdcb('0x79'),_0xbdcb('0x7a'),'followupby',_0xbdcb('0x7b'),_0xbdcb('0x7c'),_0xbdcb('0x7d'),_0xbdcb('0x7e'),_0xbdcb('0x7f'),'modifiedbyexternalpartyname',_0xbdcb('0x80'),'modifiedbyname',_0xbdcb('0x81'),_0xbdcb('0x82'),_0xbdcb('0x83'),'modifiedonbehalfbyyominame',_0xbdcb('0x84'),_0xbdcb('0x85'),_0xbdcb('0x86'),_0xbdcb('0x87'),'overriddencreatedon',_0xbdcb('0x88'),_0xbdcb('0x89'),_0xbdcb('0x8a'),_0xbdcb('0x8b'),'primarycontactidname',_0xbdcb('0x8c'),_0xbdcb('0x8d'),_0xbdcb('0x8e'),_0xbdcb('0x8f'),_0xbdcb('0x90'),_0xbdcb('0x91'),'responseby',_0xbdcb('0x92'),_0xbdcb('0x93'),_0xbdcb('0x94'),_0xbdcb('0x95'),_0xbdcb('0x96'),'socialprofileidname','statecode',_0xbdcb('0x97'),_0xbdcb('0x98'),_0xbdcb('0x99'),'timezoneruleversionnumber','transactioncurrencyidname',_0xbdcb('0x9a'),'utcconversiontimezonecode',_0xbdcb('0x9b')];var _0x2a388d=_0x27d841[_0xbdcb('0x9c')](_0x169880);return db[_0xbdcb('0x35')]['findOne']({'where':{'id':_0xe04a5b[_0xbdcb('0x55')]['id']},'attributes':['id',_0xbdcb('0x9d'),_0xbdcb('0x9e'),_0xbdcb('0x9f'),_0xbdcb('0xa0'),_0xbdcb('0xa1'),_0xbdcb('0xa2')]})[_0xbdcb('0x30')](handleEntityNotFound(_0x417721,null))[_0xbdcb('0x30')](function(_0x1aa706){if(_0x1aa706){_0xbaf400=_0x1aa706[_0xbdcb('0x9f')];var _0x338ded=_0xbaf400['slice'](-0x1);if(_0x338ded==='/'){_0xbaf400=_0xbaf400[_0xbdcb('0xa3')](0x0,_0xbaf400[_0xbdcb('0xa4')](_0x338ded));}_0x5aed09=util['format'](_0xbdcb('0xa5'),_0xbaf400);var _0x2f3f36={'method':_0xbdcb('0xa6'),'uri':_0xbdcb('0xa7')+_0x1aa706[_0xbdcb('0xa0')]+_0xbdcb('0xa8'),'form':{'client_id':_0x1aa706[_0xbdcb('0xa1')],'resource':_0xbaf400,'username':_0x1aa706[_0xbdcb('0x9d')],'password':_0x1aa706[_0xbdcb('0x9e')],'grant_type':_0xbdcb('0x9e'),'client_secret':_0x1aa706[_0xbdcb('0xa2')]},'json':!![]};return rp(_0x2f3f36);}})[_0xbdcb('0x30')](function(_0x324f1d){_0x45e9d1=_0x324f1d['access_token'];var _0x338f54={'method':_0xbdcb('0xa9'),'uri':encodeURI(_0x5aed09+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x49f630+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x45e9d1,'If-None-Match':null,'OData-Version':_0xbdcb('0xaa')},'json':!![]};return rp(_0x338f54);})['then'](function(_0x216433){var _0x5dc836=_0x216433['value'][0x0];var _0x22ae17=_0x5dc836['MetadataId'];var _0x1cd184={'method':_0xbdcb('0xa9'),'uri':_0x5aed09+'EntityDefinitions('+_0x22ae17+_0xbdcb('0xab'),'headers':{'Authorization':_0xbdcb('0xac')+_0x45e9d1,'If-None-Match':null,'OData-Version':_0xbdcb('0xaa')},'json':!![]};return rp(_0x1cd184);})[_0xbdcb('0x30')](function(_0x53bbbc){_0x51fbd7=_0x53bbbc;_0x172d3e=_0x51fbd7[_0xbdcb('0xad')];_0x172d3e=_['remove'](_0x172d3e,function(_0x52d651){return!_0x2a388d['includes'](_0x52d651[_0xbdcb('0xae')]);});var _0x1b5bc2=[];var _0x4d7435=[];_0x172d3e[_0xbdcb('0xaf')](function(_0x36649d){if(_0x36649d['@odata.type']){var _0x54f338=_0x36649d[_0xbdcb('0xb0')][_0xbdcb('0xa3')](_0x36649d[_0xbdcb('0xb0')][_0xbdcb('0xa4')]('.')+0x1);if(_0x54f338==='PicklistAttributeMetadata'){_0x1b5bc2[_0xbdcb('0xb1')](getSelectList(_0x5aed09,_0x802f43,_0x4d7435,_0x51fbd7[_0xbdcb('0xb2')],_0x36649d[_0xbdcb('0xb2')],_0x45e9d1));}}});return Promise['all'](_0x1b5bc2);})['then'](function(_0x4642da){_0x2338dd=_0x4642da[0x0];var _0x460cfd=[];var _0x4bd6a2=[];_0x172d3e[_0xbdcb('0xaf')](function(_0x423c61){if(_0x423c61[_0xbdcb('0xb0')]){var _0x14bb5a=_0x423c61[_0xbdcb('0xb0')][_0xbdcb('0xa3')](_0x423c61[_0xbdcb('0xb0')][_0xbdcb('0xa4')]('.')+0x1);if(_0x14bb5a===_0xbdcb('0xb3')){_0x460cfd[_0xbdcb('0xb1')](getBooleanList(_0x5aed09,_0x802f43,_0x4bd6a2,_0x51fbd7['MetadataId'],_0x423c61[_0xbdcb('0xb2')],_0x45e9d1));}}});return Promise[_0xbdcb('0xb4')](_0x460cfd);})[_0xbdcb('0x30')](function(_0x6a8908){_0x287f18=_0x6a8908[0x0];var _0x1b2a47=[];var _0x3ad2cc=[];_0x172d3e[_0xbdcb('0xaf')](function(_0xb48918){if(_0xb48918[_0xbdcb('0xb0')]){var _0x142028=_0xb48918[_0xbdcb('0xb0')][_0xbdcb('0xa3')](_0xb48918[_0xbdcb('0xb0')]['lastIndexOf']('.')+0x1);if(_0x142028===_0xbdcb('0xb5')||_0x142028===_0xbdcb('0xb6')||_0x142028===_0xbdcb('0xb7')||_0x142028==='IntegerAttributeMetadata'||_0x142028===_0xbdcb('0xb8')||_0x142028==='DateTimeAttributeMetadata'||_0x142028===_0xbdcb('0xb9')||_0x142028===_0xbdcb('0xba')||_0x142028===_0xbdcb('0xbb')||_0x142028===_0xbdcb('0xbc')){_0x1b2a47[_0xbdcb('0xb1')](getInputList(_0x5aed09,_0x802f43,_0x142028,_0x3ad2cc,_0x51fbd7[_0xbdcb('0xb2')],_0xb48918['MetadataId'],_0x45e9d1));}}});return Promise['all'](_0x1b2a47);})['then'](function(_0x49f4d9){_0x45042b=_0x49f4d9[0x0];var _0x3c5675=_0x2338dd[_0xbdcb('0x9c')](_0x287f18)[_0xbdcb('0x9c')](_0x45042b);var _0x54ab48={'count':_0x3c5675[_0xbdcb('0x3e')],'rows':_0x3c5675};return _0x54ab48;})['then'](respondWithResult(_0x417721,null))[_0xbdcb('0x24')](function(_0x2681f9){console['log'](_0xbdcb('0xbd')+_0x2681f9);var _0xf43043=_0xe04a5b[_0xbdcb('0x38')]['test']?0x1f4:_0x2681f9['statusCode']||0x1f4;logger[_0xbdcb('0x1f')](_0x2681f9[_0xbdcb('0x32')]);delete _0x2681f9[_0xbdcb('0x33')];if(_0xf43043===0x191){_0xf43043=0x190;}_0x417721[_0xbdcb('0x2a')](_0xf43043)[_0xbdcb('0x34')](_0xe04a5b[_0xbdcb('0x38')]['test']?{'message':_0xbdcb('0xbe'),'statusCode':_0x2681f9[_0xbdcb('0xbf')]}:_0x2681f9);});};function getSelectList(_0x3ff2ba,_0x550cf6,_0x5e58b9,_0x1db70d,_0x596cab,_0x1ef212){var _0x16d82e={'method':_0xbdcb('0xa9'),'uri':_0x3ff2ba+_0xbdcb('0xc0')+_0x1db70d+_0xbdcb('0xc1')+_0x596cab+_0xbdcb('0xc2')+_0xbdcb('0xc3'),'headers':{'Authorization':_0xbdcb('0xac')+_0x1ef212,'If-None-Match':null,'OData-Version':_0xbdcb('0xaa')},'json':!![]};return rp(_0x16d82e)[_0xbdcb('0x30')](function(_0x3d7b5f){var _0x3e36e7=[];var _0x263e09=_0x3d7b5f[_0xbdcb('0xc4')][_0xbdcb('0xc5')];_0x263e09[_0xbdcb('0xaf')](function(_0x2cb1eb){_0x3e36e7[_0xbdcb('0xb1')]({'name':_0x2cb1eb[_0xbdcb('0xc6')][_0xbdcb('0xc7')]['Label'],'value':String(_0x2cb1eb['Value'])});});var _0x5adad1={'id':_0x550cf6+'_'+_0x3d7b5f[_0xbdcb('0xae')],'name':_0x3d7b5f[_0xbdcb('0xc8')]['UserLocalizedLabel'][_0xbdcb('0xc6')],'custom':![],'options':_0x3e36e7};_0x5e58b9[_0xbdcb('0xb1')](_0x5adad1);return _0x5e58b9;});}function getBooleanList(_0x34cafb,_0x49c329,_0x3b07c9,_0xaf19fc,_0x1620f9,_0x44aac9){var _0x264264={'method':_0xbdcb('0xa9'),'uri':_0x34cafb+_0xbdcb('0xc0')+_0xaf19fc+_0xbdcb('0xc1')+_0x1620f9+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xbdcb('0xac')+_0x44aac9,'If-None-Match':null,'OData-Version':_0xbdcb('0xaa')},'json':!![]};return rp(_0x264264)[_0xbdcb('0x30')](function(_0x340750){var _0x7ba24b=[];_0x7ba24b[_0xbdcb('0xb1')]({'name':_0x340750[_0xbdcb('0xc4')][_0xbdcb('0xc9')][_0xbdcb('0xc6')][_0xbdcb('0xc7')][_0xbdcb('0xc6')],'value':String(_0x340750[_0xbdcb('0xc4')][_0xbdcb('0xc9')]['Value'])},{'name':_0x340750[_0xbdcb('0xc4')][_0xbdcb('0xca')]['Label'][_0xbdcb('0xc7')]['Label'],'value':String(_0x340750[_0xbdcb('0xc4')][_0xbdcb('0xca')][_0xbdcb('0xcb')])});var _0x55c874={'id':_0x49c329+'_'+_0x340750[_0xbdcb('0xae')],'name':_0x340750['DisplayName'][_0xbdcb('0xc7')]['Label'],'custom':![],'options':_0x7ba24b};_0x3b07c9[_0xbdcb('0xb1')](_0x55c874);return _0x3b07c9;});}function getInputList(_0x22bdaf,_0x2c1714,_0x5edd18,_0x5d9c06,_0x43633d,_0x343fd2,_0x4382f9){var _0x5afa0c={'method':_0xbdcb('0xa9'),'uri':_0x22bdaf+_0xbdcb('0xc0')+_0x43633d+_0xbdcb('0xc1')+_0x343fd2+_0xbdcb('0xcc')+_0x5edd18+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xbdcb('0xac')+_0x4382f9,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5afa0c)[_0xbdcb('0x30')](function(_0x20a725){var _0x1426f9={'id':_0x2c1714+'_'+_0x20a725['LogicalName'],'name':_0x20a725['DisplayName'][_0xbdcb('0xc7')]?_0x20a725['DisplayName'][_0xbdcb('0xc7')][_0xbdcb('0xc6')]:_0x20a725['LogicalName'],'custom':![],'options':[]};_0x5d9c06[_0xbdcb('0xb1')](_0x1426f9);return _0x5d9c06;});}
\ No newline at end of file
index cb4e706..0889072 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x49e5=['../../components/integrations/configuration','define','Dynamics365Account','int_dynamics365_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./intDynamics365Account.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x49e5,0x1cc));var _0x549e=function(_0xc48607,_0x404775){_0xc48607=_0xc48607-0x0;var _0x5f2fc1=_0x49e5[_0xc48607];return _0x5f2fc1;};'use strict';var _=require(_0x549e('0x0'));var util=require(_0x549e('0x1'));var logger=require(_0x549e('0x2'))(_0x549e('0x3'));var moment=require(_0x549e('0x4'));var BPromise=require(_0x549e('0x5'));var rp=require(_0x549e('0x6'));var attributes=require(_0x549e('0x7'));var integrations=require(_0x549e('0x8'));module['exports']=function(_0x221e78,_0x31543b){return _0x221e78[_0x549e('0x9')](_0x549e('0xa'),attributes,{'tableName':_0x549e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x85ca=['./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4f49c1,_0x12654c){var _0x1facf4=function(_0x446a39){while(--_0x446a39){_0x4f49c1['push'](_0x4f49c1['shift']());}};_0x1facf4(++_0x12654c);}(_0x85ca,0x172));var _0xa85c=function(_0x2cd7f9,_0x3c1e9e){_0x2cd7f9=_0x2cd7f9-0x0;var _0x14b5a9=_0x85ca[_0x2cd7f9];return _0x14b5a9;};'use strict';var _=require(_0xa85c('0x0'));var util=require(_0xa85c('0x1'));var logger=require(_0xa85c('0x2'))(_0xa85c('0x3'));var moment=require(_0xa85c('0x4'));var BPromise=require(_0xa85c('0x5'));var rp=require(_0xa85c('0x6'));var attributes=require(_0xa85c('0x7'));var integrations=require(_0xa85c('0x8'));module[_0xa85c('0x9')]=function(_0x258284,_0x476034){return _0x258284[_0xa85c('0xa')](_0xa85c('0xb'),attributes,{'tableName':_0xa85c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 25d1043..a9443b6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc115=['../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Dynamics365Account,\x20%s,\x20%s','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','map','include','model','find','ShowDynamics365Account','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x24617e,_0x346651){var _0x4bdda3=function(_0x322827){while(--_0x322827){_0x24617e['push'](_0x24617e['shift']());}};_0x4bdda3(++_0x346651);}(_0xc115,0xee));var _0x5c11=function(_0x5eb71d,_0x198b99){_0x5eb71d=_0x5eb71d-0x0;var _0x99c95a=_0xc115[_0x5eb71d];return _0x99c95a;};'use strict';var _=require(_0x5c11('0x0'));var util=require(_0x5c11('0x1'));var moment=require(_0x5c11('0x2'));var BPromise=require('bluebird');var rs=require(_0x5c11('0x3'));var fs=require('fs');var Redis=require(_0x5c11('0x4'));var db=require(_0x5c11('0x5'))['db'];var utils=require(_0x5c11('0x6'));var logger=require(_0x5c11('0x7'))(_0x5c11('0x8'));var config=require(_0x5c11('0x9'));var jayson=require(_0x5c11('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a54d8,_0x1c8da1,_0x8587d7){return new BPromise(function(_0x4ffcbe,_0x5d17b9){return client[_0x5c11('0xb')](_0x4a54d8,_0x8587d7)[_0x5c11('0xc')](function(_0x477fce){logger[_0x5c11('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x1c8da1,'request\x20sent');logger[_0x5c11('0xe')](_0x5c11('0xf'),_0x1c8da1,_0x5c11('0x10'),JSON[_0x5c11('0x11')](_0x477fce));if(_0x477fce[_0x5c11('0x12')]){if(_0x477fce['error'][_0x5c11('0x13')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x1c8da1,_0x477fce[_0x5c11('0x12')][_0x5c11('0x14')]);return _0x5d17b9(_0x477fce[_0x5c11('0x12')][_0x5c11('0x14')]);}logger[_0x5c11('0x12')](_0x5c11('0x15'),_0x1c8da1,_0x477fce[_0x5c11('0x12')]['message']);return _0x4ffcbe(_0x477fce[_0x5c11('0x12')]['message']);}else{logger[_0x5c11('0xd')](_0x5c11('0x15'),_0x1c8da1,_0x5c11('0x10'));_0x4ffcbe(_0x477fce[_0x5c11('0x16')][_0x5c11('0x14')]);}})[_0x5c11('0x17')](function(_0x4919b5){logger[_0x5c11('0x12')](_0x5c11('0x15'),_0x1c8da1,_0x4919b5);_0x5d17b9(_0x4919b5);});});}exports[_0x5c11('0x18')]=function(_0x5bac53){var _0x837b4b=this;return new Promise(function(_0x57a961,_0x1695c8){return db[_0x5c11('0x19')][_0x5c11('0x1a')]({'raw':_0x5bac53[_0x5c11('0x1b')]?_0x5bac53[_0x5c11('0x1b')][_0x5c11('0x1c')]===undefined?!![]:![]:!![],'where':_0x5bac53[_0x5c11('0x1b')]?_0x5bac53[_0x5c11('0x1b')]['where']||null:null,'attributes':_0x5bac53[_0x5c11('0x1b')]?_0x5bac53[_0x5c11('0x1b')][_0x5c11('0x1d')]||null:null,'limit':_0x5bac53['options']?_0x5bac53['options']['limit']||null:null,'include':_0x5bac53['options']?_0x5bac53[_0x5c11('0x1b')]['include']?_[_0x5c11('0x1e')](_0x5bac53[_0x5c11('0x1b')][_0x5c11('0x1f')],function(_0x1aad7b){return{'model':db[_0x1aad7b[_0x5c11('0x20')]],'as':_0x1aad7b['as'],'attributes':_0x1aad7b['attributes'],'include':_0x1aad7b[_0x5c11('0x1f')]?_[_0x5c11('0x1e')](_0x1aad7b[_0x5c11('0x1f')],function(_0x260a4c){return{'model':db[_0x260a4c['model']],'as':_0x260a4c['as'],'attributes':_0x260a4c[_0x5c11('0x1d')],'include':_0x260a4c[_0x5c11('0x1f')]?_[_0x5c11('0x1e')](_0x260a4c[_0x5c11('0x1f')],function(_0x42a210){return{'model':db[_0x42a210[_0x5c11('0x20')]],'as':_0x42a210['as'],'attributes':_0x42a210[_0x5c11('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5c11('0xc')](function(_0x2200b7){logger['info'](_0x5c11('0x18'),_0x5bac53);logger['debug'](_0x5c11('0x18'),_0x5bac53,JSON[_0x5c11('0x11')](_0x2200b7));_0x57a961(_0x2200b7);})['catch'](function(_0x284cb3){logger['error']('GetDynamics365Account',_0x284cb3[_0x5c11('0x14')],_0x5bac53);_0x1695c8(_0x837b4b[_0x5c11('0x12')](0x1f4,_0x284cb3['message']));});});};exports['ShowDynamics365Account']=function(_0x5dad2a){var _0x22c128=this;return new Promise(function(_0x5bb92c,_0x660e04){return db[_0x5c11('0x19')][_0x5c11('0x21')]({'raw':_0x5dad2a[_0x5c11('0x1b')]?_0x5dad2a[_0x5c11('0x1b')][_0x5c11('0x1c')]===undefined?!![]:![]:!![],'where':_0x5dad2a[_0x5c11('0x1b')]?_0x5dad2a[_0x5c11('0x1b')]['where']||null:null,'attributes':_0x5dad2a['options']?_0x5dad2a['options'][_0x5c11('0x1d')]||null:null,'include':_0x5dad2a['options']?_0x5dad2a['options']['include']?_[_0x5c11('0x1e')](_0x5dad2a['options'][_0x5c11('0x1f')],function(_0xa44ea7){return{'model':db[_0xa44ea7[_0x5c11('0x20')]],'as':_0xa44ea7['as'],'attributes':_0xa44ea7['attributes'],'include':_0xa44ea7[_0x5c11('0x1f')]?_[_0x5c11('0x1e')](_0xa44ea7[_0x5c11('0x1f')],function(_0x129b75){return{'model':db[_0x129b75[_0x5c11('0x20')]],'as':_0x129b75['as'],'attributes':_0x129b75[_0x5c11('0x1d')],'include':_0x129b75[_0x5c11('0x1f')]?_[_0x5c11('0x1e')](_0x129b75[_0x5c11('0x1f')],function(_0x3de3b4){return{'model':db[_0x3de3b4['model']],'as':_0x3de3b4['as'],'attributes':_0x3de3b4['attributes']};}):[]};}):[]};}):[]:[]})[_0x5c11('0xc')](function(_0xed3103){logger[_0x5c11('0xd')](_0x5c11('0x22'),_0x5dad2a);logger[_0x5c11('0xe')](_0x5c11('0x22'),_0x5dad2a,JSON[_0x5c11('0x11')](_0xed3103));_0x5bb92c(_0xed3103);})[_0x5c11('0x17')](function(_0x505e39){logger[_0x5c11('0x12')](_0x5c11('0x22'),_0x505e39['message'],_0x5dad2a);_0x660e04(_0x22c128[_0x5c11('0x12')](0x1f4,_0x505e39[_0x5c11('0x14')]));});});};
\ No newline at end of file
+var _0x27aa=['model','map','info','GetDynamics365Account','catch','ShowDynamics365Account','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Dynamics365Account','findAll','options','raw','where','attributes','limit','include'];(function(_0x5c137e,_0x56a07f){var _0x4d3a2c=function(_0xc31d75){while(--_0xc31d75){_0x5c137e['push'](_0x5c137e['shift']());}};_0x4d3a2c(++_0x56a07f);}(_0x27aa,0x16f));var _0xa27a=function(_0x265468,_0xcf7439){_0x265468=_0x265468-0x0;var _0x37d555=_0x27aa[_0x265468];return _0x37d555;};'use strict';var _=require('lodash');var util=require(_0xa27a('0x0'));var moment=require(_0xa27a('0x1'));var BPromise=require(_0xa27a('0x2'));var rs=require(_0xa27a('0x3'));var fs=require('fs');var Redis=require(_0xa27a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa27a('0x5'));var logger=require(_0xa27a('0x6'))(_0xa27a('0x7'));var config=require('../../config/environment');var jayson=require(_0xa27a('0x8'));var client=jayson[_0xa27a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19e9e8,_0x21af82,_0x37600d){return new BPromise(function(_0x55766f,_0xa7a5f5){return client[_0xa27a('0xa')](_0x19e9e8,_0x37600d)[_0xa27a('0xb')](function(_0x143dce){logger['info'](_0xa27a('0xc'),_0x21af82,_0xa27a('0xd'));logger[_0xa27a('0xe')](_0xa27a('0xf'),_0x21af82,_0xa27a('0xd'),JSON[_0xa27a('0x10')](_0x143dce));if(_0x143dce[_0xa27a('0x11')]){if(_0x143dce['error'][_0xa27a('0x12')]===0x1f4){logger[_0xa27a('0x11')](_0xa27a('0xc'),_0x21af82,_0x143dce['error'][_0xa27a('0x13')]);return _0xa7a5f5(_0x143dce[_0xa27a('0x11')][_0xa27a('0x13')]);}logger['error'](_0xa27a('0xc'),_0x21af82,_0x143dce['error'][_0xa27a('0x13')]);return _0x55766f(_0x143dce[_0xa27a('0x11')][_0xa27a('0x13')]);}else{logger['info'](_0xa27a('0xc'),_0x21af82,_0xa27a('0xd'));_0x55766f(_0x143dce[_0xa27a('0x14')][_0xa27a('0x13')]);}})['catch'](function(_0x5d5c18){logger[_0xa27a('0x11')](_0xa27a('0xc'),_0x21af82,_0x5d5c18);_0xa7a5f5(_0x5d5c18);});});}exports['GetDynamics365Account']=function(_0xf40701){var _0x22db1b=this;return new Promise(function(_0x5b5725,_0x39287d){return db[_0xa27a('0x15')][_0xa27a('0x16')]({'raw':_0xf40701['options']?_0xf40701[_0xa27a('0x17')][_0xa27a('0x18')]===undefined?!![]:![]:!![],'where':_0xf40701['options']?_0xf40701[_0xa27a('0x17')][_0xa27a('0x19')]||null:null,'attributes':_0xf40701[_0xa27a('0x17')]?_0xf40701[_0xa27a('0x17')][_0xa27a('0x1a')]||null:null,'limit':_0xf40701[_0xa27a('0x17')]?_0xf40701['options'][_0xa27a('0x1b')]||null:null,'include':_0xf40701[_0xa27a('0x17')]?_0xf40701[_0xa27a('0x17')]['include']?_['map'](_0xf40701['options'][_0xa27a('0x1c')],function(_0x29bc50){return{'model':db[_0x29bc50[_0xa27a('0x1d')]],'as':_0x29bc50['as'],'attributes':_0x29bc50[_0xa27a('0x1a')],'include':_0x29bc50[_0xa27a('0x1c')]?_[_0xa27a('0x1e')](_0x29bc50['include'],function(_0x14b8fb){return{'model':db[_0x14b8fb['model']],'as':_0x14b8fb['as'],'attributes':_0x14b8fb['attributes'],'include':_0x14b8fb[_0xa27a('0x1c')]?_[_0xa27a('0x1e')](_0x14b8fb[_0xa27a('0x1c')],function(_0xd37ad7){return{'model':db[_0xd37ad7[_0xa27a('0x1d')]],'as':_0xd37ad7['as'],'attributes':_0xd37ad7[_0xa27a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa27a('0xb')](function(_0x10a880){logger[_0xa27a('0x1f')](_0xa27a('0x20'),_0xf40701);logger[_0xa27a('0xe')](_0xa27a('0x20'),_0xf40701,JSON['stringify'](_0x10a880));_0x5b5725(_0x10a880);})[_0xa27a('0x21')](function(_0x32c4d6){logger['error']('GetDynamics365Account',_0x32c4d6['message'],_0xf40701);_0x39287d(_0x22db1b[_0xa27a('0x11')](0x1f4,_0x32c4d6[_0xa27a('0x13')]));});});};exports[_0xa27a('0x22')]=function(_0x46f3a1){var _0x28ddd7=this;return new Promise(function(_0x554c49,_0x3b0a4a){return db[_0xa27a('0x15')][_0xa27a('0x23')]({'raw':_0x46f3a1[_0xa27a('0x17')]?_0x46f3a1['options'][_0xa27a('0x18')]===undefined?!![]:![]:!![],'where':_0x46f3a1['options']?_0x46f3a1[_0xa27a('0x17')][_0xa27a('0x19')]||null:null,'attributes':_0x46f3a1['options']?_0x46f3a1[_0xa27a('0x17')][_0xa27a('0x1a')]||null:null,'include':_0x46f3a1['options']?_0x46f3a1[_0xa27a('0x17')][_0xa27a('0x1c')]?_[_0xa27a('0x1e')](_0x46f3a1['options'][_0xa27a('0x1c')],function(_0x490e73){return{'model':db[_0x490e73[_0xa27a('0x1d')]],'as':_0x490e73['as'],'attributes':_0x490e73[_0xa27a('0x1a')],'include':_0x490e73[_0xa27a('0x1c')]?_[_0xa27a('0x1e')](_0x490e73[_0xa27a('0x1c')],function(_0xf93aa8){return{'model':db[_0xf93aa8[_0xa27a('0x1d')]],'as':_0xf93aa8['as'],'attributes':_0xf93aa8['attributes'],'include':_0xf93aa8[_0xa27a('0x1c')]?_['map'](_0xf93aa8['include'],function(_0x54be31){return{'model':db[_0x54be31[_0xa27a('0x1d')]],'as':_0x54be31['as'],'attributes':_0x54be31[_0xa27a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa27a('0xb')](function(_0x4af9a7){logger[_0xa27a('0x1f')](_0xa27a('0x22'),_0x46f3a1);logger[_0xa27a('0xe')](_0xa27a('0x22'),_0x46f3a1,JSON['stringify'](_0x4af9a7));_0x554c49(_0x4af9a7);})[_0xa27a('0x21')](function(_0x14c3f2){logger[_0xa27a('0x11')](_0xa27a('0x22'),_0x14c3f2[_0xa27a('0x13')],_0x46f3a1);_0x3b0a4a(_0x28ddd7['error'](0x1f4,_0x14c3f2[_0xa27a('0x13')]));});});};
\ No newline at end of file
index 18a7888..89e80cd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdb19=['../../config/environment','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','update','delete','destroy','util','path','express','Router'];(function(_0x5413ed,_0x1a6fa0){var _0x8ab64=function(_0x43bcad){while(--_0x43bcad){_0x5413ed['push'](_0x5413ed['shift']());}};_0x8ab64(++_0x1a6fa0);}(_0xdb19,0xb0));var _0x9db1=function(_0xf36354,_0x55640e){_0xf36354=_0xf36354-0x0;var _0x559d8e=_0xdb19[_0xf36354];return _0x559d8e;};'use strict';var multer=require('multer');var util=require(_0x9db1('0x0'));var path=require(_0x9db1('0x1'));var timeout=require('connect-timeout');var express=require(_0x9db1('0x2'));var router=express[_0x9db1('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9db1('0x4'));var controller=require('./intDynamics365Configuration.controller');router[_0x9db1('0x5')]('/',auth['isAuthenticated'](),controller[_0x9db1('0x6')]);router[_0x9db1('0x5')](_0x9db1('0x7'),auth[_0x9db1('0x8')](),controller[_0x9db1('0x9')]);router[_0x9db1('0x5')](_0x9db1('0xa'),auth[_0x9db1('0x8')](),controller[_0x9db1('0xb')]);router[_0x9db1('0x5')](_0x9db1('0xc'),auth[_0x9db1('0x8')](),controller[_0x9db1('0xd')]);router[_0x9db1('0x5')](_0x9db1('0xe'),auth[_0x9db1('0x8')](),controller['getDescriptions']);router[_0x9db1('0xf')]('/',auth[_0x9db1('0x8')](),controller[_0x9db1('0x10')]);router['put'](_0x9db1('0x7'),auth[_0x9db1('0x8')](),controller[_0x9db1('0x11')]);router[_0x9db1('0x12')](_0x9db1('0x7'),auth[_0x9db1('0x8')](),controller[_0x9db1('0x13')]);module['exports']=router;
\ No newline at end of file
+var _0xdd8b=['getDescriptions','post','create','put','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getFields','getSubjects','/:id/descriptions'];(function(_0x4e8ac4,_0x3d1590){var _0x31f770=function(_0x29133f){while(--_0x29133f){_0x4e8ac4['push'](_0x4e8ac4['shift']());}};_0x31f770(++_0x3d1590);}(_0xdd8b,0x1ea));var _0xbdd8=function(_0x171fdc,_0x16ae91){_0x171fdc=_0x171fdc-0x0;var _0x3782ea=_0xdd8b[_0x171fdc];return _0x3782ea;};'use strict';var multer=require(_0xbdd8('0x0'));var util=require(_0xbdd8('0x1'));var path=require(_0xbdd8('0x2'));var timeout=require('connect-timeout');var express=require(_0xbdd8('0x3'));var router=express[_0xbdd8('0x4')]();var auth=require(_0xbdd8('0x5'));var interaction=require(_0xbdd8('0x6'));var config=require(_0xbdd8('0x7'));var controller=require('./intDynamics365Configuration.controller');router[_0xbdd8('0x8')]('/',auth[_0xbdd8('0x9')](),controller[_0xbdd8('0xa')]);router['get'](_0xbdd8('0xb'),auth[_0xbdd8('0x9')](),controller[_0xbdd8('0xc')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xbdd8('0xd')]);router[_0xbdd8('0x8')]('/:id/subjects',auth[_0xbdd8('0x9')](),controller[_0xbdd8('0xe')]);router[_0xbdd8('0x8')](_0xbdd8('0xf'),auth[_0xbdd8('0x9')](),controller[_0xbdd8('0x10')]);router[_0xbdd8('0x11')]('/',auth[_0xbdd8('0x9')](),controller[_0xbdd8('0x12')]);router[_0xbdd8('0x13')](_0xbdd8('0xb'),auth['isAuthenticated'](),controller[_0xbdd8('0x14')]);router[_0xbdd8('0x15')](_0xbdd8('0xb'),auth[_0xbdd8('0x9')](),controller[_0xbdd8('0x16')]);module['exports']=router;
\ No newline at end of file
index 34cdd1a..e6d9318 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x835b=['phonecall','sequelize','exports','STRING','ENUM'];(function(_0x25c988,_0xce8221){var _0x45fcc2=function(_0x47fba5){while(--_0x47fba5){_0x25c988['push'](_0x25c988['shift']());}};_0x45fcc2(++_0xce8221);}(_0x835b,0x1e6));var _0xb835=function(_0x14a1b4,_0x2c72b0){_0x14a1b4=_0x14a1b4-0x0;var _0x3cb209=_0x835b[_0x14a1b4];return _0x3cb209;};'use strict';var Sequelize=require(_0xb835('0x0'));module[_0xb835('0x1')]={'name':{'type':Sequelize[_0xb835('0x2')]},'description':{'type':Sequelize[_0xb835('0x2')]},'ticketType':{'type':Sequelize[_0xb835('0x3')]('incident',_0xb835('0x4')),'defaultValue':'incident'}};
\ No newline at end of file
+var _0x1ad1=['phonecall','exports','STRING','ENUM','incident'];(function(_0x35c13d,_0x544837){var _0x1a72f2=function(_0x36a2d3){while(--_0x36a2d3){_0x35c13d['push'](_0x35c13d['shift']());}};_0x1a72f2(++_0x544837);}(_0x1ad1,0x15a));var _0x11ad=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x1ad1[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require('sequelize');module[_0x11ad('0x0')]={'name':{'type':Sequelize[_0x11ad('0x1')]},'description':{'type':Sequelize[_0x11ad('0x1')]},'ticketType':{'type':Sequelize[_0x11ad('0x2')](_0x11ad('0x3'),_0x11ad('0x4')),'defaultValue':_0x11ad('0x3')}};
\ No newline at end of file
index 4e70545..90e1a74 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x351d=['debug','stringify','error','code','message','request\x20sent','result','sendStatus','end','json','count','limit','set','Content-Range','update','destroy','status','stack','name','send','index','Dynamics365Configuration','rawAttributes','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','map','type','key','VIRTUAL','field','includeAll','include','findAll','rows','show','params','filters','length','merge','options','catch','body','find','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','../../components/auth/service','ioredis','../../components/parsers/qs','api','../../config/utils','../../mysqldb','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s'];(function(_0x4782eb,_0x1dafc9){var _0x9f1353=function(_0x1b74b4){while(--_0x1b74b4){_0x4782eb['push'](_0x4782eb['shift']());}};_0x9f1353(++_0x1dafc9);}(_0x351d,0x90));var _0xd351=function(_0x225c21,_0x2d4385){_0x225c21=_0x225c21-0x0;var _0x242412=_0x351d[_0x225c21];return _0x242412;};'use strict';var pdf=require(_0xd351('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd351('0x1'));var zipdir=require(_0xd351('0x2'));var jsonpatch=require(_0xd351('0x3'));var rp=require('request-promise');var moment=require(_0xd351('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd351('0x5'));var util=require(_0xd351('0x6'));var path=require('path');var sox=require(_0xd351('0x7'));var csv=require(_0xd351('0x8'));var ejs=require(_0xd351('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd351('0xa'));var crypto=require(_0xd351('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd351('0xc'));var toCsv=require(_0xd351('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0xd351('0xd'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0xd351('0xe'));var qs=require(_0xd351('0xf'));var logger=require('../../config/logger')(_0xd351('0x10'));var utils=require(_0xd351('0x11'));var config=require('../../config/environment');var db=require(_0xd351('0x12'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xd351('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x15549a,_0x23445f,_0x1eb2a9,_0x4917d5){return new BPromise(function(_0x358382,_0x316cf6){var _0x597d7c=_0x4917d5||client;return _0x597d7c[_0xd351('0x14')](_0x15549a,_0x1eb2a9)[_0xd351('0x15')](function(_0x3c2299){logger[_0xd351('0x16')](_0xd351('0x17'),_0x23445f,'request\x20sent');logger[_0xd351('0x18')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x23445f,'request\x20sent',JSON[_0xd351('0x19')](_0x3c2299));if(_0x3c2299['error']){if(_0x3c2299[_0xd351('0x1a')][_0xd351('0x1b')]===0x1f4){logger[_0xd351('0x1a')]('Dynamics365Configuration,\x20%s,\x20%s',_0x23445f,_0x3c2299[_0xd351('0x1a')][_0xd351('0x1c')]);return _0x316cf6(_0x3c2299[_0xd351('0x1a')][_0xd351('0x1c')]);}logger['error'](_0xd351('0x17'),_0x23445f,_0x3c2299['error']['message']);return _0x358382(_0x3c2299[_0xd351('0x1a')]['message']);}else{logger[_0xd351('0x16')](_0xd351('0x17'),_0x23445f,_0xd351('0x1d'));_0x358382(_0x3c2299[_0xd351('0x1e')][_0xd351('0x1c')]);}})['catch'](function(_0x18625b){logger[_0xd351('0x1a')](_0xd351('0x17'),_0x23445f,_0x18625b);_0x316cf6(_0x18625b);});});}function respondWithStatusCode(_0x4e447f,_0x1ce7f7){_0x1ce7f7=_0x1ce7f7||0xcc;return function(_0x2d9aa0){if(_0x2d9aa0){return _0x4e447f[_0xd351('0x1f')](_0x1ce7f7);}return _0x4e447f['status'](_0x1ce7f7)[_0xd351('0x20')]();};}function respondWithResult(_0x34a5cb,_0x4626c4){_0x4626c4=_0x4626c4||0xc8;return function(_0x469e7d){if(_0x469e7d){return _0x34a5cb['status'](_0x4626c4)[_0xd351('0x21')](_0x469e7d);}};}function respondWithFilteredResult(_0x483c92,_0x358bff){return function(_0x8ad0a6){if(_0x8ad0a6){var _0x54f471=_0x8ad0a6[_0xd351('0x22')],_0x2648d0=_0x358bff['offset'],_0x55b4d3=_0x358bff['offset']+_0x358bff[_0xd351('0x23')],_0x50d67e;if(_0x55b4d3>=_0x54f471){_0x55b4d3=_0x54f471;_0x50d67e=0xc8;}else{_0x50d67e=0xce;}_0x483c92['status'](_0x50d67e);return _0x483c92[_0xd351('0x24')](_0xd351('0x25'),_0x2648d0+'-'+_0x55b4d3+'/'+_0x54f471)[_0xd351('0x21')](_0x8ad0a6);}return null;};}function patchUpdates(_0x4d3f48){return function(_0x71ce9c){try{jsonpatch['apply'](_0x71ce9c,_0x4d3f48,!![]);}catch(_0x1c826b){return BPromise['reject'](_0x1c826b);}return _0x71ce9c['save']();};}function saveUpdates(_0xeb4da9,_0x38c82f){return function(_0x3f9ef3){if(_0x3f9ef3){return _0x3f9ef3[_0xd351('0x26')](_0xeb4da9)['then'](function(_0x341da0){return _0x341da0;});}return null;};}function removeEntity(_0x1f7ee8,_0x38023c){return function(_0x41da60){if(_0x41da60){return _0x41da60[_0xd351('0x27')]()[_0xd351('0x15')](function(){_0x1f7ee8[_0xd351('0x28')](0xcc)[_0xd351('0x20')]();});}};}function handleEntityNotFound(_0x19bddd,_0x571f64){return function(_0x3feab5){if(!_0x3feab5){_0x19bddd[_0xd351('0x1f')](0x194);}return _0x3feab5;};}function handleError(_0xa5a7d4,_0xcb3acf){_0xcb3acf=_0xcb3acf||0x1f4;return function(_0x5e6e6d){logger[_0xd351('0x1a')](_0x5e6e6d[_0xd351('0x29')]);if(_0x5e6e6d[_0xd351('0x2a')]){delete _0x5e6e6d[_0xd351('0x2a')];}_0xa5a7d4[_0xd351('0x28')](_0xcb3acf)[_0xd351('0x2b')](_0x5e6e6d);};}exports[_0xd351('0x2c')]=function(_0x177eb5,_0x238663){var _0x51b280={},_0x521663={},_0x1fae11={'count':0x0,'rows':[]};var _0xa31042=db[_0xd351('0x2d')][_0xd351('0x2e')];_0x521663[_0xd351('0x2f')]=_[_0xd351('0x30')](_0xa31042);_0x521663['query']=_['keys'](_0x177eb5[_0xd351('0x31')]);_0x521663['filters']=_[_0xd351('0x32')](_0x521663[_0xd351('0x2f')],_0x521663[_0xd351('0x31')]);_0x51b280[_0xd351('0x33')]=_[_0xd351('0x32')](_0x521663[_0xd351('0x2f')],qs[_0xd351('0x34')](_0x177eb5[_0xd351('0x31')][_0xd351('0x34')]));_0x51b280[_0xd351('0x33')]=_0x51b280[_0xd351('0x33')]['length']?_0x51b280[_0xd351('0x33')]:_0x521663['model'];if(!_0x177eb5[_0xd351('0x31')][_0xd351('0x35')](_0xd351('0x36'))){_0x51b280[_0xd351('0x23')]=qs[_0xd351('0x23')](_0x177eb5[_0xd351('0x31')]['limit']);_0x51b280[_0xd351('0x37')]=qs[_0xd351('0x37')](_0x177eb5['query'][_0xd351('0x37')]);}_0x51b280[_0xd351('0x38')]=qs[_0xd351('0x39')](_0x177eb5[_0xd351('0x31')][_0xd351('0x39')]);_0x51b280['where']=qs['filters'](_[_0xd351('0x3a')](_0x177eb5[_0xd351('0x31')],_0x521663['filters']));if(_0x177eb5['query'][_0xd351('0x3b')]){_0x51b280[_0xd351('0x3c')]=_['merge'](_0x51b280['where'],{'$or':_[_0xd351('0x3d')](_0xa31042,function(_0x18f9d1){if(_0x18f9d1[_0xd351('0x3e')][_0xd351('0x3f')]!==_0xd351('0x40')){var _0x33a262={};_0x33a262[_0x18f9d1[_0xd351('0x41')]]={'$like':'%'+_0x177eb5[_0xd351('0x31')][_0xd351('0x3b')]+'%'};return _0x33a262;}})});}_0x51b280=_['merge']({},_0x51b280,_0x177eb5['options']);var _0x35e651={'where':_0x51b280[_0xd351('0x3c')]};return db[_0xd351('0x2d')][_0xd351('0x22')](_0x35e651)[_0xd351('0x15')](function(_0x4332e7){_0x1fae11[_0xd351('0x22')]=_0x4332e7;if(_0x177eb5[_0xd351('0x31')][_0xd351('0x42')]){_0x51b280[_0xd351('0x43')]=[{'all':!![]}];}return db[_0xd351('0x2d')][_0xd351('0x44')](_0x51b280);})[_0xd351('0x15')](function(_0x42a162){_0x1fae11[_0xd351('0x45')]=_0x42a162;return _0x1fae11;})[_0xd351('0x15')](respondWithFilteredResult(_0x238663,_0x51b280))['catch'](handleError(_0x238663,null));};exports[_0xd351('0x46')]=function(_0x3ec78a,_0x8fe1b5){var _0x56616f={'raw':![],'where':{'id':_0x3ec78a[_0xd351('0x47')]['id']}},_0x25cf80={};_0x25cf80[_0xd351('0x2f')]=_[_0xd351('0x30')](db[_0xd351('0x2d')]['rawAttributes']);_0x25cf80[_0xd351('0x31')]=_['keys'](_0x3ec78a[_0xd351('0x31')]);_0x25cf80[_0xd351('0x48')]=_['intersection'](_0x25cf80['model'],_0x25cf80[_0xd351('0x31')]);_0x56616f[_0xd351('0x33')]=_[_0xd351('0x32')](_0x25cf80['model'],qs[_0xd351('0x34')](_0x3ec78a[_0xd351('0x31')]['fields']));_0x56616f[_0xd351('0x33')]=_0x56616f['attributes'][_0xd351('0x49')]?_0x56616f[_0xd351('0x33')]:_0x25cf80['model'];if(_0x3ec78a['query'][_0xd351('0x42')]){_0x56616f['include']=[{'all':!![]}];}_0x56616f=_[_0xd351('0x4a')]({},_0x56616f,_0x3ec78a[_0xd351('0x4b')]);return db[_0xd351('0x2d')]['find'](_0x56616f)[_0xd351('0x15')](handleEntityNotFound(_0x8fe1b5,null))['then'](respondWithResult(_0x8fe1b5,null))['catch'](handleError(_0x8fe1b5,null));};exports['create']=function(_0x7e4bad,_0x292af3){return db[_0xd351('0x2d')]['create'](_0x7e4bad['body'],{})[_0xd351('0x15')](respondWithResult(_0x292af3,0xc9))[_0xd351('0x4c')](handleError(_0x292af3,null));};exports['update']=function(_0x2a87cf,_0x202bc4){if(_0x2a87cf['body']['id']){delete _0x2a87cf[_0xd351('0x4d')]['id'];}return db['Dynamics365Configuration'][_0xd351('0x4e')]({'where':{'id':_0x2a87cf['params']['id']}})[_0xd351('0x15')](handleEntityNotFound(_0x202bc4,null))[_0xd351('0x15')](saveUpdates(_0x2a87cf[_0xd351('0x4d')],null))[_0xd351('0x15')](respondWithResult(_0x202bc4,null))[_0xd351('0x4c')](handleError(_0x202bc4,null));};exports[_0xd351('0x27')]=function(_0x1bcbb0,_0x55792e){return db['Dynamics365Configuration'][_0xd351('0x4e')]({'where':{'id':_0x1bcbb0[_0xd351('0x47')]['id']}})['then'](handleEntityNotFound(_0x55792e,null))[_0xd351('0x15')](removeEntity(_0x55792e,null))[_0xd351('0x4c')](handleError(_0x55792e,null));};exports[_0xd351('0x4f')]=function(_0x4da037,_0x169122,_0x5e2dac){var _0x5ab6b1={};var _0x2c0cb1={};var _0x434465;var _0x4d5a60;return db[_0xd351('0x2d')][_0xd351('0x50')]({'where':{'id':_0x4da037[_0xd351('0x47')]['id']}})[_0xd351('0x15')](handleEntityNotFound(_0x169122,null))[_0xd351('0x15')](function(_0x2dc745){if(_0x2dc745){_0x434465=_0x2dc745;_0x2c0cb1['model']=_[_0xd351('0x30')](db[_0xd351('0x51')][_0xd351('0x2e')]);_0x2c0cb1[_0xd351('0x31')]=_[_0xd351('0x30')](_0x4da037[_0xd351('0x31')]);_0x2c0cb1[_0xd351('0x48')]=_['intersection'](_0x2c0cb1[_0xd351('0x2f')],_0x2c0cb1['query']);_0x5ab6b1[_0xd351('0x33')]=_[_0xd351('0x32')](_0x2c0cb1[_0xd351('0x2f')],qs[_0xd351('0x34')](_0x4da037[_0xd351('0x31')]['fields']));_0x5ab6b1[_0xd351('0x33')]=_0x5ab6b1['attributes'][_0xd351('0x49')]?_0x5ab6b1[_0xd351('0x33')]:_0x2c0cb1[_0xd351('0x2f')];_0x5ab6b1[_0xd351('0x38')]=qs[_0xd351('0x39')](_0x4da037['query']['sort']);_0x5ab6b1[_0xd351('0x3c')]=qs[_0xd351('0x48')](_['pick'](_0x4da037[_0xd351('0x31')],_0x2c0cb1[_0xd351('0x48')]));if(_0x4da037[_0xd351('0x31')]['filter']){_0x5ab6b1[_0xd351('0x3c')]=_[_0xd351('0x4a')](_0x5ab6b1[_0xd351('0x3c')],{'$or':_[_0xd351('0x3d')](_0x5ab6b1['attributes'],function(_0x508e5f){var _0x40c78b={};_0x40c78b[_0x508e5f]={'$like':'%'+_0x4da037[_0xd351('0x31')][_0xd351('0x3b')]+'%'};return _0x40c78b;})});}_0x5ab6b1=_[_0xd351('0x4a')]({},_0x5ab6b1,_0x4da037[_0xd351('0x4b')]);return _0x434465[_0xd351('0x4f')](_0x5ab6b1);}})[_0xd351('0x15')](function(_0x5e2e06){if(_0x5e2e06){_0x4d5a60=_0x5e2e06[_0xd351('0x49')];if(!_0x4da037['query']['hasOwnProperty'](_0xd351('0x36'))){_0x5ab6b1[_0xd351('0x23')]=qs['limit'](_0x4da037[_0xd351('0x31')]['limit']);_0x5ab6b1['offset']=qs['offset'](_0x4da037[_0xd351('0x31')][_0xd351('0x37')]);}return _0x434465[_0xd351('0x4f')](_0x5ab6b1);}})['then'](function(_0xadafc9){if(_0xadafc9){return _0xadafc9?{'count':_0x4d5a60,'rows':_0xadafc9}:null;}})[_0xd351('0x15')](respondWithResult(_0x169122,null))[_0xd351('0x4c')](handleError(_0x169122,null));};exports[_0xd351('0x52')]=function(_0x2375db,_0x475534,_0x15fcab){var _0x6bf19c={};var _0x130617={};var _0x22672;var _0x18c261;return db['Dynamics365Configuration'][_0xd351('0x50')]({'where':{'id':_0x2375db[_0xd351('0x47')]['id']}})[_0xd351('0x15')](handleEntityNotFound(_0x475534,null))[_0xd351('0x15')](function(_0xf24a29){if(_0xf24a29){_0x22672=_0xf24a29;_0x130617[_0xd351('0x2f')]=_['keys'](db[_0xd351('0x51')][_0xd351('0x2e')]);_0x130617['query']=_['keys'](_0x2375db[_0xd351('0x31')]);_0x130617[_0xd351('0x48')]=_[_0xd351('0x32')](_0x130617[_0xd351('0x2f')],_0x130617[_0xd351('0x31')]);_0x6bf19c[_0xd351('0x33')]=_[_0xd351('0x32')](_0x130617[_0xd351('0x2f')],qs[_0xd351('0x34')](_0x2375db['query'][_0xd351('0x34')]));_0x6bf19c[_0xd351('0x33')]=_0x6bf19c['attributes'][_0xd351('0x49')]?_0x6bf19c['attributes']:_0x130617[_0xd351('0x2f')];_0x6bf19c['order']=qs[_0xd351('0x39')](_0x2375db[_0xd351('0x31')][_0xd351('0x39')]);_0x6bf19c[_0xd351('0x3c')]=qs[_0xd351('0x48')](_[_0xd351('0x3a')](_0x2375db[_0xd351('0x31')],_0x130617['filters']));if(_0x2375db[_0xd351('0x31')][_0xd351('0x3b')]){_0x6bf19c[_0xd351('0x3c')]=_[_0xd351('0x4a')](_0x6bf19c[_0xd351('0x3c')],{'$or':_['map'](_0x6bf19c[_0xd351('0x33')],function(_0x155c2c){var _0x38f59a={};_0x38f59a[_0x155c2c]={'$like':'%'+_0x2375db['query'][_0xd351('0x3b')]+'%'};return _0x38f59a;})});}_0x6bf19c=_[_0xd351('0x4a')]({},_0x6bf19c,_0x2375db[_0xd351('0x4b')]);return _0x22672[_0xd351('0x52')](_0x6bf19c);}})[_0xd351('0x15')](function(_0x248503){if(_0x248503){_0x18c261=_0x248503[_0xd351('0x49')];if(!_0x2375db[_0xd351('0x31')][_0xd351('0x35')]('nolimit')){_0x6bf19c[_0xd351('0x23')]=qs[_0xd351('0x23')](_0x2375db['query'][_0xd351('0x23')]);_0x6bf19c['offset']=qs['offset'](_0x2375db['query'][_0xd351('0x37')]);}return _0x22672[_0xd351('0x52')](_0x6bf19c);}})[_0xd351('0x15')](function(_0x5b2bf9){if(_0x5b2bf9){return _0x5b2bf9?{'count':_0x18c261,'rows':_0x5b2bf9}:null;}})[_0xd351('0x15')](respondWithResult(_0x475534,null))['catch'](handleError(_0x475534,null));};exports[_0xd351('0x53')]=function(_0x5b7dda,_0x3a3139,_0x12db28){var _0x27aec9={};var _0x16dd16={};var _0x35b148;var _0x1bb955;return db[_0xd351('0x2d')][_0xd351('0x50')]({'where':{'id':_0x5b7dda[_0xd351('0x47')]['id']}})[_0xd351('0x15')](handleEntityNotFound(_0x3a3139,null))[_0xd351('0x15')](function(_0x25694a){if(_0x25694a){_0x35b148=_0x25694a;_0x16dd16['model']=_[_0xd351('0x30')](db[_0xd351('0x51')][_0xd351('0x2e')]);_0x16dd16[_0xd351('0x31')]=_[_0xd351('0x30')](_0x5b7dda['query']);_0x16dd16[_0xd351('0x48')]=_[_0xd351('0x32')](_0x16dd16[_0xd351('0x2f')],_0x16dd16[_0xd351('0x31')]);_0x27aec9['attributes']=_[_0xd351('0x32')](_0x16dd16[_0xd351('0x2f')],qs['fields'](_0x5b7dda[_0xd351('0x31')][_0xd351('0x34')]));_0x27aec9[_0xd351('0x33')]=_0x27aec9[_0xd351('0x33')]['length']?_0x27aec9['attributes']:_0x16dd16[_0xd351('0x2f')];_0x27aec9[_0xd351('0x38')]=qs[_0xd351('0x39')](_0x5b7dda[_0xd351('0x31')]['sort']);_0x27aec9[_0xd351('0x3c')]=qs[_0xd351('0x48')](_[_0xd351('0x3a')](_0x5b7dda[_0xd351('0x31')],_0x16dd16[_0xd351('0x48')]));if(_0x5b7dda['query'][_0xd351('0x3b')]){_0x27aec9[_0xd351('0x3c')]=_['merge'](_0x27aec9[_0xd351('0x3c')],{'$or':_[_0xd351('0x3d')](_0x27aec9['attributes'],function(_0x1e5bba){var _0x55b81e={};_0x55b81e[_0x1e5bba]={'$like':'%'+_0x5b7dda[_0xd351('0x31')]['filter']+'%'};return _0x55b81e;})});}_0x27aec9=_[_0xd351('0x4a')]({},_0x27aec9,_0x5b7dda[_0xd351('0x4b')]);return _0x35b148[_0xd351('0x53')](_0x27aec9);}})[_0xd351('0x15')](function(_0x34835d){if(_0x34835d){_0x1bb955=_0x34835d[_0xd351('0x49')];if(!_0x5b7dda[_0xd351('0x31')][_0xd351('0x35')](_0xd351('0x36'))){_0x27aec9['limit']=qs[_0xd351('0x23')](_0x5b7dda[_0xd351('0x31')][_0xd351('0x23')]);_0x27aec9[_0xd351('0x37')]=qs[_0xd351('0x37')](_0x5b7dda[_0xd351('0x31')][_0xd351('0x37')]);}return _0x35b148[_0xd351('0x53')](_0x27aec9);}})['then'](function(_0x3b8f86){if(_0x3b8f86){return _0x3b8f86?{'count':_0x1bb955,'rows':_0x3b8f86}:null;}})['then'](respondWithResult(_0x3a3139,null))[_0xd351('0x4c')](handleError(_0x3a3139,null));};
\ No newline at end of file
+var _0x5464=['path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','then','info','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dynamics365Configuration,\x20%s,\x20%s','result','catch','sendStatus','status','json','count','offset','limit','set','apply','save','destroy','end','stack','name','index','Dynamics365Configuration','rawAttributes','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','findAll','rows','show','params','length','include','find','create','body','update','getFields','hasOwnProperty','getSubjects','findOne','Dynamics365Field','getDescriptions','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util'];(function(_0x644ecd,_0x397f36){var _0x1c66ce=function(_0x4cf42b){while(--_0x4cf42b){_0x644ecd['push'](_0x644ecd['shift']());}};_0x1c66ce(++_0x397f36);}(_0x5464,0x15d));var _0x4546=function(_0x1d3733,_0x250a53){_0x1d3733=_0x1d3733-0x0;var _0x4c8432=_0x5464[_0x1d3733];return _0x4c8432;};'use strict';var pdf=require(_0x4546('0x0'));var emlformat=require(_0x4546('0x1'));var rimraf=require(_0x4546('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4546('0x3'));var rp=require('request-promise');var moment=require(_0x4546('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4546('0x5'));var util=require(_0x4546('0x6'));var path=require(_0x4546('0x7'));var sox=require(_0x4546('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x4546('0x9'));var crypto=require(_0x4546('0xa'));var jsforce=require(_0x4546('0xb'));var deskjs=require(_0x4546('0xc'));var toCsv=require(_0x4546('0xd'));var querystring=require(_0x4546('0xe'));var Papa=require(_0x4546('0xf'));var authService=require(_0x4546('0x10'));var hardwareService=require(_0x4546('0x11'));var Redis=require('ioredis');var qs=require(_0x4546('0x12'));var logger=require(_0x4546('0x13'))(_0x4546('0x14'));var utils=require('../../config/utils');var config=require(_0x4546('0x15'));var db=require(_0x4546('0x16'))['db'];var jayson=require(_0x4546('0x17'));var client=jayson[_0x4546('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f2641,_0x3e6622,_0x57cf5f,_0x59eb29){return new BPromise(function(_0x4bb236,_0x5b64b7){var _0x598516=_0x59eb29||client;return _0x598516['request'](_0x4f2641,_0x57cf5f)[_0x4546('0x19')](function(_0x51e279){logger[_0x4546('0x1a')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3e6622,_0x4546('0x1b'));logger['debug'](_0x4546('0x1c'),_0x3e6622,_0x4546('0x1b'),JSON[_0x4546('0x1d')](_0x51e279));if(_0x51e279[_0x4546('0x1e')]){if(_0x51e279[_0x4546('0x1e')][_0x4546('0x1f')]===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x3e6622,_0x51e279['error'][_0x4546('0x20')]);return _0x5b64b7(_0x51e279[_0x4546('0x1e')][_0x4546('0x20')]);}logger[_0x4546('0x1e')](_0x4546('0x21'),_0x3e6622,_0x51e279[_0x4546('0x1e')][_0x4546('0x20')]);return _0x4bb236(_0x51e279[_0x4546('0x1e')][_0x4546('0x20')]);}else{logger[_0x4546('0x1a')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3e6622,_0x4546('0x1b'));_0x4bb236(_0x51e279[_0x4546('0x22')]['message']);}})[_0x4546('0x23')](function(_0x437f55){logger[_0x4546('0x1e')](_0x4546('0x21'),_0x3e6622,_0x437f55);_0x5b64b7(_0x437f55);});});}function respondWithStatusCode(_0xc2997d,_0x15b013){_0x15b013=_0x15b013||0xcc;return function(_0x53e402){if(_0x53e402){return _0xc2997d[_0x4546('0x24')](_0x15b013);}return _0xc2997d[_0x4546('0x25')](_0x15b013)['end']();};}function respondWithResult(_0x824698,_0x4618a6){_0x4618a6=_0x4618a6||0xc8;return function(_0x202a6c){if(_0x202a6c){return _0x824698[_0x4546('0x25')](_0x4618a6)[_0x4546('0x26')](_0x202a6c);}};}function respondWithFilteredResult(_0x53ae5e,_0x49dc98){return function(_0x3796fe){if(_0x3796fe){var _0x831fa5=_0x3796fe[_0x4546('0x27')],_0x48fc36=_0x49dc98[_0x4546('0x28')],_0x4c1dad=_0x49dc98[_0x4546('0x28')]+_0x49dc98[_0x4546('0x29')],_0x43740e;if(_0x4c1dad>=_0x831fa5){_0x4c1dad=_0x831fa5;_0x43740e=0xc8;}else{_0x43740e=0xce;}_0x53ae5e[_0x4546('0x25')](_0x43740e);return _0x53ae5e[_0x4546('0x2a')]('Content-Range',_0x48fc36+'-'+_0x4c1dad+'/'+_0x831fa5)[_0x4546('0x26')](_0x3796fe);}return null;};}function patchUpdates(_0x52c546){return function(_0x3a2d12){try{jsonpatch[_0x4546('0x2b')](_0x3a2d12,_0x52c546,!![]);}catch(_0x5396c5){return BPromise['reject'](_0x5396c5);}return _0x3a2d12[_0x4546('0x2c')]();};}function saveUpdates(_0x5af997,_0x3c7c7d){return function(_0x58b69){if(_0x58b69){return _0x58b69['update'](_0x5af997)['then'](function(_0x1d20fc){return _0x1d20fc;});}return null;};}function removeEntity(_0x3b673f,_0x258d26){return function(_0x5716dc){if(_0x5716dc){return _0x5716dc[_0x4546('0x2d')]()[_0x4546('0x19')](function(){_0x3b673f['status'](0xcc)[_0x4546('0x2e')]();});}};}function handleEntityNotFound(_0x4f5f36,_0x2a3541){return function(_0x44f604){if(!_0x44f604){_0x4f5f36[_0x4546('0x24')](0x194);}return _0x44f604;};}function handleError(_0x2ce37f,_0x507ccb){_0x507ccb=_0x507ccb||0x1f4;return function(_0x12e38c){logger[_0x4546('0x1e')](_0x12e38c[_0x4546('0x2f')]);if(_0x12e38c[_0x4546('0x30')]){delete _0x12e38c[_0x4546('0x30')];}_0x2ce37f[_0x4546('0x25')](_0x507ccb)['send'](_0x12e38c);};}exports[_0x4546('0x31')]=function(_0x1ff54c,_0x549f48){var _0x5749b0={},_0x3eb8e8={},_0x26fb3d={'count':0x0,'rows':[]};var _0x56049d=db[_0x4546('0x32')][_0x4546('0x33')];_0x3eb8e8['model']=_['keys'](_0x56049d);_0x3eb8e8[_0x4546('0x34')]=_[_0x4546('0x35')](_0x1ff54c[_0x4546('0x34')]);_0x3eb8e8[_0x4546('0x36')]=_[_0x4546('0x37')](_0x3eb8e8[_0x4546('0x38')],_0x3eb8e8['query']);_0x5749b0[_0x4546('0x39')]=_[_0x4546('0x37')](_0x3eb8e8['model'],qs[_0x4546('0x3a')](_0x1ff54c['query'][_0x4546('0x3a')]));_0x5749b0[_0x4546('0x39')]=_0x5749b0['attributes']['length']?_0x5749b0[_0x4546('0x39')]:_0x3eb8e8[_0x4546('0x38')];if(!_0x1ff54c[_0x4546('0x34')]['hasOwnProperty'](_0x4546('0x3b'))){_0x5749b0[_0x4546('0x29')]=qs[_0x4546('0x29')](_0x1ff54c[_0x4546('0x34')][_0x4546('0x29')]);_0x5749b0[_0x4546('0x28')]=qs[_0x4546('0x28')](_0x1ff54c[_0x4546('0x34')]['offset']);}_0x5749b0[_0x4546('0x3c')]=qs[_0x4546('0x3d')](_0x1ff54c['query']['sort']);_0x5749b0[_0x4546('0x3e')]=qs[_0x4546('0x36')](_[_0x4546('0x3f')](_0x1ff54c[_0x4546('0x34')],_0x3eb8e8[_0x4546('0x36')]));if(_0x1ff54c['query'][_0x4546('0x40')]){_0x5749b0[_0x4546('0x3e')]=_[_0x4546('0x41')](_0x5749b0[_0x4546('0x3e')],{'$or':_[_0x4546('0x42')](_0x56049d,function(_0x3fabf0){if(_0x3fabf0[_0x4546('0x43')][_0x4546('0x44')]!==_0x4546('0x45')){var _0x531602={};_0x531602[_0x3fabf0[_0x4546('0x46')]]={'$like':'%'+_0x1ff54c[_0x4546('0x34')][_0x4546('0x40')]+'%'};return _0x531602;}})});}_0x5749b0=_[_0x4546('0x41')]({},_0x5749b0,_0x1ff54c[_0x4546('0x47')]);var _0x1f65a8={'where':_0x5749b0[_0x4546('0x3e')]};return db[_0x4546('0x32')][_0x4546('0x27')](_0x1f65a8)[_0x4546('0x19')](function(_0x19cdad){_0x26fb3d['count']=_0x19cdad;if(_0x1ff54c[_0x4546('0x34')][_0x4546('0x48')]){_0x5749b0['include']=[{'all':!![]}];}return db[_0x4546('0x32')][_0x4546('0x49')](_0x5749b0);})[_0x4546('0x19')](function(_0x5c3c12){_0x26fb3d[_0x4546('0x4a')]=_0x5c3c12;return _0x26fb3d;})[_0x4546('0x19')](respondWithFilteredResult(_0x549f48,_0x5749b0))[_0x4546('0x23')](handleError(_0x549f48,null));};exports[_0x4546('0x4b')]=function(_0x3b6497,_0x15816c){var _0x3e8ebd={'raw':![],'where':{'id':_0x3b6497[_0x4546('0x4c')]['id']}},_0x3343c0={};_0x3343c0[_0x4546('0x38')]=_['keys'](db[_0x4546('0x32')][_0x4546('0x33')]);_0x3343c0['query']=_[_0x4546('0x35')](_0x3b6497[_0x4546('0x34')]);_0x3343c0[_0x4546('0x36')]=_[_0x4546('0x37')](_0x3343c0['model'],_0x3343c0[_0x4546('0x34')]);_0x3e8ebd['attributes']=_[_0x4546('0x37')](_0x3343c0[_0x4546('0x38')],qs[_0x4546('0x3a')](_0x3b6497['query'][_0x4546('0x3a')]));_0x3e8ebd[_0x4546('0x39')]=_0x3e8ebd[_0x4546('0x39')][_0x4546('0x4d')]?_0x3e8ebd[_0x4546('0x39')]:_0x3343c0[_0x4546('0x38')];if(_0x3b6497[_0x4546('0x34')][_0x4546('0x48')]){_0x3e8ebd[_0x4546('0x4e')]=[{'all':!![]}];}_0x3e8ebd=_[_0x4546('0x41')]({},_0x3e8ebd,_0x3b6497[_0x4546('0x47')]);return db['Dynamics365Configuration'][_0x4546('0x4f')](_0x3e8ebd)[_0x4546('0x19')](handleEntityNotFound(_0x15816c,null))['then'](respondWithResult(_0x15816c,null))[_0x4546('0x23')](handleError(_0x15816c,null));};exports[_0x4546('0x50')]=function(_0xca0f44,_0x4ca3a6){return db[_0x4546('0x32')][_0x4546('0x50')](_0xca0f44[_0x4546('0x51')],{})[_0x4546('0x19')](respondWithResult(_0x4ca3a6,0xc9))[_0x4546('0x23')](handleError(_0x4ca3a6,null));};exports[_0x4546('0x52')]=function(_0x2ca7d8,_0x3c36b2){if(_0x2ca7d8[_0x4546('0x51')]['id']){delete _0x2ca7d8[_0x4546('0x51')]['id'];}return db[_0x4546('0x32')][_0x4546('0x4f')]({'where':{'id':_0x2ca7d8[_0x4546('0x4c')]['id']}})[_0x4546('0x19')](handleEntityNotFound(_0x3c36b2,null))[_0x4546('0x19')](saveUpdates(_0x2ca7d8[_0x4546('0x51')],null))['then'](respondWithResult(_0x3c36b2,null))[_0x4546('0x23')](handleError(_0x3c36b2,null));};exports[_0x4546('0x2d')]=function(_0x5e04c3,_0x203275){return db[_0x4546('0x32')][_0x4546('0x4f')]({'where':{'id':_0x5e04c3[_0x4546('0x4c')]['id']}})['then'](handleEntityNotFound(_0x203275,null))[_0x4546('0x19')](removeEntity(_0x203275,null))[_0x4546('0x23')](handleError(_0x203275,null));};exports[_0x4546('0x53')]=function(_0x1b9d3b,_0x49a106,_0x420954){var _0x411e55={};var _0x1765e0={};var _0x3406e9;var _0xcf682c;return db[_0x4546('0x32')]['findOne']({'where':{'id':_0x1b9d3b[_0x4546('0x4c')]['id']}})[_0x4546('0x19')](handleEntityNotFound(_0x49a106,null))[_0x4546('0x19')](function(_0x1bb2ff){if(_0x1bb2ff){_0x3406e9=_0x1bb2ff;_0x1765e0['model']=_[_0x4546('0x35')](db['Dynamics365Field'][_0x4546('0x33')]);_0x1765e0[_0x4546('0x34')]=_[_0x4546('0x35')](_0x1b9d3b[_0x4546('0x34')]);_0x1765e0[_0x4546('0x36')]=_['intersection'](_0x1765e0[_0x4546('0x38')],_0x1765e0['query']);_0x411e55[_0x4546('0x39')]=_['intersection'](_0x1765e0['model'],qs['fields'](_0x1b9d3b[_0x4546('0x34')]['fields']));_0x411e55[_0x4546('0x39')]=_0x411e55[_0x4546('0x39')][_0x4546('0x4d')]?_0x411e55[_0x4546('0x39')]:_0x1765e0['model'];_0x411e55[_0x4546('0x3c')]=qs[_0x4546('0x3d')](_0x1b9d3b[_0x4546('0x34')][_0x4546('0x3d')]);_0x411e55[_0x4546('0x3e')]=qs['filters'](_[_0x4546('0x3f')](_0x1b9d3b[_0x4546('0x34')],_0x1765e0[_0x4546('0x36')]));if(_0x1b9d3b['query'][_0x4546('0x40')]){_0x411e55[_0x4546('0x3e')]=_[_0x4546('0x41')](_0x411e55['where'],{'$or':_[_0x4546('0x42')](_0x411e55[_0x4546('0x39')],function(_0x17b211){var _0x220259={};_0x220259[_0x17b211]={'$like':'%'+_0x1b9d3b[_0x4546('0x34')][_0x4546('0x40')]+'%'};return _0x220259;})});}_0x411e55=_[_0x4546('0x41')]({},_0x411e55,_0x1b9d3b[_0x4546('0x47')]);return _0x3406e9['getFields'](_0x411e55);}})[_0x4546('0x19')](function(_0x2c0ee3){if(_0x2c0ee3){_0xcf682c=_0x2c0ee3[_0x4546('0x4d')];if(!_0x1b9d3b[_0x4546('0x34')][_0x4546('0x54')](_0x4546('0x3b'))){_0x411e55[_0x4546('0x29')]=qs[_0x4546('0x29')](_0x1b9d3b[_0x4546('0x34')][_0x4546('0x29')]);_0x411e55[_0x4546('0x28')]=qs[_0x4546('0x28')](_0x1b9d3b[_0x4546('0x34')][_0x4546('0x28')]);}return _0x3406e9[_0x4546('0x53')](_0x411e55);}})['then'](function(_0x21ff57){if(_0x21ff57){return _0x21ff57?{'count':_0xcf682c,'rows':_0x21ff57}:null;}})['then'](respondWithResult(_0x49a106,null))[_0x4546('0x23')](handleError(_0x49a106,null));};exports[_0x4546('0x55')]=function(_0x4a5bd4,_0x314afc,_0x335881){var _0x27680b={};var _0x180b24={};var _0x3c3f29;var _0x2960a0;return db[_0x4546('0x32')][_0x4546('0x56')]({'where':{'id':_0x4a5bd4[_0x4546('0x4c')]['id']}})[_0x4546('0x19')](handleEntityNotFound(_0x314afc,null))[_0x4546('0x19')](function(_0x194667){if(_0x194667){_0x3c3f29=_0x194667;_0x180b24[_0x4546('0x38')]=_['keys'](db[_0x4546('0x57')][_0x4546('0x33')]);_0x180b24[_0x4546('0x34')]=_['keys'](_0x4a5bd4[_0x4546('0x34')]);_0x180b24[_0x4546('0x36')]=_[_0x4546('0x37')](_0x180b24[_0x4546('0x38')],_0x180b24[_0x4546('0x34')]);_0x27680b[_0x4546('0x39')]=_[_0x4546('0x37')](_0x180b24['model'],qs[_0x4546('0x3a')](_0x4a5bd4[_0x4546('0x34')][_0x4546('0x3a')]));_0x27680b['attributes']=_0x27680b['attributes'][_0x4546('0x4d')]?_0x27680b[_0x4546('0x39')]:_0x180b24['model'];_0x27680b[_0x4546('0x3c')]=qs[_0x4546('0x3d')](_0x4a5bd4[_0x4546('0x34')][_0x4546('0x3d')]);_0x27680b['where']=qs[_0x4546('0x36')](_[_0x4546('0x3f')](_0x4a5bd4[_0x4546('0x34')],_0x180b24[_0x4546('0x36')]));if(_0x4a5bd4[_0x4546('0x34')][_0x4546('0x40')]){_0x27680b[_0x4546('0x3e')]=_[_0x4546('0x41')](_0x27680b['where'],{'$or':_[_0x4546('0x42')](_0x27680b[_0x4546('0x39')],function(_0x57c6ee){var _0x2b03eb={};_0x2b03eb[_0x57c6ee]={'$like':'%'+_0x4a5bd4[_0x4546('0x34')]['filter']+'%'};return _0x2b03eb;})});}_0x27680b=_[_0x4546('0x41')]({},_0x27680b,_0x4a5bd4[_0x4546('0x47')]);return _0x3c3f29[_0x4546('0x55')](_0x27680b);}})['then'](function(_0x129506){if(_0x129506){_0x2960a0=_0x129506[_0x4546('0x4d')];if(!_0x4a5bd4[_0x4546('0x34')][_0x4546('0x54')](_0x4546('0x3b'))){_0x27680b[_0x4546('0x29')]=qs[_0x4546('0x29')](_0x4a5bd4['query']['limit']);_0x27680b[_0x4546('0x28')]=qs[_0x4546('0x28')](_0x4a5bd4[_0x4546('0x34')][_0x4546('0x28')]);}return _0x3c3f29[_0x4546('0x55')](_0x27680b);}})[_0x4546('0x19')](function(_0x4c1a64){if(_0x4c1a64){return _0x4c1a64?{'count':_0x2960a0,'rows':_0x4c1a64}:null;}})['then'](respondWithResult(_0x314afc,null))[_0x4546('0x23')](handleError(_0x314afc,null));};exports[_0x4546('0x58')]=function(_0x39d86a,_0x16c904,_0x26d065){var _0x1b174f={};var _0x3e38bd={};var _0x24d214;var _0x56142c;return db[_0x4546('0x32')]['findOne']({'where':{'id':_0x39d86a[_0x4546('0x4c')]['id']}})[_0x4546('0x19')](handleEntityNotFound(_0x16c904,null))[_0x4546('0x19')](function(_0x5e35a3){if(_0x5e35a3){_0x24d214=_0x5e35a3;_0x3e38bd[_0x4546('0x38')]=_[_0x4546('0x35')](db[_0x4546('0x57')][_0x4546('0x33')]);_0x3e38bd[_0x4546('0x34')]=_[_0x4546('0x35')](_0x39d86a[_0x4546('0x34')]);_0x3e38bd[_0x4546('0x36')]=_[_0x4546('0x37')](_0x3e38bd[_0x4546('0x38')],_0x3e38bd['query']);_0x1b174f[_0x4546('0x39')]=_[_0x4546('0x37')](_0x3e38bd['model'],qs[_0x4546('0x3a')](_0x39d86a[_0x4546('0x34')][_0x4546('0x3a')]));_0x1b174f[_0x4546('0x39')]=_0x1b174f['attributes']['length']?_0x1b174f[_0x4546('0x39')]:_0x3e38bd[_0x4546('0x38')];_0x1b174f[_0x4546('0x3c')]=qs[_0x4546('0x3d')](_0x39d86a[_0x4546('0x34')]['sort']);_0x1b174f[_0x4546('0x3e')]=qs[_0x4546('0x36')](_[_0x4546('0x3f')](_0x39d86a[_0x4546('0x34')],_0x3e38bd[_0x4546('0x36')]));if(_0x39d86a['query'][_0x4546('0x40')]){_0x1b174f['where']=_[_0x4546('0x41')](_0x1b174f[_0x4546('0x3e')],{'$or':_[_0x4546('0x42')](_0x1b174f[_0x4546('0x39')],function(_0x29e6e3){var _0x19ff9b={};_0x19ff9b[_0x29e6e3]={'$like':'%'+_0x39d86a[_0x4546('0x34')][_0x4546('0x40')]+'%'};return _0x19ff9b;})});}_0x1b174f=_['merge']({},_0x1b174f,_0x39d86a[_0x4546('0x47')]);return _0x24d214[_0x4546('0x58')](_0x1b174f);}})[_0x4546('0x19')](function(_0x44bb63){if(_0x44bb63){_0x56142c=_0x44bb63[_0x4546('0x4d')];if(!_0x39d86a['query'][_0x4546('0x54')]('nolimit')){_0x1b174f['limit']=qs['limit'](_0x39d86a[_0x4546('0x34')][_0x4546('0x29')]);_0x1b174f[_0x4546('0x28')]=qs[_0x4546('0x28')](_0x39d86a[_0x4546('0x34')][_0x4546('0x28')]);}return _0x24d214[_0x4546('0x58')](_0x1b174f);}})[_0x4546('0x19')](function(_0x3d583e){if(_0x3d583e){return _0x3d583e?{'count':_0x56142c,'rows':_0x3d583e}:null;}})[_0x4546('0x19')](respondWithResult(_0x16c904,null))['catch'](handleError(_0x16c904,null));};
\ No newline at end of file
index bdf124a..ffdddde 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x469e=['../../config/logger','moment','bluebird','request-promise','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util'];(function(_0x1cf7e8,_0x3cea71){var _0x3a9a74=function(_0x4b05ff){while(--_0x4b05ff){_0x1cf7e8['push'](_0x1cf7e8['shift']());}};_0x3a9a74(++_0x3cea71);}(_0x469e,0x17b));var _0xe469=function(_0x539533,_0x59b89b){_0x539533=_0x539533-0x0;var _0x3942f3=_0x469e[_0x539533];return _0x3942f3;};'use strict';var _=require('lodash');var util=require(_0xe469('0x0'));var logger=require(_0xe469('0x1'))('api');var moment=require(_0xe469('0x2'));var BPromise=require(_0xe469('0x3'));var rp=require(_0xe469('0x4'));var attributes=require(_0xe469('0x5'));module[_0xe469('0x6')]=function(_0x36981f,_0x3bea1e){return _0x36981f[_0xe469('0x7')](_0xe469('0x8'),attributes,{'tableName':_0xe469('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x0351=['util','api','bluebird','request-promise','./intDynamics365Configuration.attributes','define'];(function(_0x2b74e9,_0x2152a2){var _0xc936e8=function(_0x588263){while(--_0x588263){_0x2b74e9['push'](_0x2b74e9['shift']());}};_0xc936e8(++_0x2152a2);}(_0x0351,0x198));var _0x1035=function(_0x29c2cf,_0x35b8c2){_0x29c2cf=_0x29c2cf-0x0;var _0x5a2465=_0x0351[_0x29c2cf];return _0x5a2465;};'use strict';var _=require('lodash');var util=require(_0x1035('0x0'));var logger=require('../../config/logger')(_0x1035('0x1'));var moment=require('moment');var BPromise=require(_0x1035('0x2'));var rp=require(_0x1035('0x3'));var attributes=require(_0x1035('0x4'));module['exports']=function(_0x5b3b38,_0x2ae677){return _0x5b3b38[_0x1035('0x5')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 38acdf1..363061d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc24c=['../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2e1a90,_0x40d0ad){var _0x403ee9=function(_0x1a6ff9){while(--_0x1a6ff9){_0x2e1a90['push'](_0x2e1a90['shift']());}};_0x403ee9(++_0x40d0ad);}(_0xc24c,0x7d));var _0xcc24=function(_0xcb0437,_0x377453){_0xcb0437=_0xcb0437-0x0;var _0x495ace=_0xc24c[_0xcb0437];return _0x495ace;};'use strict';var _=require(_0xcc24('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcc24('0x1'));var rs=require(_0xcc24('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc24('0x3'))['db'];var utils=require(_0xcc24('0x4'));var logger=require(_0xcc24('0x5'))(_0xcc24('0x6'));var config=require(_0xcc24('0x7'));var jayson=require(_0xcc24('0x8'));var client=jayson[_0xcc24('0x9')][_0xcc24('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x230d94,_0xe4575d,_0x5e627c){return new BPromise(function(_0x66d26b,_0x32966e){return client[_0xcc24('0xb')](_0x230d94,_0x5e627c)[_0xcc24('0xc')](function(_0x3c4967){logger[_0xcc24('0xd')](_0xcc24('0xe'),_0xe4575d,_0xcc24('0xf'));logger[_0xcc24('0x10')](_0xcc24('0x11'),_0xe4575d,_0xcc24('0xf'),JSON['stringify'](_0x3c4967));if(_0x3c4967[_0xcc24('0x12')]){if(_0x3c4967['error'][_0xcc24('0x13')]===0x1f4){logger[_0xcc24('0x12')](_0xcc24('0xe'),_0xe4575d,_0x3c4967[_0xcc24('0x12')]['message']);return _0x32966e(_0x3c4967['error'][_0xcc24('0x14')]);}logger['error'](_0xcc24('0xe'),_0xe4575d,_0x3c4967[_0xcc24('0x12')][_0xcc24('0x14')]);return _0x66d26b(_0x3c4967[_0xcc24('0x12')][_0xcc24('0x14')]);}else{logger[_0xcc24('0xd')](_0xcc24('0xe'),_0xe4575d,'request\x20sent');_0x66d26b(_0x3c4967['result'][_0xcc24('0x14')]);}})[_0xcc24('0x15')](function(_0xe14dd4){logger[_0xcc24('0x12')](_0xcc24('0xe'),_0xe4575d,_0xe14dd4);_0x32966e(_0xe14dd4);});});}
\ No newline at end of file
+var _0x60fc=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x3cb833,_0x48c036){var _0x58a52f=function(_0x3de48e){while(--_0x3de48e){_0x3cb833['push'](_0x3cb833['shift']());}};_0x58a52f(++_0x48c036);}(_0x60fc,0xc2));var _0xc60f=function(_0x28d7b0,_0xf86fbf){_0x28d7b0=_0x28d7b0-0x0;var _0x5ec59b=_0x60fc[_0x28d7b0];return _0x5ec59b;};'use strict';var _=require('lodash');var util=require(_0xc60f('0x0'));var moment=require(_0xc60f('0x1'));var BPromise=require(_0xc60f('0x2'));var rs=require(_0xc60f('0x3'));var fs=require('fs');var Redis=require(_0xc60f('0x4'));var db=require(_0xc60f('0x5'))['db'];var utils=require(_0xc60f('0x6'));var logger=require('../../config/logger')(_0xc60f('0x7'));var config=require(_0xc60f('0x8'));var jayson=require(_0xc60f('0x9'));var client=jayson['client'][_0xc60f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b0302,_0x1bc7bf,_0xb6826c){return new BPromise(function(_0x29369b,_0xc6e13){return client[_0xc60f('0xb')](_0x3b0302,_0xb6826c)[_0xc60f('0xc')](function(_0x5e40f9){logger[_0xc60f('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1bc7bf,_0xc60f('0xe'));logger[_0xc60f('0xf')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x1bc7bf,'request\x20sent',JSON[_0xc60f('0x10')](_0x5e40f9));if(_0x5e40f9[_0xc60f('0x11')]){if(_0x5e40f9[_0xc60f('0x11')]['code']===0x1f4){logger[_0xc60f('0x11')](_0xc60f('0x12'),_0x1bc7bf,_0x5e40f9[_0xc60f('0x11')]['message']);return _0xc6e13(_0x5e40f9[_0xc60f('0x11')][_0xc60f('0x13')]);}logger[_0xc60f('0x11')](_0xc60f('0x12'),_0x1bc7bf,_0x5e40f9['error'][_0xc60f('0x13')]);return _0x29369b(_0x5e40f9['error'][_0xc60f('0x13')]);}else{logger[_0xc60f('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1bc7bf,_0xc60f('0xe'));_0x29369b(_0x5e40f9[_0xc60f('0x14')][_0xc60f('0x13')]);}})[_0xc60f('0x15')](function(_0x49337a){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x1bc7bf,_0x49337a);_0xc6e13(_0x49337a);});});}
\ No newline at end of file
index c4cc457..755be7e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x67a5=['util','path','connect-timeout','express','Router','../../components/auth/service','./intDynamics365Field.controller','get','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports'];(function(_0x4e0f57,_0x4286f0){var _0x3d3f87=function(_0x529753){while(--_0x529753){_0x4e0f57['push'](_0x4e0f57['shift']());}};_0x3d3f87(++_0x4286f0);}(_0x67a5,0xee));var _0x567a=function(_0x4da573,_0x31b058){_0x4da573=_0x4da573-0x0;var _0x41d1b3=_0x67a5[_0x4da573];return _0x41d1b3;};'use strict';var multer=require('multer');var util=require(_0x567a('0x0'));var path=require(_0x567a('0x1'));var timeout=require(_0x567a('0x2'));var express=require(_0x567a('0x3'));var router=express[_0x567a('0x4')]();var auth=require(_0x567a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x567a('0x6'));router[_0x567a('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x567a('0x8'),auth[_0x567a('0x9')](),controller[_0x567a('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x567a('0xb')]);router[_0x567a('0xc')](_0x567a('0x8'),auth[_0x567a('0x9')](),controller[_0x567a('0xd')]);router[_0x567a('0xe')](_0x567a('0x8'),auth['isAuthenticated'](),controller[_0x567a('0xf')]);module[_0x567a('0x10')]=router;
\ No newline at end of file
+var _0x2f5a=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','/:id','update','delete','destroy','multer'];(function(_0x17e99d,_0x2c211a){var _0x41743d=function(_0xa44fcb){while(--_0xa44fcb){_0x17e99d['push'](_0x17e99d['shift']());}};_0x41743d(++_0x2c211a);}(_0x2f5a,0xb3));var _0xa2f5=function(_0x386cef,_0x112e10){_0x386cef=_0x386cef-0x0;var _0x2f866f=_0x2f5a[_0x386cef];return _0x2f866f;};'use strict';var multer=require(_0xa2f5('0x0'));var util=require(_0xa2f5('0x1'));var path=require(_0xa2f5('0x2'));var timeout=require(_0xa2f5('0x3'));var express=require(_0xa2f5('0x4'));var router=express[_0xa2f5('0x5')]();var auth=require(_0xa2f5('0x6'));var interaction=require(_0xa2f5('0x7'));var config=require(_0xa2f5('0x8'));var controller=require('./intDynamics365Field.controller');router[_0xa2f5('0x9')]('/',auth[_0xa2f5('0xa')](),controller['index']);router[_0xa2f5('0x9')]('/:id',auth[_0xa2f5('0xa')](),controller[_0xa2f5('0xb')]);router[_0xa2f5('0xc')]('/',auth['isAuthenticated'](),controller[_0xa2f5('0xd')]);router['put'](_0xa2f5('0xe'),auth[_0xa2f5('0xa')](),controller[_0xa2f5('0xf')]);router[_0xa2f5('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xa2f5('0x11')]);module['exports']=router;
\ No newline at end of file
index 9d5fc27..65174dc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4522=['STRING','customVariable','BOOLEAN','ENUM','string','variable','keyValue'];(function(_0x40d548,_0x233d52){var _0x1791f8=function(_0x526c95){while(--_0x526c95){_0x40d548['push'](_0x40d548['shift']());}};_0x1791f8(++_0x233d52);}(_0x4522,0x1a0));var _0x2452=function(_0xeebcf3,_0x119794){_0xeebcf3=_0xeebcf3-0x0;var _0x2dda52=_0x4522[_0xeebcf3];return _0x2dda52;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x2452('0x0')](_0x2452('0x1'),_0x2452('0x2'),'customVariable',_0x2452('0x3')),'defaultValue':_0x2452('0x1')},'content':{'type':Sequelize[_0x2452('0x4')]},'key':{'type':Sequelize[_0x2452('0x4')]},'keyType':{'type':Sequelize[_0x2452('0x0')](_0x2452('0x1'),_0x2452('0x2'),_0x2452('0x5'))},'keyContent':{'type':Sequelize[_0x2452('0x4')]},'idField':{'type':Sequelize[_0x2452('0x4')]},'nameField':{'type':Sequelize[_0x2452('0x4')]},'customField':{'type':Sequelize[_0x2452('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2452('0x4')]}};
\ No newline at end of file
+var _0x0bb5=['string','STRING','ENUM','BOOLEAN','sequelize','exports','variable','customVariable','keyValue'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0x0bb5,0x148));var _0x50bb=function(_0x46dd0a,_0x2b6594){_0x46dd0a=_0x46dd0a-0x0;var _0x4a4bb6=_0x0bb5[_0x46dd0a];return _0x4a4bb6;};'use strict';var Sequelize=require(_0x50bb('0x0'));module[_0x50bb('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x50bb('0x2'),_0x50bb('0x3'),_0x50bb('0x4')),'defaultValue':_0x50bb('0x5')},'content':{'type':Sequelize[_0x50bb('0x6')]},'key':{'type':Sequelize[_0x50bb('0x6')]},'keyType':{'type':Sequelize[_0x50bb('0x7')](_0x50bb('0x5'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x50bb('0x6')]},'idField':{'type':Sequelize[_0x50bb('0x6')]},'nameField':{'type':Sequelize[_0x50bb('0x6')]},'customField':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}};
\ No newline at end of file
index a60b47d..51639d9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3de0=['jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','destroy','then','error','name','send','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','key','VIRTUAL','options','Dynamics365Field','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','crypto'];(function(_0x123516,_0x517a0e){var _0x30faee=function(_0x71a5ed){while(--_0x71a5ed){_0x123516['push'](_0x123516['shift']());}};_0x30faee(++_0x517a0e);}(_0x3de0,0x143));var _0x03de=function(_0x3e8402,_0x49353d){_0x3e8402=_0x3e8402-0x0;var _0x545e08=_0x3de0[_0x3e8402];return _0x545e08;};'use strict';var pdf=require(_0x03de('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x03de('0x1'));var zipdir=require(_0x03de('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x03de('0x3'));var moment=require(_0x03de('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x03de('0x5'));var util=require(_0x03de('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x03de('0x7'));var ejs=require(_0x03de('0x8'));var fs=require('fs');var _=require(_0x03de('0x9'));var squel=require(_0x03de('0xa'));var crypto=require(_0x03de('0xb'));var jsforce=require(_0x03de('0xc'));var deskjs=require(_0x03de('0xd'));var toCsv=require(_0x03de('0x7'));var querystring=require('querystring');var Papa=require(_0x03de('0xe'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x03de('0xf'));var qs=require(_0x03de('0x10'));var logger=require('../../config/logger')(_0x03de('0x11'));var utils=require(_0x03de('0x12'));var config=require('../../config/environment');var db=require(_0x03de('0x13'))['db'];function respondWithStatusCode(_0x556d3a,_0x48acfa){_0x48acfa=_0x48acfa||0xcc;return function(_0x3d6629){if(_0x3d6629){return _0x556d3a[_0x03de('0x14')](_0x48acfa);}return _0x556d3a[_0x03de('0x15')](_0x48acfa)[_0x03de('0x16')]();};}function respondWithResult(_0x1570c3,_0x5d37da){_0x5d37da=_0x5d37da||0xc8;return function(_0xf9553d){if(_0xf9553d){return _0x1570c3[_0x03de('0x15')](_0x5d37da)[_0x03de('0x17')](_0xf9553d);}};}function respondWithFilteredResult(_0x4064a8,_0x5dcade){return function(_0x453564){if(_0x453564){var _0xedbc6b=_0x453564[_0x03de('0x18')],_0x1aa88d=_0x5dcade[_0x03de('0x19')],_0x45881e=_0x5dcade[_0x03de('0x19')]+_0x5dcade[_0x03de('0x1a')],_0x45fe9e;if(_0x45881e>=_0xedbc6b){_0x45881e=_0xedbc6b;_0x45fe9e=0xc8;}else{_0x45fe9e=0xce;}_0x4064a8['status'](_0x45fe9e);return _0x4064a8['set'](_0x03de('0x1b'),_0x1aa88d+'-'+_0x45881e+'/'+_0xedbc6b)[_0x03de('0x17')](_0x453564);}return null;};}function patchUpdates(_0x9b0ede){return function(_0x55ad7e){try{jsonpatch[_0x03de('0x1c')](_0x55ad7e,_0x9b0ede,!![]);}catch(_0x5f6058){return BPromise[_0x03de('0x1d')](_0x5f6058);}return _0x55ad7e[_0x03de('0x1e')]();};}function saveUpdates(_0x148725,_0x27f814){return function(_0x3cb6ff){if(_0x3cb6ff){return _0x3cb6ff['update'](_0x148725)['then'](function(_0x528862){return _0x528862;});}return null;};}function removeEntity(_0x29686b,_0x2884d7){return function(_0x512d82){if(_0x512d82){return _0x512d82[_0x03de('0x1f')]()[_0x03de('0x20')](function(){_0x29686b[_0x03de('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23e463,_0x396a57){return function(_0x5f2317){if(!_0x5f2317){_0x23e463[_0x03de('0x14')](0x194);}return _0x5f2317;};}function handleError(_0x37b44f,_0x8c74aa){_0x8c74aa=_0x8c74aa||0x1f4;return function(_0xf03160){logger[_0x03de('0x21')](_0xf03160['stack']);if(_0xf03160[_0x03de('0x22')]){delete _0xf03160[_0x03de('0x22')];}_0x37b44f[_0x03de('0x15')](_0x8c74aa)[_0x03de('0x23')](_0xf03160);};}exports['index']=function(_0x14e785,_0x28416a){var _0x5ce3c2={},_0x5c371f={},_0xb3fed8={'count':0x0,'rows':[]};var _0x2147b3=db['Dynamics365Field']['rawAttributes'];_0x5c371f[_0x03de('0x24')]=_[_0x03de('0x25')](_0x2147b3);_0x5c371f['query']=_[_0x03de('0x25')](_0x14e785[_0x03de('0x26')]);_0x5c371f[_0x03de('0x27')]=_[_0x03de('0x28')](_0x5c371f['model'],_0x5c371f['query']);_0x5ce3c2[_0x03de('0x29')]=_[_0x03de('0x28')](_0x5c371f[_0x03de('0x24')],qs[_0x03de('0x2a')](_0x14e785[_0x03de('0x26')][_0x03de('0x2a')]));_0x5ce3c2['attributes']=_0x5ce3c2[_0x03de('0x29')][_0x03de('0x2b')]?_0x5ce3c2[_0x03de('0x29')]:_0x5c371f[_0x03de('0x24')];if(!_0x14e785[_0x03de('0x26')][_0x03de('0x2c')]('nolimit')){_0x5ce3c2[_0x03de('0x1a')]=qs[_0x03de('0x1a')](_0x14e785['query'][_0x03de('0x1a')]);_0x5ce3c2[_0x03de('0x19')]=qs[_0x03de('0x19')](_0x14e785[_0x03de('0x26')]['offset']);}_0x5ce3c2[_0x03de('0x2d')]=qs[_0x03de('0x2e')](_0x14e785[_0x03de('0x26')][_0x03de('0x2e')]);_0x5ce3c2['where']=qs[_0x03de('0x27')](_[_0x03de('0x2f')](_0x14e785[_0x03de('0x26')],_0x5c371f['filters']));if(_0x14e785[_0x03de('0x26')][_0x03de('0x30')]){_0x5ce3c2[_0x03de('0x31')]=_[_0x03de('0x32')](_0x5ce3c2[_0x03de('0x31')],{'$or':_[_0x03de('0x33')](_0x2147b3,function(_0xdb21c3){if(_0xdb21c3['type'][_0x03de('0x34')]!==_0x03de('0x35')){var _0x5ba809={};_0x5ba809[_0xdb21c3['field']]={'$like':'%'+_0x14e785[_0x03de('0x26')][_0x03de('0x30')]+'%'};return _0x5ba809;}})});}_0x5ce3c2=_[_0x03de('0x32')]({},_0x5ce3c2,_0x14e785[_0x03de('0x36')]);var _0x65e73c={'where':_0x5ce3c2[_0x03de('0x31')]};return db[_0x03de('0x37')][_0x03de('0x18')](_0x65e73c)[_0x03de('0x20')](function(_0x269158){_0xb3fed8[_0x03de('0x18')]=_0x269158;if(_0x14e785[_0x03de('0x26')][_0x03de('0x38')]){_0x5ce3c2[_0x03de('0x39')]=[{'all':!![]}];}return db[_0x03de('0x37')][_0x03de('0x3a')](_0x5ce3c2);})[_0x03de('0x20')](function(_0x305187){_0xb3fed8[_0x03de('0x3b')]=_0x305187;return _0xb3fed8;})[_0x03de('0x20')](respondWithFilteredResult(_0x28416a,_0x5ce3c2))['catch'](handleError(_0x28416a,null));};exports[_0x03de('0x3c')]=function(_0x2b2dc3,_0x5b13ae){var _0x2b380e={'raw':!![],'where':{'id':_0x2b2dc3[_0x03de('0x3d')]['id']}},_0x2be56c={};_0x2be56c[_0x03de('0x24')]=_[_0x03de('0x25')](db[_0x03de('0x37')][_0x03de('0x3e')]);_0x2be56c[_0x03de('0x26')]=_['keys'](_0x2b2dc3[_0x03de('0x26')]);_0x2be56c[_0x03de('0x27')]=_[_0x03de('0x28')](_0x2be56c[_0x03de('0x24')],_0x2be56c[_0x03de('0x26')]);_0x2b380e[_0x03de('0x29')]=_[_0x03de('0x28')](_0x2be56c[_0x03de('0x24')],qs['fields'](_0x2b2dc3[_0x03de('0x26')]['fields']));_0x2b380e['attributes']=_0x2b380e[_0x03de('0x29')][_0x03de('0x2b')]?_0x2b380e[_0x03de('0x29')]:_0x2be56c['model'];if(_0x2b2dc3['query'][_0x03de('0x38')]){_0x2b380e[_0x03de('0x39')]=[{'all':!![]}];}_0x2b380e=_[_0x03de('0x32')]({},_0x2b380e,_0x2b2dc3[_0x03de('0x36')]);return db['Dynamics365Field'][_0x03de('0x3f')](_0x2b380e)['then'](handleEntityNotFound(_0x5b13ae,null))[_0x03de('0x20')](respondWithResult(_0x5b13ae,null))[_0x03de('0x40')](handleError(_0x5b13ae,null));};exports[_0x03de('0x41')]=function(_0x23d548,_0x1352c5){return db[_0x03de('0x37')]['create'](_0x23d548[_0x03de('0x42')],{})['then'](respondWithResult(_0x1352c5,0xc9))[_0x03de('0x40')](handleError(_0x1352c5,null));};exports['update']=function(_0x13d15c,_0x1ae15f){if(_0x13d15c[_0x03de('0x42')]['id']){delete _0x13d15c['body']['id'];}return db['Dynamics365Field'][_0x03de('0x3f')]({'where':{'id':_0x13d15c[_0x03de('0x3d')]['id']}})[_0x03de('0x20')](handleEntityNotFound(_0x1ae15f,null))[_0x03de('0x20')](saveUpdates(_0x13d15c[_0x03de('0x42')],null))[_0x03de('0x20')](respondWithResult(_0x1ae15f,null))[_0x03de('0x40')](handleError(_0x1ae15f,null));};exports['destroy']=function(_0x2ae2c6,_0x1b6c6e){return db['Dynamics365Field'][_0x03de('0x3f')]({'where':{'id':_0x2ae2c6[_0x03de('0x3d')]['id']}})['then'](handleEntityNotFound(_0x1b6c6e,null))[_0x03de('0x20')](removeEntity(_0x1b6c6e,null))[_0x03de('0x40')](handleError(_0x1b6c6e,null));};
\ No newline at end of file
+var _0xf1c6=['util','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','../../config/license/hardware','ioredis','../../config/logger','api','status','count','offset','limit','set','json','apply','reject','then','destroy','end','sendStatus','stack','name','send','Dynamics365Field','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','params','create','body','update','find','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x15d18f,_0x126b0e){var _0xd12bf7=function(_0x19e661){while(--_0x19e661){_0x15d18f['push'](_0x15d18f['shift']());}};_0xd12bf7(++_0x126b0e);}(_0xf1c6,0x145));var _0x6f1c=function(_0x1cceca,_0x3f9e83){_0x1cceca=_0x1cceca-0x0;var _0x189247=_0xf1c6[_0x1cceca];return _0x189247;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6f1c('0x0'));var zipdir=require(_0x6f1c('0x1'));var jsonpatch=require(_0x6f1c('0x2'));var rp=require(_0x6f1c('0x3'));var moment=require(_0x6f1c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6f1c('0x5'));var path=require('path');var sox=require(_0x6f1c('0x6'));var csv=require(_0x6f1c('0x7'));var ejs=require(_0x6f1c('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6f1c('0x9'));var crypto=require('crypto');var jsforce=require(_0x6f1c('0xa'));var deskjs=require(_0x6f1c('0xb'));var toCsv=require(_0x6f1c('0x7'));var querystring=require('querystring');var Papa=require(_0x6f1c('0xc'));var authService=require('../../components/auth/service');var hardwareService=require(_0x6f1c('0xd'));var Redis=require(_0x6f1c('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0x6f1c('0xf'))(_0x6f1c('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x497e92,_0x3f20cf){_0x3f20cf=_0x3f20cf||0xcc;return function(_0x4d03bc){if(_0x4d03bc){return _0x497e92['sendStatus'](_0x3f20cf);}return _0x497e92['status'](_0x3f20cf)['end']();};}function respondWithResult(_0x56e776,_0x38d780){_0x38d780=_0x38d780||0xc8;return function(_0x1899ff){if(_0x1899ff){return _0x56e776[_0x6f1c('0x11')](_0x38d780)['json'](_0x1899ff);}};}function respondWithFilteredResult(_0x82203a,_0x238c62){return function(_0x4547a7){if(_0x4547a7){var _0x4b21a4=_0x4547a7[_0x6f1c('0x12')],_0x3b7b71=_0x238c62[_0x6f1c('0x13')],_0x210abb=_0x238c62[_0x6f1c('0x13')]+_0x238c62[_0x6f1c('0x14')],_0x5515fa;if(_0x210abb>=_0x4b21a4){_0x210abb=_0x4b21a4;_0x5515fa=0xc8;}else{_0x5515fa=0xce;}_0x82203a[_0x6f1c('0x11')](_0x5515fa);return _0x82203a[_0x6f1c('0x15')]('Content-Range',_0x3b7b71+'-'+_0x210abb+'/'+_0x4b21a4)[_0x6f1c('0x16')](_0x4547a7);}return null;};}function patchUpdates(_0x6035da){return function(_0xfab35b){try{jsonpatch[_0x6f1c('0x17')](_0xfab35b,_0x6035da,!![]);}catch(_0x20c2bb){return BPromise[_0x6f1c('0x18')](_0x20c2bb);}return _0xfab35b['save']();};}function saveUpdates(_0x59ccaa,_0x58c2d8){return function(_0x29e9b5){if(_0x29e9b5){return _0x29e9b5['update'](_0x59ccaa)[_0x6f1c('0x19')](function(_0x4f6637){return _0x4f6637;});}return null;};}function removeEntity(_0x1ef209,_0x1588f2){return function(_0x475b48){if(_0x475b48){return _0x475b48[_0x6f1c('0x1a')]()[_0x6f1c('0x19')](function(){_0x1ef209[_0x6f1c('0x11')](0xcc)[_0x6f1c('0x1b')]();});}};}function handleEntityNotFound(_0x35934b,_0x255e0f){return function(_0x18ff09){if(!_0x18ff09){_0x35934b[_0x6f1c('0x1c')](0x194);}return _0x18ff09;};}function handleError(_0x2da230,_0x388416){_0x388416=_0x388416||0x1f4;return function(_0x2ffc5d){logger['error'](_0x2ffc5d[_0x6f1c('0x1d')]);if(_0x2ffc5d[_0x6f1c('0x1e')]){delete _0x2ffc5d['name'];}_0x2da230[_0x6f1c('0x11')](_0x388416)[_0x6f1c('0x1f')](_0x2ffc5d);};}exports['index']=function(_0x59931c,_0x5c0bcc){var _0x500e36={},_0x16fe5a={},_0x1ac9f5={'count':0x0,'rows':[]};var _0x19b659=db[_0x6f1c('0x20')][_0x6f1c('0x21')];_0x16fe5a[_0x6f1c('0x22')]=_[_0x6f1c('0x23')](_0x19b659);_0x16fe5a[_0x6f1c('0x24')]=_[_0x6f1c('0x23')](_0x59931c[_0x6f1c('0x24')]);_0x16fe5a[_0x6f1c('0x25')]=_[_0x6f1c('0x26')](_0x16fe5a['model'],_0x16fe5a['query']);_0x500e36[_0x6f1c('0x27')]=_[_0x6f1c('0x26')](_0x16fe5a[_0x6f1c('0x22')],qs[_0x6f1c('0x28')](_0x59931c[_0x6f1c('0x24')]['fields']));_0x500e36[_0x6f1c('0x27')]=_0x500e36['attributes'][_0x6f1c('0x29')]?_0x500e36['attributes']:_0x16fe5a[_0x6f1c('0x22')];if(!_0x59931c[_0x6f1c('0x24')][_0x6f1c('0x2a')](_0x6f1c('0x2b'))){_0x500e36[_0x6f1c('0x14')]=qs[_0x6f1c('0x14')](_0x59931c[_0x6f1c('0x24')][_0x6f1c('0x14')]);_0x500e36[_0x6f1c('0x13')]=qs[_0x6f1c('0x13')](_0x59931c['query'][_0x6f1c('0x13')]);}_0x500e36[_0x6f1c('0x2c')]=qs[_0x6f1c('0x2d')](_0x59931c[_0x6f1c('0x24')][_0x6f1c('0x2d')]);_0x500e36[_0x6f1c('0x2e')]=qs[_0x6f1c('0x25')](_[_0x6f1c('0x2f')](_0x59931c[_0x6f1c('0x24')],_0x16fe5a['filters']));if(_0x59931c['query'][_0x6f1c('0x30')]){_0x500e36[_0x6f1c('0x2e')]=_[_0x6f1c('0x31')](_0x500e36[_0x6f1c('0x2e')],{'$or':_[_0x6f1c('0x32')](_0x19b659,function(_0x84fa1c){if(_0x84fa1c[_0x6f1c('0x33')][_0x6f1c('0x34')]!==_0x6f1c('0x35')){var _0x187d49={};_0x187d49[_0x84fa1c[_0x6f1c('0x36')]]={'$like':'%'+_0x59931c[_0x6f1c('0x24')][_0x6f1c('0x30')]+'%'};return _0x187d49;}})});}_0x500e36=_[_0x6f1c('0x31')]({},_0x500e36,_0x59931c[_0x6f1c('0x37')]);var _0x2273a0={'where':_0x500e36['where']};return db['Dynamics365Field'][_0x6f1c('0x12')](_0x2273a0)[_0x6f1c('0x19')](function(_0x34a08a){_0x1ac9f5[_0x6f1c('0x12')]=_0x34a08a;if(_0x59931c[_0x6f1c('0x24')][_0x6f1c('0x38')]){_0x500e36[_0x6f1c('0x39')]=[{'all':!![]}];}return db[_0x6f1c('0x20')][_0x6f1c('0x3a')](_0x500e36);})['then'](function(_0x1c0860){_0x1ac9f5[_0x6f1c('0x3b')]=_0x1c0860;return _0x1ac9f5;})[_0x6f1c('0x19')](respondWithFilteredResult(_0x5c0bcc,_0x500e36))[_0x6f1c('0x3c')](handleError(_0x5c0bcc,null));};exports['show']=function(_0x907834,_0x53db4b){var _0x173cbc={'raw':!![],'where':{'id':_0x907834[_0x6f1c('0x3d')]['id']}},_0x1a555c={};_0x1a555c[_0x6f1c('0x22')]=_[_0x6f1c('0x23')](db[_0x6f1c('0x20')][_0x6f1c('0x21')]);_0x1a555c[_0x6f1c('0x24')]=_[_0x6f1c('0x23')](_0x907834[_0x6f1c('0x24')]);_0x1a555c[_0x6f1c('0x25')]=_[_0x6f1c('0x26')](_0x1a555c['model'],_0x1a555c[_0x6f1c('0x24')]);_0x173cbc[_0x6f1c('0x27')]=_['intersection'](_0x1a555c[_0x6f1c('0x22')],qs[_0x6f1c('0x28')](_0x907834[_0x6f1c('0x24')][_0x6f1c('0x28')]));_0x173cbc[_0x6f1c('0x27')]=_0x173cbc[_0x6f1c('0x27')][_0x6f1c('0x29')]?_0x173cbc['attributes']:_0x1a555c[_0x6f1c('0x22')];if(_0x907834['query'][_0x6f1c('0x38')]){_0x173cbc[_0x6f1c('0x39')]=[{'all':!![]}];}_0x173cbc=_[_0x6f1c('0x31')]({},_0x173cbc,_0x907834[_0x6f1c('0x37')]);return db[_0x6f1c('0x20')]['find'](_0x173cbc)[_0x6f1c('0x19')](handleEntityNotFound(_0x53db4b,null))[_0x6f1c('0x19')](respondWithResult(_0x53db4b,null))['catch'](handleError(_0x53db4b,null));};exports[_0x6f1c('0x3e')]=function(_0x1f40bf,_0x334dab){return db['Dynamics365Field'][_0x6f1c('0x3e')](_0x1f40bf[_0x6f1c('0x3f')],{})[_0x6f1c('0x19')](respondWithResult(_0x334dab,0xc9))[_0x6f1c('0x3c')](handleError(_0x334dab,null));};exports[_0x6f1c('0x40')]=function(_0x4453b0,_0x434274){if(_0x4453b0[_0x6f1c('0x3f')]['id']){delete _0x4453b0['body']['id'];}return db[_0x6f1c('0x20')][_0x6f1c('0x41')]({'where':{'id':_0x4453b0[_0x6f1c('0x3d')]['id']}})['then'](handleEntityNotFound(_0x434274,null))[_0x6f1c('0x19')](saveUpdates(_0x4453b0[_0x6f1c('0x3f')],null))[_0x6f1c('0x19')](respondWithResult(_0x434274,null))['catch'](handleError(_0x434274,null));};exports[_0x6f1c('0x1a')]=function(_0x215b86,_0x435f52){return db[_0x6f1c('0x20')][_0x6f1c('0x41')]({'where':{'id':_0x215b86[_0x6f1c('0x3d')]['id']}})[_0x6f1c('0x19')](handleEntityNotFound(_0x435f52,null))[_0x6f1c('0x19')](removeEntity(_0x435f52,null))['catch'](handleError(_0x435f52,null));};
\ No newline at end of file
index 90ffc04..467b3cd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8597=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','exports','Dynamics365Field','int_dynamics365_fields','idField','FieldId'];(function(_0x3b8f2e,_0x5a99a8){var _0x1433d5=function(_0x5e0353){while(--_0x5e0353){_0x3b8f2e['push'](_0x3b8f2e['shift']());}};_0x1433d5(++_0x5a99a8);}(_0x8597,0xc0));var _0x7859=function(_0x5401ae,_0x5e58ac){_0x5401ae=_0x5401ae-0x0;var _0x286068=_0x8597[_0x5401ae];return _0x286068;};'use strict';var _=require(_0x7859('0x0'));var util=require(_0x7859('0x1'));var logger=require(_0x7859('0x2'))(_0x7859('0x3'));var moment=require(_0x7859('0x4'));var BPromise=require(_0x7859('0x5'));var rp=require(_0x7859('0x6'));var attributes=require('./intDynamics365Field.attributes');module[_0x7859('0x7')]=function(_0x45da40,_0x3ef9b0){return _0x45da40['define'](_0x7859('0x8'),attributes,{'tableName':_0x7859('0x9'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x7859('0xa'),_0x7859('0xb')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xdec5=['./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index','idField','FieldId','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x5280f4,_0x3c36d0){var _0xba93e7=function(_0x14d63a){while(--_0x14d63a){_0x5280f4['push'](_0x5280f4['shift']());}};_0xba93e7(++_0x3c36d0);}(_0xdec5,0xeb));var _0x5dec=function(_0xb3e6cb,_0x5611c8){_0xb3e6cb=_0xb3e6cb-0x0;var _0x4d5d22=_0xdec5[_0xb3e6cb];return _0x4d5d22;};'use strict';var _=require(_0x5dec('0x0'));var util=require('util');var logger=require(_0x5dec('0x1'))(_0x5dec('0x2'));var moment=require('moment');var BPromise=require(_0x5dec('0x3'));var rp=require(_0x5dec('0x4'));var attributes=require(_0x5dec('0x5'));module[_0x5dec('0x6')]=function(_0x4d89a6,_0x19a6ae){return _0x4d89a6[_0x5dec('0x7')](_0x5dec('0x8'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x5dec('0x9'),'fields':[_0x5dec('0xa'),_0x5dec('0xb')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index 397b0d2..76c7943 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x98c5=['Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x98c5,0xeb));var _0x598c=function(_0x3bf622,_0x410deb){_0x3bf622=_0x3bf622-0x0;var _0x3075f4=_0x98c5[_0x3bf622];return _0x3075f4;};'use strict';var _=require(_0x598c('0x0'));var util=require(_0x598c('0x1'));var moment=require(_0x598c('0x2'));var BPromise=require('bluebird');var rs=require(_0x598c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x598c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x598c('0x5'))(_0x598c('0x6'));var config=require('../../config/environment');var jayson=require(_0x598c('0x7'));var client=jayson[_0x598c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x277d53,_0x2ce892,_0x1cb148){return new BPromise(function(_0x3767ae,_0x57300a){return client[_0x598c('0x9')](_0x277d53,_0x1cb148)[_0x598c('0xa')](function(_0x2fb83c){logger[_0x598c('0xb')](_0x598c('0xc'),_0x2ce892,'request\x20sent');logger[_0x598c('0xd')](_0x598c('0xe'),_0x2ce892,_0x598c('0xf'),JSON['stringify'](_0x2fb83c));if(_0x2fb83c['error']){if(_0x2fb83c[_0x598c('0x10')]['code']===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x2ce892,_0x2fb83c[_0x598c('0x10')]['message']);return _0x57300a(_0x2fb83c[_0x598c('0x10')]['message']);}logger[_0x598c('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x2ce892,_0x2fb83c['error']['message']);return _0x3767ae(_0x2fb83c[_0x598c('0x10')][_0x598c('0x11')]);}else{logger[_0x598c('0xb')](_0x598c('0xc'),_0x2ce892,_0x598c('0xf'));_0x3767ae(_0x2fb83c[_0x598c('0x12')]['message']);}})['catch'](function(_0x4ee571){logger[_0x598c('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x2ce892,_0x4ee571);_0x57300a(_0x4ee571);});});}
\ No newline at end of file
+var _0xe683=['info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request'];(function(_0x250904,_0x217bb3){var _0x3df27c=function(_0x765def){while(--_0x765def){_0x250904['push'](_0x250904['shift']());}};_0x3df27c(++_0x217bb3);}(_0xe683,0x1d7));var _0x3e68=function(_0x97fd60,_0x3095bc){_0x97fd60=_0x97fd60-0x0;var _0x1d8dc2=_0xe683[_0x97fd60];return _0x1d8dc2;};'use strict';var _=require(_0x3e68('0x0'));var util=require(_0x3e68('0x1'));var moment=require(_0x3e68('0x2'));var BPromise=require(_0x3e68('0x3'));var rs=require(_0x3e68('0x4'));var fs=require('fs');var Redis=require(_0x3e68('0x5'));var db=require(_0x3e68('0x6'))['db'];var utils=require(_0x3e68('0x7'));var logger=require(_0x3e68('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3e68('0x9'));var client=jayson[_0x3e68('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cfd39,_0xbbe4b1,_0x5d8380){return new BPromise(function(_0x48aab0,_0x346080){return client[_0x3e68('0xb')](_0x1cfd39,_0x5d8380)['then'](function(_0x5acf9a){logger[_0x3e68('0xc')](_0x3e68('0xd'),_0xbbe4b1,'request\x20sent');logger[_0x3e68('0xe')](_0x3e68('0xf'),_0xbbe4b1,_0x3e68('0x10'),JSON[_0x3e68('0x11')](_0x5acf9a));if(_0x5acf9a[_0x3e68('0x12')]){if(_0x5acf9a[_0x3e68('0x12')][_0x3e68('0x13')]===0x1f4){logger['error'](_0x3e68('0xd'),_0xbbe4b1,_0x5acf9a[_0x3e68('0x12')][_0x3e68('0x14')]);return _0x346080(_0x5acf9a['error'][_0x3e68('0x14')]);}logger[_0x3e68('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0xbbe4b1,_0x5acf9a[_0x3e68('0x12')][_0x3e68('0x14')]);return _0x48aab0(_0x5acf9a['error'][_0x3e68('0x14')]);}else{logger[_0x3e68('0xc')](_0x3e68('0xd'),_0xbbe4b1,_0x3e68('0x10'));_0x48aab0(_0x5acf9a[_0x3e68('0x15')]['message']);}})[_0x3e68('0x16')](function(_0x3b663d){logger[_0x3e68('0x12')](_0x3e68('0xd'),_0xbbe4b1,_0x3b663d);_0x346080(_0x3b663d);});});}
\ No newline at end of file
index f680008..b7a87c3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0981=['create','/:id/configurations','addConfiguration','update','delete','destroy','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post'];(function(_0x35c26e,_0x1583cc){var _0x364f03=function(_0xd00dd){while(--_0xd00dd){_0x35c26e['push'](_0x35c26e['shift']());}};_0x364f03(++_0x1583cc);}(_0x0981,0xae));var _0x1098=function(_0x2577be,_0x321390){_0x2577be=_0x2577be-0x0;var _0x409ce2=_0x0981[_0x2577be];return _0x409ce2;};'use strict';var multer=require(_0x1098('0x0'));var util=require('util');var path=require(_0x1098('0x1'));var timeout=require('connect-timeout');var express=require(_0x1098('0x2'));var router=express['Router']();var auth=require(_0x1098('0x3'));var interaction=require(_0x1098('0x4'));var config=require(_0x1098('0x5'));var controller=require('./intFreshdeskAccount.controller');router[_0x1098('0x6')]('/',auth[_0x1098('0x7')](),controller[_0x1098('0x8')]);router[_0x1098('0x6')](_0x1098('0x9'),auth['isAuthenticated'](),controller[_0x1098('0xa')]);router['get']('/:id/configurations',auth[_0x1098('0x7')](),controller[_0x1098('0xb')]);router[_0x1098('0x6')](_0x1098('0xc'),auth['isAuthenticated'](),controller[_0x1098('0xd')]);router[_0x1098('0xe')]('/',auth[_0x1098('0x7')](),controller[_0x1098('0xf')]);router[_0x1098('0xe')](_0x1098('0x10'),auth[_0x1098('0x7')](),controller[_0x1098('0x11')]);router['put'](_0x1098('0x9'),auth[_0x1098('0x7')](),controller[_0x1098('0x12')]);router[_0x1098('0x13')](_0x1098('0x9'),auth[_0x1098('0x7')](),controller[_0x1098('0x14')]);module['exports']=router;
\ No newline at end of file
+var _0x9984=['/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated'];(function(_0x345264,_0x2ac630){var _0x34d106=function(_0xac10dd){while(--_0xac10dd){_0x345264['push'](_0x345264['shift']());}};_0x34d106(++_0x2ac630);}(_0x9984,0xf9));var _0x4998=function(_0xde6614,_0x540cfa){_0xde6614=_0xde6614-0x0;var _0x52307f=_0x9984[_0xde6614];return _0x52307f;};'use strict';var multer=require(_0x4998('0x0'));var util=require(_0x4998('0x1'));var path=require(_0x4998('0x2'));var timeout=require(_0x4998('0x3'));var express=require(_0x4998('0x4'));var router=express[_0x4998('0x5')]();var auth=require(_0x4998('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4998('0x7'));var controller=require(_0x4998('0x8'));router[_0x4998('0x9')]('/',auth[_0x4998('0xa')](),controller['index']);router[_0x4998('0x9')](_0x4998('0xb'),auth[_0x4998('0xa')](),controller['show']);router[_0x4998('0x9')](_0x4998('0xc'),auth[_0x4998('0xa')](),controller[_0x4998('0xd')]);router[_0x4998('0x9')](_0x4998('0xe'),auth['isAuthenticated'](),controller[_0x4998('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x4998('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x4998('0xb'),auth[_0x4998('0xa')](),controller[_0x4998('0x10')]);router[_0x4998('0x11')]('/:id',auth[_0x4998('0xa')](),controller[_0x4998('0x12')]);module[_0x4998('0x13')]=router;
\ No newline at end of file
index 52aa092..389e735 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xffb8=['remoteUri','sequelize','exports','STRING','username'];(function(_0x49e6bc,_0x50e8b7){var _0x2778d7=function(_0x1aab02){while(--_0x1aab02){_0x49e6bc['push'](_0x49e6bc['shift']());}};_0x2778d7(++_0x50e8b7);}(_0xffb8,0x164));var _0x8ffb=function(_0x3a7dd6,_0x29a531){_0x3a7dd6=_0x3a7dd6-0x0;var _0xc011f=_0xffb8[_0x3a7dd6];return _0xc011f;};'use strict';var Sequelize=require(_0x8ffb('0x0'));module[_0x8ffb('0x1')]={'name':{'type':Sequelize[_0x8ffb('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x8ffb('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x8ffb('0x2')],'unique':_0x8ffb('0x4')},'serverUrl':{'type':Sequelize[_0x8ffb('0x2')]}};
\ No newline at end of file
+var _0xf6f8=['STRING','username','remoteUri','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf6f8,0xf8));var _0x8f6f=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xf6f8[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x8f6f('0x0'));module[_0x8f6f('0x1')]={'name':{'type':Sequelize[_0x8f6f('0x2')]},'description':{'type':Sequelize[_0x8f6f('0x2')]},'username':{'type':Sequelize[_0x8f6f('0x2')],'unique':_0x8f6f('0x3')},'apiKey':{'type':Sequelize[_0x8f6f('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x8f6f('0x4')},'serverUrl':{'type':Sequelize[_0x8f6f('0x2')]}};
\ No newline at end of file
index 8251083..27d0547 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0736=['save','update','destroy','end','name','send','FreshdeskAccount','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','map','type','key','field','filter','merge','options','includeAll','include','findAll','catch','params','length','find','create','body','findOne','FreshdeskConfiguration','getConfigurations','addConfiguration','Subjects','getSubjects','channel','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','subject','description','priority','group','company','remove','includes','default','custom_text','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','json','count','offset','set','Content-Range','apply'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0736,0xc3));var _0x6073=function(_0x3a7634,_0x18f234){_0x3a7634=_0x3a7634-0x0;var _0x1c7ad5=_0x0736[_0x3a7634];return _0x1c7ad5;};'use strict';var pdf=require(_0x6073('0x0'));var emlformat=require(_0x6073('0x1'));var rimraf=require(_0x6073('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6073('0x3'));var rp=require(_0x6073('0x4'));var moment=require(_0x6073('0x5'));var BPromise=require(_0x6073('0x6'));var Mustache=require(_0x6073('0x7'));var util=require('util');var path=require(_0x6073('0x8'));var sox=require(_0x6073('0x9'));var csv=require(_0x6073('0xa'));var ejs=require(_0x6073('0xb'));var fs=require('fs');var _=require(_0x6073('0xc'));var squel=require('squel');var crypto=require(_0x6073('0xd'));var jsforce=require(_0x6073('0xe'));var deskjs=require(_0x6073('0xf'));var toCsv=require(_0x6073('0xa'));var querystring=require(_0x6073('0x10'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0x6073('0x11'));var Redis=require(_0x6073('0x12'));var qs=require(_0x6073('0x13'));var logger=require(_0x6073('0x14'))(_0x6073('0x15'));var utils=require(_0x6073('0x16'));var config=require('../../config/environment');var db=require(_0x6073('0x17'))['db'];var integrations=require(_0x6073('0x18'));var jayson=require('jayson/promise');var client=jayson[_0x6073('0x19')][_0x6073('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x532aff,_0x10d40d,_0x3c4664,_0x2db770){return new BPromise(function(_0x3d2aed,_0x4f1a2b){var _0x5b242c=_0x2db770||client;return _0x5b242c[_0x6073('0x1b')](_0x532aff,_0x3c4664)[_0x6073('0x1c')](function(_0x2fe87b){logger[_0x6073('0x1d')](_0x6073('0x1e'),_0x10d40d,_0x6073('0x1f'));logger[_0x6073('0x20')](_0x6073('0x21'),_0x10d40d,_0x6073('0x1f'),JSON[_0x6073('0x22')](_0x2fe87b));if(_0x2fe87b[_0x6073('0x23')]){if(_0x2fe87b[_0x6073('0x23')]['code']===0x1f4){logger[_0x6073('0x23')]('FreshdeskAccount,\x20%s,\x20%s',_0x10d40d,_0x2fe87b[_0x6073('0x23')]['message']);return _0x4f1a2b(_0x2fe87b[_0x6073('0x23')][_0x6073('0x24')]);}logger[_0x6073('0x23')](_0x6073('0x1e'),_0x10d40d,_0x2fe87b[_0x6073('0x23')][_0x6073('0x24')]);return _0x3d2aed(_0x2fe87b[_0x6073('0x23')][_0x6073('0x24')]);}else{logger[_0x6073('0x1d')]('FreshdeskAccount,\x20%s,\x20%s',_0x10d40d,_0x6073('0x1f'));_0x3d2aed(_0x2fe87b['result'][_0x6073('0x24')]);}})['catch'](function(_0x48c745){logger['error'](_0x6073('0x1e'),_0x10d40d,_0x48c745);_0x4f1a2b(_0x48c745);});});}function respondWithStatusCode(_0x24cf76,_0x4cd9a2){_0x4cd9a2=_0x4cd9a2||0xcc;return function(_0x4f1c61){if(_0x4f1c61){return _0x24cf76[_0x6073('0x25')](_0x4cd9a2);}return _0x24cf76[_0x6073('0x26')](_0x4cd9a2)['end']();};}function respondWithResult(_0x430497,_0x4f5cad){_0x4f5cad=_0x4f5cad||0xc8;return function(_0x28118a){if(_0x28118a){return _0x430497[_0x6073('0x26')](_0x4f5cad)[_0x6073('0x27')](_0x28118a);}};}function respondWithFilteredResult(_0x2c5868,_0x95f102){return function(_0x23e873){if(_0x23e873){var _0x5ee5de=_0x23e873[_0x6073('0x28')],_0x5e8e69=_0x95f102[_0x6073('0x29')],_0x2107e7=_0x95f102['offset']+_0x95f102['limit'],_0x2a4951;if(_0x2107e7>=_0x5ee5de){_0x2107e7=_0x5ee5de;_0x2a4951=0xc8;}else{_0x2a4951=0xce;}_0x2c5868['status'](_0x2a4951);return _0x2c5868[_0x6073('0x2a')](_0x6073('0x2b'),_0x5e8e69+'-'+_0x2107e7+'/'+_0x5ee5de)[_0x6073('0x27')](_0x23e873);}return null;};}function patchUpdates(_0x2c3623){return function(_0x3a6910){try{jsonpatch[_0x6073('0x2c')](_0x3a6910,_0x2c3623,!![]);}catch(_0x3a6a8e){return BPromise['reject'](_0x3a6a8e);}return _0x3a6910[_0x6073('0x2d')]();};}function saveUpdates(_0x4f53f5,_0x4b2cb3){return function(_0xbd18b8){if(_0xbd18b8){return _0xbd18b8[_0x6073('0x2e')](_0x4f53f5)[_0x6073('0x1c')](function(_0x5aa7a6){return _0x5aa7a6;});}return null;};}function removeEntity(_0x49f144,_0x52627d){return function(_0x1fa200){if(_0x1fa200){return _0x1fa200[_0x6073('0x2f')]()[_0x6073('0x1c')](function(){_0x49f144[_0x6073('0x26')](0xcc)[_0x6073('0x30')]();});}};}function handleEntityNotFound(_0x59cc8c,_0x290ec9){return function(_0x5c5b93){if(!_0x5c5b93){_0x59cc8c['sendStatus'](0x194);}return _0x5c5b93;};}function handleError(_0x1d3f97,_0x2b9a5d){_0x2b9a5d=_0x2b9a5d||0x1f4;return function(_0x52bc71){logger[_0x6073('0x23')](_0x52bc71['stack']);if(_0x52bc71[_0x6073('0x31')]){delete _0x52bc71['name'];}_0x1d3f97[_0x6073('0x26')](_0x2b9a5d)[_0x6073('0x32')](_0x52bc71);};}exports['index']=function(_0x2c72fd,_0x5b92f6){var _0x343b70={},_0x48168f={},_0x13869e={'count':0x0,'rows':[]};var _0x32c1c8=db[_0x6073('0x33')][_0x6073('0x34')];_0x48168f[_0x6073('0x35')]=_[_0x6073('0x36')](_0x32c1c8);_0x48168f[_0x6073('0x37')]=_[_0x6073('0x36')](_0x2c72fd['query']);_0x48168f[_0x6073('0x38')]=_[_0x6073('0x39')](_0x48168f['model'],_0x48168f[_0x6073('0x37')]);_0x343b70[_0x6073('0x3a')]=_[_0x6073('0x39')](_0x48168f[_0x6073('0x35')],qs[_0x6073('0x3b')](_0x2c72fd[_0x6073('0x37')][_0x6073('0x3b')]));_0x343b70[_0x6073('0x3a')]=_0x343b70[_0x6073('0x3a')]['length']?_0x343b70[_0x6073('0x3a')]:_0x48168f['model'];if(!_0x2c72fd['query'][_0x6073('0x3c')](_0x6073('0x3d'))){_0x343b70[_0x6073('0x3e')]=qs[_0x6073('0x3e')](_0x2c72fd[_0x6073('0x37')][_0x6073('0x3e')]);_0x343b70[_0x6073('0x29')]=qs['offset'](_0x2c72fd[_0x6073('0x37')]['offset']);}_0x343b70[_0x6073('0x3f')]=qs[_0x6073('0x40')](_0x2c72fd[_0x6073('0x37')][_0x6073('0x40')]);_0x343b70[_0x6073('0x41')]=qs[_0x6073('0x38')](_[_0x6073('0x42')](_0x2c72fd[_0x6073('0x37')],_0x48168f[_0x6073('0x38')]));if(_0x2c72fd['query']['filter']){_0x343b70[_0x6073('0x41')]=_['merge'](_0x343b70[_0x6073('0x41')],{'$or':_[_0x6073('0x43')](_0x32c1c8,function(_0x534974){if(_0x534974[_0x6073('0x44')][_0x6073('0x45')]!=='VIRTUAL'){var _0x4e35f0={};_0x4e35f0[_0x534974[_0x6073('0x46')]]={'$like':'%'+_0x2c72fd[_0x6073('0x37')][_0x6073('0x47')]+'%'};return _0x4e35f0;}})});}_0x343b70=_[_0x6073('0x48')]({},_0x343b70,_0x2c72fd[_0x6073('0x49')]);var _0x462e5a={'where':_0x343b70[_0x6073('0x41')]};return db[_0x6073('0x33')][_0x6073('0x28')](_0x462e5a)[_0x6073('0x1c')](function(_0x1a58d2){_0x13869e[_0x6073('0x28')]=_0x1a58d2;if(_0x2c72fd[_0x6073('0x37')][_0x6073('0x4a')]){_0x343b70[_0x6073('0x4b')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x6073('0x4c')](_0x343b70);})[_0x6073('0x1c')](function(_0x5c95cb){_0x13869e['rows']=_0x5c95cb;return _0x13869e;})[_0x6073('0x1c')](respondWithFilteredResult(_0x5b92f6,_0x343b70))[_0x6073('0x4d')](handleError(_0x5b92f6,null));};exports['show']=function(_0x524c89,_0x51f145){var _0x1ccfeb={'raw':![],'where':{'id':_0x524c89[_0x6073('0x4e')]['id']}},_0x10f137={};_0x10f137[_0x6073('0x35')]=_[_0x6073('0x36')](db[_0x6073('0x33')]['rawAttributes']);_0x10f137[_0x6073('0x37')]=_[_0x6073('0x36')](_0x524c89[_0x6073('0x37')]);_0x10f137[_0x6073('0x38')]=_[_0x6073('0x39')](_0x10f137[_0x6073('0x35')],_0x10f137[_0x6073('0x37')]);_0x1ccfeb[_0x6073('0x3a')]=_[_0x6073('0x39')](_0x10f137[_0x6073('0x35')],qs[_0x6073('0x3b')](_0x524c89[_0x6073('0x37')][_0x6073('0x3b')]));_0x1ccfeb[_0x6073('0x3a')]=_0x1ccfeb[_0x6073('0x3a')][_0x6073('0x4f')]?_0x1ccfeb['attributes']:_0x10f137[_0x6073('0x35')];if(_0x524c89['query'][_0x6073('0x4a')]){_0x1ccfeb[_0x6073('0x4b')]=[{'all':!![]}];}_0x1ccfeb=_[_0x6073('0x48')]({},_0x1ccfeb,_0x524c89[_0x6073('0x49')]);return db['FreshdeskAccount'][_0x6073('0x50')](_0x1ccfeb)[_0x6073('0x1c')](handleEntityNotFound(_0x51f145,null))[_0x6073('0x1c')](respondWithResult(_0x51f145,null))['catch'](handleError(_0x51f145,null));};exports[_0x6073('0x51')]=function(_0x4ad3c4,_0x2f1221){return db[_0x6073('0x33')][_0x6073('0x51')](_0x4ad3c4[_0x6073('0x52')],{})[_0x6073('0x1c')](respondWithResult(_0x2f1221,0xc9))[_0x6073('0x4d')](handleError(_0x2f1221,null));};exports[_0x6073('0x2e')]=function(_0x5148fe,_0x237d4d){if(_0x5148fe[_0x6073('0x52')]['id']){delete _0x5148fe[_0x6073('0x52')]['id'];}return db[_0x6073('0x33')][_0x6073('0x50')]({'where':{'id':_0x5148fe[_0x6073('0x4e')]['id']}})[_0x6073('0x1c')](handleEntityNotFound(_0x237d4d,null))[_0x6073('0x1c')](saveUpdates(_0x5148fe[_0x6073('0x52')],null))[_0x6073('0x1c')](respondWithResult(_0x237d4d,null))['catch'](handleError(_0x237d4d,null));};exports['destroy']=function(_0x1e99e3,_0x1cec47){return db[_0x6073('0x33')]['find']({'where':{'id':_0x1e99e3[_0x6073('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1cec47,null))['then'](removeEntity(_0x1cec47,null))['catch'](handleError(_0x1cec47,null));};exports['getConfigurations']=function(_0x2f8500,_0x1d00b7,_0xf5d637){var _0x38a682={};var _0x2bb49e={};var _0x1da134;var _0x5ad287;return db[_0x6073('0x33')][_0x6073('0x53')]({'where':{'id':_0x2f8500[_0x6073('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1d00b7,null))[_0x6073('0x1c')](function(_0xb0849d){if(_0xb0849d){_0x1da134=_0xb0849d;_0x2bb49e['model']=_[_0x6073('0x36')](db[_0x6073('0x54')][_0x6073('0x34')]);_0x2bb49e[_0x6073('0x37')]=_['keys'](_0x2f8500['query']);_0x2bb49e[_0x6073('0x38')]=_[_0x6073('0x39')](_0x2bb49e[_0x6073('0x35')],_0x2bb49e[_0x6073('0x37')]);_0x38a682[_0x6073('0x3a')]=_['intersection'](_0x2bb49e[_0x6073('0x35')],qs[_0x6073('0x3b')](_0x2f8500['query']['fields']));_0x38a682[_0x6073('0x3a')]=_0x38a682[_0x6073('0x3a')][_0x6073('0x4f')]?_0x38a682[_0x6073('0x3a')]:_0x2bb49e[_0x6073('0x35')];_0x38a682[_0x6073('0x3f')]=qs[_0x6073('0x40')](_0x2f8500[_0x6073('0x37')]['sort']);_0x38a682[_0x6073('0x41')]=qs[_0x6073('0x38')](_[_0x6073('0x42')](_0x2f8500[_0x6073('0x37')],_0x2bb49e[_0x6073('0x38')]));if(_0x2f8500[_0x6073('0x37')][_0x6073('0x47')]){_0x38a682['where']=_[_0x6073('0x48')](_0x38a682[_0x6073('0x41')],{'$or':_[_0x6073('0x43')](_0x38a682[_0x6073('0x3a')],function(_0x533bd6){var _0x5c0d34={};_0x5c0d34[_0x533bd6]={'$like':'%'+_0x2f8500[_0x6073('0x37')][_0x6073('0x47')]+'%'};return _0x5c0d34;})});}_0x38a682=_[_0x6073('0x48')]({},_0x38a682,_0x2f8500['options']);return _0x1da134[_0x6073('0x55')](_0x38a682);}})['then'](function(_0x51ed68){if(_0x51ed68){_0x5ad287=_0x51ed68[_0x6073('0x4f')];if(!_0x2f8500[_0x6073('0x37')]['hasOwnProperty'](_0x6073('0x3d'))){_0x38a682[_0x6073('0x3e')]=qs['limit'](_0x2f8500[_0x6073('0x37')][_0x6073('0x3e')]);_0x38a682[_0x6073('0x29')]=qs[_0x6073('0x29')](_0x2f8500[_0x6073('0x37')]['offset']);}return _0x1da134['getConfigurations'](_0x38a682);}})['then'](function(_0x3ab6a1){if(_0x3ab6a1){return _0x3ab6a1?{'count':_0x5ad287,'rows':_0x3ab6a1}:null;}})[_0x6073('0x1c')](respondWithResult(_0x1d00b7,null))[_0x6073('0x4d')](handleError(_0x1d00b7,null));};exports[_0x6073('0x56')]=function(_0x5a7744,_0x2fcff3,_0x856e81){if(_0x5a7744['body']['id']){delete _0x5a7744['body']['id'];}return db[_0x6073('0x33')][_0x6073('0x53')]({'where':{'id':_0x5a7744[_0x6073('0x4e')]['id']}})[_0x6073('0x1c')](handleEntityNotFound(_0x2fcff3,null))[_0x6073('0x1c')](function(_0x3e0f9a){if(_0x3e0f9a){_0x5a7744['body']['AccountId']=_0x3e0f9a['id'];_0x5a7744[_0x6073('0x52')][_0x6073('0x57')]=integrations[_0x6073('0x58')](_0x5a7744[_0x6073('0x52')][_0x6073('0x59')],_0x5a7744[_0x6073('0x52')][_0x6073('0x44')]);_0x5a7744[_0x6073('0x52')]['Descriptions']=integrations['getDescriptions'](_0x5a7744[_0x6073('0x52')][_0x6073('0x59')],_0x5a7744[_0x6073('0x52')][_0x6073('0x44')]);return db[_0x6073('0x54')]['create'](_0x5a7744[_0x6073('0x52')],{'include':[{'model':db[_0x6073('0x5a')],'as':'Subjects'},{'model':db[_0x6073('0x5a')],'as':_0x6073('0x5b')}]});}return null;})[_0x6073('0x1c')](respondWithResult(_0x2fcff3,null))[_0x6073('0x4d')](handleError(_0x2fcff3,null));};exports[_0x6073('0x5c')]=function(_0x7c316f,_0x48efde,_0x2e27c7){return db[_0x6073('0x33')][_0x6073('0x53')]({'where':{'id':_0x7c316f[_0x6073('0x4e')]['id']},'attributes':['id',_0x6073('0x5d'),_0x6073('0x5e')]})[_0x6073('0x1c')](handleEntityNotFound(_0x48efde,null))[_0x6073('0x1c')](function(_0x387d4e){if(_0x387d4e){var _0x4de167=_0x387d4e[_0x6073('0x5d')];var _0x44cf45=_0x387d4e[_0x6073('0x5d')]['slice'](-0x1);if(_0x44cf45==='/'){_0x4de167=_0x4de167[_0x6073('0x5f')](0x0,_0x4de167[_0x6073('0x60')](_0x44cf45));}return rp({'method':_0x6073('0x61'),'uri':util[_0x6073('0x62')](_0x6073('0x63'),_0x4de167,_0x6073('0x64')),'headers':{'Authorization':util[_0x6073('0x62')](_0x6073('0x65'),new Buffer(util[_0x6073('0x62')](_0x6073('0x66'),_0x387d4e[_0x6073('0x5e')]))[_0x6073('0x67')](_0x6073('0x68')))},'json':!![]});}})[_0x6073('0x1c')](function(_0x148cca){if(_0x148cca){var _0x36dc15=['requester',_0x6073('0x69'),'agent',_0x6073('0x6a'),_0x6073('0x26'),_0x6073('0x6b'),'group','source','ticket_type',_0x6073('0x6c'),_0x6073('0x6d')];_[_0x6073('0x6e')](_0x148cca,function(_0xde9334){return _0x36dc15[_0x6073('0x6f')](_0xde9334[_0x6073('0x31')])||!_0xde9334[_0x6073('0x70')]&&_0xde9334[_0x6073('0x44')]!==_0x6073('0x71');});return{'count':_0x148cca[_0x6073('0x4f')],'rows':_[_0x6073('0x43')](_0x148cca,function(_0x1b9bfa){return{'id':_0x1b9bfa[_0x6073('0x31')],'name':_0x1b9bfa[_0x6073('0x72')],'custom':!_0x1b9bfa['default'],'options':_0x1b9bfa[_0x6073('0x73')]?_[_0x6073('0x43')](_0x1b9bfa[_0x6073('0x73')],function(_0x170682){return{'name':_[_0x6073('0x74')](_0x170682),'value':_0x170682};}):[]};})};}})[_0x6073('0x1c')](respondWithResult(_0x48efde,null))[_0x6073('0x4d')](function(_0x4ac601){var _0x9f955e=_0x7c316f['query'][_0x6073('0x75')]?0x1f4:_0x4ac601[_0x6073('0x76')]||0x1f4;logger[_0x6073('0x23')](_0x6073('0x77'),_0x6073('0x5c'),_0x9f955e,JSON['stringify'](_0x4ac601));delete _0x4ac601[_0x6073('0x31')];if(_0x9f955e===0x191){_0x9f955e=0x190;}_0x48efde[_0x6073('0x26')](_0x9f955e)[_0x6073('0x32')](_0x7c316f[_0x6073('0x37')][_0x6073('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x4ac601[_0x6073('0x76')]}:_0x4ac601);});};
\ No newline at end of file
+var _0x8dfa=['../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','name','index','FreshdeskAccount','rawAttributes','model','keys','query','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','map','type','key','field','options','count','include','findAll','show','params','includeAll','create','body','find','findOne','FreshdeskConfiguration','getConfigurations','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s:X','toString','base64','requester','subject','agent','priority','group','ticket_type','company','remove','default','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/logger','api'];(function(_0xa6180a,_0x508ff9){var _0x10f626=function(_0x1bf882){while(--_0x1bf882){_0xa6180a['push'](_0xa6180a['shift']());}};_0x10f626(++_0x508ff9);}(_0x8dfa,0x155));var _0xa8df=function(_0x3af6d3,_0xd6ff2e){_0x3af6d3=_0x3af6d3-0x0;var _0xf0c5a8=_0x8dfa[_0x3af6d3];return _0xf0c5a8;};'use strict';var pdf=require(_0xa8df('0x0'));var emlformat=require(_0xa8df('0x1'));var rimraf=require(_0xa8df('0x2'));var zipdir=require(_0xa8df('0x3'));var jsonpatch=require(_0xa8df('0x4'));var rp=require('request-promise');var moment=require(_0xa8df('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa8df('0x6'));var path=require(_0xa8df('0x7'));var sox=require(_0xa8df('0x8'));var csv=require(_0xa8df('0x9'));var ejs=require(_0xa8df('0xa'));var fs=require('fs');var _=require(_0xa8df('0xb'));var squel=require('squel');var crypto=require(_0xa8df('0xc'));var jsforce=require(_0xa8df('0xd'));var deskjs=require(_0xa8df('0xe'));var toCsv=require(_0xa8df('0x9'));var querystring=require(_0xa8df('0xf'));var Papa=require('papaparse');var authService=require(_0xa8df('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xa8df('0x11'))(_0xa8df('0x12'));var utils=require(_0xa8df('0x13'));var config=require(_0xa8df('0x14'));var db=require(_0xa8df('0x15'))['db'];var integrations=require(_0xa8df('0x16'));var jayson=require(_0xa8df('0x17'));var client=jayson[_0xa8df('0x18')][_0xa8df('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3518b7,_0x183ab3,_0x10975a,_0x5c7efb){return new BPromise(function(_0x475ac7,_0x210010){var _0x4799f2=_0x5c7efb||client;return _0x4799f2[_0xa8df('0x1a')](_0x3518b7,_0x10975a)['then'](function(_0x1ba7f6){logger[_0xa8df('0x1b')](_0xa8df('0x1c'),_0x183ab3,'request\x20sent');logger[_0xa8df('0x1d')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x183ab3,'request\x20sent',JSON['stringify'](_0x1ba7f6));if(_0x1ba7f6[_0xa8df('0x1e')]){if(_0x1ba7f6[_0xa8df('0x1e')][_0xa8df('0x1f')]===0x1f4){logger['error'](_0xa8df('0x1c'),_0x183ab3,_0x1ba7f6[_0xa8df('0x1e')][_0xa8df('0x20')]);return _0x210010(_0x1ba7f6[_0xa8df('0x1e')][_0xa8df('0x20')]);}logger[_0xa8df('0x1e')](_0xa8df('0x1c'),_0x183ab3,_0x1ba7f6['error'][_0xa8df('0x20')]);return _0x475ac7(_0x1ba7f6[_0xa8df('0x1e')][_0xa8df('0x20')]);}else{logger['info'](_0xa8df('0x1c'),_0x183ab3,_0xa8df('0x21'));_0x475ac7(_0x1ba7f6[_0xa8df('0x22')][_0xa8df('0x20')]);}})[_0xa8df('0x23')](function(_0x3f11c7){logger['error'](_0xa8df('0x1c'),_0x183ab3,_0x3f11c7);_0x210010(_0x3f11c7);});});}function respondWithStatusCode(_0x55dc2c,_0x3b739e){_0x3b739e=_0x3b739e||0xcc;return function(_0x4069f4){if(_0x4069f4){return _0x55dc2c[_0xa8df('0x24')](_0x3b739e);}return _0x55dc2c[_0xa8df('0x25')](_0x3b739e)[_0xa8df('0x26')]();};}function respondWithResult(_0x131e4b,_0x1a8a90){_0x1a8a90=_0x1a8a90||0xc8;return function(_0x59b48a){if(_0x59b48a){return _0x131e4b[_0xa8df('0x25')](_0x1a8a90)[_0xa8df('0x27')](_0x59b48a);}};}function respondWithFilteredResult(_0x5a53ec,_0x2c0b57){return function(_0x4fec66){if(_0x4fec66){var _0x28cda4=_0x4fec66['count'],_0xcfe435=_0x2c0b57[_0xa8df('0x28')],_0x4ac70b=_0x2c0b57[_0xa8df('0x28')]+_0x2c0b57[_0xa8df('0x29')],_0x5140fe;if(_0x4ac70b>=_0x28cda4){_0x4ac70b=_0x28cda4;_0x5140fe=0xc8;}else{_0x5140fe=0xce;}_0x5a53ec[_0xa8df('0x25')](_0x5140fe);return _0x5a53ec[_0xa8df('0x2a')](_0xa8df('0x2b'),_0xcfe435+'-'+_0x4ac70b+'/'+_0x28cda4)[_0xa8df('0x27')](_0x4fec66);}return null;};}function patchUpdates(_0x4f14bd){return function(_0x20956c){try{jsonpatch[_0xa8df('0x2c')](_0x20956c,_0x4f14bd,!![]);}catch(_0x5b2d0b){return BPromise['reject'](_0x5b2d0b);}return _0x20956c[_0xa8df('0x2d')]();};}function saveUpdates(_0x235f84,_0x4dab64){return function(_0x2b6abc){if(_0x2b6abc){return _0x2b6abc[_0xa8df('0x2e')](_0x235f84)[_0xa8df('0x2f')](function(_0x27535f){return _0x27535f;});}return null;};}function removeEntity(_0x2651fb,_0x16a6ad){return function(_0x17f1b0){if(_0x17f1b0){return _0x17f1b0['destroy']()[_0xa8df('0x2f')](function(){_0x2651fb[_0xa8df('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x545fc9,_0x5c409b){return function(_0x46950f){if(!_0x46950f){_0x545fc9[_0xa8df('0x24')](0x194);}return _0x46950f;};}function handleError(_0x491b70,_0x57f42b){_0x57f42b=_0x57f42b||0x1f4;return function(_0x20ee43){logger[_0xa8df('0x1e')](_0x20ee43['stack']);if(_0x20ee43[_0xa8df('0x30')]){delete _0x20ee43[_0xa8df('0x30')];}_0x491b70['status'](_0x57f42b)['send'](_0x20ee43);};}exports[_0xa8df('0x31')]=function(_0x5ed96b,_0xd0eba2){var _0x6c73eb={},_0x46a33e={},_0x42981e={'count':0x0,'rows':[]};var _0x38dcee=db[_0xa8df('0x32')][_0xa8df('0x33')];_0x46a33e[_0xa8df('0x34')]=_[_0xa8df('0x35')](_0x38dcee);_0x46a33e['query']=_[_0xa8df('0x35')](_0x5ed96b[_0xa8df('0x36')]);_0x46a33e['filters']=_[_0xa8df('0x37')](_0x46a33e['model'],_0x46a33e[_0xa8df('0x36')]);_0x6c73eb[_0xa8df('0x38')]=_[_0xa8df('0x37')](_0x46a33e['model'],qs[_0xa8df('0x39')](_0x5ed96b[_0xa8df('0x36')][_0xa8df('0x39')]));_0x6c73eb[_0xa8df('0x38')]=_0x6c73eb[_0xa8df('0x38')][_0xa8df('0x3a')]?_0x6c73eb[_0xa8df('0x38')]:_0x46a33e[_0xa8df('0x34')];if(!_0x5ed96b[_0xa8df('0x36')]['hasOwnProperty']('nolimit')){_0x6c73eb[_0xa8df('0x29')]=qs['limit'](_0x5ed96b['query'][_0xa8df('0x29')]);_0x6c73eb['offset']=qs['offset'](_0x5ed96b['query'][_0xa8df('0x28')]);}_0x6c73eb[_0xa8df('0x3b')]=qs[_0xa8df('0x3c')](_0x5ed96b[_0xa8df('0x36')][_0xa8df('0x3c')]);_0x6c73eb[_0xa8df('0x3d')]=qs[_0xa8df('0x3e')](_[_0xa8df('0x3f')](_0x5ed96b['query'],_0x46a33e[_0xa8df('0x3e')]));if(_0x5ed96b[_0xa8df('0x36')][_0xa8df('0x40')]){_0x6c73eb[_0xa8df('0x3d')]=_[_0xa8df('0x41')](_0x6c73eb['where'],{'$or':_[_0xa8df('0x42')](_0x38dcee,function(_0x45d88e){if(_0x45d88e[_0xa8df('0x43')][_0xa8df('0x44')]!=='VIRTUAL'){var _0x31b825={};_0x31b825[_0x45d88e[_0xa8df('0x45')]]={'$like':'%'+_0x5ed96b[_0xa8df('0x36')][_0xa8df('0x40')]+'%'};return _0x31b825;}})});}_0x6c73eb=_[_0xa8df('0x41')]({},_0x6c73eb,_0x5ed96b[_0xa8df('0x46')]);var _0x299c93={'where':_0x6c73eb[_0xa8df('0x3d')]};return db[_0xa8df('0x32')][_0xa8df('0x47')](_0x299c93)[_0xa8df('0x2f')](function(_0x10c3e1){_0x42981e['count']=_0x10c3e1;if(_0x5ed96b[_0xa8df('0x36')]['includeAll']){_0x6c73eb[_0xa8df('0x48')]=[{'all':!![]}];}return db[_0xa8df('0x32')][_0xa8df('0x49')](_0x6c73eb);})[_0xa8df('0x2f')](function(_0x2ad849){_0x42981e['rows']=_0x2ad849;return _0x42981e;})[_0xa8df('0x2f')](respondWithFilteredResult(_0xd0eba2,_0x6c73eb))[_0xa8df('0x23')](handleError(_0xd0eba2,null));};exports[_0xa8df('0x4a')]=function(_0x5bb6de,_0x44e621){var _0x2316c7={'raw':![],'where':{'id':_0x5bb6de[_0xa8df('0x4b')]['id']}},_0x14745d={};_0x14745d['model']=_['keys'](db[_0xa8df('0x32')][_0xa8df('0x33')]);_0x14745d['query']=_[_0xa8df('0x35')](_0x5bb6de[_0xa8df('0x36')]);_0x14745d[_0xa8df('0x3e')]=_[_0xa8df('0x37')](_0x14745d[_0xa8df('0x34')],_0x14745d['query']);_0x2316c7['attributes']=_[_0xa8df('0x37')](_0x14745d['model'],qs[_0xa8df('0x39')](_0x5bb6de['query']['fields']));_0x2316c7[_0xa8df('0x38')]=_0x2316c7['attributes']['length']?_0x2316c7['attributes']:_0x14745d[_0xa8df('0x34')];if(_0x5bb6de[_0xa8df('0x36')][_0xa8df('0x4c')]){_0x2316c7[_0xa8df('0x48')]=[{'all':!![]}];}_0x2316c7=_['merge']({},_0x2316c7,_0x5bb6de[_0xa8df('0x46')]);return db[_0xa8df('0x32')]['find'](_0x2316c7)[_0xa8df('0x2f')](handleEntityNotFound(_0x44e621,null))[_0xa8df('0x2f')](respondWithResult(_0x44e621,null))['catch'](handleError(_0x44e621,null));};exports[_0xa8df('0x4d')]=function(_0x326d6f,_0xb6349f){return db[_0xa8df('0x32')][_0xa8df('0x4d')](_0x326d6f[_0xa8df('0x4e')],{})[_0xa8df('0x2f')](respondWithResult(_0xb6349f,0xc9))[_0xa8df('0x23')](handleError(_0xb6349f,null));};exports[_0xa8df('0x2e')]=function(_0x50ee92,_0x9aab8e){if(_0x50ee92[_0xa8df('0x4e')]['id']){delete _0x50ee92[_0xa8df('0x4e')]['id'];}return db['FreshdeskAccount'][_0xa8df('0x4f')]({'where':{'id':_0x50ee92[_0xa8df('0x4b')]['id']}})[_0xa8df('0x2f')](handleEntityNotFound(_0x9aab8e,null))[_0xa8df('0x2f')](saveUpdates(_0x50ee92['body'],null))['then'](respondWithResult(_0x9aab8e,null))['catch'](handleError(_0x9aab8e,null));};exports['destroy']=function(_0x280cf4,_0x233ef7){return db['FreshdeskAccount'][_0xa8df('0x4f')]({'where':{'id':_0x280cf4[_0xa8df('0x4b')]['id']}})[_0xa8df('0x2f')](handleEntityNotFound(_0x233ef7,null))[_0xa8df('0x2f')](removeEntity(_0x233ef7,null))[_0xa8df('0x23')](handleError(_0x233ef7,null));};exports['getConfigurations']=function(_0x42bc03,_0x364bec,_0x2b57a8){var _0x25cbf4={};var _0x497de7={};var _0x1b1c8f;var _0x368808;return db[_0xa8df('0x32')][_0xa8df('0x50')]({'where':{'id':_0x42bc03[_0xa8df('0x4b')]['id']}})[_0xa8df('0x2f')](handleEntityNotFound(_0x364bec,null))[_0xa8df('0x2f')](function(_0x1ec8c6){if(_0x1ec8c6){_0x1b1c8f=_0x1ec8c6;_0x497de7[_0xa8df('0x34')]=_[_0xa8df('0x35')](db[_0xa8df('0x51')]['rawAttributes']);_0x497de7[_0xa8df('0x36')]=_['keys'](_0x42bc03[_0xa8df('0x36')]);_0x497de7[_0xa8df('0x3e')]=_[_0xa8df('0x37')](_0x497de7[_0xa8df('0x34')],_0x497de7[_0xa8df('0x36')]);_0x25cbf4[_0xa8df('0x38')]=_[_0xa8df('0x37')](_0x497de7[_0xa8df('0x34')],qs[_0xa8df('0x39')](_0x42bc03[_0xa8df('0x36')][_0xa8df('0x39')]));_0x25cbf4['attributes']=_0x25cbf4[_0xa8df('0x38')][_0xa8df('0x3a')]?_0x25cbf4[_0xa8df('0x38')]:_0x497de7['model'];_0x25cbf4['order']=qs['sort'](_0x42bc03['query'][_0xa8df('0x3c')]);_0x25cbf4[_0xa8df('0x3d')]=qs[_0xa8df('0x3e')](_[_0xa8df('0x3f')](_0x42bc03[_0xa8df('0x36')],_0x497de7[_0xa8df('0x3e')]));if(_0x42bc03[_0xa8df('0x36')][_0xa8df('0x40')]){_0x25cbf4[_0xa8df('0x3d')]=_[_0xa8df('0x41')](_0x25cbf4[_0xa8df('0x3d')],{'$or':_[_0xa8df('0x42')](_0x25cbf4['attributes'],function(_0x943153){var _0x2551a5={};_0x2551a5[_0x943153]={'$like':'%'+_0x42bc03[_0xa8df('0x36')]['filter']+'%'};return _0x2551a5;})});}_0x25cbf4=_[_0xa8df('0x41')]({},_0x25cbf4,_0x42bc03[_0xa8df('0x46')]);return _0x1b1c8f[_0xa8df('0x52')](_0x25cbf4);}})[_0xa8df('0x2f')](function(_0x68e8d0){if(_0x68e8d0){_0x368808=_0x68e8d0['length'];if(!_0x42bc03[_0xa8df('0x36')][_0xa8df('0x53')]('nolimit')){_0x25cbf4[_0xa8df('0x29')]=qs[_0xa8df('0x29')](_0x42bc03[_0xa8df('0x36')][_0xa8df('0x29')]);_0x25cbf4['offset']=qs[_0xa8df('0x28')](_0x42bc03[_0xa8df('0x36')]['offset']);}return _0x1b1c8f[_0xa8df('0x52')](_0x25cbf4);}})[_0xa8df('0x2f')](function(_0x35c442){if(_0x35c442){return _0x35c442?{'count':_0x368808,'rows':_0x35c442}:null;}})[_0xa8df('0x2f')](respondWithResult(_0x364bec,null))[_0xa8df('0x23')](handleError(_0x364bec,null));};exports[_0xa8df('0x54')]=function(_0x298d59,_0x2d3d24,_0x4cfeda){if(_0x298d59[_0xa8df('0x4e')]['id']){delete _0x298d59[_0xa8df('0x4e')]['id'];}return db['FreshdeskAccount']['findOne']({'where':{'id':_0x298d59[_0xa8df('0x4b')]['id']}})[_0xa8df('0x2f')](handleEntityNotFound(_0x2d3d24,null))[_0xa8df('0x2f')](function(_0x3fe3b5){if(_0x3fe3b5){_0x298d59[_0xa8df('0x4e')]['AccountId']=_0x3fe3b5['id'];_0x298d59[_0xa8df('0x4e')][_0xa8df('0x55')]=integrations[_0xa8df('0x56')](_0x298d59[_0xa8df('0x4e')][_0xa8df('0x57')],_0x298d59[_0xa8df('0x4e')][_0xa8df('0x43')]);_0x298d59[_0xa8df('0x4e')][_0xa8df('0x58')]=integrations[_0xa8df('0x59')](_0x298d59[_0xa8df('0x4e')][_0xa8df('0x57')],_0x298d59[_0xa8df('0x4e')][_0xa8df('0x43')]);return db['FreshdeskConfiguration'][_0xa8df('0x4d')](_0x298d59['body'],{'include':[{'model':db['FreshdeskField'],'as':'Subjects'},{'model':db[_0xa8df('0x5a')],'as':'Descriptions'}]});}return null;})[_0xa8df('0x2f')](respondWithResult(_0x2d3d24,null))[_0xa8df('0x23')](handleError(_0x2d3d24,null));};exports['getFields']=function(_0x1675a6,_0xc80269,_0x2201fe){var _0x3946b3='';return db[_0xa8df('0x32')]['findOne']({'where':{'id':_0x1675a6[_0xa8df('0x4b')]['id']},'attributes':['id',_0xa8df('0x5b'),_0xa8df('0x5c')]})['then'](handleEntityNotFound(_0xc80269,null))[_0xa8df('0x2f')](function(_0x2e28cc){if(_0x2e28cc){_0x3946b3=_0x2e28cc['remoteUri'];var _0x5022b8=_0x3946b3[_0xa8df('0x5d')](-0x1);if(_0x5022b8==='/'){_0x3946b3=_0x3946b3[_0xa8df('0x5e')](0x0,_0x3946b3[_0xa8df('0x5f')](_0x5022b8));}return rp({'method':_0xa8df('0x60'),'uri':util[_0xa8df('0x61')]('%s/%s',_0x3946b3,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xa8df('0x61')]('Basic\x20%s',new Buffer(util[_0xa8df('0x61')](_0xa8df('0x62'),_0x2e28cc['apiKey']))[_0xa8df('0x63')](_0xa8df('0x64')))},'json':!![]});}})[_0xa8df('0x2f')](function(_0x443bd3){if(_0x443bd3){var _0x51c0d8=[_0xa8df('0x65'),_0xa8df('0x66'),_0xa8df('0x67'),'description',_0xa8df('0x25'),_0xa8df('0x68'),_0xa8df('0x69'),'source',_0xa8df('0x6a'),_0xa8df('0x69'),_0xa8df('0x6b')];_[_0xa8df('0x6c')](_0x443bd3,function(_0x3588db){return _0x51c0d8['includes'](_0x3588db[_0xa8df('0x30')])||!_0x3588db[_0xa8df('0x6d')]&&_0x3588db[_0xa8df('0x43')]!=='custom_text';});return{'count':_0x443bd3['length'],'rows':_[_0xa8df('0x42')](_0x443bd3,function(_0x48fb01){return{'id':_0x48fb01[_0xa8df('0x30')],'name':_0x48fb01[_0xa8df('0x6e')],'custom':!_0x48fb01['default'],'options':_0x48fb01[_0xa8df('0x6f')]?_[_0xa8df('0x42')](_0x48fb01[_0xa8df('0x6f')],function(_0x32e5a2){return{'name':_[_0xa8df('0x70')](_0x32e5a2),'value':_0x32e5a2};}):[]};})};}})[_0xa8df('0x2f')](respondWithResult(_0xc80269,null))[_0xa8df('0x23')](function(_0x1c99d7){var _0x31220f=_0x1675a6[_0xa8df('0x36')]['test']?0x1f4:_0x1c99d7[_0xa8df('0x71')]||0x1f4;logger[_0xa8df('0x1e')](_0xa8df('0x72'),_0xa8df('0x73'),_0x31220f,JSON[_0xa8df('0x74')](_0x1c99d7));delete _0x1c99d7[_0xa8df('0x30')];if(_0x31220f===0x191){_0x31220f=0x190;}_0xc80269[_0xa8df('0x25')](_0x31220f)[_0xa8df('0x75')](_0x1675a6[_0xa8df('0x36')][_0xa8df('0x76')]?{'message':_0xa8df('0x77'),'statusCode':_0x1c99d7[_0xa8df('0x71')]}:_0x1c99d7);});};
\ No newline at end of file
index 1a6bd21..a3766e2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x622f=['int_freshdesk_accounts','lodash','util','api','moment','bluebird','./intFreshdeskAccount.attributes','exports','FreshdeskAccount'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x622f,0x172));var _0xf622=function(_0x23fae1,_0x9a7e87){_0x23fae1=_0x23fae1-0x0;var _0x1d57f3=_0x622f[_0x23fae1];return _0x1d57f3;};'use strict';var _=require(_0xf622('0x0'));var util=require(_0xf622('0x1'));var logger=require('../../config/logger')(_0xf622('0x2'));var moment=require(_0xf622('0x3'));var BPromise=require(_0xf622('0x4'));var rp=require('request-promise');var attributes=require(_0xf622('0x5'));var integrations=require('../../components/integrations/configuration');module[_0xf622('0x6')]=function(_0x4228ea,_0x5214ae){return _0x4228ea['define'](_0xf622('0x7'),attributes,{'tableName':_0xf622('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x9000=['./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','FreshdeskAccount','lodash','util','api','moment','bluebird','request-promise'];(function(_0x32003d,_0x50ed19){var _0x4c09ee=function(_0x1da2d1){while(--_0x1da2d1){_0x32003d['push'](_0x32003d['shift']());}};_0x4c09ee(++_0x50ed19);}(_0x9000,0x19e));var _0x0900=function(_0x267484,_0x3eb131){_0x267484=_0x267484-0x0;var _0x14a356=_0x9000[_0x267484];return _0x14a356;};'use strict';var _=require(_0x0900('0x0'));var util=require(_0x0900('0x1'));var logger=require('../../config/logger')(_0x0900('0x2'));var moment=require(_0x0900('0x3'));var BPromise=require(_0x0900('0x4'));var rp=require(_0x0900('0x5'));var attributes=require(_0x0900('0x6'));var integrations=require(_0x0900('0x7'));module[_0x0900('0x8')]=function(_0x3f77e6,_0x32c996){return _0x3f77e6['define'](_0x0900('0x9'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index dfd5800..7d5a0b1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x77b8=['rpc','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetFreshdeskAccount','ShowFreshdeskAccount','find','then','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x77b8,0x135));var _0x877b=function(_0x45cf2a,_0x321b63){_0x45cf2a=_0x45cf2a-0x0;var _0x424317=_0x77b8[_0x45cf2a];return _0x424317;};'use strict';var _=require(_0x877b('0x0'));var util=require('util');var moment=require(_0x877b('0x1'));var BPromise=require('bluebird');var rs=require(_0x877b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x877b('0x3'))['db'];var utils=require(_0x877b('0x4'));var logger=require(_0x877b('0x5'))(_0x877b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x877b('0x7')][_0x877b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4696f6,_0x3090cf,_0x766ef0){return new BPromise(function(_0x186827,_0x5f4647){return client[_0x877b('0x9')](_0x4696f6,_0x766ef0)['then'](function(_0x2e1e7e){logger[_0x877b('0xa')](_0x877b('0xb'),_0x3090cf,'request\x20sent');logger[_0x877b('0xc')](_0x877b('0xd'),_0x3090cf,_0x877b('0xe'),JSON[_0x877b('0xf')](_0x2e1e7e));if(_0x2e1e7e[_0x877b('0x10')]){if(_0x2e1e7e['error'][_0x877b('0x11')]===0x1f4){logger[_0x877b('0x10')](_0x877b('0xb'),_0x3090cf,_0x2e1e7e['error'][_0x877b('0x12')]);return _0x5f4647(_0x2e1e7e[_0x877b('0x10')]['message']);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x3090cf,_0x2e1e7e[_0x877b('0x10')][_0x877b('0x12')]);return _0x186827(_0x2e1e7e[_0x877b('0x10')][_0x877b('0x12')]);}else{logger[_0x877b('0xa')](_0x877b('0xb'),_0x3090cf,_0x877b('0xe'));_0x186827(_0x2e1e7e[_0x877b('0x13')][_0x877b('0x12')]);}})[_0x877b('0x14')](function(_0x182abb){logger[_0x877b('0x10')](_0x877b('0xb'),_0x3090cf,_0x182abb);_0x5f4647(_0x182abb);});});}exports['GetFreshdeskAccount']=function(_0x5816ca){var _0x22ce71=this;return new Promise(function(_0x401356,_0x38f49c){return db[_0x877b('0x15')][_0x877b('0x16')]({'raw':_0x5816ca[_0x877b('0x17')]?_0x5816ca[_0x877b('0x17')][_0x877b('0x18')]===undefined?!![]:![]:!![],'where':_0x5816ca[_0x877b('0x17')]?_0x5816ca['options'][_0x877b('0x19')]||null:null,'attributes':_0x5816ca[_0x877b('0x17')]?_0x5816ca['options'][_0x877b('0x1a')]||null:null,'limit':_0x5816ca[_0x877b('0x17')]?_0x5816ca[_0x877b('0x17')][_0x877b('0x1b')]||null:null,'include':_0x5816ca[_0x877b('0x17')]?_0x5816ca[_0x877b('0x17')][_0x877b('0x1c')]?_[_0x877b('0x1d')](_0x5816ca['options'][_0x877b('0x1c')],function(_0xf07a66){return{'model':db[_0xf07a66[_0x877b('0x1e')]],'as':_0xf07a66['as'],'attributes':_0xf07a66[_0x877b('0x1a')],'include':_0xf07a66[_0x877b('0x1c')]?_['map'](_0xf07a66[_0x877b('0x1c')],function(_0x5af658){return{'model':db[_0x5af658[_0x877b('0x1e')]],'as':_0x5af658['as'],'attributes':_0x5af658[_0x877b('0x1a')],'include':_0x5af658['include']?_[_0x877b('0x1d')](_0x5af658[_0x877b('0x1c')],function(_0x3c00f4){return{'model':db[_0x3c00f4['model']],'as':_0x3c00f4['as'],'attributes':_0x3c00f4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xcbaeca){logger[_0x877b('0xa')](_0x877b('0x1f'),_0x5816ca);logger[_0x877b('0xc')]('GetFreshdeskAccount',_0x5816ca,JSON[_0x877b('0xf')](_0xcbaeca));_0x401356(_0xcbaeca);})['catch'](function(_0x5610ad){logger[_0x877b('0x10')](_0x877b('0x1f'),_0x5610ad[_0x877b('0x12')],_0x5816ca);_0x38f49c(_0x22ce71[_0x877b('0x10')](0x1f4,_0x5610ad[_0x877b('0x12')]));});});};exports[_0x877b('0x20')]=function(_0x56a929){var _0x4416c6=this;return new Promise(function(_0x37a510,_0x1ecc28){return db[_0x877b('0x15')][_0x877b('0x21')]({'raw':_0x56a929[_0x877b('0x17')]?_0x56a929['options'][_0x877b('0x18')]===undefined?!![]:![]:!![],'where':_0x56a929[_0x877b('0x17')]?_0x56a929['options'][_0x877b('0x19')]||null:null,'attributes':_0x56a929[_0x877b('0x17')]?_0x56a929[_0x877b('0x17')][_0x877b('0x1a')]||null:null,'include':_0x56a929[_0x877b('0x17')]?_0x56a929[_0x877b('0x17')]['include']?_['map'](_0x56a929[_0x877b('0x17')][_0x877b('0x1c')],function(_0x2247a0){return{'model':db[_0x2247a0[_0x877b('0x1e')]],'as':_0x2247a0['as'],'attributes':_0x2247a0[_0x877b('0x1a')],'include':_0x2247a0[_0x877b('0x1c')]?_[_0x877b('0x1d')](_0x2247a0[_0x877b('0x1c')],function(_0x267102){return{'model':db[_0x267102['model']],'as':_0x267102['as'],'attributes':_0x267102[_0x877b('0x1a')],'include':_0x267102[_0x877b('0x1c')]?_[_0x877b('0x1d')](_0x267102[_0x877b('0x1c')],function(_0x43e883){return{'model':db[_0x43e883[_0x877b('0x1e')]],'as':_0x43e883['as'],'attributes':_0x43e883[_0x877b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x877b('0x22')](function(_0x82bfbc){logger['info'](_0x877b('0x20'),_0x56a929);logger['debug'](_0x877b('0x20'),_0x56a929,JSON[_0x877b('0xf')](_0x82bfbc));_0x37a510(_0x82bfbc);})[_0x877b('0x14')](function(_0x1b17e4){logger['error'](_0x877b('0x20'),_0x1b17e4[_0x877b('0x12')],_0x56a929);_0x1ecc28(_0x4416c6[_0x877b('0x10')](0x1f4,_0x1b17e4['message']));});});};
\ No newline at end of file
+var _0x4469=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','attributes','limit','include','model','map','ShowFreshdeskAccount','find','raw','lodash','moment','bluebird','randomstring'];(function(_0x4c8d35,_0x4c45e2){var _0x5192c7=function(_0x2ef9cc){while(--_0x2ef9cc){_0x4c8d35['push'](_0x4c8d35['shift']());}};_0x5192c7(++_0x4c45e2);}(_0x4469,0xf8));var _0x9446=function(_0x451c52,_0x569d91){_0x451c52=_0x451c52-0x0;var _0x1c208a=_0x4469[_0x451c52];return _0x1c208a;};'use strict';var _=require(_0x9446('0x0'));var util=require('util');var moment=require(_0x9446('0x1'));var BPromise=require(_0x9446('0x2'));var rs=require(_0x9446('0x3'));var fs=require('fs');var Redis=require(_0x9446('0x4'));var db=require(_0x9446('0x5'))['db'];var utils=require(_0x9446('0x6'));var logger=require(_0x9446('0x7'))('rpc');var config=require(_0x9446('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9446('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13aebd,_0x28f960,_0x561eb4){return new BPromise(function(_0x521b92,_0x1e6f4b){return client[_0x9446('0xa')](_0x13aebd,_0x561eb4)[_0x9446('0xb')](function(_0x155e7b){logger[_0x9446('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x28f960,'request\x20sent');logger[_0x9446('0xd')](_0x9446('0xe'),_0x28f960,_0x9446('0xf'),JSON[_0x9446('0x10')](_0x155e7b));if(_0x155e7b[_0x9446('0x11')]){if(_0x155e7b[_0x9446('0x11')][_0x9446('0x12')]===0x1f4){logger[_0x9446('0x11')](_0x9446('0x13'),_0x28f960,_0x155e7b[_0x9446('0x11')]['message']);return _0x1e6f4b(_0x155e7b[_0x9446('0x11')][_0x9446('0x14')]);}logger[_0x9446('0x11')](_0x9446('0x13'),_0x28f960,_0x155e7b[_0x9446('0x11')]['message']);return _0x521b92(_0x155e7b[_0x9446('0x11')]['message']);}else{logger[_0x9446('0xc')](_0x9446('0x13'),_0x28f960,_0x9446('0xf'));_0x521b92(_0x155e7b[_0x9446('0x15')][_0x9446('0x14')]);}})[_0x9446('0x16')](function(_0x1ffe52){logger[_0x9446('0x11')](_0x9446('0x13'),_0x28f960,_0x1ffe52);_0x1e6f4b(_0x1ffe52);});});}exports[_0x9446('0x17')]=function(_0x34e5b5){var _0x2f966c=this;return new Promise(function(_0x56a7ff,_0x2185c6){return db[_0x9446('0x18')][_0x9446('0x19')]({'raw':_0x34e5b5[_0x9446('0x1a')]?_0x34e5b5['options']['raw']===undefined?!![]:![]:!![],'where':_0x34e5b5[_0x9446('0x1a')]?_0x34e5b5[_0x9446('0x1a')][_0x9446('0x1b')]||null:null,'attributes':_0x34e5b5['options']?_0x34e5b5[_0x9446('0x1a')][_0x9446('0x1c')]||null:null,'limit':_0x34e5b5[_0x9446('0x1a')]?_0x34e5b5['options'][_0x9446('0x1d')]||null:null,'include':_0x34e5b5[_0x9446('0x1a')]?_0x34e5b5[_0x9446('0x1a')][_0x9446('0x1e')]?_['map'](_0x34e5b5[_0x9446('0x1a')]['include'],function(_0x18d6d4){return{'model':db[_0x18d6d4[_0x9446('0x1f')]],'as':_0x18d6d4['as'],'attributes':_0x18d6d4[_0x9446('0x1c')],'include':_0x18d6d4[_0x9446('0x1e')]?_[_0x9446('0x20')](_0x18d6d4[_0x9446('0x1e')],function(_0x1fd4eb){return{'model':db[_0x1fd4eb[_0x9446('0x1f')]],'as':_0x1fd4eb['as'],'attributes':_0x1fd4eb[_0x9446('0x1c')],'include':_0x1fd4eb[_0x9446('0x1e')]?_[_0x9446('0x20')](_0x1fd4eb['include'],function(_0x26f1dc){return{'model':db[_0x26f1dc[_0x9446('0x1f')]],'as':_0x26f1dc['as'],'attributes':_0x26f1dc[_0x9446('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9446('0xb')](function(_0x482ac0){logger[_0x9446('0xc')]('GetFreshdeskAccount',_0x34e5b5);logger[_0x9446('0xd')]('GetFreshdeskAccount',_0x34e5b5,JSON['stringify'](_0x482ac0));_0x56a7ff(_0x482ac0);})['catch'](function(_0x158fb1){logger[_0x9446('0x11')](_0x9446('0x17'),_0x158fb1[_0x9446('0x14')],_0x34e5b5);_0x2185c6(_0x2f966c[_0x9446('0x11')](0x1f4,_0x158fb1['message']));});});};exports[_0x9446('0x21')]=function(_0x47ac17){var _0x120b3a=this;return new Promise(function(_0x2373ec,_0x20ef40){return db[_0x9446('0x18')][_0x9446('0x22')]({'raw':_0x47ac17[_0x9446('0x1a')]?_0x47ac17[_0x9446('0x1a')][_0x9446('0x23')]===undefined?!![]:![]:!![],'where':_0x47ac17[_0x9446('0x1a')]?_0x47ac17[_0x9446('0x1a')]['where']||null:null,'attributes':_0x47ac17[_0x9446('0x1a')]?_0x47ac17[_0x9446('0x1a')]['attributes']||null:null,'include':_0x47ac17['options']?_0x47ac17[_0x9446('0x1a')]['include']?_[_0x9446('0x20')](_0x47ac17[_0x9446('0x1a')][_0x9446('0x1e')],function(_0x84f45a){return{'model':db[_0x84f45a[_0x9446('0x1f')]],'as':_0x84f45a['as'],'attributes':_0x84f45a[_0x9446('0x1c')],'include':_0x84f45a[_0x9446('0x1e')]?_['map'](_0x84f45a['include'],function(_0x1472ec){return{'model':db[_0x1472ec['model']],'as':_0x1472ec['as'],'attributes':_0x1472ec[_0x9446('0x1c')],'include':_0x1472ec[_0x9446('0x1e')]?_['map'](_0x1472ec[_0x9446('0x1e')],function(_0x3daeff){return{'model':db[_0x3daeff[_0x9446('0x1f')]],'as':_0x3daeff['as'],'attributes':_0x3daeff[_0x9446('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x15273e){logger[_0x9446('0xc')](_0x9446('0x21'),_0x47ac17);logger['debug'](_0x9446('0x21'),_0x47ac17,JSON[_0x9446('0x10')](_0x15273e));_0x2373ec(_0x15273e);})[_0x9446('0x16')](function(_0x2552f2){logger[_0x9446('0x11')](_0x9446('0x21'),_0x2552f2[_0x9446('0x14')],_0x47ac17);_0x20ef40(_0x120b3a[_0x9446('0x11')](0x1f4,_0x2552f2['message']));});});};
\ No newline at end of file
index 0084ef3..135727a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc3b5=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','setTags','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','/:id','show','get','getFields'];(function(_0x1ab137,_0x14ea94){var _0x201a85=function(_0x244ee3){while(--_0x244ee3){_0x1ab137['push'](_0x1ab137['shift']());}};_0x201a85(++_0x14ea94);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x2ffebf,_0x4d758b){_0x2ffebf=_0x2ffebf-0x0;var _0x578388=_0xc3b5[_0x2ffebf];return _0x578388;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5c3b('0x0'));var timeout=require(_0x5c3b('0x1'));var express=require(_0x5c3b('0x2'));var router=express[_0x5c3b('0x3')]();var auth=require(_0x5c3b('0x4'));var interaction=require(_0x5c3b('0x5'));var config=require(_0x5c3b('0x6'));var controller=require(_0x5c3b('0x7'));router['get']('/',auth[_0x5c3b('0x8')](),controller[_0x5c3b('0x9')]);router['get'](_0x5c3b('0xa'),auth[_0x5c3b('0x8')](),controller[_0x5c3b('0xb')]);router[_0x5c3b('0xc')]('/:id/fields',auth[_0x5c3b('0x8')](),controller[_0x5c3b('0xd')]);router[_0x5c3b('0xc')](_0x5c3b('0xe'),auth['isAuthenticated'](),controller[_0x5c3b('0xf')]);router[_0x5c3b('0xc')](_0x5c3b('0x10'),auth[_0x5c3b('0x8')](),controller[_0x5c3b('0x11')]);router['get'](_0x5c3b('0x12'),auth[_0x5c3b('0x8')](),controller['getTags']);router[_0x5c3b('0x13')]('/',auth[_0x5c3b('0x8')](),controller['create']);router[_0x5c3b('0x13')](_0x5c3b('0x12'),auth[_0x5c3b('0x8')](),controller[_0x5c3b('0x14')]);router[_0x5c3b('0x15')](_0x5c3b('0xa'),auth[_0x5c3b('0x8')](),controller['update']);router[_0x5c3b('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x5c3b('0x17')]);module[_0x5c3b('0x18')]=router;
\ No newline at end of file
+var _0x44e8=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','post','setTags','put','update','delete','destroy','exports','multer'];(function(_0x6f1918,_0x4afea8){var _0xff946b=function(_0x2c4f80){while(--_0x2c4f80){_0x6f1918['push'](_0x6f1918['shift']());}};_0xff946b(++_0x4afea8);}(_0x44e8,0xd7));var _0x844e=function(_0x57892e,_0xffb908){_0x57892e=_0x57892e-0x0;var _0x230268=_0x44e8[_0x57892e];return _0x230268;};'use strict';var multer=require(_0x844e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x844e('0x1'));var express=require(_0x844e('0x2'));var router=express[_0x844e('0x3')]();var auth=require(_0x844e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x844e('0x5'));var controller=require(_0x844e('0x6'));router[_0x844e('0x7')]('/',auth[_0x844e('0x8')](),controller['index']);router[_0x844e('0x7')](_0x844e('0x9'),auth[_0x844e('0x8')](),controller[_0x844e('0xa')]);router['get'](_0x844e('0xb'),auth[_0x844e('0x8')](),controller[_0x844e('0xc')]);router[_0x844e('0x7')](_0x844e('0xd'),auth[_0x844e('0x8')](),controller['getSubjects']);router[_0x844e('0x7')](_0x844e('0xe'),auth[_0x844e('0x8')](),controller[_0x844e('0xf')]);router[_0x844e('0x7')](_0x844e('0x10'),auth[_0x844e('0x8')](),controller['getTags']);router[_0x844e('0x11')]('/',auth[_0x844e('0x8')](),controller['create']);router[_0x844e('0x11')](_0x844e('0x10'),auth['isAuthenticated'](),controller[_0x844e('0x12')]);router[_0x844e('0x13')](_0x844e('0x9'),auth['isAuthenticated'](),controller[_0x844e('0x14')]);router[_0x844e('0x15')](_0x844e('0x9'),auth[_0x844e('0x8')](),controller[_0x844e('0x16')]);module[_0x844e('0x17')]=router;
\ No newline at end of file
index 2d3e176..f640df6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x122e=['STRING','sequelize','exports'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x122e,0x9d));var _0xe122=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x122e[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xe122('0x0'));module[_0xe122('0x1')]={'name':{'type':Sequelize[_0xe122('0x2')]},'description':{'type':Sequelize[_0xe122('0x2')]}};
\ No newline at end of file
+var _0x1883=['STRING','sequelize','exports'];(function(_0x2657fa,_0x12be80){var _0x1962b7=function(_0xcccd5a){while(--_0xcccd5a){_0x2657fa['push'](_0x2657fa['shift']());}};_0x1962b7(++_0x12be80);}(_0x1883,0x19f));var _0x3188=function(_0x3d30a7,_0x27127d){_0x3d30a7=_0x3d30a7-0x0;var _0x4d433e=_0x1883[_0x3d30a7];return _0x4d433e;};'use strict';var Sequelize=require(_0x3188('0x0'));module[_0x3188('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3188('0x2')]}};
\ No newline at end of file
index e59c6b5..6d7d92e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x319b=['findOne','FreshdeskField','getSubjects','getDescriptions','getTags','setTags','ids','zip-dir','moment','bluebird','mustache','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','catch','status','end','count','offset','limit','set','json','apply','reject','update','destroy','stack','name','index','FreshdeskConfiguration','rawAttributes','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','type','key','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','body','getFields'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x319b,0xb3));var _0xb319=function(_0x285633,_0x4c9897){_0x285633=_0x285633-0x0;var _0x4f03a7=_0x319b[_0x285633];return _0x4f03a7;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb319('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb319('0x1'));var BPromise=require(_0xb319('0x2'));var Mustache=require(_0xb319('0x3'));var util=require('util');var path=require(_0xb319('0x4'));var sox=require(_0xb319('0x5'));var csv=require('to-csv');var ejs=require(_0xb319('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb319('0x7'));var crypto=require(_0xb319('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xb319('0x9'));var toCsv=require(_0xb319('0xa'));var querystring=require(_0xb319('0xb'));var Papa=require('papaparse');var authService=require(_0xb319('0xc'));var hardwareService=require(_0xb319('0xd'));var Redis=require(_0xb319('0xe'));var qs=require(_0xb319('0xf'));var logger=require(_0xb319('0x10'))(_0xb319('0x11'));var utils=require('../../config/utils');var config=require(_0xb319('0x12'));var db=require('../../mysqldb')['db'];var jayson=require(_0xb319('0x13'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xdc8045,_0x28d0f0,_0x166e16,_0x24ec16){return new BPromise(function(_0x4d8510,_0x3fffe4){var _0x7f9e9f=_0x24ec16||client;return _0x7f9e9f[_0xb319('0x14')](_0xdc8045,_0x166e16)[_0xb319('0x15')](function(_0x14c89e){logger[_0xb319('0x16')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x28d0f0,_0xb319('0x17'));logger[_0xb319('0x18')](_0xb319('0x19'),_0x28d0f0,_0xb319('0x17'),JSON[_0xb319('0x1a')](_0x14c89e));if(_0x14c89e[_0xb319('0x1b')]){if(_0x14c89e[_0xb319('0x1b')][_0xb319('0x1c')]===0x1f4){logger[_0xb319('0x1b')](_0xb319('0x1d'),_0x28d0f0,_0x14c89e[_0xb319('0x1b')][_0xb319('0x1e')]);return _0x3fffe4(_0x14c89e['error'][_0xb319('0x1e')]);}logger[_0xb319('0x1b')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x28d0f0,_0x14c89e[_0xb319('0x1b')][_0xb319('0x1e')]);return _0x4d8510(_0x14c89e[_0xb319('0x1b')][_0xb319('0x1e')]);}else{logger[_0xb319('0x16')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x28d0f0,'request\x20sent');_0x4d8510(_0x14c89e['result'][_0xb319('0x1e')]);}})[_0xb319('0x1f')](function(_0x54be33){logger[_0xb319('0x1b')](_0xb319('0x1d'),_0x28d0f0,_0x54be33);_0x3fffe4(_0x54be33);});});}function respondWithStatusCode(_0x53be21,_0x28f8b4){_0x28f8b4=_0x28f8b4||0xcc;return function(_0x4cf158){if(_0x4cf158){return _0x53be21['sendStatus'](_0x28f8b4);}return _0x53be21[_0xb319('0x20')](_0x28f8b4)[_0xb319('0x21')]();};}function respondWithResult(_0x523780,_0x584db6){_0x584db6=_0x584db6||0xc8;return function(_0x482ef4){if(_0x482ef4){return _0x523780[_0xb319('0x20')](_0x584db6)['json'](_0x482ef4);}};}function respondWithFilteredResult(_0x3540f2,_0x1940b7){return function(_0x54f60b){if(_0x54f60b){var _0x27cf80=_0x54f60b[_0xb319('0x22')],_0xee2360=_0x1940b7[_0xb319('0x23')],_0x175c6f=_0x1940b7[_0xb319('0x23')]+_0x1940b7[_0xb319('0x24')],_0x495860;if(_0x175c6f>=_0x27cf80){_0x175c6f=_0x27cf80;_0x495860=0xc8;}else{_0x495860=0xce;}_0x3540f2['status'](_0x495860);return _0x3540f2[_0xb319('0x25')]('Content-Range',_0xee2360+'-'+_0x175c6f+'/'+_0x27cf80)[_0xb319('0x26')](_0x54f60b);}return null;};}function patchUpdates(_0x482520){return function(_0x6d3497){try{jsonpatch[_0xb319('0x27')](_0x6d3497,_0x482520,!![]);}catch(_0x4c3bf5){return BPromise[_0xb319('0x28')](_0x4c3bf5);}return _0x6d3497['save']();};}function saveUpdates(_0x254347,_0x210970){return function(_0x95e9cf){if(_0x95e9cf){return _0x95e9cf[_0xb319('0x29')](_0x254347)['then'](function(_0x51e5c3){return _0x51e5c3;});}return null;};}function removeEntity(_0x519306,_0x120331){return function(_0x7f89a1){if(_0x7f89a1){return _0x7f89a1[_0xb319('0x2a')]()[_0xb319('0x15')](function(){_0x519306[_0xb319('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16baa3,_0x4ab860){return function(_0x2fcd61){if(!_0x2fcd61){_0x16baa3['sendStatus'](0x194);}return _0x2fcd61;};}function handleError(_0x59a4c7,_0x5448a5){_0x5448a5=_0x5448a5||0x1f4;return function(_0xfa3e03){logger[_0xb319('0x1b')](_0xfa3e03[_0xb319('0x2b')]);if(_0xfa3e03['name']){delete _0xfa3e03[_0xb319('0x2c')];}_0x59a4c7[_0xb319('0x20')](_0x5448a5)['send'](_0xfa3e03);};}exports[_0xb319('0x2d')]=function(_0x104792,_0x4e6c46){var _0x53355b={},_0x3e0e28={},_0x585b61={'count':0x0,'rows':[]};var _0x3bd433=db[_0xb319('0x2e')][_0xb319('0x2f')];_0x3e0e28[_0xb319('0x30')]=_[_0xb319('0x31')](_0x3bd433);_0x3e0e28[_0xb319('0x32')]=_[_0xb319('0x31')](_0x104792[_0xb319('0x32')]);_0x3e0e28['filters']=_[_0xb319('0x33')](_0x3e0e28[_0xb319('0x30')],_0x3e0e28['query']);_0x53355b['attributes']=_[_0xb319('0x33')](_0x3e0e28[_0xb319('0x30')],qs['fields'](_0x104792[_0xb319('0x32')][_0xb319('0x34')]));_0x53355b['attributes']=_0x53355b[_0xb319('0x35')][_0xb319('0x36')]?_0x53355b['attributes']:_0x3e0e28[_0xb319('0x30')];if(!_0x104792[_0xb319('0x32')][_0xb319('0x37')](_0xb319('0x38'))){_0x53355b[_0xb319('0x24')]=qs['limit'](_0x104792[_0xb319('0x32')]['limit']);_0x53355b['offset']=qs[_0xb319('0x23')](_0x104792[_0xb319('0x32')][_0xb319('0x23')]);}_0x53355b[_0xb319('0x39')]=qs[_0xb319('0x3a')](_0x104792[_0xb319('0x32')]['sort']);_0x53355b[_0xb319('0x3b')]=qs[_0xb319('0x3c')](_[_0xb319('0x3d')](_0x104792[_0xb319('0x32')],_0x3e0e28[_0xb319('0x3c')]));if(_0x104792['query'][_0xb319('0x3e')]){_0x53355b[_0xb319('0x3b')]=_[_0xb319('0x3f')](_0x53355b[_0xb319('0x3b')],{'$or':_[_0xb319('0x40')](_0x3bd433,function(_0x3878fa){if(_0x3878fa[_0xb319('0x41')][_0xb319('0x42')]!==_0xb319('0x43')){var _0x278bb4={};_0x278bb4[_0x3878fa['field']]={'$like':'%'+_0x104792[_0xb319('0x32')][_0xb319('0x3e')]+'%'};return _0x278bb4;}})});}_0x53355b=_[_0xb319('0x3f')]({},_0x53355b,_0x104792['options']);var _0x14c0bf={'where':_0x53355b[_0xb319('0x3b')]};return db['FreshdeskConfiguration'][_0xb319('0x22')](_0x14c0bf)['then'](function(_0x1798c4){_0x585b61[_0xb319('0x22')]=_0x1798c4;if(_0x104792[_0xb319('0x32')][_0xb319('0x44')]){_0x53355b[_0xb319('0x45')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xb319('0x46')](_0x53355b);})[_0xb319('0x15')](function(_0x59e9ea){_0x585b61[_0xb319('0x47')]=_0x59e9ea;return _0x585b61;})[_0xb319('0x15')](respondWithFilteredResult(_0x4e6c46,_0x53355b))[_0xb319('0x1f')](handleError(_0x4e6c46,null));};exports[_0xb319('0x48')]=function(_0x4c28ed,_0x2902e3){var _0x35ba3a={'raw':![],'where':{'id':_0x4c28ed[_0xb319('0x49')]['id']}},_0x532582={};_0x532582[_0xb319('0x30')]=_[_0xb319('0x31')](db[_0xb319('0x2e')][_0xb319('0x2f')]);_0x532582[_0xb319('0x32')]=_[_0xb319('0x31')](_0x4c28ed[_0xb319('0x32')]);_0x532582[_0xb319('0x3c')]=_['intersection'](_0x532582['model'],_0x532582[_0xb319('0x32')]);_0x35ba3a[_0xb319('0x35')]=_[_0xb319('0x33')](_0x532582[_0xb319('0x30')],qs['fields'](_0x4c28ed['query']['fields']));_0x35ba3a[_0xb319('0x35')]=_0x35ba3a['attributes'][_0xb319('0x36')]?_0x35ba3a[_0xb319('0x35')]:_0x532582[_0xb319('0x30')];if(_0x4c28ed[_0xb319('0x32')]['includeAll']){_0x35ba3a['include']=[{'all':!![]}];}_0x35ba3a=_[_0xb319('0x3f')]({},_0x35ba3a,_0x4c28ed[_0xb319('0x4a')]);return db[_0xb319('0x2e')][_0xb319('0x4b')](_0x35ba3a)[_0xb319('0x15')](handleEntityNotFound(_0x2902e3,null))[_0xb319('0x15')](respondWithResult(_0x2902e3,null))[_0xb319('0x1f')](handleError(_0x2902e3,null));};exports[_0xb319('0x4c')]=function(_0x3991d7,_0x3a94c4){return db[_0xb319('0x2e')][_0xb319('0x4c')](_0x3991d7['body'],{})[_0xb319('0x15')](respondWithResult(_0x3a94c4,0xc9))[_0xb319('0x1f')](handleError(_0x3a94c4,null));};exports[_0xb319('0x29')]=function(_0x23bb15,_0x5060d2){if(_0x23bb15[_0xb319('0x4d')]['id']){delete _0x23bb15[_0xb319('0x4d')]['id'];}return db[_0xb319('0x2e')]['find']({'where':{'id':_0x23bb15[_0xb319('0x49')]['id']}})[_0xb319('0x15')](handleEntityNotFound(_0x5060d2,null))[_0xb319('0x15')](saveUpdates(_0x23bb15[_0xb319('0x4d')],null))[_0xb319('0x15')](respondWithResult(_0x5060d2,null))[_0xb319('0x1f')](handleError(_0x5060d2,null));};exports[_0xb319('0x2a')]=function(_0x464a00,_0x2a21c9){return db['FreshdeskConfiguration'][_0xb319('0x4b')]({'where':{'id':_0x464a00['params']['id']}})['then'](handleEntityNotFound(_0x2a21c9,null))['then'](removeEntity(_0x2a21c9,null))['catch'](handleError(_0x2a21c9,null));};exports[_0xb319('0x4e')]=function(_0x2a1403,_0x573ee5,_0x165a7e){var _0x18089f={};var _0x388a2c={};var _0x5ae990;var _0x969409;return db[_0xb319('0x2e')][_0xb319('0x4f')]({'where':{'id':_0x2a1403[_0xb319('0x49')]['id']}})[_0xb319('0x15')](handleEntityNotFound(_0x573ee5,null))[_0xb319('0x15')](function(_0x10fc95){if(_0x10fc95){_0x5ae990=_0x10fc95;_0x388a2c['model']=_[_0xb319('0x31')](db[_0xb319('0x50')][_0xb319('0x2f')]);_0x388a2c[_0xb319('0x32')]=_[_0xb319('0x31')](_0x2a1403[_0xb319('0x32')]);_0x388a2c[_0xb319('0x3c')]=_[_0xb319('0x33')](_0x388a2c['model'],_0x388a2c[_0xb319('0x32')]);_0x18089f['attributes']=_[_0xb319('0x33')](_0x388a2c[_0xb319('0x30')],qs[_0xb319('0x34')](_0x2a1403[_0xb319('0x32')]['fields']));_0x18089f[_0xb319('0x35')]=_0x18089f[_0xb319('0x35')][_0xb319('0x36')]?_0x18089f[_0xb319('0x35')]:_0x388a2c['model'];_0x18089f['order']=qs[_0xb319('0x3a')](_0x2a1403[_0xb319('0x32')]['sort']);_0x18089f['where']=qs[_0xb319('0x3c')](_['pick'](_0x2a1403[_0xb319('0x32')],_0x388a2c[_0xb319('0x3c')]));if(_0x2a1403[_0xb319('0x32')][_0xb319('0x3e')]){_0x18089f['where']=_[_0xb319('0x3f')](_0x18089f[_0xb319('0x3b')],{'$or':_[_0xb319('0x40')](_0x18089f[_0xb319('0x35')],function(_0x2fa5f5){var _0x53339b={};_0x53339b[_0x2fa5f5]={'$like':'%'+_0x2a1403['query']['filter']+'%'};return _0x53339b;})});}_0x18089f=_['merge']({},_0x18089f,_0x2a1403['options']);return _0x5ae990[_0xb319('0x4e')](_0x18089f);}})[_0xb319('0x15')](function(_0x2fdcd8){if(_0x2fdcd8){_0x969409=_0x2fdcd8[_0xb319('0x36')];if(!_0x2a1403[_0xb319('0x32')][_0xb319('0x37')](_0xb319('0x38'))){_0x18089f[_0xb319('0x24')]=qs[_0xb319('0x24')](_0x2a1403['query']['limit']);_0x18089f[_0xb319('0x23')]=qs[_0xb319('0x23')](_0x2a1403[_0xb319('0x32')][_0xb319('0x23')]);}return _0x5ae990[_0xb319('0x4e')](_0x18089f);}})['then'](function(_0x12efcd){if(_0x12efcd){return _0x12efcd?{'count':_0x969409,'rows':_0x12efcd}:null;}})[_0xb319('0x15')](respondWithResult(_0x573ee5,null))[_0xb319('0x1f')](handleError(_0x573ee5,null));};exports[_0xb319('0x51')]=function(_0x4d8f66,_0xddc3fe,_0x3d2fd3){var _0x8a1789={};var _0x45fab6={};var _0x299c07;var _0x32514d;return db['FreshdeskConfiguration'][_0xb319('0x4f')]({'where':{'id':_0x4d8f66['params']['id']}})[_0xb319('0x15')](handleEntityNotFound(_0xddc3fe,null))[_0xb319('0x15')](function(_0x46e664){if(_0x46e664){_0x299c07=_0x46e664;_0x45fab6['model']=_[_0xb319('0x31')](db[_0xb319('0x50')][_0xb319('0x2f')]);_0x45fab6[_0xb319('0x32')]=_[_0xb319('0x31')](_0x4d8f66[_0xb319('0x32')]);_0x45fab6['filters']=_[_0xb319('0x33')](_0x45fab6[_0xb319('0x30')],_0x45fab6[_0xb319('0x32')]);_0x8a1789[_0xb319('0x35')]=_[_0xb319('0x33')](_0x45fab6['model'],qs[_0xb319('0x34')](_0x4d8f66[_0xb319('0x32')][_0xb319('0x34')]));_0x8a1789[_0xb319('0x35')]=_0x8a1789[_0xb319('0x35')][_0xb319('0x36')]?_0x8a1789[_0xb319('0x35')]:_0x45fab6['model'];_0x8a1789[_0xb319('0x39')]=qs['sort'](_0x4d8f66[_0xb319('0x32')]['sort']);_0x8a1789[_0xb319('0x3b')]=qs[_0xb319('0x3c')](_[_0xb319('0x3d')](_0x4d8f66[_0xb319('0x32')],_0x45fab6['filters']));if(_0x4d8f66[_0xb319('0x32')]['filter']){_0x8a1789[_0xb319('0x3b')]=_['merge'](_0x8a1789[_0xb319('0x3b')],{'$or':_[_0xb319('0x40')](_0x8a1789[_0xb319('0x35')],function(_0x12627c){var _0x5dfef2={};_0x5dfef2[_0x12627c]={'$like':'%'+_0x4d8f66[_0xb319('0x32')]['filter']+'%'};return _0x5dfef2;})});}_0x8a1789=_[_0xb319('0x3f')]({},_0x8a1789,_0x4d8f66['options']);return _0x299c07[_0xb319('0x51')](_0x8a1789);}})[_0xb319('0x15')](function(_0x54d19c){if(_0x54d19c){_0x32514d=_0x54d19c[_0xb319('0x36')];if(!_0x4d8f66['query'][_0xb319('0x37')](_0xb319('0x38'))){_0x8a1789[_0xb319('0x24')]=qs[_0xb319('0x24')](_0x4d8f66[_0xb319('0x32')]['limit']);_0x8a1789['offset']=qs[_0xb319('0x23')](_0x4d8f66[_0xb319('0x32')][_0xb319('0x23')]);}return _0x299c07[_0xb319('0x51')](_0x8a1789);}})[_0xb319('0x15')](function(_0x20982d){if(_0x20982d){return _0x20982d?{'count':_0x32514d,'rows':_0x20982d}:null;}})[_0xb319('0x15')](respondWithResult(_0xddc3fe,null))[_0xb319('0x1f')](handleError(_0xddc3fe,null));};exports[_0xb319('0x52')]=function(_0x3b398c,_0x59e0de,_0x1c7182){var _0x29f2eb={};var _0x52499f={};var _0x145654;var _0x833d91;return db[_0xb319('0x2e')][_0xb319('0x4f')]({'where':{'id':_0x3b398c[_0xb319('0x49')]['id']}})[_0xb319('0x15')](handleEntityNotFound(_0x59e0de,null))[_0xb319('0x15')](function(_0x38dade){if(_0x38dade){_0x145654=_0x38dade;_0x52499f[_0xb319('0x30')]=_[_0xb319('0x31')](db[_0xb319('0x50')][_0xb319('0x2f')]);_0x52499f[_0xb319('0x32')]=_[_0xb319('0x31')](_0x3b398c['query']);_0x52499f[_0xb319('0x3c')]=_[_0xb319('0x33')](_0x52499f[_0xb319('0x30')],_0x52499f[_0xb319('0x32')]);_0x29f2eb[_0xb319('0x35')]=_[_0xb319('0x33')](_0x52499f[_0xb319('0x30')],qs[_0xb319('0x34')](_0x3b398c[_0xb319('0x32')][_0xb319('0x34')]));_0x29f2eb[_0xb319('0x35')]=_0x29f2eb[_0xb319('0x35')][_0xb319('0x36')]?_0x29f2eb[_0xb319('0x35')]:_0x52499f['model'];_0x29f2eb[_0xb319('0x39')]=qs[_0xb319('0x3a')](_0x3b398c[_0xb319('0x32')][_0xb319('0x3a')]);_0x29f2eb[_0xb319('0x3b')]=qs[_0xb319('0x3c')](_[_0xb319('0x3d')](_0x3b398c[_0xb319('0x32')],_0x52499f[_0xb319('0x3c')]));if(_0x3b398c['query']['filter']){_0x29f2eb[_0xb319('0x3b')]=_[_0xb319('0x3f')](_0x29f2eb[_0xb319('0x3b')],{'$or':_[_0xb319('0x40')](_0x29f2eb[_0xb319('0x35')],function(_0x1906ae){var _0x593d1a={};_0x593d1a[_0x1906ae]={'$like':'%'+_0x3b398c['query'][_0xb319('0x3e')]+'%'};return _0x593d1a;})});}_0x29f2eb=_[_0xb319('0x3f')]({},_0x29f2eb,_0x3b398c[_0xb319('0x4a')]);return _0x145654[_0xb319('0x52')](_0x29f2eb);}})[_0xb319('0x15')](function(_0xf7c787){if(_0xf7c787){_0x833d91=_0xf7c787[_0xb319('0x36')];if(!_0x3b398c['query'][_0xb319('0x37')](_0xb319('0x38'))){_0x29f2eb[_0xb319('0x24')]=qs[_0xb319('0x24')](_0x3b398c[_0xb319('0x32')][_0xb319('0x24')]);_0x29f2eb['offset']=qs['offset'](_0x3b398c[_0xb319('0x32')][_0xb319('0x23')]);}return _0x145654[_0xb319('0x52')](_0x29f2eb);}})['then'](function(_0x1549d8){if(_0x1549d8){return _0x1549d8?{'count':_0x833d91,'rows':_0x1549d8}:null;}})[_0xb319('0x15')](respondWithResult(_0x59e0de,null))['catch'](handleError(_0x59e0de,null));};exports[_0xb319('0x53')]=function(_0x15bee7,_0x3e20ea,_0x43b378){var _0x53f578={};var _0x4055c4={};var _0x3e13ca;var _0x3d2151;return db[_0xb319('0x2e')]['findOne']({'where':{'id':_0x15bee7[_0xb319('0x49')]['id']}})[_0xb319('0x15')](handleEntityNotFound(_0x3e20ea,null))[_0xb319('0x15')](function(_0x3791ea){if(_0x3791ea){_0x3e13ca=_0x3791ea;_0x4055c4[_0xb319('0x30')]=_['keys'](db['Tag'][_0xb319('0x2f')]);_0x4055c4[_0xb319('0x32')]=_[_0xb319('0x31')](_0x15bee7[_0xb319('0x32')]);_0x4055c4[_0xb319('0x3c')]=_['intersection'](_0x4055c4['model'],_0x4055c4[_0xb319('0x32')]);_0x53f578[_0xb319('0x35')]=_[_0xb319('0x33')](_0x4055c4[_0xb319('0x30')],qs[_0xb319('0x34')](_0x15bee7[_0xb319('0x32')][_0xb319('0x34')]));_0x53f578[_0xb319('0x35')]=_0x53f578['attributes']['length']?_0x53f578[_0xb319('0x35')]:_0x4055c4[_0xb319('0x30')];_0x53f578[_0xb319('0x39')]=qs[_0xb319('0x3a')](_0x15bee7[_0xb319('0x32')]['sort']);_0x53f578[_0xb319('0x3b')]=qs[_0xb319('0x3c')](_[_0xb319('0x3d')](_0x15bee7[_0xb319('0x32')],_0x4055c4['filters']));if(_0x15bee7[_0xb319('0x32')][_0xb319('0x3e')]){_0x53f578['where']=_[_0xb319('0x3f')](_0x53f578['where'],{'$or':_[_0xb319('0x40')](_0x53f578[_0xb319('0x35')],function(_0x49dbab){var _0x4bc99b={};_0x4bc99b[_0x49dbab]={'$like':'%'+_0x15bee7[_0xb319('0x32')][_0xb319('0x3e')]+'%'};return _0x4bc99b;})});}_0x53f578=_['merge']({},_0x53f578,_0x15bee7['options']);return _0x3e13ca[_0xb319('0x53')](_0x53f578);}})[_0xb319('0x15')](function(_0x14a6cc){if(_0x14a6cc){_0x3d2151=_0x14a6cc[_0xb319('0x36')];if(!_0x15bee7[_0xb319('0x32')][_0xb319('0x37')](_0xb319('0x38'))){_0x53f578[_0xb319('0x24')]=qs['limit'](_0x15bee7[_0xb319('0x32')][_0xb319('0x24')]);_0x53f578['offset']=qs[_0xb319('0x23')](_0x15bee7[_0xb319('0x32')][_0xb319('0x23')]);}return _0x3e13ca[_0xb319('0x53')](_0x53f578);}})[_0xb319('0x15')](function(_0x3ce5d4){if(_0x3ce5d4){return _0x3ce5d4?{'count':_0x3d2151,'rows':_0x3ce5d4}:null;}})[_0xb319('0x15')](respondWithResult(_0x3e20ea,null))[_0xb319('0x1f')](handleError(_0x3e20ea,null));};exports[_0xb319('0x54')]=function(_0x20606d,_0x5c6c59,_0x5557b3){if(_0x20606d[_0xb319('0x4d')]['id']){delete _0x20606d[_0xb319('0x4d')]['id'];}return db['FreshdeskConfiguration'][_0xb319('0x4f')]({'where':{'id':_0x20606d['params']['id']}})[_0xb319('0x15')](handleEntityNotFound(_0x5c6c59,null))[_0xb319('0x15')](function(_0x28233f){if(_0x28233f){return _0x28233f[_0xb319('0x54')](_0x20606d['body'][_0xb319('0x55')]||[]);}return null;})[_0xb319('0x15')](respondWithResult(_0x5c6c59,null))['catch'](handleError(_0x5c6c59,null));};
\ No newline at end of file
+var _0x1c46=['intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','map','type','key','VIRTUAL','options','count','includeAll','include','findAll','show','rawAttributes','keys','find','create','body','params','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','FreshdeskConfiguration','model','filters'];(function(_0x402d9e,_0x19171f){var _0x4fc40a=function(_0x249d14){while(--_0x249d14){_0x402d9e['push'](_0x402d9e['shift']());}};_0x4fc40a(++_0x19171f);}(_0x1c46,0x87));var _0x61c4=function(_0x274153,_0x26d371){_0x274153=_0x274153-0x0;var _0x5cafc5=_0x1c46[_0x274153];return _0x5cafc5;};'use strict';var pdf=require(_0x61c4('0x0'));var emlformat=require(_0x61c4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x61c4('0x2'));var jsonpatch=require(_0x61c4('0x3'));var rp=require(_0x61c4('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x61c4('0x5'));var util=require(_0x61c4('0x6'));var path=require('path');var sox=require(_0x61c4('0x7'));var csv=require(_0x61c4('0x8'));var ejs=require(_0x61c4('0x9'));var fs=require('fs');var _=require(_0x61c4('0xa'));var squel=require(_0x61c4('0xb'));var crypto=require(_0x61c4('0xc'));var jsforce=require(_0x61c4('0xd'));var deskjs=require(_0x61c4('0xe'));var toCsv=require(_0x61c4('0x8'));var querystring=require(_0x61c4('0xf'));var Papa=require(_0x61c4('0x10'));var authService=require(_0x61c4('0x11'));var hardwareService=require(_0x61c4('0x12'));var Redis=require(_0x61c4('0x13'));var qs=require(_0x61c4('0x14'));var logger=require(_0x61c4('0x15'))(_0x61c4('0x16'));var utils=require(_0x61c4('0x17'));var config=require('../../config/environment');var db=require(_0x61c4('0x18'))['db'];var jayson=require(_0x61c4('0x19'));var client=jayson['client'][_0x61c4('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4c2288,_0x47d711,_0x58fa92,_0x34d5aa){return new BPromise(function(_0xf5a39b,_0x928a77){var _0x559c5a=_0x34d5aa||client;return _0x559c5a[_0x61c4('0x1b')](_0x4c2288,_0x58fa92)[_0x61c4('0x1c')](function(_0x5438e2){logger[_0x61c4('0x1d')](_0x61c4('0x1e'),_0x47d711,_0x61c4('0x1f'));logger[_0x61c4('0x20')](_0x61c4('0x21'),_0x47d711,_0x61c4('0x1f'),JSON[_0x61c4('0x22')](_0x5438e2));if(_0x5438e2[_0x61c4('0x23')]){if(_0x5438e2[_0x61c4('0x23')]['code']===0x1f4){logger[_0x61c4('0x23')](_0x61c4('0x1e'),_0x47d711,_0x5438e2['error'][_0x61c4('0x24')]);return _0x928a77(_0x5438e2[_0x61c4('0x23')][_0x61c4('0x24')]);}logger[_0x61c4('0x23')](_0x61c4('0x1e'),_0x47d711,_0x5438e2[_0x61c4('0x23')][_0x61c4('0x24')]);return _0xf5a39b(_0x5438e2[_0x61c4('0x23')]['message']);}else{logger[_0x61c4('0x1d')](_0x61c4('0x1e'),_0x47d711,_0x61c4('0x1f'));_0xf5a39b(_0x5438e2[_0x61c4('0x25')][_0x61c4('0x24')]);}})[_0x61c4('0x26')](function(_0x383658){logger[_0x61c4('0x23')](_0x61c4('0x1e'),_0x47d711,_0x383658);_0x928a77(_0x383658);});});}function respondWithStatusCode(_0x38e5ac,_0x20c6ed){_0x20c6ed=_0x20c6ed||0xcc;return function(_0x26101b){if(_0x26101b){return _0x38e5ac[_0x61c4('0x27')](_0x20c6ed);}return _0x38e5ac[_0x61c4('0x28')](_0x20c6ed)[_0x61c4('0x29')]();};}function respondWithResult(_0x34422d,_0xbb33a7){_0xbb33a7=_0xbb33a7||0xc8;return function(_0xd3286a){if(_0xd3286a){return _0x34422d['status'](_0xbb33a7)[_0x61c4('0x2a')](_0xd3286a);}};}function respondWithFilteredResult(_0x5520c8,_0x4b4c33){return function(_0xdaae79){if(_0xdaae79){var _0x5417f9=_0xdaae79['count'],_0x4db8fe=_0x4b4c33[_0x61c4('0x2b')],_0x30d5b1=_0x4b4c33['offset']+_0x4b4c33['limit'],_0x26382c;if(_0x30d5b1>=_0x5417f9){_0x30d5b1=_0x5417f9;_0x26382c=0xc8;}else{_0x26382c=0xce;}_0x5520c8[_0x61c4('0x28')](_0x26382c);return _0x5520c8[_0x61c4('0x2c')](_0x61c4('0x2d'),_0x4db8fe+'-'+_0x30d5b1+'/'+_0x5417f9)[_0x61c4('0x2a')](_0xdaae79);}return null;};}function patchUpdates(_0x5acecb){return function(_0x4cf59e){try{jsonpatch[_0x61c4('0x2e')](_0x4cf59e,_0x5acecb,!![]);}catch(_0x1276f8){return BPromise[_0x61c4('0x2f')](_0x1276f8);}return _0x4cf59e[_0x61c4('0x30')]();};}function saveUpdates(_0x113684,_0x4f6ee0){return function(_0x5f1508){if(_0x5f1508){return _0x5f1508[_0x61c4('0x31')](_0x113684)[_0x61c4('0x1c')](function(_0x50e4b8){return _0x50e4b8;});}return null;};}function removeEntity(_0x1f9080,_0x3b9b3d){return function(_0x13c2e9){if(_0x13c2e9){return _0x13c2e9[_0x61c4('0x32')]()['then'](function(){_0x1f9080[_0x61c4('0x28')](0xcc)[_0x61c4('0x29')]();});}};}function handleEntityNotFound(_0x339e80,_0x5bf112){return function(_0x2af393){if(!_0x2af393){_0x339e80[_0x61c4('0x27')](0x194);}return _0x2af393;};}function handleError(_0x4205ea,_0x479681){_0x479681=_0x479681||0x1f4;return function(_0x4ea167){logger[_0x61c4('0x23')](_0x4ea167[_0x61c4('0x33')]);if(_0x4ea167[_0x61c4('0x34')]){delete _0x4ea167[_0x61c4('0x34')];}_0x4205ea[_0x61c4('0x28')](_0x479681)[_0x61c4('0x35')](_0x4ea167);};}exports['index']=function(_0x1d3a2c,_0x2f2111){var _0x13f1cf={},_0x10cd70={},_0xc75c26={'count':0x0,'rows':[]};var _0xe4600f=db[_0x61c4('0x36')]['rawAttributes'];_0x10cd70[_0x61c4('0x37')]=_['keys'](_0xe4600f);_0x10cd70['query']=_['keys'](_0x1d3a2c['query']);_0x10cd70[_0x61c4('0x38')]=_[_0x61c4('0x39')](_0x10cd70['model'],_0x10cd70[_0x61c4('0x3a')]);_0x13f1cf[_0x61c4('0x3b')]=_[_0x61c4('0x39')](_0x10cd70[_0x61c4('0x37')],qs['fields'](_0x1d3a2c[_0x61c4('0x3a')][_0x61c4('0x3c')]));_0x13f1cf['attributes']=_0x13f1cf[_0x61c4('0x3b')][_0x61c4('0x3d')]?_0x13f1cf[_0x61c4('0x3b')]:_0x10cd70[_0x61c4('0x37')];if(!_0x1d3a2c[_0x61c4('0x3a')][_0x61c4('0x3e')](_0x61c4('0x3f'))){_0x13f1cf[_0x61c4('0x40')]=qs[_0x61c4('0x40')](_0x1d3a2c[_0x61c4('0x3a')][_0x61c4('0x40')]);_0x13f1cf[_0x61c4('0x2b')]=qs[_0x61c4('0x2b')](_0x1d3a2c[_0x61c4('0x3a')][_0x61c4('0x2b')]);}_0x13f1cf[_0x61c4('0x41')]=qs[_0x61c4('0x42')](_0x1d3a2c['query'][_0x61c4('0x42')]);_0x13f1cf['where']=qs[_0x61c4('0x38')](_[_0x61c4('0x43')](_0x1d3a2c[_0x61c4('0x3a')],_0x10cd70['filters']));if(_0x1d3a2c[_0x61c4('0x3a')][_0x61c4('0x44')]){_0x13f1cf[_0x61c4('0x45')]=_[_0x61c4('0x46')](_0x13f1cf[_0x61c4('0x45')],{'$or':_[_0x61c4('0x47')](_0xe4600f,function(_0x3edf1f){if(_0x3edf1f[_0x61c4('0x48')][_0x61c4('0x49')]!==_0x61c4('0x4a')){var _0x3b260e={};_0x3b260e[_0x3edf1f['field']]={'$like':'%'+_0x1d3a2c[_0x61c4('0x3a')][_0x61c4('0x44')]+'%'};return _0x3b260e;}})});}_0x13f1cf=_[_0x61c4('0x46')]({},_0x13f1cf,_0x1d3a2c[_0x61c4('0x4b')]);var _0x466965={'where':_0x13f1cf['where']};return db[_0x61c4('0x36')]['count'](_0x466965)['then'](function(_0x5eb243){_0xc75c26[_0x61c4('0x4c')]=_0x5eb243;if(_0x1d3a2c['query'][_0x61c4('0x4d')]){_0x13f1cf[_0x61c4('0x4e')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x61c4('0x4f')](_0x13f1cf);})[_0x61c4('0x1c')](function(_0x3f94c1){_0xc75c26['rows']=_0x3f94c1;return _0xc75c26;})[_0x61c4('0x1c')](respondWithFilteredResult(_0x2f2111,_0x13f1cf))[_0x61c4('0x26')](handleError(_0x2f2111,null));};exports[_0x61c4('0x50')]=function(_0x554bfd,_0x1e692b){var _0x17ad6c={'raw':![],'where':{'id':_0x554bfd['params']['id']}},_0x5c491b={};_0x5c491b[_0x61c4('0x37')]=_['keys'](db[_0x61c4('0x36')][_0x61c4('0x51')]);_0x5c491b[_0x61c4('0x3a')]=_[_0x61c4('0x52')](_0x554bfd['query']);_0x5c491b[_0x61c4('0x38')]=_[_0x61c4('0x39')](_0x5c491b[_0x61c4('0x37')],_0x5c491b[_0x61c4('0x3a')]);_0x17ad6c[_0x61c4('0x3b')]=_[_0x61c4('0x39')](_0x5c491b['model'],qs[_0x61c4('0x3c')](_0x554bfd['query'][_0x61c4('0x3c')]));_0x17ad6c['attributes']=_0x17ad6c[_0x61c4('0x3b')][_0x61c4('0x3d')]?_0x17ad6c[_0x61c4('0x3b')]:_0x5c491b['model'];if(_0x554bfd[_0x61c4('0x3a')][_0x61c4('0x4d')]){_0x17ad6c[_0x61c4('0x4e')]=[{'all':!![]}];}_0x17ad6c=_[_0x61c4('0x46')]({},_0x17ad6c,_0x554bfd['options']);return db[_0x61c4('0x36')][_0x61c4('0x53')](_0x17ad6c)['then'](handleEntityNotFound(_0x1e692b,null))[_0x61c4('0x1c')](respondWithResult(_0x1e692b,null))[_0x61c4('0x26')](handleError(_0x1e692b,null));};exports[_0x61c4('0x54')]=function(_0x124685,_0x10fd44){return db[_0x61c4('0x36')][_0x61c4('0x54')](_0x124685[_0x61c4('0x55')],{})[_0x61c4('0x1c')](respondWithResult(_0x10fd44,0xc9))['catch'](handleError(_0x10fd44,null));};exports[_0x61c4('0x31')]=function(_0x316046,_0x2134af){if(_0x316046[_0x61c4('0x55')]['id']){delete _0x316046[_0x61c4('0x55')]['id'];}return db[_0x61c4('0x36')][_0x61c4('0x53')]({'where':{'id':_0x316046[_0x61c4('0x56')]['id']}})[_0x61c4('0x1c')](handleEntityNotFound(_0x2134af,null))[_0x61c4('0x1c')](saveUpdates(_0x316046[_0x61c4('0x55')],null))['then'](respondWithResult(_0x2134af,null))[_0x61c4('0x26')](handleError(_0x2134af,null));};exports[_0x61c4('0x32')]=function(_0x454350,_0x53ea93){return db[_0x61c4('0x36')][_0x61c4('0x53')]({'where':{'id':_0x454350[_0x61c4('0x56')]['id']}})[_0x61c4('0x1c')](handleEntityNotFound(_0x53ea93,null))[_0x61c4('0x1c')](removeEntity(_0x53ea93,null))[_0x61c4('0x26')](handleError(_0x53ea93,null));};exports[_0x61c4('0x57')]=function(_0xf6bdfb,_0xfebd47,_0x5e4868){var _0x1cff36={};var _0x1bf77a={};var _0x16e755;var _0x45698e;return db['FreshdeskConfiguration'][_0x61c4('0x58')]({'where':{'id':_0xf6bdfb[_0x61c4('0x56')]['id']}})[_0x61c4('0x1c')](handleEntityNotFound(_0xfebd47,null))['then'](function(_0x53833c){if(_0x53833c){_0x16e755=_0x53833c;_0x1bf77a['model']=_[_0x61c4('0x52')](db[_0x61c4('0x59')][_0x61c4('0x51')]);_0x1bf77a[_0x61c4('0x3a')]=_[_0x61c4('0x52')](_0xf6bdfb[_0x61c4('0x3a')]);_0x1bf77a['filters']=_[_0x61c4('0x39')](_0x1bf77a[_0x61c4('0x37')],_0x1bf77a[_0x61c4('0x3a')]);_0x1cff36[_0x61c4('0x3b')]=_[_0x61c4('0x39')](_0x1bf77a[_0x61c4('0x37')],qs[_0x61c4('0x3c')](_0xf6bdfb[_0x61c4('0x3a')][_0x61c4('0x3c')]));_0x1cff36[_0x61c4('0x3b')]=_0x1cff36['attributes'][_0x61c4('0x3d')]?_0x1cff36[_0x61c4('0x3b')]:_0x1bf77a[_0x61c4('0x37')];_0x1cff36[_0x61c4('0x41')]=qs[_0x61c4('0x42')](_0xf6bdfb[_0x61c4('0x3a')][_0x61c4('0x42')]);_0x1cff36[_0x61c4('0x45')]=qs[_0x61c4('0x38')](_[_0x61c4('0x43')](_0xf6bdfb[_0x61c4('0x3a')],_0x1bf77a['filters']));if(_0xf6bdfb[_0x61c4('0x3a')][_0x61c4('0x44')]){_0x1cff36['where']=_[_0x61c4('0x46')](_0x1cff36[_0x61c4('0x45')],{'$or':_[_0x61c4('0x47')](_0x1cff36[_0x61c4('0x3b')],function(_0x5db730){var _0x10c834={};_0x10c834[_0x5db730]={'$like':'%'+_0xf6bdfb['query'][_0x61c4('0x44')]+'%'};return _0x10c834;})});}_0x1cff36=_[_0x61c4('0x46')]({},_0x1cff36,_0xf6bdfb[_0x61c4('0x4b')]);return _0x16e755[_0x61c4('0x57')](_0x1cff36);}})['then'](function(_0x960c74){if(_0x960c74){_0x45698e=_0x960c74[_0x61c4('0x3d')];if(!_0xf6bdfb[_0x61c4('0x3a')][_0x61c4('0x3e')](_0x61c4('0x3f'))){_0x1cff36[_0x61c4('0x40')]=qs['limit'](_0xf6bdfb[_0x61c4('0x3a')][_0x61c4('0x40')]);_0x1cff36[_0x61c4('0x2b')]=qs[_0x61c4('0x2b')](_0xf6bdfb['query']['offset']);}return _0x16e755['getFields'](_0x1cff36);}})[_0x61c4('0x1c')](function(_0x1ecf1f){if(_0x1ecf1f){return _0x1ecf1f?{'count':_0x45698e,'rows':_0x1ecf1f}:null;}})[_0x61c4('0x1c')](respondWithResult(_0xfebd47,null))['catch'](handleError(_0xfebd47,null));};exports[_0x61c4('0x5a')]=function(_0x4de9ec,_0x31b820,_0x189ad9){var _0x5a1e42={};var _0x5dcf52={};var _0x370730;var _0x5aafe7;return db[_0x61c4('0x36')][_0x61c4('0x58')]({'where':{'id':_0x4de9ec[_0x61c4('0x56')]['id']}})['then'](handleEntityNotFound(_0x31b820,null))['then'](function(_0x297048){if(_0x297048){_0x370730=_0x297048;_0x5dcf52[_0x61c4('0x37')]=_['keys'](db[_0x61c4('0x59')]['rawAttributes']);_0x5dcf52[_0x61c4('0x3a')]=_[_0x61c4('0x52')](_0x4de9ec[_0x61c4('0x3a')]);_0x5dcf52[_0x61c4('0x38')]=_[_0x61c4('0x39')](_0x5dcf52['model'],_0x5dcf52[_0x61c4('0x3a')]);_0x5a1e42[_0x61c4('0x3b')]=_['intersection'](_0x5dcf52[_0x61c4('0x37')],qs['fields'](_0x4de9ec[_0x61c4('0x3a')][_0x61c4('0x3c')]));_0x5a1e42[_0x61c4('0x3b')]=_0x5a1e42['attributes'][_0x61c4('0x3d')]?_0x5a1e42[_0x61c4('0x3b')]:_0x5dcf52['model'];_0x5a1e42[_0x61c4('0x41')]=qs[_0x61c4('0x42')](_0x4de9ec[_0x61c4('0x3a')][_0x61c4('0x42')]);_0x5a1e42[_0x61c4('0x45')]=qs[_0x61c4('0x38')](_['pick'](_0x4de9ec[_0x61c4('0x3a')],_0x5dcf52[_0x61c4('0x38')]));if(_0x4de9ec[_0x61c4('0x3a')]['filter']){_0x5a1e42['where']=_[_0x61c4('0x46')](_0x5a1e42[_0x61c4('0x45')],{'$or':_['map'](_0x5a1e42['attributes'],function(_0x18d9ce){var _0x53c79d={};_0x53c79d[_0x18d9ce]={'$like':'%'+_0x4de9ec[_0x61c4('0x3a')][_0x61c4('0x44')]+'%'};return _0x53c79d;})});}_0x5a1e42=_['merge']({},_0x5a1e42,_0x4de9ec[_0x61c4('0x4b')]);return _0x370730[_0x61c4('0x5a')](_0x5a1e42);}})[_0x61c4('0x1c')](function(_0x228233){if(_0x228233){_0x5aafe7=_0x228233[_0x61c4('0x3d')];if(!_0x4de9ec[_0x61c4('0x3a')][_0x61c4('0x3e')](_0x61c4('0x3f'))){_0x5a1e42[_0x61c4('0x40')]=qs['limit'](_0x4de9ec[_0x61c4('0x3a')]['limit']);_0x5a1e42['offset']=qs['offset'](_0x4de9ec[_0x61c4('0x3a')][_0x61c4('0x2b')]);}return _0x370730[_0x61c4('0x5a')](_0x5a1e42);}})['then'](function(_0x483dcd){if(_0x483dcd){return _0x483dcd?{'count':_0x5aafe7,'rows':_0x483dcd}:null;}})[_0x61c4('0x1c')](respondWithResult(_0x31b820,null))[_0x61c4('0x26')](handleError(_0x31b820,null));};exports[_0x61c4('0x5b')]=function(_0x16e4c4,_0x2aae3d,_0x3b1086){var _0x371304={};var _0x354725={};var _0x40f171;var _0x1a135a;return db[_0x61c4('0x36')][_0x61c4('0x58')]({'where':{'id':_0x16e4c4[_0x61c4('0x56')]['id']}})[_0x61c4('0x1c')](handleEntityNotFound(_0x2aae3d,null))[_0x61c4('0x1c')](function(_0x2c8218){if(_0x2c8218){_0x40f171=_0x2c8218;_0x354725['model']=_[_0x61c4('0x52')](db[_0x61c4('0x59')]['rawAttributes']);_0x354725[_0x61c4('0x3a')]=_['keys'](_0x16e4c4['query']);_0x354725[_0x61c4('0x38')]=_[_0x61c4('0x39')](_0x354725[_0x61c4('0x37')],_0x354725[_0x61c4('0x3a')]);_0x371304[_0x61c4('0x3b')]=_[_0x61c4('0x39')](_0x354725[_0x61c4('0x37')],qs['fields'](_0x16e4c4[_0x61c4('0x3a')][_0x61c4('0x3c')]));_0x371304[_0x61c4('0x3b')]=_0x371304[_0x61c4('0x3b')][_0x61c4('0x3d')]?_0x371304[_0x61c4('0x3b')]:_0x354725['model'];_0x371304[_0x61c4('0x41')]=qs[_0x61c4('0x42')](_0x16e4c4[_0x61c4('0x3a')][_0x61c4('0x42')]);_0x371304[_0x61c4('0x45')]=qs[_0x61c4('0x38')](_[_0x61c4('0x43')](_0x16e4c4[_0x61c4('0x3a')],_0x354725[_0x61c4('0x38')]));if(_0x16e4c4[_0x61c4('0x3a')][_0x61c4('0x44')]){_0x371304[_0x61c4('0x45')]=_['merge'](_0x371304[_0x61c4('0x45')],{'$or':_[_0x61c4('0x47')](_0x371304[_0x61c4('0x3b')],function(_0x20e178){var _0xb997b1={};_0xb997b1[_0x20e178]={'$like':'%'+_0x16e4c4[_0x61c4('0x3a')][_0x61c4('0x44')]+'%'};return _0xb997b1;})});}_0x371304=_[_0x61c4('0x46')]({},_0x371304,_0x16e4c4['options']);return _0x40f171[_0x61c4('0x5b')](_0x371304);}})['then'](function(_0x1c3c21){if(_0x1c3c21){_0x1a135a=_0x1c3c21[_0x61c4('0x3d')];if(!_0x16e4c4[_0x61c4('0x3a')][_0x61c4('0x3e')](_0x61c4('0x3f'))){_0x371304[_0x61c4('0x40')]=qs[_0x61c4('0x40')](_0x16e4c4[_0x61c4('0x3a')][_0x61c4('0x40')]);_0x371304[_0x61c4('0x2b')]=qs[_0x61c4('0x2b')](_0x16e4c4['query'][_0x61c4('0x2b')]);}return _0x40f171[_0x61c4('0x5b')](_0x371304);}})[_0x61c4('0x1c')](function(_0x4cc726){if(_0x4cc726){return _0x4cc726?{'count':_0x1a135a,'rows':_0x4cc726}:null;}})['then'](respondWithResult(_0x2aae3d,null))[_0x61c4('0x26')](handleError(_0x2aae3d,null));};exports[_0x61c4('0x5c')]=function(_0x5a9231,_0x27e83c,_0x177fa9){var _0x156b88={};var _0x1982c1={};var _0x508bc8;var _0xa1ca9c;return db[_0x61c4('0x36')][_0x61c4('0x58')]({'where':{'id':_0x5a9231[_0x61c4('0x56')]['id']}})[_0x61c4('0x1c')](handleEntityNotFound(_0x27e83c,null))[_0x61c4('0x1c')](function(_0x387dab){if(_0x387dab){_0x508bc8=_0x387dab;_0x1982c1[_0x61c4('0x37')]=_[_0x61c4('0x52')](db[_0x61c4('0x5d')][_0x61c4('0x51')]);_0x1982c1[_0x61c4('0x3a')]=_[_0x61c4('0x52')](_0x5a9231[_0x61c4('0x3a')]);_0x1982c1[_0x61c4('0x38')]=_[_0x61c4('0x39')](_0x1982c1[_0x61c4('0x37')],_0x1982c1[_0x61c4('0x3a')]);_0x156b88['attributes']=_[_0x61c4('0x39')](_0x1982c1['model'],qs[_0x61c4('0x3c')](_0x5a9231[_0x61c4('0x3a')][_0x61c4('0x3c')]));_0x156b88[_0x61c4('0x3b')]=_0x156b88[_0x61c4('0x3b')][_0x61c4('0x3d')]?_0x156b88[_0x61c4('0x3b')]:_0x1982c1[_0x61c4('0x37')];_0x156b88['order']=qs['sort'](_0x5a9231[_0x61c4('0x3a')]['sort']);_0x156b88[_0x61c4('0x45')]=qs['filters'](_[_0x61c4('0x43')](_0x5a9231['query'],_0x1982c1[_0x61c4('0x38')]));if(_0x5a9231[_0x61c4('0x3a')]['filter']){_0x156b88['where']=_[_0x61c4('0x46')](_0x156b88[_0x61c4('0x45')],{'$or':_[_0x61c4('0x47')](_0x156b88[_0x61c4('0x3b')],function(_0x18aa86){var _0x16f485={};_0x16f485[_0x18aa86]={'$like':'%'+_0x5a9231[_0x61c4('0x3a')][_0x61c4('0x44')]+'%'};return _0x16f485;})});}_0x156b88=_['merge']({},_0x156b88,_0x5a9231[_0x61c4('0x4b')]);return _0x508bc8[_0x61c4('0x5c')](_0x156b88);}})[_0x61c4('0x1c')](function(_0x5c4ceb){if(_0x5c4ceb){_0xa1ca9c=_0x5c4ceb[_0x61c4('0x3d')];if(!_0x5a9231[_0x61c4('0x3a')][_0x61c4('0x3e')]('nolimit')){_0x156b88[_0x61c4('0x40')]=qs[_0x61c4('0x40')](_0x5a9231[_0x61c4('0x3a')][_0x61c4('0x40')]);_0x156b88['offset']=qs[_0x61c4('0x2b')](_0x5a9231[_0x61c4('0x3a')][_0x61c4('0x2b')]);}return _0x508bc8[_0x61c4('0x5c')](_0x156b88);}})['then'](function(_0xb13c55){if(_0xb13c55){return _0xb13c55?{'count':_0xa1ca9c,'rows':_0xb13c55}:null;}})[_0x61c4('0x1c')](respondWithResult(_0x27e83c,null))[_0x61c4('0x26')](handleError(_0x27e83c,null));};exports[_0x61c4('0x5e')]=function(_0xd9d199,_0x33843d,_0x51f825){if(_0xd9d199[_0x61c4('0x55')]['id']){delete _0xd9d199[_0x61c4('0x55')]['id'];}return db[_0x61c4('0x36')][_0x61c4('0x58')]({'where':{'id':_0xd9d199[_0x61c4('0x56')]['id']}})['then'](handleEntityNotFound(_0x33843d,null))[_0x61c4('0x1c')](function(_0xdd864){if(_0xdd864){return _0xdd864[_0x61c4('0x5e')](_0xd9d199[_0x61c4('0x55')][_0x61c4('0x5f')]||[]);}return null;})[_0x61c4('0x1c')](respondWithResult(_0x33843d,null))[_0x61c4('0x26')](handleError(_0x33843d,null));};
\ No newline at end of file
index dd22817..e9323fd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdb2a=['../../config/logger','bluebird','request-promise','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util'];(function(_0x44dd67,_0x36b3f7){var _0x7e1f04=function(_0x42d52b){while(--_0x42d52b){_0x44dd67['push'](_0x44dd67['shift']());}};_0x7e1f04(++_0x36b3f7);}(_0xdb2a,0x16f));var _0xadb2=function(_0x37975d,_0x5ef72b){_0x37975d=_0x37975d-0x0;var _0x3e4aad=_0xdb2a[_0x37975d];return _0x3e4aad;};'use strict';var _=require(_0xadb2('0x0'));var util=require(_0xadb2('0x1'));var logger=require(_0xadb2('0x2'))('api');var moment=require('moment');var BPromise=require(_0xadb2('0x3'));var rp=require(_0xadb2('0x4'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xadb2('0x5')]=function(_0x51f39a,_0x3aa5e1){return _0x51f39a[_0xadb2('0x6')](_0xadb2('0x7'),attributes,{'tableName':_0xadb2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x67d1=['define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','./intFreshdeskConfiguration.attributes'];(function(_0x2ec903,_0x24d92d){var _0x15c60a=function(_0x5d023d){while(--_0x5d023d){_0x2ec903['push'](_0x2ec903['shift']());}};_0x15c60a(++_0x24d92d);}(_0x67d1,0xdf));var _0x167d=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x67d1[_0x500419];return _0x241c1a;};'use strict';var _=require(_0x167d('0x0'));var util=require(_0x167d('0x1'));var logger=require(_0x167d('0x2'))(_0x167d('0x3'));var moment=require('moment');var BPromise=require(_0x167d('0x4'));var rp=require(_0x167d('0x5'));var attributes=require(_0x167d('0x6'));module['exports']=function(_0x59228a,_0x557a8c){return _0x59228a[_0x167d('0x7')](_0x167d('0x8'),attributes,{'tableName':_0x167d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 4626ce7..9a5e3b3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf1b2=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0xd38ec5,_0x468545){var _0x2e8d55=function(_0x23d536){while(--_0x23d536){_0xd38ec5['push'](_0xd38ec5['shift']());}};_0x2e8d55(++_0x468545);}(_0xf1b2,0x1a2));var _0x2f1b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf1b2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2f1b('0x0'));var util=require(_0x2f1b('0x1'));var moment=require(_0x2f1b('0x2'));var BPromise=require(_0x2f1b('0x3'));var rs=require(_0x2f1b('0x4'));var fs=require('fs');var Redis=require(_0x2f1b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2f1b('0x6'));var logger=require(_0x2f1b('0x7'))(_0x2f1b('0x8'));var config=require(_0x2f1b('0x9'));var jayson=require(_0x2f1b('0xa'));var client=jayson['client'][_0x2f1b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17fd5b,_0xd95dee,_0x2d483f){return new BPromise(function(_0x4f0785,_0x4fa2ef){return client['request'](_0x17fd5b,_0x2d483f)[_0x2f1b('0xc')](function(_0x146549){logger[_0x2f1b('0xd')](_0x2f1b('0xe'),_0xd95dee,_0x2f1b('0xf'));logger[_0x2f1b('0x10')](_0x2f1b('0x11'),_0xd95dee,_0x2f1b('0xf'),JSON[_0x2f1b('0x12')](_0x146549));if(_0x146549[_0x2f1b('0x13')]){if(_0x146549[_0x2f1b('0x13')]['code']===0x1f4){logger[_0x2f1b('0x13')](_0x2f1b('0xe'),_0xd95dee,_0x146549[_0x2f1b('0x13')][_0x2f1b('0x14')]);return _0x4fa2ef(_0x146549[_0x2f1b('0x13')][_0x2f1b('0x14')]);}logger[_0x2f1b('0x13')](_0x2f1b('0xe'),_0xd95dee,_0x146549[_0x2f1b('0x13')]['message']);return _0x4f0785(_0x146549[_0x2f1b('0x13')][_0x2f1b('0x14')]);}else{logger[_0x2f1b('0xd')](_0x2f1b('0xe'),_0xd95dee,_0x2f1b('0xf'));_0x4f0785(_0x146549[_0x2f1b('0x15')][_0x2f1b('0x14')]);}})['catch'](function(_0x15b683){logger[_0x2f1b('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xd95dee,_0x15b683);_0x4fa2ef(_0x15b683);});});}
\ No newline at end of file
+var _0x43ec=['then','info','FreshdeskConfiguration,\x20%s,\x20%s','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x5abfb6,_0x1fd2e8){var _0x1f9638=function(_0x46e6b1){while(--_0x46e6b1){_0x5abfb6['push'](_0x5abfb6['shift']());}};_0x1f9638(++_0x1fd2e8);}(_0x43ec,0xc2));var _0xc43e=function(_0x6ba418,_0x53fe35){_0x6ba418=_0x6ba418-0x0;var _0x4d941a=_0x43ec[_0x6ba418];return _0x4d941a;};'use strict';var _=require(_0xc43e('0x0'));var util=require(_0xc43e('0x1'));var moment=require('moment');var BPromise=require(_0xc43e('0x2'));var rs=require(_0xc43e('0x3'));var fs=require('fs');var Redis=require(_0xc43e('0x4'));var db=require(_0xc43e('0x5'))['db'];var utils=require(_0xc43e('0x6'));var logger=require(_0xc43e('0x7'))(_0xc43e('0x8'));var config=require(_0xc43e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc43e('0xa')][_0xc43e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d3b10,_0x49acb7,_0x4bd0a6){return new BPromise(function(_0x3c3d33,_0x2004cd){return client[_0xc43e('0xc')](_0x4d3b10,_0x4bd0a6)[_0xc43e('0xd')](function(_0x506b97){logger[_0xc43e('0xe')](_0xc43e('0xf'),_0x49acb7,'request\x20sent');logger['debug'](_0xc43e('0x10'),_0x49acb7,_0xc43e('0x11'),JSON[_0xc43e('0x12')](_0x506b97));if(_0x506b97[_0xc43e('0x13')]){if(_0x506b97[_0xc43e('0x13')][_0xc43e('0x14')]===0x1f4){logger[_0xc43e('0x13')](_0xc43e('0xf'),_0x49acb7,_0x506b97[_0xc43e('0x13')][_0xc43e('0x15')]);return _0x2004cd(_0x506b97[_0xc43e('0x13')][_0xc43e('0x15')]);}logger[_0xc43e('0x13')](_0xc43e('0xf'),_0x49acb7,_0x506b97['error'][_0xc43e('0x15')]);return _0x3c3d33(_0x506b97[_0xc43e('0x13')][_0xc43e('0x15')]);}else{logger['info'](_0xc43e('0xf'),_0x49acb7,_0xc43e('0x11'));_0x3c3d33(_0x506b97['result'][_0xc43e('0x15')]);}})[_0xc43e('0x16')](function(_0xd25870){logger[_0xc43e('0x13')](_0xc43e('0xf'),_0x49acb7,_0xd25870);_0x2004cd(_0xd25870);});});}
\ No newline at end of file
index 0c0019f..a2e258e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfb71=['util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','get','/:id','show','create','update','delete','multer'];(function(_0x512289,_0xc841f7){var _0x452233=function(_0x54937c){while(--_0x54937c){_0x512289['push'](_0x512289['shift']());}};_0x452233(++_0xc841f7);}(_0xfb71,0x1ef));var _0x1fb7=function(_0x12b2e2,_0x489b68){_0x12b2e2=_0x12b2e2-0x0;var _0x340814=_0xfb71[_0x12b2e2];return _0x340814;};'use strict';var multer=require(_0x1fb7('0x0'));var util=require(_0x1fb7('0x1'));var path=require(_0x1fb7('0x2'));var timeout=require(_0x1fb7('0x3'));var express=require(_0x1fb7('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x1fb7('0x5'));var config=require(_0x1fb7('0x6'));var controller=require(_0x1fb7('0x7'));router['get']('/',auth[_0x1fb7('0x8')](),controller[_0x1fb7('0x9')]);router[_0x1fb7('0xa')](_0x1fb7('0xb'),auth[_0x1fb7('0x8')](),controller[_0x1fb7('0xc')]);router['post']('/',auth[_0x1fb7('0x8')](),controller[_0x1fb7('0xd')]);router['put'](_0x1fb7('0xb'),auth[_0x1fb7('0x8')](),controller[_0x1fb7('0xe')]);router[_0x1fb7('0xf')](_0x1fb7('0xb'),auth[_0x1fb7('0x8')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
+var _0x04e7=['index','get','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated'];(function(_0x4ff82a,_0x33d634){var _0x421839=function(_0xd5f258){while(--_0xd5f258){_0x4ff82a['push'](_0x4ff82a['shift']());}};_0x421839(++_0x33d634);}(_0x04e7,0x6e));var _0x704e=function(_0x4c2f30,_0xa91340){_0x4c2f30=_0x4c2f30-0x0;var _0xb8854d=_0x04e7[_0x4c2f30];return _0xb8854d;};'use strict';var multer=require(_0x704e('0x0'));var util=require(_0x704e('0x1'));var path=require(_0x704e('0x2'));var timeout=require(_0x704e('0x3'));var express=require(_0x704e('0x4'));var router=express[_0x704e('0x5')]();var auth=require(_0x704e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x704e('0x7'));var controller=require(_0x704e('0x8'));router['get']('/',auth[_0x704e('0x9')](),controller[_0x704e('0xa')]);router[_0x704e('0xb')](_0x704e('0xc'),auth['isAuthenticated'](),controller[_0x704e('0xd')]);router[_0x704e('0xe')]('/',auth[_0x704e('0x9')](),controller[_0x704e('0xf')]);router['put']('/:id',auth[_0x704e('0x9')](),controller[_0x704e('0x10')]);router[_0x704e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x704e('0x12')]);module[_0x704e('0x13')]=router;
\ No newline at end of file
index 0823ead..68f090d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0713=['BOOLEAN','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x3071('0x0')](_0x3071('0x1'),_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3071('0x5')]},'key':{'type':Sequelize[_0x3071('0x5')]},'keyType':{'type':Sequelize[_0x3071('0x0')](_0x3071('0x1'),_0x3071('0x2'),_0x3071('0x3'))},'keyContent':{'type':Sequelize[_0x3071('0x5')]},'idField':{'type':Sequelize[_0x3071('0x5')]},'nameField':{'type':Sequelize[_0x3071('0x5')]},'customField':{'type':Sequelize[_0x3071('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3071('0x5')]}};
\ No newline at end of file
+var _0x702d=['STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue'];(function(_0x358495,_0x5b4cb2){var _0x2a7f2b=function(_0x4b705e){while(--_0x4b705e){_0x358495['push'](_0x358495['shift']());}};_0x2a7f2b(++_0x5b4cb2);}(_0x702d,0x147));var _0xd702=function(_0x3f9cb5,_0x158c58){_0x3f9cb5=_0x3f9cb5-0x0;var _0x4c8e65=_0x702d[_0x3f9cb5];return _0x4c8e65;};'use strict';var Sequelize=require(_0xd702('0x0'));module[_0xd702('0x1')]={'type':{'type':Sequelize[_0xd702('0x2')](_0xd702('0x3'),_0xd702('0x4'),'customVariable',_0xd702('0x5')),'defaultValue':_0xd702('0x3')},'content':{'type':Sequelize[_0xd702('0x6')]},'key':{'type':Sequelize[_0xd702('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xd702('0x3'),'variable',_0xd702('0x7'))},'keyContent':{'type':Sequelize[_0xd702('0x6')]},'idField':{'type':Sequelize[_0xd702('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd702('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}};
\ No newline at end of file
index 5a99c68..3009373 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcf24=['../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','status','end','offset','limit','Content-Range','json','reject','update','then','destroy','sendStatus','error','name','index','FreshdeskField','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','field','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../config/license/hardware','ioredis'];(function(_0x55eb05,_0x36eb0d){var _0x5cefb6=function(_0x13ee62){while(--_0x13ee62){_0x55eb05['push'](_0x55eb05['shift']());}};_0x5cefb6(++_0x36eb0d);}(_0xcf24,0x113));var _0x4cf2=function(_0x26518f,_0x540087){_0x26518f=_0x26518f-0x0;var _0x283d79=_0xcf24[_0x26518f];return _0x283d79;};'use strict';var pdf=require(_0x4cf2('0x0'));var emlformat=require(_0x4cf2('0x1'));var rimraf=require(_0x4cf2('0x2'));var zipdir=require(_0x4cf2('0x3'));var jsonpatch=require(_0x4cf2('0x4'));var rp=require(_0x4cf2('0x5'));var moment=require(_0x4cf2('0x6'));var BPromise=require(_0x4cf2('0x7'));var Mustache=require(_0x4cf2('0x8'));var util=require(_0x4cf2('0x9'));var path=require('path');var sox=require(_0x4cf2('0xa'));var csv=require(_0x4cf2('0xb'));var ejs=require(_0x4cf2('0xc'));var fs=require('fs');var _=require(_0x4cf2('0xd'));var squel=require(_0x4cf2('0xe'));var crypto=require(_0x4cf2('0xf'));var jsforce=require(_0x4cf2('0x10'));var deskjs=require(_0x4cf2('0x11'));var toCsv=require(_0x4cf2('0xb'));var querystring=require('querystring');var Papa=require(_0x4cf2('0x12'));var authService=require('../../components/auth/service');var hardwareService=require(_0x4cf2('0x13'));var Redis=require(_0x4cf2('0x14'));var qs=require(_0x4cf2('0x15'));var logger=require(_0x4cf2('0x16'))(_0x4cf2('0x17'));var utils=require(_0x4cf2('0x18'));var config=require('../../config/environment');var db=require(_0x4cf2('0x19'))['db'];function respondWithStatusCode(_0xbc5bff,_0x41a0d4){_0x41a0d4=_0x41a0d4||0xcc;return function(_0x25f67a){if(_0x25f67a){return _0xbc5bff['sendStatus'](_0x41a0d4);}return _0xbc5bff[_0x4cf2('0x1a')](_0x41a0d4)[_0x4cf2('0x1b')]();};}function respondWithResult(_0x2975c5,_0x32efd1){_0x32efd1=_0x32efd1||0xc8;return function(_0x2d2bb4){if(_0x2d2bb4){return _0x2975c5['status'](_0x32efd1)['json'](_0x2d2bb4);}};}function respondWithFilteredResult(_0x727680,_0x12a6c3){return function(_0x152384){if(_0x152384){var _0x382d22=_0x152384['count'],_0x540b47=_0x12a6c3[_0x4cf2('0x1c')],_0xab3ded=_0x12a6c3['offset']+_0x12a6c3[_0x4cf2('0x1d')],_0x33fd11;if(_0xab3ded>=_0x382d22){_0xab3ded=_0x382d22;_0x33fd11=0xc8;}else{_0x33fd11=0xce;}_0x727680[_0x4cf2('0x1a')](_0x33fd11);return _0x727680['set'](_0x4cf2('0x1e'),_0x540b47+'-'+_0xab3ded+'/'+_0x382d22)[_0x4cf2('0x1f')](_0x152384);}return null;};}function patchUpdates(_0x3928d2){return function(_0x278942){try{jsonpatch['apply'](_0x278942,_0x3928d2,!![]);}catch(_0x5ae8a8){return BPromise[_0x4cf2('0x20')](_0x5ae8a8);}return _0x278942['save']();};}function saveUpdates(_0x4ffeb9,_0x3f0cbf){return function(_0x2b1078){if(_0x2b1078){return _0x2b1078[_0x4cf2('0x21')](_0x4ffeb9)[_0x4cf2('0x22')](function(_0x102f3d){return _0x102f3d;});}return null;};}function removeEntity(_0x2a3c4e,_0x1257da){return function(_0x3b4d64){if(_0x3b4d64){return _0x3b4d64[_0x4cf2('0x23')]()['then'](function(){_0x2a3c4e[_0x4cf2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x497206,_0x110de9){return function(_0x20bcb8){if(!_0x20bcb8){_0x497206[_0x4cf2('0x24')](0x194);}return _0x20bcb8;};}function handleError(_0x28aca8,_0x5a304a){_0x5a304a=_0x5a304a||0x1f4;return function(_0x37a8a9){logger[_0x4cf2('0x25')](_0x37a8a9['stack']);if(_0x37a8a9[_0x4cf2('0x26')]){delete _0x37a8a9[_0x4cf2('0x26')];}_0x28aca8[_0x4cf2('0x1a')](_0x5a304a)['send'](_0x37a8a9);};}exports[_0x4cf2('0x27')]=function(_0x4d9d35,_0x88d40c){var _0x3efd80={},_0x3b450d={},_0x1aaa40={'count':0x0,'rows':[]};var _0x156864=db[_0x4cf2('0x28')][_0x4cf2('0x29')];_0x3b450d[_0x4cf2('0x2a')]=_[_0x4cf2('0x2b')](_0x156864);_0x3b450d['query']=_['keys'](_0x4d9d35[_0x4cf2('0x2c')]);_0x3b450d[_0x4cf2('0x2d')]=_[_0x4cf2('0x2e')](_0x3b450d['model'],_0x3b450d[_0x4cf2('0x2c')]);_0x3efd80[_0x4cf2('0x2f')]=_[_0x4cf2('0x2e')](_0x3b450d[_0x4cf2('0x2a')],qs['fields'](_0x4d9d35[_0x4cf2('0x2c')][_0x4cf2('0x30')]));_0x3efd80[_0x4cf2('0x2f')]=_0x3efd80[_0x4cf2('0x2f')][_0x4cf2('0x31')]?_0x3efd80['attributes']:_0x3b450d[_0x4cf2('0x2a')];if(!_0x4d9d35['query'][_0x4cf2('0x32')](_0x4cf2('0x33'))){_0x3efd80['limit']=qs[_0x4cf2('0x1d')](_0x4d9d35[_0x4cf2('0x2c')][_0x4cf2('0x1d')]);_0x3efd80[_0x4cf2('0x1c')]=qs[_0x4cf2('0x1c')](_0x4d9d35[_0x4cf2('0x2c')][_0x4cf2('0x1c')]);}_0x3efd80[_0x4cf2('0x34')]=qs[_0x4cf2('0x35')](_0x4d9d35[_0x4cf2('0x2c')][_0x4cf2('0x35')]);_0x3efd80[_0x4cf2('0x36')]=qs['filters'](_[_0x4cf2('0x37')](_0x4d9d35[_0x4cf2('0x2c')],_0x3b450d[_0x4cf2('0x2d')]));if(_0x4d9d35[_0x4cf2('0x2c')][_0x4cf2('0x38')]){_0x3efd80['where']=_[_0x4cf2('0x39')](_0x3efd80[_0x4cf2('0x36')],{'$or':_[_0x4cf2('0x3a')](_0x156864,function(_0xa55da0){if(_0xa55da0[_0x4cf2('0x3b')]['key']!==_0x4cf2('0x3c')){var _0x2ff1d2={};_0x2ff1d2[_0xa55da0[_0x4cf2('0x3d')]]={'$like':'%'+_0x4d9d35[_0x4cf2('0x2c')][_0x4cf2('0x38')]+'%'};return _0x2ff1d2;}})});}_0x3efd80=_[_0x4cf2('0x39')]({},_0x3efd80,_0x4d9d35[_0x4cf2('0x3e')]);var _0x2f96a9={'where':_0x3efd80[_0x4cf2('0x36')]};return db[_0x4cf2('0x28')][_0x4cf2('0x3f')](_0x2f96a9)['then'](function(_0x11c89b){_0x1aaa40[_0x4cf2('0x3f')]=_0x11c89b;if(_0x4d9d35[_0x4cf2('0x2c')][_0x4cf2('0x40')]){_0x3efd80[_0x4cf2('0x41')]=[{'all':!![]}];}return db[_0x4cf2('0x28')][_0x4cf2('0x42')](_0x3efd80);})[_0x4cf2('0x22')](function(_0x1751fe){_0x1aaa40[_0x4cf2('0x43')]=_0x1751fe;return _0x1aaa40;})[_0x4cf2('0x22')](respondWithFilteredResult(_0x88d40c,_0x3efd80))[_0x4cf2('0x44')](handleError(_0x88d40c,null));};exports[_0x4cf2('0x45')]=function(_0x532372,_0x2af83d){var _0x4a3036={'raw':!![],'where':{'id':_0x532372[_0x4cf2('0x46')]['id']}},_0x1040a8={};_0x1040a8[_0x4cf2('0x2a')]=_[_0x4cf2('0x2b')](db[_0x4cf2('0x28')][_0x4cf2('0x29')]);_0x1040a8['query']=_[_0x4cf2('0x2b')](_0x532372[_0x4cf2('0x2c')]);_0x1040a8[_0x4cf2('0x2d')]=_['intersection'](_0x1040a8[_0x4cf2('0x2a')],_0x1040a8['query']);_0x4a3036['attributes']=_[_0x4cf2('0x2e')](_0x1040a8[_0x4cf2('0x2a')],qs[_0x4cf2('0x30')](_0x532372[_0x4cf2('0x2c')]['fields']));_0x4a3036[_0x4cf2('0x2f')]=_0x4a3036[_0x4cf2('0x2f')][_0x4cf2('0x31')]?_0x4a3036['attributes']:_0x1040a8[_0x4cf2('0x2a')];if(_0x532372[_0x4cf2('0x2c')][_0x4cf2('0x40')]){_0x4a3036[_0x4cf2('0x41')]=[{'all':!![]}];}_0x4a3036=_[_0x4cf2('0x39')]({},_0x4a3036,_0x532372['options']);return db[_0x4cf2('0x28')][_0x4cf2('0x47')](_0x4a3036)[_0x4cf2('0x22')](handleEntityNotFound(_0x2af83d,null))[_0x4cf2('0x22')](respondWithResult(_0x2af83d,null))['catch'](handleError(_0x2af83d,null));};exports[_0x4cf2('0x48')]=function(_0x500570,_0x3e9066){return db[_0x4cf2('0x28')][_0x4cf2('0x48')](_0x500570[_0x4cf2('0x49')],{})[_0x4cf2('0x22')](respondWithResult(_0x3e9066,0xc9))[_0x4cf2('0x44')](handleError(_0x3e9066,null));};exports[_0x4cf2('0x21')]=function(_0x472ea7,_0x377589){if(_0x472ea7[_0x4cf2('0x49')]['id']){delete _0x472ea7[_0x4cf2('0x49')]['id'];}return db[_0x4cf2('0x28')][_0x4cf2('0x47')]({'where':{'id':_0x472ea7['params']['id']}})[_0x4cf2('0x22')](handleEntityNotFound(_0x377589,null))[_0x4cf2('0x22')](saveUpdates(_0x472ea7[_0x4cf2('0x49')],null))['then'](respondWithResult(_0x377589,null))[_0x4cf2('0x44')](handleError(_0x377589,null));};exports[_0x4cf2('0x23')]=function(_0x5a5267,_0x365085){return db[_0x4cf2('0x28')][_0x4cf2('0x47')]({'where':{'id':_0x5a5267[_0x4cf2('0x46')]['id']}})[_0x4cf2('0x22')](handleEntityNotFound(_0x365085,null))[_0x4cf2('0x22')](removeEntity(_0x365085,null))['catch'](handleError(_0x365085,null));};
\ No newline at end of file
+var _0xe3d7=['filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','FreshdeskField','rawAttributes','keys','query'];(function(_0x1f0a8b,_0x4aa86f){var _0x409ed5=function(_0x4c668d){while(--_0x4c668d){_0x1f0a8b['push'](_0x1f0a8b['shift']());}};_0x409ed5(++_0x4aa86f);}(_0xe3d7,0xb0));var _0x7e3d=function(_0x23dfb6,_0x40b2a5){_0x23dfb6=_0x23dfb6-0x0;var _0x288380=_0xe3d7[_0x23dfb6];return _0x288380;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7e3d('0x0'));var rimraf=require(_0x7e3d('0x1'));var zipdir=require(_0x7e3d('0x2'));var jsonpatch=require(_0x7e3d('0x3'));var rp=require(_0x7e3d('0x4'));var moment=require(_0x7e3d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7e3d('0x6'));var util=require('util');var path=require(_0x7e3d('0x7'));var sox=require(_0x7e3d('0x8'));var csv=require('to-csv');var ejs=require(_0x7e3d('0x9'));var fs=require('fs');var _=require(_0x7e3d('0xa'));var squel=require('squel');var crypto=require(_0x7e3d('0xb'));var jsforce=require(_0x7e3d('0xc'));var deskjs=require(_0x7e3d('0xd'));var toCsv=require(_0x7e3d('0xe'));var querystring=require(_0x7e3d('0xf'));var Papa=require(_0x7e3d('0x10'));var authService=require(_0x7e3d('0x11'));var hardwareService=require(_0x7e3d('0x12'));var Redis=require(_0x7e3d('0x13'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x7e3d('0x14'));var utils=require(_0x7e3d('0x15'));var config=require(_0x7e3d('0x16'));var db=require(_0x7e3d('0x17'))['db'];function respondWithStatusCode(_0x1a7278,_0x32f15e){_0x32f15e=_0x32f15e||0xcc;return function(_0x59d24c){if(_0x59d24c){return _0x1a7278[_0x7e3d('0x18')](_0x32f15e);}return _0x1a7278[_0x7e3d('0x19')](_0x32f15e)[_0x7e3d('0x1a')]();};}function respondWithResult(_0x2f57ac,_0x4ed312){_0x4ed312=_0x4ed312||0xc8;return function(_0x389293){if(_0x389293){return _0x2f57ac[_0x7e3d('0x19')](_0x4ed312)[_0x7e3d('0x1b')](_0x389293);}};}function respondWithFilteredResult(_0x2af2a1,_0x1e2148){return function(_0x44da1e){if(_0x44da1e){var _0x54192a=_0x44da1e[_0x7e3d('0x1c')],_0x47195f=_0x1e2148[_0x7e3d('0x1d')],_0x3754f0=_0x1e2148[_0x7e3d('0x1d')]+_0x1e2148[_0x7e3d('0x1e')],_0x3e7e86;if(_0x3754f0>=_0x54192a){_0x3754f0=_0x54192a;_0x3e7e86=0xc8;}else{_0x3e7e86=0xce;}_0x2af2a1[_0x7e3d('0x19')](_0x3e7e86);return _0x2af2a1[_0x7e3d('0x1f')](_0x7e3d('0x20'),_0x47195f+'-'+_0x3754f0+'/'+_0x54192a)[_0x7e3d('0x1b')](_0x44da1e);}return null;};}function patchUpdates(_0x3e8a6b){return function(_0x2ab0ae){try{jsonpatch[_0x7e3d('0x21')](_0x2ab0ae,_0x3e8a6b,!![]);}catch(_0x4d56c0){return BPromise['reject'](_0x4d56c0);}return _0x2ab0ae['save']();};}function saveUpdates(_0x561222,_0x3748dc){return function(_0x228d47){if(_0x228d47){return _0x228d47[_0x7e3d('0x22')](_0x561222)[_0x7e3d('0x23')](function(_0x184618){return _0x184618;});}return null;};}function removeEntity(_0x259352,_0x510baa){return function(_0x5ba6dd){if(_0x5ba6dd){return _0x5ba6dd[_0x7e3d('0x24')]()[_0x7e3d('0x23')](function(){_0x259352[_0x7e3d('0x19')](0xcc)[_0x7e3d('0x1a')]();});}};}function handleEntityNotFound(_0x23269f,_0x81a3b4){return function(_0x4d39ec){if(!_0x4d39ec){_0x23269f['sendStatus'](0x194);}return _0x4d39ec;};}function handleError(_0x34af42,_0x1ce7ea){_0x1ce7ea=_0x1ce7ea||0x1f4;return function(_0x251511){logger[_0x7e3d('0x25')](_0x251511[_0x7e3d('0x26')]);if(_0x251511[_0x7e3d('0x27')]){delete _0x251511['name'];}_0x34af42[_0x7e3d('0x19')](_0x1ce7ea)[_0x7e3d('0x28')](_0x251511);};}exports[_0x7e3d('0x29')]=function(_0x43ee33,_0x4c877e){var _0x45c4cc={},_0x3cbd96={},_0x221463={'count':0x0,'rows':[]};var _0x3c62b0=db[_0x7e3d('0x2a')][_0x7e3d('0x2b')];_0x3cbd96['model']=_[_0x7e3d('0x2c')](_0x3c62b0);_0x3cbd96[_0x7e3d('0x2d')]=_[_0x7e3d('0x2c')](_0x43ee33[_0x7e3d('0x2d')]);_0x3cbd96[_0x7e3d('0x2e')]=_['intersection'](_0x3cbd96[_0x7e3d('0x2f')],_0x3cbd96[_0x7e3d('0x2d')]);_0x45c4cc[_0x7e3d('0x30')]=_[_0x7e3d('0x31')](_0x3cbd96['model'],qs[_0x7e3d('0x32')](_0x43ee33[_0x7e3d('0x2d')]['fields']));_0x45c4cc[_0x7e3d('0x30')]=_0x45c4cc[_0x7e3d('0x30')]['length']?_0x45c4cc[_0x7e3d('0x30')]:_0x3cbd96[_0x7e3d('0x2f')];if(!_0x43ee33['query'][_0x7e3d('0x33')](_0x7e3d('0x34'))){_0x45c4cc[_0x7e3d('0x1e')]=qs[_0x7e3d('0x1e')](_0x43ee33['query'][_0x7e3d('0x1e')]);_0x45c4cc[_0x7e3d('0x1d')]=qs[_0x7e3d('0x1d')](_0x43ee33[_0x7e3d('0x2d')][_0x7e3d('0x1d')]);}_0x45c4cc['order']=qs['sort'](_0x43ee33[_0x7e3d('0x2d')][_0x7e3d('0x35')]);_0x45c4cc[_0x7e3d('0x36')]=qs[_0x7e3d('0x2e')](_[_0x7e3d('0x37')](_0x43ee33['query'],_0x3cbd96[_0x7e3d('0x2e')]));if(_0x43ee33['query'][_0x7e3d('0x38')]){_0x45c4cc[_0x7e3d('0x36')]=_[_0x7e3d('0x39')](_0x45c4cc[_0x7e3d('0x36')],{'$or':_[_0x7e3d('0x3a')](_0x3c62b0,function(_0x3900ac){if(_0x3900ac[_0x7e3d('0x3b')][_0x7e3d('0x3c')]!==_0x7e3d('0x3d')){var _0x249dc1={};_0x249dc1[_0x3900ac[_0x7e3d('0x3e')]]={'$like':'%'+_0x43ee33[_0x7e3d('0x2d')][_0x7e3d('0x38')]+'%'};return _0x249dc1;}})});}_0x45c4cc=_[_0x7e3d('0x39')]({},_0x45c4cc,_0x43ee33[_0x7e3d('0x3f')]);var _0x24edaa={'where':_0x45c4cc[_0x7e3d('0x36')]};return db[_0x7e3d('0x2a')][_0x7e3d('0x1c')](_0x24edaa)[_0x7e3d('0x23')](function(_0x481df5){_0x221463[_0x7e3d('0x1c')]=_0x481df5;if(_0x43ee33['query'][_0x7e3d('0x40')]){_0x45c4cc[_0x7e3d('0x41')]=[{'all':!![]}];}return db[_0x7e3d('0x2a')][_0x7e3d('0x42')](_0x45c4cc);})[_0x7e3d('0x23')](function(_0x2923dc){_0x221463[_0x7e3d('0x43')]=_0x2923dc;return _0x221463;})[_0x7e3d('0x23')](respondWithFilteredResult(_0x4c877e,_0x45c4cc))[_0x7e3d('0x44')](handleError(_0x4c877e,null));};exports['show']=function(_0x33422f,_0x356062){var _0xbd43a={'raw':!![],'where':{'id':_0x33422f[_0x7e3d('0x45')]['id']}},_0x2b3473={};_0x2b3473['model']=_['keys'](db[_0x7e3d('0x2a')][_0x7e3d('0x2b')]);_0x2b3473[_0x7e3d('0x2d')]=_[_0x7e3d('0x2c')](_0x33422f['query']);_0x2b3473[_0x7e3d('0x2e')]=_[_0x7e3d('0x31')](_0x2b3473['model'],_0x2b3473[_0x7e3d('0x2d')]);_0xbd43a[_0x7e3d('0x30')]=_[_0x7e3d('0x31')](_0x2b3473[_0x7e3d('0x2f')],qs[_0x7e3d('0x32')](_0x33422f[_0x7e3d('0x2d')][_0x7e3d('0x32')]));_0xbd43a['attributes']=_0xbd43a[_0x7e3d('0x30')][_0x7e3d('0x46')]?_0xbd43a[_0x7e3d('0x30')]:_0x2b3473[_0x7e3d('0x2f')];if(_0x33422f[_0x7e3d('0x2d')][_0x7e3d('0x40')]){_0xbd43a[_0x7e3d('0x41')]=[{'all':!![]}];}_0xbd43a=_[_0x7e3d('0x39')]({},_0xbd43a,_0x33422f[_0x7e3d('0x3f')]);return db[_0x7e3d('0x2a')][_0x7e3d('0x47')](_0xbd43a)[_0x7e3d('0x23')](handleEntityNotFound(_0x356062,null))[_0x7e3d('0x23')](respondWithResult(_0x356062,null))['catch'](handleError(_0x356062,null));};exports[_0x7e3d('0x48')]=function(_0x597ff4,_0xfed00e){return db[_0x7e3d('0x2a')]['create'](_0x597ff4['body'],{})[_0x7e3d('0x23')](respondWithResult(_0xfed00e,0xc9))[_0x7e3d('0x44')](handleError(_0xfed00e,null));};exports[_0x7e3d('0x22')]=function(_0xe30d45,_0x8e3268){if(_0xe30d45[_0x7e3d('0x49')]['id']){delete _0xe30d45[_0x7e3d('0x49')]['id'];}return db[_0x7e3d('0x2a')][_0x7e3d('0x47')]({'where':{'id':_0xe30d45['params']['id']}})['then'](handleEntityNotFound(_0x8e3268,null))[_0x7e3d('0x23')](saveUpdates(_0xe30d45[_0x7e3d('0x49')],null))['then'](respondWithResult(_0x8e3268,null))['catch'](handleError(_0x8e3268,null));};exports['destroy']=function(_0x32500c,_0x11ce76){return db[_0x7e3d('0x2a')][_0x7e3d('0x47')]({'where':{'id':_0x32500c[_0x7e3d('0x45')]['id']}})[_0x7e3d('0x23')](handleEntityNotFound(_0x11ce76,null))['then'](removeEntity(_0x11ce76,null))[_0x7e3d('0x44')](handleError(_0x11ce76,null));};
\ No newline at end of file
index d5e50fd..42074bb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3712=['api','bluebird','request-promise','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util'];(function(_0x4f517f,_0x15e66f){var _0x48bc81=function(_0x275f58){while(--_0x275f58){_0x4f517f['push'](_0x4f517f['shift']());}};_0x48bc81(++_0x15e66f);}(_0x3712,0x1d2));var _0x2371=function(_0x30977b,_0x22be64){_0x30977b=_0x30977b-0x0;var _0x339a92=_0x3712[_0x30977b];return _0x339a92;};'use strict';var _=require(_0x2371('0x0'));var util=require(_0x2371('0x1'));var logger=require('../../config/logger')(_0x2371('0x2'));var moment=require('moment');var BPromise=require(_0x2371('0x3'));var rp=require(_0x2371('0x4'));var attributes=require(_0x2371('0x5'));module[_0x2371('0x6')]=function(_0x30cb33,_0x694124){return _0x30cb33[_0x2371('0x7')](_0x2371('0x8'),attributes,{'tableName':_0x2371('0x9'),'paranoid':![],'indexes':[{'name':_0x2371('0xa'),'fields':[_0x2371('0xb'),_0x2371('0xc')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x9fa4=['util','../../config/logger','moment','request-promise','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9fa4,0xe9));var _0x49fa=function(_0x63135f,_0x4066f1){_0x63135f=_0x63135f-0x0;var _0xf9b578=_0x9fa4[_0x63135f];return _0xf9b578;};'use strict';var _=require(_0x49fa('0x0'));var util=require(_0x49fa('0x1'));var logger=require(_0x49fa('0x2'))('api');var moment=require(_0x49fa('0x3'));var BPromise=require('bluebird');var rp=require(_0x49fa('0x4'));var attributes=require(_0x49fa('0x5'));module[_0x49fa('0x6')]=function(_0x4401f2,_0x1496ca){return _0x4401f2[_0x49fa('0x7')](_0x49fa('0x8'),attributes,{'tableName':_0x49fa('0x9'),'paranoid':![],'indexes':[{'name':_0x49fa('0xa'),'fields':[_0x49fa('0xb'),_0x49fa('0xc')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index 5f937fc..cdc8ceb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x57d4=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshdeskField,\x20%s,\x20%s','message','info','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x4da196,_0x357dc9){var _0x375df3=function(_0x366603){while(--_0x366603){_0x4da196['push'](_0x4da196['shift']());}};_0x375df3(++_0x357dc9);}(_0x57d4,0x78));var _0x457d=function(_0x221373,_0x3125d0){_0x221373=_0x221373-0x0;var _0x53bc65=_0x57d4[_0x221373];return _0x53bc65;};'use strict';var _=require(_0x457d('0x0'));var util=require(_0x457d('0x1'));var moment=require('moment');var BPromise=require(_0x457d('0x2'));var rs=require(_0x457d('0x3'));var fs=require('fs');var Redis=require(_0x457d('0x4'));var db=require(_0x457d('0x5'))['db'];var utils=require(_0x457d('0x6'));var logger=require(_0x457d('0x7'))(_0x457d('0x8'));var config=require(_0x457d('0x9'));var jayson=require(_0x457d('0xa'));var client=jayson[_0x457d('0xb')][_0x457d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c6816,_0x1fc199,_0x381e22){return new BPromise(function(_0x4e32c0,_0x5dff56){return client[_0x457d('0xd')](_0x5c6816,_0x381e22)[_0x457d('0xe')](function(_0x127b89){logger['info']('FreshdeskField,\x20%s,\x20%s',_0x1fc199,'request\x20sent');logger[_0x457d('0xf')](_0x457d('0x10'),_0x1fc199,_0x457d('0x11'),JSON[_0x457d('0x12')](_0x127b89));if(_0x127b89[_0x457d('0x13')]){if(_0x127b89[_0x457d('0x13')][_0x457d('0x14')]===0x1f4){logger[_0x457d('0x13')](_0x457d('0x15'),_0x1fc199,_0x127b89['error'][_0x457d('0x16')]);return _0x5dff56(_0x127b89[_0x457d('0x13')]['message']);}logger['error'](_0x457d('0x15'),_0x1fc199,_0x127b89[_0x457d('0x13')][_0x457d('0x16')]);return _0x4e32c0(_0x127b89[_0x457d('0x13')][_0x457d('0x16')]);}else{logger[_0x457d('0x17')](_0x457d('0x15'),_0x1fc199,_0x457d('0x11'));_0x4e32c0(_0x127b89['result'][_0x457d('0x16')]);}})[_0x457d('0x18')](function(_0x2c05ca){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x1fc199,_0x2c05ca);_0x5dff56(_0x2c05ca);});});}
\ No newline at end of file
+var _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','FreshdeskField,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x13bec6,_0x123de8){var _0x2f4d76=function(_0x41fe13){while(--_0x41fe13){_0x13bec6['push'](_0x13bec6['shift']());}};_0x2f4d76(++_0x123de8);}(_0x3e74,0x175));var _0x43e7=function(_0x23c3e7,_0x6db7d3){_0x23c3e7=_0x23c3e7-0x0;var _0x581607=_0x3e74[_0x23c3e7];return _0x581607;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('FreshdeskField,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});}
\ No newline at end of file
index 09f0e76..176500e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd3f9=['path','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','update','delete','exports','multer'];(function(_0x372129,_0x539547){var _0x2385b4=function(_0x17969f){while(--_0x17969f){_0x372129['push'](_0x372129['shift']());}};_0x2385b4(++_0x539547);}(_0xd3f9,0x7d));var _0x9d3f=function(_0x35cf72,_0x21dc70){_0x35cf72=_0x35cf72-0x0;var _0xf5ca57=_0xd3f9[_0x35cf72];return _0xf5ca57;};'use strict';var multer=require(_0x9d3f('0x0'));var util=require('util');var path=require(_0x9d3f('0x1'));var timeout=require('connect-timeout');var express=require(_0x9d3f('0x2'));var router=express[_0x9d3f('0x3')]();var auth=require(_0x9d3f('0x4'));var interaction=require(_0x9d3f('0x5'));var config=require('../../config/environment');var controller=require(_0x9d3f('0x6'));router[_0x9d3f('0x7')]('/',auth['isAuthenticated'](),controller[_0x9d3f('0x8')]);router[_0x9d3f('0x7')](_0x9d3f('0x9'),auth[_0x9d3f('0xa')](),controller[_0x9d3f('0xb')]);router[_0x9d3f('0x7')](_0x9d3f('0xc'),auth[_0x9d3f('0xa')](),controller[_0x9d3f('0xd')]);router[_0x9d3f('0x7')]('/:id/fields',auth[_0x9d3f('0xa')](),controller[_0x9d3f('0xe')]);router[_0x9d3f('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x9d3f('0xa')](),controller[_0x9d3f('0x10')]);router[_0x9d3f('0x11')](_0x9d3f('0x9'),auth[_0x9d3f('0xa')](),controller[_0x9d3f('0x12')]);router[_0x9d3f('0x13')](_0x9d3f('0x9'),auth[_0x9d3f('0xa')](),controller['destroy']);module[_0x9d3f('0x14')]=router;
\ No newline at end of file
+var _0x5f9c=['/:id','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','update','delete','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x3e61ce,_0x13aa20){var _0x152701=function(_0x3c86d9){while(--_0x3c86d9){_0x3e61ce['push'](_0x3e61ce['shift']());}};_0x152701(++_0x13aa20);}(_0x5f9c,0x13a));var _0xc5f9=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x5f9c[_0x255d5b];return _0x3e141a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc5f9('0x0'));var timeout=require(_0xc5f9('0x1'));var express=require(_0xc5f9('0x2'));var router=express[_0xc5f9('0x3')]();var auth=require(_0xc5f9('0x4'));var interaction=require(_0xc5f9('0x5'));var config=require(_0xc5f9('0x6'));var controller=require('./intSalesforceAccount.controller');router['get']('/',auth[_0xc5f9('0x7')](),controller[_0xc5f9('0x8')]);router['get'](_0xc5f9('0x9'),auth[_0xc5f9('0x7')](),controller['show']);router[_0xc5f9('0xa')](_0xc5f9('0xb'),auth[_0xc5f9('0x7')](),controller[_0xc5f9('0xc')]);router[_0xc5f9('0xa')](_0xc5f9('0xd'),auth[_0xc5f9('0x7')](),controller[_0xc5f9('0xe')]);router[_0xc5f9('0xf')]('/',auth[_0xc5f9('0x7')](),controller[_0xc5f9('0x10')]);router[_0xc5f9('0xf')]('/:id/configurations',auth[_0xc5f9('0x7')](),controller['addConfiguration']);router['put']('/:id',auth[_0xc5f9('0x7')](),controller[_0xc5f9('0x11')]);router[_0xc5f9('0x12')](_0xc5f9('0x9'),auth[_0xc5f9('0x7')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
index 2d3a6ba..f35d282 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf519=['ENUM','integrationTab','sequelize','exports','STRING','username'];(function(_0x2d1e5f,_0x45c24c){var _0xefe11c=function(_0x1c6ba4){while(--_0x1c6ba4){_0x2d1e5f['push'](_0x2d1e5f['shift']());}};_0xefe11c(++_0x45c24c);}(_0xf519,0xc8));var _0x9f51=function(_0x4c73ac,_0x46b73c){_0x4c73ac=_0x4c73ac-0x0;var _0x9839ee=_0xf519[_0x4c73ac];return _0x9839ee;};'use strict';var Sequelize=require(_0x9f51('0x0'));module[_0x9f51('0x1')]={'name':{'type':Sequelize[_0x9f51('0x2')]},'description':{'type':Sequelize[_0x9f51('0x2')]},'username':{'type':Sequelize[_0x9f51('0x2')],'unique':_0x9f51('0x3')},'remoteUri':{'type':Sequelize[_0x9f51('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x9f51('0x2')]},'clientSecret':{'type':Sequelize[_0x9f51('0x2')]},'securityToken':{'type':Sequelize[_0x9f51('0x2')]},'serverUrl':{'type':Sequelize[_0x9f51('0x2')]},'type':{'type':Sequelize[_0x9f51('0x4')](_0x9f51('0x5'),'newTab'),'defaultValue':_0x9f51('0x5')}};
\ No newline at end of file
+var _0x497d=['integrationTab','sequelize','exports','STRING','username','ENUM'];(function(_0x2a8af2,_0x11c191){var _0x3d4cc3=function(_0x2df32e){while(--_0x2df32e){_0x2a8af2['push'](_0x2a8af2['shift']());}};_0x3d4cc3(++_0x11c191);}(_0x497d,0xc7));var _0xd497=function(_0x149595,_0x54f058){_0x149595=_0x149595-0x0;var _0x1e21b5=_0x497d[_0x149595];return _0x1e21b5;};'use strict';var Sequelize=require(_0xd497('0x0'));module[_0xd497('0x1')]={'name':{'type':Sequelize[_0xd497('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xd497('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xd497('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xd497('0x2')]},'type':{'type':Sequelize[_0xd497('0x4')](_0xd497('0x5'),'newTab'),'defaultValue':_0xd497('0x5')}};
\ No newline at end of file
index 847895d..c298cf0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3a88=['SalesforceField','getFields','remoteUri','clientId','clientSecret','username','securityToken','Connection','login','sobject','Task','describe','CallDisposition','CallDurationInSeconds','CallObject','Priority','Status','Type','remove','custom','includes','label','picklistValues','value','statusCode','html-pdf','eml-format','request-promise','moment','bluebird','mustache','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','then','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','save','update','destroy','end','stack','name','send','index','SalesforceAccount','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','type','VIRTUAL','options','count','rows','show','length','includeAll','include','find','create','body','params','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration'];(function(_0xb837f5,_0x3f80a9){var _0x357368=function(_0x432e64){while(--_0x432e64){_0xb837f5['push'](_0xb837f5['shift']());}};_0x357368(++_0x3f80a9);}(_0x3a88,0x8d));var _0x83a8=function(_0x30c649,_0x2ebbac){_0x30c649=_0x30c649-0x0;var _0x3edfb9=_0x3a88[_0x30c649];return _0x3edfb9;};'use strict';var pdf=require(_0x83a8('0x0'));var emlformat=require(_0x83a8('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x83a8('0x2'));var moment=require(_0x83a8('0x3'));var BPromise=require(_0x83a8('0x4'));var Mustache=require(_0x83a8('0x5'));var util=require('util');var path=require(_0x83a8('0x6'));var sox=require('sox');var csv=require(_0x83a8('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x83a8('0x8'));var squel=require('squel');var crypto=require(_0x83a8('0x9'));var jsforce=require(_0x83a8('0xa'));var deskjs=require(_0x83a8('0xb'));var toCsv=require(_0x83a8('0x7'));var querystring=require(_0x83a8('0xc'));var Papa=require(_0x83a8('0xd'));var authService=require('../../components/auth/service');var hardwareService=require(_0x83a8('0xe'));var Redis=require(_0x83a8('0xf'));var qs=require(_0x83a8('0x10'));var logger=require(_0x83a8('0x11'))(_0x83a8('0x12'));var utils=require(_0x83a8('0x13'));var config=require(_0x83a8('0x14'));var db=require(_0x83a8('0x15'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x83a8('0x16'));var client=jayson[_0x83a8('0x17')][_0x83a8('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x23b79c,_0x211c68,_0x4449df,_0x3b5659){return new BPromise(function(_0x50c0c6,_0x1367e4){var _0x457703=_0x3b5659||client;return _0x457703['request'](_0x23b79c,_0x4449df)[_0x83a8('0x19')](function(_0x4827b7){logger[_0x83a8('0x1a')]('SalesforceAccount,\x20%s,\x20%s',_0x211c68,_0x83a8('0x1b'));logger[_0x83a8('0x1c')](_0x83a8('0x1d'),_0x211c68,'request\x20sent',JSON[_0x83a8('0x1e')](_0x4827b7));if(_0x4827b7['error']){if(_0x4827b7[_0x83a8('0x1f')][_0x83a8('0x20')]===0x1f4){logger['error'](_0x83a8('0x21'),_0x211c68,_0x4827b7[_0x83a8('0x1f')][_0x83a8('0x22')]);return _0x1367e4(_0x4827b7[_0x83a8('0x1f')][_0x83a8('0x22')]);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x211c68,_0x4827b7[_0x83a8('0x1f')][_0x83a8('0x22')]);return _0x50c0c6(_0x4827b7['error'][_0x83a8('0x22')]);}else{logger[_0x83a8('0x1a')]('SalesforceAccount,\x20%s,\x20%s',_0x211c68,_0x83a8('0x1b'));_0x50c0c6(_0x4827b7[_0x83a8('0x23')][_0x83a8('0x22')]);}})[_0x83a8('0x24')](function(_0x25fe82){logger['error'](_0x83a8('0x21'),_0x211c68,_0x25fe82);_0x1367e4(_0x25fe82);});});}function respondWithStatusCode(_0x18fa0d,_0x3ec388){_0x3ec388=_0x3ec388||0xcc;return function(_0x37d1e0){if(_0x37d1e0){return _0x18fa0d[_0x83a8('0x25')](_0x3ec388);}return _0x18fa0d[_0x83a8('0x26')](_0x3ec388)['end']();};}function respondWithResult(_0x2acf1c,_0x53f16b){_0x53f16b=_0x53f16b||0xc8;return function(_0x16cdf8){if(_0x16cdf8){return _0x2acf1c[_0x83a8('0x26')](_0x53f16b)[_0x83a8('0x27')](_0x16cdf8);}};}function respondWithFilteredResult(_0x1bb0a6,_0x3c8e77){return function(_0x2e31a4){if(_0x2e31a4){var _0x31ece1=_0x2e31a4['count'],_0x52a37a=_0x3c8e77[_0x83a8('0x28')],_0x2e539e=_0x3c8e77['offset']+_0x3c8e77[_0x83a8('0x29')],_0x2367c4;if(_0x2e539e>=_0x31ece1){_0x2e539e=_0x31ece1;_0x2367c4=0xc8;}else{_0x2367c4=0xce;}_0x1bb0a6['status'](_0x2367c4);return _0x1bb0a6[_0x83a8('0x2a')](_0x83a8('0x2b'),_0x52a37a+'-'+_0x2e539e+'/'+_0x31ece1)[_0x83a8('0x27')](_0x2e31a4);}return null;};}function patchUpdates(_0x4e50ff){return function(_0x1db3bb){try{jsonpatch['apply'](_0x1db3bb,_0x4e50ff,!![]);}catch(_0x2e68cf){return BPromise['reject'](_0x2e68cf);}return _0x1db3bb[_0x83a8('0x2c')]();};}function saveUpdates(_0x1d8e94,_0x170b6a){return function(_0xc01d09){if(_0xc01d09){return _0xc01d09[_0x83a8('0x2d')](_0x1d8e94)[_0x83a8('0x19')](function(_0x4c29a4){return _0x4c29a4;});}return null;};}function removeEntity(_0x2f2830,_0x207120){return function(_0x2cde98){if(_0x2cde98){return _0x2cde98[_0x83a8('0x2e')]()[_0x83a8('0x19')](function(){_0x2f2830[_0x83a8('0x26')](0xcc)[_0x83a8('0x2f')]();});}};}function handleEntityNotFound(_0x1c2e03,_0x3db50b){return function(_0x58a42f){if(!_0x58a42f){_0x1c2e03[_0x83a8('0x25')](0x194);}return _0x58a42f;};}function handleError(_0x168b3b,_0x326042){_0x326042=_0x326042||0x1f4;return function(_0xd78e2a){logger[_0x83a8('0x1f')](_0xd78e2a[_0x83a8('0x30')]);if(_0xd78e2a['name']){delete _0xd78e2a[_0x83a8('0x31')];}_0x168b3b[_0x83a8('0x26')](_0x326042)[_0x83a8('0x32')](_0xd78e2a);};}exports[_0x83a8('0x33')]=function(_0x18bc84,_0x14afa4){var _0x10dd66={},_0xaa7a4d={},_0x4543d2={'count':0x0,'rows':[]};var _0x4ff9b2=db[_0x83a8('0x34')][_0x83a8('0x35')];_0xaa7a4d[_0x83a8('0x36')]=_[_0x83a8('0x37')](_0x4ff9b2);_0xaa7a4d[_0x83a8('0x38')]=_[_0x83a8('0x37')](_0x18bc84[_0x83a8('0x38')]);_0xaa7a4d[_0x83a8('0x39')]=_[_0x83a8('0x3a')](_0xaa7a4d[_0x83a8('0x36')],_0xaa7a4d[_0x83a8('0x38')]);_0x10dd66[_0x83a8('0x3b')]=_['intersection'](_0xaa7a4d['model'],qs[_0x83a8('0x3c')](_0x18bc84['query'][_0x83a8('0x3c')]));_0x10dd66[_0x83a8('0x3b')]=_0x10dd66[_0x83a8('0x3b')]['length']?_0x10dd66[_0x83a8('0x3b')]:_0xaa7a4d['model'];if(!_0x18bc84['query'][_0x83a8('0x3d')](_0x83a8('0x3e'))){_0x10dd66[_0x83a8('0x29')]=qs['limit'](_0x18bc84[_0x83a8('0x38')][_0x83a8('0x29')]);_0x10dd66[_0x83a8('0x28')]=qs[_0x83a8('0x28')](_0x18bc84['query'][_0x83a8('0x28')]);}_0x10dd66['order']=qs[_0x83a8('0x3f')](_0x18bc84['query'][_0x83a8('0x3f')]);_0x10dd66[_0x83a8('0x40')]=qs[_0x83a8('0x39')](_[_0x83a8('0x41')](_0x18bc84['query'],_0xaa7a4d[_0x83a8('0x39')]));if(_0x18bc84['query'][_0x83a8('0x42')]){_0x10dd66[_0x83a8('0x40')]=_[_0x83a8('0x43')](_0x10dd66[_0x83a8('0x40')],{'$or':_[_0x83a8('0x44')](_0x4ff9b2,function(_0x24db27){if(_0x24db27[_0x83a8('0x45')]['key']!==_0x83a8('0x46')){var _0x558e0a={};_0x558e0a[_0x24db27['field']]={'$like':'%'+_0x18bc84[_0x83a8('0x38')][_0x83a8('0x42')]+'%'};return _0x558e0a;}})});}_0x10dd66=_['merge']({},_0x10dd66,_0x18bc84[_0x83a8('0x47')]);var _0x1a3579={'where':_0x10dd66[_0x83a8('0x40')]};return db[_0x83a8('0x34')][_0x83a8('0x48')](_0x1a3579)[_0x83a8('0x19')](function(_0x25159a){_0x4543d2['count']=_0x25159a;if(_0x18bc84[_0x83a8('0x38')]['includeAll']){_0x10dd66['include']=[{'all':!![]}];}return db[_0x83a8('0x34')]['findAll'](_0x10dd66);})[_0x83a8('0x19')](function(_0x22f375){_0x4543d2[_0x83a8('0x49')]=_0x22f375;return _0x4543d2;})[_0x83a8('0x19')](respondWithFilteredResult(_0x14afa4,_0x10dd66))[_0x83a8('0x24')](handleError(_0x14afa4,null));};exports[_0x83a8('0x4a')]=function(_0x4b433f,_0x236ec2){var _0xa7b23c={'raw':![],'where':{'id':_0x4b433f['params']['id']}},_0x3a3413={};_0x3a3413['model']=_['keys'](db[_0x83a8('0x34')]['rawAttributes']);_0x3a3413[_0x83a8('0x38')]=_[_0x83a8('0x37')](_0x4b433f['query']);_0x3a3413['filters']=_['intersection'](_0x3a3413[_0x83a8('0x36')],_0x3a3413['query']);_0xa7b23c[_0x83a8('0x3b')]=_['intersection'](_0x3a3413[_0x83a8('0x36')],qs['fields'](_0x4b433f[_0x83a8('0x38')][_0x83a8('0x3c')]));_0xa7b23c[_0x83a8('0x3b')]=_0xa7b23c[_0x83a8('0x3b')][_0x83a8('0x4b')]?_0xa7b23c[_0x83a8('0x3b')]:_0x3a3413[_0x83a8('0x36')];if(_0x4b433f[_0x83a8('0x38')][_0x83a8('0x4c')]){_0xa7b23c[_0x83a8('0x4d')]=[{'all':!![]}];}_0xa7b23c=_[_0x83a8('0x43')]({},_0xa7b23c,_0x4b433f['options']);return db[_0x83a8('0x34')][_0x83a8('0x4e')](_0xa7b23c)[_0x83a8('0x19')](handleEntityNotFound(_0x236ec2,null))[_0x83a8('0x19')](respondWithResult(_0x236ec2,null))[_0x83a8('0x24')](handleError(_0x236ec2,null));};exports['create']=function(_0x234bb5,_0x34e501){return db[_0x83a8('0x34')][_0x83a8('0x4f')](_0x234bb5[_0x83a8('0x50')],{})[_0x83a8('0x19')](respondWithResult(_0x34e501,0xc9))['catch'](handleError(_0x34e501,null));};exports[_0x83a8('0x2d')]=function(_0x265ea5,_0x974458){if(_0x265ea5[_0x83a8('0x50')]['id']){delete _0x265ea5[_0x83a8('0x50')]['id'];}return db[_0x83a8('0x34')][_0x83a8('0x4e')]({'where':{'id':_0x265ea5['params']['id']}})['then'](handleEntityNotFound(_0x974458,null))['then'](saveUpdates(_0x265ea5[_0x83a8('0x50')],null))['then'](respondWithResult(_0x974458,null))[_0x83a8('0x24')](handleError(_0x974458,null));};exports[_0x83a8('0x2e')]=function(_0x174ed0,_0x55a4b4){return db['SalesforceAccount'][_0x83a8('0x4e')]({'where':{'id':_0x174ed0[_0x83a8('0x51')]['id']}})[_0x83a8('0x19')](handleEntityNotFound(_0x55a4b4,null))[_0x83a8('0x19')](removeEntity(_0x55a4b4,null))[_0x83a8('0x24')](handleError(_0x55a4b4,null));};exports[_0x83a8('0x52')]=function(_0x4d3ece,_0x1a41c0,_0x55546e){var _0xcb85c0={};var _0x1fdd64={};var _0x99170f;var _0x35f0a4;return db['SalesforceAccount'][_0x83a8('0x53')]({'where':{'id':_0x4d3ece[_0x83a8('0x51')]['id']}})['then'](handleEntityNotFound(_0x1a41c0,null))[_0x83a8('0x19')](function(_0x58e923){if(_0x58e923){_0x99170f=_0x58e923;_0x1fdd64[_0x83a8('0x36')]=_[_0x83a8('0x37')](db['SalesforceConfiguration']['rawAttributes']);_0x1fdd64['query']=_[_0x83a8('0x37')](_0x4d3ece[_0x83a8('0x38')]);_0x1fdd64[_0x83a8('0x39')]=_[_0x83a8('0x3a')](_0x1fdd64[_0x83a8('0x36')],_0x1fdd64['query']);_0xcb85c0[_0x83a8('0x3b')]=_[_0x83a8('0x3a')](_0x1fdd64[_0x83a8('0x36')],qs[_0x83a8('0x3c')](_0x4d3ece[_0x83a8('0x38')][_0x83a8('0x3c')]));_0xcb85c0[_0x83a8('0x3b')]=_0xcb85c0[_0x83a8('0x3b')]['length']?_0xcb85c0[_0x83a8('0x3b')]:_0x1fdd64[_0x83a8('0x36')];_0xcb85c0['order']=qs['sort'](_0x4d3ece['query'][_0x83a8('0x3f')]);_0xcb85c0['where']=qs['filters'](_[_0x83a8('0x41')](_0x4d3ece['query'],_0x1fdd64[_0x83a8('0x39')]));if(_0x4d3ece[_0x83a8('0x38')]['filter']){_0xcb85c0[_0x83a8('0x40')]=_[_0x83a8('0x43')](_0xcb85c0[_0x83a8('0x40')],{'$or':_[_0x83a8('0x44')](_0xcb85c0[_0x83a8('0x3b')],function(_0xfcdf23){var _0x3dd31e={};_0x3dd31e[_0xfcdf23]={'$like':'%'+_0x4d3ece['query'][_0x83a8('0x42')]+'%'};return _0x3dd31e;})});}_0xcb85c0=_[_0x83a8('0x43')]({},_0xcb85c0,_0x4d3ece['options']);return _0x99170f[_0x83a8('0x52')](_0xcb85c0);}})[_0x83a8('0x19')](function(_0x173ce1){if(_0x173ce1){_0x35f0a4=_0x173ce1[_0x83a8('0x4b')];if(!_0x4d3ece[_0x83a8('0x38')][_0x83a8('0x3d')]('nolimit')){_0xcb85c0[_0x83a8('0x29')]=qs['limit'](_0x4d3ece['query'][_0x83a8('0x29')]);_0xcb85c0[_0x83a8('0x28')]=qs[_0x83a8('0x28')](_0x4d3ece[_0x83a8('0x38')][_0x83a8('0x28')]);}return _0x99170f[_0x83a8('0x52')](_0xcb85c0);}})[_0x83a8('0x19')](function(_0x246a76){if(_0x246a76){return _0x246a76?{'count':_0x35f0a4,'rows':_0x246a76}:null;}})[_0x83a8('0x19')](respondWithResult(_0x1a41c0,null))['catch'](handleError(_0x1a41c0,null));};exports[_0x83a8('0x54')]=function(_0x139e1b,_0x1c766c,_0x45c576){if(_0x139e1b['body']['id']){delete _0x139e1b[_0x83a8('0x50')]['id'];}return db[_0x83a8('0x34')][_0x83a8('0x53')]({'where':{'id':_0x139e1b[_0x83a8('0x51')]['id']}})[_0x83a8('0x19')](handleEntityNotFound(_0x1c766c,null))[_0x83a8('0x19')](function(_0x162f4c){if(_0x162f4c){_0x139e1b['body']['AccountId']=_0x162f4c['id'];_0x139e1b[_0x83a8('0x50')][_0x83a8('0x55')]=integrations[_0x83a8('0x56')](_0x139e1b[_0x83a8('0x50')][_0x83a8('0x57')],_0x139e1b[_0x83a8('0x50')]['type']);_0x139e1b[_0x83a8('0x50')][_0x83a8('0x58')]=integrations[_0x83a8('0x59')](_0x139e1b[_0x83a8('0x50')]['channel'],_0x139e1b['body'][_0x83a8('0x45')]);return db[_0x83a8('0x5a')][_0x83a8('0x4f')](_0x139e1b[_0x83a8('0x50')],{'include':[{'model':db[_0x83a8('0x5b')],'as':'Subjects'},{'model':db[_0x83a8('0x5b')],'as':'Descriptions'}]});}return null;})[_0x83a8('0x19')](respondWithResult(_0x1c766c,null))['catch'](handleError(_0x1c766c,null));};exports[_0x83a8('0x5c')]=function(_0x153e37,_0x383a25,_0x15a15a){var _0x39143a;return db[_0x83a8('0x34')][_0x83a8('0x53')]({'where':{'id':_0x153e37[_0x83a8('0x51')]['id']},'attributes':['id',_0x83a8('0x5d'),_0x83a8('0x5e'),_0x83a8('0x5f'),_0x83a8('0x60'),'password',_0x83a8('0x61')]})['then'](handleEntityNotFound(_0x383a25,null))['then'](function(_0x2b07fd){if(_0x2b07fd){_0x39143a=new jsforce[(_0x83a8('0x62'))]({'oauth2':{'loginUrl':_0x2b07fd['remoteUri'],'clientId':_0x2b07fd['clientId'],'clientSecret':_0x2b07fd['clientSecret']}});return _0x39143a[_0x83a8('0x63')](_0x2b07fd['username'],_0x2b07fd['password']['concat'](_0x2b07fd['securityToken']));}})['then'](function(_0x5005f){if(_0x5005f){return _0x39143a[_0x83a8('0x64')](_0x83a8('0x65'))[_0x83a8('0x66')]();}})[_0x83a8('0x19')](function(_0x5c28c4){var _0x40728e=[_0x83a8('0x67'),_0x83a8('0x68'),_0x83a8('0x69'),'CallType','IsArchived',_0x83a8('0x6a'),_0x83a8('0x6b'),_0x83a8('0x6c')];if(_0x5c28c4){_[_0x83a8('0x6d')](_0x5c28c4[_0x83a8('0x3c')],function(_0x11ae50){return _0x11ae50[_0x83a8('0x6e')]===![]&&!_0x40728e[_0x83a8('0x6f')](_0x11ae50[_0x83a8('0x31')]);});return{'count':_0x5c28c4['fields'][_0x83a8('0x4b')],'rows':_[_0x83a8('0x44')](_0x5c28c4[_0x83a8('0x3c')],function(_0x371e4b){return{'id':_0x371e4b[_0x83a8('0x31')],'name':_0x371e4b[_0x83a8('0x70')],'custom':_0x371e4b[_0x83a8('0x6e')],'options':_0x371e4b[_0x83a8('0x71')]?_[_0x83a8('0x44')](_0x371e4b[_0x83a8('0x71')],function(_0x3e7d7c){return{'name':_0x3e7d7c[_0x83a8('0x70')],'value':_0x3e7d7c[_0x83a8('0x72')]};}):[]};})};}})['then'](respondWithResult(_0x383a25,null))['catch'](function(_0xba5f4){var _0x49b92f=_0x153e37[_0x83a8('0x38')]['test']?0x1f4:_0xba5f4[_0x83a8('0x73')]||0x1f4;logger[_0x83a8('0x1f')]('getFields,\x20%s,\x20%s,\x20%s',_0x83a8('0x5c'),_0x49b92f,JSON[_0x83a8('0x1e')](_0xba5f4));delete _0xba5f4[_0x83a8('0x31')];if(_0x49b92f===0x191){_0x49b92f=0x190;}_0x383a25[_0x83a8('0x26')](_0x49b92f)[_0x83a8('0x32')](_0x153e37[_0x83a8('0x38')]['test']?{'message':'Wrong\x20credentials','statusCode':_0xba5f4[_0x83a8('0x73')]}:_0xba5f4);});};
\ No newline at end of file
+var _0xbaf0=['findAll','rows','show','params','find','create','update','body','getConfigurations','findOne','SalesforceConfiguration','map','AccountId','Subjects','getSubjects','Descriptions','channel','SalesforceField','clientId','clientSecret','username','password','securityToken','slice','lastIndexOf','Connection','login','concat','sobject','describe','CallDisposition','CallDurationInSeconds','CallObject','IsArchived','Status','Type','remove','includes','label','custom','picklistValues','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','request','then','info','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SalesforceAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','set','apply','reject','save','destroy','end','stack','name','index','SalesforceAccount','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','key','VIRTUAL','field','options','includeAll','include'];(function(_0x387255,_0x897a7d){var _0x330d18=function(_0x4550ac){while(--_0x4550ac){_0x387255['push'](_0x387255['shift']());}};_0x330d18(++_0x897a7d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0baf('0x0'));var rimraf=require(_0x0baf('0x1'));var zipdir=require(_0x0baf('0x2'));var jsonpatch=require(_0x0baf('0x3'));var rp=require(_0x0baf('0x4'));var moment=require(_0x0baf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0baf('0x6'));var util=require(_0x0baf('0x7'));var path=require(_0x0baf('0x8'));var sox=require(_0x0baf('0x9'));var csv=require(_0x0baf('0xa'));var ejs=require(_0x0baf('0xb'));var fs=require('fs');var _=require(_0x0baf('0xc'));var squel=require(_0x0baf('0xd'));var crypto=require(_0x0baf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0baf('0x10'));var Papa=require(_0x0baf('0x11'));var authService=require(_0x0baf('0x12'));var hardwareService=require(_0x0baf('0x13'));var Redis=require(_0x0baf('0x14'));var qs=require(_0x0baf('0x15'));var logger=require(_0x0baf('0x16'))(_0x0baf('0x17'));var utils=require(_0x0baf('0x18'));var config=require(_0x0baf('0x19'));var db=require(_0x0baf('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x0baf('0x1b')][_0x0baf('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5db689,_0x13df17,_0x5a0583,_0x2ab33e){return new BPromise(function(_0x49e44b,_0x1c76a8){var _0x1f50c3=_0x2ab33e||client;return _0x1f50c3[_0x0baf('0x1d')](_0x5db689,_0x5a0583)[_0x0baf('0x1e')](function(_0xb8339e){logger[_0x0baf('0x1f')]('SalesforceAccount,\x20%s,\x20%s',_0x13df17,'request\x20sent');logger[_0x0baf('0x20')](_0x0baf('0x21'),_0x13df17,_0x0baf('0x22'),JSON[_0x0baf('0x23')](_0xb8339e));if(_0xb8339e[_0x0baf('0x24')]){if(_0xb8339e[_0x0baf('0x24')]['code']===0x1f4){logger[_0x0baf('0x24')](_0x0baf('0x25'),_0x13df17,_0xb8339e[_0x0baf('0x24')][_0x0baf('0x26')]);return _0x1c76a8(_0xb8339e[_0x0baf('0x24')][_0x0baf('0x26')]);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x13df17,_0xb8339e[_0x0baf('0x24')][_0x0baf('0x26')]);return _0x49e44b(_0xb8339e[_0x0baf('0x24')][_0x0baf('0x26')]);}else{logger[_0x0baf('0x1f')](_0x0baf('0x25'),_0x13df17,_0x0baf('0x22'));_0x49e44b(_0xb8339e[_0x0baf('0x27')][_0x0baf('0x26')]);}})[_0x0baf('0x28')](function(_0x54f2fa){logger[_0x0baf('0x24')]('SalesforceAccount,\x20%s,\x20%s',_0x13df17,_0x54f2fa);_0x1c76a8(_0x54f2fa);});});}function respondWithStatusCode(_0xf6c158,_0x5dbf00){_0x5dbf00=_0x5dbf00||0xcc;return function(_0x4de74c){if(_0x4de74c){return _0xf6c158[_0x0baf('0x29')](_0x5dbf00);}return _0xf6c158['status'](_0x5dbf00)['end']();};}function respondWithResult(_0x47c4b,_0x27b59c){_0x27b59c=_0x27b59c||0xc8;return function(_0x34e264){if(_0x34e264){return _0x47c4b[_0x0baf('0x2a')](_0x27b59c)[_0x0baf('0x2b')](_0x34e264);}};}function respondWithFilteredResult(_0x56b299,_0x448617){return function(_0x4681c5){if(_0x4681c5){var _0x1ca35a=_0x4681c5[_0x0baf('0x2c')],_0x366e71=_0x448617['offset'],_0x3843b8=_0x448617[_0x0baf('0x2d')]+_0x448617[_0x0baf('0x2e')],_0x3b9b31;if(_0x3843b8>=_0x1ca35a){_0x3843b8=_0x1ca35a;_0x3b9b31=0xc8;}else{_0x3b9b31=0xce;}_0x56b299[_0x0baf('0x2a')](_0x3b9b31);return _0x56b299[_0x0baf('0x2f')]('Content-Range',_0x366e71+'-'+_0x3843b8+'/'+_0x1ca35a)[_0x0baf('0x2b')](_0x4681c5);}return null;};}function patchUpdates(_0x34a58a){return function(_0x5d9d7f){try{jsonpatch[_0x0baf('0x30')](_0x5d9d7f,_0x34a58a,!![]);}catch(_0x32e4fb){return BPromise[_0x0baf('0x31')](_0x32e4fb);}return _0x5d9d7f[_0x0baf('0x32')]();};}function saveUpdates(_0xd14f0f,_0x366924){return function(_0x213a6a){if(_0x213a6a){return _0x213a6a['update'](_0xd14f0f)[_0x0baf('0x1e')](function(_0x156ed7){return _0x156ed7;});}return null;};}function removeEntity(_0x37be4e,_0x3ed995){return function(_0x24ecee){if(_0x24ecee){return _0x24ecee[_0x0baf('0x33')]()[_0x0baf('0x1e')](function(){_0x37be4e[_0x0baf('0x2a')](0xcc)[_0x0baf('0x34')]();});}};}function handleEntityNotFound(_0x3ded64,_0x2adfd7){return function(_0x165d14){if(!_0x165d14){_0x3ded64[_0x0baf('0x29')](0x194);}return _0x165d14;};}function handleError(_0x3a3353,_0x57a6bb){_0x57a6bb=_0x57a6bb||0x1f4;return function(_0x2fd426){logger['error'](_0x2fd426[_0x0baf('0x35')]);if(_0x2fd426[_0x0baf('0x36')]){delete _0x2fd426[_0x0baf('0x36')];}_0x3a3353[_0x0baf('0x2a')](_0x57a6bb)['send'](_0x2fd426);};}exports[_0x0baf('0x37')]=function(_0x1d6575,_0x5088a5){var _0x23d890={},_0x2447c2={},_0x62a2ed={'count':0x0,'rows':[]};var _0xbaa9a7=db[_0x0baf('0x38')][_0x0baf('0x39')];_0x2447c2[_0x0baf('0x3a')]=_[_0x0baf('0x3b')](_0xbaa9a7);_0x2447c2['query']=_[_0x0baf('0x3b')](_0x1d6575[_0x0baf('0x3c')]);_0x2447c2['filters']=_[_0x0baf('0x3d')](_0x2447c2['model'],_0x2447c2['query']);_0x23d890[_0x0baf('0x3e')]=_[_0x0baf('0x3d')](_0x2447c2['model'],qs['fields'](_0x1d6575[_0x0baf('0x3c')][_0x0baf('0x3f')]));_0x23d890[_0x0baf('0x3e')]=_0x23d890[_0x0baf('0x3e')][_0x0baf('0x40')]?_0x23d890[_0x0baf('0x3e')]:_0x2447c2[_0x0baf('0x3a')];if(!_0x1d6575[_0x0baf('0x3c')][_0x0baf('0x41')](_0x0baf('0x42'))){_0x23d890[_0x0baf('0x2e')]=qs[_0x0baf('0x2e')](_0x1d6575[_0x0baf('0x3c')][_0x0baf('0x2e')]);_0x23d890['offset']=qs[_0x0baf('0x2d')](_0x1d6575[_0x0baf('0x3c')]['offset']);}_0x23d890[_0x0baf('0x43')]=qs[_0x0baf('0x44')](_0x1d6575[_0x0baf('0x3c')][_0x0baf('0x44')]);_0x23d890[_0x0baf('0x45')]=qs[_0x0baf('0x46')](_['pick'](_0x1d6575[_0x0baf('0x3c')],_0x2447c2[_0x0baf('0x46')]));if(_0x1d6575['query'][_0x0baf('0x47')]){_0x23d890[_0x0baf('0x45')]=_[_0x0baf('0x48')](_0x23d890[_0x0baf('0x45')],{'$or':_['map'](_0xbaa9a7,function(_0x193fd3){if(_0x193fd3[_0x0baf('0x49')][_0x0baf('0x4a')]!==_0x0baf('0x4b')){var _0x2b6d54={};_0x2b6d54[_0x193fd3[_0x0baf('0x4c')]]={'$like':'%'+_0x1d6575[_0x0baf('0x3c')][_0x0baf('0x47')]+'%'};return _0x2b6d54;}})});}_0x23d890=_[_0x0baf('0x48')]({},_0x23d890,_0x1d6575[_0x0baf('0x4d')]);var _0x56270e={'where':_0x23d890[_0x0baf('0x45')]};return db[_0x0baf('0x38')][_0x0baf('0x2c')](_0x56270e)[_0x0baf('0x1e')](function(_0x22207a){_0x62a2ed['count']=_0x22207a;if(_0x1d6575[_0x0baf('0x3c')][_0x0baf('0x4e')]){_0x23d890[_0x0baf('0x4f')]=[{'all':!![]}];}return db[_0x0baf('0x38')][_0x0baf('0x50')](_0x23d890);})['then'](function(_0x2a0924){_0x62a2ed[_0x0baf('0x51')]=_0x2a0924;return _0x62a2ed;})[_0x0baf('0x1e')](respondWithFilteredResult(_0x5088a5,_0x23d890))[_0x0baf('0x28')](handleError(_0x5088a5,null));};exports[_0x0baf('0x52')]=function(_0x22d10f,_0x178995){var _0x5679d9={'raw':![],'where':{'id':_0x22d10f[_0x0baf('0x53')]['id']}},_0x399be0={};_0x399be0[_0x0baf('0x3a')]=_['keys'](db[_0x0baf('0x38')][_0x0baf('0x39')]);_0x399be0[_0x0baf('0x3c')]=_[_0x0baf('0x3b')](_0x22d10f[_0x0baf('0x3c')]);_0x399be0[_0x0baf('0x46')]=_[_0x0baf('0x3d')](_0x399be0['model'],_0x399be0[_0x0baf('0x3c')]);_0x5679d9[_0x0baf('0x3e')]=_[_0x0baf('0x3d')](_0x399be0[_0x0baf('0x3a')],qs[_0x0baf('0x3f')](_0x22d10f[_0x0baf('0x3c')][_0x0baf('0x3f')]));_0x5679d9[_0x0baf('0x3e')]=_0x5679d9[_0x0baf('0x3e')][_0x0baf('0x40')]?_0x5679d9[_0x0baf('0x3e')]:_0x399be0['model'];if(_0x22d10f['query'][_0x0baf('0x4e')]){_0x5679d9[_0x0baf('0x4f')]=[{'all':!![]}];}_0x5679d9=_[_0x0baf('0x48')]({},_0x5679d9,_0x22d10f[_0x0baf('0x4d')]);return db[_0x0baf('0x38')][_0x0baf('0x54')](_0x5679d9)[_0x0baf('0x1e')](handleEntityNotFound(_0x178995,null))['then'](respondWithResult(_0x178995,null))[_0x0baf('0x28')](handleError(_0x178995,null));};exports[_0x0baf('0x55')]=function(_0xf2424,_0x16d9fb){return db[_0x0baf('0x38')][_0x0baf('0x55')](_0xf2424['body'],{})[_0x0baf('0x1e')](respondWithResult(_0x16d9fb,0xc9))['catch'](handleError(_0x16d9fb,null));};exports[_0x0baf('0x56')]=function(_0x59f732,_0x25a1b2){if(_0x59f732['body']['id']){delete _0x59f732[_0x0baf('0x57')]['id'];}return db['SalesforceAccount'][_0x0baf('0x54')]({'where':{'id':_0x59f732[_0x0baf('0x53')]['id']}})[_0x0baf('0x1e')](handleEntityNotFound(_0x25a1b2,null))[_0x0baf('0x1e')](saveUpdates(_0x59f732[_0x0baf('0x57')],null))['then'](respondWithResult(_0x25a1b2,null))[_0x0baf('0x28')](handleError(_0x25a1b2,null));};exports[_0x0baf('0x33')]=function(_0x16cbf1,_0xb45360){return db[_0x0baf('0x38')][_0x0baf('0x54')]({'where':{'id':_0x16cbf1['params']['id']}})[_0x0baf('0x1e')](handleEntityNotFound(_0xb45360,null))[_0x0baf('0x1e')](removeEntity(_0xb45360,null))[_0x0baf('0x28')](handleError(_0xb45360,null));};exports[_0x0baf('0x58')]=function(_0xbc7cc2,_0x1a7ffb,_0x3834a2){var _0x565292={};var _0x48e855={};var _0x23f6ea;var _0x11e18a;return db[_0x0baf('0x38')][_0x0baf('0x59')]({'where':{'id':_0xbc7cc2[_0x0baf('0x53')]['id']}})[_0x0baf('0x1e')](handleEntityNotFound(_0x1a7ffb,null))[_0x0baf('0x1e')](function(_0x14a667){if(_0x14a667){_0x23f6ea=_0x14a667;_0x48e855[_0x0baf('0x3a')]=_['keys'](db[_0x0baf('0x5a')][_0x0baf('0x39')]);_0x48e855[_0x0baf('0x3c')]=_[_0x0baf('0x3b')](_0xbc7cc2[_0x0baf('0x3c')]);_0x48e855[_0x0baf('0x46')]=_[_0x0baf('0x3d')](_0x48e855['model'],_0x48e855[_0x0baf('0x3c')]);_0x565292[_0x0baf('0x3e')]=_[_0x0baf('0x3d')](_0x48e855[_0x0baf('0x3a')],qs[_0x0baf('0x3f')](_0xbc7cc2[_0x0baf('0x3c')][_0x0baf('0x3f')]));_0x565292[_0x0baf('0x3e')]=_0x565292['attributes'][_0x0baf('0x40')]?_0x565292['attributes']:_0x48e855[_0x0baf('0x3a')];_0x565292['order']=qs['sort'](_0xbc7cc2[_0x0baf('0x3c')]['sort']);_0x565292[_0x0baf('0x45')]=qs[_0x0baf('0x46')](_['pick'](_0xbc7cc2[_0x0baf('0x3c')],_0x48e855[_0x0baf('0x46')]));if(_0xbc7cc2[_0x0baf('0x3c')]['filter']){_0x565292['where']=_[_0x0baf('0x48')](_0x565292[_0x0baf('0x45')],{'$or':_[_0x0baf('0x5b')](_0x565292[_0x0baf('0x3e')],function(_0x784e1a){var _0x588b88={};_0x588b88[_0x784e1a]={'$like':'%'+_0xbc7cc2[_0x0baf('0x3c')]['filter']+'%'};return _0x588b88;})});}_0x565292=_['merge']({},_0x565292,_0xbc7cc2['options']);return _0x23f6ea[_0x0baf('0x58')](_0x565292);}})['then'](function(_0x4946d4){if(_0x4946d4){_0x11e18a=_0x4946d4[_0x0baf('0x40')];if(!_0xbc7cc2[_0x0baf('0x3c')][_0x0baf('0x41')](_0x0baf('0x42'))){_0x565292[_0x0baf('0x2e')]=qs[_0x0baf('0x2e')](_0xbc7cc2['query'][_0x0baf('0x2e')]);_0x565292[_0x0baf('0x2d')]=qs[_0x0baf('0x2d')](_0xbc7cc2[_0x0baf('0x3c')][_0x0baf('0x2d')]);}return _0x23f6ea[_0x0baf('0x58')](_0x565292);}})['then'](function(_0x42e8ad){if(_0x42e8ad){return _0x42e8ad?{'count':_0x11e18a,'rows':_0x42e8ad}:null;}})[_0x0baf('0x1e')](respondWithResult(_0x1a7ffb,null))[_0x0baf('0x28')](handleError(_0x1a7ffb,null));};exports['addConfiguration']=function(_0x89484d,_0x1e474f,_0x3d333d){if(_0x89484d[_0x0baf('0x57')]['id']){delete _0x89484d[_0x0baf('0x57')]['id'];}return db[_0x0baf('0x38')][_0x0baf('0x59')]({'where':{'id':_0x89484d['params']['id']}})['then'](handleEntityNotFound(_0x1e474f,null))['then'](function(_0x6ce83c){if(_0x6ce83c){_0x89484d[_0x0baf('0x57')][_0x0baf('0x5c')]=_0x6ce83c['id'];_0x89484d[_0x0baf('0x57')][_0x0baf('0x5d')]=integrations[_0x0baf('0x5e')](_0x89484d['body']['channel'],_0x89484d[_0x0baf('0x57')]['type']);_0x89484d[_0x0baf('0x57')][_0x0baf('0x5f')]=integrations['getDescriptions'](_0x89484d[_0x0baf('0x57')][_0x0baf('0x60')],_0x89484d[_0x0baf('0x57')][_0x0baf('0x49')]);return db[_0x0baf('0x5a')][_0x0baf('0x55')](_0x89484d[_0x0baf('0x57')],{'include':[{'model':db[_0x0baf('0x61')],'as':_0x0baf('0x5d')},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1e474f,null))['catch'](handleError(_0x1e474f,null));};exports['getFields']=function(_0x418c45,_0x18963f,_0x333b07){var _0x20a514;var _0x5093f5='';return db[_0x0baf('0x38')][_0x0baf('0x59')]({'where':{'id':_0x418c45['params']['id']},'attributes':['id','remoteUri',_0x0baf('0x62'),_0x0baf('0x63'),_0x0baf('0x64'),_0x0baf('0x65'),_0x0baf('0x66')]})[_0x0baf('0x1e')](handleEntityNotFound(_0x18963f,null))[_0x0baf('0x1e')](function(_0x399f40){if(_0x399f40){_0x5093f5=_0x399f40['remoteUri'];var _0x3b0f93=_0x5093f5[_0x0baf('0x67')](-0x1);if(_0x3b0f93==='/'){_0x5093f5=_0x5093f5['substring'](0x0,_0x5093f5[_0x0baf('0x68')](_0x3b0f93));}_0x20a514=new jsforce[(_0x0baf('0x69'))]({'oauth2':{'loginUrl':_0x5093f5,'clientId':_0x399f40['clientId'],'clientSecret':_0x399f40[_0x0baf('0x63')]}});return _0x20a514[_0x0baf('0x6a')](_0x399f40[_0x0baf('0x64')],_0x399f40[_0x0baf('0x65')][_0x0baf('0x6b')](_0x399f40['securityToken']));}})['then'](function(_0x1dab50){if(_0x1dab50){return _0x20a514[_0x0baf('0x6c')]('Task')[_0x0baf('0x6d')]();}})[_0x0baf('0x1e')](function(_0x21ad25){var _0x574833=[_0x0baf('0x6e'),_0x0baf('0x6f'),_0x0baf('0x70'),'CallType',_0x0baf('0x71'),'Priority',_0x0baf('0x72'),_0x0baf('0x73')];if(_0x21ad25){_[_0x0baf('0x74')](_0x21ad25[_0x0baf('0x3f')],function(_0xc09ac3){return _0xc09ac3['custom']===![]&&!_0x574833[_0x0baf('0x75')](_0xc09ac3[_0x0baf('0x36')]);});return{'count':_0x21ad25['fields'][_0x0baf('0x40')],'rows':_[_0x0baf('0x5b')](_0x21ad25[_0x0baf('0x3f')],function(_0x379c54){return{'id':_0x379c54[_0x0baf('0x36')],'name':_0x379c54[_0x0baf('0x76')],'custom':_0x379c54[_0x0baf('0x77')],'options':_0x379c54[_0x0baf('0x78')]?_[_0x0baf('0x5b')](_0x379c54[_0x0baf('0x78')],function(_0x3b7abf){return{'name':_0x3b7abf[_0x0baf('0x76')],'value':_0x3b7abf['value']};}):[]};})};}})['then'](respondWithResult(_0x18963f,null))[_0x0baf('0x28')](function(_0x322a09){var _0x384c29=_0x418c45['query']['test']?0x1f4:_0x322a09[_0x0baf('0x79')]||0x1f4;logger[_0x0baf('0x24')](_0x0baf('0x7a'),_0x0baf('0x7b'),_0x384c29,JSON[_0x0baf('0x23')](_0x322a09));delete _0x322a09[_0x0baf('0x36')];if(_0x384c29===0x191){_0x384c29=0x190;}_0x18963f[_0x0baf('0x2a')](_0x384c29)[_0x0baf('0x7c')](_0x418c45[_0x0baf('0x3c')]['test']?{'message':_0x0baf('0x7d'),'statusCode':_0x322a09[_0x0baf('0x79')]}:_0x322a09);});};
\ No newline at end of file
index 4dcfd35..ea8a3ec 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4e56=['moment','bluebird','request-promise','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','lodash','util','../../config/logger'];(function(_0x7a502a,_0x22c4be){var _0x53845b=function(_0x2c59dd){while(--_0x2c59dd){_0x7a502a['push'](_0x7a502a['shift']());}};_0x53845b(++_0x22c4be);}(_0x4e56,0x89));var _0x64e5=function(_0x319f51,_0x30257a){_0x319f51=_0x319f51-0x0;var _0x9aa82f=_0x4e56[_0x319f51];return _0x9aa82f;};'use strict';var _=require(_0x64e5('0x0'));var util=require(_0x64e5('0x1'));var logger=require(_0x64e5('0x2'))('api');var moment=require(_0x64e5('0x3'));var BPromise=require(_0x64e5('0x4'));var rp=require(_0x64e5('0x5'));var attributes=require(_0x64e5('0x6'));var integrations=require(_0x64e5('0x7'));module['exports']=function(_0x275276,_0xc4eb7c){return _0x275276[_0x64e5('0x8')](_0x64e5('0x9'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x8af0=['util','../../config/logger','api','moment','bluebird','request-promise','./intSalesforceAccount.attributes','../../components/integrations/configuration','int_salesforce_accounts'];(function(_0x1c8cc6,_0x411e5c){var _0x522936=function(_0x38d044){while(--_0x38d044){_0x1c8cc6['push'](_0x1c8cc6['shift']());}};_0x522936(++_0x411e5c);}(_0x8af0,0xea));var _0x08af=function(_0x3a73bc,_0x550aef){_0x3a73bc=_0x3a73bc-0x0;var _0x32891b=_0x8af0[_0x3a73bc];return _0x32891b;};'use strict';var _=require('lodash');var util=require(_0x08af('0x0'));var logger=require(_0x08af('0x1'))(_0x08af('0x2'));var moment=require(_0x08af('0x3'));var BPromise=require(_0x08af('0x4'));var rp=require(_0x08af('0x5'));var attributes=require(_0x08af('0x6'));var integrations=require(_0x08af('0x7'));module['exports']=function(_0x47f708,_0x4fdd06){return _0x47f708['define']('SalesforceAccount',attributes,{'tableName':_0x08af('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 7aa742e..624f5e7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7211=['then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','findAll','options','raw','include','model','attributes','map','GetSalesforceAccount','SalesforceAccount','where','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x4f2108,_0x53035c){var _0x5fe59c=function(_0x278cc1){while(--_0x278cc1){_0x4f2108['push'](_0x4f2108['shift']());}};_0x5fe59c(++_0x53035c);}(_0x7211,0x1d5));var _0x1721=function(_0x4f97f4,_0x30f006){_0x4f97f4=_0x4f97f4-0x0;var _0x240450=_0x7211[_0x4f97f4];return _0x240450;};'use strict';var _=require(_0x1721('0x0'));var util=require(_0x1721('0x1'));var moment=require(_0x1721('0x2'));var BPromise=require(_0x1721('0x3'));var rs=require(_0x1721('0x4'));var fs=require('fs');var Redis=require(_0x1721('0x5'));var db=require(_0x1721('0x6'))['db'];var utils=require(_0x1721('0x7'));var logger=require(_0x1721('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1721('0x9')][_0x1721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21b7c7,_0x62097,_0x576cec){return new BPromise(function(_0x11ac22,_0x39dc7e){return client['request'](_0x21b7c7,_0x576cec)[_0x1721('0xb')](function(_0xaaa78d){logger[_0x1721('0xc')](_0x1721('0xd'),_0x62097,'request\x20sent');logger[_0x1721('0xe')](_0x1721('0xf'),_0x62097,'request\x20sent',JSON[_0x1721('0x10')](_0xaaa78d));if(_0xaaa78d[_0x1721('0x11')]){if(_0xaaa78d[_0x1721('0x11')]['code']===0x1f4){logger['error'](_0x1721('0xd'),_0x62097,_0xaaa78d[_0x1721('0x11')]['message']);return _0x39dc7e(_0xaaa78d[_0x1721('0x11')][_0x1721('0x12')]);}logger['error'](_0x1721('0xd'),_0x62097,_0xaaa78d[_0x1721('0x11')][_0x1721('0x12')]);return _0x11ac22(_0xaaa78d[_0x1721('0x11')][_0x1721('0x12')]);}else{logger[_0x1721('0xc')](_0x1721('0xd'),_0x62097,_0x1721('0x13'));_0x11ac22(_0xaaa78d['result']['message']);}})[_0x1721('0x14')](function(_0xb61ec5){logger[_0x1721('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x62097,_0xb61ec5);_0x39dc7e(_0xb61ec5);});});}exports['GetSalesforceAccount']=function(_0x57cb96){var _0xbea966=this;return new Promise(function(_0x459fe3,_0x28e40c){return db['SalesforceAccount'][_0x1721('0x15')]({'raw':_0x57cb96[_0x1721('0x16')]?_0x57cb96[_0x1721('0x16')][_0x1721('0x17')]===undefined?!![]:![]:!![],'where':_0x57cb96[_0x1721('0x16')]?_0x57cb96['options']['where']||null:null,'attributes':_0x57cb96[_0x1721('0x16')]?_0x57cb96[_0x1721('0x16')]['attributes']||null:null,'limit':_0x57cb96[_0x1721('0x16')]?_0x57cb96[_0x1721('0x16')]['limit']||null:null,'include':_0x57cb96[_0x1721('0x16')]?_0x57cb96['options'][_0x1721('0x18')]?_['map'](_0x57cb96[_0x1721('0x16')][_0x1721('0x18')],function(_0x425cdb){return{'model':db[_0x425cdb[_0x1721('0x19')]],'as':_0x425cdb['as'],'attributes':_0x425cdb[_0x1721('0x1a')],'include':_0x425cdb[_0x1721('0x18')]?_['map'](_0x425cdb['include'],function(_0x3bf668){return{'model':db[_0x3bf668[_0x1721('0x19')]],'as':_0x3bf668['as'],'attributes':_0x3bf668[_0x1721('0x1a')],'include':_0x3bf668['include']?_[_0x1721('0x1b')](_0x3bf668[_0x1721('0x18')],function(_0x2cd61d){return{'model':db[_0x2cd61d[_0x1721('0x19')]],'as':_0x2cd61d['as'],'attributes':_0x2cd61d[_0x1721('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1721('0xb')](function(_0x359c31){logger[_0x1721('0xc')](_0x1721('0x1c'),_0x57cb96);logger['debug'](_0x1721('0x1c'),_0x57cb96,JSON[_0x1721('0x10')](_0x359c31));_0x459fe3(_0x359c31);})['catch'](function(_0x3e2984){logger[_0x1721('0x11')]('GetSalesforceAccount',_0x3e2984[_0x1721('0x12')],_0x57cb96);_0x28e40c(_0xbea966[_0x1721('0x11')](0x1f4,_0x3e2984[_0x1721('0x12')]));});});};exports['ShowSalesforceAccount']=function(_0x32ee1b){var _0x59c231=this;return new Promise(function(_0x1e8826,_0x200d68){return db[_0x1721('0x1d')]['find']({'raw':_0x32ee1b['options']?_0x32ee1b[_0x1721('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x32ee1b[_0x1721('0x16')]?_0x32ee1b['options'][_0x1721('0x1e')]||null:null,'attributes':_0x32ee1b['options']?_0x32ee1b[_0x1721('0x16')][_0x1721('0x1a')]||null:null,'include':_0x32ee1b['options']?_0x32ee1b[_0x1721('0x16')][_0x1721('0x18')]?_[_0x1721('0x1b')](_0x32ee1b[_0x1721('0x16')][_0x1721('0x18')],function(_0x3e8c14){return{'model':db[_0x3e8c14['model']],'as':_0x3e8c14['as'],'attributes':_0x3e8c14[_0x1721('0x1a')],'include':_0x3e8c14['include']?_[_0x1721('0x1b')](_0x3e8c14[_0x1721('0x18')],function(_0x1d233d){return{'model':db[_0x1d233d['model']],'as':_0x1d233d['as'],'attributes':_0x1d233d[_0x1721('0x1a')],'include':_0x1d233d['include']?_[_0x1721('0x1b')](_0x1d233d[_0x1721('0x18')],function(_0x3909a8){return{'model':db[_0x3909a8[_0x1721('0x19')]],'as':_0x3909a8['as'],'attributes':_0x3909a8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e89d7){logger[_0x1721('0xc')]('ShowSalesforceAccount',_0x32ee1b);logger['debug'](_0x1721('0x1f'),_0x32ee1b,JSON['stringify'](_0x5e89d7));_0x1e8826(_0x5e89d7);})[_0x1721('0x14')](function(_0x2f0f33){logger[_0x1721('0x11')](_0x1721('0x1f'),_0x2f0f33[_0x1721('0x12')],_0x32ee1b);_0x200d68(_0x59c231[_0x1721('0x11')](0x1f4,_0x2f0f33[_0x1721('0x12')]));});});};
\ No newline at end of file
+var _0x7d3a=['catch','GetSalesforceAccount','SalesforceAccount','findAll','options','where','attributes','limit','include','map','model','debug','stringify','ShowSalesforceAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x3b4419,_0xd4593d){var _0x51c6e1=function(_0x10078f){while(--_0x10078f){_0x3b4419['push'](_0x3b4419['shift']());}};_0x51c6e1(++_0xd4593d);}(_0x7d3a,0xa8));var _0xa7d3=function(_0x558e1e,_0x3fd803){_0x558e1e=_0x558e1e-0x0;var _0x5ba193=_0x7d3a[_0x558e1e];return _0x5ba193;};'use strict';var _=require(_0xa7d3('0x0'));var util=require(_0xa7d3('0x1'));var moment=require(_0xa7d3('0x2'));var BPromise=require(_0xa7d3('0x3'));var rs=require(_0xa7d3('0x4'));var fs=require('fs');var Redis=require(_0xa7d3('0x5'));var db=require(_0xa7d3('0x6'))['db'];var utils=require(_0xa7d3('0x7'));var logger=require(_0xa7d3('0x8'))(_0xa7d3('0x9'));var config=require(_0xa7d3('0xa'));var jayson=require(_0xa7d3('0xb'));var client=jayson[_0xa7d3('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17678d,_0x45aa44,_0x2f67e8){return new BPromise(function(_0x55f1d9,_0x284678){return client[_0xa7d3('0xd')](_0x17678d,_0x2f67e8)[_0xa7d3('0xe')](function(_0x3efbfb){logger[_0xa7d3('0xf')](_0xa7d3('0x10'),_0x45aa44,_0xa7d3('0x11'));logger['debug'](_0xa7d3('0x12'),_0x45aa44,_0xa7d3('0x11'),JSON['stringify'](_0x3efbfb));if(_0x3efbfb[_0xa7d3('0x13')]){if(_0x3efbfb[_0xa7d3('0x13')][_0xa7d3('0x14')]===0x1f4){logger['error'](_0xa7d3('0x10'),_0x45aa44,_0x3efbfb[_0xa7d3('0x13')][_0xa7d3('0x15')]);return _0x284678(_0x3efbfb['error'][_0xa7d3('0x15')]);}logger[_0xa7d3('0x13')](_0xa7d3('0x10'),_0x45aa44,_0x3efbfb[_0xa7d3('0x13')][_0xa7d3('0x15')]);return _0x55f1d9(_0x3efbfb[_0xa7d3('0x13')][_0xa7d3('0x15')]);}else{logger[_0xa7d3('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x45aa44,'request\x20sent');_0x55f1d9(_0x3efbfb['result'][_0xa7d3('0x15')]);}})[_0xa7d3('0x16')](function(_0x4406b3){logger[_0xa7d3('0x13')](_0xa7d3('0x10'),_0x45aa44,_0x4406b3);_0x284678(_0x4406b3);});});}exports[_0xa7d3('0x17')]=function(_0x52c597){var _0x1ef76b=this;return new Promise(function(_0x5931f7,_0x2deff7){return db[_0xa7d3('0x18')][_0xa7d3('0x19')]({'raw':_0x52c597['options']?_0x52c597[_0xa7d3('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x52c597[_0xa7d3('0x1a')]?_0x52c597[_0xa7d3('0x1a')][_0xa7d3('0x1b')]||null:null,'attributes':_0x52c597[_0xa7d3('0x1a')]?_0x52c597[_0xa7d3('0x1a')][_0xa7d3('0x1c')]||null:null,'limit':_0x52c597[_0xa7d3('0x1a')]?_0x52c597[_0xa7d3('0x1a')][_0xa7d3('0x1d')]||null:null,'include':_0x52c597[_0xa7d3('0x1a')]?_0x52c597[_0xa7d3('0x1a')][_0xa7d3('0x1e')]?_[_0xa7d3('0x1f')](_0x52c597[_0xa7d3('0x1a')][_0xa7d3('0x1e')],function(_0x583b1c){return{'model':db[_0x583b1c[_0xa7d3('0x20')]],'as':_0x583b1c['as'],'attributes':_0x583b1c[_0xa7d3('0x1c')],'include':_0x583b1c[_0xa7d3('0x1e')]?_[_0xa7d3('0x1f')](_0x583b1c[_0xa7d3('0x1e')],function(_0x3a6556){return{'model':db[_0x3a6556['model']],'as':_0x3a6556['as'],'attributes':_0x3a6556[_0xa7d3('0x1c')],'include':_0x3a6556[_0xa7d3('0x1e')]?_[_0xa7d3('0x1f')](_0x3a6556[_0xa7d3('0x1e')],function(_0x3a4d73){return{'model':db[_0x3a4d73[_0xa7d3('0x20')]],'as':_0x3a4d73['as'],'attributes':_0x3a4d73[_0xa7d3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa7d3('0xe')](function(_0x292657){logger[_0xa7d3('0xf')]('GetSalesforceAccount',_0x52c597);logger[_0xa7d3('0x21')](_0xa7d3('0x17'),_0x52c597,JSON[_0xa7d3('0x22')](_0x292657));_0x5931f7(_0x292657);})[_0xa7d3('0x16')](function(_0x2ef758){logger[_0xa7d3('0x13')](_0xa7d3('0x17'),_0x2ef758[_0xa7d3('0x15')],_0x52c597);_0x2deff7(_0x1ef76b['error'](0x1f4,_0x2ef758[_0xa7d3('0x15')]));});});};exports[_0xa7d3('0x23')]=function(_0x5a6f6e){var _0x93eadc=this;return new Promise(function(_0x1d0f6d,_0x3a67c3){return db[_0xa7d3('0x18')][_0xa7d3('0x24')]({'raw':_0x5a6f6e['options']?_0x5a6f6e[_0xa7d3('0x1a')][_0xa7d3('0x25')]===undefined?!![]:![]:!![],'where':_0x5a6f6e[_0xa7d3('0x1a')]?_0x5a6f6e[_0xa7d3('0x1a')]['where']||null:null,'attributes':_0x5a6f6e[_0xa7d3('0x1a')]?_0x5a6f6e[_0xa7d3('0x1a')]['attributes']||null:null,'include':_0x5a6f6e[_0xa7d3('0x1a')]?_0x5a6f6e['options'][_0xa7d3('0x1e')]?_['map'](_0x5a6f6e['options'][_0xa7d3('0x1e')],function(_0x1c89ce){return{'model':db[_0x1c89ce['model']],'as':_0x1c89ce['as'],'attributes':_0x1c89ce[_0xa7d3('0x1c')],'include':_0x1c89ce['include']?_[_0xa7d3('0x1f')](_0x1c89ce[_0xa7d3('0x1e')],function(_0x329734){return{'model':db[_0x329734[_0xa7d3('0x20')]],'as':_0x329734['as'],'attributes':_0x329734[_0xa7d3('0x1c')],'include':_0x329734['include']?_[_0xa7d3('0x1f')](_0x329734[_0xa7d3('0x1e')],function(_0x38196d){return{'model':db[_0x38196d[_0xa7d3('0x20')]],'as':_0x38196d['as'],'attributes':_0x38196d[_0xa7d3('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x333329){logger['info']('ShowSalesforceAccount',_0x5a6f6e);logger[_0xa7d3('0x21')](_0xa7d3('0x23'),_0x5a6f6e,JSON['stringify'](_0x333329));_0x1d0f6d(_0x333329);})[_0xa7d3('0x16')](function(_0x34d719){logger[_0xa7d3('0x13')](_0xa7d3('0x23'),_0x34d719[_0xa7d3('0x15')],_0x5a6f6e);_0x3a67c3(_0x93eadc[_0xa7d3('0x13')](0x1f4,_0x34d719[_0xa7d3('0x15')]));});});};
\ No newline at end of file
index cfb7c72..a7895de 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3bf6=['getFields','/:id/subjects','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields'];(function(_0x1ec4a7,_0x48c768){var _0x30ec83=function(_0x458af0){while(--_0x458af0){_0x1ec4a7['push'](_0x1ec4a7['shift']());}};_0x30ec83(++_0x48c768);}(_0x3bf6,0x181));var _0x63bf=function(_0x34c544,_0x247d25){_0x34c544=_0x34c544-0x0;var _0x335312=_0x3bf6[_0x34c544];return _0x335312;};'use strict';var multer=require(_0x63bf('0x0'));var util=require(_0x63bf('0x1'));var path=require(_0x63bf('0x2'));var timeout=require(_0x63bf('0x3'));var express=require(_0x63bf('0x4'));var router=express['Router']();var auth=require(_0x63bf('0x5'));var interaction=require(_0x63bf('0x6'));var config=require(_0x63bf('0x7'));var controller=require(_0x63bf('0x8'));router[_0x63bf('0x9')]('/',auth[_0x63bf('0xa')](),controller[_0x63bf('0xb')]);router[_0x63bf('0x9')]('/:id',auth[_0x63bf('0xa')](),controller[_0x63bf('0xc')]);router[_0x63bf('0x9')](_0x63bf('0xd'),auth['isAuthenticated'](),controller[_0x63bf('0xe')]);router[_0x63bf('0x9')](_0x63bf('0xf'),auth[_0x63bf('0xa')](),controller['getSubjects']);router[_0x63bf('0x9')]('/:id/descriptions',auth[_0x63bf('0xa')](),controller['getDescriptions']);router['post']('/',auth[_0x63bf('0xa')](),controller[_0x63bf('0x10')]);router[_0x63bf('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x63bf('0x12')]('/:id',auth[_0x63bf('0xa')](),controller[_0x63bf('0x13')]);module[_0x63bf('0x14')]=router;
\ No newline at end of file
+var _0x80ab=['getDescriptions','post','create','put','update','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x80ab,0xa8));var _0xb80a=function(_0x50fd7a,_0x50ef6c){_0x50fd7a=_0x50fd7a-0x0;var _0x49721c=_0x80ab[_0x50fd7a];return _0x49721c;};'use strict';var multer=require(_0xb80a('0x0'));var util=require(_0xb80a('0x1'));var path=require('path');var timeout=require(_0xb80a('0x2'));var express=require('express');var router=express[_0xb80a('0x3')]();var auth=require(_0xb80a('0x4'));var interaction=require(_0xb80a('0x5'));var config=require('../../config/environment');var controller=require(_0xb80a('0x6'));router[_0xb80a('0x7')]('/',auth[_0xb80a('0x8')](),controller[_0xb80a('0x9')]);router[_0xb80a('0x7')](_0xb80a('0xa'),auth[_0xb80a('0x8')](),controller[_0xb80a('0xb')]);router[_0xb80a('0x7')](_0xb80a('0xc'),auth[_0xb80a('0x8')](),controller[_0xb80a('0xd')]);router[_0xb80a('0x7')](_0xb80a('0xe'),auth[_0xb80a('0x8')](),controller[_0xb80a('0xf')]);router['get']('/:id/descriptions',auth[_0xb80a('0x8')](),controller[_0xb80a('0x10')]);router[_0xb80a('0x11')]('/',auth[_0xb80a('0x8')](),controller[_0xb80a('0x12')]);router[_0xb80a('0x13')](_0xb80a('0xa'),auth['isAuthenticated'](),controller[_0xb80a('0x14')]);router[_0xb80a('0x15')](_0xb80a('0xa'),auth[_0xb80a('0x8')](),controller[_0xb80a('0x16')]);module['exports']=router;
\ No newline at end of file
index 98bf832..e5fd505 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7e0c=['contact','sequelize','exports','STRING','ENUM','contact_lead','lead','nothing'];(function(_0x19d181,_0xbd9929){var _0x21f0b3=function(_0x27ca09){while(--_0x27ca09){_0x19d181['push'](_0x19d181['shift']());}};_0x21f0b3(++_0xbd9929);}(_0x7e0c,0x111));var _0xc7e0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7e0c[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xc7e0('0x0'));module[_0xc7e0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc7e0('0x2')]},'moduleSearch':{'type':Sequelize[_0xc7e0('0x3')](_0xc7e0('0x4'),'contact',_0xc7e0('0x5')),'defaultValue':_0xc7e0('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0xc7e0('0x6'),_0xc7e0('0x7'),_0xc7e0('0x5')),'defaultValue':'lead'}};
\ No newline at end of file
+var _0x1040=['STRING','ENUM','contact_lead','contact','lead','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1040,0x116));var _0x0104=function(_0x4def54,_0x36de1d){_0x4def54=_0x4def54-0x0;var _0x137bee=_0x1040[_0x4def54];return _0x137bee;};'use strict';var Sequelize=require(_0x0104('0x0'));module[_0x0104('0x1')]={'name':{'type':Sequelize[_0x0104('0x2')]},'description':{'type':Sequelize['STRING']},'moduleSearch':{'type':Sequelize[_0x0104('0x3')](_0x0104('0x4'),_0x0104('0x5'),_0x0104('0x6')),'defaultValue':_0x0104('0x4')},'moduleCreate':{'type':Sequelize[_0x0104('0x3')]('nothing','contact',_0x0104('0x6')),'defaultValue':'lead'}};
\ No newline at end of file
index d44b4d6..33bb7f7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7217=['offset','limit','set','Content-Range','reject','destroy','stack','name','send','index','SalesforceConfiguration','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','field','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','getFields','hasOwnProperty','getSubjects','findOne','SalesforceField','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','then','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','SalesforceConfiguration,\x20%s,\x20%s','result','sendStatus','status','end','json'];(function(_0x3a2ed1,_0x1a5716){var _0x2e01b4=function(_0x198a1e){while(--_0x198a1e){_0x3a2ed1['push'](_0x3a2ed1['shift']());}};_0x2e01b4(++_0x1a5716);}(_0x7217,0x19e));var _0x7721=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x7217[_0x6c993a];return _0x27f547;};'use strict';var pdf=require(_0x7721('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7721('0x1'));var zipdir=require(_0x7721('0x2'));var jsonpatch=require(_0x7721('0x3'));var rp=require(_0x7721('0x4'));var moment=require(_0x7721('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7721('0x6'));var path=require(_0x7721('0x7'));var sox=require(_0x7721('0x8'));var csv=require(_0x7721('0x9'));var ejs=require(_0x7721('0xa'));var fs=require('fs');var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x9'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var authService=require(_0x7721('0x12'));var hardwareService=require(_0x7721('0x13'));var Redis=require('ioredis');var qs=require(_0x7721('0x14'));var logger=require(_0x7721('0x15'))(_0x7721('0x16'));var utils=require(_0x7721('0x17'));var config=require(_0x7721('0x18'));var db=require(_0x7721('0x19'))['db'];var jayson=require(_0x7721('0x1a'));var client=jayson[_0x7721('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2911ec,_0x199930,_0x57ff6d,_0x109900){return new BPromise(function(_0x30da54,_0x3f01c5){var _0x2e9752=_0x109900||client;return _0x2e9752['request'](_0x2911ec,_0x57ff6d)[_0x7721('0x1c')](function(_0x25b1c0){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x199930,'request\x20sent');logger[_0x7721('0x1d')](_0x7721('0x1e'),_0x199930,_0x7721('0x1f'),JSON[_0x7721('0x20')](_0x25b1c0));if(_0x25b1c0['error']){if(_0x25b1c0[_0x7721('0x21')]['code']===0x1f4){logger[_0x7721('0x21')]('SalesforceConfiguration,\x20%s,\x20%s',_0x199930,_0x25b1c0[_0x7721('0x21')][_0x7721('0x22')]);return _0x3f01c5(_0x25b1c0[_0x7721('0x21')][_0x7721('0x22')]);}logger[_0x7721('0x21')](_0x7721('0x23'),_0x199930,_0x25b1c0[_0x7721('0x21')][_0x7721('0x22')]);return _0x30da54(_0x25b1c0[_0x7721('0x21')][_0x7721('0x22')]);}else{logger['info'](_0x7721('0x23'),_0x199930,_0x7721('0x1f'));_0x30da54(_0x25b1c0[_0x7721('0x24')][_0x7721('0x22')]);}})['catch'](function(_0x28f5a6){logger['error'](_0x7721('0x23'),_0x199930,_0x28f5a6);_0x3f01c5(_0x28f5a6);});});}function respondWithStatusCode(_0x288e3a,_0x3e8a4e){_0x3e8a4e=_0x3e8a4e||0xcc;return function(_0x1caad8){if(_0x1caad8){return _0x288e3a[_0x7721('0x25')](_0x3e8a4e);}return _0x288e3a[_0x7721('0x26')](_0x3e8a4e)[_0x7721('0x27')]();};}function respondWithResult(_0x5b4d74,_0x216f20){_0x216f20=_0x216f20||0xc8;return function(_0x1abedb){if(_0x1abedb){return _0x5b4d74[_0x7721('0x26')](_0x216f20)[_0x7721('0x28')](_0x1abedb);}};}function respondWithFilteredResult(_0x40d550,_0x16355a){return function(_0x424e05){if(_0x424e05){var _0xf753f1=_0x424e05['count'],_0x40f367=_0x16355a['offset'],_0x52316e=_0x16355a[_0x7721('0x29')]+_0x16355a[_0x7721('0x2a')],_0x258ddf;if(_0x52316e>=_0xf753f1){_0x52316e=_0xf753f1;_0x258ddf=0xc8;}else{_0x258ddf=0xce;}_0x40d550[_0x7721('0x26')](_0x258ddf);return _0x40d550[_0x7721('0x2b')](_0x7721('0x2c'),_0x40f367+'-'+_0x52316e+'/'+_0xf753f1)[_0x7721('0x28')](_0x424e05);}return null;};}function patchUpdates(_0xd7d703){return function(_0x1da2d8){try{jsonpatch['apply'](_0x1da2d8,_0xd7d703,!![]);}catch(_0x471651){return BPromise[_0x7721('0x2d')](_0x471651);}return _0x1da2d8['save']();};}function saveUpdates(_0x4a25c9,_0xfde9ec){return function(_0x220bbf){if(_0x220bbf){return _0x220bbf['update'](_0x4a25c9)[_0x7721('0x1c')](function(_0x4651b5){return _0x4651b5;});}return null;};}function removeEntity(_0x382821,_0x58d54b){return function(_0x3d9a32){if(_0x3d9a32){return _0x3d9a32[_0x7721('0x2e')]()[_0x7721('0x1c')](function(){_0x382821[_0x7721('0x26')](0xcc)[_0x7721('0x27')]();});}};}function handleEntityNotFound(_0x508202,_0x195ffb){return function(_0x3e4e56){if(!_0x3e4e56){_0x508202[_0x7721('0x25')](0x194);}return _0x3e4e56;};}function handleError(_0x5c5b33,_0x35de7a){_0x35de7a=_0x35de7a||0x1f4;return function(_0x213a2e){logger['error'](_0x213a2e[_0x7721('0x2f')]);if(_0x213a2e['name']){delete _0x213a2e[_0x7721('0x30')];}_0x5c5b33[_0x7721('0x26')](_0x35de7a)[_0x7721('0x31')](_0x213a2e);};}exports[_0x7721('0x32')]=function(_0x1c84c0,_0x13c635){var _0x2f1fe0={},_0x15545a={},_0x25bdd9={'count':0x0,'rows':[]};var _0x3a2eb7=db[_0x7721('0x33')]['rawAttributes'];_0x15545a[_0x7721('0x34')]=_['keys'](_0x3a2eb7);_0x15545a[_0x7721('0x35')]=_[_0x7721('0x36')](_0x1c84c0[_0x7721('0x35')]);_0x15545a[_0x7721('0x37')]=_[_0x7721('0x38')](_0x15545a[_0x7721('0x34')],_0x15545a['query']);_0x2f1fe0['attributes']=_['intersection'](_0x15545a['model'],qs[_0x7721('0x39')](_0x1c84c0[_0x7721('0x35')][_0x7721('0x39')]));_0x2f1fe0[_0x7721('0x3a')]=_0x2f1fe0['attributes'][_0x7721('0x3b')]?_0x2f1fe0['attributes']:_0x15545a[_0x7721('0x34')];if(!_0x1c84c0[_0x7721('0x35')]['hasOwnProperty'](_0x7721('0x3c'))){_0x2f1fe0[_0x7721('0x2a')]=qs['limit'](_0x1c84c0['query'][_0x7721('0x2a')]);_0x2f1fe0[_0x7721('0x29')]=qs[_0x7721('0x29')](_0x1c84c0[_0x7721('0x35')]['offset']);}_0x2f1fe0[_0x7721('0x3d')]=qs[_0x7721('0x3e')](_0x1c84c0[_0x7721('0x35')][_0x7721('0x3e')]);_0x2f1fe0[_0x7721('0x3f')]=qs['filters'](_[_0x7721('0x40')](_0x1c84c0['query'],_0x15545a[_0x7721('0x37')]));if(_0x1c84c0['query'][_0x7721('0x41')]){_0x2f1fe0[_0x7721('0x3f')]=_[_0x7721('0x42')](_0x2f1fe0['where'],{'$or':_[_0x7721('0x43')](_0x3a2eb7,function(_0x11d853){if(_0x11d853[_0x7721('0x44')]['key']!==_0x7721('0x45')){var _0x754071={};_0x754071[_0x11d853[_0x7721('0x46')]]={'$like':'%'+_0x1c84c0[_0x7721('0x35')][_0x7721('0x41')]+'%'};return _0x754071;}})});}_0x2f1fe0=_[_0x7721('0x42')]({},_0x2f1fe0,_0x1c84c0[_0x7721('0x47')]);var _0x4c76c3={'where':_0x2f1fe0['where']};return db[_0x7721('0x33')][_0x7721('0x48')](_0x4c76c3)[_0x7721('0x1c')](function(_0x39a3ad){_0x25bdd9[_0x7721('0x48')]=_0x39a3ad;if(_0x1c84c0[_0x7721('0x35')][_0x7721('0x49')]){_0x2f1fe0[_0x7721('0x4a')]=[{'all':!![]}];}return db[_0x7721('0x33')][_0x7721('0x4b')](_0x2f1fe0);})['then'](function(_0x578867){_0x25bdd9[_0x7721('0x4c')]=_0x578867;return _0x25bdd9;})[_0x7721('0x1c')](respondWithFilteredResult(_0x13c635,_0x2f1fe0))[_0x7721('0x4d')](handleError(_0x13c635,null));};exports[_0x7721('0x4e')]=function(_0x589e95,_0x30107e){var _0x2d5a88={'raw':![],'where':{'id':_0x589e95[_0x7721('0x4f')]['id']}},_0x56c3d9={};_0x56c3d9['model']=_[_0x7721('0x36')](db['SalesforceConfiguration'][_0x7721('0x50')]);_0x56c3d9[_0x7721('0x35')]=_[_0x7721('0x36')](_0x589e95['query']);_0x56c3d9[_0x7721('0x37')]=_[_0x7721('0x38')](_0x56c3d9['model'],_0x56c3d9[_0x7721('0x35')]);_0x2d5a88[_0x7721('0x3a')]=_[_0x7721('0x38')](_0x56c3d9['model'],qs[_0x7721('0x39')](_0x589e95['query'][_0x7721('0x39')]));_0x2d5a88[_0x7721('0x3a')]=_0x2d5a88[_0x7721('0x3a')][_0x7721('0x3b')]?_0x2d5a88[_0x7721('0x3a')]:_0x56c3d9[_0x7721('0x34')];if(_0x589e95[_0x7721('0x35')][_0x7721('0x49')]){_0x2d5a88[_0x7721('0x4a')]=[{'all':!![]}];}_0x2d5a88=_[_0x7721('0x42')]({},_0x2d5a88,_0x589e95[_0x7721('0x47')]);return db[_0x7721('0x33')][_0x7721('0x51')](_0x2d5a88)[_0x7721('0x1c')](handleEntityNotFound(_0x30107e,null))[_0x7721('0x1c')](respondWithResult(_0x30107e,null))['catch'](handleError(_0x30107e,null));};exports[_0x7721('0x52')]=function(_0x2f6f30,_0x8e1214){return db[_0x7721('0x33')][_0x7721('0x52')](_0x2f6f30[_0x7721('0x53')],{})[_0x7721('0x1c')](respondWithResult(_0x8e1214,0xc9))['catch'](handleError(_0x8e1214,null));};exports[_0x7721('0x54')]=function(_0x17036e,_0x134908){if(_0x17036e[_0x7721('0x53')]['id']){delete _0x17036e[_0x7721('0x53')]['id'];}return db[_0x7721('0x33')][_0x7721('0x51')]({'where':{'id':_0x17036e[_0x7721('0x4f')]['id']}})[_0x7721('0x1c')](handleEntityNotFound(_0x134908,null))[_0x7721('0x1c')](saveUpdates(_0x17036e[_0x7721('0x53')],null))['then'](respondWithResult(_0x134908,null))[_0x7721('0x4d')](handleError(_0x134908,null));};exports[_0x7721('0x2e')]=function(_0x1234bc,_0x2ee3c0){return db[_0x7721('0x33')][_0x7721('0x51')]({'where':{'id':_0x1234bc[_0x7721('0x4f')]['id']}})[_0x7721('0x1c')](handleEntityNotFound(_0x2ee3c0,null))[_0x7721('0x1c')](removeEntity(_0x2ee3c0,null))[_0x7721('0x4d')](handleError(_0x2ee3c0,null));};exports[_0x7721('0x55')]=function(_0x2e5c28,_0x106664,_0x18f7f6){var _0x300ea4={};var _0x577f47={};var _0x50e9e9;var _0x4e112e;return db[_0x7721('0x33')]['findOne']({'where':{'id':_0x2e5c28['params']['id']}})['then'](handleEntityNotFound(_0x106664,null))['then'](function(_0x47925a){if(_0x47925a){_0x50e9e9=_0x47925a;_0x577f47[_0x7721('0x34')]=_[_0x7721('0x36')](db['SalesforceField'][_0x7721('0x50')]);_0x577f47['query']=_['keys'](_0x2e5c28['query']);_0x577f47[_0x7721('0x37')]=_['intersection'](_0x577f47['model'],_0x577f47['query']);_0x300ea4[_0x7721('0x3a')]=_[_0x7721('0x38')](_0x577f47[_0x7721('0x34')],qs['fields'](_0x2e5c28[_0x7721('0x35')][_0x7721('0x39')]));_0x300ea4[_0x7721('0x3a')]=_0x300ea4[_0x7721('0x3a')][_0x7721('0x3b')]?_0x300ea4[_0x7721('0x3a')]:_0x577f47[_0x7721('0x34')];_0x300ea4[_0x7721('0x3d')]=qs[_0x7721('0x3e')](_0x2e5c28[_0x7721('0x35')][_0x7721('0x3e')]);_0x300ea4[_0x7721('0x3f')]=qs[_0x7721('0x37')](_[_0x7721('0x40')](_0x2e5c28[_0x7721('0x35')],_0x577f47['filters']));if(_0x2e5c28[_0x7721('0x35')][_0x7721('0x41')]){_0x300ea4[_0x7721('0x3f')]=_[_0x7721('0x42')](_0x300ea4['where'],{'$or':_[_0x7721('0x43')](_0x300ea4[_0x7721('0x3a')],function(_0x4c8284){var _0x3e7df3={};_0x3e7df3[_0x4c8284]={'$like':'%'+_0x2e5c28['query'][_0x7721('0x41')]+'%'};return _0x3e7df3;})});}_0x300ea4=_[_0x7721('0x42')]({},_0x300ea4,_0x2e5c28[_0x7721('0x47')]);return _0x50e9e9[_0x7721('0x55')](_0x300ea4);}})[_0x7721('0x1c')](function(_0x158aae){if(_0x158aae){_0x4e112e=_0x158aae[_0x7721('0x3b')];if(!_0x2e5c28[_0x7721('0x35')][_0x7721('0x56')]('nolimit')){_0x300ea4[_0x7721('0x2a')]=qs[_0x7721('0x2a')](_0x2e5c28[_0x7721('0x35')][_0x7721('0x2a')]);_0x300ea4[_0x7721('0x29')]=qs[_0x7721('0x29')](_0x2e5c28[_0x7721('0x35')]['offset']);}return _0x50e9e9[_0x7721('0x55')](_0x300ea4);}})[_0x7721('0x1c')](function(_0x53c918){if(_0x53c918){return _0x53c918?{'count':_0x4e112e,'rows':_0x53c918}:null;}})[_0x7721('0x1c')](respondWithResult(_0x106664,null))['catch'](handleError(_0x106664,null));};exports[_0x7721('0x57')]=function(_0x382800,_0x4282ba,_0x3b64ec){var _0x1e2436={};var _0x2bab14={};var _0x258c57;var _0x5dca04;return db[_0x7721('0x33')][_0x7721('0x58')]({'where':{'id':_0x382800[_0x7721('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4282ba,null))['then'](function(_0x515fb9){if(_0x515fb9){_0x258c57=_0x515fb9;_0x2bab14['model']=_['keys'](db[_0x7721('0x59')][_0x7721('0x50')]);_0x2bab14['query']=_[_0x7721('0x36')](_0x382800[_0x7721('0x35')]);_0x2bab14[_0x7721('0x37')]=_[_0x7721('0x38')](_0x2bab14['model'],_0x2bab14[_0x7721('0x35')]);_0x1e2436[_0x7721('0x3a')]=_[_0x7721('0x38')](_0x2bab14[_0x7721('0x34')],qs[_0x7721('0x39')](_0x382800['query'][_0x7721('0x39')]));_0x1e2436[_0x7721('0x3a')]=_0x1e2436[_0x7721('0x3a')]['length']?_0x1e2436['attributes']:_0x2bab14[_0x7721('0x34')];_0x1e2436[_0x7721('0x3d')]=qs[_0x7721('0x3e')](_0x382800[_0x7721('0x35')][_0x7721('0x3e')]);_0x1e2436['where']=qs['filters'](_[_0x7721('0x40')](_0x382800[_0x7721('0x35')],_0x2bab14[_0x7721('0x37')]));if(_0x382800[_0x7721('0x35')][_0x7721('0x41')]){_0x1e2436[_0x7721('0x3f')]=_[_0x7721('0x42')](_0x1e2436['where'],{'$or':_[_0x7721('0x43')](_0x1e2436[_0x7721('0x3a')],function(_0x27d7f1){var _0x5e85d9={};_0x5e85d9[_0x27d7f1]={'$like':'%'+_0x382800[_0x7721('0x35')][_0x7721('0x41')]+'%'};return _0x5e85d9;})});}_0x1e2436=_[_0x7721('0x42')]({},_0x1e2436,_0x382800[_0x7721('0x47')]);return _0x258c57['getSubjects'](_0x1e2436);}})['then'](function(_0x37f8f8){if(_0x37f8f8){_0x5dca04=_0x37f8f8[_0x7721('0x3b')];if(!_0x382800[_0x7721('0x35')][_0x7721('0x56')](_0x7721('0x3c'))){_0x1e2436[_0x7721('0x2a')]=qs['limit'](_0x382800[_0x7721('0x35')][_0x7721('0x2a')]);_0x1e2436[_0x7721('0x29')]=qs['offset'](_0x382800[_0x7721('0x35')][_0x7721('0x29')]);}return _0x258c57[_0x7721('0x57')](_0x1e2436);}})[_0x7721('0x1c')](function(_0x457d7f){if(_0x457d7f){return _0x457d7f?{'count':_0x5dca04,'rows':_0x457d7f}:null;}})['then'](respondWithResult(_0x4282ba,null))[_0x7721('0x4d')](handleError(_0x4282ba,null));};exports['getDescriptions']=function(_0x12a3f7,_0x47764b,_0x2d5433){var _0x7f0598={};var _0x963dbe={};var _0x438b9f;var _0x24fe2a;return db[_0x7721('0x33')][_0x7721('0x58')]({'where':{'id':_0x12a3f7[_0x7721('0x4f')]['id']}})[_0x7721('0x1c')](handleEntityNotFound(_0x47764b,null))['then'](function(_0x19fad6){if(_0x19fad6){_0x438b9f=_0x19fad6;_0x963dbe[_0x7721('0x34')]=_[_0x7721('0x36')](db['SalesforceField'][_0x7721('0x50')]);_0x963dbe[_0x7721('0x35')]=_[_0x7721('0x36')](_0x12a3f7[_0x7721('0x35')]);_0x963dbe[_0x7721('0x37')]=_['intersection'](_0x963dbe[_0x7721('0x34')],_0x963dbe[_0x7721('0x35')]);_0x7f0598[_0x7721('0x3a')]=_[_0x7721('0x38')](_0x963dbe[_0x7721('0x34')],qs[_0x7721('0x39')](_0x12a3f7['query'][_0x7721('0x39')]));_0x7f0598[_0x7721('0x3a')]=_0x7f0598['attributes'][_0x7721('0x3b')]?_0x7f0598['attributes']:_0x963dbe[_0x7721('0x34')];_0x7f0598[_0x7721('0x3d')]=qs['sort'](_0x12a3f7[_0x7721('0x35')]['sort']);_0x7f0598['where']=qs['filters'](_[_0x7721('0x40')](_0x12a3f7[_0x7721('0x35')],_0x963dbe[_0x7721('0x37')]));if(_0x12a3f7['query']['filter']){_0x7f0598['where']=_[_0x7721('0x42')](_0x7f0598[_0x7721('0x3f')],{'$or':_[_0x7721('0x43')](_0x7f0598[_0x7721('0x3a')],function(_0x3b02d7){var _0x259ee8={};_0x259ee8[_0x3b02d7]={'$like':'%'+_0x12a3f7['query'][_0x7721('0x41')]+'%'};return _0x259ee8;})});}_0x7f0598=_[_0x7721('0x42')]({},_0x7f0598,_0x12a3f7[_0x7721('0x47')]);return _0x438b9f[_0x7721('0x5a')](_0x7f0598);}})[_0x7721('0x1c')](function(_0x1a0232){if(_0x1a0232){_0x24fe2a=_0x1a0232[_0x7721('0x3b')];if(!_0x12a3f7[_0x7721('0x35')][_0x7721('0x56')](_0x7721('0x3c'))){_0x7f0598[_0x7721('0x2a')]=qs[_0x7721('0x2a')](_0x12a3f7['query']['limit']);_0x7f0598[_0x7721('0x29')]=qs[_0x7721('0x29')](_0x12a3f7['query'][_0x7721('0x29')]);}return _0x438b9f['getDescriptions'](_0x7f0598);}})['then'](function(_0x154b4b){if(_0x154b4b){return _0x154b4b?{'count':_0x24fe2a,'rows':_0x154b4b}:null;}})['then'](respondWithResult(_0x47764b,null))['catch'](handleError(_0x47764b,null));};
\ No newline at end of file
+var _0xe14b=['SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','field','SalesforceConfiguration','findAll','rows','show','params','rawAttributes','includeAll','include','options','find','catch','create','body','getFields','findOne','SalesforceField','filter','map','getSubjects','getDescriptions','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info'];(function(_0x2f664b,_0x370d66){var _0x23ec34=function(_0x4788f5){while(--_0x4788f5){_0x2f664b['push'](_0x2f664b['shift']());}};_0x23ec34(++_0x370d66);}(_0xe14b,0x93));var _0xbe14=function(_0x3d9ad1,_0x3f63a9){_0x3d9ad1=_0x3d9ad1-0x0;var _0x231f78=_0xe14b[_0x3d9ad1];return _0x231f78;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var authService=require(_0xbe14('0xe'));var hardwareService=require(_0xbe14('0xf'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xbe14('0x10'))(_0xbe14('0x11'));var utils=require('../../config/utils');var config=require(_0xbe14('0x12'));var db=require(_0xbe14('0x13'))['db'];var jayson=require(_0xbe14('0x14'));var client=jayson[_0xbe14('0x15')][_0xbe14('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x3b898d,_0x23a730,_0x2850cb,_0x16893f){return new BPromise(function(_0xa2cf72,_0x1e4826){var _0x33fd54=_0x16893f||client;return _0x33fd54[_0xbe14('0x17')](_0x3b898d,_0x2850cb)['then'](function(_0x55b3a7){logger[_0xbe14('0x18')](_0xbe14('0x19'),_0x23a730,_0xbe14('0x1a'));logger[_0xbe14('0x1b')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x23a730,_0xbe14('0x1a'),JSON[_0xbe14('0x1c')](_0x55b3a7));if(_0x55b3a7[_0xbe14('0x1d')]){if(_0x55b3a7[_0xbe14('0x1d')][_0xbe14('0x1e')]===0x1f4){logger[_0xbe14('0x1d')](_0xbe14('0x19'),_0x23a730,_0x55b3a7['error'][_0xbe14('0x1f')]);return _0x1e4826(_0x55b3a7[_0xbe14('0x1d')][_0xbe14('0x1f')]);}logger[_0xbe14('0x1d')](_0xbe14('0x19'),_0x23a730,_0x55b3a7[_0xbe14('0x1d')]['message']);return _0xa2cf72(_0x55b3a7[_0xbe14('0x1d')][_0xbe14('0x1f')]);}else{logger[_0xbe14('0x18')](_0xbe14('0x19'),_0x23a730,_0xbe14('0x1a'));_0xa2cf72(_0x55b3a7['result'][_0xbe14('0x1f')]);}})['catch'](function(_0x3c1c85){logger['error'](_0xbe14('0x19'),_0x23a730,_0x3c1c85);_0x1e4826(_0x3c1c85);});});}function respondWithStatusCode(_0x4a25fa,_0x274018){_0x274018=_0x274018||0xcc;return function(_0x3d3608){if(_0x3d3608){return _0x4a25fa['sendStatus'](_0x274018);}return _0x4a25fa[_0xbe14('0x20')](_0x274018)['end']();};}function respondWithResult(_0x4587a8,_0x4851f8){_0x4851f8=_0x4851f8||0xc8;return function(_0x36a21e){if(_0x36a21e){return _0x4587a8[_0xbe14('0x20')](_0x4851f8)[_0xbe14('0x21')](_0x36a21e);}};}function respondWithFilteredResult(_0x39cc81,_0x15ef02){return function(_0x2703f5){if(_0x2703f5){var _0x55d001=_0x2703f5[_0xbe14('0x22')],_0x1822e0=_0x15ef02['offset'],_0x1ba46a=_0x15ef02[_0xbe14('0x23')]+_0x15ef02[_0xbe14('0x24')],_0x391556;if(_0x1ba46a>=_0x55d001){_0x1ba46a=_0x55d001;_0x391556=0xc8;}else{_0x391556=0xce;}_0x39cc81['status'](_0x391556);return _0x39cc81[_0xbe14('0x25')](_0xbe14('0x26'),_0x1822e0+'-'+_0x1ba46a+'/'+_0x55d001)[_0xbe14('0x21')](_0x2703f5);}return null;};}function patchUpdates(_0x19252f){return function(_0x34d648){try{jsonpatch[_0xbe14('0x27')](_0x34d648,_0x19252f,!![]);}catch(_0x31a664){return BPromise[_0xbe14('0x28')](_0x31a664);}return _0x34d648[_0xbe14('0x29')]();};}function saveUpdates(_0x16a159,_0x40538f){return function(_0x3bf43c){if(_0x3bf43c){return _0x3bf43c[_0xbe14('0x2a')](_0x16a159)[_0xbe14('0x2b')](function(_0x223f7a){return _0x223f7a;});}return null;};}function removeEntity(_0xe6feb2,_0x6ba36c){return function(_0x2ff48e){if(_0x2ff48e){return _0x2ff48e[_0xbe14('0x2c')]()[_0xbe14('0x2b')](function(){_0xe6feb2['status'](0xcc)[_0xbe14('0x2d')]();});}};}function handleEntityNotFound(_0x499793,_0x58f8de){return function(_0x46c2d1){if(!_0x46c2d1){_0x499793['sendStatus'](0x194);}return _0x46c2d1;};}function handleError(_0x243524,_0x345b0){_0x345b0=_0x345b0||0x1f4;return function(_0x52a25c){logger['error'](_0x52a25c['stack']);if(_0x52a25c[_0xbe14('0x2e')]){delete _0x52a25c[_0xbe14('0x2e')];}_0x243524['status'](_0x345b0)[_0xbe14('0x2f')](_0x52a25c);};}exports[_0xbe14('0x30')]=function(_0x452635,_0x1aa849){var _0x29c23e={},_0x5ef1e5={},_0x591a36={'count':0x0,'rows':[]};var _0x15a997=db['SalesforceConfiguration']['rawAttributes'];_0x5ef1e5['model']=_[_0xbe14('0x31')](_0x15a997);_0x5ef1e5[_0xbe14('0x32')]=_[_0xbe14('0x31')](_0x452635[_0xbe14('0x32')]);_0x5ef1e5[_0xbe14('0x33')]=_[_0xbe14('0x34')](_0x5ef1e5[_0xbe14('0x35')],_0x5ef1e5[_0xbe14('0x32')]);_0x29c23e[_0xbe14('0x36')]=_[_0xbe14('0x34')](_0x5ef1e5[_0xbe14('0x35')],qs[_0xbe14('0x37')](_0x452635['query']['fields']));_0x29c23e[_0xbe14('0x36')]=_0x29c23e[_0xbe14('0x36')][_0xbe14('0x38')]?_0x29c23e['attributes']:_0x5ef1e5[_0xbe14('0x35')];if(!_0x452635[_0xbe14('0x32')][_0xbe14('0x39')](_0xbe14('0x3a'))){_0x29c23e[_0xbe14('0x24')]=qs[_0xbe14('0x24')](_0x452635[_0xbe14('0x32')][_0xbe14('0x24')]);_0x29c23e[_0xbe14('0x23')]=qs['offset'](_0x452635[_0xbe14('0x32')][_0xbe14('0x23')]);}_0x29c23e[_0xbe14('0x3b')]=qs[_0xbe14('0x3c')](_0x452635[_0xbe14('0x32')][_0xbe14('0x3c')]);_0x29c23e['where']=qs[_0xbe14('0x33')](_[_0xbe14('0x3d')](_0x452635[_0xbe14('0x32')],_0x5ef1e5[_0xbe14('0x33')]));if(_0x452635['query']['filter']){_0x29c23e[_0xbe14('0x3e')]=_[_0xbe14('0x3f')](_0x29c23e[_0xbe14('0x3e')],{'$or':_['map'](_0x15a997,function(_0x5d5318){if(_0x5d5318[_0xbe14('0x40')]['key']!=='VIRTUAL'){var _0x3593f8={};_0x3593f8[_0x5d5318[_0xbe14('0x41')]]={'$like':'%'+_0x452635[_0xbe14('0x32')]['filter']+'%'};return _0x3593f8;}})});}_0x29c23e=_['merge']({},_0x29c23e,_0x452635['options']);var _0x46fee8={'where':_0x29c23e[_0xbe14('0x3e')]};return db[_0xbe14('0x42')]['count'](_0x46fee8)[_0xbe14('0x2b')](function(_0xcb0680){_0x591a36[_0xbe14('0x22')]=_0xcb0680;if(_0x452635[_0xbe14('0x32')]['includeAll']){_0x29c23e['include']=[{'all':!![]}];}return db[_0xbe14('0x42')][_0xbe14('0x43')](_0x29c23e);})[_0xbe14('0x2b')](function(_0xb2b285){_0x591a36[_0xbe14('0x44')]=_0xb2b285;return _0x591a36;})['then'](respondWithFilteredResult(_0x1aa849,_0x29c23e))['catch'](handleError(_0x1aa849,null));};exports[_0xbe14('0x45')]=function(_0x2a3623,_0x238c60){var _0x2a3b35={'raw':![],'where':{'id':_0x2a3623[_0xbe14('0x46')]['id']}},_0x4e65d2={};_0x4e65d2[_0xbe14('0x35')]=_['keys'](db[_0xbe14('0x42')][_0xbe14('0x47')]);_0x4e65d2[_0xbe14('0x32')]=_[_0xbe14('0x31')](_0x2a3623['query']);_0x4e65d2['filters']=_[_0xbe14('0x34')](_0x4e65d2[_0xbe14('0x35')],_0x4e65d2['query']);_0x2a3b35['attributes']=_[_0xbe14('0x34')](_0x4e65d2[_0xbe14('0x35')],qs[_0xbe14('0x37')](_0x2a3623[_0xbe14('0x32')][_0xbe14('0x37')]));_0x2a3b35[_0xbe14('0x36')]=_0x2a3b35[_0xbe14('0x36')]['length']?_0x2a3b35[_0xbe14('0x36')]:_0x4e65d2[_0xbe14('0x35')];if(_0x2a3623[_0xbe14('0x32')][_0xbe14('0x48')]){_0x2a3b35[_0xbe14('0x49')]=[{'all':!![]}];}_0x2a3b35=_['merge']({},_0x2a3b35,_0x2a3623[_0xbe14('0x4a')]);return db[_0xbe14('0x42')][_0xbe14('0x4b')](_0x2a3b35)[_0xbe14('0x2b')](handleEntityNotFound(_0x238c60,null))[_0xbe14('0x2b')](respondWithResult(_0x238c60,null))[_0xbe14('0x4c')](handleError(_0x238c60,null));};exports['create']=function(_0x5aeea9,_0x3a49f7){return db[_0xbe14('0x42')][_0xbe14('0x4d')](_0x5aeea9['body'],{})['then'](respondWithResult(_0x3a49f7,0xc9))[_0xbe14('0x4c')](handleError(_0x3a49f7,null));};exports[_0xbe14('0x2a')]=function(_0x50d78f,_0x339a86){if(_0x50d78f[_0xbe14('0x4e')]['id']){delete _0x50d78f['body']['id'];}return db[_0xbe14('0x42')]['find']({'where':{'id':_0x50d78f[_0xbe14('0x46')]['id']}})[_0xbe14('0x2b')](handleEntityNotFound(_0x339a86,null))[_0xbe14('0x2b')](saveUpdates(_0x50d78f['body'],null))[_0xbe14('0x2b')](respondWithResult(_0x339a86,null))[_0xbe14('0x4c')](handleError(_0x339a86,null));};exports['destroy']=function(_0x27f24b,_0x42ca15){return db[_0xbe14('0x42')][_0xbe14('0x4b')]({'where':{'id':_0x27f24b[_0xbe14('0x46')]['id']}})['then'](handleEntityNotFound(_0x42ca15,null))[_0xbe14('0x2b')](removeEntity(_0x42ca15,null))[_0xbe14('0x4c')](handleError(_0x42ca15,null));};exports[_0xbe14('0x4f')]=function(_0x243b9e,_0x32968f,_0x44084c){var _0x1dd6c7={};var _0x56ab61={};var _0x72c875;var _0x1b47a4;return db[_0xbe14('0x42')][_0xbe14('0x50')]({'where':{'id':_0x243b9e[_0xbe14('0x46')]['id']}})[_0xbe14('0x2b')](handleEntityNotFound(_0x32968f,null))[_0xbe14('0x2b')](function(_0x32df3c){if(_0x32df3c){_0x72c875=_0x32df3c;_0x56ab61[_0xbe14('0x35')]=_[_0xbe14('0x31')](db[_0xbe14('0x51')]['rawAttributes']);_0x56ab61['query']=_['keys'](_0x243b9e[_0xbe14('0x32')]);_0x56ab61[_0xbe14('0x33')]=_[_0xbe14('0x34')](_0x56ab61[_0xbe14('0x35')],_0x56ab61[_0xbe14('0x32')]);_0x1dd6c7[_0xbe14('0x36')]=_[_0xbe14('0x34')](_0x56ab61[_0xbe14('0x35')],qs[_0xbe14('0x37')](_0x243b9e[_0xbe14('0x32')][_0xbe14('0x37')]));_0x1dd6c7[_0xbe14('0x36')]=_0x1dd6c7[_0xbe14('0x36')][_0xbe14('0x38')]?_0x1dd6c7[_0xbe14('0x36')]:_0x56ab61[_0xbe14('0x35')];_0x1dd6c7[_0xbe14('0x3b')]=qs[_0xbe14('0x3c')](_0x243b9e[_0xbe14('0x32')][_0xbe14('0x3c')]);_0x1dd6c7['where']=qs[_0xbe14('0x33')](_[_0xbe14('0x3d')](_0x243b9e[_0xbe14('0x32')],_0x56ab61[_0xbe14('0x33')]));if(_0x243b9e[_0xbe14('0x32')][_0xbe14('0x52')]){_0x1dd6c7[_0xbe14('0x3e')]=_[_0xbe14('0x3f')](_0x1dd6c7[_0xbe14('0x3e')],{'$or':_[_0xbe14('0x53')](_0x1dd6c7['attributes'],function(_0x18be56){var _0x442ec4={};_0x442ec4[_0x18be56]={'$like':'%'+_0x243b9e[_0xbe14('0x32')][_0xbe14('0x52')]+'%'};return _0x442ec4;})});}_0x1dd6c7=_[_0xbe14('0x3f')]({},_0x1dd6c7,_0x243b9e['options']);return _0x72c875[_0xbe14('0x4f')](_0x1dd6c7);}})[_0xbe14('0x2b')](function(_0x3d186b){if(_0x3d186b){_0x1b47a4=_0x3d186b[_0xbe14('0x38')];if(!_0x243b9e[_0xbe14('0x32')]['hasOwnProperty'](_0xbe14('0x3a'))){_0x1dd6c7[_0xbe14('0x24')]=qs[_0xbe14('0x24')](_0x243b9e[_0xbe14('0x32')][_0xbe14('0x24')]);_0x1dd6c7[_0xbe14('0x23')]=qs[_0xbe14('0x23')](_0x243b9e[_0xbe14('0x32')]['offset']);}return _0x72c875[_0xbe14('0x4f')](_0x1dd6c7);}})[_0xbe14('0x2b')](function(_0x2fdf5d){if(_0x2fdf5d){return _0x2fdf5d?{'count':_0x1b47a4,'rows':_0x2fdf5d}:null;}})[_0xbe14('0x2b')](respondWithResult(_0x32968f,null))[_0xbe14('0x4c')](handleError(_0x32968f,null));};exports[_0xbe14('0x54')]=function(_0x445302,_0x566096,_0x4eedd2){var _0x12941d={};var _0x3c2b58={};var _0x2d2643;var _0x2510a0;return db[_0xbe14('0x42')][_0xbe14('0x50')]({'where':{'id':_0x445302[_0xbe14('0x46')]['id']}})[_0xbe14('0x2b')](handleEntityNotFound(_0x566096,null))['then'](function(_0x5ca835){if(_0x5ca835){_0x2d2643=_0x5ca835;_0x3c2b58[_0xbe14('0x35')]=_[_0xbe14('0x31')](db[_0xbe14('0x51')]['rawAttributes']);_0x3c2b58[_0xbe14('0x32')]=_[_0xbe14('0x31')](_0x445302[_0xbe14('0x32')]);_0x3c2b58[_0xbe14('0x33')]=_[_0xbe14('0x34')](_0x3c2b58[_0xbe14('0x35')],_0x3c2b58[_0xbe14('0x32')]);_0x12941d['attributes']=_[_0xbe14('0x34')](_0x3c2b58[_0xbe14('0x35')],qs[_0xbe14('0x37')](_0x445302[_0xbe14('0x32')][_0xbe14('0x37')]));_0x12941d[_0xbe14('0x36')]=_0x12941d[_0xbe14('0x36')]['length']?_0x12941d[_0xbe14('0x36')]:_0x3c2b58[_0xbe14('0x35')];_0x12941d[_0xbe14('0x3b')]=qs[_0xbe14('0x3c')](_0x445302[_0xbe14('0x32')][_0xbe14('0x3c')]);_0x12941d[_0xbe14('0x3e')]=qs[_0xbe14('0x33')](_['pick'](_0x445302[_0xbe14('0x32')],_0x3c2b58[_0xbe14('0x33')]));if(_0x445302[_0xbe14('0x32')][_0xbe14('0x52')]){_0x12941d[_0xbe14('0x3e')]=_[_0xbe14('0x3f')](_0x12941d['where'],{'$or':_[_0xbe14('0x53')](_0x12941d[_0xbe14('0x36')],function(_0x1edc66){var _0x1b23a1={};_0x1b23a1[_0x1edc66]={'$like':'%'+_0x445302['query'][_0xbe14('0x52')]+'%'};return _0x1b23a1;})});}_0x12941d=_[_0xbe14('0x3f')]({},_0x12941d,_0x445302[_0xbe14('0x4a')]);return _0x2d2643[_0xbe14('0x54')](_0x12941d);}})[_0xbe14('0x2b')](function(_0x3d54e4){if(_0x3d54e4){_0x2510a0=_0x3d54e4[_0xbe14('0x38')];if(!_0x445302['query'][_0xbe14('0x39')]('nolimit')){_0x12941d[_0xbe14('0x24')]=qs['limit'](_0x445302[_0xbe14('0x32')][_0xbe14('0x24')]);_0x12941d[_0xbe14('0x23')]=qs['offset'](_0x445302[_0xbe14('0x32')][_0xbe14('0x23')]);}return _0x2d2643[_0xbe14('0x54')](_0x12941d);}})['then'](function(_0x41a896){if(_0x41a896){return _0x41a896?{'count':_0x2510a0,'rows':_0x41a896}:null;}})[_0xbe14('0x2b')](respondWithResult(_0x566096,null))[_0xbe14('0x4c')](handleError(_0x566096,null));};exports[_0xbe14('0x55')]=function(_0x568177,_0x3c0294,_0x39bc54){var _0x34f90b={};var _0x2b2e0e={};var _0x1dd5c0;var _0x2b9732;return db[_0xbe14('0x42')]['findOne']({'where':{'id':_0x568177[_0xbe14('0x46')]['id']}})[_0xbe14('0x2b')](handleEntityNotFound(_0x3c0294,null))[_0xbe14('0x2b')](function(_0x5c89a0){if(_0x5c89a0){_0x1dd5c0=_0x5c89a0;_0x2b2e0e[_0xbe14('0x35')]=_[_0xbe14('0x31')](db[_0xbe14('0x51')]['rawAttributes']);_0x2b2e0e[_0xbe14('0x32')]=_[_0xbe14('0x31')](_0x568177['query']);_0x2b2e0e[_0xbe14('0x33')]=_['intersection'](_0x2b2e0e[_0xbe14('0x35')],_0x2b2e0e[_0xbe14('0x32')]);_0x34f90b['attributes']=_['intersection'](_0x2b2e0e[_0xbe14('0x35')],qs[_0xbe14('0x37')](_0x568177[_0xbe14('0x32')]['fields']));_0x34f90b[_0xbe14('0x36')]=_0x34f90b[_0xbe14('0x36')][_0xbe14('0x38')]?_0x34f90b[_0xbe14('0x36')]:_0x2b2e0e['model'];_0x34f90b['order']=qs[_0xbe14('0x3c')](_0x568177[_0xbe14('0x32')][_0xbe14('0x3c')]);_0x34f90b[_0xbe14('0x3e')]=qs[_0xbe14('0x33')](_[_0xbe14('0x3d')](_0x568177[_0xbe14('0x32')],_0x2b2e0e['filters']));if(_0x568177[_0xbe14('0x32')]['filter']){_0x34f90b[_0xbe14('0x3e')]=_[_0xbe14('0x3f')](_0x34f90b[_0xbe14('0x3e')],{'$or':_[_0xbe14('0x53')](_0x34f90b['attributes'],function(_0x1e160b){var _0xa8dd0c={};_0xa8dd0c[_0x1e160b]={'$like':'%'+_0x568177[_0xbe14('0x32')]['filter']+'%'};return _0xa8dd0c;})});}_0x34f90b=_[_0xbe14('0x3f')]({},_0x34f90b,_0x568177[_0xbe14('0x4a')]);return _0x1dd5c0[_0xbe14('0x55')](_0x34f90b);}})[_0xbe14('0x2b')](function(_0x26d3ae){if(_0x26d3ae){_0x2b9732=_0x26d3ae[_0xbe14('0x38')];if(!_0x568177[_0xbe14('0x32')][_0xbe14('0x39')](_0xbe14('0x3a'))){_0x34f90b[_0xbe14('0x24')]=qs[_0xbe14('0x24')](_0x568177[_0xbe14('0x32')][_0xbe14('0x24')]);_0x34f90b[_0xbe14('0x23')]=qs[_0xbe14('0x23')](_0x568177[_0xbe14('0x32')][_0xbe14('0x23')]);}return _0x1dd5c0[_0xbe14('0x55')](_0x34f90b);}})[_0xbe14('0x2b')](function(_0x2ca6e6){if(_0x2ca6e6){return _0x2ca6e6?{'count':_0x2b9732,'rows':_0x2ca6e6}:null;}})['then'](respondWithResult(_0x3c0294,null))[_0xbe14('0x4c')](handleError(_0x3c0294,null));};
\ No newline at end of file
index ce92b04..cff93cd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xed8c=['exports','define','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xf0a8c4,_0xf33a36){var _0x4ac614=function(_0x5aefa4){while(--_0x5aefa4){_0xf0a8c4['push'](_0xf0a8c4['shift']());}};_0x4ac614(++_0xf33a36);}(_0xed8c,0x135));var _0xced8=function(_0x14a821,_0x415614){_0x14a821=_0x14a821-0x0;var _0x401a41=_0xed8c[_0x14a821];return _0x401a41;};'use strict';var _=require(_0xced8('0x0'));var util=require(_0xced8('0x1'));var logger=require(_0xced8('0x2'))(_0xced8('0x3'));var moment=require(_0xced8('0x4'));var BPromise=require(_0xced8('0x5'));var rp=require('request-promise');var attributes=require('./intSalesforceConfiguration.attributes');module[_0xced8('0x6')]=function(_0x46728e,_0x49a823){return _0x46728e[_0xced8('0x7')]('SalesforceConfiguration',attributes,{'tableName':_0xced8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x73ab=['util','../../config/logger','api','moment','bluebird','exports','define','SalesforceConfiguration','lodash'];(function(_0x144b30,_0x77072d){var _0x1bb7bc=function(_0x1082cc){while(--_0x1082cc){_0x144b30['push'](_0x144b30['shift']());}};_0x1bb7bc(++_0x77072d);}(_0x73ab,0x182));var _0xb73a=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x73ab[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0xb73a('0x0'));var util=require(_0xb73a('0x1'));var logger=require(_0xb73a('0x2'))(_0xb73a('0x3'));var moment=require(_0xb73a('0x4'));var BPromise=require(_0xb73a('0x5'));var rp=require('request-promise');var attributes=require('./intSalesforceConfiguration.attributes');module[_0xb73a('0x6')]=function(_0x219f3a,_0x4a8b94){return _0x219f3a[_0xb73a('0x7')](_0xb73a('0x8'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index f769e5f..9336cd3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x2abba6,_0x4aeadb){var _0x48e64a=function(_0x94f2f8){while(--_0x94f2f8){_0x2abba6['push'](_0x2abba6['shift']());}};_0x48e64a(++_0x4aeadb);}(_0xe14b,0x93));var _0xbe14=function(_0x218956,_0x13b2ae){_0x218956=_0x218956-0x0;var _0x868dd1=_0xe14b[_0x218956];return _0x868dd1;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});}
\ No newline at end of file
+var _0x326f=['info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x545044,_0x5dc66a){var _0x3e3e63=function(_0x175f31){while(--_0x175f31){_0x545044['push'](_0x545044['shift']());}};_0x3e3e63(++_0x5dc66a);}(_0x326f,0xd1));var _0xf326=function(_0x42abf1,_0x3dcdf7){_0x42abf1=_0x42abf1-0x0;var _0x249cad=_0x326f[_0x42abf1];return _0x249cad;};'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')]('SalesforceConfiguration,\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')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}
\ No newline at end of file
index 481824a..2a9e4c0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xacd7=['get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller'];(function(_0x26eda0,_0x2cd87b){var _0x26ec70=function(_0x57af2d){while(--_0x57af2d){_0x26eda0['push'](_0x26eda0['shift']());}};_0x26ec70(++_0x2cd87b);}(_0xacd7,0xbf));var _0x7acd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xacd7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7acd('0x0'));var util=require(_0x7acd('0x1'));var path=require(_0x7acd('0x2'));var timeout=require('connect-timeout');var express=require(_0x7acd('0x3'));var router=express[_0x7acd('0x4')]();var auth=require(_0x7acd('0x5'));var interaction=require(_0x7acd('0x6'));var config=require(_0x7acd('0x7'));var controller=require(_0x7acd('0x8'));router[_0x7acd('0x9')]('/',auth[_0x7acd('0xa')](),controller[_0x7acd('0xb')]);router[_0x7acd('0x9')](_0x7acd('0xc'),auth[_0x7acd('0xa')](),controller[_0x7acd('0xd')]);router[_0x7acd('0xe')]('/',auth[_0x7acd('0xa')](),controller['create']);router[_0x7acd('0xf')](_0x7acd('0xc'),auth[_0x7acd('0xa')](),controller[_0x7acd('0x10')]);router[_0x7acd('0x11')](_0x7acd('0xc'),auth[_0x7acd('0xa')](),controller[_0x7acd('0x12')]);module[_0x7acd('0x13')]=router;
\ No newline at end of file
+var _0x9896=['express','Router','../../config/environment','get','isAuthenticated','index','show','post','put','/:id','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x2f2260,_0x33617f){var _0x513502=function(_0x366628){while(--_0x366628){_0x2f2260['push'](_0x2f2260['shift']());}};_0x513502(++_0x33617f);}(_0x9896,0x1e9));var _0x6989=function(_0xaafc55,_0x2eb38f){_0xaafc55=_0xaafc55-0x0;var _0x5861ff=_0x9896[_0xaafc55];return _0x5861ff;};'use strict';var multer=require(_0x6989('0x0'));var util=require(_0x6989('0x1'));var path=require(_0x6989('0x2'));var timeout=require(_0x6989('0x3'));var express=require(_0x6989('0x4'));var router=express[_0x6989('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6989('0x6'));var controller=require('./intSalesforceField.controller');router[_0x6989('0x7')]('/',auth[_0x6989('0x8')](),controller[_0x6989('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6989('0xa')]);router[_0x6989('0xb')]('/',auth[_0x6989('0x8')](),controller['create']);router[_0x6989('0xc')](_0x6989('0xd'),auth[_0x6989('0x8')](),controller[_0x6989('0xe')]);router[_0x6989('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6989('0x10')]=router;
\ No newline at end of file
index 2295ded..31f2c42 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb020=['STRING','sequelize','ENUM','string','variable','customVariable','keyValue'];(function(_0x5b065e,_0x261d12){var _0x1a5df6=function(_0x3cc219){while(--_0x3cc219){_0x5b065e['push'](_0x5b065e['shift']());}};_0x1a5df6(++_0x261d12);}(_0xb020,0x86));var _0x0b02=function(_0x305486,_0x24acd4){_0x305486=_0x305486-0x0;var _0xa04940=_0xb020[_0x305486];return _0xa04940;};'use strict';var Sequelize=require(_0x0b02('0x0'));module['exports']={'type':{'type':Sequelize[_0x0b02('0x1')](_0x0b02('0x2'),_0x0b02('0x3'),_0x0b02('0x4'),_0x0b02('0x5')),'defaultValue':_0x0b02('0x2')},'content':{'type':Sequelize[_0x0b02('0x6')]},'key':{'type':Sequelize[_0x0b02('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x0b02('0x2'),_0x0b02('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x0b02('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x7412=['customVariable','exports','ENUM','variable','keyValue','STRING','string'];(function(_0x1b5508,_0x27354e){var _0x256be4=function(_0x43d251){while(--_0x43d251){_0x1b5508['push'](_0x1b5508['shift']());}};_0x256be4(++_0x27354e);}(_0x7412,0x16d));var _0x2741=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x7412[_0x3ea913];return _0x2b4f28;};'use strict';var Sequelize=require('sequelize');module[_0x2741('0x0')]={'type':{'type':Sequelize[_0x2741('0x1')]('string',_0x2741('0x2'),'customVariable',_0x2741('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2741('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2741('0x1')](_0x2741('0x5'),_0x2741('0x2'),_0x2741('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2741('0x4')]},'variableName':{'type':Sequelize[_0x2741('0x4')]}};
\ No newline at end of file
index b5696f8..e6e11d1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x86d2=['nolimit','order','where','filters','merge','map','type','VIRTUAL','field','filter','findAll','catch','show','params','include','options','find','create','body','eml-format','rimraf','fast-json-patch','moment','mustache','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../config/license/hardware','ioredis','api','../../config/utils','../../config/environment','../../mysqldb','json','count','offset','limit','status','set','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','SalesforceField','rawAttributes','keys','query','intersection','model','fields','attributes','length','hasOwnProperty'];(function(_0x31852b,_0x5ca827){var _0x2da2ac=function(_0x168a9b){while(--_0x168a9b){_0x31852b['push'](_0x31852b['shift']());}};_0x2da2ac(++_0x5ca827);}(_0x86d2,0x15d));var _0x286d=function(_0x1e7135,_0x2f7024){_0x1e7135=_0x1e7135-0x0;var _0x5e72d3=_0x86d2[_0x1e7135];return _0x5e72d3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x286d('0x0'));var rimraf=require(_0x286d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x286d('0x2'));var rp=require('request-promise');var moment=require(_0x286d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x286d('0x4'));var util=require('util');var path=require(_0x286d('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x286d('0x6'));var fs=require('fs');var _=require(_0x286d('0x7'));var squel=require('squel');var crypto=require(_0x286d('0x8'));var jsforce=require(_0x286d('0x9'));var deskjs=require(_0x286d('0xa'));var toCsv=require(_0x286d('0xb'));var querystring=require(_0x286d('0xc'));var Papa=require('papaparse');var authService=require(_0x286d('0xd'));var hardwareService=require(_0x286d('0xe'));var Redis=require(_0x286d('0xf'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x286d('0x10'));var utils=require(_0x286d('0x11'));var config=require(_0x286d('0x12'));var db=require(_0x286d('0x13'))['db'];function respondWithStatusCode(_0x7acc87,_0x27231c){_0x27231c=_0x27231c||0xcc;return function(_0xd36fd8){if(_0xd36fd8){return _0x7acc87['sendStatus'](_0x27231c);}return _0x7acc87['status'](_0x27231c)['end']();};}function respondWithResult(_0x4bac3a,_0x1d362b){_0x1d362b=_0x1d362b||0xc8;return function(_0x4100ee){if(_0x4100ee){return _0x4bac3a['status'](_0x1d362b)[_0x286d('0x14')](_0x4100ee);}};}function respondWithFilteredResult(_0x55bbce,_0x14fffe){return function(_0xce3051){if(_0xce3051){var _0x2e3870=_0xce3051[_0x286d('0x15')],_0x36bc48=_0x14fffe['offset'],_0x3537f7=_0x14fffe[_0x286d('0x16')]+_0x14fffe[_0x286d('0x17')],_0x2703d2;if(_0x3537f7>=_0x2e3870){_0x3537f7=_0x2e3870;_0x2703d2=0xc8;}else{_0x2703d2=0xce;}_0x55bbce[_0x286d('0x18')](_0x2703d2);return _0x55bbce[_0x286d('0x19')]('Content-Range',_0x36bc48+'-'+_0x3537f7+'/'+_0x2e3870)['json'](_0xce3051);}return null;};}function patchUpdates(_0x1196db){return function(_0x5ae5c3){try{jsonpatch[_0x286d('0x1a')](_0x5ae5c3,_0x1196db,!![]);}catch(_0x48a4bc){return BPromise[_0x286d('0x1b')](_0x48a4bc);}return _0x5ae5c3[_0x286d('0x1c')]();};}function saveUpdates(_0x52a9d4,_0xe022b5){return function(_0x389403){if(_0x389403){return _0x389403[_0x286d('0x1d')](_0x52a9d4)['then'](function(_0x94387e){return _0x94387e;});}return null;};}function removeEntity(_0x3e2f9c,_0x187e8a){return function(_0x5be548){if(_0x5be548){return _0x5be548[_0x286d('0x1e')]()[_0x286d('0x1f')](function(){_0x3e2f9c[_0x286d('0x18')](0xcc)[_0x286d('0x20')]();});}};}function handleEntityNotFound(_0x2c0bb4,_0x3920a4){return function(_0x46e4a1){if(!_0x46e4a1){_0x2c0bb4[_0x286d('0x21')](0x194);}return _0x46e4a1;};}function handleError(_0x189226,_0x30b6ee){_0x30b6ee=_0x30b6ee||0x1f4;return function(_0x7e1a95){logger[_0x286d('0x22')](_0x7e1a95[_0x286d('0x23')]);if(_0x7e1a95['name']){delete _0x7e1a95[_0x286d('0x24')];}_0x189226[_0x286d('0x18')](_0x30b6ee)['send'](_0x7e1a95);};}exports['index']=function(_0x30c9cf,_0x4bab7e){var _0xcbcda9={},_0x2e642d={},_0x1645b0={'count':0x0,'rows':[]};var _0x27521e=db[_0x286d('0x25')][_0x286d('0x26')];_0x2e642d['model']=_[_0x286d('0x27')](_0x27521e);_0x2e642d['query']=_['keys'](_0x30c9cf[_0x286d('0x28')]);_0x2e642d['filters']=_[_0x286d('0x29')](_0x2e642d[_0x286d('0x2a')],_0x2e642d[_0x286d('0x28')]);_0xcbcda9['attributes']=_[_0x286d('0x29')](_0x2e642d[_0x286d('0x2a')],qs['fields'](_0x30c9cf['query'][_0x286d('0x2b')]));_0xcbcda9[_0x286d('0x2c')]=_0xcbcda9['attributes'][_0x286d('0x2d')]?_0xcbcda9[_0x286d('0x2c')]:_0x2e642d[_0x286d('0x2a')];if(!_0x30c9cf[_0x286d('0x28')][_0x286d('0x2e')](_0x286d('0x2f'))){_0xcbcda9[_0x286d('0x17')]=qs[_0x286d('0x17')](_0x30c9cf[_0x286d('0x28')][_0x286d('0x17')]);_0xcbcda9[_0x286d('0x16')]=qs[_0x286d('0x16')](_0x30c9cf[_0x286d('0x28')][_0x286d('0x16')]);}_0xcbcda9[_0x286d('0x30')]=qs['sort'](_0x30c9cf[_0x286d('0x28')]['sort']);_0xcbcda9[_0x286d('0x31')]=qs[_0x286d('0x32')](_['pick'](_0x30c9cf[_0x286d('0x28')],_0x2e642d[_0x286d('0x32')]));if(_0x30c9cf[_0x286d('0x28')]['filter']){_0xcbcda9[_0x286d('0x31')]=_[_0x286d('0x33')](_0xcbcda9[_0x286d('0x31')],{'$or':_[_0x286d('0x34')](_0x27521e,function(_0x70e5f7){if(_0x70e5f7[_0x286d('0x35')]['key']!==_0x286d('0x36')){var _0x2455e2={};_0x2455e2[_0x70e5f7[_0x286d('0x37')]]={'$like':'%'+_0x30c9cf[_0x286d('0x28')][_0x286d('0x38')]+'%'};return _0x2455e2;}})});}_0xcbcda9=_[_0x286d('0x33')]({},_0xcbcda9,_0x30c9cf['options']);var _0x55910e={'where':_0xcbcda9[_0x286d('0x31')]};return db['SalesforceField'][_0x286d('0x15')](_0x55910e)[_0x286d('0x1f')](function(_0xd5db3b){_0x1645b0[_0x286d('0x15')]=_0xd5db3b;if(_0x30c9cf['query']['includeAll']){_0xcbcda9['include']=[{'all':!![]}];}return db[_0x286d('0x25')][_0x286d('0x39')](_0xcbcda9);})[_0x286d('0x1f')](function(_0x4d4949){_0x1645b0['rows']=_0x4d4949;return _0x1645b0;})[_0x286d('0x1f')](respondWithFilteredResult(_0x4bab7e,_0xcbcda9))[_0x286d('0x3a')](handleError(_0x4bab7e,null));};exports[_0x286d('0x3b')]=function(_0x316482,_0x248184){var _0x1bc6ca={'raw':!![],'where':{'id':_0x316482[_0x286d('0x3c')]['id']}},_0x49333f={};_0x49333f[_0x286d('0x2a')]=_[_0x286d('0x27')](db[_0x286d('0x25')]['rawAttributes']);_0x49333f[_0x286d('0x28')]=_['keys'](_0x316482[_0x286d('0x28')]);_0x49333f[_0x286d('0x32')]=_[_0x286d('0x29')](_0x49333f[_0x286d('0x2a')],_0x49333f[_0x286d('0x28')]);_0x1bc6ca[_0x286d('0x2c')]=_[_0x286d('0x29')](_0x49333f[_0x286d('0x2a')],qs[_0x286d('0x2b')](_0x316482[_0x286d('0x28')]['fields']));_0x1bc6ca[_0x286d('0x2c')]=_0x1bc6ca[_0x286d('0x2c')][_0x286d('0x2d')]?_0x1bc6ca['attributes']:_0x49333f['model'];if(_0x316482[_0x286d('0x28')]['includeAll']){_0x1bc6ca[_0x286d('0x3d')]=[{'all':!![]}];}_0x1bc6ca=_[_0x286d('0x33')]({},_0x1bc6ca,_0x316482[_0x286d('0x3e')]);return db[_0x286d('0x25')][_0x286d('0x3f')](_0x1bc6ca)[_0x286d('0x1f')](handleEntityNotFound(_0x248184,null))[_0x286d('0x1f')](respondWithResult(_0x248184,null))['catch'](handleError(_0x248184,null));};exports[_0x286d('0x40')]=function(_0x2dd28c,_0x40861f){return db[_0x286d('0x25')][_0x286d('0x40')](_0x2dd28c[_0x286d('0x41')],{})[_0x286d('0x1f')](respondWithResult(_0x40861f,0xc9))[_0x286d('0x3a')](handleError(_0x40861f,null));};exports[_0x286d('0x1d')]=function(_0xfcb44f,_0xf80c66){if(_0xfcb44f['body']['id']){delete _0xfcb44f[_0x286d('0x41')]['id'];}return db[_0x286d('0x25')]['find']({'where':{'id':_0xfcb44f[_0x286d('0x3c')]['id']}})['then'](handleEntityNotFound(_0xf80c66,null))[_0x286d('0x1f')](saveUpdates(_0xfcb44f[_0x286d('0x41')],null))['then'](respondWithResult(_0xf80c66,null))[_0x286d('0x3a')](handleError(_0xf80c66,null));};exports['destroy']=function(_0x5e3aa2,_0x4ce48d){return db['SalesforceField']['find']({'where':{'id':_0x5e3aa2[_0x286d('0x3c')]['id']}})['then'](handleEntityNotFound(_0x4ce48d,null))['then'](removeEntity(_0x4ce48d,null))[_0x286d('0x3a')](handleError(_0x4ce48d,null));};
\ No newline at end of file
+var _0xe5e0=['body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','apply','save','then','destroy','error','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','map','type','VIRTUAL','field','options','includeAll','include','SalesforceField','findAll','rows','catch','show','params','length','merge','find','create'];(function(_0x5c0b22,_0x56d46a){var _0x16a8a6=function(_0x268ef6){while(--_0x268ef6){_0x5c0b22['push'](_0x5c0b22['shift']());}};_0x16a8a6(++_0x56d46a);}(_0xe5e0,0x1be));var _0x0e5e=function(_0x4a519c,_0x53574a){_0x4a519c=_0x4a519c-0x0;var _0x1a13b2=_0xe5e0[_0x4a519c];return _0x1a13b2;};'use strict';var pdf=require(_0x0e5e('0x0'));var emlformat=require(_0x0e5e('0x1'));var rimraf=require(_0x0e5e('0x2'));var zipdir=require(_0x0e5e('0x3'));var jsonpatch=require(_0x0e5e('0x4'));var rp=require(_0x0e5e('0x5'));var moment=require(_0x0e5e('0x6'));var BPromise=require(_0x0e5e('0x7'));var Mustache=require(_0x0e5e('0x8'));var util=require('util');var path=require(_0x0e5e('0x9'));var sox=require(_0x0e5e('0xa'));var csv=require(_0x0e5e('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0e5e('0xc'));var squel=require(_0x0e5e('0xd'));var crypto=require(_0x0e5e('0xe'));var jsforce=require(_0x0e5e('0xf'));var deskjs=require(_0x0e5e('0x10'));var toCsv=require(_0x0e5e('0xb'));var querystring=require(_0x0e5e('0x11'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x0e5e('0x12'));var qs=require(_0x0e5e('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x0e5e('0x14'));var config=require(_0x0e5e('0x15'));var db=require(_0x0e5e('0x16'))['db'];function respondWithStatusCode(_0x379ce5,_0x56e099){_0x56e099=_0x56e099||0xcc;return function(_0x275cd5){if(_0x275cd5){return _0x379ce5[_0x0e5e('0x17')](_0x56e099);}return _0x379ce5['status'](_0x56e099)[_0x0e5e('0x18')]();};}function respondWithResult(_0x1e73e9,_0x1219ae){_0x1219ae=_0x1219ae||0xc8;return function(_0x50c0a3){if(_0x50c0a3){return _0x1e73e9[_0x0e5e('0x19')](_0x1219ae)[_0x0e5e('0x1a')](_0x50c0a3);}};}function respondWithFilteredResult(_0x187d39,_0x3d13a0){return function(_0x19d3a1){if(_0x19d3a1){var _0x1ef0be=_0x19d3a1[_0x0e5e('0x1b')],_0x5dedc5=_0x3d13a0[_0x0e5e('0x1c')],_0x20a35f=_0x3d13a0[_0x0e5e('0x1c')]+_0x3d13a0['limit'],_0x3e5104;if(_0x20a35f>=_0x1ef0be){_0x20a35f=_0x1ef0be;_0x3e5104=0xc8;}else{_0x3e5104=0xce;}_0x187d39[_0x0e5e('0x19')](_0x3e5104);return _0x187d39[_0x0e5e('0x1d')]('Content-Range',_0x5dedc5+'-'+_0x20a35f+'/'+_0x1ef0be)[_0x0e5e('0x1a')](_0x19d3a1);}return null;};}function patchUpdates(_0x3fd280){return function(_0x56cc12){try{jsonpatch[_0x0e5e('0x1e')](_0x56cc12,_0x3fd280,!![]);}catch(_0x3b80f8){return BPromise['reject'](_0x3b80f8);}return _0x56cc12[_0x0e5e('0x1f')]();};}function saveUpdates(_0x485b97,_0x3659d9){return function(_0x56dcc9){if(_0x56dcc9){return _0x56dcc9['update'](_0x485b97)[_0x0e5e('0x20')](function(_0x1b0588){return _0x1b0588;});}return null;};}function removeEntity(_0xb2930e,_0x1c4a7d){return function(_0x2c3c01){if(_0x2c3c01){return _0x2c3c01[_0x0e5e('0x21')]()[_0x0e5e('0x20')](function(){_0xb2930e[_0x0e5e('0x19')](0xcc)[_0x0e5e('0x18')]();});}};}function handleEntityNotFound(_0x33b27e,_0x523c30){return function(_0x742ee8){if(!_0x742ee8){_0x33b27e[_0x0e5e('0x17')](0x194);}return _0x742ee8;};}function handleError(_0xfff15b,_0xcab633){_0xcab633=_0xcab633||0x1f4;return function(_0x553208){logger[_0x0e5e('0x22')](_0x553208[_0x0e5e('0x23')]);if(_0x553208['name']){delete _0x553208[_0x0e5e('0x24')];}_0xfff15b['status'](_0xcab633)[_0x0e5e('0x25')](_0x553208);};}exports[_0x0e5e('0x26')]=function(_0x5e3a60,_0x1ceb31){var _0x471834={},_0x952141={},_0x563870={'count':0x0,'rows':[]};var _0x2b7fc6=db['SalesforceField'][_0x0e5e('0x27')];_0x952141[_0x0e5e('0x28')]=_[_0x0e5e('0x29')](_0x2b7fc6);_0x952141['query']=_[_0x0e5e('0x29')](_0x5e3a60[_0x0e5e('0x2a')]);_0x952141[_0x0e5e('0x2b')]=_[_0x0e5e('0x2c')](_0x952141[_0x0e5e('0x28')],_0x952141[_0x0e5e('0x2a')]);_0x471834[_0x0e5e('0x2d')]=_['intersection'](_0x952141[_0x0e5e('0x28')],qs[_0x0e5e('0x2e')](_0x5e3a60[_0x0e5e('0x2a')][_0x0e5e('0x2e')]));_0x471834['attributes']=_0x471834['attributes']['length']?_0x471834['attributes']:_0x952141[_0x0e5e('0x28')];if(!_0x5e3a60['query'][_0x0e5e('0x2f')](_0x0e5e('0x30'))){_0x471834[_0x0e5e('0x31')]=qs['limit'](_0x5e3a60[_0x0e5e('0x2a')]['limit']);_0x471834['offset']=qs[_0x0e5e('0x1c')](_0x5e3a60[_0x0e5e('0x2a')][_0x0e5e('0x1c')]);}_0x471834[_0x0e5e('0x32')]=qs[_0x0e5e('0x33')](_0x5e3a60['query'][_0x0e5e('0x33')]);_0x471834[_0x0e5e('0x34')]=qs[_0x0e5e('0x2b')](_[_0x0e5e('0x35')](_0x5e3a60[_0x0e5e('0x2a')],_0x952141[_0x0e5e('0x2b')]));if(_0x5e3a60[_0x0e5e('0x2a')][_0x0e5e('0x36')]){_0x471834[_0x0e5e('0x34')]=_['merge'](_0x471834[_0x0e5e('0x34')],{'$or':_[_0x0e5e('0x37')](_0x2b7fc6,function(_0x3f7067){if(_0x3f7067[_0x0e5e('0x38')]['key']!==_0x0e5e('0x39')){var _0x4842c5={};_0x4842c5[_0x3f7067[_0x0e5e('0x3a')]]={'$like':'%'+_0x5e3a60[_0x0e5e('0x2a')][_0x0e5e('0x36')]+'%'};return _0x4842c5;}})});}_0x471834=_['merge']({},_0x471834,_0x5e3a60[_0x0e5e('0x3b')]);var _0x1e8127={'where':_0x471834[_0x0e5e('0x34')]};return db['SalesforceField']['count'](_0x1e8127)[_0x0e5e('0x20')](function(_0x194e0b){_0x563870[_0x0e5e('0x1b')]=_0x194e0b;if(_0x5e3a60['query'][_0x0e5e('0x3c')]){_0x471834[_0x0e5e('0x3d')]=[{'all':!![]}];}return db[_0x0e5e('0x3e')][_0x0e5e('0x3f')](_0x471834);})[_0x0e5e('0x20')](function(_0x5d25f6){_0x563870[_0x0e5e('0x40')]=_0x5d25f6;return _0x563870;})[_0x0e5e('0x20')](respondWithFilteredResult(_0x1ceb31,_0x471834))[_0x0e5e('0x41')](handleError(_0x1ceb31,null));};exports[_0x0e5e('0x42')]=function(_0xb0953f,_0x293df2){var _0x587d27={'raw':!![],'where':{'id':_0xb0953f[_0x0e5e('0x43')]['id']}},_0xc73250={};_0xc73250['model']=_[_0x0e5e('0x29')](db[_0x0e5e('0x3e')]['rawAttributes']);_0xc73250[_0x0e5e('0x2a')]=_[_0x0e5e('0x29')](_0xb0953f['query']);_0xc73250[_0x0e5e('0x2b')]=_['intersection'](_0xc73250[_0x0e5e('0x28')],_0xc73250[_0x0e5e('0x2a')]);_0x587d27[_0x0e5e('0x2d')]=_[_0x0e5e('0x2c')](_0xc73250[_0x0e5e('0x28')],qs[_0x0e5e('0x2e')](_0xb0953f[_0x0e5e('0x2a')][_0x0e5e('0x2e')]));_0x587d27[_0x0e5e('0x2d')]=_0x587d27[_0x0e5e('0x2d')][_0x0e5e('0x44')]?_0x587d27['attributes']:_0xc73250[_0x0e5e('0x28')];if(_0xb0953f['query']['includeAll']){_0x587d27[_0x0e5e('0x3d')]=[{'all':!![]}];}_0x587d27=_[_0x0e5e('0x45')]({},_0x587d27,_0xb0953f[_0x0e5e('0x3b')]);return db[_0x0e5e('0x3e')][_0x0e5e('0x46')](_0x587d27)[_0x0e5e('0x20')](handleEntityNotFound(_0x293df2,null))[_0x0e5e('0x20')](respondWithResult(_0x293df2,null))['catch'](handleError(_0x293df2,null));};exports[_0x0e5e('0x47')]=function(_0xf6c59,_0x4271e9){return db[_0x0e5e('0x3e')]['create'](_0xf6c59[_0x0e5e('0x48')],{})[_0x0e5e('0x20')](respondWithResult(_0x4271e9,0xc9))[_0x0e5e('0x41')](handleError(_0x4271e9,null));};exports[_0x0e5e('0x49')]=function(_0x5bace4,_0x552e21){if(_0x5bace4['body']['id']){delete _0x5bace4[_0x0e5e('0x48')]['id'];}return db['SalesforceField'][_0x0e5e('0x46')]({'where':{'id':_0x5bace4[_0x0e5e('0x43')]['id']}})['then'](handleEntityNotFound(_0x552e21,null))[_0x0e5e('0x20')](saveUpdates(_0x5bace4[_0x0e5e('0x48')],null))[_0x0e5e('0x20')](respondWithResult(_0x552e21,null))[_0x0e5e('0x41')](handleError(_0x552e21,null));};exports[_0x0e5e('0x21')]=function(_0x2eb6d9,_0x13098a){return db[_0x0e5e('0x3e')][_0x0e5e('0x46')]({'where':{'id':_0x2eb6d9['params']['id']}})['then'](handleEntityNotFound(_0x13098a,null))[_0x0e5e('0x20')](removeEntity(_0x13098a,null))[_0x0e5e('0x41')](handleError(_0x13098a,null));};
\ No newline at end of file
index c802cf4..9f6fad9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc320=['request-promise','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','api','moment','bluebird'];(function(_0x3a4f18,_0x1af741){var _0x4c20fc=function(_0x27115f){while(--_0x27115f){_0x3a4f18['push'](_0x3a4f18['shift']());}};_0x4c20fc(++_0x1af741);}(_0xc320,0x6b));var _0x0c32=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xc320[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x0c32('0x0'));var util=require(_0x0c32('0x1'));var logger=require('../../config/logger')(_0x0c32('0x2'));var moment=require(_0x0c32('0x3'));var BPromise=require(_0x0c32('0x4'));var rp=require(_0x0c32('0x5'));var attributes=require(_0x0c32('0x6'));module[_0x0c32('0x7')]=function(_0x59c587,_0x36a912){return _0x59c587[_0x0c32('0x8')](_0x0c32('0x9'),attributes,{'tableName':_0x0c32('0xa'),'paranoid':![],'indexes':[{'name':_0x0c32('0xb'),'fields':[_0x0c32('0xc'),_0x0c32('0xd')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x7796=['int_salesforce_fields','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','exports','define'];(function(_0x56a95e,_0x500d51){var _0x4f2d0d=function(_0x56a73f){while(--_0x56a73f){_0x56a95e['push'](_0x56a95e['shift']());}};_0x4f2d0d(++_0x500d51);}(_0x7796,0x1f1));var _0x6779=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7796[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6779('0x0'));var util=require(_0x6779('0x1'));var logger=require(_0x6779('0x2'))(_0x6779('0x3'));var moment=require(_0x6779('0x4'));var BPromise=require(_0x6779('0x5'));var rp=require(_0x6779('0x6'));var attributes=require('./intSalesforceField.attributes');module[_0x6779('0x7')]=function(_0x1a692c,_0x3acfe2){return _0x1a692c[_0x6779('0x8')]('SalesforceField',attributes,{'tableName':_0x6779('0x9'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':['idField',_0x6779('0xa')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index 8a1db62..2f3fc6e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a3a=['debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent'];(function(_0x275a56,_0x45f7ca){var _0x3ec77e=function(_0x34d74a){while(--_0x34d74a){_0x275a56['push'](_0x275a56['shift']());}};_0x3ec77e(++_0x45f7ca);}(_0x7a3a,0x1bc));var _0xa7a3=function(_0x1e202c,_0x29ac28){_0x1e202c=_0x1e202c-0x0;var _0x3f6143=_0x7a3a[_0x1e202c];return _0x3f6143;};'use strict';var _=require(_0xa7a3('0x0'));var util=require('util');var moment=require(_0xa7a3('0x1'));var BPromise=require(_0xa7a3('0x2'));var rs=require(_0xa7a3('0x3'));var fs=require('fs');var Redis=require(_0xa7a3('0x4'));var db=require(_0xa7a3('0x5'))['db'];var utils=require(_0xa7a3('0x6'));var logger=require('../../config/logger')(_0xa7a3('0x7'));var config=require(_0xa7a3('0x8'));var jayson=require(_0xa7a3('0x9'));var client=jayson['client'][_0xa7a3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x375682,_0x5e80a6,_0x24484d){return new BPromise(function(_0x4a0920,_0x110557){return client[_0xa7a3('0xb')](_0x375682,_0x24484d)[_0xa7a3('0xc')](function(_0x34387f){logger[_0xa7a3('0xd')](_0xa7a3('0xe'),_0x5e80a6,_0xa7a3('0xf'));logger[_0xa7a3('0x10')](_0xa7a3('0x11'),_0x5e80a6,_0xa7a3('0xf'),JSON[_0xa7a3('0x12')](_0x34387f));if(_0x34387f['error']){if(_0x34387f[_0xa7a3('0x13')][_0xa7a3('0x14')]===0x1f4){logger['error'](_0xa7a3('0xe'),_0x5e80a6,_0x34387f[_0xa7a3('0x13')][_0xa7a3('0x15')]);return _0x110557(_0x34387f['error'][_0xa7a3('0x15')]);}logger['error'](_0xa7a3('0xe'),_0x5e80a6,_0x34387f[_0xa7a3('0x13')]['message']);return _0x4a0920(_0x34387f[_0xa7a3('0x13')][_0xa7a3('0x15')]);}else{logger[_0xa7a3('0xd')](_0xa7a3('0xe'),_0x5e80a6,'request\x20sent');_0x4a0920(_0x34387f[_0xa7a3('0x16')]['message']);}})['catch'](function(_0x31bdf3){logger[_0xa7a3('0x13')](_0xa7a3('0xe'),_0x5e80a6,_0x31bdf3);_0x110557(_0x31bdf3);});});}
\ No newline at end of file
+var _0xa605=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x6aad74,_0x32ecf4){var _0x5b1c38=function(_0x567477){while(--_0x567477){_0x6aad74['push'](_0x6aad74['shift']());}};_0x5b1c38(++_0x32ecf4);}(_0xa605,0x83));var _0x5a60=function(_0x10c590,_0x1fdda3){_0x10c590=_0x10c590-0x0;var _0x14e3ad=_0xa605[_0x10c590];return _0x14e3ad;};'use strict';var _=require(_0x5a60('0x0'));var util=require(_0x5a60('0x1'));var moment=require('moment');var BPromise=require(_0x5a60('0x2'));var rs=require(_0x5a60('0x3'));var fs=require('fs');var Redis=require(_0x5a60('0x4'));var db=require(_0x5a60('0x5'))['db'];var utils=require(_0x5a60('0x6'));var logger=require(_0x5a60('0x7'))(_0x5a60('0x8'));var config=require('../../config/environment');var jayson=require(_0x5a60('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3f514a,_0x36cafd,_0x8f7b63){return new BPromise(function(_0x2096c5,_0x23933f){return client[_0x5a60('0xa')](_0x3f514a,_0x8f7b63)[_0x5a60('0xb')](function(_0x1abacc){logger['info'](_0x5a60('0xc'),_0x36cafd,_0x5a60('0xd'));logger['debug'](_0x5a60('0xe'),_0x36cafd,_0x5a60('0xd'),JSON[_0x5a60('0xf')](_0x1abacc));if(_0x1abacc[_0x5a60('0x10')]){if(_0x1abacc[_0x5a60('0x10')][_0x5a60('0x11')]===0x1f4){logger[_0x5a60('0x10')](_0x5a60('0xc'),_0x36cafd,_0x1abacc[_0x5a60('0x10')][_0x5a60('0x12')]);return _0x23933f(_0x1abacc[_0x5a60('0x10')][_0x5a60('0x12')]);}logger[_0x5a60('0x10')]('SalesforceField,\x20%s,\x20%s',_0x36cafd,_0x1abacc[_0x5a60('0x10')]['message']);return _0x2096c5(_0x1abacc[_0x5a60('0x10')]['message']);}else{logger[_0x5a60('0x13')](_0x5a60('0xc'),_0x36cafd,_0x5a60('0xd'));_0x2096c5(_0x1abacc[_0x5a60('0x14')][_0x5a60('0x12')]);}})[_0x5a60('0x15')](function(_0x5956b4){logger[_0x5a60('0x10')]('SalesforceField,\x20%s,\x20%s',_0x36cafd,_0x5956b4);_0x23933f(_0x5956b4);});});}
\ No newline at end of file
index ac8eafa..babf765 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbdf7=['get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xbdf7,0x187));var _0x7bdf=function(_0x70d37e,_0xa394a6){_0x70d37e=_0x70d37e-0x0;var _0x1e2fed=_0xbdf7[_0x70d37e];return _0x1e2fed;};'use strict';var multer=require(_0x7bdf('0x0'));var util=require(_0x7bdf('0x1'));var path=require(_0x7bdf('0x2'));var timeout=require(_0x7bdf('0x3'));var express=require(_0x7bdf('0x4'));var router=express[_0x7bdf('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7bdf('0x6'));var config=require(_0x7bdf('0x7'));var controller=require(_0x7bdf('0x8'));router[_0x7bdf('0x9')]('/',auth[_0x7bdf('0xa')](),controller[_0x7bdf('0xb')]);router[_0x7bdf('0x9')](_0x7bdf('0xc'),auth[_0x7bdf('0xa')](),controller[_0x7bdf('0xd')]);router[_0x7bdf('0x9')](_0x7bdf('0xe'),auth[_0x7bdf('0xa')](),controller[_0x7bdf('0xf')]);router['get'](_0x7bdf('0x10'),auth[_0x7bdf('0xa')](),controller[_0x7bdf('0x11')]);router['post']('/',auth[_0x7bdf('0xa')](),controller[_0x7bdf('0x12')]);router['post']('/:id/configurations',auth[_0x7bdf('0xa')](),controller[_0x7bdf('0x13')]);router[_0x7bdf('0x14')](_0x7bdf('0xc'),auth[_0x7bdf('0xa')](),controller[_0x7bdf('0x15')]);router[_0x7bdf('0x16')](_0x7bdf('0xc'),auth[_0x7bdf('0xa')](),controller[_0x7bdf('0x17')]);module[_0x7bdf('0x18')]=router;
\ No newline at end of file
+var _0x021a=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','post','put','update','destroy'];(function(_0x231fae,_0x38d1ea){var _0x5be3f8=function(_0x232046){while(--_0x232046){_0x231fae['push'](_0x231fae['shift']());}};_0x5be3f8(++_0x38d1ea);}(_0x021a,0xf7));var _0xa021=function(_0x20ff64,_0x5c3677){_0x20ff64=_0x20ff64-0x0;var _0x5580db=_0x021a[_0x20ff64];return _0x5580db;};'use strict';var multer=require(_0xa021('0x0'));var util=require(_0xa021('0x1'));var path=require(_0xa021('0x2'));var timeout=require(_0xa021('0x3'));var express=require(_0xa021('0x4'));var router=express[_0xa021('0x5')]();var auth=require(_0xa021('0x6'));var interaction=require(_0xa021('0x7'));var config=require(_0xa021('0x8'));var controller=require('./intServicenowAccount.controller');router[_0xa021('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa021('0x9')](_0xa021('0xa'),auth[_0xa021('0xb')](),controller['show']);router[_0xa021('0x9')](_0xa021('0xc'),auth['isAuthenticated'](),controller[_0xa021('0xd')]);router[_0xa021('0x9')](_0xa021('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0xa021('0xf')]('/',auth[_0xa021('0xb')](),controller['create']);router[_0xa021('0xf')](_0xa021('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xa021('0x10')](_0xa021('0xa'),auth[_0xa021('0xb')](),controller[_0xa021('0x11')]);router['delete'](_0xa021('0xa'),auth['isAuthenticated'](),controller[_0xa021('0x12')]);module['exports']=router;
\ No newline at end of file
index b704419..d5809f2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1d2d=['sequelize','exports','STRING','remoteUri'];(function(_0x353207,_0xbbcec2){var _0xc9b939=function(_0x4aec7f){while(--_0x4aec7f){_0x353207['push'](_0x353207['shift']());}};_0xc9b939(++_0xbbcec2);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x6dc431,_0x135790){_0x6dc431=_0x6dc431-0x0;var _0x3c52bd=_0x1d2d[_0x6dc431];return _0x3c52bd;};'use strict';var Sequelize=require(_0xd1d2('0x0'));module[_0xd1d2('0x1')]={'name':{'type':Sequelize[_0xd1d2('0x2')]},'description':{'type':Sequelize[_0xd1d2('0x2')]},'username':{'type':Sequelize[_0xd1d2('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xd1d2('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xd1d2('0x3')},'serverUrl':{'type':Sequelize[_0xd1d2('0x2')]}};
\ No newline at end of file
+var _0xca66=['STRING','username','remoteUri','sequelize'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xca66,0x8b));var _0x6ca6=function(_0x51f658,_0x14cbe4){_0x51f658=_0x51f658-0x0;var _0x3f1c84=_0xca66[_0x51f658];return _0x3f1c84;};'use strict';var Sequelize=require(_0x6ca6('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6ca6('0x1')]},'username':{'type':Sequelize[_0x6ca6('0x1')],'unique':_0x6ca6('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x6ca6('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x6ca6('0x3')},'serverUrl':{'type':Sequelize['STRING']}};
\ No newline at end of file
index 1b85e20..f4a7f97 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x53c8=['assigned_to','comments','approval','comments_and_work_notes','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','password','email','serverUrl','format','%s/api/now/doc/table/schema/','remoteUri','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','concat','ServiceNow\x20error:\x20','test','statusCode','boolean','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','stack','name','index','ServicenowAccount','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type','VIRTUAL','options','include','findAll','rows','show','length','includeAll','find','create','update','body','params','findOne','getConfigurations','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','Subjects','getFields','made_sla','hold_reason','subcategory','close_code','notify','severity','category','parent','caused_by','watch_list','sys_updated_on','child_incidents','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','rfc','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','calendar_duration','sys_class_name','close_notes','follow_up','sys_id','contact_type','incident_state','urgency','problem_id','company','reassignment_count','activity_due'];(function(_0x526b20,_0xc7b64d){var _0x455172=function(_0xdd6599){while(--_0xdd6599){_0x526b20['push'](_0x526b20['shift']());}};_0x455172(++_0xc7b64d);}(_0x53c8,0x1b0));var _0x853c=function(_0x323c7e,_0x3d16ec){_0x323c7e=_0x323c7e-0x0;var _0x2b0f72=_0x53c8[_0x323c7e];return _0x2b0f72;};'use strict';var pdf=require(_0x853c('0x0'));var emlformat=require(_0x853c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x853c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x853c('0x3'));var moment=require(_0x853c('0x4'));var BPromise=require(_0x853c('0x5'));var Mustache=require(_0x853c('0x6'));var util=require(_0x853c('0x7'));var path=require(_0x853c('0x8'));var sox=require(_0x853c('0x9'));var csv=require(_0x853c('0xa'));var ejs=require(_0x853c('0xb'));var fs=require('fs');var _=require(_0x853c('0xc'));var squel=require(_0x853c('0xd'));var crypto=require(_0x853c('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x853c('0xa'));var querystring=require(_0x853c('0xf'));var Papa=require('papaparse');var authService=require(_0x853c('0x10'));var hardwareService=require(_0x853c('0x11'));var Redis=require(_0x853c('0x12'));var qs=require(_0x853c('0x13'));var logger=require(_0x853c('0x14'))(_0x853c('0x15'));var utils=require(_0x853c('0x16'));var config=require('../../config/environment');var db=require(_0x853c('0x17'))['db'];var integrations=require(_0x853c('0x18'));var jayson=require('jayson/promise');var client=jayson[_0x853c('0x19')][_0x853c('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3f1df2,_0x17fd00,_0x357ff6,_0x30cce1){return new BPromise(function(_0x3b3f6f,_0x353965){var _0x3c7670=_0x30cce1||client;return _0x3c7670[_0x853c('0x1b')](_0x3f1df2,_0x357ff6)[_0x853c('0x1c')](function(_0x3ef252){logger[_0x853c('0x1d')](_0x853c('0x1e'),_0x17fd00,_0x853c('0x1f'));logger[_0x853c('0x20')](_0x853c('0x21'),_0x17fd00,_0x853c('0x1f'),JSON[_0x853c('0x22')](_0x3ef252));if(_0x3ef252[_0x853c('0x23')]){if(_0x3ef252['error'][_0x853c('0x24')]===0x1f4){logger[_0x853c('0x23')](_0x853c('0x1e'),_0x17fd00,_0x3ef252[_0x853c('0x23')][_0x853c('0x25')]);return _0x353965(_0x3ef252[_0x853c('0x23')][_0x853c('0x25')]);}logger[_0x853c('0x23')]('ServicenowAccount,\x20%s,\x20%s',_0x17fd00,_0x3ef252['error'][_0x853c('0x25')]);return _0x3b3f6f(_0x3ef252['error'][_0x853c('0x25')]);}else{logger[_0x853c('0x1d')]('ServicenowAccount,\x20%s,\x20%s',_0x17fd00,_0x853c('0x1f'));_0x3b3f6f(_0x3ef252[_0x853c('0x26')][_0x853c('0x25')]);}})[_0x853c('0x27')](function(_0xaa5a73){logger[_0x853c('0x23')](_0x853c('0x1e'),_0x17fd00,_0xaa5a73);_0x353965(_0xaa5a73);});});}function respondWithStatusCode(_0x571fa1,_0x24346c){_0x24346c=_0x24346c||0xcc;return function(_0x39bc41){if(_0x39bc41){return _0x571fa1[_0x853c('0x28')](_0x24346c);}return _0x571fa1[_0x853c('0x29')](_0x24346c)[_0x853c('0x2a')]();};}function respondWithResult(_0x16c8fb,_0x604898){_0x604898=_0x604898||0xc8;return function(_0x367ee6){if(_0x367ee6){return _0x16c8fb[_0x853c('0x29')](_0x604898)[_0x853c('0x2b')](_0x367ee6);}};}function respondWithFilteredResult(_0x1fadce,_0x418fb9){return function(_0x2379da){if(_0x2379da){var _0x27d9e3=_0x2379da[_0x853c('0x2c')],_0x4e64bb=_0x418fb9[_0x853c('0x2d')],_0xd09593=_0x418fb9['offset']+_0x418fb9[_0x853c('0x2e')],_0x3180f5;if(_0xd09593>=_0x27d9e3){_0xd09593=_0x27d9e3;_0x3180f5=0xc8;}else{_0x3180f5=0xce;}_0x1fadce[_0x853c('0x29')](_0x3180f5);return _0x1fadce[_0x853c('0x2f')](_0x853c('0x30'),_0x4e64bb+'-'+_0xd09593+'/'+_0x27d9e3)['json'](_0x2379da);}return null;};}function patchUpdates(_0x35f400){return function(_0x389114){try{jsonpatch[_0x853c('0x31')](_0x389114,_0x35f400,!![]);}catch(_0xaf152e){return BPromise[_0x853c('0x32')](_0xaf152e);}return _0x389114[_0x853c('0x33')]();};}function saveUpdates(_0xcb5723,_0x3d9dd0){return function(_0x416635){if(_0x416635){return _0x416635['update'](_0xcb5723)[_0x853c('0x1c')](function(_0x2b5356){return _0x2b5356;});}return null;};}function removeEntity(_0x418b8c,_0x48a117){return function(_0x14ef52){if(_0x14ef52){return _0x14ef52[_0x853c('0x34')]()['then'](function(){_0x418b8c[_0x853c('0x29')](0xcc)[_0x853c('0x2a')]();});}};}function handleEntityNotFound(_0x1c9db6,_0xaf1159){return function(_0x5a38f5){if(!_0x5a38f5){_0x1c9db6[_0x853c('0x28')](0x194);}return _0x5a38f5;};}function handleError(_0x49607f,_0x45cad5){_0x45cad5=_0x45cad5||0x1f4;return function(_0xc39875){logger[_0x853c('0x23')](_0xc39875[_0x853c('0x35')]);if(_0xc39875[_0x853c('0x36')]){delete _0xc39875['name'];}_0x49607f[_0x853c('0x29')](_0x45cad5)['send'](_0xc39875);};}exports[_0x853c('0x37')]=function(_0xa2a23c,_0x407e21){var _0x28dbcb={},_0x3a1816={},_0x5ed47d={'count':0x0,'rows':[]};var _0x5a5307=db[_0x853c('0x38')][_0x853c('0x39')];_0x3a1816[_0x853c('0x3a')]=_[_0x853c('0x3b')](_0x5a5307);_0x3a1816[_0x853c('0x3c')]=_[_0x853c('0x3b')](_0xa2a23c['query']);_0x3a1816[_0x853c('0x3d')]=_[_0x853c('0x3e')](_0x3a1816[_0x853c('0x3a')],_0x3a1816[_0x853c('0x3c')]);_0x28dbcb[_0x853c('0x3f')]=_[_0x853c('0x3e')](_0x3a1816[_0x853c('0x3a')],qs[_0x853c('0x40')](_0xa2a23c[_0x853c('0x3c')][_0x853c('0x40')]));_0x28dbcb['attributes']=_0x28dbcb['attributes']['length']?_0x28dbcb['attributes']:_0x3a1816[_0x853c('0x3a')];if(!_0xa2a23c[_0x853c('0x3c')][_0x853c('0x41')](_0x853c('0x42'))){_0x28dbcb[_0x853c('0x2e')]=qs[_0x853c('0x2e')](_0xa2a23c[_0x853c('0x3c')][_0x853c('0x2e')]);_0x28dbcb[_0x853c('0x2d')]=qs[_0x853c('0x2d')](_0xa2a23c[_0x853c('0x3c')][_0x853c('0x2d')]);}_0x28dbcb[_0x853c('0x43')]=qs[_0x853c('0x44')](_0xa2a23c[_0x853c('0x3c')][_0x853c('0x44')]);_0x28dbcb['where']=qs['filters'](_[_0x853c('0x45')](_0xa2a23c['query'],_0x3a1816[_0x853c('0x3d')]));if(_0xa2a23c[_0x853c('0x3c')][_0x853c('0x46')]){_0x28dbcb[_0x853c('0x47')]=_[_0x853c('0x48')](_0x28dbcb[_0x853c('0x47')],{'$or':_[_0x853c('0x49')](_0x5a5307,function(_0x35cc56){if(_0x35cc56[_0x853c('0x4a')]['key']!==_0x853c('0x4b')){var _0x19f96b={};_0x19f96b[_0x35cc56['field']]={'$like':'%'+_0xa2a23c[_0x853c('0x3c')][_0x853c('0x46')]+'%'};return _0x19f96b;}})});}_0x28dbcb=_[_0x853c('0x48')]({},_0x28dbcb,_0xa2a23c[_0x853c('0x4c')]);var _0x16bb18={'where':_0x28dbcb['where']};return db[_0x853c('0x38')][_0x853c('0x2c')](_0x16bb18)['then'](function(_0x4e2581){_0x5ed47d[_0x853c('0x2c')]=_0x4e2581;if(_0xa2a23c['query']['includeAll']){_0x28dbcb[_0x853c('0x4d')]=[{'all':!![]}];}return db[_0x853c('0x38')][_0x853c('0x4e')](_0x28dbcb);})[_0x853c('0x1c')](function(_0x4e5712){_0x5ed47d[_0x853c('0x4f')]=_0x4e5712;return _0x5ed47d;})['then'](respondWithFilteredResult(_0x407e21,_0x28dbcb))['catch'](handleError(_0x407e21,null));};exports[_0x853c('0x50')]=function(_0x1995d8,_0x448b93){var _0x38d857={'raw':![],'where':{'id':_0x1995d8['params']['id']}},_0x34f7f0={};_0x34f7f0['model']=_[_0x853c('0x3b')](db['ServicenowAccount']['rawAttributes']);_0x34f7f0[_0x853c('0x3c')]=_[_0x853c('0x3b')](_0x1995d8[_0x853c('0x3c')]);_0x34f7f0[_0x853c('0x3d')]=_[_0x853c('0x3e')](_0x34f7f0[_0x853c('0x3a')],_0x34f7f0[_0x853c('0x3c')]);_0x38d857[_0x853c('0x3f')]=_['intersection'](_0x34f7f0[_0x853c('0x3a')],qs['fields'](_0x1995d8[_0x853c('0x3c')][_0x853c('0x40')]));_0x38d857[_0x853c('0x3f')]=_0x38d857['attributes'][_0x853c('0x51')]?_0x38d857[_0x853c('0x3f')]:_0x34f7f0[_0x853c('0x3a')];if(_0x1995d8[_0x853c('0x3c')][_0x853c('0x52')]){_0x38d857[_0x853c('0x4d')]=[{'all':!![]}];}_0x38d857=_[_0x853c('0x48')]({},_0x38d857,_0x1995d8['options']);return db[_0x853c('0x38')][_0x853c('0x53')](_0x38d857)[_0x853c('0x1c')](handleEntityNotFound(_0x448b93,null))[_0x853c('0x1c')](respondWithResult(_0x448b93,null))['catch'](handleError(_0x448b93,null));};exports[_0x853c('0x54')]=function(_0x27a0ff,_0x201965){return db[_0x853c('0x38')][_0x853c('0x54')](_0x27a0ff['body'],{})[_0x853c('0x1c')](respondWithResult(_0x201965,0xc9))['catch'](handleError(_0x201965,null));};exports[_0x853c('0x55')]=function(_0x4d6f5c,_0x1ed1b2){if(_0x4d6f5c[_0x853c('0x56')]['id']){delete _0x4d6f5c['body']['id'];}return db[_0x853c('0x38')][_0x853c('0x53')]({'where':{'id':_0x4d6f5c[_0x853c('0x57')]['id']}})[_0x853c('0x1c')](handleEntityNotFound(_0x1ed1b2,null))[_0x853c('0x1c')](saveUpdates(_0x4d6f5c[_0x853c('0x56')],null))[_0x853c('0x1c')](respondWithResult(_0x1ed1b2,null))[_0x853c('0x27')](handleError(_0x1ed1b2,null));};exports[_0x853c('0x34')]=function(_0x49e94a,_0x451efd){return db['ServicenowAccount'][_0x853c('0x53')]({'where':{'id':_0x49e94a[_0x853c('0x57')]['id']}})[_0x853c('0x1c')](handleEntityNotFound(_0x451efd,null))[_0x853c('0x1c')](removeEntity(_0x451efd,null))['catch'](handleError(_0x451efd,null));};exports['getConfigurations']=function(_0x459f29,_0x5f3f0a,_0x281eca){var _0x31ffec={};var _0x646adf={};var _0x48e7b0;var _0x2ffa89;return db[_0x853c('0x38')][_0x853c('0x58')]({'where':{'id':_0x459f29[_0x853c('0x57')]['id']}})['then'](handleEntityNotFound(_0x5f3f0a,null))[_0x853c('0x1c')](function(_0xe1257b){if(_0xe1257b){_0x48e7b0=_0xe1257b;_0x646adf[_0x853c('0x3a')]=_['keys'](db['ServicenowConfiguration'][_0x853c('0x39')]);_0x646adf[_0x853c('0x3c')]=_[_0x853c('0x3b')](_0x459f29[_0x853c('0x3c')]);_0x646adf[_0x853c('0x3d')]=_[_0x853c('0x3e')](_0x646adf[_0x853c('0x3a')],_0x646adf[_0x853c('0x3c')]);_0x31ffec[_0x853c('0x3f')]=_[_0x853c('0x3e')](_0x646adf[_0x853c('0x3a')],qs[_0x853c('0x40')](_0x459f29[_0x853c('0x3c')]['fields']));_0x31ffec['attributes']=_0x31ffec['attributes']['length']?_0x31ffec['attributes']:_0x646adf['model'];_0x31ffec[_0x853c('0x43')]=qs['sort'](_0x459f29[_0x853c('0x3c')][_0x853c('0x44')]);_0x31ffec[_0x853c('0x47')]=qs[_0x853c('0x3d')](_[_0x853c('0x45')](_0x459f29[_0x853c('0x3c')],_0x646adf['filters']));if(_0x459f29[_0x853c('0x3c')]['filter']){_0x31ffec[_0x853c('0x47')]=_[_0x853c('0x48')](_0x31ffec['where'],{'$or':_[_0x853c('0x49')](_0x31ffec[_0x853c('0x3f')],function(_0x2b317d){var _0x526de2={};_0x526de2[_0x2b317d]={'$like':'%'+_0x459f29['query'][_0x853c('0x46')]+'%'};return _0x526de2;})});}_0x31ffec=_[_0x853c('0x48')]({},_0x31ffec,_0x459f29[_0x853c('0x4c')]);return _0x48e7b0[_0x853c('0x59')](_0x31ffec);}})['then'](function(_0x1b8d2a){if(_0x1b8d2a){_0x2ffa89=_0x1b8d2a[_0x853c('0x51')];if(!_0x459f29['query'][_0x853c('0x41')](_0x853c('0x42'))){_0x31ffec[_0x853c('0x2e')]=qs[_0x853c('0x2e')](_0x459f29[_0x853c('0x3c')][_0x853c('0x2e')]);_0x31ffec[_0x853c('0x2d')]=qs['offset'](_0x459f29[_0x853c('0x3c')][_0x853c('0x2d')]);}return _0x48e7b0['getConfigurations'](_0x31ffec);}})[_0x853c('0x1c')](function(_0x3ffaab){if(_0x3ffaab){return _0x3ffaab?{'count':_0x2ffa89,'rows':_0x3ffaab}:null;}})[_0x853c('0x1c')](respondWithResult(_0x5f3f0a,null))['catch'](handleError(_0x5f3f0a,null));};exports['addConfiguration']=function(_0x211314,_0x539a21,_0x1bd47c){if(_0x211314[_0x853c('0x56')]['id']){delete _0x211314['body']['id'];}return db[_0x853c('0x38')][_0x853c('0x58')]({'where':{'id':_0x211314[_0x853c('0x57')]['id']}})[_0x853c('0x1c')](handleEntityNotFound(_0x539a21,null))[_0x853c('0x1c')](function(_0xeaa065){if(_0xeaa065){_0x211314['body']['AccountId']=_0xeaa065['id'];_0x211314[_0x853c('0x56')]['Subjects']=integrations[_0x853c('0x5a')](_0x211314[_0x853c('0x56')][_0x853c('0x5b')],_0x211314[_0x853c('0x56')][_0x853c('0x4a')]);_0x211314[_0x853c('0x56')][_0x853c('0x5c')]=integrations[_0x853c('0x5d')](_0x211314[_0x853c('0x56')][_0x853c('0x5b')],_0x211314[_0x853c('0x56')][_0x853c('0x4a')]);return db['ServicenowConfiguration'][_0x853c('0x54')](_0x211314[_0x853c('0x56')],{'include':[{'model':db[_0x853c('0x5e')],'as':_0x853c('0x5f')},{'model':db['ServicenowField'],'as':'Descriptions'}]});}return null;})[_0x853c('0x1c')](respondWithResult(_0x539a21,null))['catch'](handleError(_0x539a21,null));};exports[_0x853c('0x60')]=function(_0x15a37b,_0x22ae0b,_0x1970e1){var _0x3c2ddb=[_0x853c('0x61'),_0x853c('0x62'),'knowledge',_0x853c('0x63'),_0x853c('0x64'),_0x853c('0x65'),'incident_state',_0x853c('0x66'),_0x853c('0x67')];var _0x16e936=[_0x853c('0x68'),_0x853c('0x61'),_0x853c('0x69'),_0x853c('0x6a'),'upon_reject',_0x853c('0x6b'),_0x853c('0x6c'),_0x853c('0x62'),'approval_history',_0x853c('0x6d'),_0x853c('0x6e'),_0x853c('0x6f'),_0x853c('0x70'),_0x853c('0x71'),_0x853c('0x72'),_0x853c('0x73'),_0x853c('0x74'),_0x853c('0x75'),'knowledge',_0x853c('0x43'),'calendar_stc',_0x853c('0x76'),_0x853c('0x77'),_0x853c('0x78'),'impact',_0x853c('0x79'),_0x853c('0x7a'),_0x853c('0x7b'),_0x853c('0x7c'),'sys_domain_path',_0x853c('0x7d'),_0x853c('0x7e'),'expected_start',_0x853c('0x7f'),_0x853c('0x80'),_0x853c('0x81'),_0x853c('0x82'),_0x853c('0x83'),_0x853c('0x84'),_0x853c('0x85'),_0x853c('0x86'),'subcategory','work_notes',_0x853c('0x87'),'close_code',_0x853c('0x88'),_0x853c('0x89'),_0x853c('0x8a'),_0x853c('0x8b'),_0x853c('0x8c'),'additional_assignee_list','description',_0x853c('0x8d'),_0x853c('0x65'),_0x853c('0x8e'),_0x853c('0x8f'),'closed_by',_0x853c('0x90'),'parent_incident',_0x853c('0x91'),_0x853c('0x92'),'reopened_by',_0x853c('0x93'),_0x853c('0x94'),_0x853c('0x95'),_0x853c('0x96'),_0x853c('0x97'),_0x853c('0x98'),_0x853c('0x99'),_0x853c('0x66'),_0x853c('0x9a'),'sla_due',_0x853c('0x9b'),_0x853c('0x9c'),'due_date','sys_mod_count',_0x853c('0x9d'),_0x853c('0x9e'),_0x853c('0x9f'),_0x853c('0xa0'),_0x853c('0xa1'),_0x853c('0xa2'),_0x853c('0x67')];var _0x372fda='';var _0x4ee3b8='';var _0x2a08ed=[];var _0x3e1a4b='';var _0x4713f6='';var _0x2680c8=[];var _0xb63d7b='';var _0x561d53='';var _0x5bbc70={};return db['ServicenowAccount'][_0x853c('0x58')]({'where':{'id':_0x15a37b[_0x853c('0x57')]['id']},'attributes':['id','username',_0x853c('0xa3'),_0x853c('0xa4'),'remoteUri',_0x853c('0xa5')]})[_0x853c('0x1c')](handleEntityNotFound(_0x22ae0b,null))[_0x853c('0x1c')](function(_0x58e943){if(_0x58e943){_0x561d53=util[_0x853c('0xa6')](_0x853c('0xa7'),_0x58e943[_0x853c('0xa8')]);_0xb63d7b=util['format'](_0x853c('0xa9'),_0x58e943['remoteUri']);_0x5bbc70={'user':_0x58e943['username'],'pass':_0x58e943['password']};var _0x5d5643={'method':_0x853c('0xaa'),'uri':_0x561d53+_0x853c('0xab'),'auth':_0x5bbc70,'json':!![]};return rp(_0x5d5643);}})[_0x853c('0x1c')](function(_0x2c6018){if(_0x2c6018[_0x853c('0x26')][_0x853c('0x51')]>0x0){_0x372fda=_0x2c6018[_0x853c('0x26')];}console[_0x853c('0xac')](_0x853c('0xad'),_0x372fda);_0x2680c8=[];_0x4ee3b8=Object[_0x853c('0xae')]([],_0x372fda);_[_0x853c('0xaf')](_0x4ee3b8,function(_0x5b2b6d){return!_0x3c2ddb[_0x853c('0xb0')](_0x5b2b6d[_0x853c('0x36')]);});_0x4ee3b8[_0x853c('0xb1')](function(_0x50d955){var _0x4c8598=createFieldObject(_0xb63d7b,_0x5bbc70,_0x50d955[_0x853c('0xb2')],_0x50d955[_0x853c('0x36')],_0x50d955[_0x853c('0xb3')],![]);_0x2680c8[_0x853c('0xb4')](_0x4c8598);});return Promise['all'](_0x2680c8);})[_0x853c('0x1c')](function(_0x298b2b){_0x2a08ed=_0x298b2b;_0x3e1a4b=Object[_0x853c('0xae')]([],_0x372fda);console[_0x853c('0xac')](_0x853c('0xb5'),_0x372fda);_[_0x853c('0xaf')](_0x3e1a4b,function(_0x2b1f5a){return _0x16e936[_0x853c('0xb0')](_0x2b1f5a[_0x853c('0x36')]);});console[_0x853c('0xac')](_0x853c('0xb6'),_0x3e1a4b);_0x2680c8=[];_0x3e1a4b[_0x853c('0xb1')](function(_0x397ed6){var _0x5eaf27=createFieldObject(_0xb63d7b,_0x5bbc70,_0x397ed6[_0x853c('0xb2')],_0x397ed6['name'],_0x397ed6[_0x853c('0xb3')],!![]);_0x2680c8[_0x853c('0xb4')](_0x5eaf27);});return Promise[_0x853c('0xb7')](_0x2680c8);})[_0x853c('0x1c')](function(_0xab1f8){_0x4713f6=_0xab1f8;var _0x110d45=_0x2a08ed[_0x853c('0xb8')](_0x4713f6);return{'count':_0x110d45[_0x853c('0x51')],'rows':_0x110d45};})[_0x853c('0x1c')](respondWithResult(_0x22ae0b,null))[_0x853c('0x27')](function(_0x5de24f){console[_0x853c('0xac')](_0x853c('0xb9')+_0x5de24f);var _0x3ee4ea=_0x15a37b[_0x853c('0x3c')][_0x853c('0xba')]?0x1f4:_0x5de24f[_0x853c('0xbb')]||0x1f4;logger[_0x853c('0x23')](_0x5de24f[_0x853c('0x35')]);delete _0x5de24f[_0x853c('0x36')];if(_0x3ee4ea===0x191){_0x3ee4ea=0x190;}_0x22ae0b[_0x853c('0x29')](_0x3ee4ea)['send'](_0x15a37b[_0x853c('0x3c')][_0x853c('0xba')]?{'message':'Wrong\x20credentials','statusCode':_0x5de24f['statusCode']}:_0x5de24f);});};function createFieldObject(_0x43e8d6,_0x3acb0b,_0x263b96,_0x260e61,_0x4fee2e,_0x266508){return new Promise(function(_0x4c729b,_0x568cc7){var _0x55ab41={'id':_0x260e61,'name':_0x4fee2e,'custom':_0x266508};if(_0x263b96===_0x853c('0xbc')){_0x55ab41[_0x853c('0x4c')]=[{'name':'True','value':_0x853c('0xbd')},{'name':_0x853c('0xbe'),'value':_0x853c('0xbf')}];_0x4c729b(_0x55ab41);}else{var _0x3773b0={'method':_0x853c('0xaa'),'uri':_0x43e8d6+_0x853c('0xc0')+_0x260e61,'auth':_0x3acb0b,'json':!![]};return rp(_0x3773b0)[_0x853c('0x1c')](function(_0x3c69cc){var _0x2b1c7a=[];if(_0x3c69cc['result'][_0x853c('0x51')]>0x0){_0x3c69cc['result'][_0x853c('0xb1')](function(_0x329e2c){if(_0x329e2c[_0x853c('0xc1')]===_0x853c('0xbf')){var _0x4def3e={'name':_0x329e2c[_0x853c('0xb3')],'value':_0x329e2c[_0x853c('0xc2')]};_0x2b1c7a[_0x853c('0xb4')](_0x4def3e);}});}_0x55ab41[_0x853c('0x4c')]=_0x2b1c7a;if(_0x55ab41[_0x853c('0x4c')][_0x853c('0x51')]>0x0){_0x4c729b(_0x55ab41);}else{if(_0x266508==![]){_0x4c729b();}else{_0x4c729b(_0x55ab41);}}});}});}
\ No newline at end of file
+var _0xc6ac=['ServicenowAccount','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','map','key','VIRTUAL','field','options','includeAll','include','findAll','rows','show','params','find','create','update','body','getConfigurations','findOne','sort','addConfiguration','AccountId','Subjects','type','getDescriptions','channel','ServicenowConfiguration','ServicenowField','Descriptions','getFields','knowledge','subcategory','close_code','notify','incident_state','severity','parent','made_sla','caused_by','watch_list','upon_reject','hold_reason','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_domain','state','sys_created_by','calendar_stc','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','business_duration','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','additional_assignee_list','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','company','reassignment_count','activity_due','assigned_to','comments','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','location','category','password','remoteUri','serverUrl','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','forEach','internalType','name','label','push','all','includes','concat','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','destroy','stack','send','index'];(function(_0x381f21,_0x5dea54){var _0x45f14b=function(_0x5b220a){while(--_0x5b220a){_0x381f21['push'](_0x381f21['shift']());}};_0x45f14b(++_0x5dea54);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x172706,_0x39fa54){_0x172706=_0x172706-0x0;var _0x1e5c5b=_0xc6ac[_0x172706];return _0x1e5c5b;};'use strict';var pdf=require(_0xcc6a('0x0'));var emlformat=require(_0xcc6a('0x1'));var rimraf=require(_0xcc6a('0x2'));var zipdir=require(_0xcc6a('0x3'));var jsonpatch=require(_0xcc6a('0x4'));var rp=require(_0xcc6a('0x5'));var moment=require(_0xcc6a('0x6'));var BPromise=require(_0xcc6a('0x7'));var Mustache=require(_0xcc6a('0x8'));var util=require(_0xcc6a('0x9'));var path=require(_0xcc6a('0xa'));var sox=require(_0xcc6a('0xb'));var csv=require(_0xcc6a('0xc'));var ejs=require(_0xcc6a('0xd'));var fs=require('fs');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('0xc'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var authService=require(_0xcc6a('0x13'));var hardwareService=require(_0xcc6a('0x14'));var Redis=require('ioredis');var qs=require(_0xcc6a('0x15'));var logger=require(_0xcc6a('0x16'))(_0xcc6a('0x17'));var utils=require('../../config/utils');var config=require(_0xcc6a('0x18'));var db=require(_0xcc6a('0x19'))['db'];var integrations=require(_0xcc6a('0x1a'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcc6a('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x211444,_0x4300c0,_0x559a0a,_0x483ed4){return new BPromise(function(_0x369dc1,_0xcb9e2e){var _0x43710d=_0x483ed4||client;return _0x43710d[_0xcc6a('0x1c')](_0x211444,_0x559a0a)[_0xcc6a('0x1d')](function(_0x337ec5){logger[_0xcc6a('0x1e')](_0xcc6a('0x1f'),_0x4300c0,'request\x20sent');logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x4300c0,_0xcc6a('0x20'),JSON[_0xcc6a('0x21')](_0x337ec5));if(_0x337ec5[_0xcc6a('0x22')]){if(_0x337ec5[_0xcc6a('0x22')][_0xcc6a('0x23')]===0x1f4){logger[_0xcc6a('0x22')](_0xcc6a('0x1f'),_0x4300c0,_0x337ec5[_0xcc6a('0x22')][_0xcc6a('0x24')]);return _0xcb9e2e(_0x337ec5[_0xcc6a('0x22')][_0xcc6a('0x24')]);}logger['error'](_0xcc6a('0x1f'),_0x4300c0,_0x337ec5[_0xcc6a('0x22')][_0xcc6a('0x24')]);return _0x369dc1(_0x337ec5[_0xcc6a('0x22')][_0xcc6a('0x24')]);}else{logger[_0xcc6a('0x1e')](_0xcc6a('0x1f'),_0x4300c0,_0xcc6a('0x20'));_0x369dc1(_0x337ec5[_0xcc6a('0x25')][_0xcc6a('0x24')]);}})[_0xcc6a('0x26')](function(_0x845088){logger['error'](_0xcc6a('0x1f'),_0x4300c0,_0x845088);_0xcb9e2e(_0x845088);});});}function respondWithStatusCode(_0x3a081e,_0x38f812){_0x38f812=_0x38f812||0xcc;return function(_0x581aae){if(_0x581aae){return _0x3a081e[_0xcc6a('0x27')](_0x38f812);}return _0x3a081e[_0xcc6a('0x28')](_0x38f812)[_0xcc6a('0x29')]();};}function respondWithResult(_0x3ed7ce,_0x432c23){_0x432c23=_0x432c23||0xc8;return function(_0x5fc697){if(_0x5fc697){return _0x3ed7ce['status'](_0x432c23)[_0xcc6a('0x2a')](_0x5fc697);}};}function respondWithFilteredResult(_0x29d8be,_0x3514f3){return function(_0x5f27e5){if(_0x5f27e5){var _0x3afb3a=_0x5f27e5[_0xcc6a('0x2b')],_0x3dad72=_0x3514f3[_0xcc6a('0x2c')],_0x4da301=_0x3514f3[_0xcc6a('0x2c')]+_0x3514f3['limit'],_0xb377de;if(_0x4da301>=_0x3afb3a){_0x4da301=_0x3afb3a;_0xb377de=0xc8;}else{_0xb377de=0xce;}_0x29d8be[_0xcc6a('0x28')](_0xb377de);return _0x29d8be[_0xcc6a('0x2d')](_0xcc6a('0x2e'),_0x3dad72+'-'+_0x4da301+'/'+_0x3afb3a)['json'](_0x5f27e5);}return null;};}function patchUpdates(_0x2590a2){return function(_0x5308d4){try{jsonpatch['apply'](_0x5308d4,_0x2590a2,!![]);}catch(_0x33b72b){return BPromise[_0xcc6a('0x2f')](_0x33b72b);}return _0x5308d4[_0xcc6a('0x30')]();};}function saveUpdates(_0x11b481,_0x2b575d){return function(_0x131138){if(_0x131138){return _0x131138['update'](_0x11b481)[_0xcc6a('0x1d')](function(_0x28e3c3){return _0x28e3c3;});}return null;};}function removeEntity(_0x147aff,_0x2faeb5){return function(_0x211a8c){if(_0x211a8c){return _0x211a8c[_0xcc6a('0x31')]()[_0xcc6a('0x1d')](function(){_0x147aff[_0xcc6a('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36fc25,_0xc8c90c){return function(_0x3769b2){if(!_0x3769b2){_0x36fc25[_0xcc6a('0x27')](0x194);}return _0x3769b2;};}function handleError(_0x30d6e1,_0x711a58){_0x711a58=_0x711a58||0x1f4;return function(_0x28b16e){logger['error'](_0x28b16e[_0xcc6a('0x32')]);if(_0x28b16e['name']){delete _0x28b16e['name'];}_0x30d6e1['status'](_0x711a58)[_0xcc6a('0x33')](_0x28b16e);};}exports[_0xcc6a('0x34')]=function(_0x1101ec,_0xe213b3){var _0x1dc64f={},_0x5856af={},_0x58f6ee={'count':0x0,'rows':[]};var _0x10f47d=db[_0xcc6a('0x35')][_0xcc6a('0x36')];_0x5856af['model']=_[_0xcc6a('0x37')](_0x10f47d);_0x5856af[_0xcc6a('0x38')]=_[_0xcc6a('0x37')](_0x1101ec[_0xcc6a('0x38')]);_0x5856af[_0xcc6a('0x39')]=_[_0xcc6a('0x3a')](_0x5856af[_0xcc6a('0x3b')],_0x5856af[_0xcc6a('0x38')]);_0x1dc64f[_0xcc6a('0x3c')]=_[_0xcc6a('0x3a')](_0x5856af[_0xcc6a('0x3b')],qs[_0xcc6a('0x3d')](_0x1101ec[_0xcc6a('0x38')][_0xcc6a('0x3d')]));_0x1dc64f[_0xcc6a('0x3c')]=_0x1dc64f[_0xcc6a('0x3c')][_0xcc6a('0x3e')]?_0x1dc64f[_0xcc6a('0x3c')]:_0x5856af['model'];if(!_0x1101ec['query'][_0xcc6a('0x3f')](_0xcc6a('0x40'))){_0x1dc64f[_0xcc6a('0x41')]=qs[_0xcc6a('0x41')](_0x1101ec[_0xcc6a('0x38')][_0xcc6a('0x41')]);_0x1dc64f[_0xcc6a('0x2c')]=qs[_0xcc6a('0x2c')](_0x1101ec['query']['offset']);}_0x1dc64f[_0xcc6a('0x42')]=qs['sort'](_0x1101ec['query']['sort']);_0x1dc64f[_0xcc6a('0x43')]=qs[_0xcc6a('0x39')](_[_0xcc6a('0x44')](_0x1101ec[_0xcc6a('0x38')],_0x5856af[_0xcc6a('0x39')]));if(_0x1101ec['query'][_0xcc6a('0x45')]){_0x1dc64f[_0xcc6a('0x43')]=_[_0xcc6a('0x46')](_0x1dc64f[_0xcc6a('0x43')],{'$or':_[_0xcc6a('0x47')](_0x10f47d,function(_0x2235e0){if(_0x2235e0['type'][_0xcc6a('0x48')]!==_0xcc6a('0x49')){var _0x103eee={};_0x103eee[_0x2235e0[_0xcc6a('0x4a')]]={'$like':'%'+_0x1101ec['query'][_0xcc6a('0x45')]+'%'};return _0x103eee;}})});}_0x1dc64f=_['merge']({},_0x1dc64f,_0x1101ec[_0xcc6a('0x4b')]);var _0x3f280a={'where':_0x1dc64f[_0xcc6a('0x43')]};return db['ServicenowAccount'][_0xcc6a('0x2b')](_0x3f280a)[_0xcc6a('0x1d')](function(_0x4214d8){_0x58f6ee['count']=_0x4214d8;if(_0x1101ec['query'][_0xcc6a('0x4c')]){_0x1dc64f[_0xcc6a('0x4d')]=[{'all':!![]}];}return db[_0xcc6a('0x35')][_0xcc6a('0x4e')](_0x1dc64f);})[_0xcc6a('0x1d')](function(_0x5e59af){_0x58f6ee[_0xcc6a('0x4f')]=_0x5e59af;return _0x58f6ee;})[_0xcc6a('0x1d')](respondWithFilteredResult(_0xe213b3,_0x1dc64f))['catch'](handleError(_0xe213b3,null));};exports[_0xcc6a('0x50')]=function(_0xa45d06,_0x42ffcc){var _0x12a594={'raw':![],'where':{'id':_0xa45d06[_0xcc6a('0x51')]['id']}},_0x3b595f={};_0x3b595f['model']=_['keys'](db['ServicenowAccount'][_0xcc6a('0x36')]);_0x3b595f[_0xcc6a('0x38')]=_[_0xcc6a('0x37')](_0xa45d06[_0xcc6a('0x38')]);_0x3b595f['filters']=_[_0xcc6a('0x3a')](_0x3b595f['model'],_0x3b595f[_0xcc6a('0x38')]);_0x12a594[_0xcc6a('0x3c')]=_[_0xcc6a('0x3a')](_0x3b595f[_0xcc6a('0x3b')],qs[_0xcc6a('0x3d')](_0xa45d06[_0xcc6a('0x38')]['fields']));_0x12a594[_0xcc6a('0x3c')]=_0x12a594[_0xcc6a('0x3c')][_0xcc6a('0x3e')]?_0x12a594[_0xcc6a('0x3c')]:_0x3b595f[_0xcc6a('0x3b')];if(_0xa45d06[_0xcc6a('0x38')][_0xcc6a('0x4c')]){_0x12a594[_0xcc6a('0x4d')]=[{'all':!![]}];}_0x12a594=_[_0xcc6a('0x46')]({},_0x12a594,_0xa45d06[_0xcc6a('0x4b')]);return db['ServicenowAccount'][_0xcc6a('0x52')](_0x12a594)[_0xcc6a('0x1d')](handleEntityNotFound(_0x42ffcc,null))[_0xcc6a('0x1d')](respondWithResult(_0x42ffcc,null))[_0xcc6a('0x26')](handleError(_0x42ffcc,null));};exports[_0xcc6a('0x53')]=function(_0x465741,_0x4abb9b){return db['ServicenowAccount'][_0xcc6a('0x53')](_0x465741['body'],{})[_0xcc6a('0x1d')](respondWithResult(_0x4abb9b,0xc9))[_0xcc6a('0x26')](handleError(_0x4abb9b,null));};exports[_0xcc6a('0x54')]=function(_0x346660,_0x146362){if(_0x346660[_0xcc6a('0x55')]['id']){delete _0x346660[_0xcc6a('0x55')]['id'];}return db[_0xcc6a('0x35')][_0xcc6a('0x52')]({'where':{'id':_0x346660[_0xcc6a('0x51')]['id']}})[_0xcc6a('0x1d')](handleEntityNotFound(_0x146362,null))['then'](saveUpdates(_0x346660[_0xcc6a('0x55')],null))['then'](respondWithResult(_0x146362,null))[_0xcc6a('0x26')](handleError(_0x146362,null));};exports[_0xcc6a('0x31')]=function(_0x22acfb,_0x571a0a){return db[_0xcc6a('0x35')]['find']({'where':{'id':_0x22acfb[_0xcc6a('0x51')]['id']}})['then'](handleEntityNotFound(_0x571a0a,null))[_0xcc6a('0x1d')](removeEntity(_0x571a0a,null))[_0xcc6a('0x26')](handleError(_0x571a0a,null));};exports[_0xcc6a('0x56')]=function(_0xe212e8,_0x6c7752,_0x458b78){var _0xd891b5={};var _0x11459f={};var _0x506311;var _0x14d3ff;return db['ServicenowAccount'][_0xcc6a('0x57')]({'where':{'id':_0xe212e8['params']['id']}})[_0xcc6a('0x1d')](handleEntityNotFound(_0x6c7752,null))[_0xcc6a('0x1d')](function(_0x3c4b7c){if(_0x3c4b7c){_0x506311=_0x3c4b7c;_0x11459f['model']=_[_0xcc6a('0x37')](db['ServicenowConfiguration']['rawAttributes']);_0x11459f[_0xcc6a('0x38')]=_[_0xcc6a('0x37')](_0xe212e8[_0xcc6a('0x38')]);_0x11459f[_0xcc6a('0x39')]=_[_0xcc6a('0x3a')](_0x11459f[_0xcc6a('0x3b')],_0x11459f[_0xcc6a('0x38')]);_0xd891b5[_0xcc6a('0x3c')]=_[_0xcc6a('0x3a')](_0x11459f[_0xcc6a('0x3b')],qs[_0xcc6a('0x3d')](_0xe212e8[_0xcc6a('0x38')][_0xcc6a('0x3d')]));_0xd891b5['attributes']=_0xd891b5[_0xcc6a('0x3c')][_0xcc6a('0x3e')]?_0xd891b5[_0xcc6a('0x3c')]:_0x11459f[_0xcc6a('0x3b')];_0xd891b5['order']=qs[_0xcc6a('0x58')](_0xe212e8[_0xcc6a('0x38')][_0xcc6a('0x58')]);_0xd891b5[_0xcc6a('0x43')]=qs[_0xcc6a('0x39')](_[_0xcc6a('0x44')](_0xe212e8[_0xcc6a('0x38')],_0x11459f[_0xcc6a('0x39')]));if(_0xe212e8[_0xcc6a('0x38')][_0xcc6a('0x45')]){_0xd891b5['where']=_['merge'](_0xd891b5['where'],{'$or':_[_0xcc6a('0x47')](_0xd891b5[_0xcc6a('0x3c')],function(_0x9c444){var _0x4a9f34={};_0x4a9f34[_0x9c444]={'$like':'%'+_0xe212e8[_0xcc6a('0x38')][_0xcc6a('0x45')]+'%'};return _0x4a9f34;})});}_0xd891b5=_[_0xcc6a('0x46')]({},_0xd891b5,_0xe212e8[_0xcc6a('0x4b')]);return _0x506311['getConfigurations'](_0xd891b5);}})['then'](function(_0xaec5e8){if(_0xaec5e8){_0x14d3ff=_0xaec5e8[_0xcc6a('0x3e')];if(!_0xe212e8[_0xcc6a('0x38')][_0xcc6a('0x3f')]('nolimit')){_0xd891b5[_0xcc6a('0x41')]=qs[_0xcc6a('0x41')](_0xe212e8[_0xcc6a('0x38')][_0xcc6a('0x41')]);_0xd891b5[_0xcc6a('0x2c')]=qs['offset'](_0xe212e8['query'][_0xcc6a('0x2c')]);}return _0x506311[_0xcc6a('0x56')](_0xd891b5);}})[_0xcc6a('0x1d')](function(_0x144495){if(_0x144495){return _0x144495?{'count':_0x14d3ff,'rows':_0x144495}:null;}})['then'](respondWithResult(_0x6c7752,null))['catch'](handleError(_0x6c7752,null));};exports[_0xcc6a('0x59')]=function(_0xa1385,_0x472f5c,_0x421d0b){if(_0xa1385['body']['id']){delete _0xa1385['body']['id'];}return db['ServicenowAccount'][_0xcc6a('0x57')]({'where':{'id':_0xa1385[_0xcc6a('0x51')]['id']}})[_0xcc6a('0x1d')](handleEntityNotFound(_0x472f5c,null))[_0xcc6a('0x1d')](function(_0x51a10b){if(_0x51a10b){_0xa1385[_0xcc6a('0x55')][_0xcc6a('0x5a')]=_0x51a10b['id'];_0xa1385['body'][_0xcc6a('0x5b')]=integrations['getSubjects'](_0xa1385[_0xcc6a('0x55')]['channel'],_0xa1385[_0xcc6a('0x55')][_0xcc6a('0x5c')]);_0xa1385[_0xcc6a('0x55')]['Descriptions']=integrations[_0xcc6a('0x5d')](_0xa1385['body'][_0xcc6a('0x5e')],_0xa1385['body'][_0xcc6a('0x5c')]);return db[_0xcc6a('0x5f')][_0xcc6a('0x53')](_0xa1385[_0xcc6a('0x55')],{'include':[{'model':db[_0xcc6a('0x60')],'as':_0xcc6a('0x5b')},{'model':db['ServicenowField'],'as':_0xcc6a('0x61')}]});}return null;})[_0xcc6a('0x1d')](respondWithResult(_0x472f5c,null))[_0xcc6a('0x26')](handleError(_0x472f5c,null));};exports[_0xcc6a('0x62')]=function(_0x3f4a88,_0x4edd03,_0xcc68cf){var _0x731844=['made_sla','hold_reason',_0xcc6a('0x63'),_0xcc6a('0x64'),_0xcc6a('0x65'),_0xcc6a('0x66'),_0xcc6a('0x67'),_0xcc6a('0x68'),'category'];var _0x32f056=[_0xcc6a('0x69'),_0xcc6a('0x6a'),_0xcc6a('0x6b'),_0xcc6a('0x6c'),_0xcc6a('0x6d'),'sys_updated_on','child_incidents',_0xcc6a('0x6e'),_0xcc6a('0x6f'),_0xcc6a('0x70'),_0xcc6a('0x71'),_0xcc6a('0x72'),_0xcc6a('0x73'),_0xcc6a('0x74'),'sys_created_on',_0xcc6a('0x75'),_0xcc6a('0x76'),_0xcc6a('0x77'),_0xcc6a('0x63'),_0xcc6a('0x42'),_0xcc6a('0x78'),'closed_at',_0xcc6a('0x79'),_0xcc6a('0x7a'),_0xcc6a('0x7b'),'active',_0xcc6a('0x7c'),_0xcc6a('0x7d'),_0xcc6a('0x7e'),_0xcc6a('0x7f'),_0xcc6a('0x80'),_0xcc6a('0x81'),'expected_start',_0xcc6a('0x82'),_0xcc6a('0x83'),'group_list',_0xcc6a('0x84'),_0xcc6a('0x85'),_0xcc6a('0x86'),_0xcc6a('0x87'),_0xcc6a('0x88'),'subcategory',_0xcc6a('0x89'),_0xcc6a('0x8a'),_0xcc6a('0x65'),_0xcc6a('0x8b'),_0xcc6a('0x8c'),_0xcc6a('0x8d'),'assignment_group','business_stc',_0xcc6a('0x8e'),'description',_0xcc6a('0x8f'),_0xcc6a('0x66'),_0xcc6a('0x90'),_0xcc6a('0x91'),_0xcc6a('0x92'),_0xcc6a('0x93'),_0xcc6a('0x94'),_0xcc6a('0x95'),_0xcc6a('0x96'),_0xcc6a('0x97'),_0xcc6a('0x67'),_0xcc6a('0x98'),'problem_id',_0xcc6a('0x99'),_0xcc6a('0x9a'),_0xcc6a('0x9b'),_0xcc6a('0x9c'),'severity',_0xcc6a('0x9d'),'sla_due',_0xcc6a('0x9e'),_0xcc6a('0x9f'),_0xcc6a('0xa0'),_0xcc6a('0xa1'),_0xcc6a('0xa2'),_0xcc6a('0xa3'),_0xcc6a('0xa4'),'upon_approval',_0xcc6a('0xa5'),_0xcc6a('0xa6'),_0xcc6a('0xa7')];var _0x1c1e4c='';var _0xc5cc18='';var _0x4473ab=[];var _0x558e2f='';var _0x14a957='';var _0x350766=[];var _0x589bff='';var _0x5661b5='';var _0x23c34d={};var _0x2569d3='';return db[_0xcc6a('0x35')][_0xcc6a('0x57')]({'where':{'id':_0x3f4a88[_0xcc6a('0x51')]['id']},'attributes':['id','username',_0xcc6a('0xa8'),'email',_0xcc6a('0xa9'),_0xcc6a('0xaa')]})[_0xcc6a('0x1d')](handleEntityNotFound(_0x4edd03,null))[_0xcc6a('0x1d')](function(_0x3c6e89){if(_0x3c6e89){_0x2569d3=_0x3c6e89[_0xcc6a('0xa9')];var _0x294dd5=_0x2569d3[_0xcc6a('0xab')](-0x1);if(_0x294dd5==='/'){_0x2569d3=_0x2569d3['substring'](0x0,_0x2569d3[_0xcc6a('0xac')](_0x294dd5));}_0x5661b5=util[_0xcc6a('0xad')](_0xcc6a('0xae'),_0x2569d3);_0x589bff=util['format'](_0xcc6a('0xaf'),_0x2569d3);_0x23c34d={'user':_0x3c6e89[_0xcc6a('0xb0')],'pass':_0x3c6e89[_0xcc6a('0xa8')]};var _0x290196={'method':_0xcc6a('0xb1'),'uri':_0x5661b5+_0xcc6a('0xb2'),'auth':_0x23c34d,'json':!![]};return rp(_0x290196);}})[_0xcc6a('0x1d')](function(_0x50d2d3){if(_0x50d2d3[_0xcc6a('0x25')][_0xcc6a('0x3e')]>0x0){_0x1c1e4c=_0x50d2d3[_0xcc6a('0x25')];}console[_0xcc6a('0xb3')](_0xcc6a('0xb4'),_0x1c1e4c);_0x350766=[];_0xc5cc18=Object[_0xcc6a('0xb5')]([],_0x1c1e4c);_[_0xcc6a('0xb6')](_0xc5cc18,function(_0x1dd2f2){return!_0x731844['includes'](_0x1dd2f2['name']);});_0xc5cc18[_0xcc6a('0xb7')](function(_0x53ef27){var _0x1e3414=createFieldObject(_0x589bff,_0x23c34d,_0x53ef27[_0xcc6a('0xb8')],_0x53ef27[_0xcc6a('0xb9')],_0x53ef27[_0xcc6a('0xba')],![]);_0x350766[_0xcc6a('0xbb')](_0x1e3414);});return Promise[_0xcc6a('0xbc')](_0x350766);})[_0xcc6a('0x1d')](function(_0x48b6e3){_0x4473ab=_0x48b6e3;_0x558e2f=Object[_0xcc6a('0xb5')]([],_0x1c1e4c);console['log']('TCL:\x20_object',_0x1c1e4c);_[_0xcc6a('0xb6')](_0x558e2f,function(_0x57ad38){return _0x32f056[_0xcc6a('0xbd')](_0x57ad38[_0xcc6a('0xb9')]);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x558e2f);_0x350766=[];_0x558e2f[_0xcc6a('0xb7')](function(_0x4d0e37){var _0x23f83b=createFieldObject(_0x589bff,_0x23c34d,_0x4d0e37[_0xcc6a('0xb8')],_0x4d0e37[_0xcc6a('0xb9')],_0x4d0e37[_0xcc6a('0xba')],!![]);_0x350766[_0xcc6a('0xbb')](_0x23f83b);});return Promise[_0xcc6a('0xbc')](_0x350766);})['then'](function(_0x1b6493){_0x14a957=_0x1b6493;var _0x4223d1=_0x4473ab[_0xcc6a('0xbe')](_0x14a957);return{'count':_0x4223d1[_0xcc6a('0x3e')],'rows':_0x4223d1};})['then'](respondWithResult(_0x4edd03,null))[_0xcc6a('0x26')](function(_0x35b777){console[_0xcc6a('0xb3')](_0xcc6a('0xbf')+_0x35b777);var _0x383e2b=_0x3f4a88[_0xcc6a('0x38')][_0xcc6a('0xc0')]?0x1f4:_0x35b777['statusCode']||0x1f4;logger[_0xcc6a('0x22')](_0x35b777[_0xcc6a('0x32')]);delete _0x35b777['name'];if(_0x383e2b===0x191){_0x383e2b=0x190;}_0x4edd03[_0xcc6a('0x28')](_0x383e2b)[_0xcc6a('0x33')](_0x3f4a88[_0xcc6a('0x38')][_0xcc6a('0xc0')]?{'message':_0xcc6a('0xc1'),'statusCode':_0x35b777[_0xcc6a('0xc2')]}:_0x35b777);});};function createFieldObject(_0x108aa8,_0x350c7f,_0xe82859,_0x44fa34,_0x3efe1c,_0x18e20d){return new Promise(function(_0x2768b6,_0x3ba3b0){var _0x4ebeff={'id':_0x44fa34,'name':_0x3efe1c,'custom':_0x18e20d};if(_0xe82859==='boolean'){_0x4ebeff[_0xcc6a('0x4b')]=[{'name':_0xcc6a('0xc3'),'value':'true'},{'name':_0xcc6a('0xc4'),'value':_0xcc6a('0xc5')}];_0x2768b6(_0x4ebeff);}else{var _0x45fcbb={'method':'GET','uri':_0x108aa8+_0xcc6a('0xc6')+_0x44fa34,'auth':_0x350c7f,'json':!![]};return rp(_0x45fcbb)['then'](function(_0x1ced4b){var _0x4345eb=[];if(_0x1ced4b['result'][_0xcc6a('0x3e')]>0x0){_0x1ced4b['result'][_0xcc6a('0xb7')](function(_0x21cb66){if(_0x21cb66[_0xcc6a('0xc7')]===_0xcc6a('0xc5')){var _0x32098d={'name':_0x21cb66[_0xcc6a('0xba')],'value':_0x21cb66['value']};_0x4345eb['push'](_0x32098d);}});}_0x4ebeff[_0xcc6a('0x4b')]=_0x4345eb;if(_0x4ebeff[_0xcc6a('0x4b')][_0xcc6a('0x3e')]>0x0){_0x2768b6(_0x4ebeff);}else{if(_0x18e20d==![]){_0x2768b6();}else{_0x2768b6(_0x4ebeff);}}});}});}
\ No newline at end of file
index 754aa5f..91b4331 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa0bc=['exports','define','ServicenowAccount','int_servicenow_accounts','util','moment','bluebird','request-promise','./intServicenowAccount.attributes'];(function(_0x1b2255,_0x3de34f){var _0x33e57d=function(_0x2f9cce){while(--_0x2f9cce){_0x1b2255['push'](_0x1b2255['shift']());}};_0x33e57d(++_0x3de34f);}(_0xa0bc,0x148));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xca0b('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xca0b('0x1'));var BPromise=require(_0xca0b('0x2'));var rp=require(_0xca0b('0x3'));var attributes=require(_0xca0b('0x4'));var integrations=require('../../components/integrations/configuration');module[_0xca0b('0x5')]=function(_0x3e1ceb,_0x51a0fa){return _0x3e1ceb[_0xca0b('0x6')](_0xca0b('0x7'),attributes,{'tableName':_0xca0b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xfa0f=['request-promise','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','moment','bluebird'];(function(_0x1f6294,_0x2827a0){var _0x26f03a=function(_0x34f173){while(--_0x34f173){_0x1f6294['push'](_0x1f6294['shift']());}};_0x26f03a(++_0x2827a0);}(_0xfa0f,0xe2));var _0xffa0=function(_0x2a1f2e,_0x1019fc){_0x2a1f2e=_0x2a1f2e-0x0;var _0x3d9db9=_0xfa0f[_0x2a1f2e];return _0x3d9db9;};'use strict';var _=require(_0xffa0('0x0'));var util=require('util');var logger=require(_0xffa0('0x1'))('api');var moment=require(_0xffa0('0x2'));var BPromise=require(_0xffa0('0x3'));var rp=require(_0xffa0('0x4'));var attributes=require(_0xffa0('0x5'));var integrations=require(_0xffa0('0x6'));module['exports']=function(_0x57bebd,_0x1c54c0){return _0x57bebd[_0xffa0('0x7')](_0xffa0('0x8'),attributes,{'tableName':_0xffa0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 25dc93b..04cc86a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6ca1=['lodash','util','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','ServicenowAccount,\x20%s,\x20%s','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','limit','map','model','include','debug','ShowServicenowAccount'];(function(_0x2a4a99,_0x64b4a){var _0x1cef2f=function(_0x43beef){while(--_0x43beef){_0x2a4a99['push'](_0x2a4a99['shift']());}};_0x1cef2f(++_0x64b4a);}(_0x6ca1,0x1f0));var _0x16ca=function(_0x292388,_0x4a7058){_0x292388=_0x292388-0x0;var _0x549241=_0x6ca1[_0x292388];return _0x549241;};'use strict';var _=require(_0x16ca('0x0'));var util=require(_0x16ca('0x1'));var moment=require('moment');var BPromise=require(_0x16ca('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x16ca('0x3'));var logger=require('../../config/logger')(_0x16ca('0x4'));var config=require(_0x16ca('0x5'));var jayson=require(_0x16ca('0x6'));var client=jayson[_0x16ca('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x587773,_0x25a0bd,_0x193c34){return new BPromise(function(_0x173922,_0x3a7291){return client['request'](_0x587773,_0x193c34)[_0x16ca('0x8')](function(_0x148d3f){logger[_0x16ca('0x9')](_0x16ca('0xa'),_0x25a0bd,'request\x20sent');logger['debug'](_0x16ca('0xb'),_0x25a0bd,_0x16ca('0xc'),JSON[_0x16ca('0xd')](_0x148d3f));if(_0x148d3f[_0x16ca('0xe')]){if(_0x148d3f['error'][_0x16ca('0xf')]===0x1f4){logger[_0x16ca('0xe')](_0x16ca('0xa'),_0x25a0bd,_0x148d3f[_0x16ca('0xe')][_0x16ca('0x10')]);return _0x3a7291(_0x148d3f[_0x16ca('0xe')][_0x16ca('0x10')]);}logger[_0x16ca('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x25a0bd,_0x148d3f[_0x16ca('0xe')]['message']);return _0x173922(_0x148d3f[_0x16ca('0xe')][_0x16ca('0x10')]);}else{logger[_0x16ca('0x9')]('ServicenowAccount,\x20%s,\x20%s',_0x25a0bd,_0x16ca('0xc'));_0x173922(_0x148d3f[_0x16ca('0x11')][_0x16ca('0x10')]);}})[_0x16ca('0x12')](function(_0x2e3983){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x25a0bd,_0x2e3983);_0x3a7291(_0x2e3983);});});}exports[_0x16ca('0x13')]=function(_0x51d722){var _0x5a394c=this;return new Promise(function(_0x1dc78c,_0x173c99){return db[_0x16ca('0x14')]['findAll']({'raw':_0x51d722[_0x16ca('0x15')]?_0x51d722[_0x16ca('0x15')][_0x16ca('0x16')]===undefined?!![]:![]:!![],'where':_0x51d722[_0x16ca('0x15')]?_0x51d722['options'][_0x16ca('0x17')]||null:null,'attributes':_0x51d722[_0x16ca('0x15')]?_0x51d722[_0x16ca('0x15')][_0x16ca('0x18')]||null:null,'limit':_0x51d722[_0x16ca('0x15')]?_0x51d722[_0x16ca('0x15')][_0x16ca('0x19')]||null:null,'include':_0x51d722['options']?_0x51d722[_0x16ca('0x15')]['include']?_[_0x16ca('0x1a')](_0x51d722['options']['include'],function(_0x3f2e38){return{'model':db[_0x3f2e38[_0x16ca('0x1b')]],'as':_0x3f2e38['as'],'attributes':_0x3f2e38[_0x16ca('0x18')],'include':_0x3f2e38[_0x16ca('0x1c')]?_['map'](_0x3f2e38[_0x16ca('0x1c')],function(_0x41e021){return{'model':db[_0x41e021[_0x16ca('0x1b')]],'as':_0x41e021['as'],'attributes':_0x41e021[_0x16ca('0x18')],'include':_0x41e021[_0x16ca('0x1c')]?_['map'](_0x41e021[_0x16ca('0x1c')],function(_0x60ad7){return{'model':db[_0x60ad7[_0x16ca('0x1b')]],'as':_0x60ad7['as'],'attributes':_0x60ad7['attributes']};}):[]};}):[]};}):[]:[]})[_0x16ca('0x8')](function(_0x1404a5){logger[_0x16ca('0x9')]('GetServicenowAccount',_0x51d722);logger[_0x16ca('0x1d')](_0x16ca('0x13'),_0x51d722,JSON['stringify'](_0x1404a5));_0x1dc78c(_0x1404a5);})[_0x16ca('0x12')](function(_0x125f75){logger[_0x16ca('0xe')](_0x16ca('0x13'),_0x125f75[_0x16ca('0x10')],_0x51d722);_0x173c99(_0x5a394c['error'](0x1f4,_0x125f75['message']));});});};exports[_0x16ca('0x1e')]=function(_0x377122){var _0x309f73=this;return new Promise(function(_0x900238,_0x4bf7dd){return db[_0x16ca('0x14')]['find']({'raw':_0x377122[_0x16ca('0x15')]?_0x377122[_0x16ca('0x15')][_0x16ca('0x16')]===undefined?!![]:![]:!![],'where':_0x377122[_0x16ca('0x15')]?_0x377122[_0x16ca('0x15')][_0x16ca('0x17')]||null:null,'attributes':_0x377122[_0x16ca('0x15')]?_0x377122[_0x16ca('0x15')][_0x16ca('0x18')]||null:null,'include':_0x377122[_0x16ca('0x15')]?_0x377122[_0x16ca('0x15')]['include']?_[_0x16ca('0x1a')](_0x377122[_0x16ca('0x15')]['include'],function(_0x2327ab){return{'model':db[_0x2327ab['model']],'as':_0x2327ab['as'],'attributes':_0x2327ab[_0x16ca('0x18')],'include':_0x2327ab[_0x16ca('0x1c')]?_[_0x16ca('0x1a')](_0x2327ab['include'],function(_0x16a6b6){return{'model':db[_0x16a6b6[_0x16ca('0x1b')]],'as':_0x16a6b6['as'],'attributes':_0x16a6b6[_0x16ca('0x18')],'include':_0x16a6b6[_0x16ca('0x1c')]?_['map'](_0x16a6b6[_0x16ca('0x1c')],function(_0x1827a2){return{'model':db[_0x1827a2[_0x16ca('0x1b')]],'as':_0x1827a2['as'],'attributes':_0x1827a2[_0x16ca('0x18')]};}):[]};}):[]};}):[]:[]})[_0x16ca('0x8')](function(_0x3ab549){logger[_0x16ca('0x9')](_0x16ca('0x1e'),_0x377122);logger[_0x16ca('0x1d')](_0x16ca('0x1e'),_0x377122,JSON[_0x16ca('0xd')](_0x3ab549));_0x900238(_0x3ab549);})[_0x16ca('0x12')](function(_0x1e879e){logger[_0x16ca('0xe')](_0x16ca('0x1e'),_0x1e879e[_0x16ca('0x10')],_0x377122);_0x4bf7dd(_0x309f73[_0x16ca('0xe')](0x1f4,_0x1e879e[_0x16ca('0x10')]));});});};
\ No newline at end of file
+var _0x1127=['randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','map','include','model','ShowServicenowAccount','lodash','moment'];(function(_0x191d10,_0x50aa28){var _0x208332=function(_0x4016bc){while(--_0x4016bc){_0x191d10['push'](_0x191d10['shift']());}};_0x208332(++_0x50aa28);}(_0x1127,0x15e));var _0x7112=function(_0x4f1789,_0x37fda7){_0x4f1789=_0x4f1789-0x0;var _0x5bb8fe=_0x1127[_0x4f1789];return _0x5bb8fe;};'use strict';var _=require(_0x7112('0x0'));var util=require('util');var moment=require(_0x7112('0x1'));var BPromise=require('bluebird');var rs=require(_0x7112('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7112('0x3'))['db'];var utils=require(_0x7112('0x4'));var logger=require('../../config/logger')(_0x7112('0x5'));var config=require('../../config/environment');var jayson=require(_0x7112('0x6'));var client=jayson['client'][_0x7112('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x278daa,_0x79147a,_0x424376){return new BPromise(function(_0x450be1,_0x556561){return client['request'](_0x278daa,_0x424376)[_0x7112('0x8')](function(_0x38d2fd){logger[_0x7112('0x9')](_0x7112('0xa'),_0x79147a,_0x7112('0xb'));logger[_0x7112('0xc')](_0x7112('0xd'),_0x79147a,_0x7112('0xb'),JSON[_0x7112('0xe')](_0x38d2fd));if(_0x38d2fd['error']){if(_0x38d2fd[_0x7112('0xf')][_0x7112('0x10')]===0x1f4){logger[_0x7112('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x79147a,_0x38d2fd[_0x7112('0xf')][_0x7112('0x11')]);return _0x556561(_0x38d2fd['error'][_0x7112('0x11')]);}logger[_0x7112('0xf')](_0x7112('0xa'),_0x79147a,_0x38d2fd[_0x7112('0xf')][_0x7112('0x11')]);return _0x450be1(_0x38d2fd[_0x7112('0xf')][_0x7112('0x11')]);}else{logger[_0x7112('0x9')](_0x7112('0xa'),_0x79147a,_0x7112('0xb'));_0x450be1(_0x38d2fd[_0x7112('0x12')]['message']);}})[_0x7112('0x13')](function(_0x15729d){logger['error'](_0x7112('0xa'),_0x79147a,_0x15729d);_0x556561(_0x15729d);});});}exports[_0x7112('0x14')]=function(_0x1f25df){var _0x2d5224=this;return new Promise(function(_0x6cae0a,_0x790cd1){return db[_0x7112('0x15')][_0x7112('0x16')]({'raw':_0x1f25df[_0x7112('0x17')]?_0x1f25df[_0x7112('0x17')][_0x7112('0x18')]===undefined?!![]:![]:!![],'where':_0x1f25df[_0x7112('0x17')]?_0x1f25df['options'][_0x7112('0x19')]||null:null,'attributes':_0x1f25df[_0x7112('0x17')]?_0x1f25df[_0x7112('0x17')][_0x7112('0x1a')]||null:null,'limit':_0x1f25df[_0x7112('0x17')]?_0x1f25df[_0x7112('0x17')][_0x7112('0x1b')]||null:null,'include':_0x1f25df[_0x7112('0x17')]?_0x1f25df['options']['include']?_[_0x7112('0x1c')](_0x1f25df[_0x7112('0x17')][_0x7112('0x1d')],function(_0x25df2b){return{'model':db[_0x25df2b[_0x7112('0x1e')]],'as':_0x25df2b['as'],'attributes':_0x25df2b[_0x7112('0x1a')],'include':_0x25df2b['include']?_[_0x7112('0x1c')](_0x25df2b[_0x7112('0x1d')],function(_0x130e9d){return{'model':db[_0x130e9d[_0x7112('0x1e')]],'as':_0x130e9d['as'],'attributes':_0x130e9d[_0x7112('0x1a')],'include':_0x130e9d['include']?_[_0x7112('0x1c')](_0x130e9d[_0x7112('0x1d')],function(_0x425262){return{'model':db[_0x425262[_0x7112('0x1e')]],'as':_0x425262['as'],'attributes':_0x425262[_0x7112('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7112('0x8')](function(_0x106f72){logger[_0x7112('0x9')](_0x7112('0x14'),_0x1f25df);logger['debug'](_0x7112('0x14'),_0x1f25df,JSON['stringify'](_0x106f72));_0x6cae0a(_0x106f72);})[_0x7112('0x13')](function(_0xd44234){logger[_0x7112('0xf')]('GetServicenowAccount',_0xd44234['message'],_0x1f25df);_0x790cd1(_0x2d5224[_0x7112('0xf')](0x1f4,_0xd44234['message']));});});};exports[_0x7112('0x1f')]=function(_0x1e4d51){var _0x3a82e2=this;return new Promise(function(_0x5ec4de,_0x6ab26b){return db['ServicenowAccount']['find']({'raw':_0x1e4d51[_0x7112('0x17')]?_0x1e4d51[_0x7112('0x17')][_0x7112('0x18')]===undefined?!![]:![]:!![],'where':_0x1e4d51['options']?_0x1e4d51[_0x7112('0x17')][_0x7112('0x19')]||null:null,'attributes':_0x1e4d51[_0x7112('0x17')]?_0x1e4d51[_0x7112('0x17')][_0x7112('0x1a')]||null:null,'include':_0x1e4d51[_0x7112('0x17')]?_0x1e4d51[_0x7112('0x17')]['include']?_[_0x7112('0x1c')](_0x1e4d51[_0x7112('0x17')][_0x7112('0x1d')],function(_0x4a9a5e){return{'model':db[_0x4a9a5e[_0x7112('0x1e')]],'as':_0x4a9a5e['as'],'attributes':_0x4a9a5e['attributes'],'include':_0x4a9a5e[_0x7112('0x1d')]?_[_0x7112('0x1c')](_0x4a9a5e[_0x7112('0x1d')],function(_0x151f72){return{'model':db[_0x151f72[_0x7112('0x1e')]],'as':_0x151f72['as'],'attributes':_0x151f72['attributes'],'include':_0x151f72[_0x7112('0x1d')]?_['map'](_0x151f72['include'],function(_0x5c6fac){return{'model':db[_0x5c6fac[_0x7112('0x1e')]],'as':_0x5c6fac['as'],'attributes':_0x5c6fac['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x519272){logger[_0x7112('0x9')]('ShowServicenowAccount',_0x1e4d51);logger[_0x7112('0xc')](_0x7112('0x1f'),_0x1e4d51,JSON['stringify'](_0x519272));_0x5ec4de(_0x519272);})[_0x7112('0x13')](function(_0x44467f){logger[_0x7112('0xf')]('ShowServicenowAccount',_0x44467f['message'],_0x1e4d51);_0x6ab26b(_0x3a82e2[_0x7112('0xf')](0x1f4,_0x44467f[_0x7112('0x11')]));});});};
\ No newline at end of file
index 0f8808e..8d37bd9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1cba=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x20f0b7,_0x2dd297){var _0x78b55f=function(_0x3b8eb5){while(--_0x3b8eb5){_0x20f0b7['push'](_0x20f0b7['shift']());}};_0x78b55f(++_0x2dd297);}(_0x1cba,0x126));var _0xa1cb=function(_0x3c3128,_0x117d7d){_0x3c3128=_0x3c3128-0x0;var _0x26b55e=_0x1cba[_0x3c3128];return _0x26b55e;};'use strict';var multer=require('multer');var util=require(_0xa1cb('0x0'));var path=require(_0xa1cb('0x1'));var timeout=require(_0xa1cb('0x2'));var express=require(_0xa1cb('0x3'));var router=express[_0xa1cb('0x4')]();var auth=require(_0xa1cb('0x5'));var interaction=require(_0xa1cb('0x6'));var config=require(_0xa1cb('0x7'));var controller=require('./intServicenowConfiguration.controller');router[_0xa1cb('0x8')]('/',auth['isAuthenticated'](),controller[_0xa1cb('0x9')]);router[_0xa1cb('0x8')](_0xa1cb('0xa'),auth[_0xa1cb('0xb')](),controller['show']);router['get'](_0xa1cb('0xc'),auth[_0xa1cb('0xb')](),controller['getFields']);router[_0xa1cb('0x8')](_0xa1cb('0xd'),auth[_0xa1cb('0xb')](),controller[_0xa1cb('0xe')]);router[_0xa1cb('0x8')](_0xa1cb('0xf'),auth[_0xa1cb('0xb')](),controller[_0xa1cb('0x10')]);router[_0xa1cb('0x11')]('/',auth[_0xa1cb('0xb')](),controller['create']);router[_0xa1cb('0x12')](_0xa1cb('0xa'),auth[_0xa1cb('0xb')](),controller[_0xa1cb('0x13')]);router[_0xa1cb('0x14')](_0xa1cb('0xa'),auth[_0xa1cb('0xb')](),controller[_0xa1cb('0x15')]);module[_0xa1cb('0x16')]=router;
\ No newline at end of file
+var _0x960c=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete'];(function(_0x16cdec,_0x1544d7){var _0x3a1bac=function(_0x44273c){while(--_0x44273c){_0x16cdec['push'](_0x16cdec['shift']());}};_0x3a1bac(++_0x1544d7);}(_0x960c,0x144));var _0xc960=function(_0x414c7c,_0x3a966d){_0x414c7c=_0x414c7c-0x0;var _0x134d73=_0x960c[_0x414c7c];return _0x134d73;};'use strict';var multer=require(_0xc960('0x0'));var util=require(_0xc960('0x1'));var path=require(_0xc960('0x2'));var timeout=require(_0xc960('0x3'));var express=require(_0xc960('0x4'));var router=express[_0xc960('0x5')]();var auth=require(_0xc960('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc960('0x7'));var controller=require(_0xc960('0x8'));router[_0xc960('0x9')]('/',auth[_0xc960('0xa')](),controller[_0xc960('0xb')]);router['get'](_0xc960('0xc'),auth['isAuthenticated'](),controller[_0xc960('0xd')]);router[_0xc960('0x9')]('/:id/fields',auth[_0xc960('0xa')](),controller['getFields']);router[_0xc960('0x9')]('/:id/subjects',auth[_0xc960('0xa')](),controller[_0xc960('0xe')]);router[_0xc960('0x9')](_0xc960('0xf'),auth[_0xc960('0xa')](),controller[_0xc960('0x10')]);router['post']('/',auth[_0xc960('0xa')](),controller[_0xc960('0x11')]);router[_0xc960('0x12')](_0xc960('0xc'),auth['isAuthenticated'](),controller[_0xc960('0x13')]);router[_0xc960('0x14')](_0xc960('0xc'),auth[_0xc960('0xa')](),controller[_0xc960('0x15')]);module[_0xc960('0x16')]=router;
\ No newline at end of file
index 67f6353..58fc4c7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x150b=['exports','STRING','sequelize'];(function(_0x5ca2ff,_0x304690){var _0x2d0936=function(_0x5a0a4b){while(--_0x5a0a4b){_0x5ca2ff['push'](_0x5ca2ff['shift']());}};_0x2d0936(++_0x304690);}(_0x150b,0x12b));var _0xb150=function(_0x4f9d26,_0x641341){_0x4f9d26=_0x4f9d26-0x0;var _0x57debc=_0x150b[_0x4f9d26];return _0x57debc;};'use strict';var Sequelize=require(_0xb150('0x0'));module[_0xb150('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb150('0x2')]}};
\ No newline at end of file
+var _0x1d43=['sequelize','STRING'];(function(_0x40ecb4,_0x3fd69e){var _0x579635=function(_0x3f3975){while(--_0x3f3975){_0x40ecb4['push'](_0x40ecb4['shift']());}};_0x579635(++_0x3fd69e);}(_0x1d43,0x1ac));var _0x31d4=function(_0x2642fa,_0x556606){_0x2642fa=_0x2642fa-0x0;var _0x5be253=_0x1d43[_0x2642fa];return _0x5be253;};'use strict';var Sequelize=require(_0x31d4('0x0'));module['exports']={'name':{'type':Sequelize[_0x31d4('0x1')]},'description':{'type':Sequelize[_0x31d4('0x1')]}};
\ No newline at end of file
index 729a84b..fff7031 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xec56=['info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','destroy','sendStatus','stack','name','send','index','ServicenowConfiguration','rawAttributes','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','map','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','show','create','body','find','params','getFields','findOne','ServicenowField','length','order','filter','getSubjects','getDescriptions','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','then'];(function(_0x42bbf2,_0x6ed3f2){var _0x31a732=function(_0x5b3c39){while(--_0x5b3c39){_0x42bbf2['push'](_0x42bbf2['shift']());}};_0x31a732(++_0x6ed3f2);}(_0xec56,0x1bd));var _0x6ec5=function(_0x47c4cf,_0x8e7539){_0x47c4cf=_0x47c4cf-0x0;var _0x2c83b7=_0xec56[_0x47c4cf];return _0x2c83b7;};'use strict';var pdf=require(_0x6ec5('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6ec5('0x1'));var jsonpatch=require(_0x6ec5('0x2'));var rp=require(_0x6ec5('0x3'));var moment=require(_0x6ec5('0x4'));var BPromise=require(_0x6ec5('0x5'));var Mustache=require(_0x6ec5('0x6'));var util=require(_0x6ec5('0x7'));var path=require(_0x6ec5('0x8'));var sox=require(_0x6ec5('0x9'));var csv=require(_0x6ec5('0xa'));var ejs=require(_0x6ec5('0xb'));var fs=require('fs');var _=require(_0x6ec5('0xc'));var squel=require(_0x6ec5('0xd'));var crypto=require(_0x6ec5('0xe'));var jsforce=require(_0x6ec5('0xf'));var deskjs=require(_0x6ec5('0x10'));var toCsv=require(_0x6ec5('0xa'));var querystring=require(_0x6ec5('0x11'));var Papa=require(_0x6ec5('0x12'));var authService=require('../../components/auth/service');var hardwareService=require(_0x6ec5('0x13'));var Redis=require(_0x6ec5('0x14'));var qs=require(_0x6ec5('0x15'));var logger=require(_0x6ec5('0x16'))(_0x6ec5('0x17'));var utils=require(_0x6ec5('0x18'));var config=require(_0x6ec5('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x6ec5('0x1a'));var client=jayson[_0x6ec5('0x1b')][_0x6ec5('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xb04ab6,_0x135aaf,_0x2890fb,_0x2f4c5d){return new BPromise(function(_0x39125b,_0x5166ad){var _0x3ed07a=_0x2f4c5d||client;return _0x3ed07a['request'](_0xb04ab6,_0x2890fb)[_0x6ec5('0x1d')](function(_0x287542){logger[_0x6ec5('0x1e')](_0x6ec5('0x1f'),_0x135aaf,_0x6ec5('0x20'));logger['debug'](_0x6ec5('0x21'),_0x135aaf,_0x6ec5('0x20'),JSON[_0x6ec5('0x22')](_0x287542));if(_0x287542[_0x6ec5('0x23')]){if(_0x287542[_0x6ec5('0x23')][_0x6ec5('0x24')]===0x1f4){logger[_0x6ec5('0x23')](_0x6ec5('0x1f'),_0x135aaf,_0x287542[_0x6ec5('0x23')][_0x6ec5('0x25')]);return _0x5166ad(_0x287542[_0x6ec5('0x23')][_0x6ec5('0x25')]);}logger[_0x6ec5('0x23')](_0x6ec5('0x1f'),_0x135aaf,_0x287542[_0x6ec5('0x23')][_0x6ec5('0x25')]);return _0x39125b(_0x287542[_0x6ec5('0x23')]['message']);}else{logger[_0x6ec5('0x1e')](_0x6ec5('0x1f'),_0x135aaf,_0x6ec5('0x20'));_0x39125b(_0x287542[_0x6ec5('0x26')][_0x6ec5('0x25')]);}})[_0x6ec5('0x27')](function(_0x18243f){logger['error'](_0x6ec5('0x1f'),_0x135aaf,_0x18243f);_0x5166ad(_0x18243f);});});}function respondWithStatusCode(_0x2ecdcf,_0x358d18){_0x358d18=_0x358d18||0xcc;return function(_0x1560c6){if(_0x1560c6){return _0x2ecdcf['sendStatus'](_0x358d18);}return _0x2ecdcf[_0x6ec5('0x28')](_0x358d18)[_0x6ec5('0x29')]();};}function respondWithResult(_0x5be80f,_0x2dc0a7){_0x2dc0a7=_0x2dc0a7||0xc8;return function(_0x19812b){if(_0x19812b){return _0x5be80f[_0x6ec5('0x28')](_0x2dc0a7)['json'](_0x19812b);}};}function respondWithFilteredResult(_0x1b779a,_0xd0e8d7){return function(_0x197ea8){if(_0x197ea8){var _0x462488=_0x197ea8[_0x6ec5('0x2a')],_0x425fac=_0xd0e8d7['offset'],_0x484847=_0xd0e8d7[_0x6ec5('0x2b')]+_0xd0e8d7[_0x6ec5('0x2c')],_0x171e2a;if(_0x484847>=_0x462488){_0x484847=_0x462488;_0x171e2a=0xc8;}else{_0x171e2a=0xce;}_0x1b779a['status'](_0x171e2a);return _0x1b779a[_0x6ec5('0x2d')](_0x6ec5('0x2e'),_0x425fac+'-'+_0x484847+'/'+_0x462488)[_0x6ec5('0x2f')](_0x197ea8);}return null;};}function patchUpdates(_0xa227ff){return function(_0x116659){try{jsonpatch['apply'](_0x116659,_0xa227ff,!![]);}catch(_0x2b8c99){return BPromise[_0x6ec5('0x30')](_0x2b8c99);}return _0x116659[_0x6ec5('0x31')]();};}function saveUpdates(_0x174164,_0x3e6d33){return function(_0x22c3d3){if(_0x22c3d3){return _0x22c3d3[_0x6ec5('0x32')](_0x174164)['then'](function(_0x2684fd){return _0x2684fd;});}return null;};}function removeEntity(_0x47a052,_0x15e1f6){return function(_0x5c6517){if(_0x5c6517){return _0x5c6517[_0x6ec5('0x33')]()[_0x6ec5('0x1d')](function(){_0x47a052['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bfab4,_0x293915){return function(_0x4b7662){if(!_0x4b7662){_0x3bfab4[_0x6ec5('0x34')](0x194);}return _0x4b7662;};}function handleError(_0x251bcf,_0x54ab73){_0x54ab73=_0x54ab73||0x1f4;return function(_0x249a8b){logger[_0x6ec5('0x23')](_0x249a8b[_0x6ec5('0x35')]);if(_0x249a8b[_0x6ec5('0x36')]){delete _0x249a8b[_0x6ec5('0x36')];}_0x251bcf[_0x6ec5('0x28')](_0x54ab73)[_0x6ec5('0x37')](_0x249a8b);};}exports[_0x6ec5('0x38')]=function(_0x4b7a08,_0x11ba9b){var _0x4d8b6e={},_0x9fec63={},_0xe1e58={'count':0x0,'rows':[]};var _0x26ada3=db[_0x6ec5('0x39')][_0x6ec5('0x3a')];_0x9fec63[_0x6ec5('0x3b')]=_[_0x6ec5('0x3c')](_0x26ada3);_0x9fec63[_0x6ec5('0x3d')]=_[_0x6ec5('0x3c')](_0x4b7a08[_0x6ec5('0x3d')]);_0x9fec63[_0x6ec5('0x3e')]=_['intersection'](_0x9fec63['model'],_0x9fec63[_0x6ec5('0x3d')]);_0x4d8b6e['attributes']=_[_0x6ec5('0x3f')](_0x9fec63[_0x6ec5('0x3b')],qs[_0x6ec5('0x40')](_0x4b7a08[_0x6ec5('0x3d')][_0x6ec5('0x40')]));_0x4d8b6e[_0x6ec5('0x41')]=_0x4d8b6e[_0x6ec5('0x41')]['length']?_0x4d8b6e[_0x6ec5('0x41')]:_0x9fec63[_0x6ec5('0x3b')];if(!_0x4b7a08[_0x6ec5('0x3d')][_0x6ec5('0x42')](_0x6ec5('0x43'))){_0x4d8b6e[_0x6ec5('0x2c')]=qs[_0x6ec5('0x2c')](_0x4b7a08[_0x6ec5('0x3d')][_0x6ec5('0x2c')]);_0x4d8b6e['offset']=qs[_0x6ec5('0x2b')](_0x4b7a08['query'][_0x6ec5('0x2b')]);}_0x4d8b6e['order']=qs[_0x6ec5('0x44')](_0x4b7a08[_0x6ec5('0x3d')]['sort']);_0x4d8b6e[_0x6ec5('0x45')]=qs[_0x6ec5('0x3e')](_[_0x6ec5('0x46')](_0x4b7a08['query'],_0x9fec63[_0x6ec5('0x3e')]));if(_0x4b7a08[_0x6ec5('0x3d')]['filter']){_0x4d8b6e[_0x6ec5('0x45')]=_[_0x6ec5('0x47')](_0x4d8b6e[_0x6ec5('0x45')],{'$or':_[_0x6ec5('0x48')](_0x26ada3,function(_0x43d858){if(_0x43d858[_0x6ec5('0x49')][_0x6ec5('0x4a')]!==_0x6ec5('0x4b')){var _0xce0f06={};_0xce0f06[_0x43d858[_0x6ec5('0x4c')]]={'$like':'%'+_0x4b7a08[_0x6ec5('0x3d')]['filter']+'%'};return _0xce0f06;}})});}_0x4d8b6e=_[_0x6ec5('0x47')]({},_0x4d8b6e,_0x4b7a08[_0x6ec5('0x4d')]);var _0x468a74={'where':_0x4d8b6e[_0x6ec5('0x45')]};return db['ServicenowConfiguration'][_0x6ec5('0x2a')](_0x468a74)[_0x6ec5('0x1d')](function(_0x56cd2a){_0xe1e58[_0x6ec5('0x2a')]=_0x56cd2a;if(_0x4b7a08['query'][_0x6ec5('0x4e')]){_0x4d8b6e[_0x6ec5('0x4f')]=[{'all':!![]}];}return db[_0x6ec5('0x39')][_0x6ec5('0x50')](_0x4d8b6e);})['then'](function(_0x5b0656){_0xe1e58[_0x6ec5('0x51')]=_0x5b0656;return _0xe1e58;})['then'](respondWithFilteredResult(_0x11ba9b,_0x4d8b6e))[_0x6ec5('0x27')](handleError(_0x11ba9b,null));};exports[_0x6ec5('0x52')]=function(_0x390141,_0x3442a9){var _0x2cf8c7={'raw':![],'where':{'id':_0x390141['params']['id']}},_0x4d6733={};_0x4d6733[_0x6ec5('0x3b')]=_[_0x6ec5('0x3c')](db[_0x6ec5('0x39')][_0x6ec5('0x3a')]);_0x4d6733[_0x6ec5('0x3d')]=_[_0x6ec5('0x3c')](_0x390141[_0x6ec5('0x3d')]);_0x4d6733[_0x6ec5('0x3e')]=_[_0x6ec5('0x3f')](_0x4d6733[_0x6ec5('0x3b')],_0x4d6733[_0x6ec5('0x3d')]);_0x2cf8c7[_0x6ec5('0x41')]=_[_0x6ec5('0x3f')](_0x4d6733[_0x6ec5('0x3b')],qs['fields'](_0x390141[_0x6ec5('0x3d')]['fields']));_0x2cf8c7[_0x6ec5('0x41')]=_0x2cf8c7[_0x6ec5('0x41')]['length']?_0x2cf8c7[_0x6ec5('0x41')]:_0x4d6733[_0x6ec5('0x3b')];if(_0x390141['query'][_0x6ec5('0x4e')]){_0x2cf8c7[_0x6ec5('0x4f')]=[{'all':!![]}];}_0x2cf8c7=_['merge']({},_0x2cf8c7,_0x390141['options']);return db[_0x6ec5('0x39')]['find'](_0x2cf8c7)['then'](handleEntityNotFound(_0x3442a9,null))[_0x6ec5('0x1d')](respondWithResult(_0x3442a9,null))[_0x6ec5('0x27')](handleError(_0x3442a9,null));};exports[_0x6ec5('0x53')]=function(_0x16ac52,_0x5aecab){return db[_0x6ec5('0x39')][_0x6ec5('0x53')](_0x16ac52[_0x6ec5('0x54')],{})[_0x6ec5('0x1d')](respondWithResult(_0x5aecab,0xc9))[_0x6ec5('0x27')](handleError(_0x5aecab,null));};exports[_0x6ec5('0x32')]=function(_0x15c0d7,_0x29bf52){if(_0x15c0d7[_0x6ec5('0x54')]['id']){delete _0x15c0d7[_0x6ec5('0x54')]['id'];}return db[_0x6ec5('0x39')][_0x6ec5('0x55')]({'where':{'id':_0x15c0d7[_0x6ec5('0x56')]['id']}})['then'](handleEntityNotFound(_0x29bf52,null))[_0x6ec5('0x1d')](saveUpdates(_0x15c0d7[_0x6ec5('0x54')],null))['then'](respondWithResult(_0x29bf52,null))[_0x6ec5('0x27')](handleError(_0x29bf52,null));};exports[_0x6ec5('0x33')]=function(_0x377c08,_0x1e80bc){return db[_0x6ec5('0x39')]['find']({'where':{'id':_0x377c08['params']['id']}})[_0x6ec5('0x1d')](handleEntityNotFound(_0x1e80bc,null))['then'](removeEntity(_0x1e80bc,null))[_0x6ec5('0x27')](handleError(_0x1e80bc,null));};exports[_0x6ec5('0x57')]=function(_0x16ce99,_0x1f7674,_0x301e31){var _0x4bb0e4={};var _0xa00917={};var _0x4838a9;var _0x4c7104;return db['ServicenowConfiguration'][_0x6ec5('0x58')]({'where':{'id':_0x16ce99[_0x6ec5('0x56')]['id']}})['then'](handleEntityNotFound(_0x1f7674,null))['then'](function(_0x36d685){if(_0x36d685){_0x4838a9=_0x36d685;_0xa00917[_0x6ec5('0x3b')]=_[_0x6ec5('0x3c')](db[_0x6ec5('0x59')][_0x6ec5('0x3a')]);_0xa00917['query']=_[_0x6ec5('0x3c')](_0x16ce99[_0x6ec5('0x3d')]);_0xa00917[_0x6ec5('0x3e')]=_[_0x6ec5('0x3f')](_0xa00917[_0x6ec5('0x3b')],_0xa00917['query']);_0x4bb0e4[_0x6ec5('0x41')]=_[_0x6ec5('0x3f')](_0xa00917[_0x6ec5('0x3b')],qs[_0x6ec5('0x40')](_0x16ce99[_0x6ec5('0x3d')][_0x6ec5('0x40')]));_0x4bb0e4[_0x6ec5('0x41')]=_0x4bb0e4[_0x6ec5('0x41')][_0x6ec5('0x5a')]?_0x4bb0e4[_0x6ec5('0x41')]:_0xa00917[_0x6ec5('0x3b')];_0x4bb0e4[_0x6ec5('0x5b')]=qs[_0x6ec5('0x44')](_0x16ce99[_0x6ec5('0x3d')][_0x6ec5('0x44')]);_0x4bb0e4[_0x6ec5('0x45')]=qs[_0x6ec5('0x3e')](_['pick'](_0x16ce99[_0x6ec5('0x3d')],_0xa00917['filters']));if(_0x16ce99[_0x6ec5('0x3d')]['filter']){_0x4bb0e4['where']=_[_0x6ec5('0x47')](_0x4bb0e4[_0x6ec5('0x45')],{'$or':_[_0x6ec5('0x48')](_0x4bb0e4[_0x6ec5('0x41')],function(_0x1d4424){var _0x48b5a9={};_0x48b5a9[_0x1d4424]={'$like':'%'+_0x16ce99[_0x6ec5('0x3d')][_0x6ec5('0x5c')]+'%'};return _0x48b5a9;})});}_0x4bb0e4=_[_0x6ec5('0x47')]({},_0x4bb0e4,_0x16ce99[_0x6ec5('0x4d')]);return _0x4838a9[_0x6ec5('0x57')](_0x4bb0e4);}})['then'](function(_0x43453f){if(_0x43453f){_0x4c7104=_0x43453f[_0x6ec5('0x5a')];if(!_0x16ce99[_0x6ec5('0x3d')][_0x6ec5('0x42')]('nolimit')){_0x4bb0e4[_0x6ec5('0x2c')]=qs[_0x6ec5('0x2c')](_0x16ce99['query']['limit']);_0x4bb0e4[_0x6ec5('0x2b')]=qs[_0x6ec5('0x2b')](_0x16ce99[_0x6ec5('0x3d')][_0x6ec5('0x2b')]);}return _0x4838a9[_0x6ec5('0x57')](_0x4bb0e4);}})[_0x6ec5('0x1d')](function(_0x3233ab){if(_0x3233ab){return _0x3233ab?{'count':_0x4c7104,'rows':_0x3233ab}:null;}})[_0x6ec5('0x1d')](respondWithResult(_0x1f7674,null))[_0x6ec5('0x27')](handleError(_0x1f7674,null));};exports[_0x6ec5('0x5d')]=function(_0x37503f,_0x5c297f,_0x2dcd18){var _0x12fdac={};var _0x3ee62e={};var _0x3003d8;var _0x480f40;return db[_0x6ec5('0x39')][_0x6ec5('0x58')]({'where':{'id':_0x37503f[_0x6ec5('0x56')]['id']}})[_0x6ec5('0x1d')](handleEntityNotFound(_0x5c297f,null))['then'](function(_0x3c3d8c){if(_0x3c3d8c){_0x3003d8=_0x3c3d8c;_0x3ee62e[_0x6ec5('0x3b')]=_[_0x6ec5('0x3c')](db['ServicenowField']['rawAttributes']);_0x3ee62e[_0x6ec5('0x3d')]=_[_0x6ec5('0x3c')](_0x37503f['query']);_0x3ee62e[_0x6ec5('0x3e')]=_[_0x6ec5('0x3f')](_0x3ee62e[_0x6ec5('0x3b')],_0x3ee62e[_0x6ec5('0x3d')]);_0x12fdac['attributes']=_[_0x6ec5('0x3f')](_0x3ee62e[_0x6ec5('0x3b')],qs[_0x6ec5('0x40')](_0x37503f['query'][_0x6ec5('0x40')]));_0x12fdac[_0x6ec5('0x41')]=_0x12fdac[_0x6ec5('0x41')][_0x6ec5('0x5a')]?_0x12fdac[_0x6ec5('0x41')]:_0x3ee62e[_0x6ec5('0x3b')];_0x12fdac[_0x6ec5('0x5b')]=qs[_0x6ec5('0x44')](_0x37503f['query'][_0x6ec5('0x44')]);_0x12fdac[_0x6ec5('0x45')]=qs['filters'](_['pick'](_0x37503f[_0x6ec5('0x3d')],_0x3ee62e[_0x6ec5('0x3e')]));if(_0x37503f[_0x6ec5('0x3d')]['filter']){_0x12fdac[_0x6ec5('0x45')]=_[_0x6ec5('0x47')](_0x12fdac[_0x6ec5('0x45')],{'$or':_[_0x6ec5('0x48')](_0x12fdac['attributes'],function(_0x220b28){var _0x376411={};_0x376411[_0x220b28]={'$like':'%'+_0x37503f[_0x6ec5('0x3d')][_0x6ec5('0x5c')]+'%'};return _0x376411;})});}_0x12fdac=_[_0x6ec5('0x47')]({},_0x12fdac,_0x37503f[_0x6ec5('0x4d')]);return _0x3003d8[_0x6ec5('0x5d')](_0x12fdac);}})[_0x6ec5('0x1d')](function(_0x16b3d8){if(_0x16b3d8){_0x480f40=_0x16b3d8['length'];if(!_0x37503f['query'][_0x6ec5('0x42')](_0x6ec5('0x43'))){_0x12fdac[_0x6ec5('0x2c')]=qs['limit'](_0x37503f[_0x6ec5('0x3d')]['limit']);_0x12fdac[_0x6ec5('0x2b')]=qs[_0x6ec5('0x2b')](_0x37503f['query']['offset']);}return _0x3003d8[_0x6ec5('0x5d')](_0x12fdac);}})[_0x6ec5('0x1d')](function(_0x207142){if(_0x207142){return _0x207142?{'count':_0x480f40,'rows':_0x207142}:null;}})[_0x6ec5('0x1d')](respondWithResult(_0x5c297f,null))['catch'](handleError(_0x5c297f,null));};exports[_0x6ec5('0x5e')]=function(_0x27b01b,_0x180865,_0x569fc6){var _0x5befa3={};var _0x579490={};var _0x3a5b21;var _0x18fbea;return db[_0x6ec5('0x39')][_0x6ec5('0x58')]({'where':{'id':_0x27b01b[_0x6ec5('0x56')]['id']}})[_0x6ec5('0x1d')](handleEntityNotFound(_0x180865,null))[_0x6ec5('0x1d')](function(_0x543c38){if(_0x543c38){_0x3a5b21=_0x543c38;_0x579490[_0x6ec5('0x3b')]=_['keys'](db[_0x6ec5('0x59')][_0x6ec5('0x3a')]);_0x579490['query']=_[_0x6ec5('0x3c')](_0x27b01b[_0x6ec5('0x3d')]);_0x579490['filters']=_[_0x6ec5('0x3f')](_0x579490[_0x6ec5('0x3b')],_0x579490['query']);_0x5befa3[_0x6ec5('0x41')]=_[_0x6ec5('0x3f')](_0x579490[_0x6ec5('0x3b')],qs['fields'](_0x27b01b['query'][_0x6ec5('0x40')]));_0x5befa3[_0x6ec5('0x41')]=_0x5befa3[_0x6ec5('0x41')][_0x6ec5('0x5a')]?_0x5befa3[_0x6ec5('0x41')]:_0x579490[_0x6ec5('0x3b')];_0x5befa3[_0x6ec5('0x5b')]=qs[_0x6ec5('0x44')](_0x27b01b[_0x6ec5('0x3d')][_0x6ec5('0x44')]);_0x5befa3[_0x6ec5('0x45')]=qs[_0x6ec5('0x3e')](_[_0x6ec5('0x46')](_0x27b01b['query'],_0x579490[_0x6ec5('0x3e')]));if(_0x27b01b[_0x6ec5('0x3d')][_0x6ec5('0x5c')]){_0x5befa3[_0x6ec5('0x45')]=_['merge'](_0x5befa3[_0x6ec5('0x45')],{'$or':_['map'](_0x5befa3[_0x6ec5('0x41')],function(_0x2e6e33){var _0x34a8d9={};_0x34a8d9[_0x2e6e33]={'$like':'%'+_0x27b01b[_0x6ec5('0x3d')][_0x6ec5('0x5c')]+'%'};return _0x34a8d9;})});}_0x5befa3=_[_0x6ec5('0x47')]({},_0x5befa3,_0x27b01b[_0x6ec5('0x4d')]);return _0x3a5b21['getDescriptions'](_0x5befa3);}})[_0x6ec5('0x1d')](function(_0xd13ca6){if(_0xd13ca6){_0x18fbea=_0xd13ca6['length'];if(!_0x27b01b[_0x6ec5('0x3d')][_0x6ec5('0x42')](_0x6ec5('0x43'))){_0x5befa3[_0x6ec5('0x2c')]=qs[_0x6ec5('0x2c')](_0x27b01b[_0x6ec5('0x3d')][_0x6ec5('0x2c')]);_0x5befa3[_0x6ec5('0x2b')]=qs[_0x6ec5('0x2b')](_0x27b01b[_0x6ec5('0x3d')][_0x6ec5('0x2b')]);}return _0x3a5b21[_0x6ec5('0x5e')](_0x5befa3);}})[_0x6ec5('0x1d')](function(_0x3d0b1d){if(_0x3d0b1d){return _0x3d0b1d?{'count':_0x18fbea,'rows':_0x3d0b1d}:null;}})[_0x6ec5('0x1d')](respondWithResult(_0x180865,null))['catch'](handleError(_0x180865,null));};
\ No newline at end of file
+var _0xf109=['attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','map','type','key','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','update','body','destroy','params','ServicenowField','pick','getFields','findOne','getSubjects','nolimit','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','save','then','name','send','index','ServicenowConfiguration','rawAttributes','keys','query','filters','intersection','model'];(function(_0x57b432,_0x1589a0){var _0x2edf2a=function(_0x20edfc){while(--_0x20edfc){_0x57b432['push'](_0x57b432['shift']());}};_0x2edf2a(++_0x1589a0);}(_0xf109,0xce));var _0x9f10=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xf109[_0x29d94e];return _0x106237;};'use strict';var pdf=require(_0x9f10('0x0'));var emlformat=require(_0x9f10('0x1'));var rimraf=require(_0x9f10('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9f10('0x3'));var BPromise=require(_0x9f10('0x4'));var Mustache=require(_0x9f10('0x5'));var util=require(_0x9f10('0x6'));var path=require(_0x9f10('0x7'));var sox=require(_0x9f10('0x8'));var csv=require(_0x9f10('0x9'));var ejs=require(_0x9f10('0xa'));var fs=require('fs');var _=require(_0x9f10('0xb'));var squel=require(_0x9f10('0xc'));var crypto=require(_0x9f10('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9f10('0xe'));var toCsv=require(_0x9f10('0x9'));var querystring=require(_0x9f10('0xf'));var Papa=require(_0x9f10('0x10'));var authService=require(_0x9f10('0x11'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x9f10('0x12'));var qs=require(_0x9f10('0x13'));var logger=require(_0x9f10('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x9f10('0x15'));var db=require(_0x9f10('0x16'))['db'];var jayson=require(_0x9f10('0x17'));var client=jayson['client'][_0x9f10('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x260606,_0x35c529,_0x58067f,_0x9a3ae6){return new BPromise(function(_0x309f27,_0x5be443){var _0x40a48a=_0x9a3ae6||client;return _0x40a48a[_0x9f10('0x19')](_0x260606,_0x58067f)['then'](function(_0x59bcad){logger[_0x9f10('0x1a')](_0x9f10('0x1b'),_0x35c529,'request\x20sent');logger[_0x9f10('0x1c')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x35c529,_0x9f10('0x1d'),JSON[_0x9f10('0x1e')](_0x59bcad));if(_0x59bcad['error']){if(_0x59bcad[_0x9f10('0x1f')][_0x9f10('0x20')]===0x1f4){logger['error'](_0x9f10('0x1b'),_0x35c529,_0x59bcad['error'][_0x9f10('0x21')]);return _0x5be443(_0x59bcad['error'][_0x9f10('0x21')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x35c529,_0x59bcad[_0x9f10('0x1f')][_0x9f10('0x21')]);return _0x309f27(_0x59bcad[_0x9f10('0x1f')][_0x9f10('0x21')]);}else{logger[_0x9f10('0x1a')](_0x9f10('0x1b'),_0x35c529,_0x9f10('0x1d'));_0x309f27(_0x59bcad['result'][_0x9f10('0x21')]);}})['catch'](function(_0x293990){logger[_0x9f10('0x1f')](_0x9f10('0x1b'),_0x35c529,_0x293990);_0x5be443(_0x293990);});});}function respondWithStatusCode(_0x4adbda,_0x2f31fb){_0x2f31fb=_0x2f31fb||0xcc;return function(_0x3dde2e){if(_0x3dde2e){return _0x4adbda[_0x9f10('0x22')](_0x2f31fb);}return _0x4adbda['status'](_0x2f31fb)[_0x9f10('0x23')]();};}function respondWithResult(_0x37e9ac,_0x44b99d){_0x44b99d=_0x44b99d||0xc8;return function(_0x4c531e){if(_0x4c531e){return _0x37e9ac[_0x9f10('0x24')](_0x44b99d)[_0x9f10('0x25')](_0x4c531e);}};}function respondWithFilteredResult(_0x11cae7,_0x1647c0){return function(_0x5e80de){if(_0x5e80de){var _0x57539b=_0x5e80de[_0x9f10('0x26')],_0x5c1800=_0x1647c0[_0x9f10('0x27')],_0x385a39=_0x1647c0[_0x9f10('0x27')]+_0x1647c0[_0x9f10('0x28')],_0x4a0407;if(_0x385a39>=_0x57539b){_0x385a39=_0x57539b;_0x4a0407=0xc8;}else{_0x4a0407=0xce;}_0x11cae7[_0x9f10('0x24')](_0x4a0407);return _0x11cae7['set'](_0x9f10('0x29'),_0x5c1800+'-'+_0x385a39+'/'+_0x57539b)[_0x9f10('0x25')](_0x5e80de);}return null;};}function patchUpdates(_0x40f96b){return function(_0xfbb37f){try{jsonpatch[_0x9f10('0x2a')](_0xfbb37f,_0x40f96b,!![]);}catch(_0x2c4373){return BPromise['reject'](_0x2c4373);}return _0xfbb37f[_0x9f10('0x2b')]();};}function saveUpdates(_0x501ee,_0x44207f){return function(_0x1b03ee){if(_0x1b03ee){return _0x1b03ee['update'](_0x501ee)[_0x9f10('0x2c')](function(_0x44f389){return _0x44f389;});}return null;};}function removeEntity(_0x34d8f6,_0x5dd404){return function(_0x434128){if(_0x434128){return _0x434128['destroy']()[_0x9f10('0x2c')](function(){_0x34d8f6[_0x9f10('0x24')](0xcc)[_0x9f10('0x23')]();});}};}function handleEntityNotFound(_0x5944e5,_0x3ac139){return function(_0x451478){if(!_0x451478){_0x5944e5[_0x9f10('0x22')](0x194);}return _0x451478;};}function handleError(_0x11f128,_0x148a5b){_0x148a5b=_0x148a5b||0x1f4;return function(_0x47bb88){logger[_0x9f10('0x1f')](_0x47bb88['stack']);if(_0x47bb88[_0x9f10('0x2d')]){delete _0x47bb88[_0x9f10('0x2d')];}_0x11f128[_0x9f10('0x24')](_0x148a5b)[_0x9f10('0x2e')](_0x47bb88);};}exports[_0x9f10('0x2f')]=function(_0x12c486,_0x4b87b0){var _0x2dd250={},_0x3a1601={},_0x1b8018={'count':0x0,'rows':[]};var _0x5e63b1=db[_0x9f10('0x30')][_0x9f10('0x31')];_0x3a1601['model']=_[_0x9f10('0x32')](_0x5e63b1);_0x3a1601['query']=_[_0x9f10('0x32')](_0x12c486[_0x9f10('0x33')]);_0x3a1601[_0x9f10('0x34')]=_[_0x9f10('0x35')](_0x3a1601[_0x9f10('0x36')],_0x3a1601[_0x9f10('0x33')]);_0x2dd250[_0x9f10('0x37')]=_[_0x9f10('0x35')](_0x3a1601['model'],qs[_0x9f10('0x38')](_0x12c486[_0x9f10('0x33')][_0x9f10('0x38')]));_0x2dd250['attributes']=_0x2dd250[_0x9f10('0x37')][_0x9f10('0x39')]?_0x2dd250['attributes']:_0x3a1601[_0x9f10('0x36')];if(!_0x12c486[_0x9f10('0x33')][_0x9f10('0x3a')]('nolimit')){_0x2dd250['limit']=qs[_0x9f10('0x28')](_0x12c486[_0x9f10('0x33')][_0x9f10('0x28')]);_0x2dd250[_0x9f10('0x27')]=qs[_0x9f10('0x27')](_0x12c486[_0x9f10('0x33')][_0x9f10('0x27')]);}_0x2dd250[_0x9f10('0x3b')]=qs[_0x9f10('0x3c')](_0x12c486[_0x9f10('0x33')][_0x9f10('0x3c')]);_0x2dd250[_0x9f10('0x3d')]=qs['filters'](_['pick'](_0x12c486['query'],_0x3a1601[_0x9f10('0x34')]));if(_0x12c486['query'][_0x9f10('0x3e')]){_0x2dd250[_0x9f10('0x3d')]=_[_0x9f10('0x3f')](_0x2dd250['where'],{'$or':_[_0x9f10('0x40')](_0x5e63b1,function(_0xf1164){if(_0xf1164[_0x9f10('0x41')][_0x9f10('0x42')]!==_0x9f10('0x43')){var _0x4eb658={};_0x4eb658[_0xf1164['field']]={'$like':'%'+_0x12c486['query'][_0x9f10('0x3e')]+'%'};return _0x4eb658;}})});}_0x2dd250=_['merge']({},_0x2dd250,_0x12c486[_0x9f10('0x44')]);var _0x49f6cc={'where':_0x2dd250[_0x9f10('0x3d')]};return db[_0x9f10('0x30')][_0x9f10('0x26')](_0x49f6cc)[_0x9f10('0x2c')](function(_0x553fff){_0x1b8018[_0x9f10('0x26')]=_0x553fff;if(_0x12c486[_0x9f10('0x33')]['includeAll']){_0x2dd250[_0x9f10('0x45')]=[{'all':!![]}];}return db[_0x9f10('0x30')][_0x9f10('0x46')](_0x2dd250);})[_0x9f10('0x2c')](function(_0x1b3529){_0x1b8018[_0x9f10('0x47')]=_0x1b3529;return _0x1b8018;})[_0x9f10('0x2c')](respondWithFilteredResult(_0x4b87b0,_0x2dd250))[_0x9f10('0x48')](handleError(_0x4b87b0,null));};exports[_0x9f10('0x49')]=function(_0x2672a0,_0x552588){var _0x181eab={'raw':![],'where':{'id':_0x2672a0['params']['id']}},_0x102730={};_0x102730[_0x9f10('0x36')]=_[_0x9f10('0x32')](db[_0x9f10('0x30')][_0x9f10('0x31')]);_0x102730['query']=_[_0x9f10('0x32')](_0x2672a0[_0x9f10('0x33')]);_0x102730[_0x9f10('0x34')]=_[_0x9f10('0x35')](_0x102730[_0x9f10('0x36')],_0x102730[_0x9f10('0x33')]);_0x181eab['attributes']=_[_0x9f10('0x35')](_0x102730[_0x9f10('0x36')],qs[_0x9f10('0x38')](_0x2672a0[_0x9f10('0x33')][_0x9f10('0x38')]));_0x181eab[_0x9f10('0x37')]=_0x181eab['attributes'][_0x9f10('0x39')]?_0x181eab[_0x9f10('0x37')]:_0x102730[_0x9f10('0x36')];if(_0x2672a0[_0x9f10('0x33')][_0x9f10('0x4a')]){_0x181eab[_0x9f10('0x45')]=[{'all':!![]}];}_0x181eab=_[_0x9f10('0x3f')]({},_0x181eab,_0x2672a0[_0x9f10('0x44')]);return db['ServicenowConfiguration'][_0x9f10('0x4b')](_0x181eab)['then'](handleEntityNotFound(_0x552588,null))[_0x9f10('0x2c')](respondWithResult(_0x552588,null))['catch'](handleError(_0x552588,null));};exports[_0x9f10('0x4c')]=function(_0x2d06b2,_0x30fad9){return db[_0x9f10('0x30')][_0x9f10('0x4c')](_0x2d06b2['body'],{})[_0x9f10('0x2c')](respondWithResult(_0x30fad9,0xc9))[_0x9f10('0x48')](handleError(_0x30fad9,null));};exports[_0x9f10('0x4d')]=function(_0x3818dc,_0x500e51){if(_0x3818dc['body']['id']){delete _0x3818dc[_0x9f10('0x4e')]['id'];}return db[_0x9f10('0x30')]['find']({'where':{'id':_0x3818dc['params']['id']}})[_0x9f10('0x2c')](handleEntityNotFound(_0x500e51,null))[_0x9f10('0x2c')](saveUpdates(_0x3818dc[_0x9f10('0x4e')],null))['then'](respondWithResult(_0x500e51,null))[_0x9f10('0x48')](handleError(_0x500e51,null));};exports[_0x9f10('0x4f')]=function(_0x7611e8,_0x4c3d18){return db[_0x9f10('0x30')][_0x9f10('0x4b')]({'where':{'id':_0x7611e8[_0x9f10('0x50')]['id']}})['then'](handleEntityNotFound(_0x4c3d18,null))[_0x9f10('0x2c')](removeEntity(_0x4c3d18,null))[_0x9f10('0x48')](handleError(_0x4c3d18,null));};exports['getFields']=function(_0x2a99fa,_0x283a03,_0xcd8ae7){var _0x2c215d={};var _0x334ab4={};var _0x55cb99;var _0x3d6c26;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x2a99fa[_0x9f10('0x50')]['id']}})[_0x9f10('0x2c')](handleEntityNotFound(_0x283a03,null))[_0x9f10('0x2c')](function(_0x277a86){if(_0x277a86){_0x55cb99=_0x277a86;_0x334ab4[_0x9f10('0x36')]=_[_0x9f10('0x32')](db[_0x9f10('0x51')]['rawAttributes']);_0x334ab4['query']=_[_0x9f10('0x32')](_0x2a99fa[_0x9f10('0x33')]);_0x334ab4[_0x9f10('0x34')]=_[_0x9f10('0x35')](_0x334ab4[_0x9f10('0x36')],_0x334ab4[_0x9f10('0x33')]);_0x2c215d[_0x9f10('0x37')]=_['intersection'](_0x334ab4[_0x9f10('0x36')],qs[_0x9f10('0x38')](_0x2a99fa['query'][_0x9f10('0x38')]));_0x2c215d[_0x9f10('0x37')]=_0x2c215d['attributes'][_0x9f10('0x39')]?_0x2c215d[_0x9f10('0x37')]:_0x334ab4['model'];_0x2c215d[_0x9f10('0x3b')]=qs['sort'](_0x2a99fa[_0x9f10('0x33')][_0x9f10('0x3c')]);_0x2c215d[_0x9f10('0x3d')]=qs[_0x9f10('0x34')](_[_0x9f10('0x52')](_0x2a99fa['query'],_0x334ab4[_0x9f10('0x34')]));if(_0x2a99fa[_0x9f10('0x33')][_0x9f10('0x3e')]){_0x2c215d['where']=_['merge'](_0x2c215d[_0x9f10('0x3d')],{'$or':_[_0x9f10('0x40')](_0x2c215d[_0x9f10('0x37')],function(_0x20045f){var _0xd627a2={};_0xd627a2[_0x20045f]={'$like':'%'+_0x2a99fa[_0x9f10('0x33')][_0x9f10('0x3e')]+'%'};return _0xd627a2;})});}_0x2c215d=_['merge']({},_0x2c215d,_0x2a99fa[_0x9f10('0x44')]);return _0x55cb99[_0x9f10('0x53')](_0x2c215d);}})['then'](function(_0xb0f5e9){if(_0xb0f5e9){_0x3d6c26=_0xb0f5e9['length'];if(!_0x2a99fa[_0x9f10('0x33')][_0x9f10('0x3a')]('nolimit')){_0x2c215d[_0x9f10('0x28')]=qs['limit'](_0x2a99fa[_0x9f10('0x33')][_0x9f10('0x28')]);_0x2c215d[_0x9f10('0x27')]=qs['offset'](_0x2a99fa[_0x9f10('0x33')]['offset']);}return _0x55cb99[_0x9f10('0x53')](_0x2c215d);}})[_0x9f10('0x2c')](function(_0x3be022){if(_0x3be022){return _0x3be022?{'count':_0x3d6c26,'rows':_0x3be022}:null;}})['then'](respondWithResult(_0x283a03,null))[_0x9f10('0x48')](handleError(_0x283a03,null));};exports['getSubjects']=function(_0x5708c1,_0x3b1893,_0x34520c){var _0x6b3eb6={};var _0x50ea89={};var _0x3b2d92;var _0x5a64ae;return db['ServicenowConfiguration'][_0x9f10('0x54')]({'where':{'id':_0x5708c1['params']['id']}})['then'](handleEntityNotFound(_0x3b1893,null))[_0x9f10('0x2c')](function(_0x5302d3){if(_0x5302d3){_0x3b2d92=_0x5302d3;_0x50ea89[_0x9f10('0x36')]=_[_0x9f10('0x32')](db[_0x9f10('0x51')]['rawAttributes']);_0x50ea89[_0x9f10('0x33')]=_[_0x9f10('0x32')](_0x5708c1['query']);_0x50ea89[_0x9f10('0x34')]=_['intersection'](_0x50ea89['model'],_0x50ea89[_0x9f10('0x33')]);_0x6b3eb6[_0x9f10('0x37')]=_[_0x9f10('0x35')](_0x50ea89[_0x9f10('0x36')],qs[_0x9f10('0x38')](_0x5708c1[_0x9f10('0x33')][_0x9f10('0x38')]));_0x6b3eb6['attributes']=_0x6b3eb6[_0x9f10('0x37')][_0x9f10('0x39')]?_0x6b3eb6[_0x9f10('0x37')]:_0x50ea89[_0x9f10('0x36')];_0x6b3eb6[_0x9f10('0x3b')]=qs[_0x9f10('0x3c')](_0x5708c1[_0x9f10('0x33')][_0x9f10('0x3c')]);_0x6b3eb6[_0x9f10('0x3d')]=qs['filters'](_[_0x9f10('0x52')](_0x5708c1[_0x9f10('0x33')],_0x50ea89[_0x9f10('0x34')]));if(_0x5708c1[_0x9f10('0x33')]['filter']){_0x6b3eb6[_0x9f10('0x3d')]=_[_0x9f10('0x3f')](_0x6b3eb6[_0x9f10('0x3d')],{'$or':_[_0x9f10('0x40')](_0x6b3eb6['attributes'],function(_0x57ac53){var _0x7f13fa={};_0x7f13fa[_0x57ac53]={'$like':'%'+_0x5708c1[_0x9f10('0x33')][_0x9f10('0x3e')]+'%'};return _0x7f13fa;})});}_0x6b3eb6=_[_0x9f10('0x3f')]({},_0x6b3eb6,_0x5708c1[_0x9f10('0x44')]);return _0x3b2d92[_0x9f10('0x55')](_0x6b3eb6);}})[_0x9f10('0x2c')](function(_0x25a1d7){if(_0x25a1d7){_0x5a64ae=_0x25a1d7[_0x9f10('0x39')];if(!_0x5708c1[_0x9f10('0x33')][_0x9f10('0x3a')](_0x9f10('0x56'))){_0x6b3eb6[_0x9f10('0x28')]=qs[_0x9f10('0x28')](_0x5708c1[_0x9f10('0x33')]['limit']);_0x6b3eb6[_0x9f10('0x27')]=qs[_0x9f10('0x27')](_0x5708c1['query'][_0x9f10('0x27')]);}return _0x3b2d92[_0x9f10('0x55')](_0x6b3eb6);}})[_0x9f10('0x2c')](function(_0x24118b){if(_0x24118b){return _0x24118b?{'count':_0x5a64ae,'rows':_0x24118b}:null;}})['then'](respondWithResult(_0x3b1893,null))[_0x9f10('0x48')](handleError(_0x3b1893,null));};exports['getDescriptions']=function(_0x143c8b,_0x38667a,_0x35f461){var _0x59b527={};var _0x26edd6={};var _0x351766;var _0x4139c6;return db['ServicenowConfiguration'][_0x9f10('0x54')]({'where':{'id':_0x143c8b[_0x9f10('0x50')]['id']}})[_0x9f10('0x2c')](handleEntityNotFound(_0x38667a,null))['then'](function(_0x4f2430){if(_0x4f2430){_0x351766=_0x4f2430;_0x26edd6['model']=_['keys'](db['ServicenowField']['rawAttributes']);_0x26edd6['query']=_[_0x9f10('0x32')](_0x143c8b[_0x9f10('0x33')]);_0x26edd6['filters']=_[_0x9f10('0x35')](_0x26edd6[_0x9f10('0x36')],_0x26edd6[_0x9f10('0x33')]);_0x59b527[_0x9f10('0x37')]=_[_0x9f10('0x35')](_0x26edd6[_0x9f10('0x36')],qs[_0x9f10('0x38')](_0x143c8b[_0x9f10('0x33')][_0x9f10('0x38')]));_0x59b527[_0x9f10('0x37')]=_0x59b527['attributes'][_0x9f10('0x39')]?_0x59b527[_0x9f10('0x37')]:_0x26edd6['model'];_0x59b527[_0x9f10('0x3b')]=qs['sort'](_0x143c8b['query'][_0x9f10('0x3c')]);_0x59b527[_0x9f10('0x3d')]=qs['filters'](_[_0x9f10('0x52')](_0x143c8b[_0x9f10('0x33')],_0x26edd6['filters']));if(_0x143c8b[_0x9f10('0x33')][_0x9f10('0x3e')]){_0x59b527[_0x9f10('0x3d')]=_['merge'](_0x59b527[_0x9f10('0x3d')],{'$or':_[_0x9f10('0x40')](_0x59b527['attributes'],function(_0x48c017){var _0xfd6899={};_0xfd6899[_0x48c017]={'$like':'%'+_0x143c8b[_0x9f10('0x33')]['filter']+'%'};return _0xfd6899;})});}_0x59b527=_[_0x9f10('0x3f')]({},_0x59b527,_0x143c8b[_0x9f10('0x44')]);return _0x351766['getDescriptions'](_0x59b527);}})['then'](function(_0x36fe07){if(_0x36fe07){_0x4139c6=_0x36fe07[_0x9f10('0x39')];if(!_0x143c8b['query']['hasOwnProperty'](_0x9f10('0x56'))){_0x59b527[_0x9f10('0x28')]=qs['limit'](_0x143c8b[_0x9f10('0x33')][_0x9f10('0x28')]);_0x59b527[_0x9f10('0x27')]=qs[_0x9f10('0x27')](_0x143c8b[_0x9f10('0x33')]['offset']);}return _0x351766['getDescriptions'](_0x59b527);}})['then'](function(_0x5e1e9a){if(_0x5e1e9a){return _0x5e1e9a?{'count':_0x4139c6,'rows':_0x5e1e9a}:null;}})[_0x9f10('0x2c')](respondWithResult(_0x38667a,null))[_0x9f10('0x48')](handleError(_0x38667a,null));};
\ No newline at end of file
index 4b31ad1..3c5ce6e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x151b=['../../config/logger','api','moment','bluebird','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','lodash'];(function(_0x251142,_0x58857b){var _0x4a2b81=function(_0x432b7d){while(--_0x432b7d){_0x251142['push'](_0x251142['shift']());}};_0x4a2b81(++_0x58857b);}(_0x151b,0x1dc));var _0xb151=function(_0x10366f,_0xc62ff4){_0x10366f=_0x10366f-0x0;var _0x545ba9=_0x151b[_0x10366f];return _0x545ba9;};'use strict';var _=require(_0xb151('0x0'));var util=require('util');var logger=require(_0xb151('0x1'))(_0xb151('0x2'));var moment=require(_0xb151('0x3'));var BPromise=require(_0xb151('0x4'));var rp=require('request-promise');var attributes=require(_0xb151('0x5'));module['exports']=function(_0x387eaa,_0x1ddb09){return _0x387eaa[_0xb151('0x6')](_0xb151('0x7'),attributes,{'tableName':_0xb151('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x9937=['../../config/logger','moment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','util'];(function(_0xe525b8,_0x1a1d17){var _0x38d9d6=function(_0x3550a3){while(--_0x3550a3){_0xe525b8['push'](_0xe525b8['shift']());}};_0x38d9d6(++_0x1a1d17);}(_0x9937,0x164));var _0x7993=function(_0x430692,_0x4221eb){_0x430692=_0x430692-0x0;var _0x4b4f0a=_0x9937[_0x430692];return _0x4b4f0a;};'use strict';var _=require('lodash');var util=require(_0x7993('0x0'));var logger=require(_0x7993('0x1'))('api');var moment=require(_0x7993('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x7993('0x3'));module['exports']=function(_0x2e8a98,_0x1c3385){return _0x2e8a98[_0x7993('0x4')](_0x7993('0x5'),attributes,{'tableName':_0x7993('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 7f12b56..f073352 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7ddb=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x7ddb,0x158));var _0xb7dd=function(_0x332f5f,_0x162887){_0x332f5f=_0x332f5f-0x0;var _0x396cd9=_0x7ddb[_0x332f5f];return _0x396cd9;};'use strict';var _=require(_0xb7dd('0x0'));var util=require(_0xb7dd('0x1'));var moment=require(_0xb7dd('0x2'));var BPromise=require(_0xb7dd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb7dd('0x4'));var db=require(_0xb7dd('0x5'))['db'];var utils=require(_0xb7dd('0x6'));var logger=require(_0xb7dd('0x7'))(_0xb7dd('0x8'));var config=require(_0xb7dd('0x9'));var jayson=require(_0xb7dd('0xa'));var client=jayson[_0xb7dd('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9832e1,_0x8c7501,_0x430be5){return new BPromise(function(_0x521599,_0x39913a){return client['request'](_0x9832e1,_0x430be5)['then'](function(_0x2e7969){logger[_0xb7dd('0xc')](_0xb7dd('0xd'),_0x8c7501,_0xb7dd('0xe'));logger[_0xb7dd('0xf')](_0xb7dd('0x10'),_0x8c7501,_0xb7dd('0xe'),JSON[_0xb7dd('0x11')](_0x2e7969));if(_0x2e7969[_0xb7dd('0x12')]){if(_0x2e7969[_0xb7dd('0x12')][_0xb7dd('0x13')]===0x1f4){logger[_0xb7dd('0x12')](_0xb7dd('0xd'),_0x8c7501,_0x2e7969[_0xb7dd('0x12')][_0xb7dd('0x14')]);return _0x39913a(_0x2e7969[_0xb7dd('0x12')][_0xb7dd('0x14')]);}logger[_0xb7dd('0x12')](_0xb7dd('0xd'),_0x8c7501,_0x2e7969[_0xb7dd('0x12')][_0xb7dd('0x14')]);return _0x521599(_0x2e7969[_0xb7dd('0x12')][_0xb7dd('0x14')]);}else{logger[_0xb7dd('0xc')](_0xb7dd('0xd'),_0x8c7501,_0xb7dd('0xe'));_0x521599(_0x2e7969[_0xb7dd('0x15')]['message']);}})[_0xb7dd('0x16')](function(_0x174417){logger[_0xb7dd('0x12')](_0xb7dd('0xd'),_0x8c7501,_0x174417);_0x39913a(_0x174417);});});}
\ No newline at end of file
+var _0x06ea=['ServicenowConfiguration,\x20%s,\x20%s','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x355549,_0x60839d){var _0x4e3802=function(_0x5fbd84){while(--_0x5fbd84){_0x355549['push'](_0x355549['shift']());}};_0x4e3802(++_0x60839d);}(_0x06ea,0x8d));var _0xa06e=function(_0x141f06,_0x57a6a3){_0x141f06=_0x141f06-0x0;var _0x369ca2=_0x06ea[_0x141f06];return _0x369ca2;};'use strict';var _=require('lodash');var util=require(_0xa06e('0x0'));var moment=require(_0xa06e('0x1'));var BPromise=require(_0xa06e('0x2'));var rs=require(_0xa06e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa06e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa06e('0x5'))(_0xa06e('0x6'));var config=require(_0xa06e('0x7'));var jayson=require(_0xa06e('0x8'));var client=jayson[_0xa06e('0x9')][_0xa06e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1962f0,_0x4b517f,_0x6a4ff2){return new BPromise(function(_0x1bf080,_0xa5e1ea){return client['request'](_0x1962f0,_0x6a4ff2)[_0xa06e('0xb')](function(_0x29db01){logger[_0xa06e('0xc')](_0xa06e('0xd'),_0x4b517f,'request\x20sent');logger['debug'](_0xa06e('0xe'),_0x4b517f,_0xa06e('0xf'),JSON[_0xa06e('0x10')](_0x29db01));if(_0x29db01['error']){if(_0x29db01[_0xa06e('0x11')][_0xa06e('0x12')]===0x1f4){logger[_0xa06e('0x11')](_0xa06e('0xd'),_0x4b517f,_0x29db01[_0xa06e('0x11')][_0xa06e('0x13')]);return _0xa5e1ea(_0x29db01[_0xa06e('0x11')][_0xa06e('0x13')]);}logger[_0xa06e('0x11')](_0xa06e('0xd'),_0x4b517f,_0x29db01['error']['message']);return _0x1bf080(_0x29db01[_0xa06e('0x11')][_0xa06e('0x13')]);}else{logger[_0xa06e('0xc')](_0xa06e('0xd'),_0x4b517f,_0xa06e('0xf'));_0x1bf080(_0x29db01[_0xa06e('0x14')]['message']);}})[_0xa06e('0x15')](function(_0x2df3fe){logger[_0xa06e('0x11')](_0xa06e('0xd'),_0x4b517f,_0x2df3fe);_0xa5e1ea(_0x2df3fe);});});}
\ No newline at end of file
index 318480a..2d988fb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4e40=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','/:id','show','put','update','delete','exports'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x4e40,0x1f0));var _0x04e4=function(_0x2b0f8c,_0x2c51bc){_0x2b0f8c=_0x2b0f8c-0x0;var _0x407a38=_0x4e40[_0x2b0f8c];return _0x407a38;};'use strict';var multer=require(_0x04e4('0x0'));var util=require(_0x04e4('0x1'));var path=require(_0x04e4('0x2'));var timeout=require('connect-timeout');var express=require(_0x04e4('0x3'));var router=express[_0x04e4('0x4')]();var auth=require(_0x04e4('0x5'));var interaction=require(_0x04e4('0x6'));var config=require('../../config/environment');var controller=require(_0x04e4('0x7'));router[_0x04e4('0x8')]('/',auth[_0x04e4('0x9')](),controller['index']);router[_0x04e4('0x8')](_0x04e4('0xa'),auth['isAuthenticated'](),controller[_0x04e4('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x04e4('0xc')](_0x04e4('0xa'),auth[_0x04e4('0x9')](),controller[_0x04e4('0xd')]);router[_0x04e4('0xe')]('/:id',auth[_0x04e4('0x9')](),controller['destroy']);module[_0x04e4('0xf')]=router;
\ No newline at end of file
+var _0xd265=['show','post','put','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0xd265,0x144));var _0x5d26=function(_0x215ccc,_0x38e777){_0x215ccc=_0x215ccc-0x0;var _0x5a7fad=_0xd265[_0x215ccc];return _0x5a7fad;};'use strict';var multer=require(_0x5d26('0x0'));var util=require(_0x5d26('0x1'));var path=require('path');var timeout=require(_0x5d26('0x2'));var express=require('express');var router=express[_0x5d26('0x3')]();var auth=require(_0x5d26('0x4'));var interaction=require(_0x5d26('0x5'));var config=require(_0x5d26('0x6'));var controller=require(_0x5d26('0x7'));router[_0x5d26('0x8')]('/',auth[_0x5d26('0x9')](),controller[_0x5d26('0xa')]);router[_0x5d26('0x8')](_0x5d26('0xb'),auth[_0x5d26('0x9')](),controller[_0x5d26('0xc')]);router[_0x5d26('0xd')]('/',auth[_0x5d26('0x9')](),controller['create']);router[_0x5d26('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x5d26('0xb'),auth[_0x5d26('0x9')](),controller[_0x5d26('0xf')]);module['exports']=router;
\ No newline at end of file
index 08f6fc0..f5d18cb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb688=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','exports'];(function(_0x44f312,_0x4ed402){var _0x3ec697=function(_0x3ac5d5){while(--_0x3ac5d5){_0x44f312['push'](_0x44f312['shift']());}};_0x3ec697(++_0x4ed402);}(_0xb688,0xcf));var _0x8b68=function(_0x18f1ab,_0x481922){_0x18f1ab=_0x18f1ab-0x0;var _0x3122da=_0xb688[_0x18f1ab];return _0x3122da;};'use strict';var Sequelize=require('sequelize');module[_0x8b68('0x0')]={'type':{'type':Sequelize[_0x8b68('0x1')](_0x8b68('0x2'),_0x8b68('0x3'),_0x8b68('0x4'),_0x8b68('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x8b68('0x6')]},'key':{'type':Sequelize[_0x8b68('0x6')]},'keyType':{'type':Sequelize[_0x8b68('0x1')](_0x8b68('0x2'),'variable',_0x8b68('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8b68('0x6')]},'nameField':{'type':Sequelize[_0x8b68('0x6')]},'customField':{'type':Sequelize[_0x8b68('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8b68('0x6')]}};
\ No newline at end of file
+var _0xb7e7=['customVariable','BOOLEAN','sequelize','ENUM','variable','keyValue','STRING'];(function(_0x4e4e75,_0x2738b3){var _0x5014dc=function(_0x3c1c3c){while(--_0x3c1c3c){_0x4e4e75['push'](_0x4e4e75['shift']());}};_0x5014dc(++_0x2738b3);}(_0xb7e7,0x121));var _0x7b7e=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xb7e7[_0x39096d];return _0x13da4f;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'type':{'type':Sequelize[_0x7b7e('0x1')]('string',_0x7b7e('0x2'),'customVariable',_0x7b7e('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0x7b7e('0x4')]},'key':{'type':Sequelize[_0x7b7e('0x4')]},'keyType':{'type':Sequelize[_0x7b7e('0x1')]('string','variable',_0x7b7e('0x5'))},'keyContent':{'type':Sequelize[_0x7b7e('0x4')]},'idField':{'type':Sequelize[_0x7b7e('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7b7e('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7b7e('0x4')]}};
\ No newline at end of file
index 92c6f61..72fa3c1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3113=['json','count','offset','limit','set','Content-Range','apply','update','destroy','error','name','send','index','rawAttributes','keys','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','map','type','key','field','then','includeAll','include','ServicenowField','findAll','catch','length','options','create','body','find','params','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end'];(function(_0x2e655a,_0x6d5799){var _0x26f13b=function(_0x2dd535){while(--_0x2dd535){_0x2e655a['push'](_0x2e655a['shift']());}};_0x26f13b(++_0x6d5799);}(_0x3113,0xfb));var _0x3311=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3113[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0x3311('0x0'));var emlformat=require(_0x3311('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3311('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3311('0x3'));var moment=require(_0x3311('0x4'));var BPromise=require(_0x3311('0x5'));var Mustache=require(_0x3311('0x6'));var util=require(_0x3311('0x7'));var path=require(_0x3311('0x8'));var sox=require(_0x3311('0x9'));var csv=require(_0x3311('0xa'));var ejs=require(_0x3311('0xb'));var fs=require('fs');var _=require(_0x3311('0xc'));var squel=require(_0x3311('0xd'));var crypto=require('crypto');var jsforce=require(_0x3311('0xe'));var deskjs=require(_0x3311('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3311('0x10'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x3311('0x11'));var qs=require('../../components/parsers/qs');var logger=require(_0x3311('0x12'))(_0x3311('0x13'));var utils=require(_0x3311('0x14'));var config=require(_0x3311('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fdda5,_0x5aa2f2){_0x5aa2f2=_0x5aa2f2||0xcc;return function(_0x324c73){if(_0x324c73){return _0x1fdda5[_0x3311('0x16')](_0x5aa2f2);}return _0x1fdda5[_0x3311('0x17')](_0x5aa2f2)[_0x3311('0x18')]();};}function respondWithResult(_0x4f0571,_0x243235){_0x243235=_0x243235||0xc8;return function(_0x50228a){if(_0x50228a){return _0x4f0571[_0x3311('0x17')](_0x243235)[_0x3311('0x19')](_0x50228a);}};}function respondWithFilteredResult(_0x347584,_0x1367d0){return function(_0x32842b){if(_0x32842b){var _0x454a67=_0x32842b[_0x3311('0x1a')],_0x4771f0=_0x1367d0[_0x3311('0x1b')],_0x4a008e=_0x1367d0[_0x3311('0x1b')]+_0x1367d0[_0x3311('0x1c')],_0x31b5c1;if(_0x4a008e>=_0x454a67){_0x4a008e=_0x454a67;_0x31b5c1=0xc8;}else{_0x31b5c1=0xce;}_0x347584[_0x3311('0x17')](_0x31b5c1);return _0x347584[_0x3311('0x1d')](_0x3311('0x1e'),_0x4771f0+'-'+_0x4a008e+'/'+_0x454a67)[_0x3311('0x19')](_0x32842b);}return null;};}function patchUpdates(_0x2ac89f){return function(_0x5e8d2d){try{jsonpatch[_0x3311('0x1f')](_0x5e8d2d,_0x2ac89f,!![]);}catch(_0x12f97b){return BPromise['reject'](_0x12f97b);}return _0x5e8d2d['save']();};}function saveUpdates(_0xad905b,_0x30d10d){return function(_0x66182d){if(_0x66182d){return _0x66182d[_0x3311('0x20')](_0xad905b)['then'](function(_0x3d2cc7){return _0x3d2cc7;});}return null;};}function removeEntity(_0x15e9b6,_0x1efea6){return function(_0x30df90){if(_0x30df90){return _0x30df90[_0x3311('0x21')]()['then'](function(){_0x15e9b6['status'](0xcc)[_0x3311('0x18')]();});}};}function handleEntityNotFound(_0x555c07,_0x292f61){return function(_0x1f84da){if(!_0x1f84da){_0x555c07['sendStatus'](0x194);}return _0x1f84da;};}function handleError(_0x2b317f,_0x5b1daa){_0x5b1daa=_0x5b1daa||0x1f4;return function(_0x22b811){logger[_0x3311('0x22')](_0x22b811['stack']);if(_0x22b811[_0x3311('0x23')]){delete _0x22b811[_0x3311('0x23')];}_0x2b317f[_0x3311('0x17')](_0x5b1daa)[_0x3311('0x24')](_0x22b811);};}exports[_0x3311('0x25')]=function(_0xd5b3ca,_0x2de50f){var _0xbea1cf={},_0xc581e9={},_0x206aec={'count':0x0,'rows':[]};var _0xe05f69=db['ServicenowField'][_0x3311('0x26')];_0xc581e9['model']=_[_0x3311('0x27')](_0xe05f69);_0xc581e9[_0x3311('0x28')]=_[_0x3311('0x27')](_0xd5b3ca[_0x3311('0x28')]);_0xc581e9[_0x3311('0x29')]=_[_0x3311('0x2a')](_0xc581e9[_0x3311('0x2b')],_0xc581e9[_0x3311('0x28')]);_0xbea1cf[_0x3311('0x2c')]=_['intersection'](_0xc581e9[_0x3311('0x2b')],qs['fields'](_0xd5b3ca[_0x3311('0x28')][_0x3311('0x2d')]));_0xbea1cf[_0x3311('0x2c')]=_0xbea1cf[_0x3311('0x2c')]['length']?_0xbea1cf[_0x3311('0x2c')]:_0xc581e9[_0x3311('0x2b')];if(!_0xd5b3ca[_0x3311('0x28')]['hasOwnProperty'](_0x3311('0x2e'))){_0xbea1cf[_0x3311('0x1c')]=qs[_0x3311('0x1c')](_0xd5b3ca[_0x3311('0x28')][_0x3311('0x1c')]);_0xbea1cf[_0x3311('0x1b')]=qs[_0x3311('0x1b')](_0xd5b3ca[_0x3311('0x28')][_0x3311('0x1b')]);}_0xbea1cf[_0x3311('0x2f')]=qs['sort'](_0xd5b3ca['query'][_0x3311('0x30')]);_0xbea1cf[_0x3311('0x31')]=qs['filters'](_[_0x3311('0x32')](_0xd5b3ca[_0x3311('0x28')],_0xc581e9['filters']));if(_0xd5b3ca[_0x3311('0x28')][_0x3311('0x33')]){_0xbea1cf['where']=_[_0x3311('0x34')](_0xbea1cf[_0x3311('0x31')],{'$or':_[_0x3311('0x35')](_0xe05f69,function(_0x17dfa){if(_0x17dfa[_0x3311('0x36')][_0x3311('0x37')]!=='VIRTUAL'){var _0x435eb9={};_0x435eb9[_0x17dfa[_0x3311('0x38')]]={'$like':'%'+_0xd5b3ca[_0x3311('0x28')][_0x3311('0x33')]+'%'};return _0x435eb9;}})});}_0xbea1cf=_[_0x3311('0x34')]({},_0xbea1cf,_0xd5b3ca['options']);var _0xcd9284={'where':_0xbea1cf[_0x3311('0x31')]};return db['ServicenowField']['count'](_0xcd9284)[_0x3311('0x39')](function(_0x22559e){_0x206aec[_0x3311('0x1a')]=_0x22559e;if(_0xd5b3ca[_0x3311('0x28')][_0x3311('0x3a')]){_0xbea1cf[_0x3311('0x3b')]=[{'all':!![]}];}return db[_0x3311('0x3c')][_0x3311('0x3d')](_0xbea1cf);})[_0x3311('0x39')](function(_0x5280a8){_0x206aec['rows']=_0x5280a8;return _0x206aec;})['then'](respondWithFilteredResult(_0x2de50f,_0xbea1cf))[_0x3311('0x3e')](handleError(_0x2de50f,null));};exports['show']=function(_0x42ca49,_0xa42027){var _0x479c19={'raw':!![],'where':{'id':_0x42ca49['params']['id']}},_0x6c8cff={};_0x6c8cff[_0x3311('0x2b')]=_[_0x3311('0x27')](db['ServicenowField']['rawAttributes']);_0x6c8cff[_0x3311('0x28')]=_[_0x3311('0x27')](_0x42ca49[_0x3311('0x28')]);_0x6c8cff['filters']=_[_0x3311('0x2a')](_0x6c8cff[_0x3311('0x2b')],_0x6c8cff[_0x3311('0x28')]);_0x479c19['attributes']=_[_0x3311('0x2a')](_0x6c8cff['model'],qs[_0x3311('0x2d')](_0x42ca49[_0x3311('0x28')][_0x3311('0x2d')]));_0x479c19[_0x3311('0x2c')]=_0x479c19[_0x3311('0x2c')][_0x3311('0x3f')]?_0x479c19[_0x3311('0x2c')]:_0x6c8cff[_0x3311('0x2b')];if(_0x42ca49['query']['includeAll']){_0x479c19[_0x3311('0x3b')]=[{'all':!![]}];}_0x479c19=_[_0x3311('0x34')]({},_0x479c19,_0x42ca49[_0x3311('0x40')]);return db[_0x3311('0x3c')]['find'](_0x479c19)[_0x3311('0x39')](handleEntityNotFound(_0xa42027,null))['then'](respondWithResult(_0xa42027,null))[_0x3311('0x3e')](handleError(_0xa42027,null));};exports[_0x3311('0x41')]=function(_0xbee916,_0x28a673){return db[_0x3311('0x3c')]['create'](_0xbee916['body'],{})[_0x3311('0x39')](respondWithResult(_0x28a673,0xc9))[_0x3311('0x3e')](handleError(_0x28a673,null));};exports[_0x3311('0x20')]=function(_0x4ad274,_0x270e6c){if(_0x4ad274[_0x3311('0x42')]['id']){delete _0x4ad274[_0x3311('0x42')]['id'];}return db[_0x3311('0x3c')][_0x3311('0x43')]({'where':{'id':_0x4ad274[_0x3311('0x44')]['id']}})[_0x3311('0x39')](handleEntityNotFound(_0x270e6c,null))[_0x3311('0x39')](saveUpdates(_0x4ad274['body'],null))[_0x3311('0x39')](respondWithResult(_0x270e6c,null))[_0x3311('0x3e')](handleError(_0x270e6c,null));};exports[_0x3311('0x21')]=function(_0x4759e5,_0x582d93){return db[_0x3311('0x3c')]['find']({'where':{'id':_0x4759e5[_0x3311('0x44')]['id']}})[_0x3311('0x39')](handleEntityNotFound(_0x582d93,null))[_0x3311('0x39')](removeEntity(_0x582d93,null))['catch'](handleError(_0x582d93,null));};
\ No newline at end of file
+var _0x8906=['save','then','error','stack','name','ServicenowField','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','map','type','key','field','options','includeAll','include','findAll','rows','rawAttributes','find','catch','create','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject'];(function(_0x3712c1,_0x192b92){var _0x4070ff=function(_0x5bf6c8){while(--_0x5bf6c8){_0x3712c1['push'](_0x3712c1['shift']());}};_0x4070ff(++_0x192b92);}(_0x8906,0x1bc));var _0x6890=function(_0x35af11,_0x279847){_0x35af11=_0x35af11-0x0;var _0x48c978=_0x8906[_0x35af11];return _0x48c978;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6890('0x0'));var rimraf=require(_0x6890('0x1'));var zipdir=require(_0x6890('0x2'));var jsonpatch=require(_0x6890('0x3'));var rp=require('request-promise');var moment=require(_0x6890('0x4'));var BPromise=require(_0x6890('0x5'));var Mustache=require(_0x6890('0x6'));var util=require(_0x6890('0x7'));var path=require('path');var sox=require(_0x6890('0x8'));var csv=require(_0x6890('0x9'));var ejs=require(_0x6890('0xa'));var fs=require('fs');var _=require(_0x6890('0xb'));var squel=require(_0x6890('0xc'));var crypto=require(_0x6890('0xd'));var jsforce=require(_0x6890('0xe'));var deskjs=require(_0x6890('0xf'));var toCsv=require(_0x6890('0x9'));var querystring=require('querystring');var Papa=require(_0x6890('0x10'));var authService=require(_0x6890('0x11'));var hardwareService=require(_0x6890('0x12'));var Redis=require(_0x6890('0x13'));var qs=require('../../components/parsers/qs');var logger=require(_0x6890('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x6890('0x15'))['db'];function respondWithStatusCode(_0x5e7495,_0x5d5e6d){_0x5d5e6d=_0x5d5e6d||0xcc;return function(_0x4d930d){if(_0x4d930d){return _0x5e7495[_0x6890('0x16')](_0x5d5e6d);}return _0x5e7495['status'](_0x5d5e6d)[_0x6890('0x17')]();};}function respondWithResult(_0x23cfdf,_0x590075){_0x590075=_0x590075||0xc8;return function(_0x410790){if(_0x410790){return _0x23cfdf[_0x6890('0x18')](_0x590075)[_0x6890('0x19')](_0x410790);}};}function respondWithFilteredResult(_0x3dc558,_0x1d5d71){return function(_0x157553){if(_0x157553){var _0x281636=_0x157553[_0x6890('0x1a')],_0x3b904f=_0x1d5d71[_0x6890('0x1b')],_0x411ee0=_0x1d5d71[_0x6890('0x1b')]+_0x1d5d71[_0x6890('0x1c')],_0x2cb4b5;if(_0x411ee0>=_0x281636){_0x411ee0=_0x281636;_0x2cb4b5=0xc8;}else{_0x2cb4b5=0xce;}_0x3dc558[_0x6890('0x18')](_0x2cb4b5);return _0x3dc558[_0x6890('0x1d')]('Content-Range',_0x3b904f+'-'+_0x411ee0+'/'+_0x281636)[_0x6890('0x19')](_0x157553);}return null;};}function patchUpdates(_0x204c81){return function(_0x5ad28a){try{jsonpatch[_0x6890('0x1e')](_0x5ad28a,_0x204c81,!![]);}catch(_0x6f230a){return BPromise[_0x6890('0x1f')](_0x6f230a);}return _0x5ad28a[_0x6890('0x20')]();};}function saveUpdates(_0x3b40d4,_0x4e9771){return function(_0x85fb8e){if(_0x85fb8e){return _0x85fb8e['update'](_0x3b40d4)[_0x6890('0x21')](function(_0x4aa5b6){return _0x4aa5b6;});}return null;};}function removeEntity(_0x5220bc,_0x206545){return function(_0x3d0e9e){if(_0x3d0e9e){return _0x3d0e9e['destroy']()[_0x6890('0x21')](function(){_0x5220bc[_0x6890('0x18')](0xcc)[_0x6890('0x17')]();});}};}function handleEntityNotFound(_0x4c7010,_0x1e339d){return function(_0x5665c2){if(!_0x5665c2){_0x4c7010[_0x6890('0x16')](0x194);}return _0x5665c2;};}function handleError(_0x17f080,_0x1afabf){_0x1afabf=_0x1afabf||0x1f4;return function(_0x3b97c1){logger[_0x6890('0x22')](_0x3b97c1[_0x6890('0x23')]);if(_0x3b97c1[_0x6890('0x24')]){delete _0x3b97c1[_0x6890('0x24')];}_0x17f080['status'](_0x1afabf)['send'](_0x3b97c1);};}exports['index']=function(_0x254bbe,_0x168253){var _0x39dec5={},_0x5ac619={},_0x53b411={'count':0x0,'rows':[]};var _0x290a90=db[_0x6890('0x25')]['rawAttributes'];_0x5ac619[_0x6890('0x26')]=_[_0x6890('0x27')](_0x290a90);_0x5ac619[_0x6890('0x28')]=_['keys'](_0x254bbe[_0x6890('0x28')]);_0x5ac619[_0x6890('0x29')]=_[_0x6890('0x2a')](_0x5ac619['model'],_0x5ac619[_0x6890('0x28')]);_0x39dec5[_0x6890('0x2b')]=_[_0x6890('0x2a')](_0x5ac619['model'],qs[_0x6890('0x2c')](_0x254bbe[_0x6890('0x28')][_0x6890('0x2c')]));_0x39dec5[_0x6890('0x2b')]=_0x39dec5[_0x6890('0x2b')][_0x6890('0x2d')]?_0x39dec5['attributes']:_0x5ac619[_0x6890('0x26')];if(!_0x254bbe[_0x6890('0x28')][_0x6890('0x2e')]('nolimit')){_0x39dec5[_0x6890('0x1c')]=qs['limit'](_0x254bbe[_0x6890('0x28')]['limit']);_0x39dec5[_0x6890('0x1b')]=qs[_0x6890('0x1b')](_0x254bbe[_0x6890('0x28')][_0x6890('0x1b')]);}_0x39dec5[_0x6890('0x2f')]=qs[_0x6890('0x30')](_0x254bbe[_0x6890('0x28')][_0x6890('0x30')]);_0x39dec5[_0x6890('0x31')]=qs[_0x6890('0x29')](_['pick'](_0x254bbe[_0x6890('0x28')],_0x5ac619['filters']));if(_0x254bbe[_0x6890('0x28')][_0x6890('0x32')]){_0x39dec5[_0x6890('0x31')]=_[_0x6890('0x33')](_0x39dec5[_0x6890('0x31')],{'$or':_[_0x6890('0x34')](_0x290a90,function(_0x452e6c){if(_0x452e6c[_0x6890('0x35')][_0x6890('0x36')]!=='VIRTUAL'){var _0x32c470={};_0x32c470[_0x452e6c[_0x6890('0x37')]]={'$like':'%'+_0x254bbe['query'][_0x6890('0x32')]+'%'};return _0x32c470;}})});}_0x39dec5=_[_0x6890('0x33')]({},_0x39dec5,_0x254bbe[_0x6890('0x38')]);var _0x20340c={'where':_0x39dec5[_0x6890('0x31')]};return db['ServicenowField']['count'](_0x20340c)[_0x6890('0x21')](function(_0x2b8061){_0x53b411[_0x6890('0x1a')]=_0x2b8061;if(_0x254bbe[_0x6890('0x28')][_0x6890('0x39')]){_0x39dec5[_0x6890('0x3a')]=[{'all':!![]}];}return db[_0x6890('0x25')][_0x6890('0x3b')](_0x39dec5);})[_0x6890('0x21')](function(_0x11eaef){_0x53b411[_0x6890('0x3c')]=_0x11eaef;return _0x53b411;})[_0x6890('0x21')](respondWithFilteredResult(_0x168253,_0x39dec5))['catch'](handleError(_0x168253,null));};exports['show']=function(_0x236af8,_0x36b49f){var _0x5500cd={'raw':!![],'where':{'id':_0x236af8['params']['id']}},_0x2ac796={};_0x2ac796[_0x6890('0x26')]=_['keys'](db[_0x6890('0x25')][_0x6890('0x3d')]);_0x2ac796['query']=_[_0x6890('0x27')](_0x236af8[_0x6890('0x28')]);_0x2ac796[_0x6890('0x29')]=_[_0x6890('0x2a')](_0x2ac796['model'],_0x2ac796['query']);_0x5500cd[_0x6890('0x2b')]=_['intersection'](_0x2ac796['model'],qs['fields'](_0x236af8[_0x6890('0x28')][_0x6890('0x2c')]));_0x5500cd[_0x6890('0x2b')]=_0x5500cd['attributes'][_0x6890('0x2d')]?_0x5500cd[_0x6890('0x2b')]:_0x2ac796[_0x6890('0x26')];if(_0x236af8[_0x6890('0x28')]['includeAll']){_0x5500cd['include']=[{'all':!![]}];}_0x5500cd=_[_0x6890('0x33')]({},_0x5500cd,_0x236af8[_0x6890('0x38')]);return db['ServicenowField'][_0x6890('0x3e')](_0x5500cd)['then'](handleEntityNotFound(_0x36b49f,null))[_0x6890('0x21')](respondWithResult(_0x36b49f,null))[_0x6890('0x3f')](handleError(_0x36b49f,null));};exports[_0x6890('0x40')]=function(_0x2ec885,_0x4a8b5a){return db['ServicenowField'][_0x6890('0x40')](_0x2ec885['body'],{})[_0x6890('0x21')](respondWithResult(_0x4a8b5a,0xc9))[_0x6890('0x3f')](handleError(_0x4a8b5a,null));};exports[_0x6890('0x41')]=function(_0x14a628,_0x1adc3f){if(_0x14a628['body']['id']){delete _0x14a628[_0x6890('0x42')]['id'];}return db[_0x6890('0x25')][_0x6890('0x3e')]({'where':{'id':_0x14a628[_0x6890('0x43')]['id']}})[_0x6890('0x21')](handleEntityNotFound(_0x1adc3f,null))[_0x6890('0x21')](saveUpdates(_0x14a628['body'],null))[_0x6890('0x21')](respondWithResult(_0x1adc3f,null))[_0x6890('0x3f')](handleError(_0x1adc3f,null));};exports['destroy']=function(_0x43652f,_0x3853a8){return db[_0x6890('0x25')]['find']({'where':{'id':_0x43652f[_0x6890('0x43')]['id']}})[_0x6890('0x21')](handleEntityNotFound(_0x3853a8,null))[_0x6890('0x21')](removeEntity(_0x3853a8,null))[_0x6890('0x3f')](handleError(_0x3853a8,null));};
\ No newline at end of file
index a3518a7..c9a90ae 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7e5a=['ServicenowField','servicenow_unique_index','idField','FieldId','../../config/logger','api','request-promise','./intServicenowField.attributes','exports','define'];(function(_0x36d25e,_0x1a047d){var _0x4b95b8=function(_0x74da3){while(--_0x74da3){_0x36d25e['push'](_0x36d25e['shift']());}};_0x4b95b8(++_0x1a047d);}(_0x7e5a,0x1d0));var _0xa7e5=function(_0x18b9b5,_0x59ae05){_0x18b9b5=_0x18b9b5-0x0;var _0x2670ac=_0x7e5a[_0x18b9b5];return _0x2670ac;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa7e5('0x0'))(_0xa7e5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa7e5('0x2'));var attributes=require(_0xa7e5('0x3'));module[_0xa7e5('0x4')]=function(_0x1c1f69,_0x1f9ca8){return _0x1c1f69[_0xa7e5('0x5')](_0xa7e5('0x6'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xa7e5('0x7'),'fields':[_0xa7e5('0x8'),_0xa7e5('0x9')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x2d4c=['servicenow_unique_index','lodash','util','bluebird','./intServicenowField.attributes','define','ServicenowField','int_servicenow_fields'];(function(_0x4d9b6a,_0x3f02ab){var _0x446244=function(_0x252267){while(--_0x252267){_0x4d9b6a['push'](_0x4d9b6a['shift']());}};_0x446244(++_0x3f02ab);}(_0x2d4c,0x1d1));var _0xc2d4=function(_0x336355,_0x54f200){_0x336355=_0x336355-0x0;var _0x1e14bb=_0x2d4c[_0x336355];return _0x1e14bb;};'use strict';var _=require(_0xc2d4('0x0'));var util=require(_0xc2d4('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc2d4('0x2'));var rp=require('request-promise');var attributes=require(_0xc2d4('0x3'));module['exports']=function(_0x57a589,_0x2260c2){return _0x57a589[_0xc2d4('0x4')](_0xc2d4('0x5'),attributes,{'tableName':_0xc2d4('0x6'),'paranoid':![],'indexes':[{'name':_0xc2d4('0x7'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index b002dac..7ae7dd3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa30a=['stringify','error','code','message','request\x20sent','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','ServicenowField,\x20%s,\x20%s','ServicenowField,\x20%s,\x20%s,\x20%s'];(function(_0x23fae4,_0x3fdf93){var _0x165c2f=function(_0x48e8b8){while(--_0x48e8b8){_0x23fae4['push'](_0x23fae4['shift']());}};_0x165c2f(++_0x3fdf93);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaa30('0x0'));var util=require(_0xaa30('0x1'));var moment=require(_0xaa30('0x2'));var BPromise=require('bluebird');var rs=require(_0xaa30('0x3'));var fs=require('fs');var Redis=require(_0xaa30('0x4'));var db=require(_0xaa30('0x5'))['db'];var utils=require(_0xaa30('0x6'));var logger=require(_0xaa30('0x7'))(_0xaa30('0x8'));var config=require(_0xaa30('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa30('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8af448,_0x14fe09,_0x42dc22){return new BPromise(function(_0x5d076a,_0xedbc45){return client[_0xaa30('0xb')](_0x8af448,_0x42dc22)[_0xaa30('0xc')](function(_0x59d028){logger[_0xaa30('0xd')](_0xaa30('0xe'),_0x14fe09,'request\x20sent');logger['debug'](_0xaa30('0xf'),_0x14fe09,'request\x20sent',JSON[_0xaa30('0x10')](_0x59d028));if(_0x59d028[_0xaa30('0x11')]){if(_0x59d028[_0xaa30('0x11')][_0xaa30('0x12')]===0x1f4){logger['error'](_0xaa30('0xe'),_0x14fe09,_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);return _0xedbc45(_0x59d028['error'][_0xaa30('0x13')]);}logger[_0xaa30('0x11')](_0xaa30('0xe'),_0x14fe09,_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);return _0x5d076a(_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);}else{logger[_0xaa30('0xd')](_0xaa30('0xe'),_0x14fe09,_0xaa30('0x14'));_0x5d076a(_0x59d028['result'][_0xaa30('0x13')]);}})['catch'](function(_0x5eb356){logger[_0xaa30('0x11')](_0xaa30('0xe'),_0x14fe09,_0x5eb356);_0xedbc45(_0x5eb356);});});}
\ No newline at end of file
+var _0x0598=['../../config/utils','jayson/promise','client','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','bluebird','../../mysqldb'];(function(_0xd139a9,_0x54e4b6){var _0x3eca3c=function(_0x561906){while(--_0x561906){_0xd139a9['push'](_0xd139a9['shift']());}};_0x3eca3c(++_0x54e4b6);}(_0x0598,0x92));var _0x8059=function(_0x191c6f,_0x525279){_0x191c6f=_0x191c6f-0x0;var _0x4d359c=_0x0598[_0x191c6f];return _0x4d359c;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var moment=require('moment');var BPromise=require(_0x8059('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8059('0x3'))['db'];var utils=require(_0x8059('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8059('0x5'));var client=jayson[_0x8059('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5996d7,_0x248273,_0x347f1b){return new BPromise(function(_0x4610d2,_0x116946){return client['request'](_0x5996d7,_0x347f1b)['then'](function(_0x89dda1){logger[_0x8059('0x7')](_0x8059('0x8'),_0x248273,_0x8059('0x9'));logger[_0x8059('0xa')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x248273,'request\x20sent',JSON[_0x8059('0xb')](_0x89dda1));if(_0x89dda1[_0x8059('0xc')]){if(_0x89dda1['error']['code']===0x1f4){logger['error'](_0x8059('0x8'),_0x248273,_0x89dda1[_0x8059('0xc')][_0x8059('0xd')]);return _0x116946(_0x89dda1[_0x8059('0xc')][_0x8059('0xd')]);}logger['error'](_0x8059('0x8'),_0x248273,_0x89dda1['error'][_0x8059('0xd')]);return _0x4610d2(_0x89dda1['error'][_0x8059('0xd')]);}else{logger[_0x8059('0x7')](_0x8059('0x8'),_0x248273,'request\x20sent');_0x4610d2(_0x89dda1['result']['message']);}})[_0x8059('0xe')](function(_0x239195){logger[_0x8059('0xc')](_0x8059('0x8'),_0x248273,_0x239195);_0x116946(_0x239195);});});}
\ No newline at end of file
index 5f2b64a..e14a950 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe073=['../../config/environment','./intSugarcrmAccount.controller','isAuthenticated','get','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','/:id','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0xe073,0x134));var _0x3e07=function(_0xb5646e,_0x327fd7){_0xb5646e=_0xb5646e-0x0;var _0x55fe64=_0xe073[_0xb5646e];return _0x55fe64;};'use strict';var multer=require(_0x3e07('0x0'));var util=require(_0x3e07('0x1'));var path=require(_0x3e07('0x2'));var timeout=require(_0x3e07('0x3'));var express=require('express');var router=express[_0x3e07('0x4')]();var auth=require(_0x3e07('0x5'));var interaction=require(_0x3e07('0x6'));var config=require(_0x3e07('0x7'));var controller=require(_0x3e07('0x8'));router['get']('/',auth[_0x3e07('0x9')](),controller['index']);router[_0x3e07('0xa')]('/:id',auth[_0x3e07('0x9')](),controller[_0x3e07('0xb')]);router[_0x3e07('0xa')]('/:id/configurations',auth[_0x3e07('0x9')](),controller[_0x3e07('0xc')]);router['get'](_0x3e07('0xd'),auth[_0x3e07('0x9')](),controller[_0x3e07('0xe')]);router[_0x3e07('0xf')]('/',auth[_0x3e07('0x9')](),controller[_0x3e07('0x10')]);router['post'](_0x3e07('0x11'),auth[_0x3e07('0x9')](),controller['addConfiguration']);router[_0x3e07('0x12')](_0x3e07('0x13'),auth[_0x3e07('0x9')](),controller['update']);router['delete'](_0x3e07('0x13'),auth[_0x3e07('0x9')](),controller['destroy']);module[_0x3e07('0x14')]=router;
\ No newline at end of file
+var _0x113b=['update','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put'];(function(_0x4769bd,_0xd3a1b9){var _0x3f282a=function(_0x183670){while(--_0x183670){_0x4769bd['push'](_0x4769bd['shift']());}};_0x3f282a(++_0xd3a1b9);}(_0x113b,0x67));var _0xb113=function(_0x4d7a96,_0x5a651e){_0x4d7a96=_0x4d7a96-0x0;var _0x5e50b3=_0x113b[_0x4d7a96];return _0x5e50b3;};'use strict';var multer=require(_0xb113('0x0'));var util=require(_0xb113('0x1'));var path=require(_0xb113('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb113('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb113('0x4'));var config=require(_0xb113('0x5'));var controller=require(_0xb113('0x6'));router[_0xb113('0x7')]('/',auth[_0xb113('0x8')](),controller['index']);router[_0xb113('0x7')](_0xb113('0x9'),auth[_0xb113('0x8')](),controller[_0xb113('0xa')]);router['get'](_0xb113('0xb'),auth[_0xb113('0x8')](),controller[_0xb113('0xc')]);router[_0xb113('0x7')](_0xb113('0xd'),auth[_0xb113('0x8')](),controller['getFields']);router[_0xb113('0xe')]('/',auth[_0xb113('0x8')](),controller['create']);router['post'](_0xb113('0xb'),auth[_0xb113('0x8')](),controller[_0xb113('0xf')]);router[_0xb113('0x10')](_0xb113('0x9'),auth[_0xb113('0x8')](),controller[_0xb113('0x11')]);router['delete'](_0xb113('0x9'),auth['isAuthenticated'](),controller[_0xb113('0x12')]);module[_0xb113('0x13')]=router;
\ No newline at end of file
index e346682..5962130 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x280f=['STRING','username','remoteUri','sequelize','exports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x280f,0x102));var _0xf280=function(_0x479509,_0x1daf8a){_0x479509=_0x479509-0x0;var _0x382da8=_0x280f[_0x479509];return _0x382da8;};'use strict';var Sequelize=require(_0xf280('0x0'));module[_0xf280('0x1')]={'name':{'type':Sequelize[_0xf280('0x2')]},'description':{'type':Sequelize[_0xf280('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xf280('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xf280('0x4')},'serverUrl':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x0df3=['username','remoteUri','sequelize','STRING'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0df3,0x1aa));var _0x30df=function(_0x872b02,_0x4f4458){_0x872b02=_0x872b02-0x0;var _0x1a6b24=_0x0df3[_0x872b02];return _0x1a6b24;};'use strict';var Sequelize=require(_0x30df('0x0'));module['exports']={'name':{'type':Sequelize[_0x30df('0x1')]},'description':{'type':Sequelize[_0x30df('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x30df('0x2')},'password':{'type':Sequelize[_0x30df('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x30df('0x3')},'serverUrl':{'type':Sequelize['STRING']}};
\ No newline at end of file
index c787b7a..e6e241b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0f54=['info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','apply','save','destroy','then','sendStatus','stack','name','send','index','SugarcrmAccount','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','key','VIRTUAL','filter','merge','findAll','rows','show','params','keys','rawAttributes','include','create','body','update','find','getConfigurations','findOne','SugarcrmConfiguration','map','options','AccountId','Subjects','Descriptions','getDescriptions','channel','type','getFields','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','password','remoteUri','format','%s%s','JSON','username','PLAIN','Invalid\x20Login','POST','/service/v4_1/rest.php','Calls','values','module_fields','remove','includes','label','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','request'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x0f54,0x1db));var _0x40f5=function(_0x5d516b,_0x347b84){_0x5d516b=_0x5d516b-0x0;var _0x3cede5=_0x0f54[_0x5d516b];return _0x3cede5;};'use strict';var pdf=require(_0x40f5('0x0'));var emlformat=require(_0x40f5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x40f5('0x2'));var jsonpatch=require(_0x40f5('0x3'));var rp=require(_0x40f5('0x4'));var moment=require(_0x40f5('0x5'));var BPromise=require(_0x40f5('0x6'));var Mustache=require(_0x40f5('0x7'));var util=require(_0x40f5('0x8'));var path=require(_0x40f5('0x9'));var sox=require(_0x40f5('0xa'));var csv=require(_0x40f5('0xb'));var ejs=require(_0x40f5('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x40f5('0xd'));var crypto=require(_0x40f5('0xe'));var jsforce=require(_0x40f5('0xf'));var deskjs=require(_0x40f5('0x10'));var toCsv=require(_0x40f5('0xb'));var querystring=require(_0x40f5('0x11'));var Papa=require(_0x40f5('0x12'));var authService=require(_0x40f5('0x13'));var hardwareService=require(_0x40f5('0x14'));var Redis=require('ioredis');var qs=require(_0x40f5('0x15'));var logger=require(_0x40f5('0x16'))(_0x40f5('0x17'));var utils=require(_0x40f5('0x18'));var config=require('../../config/environment');var db=require(_0x40f5('0x19'))['db'];var integrations=require(_0x40f5('0x1a'));var jayson=require(_0x40f5('0x1b'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x320763,_0x3e690b,_0x526bd1,_0x52489a){return new BPromise(function(_0x5c12ed,_0x10ae08){var _0x3c4913=_0x52489a||client;return _0x3c4913[_0x40f5('0x1c')](_0x320763,_0x526bd1)['then'](function(_0x462cb1){logger[_0x40f5('0x1d')](_0x40f5('0x1e'),_0x3e690b,_0x40f5('0x1f'));logger[_0x40f5('0x20')](_0x40f5('0x21'),_0x3e690b,_0x40f5('0x1f'),JSON[_0x40f5('0x22')](_0x462cb1));if(_0x462cb1[_0x40f5('0x23')]){if(_0x462cb1['error'][_0x40f5('0x24')]===0x1f4){logger[_0x40f5('0x23')](_0x40f5('0x1e'),_0x3e690b,_0x462cb1['error'][_0x40f5('0x25')]);return _0x10ae08(_0x462cb1['error']['message']);}logger[_0x40f5('0x23')](_0x40f5('0x1e'),_0x3e690b,_0x462cb1[_0x40f5('0x23')][_0x40f5('0x25')]);return _0x5c12ed(_0x462cb1['error']['message']);}else{logger[_0x40f5('0x1d')]('SugarcrmAccount,\x20%s,\x20%s',_0x3e690b,'request\x20sent');_0x5c12ed(_0x462cb1[_0x40f5('0x26')][_0x40f5('0x25')]);}})[_0x40f5('0x27')](function(_0x30e8a2){logger[_0x40f5('0x23')](_0x40f5('0x1e'),_0x3e690b,_0x30e8a2);_0x10ae08(_0x30e8a2);});});}function respondWithStatusCode(_0x3a4cc7,_0x337aa4){_0x337aa4=_0x337aa4||0xcc;return function(_0x113fc8){if(_0x113fc8){return _0x3a4cc7['sendStatus'](_0x337aa4);}return _0x3a4cc7[_0x40f5('0x28')](_0x337aa4)[_0x40f5('0x29')]();};}function respondWithResult(_0x199241,_0x309262){_0x309262=_0x309262||0xc8;return function(_0x3db099){if(_0x3db099){return _0x199241['status'](_0x309262)[_0x40f5('0x2a')](_0x3db099);}};}function respondWithFilteredResult(_0x212e98,_0x5eb00d){return function(_0x1161e2){if(_0x1161e2){var _0x50d07d=_0x1161e2[_0x40f5('0x2b')],_0x50d38e=_0x5eb00d[_0x40f5('0x2c')],_0xa36029=_0x5eb00d['offset']+_0x5eb00d['limit'],_0x1a1a22;if(_0xa36029>=_0x50d07d){_0xa36029=_0x50d07d;_0x1a1a22=0xc8;}else{_0x1a1a22=0xce;}_0x212e98[_0x40f5('0x28')](_0x1a1a22);return _0x212e98['set']('Content-Range',_0x50d38e+'-'+_0xa36029+'/'+_0x50d07d)[_0x40f5('0x2a')](_0x1161e2);}return null;};}function patchUpdates(_0x199204){return function(_0x4cf548){try{jsonpatch[_0x40f5('0x2d')](_0x4cf548,_0x199204,!![]);}catch(_0x4a4d9e){return BPromise['reject'](_0x4a4d9e);}return _0x4cf548[_0x40f5('0x2e')]();};}function saveUpdates(_0x1e3c21,_0x201552){return function(_0x57f30f){if(_0x57f30f){return _0x57f30f['update'](_0x1e3c21)['then'](function(_0x277b0f){return _0x277b0f;});}return null;};}function removeEntity(_0x29873f,_0x4d1b66){return function(_0x4d2725){if(_0x4d2725){return _0x4d2725[_0x40f5('0x2f')]()[_0x40f5('0x30')](function(){_0x29873f[_0x40f5('0x28')](0xcc)[_0x40f5('0x29')]();});}};}function handleEntityNotFound(_0x1e41ab,_0x956b6){return function(_0x5d2bf6){if(!_0x5d2bf6){_0x1e41ab[_0x40f5('0x31')](0x194);}return _0x5d2bf6;};}function handleError(_0x2508f6,_0x436c40){_0x436c40=_0x436c40||0x1f4;return function(_0x1b97de){logger['error'](_0x1b97de[_0x40f5('0x32')]);if(_0x1b97de[_0x40f5('0x33')]){delete _0x1b97de[_0x40f5('0x33')];}_0x2508f6[_0x40f5('0x28')](_0x436c40)[_0x40f5('0x34')](_0x1b97de);};}exports[_0x40f5('0x35')]=function(_0x2075c5,_0x5b3458){var _0x2a0d90={},_0xb8947e={},_0x4af8fc={'count':0x0,'rows':[]};var _0x171d8f=db[_0x40f5('0x36')]['rawAttributes'];_0xb8947e[_0x40f5('0x37')]=_['keys'](_0x171d8f);_0xb8947e['query']=_['keys'](_0x2075c5[_0x40f5('0x38')]);_0xb8947e[_0x40f5('0x39')]=_[_0x40f5('0x3a')](_0xb8947e['model'],_0xb8947e['query']);_0x2a0d90[_0x40f5('0x3b')]=_['intersection'](_0xb8947e[_0x40f5('0x37')],qs[_0x40f5('0x3c')](_0x2075c5['query'][_0x40f5('0x3c')]));_0x2a0d90[_0x40f5('0x3b')]=_0x2a0d90[_0x40f5('0x3b')][_0x40f5('0x3d')]?_0x2a0d90[_0x40f5('0x3b')]:_0xb8947e['model'];if(!_0x2075c5[_0x40f5('0x38')][_0x40f5('0x3e')](_0x40f5('0x3f'))){_0x2a0d90[_0x40f5('0x40')]=qs[_0x40f5('0x40')](_0x2075c5['query'][_0x40f5('0x40')]);_0x2a0d90[_0x40f5('0x2c')]=qs[_0x40f5('0x2c')](_0x2075c5[_0x40f5('0x38')][_0x40f5('0x2c')]);}_0x2a0d90[_0x40f5('0x41')]=qs[_0x40f5('0x42')](_0x2075c5[_0x40f5('0x38')][_0x40f5('0x42')]);_0x2a0d90[_0x40f5('0x43')]=qs[_0x40f5('0x39')](_[_0x40f5('0x44')](_0x2075c5[_0x40f5('0x38')],_0xb8947e[_0x40f5('0x39')]));if(_0x2075c5[_0x40f5('0x38')]['filter']){_0x2a0d90[_0x40f5('0x43')]=_['merge'](_0x2a0d90['where'],{'$or':_['map'](_0x171d8f,function(_0x2ee41b){if(_0x2ee41b['type'][_0x40f5('0x45')]!==_0x40f5('0x46')){var _0x3a8e96={};_0x3a8e96[_0x2ee41b['field']]={'$like':'%'+_0x2075c5[_0x40f5('0x38')][_0x40f5('0x47')]+'%'};return _0x3a8e96;}})});}_0x2a0d90=_[_0x40f5('0x48')]({},_0x2a0d90,_0x2075c5['options']);var _0x6aee2d={'where':_0x2a0d90['where']};return db[_0x40f5('0x36')][_0x40f5('0x2b')](_0x6aee2d)['then'](function(_0x560942){_0x4af8fc[_0x40f5('0x2b')]=_0x560942;if(_0x2075c5[_0x40f5('0x38')]['includeAll']){_0x2a0d90['include']=[{'all':!![]}];}return db[_0x40f5('0x36')][_0x40f5('0x49')](_0x2a0d90);})[_0x40f5('0x30')](function(_0x16fec9){_0x4af8fc[_0x40f5('0x4a')]=_0x16fec9;return _0x4af8fc;})['then'](respondWithFilteredResult(_0x5b3458,_0x2a0d90))[_0x40f5('0x27')](handleError(_0x5b3458,null));};exports[_0x40f5('0x4b')]=function(_0x422225,_0x5a1c8f){var _0x20a71c={'raw':![],'where':{'id':_0x422225[_0x40f5('0x4c')]['id']}},_0x2ab929={};_0x2ab929[_0x40f5('0x37')]=_[_0x40f5('0x4d')](db['SugarcrmAccount'][_0x40f5('0x4e')]);_0x2ab929[_0x40f5('0x38')]=_['keys'](_0x422225[_0x40f5('0x38')]);_0x2ab929[_0x40f5('0x39')]=_[_0x40f5('0x3a')](_0x2ab929[_0x40f5('0x37')],_0x2ab929[_0x40f5('0x38')]);_0x20a71c[_0x40f5('0x3b')]=_['intersection'](_0x2ab929['model'],qs[_0x40f5('0x3c')](_0x422225['query'][_0x40f5('0x3c')]));_0x20a71c[_0x40f5('0x3b')]=_0x20a71c['attributes'][_0x40f5('0x3d')]?_0x20a71c[_0x40f5('0x3b')]:_0x2ab929[_0x40f5('0x37')];if(_0x422225['query']['includeAll']){_0x20a71c[_0x40f5('0x4f')]=[{'all':!![]}];}_0x20a71c=_[_0x40f5('0x48')]({},_0x20a71c,_0x422225['options']);return db[_0x40f5('0x36')]['find'](_0x20a71c)[_0x40f5('0x30')](handleEntityNotFound(_0x5a1c8f,null))[_0x40f5('0x30')](respondWithResult(_0x5a1c8f,null))[_0x40f5('0x27')](handleError(_0x5a1c8f,null));};exports[_0x40f5('0x50')]=function(_0x191a86,_0x26e0c3){return db[_0x40f5('0x36')][_0x40f5('0x50')](_0x191a86[_0x40f5('0x51')],{})['then'](respondWithResult(_0x26e0c3,0xc9))['catch'](handleError(_0x26e0c3,null));};exports[_0x40f5('0x52')]=function(_0x21c3ae,_0x404a2d){if(_0x21c3ae[_0x40f5('0x51')]['id']){delete _0x21c3ae[_0x40f5('0x51')]['id'];}return db[_0x40f5('0x36')][_0x40f5('0x53')]({'where':{'id':_0x21c3ae[_0x40f5('0x4c')]['id']}})['then'](handleEntityNotFound(_0x404a2d,null))[_0x40f5('0x30')](saveUpdates(_0x21c3ae[_0x40f5('0x51')],null))[_0x40f5('0x30')](respondWithResult(_0x404a2d,null))[_0x40f5('0x27')](handleError(_0x404a2d,null));};exports['destroy']=function(_0x4352c9,_0x4c2e2c){return db[_0x40f5('0x36')][_0x40f5('0x53')]({'where':{'id':_0x4352c9[_0x40f5('0x4c')]['id']}})[_0x40f5('0x30')](handleEntityNotFound(_0x4c2e2c,null))[_0x40f5('0x30')](removeEntity(_0x4c2e2c,null))['catch'](handleError(_0x4c2e2c,null));};exports[_0x40f5('0x54')]=function(_0x1a9154,_0x3c2cff,_0x3d6cfd){var _0x531a2d={};var _0x4e46cc={};var _0x541870;var _0x55851e;return db['SugarcrmAccount'][_0x40f5('0x55')]({'where':{'id':_0x1a9154[_0x40f5('0x4c')]['id']}})[_0x40f5('0x30')](handleEntityNotFound(_0x3c2cff,null))[_0x40f5('0x30')](function(_0x41a95a){if(_0x41a95a){_0x541870=_0x41a95a;_0x4e46cc['model']=_[_0x40f5('0x4d')](db[_0x40f5('0x56')][_0x40f5('0x4e')]);_0x4e46cc[_0x40f5('0x38')]=_[_0x40f5('0x4d')](_0x1a9154[_0x40f5('0x38')]);_0x4e46cc[_0x40f5('0x39')]=_['intersection'](_0x4e46cc[_0x40f5('0x37')],_0x4e46cc[_0x40f5('0x38')]);_0x531a2d[_0x40f5('0x3b')]=_[_0x40f5('0x3a')](_0x4e46cc[_0x40f5('0x37')],qs[_0x40f5('0x3c')](_0x1a9154[_0x40f5('0x38')]['fields']));_0x531a2d[_0x40f5('0x3b')]=_0x531a2d['attributes'][_0x40f5('0x3d')]?_0x531a2d['attributes']:_0x4e46cc[_0x40f5('0x37')];_0x531a2d[_0x40f5('0x41')]=qs[_0x40f5('0x42')](_0x1a9154[_0x40f5('0x38')][_0x40f5('0x42')]);_0x531a2d[_0x40f5('0x43')]=qs[_0x40f5('0x39')](_['pick'](_0x1a9154['query'],_0x4e46cc[_0x40f5('0x39')]));if(_0x1a9154['query'][_0x40f5('0x47')]){_0x531a2d[_0x40f5('0x43')]=_['merge'](_0x531a2d[_0x40f5('0x43')],{'$or':_[_0x40f5('0x57')](_0x531a2d[_0x40f5('0x3b')],function(_0x220761){var _0x45d33b={};_0x45d33b[_0x220761]={'$like':'%'+_0x1a9154['query']['filter']+'%'};return _0x45d33b;})});}_0x531a2d=_[_0x40f5('0x48')]({},_0x531a2d,_0x1a9154[_0x40f5('0x58')]);return _0x541870[_0x40f5('0x54')](_0x531a2d);}})[_0x40f5('0x30')](function(_0x59b907){if(_0x59b907){_0x55851e=_0x59b907[_0x40f5('0x3d')];if(!_0x1a9154['query'][_0x40f5('0x3e')]('nolimit')){_0x531a2d[_0x40f5('0x40')]=qs[_0x40f5('0x40')](_0x1a9154[_0x40f5('0x38')]['limit']);_0x531a2d[_0x40f5('0x2c')]=qs[_0x40f5('0x2c')](_0x1a9154[_0x40f5('0x38')][_0x40f5('0x2c')]);}return _0x541870[_0x40f5('0x54')](_0x531a2d);}})[_0x40f5('0x30')](function(_0x14b7c2){if(_0x14b7c2){return _0x14b7c2?{'count':_0x55851e,'rows':_0x14b7c2}:null;}})[_0x40f5('0x30')](respondWithResult(_0x3c2cff,null))[_0x40f5('0x27')](handleError(_0x3c2cff,null));};exports['addConfiguration']=function(_0x546726,_0x28a88e,_0x3b2171){if(_0x546726[_0x40f5('0x51')]['id']){delete _0x546726['body']['id'];}return db['SugarcrmAccount'][_0x40f5('0x55')]({'where':{'id':_0x546726['params']['id']}})[_0x40f5('0x30')](handleEntityNotFound(_0x28a88e,null))['then'](function(_0x42f3cb){if(_0x42f3cb){_0x546726['body'][_0x40f5('0x59')]=_0x42f3cb['id'];_0x546726[_0x40f5('0x51')][_0x40f5('0x5a')]=integrations['getSubjects'](_0x546726[_0x40f5('0x51')]['channel'],_0x546726[_0x40f5('0x51')]['type']);_0x546726[_0x40f5('0x51')][_0x40f5('0x5b')]=integrations[_0x40f5('0x5c')](_0x546726[_0x40f5('0x51')][_0x40f5('0x5d')],_0x546726[_0x40f5('0x51')][_0x40f5('0x5e')]);return db['SugarcrmConfiguration'][_0x40f5('0x50')](_0x546726[_0x40f5('0x51')],{'include':[{'model':db['SugarcrmField'],'as':_0x40f5('0x5a')},{'model':db['SugarcrmField'],'as':_0x40f5('0x5b')}]});}return null;})[_0x40f5('0x30')](respondWithResult(_0x28a88e,null))['catch'](handleError(_0x28a88e,null));};exports[_0x40f5('0x5f')]=function(_0x1d9cba,_0x40d673,_0x443044){var _0x2e3602;var _0x24d954=['id',_0x40f5('0x33'),_0x40f5('0x60'),_0x40f5('0x61'),'description',_0x40f5('0x62'),_0x40f5('0x63'),_0x40f5('0x64'),_0x40f5('0x65'),_0x40f5('0x66'),_0x40f5('0x67'),_0x40f5('0x68')];return db[_0x40f5('0x36')][_0x40f5('0x55')]({'where':{'id':_0x1d9cba[_0x40f5('0x4c')]['id']},'attributes':['id','username',_0x40f5('0x69'),'remoteUri']})[_0x40f5('0x30')](handleEntityNotFound(_0x40d673,null))['then'](function(_0x2f23b6){if(_0x2f23b6){_0x2e3602=_0x2f23b6[_0x40f5('0x6a')];return rp({'method':'POST','uri':util[_0x40f5('0x6b')](_0x40f5('0x6c'),_0x2e3602,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0x40f5('0x6d'),'response_type':_0x40f5('0x6d'),'rest_data':JSON[_0x40f5('0x22')]({'user_auth':{'user_name':_0x2f23b6[_0x40f5('0x6e')],'password':_0x2f23b6[_0x40f5('0x69')],'encryption':_0x40f5('0x6f')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x40f5('0x30')](function(_0x158fd3){if(_0x158fd3&&_0x158fd3[_0x40f5('0x33')]!==_0x40f5('0x70')&&_0x158fd3[_0x40f5('0x33')]!=='Password\x20Expired'){return rp({'method':_0x40f5('0x71'),'uri':util['format'](_0x40f5('0x6c'),_0x2e3602,_0x40f5('0x72')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x40f5('0x22')]({'session':_0x158fd3['id'],'module_name':_0x40f5('0x73')})}})[_0x40f5('0x30')](function(_0x3e029f){if(_0x3e029f){var _0x473998=_[_0x40f5('0x74')](_0x3e029f[_0x40f5('0x75')]);_[_0x40f5('0x76')](_0x473998,function(_0xdcdf83){return _0x24d954[_0x40f5('0x77')](_0xdcdf83[_0x40f5('0x33')]);});return{'count':_0x473998['length'],'rows':_[_0x40f5('0x57')](_0x473998,function(_0xd79031){return{'id':_0xd79031['name'],'name':_0xd79031[_0x40f5('0x78')],'custom':_['endsWith'](_0xd79031[_0x40f5('0x33')],'_c')?!![]:![],'options':_0xd79031[_0x40f5('0x58')]?_[_0x40f5('0x57')](_[_0x40f5('0x74')](_0xd79031['options']),function(_0x30748f){return{'name':_0x30748f[_0x40f5('0x79')],'value':_0x30748f[_0x40f5('0x33')]};}):[]};})};}})[_0x40f5('0x30')](respondWithResult(_0x40d673,null))['catch'](function(_0x150e08){var _0x41e78e=_0x1d9cba['query']['test']?0x1f4:_0x150e08[_0x40f5('0x7a')]||0x1f4;logger[_0x40f5('0x23')](_0x40f5('0x7b'),_0x40f5('0x5f'),_0x41e78e,JSON[_0x40f5('0x22')](_0x150e08));delete _0x150e08[_0x40f5('0x33')];if(_0x41e78e===0x191){_0x41e78e=0x190;}_0x40d673[_0x40f5('0x28')](_0x41e78e)[_0x40f5('0x34')](_0x1d9cba[_0x40f5('0x38')][_0x40f5('0x7c')]?{'message':_0x40f5('0x7d'),'statusCode':_0x150e08[_0x40f5('0x7a')]}:_0x150e08);});}else{var _0x3aea38=0x1f4;_0x40d673[_0x40f5('0x28')](_0x3aea38)[_0x40f5('0x34')]({'message':_0x40f5('0x7d'),'statusCode':0x190});}});};
\ No newline at end of file
+var _0x3c62=['set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','send','index','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','map','type','key','field','SugarcrmAccount','includeAll','rows','params','include','find','create','body','getConfigurations','SugarcrmConfiguration','order','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','getFields','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_name','direction','findOne','username','password','remoteUri','slice','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','module_fields','remove','includes','endsWith','options','value','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','request','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SugarcrmAccount,\x20%s,\x20%s','result','catch','status','end','json','count','offset','limit'];(function(_0xb1c3ba,_0x1f85ae){var _0x2cd619=function(_0x5c46dd){while(--_0x5c46dd){_0xb1c3ba['push'](_0xb1c3ba['shift']());}};_0x2cd619(++_0x1f85ae);}(_0x3c62,0x1de));var _0x23c6=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x3c62[_0x433a86];return _0x23000c;};'use strict';var pdf=require(_0x23c6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x23c6('0x1'));var zipdir=require(_0x23c6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x23c6('0x3'));var moment=require(_0x23c6('0x4'));var BPromise=require(_0x23c6('0x5'));var Mustache=require('mustache');var util=require(_0x23c6('0x6'));var path=require(_0x23c6('0x7'));var sox=require(_0x23c6('0x8'));var csv=require(_0x23c6('0x9'));var ejs=require(_0x23c6('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x23c6('0xb'));var crypto=require(_0x23c6('0xc'));var jsforce=require(_0x23c6('0xd'));var deskjs=require(_0x23c6('0xe'));var toCsv=require(_0x23c6('0x9'));var querystring=require(_0x23c6('0xf'));var Papa=require(_0x23c6('0x10'));var authService=require(_0x23c6('0x11'));var hardwareService=require(_0x23c6('0x12'));var Redis=require(_0x23c6('0x13'));var qs=require(_0x23c6('0x14'));var logger=require(_0x23c6('0x15'))(_0x23c6('0x16'));var utils=require(_0x23c6('0x17'));var config=require(_0x23c6('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x23c6('0x19'));var jayson=require(_0x23c6('0x1a'));var client=jayson[_0x23c6('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x812de3,_0x2dcba6,_0x5be413,_0x3db475){return new BPromise(function(_0x3f0e7b,_0x2bc417){var _0x38093c=_0x3db475||client;return _0x38093c[_0x23c6('0x1c')](_0x812de3,_0x5be413)['then'](function(_0x492277){logger[_0x23c6('0x1d')]('SugarcrmAccount,\x20%s,\x20%s',_0x2dcba6,_0x23c6('0x1e'));logger[_0x23c6('0x1f')](_0x23c6('0x20'),_0x2dcba6,_0x23c6('0x1e'),JSON[_0x23c6('0x21')](_0x492277));if(_0x492277['error']){if(_0x492277[_0x23c6('0x22')][_0x23c6('0x23')]===0x1f4){logger[_0x23c6('0x22')]('SugarcrmAccount,\x20%s,\x20%s',_0x2dcba6,_0x492277[_0x23c6('0x22')]['message']);return _0x2bc417(_0x492277['error'][_0x23c6('0x24')]);}logger[_0x23c6('0x22')](_0x23c6('0x25'),_0x2dcba6,_0x492277[_0x23c6('0x22')][_0x23c6('0x24')]);return _0x3f0e7b(_0x492277[_0x23c6('0x22')][_0x23c6('0x24')]);}else{logger[_0x23c6('0x1d')](_0x23c6('0x25'),_0x2dcba6,_0x23c6('0x1e'));_0x3f0e7b(_0x492277[_0x23c6('0x26')][_0x23c6('0x24')]);}})[_0x23c6('0x27')](function(_0x561821){logger[_0x23c6('0x22')](_0x23c6('0x25'),_0x2dcba6,_0x561821);_0x2bc417(_0x561821);});});}function respondWithStatusCode(_0x3cbfe5,_0x31abf5){_0x31abf5=_0x31abf5||0xcc;return function(_0x4b957c){if(_0x4b957c){return _0x3cbfe5['sendStatus'](_0x31abf5);}return _0x3cbfe5[_0x23c6('0x28')](_0x31abf5)[_0x23c6('0x29')]();};}function respondWithResult(_0x5aaa95,_0x3fbfe6){_0x3fbfe6=_0x3fbfe6||0xc8;return function(_0x484ee1){if(_0x484ee1){return _0x5aaa95[_0x23c6('0x28')](_0x3fbfe6)[_0x23c6('0x2a')](_0x484ee1);}};}function respondWithFilteredResult(_0x22b8fa,_0x25bf5c){return function(_0x415d2c){if(_0x415d2c){var _0x2801a4=_0x415d2c[_0x23c6('0x2b')],_0x4d5217=_0x25bf5c[_0x23c6('0x2c')],_0x192569=_0x25bf5c[_0x23c6('0x2c')]+_0x25bf5c[_0x23c6('0x2d')],_0x5b1342;if(_0x192569>=_0x2801a4){_0x192569=_0x2801a4;_0x5b1342=0xc8;}else{_0x5b1342=0xce;}_0x22b8fa[_0x23c6('0x28')](_0x5b1342);return _0x22b8fa[_0x23c6('0x2e')](_0x23c6('0x2f'),_0x4d5217+'-'+_0x192569+'/'+_0x2801a4)[_0x23c6('0x2a')](_0x415d2c);}return null;};}function patchUpdates(_0x4bfc93){return function(_0x16cb32){try{jsonpatch[_0x23c6('0x30')](_0x16cb32,_0x4bfc93,!![]);}catch(_0x3ea1af){return BPromise[_0x23c6('0x31')](_0x3ea1af);}return _0x16cb32[_0x23c6('0x32')]();};}function saveUpdates(_0x27744c,_0x34174d){return function(_0x4e87ea){if(_0x4e87ea){return _0x4e87ea[_0x23c6('0x33')](_0x27744c)[_0x23c6('0x34')](function(_0x5cdedd){return _0x5cdedd;});}return null;};}function removeEntity(_0x4a9fc4,_0x1248b3){return function(_0x107771){if(_0x107771){return _0x107771[_0x23c6('0x35')]()[_0x23c6('0x34')](function(){_0x4a9fc4[_0x23c6('0x28')](0xcc)[_0x23c6('0x29')]();});}};}function handleEntityNotFound(_0x4840a4,_0x14d37c){return function(_0x391e2f){if(!_0x391e2f){_0x4840a4[_0x23c6('0x36')](0x194);}return _0x391e2f;};}function handleError(_0x213067,_0x4d4ed5){_0x4d4ed5=_0x4d4ed5||0x1f4;return function(_0x3577ed){logger['error'](_0x3577ed['stack']);if(_0x3577ed[_0x23c6('0x37')]){delete _0x3577ed[_0x23c6('0x37')];}_0x213067[_0x23c6('0x28')](_0x4d4ed5)[_0x23c6('0x38')](_0x3577ed);};}exports[_0x23c6('0x39')]=function(_0x4fc528,_0x525e66){var _0x1d56cd={},_0xb7b49c={},_0x34cec0={'count':0x0,'rows':[]};var _0x28dd53=db['SugarcrmAccount'][_0x23c6('0x3a')];_0xb7b49c[_0x23c6('0x3b')]=_[_0x23c6('0x3c')](_0x28dd53);_0xb7b49c['query']=_[_0x23c6('0x3c')](_0x4fc528[_0x23c6('0x3d')]);_0xb7b49c['filters']=_[_0x23c6('0x3e')](_0xb7b49c[_0x23c6('0x3b')],_0xb7b49c[_0x23c6('0x3d')]);_0x1d56cd[_0x23c6('0x3f')]=_[_0x23c6('0x3e')](_0xb7b49c[_0x23c6('0x3b')],qs[_0x23c6('0x40')](_0x4fc528[_0x23c6('0x3d')]['fields']));_0x1d56cd['attributes']=_0x1d56cd[_0x23c6('0x3f')][_0x23c6('0x41')]?_0x1d56cd[_0x23c6('0x3f')]:_0xb7b49c[_0x23c6('0x3b')];if(!_0x4fc528[_0x23c6('0x3d')][_0x23c6('0x42')](_0x23c6('0x43'))){_0x1d56cd['limit']=qs[_0x23c6('0x2d')](_0x4fc528[_0x23c6('0x3d')][_0x23c6('0x2d')]);_0x1d56cd[_0x23c6('0x2c')]=qs[_0x23c6('0x2c')](_0x4fc528[_0x23c6('0x3d')]['offset']);}_0x1d56cd['order']=qs[_0x23c6('0x44')](_0x4fc528[_0x23c6('0x3d')]['sort']);_0x1d56cd[_0x23c6('0x45')]=qs[_0x23c6('0x46')](_['pick'](_0x4fc528['query'],_0xb7b49c[_0x23c6('0x46')]));if(_0x4fc528[_0x23c6('0x3d')][_0x23c6('0x47')]){_0x1d56cd[_0x23c6('0x45')]=_[_0x23c6('0x48')](_0x1d56cd[_0x23c6('0x45')],{'$or':_[_0x23c6('0x49')](_0x28dd53,function(_0x366112){if(_0x366112[_0x23c6('0x4a')][_0x23c6('0x4b')]!=='VIRTUAL'){var _0x3e5c77={};_0x3e5c77[_0x366112[_0x23c6('0x4c')]]={'$like':'%'+_0x4fc528[_0x23c6('0x3d')][_0x23c6('0x47')]+'%'};return _0x3e5c77;}})});}_0x1d56cd=_[_0x23c6('0x48')]({},_0x1d56cd,_0x4fc528['options']);var _0x45ad35={'where':_0x1d56cd[_0x23c6('0x45')]};return db[_0x23c6('0x4d')][_0x23c6('0x2b')](_0x45ad35)[_0x23c6('0x34')](function(_0x17ff2f){_0x34cec0[_0x23c6('0x2b')]=_0x17ff2f;if(_0x4fc528['query'][_0x23c6('0x4e')]){_0x1d56cd['include']=[{'all':!![]}];}return db[_0x23c6('0x4d')]['findAll'](_0x1d56cd);})[_0x23c6('0x34')](function(_0x101d56){_0x34cec0[_0x23c6('0x4f')]=_0x101d56;return _0x34cec0;})[_0x23c6('0x34')](respondWithFilteredResult(_0x525e66,_0x1d56cd))[_0x23c6('0x27')](handleError(_0x525e66,null));};exports['show']=function(_0x2dca30,_0x35b585){var _0x58360c={'raw':![],'where':{'id':_0x2dca30[_0x23c6('0x50')]['id']}},_0x2f4ca8={};_0x2f4ca8['model']=_[_0x23c6('0x3c')](db[_0x23c6('0x4d')][_0x23c6('0x3a')]);_0x2f4ca8[_0x23c6('0x3d')]=_[_0x23c6('0x3c')](_0x2dca30['query']);_0x2f4ca8['filters']=_[_0x23c6('0x3e')](_0x2f4ca8[_0x23c6('0x3b')],_0x2f4ca8[_0x23c6('0x3d')]);_0x58360c['attributes']=_[_0x23c6('0x3e')](_0x2f4ca8[_0x23c6('0x3b')],qs['fields'](_0x2dca30[_0x23c6('0x3d')][_0x23c6('0x40')]));_0x58360c[_0x23c6('0x3f')]=_0x58360c[_0x23c6('0x3f')]['length']?_0x58360c[_0x23c6('0x3f')]:_0x2f4ca8[_0x23c6('0x3b')];if(_0x2dca30[_0x23c6('0x3d')][_0x23c6('0x4e')]){_0x58360c[_0x23c6('0x51')]=[{'all':!![]}];}_0x58360c=_['merge']({},_0x58360c,_0x2dca30['options']);return db['SugarcrmAccount'][_0x23c6('0x52')](_0x58360c)[_0x23c6('0x34')](handleEntityNotFound(_0x35b585,null))['then'](respondWithResult(_0x35b585,null))[_0x23c6('0x27')](handleError(_0x35b585,null));};exports['create']=function(_0x2f5bf8,_0x7e8bdb){return db[_0x23c6('0x4d')][_0x23c6('0x53')](_0x2f5bf8[_0x23c6('0x54')],{})[_0x23c6('0x34')](respondWithResult(_0x7e8bdb,0xc9))['catch'](handleError(_0x7e8bdb,null));};exports['update']=function(_0x4b726b,_0x578ce4){if(_0x4b726b[_0x23c6('0x54')]['id']){delete _0x4b726b[_0x23c6('0x54')]['id'];}return db['SugarcrmAccount'][_0x23c6('0x52')]({'where':{'id':_0x4b726b[_0x23c6('0x50')]['id']}})[_0x23c6('0x34')](handleEntityNotFound(_0x578ce4,null))[_0x23c6('0x34')](saveUpdates(_0x4b726b[_0x23c6('0x54')],null))[_0x23c6('0x34')](respondWithResult(_0x578ce4,null))[_0x23c6('0x27')](handleError(_0x578ce4,null));};exports[_0x23c6('0x35')]=function(_0x29ca37,_0x25dbd7){return db[_0x23c6('0x4d')][_0x23c6('0x52')]({'where':{'id':_0x29ca37[_0x23c6('0x50')]['id']}})[_0x23c6('0x34')](handleEntityNotFound(_0x25dbd7,null))['then'](removeEntity(_0x25dbd7,null))['catch'](handleError(_0x25dbd7,null));};exports[_0x23c6('0x55')]=function(_0x2e6756,_0x19cd7b,_0x237df0){var _0xd2bfb6={};var _0x167403={};var _0xe8ad94;var _0x584902;return db[_0x23c6('0x4d')]['findOne']({'where':{'id':_0x2e6756[_0x23c6('0x50')]['id']}})[_0x23c6('0x34')](handleEntityNotFound(_0x19cd7b,null))[_0x23c6('0x34')](function(_0x47ca55){if(_0x47ca55){_0xe8ad94=_0x47ca55;_0x167403['model']=_['keys'](db[_0x23c6('0x56')]['rawAttributes']);_0x167403[_0x23c6('0x3d')]=_[_0x23c6('0x3c')](_0x2e6756[_0x23c6('0x3d')]);_0x167403[_0x23c6('0x46')]=_['intersection'](_0x167403[_0x23c6('0x3b')],_0x167403[_0x23c6('0x3d')]);_0xd2bfb6[_0x23c6('0x3f')]=_[_0x23c6('0x3e')](_0x167403[_0x23c6('0x3b')],qs[_0x23c6('0x40')](_0x2e6756[_0x23c6('0x3d')][_0x23c6('0x40')]));_0xd2bfb6[_0x23c6('0x3f')]=_0xd2bfb6[_0x23c6('0x3f')][_0x23c6('0x41')]?_0xd2bfb6[_0x23c6('0x3f')]:_0x167403[_0x23c6('0x3b')];_0xd2bfb6[_0x23c6('0x57')]=qs[_0x23c6('0x44')](_0x2e6756[_0x23c6('0x3d')][_0x23c6('0x44')]);_0xd2bfb6[_0x23c6('0x45')]=qs['filters'](_['pick'](_0x2e6756['query'],_0x167403[_0x23c6('0x46')]));if(_0x2e6756['query'][_0x23c6('0x47')]){_0xd2bfb6[_0x23c6('0x45')]=_[_0x23c6('0x48')](_0xd2bfb6['where'],{'$or':_['map'](_0xd2bfb6[_0x23c6('0x3f')],function(_0x3fe451){var _0x3cba6e={};_0x3cba6e[_0x3fe451]={'$like':'%'+_0x2e6756[_0x23c6('0x3d')][_0x23c6('0x47')]+'%'};return _0x3cba6e;})});}_0xd2bfb6=_['merge']({},_0xd2bfb6,_0x2e6756['options']);return _0xe8ad94[_0x23c6('0x55')](_0xd2bfb6);}})[_0x23c6('0x34')](function(_0x3585e9){if(_0x3585e9){_0x584902=_0x3585e9[_0x23c6('0x41')];if(!_0x2e6756[_0x23c6('0x3d')]['hasOwnProperty'](_0x23c6('0x43'))){_0xd2bfb6[_0x23c6('0x2d')]=qs[_0x23c6('0x2d')](_0x2e6756[_0x23c6('0x3d')][_0x23c6('0x2d')]);_0xd2bfb6[_0x23c6('0x2c')]=qs[_0x23c6('0x2c')](_0x2e6756[_0x23c6('0x3d')]['offset']);}return _0xe8ad94[_0x23c6('0x55')](_0xd2bfb6);}})['then'](function(_0xb2a5d){if(_0xb2a5d){return _0xb2a5d?{'count':_0x584902,'rows':_0xb2a5d}:null;}})[_0x23c6('0x34')](respondWithResult(_0x19cd7b,null))['catch'](handleError(_0x19cd7b,null));};exports['addConfiguration']=function(_0x1a6fd5,_0x381d40,_0x51b5a8){if(_0x1a6fd5[_0x23c6('0x54')]['id']){delete _0x1a6fd5['body']['id'];}return db[_0x23c6('0x4d')]['findOne']({'where':{'id':_0x1a6fd5[_0x23c6('0x50')]['id']}})[_0x23c6('0x34')](handleEntityNotFound(_0x381d40,null))[_0x23c6('0x34')](function(_0x512dc9){if(_0x512dc9){_0x1a6fd5['body'][_0x23c6('0x58')]=_0x512dc9['id'];_0x1a6fd5['body'][_0x23c6('0x59')]=integrations[_0x23c6('0x5a')](_0x1a6fd5['body']['channel'],_0x1a6fd5[_0x23c6('0x54')][_0x23c6('0x4a')]);_0x1a6fd5[_0x23c6('0x54')][_0x23c6('0x5b')]=integrations[_0x23c6('0x5c')](_0x1a6fd5[_0x23c6('0x54')][_0x23c6('0x5d')],_0x1a6fd5[_0x23c6('0x54')][_0x23c6('0x4a')]);return db[_0x23c6('0x56')][_0x23c6('0x53')](_0x1a6fd5['body'],{'include':[{'model':db[_0x23c6('0x5e')],'as':_0x23c6('0x59')},{'model':db[_0x23c6('0x5e')],'as':_0x23c6('0x5b')}]});}return null;})[_0x23c6('0x34')](respondWithResult(_0x381d40,null))[_0x23c6('0x27')](handleError(_0x381d40,null));};exports[_0x23c6('0x5f')]=function(_0x5b0085,_0x52e555,_0x303da9){var _0x2f219a='';var _0x344c72=['id',_0x23c6('0x37'),'assigned_user_id',_0x23c6('0x60'),_0x23c6('0x61'),_0x23c6('0x62'),_0x23c6('0x63'),_0x23c6('0x64'),_0x23c6('0x65'),'parent_type',_0x23c6('0x66'),_0x23c6('0x67')];return db[_0x23c6('0x4d')][_0x23c6('0x68')]({'where':{'id':_0x5b0085[_0x23c6('0x50')]['id']},'attributes':['id',_0x23c6('0x69'),_0x23c6('0x6a'),'remoteUri']})['then'](handleEntityNotFound(_0x52e555,null))[_0x23c6('0x34')](function(_0x5f14e7){if(_0x5f14e7){_0x2f219a=_0x5f14e7[_0x23c6('0x6b')];var _0xb95340=_0x2f219a[_0x23c6('0x6c')](-0x1);if(_0xb95340==='/'){_0x2f219a=_0x2f219a[_0x23c6('0x6d')](0x0,_0x2f219a[_0x23c6('0x6e')](_0xb95340));}return rp({'method':'POST','uri':util[_0x23c6('0x6f')](_0x23c6('0x70'),_0x2f219a,_0x23c6('0x71')),'json':!![],'form':{'method':_0x23c6('0x72'),'input_type':_0x23c6('0x73'),'response_type':_0x23c6('0x73'),'rest_data':JSON[_0x23c6('0x21')]({'user_auth':{'user_name':_0x5f14e7[_0x23c6('0x69')],'password':_0x5f14e7[_0x23c6('0x6a')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x23c6('0x34')](function(_0x5a9f28){if(_0x5a9f28&&_0x5a9f28[_0x23c6('0x37')]!==_0x23c6('0x74')&&_0x5a9f28[_0x23c6('0x37')]!==_0x23c6('0x75')){return rp({'method':'POST','uri':util['format']('%s%s',_0x2f219a,_0x23c6('0x71')),'json':!![],'form':{'method':_0x23c6('0x76'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x23c6('0x21')]({'session':_0x5a9f28['id'],'module_name':_0x23c6('0x77')})}})['then'](function(_0x1a845d){if(_0x1a845d){var _0x6c88cf=_[_0x23c6('0x78')](_0x1a845d[_0x23c6('0x79')]);_[_0x23c6('0x7a')](_0x6c88cf,function(_0x386413){return _0x344c72[_0x23c6('0x7b')](_0x386413['name']);});return{'count':_0x6c88cf[_0x23c6('0x41')],'rows':_['map'](_0x6c88cf,function(_0x45a9d8){return{'id':_0x45a9d8[_0x23c6('0x37')],'name':_0x45a9d8['label'],'custom':_[_0x23c6('0x7c')](_0x45a9d8['name'],'_c')?!![]:![],'options':_0x45a9d8[_0x23c6('0x7d')]?_[_0x23c6('0x49')](_[_0x23c6('0x78')](_0x45a9d8[_0x23c6('0x7d')]),function(_0xd23486){return{'name':_0xd23486[_0x23c6('0x7e')],'value':_0xd23486['name']};}):[]};})};}})[_0x23c6('0x34')](respondWithResult(_0x52e555,null))[_0x23c6('0x27')](function(_0x182cef){var _0x38f25f=_0x5b0085[_0x23c6('0x3d')][_0x23c6('0x7f')]?0x1f4:_0x182cef['statusCode']||0x1f4;logger[_0x23c6('0x22')](_0x23c6('0x80'),_0x23c6('0x5f'),_0x38f25f,JSON['stringify'](_0x182cef));delete _0x182cef[_0x23c6('0x37')];if(_0x38f25f===0x191){_0x38f25f=0x190;}_0x52e555[_0x23c6('0x28')](_0x38f25f)['send'](_0x5b0085['query'][_0x23c6('0x7f')]?{'message':_0x23c6('0x81'),'statusCode':_0x182cef[_0x23c6('0x82')]}:_0x182cef);});}else{var _0x51307f=0x1f4;_0x52e555[_0x23c6('0x28')](_0x51307f)[_0x23c6('0x38')]({'message':_0x23c6('0x81'),'statusCode':0x190});}});};
\ No newline at end of file
index 3be0c01..0ec3193 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5ea3=['request-promise','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','moment','bluebird'];(function(_0x1e7ea9,_0x37874d){var _0x309f4c=function(_0x4304b1){while(--_0x4304b1){_0x1e7ea9['push'](_0x1e7ea9['shift']());}};_0x309f4c(++_0x37874d);}(_0x5ea3,0xf7));var _0x35ea=function(_0x1bfbd9,_0x2ab718){_0x1bfbd9=_0x1bfbd9-0x0;var _0x4c54d4=_0x5ea3[_0x1bfbd9];return _0x4c54d4;};'use strict';var _=require(_0x35ea('0x0'));var util=require(_0x35ea('0x1'));var logger=require(_0x35ea('0x2'))('api');var moment=require(_0x35ea('0x3'));var BPromise=require(_0x35ea('0x4'));var rp=require(_0x35ea('0x5'));var attributes=require(_0x35ea('0x6'));var integrations=require(_0x35ea('0x7'));module[_0x35ea('0x8')]=function(_0x569e23,_0x1faf94){return _0x569e23[_0x35ea('0x9')](_0x35ea('0xa'),attributes,{'tableName':_0x35ea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xb456=['int_sugarcrm_accounts','util','../../config/logger','api','moment','bluebird','request-promise','./intSugarcrmAccount.attributes','../../components/integrations/configuration'];(function(_0x43e4b3,_0x1444de){var _0x10c655=function(_0x56c01d){while(--_0x56c01d){_0x43e4b3['push'](_0x43e4b3['shift']());}};_0x10c655(++_0x1444de);}(_0xb456,0xeb));var _0x6b45=function(_0x3419f7,_0x345fd5){_0x3419f7=_0x3419f7-0x0;var _0x59676c=_0xb456[_0x3419f7];return _0x59676c;};'use strict';var _=require('lodash');var util=require(_0x6b45('0x0'));var logger=require(_0x6b45('0x1'))(_0x6b45('0x2'));var moment=require(_0x6b45('0x3'));var BPromise=require(_0x6b45('0x4'));var rp=require(_0x6b45('0x5'));var attributes=require(_0x6b45('0x6'));var integrations=require(_0x6b45('0x7'));module['exports']=function(_0x180b2e,_0x338365){return _0x180b2e['define']('SugarcrmAccount',attributes,{'tableName':_0x6b45('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index a0493f6..f2193f3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x898b=['raw','attributes','limit','include','map','model','where','ShowSugarcrmAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','info','result','catch','GetSugarcrmAccount','SugarcrmAccount','options'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x898b,0xb7));var _0xb898=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x898b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb898('0x0'));var util=require(_0xb898('0x1'));var moment=require(_0xb898('0x2'));var BPromise=require(_0xb898('0x3'));var rs=require(_0xb898('0x4'));var fs=require('fs');var Redis=require(_0xb898('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb898('0x6'));var logger=require(_0xb898('0x7'))('rpc');var config=require(_0xb898('0x8'));var jayson=require(_0xb898('0x9'));var client=jayson[_0xb898('0xa')][_0xb898('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x529630,_0x8e67a2,_0x4a5c34){return new BPromise(function(_0x113539,_0x52081d){return client[_0xb898('0xc')](_0x529630,_0x4a5c34)[_0xb898('0xd')](function(_0x74793f){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x8e67a2,_0xb898('0xe'));logger[_0xb898('0xf')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x8e67a2,_0xb898('0xe'),JSON[_0xb898('0x10')](_0x74793f));if(_0x74793f['error']){if(_0x74793f[_0xb898('0x11')][_0xb898('0x12')]===0x1f4){logger[_0xb898('0x11')](_0xb898('0x13'),_0x8e67a2,_0x74793f[_0xb898('0x11')][_0xb898('0x14')]);return _0x52081d(_0x74793f[_0xb898('0x11')]['message']);}logger[_0xb898('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x8e67a2,_0x74793f[_0xb898('0x11')][_0xb898('0x14')]);return _0x113539(_0x74793f[_0xb898('0x11')][_0xb898('0x14')]);}else{logger[_0xb898('0x15')](_0xb898('0x13'),_0x8e67a2,_0xb898('0xe'));_0x113539(_0x74793f[_0xb898('0x16')][_0xb898('0x14')]);}})[_0xb898('0x17')](function(_0x415e11){logger['error'](_0xb898('0x13'),_0x8e67a2,_0x415e11);_0x52081d(_0x415e11);});});}exports[_0xb898('0x18')]=function(_0xf1ee33){var _0x3020b8=this;return new Promise(function(_0x316506,_0x929f0b){return db[_0xb898('0x19')]['findAll']({'raw':_0xf1ee33[_0xb898('0x1a')]?_0xf1ee33[_0xb898('0x1a')][_0xb898('0x1b')]===undefined?!![]:![]:!![],'where':_0xf1ee33[_0xb898('0x1a')]?_0xf1ee33['options']['where']||null:null,'attributes':_0xf1ee33[_0xb898('0x1a')]?_0xf1ee33[_0xb898('0x1a')][_0xb898('0x1c')]||null:null,'limit':_0xf1ee33[_0xb898('0x1a')]?_0xf1ee33[_0xb898('0x1a')][_0xb898('0x1d')]||null:null,'include':_0xf1ee33['options']?_0xf1ee33[_0xb898('0x1a')][_0xb898('0x1e')]?_[_0xb898('0x1f')](_0xf1ee33[_0xb898('0x1a')][_0xb898('0x1e')],function(_0x2d6d4a){return{'model':db[_0x2d6d4a['model']],'as':_0x2d6d4a['as'],'attributes':_0x2d6d4a[_0xb898('0x1c')],'include':_0x2d6d4a[_0xb898('0x1e')]?_['map'](_0x2d6d4a[_0xb898('0x1e')],function(_0x4561da){return{'model':db[_0x4561da[_0xb898('0x20')]],'as':_0x4561da['as'],'attributes':_0x4561da[_0xb898('0x1c')],'include':_0x4561da[_0xb898('0x1e')]?_[_0xb898('0x1f')](_0x4561da[_0xb898('0x1e')],function(_0x22a4f0){return{'model':db[_0x22a4f0[_0xb898('0x20')]],'as':_0x22a4f0['as'],'attributes':_0x22a4f0[_0xb898('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb898('0xd')](function(_0x3c6718){logger[_0xb898('0x15')]('GetSugarcrmAccount',_0xf1ee33);logger[_0xb898('0xf')](_0xb898('0x18'),_0xf1ee33,JSON[_0xb898('0x10')](_0x3c6718));_0x316506(_0x3c6718);})[_0xb898('0x17')](function(_0x3907c1){logger[_0xb898('0x11')](_0xb898('0x18'),_0x3907c1[_0xb898('0x14')],_0xf1ee33);_0x929f0b(_0x3020b8[_0xb898('0x11')](0x1f4,_0x3907c1[_0xb898('0x14')]));});});};exports['ShowSugarcrmAccount']=function(_0x3c478f){var _0x297c34=this;return new Promise(function(_0x481f7b,_0x153380){return db[_0xb898('0x19')]['find']({'raw':_0x3c478f[_0xb898('0x1a')]?_0x3c478f[_0xb898('0x1a')][_0xb898('0x1b')]===undefined?!![]:![]:!![],'where':_0x3c478f[_0xb898('0x1a')]?_0x3c478f[_0xb898('0x1a')][_0xb898('0x21')]||null:null,'attributes':_0x3c478f['options']?_0x3c478f[_0xb898('0x1a')][_0xb898('0x1c')]||null:null,'include':_0x3c478f['options']?_0x3c478f[_0xb898('0x1a')][_0xb898('0x1e')]?_[_0xb898('0x1f')](_0x3c478f[_0xb898('0x1a')][_0xb898('0x1e')],function(_0x3f8462){return{'model':db[_0x3f8462['model']],'as':_0x3f8462['as'],'attributes':_0x3f8462[_0xb898('0x1c')],'include':_0x3f8462[_0xb898('0x1e')]?_[_0xb898('0x1f')](_0x3f8462[_0xb898('0x1e')],function(_0x55a23f){return{'model':db[_0x55a23f[_0xb898('0x20')]],'as':_0x55a23f['as'],'attributes':_0x55a23f[_0xb898('0x1c')],'include':_0x55a23f['include']?_['map'](_0x55a23f['include'],function(_0x561b66){return{'model':db[_0x561b66[_0xb898('0x20')]],'as':_0x561b66['as'],'attributes':_0x561b66['attributes']};}):[]};}):[]};}):[]:[]})[_0xb898('0xd')](function(_0x4cadd4){logger[_0xb898('0x15')](_0xb898('0x22'),_0x3c478f);logger[_0xb898('0xf')]('ShowSugarcrmAccount',_0x3c478f,JSON['stringify'](_0x4cadd4));_0x481f7b(_0x4cadd4);})[_0xb898('0x17')](function(_0x3d3465){logger[_0xb898('0x11')](_0xb898('0x22'),_0x3d3465[_0xb898('0x14')],_0x3c478f);_0x153380(_0x297c34['error'](0x1f4,_0x3d3465['message']));});});};
\ No newline at end of file
+var _0xc8dd=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SugarcrmAccount','options','raw','where','attributes','limit','include','map','model','GetSugarcrmAccount','ShowSugarcrmAccount','find','lodash'];(function(_0x257579,_0x627180){var _0x1a329d=function(_0x27e1f8){while(--_0x27e1f8){_0x257579['push'](_0x257579['shift']());}};_0x1a329d(++_0x627180);}(_0xc8dd,0x127));var _0xdc8d=function(_0x5f1cf8,_0x5e0923){_0x5f1cf8=_0x5f1cf8-0x0;var _0x27d0fa=_0xc8dd[_0x5f1cf8];return _0x27d0fa;};'use strict';var _=require(_0xdc8d('0x0'));var util=require(_0xdc8d('0x1'));var moment=require(_0xdc8d('0x2'));var BPromise=require(_0xdc8d('0x3'));var rs=require(_0xdc8d('0x4'));var fs=require('fs');var Redis=require(_0xdc8d('0x5'));var db=require(_0xdc8d('0x6'))['db'];var utils=require(_0xdc8d('0x7'));var logger=require(_0xdc8d('0x8'))(_0xdc8d('0x9'));var config=require(_0xdc8d('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xdc8d('0xb')][_0xdc8d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1c5b65,_0x210a10,_0x49e5b5){return new BPromise(function(_0xaae5a3,_0x1ba578){return client['request'](_0x1c5b65,_0x49e5b5)[_0xdc8d('0xd')](function(_0x373148){logger[_0xdc8d('0xe')](_0xdc8d('0xf'),_0x210a10,'request\x20sent');logger[_0xdc8d('0x10')](_0xdc8d('0x11'),_0x210a10,_0xdc8d('0x12'),JSON[_0xdc8d('0x13')](_0x373148));if(_0x373148[_0xdc8d('0x14')]){if(_0x373148[_0xdc8d('0x14')][_0xdc8d('0x15')]===0x1f4){logger[_0xdc8d('0x14')](_0xdc8d('0xf'),_0x210a10,_0x373148['error'][_0xdc8d('0x16')]);return _0x1ba578(_0x373148['error'][_0xdc8d('0x16')]);}logger['error'](_0xdc8d('0xf'),_0x210a10,_0x373148[_0xdc8d('0x14')][_0xdc8d('0x16')]);return _0xaae5a3(_0x373148[_0xdc8d('0x14')][_0xdc8d('0x16')]);}else{logger['info'](_0xdc8d('0xf'),_0x210a10,_0xdc8d('0x12'));_0xaae5a3(_0x373148[_0xdc8d('0x17')]['message']);}})[_0xdc8d('0x18')](function(_0x42a124){logger[_0xdc8d('0x14')]('SugarcrmAccount,\x20%s,\x20%s',_0x210a10,_0x42a124);_0x1ba578(_0x42a124);});});}exports['GetSugarcrmAccount']=function(_0x367105){var _0x56b7ea=this;return new Promise(function(_0xe05684,_0x1a48a3){return db[_0xdc8d('0x19')]['findAll']({'raw':_0x367105['options']?_0x367105[_0xdc8d('0x1a')][_0xdc8d('0x1b')]===undefined?!![]:![]:!![],'where':_0x367105[_0xdc8d('0x1a')]?_0x367105[_0xdc8d('0x1a')][_0xdc8d('0x1c')]||null:null,'attributes':_0x367105[_0xdc8d('0x1a')]?_0x367105[_0xdc8d('0x1a')][_0xdc8d('0x1d')]||null:null,'limit':_0x367105[_0xdc8d('0x1a')]?_0x367105['options'][_0xdc8d('0x1e')]||null:null,'include':_0x367105[_0xdc8d('0x1a')]?_0x367105[_0xdc8d('0x1a')][_0xdc8d('0x1f')]?_[_0xdc8d('0x20')](_0x367105[_0xdc8d('0x1a')][_0xdc8d('0x1f')],function(_0x28db9c){return{'model':db[_0x28db9c[_0xdc8d('0x21')]],'as':_0x28db9c['as'],'attributes':_0x28db9c[_0xdc8d('0x1d')],'include':_0x28db9c[_0xdc8d('0x1f')]?_[_0xdc8d('0x20')](_0x28db9c[_0xdc8d('0x1f')],function(_0x4337cb){return{'model':db[_0x4337cb[_0xdc8d('0x21')]],'as':_0x4337cb['as'],'attributes':_0x4337cb[_0xdc8d('0x1d')],'include':_0x4337cb['include']?_[_0xdc8d('0x20')](_0x4337cb[_0xdc8d('0x1f')],function(_0xdc0825){return{'model':db[_0xdc0825[_0xdc8d('0x21')]],'as':_0xdc0825['as'],'attributes':_0xdc0825[_0xdc8d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdc8d('0xd')](function(_0x549f29){logger['info'](_0xdc8d('0x22'),_0x367105);logger[_0xdc8d('0x10')]('GetSugarcrmAccount',_0x367105,JSON[_0xdc8d('0x13')](_0x549f29));_0xe05684(_0x549f29);})[_0xdc8d('0x18')](function(_0x579b76){logger[_0xdc8d('0x14')](_0xdc8d('0x22'),_0x579b76[_0xdc8d('0x16')],_0x367105);_0x1a48a3(_0x56b7ea[_0xdc8d('0x14')](0x1f4,_0x579b76[_0xdc8d('0x16')]));});});};exports[_0xdc8d('0x23')]=function(_0x279b2a){var _0x49cdd0=this;return new Promise(function(_0x59b5b1,_0x1cee9f){return db['SugarcrmAccount'][_0xdc8d('0x24')]({'raw':_0x279b2a[_0xdc8d('0x1a')]?_0x279b2a['options'][_0xdc8d('0x1b')]===undefined?!![]:![]:!![],'where':_0x279b2a['options']?_0x279b2a[_0xdc8d('0x1a')][_0xdc8d('0x1c')]||null:null,'attributes':_0x279b2a[_0xdc8d('0x1a')]?_0x279b2a['options'][_0xdc8d('0x1d')]||null:null,'include':_0x279b2a[_0xdc8d('0x1a')]?_0x279b2a['options']['include']?_[_0xdc8d('0x20')](_0x279b2a[_0xdc8d('0x1a')][_0xdc8d('0x1f')],function(_0x30a036){return{'model':db[_0x30a036[_0xdc8d('0x21')]],'as':_0x30a036['as'],'attributes':_0x30a036['attributes'],'include':_0x30a036[_0xdc8d('0x1f')]?_[_0xdc8d('0x20')](_0x30a036[_0xdc8d('0x1f')],function(_0x256e24){return{'model':db[_0x256e24[_0xdc8d('0x21')]],'as':_0x256e24['as'],'attributes':_0x256e24['attributes'],'include':_0x256e24[_0xdc8d('0x1f')]?_[_0xdc8d('0x20')](_0x256e24[_0xdc8d('0x1f')],function(_0x5c7bbd){return{'model':db[_0x5c7bbd[_0xdc8d('0x21')]],'as':_0x5c7bbd['as'],'attributes':_0x5c7bbd[_0xdc8d('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x393bc6){logger[_0xdc8d('0xe')](_0xdc8d('0x23'),_0x279b2a);logger[_0xdc8d('0x10')](_0xdc8d('0x23'),_0x279b2a,JSON[_0xdc8d('0x13')](_0x393bc6));_0x59b5b1(_0x393bc6);})[_0xdc8d('0x18')](function(_0x4081dc){logger[_0xdc8d('0x14')](_0xdc8d('0x23'),_0x4081dc[_0xdc8d('0x16')],_0x279b2a);_0x1cee9f(_0x49cdd0[_0xdc8d('0x14')](0x1f4,_0x4081dc['message']));});});};
\ No newline at end of file
index 537f442..edacf3e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfde6=['./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x41b95a,_0x281d00){var _0x309134=function(_0x867ace){while(--_0x867ace){_0x41b95a['push'](_0x41b95a['shift']());}};_0x309134(++_0x281d00);}(_0xfde6,0x19f));var _0x6fde=function(_0x55311c,_0x4c6a2d){_0x55311c=_0x55311c-0x0;var _0x220908=_0xfde6[_0x55311c];return _0x220908;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x6fde('0x0'));var express=require('express');var router=express[_0x6fde('0x1')]();var auth=require(_0x6fde('0x2'));var interaction=require(_0x6fde('0x3'));var config=require(_0x6fde('0x4'));var controller=require(_0x6fde('0x5'));router[_0x6fde('0x6')]('/',auth[_0x6fde('0x7')](),controller[_0x6fde('0x8')]);router[_0x6fde('0x6')](_0x6fde('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x6fde('0x6')](_0x6fde('0xa'),auth['isAuthenticated'](),controller[_0x6fde('0xb')]);router[_0x6fde('0x6')]('/:id/subjects',auth[_0x6fde('0x7')](),controller['getSubjects']);router[_0x6fde('0x6')](_0x6fde('0xc'),auth[_0x6fde('0x7')](),controller[_0x6fde('0xd')]);router[_0x6fde('0xe')]('/',auth[_0x6fde('0x7')](),controller[_0x6fde('0xf')]);router[_0x6fde('0x10')](_0x6fde('0x9'),auth[_0x6fde('0x7')](),controller[_0x6fde('0x11')]);router[_0x6fde('0x12')](_0x6fde('0x9'),auth[_0x6fde('0x7')](),controller[_0x6fde('0x13')]);module[_0x6fde('0x14')]=router;
\ No newline at end of file
+var _0x593a=['/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/fields','getSubjects','/:id/descriptions','post','create'];(function(_0x6ca7f4,_0x51a5df){var _0x494fa6=function(_0x359532){while(--_0x359532){_0x6ca7f4['push'](_0x6ca7f4['shift']());}};_0x494fa6(++_0x51a5df);}(_0x593a,0x180));var _0xa593=function(_0xe07cb9,_0x1f0adc){_0xe07cb9=_0xe07cb9-0x0;var _0x50f528=_0x593a[_0xe07cb9];return _0x50f528;};'use strict';var multer=require(_0xa593('0x0'));var util=require(_0xa593('0x1'));var path=require('path');var timeout=require(_0xa593('0x2'));var express=require(_0xa593('0x3'));var router=express[_0xa593('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa593('0x5'));var config=require(_0xa593('0x6'));var controller=require('./intSugarcrmConfiguration.controller');router[_0xa593('0x7')]('/',auth[_0xa593('0x8')](),controller[_0xa593('0x9')]);router[_0xa593('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xa593('0xa')]);router[_0xa593('0x7')](_0xa593('0xb'),auth[_0xa593('0x8')](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xa593('0xc')]);router[_0xa593('0x7')](_0xa593('0xd'),auth[_0xa593('0x8')](),controller['getDescriptions']);router[_0xa593('0xe')]('/',auth[_0xa593('0x8')](),controller[_0xa593('0xf')]);router['put'](_0xa593('0x10'),auth[_0xa593('0x8')](),controller['update']);router[_0xa593('0x11')](_0xa593('0x10'),auth[_0xa593('0x8')](),controller[_0xa593('0x12')]);module[_0xa593('0x13')]=router;
\ No newline at end of file
index b00c5d4..4436d1b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4678=['sequelize','exports','STRING'];(function(_0xfe69e2,_0x487c34){var _0x22f244=function(_0x54565f){while(--_0x54565f){_0xfe69e2['push'](_0xfe69e2['shift']());}};_0x22f244(++_0x487c34);}(_0x4678,0x96));var _0x8467=function(_0x4417ba,_0x377056){_0x4417ba=_0x4417ba-0x0;var _0x403f76=_0x4678[_0x4417ba];return _0x403f76;};'use strict';var Sequelize=require(_0x8467('0x0'));module[_0x8467('0x1')]={'name':{'type':Sequelize[_0x8467('0x2')]},'description':{'type':Sequelize[_0x8467('0x2')]}};
\ No newline at end of file
+var _0x1d2d=['STRING','sequelize','exports'];(function(_0x347289,_0x23f6fe){var _0x4fa4d4=function(_0x33f93d){while(--_0x33f93d){_0x347289['push'](_0x347289['shift']());}};_0x4fa4d4(++_0x23f6fe);}(_0x1d2d,0xeb));var _0xd1d2=function(_0x1d9a5b,_0x287c19){_0x1d9a5b=_0x1d9a5b-0x0;var _0x5e5598=_0x1d2d[_0x1d9a5b];return _0x5e5598;};'use strict';var Sequelize=require(_0xd1d2('0x0'));module[_0xd1d2('0x1')]={'name':{'type':Sequelize[_0xd1d2('0x2')]},'description':{'type':Sequelize[_0xd1d2('0x2')]}};
\ No newline at end of file
index 9127a72..d466aff 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf743=['../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','index','SugarcrmConfiguration','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','map','type','key','VIRTUAL','field','filter','options','include','findAll','rows','show','params','create','body','find','getFields','findOne','order','getSubjects','SugarcrmField','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xf743,0x1ba));var _0x3f74=function(_0x131604,_0x475a68){_0x131604=_0x131604-0x0;var _0x4a2aea=_0xf743[_0x131604];return _0x4a2aea;};'use strict';var pdf=require(_0x3f74('0x0'));var emlformat=require(_0x3f74('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3f74('0x2'));var jsonpatch=require(_0x3f74('0x3'));var rp=require(_0x3f74('0x4'));var moment=require('moment');var BPromise=require(_0x3f74('0x5'));var Mustache=require(_0x3f74('0x6'));var util=require(_0x3f74('0x7'));var path=require(_0x3f74('0x8'));var sox=require(_0x3f74('0x9'));var csv=require(_0x3f74('0xa'));var ejs=require(_0x3f74('0xb'));var fs=require('fs');var _=require(_0x3f74('0xc'));var squel=require(_0x3f74('0xd'));var crypto=require(_0x3f74('0xe'));var jsforce=require(_0x3f74('0xf'));var deskjs=require(_0x3f74('0x10'));var toCsv=require(_0x3f74('0xa'));var querystring=require(_0x3f74('0x11'));var Papa=require(_0x3f74('0x12'));var authService=require(_0x3f74('0x13'));var hardwareService=require(_0x3f74('0x14'));var Redis=require('ioredis');var qs=require(_0x3f74('0x15'));var logger=require(_0x3f74('0x16'))('api');var utils=require(_0x3f74('0x17'));var config=require(_0x3f74('0x18'));var db=require(_0x3f74('0x19'))['db'];var jayson=require(_0x3f74('0x1a'));var client=jayson['client'][_0x3f74('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x32936b,_0x54fc95,_0x4045b6,_0xcd6af1){return new BPromise(function(_0x3f83ae,_0x221681){var _0xdf1cc3=_0xcd6af1||client;return _0xdf1cc3[_0x3f74('0x1c')](_0x32936b,_0x4045b6)[_0x3f74('0x1d')](function(_0xb5bc73){logger[_0x3f74('0x1e')](_0x3f74('0x1f'),_0x54fc95,_0x3f74('0x20'));logger['debug'](_0x3f74('0x21'),_0x54fc95,_0x3f74('0x20'),JSON[_0x3f74('0x22')](_0xb5bc73));if(_0xb5bc73[_0x3f74('0x23')]){if(_0xb5bc73[_0x3f74('0x23')][_0x3f74('0x24')]===0x1f4){logger[_0x3f74('0x23')](_0x3f74('0x1f'),_0x54fc95,_0xb5bc73['error'][_0x3f74('0x25')]);return _0x221681(_0xb5bc73[_0x3f74('0x23')][_0x3f74('0x25')]);}logger[_0x3f74('0x23')](_0x3f74('0x1f'),_0x54fc95,_0xb5bc73[_0x3f74('0x23')][_0x3f74('0x25')]);return _0x3f83ae(_0xb5bc73[_0x3f74('0x23')]['message']);}else{logger['info'](_0x3f74('0x1f'),_0x54fc95,_0x3f74('0x20'));_0x3f83ae(_0xb5bc73[_0x3f74('0x26')]['message']);}})[_0x3f74('0x27')](function(_0x57cad3){logger[_0x3f74('0x23')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x54fc95,_0x57cad3);_0x221681(_0x57cad3);});});}function respondWithStatusCode(_0x2107f6,_0xc41d3d){_0xc41d3d=_0xc41d3d||0xcc;return function(_0x240de1){if(_0x240de1){return _0x2107f6[_0x3f74('0x28')](_0xc41d3d);}return _0x2107f6[_0x3f74('0x29')](_0xc41d3d)[_0x3f74('0x2a')]();};}function respondWithResult(_0x34d5fb,_0x27eeb3){_0x27eeb3=_0x27eeb3||0xc8;return function(_0x3b9e7a){if(_0x3b9e7a){return _0x34d5fb['status'](_0x27eeb3)[_0x3f74('0x2b')](_0x3b9e7a);}};}function respondWithFilteredResult(_0x3fa647,_0x3bea86){return function(_0x108114){if(_0x108114){var _0x391f86=_0x108114[_0x3f74('0x2c')],_0x2b9301=_0x3bea86[_0x3f74('0x2d')],_0x5cb597=_0x3bea86[_0x3f74('0x2d')]+_0x3bea86[_0x3f74('0x2e')],_0x16af69;if(_0x5cb597>=_0x391f86){_0x5cb597=_0x391f86;_0x16af69=0xc8;}else{_0x16af69=0xce;}_0x3fa647[_0x3f74('0x29')](_0x16af69);return _0x3fa647[_0x3f74('0x2f')](_0x3f74('0x30'),_0x2b9301+'-'+_0x5cb597+'/'+_0x391f86)['json'](_0x108114);}return null;};}function patchUpdates(_0x569e59){return function(_0x3c03de){try{jsonpatch[_0x3f74('0x31')](_0x3c03de,_0x569e59,!![]);}catch(_0x1ef1f2){return BPromise['reject'](_0x1ef1f2);}return _0x3c03de[_0x3f74('0x32')]();};}function saveUpdates(_0x585e7c,_0x59f5bc){return function(_0x9bc87f){if(_0x9bc87f){return _0x9bc87f[_0x3f74('0x33')](_0x585e7c)[_0x3f74('0x1d')](function(_0x2c759f){return _0x2c759f;});}return null;};}function removeEntity(_0x1a281a,_0x4bdc7f){return function(_0x41c45c){if(_0x41c45c){return _0x41c45c[_0x3f74('0x34')]()[_0x3f74('0x1d')](function(){_0x1a281a[_0x3f74('0x29')](0xcc)[_0x3f74('0x2a')]();});}};}function handleEntityNotFound(_0x576a60,_0x39a1c0){return function(_0x1373ff){if(!_0x1373ff){_0x576a60[_0x3f74('0x28')](0x194);}return _0x1373ff;};}function handleError(_0x55140c,_0x5cb8f6){_0x5cb8f6=_0x5cb8f6||0x1f4;return function(_0x385221){logger[_0x3f74('0x23')](_0x385221[_0x3f74('0x35')]);if(_0x385221[_0x3f74('0x36')]){delete _0x385221[_0x3f74('0x36')];}_0x55140c[_0x3f74('0x29')](_0x5cb8f6)['send'](_0x385221);};}exports[_0x3f74('0x37')]=function(_0x1438f6,_0x46b5c5){var _0x4f160a={},_0x563b1b={},_0x57f1c2={'count':0x0,'rows':[]};var _0x1d3c93=db[_0x3f74('0x38')][_0x3f74('0x39')];_0x563b1b[_0x3f74('0x3a')]=_[_0x3f74('0x3b')](_0x1d3c93);_0x563b1b[_0x3f74('0x3c')]=_[_0x3f74('0x3b')](_0x1438f6['query']);_0x563b1b[_0x3f74('0x3d')]=_[_0x3f74('0x3e')](_0x563b1b[_0x3f74('0x3a')],_0x563b1b[_0x3f74('0x3c')]);_0x4f160a[_0x3f74('0x3f')]=_['intersection'](_0x563b1b['model'],qs[_0x3f74('0x40')](_0x1438f6[_0x3f74('0x3c')]['fields']));_0x4f160a[_0x3f74('0x3f')]=_0x4f160a[_0x3f74('0x3f')][_0x3f74('0x41')]?_0x4f160a['attributes']:_0x563b1b['model'];if(!_0x1438f6[_0x3f74('0x3c')][_0x3f74('0x42')](_0x3f74('0x43'))){_0x4f160a[_0x3f74('0x2e')]=qs[_0x3f74('0x2e')](_0x1438f6[_0x3f74('0x3c')][_0x3f74('0x2e')]);_0x4f160a[_0x3f74('0x2d')]=qs['offset'](_0x1438f6[_0x3f74('0x3c')][_0x3f74('0x2d')]);}_0x4f160a['order']=qs[_0x3f74('0x44')](_0x1438f6[_0x3f74('0x3c')][_0x3f74('0x44')]);_0x4f160a[_0x3f74('0x45')]=qs[_0x3f74('0x3d')](_[_0x3f74('0x46')](_0x1438f6[_0x3f74('0x3c')],_0x563b1b[_0x3f74('0x3d')]));if(_0x1438f6[_0x3f74('0x3c')]['filter']){_0x4f160a[_0x3f74('0x45')]=_[_0x3f74('0x47')](_0x4f160a[_0x3f74('0x45')],{'$or':_[_0x3f74('0x48')](_0x1d3c93,function(_0xb34342){if(_0xb34342[_0x3f74('0x49')][_0x3f74('0x4a')]!==_0x3f74('0x4b')){var _0x481856={};_0x481856[_0xb34342[_0x3f74('0x4c')]]={'$like':'%'+_0x1438f6[_0x3f74('0x3c')][_0x3f74('0x4d')]+'%'};return _0x481856;}})});}_0x4f160a=_['merge']({},_0x4f160a,_0x1438f6[_0x3f74('0x4e')]);var _0x5e40cf={'where':_0x4f160a[_0x3f74('0x45')]};return db[_0x3f74('0x38')][_0x3f74('0x2c')](_0x5e40cf)['then'](function(_0x5ac01c){_0x57f1c2['count']=_0x5ac01c;if(_0x1438f6[_0x3f74('0x3c')]['includeAll']){_0x4f160a[_0x3f74('0x4f')]=[{'all':!![]}];}return db[_0x3f74('0x38')][_0x3f74('0x50')](_0x4f160a);})[_0x3f74('0x1d')](function(_0x20f28c){_0x57f1c2[_0x3f74('0x51')]=_0x20f28c;return _0x57f1c2;})[_0x3f74('0x1d')](respondWithFilteredResult(_0x46b5c5,_0x4f160a))[_0x3f74('0x27')](handleError(_0x46b5c5,null));};exports[_0x3f74('0x52')]=function(_0x28fb99,_0x11f0d4){var _0x207471={'raw':![],'where':{'id':_0x28fb99[_0x3f74('0x53')]['id']}},_0x42fe49={};_0x42fe49['model']=_[_0x3f74('0x3b')](db['SugarcrmConfiguration'][_0x3f74('0x39')]);_0x42fe49[_0x3f74('0x3c')]=_['keys'](_0x28fb99[_0x3f74('0x3c')]);_0x42fe49['filters']=_[_0x3f74('0x3e')](_0x42fe49[_0x3f74('0x3a')],_0x42fe49[_0x3f74('0x3c')]);_0x207471[_0x3f74('0x3f')]=_['intersection'](_0x42fe49[_0x3f74('0x3a')],qs[_0x3f74('0x40')](_0x28fb99[_0x3f74('0x3c')][_0x3f74('0x40')]));_0x207471[_0x3f74('0x3f')]=_0x207471[_0x3f74('0x3f')][_0x3f74('0x41')]?_0x207471[_0x3f74('0x3f')]:_0x42fe49[_0x3f74('0x3a')];if(_0x28fb99[_0x3f74('0x3c')]['includeAll']){_0x207471[_0x3f74('0x4f')]=[{'all':!![]}];}_0x207471=_[_0x3f74('0x47')]({},_0x207471,_0x28fb99['options']);return db[_0x3f74('0x38')]['find'](_0x207471)[_0x3f74('0x1d')](handleEntityNotFound(_0x11f0d4,null))[_0x3f74('0x1d')](respondWithResult(_0x11f0d4,null))['catch'](handleError(_0x11f0d4,null));};exports[_0x3f74('0x54')]=function(_0x453b87,_0x11d9b9){return db['SugarcrmConfiguration'][_0x3f74('0x54')](_0x453b87[_0x3f74('0x55')],{})[_0x3f74('0x1d')](respondWithResult(_0x11d9b9,0xc9))[_0x3f74('0x27')](handleError(_0x11d9b9,null));};exports['update']=function(_0x4de2f7,_0x171440){if(_0x4de2f7[_0x3f74('0x55')]['id']){delete _0x4de2f7['body']['id'];}return db['SugarcrmConfiguration'][_0x3f74('0x56')]({'where':{'id':_0x4de2f7['params']['id']}})['then'](handleEntityNotFound(_0x171440,null))[_0x3f74('0x1d')](saveUpdates(_0x4de2f7['body'],null))[_0x3f74('0x1d')](respondWithResult(_0x171440,null))[_0x3f74('0x27')](handleError(_0x171440,null));};exports[_0x3f74('0x34')]=function(_0xe9a635,_0x367777){return db[_0x3f74('0x38')][_0x3f74('0x56')]({'where':{'id':_0xe9a635[_0x3f74('0x53')]['id']}})[_0x3f74('0x1d')](handleEntityNotFound(_0x367777,null))['then'](removeEntity(_0x367777,null))[_0x3f74('0x27')](handleError(_0x367777,null));};exports[_0x3f74('0x57')]=function(_0x4d1870,_0x186fa5,_0x3d9bdb){var _0x1a23fa={};var _0x17f2fa={};var _0x55a977;var _0x3d62cc;return db[_0x3f74('0x38')][_0x3f74('0x58')]({'where':{'id':_0x4d1870['params']['id']}})[_0x3f74('0x1d')](handleEntityNotFound(_0x186fa5,null))[_0x3f74('0x1d')](function(_0x16a1ea){if(_0x16a1ea){_0x55a977=_0x16a1ea;_0x17f2fa[_0x3f74('0x3a')]=_['keys'](db['SugarcrmField']['rawAttributes']);_0x17f2fa[_0x3f74('0x3c')]=_['keys'](_0x4d1870[_0x3f74('0x3c')]);_0x17f2fa[_0x3f74('0x3d')]=_['intersection'](_0x17f2fa[_0x3f74('0x3a')],_0x17f2fa[_0x3f74('0x3c')]);_0x1a23fa['attributes']=_[_0x3f74('0x3e')](_0x17f2fa[_0x3f74('0x3a')],qs[_0x3f74('0x40')](_0x4d1870['query']['fields']));_0x1a23fa[_0x3f74('0x3f')]=_0x1a23fa['attributes'][_0x3f74('0x41')]?_0x1a23fa[_0x3f74('0x3f')]:_0x17f2fa[_0x3f74('0x3a')];_0x1a23fa[_0x3f74('0x59')]=qs[_0x3f74('0x44')](_0x4d1870['query'][_0x3f74('0x44')]);_0x1a23fa[_0x3f74('0x45')]=qs[_0x3f74('0x3d')](_[_0x3f74('0x46')](_0x4d1870[_0x3f74('0x3c')],_0x17f2fa['filters']));if(_0x4d1870['query'][_0x3f74('0x4d')]){_0x1a23fa['where']=_[_0x3f74('0x47')](_0x1a23fa[_0x3f74('0x45')],{'$or':_[_0x3f74('0x48')](_0x1a23fa[_0x3f74('0x3f')],function(_0x2fb07a){var _0xb6d35a={};_0xb6d35a[_0x2fb07a]={'$like':'%'+_0x4d1870[_0x3f74('0x3c')][_0x3f74('0x4d')]+'%'};return _0xb6d35a;})});}_0x1a23fa=_['merge']({},_0x1a23fa,_0x4d1870[_0x3f74('0x4e')]);return _0x55a977[_0x3f74('0x57')](_0x1a23fa);}})[_0x3f74('0x1d')](function(_0x299339){if(_0x299339){_0x3d62cc=_0x299339[_0x3f74('0x41')];if(!_0x4d1870['query'][_0x3f74('0x42')]('nolimit')){_0x1a23fa[_0x3f74('0x2e')]=qs[_0x3f74('0x2e')](_0x4d1870[_0x3f74('0x3c')][_0x3f74('0x2e')]);_0x1a23fa[_0x3f74('0x2d')]=qs[_0x3f74('0x2d')](_0x4d1870[_0x3f74('0x3c')][_0x3f74('0x2d')]);}return _0x55a977['getFields'](_0x1a23fa);}})[_0x3f74('0x1d')](function(_0x166a4b){if(_0x166a4b){return _0x166a4b?{'count':_0x3d62cc,'rows':_0x166a4b}:null;}})[_0x3f74('0x1d')](respondWithResult(_0x186fa5,null))['catch'](handleError(_0x186fa5,null));};exports[_0x3f74('0x5a')]=function(_0x637e8b,_0x490f1d,_0x103633){var _0xcadd8c={};var _0x1e902d={};var _0x517c28;var _0x165497;return db[_0x3f74('0x38')]['findOne']({'where':{'id':_0x637e8b['params']['id']}})['then'](handleEntityNotFound(_0x490f1d,null))['then'](function(_0x4f8eaf){if(_0x4f8eaf){_0x517c28=_0x4f8eaf;_0x1e902d[_0x3f74('0x3a')]=_[_0x3f74('0x3b')](db[_0x3f74('0x5b')][_0x3f74('0x39')]);_0x1e902d[_0x3f74('0x3c')]=_[_0x3f74('0x3b')](_0x637e8b['query']);_0x1e902d['filters']=_[_0x3f74('0x3e')](_0x1e902d[_0x3f74('0x3a')],_0x1e902d[_0x3f74('0x3c')]);_0xcadd8c[_0x3f74('0x3f')]=_[_0x3f74('0x3e')](_0x1e902d[_0x3f74('0x3a')],qs['fields'](_0x637e8b[_0x3f74('0x3c')][_0x3f74('0x40')]));_0xcadd8c[_0x3f74('0x3f')]=_0xcadd8c[_0x3f74('0x3f')]['length']?_0xcadd8c[_0x3f74('0x3f')]:_0x1e902d[_0x3f74('0x3a')];_0xcadd8c[_0x3f74('0x59')]=qs['sort'](_0x637e8b['query'][_0x3f74('0x44')]);_0xcadd8c[_0x3f74('0x45')]=qs[_0x3f74('0x3d')](_[_0x3f74('0x46')](_0x637e8b[_0x3f74('0x3c')],_0x1e902d[_0x3f74('0x3d')]));if(_0x637e8b[_0x3f74('0x3c')]['filter']){_0xcadd8c[_0x3f74('0x45')]=_[_0x3f74('0x47')](_0xcadd8c['where'],{'$or':_[_0x3f74('0x48')](_0xcadd8c[_0x3f74('0x3f')],function(_0xcd5035){var _0x46fa41={};_0x46fa41[_0xcd5035]={'$like':'%'+_0x637e8b[_0x3f74('0x3c')][_0x3f74('0x4d')]+'%'};return _0x46fa41;})});}_0xcadd8c=_['merge']({},_0xcadd8c,_0x637e8b[_0x3f74('0x4e')]);return _0x517c28[_0x3f74('0x5a')](_0xcadd8c);}})[_0x3f74('0x1d')](function(_0x2da1b0){if(_0x2da1b0){_0x165497=_0x2da1b0[_0x3f74('0x41')];if(!_0x637e8b[_0x3f74('0x3c')]['hasOwnProperty'](_0x3f74('0x43'))){_0xcadd8c[_0x3f74('0x2e')]=qs['limit'](_0x637e8b[_0x3f74('0x3c')][_0x3f74('0x2e')]);_0xcadd8c[_0x3f74('0x2d')]=qs[_0x3f74('0x2d')](_0x637e8b['query'][_0x3f74('0x2d')]);}return _0x517c28[_0x3f74('0x5a')](_0xcadd8c);}})[_0x3f74('0x1d')](function(_0x395507){if(_0x395507){return _0x395507?{'count':_0x165497,'rows':_0x395507}:null;}})[_0x3f74('0x1d')](respondWithResult(_0x490f1d,null))[_0x3f74('0x27')](handleError(_0x490f1d,null));};exports[_0x3f74('0x5c')]=function(_0x3c4135,_0xf90646,_0x1ff437){var _0xdd156a={};var _0x5d815c={};var _0x4b5fc7;var _0x2c20a5;return db[_0x3f74('0x38')][_0x3f74('0x58')]({'where':{'id':_0x3c4135[_0x3f74('0x53')]['id']}})[_0x3f74('0x1d')](handleEntityNotFound(_0xf90646,null))[_0x3f74('0x1d')](function(_0x25f241){if(_0x25f241){_0x4b5fc7=_0x25f241;_0x5d815c['model']=_['keys'](db[_0x3f74('0x5b')]['rawAttributes']);_0x5d815c['query']=_[_0x3f74('0x3b')](_0x3c4135['query']);_0x5d815c[_0x3f74('0x3d')]=_[_0x3f74('0x3e')](_0x5d815c[_0x3f74('0x3a')],_0x5d815c[_0x3f74('0x3c')]);_0xdd156a[_0x3f74('0x3f')]=_[_0x3f74('0x3e')](_0x5d815c[_0x3f74('0x3a')],qs['fields'](_0x3c4135[_0x3f74('0x3c')][_0x3f74('0x40')]));_0xdd156a['attributes']=_0xdd156a[_0x3f74('0x3f')][_0x3f74('0x41')]?_0xdd156a[_0x3f74('0x3f')]:_0x5d815c[_0x3f74('0x3a')];_0xdd156a[_0x3f74('0x59')]=qs[_0x3f74('0x44')](_0x3c4135[_0x3f74('0x3c')][_0x3f74('0x44')]);_0xdd156a[_0x3f74('0x45')]=qs['filters'](_[_0x3f74('0x46')](_0x3c4135[_0x3f74('0x3c')],_0x5d815c[_0x3f74('0x3d')]));if(_0x3c4135['query'][_0x3f74('0x4d')]){_0xdd156a['where']=_[_0x3f74('0x47')](_0xdd156a['where'],{'$or':_[_0x3f74('0x48')](_0xdd156a['attributes'],function(_0x3370d0){var _0x25b832={};_0x25b832[_0x3370d0]={'$like':'%'+_0x3c4135[_0x3f74('0x3c')][_0x3f74('0x4d')]+'%'};return _0x25b832;})});}_0xdd156a=_[_0x3f74('0x47')]({},_0xdd156a,_0x3c4135[_0x3f74('0x4e')]);return _0x4b5fc7[_0x3f74('0x5c')](_0xdd156a);}})['then'](function(_0x31859d){if(_0x31859d){_0x2c20a5=_0x31859d[_0x3f74('0x41')];if(!_0x3c4135[_0x3f74('0x3c')][_0x3f74('0x42')](_0x3f74('0x43'))){_0xdd156a[_0x3f74('0x2e')]=qs['limit'](_0x3c4135[_0x3f74('0x3c')]['limit']);_0xdd156a[_0x3f74('0x2d')]=qs[_0x3f74('0x2d')](_0x3c4135[_0x3f74('0x3c')][_0x3f74('0x2d')]);}return _0x4b5fc7[_0x3f74('0x5c')](_0xdd156a);}})[_0x3f74('0x1d')](function(_0x32953b){if(_0x32953b){return _0x32953b?{'count':_0x2c20a5,'rows':_0x32953b}:null;}})['then'](respondWithResult(_0xf90646,null))['catch'](handleError(_0xf90646,null));};
\ No newline at end of file
+var _0x9c3e=['../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','send','index','SugarcrmConfiguration','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','where','pick','filter','key','field','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','SugarcrmField','sort','nolimit','findOne','map','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service'];(function(_0x274f8d,_0xfa90ca){var _0x5676c8=function(_0x1a4ee9){while(--_0x1a4ee9){_0x274f8d['push'](_0x274f8d['shift']());}};_0x5676c8(++_0xfa90ca);}(_0x9c3e,0x1be));var _0xe9c3=function(_0x3929ff,_0x701c99){_0x3929ff=_0x3929ff-0x0;var _0x44650a=_0x9c3e[_0x3929ff];return _0x44650a;};'use strict';var pdf=require(_0xe9c3('0x0'));var emlformat=require(_0xe9c3('0x1'));var rimraf=require(_0xe9c3('0x2'));var zipdir=require(_0xe9c3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe9c3('0x4'));var moment=require('moment');var BPromise=require(_0xe9c3('0x5'));var Mustache=require(_0xe9c3('0x6'));var util=require(_0xe9c3('0x7'));var path=require('path');var sox=require(_0xe9c3('0x8'));var csv=require('to-csv');var ejs=require(_0xe9c3('0x9'));var fs=require('fs');var _=require(_0xe9c3('0xa'));var squel=require(_0xe9c3('0xb'));var crypto=require(_0xe9c3('0xc'));var jsforce=require(_0xe9c3('0xd'));var deskjs=require(_0xe9c3('0xe'));var toCsv=require(_0xe9c3('0xf'));var querystring=require(_0xe9c3('0x10'));var Papa=require(_0xe9c3('0x11'));var authService=require(_0xe9c3('0x12'));var hardwareService=require(_0xe9c3('0x13'));var Redis=require(_0xe9c3('0x14'));var qs=require(_0xe9c3('0x15'));var logger=require(_0xe9c3('0x16'))(_0xe9c3('0x17'));var utils=require(_0xe9c3('0x18'));var config=require(_0xe9c3('0x19'));var db=require(_0xe9c3('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe9c3('0x1b')][_0xe9c3('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2c70da,_0x33f188,_0x8fabde,_0x16a76f){return new BPromise(function(_0x22196e,_0x1db7c7){var _0x3df3e8=_0x16a76f||client;return _0x3df3e8['request'](_0x2c70da,_0x8fabde)[_0xe9c3('0x1d')](function(_0x4f19e7){logger[_0xe9c3('0x1e')](_0xe9c3('0x1f'),_0x33f188,_0xe9c3('0x20'));logger[_0xe9c3('0x21')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x33f188,_0xe9c3('0x20'),JSON[_0xe9c3('0x22')](_0x4f19e7));if(_0x4f19e7[_0xe9c3('0x23')]){if(_0x4f19e7[_0xe9c3('0x23')][_0xe9c3('0x24')]===0x1f4){logger[_0xe9c3('0x23')](_0xe9c3('0x1f'),_0x33f188,_0x4f19e7[_0xe9c3('0x23')]['message']);return _0x1db7c7(_0x4f19e7[_0xe9c3('0x23')][_0xe9c3('0x25')]);}logger[_0xe9c3('0x23')](_0xe9c3('0x1f'),_0x33f188,_0x4f19e7[_0xe9c3('0x23')][_0xe9c3('0x25')]);return _0x22196e(_0x4f19e7[_0xe9c3('0x23')][_0xe9c3('0x25')]);}else{logger['info'](_0xe9c3('0x1f'),_0x33f188,_0xe9c3('0x20'));_0x22196e(_0x4f19e7[_0xe9c3('0x26')][_0xe9c3('0x25')]);}})['catch'](function(_0xcae302){logger[_0xe9c3('0x23')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x33f188,_0xcae302);_0x1db7c7(_0xcae302);});});}function respondWithStatusCode(_0x37df84,_0x203646){_0x203646=_0x203646||0xcc;return function(_0x437b2b){if(_0x437b2b){return _0x37df84['sendStatus'](_0x203646);}return _0x37df84[_0xe9c3('0x27')](_0x203646)[_0xe9c3('0x28')]();};}function respondWithResult(_0x6ff93e,_0x297402){_0x297402=_0x297402||0xc8;return function(_0x533e44){if(_0x533e44){return _0x6ff93e[_0xe9c3('0x27')](_0x297402)[_0xe9c3('0x29')](_0x533e44);}};}function respondWithFilteredResult(_0x129cb5,_0xb088c3){return function(_0x3d7665){if(_0x3d7665){var _0x325c51=_0x3d7665[_0xe9c3('0x2a')],_0x48b4d7=_0xb088c3[_0xe9c3('0x2b')],_0x534861=_0xb088c3[_0xe9c3('0x2b')]+_0xb088c3[_0xe9c3('0x2c')],_0x1f3890;if(_0x534861>=_0x325c51){_0x534861=_0x325c51;_0x1f3890=0xc8;}else{_0x1f3890=0xce;}_0x129cb5[_0xe9c3('0x27')](_0x1f3890);return _0x129cb5[_0xe9c3('0x2d')](_0xe9c3('0x2e'),_0x48b4d7+'-'+_0x534861+'/'+_0x325c51)[_0xe9c3('0x29')](_0x3d7665);}return null;};}function patchUpdates(_0x5e3b99){return function(_0x7e0c8d){try{jsonpatch[_0xe9c3('0x2f')](_0x7e0c8d,_0x5e3b99,!![]);}catch(_0x1d378d){return BPromise[_0xe9c3('0x30')](_0x1d378d);}return _0x7e0c8d['save']();};}function saveUpdates(_0x20dc09,_0x57ff8d){return function(_0x3d28a2){if(_0x3d28a2){return _0x3d28a2[_0xe9c3('0x31')](_0x20dc09)[_0xe9c3('0x1d')](function(_0x2baf58){return _0x2baf58;});}return null;};}function removeEntity(_0x30a8c4,_0x296987){return function(_0x429f81){if(_0x429f81){return _0x429f81[_0xe9c3('0x32')]()[_0xe9c3('0x1d')](function(){_0x30a8c4[_0xe9c3('0x27')](0xcc)[_0xe9c3('0x28')]();});}};}function handleEntityNotFound(_0x300b23,_0x1dc88f){return function(_0x4a197b){if(!_0x4a197b){_0x300b23[_0xe9c3('0x33')](0x194);}return _0x4a197b;};}function handleError(_0x318ed8,_0x21181e){_0x21181e=_0x21181e||0x1f4;return function(_0x478c29){logger['error'](_0x478c29[_0xe9c3('0x34')]);if(_0x478c29[_0xe9c3('0x35')]){delete _0x478c29[_0xe9c3('0x35')];}_0x318ed8['status'](_0x21181e)[_0xe9c3('0x36')](_0x478c29);};}exports[_0xe9c3('0x37')]=function(_0x23b4a8,_0x4bcec0){var _0x339aca={},_0x41a5cf={},_0x2d2b42={'count':0x0,'rows':[]};var _0x4bc700=db[_0xe9c3('0x38')][_0xe9c3('0x39')];_0x41a5cf[_0xe9c3('0x3a')]=_[_0xe9c3('0x3b')](_0x4bc700);_0x41a5cf[_0xe9c3('0x3c')]=_['keys'](_0x23b4a8['query']);_0x41a5cf[_0xe9c3('0x3d')]=_['intersection'](_0x41a5cf['model'],_0x41a5cf[_0xe9c3('0x3c')]);_0x339aca[_0xe9c3('0x3e')]=_[_0xe9c3('0x3f')](_0x41a5cf[_0xe9c3('0x3a')],qs[_0xe9c3('0x40')](_0x23b4a8[_0xe9c3('0x3c')][_0xe9c3('0x40')]));_0x339aca[_0xe9c3('0x3e')]=_0x339aca[_0xe9c3('0x3e')][_0xe9c3('0x41')]?_0x339aca[_0xe9c3('0x3e')]:_0x41a5cf[_0xe9c3('0x3a')];if(!_0x23b4a8[_0xe9c3('0x3c')][_0xe9c3('0x42')]('nolimit')){_0x339aca[_0xe9c3('0x2c')]=qs['limit'](_0x23b4a8[_0xe9c3('0x3c')]['limit']);_0x339aca[_0xe9c3('0x2b')]=qs['offset'](_0x23b4a8[_0xe9c3('0x3c')][_0xe9c3('0x2b')]);}_0x339aca[_0xe9c3('0x43')]=qs['sort'](_0x23b4a8[_0xe9c3('0x3c')]['sort']);_0x339aca[_0xe9c3('0x44')]=qs['filters'](_[_0xe9c3('0x45')](_0x23b4a8[_0xe9c3('0x3c')],_0x41a5cf[_0xe9c3('0x3d')]));if(_0x23b4a8['query'][_0xe9c3('0x46')]){_0x339aca[_0xe9c3('0x44')]=_['merge'](_0x339aca['where'],{'$or':_['map'](_0x4bc700,function(_0x5cc038){if(_0x5cc038['type'][_0xe9c3('0x47')]!=='VIRTUAL'){var _0x2bc80a={};_0x2bc80a[_0x5cc038[_0xe9c3('0x48')]]={'$like':'%'+_0x23b4a8['query'][_0xe9c3('0x46')]+'%'};return _0x2bc80a;}})});}_0x339aca=_[_0xe9c3('0x49')]({},_0x339aca,_0x23b4a8[_0xe9c3('0x4a')]);var _0x228324={'where':_0x339aca['where']};return db[_0xe9c3('0x38')][_0xe9c3('0x2a')](_0x228324)[_0xe9c3('0x1d')](function(_0x465870){_0x2d2b42[_0xe9c3('0x2a')]=_0x465870;if(_0x23b4a8[_0xe9c3('0x3c')][_0xe9c3('0x4b')]){_0x339aca[_0xe9c3('0x4c')]=[{'all':!![]}];}return db[_0xe9c3('0x38')][_0xe9c3('0x4d')](_0x339aca);})[_0xe9c3('0x1d')](function(_0x3d8cd0){_0x2d2b42[_0xe9c3('0x4e')]=_0x3d8cd0;return _0x2d2b42;})['then'](respondWithFilteredResult(_0x4bcec0,_0x339aca))[_0xe9c3('0x4f')](handleError(_0x4bcec0,null));};exports[_0xe9c3('0x50')]=function(_0xc35c44,_0x180bca){var _0x57470b={'raw':![],'where':{'id':_0xc35c44[_0xe9c3('0x51')]['id']}},_0x4a113c={};_0x4a113c[_0xe9c3('0x3a')]=_['keys'](db[_0xe9c3('0x38')][_0xe9c3('0x39')]);_0x4a113c[_0xe9c3('0x3c')]=_[_0xe9c3('0x3b')](_0xc35c44[_0xe9c3('0x3c')]);_0x4a113c['filters']=_[_0xe9c3('0x3f')](_0x4a113c[_0xe9c3('0x3a')],_0x4a113c[_0xe9c3('0x3c')]);_0x57470b['attributes']=_[_0xe9c3('0x3f')](_0x4a113c[_0xe9c3('0x3a')],qs[_0xe9c3('0x40')](_0xc35c44['query'][_0xe9c3('0x40')]));_0x57470b['attributes']=_0x57470b[_0xe9c3('0x3e')]['length']?_0x57470b[_0xe9c3('0x3e')]:_0x4a113c['model'];if(_0xc35c44['query'][_0xe9c3('0x4b')]){_0x57470b['include']=[{'all':!![]}];}_0x57470b=_[_0xe9c3('0x49')]({},_0x57470b,_0xc35c44[_0xe9c3('0x4a')]);return db['SugarcrmConfiguration'][_0xe9c3('0x52')](_0x57470b)[_0xe9c3('0x1d')](handleEntityNotFound(_0x180bca,null))['then'](respondWithResult(_0x180bca,null))[_0xe9c3('0x4f')](handleError(_0x180bca,null));};exports[_0xe9c3('0x53')]=function(_0x59705f,_0x59061d){return db[_0xe9c3('0x38')]['create'](_0x59705f[_0xe9c3('0x54')],{})[_0xe9c3('0x1d')](respondWithResult(_0x59061d,0xc9))[_0xe9c3('0x4f')](handleError(_0x59061d,null));};exports[_0xe9c3('0x31')]=function(_0x497dcd,_0x3835bf){if(_0x497dcd[_0xe9c3('0x54')]['id']){delete _0x497dcd[_0xe9c3('0x54')]['id'];}return db[_0xe9c3('0x38')][_0xe9c3('0x52')]({'where':{'id':_0x497dcd[_0xe9c3('0x51')]['id']}})[_0xe9c3('0x1d')](handleEntityNotFound(_0x3835bf,null))['then'](saveUpdates(_0x497dcd[_0xe9c3('0x54')],null))[_0xe9c3('0x1d')](respondWithResult(_0x3835bf,null))['catch'](handleError(_0x3835bf,null));};exports[_0xe9c3('0x32')]=function(_0x86be18,_0x1291b5){return db[_0xe9c3('0x38')][_0xe9c3('0x52')]({'where':{'id':_0x86be18[_0xe9c3('0x51')]['id']}})['then'](handleEntityNotFound(_0x1291b5,null))['then'](removeEntity(_0x1291b5,null))[_0xe9c3('0x4f')](handleError(_0x1291b5,null));};exports[_0xe9c3('0x55')]=function(_0x1a2aa6,_0xc12058,_0x203970){var _0x115007={};var _0x34988c={};var _0x3f4b6d;var _0x44aea8;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x1a2aa6[_0xe9c3('0x51')]['id']}})['then'](handleEntityNotFound(_0xc12058,null))['then'](function(_0x2750ec){if(_0x2750ec){_0x3f4b6d=_0x2750ec;_0x34988c[_0xe9c3('0x3a')]=_['keys'](db[_0xe9c3('0x56')]['rawAttributes']);_0x34988c['query']=_['keys'](_0x1a2aa6[_0xe9c3('0x3c')]);_0x34988c[_0xe9c3('0x3d')]=_[_0xe9c3('0x3f')](_0x34988c[_0xe9c3('0x3a')],_0x34988c['query']);_0x115007[_0xe9c3('0x3e')]=_['intersection'](_0x34988c[_0xe9c3('0x3a')],qs[_0xe9c3('0x40')](_0x1a2aa6[_0xe9c3('0x3c')]['fields']));_0x115007[_0xe9c3('0x3e')]=_0x115007[_0xe9c3('0x3e')]['length']?_0x115007[_0xe9c3('0x3e')]:_0x34988c['model'];_0x115007[_0xe9c3('0x43')]=qs[_0xe9c3('0x57')](_0x1a2aa6[_0xe9c3('0x3c')]['sort']);_0x115007[_0xe9c3('0x44')]=qs[_0xe9c3('0x3d')](_[_0xe9c3('0x45')](_0x1a2aa6['query'],_0x34988c[_0xe9c3('0x3d')]));if(_0x1a2aa6['query'][_0xe9c3('0x46')]){_0x115007[_0xe9c3('0x44')]=_['merge'](_0x115007['where'],{'$or':_['map'](_0x115007[_0xe9c3('0x3e')],function(_0x4d3e4d){var _0x23904c={};_0x23904c[_0x4d3e4d]={'$like':'%'+_0x1a2aa6[_0xe9c3('0x3c')]['filter']+'%'};return _0x23904c;})});}_0x115007=_[_0xe9c3('0x49')]({},_0x115007,_0x1a2aa6['options']);return _0x3f4b6d[_0xe9c3('0x55')](_0x115007);}})[_0xe9c3('0x1d')](function(_0x14f1e1){if(_0x14f1e1){_0x44aea8=_0x14f1e1['length'];if(!_0x1a2aa6[_0xe9c3('0x3c')][_0xe9c3('0x42')](_0xe9c3('0x58'))){_0x115007[_0xe9c3('0x2c')]=qs[_0xe9c3('0x2c')](_0x1a2aa6['query'][_0xe9c3('0x2c')]);_0x115007[_0xe9c3('0x2b')]=qs['offset'](_0x1a2aa6[_0xe9c3('0x3c')][_0xe9c3('0x2b')]);}return _0x3f4b6d['getFields'](_0x115007);}})[_0xe9c3('0x1d')](function(_0x595d69){if(_0x595d69){return _0x595d69?{'count':_0x44aea8,'rows':_0x595d69}:null;}})['then'](respondWithResult(_0xc12058,null))[_0xe9c3('0x4f')](handleError(_0xc12058,null));};exports['getSubjects']=function(_0xadbba0,_0x41595a,_0x17cdb3){var _0x29b235={};var _0x357fe5={};var _0x34f43b;var _0x232e06;return db[_0xe9c3('0x38')][_0xe9c3('0x59')]({'where':{'id':_0xadbba0[_0xe9c3('0x51')]['id']}})[_0xe9c3('0x1d')](handleEntityNotFound(_0x41595a,null))['then'](function(_0x27dddb){if(_0x27dddb){_0x34f43b=_0x27dddb;_0x357fe5['model']=_['keys'](db[_0xe9c3('0x56')]['rawAttributes']);_0x357fe5[_0xe9c3('0x3c')]=_[_0xe9c3('0x3b')](_0xadbba0[_0xe9c3('0x3c')]);_0x357fe5[_0xe9c3('0x3d')]=_[_0xe9c3('0x3f')](_0x357fe5[_0xe9c3('0x3a')],_0x357fe5['query']);_0x29b235[_0xe9c3('0x3e')]=_[_0xe9c3('0x3f')](_0x357fe5[_0xe9c3('0x3a')],qs[_0xe9c3('0x40')](_0xadbba0[_0xe9c3('0x3c')][_0xe9c3('0x40')]));_0x29b235['attributes']=_0x29b235[_0xe9c3('0x3e')][_0xe9c3('0x41')]?_0x29b235[_0xe9c3('0x3e')]:_0x357fe5[_0xe9c3('0x3a')];_0x29b235[_0xe9c3('0x43')]=qs[_0xe9c3('0x57')](_0xadbba0[_0xe9c3('0x3c')][_0xe9c3('0x57')]);_0x29b235[_0xe9c3('0x44')]=qs[_0xe9c3('0x3d')](_['pick'](_0xadbba0['query'],_0x357fe5[_0xe9c3('0x3d')]));if(_0xadbba0[_0xe9c3('0x3c')][_0xe9c3('0x46')]){_0x29b235[_0xe9c3('0x44')]=_['merge'](_0x29b235[_0xe9c3('0x44')],{'$or':_[_0xe9c3('0x5a')](_0x29b235[_0xe9c3('0x3e')],function(_0x1175c9){var _0x452e7c={};_0x452e7c[_0x1175c9]={'$like':'%'+_0xadbba0[_0xe9c3('0x3c')][_0xe9c3('0x46')]+'%'};return _0x452e7c;})});}_0x29b235=_[_0xe9c3('0x49')]({},_0x29b235,_0xadbba0['options']);return _0x34f43b[_0xe9c3('0x5b')](_0x29b235);}})[_0xe9c3('0x1d')](function(_0xd224b){if(_0xd224b){_0x232e06=_0xd224b[_0xe9c3('0x41')];if(!_0xadbba0[_0xe9c3('0x3c')][_0xe9c3('0x42')](_0xe9c3('0x58'))){_0x29b235[_0xe9c3('0x2c')]=qs[_0xe9c3('0x2c')](_0xadbba0[_0xe9c3('0x3c')][_0xe9c3('0x2c')]);_0x29b235[_0xe9c3('0x2b')]=qs[_0xe9c3('0x2b')](_0xadbba0[_0xe9c3('0x3c')][_0xe9c3('0x2b')]);}return _0x34f43b[_0xe9c3('0x5b')](_0x29b235);}})[_0xe9c3('0x1d')](function(_0x442485){if(_0x442485){return _0x442485?{'count':_0x232e06,'rows':_0x442485}:null;}})[_0xe9c3('0x1d')](respondWithResult(_0x41595a,null))[_0xe9c3('0x4f')](handleError(_0x41595a,null));};exports[_0xe9c3('0x5c')]=function(_0x242d16,_0x2398eb,_0x210cba){var _0x2a95db={};var _0x5aac45={};var _0x159e9b;var _0x1942f7;return db[_0xe9c3('0x38')][_0xe9c3('0x59')]({'where':{'id':_0x242d16[_0xe9c3('0x51')]['id']}})[_0xe9c3('0x1d')](handleEntityNotFound(_0x2398eb,null))[_0xe9c3('0x1d')](function(_0xb81415){if(_0xb81415){_0x159e9b=_0xb81415;_0x5aac45['model']=_['keys'](db['SugarcrmField'][_0xe9c3('0x39')]);_0x5aac45[_0xe9c3('0x3c')]=_['keys'](_0x242d16[_0xe9c3('0x3c')]);_0x5aac45[_0xe9c3('0x3d')]=_[_0xe9c3('0x3f')](_0x5aac45[_0xe9c3('0x3a')],_0x5aac45[_0xe9c3('0x3c')]);_0x2a95db[_0xe9c3('0x3e')]=_['intersection'](_0x5aac45[_0xe9c3('0x3a')],qs['fields'](_0x242d16[_0xe9c3('0x3c')][_0xe9c3('0x40')]));_0x2a95db['attributes']=_0x2a95db[_0xe9c3('0x3e')]['length']?_0x2a95db[_0xe9c3('0x3e')]:_0x5aac45[_0xe9c3('0x3a')];_0x2a95db[_0xe9c3('0x43')]=qs[_0xe9c3('0x57')](_0x242d16[_0xe9c3('0x3c')][_0xe9c3('0x57')]);_0x2a95db['where']=qs[_0xe9c3('0x3d')](_[_0xe9c3('0x45')](_0x242d16[_0xe9c3('0x3c')],_0x5aac45[_0xe9c3('0x3d')]));if(_0x242d16[_0xe9c3('0x3c')][_0xe9c3('0x46')]){_0x2a95db[_0xe9c3('0x44')]=_[_0xe9c3('0x49')](_0x2a95db[_0xe9c3('0x44')],{'$or':_[_0xe9c3('0x5a')](_0x2a95db['attributes'],function(_0x19a3dc){var _0x5346bc={};_0x5346bc[_0x19a3dc]={'$like':'%'+_0x242d16['query']['filter']+'%'};return _0x5346bc;})});}_0x2a95db=_['merge']({},_0x2a95db,_0x242d16[_0xe9c3('0x4a')]);return _0x159e9b[_0xe9c3('0x5c')](_0x2a95db);}})[_0xe9c3('0x1d')](function(_0x5bdf42){if(_0x5bdf42){_0x1942f7=_0x5bdf42['length'];if(!_0x242d16[_0xe9c3('0x3c')][_0xe9c3('0x42')](_0xe9c3('0x58'))){_0x2a95db[_0xe9c3('0x2c')]=qs[_0xe9c3('0x2c')](_0x242d16[_0xe9c3('0x3c')][_0xe9c3('0x2c')]);_0x2a95db[_0xe9c3('0x2b')]=qs['offset'](_0x242d16['query'][_0xe9c3('0x2b')]);}return _0x159e9b['getDescriptions'](_0x2a95db);}})[_0xe9c3('0x1d')](function(_0x550fad){if(_0x550fad){return _0x550fad?{'count':_0x1942f7,'rows':_0x550fad}:null;}})['then'](respondWithResult(_0x2398eb,null))[_0xe9c3('0x4f')](handleError(_0x2398eb,null));};
\ No newline at end of file
index fc09455..625c7bf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3cc7=['util','../../config/logger','api','moment','request-promise','exports','define','SugarcrmConfiguration','lodash'];(function(_0x257495,_0x18269b){var _0x3849aa=function(_0x1ca94e){while(--_0x1ca94e){_0x257495['push'](_0x257495['shift']());}};_0x3849aa(++_0x18269b);}(_0x3cc7,0x11f));var _0x73cc=function(_0x2ddfd9,_0x5877d0){_0x2ddfd9=_0x2ddfd9-0x0;var _0x2668f0=_0x3cc7[_0x2ddfd9];return _0x2668f0;};'use strict';var _=require(_0x73cc('0x0'));var util=require(_0x73cc('0x1'));var logger=require(_0x73cc('0x2'))(_0x73cc('0x3'));var moment=require(_0x73cc('0x4'));var BPromise=require('bluebird');var rp=require(_0x73cc('0x5'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x73cc('0x6')]=function(_0x4d7784,_0x435e90){return _0x4d7784[_0x73cc('0x7')](_0x73cc('0x8'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xccc9=['../../config/logger','bluebird','./intSugarcrmConfiguration.attributes','exports','define','int_sugarcrm_configurations','lodash','util'];(function(_0x474770,_0x453c38){var _0x53a8ab=function(_0x2f3324){while(--_0x2f3324){_0x474770['push'](_0x474770['shift']());}};_0x53a8ab(++_0x453c38);}(_0xccc9,0x136));var _0x9ccc=function(_0x3c1618,_0x3d33da){_0x3c1618=_0x3c1618-0x0;var _0x557b61=_0xccc9[_0x3c1618];return _0x557b61;};'use strict';var _=require(_0x9ccc('0x0'));var util=require(_0x9ccc('0x1'));var logger=require(_0x9ccc('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9ccc('0x3'));var rp=require('request-promise');var attributes=require(_0x9ccc('0x4'));module[_0x9ccc('0x5')]=function(_0x3700bc,_0x2bb928){return _0x3700bc[_0x9ccc('0x6')]('SugarcrmConfiguration',attributes,{'tableName':_0x9ccc('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 976cce5..d6ef926 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x06ce=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x55cbb8,_0x3362d1){var _0x5d0e21=function(_0x847066){while(--_0x847066){_0x55cbb8['push'](_0x55cbb8['shift']());}};_0x5d0e21(++_0x3362d1);}(_0x06ce,0xa0));var _0xe06c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x06ce[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xe06c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe06c('0x1'));var rs=require(_0xe06c('0x2'));var fs=require('fs');var Redis=require(_0xe06c('0x3'));var db=require(_0xe06c('0x4'))['db'];var utils=require(_0xe06c('0x5'));var logger=require(_0xe06c('0x6'))(_0xe06c('0x7'));var config=require(_0xe06c('0x8'));var jayson=require(_0xe06c('0x9'));var client=jayson[_0xe06c('0xa')][_0xe06c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x907539,_0x180832,_0x3b4a67){return new BPromise(function(_0x587835,_0x1e3dbd){return client[_0xe06c('0xc')](_0x907539,_0x3b4a67)[_0xe06c('0xd')](function(_0xe8b40b){logger[_0xe06c('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x180832,_0xe06c('0xf'));logger[_0xe06c('0x10')](_0xe06c('0x11'),_0x180832,_0xe06c('0xf'),JSON[_0xe06c('0x12')](_0xe8b40b));if(_0xe8b40b[_0xe06c('0x13')]){if(_0xe8b40b[_0xe06c('0x13')][_0xe06c('0x14')]===0x1f4){logger[_0xe06c('0x13')](_0xe06c('0x15'),_0x180832,_0xe8b40b[_0xe06c('0x13')]['message']);return _0x1e3dbd(_0xe8b40b['error'][_0xe06c('0x16')]);}logger[_0xe06c('0x13')](_0xe06c('0x15'),_0x180832,_0xe8b40b[_0xe06c('0x13')]['message']);return _0x587835(_0xe8b40b[_0xe06c('0x13')][_0xe06c('0x16')]);}else{logger['info'](_0xe06c('0x15'),_0x180832,'request\x20sent');_0x587835(_0xe8b40b[_0xe06c('0x17')]['message']);}})['catch'](function(_0x3ea915){logger[_0xe06c('0x13')](_0xe06c('0x15'),_0x180832,_0x3ea915);_0x1e3dbd(_0x3ea915);});});}
\ No newline at end of file
+var _0x825e=['debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x825e,0x128));var _0xe825=function(_0x182c57,_0x23abcb){_0x182c57=_0x182c57-0x0;var _0x3b149d=_0x825e[_0x182c57];return _0x3b149d;};'use strict';var _=require(_0xe825('0x0'));var util=require(_0xe825('0x1'));var moment=require(_0xe825('0x2'));var BPromise=require(_0xe825('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe825('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe825('0x5'))(_0xe825('0x6'));var config=require(_0xe825('0x7'));var jayson=require(_0xe825('0x8'));var client=jayson[_0xe825('0x9')][_0xe825('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c2f34,_0x4aa852,_0xaa3e35){return new BPromise(function(_0x1a3bb7,_0x357611){return client[_0xe825('0xb')](_0x3c2f34,_0xaa3e35)[_0xe825('0xc')](function(_0x13ea1d){logger[_0xe825('0xd')](_0xe825('0xe'),_0x4aa852,_0xe825('0xf'));logger[_0xe825('0x10')](_0xe825('0x11'),_0x4aa852,_0xe825('0xf'),JSON[_0xe825('0x12')](_0x13ea1d));if(_0x13ea1d[_0xe825('0x13')]){if(_0x13ea1d['error'][_0xe825('0x14')]===0x1f4){logger['error'](_0xe825('0xe'),_0x4aa852,_0x13ea1d[_0xe825('0x13')][_0xe825('0x15')]);return _0x357611(_0x13ea1d['error'][_0xe825('0x15')]);}logger['error'](_0xe825('0xe'),_0x4aa852,_0x13ea1d[_0xe825('0x13')][_0xe825('0x15')]);return _0x1a3bb7(_0x13ea1d['error']['message']);}else{logger[_0xe825('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4aa852,'request\x20sent');_0x1a3bb7(_0x13ea1d[_0xe825('0x16')][_0xe825('0x15')]);}})[_0xe825('0x17')](function(_0x26471c){logger['error'](_0xe825('0xe'),_0x4aa852,_0x26471c);_0x357611(_0x26471c);});});}
\ No newline at end of file
index a3ac161..5682f1d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa534=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports'];(function(_0x31991b,_0xaf75d2){var _0x307304=function(_0x2f36c5){while(--_0x2f36c5){_0x31991b['push'](_0x31991b['shift']());}};_0x307304(++_0xaf75d2);}(_0xa534,0x156));var _0x4a53=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xa534[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x4a53('0x0'));var util=require(_0x4a53('0x1'));var path=require(_0x4a53('0x2'));var timeout=require('connect-timeout');var express=require(_0x4a53('0x3'));var router=express[_0x4a53('0x4')]();var auth=require(_0x4a53('0x5'));var interaction=require(_0x4a53('0x6'));var config=require(_0x4a53('0x7'));var controller=require(_0x4a53('0x8'));router[_0x4a53('0x9')]('/',auth[_0x4a53('0xa')](),controller[_0x4a53('0xb')]);router[_0x4a53('0x9')](_0x4a53('0xc'),auth[_0x4a53('0xa')](),controller[_0x4a53('0xd')]);router[_0x4a53('0xe')]('/',auth[_0x4a53('0xa')](),controller[_0x4a53('0xf')]);router[_0x4a53('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x4a53('0xc'),auth['isAuthenticated'](),controller[_0x4a53('0x11')]);module[_0x4a53('0x12')]=router;
\ No newline at end of file
+var _0x7863=['/:id','show','post','create','put','update','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index'];(function(_0x53c348,_0x3bb399){var _0x4aedec=function(_0x2f2550){while(--_0x2f2550){_0x53c348['push'](_0x53c348['shift']());}};_0x4aedec(++_0x3bb399);}(_0x7863,0x14b));var _0x3786=function(_0x321ccf,_0x2e780d){_0x321ccf=_0x321ccf-0x0;var _0x3a9a2a=_0x7863[_0x321ccf];return _0x3a9a2a;};'use strict';var multer=require(_0x3786('0x0'));var util=require('util');var path=require(_0x3786('0x1'));var timeout=require(_0x3786('0x2'));var express=require(_0x3786('0x3'));var router=express['Router']();var auth=require(_0x3786('0x4'));var interaction=require(_0x3786('0x5'));var config=require(_0x3786('0x6'));var controller=require(_0x3786('0x7'));router[_0x3786('0x8')]('/',auth[_0x3786('0x9')](),controller[_0x3786('0xa')]);router[_0x3786('0x8')](_0x3786('0xb'),auth[_0x3786('0x9')](),controller[_0x3786('0xc')]);router[_0x3786('0xd')]('/',auth[_0x3786('0x9')](),controller[_0x3786('0xe')]);router[_0x3786('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x3786('0x10')]);router['delete']('/:id',auth[_0x3786('0x9')](),controller[_0x3786('0x11')]);module['exports']=router;
\ No newline at end of file
index 40412c1..8567e48 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x22fb=['string','STRING','BOOLEAN','ENUM','variable','customVariable','keyValue'];(function(_0x3b04d7,_0x24731a){var _0x21135f=function(_0x28d8dd){while(--_0x28d8dd){_0x3b04d7['push'](_0x3b04d7['shift']());}};_0x21135f(++_0x24731a);}(_0x22fb,0x192));var _0xb22f=function(_0x61d996,_0x298278){_0x61d996=_0x61d996-0x0;var _0x2fef51=_0x22fb[_0x61d996];return _0x2fef51;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xb22f('0x0')]('string',_0xb22f('0x1'),_0xb22f('0x2'),_0xb22f('0x3')),'defaultValue':_0xb22f('0x4')},'content':{'type':Sequelize[_0xb22f('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb22f('0x0')](_0xb22f('0x4'),_0xb22f('0x1'),_0xb22f('0x2'))},'keyContent':{'type':Sequelize[_0xb22f('0x5')]},'idField':{'type':Sequelize[_0xb22f('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb22f('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb22f('0x5')]}};
\ No newline at end of file
+var _0x750a=['customVariable','keyValue','string','STRING','ENUM','exports','variable'];(function(_0x490539,_0x499605){var _0x3da4ed=function(_0x24b4af){while(--_0x24b4af){_0x490539['push'](_0x490539['shift']());}};_0x3da4ed(++_0x499605);}(_0x750a,0x140));var _0xa750=function(_0x1c0e60,_0x1aea6b){_0x1c0e60=_0x1c0e60-0x0;var _0x128a9c=_0x750a[_0x1c0e60];return _0x128a9c;};'use strict';var Sequelize=require('sequelize');module[_0xa750('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0xa750('0x1'),_0xa750('0x2'),_0xa750('0x3')),'defaultValue':_0xa750('0x4')},'content':{'type':Sequelize[_0xa750('0x5')]},'key':{'type':Sequelize[_0xa750('0x5')]},'keyType':{'type':Sequelize[_0xa750('0x6')](_0xa750('0x4'),_0xa750('0x1'),_0xa750('0x2'))},'keyContent':{'type':Sequelize[_0xa750('0x5')]},'idField':{'type':Sequelize[_0xa750('0x5')]},'nameField':{'type':Sequelize[_0xa750('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}};
\ No newline at end of file
index bc6c8c9..bcbfb93 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc6e0=['reject','save','update','destroy','then','stack','name','send','index','SugarcrmField','rawAttributes','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply'];(function(_0x37ef22,_0x348c92){var _0x49eeb3=function(_0x1ef837){while(--_0x1ef837){_0x37ef22['push'](_0x37ef22['shift']());}};_0x49eeb3(++_0x348c92);}(_0xc6e0,0x110));var _0x0c6e=function(_0x3510bf,_0x35ee2c){_0x3510bf=_0x3510bf-0x0;var _0x28994b=_0xc6e0[_0x3510bf];return _0x28994b;};'use strict';var pdf=require(_0x0c6e('0x0'));var emlformat=require(_0x0c6e('0x1'));var rimraf=require(_0x0c6e('0x2'));var zipdir=require(_0x0c6e('0x3'));var jsonpatch=require(_0x0c6e('0x4'));var rp=require(_0x0c6e('0x5'));var moment=require(_0x0c6e('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x0c6e('0x7'));var util=require(_0x0c6e('0x8'));var path=require(_0x0c6e('0x9'));var sox=require(_0x0c6e('0xa'));var csv=require('to-csv');var ejs=require(_0x0c6e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0c6e('0xc'));var crypto=require(_0x0c6e('0xd'));var jsforce=require(_0x0c6e('0xe'));var deskjs=require(_0x0c6e('0xf'));var toCsv=require(_0x0c6e('0x10'));var querystring=require(_0x0c6e('0x11'));var Papa=require(_0x0c6e('0x12'));var authService=require('../../components/auth/service');var hardwareService=require(_0x0c6e('0x13'));var Redis=require(_0x0c6e('0x14'));var qs=require(_0x0c6e('0x15'));var logger=require(_0x0c6e('0x16'))(_0x0c6e('0x17'));var utils=require(_0x0c6e('0x18'));var config=require(_0x0c6e('0x19'));var db=require(_0x0c6e('0x1a'))['db'];function respondWithStatusCode(_0x4d47c9,_0x5f35c4){_0x5f35c4=_0x5f35c4||0xcc;return function(_0x41e739){if(_0x41e739){return _0x4d47c9[_0x0c6e('0x1b')](_0x5f35c4);}return _0x4d47c9['status'](_0x5f35c4)[_0x0c6e('0x1c')]();};}function respondWithResult(_0x4f2084,_0x494953){_0x494953=_0x494953||0xc8;return function(_0x41ada9){if(_0x41ada9){return _0x4f2084[_0x0c6e('0x1d')](_0x494953)[_0x0c6e('0x1e')](_0x41ada9);}};}function respondWithFilteredResult(_0x189c36,_0xfe1b4e){return function(_0x2e0085){if(_0x2e0085){var _0x3f7b91=_0x2e0085[_0x0c6e('0x1f')],_0x55f11c=_0xfe1b4e['offset'],_0x3b8ba9=_0xfe1b4e[_0x0c6e('0x20')]+_0xfe1b4e['limit'],_0xf0bf67;if(_0x3b8ba9>=_0x3f7b91){_0x3b8ba9=_0x3f7b91;_0xf0bf67=0xc8;}else{_0xf0bf67=0xce;}_0x189c36[_0x0c6e('0x1d')](_0xf0bf67);return _0x189c36[_0x0c6e('0x21')](_0x0c6e('0x22'),_0x55f11c+'-'+_0x3b8ba9+'/'+_0x3f7b91)[_0x0c6e('0x1e')](_0x2e0085);}return null;};}function patchUpdates(_0x4a52e2){return function(_0x2e9799){try{jsonpatch[_0x0c6e('0x23')](_0x2e9799,_0x4a52e2,!![]);}catch(_0x127975){return BPromise[_0x0c6e('0x24')](_0x127975);}return _0x2e9799[_0x0c6e('0x25')]();};}function saveUpdates(_0x3437b0,_0x44044c){return function(_0x223ea9){if(_0x223ea9){return _0x223ea9[_0x0c6e('0x26')](_0x3437b0)['then'](function(_0x8a843b){return _0x8a843b;});}return null;};}function removeEntity(_0x3497d5,_0x10ffdc){return function(_0x1b2053){if(_0x1b2053){return _0x1b2053[_0x0c6e('0x27')]()[_0x0c6e('0x28')](function(){_0x3497d5[_0x0c6e('0x1d')](0xcc)[_0x0c6e('0x1c')]();});}};}function handleEntityNotFound(_0x353c31,_0x54f073){return function(_0x14cefc){if(!_0x14cefc){_0x353c31[_0x0c6e('0x1b')](0x194);}return _0x14cefc;};}function handleError(_0x226ed9,_0x1d97ac){_0x1d97ac=_0x1d97ac||0x1f4;return function(_0x123e0c){logger['error'](_0x123e0c[_0x0c6e('0x29')]);if(_0x123e0c[_0x0c6e('0x2a')]){delete _0x123e0c[_0x0c6e('0x2a')];}_0x226ed9[_0x0c6e('0x1d')](_0x1d97ac)[_0x0c6e('0x2b')](_0x123e0c);};}exports[_0x0c6e('0x2c')]=function(_0x27d88e,_0x197b80){var _0xe349ca={},_0x261519={},_0x50cce5={'count':0x0,'rows':[]};var _0xafb084=db[_0x0c6e('0x2d')][_0x0c6e('0x2e')];_0x261519['model']=_[_0x0c6e('0x2f')](_0xafb084);_0x261519['query']=_[_0x0c6e('0x2f')](_0x27d88e[_0x0c6e('0x30')]);_0x261519[_0x0c6e('0x31')]=_['intersection'](_0x261519[_0x0c6e('0x32')],_0x261519[_0x0c6e('0x30')]);_0xe349ca[_0x0c6e('0x33')]=_[_0x0c6e('0x34')](_0x261519['model'],qs['fields'](_0x27d88e['query'][_0x0c6e('0x35')]));_0xe349ca[_0x0c6e('0x33')]=_0xe349ca[_0x0c6e('0x33')][_0x0c6e('0x36')]?_0xe349ca['attributes']:_0x261519['model'];if(!_0x27d88e[_0x0c6e('0x30')][_0x0c6e('0x37')](_0x0c6e('0x38'))){_0xe349ca['limit']=qs[_0x0c6e('0x39')](_0x27d88e['query'][_0x0c6e('0x39')]);_0xe349ca['offset']=qs[_0x0c6e('0x20')](_0x27d88e[_0x0c6e('0x30')][_0x0c6e('0x20')]);}_0xe349ca[_0x0c6e('0x3a')]=qs[_0x0c6e('0x3b')](_0x27d88e[_0x0c6e('0x30')]['sort']);_0xe349ca[_0x0c6e('0x3c')]=qs[_0x0c6e('0x31')](_[_0x0c6e('0x3d')](_0x27d88e[_0x0c6e('0x30')],_0x261519[_0x0c6e('0x31')]));if(_0x27d88e[_0x0c6e('0x30')][_0x0c6e('0x3e')]){_0xe349ca[_0x0c6e('0x3c')]=_[_0x0c6e('0x3f')](_0xe349ca[_0x0c6e('0x3c')],{'$or':_[_0x0c6e('0x40')](_0xafb084,function(_0x2fc8f2){if(_0x2fc8f2[_0x0c6e('0x41')]['key']!==_0x0c6e('0x42')){var _0x57bd98={};_0x57bd98[_0x2fc8f2['field']]={'$like':'%'+_0x27d88e[_0x0c6e('0x30')][_0x0c6e('0x3e')]+'%'};return _0x57bd98;}})});}_0xe349ca=_[_0x0c6e('0x3f')]({},_0xe349ca,_0x27d88e[_0x0c6e('0x43')]);var _0x3dad06={'where':_0xe349ca['where']};return db[_0x0c6e('0x2d')]['count'](_0x3dad06)[_0x0c6e('0x28')](function(_0x1615c5){_0x50cce5[_0x0c6e('0x1f')]=_0x1615c5;if(_0x27d88e[_0x0c6e('0x30')][_0x0c6e('0x44')]){_0xe349ca[_0x0c6e('0x45')]=[{'all':!![]}];}return db[_0x0c6e('0x2d')][_0x0c6e('0x46')](_0xe349ca);})['then'](function(_0x3f4412){_0x50cce5['rows']=_0x3f4412;return _0x50cce5;})['then'](respondWithFilteredResult(_0x197b80,_0xe349ca))[_0x0c6e('0x47')](handleError(_0x197b80,null));};exports[_0x0c6e('0x48')]=function(_0x5984eb,_0x21b3fb){var _0x36f48b={'raw':!![],'where':{'id':_0x5984eb[_0x0c6e('0x49')]['id']}},_0x1dcb00={};_0x1dcb00['model']=_[_0x0c6e('0x2f')](db[_0x0c6e('0x2d')][_0x0c6e('0x2e')]);_0x1dcb00[_0x0c6e('0x30')]=_[_0x0c6e('0x2f')](_0x5984eb[_0x0c6e('0x30')]);_0x1dcb00['filters']=_['intersection'](_0x1dcb00[_0x0c6e('0x32')],_0x1dcb00[_0x0c6e('0x30')]);_0x36f48b['attributes']=_[_0x0c6e('0x34')](_0x1dcb00['model'],qs[_0x0c6e('0x35')](_0x5984eb['query'][_0x0c6e('0x35')]));_0x36f48b[_0x0c6e('0x33')]=_0x36f48b[_0x0c6e('0x33')][_0x0c6e('0x36')]?_0x36f48b['attributes']:_0x1dcb00[_0x0c6e('0x32')];if(_0x5984eb[_0x0c6e('0x30')][_0x0c6e('0x44')]){_0x36f48b[_0x0c6e('0x45')]=[{'all':!![]}];}_0x36f48b=_[_0x0c6e('0x3f')]({},_0x36f48b,_0x5984eb[_0x0c6e('0x43')]);return db['SugarcrmField'][_0x0c6e('0x4a')](_0x36f48b)[_0x0c6e('0x28')](handleEntityNotFound(_0x21b3fb,null))[_0x0c6e('0x28')](respondWithResult(_0x21b3fb,null))['catch'](handleError(_0x21b3fb,null));};exports[_0x0c6e('0x4b')]=function(_0x2d51ba,_0x3594df){return db[_0x0c6e('0x2d')][_0x0c6e('0x4b')](_0x2d51ba[_0x0c6e('0x4c')],{})[_0x0c6e('0x28')](respondWithResult(_0x3594df,0xc9))['catch'](handleError(_0x3594df,null));};exports[_0x0c6e('0x26')]=function(_0x2e6743,_0x1b1b66){if(_0x2e6743[_0x0c6e('0x4c')]['id']){delete _0x2e6743['body']['id'];}return db[_0x0c6e('0x2d')][_0x0c6e('0x4a')]({'where':{'id':_0x2e6743[_0x0c6e('0x49')]['id']}})[_0x0c6e('0x28')](handleEntityNotFound(_0x1b1b66,null))['then'](saveUpdates(_0x2e6743[_0x0c6e('0x4c')],null))[_0x0c6e('0x28')](respondWithResult(_0x1b1b66,null))[_0x0c6e('0x47')](handleError(_0x1b1b66,null));};exports['destroy']=function(_0x25b9cf,_0x42a40f){return db[_0x0c6e('0x2d')][_0x0c6e('0x4a')]({'where':{'id':_0x25b9cf[_0x0c6e('0x49')]['id']}})['then'](handleEntityNotFound(_0x42a40f,null))[_0x0c6e('0x28')](removeEntity(_0x42a40f,null))[_0x0c6e('0x47')](handleError(_0x42a40f,null));};
\ No newline at end of file
+var _0x138e=['include','findAll','rows','catch','show','params','body','update','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','error','stack','name','SugarcrmField','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type','key','VIRTUAL','field','options','then','count','includeAll'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x138e,0x1bf));var _0xe138=function(_0x28be18,_0x450fc5){_0x28be18=_0x28be18-0x0;var _0x1d197d=_0x138e[_0x28be18];return _0x1d197d;};'use strict';var pdf=require(_0xe138('0x0'));var emlformat=require(_0xe138('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe138('0x2'));var jsonpatch=require(_0xe138('0x3'));var rp=require(_0xe138('0x4'));var moment=require(_0xe138('0x5'));var BPromise=require(_0xe138('0x6'));var Mustache=require(_0xe138('0x7'));var util=require(_0xe138('0x8'));var path=require(_0xe138('0x9'));var sox=require(_0xe138('0xa'));var csv=require(_0xe138('0xb'));var ejs=require(_0xe138('0xc'));var fs=require('fs');var _=require(_0xe138('0xd'));var squel=require(_0xe138('0xe'));var crypto=require('crypto');var jsforce=require(_0xe138('0xf'));var deskjs=require(_0xe138('0x10'));var toCsv=require(_0xe138('0xb'));var querystring=require(_0xe138('0x11'));var Papa=require(_0xe138('0x12'));var authService=require(_0xe138('0x13'));var hardwareService=require(_0xe138('0x14'));var Redis=require(_0xe138('0x15'));var qs=require(_0xe138('0x16'));var logger=require(_0xe138('0x17'))(_0xe138('0x18'));var utils=require(_0xe138('0x19'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x394f06,_0x42c86c){_0x42c86c=_0x42c86c||0xcc;return function(_0x192605){if(_0x192605){return _0x394f06[_0xe138('0x1a')](_0x42c86c);}return _0x394f06[_0xe138('0x1b')](_0x42c86c)[_0xe138('0x1c')]();};}function respondWithResult(_0x22981e,_0x2dc992){_0x2dc992=_0x2dc992||0xc8;return function(_0x274f78){if(_0x274f78){return _0x22981e[_0xe138('0x1b')](_0x2dc992)[_0xe138('0x1d')](_0x274f78);}};}function respondWithFilteredResult(_0x22e4ec,_0x136539){return function(_0x345397){if(_0x345397){var _0x5bc6db=_0x345397['count'],_0xf02c1e=_0x136539[_0xe138('0x1e')],_0x1b34b6=_0x136539[_0xe138('0x1e')]+_0x136539[_0xe138('0x1f')],_0x38be74;if(_0x1b34b6>=_0x5bc6db){_0x1b34b6=_0x5bc6db;_0x38be74=0xc8;}else{_0x38be74=0xce;}_0x22e4ec[_0xe138('0x1b')](_0x38be74);return _0x22e4ec[_0xe138('0x20')](_0xe138('0x21'),_0xf02c1e+'-'+_0x1b34b6+'/'+_0x5bc6db)[_0xe138('0x1d')](_0x345397);}return null;};}function patchUpdates(_0x1e6c01){return function(_0x3b618a){try{jsonpatch[_0xe138('0x22')](_0x3b618a,_0x1e6c01,!![]);}catch(_0x1c0ccd){return BPromise[_0xe138('0x23')](_0x1c0ccd);}return _0x3b618a[_0xe138('0x24')]();};}function saveUpdates(_0x2bc85b,_0xff9074){return function(_0x600ed5){if(_0x600ed5){return _0x600ed5['update'](_0x2bc85b)['then'](function(_0x3c6081){return _0x3c6081;});}return null;};}function removeEntity(_0x1a2b02,_0xfbc519){return function(_0x5c4eef){if(_0x5c4eef){return _0x5c4eef['destroy']()['then'](function(){_0x1a2b02[_0xe138('0x1b')](0xcc)[_0xe138('0x1c')]();});}};}function handleEntityNotFound(_0x2a9a97,_0x3baec9){return function(_0x2e0ddd){if(!_0x2e0ddd){_0x2a9a97[_0xe138('0x1a')](0x194);}return _0x2e0ddd;};}function handleError(_0x286b,_0x74b51f){_0x74b51f=_0x74b51f||0x1f4;return function(_0x34e4ba){logger[_0xe138('0x25')](_0x34e4ba[_0xe138('0x26')]);if(_0x34e4ba[_0xe138('0x27')]){delete _0x34e4ba[_0xe138('0x27')];}_0x286b['status'](_0x74b51f)['send'](_0x34e4ba);};}exports['index']=function(_0x193e5f,_0x32c2d7){var _0x285b28={},_0xec3b25={},_0x83cd08={'count':0x0,'rows':[]};var _0x55a74d=db[_0xe138('0x28')][_0xe138('0x29')];_0xec3b25[_0xe138('0x2a')]=_['keys'](_0x55a74d);_0xec3b25['query']=_[_0xe138('0x2b')](_0x193e5f[_0xe138('0x2c')]);_0xec3b25[_0xe138('0x2d')]=_[_0xe138('0x2e')](_0xec3b25[_0xe138('0x2a')],_0xec3b25[_0xe138('0x2c')]);_0x285b28[_0xe138('0x2f')]=_[_0xe138('0x2e')](_0xec3b25['model'],qs[_0xe138('0x30')](_0x193e5f[_0xe138('0x2c')][_0xe138('0x30')]));_0x285b28['attributes']=_0x285b28[_0xe138('0x2f')][_0xe138('0x31')]?_0x285b28['attributes']:_0xec3b25['model'];if(!_0x193e5f[_0xe138('0x2c')]['hasOwnProperty'](_0xe138('0x32'))){_0x285b28[_0xe138('0x1f')]=qs[_0xe138('0x1f')](_0x193e5f[_0xe138('0x2c')]['limit']);_0x285b28['offset']=qs[_0xe138('0x1e')](_0x193e5f[_0xe138('0x2c')][_0xe138('0x1e')]);}_0x285b28['order']=qs[_0xe138('0x33')](_0x193e5f['query']['sort']);_0x285b28[_0xe138('0x34')]=qs[_0xe138('0x2d')](_[_0xe138('0x35')](_0x193e5f[_0xe138('0x2c')],_0xec3b25['filters']));if(_0x193e5f['query'][_0xe138('0x36')]){_0x285b28[_0xe138('0x34')]=_[_0xe138('0x37')](_0x285b28[_0xe138('0x34')],{'$or':_['map'](_0x55a74d,function(_0x149e11){if(_0x149e11[_0xe138('0x38')][_0xe138('0x39')]!==_0xe138('0x3a')){var _0x33f6dc={};_0x33f6dc[_0x149e11[_0xe138('0x3b')]]={'$like':'%'+_0x193e5f['query'][_0xe138('0x36')]+'%'};return _0x33f6dc;}})});}_0x285b28=_[_0xe138('0x37')]({},_0x285b28,_0x193e5f[_0xe138('0x3c')]);var _0x23097d={'where':_0x285b28['where']};return db[_0xe138('0x28')]['count'](_0x23097d)[_0xe138('0x3d')](function(_0x4fd4d3){_0x83cd08[_0xe138('0x3e')]=_0x4fd4d3;if(_0x193e5f[_0xe138('0x2c')][_0xe138('0x3f')]){_0x285b28[_0xe138('0x40')]=[{'all':!![]}];}return db[_0xe138('0x28')][_0xe138('0x41')](_0x285b28);})[_0xe138('0x3d')](function(_0x2b7f47){_0x83cd08[_0xe138('0x42')]=_0x2b7f47;return _0x83cd08;})[_0xe138('0x3d')](respondWithFilteredResult(_0x32c2d7,_0x285b28))[_0xe138('0x43')](handleError(_0x32c2d7,null));};exports[_0xe138('0x44')]=function(_0x38a44,_0x5d8a21){var _0x441316={'raw':!![],'where':{'id':_0x38a44[_0xe138('0x45')]['id']}},_0xfcd47={};_0xfcd47['model']=_['keys'](db['SugarcrmField'][_0xe138('0x29')]);_0xfcd47[_0xe138('0x2c')]=_['keys'](_0x38a44['query']);_0xfcd47['filters']=_[_0xe138('0x2e')](_0xfcd47[_0xe138('0x2a')],_0xfcd47[_0xe138('0x2c')]);_0x441316['attributes']=_['intersection'](_0xfcd47['model'],qs[_0xe138('0x30')](_0x38a44[_0xe138('0x2c')][_0xe138('0x30')]));_0x441316[_0xe138('0x2f')]=_0x441316[_0xe138('0x2f')][_0xe138('0x31')]?_0x441316[_0xe138('0x2f')]:_0xfcd47[_0xe138('0x2a')];if(_0x38a44[_0xe138('0x2c')][_0xe138('0x3f')]){_0x441316[_0xe138('0x40')]=[{'all':!![]}];}_0x441316=_['merge']({},_0x441316,_0x38a44[_0xe138('0x3c')]);return db[_0xe138('0x28')]['find'](_0x441316)[_0xe138('0x3d')](handleEntityNotFound(_0x5d8a21,null))[_0xe138('0x3d')](respondWithResult(_0x5d8a21,null))[_0xe138('0x43')](handleError(_0x5d8a21,null));};exports['create']=function(_0x19b869,_0x19d130){return db[_0xe138('0x28')]['create'](_0x19b869[_0xe138('0x46')],{})[_0xe138('0x3d')](respondWithResult(_0x19d130,0xc9))[_0xe138('0x43')](handleError(_0x19d130,null));};exports[_0xe138('0x47')]=function(_0x1068cc,_0x2303bb){if(_0x1068cc['body']['id']){delete _0x1068cc[_0xe138('0x46')]['id'];}return db[_0xe138('0x28')][_0xe138('0x48')]({'where':{'id':_0x1068cc[_0xe138('0x45')]['id']}})['then'](handleEntityNotFound(_0x2303bb,null))[_0xe138('0x3d')](saveUpdates(_0x1068cc['body'],null))[_0xe138('0x3d')](respondWithResult(_0x2303bb,null))[_0xe138('0x43')](handleError(_0x2303bb,null));};exports['destroy']=function(_0x492c8e,_0x5ef416){return db[_0xe138('0x28')][_0xe138('0x48')]({'where':{'id':_0x492c8e[_0xe138('0x45')]['id']}})[_0xe138('0x3d')](handleEntityNotFound(_0x5ef416,null))[_0xe138('0x3d')](removeEntity(_0x5ef416,null))['catch'](handleError(_0x5ef416,null));};
\ No newline at end of file
index b315028..d2b12ba 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa8c8=['SugarcrmField','sugarcrm_unique_index','idField','FieldId','lodash','../../config/logger','moment','request-promise','./intSugarcrmField.attributes','exports','define'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0xa8c8,0x138));var _0x8a8c=function(_0x26fcfa,_0x5136c5){_0x26fcfa=_0x26fcfa-0x0;var _0x1429fa=_0xa8c8[_0x26fcfa];return _0x1429fa;};'use strict';var _=require(_0x8a8c('0x0'));var util=require('util');var logger=require(_0x8a8c('0x1'))('api');var moment=require(_0x8a8c('0x2'));var BPromise=require('bluebird');var rp=require(_0x8a8c('0x3'));var attributes=require(_0x8a8c('0x4'));module[_0x8a8c('0x5')]=function(_0x38ca16,_0x1cde03){return _0x38ca16[_0x8a8c('0x6')](_0x8a8c('0x7'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x8a8c('0x8'),'fields':[_0x8a8c('0x9'),_0x8a8c('0xa')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x1dd2=['int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','../../config/logger','api','moment','bluebird','./intSugarcrmField.attributes','exports','define','SugarcrmField'];(function(_0x26315a,_0x377bf2){var _0x286929=function(_0x3037d7){while(--_0x3037d7){_0x26315a['push'](_0x26315a['shift']());}};_0x286929(++_0x377bf2);}(_0x1dd2,0x13c));var _0x21dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dd2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x21dd('0x0'))(_0x21dd('0x1'));var moment=require(_0x21dd('0x2'));var BPromise=require(_0x21dd('0x3'));var rp=require('request-promise');var attributes=require(_0x21dd('0x4'));module[_0x21dd('0x5')]=function(_0x50dca6,_0x10bf29){return _0x50dca6[_0x21dd('0x6')](_0x21dd('0x7'),attributes,{'tableName':_0x21dd('0x8'),'paranoid':![],'indexes':[{'name':_0x21dd('0x9'),'fields':[_0x21dd('0xa'),_0x21dd('0xb')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index e7461e6..83662f8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc94b=['SugarcrmField,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc94b,0x17a));var _0xbc94=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0xc94b[_0x59d89e];return _0x554e93;};'use strict';var _=require(_0xbc94('0x0'));var util=require(_0xbc94('0x1'));var moment=require(_0xbc94('0x2'));var BPromise=require(_0xbc94('0x3'));var rs=require(_0xbc94('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc94('0x5'))['db'];var utils=require(_0xbc94('0x6'));var logger=require(_0xbc94('0x7'))(_0xbc94('0x8'));var config=require(_0xbc94('0x9'));var jayson=require(_0xbc94('0xa'));var client=jayson['client'][_0xbc94('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x324bd7,_0x58440e,_0x4e2536){return new BPromise(function(_0x38dc4f,_0x4d7929){return client[_0xbc94('0xc')](_0x324bd7,_0x4e2536)[_0xbc94('0xd')](function(_0x3065a7){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x58440e,'request\x20sent');logger['debug'](_0xbc94('0xe'),_0x58440e,'request\x20sent',JSON[_0xbc94('0xf')](_0x3065a7));if(_0x3065a7['error']){if(_0x3065a7[_0xbc94('0x10')][_0xbc94('0x11')]===0x1f4){logger[_0xbc94('0x10')](_0xbc94('0x12'),_0x58440e,_0x3065a7[_0xbc94('0x10')][_0xbc94('0x13')]);return _0x4d7929(_0x3065a7['error'][_0xbc94('0x13')]);}logger['error'](_0xbc94('0x12'),_0x58440e,_0x3065a7[_0xbc94('0x10')][_0xbc94('0x13')]);return _0x38dc4f(_0x3065a7[_0xbc94('0x10')][_0xbc94('0x13')]);}else{logger['info'](_0xbc94('0x12'),_0x58440e,_0xbc94('0x14'));_0x38dc4f(_0x3065a7[_0xbc94('0x15')][_0xbc94('0x13')]);}})['catch'](function(_0x3f7216){logger[_0xbc94('0x10')](_0xbc94('0x12'),_0x58440e,_0x3f7216);_0x4d7929(_0x3f7216);});});}
\ No newline at end of file
+var _0xa90d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0xe94f78,_0x22c074){var _0x2bc8c4=function(_0x5dfad0){while(--_0x5dfad0){_0xe94f78['push'](_0xe94f78['shift']());}};_0x2bc8c4(++_0x22c074);}(_0xa90d,0x91));var _0xda90=function(_0x31ba98,_0x4f14d3){_0x31ba98=_0x31ba98-0x0;var _0x3ae62f=_0xa90d[_0x31ba98];return _0x3ae62f;};'use strict';var _=require(_0xda90('0x0'));var util=require(_0xda90('0x1'));var moment=require(_0xda90('0x2'));var BPromise=require(_0xda90('0x3'));var rs=require(_0xda90('0x4'));var fs=require('fs');var Redis=require(_0xda90('0x5'));var db=require(_0xda90('0x6'))['db'];var utils=require(_0xda90('0x7'));var logger=require(_0xda90('0x8'))('rpc');var config=require(_0xda90('0x9'));var jayson=require(_0xda90('0xa'));var client=jayson[_0xda90('0xb')][_0xda90('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x15777e,_0x1b1956,_0x4efa74){return new BPromise(function(_0x40af3f,_0x51da4d){return client[_0xda90('0xd')](_0x15777e,_0x4efa74)['then'](function(_0x3d5f0f){logger[_0xda90('0xe')](_0xda90('0xf'),_0x1b1956,_0xda90('0x10'));logger[_0xda90('0x11')](_0xda90('0x12'),_0x1b1956,_0xda90('0x10'),JSON[_0xda90('0x13')](_0x3d5f0f));if(_0x3d5f0f[_0xda90('0x14')]){if(_0x3d5f0f[_0xda90('0x14')][_0xda90('0x15')]===0x1f4){logger[_0xda90('0x14')](_0xda90('0xf'),_0x1b1956,_0x3d5f0f[_0xda90('0x14')]['message']);return _0x51da4d(_0x3d5f0f['error'][_0xda90('0x16')]);}logger[_0xda90('0x14')](_0xda90('0xf'),_0x1b1956,_0x3d5f0f[_0xda90('0x14')][_0xda90('0x16')]);return _0x40af3f(_0x3d5f0f[_0xda90('0x14')][_0xda90('0x16')]);}else{logger[_0xda90('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x1b1956,_0xda90('0x10'));_0x40af3f(_0x3d5f0f[_0xda90('0x17')][_0xda90('0x16')]);}})[_0xda90('0x18')](function(_0xedb38){logger[_0xda90('0x14')](_0xda90('0xf'),_0x1b1956,_0xedb38);_0x51da4d(_0xedb38);});});}
\ No newline at end of file
index a8ead2a..9d04475 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6f58=['create','post','put','/:id','update','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','/:id/configurations','getConfigurations','getFields'];(function(_0x1a1df6,_0x2dd467){var _0x2ce232=function(_0x2d813a){while(--_0x2d813a){_0x1a1df6['push'](_0x1a1df6['shift']());}};_0x2ce232(++_0x2dd467);}(_0x6f58,0x1e1));var _0x86f5=function(_0x1286c5,_0x479506){_0x1286c5=_0x1286c5-0x0;var _0x11b8e7=_0x6f58[_0x1286c5];return _0x11b8e7;};'use strict';var multer=require(_0x86f5('0x0'));var util=require(_0x86f5('0x1'));var path=require(_0x86f5('0x2'));var timeout=require(_0x86f5('0x3'));var express=require('express');var router=express[_0x86f5('0x4')]();var auth=require(_0x86f5('0x5'));var interaction=require(_0x86f5('0x6'));var config=require('../../config/environment');var controller=require(_0x86f5('0x7'));router[_0x86f5('0x8')]('/',auth[_0x86f5('0x9')](),controller['index']);router[_0x86f5('0x8')]('/:id',auth[_0x86f5('0x9')](),controller['show']);router[_0x86f5('0x8')](_0x86f5('0xa'),auth['isAuthenticated'](),controller[_0x86f5('0xb')]);router['get']('/:id/fields',auth[_0x86f5('0x9')](),controller[_0x86f5('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x86f5('0xd')]);router[_0x86f5('0xe')](_0x86f5('0xa'),auth[_0x86f5('0x9')](),controller['addConfiguration']);router[_0x86f5('0xf')](_0x86f5('0x10'),auth[_0x86f5('0x9')](),controller[_0x86f5('0x11')]);router['delete'](_0x86f5('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x86f5('0x12')]=router;
\ No newline at end of file
+var _0xb9d5=['isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','index','/:id'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb9d5,0xb6));var _0x5b9d=function(_0x40160f,_0x3babf7){_0x40160f=_0x40160f-0x0;var _0x2a8af8=_0xb9d5[_0x40160f];return _0x2a8af8;};'use strict';var multer=require('multer');var util=require(_0x5b9d('0x0'));var path=require(_0x5b9d('0x1'));var timeout=require(_0x5b9d('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x5b9d('0x3'));var interaction=require(_0x5b9d('0x4'));var config=require(_0x5b9d('0x5'));var controller=require(_0x5b9d('0x6'));router[_0x5b9d('0x7')]('/',auth['isAuthenticated'](),controller[_0x5b9d('0x8')]);router[_0x5b9d('0x7')](_0x5b9d('0x9'),auth[_0x5b9d('0xa')](),controller[_0x5b9d('0xb')]);router['get'](_0x5b9d('0xc'),auth['isAuthenticated'](),controller[_0x5b9d('0xd')]);router[_0x5b9d('0x7')](_0x5b9d('0xe'),auth[_0x5b9d('0xa')](),controller[_0x5b9d('0xf')]);router['post']('/',auth[_0x5b9d('0xa')](),controller[_0x5b9d('0x10')]);router[_0x5b9d('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x5b9d('0x12')]);router[_0x5b9d('0x13')]('/:id',auth[_0x5b9d('0xa')](),controller[_0x5b9d('0x14')]);router[_0x5b9d('0x15')](_0x5b9d('0x9'),auth[_0x5b9d('0xa')](),controller[_0x5b9d('0x16')]);module[_0x5b9d('0x17')]=router;
\ No newline at end of file
index 0cb1444..33df84e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa866=['exports','STRING','HelpDesk','sequelize'];(function(_0x3cc8e8,_0x389797){var _0x409c44=function(_0x219cd0){while(--_0x219cd0){_0x3cc8e8['push'](_0x3cc8e8['shift']());}};_0x409c44(++_0x389797);}(_0xa866,0xab));var _0x6a86=function(_0x217e8f,_0x508a57){_0x217e8f=_0x217e8f-0x0;var _0x4a605e=_0xa866[_0x217e8f];return _0x4a605e;};'use strict';var Sequelize=require(_0x6a86('0x0'));module[_0x6a86('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x6a86('0x2')]},'username':{'type':Sequelize[_0x6a86('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x6a86('0x2')],'allowNull':![],'defaultValue':_0x6a86('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x6a86('0x2')]},'accessKey':{'type':Sequelize[_0x6a86('0x2')],'allowNull':![]}};
\ No newline at end of file
+var _0x0926=['sequelize','STRING','HelpDesk'];(function(_0x215848,_0x1fa90a){var _0x2f1c44=function(_0x29ca2e){while(--_0x29ca2e){_0x215848['push'](_0x215848['shift']());}};_0x2f1c44(++_0x1fa90a);}(_0x0926,0xba));var _0x6092=function(_0x57e00e,_0x36e79a){_0x57e00e=_0x57e00e-0x0;var _0x415e60=_0x0926[_0x57e00e];return _0x415e60;};'use strict';var Sequelize=require(_0x6092('0x0'));module['exports']={'name':{'type':Sequelize[_0x6092('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x6092('0x1')]},'username':{'type':Sequelize[_0x6092('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x6092('0x1')],'allowNull':![],'defaultValue':_0x6092('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x6092('0x1')]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}};
\ No newline at end of file
index 744ee6b..7578c26 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe685=['statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../components/integrations/configuration','jayson/promise','client','request','then','VtigerAccount,\x20%s,\x20%s','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','status','json','count','offset','set','apply','reject','save','sendStatus','stack','name','send','index','VtigerAccount','rawAttributes','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','includeAll','include','findAll','rows','show','params','options','find','create','body','update','getConfigurations','findOne','VtigerConfiguration','order','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','VtigerField','username','description','moduleName','remoteUri','serverUrl','accessKey','format','%s/webservice.php','getchallenge','success','token','GET','describe','sessionName','autogenerated','reference','owner','remove','result','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20'];(function(_0x36e32f,_0x239f58){var _0x987f9f=function(_0x1500e2){while(--_0x1500e2){_0x36e32f['push'](_0x36e32f['shift']());}};_0x987f9f(++_0x239f58);}(_0xe685,0x1ed));var _0x5e68=function(_0x55b020,_0x21fff9){_0x55b020=_0x55b020-0x0;var _0x2a3b0a=_0xe685[_0x55b020];return _0x2a3b0a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5e68('0x0'));var rimraf=require(_0x5e68('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e68('0x2'));var rp=require(_0x5e68('0x3'));var moment=require(_0x5e68('0x4'));var BPromise=require(_0x5e68('0x5'));var Mustache=require(_0x5e68('0x6'));var util=require('util');var path=require('path');var sox=require(_0x5e68('0x7'));var csv=require(_0x5e68('0x8'));var ejs=require(_0x5e68('0x9'));var fs=require('fs');var _=require(_0x5e68('0xa'));var squel=require('squel');var crypto=require(_0x5e68('0xb'));var jsforce=require(_0x5e68('0xc'));var deskjs=require(_0x5e68('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x5e68('0xe'));var hardwareService=require(_0x5e68('0xf'));var Redis=require(_0x5e68('0x10'));var qs=require(_0x5e68('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x5e68('0x12'));var jayson=require(_0x5e68('0x13'));var client=jayson[_0x5e68('0x14')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f4df9,_0x2f4a3d,_0x5059b4,_0x341f98){return new BPromise(function(_0x5b3ff2,_0x183736){var _0x5dd1c1=_0x341f98||client;return _0x5dd1c1[_0x5e68('0x15')](_0x1f4df9,_0x5059b4)[_0x5e68('0x16')](function(_0x222350){logger['info'](_0x5e68('0x17'),_0x2f4a3d,'request\x20sent');logger['debug'](_0x5e68('0x18'),_0x2f4a3d,_0x5e68('0x19'),JSON[_0x5e68('0x1a')](_0x222350));if(_0x222350[_0x5e68('0x1b')]){if(_0x222350[_0x5e68('0x1b')][_0x5e68('0x1c')]===0x1f4){logger['error'](_0x5e68('0x17'),_0x2f4a3d,_0x222350[_0x5e68('0x1b')]['message']);return _0x183736(_0x222350[_0x5e68('0x1b')][_0x5e68('0x1d')]);}logger[_0x5e68('0x1b')]('VtigerAccount,\x20%s,\x20%s',_0x2f4a3d,_0x222350[_0x5e68('0x1b')][_0x5e68('0x1d')]);return _0x5b3ff2(_0x222350[_0x5e68('0x1b')][_0x5e68('0x1d')]);}else{logger[_0x5e68('0x1e')](_0x5e68('0x17'),_0x2f4a3d,_0x5e68('0x19'));_0x5b3ff2(_0x222350['result'][_0x5e68('0x1d')]);}})[_0x5e68('0x1f')](function(_0x4132c2){logger[_0x5e68('0x1b')](_0x5e68('0x17'),_0x2f4a3d,_0x4132c2);_0x183736(_0x4132c2);});});}function respondWithStatusCode(_0x41a572,_0x4ded56){_0x4ded56=_0x4ded56||0xcc;return function(_0x5bf874){if(_0x5bf874){return _0x41a572['sendStatus'](_0x4ded56);}return _0x41a572['status'](_0x4ded56)['end']();};}function respondWithResult(_0x5e8959,_0x1b4894){_0x1b4894=_0x1b4894||0xc8;return function(_0x4e597b){if(_0x4e597b){return _0x5e8959[_0x5e68('0x20')](_0x1b4894)[_0x5e68('0x21')](_0x4e597b);}};}function respondWithFilteredResult(_0x3f7888,_0x4da484){return function(_0x1847df){if(_0x1847df){var _0xb81447=_0x1847df[_0x5e68('0x22')],_0x110e8d=_0x4da484[_0x5e68('0x23')],_0x13c5b2=_0x4da484[_0x5e68('0x23')]+_0x4da484['limit'],_0x7de68c;if(_0x13c5b2>=_0xb81447){_0x13c5b2=_0xb81447;_0x7de68c=0xc8;}else{_0x7de68c=0xce;}_0x3f7888['status'](_0x7de68c);return _0x3f7888[_0x5e68('0x24')]('Content-Range',_0x110e8d+'-'+_0x13c5b2+'/'+_0xb81447)['json'](_0x1847df);}return null;};}function patchUpdates(_0x510689){return function(_0x5d22f1){try{jsonpatch[_0x5e68('0x25')](_0x5d22f1,_0x510689,!![]);}catch(_0x47b1b8){return BPromise[_0x5e68('0x26')](_0x47b1b8);}return _0x5d22f1[_0x5e68('0x27')]();};}function saveUpdates(_0xfbf5be,_0x3ed932){return function(_0x383764){if(_0x383764){return _0x383764['update'](_0xfbf5be)[_0x5e68('0x16')](function(_0x2ed303){return _0x2ed303;});}return null;};}function removeEntity(_0x32b7ec,_0x3a5828){return function(_0xa65d73){if(_0xa65d73){return _0xa65d73['destroy']()[_0x5e68('0x16')](function(){_0x32b7ec[_0x5e68('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x417f1c,_0x361b76){return function(_0x5c657e){if(!_0x5c657e){_0x417f1c[_0x5e68('0x28')](0x194);}return _0x5c657e;};}function handleError(_0x515eab,_0x57a77e){_0x57a77e=_0x57a77e||0x1f4;return function(_0x4de6c6){logger['error'](_0x4de6c6[_0x5e68('0x29')]);if(_0x4de6c6[_0x5e68('0x2a')]){delete _0x4de6c6[_0x5e68('0x2a')];}_0x515eab[_0x5e68('0x20')](_0x57a77e)[_0x5e68('0x2b')](_0x4de6c6);};}exports[_0x5e68('0x2c')]=function(_0x1542cf,_0x333b6c){var _0x32e495={},_0x3f8eae={},_0x274231={'count':0x0,'rows':[]};var _0x10e2d1=db[_0x5e68('0x2d')][_0x5e68('0x2e')];_0x3f8eae['model']=_[_0x5e68('0x2f')](_0x10e2d1);_0x3f8eae[_0x5e68('0x30')]=_[_0x5e68('0x2f')](_0x1542cf['query']);_0x3f8eae[_0x5e68('0x31')]=_[_0x5e68('0x32')](_0x3f8eae['model'],_0x3f8eae[_0x5e68('0x30')]);_0x32e495[_0x5e68('0x33')]=_[_0x5e68('0x32')](_0x3f8eae[_0x5e68('0x34')],qs['fields'](_0x1542cf['query'][_0x5e68('0x35')]));_0x32e495[_0x5e68('0x33')]=_0x32e495[_0x5e68('0x33')][_0x5e68('0x36')]?_0x32e495['attributes']:_0x3f8eae['model'];if(!_0x1542cf[_0x5e68('0x30')][_0x5e68('0x37')]('nolimit')){_0x32e495[_0x5e68('0x38')]=qs['limit'](_0x1542cf[_0x5e68('0x30')][_0x5e68('0x38')]);_0x32e495[_0x5e68('0x23')]=qs['offset'](_0x1542cf['query'][_0x5e68('0x23')]);}_0x32e495['order']=qs[_0x5e68('0x39')](_0x1542cf[_0x5e68('0x30')][_0x5e68('0x39')]);_0x32e495[_0x5e68('0x3a')]=qs[_0x5e68('0x31')](_[_0x5e68('0x3b')](_0x1542cf[_0x5e68('0x30')],_0x3f8eae[_0x5e68('0x31')]));if(_0x1542cf[_0x5e68('0x30')][_0x5e68('0x3c')]){_0x32e495[_0x5e68('0x3a')]=_[_0x5e68('0x3d')](_0x32e495['where'],{'$or':_[_0x5e68('0x3e')](_0x10e2d1,function(_0x36a957){if(_0x36a957[_0x5e68('0x3f')][_0x5e68('0x40')]!==_0x5e68('0x41')){var _0x16558d={};_0x16558d[_0x36a957[_0x5e68('0x42')]]={'$like':'%'+_0x1542cf[_0x5e68('0x30')][_0x5e68('0x3c')]+'%'};return _0x16558d;}})});}_0x32e495=_['merge']({},_0x32e495,_0x1542cf['options']);var _0x422556={'where':_0x32e495['where']};return db[_0x5e68('0x2d')][_0x5e68('0x22')](_0x422556)[_0x5e68('0x16')](function(_0xbbeedf){_0x274231[_0x5e68('0x22')]=_0xbbeedf;if(_0x1542cf[_0x5e68('0x30')][_0x5e68('0x43')]){_0x32e495[_0x5e68('0x44')]=[{'all':!![]}];}return db['VtigerAccount'][_0x5e68('0x45')](_0x32e495);})['then'](function(_0x72b87){_0x274231[_0x5e68('0x46')]=_0x72b87;return _0x274231;})[_0x5e68('0x16')](respondWithFilteredResult(_0x333b6c,_0x32e495))[_0x5e68('0x1f')](handleError(_0x333b6c,null));};exports[_0x5e68('0x47')]=function(_0x247dd3,_0x3fc981){var _0x22e42d={'raw':![],'where':{'id':_0x247dd3[_0x5e68('0x48')]['id']}},_0x5a8dcc={};_0x5a8dcc[_0x5e68('0x34')]=_[_0x5e68('0x2f')](db[_0x5e68('0x2d')][_0x5e68('0x2e')]);_0x5a8dcc[_0x5e68('0x30')]=_['keys'](_0x247dd3[_0x5e68('0x30')]);_0x5a8dcc[_0x5e68('0x31')]=_[_0x5e68('0x32')](_0x5a8dcc[_0x5e68('0x34')],_0x5a8dcc['query']);_0x22e42d[_0x5e68('0x33')]=_['intersection'](_0x5a8dcc[_0x5e68('0x34')],qs[_0x5e68('0x35')](_0x247dd3[_0x5e68('0x30')][_0x5e68('0x35')]));_0x22e42d['attributes']=_0x22e42d[_0x5e68('0x33')][_0x5e68('0x36')]?_0x22e42d[_0x5e68('0x33')]:_0x5a8dcc[_0x5e68('0x34')];if(_0x247dd3[_0x5e68('0x30')][_0x5e68('0x43')]){_0x22e42d[_0x5e68('0x44')]=[{'all':!![]}];}_0x22e42d=_['merge']({},_0x22e42d,_0x247dd3[_0x5e68('0x49')]);return db[_0x5e68('0x2d')][_0x5e68('0x4a')](_0x22e42d)[_0x5e68('0x16')](handleEntityNotFound(_0x3fc981,null))[_0x5e68('0x16')](respondWithResult(_0x3fc981,null))[_0x5e68('0x1f')](handleError(_0x3fc981,null));};exports[_0x5e68('0x4b')]=function(_0x1667a3,_0x4c5f5d){return db['VtigerAccount']['create'](_0x1667a3[_0x5e68('0x4c')],{})[_0x5e68('0x16')](respondWithResult(_0x4c5f5d,0xc9))['catch'](handleError(_0x4c5f5d,null));};exports[_0x5e68('0x4d')]=function(_0x1c6e71,_0x4bf977){if(_0x1c6e71[_0x5e68('0x4c')]['id']){delete _0x1c6e71[_0x5e68('0x4c')]['id'];}return db['VtigerAccount'][_0x5e68('0x4a')]({'where':{'id':_0x1c6e71[_0x5e68('0x48')]['id']}})[_0x5e68('0x16')](handleEntityNotFound(_0x4bf977,null))[_0x5e68('0x16')](saveUpdates(_0x1c6e71[_0x5e68('0x4c')],null))[_0x5e68('0x16')](respondWithResult(_0x4bf977,null))[_0x5e68('0x1f')](handleError(_0x4bf977,null));};exports['destroy']=function(_0xa344eb,_0x4c7ffd){return db[_0x5e68('0x2d')][_0x5e68('0x4a')]({'where':{'id':_0xa344eb[_0x5e68('0x48')]['id']}})['then'](handleEntityNotFound(_0x4c7ffd,null))[_0x5e68('0x16')](removeEntity(_0x4c7ffd,null))['catch'](handleError(_0x4c7ffd,null));};exports[_0x5e68('0x4e')]=function(_0x198a9e,_0x64d1ad,_0x22af2c){var _0xdd8e89={};var _0x366b9b={};var _0x5c99ab;var _0x4b3599;return db[_0x5e68('0x2d')][_0x5e68('0x4f')]({'where':{'id':_0x198a9e['params']['id']}})[_0x5e68('0x16')](handleEntityNotFound(_0x64d1ad,null))[_0x5e68('0x16')](function(_0x8ec07f){if(_0x8ec07f){_0x5c99ab=_0x8ec07f;_0x366b9b[_0x5e68('0x34')]=_['keys'](db[_0x5e68('0x50')][_0x5e68('0x2e')]);_0x366b9b[_0x5e68('0x30')]=_['keys'](_0x198a9e[_0x5e68('0x30')]);_0x366b9b[_0x5e68('0x31')]=_['intersection'](_0x366b9b[_0x5e68('0x34')],_0x366b9b[_0x5e68('0x30')]);_0xdd8e89[_0x5e68('0x33')]=_[_0x5e68('0x32')](_0x366b9b[_0x5e68('0x34')],qs[_0x5e68('0x35')](_0x198a9e[_0x5e68('0x30')][_0x5e68('0x35')]));_0xdd8e89[_0x5e68('0x33')]=_0xdd8e89['attributes']['length']?_0xdd8e89[_0x5e68('0x33')]:_0x366b9b['model'];_0xdd8e89[_0x5e68('0x51')]=qs[_0x5e68('0x39')](_0x198a9e[_0x5e68('0x30')]['sort']);_0xdd8e89['where']=qs[_0x5e68('0x31')](_['pick'](_0x198a9e[_0x5e68('0x30')],_0x366b9b[_0x5e68('0x31')]));if(_0x198a9e['query'][_0x5e68('0x3c')]){_0xdd8e89[_0x5e68('0x3a')]=_[_0x5e68('0x3d')](_0xdd8e89[_0x5e68('0x3a')],{'$or':_[_0x5e68('0x3e')](_0xdd8e89[_0x5e68('0x33')],function(_0x389999){var _0x383ffd={};_0x383ffd[_0x389999]={'$like':'%'+_0x198a9e[_0x5e68('0x30')][_0x5e68('0x3c')]+'%'};return _0x383ffd;})});}_0xdd8e89=_[_0x5e68('0x3d')]({},_0xdd8e89,_0x198a9e[_0x5e68('0x49')]);return _0x5c99ab[_0x5e68('0x4e')](_0xdd8e89);}})[_0x5e68('0x16')](function(_0x4e7f43){if(_0x4e7f43){_0x4b3599=_0x4e7f43[_0x5e68('0x36')];if(!_0x198a9e['query'][_0x5e68('0x37')](_0x5e68('0x52'))){_0xdd8e89[_0x5e68('0x38')]=qs[_0x5e68('0x38')](_0x198a9e['query'][_0x5e68('0x38')]);_0xdd8e89[_0x5e68('0x23')]=qs[_0x5e68('0x23')](_0x198a9e['query']['offset']);}return _0x5c99ab[_0x5e68('0x4e')](_0xdd8e89);}})['then'](function(_0x575509){if(_0x575509){return _0x575509?{'count':_0x4b3599,'rows':_0x575509}:null;}})['then'](respondWithResult(_0x64d1ad,null))['catch'](handleError(_0x64d1ad,null));};exports[_0x5e68('0x53')]=function(_0x5ec0eb,_0x196a99,_0x4fa344){if(_0x5ec0eb[_0x5e68('0x4c')]['id']){delete _0x5ec0eb[_0x5e68('0x4c')]['id'];}return db[_0x5e68('0x2d')][_0x5e68('0x4f')]({'where':{'id':_0x5ec0eb['params']['id']}})[_0x5e68('0x16')](handleEntityNotFound(_0x196a99,null))['then'](function(_0x151c79){if(_0x151c79){_0x5ec0eb['body'][_0x5e68('0x54')]=_0x151c79['id'];_0x5ec0eb[_0x5e68('0x4c')][_0x5e68('0x55')]=integrations[_0x5e68('0x56')](_0x5ec0eb['body'][_0x5e68('0x57')],_0x5ec0eb['body']['type']);_0x5ec0eb['body'][_0x5e68('0x58')]=integrations['getDescriptions'](_0x5ec0eb[_0x5e68('0x4c')]['channel'],_0x5ec0eb[_0x5e68('0x4c')][_0x5e68('0x3f')]);return db['VtigerConfiguration'][_0x5e68('0x4b')](_0x5ec0eb[_0x5e68('0x4c')],{'include':[{'model':db[_0x5e68('0x59')],'as':_0x5e68('0x55')},{'model':db[_0x5e68('0x59')],'as':_0x5e68('0x58')}]});}return null;})[_0x5e68('0x16')](respondWithResult(_0x196a99,null))[_0x5e68('0x1f')](handleError(_0x196a99,null));};var md5=require('md5');exports['getFields']=function(_0x2964b2,_0x31c6f1,_0x6033e7){var _0x4a795b=null;var _0x46c5d3=null;var _0x23fe4f=null;var _0x10f4a8=null;return db['VtigerAccount']['findOne']({'where':{'id':_0x2964b2[_0x5e68('0x48')]['id']},'attributes':['id',_0x5e68('0x2a'),_0x5e68('0x5a'),_0x5e68('0x5b'),_0x5e68('0x5c'),_0x5e68('0x5d'),_0x5e68('0x5e'),_0x5e68('0x5f')]})[_0x5e68('0x16')](handleEntityNotFound(_0x31c6f1,null))['then'](function(_0x205638){if(_0x205638){_0x4a795b=_0x205638[_0x5e68('0x5a')];_0x46c5d3=_0x205638[_0x5e68('0x5f')];_0x23fe4f=_0x205638[_0x5e68('0x5c')];_0x10f4a8=util[_0x5e68('0x60')](_0x5e68('0x61'),_0x205638[_0x5e68('0x5d')]);var _0x44be2d={'method':'GET','uri':_0x10f4a8,'qs':{'operation':_0x5e68('0x62'),'username':_0x205638[_0x5e68('0x5a')]},'json':!![]};return rp(_0x44be2d);}})[_0x5e68('0x16')](function(_0x539580){if(_0x539580[_0x5e68('0x63')]){var _0x270daf={'method':'POST','uri':_0x10f4a8,'form':{'operation':'login','username':_0x4a795b,'accessKey':md5(_0x539580['result'][_0x5e68('0x64')]+_0x46c5d3)},'json':!![]};return rp(_0x270daf);}})[_0x5e68('0x16')](function(_0x58f162){if(_0x58f162[_0x5e68('0x63')]){var _0xb645a5={'method':_0x5e68('0x65'),'uri':_0x10f4a8,'qs':{'operation':_0x5e68('0x66'),'username':_0x4a795b,'sessionName':_0x58f162['result'][_0x5e68('0x67')],'elementType':_0x23fe4f},'json':!![]};return rp(_0xb645a5);}})[_0x5e68('0x16')](function(_0x561832){if(_0x561832[_0x5e68('0x63')]){var _0x1e767a=[_0x5e68('0x68'),_0x5e68('0x69'),_0x5e68('0x6a')];_[_0x5e68('0x6b')](_0x561832[_0x5e68('0x6c')][_0x5e68('0x35')],function(_0x360fed){return _0x1e767a['includes'](_0x360fed[_0x5e68('0x3f')]['name']);});_[_0x5e68('0x6b')](_0x561832['result'][_0x5e68('0x35')],function(_0x38d9fe){return _0x38d9fe['editable']==='false';});return{'count':_0x561832[_0x5e68('0x6c')][_0x5e68('0x35')][_0x5e68('0x36')],'rows':_[_0x5e68('0x3e')](_0x561832['result'][_0x5e68('0x35')],function(_0x3dd6b0){return{'id':_0x3dd6b0[_0x5e68('0x2a')],'name':_0x3dd6b0[_0x5e68('0x6d')],'custom':_[_0x5e68('0x6e')](_0x3dd6b0[_0x5e68('0x2a')],_0x5e68('0x6f'))?!![]:![],'options':_0x3dd6b0['type'][_0x5e68('0x2a')]===_0x5e68('0x70')&&_0x3dd6b0['type'][_0x5e68('0x71')][_0x5e68('0x36')]>0x0?_[_0x5e68('0x3e')](_0x3dd6b0[_0x5e68('0x3f')][_0x5e68('0x71')],function(_0x56ba25){return{'name':_0x56ba25[_0x5e68('0x6d')],'value':_0x56ba25[_0x5e68('0x72')]};}):[]};})};}})[_0x5e68('0x16')](respondWithResult(_0x31c6f1,null))[_0x5e68('0x1f')](function(_0x245f49){console[_0x5e68('0x73')](_0x5e68('0x74')+_0x245f49);var _0x26d552=_0x2964b2[_0x5e68('0x30')]['test']?0x1f4:_0x245f49[_0x5e68('0x75')]||0x1f4;logger[_0x5e68('0x1b')](_0x5e68('0x76'),_0x5e68('0x77'),_0x26d552,JSON[_0x5e68('0x1a')](_0x245f49));delete _0x245f49[_0x5e68('0x2a')];if(_0x26d552===0x191){_0x26d552=0x190;}_0x31c6f1['status'](_0x26d552)[_0x5e68('0x2b')](_0x2964b2['query'][_0x5e68('0x78')]?{'message':_0x5e68('0x79'),'statusCode':_0x245f49['statusCode']}:_0x245f49);});};
\ No newline at end of file
+var _0x536f=['jsforce','desk.js','querystring','../../config/license/hardware','ioredis','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','request','then','info','VtigerAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','save','update','destroy','stack','name','index','VtigerAccount','keys','query','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','merge','type','key','VIRTUAL','field','filter','includeAll','include','rows','rawAttributes','intersection','find','body','findOne','params','VtigerConfiguration','options','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','create','VtigerField','md5','description','remoteUri','serverUrl','accessKey','username','moduleName','substring','lastIndexOf','%s/webservice.php','GET','getchallenge','success','login','token','describe','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','picklist','picklistValues','map','value','log','vTiger\x20error:\x20','test','statusCode','getFields','Wrong\x20credentials','html-pdf','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash'];(function(_0x57513e,_0x51afec){var _0xa5338b=function(_0x583492){while(--_0x583492){_0x57513e['push'](_0x57513e['shift']());}};_0xa5338b(++_0x51afec);}(_0x536f,0x70));var _0xf536=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x536f[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xf536('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf536('0x1'));var moment=require(_0xf536('0x2'));var BPromise=require(_0xf536('0x3'));var Mustache=require(_0xf536('0x4'));var util=require('util');var path=require(_0xf536('0x5'));var sox=require('sox');var csv=require(_0xf536('0x6'));var ejs=require(_0xf536('0x7'));var fs=require('fs');var _=require(_0xf536('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf536('0x9'));var deskjs=require(_0xf536('0xa'));var toCsv=require(_0xf536('0x6'));var querystring=require(_0xf536('0xb'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0xf536('0xc'));var Redis=require(_0xf536('0xd'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xf536('0xe'));var utils=require(_0xf536('0xf'));var config=require(_0xf536('0x10'));var db=require(_0xf536('0x11'))['db'];var integrations=require(_0xf536('0x12'));var jayson=require('jayson/promise');var client=jayson[_0xf536('0x13')]['http']({'port':0x232a});function respondWithRpcPromise(_0x146970,_0xd76d38,_0x11136e,_0x3b5df6){return new BPromise(function(_0x458255,_0x1f8aef){var _0xbae810=_0x3b5df6||client;return _0xbae810[_0xf536('0x14')](_0x146970,_0x11136e)[_0xf536('0x15')](function(_0x1e6f7d){logger[_0xf536('0x16')](_0xf536('0x17'),_0xd76d38,'request\x20sent');logger[_0xf536('0x18')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0xd76d38,_0xf536('0x19'),JSON['stringify'](_0x1e6f7d));if(_0x1e6f7d[_0xf536('0x1a')]){if(_0x1e6f7d[_0xf536('0x1a')][_0xf536('0x1b')]===0x1f4){logger[_0xf536('0x1a')](_0xf536('0x17'),_0xd76d38,_0x1e6f7d[_0xf536('0x1a')][_0xf536('0x1c')]);return _0x1f8aef(_0x1e6f7d[_0xf536('0x1a')]['message']);}logger[_0xf536('0x1a')](_0xf536('0x17'),_0xd76d38,_0x1e6f7d['error']['message']);return _0x458255(_0x1e6f7d[_0xf536('0x1a')][_0xf536('0x1c')]);}else{logger[_0xf536('0x16')](_0xf536('0x17'),_0xd76d38,_0xf536('0x19'));_0x458255(_0x1e6f7d[_0xf536('0x1d')][_0xf536('0x1c')]);}})[_0xf536('0x1e')](function(_0xd0c03a){logger[_0xf536('0x1a')]('VtigerAccount,\x20%s,\x20%s',_0xd76d38,_0xd0c03a);_0x1f8aef(_0xd0c03a);});});}function respondWithStatusCode(_0xad8c36,_0xd305eb){_0xd305eb=_0xd305eb||0xcc;return function(_0x5ed999){if(_0x5ed999){return _0xad8c36[_0xf536('0x1f')](_0xd305eb);}return _0xad8c36[_0xf536('0x20')](_0xd305eb)[_0xf536('0x21')]();};}function respondWithResult(_0x252cae,_0xd5098){_0xd5098=_0xd5098||0xc8;return function(_0x378f48){if(_0x378f48){return _0x252cae[_0xf536('0x20')](_0xd5098)['json'](_0x378f48);}};}function respondWithFilteredResult(_0x225a3c,_0x25114b){return function(_0x2cd4b8){if(_0x2cd4b8){var _0x436d12=_0x2cd4b8[_0xf536('0x22')],_0x19e4c4=_0x25114b[_0xf536('0x23')],_0x5831a1=_0x25114b[_0xf536('0x23')]+_0x25114b['limit'],_0x373af5;if(_0x5831a1>=_0x436d12){_0x5831a1=_0x436d12;_0x373af5=0xc8;}else{_0x373af5=0xce;}_0x225a3c[_0xf536('0x20')](_0x373af5);return _0x225a3c['set'](_0xf536('0x24'),_0x19e4c4+'-'+_0x5831a1+'/'+_0x436d12)[_0xf536('0x25')](_0x2cd4b8);}return null;};}function patchUpdates(_0x430bb7){return function(_0x29300a){try{jsonpatch[_0xf536('0x26')](_0x29300a,_0x430bb7,!![]);}catch(_0x16799d){return BPromise[_0xf536('0x27')](_0x16799d);}return _0x29300a[_0xf536('0x28')]();};}function saveUpdates(_0x3de9ca,_0x17b698){return function(_0x24a8c7){if(_0x24a8c7){return _0x24a8c7[_0xf536('0x29')](_0x3de9ca)['then'](function(_0x3a5297){return _0x3a5297;});}return null;};}function removeEntity(_0x24634b,_0x5b3c9b){return function(_0x2f0dab){if(_0x2f0dab){return _0x2f0dab[_0xf536('0x2a')]()['then'](function(){_0x24634b[_0xf536('0x20')](0xcc)[_0xf536('0x21')]();});}};}function handleEntityNotFound(_0x2df17b,_0x2b397a){return function(_0x4a2fb8){if(!_0x4a2fb8){_0x2df17b[_0xf536('0x1f')](0x194);}return _0x4a2fb8;};}function handleError(_0x86fd56,_0x45a25d){_0x45a25d=_0x45a25d||0x1f4;return function(_0x4ee320){logger[_0xf536('0x1a')](_0x4ee320[_0xf536('0x2b')]);if(_0x4ee320[_0xf536('0x2c')]){delete _0x4ee320[_0xf536('0x2c')];}_0x86fd56[_0xf536('0x20')](_0x45a25d)['send'](_0x4ee320);};}exports[_0xf536('0x2d')]=function(_0x507dec,_0xc45380){var _0x310387={},_0x118910={},_0x4de8c4={'count':0x0,'rows':[]};var _0x16c31c=db[_0xf536('0x2e')]['rawAttributes'];_0x118910['model']=_[_0xf536('0x2f')](_0x16c31c);_0x118910['query']=_[_0xf536('0x2f')](_0x507dec[_0xf536('0x30')]);_0x118910['filters']=_['intersection'](_0x118910[_0xf536('0x31')],_0x118910[_0xf536('0x30')]);_0x310387[_0xf536('0x32')]=_['intersection'](_0x118910[_0xf536('0x31')],qs[_0xf536('0x33')](_0x507dec[_0xf536('0x30')][_0xf536('0x33')]));_0x310387[_0xf536('0x32')]=_0x310387[_0xf536('0x32')][_0xf536('0x34')]?_0x310387[_0xf536('0x32')]:_0x118910[_0xf536('0x31')];if(!_0x507dec[_0xf536('0x30')][_0xf536('0x35')](_0xf536('0x36'))){_0x310387[_0xf536('0x37')]=qs[_0xf536('0x37')](_0x507dec[_0xf536('0x30')]['limit']);_0x310387[_0xf536('0x23')]=qs[_0xf536('0x23')](_0x507dec[_0xf536('0x30')]['offset']);}_0x310387[_0xf536('0x38')]=qs[_0xf536('0x39')](_0x507dec[_0xf536('0x30')][_0xf536('0x39')]);_0x310387['where']=qs[_0xf536('0x3a')](_[_0xf536('0x3b')](_0x507dec[_0xf536('0x30')],_0x118910[_0xf536('0x3a')]));if(_0x507dec[_0xf536('0x30')]['filter']){_0x310387[_0xf536('0x3c')]=_[_0xf536('0x3d')](_0x310387[_0xf536('0x3c')],{'$or':_['map'](_0x16c31c,function(_0x17867a){if(_0x17867a[_0xf536('0x3e')][_0xf536('0x3f')]!==_0xf536('0x40')){var _0x56b40c={};_0x56b40c[_0x17867a[_0xf536('0x41')]]={'$like':'%'+_0x507dec[_0xf536('0x30')][_0xf536('0x42')]+'%'};return _0x56b40c;}})});}_0x310387=_[_0xf536('0x3d')]({},_0x310387,_0x507dec['options']);var _0x3eae9e={'where':_0x310387['where']};return db['VtigerAccount'][_0xf536('0x22')](_0x3eae9e)[_0xf536('0x15')](function(_0x2c66e1){_0x4de8c4['count']=_0x2c66e1;if(_0x507dec[_0xf536('0x30')][_0xf536('0x43')]){_0x310387[_0xf536('0x44')]=[{'all':!![]}];}return db[_0xf536('0x2e')]['findAll'](_0x310387);})[_0xf536('0x15')](function(_0x2a99a1){_0x4de8c4[_0xf536('0x45')]=_0x2a99a1;return _0x4de8c4;})[_0xf536('0x15')](respondWithFilteredResult(_0xc45380,_0x310387))[_0xf536('0x1e')](handleError(_0xc45380,null));};exports['show']=function(_0x4a8ab7,_0x4f9d4b){var _0x2662f8={'raw':![],'where':{'id':_0x4a8ab7['params']['id']}},_0x41de62={};_0x41de62[_0xf536('0x31')]=_[_0xf536('0x2f')](db[_0xf536('0x2e')][_0xf536('0x46')]);_0x41de62['query']=_['keys'](_0x4a8ab7[_0xf536('0x30')]);_0x41de62['filters']=_[_0xf536('0x47')](_0x41de62['model'],_0x41de62[_0xf536('0x30')]);_0x2662f8[_0xf536('0x32')]=_[_0xf536('0x47')](_0x41de62[_0xf536('0x31')],qs['fields'](_0x4a8ab7[_0xf536('0x30')][_0xf536('0x33')]));_0x2662f8[_0xf536('0x32')]=_0x2662f8[_0xf536('0x32')]['length']?_0x2662f8[_0xf536('0x32')]:_0x41de62['model'];if(_0x4a8ab7['query'][_0xf536('0x43')]){_0x2662f8[_0xf536('0x44')]=[{'all':!![]}];}_0x2662f8=_[_0xf536('0x3d')]({},_0x2662f8,_0x4a8ab7['options']);return db[_0xf536('0x2e')][_0xf536('0x48')](_0x2662f8)[_0xf536('0x15')](handleEntityNotFound(_0x4f9d4b,null))[_0xf536('0x15')](respondWithResult(_0x4f9d4b,null))['catch'](handleError(_0x4f9d4b,null));};exports['create']=function(_0x669a69,_0x21b320){return db[_0xf536('0x2e')]['create'](_0x669a69['body'],{})[_0xf536('0x15')](respondWithResult(_0x21b320,0xc9))[_0xf536('0x1e')](handleError(_0x21b320,null));};exports[_0xf536('0x29')]=function(_0x68842,_0x4728ac){if(_0x68842['body']['id']){delete _0x68842[_0xf536('0x49')]['id'];}return db['VtigerAccount'][_0xf536('0x48')]({'where':{'id':_0x68842['params']['id']}})['then'](handleEntityNotFound(_0x4728ac,null))['then'](saveUpdates(_0x68842['body'],null))[_0xf536('0x15')](respondWithResult(_0x4728ac,null))[_0xf536('0x1e')](handleError(_0x4728ac,null));};exports[_0xf536('0x2a')]=function(_0x47b1fd,_0x35ba20){return db[_0xf536('0x2e')][_0xf536('0x48')]({'where':{'id':_0x47b1fd['params']['id']}})[_0xf536('0x15')](handleEntityNotFound(_0x35ba20,null))['then'](removeEntity(_0x35ba20,null))[_0xf536('0x1e')](handleError(_0x35ba20,null));};exports['getConfigurations']=function(_0x4aecd9,_0x2946d1,_0x298571){var _0x4cba67={};var _0x2d7715={};var _0x3f5378;var _0x43b1c6;return db[_0xf536('0x2e')][_0xf536('0x4a')]({'where':{'id':_0x4aecd9[_0xf536('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2946d1,null))['then'](function(_0xf60af2){if(_0xf60af2){_0x3f5378=_0xf60af2;_0x2d7715[_0xf536('0x31')]=_[_0xf536('0x2f')](db[_0xf536('0x4c')][_0xf536('0x46')]);_0x2d7715[_0xf536('0x30')]=_['keys'](_0x4aecd9[_0xf536('0x30')]);_0x2d7715[_0xf536('0x3a')]=_[_0xf536('0x47')](_0x2d7715['model'],_0x2d7715[_0xf536('0x30')]);_0x4cba67[_0xf536('0x32')]=_[_0xf536('0x47')](_0x2d7715[_0xf536('0x31')],qs[_0xf536('0x33')](_0x4aecd9[_0xf536('0x30')]['fields']));_0x4cba67[_0xf536('0x32')]=_0x4cba67[_0xf536('0x32')][_0xf536('0x34')]?_0x4cba67['attributes']:_0x2d7715[_0xf536('0x31')];_0x4cba67[_0xf536('0x38')]=qs[_0xf536('0x39')](_0x4aecd9[_0xf536('0x30')][_0xf536('0x39')]);_0x4cba67['where']=qs['filters'](_[_0xf536('0x3b')](_0x4aecd9[_0xf536('0x30')],_0x2d7715[_0xf536('0x3a')]));if(_0x4aecd9[_0xf536('0x30')]['filter']){_0x4cba67[_0xf536('0x3c')]=_['merge'](_0x4cba67[_0xf536('0x3c')],{'$or':_['map'](_0x4cba67[_0xf536('0x32')],function(_0x2cd59c){var _0x15a631={};_0x15a631[_0x2cd59c]={'$like':'%'+_0x4aecd9[_0xf536('0x30')]['filter']+'%'};return _0x15a631;})});}_0x4cba67=_[_0xf536('0x3d')]({},_0x4cba67,_0x4aecd9[_0xf536('0x4d')]);return _0x3f5378[_0xf536('0x4e')](_0x4cba67);}})[_0xf536('0x15')](function(_0x5d6f63){if(_0x5d6f63){_0x43b1c6=_0x5d6f63[_0xf536('0x34')];if(!_0x4aecd9[_0xf536('0x30')][_0xf536('0x35')](_0xf536('0x36'))){_0x4cba67[_0xf536('0x37')]=qs[_0xf536('0x37')](_0x4aecd9[_0xf536('0x30')][_0xf536('0x37')]);_0x4cba67[_0xf536('0x23')]=qs['offset'](_0x4aecd9[_0xf536('0x30')][_0xf536('0x23')]);}return _0x3f5378[_0xf536('0x4e')](_0x4cba67);}})[_0xf536('0x15')](function(_0x1c15a2){if(_0x1c15a2){return _0x1c15a2?{'count':_0x43b1c6,'rows':_0x1c15a2}:null;}})[_0xf536('0x15')](respondWithResult(_0x2946d1,null))[_0xf536('0x1e')](handleError(_0x2946d1,null));};exports[_0xf536('0x4f')]=function(_0x4f918c,_0x5a66e6,_0x19b8bf){if(_0x4f918c['body']['id']){delete _0x4f918c[_0xf536('0x49')]['id'];}return db['VtigerAccount'][_0xf536('0x4a')]({'where':{'id':_0x4f918c['params']['id']}})[_0xf536('0x15')](handleEntityNotFound(_0x5a66e6,null))['then'](function(_0x4359ad){if(_0x4359ad){_0x4f918c[_0xf536('0x49')]['AccountId']=_0x4359ad['id'];_0x4f918c[_0xf536('0x49')][_0xf536('0x50')]=integrations[_0xf536('0x51')](_0x4f918c[_0xf536('0x49')][_0xf536('0x52')],_0x4f918c[_0xf536('0x49')][_0xf536('0x3e')]);_0x4f918c['body'][_0xf536('0x53')]=integrations['getDescriptions'](_0x4f918c['body'][_0xf536('0x52')],_0x4f918c['body'][_0xf536('0x3e')]);return db['VtigerConfiguration'][_0xf536('0x54')](_0x4f918c['body'],{'include':[{'model':db[_0xf536('0x55')],'as':_0xf536('0x50')},{'model':db[_0xf536('0x55')],'as':_0xf536('0x53')}]});}return null;})[_0xf536('0x15')](respondWithResult(_0x5a66e6,null))[_0xf536('0x1e')](handleError(_0x5a66e6,null));};var md5=require(_0xf536('0x56'));exports['getFields']=function(_0x43358f,_0xb9fffd,_0x42aa25){var _0x4c2d9b=null;var _0xbcad5b=null;var _0x5439c9=null;var _0x3a3cc2=null;var _0x302460='';return db['VtigerAccount']['findOne']({'where':{'id':_0x43358f['params']['id']},'attributes':['id','name','username',_0xf536('0x57'),'moduleName',_0xf536('0x58'),_0xf536('0x59'),_0xf536('0x5a')]})[_0xf536('0x15')](handleEntityNotFound(_0xb9fffd,null))[_0xf536('0x15')](function(_0x444bcc){if(_0x444bcc){_0x4c2d9b=_0x444bcc[_0xf536('0x5b')];_0xbcad5b=_0x444bcc[_0xf536('0x5a')];_0x5439c9=_0x444bcc[_0xf536('0x5c')];_0x302460=_0x444bcc[_0xf536('0x58')];var _0x5efa6b=_0x302460['slice'](-0x1);if(_0x5efa6b==='/'){_0x302460=_0x302460[_0xf536('0x5d')](0x0,_0x302460[_0xf536('0x5e')](_0x5efa6b));}_0x3a3cc2=util['format'](_0xf536('0x5f'),_0x302460);var _0x2a9cbd={'method':_0xf536('0x60'),'uri':_0x3a3cc2,'qs':{'operation':_0xf536('0x61'),'username':_0x444bcc[_0xf536('0x5b')]},'json':!![]};return rp(_0x2a9cbd);}})[_0xf536('0x15')](function(_0x107151){if(_0x107151[_0xf536('0x62')]){var _0x1b2886={'method':'POST','uri':_0x3a3cc2,'form':{'operation':_0xf536('0x63'),'username':_0x4c2d9b,'accessKey':md5(_0x107151[_0xf536('0x1d')][_0xf536('0x64')]+_0xbcad5b)},'json':!![]};return rp(_0x1b2886);}})[_0xf536('0x15')](function(_0x2c63f7){if(_0x2c63f7[_0xf536('0x62')]){var _0x486a2={'method':_0xf536('0x60'),'uri':_0x3a3cc2,'qs':{'operation':_0xf536('0x65'),'username':_0x4c2d9b,'sessionName':_0x2c63f7[_0xf536('0x1d')]['sessionName'],'elementType':_0x5439c9},'json':!![]};return rp(_0x486a2);}})[_0xf536('0x15')](function(_0x12224f){if(_0x12224f['success']){var _0x1eb77f=[_0xf536('0x66'),_0xf536('0x67'),_0xf536('0x68')];_[_0xf536('0x69')](_0x12224f[_0xf536('0x1d')][_0xf536('0x33')],function(_0xdf59a4){return _0x1eb77f[_0xf536('0x6a')](_0xdf59a4[_0xf536('0x3e')][_0xf536('0x2c')]);});_[_0xf536('0x69')](_0x12224f[_0xf536('0x1d')][_0xf536('0x33')],function(_0x4d2836){return _0x4d2836[_0xf536('0x6b')]===_0xf536('0x6c');});return{'count':_0x12224f[_0xf536('0x1d')][_0xf536('0x33')][_0xf536('0x34')],'rows':_['map'](_0x12224f[_0xf536('0x1d')][_0xf536('0x33')],function(_0x27de15){return{'id':_0x27de15[_0xf536('0x2c')],'name':_0x27de15[_0xf536('0x6d')],'custom':_[_0xf536('0x6e')](_0x27de15[_0xf536('0x2c')],'cf_')?!![]:![],'options':_0x27de15[_0xf536('0x3e')][_0xf536('0x2c')]===_0xf536('0x6f')&&_0x27de15[_0xf536('0x3e')][_0xf536('0x70')]['length']>0x0?_[_0xf536('0x71')](_0x27de15[_0xf536('0x3e')][_0xf536('0x70')],function(_0x3205fa){return{'name':_0x3205fa[_0xf536('0x6d')],'value':_0x3205fa[_0xf536('0x72')]};}):[]};})};}})[_0xf536('0x15')](respondWithResult(_0xb9fffd,null))['catch'](function(_0x308629){console[_0xf536('0x73')](_0xf536('0x74')+_0x308629);var _0x1a05ed=_0x43358f[_0xf536('0x30')][_0xf536('0x75')]?0x1f4:_0x308629[_0xf536('0x76')]||0x1f4;logger[_0xf536('0x1a')]('getFields,\x20%s,\x20%s,\x20%s',_0xf536('0x77'),_0x1a05ed,JSON['stringify'](_0x308629));delete _0x308629[_0xf536('0x2c')];if(_0x1a05ed===0x191){_0x1a05ed=0x190;}_0xb9fffd[_0xf536('0x20')](_0x1a05ed)['send'](_0x43358f[_0xf536('0x30')][_0xf536('0x75')]?{'message':_0xf536('0x78'),'statusCode':_0x308629[_0xf536('0x76')]}:_0x308629);});};
\ No newline at end of file
index 1fc824a..23d7926 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9faf=['api','moment','request-promise','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','int_vtiger_accounts','util','../../config/logger'];(function(_0x308375,_0x3a93cc){var _0x18d40c=function(_0x21bbbf){while(--_0x21bbbf){_0x308375['push'](_0x308375['shift']());}};_0x18d40c(++_0x3a93cc);}(_0x9faf,0x184));var _0xf9fa=function(_0x45b34e,_0x549706){_0x45b34e=_0x45b34e-0x0;var _0x130dd6=_0x9faf[_0x45b34e];return _0x130dd6;};'use strict';var _=require('lodash');var util=require(_0xf9fa('0x0'));var logger=require(_0xf9fa('0x1'))(_0xf9fa('0x2'));var moment=require(_0xf9fa('0x3'));var BPromise=require('bluebird');var rp=require(_0xf9fa('0x4'));var attributes=require(_0xf9fa('0x5'));var integrations=require(_0xf9fa('0x6'));module[_0xf9fa('0x7')]=function(_0x1bf2a2,_0x4c46e0){return _0x1bf2a2[_0xf9fa('0x8')]('VtigerAccount',attributes,{'tableName':_0xf9fa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x09e3=['./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','int_vtiger_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x32c012,_0xe3c576){var _0x48562e=function(_0x505228){while(--_0x505228){_0x32c012['push'](_0x32c012['shift']());}};_0x48562e(++_0xe3c576);}(_0x09e3,0x1de));var _0x309e=function(_0x331ca1,_0x182b6a){_0x331ca1=_0x331ca1-0x0;var _0x3a0b97=_0x09e3[_0x331ca1];return _0x3a0b97;};'use strict';var _=require(_0x309e('0x0'));var util=require('util');var logger=require(_0x309e('0x1'))(_0x309e('0x2'));var moment=require(_0x309e('0x3'));var BPromise=require(_0x309e('0x4'));var rp=require(_0x309e('0x5'));var attributes=require(_0x309e('0x6'));var integrations=require(_0x309e('0x7'));module[_0x309e('0x8')]=function(_0x33da13,_0x10490b){return _0x33da13[_0x309e('0x9')]('VtigerAccount',attributes,{'tableName':_0x309e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index bdbd248..1956940 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x38df=['http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','options','raw','attributes','include','map','model','ShowVtigerAccount','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4a2f8f,_0x21a198){var _0x1ea8a6=function(_0x8a7fc){while(--_0x8a7fc){_0x4a2f8f['push'](_0x4a2f8f['shift']());}};_0x1ea8a6(++_0x21a198);}(_0x38df,0x117));var _0xf38d=function(_0x2ffd05,_0x1840e3){_0x2ffd05=_0x2ffd05-0x0;var _0x5038bf=_0x38df[_0x2ffd05];return _0x5038bf;};'use strict';var _=require('lodash');var util=require(_0xf38d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf38d('0x1'));var fs=require('fs');var Redis=require(_0xf38d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf38d('0x3'));var logger=require(_0xf38d('0x4'))(_0xf38d('0x5'));var config=require(_0xf38d('0x6'));var jayson=require(_0xf38d('0x7'));var client=jayson[_0xf38d('0x8')][_0xf38d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13b687,_0x92287a,_0x136d91){return new BPromise(function(_0x3152b1,_0x29c6b2){return client[_0xf38d('0xa')](_0x13b687,_0x136d91)[_0xf38d('0xb')](function(_0x1e0ee3){logger[_0xf38d('0xc')](_0xf38d('0xd'),_0x92287a,_0xf38d('0xe'));logger[_0xf38d('0xf')](_0xf38d('0x10'),_0x92287a,'request\x20sent',JSON[_0xf38d('0x11')](_0x1e0ee3));if(_0x1e0ee3[_0xf38d('0x12')]){if(_0x1e0ee3[_0xf38d('0x12')][_0xf38d('0x13')]===0x1f4){logger[_0xf38d('0x12')](_0xf38d('0xd'),_0x92287a,_0x1e0ee3[_0xf38d('0x12')][_0xf38d('0x14')]);return _0x29c6b2(_0x1e0ee3[_0xf38d('0x12')][_0xf38d('0x14')]);}logger[_0xf38d('0x12')](_0xf38d('0xd'),_0x92287a,_0x1e0ee3[_0xf38d('0x12')][_0xf38d('0x14')]);return _0x3152b1(_0x1e0ee3[_0xf38d('0x12')][_0xf38d('0x14')]);}else{logger[_0xf38d('0xc')](_0xf38d('0xd'),_0x92287a,_0xf38d('0xe'));_0x3152b1(_0x1e0ee3[_0xf38d('0x15')][_0xf38d('0x14')]);}})[_0xf38d('0x16')](function(_0x1a32b3){logger['error'](_0xf38d('0xd'),_0x92287a,_0x1a32b3);_0x29c6b2(_0x1a32b3);});});}exports[_0xf38d('0x17')]=function(_0x47e025){var _0x3ba8ed=this;return new Promise(function(_0x5456d6,_0x392549){return db[_0xf38d('0x18')]['findAll']({'raw':_0x47e025[_0xf38d('0x19')]?_0x47e025[_0xf38d('0x19')][_0xf38d('0x1a')]===undefined?!![]:![]:!![],'where':_0x47e025['options']?_0x47e025[_0xf38d('0x19')]['where']||null:null,'attributes':_0x47e025[_0xf38d('0x19')]?_0x47e025[_0xf38d('0x19')][_0xf38d('0x1b')]||null:null,'limit':_0x47e025[_0xf38d('0x19')]?_0x47e025[_0xf38d('0x19')]['limit']||null:null,'include':_0x47e025['options']?_0x47e025[_0xf38d('0x19')][_0xf38d('0x1c')]?_[_0xf38d('0x1d')](_0x47e025[_0xf38d('0x19')][_0xf38d('0x1c')],function(_0x2ce6be){return{'model':db[_0x2ce6be[_0xf38d('0x1e')]],'as':_0x2ce6be['as'],'attributes':_0x2ce6be[_0xf38d('0x1b')],'include':_0x2ce6be[_0xf38d('0x1c')]?_[_0xf38d('0x1d')](_0x2ce6be[_0xf38d('0x1c')],function(_0x4f6a30){return{'model':db[_0x4f6a30[_0xf38d('0x1e')]],'as':_0x4f6a30['as'],'attributes':_0x4f6a30[_0xf38d('0x1b')],'include':_0x4f6a30[_0xf38d('0x1c')]?_[_0xf38d('0x1d')](_0x4f6a30[_0xf38d('0x1c')],function(_0x1790be){return{'model':db[_0x1790be[_0xf38d('0x1e')]],'as':_0x1790be['as'],'attributes':_0x1790be[_0xf38d('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x282308){logger[_0xf38d('0xc')](_0xf38d('0x17'),_0x47e025);logger[_0xf38d('0xf')](_0xf38d('0x17'),_0x47e025,JSON[_0xf38d('0x11')](_0x282308));_0x5456d6(_0x282308);})[_0xf38d('0x16')](function(_0x5d07b3){logger[_0xf38d('0x12')](_0xf38d('0x17'),_0x5d07b3[_0xf38d('0x14')],_0x47e025);_0x392549(_0x3ba8ed[_0xf38d('0x12')](0x1f4,_0x5d07b3['message']));});});};exports[_0xf38d('0x1f')]=function(_0x2073d8){var _0x2b573a=this;return new Promise(function(_0x4d9b69,_0x289743){return db[_0xf38d('0x18')]['find']({'raw':_0x2073d8[_0xf38d('0x19')]?_0x2073d8[_0xf38d('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2073d8[_0xf38d('0x19')]?_0x2073d8[_0xf38d('0x19')]['where']||null:null,'attributes':_0x2073d8[_0xf38d('0x19')]?_0x2073d8[_0xf38d('0x19')][_0xf38d('0x1b')]||null:null,'include':_0x2073d8[_0xf38d('0x19')]?_0x2073d8[_0xf38d('0x19')][_0xf38d('0x1c')]?_[_0xf38d('0x1d')](_0x2073d8[_0xf38d('0x19')][_0xf38d('0x1c')],function(_0x4980af){return{'model':db[_0x4980af[_0xf38d('0x1e')]],'as':_0x4980af['as'],'attributes':_0x4980af[_0xf38d('0x1b')],'include':_0x4980af[_0xf38d('0x1c')]?_[_0xf38d('0x1d')](_0x4980af[_0xf38d('0x1c')],function(_0x3c7fad){return{'model':db[_0x3c7fad['model']],'as':_0x3c7fad['as'],'attributes':_0x3c7fad[_0xf38d('0x1b')],'include':_0x3c7fad[_0xf38d('0x1c')]?_[_0xf38d('0x1d')](_0x3c7fad[_0xf38d('0x1c')],function(_0x283461){return{'model':db[_0x283461[_0xf38d('0x1e')]],'as':_0x283461['as'],'attributes':_0x283461[_0xf38d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf38d('0xb')](function(_0x59063e){logger[_0xf38d('0xc')](_0xf38d('0x1f'),_0x2073d8);logger['debug'](_0xf38d('0x1f'),_0x2073d8,JSON[_0xf38d('0x11')](_0x59063e));_0x4d9b69(_0x59063e);})['catch'](function(_0x4c5fcb){logger[_0xf38d('0x12')](_0xf38d('0x1f'),_0x4c5fcb['message'],_0x2073d8);_0x289743(_0x2b573a[_0xf38d('0x12')](0x1f4,_0x4c5fcb[_0xf38d('0x14')]));});});};
\ No newline at end of file
+var _0x6327=['message','request\x20sent','result','catch','GetVtigerAccount','VtigerAccount','options','raw','attributes','limit','include','map','model','ShowVtigerAccount','find','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x503950,_0x5022eb){var _0x1657a9=function(_0x4c1e8f){while(--_0x4c1e8f){_0x503950['push'](_0x503950['shift']());}};_0x1657a9(++_0x5022eb);}(_0x6327,0x1cc));var _0x7632=function(_0x3238ea,_0x91809d){_0x3238ea=_0x3238ea-0x0;var _0x4aaac2=_0x6327[_0x3238ea];return _0x4aaac2;};'use strict';var _=require(_0x7632('0x0'));var util=require(_0x7632('0x1'));var moment=require(_0x7632('0x2'));var BPromise=require(_0x7632('0x3'));var rs=require(_0x7632('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7632('0x5'))['db'];var utils=require(_0x7632('0x6'));var logger=require(_0x7632('0x7'))('rpc');var config=require(_0x7632('0x8'));var jayson=require(_0x7632('0x9'));var client=jayson[_0x7632('0xa')][_0x7632('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a78b3,_0x37d090,_0x113f8d){return new BPromise(function(_0x53414a,_0x5a12c8){return client[_0x7632('0xc')](_0x2a78b3,_0x113f8d)[_0x7632('0xd')](function(_0x36d6b8){logger[_0x7632('0xe')](_0x7632('0xf'),_0x37d090,'request\x20sent');logger[_0x7632('0x10')](_0x7632('0x11'),_0x37d090,'request\x20sent',JSON[_0x7632('0x12')](_0x36d6b8));if(_0x36d6b8['error']){if(_0x36d6b8[_0x7632('0x13')][_0x7632('0x14')]===0x1f4){logger[_0x7632('0x13')](_0x7632('0xf'),_0x37d090,_0x36d6b8[_0x7632('0x13')][_0x7632('0x15')]);return _0x5a12c8(_0x36d6b8[_0x7632('0x13')]['message']);}logger['error'](_0x7632('0xf'),_0x37d090,_0x36d6b8['error'][_0x7632('0x15')]);return _0x53414a(_0x36d6b8[_0x7632('0x13')][_0x7632('0x15')]);}else{logger[_0x7632('0xe')](_0x7632('0xf'),_0x37d090,_0x7632('0x16'));_0x53414a(_0x36d6b8[_0x7632('0x17')][_0x7632('0x15')]);}})[_0x7632('0x18')](function(_0x116816){logger[_0x7632('0x13')](_0x7632('0xf'),_0x37d090,_0x116816);_0x5a12c8(_0x116816);});});}exports[_0x7632('0x19')]=function(_0x25ea81){var _0x28db6e=this;return new Promise(function(_0x4bbffa,_0x1eae99){return db[_0x7632('0x1a')]['findAll']({'raw':_0x25ea81[_0x7632('0x1b')]?_0x25ea81[_0x7632('0x1b')][_0x7632('0x1c')]===undefined?!![]:![]:!![],'where':_0x25ea81[_0x7632('0x1b')]?_0x25ea81[_0x7632('0x1b')]['where']||null:null,'attributes':_0x25ea81[_0x7632('0x1b')]?_0x25ea81[_0x7632('0x1b')][_0x7632('0x1d')]||null:null,'limit':_0x25ea81[_0x7632('0x1b')]?_0x25ea81[_0x7632('0x1b')][_0x7632('0x1e')]||null:null,'include':_0x25ea81[_0x7632('0x1b')]?_0x25ea81['options']['include']?_['map'](_0x25ea81[_0x7632('0x1b')][_0x7632('0x1f')],function(_0x15d485){return{'model':db[_0x15d485['model']],'as':_0x15d485['as'],'attributes':_0x15d485['attributes'],'include':_0x15d485[_0x7632('0x1f')]?_[_0x7632('0x20')](_0x15d485[_0x7632('0x1f')],function(_0x550313){return{'model':db[_0x550313[_0x7632('0x21')]],'as':_0x550313['as'],'attributes':_0x550313[_0x7632('0x1d')],'include':_0x550313[_0x7632('0x1f')]?_[_0x7632('0x20')](_0x550313[_0x7632('0x1f')],function(_0x399f49){return{'model':db[_0x399f49[_0x7632('0x21')]],'as':_0x399f49['as'],'attributes':_0x399f49[_0x7632('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7632('0xd')](function(_0x12a7f2){logger['info'](_0x7632('0x19'),_0x25ea81);logger[_0x7632('0x10')](_0x7632('0x19'),_0x25ea81,JSON[_0x7632('0x12')](_0x12a7f2));_0x4bbffa(_0x12a7f2);})[_0x7632('0x18')](function(_0x285096){logger['error']('GetVtigerAccount',_0x285096[_0x7632('0x15')],_0x25ea81);_0x1eae99(_0x28db6e[_0x7632('0x13')](0x1f4,_0x285096['message']));});});};exports[_0x7632('0x22')]=function(_0x4ddb09){var _0x9e36de=this;return new Promise(function(_0x3cd584,_0x3a1a71){return db[_0x7632('0x1a')][_0x7632('0x23')]({'raw':_0x4ddb09['options']?_0x4ddb09[_0x7632('0x1b')][_0x7632('0x1c')]===undefined?!![]:![]:!![],'where':_0x4ddb09[_0x7632('0x1b')]?_0x4ddb09[_0x7632('0x1b')][_0x7632('0x24')]||null:null,'attributes':_0x4ddb09[_0x7632('0x1b')]?_0x4ddb09[_0x7632('0x1b')][_0x7632('0x1d')]||null:null,'include':_0x4ddb09[_0x7632('0x1b')]?_0x4ddb09[_0x7632('0x1b')][_0x7632('0x1f')]?_[_0x7632('0x20')](_0x4ddb09[_0x7632('0x1b')]['include'],function(_0x5abf49){return{'model':db[_0x5abf49[_0x7632('0x21')]],'as':_0x5abf49['as'],'attributes':_0x5abf49[_0x7632('0x1d')],'include':_0x5abf49[_0x7632('0x1f')]?_[_0x7632('0x20')](_0x5abf49[_0x7632('0x1f')],function(_0x4ebcf4){return{'model':db[_0x4ebcf4[_0x7632('0x21')]],'as':_0x4ebcf4['as'],'attributes':_0x4ebcf4[_0x7632('0x1d')],'include':_0x4ebcf4[_0x7632('0x1f')]?_['map'](_0x4ebcf4['include'],function(_0x377835){return{'model':db[_0x377835['model']],'as':_0x377835['as'],'attributes':_0x377835[_0x7632('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7632('0xd')](function(_0x477c53){logger[_0x7632('0xe')](_0x7632('0x22'),_0x4ddb09);logger[_0x7632('0x10')]('ShowVtigerAccount',_0x4ddb09,JSON[_0x7632('0x12')](_0x477c53));_0x3cd584(_0x477c53);})['catch'](function(_0x4e2fd3){logger[_0x7632('0x13')](_0x7632('0x22'),_0x4e2fd3[_0x7632('0x15')],_0x4ddb09);_0x3a1a71(_0x9e36de[_0x7632('0x13')](0x1f4,_0x4e2fd3['message']));});});};
\ No newline at end of file
index 3e393a3..ab192c2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd8b0=['isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','index','get','/:id','show'];(function(_0x32e649,_0x228649){var _0x14d386=function(_0x3fb3ed){while(--_0x3fb3ed){_0x32e649['push'](_0x32e649['shift']());}};_0x14d386(++_0x228649);}(_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 auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/fields',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x8')](_0x0d8b('0xf'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['post']('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);module[_0x0d8b('0x16')]=router;
\ No newline at end of file
+var _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x14fda8,_0xa932ad){var _0x41b9ba=function(_0x3dbae1){while(--_0x3dbae1){_0x14fda8['push'](_0x14fda8['shift']());}};_0x41b9ba(++_0xa932ad);}(_0xb10b,0x12a));var _0xbb10=function(_0x438912,_0x3f7f74){_0x438912=_0x438912-0x0;var _0x18112f=_0xb10b[_0x438912];return _0x18112f;};'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 auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router;
\ No newline at end of file
index bc64aad..9eaebcc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1cc6=['sequelize','exports','STRING'];(function(_0x128cac,_0x5bed99){var _0x4bc54a=function(_0x32914f){while(--_0x32914f){_0x128cac['push'](_0x128cac['shift']());}};_0x4bc54a(++_0x5bed99);}(_0x1cc6,0x66));var _0x61cc=function(_0x2c3a8f,_0x374e56){_0x2c3a8f=_0x2c3a8f-0x0;var _0x189412=_0x1cc6[_0x2c3a8f];return _0x189412;};'use strict';var Sequelize=require(_0x61cc('0x0'));module[_0x61cc('0x1')]={'name':{'type':Sequelize[_0x61cc('0x2')]},'description':{'type':Sequelize[_0x61cc('0x2')]}};
\ No newline at end of file
+var _0xd521=['STRING','sequelize'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0xd521,0x7d));var _0x1d52=function(_0x3c9777,_0x1105b1){_0x3c9777=_0x3c9777-0x0;var _0x794604=_0xd521[_0x3c9777];return _0x794604;};'use strict';var Sequelize=require(_0x1d52('0x0'));module['exports']={'name':{'type':Sequelize[_0x1d52('0x1')]},'description':{'type':Sequelize[_0x1d52('0x1')]}};
\ No newline at end of file
index 86a95dd..dd11e3b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xffc0=['getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','http','request','then','info','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','message','VtigerConfiguration,\x20%s,\x20%s','result','catch','sendStatus','json','offset','set','apply','reject','save','update','destroy','status','stack','name','send','index','VtigerConfiguration','rawAttributes','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','type','VIRTUAL','filter','options','count','include','findAll','rows','params','filters','create','body','getFields','findOne','VtigerField','map','pick'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0xffc0,0x1a0));var _0x0ffc=function(_0x3304ba,_0x5df355){_0x3304ba=_0x3304ba-0x0;var _0x44dd4c=_0xffc0[_0x3304ba];return _0x44dd4c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0ffc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0ffc('0x1'));var jsonpatch=require(_0x0ffc('0x2'));var rp=require(_0x0ffc('0x3'));var moment=require(_0x0ffc('0x4'));var BPromise=require(_0x0ffc('0x5'));var Mustache=require(_0x0ffc('0x6'));var util=require(_0x0ffc('0x7'));var path=require('path');var sox=require(_0x0ffc('0x8'));var csv=require(_0x0ffc('0x9'));var ejs=require(_0x0ffc('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0ffc('0xb'));var jsforce=require(_0x0ffc('0xc'));var deskjs=require(_0x0ffc('0xd'));var toCsv=require(_0x0ffc('0x9'));var querystring=require('querystring');var Papa=require(_0x0ffc('0xe'));var authService=require(_0x0ffc('0xf'));var hardwareService=require(_0x0ffc('0x10'));var Redis=require(_0x0ffc('0x11'));var qs=require(_0x0ffc('0x12'));var logger=require(_0x0ffc('0x13'))(_0x0ffc('0x14'));var utils=require(_0x0ffc('0x15'));var config=require('../../config/environment');var db=require(_0x0ffc('0x16'))['db'];var jayson=require(_0x0ffc('0x17'));var client=jayson['client'][_0x0ffc('0x18')]({'port':0x232a});function respondWithRpcPromise(_0xbf12d1,_0x9622fe,_0x59d73e,_0x15f5f8){return new BPromise(function(_0x232345,_0x47a80b){var _0x2095df=_0x15f5f8||client;return _0x2095df[_0x0ffc('0x19')](_0xbf12d1,_0x59d73e)[_0x0ffc('0x1a')](function(_0x11a5ee){logger[_0x0ffc('0x1b')]('VtigerConfiguration,\x20%s,\x20%s',_0x9622fe,_0x0ffc('0x1c'));logger['debug'](_0x0ffc('0x1d'),_0x9622fe,_0x0ffc('0x1c'),JSON['stringify'](_0x11a5ee));if(_0x11a5ee[_0x0ffc('0x1e')]){if(_0x11a5ee['error']['code']===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x9622fe,_0x11a5ee[_0x0ffc('0x1e')][_0x0ffc('0x1f')]);return _0x47a80b(_0x11a5ee[_0x0ffc('0x1e')][_0x0ffc('0x1f')]);}logger[_0x0ffc('0x1e')]('VtigerConfiguration,\x20%s,\x20%s',_0x9622fe,_0x11a5ee['error'][_0x0ffc('0x1f')]);return _0x232345(_0x11a5ee['error']['message']);}else{logger[_0x0ffc('0x1b')](_0x0ffc('0x20'),_0x9622fe,'request\x20sent');_0x232345(_0x11a5ee[_0x0ffc('0x21')][_0x0ffc('0x1f')]);}})[_0x0ffc('0x22')](function(_0x527fd4){logger['error'](_0x0ffc('0x20'),_0x9622fe,_0x527fd4);_0x47a80b(_0x527fd4);});});}function respondWithStatusCode(_0x2721b6,_0x418150){_0x418150=_0x418150||0xcc;return function(_0x948451){if(_0x948451){return _0x2721b6[_0x0ffc('0x23')](_0x418150);}return _0x2721b6['status'](_0x418150)['end']();};}function respondWithResult(_0x3e1180,_0x529415){_0x529415=_0x529415||0xc8;return function(_0x154ffe){if(_0x154ffe){return _0x3e1180['status'](_0x529415)[_0x0ffc('0x24')](_0x154ffe);}};}function respondWithFilteredResult(_0x136b0a,_0x23b14e){return function(_0x1265f5){if(_0x1265f5){var _0x3968cc=_0x1265f5['count'],_0x34bce1=_0x23b14e[_0x0ffc('0x25')],_0x20db15=_0x23b14e[_0x0ffc('0x25')]+_0x23b14e['limit'],_0x4a2794;if(_0x20db15>=_0x3968cc){_0x20db15=_0x3968cc;_0x4a2794=0xc8;}else{_0x4a2794=0xce;}_0x136b0a['status'](_0x4a2794);return _0x136b0a[_0x0ffc('0x26')]('Content-Range',_0x34bce1+'-'+_0x20db15+'/'+_0x3968cc)[_0x0ffc('0x24')](_0x1265f5);}return null;};}function patchUpdates(_0x5d3cff){return function(_0x4ece4f){try{jsonpatch[_0x0ffc('0x27')](_0x4ece4f,_0x5d3cff,!![]);}catch(_0x4f9cae){return BPromise[_0x0ffc('0x28')](_0x4f9cae);}return _0x4ece4f[_0x0ffc('0x29')]();};}function saveUpdates(_0x28c608,_0x4e813f){return function(_0x29f0cf){if(_0x29f0cf){return _0x29f0cf[_0x0ffc('0x2a')](_0x28c608)[_0x0ffc('0x1a')](function(_0x10e86d){return _0x10e86d;});}return null;};}function removeEntity(_0x51c673,_0x170390){return function(_0x557f1f){if(_0x557f1f){return _0x557f1f[_0x0ffc('0x2b')]()['then'](function(){_0x51c673[_0x0ffc('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x321fa9,_0x47a923){return function(_0x214faf){if(!_0x214faf){_0x321fa9[_0x0ffc('0x23')](0x194);}return _0x214faf;};}function handleError(_0x48fdca,_0x473d6c){_0x473d6c=_0x473d6c||0x1f4;return function(_0x313d57){logger[_0x0ffc('0x1e')](_0x313d57[_0x0ffc('0x2d')]);if(_0x313d57['name']){delete _0x313d57[_0x0ffc('0x2e')];}_0x48fdca[_0x0ffc('0x2c')](_0x473d6c)[_0x0ffc('0x2f')](_0x313d57);};}exports[_0x0ffc('0x30')]=function(_0x1edd2c,_0x6f3091){var _0x1ba0b6={},_0x597d9a={},_0x482372={'count':0x0,'rows':[]};var _0x3e3c5f=db[_0x0ffc('0x31')][_0x0ffc('0x32')];_0x597d9a['model']=_[_0x0ffc('0x33')](_0x3e3c5f);_0x597d9a[_0x0ffc('0x34')]=_[_0x0ffc('0x33')](_0x1edd2c[_0x0ffc('0x34')]);_0x597d9a['filters']=_[_0x0ffc('0x35')](_0x597d9a[_0x0ffc('0x36')],_0x597d9a[_0x0ffc('0x34')]);_0x1ba0b6[_0x0ffc('0x37')]=_[_0x0ffc('0x35')](_0x597d9a[_0x0ffc('0x36')],qs[_0x0ffc('0x38')](_0x1edd2c[_0x0ffc('0x34')][_0x0ffc('0x38')]));_0x1ba0b6['attributes']=_0x1ba0b6[_0x0ffc('0x37')][_0x0ffc('0x39')]?_0x1ba0b6[_0x0ffc('0x37')]:_0x597d9a[_0x0ffc('0x36')];if(!_0x1edd2c['query'][_0x0ffc('0x3a')](_0x0ffc('0x3b'))){_0x1ba0b6[_0x0ffc('0x3c')]=qs[_0x0ffc('0x3c')](_0x1edd2c[_0x0ffc('0x34')][_0x0ffc('0x3c')]);_0x1ba0b6[_0x0ffc('0x25')]=qs[_0x0ffc('0x25')](_0x1edd2c[_0x0ffc('0x34')]['offset']);}_0x1ba0b6[_0x0ffc('0x3d')]=qs[_0x0ffc('0x3e')](_0x1edd2c[_0x0ffc('0x34')][_0x0ffc('0x3e')]);_0x1ba0b6['where']=qs['filters'](_['pick'](_0x1edd2c[_0x0ffc('0x34')],_0x597d9a['filters']));if(_0x1edd2c[_0x0ffc('0x34')]['filter']){_0x1ba0b6[_0x0ffc('0x3f')]=_[_0x0ffc('0x40')](_0x1ba0b6['where'],{'$or':_['map'](_0x3e3c5f,function(_0x1bf431){if(_0x1bf431[_0x0ffc('0x41')]['key']!==_0x0ffc('0x42')){var _0x153a04={};_0x153a04[_0x1bf431['field']]={'$like':'%'+_0x1edd2c['query'][_0x0ffc('0x43')]+'%'};return _0x153a04;}})});}_0x1ba0b6=_['merge']({},_0x1ba0b6,_0x1edd2c[_0x0ffc('0x44')]);var _0x4928ef={'where':_0x1ba0b6['where']};return db['VtigerConfiguration'][_0x0ffc('0x45')](_0x4928ef)['then'](function(_0x1683d8){_0x482372[_0x0ffc('0x45')]=_0x1683d8;if(_0x1edd2c[_0x0ffc('0x34')]['includeAll']){_0x1ba0b6[_0x0ffc('0x46')]=[{'all':!![]}];}return db[_0x0ffc('0x31')][_0x0ffc('0x47')](_0x1ba0b6);})[_0x0ffc('0x1a')](function(_0x3ed692){_0x482372[_0x0ffc('0x48')]=_0x3ed692;return _0x482372;})[_0x0ffc('0x1a')](respondWithFilteredResult(_0x6f3091,_0x1ba0b6))[_0x0ffc('0x22')](handleError(_0x6f3091,null));};exports['show']=function(_0xd7aa22,_0x200b10){var _0x3c4b87={'raw':![],'where':{'id':_0xd7aa22[_0x0ffc('0x49')]['id']}},_0x5c5093={};_0x5c5093[_0x0ffc('0x36')]=_[_0x0ffc('0x33')](db[_0x0ffc('0x31')]['rawAttributes']);_0x5c5093[_0x0ffc('0x34')]=_[_0x0ffc('0x33')](_0xd7aa22['query']);_0x5c5093[_0x0ffc('0x4a')]=_[_0x0ffc('0x35')](_0x5c5093['model'],_0x5c5093['query']);_0x3c4b87[_0x0ffc('0x37')]=_[_0x0ffc('0x35')](_0x5c5093[_0x0ffc('0x36')],qs['fields'](_0xd7aa22['query'][_0x0ffc('0x38')]));_0x3c4b87['attributes']=_0x3c4b87[_0x0ffc('0x37')][_0x0ffc('0x39')]?_0x3c4b87[_0x0ffc('0x37')]:_0x5c5093[_0x0ffc('0x36')];if(_0xd7aa22[_0x0ffc('0x34')]['includeAll']){_0x3c4b87[_0x0ffc('0x46')]=[{'all':!![]}];}_0x3c4b87=_[_0x0ffc('0x40')]({},_0x3c4b87,_0xd7aa22[_0x0ffc('0x44')]);return db[_0x0ffc('0x31')]['find'](_0x3c4b87)['then'](handleEntityNotFound(_0x200b10,null))[_0x0ffc('0x1a')](respondWithResult(_0x200b10,null))['catch'](handleError(_0x200b10,null));};exports[_0x0ffc('0x4b')]=function(_0x4456f5,_0x52cc45){return db['VtigerConfiguration'][_0x0ffc('0x4b')](_0x4456f5[_0x0ffc('0x4c')],{})['then'](respondWithResult(_0x52cc45,0xc9))[_0x0ffc('0x22')](handleError(_0x52cc45,null));};exports[_0x0ffc('0x2a')]=function(_0x265b8d,_0x38aa4b){if(_0x265b8d[_0x0ffc('0x4c')]['id']){delete _0x265b8d[_0x0ffc('0x4c')]['id'];}return db[_0x0ffc('0x31')]['find']({'where':{'id':_0x265b8d['params']['id']}})[_0x0ffc('0x1a')](handleEntityNotFound(_0x38aa4b,null))[_0x0ffc('0x1a')](saveUpdates(_0x265b8d['body'],null))[_0x0ffc('0x1a')](respondWithResult(_0x38aa4b,null))[_0x0ffc('0x22')](handleError(_0x38aa4b,null));};exports[_0x0ffc('0x2b')]=function(_0x49fa0a,_0x14e012){return db['VtigerConfiguration']['find']({'where':{'id':_0x49fa0a[_0x0ffc('0x49')]['id']}})['then'](handleEntityNotFound(_0x14e012,null))['then'](removeEntity(_0x14e012,null))[_0x0ffc('0x22')](handleError(_0x14e012,null));};exports[_0x0ffc('0x4d')]=function(_0xd5e2cf,_0x5847c4,_0x252aa0){var _0x3320e9={};var _0x53d060={};var _0x51d53d;var _0x2a4b66;return db[_0x0ffc('0x31')][_0x0ffc('0x4e')]({'where':{'id':_0xd5e2cf[_0x0ffc('0x49')]['id']}})[_0x0ffc('0x1a')](handleEntityNotFound(_0x5847c4,null))['then'](function(_0x348874){if(_0x348874){_0x51d53d=_0x348874;_0x53d060['model']=_['keys'](db[_0x0ffc('0x4f')][_0x0ffc('0x32')]);_0x53d060[_0x0ffc('0x34')]=_['keys'](_0xd5e2cf['query']);_0x53d060['filters']=_[_0x0ffc('0x35')](_0x53d060[_0x0ffc('0x36')],_0x53d060['query']);_0x3320e9[_0x0ffc('0x37')]=_[_0x0ffc('0x35')](_0x53d060['model'],qs[_0x0ffc('0x38')](_0xd5e2cf[_0x0ffc('0x34')][_0x0ffc('0x38')]));_0x3320e9['attributes']=_0x3320e9[_0x0ffc('0x37')][_0x0ffc('0x39')]?_0x3320e9[_0x0ffc('0x37')]:_0x53d060[_0x0ffc('0x36')];_0x3320e9['order']=qs['sort'](_0xd5e2cf[_0x0ffc('0x34')]['sort']);_0x3320e9[_0x0ffc('0x3f')]=qs[_0x0ffc('0x4a')](_['pick'](_0xd5e2cf[_0x0ffc('0x34')],_0x53d060['filters']));if(_0xd5e2cf[_0x0ffc('0x34')][_0x0ffc('0x43')]){_0x3320e9['where']=_['merge'](_0x3320e9[_0x0ffc('0x3f')],{'$or':_[_0x0ffc('0x50')](_0x3320e9[_0x0ffc('0x37')],function(_0x26f3d8){var _0x21bb09={};_0x21bb09[_0x26f3d8]={'$like':'%'+_0xd5e2cf[_0x0ffc('0x34')]['filter']+'%'};return _0x21bb09;})});}_0x3320e9=_['merge']({},_0x3320e9,_0xd5e2cf[_0x0ffc('0x44')]);return _0x51d53d[_0x0ffc('0x4d')](_0x3320e9);}})[_0x0ffc('0x1a')](function(_0x18dc97){if(_0x18dc97){_0x2a4b66=_0x18dc97[_0x0ffc('0x39')];if(!_0xd5e2cf['query']['hasOwnProperty'](_0x0ffc('0x3b'))){_0x3320e9[_0x0ffc('0x3c')]=qs[_0x0ffc('0x3c')](_0xd5e2cf['query'][_0x0ffc('0x3c')]);_0x3320e9[_0x0ffc('0x25')]=qs[_0x0ffc('0x25')](_0xd5e2cf[_0x0ffc('0x34')][_0x0ffc('0x25')]);}return _0x51d53d['getFields'](_0x3320e9);}})[_0x0ffc('0x1a')](function(_0x435ea9){if(_0x435ea9){return _0x435ea9?{'count':_0x2a4b66,'rows':_0x435ea9}:null;}})[_0x0ffc('0x1a')](respondWithResult(_0x5847c4,null))[_0x0ffc('0x22')](handleError(_0x5847c4,null));};exports['getSubjects']=function(_0x228e23,_0x463132,_0x5db7ba){var _0x24dd64={};var _0x589e42={};var _0xc8e26d;var _0x416aad;return db[_0x0ffc('0x31')][_0x0ffc('0x4e')]({'where':{'id':_0x228e23[_0x0ffc('0x49')]['id']}})[_0x0ffc('0x1a')](handleEntityNotFound(_0x463132,null))[_0x0ffc('0x1a')](function(_0x53ee34){if(_0x53ee34){_0xc8e26d=_0x53ee34;_0x589e42[_0x0ffc('0x36')]=_['keys'](db[_0x0ffc('0x4f')][_0x0ffc('0x32')]);_0x589e42['query']=_[_0x0ffc('0x33')](_0x228e23[_0x0ffc('0x34')]);_0x589e42[_0x0ffc('0x4a')]=_[_0x0ffc('0x35')](_0x589e42[_0x0ffc('0x36')],_0x589e42[_0x0ffc('0x34')]);_0x24dd64[_0x0ffc('0x37')]=_[_0x0ffc('0x35')](_0x589e42['model'],qs[_0x0ffc('0x38')](_0x228e23[_0x0ffc('0x34')][_0x0ffc('0x38')]));_0x24dd64[_0x0ffc('0x37')]=_0x24dd64[_0x0ffc('0x37')][_0x0ffc('0x39')]?_0x24dd64[_0x0ffc('0x37')]:_0x589e42[_0x0ffc('0x36')];_0x24dd64['order']=qs[_0x0ffc('0x3e')](_0x228e23[_0x0ffc('0x34')]['sort']);_0x24dd64[_0x0ffc('0x3f')]=qs['filters'](_[_0x0ffc('0x51')](_0x228e23['query'],_0x589e42[_0x0ffc('0x4a')]));if(_0x228e23['query'][_0x0ffc('0x43')]){_0x24dd64[_0x0ffc('0x3f')]=_[_0x0ffc('0x40')](_0x24dd64['where'],{'$or':_['map'](_0x24dd64[_0x0ffc('0x37')],function(_0x512dde){var _0x56a68b={};_0x56a68b[_0x512dde]={'$like':'%'+_0x228e23[_0x0ffc('0x34')][_0x0ffc('0x43')]+'%'};return _0x56a68b;})});}_0x24dd64=_['merge']({},_0x24dd64,_0x228e23[_0x0ffc('0x44')]);return _0xc8e26d['getSubjects'](_0x24dd64);}})[_0x0ffc('0x1a')](function(_0x396992){if(_0x396992){_0x416aad=_0x396992[_0x0ffc('0x39')];if(!_0x228e23['query'][_0x0ffc('0x3a')](_0x0ffc('0x3b'))){_0x24dd64[_0x0ffc('0x3c')]=qs[_0x0ffc('0x3c')](_0x228e23[_0x0ffc('0x34')]['limit']);_0x24dd64[_0x0ffc('0x25')]=qs[_0x0ffc('0x25')](_0x228e23['query'][_0x0ffc('0x25')]);}return _0xc8e26d['getSubjects'](_0x24dd64);}})[_0x0ffc('0x1a')](function(_0x100d6c){if(_0x100d6c){return _0x100d6c?{'count':_0x416aad,'rows':_0x100d6c}:null;}})[_0x0ffc('0x1a')](respondWithResult(_0x463132,null))[_0x0ffc('0x22')](handleError(_0x463132,null));};exports[_0x0ffc('0x52')]=function(_0x3314be,_0x5956a0,_0x355a70){var _0x1034db={};var _0x52dd03={};var _0x7789d4;var _0x418de1;return db[_0x0ffc('0x31')][_0x0ffc('0x4e')]({'where':{'id':_0x3314be[_0x0ffc('0x49')]['id']}})[_0x0ffc('0x1a')](handleEntityNotFound(_0x5956a0,null))[_0x0ffc('0x1a')](function(_0x2fbe10){if(_0x2fbe10){_0x7789d4=_0x2fbe10;_0x52dd03[_0x0ffc('0x36')]=_[_0x0ffc('0x33')](db['VtigerField']['rawAttributes']);_0x52dd03['query']=_[_0x0ffc('0x33')](_0x3314be[_0x0ffc('0x34')]);_0x52dd03[_0x0ffc('0x4a')]=_[_0x0ffc('0x35')](_0x52dd03[_0x0ffc('0x36')],_0x52dd03['query']);_0x1034db[_0x0ffc('0x37')]=_[_0x0ffc('0x35')](_0x52dd03[_0x0ffc('0x36')],qs[_0x0ffc('0x38')](_0x3314be['query'][_0x0ffc('0x38')]));_0x1034db[_0x0ffc('0x37')]=_0x1034db[_0x0ffc('0x37')][_0x0ffc('0x39')]?_0x1034db[_0x0ffc('0x37')]:_0x52dd03[_0x0ffc('0x36')];_0x1034db[_0x0ffc('0x3d')]=qs[_0x0ffc('0x3e')](_0x3314be[_0x0ffc('0x34')]['sort']);_0x1034db[_0x0ffc('0x3f')]=qs[_0x0ffc('0x4a')](_['pick'](_0x3314be[_0x0ffc('0x34')],_0x52dd03[_0x0ffc('0x4a')]));if(_0x3314be[_0x0ffc('0x34')][_0x0ffc('0x43')]){_0x1034db[_0x0ffc('0x3f')]=_['merge'](_0x1034db[_0x0ffc('0x3f')],{'$or':_[_0x0ffc('0x50')](_0x1034db['attributes'],function(_0x5e62ea){var _0xe3c7e1={};_0xe3c7e1[_0x5e62ea]={'$like':'%'+_0x3314be[_0x0ffc('0x34')]['filter']+'%'};return _0xe3c7e1;})});}_0x1034db=_['merge']({},_0x1034db,_0x3314be[_0x0ffc('0x44')]);return _0x7789d4[_0x0ffc('0x52')](_0x1034db);}})[_0x0ffc('0x1a')](function(_0x365ca7){if(_0x365ca7){_0x418de1=_0x365ca7['length'];if(!_0x3314be[_0x0ffc('0x34')][_0x0ffc('0x3a')](_0x0ffc('0x3b'))){_0x1034db['limit']=qs[_0x0ffc('0x3c')](_0x3314be['query'][_0x0ffc('0x3c')]);_0x1034db[_0x0ffc('0x25')]=qs[_0x0ffc('0x25')](_0x3314be[_0x0ffc('0x34')][_0x0ffc('0x25')]);}return _0x7789d4['getDescriptions'](_0x1034db);}})[_0x0ffc('0x1a')](function(_0xed11c7){if(_0xed11c7){return _0xed11c7?{'count':_0x418de1,'rows':_0xed11c7}:null;}})[_0x0ffc('0x1a')](respondWithResult(_0x5956a0,null))[_0x0ffc('0x22')](handleError(_0x5956a0,null));};
\ No newline at end of file
+var _0x2bab=['includeAll','find','create','body','params','destroy','getFields','VtigerField','map','findOne','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','lodash','crypto','to-csv','querystring','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','jayson/promise','client','http','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','stack','name','send','index','VtigerConfiguration','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','type','key','VIRTUAL','field','options','where','include','rows','show','rawAttributes','fields'];(function(_0x31c81b,_0x4a2b1c){var _0x52ab34=function(_0x2e6c48){while(--_0x2e6c48){_0x31c81b['push'](_0x31c81b['shift']());}};_0x52ab34(++_0x4a2b1c);}(_0x2bab,0x1ba));var _0xb2ba=function(_0x2964c3,_0x1e6176){_0x2964c3=_0x2964c3-0x0;var _0x25d7d0=_0x2bab[_0x2964c3];return _0x25d7d0;};'use strict';var pdf=require(_0xb2ba('0x0'));var emlformat=require(_0xb2ba('0x1'));var rimraf=require(_0xb2ba('0x2'));var zipdir=require(_0xb2ba('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb2ba('0x4'));var moment=require(_0xb2ba('0x5'));var BPromise=require(_0xb2ba('0x6'));var Mustache=require('mustache');var util=require(_0xb2ba('0x7'));var path=require(_0xb2ba('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb2ba('0x9'));var squel=require('squel');var crypto=require(_0xb2ba('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb2ba('0xb'));var querystring=require(_0xb2ba('0xc'));var Papa=require(_0xb2ba('0xd'));var authService=require(_0xb2ba('0xe'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0xb2ba('0xf'));var qs=require(_0xb2ba('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xb2ba('0x11'));var config=require(_0xb2ba('0x12'));var db=require('../../mysqldb')['db'];var jayson=require(_0xb2ba('0x13'));var client=jayson[_0xb2ba('0x14')][_0xb2ba('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x55317a,_0x44fe02,_0x7cd2b2,_0x3baac1){return new BPromise(function(_0x295132,_0x14b5bc){var _0x5d0455=_0x3baac1||client;return _0x5d0455['request'](_0x55317a,_0x7cd2b2)['then'](function(_0x490e4d){logger[_0xb2ba('0x16')](_0xb2ba('0x17'),_0x44fe02,_0xb2ba('0x18'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x44fe02,_0xb2ba('0x18'),JSON[_0xb2ba('0x19')](_0x490e4d));if(_0x490e4d[_0xb2ba('0x1a')]){if(_0x490e4d[_0xb2ba('0x1a')][_0xb2ba('0x1b')]===0x1f4){logger[_0xb2ba('0x1a')](_0xb2ba('0x17'),_0x44fe02,_0x490e4d[_0xb2ba('0x1a')][_0xb2ba('0x1c')]);return _0x14b5bc(_0x490e4d[_0xb2ba('0x1a')][_0xb2ba('0x1c')]);}logger['error'](_0xb2ba('0x17'),_0x44fe02,_0x490e4d[_0xb2ba('0x1a')][_0xb2ba('0x1c')]);return _0x295132(_0x490e4d[_0xb2ba('0x1a')][_0xb2ba('0x1c')]);}else{logger['info'](_0xb2ba('0x17'),_0x44fe02,_0xb2ba('0x18'));_0x295132(_0x490e4d[_0xb2ba('0x1d')][_0xb2ba('0x1c')]);}})[_0xb2ba('0x1e')](function(_0x4639a9){logger[_0xb2ba('0x1a')](_0xb2ba('0x17'),_0x44fe02,_0x4639a9);_0x14b5bc(_0x4639a9);});});}function respondWithStatusCode(_0x18e25c,_0x45aeba){_0x45aeba=_0x45aeba||0xcc;return function(_0x52d48d){if(_0x52d48d){return _0x18e25c[_0xb2ba('0x1f')](_0x45aeba);}return _0x18e25c[_0xb2ba('0x20')](_0x45aeba)[_0xb2ba('0x21')]();};}function respondWithResult(_0x5a8334,_0x3fcc7c){_0x3fcc7c=_0x3fcc7c||0xc8;return function(_0x401843){if(_0x401843){return _0x5a8334[_0xb2ba('0x20')](_0x3fcc7c)[_0xb2ba('0x22')](_0x401843);}};}function respondWithFilteredResult(_0x383c14,_0x19ab32){return function(_0xa64b7d){if(_0xa64b7d){var _0x4e9ae8=_0xa64b7d[_0xb2ba('0x23')],_0x5ca398=_0x19ab32[_0xb2ba('0x24')],_0x43d4ab=_0x19ab32[_0xb2ba('0x24')]+_0x19ab32['limit'],_0x5e2e2e;if(_0x43d4ab>=_0x4e9ae8){_0x43d4ab=_0x4e9ae8;_0x5e2e2e=0xc8;}else{_0x5e2e2e=0xce;}_0x383c14[_0xb2ba('0x20')](_0x5e2e2e);return _0x383c14['set'](_0xb2ba('0x25'),_0x5ca398+'-'+_0x43d4ab+'/'+_0x4e9ae8)[_0xb2ba('0x22')](_0xa64b7d);}return null;};}function patchUpdates(_0x254312){return function(_0x553cec){try{jsonpatch[_0xb2ba('0x26')](_0x553cec,_0x254312,!![]);}catch(_0x4ce878){return BPromise[_0xb2ba('0x27')](_0x4ce878);}return _0x553cec[_0xb2ba('0x28')]();};}function saveUpdates(_0x4baaf5,_0x1f53b3){return function(_0x4d633c){if(_0x4d633c){return _0x4d633c[_0xb2ba('0x29')](_0x4baaf5)[_0xb2ba('0x2a')](function(_0x5cb20c){return _0x5cb20c;});}return null;};}function removeEntity(_0x9c9578,_0x1eb107){return function(_0x4104f9){if(_0x4104f9){return _0x4104f9['destroy']()['then'](function(){_0x9c9578[_0xb2ba('0x20')](0xcc)[_0xb2ba('0x21')]();});}};}function handleEntityNotFound(_0x37f988,_0x4986e6){return function(_0xa2901a){if(!_0xa2901a){_0x37f988[_0xb2ba('0x1f')](0x194);}return _0xa2901a;};}function handleError(_0x56a7f4,_0x44229d){_0x44229d=_0x44229d||0x1f4;return function(_0x202297){logger['error'](_0x202297[_0xb2ba('0x2b')]);if(_0x202297[_0xb2ba('0x2c')]){delete _0x202297[_0xb2ba('0x2c')];}_0x56a7f4['status'](_0x44229d)[_0xb2ba('0x2d')](_0x202297);};}exports[_0xb2ba('0x2e')]=function(_0x2a6ce8,_0x5a95cd){var _0x25aa99={},_0x1d701d={},_0x1c4863={'count':0x0,'rows':[]};var _0x8ae887=db[_0xb2ba('0x2f')]['rawAttributes'];_0x1d701d[_0xb2ba('0x30')]=_[_0xb2ba('0x31')](_0x8ae887);_0x1d701d[_0xb2ba('0x32')]=_[_0xb2ba('0x31')](_0x2a6ce8[_0xb2ba('0x32')]);_0x1d701d[_0xb2ba('0x33')]=_[_0xb2ba('0x34')](_0x1d701d[_0xb2ba('0x30')],_0x1d701d[_0xb2ba('0x32')]);_0x25aa99['attributes']=_['intersection'](_0x1d701d[_0xb2ba('0x30')],qs['fields'](_0x2a6ce8[_0xb2ba('0x32')]['fields']));_0x25aa99['attributes']=_0x25aa99[_0xb2ba('0x35')][_0xb2ba('0x36')]?_0x25aa99['attributes']:_0x1d701d[_0xb2ba('0x30')];if(!_0x2a6ce8[_0xb2ba('0x32')][_0xb2ba('0x37')](_0xb2ba('0x38'))){_0x25aa99[_0xb2ba('0x39')]=qs[_0xb2ba('0x39')](_0x2a6ce8[_0xb2ba('0x32')][_0xb2ba('0x39')]);_0x25aa99[_0xb2ba('0x24')]=qs[_0xb2ba('0x24')](_0x2a6ce8[_0xb2ba('0x32')][_0xb2ba('0x24')]);}_0x25aa99[_0xb2ba('0x3a')]=qs[_0xb2ba('0x3b')](_0x2a6ce8[_0xb2ba('0x32')][_0xb2ba('0x3b')]);_0x25aa99['where']=qs[_0xb2ba('0x33')](_[_0xb2ba('0x3c')](_0x2a6ce8[_0xb2ba('0x32')],_0x1d701d[_0xb2ba('0x33')]));if(_0x2a6ce8['query'][_0xb2ba('0x3d')]){_0x25aa99['where']=_[_0xb2ba('0x3e')](_0x25aa99['where'],{'$or':_['map'](_0x8ae887,function(_0x13c316){if(_0x13c316[_0xb2ba('0x3f')][_0xb2ba('0x40')]!==_0xb2ba('0x41')){var _0x4ebc68={};_0x4ebc68[_0x13c316[_0xb2ba('0x42')]]={'$like':'%'+_0x2a6ce8['query'][_0xb2ba('0x3d')]+'%'};return _0x4ebc68;}})});}_0x25aa99=_[_0xb2ba('0x3e')]({},_0x25aa99,_0x2a6ce8[_0xb2ba('0x43')]);var _0x13ffd3={'where':_0x25aa99[_0xb2ba('0x44')]};return db['VtigerConfiguration'][_0xb2ba('0x23')](_0x13ffd3)[_0xb2ba('0x2a')](function(_0x2b78cd){_0x1c4863[_0xb2ba('0x23')]=_0x2b78cd;if(_0x2a6ce8['query']['includeAll']){_0x25aa99[_0xb2ba('0x45')]=[{'all':!![]}];}return db[_0xb2ba('0x2f')]['findAll'](_0x25aa99);})[_0xb2ba('0x2a')](function(_0x2c9378){_0x1c4863[_0xb2ba('0x46')]=_0x2c9378;return _0x1c4863;})[_0xb2ba('0x2a')](respondWithFilteredResult(_0x5a95cd,_0x25aa99))[_0xb2ba('0x1e')](handleError(_0x5a95cd,null));};exports[_0xb2ba('0x47')]=function(_0x464ad8,_0x63ea9d){var _0x16ed36={'raw':![],'where':{'id':_0x464ad8['params']['id']}},_0x1870b1={};_0x1870b1[_0xb2ba('0x30')]=_['keys'](db[_0xb2ba('0x2f')][_0xb2ba('0x48')]);_0x1870b1['query']=_['keys'](_0x464ad8[_0xb2ba('0x32')]);_0x1870b1[_0xb2ba('0x33')]=_[_0xb2ba('0x34')](_0x1870b1[_0xb2ba('0x30')],_0x1870b1[_0xb2ba('0x32')]);_0x16ed36['attributes']=_['intersection'](_0x1870b1['model'],qs[_0xb2ba('0x49')](_0x464ad8[_0xb2ba('0x32')]['fields']));_0x16ed36['attributes']=_0x16ed36[_0xb2ba('0x35')]['length']?_0x16ed36[_0xb2ba('0x35')]:_0x1870b1['model'];if(_0x464ad8[_0xb2ba('0x32')][_0xb2ba('0x4a')]){_0x16ed36[_0xb2ba('0x45')]=[{'all':!![]}];}_0x16ed36=_[_0xb2ba('0x3e')]({},_0x16ed36,_0x464ad8[_0xb2ba('0x43')]);return db[_0xb2ba('0x2f')][_0xb2ba('0x4b')](_0x16ed36)[_0xb2ba('0x2a')](handleEntityNotFound(_0x63ea9d,null))[_0xb2ba('0x2a')](respondWithResult(_0x63ea9d,null))['catch'](handleError(_0x63ea9d,null));};exports['create']=function(_0x262c23,_0x2b3ebd){return db[_0xb2ba('0x2f')][_0xb2ba('0x4c')](_0x262c23[_0xb2ba('0x4d')],{})['then'](respondWithResult(_0x2b3ebd,0xc9))[_0xb2ba('0x1e')](handleError(_0x2b3ebd,null));};exports[_0xb2ba('0x29')]=function(_0x2b1d07,_0x1ccdf5){if(_0x2b1d07['body']['id']){delete _0x2b1d07[_0xb2ba('0x4d')]['id'];}return db[_0xb2ba('0x2f')][_0xb2ba('0x4b')]({'where':{'id':_0x2b1d07[_0xb2ba('0x4e')]['id']}})[_0xb2ba('0x2a')](handleEntityNotFound(_0x1ccdf5,null))['then'](saveUpdates(_0x2b1d07[_0xb2ba('0x4d')],null))[_0xb2ba('0x2a')](respondWithResult(_0x1ccdf5,null))[_0xb2ba('0x1e')](handleError(_0x1ccdf5,null));};exports[_0xb2ba('0x4f')]=function(_0x2a39e9,_0x4abe59){return db[_0xb2ba('0x2f')][_0xb2ba('0x4b')]({'where':{'id':_0x2a39e9[_0xb2ba('0x4e')]['id']}})[_0xb2ba('0x2a')](handleEntityNotFound(_0x4abe59,null))[_0xb2ba('0x2a')](removeEntity(_0x4abe59,null))[_0xb2ba('0x1e')](handleError(_0x4abe59,null));};exports[_0xb2ba('0x50')]=function(_0x2428e0,_0x4bf33f,_0x32e61f){var _0x1d6d7c={};var _0x585ce9={};var _0x28d813;var _0x1c0a04;return db[_0xb2ba('0x2f')]['findOne']({'where':{'id':_0x2428e0[_0xb2ba('0x4e')]['id']}})[_0xb2ba('0x2a')](handleEntityNotFound(_0x4bf33f,null))['then'](function(_0x2aeb7b){if(_0x2aeb7b){_0x28d813=_0x2aeb7b;_0x585ce9[_0xb2ba('0x30')]=_[_0xb2ba('0x31')](db[_0xb2ba('0x51')][_0xb2ba('0x48')]);_0x585ce9[_0xb2ba('0x32')]=_['keys'](_0x2428e0[_0xb2ba('0x32')]);_0x585ce9[_0xb2ba('0x33')]=_['intersection'](_0x585ce9[_0xb2ba('0x30')],_0x585ce9['query']);_0x1d6d7c['attributes']=_['intersection'](_0x585ce9['model'],qs[_0xb2ba('0x49')](_0x2428e0[_0xb2ba('0x32')]['fields']));_0x1d6d7c[_0xb2ba('0x35')]=_0x1d6d7c[_0xb2ba('0x35')]['length']?_0x1d6d7c[_0xb2ba('0x35')]:_0x585ce9[_0xb2ba('0x30')];_0x1d6d7c['order']=qs[_0xb2ba('0x3b')](_0x2428e0[_0xb2ba('0x32')][_0xb2ba('0x3b')]);_0x1d6d7c['where']=qs[_0xb2ba('0x33')](_[_0xb2ba('0x3c')](_0x2428e0['query'],_0x585ce9[_0xb2ba('0x33')]));if(_0x2428e0[_0xb2ba('0x32')][_0xb2ba('0x3d')]){_0x1d6d7c[_0xb2ba('0x44')]=_['merge'](_0x1d6d7c[_0xb2ba('0x44')],{'$or':_[_0xb2ba('0x52')](_0x1d6d7c['attributes'],function(_0xea6f6a){var _0x566af7={};_0x566af7[_0xea6f6a]={'$like':'%'+_0x2428e0[_0xb2ba('0x32')][_0xb2ba('0x3d')]+'%'};return _0x566af7;})});}_0x1d6d7c=_['merge']({},_0x1d6d7c,_0x2428e0[_0xb2ba('0x43')]);return _0x28d813[_0xb2ba('0x50')](_0x1d6d7c);}})[_0xb2ba('0x2a')](function(_0x27d27f){if(_0x27d27f){_0x1c0a04=_0x27d27f[_0xb2ba('0x36')];if(!_0x2428e0[_0xb2ba('0x32')]['hasOwnProperty'](_0xb2ba('0x38'))){_0x1d6d7c[_0xb2ba('0x39')]=qs['limit'](_0x2428e0[_0xb2ba('0x32')][_0xb2ba('0x39')]);_0x1d6d7c[_0xb2ba('0x24')]=qs[_0xb2ba('0x24')](_0x2428e0['query']['offset']);}return _0x28d813[_0xb2ba('0x50')](_0x1d6d7c);}})[_0xb2ba('0x2a')](function(_0x54deed){if(_0x54deed){return _0x54deed?{'count':_0x1c0a04,'rows':_0x54deed}:null;}})['then'](respondWithResult(_0x4bf33f,null))[_0xb2ba('0x1e')](handleError(_0x4bf33f,null));};exports['getSubjects']=function(_0x323ef1,_0x49c097,_0x1ee328){var _0x16c532={};var _0x1b9bf7={};var _0x97ac76;var _0x3ef241;return db['VtigerConfiguration'][_0xb2ba('0x53')]({'where':{'id':_0x323ef1[_0xb2ba('0x4e')]['id']}})[_0xb2ba('0x2a')](handleEntityNotFound(_0x49c097,null))['then'](function(_0x18146c){if(_0x18146c){_0x97ac76=_0x18146c;_0x1b9bf7['model']=_['keys'](db[_0xb2ba('0x51')][_0xb2ba('0x48')]);_0x1b9bf7[_0xb2ba('0x32')]=_[_0xb2ba('0x31')](_0x323ef1[_0xb2ba('0x32')]);_0x1b9bf7['filters']=_[_0xb2ba('0x34')](_0x1b9bf7['model'],_0x1b9bf7[_0xb2ba('0x32')]);_0x16c532[_0xb2ba('0x35')]=_[_0xb2ba('0x34')](_0x1b9bf7['model'],qs[_0xb2ba('0x49')](_0x323ef1[_0xb2ba('0x32')][_0xb2ba('0x49')]));_0x16c532['attributes']=_0x16c532[_0xb2ba('0x35')][_0xb2ba('0x36')]?_0x16c532[_0xb2ba('0x35')]:_0x1b9bf7[_0xb2ba('0x30')];_0x16c532[_0xb2ba('0x3a')]=qs[_0xb2ba('0x3b')](_0x323ef1[_0xb2ba('0x32')][_0xb2ba('0x3b')]);_0x16c532[_0xb2ba('0x44')]=qs[_0xb2ba('0x33')](_[_0xb2ba('0x3c')](_0x323ef1[_0xb2ba('0x32')],_0x1b9bf7['filters']));if(_0x323ef1[_0xb2ba('0x32')][_0xb2ba('0x3d')]){_0x16c532[_0xb2ba('0x44')]=_[_0xb2ba('0x3e')](_0x16c532['where'],{'$or':_[_0xb2ba('0x52')](_0x16c532['attributes'],function(_0x576908){var _0x2c90e4={};_0x2c90e4[_0x576908]={'$like':'%'+_0x323ef1[_0xb2ba('0x32')]['filter']+'%'};return _0x2c90e4;})});}_0x16c532=_[_0xb2ba('0x3e')]({},_0x16c532,_0x323ef1[_0xb2ba('0x43')]);return _0x97ac76[_0xb2ba('0x54')](_0x16c532);}})[_0xb2ba('0x2a')](function(_0x17ddc7){if(_0x17ddc7){_0x3ef241=_0x17ddc7[_0xb2ba('0x36')];if(!_0x323ef1[_0xb2ba('0x32')]['hasOwnProperty'](_0xb2ba('0x38'))){_0x16c532[_0xb2ba('0x39')]=qs[_0xb2ba('0x39')](_0x323ef1[_0xb2ba('0x32')]['limit']);_0x16c532[_0xb2ba('0x24')]=qs[_0xb2ba('0x24')](_0x323ef1[_0xb2ba('0x32')]['offset']);}return _0x97ac76[_0xb2ba('0x54')](_0x16c532);}})[_0xb2ba('0x2a')](function(_0x118466){if(_0x118466){return _0x118466?{'count':_0x3ef241,'rows':_0x118466}:null;}})[_0xb2ba('0x2a')](respondWithResult(_0x49c097,null))[_0xb2ba('0x1e')](handleError(_0x49c097,null));};exports[_0xb2ba('0x55')]=function(_0x3678a6,_0x18cd7c,_0x14b7e7){var _0xf764f9={};var _0x2e94ac={};var _0x1112dc;var _0x4b7b48;return db['VtigerConfiguration'][_0xb2ba('0x53')]({'where':{'id':_0x3678a6['params']['id']}})[_0xb2ba('0x2a')](handleEntityNotFound(_0x18cd7c,null))['then'](function(_0x4454cf){if(_0x4454cf){_0x1112dc=_0x4454cf;_0x2e94ac[_0xb2ba('0x30')]=_['keys'](db[_0xb2ba('0x51')][_0xb2ba('0x48')]);_0x2e94ac[_0xb2ba('0x32')]=_[_0xb2ba('0x31')](_0x3678a6[_0xb2ba('0x32')]);_0x2e94ac['filters']=_[_0xb2ba('0x34')](_0x2e94ac['model'],_0x2e94ac[_0xb2ba('0x32')]);_0xf764f9[_0xb2ba('0x35')]=_[_0xb2ba('0x34')](_0x2e94ac['model'],qs[_0xb2ba('0x49')](_0x3678a6[_0xb2ba('0x32')][_0xb2ba('0x49')]));_0xf764f9[_0xb2ba('0x35')]=_0xf764f9[_0xb2ba('0x35')][_0xb2ba('0x36')]?_0xf764f9[_0xb2ba('0x35')]:_0x2e94ac['model'];_0xf764f9[_0xb2ba('0x3a')]=qs['sort'](_0x3678a6[_0xb2ba('0x32')][_0xb2ba('0x3b')]);_0xf764f9[_0xb2ba('0x44')]=qs['filters'](_[_0xb2ba('0x3c')](_0x3678a6['query'],_0x2e94ac[_0xb2ba('0x33')]));if(_0x3678a6[_0xb2ba('0x32')][_0xb2ba('0x3d')]){_0xf764f9[_0xb2ba('0x44')]=_[_0xb2ba('0x3e')](_0xf764f9[_0xb2ba('0x44')],{'$or':_[_0xb2ba('0x52')](_0xf764f9[_0xb2ba('0x35')],function(_0x4d5a96){var _0x3137ad={};_0x3137ad[_0x4d5a96]={'$like':'%'+_0x3678a6[_0xb2ba('0x32')][_0xb2ba('0x3d')]+'%'};return _0x3137ad;})});}_0xf764f9=_[_0xb2ba('0x3e')]({},_0xf764f9,_0x3678a6[_0xb2ba('0x43')]);return _0x1112dc[_0xb2ba('0x55')](_0xf764f9);}})['then'](function(_0x101fb1){if(_0x101fb1){_0x4b7b48=_0x101fb1[_0xb2ba('0x36')];if(!_0x3678a6[_0xb2ba('0x32')][_0xb2ba('0x37')]('nolimit')){_0xf764f9[_0xb2ba('0x39')]=qs[_0xb2ba('0x39')](_0x3678a6[_0xb2ba('0x32')][_0xb2ba('0x39')]);_0xf764f9['offset']=qs[_0xb2ba('0x24')](_0x3678a6[_0xb2ba('0x32')]['offset']);}return _0x1112dc[_0xb2ba('0x55')](_0xf764f9);}})[_0xb2ba('0x2a')](function(_0x2a3e4a){if(_0x2a3e4a){return _0x2a3e4a?{'count':_0x4b7b48,'rows':_0x2a3e4a}:null;}})[_0xb2ba('0x2a')](respondWithResult(_0x18cd7c,null))[_0xb2ba('0x1e')](handleError(_0x18cd7c,null));};
\ No newline at end of file
index 96cf42c..6d3861a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf904=['util','../../config/logger','api','request-promise','./intVtigerConfiguration.attributes','exports','lodash'];(function(_0x2fe523,_0x40f413){var _0x3afb74=function(_0x3c0157){while(--_0x3c0157){_0x2fe523['push'](_0x2fe523['shift']());}};_0x3afb74(++_0x40f413);}(_0xf904,0x18e));var _0x4f90=function(_0x8956db,_0x565a5f){_0x8956db=_0x8956db-0x0;var _0x175a41=_0xf904[_0x8956db];return _0x175a41;};'use strict';var _=require(_0x4f90('0x0'));var util=require(_0x4f90('0x1'));var logger=require(_0x4f90('0x2'))(_0x4f90('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4f90('0x4'));var attributes=require(_0x4f90('0x5'));module[_0x4f90('0x6')]=function(_0x2ec3a7,_0x39d09b){return _0x2ec3a7['define']('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x8ea5=['moment','bluebird','request-promise','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger'];(function(_0x5f0435,_0x333422){var _0x5256a1=function(_0x2387ba){while(--_0x2387ba){_0x5f0435['push'](_0x5f0435['shift']());}};_0x5256a1(++_0x333422);}(_0x8ea5,0xd9));var _0x58ea=function(_0x4a0cfc,_0x25e45b){_0x4a0cfc=_0x4a0cfc-0x0;var _0x55b173=_0x8ea5[_0x4a0cfc];return _0x55b173;};'use strict';var _=require(_0x58ea('0x0'));var util=require(_0x58ea('0x1'));var logger=require(_0x58ea('0x2'))('api');var moment=require(_0x58ea('0x3'));var BPromise=require(_0x58ea('0x4'));var rp=require(_0x58ea('0x5'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x58ea('0x6')]=function(_0x14e0b3,_0x475887){return _0x14e0b3[_0x58ea('0x7')](_0x58ea('0x8'),attributes,{'tableName':_0x58ea('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index d088c0f..e47abf1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x850d=['error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0xef1c93,_0x357079){var _0x4f7c0e=function(_0x1b7016){while(--_0x1b7016){_0xef1c93['push'](_0xef1c93['shift']());}};_0x4f7c0e(++_0x357079);}(_0x850d,0xe1));var _0xd850=function(_0x46bac8,_0x33ca8c){_0x46bac8=_0x46bac8-0x0;var _0x3b196c=_0x850d[_0x46bac8];return _0x3b196c;};'use strict';var _=require('lodash');var util=require(_0xd850('0x0'));var moment=require(_0xd850('0x1'));var BPromise=require(_0xd850('0x2'));var rs=require(_0xd850('0x3'));var fs=require('fs');var Redis=require(_0xd850('0x4'));var db=require(_0xd850('0x5'))['db'];var utils=require(_0xd850('0x6'));var logger=require('../../config/logger')(_0xd850('0x7'));var config=require(_0xd850('0x8'));var jayson=require(_0xd850('0x9'));var client=jayson[_0xd850('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27349e,_0x20f0ef,_0x19d2c2){return new BPromise(function(_0x35215b,_0x3cd3f6){return client[_0xd850('0xb')](_0x27349e,_0x19d2c2)['then'](function(_0x443555){logger[_0xd850('0xc')](_0xd850('0xd'),_0x20f0ef,_0xd850('0xe'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x20f0ef,'request\x20sent',JSON['stringify'](_0x443555));if(_0x443555['error']){if(_0x443555[_0xd850('0xf')][_0xd850('0x10')]===0x1f4){logger[_0xd850('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x20f0ef,_0x443555[_0xd850('0xf')]['message']);return _0x3cd3f6(_0x443555['error']['message']);}logger[_0xd850('0xf')](_0xd850('0xd'),_0x20f0ef,_0x443555[_0xd850('0xf')][_0xd850('0x11')]);return _0x35215b(_0x443555[_0xd850('0xf')]['message']);}else{logger['info'](_0xd850('0xd'),_0x20f0ef,_0xd850('0xe'));_0x35215b(_0x443555[_0xd850('0x12')][_0xd850('0x11')]);}})[_0xd850('0x13')](function(_0x1f9a4d){logger[_0xd850('0xf')](_0xd850('0xd'),_0x20f0ef,_0x1f9a4d);_0x3cd3f6(_0x1f9a4d);});});}
\ No newline at end of file
+var _0x53fc=['util','moment','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash'];(function(_0x42d6da,_0x3c8613){var _0x37ddd3=function(_0x529230){while(--_0x529230){_0x42d6da['push'](_0x42d6da['shift']());}};_0x37ddd3(++_0x3c8613);}(_0x53fc,0x1b4));var _0xc53f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53fc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc53f('0x0'));var util=require(_0xc53f('0x1'));var moment=require(_0xc53f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc53f('0x3'));var db=require(_0xc53f('0x4'))['db'];var utils=require(_0xc53f('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc53f('0x6'));var client=jayson[_0xc53f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18a8b9,_0x4e67f0,_0x402423){return new BPromise(function(_0x16c061,_0x209044){return client[_0xc53f('0x8')](_0x18a8b9,_0x402423)[_0xc53f('0x9')](function(_0x2125c5){logger[_0xc53f('0xa')](_0xc53f('0xb'),_0x4e67f0,_0xc53f('0xc'));logger[_0xc53f('0xd')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x4e67f0,_0xc53f('0xc'),JSON[_0xc53f('0xe')](_0x2125c5));if(_0x2125c5['error']){if(_0x2125c5[_0xc53f('0xf')][_0xc53f('0x10')]===0x1f4){logger[_0xc53f('0xf')](_0xc53f('0xb'),_0x4e67f0,_0x2125c5[_0xc53f('0xf')][_0xc53f('0x11')]);return _0x209044(_0x2125c5[_0xc53f('0xf')][_0xc53f('0x11')]);}logger[_0xc53f('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x4e67f0,_0x2125c5['error'][_0xc53f('0x11')]);return _0x16c061(_0x2125c5['error']['message']);}else{logger[_0xc53f('0xa')](_0xc53f('0xb'),_0x4e67f0,'request\x20sent');_0x16c061(_0x2125c5['result'][_0xc53f('0x11')]);}})[_0xc53f('0x12')](function(_0x309940){logger[_0xc53f('0xf')](_0xc53f('0xb'),_0x4e67f0,_0x309940);_0x209044(_0x309940);});});}
\ No newline at end of file
index d346a3e..72b12d3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1fef=['show','post','/:id','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x56a1d0,_0x16a437){var _0x5952c4=function(_0x3a4e4e){while(--_0x3a4e4e){_0x56a1d0['push'](_0x56a1d0['shift']());}};_0x5952c4(++_0x16a437);}(_0x1fef,0x155));var _0xf1fe=function(_0x26d850,_0x4c6832){_0x26d850=_0x26d850-0x0;var _0x3e020c=_0x1fef[_0x26d850];return _0x3e020c;};'use strict';var multer=require(_0xf1fe('0x0'));var util=require(_0xf1fe('0x1'));var path=require(_0xf1fe('0x2'));var timeout=require(_0xf1fe('0x3'));var express=require('express');var router=express[_0xf1fe('0x4')]();var auth=require(_0xf1fe('0x5'));var interaction=require(_0xf1fe('0x6'));var config=require(_0xf1fe('0x7'));var controller=require('./intVtigerField.controller');router[_0xf1fe('0x8')]('/',auth[_0xf1fe('0x9')](),controller[_0xf1fe('0xa')]);router[_0xf1fe('0x8')]('/:id',auth[_0xf1fe('0x9')](),controller[_0xf1fe('0xb')]);router[_0xf1fe('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xf1fe('0xd'),auth[_0xf1fe('0x9')](),controller['update']);router[_0xf1fe('0xe')](_0xf1fe('0xd'),auth['isAuthenticated'](),controller[_0xf1fe('0xf')]);module['exports']=router;
\ No newline at end of file
+var _0x91e4=['create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post'];(function(_0x2ec17c,_0x49604d){var _0x579a9a=function(_0x35586a){while(--_0x35586a){_0x2ec17c['push'](_0x2ec17c['shift']());}};_0x579a9a(++_0x49604d);}(_0x91e4,0x191));var _0x491e=function(_0x3e5ddb,_0x447747){_0x3e5ddb=_0x3e5ddb-0x0;var _0x196b4a=_0x91e4[_0x3e5ddb];return _0x196b4a;};'use strict';var multer=require(_0x491e('0x0'));var util=require(_0x491e('0x1'));var path=require('path');var timeout=require(_0x491e('0x2'));var express=require(_0x491e('0x3'));var router=express[_0x491e('0x4')]();var auth=require(_0x491e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x491e('0x6'));var controller=require('./intVtigerField.controller');router[_0x491e('0x7')]('/',auth[_0x491e('0x8')](),controller[_0x491e('0x9')]);router[_0x491e('0x7')](_0x491e('0xa'),auth[_0x491e('0x8')](),controller[_0x491e('0xb')]);router[_0x491e('0xc')]('/',auth['isAuthenticated'](),controller[_0x491e('0xd')]);router[_0x491e('0xe')](_0x491e('0xa'),auth[_0x491e('0x8')](),controller['update']);router[_0x491e('0xf')](_0x491e('0xa'),auth[_0x491e('0x8')](),controller[_0x491e('0x10')]);module[_0x491e('0x11')]=router;
\ No newline at end of file
index eb82cb0..3014e06 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5b02=['BOOLEAN','sequelize','exports','ENUM','string','keyValue','STRING','variable'];(function(_0x305550,_0x567d29){var _0x54b500=function(_0x141a6b){while(--_0x141a6b){_0x305550['push'](_0x305550['shift']());}};_0x54b500(++_0x567d29);}(_0x5b02,0xe9));var _0x25b0=function(_0x30d0e7,_0x2e914f){_0x30d0e7=_0x30d0e7-0x0;var _0x3592b7=_0x5b02[_0x30d0e7];return _0x3592b7;};'use strict';var Sequelize=require(_0x25b0('0x0'));module[_0x25b0('0x1')]={'type':{'type':Sequelize[_0x25b0('0x2')](_0x25b0('0x3'),'variable','customVariable',_0x25b0('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x25b0('0x5')]},'key':{'type':Sequelize[_0x25b0('0x5')]},'keyType':{'type':Sequelize[_0x25b0('0x2')](_0x25b0('0x3'),_0x25b0('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x25b0('0x5')]},'idField':{'type':Sequelize[_0x25b0('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x25b0('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x6e6c=['variable','STRING','BOOLEAN','sequelize','exports','string'];(function(_0x107ae6,_0x5c034f){var _0x341620=function(_0x81c77c){while(--_0x81c77c){_0x107ae6['push'](_0x107ae6['shift']());}};_0x341620(++_0x5c034f);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6e6c[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xc6e6('0x0'));module[_0xc6e6('0x1')]={'type':{'type':Sequelize['ENUM'](_0xc6e6('0x2'),_0xc6e6('0x3'),'customVariable','keyValue'),'defaultValue':_0xc6e6('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc6e6('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0xc6e6('0x2'),_0xc6e6('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xc6e6('0x4')]},'idField':{'type':Sequelize[_0xc6e6('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc6e6('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc6e6('0x4')]}};
\ No newline at end of file
index dcf86ec..15294f5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd2be=['params','rawAttributes','options','find','create','body','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../mysqldb','status','end','json','count','offset','apply','reject','save','update','then','destroy','sendStatus','error','name','index','VtigerField','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','map','key','field','includeAll','include','findAll','rows','catch','show'];(function(_0x52c5cc,_0x1d948f){var _0x4ab346=function(_0x3d941d){while(--_0x3d941d){_0x52c5cc['push'](_0x52c5cc['shift']());}};_0x4ab346(++_0x1d948f);}(_0xd2be,0x86));var _0xed2b=function(_0x9a7796,_0xe30784){_0x9a7796=_0x9a7796-0x0;var _0x2e73a0=_0xd2be[_0x9a7796];return _0x2e73a0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xed2b('0x0'));var zipdir=require(_0xed2b('0x1'));var jsonpatch=require(_0xed2b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xed2b('0x3'));var Mustache=require(_0xed2b('0x4'));var util=require(_0xed2b('0x5'));var path=require(_0xed2b('0x6'));var sox=require('sox');var csv=require(_0xed2b('0x7'));var ejs=require(_0xed2b('0x8'));var fs=require('fs');var _=require(_0xed2b('0x9'));var squel=require(_0xed2b('0xa'));var crypto=require('crypto');var jsforce=require(_0xed2b('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xed2b('0xc'));var authService=require(_0xed2b('0xd'));var hardwareService=require(_0xed2b('0xe'));var Redis=require(_0xed2b('0xf'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xed2b('0x10'))['db'];function respondWithStatusCode(_0x1421c4,_0x5df3d9){_0x5df3d9=_0x5df3d9||0xcc;return function(_0x3bda34){if(_0x3bda34){return _0x1421c4['sendStatus'](_0x5df3d9);}return _0x1421c4[_0xed2b('0x11')](_0x5df3d9)[_0xed2b('0x12')]();};}function respondWithResult(_0x366d2a,_0x111901){_0x111901=_0x111901||0xc8;return function(_0x3dd18b){if(_0x3dd18b){return _0x366d2a[_0xed2b('0x11')](_0x111901)[_0xed2b('0x13')](_0x3dd18b);}};}function respondWithFilteredResult(_0x5a08b0,_0x4ae146){return function(_0x1a6b66){if(_0x1a6b66){var _0xa6c74c=_0x1a6b66[_0xed2b('0x14')],_0x4fcf61=_0x4ae146[_0xed2b('0x15')],_0x4c9198=_0x4ae146['offset']+_0x4ae146['limit'],_0x13119d;if(_0x4c9198>=_0xa6c74c){_0x4c9198=_0xa6c74c;_0x13119d=0xc8;}else{_0x13119d=0xce;}_0x5a08b0[_0xed2b('0x11')](_0x13119d);return _0x5a08b0['set']('Content-Range',_0x4fcf61+'-'+_0x4c9198+'/'+_0xa6c74c)[_0xed2b('0x13')](_0x1a6b66);}return null;};}function patchUpdates(_0x572b39){return function(_0x173b44){try{jsonpatch[_0xed2b('0x16')](_0x173b44,_0x572b39,!![]);}catch(_0x29dd2e){return BPromise[_0xed2b('0x17')](_0x29dd2e);}return _0x173b44[_0xed2b('0x18')]();};}function saveUpdates(_0x52c32d,_0x545045){return function(_0x39f1a2){if(_0x39f1a2){return _0x39f1a2[_0xed2b('0x19')](_0x52c32d)[_0xed2b('0x1a')](function(_0xcd06b9){return _0xcd06b9;});}return null;};}function removeEntity(_0x42e92a,_0x40668a){return function(_0x21306b){if(_0x21306b){return _0x21306b[_0xed2b('0x1b')]()[_0xed2b('0x1a')](function(){_0x42e92a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x53911d,_0x1a244e){return function(_0xfc2f52){if(!_0xfc2f52){_0x53911d[_0xed2b('0x1c')](0x194);}return _0xfc2f52;};}function handleError(_0x4deda7,_0x15d036){_0x15d036=_0x15d036||0x1f4;return function(_0x313c13){logger[_0xed2b('0x1d')](_0x313c13['stack']);if(_0x313c13['name']){delete _0x313c13[_0xed2b('0x1e')];}_0x4deda7[_0xed2b('0x11')](_0x15d036)['send'](_0x313c13);};}exports[_0xed2b('0x1f')]=function(_0x2f4755,_0x50e57e){var _0x169135={},_0x5ef8c1={},_0x51ae98={'count':0x0,'rows':[]};var _0x56c741=db[_0xed2b('0x20')]['rawAttributes'];_0x5ef8c1[_0xed2b('0x21')]=_[_0xed2b('0x22')](_0x56c741);_0x5ef8c1['query']=_[_0xed2b('0x22')](_0x2f4755[_0xed2b('0x23')]);_0x5ef8c1['filters']=_[_0xed2b('0x24')](_0x5ef8c1[_0xed2b('0x21')],_0x5ef8c1[_0xed2b('0x23')]);_0x169135[_0xed2b('0x25')]=_['intersection'](_0x5ef8c1[_0xed2b('0x21')],qs[_0xed2b('0x26')](_0x2f4755[_0xed2b('0x23')][_0xed2b('0x26')]));_0x169135[_0xed2b('0x25')]=_0x169135[_0xed2b('0x25')][_0xed2b('0x27')]?_0x169135[_0xed2b('0x25')]:_0x5ef8c1[_0xed2b('0x21')];if(!_0x2f4755[_0xed2b('0x23')][_0xed2b('0x28')]('nolimit')){_0x169135[_0xed2b('0x29')]=qs[_0xed2b('0x29')](_0x2f4755[_0xed2b('0x23')][_0xed2b('0x29')]);_0x169135[_0xed2b('0x15')]=qs['offset'](_0x2f4755[_0xed2b('0x23')][_0xed2b('0x15')]);}_0x169135[_0xed2b('0x2a')]=qs['sort'](_0x2f4755[_0xed2b('0x23')][_0xed2b('0x2b')]);_0x169135[_0xed2b('0x2c')]=qs[_0xed2b('0x2d')](_[_0xed2b('0x2e')](_0x2f4755[_0xed2b('0x23')],_0x5ef8c1[_0xed2b('0x2d')]));if(_0x2f4755['query'][_0xed2b('0x2f')]){_0x169135[_0xed2b('0x2c')]=_[_0xed2b('0x30')](_0x169135[_0xed2b('0x2c')],{'$or':_[_0xed2b('0x31')](_0x56c741,function(_0x394314){if(_0x394314['type'][_0xed2b('0x32')]!=='VIRTUAL'){var _0xa5a57a={};_0xa5a57a[_0x394314[_0xed2b('0x33')]]={'$like':'%'+_0x2f4755['query'][_0xed2b('0x2f')]+'%'};return _0xa5a57a;}})});}_0x169135=_[_0xed2b('0x30')]({},_0x169135,_0x2f4755['options']);var _0x26e8d1={'where':_0x169135[_0xed2b('0x2c')]};return db[_0xed2b('0x20')][_0xed2b('0x14')](_0x26e8d1)[_0xed2b('0x1a')](function(_0x30ac08){_0x51ae98[_0xed2b('0x14')]=_0x30ac08;if(_0x2f4755[_0xed2b('0x23')][_0xed2b('0x34')]){_0x169135[_0xed2b('0x35')]=[{'all':!![]}];}return db[_0xed2b('0x20')][_0xed2b('0x36')](_0x169135);})['then'](function(_0x3ab194){_0x51ae98[_0xed2b('0x37')]=_0x3ab194;return _0x51ae98;})[_0xed2b('0x1a')](respondWithFilteredResult(_0x50e57e,_0x169135))[_0xed2b('0x38')](handleError(_0x50e57e,null));};exports[_0xed2b('0x39')]=function(_0x3fdb84,_0xe43e86){var _0x28b333={'raw':!![],'where':{'id':_0x3fdb84[_0xed2b('0x3a')]['id']}},_0x3e7de6={};_0x3e7de6[_0xed2b('0x21')]=_['keys'](db[_0xed2b('0x20')][_0xed2b('0x3b')]);_0x3e7de6[_0xed2b('0x23')]=_[_0xed2b('0x22')](_0x3fdb84['query']);_0x3e7de6[_0xed2b('0x2d')]=_[_0xed2b('0x24')](_0x3e7de6[_0xed2b('0x21')],_0x3e7de6[_0xed2b('0x23')]);_0x28b333[_0xed2b('0x25')]=_[_0xed2b('0x24')](_0x3e7de6['model'],qs[_0xed2b('0x26')](_0x3fdb84[_0xed2b('0x23')][_0xed2b('0x26')]));_0x28b333[_0xed2b('0x25')]=_0x28b333['attributes'][_0xed2b('0x27')]?_0x28b333['attributes']:_0x3e7de6[_0xed2b('0x21')];if(_0x3fdb84[_0xed2b('0x23')][_0xed2b('0x34')]){_0x28b333[_0xed2b('0x35')]=[{'all':!![]}];}_0x28b333=_['merge']({},_0x28b333,_0x3fdb84[_0xed2b('0x3c')]);return db[_0xed2b('0x20')][_0xed2b('0x3d')](_0x28b333)[_0xed2b('0x1a')](handleEntityNotFound(_0xe43e86,null))['then'](respondWithResult(_0xe43e86,null))[_0xed2b('0x38')](handleError(_0xe43e86,null));};exports['create']=function(_0x4fd2cb,_0x32f4bf){return db['VtigerField'][_0xed2b('0x3e')](_0x4fd2cb[_0xed2b('0x3f')],{})[_0xed2b('0x1a')](respondWithResult(_0x32f4bf,0xc9))['catch'](handleError(_0x32f4bf,null));};exports[_0xed2b('0x19')]=function(_0x5dfd6b,_0x4d1d36){if(_0x5dfd6b[_0xed2b('0x3f')]['id']){delete _0x5dfd6b[_0xed2b('0x3f')]['id'];}return db[_0xed2b('0x20')][_0xed2b('0x3d')]({'where':{'id':_0x5dfd6b[_0xed2b('0x3a')]['id']}})[_0xed2b('0x1a')](handleEntityNotFound(_0x4d1d36,null))[_0xed2b('0x1a')](saveUpdates(_0x5dfd6b[_0xed2b('0x3f')],null))[_0xed2b('0x1a')](respondWithResult(_0x4d1d36,null))[_0xed2b('0x38')](handleError(_0x4d1d36,null));};exports['destroy']=function(_0x41bdcd,_0x581ffe){return db['VtigerField'][_0xed2b('0x3d')]({'where':{'id':_0x41bdcd['params']['id']}})[_0xed2b('0x1a')](handleEntityNotFound(_0x581ffe,null))['then'](removeEntity(_0x581ffe,null))[_0xed2b('0x38')](handleError(_0x581ffe,null));};
\ No newline at end of file
+var _0x2f22=['Content-Range','reject','update','then','destroy','error','stack','name','index','VtigerField','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','count','includeAll','include','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set'];(function(_0x5d93fe,_0x5d3807){var _0x3fe2b8=function(_0x354230){while(--_0x354230){_0x5d93fe['push'](_0x5d93fe['shift']());}};_0x3fe2b8(++_0x5d3807);}(_0x2f22,0x156));var _0x22f2=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x2f22[_0x1d1779];return _0x2377e9;};'use strict';var pdf=require(_0x22f2('0x0'));var emlformat=require(_0x22f2('0x1'));var rimraf=require(_0x22f2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x22f2('0x3'));var rp=require(_0x22f2('0x4'));var moment=require('moment');var BPromise=require(_0x22f2('0x5'));var Mustache=require(_0x22f2('0x6'));var util=require(_0x22f2('0x7'));var path=require(_0x22f2('0x8'));var sox=require(_0x22f2('0x9'));var csv=require(_0x22f2('0xa'));var ejs=require(_0x22f2('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x22f2('0xc'));var crypto=require(_0x22f2('0xd'));var jsforce=require(_0x22f2('0xe'));var deskjs=require(_0x22f2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x22f2('0x10'));var Papa=require(_0x22f2('0x11'));var authService=require('../../components/auth/service');var hardwareService=require(_0x22f2('0x12'));var Redis=require(_0x22f2('0x13'));var qs=require(_0x22f2('0x14'));var logger=require(_0x22f2('0x15'))(_0x22f2('0x16'));var utils=require(_0x22f2('0x17'));var config=require(_0x22f2('0x18'));var db=require(_0x22f2('0x19'))['db'];function respondWithStatusCode(_0x29ce04,_0x12a8ef){_0x12a8ef=_0x12a8ef||0xcc;return function(_0x1b2d2e){if(_0x1b2d2e){return _0x29ce04[_0x22f2('0x1a')](_0x12a8ef);}return _0x29ce04[_0x22f2('0x1b')](_0x12a8ef)[_0x22f2('0x1c')]();};}function respondWithResult(_0x2ecf0d,_0x49a061){_0x49a061=_0x49a061||0xc8;return function(_0x4c72f8){if(_0x4c72f8){return _0x2ecf0d[_0x22f2('0x1b')](_0x49a061)[_0x22f2('0x1d')](_0x4c72f8);}};}function respondWithFilteredResult(_0x45ecb2,_0x28024d){return function(_0x586a8e){if(_0x586a8e){var _0x4ba894=_0x586a8e['count'],_0x1223dc=_0x28024d[_0x22f2('0x1e')],_0x1666f0=_0x28024d['offset']+_0x28024d[_0x22f2('0x1f')],_0x2b72f2;if(_0x1666f0>=_0x4ba894){_0x1666f0=_0x4ba894;_0x2b72f2=0xc8;}else{_0x2b72f2=0xce;}_0x45ecb2[_0x22f2('0x1b')](_0x2b72f2);return _0x45ecb2[_0x22f2('0x20')](_0x22f2('0x21'),_0x1223dc+'-'+_0x1666f0+'/'+_0x4ba894)[_0x22f2('0x1d')](_0x586a8e);}return null;};}function patchUpdates(_0x1aa78d){return function(_0x4c901d){try{jsonpatch['apply'](_0x4c901d,_0x1aa78d,!![]);}catch(_0x2f5bb0){return BPromise[_0x22f2('0x22')](_0x2f5bb0);}return _0x4c901d['save']();};}function saveUpdates(_0x17ebd7,_0x3eb534){return function(_0x35ab89){if(_0x35ab89){return _0x35ab89[_0x22f2('0x23')](_0x17ebd7)[_0x22f2('0x24')](function(_0x2fcc87){return _0x2fcc87;});}return null;};}function removeEntity(_0x1510c1,_0x3632c9){return function(_0x5d488e){if(_0x5d488e){return _0x5d488e[_0x22f2('0x25')]()[_0x22f2('0x24')](function(){_0x1510c1[_0x22f2('0x1b')](0xcc)[_0x22f2('0x1c')]();});}};}function handleEntityNotFound(_0x341f5c,_0x49c4e5){return function(_0x5eb241){if(!_0x5eb241){_0x341f5c['sendStatus'](0x194);}return _0x5eb241;};}function handleError(_0x42dddb,_0xa0fd50){_0xa0fd50=_0xa0fd50||0x1f4;return function(_0x46565c){logger[_0x22f2('0x26')](_0x46565c[_0x22f2('0x27')]);if(_0x46565c['name']){delete _0x46565c[_0x22f2('0x28')];}_0x42dddb[_0x22f2('0x1b')](_0xa0fd50)['send'](_0x46565c);};}exports[_0x22f2('0x29')]=function(_0x5a3a33,_0xb43c6c){var _0x544bc8={},_0x5747fa={},_0x5a448b={'count':0x0,'rows':[]};var _0x4673d0=db[_0x22f2('0x2a')][_0x22f2('0x2b')];_0x5747fa[_0x22f2('0x2c')]=_[_0x22f2('0x2d')](_0x4673d0);_0x5747fa['query']=_['keys'](_0x5a3a33[_0x22f2('0x2e')]);_0x5747fa[_0x22f2('0x2f')]=_[_0x22f2('0x30')](_0x5747fa[_0x22f2('0x2c')],_0x5747fa[_0x22f2('0x2e')]);_0x544bc8[_0x22f2('0x31')]=_[_0x22f2('0x30')](_0x5747fa['model'],qs[_0x22f2('0x32')](_0x5a3a33[_0x22f2('0x2e')][_0x22f2('0x32')]));_0x544bc8[_0x22f2('0x31')]=_0x544bc8[_0x22f2('0x31')][_0x22f2('0x33')]?_0x544bc8[_0x22f2('0x31')]:_0x5747fa['model'];if(!_0x5a3a33[_0x22f2('0x2e')][_0x22f2('0x34')](_0x22f2('0x35'))){_0x544bc8[_0x22f2('0x1f')]=qs[_0x22f2('0x1f')](_0x5a3a33[_0x22f2('0x2e')][_0x22f2('0x1f')]);_0x544bc8['offset']=qs[_0x22f2('0x1e')](_0x5a3a33['query']['offset']);}_0x544bc8[_0x22f2('0x36')]=qs[_0x22f2('0x37')](_0x5a3a33[_0x22f2('0x2e')][_0x22f2('0x37')]);_0x544bc8[_0x22f2('0x38')]=qs[_0x22f2('0x2f')](_[_0x22f2('0x39')](_0x5a3a33[_0x22f2('0x2e')],_0x5747fa[_0x22f2('0x2f')]));if(_0x5a3a33[_0x22f2('0x2e')][_0x22f2('0x3a')]){_0x544bc8[_0x22f2('0x38')]=_[_0x22f2('0x3b')](_0x544bc8['where'],{'$or':_[_0x22f2('0x3c')](_0x4673d0,function(_0x336024){if(_0x336024[_0x22f2('0x3d')][_0x22f2('0x3e')]!==_0x22f2('0x3f')){var _0x238b3e={};_0x238b3e[_0x336024[_0x22f2('0x40')]]={'$like':'%'+_0x5a3a33[_0x22f2('0x2e')][_0x22f2('0x3a')]+'%'};return _0x238b3e;}})});}_0x544bc8=_[_0x22f2('0x3b')]({},_0x544bc8,_0x5a3a33[_0x22f2('0x41')]);var _0x53a53c={'where':_0x544bc8[_0x22f2('0x38')]};return db['VtigerField'][_0x22f2('0x42')](_0x53a53c)[_0x22f2('0x24')](function(_0x99616c){_0x5a448b[_0x22f2('0x42')]=_0x99616c;if(_0x5a3a33[_0x22f2('0x2e')][_0x22f2('0x43')]){_0x544bc8[_0x22f2('0x44')]=[{'all':!![]}];}return db[_0x22f2('0x2a')]['findAll'](_0x544bc8);})['then'](function(_0x483bc1){_0x5a448b['rows']=_0x483bc1;return _0x5a448b;})[_0x22f2('0x24')](respondWithFilteredResult(_0xb43c6c,_0x544bc8))[_0x22f2('0x45')](handleError(_0xb43c6c,null));};exports[_0x22f2('0x46')]=function(_0x1d6e00,_0xee71a1){var _0x223473={'raw':!![],'where':{'id':_0x1d6e00[_0x22f2('0x47')]['id']}},_0x4e4365={};_0x4e4365[_0x22f2('0x2c')]=_['keys'](db[_0x22f2('0x2a')][_0x22f2('0x2b')]);_0x4e4365['query']=_[_0x22f2('0x2d')](_0x1d6e00[_0x22f2('0x2e')]);_0x4e4365[_0x22f2('0x2f')]=_[_0x22f2('0x30')](_0x4e4365['model'],_0x4e4365['query']);_0x223473[_0x22f2('0x31')]=_['intersection'](_0x4e4365[_0x22f2('0x2c')],qs['fields'](_0x1d6e00['query'][_0x22f2('0x32')]));_0x223473[_0x22f2('0x31')]=_0x223473[_0x22f2('0x31')][_0x22f2('0x33')]?_0x223473['attributes']:_0x4e4365['model'];if(_0x1d6e00['query'][_0x22f2('0x43')]){_0x223473[_0x22f2('0x44')]=[{'all':!![]}];}_0x223473=_[_0x22f2('0x3b')]({},_0x223473,_0x1d6e00[_0x22f2('0x41')]);return db['VtigerField'][_0x22f2('0x48')](_0x223473)[_0x22f2('0x24')](handleEntityNotFound(_0xee71a1,null))[_0x22f2('0x24')](respondWithResult(_0xee71a1,null))[_0x22f2('0x45')](handleError(_0xee71a1,null));};exports[_0x22f2('0x49')]=function(_0x4a8ba1,_0x49ddcc){return db[_0x22f2('0x2a')][_0x22f2('0x49')](_0x4a8ba1[_0x22f2('0x4a')],{})[_0x22f2('0x24')](respondWithResult(_0x49ddcc,0xc9))[_0x22f2('0x45')](handleError(_0x49ddcc,null));};exports[_0x22f2('0x23')]=function(_0x5ae04d,_0x3dfc6f){if(_0x5ae04d[_0x22f2('0x4a')]['id']){delete _0x5ae04d[_0x22f2('0x4a')]['id'];}return db[_0x22f2('0x2a')][_0x22f2('0x48')]({'where':{'id':_0x5ae04d['params']['id']}})[_0x22f2('0x24')](handleEntityNotFound(_0x3dfc6f,null))[_0x22f2('0x24')](saveUpdates(_0x5ae04d[_0x22f2('0x4a')],null))[_0x22f2('0x24')](respondWithResult(_0x3dfc6f,null))[_0x22f2('0x45')](handleError(_0x3dfc6f,null));};exports['destroy']=function(_0x5a1311,_0x1e0d2b){return db[_0x22f2('0x2a')]['find']({'where':{'id':_0x5a1311[_0x22f2('0x47')]['id']}})[_0x22f2('0x24')](handleEntityNotFound(_0x1e0d2b,null))[_0x22f2('0x24')](removeEntity(_0x1e0d2b,null))['catch'](handleError(_0x1e0d2b,null));};
\ No newline at end of file
index 8528d49..d685d9e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4d7e=['exports','define','VtigerField','int_vtiger_fields','idField','lodash','../../config/logger','api','bluebird','request-promise','./intVtigerField.attributes'];(function(_0x17253f,_0xbb82c){var _0x69d8=function(_0x36cfcb){while(--_0x36cfcb){_0x17253f['push'](_0x17253f['shift']());}};_0x69d8(++_0xbb82c);}(_0x4d7e,0x19c));var _0xe4d7=function(_0x11362f,_0x2fc8f0){_0x11362f=_0x11362f-0x0;var _0x5a446c=_0x4d7e[_0x11362f];return _0x5a446c;};'use strict';var _=require(_0xe4d7('0x0'));var util=require('util');var logger=require(_0xe4d7('0x1'))(_0xe4d7('0x2'));var moment=require('moment');var BPromise=require(_0xe4d7('0x3'));var rp=require(_0xe4d7('0x4'));var attributes=require(_0xe4d7('0x5'));module[_0xe4d7('0x6')]=function(_0x3b34f8,_0x476c70){return _0x3b34f8[_0xe4d7('0x7')](_0xe4d7('0x8'),attributes,{'tableName':_0xe4d7('0x9'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0xe4d7('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x5699=['./intVtigerField.attributes','exports','vtiger_unique_index','idField','FieldId','lodash','util','moment','request-promise'];(function(_0x35b9ed,_0x2e2ca9){var _0x30515b=function(_0x5a8a3c){while(--_0x5a8a3c){_0x35b9ed['push'](_0x35b9ed['shift']());}};_0x30515b(++_0x2e2ca9);}(_0x5699,0x68));var _0x9569=function(_0x321fd0,_0x254d31){_0x321fd0=_0x321fd0-0x0;var _0x23e223=_0x5699[_0x321fd0];return _0x23e223;};'use strict';var _=require(_0x9569('0x0'));var util=require(_0x9569('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9569('0x2'));var BPromise=require('bluebird');var rp=require(_0x9569('0x3'));var attributes=require(_0x9569('0x4'));module[_0x9569('0x5')]=function(_0xbce72e,_0x4cc869){return _0xbce72e['define']('VtigerField',attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x9569('0x6'),'fields':[_0x9569('0x7'),_0x9569('0x8')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index 1285875..7178dc7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x752c=['rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerField,\x20%s,\x20%s','debug','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4caa5f,_0x92897d){var _0x1e9d74=function(_0x534182){while(--_0x534182){_0x4caa5f['push'](_0x4caa5f['shift']());}};_0x1e9d74(++_0x92897d);}(_0x752c,0x98));var _0xc752=function(_0x5f15c2,_0x5f0114){_0x5f15c2=_0x5f15c2-0x0;var _0x137189=_0x752c[_0x5f15c2];return _0x137189;};'use strict';var _=require(_0xc752('0x0'));var util=require(_0xc752('0x1'));var moment=require(_0xc752('0x2'));var BPromise=require(_0xc752('0x3'));var rs=require(_0xc752('0x4'));var fs=require('fs');var Redis=require(_0xc752('0x5'));var db=require(_0xc752('0x6'))['db'];var utils=require(_0xc752('0x7'));var logger=require(_0xc752('0x8'))(_0xc752('0x9'));var config=require(_0xc752('0xa'));var jayson=require(_0xc752('0xb'));var client=jayson[_0xc752('0xc')][_0xc752('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x17b341,_0x45aa5f,_0x29fbd2){return new BPromise(function(_0x39971,_0x4a373c){return client[_0xc752('0xe')](_0x17b341,_0x29fbd2)['then'](function(_0x5f56a5){logger[_0xc752('0xf')](_0xc752('0x10'),_0x45aa5f,'request\x20sent');logger[_0xc752('0x11')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x45aa5f,'request\x20sent',JSON['stringify'](_0x5f56a5));if(_0x5f56a5['error']){if(_0x5f56a5[_0xc752('0x12')][_0xc752('0x13')]===0x1f4){logger[_0xc752('0x12')]('VtigerField,\x20%s,\x20%s',_0x45aa5f,_0x5f56a5['error'][_0xc752('0x14')]);return _0x4a373c(_0x5f56a5[_0xc752('0x12')]['message']);}logger[_0xc752('0x12')]('VtigerField,\x20%s,\x20%s',_0x45aa5f,_0x5f56a5[_0xc752('0x12')][_0xc752('0x14')]);return _0x39971(_0x5f56a5['error'][_0xc752('0x14')]);}else{logger[_0xc752('0xf')](_0xc752('0x10'),_0x45aa5f,_0xc752('0x15'));_0x39971(_0x5f56a5['result'][_0xc752('0x14')]);}})[_0xc752('0x16')](function(_0xd781ba){logger[_0xc752('0x12')](_0xc752('0x10'),_0x45aa5f,_0xd781ba);_0x4a373c(_0xd781ba);});});}
\ No newline at end of file
+var _0xe92e=['../../config/logger','../../config/environment','jayson/promise','client','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x1a4641,_0x1558fc){var _0x45fc0e=function(_0x1e6317){while(--_0x1e6317){_0x1a4641['push'](_0x1a4641['shift']());}};_0x45fc0e(++_0x1558fc);}(_0xe92e,0x15f));var _0xee92=function(_0x249c3e,_0x3299d7){_0x249c3e=_0x249c3e-0x0;var _0x1804da=_0xe92e[_0x249c3e];return _0x1804da;};'use strict';var _=require(_0xee92('0x0'));var util=require(_0xee92('0x1'));var moment=require(_0xee92('0x2'));var BPromise=require(_0xee92('0x3'));var rs=require(_0xee92('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xee92('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xee92('0x6'))('rpc');var config=require(_0xee92('0x7'));var jayson=require(_0xee92('0x8'));var client=jayson[_0xee92('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x198753,_0xe8a28e,_0x46e574){return new BPromise(function(_0x27bcf1,_0x33add8){return client['request'](_0x198753,_0x46e574)[_0xee92('0xa')](function(_0x530cb5){logger[_0xee92('0xb')](_0xee92('0xc'),_0xe8a28e,_0xee92('0xd'));logger['debug'](_0xee92('0xe'),_0xe8a28e,_0xee92('0xd'),JSON[_0xee92('0xf')](_0x530cb5));if(_0x530cb5[_0xee92('0x10')]){if(_0x530cb5[_0xee92('0x10')][_0xee92('0x11')]===0x1f4){logger['error'](_0xee92('0xc'),_0xe8a28e,_0x530cb5['error']['message']);return _0x33add8(_0x530cb5['error'][_0xee92('0x12')]);}logger[_0xee92('0x10')](_0xee92('0xc'),_0xe8a28e,_0x530cb5[_0xee92('0x10')]['message']);return _0x27bcf1(_0x530cb5[_0xee92('0x10')][_0xee92('0x12')]);}else{logger[_0xee92('0xb')](_0xee92('0xc'),_0xe8a28e,_0xee92('0xd'));_0x27bcf1(_0x530cb5[_0xee92('0x13')][_0xee92('0x12')]);}})[_0xee92('0x14')](function(_0x2a5bef){logger[_0xee92('0x10')](_0xee92('0xc'),_0xe8a28e,_0x2a5bef);_0x33add8(_0x2a5bef);});});}
\ No newline at end of file
index 9b6020b..7af3e27 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf60b=['getConfigurations','/:id/fields','post','create','addConfiguration','put','/:id','update','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show'];(function(_0xe1ec97,_0xb385e2){var _0x1a8924=function(_0x543fea){while(--_0x543fea){_0xe1ec97['push'](_0xe1ec97['shift']());}};_0x1a8924(++_0xb385e2);}(_0xf60b,0x19a));var _0xbf60=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xf60b[_0x173441];return _0x2423a8;};'use strict';var multer=require(_0xbf60('0x0'));var util=require('util');var path=require(_0xbf60('0x1'));var timeout=require('connect-timeout');var express=require(_0xbf60('0x2'));var router=express[_0xbf60('0x3')]();var auth=require(_0xbf60('0x4'));var interaction=require(_0xbf60('0x5'));var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router[_0xbf60('0x6')]('/',auth[_0xbf60('0x7')](),controller[_0xbf60('0x8')]);router[_0xbf60('0x6')]('/:id',auth[_0xbf60('0x7')](),controller[_0xbf60('0x9')]);router[_0xbf60('0x6')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xbf60('0xa')]);router['get'](_0xbf60('0xb'),auth[_0xbf60('0x7')](),controller['getFields']);router[_0xbf60('0xc')]('/',auth[_0xbf60('0x7')](),controller[_0xbf60('0xd')]);router['post']('/:id/configurations',auth[_0xbf60('0x7')](),controller[_0xbf60('0xe')]);router[_0xbf60('0xf')](_0xbf60('0x10'),auth['isAuthenticated'](),controller[_0xbf60('0x11')]);router['delete'](_0xbf60('0x10'),auth[_0xbf60('0x7')](),controller[_0xbf60('0x12')]);module[_0xbf60('0x13')]=router;
\ No newline at end of file
+var _0xc761=['../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id/configurations','/:id/fields','create','post','addConfiguration','/:id','update','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2786ea,_0x2a98c8){var _0x4ca087=function(_0x8a0a44){while(--_0x8a0a44){_0x2786ea['push'](_0x2786ea['shift']());}};_0x4ca087(++_0x2a98c8);}(_0xc761,0x150));var _0x1c76=function(_0x5c84a6,_0x321f95){_0x5c84a6=_0x5c84a6-0x0;var _0xb8c5f0=_0xc761[_0x5c84a6];return _0xb8c5f0;};'use strict';var multer=require(_0x1c76('0x0'));var util=require(_0x1c76('0x1'));var path=require('path');var timeout=require(_0x1c76('0x2'));var express=require('express');var router=express[_0x1c76('0x3')]();var auth=require(_0x1c76('0x4'));var interaction=require(_0x1c76('0x5'));var config=require(_0x1c76('0x6'));var controller=require(_0x1c76('0x7'));router[_0x1c76('0x8')]('/',auth[_0x1c76('0x9')](),controller['index']);router[_0x1c76('0x8')]('/:id',auth[_0x1c76('0x9')](),controller['show']);router['get'](_0x1c76('0xa'),auth[_0x1c76('0x9')](),controller['getConfigurations']);router[_0x1c76('0x8')](_0x1c76('0xb'),auth[_0x1c76('0x9')](),controller['getFields']);router['post']('/',auth[_0x1c76('0x9')](),controller[_0x1c76('0xc')]);router[_0x1c76('0xd')](_0x1c76('0xa'),auth[_0x1c76('0x9')](),controller[_0x1c76('0xe')]);router['put'](_0x1c76('0xf'),auth[_0x1c76('0x9')](),controller[_0x1c76('0x10')]);router[_0x1c76('0x11')](_0x1c76('0xf'),auth['isAuthenticated'](),controller[_0x1c76('0x12')]);module['exports']=router;
\ No newline at end of file
index 9c51ecd..41e32ca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x572b=['integrationTab','newTab','sequelize','exports','STRING','ENUM','password','token'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x572b,0x1b2));var _0xb572=function(_0x10c16d,_0x2b3e14){_0x10c16d=_0x10c16d-0x0;var _0x5896f4=_0x572b[_0x10c16d];return _0x5896f4;};'use strict';var Sequelize=require(_0xb572('0x0'));module[_0xb572('0x1')]={'name':{'type':Sequelize[_0xb572('0x2')]},'description':{'type':Sequelize[_0xb572('0x2')]},'username':{'type':Sequelize[_0xb572('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xb572('0x2')]},'token':{'type':Sequelize[_0xb572('0x2')]},'remoteUri':{'type':Sequelize[_0xb572('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xb572('0x3')](_0xb572('0x4'),_0xb572('0x5')),'defaultValue':_0xb572('0x4')},'serverUrl':{'type':Sequelize[_0xb572('0x2')]},'type':{'type':Sequelize[_0xb572('0x3')](_0xb572('0x6'),_0xb572('0x7')),'defaultValue':_0xb572('0x6')}};
\ No newline at end of file
+var _0x4294=['sequelize','exports','STRING','remoteUri','ENUM','password','token','integrationTab','newTab'];(function(_0xbf48a8,_0x408e23){var _0x574ca8=function(_0xa49e22){while(--_0xa49e22){_0xbf48a8['push'](_0xbf48a8['shift']());}};_0x574ca8(++_0x408e23);}(_0x4294,0x6c));var _0x4429=function(_0x5b5f4c,_0xf1e942){_0x5b5f4c=_0x5b5f4c-0x0;var _0x29ccbf=_0x4294[_0x5b5f4c];return _0x29ccbf;};'use strict';var Sequelize=require(_0x4429('0x0'));module[_0x4429('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4429('0x2')]},'username':{'type':Sequelize[_0x4429('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x4429('0x2')]},'token':{'type':Sequelize[_0x4429('0x2')]},'remoteUri':{'type':Sequelize[_0x4429('0x2')],'unique':_0x4429('0x3')},'authType':{'type':Sequelize[_0x4429('0x4')](_0x4429('0x5'),_0x4429('0x6')),'defaultValue':_0x4429('0x5')},'serverUrl':{'type':Sequelize[_0x4429('0x2')]},'type':{'type':Sequelize[_0x4429('0x4')](_0x4429('0x7'),_0x4429('0x8')),'defaultValue':'integrationTab'}};
\ No newline at end of file
index f85c58d..92e92f0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5f2f=['sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','then','destroy','end','stack','name','send','index','ZendeskAccount','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','map','type','key','VIRTUAL','field','filter','merge','options','includeAll','include','findAll','show','params','rawAttributes','length','find','create','body','update','getConfigurations','ZendeskConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','ZendeskField','Descriptions','getFields','password','token','authType','remoteUri','GET','format','%s%s','%s:%s','username','toString','base64','headers','Basic\x20%s','%s/token:%s','Sequelize','ValidationError','subject','description','group','assignee','remove','position','title','system_field_options','getFields,\x20%s,\x20%s,\x20%s','test','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path'];(function(_0x236f0a,_0xdda8f1){var _0x1b7512=function(_0xad2e46){while(--_0xad2e46){_0x236f0a['push'](_0x236f0a['shift']());}};_0x1b7512(++_0xdda8f1);}(_0x5f2f,0x73));var _0xf5f2=function(_0xe47ca,_0x5eeec0){_0xe47ca=_0xe47ca-0x0;var _0x2d90b7=_0x5f2f[_0xe47ca];return _0x2d90b7;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0xa'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var authService=require(_0xf5f2('0x11'));var hardwareService=require(_0xf5f2('0x12'));var Redis=require('ioredis');var qs=require(_0xf5f2('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xf5f2('0x14'));var config=require(_0xf5f2('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf5f2('0x16'));var jayson=require(_0xf5f2('0x17'));var client=jayson[_0xf5f2('0x18')][_0xf5f2('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x59bb6c,_0x3e5956,_0x5c01b8,_0x5850f4){return new BPromise(function(_0xea612c,_0x269909){var _0x1c1a5c=_0x5850f4||client;return _0x1c1a5c[_0xf5f2('0x1a')](_0x59bb6c,_0x5c01b8)['then'](function(_0xafe430){logger[_0xf5f2('0x1b')](_0xf5f2('0x1c'),_0x3e5956,_0xf5f2('0x1d'));logger[_0xf5f2('0x1e')](_0xf5f2('0x1f'),_0x3e5956,_0xf5f2('0x1d'),JSON[_0xf5f2('0x20')](_0xafe430));if(_0xafe430[_0xf5f2('0x21')]){if(_0xafe430[_0xf5f2('0x21')][_0xf5f2('0x22')]===0x1f4){logger[_0xf5f2('0x21')](_0xf5f2('0x1c'),_0x3e5956,_0xafe430[_0xf5f2('0x21')][_0xf5f2('0x23')]);return _0x269909(_0xafe430[_0xf5f2('0x21')][_0xf5f2('0x23')]);}logger['error'](_0xf5f2('0x1c'),_0x3e5956,_0xafe430[_0xf5f2('0x21')]['message']);return _0xea612c(_0xafe430['error'][_0xf5f2('0x23')]);}else{logger[_0xf5f2('0x1b')]('ZendeskAccount,\x20%s,\x20%s',_0x3e5956,_0xf5f2('0x1d'));_0xea612c(_0xafe430[_0xf5f2('0x24')][_0xf5f2('0x23')]);}})[_0xf5f2('0x25')](function(_0x36f1cb){logger['error'](_0xf5f2('0x1c'),_0x3e5956,_0x36f1cb);_0x269909(_0x36f1cb);});});}function respondWithStatusCode(_0x4669a6,_0x4e8bda){_0x4e8bda=_0x4e8bda||0xcc;return function(_0x2833fe){if(_0x2833fe){return _0x4669a6[_0xf5f2('0x26')](_0x4e8bda);}return _0x4669a6['status'](_0x4e8bda)['end']();};}function respondWithResult(_0x5f1124,_0x3f79d5){_0x3f79d5=_0x3f79d5||0xc8;return function(_0x13da6f){if(_0x13da6f){return _0x5f1124[_0xf5f2('0x27')](_0x3f79d5)[_0xf5f2('0x28')](_0x13da6f);}};}function respondWithFilteredResult(_0x788a8d,_0x13a3be){return function(_0x281ec8){if(_0x281ec8){var _0x294414=_0x281ec8[_0xf5f2('0x29')],_0x4ab014=_0x13a3be[_0xf5f2('0x2a')],_0xaa2602=_0x13a3be[_0xf5f2('0x2a')]+_0x13a3be[_0xf5f2('0x2b')],_0x102449;if(_0xaa2602>=_0x294414){_0xaa2602=_0x294414;_0x102449=0xc8;}else{_0x102449=0xce;}_0x788a8d['status'](_0x102449);return _0x788a8d['set'](_0xf5f2('0x2c'),_0x4ab014+'-'+_0xaa2602+'/'+_0x294414)[_0xf5f2('0x28')](_0x281ec8);}return null;};}function patchUpdates(_0x11c771){return function(_0x5027ab){try{jsonpatch['apply'](_0x5027ab,_0x11c771,!![]);}catch(_0x29571b){return BPromise[_0xf5f2('0x2d')](_0x29571b);}return _0x5027ab[_0xf5f2('0x2e')]();};}function saveUpdates(_0x153924,_0x1b381e){return function(_0x54c0c8){if(_0x54c0c8){return _0x54c0c8['update'](_0x153924)[_0xf5f2('0x2f')](function(_0x4e19cb){return _0x4e19cb;});}return null;};}function removeEntity(_0xb744b9,_0x58a4df){return function(_0x45b643){if(_0x45b643){return _0x45b643[_0xf5f2('0x30')]()[_0xf5f2('0x2f')](function(){_0xb744b9[_0xf5f2('0x27')](0xcc)[_0xf5f2('0x31')]();});}};}function handleEntityNotFound(_0x277eee,_0x2ac089){return function(_0x2c0e05){if(!_0x2c0e05){_0x277eee['sendStatus'](0x194);}return _0x2c0e05;};}function handleError(_0x4149e6,_0x43e4ff){_0x43e4ff=_0x43e4ff||0x1f4;return function(_0x4590ec){logger[_0xf5f2('0x21')](_0x4590ec[_0xf5f2('0x32')]);if(_0x4590ec[_0xf5f2('0x33')]){delete _0x4590ec[_0xf5f2('0x33')];}_0x4149e6['status'](_0x43e4ff)[_0xf5f2('0x34')](_0x4590ec);};}exports[_0xf5f2('0x35')]=function(_0x55989d,_0x3fc168){var _0x4b8c42={},_0x18ae07={},_0x3930fb={'count':0x0,'rows':[]};var _0x2a2c31=db[_0xf5f2('0x36')]['rawAttributes'];_0x18ae07['model']=_[_0xf5f2('0x37')](_0x2a2c31);_0x18ae07[_0xf5f2('0x38')]=_[_0xf5f2('0x37')](_0x55989d['query']);_0x18ae07[_0xf5f2('0x39')]=_['intersection'](_0x18ae07[_0xf5f2('0x3a')],_0x18ae07['query']);_0x4b8c42[_0xf5f2('0x3b')]=_[_0xf5f2('0x3c')](_0x18ae07['model'],qs[_0xf5f2('0x3d')](_0x55989d[_0xf5f2('0x38')][_0xf5f2('0x3d')]));_0x4b8c42[_0xf5f2('0x3b')]=_0x4b8c42['attributes']['length']?_0x4b8c42[_0xf5f2('0x3b')]:_0x18ae07[_0xf5f2('0x3a')];if(!_0x55989d[_0xf5f2('0x38')][_0xf5f2('0x3e')](_0xf5f2('0x3f'))){_0x4b8c42[_0xf5f2('0x2b')]=qs[_0xf5f2('0x2b')](_0x55989d['query'][_0xf5f2('0x2b')]);_0x4b8c42[_0xf5f2('0x2a')]=qs['offset'](_0x55989d[_0xf5f2('0x38')][_0xf5f2('0x2a')]);}_0x4b8c42[_0xf5f2('0x40')]=qs[_0xf5f2('0x41')](_0x55989d[_0xf5f2('0x38')][_0xf5f2('0x41')]);_0x4b8c42[_0xf5f2('0x42')]=qs[_0xf5f2('0x39')](_['pick'](_0x55989d[_0xf5f2('0x38')],_0x18ae07[_0xf5f2('0x39')]));if(_0x55989d[_0xf5f2('0x38')]['filter']){_0x4b8c42['where']=_['merge'](_0x4b8c42[_0xf5f2('0x42')],{'$or':_[_0xf5f2('0x43')](_0x2a2c31,function(_0x4c8d8e){if(_0x4c8d8e[_0xf5f2('0x44')][_0xf5f2('0x45')]!==_0xf5f2('0x46')){var _0x31f86c={};_0x31f86c[_0x4c8d8e[_0xf5f2('0x47')]]={'$like':'%'+_0x55989d[_0xf5f2('0x38')][_0xf5f2('0x48')]+'%'};return _0x31f86c;}})});}_0x4b8c42=_[_0xf5f2('0x49')]({},_0x4b8c42,_0x55989d[_0xf5f2('0x4a')]);var _0x106062={'where':_0x4b8c42[_0xf5f2('0x42')]};return db[_0xf5f2('0x36')][_0xf5f2('0x29')](_0x106062)[_0xf5f2('0x2f')](function(_0x4faeed){_0x3930fb[_0xf5f2('0x29')]=_0x4faeed;if(_0x55989d['query'][_0xf5f2('0x4b')]){_0x4b8c42[_0xf5f2('0x4c')]=[{'all':!![]}];}return db[_0xf5f2('0x36')][_0xf5f2('0x4d')](_0x4b8c42);})[_0xf5f2('0x2f')](function(_0x3721c4){_0x3930fb['rows']=_0x3721c4;return _0x3930fb;})[_0xf5f2('0x2f')](respondWithFilteredResult(_0x3fc168,_0x4b8c42))[_0xf5f2('0x25')](handleError(_0x3fc168,null));};exports[_0xf5f2('0x4e')]=function(_0x29b108,_0x12124d){var _0x10753a={'raw':![],'where':{'id':_0x29b108[_0xf5f2('0x4f')]['id']}},_0xf638ff={};_0xf638ff['model']=_[_0xf5f2('0x37')](db[_0xf5f2('0x36')][_0xf5f2('0x50')]);_0xf638ff['query']=_[_0xf5f2('0x37')](_0x29b108[_0xf5f2('0x38')]);_0xf638ff[_0xf5f2('0x39')]=_['intersection'](_0xf638ff['model'],_0xf638ff[_0xf5f2('0x38')]);_0x10753a[_0xf5f2('0x3b')]=_['intersection'](_0xf638ff[_0xf5f2('0x3a')],qs['fields'](_0x29b108[_0xf5f2('0x38')]['fields']));_0x10753a[_0xf5f2('0x3b')]=_0x10753a['attributes'][_0xf5f2('0x51')]?_0x10753a[_0xf5f2('0x3b')]:_0xf638ff[_0xf5f2('0x3a')];if(_0x29b108[_0xf5f2('0x38')]['includeAll']){_0x10753a[_0xf5f2('0x4c')]=[{'all':!![]}];}_0x10753a=_[_0xf5f2('0x49')]({},_0x10753a,_0x29b108['options']);return db['ZendeskAccount'][_0xf5f2('0x52')](_0x10753a)[_0xf5f2('0x2f')](handleEntityNotFound(_0x12124d,null))['then'](respondWithResult(_0x12124d,null))[_0xf5f2('0x25')](handleError(_0x12124d,null));};exports[_0xf5f2('0x53')]=function(_0x29c9b6,_0x41b1c7){return db['ZendeskAccount']['create'](_0x29c9b6[_0xf5f2('0x54')],{})[_0xf5f2('0x2f')](respondWithResult(_0x41b1c7,0xc9))['catch'](handleError(_0x41b1c7,null));};exports[_0xf5f2('0x55')]=function(_0x43fc49,_0x255125){if(_0x43fc49[_0xf5f2('0x54')]['id']){delete _0x43fc49[_0xf5f2('0x54')]['id'];}return db[_0xf5f2('0x36')][_0xf5f2('0x52')]({'where':{'id':_0x43fc49['params']['id']}})['then'](handleEntityNotFound(_0x255125,null))[_0xf5f2('0x2f')](saveUpdates(_0x43fc49[_0xf5f2('0x54')],null))[_0xf5f2('0x2f')](respondWithResult(_0x255125,null))[_0xf5f2('0x25')](handleError(_0x255125,null));};exports[_0xf5f2('0x30')]=function(_0x5a861d,_0xdb1106){return db[_0xf5f2('0x36')][_0xf5f2('0x52')]({'where':{'id':_0x5a861d['params']['id']}})[_0xf5f2('0x2f')](handleEntityNotFound(_0xdb1106,null))['then'](removeEntity(_0xdb1106,null))[_0xf5f2('0x25')](handleError(_0xdb1106,null));};exports[_0xf5f2('0x56')]=function(_0x28cce5,_0x10f391,_0x4afa4d){var _0x5a5338={};var _0x756f1f={};var _0x4de303;var _0xa39c65;return db[_0xf5f2('0x36')]['findOne']({'where':{'id':_0x28cce5[_0xf5f2('0x4f')]['id']}})[_0xf5f2('0x2f')](handleEntityNotFound(_0x10f391,null))[_0xf5f2('0x2f')](function(_0x51ef09){if(_0x51ef09){_0x4de303=_0x51ef09;_0x756f1f[_0xf5f2('0x3a')]=_[_0xf5f2('0x37')](db[_0xf5f2('0x57')][_0xf5f2('0x50')]);_0x756f1f['query']=_[_0xf5f2('0x37')](_0x28cce5['query']);_0x756f1f[_0xf5f2('0x39')]=_[_0xf5f2('0x3c')](_0x756f1f[_0xf5f2('0x3a')],_0x756f1f[_0xf5f2('0x38')]);_0x5a5338[_0xf5f2('0x3b')]=_['intersection'](_0x756f1f[_0xf5f2('0x3a')],qs[_0xf5f2('0x3d')](_0x28cce5[_0xf5f2('0x38')][_0xf5f2('0x3d')]));_0x5a5338[_0xf5f2('0x3b')]=_0x5a5338['attributes'][_0xf5f2('0x51')]?_0x5a5338['attributes']:_0x756f1f['model'];_0x5a5338[_0xf5f2('0x40')]=qs['sort'](_0x28cce5[_0xf5f2('0x38')][_0xf5f2('0x41')]);_0x5a5338[_0xf5f2('0x42')]=qs[_0xf5f2('0x39')](_['pick'](_0x28cce5[_0xf5f2('0x38')],_0x756f1f[_0xf5f2('0x39')]));if(_0x28cce5[_0xf5f2('0x38')][_0xf5f2('0x48')]){_0x5a5338[_0xf5f2('0x42')]=_[_0xf5f2('0x49')](_0x5a5338[_0xf5f2('0x42')],{'$or':_['map'](_0x5a5338[_0xf5f2('0x3b')],function(_0x2d171d){var _0xb39a6e={};_0xb39a6e[_0x2d171d]={'$like':'%'+_0x28cce5[_0xf5f2('0x38')]['filter']+'%'};return _0xb39a6e;})});}_0x5a5338=_[_0xf5f2('0x49')]({},_0x5a5338,_0x28cce5['options']);return _0x4de303[_0xf5f2('0x56')](_0x5a5338);}})[_0xf5f2('0x2f')](function(_0x5588cf){if(_0x5588cf){_0xa39c65=_0x5588cf[_0xf5f2('0x51')];if(!_0x28cce5[_0xf5f2('0x38')][_0xf5f2('0x3e')](_0xf5f2('0x3f'))){_0x5a5338[_0xf5f2('0x2b')]=qs['limit'](_0x28cce5[_0xf5f2('0x38')][_0xf5f2('0x2b')]);_0x5a5338[_0xf5f2('0x2a')]=qs[_0xf5f2('0x2a')](_0x28cce5[_0xf5f2('0x38')][_0xf5f2('0x2a')]);}return _0x4de303['getConfigurations'](_0x5a5338);}})[_0xf5f2('0x2f')](function(_0x3f475e){if(_0x3f475e){return _0x3f475e?{'count':_0xa39c65,'rows':_0x3f475e}:null;}})['then'](respondWithResult(_0x10f391,null))[_0xf5f2('0x25')](handleError(_0x10f391,null));};exports[_0xf5f2('0x58')]=function(_0x377aad,_0x51a3c7,_0x551cc9){if(_0x377aad['body']['id']){delete _0x377aad[_0xf5f2('0x54')]['id'];}return db[_0xf5f2('0x36')][_0xf5f2('0x59')]({'where':{'id':_0x377aad[_0xf5f2('0x4f')]['id']}})[_0xf5f2('0x2f')](handleEntityNotFound(_0x51a3c7,null))['then'](function(_0x278b76){if(_0x278b76){_0x377aad[_0xf5f2('0x54')][_0xf5f2('0x5a')]=_0x278b76['id'];_0x377aad[_0xf5f2('0x54')][_0xf5f2('0x5b')]=integrations[_0xf5f2('0x5c')](_0x377aad[_0xf5f2('0x54')][_0xf5f2('0x5d')],_0x377aad[_0xf5f2('0x54')][_0xf5f2('0x44')]);_0x377aad[_0xf5f2('0x54')]['Descriptions']=integrations['getDescriptions'](_0x377aad['body'][_0xf5f2('0x5d')],_0x377aad[_0xf5f2('0x54')][_0xf5f2('0x44')]);return db[_0xf5f2('0x57')][_0xf5f2('0x53')](_0x377aad['body'],{'include':[{'model':db[_0xf5f2('0x5e')],'as':_0xf5f2('0x5b')},{'model':db[_0xf5f2('0x5e')],'as':_0xf5f2('0x5f')}]});}return null;})[_0xf5f2('0x2f')](respondWithResult(_0x51a3c7,null))['catch'](handleError(_0x51a3c7,null));};exports[_0xf5f2('0x60')]=function(_0x1409b9,_0x517c15,_0x777098){return db[_0xf5f2('0x36')][_0xf5f2('0x59')]({'where':{'id':_0x1409b9[_0xf5f2('0x4f')]['id']},'attributes':['id','username',_0xf5f2('0x61'),_0xf5f2('0x62'),_0xf5f2('0x63'),_0xf5f2('0x64')]})[_0xf5f2('0x2f')](handleEntityNotFound(_0x517c15,null))['then'](function(_0x5cab92){if(_0x5cab92){var _0x32788b={'method':_0xf5f2('0x65'),'uri':util[_0xf5f2('0x66')](_0xf5f2('0x67'),_0x5cab92['remoteUri'],'ticket_fields'),'json':!![]};switch(_0x5cab92[_0xf5f2('0x63')]){case'password':_0x32788b['headers']={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xf5f2('0x66')](_0xf5f2('0x68'),_0x5cab92[_0xf5f2('0x69')],_0x5cab92[_0xf5f2('0x61')]))[_0xf5f2('0x6a')](_0xf5f2('0x6b')))};break;case _0xf5f2('0x62'):_0x32788b[_0xf5f2('0x6c')]={'Authorization':util[_0xf5f2('0x66')](_0xf5f2('0x6d'),new Buffer(util[_0xf5f2('0x66')](_0xf5f2('0x6e'),_0x5cab92[_0xf5f2('0x69')],_0x5cab92[_0xf5f2('0x62')]))[_0xf5f2('0x6a')](_0xf5f2('0x6b')))};break;default:throw new db[(_0xf5f2('0x6f'))][(_0xf5f2('0x70'))]('Unknown\x20authentication\x20type');}return rp(_0x32788b);}})[_0xf5f2('0x2f')](function(_0x35299d){if(_0x35299d){var _0x21043b=[_0xf5f2('0x71'),_0xf5f2('0x72'),_0xf5f2('0x73'),_0xf5f2('0x74')];_[_0xf5f2('0x75')](_0x35299d['ticket_fields'],function(_0x38675d){return _0x21043b['includes'](_0x38675d['type']);});return{'count':_0x35299d['ticket_fields']['length'],'rows':_['map'](_0x35299d['ticket_fields'],function(_0x161890){return{'id':_0x161890['id'],'name':_0x161890[_0xf5f2('0x76')]>0x7?_0x161890[_0xf5f2('0x77')]:_0x161890[_0xf5f2('0x44')],'custom':_0x161890[_0xf5f2('0x76')]>0x7?!![]:![],'options':_0x161890[_0xf5f2('0x78')]?_0x161890['system_field_options']:[]};})};}})['then'](respondWithResult(_0x517c15,null))[_0xf5f2('0x25')](function(_0x578a22){var _0x418ece=_0x1409b9[_0xf5f2('0x38')]['test']?0x1f4:_0x578a22['statusCode']||0x1f4;logger[_0xf5f2('0x21')](_0xf5f2('0x79'),'getFields',_0x418ece,JSON[_0xf5f2('0x20')](_0x578a22));delete _0x578a22[_0xf5f2('0x33')];if(_0x418ece===0x191){_0x418ece=0x190;}_0x517c15['status'](_0x418ece)[_0xf5f2('0x34')](_0x1409b9[_0xf5f2('0x38')][_0xf5f2('0x7a')]?{'message':'Wrong\x20credentials','statusCode':_0x578a22[_0xf5f2('0x7b')]}:_0x578a22);});};
\ No newline at end of file
+var _0xdab3=['querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','status','json','count','offset','set','apply','reject','save','update','destroy','end','stack','name','send','index','ZendeskAccount','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','filter','where','merge','map','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','params','rawAttributes','find','catch','create','body','getConfigurations','ZendeskConfiguration','pick','nolimit','addConfiguration','findOne','channel','Descriptions','getDescriptions','ZendeskField','Subjects','getFields','username','password','remoteUri','slice','GET','format','%s/%s','authType','Basic\x20%s','%s:%s','toString','base64','token','headers','%s/token:%s','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','ticket_fields','includes','position','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js'];(function(_0x500604,_0x300628){var _0x5d2958=function(_0x396d0d){while(--_0x396d0d){_0x500604['push'](_0x500604['shift']());}};_0x5d2958(++_0x300628);}(_0xdab3,0xeb));var _0x3dab=function(_0x5885f7,_0x4e1635){_0x5885f7=_0x5885f7-0x0;var _0x4f597f=_0xdab3[_0x5885f7];return _0x4f597f;};'use strict';var pdf=require(_0x3dab('0x0'));var emlformat=require(_0x3dab('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3dab('0x2'));var jsonpatch=require(_0x3dab('0x3'));var rp=require(_0x3dab('0x4'));var moment=require(_0x3dab('0x5'));var BPromise=require(_0x3dab('0x6'));var Mustache=require(_0x3dab('0x7'));var util=require('util');var path=require('path');var sox=require(_0x3dab('0x8'));var csv=require(_0x3dab('0x9'));var ejs=require(_0x3dab('0xa'));var fs=require('fs');var _=require(_0x3dab('0xb'));var squel=require(_0x3dab('0xc'));var crypto=require(_0x3dab('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3dab('0xe'));var toCsv=require(_0x3dab('0x9'));var querystring=require(_0x3dab('0xf'));var Papa=require(_0x3dab('0x10'));var authService=require(_0x3dab('0x11'));var hardwareService=require(_0x3dab('0x12'));var Redis=require(_0x3dab('0x13'));var qs=require('../../components/parsers/qs');var logger=require(_0x3dab('0x14'))(_0x3dab('0x15'));var utils=require(_0x3dab('0x16'));var config=require(_0x3dab('0x17'));var db=require(_0x3dab('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x3dab('0x19')][_0x3dab('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x302eec,_0xfd33af,_0x28fdaa,_0x13c035){return new BPromise(function(_0x1e9dcb,_0xb44734){var _0x54bf6e=_0x13c035||client;return _0x54bf6e[_0x3dab('0x1b')](_0x302eec,_0x28fdaa)[_0x3dab('0x1c')](function(_0x5b0784){logger[_0x3dab('0x1d')](_0x3dab('0x1e'),_0xfd33af,'request\x20sent');logger['debug'](_0x3dab('0x1f'),_0xfd33af,_0x3dab('0x20'),JSON[_0x3dab('0x21')](_0x5b0784));if(_0x5b0784[_0x3dab('0x22')]){if(_0x5b0784[_0x3dab('0x22')]['code']===0x1f4){logger[_0x3dab('0x22')](_0x3dab('0x1e'),_0xfd33af,_0x5b0784['error'][_0x3dab('0x23')]);return _0xb44734(_0x5b0784[_0x3dab('0x22')][_0x3dab('0x23')]);}logger[_0x3dab('0x22')]('ZendeskAccount,\x20%s,\x20%s',_0xfd33af,_0x5b0784[_0x3dab('0x22')][_0x3dab('0x23')]);return _0x1e9dcb(_0x5b0784[_0x3dab('0x22')][_0x3dab('0x23')]);}else{logger[_0x3dab('0x1d')](_0x3dab('0x1e'),_0xfd33af,_0x3dab('0x20'));_0x1e9dcb(_0x5b0784[_0x3dab('0x24')][_0x3dab('0x23')]);}})['catch'](function(_0x29d21a){logger['error'](_0x3dab('0x1e'),_0xfd33af,_0x29d21a);_0xb44734(_0x29d21a);});});}function respondWithStatusCode(_0x23f69a,_0x420de0){_0x420de0=_0x420de0||0xcc;return function(_0x227c86){if(_0x227c86){return _0x23f69a[_0x3dab('0x25')](_0x420de0);}return _0x23f69a[_0x3dab('0x26')](_0x420de0)['end']();};}function respondWithResult(_0x50bd53,_0x1b127e){_0x1b127e=_0x1b127e||0xc8;return function(_0x10f848){if(_0x10f848){return _0x50bd53['status'](_0x1b127e)[_0x3dab('0x27')](_0x10f848);}};}function respondWithFilteredResult(_0x2f78d7,_0x240c59){return function(_0x151806){if(_0x151806){var _0x5acc7b=_0x151806[_0x3dab('0x28')],_0x2215d7=_0x240c59[_0x3dab('0x29')],_0x4999c4=_0x240c59[_0x3dab('0x29')]+_0x240c59['limit'],_0x803cc1;if(_0x4999c4>=_0x5acc7b){_0x4999c4=_0x5acc7b;_0x803cc1=0xc8;}else{_0x803cc1=0xce;}_0x2f78d7['status'](_0x803cc1);return _0x2f78d7[_0x3dab('0x2a')]('Content-Range',_0x2215d7+'-'+_0x4999c4+'/'+_0x5acc7b)['json'](_0x151806);}return null;};}function patchUpdates(_0x5b6026){return function(_0x56b1d6){try{jsonpatch[_0x3dab('0x2b')](_0x56b1d6,_0x5b6026,!![]);}catch(_0x299de6){return BPromise[_0x3dab('0x2c')](_0x299de6);}return _0x56b1d6[_0x3dab('0x2d')]();};}function saveUpdates(_0x2088cc,_0x3f612a){return function(_0xf2c487){if(_0xf2c487){return _0xf2c487[_0x3dab('0x2e')](_0x2088cc)[_0x3dab('0x1c')](function(_0x235922){return _0x235922;});}return null;};}function removeEntity(_0x122437,_0x29f9cf){return function(_0x2c445d){if(_0x2c445d){return _0x2c445d[_0x3dab('0x2f')]()[_0x3dab('0x1c')](function(){_0x122437[_0x3dab('0x26')](0xcc)[_0x3dab('0x30')]();});}};}function handleEntityNotFound(_0x413bc9,_0x341c2d){return function(_0x383ef8){if(!_0x383ef8){_0x413bc9['sendStatus'](0x194);}return _0x383ef8;};}function handleError(_0x599b21,_0x3bea25){_0x3bea25=_0x3bea25||0x1f4;return function(_0x4f3dca){logger[_0x3dab('0x22')](_0x4f3dca[_0x3dab('0x31')]);if(_0x4f3dca['name']){delete _0x4f3dca[_0x3dab('0x32')];}_0x599b21[_0x3dab('0x26')](_0x3bea25)[_0x3dab('0x33')](_0x4f3dca);};}exports[_0x3dab('0x34')]=function(_0x5430e3,_0x5ce8e5){var _0x3c56bd={},_0x47e768={},_0x1f0171={'count':0x0,'rows':[]};var _0x34a856=db[_0x3dab('0x35')]['rawAttributes'];_0x47e768['model']=_[_0x3dab('0x36')](_0x34a856);_0x47e768[_0x3dab('0x37')]=_[_0x3dab('0x36')](_0x5430e3['query']);_0x47e768[_0x3dab('0x38')]=_[_0x3dab('0x39')](_0x47e768[_0x3dab('0x3a')],_0x47e768[_0x3dab('0x37')]);_0x3c56bd[_0x3dab('0x3b')]=_['intersection'](_0x47e768[_0x3dab('0x3a')],qs[_0x3dab('0x3c')](_0x5430e3[_0x3dab('0x37')][_0x3dab('0x3c')]));_0x3c56bd[_0x3dab('0x3b')]=_0x3c56bd[_0x3dab('0x3b')][_0x3dab('0x3d')]?_0x3c56bd['attributes']:_0x47e768[_0x3dab('0x3a')];if(!_0x5430e3[_0x3dab('0x37')][_0x3dab('0x3e')]('nolimit')){_0x3c56bd['limit']=qs[_0x3dab('0x3f')](_0x5430e3[_0x3dab('0x37')][_0x3dab('0x3f')]);_0x3c56bd[_0x3dab('0x29')]=qs['offset'](_0x5430e3[_0x3dab('0x37')][_0x3dab('0x29')]);}_0x3c56bd[_0x3dab('0x40')]=qs[_0x3dab('0x41')](_0x5430e3[_0x3dab('0x37')][_0x3dab('0x41')]);_0x3c56bd['where']=qs[_0x3dab('0x38')](_['pick'](_0x5430e3['query'],_0x47e768[_0x3dab('0x38')]));if(_0x5430e3['query'][_0x3dab('0x42')]){_0x3c56bd[_0x3dab('0x43')]=_[_0x3dab('0x44')](_0x3c56bd['where'],{'$or':_[_0x3dab('0x45')](_0x34a856,function(_0x1974db){if(_0x1974db[_0x3dab('0x46')][_0x3dab('0x47')]!==_0x3dab('0x48')){var _0x90b36={};_0x90b36[_0x1974db[_0x3dab('0x49')]]={'$like':'%'+_0x5430e3['query'][_0x3dab('0x42')]+'%'};return _0x90b36;}})});}_0x3c56bd=_['merge']({},_0x3c56bd,_0x5430e3[_0x3dab('0x4a')]);var _0x4615e5={'where':_0x3c56bd[_0x3dab('0x43')]};return db['ZendeskAccount'][_0x3dab('0x28')](_0x4615e5)[_0x3dab('0x1c')](function(_0x56422c){_0x1f0171['count']=_0x56422c;if(_0x5430e3[_0x3dab('0x37')][_0x3dab('0x4b')]){_0x3c56bd[_0x3dab('0x4c')]=[{'all':!![]}];}return db[_0x3dab('0x35')][_0x3dab('0x4d')](_0x3c56bd);})[_0x3dab('0x1c')](function(_0x4743fd){_0x1f0171[_0x3dab('0x4e')]=_0x4743fd;return _0x1f0171;})[_0x3dab('0x1c')](respondWithFilteredResult(_0x5ce8e5,_0x3c56bd))['catch'](handleError(_0x5ce8e5,null));};exports['show']=function(_0x553d15,_0x14960d){var _0x439f9e={'raw':![],'where':{'id':_0x553d15[_0x3dab('0x4f')]['id']}},_0x5780ec={};_0x5780ec[_0x3dab('0x3a')]=_[_0x3dab('0x36')](db[_0x3dab('0x35')][_0x3dab('0x50')]);_0x5780ec[_0x3dab('0x37')]=_['keys'](_0x553d15[_0x3dab('0x37')]);_0x5780ec['filters']=_[_0x3dab('0x39')](_0x5780ec[_0x3dab('0x3a')],_0x5780ec[_0x3dab('0x37')]);_0x439f9e[_0x3dab('0x3b')]=_['intersection'](_0x5780ec[_0x3dab('0x3a')],qs[_0x3dab('0x3c')](_0x553d15[_0x3dab('0x37')][_0x3dab('0x3c')]));_0x439f9e['attributes']=_0x439f9e[_0x3dab('0x3b')][_0x3dab('0x3d')]?_0x439f9e[_0x3dab('0x3b')]:_0x5780ec[_0x3dab('0x3a')];if(_0x553d15[_0x3dab('0x37')]['includeAll']){_0x439f9e[_0x3dab('0x4c')]=[{'all':!![]}];}_0x439f9e=_['merge']({},_0x439f9e,_0x553d15[_0x3dab('0x4a')]);return db[_0x3dab('0x35')][_0x3dab('0x51')](_0x439f9e)['then'](handleEntityNotFound(_0x14960d,null))['then'](respondWithResult(_0x14960d,null))[_0x3dab('0x52')](handleError(_0x14960d,null));};exports[_0x3dab('0x53')]=function(_0x3515ae,_0x20f7c7){return db['ZendeskAccount'][_0x3dab('0x53')](_0x3515ae[_0x3dab('0x54')],{})[_0x3dab('0x1c')](respondWithResult(_0x20f7c7,0xc9))[_0x3dab('0x52')](handleError(_0x20f7c7,null));};exports['update']=function(_0x543080,_0x4986cb){if(_0x543080[_0x3dab('0x54')]['id']){delete _0x543080[_0x3dab('0x54')]['id'];}return db[_0x3dab('0x35')][_0x3dab('0x51')]({'where':{'id':_0x543080[_0x3dab('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4986cb,null))[_0x3dab('0x1c')](saveUpdates(_0x543080[_0x3dab('0x54')],null))[_0x3dab('0x1c')](respondWithResult(_0x4986cb,null))[_0x3dab('0x52')](handleError(_0x4986cb,null));};exports[_0x3dab('0x2f')]=function(_0x5a9bdd,_0x565443){return db['ZendeskAccount'][_0x3dab('0x51')]({'where':{'id':_0x5a9bdd[_0x3dab('0x4f')]['id']}})[_0x3dab('0x1c')](handleEntityNotFound(_0x565443,null))['then'](removeEntity(_0x565443,null))[_0x3dab('0x52')](handleError(_0x565443,null));};exports[_0x3dab('0x55')]=function(_0x54a31c,_0x297d5b,_0x9aca1b){var _0x5c6a58={};var _0xb9eb31={};var _0x47d734;var _0x5aa4b7;return db[_0x3dab('0x35')]['findOne']({'where':{'id':_0x54a31c[_0x3dab('0x4f')]['id']}})[_0x3dab('0x1c')](handleEntityNotFound(_0x297d5b,null))[_0x3dab('0x1c')](function(_0x101a4f){if(_0x101a4f){_0x47d734=_0x101a4f;_0xb9eb31[_0x3dab('0x3a')]=_[_0x3dab('0x36')](db[_0x3dab('0x56')][_0x3dab('0x50')]);_0xb9eb31['query']=_[_0x3dab('0x36')](_0x54a31c[_0x3dab('0x37')]);_0xb9eb31[_0x3dab('0x38')]=_[_0x3dab('0x39')](_0xb9eb31[_0x3dab('0x3a')],_0xb9eb31[_0x3dab('0x37')]);_0x5c6a58[_0x3dab('0x3b')]=_[_0x3dab('0x39')](_0xb9eb31[_0x3dab('0x3a')],qs[_0x3dab('0x3c')](_0x54a31c[_0x3dab('0x37')][_0x3dab('0x3c')]));_0x5c6a58[_0x3dab('0x3b')]=_0x5c6a58[_0x3dab('0x3b')][_0x3dab('0x3d')]?_0x5c6a58[_0x3dab('0x3b')]:_0xb9eb31[_0x3dab('0x3a')];_0x5c6a58['order']=qs[_0x3dab('0x41')](_0x54a31c[_0x3dab('0x37')][_0x3dab('0x41')]);_0x5c6a58['where']=qs['filters'](_[_0x3dab('0x57')](_0x54a31c[_0x3dab('0x37')],_0xb9eb31[_0x3dab('0x38')]));if(_0x54a31c[_0x3dab('0x37')][_0x3dab('0x42')]){_0x5c6a58[_0x3dab('0x43')]=_[_0x3dab('0x44')](_0x5c6a58[_0x3dab('0x43')],{'$or':_[_0x3dab('0x45')](_0x5c6a58[_0x3dab('0x3b')],function(_0x345edb){var _0x272d20={};_0x272d20[_0x345edb]={'$like':'%'+_0x54a31c[_0x3dab('0x37')][_0x3dab('0x42')]+'%'};return _0x272d20;})});}_0x5c6a58=_[_0x3dab('0x44')]({},_0x5c6a58,_0x54a31c[_0x3dab('0x4a')]);return _0x47d734[_0x3dab('0x55')](_0x5c6a58);}})['then'](function(_0x4983c9){if(_0x4983c9){_0x5aa4b7=_0x4983c9[_0x3dab('0x3d')];if(!_0x54a31c['query'][_0x3dab('0x3e')](_0x3dab('0x58'))){_0x5c6a58['limit']=qs[_0x3dab('0x3f')](_0x54a31c[_0x3dab('0x37')][_0x3dab('0x3f')]);_0x5c6a58['offset']=qs[_0x3dab('0x29')](_0x54a31c[_0x3dab('0x37')]['offset']);}return _0x47d734[_0x3dab('0x55')](_0x5c6a58);}})[_0x3dab('0x1c')](function(_0x5d34e1){if(_0x5d34e1){return _0x5d34e1?{'count':_0x5aa4b7,'rows':_0x5d34e1}:null;}})[_0x3dab('0x1c')](respondWithResult(_0x297d5b,null))[_0x3dab('0x52')](handleError(_0x297d5b,null));};exports[_0x3dab('0x59')]=function(_0x5655b9,_0x480102,_0x39a06f){if(_0x5655b9[_0x3dab('0x54')]['id']){delete _0x5655b9[_0x3dab('0x54')]['id'];}return db[_0x3dab('0x35')][_0x3dab('0x5a')]({'where':{'id':_0x5655b9[_0x3dab('0x4f')]['id']}})[_0x3dab('0x1c')](handleEntityNotFound(_0x480102,null))[_0x3dab('0x1c')](function(_0x4972f3){if(_0x4972f3){_0x5655b9['body']['AccountId']=_0x4972f3['id'];_0x5655b9[_0x3dab('0x54')]['Subjects']=integrations['getSubjects'](_0x5655b9[_0x3dab('0x54')][_0x3dab('0x5b')],_0x5655b9[_0x3dab('0x54')][_0x3dab('0x46')]);_0x5655b9[_0x3dab('0x54')][_0x3dab('0x5c')]=integrations[_0x3dab('0x5d')](_0x5655b9[_0x3dab('0x54')][_0x3dab('0x5b')],_0x5655b9['body']['type']);return db[_0x3dab('0x56')][_0x3dab('0x53')](_0x5655b9[_0x3dab('0x54')],{'include':[{'model':db[_0x3dab('0x5e')],'as':_0x3dab('0x5f')},{'model':db[_0x3dab('0x5e')],'as':_0x3dab('0x5c')}]});}return null;})[_0x3dab('0x1c')](respondWithResult(_0x480102,null))[_0x3dab('0x52')](handleError(_0x480102,null));};exports[_0x3dab('0x60')]=function(_0x26415c,_0x19305b,_0x2b253f){var _0x5ce075='';return db[_0x3dab('0x35')][_0x3dab('0x5a')]({'where':{'id':_0x26415c['params']['id']},'attributes':['id',_0x3dab('0x61'),_0x3dab('0x62'),'token','authType',_0x3dab('0x63')]})['then'](handleEntityNotFound(_0x19305b,null))[_0x3dab('0x1c')](function(_0x91986){if(_0x91986){_0x5ce075=_0x91986['remoteUri'];var _0x1afd42=_0x5ce075[_0x3dab('0x64')](-0x1);if(_0x1afd42==='/'){_0x5ce075=_0x5ce075['substring'](0x0,_0x5ce075['lastIndexOf'](_0x1afd42));}var _0x9b7dd2={'method':_0x3dab('0x65'),'uri':util[_0x3dab('0x66')](_0x3dab('0x67'),_0x5ce075,'ticket_fields'),'json':!![]};switch(_0x91986[_0x3dab('0x68')]){case _0x3dab('0x62'):_0x9b7dd2['headers']={'Authorization':util['format'](_0x3dab('0x69'),new Buffer(util[_0x3dab('0x66')](_0x3dab('0x6a'),_0x91986[_0x3dab('0x61')],_0x91986[_0x3dab('0x62')]))[_0x3dab('0x6b')](_0x3dab('0x6c')))};break;case _0x3dab('0x6d'):_0x9b7dd2[_0x3dab('0x6e')]={'Authorization':util[_0x3dab('0x66')](_0x3dab('0x69'),new Buffer(util['format'](_0x3dab('0x6f'),_0x91986['username'],_0x91986[_0x3dab('0x6d')]))[_0x3dab('0x6b')](_0x3dab('0x6c')))};break;default:throw new db['Sequelize']['ValidationError'](_0x3dab('0x70'));}return rp(_0x9b7dd2);}})[_0x3dab('0x1c')](function(_0xd2a7b5){if(_0xd2a7b5){var _0x54229e=[_0x3dab('0x71'),_0x3dab('0x72'),_0x3dab('0x73'),_0x3dab('0x74')];_[_0x3dab('0x75')](_0xd2a7b5[_0x3dab('0x76')],function(_0x343b7c){return _0x54229e[_0x3dab('0x77')](_0x343b7c['type']);});return{'count':_0xd2a7b5['ticket_fields'][_0x3dab('0x3d')],'rows':_['map'](_0xd2a7b5[_0x3dab('0x76')],function(_0x59e076){return{'id':_0x59e076['id'],'name':_0x59e076[_0x3dab('0x78')]>0x7?_0x59e076['title']:_0x59e076[_0x3dab('0x46')],'custom':_0x59e076[_0x3dab('0x78')]>0x7?!![]:![],'options':_0x59e076[_0x3dab('0x79')]?_0x59e076[_0x3dab('0x79')]:_0x59e076[_0x3dab('0x7a')]?_0x59e076['custom_field_options']:[]};})};}})[_0x3dab('0x1c')](respondWithResult(_0x19305b,null))[_0x3dab('0x52')](function(_0x515894){var _0x5360ba=_0x26415c[_0x3dab('0x37')]['test']?0x1f4:_0x515894[_0x3dab('0x7b')]||0x1f4;logger[_0x3dab('0x22')](_0x3dab('0x7c'),_0x3dab('0x60'),_0x5360ba,JSON[_0x3dab('0x21')](_0x515894));delete _0x515894[_0x3dab('0x32')];if(_0x5360ba===0x191){_0x5360ba=0x190;}_0x19305b[_0x3dab('0x26')](_0x5360ba)[_0x3dab('0x33')](_0x26415c[_0x3dab('0x37')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x515894[_0x3dab('0x7b')]}:_0x515894);});};
\ No newline at end of file
index e12e7d0..1d0a9e4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7eba=['int_zendesk_accounts','lodash','util','../../config/logger','api','moment','request-promise','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount'];(function(_0x1875be,_0x3b8c30){var _0x3e3950=function(_0xb90242){while(--_0xb90242){_0x1875be['push'](_0x1875be['shift']());}};_0x3e3950(++_0x3b8c30);}(_0x7eba,0x121));var _0xa7eb=function(_0x567df6,_0x268db8){_0x567df6=_0x567df6-0x0;var _0x5c97e2=_0x7eba[_0x567df6];return _0x5c97e2;};'use strict';var _=require(_0xa7eb('0x0'));var util=require(_0xa7eb('0x1'));var logger=require(_0xa7eb('0x2'))(_0xa7eb('0x3'));var moment=require(_0xa7eb('0x4'));var BPromise=require('bluebird');var rp=require(_0xa7eb('0x5'));var attributes=require(_0xa7eb('0x6'));var integrations=require(_0xa7eb('0x7'));module[_0xa7eb('0x8')]=function(_0x1f977a,_0x3c6c31){return _0x1f977a[_0xa7eb('0x9')](_0xa7eb('0xa'),attributes,{'tableName':_0xa7eb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x13ac=['../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','./intZendeskAccount.attributes'];(function(_0x5d0b39,_0x48c2ec){var _0x5b6e3a=function(_0x1b31e2){while(--_0x1b31e2){_0x5d0b39['push'](_0x5d0b39['shift']());}};_0x5b6e3a(++_0x48c2ec);}(_0x13ac,0x185));var _0xc13a=function(_0x3b8736,_0x311c83){_0x3b8736=_0x3b8736-0x0;var _0x261688=_0x13ac[_0x3b8736];return _0x261688;};'use strict';var _=require(_0xc13a('0x0'));var util=require(_0xc13a('0x1'));var logger=require(_0xc13a('0x2'))(_0xc13a('0x3'));var moment=require('moment');var BPromise=require(_0xc13a('0x4'));var rp=require(_0xc13a('0x5'));var attributes=require(_0xc13a('0x6'));var integrations=require(_0xc13a('0x7'));module[_0xc13a('0x8')]=function(_0x52fbfb,_0x17e208){return _0x52fbfb[_0xc13a('0x9')](_0xc13a('0xa'),attributes,{'tableName':_0xc13a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index c0dbc5d..6ba0c59 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7af0=['code','message','result','catch','options','raw','where','attributes','limit','include','map','model','GetZendeskAccount','ZendeskAccount','find','ShowZendeskAccount','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x370ac9,_0x3a39bd){var _0x57d290=function(_0x3e1599){while(--_0x3e1599){_0x370ac9['push'](_0x370ac9['shift']());}};_0x57d290(++_0x3a39bd);}(_0x7af0,0x139));var _0x07af=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x7af0[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0x07af('0x0'));var util=require(_0x07af('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x07af('0x2'));var db=require(_0x07af('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x07af('0x4'))(_0x07af('0x5'));var config=require(_0x07af('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x07af('0x7')][_0x07af('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c89ac,_0x1e461e,_0x15bb4e){return new BPromise(function(_0x7dd0a2,_0xabb75c){return client[_0x07af('0x9')](_0x5c89ac,_0x15bb4e)[_0x07af('0xa')](function(_0x1da9b3){logger[_0x07af('0xb')](_0x07af('0xc'),_0x1e461e,_0x07af('0xd'));logger[_0x07af('0xe')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x1e461e,'request\x20sent',JSON[_0x07af('0xf')](_0x1da9b3));if(_0x1da9b3[_0x07af('0x10')]){if(_0x1da9b3[_0x07af('0x10')][_0x07af('0x11')]===0x1f4){logger['error'](_0x07af('0xc'),_0x1e461e,_0x1da9b3[_0x07af('0x10')][_0x07af('0x12')]);return _0xabb75c(_0x1da9b3[_0x07af('0x10')][_0x07af('0x12')]);}logger['error'](_0x07af('0xc'),_0x1e461e,_0x1da9b3[_0x07af('0x10')][_0x07af('0x12')]);return _0x7dd0a2(_0x1da9b3[_0x07af('0x10')]['message']);}else{logger[_0x07af('0xb')](_0x07af('0xc'),_0x1e461e,_0x07af('0xd'));_0x7dd0a2(_0x1da9b3[_0x07af('0x13')][_0x07af('0x12')]);}})[_0x07af('0x14')](function(_0x5666b6){logger['error'](_0x07af('0xc'),_0x1e461e,_0x5666b6);_0xabb75c(_0x5666b6);});});}exports['GetZendeskAccount']=function(_0x117bc6){var _0xaae6e0=this;return new Promise(function(_0x3f3ebb,_0x447a54){return db['ZendeskAccount']['findAll']({'raw':_0x117bc6['options']?_0x117bc6[_0x07af('0x15')][_0x07af('0x16')]===undefined?!![]:![]:!![],'where':_0x117bc6[_0x07af('0x15')]?_0x117bc6[_0x07af('0x15')][_0x07af('0x17')]||null:null,'attributes':_0x117bc6[_0x07af('0x15')]?_0x117bc6[_0x07af('0x15')][_0x07af('0x18')]||null:null,'limit':_0x117bc6[_0x07af('0x15')]?_0x117bc6['options'][_0x07af('0x19')]||null:null,'include':_0x117bc6['options']?_0x117bc6[_0x07af('0x15')][_0x07af('0x1a')]?_[_0x07af('0x1b')](_0x117bc6[_0x07af('0x15')]['include'],function(_0x4cf1ca){return{'model':db[_0x4cf1ca[_0x07af('0x1c')]],'as':_0x4cf1ca['as'],'attributes':_0x4cf1ca[_0x07af('0x18')],'include':_0x4cf1ca[_0x07af('0x1a')]?_['map'](_0x4cf1ca[_0x07af('0x1a')],function(_0x223384){return{'model':db[_0x223384[_0x07af('0x1c')]],'as':_0x223384['as'],'attributes':_0x223384[_0x07af('0x18')],'include':_0x223384[_0x07af('0x1a')]?_[_0x07af('0x1b')](_0x223384['include'],function(_0x1b30c9){return{'model':db[_0x1b30c9[_0x07af('0x1c')]],'as':_0x1b30c9['as'],'attributes':_0x1b30c9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x8d512a){logger[_0x07af('0xb')]('GetZendeskAccount',_0x117bc6);logger[_0x07af('0xe')](_0x07af('0x1d'),_0x117bc6,JSON[_0x07af('0xf')](_0x8d512a));_0x3f3ebb(_0x8d512a);})[_0x07af('0x14')](function(_0x1bdeb6){logger[_0x07af('0x10')](_0x07af('0x1d'),_0x1bdeb6[_0x07af('0x12')],_0x117bc6);_0x447a54(_0xaae6e0[_0x07af('0x10')](0x1f4,_0x1bdeb6['message']));});});};exports['ShowZendeskAccount']=function(_0x4db158){var _0xb30d1e=this;return new Promise(function(_0x33a148,_0x5cd94b){return db[_0x07af('0x1e')][_0x07af('0x1f')]({'raw':_0x4db158[_0x07af('0x15')]?_0x4db158[_0x07af('0x15')][_0x07af('0x16')]===undefined?!![]:![]:!![],'where':_0x4db158[_0x07af('0x15')]?_0x4db158[_0x07af('0x15')][_0x07af('0x17')]||null:null,'attributes':_0x4db158[_0x07af('0x15')]?_0x4db158[_0x07af('0x15')]['attributes']||null:null,'include':_0x4db158[_0x07af('0x15')]?_0x4db158[_0x07af('0x15')][_0x07af('0x1a')]?_[_0x07af('0x1b')](_0x4db158['options'][_0x07af('0x1a')],function(_0xfa9f25){return{'model':db[_0xfa9f25[_0x07af('0x1c')]],'as':_0xfa9f25['as'],'attributes':_0xfa9f25[_0x07af('0x18')],'include':_0xfa9f25[_0x07af('0x1a')]?_[_0x07af('0x1b')](_0xfa9f25[_0x07af('0x1a')],function(_0x207d4e){return{'model':db[_0x207d4e['model']],'as':_0x207d4e['as'],'attributes':_0x207d4e[_0x07af('0x18')],'include':_0x207d4e[_0x07af('0x1a')]?_[_0x07af('0x1b')](_0x207d4e['include'],function(_0xcd22f6){return{'model':db[_0xcd22f6[_0x07af('0x1c')]],'as':_0xcd22f6['as'],'attributes':_0xcd22f6['attributes']};}):[]};}):[]};}):[]:[]})[_0x07af('0xa')](function(_0x4b126e){logger[_0x07af('0xb')](_0x07af('0x20'),_0x4db158);logger[_0x07af('0xe')]('ShowZendeskAccount',_0x4db158,JSON['stringify'](_0x4b126e));_0x33a148(_0x4b126e);})[_0x07af('0x14')](function(_0x46c285){logger[_0x07af('0x10')](_0x07af('0x20'),_0x46c285[_0x07af('0x12')],_0x4db158);_0x5cd94b(_0xb30d1e[_0x07af('0x10')](0x1f4,_0x46c285[_0x07af('0x12')]));});});};
\ No newline at end of file
+var _0x7e4b=['request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','ShowZendeskAccount','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s'];(function(_0x2b8022,_0x22b3a0){var _0x163f9e=function(_0x3e1b95){while(--_0x3e1b95){_0x2b8022['push'](_0x2b8022['shift']());}};_0x163f9e(++_0x22b3a0);}(_0x7e4b,0x84));var _0xb7e4=function(_0x30a640,_0x57c38f){_0x30a640=_0x30a640-0x0;var _0x474bc5=_0x7e4b[_0x30a640];return _0x474bc5;};'use strict';var _=require(_0xb7e4('0x0'));var util=require(_0xb7e4('0x1'));var moment=require('moment');var BPromise=require(_0xb7e4('0x2'));var rs=require(_0xb7e4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb7e4('0x4'))['db'];var utils=require(_0xb7e4('0x5'));var logger=require(_0xb7e4('0x6'))(_0xb7e4('0x7'));var config=require(_0xb7e4('0x8'));var jayson=require(_0xb7e4('0x9'));var client=jayson[_0xb7e4('0xa')][_0xb7e4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d49a7,_0x4ba34c,_0x334af2){return new BPromise(function(_0x5e4a34,_0x950cc5){return client[_0xb7e4('0xc')](_0x1d49a7,_0x334af2)[_0xb7e4('0xd')](function(_0x3d1196){logger[_0xb7e4('0xe')](_0xb7e4('0xf'),_0x4ba34c,_0xb7e4('0x10'));logger[_0xb7e4('0x11')](_0xb7e4('0x12'),_0x4ba34c,_0xb7e4('0x10'),JSON[_0xb7e4('0x13')](_0x3d1196));if(_0x3d1196[_0xb7e4('0x14')]){if(_0x3d1196[_0xb7e4('0x14')]['code']===0x1f4){logger['error'](_0xb7e4('0xf'),_0x4ba34c,_0x3d1196[_0xb7e4('0x14')]['message']);return _0x950cc5(_0x3d1196[_0xb7e4('0x14')][_0xb7e4('0x15')]);}logger[_0xb7e4('0x14')](_0xb7e4('0xf'),_0x4ba34c,_0x3d1196[_0xb7e4('0x14')][_0xb7e4('0x15')]);return _0x5e4a34(_0x3d1196[_0xb7e4('0x14')][_0xb7e4('0x15')]);}else{logger[_0xb7e4('0xe')](_0xb7e4('0xf'),_0x4ba34c,_0xb7e4('0x10'));_0x5e4a34(_0x3d1196[_0xb7e4('0x16')][_0xb7e4('0x15')]);}})[_0xb7e4('0x17')](function(_0x4d4220){logger[_0xb7e4('0x14')](_0xb7e4('0xf'),_0x4ba34c,_0x4d4220);_0x950cc5(_0x4d4220);});});}exports[_0xb7e4('0x18')]=function(_0x258ba9){var _0x44a6c9=this;return new Promise(function(_0x88906e,_0x461375){return db[_0xb7e4('0x19')][_0xb7e4('0x1a')]({'raw':_0x258ba9[_0xb7e4('0x1b')]?_0x258ba9['options'][_0xb7e4('0x1c')]===undefined?!![]:![]:!![],'where':_0x258ba9[_0xb7e4('0x1b')]?_0x258ba9[_0xb7e4('0x1b')][_0xb7e4('0x1d')]||null:null,'attributes':_0x258ba9[_0xb7e4('0x1b')]?_0x258ba9['options'][_0xb7e4('0x1e')]||null:null,'limit':_0x258ba9[_0xb7e4('0x1b')]?_0x258ba9[_0xb7e4('0x1b')][_0xb7e4('0x1f')]||null:null,'include':_0x258ba9[_0xb7e4('0x1b')]?_0x258ba9[_0xb7e4('0x1b')]['include']?_[_0xb7e4('0x20')](_0x258ba9[_0xb7e4('0x1b')][_0xb7e4('0x21')],function(_0x2eec58){return{'model':db[_0x2eec58['model']],'as':_0x2eec58['as'],'attributes':_0x2eec58[_0xb7e4('0x1e')],'include':_0x2eec58[_0xb7e4('0x21')]?_['map'](_0x2eec58[_0xb7e4('0x21')],function(_0xedb514){return{'model':db[_0xedb514[_0xb7e4('0x22')]],'as':_0xedb514['as'],'attributes':_0xedb514['attributes'],'include':_0xedb514[_0xb7e4('0x21')]?_[_0xb7e4('0x20')](_0xedb514['include'],function(_0x29715c){return{'model':db[_0x29715c[_0xb7e4('0x22')]],'as':_0x29715c['as'],'attributes':_0x29715c['attributes']};}):[]};}):[]};}):[]:[]})[_0xb7e4('0xd')](function(_0xd0b54c){logger[_0xb7e4('0xe')]('GetZendeskAccount',_0x258ba9);logger[_0xb7e4('0x11')](_0xb7e4('0x18'),_0x258ba9,JSON[_0xb7e4('0x13')](_0xd0b54c));_0x88906e(_0xd0b54c);})[_0xb7e4('0x17')](function(_0x41011d){logger[_0xb7e4('0x14')](_0xb7e4('0x18'),_0x41011d[_0xb7e4('0x15')],_0x258ba9);_0x461375(_0x44a6c9[_0xb7e4('0x14')](0x1f4,_0x41011d[_0xb7e4('0x15')]));});});};exports[_0xb7e4('0x23')]=function(_0x601559){var _0x16524e=this;return new Promise(function(_0x52ec18,_0x182e60){return db[_0xb7e4('0x19')][_0xb7e4('0x24')]({'raw':_0x601559[_0xb7e4('0x1b')]?_0x601559['options'][_0xb7e4('0x1c')]===undefined?!![]:![]:!![],'where':_0x601559[_0xb7e4('0x1b')]?_0x601559[_0xb7e4('0x1b')][_0xb7e4('0x1d')]||null:null,'attributes':_0x601559[_0xb7e4('0x1b')]?_0x601559['options'][_0xb7e4('0x1e')]||null:null,'include':_0x601559['options']?_0x601559[_0xb7e4('0x1b')][_0xb7e4('0x21')]?_[_0xb7e4('0x20')](_0x601559[_0xb7e4('0x1b')][_0xb7e4('0x21')],function(_0x836f96){return{'model':db[_0x836f96[_0xb7e4('0x22')]],'as':_0x836f96['as'],'attributes':_0x836f96[_0xb7e4('0x1e')],'include':_0x836f96[_0xb7e4('0x21')]?_['map'](_0x836f96[_0xb7e4('0x21')],function(_0x16c01f){return{'model':db[_0x16c01f[_0xb7e4('0x22')]],'as':_0x16c01f['as'],'attributes':_0x16c01f[_0xb7e4('0x1e')],'include':_0x16c01f[_0xb7e4('0x21')]?_['map'](_0x16c01f[_0xb7e4('0x21')],function(_0x216f04){return{'model':db[_0x216f04['model']],'as':_0x216f04['as'],'attributes':_0x216f04[_0xb7e4('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ee12a){logger[_0xb7e4('0xe')](_0xb7e4('0x23'),_0x601559);logger['debug'](_0xb7e4('0x23'),_0x601559,JSON[_0xb7e4('0x13')](_0x4ee12a));_0x52ec18(_0x4ee12a);})[_0xb7e4('0x17')](function(_0x2365f1){logger[_0xb7e4('0x14')](_0xb7e4('0x23'),_0x2365f1[_0xb7e4('0x15')],_0x601559);_0x182e60(_0x16524e[_0xb7e4('0x14')](0x1f4,_0x2365f1['message']));});});};
\ No newline at end of file
index e9aacce..691dfdd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc0d2=['connect-timeout','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','setTags','put','update','destroy','exports','util','path'];(function(_0x30d6e2,_0x2b5b17){var _0x4b6b98=function(_0x26afe1){while(--_0x26afe1){_0x30d6e2['push'](_0x30d6e2['shift']());}};_0x4b6b98(++_0x2b5b17);}(_0xc0d2,0x98));var _0x2c0d=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xc0d2[_0xefd519];return _0x4bb882;};'use strict';var multer=require('multer');var util=require(_0x2c0d('0x0'));var path=require(_0x2c0d('0x1'));var timeout=require(_0x2c0d('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x2c0d('0x3'));var interaction=require(_0x2c0d('0x4'));var config=require('../../config/environment');var controller=require(_0x2c0d('0x5'));router['get']('/',auth[_0x2c0d('0x6')](),controller[_0x2c0d('0x7')]);router[_0x2c0d('0x8')](_0x2c0d('0x9'),auth[_0x2c0d('0x6')](),controller[_0x2c0d('0xa')]);router[_0x2c0d('0x8')]('/:id/fields',auth[_0x2c0d('0x6')](),controller['getFields']);router[_0x2c0d('0x8')](_0x2c0d('0xb'),auth[_0x2c0d('0x6')](),controller['getSubjects']);router['get'](_0x2c0d('0xc'),auth['isAuthenticated'](),controller[_0x2c0d('0xd')]);router[_0x2c0d('0x8')](_0x2c0d('0xe'),auth[_0x2c0d('0x6')](),controller[_0x2c0d('0xf')]);router['post']('/',auth[_0x2c0d('0x6')](),controller[_0x2c0d('0x10')]);router['post'](_0x2c0d('0xe'),auth[_0x2c0d('0x6')](),controller[_0x2c0d('0x11')]);router[_0x2c0d('0x12')]('/:id',auth[_0x2c0d('0x6')](),controller[_0x2c0d('0x13')]);router['delete'](_0x2c0d('0x9'),auth[_0x2c0d('0x6')](),controller[_0x2c0d('0x14')]);module[_0x2c0d('0x15')]=router;
\ No newline at end of file
+var _0x92e1=['/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','/:id/tags','setTags','update','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','get'];(function(_0x2bda59,_0x5b3da3){var _0x485739=function(_0x1ad1fc){while(--_0x1ad1fc){_0x2bda59['push'](_0x2bda59['shift']());}};_0x485739(++_0x5b3da3);}(_0x92e1,0x145));var _0x192e=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x92e1[_0x263a74];return _0x2aa86c;};'use strict';var multer=require(_0x192e('0x0'));var util=require(_0x192e('0x1'));var path=require(_0x192e('0x2'));var timeout=require('connect-timeout');var express=require(_0x192e('0x3'));var router=express[_0x192e('0x4')]();var auth=require(_0x192e('0x5'));var interaction=require(_0x192e('0x6'));var config=require(_0x192e('0x7'));var controller=require(_0x192e('0x8'));router['get']('/',auth[_0x192e('0x9')](),controller['index']);router[_0x192e('0xa')](_0x192e('0xb'),auth[_0x192e('0x9')](),controller[_0x192e('0xc')]);router['get'](_0x192e('0xd'),auth[_0x192e('0x9')](),controller[_0x192e('0xe')]);router[_0x192e('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x192e('0xf')]);router['get'](_0x192e('0x10'),auth[_0x192e('0x9')](),controller[_0x192e('0x11')]);router[_0x192e('0xa')]('/:id/tags',auth[_0x192e('0x9')](),controller['getTags']);router[_0x192e('0x12')]('/',auth[_0x192e('0x9')](),controller[_0x192e('0x13')]);router['post'](_0x192e('0x14'),auth[_0x192e('0x9')](),controller[_0x192e('0x15')]);router['put']('/:id',auth[_0x192e('0x9')](),controller[_0x192e('0x16')]);router['delete'](_0x192e('0xb'),auth['isAuthenticated'](),controller[_0x192e('0x17')]);module['exports']=router;
\ No newline at end of file
index acf542d..57665d2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5c02=['STRING','sequelize','exports'];(function(_0x4cd21c,_0x35fa45){var _0x5d8e5e=function(_0x3af223){while(--_0x3af223){_0x4cd21c['push'](_0x4cd21c['shift']());}};_0x5d8e5e(++_0x35fa45);}(_0x5c02,0x166));var _0x25c0=function(_0x198f31,_0x55fc7a){_0x198f31=_0x198f31-0x0;var _0x3d1d9a=_0x5c02[_0x198f31];return _0x3d1d9a;};'use strict';var Sequelize=require(_0x25c0('0x0'));module[_0x25c0('0x1')]={'name':{'type':Sequelize[_0x25c0('0x2')]},'description':{'type':Sequelize[_0x25c0('0x2')]}};
\ No newline at end of file
+var _0xe2b3=['exports','STRING','sequelize'];(function(_0x7e61c8,_0x694f27){var _0x5cbf2e=function(_0x2d4260){while(--_0x2d4260){_0x7e61c8['push'](_0x7e61c8['shift']());}};_0x5cbf2e(++_0x694f27);}(_0xe2b3,0xf8));var _0x3e2b=function(_0x248400,_0x231fa4){_0x248400=_0x248400-0x0;var _0x2473ea=_0xe2b3[_0x248400];return _0x2473ea;};'use strict';var Sequelize=require(_0x3e2b('0x0'));module[_0x3e2b('0x1')]={'name':{'type':Sequelize[_0x3e2b('0x2')]},'description':{'type':Sequelize[_0x3e2b('0x2')]}};
\ No newline at end of file
index 79203ea..bd27473 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1e94=['name','send','index','ZendeskConfiguration','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','key','VIRTUAL','field','options','count','includeAll','include','rows','catch','show','params','rawAttributes','create','body','find','getFields','findOne','ZendeskField','map','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','status','end','offset','limit','set','Content-Range','json','reject','save','update','destroy','sendStatus','stack'];(function(_0x3ddd67,_0x2a102d){var _0x172e0b=function(_0x3e8786){while(--_0x3e8786){_0x3ddd67['push'](_0x3ddd67['shift']());}};_0x172e0b(++_0x2a102d);}(_0x1e94,0x87));var _0x41e9=function(_0x2f8de5,_0x3ab8ac){_0x2f8de5=_0x2f8de5-0x0;var _0x1364a6=_0x1e94[_0x2f8de5];return _0x1364a6;};'use strict';var pdf=require(_0x41e9('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x41e9('0x1'));var jsonpatch=require(_0x41e9('0x2'));var rp=require(_0x41e9('0x3'));var moment=require('moment');var BPromise=require(_0x41e9('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x41e9('0x5'));var csv=require(_0x41e9('0x6'));var ejs=require(_0x41e9('0x7'));var fs=require('fs');var _=require(_0x41e9('0x8'));var squel=require('squel');var crypto=require(_0x41e9('0x9'));var jsforce=require(_0x41e9('0xa'));var deskjs=require(_0x41e9('0xb'));var toCsv=require(_0x41e9('0x6'));var querystring=require(_0x41e9('0xc'));var Papa=require(_0x41e9('0xd'));var authService=require('../../components/auth/service');var hardwareService=require(_0x41e9('0xe'));var Redis=require(_0x41e9('0xf'));var qs=require(_0x41e9('0x10'));var logger=require(_0x41e9('0x11'))(_0x41e9('0x12'));var utils=require(_0x41e9('0x13'));var config=require(_0x41e9('0x14'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a5201,_0xec4e4a,_0x14402f,_0x210262){return new BPromise(function(_0x3484dc,_0xef368f){var _0x540746=_0x210262||client;return _0x540746[_0x41e9('0x15')](_0x4a5201,_0x14402f)[_0x41e9('0x16')](function(_0x334c13){logger[_0x41e9('0x17')](_0x41e9('0x18'),_0xec4e4a,'request\x20sent');logger[_0x41e9('0x19')](_0x41e9('0x1a'),_0xec4e4a,_0x41e9('0x1b'),JSON[_0x41e9('0x1c')](_0x334c13));if(_0x334c13[_0x41e9('0x1d')]){if(_0x334c13[_0x41e9('0x1d')]['code']===0x1f4){logger[_0x41e9('0x1d')](_0x41e9('0x18'),_0xec4e4a,_0x334c13[_0x41e9('0x1d')][_0x41e9('0x1e')]);return _0xef368f(_0x334c13[_0x41e9('0x1d')][_0x41e9('0x1e')]);}logger['error'](_0x41e9('0x18'),_0xec4e4a,_0x334c13[_0x41e9('0x1d')]['message']);return _0x3484dc(_0x334c13[_0x41e9('0x1d')][_0x41e9('0x1e')]);}else{logger[_0x41e9('0x17')](_0x41e9('0x18'),_0xec4e4a,_0x41e9('0x1b'));_0x3484dc(_0x334c13[_0x41e9('0x1f')][_0x41e9('0x1e')]);}})['catch'](function(_0x17f6ec){logger[_0x41e9('0x1d')](_0x41e9('0x18'),_0xec4e4a,_0x17f6ec);_0xef368f(_0x17f6ec);});});}function respondWithStatusCode(_0x15e6fb,_0x1a2559){_0x1a2559=_0x1a2559||0xcc;return function(_0x28b3d7){if(_0x28b3d7){return _0x15e6fb['sendStatus'](_0x1a2559);}return _0x15e6fb[_0x41e9('0x20')](_0x1a2559)[_0x41e9('0x21')]();};}function respondWithResult(_0x4ae4f7,_0x1be130){_0x1be130=_0x1be130||0xc8;return function(_0x3a3316){if(_0x3a3316){return _0x4ae4f7[_0x41e9('0x20')](_0x1be130)['json'](_0x3a3316);}};}function respondWithFilteredResult(_0x44c5b3,_0x2a6dd1){return function(_0x5f36ae){if(_0x5f36ae){var _0x23b46d=_0x5f36ae['count'],_0x27fa81=_0x2a6dd1[_0x41e9('0x22')],_0x42aa6a=_0x2a6dd1[_0x41e9('0x22')]+_0x2a6dd1[_0x41e9('0x23')],_0x4d60f1;if(_0x42aa6a>=_0x23b46d){_0x42aa6a=_0x23b46d;_0x4d60f1=0xc8;}else{_0x4d60f1=0xce;}_0x44c5b3[_0x41e9('0x20')](_0x4d60f1);return _0x44c5b3[_0x41e9('0x24')](_0x41e9('0x25'),_0x27fa81+'-'+_0x42aa6a+'/'+_0x23b46d)[_0x41e9('0x26')](_0x5f36ae);}return null;};}function patchUpdates(_0x34e6bb){return function(_0x5b5b13){try{jsonpatch['apply'](_0x5b5b13,_0x34e6bb,!![]);}catch(_0xc9583){return BPromise[_0x41e9('0x27')](_0xc9583);}return _0x5b5b13[_0x41e9('0x28')]();};}function saveUpdates(_0x312d3e,_0x57b220){return function(_0x2e82da){if(_0x2e82da){return _0x2e82da[_0x41e9('0x29')](_0x312d3e)[_0x41e9('0x16')](function(_0x2aaa5a){return _0x2aaa5a;});}return null;};}function removeEntity(_0x5f0b94,_0x52034c){return function(_0x54c3a8){if(_0x54c3a8){return _0x54c3a8[_0x41e9('0x2a')]()[_0x41e9('0x16')](function(){_0x5f0b94[_0x41e9('0x20')](0xcc)[_0x41e9('0x21')]();});}};}function handleEntityNotFound(_0x2946ed,_0x1b765f){return function(_0x2b4a6c){if(!_0x2b4a6c){_0x2946ed[_0x41e9('0x2b')](0x194);}return _0x2b4a6c;};}function handleError(_0x206c59,_0x15a54f){_0x15a54f=_0x15a54f||0x1f4;return function(_0x561687){logger[_0x41e9('0x1d')](_0x561687[_0x41e9('0x2c')]);if(_0x561687[_0x41e9('0x2d')]){delete _0x561687[_0x41e9('0x2d')];}_0x206c59[_0x41e9('0x20')](_0x15a54f)[_0x41e9('0x2e')](_0x561687);};}exports[_0x41e9('0x2f')]=function(_0x3e529e,_0x28eb1d){var _0x496624={},_0x4a5f3e={},_0x258abd={'count':0x0,'rows':[]};var _0x18eb11=db[_0x41e9('0x30')]['rawAttributes'];_0x4a5f3e[_0x41e9('0x31')]=_[_0x41e9('0x32')](_0x18eb11);_0x4a5f3e['query']=_[_0x41e9('0x32')](_0x3e529e[_0x41e9('0x33')]);_0x4a5f3e[_0x41e9('0x34')]=_['intersection'](_0x4a5f3e['model'],_0x4a5f3e[_0x41e9('0x33')]);_0x496624[_0x41e9('0x35')]=_[_0x41e9('0x36')](_0x4a5f3e[_0x41e9('0x31')],qs[_0x41e9('0x37')](_0x3e529e[_0x41e9('0x33')][_0x41e9('0x37')]));_0x496624[_0x41e9('0x35')]=_0x496624[_0x41e9('0x35')][_0x41e9('0x38')]?_0x496624['attributes']:_0x4a5f3e[_0x41e9('0x31')];if(!_0x3e529e['query'][_0x41e9('0x39')](_0x41e9('0x3a'))){_0x496624['limit']=qs[_0x41e9('0x23')](_0x3e529e[_0x41e9('0x33')][_0x41e9('0x23')]);_0x496624[_0x41e9('0x22')]=qs[_0x41e9('0x22')](_0x3e529e[_0x41e9('0x33')][_0x41e9('0x22')]);}_0x496624[_0x41e9('0x3b')]=qs['sort'](_0x3e529e[_0x41e9('0x33')][_0x41e9('0x3c')]);_0x496624[_0x41e9('0x3d')]=qs[_0x41e9('0x34')](_[_0x41e9('0x3e')](_0x3e529e[_0x41e9('0x33')],_0x4a5f3e[_0x41e9('0x34')]));if(_0x3e529e[_0x41e9('0x33')][_0x41e9('0x3f')]){_0x496624[_0x41e9('0x3d')]=_[_0x41e9('0x40')](_0x496624[_0x41e9('0x3d')],{'$or':_['map'](_0x18eb11,function(_0x5f3090){if(_0x5f3090['type'][_0x41e9('0x41')]!==_0x41e9('0x42')){var _0x463ff6={};_0x463ff6[_0x5f3090[_0x41e9('0x43')]]={'$like':'%'+_0x3e529e[_0x41e9('0x33')][_0x41e9('0x3f')]+'%'};return _0x463ff6;}})});}_0x496624=_[_0x41e9('0x40')]({},_0x496624,_0x3e529e[_0x41e9('0x44')]);var _0x550c37={'where':_0x496624[_0x41e9('0x3d')]};return db[_0x41e9('0x30')][_0x41e9('0x45')](_0x550c37)[_0x41e9('0x16')](function(_0x1fe46d){_0x258abd['count']=_0x1fe46d;if(_0x3e529e['query'][_0x41e9('0x46')]){_0x496624[_0x41e9('0x47')]=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x496624);})[_0x41e9('0x16')](function(_0x297d53){_0x258abd[_0x41e9('0x48')]=_0x297d53;return _0x258abd;})['then'](respondWithFilteredResult(_0x28eb1d,_0x496624))[_0x41e9('0x49')](handleError(_0x28eb1d,null));};exports[_0x41e9('0x4a')]=function(_0x21c477,_0x42404c){var _0x25df59={'raw':![],'where':{'id':_0x21c477[_0x41e9('0x4b')]['id']}},_0x19d52b={};_0x19d52b[_0x41e9('0x31')]=_['keys'](db[_0x41e9('0x30')][_0x41e9('0x4c')]);_0x19d52b[_0x41e9('0x33')]=_[_0x41e9('0x32')](_0x21c477['query']);_0x19d52b['filters']=_[_0x41e9('0x36')](_0x19d52b['model'],_0x19d52b[_0x41e9('0x33')]);_0x25df59[_0x41e9('0x35')]=_[_0x41e9('0x36')](_0x19d52b[_0x41e9('0x31')],qs[_0x41e9('0x37')](_0x21c477['query'][_0x41e9('0x37')]));_0x25df59['attributes']=_0x25df59[_0x41e9('0x35')][_0x41e9('0x38')]?_0x25df59[_0x41e9('0x35')]:_0x19d52b[_0x41e9('0x31')];if(_0x21c477[_0x41e9('0x33')]['includeAll']){_0x25df59['include']=[{'all':!![]}];}_0x25df59=_[_0x41e9('0x40')]({},_0x25df59,_0x21c477[_0x41e9('0x44')]);return db[_0x41e9('0x30')]['find'](_0x25df59)['then'](handleEntityNotFound(_0x42404c,null))[_0x41e9('0x16')](respondWithResult(_0x42404c,null))[_0x41e9('0x49')](handleError(_0x42404c,null));};exports[_0x41e9('0x4d')]=function(_0x35b084,_0x36bbd5){return db[_0x41e9('0x30')][_0x41e9('0x4d')](_0x35b084[_0x41e9('0x4e')],{})[_0x41e9('0x16')](respondWithResult(_0x36bbd5,0xc9))[_0x41e9('0x49')](handleError(_0x36bbd5,null));};exports[_0x41e9('0x29')]=function(_0x5e0b76,_0x47a45c){if(_0x5e0b76[_0x41e9('0x4e')]['id']){delete _0x5e0b76[_0x41e9('0x4e')]['id'];}return db[_0x41e9('0x30')][_0x41e9('0x4f')]({'where':{'id':_0x5e0b76['params']['id']}})['then'](handleEntityNotFound(_0x47a45c,null))[_0x41e9('0x16')](saveUpdates(_0x5e0b76['body'],null))[_0x41e9('0x16')](respondWithResult(_0x47a45c,null))[_0x41e9('0x49')](handleError(_0x47a45c,null));};exports[_0x41e9('0x2a')]=function(_0x2edb3a,_0x1e480a){return db[_0x41e9('0x30')][_0x41e9('0x4f')]({'where':{'id':_0x2edb3a[_0x41e9('0x4b')]['id']}})[_0x41e9('0x16')](handleEntityNotFound(_0x1e480a,null))[_0x41e9('0x16')](removeEntity(_0x1e480a,null))[_0x41e9('0x49')](handleError(_0x1e480a,null));};exports[_0x41e9('0x50')]=function(_0x122a62,_0x270dcc,_0x5e56ca){var _0x3fa1ef={};var _0x241caa={};var _0x1531f0;var _0x56bde1;return db['ZendeskConfiguration'][_0x41e9('0x51')]({'where':{'id':_0x122a62[_0x41e9('0x4b')]['id']}})[_0x41e9('0x16')](handleEntityNotFound(_0x270dcc,null))[_0x41e9('0x16')](function(_0x4ea030){if(_0x4ea030){_0x1531f0=_0x4ea030;_0x241caa['model']=_[_0x41e9('0x32')](db[_0x41e9('0x52')][_0x41e9('0x4c')]);_0x241caa['query']=_[_0x41e9('0x32')](_0x122a62[_0x41e9('0x33')]);_0x241caa['filters']=_[_0x41e9('0x36')](_0x241caa[_0x41e9('0x31')],_0x241caa[_0x41e9('0x33')]);_0x3fa1ef[_0x41e9('0x35')]=_[_0x41e9('0x36')](_0x241caa[_0x41e9('0x31')],qs[_0x41e9('0x37')](_0x122a62['query'][_0x41e9('0x37')]));_0x3fa1ef[_0x41e9('0x35')]=_0x3fa1ef[_0x41e9('0x35')][_0x41e9('0x38')]?_0x3fa1ef[_0x41e9('0x35')]:_0x241caa[_0x41e9('0x31')];_0x3fa1ef[_0x41e9('0x3b')]=qs[_0x41e9('0x3c')](_0x122a62[_0x41e9('0x33')][_0x41e9('0x3c')]);_0x3fa1ef[_0x41e9('0x3d')]=qs['filters'](_[_0x41e9('0x3e')](_0x122a62['query'],_0x241caa['filters']));if(_0x122a62[_0x41e9('0x33')]['filter']){_0x3fa1ef['where']=_[_0x41e9('0x40')](_0x3fa1ef[_0x41e9('0x3d')],{'$or':_[_0x41e9('0x53')](_0x3fa1ef[_0x41e9('0x35')],function(_0x3c7893){var _0x1d5ea4={};_0x1d5ea4[_0x3c7893]={'$like':'%'+_0x122a62['query']['filter']+'%'};return _0x1d5ea4;})});}_0x3fa1ef=_['merge']({},_0x3fa1ef,_0x122a62['options']);return _0x1531f0[_0x41e9('0x50')](_0x3fa1ef);}})[_0x41e9('0x16')](function(_0x31b5d6){if(_0x31b5d6){_0x56bde1=_0x31b5d6[_0x41e9('0x38')];if(!_0x122a62[_0x41e9('0x33')]['hasOwnProperty'](_0x41e9('0x3a'))){_0x3fa1ef[_0x41e9('0x23')]=qs[_0x41e9('0x23')](_0x122a62[_0x41e9('0x33')][_0x41e9('0x23')]);_0x3fa1ef[_0x41e9('0x22')]=qs[_0x41e9('0x22')](_0x122a62['query'][_0x41e9('0x22')]);}return _0x1531f0[_0x41e9('0x50')](_0x3fa1ef);}})['then'](function(_0x5bb5ec){if(_0x5bb5ec){return _0x5bb5ec?{'count':_0x56bde1,'rows':_0x5bb5ec}:null;}})['then'](respondWithResult(_0x270dcc,null))[_0x41e9('0x49')](handleError(_0x270dcc,null));};exports[_0x41e9('0x54')]=function(_0x582295,_0x3178cd,_0x29530c){var _0x5193a2={};var _0x475aa0={};var _0x4cdbc9;var _0x290a4d;return db[_0x41e9('0x30')][_0x41e9('0x51')]({'where':{'id':_0x582295[_0x41e9('0x4b')]['id']}})[_0x41e9('0x16')](handleEntityNotFound(_0x3178cd,null))[_0x41e9('0x16')](function(_0x2049ec){if(_0x2049ec){_0x4cdbc9=_0x2049ec;_0x475aa0[_0x41e9('0x31')]=_[_0x41e9('0x32')](db['ZendeskField'][_0x41e9('0x4c')]);_0x475aa0[_0x41e9('0x33')]=_[_0x41e9('0x32')](_0x582295['query']);_0x475aa0[_0x41e9('0x34')]=_[_0x41e9('0x36')](_0x475aa0['model'],_0x475aa0[_0x41e9('0x33')]);_0x5193a2[_0x41e9('0x35')]=_[_0x41e9('0x36')](_0x475aa0[_0x41e9('0x31')],qs[_0x41e9('0x37')](_0x582295[_0x41e9('0x33')][_0x41e9('0x37')]));_0x5193a2[_0x41e9('0x35')]=_0x5193a2[_0x41e9('0x35')][_0x41e9('0x38')]?_0x5193a2[_0x41e9('0x35')]:_0x475aa0[_0x41e9('0x31')];_0x5193a2[_0x41e9('0x3b')]=qs['sort'](_0x582295[_0x41e9('0x33')][_0x41e9('0x3c')]);_0x5193a2['where']=qs[_0x41e9('0x34')](_[_0x41e9('0x3e')](_0x582295[_0x41e9('0x33')],_0x475aa0['filters']));if(_0x582295[_0x41e9('0x33')][_0x41e9('0x3f')]){_0x5193a2[_0x41e9('0x3d')]=_[_0x41e9('0x40')](_0x5193a2[_0x41e9('0x3d')],{'$or':_['map'](_0x5193a2[_0x41e9('0x35')],function(_0x34636b){var _0x19013e={};_0x19013e[_0x34636b]={'$like':'%'+_0x582295[_0x41e9('0x33')][_0x41e9('0x3f')]+'%'};return _0x19013e;})});}_0x5193a2=_[_0x41e9('0x40')]({},_0x5193a2,_0x582295[_0x41e9('0x44')]);return _0x4cdbc9[_0x41e9('0x54')](_0x5193a2);}})[_0x41e9('0x16')](function(_0x568996){if(_0x568996){_0x290a4d=_0x568996[_0x41e9('0x38')];if(!_0x582295[_0x41e9('0x33')][_0x41e9('0x39')](_0x41e9('0x3a'))){_0x5193a2['limit']=qs[_0x41e9('0x23')](_0x582295[_0x41e9('0x33')]['limit']);_0x5193a2[_0x41e9('0x22')]=qs['offset'](_0x582295[_0x41e9('0x33')][_0x41e9('0x22')]);}return _0x4cdbc9['getSubjects'](_0x5193a2);}})['then'](function(_0xd956b9){if(_0xd956b9){return _0xd956b9?{'count':_0x290a4d,'rows':_0xd956b9}:null;}})['then'](respondWithResult(_0x3178cd,null))[_0x41e9('0x49')](handleError(_0x3178cd,null));};exports['getDescriptions']=function(_0x12c8b1,_0xf473e0,_0x5aff54){var _0x2dd793={};var _0x50abc9={};var _0x19ace8;var _0x40fce3;return db[_0x41e9('0x30')]['findOne']({'where':{'id':_0x12c8b1[_0x41e9('0x4b')]['id']}})[_0x41e9('0x16')](handleEntityNotFound(_0xf473e0,null))[_0x41e9('0x16')](function(_0x28856a){if(_0x28856a){_0x19ace8=_0x28856a;_0x50abc9[_0x41e9('0x31')]=_[_0x41e9('0x32')](db[_0x41e9('0x52')][_0x41e9('0x4c')]);_0x50abc9[_0x41e9('0x33')]=_[_0x41e9('0x32')](_0x12c8b1[_0x41e9('0x33')]);_0x50abc9['filters']=_[_0x41e9('0x36')](_0x50abc9[_0x41e9('0x31')],_0x50abc9[_0x41e9('0x33')]);_0x2dd793[_0x41e9('0x35')]=_[_0x41e9('0x36')](_0x50abc9[_0x41e9('0x31')],qs[_0x41e9('0x37')](_0x12c8b1[_0x41e9('0x33')]['fields']));_0x2dd793['attributes']=_0x2dd793['attributes'][_0x41e9('0x38')]?_0x2dd793['attributes']:_0x50abc9[_0x41e9('0x31')];_0x2dd793[_0x41e9('0x3b')]=qs[_0x41e9('0x3c')](_0x12c8b1[_0x41e9('0x33')]['sort']);_0x2dd793[_0x41e9('0x3d')]=qs['filters'](_[_0x41e9('0x3e')](_0x12c8b1[_0x41e9('0x33')],_0x50abc9[_0x41e9('0x34')]));if(_0x12c8b1['query'][_0x41e9('0x3f')]){_0x2dd793[_0x41e9('0x3d')]=_[_0x41e9('0x40')](_0x2dd793[_0x41e9('0x3d')],{'$or':_[_0x41e9('0x53')](_0x2dd793['attributes'],function(_0x8c7eb5){var _0x20a886={};_0x20a886[_0x8c7eb5]={'$like':'%'+_0x12c8b1['query']['filter']+'%'};return _0x20a886;})});}_0x2dd793=_[_0x41e9('0x40')]({},_0x2dd793,_0x12c8b1[_0x41e9('0x44')]);return _0x19ace8[_0x41e9('0x55')](_0x2dd793);}})[_0x41e9('0x16')](function(_0x375fcc){if(_0x375fcc){_0x40fce3=_0x375fcc[_0x41e9('0x38')];if(!_0x12c8b1['query'][_0x41e9('0x39')](_0x41e9('0x3a'))){_0x2dd793[_0x41e9('0x23')]=qs['limit'](_0x12c8b1[_0x41e9('0x33')][_0x41e9('0x23')]);_0x2dd793[_0x41e9('0x22')]=qs[_0x41e9('0x22')](_0x12c8b1[_0x41e9('0x33')][_0x41e9('0x22')]);}return _0x19ace8[_0x41e9('0x55')](_0x2dd793);}})[_0x41e9('0x16')](function(_0x5aaa71){if(_0x5aaa71){return _0x5aaa71?{'count':_0x40fce3,'rows':_0x5aaa71}:null;}})['then'](respondWithResult(_0xf473e0,null))[_0x41e9('0x49')](handleError(_0xf473e0,null));};exports[_0x41e9('0x56')]=function(_0x1a3ce9,_0x43e5f8,_0x41a816){var _0x2546b4={};var _0x2a4eda={};var _0x1c4ad5;var _0x21ccc3;return db['ZendeskConfiguration'][_0x41e9('0x51')]({'where':{'id':_0x1a3ce9[_0x41e9('0x4b')]['id']}})[_0x41e9('0x16')](handleEntityNotFound(_0x43e5f8,null))[_0x41e9('0x16')](function(_0x29ead3){if(_0x29ead3){_0x1c4ad5=_0x29ead3;_0x2a4eda[_0x41e9('0x31')]=_['keys'](db[_0x41e9('0x57')][_0x41e9('0x4c')]);_0x2a4eda[_0x41e9('0x33')]=_['keys'](_0x1a3ce9[_0x41e9('0x33')]);_0x2a4eda[_0x41e9('0x34')]=_[_0x41e9('0x36')](_0x2a4eda[_0x41e9('0x31')],_0x2a4eda[_0x41e9('0x33')]);_0x2546b4['attributes']=_[_0x41e9('0x36')](_0x2a4eda['model'],qs[_0x41e9('0x37')](_0x1a3ce9['query'][_0x41e9('0x37')]));_0x2546b4[_0x41e9('0x35')]=_0x2546b4['attributes'][_0x41e9('0x38')]?_0x2546b4[_0x41e9('0x35')]:_0x2a4eda['model'];_0x2546b4['order']=qs['sort'](_0x1a3ce9[_0x41e9('0x33')]['sort']);_0x2546b4[_0x41e9('0x3d')]=qs[_0x41e9('0x34')](_[_0x41e9('0x3e')](_0x1a3ce9[_0x41e9('0x33')],_0x2a4eda[_0x41e9('0x34')]));if(_0x1a3ce9['query']['filter']){_0x2546b4[_0x41e9('0x3d')]=_[_0x41e9('0x40')](_0x2546b4[_0x41e9('0x3d')],{'$or':_[_0x41e9('0x53')](_0x2546b4['attributes'],function(_0x119882){var _0x763989={};_0x763989[_0x119882]={'$like':'%'+_0x1a3ce9[_0x41e9('0x33')][_0x41e9('0x3f')]+'%'};return _0x763989;})});}_0x2546b4=_[_0x41e9('0x40')]({},_0x2546b4,_0x1a3ce9[_0x41e9('0x44')]);return _0x1c4ad5[_0x41e9('0x56')](_0x2546b4);}})[_0x41e9('0x16')](function(_0x102644){if(_0x102644){_0x21ccc3=_0x102644[_0x41e9('0x38')];if(!_0x1a3ce9[_0x41e9('0x33')][_0x41e9('0x39')](_0x41e9('0x3a'))){_0x2546b4[_0x41e9('0x23')]=qs['limit'](_0x1a3ce9[_0x41e9('0x33')]['limit']);_0x2546b4[_0x41e9('0x22')]=qs[_0x41e9('0x22')](_0x1a3ce9[_0x41e9('0x33')]['offset']);}return _0x1c4ad5[_0x41e9('0x56')](_0x2546b4);}})['then'](function(_0x5b5d97){if(_0x5b5d97){return _0x5b5d97?{'count':_0x21ccc3,'rows':_0x5b5d97}:null;}})['then'](respondWithResult(_0x43e5f8,null))['catch'](handleError(_0x43e5f8,null));};exports['setTags']=function(_0x1d9f4b,_0x5ee30f,_0x2e5a3b){if(_0x1d9f4b['body']['id']){delete _0x1d9f4b['body']['id'];}return db[_0x41e9('0x30')][_0x41e9('0x51')]({'where':{'id':_0x1d9f4b['params']['id']}})['then'](handleEntityNotFound(_0x5ee30f,null))[_0x41e9('0x16')](function(_0x324841){if(_0x324841){return _0x324841[_0x41e9('0x58')](_0x1d9f4b['body'][_0x41e9('0x59')]||[]);}return null;})[_0x41e9('0x16')](respondWithResult(_0x5ee30f,null))['catch'](handleError(_0x5ee30f,null));};
\ No newline at end of file
+var _0x1cc6=['create','body','find','findOne','getFields','getSubjects','ZendeskField','getDescriptions','getTags','Tag','setTags','ids','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','apply','save','update','destroy','stack','index','rawAttributes','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','key','options','ZendeskConfiguration','count','includeAll','include','findAll','rows','show','params','length'];(function(_0x3b2a7c,_0x23225a){var _0x122527=function(_0x4fa551){while(--_0x4fa551){_0x3b2a7c['push'](_0x3b2a7c['shift']());}};_0x122527(++_0x23225a);}(_0x1cc6,0x66));var _0x61cc=function(_0x2f0057,_0x448b27){_0x2f0057=_0x2f0057-0x0;var _0x17f2c3=_0x1cc6[_0x2f0057];return _0x17f2c3;};'use strict';var pdf=require(_0x61cc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x61cc('0x1'));var zipdir=require(_0x61cc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x61cc('0x3'));var moment=require(_0x61cc('0x4'));var BPromise=require(_0x61cc('0x5'));var Mustache=require(_0x61cc('0x6'));var util=require(_0x61cc('0x7'));var path=require(_0x61cc('0x8'));var sox=require(_0x61cc('0x9'));var csv=require(_0x61cc('0xa'));var ejs=require(_0x61cc('0xb'));var fs=require('fs');var _=require(_0x61cc('0xc'));var squel=require(_0x61cc('0xd'));var crypto=require(_0x61cc('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x61cc('0xf'));var toCsv=require(_0x61cc('0xa'));var querystring=require(_0x61cc('0x10'));var Papa=require(_0x61cc('0x11'));var authService=require('../../components/auth/service');var hardwareService=require(_0x61cc('0x12'));var Redis=require('ioredis');var qs=require(_0x61cc('0x13'));var logger=require(_0x61cc('0x14'))(_0x61cc('0x15'));var utils=require('../../config/utils');var config=require(_0x61cc('0x16'));var db=require(_0x61cc('0x17'))['db'];var jayson=require(_0x61cc('0x18'));var client=jayson['client'][_0x61cc('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x175222,_0x5efc4f,_0x22e860,_0x429a84){return new BPromise(function(_0x5f32fe,_0x45216d){var _0x2ee12f=_0x429a84||client;return _0x2ee12f['request'](_0x175222,_0x22e860)[_0x61cc('0x1a')](function(_0x53c9c3){logger[_0x61cc('0x1b')](_0x61cc('0x1c'),_0x5efc4f,_0x61cc('0x1d'));logger[_0x61cc('0x1e')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5efc4f,_0x61cc('0x1d'),JSON[_0x61cc('0x1f')](_0x53c9c3));if(_0x53c9c3[_0x61cc('0x20')]){if(_0x53c9c3['error'][_0x61cc('0x21')]===0x1f4){logger[_0x61cc('0x20')](_0x61cc('0x1c'),_0x5efc4f,_0x53c9c3[_0x61cc('0x20')][_0x61cc('0x22')]);return _0x45216d(_0x53c9c3[_0x61cc('0x20')][_0x61cc('0x22')]);}logger[_0x61cc('0x20')](_0x61cc('0x1c'),_0x5efc4f,_0x53c9c3['error']['message']);return _0x5f32fe(_0x53c9c3[_0x61cc('0x20')][_0x61cc('0x22')]);}else{logger[_0x61cc('0x1b')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5efc4f,'request\x20sent');_0x5f32fe(_0x53c9c3[_0x61cc('0x23')]['message']);}})[_0x61cc('0x24')](function(_0x486af9){logger[_0x61cc('0x20')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5efc4f,_0x486af9);_0x45216d(_0x486af9);});});}function respondWithStatusCode(_0x3df975,_0xb10e2d){_0xb10e2d=_0xb10e2d||0xcc;return function(_0x3a8f08){if(_0x3a8f08){return _0x3df975[_0x61cc('0x25')](_0xb10e2d);}return _0x3df975[_0x61cc('0x26')](_0xb10e2d)[_0x61cc('0x27')]();};}function respondWithResult(_0x5c1417,_0x124a09){_0x124a09=_0x124a09||0xc8;return function(_0x51bc39){if(_0x51bc39){return _0x5c1417[_0x61cc('0x26')](_0x124a09)[_0x61cc('0x28')](_0x51bc39);}};}function respondWithFilteredResult(_0x1e9afb,_0x309734){return function(_0x1a18ae){if(_0x1a18ae){var _0x3ddc01=_0x1a18ae['count'],_0x1e2704=_0x309734[_0x61cc('0x29')],_0x33d2e5=_0x309734[_0x61cc('0x29')]+_0x309734[_0x61cc('0x2a')],_0x56e3e2;if(_0x33d2e5>=_0x3ddc01){_0x33d2e5=_0x3ddc01;_0x56e3e2=0xc8;}else{_0x56e3e2=0xce;}_0x1e9afb[_0x61cc('0x26')](_0x56e3e2);return _0x1e9afb[_0x61cc('0x2b')]('Content-Range',_0x1e2704+'-'+_0x33d2e5+'/'+_0x3ddc01)[_0x61cc('0x28')](_0x1a18ae);}return null;};}function patchUpdates(_0x4b5f09){return function(_0x190c44){try{jsonpatch[_0x61cc('0x2c')](_0x190c44,_0x4b5f09,!![]);}catch(_0x5d2703){return BPromise['reject'](_0x5d2703);}return _0x190c44[_0x61cc('0x2d')]();};}function saveUpdates(_0x2735f6,_0x3c5a07){return function(_0x1ae74e){if(_0x1ae74e){return _0x1ae74e[_0x61cc('0x2e')](_0x2735f6)['then'](function(_0x395ef4){return _0x395ef4;});}return null;};}function removeEntity(_0x51baee,_0x12d17f){return function(_0x2d9520){if(_0x2d9520){return _0x2d9520[_0x61cc('0x2f')]()[_0x61cc('0x1a')](function(){_0x51baee[_0x61cc('0x26')](0xcc)[_0x61cc('0x27')]();});}};}function handleEntityNotFound(_0x12e535,_0x243522){return function(_0x27fe68){if(!_0x27fe68){_0x12e535[_0x61cc('0x25')](0x194);}return _0x27fe68;};}function handleError(_0x45ff46,_0x4f9803){_0x4f9803=_0x4f9803||0x1f4;return function(_0x44a2a8){logger['error'](_0x44a2a8[_0x61cc('0x30')]);if(_0x44a2a8['name']){delete _0x44a2a8['name'];}_0x45ff46[_0x61cc('0x26')](_0x4f9803)['send'](_0x44a2a8);};}exports[_0x61cc('0x31')]=function(_0x33ae20,_0x43579e){var _0x33e229={},_0x10f0c5={},_0x5ae15e={'count':0x0,'rows':[]};var _0x27c04a=db['ZendeskConfiguration'][_0x61cc('0x32')];_0x10f0c5['model']=_[_0x61cc('0x33')](_0x27c04a);_0x10f0c5[_0x61cc('0x34')]=_['keys'](_0x33ae20[_0x61cc('0x34')]);_0x10f0c5[_0x61cc('0x35')]=_[_0x61cc('0x36')](_0x10f0c5[_0x61cc('0x37')],_0x10f0c5[_0x61cc('0x34')]);_0x33e229['attributes']=_[_0x61cc('0x36')](_0x10f0c5[_0x61cc('0x37')],qs[_0x61cc('0x38')](_0x33ae20['query'][_0x61cc('0x38')]));_0x33e229['attributes']=_0x33e229[_0x61cc('0x39')]['length']?_0x33e229[_0x61cc('0x39')]:_0x10f0c5[_0x61cc('0x37')];if(!_0x33ae20[_0x61cc('0x34')][_0x61cc('0x3a')](_0x61cc('0x3b'))){_0x33e229[_0x61cc('0x2a')]=qs['limit'](_0x33ae20[_0x61cc('0x34')]['limit']);_0x33e229[_0x61cc('0x29')]=qs[_0x61cc('0x29')](_0x33ae20[_0x61cc('0x34')][_0x61cc('0x29')]);}_0x33e229[_0x61cc('0x3c')]=qs[_0x61cc('0x3d')](_0x33ae20[_0x61cc('0x34')][_0x61cc('0x3d')]);_0x33e229[_0x61cc('0x3e')]=qs[_0x61cc('0x35')](_[_0x61cc('0x3f')](_0x33ae20[_0x61cc('0x34')],_0x10f0c5['filters']));if(_0x33ae20[_0x61cc('0x34')][_0x61cc('0x40')]){_0x33e229['where']=_[_0x61cc('0x41')](_0x33e229['where'],{'$or':_[_0x61cc('0x42')](_0x27c04a,function(_0x463024){if(_0x463024['type'][_0x61cc('0x43')]!=='VIRTUAL'){var _0x389231={};_0x389231[_0x463024['field']]={'$like':'%'+_0x33ae20[_0x61cc('0x34')][_0x61cc('0x40')]+'%'};return _0x389231;}})});}_0x33e229=_[_0x61cc('0x41')]({},_0x33e229,_0x33ae20[_0x61cc('0x44')]);var _0x38ebbf={'where':_0x33e229[_0x61cc('0x3e')]};return db[_0x61cc('0x45')][_0x61cc('0x46')](_0x38ebbf)[_0x61cc('0x1a')](function(_0x14fdb2){_0x5ae15e[_0x61cc('0x46')]=_0x14fdb2;if(_0x33ae20[_0x61cc('0x34')][_0x61cc('0x47')]){_0x33e229[_0x61cc('0x48')]=[{'all':!![]}];}return db[_0x61cc('0x45')][_0x61cc('0x49')](_0x33e229);})[_0x61cc('0x1a')](function(_0x45e3ea){_0x5ae15e[_0x61cc('0x4a')]=_0x45e3ea;return _0x5ae15e;})['then'](respondWithFilteredResult(_0x43579e,_0x33e229))[_0x61cc('0x24')](handleError(_0x43579e,null));};exports[_0x61cc('0x4b')]=function(_0x4a8fb2,_0x5655d3){var _0x346640={'raw':![],'where':{'id':_0x4a8fb2[_0x61cc('0x4c')]['id']}},_0x26b0e7={};_0x26b0e7[_0x61cc('0x37')]=_[_0x61cc('0x33')](db[_0x61cc('0x45')][_0x61cc('0x32')]);_0x26b0e7['query']=_['keys'](_0x4a8fb2[_0x61cc('0x34')]);_0x26b0e7[_0x61cc('0x35')]=_[_0x61cc('0x36')](_0x26b0e7['model'],_0x26b0e7[_0x61cc('0x34')]);_0x346640['attributes']=_[_0x61cc('0x36')](_0x26b0e7[_0x61cc('0x37')],qs['fields'](_0x4a8fb2[_0x61cc('0x34')]['fields']));_0x346640[_0x61cc('0x39')]=_0x346640[_0x61cc('0x39')][_0x61cc('0x4d')]?_0x346640['attributes']:_0x26b0e7['model'];if(_0x4a8fb2['query'][_0x61cc('0x47')]){_0x346640['include']=[{'all':!![]}];}_0x346640=_[_0x61cc('0x41')]({},_0x346640,_0x4a8fb2[_0x61cc('0x44')]);return db[_0x61cc('0x45')]['find'](_0x346640)[_0x61cc('0x1a')](handleEntityNotFound(_0x5655d3,null))[_0x61cc('0x1a')](respondWithResult(_0x5655d3,null))['catch'](handleError(_0x5655d3,null));};exports[_0x61cc('0x4e')]=function(_0x3503db,_0xea9c60){return db[_0x61cc('0x45')][_0x61cc('0x4e')](_0x3503db[_0x61cc('0x4f')],{})['then'](respondWithResult(_0xea9c60,0xc9))[_0x61cc('0x24')](handleError(_0xea9c60,null));};exports[_0x61cc('0x2e')]=function(_0x45b228,_0x4aacae){if(_0x45b228[_0x61cc('0x4f')]['id']){delete _0x45b228[_0x61cc('0x4f')]['id'];}return db[_0x61cc('0x45')][_0x61cc('0x50')]({'where':{'id':_0x45b228[_0x61cc('0x4c')]['id']}})[_0x61cc('0x1a')](handleEntityNotFound(_0x4aacae,null))['then'](saveUpdates(_0x45b228[_0x61cc('0x4f')],null))['then'](respondWithResult(_0x4aacae,null))['catch'](handleError(_0x4aacae,null));};exports['destroy']=function(_0x42adbc,_0x3785ba){return db[_0x61cc('0x45')][_0x61cc('0x50')]({'where':{'id':_0x42adbc['params']['id']}})[_0x61cc('0x1a')](handleEntityNotFound(_0x3785ba,null))[_0x61cc('0x1a')](removeEntity(_0x3785ba,null))[_0x61cc('0x24')](handleError(_0x3785ba,null));};exports['getFields']=function(_0x5de082,_0x2c54e6,_0x30b233){var _0x40330b={};var _0x3e5798={};var _0x2c613d;var _0x5cf1cc;return db[_0x61cc('0x45')][_0x61cc('0x51')]({'where':{'id':_0x5de082['params']['id']}})[_0x61cc('0x1a')](handleEntityNotFound(_0x2c54e6,null))[_0x61cc('0x1a')](function(_0x3e2f4e){if(_0x3e2f4e){_0x2c613d=_0x3e2f4e;_0x3e5798['model']=_[_0x61cc('0x33')](db['ZendeskField'][_0x61cc('0x32')]);_0x3e5798[_0x61cc('0x34')]=_[_0x61cc('0x33')](_0x5de082['query']);_0x3e5798[_0x61cc('0x35')]=_[_0x61cc('0x36')](_0x3e5798[_0x61cc('0x37')],_0x3e5798[_0x61cc('0x34')]);_0x40330b[_0x61cc('0x39')]=_['intersection'](_0x3e5798['model'],qs[_0x61cc('0x38')](_0x5de082['query'][_0x61cc('0x38')]));_0x40330b[_0x61cc('0x39')]=_0x40330b[_0x61cc('0x39')]['length']?_0x40330b['attributes']:_0x3e5798[_0x61cc('0x37')];_0x40330b[_0x61cc('0x3c')]=qs['sort'](_0x5de082['query'][_0x61cc('0x3d')]);_0x40330b[_0x61cc('0x3e')]=qs[_0x61cc('0x35')](_['pick'](_0x5de082['query'],_0x3e5798['filters']));if(_0x5de082[_0x61cc('0x34')]['filter']){_0x40330b[_0x61cc('0x3e')]=_[_0x61cc('0x41')](_0x40330b[_0x61cc('0x3e')],{'$or':_[_0x61cc('0x42')](_0x40330b[_0x61cc('0x39')],function(_0x4faea6){var _0x2fe0b7={};_0x2fe0b7[_0x4faea6]={'$like':'%'+_0x5de082[_0x61cc('0x34')]['filter']+'%'};return _0x2fe0b7;})});}_0x40330b=_['merge']({},_0x40330b,_0x5de082[_0x61cc('0x44')]);return _0x2c613d['getFields'](_0x40330b);}})[_0x61cc('0x1a')](function(_0x1b0d35){if(_0x1b0d35){_0x5cf1cc=_0x1b0d35[_0x61cc('0x4d')];if(!_0x5de082['query'][_0x61cc('0x3a')](_0x61cc('0x3b'))){_0x40330b[_0x61cc('0x2a')]=qs[_0x61cc('0x2a')](_0x5de082[_0x61cc('0x34')][_0x61cc('0x2a')]);_0x40330b[_0x61cc('0x29')]=qs['offset'](_0x5de082[_0x61cc('0x34')][_0x61cc('0x29')]);}return _0x2c613d[_0x61cc('0x52')](_0x40330b);}})[_0x61cc('0x1a')](function(_0x1f145b){if(_0x1f145b){return _0x1f145b?{'count':_0x5cf1cc,'rows':_0x1f145b}:null;}})[_0x61cc('0x1a')](respondWithResult(_0x2c54e6,null))[_0x61cc('0x24')](handleError(_0x2c54e6,null));};exports[_0x61cc('0x53')]=function(_0x2ae6c8,_0x5780c2,_0x48ea01){var _0xce49a0={};var _0x20a887={};var _0x31feaa;var _0x4d714f;return db[_0x61cc('0x45')]['findOne']({'where':{'id':_0x2ae6c8['params']['id']}})[_0x61cc('0x1a')](handleEntityNotFound(_0x5780c2,null))[_0x61cc('0x1a')](function(_0x44257e){if(_0x44257e){_0x31feaa=_0x44257e;_0x20a887[_0x61cc('0x37')]=_['keys'](db[_0x61cc('0x54')]['rawAttributes']);_0x20a887[_0x61cc('0x34')]=_[_0x61cc('0x33')](_0x2ae6c8[_0x61cc('0x34')]);_0x20a887[_0x61cc('0x35')]=_[_0x61cc('0x36')](_0x20a887['model'],_0x20a887[_0x61cc('0x34')]);_0xce49a0['attributes']=_[_0x61cc('0x36')](_0x20a887[_0x61cc('0x37')],qs[_0x61cc('0x38')](_0x2ae6c8[_0x61cc('0x34')][_0x61cc('0x38')]));_0xce49a0['attributes']=_0xce49a0[_0x61cc('0x39')]['length']?_0xce49a0[_0x61cc('0x39')]:_0x20a887['model'];_0xce49a0[_0x61cc('0x3c')]=qs[_0x61cc('0x3d')](_0x2ae6c8[_0x61cc('0x34')]['sort']);_0xce49a0[_0x61cc('0x3e')]=qs[_0x61cc('0x35')](_[_0x61cc('0x3f')](_0x2ae6c8[_0x61cc('0x34')],_0x20a887['filters']));if(_0x2ae6c8['query'][_0x61cc('0x40')]){_0xce49a0['where']=_[_0x61cc('0x41')](_0xce49a0[_0x61cc('0x3e')],{'$or':_[_0x61cc('0x42')](_0xce49a0[_0x61cc('0x39')],function(_0x192d8e){var _0x26955c={};_0x26955c[_0x192d8e]={'$like':'%'+_0x2ae6c8[_0x61cc('0x34')][_0x61cc('0x40')]+'%'};return _0x26955c;})});}_0xce49a0=_['merge']({},_0xce49a0,_0x2ae6c8[_0x61cc('0x44')]);return _0x31feaa[_0x61cc('0x53')](_0xce49a0);}})[_0x61cc('0x1a')](function(_0x30f50d){if(_0x30f50d){_0x4d714f=_0x30f50d[_0x61cc('0x4d')];if(!_0x2ae6c8[_0x61cc('0x34')]['hasOwnProperty']('nolimit')){_0xce49a0[_0x61cc('0x2a')]=qs[_0x61cc('0x2a')](_0x2ae6c8[_0x61cc('0x34')][_0x61cc('0x2a')]);_0xce49a0[_0x61cc('0x29')]=qs[_0x61cc('0x29')](_0x2ae6c8[_0x61cc('0x34')][_0x61cc('0x29')]);}return _0x31feaa[_0x61cc('0x53')](_0xce49a0);}})[_0x61cc('0x1a')](function(_0x33b8d8){if(_0x33b8d8){return _0x33b8d8?{'count':_0x4d714f,'rows':_0x33b8d8}:null;}})[_0x61cc('0x1a')](respondWithResult(_0x5780c2,null))[_0x61cc('0x24')](handleError(_0x5780c2,null));};exports[_0x61cc('0x55')]=function(_0x4aa569,_0x13b09e,_0x3c6025){var _0x1a4884={};var _0x4e715e={};var _0x1c907d;var _0x20c537;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x4aa569[_0x61cc('0x4c')]['id']}})[_0x61cc('0x1a')](handleEntityNotFound(_0x13b09e,null))[_0x61cc('0x1a')](function(_0x417cba){if(_0x417cba){_0x1c907d=_0x417cba;_0x4e715e[_0x61cc('0x37')]=_[_0x61cc('0x33')](db[_0x61cc('0x54')][_0x61cc('0x32')]);_0x4e715e['query']=_['keys'](_0x4aa569[_0x61cc('0x34')]);_0x4e715e[_0x61cc('0x35')]=_[_0x61cc('0x36')](_0x4e715e['model'],_0x4e715e[_0x61cc('0x34')]);_0x1a4884['attributes']=_['intersection'](_0x4e715e['model'],qs[_0x61cc('0x38')](_0x4aa569[_0x61cc('0x34')]['fields']));_0x1a4884['attributes']=_0x1a4884[_0x61cc('0x39')][_0x61cc('0x4d')]?_0x1a4884[_0x61cc('0x39')]:_0x4e715e['model'];_0x1a4884[_0x61cc('0x3c')]=qs[_0x61cc('0x3d')](_0x4aa569[_0x61cc('0x34')][_0x61cc('0x3d')]);_0x1a4884[_0x61cc('0x3e')]=qs[_0x61cc('0x35')](_['pick'](_0x4aa569['query'],_0x4e715e[_0x61cc('0x35')]));if(_0x4aa569[_0x61cc('0x34')][_0x61cc('0x40')]){_0x1a4884['where']=_[_0x61cc('0x41')](_0x1a4884[_0x61cc('0x3e')],{'$or':_[_0x61cc('0x42')](_0x1a4884[_0x61cc('0x39')],function(_0x30d0f5){var _0x4694ed={};_0x4694ed[_0x30d0f5]={'$like':'%'+_0x4aa569[_0x61cc('0x34')][_0x61cc('0x40')]+'%'};return _0x4694ed;})});}_0x1a4884=_['merge']({},_0x1a4884,_0x4aa569[_0x61cc('0x44')]);return _0x1c907d['getDescriptions'](_0x1a4884);}})[_0x61cc('0x1a')](function(_0x3108cf){if(_0x3108cf){_0x20c537=_0x3108cf['length'];if(!_0x4aa569[_0x61cc('0x34')][_0x61cc('0x3a')]('nolimit')){_0x1a4884[_0x61cc('0x2a')]=qs[_0x61cc('0x2a')](_0x4aa569[_0x61cc('0x34')]['limit']);_0x1a4884[_0x61cc('0x29')]=qs[_0x61cc('0x29')](_0x4aa569[_0x61cc('0x34')][_0x61cc('0x29')]);}return _0x1c907d['getDescriptions'](_0x1a4884);}})[_0x61cc('0x1a')](function(_0x537219){if(_0x537219){return _0x537219?{'count':_0x20c537,'rows':_0x537219}:null;}})['then'](respondWithResult(_0x13b09e,null))[_0x61cc('0x24')](handleError(_0x13b09e,null));};exports[_0x61cc('0x56')]=function(_0x2d51cd,_0x1a3c60,_0x443898){var _0x20f8f9={};var _0x271011={};var _0x29581b;var _0x35f2b2;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x2d51cd['params']['id']}})[_0x61cc('0x1a')](handleEntityNotFound(_0x1a3c60,null))[_0x61cc('0x1a')](function(_0x23b9d4){if(_0x23b9d4){_0x29581b=_0x23b9d4;_0x271011['model']=_[_0x61cc('0x33')](db[_0x61cc('0x57')]['rawAttributes']);_0x271011[_0x61cc('0x34')]=_['keys'](_0x2d51cd[_0x61cc('0x34')]);_0x271011['filters']=_['intersection'](_0x271011[_0x61cc('0x37')],_0x271011[_0x61cc('0x34')]);_0x20f8f9[_0x61cc('0x39')]=_[_0x61cc('0x36')](_0x271011[_0x61cc('0x37')],qs[_0x61cc('0x38')](_0x2d51cd[_0x61cc('0x34')][_0x61cc('0x38')]));_0x20f8f9[_0x61cc('0x39')]=_0x20f8f9[_0x61cc('0x39')][_0x61cc('0x4d')]?_0x20f8f9[_0x61cc('0x39')]:_0x271011[_0x61cc('0x37')];_0x20f8f9[_0x61cc('0x3c')]=qs['sort'](_0x2d51cd[_0x61cc('0x34')]['sort']);_0x20f8f9[_0x61cc('0x3e')]=qs['filters'](_[_0x61cc('0x3f')](_0x2d51cd[_0x61cc('0x34')],_0x271011[_0x61cc('0x35')]));if(_0x2d51cd[_0x61cc('0x34')]['filter']){_0x20f8f9[_0x61cc('0x3e')]=_['merge'](_0x20f8f9[_0x61cc('0x3e')],{'$or':_[_0x61cc('0x42')](_0x20f8f9['attributes'],function(_0x4df5c3){var _0x1f27a4={};_0x1f27a4[_0x4df5c3]={'$like':'%'+_0x2d51cd['query'][_0x61cc('0x40')]+'%'};return _0x1f27a4;})});}_0x20f8f9=_[_0x61cc('0x41')]({},_0x20f8f9,_0x2d51cd[_0x61cc('0x44')]);return _0x29581b[_0x61cc('0x56')](_0x20f8f9);}})[_0x61cc('0x1a')](function(_0x35a201){if(_0x35a201){_0x35f2b2=_0x35a201[_0x61cc('0x4d')];if(!_0x2d51cd[_0x61cc('0x34')][_0x61cc('0x3a')]('nolimit')){_0x20f8f9[_0x61cc('0x2a')]=qs[_0x61cc('0x2a')](_0x2d51cd[_0x61cc('0x34')]['limit']);_0x20f8f9['offset']=qs[_0x61cc('0x29')](_0x2d51cd[_0x61cc('0x34')]['offset']);}return _0x29581b[_0x61cc('0x56')](_0x20f8f9);}})[_0x61cc('0x1a')](function(_0x1eb2bc){if(_0x1eb2bc){return _0x1eb2bc?{'count':_0x35f2b2,'rows':_0x1eb2bc}:null;}})[_0x61cc('0x1a')](respondWithResult(_0x1a3c60,null))[_0x61cc('0x24')](handleError(_0x1a3c60,null));};exports[_0x61cc('0x58')]=function(_0x350df9,_0x29387c,_0x3cd4e6){if(_0x350df9[_0x61cc('0x4f')]['id']){delete _0x350df9[_0x61cc('0x4f')]['id'];}return db[_0x61cc('0x45')]['findOne']({'where':{'id':_0x350df9[_0x61cc('0x4c')]['id']}})['then'](handleEntityNotFound(_0x29387c,null))[_0x61cc('0x1a')](function(_0x4d7f2d){if(_0x4d7f2d){return _0x4d7f2d['setTags'](_0x350df9[_0x61cc('0x4f')][_0x61cc('0x59')]||[]);}return null;})[_0x61cc('0x1a')](respondWithResult(_0x29387c,null))[_0x61cc('0x24')](handleError(_0x29387c,null));};
\ No newline at end of file
index 6918c21..64b63b9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6acf=['int_zendesk_configurations','lodash','util','../../config/logger','moment','request-promise','./intZendeskConfiguration.attributes','define','ZendeskConfiguration'];(function(_0x11c8e5,_0x2876e1){var _0x46689a=function(_0x40ba0a){while(--_0x40ba0a){_0x11c8e5['push'](_0x11c8e5['shift']());}};_0x46689a(++_0x2876e1);}(_0x6acf,0x9a));var _0xf6ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6acf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf6ac('0x0'));var util=require(_0xf6ac('0x1'));var logger=require(_0xf6ac('0x2'))('api');var moment=require(_0xf6ac('0x3'));var BPromise=require('bluebird');var rp=require(_0xf6ac('0x4'));var attributes=require(_0xf6ac('0x5'));module['exports']=function(_0x4407da,_0x5552ac){return _0x4407da[_0xf6ac('0x6')](_0xf6ac('0x7'),attributes,{'tableName':_0xf6ac('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xfa28=['int_zendesk_configurations','../../config/logger','api','moment','bluebird','request-promise','define','ZendeskConfiguration'];(function(_0x4d780e,_0x43ae95){var _0x26aad7=function(_0x4a1c05){while(--_0x4a1c05){_0x4d780e['push'](_0x4d780e['shift']());}};_0x26aad7(++_0x43ae95);}(_0xfa28,0x89));var _0x8fa2=function(_0x25fa5c,_0x421141){_0x25fa5c=_0x25fa5c-0x0;var _0x1bade2=_0xfa28[_0x25fa5c];return _0x1bade2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8fa2('0x0'))(_0x8fa2('0x1'));var moment=require(_0x8fa2('0x2'));var BPromise=require(_0x8fa2('0x3'));var rp=require(_0x8fa2('0x4'));var attributes=require('./intZendeskConfiguration.attributes');module['exports']=function(_0x216382,_0x41aea2){return _0x216382[_0x8fa2('0x5')](_0x8fa2('0x6'),attributes,{'tableName':_0x8fa2('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 1624b39..ce8cda3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x86d7=['debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x2b3ddc,_0x19a52d){var _0x5a71ec=function(_0x50b962){while(--_0x50b962){_0x2b3ddc['push'](_0x2b3ddc['shift']());}};_0x5a71ec(++_0x19a52d);}(_0x86d7,0x147));var _0x786d=function(_0x1c1f72,_0x219e0b){_0x1c1f72=_0x1c1f72-0x0;var _0x4baf14=_0x86d7[_0x1c1f72];return _0x4baf14;};'use strict';var _=require(_0x786d('0x0'));var util=require(_0x786d('0x1'));var moment=require(_0x786d('0x2'));var BPromise=require('bluebird');var rs=require(_0x786d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x786d('0x4'))['db'];var utils=require(_0x786d('0x5'));var logger=require(_0x786d('0x6'))(_0x786d('0x7'));var config=require(_0x786d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x786d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3517ca,_0x542245,_0xa502ca){return new BPromise(function(_0x41816a,_0x4b574a){return client[_0x786d('0xa')](_0x3517ca,_0xa502ca)['then'](function(_0x23c3a2){logger[_0x786d('0xb')](_0x786d('0xc'),_0x542245,'request\x20sent');logger[_0x786d('0xd')](_0x786d('0xe'),_0x542245,_0x786d('0xf'),JSON['stringify'](_0x23c3a2));if(_0x23c3a2[_0x786d('0x10')]){if(_0x23c3a2[_0x786d('0x10')][_0x786d('0x11')]===0x1f4){logger[_0x786d('0x10')](_0x786d('0xc'),_0x542245,_0x23c3a2[_0x786d('0x10')][_0x786d('0x12')]);return _0x4b574a(_0x23c3a2[_0x786d('0x10')]['message']);}logger[_0x786d('0x10')](_0x786d('0xc'),_0x542245,_0x23c3a2[_0x786d('0x10')][_0x786d('0x12')]);return _0x41816a(_0x23c3a2[_0x786d('0x10')]['message']);}else{logger[_0x786d('0xb')](_0x786d('0xc'),_0x542245,_0x786d('0xf'));_0x41816a(_0x23c3a2['result'][_0x786d('0x12')]);}})[_0x786d('0x13')](function(_0x3a2048){logger['error'](_0x786d('0xc'),_0x542245,_0x3a2048);_0x4b574a(_0x3a2048);});});}
\ No newline at end of file
+var _0xd5f4=['stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x434f45,_0x3958e4){var _0x5ee7f6=function(_0x2947da){while(--_0x2947da){_0x434f45['push'](_0x434f45['shift']());}};_0x5ee7f6(++_0x3958e4);}(_0xd5f4,0xf5));var _0x4d5f=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xd5f4[_0x42bdad];return _0x122626;};'use strict';var _=require(_0x4d5f('0x0'));var util=require(_0x4d5f('0x1'));var moment=require(_0x4d5f('0x2'));var BPromise=require('bluebird');var rs=require(_0x4d5f('0x3'));var fs=require('fs');var Redis=require(_0x4d5f('0x4'));var db=require(_0x4d5f('0x5'))['db'];var utils=require(_0x4d5f('0x6'));var logger=require(_0x4d5f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4d5f('0x8')][_0x4d5f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x510900,_0x232fe2,_0x306fac){return new BPromise(function(_0x6be49,_0x4cd774){return client['request'](_0x510900,_0x306fac)[_0x4d5f('0xa')](function(_0x4a0abd){logger['info'](_0x4d5f('0xb'),_0x232fe2,_0x4d5f('0xc'));logger[_0x4d5f('0xd')](_0x4d5f('0xe'),_0x232fe2,_0x4d5f('0xc'),JSON[_0x4d5f('0xf')](_0x4a0abd));if(_0x4a0abd[_0x4d5f('0x10')]){if(_0x4a0abd['error'][_0x4d5f('0x11')]===0x1f4){logger[_0x4d5f('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x232fe2,_0x4a0abd[_0x4d5f('0x10')]['message']);return _0x4cd774(_0x4a0abd[_0x4d5f('0x10')]['message']);}logger[_0x4d5f('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x232fe2,_0x4a0abd[_0x4d5f('0x10')][_0x4d5f('0x12')]);return _0x6be49(_0x4a0abd['error'][_0x4d5f('0x12')]);}else{logger['info'](_0x4d5f('0xb'),_0x232fe2,_0x4d5f('0xc'));_0x6be49(_0x4a0abd[_0x4d5f('0x13')][_0x4d5f('0x12')]);}})['catch'](function(_0x297e2e){logger['error'](_0x4d5f('0xb'),_0x232fe2,_0x297e2e);_0x4cd774(_0x297e2e);});});}
\ No newline at end of file
index e1b5ae1..3b232bc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x4e434f,_0x22f4c5){var _0x32e41f=function(_0x26723f){while(--_0x26723f){_0x4e434f['push'](_0x4e434f['shift']());}};_0x32e41f(++_0x22f4c5);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./intZendeskField.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0xc')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0xd')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller[_0x7995('0xe')]);router[_0x7995('0xf')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['destroy']);module[_0x7995('0x10')]=router;
\ No newline at end of file
+var _0x9957=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x241bc8,_0x2547d0){var _0xf88072=function(_0x7fb7d9){while(--_0x7fb7d9){_0x241bc8['push'](_0x241bc8['shift']());}};_0xf88072(++_0x2547d0);}(_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 auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./intZendeskField.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0xc')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0xd')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller[_0x7995('0xe')]);router[_0x7995('0xf')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['destroy']);module[_0x7995('0x10')]=router;
\ No newline at end of file
index 61bf28a..2e3793b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6c76=['customVariable','STRING','string','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0x6c76,0x184));var _0x66c7=function(_0x13080c,_0x878006){_0x13080c=_0x13080c-0x0;var _0x228c66=_0x6c76[_0x13080c];return _0x228c66;};'use strict';var Sequelize=require(_0x66c7('0x0'));module[_0x66c7('0x1')]={'type':{'type':Sequelize[_0x66c7('0x2')]('string',_0x66c7('0x3'),_0x66c7('0x4'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0x66c7('0x5')]},'key':{'type':Sequelize[_0x66c7('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x66c7('0x6'),_0x66c7('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x66c7('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x66c7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x66c7('0x5')]}};
\ No newline at end of file
+var _0x55e0=['keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x428774,_0x383962){var _0x53a01c=function(_0x2d62da){while(--_0x2d62da){_0x428774['push'](_0x428774['shift']());}};_0x53a01c(++_0x383962);}(_0x55e0,0xdc));var _0x055e=function(_0x8cc7c,_0x591379){_0x8cc7c=_0x8cc7c-0x0;var _0x404b40=_0x55e0[_0x8cc7c];return _0x404b40;};'use strict';var Sequelize=require(_0x055e('0x0'));module[_0x055e('0x1')]={'type':{'type':Sequelize[_0x055e('0x2')](_0x055e('0x3'),'variable','customVariable',_0x055e('0x4')),'defaultValue':_0x055e('0x3')},'content':{'type':Sequelize[_0x055e('0x5')]},'key':{'type':Sequelize[_0x055e('0x5')]},'keyType':{'type':Sequelize[_0x055e('0x2')](_0x055e('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x055e('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x055e('0x5')]},'customField':{'type':Sequelize[_0x055e('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x055e('0x5')]}};
\ No newline at end of file
index ebd6318..1549590 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1df5=['fast-json-patch','request-promise','moment','bluebird','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','ioredis','../../config/utils','../../config/environment','sendStatus','status','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','stack','name','send','index','ZendeskField','rawAttributes','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filters','map','type','key','VIRTUAL','field','filter','merge','options','includeAll','include','rows','show','params','find','create','catch','body','html-pdf','eml-format','rimraf'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x1df5,0x85));var _0x51df=function(_0x43112b,_0x192fcd){_0x43112b=_0x43112b-0x0;var _0x3d916d=_0x1df5[_0x43112b];return _0x3d916d;};'use strict';var pdf=require(_0x51df('0x0'));var emlformat=require(_0x51df('0x1'));var rimraf=require(_0x51df('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x51df('0x3'));var rp=require(_0x51df('0x4'));var moment=require(_0x51df('0x5'));var BPromise=require(_0x51df('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x51df('0x7'));var fs=require('fs');var _=require(_0x51df('0x8'));var squel=require(_0x51df('0x9'));var crypto=require('crypto');var jsforce=require(_0x51df('0xa'));var deskjs=require(_0x51df('0xb'));var toCsv=require(_0x51df('0xc'));var querystring=require(_0x51df('0xd'));var Papa=require(_0x51df('0xe'));var authService=require(_0x51df('0xf'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x51df('0x10'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require(_0x51df('0x11'));var config=require(_0x51df('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16cc38,_0x35e374){_0x35e374=_0x35e374||0xcc;return function(_0x371895){if(_0x371895){return _0x16cc38[_0x51df('0x13')](_0x35e374);}return _0x16cc38[_0x51df('0x14')](_0x35e374)['end']();};}function respondWithResult(_0x868d15,_0x1f3e18){_0x1f3e18=_0x1f3e18||0xc8;return function(_0x1a2a6b){if(_0x1a2a6b){return _0x868d15['status'](_0x1f3e18)['json'](_0x1a2a6b);}};}function respondWithFilteredResult(_0x58801a,_0x3997c1){return function(_0x292589){if(_0x292589){var _0x4c1f11=_0x292589[_0x51df('0x15')],_0x2178d6=_0x3997c1[_0x51df('0x16')],_0x5387da=_0x3997c1[_0x51df('0x16')]+_0x3997c1[_0x51df('0x17')],_0x37424d;if(_0x5387da>=_0x4c1f11){_0x5387da=_0x4c1f11;_0x37424d=0xc8;}else{_0x37424d=0xce;}_0x58801a['status'](_0x37424d);return _0x58801a[_0x51df('0x18')](_0x51df('0x19'),_0x2178d6+'-'+_0x5387da+'/'+_0x4c1f11)['json'](_0x292589);}return null;};}function patchUpdates(_0x44c7fb){return function(_0x4edde3){try{jsonpatch[_0x51df('0x1a')](_0x4edde3,_0x44c7fb,!![]);}catch(_0x28badb){return BPromise['reject'](_0x28badb);}return _0x4edde3[_0x51df('0x1b')]();};}function saveUpdates(_0x3cabfb,_0x360558){return function(_0x3d22f1){if(_0x3d22f1){return _0x3d22f1[_0x51df('0x1c')](_0x3cabfb)[_0x51df('0x1d')](function(_0xd67fd8){return _0xd67fd8;});}return null;};}function removeEntity(_0x3e9dba,_0x20868c){return function(_0x543aad){if(_0x543aad){return _0x543aad[_0x51df('0x1e')]()[_0x51df('0x1d')](function(){_0x3e9dba[_0x51df('0x14')](0xcc)[_0x51df('0x1f')]();});}};}function handleEntityNotFound(_0x54e4df,_0x878e29){return function(_0x2bf40a){if(!_0x2bf40a){_0x54e4df[_0x51df('0x13')](0x194);}return _0x2bf40a;};}function handleError(_0x4b6d5b,_0x4668e8){_0x4668e8=_0x4668e8||0x1f4;return function(_0x4ca9e5){logger['error'](_0x4ca9e5[_0x51df('0x20')]);if(_0x4ca9e5[_0x51df('0x21')]){delete _0x4ca9e5[_0x51df('0x21')];}_0x4b6d5b[_0x51df('0x14')](_0x4668e8)[_0x51df('0x22')](_0x4ca9e5);};}exports[_0x51df('0x23')]=function(_0x4a86c5,_0x249210){var _0x389de4={},_0x5383bb={},_0xb3a713={'count':0x0,'rows':[]};var _0x446615=db[_0x51df('0x24')][_0x51df('0x25')];_0x5383bb[_0x51df('0x26')]=_['keys'](_0x446615);_0x5383bb[_0x51df('0x27')]=_[_0x51df('0x28')](_0x4a86c5[_0x51df('0x27')]);_0x5383bb['filters']=_['intersection'](_0x5383bb['model'],_0x5383bb[_0x51df('0x27')]);_0x389de4[_0x51df('0x29')]=_[_0x51df('0x2a')](_0x5383bb[_0x51df('0x26')],qs[_0x51df('0x2b')](_0x4a86c5[_0x51df('0x27')]['fields']));_0x389de4[_0x51df('0x29')]=_0x389de4[_0x51df('0x29')][_0x51df('0x2c')]?_0x389de4[_0x51df('0x29')]:_0x5383bb['model'];if(!_0x4a86c5[_0x51df('0x27')]['hasOwnProperty'](_0x51df('0x2d'))){_0x389de4['limit']=qs[_0x51df('0x17')](_0x4a86c5[_0x51df('0x27')][_0x51df('0x17')]);_0x389de4[_0x51df('0x16')]=qs[_0x51df('0x16')](_0x4a86c5[_0x51df('0x27')][_0x51df('0x16')]);}_0x389de4[_0x51df('0x2e')]=qs[_0x51df('0x2f')](_0x4a86c5[_0x51df('0x27')][_0x51df('0x2f')]);_0x389de4[_0x51df('0x30')]=qs['filters'](_[_0x51df('0x31')](_0x4a86c5[_0x51df('0x27')],_0x5383bb[_0x51df('0x32')]));if(_0x4a86c5[_0x51df('0x27')]['filter']){_0x389de4[_0x51df('0x30')]=_['merge'](_0x389de4[_0x51df('0x30')],{'$or':_[_0x51df('0x33')](_0x446615,function(_0x4aad2a){if(_0x4aad2a[_0x51df('0x34')][_0x51df('0x35')]!==_0x51df('0x36')){var _0x2cae9e={};_0x2cae9e[_0x4aad2a[_0x51df('0x37')]]={'$like':'%'+_0x4a86c5[_0x51df('0x27')][_0x51df('0x38')]+'%'};return _0x2cae9e;}})});}_0x389de4=_[_0x51df('0x39')]({},_0x389de4,_0x4a86c5[_0x51df('0x3a')]);var _0x58d146={'where':_0x389de4[_0x51df('0x30')]};return db[_0x51df('0x24')]['count'](_0x58d146)['then'](function(_0x5c3468){_0xb3a713[_0x51df('0x15')]=_0x5c3468;if(_0x4a86c5[_0x51df('0x27')][_0x51df('0x3b')]){_0x389de4[_0x51df('0x3c')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x389de4);})['then'](function(_0x596130){_0xb3a713[_0x51df('0x3d')]=_0x596130;return _0xb3a713;})['then'](respondWithFilteredResult(_0x249210,_0x389de4))['catch'](handleError(_0x249210,null));};exports[_0x51df('0x3e')]=function(_0x38704d,_0x103da1){var _0x179902={'raw':!![],'where':{'id':_0x38704d[_0x51df('0x3f')]['id']}},_0x510ae9={};_0x510ae9[_0x51df('0x26')]=_[_0x51df('0x28')](db[_0x51df('0x24')][_0x51df('0x25')]);_0x510ae9[_0x51df('0x27')]=_['keys'](_0x38704d[_0x51df('0x27')]);_0x510ae9[_0x51df('0x32')]=_[_0x51df('0x2a')](_0x510ae9[_0x51df('0x26')],_0x510ae9[_0x51df('0x27')]);_0x179902[_0x51df('0x29')]=_[_0x51df('0x2a')](_0x510ae9[_0x51df('0x26')],qs[_0x51df('0x2b')](_0x38704d[_0x51df('0x27')][_0x51df('0x2b')]));_0x179902['attributes']=_0x179902[_0x51df('0x29')]['length']?_0x179902[_0x51df('0x29')]:_0x510ae9['model'];if(_0x38704d['query']['includeAll']){_0x179902[_0x51df('0x3c')]=[{'all':!![]}];}_0x179902=_[_0x51df('0x39')]({},_0x179902,_0x38704d[_0x51df('0x3a')]);return db[_0x51df('0x24')][_0x51df('0x40')](_0x179902)[_0x51df('0x1d')](handleEntityNotFound(_0x103da1,null))[_0x51df('0x1d')](respondWithResult(_0x103da1,null))['catch'](handleError(_0x103da1,null));};exports[_0x51df('0x41')]=function(_0x2b0e78,_0x3d0c9e){return db['ZendeskField'][_0x51df('0x41')](_0x2b0e78['body'],{})[_0x51df('0x1d')](respondWithResult(_0x3d0c9e,0xc9))[_0x51df('0x42')](handleError(_0x3d0c9e,null));};exports[_0x51df('0x1c')]=function(_0x53103c,_0x2cc108){if(_0x53103c[_0x51df('0x43')]['id']){delete _0x53103c[_0x51df('0x43')]['id'];}return db[_0x51df('0x24')]['find']({'where':{'id':_0x53103c[_0x51df('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2cc108,null))[_0x51df('0x1d')](saveUpdates(_0x53103c[_0x51df('0x43')],null))['then'](respondWithResult(_0x2cc108,null))[_0x51df('0x42')](handleError(_0x2cc108,null));};exports[_0x51df('0x1e')]=function(_0x36fec0,_0x21e8ac){return db['ZendeskField']['find']({'where':{'id':_0x36fec0[_0x51df('0x3f')]['id']}})[_0x51df('0x1d')](handleEntityNotFound(_0x21e8ac,null))[_0x51df('0x1d')](removeEntity(_0x21e8ac,null))[_0x51df('0x42')](handleError(_0x21e8ac,null));};
\ No newline at end of file
+var _0x4739=['zip-dir','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','ZendeskField','rawAttributes','keys','query','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','map','VIRTUAL','field','options','includeAll','include','findAll','rows','show','params','fields','find','catch','create','body','html-pdf'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x4739,0x113));var _0x9473=function(_0x396c14,_0x10240a){_0x396c14=_0x396c14-0x0;var _0x3b8bc0=_0x4739[_0x396c14];return _0x3b8bc0;};'use strict';var pdf=require(_0x9473('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9473('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9473('0x2'));var moment=require('moment');var BPromise=require(_0x9473('0x3'));var Mustache=require('mustache');var util=require(_0x9473('0x4'));var path=require(_0x9473('0x5'));var sox=require('sox');var csv=require(_0x9473('0x6'));var ejs=require(_0x9473('0x7'));var fs=require('fs');var _=require(_0x9473('0x8'));var squel=require(_0x9473('0x9'));var crypto=require(_0x9473('0xa'));var jsforce=require(_0x9473('0xb'));var deskjs=require(_0x9473('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9473('0xd'));var Papa=require(_0x9473('0xe'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x9473('0xf'));var qs=require(_0x9473('0x10'));var logger=require(_0x9473('0x11'))(_0x9473('0x12'));var utils=require('../../config/utils');var config=require(_0x9473('0x13'));var db=require(_0x9473('0x14'))['db'];function respondWithStatusCode(_0x18d17c,_0x5cf4b3){_0x5cf4b3=_0x5cf4b3||0xcc;return function(_0x3d898f){if(_0x3d898f){return _0x18d17c[_0x9473('0x15')](_0x5cf4b3);}return _0x18d17c[_0x9473('0x16')](_0x5cf4b3)[_0x9473('0x17')]();};}function respondWithResult(_0xd1baf0,_0x335de3){_0x335de3=_0x335de3||0xc8;return function(_0x2998aa){if(_0x2998aa){return _0xd1baf0['status'](_0x335de3)['json'](_0x2998aa);}};}function respondWithFilteredResult(_0x4bfa75,_0x13c6b1){return function(_0x308ebc){if(_0x308ebc){var _0x164f59=_0x308ebc[_0x9473('0x18')],_0x2abb5b=_0x13c6b1[_0x9473('0x19')],_0xd94407=_0x13c6b1['offset']+_0x13c6b1[_0x9473('0x1a')],_0x2e7d59;if(_0xd94407>=_0x164f59){_0xd94407=_0x164f59;_0x2e7d59=0xc8;}else{_0x2e7d59=0xce;}_0x4bfa75['status'](_0x2e7d59);return _0x4bfa75[_0x9473('0x1b')](_0x9473('0x1c'),_0x2abb5b+'-'+_0xd94407+'/'+_0x164f59)['json'](_0x308ebc);}return null;};}function patchUpdates(_0x518f31){return function(_0x475537){try{jsonpatch[_0x9473('0x1d')](_0x475537,_0x518f31,!![]);}catch(_0xd1b60){return BPromise[_0x9473('0x1e')](_0xd1b60);}return _0x475537['save']();};}function saveUpdates(_0x41113c,_0x1929e3){return function(_0x3d0627){if(_0x3d0627){return _0x3d0627[_0x9473('0x1f')](_0x41113c)[_0x9473('0x20')](function(_0xa27607){return _0xa27607;});}return null;};}function removeEntity(_0x217616,_0x580e7e){return function(_0x19ccbf){if(_0x19ccbf){return _0x19ccbf[_0x9473('0x21')]()[_0x9473('0x20')](function(){_0x217616['status'](0xcc)[_0x9473('0x17')]();});}};}function handleEntityNotFound(_0x442498,_0x292668){return function(_0x4fdb32){if(!_0x4fdb32){_0x442498['sendStatus'](0x194);}return _0x4fdb32;};}function handleError(_0x286a95,_0x5622a6){_0x5622a6=_0x5622a6||0x1f4;return function(_0x381a73){logger[_0x9473('0x22')](_0x381a73[_0x9473('0x23')]);if(_0x381a73[_0x9473('0x24')]){delete _0x381a73['name'];}_0x286a95[_0x9473('0x16')](_0x5622a6)['send'](_0x381a73);};}exports[_0x9473('0x25')]=function(_0x155a23,_0x22c5b4){var _0x31136f={},_0x322af0={},_0x5b468e={'count':0x0,'rows':[]};var _0x3a157a=db[_0x9473('0x26')][_0x9473('0x27')];_0x322af0['model']=_[_0x9473('0x28')](_0x3a157a);_0x322af0[_0x9473('0x29')]=_[_0x9473('0x28')](_0x155a23['query']);_0x322af0[_0x9473('0x2a')]=_[_0x9473('0x2b')](_0x322af0[_0x9473('0x2c')],_0x322af0[_0x9473('0x29')]);_0x31136f['attributes']=_[_0x9473('0x2b')](_0x322af0[_0x9473('0x2c')],qs['fields'](_0x155a23[_0x9473('0x29')]['fields']));_0x31136f[_0x9473('0x2d')]=_0x31136f[_0x9473('0x2d')]['length']?_0x31136f[_0x9473('0x2d')]:_0x322af0[_0x9473('0x2c')];if(!_0x155a23['query'][_0x9473('0x2e')](_0x9473('0x2f'))){_0x31136f['limit']=qs[_0x9473('0x1a')](_0x155a23[_0x9473('0x29')][_0x9473('0x1a')]);_0x31136f[_0x9473('0x19')]=qs[_0x9473('0x19')](_0x155a23[_0x9473('0x29')][_0x9473('0x19')]);}_0x31136f[_0x9473('0x30')]=qs[_0x9473('0x31')](_0x155a23[_0x9473('0x29')]['sort']);_0x31136f['where']=qs[_0x9473('0x2a')](_[_0x9473('0x32')](_0x155a23[_0x9473('0x29')],_0x322af0[_0x9473('0x2a')]));if(_0x155a23['query'][_0x9473('0x33')]){_0x31136f['where']=_[_0x9473('0x34')](_0x31136f[_0x9473('0x35')],{'$or':_[_0x9473('0x36')](_0x3a157a,function(_0x4be01a){if(_0x4be01a['type']['key']!==_0x9473('0x37')){var _0x5a18cb={};_0x5a18cb[_0x4be01a[_0x9473('0x38')]]={'$like':'%'+_0x155a23[_0x9473('0x29')][_0x9473('0x33')]+'%'};return _0x5a18cb;}})});}_0x31136f=_[_0x9473('0x34')]({},_0x31136f,_0x155a23[_0x9473('0x39')]);var _0x442eca={'where':_0x31136f[_0x9473('0x35')]};return db[_0x9473('0x26')][_0x9473('0x18')](_0x442eca)[_0x9473('0x20')](function(_0x2fd7e9){_0x5b468e[_0x9473('0x18')]=_0x2fd7e9;if(_0x155a23['query'][_0x9473('0x3a')]){_0x31136f[_0x9473('0x3b')]=[{'all':!![]}];}return db[_0x9473('0x26')][_0x9473('0x3c')](_0x31136f);})['then'](function(_0x16bc44){_0x5b468e[_0x9473('0x3d')]=_0x16bc44;return _0x5b468e;})[_0x9473('0x20')](respondWithFilteredResult(_0x22c5b4,_0x31136f))['catch'](handleError(_0x22c5b4,null));};exports[_0x9473('0x3e')]=function(_0x59a584,_0x515bdb){var _0x3b73c6={'raw':!![],'where':{'id':_0x59a584[_0x9473('0x3f')]['id']}},_0x340bbf={};_0x340bbf['model']=_[_0x9473('0x28')](db['ZendeskField'][_0x9473('0x27')]);_0x340bbf[_0x9473('0x29')]=_[_0x9473('0x28')](_0x59a584[_0x9473('0x29')]);_0x340bbf[_0x9473('0x2a')]=_['intersection'](_0x340bbf['model'],_0x340bbf[_0x9473('0x29')]);_0x3b73c6['attributes']=_[_0x9473('0x2b')](_0x340bbf[_0x9473('0x2c')],qs[_0x9473('0x40')](_0x59a584[_0x9473('0x29')]['fields']));_0x3b73c6[_0x9473('0x2d')]=_0x3b73c6[_0x9473('0x2d')]['length']?_0x3b73c6['attributes']:_0x340bbf[_0x9473('0x2c')];if(_0x59a584['query'][_0x9473('0x3a')]){_0x3b73c6['include']=[{'all':!![]}];}_0x3b73c6=_[_0x9473('0x34')]({},_0x3b73c6,_0x59a584[_0x9473('0x39')]);return db[_0x9473('0x26')][_0x9473('0x41')](_0x3b73c6)['then'](handleEntityNotFound(_0x515bdb,null))[_0x9473('0x20')](respondWithResult(_0x515bdb,null))[_0x9473('0x42')](handleError(_0x515bdb,null));};exports['create']=function(_0x31a930,_0x89d16b){return db['ZendeskField'][_0x9473('0x43')](_0x31a930[_0x9473('0x44')],{})[_0x9473('0x20')](respondWithResult(_0x89d16b,0xc9))[_0x9473('0x42')](handleError(_0x89d16b,null));};exports[_0x9473('0x1f')]=function(_0x5deb47,_0x318668){if(_0x5deb47[_0x9473('0x44')]['id']){delete _0x5deb47[_0x9473('0x44')]['id'];}return db[_0x9473('0x26')]['find']({'where':{'id':_0x5deb47[_0x9473('0x3f')]['id']}})[_0x9473('0x20')](handleEntityNotFound(_0x318668,null))[_0x9473('0x20')](saveUpdates(_0x5deb47[_0x9473('0x44')],null))[_0x9473('0x20')](respondWithResult(_0x318668,null))[_0x9473('0x42')](handleError(_0x318668,null));};exports[_0x9473('0x21')]=function(_0x432a73,_0x3e0712){return db[_0x9473('0x26')][_0x9473('0x41')]({'where':{'id':_0x432a73[_0x9473('0x3f')]['id']}})[_0x9473('0x20')](handleEntityNotFound(_0x3e0712,null))['then'](removeEntity(_0x3e0712,null))[_0x9473('0x42')](handleError(_0x3e0712,null));};
\ No newline at end of file
index 54493e8..8986e83 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xea28=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./intZendeskField.attributes','define','int_zendesk_fields','zendesk_unique_index'];(function(_0xda209,_0x97f42f){var _0x3c1551=function(_0x4c54a5){while(--_0x4c54a5){_0xda209['push'](_0xda209['shift']());}};_0x3c1551(++_0x97f42f);}(_0xea28,0x13a));var _0x8ea2=function(_0x53b9d1,_0x2a98b2){_0x53b9d1=_0x53b9d1-0x0;var _0x1e222d=_0xea28[_0x53b9d1];return _0x1e222d;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var logger=require(_0x8ea2('0x2'))(_0x8ea2('0x3'));var moment=require(_0x8ea2('0x4'));var BPromise=require(_0x8ea2('0x5'));var rp=require(_0x8ea2('0x6'));var attributes=require(_0x8ea2('0x7'));module['exports']=function(_0x9b45ab,_0x23aaf1){return _0x9b45ab[_0x8ea2('0x8')]('ZendeskField',attributes,{'tableName':_0x8ea2('0x9'),'paranoid':![],'indexes':[{'name':_0x8ea2('0xa'),'fields':[_0x8ea2('0xb'),_0x8ea2('0xc')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x34b7=['api','moment','bluebird','request-promise','./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','../../config/logger'];(function(_0x5b6cf1,_0x32fdcd){var _0x46278c=function(_0x53fd9b){while(--_0x53fd9b){_0x5b6cf1['push'](_0x5b6cf1['shift']());}};_0x46278c(++_0x32fdcd);}(_0x34b7,0x196));var _0x734b=function(_0x31f207,_0x33353a){_0x31f207=_0x31f207-0x0;var _0x1089ef=_0x34b7[_0x31f207];return _0x1089ef;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x734b('0x0'))(_0x734b('0x1'));var moment=require(_0x734b('0x2'));var BPromise=require(_0x734b('0x3'));var rp=require(_0x734b('0x4'));var attributes=require(_0x734b('0x5'));module['exports']=function(_0x547652,_0x303067){return _0x547652[_0x734b('0x6')](_0x734b('0x7'),attributes,{'tableName':_0x734b('0x8'),'paranoid':![],'indexes':[{'name':_0x734b('0x9'),'fields':[_0x734b('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index 099999d..1df8da2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc901=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','lodash'];(function(_0x22be6d,_0x90876b){var _0x1985e1=function(_0x4a8921){while(--_0x4a8921){_0x22be6d['push'](_0x22be6d['shift']());}};_0x1985e1(++_0x90876b);}(_0xc901,0x142));var _0x1c90=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc901[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x1c90('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c90('0x1'));var db=require(_0x1c90('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x1c90('0x3'))(_0x1c90('0x4'));var config=require(_0x1c90('0x5'));var jayson=require(_0x1c90('0x6'));var client=jayson[_0x1c90('0x7')][_0x1c90('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x912860,_0x12c07d,_0x423cfb){return new BPromise(function(_0x19196f,_0x514386){return client[_0x1c90('0x9')](_0x912860,_0x423cfb)[_0x1c90('0xa')](function(_0x38cd18){logger[_0x1c90('0xb')](_0x1c90('0xc'),_0x12c07d,_0x1c90('0xd'));logger[_0x1c90('0xe')](_0x1c90('0xf'),_0x12c07d,'request\x20sent',JSON['stringify'](_0x38cd18));if(_0x38cd18[_0x1c90('0x10')]){if(_0x38cd18[_0x1c90('0x10')][_0x1c90('0x11')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x12c07d,_0x38cd18[_0x1c90('0x10')][_0x1c90('0x12')]);return _0x514386(_0x38cd18['error'][_0x1c90('0x12')]);}logger[_0x1c90('0x10')](_0x1c90('0xc'),_0x12c07d,_0x38cd18['error'][_0x1c90('0x12')]);return _0x19196f(_0x38cd18['error'][_0x1c90('0x12')]);}else{logger[_0x1c90('0xb')](_0x1c90('0xc'),_0x12c07d,_0x1c90('0xd'));_0x19196f(_0x38cd18['result'][_0x1c90('0x12')]);}})['catch'](function(_0x2d3c90){logger[_0x1c90('0x10')]('ZendeskField,\x20%s,\x20%s',_0x12c07d,_0x2d3c90);_0x514386(_0x2d3c90);});});}
\ No newline at end of file
+var _0x750a=['error','code','ZendeskField,\x20%s,\x20%s','message','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify'];(function(_0xc8e0f3,_0x5997b2){var _0x373338=function(_0xaf75cf){while(--_0xaf75cf){_0xc8e0f3['push'](_0xc8e0f3['shift']());}};_0x373338(++_0x5997b2);}(_0x750a,0x140));var _0xa750=function(_0x58be0a,_0x478178){_0x58be0a=_0x58be0a-0x0;var _0x216b62=_0x750a[_0x58be0a];return _0x216b62;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa750('0x1'));var fs=require('fs');var Redis=require(_0xa750('0x2'));var db=require(_0xa750('0x3'))['db'];var utils=require(_0xa750('0x4'));var logger=require(_0xa750('0x5'))(_0xa750('0x6'));var config=require(_0xa750('0x7'));var jayson=require(_0xa750('0x8'));var client=jayson[_0xa750('0x9')][_0xa750('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x197299,_0x1ae455,_0x3d7c43){return new BPromise(function(_0x47a4dd,_0x53f2cb){return client[_0xa750('0xb')](_0x197299,_0x3d7c43)['then'](function(_0x4458b1){logger[_0xa750('0xc')]('ZendeskField,\x20%s,\x20%s',_0x1ae455,_0xa750('0xd'));logger[_0xa750('0xe')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x1ae455,'request\x20sent',JSON[_0xa750('0xf')](_0x4458b1));if(_0x4458b1['error']){if(_0x4458b1[_0xa750('0x10')][_0xa750('0x11')]===0x1f4){logger['error'](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x53f2cb(_0x4458b1['error'][_0xa750('0x13')]);}logger[_0xa750('0x10')](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x47a4dd(_0x4458b1[_0xa750('0x10')]['message']);}else{logger[_0xa750('0xc')](_0xa750('0x12'),_0x1ae455,_0xa750('0xd'));_0x47a4dd(_0x4458b1['result'][_0xa750('0x13')]);}})[_0xa750('0x14')](function(_0x58639b){logger['error'](_0xa750('0x12'),_0x1ae455,_0x58639b);_0x53f2cb(_0x58639b);});});}
\ No newline at end of file
index 255bfd8..f66e489 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa571=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','./intZohoAccount.controller','isAuthenticated','index','get'];(function(_0x52f177,_0x41ea86){var _0x32d5ef=function(_0x417c4b){while(--_0x417c4b){_0x52f177['push'](_0x52f177['shift']());}};_0x32d5ef(++_0x41ea86);}(_0xa571,0x107));var _0x1a57=function(_0x549966,_0x1bb990){_0x549966=_0x549966-0x0;var _0x4e1609=_0xa571[_0x549966];return _0x4e1609;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var auth=require(_0x1a57('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1a57('0x6'));router['get']('/',auth[_0x1a57('0x7')](),controller[_0x1a57('0x8')]);router[_0x1a57('0x9')](_0x1a57('0xa'),auth[_0x1a57('0x7')](),controller[_0x1a57('0xb')]);router['get'](_0x1a57('0xc'),auth[_0x1a57('0x7')](),controller[_0x1a57('0xd')]);router['get'](_0x1a57('0xe'),auth[_0x1a57('0x7')](),controller[_0x1a57('0xf')]);router[_0x1a57('0x10')]('/',auth[_0x1a57('0x7')](),controller[_0x1a57('0x11')]);router[_0x1a57('0x10')](_0x1a57('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x1a57('0x12')](_0x1a57('0xa'),auth[_0x1a57('0x7')](),controller['update']);router[_0x1a57('0x13')](_0x1a57('0xa'),auth['isAuthenticated'](),controller[_0x1a57('0x14')]);module['exports']=router;
\ No newline at end of file
+var _0xefda=['delete','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put'];(function(_0x845672,_0x2a2b2a){var _0x24f4b4=function(_0x1108d7){while(--_0x1108d7){_0x845672['push'](_0x845672['shift']());}};_0x24f4b4(++_0x2a2b2a);}(_0xefda,0x96));var _0xaefd=function(_0x6bc68,_0x162239){_0x6bc68=_0x6bc68-0x0;var _0x102cdb=_0xefda[_0x6bc68];return _0x102cdb;};'use strict';var multer=require(_0xaefd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaefd('0x1'));var express=require(_0xaefd('0x2'));var router=express['Router']();var auth=require(_0xaefd('0x3'));var interaction=require(_0xaefd('0x4'));var config=require(_0xaefd('0x5'));var controller=require(_0xaefd('0x6'));router[_0xaefd('0x7')]('/',auth[_0xaefd('0x8')](),controller['index']);router[_0xaefd('0x7')](_0xaefd('0x9'),auth[_0xaefd('0x8')](),controller[_0xaefd('0xa')]);router['get'](_0xaefd('0xb'),auth[_0xaefd('0x8')](),controller[_0xaefd('0xc')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xaefd('0xd')]);router[_0xaefd('0xe')]('/',auth[_0xaefd('0x8')](),controller[_0xaefd('0xf')]);router[_0xaefd('0xe')](_0xaefd('0xb'),auth[_0xaefd('0x8')](),controller[_0xaefd('0x10')]);router[_0xaefd('0x11')](_0xaefd('0x9'),auth[_0xaefd('0x8')](),controller['update']);router[_0xaefd('0x12')]('/:id',auth[_0xaefd('0x8')](),controller[_0xaefd('0x13')]);module[_0xaefd('0x14')]=router;
\ No newline at end of file
index 7982238..33d0067 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xda2d=['STRING','exports'];(function(_0x417123,_0x5b001e){var _0x1b1ccf=function(_0x1694f9){while(--_0x1694f9){_0x417123['push'](_0x417123['shift']());}};_0x1b1ccf(++_0x5b001e);}(_0xda2d,0x113));var _0xdda2=function(_0x55cf2b,_0x5ffdcb){_0x55cf2b=_0x55cf2b-0x0;var _0x127942=_0xda2d[_0x55cf2b];return _0x127942;};'use strict';var Sequelize=require('sequelize');module[_0xdda2('0x0')]={'name':{'type':Sequelize[_0xdda2('0x1')]},'description':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xdda2('0x1')]},'host':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x8ba0=['STRING','sequelize','exports'];(function(_0x491c4d,_0x1c2915){var _0x1b30b4=function(_0x5c7cf7){while(--_0x5c7cf7){_0x491c4d['push'](_0x491c4d['shift']());}};_0x1b30b4(++_0x1c2915);}(_0x8ba0,0x124));var _0x08ba=function(_0x5dfeb6,_0xf17364){_0x5dfeb6=_0x5dfeb6-0x0;var _0x1c9371=_0x8ba0[_0x5dfeb6];return _0x1c9371;};'use strict';var Sequelize=require(_0x08ba('0x0'));module[_0x08ba('0x1')]={'name':{'type':Sequelize[_0x08ba('0x2')]},'description':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x08ba('0x2')]},'host':{'type':Sequelize[_0x08ba('0x2')]},'serverUrl':{'type':Sequelize['STRING']}};
\ No newline at end of file
index b9af977..eac5995 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6918=['field','merge','options','count','includeAll','findAll','rows','show','params','include','find','create','body','getConfigurations','findOne','ZohoConfiguration','nolimit','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','ZohoField','getFields','host','GET','format','https://crm.%s/crm/private/json/Calls/getFields','crmapi','response','Calls','section','Call\x20Purpose','includes','push','label','Pick\x20List','val','test','statusCode','name','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','status','json','offset','limit','Content-Range','apply','reject','save','update','end','send','ZohoAccount','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','map','type','key','VIRTUAL'];(function(_0x39b6bc,_0x4aff45){var _0x544ae2=function(_0x3f10be){while(--_0x3f10be){_0x39b6bc['push'](_0x39b6bc['shift']());}};_0x544ae2(++_0x4aff45);}(_0x6918,0x17a));var _0x8691=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6918[_0x397e5f];return _0x5302b8;};'use strict';var pdf=require(_0x8691('0x0'));var emlformat=require(_0x8691('0x1'));var rimraf=require(_0x8691('0x2'));var zipdir=require(_0x8691('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8691('0x4'));var moment=require('moment');var BPromise=require(_0x8691('0x5'));var Mustache=require(_0x8691('0x6'));var util=require('util');var path=require(_0x8691('0x7'));var sox=require('sox');var csv=require(_0x8691('0x8'));var ejs=require(_0x8691('0x9'));var fs=require('fs');var _=require(_0x8691('0xa'));var squel=require(_0x8691('0xb'));var crypto=require(_0x8691('0xc'));var jsforce=require(_0x8691('0xd'));var deskjs=require(_0x8691('0xe'));var toCsv=require(_0x8691('0x8'));var querystring=require(_0x8691('0xf'));var Papa=require(_0x8691('0x10'));var authService=require('../../components/auth/service');var hardwareService=require(_0x8691('0x11'));var Redis=require(_0x8691('0x12'));var qs=require(_0x8691('0x13'));var logger=require(_0x8691('0x14'))(_0x8691('0x15'));var utils=require(_0x8691('0x16'));var config=require(_0x8691('0x17'));var db=require(_0x8691('0x18'))['db'];var integrations=require(_0x8691('0x19'));var jayson=require(_0x8691('0x1a'));var client=jayson[_0x8691('0x1b')][_0x8691('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1476b3,_0x605711,_0x18f549,_0x4eca94){return new BPromise(function(_0x3fd5e9,_0x4620c3){var _0xdd195a=_0x4eca94||client;return _0xdd195a['request'](_0x1476b3,_0x18f549)[_0x8691('0x1d')](function(_0x3530bc){logger['info'](_0x8691('0x1e'),_0x605711,_0x8691('0x1f'));logger[_0x8691('0x20')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x605711,'request\x20sent',JSON[_0x8691('0x21')](_0x3530bc));if(_0x3530bc['error']){if(_0x3530bc[_0x8691('0x22')][_0x8691('0x23')]===0x1f4){logger[_0x8691('0x22')](_0x8691('0x1e'),_0x605711,_0x3530bc[_0x8691('0x22')][_0x8691('0x24')]);return _0x4620c3(_0x3530bc[_0x8691('0x22')][_0x8691('0x24')]);}logger[_0x8691('0x22')](_0x8691('0x1e'),_0x605711,_0x3530bc[_0x8691('0x22')][_0x8691('0x24')]);return _0x3fd5e9(_0x3530bc[_0x8691('0x22')][_0x8691('0x24')]);}else{logger[_0x8691('0x25')]('ZohoAccount,\x20%s,\x20%s',_0x605711,_0x8691('0x1f'));_0x3fd5e9(_0x3530bc[_0x8691('0x26')][_0x8691('0x24')]);}})[_0x8691('0x27')](function(_0x4c672b){logger[_0x8691('0x22')](_0x8691('0x1e'),_0x605711,_0x4c672b);_0x4620c3(_0x4c672b);});});}function respondWithStatusCode(_0x5e9d7d,_0x11c593){_0x11c593=_0x11c593||0xcc;return function(_0x5d0e26){if(_0x5d0e26){return _0x5e9d7d['sendStatus'](_0x11c593);}return _0x5e9d7d[_0x8691('0x28')](_0x11c593)['end']();};}function respondWithResult(_0x2702f4,_0x2b7574){_0x2b7574=_0x2b7574||0xc8;return function(_0x53a5d6){if(_0x53a5d6){return _0x2702f4[_0x8691('0x28')](_0x2b7574)[_0x8691('0x29')](_0x53a5d6);}};}function respondWithFilteredResult(_0x3b4d61,_0x1a2c69){return function(_0x4f16a9){if(_0x4f16a9){var _0x4bd77c=_0x4f16a9['count'],_0x556e86=_0x1a2c69[_0x8691('0x2a')],_0x51cf6c=_0x1a2c69['offset']+_0x1a2c69[_0x8691('0x2b')],_0x572b2e;if(_0x51cf6c>=_0x4bd77c){_0x51cf6c=_0x4bd77c;_0x572b2e=0xc8;}else{_0x572b2e=0xce;}_0x3b4d61['status'](_0x572b2e);return _0x3b4d61['set'](_0x8691('0x2c'),_0x556e86+'-'+_0x51cf6c+'/'+_0x4bd77c)['json'](_0x4f16a9);}return null;};}function patchUpdates(_0x3826a7){return function(_0x332024){try{jsonpatch[_0x8691('0x2d')](_0x332024,_0x3826a7,!![]);}catch(_0x31adec){return BPromise[_0x8691('0x2e')](_0x31adec);}return _0x332024[_0x8691('0x2f')]();};}function saveUpdates(_0x342e68,_0x868b22){return function(_0x2bc6ee){if(_0x2bc6ee){return _0x2bc6ee[_0x8691('0x30')](_0x342e68)[_0x8691('0x1d')](function(_0x463f76){return _0x463f76;});}return null;};}function removeEntity(_0x345160,_0x495999){return function(_0x1f7a75){if(_0x1f7a75){return _0x1f7a75['destroy']()['then'](function(){_0x345160[_0x8691('0x28')](0xcc)[_0x8691('0x31')]();});}};}function handleEntityNotFound(_0x44d4f4,_0x594901){return function(_0x4417c6){if(!_0x4417c6){_0x44d4f4['sendStatus'](0x194);}return _0x4417c6;};}function handleError(_0x190301,_0x5c003b){_0x5c003b=_0x5c003b||0x1f4;return function(_0x942a0c){logger[_0x8691('0x22')](_0x942a0c['stack']);if(_0x942a0c['name']){delete _0x942a0c['name'];}_0x190301['status'](_0x5c003b)[_0x8691('0x32')](_0x942a0c);};}exports['index']=function(_0x54ee35,_0x48f5e1){var _0x3eefd9={},_0x314dd8={},_0x3f2411={'count':0x0,'rows':[]};var _0x587b7b=db[_0x8691('0x33')][_0x8691('0x34')];_0x314dd8['model']=_[_0x8691('0x35')](_0x587b7b);_0x314dd8[_0x8691('0x36')]=_[_0x8691('0x35')](_0x54ee35[_0x8691('0x36')]);_0x314dd8[_0x8691('0x37')]=_[_0x8691('0x38')](_0x314dd8[_0x8691('0x39')],_0x314dd8[_0x8691('0x36')]);_0x3eefd9[_0x8691('0x3a')]=_[_0x8691('0x38')](_0x314dd8['model'],qs[_0x8691('0x3b')](_0x54ee35[_0x8691('0x36')][_0x8691('0x3b')]));_0x3eefd9['attributes']=_0x3eefd9[_0x8691('0x3a')][_0x8691('0x3c')]?_0x3eefd9[_0x8691('0x3a')]:_0x314dd8[_0x8691('0x39')];if(!_0x54ee35[_0x8691('0x36')]['hasOwnProperty']('nolimit')){_0x3eefd9[_0x8691('0x2b')]=qs[_0x8691('0x2b')](_0x54ee35[_0x8691('0x36')][_0x8691('0x2b')]);_0x3eefd9['offset']=qs['offset'](_0x54ee35[_0x8691('0x36')]['offset']);}_0x3eefd9[_0x8691('0x3d')]=qs[_0x8691('0x3e')](_0x54ee35['query'][_0x8691('0x3e')]);_0x3eefd9[_0x8691('0x3f')]=qs[_0x8691('0x37')](_[_0x8691('0x40')](_0x54ee35[_0x8691('0x36')],_0x314dd8[_0x8691('0x37')]));if(_0x54ee35[_0x8691('0x36')][_0x8691('0x41')]){_0x3eefd9[_0x8691('0x3f')]=_['merge'](_0x3eefd9[_0x8691('0x3f')],{'$or':_[_0x8691('0x42')](_0x587b7b,function(_0x469669){if(_0x469669[_0x8691('0x43')][_0x8691('0x44')]!==_0x8691('0x45')){var _0xce6924={};_0xce6924[_0x469669[_0x8691('0x46')]]={'$like':'%'+_0x54ee35[_0x8691('0x36')][_0x8691('0x41')]+'%'};return _0xce6924;}})});}_0x3eefd9=_[_0x8691('0x47')]({},_0x3eefd9,_0x54ee35[_0x8691('0x48')]);var _0x4dc4c5={'where':_0x3eefd9[_0x8691('0x3f')]};return db[_0x8691('0x33')][_0x8691('0x49')](_0x4dc4c5)['then'](function(_0x1c8313){_0x3f2411[_0x8691('0x49')]=_0x1c8313;if(_0x54ee35['query'][_0x8691('0x4a')]){_0x3eefd9['include']=[{'all':!![]}];}return db[_0x8691('0x33')][_0x8691('0x4b')](_0x3eefd9);})[_0x8691('0x1d')](function(_0x270bf3){_0x3f2411[_0x8691('0x4c')]=_0x270bf3;return _0x3f2411;})[_0x8691('0x1d')](respondWithFilteredResult(_0x48f5e1,_0x3eefd9))[_0x8691('0x27')](handleError(_0x48f5e1,null));};exports[_0x8691('0x4d')]=function(_0x124c53,_0x1694cd){var _0x1a3f0e={'raw':![],'where':{'id':_0x124c53[_0x8691('0x4e')]['id']}},_0x147097={};_0x147097[_0x8691('0x39')]=_[_0x8691('0x35')](db[_0x8691('0x33')][_0x8691('0x34')]);_0x147097['query']=_['keys'](_0x124c53['query']);_0x147097[_0x8691('0x37')]=_['intersection'](_0x147097[_0x8691('0x39')],_0x147097[_0x8691('0x36')]);_0x1a3f0e[_0x8691('0x3a')]=_['intersection'](_0x147097[_0x8691('0x39')],qs[_0x8691('0x3b')](_0x124c53[_0x8691('0x36')][_0x8691('0x3b')]));_0x1a3f0e['attributes']=_0x1a3f0e[_0x8691('0x3a')]['length']?_0x1a3f0e[_0x8691('0x3a')]:_0x147097['model'];if(_0x124c53[_0x8691('0x36')][_0x8691('0x4a')]){_0x1a3f0e[_0x8691('0x4f')]=[{'all':!![]}];}_0x1a3f0e=_['merge']({},_0x1a3f0e,_0x124c53[_0x8691('0x48')]);return db[_0x8691('0x33')][_0x8691('0x50')](_0x1a3f0e)['then'](handleEntityNotFound(_0x1694cd,null))[_0x8691('0x1d')](respondWithResult(_0x1694cd,null))[_0x8691('0x27')](handleError(_0x1694cd,null));};exports['create']=function(_0x1fe909,_0x17d7d2){return db[_0x8691('0x33')][_0x8691('0x51')](_0x1fe909[_0x8691('0x52')],{})['then'](respondWithResult(_0x17d7d2,0xc9))['catch'](handleError(_0x17d7d2,null));};exports[_0x8691('0x30')]=function(_0x3266c2,_0x3816dd){if(_0x3266c2[_0x8691('0x52')]['id']){delete _0x3266c2[_0x8691('0x52')]['id'];}return db[_0x8691('0x33')][_0x8691('0x50')]({'where':{'id':_0x3266c2[_0x8691('0x4e')]['id']}})[_0x8691('0x1d')](handleEntityNotFound(_0x3816dd,null))['then'](saveUpdates(_0x3266c2[_0x8691('0x52')],null))[_0x8691('0x1d')](respondWithResult(_0x3816dd,null))[_0x8691('0x27')](handleError(_0x3816dd,null));};exports['destroy']=function(_0x353d17,_0x51cd6a){return db['ZohoAccount'][_0x8691('0x50')]({'where':{'id':_0x353d17[_0x8691('0x4e')]['id']}})['then'](handleEntityNotFound(_0x51cd6a,null))[_0x8691('0x1d')](removeEntity(_0x51cd6a,null))[_0x8691('0x27')](handleError(_0x51cd6a,null));};exports[_0x8691('0x53')]=function(_0x565dda,_0x298647,_0x1fd3c1){var _0x361407={};var _0x23d778={};var _0x2f5a2c;var _0x171aad;return db[_0x8691('0x33')][_0x8691('0x54')]({'where':{'id':_0x565dda[_0x8691('0x4e')]['id']}})[_0x8691('0x1d')](handleEntityNotFound(_0x298647,null))[_0x8691('0x1d')](function(_0x35eaaf){if(_0x35eaaf){_0x2f5a2c=_0x35eaaf;_0x23d778['model']=_[_0x8691('0x35')](db[_0x8691('0x55')][_0x8691('0x34')]);_0x23d778[_0x8691('0x36')]=_['keys'](_0x565dda['query']);_0x23d778[_0x8691('0x37')]=_['intersection'](_0x23d778[_0x8691('0x39')],_0x23d778[_0x8691('0x36')]);_0x361407['attributes']=_[_0x8691('0x38')](_0x23d778[_0x8691('0x39')],qs[_0x8691('0x3b')](_0x565dda['query']['fields']));_0x361407[_0x8691('0x3a')]=_0x361407[_0x8691('0x3a')][_0x8691('0x3c')]?_0x361407[_0x8691('0x3a')]:_0x23d778[_0x8691('0x39')];_0x361407[_0x8691('0x3d')]=qs[_0x8691('0x3e')](_0x565dda[_0x8691('0x36')]['sort']);_0x361407[_0x8691('0x3f')]=qs[_0x8691('0x37')](_[_0x8691('0x40')](_0x565dda['query'],_0x23d778[_0x8691('0x37')]));if(_0x565dda[_0x8691('0x36')][_0x8691('0x41')]){_0x361407[_0x8691('0x3f')]=_[_0x8691('0x47')](_0x361407[_0x8691('0x3f')],{'$or':_['map'](_0x361407[_0x8691('0x3a')],function(_0x45f9b2){var _0x59bc6f={};_0x59bc6f[_0x45f9b2]={'$like':'%'+_0x565dda[_0x8691('0x36')]['filter']+'%'};return _0x59bc6f;})});}_0x361407=_[_0x8691('0x47')]({},_0x361407,_0x565dda[_0x8691('0x48')]);return _0x2f5a2c[_0x8691('0x53')](_0x361407);}})[_0x8691('0x1d')](function(_0x3bc4cb){if(_0x3bc4cb){_0x171aad=_0x3bc4cb[_0x8691('0x3c')];if(!_0x565dda[_0x8691('0x36')]['hasOwnProperty'](_0x8691('0x56'))){_0x361407['limit']=qs['limit'](_0x565dda['query'][_0x8691('0x2b')]);_0x361407[_0x8691('0x2a')]=qs[_0x8691('0x2a')](_0x565dda[_0x8691('0x36')][_0x8691('0x2a')]);}return _0x2f5a2c[_0x8691('0x53')](_0x361407);}})[_0x8691('0x1d')](function(_0x5ea08c){if(_0x5ea08c){return _0x5ea08c?{'count':_0x171aad,'rows':_0x5ea08c}:null;}})[_0x8691('0x1d')](respondWithResult(_0x298647,null))['catch'](handleError(_0x298647,null));};exports[_0x8691('0x57')]=function(_0x4eb30c,_0x382977,_0x5a8a3e){if(_0x4eb30c[_0x8691('0x52')]['id']){delete _0x4eb30c[_0x8691('0x52')]['id'];}return db[_0x8691('0x33')][_0x8691('0x54')]({'where':{'id':_0x4eb30c['params']['id']}})[_0x8691('0x1d')](handleEntityNotFound(_0x382977,null))[_0x8691('0x1d')](function(_0x123364){if(_0x123364){_0x4eb30c[_0x8691('0x52')][_0x8691('0x58')]=_0x123364['id'];_0x4eb30c[_0x8691('0x52')][_0x8691('0x59')]=integrations['getSubjects'](_0x4eb30c[_0x8691('0x52')]['channel'],_0x4eb30c[_0x8691('0x52')][_0x8691('0x43')]);_0x4eb30c['body'][_0x8691('0x5a')]=integrations[_0x8691('0x5b')](_0x4eb30c[_0x8691('0x52')]['channel'],_0x4eb30c[_0x8691('0x52')][_0x8691('0x43')]);return db[_0x8691('0x55')][_0x8691('0x51')](_0x4eb30c['body'],{'include':[{'model':db['ZohoField'],'as':_0x8691('0x59')},{'model':db[_0x8691('0x5c')],'as':_0x8691('0x5a')}]});}return null;})[_0x8691('0x1d')](respondWithResult(_0x382977,null))[_0x8691('0x27')](handleError(_0x382977,null));};exports[_0x8691('0x5d')]=function(_0x1dbced,_0x40fbe3,_0x2273bf){return db[_0x8691('0x33')][_0x8691('0x54')]({'where':{'id':_0x1dbced['params']['id']},'attributes':['id',_0x8691('0x5e'),'authToken']})['then'](handleEntityNotFound(_0x40fbe3,null))['then'](function(_0x3bd993){if(_0x3bd993){return rp({'method':_0x8691('0x5f'),'uri':util[_0x8691('0x60')](_0x8691('0x61'),_0x3bd993[_0x8691('0x5e')]),'qs':{'authtoken':_0x3bd993['authToken'],'scope':_0x8691('0x62')},'json':!![]});}})[_0x8691('0x1d')](function(_0x3a27f4){if(_0x3a27f4){if(_0x3a27f4['response']&&_0x3a27f4[_0x8691('0x63')][_0x8691('0x22')]){throw new Error(_0x3a27f4[_0x8691('0x63')]['error'][_0x8691('0x24')]);}var _0x4e32c0=[];if(_0x3a27f4[_0x8691('0x64')]&&_0x3a27f4[_0x8691('0x64')][_0x8691('0x65')]){if(_0x3a27f4[_0x8691('0x64')][_0x8691('0x65')]['FL']){var _0x4ec17e=[_0x8691('0x66')];for(var _0x3d5adb=0x0,_0x4e03e9=_0x3a27f4['Calls'][_0x8691('0x65')]['FL'][_0x8691('0x3c')];_0x3d5adb<_0x4e03e9;_0x3d5adb++){if(_[_0x8691('0x67')](_0x4ec17e,_0x3a27f4[_0x8691('0x64')][_0x8691('0x65')]['FL'][_0x3d5adb]['dv'])){_0x4e32c0[_0x8691('0x68')]({'id':_0x3a27f4[_0x8691('0x64')][_0x8691('0x65')]['FL'][_0x3d5adb]['dv'],'name':_0x3a27f4[_0x8691('0x64')]['section']['FL'][_0x3d5adb][_0x8691('0x69')],'custom':_0x3a27f4[_0x8691('0x64')][_0x8691('0x65')]['FL'][_0x3d5adb]['customfield']==='true'?!![]:![],'options':_0x3a27f4[_0x8691('0x64')][_0x8691('0x65')]['FL'][_0x3d5adb][_0x8691('0x43')]===_0x8691('0x6a')&&_0x3a27f4['Calls']['section']['FL'][_0x3d5adb][_0x8691('0x6b')]?_[_0x8691('0x42')](_0x3a27f4[_0x8691('0x64')]['section']['FL'][_0x3d5adb][_0x8691('0x6b')],function(_0x3d7a90){return{'name':_0x3d7a90,'value':_0x3d7a90};}):[]});}}}}return{'count':_0x4e32c0['length'],'rows':_0x4e32c0};}})['then'](respondWithResult(_0x40fbe3,null))[_0x8691('0x27')](function(_0x13eac1){var _0xad4292=_0x1dbced[_0x8691('0x36')][_0x8691('0x6c')]?0x1f4:_0x13eac1[_0x8691('0x6d')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x8691('0x5d'),_0xad4292,JSON[_0x8691('0x21')](_0x13eac1));delete _0x13eac1[_0x8691('0x6e')];if(_0xad4292===0x191){_0xad4292=0x190;}_0x40fbe3[_0x8691('0x28')](_0xad4292)['send'](_0x1dbced[_0x8691('0x36')]['test']?{'message':_0x8691('0x6f'),'statusCode':_0x13eac1[_0x8691('0x6d')]}:_0x13eac1);});};
\ No newline at end of file
+var _0x44ae=['count','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','ZohoConfiguration','length','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','type','Descriptions','getDescriptions','channel','ZohoField','getFields','host','substring','lastIndexOf','GET','format','https://crm.%s/crm/private/json/Calls/getFields','authToken','response','Calls','section','Call\x20Purpose','includes','push','customfield','true','val','test','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','sendStatus','status','end','json','offset','limit','set','reject','update','stack','name','send','index','ZohoAccount','rawAttributes','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','key','VIRTUAL','options'];(function(_0xc27142,_0xdd0686){var _0x26a6aa=function(_0x165967){while(--_0x165967){_0xc27142['push'](_0xc27142['shift']());}};_0x26a6aa(++_0xdd0686);}(_0x44ae,0x17d));var _0xe44a=function(_0x5bbb86,_0x31386a){_0x5bbb86=_0x5bbb86-0x0;var _0x41f61d=_0x44ae[_0x5bbb86];return _0x41f61d;};'use strict';var pdf=require(_0xe44a('0x0'));var emlformat=require(_0xe44a('0x1'));var rimraf=require(_0xe44a('0x2'));var zipdir=require(_0xe44a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe44a('0x4'));var moment=require('moment');var BPromise=require(_0xe44a('0x5'));var Mustache=require(_0xe44a('0x6'));var util=require(_0xe44a('0x7'));var path=require(_0xe44a('0x8'));var sox=require(_0xe44a('0x9'));var csv=require(_0xe44a('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe44a('0xb'));var squel=require(_0xe44a('0xc'));var crypto=require(_0xe44a('0xd'));var jsforce=require(_0xe44a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe44a('0xa'));var querystring=require(_0xe44a('0xf'));var Papa=require(_0xe44a('0x10'));var authService=require(_0xe44a('0x11'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0xe44a('0x12'));var qs=require(_0xe44a('0x13'));var logger=require(_0xe44a('0x14'))(_0xe44a('0x15'));var utils=require(_0xe44a('0x16'));var config=require(_0xe44a('0x17'));var db=require(_0xe44a('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson['client'][_0xe44a('0x19')]({'port':0x232a});function respondWithRpcPromise(_0xbfc286,_0x15f225,_0x56cee6,_0x2263ba){return new BPromise(function(_0x3ab707,_0x3656b2){var _0x14c1a8=_0x2263ba||client;return _0x14c1a8[_0xe44a('0x1a')](_0xbfc286,_0x56cee6)[_0xe44a('0x1b')](function(_0x1d491a){logger['info'](_0xe44a('0x1c'),_0x15f225,_0xe44a('0x1d'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x15f225,'request\x20sent',JSON['stringify'](_0x1d491a));if(_0x1d491a[_0xe44a('0x1e')]){if(_0x1d491a[_0xe44a('0x1e')][_0xe44a('0x1f')]===0x1f4){logger['error'](_0xe44a('0x1c'),_0x15f225,_0x1d491a[_0xe44a('0x1e')][_0xe44a('0x20')]);return _0x3656b2(_0x1d491a[_0xe44a('0x1e')][_0xe44a('0x20')]);}logger[_0xe44a('0x1e')]('ZohoAccount,\x20%s,\x20%s',_0x15f225,_0x1d491a[_0xe44a('0x1e')]['message']);return _0x3ab707(_0x1d491a[_0xe44a('0x1e')][_0xe44a('0x20')]);}else{logger[_0xe44a('0x21')](_0xe44a('0x1c'),_0x15f225,_0xe44a('0x1d'));_0x3ab707(_0x1d491a[_0xe44a('0x22')][_0xe44a('0x20')]);}})['catch'](function(_0x203889){logger['error'](_0xe44a('0x1c'),_0x15f225,_0x203889);_0x3656b2(_0x203889);});});}function respondWithStatusCode(_0x2b53b9,_0x444c93){_0x444c93=_0x444c93||0xcc;return function(_0x26eba0){if(_0x26eba0){return _0x2b53b9[_0xe44a('0x23')](_0x444c93);}return _0x2b53b9[_0xe44a('0x24')](_0x444c93)[_0xe44a('0x25')]();};}function respondWithResult(_0x36f5e7,_0x2db197){_0x2db197=_0x2db197||0xc8;return function(_0x2d91b7){if(_0x2d91b7){return _0x36f5e7[_0xe44a('0x24')](_0x2db197)[_0xe44a('0x26')](_0x2d91b7);}};}function respondWithFilteredResult(_0x12bf7c,_0xc69e9d){return function(_0x5574f8){if(_0x5574f8){var _0x8fbbbf=_0x5574f8['count'],_0x48d49a=_0xc69e9d[_0xe44a('0x27')],_0x3bed81=_0xc69e9d[_0xe44a('0x27')]+_0xc69e9d[_0xe44a('0x28')],_0x18acb6;if(_0x3bed81>=_0x8fbbbf){_0x3bed81=_0x8fbbbf;_0x18acb6=0xc8;}else{_0x18acb6=0xce;}_0x12bf7c['status'](_0x18acb6);return _0x12bf7c[_0xe44a('0x29')]('Content-Range',_0x48d49a+'-'+_0x3bed81+'/'+_0x8fbbbf)[_0xe44a('0x26')](_0x5574f8);}return null;};}function patchUpdates(_0x5e0768){return function(_0x5a57a1){try{jsonpatch['apply'](_0x5a57a1,_0x5e0768,!![]);}catch(_0x4a5bdc){return BPromise[_0xe44a('0x2a')](_0x4a5bdc);}return _0x5a57a1['save']();};}function saveUpdates(_0x74869b,_0x58d292){return function(_0x3bbd15){if(_0x3bbd15){return _0x3bbd15[_0xe44a('0x2b')](_0x74869b)[_0xe44a('0x1b')](function(_0x4e5927){return _0x4e5927;});}return null;};}function removeEntity(_0x12af37,_0x98e147){return function(_0x53c580){if(_0x53c580){return _0x53c580['destroy']()[_0xe44a('0x1b')](function(){_0x12af37['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x6dfea5,_0x17728b){return function(_0x1d2c8e){if(!_0x1d2c8e){_0x6dfea5[_0xe44a('0x23')](0x194);}return _0x1d2c8e;};}function handleError(_0x1cc637,_0x25b399){_0x25b399=_0x25b399||0x1f4;return function(_0x2d4ae8){logger[_0xe44a('0x1e')](_0x2d4ae8[_0xe44a('0x2c')]);if(_0x2d4ae8[_0xe44a('0x2d')]){delete _0x2d4ae8[_0xe44a('0x2d')];}_0x1cc637[_0xe44a('0x24')](_0x25b399)[_0xe44a('0x2e')](_0x2d4ae8);};}exports[_0xe44a('0x2f')]=function(_0x2b9e4a,_0x198683){var _0x537c05={},_0x19e6e8={},_0x22b475={'count':0x0,'rows':[]};var _0x5d4aac=db[_0xe44a('0x30')][_0xe44a('0x31')];_0x19e6e8['model']=_['keys'](_0x5d4aac);_0x19e6e8[_0xe44a('0x32')]=_[_0xe44a('0x33')](_0x2b9e4a[_0xe44a('0x32')]);_0x19e6e8[_0xe44a('0x34')]=_[_0xe44a('0x35')](_0x19e6e8[_0xe44a('0x36')],_0x19e6e8['query']);_0x537c05[_0xe44a('0x37')]=_[_0xe44a('0x35')](_0x19e6e8[_0xe44a('0x36')],qs[_0xe44a('0x38')](_0x2b9e4a[_0xe44a('0x32')][_0xe44a('0x38')]));_0x537c05['attributes']=_0x537c05[_0xe44a('0x37')]['length']?_0x537c05[_0xe44a('0x37')]:_0x19e6e8[_0xe44a('0x36')];if(!_0x2b9e4a[_0xe44a('0x32')]['hasOwnProperty'](_0xe44a('0x39'))){_0x537c05['limit']=qs['limit'](_0x2b9e4a[_0xe44a('0x32')][_0xe44a('0x28')]);_0x537c05['offset']=qs['offset'](_0x2b9e4a[_0xe44a('0x32')][_0xe44a('0x27')]);}_0x537c05[_0xe44a('0x3a')]=qs[_0xe44a('0x3b')](_0x2b9e4a['query']['sort']);_0x537c05[_0xe44a('0x3c')]=qs['filters'](_[_0xe44a('0x3d')](_0x2b9e4a[_0xe44a('0x32')],_0x19e6e8[_0xe44a('0x34')]));if(_0x2b9e4a[_0xe44a('0x32')][_0xe44a('0x3e')]){_0x537c05[_0xe44a('0x3c')]=_[_0xe44a('0x3f')](_0x537c05[_0xe44a('0x3c')],{'$or':_['map'](_0x5d4aac,function(_0x19ce46){if(_0x19ce46['type'][_0xe44a('0x40')]!==_0xe44a('0x41')){var _0x5e66db={};_0x5e66db[_0x19ce46['field']]={'$like':'%'+_0x2b9e4a[_0xe44a('0x32')][_0xe44a('0x3e')]+'%'};return _0x5e66db;}})});}_0x537c05=_[_0xe44a('0x3f')]({},_0x537c05,_0x2b9e4a[_0xe44a('0x42')]);var _0x56e905={'where':_0x537c05['where']};return db['ZohoAccount'][_0xe44a('0x43')](_0x56e905)[_0xe44a('0x1b')](function(_0x4273f4){_0x22b475[_0xe44a('0x43')]=_0x4273f4;if(_0x2b9e4a[_0xe44a('0x32')][_0xe44a('0x44')]){_0x537c05[_0xe44a('0x45')]=[{'all':!![]}];}return db[_0xe44a('0x30')][_0xe44a('0x46')](_0x537c05);})[_0xe44a('0x1b')](function(_0x34d47f){_0x22b475[_0xe44a('0x47')]=_0x34d47f;return _0x22b475;})[_0xe44a('0x1b')](respondWithFilteredResult(_0x198683,_0x537c05))[_0xe44a('0x48')](handleError(_0x198683,null));};exports[_0xe44a('0x49')]=function(_0x50a23d,_0x17e4a0){var _0x3852f4={'raw':![],'where':{'id':_0x50a23d[_0xe44a('0x4a')]['id']}},_0x45eda1={};_0x45eda1['model']=_['keys'](db[_0xe44a('0x30')][_0xe44a('0x31')]);_0x45eda1[_0xe44a('0x32')]=_[_0xe44a('0x33')](_0x50a23d['query']);_0x45eda1['filters']=_['intersection'](_0x45eda1[_0xe44a('0x36')],_0x45eda1[_0xe44a('0x32')]);_0x3852f4[_0xe44a('0x37')]=_[_0xe44a('0x35')](_0x45eda1[_0xe44a('0x36')],qs[_0xe44a('0x38')](_0x50a23d[_0xe44a('0x32')][_0xe44a('0x38')]));_0x3852f4[_0xe44a('0x37')]=_0x3852f4[_0xe44a('0x37')]['length']?_0x3852f4['attributes']:_0x45eda1['model'];if(_0x50a23d[_0xe44a('0x32')][_0xe44a('0x44')]){_0x3852f4['include']=[{'all':!![]}];}_0x3852f4=_[_0xe44a('0x3f')]({},_0x3852f4,_0x50a23d[_0xe44a('0x42')]);return db[_0xe44a('0x30')][_0xe44a('0x4b')](_0x3852f4)[_0xe44a('0x1b')](handleEntityNotFound(_0x17e4a0,null))[_0xe44a('0x1b')](respondWithResult(_0x17e4a0,null))[_0xe44a('0x48')](handleError(_0x17e4a0,null));};exports[_0xe44a('0x4c')]=function(_0x1cd90d,_0x5dc6ef){return db['ZohoAccount'][_0xe44a('0x4c')](_0x1cd90d[_0xe44a('0x4d')],{})['then'](respondWithResult(_0x5dc6ef,0xc9))[_0xe44a('0x48')](handleError(_0x5dc6ef,null));};exports[_0xe44a('0x2b')]=function(_0x4f16ef,_0x455562){if(_0x4f16ef[_0xe44a('0x4d')]['id']){delete _0x4f16ef[_0xe44a('0x4d')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x4f16ef['params']['id']}})[_0xe44a('0x1b')](handleEntityNotFound(_0x455562,null))['then'](saveUpdates(_0x4f16ef[_0xe44a('0x4d')],null))[_0xe44a('0x1b')](respondWithResult(_0x455562,null))[_0xe44a('0x48')](handleError(_0x455562,null));};exports['destroy']=function(_0x39513f,_0x418ab3){return db['ZohoAccount'][_0xe44a('0x4b')]({'where':{'id':_0x39513f[_0xe44a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x418ab3,null))[_0xe44a('0x1b')](removeEntity(_0x418ab3,null))[_0xe44a('0x48')](handleError(_0x418ab3,null));};exports['getConfigurations']=function(_0x878893,_0x22a58c,_0x49514d){var _0x435a87={};var _0x3e0616={};var _0x244152;var _0x4fbfd5;return db[_0xe44a('0x30')][_0xe44a('0x4e')]({'where':{'id':_0x878893[_0xe44a('0x4a')]['id']}})[_0xe44a('0x1b')](handleEntityNotFound(_0x22a58c,null))[_0xe44a('0x1b')](function(_0x39c5d8){if(_0x39c5d8){_0x244152=_0x39c5d8;_0x3e0616['model']=_[_0xe44a('0x33')](db[_0xe44a('0x4f')][_0xe44a('0x31')]);_0x3e0616['query']=_[_0xe44a('0x33')](_0x878893[_0xe44a('0x32')]);_0x3e0616[_0xe44a('0x34')]=_['intersection'](_0x3e0616['model'],_0x3e0616[_0xe44a('0x32')]);_0x435a87[_0xe44a('0x37')]=_[_0xe44a('0x35')](_0x3e0616[_0xe44a('0x36')],qs[_0xe44a('0x38')](_0x878893[_0xe44a('0x32')][_0xe44a('0x38')]));_0x435a87[_0xe44a('0x37')]=_0x435a87['attributes'][_0xe44a('0x50')]?_0x435a87[_0xe44a('0x37')]:_0x3e0616[_0xe44a('0x36')];_0x435a87['order']=qs[_0xe44a('0x3b')](_0x878893[_0xe44a('0x32')]['sort']);_0x435a87[_0xe44a('0x3c')]=qs[_0xe44a('0x34')](_['pick'](_0x878893[_0xe44a('0x32')],_0x3e0616[_0xe44a('0x34')]));if(_0x878893[_0xe44a('0x32')][_0xe44a('0x3e')]){_0x435a87[_0xe44a('0x3c')]=_['merge'](_0x435a87[_0xe44a('0x3c')],{'$or':_['map'](_0x435a87[_0xe44a('0x37')],function(_0x193ebd){var _0x5753b2={};_0x5753b2[_0x193ebd]={'$like':'%'+_0x878893[_0xe44a('0x32')]['filter']+'%'};return _0x5753b2;})});}_0x435a87=_['merge']({},_0x435a87,_0x878893[_0xe44a('0x42')]);return _0x244152[_0xe44a('0x51')](_0x435a87);}})[_0xe44a('0x1b')](function(_0xa4df14){if(_0xa4df14){_0x4fbfd5=_0xa4df14[_0xe44a('0x50')];if(!_0x878893[_0xe44a('0x32')][_0xe44a('0x52')](_0xe44a('0x39'))){_0x435a87[_0xe44a('0x28')]=qs[_0xe44a('0x28')](_0x878893[_0xe44a('0x32')][_0xe44a('0x28')]);_0x435a87[_0xe44a('0x27')]=qs[_0xe44a('0x27')](_0x878893[_0xe44a('0x32')]['offset']);}return _0x244152[_0xe44a('0x51')](_0x435a87);}})[_0xe44a('0x1b')](function(_0x343143){if(_0x343143){return _0x343143?{'count':_0x4fbfd5,'rows':_0x343143}:null;}})[_0xe44a('0x1b')](respondWithResult(_0x22a58c,null))[_0xe44a('0x48')](handleError(_0x22a58c,null));};exports[_0xe44a('0x53')]=function(_0x175ded,_0x1fc696,_0x18e2bf){if(_0x175ded[_0xe44a('0x4d')]['id']){delete _0x175ded[_0xe44a('0x4d')]['id'];}return db[_0xe44a('0x30')][_0xe44a('0x4e')]({'where':{'id':_0x175ded[_0xe44a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1fc696,null))['then'](function(_0x1907a4){if(_0x1907a4){_0x175ded[_0xe44a('0x4d')][_0xe44a('0x54')]=_0x1907a4['id'];_0x175ded[_0xe44a('0x4d')][_0xe44a('0x55')]=integrations[_0xe44a('0x56')](_0x175ded[_0xe44a('0x4d')]['channel'],_0x175ded[_0xe44a('0x4d')][_0xe44a('0x57')]);_0x175ded[_0xe44a('0x4d')][_0xe44a('0x58')]=integrations[_0xe44a('0x59')](_0x175ded['body'][_0xe44a('0x5a')],_0x175ded['body'][_0xe44a('0x57')]);return db[_0xe44a('0x4f')][_0xe44a('0x4c')](_0x175ded[_0xe44a('0x4d')],{'include':[{'model':db['ZohoField'],'as':_0xe44a('0x55')},{'model':db[_0xe44a('0x5b')],'as':_0xe44a('0x58')}]});}return null;})[_0xe44a('0x1b')](respondWithResult(_0x1fc696,null))['catch'](handleError(_0x1fc696,null));};exports[_0xe44a('0x5c')]=function(_0x196a0c,_0x45f156,_0x37a26a){var _0x523439='';return db[_0xe44a('0x30')][_0xe44a('0x4e')]({'where':{'id':_0x196a0c[_0xe44a('0x4a')]['id']},'attributes':['id',_0xe44a('0x5d'),'authToken']})[_0xe44a('0x1b')](handleEntityNotFound(_0x45f156,null))[_0xe44a('0x1b')](function(_0x5a43ed){if(_0x5a43ed){_0x523439=_0x5a43ed[_0xe44a('0x5d')];var _0x427ca0=_0x523439['slice'](-0x1);if(_0x427ca0==='/'){_0x523439=_0x523439[_0xe44a('0x5e')](0x0,_0x523439[_0xe44a('0x5f')](_0x427ca0));}return rp({'method':_0xe44a('0x60'),'uri':util[_0xe44a('0x61')](_0xe44a('0x62'),_0x523439),'qs':{'authtoken':_0x5a43ed[_0xe44a('0x63')],'scope':'crmapi'},'json':!![]});}})['then'](function(_0x2c6e80){if(_0x2c6e80){if(_0x2c6e80[_0xe44a('0x64')]&&_0x2c6e80[_0xe44a('0x64')]['error']){throw new Error(_0x2c6e80[_0xe44a('0x64')]['error'][_0xe44a('0x20')]);}var _0x4db2bc=[];if(_0x2c6e80[_0xe44a('0x65')]&&_0x2c6e80[_0xe44a('0x65')][_0xe44a('0x66')]){if(_0x2c6e80[_0xe44a('0x65')][_0xe44a('0x66')]['FL']){var _0x126c01=[_0xe44a('0x67')];for(var _0x36fb18=0x0,_0x5a3a83=_0x2c6e80[_0xe44a('0x65')]['section']['FL'][_0xe44a('0x50')];_0x36fb18<_0x5a3a83;_0x36fb18++){if(_[_0xe44a('0x68')](_0x126c01,_0x2c6e80[_0xe44a('0x65')]['section']['FL'][_0x36fb18]['dv'])){_0x4db2bc[_0xe44a('0x69')]({'id':_0x2c6e80['Calls'][_0xe44a('0x66')]['FL'][_0x36fb18]['dv'],'name':_0x2c6e80[_0xe44a('0x65')]['section']['FL'][_0x36fb18]['label'],'custom':_0x2c6e80[_0xe44a('0x65')][_0xe44a('0x66')]['FL'][_0x36fb18][_0xe44a('0x6a')]===_0xe44a('0x6b')?!![]:![],'options':_0x2c6e80[_0xe44a('0x65')][_0xe44a('0x66')]['FL'][_0x36fb18][_0xe44a('0x57')]==='Pick\x20List'&&_0x2c6e80[_0xe44a('0x65')][_0xe44a('0x66')]['FL'][_0x36fb18]['val']?_['map'](_0x2c6e80[_0xe44a('0x65')][_0xe44a('0x66')]['FL'][_0x36fb18][_0xe44a('0x6c')],function(_0x1f9ccd){return{'name':_0x1f9ccd,'value':_0x1f9ccd};}):[]});}}}}return{'count':_0x4db2bc[_0xe44a('0x50')],'rows':_0x4db2bc};}})[_0xe44a('0x1b')](respondWithResult(_0x45f156,null))[_0xe44a('0x48')](function(_0x1dff57){var _0x13f8af=_0x196a0c[_0xe44a('0x32')][_0xe44a('0x6d')]?0x1f4:_0x1dff57[_0xe44a('0x6e')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x13f8af,JSON['stringify'](_0x1dff57));delete _0x1dff57['name'];if(_0x13f8af===0x191){_0x13f8af=0x190;}_0x45f156['status'](_0x13f8af)[_0xe44a('0x2e')](_0x196a0c[_0xe44a('0x32')][_0xe44a('0x6d')]?{'message':_0xe44a('0x6f'),'statusCode':_0x1dff57['statusCode']}:_0x1dff57);});};
\ No newline at end of file
index b7556af..cf754a0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6f28=['exports','int_zoho_accounts','util','api','bluebird','request-promise','../../components/integrations/configuration'];(function(_0x5bfa44,_0x76dacc){var _0x43815f=function(_0x307fca){while(--_0x307fca){_0x5bfa44['push'](_0x5bfa44['shift']());}};_0x43815f(++_0x76dacc);}(_0x6f28,0x72));var _0x86f2=function(_0x4d674b,_0x176474){_0x4d674b=_0x4d674b-0x0;var _0x535a1f=_0x6f28[_0x4d674b];return _0x535a1f;};'use strict';var _=require('lodash');var util=require(_0x86f2('0x0'));var logger=require('../../config/logger')(_0x86f2('0x1'));var moment=require('moment');var BPromise=require(_0x86f2('0x2'));var rp=require(_0x86f2('0x3'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x86f2('0x4'));module[_0x86f2('0x5')]=function(_0x27440c,_0x2ba5c3){return _0x27440c['define']('ZohoAccount',attributes,{'tableName':_0x86f2('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xcd41=['./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','lodash','util','api','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd41,0x159));var _0x1cd4=function(_0x53da9b,_0x238e08){_0x53da9b=_0x53da9b-0x0;var _0x41c46e=_0xcd41[_0x53da9b];return _0x41c46e;};'use strict';var _=require(_0x1cd4('0x0'));var util=require(_0x1cd4('0x1'));var logger=require('../../config/logger')(_0x1cd4('0x2'));var moment=require('moment');var BPromise=require(_0x1cd4('0x3'));var rp=require(_0x1cd4('0x4'));var attributes=require(_0x1cd4('0x5'));var integrations=require(_0x1cd4('0x6'));module['exports']=function(_0x693df2,_0x5c076f){return _0x693df2[_0x1cd4('0x7')](_0x1cd4('0x8'),attributes,{'tableName':_0x1cd4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index dc9b696..7f9dc5c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbfe0=['error','code','message','result','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','include','map','model','catch','find','ShowZohoAccount','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0xbfe0,0x1ed));var _0x0bfe=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0xbfe0[_0x42f009];return _0x22a1e0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0bfe('0x0'));var BPromise=require(_0x0bfe('0x1'));var rs=require(_0x0bfe('0x2'));var fs=require('fs');var Redis=require(_0x0bfe('0x3'));var db=require(_0x0bfe('0x4'))['db'];var utils=require(_0x0bfe('0x5'));var logger=require(_0x0bfe('0x6'))(_0x0bfe('0x7'));var config=require(_0x0bfe('0x8'));var jayson=require(_0x0bfe('0x9'));var client=jayson['client'][_0x0bfe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x213935,_0x812d73,_0x366459){return new BPromise(function(_0x361780,_0x4f3227){return client['request'](_0x213935,_0x366459)[_0x0bfe('0xb')](function(_0x5d986e){logger[_0x0bfe('0xc')](_0x0bfe('0xd'),_0x812d73,_0x0bfe('0xe'));logger[_0x0bfe('0xf')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x812d73,_0x0bfe('0xe'),JSON[_0x0bfe('0x10')](_0x5d986e));if(_0x5d986e[_0x0bfe('0x11')]){if(_0x5d986e['error'][_0x0bfe('0x12')]===0x1f4){logger[_0x0bfe('0x11')](_0x0bfe('0xd'),_0x812d73,_0x5d986e[_0x0bfe('0x11')][_0x0bfe('0x13')]);return _0x4f3227(_0x5d986e[_0x0bfe('0x11')][_0x0bfe('0x13')]);}logger[_0x0bfe('0x11')](_0x0bfe('0xd'),_0x812d73,_0x5d986e['error'][_0x0bfe('0x13')]);return _0x361780(_0x5d986e[_0x0bfe('0x11')][_0x0bfe('0x13')]);}else{logger[_0x0bfe('0xc')](_0x0bfe('0xd'),_0x812d73,_0x0bfe('0xe'));_0x361780(_0x5d986e[_0x0bfe('0x14')][_0x0bfe('0x13')]);}})['catch'](function(_0x33b12a){logger[_0x0bfe('0x11')](_0x0bfe('0xd'),_0x812d73,_0x33b12a);_0x4f3227(_0x33b12a);});});}exports[_0x0bfe('0x15')]=function(_0x4db956){var _0x24b6d5=this;return new Promise(function(_0x1c9c6c,_0x13dcf2){return db[_0x0bfe('0x16')][_0x0bfe('0x17')]({'raw':_0x4db956[_0x0bfe('0x18')]?_0x4db956[_0x0bfe('0x18')][_0x0bfe('0x19')]===undefined?!![]:![]:!![],'where':_0x4db956[_0x0bfe('0x18')]?_0x4db956[_0x0bfe('0x18')][_0x0bfe('0x1a')]||null:null,'attributes':_0x4db956['options']?_0x4db956[_0x0bfe('0x18')][_0x0bfe('0x1b')]||null:null,'limit':_0x4db956[_0x0bfe('0x18')]?_0x4db956[_0x0bfe('0x18')]['limit']||null:null,'include':_0x4db956[_0x0bfe('0x18')]?_0x4db956[_0x0bfe('0x18')][_0x0bfe('0x1c')]?_[_0x0bfe('0x1d')](_0x4db956[_0x0bfe('0x18')]['include'],function(_0x18d7da){return{'model':db[_0x18d7da[_0x0bfe('0x1e')]],'as':_0x18d7da['as'],'attributes':_0x18d7da[_0x0bfe('0x1b')],'include':_0x18d7da['include']?_[_0x0bfe('0x1d')](_0x18d7da[_0x0bfe('0x1c')],function(_0x4aabbe){return{'model':db[_0x4aabbe[_0x0bfe('0x1e')]],'as':_0x4aabbe['as'],'attributes':_0x4aabbe[_0x0bfe('0x1b')],'include':_0x4aabbe[_0x0bfe('0x1c')]?_[_0x0bfe('0x1d')](_0x4aabbe[_0x0bfe('0x1c')],function(_0x2010fe){return{'model':db[_0x2010fe[_0x0bfe('0x1e')]],'as':_0x2010fe['as'],'attributes':_0x2010fe['attributes']};}):[]};}):[]};}):[]:[]})[_0x0bfe('0xb')](function(_0x4f9196){logger[_0x0bfe('0xc')]('GetZohoAccount',_0x4db956);logger['debug'](_0x0bfe('0x15'),_0x4db956,JSON[_0x0bfe('0x10')](_0x4f9196));_0x1c9c6c(_0x4f9196);})[_0x0bfe('0x1f')](function(_0x59aee8){logger[_0x0bfe('0x11')](_0x0bfe('0x15'),_0x59aee8[_0x0bfe('0x13')],_0x4db956);_0x13dcf2(_0x24b6d5[_0x0bfe('0x11')](0x1f4,_0x59aee8[_0x0bfe('0x13')]));});});};exports['ShowZohoAccount']=function(_0x1da3a7){var _0x253045=this;return new Promise(function(_0x51c6da,_0x48fd6b){return db['ZohoAccount'][_0x0bfe('0x20')]({'raw':_0x1da3a7[_0x0bfe('0x18')]?_0x1da3a7[_0x0bfe('0x18')][_0x0bfe('0x19')]===undefined?!![]:![]:!![],'where':_0x1da3a7['options']?_0x1da3a7[_0x0bfe('0x18')][_0x0bfe('0x1a')]||null:null,'attributes':_0x1da3a7['options']?_0x1da3a7[_0x0bfe('0x18')][_0x0bfe('0x1b')]||null:null,'include':_0x1da3a7['options']?_0x1da3a7[_0x0bfe('0x18')]['include']?_[_0x0bfe('0x1d')](_0x1da3a7[_0x0bfe('0x18')]['include'],function(_0x56ffb4){return{'model':db[_0x56ffb4[_0x0bfe('0x1e')]],'as':_0x56ffb4['as'],'attributes':_0x56ffb4[_0x0bfe('0x1b')],'include':_0x56ffb4[_0x0bfe('0x1c')]?_[_0x0bfe('0x1d')](_0x56ffb4[_0x0bfe('0x1c')],function(_0x1d5f9a){return{'model':db[_0x1d5f9a[_0x0bfe('0x1e')]],'as':_0x1d5f9a['as'],'attributes':_0x1d5f9a[_0x0bfe('0x1b')],'include':_0x1d5f9a[_0x0bfe('0x1c')]?_[_0x0bfe('0x1d')](_0x1d5f9a[_0x0bfe('0x1c')],function(_0x4922c3){return{'model':db[_0x4922c3[_0x0bfe('0x1e')]],'as':_0x4922c3['as'],'attributes':_0x4922c3['attributes']};}):[]};}):[]};}):[]:[]})[_0x0bfe('0xb')](function(_0x19fbe9){logger[_0x0bfe('0xc')](_0x0bfe('0x21'),_0x1da3a7);logger[_0x0bfe('0xf')](_0x0bfe('0x21'),_0x1da3a7,JSON[_0x0bfe('0x10')](_0x19fbe9));_0x51c6da(_0x19fbe9);})[_0x0bfe('0x1f')](function(_0x30bf07){logger[_0x0bfe('0x11')](_0x0bfe('0x21'),_0x30bf07[_0x0bfe('0x13')],_0x1da3a7);_0x48fd6b(_0x253045[_0x0bfe('0x11')](0x1f4,_0x30bf07['message']));});});};
\ No newline at end of file
+var _0x1332=['ZohoAccount,\x20%s,\x20%s','debug','error','message','request\x20sent','result','catch','GetZohoAccount','ZohoAccount','findAll','options','where','attributes','include','model','map','stringify','find','raw','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','then','info'];(function(_0x295f69,_0x5a5088){var _0x23819a=function(_0x910aad){while(--_0x910aad){_0x295f69['push'](_0x295f69['shift']());}};_0x23819a(++_0x5a5088);}(_0x1332,0x1d4));var _0x2133=function(_0x392706,_0x29754d){_0x392706=_0x392706-0x0;var _0x227fbb=_0x1332[_0x392706];return _0x227fbb;};'use strict';var _=require(_0x2133('0x0'));var util=require(_0x2133('0x1'));var moment=require(_0x2133('0x2'));var BPromise=require(_0x2133('0x3'));var rs=require(_0x2133('0x4'));var fs=require('fs');var Redis=require(_0x2133('0x5'));var db=require(_0x2133('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2133('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2133('0x8'));var client=jayson['client'][_0x2133('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42c2cc,_0x1ddbb6,_0x2cf614){return new BPromise(function(_0x297fe8,_0x35cc72){return client['request'](_0x42c2cc,_0x2cf614)[_0x2133('0xa')](function(_0x1b93a1){logger[_0x2133('0xb')](_0x2133('0xc'),_0x1ddbb6,'request\x20sent');logger[_0x2133('0xd')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x1ddbb6,'request\x20sent',JSON['stringify'](_0x1b93a1));if(_0x1b93a1[_0x2133('0xe')]){if(_0x1b93a1['error']['code']===0x1f4){logger[_0x2133('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x1ddbb6,_0x1b93a1[_0x2133('0xe')]['message']);return _0x35cc72(_0x1b93a1['error'][_0x2133('0xf')]);}logger[_0x2133('0xe')](_0x2133('0xc'),_0x1ddbb6,_0x1b93a1['error'][_0x2133('0xf')]);return _0x297fe8(_0x1b93a1['error'][_0x2133('0xf')]);}else{logger[_0x2133('0xb')](_0x2133('0xc'),_0x1ddbb6,_0x2133('0x10'));_0x297fe8(_0x1b93a1[_0x2133('0x11')]['message']);}})[_0x2133('0x12')](function(_0x3e8c77){logger[_0x2133('0xe')](_0x2133('0xc'),_0x1ddbb6,_0x3e8c77);_0x35cc72(_0x3e8c77);});});}exports[_0x2133('0x13')]=function(_0x5264ba){var _0x31113a=this;return new Promise(function(_0x577cd2,_0x2a7727){return db[_0x2133('0x14')][_0x2133('0x15')]({'raw':_0x5264ba[_0x2133('0x16')]?_0x5264ba[_0x2133('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5264ba[_0x2133('0x16')]?_0x5264ba[_0x2133('0x16')][_0x2133('0x17')]||null:null,'attributes':_0x5264ba[_0x2133('0x16')]?_0x5264ba[_0x2133('0x16')][_0x2133('0x18')]||null:null,'limit':_0x5264ba[_0x2133('0x16')]?_0x5264ba[_0x2133('0x16')]['limit']||null:null,'include':_0x5264ba[_0x2133('0x16')]?_0x5264ba[_0x2133('0x16')][_0x2133('0x19')]?_['map'](_0x5264ba[_0x2133('0x16')][_0x2133('0x19')],function(_0x46dcb2){return{'model':db[_0x46dcb2[_0x2133('0x1a')]],'as':_0x46dcb2['as'],'attributes':_0x46dcb2[_0x2133('0x18')],'include':_0x46dcb2[_0x2133('0x19')]?_[_0x2133('0x1b')](_0x46dcb2['include'],function(_0x29a7e6){return{'model':db[_0x29a7e6['model']],'as':_0x29a7e6['as'],'attributes':_0x29a7e6['attributes'],'include':_0x29a7e6['include']?_[_0x2133('0x1b')](_0x29a7e6[_0x2133('0x19')],function(_0x3b918e){return{'model':db[_0x3b918e[_0x2133('0x1a')]],'as':_0x3b918e['as'],'attributes':_0x3b918e[_0x2133('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2133('0xa')](function(_0x259647){logger[_0x2133('0xb')]('GetZohoAccount',_0x5264ba);logger[_0x2133('0xd')](_0x2133('0x13'),_0x5264ba,JSON[_0x2133('0x1c')](_0x259647));_0x577cd2(_0x259647);})[_0x2133('0x12')](function(_0x456e51){logger[_0x2133('0xe')](_0x2133('0x13'),_0x456e51[_0x2133('0xf')],_0x5264ba);_0x2a7727(_0x31113a['error'](0x1f4,_0x456e51[_0x2133('0xf')]));});});};exports['ShowZohoAccount']=function(_0x47d546){var _0x274189=this;return new Promise(function(_0x531683,_0x2a23d9){return db[_0x2133('0x14')][_0x2133('0x1d')]({'raw':_0x47d546[_0x2133('0x16')]?_0x47d546['options'][_0x2133('0x1e')]===undefined?!![]:![]:!![],'where':_0x47d546[_0x2133('0x16')]?_0x47d546[_0x2133('0x16')][_0x2133('0x17')]||null:null,'attributes':_0x47d546[_0x2133('0x16')]?_0x47d546[_0x2133('0x16')]['attributes']||null:null,'include':_0x47d546[_0x2133('0x16')]?_0x47d546[_0x2133('0x16')][_0x2133('0x19')]?_[_0x2133('0x1b')](_0x47d546[_0x2133('0x16')]['include'],function(_0x2aae0a){return{'model':db[_0x2aae0a[_0x2133('0x1a')]],'as':_0x2aae0a['as'],'attributes':_0x2aae0a[_0x2133('0x18')],'include':_0x2aae0a['include']?_['map'](_0x2aae0a['include'],function(_0x423a6a){return{'model':db[_0x423a6a[_0x2133('0x1a')]],'as':_0x423a6a['as'],'attributes':_0x423a6a[_0x2133('0x18')],'include':_0x423a6a['include']?_[_0x2133('0x1b')](_0x423a6a['include'],function(_0x3c91a8){return{'model':db[_0x3c91a8[_0x2133('0x1a')]],'as':_0x3c91a8['as'],'attributes':_0x3c91a8['attributes']};}):[]};}):[]};}):[]:[]})[_0x2133('0xa')](function(_0x3d51ef){logger['info']('ShowZohoAccount',_0x47d546);logger[_0x2133('0xd')](_0x2133('0x1f'),_0x47d546,JSON[_0x2133('0x1c')](_0x3d51ef));_0x531683(_0x3d51ef);})[_0x2133('0x12')](function(_0xce613d){logger[_0x2133('0xe')]('ShowZohoAccount',_0xce613d['message'],_0x47d546);_0x2a23d9(_0x274189[_0x2133('0xe')](0x1f4,_0xce613d[_0x2133('0xf')]));});});};
\ No newline at end of file
index 3c6f4e6..168775e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8c1a=['isAuthenticated','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','update','delete','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x1cf748,_0x4160a2){var _0x45c034=function(_0x49cd11){while(--_0x49cd11){_0x1cf748['push'](_0x1cf748['shift']());}};_0x45c034(++_0x4160a2);}(_0x8c1a,0x1ad));var _0xa8c1=function(_0x208749,_0x2b7b66){_0x208749=_0x208749-0x0;var _0x3e0042=_0x8c1a[_0x208749];return _0x3e0042;};'use strict';var multer=require(_0xa8c1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa8c1('0x1'));var express=require(_0xa8c1('0x2'));var router=express[_0xa8c1('0x3')]();var auth=require(_0xa8c1('0x4'));var interaction=require(_0xa8c1('0x5'));var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0xa8c1('0x6')]('/',auth['isAuthenticated'](),controller[_0xa8c1('0x7')]);router[_0xa8c1('0x6')]('/:id',auth[_0xa8c1('0x8')](),controller[_0xa8c1('0x9')]);router[_0xa8c1('0x6')](_0xa8c1('0xa'),auth['isAuthenticated'](),controller['getFields']);router[_0xa8c1('0x6')](_0xa8c1('0xb'),auth[_0xa8c1('0x8')](),controller['getSubjects']);router['get'](_0xa8c1('0xc'),auth[_0xa8c1('0x8')](),controller[_0xa8c1('0xd')]);router[_0xa8c1('0xe')]('/',auth[_0xa8c1('0x8')](),controller[_0xa8c1('0xf')]);router['put']('/:id',auth[_0xa8c1('0x8')](),controller[_0xa8c1('0x10')]);router[_0xa8c1('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xa8c1('0x12')]=router;
\ No newline at end of file
+var _0xad36=['getSubjects','/:id/descriptions','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','get','/:id','getFields','/:id/subjects'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xad36,0x11c));var _0x6ad3=function(_0xe25d3f,_0x4d049d){_0xe25d3f=_0xe25d3f-0x0;var _0x52646a=_0xad36[_0xe25d3f];return _0x52646a;};'use strict';var multer=require('multer');var util=require(_0x6ad3('0x0'));var path=require(_0x6ad3('0x1'));var timeout=require(_0x6ad3('0x2'));var express=require(_0x6ad3('0x3'));var router=express[_0x6ad3('0x4')]();var auth=require(_0x6ad3('0x5'));var interaction=require(_0x6ad3('0x6'));var config=require(_0x6ad3('0x7'));var controller=require(_0x6ad3('0x8'));router['get']('/',auth[_0x6ad3('0x9')](),controller[_0x6ad3('0xa')]);router[_0x6ad3('0xb')](_0x6ad3('0xc'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/fields',auth[_0x6ad3('0x9')](),controller[_0x6ad3('0xd')]);router[_0x6ad3('0xb')](_0x6ad3('0xe'),auth[_0x6ad3('0x9')](),controller[_0x6ad3('0xf')]);router[_0x6ad3('0xb')](_0x6ad3('0x10'),auth[_0x6ad3('0x9')](),controller['getDescriptions']);router[_0x6ad3('0x11')]('/',auth[_0x6ad3('0x9')](),controller[_0x6ad3('0x12')]);router[_0x6ad3('0x13')](_0x6ad3('0xc'),auth[_0x6ad3('0x9')](),controller[_0x6ad3('0x14')]);router[_0x6ad3('0x15')]('/:id',auth[_0x6ad3('0x9')](),controller['destroy']);module[_0x6ad3('0x16')]=router;
\ No newline at end of file
index 17c6ee4..cf92698 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa7da=['STRING'];(function(_0x2c4c8,_0x78e5c9){var _0x592a8c=function(_0x2b2b67){while(--_0x2b2b67){_0x2c4c8['push'](_0x2c4c8['shift']());}};_0x592a8c(++_0x78e5c9);}(_0xa7da,0x120));var _0xaa7d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa7da[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xaa7d('0x0')]},'description':{'type':Sequelize[_0xaa7d('0x0')]}};
\ No newline at end of file
+var _0x6b43=['STRING','exports'];(function(_0x16955e,_0x4515aa){var _0x3c02de=function(_0x1d5864){while(--_0x1d5864){_0x16955e['push'](_0x16955e['shift']());}};_0x3c02de(++_0x4515aa);}(_0x6b43,0x13d));var _0x36b4=function(_0x531991,_0x3b6f62){_0x531991=_0x531991-0x0;var _0x5a4759=_0x6b43[_0x531991];return _0x5a4759;};'use strict';var Sequelize=require('sequelize');module[_0x36b4('0x0')]={'name':{'type':Sequelize[_0x36b4('0x1')]},'description':{'type':Sequelize[_0x36b4('0x1')]}};
\ No newline at end of file
index dd65217..9d58298 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc51a=['moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','name','send','index','ZohoConfiguration','rawAttributes','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type','key','VIRTUAL','field','options','include','rows','show','params','length','includeAll','find','create','body','findOne','getFields','getSubjects','ZohoField','getDescriptions','html-pdf','eml-format','zip-dir','request-promise'];(function(_0x204587,_0x3e40c2){var _0x224eb0=function(_0x116bc7){while(--_0x116bc7){_0x204587['push'](_0x204587['shift']());}};_0x224eb0(++_0x3e40c2);}(_0xc51a,0x104));var _0xac51=function(_0x4f135e,_0x384f25){_0x4f135e=_0x4f135e-0x0;var _0x3e84c7=_0xc51a[_0x4f135e];return _0x3e84c7;};'use strict';var pdf=require(_0xac51('0x0'));var emlformat=require(_0xac51('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xac51('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xac51('0x3'));var moment=require(_0xac51('0x4'));var BPromise=require(_0xac51('0x5'));var Mustache=require('mustache');var util=require(_0xac51('0x6'));var path=require('path');var sox=require(_0xac51('0x7'));var csv=require(_0xac51('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xac51('0x9'));var squel=require(_0xac51('0xa'));var crypto=require(_0xac51('0xb'));var jsforce=require(_0xac51('0xc'));var deskjs=require(_0xac51('0xd'));var toCsv=require(_0xac51('0x8'));var querystring=require(_0xac51('0xe'));var Papa=require(_0xac51('0xf'));var authService=require(_0xac51('0x10'));var hardwareService=require(_0xac51('0x11'));var Redis=require('ioredis');var qs=require(_0xac51('0x12'));var logger=require(_0xac51('0x13'))(_0xac51('0x14'));var utils=require('../../config/utils');var config=require(_0xac51('0x15'));var db=require(_0xac51('0x16'))['db'];var jayson=require(_0xac51('0x17'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x37787b,_0x74b580,_0x324ddc,_0x1807d9){return new BPromise(function(_0x368cb5,_0x5a8871){var _0x4ef85b=_0x1807d9||client;return _0x4ef85b[_0xac51('0x18')](_0x37787b,_0x324ddc)[_0xac51('0x19')](function(_0x39c264){logger[_0xac51('0x1a')](_0xac51('0x1b'),_0x74b580,'request\x20sent');logger[_0xac51('0x1c')](_0xac51('0x1d'),_0x74b580,_0xac51('0x1e'),JSON[_0xac51('0x1f')](_0x39c264));if(_0x39c264[_0xac51('0x20')]){if(_0x39c264[_0xac51('0x20')]['code']===0x1f4){logger[_0xac51('0x20')](_0xac51('0x1b'),_0x74b580,_0x39c264[_0xac51('0x20')]['message']);return _0x5a8871(_0x39c264[_0xac51('0x20')][_0xac51('0x21')]);}logger['error'](_0xac51('0x1b'),_0x74b580,_0x39c264['error'][_0xac51('0x21')]);return _0x368cb5(_0x39c264[_0xac51('0x20')][_0xac51('0x21')]);}else{logger[_0xac51('0x1a')]('ZohoConfiguration,\x20%s,\x20%s',_0x74b580,_0xac51('0x1e'));_0x368cb5(_0x39c264['result'][_0xac51('0x21')]);}})[_0xac51('0x22')](function(_0x234fac){logger[_0xac51('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x74b580,_0x234fac);_0x5a8871(_0x234fac);});});}function respondWithStatusCode(_0x1daa26,_0x319782){_0x319782=_0x319782||0xcc;return function(_0x364b48){if(_0x364b48){return _0x1daa26[_0xac51('0x23')](_0x319782);}return _0x1daa26['status'](_0x319782)[_0xac51('0x24')]();};}function respondWithResult(_0x32b68d,_0x132629){_0x132629=_0x132629||0xc8;return function(_0x56ede4){if(_0x56ede4){return _0x32b68d[_0xac51('0x25')](_0x132629)[_0xac51('0x26')](_0x56ede4);}};}function respondWithFilteredResult(_0x404803,_0x5316aa){return function(_0x3667d1){if(_0x3667d1){var _0x3a8ab4=_0x3667d1[_0xac51('0x27')],_0x44ab96=_0x5316aa[_0xac51('0x28')],_0xed1412=_0x5316aa[_0xac51('0x28')]+_0x5316aa[_0xac51('0x29')],_0x483cc8;if(_0xed1412>=_0x3a8ab4){_0xed1412=_0x3a8ab4;_0x483cc8=0xc8;}else{_0x483cc8=0xce;}_0x404803[_0xac51('0x25')](_0x483cc8);return _0x404803['set'](_0xac51('0x2a'),_0x44ab96+'-'+_0xed1412+'/'+_0x3a8ab4)[_0xac51('0x26')](_0x3667d1);}return null;};}function patchUpdates(_0x4c81d0){return function(_0x3e8332){try{jsonpatch[_0xac51('0x2b')](_0x3e8332,_0x4c81d0,!![]);}catch(_0x15e050){return BPromise[_0xac51('0x2c')](_0x15e050);}return _0x3e8332[_0xac51('0x2d')]();};}function saveUpdates(_0x3f8190,_0x24b961){return function(_0x26ab58){if(_0x26ab58){return _0x26ab58[_0xac51('0x2e')](_0x3f8190)[_0xac51('0x19')](function(_0x37f254){return _0x37f254;});}return null;};}function removeEntity(_0x91e54b,_0xabdee5){return function(_0x17a192){if(_0x17a192){return _0x17a192[_0xac51('0x2f')]()[_0xac51('0x19')](function(){_0x91e54b[_0xac51('0x25')](0xcc)[_0xac51('0x24')]();});}};}function handleEntityNotFound(_0x35a1a8,_0x6ecefc){return function(_0x32f411){if(!_0x32f411){_0x35a1a8[_0xac51('0x23')](0x194);}return _0x32f411;};}function handleError(_0x47786d,_0x3079ac){_0x3079ac=_0x3079ac||0x1f4;return function(_0x5d2e52){logger[_0xac51('0x20')](_0x5d2e52['stack']);if(_0x5d2e52[_0xac51('0x30')]){delete _0x5d2e52['name'];}_0x47786d['status'](_0x3079ac)[_0xac51('0x31')](_0x5d2e52);};}exports[_0xac51('0x32')]=function(_0x270f64,_0x185730){var _0x4038ac={},_0x443316={},_0x3d70ba={'count':0x0,'rows':[]};var _0xebfe86=db[_0xac51('0x33')][_0xac51('0x34')];_0x443316[_0xac51('0x35')]=_[_0xac51('0x36')](_0xebfe86);_0x443316[_0xac51('0x37')]=_[_0xac51('0x36')](_0x270f64[_0xac51('0x37')]);_0x443316[_0xac51('0x38')]=_['intersection'](_0x443316[_0xac51('0x35')],_0x443316['query']);_0x4038ac[_0xac51('0x39')]=_[_0xac51('0x3a')](_0x443316[_0xac51('0x35')],qs[_0xac51('0x3b')](_0x270f64[_0xac51('0x37')]['fields']));_0x4038ac[_0xac51('0x39')]=_0x4038ac[_0xac51('0x39')]['length']?_0x4038ac['attributes']:_0x443316[_0xac51('0x35')];if(!_0x270f64['query'][_0xac51('0x3c')](_0xac51('0x3d'))){_0x4038ac['limit']=qs[_0xac51('0x29')](_0x270f64[_0xac51('0x37')][_0xac51('0x29')]);_0x4038ac[_0xac51('0x28')]=qs[_0xac51('0x28')](_0x270f64[_0xac51('0x37')][_0xac51('0x28')]);}_0x4038ac[_0xac51('0x3e')]=qs[_0xac51('0x3f')](_0x270f64[_0xac51('0x37')][_0xac51('0x3f')]);_0x4038ac['where']=qs[_0xac51('0x38')](_[_0xac51('0x40')](_0x270f64[_0xac51('0x37')],_0x443316[_0xac51('0x38')]));if(_0x270f64['query'][_0xac51('0x41')]){_0x4038ac[_0xac51('0x42')]=_[_0xac51('0x43')](_0x4038ac[_0xac51('0x42')],{'$or':_[_0xac51('0x44')](_0xebfe86,function(_0xc5c493){if(_0xc5c493[_0xac51('0x45')][_0xac51('0x46')]!==_0xac51('0x47')){var _0x4b09c2={};_0x4b09c2[_0xc5c493[_0xac51('0x48')]]={'$like':'%'+_0x270f64[_0xac51('0x37')]['filter']+'%'};return _0x4b09c2;}})});}_0x4038ac=_[_0xac51('0x43')]({},_0x4038ac,_0x270f64[_0xac51('0x49')]);var _0x1beb15={'where':_0x4038ac[_0xac51('0x42')]};return db[_0xac51('0x33')][_0xac51('0x27')](_0x1beb15)[_0xac51('0x19')](function(_0xe1bef6){_0x3d70ba[_0xac51('0x27')]=_0xe1bef6;if(_0x270f64[_0xac51('0x37')]['includeAll']){_0x4038ac[_0xac51('0x4a')]=[{'all':!![]}];}return db[_0xac51('0x33')]['findAll'](_0x4038ac);})[_0xac51('0x19')](function(_0x3a74a6){_0x3d70ba[_0xac51('0x4b')]=_0x3a74a6;return _0x3d70ba;})[_0xac51('0x19')](respondWithFilteredResult(_0x185730,_0x4038ac))[_0xac51('0x22')](handleError(_0x185730,null));};exports[_0xac51('0x4c')]=function(_0x4b41e3,_0x83cb59){var _0x2755a7={'raw':![],'where':{'id':_0x4b41e3[_0xac51('0x4d')]['id']}},_0x69129d={};_0x69129d[_0xac51('0x35')]=_['keys'](db[_0xac51('0x33')][_0xac51('0x34')]);_0x69129d[_0xac51('0x37')]=_[_0xac51('0x36')](_0x4b41e3['query']);_0x69129d['filters']=_['intersection'](_0x69129d[_0xac51('0x35')],_0x69129d['query']);_0x2755a7[_0xac51('0x39')]=_[_0xac51('0x3a')](_0x69129d['model'],qs[_0xac51('0x3b')](_0x4b41e3['query'][_0xac51('0x3b')]));_0x2755a7[_0xac51('0x39')]=_0x2755a7[_0xac51('0x39')][_0xac51('0x4e')]?_0x2755a7['attributes']:_0x69129d[_0xac51('0x35')];if(_0x4b41e3['query'][_0xac51('0x4f')]){_0x2755a7['include']=[{'all':!![]}];}_0x2755a7=_['merge']({},_0x2755a7,_0x4b41e3[_0xac51('0x49')]);return db[_0xac51('0x33')][_0xac51('0x50')](_0x2755a7)[_0xac51('0x19')](handleEntityNotFound(_0x83cb59,null))[_0xac51('0x19')](respondWithResult(_0x83cb59,null))[_0xac51('0x22')](handleError(_0x83cb59,null));};exports[_0xac51('0x51')]=function(_0x304300,_0x1df405){return db[_0xac51('0x33')][_0xac51('0x51')](_0x304300[_0xac51('0x52')],{})[_0xac51('0x19')](respondWithResult(_0x1df405,0xc9))[_0xac51('0x22')](handleError(_0x1df405,null));};exports[_0xac51('0x2e')]=function(_0x568932,_0x5835f7){if(_0x568932[_0xac51('0x52')]['id']){delete _0x568932[_0xac51('0x52')]['id'];}return db[_0xac51('0x33')][_0xac51('0x50')]({'where':{'id':_0x568932[_0xac51('0x4d')]['id']}})[_0xac51('0x19')](handleEntityNotFound(_0x5835f7,null))[_0xac51('0x19')](saveUpdates(_0x568932['body'],null))[_0xac51('0x19')](respondWithResult(_0x5835f7,null))['catch'](handleError(_0x5835f7,null));};exports[_0xac51('0x2f')]=function(_0x287c96,_0x1773e2){return db[_0xac51('0x33')][_0xac51('0x50')]({'where':{'id':_0x287c96[_0xac51('0x4d')]['id']}})[_0xac51('0x19')](handleEntityNotFound(_0x1773e2,null))[_0xac51('0x19')](removeEntity(_0x1773e2,null))[_0xac51('0x22')](handleError(_0x1773e2,null));};exports['getFields']=function(_0x3809f1,_0x5a2088,_0x4a6bd4){var _0x127f34={};var _0x2ef526={};var _0x14aa7a;var _0x2296b4;return db[_0xac51('0x33')][_0xac51('0x53')]({'where':{'id':_0x3809f1[_0xac51('0x4d')]['id']}})[_0xac51('0x19')](handleEntityNotFound(_0x5a2088,null))['then'](function(_0x39f7ab){if(_0x39f7ab){_0x14aa7a=_0x39f7ab;_0x2ef526['model']=_[_0xac51('0x36')](db['ZohoField']['rawAttributes']);_0x2ef526[_0xac51('0x37')]=_[_0xac51('0x36')](_0x3809f1['query']);_0x2ef526['filters']=_[_0xac51('0x3a')](_0x2ef526[_0xac51('0x35')],_0x2ef526['query']);_0x127f34['attributes']=_['intersection'](_0x2ef526[_0xac51('0x35')],qs[_0xac51('0x3b')](_0x3809f1[_0xac51('0x37')][_0xac51('0x3b')]));_0x127f34['attributes']=_0x127f34['attributes'][_0xac51('0x4e')]?_0x127f34[_0xac51('0x39')]:_0x2ef526[_0xac51('0x35')];_0x127f34['order']=qs[_0xac51('0x3f')](_0x3809f1[_0xac51('0x37')]['sort']);_0x127f34[_0xac51('0x42')]=qs[_0xac51('0x38')](_[_0xac51('0x40')](_0x3809f1[_0xac51('0x37')],_0x2ef526[_0xac51('0x38')]));if(_0x3809f1[_0xac51('0x37')][_0xac51('0x41')]){_0x127f34[_0xac51('0x42')]=_['merge'](_0x127f34['where'],{'$or':_[_0xac51('0x44')](_0x127f34[_0xac51('0x39')],function(_0x12d541){var _0x4ba8d2={};_0x4ba8d2[_0x12d541]={'$like':'%'+_0x3809f1[_0xac51('0x37')][_0xac51('0x41')]+'%'};return _0x4ba8d2;})});}_0x127f34=_[_0xac51('0x43')]({},_0x127f34,_0x3809f1[_0xac51('0x49')]);return _0x14aa7a[_0xac51('0x54')](_0x127f34);}})['then'](function(_0x20611a){if(_0x20611a){_0x2296b4=_0x20611a[_0xac51('0x4e')];if(!_0x3809f1[_0xac51('0x37')]['hasOwnProperty']('nolimit')){_0x127f34['limit']=qs[_0xac51('0x29')](_0x3809f1[_0xac51('0x37')]['limit']);_0x127f34['offset']=qs[_0xac51('0x28')](_0x3809f1[_0xac51('0x37')][_0xac51('0x28')]);}return _0x14aa7a[_0xac51('0x54')](_0x127f34);}})[_0xac51('0x19')](function(_0x5de660){if(_0x5de660){return _0x5de660?{'count':_0x2296b4,'rows':_0x5de660}:null;}})[_0xac51('0x19')](respondWithResult(_0x5a2088,null))['catch'](handleError(_0x5a2088,null));};exports[_0xac51('0x55')]=function(_0x493b64,_0x44ad24,_0xa8a45e){var _0x2b7c54={};var _0x4e7779={};var _0x542482;var _0x3a2aa7;return db[_0xac51('0x33')]['findOne']({'where':{'id':_0x493b64['params']['id']}})[_0xac51('0x19')](handleEntityNotFound(_0x44ad24,null))[_0xac51('0x19')](function(_0x26be08){if(_0x26be08){_0x542482=_0x26be08;_0x4e7779[_0xac51('0x35')]=_['keys'](db[_0xac51('0x56')]['rawAttributes']);_0x4e7779[_0xac51('0x37')]=_[_0xac51('0x36')](_0x493b64['query']);_0x4e7779[_0xac51('0x38')]=_['intersection'](_0x4e7779['model'],_0x4e7779[_0xac51('0x37')]);_0x2b7c54[_0xac51('0x39')]=_['intersection'](_0x4e7779[_0xac51('0x35')],qs[_0xac51('0x3b')](_0x493b64[_0xac51('0x37')][_0xac51('0x3b')]));_0x2b7c54[_0xac51('0x39')]=_0x2b7c54['attributes'][_0xac51('0x4e')]?_0x2b7c54[_0xac51('0x39')]:_0x4e7779[_0xac51('0x35')];_0x2b7c54[_0xac51('0x3e')]=qs[_0xac51('0x3f')](_0x493b64['query']['sort']);_0x2b7c54[_0xac51('0x42')]=qs[_0xac51('0x38')](_['pick'](_0x493b64[_0xac51('0x37')],_0x4e7779[_0xac51('0x38')]));if(_0x493b64[_0xac51('0x37')]['filter']){_0x2b7c54[_0xac51('0x42')]=_[_0xac51('0x43')](_0x2b7c54['where'],{'$or':_['map'](_0x2b7c54[_0xac51('0x39')],function(_0x3fd40d){var _0x1ab26a={};_0x1ab26a[_0x3fd40d]={'$like':'%'+_0x493b64[_0xac51('0x37')]['filter']+'%'};return _0x1ab26a;})});}_0x2b7c54=_[_0xac51('0x43')]({},_0x2b7c54,_0x493b64[_0xac51('0x49')]);return _0x542482[_0xac51('0x55')](_0x2b7c54);}})[_0xac51('0x19')](function(_0xdaaeda){if(_0xdaaeda){_0x3a2aa7=_0xdaaeda[_0xac51('0x4e')];if(!_0x493b64['query'][_0xac51('0x3c')](_0xac51('0x3d'))){_0x2b7c54[_0xac51('0x29')]=qs[_0xac51('0x29')](_0x493b64[_0xac51('0x37')]['limit']);_0x2b7c54['offset']=qs['offset'](_0x493b64['query'][_0xac51('0x28')]);}return _0x542482[_0xac51('0x55')](_0x2b7c54);}})['then'](function(_0x21ec83){if(_0x21ec83){return _0x21ec83?{'count':_0x3a2aa7,'rows':_0x21ec83}:null;}})[_0xac51('0x19')](respondWithResult(_0x44ad24,null))[_0xac51('0x22')](handleError(_0x44ad24,null));};exports['getDescriptions']=function(_0x2191e0,_0x2e0d3d,_0x478144){var _0x384f2d={};var _0x28dc3b={};var _0x502a4f;var _0x111cb5;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x2191e0[_0xac51('0x4d')]['id']}})[_0xac51('0x19')](handleEntityNotFound(_0x2e0d3d,null))['then'](function(_0x37c83c){if(_0x37c83c){_0x502a4f=_0x37c83c;_0x28dc3b[_0xac51('0x35')]=_[_0xac51('0x36')](db[_0xac51('0x56')][_0xac51('0x34')]);_0x28dc3b[_0xac51('0x37')]=_[_0xac51('0x36')](_0x2191e0[_0xac51('0x37')]);_0x28dc3b[_0xac51('0x38')]=_[_0xac51('0x3a')](_0x28dc3b[_0xac51('0x35')],_0x28dc3b[_0xac51('0x37')]);_0x384f2d[_0xac51('0x39')]=_['intersection'](_0x28dc3b[_0xac51('0x35')],qs[_0xac51('0x3b')](_0x2191e0[_0xac51('0x37')][_0xac51('0x3b')]));_0x384f2d[_0xac51('0x39')]=_0x384f2d['attributes'][_0xac51('0x4e')]?_0x384f2d[_0xac51('0x39')]:_0x28dc3b[_0xac51('0x35')];_0x384f2d[_0xac51('0x3e')]=qs[_0xac51('0x3f')](_0x2191e0[_0xac51('0x37')]['sort']);_0x384f2d[_0xac51('0x42')]=qs[_0xac51('0x38')](_[_0xac51('0x40')](_0x2191e0[_0xac51('0x37')],_0x28dc3b['filters']));if(_0x2191e0['query'][_0xac51('0x41')]){_0x384f2d[_0xac51('0x42')]=_[_0xac51('0x43')](_0x384f2d['where'],{'$or':_[_0xac51('0x44')](_0x384f2d[_0xac51('0x39')],function(_0x5b791e){var _0x598582={};_0x598582[_0x5b791e]={'$like':'%'+_0x2191e0[_0xac51('0x37')][_0xac51('0x41')]+'%'};return _0x598582;})});}_0x384f2d=_[_0xac51('0x43')]({},_0x384f2d,_0x2191e0['options']);return _0x502a4f[_0xac51('0x57')](_0x384f2d);}})['then'](function(_0x4ee783){if(_0x4ee783){_0x111cb5=_0x4ee783[_0xac51('0x4e')];if(!_0x2191e0[_0xac51('0x37')][_0xac51('0x3c')](_0xac51('0x3d'))){_0x384f2d[_0xac51('0x29')]=qs[_0xac51('0x29')](_0x2191e0[_0xac51('0x37')][_0xac51('0x29')]);_0x384f2d[_0xac51('0x28')]=qs['offset'](_0x2191e0['query'][_0xac51('0x28')]);}return _0x502a4f['getDescriptions'](_0x384f2d);}})[_0xac51('0x19')](function(_0x2c23f7){if(_0x2c23f7){return _0x2c23f7?{'count':_0x111cb5,'rows':_0x2c23f7}:null;}})[_0xac51('0x19')](respondWithResult(_0x2e0d3d,null))[_0xac51('0x22')](handleError(_0x2e0d3d,null));};
\ No newline at end of file
+var _0xffec=['../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','client','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','status','end','json','count','offset','limit','set','apply','save','update','destroy','then','sendStatus','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','type','field','options','ZohoConfiguration','includeAll','include','rows','show','params','length','create','body','find','getFields','findOne','ZohoField','filter','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','querystring'];(function(_0x5213d3,_0x457833){var _0x3eb033=function(_0x32b684){while(--_0x32b684){_0x5213d3['push'](_0x5213d3['shift']());}};_0x3eb033(++_0x457833);}(_0xffec,0x142));var _0xcffe=function(_0x1d1606,_0x41439f){_0x1d1606=_0x1d1606-0x0;var _0x2edc95=_0xffec[_0x1d1606];return _0x2edc95;};'use strict';var pdf=require(_0xcffe('0x0'));var emlformat=require(_0xcffe('0x1'));var rimraf=require(_0xcffe('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcffe('0x3'));var moment=require('moment');var BPromise=require(_0xcffe('0x4'));var Mustache=require(_0xcffe('0x5'));var util=require(_0xcffe('0x6'));var path=require(_0xcffe('0x7'));var sox=require(_0xcffe('0x8'));var csv=require('to-csv');var ejs=require(_0xcffe('0x9'));var fs=require('fs');var _=require(_0xcffe('0xa'));var squel=require('squel');var crypto=require(_0xcffe('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xcffe('0xc'));var toCsv=require('to-csv');var querystring=require(_0xcffe('0xd'));var Papa=require('papaparse');var authService=require(_0xcffe('0xe'));var hardwareService=require(_0xcffe('0xf'));var Redis=require(_0xcffe('0x10'));var qs=require(_0xcffe('0x11'));var logger=require(_0xcffe('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xcffe('0x13'));var db=require(_0xcffe('0x14'))['db'];var jayson=require(_0xcffe('0x15'));var client=jayson[_0xcffe('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54a122,_0xec9fdc,_0xf67447,_0xe951ed){return new BPromise(function(_0x1010be,_0x864000){var _0x1b348a=_0xe951ed||client;return _0x1b348a['request'](_0x54a122,_0xf67447)['then'](function(_0xd74aae){logger['info'](_0xcffe('0x17'),_0xec9fdc,_0xcffe('0x18'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0xec9fdc,_0xcffe('0x18'),JSON[_0xcffe('0x19')](_0xd74aae));if(_0xd74aae[_0xcffe('0x1a')]){if(_0xd74aae[_0xcffe('0x1a')][_0xcffe('0x1b')]===0x1f4){logger[_0xcffe('0x1a')](_0xcffe('0x17'),_0xec9fdc,_0xd74aae[_0xcffe('0x1a')][_0xcffe('0x1c')]);return _0x864000(_0xd74aae['error'][_0xcffe('0x1c')]);}logger['error'](_0xcffe('0x17'),_0xec9fdc,_0xd74aae['error'][_0xcffe('0x1c')]);return _0x1010be(_0xd74aae[_0xcffe('0x1a')]['message']);}else{logger[_0xcffe('0x1d')](_0xcffe('0x17'),_0xec9fdc,'request\x20sent');_0x1010be(_0xd74aae[_0xcffe('0x1e')]['message']);}})[_0xcffe('0x1f')](function(_0x5bcc63){logger[_0xcffe('0x1a')](_0xcffe('0x17'),_0xec9fdc,_0x5bcc63);_0x864000(_0x5bcc63);});});}function respondWithStatusCode(_0x66ebfe,_0x1dfe9a){_0x1dfe9a=_0x1dfe9a||0xcc;return function(_0x4276a1){if(_0x4276a1){return _0x66ebfe['sendStatus'](_0x1dfe9a);}return _0x66ebfe[_0xcffe('0x20')](_0x1dfe9a)[_0xcffe('0x21')]();};}function respondWithResult(_0x484b53,_0x19615e){_0x19615e=_0x19615e||0xc8;return function(_0x29fea2){if(_0x29fea2){return _0x484b53['status'](_0x19615e)[_0xcffe('0x22')](_0x29fea2);}};}function respondWithFilteredResult(_0x349de4,_0x2e76a4){return function(_0x21bd5a){if(_0x21bd5a){var _0x2d91ef=_0x21bd5a[_0xcffe('0x23')],_0x50df0b=_0x2e76a4[_0xcffe('0x24')],_0x295573=_0x2e76a4[_0xcffe('0x24')]+_0x2e76a4[_0xcffe('0x25')],_0x3b7131;if(_0x295573>=_0x2d91ef){_0x295573=_0x2d91ef;_0x3b7131=0xc8;}else{_0x3b7131=0xce;}_0x349de4[_0xcffe('0x20')](_0x3b7131);return _0x349de4[_0xcffe('0x26')]('Content-Range',_0x50df0b+'-'+_0x295573+'/'+_0x2d91ef)[_0xcffe('0x22')](_0x21bd5a);}return null;};}function patchUpdates(_0x475b1a){return function(_0x241552){try{jsonpatch[_0xcffe('0x27')](_0x241552,_0x475b1a,!![]);}catch(_0x5d051f){return BPromise['reject'](_0x5d051f);}return _0x241552[_0xcffe('0x28')]();};}function saveUpdates(_0x2d9eea,_0x80ebdf){return function(_0x4c2a9b){if(_0x4c2a9b){return _0x4c2a9b[_0xcffe('0x29')](_0x2d9eea)['then'](function(_0x3be8b2){return _0x3be8b2;});}return null;};}function removeEntity(_0x4d1975,_0x5dd0cd){return function(_0x1cc696){if(_0x1cc696){return _0x1cc696[_0xcffe('0x2a')]()[_0xcffe('0x2b')](function(){_0x4d1975['status'](0xcc)[_0xcffe('0x21')]();});}};}function handleEntityNotFound(_0x1df422,_0x1e1b10){return function(_0x4146e9){if(!_0x4146e9){_0x1df422[_0xcffe('0x2c')](0x194);}return _0x4146e9;};}function handleError(_0x2a4c82,_0x5bee23){_0x5bee23=_0x5bee23||0x1f4;return function(_0x3b0c52){logger[_0xcffe('0x1a')](_0x3b0c52[_0xcffe('0x2d')]);if(_0x3b0c52['name']){delete _0x3b0c52[_0xcffe('0x2e')];}_0x2a4c82[_0xcffe('0x20')](_0x5bee23)[_0xcffe('0x2f')](_0x3b0c52);};}exports[_0xcffe('0x30')]=function(_0x4a17fd,_0x290aa6){var _0x45119e={},_0x493b06={},_0x2c5833={'count':0x0,'rows':[]};var _0x57640a=db['ZohoConfiguration'][_0xcffe('0x31')];_0x493b06[_0xcffe('0x32')]=_[_0xcffe('0x33')](_0x57640a);_0x493b06[_0xcffe('0x34')]=_[_0xcffe('0x33')](_0x4a17fd[_0xcffe('0x34')]);_0x493b06[_0xcffe('0x35')]=_[_0xcffe('0x36')](_0x493b06[_0xcffe('0x32')],_0x493b06[_0xcffe('0x34')]);_0x45119e[_0xcffe('0x37')]=_[_0xcffe('0x36')](_0x493b06['model'],qs[_0xcffe('0x38')](_0x4a17fd[_0xcffe('0x34')][_0xcffe('0x38')]));_0x45119e[_0xcffe('0x37')]=_0x45119e['attributes']['length']?_0x45119e[_0xcffe('0x37')]:_0x493b06[_0xcffe('0x32')];if(!_0x4a17fd[_0xcffe('0x34')][_0xcffe('0x39')](_0xcffe('0x3a'))){_0x45119e['limit']=qs['limit'](_0x4a17fd[_0xcffe('0x34')]['limit']);_0x45119e[_0xcffe('0x24')]=qs[_0xcffe('0x24')](_0x4a17fd[_0xcffe('0x34')][_0xcffe('0x24')]);}_0x45119e[_0xcffe('0x3b')]=qs['sort'](_0x4a17fd[_0xcffe('0x34')][_0xcffe('0x3c')]);_0x45119e['where']=qs['filters'](_[_0xcffe('0x3d')](_0x4a17fd[_0xcffe('0x34')],_0x493b06[_0xcffe('0x35')]));if(_0x4a17fd[_0xcffe('0x34')]['filter']){_0x45119e[_0xcffe('0x3e')]=_[_0xcffe('0x3f')](_0x45119e[_0xcffe('0x3e')],{'$or':_[_0xcffe('0x40')](_0x57640a,function(_0x348d42){if(_0x348d42[_0xcffe('0x41')]['key']!=='VIRTUAL'){var _0x203ff1={};_0x203ff1[_0x348d42[_0xcffe('0x42')]]={'$like':'%'+_0x4a17fd[_0xcffe('0x34')]['filter']+'%'};return _0x203ff1;}})});}_0x45119e=_[_0xcffe('0x3f')]({},_0x45119e,_0x4a17fd[_0xcffe('0x43')]);var _0x459814={'where':_0x45119e[_0xcffe('0x3e')]};return db[_0xcffe('0x44')]['count'](_0x459814)['then'](function(_0x39d428){_0x2c5833['count']=_0x39d428;if(_0x4a17fd[_0xcffe('0x34')][_0xcffe('0x45')]){_0x45119e[_0xcffe('0x46')]=[{'all':!![]}];}return db[_0xcffe('0x44')]['findAll'](_0x45119e);})['then'](function(_0x1f8239){_0x2c5833[_0xcffe('0x47')]=_0x1f8239;return _0x2c5833;})[_0xcffe('0x2b')](respondWithFilteredResult(_0x290aa6,_0x45119e))[_0xcffe('0x1f')](handleError(_0x290aa6,null));};exports[_0xcffe('0x48')]=function(_0x1b039c,_0x24ad7a){var _0x446a7d={'raw':![],'where':{'id':_0x1b039c[_0xcffe('0x49')]['id']}},_0x319b48={};_0x319b48[_0xcffe('0x32')]=_['keys'](db[_0xcffe('0x44')][_0xcffe('0x31')]);_0x319b48[_0xcffe('0x34')]=_[_0xcffe('0x33')](_0x1b039c[_0xcffe('0x34')]);_0x319b48['filters']=_['intersection'](_0x319b48[_0xcffe('0x32')],_0x319b48[_0xcffe('0x34')]);_0x446a7d['attributes']=_['intersection'](_0x319b48[_0xcffe('0x32')],qs[_0xcffe('0x38')](_0x1b039c[_0xcffe('0x34')][_0xcffe('0x38')]));_0x446a7d[_0xcffe('0x37')]=_0x446a7d[_0xcffe('0x37')][_0xcffe('0x4a')]?_0x446a7d[_0xcffe('0x37')]:_0x319b48['model'];if(_0x1b039c[_0xcffe('0x34')]['includeAll']){_0x446a7d['include']=[{'all':!![]}];}_0x446a7d=_[_0xcffe('0x3f')]({},_0x446a7d,_0x1b039c[_0xcffe('0x43')]);return db[_0xcffe('0x44')]['find'](_0x446a7d)[_0xcffe('0x2b')](handleEntityNotFound(_0x24ad7a,null))[_0xcffe('0x2b')](respondWithResult(_0x24ad7a,null))[_0xcffe('0x1f')](handleError(_0x24ad7a,null));};exports[_0xcffe('0x4b')]=function(_0x1b83f2,_0x314814){return db[_0xcffe('0x44')]['create'](_0x1b83f2[_0xcffe('0x4c')],{})[_0xcffe('0x2b')](respondWithResult(_0x314814,0xc9))[_0xcffe('0x1f')](handleError(_0x314814,null));};exports[_0xcffe('0x29')]=function(_0x52a8c4,_0x52a926){if(_0x52a8c4[_0xcffe('0x4c')]['id']){delete _0x52a8c4[_0xcffe('0x4c')]['id'];}return db[_0xcffe('0x44')][_0xcffe('0x4d')]({'where':{'id':_0x52a8c4['params']['id']}})[_0xcffe('0x2b')](handleEntityNotFound(_0x52a926,null))['then'](saveUpdates(_0x52a8c4[_0xcffe('0x4c')],null))[_0xcffe('0x2b')](respondWithResult(_0x52a926,null))['catch'](handleError(_0x52a926,null));};exports[_0xcffe('0x2a')]=function(_0xd07572,_0x1869d3){return db[_0xcffe('0x44')][_0xcffe('0x4d')]({'where':{'id':_0xd07572['params']['id']}})[_0xcffe('0x2b')](handleEntityNotFound(_0x1869d3,null))[_0xcffe('0x2b')](removeEntity(_0x1869d3,null))['catch'](handleError(_0x1869d3,null));};exports[_0xcffe('0x4e')]=function(_0x2d3b86,_0x556d8c,_0x57697e){var _0x462f59={};var _0x4a68a3={};var _0x5c239c;var _0x900745;return db[_0xcffe('0x44')][_0xcffe('0x4f')]({'where':{'id':_0x2d3b86[_0xcffe('0x49')]['id']}})[_0xcffe('0x2b')](handleEntityNotFound(_0x556d8c,null))['then'](function(_0x349e85){if(_0x349e85){_0x5c239c=_0x349e85;_0x4a68a3[_0xcffe('0x32')]=_[_0xcffe('0x33')](db[_0xcffe('0x50')]['rawAttributes']);_0x4a68a3[_0xcffe('0x34')]=_[_0xcffe('0x33')](_0x2d3b86['query']);_0x4a68a3[_0xcffe('0x35')]=_[_0xcffe('0x36')](_0x4a68a3[_0xcffe('0x32')],_0x4a68a3[_0xcffe('0x34')]);_0x462f59[_0xcffe('0x37')]=_[_0xcffe('0x36')](_0x4a68a3['model'],qs['fields'](_0x2d3b86[_0xcffe('0x34')][_0xcffe('0x38')]));_0x462f59['attributes']=_0x462f59[_0xcffe('0x37')]['length']?_0x462f59[_0xcffe('0x37')]:_0x4a68a3[_0xcffe('0x32')];_0x462f59[_0xcffe('0x3b')]=qs[_0xcffe('0x3c')](_0x2d3b86[_0xcffe('0x34')]['sort']);_0x462f59[_0xcffe('0x3e')]=qs[_0xcffe('0x35')](_[_0xcffe('0x3d')](_0x2d3b86[_0xcffe('0x34')],_0x4a68a3[_0xcffe('0x35')]));if(_0x2d3b86[_0xcffe('0x34')][_0xcffe('0x51')]){_0x462f59[_0xcffe('0x3e')]=_[_0xcffe('0x3f')](_0x462f59[_0xcffe('0x3e')],{'$or':_['map'](_0x462f59['attributes'],function(_0x297f43){var _0x84d02d={};_0x84d02d[_0x297f43]={'$like':'%'+_0x2d3b86['query'][_0xcffe('0x51')]+'%'};return _0x84d02d;})});}_0x462f59=_[_0xcffe('0x3f')]({},_0x462f59,_0x2d3b86[_0xcffe('0x43')]);return _0x5c239c[_0xcffe('0x4e')](_0x462f59);}})[_0xcffe('0x2b')](function(_0x527f16){if(_0x527f16){_0x900745=_0x527f16['length'];if(!_0x2d3b86[_0xcffe('0x34')][_0xcffe('0x39')]('nolimit')){_0x462f59[_0xcffe('0x25')]=qs[_0xcffe('0x25')](_0x2d3b86[_0xcffe('0x34')][_0xcffe('0x25')]);_0x462f59[_0xcffe('0x24')]=qs[_0xcffe('0x24')](_0x2d3b86['query'][_0xcffe('0x24')]);}return _0x5c239c['getFields'](_0x462f59);}})[_0xcffe('0x2b')](function(_0x144d95){if(_0x144d95){return _0x144d95?{'count':_0x900745,'rows':_0x144d95}:null;}})[_0xcffe('0x2b')](respondWithResult(_0x556d8c,null))[_0xcffe('0x1f')](handleError(_0x556d8c,null));};exports[_0xcffe('0x52')]=function(_0x381576,_0x449e06,_0x564b26){var _0x588a44={};var _0x2e8a36={};var _0x3b9183;var _0x4e366c;return db['ZohoConfiguration'][_0xcffe('0x4f')]({'where':{'id':_0x381576[_0xcffe('0x49')]['id']}})[_0xcffe('0x2b')](handleEntityNotFound(_0x449e06,null))[_0xcffe('0x2b')](function(_0x5f37b7){if(_0x5f37b7){_0x3b9183=_0x5f37b7;_0x2e8a36['model']=_[_0xcffe('0x33')](db[_0xcffe('0x50')]['rawAttributes']);_0x2e8a36[_0xcffe('0x34')]=_[_0xcffe('0x33')](_0x381576[_0xcffe('0x34')]);_0x2e8a36[_0xcffe('0x35')]=_[_0xcffe('0x36')](_0x2e8a36['model'],_0x2e8a36[_0xcffe('0x34')]);_0x588a44[_0xcffe('0x37')]=_['intersection'](_0x2e8a36[_0xcffe('0x32')],qs[_0xcffe('0x38')](_0x381576[_0xcffe('0x34')]['fields']));_0x588a44[_0xcffe('0x37')]=_0x588a44[_0xcffe('0x37')][_0xcffe('0x4a')]?_0x588a44['attributes']:_0x2e8a36[_0xcffe('0x32')];_0x588a44[_0xcffe('0x3b')]=qs[_0xcffe('0x3c')](_0x381576[_0xcffe('0x34')]['sort']);_0x588a44[_0xcffe('0x3e')]=qs[_0xcffe('0x35')](_['pick'](_0x381576[_0xcffe('0x34')],_0x2e8a36[_0xcffe('0x35')]));if(_0x381576[_0xcffe('0x34')][_0xcffe('0x51')]){_0x588a44[_0xcffe('0x3e')]=_[_0xcffe('0x3f')](_0x588a44[_0xcffe('0x3e')],{'$or':_['map'](_0x588a44[_0xcffe('0x37')],function(_0x826d19){var _0x36e869={};_0x36e869[_0x826d19]={'$like':'%'+_0x381576['query'][_0xcffe('0x51')]+'%'};return _0x36e869;})});}_0x588a44=_[_0xcffe('0x3f')]({},_0x588a44,_0x381576[_0xcffe('0x43')]);return _0x3b9183[_0xcffe('0x52')](_0x588a44);}})['then'](function(_0x31cefd){if(_0x31cefd){_0x4e366c=_0x31cefd['length'];if(!_0x381576[_0xcffe('0x34')]['hasOwnProperty'](_0xcffe('0x3a'))){_0x588a44[_0xcffe('0x25')]=qs[_0xcffe('0x25')](_0x381576['query'][_0xcffe('0x25')]);_0x588a44[_0xcffe('0x24')]=qs['offset'](_0x381576[_0xcffe('0x34')][_0xcffe('0x24')]);}return _0x3b9183[_0xcffe('0x52')](_0x588a44);}})[_0xcffe('0x2b')](function(_0x186f8b){if(_0x186f8b){return _0x186f8b?{'count':_0x4e366c,'rows':_0x186f8b}:null;}})[_0xcffe('0x2b')](respondWithResult(_0x449e06,null))['catch'](handleError(_0x449e06,null));};exports['getDescriptions']=function(_0x1ea290,_0x2c3199,_0x54ee3d){var _0xfbc732={};var _0x51b968={};var _0x453769;var _0x1f2dbc;return db[_0xcffe('0x44')][_0xcffe('0x4f')]({'where':{'id':_0x1ea290[_0xcffe('0x49')]['id']}})[_0xcffe('0x2b')](handleEntityNotFound(_0x2c3199,null))[_0xcffe('0x2b')](function(_0x24e2de){if(_0x24e2de){_0x453769=_0x24e2de;_0x51b968[_0xcffe('0x32')]=_[_0xcffe('0x33')](db[_0xcffe('0x50')][_0xcffe('0x31')]);_0x51b968[_0xcffe('0x34')]=_[_0xcffe('0x33')](_0x1ea290[_0xcffe('0x34')]);_0x51b968[_0xcffe('0x35')]=_[_0xcffe('0x36')](_0x51b968[_0xcffe('0x32')],_0x51b968[_0xcffe('0x34')]);_0xfbc732[_0xcffe('0x37')]=_['intersection'](_0x51b968['model'],qs['fields'](_0x1ea290[_0xcffe('0x34')][_0xcffe('0x38')]));_0xfbc732[_0xcffe('0x37')]=_0xfbc732[_0xcffe('0x37')]['length']?_0xfbc732[_0xcffe('0x37')]:_0x51b968[_0xcffe('0x32')];_0xfbc732[_0xcffe('0x3b')]=qs[_0xcffe('0x3c')](_0x1ea290['query'][_0xcffe('0x3c')]);_0xfbc732['where']=qs['filters'](_[_0xcffe('0x3d')](_0x1ea290[_0xcffe('0x34')],_0x51b968[_0xcffe('0x35')]));if(_0x1ea290[_0xcffe('0x34')]['filter']){_0xfbc732[_0xcffe('0x3e')]=_['merge'](_0xfbc732[_0xcffe('0x3e')],{'$or':_[_0xcffe('0x40')](_0xfbc732[_0xcffe('0x37')],function(_0x48c165){var _0x3645a4={};_0x3645a4[_0x48c165]={'$like':'%'+_0x1ea290[_0xcffe('0x34')][_0xcffe('0x51')]+'%'};return _0x3645a4;})});}_0xfbc732=_[_0xcffe('0x3f')]({},_0xfbc732,_0x1ea290['options']);return _0x453769['getDescriptions'](_0xfbc732);}})['then'](function(_0x49621c){if(_0x49621c){_0x1f2dbc=_0x49621c[_0xcffe('0x4a')];if(!_0x1ea290['query'][_0xcffe('0x39')]('nolimit')){_0xfbc732[_0xcffe('0x25')]=qs[_0xcffe('0x25')](_0x1ea290[_0xcffe('0x34')][_0xcffe('0x25')]);_0xfbc732[_0xcffe('0x24')]=qs[_0xcffe('0x24')](_0x1ea290[_0xcffe('0x34')][_0xcffe('0x24')]);}return _0x453769[_0xcffe('0x53')](_0xfbc732);}})[_0xcffe('0x2b')](function(_0x10bfb5){if(_0x10bfb5){return _0x10bfb5?{'count':_0x1f2dbc,'rows':_0x10bfb5}:null;}})[_0xcffe('0x2b')](respondWithResult(_0x2c3199,null))[_0xcffe('0x1f')](handleError(_0x2c3199,null));};
\ No newline at end of file
index 3b4e592..280b0ed 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xce9b=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','./intZohoConfiguration.attributes','define','ZohoConfiguration','int_zoho_configurations'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xce9b,0xc6));var _0xbce9=function(_0x9d421,_0x21275d){_0x9d421=_0x9d421-0x0;var _0x152bc1=_0xce9b[_0x9d421];return _0x152bc1;};'use strict';var _=require(_0xbce9('0x0'));var util=require(_0xbce9('0x1'));var logger=require(_0xbce9('0x2'))(_0xbce9('0x3'));var moment=require(_0xbce9('0x4'));var BPromise=require(_0xbce9('0x5'));var rp=require(_0xbce9('0x6'));var attributes=require(_0xbce9('0x7'));module['exports']=function(_0x2461ee,_0x302861){return _0x2461ee[_0xbce9('0x8')](_0xbce9('0x9'),attributes,{'tableName':_0xbce9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x9b9b=['request-promise','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','util','moment','bluebird'];(function(_0x2212d1,_0x483fc8){var _0x15eec5=function(_0x15e6ac){while(--_0x15e6ac){_0x2212d1['push'](_0x2212d1['shift']());}};_0x15eec5(++_0x483fc8);}(_0x9b9b,0x114));var _0xb9b9=function(_0xddf2eb,_0x4bc8ab){_0xddf2eb=_0xddf2eb-0x0;var _0x39948f=_0x9b9b[_0xddf2eb];return _0x39948f;};'use strict';var _=require('lodash');var util=require(_0xb9b9('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb9b9('0x1'));var BPromise=require(_0xb9b9('0x2'));var rp=require(_0xb9b9('0x3'));var attributes=require(_0xb9b9('0x4'));module[_0xb9b9('0x5')]=function(_0x43c8ff,_0x23b016){return _0x43c8ff[_0xb9b9('0x6')](_0xb9b9('0x7'),attributes,{'tableName':_0xb9b9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index bfa5ba8..1477a0f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdd3a=['error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5773ed,_0x2270ce){var _0x4a75d9=function(_0x31a9a3){while(--_0x31a9a3){_0x5773ed['push'](_0x5773ed['shift']());}};_0x4a75d9(++_0x2270ce);}(_0xdd3a,0x13d));var _0xadd3=function(_0x3e5f37,_0x38b152){_0x3e5f37=_0x3e5f37-0x0;var _0x1cf477=_0xdd3a[_0x3e5f37];return _0x1cf477;};'use strict';var _=require(_0xadd3('0x0'));var util=require(_0xadd3('0x1'));var moment=require(_0xadd3('0x2'));var BPromise=require(_0xadd3('0x3'));var rs=require(_0xadd3('0x4'));var fs=require('fs');var Redis=require(_0xadd3('0x5'));var db=require(_0xadd3('0x6'))['db'];var utils=require(_0xadd3('0x7'));var logger=require(_0xadd3('0x8'))(_0xadd3('0x9'));var config=require(_0xadd3('0xa'));var jayson=require(_0xadd3('0xb'));var client=jayson[_0xadd3('0xc')][_0xadd3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x446eab,_0xc855b0,_0x34e35c){return new BPromise(function(_0x6508bb,_0x728499){return client[_0xadd3('0xe')](_0x446eab,_0x34e35c)['then'](function(_0x40e7c1){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0xc855b0,_0xadd3('0xf'));logger[_0xadd3('0x10')](_0xadd3('0x11'),_0xc855b0,_0xadd3('0xf'),JSON[_0xadd3('0x12')](_0x40e7c1));if(_0x40e7c1['error']){if(_0x40e7c1[_0xadd3('0x13')][_0xadd3('0x14')]===0x1f4){logger[_0xadd3('0x13')](_0xadd3('0x15'),_0xc855b0,_0x40e7c1[_0xadd3('0x13')][_0xadd3('0x16')]);return _0x728499(_0x40e7c1['error'][_0xadd3('0x16')]);}logger[_0xadd3('0x13')](_0xadd3('0x15'),_0xc855b0,_0x40e7c1['error'][_0xadd3('0x16')]);return _0x6508bb(_0x40e7c1['error'][_0xadd3('0x16')]);}else{logger['info'](_0xadd3('0x15'),_0xc855b0,_0xadd3('0xf'));_0x6508bb(_0x40e7c1[_0xadd3('0x17')][_0xadd3('0x16')]);}})['catch'](function(_0x2ddd39){logger[_0xadd3('0x13')](_0xadd3('0x15'),_0xc855b0,_0x2ddd39);_0x728499(_0x2ddd39);});});}
\ No newline at end of file
+var _0x8006=['ZohoConfiguration,\x20%s,\x20%s','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2f68fb,_0x55e83f){var _0x51342f=function(_0x118ba4){while(--_0x118ba4){_0x2f68fb['push'](_0x2f68fb['shift']());}};_0x51342f(++_0x55e83f);}(_0x8006,0x13b));var _0x6800=function(_0x3980f8,_0x252339){_0x3980f8=_0x3980f8-0x0;var _0x4dc785=_0x8006[_0x3980f8];return _0x4dc785;};'use strict';var _=require(_0x6800('0x0'));var util=require('util');var moment=require(_0x6800('0x1'));var BPromise=require('bluebird');var rs=require(_0x6800('0x2'));var fs=require('fs');var Redis=require(_0x6800('0x3'));var db=require(_0x6800('0x4'))['db'];var utils=require(_0x6800('0x5'));var logger=require(_0x6800('0x6'))(_0x6800('0x7'));var config=require(_0x6800('0x8'));var jayson=require(_0x6800('0x9'));var client=jayson[_0x6800('0xa')][_0x6800('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49a277,_0xb73b7a,_0x368d73){return new BPromise(function(_0x2eac09,_0x286afc){return client[_0x6800('0xc')](_0x49a277,_0x368d73)[_0x6800('0xd')](function(_0x330df1){logger[_0x6800('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0xb73b7a,_0x6800('0xf'));logger[_0x6800('0x10')](_0x6800('0x11'),_0xb73b7a,_0x6800('0xf'),JSON[_0x6800('0x12')](_0x330df1));if(_0x330df1[_0x6800('0x13')]){if(_0x330df1[_0x6800('0x13')][_0x6800('0x14')]===0x1f4){logger[_0x6800('0x13')](_0x6800('0x15'),_0xb73b7a,_0x330df1['error'][_0x6800('0x16')]);return _0x286afc(_0x330df1['error'][_0x6800('0x16')]);}logger[_0x6800('0x13')](_0x6800('0x15'),_0xb73b7a,_0x330df1['error']['message']);return _0x2eac09(_0x330df1[_0x6800('0x13')][_0x6800('0x16')]);}else{logger[_0x6800('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0xb73b7a,_0x6800('0xf'));_0x2eac09(_0x330df1[_0x6800('0x17')][_0x6800('0x16')]);}})['catch'](function(_0x1e5936){logger['error'](_0x6800('0x15'),_0xb73b7a,_0x1e5936);_0x286afc(_0x1e5936);});});}
\ No newline at end of file
index d310873..0e6a511 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3371=['delete','destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','show','create','put','/:id','update'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x3371,0xe3));var _0x1337=function(_0x1b646f,_0x44b1f0){_0x1b646f=_0x1b646f-0x0;var _0x5663a8=_0x3371[_0x1b646f];return _0x5663a8;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1337('0x0'));var router=express[_0x1337('0x1')]();var auth=require(_0x1337('0x2'));var interaction=require(_0x1337('0x3'));var config=require(_0x1337('0x4'));var controller=require('./intZohoField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1337('0x5')]);router[_0x1337('0x6')]('/:id',auth[_0x1337('0x7')](),controller[_0x1337('0x8')]);router['post']('/',auth[_0x1337('0x7')](),controller[_0x1337('0x9')]);router[_0x1337('0xa')](_0x1337('0xb'),auth['isAuthenticated'](),controller[_0x1337('0xc')]);router[_0x1337('0xd')](_0x1337('0xb'),auth[_0x1337('0x7')](),controller[_0x1337('0xe')]);module[_0x1337('0xf')]=router;
\ No newline at end of file
+var _0x40ef=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','show','post','create','put','update','delete'];(function(_0x3630a4,_0x3341a5){var _0x462b0e=function(_0xdf6cc8){while(--_0xdf6cc8){_0x3630a4['push'](_0x3630a4['shift']());}};_0x462b0e(++_0x3341a5);}(_0x40ef,0xb6));var _0xf40e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x40ef[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xf40e('0x0'));var util=require(_0xf40e('0x1'));var path=require(_0xf40e('0x2'));var timeout=require('connect-timeout');var express=require(_0xf40e('0x3'));var router=express[_0xf40e('0x4')]();var auth=require(_0xf40e('0x5'));var interaction=require(_0xf40e('0x6'));var config=require('../../config/environment');var controller=require(_0xf40e('0x7'));router[_0xf40e('0x8')]('/',auth[_0xf40e('0x9')](),controller['index']);router['get']('/:id',auth[_0xf40e('0x9')](),controller[_0xf40e('0xa')]);router[_0xf40e('0xb')]('/',auth[_0xf40e('0x9')](),controller[_0xf40e('0xc')]);router[_0xf40e('0xd')]('/:id',auth[_0xf40e('0x9')](),controller[_0xf40e('0xe')]);router[_0xf40e('0xf')]('/:id',auth[_0xf40e('0x9')](),controller[_0xf40e('0x10')]);module[_0xf40e('0x11')]=router;
\ No newline at end of file
index bf15bcc..bef3103 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9348=['exports','ENUM','string','variable','keyValue','STRING','customVariable','BOOLEAN','sequelize'];(function(_0x13a190,_0x4026c7){var _0x23c5be=function(_0xf6062d){while(--_0xf6062d){_0x13a190['push'](_0x13a190['shift']());}};_0x23c5be(++_0x4026c7);}(_0x9348,0x10d));var _0x8934=function(_0x2f8d85,_0x436c0f){_0x2f8d85=_0x2f8d85-0x0;var _0x2767f5=_0x9348[_0x2f8d85];return _0x2767f5;};'use strict';var Sequelize=require(_0x8934('0x0'));module[_0x8934('0x1')]={'type':{'type':Sequelize[_0x8934('0x2')](_0x8934('0x3'),_0x8934('0x4'),'customVariable',_0x8934('0x5')),'defaultValue':_0x8934('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8934('0x6')]},'keyType':{'type':Sequelize[_0x8934('0x2')](_0x8934('0x3'),_0x8934('0x4'),_0x8934('0x7'))},'keyContent':{'type':Sequelize[_0x8934('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8934('0x6')]},'customField':{'type':Sequelize[_0x8934('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8934('0x6')]}};
\ No newline at end of file
+var _0x3c81=['customVariable','BOOLEAN','sequelize','exports','string','variable','STRING','ENUM'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3c81,0x102));var _0x13c8=function(_0x1fbe0c,_0x490be8){_0x1fbe0c=_0x1fbe0c-0x0;var _0x5d16b3=_0x3c81[_0x1fbe0c];return _0x5d16b3;};'use strict';var Sequelize=require(_0x13c8('0x0'));module[_0x13c8('0x1')]={'type':{'type':Sequelize['ENUM'](_0x13c8('0x2'),_0x13c8('0x3'),'customVariable','keyValue'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x13c8('0x4')]},'keyType':{'type':Sequelize[_0x13c8('0x5')](_0x13c8('0x2'),_0x13c8('0x3'),_0x13c8('0x6'))},'keyContent':{'type':Sequelize[_0x13c8('0x4')]},'idField':{'type':Sequelize[_0x13c8('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}};
\ No newline at end of file
index 4a56f18..582e0db 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbfc0=['filters','map','type','key','VIRTUAL','field','filter','merge','where','then','includeAll','include','findAll','catch','show','params','options','find','create','body','destroy','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','lodash','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','save','update','error','stack','name','send','index','ZohoField','rawAttributes','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','sort'];(function(_0x5ac84c,_0x287781){var _0x3c53d2=function(_0x40cde0){while(--_0x40cde0){_0x5ac84c['push'](_0x5ac84c['shift']());}};_0x3c53d2(++_0x287781);}(_0xbfc0,0x115));var _0x0bfc=function(_0x263a2f,_0x1e81e3){_0x263a2f=_0x263a2f-0x0;var _0x8020e8=_0xbfc0[_0x263a2f];return _0x8020e8;};'use strict';var pdf=require(_0x0bfc('0x0'));var emlformat=require(_0x0bfc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0bfc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0bfc('0x3'));var moment=require(_0x0bfc('0x4'));var BPromise=require(_0x0bfc('0x5'));var Mustache=require('mustache');var util=require(_0x0bfc('0x6'));var path=require(_0x0bfc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0bfc('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0bfc('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x0bfc('0xa'));var querystring=require(_0x0bfc('0xb'));var Papa=require(_0x0bfc('0xc'));var authService=require(_0x0bfc('0xd'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0x0bfc('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0x0bfc('0xf'));var config=require('../../config/environment');var db=require(_0x0bfc('0x10'))['db'];function respondWithStatusCode(_0x29cf86,_0x9ee167){_0x9ee167=_0x9ee167||0xcc;return function(_0x259b30){if(_0x259b30){return _0x29cf86[_0x0bfc('0x11')](_0x9ee167);}return _0x29cf86[_0x0bfc('0x12')](_0x9ee167)[_0x0bfc('0x13')]();};}function respondWithResult(_0x399c1a,_0x3155e1){_0x3155e1=_0x3155e1||0xc8;return function(_0x357c45){if(_0x357c45){return _0x399c1a[_0x0bfc('0x12')](_0x3155e1)[_0x0bfc('0x14')](_0x357c45);}};}function respondWithFilteredResult(_0x1b8e46,_0x4e06cd){return function(_0x31babe){if(_0x31babe){var _0x434f33=_0x31babe[_0x0bfc('0x15')],_0x5971fb=_0x4e06cd[_0x0bfc('0x16')],_0x40f312=_0x4e06cd['offset']+_0x4e06cd[_0x0bfc('0x17')],_0x1defb0;if(_0x40f312>=_0x434f33){_0x40f312=_0x434f33;_0x1defb0=0xc8;}else{_0x1defb0=0xce;}_0x1b8e46['status'](_0x1defb0);return _0x1b8e46['set']('Content-Range',_0x5971fb+'-'+_0x40f312+'/'+_0x434f33)[_0x0bfc('0x14')](_0x31babe);}return null;};}function patchUpdates(_0x3933aa){return function(_0x408e67){try{jsonpatch[_0x0bfc('0x18')](_0x408e67,_0x3933aa,!![]);}catch(_0x4b7dfd){return BPromise['reject'](_0x4b7dfd);}return _0x408e67[_0x0bfc('0x19')]();};}function saveUpdates(_0x5a5c00,_0x109a05){return function(_0x316e70){if(_0x316e70){return _0x316e70[_0x0bfc('0x1a')](_0x5a5c00)['then'](function(_0x575700){return _0x575700;});}return null;};}function removeEntity(_0x4a8225,_0x488f3d){return function(_0x13a8a0){if(_0x13a8a0){return _0x13a8a0['destroy']()['then'](function(){_0x4a8225[_0x0bfc('0x12')](0xcc)[_0x0bfc('0x13')]();});}};}function handleEntityNotFound(_0x45bda4,_0x3928b2){return function(_0x2fe950){if(!_0x2fe950){_0x45bda4[_0x0bfc('0x11')](0x194);}return _0x2fe950;};}function handleError(_0x518a5b,_0x1d665a){_0x1d665a=_0x1d665a||0x1f4;return function(_0x26db58){logger[_0x0bfc('0x1b')](_0x26db58[_0x0bfc('0x1c')]);if(_0x26db58[_0x0bfc('0x1d')]){delete _0x26db58[_0x0bfc('0x1d')];}_0x518a5b[_0x0bfc('0x12')](_0x1d665a)[_0x0bfc('0x1e')](_0x26db58);};}exports[_0x0bfc('0x1f')]=function(_0x2f704b,_0x4b56ff){var _0x50c7cb={},_0xe9452d={},_0x469199={'count':0x0,'rows':[]};var _0x3616f1=db[_0x0bfc('0x20')][_0x0bfc('0x21')];_0xe9452d['model']=_[_0x0bfc('0x22')](_0x3616f1);_0xe9452d[_0x0bfc('0x23')]=_[_0x0bfc('0x22')](_0x2f704b[_0x0bfc('0x23')]);_0xe9452d['filters']=_[_0x0bfc('0x24')](_0xe9452d[_0x0bfc('0x25')],_0xe9452d['query']);_0x50c7cb[_0x0bfc('0x26')]=_[_0x0bfc('0x24')](_0xe9452d[_0x0bfc('0x25')],qs[_0x0bfc('0x27')](_0x2f704b[_0x0bfc('0x23')]['fields']));_0x50c7cb[_0x0bfc('0x26')]=_0x50c7cb['attributes'][_0x0bfc('0x28')]?_0x50c7cb[_0x0bfc('0x26')]:_0xe9452d[_0x0bfc('0x25')];if(!_0x2f704b[_0x0bfc('0x23')][_0x0bfc('0x29')]('nolimit')){_0x50c7cb[_0x0bfc('0x17')]=qs[_0x0bfc('0x17')](_0x2f704b[_0x0bfc('0x23')][_0x0bfc('0x17')]);_0x50c7cb[_0x0bfc('0x16')]=qs[_0x0bfc('0x16')](_0x2f704b[_0x0bfc('0x23')][_0x0bfc('0x16')]);}_0x50c7cb['order']=qs[_0x0bfc('0x2a')](_0x2f704b['query'][_0x0bfc('0x2a')]);_0x50c7cb['where']=qs['filters'](_['pick'](_0x2f704b[_0x0bfc('0x23')],_0xe9452d[_0x0bfc('0x2b')]));if(_0x2f704b[_0x0bfc('0x23')]['filter']){_0x50c7cb['where']=_['merge'](_0x50c7cb['where'],{'$or':_[_0x0bfc('0x2c')](_0x3616f1,function(_0x3a9ec1){if(_0x3a9ec1[_0x0bfc('0x2d')][_0x0bfc('0x2e')]!==_0x0bfc('0x2f')){var _0x4cb955={};_0x4cb955[_0x3a9ec1[_0x0bfc('0x30')]]={'$like':'%'+_0x2f704b[_0x0bfc('0x23')][_0x0bfc('0x31')]+'%'};return _0x4cb955;}})});}_0x50c7cb=_[_0x0bfc('0x32')]({},_0x50c7cb,_0x2f704b['options']);var _0x4281b1={'where':_0x50c7cb[_0x0bfc('0x33')]};return db[_0x0bfc('0x20')][_0x0bfc('0x15')](_0x4281b1)[_0x0bfc('0x34')](function(_0x2afa14){_0x469199[_0x0bfc('0x15')]=_0x2afa14;if(_0x2f704b[_0x0bfc('0x23')][_0x0bfc('0x35')]){_0x50c7cb[_0x0bfc('0x36')]=[{'all':!![]}];}return db['ZohoField'][_0x0bfc('0x37')](_0x50c7cb);})[_0x0bfc('0x34')](function(_0x579e9f){_0x469199['rows']=_0x579e9f;return _0x469199;})['then'](respondWithFilteredResult(_0x4b56ff,_0x50c7cb))[_0x0bfc('0x38')](handleError(_0x4b56ff,null));};exports[_0x0bfc('0x39')]=function(_0x3d8e32,_0x23ed14){var _0x1bdb2d={'raw':!![],'where':{'id':_0x3d8e32[_0x0bfc('0x3a')]['id']}},_0x37a19b={};_0x37a19b[_0x0bfc('0x25')]=_[_0x0bfc('0x22')](db[_0x0bfc('0x20')][_0x0bfc('0x21')]);_0x37a19b['query']=_[_0x0bfc('0x22')](_0x3d8e32[_0x0bfc('0x23')]);_0x37a19b[_0x0bfc('0x2b')]=_[_0x0bfc('0x24')](_0x37a19b[_0x0bfc('0x25')],_0x37a19b[_0x0bfc('0x23')]);_0x1bdb2d['attributes']=_['intersection'](_0x37a19b['model'],qs[_0x0bfc('0x27')](_0x3d8e32[_0x0bfc('0x23')][_0x0bfc('0x27')]));_0x1bdb2d['attributes']=_0x1bdb2d[_0x0bfc('0x26')][_0x0bfc('0x28')]?_0x1bdb2d[_0x0bfc('0x26')]:_0x37a19b[_0x0bfc('0x25')];if(_0x3d8e32[_0x0bfc('0x23')][_0x0bfc('0x35')]){_0x1bdb2d[_0x0bfc('0x36')]=[{'all':!![]}];}_0x1bdb2d=_[_0x0bfc('0x32')]({},_0x1bdb2d,_0x3d8e32[_0x0bfc('0x3b')]);return db[_0x0bfc('0x20')][_0x0bfc('0x3c')](_0x1bdb2d)[_0x0bfc('0x34')](handleEntityNotFound(_0x23ed14,null))[_0x0bfc('0x34')](respondWithResult(_0x23ed14,null))[_0x0bfc('0x38')](handleError(_0x23ed14,null));};exports[_0x0bfc('0x3d')]=function(_0x2d21ed,_0x4f1ebf){return db[_0x0bfc('0x20')][_0x0bfc('0x3d')](_0x2d21ed[_0x0bfc('0x3e')],{})[_0x0bfc('0x34')](respondWithResult(_0x4f1ebf,0xc9))[_0x0bfc('0x38')](handleError(_0x4f1ebf,null));};exports['update']=function(_0x50b414,_0x25f3cd){if(_0x50b414[_0x0bfc('0x3e')]['id']){delete _0x50b414[_0x0bfc('0x3e')]['id'];}return db['ZohoField'][_0x0bfc('0x3c')]({'where':{'id':_0x50b414[_0x0bfc('0x3a')]['id']}})[_0x0bfc('0x34')](handleEntityNotFound(_0x25f3cd,null))[_0x0bfc('0x34')](saveUpdates(_0x50b414[_0x0bfc('0x3e')],null))[_0x0bfc('0x34')](respondWithResult(_0x25f3cd,null))[_0x0bfc('0x38')](handleError(_0x25f3cd,null));};exports[_0x0bfc('0x3f')]=function(_0x15025d,_0x398b43){return db[_0x0bfc('0x20')]['find']({'where':{'id':_0x15025d['params']['id']}})[_0x0bfc('0x34')](handleEntityNotFound(_0x398b43,null))[_0x0bfc('0x34')](removeEntity(_0x398b43,null))[_0x0bfc('0x38')](handleError(_0x398b43,null));};
\ No newline at end of file
+var _0xc16b=['offset','limit','set','Content-Range','json','apply','reject','update','then','sendStatus','name','index','ZohoField','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','rawAttributes','create','find','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status'];(function(_0x5574e5,_0x2287ce){var _0x47d890=function(_0x4a85c6){while(--_0x4a85c6){_0x5574e5['push'](_0x5574e5['shift']());}};_0x47d890(++_0x2287ce);}(_0xc16b,0x76));var _0xbc16=function(_0x3bb2cb,_0xd01732){_0x3bb2cb=_0x3bb2cb-0x0;var _0x2eb012=_0xc16b[_0x3bb2cb];return _0x2eb012;};'use strict';var pdf=require(_0xbc16('0x0'));var emlformat=require(_0xbc16('0x1'));var rimraf=require(_0xbc16('0x2'));var zipdir=require(_0xbc16('0x3'));var jsonpatch=require(_0xbc16('0x4'));var rp=require(_0xbc16('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbc16('0x6'));var path=require(_0xbc16('0x7'));var sox=require(_0xbc16('0x8'));var csv=require(_0xbc16('0x9'));var ejs=require(_0xbc16('0xa'));var fs=require('fs');var _=require(_0xbc16('0xb'));var squel=require('squel');var crypto=require(_0xbc16('0xc'));var jsforce=require(_0xbc16('0xd'));var deskjs=require(_0xbc16('0xe'));var toCsv=require(_0xbc16('0x9'));var querystring=require('querystring');var Papa=require(_0xbc16('0xf'));var authService=require(_0xbc16('0x10'));var hardwareService=require(_0xbc16('0x11'));var Redis=require('ioredis');var qs=require(_0xbc16('0x12'));var logger=require(_0xbc16('0x13'))(_0xbc16('0x14'));var utils=require(_0xbc16('0x15'));var config=require(_0xbc16('0x16'));var db=require(_0xbc16('0x17'))['db'];function respondWithStatusCode(_0x4fdb69,_0x30f49a){_0x30f49a=_0x30f49a||0xcc;return function(_0x4f53fd){if(_0x4f53fd){return _0x4fdb69['sendStatus'](_0x30f49a);}return _0x4fdb69['status'](_0x30f49a)[_0xbc16('0x18')]();};}function respondWithResult(_0xa116db,_0x540210){_0x540210=_0x540210||0xc8;return function(_0x53608a){if(_0x53608a){return _0xa116db[_0xbc16('0x19')](_0x540210)['json'](_0x53608a);}};}function respondWithFilteredResult(_0x1ebaa0,_0x38a85e){return function(_0x3be88e){if(_0x3be88e){var _0x284bb3=_0x3be88e['count'],_0x1b109d=_0x38a85e[_0xbc16('0x1a')],_0x321b6b=_0x38a85e[_0xbc16('0x1a')]+_0x38a85e[_0xbc16('0x1b')],_0x3eb28d;if(_0x321b6b>=_0x284bb3){_0x321b6b=_0x284bb3;_0x3eb28d=0xc8;}else{_0x3eb28d=0xce;}_0x1ebaa0[_0xbc16('0x19')](_0x3eb28d);return _0x1ebaa0[_0xbc16('0x1c')](_0xbc16('0x1d'),_0x1b109d+'-'+_0x321b6b+'/'+_0x284bb3)[_0xbc16('0x1e')](_0x3be88e);}return null;};}function patchUpdates(_0x18831e){return function(_0x2e5bb3){try{jsonpatch[_0xbc16('0x1f')](_0x2e5bb3,_0x18831e,!![]);}catch(_0x21b280){return BPromise[_0xbc16('0x20')](_0x21b280);}return _0x2e5bb3['save']();};}function saveUpdates(_0x332d86,_0x58ee65){return function(_0x490ca9){if(_0x490ca9){return _0x490ca9[_0xbc16('0x21')](_0x332d86)[_0xbc16('0x22')](function(_0x211788){return _0x211788;});}return null;};}function removeEntity(_0x365ae2,_0x3bd08b){return function(_0x3a8546){if(_0x3a8546){return _0x3a8546['destroy']()[_0xbc16('0x22')](function(){_0x365ae2[_0xbc16('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x316275,_0x5c5175){return function(_0x1b7889){if(!_0x1b7889){_0x316275[_0xbc16('0x23')](0x194);}return _0x1b7889;};}function handleError(_0x7d02e8,_0x2a9ab6){_0x2a9ab6=_0x2a9ab6||0x1f4;return function(_0x19f5ff){logger['error'](_0x19f5ff['stack']);if(_0x19f5ff['name']){delete _0x19f5ff[_0xbc16('0x24')];}_0x7d02e8[_0xbc16('0x19')](_0x2a9ab6)['send'](_0x19f5ff);};}exports[_0xbc16('0x25')]=function(_0x5b3201,_0x320bfb){var _0x44ab08={},_0x3700d5={},_0x2f8db5={'count':0x0,'rows':[]};var _0x2b0bff=db[_0xbc16('0x26')]['rawAttributes'];_0x3700d5[_0xbc16('0x27')]=_['keys'](_0x2b0bff);_0x3700d5[_0xbc16('0x28')]=_[_0xbc16('0x29')](_0x5b3201[_0xbc16('0x28')]);_0x3700d5[_0xbc16('0x2a')]=_['intersection'](_0x3700d5['model'],_0x3700d5[_0xbc16('0x28')]);_0x44ab08['attributes']=_[_0xbc16('0x2b')](_0x3700d5['model'],qs[_0xbc16('0x2c')](_0x5b3201['query'][_0xbc16('0x2c')]));_0x44ab08[_0xbc16('0x2d')]=_0x44ab08['attributes'][_0xbc16('0x2e')]?_0x44ab08['attributes']:_0x3700d5[_0xbc16('0x27')];if(!_0x5b3201[_0xbc16('0x28')][_0xbc16('0x2f')](_0xbc16('0x30'))){_0x44ab08[_0xbc16('0x1b')]=qs['limit'](_0x5b3201[_0xbc16('0x28')][_0xbc16('0x1b')]);_0x44ab08[_0xbc16('0x1a')]=qs[_0xbc16('0x1a')](_0x5b3201[_0xbc16('0x28')][_0xbc16('0x1a')]);}_0x44ab08[_0xbc16('0x31')]=qs[_0xbc16('0x32')](_0x5b3201[_0xbc16('0x28')][_0xbc16('0x32')]);_0x44ab08[_0xbc16('0x33')]=qs['filters'](_[_0xbc16('0x34')](_0x5b3201[_0xbc16('0x28')],_0x3700d5[_0xbc16('0x2a')]));if(_0x5b3201[_0xbc16('0x28')][_0xbc16('0x35')]){_0x44ab08[_0xbc16('0x33')]=_[_0xbc16('0x36')](_0x44ab08['where'],{'$or':_[_0xbc16('0x37')](_0x2b0bff,function(_0x530ddd){if(_0x530ddd[_0xbc16('0x38')][_0xbc16('0x39')]!==_0xbc16('0x3a')){var _0x52973d={};_0x52973d[_0x530ddd['field']]={'$like':'%'+_0x5b3201[_0xbc16('0x28')]['filter']+'%'};return _0x52973d;}})});}_0x44ab08=_['merge']({},_0x44ab08,_0x5b3201[_0xbc16('0x3b')]);var _0x2037a3={'where':_0x44ab08[_0xbc16('0x33')]};return db['ZohoField']['count'](_0x2037a3)[_0xbc16('0x22')](function(_0x179816){_0x2f8db5[_0xbc16('0x3c')]=_0x179816;if(_0x5b3201[_0xbc16('0x28')][_0xbc16('0x3d')]){_0x44ab08[_0xbc16('0x3e')]=[{'all':!![]}];}return db['ZohoField']['findAll'](_0x44ab08);})['then'](function(_0x20994e){_0x2f8db5[_0xbc16('0x3f')]=_0x20994e;return _0x2f8db5;})['then'](respondWithFilteredResult(_0x320bfb,_0x44ab08))[_0xbc16('0x40')](handleError(_0x320bfb,null));};exports[_0xbc16('0x41')]=function(_0x4ebb6b,_0x294e47){var _0x542eea={'raw':!![],'where':{'id':_0x4ebb6b[_0xbc16('0x42')]['id']}},_0xa3c4ae={};_0xa3c4ae[_0xbc16('0x27')]=_['keys'](db['ZohoField'][_0xbc16('0x43')]);_0xa3c4ae['query']=_[_0xbc16('0x29')](_0x4ebb6b[_0xbc16('0x28')]);_0xa3c4ae['filters']=_['intersection'](_0xa3c4ae['model'],_0xa3c4ae[_0xbc16('0x28')]);_0x542eea[_0xbc16('0x2d')]=_[_0xbc16('0x2b')](_0xa3c4ae[_0xbc16('0x27')],qs['fields'](_0x4ebb6b['query']['fields']));_0x542eea[_0xbc16('0x2d')]=_0x542eea[_0xbc16('0x2d')]['length']?_0x542eea['attributes']:_0xa3c4ae[_0xbc16('0x27')];if(_0x4ebb6b[_0xbc16('0x28')][_0xbc16('0x3d')]){_0x542eea[_0xbc16('0x3e')]=[{'all':!![]}];}_0x542eea=_['merge']({},_0x542eea,_0x4ebb6b[_0xbc16('0x3b')]);return db[_0xbc16('0x26')]['find'](_0x542eea)[_0xbc16('0x22')](handleEntityNotFound(_0x294e47,null))[_0xbc16('0x22')](respondWithResult(_0x294e47,null))[_0xbc16('0x40')](handleError(_0x294e47,null));};exports[_0xbc16('0x44')]=function(_0x2d7bfc,_0x8eceb6){return db['ZohoField'][_0xbc16('0x44')](_0x2d7bfc['body'],{})[_0xbc16('0x22')](respondWithResult(_0x8eceb6,0xc9))[_0xbc16('0x40')](handleError(_0x8eceb6,null));};exports[_0xbc16('0x21')]=function(_0x375536,_0x5db957){if(_0x375536['body']['id']){delete _0x375536['body']['id'];}return db[_0xbc16('0x26')][_0xbc16('0x45')]({'where':{'id':_0x375536[_0xbc16('0x42')]['id']}})[_0xbc16('0x22')](handleEntityNotFound(_0x5db957,null))[_0xbc16('0x22')](saveUpdates(_0x375536[_0xbc16('0x46')],null))['then'](respondWithResult(_0x5db957,null))[_0xbc16('0x40')](handleError(_0x5db957,null));};exports[_0xbc16('0x47')]=function(_0x4aba9a,_0xbfeab4){return db['ZohoField']['find']({'where':{'id':_0x4aba9a[_0xbc16('0x42')]['id']}})[_0xbc16('0x22')](handleEntityNotFound(_0xbfeab4,null))[_0xbc16('0x22')](removeEntity(_0xbfeab4,null))[_0xbc16('0x40')](handleError(_0xbfeab4,null));};
\ No newline at end of file
index 4b7023b..7152509 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x756f=['util','../../config/logger','api','bluebird','request-promise','./intZohoField.attributes','exports','ZohoField','zoho_unique_index','idField','FieldId','lodash'];(function(_0x5e5720,_0x239782){var _0x32abb1=function(_0x34fa48){while(--_0x34fa48){_0x5e5720['push'](_0x5e5720['shift']());}};_0x32abb1(++_0x239782);}(_0x756f,0x137));var _0xf756=function(_0x2f4ab6,_0x271ad4){_0x2f4ab6=_0x2f4ab6-0x0;var _0x1d8027=_0x756f[_0x2f4ab6];return _0x1d8027;};'use strict';var _=require(_0xf756('0x0'));var util=require(_0xf756('0x1'));var logger=require(_0xf756('0x2'))(_0xf756('0x3'));var moment=require('moment');var BPromise=require(_0xf756('0x4'));var rp=require(_0xf756('0x5'));var attributes=require(_0xf756('0x6'));module[_0xf756('0x7')]=function(_0xa001d3,_0x532d13){return _0xa001d3['define'](_0xf756('0x8'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xf756('0x9'),'fields':[_0xf756('0xa'),_0xf756('0xb')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x7d5d=['request-promise','./intZohoField.attributes','define','ZohoField','int_zoho_fields','idField','FieldId','util','../../config/logger','bluebird'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7d5d,0x1dd));var _0xd7d5=function(_0x4895cf,_0xe707a8){_0x4895cf=_0x4895cf-0x0;var _0x271741=_0x7d5d[_0x4895cf];return _0x271741;};'use strict';var _=require('lodash');var util=require(_0xd7d5('0x0'));var logger=require(_0xd7d5('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd7d5('0x2'));var rp=require(_0xd7d5('0x3'));var attributes=require(_0xd7d5('0x4'));module['exports']=function(_0x236433,_0x26fd7b){return _0x236433[_0xd7d5('0x5')](_0xd7d5('0x6'),attributes,{'tableName':_0xd7d5('0x7'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0xd7d5('0x8'),_0xd7d5('0x9')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index edb7a97..7d900e9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd552=['ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x1254c8,_0x34e836){var _0x4c2496=function(_0x2e84ad){while(--_0x2e84ad){_0x1254c8['push'](_0x1254c8['shift']());}};_0x4c2496(++_0x34e836);}(_0xd552,0x103));var _0x2d55=function(_0xc70ce0,_0x2dadf5){_0xc70ce0=_0xc70ce0-0x0;var _0x6d78b9=_0xd552[_0xc70ce0];return _0x6d78b9;};'use strict';var _=require(_0x2d55('0x0'));var util=require(_0x2d55('0x1'));var moment=require(_0x2d55('0x2'));var BPromise=require('bluebird');var rs=require(_0x2d55('0x3'));var fs=require('fs');var Redis=require(_0x2d55('0x4'));var db=require(_0x2d55('0x5'))['db'];var utils=require(_0x2d55('0x6'));var logger=require(_0x2d55('0x7'))('rpc');var config=require(_0x2d55('0x8'));var jayson=require(_0x2d55('0x9'));var client=jayson[_0x2d55('0xa')][_0x2d55('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c7c66,_0x210faf,_0x30f796){return new BPromise(function(_0x42e4c2,_0x5ac87f){return client['request'](_0x4c7c66,_0x30f796)[_0x2d55('0xc')](function(_0xc995f8){logger[_0x2d55('0xd')](_0x2d55('0xe'),_0x210faf,_0x2d55('0xf'));logger[_0x2d55('0x10')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x210faf,_0x2d55('0xf'),JSON[_0x2d55('0x11')](_0xc995f8));if(_0xc995f8[_0x2d55('0x12')]){if(_0xc995f8[_0x2d55('0x12')]['code']===0x1f4){logger[_0x2d55('0x12')](_0x2d55('0xe'),_0x210faf,_0xc995f8[_0x2d55('0x12')][_0x2d55('0x13')]);return _0x5ac87f(_0xc995f8[_0x2d55('0x12')][_0x2d55('0x13')]);}logger[_0x2d55('0x12')](_0x2d55('0xe'),_0x210faf,_0xc995f8[_0x2d55('0x12')]['message']);return _0x42e4c2(_0xc995f8[_0x2d55('0x12')]['message']);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x210faf,_0x2d55('0xf'));_0x42e4c2(_0xc995f8[_0x2d55('0x14')][_0x2d55('0x13')]);}})['catch'](function(_0x283b95){logger[_0x2d55('0x12')](_0x2d55('0xe'),_0x210faf,_0x283b95);_0x5ac87f(_0x283b95);});});}
\ No newline at end of file
+var _0x4283=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4283,0x1c6));var _0x3428=function(_0x15222b,_0x45e08d){_0x15222b=_0x15222b-0x0;var _0xf5bb3d=_0x4283[_0x15222b];return _0xf5bb3d;};'use strict';var _=require(_0x3428('0x0'));var util=require(_0x3428('0x1'));var moment=require('moment');var BPromise=require(_0x3428('0x2'));var rs=require(_0x3428('0x3'));var fs=require('fs');var Redis=require(_0x3428('0x4'));var db=require(_0x3428('0x5'))['db'];var utils=require(_0x3428('0x6'));var logger=require(_0x3428('0x7'))(_0x3428('0x8'));var config=require('../../config/environment');var jayson=require(_0x3428('0x9'));var client=jayson[_0x3428('0xa')][_0x3428('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f17dd,_0x5b8654,_0x1cd54a){return new BPromise(function(_0x16d5fb,_0x43c249){return client[_0x3428('0xc')](_0x2f17dd,_0x1cd54a)[_0x3428('0xd')](function(_0x45e8e8){logger[_0x3428('0xe')](_0x3428('0xf'),_0x5b8654,_0x3428('0x10'));logger[_0x3428('0x11')](_0x3428('0x12'),_0x5b8654,_0x3428('0x10'),JSON[_0x3428('0x13')](_0x45e8e8));if(_0x45e8e8[_0x3428('0x14')]){if(_0x45e8e8['error']['code']===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0x5b8654,_0x45e8e8[_0x3428('0x14')][_0x3428('0x15')]);return _0x43c249(_0x45e8e8[_0x3428('0x14')][_0x3428('0x15')]);}logger[_0x3428('0x14')](_0x3428('0xf'),_0x5b8654,_0x45e8e8[_0x3428('0x14')][_0x3428('0x15')]);return _0x16d5fb(_0x45e8e8[_0x3428('0x14')][_0x3428('0x15')]);}else{logger[_0x3428('0xe')](_0x3428('0xf'),_0x5b8654,_0x3428('0x10'));_0x16d5fb(_0x45e8e8[_0x3428('0x16')]['message']);}})[_0x3428('0x17')](function(_0x7dcd99){logger[_0x3428('0x14')](_0x3428('0xf'),_0x5b8654,_0x7dcd99);_0x43c249(_0x7dcd99);});});}
\ No newline at end of file
index ef4107c..cd0e1ea 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb96d=['../../components/auth/service','../../components/interaction/service','util','path','connect-timeout','Router'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xb96d,0x9e));var _0xdb96=function(_0x408e38,_0x23cda8){_0x408e38=_0x408e38-0x0;var _0x426b0e=_0xb96d[_0x408e38];return _0x426b0e;};'use strict';var multer=require('multer');var util=require(_0xdb96('0x0'));var path=require(_0xdb96('0x1'));var timeout=require(_0xdb96('0x2'));var express=require('express');var router=express[_0xdb96('0x3')]();var auth=require(_0xdb96('0x4'));var interaction=require(_0xdb96('0x5'));var config=require('../../config/environment');module['exports']=router;
\ No newline at end of file
+var _0xc7a3=['express','Router','../../components/auth/service','../../config/environment','exports','util','path','connect-timeout'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x4c8ce8,_0x10aeee){_0x4c8ce8=_0x4c8ce8-0x0;var _0x1013d6=_0xc7a3[_0x4c8ce8];return _0x1013d6;};'use strict';var multer=require('multer');var util=require(_0x3c7a('0x0'));var path=require(_0x3c7a('0x1'));var timeout=require(_0x3c7a('0x2'));var express=require(_0x3c7a('0x3'));var router=express[_0x3c7a('0x4')]();var auth=require(_0x3c7a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3c7a('0x6'));module[_0x3c7a('0x7')]=router;
\ No newline at end of file
index 2050ea9..03a3aef 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4b18=['unique_name_and_version','app.js','INTEGER','sequelize','exports','STRING'];(function(_0x58b3ca,_0x4183bc){var _0x1dfab9=function(_0xa24c69){while(--_0xa24c69){_0x58b3ca['push'](_0x58b3ca['shift']());}};_0x1dfab9(++_0x4183bc);}(_0x4b18,0xe7));var _0x84b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b18[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x84b1('0x0'));module[_0x84b1('0x1')]={'name':{'type':Sequelize[_0x84b1('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x84b1('0x2')],'allowNull':![],'unique':_0x84b1('0x3')},'main':{'type':Sequelize[_0x84b1('0x2')],'defaultValue':_0x84b1('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x84b1('0x2')]},'type':{'type':Sequelize[_0x84b1('0x2')]},'size':{'type':Sequelize[_0x84b1('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x84b1('0x2')],'unique':'state'},'description':{'type':Sequelize[_0x84b1('0x2')]},'title':{'type':Sequelize[_0x84b1('0x2')]},'remoteUri':{'type':Sequelize[_0x84b1('0x2')]},'link':{'type':Sequelize[_0x84b1('0x2')],'defaultValue':'#'}};
\ No newline at end of file
+var _0x0090=['INTEGER','BOOLEAN','exports','unique_name_and_version','STRING','app.js'];(function(_0x41049c,_0x490aa3){var _0x81a174=function(_0x1126c6){while(--_0x1126c6){_0x41049c['push'](_0x41049c['shift']());}};_0x81a174(++_0x490aa3);}(_0x0090,0x1a6));var _0x0009=function(_0xfb2d0f,_0x2947d1){_0xfb2d0f=_0xfb2d0f-0x0;var _0x4caf4f=_0x0090[_0xfb2d0f];return _0x4caf4f;};'use strict';var Sequelize=require('sequelize');module[_0x0009('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0009('0x1')},'version':{'type':Sequelize[_0x0009('0x2')],'allowNull':![],'unique':_0x0009('0x1')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x0009('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x0009('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x0009('0x4')]},'active':{'type':Sequelize[_0x0009('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x0009('0x2')]},'logo':{'type':Sequelize[_0x0009('0x2')]},'state':{'type':Sequelize[_0x0009('0x2')],'unique':'state'},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x0009('0x2')]},'remoteUri':{'type':Sequelize[_0x0009('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}};
\ No newline at end of file
index a35b69e..871e68f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9348=['zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','reject','save','update','then','destroy','stack','name','send','Integration','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','map','type','key','VIRTUAL','field','merge','count','findAll','params','includeAll','find','create','body','catch','html-pdf','eml-format','rimraf'];(function(_0x2ce8f1,_0x4ccbe7){var _0x466ce9=function(_0x53d29e){while(--_0x53d29e){_0x2ce8f1['push'](_0x2ce8f1['shift']());}};_0x466ce9(++_0x4ccbe7);}(_0x9348,0x10d));var _0x8934=function(_0x546680,_0x55ac3a){_0x546680=_0x546680-0x0;var _0x142c9b=_0x9348[_0x546680];return _0x142c9b;};'use strict';var pdf=require(_0x8934('0x0'));var emlformat=require(_0x8934('0x1'));var rimraf=require(_0x8934('0x2'));var zipdir=require(_0x8934('0x3'));var jsonpatch=require(_0x8934('0x4'));var rp=require('request-promise');var moment=require(_0x8934('0x5'));var BPromise=require(_0x8934('0x6'));var Mustache=require('mustache');var util=require(_0x8934('0x7'));var path=require(_0x8934('0x8'));var sox=require(_0x8934('0x9'));var csv=require(_0x8934('0xa'));var ejs=require(_0x8934('0xb'));var fs=require('fs');var _=require(_0x8934('0xc'));var squel=require('squel');var crypto=require(_0x8934('0xd'));var jsforce=require(_0x8934('0xe'));var deskjs=require(_0x8934('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0x8934('0x10'));var Redis=require('ioredis');var qs=require(_0x8934('0x11'));var logger=require(_0x8934('0x12'))(_0x8934('0x13'));var utils=require(_0x8934('0x14'));var config=require(_0x8934('0x15'));var db=require(_0x8934('0x16'))['db'];function respondWithStatusCode(_0x41909f,_0xbb421b){_0xbb421b=_0xbb421b||0xcc;return function(_0x4a999c){if(_0x4a999c){return _0x41909f[_0x8934('0x17')](_0xbb421b);}return _0x41909f[_0x8934('0x18')](_0xbb421b)[_0x8934('0x19')]();};}function respondWithResult(_0x1906d0,_0xbc487e){_0xbc487e=_0xbc487e||0xc8;return function(_0xdf59f4){if(_0xdf59f4){return _0x1906d0['status'](_0xbc487e)[_0x8934('0x1a')](_0xdf59f4);}};}function respondWithFilteredResult(_0x38230a,_0xdfc97c){return function(_0x94b948){if(_0x94b948){var _0x34d4dc=_0x94b948['count'],_0x41e6a9=_0xdfc97c[_0x8934('0x1b')],_0x2a5b04=_0xdfc97c[_0x8934('0x1b')]+_0xdfc97c[_0x8934('0x1c')],_0x357cf8;if(_0x2a5b04>=_0x34d4dc){_0x2a5b04=_0x34d4dc;_0x357cf8=0xc8;}else{_0x357cf8=0xce;}_0x38230a['status'](_0x357cf8);return _0x38230a['set']('Content-Range',_0x41e6a9+'-'+_0x2a5b04+'/'+_0x34d4dc)[_0x8934('0x1a')](_0x94b948);}return null;};}function patchUpdates(_0x51f9ed){return function(_0xe64ebd){try{jsonpatch[_0x8934('0x1d')](_0xe64ebd,_0x51f9ed,!![]);}catch(_0x14b4e4){return BPromise[_0x8934('0x1e')](_0x14b4e4);}return _0xe64ebd[_0x8934('0x1f')]();};}function saveUpdates(_0x5024e9,_0xf3998){return function(_0x5ae49f){if(_0x5ae49f){return _0x5ae49f[_0x8934('0x20')](_0x5024e9)[_0x8934('0x21')](function(_0x1ccbe5){return _0x1ccbe5;});}return null;};}function removeEntity(_0x379445,_0x2500ec){return function(_0x331e18){if(_0x331e18){return _0x331e18[_0x8934('0x22')]()['then'](function(){_0x379445[_0x8934('0x18')](0xcc)[_0x8934('0x19')]();});}};}function handleEntityNotFound(_0x32020a,_0x343e09){return function(_0x43b89a){if(!_0x43b89a){_0x32020a['sendStatus'](0x194);}return _0x43b89a;};}function handleError(_0x3cf295,_0x1c15c5){_0x1c15c5=_0x1c15c5||0x1f4;return function(_0x1b5775){logger['error'](_0x1b5775[_0x8934('0x23')]);if(_0x1b5775['name']){delete _0x1b5775[_0x8934('0x24')];}_0x3cf295[_0x8934('0x18')](_0x1c15c5)[_0x8934('0x25')](_0x1b5775);};}exports['index']=function(_0x1fd5eb,_0x15910b){var _0x310454={},_0x50b89e={},_0x4b5780={'count':0x0,'rows':[]};var _0x3db790=db[_0x8934('0x26')][_0x8934('0x27')];_0x50b89e[_0x8934('0x28')]=_[_0x8934('0x29')](_0x3db790);_0x50b89e[_0x8934('0x2a')]=_[_0x8934('0x29')](_0x1fd5eb[_0x8934('0x2a')]);_0x50b89e[_0x8934('0x2b')]=_[_0x8934('0x2c')](_0x50b89e['model'],_0x50b89e[_0x8934('0x2a')]);_0x310454[_0x8934('0x2d')]=_['intersection'](_0x50b89e[_0x8934('0x28')],qs[_0x8934('0x2e')](_0x1fd5eb[_0x8934('0x2a')][_0x8934('0x2e')]));_0x310454['attributes']=_0x310454[_0x8934('0x2d')][_0x8934('0x2f')]?_0x310454[_0x8934('0x2d')]:_0x50b89e[_0x8934('0x28')];if(!_0x1fd5eb[_0x8934('0x2a')]['hasOwnProperty'](_0x8934('0x30'))){_0x310454['limit']=qs['limit'](_0x1fd5eb[_0x8934('0x2a')][_0x8934('0x1c')]);_0x310454[_0x8934('0x1b')]=qs[_0x8934('0x1b')](_0x1fd5eb['query'][_0x8934('0x1b')]);}_0x310454[_0x8934('0x31')]=qs[_0x8934('0x32')](_0x1fd5eb[_0x8934('0x2a')][_0x8934('0x32')]);_0x310454['where']=qs[_0x8934('0x2b')](_[_0x8934('0x33')](_0x1fd5eb['query'],_0x50b89e['filters']));if(_0x1fd5eb[_0x8934('0x2a')][_0x8934('0x34')]){_0x310454['where']=_['merge'](_0x310454[_0x8934('0x35')],{'$or':_[_0x8934('0x36')](_0x3db790,function(_0x2f710a){if(_0x2f710a[_0x8934('0x37')][_0x8934('0x38')]!==_0x8934('0x39')){var _0x30f8c6={};_0x30f8c6[_0x2f710a[_0x8934('0x3a')]]={'$like':'%'+_0x1fd5eb[_0x8934('0x2a')][_0x8934('0x34')]+'%'};return _0x30f8c6;}})});}_0x310454=_[_0x8934('0x3b')]({},_0x310454,_0x1fd5eb['options']);var _0x31c805={'where':_0x310454[_0x8934('0x35')]};return db['Integration'][_0x8934('0x3c')](_0x31c805)[_0x8934('0x21')](function(_0x414091){_0x4b5780[_0x8934('0x3c')]=_0x414091;if(_0x1fd5eb[_0x8934('0x2a')]['includeAll']){_0x310454['include']=[{'all':!![]}];}return db['Integration'][_0x8934('0x3d')](_0x310454);})[_0x8934('0x21')](function(_0x8814f6){_0x4b5780['rows']=_0x8814f6;return _0x4b5780;})[_0x8934('0x21')](respondWithFilteredResult(_0x15910b,_0x310454))['catch'](handleError(_0x15910b,null));};exports['show']=function(_0x332098,_0x1f36d0){var _0x533eee={'raw':![],'where':{'id':_0x332098[_0x8934('0x3e')]['id']}},_0x52b95f={};_0x52b95f[_0x8934('0x28')]=_[_0x8934('0x29')](db['Integration'][_0x8934('0x27')]);_0x52b95f['query']=_[_0x8934('0x29')](_0x332098['query']);_0x52b95f[_0x8934('0x2b')]=_[_0x8934('0x2c')](_0x52b95f[_0x8934('0x28')],_0x52b95f['query']);_0x533eee[_0x8934('0x2d')]=_[_0x8934('0x2c')](_0x52b95f[_0x8934('0x28')],qs[_0x8934('0x2e')](_0x332098['query'][_0x8934('0x2e')]));_0x533eee[_0x8934('0x2d')]=_0x533eee[_0x8934('0x2d')][_0x8934('0x2f')]?_0x533eee[_0x8934('0x2d')]:_0x52b95f[_0x8934('0x28')];if(_0x332098[_0x8934('0x2a')][_0x8934('0x3f')]){_0x533eee['include']=[{'all':!![]}];}_0x533eee=_['merge']({},_0x533eee,_0x332098['options']);return db[_0x8934('0x26')][_0x8934('0x40')](_0x533eee)['then'](handleEntityNotFound(_0x1f36d0,null))[_0x8934('0x21')](respondWithResult(_0x1f36d0,null))['catch'](handleError(_0x1f36d0,null));};exports[_0x8934('0x41')]=function(_0x170fbf,_0x4be80d){return db[_0x8934('0x26')][_0x8934('0x41')](_0x170fbf[_0x8934('0x42')],{})[_0x8934('0x21')](respondWithResult(_0x4be80d,0xc9))['catch'](handleError(_0x4be80d,null));};exports[_0x8934('0x20')]=function(_0xa35ac9,_0x5991fc){if(_0xa35ac9[_0x8934('0x42')]['id']){delete _0xa35ac9[_0x8934('0x42')]['id'];}return db[_0x8934('0x26')][_0x8934('0x40')]({'where':{'id':_0xa35ac9[_0x8934('0x3e')]['id']}})[_0x8934('0x21')](handleEntityNotFound(_0x5991fc,null))[_0x8934('0x21')](saveUpdates(_0xa35ac9[_0x8934('0x42')],null))[_0x8934('0x21')](respondWithResult(_0x5991fc,null))[_0x8934('0x43')](handleError(_0x5991fc,null));};exports[_0x8934('0x22')]=function(_0xe212bc,_0x2c322d){return db[_0x8934('0x26')][_0x8934('0x40')]({'where':{'id':_0xe212bc[_0x8934('0x3e')]['id']}})[_0x8934('0x21')](handleEntityNotFound(_0x2c322d,null))[_0x8934('0x21')](removeEntity(_0x2c322d,null))['catch'](handleError(_0x2c322d,null));};
\ No newline at end of file
+var _0x0c19=['rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','key','field','merge','options','findAll','rows','catch','show','params','includeAll','find','create','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/utils','../../mysqldb','end','json','count','offset','limit','status','set','Content-Range','reject','save','then','destroy','error','stack','name','send','Integration'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0x0c19,0xf5));var _0x90c1=function(_0x223a7c,_0x390977){_0x223a7c=_0x223a7c-0x0;var _0x535ac8=_0x0c19[_0x223a7c];return _0x535ac8;};'use strict';var pdf=require(_0x90c1('0x0'));var emlformat=require(_0x90c1('0x1'));var rimraf=require(_0x90c1('0x2'));var zipdir=require(_0x90c1('0x3'));var jsonpatch=require(_0x90c1('0x4'));var rp=require(_0x90c1('0x5'));var moment=require('moment');var BPromise=require(_0x90c1('0x6'));var Mustache=require(_0x90c1('0x7'));var util=require(_0x90c1('0x8'));var path=require('path');var sox=require(_0x90c1('0x9'));var csv=require(_0x90c1('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x90c1('0xb'));var squel=require(_0x90c1('0xc'));var crypto=require(_0x90c1('0xd'));var jsforce=require(_0x90c1('0xe'));var deskjs=require(_0x90c1('0xf'));var toCsv=require(_0x90c1('0xa'));var querystring=require(_0x90c1('0x10'));var Papa=require('papaparse');var authService=require(_0x90c1('0x11'));var hardwareService=require(_0x90c1('0x12'));var Redis=require('ioredis');var qs=require(_0x90c1('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x90c1('0x14'));var config=require('../../config/environment');var db=require(_0x90c1('0x15'))['db'];function respondWithStatusCode(_0x40dd6b,_0x239342){_0x239342=_0x239342||0xcc;return function(_0x2d9964){if(_0x2d9964){return _0x40dd6b['sendStatus'](_0x239342);}return _0x40dd6b['status'](_0x239342)[_0x90c1('0x16')]();};}function respondWithResult(_0x1e76ae,_0x3a49ec){_0x3a49ec=_0x3a49ec||0xc8;return function(_0x3a8b82){if(_0x3a8b82){return _0x1e76ae['status'](_0x3a49ec)[_0x90c1('0x17')](_0x3a8b82);}};}function respondWithFilteredResult(_0x46b951,_0x154cde){return function(_0x139c67){if(_0x139c67){var _0x38fcea=_0x139c67[_0x90c1('0x18')],_0x1cfb86=_0x154cde[_0x90c1('0x19')],_0x4f77bf=_0x154cde[_0x90c1('0x19')]+_0x154cde[_0x90c1('0x1a')],_0x39dc3c;if(_0x4f77bf>=_0x38fcea){_0x4f77bf=_0x38fcea;_0x39dc3c=0xc8;}else{_0x39dc3c=0xce;}_0x46b951[_0x90c1('0x1b')](_0x39dc3c);return _0x46b951[_0x90c1('0x1c')](_0x90c1('0x1d'),_0x1cfb86+'-'+_0x4f77bf+'/'+_0x38fcea)[_0x90c1('0x17')](_0x139c67);}return null;};}function patchUpdates(_0x112aa4){return function(_0x2e6ecb){try{jsonpatch['apply'](_0x2e6ecb,_0x112aa4,!![]);}catch(_0x302ca2){return BPromise[_0x90c1('0x1e')](_0x302ca2);}return _0x2e6ecb[_0x90c1('0x1f')]();};}function saveUpdates(_0x1cd1f6,_0x242331){return function(_0x3c8cc6){if(_0x3c8cc6){return _0x3c8cc6['update'](_0x1cd1f6)[_0x90c1('0x20')](function(_0x5bfe28){return _0x5bfe28;});}return null;};}function removeEntity(_0x299241,_0x490182){return function(_0x4b0480){if(_0x4b0480){return _0x4b0480[_0x90c1('0x21')]()['then'](function(){_0x299241['status'](0xcc)[_0x90c1('0x16')]();});}};}function handleEntityNotFound(_0x5f4c05,_0x4d53fd){return function(_0x36fe37){if(!_0x36fe37){_0x5f4c05['sendStatus'](0x194);}return _0x36fe37;};}function handleError(_0x213cd1,_0x4e9caa){_0x4e9caa=_0x4e9caa||0x1f4;return function(_0x46dad7){logger[_0x90c1('0x22')](_0x46dad7[_0x90c1('0x23')]);if(_0x46dad7[_0x90c1('0x24')]){delete _0x46dad7[_0x90c1('0x24')];}_0x213cd1[_0x90c1('0x1b')](_0x4e9caa)[_0x90c1('0x25')](_0x46dad7);};}exports['index']=function(_0x26ee39,_0x163939){var _0x18d8ab={},_0x12d35d={},_0x3c3a20={'count':0x0,'rows':[]};var _0x3b6a58=db[_0x90c1('0x26')][_0x90c1('0x27')];_0x12d35d[_0x90c1('0x28')]=_[_0x90c1('0x29')](_0x3b6a58);_0x12d35d[_0x90c1('0x2a')]=_[_0x90c1('0x29')](_0x26ee39[_0x90c1('0x2a')]);_0x12d35d[_0x90c1('0x2b')]=_[_0x90c1('0x2c')](_0x12d35d['model'],_0x12d35d[_0x90c1('0x2a')]);_0x18d8ab[_0x90c1('0x2d')]=_[_0x90c1('0x2c')](_0x12d35d[_0x90c1('0x28')],qs[_0x90c1('0x2e')](_0x26ee39[_0x90c1('0x2a')][_0x90c1('0x2e')]));_0x18d8ab[_0x90c1('0x2d')]=_0x18d8ab[_0x90c1('0x2d')][_0x90c1('0x2f')]?_0x18d8ab[_0x90c1('0x2d')]:_0x12d35d['model'];if(!_0x26ee39[_0x90c1('0x2a')][_0x90c1('0x30')](_0x90c1('0x31'))){_0x18d8ab['limit']=qs[_0x90c1('0x1a')](_0x26ee39[_0x90c1('0x2a')][_0x90c1('0x1a')]);_0x18d8ab[_0x90c1('0x19')]=qs[_0x90c1('0x19')](_0x26ee39[_0x90c1('0x2a')][_0x90c1('0x19')]);}_0x18d8ab[_0x90c1('0x32')]=qs[_0x90c1('0x33')](_0x26ee39[_0x90c1('0x2a')][_0x90c1('0x33')]);_0x18d8ab[_0x90c1('0x34')]=qs[_0x90c1('0x2b')](_[_0x90c1('0x35')](_0x26ee39['query'],_0x12d35d[_0x90c1('0x2b')]));if(_0x26ee39[_0x90c1('0x2a')][_0x90c1('0x36')]){_0x18d8ab[_0x90c1('0x34')]=_['merge'](_0x18d8ab['where'],{'$or':_[_0x90c1('0x37')](_0x3b6a58,function(_0x1f3e34){if(_0x1f3e34[_0x90c1('0x38')][_0x90c1('0x39')]!=='VIRTUAL'){var _0x49f3d3={};_0x49f3d3[_0x1f3e34[_0x90c1('0x3a')]]={'$like':'%'+_0x26ee39[_0x90c1('0x2a')][_0x90c1('0x36')]+'%'};return _0x49f3d3;}})});}_0x18d8ab=_[_0x90c1('0x3b')]({},_0x18d8ab,_0x26ee39[_0x90c1('0x3c')]);var _0x5a5ccd={'where':_0x18d8ab['where']};return db['Integration'][_0x90c1('0x18')](_0x5a5ccd)[_0x90c1('0x20')](function(_0xa6de){_0x3c3a20['count']=_0xa6de;if(_0x26ee39[_0x90c1('0x2a')]['includeAll']){_0x18d8ab['include']=[{'all':!![]}];}return db[_0x90c1('0x26')][_0x90c1('0x3d')](_0x18d8ab);})['then'](function(_0x3ace43){_0x3c3a20[_0x90c1('0x3e')]=_0x3ace43;return _0x3c3a20;})[_0x90c1('0x20')](respondWithFilteredResult(_0x163939,_0x18d8ab))[_0x90c1('0x3f')](handleError(_0x163939,null));};exports[_0x90c1('0x40')]=function(_0x275731,_0x55969f){var _0x3fb4ed={'raw':![],'where':{'id':_0x275731[_0x90c1('0x41')]['id']}},_0x4c9d22={};_0x4c9d22[_0x90c1('0x28')]=_[_0x90c1('0x29')](db[_0x90c1('0x26')][_0x90c1('0x27')]);_0x4c9d22[_0x90c1('0x2a')]=_[_0x90c1('0x29')](_0x275731['query']);_0x4c9d22['filters']=_[_0x90c1('0x2c')](_0x4c9d22[_0x90c1('0x28')],_0x4c9d22[_0x90c1('0x2a')]);_0x3fb4ed[_0x90c1('0x2d')]=_[_0x90c1('0x2c')](_0x4c9d22['model'],qs['fields'](_0x275731[_0x90c1('0x2a')][_0x90c1('0x2e')]));_0x3fb4ed['attributes']=_0x3fb4ed[_0x90c1('0x2d')]['length']?_0x3fb4ed['attributes']:_0x4c9d22[_0x90c1('0x28')];if(_0x275731['query'][_0x90c1('0x42')]){_0x3fb4ed['include']=[{'all':!![]}];}_0x3fb4ed=_['merge']({},_0x3fb4ed,_0x275731[_0x90c1('0x3c')]);return db[_0x90c1('0x26')][_0x90c1('0x43')](_0x3fb4ed)[_0x90c1('0x20')](handleEntityNotFound(_0x55969f,null))['then'](respondWithResult(_0x55969f,null))[_0x90c1('0x3f')](handleError(_0x55969f,null));};exports[_0x90c1('0x44')]=function(_0x92d548,_0x3105ac){return db['Integration'][_0x90c1('0x44')](_0x92d548[_0x90c1('0x45')],{})['then'](respondWithResult(_0x3105ac,0xc9))[_0x90c1('0x3f')](handleError(_0x3105ac,null));};exports[_0x90c1('0x46')]=function(_0x19e777,_0x2c8042){if(_0x19e777[_0x90c1('0x45')]['id']){delete _0x19e777['body']['id'];}return db[_0x90c1('0x26')]['find']({'where':{'id':_0x19e777[_0x90c1('0x41')]['id']}})['then'](handleEntityNotFound(_0x2c8042,null))[_0x90c1('0x20')](saveUpdates(_0x19e777[_0x90c1('0x45')],null))[_0x90c1('0x20')](respondWithResult(_0x2c8042,null))[_0x90c1('0x3f')](handleError(_0x2c8042,null));};exports[_0x90c1('0x21')]=function(_0x3aa812,_0x1d00e4){return db[_0x90c1('0x26')][_0x90c1('0x43')]({'where':{'id':_0x3aa812['params']['id']}})[_0x90c1('0x20')](handleEntityNotFound(_0x1d00e4,null))['then'](removeEntity(_0x1d00e4,null))[_0x90c1('0x3f')](handleError(_0x1d00e4,null));};
\ No newline at end of file
index 3bb1627..39774c9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc4aa=['../../config/logger','api','moment','bluebird','define','Integration','integrations','lodash','util'];(function(_0xc0374e,_0x2de1fc){var _0x3cabe1=function(_0x2cfcae){while(--_0x2cfcae){_0xc0374e['push'](_0xc0374e['shift']());}};_0x3cabe1(++_0x2de1fc);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xc4aa[_0x5a776b];return _0xbbef59;};'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 attributes=require('./integration.attributes');module['exports']=function(_0x2f48ed,_0x15b967){return _0x2f48ed[_0xac4a('0x6')](_0xac4a('0x7'),attributes,{'tableName':_0xac4a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x1967=['integrations','util','../../config/logger','api','moment','bluebird','request-promise','./integration.attributes','exports','Integration'];(function(_0x41b744,_0x15edcd){var _0x39410a=function(_0x412e19){while(--_0x412e19){_0x41b744['push'](_0x41b744['shift']());}};_0x39410a(++_0x15edcd);}(_0x1967,0x173));var _0x7196=function(_0x4469b7,_0x24dea2){_0x4469b7=_0x4469b7-0x0;var _0x5232de=_0x1967[_0x4469b7];return _0x5232de;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var attributes=require(_0x7196('0x6'));module[_0x7196('0x7')]=function(_0x458ae8,_0x3ae43f){return _0x458ae8['define'](_0x7196('0x8'),attributes,{'tableName':_0x7196('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 688ee04..376eae5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe2fc=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x188ee2,_0x507bba){var _0x4e1fa2=function(_0x11c526){while(--_0x11c526){_0x188ee2['push'](_0x188ee2['shift']());}};_0x4e1fa2(++_0x507bba);}(_0xe2fc,0x1df));var _0xce2f=function(_0x24ce70,_0x15557b){_0x24ce70=_0x24ce70-0x0;var _0x16651a=_0xe2fc[_0x24ce70];return _0x16651a;};'use strict';var _=require(_0xce2f('0x0'));var util=require('util');var moment=require(_0xce2f('0x1'));var BPromise=require('bluebird');var rs=require(_0xce2f('0x2'));var fs=require('fs');var Redis=require(_0xce2f('0x3'));var db=require(_0xce2f('0x4'))['db'];var utils=require(_0xce2f('0x5'));var logger=require(_0xce2f('0x6'))(_0xce2f('0x7'));var config=require(_0xce2f('0x8'));var jayson=require(_0xce2f('0x9'));var client=jayson[_0xce2f('0xa')][_0xce2f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c0e31,_0x124411,_0x1042a5){return new BPromise(function(_0xb43ce2,_0x3a0b1c){return client['request'](_0x2c0e31,_0x1042a5)[_0xce2f('0xc')](function(_0x3478ce){logger[_0xce2f('0xd')](_0xce2f('0xe'),_0x124411,_0xce2f('0xf'));logger[_0xce2f('0x10')]('Integration,\x20%s,\x20%s,\x20%s',_0x124411,_0xce2f('0xf'),JSON[_0xce2f('0x11')](_0x3478ce));if(_0x3478ce[_0xce2f('0x12')]){if(_0x3478ce[_0xce2f('0x12')][_0xce2f('0x13')]===0x1f4){logger['error'](_0xce2f('0xe'),_0x124411,_0x3478ce[_0xce2f('0x12')][_0xce2f('0x14')]);return _0x3a0b1c(_0x3478ce[_0xce2f('0x12')][_0xce2f('0x14')]);}logger[_0xce2f('0x12')](_0xce2f('0xe'),_0x124411,_0x3478ce[_0xce2f('0x12')]['message']);return _0xb43ce2(_0x3478ce[_0xce2f('0x12')][_0xce2f('0x14')]);}else{logger['info'](_0xce2f('0xe'),_0x124411,_0xce2f('0xf'));_0xb43ce2(_0x3478ce[_0xce2f('0x15')][_0xce2f('0x14')]);}})[_0xce2f('0x16')](function(_0x5939a6){logger[_0xce2f('0x12')](_0xce2f('0xe'),_0x124411,_0x5939a6);_0x3a0b1c(_0x5939a6);});});}
\ No newline at end of file
+var _0x6514=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x168c60,_0x539d96){var _0x29bea4=function(_0x1f7f4e){while(--_0x1f7f4e){_0x168c60['push'](_0x168c60['shift']());}};_0x29bea4(++_0x539d96);}(_0x6514,0x1cc));var _0x4651=function(_0x248873,_0x32cca5){_0x248873=_0x248873-0x0;var _0x28d0c4=_0x6514[_0x248873];return _0x28d0c4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4651('0x0'));var BPromise=require(_0x4651('0x1'));var rs=require(_0x4651('0x2'));var fs=require('fs');var Redis=require(_0x4651('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4651('0x4'));var logger=require('../../config/logger')(_0x4651('0x5'));var config=require(_0x4651('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4651('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5abb06,_0x4db51a,_0x2a5ee4){return new BPromise(function(_0x5466ee,_0x15665c){return client[_0x4651('0x8')](_0x5abb06,_0x2a5ee4)[_0x4651('0x9')](function(_0x38c52e){logger[_0x4651('0xa')](_0x4651('0xb'),_0x4db51a,_0x4651('0xc'));logger['debug'](_0x4651('0xd'),_0x4db51a,_0x4651('0xc'),JSON[_0x4651('0xe')](_0x38c52e));if(_0x38c52e[_0x4651('0xf')]){if(_0x38c52e['error'][_0x4651('0x10')]===0x1f4){logger[_0x4651('0xf')](_0x4651('0xb'),_0x4db51a,_0x38c52e['error']['message']);return _0x15665c(_0x38c52e[_0x4651('0xf')]['message']);}logger['error'](_0x4651('0xb'),_0x4db51a,_0x38c52e[_0x4651('0xf')][_0x4651('0x11')]);return _0x5466ee(_0x38c52e['error'][_0x4651('0x11')]);}else{logger['info']('Integration,\x20%s,\x20%s',_0x4db51a,'request\x20sent');_0x5466ee(_0x38c52e[_0x4651('0x12')]['message']);}})[_0x4651('0x13')](function(_0x25b228){logger[_0x4651('0xf')]('Integration,\x20%s,\x20%s',_0x4db51a,_0x25b228);_0x15665c(_0x25b228);});});}
\ No newline at end of file
index a29f6aa..34c93fb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x68f8=['multer','util','path','connect-timeout','express','../../components/auth/service','get','isAuthenticated','/describe','describe','/:id','show','post','put','delete','destroy','exports'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x68f8,0x154));var _0x868f=function(_0x484ab6,_0x5627a5){_0x484ab6=_0x484ab6-0x0;var _0x333e67=_0x68f8[_0x484ab6];return _0x333e67;};'use strict';var multer=require(_0x868f('0x0'));var util=require(_0x868f('0x1'));var path=require(_0x868f('0x2'));var timeout=require(_0x868f('0x3'));var express=require(_0x868f('0x4'));var router=express['Router']();var auth=require(_0x868f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./integrationReport.controller');router[_0x868f('0x6')]('/',auth[_0x868f('0x7')](),controller['index']);router[_0x868f('0x6')](_0x868f('0x8'),auth['isAuthenticated'](),controller[_0x868f('0x9')]);router[_0x868f('0x6')](_0x868f('0xa'),auth['isAuthenticated'](),controller[_0x868f('0xb')]);router[_0x868f('0xc')]('/',auth[_0x868f('0x7')](),controller['create']);router[_0x868f('0xd')]('/:id',auth[_0x868f('0x7')](),controller['update']);router[_0x868f('0xe')](_0x868f('0xa'),auth['isAuthenticated'](),controller[_0x868f('0xf')]);module[_0x868f('0x10')]=router;
\ No newline at end of file
+var _0x5694=['delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','put'];(function(_0x26ba39,_0x414c2a){var _0x5279a9=function(_0x122f06){while(--_0x122f06){_0x26ba39['push'](_0x26ba39['shift']());}};_0x5279a9(++_0x414c2a);}(_0x5694,0x1ca));var _0x4569=function(_0x22df8d,_0x4b650f){_0x22df8d=_0x22df8d-0x0;var _0x2d099c=_0x5694[_0x22df8d];return _0x2d099c;};'use strict';var multer=require(_0x4569('0x0'));var util=require(_0x4569('0x1'));var path=require(_0x4569('0x2'));var timeout=require(_0x4569('0x3'));var express=require('express');var router=express[_0x4569('0x4')]();var auth=require(_0x4569('0x5'));var interaction=require(_0x4569('0x6'));var config=require('../../config/environment');var controller=require(_0x4569('0x7'));router['get']('/',auth[_0x4569('0x8')](),controller[_0x4569('0x9')]);router[_0x4569('0xa')](_0x4569('0xb'),auth[_0x4569('0x8')](),controller[_0x4569('0xc')]);router[_0x4569('0xa')](_0x4569('0xd'),auth[_0x4569('0x8')](),controller[_0x4569('0xe')]);router['post']('/',auth[_0x4569('0x8')](),controller[_0x4569('0xf')]);router[_0x4569('0x10')](_0x4569('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x4569('0x11')](_0x4569('0xd'),auth[_0x4569('0x8')](),controller['destroy']);module[_0x4569('0x12')]=router;
\ No newline at end of file
index 36562c2..fbd9986 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe38b=['TEXT','ENUM','SENT','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x47430a,_0x2e3f19){var _0x3efc3a=function(_0xcd33b6){while(--_0xcd33b6){_0x47430a['push'](_0x47430a['shift']());}};_0x3efc3a(++_0x2e3f19);}(_0xe38b,0x1a1));var _0xbe38=function(_0x2432d7,_0x15e20e){_0x2432d7=_0x2432d7-0x0;var _0x3bd787=_0xe38b[_0x2432d7];return _0x3bd787;};'use strict';var Sequelize=require(_0xbe38('0x0'));module[_0xbe38('0x1')]={'integration':{'type':Sequelize[_0xbe38('0x2')]},'eventChannel':{'type':Sequelize[_0xbe38('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0xbe38('0x2')]},'integrationId':{'type':Sequelize[_0xbe38('0x3')]},'contacts':{'type':Sequelize[_0xbe38('0x2')]},'uniqueid':{'type':Sequelize[_0xbe38('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xbe38('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xbe38('0x2')]},'membername':{'type':Sequelize[_0xbe38('0x2')]},'agentcalledAt':{'type':Sequelize[_0xbe38('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xbe38('0x3')]},'agentcomplete':{'type':Sequelize[_0xbe38('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xbe38('0x3')]},'reason':{'type':Sequelize[_0xbe38('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xbe38('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xbe38('0x4')]},'agentdump':{'type':Sequelize[_0xbe38('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xbe38('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xbe38('0x3')]},'channelstatedesc':{'type':Sequelize[_0xbe38('0x2')]},'connectedlinenum':{'type':Sequelize[_0xbe38('0x2')]},'connectedlinename':{'type':Sequelize[_0xbe38('0x2')]},'language':{'type':Sequelize[_0xbe38('0x2')]},'accountcode':{'type':Sequelize[_0xbe38('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xbe38('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xbe38('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xbe38('0x2')]},'destcalleridnum':{'type':Sequelize[_0xbe38('0x2')]},'destcalleridname':{'type':Sequelize[_0xbe38('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xbe38('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xbe38('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xbe38('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xbe38('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xbe38('0x2')]},'messageId':{'type':Sequelize[_0xbe38('0x2')]},'inReplyTo':{'type':Sequelize[_0xbe38('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xbe38('0x2')]},'attachment':{'type':Sequelize[_0xbe38('0x6')]},'html':{'type':Sequelize[_0xbe38('0x6')]},'text':{'type':Sequelize[_0xbe38('0x6')]},'status':{'type':Sequelize[_0xbe38('0x7')](_0xbe38('0x8'),'SENDING','RECEIVED','FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xbe38('0x2')]},'appdata':{'type':Sequelize[_0xbe38('0x2')]},'projectId':{'type':Sequelize[_0xbe38('0x3')]}};
\ No newline at end of file
+var _0x05b6=['exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','FAILED','sequelize'];(function(_0x361c98,_0x164150){var _0x424847=function(_0x3c8726){while(--_0x3c8726){_0x361c98['push'](_0x361c98['shift']());}};_0x424847(++_0x164150);}(_0x05b6,0x180));var _0x605b=function(_0x21e97b,_0x65a77f){_0x21e97b=_0x21e97b-0x0;var _0x10ba44=_0x05b6[_0x21e97b];return _0x10ba44;};'use strict';var Sequelize=require(_0x605b('0x0'));module[_0x605b('0x1')]={'integration':{'type':Sequelize[_0x605b('0x2')]},'eventChannel':{'type':Sequelize[_0x605b('0x2')]},'exitStatus':{'type':Sequelize[_0x605b('0x2')]},'ticketId':{'type':Sequelize[_0x605b('0x2')]},'integrationId':{'type':Sequelize[_0x605b('0x3')]},'contacts':{'type':Sequelize[_0x605b('0x2')]},'uniqueid':{'type':Sequelize[_0x605b('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x605b('0x2')]},'interface':{'type':Sequelize[_0x605b('0x2')]},'membername':{'type':Sequelize[_0x605b('0x2')]},'agentcalledAt':{'type':Sequelize[_0x605b('0x4')]},'agentconnectAt':{'type':Sequelize[_0x605b('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x605b('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x605b('0x4')]},'talktime':{'type':Sequelize[_0x605b('0x3')]},'agentacw':{'type':Sequelize[_0x605b('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x605b('0x3')]},'reason':{'type':Sequelize[_0x605b('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x605b('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x605b('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x605b('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x605b('0x2')]},'channelstate':{'type':Sequelize[_0x605b('0x3')]},'channelstatedesc':{'type':Sequelize[_0x605b('0x2')]},'connectedlinenum':{'type':Sequelize[_0x605b('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x605b('0x2')]},'accountcode':{'type':Sequelize[_0x605b('0x2')]},'context':{'type':Sequelize[_0x605b('0x2')]},'exten':{'type':Sequelize[_0x605b('0x2')]},'priority':{'type':Sequelize[_0x605b('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x605b('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x605b('0x2')]},'destcalleridnum':{'type':Sequelize[_0x605b('0x2')]},'destcalleridname':{'type':Sequelize[_0x605b('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x605b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x605b('0x2')]},'destlanguage':{'type':Sequelize[_0x605b('0x2')]},'destaccountcode':{'type':Sequelize[_0x605b('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x605b('0x2')]},'destuniqueid':{'type':Sequelize[_0x605b('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x605b('0x2')]},'from':{'type':Sequelize[_0x605b('0x2')]},'to':{'type':Sequelize[_0x605b('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x605b('0x6')]},'html':{'type':Sequelize[_0x605b('0x6')]},'text':{'type':Sequelize[_0x605b('0x6')]},'status':{'type':Sequelize[_0x605b('0x7')]('SENT',_0x605b('0x8'),_0x605b('0x9'),_0x605b('0xa'))},'url':{'type':Sequelize[_0x605b('0x2')]},'app':{'type':Sequelize[_0x605b('0x2')]},'appdata':{'type':Sequelize[_0x605b('0x2')]},'projectId':{'type':Sequelize['INTEGER']}};
\ No newline at end of file
index 476aa84..2e8bf64 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x760e=['../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','IntegrationReport','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','VIRTUAL','field','include','rows','catch','params','rawAttributes','includeAll','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x760e,0x1a3));var _0xe760=function(_0x123bfe,_0x500614){_0x123bfe=_0x123bfe-0x0;var _0x1cfbc7=_0x760e[_0x123bfe];return _0x1cfbc7;};'use strict';var pdf=require(_0xe760('0x0'));var emlformat=require(_0xe760('0x1'));var rimraf=require(_0xe760('0x2'));var zipdir=require(_0xe760('0x3'));var jsonpatch=require(_0xe760('0x4'));var rp=require(_0xe760('0x5'));var moment=require('moment');var BPromise=require(_0xe760('0x6'));var Mustache=require(_0xe760('0x7'));var util=require(_0xe760('0x8'));var path=require('path');var sox=require(_0xe760('0x9'));var csv=require(_0xe760('0xa'));var ejs=require(_0xe760('0xb'));var fs=require('fs');var _=require(_0xe760('0xc'));var squel=require(_0xe760('0xd'));var crypto=require(_0xe760('0xe'));var jsforce=require(_0xe760('0xf'));var deskjs=require(_0xe760('0x10'));var toCsv=require(_0xe760('0xa'));var querystring=require(_0xe760('0x11'));var Papa=require(_0xe760('0x12'));var authService=require('../../components/auth/service');var hardwareService=require(_0xe760('0x13'));var Redis=require(_0xe760('0x14'));var qs=require(_0xe760('0x15'));var logger=require(_0xe760('0x16'))(_0xe760('0x17'));var utils=require('../../config/utils');var config=require(_0xe760('0x18'));var db=require(_0xe760('0x19'))['db'];function respondWithStatusCode(_0x4629ff,_0x47f36e){_0x47f36e=_0x47f36e||0xcc;return function(_0xa1e225){if(_0xa1e225){return _0x4629ff[_0xe760('0x1a')](_0x47f36e);}return _0x4629ff[_0xe760('0x1b')](_0x47f36e)[_0xe760('0x1c')]();};}function respondWithResult(_0x2c2b50,_0x3acd9b){_0x3acd9b=_0x3acd9b||0xc8;return function(_0x2821a0){if(_0x2821a0){return _0x2c2b50[_0xe760('0x1b')](_0x3acd9b)['json'](_0x2821a0);}};}function respondWithFilteredResult(_0x58d5d4,_0x1144e6){return function(_0x18a604){if(_0x18a604){var _0x5ccfbc=_0x18a604[_0xe760('0x1d')],_0x3dbe7d=_0x1144e6[_0xe760('0x1e')],_0x3b9927=_0x1144e6[_0xe760('0x1e')]+_0x1144e6[_0xe760('0x1f')],_0x4f1a56;if(_0x3b9927>=_0x5ccfbc){_0x3b9927=_0x5ccfbc;_0x4f1a56=0xc8;}else{_0x4f1a56=0xce;}_0x58d5d4[_0xe760('0x1b')](_0x4f1a56);return _0x58d5d4['set'](_0xe760('0x20'),_0x3dbe7d+'-'+_0x3b9927+'/'+_0x5ccfbc)[_0xe760('0x21')](_0x18a604);}return null;};}function patchUpdates(_0x2add3e){return function(_0x178b33){try{jsonpatch[_0xe760('0x22')](_0x178b33,_0x2add3e,!![]);}catch(_0x1803f7){return BPromise[_0xe760('0x23')](_0x1803f7);}return _0x178b33[_0xe760('0x24')]();};}function saveUpdates(_0x210adc,_0x317f12){return function(_0x22f7a4){if(_0x22f7a4){return _0x22f7a4[_0xe760('0x25')](_0x210adc)[_0xe760('0x26')](function(_0x22c02c){return _0x22c02c;});}return null;};}function removeEntity(_0x2fe4d9,_0x1e3965){return function(_0x28d340){if(_0x28d340){return _0x28d340[_0xe760('0x27')]()['then'](function(){_0x2fe4d9[_0xe760('0x1b')](0xcc)[_0xe760('0x1c')]();});}};}function handleEntityNotFound(_0x17862a,_0x5d8aea){return function(_0x2a9b7f){if(!_0x2a9b7f){_0x17862a[_0xe760('0x1a')](0x194);}return _0x2a9b7f;};}function handleError(_0x542355,_0x1f618){_0x1f618=_0x1f618||0x1f4;return function(_0x1884c7){logger[_0xe760('0x28')](_0x1884c7['stack']);if(_0x1884c7[_0xe760('0x29')]){delete _0x1884c7['name'];}_0x542355[_0xe760('0x1b')](_0x1f618)[_0xe760('0x2a')](_0x1884c7);};}exports[_0xe760('0x2b')]=function(_0x44deb4,_0x33a5c2){var _0xb5bee9={},_0x369211={},_0x435e6f={'count':0x0,'rows':[]};var _0x9ccacf=db[_0xe760('0x2c')]['rawAttributes'];_0x369211['model']=_['keys'](_0x9ccacf);_0x369211[_0xe760('0x2d')]=_[_0xe760('0x2e')](_0x44deb4[_0xe760('0x2d')]);_0x369211[_0xe760('0x2f')]=_[_0xe760('0x30')](_0x369211[_0xe760('0x31')],_0x369211['query']);_0xb5bee9['attributes']=_[_0xe760('0x30')](_0x369211[_0xe760('0x31')],qs[_0xe760('0x32')](_0x44deb4[_0xe760('0x2d')][_0xe760('0x32')]));_0xb5bee9[_0xe760('0x33')]=_0xb5bee9[_0xe760('0x33')]['length']?_0xb5bee9[_0xe760('0x33')]:_0x369211[_0xe760('0x31')];if(!_0x44deb4[_0xe760('0x2d')][_0xe760('0x34')]('nolimit')){_0xb5bee9[_0xe760('0x1f')]=qs[_0xe760('0x1f')](_0x44deb4[_0xe760('0x2d')]['limit']);_0xb5bee9['offset']=qs[_0xe760('0x1e')](_0x44deb4[_0xe760('0x2d')][_0xe760('0x1e')]);}_0xb5bee9[_0xe760('0x35')]=qs[_0xe760('0x36')](_0x44deb4['query'][_0xe760('0x36')]);_0xb5bee9[_0xe760('0x37')]=qs['filters'](_[_0xe760('0x38')](_0x44deb4[_0xe760('0x2d')],_0x369211[_0xe760('0x2f')]));if(_0x44deb4['query'][_0xe760('0x39')]){_0xb5bee9[_0xe760('0x37')]=_[_0xe760('0x3a')](_0xb5bee9[_0xe760('0x37')],{'$or':_[_0xe760('0x3b')](_0x9ccacf,function(_0x242640){if(_0x242640[_0xe760('0x3c')]['key']!==_0xe760('0x3d')){var _0xff85b2={};_0xff85b2[_0x242640[_0xe760('0x3e')]]={'$like':'%'+_0x44deb4['query']['filter']+'%'};return _0xff85b2;}})});}_0xb5bee9=_[_0xe760('0x3a')]({},_0xb5bee9,_0x44deb4['options']);var _0x208ec0={'where':_0xb5bee9[_0xe760('0x37')]};return db[_0xe760('0x2c')]['count'](_0x208ec0)['then'](function(_0xab391f){_0x435e6f[_0xe760('0x1d')]=_0xab391f;if(_0x44deb4[_0xe760('0x2d')]['includeAll']){_0xb5bee9[_0xe760('0x3f')]=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0xb5bee9);})[_0xe760('0x26')](function(_0x1a63dc){_0x435e6f[_0xe760('0x40')]=_0x1a63dc;return _0x435e6f;})[_0xe760('0x26')](respondWithFilteredResult(_0x33a5c2,_0xb5bee9))[_0xe760('0x41')](handleError(_0x33a5c2,null));};exports['show']=function(_0x1f9d80,_0xdaf20a){var _0x2d0f60={'raw':![],'where':{'id':_0x1f9d80[_0xe760('0x42')]['id']}},_0x5aca16={};_0x5aca16['model']=_[_0xe760('0x2e')](db[_0xe760('0x2c')][_0xe760('0x43')]);_0x5aca16[_0xe760('0x2d')]=_[_0xe760('0x2e')](_0x1f9d80['query']);_0x5aca16['filters']=_[_0xe760('0x30')](_0x5aca16['model'],_0x5aca16[_0xe760('0x2d')]);_0x2d0f60[_0xe760('0x33')]=_[_0xe760('0x30')](_0x5aca16[_0xe760('0x31')],qs[_0xe760('0x32')](_0x1f9d80['query'][_0xe760('0x32')]));_0x2d0f60['attributes']=_0x2d0f60[_0xe760('0x33')]['length']?_0x2d0f60[_0xe760('0x33')]:_0x5aca16[_0xe760('0x31')];if(_0x1f9d80['query'][_0xe760('0x44')]){_0x2d0f60[_0xe760('0x3f')]=[{'all':!![]}];}_0x2d0f60=_[_0xe760('0x3a')]({},_0x2d0f60,_0x1f9d80[_0xe760('0x45')]);return db['IntegrationReport'][_0xe760('0x46')](_0x2d0f60)[_0xe760('0x26')](handleEntityNotFound(_0xdaf20a,null))[_0xe760('0x26')](respondWithResult(_0xdaf20a,null))[_0xe760('0x41')](handleError(_0xdaf20a,null));};exports[_0xe760('0x47')]=function(_0x492a2c,_0x4be5c8){return db[_0xe760('0x2c')][_0xe760('0x47')](_0x492a2c['body'],{})[_0xe760('0x26')](respondWithResult(_0x4be5c8,0xc9))[_0xe760('0x41')](handleError(_0x4be5c8,null));};exports['update']=function(_0xcb9990,_0x12bd67){if(_0xcb9990[_0xe760('0x48')]['id']){delete _0xcb9990['body']['id'];}return db['IntegrationReport'][_0xe760('0x46')]({'where':{'id':_0xcb9990['params']['id']}})[_0xe760('0x26')](handleEntityNotFound(_0x12bd67,null))[_0xe760('0x26')](saveUpdates(_0xcb9990[_0xe760('0x48')],null))['then'](respondWithResult(_0x12bd67,null))[_0xe760('0x41')](handleError(_0x12bd67,null));};exports['destroy']=function(_0x35efd1,_0x524fb5){return db[_0xe760('0x2c')][_0xe760('0x46')]({'where':{'id':_0x35efd1[_0xe760('0x42')]['id']}})[_0xe760('0x26')](handleEntityNotFound(_0x524fb5,null))[_0xe760('0x26')](removeEntity(_0x524fb5,null))[_0xe760('0x41')](handleError(_0x524fb5,null));};exports[_0xe760('0x49')]=function(_0xe8452a,_0x53ffa4){return db[_0xe760('0x2c')]['describe']()[_0xe760('0x26')](respondWithResult(_0x53ffa4,null))['catch'](handleError(_0x53ffa4,null));};
\ No newline at end of file
+var _0xc29d=['name','index','IntegrationReport','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','merge','type','key','VIRTUAL','field','filter','options','count','includeAll','include','rows','show','params','find','catch','create','update','body','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','save','then','destroy','end','stack'];(function(_0x446e61,_0x27e680){var _0x4160a8=function(_0x1c9171){while(--_0x1c9171){_0x446e61['push'](_0x446e61['shift']());}};_0x4160a8(++_0x27e680);}(_0xc29d,0x68));var _0xdc29=function(_0x16d90f,_0x5f10ff){_0x16d90f=_0x16d90f-0x0;var _0x13e2c1=_0xc29d[_0x16d90f];return _0x13e2c1;};'use strict';var pdf=require(_0xdc29('0x0'));var emlformat=require(_0xdc29('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xdc29('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdc29('0x3'));var moment=require(_0xdc29('0x4'));var BPromise=require(_0xdc29('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xdc29('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xdc29('0x7'));var squel=require(_0xdc29('0x8'));var crypto=require('crypto');var jsforce=require(_0xdc29('0x9'));var deskjs=require(_0xdc29('0xa'));var toCsv=require(_0xdc29('0xb'));var querystring=require(_0xdc29('0xc'));var Papa=require(_0xdc29('0xd'));var authService=require(_0xdc29('0xe'));var hardwareService=require(_0xdc29('0xf'));var Redis=require(_0xdc29('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0xdc29('0x11'))(_0xdc29('0x12'));var utils=require(_0xdc29('0x13'));var config=require(_0xdc29('0x14'));var db=require(_0xdc29('0x15'))['db'];function respondWithStatusCode(_0x3c6d62,_0x4df0af){_0x4df0af=_0x4df0af||0xcc;return function(_0x4abba9){if(_0x4abba9){return _0x3c6d62[_0xdc29('0x16')](_0x4df0af);}return _0x3c6d62[_0xdc29('0x17')](_0x4df0af)['end']();};}function respondWithResult(_0x198246,_0xd3b113){_0xd3b113=_0xd3b113||0xc8;return function(_0x3f9f8f){if(_0x3f9f8f){return _0x198246[_0xdc29('0x17')](_0xd3b113)[_0xdc29('0x18')](_0x3f9f8f);}};}function respondWithFilteredResult(_0xc71648,_0x2690e0){return function(_0x2cb729){if(_0x2cb729){var _0x496fbc=_0x2cb729['count'],_0x1c0992=_0x2690e0[_0xdc29('0x19')],_0x56464f=_0x2690e0[_0xdc29('0x19')]+_0x2690e0[_0xdc29('0x1a')],_0x5063f9;if(_0x56464f>=_0x496fbc){_0x56464f=_0x496fbc;_0x5063f9=0xc8;}else{_0x5063f9=0xce;}_0xc71648['status'](_0x5063f9);return _0xc71648[_0xdc29('0x1b')](_0xdc29('0x1c'),_0x1c0992+'-'+_0x56464f+'/'+_0x496fbc)['json'](_0x2cb729);}return null;};}function patchUpdates(_0x5de4fb){return function(_0xa8bd9d){try{jsonpatch['apply'](_0xa8bd9d,_0x5de4fb,!![]);}catch(_0x8a983c){return BPromise['reject'](_0x8a983c);}return _0xa8bd9d[_0xdc29('0x1d')]();};}function saveUpdates(_0x35bb53,_0x31c645){return function(_0x4eed66){if(_0x4eed66){return _0x4eed66['update'](_0x35bb53)[_0xdc29('0x1e')](function(_0x3039bd){return _0x3039bd;});}return null;};}function removeEntity(_0x11f87c,_0x3500b0){return function(_0x1d39f9){if(_0x1d39f9){return _0x1d39f9[_0xdc29('0x1f')]()[_0xdc29('0x1e')](function(){_0x11f87c['status'](0xcc)[_0xdc29('0x20')]();});}};}function handleEntityNotFound(_0x5867c8,_0x36b8d7){return function(_0x18217f){if(!_0x18217f){_0x5867c8['sendStatus'](0x194);}return _0x18217f;};}function handleError(_0x23dced,_0x2407f8){_0x2407f8=_0x2407f8||0x1f4;return function(_0x351f88){logger['error'](_0x351f88[_0xdc29('0x21')]);if(_0x351f88[_0xdc29('0x22')]){delete _0x351f88['name'];}_0x23dced['status'](_0x2407f8)['send'](_0x351f88);};}exports[_0xdc29('0x23')]=function(_0x6600b8,_0x518b87){var _0x5f286d={},_0x42c95a={},_0x24e8d0={'count':0x0,'rows':[]};var _0x3fabf9=db[_0xdc29('0x24')][_0xdc29('0x25')];_0x42c95a[_0xdc29('0x26')]=_[_0xdc29('0x27')](_0x3fabf9);_0x42c95a['query']=_[_0xdc29('0x27')](_0x6600b8[_0xdc29('0x28')]);_0x42c95a[_0xdc29('0x29')]=_['intersection'](_0x42c95a[_0xdc29('0x26')],_0x42c95a[_0xdc29('0x28')]);_0x5f286d[_0xdc29('0x2a')]=_[_0xdc29('0x2b')](_0x42c95a['model'],qs[_0xdc29('0x2c')](_0x6600b8[_0xdc29('0x28')][_0xdc29('0x2c')]));_0x5f286d['attributes']=_0x5f286d[_0xdc29('0x2a')][_0xdc29('0x2d')]?_0x5f286d[_0xdc29('0x2a')]:_0x42c95a['model'];if(!_0x6600b8[_0xdc29('0x28')][_0xdc29('0x2e')](_0xdc29('0x2f'))){_0x5f286d[_0xdc29('0x1a')]=qs[_0xdc29('0x1a')](_0x6600b8[_0xdc29('0x28')]['limit']);_0x5f286d[_0xdc29('0x19')]=qs['offset'](_0x6600b8[_0xdc29('0x28')][_0xdc29('0x19')]);}_0x5f286d['order']=qs[_0xdc29('0x30')](_0x6600b8[_0xdc29('0x28')][_0xdc29('0x30')]);_0x5f286d[_0xdc29('0x31')]=qs['filters'](_['pick'](_0x6600b8['query'],_0x42c95a['filters']));if(_0x6600b8[_0xdc29('0x28')]['filter']){_0x5f286d[_0xdc29('0x31')]=_[_0xdc29('0x32')](_0x5f286d[_0xdc29('0x31')],{'$or':_['map'](_0x3fabf9,function(_0x518e8f){if(_0x518e8f[_0xdc29('0x33')][_0xdc29('0x34')]!==_0xdc29('0x35')){var _0x1f2f2f={};_0x1f2f2f[_0x518e8f[_0xdc29('0x36')]]={'$like':'%'+_0x6600b8['query'][_0xdc29('0x37')]+'%'};return _0x1f2f2f;}})});}_0x5f286d=_[_0xdc29('0x32')]({},_0x5f286d,_0x6600b8[_0xdc29('0x38')]);var _0x50b527={'where':_0x5f286d[_0xdc29('0x31')]};return db[_0xdc29('0x24')][_0xdc29('0x39')](_0x50b527)[_0xdc29('0x1e')](function(_0x1ef068){_0x24e8d0['count']=_0x1ef068;if(_0x6600b8[_0xdc29('0x28')][_0xdc29('0x3a')]){_0x5f286d[_0xdc29('0x3b')]=[{'all':!![]}];}return db[_0xdc29('0x24')]['findAll'](_0x5f286d);})['then'](function(_0x50716c){_0x24e8d0[_0xdc29('0x3c')]=_0x50716c;return _0x24e8d0;})['then'](respondWithFilteredResult(_0x518b87,_0x5f286d))['catch'](handleError(_0x518b87,null));};exports[_0xdc29('0x3d')]=function(_0x5d35bb,_0xcde07c){var _0x9c9332={'raw':![],'where':{'id':_0x5d35bb[_0xdc29('0x3e')]['id']}},_0x5a578a={};_0x5a578a[_0xdc29('0x26')]=_[_0xdc29('0x27')](db[_0xdc29('0x24')][_0xdc29('0x25')]);_0x5a578a['query']=_[_0xdc29('0x27')](_0x5d35bb['query']);_0x5a578a['filters']=_['intersection'](_0x5a578a['model'],_0x5a578a[_0xdc29('0x28')]);_0x9c9332[_0xdc29('0x2a')]=_['intersection'](_0x5a578a[_0xdc29('0x26')],qs['fields'](_0x5d35bb[_0xdc29('0x28')][_0xdc29('0x2c')]));_0x9c9332[_0xdc29('0x2a')]=_0x9c9332[_0xdc29('0x2a')]['length']?_0x9c9332[_0xdc29('0x2a')]:_0x5a578a[_0xdc29('0x26')];if(_0x5d35bb[_0xdc29('0x28')][_0xdc29('0x3a')]){_0x9c9332[_0xdc29('0x3b')]=[{'all':!![]}];}_0x9c9332=_['merge']({},_0x9c9332,_0x5d35bb['options']);return db[_0xdc29('0x24')][_0xdc29('0x3f')](_0x9c9332)[_0xdc29('0x1e')](handleEntityNotFound(_0xcde07c,null))[_0xdc29('0x1e')](respondWithResult(_0xcde07c,null))[_0xdc29('0x40')](handleError(_0xcde07c,null));};exports[_0xdc29('0x41')]=function(_0x11ed31,_0x56d296){return db['IntegrationReport'][_0xdc29('0x41')](_0x11ed31['body'],{})[_0xdc29('0x1e')](respondWithResult(_0x56d296,0xc9))[_0xdc29('0x40')](handleError(_0x56d296,null));};exports[_0xdc29('0x42')]=function(_0x4bb456,_0x4ec9fd){if(_0x4bb456[_0xdc29('0x43')]['id']){delete _0x4bb456[_0xdc29('0x43')]['id'];}return db[_0xdc29('0x24')]['find']({'where':{'id':_0x4bb456[_0xdc29('0x3e')]['id']}})[_0xdc29('0x1e')](handleEntityNotFound(_0x4ec9fd,null))['then'](saveUpdates(_0x4bb456[_0xdc29('0x43')],null))[_0xdc29('0x1e')](respondWithResult(_0x4ec9fd,null))[_0xdc29('0x40')](handleError(_0x4ec9fd,null));};exports[_0xdc29('0x1f')]=function(_0x4ec2db,_0x54eb49){return db[_0xdc29('0x24')][_0xdc29('0x3f')]({'where':{'id':_0x4ec2db['params']['id']}})['then'](handleEntityNotFound(_0x54eb49,null))[_0xdc29('0x1e')](removeEntity(_0x54eb49,null))[_0xdc29('0x40')](handleError(_0x54eb49,null));};exports[_0xdc29('0x44')]=function(_0x5a7a82,_0x8cd118){return db[_0xdc29('0x24')]['describe']()['then'](respondWithResult(_0x8cd118,null))[_0xdc29('0x40')](handleError(_0x8cd118,null));};
\ No newline at end of file
index 12c8b8c..3b2f168 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','./integrationReport.attributes','define'];(function(_0x23f642,_0x3c8f66){var _0x4ba0d0=function(_0x507a88){while(--_0x507a88){_0x23f642['push'](_0x23f642['shift']());}};_0x4ba0d0(++_0x3c8f66);}(_0x5fc3,0xa8));var _0x35fc=function(_0x53b594,_0x559767){_0x53b594=_0x53b594-0x0;var _0x1e616f=_0x5fc3[_0x53b594];return _0x1e616f;};'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 attributes=require(_0x35fc('0x6'));module['exports']=function(_0x2d1404,_0x1d5fec){return _0x2d1404[_0x35fc('0x7')]('IntegrationReport',attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x3831=['bluebird','request-promise','exports','lodash','../../config/logger','api','moment'];(function(_0x568455,_0x327088){var _0x233cf7=function(_0x4fa871){while(--_0x4fa871){_0x568455['push'](_0x568455['shift']());}};_0x233cf7(++_0x327088);}(_0x3831,0x14c));var _0x1383=function(_0x51f4fc,_0x1fe3ef){_0x51f4fc=_0x51f4fc-0x0;var _0x4d96fc=_0x3831[_0x51f4fc];return _0x4d96fc;};'use strict';var _=require(_0x1383('0x0'));var util=require('util');var logger=require(_0x1383('0x1'))(_0x1383('0x2'));var moment=require(_0x1383('0x3'));var BPromise=require(_0x1383('0x4'));var rp=require(_0x1383('0x5'));var attributes=require('./integrationReport.attributes');module[_0x1383('0x6')]=function(_0x573874,_0x21ea2c){return _0x573874['define']('IntegrationReport',attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index c345cda..19214b5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6147=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','IntegrationReport,\x20%s,\x20%s','message','result'];(function(_0x3be61a,_0x3df6ab){var _0x519072=function(_0x1ee1fa){while(--_0x1ee1fa){_0x3be61a['push'](_0x3be61a['shift']());}};_0x519072(++_0x3df6ab);}(_0x6147,0xf2));var _0x7614=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x6147[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0x7614('0x0'));var util=require(_0x7614('0x1'));var moment=require(_0x7614('0x2'));var BPromise=require(_0x7614('0x3'));var rs=require(_0x7614('0x4'));var fs=require('fs');var Redis=require(_0x7614('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7614('0x6'));var logger=require(_0x7614('0x7'))(_0x7614('0x8'));var config=require('../../config/environment');var jayson=require(_0x7614('0x9'));var client=jayson['client'][_0x7614('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49a9ff,_0x39b1e7,_0x33d1a4){return new BPromise(function(_0x1726fa,_0x4c2b49){return client[_0x7614('0xb')](_0x49a9ff,_0x33d1a4)[_0x7614('0xc')](function(_0x4463e2){logger[_0x7614('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x39b1e7,_0x7614('0xe'));logger[_0x7614('0xf')](_0x7614('0x10'),_0x39b1e7,_0x7614('0xe'),JSON[_0x7614('0x11')](_0x4463e2));if(_0x4463e2['error']){if(_0x4463e2[_0x7614('0x12')]['code']===0x1f4){logger[_0x7614('0x12')](_0x7614('0x13'),_0x39b1e7,_0x4463e2[_0x7614('0x12')][_0x7614('0x14')]);return _0x4c2b49(_0x4463e2[_0x7614('0x12')]['message']);}logger[_0x7614('0x12')](_0x7614('0x13'),_0x39b1e7,_0x4463e2['error'][_0x7614('0x14')]);return _0x1726fa(_0x4463e2['error'][_0x7614('0x14')]);}else{logger[_0x7614('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x39b1e7,_0x7614('0xe'));_0x1726fa(_0x4463e2[_0x7614('0x15')][_0x7614('0x14')]);}})['catch'](function(_0x609a2a){logger[_0x7614('0x12')](_0x7614('0x13'),_0x39b1e7,_0x609a2a);_0x4c2b49(_0x609a2a);});});}
\ No newline at end of file
+var _0xd2fb=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','IntegrationReport,\x20%s,\x20%s','result','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x54ad2b,_0x40395c){var _0x57361b=function(_0x517240){while(--_0x517240){_0x54ad2b['push'](_0x54ad2b['shift']());}};_0x57361b(++_0x40395c);}(_0xd2fb,0xaa));var _0xbd2f=function(_0x465f16,_0x2fdc9e){_0x465f16=_0x465f16-0x0;var _0x236a11=_0xd2fb[_0x465f16];return _0x236a11;};'use strict';var _=require(_0xbd2f('0x0'));var util=require(_0xbd2f('0x1'));var moment=require(_0xbd2f('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd2f('0x3'));var fs=require('fs');var Redis=require(_0xbd2f('0x4'));var db=require(_0xbd2f('0x5'))['db'];var utils=require(_0xbd2f('0x6'));var logger=require(_0xbd2f('0x7'))(_0xbd2f('0x8'));var config=require('../../config/environment');var jayson=require(_0xbd2f('0x9'));var client=jayson['client'][_0xbd2f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3875a4,_0xcd84ed,_0x44ac7d){return new BPromise(function(_0x5cf5c1,_0x2a30e2){return client[_0xbd2f('0xb')](_0x3875a4,_0x44ac7d)[_0xbd2f('0xc')](function(_0x3ba62b){logger[_0xbd2f('0xd')]('IntegrationReport,\x20%s,\x20%s',_0xcd84ed,'request\x20sent');logger[_0xbd2f('0xe')](_0xbd2f('0xf'),_0xcd84ed,_0xbd2f('0x10'),JSON[_0xbd2f('0x11')](_0x3ba62b));if(_0x3ba62b['error']){if(_0x3ba62b[_0xbd2f('0x12')]['code']===0x1f4){logger['error']('IntegrationReport,\x20%s,\x20%s',_0xcd84ed,_0x3ba62b[_0xbd2f('0x12')]['message']);return _0x2a30e2(_0x3ba62b[_0xbd2f('0x12')][_0xbd2f('0x13')]);}logger['error'](_0xbd2f('0x14'),_0xcd84ed,_0x3ba62b[_0xbd2f('0x12')][_0xbd2f('0x13')]);return _0x5cf5c1(_0x3ba62b[_0xbd2f('0x12')][_0xbd2f('0x13')]);}else{logger['info'](_0xbd2f('0x14'),_0xcd84ed,'request\x20sent');_0x5cf5c1(_0x3ba62b[_0xbd2f('0x15')][_0xbd2f('0x13')]);}})['catch'](function(_0x2f90fc){logger[_0xbd2f('0x12')](_0xbd2f('0x14'),_0xcd84ed,_0x2f90fc);_0x2a30e2(_0x2f90fc);});});}
\ No newline at end of file
index fd6ca90..5677f4a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd290=['multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','create','post','addIntervals','put','delete','destroy','exports'];(function(_0xe8b0db,_0x14d346){var _0x5cd46f=function(_0x365ca9){while(--_0x365ca9){_0xe8b0db['push'](_0xe8b0db['shift']());}};_0x5cd46f(++_0x14d346);}(_0xd290,0x165));var _0x0d29=function(_0x10a51c,_0x2ace0a){_0x10a51c=_0x10a51c-0x0;var _0xaf3bfc=_0xd290[_0x10a51c];return _0xaf3bfc;};'use strict';var multer=require(_0x0d29('0x0'));var util=require(_0x0d29('0x1'));var path=require('path');var timeout=require(_0x0d29('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x0d29('0x3'));var interaction=require(_0x0d29('0x4'));var config=require(_0x0d29('0x5'));var controller=require(_0x0d29('0x6'));router[_0x0d29('0x7')]('/',auth['isAuthenticated'](),controller[_0x0d29('0x8')]);router[_0x0d29('0x7')](_0x0d29('0x9'),auth[_0x0d29('0xa')](),controller[_0x0d29('0xb')]);router['get'](_0x0d29('0xc'),auth[_0x0d29('0xa')](),controller[_0x0d29('0xd')]);router['post']('/',auth[_0x0d29('0xa')](),controller[_0x0d29('0xe')]);router['post'](_0x0d29('0xc'),auth[_0x0d29('0xa')](),controller['addInterval']);router[_0x0d29('0xf')]('/:id/sub_intervals/create_many',auth[_0x0d29('0xa')](),controller[_0x0d29('0x10')]);router[_0x0d29('0x11')](_0x0d29('0x9'),auth[_0x0d29('0xa')](),controller['update']);router[_0x0d29('0x12')](_0x0d29('0x9'),auth[_0x0d29('0xa')](),controller[_0x0d29('0x13')]);module[_0x0d29('0x14')]=router;
\ No newline at end of file
+var _0xaac7=['destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','getIntervals','post','create','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','update','delete'];(function(_0x945559,_0x2cc7fd){var _0x4f4948=function(_0x239758){while(--_0x239758){_0x945559['push'](_0x945559['shift']());}};_0x4f4948(++_0x2cc7fd);}(_0xaac7,0x122));var _0x7aac=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0xaac7[_0x9fd887];return _0x1a54ab;};'use strict';var multer=require(_0x7aac('0x0'));var util=require(_0x7aac('0x1'));var path=require(_0x7aac('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7aac('0x3')]();var auth=require(_0x7aac('0x4'));var interaction=require(_0x7aac('0x5'));var config=require(_0x7aac('0x6'));var controller=require(_0x7aac('0x7'));router[_0x7aac('0x8')]('/',auth[_0x7aac('0x9')](),controller[_0x7aac('0xa')]);router[_0x7aac('0x8')](_0x7aac('0xb'),auth[_0x7aac('0x9')](),controller[_0x7aac('0xc')]);router[_0x7aac('0x8')]('/:id/sub_intervals',auth[_0x7aac('0x9')](),controller[_0x7aac('0xd')]);router[_0x7aac('0xe')]('/',auth[_0x7aac('0x9')](),controller[_0x7aac('0xf')]);router[_0x7aac('0xe')](_0x7aac('0x10'),auth['isAuthenticated'](),controller[_0x7aac('0x11')]);router[_0x7aac('0xe')](_0x7aac('0x12'),auth[_0x7aac('0x9')](),controller[_0x7aac('0x13')]);router['put'](_0x7aac('0xb'),auth[_0x7aac('0x9')](),controller[_0x7aac('0x14')]);router[_0x7aac('0x15')]('/:id',auth[_0x7aac('0x9')](),controller[_0x7aac('0x16')]);module[_0x7aac('0x17')]=router;
\ No newline at end of file
index 60d2c44..de1a9f7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0cb6=['sequelize','exports','STRING'];(function(_0x24df0f,_0x3afdfe){var _0x424c75=function(_0x1e8064){while(--_0x1e8064){_0x24df0f['push'](_0x24df0f['shift']());}};_0x424c75(++_0x3afdfe);}(_0x0cb6,0xb7));var _0x60cb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0cb6[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x60cb('0x0'));module[_0x60cb('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x60cb('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}};
\ No newline at end of file
+var _0x39f8=['STRING','sequelize','exports'];(function(_0x88d253,_0x54b667){var _0x37d7fa=function(_0x540fc8){while(--_0x540fc8){_0x88d253['push'](_0x88d253['shift']());}};_0x37d7fa(++_0x54b667);}(_0x39f8,0x70));var _0x839f=function(_0x2e0f4d,_0x22243d){_0x2e0f4d=_0x2e0f4d-0x0;var _0x3b34b5=_0x39f8[_0x2e0f4d];return _0x3b34b5;};'use strict';var Sequelize=require(_0x839f('0x0'));module[_0x839f('0x1')]={'name':{'type':Sequelize[_0x839f('0x2')]},'description':{'type':Sequelize[_0x839f('0x2')]},'interval':{'type':Sequelize[_0x839f('0x2')],'allowNull':!![]}};
\ No newline at end of file
index edf70cf..89d743e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x85b5=['Intervals','UserProfileSection','find','userProfileId','autoAssociation','name','update','params','addInterval','IntervalId','getIntervals','findOne','order','pick','map','hasOwnProperty','addIntervals','sequelize','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','then','get','error','stack','send','index','Interval','rawAttributes','keys','query','filters','intersection','model','attributes','fields','nolimit','sort','where','type','key','VIRTUAL','field','filter','options','includeAll','include','findAll','rows','show','length','merge','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user'];(function(_0x4c5708,_0x34b1f9){var _0x37fa9b=function(_0x534dc4){while(--_0x534dc4){_0x4c5708['push'](_0x4c5708['shift']());}};_0x37fa9b(++_0x34b1f9);}(_0x85b5,0xcc));var _0x585b=function(_0x300ac7,_0xe1df87){_0x300ac7=_0x300ac7-0x0;var _0x57b19f=_0x85b5[_0x300ac7];return _0x57b19f;};'use strict';var pdf=require(_0x585b('0x0'));var emlformat=require(_0x585b('0x1'));var rimraf=require(_0x585b('0x2'));var zipdir=require(_0x585b('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x585b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x585b('0x5'));var util=require(_0x585b('0x6'));var path=require(_0x585b('0x7'));var sox=require(_0x585b('0x8'));var csv=require(_0x585b('0x9'));var ejs=require(_0x585b('0xa'));var fs=require('fs');var _=require(_0x585b('0xb'));var squel=require(_0x585b('0xc'));var crypto=require(_0x585b('0xd'));var jsforce=require(_0x585b('0xe'));var deskjs=require(_0x585b('0xf'));var toCsv=require(_0x585b('0x9'));var querystring=require(_0x585b('0x10'));var Papa=require(_0x585b('0x11'));var authService=require(_0x585b('0x12'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x585b('0x13'));var qs=require('../../components/parsers/qs');var logger=require(_0x585b('0x14'))(_0x585b('0x15'));var utils=require(_0x585b('0x16'));var config=require(_0x585b('0x17'));var db=require(_0x585b('0x18'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x51db1b,_0x544538){_0x544538=_0x544538||0xcc;return function(_0x5c36e1){if(_0x5c36e1){return _0x51db1b[_0x585b('0x19')](_0x544538);}return _0x51db1b[_0x585b('0x1a')](_0x544538)[_0x585b('0x1b')]();};}function respondWithResult(_0x188e2c,_0x4fce4c){_0x4fce4c=_0x4fce4c||0xc8;return function(_0x41e371){if(_0x41e371){return _0x188e2c['status'](_0x4fce4c)['json'](_0x41e371);}};}function respondWithFilteredResult(_0xc87de1,_0x7a00a4){return function(_0x3d4241){if(_0x3d4241){var _0x2eefc3=_0x3d4241[_0x585b('0x1c')],_0x3fcbeb=_0x7a00a4[_0x585b('0x1d')],_0x27a84a=_0x7a00a4[_0x585b('0x1d')]+_0x7a00a4[_0x585b('0x1e')],_0x2a896e;if(_0x27a84a>=_0x2eefc3){_0x27a84a=_0x2eefc3;_0x2a896e=0xc8;}else{_0x2a896e=0xce;}_0xc87de1[_0x585b('0x1a')](_0x2a896e);return _0xc87de1[_0x585b('0x1f')](_0x585b('0x20'),_0x3fcbeb+'-'+_0x27a84a+'/'+_0x2eefc3)[_0x585b('0x21')](_0x3d4241);}return null;};}function patchUpdates(_0x1f33f8){return function(_0x52115d){try{jsonpatch[_0x585b('0x22')](_0x52115d,_0x1f33f8,!![]);}catch(_0x2e2bc2){return BPromise[_0x585b('0x23')](_0x2e2bc2);}return _0x52115d[_0x585b('0x24')]();};}function saveUpdates(_0x18cf82,_0x530f9f){return function(_0xbc0dd0){if(_0xbc0dd0){return _0xbc0dd0['update'](_0x18cf82)['then'](function(_0x530ba5){return _0x530ba5;});}return null;};}function removeEntity(_0x22dbb7,_0x493a8c){return function(_0x494cb6){if(_0x494cb6){return _0x494cb6[_0x585b('0x25')]()[_0x585b('0x26')](function(){var _0x30bf11=_0x494cb6[_0x585b('0x27')]({'plain':!![]});var _0x495a6a='Intervals';return db['UserProfileResource'][_0x585b('0x25')]({'where':{'type':_0x495a6a,'resourceId':_0x30bf11['id']}})[_0x585b('0x26')](function(){return _0x494cb6;});})['then'](function(){_0x22dbb7['status'](0xcc)[_0x585b('0x1b')]();});}};}function handleEntityNotFound(_0x2dfa58,_0x41eb54){return function(_0x2dc1b9){if(!_0x2dc1b9){_0x2dfa58[_0x585b('0x19')](0x194);}return _0x2dc1b9;};}function handleError(_0x3becb3,_0x2004c1){_0x2004c1=_0x2004c1||0x1f4;return function(_0x1e566a){logger[_0x585b('0x28')](_0x1e566a[_0x585b('0x29')]);if(_0x1e566a['name']){delete _0x1e566a['name'];}_0x3becb3['status'](_0x2004c1)[_0x585b('0x2a')](_0x1e566a);};}exports[_0x585b('0x2b')]=function(_0x4ba204,_0x315577){var _0x40476b={},_0x9d8813={},_0x597827={'count':0x0,'rows':[]};var _0x3dda6a=db[_0x585b('0x2c')][_0x585b('0x2d')];_0x9d8813['model']=_['keys'](_0x3dda6a);_0x9d8813['query']=_[_0x585b('0x2e')](_0x4ba204[_0x585b('0x2f')]);_0x9d8813[_0x585b('0x30')]=_[_0x585b('0x31')](_0x9d8813[_0x585b('0x32')],_0x9d8813['query']);_0x40476b[_0x585b('0x33')]=_[_0x585b('0x31')](_0x9d8813['model'],qs[_0x585b('0x34')](_0x4ba204[_0x585b('0x2f')][_0x585b('0x34')]));_0x40476b[_0x585b('0x33')]=_0x40476b[_0x585b('0x33')]['length']?_0x40476b[_0x585b('0x33')]:_0x9d8813[_0x585b('0x32')];if(!_0x4ba204[_0x585b('0x2f')]['hasOwnProperty'](_0x585b('0x35'))){_0x40476b[_0x585b('0x1e')]=qs[_0x585b('0x1e')](_0x4ba204[_0x585b('0x2f')][_0x585b('0x1e')]);_0x40476b[_0x585b('0x1d')]=qs[_0x585b('0x1d')](_0x4ba204[_0x585b('0x2f')][_0x585b('0x1d')]);}_0x40476b['order']=qs[_0x585b('0x36')](_0x4ba204['query']['sort']);_0x40476b[_0x585b('0x37')]=qs[_0x585b('0x30')](_['pick'](_0x4ba204[_0x585b('0x2f')],_0x9d8813[_0x585b('0x30')]));if(_0x4ba204[_0x585b('0x2f')]['filter']){_0x40476b[_0x585b('0x37')]=_['merge'](_0x40476b['where'],{'$or':_['map'](_0x3dda6a,function(_0x24534e){if(_0x24534e[_0x585b('0x38')][_0x585b('0x39')]!==_0x585b('0x3a')){var _0x1b2b2d={};_0x1b2b2d[_0x24534e[_0x585b('0x3b')]]={'$like':'%'+_0x4ba204[_0x585b('0x2f')][_0x585b('0x3c')]+'%'};return _0x1b2b2d;}})});}_0x40476b=_['merge']({},_0x40476b,_0x4ba204[_0x585b('0x3d')]);var _0x1974b6={'where':_0x40476b['where']};return db[_0x585b('0x2c')]['count'](_0x1974b6)['then'](function(_0x118670){_0x597827[_0x585b('0x1c')]=_0x118670;if(_0x4ba204[_0x585b('0x2f')][_0x585b('0x3e')]){_0x40476b[_0x585b('0x3f')]=[{'all':!![]}];}return db['Interval'][_0x585b('0x40')](_0x40476b);})[_0x585b('0x26')](function(_0x311429){_0x597827[_0x585b('0x41')]=_0x311429;return _0x597827;})['then'](respondWithFilteredResult(_0x315577,_0x40476b))['catch'](handleError(_0x315577,null));};exports[_0x585b('0x42')]=function(_0x5d8bf8,_0x4ad68a){var _0x953946={'raw':!![],'where':{'id':_0x5d8bf8['params']['id']}},_0x3b63c1={};_0x3b63c1[_0x585b('0x32')]=_[_0x585b('0x2e')](db[_0x585b('0x2c')][_0x585b('0x2d')]);_0x3b63c1[_0x585b('0x2f')]=_[_0x585b('0x2e')](_0x5d8bf8[_0x585b('0x2f')]);_0x3b63c1[_0x585b('0x30')]=_[_0x585b('0x31')](_0x3b63c1[_0x585b('0x32')],_0x3b63c1['query']);_0x953946[_0x585b('0x33')]=_['intersection'](_0x3b63c1[_0x585b('0x32')],qs[_0x585b('0x34')](_0x5d8bf8[_0x585b('0x2f')][_0x585b('0x34')]));_0x953946[_0x585b('0x33')]=_0x953946[_0x585b('0x33')][_0x585b('0x43')]?_0x953946[_0x585b('0x33')]:_0x3b63c1[_0x585b('0x32')];if(_0x5d8bf8[_0x585b('0x2f')]['includeAll']){_0x953946[_0x585b('0x3f')]=[{'all':!![]}];}_0x953946=_[_0x585b('0x44')]({},_0x953946,_0x5d8bf8[_0x585b('0x3d')]);return db[_0x585b('0x2c')]['find'](_0x953946)[_0x585b('0x26')](handleEntityNotFound(_0x4ad68a,null))[_0x585b('0x26')](respondWithResult(_0x4ad68a,null))[_0x585b('0x45')](handleError(_0x4ad68a,null));};exports[_0x585b('0x46')]=function(_0x2556cd,_0x10389c){return db[_0x585b('0x2c')]['create'](_0x2556cd[_0x585b('0x47')],{})[_0x585b('0x26')](function(_0x1981eb){var _0x97f028=_0x2556cd['user'][_0x585b('0x27')]({'plain':!![]});if(!_0x97f028)throw new Error(_0x585b('0x48'));if(_0x97f028[_0x585b('0x49')]===_0x585b('0x4a')){var _0x490aed=_0x1981eb[_0x585b('0x27')]({'plain':!![]});var _0x1e1ff1=_0x585b('0x4b');return db[_0x585b('0x4c')][_0x585b('0x4d')]({'where':{'name':_0x1e1ff1,'userProfileId':_0x97f028[_0x585b('0x4e')]},'raw':!![]})['then'](function(_0x26f332){if(_0x26f332&&_0x26f332[_0x585b('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x490aed[_0x585b('0x50')],'resourceId':_0x490aed['id'],'type':_0x26f332[_0x585b('0x50')],'sectionId':_0x26f332['id']},{})['then'](function(){return _0x1981eb;});}else{return _0x1981eb;}})[_0x585b('0x45')](function(_0x519abe){logger[_0x585b('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x519abe);throw _0x519abe;});}return _0x1981eb;})[_0x585b('0x26')](respondWithResult(_0x10389c,0xc9))['catch'](handleError(_0x10389c,null));};exports[_0x585b('0x51')]=function(_0x343056,_0x47dda2){if(_0x343056[_0x585b('0x47')]['id']){delete _0x343056['body']['id'];}return db['Interval'][_0x585b('0x4d')]({'where':{'id':_0x343056['params']['id']}})[_0x585b('0x26')](handleEntityNotFound(_0x47dda2,null))['then'](saveUpdates(_0x343056[_0x585b('0x47')],null))[_0x585b('0x26')](respondWithResult(_0x47dda2,null))[_0x585b('0x45')](handleError(_0x47dda2,null));};exports[_0x585b('0x25')]=function(_0x33f574,_0x15cd73){return db[_0x585b('0x2c')]['find']({'where':{'id':_0x33f574[_0x585b('0x52')]['id']}})[_0x585b('0x26')](handleEntityNotFound(_0x15cd73,null))[_0x585b('0x26')](removeEntity(_0x15cd73,null))[_0x585b('0x45')](handleError(_0x15cd73,null));};exports[_0x585b('0x53')]=function(_0x29b07d,_0x20075d,_0x2e20b0){if(_0x29b07d[_0x585b('0x47')]['id']){delete _0x29b07d['body']['id'];}return db['Interval'][_0x585b('0x4d')]({'where':{'id':_0x29b07d[_0x585b('0x52')]['id']}})['then'](handleEntityNotFound(_0x20075d,null))[_0x585b('0x26')](function(_0x5e2aa3){if(_0x5e2aa3){_0x29b07d[_0x585b('0x47')][_0x585b('0x54')]=_0x5e2aa3['id'];return db[_0x585b('0x2c')][_0x585b('0x46')](_0x29b07d[_0x585b('0x47')]);}})[_0x585b('0x26')](respondWithResult(_0x20075d,null))[_0x585b('0x45')](handleError(_0x20075d,null));};exports[_0x585b('0x55')]=function(_0x5a0830,_0x2b4497,_0x36cbb9){var _0x3d08fd={};var _0x317278={};var _0x585edd;var _0x1e4c00;return db['Interval'][_0x585b('0x56')]({'where':{'id':_0x5a0830[_0x585b('0x52')]['id']}})['then'](handleEntityNotFound(_0x2b4497,null))[_0x585b('0x26')](function(_0x5778dc){if(_0x5778dc){_0x585edd=_0x5778dc;_0x317278['model']=_[_0x585b('0x2e')](db[_0x585b('0x2c')]['rawAttributes']);_0x317278[_0x585b('0x2f')]=_[_0x585b('0x2e')](_0x5a0830[_0x585b('0x2f')]);_0x317278['filters']=_['intersection'](_0x317278['model'],_0x317278[_0x585b('0x2f')]);_0x3d08fd[_0x585b('0x33')]=_[_0x585b('0x31')](_0x317278[_0x585b('0x32')],qs['fields'](_0x5a0830['query'][_0x585b('0x34')]));_0x3d08fd[_0x585b('0x33')]=_0x3d08fd[_0x585b('0x33')][_0x585b('0x43')]?_0x3d08fd[_0x585b('0x33')]:_0x317278['model'];_0x3d08fd[_0x585b('0x57')]=qs['sort'](_0x5a0830[_0x585b('0x2f')][_0x585b('0x36')]);_0x3d08fd[_0x585b('0x37')]=qs[_0x585b('0x30')](_[_0x585b('0x58')](_0x5a0830[_0x585b('0x2f')],_0x317278[_0x585b('0x30')]));if(_0x5a0830[_0x585b('0x2f')][_0x585b('0x3c')]){_0x3d08fd['where']=_[_0x585b('0x44')](_0x3d08fd['where'],{'$or':_[_0x585b('0x59')](_0x3d08fd[_0x585b('0x33')],function(_0x18c610){var _0x37095b={};_0x37095b[_0x18c610]={'$like':'%'+_0x5a0830[_0x585b('0x2f')][_0x585b('0x3c')]+'%'};return _0x37095b;})});}_0x3d08fd=_[_0x585b('0x44')]({},_0x3d08fd,_0x5a0830[_0x585b('0x3d')]);return _0x585edd[_0x585b('0x55')](_0x3d08fd);}})[_0x585b('0x26')](function(_0x447b5a){if(_0x447b5a){_0x1e4c00=_0x447b5a[_0x585b('0x43')];if(!_0x5a0830[_0x585b('0x2f')][_0x585b('0x5a')](_0x585b('0x35'))){_0x3d08fd['limit']=qs[_0x585b('0x1e')](_0x5a0830[_0x585b('0x2f')]['limit']);_0x3d08fd[_0x585b('0x1d')]=qs[_0x585b('0x1d')](_0x5a0830[_0x585b('0x2f')][_0x585b('0x1d')]);}return _0x585edd[_0x585b('0x55')](_0x3d08fd);}})[_0x585b('0x26')](function(_0x556a7f){if(_0x556a7f){return _0x556a7f?{'count':_0x1e4c00,'rows':_0x556a7f}:null;}})['then'](respondWithResult(_0x2b4497,null))[_0x585b('0x45')](handleError(_0x2b4497,null));};exports[_0x585b('0x5b')]=function(_0x103fa7,_0x1afad0,_0x36b104){return db[_0x585b('0x2c')]['findOne']({'where':{'id':_0x103fa7['params']['id']}})[_0x585b('0x26')](handleEntityNotFound(_0x1afad0,null))[_0x585b('0x26')](function(_0x4c7579){if(_0x4c7579){return db[_0x585b('0x5c')]['transaction'](function(_0x413050){return db[_0x585b('0x2c')][_0x585b('0x25')]({'where':{'IntervalId':_0x103fa7[_0x585b('0x52')]['id']},'transaction':_0x413050})[_0x585b('0x26')](function(_0x497ac3){var _0x4c86d7=_[_0x585b('0x59')](_0x103fa7[_0x585b('0x47')],function(_0xd9a99c){delete _0xd9a99c['id'];_0xd9a99c[_0x585b('0x54')]=_0x103fa7[_0x585b('0x52')]['id'];return _0xd9a99c;});return db[_0x585b('0x2c')]['bulkCreate'](_0x4c86d7,{'transaction':_0x413050});});})['then'](function(){return db[_0x585b('0x2c')][_0x585b('0x40')]({'where':{'IntervalId':_0x103fa7[_0x585b('0x52')]['id']}});});}})[_0x585b('0x26')](respondWithResult(_0x1afad0,null))['catch'](handleError(_0x1afad0,null));};
\ No newline at end of file
+var _0x2462=['status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','stack','name','send','index','Interval','rawAttributes','keys','query','filters','model','attributes','intersection','fields','length','order','sort','pick','filter','where','merge','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','Intervals','UserProfileSection','autoAssociation','error','params','destroy','addInterval','IntervalId','getIntervals','findOne','map','nolimit','sequelize','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','../../components/extensions/rewrite','sendStatus'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x2462,0x196));var _0x2246=function(_0x1b3797,_0x500d3d){_0x1b3797=_0x1b3797-0x0;var _0x484a75=_0x2462[_0x1b3797];return _0x484a75;};'use strict';var pdf=require(_0x2246('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2246('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2246('0x2'));var rp=require(_0x2246('0x3'));var moment=require(_0x2246('0x4'));var BPromise=require(_0x2246('0x5'));var Mustache=require(_0x2246('0x6'));var util=require('util');var path=require(_0x2246('0x7'));var sox=require(_0x2246('0x8'));var csv=require(_0x2246('0x9'));var ejs=require(_0x2246('0xa'));var fs=require('fs');var _=require(_0x2246('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2246('0xc'));var toCsv=require(_0x2246('0x9'));var querystring=require(_0x2246('0xd'));var Papa=require('papaparse');var authService=require(_0x2246('0xe'));var hardwareService=require(_0x2246('0xf'));var Redis=require(_0x2246('0x10'));var qs=require(_0x2246('0x11'));var logger=require(_0x2246('0x12'))(_0x2246('0x13'));var utils=require(_0x2246('0x14'));var config=require('../../config/environment');var db=require(_0x2246('0x15'))['db'];var extensions=require(_0x2246('0x16'));function respondWithStatusCode(_0x40b41f,_0x404c5b){_0x404c5b=_0x404c5b||0xcc;return function(_0x56cfc3){if(_0x56cfc3){return _0x40b41f[_0x2246('0x17')](_0x404c5b);}return _0x40b41f[_0x2246('0x18')](_0x404c5b)[_0x2246('0x19')]();};}function respondWithResult(_0x39b06e,_0x4b0d36){_0x4b0d36=_0x4b0d36||0xc8;return function(_0x3b2d95){if(_0x3b2d95){return _0x39b06e[_0x2246('0x18')](_0x4b0d36)[_0x2246('0x1a')](_0x3b2d95);}};}function respondWithFilteredResult(_0x3011b3,_0x45d78e){return function(_0x311143){if(_0x311143){var _0x31f4b4=_0x311143[_0x2246('0x1b')],_0x55a4f9=_0x45d78e[_0x2246('0x1c')],_0x2b8cfc=_0x45d78e[_0x2246('0x1c')]+_0x45d78e[_0x2246('0x1d')],_0xb46b93;if(_0x2b8cfc>=_0x31f4b4){_0x2b8cfc=_0x31f4b4;_0xb46b93=0xc8;}else{_0xb46b93=0xce;}_0x3011b3['status'](_0xb46b93);return _0x3011b3[_0x2246('0x1e')](_0x2246('0x1f'),_0x55a4f9+'-'+_0x2b8cfc+'/'+_0x31f4b4)[_0x2246('0x1a')](_0x311143);}return null;};}function patchUpdates(_0x12f189){return function(_0x10bcd1){try{jsonpatch[_0x2246('0x20')](_0x10bcd1,_0x12f189,!![]);}catch(_0x20d5f3){return BPromise[_0x2246('0x21')](_0x20d5f3);}return _0x10bcd1[_0x2246('0x22')]();};}function saveUpdates(_0x49a181,_0x40f5cd){return function(_0x51d785){if(_0x51d785){return _0x51d785[_0x2246('0x23')](_0x49a181)[_0x2246('0x24')](function(_0x2fe237){return _0x2fe237;});}return null;};}function removeEntity(_0x4196c9,_0x1645ae){return function(_0x3890ef){if(_0x3890ef){return _0x3890ef['destroy']()[_0x2246('0x24')](function(){var _0x3d0e2c=_0x3890ef[_0x2246('0x25')]({'plain':!![]});var _0x236ec4='Intervals';return db[_0x2246('0x26')]['destroy']({'where':{'type':_0x236ec4,'resourceId':_0x3d0e2c['id']}})['then'](function(){return _0x3890ef;});})[_0x2246('0x24')](function(){_0x4196c9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c0c7e,_0xc1b3af){return function(_0xd0a36c){if(!_0xd0a36c){_0x1c0c7e['sendStatus'](0x194);}return _0xd0a36c;};}function handleError(_0x5882e5,_0x2b7bab){_0x2b7bab=_0x2b7bab||0x1f4;return function(_0x113055){logger['error'](_0x113055[_0x2246('0x27')]);if(_0x113055[_0x2246('0x28')]){delete _0x113055[_0x2246('0x28')];}_0x5882e5[_0x2246('0x18')](_0x2b7bab)[_0x2246('0x29')](_0x113055);};}exports[_0x2246('0x2a')]=function(_0x129470,_0x27a6a2){var _0x18058b={},_0x313562={},_0x3bc2f6={'count':0x0,'rows':[]};var _0x1b48bd=db[_0x2246('0x2b')][_0x2246('0x2c')];_0x313562['model']=_[_0x2246('0x2d')](_0x1b48bd);_0x313562['query']=_[_0x2246('0x2d')](_0x129470[_0x2246('0x2e')]);_0x313562[_0x2246('0x2f')]=_['intersection'](_0x313562[_0x2246('0x30')],_0x313562[_0x2246('0x2e')]);_0x18058b[_0x2246('0x31')]=_[_0x2246('0x32')](_0x313562[_0x2246('0x30')],qs[_0x2246('0x33')](_0x129470[_0x2246('0x2e')][_0x2246('0x33')]));_0x18058b[_0x2246('0x31')]=_0x18058b[_0x2246('0x31')][_0x2246('0x34')]?_0x18058b[_0x2246('0x31')]:_0x313562[_0x2246('0x30')];if(!_0x129470[_0x2246('0x2e')]['hasOwnProperty']('nolimit')){_0x18058b['limit']=qs[_0x2246('0x1d')](_0x129470[_0x2246('0x2e')][_0x2246('0x1d')]);_0x18058b[_0x2246('0x1c')]=qs['offset'](_0x129470[_0x2246('0x2e')]['offset']);}_0x18058b[_0x2246('0x35')]=qs[_0x2246('0x36')](_0x129470['query'][_0x2246('0x36')]);_0x18058b['where']=qs[_0x2246('0x2f')](_[_0x2246('0x37')](_0x129470[_0x2246('0x2e')],_0x313562[_0x2246('0x2f')]));if(_0x129470['query'][_0x2246('0x38')]){_0x18058b[_0x2246('0x39')]=_[_0x2246('0x3a')](_0x18058b[_0x2246('0x39')],{'$or':_['map'](_0x1b48bd,function(_0x592de1){if(_0x592de1[_0x2246('0x3b')][_0x2246('0x3c')]!==_0x2246('0x3d')){var _0xd59bc={};_0xd59bc[_0x592de1[_0x2246('0x3e')]]={'$like':'%'+_0x129470[_0x2246('0x2e')][_0x2246('0x38')]+'%'};return _0xd59bc;}})});}_0x18058b=_[_0x2246('0x3a')]({},_0x18058b,_0x129470[_0x2246('0x3f')]);var _0x2d9fa3={'where':_0x18058b[_0x2246('0x39')]};return db[_0x2246('0x2b')][_0x2246('0x1b')](_0x2d9fa3)[_0x2246('0x24')](function(_0x1656ee){_0x3bc2f6['count']=_0x1656ee;if(_0x129470[_0x2246('0x2e')][_0x2246('0x40')]){_0x18058b[_0x2246('0x41')]=[{'all':!![]}];}return db[_0x2246('0x2b')][_0x2246('0x42')](_0x18058b);})[_0x2246('0x24')](function(_0x54396f){_0x3bc2f6[_0x2246('0x43')]=_0x54396f;return _0x3bc2f6;})['then'](respondWithFilteredResult(_0x27a6a2,_0x18058b))[_0x2246('0x44')](handleError(_0x27a6a2,null));};exports['show']=function(_0x4497e5,_0x126504){var _0x1b0ed6={'raw':!![],'where':{'id':_0x4497e5['params']['id']}},_0x24eafe={};_0x24eafe[_0x2246('0x30')]=_['keys'](db[_0x2246('0x2b')][_0x2246('0x2c')]);_0x24eafe[_0x2246('0x2e')]=_[_0x2246('0x2d')](_0x4497e5['query']);_0x24eafe['filters']=_[_0x2246('0x32')](_0x24eafe[_0x2246('0x30')],_0x24eafe['query']);_0x1b0ed6[_0x2246('0x31')]=_[_0x2246('0x32')](_0x24eafe[_0x2246('0x30')],qs[_0x2246('0x33')](_0x4497e5[_0x2246('0x2e')]['fields']));_0x1b0ed6[_0x2246('0x31')]=_0x1b0ed6[_0x2246('0x31')][_0x2246('0x34')]?_0x1b0ed6[_0x2246('0x31')]:_0x24eafe[_0x2246('0x30')];if(_0x4497e5[_0x2246('0x2e')][_0x2246('0x40')]){_0x1b0ed6[_0x2246('0x41')]=[{'all':!![]}];}_0x1b0ed6=_['merge']({},_0x1b0ed6,_0x4497e5['options']);return db[_0x2246('0x2b')][_0x2246('0x45')](_0x1b0ed6)[_0x2246('0x24')](handleEntityNotFound(_0x126504,null))[_0x2246('0x24')](respondWithResult(_0x126504,null))['catch'](handleError(_0x126504,null));};exports[_0x2246('0x46')]=function(_0xef2115,_0x370d0b){return db[_0x2246('0x2b')][_0x2246('0x46')](_0xef2115[_0x2246('0x47')],{})[_0x2246('0x24')](function(_0x3d30ed){var _0x5ee6de=_0xef2115['user'][_0x2246('0x25')]({'plain':!![]});if(!_0x5ee6de)throw new Error(_0x2246('0x48'));if(_0x5ee6de['role']==='user'){var _0x2a2644=_0x3d30ed[_0x2246('0x25')]({'plain':!![]});var _0x5d5fd3=_0x2246('0x49');return db[_0x2246('0x4a')][_0x2246('0x45')]({'where':{'name':_0x5d5fd3,'userProfileId':_0x5ee6de['userProfileId']},'raw':!![]})[_0x2246('0x24')](function(_0xc7b9b1){if(_0xc7b9b1&&_0xc7b9b1[_0x2246('0x4b')]===0x0){return db[_0x2246('0x26')]['create']({'name':_0x2a2644['name'],'resourceId':_0x2a2644['id'],'type':_0xc7b9b1[_0x2246('0x28')],'sectionId':_0xc7b9b1['id']},{})['then'](function(){return _0x3d30ed;});}else{return _0x3d30ed;}})[_0x2246('0x44')](function(_0x3fa796){logger[_0x2246('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fa796);throw _0x3fa796;});}return _0x3d30ed;})[_0x2246('0x24')](respondWithResult(_0x370d0b,0xc9))[_0x2246('0x44')](handleError(_0x370d0b,null));};exports[_0x2246('0x23')]=function(_0x1d6fb2,_0x1cedee){if(_0x1d6fb2[_0x2246('0x47')]['id']){delete _0x1d6fb2[_0x2246('0x47')]['id'];}return db['Interval']['find']({'where':{'id':_0x1d6fb2[_0x2246('0x4d')]['id']}})[_0x2246('0x24')](handleEntityNotFound(_0x1cedee,null))[_0x2246('0x24')](saveUpdates(_0x1d6fb2['body'],null))[_0x2246('0x24')](respondWithResult(_0x1cedee,null))['catch'](handleError(_0x1cedee,null));};exports[_0x2246('0x4e')]=function(_0x1b3ff7,_0xd275a3){return db[_0x2246('0x2b')][_0x2246('0x45')]({'where':{'id':_0x1b3ff7['params']['id']}})[_0x2246('0x24')](handleEntityNotFound(_0xd275a3,null))[_0x2246('0x24')](removeEntity(_0xd275a3,null))[_0x2246('0x44')](handleError(_0xd275a3,null));};exports[_0x2246('0x4f')]=function(_0xe495b2,_0x32e1bc,_0x107001){if(_0xe495b2['body']['id']){delete _0xe495b2[_0x2246('0x47')]['id'];}return db[_0x2246('0x2b')][_0x2246('0x45')]({'where':{'id':_0xe495b2[_0x2246('0x4d')]['id']}})[_0x2246('0x24')](handleEntityNotFound(_0x32e1bc,null))[_0x2246('0x24')](function(_0x1dda0f){if(_0x1dda0f){_0xe495b2[_0x2246('0x47')][_0x2246('0x50')]=_0x1dda0f['id'];return db[_0x2246('0x2b')]['create'](_0xe495b2[_0x2246('0x47')]);}})['then'](respondWithResult(_0x32e1bc,null))[_0x2246('0x44')](handleError(_0x32e1bc,null));};exports[_0x2246('0x51')]=function(_0xa8be67,_0x478f09,_0x682d36){var _0x29cc6b={};var _0x44cf39={};var _0x1317dd;var _0x3d2492;return db[_0x2246('0x2b')][_0x2246('0x52')]({'where':{'id':_0xa8be67[_0x2246('0x4d')]['id']}})[_0x2246('0x24')](handleEntityNotFound(_0x478f09,null))[_0x2246('0x24')](function(_0x5de7db){if(_0x5de7db){_0x1317dd=_0x5de7db;_0x44cf39[_0x2246('0x30')]=_[_0x2246('0x2d')](db[_0x2246('0x2b')][_0x2246('0x2c')]);_0x44cf39[_0x2246('0x2e')]=_[_0x2246('0x2d')](_0xa8be67[_0x2246('0x2e')]);_0x44cf39[_0x2246('0x2f')]=_[_0x2246('0x32')](_0x44cf39[_0x2246('0x30')],_0x44cf39['query']);_0x29cc6b[_0x2246('0x31')]=_[_0x2246('0x32')](_0x44cf39[_0x2246('0x30')],qs[_0x2246('0x33')](_0xa8be67[_0x2246('0x2e')][_0x2246('0x33')]));_0x29cc6b[_0x2246('0x31')]=_0x29cc6b[_0x2246('0x31')][_0x2246('0x34')]?_0x29cc6b[_0x2246('0x31')]:_0x44cf39[_0x2246('0x30')];_0x29cc6b[_0x2246('0x35')]=qs[_0x2246('0x36')](_0xa8be67[_0x2246('0x2e')][_0x2246('0x36')]);_0x29cc6b[_0x2246('0x39')]=qs['filters'](_[_0x2246('0x37')](_0xa8be67[_0x2246('0x2e')],_0x44cf39[_0x2246('0x2f')]));if(_0xa8be67[_0x2246('0x2e')][_0x2246('0x38')]){_0x29cc6b[_0x2246('0x39')]=_[_0x2246('0x3a')](_0x29cc6b[_0x2246('0x39')],{'$or':_[_0x2246('0x53')](_0x29cc6b[_0x2246('0x31')],function(_0x46c08e){var _0x4f020a={};_0x4f020a[_0x46c08e]={'$like':'%'+_0xa8be67[_0x2246('0x2e')][_0x2246('0x38')]+'%'};return _0x4f020a;})});}_0x29cc6b=_[_0x2246('0x3a')]({},_0x29cc6b,_0xa8be67[_0x2246('0x3f')]);return _0x1317dd[_0x2246('0x51')](_0x29cc6b);}})[_0x2246('0x24')](function(_0x7efc3b){if(_0x7efc3b){_0x3d2492=_0x7efc3b[_0x2246('0x34')];if(!_0xa8be67[_0x2246('0x2e')]['hasOwnProperty'](_0x2246('0x54'))){_0x29cc6b['limit']=qs['limit'](_0xa8be67[_0x2246('0x2e')][_0x2246('0x1d')]);_0x29cc6b[_0x2246('0x1c')]=qs[_0x2246('0x1c')](_0xa8be67['query'][_0x2246('0x1c')]);}return _0x1317dd[_0x2246('0x51')](_0x29cc6b);}})[_0x2246('0x24')](function(_0x54da5e){if(_0x54da5e){return _0x54da5e?{'count':_0x3d2492,'rows':_0x54da5e}:null;}})[_0x2246('0x24')](respondWithResult(_0x478f09,null))[_0x2246('0x44')](handleError(_0x478f09,null));};exports['addIntervals']=function(_0x227286,_0x1c0952,_0xbe9063){return db[_0x2246('0x2b')]['findOne']({'where':{'id':_0x227286[_0x2246('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1c0952,null))['then'](function(_0x595f3b){if(_0x595f3b){return db[_0x2246('0x55')]['transaction'](function(_0x3fd9be){return db['Interval']['destroy']({'where':{'IntervalId':_0x227286[_0x2246('0x4d')]['id']},'transaction':_0x3fd9be})[_0x2246('0x24')](function(_0x2e7e60){var _0x43ff23=_[_0x2246('0x53')](_0x227286['body'],function(_0x1a5dcd){delete _0x1a5dcd['id'];_0x1a5dcd[_0x2246('0x50')]=_0x227286['params']['id'];return _0x1a5dcd;});return db['Interval']['bulkCreate'](_0x43ff23,{'transaction':_0x3fd9be});});})[_0x2246('0x24')](function(){return db['Interval'][_0x2246('0x42')]({'where':{'IntervalId':_0x227286['params']['id']}});});}})[_0x2246('0x24')](respondWithResult(_0x1c0952,null))[_0x2246('0x44')](handleError(_0x1c0952,null));};
\ No newline at end of file
index f94b57c..1508255 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0c7a=['rewrite','lodash','../../config/logger','moment','bluebird','request-promise','../../components/extensions/rewrite','exports','define','Interval','tools_intervals'];(function(_0x2101bd,_0x24dbd1){var _0x4afc0d=function(_0x29951c){while(--_0x29951c){_0x2101bd['push'](_0x2101bd['shift']());}};_0x4afc0d(++_0x24dbd1);}(_0x0c7a,0x1a3));var _0xa0c7=function(_0x6e4d83,_0x2435d8){_0x6e4d83=_0x6e4d83-0x0;var _0x3ce968=_0x0c7a[_0x6e4d83];return _0x3ce968;};'use strict';var _=require(_0xa0c7('0x0'));var util=require('util');var logger=require(_0xa0c7('0x1'))('api');var moment=require(_0xa0c7('0x2'));var BPromise=require(_0xa0c7('0x3'));var rp=require(_0xa0c7('0x4'));var attributes=require('./interval.attributes');var extensions=require(_0xa0c7('0x5'));module[_0xa0c7('0x6')]=function(_0x341d6b,_0x53f8b3){return _0x341d6b[_0xa0c7('0x7')](_0xa0c7('0x8'),attributes,{'tableName':_0xa0c7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x7fb922,_0x180e45){extensions[_0xa0c7('0xa')](_0x341d6b,_0x7fb922);},'afterBulkCreate':function(_0x9de770,_0x3841e0,_0x141741){_0x141741();extensions['rewrite'](_0x341d6b,_0x9de770[0x0]);},'afterUpdate':function(_0x31d33d,_0x5f2823){extensions[_0xa0c7('0xa')](_0x341d6b,_0x31d33d);},'afterDestroy':function(_0x541dae,_0x2abd20){extensions[_0xa0c7('0xa')](_0x341d6b,_0x541dae);}}});};
\ No newline at end of file
+var _0xbee6=['rewrite','lodash','util','../../config/logger','api','bluebird','request-promise','../../components/extensions/rewrite','exports','define','tools_intervals'];(function(_0x3fe892,_0x12133f){var _0x5765ba=function(_0x3a5a20){while(--_0x3a5a20){_0x3fe892['push'](_0x3fe892['shift']());}};_0x5765ba(++_0x12133f);}(_0xbee6,0x11f));var _0x6bee=function(_0x10036b,_0x58a09a){_0x10036b=_0x10036b-0x0;var _0x7f548a=_0xbee6[_0x10036b];return _0x7f548a;};'use strict';var _=require(_0x6bee('0x0'));var util=require(_0x6bee('0x1'));var logger=require(_0x6bee('0x2'))(_0x6bee('0x3'));var moment=require('moment');var BPromise=require(_0x6bee('0x4'));var rp=require(_0x6bee('0x5'));var attributes=require('./interval.attributes');var extensions=require(_0x6bee('0x6'));module[_0x6bee('0x7')]=function(_0x5c541f,_0x5e5660){return _0x5c541f[_0x6bee('0x8')]('Interval',attributes,{'tableName':_0x6bee('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x9f3c2d,_0x50cf91){extensions[_0x6bee('0xa')](_0x5c541f,_0x9f3c2d);},'afterBulkCreate':function(_0x4aea82,_0x46ed47,_0x581510){_0x581510();extensions[_0x6bee('0xa')](_0x5c541f,_0x4aea82[0x0]);},'afterUpdate':function(_0x5e105e,_0x258608){extensions[_0x6bee('0xa')](_0x5c541f,_0x5e105e);},'afterDestroy':function(_0x55f134,_0xd06360){extensions[_0x6bee('0xa')](_0x5c541f,_0x55f134);}}});};
\ No newline at end of file
index f6e3cb7..f5ed303 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x31f0=['error','code','message','result','GetInterval','Interval','findAll','options','raw','where','attributes','include','model','then','catch','ShowInterval','find','map','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x447675,_0x3af6fe){var _0x553e5a=function(_0x270123){while(--_0x270123){_0x447675['push'](_0x447675['shift']());}};_0x553e5a(++_0x3af6fe);}(_0x31f0,0xb7));var _0x031f=function(_0x1a3f88,_0x38a506){_0x1a3f88=_0x1a3f88-0x0;var _0x4d7534=_0x31f0[_0x1a3f88];return _0x4d7534;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var moment=require(_0x031f('0x1'));var BPromise=require('bluebird');var rs=require(_0x031f('0x2'));var fs=require('fs');var Redis=require(_0x031f('0x3'));var db=require(_0x031f('0x4'))['db'];var utils=require(_0x031f('0x5'));var logger=require('../../config/logger')(_0x031f('0x6'));var config=require(_0x031f('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dc98e,_0x487e65,_0x365f59){return new BPromise(function(_0x4300b4,_0x2569b6){return client[_0x031f('0x8')](_0x3dc98e,_0x365f59)['then'](function(_0x2e5624){logger[_0x031f('0x9')](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));logger[_0x031f('0xc')](_0x031f('0xd'),_0x487e65,_0x031f('0xb'),JSON[_0x031f('0xe')](_0x2e5624));if(_0x2e5624['error']){if(_0x2e5624[_0x031f('0xf')][_0x031f('0x10')]===0x1f4){logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x2569b6(_0x2e5624[_0x031f('0xf')]['message']);}logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x4300b4(_0x2e5624[_0x031f('0xf')]['message']);}else{logger['info'](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));_0x4300b4(_0x2e5624[_0x031f('0x12')][_0x031f('0x11')]);}})['catch'](function(_0x1dc4a7){logger[_0x031f('0xf')]('Interval,\x20%s,\x20%s',_0x487e65,_0x1dc4a7);_0x2569b6(_0x1dc4a7);});});}exports[_0x031f('0x13')]=function(_0x535e70){var _0x421f75=this;return new Promise(function(_0x5f2199,_0x563bc8){return db[_0x031f('0x14')][_0x031f('0x15')]({'raw':_0x535e70[_0x031f('0x16')]?_0x535e70[_0x031f('0x16')][_0x031f('0x17')]===undefined?!![]:![]:!![],'where':_0x535e70[_0x031f('0x16')]?_0x535e70[_0x031f('0x16')][_0x031f('0x18')]||null:null,'attributes':_0x535e70['options']?_0x535e70[_0x031f('0x16')][_0x031f('0x19')]||null:null,'limit':_0x535e70[_0x031f('0x16')]?_0x535e70['options']['limit']||null:null,'include':_0x535e70[_0x031f('0x16')]?_0x535e70['options'][_0x031f('0x1a')]?_['map'](_0x535e70['options']['include'],function(_0x971691){return{'model':db[_0x971691[_0x031f('0x1b')]],'as':_0x971691['as'],'attributes':_0x971691[_0x031f('0x19')],'include':_0x971691[_0x031f('0x1a')]?_['map'](_0x971691[_0x031f('0x1a')],function(_0x5a64c0){return{'model':db[_0x5a64c0[_0x031f('0x1b')]],'as':_0x5a64c0['as'],'attributes':_0x5a64c0[_0x031f('0x19')],'include':_0x5a64c0[_0x031f('0x1a')]?_['map'](_0x5a64c0[_0x031f('0x1a')],function(_0x3b2a51){return{'model':db[_0x3b2a51['model']],'as':_0x3b2a51['as'],'attributes':_0x3b2a51[_0x031f('0x19')]};}):[]};}):[]};}):[]:[]})[_0x031f('0x1c')](function(_0x2403e9){logger['info'](_0x031f('0x13'),_0x535e70);logger[_0x031f('0xc')](_0x031f('0x13'),_0x535e70,JSON[_0x031f('0xe')](_0x2403e9));_0x5f2199(_0x2403e9);})[_0x031f('0x1d')](function(_0x301bd2){logger['error'](_0x031f('0x13'),_0x301bd2[_0x031f('0x11')],_0x535e70);_0x563bc8(_0x421f75[_0x031f('0xf')](0x1f4,_0x301bd2[_0x031f('0x11')]));});});};exports[_0x031f('0x1e')]=function(_0x2d24f0){var _0x378692=this;return new Promise(function(_0x87dc07,_0x2034ac){return db[_0x031f('0x14')][_0x031f('0x1f')]({'raw':_0x2d24f0['options']?_0x2d24f0[_0x031f('0x16')][_0x031f('0x17')]===undefined?!![]:![]:!![],'where':_0x2d24f0[_0x031f('0x16')]?_0x2d24f0[_0x031f('0x16')][_0x031f('0x18')]||null:null,'attributes':_0x2d24f0[_0x031f('0x16')]?_0x2d24f0[_0x031f('0x16')][_0x031f('0x19')]||null:null,'include':_0x2d24f0[_0x031f('0x16')]?_0x2d24f0[_0x031f('0x16')][_0x031f('0x1a')]?_[_0x031f('0x20')](_0x2d24f0[_0x031f('0x16')]['include'],function(_0x38061b){return{'model':db[_0x38061b[_0x031f('0x1b')]],'as':_0x38061b['as'],'attributes':_0x38061b['attributes'],'include':_0x38061b[_0x031f('0x1a')]?_[_0x031f('0x20')](_0x38061b['include'],function(_0x17b93c){return{'model':db[_0x17b93c[_0x031f('0x1b')]],'as':_0x17b93c['as'],'attributes':_0x17b93c[_0x031f('0x19')],'include':_0x17b93c[_0x031f('0x1a')]?_['map'](_0x17b93c['include'],function(_0x36ab13){return{'model':db[_0x36ab13['model']],'as':_0x36ab13['as'],'attributes':_0x36ab13[_0x031f('0x19')]};}):[]};}):[]};}):[]:[]})[_0x031f('0x1c')](function(_0x43ef89){logger['info']('ShowInterval',_0x2d24f0);logger[_0x031f('0xc')]('ShowInterval',_0x2d24f0,JSON['stringify'](_0x43ef89));_0x87dc07(_0x43ef89);})[_0x031f('0x1d')](function(_0x45e3a4){logger[_0x031f('0xf')](_0x031f('0x1e'),_0x45e3a4[_0x031f('0x11')],_0x2d24f0);_0x2034ac(_0x378692[_0x031f('0xf')](0x1f4,_0x45e3a4[_0x031f('0x11')]));});});};
\ No newline at end of file
+var _0x9b67=['ShowInterval','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','error','code','message','Interval,\x20%s,\x20%s','catch','GetInterval','Interval','findAll','options','raw','attributes','limit','include','map','model','stringify','find'];(function(_0x59342a,_0x16827b){var _0x17abc9=function(_0x2f7bfc){while(--_0x2f7bfc){_0x59342a['push'](_0x59342a['shift']());}};_0x17abc9(++_0x16827b);}(_0x9b67,0xf6));var _0x79b6=function(_0x246031,_0x278535){_0x246031=_0x246031-0x0;var _0x411f80=_0x9b67[_0x246031];return _0x411f80;};'use strict';var _=require(_0x79b6('0x0'));var util=require(_0x79b6('0x1'));var moment=require(_0x79b6('0x2'));var BPromise=require(_0x79b6('0x3'));var rs=require(_0x79b6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x79b6('0x5'))['db'];var utils=require(_0x79b6('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x79b6('0x7'));var jayson=require(_0x79b6('0x8'));var client=jayson[_0x79b6('0x9')][_0x79b6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfa6a05,_0x128543,_0x34adbe){return new BPromise(function(_0x58ae2d,_0x1270a7){return client[_0x79b6('0xb')](_0xfa6a05,_0x34adbe)[_0x79b6('0xc')](function(_0x3d28cd){logger[_0x79b6('0xd')]('Interval,\x20%s,\x20%s',_0x128543,_0x79b6('0xe'));logger[_0x79b6('0xf')](_0x79b6('0x10'),_0x128543,_0x79b6('0xe'),JSON['stringify'](_0x3d28cd));if(_0x3d28cd['error']){if(_0x3d28cd[_0x79b6('0x11')][_0x79b6('0x12')]===0x1f4){logger[_0x79b6('0x11')]('Interval,\x20%s,\x20%s',_0x128543,_0x3d28cd[_0x79b6('0x11')][_0x79b6('0x13')]);return _0x1270a7(_0x3d28cd[_0x79b6('0x11')][_0x79b6('0x13')]);}logger[_0x79b6('0x11')](_0x79b6('0x14'),_0x128543,_0x3d28cd[_0x79b6('0x11')][_0x79b6('0x13')]);return _0x58ae2d(_0x3d28cd[_0x79b6('0x11')][_0x79b6('0x13')]);}else{logger[_0x79b6('0xd')](_0x79b6('0x14'),_0x128543,_0x79b6('0xe'));_0x58ae2d(_0x3d28cd['result'][_0x79b6('0x13')]);}})[_0x79b6('0x15')](function(_0xc36fd3){logger[_0x79b6('0x11')](_0x79b6('0x14'),_0x128543,_0xc36fd3);_0x1270a7(_0xc36fd3);});});}exports[_0x79b6('0x16')]=function(_0x131bc5){var _0x3123b8=this;return new Promise(function(_0x3ff583,_0x16b3ef){return db[_0x79b6('0x17')][_0x79b6('0x18')]({'raw':_0x131bc5[_0x79b6('0x19')]?_0x131bc5['options'][_0x79b6('0x1a')]===undefined?!![]:![]:!![],'where':_0x131bc5['options']?_0x131bc5[_0x79b6('0x19')]['where']||null:null,'attributes':_0x131bc5[_0x79b6('0x19')]?_0x131bc5[_0x79b6('0x19')][_0x79b6('0x1b')]||null:null,'limit':_0x131bc5['options']?_0x131bc5[_0x79b6('0x19')][_0x79b6('0x1c')]||null:null,'include':_0x131bc5['options']?_0x131bc5['options'][_0x79b6('0x1d')]?_[_0x79b6('0x1e')](_0x131bc5[_0x79b6('0x19')][_0x79b6('0x1d')],function(_0x3b2a2a){return{'model':db[_0x3b2a2a['model']],'as':_0x3b2a2a['as'],'attributes':_0x3b2a2a[_0x79b6('0x1b')],'include':_0x3b2a2a[_0x79b6('0x1d')]?_[_0x79b6('0x1e')](_0x3b2a2a[_0x79b6('0x1d')],function(_0x4c275d){return{'model':db[_0x4c275d['model']],'as':_0x4c275d['as'],'attributes':_0x4c275d[_0x79b6('0x1b')],'include':_0x4c275d[_0x79b6('0x1d')]?_[_0x79b6('0x1e')](_0x4c275d[_0x79b6('0x1d')],function(_0x4adf15){return{'model':db[_0x4adf15[_0x79b6('0x1f')]],'as':_0x4adf15['as'],'attributes':_0x4adf15['attributes']};}):[]};}):[]};}):[]:[]})[_0x79b6('0xc')](function(_0x2fd9b5){logger[_0x79b6('0xd')](_0x79b6('0x16'),_0x131bc5);logger['debug'](_0x79b6('0x16'),_0x131bc5,JSON[_0x79b6('0x20')](_0x2fd9b5));_0x3ff583(_0x2fd9b5);})['catch'](function(_0x158221){logger[_0x79b6('0x11')](_0x79b6('0x16'),_0x158221[_0x79b6('0x13')],_0x131bc5);_0x16b3ef(_0x3123b8[_0x79b6('0x11')](0x1f4,_0x158221[_0x79b6('0x13')]));});});};exports['ShowInterval']=function(_0x160d2a){var _0x11057e=this;return new Promise(function(_0x27f680,_0x40ab0c){return db[_0x79b6('0x17')][_0x79b6('0x21')]({'raw':_0x160d2a['options']?_0x160d2a[_0x79b6('0x19')][_0x79b6('0x1a')]===undefined?!![]:![]:!![],'where':_0x160d2a[_0x79b6('0x19')]?_0x160d2a['options']['where']||null:null,'attributes':_0x160d2a[_0x79b6('0x19')]?_0x160d2a[_0x79b6('0x19')][_0x79b6('0x1b')]||null:null,'include':_0x160d2a[_0x79b6('0x19')]?_0x160d2a[_0x79b6('0x19')][_0x79b6('0x1d')]?_['map'](_0x160d2a['options'][_0x79b6('0x1d')],function(_0x498e83){return{'model':db[_0x498e83[_0x79b6('0x1f')]],'as':_0x498e83['as'],'attributes':_0x498e83['attributes'],'include':_0x498e83[_0x79b6('0x1d')]?_[_0x79b6('0x1e')](_0x498e83['include'],function(_0x29ee3c){return{'model':db[_0x29ee3c[_0x79b6('0x1f')]],'as':_0x29ee3c['as'],'attributes':_0x29ee3c['attributes'],'include':_0x29ee3c[_0x79b6('0x1d')]?_['map'](_0x29ee3c[_0x79b6('0x1d')],function(_0xe189c2){return{'model':db[_0xe189c2[_0x79b6('0x1f')]],'as':_0xe189c2['as'],'attributes':_0xe189c2[_0x79b6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x79b6('0xc')](function(_0x732849){logger[_0x79b6('0xd')](_0x79b6('0x22'),_0x160d2a);logger[_0x79b6('0xf')](_0x79b6('0x22'),_0x160d2a,JSON['stringify'](_0x732849));_0x27f680(_0x732849);})['catch'](function(_0x4e0f58){logger[_0x79b6('0x11')](_0x79b6('0x22'),_0x4e0f58['message'],_0x160d2a);_0x40ab0c(_0x11057e[_0x79b6('0x11')](0x1f4,_0x4e0f58['message']));});});};
\ No newline at end of file
index efbcc52..44dc69d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x11d56f,_0x5451fa){var _0x38c4ff=function(_0x562f1b){while(--_0x562f1b){_0x11d56f['push'](_0x11d56f['shift']());}};_0x38c4ff(++_0x5451fa);}(_0x5f2f,0x73));var _0xf5f2=function(_0x9d83c1,_0x20c4e6){_0x9d83c1=_0x9d83c1-0x0;var _0x4acc75=_0x5f2f[_0x9d83c1];return _0x4acc75;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router;
\ No newline at end of file
+var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x37b160,_0x143d1c){var _0x1efec1=function(_0x49663a){while(--_0x49663a){_0x37b160['push'](_0x37b160['shift']());}};_0x1efec1(++_0x143d1c);}(_0xadb5,0xad));var _0x5adb=function(_0x1aab9d,_0x46a670){_0x1aab9d=_0x1aab9d-0x0;var _0x27600a=_0xadb5[_0x1aab9d];return _0x27600a;};'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
index e734c82..d72a909 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0713=['Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','headers','x-forwarded-for','connection','remoteAddress','socket','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','/rest/api/2/issue','POST','Basic\x20','base64','request','setEncoding','utf8','data','end','status','statusCode','json','parse','error'];(function(_0x2589c8,_0x31f0cc){var _0x202338=function(_0x246650){while(--_0x246650){_0x2589c8['push'](_0x2589c8['shift']());}};_0x202338(++_0x31f0cc);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var USERNAME=_0x3071('0x2');var PASSWORD=_0x3071('0x3');function openIssue(_0x864539,_0x52b5fb){var _0x2c547f={'fields':{'project':{'key':_0x864539[_0x3071('0x4')]||_0x3071('0x5')},'summary':(_0x864539[_0x3071('0x6')]||_0x3071('0x7'))+_0x3071('0x8')+_0x864539['ip'],'description':_0x864539[_0x3071('0x9')]||JSON[_0x3071('0xa')](_0x864539),'issuetype':{'name':_0x864539[_0x3071('0xb')]||_0x3071('0xc')}}};_0x2c547f[_0x3071('0xd')][_0x3071('0xe')]=_0x864539[_0x3071('0xf')];_0x2c547f['fields'][_0x3071('0x10')]=_0x864539[_0x3071('0x11')];_0x2c547f[_0x3071('0xd')][_0x3071('0x12')]=_0x864539[_0x3071('0x13')];_0x2c547f['fields'][_0x3071('0x14')]=_0x864539[_0x3071('0x15')];_0x2c547f[_0x3071('0xd')][_0x3071('0x16')]=_0x864539[_0x3071('0x17')];_0x2c547f['fields']['customfield_10102']=_0x864539['ip'];var _0x1826ca={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x3071('0x18'),'method':_0x3071('0x19'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x3071('0x1a')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x3071('0x1b'))}};var _0x45c93b=JSON[_0x3071('0xa')](_0x2c547f);var _0x1f14e1=https[_0x3071('0x1c')](_0x1826ca,function(_0x2a6a4b){_0x2a6a4b[_0x3071('0x1d')](_0x3071('0x1e'));var _0x21aad3='';_0x2a6a4b['on'](_0x3071('0x1f'),function(_0x5f3c22){_0x21aad3+=_0x5f3c22;});_0x2a6a4b['on'](_0x3071('0x20'),function(){if(_0x52b5fb){return _0x52b5fb[_0x3071('0x21')](_0x2a6a4b[_0x3071('0x22')])[_0x3071('0x23')](JSON[_0x3071('0x24')](_0x21aad3));}});});_0x1f14e1['on'](_0x3071('0x25'),function(_0x105bbb){if(_0x52b5fb){return _0x52b5fb[_0x3071('0x21')](0x1f4)['json']({'errors':[{'message':_0x3071('0x26'),'type':_0x3071('0x27')}]});}});_0x1f14e1[_0x3071('0x28')](_0x45c93b);_0x1f14e1['end']();}exports[_0x3071('0x29')]=openIssue;exports['send']=function(_0x833074,_0x43128c){_0x833074[_0x3071('0x2a')]['ip']=_0x833074[_0x3071('0x2b')][_0x3071('0x2c')]||_0x833074[_0x3071('0x2d')][_0x3071('0x2e')]||_0x833074[_0x3071('0x2f')]['remoteAddress']||_0x833074['connection'][_0x3071('0x2f')][_0x3071('0x2e')];return openIssue(_0x833074[_0x3071('0x2a')],_0x43128c);};
\ No newline at end of file
+var _0x0713=['Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','headers','x-forwarded-for','connection','remoteAddress','socket','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','/rest/api/2/issue','POST','Basic\x20','base64','request','setEncoding','utf8','data','end','status','statusCode','json','parse','error'];(function(_0x57103f,_0x4ba6c8){var _0x6009ae=function(_0x2d40b8){while(--_0x2d40b8){_0x57103f['push'](_0x57103f['shift']());}};_0x6009ae(++_0x4ba6c8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var USERNAME=_0x3071('0x2');var PASSWORD=_0x3071('0x3');function openIssue(_0x864539,_0x52b5fb){var _0x2c547f={'fields':{'project':{'key':_0x864539[_0x3071('0x4')]||_0x3071('0x5')},'summary':(_0x864539[_0x3071('0x6')]||_0x3071('0x7'))+_0x3071('0x8')+_0x864539['ip'],'description':_0x864539[_0x3071('0x9')]||JSON[_0x3071('0xa')](_0x864539),'issuetype':{'name':_0x864539[_0x3071('0xb')]||_0x3071('0xc')}}};_0x2c547f[_0x3071('0xd')][_0x3071('0xe')]=_0x864539[_0x3071('0xf')];_0x2c547f['fields'][_0x3071('0x10')]=_0x864539[_0x3071('0x11')];_0x2c547f[_0x3071('0xd')][_0x3071('0x12')]=_0x864539[_0x3071('0x13')];_0x2c547f['fields'][_0x3071('0x14')]=_0x864539[_0x3071('0x15')];_0x2c547f[_0x3071('0xd')][_0x3071('0x16')]=_0x864539[_0x3071('0x17')];_0x2c547f['fields']['customfield_10102']=_0x864539['ip'];var _0x1826ca={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x3071('0x18'),'method':_0x3071('0x19'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x3071('0x1a')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x3071('0x1b'))}};var _0x45c93b=JSON[_0x3071('0xa')](_0x2c547f);var _0x1f14e1=https[_0x3071('0x1c')](_0x1826ca,function(_0x2a6a4b){_0x2a6a4b[_0x3071('0x1d')](_0x3071('0x1e'));var _0x21aad3='';_0x2a6a4b['on'](_0x3071('0x1f'),function(_0x5f3c22){_0x21aad3+=_0x5f3c22;});_0x2a6a4b['on'](_0x3071('0x20'),function(){if(_0x52b5fb){return _0x52b5fb[_0x3071('0x21')](_0x2a6a4b[_0x3071('0x22')])[_0x3071('0x23')](JSON[_0x3071('0x24')](_0x21aad3));}});});_0x1f14e1['on'](_0x3071('0x25'),function(_0x105bbb){if(_0x52b5fb){return _0x52b5fb[_0x3071('0x21')](0x1f4)['json']({'errors':[{'message':_0x3071('0x26'),'type':_0x3071('0x27')}]});}});_0x1f14e1[_0x3071('0x28')](_0x45c93b);_0x1f14e1['end']();}exports[_0x3071('0x29')]=openIssue;exports['send']=function(_0x833074,_0x43128c){_0x833074[_0x3071('0x2a')]['ip']=_0x833074[_0x3071('0x2b')][_0x3071('0x2c')]||_0x833074[_0x3071('0x2d')][_0x3071('0x2e')]||_0x833074[_0x3071('0x2f')]['remoteAddress']||_0x833074['connection'][_0x3071('0x2f')][_0x3071('0x2e')];return openIssue(_0x833074[_0x3071('0x2a')],_0x43128c);};
\ No newline at end of file
index a3a314a..15db388 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc1fa=['update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0xc1fa,0x17f));var _0xac1f=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xc1fa[_0x2d2c16];return _0x53f2fb;};'use strict';var multer=require(_0xac1f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xac1f('0x1'));var express=require(_0xac1f('0x2'));var router=express[_0xac1f('0x3')]();var auth=require(_0xac1f('0x4'));var interaction=require(_0xac1f('0x5'));var config=require('../../config/environment');var controller=require(_0xac1f('0x6'));router[_0xac1f('0x7')]('/',auth[_0xac1f('0x8')](),controller[_0xac1f('0x9')]);router[_0xac1f('0x7')](_0xac1f('0xa'),auth[_0xac1f('0x8')](),controller[_0xac1f('0xb')]);router['get'](_0xac1f('0xc'),auth[_0xac1f('0x8')](),controller[_0xac1f('0xd')]);router[_0xac1f('0xe')]('/',auth[_0xac1f('0x8')](),controller[_0xac1f('0xf')]);router[_0xac1f('0x10')](_0xac1f('0xc'),auth['isAuthenticated'](),controller[_0xac1f('0x11')]);router[_0xac1f('0x12')](_0xac1f('0xc'),auth[_0xac1f('0x8')](),controller[_0xac1f('0x13')]);module['exports']=router;
\ No newline at end of file
+var _0xad0e=['post','create','put','update','delete','destroy','util','Router','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','index','isAuthenticated','/:id','show'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xad0e,0x156));var _0xead0=function(_0x350ea6,_0x57f6dc){_0x350ea6=_0x350ea6-0x0;var _0x48816a=_0xad0e[_0x350ea6];return _0x48816a;};'use strict';var multer=require('multer');var util=require(_0xead0('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xead0('0x1')]();var auth=require(_0xead0('0x2'));var interaction=require(_0xead0('0x3'));var config=require('../../config/environment');var controller=require(_0xead0('0x4'));router[_0xead0('0x5')]('/',auth['isAuthenticated'](),controller[_0xead0('0x6')]);router[_0xead0('0x5')]('/describe',auth[_0xead0('0x7')](),controller['describe']);router[_0xead0('0x5')](_0xead0('0x8'),auth[_0xead0('0x7')](),controller[_0xead0('0x9')]);router[_0xead0('0xa')]('/',auth[_0xead0('0x7')](),controller[_0xead0('0xb')]);router[_0xead0('0xc')]('/:id',auth[_0xead0('0x7')](),controller[_0xead0('0xd')]);router[_0xead0('0xe')](_0xead0('0x8'),auth[_0xead0('0x7')](),controller[_0xead0('0xf')]);module['exports']=router;
\ No newline at end of file
index f9289cd..20a0dc6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc577=['long','STRING','sequelize','TEXT'];(function(_0xf95a1a,_0x53e078){var _0x4c15f6=function(_0x58110b){while(--_0x58110b){_0xf95a1a['push'](_0xf95a1a['shift']());}};_0x4c15f6(++_0x53e078);}(_0xc577,0x172));var _0x7c57=function(_0x7f287d,_0xe3b36e){_0x7f287d=_0x7f287d-0x0;var _0x21514f=_0xc577[_0x7f287d];return _0x21514f;};'use strict';var Sequelize=require(_0x7c57('0x0'));module['exports']={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0x7c57('0x1')](_0x7c57('0x2'))},'membername':{'type':Sequelize[_0x7c57('0x3')]},'projectname':{'type':Sequelize[_0x7c57('0x3')]},'queue':{'type':Sequelize[_0x7c57('0x3')]},'uniqueid':{'type':Sequelize[_0x7c57('0x3')]},'calleridname':{'type':Sequelize[_0x7c57('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0x7c57('0x3')]}};
\ No newline at end of file
+var _0x68fc=['sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68fc,0xa5));var _0xc68f=function(_0x373152,_0x172712){_0x373152=_0x373152-0x0;var _0x250bcc=_0x68fc[_0x373152];return _0x250bcc;};'use strict';var Sequelize=require(_0xc68f('0x0'));module[_0xc68f('0x1')]={'question':{'type':Sequelize[_0xc68f('0x2')]},'answer':{'type':Sequelize['TEXT']('long')},'membername':{'type':Sequelize[_0xc68f('0x2')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xc68f('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc68f('0x2')]},'questionId':{'type':Sequelize[_0xc68f('0x2')]}};
\ No newline at end of file
index 2780295..a59b327 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['mustache','util','path','sox','ejs','squel','crypto','desk.js','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','index','JscriptyAnswerReport','rawAttributes','model','keys','query','filters','attributes','intersection','fields','offset','sort','where','filter','merge','map','type','key','VIRTUAL','field','options','include','rows','catch','show','params','length','includeAll','create','body','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird'];(function(_0x130761,_0x1147b5){var _0x54a64b=function(_0x179bce){while(--_0x179bce){_0x130761['push'](_0x130761['shift']());}};_0x54a64b(++_0x1147b5);}(_0x7a54,0x106));var _0x47a5=function(_0x5b02df,_0x8c272e){_0x5b02df=_0x5b02df-0x0;var _0x4cdf30=_0x7a54[_0x5b02df];return _0x4cdf30;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');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 authService=require(_0x47a5('0xe'));var hardwareService=require(_0x47a5('0xf'));var Redis=require('ioredis');var qs=require(_0x47a5('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x47a5('0x11'));var config=require(_0x47a5('0x12'));var db=require(_0x47a5('0x13'))['db'];function respondWithStatusCode(_0x250fad,_0xd612dd){_0xd612dd=_0xd612dd||0xcc;return function(_0xd308b8){if(_0xd308b8){return _0x250fad[_0x47a5('0x14')](_0xd612dd);}return _0x250fad['status'](_0xd612dd)[_0x47a5('0x15')]();};}function respondWithResult(_0x221b54,_0x1cf309){_0x1cf309=_0x1cf309||0xc8;return function(_0x711793){if(_0x711793){return _0x221b54[_0x47a5('0x16')](_0x1cf309)[_0x47a5('0x17')](_0x711793);}};}function respondWithFilteredResult(_0x3c6c46,_0x190faa){return function(_0x4e99a8){if(_0x4e99a8){var _0x362359=_0x4e99a8[_0x47a5('0x18')],_0x11faf5=_0x190faa['offset'],_0x3b001e=_0x190faa['offset']+_0x190faa[_0x47a5('0x19')],_0x2a2cbb;if(_0x3b001e>=_0x362359){_0x3b001e=_0x362359;_0x2a2cbb=0xc8;}else{_0x2a2cbb=0xce;}_0x3c6c46['status'](_0x2a2cbb);return _0x3c6c46['set'](_0x47a5('0x1a'),_0x11faf5+'-'+_0x3b001e+'/'+_0x362359)[_0x47a5('0x17')](_0x4e99a8);}return null;};}function patchUpdates(_0x2ce454){return function(_0x1ef371){try{jsonpatch[_0x47a5('0x1b')](_0x1ef371,_0x2ce454,!![]);}catch(_0x12b98e){return BPromise[_0x47a5('0x1c')](_0x12b98e);}return _0x1ef371[_0x47a5('0x1d')]();};}function saveUpdates(_0x3aed38,_0x4a9fcb){return function(_0x1570bc){if(_0x1570bc){return _0x1570bc[_0x47a5('0x1e')](_0x3aed38)['then'](function(_0x2b0360){return _0x2b0360;});}return null;};}function removeEntity(_0x1f03f7,_0x36874d){return function(_0x4c5910){if(_0x4c5910){return _0x4c5910[_0x47a5('0x1f')]()[_0x47a5('0x20')](function(){_0x1f03f7[_0x47a5('0x16')](0xcc)[_0x47a5('0x15')]();});}};}function handleEntityNotFound(_0x5ef1b1,_0xe2dea9){return function(_0x385687){if(!_0x385687){_0x5ef1b1['sendStatus'](0x194);}return _0x385687;};}function handleError(_0x28747d,_0xc4cd63){_0xc4cd63=_0xc4cd63||0x1f4;return function(_0x4437f1){logger[_0x47a5('0x21')](_0x4437f1[_0x47a5('0x22')]);if(_0x4437f1['name']){delete _0x4437f1['name'];}_0x28747d[_0x47a5('0x16')](_0xc4cd63)['send'](_0x4437f1);};}exports[_0x47a5('0x23')]=function(_0x5b6c4e,_0x23cb77){var _0x378208={},_0x36ad34={},_0x1dac65={'count':0x0,'rows':[]};var _0x21f296=db[_0x47a5('0x24')][_0x47a5('0x25')];_0x36ad34[_0x47a5('0x26')]=_[_0x47a5('0x27')](_0x21f296);_0x36ad34[_0x47a5('0x28')]=_[_0x47a5('0x27')](_0x5b6c4e[_0x47a5('0x28')]);_0x36ad34[_0x47a5('0x29')]=_['intersection'](_0x36ad34[_0x47a5('0x26')],_0x36ad34['query']);_0x378208[_0x47a5('0x2a')]=_[_0x47a5('0x2b')](_0x36ad34[_0x47a5('0x26')],qs['fields'](_0x5b6c4e[_0x47a5('0x28')][_0x47a5('0x2c')]));_0x378208[_0x47a5('0x2a')]=_0x378208[_0x47a5('0x2a')]['length']?_0x378208['attributes']:_0x36ad34[_0x47a5('0x26')];if(!_0x5b6c4e[_0x47a5('0x28')]['hasOwnProperty']('nolimit')){_0x378208[_0x47a5('0x19')]=qs[_0x47a5('0x19')](_0x5b6c4e['query'][_0x47a5('0x19')]);_0x378208['offset']=qs[_0x47a5('0x2d')](_0x5b6c4e[_0x47a5('0x28')]['offset']);}_0x378208['order']=qs[_0x47a5('0x2e')](_0x5b6c4e['query'][_0x47a5('0x2e')]);_0x378208[_0x47a5('0x2f')]=qs[_0x47a5('0x29')](_['pick'](_0x5b6c4e[_0x47a5('0x28')],_0x36ad34['filters']));if(_0x5b6c4e['query'][_0x47a5('0x30')]){_0x378208['where']=_[_0x47a5('0x31')](_0x378208['where'],{'$or':_[_0x47a5('0x32')](_0x21f296,function(_0x3534cb){if(_0x3534cb[_0x47a5('0x33')][_0x47a5('0x34')]!==_0x47a5('0x35')){var _0xed6320={};_0xed6320[_0x3534cb[_0x47a5('0x36')]]={'$like':'%'+_0x5b6c4e[_0x47a5('0x28')][_0x47a5('0x30')]+'%'};return _0xed6320;}})});}_0x378208=_['merge']({},_0x378208,_0x5b6c4e[_0x47a5('0x37')]);var _0x10f136={'where':_0x378208['where']};return db[_0x47a5('0x24')][_0x47a5('0x18')](_0x10f136)[_0x47a5('0x20')](function(_0x49c4b5){_0x1dac65[_0x47a5('0x18')]=_0x49c4b5;if(_0x5b6c4e[_0x47a5('0x28')]['includeAll']){_0x378208[_0x47a5('0x38')]=[{'all':!![]}];}return db[_0x47a5('0x24')]['findAll'](_0x378208);})['then'](function(_0x5ebd8c){_0x1dac65[_0x47a5('0x39')]=_0x5ebd8c;return _0x1dac65;})['then'](respondWithFilteredResult(_0x23cb77,_0x378208))[_0x47a5('0x3a')](handleError(_0x23cb77,null));};exports[_0x47a5('0x3b')]=function(_0x301a85,_0x111f0d){var _0x1b2c80={'raw':!![],'where':{'id':_0x301a85[_0x47a5('0x3c')]['id']}},_0xcb5243={};_0xcb5243[_0x47a5('0x26')]=_[_0x47a5('0x27')](db[_0x47a5('0x24')][_0x47a5('0x25')]);_0xcb5243[_0x47a5('0x28')]=_[_0x47a5('0x27')](_0x301a85['query']);_0xcb5243[_0x47a5('0x29')]=_[_0x47a5('0x2b')](_0xcb5243[_0x47a5('0x26')],_0xcb5243[_0x47a5('0x28')]);_0x1b2c80['attributes']=_[_0x47a5('0x2b')](_0xcb5243['model'],qs['fields'](_0x301a85['query']['fields']));_0x1b2c80[_0x47a5('0x2a')]=_0x1b2c80['attributes'][_0x47a5('0x3d')]?_0x1b2c80[_0x47a5('0x2a')]:_0xcb5243[_0x47a5('0x26')];if(_0x301a85['query'][_0x47a5('0x3e')]){_0x1b2c80[_0x47a5('0x38')]=[{'all':!![]}];}_0x1b2c80=_['merge']({},_0x1b2c80,_0x301a85['options']);return db[_0x47a5('0x24')]['find'](_0x1b2c80)[_0x47a5('0x20')](handleEntityNotFound(_0x111f0d,null))[_0x47a5('0x20')](respondWithResult(_0x111f0d,null))[_0x47a5('0x3a')](handleError(_0x111f0d,null));};exports[_0x47a5('0x3f')]=function(_0x34a9ae,_0xf0edbb){return db[_0x47a5('0x24')][_0x47a5('0x3f')](_0x34a9ae[_0x47a5('0x40')],{})[_0x47a5('0x20')](respondWithResult(_0xf0edbb,0xc9))[_0x47a5('0x3a')](handleError(_0xf0edbb,null));};exports[_0x47a5('0x1e')]=function(_0xe28d76,_0x3574d4){if(_0xe28d76[_0x47a5('0x40')]['id']){delete _0xe28d76[_0x47a5('0x40')]['id'];}return db['JscriptyAnswerReport'][_0x47a5('0x41')]({'where':{'id':_0xe28d76[_0x47a5('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3574d4,null))['then'](saveUpdates(_0xe28d76[_0x47a5('0x40')],null))['then'](respondWithResult(_0x3574d4,null))[_0x47a5('0x3a')](handleError(_0x3574d4,null));};exports[_0x47a5('0x1f')]=function(_0x54c35f,_0x4f62d3){return db[_0x47a5('0x24')]['find']({'where':{'id':_0x54c35f[_0x47a5('0x3c')]['id']}})[_0x47a5('0x20')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x20')](removeEntity(_0x4f62d3,null))[_0x47a5('0x3a')](handleError(_0x4f62d3,null));};exports[_0x47a5('0x42')]=function(_0x26acd2,_0x238ebb){return db['JscriptyAnswerReport']['describe']()[_0x47a5('0x20')](respondWithResult(_0x238ebb,null))[_0x47a5('0x3a')](handleError(_0x238ebb,null));};
\ No newline at end of file
+var _0x9957=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','destroy','then','stack','name','send','index','JscriptyAnswerReport','rawAttributes','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','type','key','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','create','body','find','params','describe','html-pdf'];(function(_0x3bbe4b,_0x35f067){var _0x402d37=function(_0x2f7f78){while(--_0x2f7f78){_0x3bbe4b['push'](_0x3bbe4b['shift']());}};_0x402d37(++_0x35f067);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');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 authService=require(_0x7995('0x12'));var hardwareService=require(_0x7995('0x13'));var Redis=require(_0x7995('0x14'));var qs=require(_0x7995('0x15'));var logger=require(_0x7995('0x16'))('api');var utils=require(_0x7995('0x17'));var config=require(_0x7995('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb0c872,_0x2cb37a){_0x2cb37a=_0x2cb37a||0xcc;return function(_0x19a27e){if(_0x19a27e){return _0xb0c872[_0x7995('0x19')](_0x2cb37a);}return _0xb0c872[_0x7995('0x1a')](_0x2cb37a)[_0x7995('0x1b')]();};}function respondWithResult(_0x2bbe7a,_0x4cc004){_0x4cc004=_0x4cc004||0xc8;return function(_0x58f5ad){if(_0x58f5ad){return _0x2bbe7a[_0x7995('0x1a')](_0x4cc004)[_0x7995('0x1c')](_0x58f5ad);}};}function respondWithFilteredResult(_0x24b5bb,_0x321ae8){return function(_0x3f1d3e){if(_0x3f1d3e){var _0x1a5310=_0x3f1d3e[_0x7995('0x1d')],_0x2202ce=_0x321ae8['offset'],_0x41cbf0=_0x321ae8[_0x7995('0x1e')]+_0x321ae8[_0x7995('0x1f')],_0x5377e5;if(_0x41cbf0>=_0x1a5310){_0x41cbf0=_0x1a5310;_0x5377e5=0xc8;}else{_0x5377e5=0xce;}_0x24b5bb[_0x7995('0x1a')](_0x5377e5);return _0x24b5bb[_0x7995('0x20')](_0x7995('0x21'),_0x2202ce+'-'+_0x41cbf0+'/'+_0x1a5310)[_0x7995('0x1c')](_0x3f1d3e);}return null;};}function patchUpdates(_0x4faa60){return function(_0x54c9ae){try{jsonpatch[_0x7995('0x22')](_0x54c9ae,_0x4faa60,!![]);}catch(_0x5e6f90){return BPromise['reject'](_0x5e6f90);}return _0x54c9ae[_0x7995('0x23')]();};}function saveUpdates(_0x3d463e,_0x4cbe10){return function(_0x3a9b54){if(_0x3a9b54){return _0x3a9b54['update'](_0x3d463e)['then'](function(_0x3e4c54){return _0x3e4c54;});}return null;};}function removeEntity(_0x327b1f,_0x350fd9){return function(_0x1a8568){if(_0x1a8568){return _0x1a8568[_0x7995('0x24')]()[_0x7995('0x25')](function(){_0x327b1f['status'](0xcc)[_0x7995('0x1b')]();});}};}function handleEntityNotFound(_0x46ee4b,_0x204507){return function(_0x285437){if(!_0x285437){_0x46ee4b[_0x7995('0x19')](0x194);}return _0x285437;};}function handleError(_0x13bc35,_0x475351){_0x475351=_0x475351||0x1f4;return function(_0x472195){logger['error'](_0x472195[_0x7995('0x26')]);if(_0x472195[_0x7995('0x27')]){delete _0x472195[_0x7995('0x27')];}_0x13bc35[_0x7995('0x1a')](_0x475351)[_0x7995('0x28')](_0x472195);};}exports[_0x7995('0x29')]=function(_0x56691a,_0x47625f){var _0x5911c3={},_0x229742={},_0x49bc7e={'count':0x0,'rows':[]};var _0xf16cc2=db[_0x7995('0x2a')][_0x7995('0x2b')];_0x229742['model']=_[_0x7995('0x2c')](_0xf16cc2);_0x229742['query']=_[_0x7995('0x2c')](_0x56691a[_0x7995('0x2d')]);_0x229742[_0x7995('0x2e')]=_['intersection'](_0x229742['model'],_0x229742['query']);_0x5911c3[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x229742[_0x7995('0x31')],qs[_0x7995('0x32')](_0x56691a[_0x7995('0x2d')][_0x7995('0x32')]));_0x5911c3['attributes']=_0x5911c3['attributes'][_0x7995('0x33')]?_0x5911c3['attributes']:_0x229742[_0x7995('0x31')];if(!_0x56691a[_0x7995('0x2d')][_0x7995('0x34')](_0x7995('0x35'))){_0x5911c3[_0x7995('0x1f')]=qs['limit'](_0x56691a[_0x7995('0x2d')][_0x7995('0x1f')]);_0x5911c3['offset']=qs['offset'](_0x56691a['query'][_0x7995('0x1e')]);}_0x5911c3[_0x7995('0x36')]=qs['sort'](_0x56691a[_0x7995('0x2d')]['sort']);_0x5911c3[_0x7995('0x37')]=qs[_0x7995('0x2e')](_[_0x7995('0x38')](_0x56691a['query'],_0x229742['filters']));if(_0x56691a[_0x7995('0x2d')]['filter']){_0x5911c3['where']=_[_0x7995('0x39')](_0x5911c3[_0x7995('0x37')],{'$or':_['map'](_0xf16cc2,function(_0x1baa15){if(_0x1baa15[_0x7995('0x3a')][_0x7995('0x3b')]!==_0x7995('0x3c')){var _0x1e3dbf={};_0x1e3dbf[_0x1baa15['field']]={'$like':'%'+_0x56691a[_0x7995('0x2d')][_0x7995('0x3d')]+'%'};return _0x1e3dbf;}})});}_0x5911c3=_[_0x7995('0x39')]({},_0x5911c3,_0x56691a[_0x7995('0x3e')]);var _0x4b1541={'where':_0x5911c3[_0x7995('0x37')]};return db[_0x7995('0x2a')][_0x7995('0x1d')](_0x4b1541)[_0x7995('0x25')](function(_0x1f5bee){_0x49bc7e[_0x7995('0x1d')]=_0x1f5bee;if(_0x56691a['query'][_0x7995('0x3f')]){_0x5911c3[_0x7995('0x40')]=[{'all':!![]}];}return db[_0x7995('0x2a')][_0x7995('0x41')](_0x5911c3);})[_0x7995('0x25')](function(_0x298fc2){_0x49bc7e[_0x7995('0x42')]=_0x298fc2;return _0x49bc7e;})[_0x7995('0x25')](respondWithFilteredResult(_0x47625f,_0x5911c3))[_0x7995('0x43')](handleError(_0x47625f,null));};exports[_0x7995('0x44')]=function(_0x6fe77b,_0x270d52){var _0x7b4e67={'raw':!![],'where':{'id':_0x6fe77b['params']['id']}},_0x53cda2={};_0x53cda2[_0x7995('0x31')]=_[_0x7995('0x2c')](db['JscriptyAnswerReport']['rawAttributes']);_0x53cda2[_0x7995('0x2d')]=_['keys'](_0x6fe77b['query']);_0x53cda2[_0x7995('0x2e')]=_[_0x7995('0x30')](_0x53cda2[_0x7995('0x31')],_0x53cda2['query']);_0x7b4e67[_0x7995('0x2f')]=_['intersection'](_0x53cda2[_0x7995('0x31')],qs['fields'](_0x6fe77b['query'][_0x7995('0x32')]));_0x7b4e67[_0x7995('0x2f')]=_0x7b4e67[_0x7995('0x2f')][_0x7995('0x33')]?_0x7b4e67['attributes']:_0x53cda2[_0x7995('0x31')];if(_0x6fe77b[_0x7995('0x2d')][_0x7995('0x3f')]){_0x7b4e67[_0x7995('0x40')]=[{'all':!![]}];}_0x7b4e67=_['merge']({},_0x7b4e67,_0x6fe77b['options']);return db[_0x7995('0x2a')]['find'](_0x7b4e67)[_0x7995('0x25')](handleEntityNotFound(_0x270d52,null))['then'](respondWithResult(_0x270d52,null))[_0x7995('0x43')](handleError(_0x270d52,null));};exports['create']=function(_0x1e795e,_0x1b0373){return db['JscriptyAnswerReport'][_0x7995('0x45')](_0x1e795e[_0x7995('0x46')],{})[_0x7995('0x25')](respondWithResult(_0x1b0373,0xc9))[_0x7995('0x43')](handleError(_0x1b0373,null));};exports['update']=function(_0x2458cb,_0x3e787d){if(_0x2458cb[_0x7995('0x46')]['id']){delete _0x2458cb['body']['id'];}return db[_0x7995('0x2a')][_0x7995('0x47')]({'where':{'id':_0x2458cb[_0x7995('0x48')]['id']}})[_0x7995('0x25')](handleEntityNotFound(_0x3e787d,null))[_0x7995('0x25')](saveUpdates(_0x2458cb['body'],null))[_0x7995('0x25')](respondWithResult(_0x3e787d,null))[_0x7995('0x43')](handleError(_0x3e787d,null));};exports['destroy']=function(_0x3d1dbb,_0x5843ba){return db[_0x7995('0x2a')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x48')]['id']}})[_0x7995('0x25')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x25')](removeEntity(_0x5843ba,null))[_0x7995('0x43')](handleError(_0x5843ba,null));};exports[_0x7995('0x49')]=function(_0x4d46bc,_0x427dcf){return db[_0x7995('0x2a')][_0x7995('0x49')]()['then'](respondWithResult(_0x427dcf,null))[_0x7995('0x43')](handleError(_0x427dcf,null));};
\ No newline at end of file
index 6d018e4..7c4969d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4170=['../../config/logger','moment','bluebird','request-promise','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x4170,0x111));var _0x0417=function(_0x15d178,_0x533561){_0x15d178=_0x15d178-0x0;var _0xc73785=_0x4170[_0x15d178];return _0xc73785;};'use strict';var _=require(_0x0417('0x0'));var util=require(_0x0417('0x1'));var logger=require(_0x0417('0x2'))('api');var moment=require(_0x0417('0x3'));var BPromise=require(_0x0417('0x4'));var rp=require(_0x0417('0x5'));var attributes=require(_0x0417('0x6'));module[_0x0417('0x7')]=function(_0x52c835,_0x763e77){return _0x52c835[_0x0417('0x8')](_0x0417('0x9'),attributes,{'tableName':_0x0417('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xebd2=['request-promise','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','bluebird'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xebd2,0x72));var _0x2ebd=function(_0x1c62e8,_0x550d84){_0x1c62e8=_0x1c62e8-0x0;var _0x4c496=_0xebd2[_0x1c62e8];return _0x4c496;};'use strict';var _=require(_0x2ebd('0x0'));var util=require(_0x2ebd('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2ebd('0x2'));var rp=require(_0x2ebd('0x3'));var attributes=require(_0x2ebd('0x4'));module[_0x2ebd('0x5')]=function(_0x431688,_0x3066f7){return _0x431688[_0x2ebd('0x6')](_0x2ebd('0x7'),attributes,{'tableName':_0x2ebd('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 2b6079e..a86ab12 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0bbe=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird'];(function(_0x291aaf,_0x4c6d8d){var _0x5571e6=function(_0x1b4fec){while(--_0x1b4fec){_0x291aaf['push'](_0x291aaf['shift']());}};_0x5571e6(++_0x4c6d8d);}(_0x0bbe,0x1f1));var _0xe0bb=function(_0x5c5c01,_0x3bf644){_0x5c5c01=_0x5c5c01-0x0;var _0x2052e7=_0x0bbe[_0x5c5c01];return _0x2052e7;};'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')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2e3e0a,_0xdc10ec);_0xa4fb35(_0xdc10ec);});});}
\ No newline at end of file
+var _0x097b=['stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s'];(function(_0x4715d2,_0x3371b2){var _0x141811=function(_0x520bc6){while(--_0x520bc6){_0x4715d2['push'](_0x4715d2['shift']());}};_0x141811(++_0x3371b2);}(_0x097b,0x147));var _0xb097=function(_0xc9396b,_0x734ceb){_0xc9396b=_0xc9396b-0x0;var _0x56d6ee=_0x097b[_0xc9396b];return _0x56d6ee;};'use strict';var _=require(_0xb097('0x0'));var util=require(_0xb097('0x1'));var moment=require(_0xb097('0x2'));var BPromise=require(_0xb097('0x3'));var rs=require(_0xb097('0x4'));var fs=require('fs');var Redis=require(_0xb097('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb097('0x6'))(_0xb097('0x7'));var config=require(_0xb097('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb097('0x9')][_0xb097('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b32a4,_0x5746ff,_0x4f897c){return new BPromise(function(_0x3b0d69,_0x10f591){return client[_0xb097('0xb')](_0x4b32a4,_0x4f897c)[_0xb097('0xc')](function(_0x47fad9){logger[_0xb097('0xd')](_0xb097('0xe'),_0x5746ff,_0xb097('0xf'));logger[_0xb097('0x10')](_0xb097('0x11'),_0x5746ff,'request\x20sent',JSON[_0xb097('0x12')](_0x47fad9));if(_0x47fad9[_0xb097('0x13')]){if(_0x47fad9[_0xb097('0x13')][_0xb097('0x14')]===0x1f4){logger['error'](_0xb097('0xe'),_0x5746ff,_0x47fad9[_0xb097('0x13')][_0xb097('0x15')]);return _0x10f591(_0x47fad9['error'][_0xb097('0x15')]);}logger[_0xb097('0x13')](_0xb097('0xe'),_0x5746ff,_0x47fad9[_0xb097('0x13')][_0xb097('0x15')]);return _0x3b0d69(_0x47fad9[_0xb097('0x13')][_0xb097('0x15')]);}else{logger[_0xb097('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5746ff,_0xb097('0xf'));_0x3b0d69(_0x47fad9[_0xb097('0x16')][_0xb097('0x15')]);}})['catch'](function(_0x4412ab){logger[_0xb097('0x13')](_0xb097('0xe'),_0x5746ff,_0x4412ab);_0x10f591(_0x4412ab);});});}
\ No newline at end of file
index f74d99c..3df6bbc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1abc=['util','path','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/sessions','/:id/answers','getAnswers','getSummary','post','create','/:id/clone','delete','destroy','exports','multer'];(function(_0x4e8dfc,_0x448b97){var _0x3c47e0=function(_0x844a2b){while(--_0x844a2b){_0x4e8dfc['push'](_0x4e8dfc['shift']());}};_0x3c47e0(++_0x448b97);}(_0x1abc,0x107));var _0xc1ab=function(_0x28ef95,_0x3a4439){_0x28ef95=_0x28ef95-0x0;var _0x1cb35a=_0x1abc[_0x28ef95];return _0x1cb35a;};'use strict';var multer=require(_0xc1ab('0x0'));var util=require(_0xc1ab('0x1'));var path=require(_0xc1ab('0x2'));var timeout=require('connect-timeout');var express=require(_0xc1ab('0x3'));var router=express[_0xc1ab('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc1ab('0x5'));var config=require(_0xc1ab('0x6'));var controller=require('./jscriptyProject.controller');router['get']('/',auth[_0xc1ab('0x7')](),controller[_0xc1ab('0x8')]);router[_0xc1ab('0x9')](_0xc1ab('0xa'),auth[_0xc1ab('0x7')](),controller[_0xc1ab('0xb')]);router[_0xc1ab('0x9')](_0xc1ab('0xc'),auth[_0xc1ab('0x7')](),controller['getSessions']);router['get'](_0xc1ab('0xd'),auth['isAuthenticated'](),controller[_0xc1ab('0xe')]);router['get']('/:id/summary',auth[_0xc1ab('0x7')](),timeout('30s'),controller[_0xc1ab('0xf')]);router[_0xc1ab('0x10')]('/',auth['isAuthenticated'](),controller[_0xc1ab('0x11')]);router[_0xc1ab('0x10')](_0xc1ab('0x12'),auth['isAuthenticated'](),controller['clone']);router['put'](_0xc1ab('0xa'),auth[_0xc1ab('0x7')](),controller['update']);router[_0xc1ab('0x13')](_0xc1ab('0xa'),auth[_0xc1ab('0x7')](),controller[_0xc1ab('0x14')]);module[_0xc1ab('0x15')]=router;
\ No newline at end of file
+var _0x707d=['post','clone','put','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id','show','/:id/sessions','getSessions','getAnswers','30s','getSummary','create'];(function(_0x2ec634,_0x1c1084){var _0x44a379=function(_0x2b328a){while(--_0x2b328a){_0x2ec634['push'](_0x2ec634['shift']());}};_0x44a379(++_0x1c1084);}(_0x707d,0x18b));var _0xd707=function(_0x41a55f,_0xf93c5c){_0x41a55f=_0x41a55f-0x0;var _0x22a146=_0x707d[_0x41a55f];return _0x22a146;};'use strict';var multer=require(_0xd707('0x0'));var util=require(_0xd707('0x1'));var path=require(_0xd707('0x2'));var timeout=require(_0xd707('0x3'));var express=require(_0xd707('0x4'));var router=express[_0xd707('0x5')]();var auth=require(_0xd707('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd707('0x7'));var controller=require(_0xd707('0x8'));router[_0xd707('0x9')]('/',auth[_0xd707('0xa')](),controller['index']);router[_0xd707('0x9')](_0xd707('0xb'),auth['isAuthenticated'](),controller[_0xd707('0xc')]);router[_0xd707('0x9')](_0xd707('0xd'),auth['isAuthenticated'](),controller[_0xd707('0xe')]);router[_0xd707('0x9')]('/:id/answers',auth[_0xd707('0xa')](),controller[_0xd707('0xf')]);router['get']('/:id/summary',auth[_0xd707('0xa')](),timeout(_0xd707('0x10')),controller[_0xd707('0x11')]);router['post']('/',auth[_0xd707('0xa')](),controller[_0xd707('0x12')]);router[_0xd707('0x13')]('/:id/clone',auth['isAuthenticated'](),controller[_0xd707('0x14')]);router[_0xd707('0x15')]('/:id',auth[_0xd707('0xa')](),controller[_0xd707('0x16')]);router['delete'](_0xd707('0xb'),auth[_0xd707('0xa')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
index cebc0fc..1843a2d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe08b=['name','TEXT','long','isObjectLike','formData','setDataValue','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','STRING'];(function(_0x3532f1,_0x2a47a2){var _0x200fc6=function(_0x2134b0){while(--_0x2134b0){_0x3532f1['push'](_0x3532f1['shift']());}};_0x200fc6(++_0x2a47a2);}(_0xe08b,0xa9));var _0xbe08=function(_0x5f4cd7,_0x459c44){_0x5f4cd7=_0x5f4cd7-0x0;var _0x47c93f=_0xe08b[_0x5f4cd7];return _0x47c93f;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require('util');module['exports']={'name':{'type':Sequelize[_0xbe08('0x0')],'unique':_0xbe08('0x1')},'description':{'type':Sequelize[_0xbe08('0x0')]},'formData':{'type':Sequelize[_0xbe08('0x2')](_0xbe08('0x3')),'set':function(_0x198cf1){if(_[_0xbe08('0x4')](_0x198cf1)){this['setDataValue'](_0xbe08('0x5'),JSON['stringify'](_0x198cf1));}else if(_['isString'](_0x198cf1)){this[_0xbe08('0x6')](_0xbe08('0x5'),_0x198cf1);}else{this[_0xbe08('0x6')](_0xbe08('0x5'),util['format'](_0xbe08('0x7'),this[_0xbe08('0x8')](_0xbe08('0x1'))||'',this[_0xbe08('0x8')](_0xbe08('0x9'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}};
\ No newline at end of file
+var _0xafc6=['formData','stringify','isString','setDataValue','format','getDataValue','description','BOOLEAN','sequelize','lodash','util','STRING','name','TEXT','long','isObjectLike'];(function(_0x518772,_0x4346f9){var _0x1a9c88=function(_0xed9628){while(--_0xed9628){_0x518772['push'](_0x518772['shift']());}};_0x1a9c88(++_0x4346f9);}(_0xafc6,0xc8));var _0x6afc=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xafc6[_0x24f31b];return _0x488401;};'use strict';var Sequelize=require(_0x6afc('0x0'));var _=require(_0x6afc('0x1'));var util=require(_0x6afc('0x2'));module['exports']={'name':{'type':Sequelize[_0x6afc('0x3')],'unique':_0x6afc('0x4')},'description':{'type':Sequelize[_0x6afc('0x3')]},'formData':{'type':Sequelize[_0x6afc('0x5')](_0x6afc('0x6')),'set':function(_0x2609fa){if(_[_0x6afc('0x7')](_0x2609fa)){this['setDataValue'](_0x6afc('0x8'),JSON[_0x6afc('0x9')](_0x2609fa));}else if(_[_0x6afc('0xa')](_0x2609fa)){this[_0x6afc('0xb')](_0x6afc('0x8'),_0x2609fa);}else{this['setDataValue'](_0x6afc('0x8'),util[_0x6afc('0xc')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x6afc('0xd')](_0x6afc('0x4'))||'',this[_0x6afc('0xd')](_0x6afc('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x6afc('0xf')],'defaultValue':!![]}};
\ No newline at end of file
index e85f39f..5ee3792 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf706=['error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','create','user','userProfileId','getSessions','findOne','JscriptySessionReport','hasOwnProperty','ProjectId','getAnswers','params','JscriptyAnswerReport','rows','toString','indexOf','replace','getSummary','startTime','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','api','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','stack','name','send','index','JscriptyProject','rawAttributes','model','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','merge','map','type','key','field','filter','options','includeAll','findAll','show','include','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','catch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf706,0x16d));var _0x6f70=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0xf706[_0xb24a3e];return _0x4038d7;};'use strict';var pdf=require(_0x6f70('0x0'));var emlformat=require(_0x6f70('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6f70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6f70('0x3'));var BPromise=require(_0x6f70('0x4'));var Mustache=require(_0x6f70('0x5'));var util=require(_0x6f70('0x6'));var path=require(_0x6f70('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6f70('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6f70('0x9'));var crypto=require(_0x6f70('0xa'));var jsforce=require(_0x6f70('0xb'));var deskjs=require(_0x6f70('0xc'));var toCsv=require(_0x6f70('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x6f70('0xe'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x6f70('0xf'));var qs=require(_0x6f70('0x10'));var logger=require(_0x6f70('0x11'))(_0x6f70('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x160182,_0x3bae54){_0x3bae54=_0x3bae54||0xcc;return function(_0x5815d0){if(_0x5815d0){return _0x160182['sendStatus'](_0x3bae54);}return _0x160182[_0x6f70('0x13')](_0x3bae54)['end']();};}function respondWithResult(_0x380009,_0x1052ba){_0x1052ba=_0x1052ba||0xc8;return function(_0x3321d1){if(_0x3321d1){return _0x380009[_0x6f70('0x13')](_0x1052ba)[_0x6f70('0x14')](_0x3321d1);}};}function respondWithFilteredResult(_0x44db01,_0x1020f8){return function(_0x1700d9){if(_0x1700d9){var _0x45e0d5=_0x1700d9[_0x6f70('0x15')],_0x444b97=_0x1020f8[_0x6f70('0x16')],_0x4fa49d=_0x1020f8[_0x6f70('0x16')]+_0x1020f8['limit'],_0xf80529;if(_0x4fa49d>=_0x45e0d5){_0x4fa49d=_0x45e0d5;_0xf80529=0xc8;}else{_0xf80529=0xce;}_0x44db01['status'](_0xf80529);return _0x44db01[_0x6f70('0x17')](_0x6f70('0x18'),_0x444b97+'-'+_0x4fa49d+'/'+_0x45e0d5)[_0x6f70('0x14')](_0x1700d9);}return null;};}function patchUpdates(_0xf2d7bc){return function(_0x532064){try{jsonpatch[_0x6f70('0x19')](_0x532064,_0xf2d7bc,!![]);}catch(_0xcb5ea8){return BPromise[_0x6f70('0x1a')](_0xcb5ea8);}return _0x532064[_0x6f70('0x1b')]();};}function saveUpdates(_0xe93cd5,_0x1db5fc){return function(_0x523251){if(_0x523251){return _0x523251[_0x6f70('0x1c')](_0xe93cd5)[_0x6f70('0x1d')](function(_0x9d8f72){return _0x9d8f72;});}return null;};}function removeEntity(_0x5b0b2c,_0x2a0f75){return function(_0x459112){if(_0x459112){return _0x459112[_0x6f70('0x1e')]()[_0x6f70('0x1d')](function(){var _0x1597fe=_0x459112[_0x6f70('0x1f')]({'plain':!![]});var _0x457805=_0x6f70('0x20');return db[_0x6f70('0x21')][_0x6f70('0x1e')]({'where':{'type':_0x457805,'resourceId':_0x1597fe['id']}})['then'](function(){return _0x459112;});})[_0x6f70('0x1d')](function(){_0x5b0b2c[_0x6f70('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18ef62,_0x1ff613){return function(_0x3eb568){if(!_0x3eb568){_0x18ef62['sendStatus'](0x194);}return _0x3eb568;};}function handleError(_0x6a4c36,_0x4c0904){_0x4c0904=_0x4c0904||0x1f4;return function(_0x48846b){logger['error'](_0x48846b[_0x6f70('0x22')]);if(_0x48846b['name']){delete _0x48846b[_0x6f70('0x23')];}_0x6a4c36[_0x6f70('0x13')](_0x4c0904)[_0x6f70('0x24')](_0x48846b);};}exports[_0x6f70('0x25')]=function(_0x30ddc7,_0x557637){var _0x463cf2={},_0x542307={},_0x1e9e15={'count':0x0,'rows':[]};var _0x1b7f31=db[_0x6f70('0x26')][_0x6f70('0x27')];_0x542307[_0x6f70('0x28')]=_['keys'](_0x1b7f31);_0x542307[_0x6f70('0x29')]=_[_0x6f70('0x2a')](_0x30ddc7[_0x6f70('0x29')]);_0x542307['filters']=_[_0x6f70('0x2b')](_0x542307['model'],_0x542307[_0x6f70('0x29')]);_0x463cf2[_0x6f70('0x2c')]=_[_0x6f70('0x2b')](_0x542307[_0x6f70('0x28')],qs[_0x6f70('0x2d')](_0x30ddc7[_0x6f70('0x29')][_0x6f70('0x2d')]));_0x463cf2[_0x6f70('0x2c')]=_0x463cf2[_0x6f70('0x2c')][_0x6f70('0x2e')]?_0x463cf2[_0x6f70('0x2c')]:_0x542307[_0x6f70('0x28')];if(!_0x30ddc7['query']['hasOwnProperty'](_0x6f70('0x2f'))){_0x463cf2[_0x6f70('0x30')]=qs[_0x6f70('0x30')](_0x30ddc7['query'][_0x6f70('0x30')]);_0x463cf2[_0x6f70('0x16')]=qs[_0x6f70('0x16')](_0x30ddc7[_0x6f70('0x29')][_0x6f70('0x16')]);}_0x463cf2[_0x6f70('0x31')]=qs['sort'](_0x30ddc7[_0x6f70('0x29')][_0x6f70('0x32')]);_0x463cf2[_0x6f70('0x33')]=qs[_0x6f70('0x34')](_[_0x6f70('0x35')](_0x30ddc7['query'],_0x542307['filters']));if(_0x30ddc7[_0x6f70('0x29')]['filter']){_0x463cf2[_0x6f70('0x33')]=_[_0x6f70('0x36')](_0x463cf2[_0x6f70('0x33')],{'$or':_[_0x6f70('0x37')](_0x1b7f31,function(_0x3ac777){if(_0x3ac777[_0x6f70('0x38')][_0x6f70('0x39')]!=='VIRTUAL'){var _0x59243b={};_0x59243b[_0x3ac777[_0x6f70('0x3a')]]={'$like':'%'+_0x30ddc7[_0x6f70('0x29')][_0x6f70('0x3b')]+'%'};return _0x59243b;}})});}_0x463cf2=_['merge']({},_0x463cf2,_0x30ddc7[_0x6f70('0x3c')]);var _0x128e66={'where':_0x463cf2[_0x6f70('0x33')]};return db[_0x6f70('0x26')][_0x6f70('0x15')](_0x128e66)['then'](function(_0x42c98d){_0x1e9e15[_0x6f70('0x15')]=_0x42c98d;if(_0x30ddc7['query'][_0x6f70('0x3d')]){_0x463cf2['include']=[{'all':!![]}];}return db[_0x6f70('0x26')][_0x6f70('0x3e')](_0x463cf2);})[_0x6f70('0x1d')](function(_0x53a7f6){_0x1e9e15['rows']=_0x53a7f6;return _0x1e9e15;})[_0x6f70('0x1d')](respondWithFilteredResult(_0x557637,_0x463cf2))['catch'](handleError(_0x557637,null));};exports[_0x6f70('0x3f')]=function(_0x32b45f,_0x5873a4){var _0x59fbab={'raw':![],'where':{'id':_0x32b45f['params']['id']}},_0x59b1c1={};_0x59b1c1['model']=_[_0x6f70('0x2a')](db[_0x6f70('0x26')][_0x6f70('0x27')]);_0x59b1c1[_0x6f70('0x29')]=_[_0x6f70('0x2a')](_0x32b45f[_0x6f70('0x29')]);_0x59b1c1[_0x6f70('0x34')]=_[_0x6f70('0x2b')](_0x59b1c1[_0x6f70('0x28')],_0x59b1c1[_0x6f70('0x29')]);_0x59fbab[_0x6f70('0x2c')]=_['intersection'](_0x59b1c1[_0x6f70('0x28')],qs[_0x6f70('0x2d')](_0x32b45f['query'][_0x6f70('0x2d')]));_0x59fbab['attributes']=_0x59fbab[_0x6f70('0x2c')][_0x6f70('0x2e')]?_0x59fbab[_0x6f70('0x2c')]:_0x59b1c1[_0x6f70('0x28')];if(_0x32b45f['query'][_0x6f70('0x3d')]){_0x59fbab[_0x6f70('0x40')]=[{'all':!![]}];}_0x59fbab=_[_0x6f70('0x36')]({},_0x59fbab,_0x32b45f[_0x6f70('0x3c')]);return db['JscriptyProject'][_0x6f70('0x41')](_0x59fbab)['then'](handleEntityNotFound(_0x5873a4,null))[_0x6f70('0x1d')](respondWithResult(_0x5873a4,null))['catch'](handleError(_0x5873a4,null));};exports['create']=function(_0x2ff61b,_0x5546c9){return db['JscriptyProject']['create'](_0x2ff61b[_0x6f70('0x42')],{})[_0x6f70('0x1d')](function(_0x43b847){var _0x4e4f7b=_0x2ff61b['user'][_0x6f70('0x1f')]({'plain':!![]});if(!_0x4e4f7b)throw new Error(_0x6f70('0x43'));if(_0x4e4f7b[_0x6f70('0x44')]==='user'){var _0x2728fd=_0x43b847[_0x6f70('0x1f')]({'plain':!![]});var _0x1d66fc=_0x6f70('0x20');return db['UserProfileSection']['find']({'where':{'name':_0x1d66fc,'userProfileId':_0x4e4f7b['userProfileId']},'raw':!![]})[_0x6f70('0x1d')](function(_0x5d843b){if(_0x5d843b&&_0x5d843b[_0x6f70('0x45')]===0x0){return db[_0x6f70('0x21')]['create']({'name':_0x2728fd[_0x6f70('0x23')],'resourceId':_0x2728fd['id'],'type':_0x5d843b['name'],'sectionId':_0x5d843b['id']},{})[_0x6f70('0x1d')](function(){return _0x43b847;});}else{return _0x43b847;}})[_0x6f70('0x46')](function(_0x493acf){logger[_0x6f70('0x47')](_0x6f70('0x48'),_0x493acf);throw _0x493acf;});}return _0x43b847;})['then'](respondWithResult(_0x5546c9,0xc9))[_0x6f70('0x46')](handleError(_0x5546c9,null));};exports[_0x6f70('0x49')]=function(_0x56156f,_0x63d3d4){var _0x5dedf7={'raw':![],'where':{'id':_0x56156f['params']['id']}},_0x1b040a={};_0x1b040a[_0x6f70('0x28')]=_[_0x6f70('0x2a')](db[_0x6f70('0x26')][_0x6f70('0x27')]);_0x5dedf7[_0x6f70('0x2c')]=_[_0x6f70('0x2b')](_0x1b040a[_0x6f70('0x28')],qs[_0x6f70('0x2d')](_0x56156f['query']['fields']));_0x5dedf7[_0x6f70('0x2c')]=_0x5dedf7[_0x6f70('0x2c')][_0x6f70('0x2e')]?_0x5dedf7[_0x6f70('0x2c')]:_0x1b040a[_0x6f70('0x28')];if(_0x56156f['query'][_0x6f70('0x3d')]){_0x5dedf7[_0x6f70('0x40')]=[{'all':!![]}];}_0x5dedf7=_[_0x6f70('0x36')]({},_0x5dedf7,_0x56156f[_0x6f70('0x3c')]);return db[_0x6f70('0x26')]['find'](_0x5dedf7)[_0x6f70('0x1d')](handleEntityNotFound(_0x63d3d4,null))[_0x6f70('0x1d')](function(_0xd47cce){if(_0xd47cce){var _0x125713=_0xd47cce['get']({'plain':!![]});_0x125713=qs['omit'](_0x125713,['id',_0x6f70('0x4a'),_0x6f70('0x4b')]);_0x56156f[_0x6f70('0x42')]=_[_0x6f70('0x4c')](_0x56156f[_0x6f70('0x42')],['id','createdAt',_0x6f70('0x4b')]);return db['JscriptyProject'][_0x6f70('0x4d')](_[_0x6f70('0x36')](_0x125713,_0x56156f[_0x6f70('0x42')]),{'include':_0x56156f[_0x6f70('0x29')][_0x6f70('0x3d')]?[{'all':!![]}]:undefined})['then'](function(_0x5ce602){var _0x27f3cf=_0x56156f[_0x6f70('0x4e')][_0x6f70('0x1f')]({'plain':!![]});if(!_0x27f3cf)throw new Error(_0x6f70('0x43'));if(_0x27f3cf[_0x6f70('0x44')]==='user'){var _0x3f2680=_0x5ce602['get']({'plain':!![]});var _0x24c143=_0x6f70('0x20');return db['UserProfileSection'][_0x6f70('0x41')]({'where':{'name':_0x24c143,'userProfileId':_0x27f3cf[_0x6f70('0x4f')]},'raw':!![]})[_0x6f70('0x1d')](function(_0x2cef27){if(_0x2cef27&&_0x2cef27[_0x6f70('0x45')]===0x0){return db[_0x6f70('0x21')]['create']({'name':_0x3f2680[_0x6f70('0x23')],'resourceId':_0x3f2680['id'],'type':_0x2cef27[_0x6f70('0x23')],'sectionId':_0x2cef27['id']},{})['then'](function(){return _0x5ce602;});}else{return _0x5ce602;}})[_0x6f70('0x46')](function(_0x118f24){logger[_0x6f70('0x47')](_0x6f70('0x48'),_0x118f24);throw _0x118f24;});}return _0x5ce602;});}})[_0x6f70('0x1d')](respondWithResult(_0x63d3d4,0xc9))[_0x6f70('0x46')](handleError(_0x63d3d4,null));};exports[_0x6f70('0x1c')]=function(_0x4fd715,_0x15ba21){if(_0x4fd715[_0x6f70('0x42')]['id']){delete _0x4fd715[_0x6f70('0x42')]['id'];}return db[_0x6f70('0x26')][_0x6f70('0x41')]({'where':{'id':_0x4fd715['params']['id']}})[_0x6f70('0x1d')](handleEntityNotFound(_0x15ba21,null))[_0x6f70('0x1d')](saveUpdates(_0x4fd715[_0x6f70('0x42')],null))[_0x6f70('0x1d')](respondWithResult(_0x15ba21,null))[_0x6f70('0x46')](handleError(_0x15ba21,null));};exports[_0x6f70('0x1e')]=function(_0x329484,_0x4dc467){return db[_0x6f70('0x26')][_0x6f70('0x41')]({'where':{'id':_0x329484['params']['id']}})[_0x6f70('0x1d')](handleEntityNotFound(_0x4dc467,null))['then'](removeEntity(_0x4dc467,null))['catch'](handleError(_0x4dc467,null));};exports[_0x6f70('0x50')]=function(_0x566244,_0x5794ff,_0xa337fd){var _0x3b25f4={'raw':!![],'where':{}};var _0x476b27={};var _0x4f6c51={'count':0x0,'rows':[]};return db[_0x6f70('0x26')][_0x6f70('0x51')]({'where':{'id':_0x566244['params']['id']}})[_0x6f70('0x1d')](handleEntityNotFound(_0x5794ff,null))['then'](function(_0x45c9b1){if(_0x45c9b1){_0x476b27['model']=_['keys'](db[_0x6f70('0x52')][_0x6f70('0x27')]);_0x476b27[_0x6f70('0x29')]=_[_0x6f70('0x2a')](_0x566244[_0x6f70('0x29')]);_0x476b27[_0x6f70('0x34')]=_['intersection'](_0x476b27[_0x6f70('0x28')],_0x476b27['query']);_0x3b25f4['attributes']=_[_0x6f70('0x2b')](_0x476b27['model'],qs[_0x6f70('0x2d')](_0x566244[_0x6f70('0x29')]['fields']));_0x3b25f4['attributes']=_0x3b25f4[_0x6f70('0x2c')][_0x6f70('0x2e')]?_0x3b25f4[_0x6f70('0x2c')]:_0x476b27[_0x6f70('0x28')];if(!_0x566244[_0x6f70('0x29')][_0x6f70('0x53')](_0x6f70('0x2f'))){_0x3b25f4[_0x6f70('0x30')]=qs[_0x6f70('0x30')](_0x566244['query'][_0x6f70('0x30')]);_0x3b25f4[_0x6f70('0x16')]=qs[_0x6f70('0x16')](_0x566244[_0x6f70('0x29')][_0x6f70('0x16')]);}_0x3b25f4[_0x6f70('0x31')]=qs[_0x6f70('0x32')](_0x566244[_0x6f70('0x29')]['sort']);_0x3b25f4[_0x6f70('0x33')]=qs[_0x6f70('0x34')](_[_0x6f70('0x35')](_0x566244[_0x6f70('0x29')],_0x476b27['filters']));_0x3b25f4[_0x6f70('0x33')][_0x6f70('0x54')]=_0x45c9b1['id'];if(_0x566244[_0x6f70('0x29')][_0x6f70('0x3b')]){_0x3b25f4['where']=_['merge'](_0x3b25f4[_0x6f70('0x33')],{'$or':_[_0x6f70('0x37')](_0x3b25f4[_0x6f70('0x2c')],function(_0x269097){var _0x417d2c={};_0x417d2c[_0x269097]={'$like':'%'+_0x566244['query']['filter']+'%'};return _0x417d2c;})});}_0x3b25f4=_[_0x6f70('0x36')]({},_0x3b25f4,_0x566244['options']);return db[_0x6f70('0x52')][_0x6f70('0x15')]({'where':_0x3b25f4[_0x6f70('0x33')]})[_0x6f70('0x1d')](function(_0x230c88){_0x4f6c51[_0x6f70('0x15')]=_0x230c88;if(_0x566244[_0x6f70('0x29')][_0x6f70('0x3d')]){_0x3b25f4[_0x6f70('0x40')]=[{'all':!![]}];}return db[_0x6f70('0x52')][_0x6f70('0x3e')](_0x3b25f4);})['then'](function(_0xb2ea02){_0x4f6c51['rows']=_0xb2ea02;return _0x4f6c51;});}})[_0x6f70('0x1d')](respondWithFilteredResult(_0x5794ff,_0x3b25f4))['catch'](handleError(_0x5794ff,null));};exports[_0x6f70('0x55')]=function(_0x274775,_0x1c497d,_0x2fab02){var _0x298f4d={'raw':!![],'where':{}};var _0x5c332a={};var _0xb4b003={'count':0x0,'rows':[]};return db[_0x6f70('0x26')][_0x6f70('0x51')]({'where':{'id':_0x274775[_0x6f70('0x56')]['id']}})[_0x6f70('0x1d')](handleEntityNotFound(_0x1c497d,null))[_0x6f70('0x1d')](function(_0x31285f){if(_0x31285f){_0x5c332a['model']=_[_0x6f70('0x2a')](db[_0x6f70('0x57')]['rawAttributes']);_0x5c332a[_0x6f70('0x29')]=_[_0x6f70('0x2a')](_0x274775[_0x6f70('0x29')]);_0x5c332a['filters']=_['intersection'](_0x5c332a[_0x6f70('0x28')],_0x5c332a[_0x6f70('0x29')]);_0x298f4d['attributes']=_['intersection'](_0x5c332a[_0x6f70('0x28')],qs[_0x6f70('0x2d')](_0x274775[_0x6f70('0x29')][_0x6f70('0x2d')]));_0x298f4d['attributes']=_0x298f4d[_0x6f70('0x2c')][_0x6f70('0x2e')]?_0x298f4d[_0x6f70('0x2c')]:_0x5c332a[_0x6f70('0x28')];if(!_0x274775[_0x6f70('0x29')][_0x6f70('0x53')](_0x6f70('0x2f'))){_0x298f4d[_0x6f70('0x30')]=qs[_0x6f70('0x30')](_0x274775[_0x6f70('0x29')]['limit']);_0x298f4d[_0x6f70('0x16')]=qs[_0x6f70('0x16')](_0x274775[_0x6f70('0x29')][_0x6f70('0x16')]);}_0x298f4d['order']=qs[_0x6f70('0x32')](_0x274775[_0x6f70('0x29')][_0x6f70('0x32')]);_0x298f4d[_0x6f70('0x33')]=qs['filters'](_[_0x6f70('0x35')](_0x274775[_0x6f70('0x29')],_0x5c332a[_0x6f70('0x34')]));_0x298f4d[_0x6f70('0x33')][_0x6f70('0x54')]=_0x31285f['id'];if(_0x274775[_0x6f70('0x29')][_0x6f70('0x3b')]){_0x298f4d[_0x6f70('0x33')]=_[_0x6f70('0x36')](_0x298f4d['where'],{'$or':_[_0x6f70('0x37')](_0x298f4d[_0x6f70('0x2c')],function(_0x3e6d3f){var _0x5f2c77={};_0x5f2c77[_0x3e6d3f]={'$like':'%'+_0x274775[_0x6f70('0x29')][_0x6f70('0x3b')]+'%'};return _0x5f2c77;})});}_0x298f4d=_['merge']({},_0x298f4d,_0x274775[_0x6f70('0x3c')]);return db['JscriptyAnswerReport'][_0x6f70('0x15')]({'where':_0x298f4d[_0x6f70('0x33')]})[_0x6f70('0x1d')](function(_0x4bf934){_0xb4b003['count']=_0x4bf934;if(_0x274775[_0x6f70('0x29')][_0x6f70('0x3d')]){_0x298f4d[_0x6f70('0x40')]=[{'all':!![]}];}return db[_0x6f70('0x57')][_0x6f70('0x3e')](_0x298f4d);})['then'](function(_0x16b7e1){_0xb4b003[_0x6f70('0x58')]=_0x16b7e1;return _0xb4b003;});}})[_0x6f70('0x1d')](respondWithFilteredResult(_0x1c497d,_0x298f4d))[_0x6f70('0x46')](handleError(_0x1c497d,null));};function char(_0x44ff82){return'number'===typeof _0x44ff82?String['fromCharCode'][_0x6f70('0x19')](null,arguments):_0x44ff82;}function needsEncapsulation(_0x302bb0){return!!_0x302bb0&&(_0x302bb0[_0x6f70('0x59')]()[_0x6f70('0x5a')](char(0xd))>=0x0||_0x302bb0[_0x6f70('0x59')]()[_0x6f70('0x5a')](char(0xa))>=0x0||_0x302bb0[_0x6f70('0x59')]()[_0x6f70('0x5a')](char(0x2c))>=0x0||_0x302bb0[_0x6f70('0x59')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x451e7f){var _0x10e687=char(0x22),_0x2cb2ef='\x5c'+char(0x22),_0x1e73ae=_0x451e7f[_0x6f70('0x59')]()[_0x6f70('0x5b')](new RegExp(_0x10e687,'g'),_0x2cb2ef);return _0x10e687+_0x1e73ae+_0x10e687;}exports[_0x6f70('0x5c')]=function(_0x218763,_0x5c7a44,_0x203327){var _0x198d71,_0x147bd2;return db[_0x6f70('0x52')][_0x6f70('0x3e')]({'where':{'ProjectId':_0x218763[_0x6f70('0x56')]['id'],'starttime':_0x218763[_0x6f70('0x29')][_0x6f70('0x5d')]}})[_0x6f70('0x1d')](handleEntityNotFound(_0x5c7a44,null))[_0x6f70('0x1d')](function(_0x327269){if(_0x327269){_0x198d71=_0x327269;return db['JscriptyQuestionReport'][_0x6f70('0x3e')]({'where':{'SessionId':{'$in':_[_0x6f70('0x37')](_0x198d71,'id')},'ProjectId':_0x218763[_0x6f70('0x56')]['id']},'order':_0x6f70('0x5e')});}})[_0x6f70('0x1d')](handleEntityNotFound(_0x5c7a44,null))[_0x6f70('0x1d')](function(_0x161dbd){if(_0x161dbd){_0x147bd2=_0x161dbd;var _0x3e0b21={};for(var _0x3bc971=0x0,_0x2d37df=_0x147bd2[_0x6f70('0x2e')];_0x3bc971<_0x2d37df;_0x3bc971++){if(!_0x3e0b21['hasOwnProperty'](_0x147bd2[_0x3bc971][_0x6f70('0x5f')])){_0x3e0b21[_0x147bd2[_0x3bc971][_0x6f70('0x5f')]]=needsEncapsulation(_0x147bd2[_0x3bc971][_0x6f70('0x60')])?encapsulate(_0x147bd2[_0x3bc971][_0x6f70('0x60')]):_0x147bd2[_0x3bc971][_0x6f70('0x60')];}}var _0x4a5654=[],_0x1e023f={};for(var _0x3e77a2=0x0,_0x5af0e8=_0x198d71[_0x6f70('0x2e')];_0x3e77a2<_0x5af0e8;_0x3e77a2++){_0x1e023f={'ProjectId':_0x218763['params']['id'],'SessionId':_0x198d71[_0x3e77a2]['id'],'StartTime':moment(_0x198d71[_0x3e77a2]['starttime'])[_0x6f70('0x61')](_0x6f70('0x62'))};for(var _0x290052=0x0,_0x199dac=_0x147bd2['length'];_0x290052<_0x199dac;_0x290052++){if(_0x147bd2[_0x290052][_0x6f70('0x63')]==_0x198d71[_0x3e77a2]['id']&&_0x3e0b21[_0x6f70('0x53')](_0x147bd2[_0x290052][_0x6f70('0x5f')])){_0x1e023f[_0x3e0b21[_0x147bd2[_0x290052][_0x6f70('0x5f')]]]=_0x147bd2[_0x290052][_0x6f70('0x64')];}}for(var _0x1222f6 in _0x3e0b21){if(!_0x1e023f[_0x6f70('0x53')](_0x3e0b21[_0x1222f6])){_0x1e023f[_0x3e0b21[_0x1222f6]]=null;}}_0x4a5654[_0x6f70('0x65')](_0x1e023f);}return _0x4a5654;}})[_0x6f70('0x1d')](function(_0x5ae20a){if(!_['isEmpty'](_0x5ae20a)){var _0x3807bc=toCsv(_0x5ae20a);var _0x5ddc60=Date[_0x6f70('0x66')]();fs['writeFileSync'](util[_0x6f70('0x61')](_0x6f70('0x67'),_0x218763[_0x6f70('0x56')]['id'],_0x5ddc60),_0x3807bc);_0x5c7a44['setHeader'](_0x6f70('0x68'),_0x6f70('0x69')+util['format'](_0x6f70('0x6a'),_0x218763[_0x6f70('0x56')]['id'],_0x5ddc60));_0x5c7a44['setHeader'](_0x6f70('0x6b'),'text/csv');return _0x5c7a44[_0x6f70('0x6c')](util[_0x6f70('0x61')](_0x6f70('0x67'),_0x218763[_0x6f70('0x56')]['id'],_0x5ddc60));}else{return _0x5c7a44['sendStatus'](0xcc);}})[_0x6f70('0x46')](handleError(_0x5c7a44,null));};
\ No newline at end of file
+var _0xbd5f=['sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','get','UserProfileResource','error','stack','name','index','keys','query','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','map','key','filter','options','includeAll','include','findAll','catch','show','JscriptyProject','rawAttributes','intersection','find','body','user','role','Projects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','updatedAt','omit','createdAt','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','getSessions','findOne','JscriptySessionReport','ProjectId','JscriptyAnswerReport','rows','number','toString','indexOf','replace','getSummary','startTime','JscriptyQuestionReport','-createdAt','questionId','question','starttime','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x527ced,_0x4b9c36){var _0x4d2e88=function(_0x5412c1){while(--_0x5412c1){_0x527ced['push'](_0x527ced['shift']());}};_0x4d2e88(++_0x4b9c36);}(_0xbd5f,0xce));var _0xfbd5=function(_0x2a0377,_0x44da1c){_0x2a0377=_0x2a0377-0x0;var _0x1f1762=_0xbd5f[_0x2a0377];return _0x1f1762;};'use strict';var pdf=require(_0xfbd5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfbd5('0x1'));var zipdir=require(_0xfbd5('0x2'));var jsonpatch=require(_0xfbd5('0x3'));var rp=require(_0xfbd5('0x4'));var moment=require(_0xfbd5('0x5'));var BPromise=require(_0xfbd5('0x6'));var Mustache=require('mustache');var util=require(_0xfbd5('0x7'));var path=require(_0xfbd5('0x8'));var sox=require(_0xfbd5('0x9'));var csv=require(_0xfbd5('0xa'));var ejs=require(_0xfbd5('0xb'));var fs=require('fs');var _=require(_0xfbd5('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfbd5('0xd'));var deskjs=require(_0xfbd5('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfbd5('0xf'));var Papa=require('papaparse');var authService=require(_0xfbd5('0x10'));var hardwareService=require(_0xfbd5('0x11'));var Redis=require(_0xfbd5('0x12'));var qs=require(_0xfbd5('0x13'));var logger=require(_0xfbd5('0x14'))(_0xfbd5('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c28a6,_0x865f00){_0x865f00=_0x865f00||0xcc;return function(_0x514396){if(_0x514396){return _0x2c28a6[_0xfbd5('0x16')](_0x865f00);}return _0x2c28a6[_0xfbd5('0x17')](_0x865f00)[_0xfbd5('0x18')]();};}function respondWithResult(_0x319239,_0x382d79){_0x382d79=_0x382d79||0xc8;return function(_0x25c1f7){if(_0x25c1f7){return _0x319239['status'](_0x382d79)[_0xfbd5('0x19')](_0x25c1f7);}};}function respondWithFilteredResult(_0x2d3514,_0x2eca3e){return function(_0x4804df){if(_0x4804df){var _0x316c0e=_0x4804df[_0xfbd5('0x1a')],_0x3cdd77=_0x2eca3e[_0xfbd5('0x1b')],_0x5ed430=_0x2eca3e['offset']+_0x2eca3e[_0xfbd5('0x1c')],_0x339749;if(_0x5ed430>=_0x316c0e){_0x5ed430=_0x316c0e;_0x339749=0xc8;}else{_0x339749=0xce;}_0x2d3514[_0xfbd5('0x17')](_0x339749);return _0x2d3514[_0xfbd5('0x1d')](_0xfbd5('0x1e'),_0x3cdd77+'-'+_0x5ed430+'/'+_0x316c0e)['json'](_0x4804df);}return null;};}function patchUpdates(_0x131068){return function(_0x99f97d){try{jsonpatch[_0xfbd5('0x1f')](_0x99f97d,_0x131068,!![]);}catch(_0x5d365d){return BPromise['reject'](_0x5d365d);}return _0x99f97d['save']();};}function saveUpdates(_0x47dd6e,_0x23c0e2){return function(_0x2c3225){if(_0x2c3225){return _0x2c3225[_0xfbd5('0x20')](_0x47dd6e)[_0xfbd5('0x21')](function(_0x524867){return _0x524867;});}return null;};}function removeEntity(_0x59ffd4,_0x29fdb3){return function(_0x4e4dc3){if(_0x4e4dc3){return _0x4e4dc3[_0xfbd5('0x22')]()[_0xfbd5('0x21')](function(){var _0x1bb649=_0x4e4dc3[_0xfbd5('0x23')]({'plain':!![]});var _0x279ae4='Projects';return db[_0xfbd5('0x24')]['destroy']({'where':{'type':_0x279ae4,'resourceId':_0x1bb649['id']}})[_0xfbd5('0x21')](function(){return _0x4e4dc3;});})['then'](function(){_0x59ffd4[_0xfbd5('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x424a61,_0x4aa47a){return function(_0x1160b8){if(!_0x1160b8){_0x424a61['sendStatus'](0x194);}return _0x1160b8;};}function handleError(_0x8e657e,_0x5724f6){_0x5724f6=_0x5724f6||0x1f4;return function(_0x4a35dc){logger[_0xfbd5('0x25')](_0x4a35dc[_0xfbd5('0x26')]);if(_0x4a35dc[_0xfbd5('0x27')]){delete _0x4a35dc[_0xfbd5('0x27')];}_0x8e657e[_0xfbd5('0x17')](_0x5724f6)['send'](_0x4a35dc);};}exports[_0xfbd5('0x28')]=function(_0x4572d7,_0x22ef67){var _0x448118={},_0x3a9aa8={},_0xc468a9={'count':0x0,'rows':[]};var _0x4a1d71=db['JscriptyProject']['rawAttributes'];_0x3a9aa8['model']=_[_0xfbd5('0x29')](_0x4a1d71);_0x3a9aa8[_0xfbd5('0x2a')]=_[_0xfbd5('0x29')](_0x4572d7['query']);_0x3a9aa8['filters']=_['intersection'](_0x3a9aa8[_0xfbd5('0x2b')],_0x3a9aa8[_0xfbd5('0x2a')]);_0x448118[_0xfbd5('0x2c')]=_['intersection'](_0x3a9aa8[_0xfbd5('0x2b')],qs[_0xfbd5('0x2d')](_0x4572d7[_0xfbd5('0x2a')][_0xfbd5('0x2d')]));_0x448118['attributes']=_0x448118[_0xfbd5('0x2c')][_0xfbd5('0x2e')]?_0x448118[_0xfbd5('0x2c')]:_0x3a9aa8[_0xfbd5('0x2b')];if(!_0x4572d7[_0xfbd5('0x2a')][_0xfbd5('0x2f')](_0xfbd5('0x30'))){_0x448118[_0xfbd5('0x1c')]=qs['limit'](_0x4572d7['query'][_0xfbd5('0x1c')]);_0x448118[_0xfbd5('0x1b')]=qs[_0xfbd5('0x1b')](_0x4572d7['query']['offset']);}_0x448118[_0xfbd5('0x31')]=qs['sort'](_0x4572d7[_0xfbd5('0x2a')][_0xfbd5('0x32')]);_0x448118[_0xfbd5('0x33')]=qs[_0xfbd5('0x34')](_[_0xfbd5('0x35')](_0x4572d7['query'],_0x3a9aa8[_0xfbd5('0x34')]));if(_0x4572d7['query']['filter']){_0x448118[_0xfbd5('0x33')]=_[_0xfbd5('0x36')](_0x448118[_0xfbd5('0x33')],{'$or':_[_0xfbd5('0x37')](_0x4a1d71,function(_0x2f3859){if(_0x2f3859['type'][_0xfbd5('0x38')]!=='VIRTUAL'){var _0x2ac028={};_0x2ac028[_0x2f3859['field']]={'$like':'%'+_0x4572d7['query'][_0xfbd5('0x39')]+'%'};return _0x2ac028;}})});}_0x448118=_[_0xfbd5('0x36')]({},_0x448118,_0x4572d7[_0xfbd5('0x3a')]);var _0x473e86={'where':_0x448118['where']};return db['JscriptyProject'][_0xfbd5('0x1a')](_0x473e86)[_0xfbd5('0x21')](function(_0x1cfbfc){_0xc468a9['count']=_0x1cfbfc;if(_0x4572d7['query'][_0xfbd5('0x3b')]){_0x448118[_0xfbd5('0x3c')]=[{'all':!![]}];}return db['JscriptyProject'][_0xfbd5('0x3d')](_0x448118);})[_0xfbd5('0x21')](function(_0x1b63f4){_0xc468a9['rows']=_0x1b63f4;return _0xc468a9;})[_0xfbd5('0x21')](respondWithFilteredResult(_0x22ef67,_0x448118))[_0xfbd5('0x3e')](handleError(_0x22ef67,null));};exports[_0xfbd5('0x3f')]=function(_0x5863f8,_0x574b8d){var _0x554650={'raw':![],'where':{'id':_0x5863f8['params']['id']}},_0x9044f8={};_0x9044f8[_0xfbd5('0x2b')]=_[_0xfbd5('0x29')](db[_0xfbd5('0x40')][_0xfbd5('0x41')]);_0x9044f8[_0xfbd5('0x2a')]=_['keys'](_0x5863f8[_0xfbd5('0x2a')]);_0x9044f8[_0xfbd5('0x34')]=_['intersection'](_0x9044f8[_0xfbd5('0x2b')],_0x9044f8['query']);_0x554650[_0xfbd5('0x2c')]=_[_0xfbd5('0x42')](_0x9044f8[_0xfbd5('0x2b')],qs['fields'](_0x5863f8[_0xfbd5('0x2a')][_0xfbd5('0x2d')]));_0x554650['attributes']=_0x554650[_0xfbd5('0x2c')][_0xfbd5('0x2e')]?_0x554650[_0xfbd5('0x2c')]:_0x9044f8['model'];if(_0x5863f8['query']['includeAll']){_0x554650[_0xfbd5('0x3c')]=[{'all':!![]}];}_0x554650=_[_0xfbd5('0x36')]({},_0x554650,_0x5863f8[_0xfbd5('0x3a')]);return db[_0xfbd5('0x40')][_0xfbd5('0x43')](_0x554650)['then'](handleEntityNotFound(_0x574b8d,null))[_0xfbd5('0x21')](respondWithResult(_0x574b8d,null))[_0xfbd5('0x3e')](handleError(_0x574b8d,null));};exports['create']=function(_0x403e95,_0x3128c6){return db['JscriptyProject']['create'](_0x403e95[_0xfbd5('0x44')],{})['then'](function(_0x5d6811){var _0x43618d=_0x403e95[_0xfbd5('0x45')]['get']({'plain':!![]});if(!_0x43618d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43618d[_0xfbd5('0x46')]===_0xfbd5('0x45')){var _0x23c8e1=_0x5d6811[_0xfbd5('0x23')]({'plain':!![]});var _0xb04fb7=_0xfbd5('0x47');return db[_0xfbd5('0x48')][_0xfbd5('0x43')]({'where':{'name':_0xb04fb7,'userProfileId':_0x43618d[_0xfbd5('0x49')]},'raw':!![]})[_0xfbd5('0x21')](function(_0x27bce0){if(_0x27bce0&&_0x27bce0[_0xfbd5('0x4a')]===0x0){return db[_0xfbd5('0x24')]['create']({'name':_0x23c8e1[_0xfbd5('0x27')],'resourceId':_0x23c8e1['id'],'type':_0x27bce0[_0xfbd5('0x27')],'sectionId':_0x27bce0['id']},{})[_0xfbd5('0x21')](function(){return _0x5d6811;});}else{return _0x5d6811;}})[_0xfbd5('0x3e')](function(_0x1d5d36){logger[_0xfbd5('0x25')](_0xfbd5('0x4b'),_0x1d5d36);throw _0x1d5d36;});}return _0x5d6811;})[_0xfbd5('0x21')](respondWithResult(_0x3128c6,0xc9))[_0xfbd5('0x3e')](handleError(_0x3128c6,null));};exports['clone']=function(_0x555b0c,_0xcc5f54){var _0x4932be={'raw':![],'where':{'id':_0x555b0c[_0xfbd5('0x4c')]['id']}},_0x4814b9={};_0x4814b9['model']=_['keys'](db[_0xfbd5('0x40')][_0xfbd5('0x41')]);_0x4932be['attributes']=_[_0xfbd5('0x42')](_0x4814b9[_0xfbd5('0x2b')],qs[_0xfbd5('0x2d')](_0x555b0c[_0xfbd5('0x2a')][_0xfbd5('0x2d')]));_0x4932be[_0xfbd5('0x2c')]=_0x4932be[_0xfbd5('0x2c')]['length']?_0x4932be[_0xfbd5('0x2c')]:_0x4814b9[_0xfbd5('0x2b')];if(_0x555b0c[_0xfbd5('0x2a')][_0xfbd5('0x3b')]){_0x4932be[_0xfbd5('0x3c')]=[{'all':!![]}];}_0x4932be=_[_0xfbd5('0x36')]({},_0x4932be,_0x555b0c[_0xfbd5('0x3a')]);return db[_0xfbd5('0x40')][_0xfbd5('0x43')](_0x4932be)[_0xfbd5('0x21')](handleEntityNotFound(_0xcc5f54,null))['then'](function(_0x351127){if(_0x351127){var _0x302be5=_0x351127[_0xfbd5('0x23')]({'plain':!![]});_0x302be5=qs['omit'](_0x302be5,['id','createdAt',_0xfbd5('0x4d')]);_0x555b0c['body']=_[_0xfbd5('0x4e')](_0x555b0c[_0xfbd5('0x44')],['id',_0xfbd5('0x4f'),_0xfbd5('0x4d')]);return db[_0xfbd5('0x40')][_0xfbd5('0x50')](_[_0xfbd5('0x36')](_0x302be5,_0x555b0c[_0xfbd5('0x44')]),{'include':_0x555b0c[_0xfbd5('0x2a')][_0xfbd5('0x3b')]?[{'all':!![]}]:undefined})['then'](function(_0x10812d){var _0x71e45b=_0x555b0c[_0xfbd5('0x45')][_0xfbd5('0x23')]({'plain':!![]});if(!_0x71e45b)throw new Error(_0xfbd5('0x51'));if(_0x71e45b['role']===_0xfbd5('0x45')){var _0x1bc6b0=_0x10812d[_0xfbd5('0x23')]({'plain':!![]});var _0x230af7=_0xfbd5('0x47');return db['UserProfileSection']['find']({'where':{'name':_0x230af7,'userProfileId':_0x71e45b[_0xfbd5('0x49')]},'raw':!![]})[_0xfbd5('0x21')](function(_0x531cae){if(_0x531cae&&_0x531cae['autoAssociation']===0x0){return db[_0xfbd5('0x24')][_0xfbd5('0x50')]({'name':_0x1bc6b0['name'],'resourceId':_0x1bc6b0['id'],'type':_0x531cae['name'],'sectionId':_0x531cae['id']},{})[_0xfbd5('0x21')](function(){return _0x10812d;});}else{return _0x10812d;}})['catch'](function(_0x30f716){logger[_0xfbd5('0x25')](_0xfbd5('0x4b'),_0x30f716);throw _0x30f716;});}return _0x10812d;});}})[_0xfbd5('0x21')](respondWithResult(_0xcc5f54,0xc9))[_0xfbd5('0x3e')](handleError(_0xcc5f54,null));};exports[_0xfbd5('0x20')]=function(_0x34cbbe,_0x5b3975){if(_0x34cbbe[_0xfbd5('0x44')]['id']){delete _0x34cbbe[_0xfbd5('0x44')]['id'];}return db[_0xfbd5('0x40')][_0xfbd5('0x43')]({'where':{'id':_0x34cbbe[_0xfbd5('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5b3975,null))[_0xfbd5('0x21')](saveUpdates(_0x34cbbe[_0xfbd5('0x44')],null))[_0xfbd5('0x21')](respondWithResult(_0x5b3975,null))['catch'](handleError(_0x5b3975,null));};exports['destroy']=function(_0x33f3c1,_0x188193){return db[_0xfbd5('0x40')][_0xfbd5('0x43')]({'where':{'id':_0x33f3c1['params']['id']}})[_0xfbd5('0x21')](handleEntityNotFound(_0x188193,null))[_0xfbd5('0x21')](removeEntity(_0x188193,null))[_0xfbd5('0x3e')](handleError(_0x188193,null));};exports[_0xfbd5('0x52')]=function(_0x4b7608,_0x2e85c1,_0x423553){var _0x3aa920={'raw':!![],'where':{}};var _0x2ea247={};var _0x2c3d0={'count':0x0,'rows':[]};return db[_0xfbd5('0x40')][_0xfbd5('0x53')]({'where':{'id':_0x4b7608[_0xfbd5('0x4c')]['id']}})[_0xfbd5('0x21')](handleEntityNotFound(_0x2e85c1,null))[_0xfbd5('0x21')](function(_0xa927b8){if(_0xa927b8){_0x2ea247[_0xfbd5('0x2b')]=_[_0xfbd5('0x29')](db[_0xfbd5('0x54')][_0xfbd5('0x41')]);_0x2ea247[_0xfbd5('0x2a')]=_[_0xfbd5('0x29')](_0x4b7608[_0xfbd5('0x2a')]);_0x2ea247[_0xfbd5('0x34')]=_[_0xfbd5('0x42')](_0x2ea247[_0xfbd5('0x2b')],_0x2ea247[_0xfbd5('0x2a')]);_0x3aa920['attributes']=_[_0xfbd5('0x42')](_0x2ea247[_0xfbd5('0x2b')],qs['fields'](_0x4b7608[_0xfbd5('0x2a')][_0xfbd5('0x2d')]));_0x3aa920[_0xfbd5('0x2c')]=_0x3aa920[_0xfbd5('0x2c')]['length']?_0x3aa920[_0xfbd5('0x2c')]:_0x2ea247[_0xfbd5('0x2b')];if(!_0x4b7608['query'][_0xfbd5('0x2f')](_0xfbd5('0x30'))){_0x3aa920[_0xfbd5('0x1c')]=qs[_0xfbd5('0x1c')](_0x4b7608[_0xfbd5('0x2a')]['limit']);_0x3aa920['offset']=qs[_0xfbd5('0x1b')](_0x4b7608[_0xfbd5('0x2a')][_0xfbd5('0x1b')]);}_0x3aa920[_0xfbd5('0x31')]=qs[_0xfbd5('0x32')](_0x4b7608[_0xfbd5('0x2a')][_0xfbd5('0x32')]);_0x3aa920[_0xfbd5('0x33')]=qs[_0xfbd5('0x34')](_[_0xfbd5('0x35')](_0x4b7608[_0xfbd5('0x2a')],_0x2ea247[_0xfbd5('0x34')]));_0x3aa920[_0xfbd5('0x33')][_0xfbd5('0x55')]=_0xa927b8['id'];if(_0x4b7608[_0xfbd5('0x2a')]['filter']){_0x3aa920[_0xfbd5('0x33')]=_[_0xfbd5('0x36')](_0x3aa920['where'],{'$or':_[_0xfbd5('0x37')](_0x3aa920[_0xfbd5('0x2c')],function(_0x5afcda){var _0x7870a4={};_0x7870a4[_0x5afcda]={'$like':'%'+_0x4b7608[_0xfbd5('0x2a')][_0xfbd5('0x39')]+'%'};return _0x7870a4;})});}_0x3aa920=_[_0xfbd5('0x36')]({},_0x3aa920,_0x4b7608[_0xfbd5('0x3a')]);return db[_0xfbd5('0x54')][_0xfbd5('0x1a')]({'where':_0x3aa920[_0xfbd5('0x33')]})[_0xfbd5('0x21')](function(_0x4d1a7b){_0x2c3d0['count']=_0x4d1a7b;if(_0x4b7608[_0xfbd5('0x2a')][_0xfbd5('0x3b')]){_0x3aa920[_0xfbd5('0x3c')]=[{'all':!![]}];}return db[_0xfbd5('0x54')][_0xfbd5('0x3d')](_0x3aa920);})[_0xfbd5('0x21')](function(_0x39c4de){_0x2c3d0['rows']=_0x39c4de;return _0x2c3d0;});}})['then'](respondWithFilteredResult(_0x2e85c1,_0x3aa920))[_0xfbd5('0x3e')](handleError(_0x2e85c1,null));};exports['getAnswers']=function(_0x27e033,_0x3e500d,_0x321b80){var _0x20f54f={'raw':!![],'where':{}};var _0x2fffab={};var _0x320b62={'count':0x0,'rows':[]};return db[_0xfbd5('0x40')][_0xfbd5('0x53')]({'where':{'id':_0x27e033[_0xfbd5('0x4c')]['id']}})[_0xfbd5('0x21')](handleEntityNotFound(_0x3e500d,null))[_0xfbd5('0x21')](function(_0x2981d9){if(_0x2981d9){_0x2fffab[_0xfbd5('0x2b')]=_[_0xfbd5('0x29')](db[_0xfbd5('0x56')][_0xfbd5('0x41')]);_0x2fffab[_0xfbd5('0x2a')]=_[_0xfbd5('0x29')](_0x27e033[_0xfbd5('0x2a')]);_0x2fffab['filters']=_[_0xfbd5('0x42')](_0x2fffab[_0xfbd5('0x2b')],_0x2fffab['query']);_0x20f54f['attributes']=_[_0xfbd5('0x42')](_0x2fffab['model'],qs[_0xfbd5('0x2d')](_0x27e033[_0xfbd5('0x2a')][_0xfbd5('0x2d')]));_0x20f54f[_0xfbd5('0x2c')]=_0x20f54f[_0xfbd5('0x2c')][_0xfbd5('0x2e')]?_0x20f54f['attributes']:_0x2fffab[_0xfbd5('0x2b')];if(!_0x27e033['query']['hasOwnProperty'](_0xfbd5('0x30'))){_0x20f54f[_0xfbd5('0x1c')]=qs[_0xfbd5('0x1c')](_0x27e033[_0xfbd5('0x2a')][_0xfbd5('0x1c')]);_0x20f54f['offset']=qs['offset'](_0x27e033['query'][_0xfbd5('0x1b')]);}_0x20f54f[_0xfbd5('0x31')]=qs['sort'](_0x27e033[_0xfbd5('0x2a')]['sort']);_0x20f54f[_0xfbd5('0x33')]=qs[_0xfbd5('0x34')](_[_0xfbd5('0x35')](_0x27e033[_0xfbd5('0x2a')],_0x2fffab[_0xfbd5('0x34')]));_0x20f54f[_0xfbd5('0x33')][_0xfbd5('0x55')]=_0x2981d9['id'];if(_0x27e033[_0xfbd5('0x2a')][_0xfbd5('0x39')]){_0x20f54f[_0xfbd5('0x33')]=_['merge'](_0x20f54f[_0xfbd5('0x33')],{'$or':_[_0xfbd5('0x37')](_0x20f54f[_0xfbd5('0x2c')],function(_0x54f94c){var _0x2ab5de={};_0x2ab5de[_0x54f94c]={'$like':'%'+_0x27e033[_0xfbd5('0x2a')][_0xfbd5('0x39')]+'%'};return _0x2ab5de;})});}_0x20f54f=_['merge']({},_0x20f54f,_0x27e033['options']);return db[_0xfbd5('0x56')]['count']({'where':_0x20f54f['where']})[_0xfbd5('0x21')](function(_0x440969){_0x320b62[_0xfbd5('0x1a')]=_0x440969;if(_0x27e033[_0xfbd5('0x2a')][_0xfbd5('0x3b')]){_0x20f54f['include']=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x20f54f);})[_0xfbd5('0x21')](function(_0x501c18){_0x320b62[_0xfbd5('0x57')]=_0x501c18;return _0x320b62;});}})['then'](respondWithFilteredResult(_0x3e500d,_0x20f54f))['catch'](handleError(_0x3e500d,null));};function char(_0x2a1f89){return _0xfbd5('0x58')===typeof _0x2a1f89?String['fromCharCode']['apply'](null,arguments):_0x2a1f89;}function needsEncapsulation(_0x324bca){return!!_0x324bca&&(_0x324bca[_0xfbd5('0x59')]()[_0xfbd5('0x5a')](char(0xd))>=0x0||_0x324bca[_0xfbd5('0x59')]()[_0xfbd5('0x5a')](char(0xa))>=0x0||_0x324bca['toString']()[_0xfbd5('0x5a')](char(0x2c))>=0x0||_0x324bca['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x4dfd9b){var _0x2caf26=char(0x22),_0x524bee='\x5c'+char(0x22),_0x23411e=_0x4dfd9b[_0xfbd5('0x59')]()[_0xfbd5('0x5b')](new RegExp(_0x2caf26,'g'),_0x524bee);return _0x2caf26+_0x23411e+_0x2caf26;}exports[_0xfbd5('0x5c')]=function(_0x795761,_0xdc6084,_0x1ba79c){var _0x283679,_0x21cfa8;return db['JscriptySessionReport']['findAll']({'where':{'ProjectId':_0x795761[_0xfbd5('0x4c')]['id'],'starttime':_0x795761['query'][_0xfbd5('0x5d')]}})['then'](handleEntityNotFound(_0xdc6084,null))['then'](function(_0x2a7a77){if(_0x2a7a77){_0x283679=_0x2a7a77;return db[_0xfbd5('0x5e')][_0xfbd5('0x3d')]({'where':{'SessionId':{'$in':_[_0xfbd5('0x37')](_0x283679,'id')},'ProjectId':_0x795761['params']['id']},'order':_0xfbd5('0x5f')});}})['then'](handleEntityNotFound(_0xdc6084,null))[_0xfbd5('0x21')](function(_0x437443){if(_0x437443){_0x21cfa8=_0x437443;var _0x50f639={};for(var _0x46d7e6=0x0,_0x525311=_0x21cfa8[_0xfbd5('0x2e')];_0x46d7e6<_0x525311;_0x46d7e6++){if(!_0x50f639[_0xfbd5('0x2f')](_0x21cfa8[_0x46d7e6][_0xfbd5('0x60')])){_0x50f639[_0x21cfa8[_0x46d7e6]['questionId']]=needsEncapsulation(_0x21cfa8[_0x46d7e6][_0xfbd5('0x61')])?encapsulate(_0x21cfa8[_0x46d7e6]['question']):_0x21cfa8[_0x46d7e6][_0xfbd5('0x61')];}}var _0x5cc1f9=[],_0x3c53a3={};for(var _0xa436aa=0x0,_0x5d4aac=_0x283679['length'];_0xa436aa<_0x5d4aac;_0xa436aa++){_0x3c53a3={'ProjectId':_0x795761[_0xfbd5('0x4c')]['id'],'SessionId':_0x283679[_0xa436aa]['id'],'StartTime':moment(_0x283679[_0xa436aa][_0xfbd5('0x62')])['format'](_0xfbd5('0x63'))};for(var _0x5413bb=0x0,_0x3a6c88=_0x21cfa8['length'];_0x5413bb<_0x3a6c88;_0x5413bb++){if(_0x21cfa8[_0x5413bb][_0xfbd5('0x64')]==_0x283679[_0xa436aa]['id']&&_0x50f639['hasOwnProperty'](_0x21cfa8[_0x5413bb][_0xfbd5('0x60')])){_0x3c53a3[_0x50f639[_0x21cfa8[_0x5413bb]['questionId']]]=_0x21cfa8[_0x5413bb][_0xfbd5('0x65')];}}for(var _0x465eac in _0x50f639){if(!_0x3c53a3[_0xfbd5('0x2f')](_0x50f639[_0x465eac])){_0x3c53a3[_0x50f639[_0x465eac]]=null;}}_0x5cc1f9[_0xfbd5('0x66')](_0x3c53a3);}return _0x5cc1f9;}})[_0xfbd5('0x21')](function(_0x324be9){if(!_[_0xfbd5('0x67')](_0x324be9)){var _0x7bdc16=toCsv(_0x324be9);var _0x563ca0=Date['now']();fs[_0xfbd5('0x68')](util[_0xfbd5('0x69')](_0xfbd5('0x6a'),_0x795761[_0xfbd5('0x4c')]['id'],_0x563ca0),_0x7bdc16);_0xdc6084[_0xfbd5('0x6b')](_0xfbd5('0x6c'),_0xfbd5('0x6d')+util['format'](_0xfbd5('0x6e'),_0x795761[_0xfbd5('0x4c')]['id'],_0x563ca0));_0xdc6084[_0xfbd5('0x6b')](_0xfbd5('0x6f'),_0xfbd5('0x70'));return _0xdc6084[_0xfbd5('0x71')](util[_0xfbd5('0x69')](_0xfbd5('0x6a'),_0x795761[_0xfbd5('0x4c')]['id'],_0x563ca0));}else{return _0xdc6084[_0xfbd5('0x16')](0xcc);}})[_0xfbd5('0x3e')](handleError(_0xdc6084,null));};
\ No newline at end of file
index c6ea4d3..35938a0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5b00=['./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','util','api','moment','request-promise'];(function(_0x30eb14,_0x56d32d){var _0x104545=function(_0x22d3d3){while(--_0x22d3d3){_0x30eb14['push'](_0x30eb14['shift']());}};_0x104545(++_0x56d32d);}(_0x5b00,0x113));var _0x05b0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5b00[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x05b0('0x0'));var logger=require('../../config/logger')(_0x05b0('0x1'));var moment=require(_0x05b0('0x2'));var BPromise=require('bluebird');var rp=require(_0x05b0('0x3'));var attributes=require(_0x05b0('0x4'));module[_0x05b0('0x5')]=function(_0x5e6dce,_0x536e44){return _0x5e6dce[_0x05b0('0x6')](_0x05b0('0x7'),attributes,{'tableName':_0x05b0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x546b=['api','moment','request-promise','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','../../config/logger'];(function(_0xed5f9c,_0x5a25cd){var _0x3a1c43=function(_0x251202){while(--_0x251202){_0xed5f9c['push'](_0xed5f9c['shift']());}};_0x3a1c43(++_0x5a25cd);}(_0x546b,0x17a));var _0xb546=function(_0x3e2fcf,_0x579110){_0x3e2fcf=_0x3e2fcf-0x0;var _0x497db7=_0x546b[_0x3e2fcf];return _0x497db7;};'use strict';var _=require(_0xb546('0x0'));var util=require('util');var logger=require(_0xb546('0x1'))(_0xb546('0x2'));var moment=require(_0xb546('0x3'));var BPromise=require('bluebird');var rp=require(_0xb546('0x4'));var attributes=require(_0xb546('0x5'));module[_0xb546('0x6')]=function(_0xa510bf,_0x1a71fe){return _0xa510bf[_0xb546('0x7')](_0xb546('0x8'),attributes,{'tableName':_0xb546('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index eacbfbc..bdf7e7e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbac2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment'];(function(_0x547348,_0x210f75){var _0xd44e19=function(_0x13a30d){while(--_0x13a30d){_0x547348['push'](_0x547348['shift']());}};_0xd44e19(++_0x210f75);}(_0xbac2,0x71));var _0x2bac=function(_0x3b3a82,_0x53b5e0){_0x3b3a82=_0x3b3a82-0x0;var _0x267063=_0xbac2[_0x3b3a82];return _0x267063;};'use strict';var _=require(_0x2bac('0x0'));var util=require('util');var moment=require(_0x2bac('0x1'));var BPromise=require(_0x2bac('0x2'));var rs=require(_0x2bac('0x3'));var fs=require('fs');var Redis=require(_0x2bac('0x4'));var db=require(_0x2bac('0x5'))['db'];var utils=require(_0x2bac('0x6'));var logger=require('../../config/logger')(_0x2bac('0x7'));var config=require(_0x2bac('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2bac('0x9')][_0x2bac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x580af9,_0x3a5ef3,_0x734e6a){return new BPromise(function(_0x45c00b,_0x1cfab3){return client[_0x2bac('0xb')](_0x580af9,_0x734e6a)['then'](function(_0x18f134){logger['info'](_0x2bac('0xc'),_0x3a5ef3,_0x2bac('0xd'));logger[_0x2bac('0xe')](_0x2bac('0xf'),_0x3a5ef3,_0x2bac('0xd'),JSON[_0x2bac('0x10')](_0x18f134));if(_0x18f134[_0x2bac('0x11')]){if(_0x18f134[_0x2bac('0x11')][_0x2bac('0x12')]===0x1f4){logger[_0x2bac('0x11')](_0x2bac('0xc'),_0x3a5ef3,_0x18f134[_0x2bac('0x11')][_0x2bac('0x13')]);return _0x1cfab3(_0x18f134['error']['message']);}logger['error'](_0x2bac('0xc'),_0x3a5ef3,_0x18f134[_0x2bac('0x11')][_0x2bac('0x13')]);return _0x45c00b(_0x18f134['error'][_0x2bac('0x13')]);}else{logger[_0x2bac('0x14')]('JscriptyProject,\x20%s,\x20%s',_0x3a5ef3,_0x2bac('0xd'));_0x45c00b(_0x18f134[_0x2bac('0x15')][_0x2bac('0x13')]);}})[_0x2bac('0x16')](function(_0x1572db){logger[_0x2bac('0x11')]('JscriptyProject,\x20%s,\x20%s',_0x3a5ef3,_0x1572db);_0x1cfab3(_0x1572db);});});}
\ No newline at end of file
+var _0xd758=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','JscriptyProject,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x49b3d3,_0x12ec80){var _0x4c6584=function(_0x1af02e){while(--_0x1af02e){_0x49b3d3['push'](_0x49b3d3['shift']());}};_0x4c6584(++_0x12ec80);}(_0xd758,0x1c6));var _0x8d75=function(_0x132f45,_0x2a182a){_0x132f45=_0x132f45-0x0;var _0x33f7e9=_0xd758[_0x132f45];return _0x33f7e9;};'use strict';var _=require(_0x8d75('0x0'));var util=require(_0x8d75('0x1'));var moment=require(_0x8d75('0x2'));var BPromise=require(_0x8d75('0x3'));var rs=require(_0x8d75('0x4'));var fs=require('fs');var Redis=require(_0x8d75('0x5'));var db=require(_0x8d75('0x6'))['db'];var utils=require(_0x8d75('0x7'));var logger=require(_0x8d75('0x8'))(_0x8d75('0x9'));var config=require('../../config/environment');var jayson=require(_0x8d75('0xa'));var client=jayson[_0x8d75('0xb')][_0x8d75('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4e9fc5,_0x678c53,_0x3322dc){return new BPromise(function(_0x13ef16,_0x4be0e9){return client[_0x8d75('0xd')](_0x4e9fc5,_0x3322dc)[_0x8d75('0xe')](function(_0xec64e4){logger[_0x8d75('0xf')](_0x8d75('0x10'),_0x678c53,_0x8d75('0x11'));logger['debug'](_0x8d75('0x12'),_0x678c53,_0x8d75('0x11'),JSON['stringify'](_0xec64e4));if(_0xec64e4[_0x8d75('0x13')]){if(_0xec64e4[_0x8d75('0x13')][_0x8d75('0x14')]===0x1f4){logger['error'](_0x8d75('0x10'),_0x678c53,_0xec64e4[_0x8d75('0x13')][_0x8d75('0x15')]);return _0x4be0e9(_0xec64e4[_0x8d75('0x13')][_0x8d75('0x15')]);}logger[_0x8d75('0x13')](_0x8d75('0x10'),_0x678c53,_0xec64e4[_0x8d75('0x13')]['message']);return _0x13ef16(_0xec64e4[_0x8d75('0x13')]['message']);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x678c53,_0x8d75('0x11'));_0x13ef16(_0xec64e4['result'][_0x8d75('0x15')]);}})['catch'](function(_0x26e560){logger[_0x8d75('0x13')](_0x8d75('0x10'),_0x678c53,_0x26e560);_0x4be0e9(_0x26e560);});});}
\ No newline at end of file
index da850b3..3c1b8e4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd9dc=['describe','/:id','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','get','/describe'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xd9dc,0x16f));var _0xcd9d=function(_0x3e0709,_0x3e427b){_0x3e0709=_0x3e0709-0x0;var _0x9ed3b4=_0xd9dc[_0x3e0709];return _0x9ed3b4;};'use strict';var multer=require(_0xcd9d('0x0'));var util=require(_0xcd9d('0x1'));var path=require(_0xcd9d('0x2'));var timeout=require(_0xcd9d('0x3'));var express=require(_0xcd9d('0x4'));var router=express[_0xcd9d('0x5')]();var auth=require(_0xcd9d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcd9d('0x7'));var controller=require('./jscriptyQuestionReport.controller');router['get']('/',auth[_0xcd9d('0x8')](),controller['index']);router[_0xcd9d('0x9')](_0xcd9d('0xa'),auth[_0xcd9d('0x8')](),controller[_0xcd9d('0xb')]);router[_0xcd9d('0x9')](_0xcd9d('0xc'),auth[_0xcd9d('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xcd9d('0xd')]);router[_0xcd9d('0xe')]('/:id',auth[_0xcd9d('0x8')](),controller[_0xcd9d('0xf')]);router[_0xcd9d('0x10')](_0xcd9d('0xc'),auth[_0xcd9d('0x8')](),controller[_0xcd9d('0x11')]);module['exports']=router;
\ No newline at end of file
+var _0xa141=['/:id','show','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','describe'];(function(_0x5144a0,_0x4ef0f7){var _0x211070=function(_0x3001aa){while(--_0x3001aa){_0x5144a0['push'](_0x5144a0['shift']());}};_0x211070(++_0x4ef0f7);}(_0xa141,0xdc));var _0x1a14=function(_0x22b19c,_0x49ea85){_0x22b19c=_0x22b19c-0x0;var _0xe9fd87=_0xa141[_0x22b19c];return _0xe9fd87;};'use strict';var multer=require(_0x1a14('0x0'));var util=require(_0x1a14('0x1'));var path=require(_0x1a14('0x2'));var timeout=require(_0x1a14('0x3'));var express=require(_0x1a14('0x4'));var router=express[_0x1a14('0x5')]();var auth=require(_0x1a14('0x6'));var interaction=require(_0x1a14('0x7'));var config=require(_0x1a14('0x8'));var controller=require(_0x1a14('0x9'));router[_0x1a14('0xa')]('/',auth[_0x1a14('0xb')](),controller[_0x1a14('0xc')]);router[_0x1a14('0xa')]('/describe',auth[_0x1a14('0xb')](),controller[_0x1a14('0xd')]);router[_0x1a14('0xa')](_0x1a14('0xe'),auth['isAuthenticated'](),controller[_0x1a14('0xf')]);router['post']('/',auth[_0x1a14('0xb')](),controller['create']);router['put'](_0x1a14('0xe'),auth[_0x1a14('0xb')](),controller[_0x1a14('0x10')]);router['delete'](_0x1a14('0xe'),auth[_0x1a14('0xb')](),controller['destroy']);module[_0x1a14('0x11')]=router;
\ No newline at end of file
index 814ff7d..747ce29 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb58b=['STRING','TEXT','exports'];(function(_0x117ce0,_0x528e86){var _0x1489b9=function(_0x3f4cbd){while(--_0x3f4cbd){_0x117ce0['push'](_0x117ce0['shift']());}};_0x1489b9(++_0x528e86);}(_0xb58b,0x1f1));var _0xbb58=function(_0x189c1e,_0x1d6bf6){_0x189c1e=_0x189c1e-0x0;var _0x5c0d4a=_0xb58b[_0x189c1e];return _0x5c0d4a;};'use strict';var Sequelize=require('sequelize');module[_0xbb58('0x0')]={'question':{'type':Sequelize[_0xbb58('0x1')]},'answer':{'type':Sequelize[_0xbb58('0x2')]('long')},'membername':{'type':Sequelize[_0xbb58('0x1')]},'projectname':{'type':Sequelize[_0xbb58('0x1')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xbb58('0x1')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xbb58('0x1')]},'questionId':{'type':Sequelize[_0xbb58('0x1')]}};
\ No newline at end of file
+var _0xde56=['sequelize','STRING','TEXT','long'];(function(_0x1a8808,_0x2657d6){var _0xdcd9bd=function(_0x3ace8d){while(--_0x3ace8d){_0x1a8808['push'](_0x1a8808['shift']());}};_0xdcd9bd(++_0x2657d6);}(_0xde56,0x144));var _0x6de5=function(_0x1177d5,_0x22b649){_0x1177d5=_0x1177d5-0x0;var _0xc3ddc2=_0xde56[_0x1177d5];return _0xc3ddc2;};'use strict';var Sequelize=require(_0x6de5('0x0'));module['exports']={'question':{'type':Sequelize[_0x6de5('0x1')]},'answer':{'type':Sequelize[_0x6de5('0x2')](_0x6de5('0x3'))},'membername':{'type':Sequelize[_0x6de5('0x1')]},'projectname':{'type':Sequelize[_0x6de5('0x1')]},'queue':{'type':Sequelize[_0x6de5('0x1')]},'uniqueid':{'type':Sequelize[_0x6de5('0x1')]},'calleridname':{'type':Sequelize[_0x6de5('0x1')]},'calleridnum':{'type':Sequelize[_0x6de5('0x1')]},'questionId':{'type':Sequelize[_0x6de5('0x1')]}};
\ No newline at end of file
index edf3574..ab38e40 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1c3d=['VIRTUAL','includeAll','include','findAll','rows','catch','show','options','create','update','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','apply','save','then','destroy','end','sendStatus','error','stack','name','send','index','JscriptyQuestionReport','rawAttributes','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','sort','where','pick','merge','map','type','key'];(function(_0x536107,_0x20cb98){var _0x460378=function(_0x3425bc){while(--_0x3425bc){_0x536107['push'](_0x536107['shift']());}};_0x460378(++_0x20cb98);}(_0x1c3d,0x1b8));var _0xd1c3=function(_0x10f0dd,_0x342d6f){_0x10f0dd=_0x10f0dd-0x0;var _0x56e241=_0x1c3d[_0x10f0dd];return _0x56e241;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd1c3('0x0'));var rimraf=require(_0xd1c3('0x1'));var zipdir=require(_0xd1c3('0x2'));var jsonpatch=require(_0xd1c3('0x3'));var rp=require(_0xd1c3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd1c3('0x5'));var util=require(_0xd1c3('0x6'));var path=require(_0xd1c3('0x7'));var sox=require(_0xd1c3('0x8'));var csv=require(_0xd1c3('0x9'));var ejs=require(_0xd1c3('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd1c3('0xb'));var crypto=require(_0xd1c3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd1c3('0xd'));var toCsv=require(_0xd1c3('0x9'));var querystring=require(_0xd1c3('0xe'));var Papa=require(_0xd1c3('0xf'));var authService=require(_0xd1c3('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0xd1c3('0x11'));var logger=require(_0xd1c3('0x12'))(_0xd1c3('0x13'));var utils=require(_0xd1c3('0x14'));var config=require(_0xd1c3('0x15'));var db=require(_0xd1c3('0x16'))['db'];function respondWithStatusCode(_0x373ffb,_0x280405){_0x280405=_0x280405||0xcc;return function(_0x159691){if(_0x159691){return _0x373ffb['sendStatus'](_0x280405);}return _0x373ffb[_0xd1c3('0x17')](_0x280405)['end']();};}function respondWithResult(_0x5eb3c1,_0x11d1f3){_0x11d1f3=_0x11d1f3||0xc8;return function(_0x57a55e){if(_0x57a55e){return _0x5eb3c1[_0xd1c3('0x17')](_0x11d1f3)[_0xd1c3('0x18')](_0x57a55e);}};}function respondWithFilteredResult(_0x37d175,_0x52e7bc){return function(_0xaaa259){if(_0xaaa259){var _0x4230f7=_0xaaa259[_0xd1c3('0x19')],_0x127067=_0x52e7bc[_0xd1c3('0x1a')],_0x3bc2b=_0x52e7bc[_0xd1c3('0x1a')]+_0x52e7bc[_0xd1c3('0x1b')],_0x42ba11;if(_0x3bc2b>=_0x4230f7){_0x3bc2b=_0x4230f7;_0x42ba11=0xc8;}else{_0x42ba11=0xce;}_0x37d175[_0xd1c3('0x17')](_0x42ba11);return _0x37d175['set']('Content-Range',_0x127067+'-'+_0x3bc2b+'/'+_0x4230f7)[_0xd1c3('0x18')](_0xaaa259);}return null;};}function patchUpdates(_0x3a1a74){return function(_0x3f1df3){try{jsonpatch[_0xd1c3('0x1c')](_0x3f1df3,_0x3a1a74,!![]);}catch(_0x5b2571){return BPromise['reject'](_0x5b2571);}return _0x3f1df3[_0xd1c3('0x1d')]();};}function saveUpdates(_0xac3076,_0x1dcb29){return function(_0x588f4e){if(_0x588f4e){return _0x588f4e['update'](_0xac3076)[_0xd1c3('0x1e')](function(_0x1b5fae){return _0x1b5fae;});}return null;};}function removeEntity(_0x4f8277,_0x4b2f00){return function(_0x1b5732){if(_0x1b5732){return _0x1b5732[_0xd1c3('0x1f')]()[_0xd1c3('0x1e')](function(){_0x4f8277[_0xd1c3('0x17')](0xcc)[_0xd1c3('0x20')]();});}};}function handleEntityNotFound(_0x46ed40,_0x137fd5){return function(_0xaa7580){if(!_0xaa7580){_0x46ed40[_0xd1c3('0x21')](0x194);}return _0xaa7580;};}function handleError(_0x218ef1,_0x5a9d5d){_0x5a9d5d=_0x5a9d5d||0x1f4;return function(_0x56091a){logger[_0xd1c3('0x22')](_0x56091a[_0xd1c3('0x23')]);if(_0x56091a[_0xd1c3('0x24')]){delete _0x56091a[_0xd1c3('0x24')];}_0x218ef1['status'](_0x5a9d5d)[_0xd1c3('0x25')](_0x56091a);};}exports[_0xd1c3('0x26')]=function(_0x54fd33,_0xcb5283){var _0x3f5206={},_0x6f912b={},_0x173cb9={'count':0x0,'rows':[]};var _0x10be91=db[_0xd1c3('0x27')][_0xd1c3('0x28')];_0x6f912b['model']=_['keys'](_0x10be91);_0x6f912b[_0xd1c3('0x29')]=_[_0xd1c3('0x2a')](_0x54fd33[_0xd1c3('0x29')]);_0x6f912b[_0xd1c3('0x2b')]=_[_0xd1c3('0x2c')](_0x6f912b['model'],_0x6f912b[_0xd1c3('0x29')]);_0x3f5206[_0xd1c3('0x2d')]=_['intersection'](_0x6f912b[_0xd1c3('0x2e')],qs['fields'](_0x54fd33[_0xd1c3('0x29')][_0xd1c3('0x2f')]));_0x3f5206[_0xd1c3('0x2d')]=_0x3f5206[_0xd1c3('0x2d')][_0xd1c3('0x30')]?_0x3f5206[_0xd1c3('0x2d')]:_0x6f912b[_0xd1c3('0x2e')];if(!_0x54fd33[_0xd1c3('0x29')][_0xd1c3('0x31')]('nolimit')){_0x3f5206[_0xd1c3('0x1b')]=qs[_0xd1c3('0x1b')](_0x54fd33['query'][_0xd1c3('0x1b')]);_0x3f5206['offset']=qs[_0xd1c3('0x1a')](_0x54fd33[_0xd1c3('0x29')][_0xd1c3('0x1a')]);}_0x3f5206['order']=qs[_0xd1c3('0x32')](_0x54fd33[_0xd1c3('0x29')][_0xd1c3('0x32')]);_0x3f5206[_0xd1c3('0x33')]=qs[_0xd1c3('0x2b')](_[_0xd1c3('0x34')](_0x54fd33[_0xd1c3('0x29')],_0x6f912b[_0xd1c3('0x2b')]));if(_0x54fd33[_0xd1c3('0x29')]['filter']){_0x3f5206['where']=_[_0xd1c3('0x35')](_0x3f5206['where'],{'$or':_[_0xd1c3('0x36')](_0x10be91,function(_0x3b2efa){if(_0x3b2efa[_0xd1c3('0x37')][_0xd1c3('0x38')]!==_0xd1c3('0x39')){var _0x3690f8={};_0x3690f8[_0x3b2efa['field']]={'$like':'%'+_0x54fd33[_0xd1c3('0x29')]['filter']+'%'};return _0x3690f8;}})});}_0x3f5206=_[_0xd1c3('0x35')]({},_0x3f5206,_0x54fd33['options']);var _0x292a57={'where':_0x3f5206['where']};return db['JscriptyQuestionReport'][_0xd1c3('0x19')](_0x292a57)[_0xd1c3('0x1e')](function(_0x40d394){_0x173cb9['count']=_0x40d394;if(_0x54fd33[_0xd1c3('0x29')][_0xd1c3('0x3a')]){_0x3f5206[_0xd1c3('0x3b')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xd1c3('0x3c')](_0x3f5206);})[_0xd1c3('0x1e')](function(_0x21b01a){_0x173cb9[_0xd1c3('0x3d')]=_0x21b01a;return _0x173cb9;})[_0xd1c3('0x1e')](respondWithFilteredResult(_0xcb5283,_0x3f5206))[_0xd1c3('0x3e')](handleError(_0xcb5283,null));};exports[_0xd1c3('0x3f')]=function(_0x5744f0,_0x20c891){var _0x357855={'raw':!![],'where':{'id':_0x5744f0['params']['id']}},_0x58d588={};_0x58d588[_0xd1c3('0x2e')]=_[_0xd1c3('0x2a')](db[_0xd1c3('0x27')][_0xd1c3('0x28')]);_0x58d588[_0xd1c3('0x29')]=_['keys'](_0x5744f0[_0xd1c3('0x29')]);_0x58d588[_0xd1c3('0x2b')]=_[_0xd1c3('0x2c')](_0x58d588[_0xd1c3('0x2e')],_0x58d588[_0xd1c3('0x29')]);_0x357855[_0xd1c3('0x2d')]=_[_0xd1c3('0x2c')](_0x58d588[_0xd1c3('0x2e')],qs[_0xd1c3('0x2f')](_0x5744f0[_0xd1c3('0x29')]['fields']));_0x357855[_0xd1c3('0x2d')]=_0x357855['attributes'][_0xd1c3('0x30')]?_0x357855[_0xd1c3('0x2d')]:_0x58d588[_0xd1c3('0x2e')];if(_0x5744f0['query'][_0xd1c3('0x3a')]){_0x357855[_0xd1c3('0x3b')]=[{'all':!![]}];}_0x357855=_[_0xd1c3('0x35')]({},_0x357855,_0x5744f0[_0xd1c3('0x40')]);return db[_0xd1c3('0x27')]['find'](_0x357855)['then'](handleEntityNotFound(_0x20c891,null))[_0xd1c3('0x1e')](respondWithResult(_0x20c891,null))['catch'](handleError(_0x20c891,null));};exports[_0xd1c3('0x41')]=function(_0x3a261c,_0x426a31){return db[_0xd1c3('0x27')]['create'](_0x3a261c['body'],{})[_0xd1c3('0x1e')](respondWithResult(_0x426a31,0xc9))[_0xd1c3('0x3e')](handleError(_0x426a31,null));};exports[_0xd1c3('0x42')]=function(_0x5df790,_0xc860d5){if(_0x5df790['body']['id']){delete _0x5df790[_0xd1c3('0x43')]['id'];}return db[_0xd1c3('0x27')][_0xd1c3('0x44')]({'where':{'id':_0x5df790[_0xd1c3('0x45')]['id']}})['then'](handleEntityNotFound(_0xc860d5,null))['then'](saveUpdates(_0x5df790[_0xd1c3('0x43')],null))[_0xd1c3('0x1e')](respondWithResult(_0xc860d5,null))[_0xd1c3('0x3e')](handleError(_0xc860d5,null));};exports[_0xd1c3('0x1f')]=function(_0xbaf0b7,_0xae72ab){return db[_0xd1c3('0x27')][_0xd1c3('0x44')]({'where':{'id':_0xbaf0b7['params']['id']}})[_0xd1c3('0x1e')](handleEntityNotFound(_0xae72ab,null))[_0xd1c3('0x1e')](removeEntity(_0xae72ab,null))[_0xd1c3('0x3e')](handleError(_0xae72ab,null));};exports[_0xd1c3('0x46')]=function(_0x2eb58e,_0x5d3db4){return db['JscriptyQuestionReport'][_0xd1c3('0x46')]()['then'](respondWithResult(_0x5d3db4,null))[_0xd1c3('0x3e')](handleError(_0x5d3db4,null));};
\ No newline at end of file
+var _0xfff0=['where','filter','merge','map','type','key','VIRTUAL','field','count','includeAll','include','findAll','rows','show','find','catch','create','body','update','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','Content-Range','json','apply','save','then','destroy','end','sendStatus','error','stack','name','send','index','JscriptyQuestionReport','rawAttributes','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','limit','sort'];(function(_0x1cccc0,_0x48ae3c){var _0x4b9917=function(_0x5a5d4c){while(--_0x5a5d4c){_0x1cccc0['push'](_0x1cccc0['shift']());}};_0x4b9917(++_0x48ae3c);}(_0xfff0,0x139));var _0x0fff=function(_0x52b9b9,_0xec5fcb){_0x52b9b9=_0x52b9b9-0x0;var _0x4aa191=_0xfff0[_0x52b9b9];return _0x4aa191;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0fff('0x0'));var rimraf=require(_0x0fff('0x1'));var zipdir=require(_0x0fff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0fff('0x3'));var moment=require(_0x0fff('0x4'));var BPromise=require(_0x0fff('0x5'));var Mustache=require('mustache');var util=require(_0x0fff('0x6'));var path=require(_0x0fff('0x7'));var sox=require('sox');var csv=require(_0x0fff('0x8'));var ejs=require(_0x0fff('0x9'));var fs=require('fs');var _=require(_0x0fff('0xa'));var squel=require('squel');var crypto=require(_0x0fff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0fff('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0fff('0xd'));var Papa=require(_0x0fff('0xe'));var authService=require('../../components/auth/service');var hardwareService=require(_0x0fff('0xf'));var Redis=require(_0x0fff('0x10'));var qs=require(_0x0fff('0x11'));var logger=require(_0x0fff('0x12'))(_0x0fff('0x13'));var utils=require(_0x0fff('0x14'));var config=require(_0x0fff('0x15'));var db=require(_0x0fff('0x16'))['db'];function respondWithStatusCode(_0x2a0e49,_0x411ffc){_0x411ffc=_0x411ffc||0xcc;return function(_0x13f768){if(_0x13f768){return _0x2a0e49['sendStatus'](_0x411ffc);}return _0x2a0e49[_0x0fff('0x17')](_0x411ffc)['end']();};}function respondWithResult(_0x277b37,_0x431efa){_0x431efa=_0x431efa||0xc8;return function(_0x38fc82){if(_0x38fc82){return _0x277b37[_0x0fff('0x17')](_0x431efa)['json'](_0x38fc82);}};}function respondWithFilteredResult(_0x53bde9,_0x1daf30){return function(_0x50a9e4){if(_0x50a9e4){var _0x5636fd=_0x50a9e4['count'],_0x51ceea=_0x1daf30[_0x0fff('0x18')],_0x1fb430=_0x1daf30[_0x0fff('0x18')]+_0x1daf30['limit'],_0x41e2e7;if(_0x1fb430>=_0x5636fd){_0x1fb430=_0x5636fd;_0x41e2e7=0xc8;}else{_0x41e2e7=0xce;}_0x53bde9['status'](_0x41e2e7);return _0x53bde9['set'](_0x0fff('0x19'),_0x51ceea+'-'+_0x1fb430+'/'+_0x5636fd)[_0x0fff('0x1a')](_0x50a9e4);}return null;};}function patchUpdates(_0x46a02d){return function(_0x3762dc){try{jsonpatch[_0x0fff('0x1b')](_0x3762dc,_0x46a02d,!![]);}catch(_0xe89b4a){return BPromise['reject'](_0xe89b4a);}return _0x3762dc[_0x0fff('0x1c')]();};}function saveUpdates(_0x136520,_0x48e6f9){return function(_0x49d211){if(_0x49d211){return _0x49d211['update'](_0x136520)[_0x0fff('0x1d')](function(_0x330e29){return _0x330e29;});}return null;};}function removeEntity(_0x1f97c5,_0x3c4f8f){return function(_0x502393){if(_0x502393){return _0x502393[_0x0fff('0x1e')]()[_0x0fff('0x1d')](function(){_0x1f97c5[_0x0fff('0x17')](0xcc)[_0x0fff('0x1f')]();});}};}function handleEntityNotFound(_0x16e7f4,_0x17fba6){return function(_0x580b8e){if(!_0x580b8e){_0x16e7f4[_0x0fff('0x20')](0x194);}return _0x580b8e;};}function handleError(_0x29f702,_0x37e090){_0x37e090=_0x37e090||0x1f4;return function(_0x24cd18){logger[_0x0fff('0x21')](_0x24cd18[_0x0fff('0x22')]);if(_0x24cd18['name']){delete _0x24cd18[_0x0fff('0x23')];}_0x29f702[_0x0fff('0x17')](_0x37e090)[_0x0fff('0x24')](_0x24cd18);};}exports[_0x0fff('0x25')]=function(_0x36d268,_0x12d699){var _0x27bd76={},_0x3e6fef={},_0x44e54a={'count':0x0,'rows':[]};var _0xc32a61=db[_0x0fff('0x26')][_0x0fff('0x27')];_0x3e6fef['model']=_[_0x0fff('0x28')](_0xc32a61);_0x3e6fef[_0x0fff('0x29')]=_[_0x0fff('0x28')](_0x36d268[_0x0fff('0x29')]);_0x3e6fef[_0x0fff('0x2a')]=_[_0x0fff('0x2b')](_0x3e6fef['model'],_0x3e6fef[_0x0fff('0x29')]);_0x27bd76[_0x0fff('0x2c')]=_[_0x0fff('0x2b')](_0x3e6fef['model'],qs[_0x0fff('0x2d')](_0x36d268[_0x0fff('0x29')]['fields']));_0x27bd76[_0x0fff('0x2c')]=_0x27bd76[_0x0fff('0x2c')][_0x0fff('0x2e')]?_0x27bd76[_0x0fff('0x2c')]:_0x3e6fef[_0x0fff('0x2f')];if(!_0x36d268[_0x0fff('0x29')][_0x0fff('0x30')](_0x0fff('0x31'))){_0x27bd76[_0x0fff('0x32')]=qs[_0x0fff('0x32')](_0x36d268['query'][_0x0fff('0x32')]);_0x27bd76[_0x0fff('0x18')]=qs[_0x0fff('0x18')](_0x36d268[_0x0fff('0x29')][_0x0fff('0x18')]);}_0x27bd76['order']=qs['sort'](_0x36d268[_0x0fff('0x29')][_0x0fff('0x33')]);_0x27bd76[_0x0fff('0x34')]=qs[_0x0fff('0x2a')](_['pick'](_0x36d268[_0x0fff('0x29')],_0x3e6fef[_0x0fff('0x2a')]));if(_0x36d268[_0x0fff('0x29')][_0x0fff('0x35')]){_0x27bd76['where']=_[_0x0fff('0x36')](_0x27bd76[_0x0fff('0x34')],{'$or':_[_0x0fff('0x37')](_0xc32a61,function(_0x2387cc){if(_0x2387cc[_0x0fff('0x38')][_0x0fff('0x39')]!==_0x0fff('0x3a')){var _0x384f76={};_0x384f76[_0x2387cc[_0x0fff('0x3b')]]={'$like':'%'+_0x36d268[_0x0fff('0x29')][_0x0fff('0x35')]+'%'};return _0x384f76;}})});}_0x27bd76=_[_0x0fff('0x36')]({},_0x27bd76,_0x36d268['options']);var _0x114e9a={'where':_0x27bd76[_0x0fff('0x34')]};return db[_0x0fff('0x26')][_0x0fff('0x3c')](_0x114e9a)[_0x0fff('0x1d')](function(_0xf2135d){_0x44e54a['count']=_0xf2135d;if(_0x36d268[_0x0fff('0x29')][_0x0fff('0x3d')]){_0x27bd76[_0x0fff('0x3e')]=[{'all':!![]}];}return db[_0x0fff('0x26')][_0x0fff('0x3f')](_0x27bd76);})[_0x0fff('0x1d')](function(_0x3dc0b8){_0x44e54a[_0x0fff('0x40')]=_0x3dc0b8;return _0x44e54a;})[_0x0fff('0x1d')](respondWithFilteredResult(_0x12d699,_0x27bd76))['catch'](handleError(_0x12d699,null));};exports[_0x0fff('0x41')]=function(_0x4d89c0,_0x28a8b7){var _0x30f329={'raw':!![],'where':{'id':_0x4d89c0['params']['id']}},_0x126f6a={};_0x126f6a['model']=_[_0x0fff('0x28')](db[_0x0fff('0x26')][_0x0fff('0x27')]);_0x126f6a['query']=_['keys'](_0x4d89c0[_0x0fff('0x29')]);_0x126f6a['filters']=_[_0x0fff('0x2b')](_0x126f6a[_0x0fff('0x2f')],_0x126f6a[_0x0fff('0x29')]);_0x30f329[_0x0fff('0x2c')]=_[_0x0fff('0x2b')](_0x126f6a[_0x0fff('0x2f')],qs['fields'](_0x4d89c0[_0x0fff('0x29')][_0x0fff('0x2d')]));_0x30f329[_0x0fff('0x2c')]=_0x30f329[_0x0fff('0x2c')][_0x0fff('0x2e')]?_0x30f329[_0x0fff('0x2c')]:_0x126f6a[_0x0fff('0x2f')];if(_0x4d89c0['query'][_0x0fff('0x3d')]){_0x30f329[_0x0fff('0x3e')]=[{'all':!![]}];}_0x30f329=_[_0x0fff('0x36')]({},_0x30f329,_0x4d89c0['options']);return db[_0x0fff('0x26')][_0x0fff('0x42')](_0x30f329)[_0x0fff('0x1d')](handleEntityNotFound(_0x28a8b7,null))[_0x0fff('0x1d')](respondWithResult(_0x28a8b7,null))[_0x0fff('0x43')](handleError(_0x28a8b7,null));};exports[_0x0fff('0x44')]=function(_0x2f73cf,_0x2059f2){return db[_0x0fff('0x26')][_0x0fff('0x44')](_0x2f73cf[_0x0fff('0x45')],{})['then'](respondWithResult(_0x2059f2,0xc9))[_0x0fff('0x43')](handleError(_0x2059f2,null));};exports[_0x0fff('0x46')]=function(_0x5c9dad,_0x38c058){if(_0x5c9dad[_0x0fff('0x45')]['id']){delete _0x5c9dad[_0x0fff('0x45')]['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x5c9dad[_0x0fff('0x47')]['id']}})['then'](handleEntityNotFound(_0x38c058,null))['then'](saveUpdates(_0x5c9dad[_0x0fff('0x45')],null))[_0x0fff('0x1d')](respondWithResult(_0x38c058,null))[_0x0fff('0x43')](handleError(_0x38c058,null));};exports[_0x0fff('0x1e')]=function(_0x3b4b8e,_0x1a7677){return db['JscriptyQuestionReport'][_0x0fff('0x42')]({'where':{'id':_0x3b4b8e[_0x0fff('0x47')]['id']}})[_0x0fff('0x1d')](handleEntityNotFound(_0x1a7677,null))[_0x0fff('0x1d')](removeEntity(_0x1a7677,null))[_0x0fff('0x43')](handleError(_0x1a7677,null));};exports[_0x0fff('0x48')]=function(_0x5d1739,_0x17cc91){return db[_0x0fff('0x26')]['describe']()[_0x0fff('0x1d')](respondWithResult(_0x17cc91,null))['catch'](handleError(_0x17cc91,null));};
\ No newline at end of file
index 9eef384..b74f113 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x55d6=['./jscriptyQuestionReport.attributes','report_jscripty_questions','lodash','util','api','moment','bluebird','request-promise'];(function(_0x2d138a,_0x38524c){var _0x1c13e9=function(_0x342d00){while(--_0x342d00){_0x2d138a['push'](_0x2d138a['shift']());}};_0x1c13e9(++_0x38524c);}(_0x55d6,0x112));var _0x655d=function(_0x5899fa,_0x8b9e30){_0x5899fa=_0x5899fa-0x0;var _0x5388e8=_0x55d6[_0x5899fa];return _0x5388e8;};'use strict';var _=require(_0x655d('0x0'));var util=require(_0x655d('0x1'));var logger=require('../../config/logger')(_0x655d('0x2'));var moment=require(_0x655d('0x3'));var BPromise=require(_0x655d('0x4'));var rp=require(_0x655d('0x5'));var attributes=require(_0x655d('0x6'));module['exports']=function(_0x291ea2,_0x31e95a){return _0x291ea2['define']('JscriptyQuestionReport',attributes,{'tableName':_0x655d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x79ad=['bluebird','request-promise','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','lodash','api','moment'];(function(_0x37a68f,_0x3f43c0){var _0x49aa76=function(_0x3d4bb4){while(--_0x3d4bb4){_0x37a68f['push'](_0x37a68f['shift']());}};_0x49aa76(++_0x3f43c0);}(_0x79ad,0x16e));var _0xd79a=function(_0x36c7c0,_0xb7ba6a){_0x36c7c0=_0x36c7c0-0x0;var _0x18ea81=_0x79ad[_0x36c7c0];return _0x18ea81;};'use strict';var _=require(_0xd79a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd79a('0x1'));var moment=require(_0xd79a('0x2'));var BPromise=require(_0xd79a('0x3'));var rp=require(_0xd79a('0x4'));var attributes=require(_0xd79a('0x5'));module[_0xd79a('0x6')]=function(_0x2b7699,_0x50a8d3){return _0x2b7699['define'](_0xd79a('0x7'),attributes,{'tableName':_0xd79a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index aaa625d..58cdf27 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0e55=['error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify'];(function(_0x3b2ebd,_0x5da4e9){var _0x4389ec=function(_0x14ef3d){while(--_0x14ef3d){_0x3b2ebd['push'](_0x3b2ebd['shift']());}};_0x4389ec(++_0x5da4e9);}(_0x0e55,0x1d1));var _0x50e5=function(_0x6f3820,_0x22c69b){_0x6f3820=_0x6f3820-0x0;var _0x4bc1f9=_0x0e55[_0x6f3820];return _0x4bc1f9;};'use strict';var _=require(_0x50e5('0x0'));var util=require(_0x50e5('0x1'));var moment=require(_0x50e5('0x2'));var BPromise=require(_0x50e5('0x3'));var rs=require(_0x50e5('0x4'));var fs=require('fs');var Redis=require(_0x50e5('0x5'));var db=require(_0x50e5('0x6'))['db'];var utils=require(_0x50e5('0x7'));var logger=require(_0x50e5('0x8'))(_0x50e5('0x9'));var config=require(_0x50e5('0xa'));var jayson=require(_0x50e5('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e0b2b,_0x5af3e3,_0x39f203){return new BPromise(function(_0x23101d,_0x414237){return client[_0x50e5('0xc')](_0x2e0b2b,_0x39f203)[_0x50e5('0xd')](function(_0x52d62e){logger[_0x50e5('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5af3e3,_0x50e5('0xf'));logger[_0x50e5('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x5af3e3,_0x50e5('0xf'),JSON[_0x50e5('0x11')](_0x52d62e));if(_0x52d62e[_0x50e5('0x12')]){if(_0x52d62e[_0x50e5('0x12')][_0x50e5('0x13')]===0x1f4){logger['error'](_0x50e5('0x14'),_0x5af3e3,_0x52d62e['error'][_0x50e5('0x15')]);return _0x414237(_0x52d62e[_0x50e5('0x12')][_0x50e5('0x15')]);}logger[_0x50e5('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5af3e3,_0x52d62e['error'][_0x50e5('0x15')]);return _0x23101d(_0x52d62e[_0x50e5('0x12')][_0x50e5('0x15')]);}else{logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x5af3e3,_0x50e5('0xf'));_0x23101d(_0x52d62e[_0x50e5('0x16')]['message']);}})['catch'](function(_0x4f24e8){logger[_0x50e5('0x12')](_0x50e5('0x14'),_0x5af3e3,_0x4f24e8);_0x414237(_0x4f24e8);});});}
\ No newline at end of file
+var _0x37c3=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x37c3,0x1a4));var _0x337c=function(_0x443c1b,_0x1b30cc){_0x443c1b=_0x443c1b-0x0;var _0xd64090=_0x37c3[_0x443c1b];return _0xd64090;};'use strict';var _=require(_0x337c('0x0'));var util=require(_0x337c('0x1'));var moment=require('moment');var BPromise=require(_0x337c('0x2'));var rs=require(_0x337c('0x3'));var fs=require('fs');var Redis=require(_0x337c('0x4'));var db=require(_0x337c('0x5'))['db'];var utils=require(_0x337c('0x6'));var logger=require(_0x337c('0x7'))(_0x337c('0x8'));var config=require('../../config/environment');var jayson=require(_0x337c('0x9'));var client=jayson[_0x337c('0xa')][_0x337c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2be5c3,_0x1fbdb7,_0x6e6b73){return new BPromise(function(_0x30a841,_0x470460){return client[_0x337c('0xc')](_0x2be5c3,_0x6e6b73)['then'](function(_0xff980f){logger[_0x337c('0xd')](_0x337c('0xe'),_0x1fbdb7,_0x337c('0xf'));logger['debug'](_0x337c('0x10'),_0x1fbdb7,'request\x20sent',JSON[_0x337c('0x11')](_0xff980f));if(_0xff980f['error']){if(_0xff980f[_0x337c('0x12')][_0x337c('0x13')]===0x1f4){logger['error'](_0x337c('0xe'),_0x1fbdb7,_0xff980f[_0x337c('0x12')]['message']);return _0x470460(_0xff980f[_0x337c('0x12')][_0x337c('0x14')]);}logger[_0x337c('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1fbdb7,_0xff980f['error'][_0x337c('0x14')]);return _0x30a841(_0xff980f[_0x337c('0x12')]['message']);}else{logger[_0x337c('0xd')](_0x337c('0xe'),_0x1fbdb7,_0x337c('0xf'));_0x30a841(_0xff980f[_0x337c('0x15')][_0x337c('0x14')]);}})[_0x337c('0x16')](function(_0x5e1881){logger[_0x337c('0x12')](_0x337c('0xe'),_0x1fbdb7,_0x5e1881);_0x470460(_0x5e1881);});});}
\ No newline at end of file
index 7372f7e..3d17ee7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf84b=['index','/describe','describe','/:id','show','getQuestions','post','create','put','update','delete','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated'];(function(_0x356460,_0xb1cd1b){var _0x338efe=function(_0x5b313c){while(--_0x5b313c){_0x356460['push'](_0x356460['shift']());}};_0x338efe(++_0xb1cd1b);}(_0xf84b,0x1ee));var _0xbf84=function(_0x20f1ff,_0x1cbbdd){_0x20f1ff=_0x20f1ff-0x0;var _0x58222e=_0xf84b[_0x20f1ff];return _0x58222e;};'use strict';var multer=require('multer');var util=require(_0xbf84('0x0'));var path=require('path');var timeout=require(_0xbf84('0x1'));var express=require(_0xbf84('0x2'));var router=express[_0xbf84('0x3')]();var auth=require(_0xbf84('0x4'));var interaction=require(_0xbf84('0x5'));var config=require(_0xbf84('0x6'));var controller=require(_0xbf84('0x7'));router[_0xbf84('0x8')]('/',auth[_0xbf84('0x9')](),controller[_0xbf84('0xa')]);router['get'](_0xbf84('0xb'),auth[_0xbf84('0x9')](),controller[_0xbf84('0xc')]);router[_0xbf84('0x8')](_0xbf84('0xd'),auth[_0xbf84('0x9')](),controller[_0xbf84('0xe')]);router[_0xbf84('0x8')]('/:id/questions',auth[_0xbf84('0x9')](),controller[_0xbf84('0xf')]);router[_0xbf84('0x10')]('/',auth[_0xbf84('0x9')](),controller[_0xbf84('0x11')]);router[_0xbf84('0x12')](_0xbf84('0xd'),auth['isAuthenticated'](),controller[_0xbf84('0x13')]);router[_0xbf84('0x14')](_0xbf84('0xd'),auth[_0xbf84('0x9')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
+var _0xaea7=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id/questions','getQuestions','post','create','put','/:id','destroy','path'];(function(_0x2e7b26,_0xf0a5ff){var _0x7e6f91=function(_0x5d22b2){while(--_0x5d22b2){_0x2e7b26['push'](_0x2e7b26['shift']());}};_0x7e6f91(++_0xf0a5ff);}(_0xaea7,0x1db));var _0x7aea=function(_0x5445bd,_0x1760d7){_0x5445bd=_0x5445bd-0x0;var _0x165f97=_0xaea7[_0x5445bd];return _0x165f97;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7aea('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7aea('0x1')]();var auth=require(_0x7aea('0x2'));var interaction=require(_0x7aea('0x3'));var config=require(_0x7aea('0x4'));var controller=require('./jscriptySessionReport.controller');router[_0x7aea('0x5')]('/',auth[_0x7aea('0x6')](),controller[_0x7aea('0x7')]);router[_0x7aea('0x5')](_0x7aea('0x8'),auth[_0x7aea('0x6')](),controller[_0x7aea('0x9')]);router['get']('/:id',auth[_0x7aea('0x6')](),controller['show']);router[_0x7aea('0x5')](_0x7aea('0xa'),auth[_0x7aea('0x6')](),controller[_0x7aea('0xb')]);router[_0x7aea('0xc')]('/',auth[_0x7aea('0x6')](),controller[_0x7aea('0xd')]);router[_0x7aea('0xe')](_0x7aea('0xf'),auth[_0x7aea('0x6')](),controller['update']);router['delete'](_0x7aea('0xf'),auth[_0x7aea('0x6')](),controller[_0x7aea('0x10')]);module['exports']=router;
\ No newline at end of file
index a9bb9c3..c3684c2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xff4f=['moment','sequelize','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN'];(function(_0x4bf398,_0xc4c7d0){var _0x13f9b3=function(_0x414fbf){while(--_0x414fbf){_0x4bf398['push'](_0x4bf398['shift']());}};_0x13f9b3(++_0xc4c7d0);}(_0xff4f,0x19a));var _0xfff4=function(_0x5bed8f,_0x4a5e51){_0x5bed8f=_0x5bed8f-0x0;var _0x34d119=_0xff4f[_0x5bed8f];return _0x34d119;};'use strict';var moment=require(_0xfff4('0x0'));var Sequelize=require(_0xfff4('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xfff4('0x2')],'set':function(_0xbd700c){this[_0xfff4('0x3')](_0xfff4('0x4'),_0xbd700c);this[_0xfff4('0x3')](_0xfff4('0x5'),moment()[_0xfff4('0x6')](_0xfff4('0x7')));}},'endtime':{'type':Sequelize[_0xfff4('0x2')]},'membername':{'type':Sequelize[_0xfff4('0x8')]},'projectname':{'type':Sequelize[_0xfff4('0x8')]},'queue':{'type':Sequelize[_0xfff4('0x8')]},'uniqueid':{'type':Sequelize[_0xfff4('0x8')]},'calleridname':{'type':Sequelize[_0xfff4('0x8')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xfff4('0x9')],'defaultValue':![]}};
\ No newline at end of file
+var _0xac80=['YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime','endtime','format'];(function(_0x338b4c,_0x48f49e){var _0x3442f8=function(_0x2d81d4){while(--_0x2d81d4){_0x338b4c['push'](_0x338b4c['shift']());}};_0x3442f8(++_0x48f49e);}(_0xac80,0x163));var _0x0ac8=function(_0x567a92,_0xec96a4){_0x567a92=_0x567a92-0x0;var _0x2fb615=_0xac80[_0x567a92];return _0x2fb615;};'use strict';var moment=require(_0x0ac8('0x0'));var Sequelize=require(_0x0ac8('0x1'));module[_0x0ac8('0x2')]={'starttime':{'type':Sequelize[_0x0ac8('0x3')],'set':function(_0x1ecaad){this[_0x0ac8('0x4')](_0x0ac8('0x5'),_0x1ecaad);this['setDataValue'](_0x0ac8('0x6'),moment()[_0x0ac8('0x7')](_0x0ac8('0x8')));}},'endtime':{'type':Sequelize[_0x0ac8('0x3')]},'membername':{'type':Sequelize[_0x0ac8('0x9')]},'projectname':{'type':Sequelize[_0x0ac8('0x9')]},'queue':{'type':Sequelize[_0x0ac8('0x9')]},'uniqueid':{'type':Sequelize[_0x0ac8('0x9')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x0ac8('0xa')],'defaultValue':![]}};
\ No newline at end of file
index 08c235c..c18a128 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfedb=['filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','destroy','describe','findOne','params','JscriptyQuestionReport','SessionId','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','desk.js','to-csv','../../components/auth/service','../../config/license/hardware','ioredis','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','JscriptySessionReport','rawAttributes','model','keys','query'];(function(_0x1be845,_0x394031){var _0x38f6b0=function(_0x70d9b6){while(--_0x70d9b6){_0x1be845['push'](_0x1be845['shift']());}};_0x38f6b0(++_0x394031);}(_0xfedb,0x14c));var _0xbfed=function(_0x18dce6,_0x2b825e){_0x18dce6=_0x18dce6-0x0;var _0x137eb9=_0xfedb[_0x18dce6];return _0x137eb9;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xbfed('0x0'));var zipdir=require(_0xbfed('0x1'));var jsonpatch=require(_0xbfed('0x2'));var rp=require(_0xbfed('0x3'));var moment=require(_0xbfed('0x4'));var BPromise=require(_0xbfed('0x5'));var Mustache=require(_0xbfed('0x6'));var util=require(_0xbfed('0x7'));var path=require(_0xbfed('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbfed('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbfed('0xa'));var crypto=require(_0xbfed('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbfed('0xc'));var toCsv=require(_0xbfed('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0xbfed('0xe'));var hardwareService=require(_0xbfed('0xf'));var Redis=require(_0xbfed('0x10'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xbfed('0x11'));var utils=require(_0xbfed('0x12'));var config=require('../../config/environment');var db=require(_0xbfed('0x13'))['db'];function respondWithStatusCode(_0x5c24dc,_0x16b5ca){_0x16b5ca=_0x16b5ca||0xcc;return function(_0x1bec8b){if(_0x1bec8b){return _0x5c24dc[_0xbfed('0x14')](_0x16b5ca);}return _0x5c24dc[_0xbfed('0x15')](_0x16b5ca)[_0xbfed('0x16')]();};}function respondWithResult(_0x1e8b25,_0x5bb650){_0x5bb650=_0x5bb650||0xc8;return function(_0x154996){if(_0x154996){return _0x1e8b25[_0xbfed('0x15')](_0x5bb650)[_0xbfed('0x17')](_0x154996);}};}function respondWithFilteredResult(_0x4c2e5d,_0x2d73b5){return function(_0x4a6957){if(_0x4a6957){var _0x2442d6=_0x4a6957[_0xbfed('0x18')],_0x379142=_0x2d73b5[_0xbfed('0x19')],_0xaf13b0=_0x2d73b5[_0xbfed('0x19')]+_0x2d73b5[_0xbfed('0x1a')],_0x2bd7f3;if(_0xaf13b0>=_0x2442d6){_0xaf13b0=_0x2442d6;_0x2bd7f3=0xc8;}else{_0x2bd7f3=0xce;}_0x4c2e5d[_0xbfed('0x15')](_0x2bd7f3);return _0x4c2e5d[_0xbfed('0x1b')](_0xbfed('0x1c'),_0x379142+'-'+_0xaf13b0+'/'+_0x2442d6)[_0xbfed('0x17')](_0x4a6957);}return null;};}function patchUpdates(_0x4ddb4a){return function(_0x4ba2bb){try{jsonpatch[_0xbfed('0x1d')](_0x4ba2bb,_0x4ddb4a,!![]);}catch(_0x3ce1f3){return BPromise[_0xbfed('0x1e')](_0x3ce1f3);}return _0x4ba2bb[_0xbfed('0x1f')]();};}function saveUpdates(_0x54676f,_0xdbf58e){return function(_0x68d5fd){if(_0x68d5fd){return _0x68d5fd[_0xbfed('0x20')](_0x54676f)[_0xbfed('0x21')](function(_0x42c2c2){return _0x42c2c2;});}return null;};}function removeEntity(_0x5c7485,_0x176664){return function(_0x43451e){if(_0x43451e){return _0x43451e['destroy']()[_0xbfed('0x21')](function(){_0x5c7485[_0xbfed('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x544cf8,_0x2eb32c){return function(_0x4f05d8){if(!_0x4f05d8){_0x544cf8[_0xbfed('0x14')](0x194);}return _0x4f05d8;};}function handleError(_0x181acc,_0x58fbd7){_0x58fbd7=_0x58fbd7||0x1f4;return function(_0xd430bf){logger[_0xbfed('0x22')](_0xd430bf[_0xbfed('0x23')]);if(_0xd430bf['name']){delete _0xd430bf[_0xbfed('0x24')];}_0x181acc['status'](_0x58fbd7)[_0xbfed('0x25')](_0xd430bf);};}exports['index']=function(_0x4c1b70,_0x4ac0f4){var _0x54369e={},_0x374d82={},_0x3f56b3={'count':0x0,'rows':[]};var _0x1f7de8=db[_0xbfed('0x26')][_0xbfed('0x27')];_0x374d82[_0xbfed('0x28')]=_[_0xbfed('0x29')](_0x1f7de8);_0x374d82[_0xbfed('0x2a')]=_['keys'](_0x4c1b70['query']);_0x374d82[_0xbfed('0x2b')]=_[_0xbfed('0x2c')](_0x374d82[_0xbfed('0x28')],_0x374d82[_0xbfed('0x2a')]);_0x54369e[_0xbfed('0x2d')]=_[_0xbfed('0x2c')](_0x374d82[_0xbfed('0x28')],qs[_0xbfed('0x2e')](_0x4c1b70['query'][_0xbfed('0x2e')]));_0x54369e[_0xbfed('0x2d')]=_0x54369e[_0xbfed('0x2d')]['length']?_0x54369e['attributes']:_0x374d82[_0xbfed('0x28')];if(!_0x4c1b70[_0xbfed('0x2a')][_0xbfed('0x2f')](_0xbfed('0x30'))){_0x54369e[_0xbfed('0x1a')]=qs[_0xbfed('0x1a')](_0x4c1b70[_0xbfed('0x2a')][_0xbfed('0x1a')]);_0x54369e[_0xbfed('0x19')]=qs[_0xbfed('0x19')](_0x4c1b70['query'][_0xbfed('0x19')]);}_0x54369e[_0xbfed('0x31')]=qs[_0xbfed('0x32')](_0x4c1b70[_0xbfed('0x2a')][_0xbfed('0x32')]);_0x54369e[_0xbfed('0x33')]=qs[_0xbfed('0x2b')](_[_0xbfed('0x34')](_0x4c1b70[_0xbfed('0x2a')],_0x374d82[_0xbfed('0x2b')]));if(_0x4c1b70[_0xbfed('0x2a')][_0xbfed('0x35')]){_0x54369e[_0xbfed('0x33')]=_[_0xbfed('0x36')](_0x54369e[_0xbfed('0x33')],{'$or':_[_0xbfed('0x37')](_0x1f7de8,function(_0x4d9866){if(_0x4d9866[_0xbfed('0x38')][_0xbfed('0x39')]!==_0xbfed('0x3a')){var _0x174306={};_0x174306[_0x4d9866['field']]={'$like':'%'+_0x4c1b70[_0xbfed('0x2a')][_0xbfed('0x35')]+'%'};return _0x174306;}})});}_0x54369e=_['merge']({},_0x54369e,_0x4c1b70[_0xbfed('0x3b')]);var _0x413766={'where':_0x54369e[_0xbfed('0x33')]};return db[_0xbfed('0x26')][_0xbfed('0x18')](_0x413766)[_0xbfed('0x21')](function(_0x523507){_0x3f56b3[_0xbfed('0x18')]=_0x523507;if(_0x4c1b70[_0xbfed('0x2a')][_0xbfed('0x3c')]){_0x54369e[_0xbfed('0x3d')]=[{'all':!![]}];}return db[_0xbfed('0x26')][_0xbfed('0x3e')](_0x54369e);})[_0xbfed('0x21')](function(_0x44354b){_0x3f56b3[_0xbfed('0x3f')]=_0x44354b;return _0x3f56b3;})[_0xbfed('0x21')](respondWithFilteredResult(_0x4ac0f4,_0x54369e))[_0xbfed('0x40')](handleError(_0x4ac0f4,null));};exports[_0xbfed('0x41')]=function(_0x5d5946,_0x53d3ba){var _0x518b99={'raw':!![],'where':{'id':_0x5d5946['params']['id']}},_0x2fa53f={};_0x2fa53f['model']=_[_0xbfed('0x29')](db[_0xbfed('0x26')][_0xbfed('0x27')]);_0x2fa53f[_0xbfed('0x2a')]=_[_0xbfed('0x29')](_0x5d5946['query']);_0x2fa53f[_0xbfed('0x2b')]=_['intersection'](_0x2fa53f[_0xbfed('0x28')],_0x2fa53f['query']);_0x518b99[_0xbfed('0x2d')]=_[_0xbfed('0x2c')](_0x2fa53f[_0xbfed('0x28')],qs[_0xbfed('0x2e')](_0x5d5946[_0xbfed('0x2a')][_0xbfed('0x2e')]));_0x518b99[_0xbfed('0x2d')]=_0x518b99[_0xbfed('0x2d')]['length']?_0x518b99['attributes']:_0x2fa53f['model'];if(_0x5d5946[_0xbfed('0x2a')]['includeAll']){_0x518b99[_0xbfed('0x3d')]=[{'all':!![]}];}_0x518b99=_[_0xbfed('0x36')]({},_0x518b99,_0x5d5946['options']);return db['JscriptySessionReport'][_0xbfed('0x42')](_0x518b99)[_0xbfed('0x21')](handleEntityNotFound(_0x53d3ba,null))[_0xbfed('0x21')](respondWithResult(_0x53d3ba,null))['catch'](handleError(_0x53d3ba,null));};exports['create']=function(_0x2a973c,_0x2bd3c9){return db[_0xbfed('0x26')][_0xbfed('0x43')](_0x2a973c['body'],{})['then'](respondWithResult(_0x2bd3c9,0xc9))['catch'](handleError(_0x2bd3c9,null));};exports[_0xbfed('0x20')]=function(_0x29843e,_0x1ccd45){if(_0x29843e[_0xbfed('0x44')]['id']){delete _0x29843e[_0xbfed('0x44')]['id'];}return db[_0xbfed('0x26')][_0xbfed('0x42')]({'where':{'id':_0x29843e['params']['id']}})[_0xbfed('0x21')](handleEntityNotFound(_0x1ccd45,null))[_0xbfed('0x21')](saveUpdates(_0x29843e[_0xbfed('0x44')],null))[_0xbfed('0x21')](respondWithResult(_0x1ccd45,null))[_0xbfed('0x40')](handleError(_0x1ccd45,null));};exports[_0xbfed('0x45')]=function(_0xfed367,_0xd3b2ca){return db['JscriptySessionReport'][_0xbfed('0x42')]({'where':{'id':_0xfed367['params']['id']}})['then'](handleEntityNotFound(_0xd3b2ca,null))[_0xbfed('0x21')](removeEntity(_0xd3b2ca,null))[_0xbfed('0x40')](handleError(_0xd3b2ca,null));};exports['describe']=function(_0x818dcd,_0x269e08){return db[_0xbfed('0x26')][_0xbfed('0x46')]()['then'](respondWithResult(_0x269e08,null))[_0xbfed('0x40')](handleError(_0x269e08,null));};exports['getQuestions']=function(_0x456a3c,_0x1c4169,_0x32b8f6){var _0x23dea8={'raw':!![],'where':{}};var _0x309de0={};var _0x272a9f={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xbfed('0x47')]({'where':{'id':_0x456a3c[_0xbfed('0x48')]['id']}})[_0xbfed('0x21')](handleEntityNotFound(_0x1c4169,null))[_0xbfed('0x21')](function(_0xee2a3e){if(_0xee2a3e){_0x309de0[_0xbfed('0x28')]=_[_0xbfed('0x29')](db[_0xbfed('0x49')]['rawAttributes']);_0x309de0[_0xbfed('0x2a')]=_[_0xbfed('0x29')](_0x456a3c[_0xbfed('0x2a')]);_0x309de0[_0xbfed('0x2b')]=_['intersection'](_0x309de0['model'],_0x309de0[_0xbfed('0x2a')]);_0x23dea8[_0xbfed('0x2d')]=_['intersection'](_0x309de0['model'],qs[_0xbfed('0x2e')](_0x456a3c[_0xbfed('0x2a')][_0xbfed('0x2e')]));_0x23dea8['attributes']=_0x23dea8[_0xbfed('0x2d')]['length']?_0x23dea8[_0xbfed('0x2d')]:_0x309de0[_0xbfed('0x28')];if(!_0x456a3c[_0xbfed('0x2a')][_0xbfed('0x2f')](_0xbfed('0x30'))){_0x23dea8[_0xbfed('0x1a')]=qs[_0xbfed('0x1a')](_0x456a3c[_0xbfed('0x2a')]['limit']);_0x23dea8['offset']=qs[_0xbfed('0x19')](_0x456a3c[_0xbfed('0x2a')][_0xbfed('0x19')]);}_0x23dea8[_0xbfed('0x31')]=qs['sort'](_0x456a3c[_0xbfed('0x2a')]['sort']);_0x23dea8[_0xbfed('0x33')]=qs[_0xbfed('0x2b')](_['pick'](_0x456a3c[_0xbfed('0x2a')],_0x309de0[_0xbfed('0x2b')]));_0x23dea8[_0xbfed('0x33')][_0xbfed('0x4a')]=_0xee2a3e['id'];if(_0x456a3c['query'][_0xbfed('0x35')]){_0x23dea8['where']=_[_0xbfed('0x36')](_0x23dea8[_0xbfed('0x33')],{'$or':_[_0xbfed('0x37')](_0x23dea8[_0xbfed('0x2d')],function(_0x4e3a3d){var _0x35a063={};_0x35a063[_0x4e3a3d]={'$like':'%'+_0x456a3c[_0xbfed('0x2a')]['filter']+'%'};return _0x35a063;})});}_0x23dea8=_[_0xbfed('0x36')]({},_0x23dea8,_0x456a3c[_0xbfed('0x3b')]);return db[_0xbfed('0x49')]['count']({'where':_0x23dea8['where']})[_0xbfed('0x21')](function(_0x2c7ebc){_0x272a9f['count']=_0x2c7ebc;if(_0x456a3c[_0xbfed('0x2a')][_0xbfed('0x3c')]){_0x23dea8[_0xbfed('0x3d')]=[{'all':!![]}];}return db[_0xbfed('0x49')][_0xbfed('0x3e')](_0x23dea8);})[_0xbfed('0x21')](function(_0x2655b7){_0x272a9f[_0xbfed('0x3f')]=_0x2655b7;return _0x272a9f;});}})[_0xbfed('0x21')](respondWithFilteredResult(_0x1c4169,_0x23dea8))['catch'](handleError(_0x1c4169,null));};
\ No newline at end of file
+var _0x064c=['field','options','count','includeAll','include','rows','show','params','length','find','catch','create','body','describe','findOne','JscriptyQuestionReport','SessionId','findAll','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','../../components/auth/service','api','../../config/utils','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','JscriptySessionReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL'];(function(_0x385467,_0x298239){var _0x5ed67e=function(_0x4b252c){while(--_0x4b252c){_0x385467['push'](_0x385467['shift']());}};_0x5ed67e(++_0x298239);}(_0x064c,0x136));var _0xc064=function(_0x2440fe,_0x281a11){_0x2440fe=_0x2440fe-0x0;var _0x5cf734=_0x064c[_0x2440fe];return _0x5cf734;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc064('0x0'));var rimraf=require(_0xc064('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc064('0x2'));var rp=require(_0xc064('0x3'));var moment=require(_0xc064('0x4'));var BPromise=require(_0xc064('0x5'));var Mustache=require(_0xc064('0x6'));var util=require('util');var path=require(_0xc064('0x7'));var sox=require(_0xc064('0x8'));var csv=require(_0xc064('0x9'));var ejs=require(_0xc064('0xa'));var fs=require('fs');var _=require(_0xc064('0xb'));var squel=require('squel');var crypto=require(_0xc064('0xc'));var jsforce=require(_0xc064('0xd'));var deskjs=require(_0xc064('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0xc064('0xf'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xc064('0x10'));var utils=require(_0xc064('0x11'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x408586,_0x61123c){_0x61123c=_0x61123c||0xcc;return function(_0x549f41){if(_0x549f41){return _0x408586[_0xc064('0x12')](_0x61123c);}return _0x408586[_0xc064('0x13')](_0x61123c)[_0xc064('0x14')]();};}function respondWithResult(_0x1fb70c,_0x5985e5){_0x5985e5=_0x5985e5||0xc8;return function(_0x6a1aa5){if(_0x6a1aa5){return _0x1fb70c['status'](_0x5985e5)[_0xc064('0x15')](_0x6a1aa5);}};}function respondWithFilteredResult(_0x4ac4b6,_0x9bde9d){return function(_0x3298f6){if(_0x3298f6){var _0x231dd0=_0x3298f6['count'],_0x1ef7f2=_0x9bde9d[_0xc064('0x16')],_0x5b65d5=_0x9bde9d[_0xc064('0x16')]+_0x9bde9d[_0xc064('0x17')],_0x467f39;if(_0x5b65d5>=_0x231dd0){_0x5b65d5=_0x231dd0;_0x467f39=0xc8;}else{_0x467f39=0xce;}_0x4ac4b6[_0xc064('0x13')](_0x467f39);return _0x4ac4b6['set'](_0xc064('0x18'),_0x1ef7f2+'-'+_0x5b65d5+'/'+_0x231dd0)[_0xc064('0x15')](_0x3298f6);}return null;};}function patchUpdates(_0x80da99){return function(_0x4b0dfb){try{jsonpatch[_0xc064('0x19')](_0x4b0dfb,_0x80da99,!![]);}catch(_0x309936){return BPromise[_0xc064('0x1a')](_0x309936);}return _0x4b0dfb['save']();};}function saveUpdates(_0x438dab,_0x4a885b){return function(_0x3a9f77){if(_0x3a9f77){return _0x3a9f77[_0xc064('0x1b')](_0x438dab)[_0xc064('0x1c')](function(_0x4c8b79){return _0x4c8b79;});}return null;};}function removeEntity(_0x1d2fb0,_0xd8995a){return function(_0x5cc1f0){if(_0x5cc1f0){return _0x5cc1f0[_0xc064('0x1d')]()[_0xc064('0x1c')](function(){_0x1d2fb0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c4f0a,_0x1744e4){return function(_0x421ec4){if(!_0x421ec4){_0x1c4f0a[_0xc064('0x12')](0x194);}return _0x421ec4;};}function handleError(_0x2855cf,_0x26cff9){_0x26cff9=_0x26cff9||0x1f4;return function(_0xb0b830){logger[_0xc064('0x1e')](_0xb0b830[_0xc064('0x1f')]);if(_0xb0b830['name']){delete _0xb0b830[_0xc064('0x20')];}_0x2855cf[_0xc064('0x13')](_0x26cff9)['send'](_0xb0b830);};}exports[_0xc064('0x21')]=function(_0x3336be,_0x32b1a5){var _0x51f836={},_0x37d863={},_0x454127={'count':0x0,'rows':[]};var _0x4d123e=db[_0xc064('0x22')][_0xc064('0x23')];_0x37d863[_0xc064('0x24')]=_[_0xc064('0x25')](_0x4d123e);_0x37d863[_0xc064('0x26')]=_[_0xc064('0x25')](_0x3336be['query']);_0x37d863[_0xc064('0x27')]=_[_0xc064('0x28')](_0x37d863[_0xc064('0x24')],_0x37d863[_0xc064('0x26')]);_0x51f836[_0xc064('0x29')]=_['intersection'](_0x37d863[_0xc064('0x24')],qs[_0xc064('0x2a')](_0x3336be['query']['fields']));_0x51f836['attributes']=_0x51f836[_0xc064('0x29')]['length']?_0x51f836[_0xc064('0x29')]:_0x37d863[_0xc064('0x24')];if(!_0x3336be[_0xc064('0x26')][_0xc064('0x2b')](_0xc064('0x2c'))){_0x51f836[_0xc064('0x17')]=qs[_0xc064('0x17')](_0x3336be['query']['limit']);_0x51f836[_0xc064('0x16')]=qs[_0xc064('0x16')](_0x3336be[_0xc064('0x26')]['offset']);}_0x51f836[_0xc064('0x2d')]=qs[_0xc064('0x2e')](_0x3336be[_0xc064('0x26')][_0xc064('0x2e')]);_0x51f836[_0xc064('0x2f')]=qs[_0xc064('0x27')](_[_0xc064('0x30')](_0x3336be[_0xc064('0x26')],_0x37d863['filters']));if(_0x3336be[_0xc064('0x26')][_0xc064('0x31')]){_0x51f836[_0xc064('0x2f')]=_[_0xc064('0x32')](_0x51f836[_0xc064('0x2f')],{'$or':_[_0xc064('0x33')](_0x4d123e,function(_0x3ebf49){if(_0x3ebf49[_0xc064('0x34')][_0xc064('0x35')]!==_0xc064('0x36')){var _0x581154={};_0x581154[_0x3ebf49[_0xc064('0x37')]]={'$like':'%'+_0x3336be[_0xc064('0x26')][_0xc064('0x31')]+'%'};return _0x581154;}})});}_0x51f836=_[_0xc064('0x32')]({},_0x51f836,_0x3336be[_0xc064('0x38')]);var _0x2332e5={'where':_0x51f836[_0xc064('0x2f')]};return db[_0xc064('0x22')][_0xc064('0x39')](_0x2332e5)[_0xc064('0x1c')](function(_0x13519b){_0x454127[_0xc064('0x39')]=_0x13519b;if(_0x3336be[_0xc064('0x26')][_0xc064('0x3a')]){_0x51f836[_0xc064('0x3b')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x51f836);})[_0xc064('0x1c')](function(_0x75e519){_0x454127[_0xc064('0x3c')]=_0x75e519;return _0x454127;})[_0xc064('0x1c')](respondWithFilteredResult(_0x32b1a5,_0x51f836))['catch'](handleError(_0x32b1a5,null));};exports[_0xc064('0x3d')]=function(_0x2cdaa1,_0x55d878){var _0x430abe={'raw':!![],'where':{'id':_0x2cdaa1[_0xc064('0x3e')]['id']}},_0xcc6a1a={};_0xcc6a1a[_0xc064('0x24')]=_[_0xc064('0x25')](db[_0xc064('0x22')][_0xc064('0x23')]);_0xcc6a1a[_0xc064('0x26')]=_[_0xc064('0x25')](_0x2cdaa1[_0xc064('0x26')]);_0xcc6a1a[_0xc064('0x27')]=_['intersection'](_0xcc6a1a[_0xc064('0x24')],_0xcc6a1a[_0xc064('0x26')]);_0x430abe[_0xc064('0x29')]=_[_0xc064('0x28')](_0xcc6a1a[_0xc064('0x24')],qs[_0xc064('0x2a')](_0x2cdaa1['query'][_0xc064('0x2a')]));_0x430abe[_0xc064('0x29')]=_0x430abe['attributes'][_0xc064('0x3f')]?_0x430abe['attributes']:_0xcc6a1a[_0xc064('0x24')];if(_0x2cdaa1[_0xc064('0x26')][_0xc064('0x3a')]){_0x430abe[_0xc064('0x3b')]=[{'all':!![]}];}_0x430abe=_[_0xc064('0x32')]({},_0x430abe,_0x2cdaa1['options']);return db['JscriptySessionReport'][_0xc064('0x40')](_0x430abe)['then'](handleEntityNotFound(_0x55d878,null))[_0xc064('0x1c')](respondWithResult(_0x55d878,null))[_0xc064('0x41')](handleError(_0x55d878,null));};exports[_0xc064('0x42')]=function(_0x157ccb,_0x59e0e7){return db[_0xc064('0x22')]['create'](_0x157ccb[_0xc064('0x43')],{})[_0xc064('0x1c')](respondWithResult(_0x59e0e7,0xc9))[_0xc064('0x41')](handleError(_0x59e0e7,null));};exports['update']=function(_0x26d3e1,_0x5f4be6){if(_0x26d3e1[_0xc064('0x43')]['id']){delete _0x26d3e1[_0xc064('0x43')]['id'];}return db['JscriptySessionReport']['find']({'where':{'id':_0x26d3e1[_0xc064('0x3e')]['id']}})[_0xc064('0x1c')](handleEntityNotFound(_0x5f4be6,null))[_0xc064('0x1c')](saveUpdates(_0x26d3e1['body'],null))[_0xc064('0x1c')](respondWithResult(_0x5f4be6,null))[_0xc064('0x41')](handleError(_0x5f4be6,null));};exports['destroy']=function(_0x3f5b8e,_0x4fe192){return db[_0xc064('0x22')][_0xc064('0x40')]({'where':{'id':_0x3f5b8e[_0xc064('0x3e')]['id']}})[_0xc064('0x1c')](handleEntityNotFound(_0x4fe192,null))[_0xc064('0x1c')](removeEntity(_0x4fe192,null))[_0xc064('0x41')](handleError(_0x4fe192,null));};exports['describe']=function(_0x13b209,_0x5d3b70){return db[_0xc064('0x22')][_0xc064('0x44')]()[_0xc064('0x1c')](respondWithResult(_0x5d3b70,null))[_0xc064('0x41')](handleError(_0x5d3b70,null));};exports['getQuestions']=function(_0xb3899d,_0x20ee2a,_0x2e7e34){var _0x35cfd1={'raw':!![],'where':{}};var _0x5a4350={};var _0x4f25fc={'count':0x0,'rows':[]};return db[_0xc064('0x22')][_0xc064('0x45')]({'where':{'id':_0xb3899d[_0xc064('0x3e')]['id']}})[_0xc064('0x1c')](handleEntityNotFound(_0x20ee2a,null))[_0xc064('0x1c')](function(_0x412742){if(_0x412742){_0x5a4350[_0xc064('0x24')]=_[_0xc064('0x25')](db[_0xc064('0x46')][_0xc064('0x23')]);_0x5a4350[_0xc064('0x26')]=_[_0xc064('0x25')](_0xb3899d[_0xc064('0x26')]);_0x5a4350[_0xc064('0x27')]=_[_0xc064('0x28')](_0x5a4350['model'],_0x5a4350[_0xc064('0x26')]);_0x35cfd1[_0xc064('0x29')]=_['intersection'](_0x5a4350[_0xc064('0x24')],qs['fields'](_0xb3899d['query']['fields']));_0x35cfd1[_0xc064('0x29')]=_0x35cfd1[_0xc064('0x29')][_0xc064('0x3f')]?_0x35cfd1[_0xc064('0x29')]:_0x5a4350[_0xc064('0x24')];if(!_0xb3899d[_0xc064('0x26')][_0xc064('0x2b')](_0xc064('0x2c'))){_0x35cfd1[_0xc064('0x17')]=qs[_0xc064('0x17')](_0xb3899d[_0xc064('0x26')]['limit']);_0x35cfd1[_0xc064('0x16')]=qs[_0xc064('0x16')](_0xb3899d[_0xc064('0x26')][_0xc064('0x16')]);}_0x35cfd1['order']=qs[_0xc064('0x2e')](_0xb3899d['query'][_0xc064('0x2e')]);_0x35cfd1[_0xc064('0x2f')]=qs[_0xc064('0x27')](_['pick'](_0xb3899d['query'],_0x5a4350[_0xc064('0x27')]));_0x35cfd1[_0xc064('0x2f')][_0xc064('0x47')]=_0x412742['id'];if(_0xb3899d[_0xc064('0x26')][_0xc064('0x31')]){_0x35cfd1[_0xc064('0x2f')]=_['merge'](_0x35cfd1[_0xc064('0x2f')],{'$or':_[_0xc064('0x33')](_0x35cfd1['attributes'],function(_0x1d5eca){var _0x3caf6e={};_0x3caf6e[_0x1d5eca]={'$like':'%'+_0xb3899d[_0xc064('0x26')][_0xc064('0x31')]+'%'};return _0x3caf6e;})});}_0x35cfd1=_[_0xc064('0x32')]({},_0x35cfd1,_0xb3899d['options']);return db[_0xc064('0x46')][_0xc064('0x39')]({'where':_0x35cfd1[_0xc064('0x2f')]})['then'](function(_0x1f3931){_0x4f25fc['count']=_0x1f3931;if(_0xb3899d[_0xc064('0x26')][_0xc064('0x3a')]){_0x35cfd1['include']=[{'all':!![]}];}return db[_0xc064('0x46')][_0xc064('0x48')](_0x35cfd1);})[_0xc064('0x1c')](function(_0x3f387f){_0x4f25fc[_0xc064('0x3c')]=_0x3f387f;return _0x4f25fc;});}})[_0xc064('0x1c')](respondWithFilteredResult(_0x20ee2a,_0x35cfd1))[_0xc064('0x41')](handleError(_0x20ee2a,null));};
\ No newline at end of file
index 6300092..122be78 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0149=['exports','define','lodash','util','moment','bluebird','request-promise','./jscriptySessionReport.attributes'];(function(_0x335b14,_0xc85f2f){var _0x43790d=function(_0x3e8252){while(--_0x3e8252){_0x335b14['push'](_0x335b14['shift']());}};_0x43790d(++_0xc85f2f);}(_0x0149,0x1ea));var _0x9014=function(_0x55a978,_0x4a809f){_0x55a978=_0x55a978-0x0;var _0x321a6c=_0x0149[_0x55a978];return _0x321a6c;};'use strict';var _=require(_0x9014('0x0'));var util=require(_0x9014('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9014('0x2'));var BPromise=require(_0x9014('0x3'));var rp=require(_0x9014('0x4'));var attributes=require(_0x9014('0x5'));module[_0x9014('0x6')]=function(_0x622d50,_0x41ab5e){return _0x622d50[_0x9014('0x7')]('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x4a91=['request-promise','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','util','../../config/logger','moment','bluebird'];(function(_0x6bc549,_0x140806){var _0x26280a=function(_0x584432){while(--_0x584432){_0x6bc549['push'](_0x6bc549['shift']());}};_0x26280a(++_0x140806);}(_0x4a91,0x140));var _0x14a9=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0x4a91[_0xa60623];return _0x4a6487;};'use strict';var _=require('lodash');var util=require(_0x14a9('0x0'));var logger=require(_0x14a9('0x1'))('api');var moment=require(_0x14a9('0x2'));var BPromise=require(_0x14a9('0x3'));var rp=require(_0x14a9('0x4'));var attributes=require(_0x14a9('0x5'));module[_0x14a9('0x6')]=function(_0x2ff226,_0x463083){return _0x2ff226[_0x14a9('0x7')](_0x14a9('0x8'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 214d853..07ae3ce 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3024=['rpc','../../config/environment','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','../../config/utils'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x3024,0x64));var _0x4302=function(_0x281480,_0x7c054b){_0x281480=_0x281480-0x0;var _0x3fe6a6=_0x3024[_0x281480];return _0x3fe6a6;};'use strict';var _=require(_0x4302('0x0'));var util=require(_0x4302('0x1'));var moment=require('moment');var BPromise=require(_0x4302('0x2'));var rs=require(_0x4302('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4302('0x4'));var logger=require('../../config/logger')(_0x4302('0x5'));var config=require(_0x4302('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4302('0x7')][_0x4302('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c3983,_0xced9fc,_0x2aecd7){return new BPromise(function(_0x3c007b,_0x285613){return client[_0x4302('0x9')](_0x4c3983,_0x2aecd7)[_0x4302('0xa')](function(_0x41580c){logger['info'](_0x4302('0xb'),_0xced9fc,_0x4302('0xc'));logger[_0x4302('0xd')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0xced9fc,_0x4302('0xc'),JSON[_0x4302('0xe')](_0x41580c));if(_0x41580c['error']){if(_0x41580c[_0x4302('0xf')][_0x4302('0x10')]===0x1f4){logger[_0x4302('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0xced9fc,_0x41580c[_0x4302('0xf')][_0x4302('0x11')]);return _0x285613(_0x41580c['error'][_0x4302('0x11')]);}logger[_0x4302('0xf')](_0x4302('0xb'),_0xced9fc,_0x41580c['error'][_0x4302('0x11')]);return _0x3c007b(_0x41580c[_0x4302('0xf')]['message']);}else{logger[_0x4302('0x12')](_0x4302('0xb'),_0xced9fc,'request\x20sent');_0x3c007b(_0x41580c[_0x4302('0x13')][_0x4302('0x11')]);}})[_0x4302('0x14')](function(_0x32178f){logger[_0x4302('0xf')](_0x4302('0xb'),_0xced9fc,_0x32178f);_0x285613(_0x32178f);});});}
\ No newline at end of file
+var _0x36fe=['info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then'];(function(_0x39d440,_0x3642c0){var _0x228113=function(_0x2d3411){while(--_0x2d3411){_0x39d440['push'](_0x39d440['shift']());}};_0x228113(++_0x3642c0);}(_0x36fe,0x127));var _0xe36f=function(_0x3cec45,_0x37d817){_0x3cec45=_0x3cec45-0x0;var _0x51d691=_0x36fe[_0x3cec45];return _0x51d691;};'use strict';var _=require(_0xe36f('0x0'));var util=require(_0xe36f('0x1'));var moment=require(_0xe36f('0x2'));var BPromise=require(_0xe36f('0x3'));var rs=require(_0xe36f('0x4'));var fs=require('fs');var Redis=require(_0xe36f('0x5'));var db=require(_0xe36f('0x6'))['db'];var utils=require(_0xe36f('0x7'));var logger=require(_0xe36f('0x8'))(_0xe36f('0x9'));var config=require(_0xe36f('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xe36f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x349c9e,_0xdae131,_0x5a0d3c){return new BPromise(function(_0x1ecd6b,_0x21f2a5){return client['request'](_0x349c9e,_0x5a0d3c)[_0xe36f('0xc')](function(_0x386c00){logger[_0xe36f('0xd')](_0xe36f('0xe'),_0xdae131,_0xe36f('0xf'));logger['debug'](_0xe36f('0x10'),_0xdae131,'request\x20sent',JSON[_0xe36f('0x11')](_0x386c00));if(_0x386c00[_0xe36f('0x12')]){if(_0x386c00[_0xe36f('0x12')]['code']===0x1f4){logger[_0xe36f('0x12')](_0xe36f('0xe'),_0xdae131,_0x386c00['error'][_0xe36f('0x13')]);return _0x21f2a5(_0x386c00[_0xe36f('0x12')][_0xe36f('0x13')]);}logger[_0xe36f('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0xdae131,_0x386c00[_0xe36f('0x12')][_0xe36f('0x13')]);return _0x1ecd6b(_0x386c00[_0xe36f('0x12')]['message']);}else{logger[_0xe36f('0xd')](_0xe36f('0xe'),_0xdae131,'request\x20sent');_0x1ecd6b(_0x386c00[_0xe36f('0x14')][_0xe36f('0x13')]);}})[_0xe36f('0x15')](function(_0x3f8f9f){logger[_0xe36f('0x12')](_0xe36f('0xe'),_0xdae131,_0x3f8f9f);_0x21f2a5(_0x3f8f9f);});});}
\ No newline at end of file
index c8e1ecb..7e9fa3f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc4b5=['update','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated'];(function(_0x500f61,_0x257d07){var _0x105931=function(_0x59f0e8){while(--_0x59f0e8){_0x500f61['push'](_0x500f61['shift']());}};_0x105931(++_0x257d07);}(_0xc4b5,0x64));var _0x5c4b=function(_0x159d98,_0x5052b4){_0x159d98=_0x159d98-0x0;var _0x44ba54=_0xc4b5[_0x159d98];return _0x44ba54;};'use strict';var multer=require(_0x5c4b('0x0'));var util=require('util');var path=require(_0x5c4b('0x1'));var timeout=require(_0x5c4b('0x2'));var express=require(_0x5c4b('0x3'));var router=express[_0x5c4b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5c4b('0x5'));var config=require(_0x5c4b('0x6'));var controller=require('./license.controller');router['get']('/',controller['index']);router[_0x5c4b('0x7')](_0x5c4b('0x8'),auth[_0x5c4b('0x9')](),controller[_0x5c4b('0xa')]);module['exports']=router;
\ No newline at end of file
+var _0x706c=['connect-timeout','express','Router','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','update','exports','multer','util','path'];(function(_0x43763b,_0x435831){var _0x1eaa08=function(_0x1f0c88){while(--_0x1f0c88){_0x43763b['push'](_0x43763b['shift']());}};_0x1eaa08(++_0x435831);}(_0x706c,0x93));var _0xc706=function(_0x16e0f5,_0x4ec0f3){_0x16e0f5=_0x16e0f5-0x0;var _0x4839d5=_0x706c[_0x16e0f5];return _0x4839d5;};'use strict';var multer=require(_0xc706('0x0'));var util=require(_0xc706('0x1'));var path=require(_0xc706('0x2'));var timeout=require(_0xc706('0x3'));var express=require(_0xc706('0x4'));var router=express[_0xc706('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc706('0x6'));var controller=require(_0xc706('0x7'));router[_0xc706('0x8')]('/',controller[_0xc706('0x9')]);router[_0xc706('0xa')](_0xc706('0xb'),auth[_0xc706('0xc')](),controller[_0xc706('0xd')]);module[_0xc706('0xe')]=router;
\ No newline at end of file
index 99308ad..cfc551d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x94be=['INTEGER','TEXT'];(function(_0x484c72,_0xeaa814){var _0x51497d=function(_0x4a1d63){while(--_0x4a1d63){_0x484c72['push'](_0x484c72['shift']());}};_0x51497d(++_0xeaa814);}(_0x94be,0x11f));var _0xe94b=function(_0x577d6a,_0x168189){_0x577d6a=_0x577d6a-0x0;var _0x2a6f0c=_0x94be[_0x577d6a];return _0x2a6f0c;};'use strict';var Sequelize=require('sequelize');module['exports']={'license':{'type':Sequelize[_0xe94b('0x0')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0xe94b('0x1')],'defaultValue':0x0}};
\ No newline at end of file
+var _0x2401=['TEXT','STRING','exports'];(function(_0x16ace6,_0x49e982){var _0x33f64b=function(_0x37acad){while(--_0x37acad){_0x16ace6['push'](_0x16ace6['shift']());}};_0x33f64b(++_0x49e982);}(_0x2401,0xd1));var _0x1240=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2401[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require('sequelize');module[_0x1240('0x0')]={'license':{'type':Sequelize[_0x1240('0x1')]},'data1':{'type':Sequelize[_0x1240('0x2')]},'data2':{'type':Sequelize[_0x1240('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}};
\ No newline at end of file
index 2944b99..9ba32b8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4b99=['body','find','get','checkLicense','key','demo','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../components/parsers/qs','api','../../config/utils','../../config/environment','end','status','json','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','keys','License','rawAttributes','query','filters','intersection','model','fields','attributes','length','options','getLicense','catch'];(function(_0x1e8d58,_0x55d6d3){var _0x83f072=function(_0xb04832){while(--_0xb04832){_0x1e8d58['push'](_0x1e8d58['shift']());}};_0x83f072(++_0x55d6d3);}(_0x4b99,0x1de));var _0x94b9=function(_0x1e33c7,_0x173913){_0x1e33c7=_0x1e33c7-0x0;var _0x558ed7=_0x4b99[_0x1e33c7];return _0x558ed7;};'use strict';var pdf=require(_0x94b9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x94b9('0x1'));var zipdir=require(_0x94b9('0x2'));var jsonpatch=require(_0x94b9('0x3'));var rp=require(_0x94b9('0x4'));var moment=require(_0x94b9('0x5'));var BPromise=require(_0x94b9('0x6'));var Mustache=require(_0x94b9('0x7'));var util=require(_0x94b9('0x8'));var path=require(_0x94b9('0x9'));var sox=require(_0x94b9('0xa'));var csv=require('to-csv');var ejs=require(_0x94b9('0xb'));var fs=require('fs');var _=require(_0x94b9('0xc'));var squel=require(_0x94b9('0xd'));var crypto=require(_0x94b9('0xe'));var jsforce=require(_0x94b9('0xf'));var deskjs=require(_0x94b9('0x10'));var toCsv=require('to-csv');var querystring=require(_0x94b9('0x11'));var Papa=require(_0x94b9('0x12'));var authService=require('../../components/auth/service');var hardwareService=require(_0x94b9('0x13'));var Redis=require('ioredis');var qs=require(_0x94b9('0x14'));var logger=require('../../config/logger')(_0x94b9('0x15'));var utils=require(_0x94b9('0x16'));var config=require(_0x94b9('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e0972,_0x382f6c){_0x382f6c=_0x382f6c||0xcc;return function(_0x1ae735){if(_0x1ae735){return _0x2e0972['sendStatus'](_0x382f6c);}return _0x2e0972['status'](_0x382f6c)[_0x94b9('0x18')]();};}function respondWithResult(_0x4c03b4,_0x1e4063){_0x1e4063=_0x1e4063||0xc8;return function(_0x3af8fd){if(_0x3af8fd){return _0x4c03b4[_0x94b9('0x19')](_0x1e4063)[_0x94b9('0x1a')](_0x3af8fd);}};}function respondWithFilteredResult(_0x4dda2d,_0x599b1f){return function(_0x5a6b1f){if(_0x5a6b1f){var _0x43b8b5=_0x5a6b1f['count'],_0x70b5d=_0x599b1f[_0x94b9('0x1b')],_0x43f425=_0x599b1f[_0x94b9('0x1b')]+_0x599b1f['limit'],_0x46a8ac;if(_0x43f425>=_0x43b8b5){_0x43f425=_0x43b8b5;_0x46a8ac=0xc8;}else{_0x46a8ac=0xce;}_0x4dda2d[_0x94b9('0x19')](_0x46a8ac);return _0x4dda2d['set'](_0x94b9('0x1c'),_0x70b5d+'-'+_0x43f425+'/'+_0x43b8b5)[_0x94b9('0x1a')](_0x5a6b1f);}return null;};}function patchUpdates(_0x1fe934){return function(_0x175491){try{jsonpatch[_0x94b9('0x1d')](_0x175491,_0x1fe934,!![]);}catch(_0x219fad){return BPromise[_0x94b9('0x1e')](_0x219fad);}return _0x175491[_0x94b9('0x1f')]();};}function saveUpdates(_0x512545,_0x4499d3){return function(_0x4a93be){if(_0x4a93be){return _0x4a93be[_0x94b9('0x20')](_0x512545)[_0x94b9('0x21')](function(_0x5898e0){return _0x5898e0;});}return null;};}function removeEntity(_0x3f6484,_0x186c62){return function(_0x358b4e){if(_0x358b4e){return _0x358b4e[_0x94b9('0x22')]()['then'](function(){_0x3f6484['status'](0xcc)[_0x94b9('0x18')]();});}};}function handleEntityNotFound(_0x2ccf53,_0x1065c5){return function(_0xbbc6db){if(!_0xbbc6db){_0x2ccf53['sendStatus'](0x194);}return _0xbbc6db;};}function handleError(_0x134658,_0x5f227d){_0x5f227d=_0x5f227d||0x1f4;return function(_0x1c766e){logger[_0x94b9('0x23')](_0x1c766e[_0x94b9('0x24')]);if(_0x1c766e[_0x94b9('0x25')]){delete _0x1c766e[_0x94b9('0x25')];}_0x134658[_0x94b9('0x19')](_0x5f227d)[_0x94b9('0x26')](_0x1c766e);};}var utilLicense=require('../../config/license/util');exports[_0x94b9('0x27')]=function(_0x972398,_0x39f6d2){var _0x78385a={'raw':!![],'where':{'id':0x1}},_0x56b838={};_0x56b838['model']=_[_0x94b9('0x28')](db[_0x94b9('0x29')][_0x94b9('0x2a')]);_0x56b838[_0x94b9('0x2b')]=_[_0x94b9('0x28')](_0x972398[_0x94b9('0x2b')]);_0x56b838[_0x94b9('0x2c')]=_[_0x94b9('0x2d')](_0x56b838[_0x94b9('0x2e')],_0x56b838[_0x94b9('0x2b')]);_0x78385a['attributes']=_[_0x94b9('0x2d')](_0x56b838['model'],qs[_0x94b9('0x2f')](_0x972398[_0x94b9('0x2b')]['fields']));_0x78385a[_0x94b9('0x30')]=_0x78385a['attributes'][_0x94b9('0x31')]?_0x78385a[_0x94b9('0x30')]:_0x56b838[_0x94b9('0x2e')];_0x78385a=_['merge']({},_0x78385a,_0x972398[_0x94b9('0x32')]);return utilLicense[_0x94b9('0x33')](_0x78385a)[_0x94b9('0x21')](respondWithResult(_0x39f6d2,null))[_0x94b9('0x34')](handleError(_0x39f6d2,null));};exports[_0x94b9('0x20')]=function(_0x5a0bcc,_0x20f9a8){if(_0x5a0bcc['body']['id']){delete _0x5a0bcc[_0x94b9('0x35')]['id'];}return db['License'][_0x94b9('0x36')]({'where':{'id':_0x5a0bcc['params']['id']}})[_0x94b9('0x21')](handleEntityNotFound(_0x20f9a8,null))[_0x94b9('0x21')](function(_0x41bb05){var _0x49f79e=_0x41bb05[_0x94b9('0x37')]({'plain':!![]});return utilLicense[_0x94b9('0x38')](_0x49f79e,_0x5a0bcc[_0x94b9('0x35')][_0x94b9('0x39')]);})[_0x94b9('0x21')](function(_0x92569){if(!_0x92569[_0x94b9('0x3a')]){return saveUpdates(_0x5a0bcc[_0x94b9('0x35')],null);}return _0x92569;})['then'](respondWithResult(_0x20f9a8,null))[_0x94b9('0x34')](handleError(_0x20f9a8,null));};
\ No newline at end of file
+var _0xcf26=['bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','json','apply','reject','destroy','then','error','stack','name','send','../../config/license/util','index','model','License','rawAttributes','query','keys','filters','intersection','attributes','fields','length','merge','catch','update','body','get','key','demo','html-pdf','eml-format','request-promise'];(function(_0x4b775f,_0x21ef09){var _0x3bf33f=function(_0x2a4313){while(--_0x2a4313){_0x4b775f['push'](_0x4b775f['shift']());}};_0x3bf33f(++_0x21ef09);}(_0xcf26,0x18c));var _0x6cf2=function(_0xf4237a,_0x1ac1e2){_0xf4237a=_0xf4237a-0x0;var _0x7b4c17=_0xcf26[_0xf4237a];return _0x7b4c17;};'use strict';var pdf=require(_0x6cf2('0x0'));var emlformat=require(_0x6cf2('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6cf2('0x2'));var moment=require('moment');var BPromise=require(_0x6cf2('0x3'));var Mustache=require('mustache');var util=require(_0x6cf2('0x4'));var path=require(_0x6cf2('0x5'));var sox=require(_0x6cf2('0x6'));var csv=require(_0x6cf2('0x7'));var ejs=require(_0x6cf2('0x8'));var fs=require('fs');var _=require(_0x6cf2('0x9'));var squel=require(_0x6cf2('0xa'));var crypto=require('crypto');var jsforce=require(_0x6cf2('0xb'));var deskjs=require(_0x6cf2('0xc'));var toCsv=require(_0x6cf2('0x7'));var querystring=require(_0x6cf2('0xd'));var Papa=require(_0x6cf2('0xe'));var authService=require(_0x6cf2('0xf'));var hardwareService=require(_0x6cf2('0x10'));var Redis=require(_0x6cf2('0x11'));var qs=require(_0x6cf2('0x12'));var logger=require(_0x6cf2('0x13'))(_0x6cf2('0x14'));var utils=require(_0x6cf2('0x15'));var config=require('../../config/environment');var db=require(_0x6cf2('0x16'))['db'];function respondWithStatusCode(_0x46a614,_0x41f955){_0x41f955=_0x41f955||0xcc;return function(_0x480059){if(_0x480059){return _0x46a614[_0x6cf2('0x17')](_0x41f955);}return _0x46a614[_0x6cf2('0x18')](_0x41f955)[_0x6cf2('0x19')]();};}function respondWithResult(_0x3bfe64,_0x2bb204){_0x2bb204=_0x2bb204||0xc8;return function(_0x103311){if(_0x103311){return _0x3bfe64[_0x6cf2('0x18')](_0x2bb204)['json'](_0x103311);}};}function respondWithFilteredResult(_0x51930d,_0x43a1eb){return function(_0x19f76a){if(_0x19f76a){var _0xb492ec=_0x19f76a['count'],_0x20befc=_0x43a1eb[_0x6cf2('0x1a')],_0x3e044e=_0x43a1eb[_0x6cf2('0x1a')]+_0x43a1eb[_0x6cf2('0x1b')],_0x45008b;if(_0x3e044e>=_0xb492ec){_0x3e044e=_0xb492ec;_0x45008b=0xc8;}else{_0x45008b=0xce;}_0x51930d[_0x6cf2('0x18')](_0x45008b);return _0x51930d['set'](_0x6cf2('0x1c'),_0x20befc+'-'+_0x3e044e+'/'+_0xb492ec)[_0x6cf2('0x1d')](_0x19f76a);}return null;};}function patchUpdates(_0x5cfc6c){return function(_0x44525e){try{jsonpatch[_0x6cf2('0x1e')](_0x44525e,_0x5cfc6c,!![]);}catch(_0x5b9a04){return BPromise[_0x6cf2('0x1f')](_0x5b9a04);}return _0x44525e['save']();};}function saveUpdates(_0x48c6dc,_0x582a9c){return function(_0x177bcc){if(_0x177bcc){return _0x177bcc['update'](_0x48c6dc)['then'](function(_0x1c7d9c){return _0x1c7d9c;});}return null;};}function removeEntity(_0x5c3e07,_0x9b9648){return function(_0xedabb8){if(_0xedabb8){return _0xedabb8[_0x6cf2('0x20')]()[_0x6cf2('0x21')](function(){_0x5c3e07['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fda48,_0x1e5bb0){return function(_0x14af75){if(!_0x14af75){_0x4fda48[_0x6cf2('0x17')](0x194);}return _0x14af75;};}function handleError(_0x53aaf8,_0x14811b){_0x14811b=_0x14811b||0x1f4;return function(_0x33d3ca){logger[_0x6cf2('0x22')](_0x33d3ca[_0x6cf2('0x23')]);if(_0x33d3ca[_0x6cf2('0x24')]){delete _0x33d3ca[_0x6cf2('0x24')];}_0x53aaf8[_0x6cf2('0x18')](_0x14811b)[_0x6cf2('0x25')](_0x33d3ca);};}var utilLicense=require(_0x6cf2('0x26'));exports[_0x6cf2('0x27')]=function(_0xd7ec3f,_0x33d475){var _0x447d40={'raw':!![],'where':{'id':0x1}},_0x4cf420={};_0x4cf420[_0x6cf2('0x28')]=_['keys'](db[_0x6cf2('0x29')][_0x6cf2('0x2a')]);_0x4cf420[_0x6cf2('0x2b')]=_[_0x6cf2('0x2c')](_0xd7ec3f[_0x6cf2('0x2b')]);_0x4cf420[_0x6cf2('0x2d')]=_[_0x6cf2('0x2e')](_0x4cf420[_0x6cf2('0x28')],_0x4cf420[_0x6cf2('0x2b')]);_0x447d40[_0x6cf2('0x2f')]=_[_0x6cf2('0x2e')](_0x4cf420[_0x6cf2('0x28')],qs['fields'](_0xd7ec3f[_0x6cf2('0x2b')][_0x6cf2('0x30')]));_0x447d40[_0x6cf2('0x2f')]=_0x447d40[_0x6cf2('0x2f')][_0x6cf2('0x31')]?_0x447d40[_0x6cf2('0x2f')]:_0x4cf420[_0x6cf2('0x28')];_0x447d40=_[_0x6cf2('0x32')]({},_0x447d40,_0xd7ec3f['options']);return utilLicense['getLicense'](_0x447d40)['then'](respondWithResult(_0x33d475,null))[_0x6cf2('0x33')](handleError(_0x33d475,null));};exports[_0x6cf2('0x34')]=function(_0xe1acf0,_0x175669){if(_0xe1acf0['body']['id']){delete _0xe1acf0[_0x6cf2('0x35')]['id'];}return db[_0x6cf2('0x29')]['find']({'where':{'id':_0xe1acf0['params']['id']}})[_0x6cf2('0x21')](handleEntityNotFound(_0x175669,null))[_0x6cf2('0x21')](function(_0x161fa3){var _0xed178d=_0x161fa3[_0x6cf2('0x36')]({'plain':!![]});return utilLicense['checkLicense'](_0xed178d,_0xe1acf0['body'][_0x6cf2('0x37')]);})[_0x6cf2('0x21')](function(_0x5535a4){if(!_0x5535a4[_0x6cf2('0x38')]){return saveUpdates(_0xe1acf0[_0x6cf2('0x35')],null);}return _0x5535a4;})[_0x6cf2('0x21')](respondWithResult(_0x175669,null))[_0x6cf2('0x33')](handleError(_0x175669,null));};
\ No newline at end of file
index eb03d6c..06bb1c8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9585=['moment','bluebird','request-promise','./license.attributes','exports','License','util','api'];(function(_0x1e009e,_0x1fb11c){var _0x531fb7=function(_0x30b9b6){while(--_0x30b9b6){_0x1e009e['push'](_0x1e009e['shift']());}};_0x531fb7(++_0x1fb11c);}(_0x9585,0x15e));var _0x5958=function(_0x52da09,_0x2b9cbd){_0x52da09=_0x52da09-0x0;var _0xf3b51f=_0x9585[_0x52da09];return _0xf3b51f;};'use strict';var _=require('lodash');var util=require(_0x5958('0x0'));var logger=require('../../config/logger')(_0x5958('0x1'));var moment=require(_0x5958('0x2'));var BPromise=require(_0x5958('0x3'));var rp=require(_0x5958('0x4'));var attributes=require(_0x5958('0x5'));module[_0x5958('0x6')]=function(_0x28be1b,_0x44ce6d){return _0x28be1b['define'](_0x5958('0x7'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x795a=['License','license','util','../../config/logger','moment','request-promise','./license.attributes','define'];(function(_0xba1d45,_0x1b0cf7){var _0x385d02=function(_0x3bc02d){while(--_0x3bc02d){_0xba1d45['push'](_0xba1d45['shift']());}};_0x385d02(++_0x1b0cf7);}(_0x795a,0xa2));var _0xa795=function(_0x3a4848,_0x4937f5){_0x3a4848=_0x3a4848-0x0;var _0x70e86c=_0x795a[_0x3a4848];return _0x70e86c;};'use strict';var _=require('lodash');var util=require(_0xa795('0x0'));var logger=require(_0xa795('0x1'))('api');var moment=require(_0xa795('0x2'));var BPromise=require('bluebird');var rp=require(_0xa795('0x3'));var attributes=require(_0xa795('0x4'));module['exports']=function(_0x4f7e4e,_0x174575){return _0x4f7e4e[_0xa795('0x5')](_0xa795('0x6'),attributes,{'tableName':_0xa795('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index bdf6e31..abec778 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xedc9=['License,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4d3c10,_0x451e74){var _0x5e8578=function(_0x57b3ee){while(--_0x57b3ee){_0x4d3c10['push'](_0x4d3c10['shift']());}};_0x5e8578(++_0x451e74);}(_0xedc9,0x17f));var _0x9edc=function(_0x5162ed,_0x386cb7){_0x5162ed=_0x5162ed-0x0;var _0x4c579b=_0xedc9[_0x5162ed];return _0x4c579b;};'use strict';var _=require(_0x9edc('0x0'));var util=require(_0x9edc('0x1'));var moment=require(_0x9edc('0x2'));var BPromise=require('bluebird');var rs=require(_0x9edc('0x3'));var fs=require('fs');var Redis=require(_0x9edc('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9edc('0x5'))('rpc');var config=require(_0x9edc('0x6'));var jayson=require(_0x9edc('0x7'));var client=jayson[_0x9edc('0x8')][_0x9edc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9a5f0e,_0x10dbcb,_0x48bce8){return new BPromise(function(_0x34e12e,_0x1c190a){return client[_0x9edc('0xa')](_0x9a5f0e,_0x48bce8)[_0x9edc('0xb')](function(_0x28e97c){logger[_0x9edc('0xc')]('License,\x20%s,\x20%s',_0x10dbcb,_0x9edc('0xd'));logger['debug'](_0x9edc('0xe'),_0x10dbcb,_0x9edc('0xd'),JSON[_0x9edc('0xf')](_0x28e97c));if(_0x28e97c[_0x9edc('0x10')]){if(_0x28e97c[_0x9edc('0x10')]['code']===0x1f4){logger[_0x9edc('0x10')](_0x9edc('0x11'),_0x10dbcb,_0x28e97c['error'][_0x9edc('0x12')]);return _0x1c190a(_0x28e97c[_0x9edc('0x10')][_0x9edc('0x12')]);}logger[_0x9edc('0x10')](_0x9edc('0x11'),_0x10dbcb,_0x28e97c[_0x9edc('0x10')][_0x9edc('0x12')]);return _0x34e12e(_0x28e97c[_0x9edc('0x10')][_0x9edc('0x12')]);}else{logger[_0x9edc('0xc')]('License,\x20%s,\x20%s',_0x10dbcb,_0x9edc('0xd'));_0x34e12e(_0x28e97c[_0x9edc('0x13')]['message']);}})['catch'](function(_0x4cb975){logger[_0x9edc('0x10')](_0x9edc('0x11'),_0x10dbcb,_0x4cb975);_0x1c190a(_0x4cb975);});});}
\ No newline at end of file
+var _0xe681=['request','then','request\x20sent','License,\x20%s,\x20%s,\x20%s','error','code','License,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x39ef9b,_0x4f1c05){var _0x177b9d=function(_0x535469){while(--_0x535469){_0x39ef9b['push'](_0x39ef9b['shift']());}};_0x177b9d(++_0x4f1c05);}(_0xe681,0x8e));var _0x1e68=function(_0x1328b7,_0x40d4f5){_0x1328b7=_0x1328b7-0x0;var _0x197cad=_0xe681[_0x1328b7];return _0x197cad;};'use strict';var _=require(_0x1e68('0x0'));var util=require(_0x1e68('0x1'));var moment=require('moment');var BPromise=require(_0x1e68('0x2'));var rs=require(_0x1e68('0x3'));var fs=require('fs');var Redis=require(_0x1e68('0x4'));var db=require(_0x1e68('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e68('0x6'))(_0x1e68('0x7'));var config=require(_0x1e68('0x8'));var jayson=require(_0x1e68('0x9'));var client=jayson[_0x1e68('0xa')][_0x1e68('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x218a51,_0x311c8d,_0x506c94){return new BPromise(function(_0x29bcfc,_0xa104b6){return client[_0x1e68('0xc')](_0x218a51,_0x506c94)[_0x1e68('0xd')](function(_0x3c1af8){logger['info']('License,\x20%s,\x20%s',_0x311c8d,_0x1e68('0xe'));logger['debug'](_0x1e68('0xf'),_0x311c8d,_0x1e68('0xe'),JSON['stringify'](_0x3c1af8));if(_0x3c1af8['error']){if(_0x3c1af8[_0x1e68('0x10')][_0x1e68('0x11')]===0x1f4){logger[_0x1e68('0x10')](_0x1e68('0x12'),_0x311c8d,_0x3c1af8['error'][_0x1e68('0x13')]);return _0xa104b6(_0x3c1af8[_0x1e68('0x10')][_0x1e68('0x13')]);}logger[_0x1e68('0x10')](_0x1e68('0x12'),_0x311c8d,_0x3c1af8['error'][_0x1e68('0x13')]);return _0x29bcfc(_0x3c1af8[_0x1e68('0x10')][_0x1e68('0x13')]);}else{logger['info'](_0x1e68('0x12'),_0x311c8d,'request\x20sent');_0x29bcfc(_0x3c1af8[_0x1e68('0x14')]['message']);}})[_0x1e68('0x15')](function(_0x1e65e7){logger[_0x1e68('0x10')]('License,\x20%s,\x20%s',_0x311c8d,_0x1e65e7);_0xa104b6(_0x1e65e7);});});}
\ No newline at end of file
index 3ad890e..9e32dae 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x40f0=['send','/:id/users','addAgents','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','path','Router','../../config/environment','./mailAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','getAgents','addDisposition','post','create','/:id/in_servers','addImap','addSmtp','addApplications','/:id/send'];(function(_0x3d0889,_0x50ff41){var _0x13758f=function(_0x29b3f7){while(--_0x29b3f7){_0x3d0889['push'](_0x3d0889['shift']());}};_0x13758f(++_0x50ff41);}(_0x40f0,0x1c4));var _0x040f=function(_0x2ea539,_0x25cb5f){_0x2ea539=_0x2ea539-0x0;var _0xe70849=_0x40f0[_0x2ea539];return _0xe70849;};'use strict';var multer=require(_0x040f('0x0'));var util=require('util');var path=require(_0x040f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x040f('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x040f('0x3'));var controller=require(_0x040f('0x4'));router[_0x040f('0x5')]('/',auth['isAuthenticated'](),controller[_0x040f('0x6')]);router['get'](_0x040f('0x7'),auth[_0x040f('0x8')](),controller[_0x040f('0x9')]);router[_0x040f('0x5')](_0x040f('0xa'),auth[_0x040f('0x8')](),controller[_0x040f('0xb')]);router['get'](_0x040f('0xc'),auth[_0x040f('0x8')](),controller['getDispositions']);router[_0x040f('0x5')](_0x040f('0xd'),auth[_0x040f('0x8')](),controller[_0x040f('0xe')]);router['get']('/:id/in_servers',auth['isAuthenticated'](),controller['getImap']);router['get'](_0x040f('0xf'),auth['isAuthenticated'](),controller[_0x040f('0x10')]);router[_0x040f('0x5')](_0x040f('0x11'),auth[_0x040f('0x8')](),controller['getInteractions']);router['get'](_0x040f('0x12'),auth[_0x040f('0x8')](),controller[_0x040f('0x13')]);router[_0x040f('0x5')]('/:id/messages',auth[_0x040f('0x8')](),controller[_0x040f('0x14')]);router[_0x040f('0x5')](_0x040f('0x15'),auth[_0x040f('0x8')](),controller[_0x040f('0x16')]);router[_0x040f('0x5')]('/:id/users',auth[_0x040f('0x8')](),controller[_0x040f('0x17')]);router['post'](_0x040f('0xc'),auth['isAuthenticated'](),controller[_0x040f('0x18')]);router[_0x040f('0x19')](_0x040f('0xd'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x040f('0x19')]('/',auth[_0x040f('0x8')](),controller[_0x040f('0x1a')]);router[_0x040f('0x19')](_0x040f('0x1b'),auth[_0x040f('0x8')](),controller[_0x040f('0x1c')]);router[_0x040f('0x19')](_0x040f('0xf'),auth['isAuthenticated'](),controller[_0x040f('0x1d')]);router[_0x040f('0x19')](_0x040f('0x11'),auth[_0x040f('0x8')](),controller['addInteraction']);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0x040f('0x1e')]);router[_0x040f('0x19')](_0x040f('0x1f'),auth['isAuthenticated'](),controller[_0x040f('0x20')]);router['post'](_0x040f('0x21'),auth[_0x040f('0x8')](),controller[_0x040f('0x22')]);router['put']('/:id',auth[_0x040f('0x8')](),controller[_0x040f('0x23')]);router[_0x040f('0x24')](_0x040f('0xc'),auth[_0x040f('0x8')](),controller[_0x040f('0x25')]);router[_0x040f('0x24')](_0x040f('0xd'),auth[_0x040f('0x8')](),controller[_0x040f('0x26')]);router[_0x040f('0x24')](_0x040f('0x1b'),auth[_0x040f('0x8')](),controller[_0x040f('0x27')]);router[_0x040f('0x24')](_0x040f('0xf'),auth['isAuthenticated'](),controller[_0x040f('0x28')]);router[_0x040f('0x24')](_0x040f('0xa'),auth[_0x040f('0x8')](),controller[_0x040f('0x29')]);router[_0x040f('0x24')]('/:id/users',auth[_0x040f('0x8')](),controller[_0x040f('0x2a')]);module[_0x040f('0x2b')]=router;
\ No newline at end of file
+var _0x3913=['addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addImap','addInteraction'];(function(_0x2f8905,_0x53da40){var _0x390ede=function(_0xa55eb4){while(--_0xa55eb4){_0x2f8905['push'](_0x2f8905['shift']());}};_0x390ede(++_0x53da40);}(_0x3913,0x6c));var _0x3391=function(_0x3599d6,_0x23f142){_0x3599d6=_0x3599d6-0x0;var _0x352cd6=_0x3913[_0x3599d6];return _0x352cd6;};'use strict';var multer=require(_0x3391('0x0'));var util=require(_0x3391('0x1'));var path=require(_0x3391('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3391('0x3')]();var auth=require(_0x3391('0x4'));var interaction=require(_0x3391('0x5'));var config=require(_0x3391('0x6'));var controller=require(_0x3391('0x7'));router[_0x3391('0x8')]('/',auth[_0x3391('0x9')](),controller[_0x3391('0xa')]);router['get'](_0x3391('0xb'),auth[_0x3391('0x9')](),controller[_0x3391('0xc')]);router[_0x3391('0x8')](_0x3391('0xd'),auth[_0x3391('0x9')](),controller[_0x3391('0xe')]);router[_0x3391('0x8')]('/:id/dispositions',auth[_0x3391('0x9')](),controller[_0x3391('0xf')]);router[_0x3391('0x8')](_0x3391('0x10'),auth[_0x3391('0x9')](),controller[_0x3391('0x11')]);router[_0x3391('0x8')](_0x3391('0x12'),auth[_0x3391('0x9')](),controller['getImap']);router[_0x3391('0x8')](_0x3391('0x13'),auth[_0x3391('0x9')](),controller['getSmtp']);router['get'](_0x3391('0x14'),auth[_0x3391('0x9')](),controller[_0x3391('0x15')]);router[_0x3391('0x8')]('/:id/applications',auth[_0x3391('0x9')](),controller[_0x3391('0x16')]);router[_0x3391('0x8')](_0x3391('0x17'),auth[_0x3391('0x9')](),controller[_0x3391('0x18')]);router[_0x3391('0x8')]('/:id/verify',auth[_0x3391('0x9')](),controller[_0x3391('0x19')]);router['get'](_0x3391('0x1a'),auth['isAuthenticated'](),controller[_0x3391('0x1b')]);router[_0x3391('0x1c')](_0x3391('0x1d'),auth[_0x3391('0x9')](),controller[_0x3391('0x1e')]);router['post'](_0x3391('0x10'),auth[_0x3391('0x9')](),controller['addAnswer']);router[_0x3391('0x1c')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3391('0x1c')](_0x3391('0x12'),auth['isAuthenticated'](),controller[_0x3391('0x1f')]);router[_0x3391('0x1c')](_0x3391('0x13'),auth[_0x3391('0x9')](),controller['addSmtp']);router[_0x3391('0x1c')](_0x3391('0x14'),auth['isAuthenticated'](),controller[_0x3391('0x20')]);router['post']('/:id/applications',auth[_0x3391('0x9')](),controller[_0x3391('0x21')]);router['post'](_0x3391('0x22'),auth[_0x3391('0x9')](),controller[_0x3391('0x23')]);router[_0x3391('0x1c')]('/:id/users',auth[_0x3391('0x9')](),controller[_0x3391('0x24')]);router[_0x3391('0x25')]('/:id',auth[_0x3391('0x9')](),controller[_0x3391('0x26')]);router[_0x3391('0x27')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x3391('0x28')]);router[_0x3391('0x27')]('/:id/canned_answers',auth[_0x3391('0x9')](),controller[_0x3391('0x29')]);router[_0x3391('0x27')](_0x3391('0x12'),auth[_0x3391('0x9')](),controller[_0x3391('0x2a')]);router[_0x3391('0x27')](_0x3391('0x13'),auth[_0x3391('0x9')](),controller[_0x3391('0x2b')]);router[_0x3391('0x27')]('/:id',auth['isAuthenticated'](),controller[_0x3391('0x2c')]);router[_0x3391('0x27')]('/:id/users',auth['isAuthenticated'](),controller[_0x3391('0x2d')]);module[_0x3391('0x2e')]=router;
\ No newline at end of file
index 07e7dc9..e4f357d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5dae=['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','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT'];(function(_0xa320b2,_0x358a2e){var _0x59a838=function(_0x229db5){while(--_0x229db5){_0xa320b2['push'](_0xa320b2['shift']());}};_0x59a838(++_0x358a2e);}(_0x5dae,0x121));var _0xe5da=function(_0x41c621,_0x1edf7c){_0x41c621=_0x41c621-0x0;var _0x2de75b=_0x5dae[_0x41c621];return _0x2de75b;};'use strict';var Sequelize=require(_0xe5da('0x0'));module[_0xe5da('0x1')]={'description':{'type':Sequelize[_0xe5da('0x2')]},'name':{'type':Sequelize[_0xe5da('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xe5da('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xe5da('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xe5da('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xe5da('0x4')]},'markAsUnread':{'type':Sequelize[_0xe5da('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xe5da('0x2')],'allowNull':![],'defaultValue':_0xe5da('0x5')},'fontSize':{'type':Sequelize[_0xe5da('0x6')](0x2)[_0xe5da('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xe5da('0x4')],'defaultValue':function(){return _0xe5da('0x8');}},'notificationSound':{'type':Sequelize[_0xe5da('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe5da('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe5da('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe5da('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe5da('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe5da('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe5da('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xe5da('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xe5da('0x3')],'defaultValue':![],'comment':_0xe5da('0xa'),'set':function(_0x19143b){if(!_0x19143b)this[_0xe5da('0xb')](_0xe5da('0xc'),null);this[_0xe5da('0xb')](_0xe5da('0xd'),_0x19143b);}}};
\ No newline at end of file
+var _0xb3e7=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','BOOLEAN','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}}'];(function(_0x15d913,_0x51cf7a){var _0x4ae65e=function(_0x2f39a1){while(--_0x2f39a1){_0x15d913['push'](_0x15d913['shift']());}};_0x4ae65e(++_0x51cf7a);}(_0xb3e7,0x1e7));var _0x7b3e=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xb3e7[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require(_0x7b3e('0x0'));module[_0x7b3e('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x7b3e('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x7b3e('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x7b3e('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7b3e('0x4')},'fontSize':{'type':Sequelize[_0x7b3e('0x5')](0x2)[_0x7b3e('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x7b3e('0x7');}},'notificationSound':{'type':Sequelize[_0x7b3e('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7b3e('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7b3e('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7b3e('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7b3e('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7b3e('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x7b3e('0x3')],'defaultValue':![],'comment':_0x7b3e('0x8'),'set':function(_0x20927f){if(!_0x20927f)this[_0x7b3e('0x9')](_0x7b3e('0xa'),null);this['setDataValue']('mandatoryDisposition',_0x20927f);}}};
\ No newline at end of file
index 94251f6..9b22add 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x77af=['removeImap','getSmtp','addSmtp','setSmtp','MailInteraction','addInteraction','omit','CmContact','Contact','User','Owner','internal','Tag','Tags','tag','addApplications','bulkCreate','MailApplication','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','CmList','List','from','%s\x20<%s>','attachments','join','pass','secure','auth','SendMail','sendMail','List\x20not\x20found','Contacts','defaults','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','moment','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','destroy','get','stack','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','rawAttributes','model','keys','query','intersection','attributes','fields','hasOwnProperty','limit','sort','where','filters','pick','filter','merge','key','field','options','MailAccount','includeAll','include','findAll','rows','show','params','Pause','length','find','body','describe','addDisposition','MailAccountId','Disposition','create','findOne','nolimit','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','map','removeAnswers','email','ListId','isNil','active','description','user','cuser','password','cpassword','authentication','host','port','service','cservice','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap'];(function(_0x412d2,_0x44e6f0){var _0x29b402=function(_0x1a67e1){while(--_0x1a67e1){_0x412d2['push'](_0x412d2['shift']());}};_0x29b402(++_0x44e6f0);}(_0x77af,0xf4));var _0xf77a=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x77af[_0x3bf83f];return _0x22c4a9;};'use strict';var pdf=require(_0xf77a('0x0'));var emlformat=require(_0xf77a('0x1'));var rimraf=require(_0xf77a('0x2'));var zipdir=require(_0xf77a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf77a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf77a('0x5'));var path=require(_0xf77a('0x6'));var sox=require(_0xf77a('0x7'));var csv=require(_0xf77a('0x8'));var ejs=require(_0xf77a('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf77a('0xa'));var crypto=require(_0xf77a('0xb'));var jsforce=require(_0xf77a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf77a('0x8'));var querystring=require(_0xf77a('0xd'));var Papa=require(_0xf77a('0xe'));var authService=require(_0xf77a('0xf'));var hardwareService=require(_0xf77a('0x10'));var Redis=require(_0xf77a('0x11'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xf77a('0x12'));var utils=require('../../config/utils');var config=require(_0xf77a('0x13'));var db=require(_0xf77a('0x14'))['db'];config[_0xf77a('0x15')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf77a('0x16'))(new Redis(config[_0xf77a('0x15')]));require('./mailAccount.socket')[_0xf77a('0x17')](socket);var jayson=require(_0xf77a('0x18'));var client=jayson[_0xf77a('0x19')][_0xf77a('0x1a')]({'port':0x232b});function respondWithRpcPromise(_0x1a58a7,_0x576d02,_0x44a9b0,_0x34749f){return new BPromise(function(_0x5e4bf3,_0x88bfde){var _0xe44a66=_0x34749f||client;return _0xe44a66[_0xf77a('0x1b')](_0x1a58a7,_0x44a9b0)[_0xf77a('0x1c')](function(_0x257c9a){logger[_0xf77a('0x1d')](_0xf77a('0x1e'),_0x576d02,_0xf77a('0x1f'));logger[_0xf77a('0x20')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x576d02,_0xf77a('0x1f'),JSON[_0xf77a('0x21')](_0x257c9a));if(_0x257c9a[_0xf77a('0x22')]){if(_0x257c9a['error'][_0xf77a('0x23')]===0x1f4){logger[_0xf77a('0x22')](_0xf77a('0x1e'),_0x576d02,_0x257c9a[_0xf77a('0x22')][_0xf77a('0x24')]);return _0x88bfde(_0x257c9a['error'][_0xf77a('0x24')]);}logger[_0xf77a('0x22')]('MailAccount,\x20%s,\x20%s',_0x576d02,_0x257c9a[_0xf77a('0x22')][_0xf77a('0x24')]);return _0x5e4bf3(_0x257c9a[_0xf77a('0x22')][_0xf77a('0x24')]);}else{logger[_0xf77a('0x1d')](_0xf77a('0x1e'),_0x576d02,_0xf77a('0x1f'));_0x5e4bf3(_0x257c9a[_0xf77a('0x25')][_0xf77a('0x24')]);}})[_0xf77a('0x26')](function(_0x552907){logger[_0xf77a('0x22')](_0xf77a('0x1e'),_0x576d02,_0x552907);_0x88bfde(_0x552907);});});}function respondWithStatusCode(_0x518bd6,_0xa92a73){_0xa92a73=_0xa92a73||0xcc;return function(_0x40394a){if(_0x40394a){return _0x518bd6[_0xf77a('0x27')](_0xa92a73);}return _0x518bd6[_0xf77a('0x28')](_0xa92a73)[_0xf77a('0x29')]();};}function respondWithResult(_0x530b2e,_0x124136){_0x124136=_0x124136||0xc8;return function(_0x29d42a){if(_0x29d42a){return _0x530b2e['status'](_0x124136)[_0xf77a('0x2a')](_0x29d42a);}};}function respondWithFilteredResult(_0x5cb253,_0x510055){return function(_0x110b74){if(_0x110b74){var _0x326bf2=_0x110b74[_0xf77a('0x2b')],_0x3d75bd=_0x510055[_0xf77a('0x2c')],_0x45f63b=_0x510055[_0xf77a('0x2c')]+_0x510055['limit'],_0x35af70;if(_0x45f63b>=_0x326bf2){_0x45f63b=_0x326bf2;_0x35af70=0xc8;}else{_0x35af70=0xce;}_0x5cb253[_0xf77a('0x28')](_0x35af70);return _0x5cb253[_0xf77a('0x2d')](_0xf77a('0x2e'),_0x3d75bd+'-'+_0x45f63b+'/'+_0x326bf2)[_0xf77a('0x2a')](_0x110b74);}return null;};}function patchUpdates(_0x16b789){return function(_0x165164){try{jsonpatch[_0xf77a('0x2f')](_0x165164,_0x16b789,!![]);}catch(_0x2f6b06){return BPromise[_0xf77a('0x30')](_0x2f6b06);}return _0x165164['save']();};}function saveUpdates(_0x106287,_0x391edb){return function(_0x1ac089){if(_0x1ac089){return _0x1ac089[_0xf77a('0x31')](_0x106287)[_0xf77a('0x1c')](function(_0xf0a159){return _0xf0a159;});}return null;};}function removeEntity(_0x392e2a,_0x584ff6){return function(_0x42527e){if(_0x42527e){return _0x42527e[_0xf77a('0x32')]()[_0xf77a('0x1c')](function(){var _0x3b38fb=_0x42527e[_0xf77a('0x33')]({'plain':!![]});var _0x303fbd='MailAccounts';return db['UserProfileResource'][_0xf77a('0x32')]({'where':{'type':_0x303fbd,'resourceId':_0x3b38fb['id']}})[_0xf77a('0x1c')](function(){return _0x42527e;});})[_0xf77a('0x1c')](function(){_0x392e2a[_0xf77a('0x28')](0xcc)[_0xf77a('0x29')]();});}};}function handleEntityNotFound(_0x57ed65,_0x8dd703){return function(_0x514808){if(!_0x514808){_0x57ed65[_0xf77a('0x27')](0x194);}return _0x514808;};}function handleError(_0x27d3db,_0x24c65d){_0x24c65d=_0x24c65d||0x1f4;return function(_0x4ee322){logger[_0xf77a('0x22')](_0x4ee322[_0xf77a('0x34')]);if(_0x4ee322[_0xf77a('0x35')]){delete _0x4ee322[_0xf77a('0x35')];}_0x27d3db[_0xf77a('0x28')](_0x24c65d)[_0xf77a('0x36')](_0x4ee322);};}exports[_0xf77a('0x37')]=function(_0x1d2072,_0x4a5ff6){var _0x45d06d={'include':[{'model':db[_0xf77a('0x38')],'as':_0xf77a('0x39')},{'model':db[_0xf77a('0x3a')],'as':_0xf77a('0x3b')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0xeaec4c={},_0x32f5bf={'count':0x0,'rows':[]};var _0x403778=db['MailAccount'][_0xf77a('0x3c')];_0xeaec4c[_0xf77a('0x3d')]=_['keys'](_0x403778);_0xeaec4c['query']=_[_0xf77a('0x3e')](_0x1d2072[_0xf77a('0x3f')]);_0xeaec4c['filters']=_[_0xf77a('0x40')](_0xeaec4c[_0xf77a('0x3d')],_0xeaec4c[_0xf77a('0x3f')]);_0x45d06d[_0xf77a('0x41')]=_['intersection'](_0xeaec4c[_0xf77a('0x3d')],qs[_0xf77a('0x42')](_0x1d2072[_0xf77a('0x3f')][_0xf77a('0x42')]));_0x45d06d['attributes']=_0x45d06d[_0xf77a('0x41')]['length']?_0x45d06d[_0xf77a('0x41')]:_0xeaec4c['model'];if(!_0x1d2072[_0xf77a('0x3f')][_0xf77a('0x43')]('nolimit')){_0x45d06d['limit']=qs[_0xf77a('0x44')](_0x1d2072['query'][_0xf77a('0x44')]);_0x45d06d['offset']=qs['offset'](_0x1d2072[_0xf77a('0x3f')][_0xf77a('0x2c')]);}_0x45d06d['order']=qs[_0xf77a('0x45')](_0x1d2072['query'][_0xf77a('0x45')]);_0x45d06d[_0xf77a('0x46')]=qs[_0xf77a('0x47')](_[_0xf77a('0x48')](_0x1d2072[_0xf77a('0x3f')],_0xeaec4c['filters']));if(_0x1d2072[_0xf77a('0x3f')][_0xf77a('0x49')]){_0x45d06d[_0xf77a('0x46')]=_[_0xf77a('0x4a')](_0x45d06d[_0xf77a('0x46')],{'$or':_['map'](_0x403778,function(_0x1e6788){if(_0x1e6788['type'][_0xf77a('0x4b')]!=='VIRTUAL'){var _0x1f7ac6={};_0x1f7ac6[_0x1e6788[_0xf77a('0x4c')]]={'$like':'%'+_0x1d2072[_0xf77a('0x3f')][_0xf77a('0x49')]+'%'};return _0x1f7ac6;}})});}_0x45d06d=_[_0xf77a('0x4a')]({},_0x45d06d,_0x1d2072[_0xf77a('0x4d')]);var _0x4303cc={'where':_0x45d06d[_0xf77a('0x46')]};return db[_0xf77a('0x4e')]['count'](_0x4303cc)['then'](function(_0x1426e1){_0x32f5bf['count']=_0x1426e1;if(_0x1d2072[_0xf77a('0x3f')][_0xf77a('0x4f')]){_0x45d06d[_0xf77a('0x50')]=[{'all':!![]}];}return db[_0xf77a('0x4e')][_0xf77a('0x51')](_0x45d06d);})[_0xf77a('0x1c')](function(_0x501eb8){_0x32f5bf[_0xf77a('0x52')]=_0x501eb8;return _0x32f5bf;})[_0xf77a('0x1c')](respondWithFilteredResult(_0x4a5ff6,_0x45d06d))[_0xf77a('0x26')](handleError(_0x4a5ff6,null));};exports[_0xf77a('0x53')]=function(_0x217017,_0x23cd2e){var _0x6fe6ef={'raw':![],'where':{'id':_0x217017[_0xf77a('0x54')]['id']},'include':[{'model':db[_0xf77a('0x38')],'as':_0xf77a('0x39')},{'model':db[_0xf77a('0x3a')],'as':_0xf77a('0x3b')},{'model':db[_0xf77a('0x55')],'as':'mandatoryDispositionPause'}]},_0x219193={};_0x219193['model']=_['keys'](db['MailAccount']['rawAttributes']);_0x219193[_0xf77a('0x3f')]=_[_0xf77a('0x3e')](_0x217017[_0xf77a('0x3f')]);_0x219193[_0xf77a('0x47')]=_[_0xf77a('0x40')](_0x219193['model'],_0x219193[_0xf77a('0x3f')]);_0x6fe6ef[_0xf77a('0x41')]=_['intersection'](_0x219193[_0xf77a('0x3d')],qs[_0xf77a('0x42')](_0x217017[_0xf77a('0x3f')][_0xf77a('0x42')]));_0x6fe6ef[_0xf77a('0x41')]=_0x6fe6ef['attributes'][_0xf77a('0x56')]?_0x6fe6ef[_0xf77a('0x41')]:_0x219193[_0xf77a('0x3d')];if(_0x217017[_0xf77a('0x3f')][_0xf77a('0x4f')]){_0x6fe6ef[_0xf77a('0x50')]=[{'all':!![]}];}_0x6fe6ef=_[_0xf77a('0x4a')]({},_0x6fe6ef,_0x217017[_0xf77a('0x4d')]);return db[_0xf77a('0x4e')][_0xf77a('0x57')](_0x6fe6ef)[_0xf77a('0x1c')](handleEntityNotFound(_0x23cd2e,null))[_0xf77a('0x1c')](respondWithResult(_0x23cd2e,null))[_0xf77a('0x26')](handleError(_0x23cd2e,null));};exports['update']=function(_0x251f9c,_0x57fa62){if(_0x251f9c[_0xf77a('0x58')]['id']){delete _0x251f9c[_0xf77a('0x58')]['id'];}return db['MailAccount'][_0xf77a('0x57')]({'where':{'id':_0x251f9c['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0xf77a('0x39')},{'model':db[_0xf77a('0x3a')],'as':_0xf77a('0x3b')},{'model':db[_0xf77a('0x55')],'as':'mandatoryDispositionPause'}]})[_0xf77a('0x1c')](handleEntityNotFound(_0x57fa62,null))[_0xf77a('0x1c')](saveUpdates(_0x251f9c[_0xf77a('0x58')],null))['then'](function(_0x3a1ec3){if(_0x3a1ec3&&_0x251f9c[_0xf77a('0x58')][_0xf77a('0x39')]){return db['MailServerIn'][_0xf77a('0x31')](_0x251f9c[_0xf77a('0x58')]['Imap'],{'where':{'MailAccountId':_0x3a1ec3['id']}})[_0xf77a('0x1c')](function(){return _0x3a1ec3;});}return _0x3a1ec3;})[_0xf77a('0x1c')](function(_0x1dcb94){if(_0x1dcb94&&_0x251f9c[_0xf77a('0x58')][_0xf77a('0x3b')]){return db[_0xf77a('0x3a')]['update'](_0x251f9c[_0xf77a('0x58')][_0xf77a('0x3b')],{'where':{'MailAccountId':_0x1dcb94['id']}})[_0xf77a('0x1c')](function(){return _0x1dcb94;});}return _0x1dcb94;})['then'](function(_0x6b9261){if(_0x6b9261&&_0x251f9c['body']['mandatoryDispositionPause']){return db[_0xf77a('0x55')][_0xf77a('0x31')](_0x251f9c[_0xf77a('0x58')]['mandatoryDispositionPause'],{'where':{'MailAccountId':_0x6b9261['id']}})['then'](function(){return _0x6b9261;});}return _0x6b9261;})[_0xf77a('0x1c')](respondWithResult(_0x57fa62,null))[_0xf77a('0x26')](handleError(_0x57fa62,null));};exports[_0xf77a('0x59')]=function(_0x59b830,_0x678031){return db[_0xf77a('0x4e')][_0xf77a('0x59')]()[_0xf77a('0x1c')](respondWithResult(_0x678031,null))[_0xf77a('0x26')](handleError(_0x678031,null));};exports[_0xf77a('0x5a')]=function(_0x1d3ce4,_0x505f2d,_0x2670e5){if(_0x1d3ce4['body']['id']){delete _0x1d3ce4[_0xf77a('0x58')]['id'];}return db[_0xf77a('0x4e')][_0xf77a('0x57')]({'where':{'id':_0x1d3ce4[_0xf77a('0x54')]['id']}})[_0xf77a('0x1c')](handleEntityNotFound(_0x505f2d,null))[_0xf77a('0x1c')](function(_0x2b175b){if(_0x2b175b){_0x1d3ce4['body'][_0xf77a('0x5b')]=_0x2b175b['id'];return db[_0xf77a('0x5c')][_0xf77a('0x5d')](_0x1d3ce4['body']);}})['then'](respondWithResult(_0x505f2d,null))[_0xf77a('0x26')](handleError(_0x505f2d,null));};exports['getDispositions']=function(_0x2545be,_0x3e4123,_0x5f56a4){var _0x41aa77={'raw':![],'where':{}};var _0x8644a5={};var _0x49b920={'count':0x0,'rows':[]};return db['MailAccount'][_0xf77a('0x5e')]({'where':{'id':_0x2545be[_0xf77a('0x54')]['id']}})[_0xf77a('0x1c')](handleEntityNotFound(_0x3e4123,null))[_0xf77a('0x1c')](function(_0x5a6074){if(_0x5a6074){_0x8644a5['model']=_[_0xf77a('0x3e')](db[_0xf77a('0x5c')][_0xf77a('0x3c')]);_0x8644a5['query']=_['keys'](_0x2545be[_0xf77a('0x3f')]);_0x8644a5[_0xf77a('0x47')]=_['intersection'](_0x8644a5[_0xf77a('0x3d')],_0x8644a5[_0xf77a('0x3f')]);_0x41aa77['attributes']=_[_0xf77a('0x40')](_0x8644a5[_0xf77a('0x3d')],qs['fields'](_0x2545be['query']['fields']));_0x41aa77[_0xf77a('0x41')]=_0x41aa77[_0xf77a('0x41')][_0xf77a('0x56')]?_0x41aa77[_0xf77a('0x41')]:_0x8644a5[_0xf77a('0x3d')];if(!_0x2545be[_0xf77a('0x3f')][_0xf77a('0x43')](_0xf77a('0x5f'))){_0x41aa77[_0xf77a('0x44')]=qs['limit'](_0x2545be[_0xf77a('0x3f')]['limit']);_0x41aa77[_0xf77a('0x2c')]=qs[_0xf77a('0x2c')](_0x2545be[_0xf77a('0x3f')][_0xf77a('0x2c')]);}_0x41aa77[_0xf77a('0x60')]=qs['sort'](_0x2545be[_0xf77a('0x3f')]['sort']);_0x41aa77['where']=qs[_0xf77a('0x47')](_[_0xf77a('0x48')](_0x2545be[_0xf77a('0x3f')],_0x8644a5[_0xf77a('0x47')]));_0x41aa77[_0xf77a('0x46')][_0xf77a('0x5b')]=_0x5a6074['id'];if(_0x2545be[_0xf77a('0x3f')][_0xf77a('0x49')]){_0x41aa77[_0xf77a('0x46')]=_[_0xf77a('0x4a')](_0x41aa77[_0xf77a('0x46')],{'$or':_['map'](_0x41aa77['attributes'],function(_0x5ee5f2){var _0xe06700={};_0xe06700[_0x5ee5f2]={'$like':'%'+_0x2545be[_0xf77a('0x3f')]['filter']+'%'};return _0xe06700;})});}_0x41aa77=_['merge']({},_0x41aa77,_0x2545be[_0xf77a('0x4d')]);return db[_0xf77a('0x5c')][_0xf77a('0x2b')]({'where':_0x41aa77[_0xf77a('0x46')]})[_0xf77a('0x1c')](function(_0x276b36){_0x49b920[_0xf77a('0x2b')]=_0x276b36;if(_0x2545be['query'][_0xf77a('0x4f')]){_0x41aa77[_0xf77a('0x50')]=[{'all':!![]}];}return db[_0xf77a('0x5c')][_0xf77a('0x51')](_0x41aa77);})['then'](function(_0x20174e){_0x49b920[_0xf77a('0x52')]=_0x20174e;return _0x49b920;});}})[_0xf77a('0x1c')](respondWithFilteredResult(_0x3e4123,_0x41aa77))[_0xf77a('0x26')](handleError(_0x3e4123,null));};exports[_0xf77a('0x61')]=function(_0x43e4f7,_0x1492a2,_0xb7a7d6){var _0x37a253;return db[_0xf77a('0x4e')][_0xf77a('0x57')]({'where':{'id':_0x43e4f7[_0xf77a('0x54')]['id']}})[_0xf77a('0x1c')](handleEntityNotFound(_0x1492a2,null))[_0xf77a('0x1c')](function(_0x2d8c2c){if(_0x2d8c2c){return _0x2d8c2c[_0xf77a('0x61')](_0x43e4f7[_0xf77a('0x3f')][_0xf77a('0x62')]);}})[_0xf77a('0x1c')](respondWithStatusCode(_0x1492a2,null))[_0xf77a('0x26')](handleError(_0x1492a2,null));};exports[_0xf77a('0x63')]=function(_0x154591,_0x4b5b9e,_0x2b6870){if(_0x154591[_0xf77a('0x58')]['id']){delete _0x154591['body']['id'];}return db[_0xf77a('0x4e')][_0xf77a('0x57')]({'where':{'id':_0x154591[_0xf77a('0x54')]['id']}})['then'](handleEntityNotFound(_0x4b5b9e,null))['then'](function(_0x4e3349){if(_0x4e3349){_0x154591[_0xf77a('0x58')][_0xf77a('0x5b')]=_0x4e3349['id'];return db[_0xf77a('0x64')]['create'](_0x154591[_0xf77a('0x58')]);}})[_0xf77a('0x1c')](respondWithResult(_0x4b5b9e,null))['catch'](handleError(_0x4b5b9e,null));};exports[_0xf77a('0x65')]=function(_0x1936e6,_0x4b93f8,_0xcc8456){var _0x38eff0={'raw':![],'where':{}};var _0xc418f0={};var _0x485f6a={'count':0x0,'rows':[]};return db['MailAccount'][_0xf77a('0x5e')]({'where':{'id':_0x1936e6[_0xf77a('0x54')]['id']}})[_0xf77a('0x1c')](handleEntityNotFound(_0x4b93f8,null))[_0xf77a('0x1c')](function(_0x34d3b7){if(_0x34d3b7){_0xc418f0[_0xf77a('0x3d')]=_[_0xf77a('0x3e')](db[_0xf77a('0x64')]['rawAttributes']);_0xc418f0[_0xf77a('0x3f')]=_['keys'](_0x1936e6[_0xf77a('0x3f')]);_0xc418f0[_0xf77a('0x47')]=_[_0xf77a('0x40')](_0xc418f0[_0xf77a('0x3d')],_0xc418f0[_0xf77a('0x3f')]);_0x38eff0[_0xf77a('0x41')]=_[_0xf77a('0x40')](_0xc418f0[_0xf77a('0x3d')],qs[_0xf77a('0x42')](_0x1936e6['query'][_0xf77a('0x42')]));_0x38eff0[_0xf77a('0x41')]=_0x38eff0[_0xf77a('0x41')]['length']?_0x38eff0[_0xf77a('0x41')]:_0xc418f0['model'];if(!_0x1936e6[_0xf77a('0x3f')][_0xf77a('0x43')](_0xf77a('0x5f'))){_0x38eff0[_0xf77a('0x44')]=qs['limit'](_0x1936e6[_0xf77a('0x3f')][_0xf77a('0x44')]);_0x38eff0['offset']=qs[_0xf77a('0x2c')](_0x1936e6['query'][_0xf77a('0x2c')]);}_0x38eff0[_0xf77a('0x60')]=qs[_0xf77a('0x45')](_0x1936e6[_0xf77a('0x3f')][_0xf77a('0x45')]);_0x38eff0[_0xf77a('0x46')]=qs[_0xf77a('0x47')](_[_0xf77a('0x48')](_0x1936e6[_0xf77a('0x3f')],_0xc418f0[_0xf77a('0x47')]));_0x38eff0[_0xf77a('0x46')][_0xf77a('0x5b')]=_0x34d3b7['id'];if(_0x1936e6[_0xf77a('0x3f')][_0xf77a('0x49')]){_0x38eff0[_0xf77a('0x46')]=_[_0xf77a('0x4a')](_0x38eff0[_0xf77a('0x46')],{'$or':_[_0xf77a('0x66')](_0x38eff0[_0xf77a('0x41')],function(_0x28657a){var _0x106753={};_0x106753[_0x28657a]={'$like':'%'+_0x1936e6['query'][_0xf77a('0x49')]+'%'};return _0x106753;})});}_0x38eff0=_[_0xf77a('0x4a')]({},_0x38eff0,_0x1936e6[_0xf77a('0x4d')]);return db[_0xf77a('0x64')][_0xf77a('0x2b')]({'where':_0x38eff0[_0xf77a('0x46')]})[_0xf77a('0x1c')](function(_0x27a32f){_0x485f6a['count']=_0x27a32f;if(_0x1936e6[_0xf77a('0x3f')][_0xf77a('0x4f')]){_0x38eff0[_0xf77a('0x50')]=[{'all':!![]}];}return db[_0xf77a('0x64')][_0xf77a('0x51')](_0x38eff0);})[_0xf77a('0x1c')](function(_0x336335){_0x485f6a[_0xf77a('0x52')]=_0x336335;return _0x485f6a;});}})['then'](respondWithFilteredResult(_0x4b93f8,_0x38eff0))[_0xf77a('0x26')](handleError(_0x4b93f8,null));};exports[_0xf77a('0x67')]=function(_0x24b6dd,_0xe4c0a2,_0x1427b1){var _0x3aebac;return db[_0xf77a('0x4e')][_0xf77a('0x57')]({'where':{'id':_0x24b6dd[_0xf77a('0x54')]['id']}})[_0xf77a('0x1c')](handleEntityNotFound(_0xe4c0a2,null))[_0xf77a('0x1c')](function(_0x2f9bba){if(_0x2f9bba){return _0x2f9bba[_0xf77a('0x67')](_0x24b6dd[_0xf77a('0x3f')][_0xf77a('0x62')]);}})['then'](respondWithStatusCode(_0xe4c0a2,null))[_0xf77a('0x26')](handleError(_0xe4c0a2,null));};exports[_0xf77a('0x5d')]=function(_0x170244,_0x3a3ed9){var _0xa54954={'name':_0x170244[_0xf77a('0x58')]['name'],'key':_0x170244['body'][_0xf77a('0x4b')],'email':_0x170244['body'][_0xf77a('0x68')],'ListId':_0x170244[_0xf77a('0x58')][_0xf77a('0x69')],'active':!_[_0xf77a('0x6a')](_0x170244[_0xf77a('0x58')][_0xf77a('0x6b')])?_0x170244[_0xf77a('0x58')]['active']:!![],'description':_0x170244[_0xf77a('0x58')][_0xf77a('0x6c')]||null,'Imap':{},'Smtp':{}};if(_[_0xf77a('0x6a')](_0x170244[_0xf77a('0x58')]['cservice'])){if(_0x170244['body']['cauthentication']){_0xa54954[_0xf77a('0x39')][_0xf77a('0x6d')]=_0xa54954[_0xf77a('0x3b')][_0xf77a('0x6d')]=_0x170244[_0xf77a('0x58')][_0xf77a('0x6e')];_0xa54954['Imap'][_0xf77a('0x6f')]=_0xa54954[_0xf77a('0x3b')]['pass']=_0x170244[_0xf77a('0x58')][_0xf77a('0x70')];}else{_0xa54954[_0xf77a('0x39')][_0xf77a('0x71')]=_0xa54954[_0xf77a('0x3b')]['authentication']=![];}_0xa54954['Imap'][_0xf77a('0x72')]=_0x170244[_0xf77a('0x58')][_0xf77a('0x39')][_0xf77a('0x72')];_0xa54954[_0xf77a('0x39')][_0xf77a('0x73')]=_0x170244[_0xf77a('0x58')][_0xf77a('0x39')][_0xf77a('0x73')];_0xa54954[_0xf77a('0x3b')][_0xf77a('0x72')]=_0x170244[_0xf77a('0x58')][_0xf77a('0x3b')]['host'];_0xa54954['Smtp'][_0xf77a('0x73')]=_0x170244[_0xf77a('0x58')][_0xf77a('0x3b')][_0xf77a('0x73')];}else{_0xa54954[_0xf77a('0x39')][_0xf77a('0x74')]=_0xa54954['Smtp']['service']=_0x170244[_0xf77a('0x58')][_0xf77a('0x75')];_0xa54954[_0xf77a('0x39')]['user']=_0xa54954[_0xf77a('0x3b')]['user']=_0x170244[_0xf77a('0x58')][_0xf77a('0x6e')];_0xa54954['Imap'][_0xf77a('0x6f')]=_0xa54954[_0xf77a('0x3b')]['pass']=_0x170244['body']['cpassword'];}return db['MailAccount'][_0xf77a('0x5d')](_0xa54954,{'include':[{'model':db[_0xf77a('0x3a')],'as':_0xf77a('0x3b')},{'model':db[_0xf77a('0x38')],'as':_0xf77a('0x39')}]})[_0xf77a('0x1c')](function(_0x34e56f){var _0x26c386=_0x170244[_0xf77a('0x6d')]['get']({'plain':!![]});if(!_0x26c386)throw new Error(_0xf77a('0x76'));if(_0x26c386[_0xf77a('0x77')]===_0xf77a('0x6d')){var _0x50b156=_0x34e56f[_0xf77a('0x33')]({'plain':!![]});return db[_0xf77a('0x78')]['find']({'where':{'name':_0xf77a('0x79'),'userProfileId':_0x26c386[_0xf77a('0x7a')]},'raw':!![]})[_0xf77a('0x1c')](function(_0x216d04){if(_0x216d04&&_0x216d04[_0xf77a('0x7b')]===0x0){return db[_0xf77a('0x7c')][_0xf77a('0x5d')]({'name':_0x50b156[_0xf77a('0x35')],'resourceId':_0x50b156['id'],'type':_0x216d04[_0xf77a('0x35')],'sectionId':_0x216d04['id']},{})[_0xf77a('0x1c')](function(){return _0x34e56f;});}else{return _0x34e56f;}})['catch'](function(_0x385d8a){logger[_0xf77a('0x22')](_0xf77a('0x7d'),_0x385d8a);throw _0x385d8a;});}return _0x34e56f;})[_0xf77a('0x1c')](respondWithResult(_0x3a3ed9,0xc9))[_0xf77a('0x26')](handleError(_0x3a3ed9,null));};exports[_0xf77a('0x7e')]=function(_0x1170e0,_0x1c4a0e,_0x529465){return db['MailAccount'][_0xf77a('0x5e')]({'where':{'id':_0x1170e0[_0xf77a('0x54')]['id']}})[_0xf77a('0x1c')](handleEntityNotFound(_0x1c4a0e,null))[_0xf77a('0x1c')](function(_0x3b2a9a){if(_0x3b2a9a){return _0x3b2a9a['getImap']();}return null;})['then'](respondWithResult(_0x1c4a0e,null))[_0xf77a('0x26')](handleError(_0x1c4a0e,null));};exports[_0xf77a('0x7f')]=function(_0x208a73,_0x2ea02e,_0x60b76c){if(_0x208a73['body']['id']){delete _0x208a73['body']['id'];}return db[_0xf77a('0x4e')][_0xf77a('0x57')]({'where':{'id':_0x208a73[_0xf77a('0x54')]['id']}})[_0xf77a('0x1c')](handleEntityNotFound(_0x2ea02e,null))[_0xf77a('0x1c')](function(_0x49fe49){if(_0x49fe49){_0x208a73[_0xf77a('0x58')][_0xf77a('0x5b')]=_0x49fe49['id'];return db[_0xf77a('0x38')]['create'](_0x208a73[_0xf77a('0x58')]);}})[_0xf77a('0x1c')](respondWithResult(_0x2ea02e,null))[_0xf77a('0x26')](handleError(_0x2ea02e,null));};exports[_0xf77a('0x80')]=function(_0x5568b5,_0x341bcc,_0x3a022f){return db[_0xf77a('0x4e')][_0xf77a('0x5e')]({'where':{'id':_0x5568b5[_0xf77a('0x54')]['id']}})[_0xf77a('0x1c')](handleEntityNotFound(_0x341bcc,null))[_0xf77a('0x1c')](function(_0x431551){if(_0x431551){return _0x431551['setImap'](null);}return null;})[_0xf77a('0x1c')](respondWithStatusCode(_0x341bcc,null))[_0xf77a('0x26')](handleError(_0x341bcc,null));};exports['getSmtp']=function(_0x56da6f,_0x3c0040,_0x4de594){return db['MailAccount'][_0xf77a('0x5e')]({'where':{'id':_0x56da6f[_0xf77a('0x54')]['id']}})['then'](handleEntityNotFound(_0x3c0040,null))['then'](function(_0x1ea9bf){if(_0x1ea9bf){return _0x1ea9bf[_0xf77a('0x81')]();}return null;})[_0xf77a('0x1c')](respondWithResult(_0x3c0040,null))[_0xf77a('0x26')](handleError(_0x3c0040,null));};exports[_0xf77a('0x82')]=function(_0x5c807a,_0x28049a,_0x5a684c){if(_0x5c807a[_0xf77a('0x58')]['id']){delete _0x5c807a[_0xf77a('0x58')]['id'];}return db[_0xf77a('0x4e')]['find']({'where':{'id':_0x5c807a[_0xf77a('0x54')]['id']}})['then'](handleEntityNotFound(_0x28049a,null))[_0xf77a('0x1c')](function(_0x3ae2ce){if(_0x3ae2ce){_0x5c807a[_0xf77a('0x58')]['MailAccountId']=_0x3ae2ce['id'];return db['MailServerOut'][_0xf77a('0x5d')](_0x5c807a[_0xf77a('0x58')]);}})[_0xf77a('0x1c')](respondWithResult(_0x28049a,null))[_0xf77a('0x26')](handleError(_0x28049a,null));};exports['removeSmtp']=function(_0x55d3c5,_0x5c3a86,_0x308e9c){return db['MailAccount'][_0xf77a('0x5e')]({'where':{'id':_0x55d3c5['params']['id']}})[_0xf77a('0x1c')](handleEntityNotFound(_0x5c3a86,null))[_0xf77a('0x1c')](function(_0x19ea2e){if(_0x19ea2e){return _0x19ea2e[_0xf77a('0x83')](null);}return null;})[_0xf77a('0x1c')](respondWithStatusCode(_0x5c3a86,null))[_0xf77a('0x26')](handleError(_0x5c3a86,null));};exports['addInteraction']=function(_0xa19a11,_0x33aed1,_0x3d42b0){return db[_0xf77a('0x84')]['find']({'where':{'id':_0xa19a11['params']['id']}})['then'](handleEntityNotFound(_0x33aed1,null))['then'](function(_0x28f597){if(_0x28f597){return _0x28f597[_0xf77a('0x85')](_0xa19a11[_0xf77a('0x58')]['ids'],_[_0xf77a('0x86')](_0xa19a11[_0xf77a('0x58')],['ids','id'])||{});}})[_0xf77a('0x1c')](respondWithResult(_0x33aed1,null))[_0xf77a('0x26')](handleError(_0x33aed1,null));};exports['getInteractions']=function(_0x451148,_0x1367a4,_0x383f46){var _0xbb8e2c={'raw':![],'where':{}};var _0x2d5c7e={};var _0x3587bd={'count':0x0,'rows':[]};return db[_0xf77a('0x4e')]['findOne']({'where':{'id':_0x451148[_0xf77a('0x54')]['id']}})[_0xf77a('0x1c')](handleEntityNotFound(_0x1367a4,null))['then'](function(_0x10a8e2){if(_0x10a8e2){_0x2d5c7e[_0xf77a('0x3d')]=_[_0xf77a('0x3e')](db['MailInteraction'][_0xf77a('0x3c')]);_0x2d5c7e[_0xf77a('0x3f')]=_['keys'](_0x451148[_0xf77a('0x3f')]);_0x2d5c7e['filters']=_[_0xf77a('0x40')](_0x2d5c7e[_0xf77a('0x3d')],_0x2d5c7e[_0xf77a('0x3f')]);_0xbb8e2c[_0xf77a('0x41')]=_[_0xf77a('0x40')](_0x2d5c7e['model'],qs[_0xf77a('0x42')](_0x451148['query']['fields']));_0xbb8e2c[_0xf77a('0x41')]=_0xbb8e2c[_0xf77a('0x41')][_0xf77a('0x56')]?_0xbb8e2c[_0xf77a('0x41')]:_0x2d5c7e[_0xf77a('0x3d')];if(!_0x451148[_0xf77a('0x3f')][_0xf77a('0x43')](_0xf77a('0x5f'))){_0xbb8e2c[_0xf77a('0x44')]=qs[_0xf77a('0x44')](_0x451148['query'][_0xf77a('0x44')]);_0xbb8e2c[_0xf77a('0x2c')]=qs[_0xf77a('0x2c')](_0x451148[_0xf77a('0x3f')][_0xf77a('0x2c')]);}_0xbb8e2c['order']=qs['sort'](_0x451148[_0xf77a('0x3f')][_0xf77a('0x45')]);_0xbb8e2c['where']=qs[_0xf77a('0x47')](_[_0xf77a('0x48')](_0x451148[_0xf77a('0x3f')],_0x2d5c7e['filters']));_0xbb8e2c[_0xf77a('0x46')][_0xf77a('0x5b')]=_0x10a8e2['id'];if(_0x451148[_0xf77a('0x3f')][_0xf77a('0x49')]){_0xbb8e2c[_0xf77a('0x46')]=_['merge'](_0xbb8e2c[_0xf77a('0x46')],{'$or':_['map'](_0xbb8e2c['attributes'],function(_0x9fbae5){var _0x339efb={};_0x339efb[_0x9fbae5]={'$like':'%'+_0x451148['query'][_0xf77a('0x49')]+'%'};return _0x339efb;})});}_0xbb8e2c=_[_0xf77a('0x4a')]({},_0xbb8e2c,_0x451148[_0xf77a('0x4d')]);return db[_0xf77a('0x84')][_0xf77a('0x2b')]({'where':_0xbb8e2c[_0xf77a('0x46')]})[_0xf77a('0x1c')](function(_0x394471){_0x3587bd[_0xf77a('0x2b')]=_0x394471;if(_0x451148['query'][_0xf77a('0x4f')]){_0xbb8e2c['include']=[{'model':db[_0xf77a('0x87')],'as':_0xf77a('0x88'),'required':![]},{'model':db[_0xf77a('0x89')],'as':_0xf77a('0x8a'),'attributes':[_0xf77a('0x35'),'fullname',_0xf77a('0x8b')],'required':![]},{'model':db[_0xf77a('0x8c')],'as':_0xf77a('0x8d'),'attributes':['id',_0xf77a('0x35'),'color'],'where':_0x451148[_0xf77a('0x3f')][_0xf77a('0x8e')]?{'id':_0x451148['query'][_0xf77a('0x8e')]}:undefined,'required':_0x451148[_0xf77a('0x3f')][_0xf77a('0x8e')]?!![]:![]}];}return db[_0xf77a('0x84')][_0xf77a('0x51')](_0xbb8e2c);})[_0xf77a('0x1c')](function(_0x55f1f1){_0x3587bd[_0xf77a('0x52')]=_0x55f1f1;return _0x3587bd;});}})['then'](respondWithFilteredResult(_0x1367a4,_0xbb8e2c))[_0xf77a('0x26')](handleError(_0x1367a4,null));};exports[_0xf77a('0x8f')]=function(_0x47021f,_0xf8290b,_0x1edfb6){return db[_0xf77a('0x4e')][_0xf77a('0x5e')]({'where':{'id':_0x47021f[_0xf77a('0x54')]['id']}})[_0xf77a('0x1c')](handleEntityNotFound(_0xf8290b,null))[_0xf77a('0x1c')](function(_0x4191dd){if(_0x4191dd){return db['sequelize']['transaction'](function(_0x5011a0){return db['MailApplication'][_0xf77a('0x32')]({'where':{'MailAccountId':_0x47021f[_0xf77a('0x54')]['id']},'transaction':_0x5011a0})['then'](function(_0x390c53){var _0x9958f5=_[_0xf77a('0x66')](_0x47021f['body'],function(_0x577f91){_0x577f91[_0xf77a('0x5b')]=_0x47021f[_0xf77a('0x54')]['id'];return _0x577f91;});return db['MailApplication'][_0xf77a('0x90')](_0x9958f5,{'transaction':_0x5011a0});});})[_0xf77a('0x1c')](function(){return db[_0xf77a('0x91')][_0xf77a('0x92')]({'where':{'MailAccountId':_0x47021f[_0xf77a('0x54')]['id']},'order':_0xf77a('0x93')});});}})[_0xf77a('0x1c')](respondWithResult(_0xf8290b,null))[_0xf77a('0x26')](handleError(_0xf8290b,null));};exports[_0xf77a('0x94')]=function(_0x605010,_0x1e528c,_0x5411dc){var _0x2d9430={};var _0x57e5ce={};var _0x142002;var _0x312fda;return db[_0xf77a('0x4e')]['findOne']({'where':{'id':_0x605010[_0xf77a('0x54')]['id']}})[_0xf77a('0x1c')](handleEntityNotFound(_0x1e528c,null))['then'](function(_0x472ee6){if(_0x472ee6){_0x142002=_0x472ee6;_0x57e5ce[_0xf77a('0x3d')]=_[_0xf77a('0x3e')](db[_0xf77a('0x91')][_0xf77a('0x3c')]);_0x57e5ce[_0xf77a('0x3f')]=_['keys'](_0x605010['query']);_0x57e5ce[_0xf77a('0x47')]=_[_0xf77a('0x40')](_0x57e5ce[_0xf77a('0x3d')],_0x57e5ce[_0xf77a('0x3f')]);_0x2d9430['attributes']=_['intersection'](_0x57e5ce['model'],qs[_0xf77a('0x42')](_0x605010['query'][_0xf77a('0x42')]));_0x2d9430[_0xf77a('0x41')]=_0x2d9430[_0xf77a('0x41')][_0xf77a('0x56')]?_0x2d9430[_0xf77a('0x41')]:_0x57e5ce[_0xf77a('0x3d')];_0x2d9430['order']=qs['sort'](_0x605010['query'][_0xf77a('0x45')]);_0x2d9430['where']=qs[_0xf77a('0x47')](_[_0xf77a('0x48')](_0x605010[_0xf77a('0x3f')],_0x57e5ce[_0xf77a('0x47')]));if(_0x605010[_0xf77a('0x3f')][_0xf77a('0x49')]){_0x2d9430[_0xf77a('0x46')]=_[_0xf77a('0x4a')](_0x2d9430[_0xf77a('0x46')],{'$or':_['map'](_0x2d9430[_0xf77a('0x41')],function(_0x11f211){var _0x354452={};_0x354452[_0x11f211]={'$like':'%'+_0x605010[_0xf77a('0x3f')][_0xf77a('0x49')]+'%'};return _0x354452;})});}_0x2d9430=_[_0xf77a('0x4a')]({},_0x2d9430,_0x605010['options']);return _0x142002[_0xf77a('0x94')](_0x2d9430);}})[_0xf77a('0x1c')](function(_0x12538d){if(_0x12538d){_0x312fda=_0x12538d['length'];if(!_0x605010['query'][_0xf77a('0x43')](_0xf77a('0x5f'))){_0x2d9430[_0xf77a('0x44')]=qs['limit'](_0x605010[_0xf77a('0x3f')][_0xf77a('0x44')]);_0x2d9430[_0xf77a('0x2c')]=qs[_0xf77a('0x2c')](_0x605010['query'][_0xf77a('0x2c')]);}return _0x142002['getApplications'](_0x2d9430);}})[_0xf77a('0x1c')](function(_0x83444d){if(_0x83444d){return _0x83444d?{'count':_0x312fda,'rows':_0x83444d}:null;}})[_0xf77a('0x1c')](respondWithResult(_0x1e528c,null))[_0xf77a('0x26')](handleError(_0x1e528c,null));};exports[_0xf77a('0x95')]=function(_0x4d70e3,_0x30847a,_0x5011c2){var _0x155fec={'raw':!![],'where':{}};var _0x543bee={};var _0x2a2f7b={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x4d70e3['params']['id']}})[_0xf77a('0x1c')](handleEntityNotFound(_0x30847a,null))[_0xf77a('0x1c')](function(_0x458763){if(_0x458763){_0x543bee[_0xf77a('0x3d')]=_['keys'](db[_0xf77a('0x96')][_0xf77a('0x3c')]);_0x543bee['query']=_['keys'](_0x4d70e3[_0xf77a('0x3f')]);_0x543bee[_0xf77a('0x47')]=_[_0xf77a('0x40')](_0x543bee[_0xf77a('0x3d')],_0x543bee['query']);_0x155fec[_0xf77a('0x41')]=_[_0xf77a('0x40')](_0x543bee[_0xf77a('0x3d')],qs['fields'](_0x4d70e3['query']['fields']));_0x155fec['attributes']=_0x155fec[_0xf77a('0x41')][_0xf77a('0x56')]?_0x155fec[_0xf77a('0x41')]:_0x543bee[_0xf77a('0x3d')];if(!_0x4d70e3[_0xf77a('0x3f')][_0xf77a('0x43')](_0xf77a('0x5f'))){_0x155fec[_0xf77a('0x44')]=qs[_0xf77a('0x44')](_0x4d70e3['query'][_0xf77a('0x44')]);_0x155fec[_0xf77a('0x2c')]=qs[_0xf77a('0x2c')](_0x4d70e3[_0xf77a('0x3f')][_0xf77a('0x2c')]);}_0x155fec[_0xf77a('0x60')]=qs[_0xf77a('0x45')](_0x4d70e3[_0xf77a('0x3f')][_0xf77a('0x45')]);_0x155fec[_0xf77a('0x46')]=qs[_0xf77a('0x47')](_['pick'](_0x4d70e3[_0xf77a('0x3f')],_0x543bee[_0xf77a('0x47')]));_0x155fec[_0xf77a('0x46')][_0xf77a('0x5b')]=_0x458763['id'];if(_0x4d70e3[_0xf77a('0x3f')][_0xf77a('0x49')]){_0x155fec['where']=_[_0xf77a('0x4a')](_0x155fec[_0xf77a('0x46')],{'$or':_[_0xf77a('0x66')](_0x155fec[_0xf77a('0x41')],function(_0x39eaf1){var _0xdf118d={};_0xdf118d[_0x39eaf1]={'$like':'%'+_0x4d70e3['query'][_0xf77a('0x49')]+'%'};return _0xdf118d;})});}if(_0x4d70e3[_0xf77a('0x3f')]['$gte']){var _0x59033a=_0x4d70e3[_0xf77a('0x3f')][_0xf77a('0x97')][_0xf77a('0x98')](',');var _0x17ec34={};_0x17ec34[_0x59033a[0x0]]={'$gte':moment(_0x59033a[0x1])[_0xf77a('0x99')]('YYYY-MM-DD\x20HH:mm:ss')};_0x155fec[_0xf77a('0x46')]=_[_0xf77a('0x4a')](_0x155fec[_0xf77a('0x46')],_0x17ec34);}_0x155fec=_[_0xf77a('0x4a')]({},_0x155fec,_0x4d70e3[_0xf77a('0x4d')]);return db[_0xf77a('0x96')][_0xf77a('0x2b')]({'where':_0x155fec['where']})['then'](function(_0x4d80f2){_0x2a2f7b['count']=_0x4d80f2;if(_0x4d70e3[_0xf77a('0x3f')][_0xf77a('0x4f')]){_0x155fec['include']=[{'all':!![]}];}return db[_0xf77a('0x96')][_0xf77a('0x51')](_0x155fec);})['then'](function(_0x21d6b0){_0x2a2f7b[_0xf77a('0x52')]=_0x21d6b0;return _0x2a2f7b;});}})[_0xf77a('0x1c')](respondWithFilteredResult(_0x30847a,_0x155fec))[_0xf77a('0x26')](handleError(_0x30847a,null));};exports[_0xf77a('0x36')]=function(_0x1db935,_0x104531,_0x5f2397){var _0xb53cfa,_0x175cd0={},_0x3e32a2;if(_0x1db935[_0xf77a('0x58')]['to']){_0x3e32a2=_0x1db935[_0xf77a('0x58')]['to'][_0xf77a('0x98')](',')[0x0];}return db[_0xf77a('0x4e')][_0xf77a('0x57')]({'where':{'id':_0x1db935[_0xf77a('0x54')]['id']},'include':[{'model':db[_0xf77a('0x9a')],'as':_0xf77a('0x9b'),'include':[{'model':db[_0xf77a('0x87')],'as':'Contacts','where':{'email':_0x3e32a2},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xf77a('0x3a')],'as':_0xf77a('0x3b'),'raw':!![]}]})[_0xf77a('0x1c')](handleEntityNotFound(_0x104531,null))['then'](function(_0x302539){if(_0x302539){_0xb53cfa=_0x302539;if(_0x302539[_0xf77a('0x3b')]){if(_[_0xf77a('0x6a')](_0x1db935[_0xf77a('0x58')][_0xf77a('0x9c')])){_0x1db935[_0xf77a('0x58')]['from']=util[_0xf77a('0x99')](_0xf77a('0x9d'),_0x302539['name'],_0x302539[_0xf77a('0x68')]||_0x302539[_0xf77a('0x3b')]['user']);}if(_0x1db935[_0xf77a('0x58')][_0xf77a('0x9e')]&&_0x1db935[_0xf77a('0x58')][_0xf77a('0x9e')][_0xf77a('0x56')]){for(var _0x4530fc=0x0;_0x4530fc<_0x1db935['body']['attachments'][_0xf77a('0x56')];_0x4530fc+=0x1){_0x1db935[_0xf77a('0x58')]['attachments'][_0x4530fc]={'filename':_0x1db935['body']['attachments'][_0x4530fc][_0xf77a('0x35')],'path':path[_0xf77a('0x9f')](config['root'],'server/files/attachments',_0x1db935[_0xf77a('0x58')]['attachments'][_0x4530fc]['basename'])};}}var _0x4a95fd={'tls':{'rejectUnauthorized':![]}};if(_[_0xf77a('0x6a')](_0x302539[_0xf77a('0x3b')][_0xf77a('0x74')])){if(_0x302539[_0xf77a('0x3b')][_0xf77a('0x71')]){_0x4a95fd['auth']={'user':_0x302539[_0xf77a('0x3b')]['user'],'pass':_0x302539[_0xf77a('0x3b')][_0xf77a('0xa0')]};}_0x4a95fd[_0xf77a('0x72')]=_0x302539[_0xf77a('0x3b')][_0xf77a('0x72')];_0x4a95fd[_0xf77a('0x73')]=_0x302539[_0xf77a('0x3b')][_0xf77a('0x73')];_0x4a95fd[_0xf77a('0xa1')]=_0x302539[_0xf77a('0x3b')][_0xf77a('0xa1')];}else{_0x4a95fd[_0xf77a('0x74')]=_0x302539[_0xf77a('0x3b')][_0xf77a('0x74')];_0x4a95fd[_0xf77a('0xa2')]={'user':_0x302539[_0xf77a('0x3b')][_0xf77a('0x6d')],'pass':_0x302539[_0xf77a('0x3b')][_0xf77a('0xa0')]};}return respondWithRpcPromise(_0xf77a('0xa3'),_0xf77a('0xa4'),{'account':_0x4a95fd,'message':_0x1db935[_0xf77a('0x58')]});}else{throw new Error(_0xf77a('0xa5'));}}})[_0xf77a('0x1c')](function(_0x474750){if(_0x474750){_0x175cd0=_0x474750;if(_0xb53cfa[_0xf77a('0x9b')]){if(_0xb53cfa[_0xf77a('0x9b')][_0xf77a('0xa6')][_0xf77a('0x56')]){return _0xb53cfa[_0xf77a('0x9b')][_0xf77a('0xa6')][0x0];}else{return db['CmContact'][_0xf77a('0x5d')](_[_0xf77a('0xa7')](_0x1db935['body'],{'firstName':_0x1db935['body']['to'],'email':_0x1db935['body']['to'],'phone':_0x1db935[_0xf77a('0x58')]['to'],'ListId':_0xb53cfa[_0xf77a('0x69')]}));}}else{throw new Error(_0xf77a('0xa5'));}}})[_0xf77a('0x1c')](function(_0x42c428){if(_0x42c428){var _0x1d68ff={'UserId':_0x1db935[_0xf77a('0x6d')]['id'],'ContactId':_0x42c428['id'],'MailAccountId':_0xb53cfa['id'],'inReplyTo':_0x175cd0['messageId'],'to':_0x1db935[_0xf77a('0x58')]['from'],'cc':_0x1db935[_0xf77a('0x58')]['cc'],'subject':_0x1db935[_0xf77a('0x58')][_0xf77a('0xa8')],'attach':_0x1db935[_0xf77a('0x58')][_0xf77a('0xa9')],'firstMsgDirection':'out','lastMsgAt':moment()[_0xf77a('0x99')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xf77a('0xaa'),'lastMsgBody':_0x1db935[_0xf77a('0x58')][_0xf77a('0x58')],'Messages':[_[_0xf77a('0x4a')](_0x1db935[_0xf77a('0x58')],{'messageId':_0x175cd0['messageId'],'sentAt':moment()[_0xf77a('0x99')](_0xf77a('0xab')),'read':!![],'MailAccountId':_0xb53cfa['id'],'UserId':_0x1db935['user']['id'],'ContactId':_0x42c428['id']})]};if(_0x1db935[_0xf77a('0x58')][_0xf77a('0xac')]){_0x1d68ff=_[_0xf77a('0x4a')](_0x1d68ff,_0x1db935[_0xf77a('0x58')][_0xf77a('0xac')]);}return db['MailInteraction'][_0xf77a('0x5d')](_0x1d68ff,{'include':[{'model':db[_0xf77a('0x96')],'as':_0xf77a('0xad')}]});}})['then'](respondWithResult(_0x104531,null))[_0xf77a('0x26')](handleError(_0x104531,null));};exports[_0xf77a('0xae')]=function(_0x2a1bc6,_0x4ea1bf,_0xefd58a){return db[_0xf77a('0x4e')]['find']({'where':{'id':_0x2a1bc6[_0xf77a('0x54')]['id']},'include':[{'model':db[_0xf77a('0x3a')],'as':_0xf77a('0x3b'),'raw':!![]}]})[_0xf77a('0x1c')](handleEntityNotFound(_0x4ea1bf,null))['then'](function(_0x86b122){if(_0x86b122&&_0x86b122[_0xf77a('0x3b')]){var _0x352b72={'id':_0x86b122['id'],'tls':{'rejectUnauthorized':![]}};if(_0x86b122['Smtp'][_0xf77a('0x74')]){_0x352b72[_0xf77a('0x74')]=_0x86b122[_0xf77a('0x3b')][_0xf77a('0x74')];}else{_0x352b72['host']=_0x86b122['Smtp'][_0xf77a('0x72')];_0x352b72[_0xf77a('0x73')]=_0x86b122[_0xf77a('0x3b')]['port'];_0x352b72[_0xf77a('0xa1')]=_0x86b122[_0xf77a('0x3b')][_0xf77a('0xa1')];}if(_0x86b122[_0xf77a('0x3b')][_0xf77a('0x71')]){_0x352b72[_0xf77a('0xa2')]={'user':_0x86b122[_0xf77a('0x3b')][_0xf77a('0x6d')],'pass':_0x86b122[_0xf77a('0x3b')][_0xf77a('0xa0')]};}return respondWithRpcPromise(_0xf77a('0xaf'),_0xf77a('0xae'),{'account':_0x352b72});}})[_0xf77a('0x1c')](respondWithResult(_0x4ea1bf,null))['catch'](handleError(_0x4ea1bf,null));};exports[_0xf77a('0x32')]=function(_0x24a1f7,_0x4cc784){return db['MailAccount']['find']({'where':{'id':_0x24a1f7[_0xf77a('0x54')]['id']}})[_0xf77a('0x1c')](handleEntityNotFound(_0x4cc784,null))[_0xf77a('0x1c')](function(_0x403fef){if(_0x403fef&&_0x403fef[_0xf77a('0x74')]){throw new db[(_0xf77a('0xb0'))][(_0xf77a('0xb1'))](_0xf77a('0xb2'));}return _0x403fef;})[_0xf77a('0x1c')](removeEntity(_0x4cc784,null))[_0xf77a('0x26')](handleError(_0x4cc784,null));};exports[_0xf77a('0xb3')]=function(_0x3001b8,_0x3967cc,_0x39a8b5){return db[_0xf77a('0x4e')][_0xf77a('0x57')]({'where':{'id':_0x3001b8[_0xf77a('0x54')]['id']}})[_0xf77a('0x1c')](handleEntityNotFound(_0x3967cc,null))[_0xf77a('0x1c')](function(_0x3cfb00){if(_0x3cfb00){return _0x3cfb00[_0xf77a('0xb3')](_0x3001b8[_0xf77a('0x58')][_0xf77a('0x62')],_[_0xf77a('0x86')](_0x3001b8[_0xf77a('0x58')],['ids','id'])||{})[_0xf77a('0xb4')](function(_0xaf4cc4){for(var _0x5e7ab1=0x0;_0x5e7ab1<_0x3001b8['body']['ids'][_0xf77a('0x56')];_0x5e7ab1+=0x1){socket[_0xf77a('0xb5')](_0xf77a('0xb6'),{'UserId':_0x3001b8[_0xf77a('0x58')][_0xf77a('0x62')][_0x5e7ab1],'MailAccountId':_0x3001b8[_0xf77a('0x54')]['id']});}return _0xaf4cc4;});}})['then'](respondWithResult(_0x3967cc,null))[_0xf77a('0x26')](handleError(_0x3967cc,null));};exports[_0xf77a('0xb7')]=function(_0x2c78bb,_0x2374cc,_0x30ad21){var _0x1dc1d6;return db[_0xf77a('0x4e')][_0xf77a('0x57')]({'where':{'id':_0x2c78bb['params']['id']}})[_0xf77a('0x1c')](handleEntityNotFound(_0x2374cc,null))[_0xf77a('0x1c')](function(_0x5b65b4){if(_0x5b65b4){return _0x5b65b4[_0xf77a('0xb7')](_0x2c78bb[_0xf77a('0x3f')]['ids'])[_0xf77a('0x1c')](function(_0x300274){if(_['isArray'](_0x2c78bb[_0xf77a('0x3f')][_0xf77a('0x62')])){for(var _0x3c7914=0x0;_0x3c7914<_0x2c78bb[_0xf77a('0x3f')][_0xf77a('0x62')][_0xf77a('0x56')];_0x3c7914+=0x1){socket[_0xf77a('0xb5')](_0xf77a('0xb8'),{'UserId':_0x2c78bb[_0xf77a('0x3f')][_0xf77a('0x62')][_0x3c7914],'MailAccountId':_0x2c78bb[_0xf77a('0x54')]['id']});}}else{socket[_0xf77a('0xb5')](_0xf77a('0xb8'),{'UserId':_0x2c78bb[_0xf77a('0x3f')][_0xf77a('0x62')],'MailAccountId':_0x2c78bb[_0xf77a('0x54')]['id']});}});}})[_0xf77a('0x1c')](respondWithStatusCode(_0x2374cc,null))['catch'](handleError(_0x2374cc,null));};exports['getAgents']=function(_0x2c2b10,_0x3a283a,_0x2f0f2b){var _0x4f4f6c={};var _0x4d4b3a={};var _0x38ea8d;var _0xab8d32;return db[_0xf77a('0x4e')][_0xf77a('0x5e')]({'where':{'id':_0x2c2b10[_0xf77a('0x54')]['id']}})[_0xf77a('0x1c')](handleEntityNotFound(_0x3a283a,null))[_0xf77a('0x1c')](function(_0x210af7){if(_0x210af7){_0x38ea8d=_0x210af7;_0x4d4b3a[_0xf77a('0x3d')]=_[_0xf77a('0x3e')](db[_0xf77a('0x89')][_0xf77a('0x3c')]);_0x4d4b3a[_0xf77a('0x3f')]=_[_0xf77a('0x3e')](_0x2c2b10[_0xf77a('0x3f')]);_0x4d4b3a[_0xf77a('0x47')]=_['intersection'](_0x4d4b3a[_0xf77a('0x3d')],_0x4d4b3a[_0xf77a('0x3f')]);_0x4f4f6c[_0xf77a('0x41')]=_[_0xf77a('0x40')](_0x4d4b3a[_0xf77a('0x3d')],qs[_0xf77a('0x42')](_0x2c2b10[_0xf77a('0x3f')][_0xf77a('0x42')]));_0x4f4f6c[_0xf77a('0x41')]=_0x4f4f6c[_0xf77a('0x41')]['length']?_0x4f4f6c[_0xf77a('0x41')]:_0x4d4b3a['model'];_0x4f4f6c[_0xf77a('0x60')]=qs[_0xf77a('0x45')](_0x2c2b10['query'][_0xf77a('0x45')]);_0x4f4f6c[_0xf77a('0x46')]=qs[_0xf77a('0x47')](_[_0xf77a('0x48')](_0x2c2b10[_0xf77a('0x3f')],_0x4d4b3a[_0xf77a('0x47')]));if(_0x2c2b10[_0xf77a('0x3f')][_0xf77a('0x49')]){_0x4f4f6c[_0xf77a('0x46')]=_['merge'](_0x4f4f6c[_0xf77a('0x46')],{'$or':_[_0xf77a('0x66')](_0x4f4f6c[_0xf77a('0x41')],function(_0x50bd77){var _0x42997f={};_0x42997f[_0x50bd77]={'$like':'%'+_0x2c2b10[_0xf77a('0x3f')][_0xf77a('0x49')]+'%'};return _0x42997f;})});}_0x4f4f6c=_[_0xf77a('0x4a')]({},_0x4f4f6c,_0x2c2b10[_0xf77a('0x4d')]);return _0x38ea8d[_0xf77a('0xb9')](_0x4f4f6c);}})[_0xf77a('0x1c')](function(_0x7ea454){if(_0x7ea454){_0xab8d32=_0x7ea454[_0xf77a('0x56')];if(!_0x2c2b10[_0xf77a('0x3f')][_0xf77a('0x43')](_0xf77a('0x5f'))){_0x4f4f6c[_0xf77a('0x44')]=qs[_0xf77a('0x44')](_0x2c2b10[_0xf77a('0x3f')][_0xf77a('0x44')]);_0x4f4f6c[_0xf77a('0x2c')]=qs[_0xf77a('0x2c')](_0x2c2b10['query'][_0xf77a('0x2c')]);}return _0x38ea8d['getAgents'](_0x4f4f6c);}})[_0xf77a('0x1c')](function(_0x38b26e){if(_0x38b26e){return _0x38b26e?{'count':_0xab8d32,'rows':_0x38b26e}:null;}})[_0xf77a('0x1c')](respondWithResult(_0x3a283a,null))[_0xf77a('0x26')](handleError(_0x3a283a,null));};
\ No newline at end of file
+var _0x1942=['isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','client','http','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','apply','save','then','MailAccounts','UserProfileResource','destroy','stack','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','MailAccount','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','type','VIRTUAL','field','includeAll','findAll','rows','params','include','options','find','update','body','Pause','mandatoryDispositionPause','describe','addDisposition','MailAccountId','Disposition','create','findOne','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','key','email','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','pass','cpassword','host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','setSmtp','addInteraction','omit','MailInteraction','nolimit','CmContact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','transaction','MailApplication','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','updatedAt','DESC','from','attachments','server/files/attachments','basename','authentication','auth','secure','SendMail','List\x20not\x20found','messageId','attach','out','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents'];(function(_0x352ad8,_0x1f8429){var _0x5b66b9=function(_0x19fda9){while(--_0x19fda9){_0x352ad8['push'](_0x352ad8['shift']());}};_0x5b66b9(++_0x1f8429);}(_0x1942,0xba));var _0x2194=function(_0x36c12e,_0x25ce82){_0x36c12e=_0x36c12e-0x0;var _0x58e9b7=_0x1942[_0x36c12e];return _0x58e9b7;};'use strict';var pdf=require(_0x2194('0x0'));var emlformat=require(_0x2194('0x1'));var rimraf=require(_0x2194('0x2'));var zipdir=require(_0x2194('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2194('0x4'));var moment=require(_0x2194('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2194('0x6'));var util=require(_0x2194('0x7'));var path=require(_0x2194('0x8'));var sox=require('sox');var csv=require(_0x2194('0x9'));var ejs=require(_0x2194('0xa'));var fs=require('fs');var _=require(_0x2194('0xb'));var squel=require(_0x2194('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0x2194('0xd'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x2194('0xe'))(_0x2194('0xf'));var utils=require(_0x2194('0x10'));var config=require('../../config/environment');var db=require(_0x2194('0x11'))['db'];config['redis']=_[_0x2194('0x12')](config[_0x2194('0x13')],{'host':_0x2194('0x14'),'port':0x18eb});var socket=require(_0x2194('0x15'))(new Redis(config[_0x2194('0x13')]));require(_0x2194('0x16'))[_0x2194('0x17')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2194('0x18')][_0x2194('0x19')]({'port':0x232b});function respondWithRpcPromise(_0x41bbf6,_0x35f2a3,_0x100618,_0x2cdcf0){return new BPromise(function(_0xa37afe,_0x1c7f21){var _0x5a4cd0=_0x2cdcf0||client;return _0x5a4cd0['request'](_0x41bbf6,_0x100618)['then'](function(_0x3e6499){logger[_0x2194('0x1a')](_0x2194('0x1b'),_0x35f2a3,_0x2194('0x1c'));logger[_0x2194('0x1d')](_0x2194('0x1e'),_0x35f2a3,_0x2194('0x1c'),JSON['stringify'](_0x3e6499));if(_0x3e6499[_0x2194('0x1f')]){if(_0x3e6499['error'][_0x2194('0x20')]===0x1f4){logger[_0x2194('0x1f')]('MailAccount,\x20%s,\x20%s',_0x35f2a3,_0x3e6499[_0x2194('0x1f')][_0x2194('0x21')]);return _0x1c7f21(_0x3e6499[_0x2194('0x1f')]['message']);}logger[_0x2194('0x1f')](_0x2194('0x1b'),_0x35f2a3,_0x3e6499[_0x2194('0x1f')][_0x2194('0x21')]);return _0xa37afe(_0x3e6499[_0x2194('0x1f')]['message']);}else{logger[_0x2194('0x1a')]('MailAccount,\x20%s,\x20%s',_0x35f2a3,'request\x20sent');_0xa37afe(_0x3e6499[_0x2194('0x22')][_0x2194('0x21')]);}})[_0x2194('0x23')](function(_0x36ba47){logger[_0x2194('0x1f')]('MailAccount,\x20%s,\x20%s',_0x35f2a3,_0x36ba47);_0x1c7f21(_0x36ba47);});});}function respondWithStatusCode(_0x56634c,_0x285dd1){_0x285dd1=_0x285dd1||0xcc;return function(_0x2acd2e){if(_0x2acd2e){return _0x56634c[_0x2194('0x24')](_0x285dd1);}return _0x56634c[_0x2194('0x25')](_0x285dd1)[_0x2194('0x26')]();};}function respondWithResult(_0x48be95,_0x26c949){_0x26c949=_0x26c949||0xc8;return function(_0x59e3c6){if(_0x59e3c6){return _0x48be95[_0x2194('0x25')](_0x26c949)[_0x2194('0x27')](_0x59e3c6);}};}function respondWithFilteredResult(_0x27d731,_0x1215e4){return function(_0x43ef5b){if(_0x43ef5b){var _0x44f6f9=_0x43ef5b[_0x2194('0x28')],_0x22c0ff=_0x1215e4[_0x2194('0x29')],_0x39db3c=_0x1215e4[_0x2194('0x29')]+_0x1215e4[_0x2194('0x2a')],_0xb950cb;if(_0x39db3c>=_0x44f6f9){_0x39db3c=_0x44f6f9;_0xb950cb=0xc8;}else{_0xb950cb=0xce;}_0x27d731[_0x2194('0x25')](_0xb950cb);return _0x27d731['set']('Content-Range',_0x22c0ff+'-'+_0x39db3c+'/'+_0x44f6f9)[_0x2194('0x27')](_0x43ef5b);}return null;};}function patchUpdates(_0x348dc5){return function(_0x370226){try{jsonpatch[_0x2194('0x2b')](_0x370226,_0x348dc5,!![]);}catch(_0x1371c0){return BPromise['reject'](_0x1371c0);}return _0x370226[_0x2194('0x2c')]();};}function saveUpdates(_0x5b20c6,_0x135820){return function(_0x1b6c8a){if(_0x1b6c8a){return _0x1b6c8a['update'](_0x5b20c6)['then'](function(_0x19f7a1){return _0x19f7a1;});}return null;};}function removeEntity(_0x1db173,_0xcf6b01){return function(_0x6a13c5){if(_0x6a13c5){return _0x6a13c5['destroy']()[_0x2194('0x2d')](function(){var _0x426702=_0x6a13c5['get']({'plain':!![]});var _0x40b9d9=_0x2194('0x2e');return db[_0x2194('0x2f')][_0x2194('0x30')]({'where':{'type':_0x40b9d9,'resourceId':_0x426702['id']}})['then'](function(){return _0x6a13c5;});})[_0x2194('0x2d')](function(){_0x1db173[_0x2194('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16b8f6,_0x223cf2){return function(_0x1a4f39){if(!_0x1a4f39){_0x16b8f6[_0x2194('0x24')](0x194);}return _0x1a4f39;};}function handleError(_0x20413d,_0x196e88){_0x196e88=_0x196e88||0x1f4;return function(_0x269844){logger[_0x2194('0x1f')](_0x269844[_0x2194('0x31')]);if(_0x269844[_0x2194('0x32')]){delete _0x269844[_0x2194('0x32')];}_0x20413d[_0x2194('0x25')](_0x196e88)[_0x2194('0x33')](_0x269844);};}exports[_0x2194('0x34')]=function(_0x367750,_0x3b53f){var _0x35b83f={'include':[{'model':db[_0x2194('0x35')],'as':_0x2194('0x36')},{'model':db[_0x2194('0x37')],'as':_0x2194('0x38')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4ea4cb={},_0x3c56ba={'count':0x0,'rows':[]};var _0x35883c=db[_0x2194('0x39')][_0x2194('0x3a')];_0x4ea4cb[_0x2194('0x3b')]=_[_0x2194('0x3c')](_0x35883c);_0x4ea4cb[_0x2194('0x3d')]=_[_0x2194('0x3c')](_0x367750['query']);_0x4ea4cb[_0x2194('0x3e')]=_[_0x2194('0x3f')](_0x4ea4cb[_0x2194('0x3b')],_0x4ea4cb[_0x2194('0x3d')]);_0x35b83f[_0x2194('0x40')]=_[_0x2194('0x3f')](_0x4ea4cb[_0x2194('0x3b')],qs[_0x2194('0x41')](_0x367750[_0x2194('0x3d')][_0x2194('0x41')]));_0x35b83f['attributes']=_0x35b83f[_0x2194('0x40')][_0x2194('0x42')]?_0x35b83f[_0x2194('0x40')]:_0x4ea4cb[_0x2194('0x3b')];if(!_0x367750[_0x2194('0x3d')][_0x2194('0x43')]('nolimit')){_0x35b83f[_0x2194('0x2a')]=qs[_0x2194('0x2a')](_0x367750[_0x2194('0x3d')][_0x2194('0x2a')]);_0x35b83f[_0x2194('0x29')]=qs['offset'](_0x367750[_0x2194('0x3d')][_0x2194('0x29')]);}_0x35b83f[_0x2194('0x44')]=qs['sort'](_0x367750['query'][_0x2194('0x45')]);_0x35b83f['where']=qs['filters'](_[_0x2194('0x46')](_0x367750[_0x2194('0x3d')],_0x4ea4cb['filters']));if(_0x367750[_0x2194('0x3d')][_0x2194('0x47')]){_0x35b83f[_0x2194('0x48')]=_[_0x2194('0x49')](_0x35b83f[_0x2194('0x48')],{'$or':_[_0x2194('0x4a')](_0x35883c,function(_0x23f97c){if(_0x23f97c[_0x2194('0x4b')]['key']!==_0x2194('0x4c')){var _0x2fa7f7={};_0x2fa7f7[_0x23f97c[_0x2194('0x4d')]]={'$like':'%'+_0x367750[_0x2194('0x3d')][_0x2194('0x47')]+'%'};return _0x2fa7f7;}})});}_0x35b83f=_['merge']({},_0x35b83f,_0x367750['options']);var _0x591f7b={'where':_0x35b83f[_0x2194('0x48')]};return db['MailAccount']['count'](_0x591f7b)[_0x2194('0x2d')](function(_0x3d1b08){_0x3c56ba[_0x2194('0x28')]=_0x3d1b08;if(_0x367750[_0x2194('0x3d')][_0x2194('0x4e')]){_0x35b83f['include']=[{'all':!![]}];}return db[_0x2194('0x39')][_0x2194('0x4f')](_0x35b83f);})[_0x2194('0x2d')](function(_0x487269){_0x3c56ba[_0x2194('0x50')]=_0x487269;return _0x3c56ba;})[_0x2194('0x2d')](respondWithFilteredResult(_0x3b53f,_0x35b83f))['catch'](handleError(_0x3b53f,null));};exports['show']=function(_0x3de175,_0x832997){var _0x1f507d={'raw':![],'where':{'id':_0x3de175[_0x2194('0x51')]['id']},'include':[{'model':db[_0x2194('0x35')],'as':_0x2194('0x36')},{'model':db[_0x2194('0x37')],'as':_0x2194('0x38')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x37eeb6={};_0x37eeb6[_0x2194('0x3b')]=_['keys'](db[_0x2194('0x39')][_0x2194('0x3a')]);_0x37eeb6[_0x2194('0x3d')]=_['keys'](_0x3de175[_0x2194('0x3d')]);_0x37eeb6['filters']=_[_0x2194('0x3f')](_0x37eeb6[_0x2194('0x3b')],_0x37eeb6['query']);_0x1f507d[_0x2194('0x40')]=_[_0x2194('0x3f')](_0x37eeb6[_0x2194('0x3b')],qs[_0x2194('0x41')](_0x3de175[_0x2194('0x3d')][_0x2194('0x41')]));_0x1f507d[_0x2194('0x40')]=_0x1f507d[_0x2194('0x40')][_0x2194('0x42')]?_0x1f507d[_0x2194('0x40')]:_0x37eeb6['model'];if(_0x3de175['query'][_0x2194('0x4e')]){_0x1f507d[_0x2194('0x52')]=[{'all':!![]}];}_0x1f507d=_[_0x2194('0x49')]({},_0x1f507d,_0x3de175[_0x2194('0x53')]);return db[_0x2194('0x39')][_0x2194('0x54')](_0x1f507d)['then'](handleEntityNotFound(_0x832997,null))['then'](respondWithResult(_0x832997,null))[_0x2194('0x23')](handleError(_0x832997,null));};exports[_0x2194('0x55')]=function(_0x273557,_0x522182){if(_0x273557[_0x2194('0x56')]['id']){delete _0x273557[_0x2194('0x56')]['id'];}return db[_0x2194('0x39')][_0x2194('0x54')]({'where':{'id':_0x273557[_0x2194('0x51')]['id']},'include':[{'model':db[_0x2194('0x35')],'as':_0x2194('0x36')},{'model':db[_0x2194('0x37')],'as':_0x2194('0x38')},{'model':db[_0x2194('0x57')],'as':_0x2194('0x58')}]})['then'](handleEntityNotFound(_0x522182,null))[_0x2194('0x2d')](saveUpdates(_0x273557[_0x2194('0x56')],null))[_0x2194('0x2d')](function(_0x1dccfe){if(_0x1dccfe&&_0x273557[_0x2194('0x56')][_0x2194('0x36')]){return db['MailServerIn'][_0x2194('0x55')](_0x273557[_0x2194('0x56')][_0x2194('0x36')],{'where':{'MailAccountId':_0x1dccfe['id']}})[_0x2194('0x2d')](function(){return _0x1dccfe;});}return _0x1dccfe;})[_0x2194('0x2d')](function(_0x35afe3){if(_0x35afe3&&_0x273557['body'][_0x2194('0x38')]){return db[_0x2194('0x37')][_0x2194('0x55')](_0x273557[_0x2194('0x56')][_0x2194('0x38')],{'where':{'MailAccountId':_0x35afe3['id']}})[_0x2194('0x2d')](function(){return _0x35afe3;});}return _0x35afe3;})[_0x2194('0x2d')](function(_0x34d5b3){if(_0x34d5b3&&_0x273557[_0x2194('0x56')][_0x2194('0x58')]){return db[_0x2194('0x57')][_0x2194('0x55')](_0x273557[_0x2194('0x56')][_0x2194('0x58')],{'where':{'MailAccountId':_0x34d5b3['id']}})['then'](function(){return _0x34d5b3;});}return _0x34d5b3;})[_0x2194('0x2d')](respondWithResult(_0x522182,null))[_0x2194('0x23')](handleError(_0x522182,null));};exports['describe']=function(_0xe8e245,_0x46950f){return db[_0x2194('0x39')][_0x2194('0x59')]()[_0x2194('0x2d')](respondWithResult(_0x46950f,null))[_0x2194('0x23')](handleError(_0x46950f,null));};exports[_0x2194('0x5a')]=function(_0x127795,_0x4f8f65,_0x2e8a81){if(_0x127795[_0x2194('0x56')]['id']){delete _0x127795[_0x2194('0x56')]['id'];}return db[_0x2194('0x39')][_0x2194('0x54')]({'where':{'id':_0x127795['params']['id']}})['then'](handleEntityNotFound(_0x4f8f65,null))[_0x2194('0x2d')](function(_0x12cfc){if(_0x12cfc){_0x127795['body'][_0x2194('0x5b')]=_0x12cfc['id'];return db[_0x2194('0x5c')][_0x2194('0x5d')](_0x127795['body']);}})[_0x2194('0x2d')](respondWithResult(_0x4f8f65,null))[_0x2194('0x23')](handleError(_0x4f8f65,null));};exports['getDispositions']=function(_0x157cfd,_0x5a3f80,_0x46f8dd){var _0x52a3e8={'raw':![],'where':{}};var _0x49ef59={};var _0x1966fa={'count':0x0,'rows':[]};return db[_0x2194('0x39')][_0x2194('0x5e')]({'where':{'id':_0x157cfd[_0x2194('0x51')]['id']}})[_0x2194('0x2d')](handleEntityNotFound(_0x5a3f80,null))['then'](function(_0xd0865d){if(_0xd0865d){_0x49ef59[_0x2194('0x3b')]=_[_0x2194('0x3c')](db[_0x2194('0x5c')][_0x2194('0x3a')]);_0x49ef59[_0x2194('0x3d')]=_[_0x2194('0x3c')](_0x157cfd['query']);_0x49ef59[_0x2194('0x3e')]=_[_0x2194('0x3f')](_0x49ef59[_0x2194('0x3b')],_0x49ef59[_0x2194('0x3d')]);_0x52a3e8['attributes']=_[_0x2194('0x3f')](_0x49ef59[_0x2194('0x3b')],qs[_0x2194('0x41')](_0x157cfd[_0x2194('0x3d')][_0x2194('0x41')]));_0x52a3e8[_0x2194('0x40')]=_0x52a3e8[_0x2194('0x40')][_0x2194('0x42')]?_0x52a3e8[_0x2194('0x40')]:_0x49ef59[_0x2194('0x3b')];if(!_0x157cfd['query'][_0x2194('0x43')]('nolimit')){_0x52a3e8[_0x2194('0x2a')]=qs[_0x2194('0x2a')](_0x157cfd[_0x2194('0x3d')][_0x2194('0x2a')]);_0x52a3e8[_0x2194('0x29')]=qs[_0x2194('0x29')](_0x157cfd['query']['offset']);}_0x52a3e8['order']=qs[_0x2194('0x45')](_0x157cfd[_0x2194('0x3d')][_0x2194('0x45')]);_0x52a3e8[_0x2194('0x48')]=qs[_0x2194('0x3e')](_[_0x2194('0x46')](_0x157cfd[_0x2194('0x3d')],_0x49ef59[_0x2194('0x3e')]));_0x52a3e8[_0x2194('0x48')][_0x2194('0x5b')]=_0xd0865d['id'];if(_0x157cfd[_0x2194('0x3d')][_0x2194('0x47')]){_0x52a3e8[_0x2194('0x48')]=_[_0x2194('0x49')](_0x52a3e8['where'],{'$or':_['map'](_0x52a3e8[_0x2194('0x40')],function(_0x18c921){var _0x52860b={};_0x52860b[_0x18c921]={'$like':'%'+_0x157cfd[_0x2194('0x3d')][_0x2194('0x47')]+'%'};return _0x52860b;})});}_0x52a3e8=_[_0x2194('0x49')]({},_0x52a3e8,_0x157cfd[_0x2194('0x53')]);return db[_0x2194('0x5c')][_0x2194('0x28')]({'where':_0x52a3e8[_0x2194('0x48')]})['then'](function(_0x10bec5){_0x1966fa[_0x2194('0x28')]=_0x10bec5;if(_0x157cfd['query'][_0x2194('0x4e')]){_0x52a3e8[_0x2194('0x52')]=[{'all':!![]}];}return db[_0x2194('0x5c')][_0x2194('0x4f')](_0x52a3e8);})[_0x2194('0x2d')](function(_0x16f5bc){_0x1966fa[_0x2194('0x50')]=_0x16f5bc;return _0x1966fa;});}})[_0x2194('0x2d')](respondWithFilteredResult(_0x5a3f80,_0x52a3e8))[_0x2194('0x23')](handleError(_0x5a3f80,null));};exports[_0x2194('0x5f')]=function(_0x55185e,_0x2fd8ce,_0x5dd6e4){var _0x1adfe4;return db['MailAccount']['find']({'where':{'id':_0x55185e[_0x2194('0x51')]['id']}})[_0x2194('0x2d')](handleEntityNotFound(_0x2fd8ce,null))[_0x2194('0x2d')](function(_0x2f8f46){if(_0x2f8f46){return _0x2f8f46[_0x2194('0x5f')](_0x55185e[_0x2194('0x3d')][_0x2194('0x60')]);}})[_0x2194('0x2d')](respondWithStatusCode(_0x2fd8ce,null))[_0x2194('0x23')](handleError(_0x2fd8ce,null));};exports['addAnswer']=function(_0x39fe11,_0x3030f2,_0xa1c160){if(_0x39fe11[_0x2194('0x56')]['id']){delete _0x39fe11['body']['id'];}return db[_0x2194('0x39')]['find']({'where':{'id':_0x39fe11['params']['id']}})[_0x2194('0x2d')](handleEntityNotFound(_0x3030f2,null))[_0x2194('0x2d')](function(_0x1b31c1){if(_0x1b31c1){_0x39fe11[_0x2194('0x56')][_0x2194('0x5b')]=_0x1b31c1['id'];return db[_0x2194('0x61')][_0x2194('0x5d')](_0x39fe11[_0x2194('0x56')]);}})[_0x2194('0x2d')](respondWithResult(_0x3030f2,null))[_0x2194('0x23')](handleError(_0x3030f2,null));};exports[_0x2194('0x62')]=function(_0x361171,_0x6ee35e,_0x3848c7){var _0x311488={'raw':![],'where':{}};var _0x29d3c2={};var _0x392fce={'count':0x0,'rows':[]};return db[_0x2194('0x39')][_0x2194('0x5e')]({'where':{'id':_0x361171['params']['id']}})[_0x2194('0x2d')](handleEntityNotFound(_0x6ee35e,null))[_0x2194('0x2d')](function(_0x3f9b0b){if(_0x3f9b0b){_0x29d3c2[_0x2194('0x3b')]=_[_0x2194('0x3c')](db[_0x2194('0x61')][_0x2194('0x3a')]);_0x29d3c2['query']=_['keys'](_0x361171[_0x2194('0x3d')]);_0x29d3c2['filters']=_[_0x2194('0x3f')](_0x29d3c2[_0x2194('0x3b')],_0x29d3c2[_0x2194('0x3d')]);_0x311488[_0x2194('0x40')]=_[_0x2194('0x3f')](_0x29d3c2['model'],qs['fields'](_0x361171[_0x2194('0x3d')][_0x2194('0x41')]));_0x311488[_0x2194('0x40')]=_0x311488[_0x2194('0x40')][_0x2194('0x42')]?_0x311488[_0x2194('0x40')]:_0x29d3c2[_0x2194('0x3b')];if(!_0x361171['query']['hasOwnProperty']('nolimit')){_0x311488[_0x2194('0x2a')]=qs['limit'](_0x361171[_0x2194('0x3d')][_0x2194('0x2a')]);_0x311488[_0x2194('0x29')]=qs[_0x2194('0x29')](_0x361171[_0x2194('0x3d')][_0x2194('0x29')]);}_0x311488[_0x2194('0x44')]=qs[_0x2194('0x45')](_0x361171[_0x2194('0x3d')][_0x2194('0x45')]);_0x311488[_0x2194('0x48')]=qs['filters'](_[_0x2194('0x46')](_0x361171['query'],_0x29d3c2['filters']));_0x311488['where'][_0x2194('0x5b')]=_0x3f9b0b['id'];if(_0x361171['query'][_0x2194('0x47')]){_0x311488['where']=_['merge'](_0x311488[_0x2194('0x48')],{'$or':_[_0x2194('0x4a')](_0x311488[_0x2194('0x40')],function(_0x306b14){var _0x460bd5={};_0x460bd5[_0x306b14]={'$like':'%'+_0x361171[_0x2194('0x3d')]['filter']+'%'};return _0x460bd5;})});}_0x311488=_[_0x2194('0x49')]({},_0x311488,_0x361171[_0x2194('0x53')]);return db[_0x2194('0x61')][_0x2194('0x28')]({'where':_0x311488[_0x2194('0x48')]})[_0x2194('0x2d')](function(_0x4a8793){_0x392fce[_0x2194('0x28')]=_0x4a8793;if(_0x361171['query'][_0x2194('0x4e')]){_0x311488[_0x2194('0x52')]=[{'all':!![]}];}return db['CannedAnswer'][_0x2194('0x4f')](_0x311488);})[_0x2194('0x2d')](function(_0x47118f){_0x392fce[_0x2194('0x50')]=_0x47118f;return _0x392fce;});}})[_0x2194('0x2d')](respondWithFilteredResult(_0x6ee35e,_0x311488))[_0x2194('0x23')](handleError(_0x6ee35e,null));};exports['removeAnswers']=function(_0x4c1553,_0x13b56c,_0x19180b){var _0x2ad336;return db[_0x2194('0x39')][_0x2194('0x54')]({'where':{'id':_0x4c1553[_0x2194('0x51')]['id']}})['then'](handleEntityNotFound(_0x13b56c,null))['then'](function(_0x487cc0){if(_0x487cc0){return _0x487cc0[_0x2194('0x63')](_0x4c1553['query']['ids']);}})['then'](respondWithStatusCode(_0x13b56c,null))['catch'](handleError(_0x13b56c,null));};exports[_0x2194('0x5d')]=function(_0x158874,_0x27ec30){var _0x49a52e={'name':_0x158874[_0x2194('0x56')][_0x2194('0x32')],'key':_0x158874[_0x2194('0x56')][_0x2194('0x64')],'email':_0x158874[_0x2194('0x56')][_0x2194('0x65')],'ListId':_0x158874[_0x2194('0x56')][_0x2194('0x66')],'active':!_[_0x2194('0x67')](_0x158874['body'][_0x2194('0x68')])?_0x158874[_0x2194('0x56')]['active']:!![],'description':_0x158874[_0x2194('0x56')][_0x2194('0x69')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x158874[_0x2194('0x56')][_0x2194('0x6a')])){if(_0x158874[_0x2194('0x56')][_0x2194('0x6b')]){_0x49a52e[_0x2194('0x36')]['user']=_0x49a52e[_0x2194('0x38')][_0x2194('0x6c')]=_0x158874[_0x2194('0x56')][_0x2194('0x6d')];_0x49a52e['Imap'][_0x2194('0x6e')]=_0x49a52e[_0x2194('0x38')][_0x2194('0x6f')]=_0x158874['body'][_0x2194('0x70')];}else{_0x49a52e[_0x2194('0x36')]['authentication']=_0x49a52e[_0x2194('0x38')]['authentication']=![];}_0x49a52e[_0x2194('0x36')][_0x2194('0x71')]=_0x158874[_0x2194('0x56')]['Imap'][_0x2194('0x71')];_0x49a52e['Imap'][_0x2194('0x72')]=_0x158874[_0x2194('0x56')]['Imap'][_0x2194('0x72')];_0x49a52e[_0x2194('0x38')][_0x2194('0x71')]=_0x158874['body'][_0x2194('0x38')][_0x2194('0x71')];_0x49a52e[_0x2194('0x38')]['port']=_0x158874['body']['Smtp'][_0x2194('0x72')];}else{_0x49a52e[_0x2194('0x36')]['service']=_0x49a52e[_0x2194('0x38')][_0x2194('0x73')]=_0x158874[_0x2194('0x56')]['cservice'];_0x49a52e[_0x2194('0x36')][_0x2194('0x6c')]=_0x49a52e[_0x2194('0x38')]['user']=_0x158874[_0x2194('0x56')][_0x2194('0x6d')];_0x49a52e[_0x2194('0x36')][_0x2194('0x6e')]=_0x49a52e[_0x2194('0x38')][_0x2194('0x6f')]=_0x158874[_0x2194('0x56')]['cpassword'];}return db[_0x2194('0x39')][_0x2194('0x5d')](_0x49a52e,{'include':[{'model':db[_0x2194('0x37')],'as':_0x2194('0x38')},{'model':db[_0x2194('0x35')],'as':_0x2194('0x36')}]})[_0x2194('0x2d')](function(_0x29e8c4){var _0x385fbf=_0x158874[_0x2194('0x6c')]['get']({'plain':!![]});if(!_0x385fbf)throw new Error(_0x2194('0x74'));if(_0x385fbf[_0x2194('0x75')]==='user'){var _0x2e9667=_0x29e8c4['get']({'plain':!![]});return db[_0x2194('0x76')][_0x2194('0x54')]({'where':{'name':_0x2194('0x2e'),'userProfileId':_0x385fbf[_0x2194('0x77')]},'raw':!![]})[_0x2194('0x2d')](function(_0x2afeec){if(_0x2afeec&&_0x2afeec['autoAssociation']===0x0){return db[_0x2194('0x2f')][_0x2194('0x5d')]({'name':_0x2e9667[_0x2194('0x32')],'resourceId':_0x2e9667['id'],'type':_0x2afeec['name'],'sectionId':_0x2afeec['id']},{})[_0x2194('0x2d')](function(){return _0x29e8c4;});}else{return _0x29e8c4;}})[_0x2194('0x23')](function(_0x1b74a2){logger[_0x2194('0x1f')](_0x2194('0x78'),_0x1b74a2);throw _0x1b74a2;});}return _0x29e8c4;})['then'](respondWithResult(_0x27ec30,0xc9))[_0x2194('0x23')](handleError(_0x27ec30,null));};exports[_0x2194('0x79')]=function(_0x187939,_0x1aeb80,_0x5d3cbf){return db['MailAccount'][_0x2194('0x5e')]({'where':{'id':_0x187939[_0x2194('0x51')]['id']}})[_0x2194('0x2d')](handleEntityNotFound(_0x1aeb80,null))[_0x2194('0x2d')](function(_0x50c674){if(_0x50c674){return _0x50c674[_0x2194('0x79')]();}return null;})['then'](respondWithResult(_0x1aeb80,null))[_0x2194('0x23')](handleError(_0x1aeb80,null));};exports[_0x2194('0x7a')]=function(_0x3d5c0e,_0x1b895d,_0x40ad1a){if(_0x3d5c0e[_0x2194('0x56')]['id']){delete _0x3d5c0e[_0x2194('0x56')]['id'];}return db[_0x2194('0x39')][_0x2194('0x54')]({'where':{'id':_0x3d5c0e[_0x2194('0x51')]['id']}})['then'](handleEntityNotFound(_0x1b895d,null))[_0x2194('0x2d')](function(_0x1fb057){if(_0x1fb057){_0x3d5c0e[_0x2194('0x56')][_0x2194('0x5b')]=_0x1fb057['id'];return db['MailServerIn'][_0x2194('0x5d')](_0x3d5c0e[_0x2194('0x56')]);}})[_0x2194('0x2d')](respondWithResult(_0x1b895d,null))[_0x2194('0x23')](handleError(_0x1b895d,null));};exports[_0x2194('0x7b')]=function(_0x196af8,_0x2e46a2,_0x5d714c){return db[_0x2194('0x39')][_0x2194('0x5e')]({'where':{'id':_0x196af8[_0x2194('0x51')]['id']}})['then'](handleEntityNotFound(_0x2e46a2,null))[_0x2194('0x2d')](function(_0xd52567){if(_0xd52567){return _0xd52567['setImap'](null);}return null;})[_0x2194('0x2d')](respondWithStatusCode(_0x2e46a2,null))[_0x2194('0x23')](handleError(_0x2e46a2,null));};exports[_0x2194('0x7c')]=function(_0xf2de38,_0x96c7b7,_0x269ff4){return db['MailAccount'][_0x2194('0x5e')]({'where':{'id':_0xf2de38['params']['id']}})['then'](handleEntityNotFound(_0x96c7b7,null))['then'](function(_0x3a894d){if(_0x3a894d){return _0x3a894d[_0x2194('0x7c')]();}return null;})['then'](respondWithResult(_0x96c7b7,null))[_0x2194('0x23')](handleError(_0x96c7b7,null));};exports[_0x2194('0x7d')]=function(_0x424d9f,_0x227cc3,_0x274bed){if(_0x424d9f['body']['id']){delete _0x424d9f[_0x2194('0x56')]['id'];}return db[_0x2194('0x39')]['find']({'where':{'id':_0x424d9f[_0x2194('0x51')]['id']}})['then'](handleEntityNotFound(_0x227cc3,null))['then'](function(_0x58ad75){if(_0x58ad75){_0x424d9f[_0x2194('0x56')]['MailAccountId']=_0x58ad75['id'];return db['MailServerOut'][_0x2194('0x5d')](_0x424d9f[_0x2194('0x56')]);}})[_0x2194('0x2d')](respondWithResult(_0x227cc3,null))[_0x2194('0x23')](handleError(_0x227cc3,null));};exports['removeSmtp']=function(_0x59afd1,_0x2fa054,_0x3d4f0e){return db['MailAccount'][_0x2194('0x5e')]({'where':{'id':_0x59afd1[_0x2194('0x51')]['id']}})[_0x2194('0x2d')](handleEntityNotFound(_0x2fa054,null))['then'](function(_0x3211e1){if(_0x3211e1){return _0x3211e1[_0x2194('0x7e')](null);}return null;})['then'](respondWithStatusCode(_0x2fa054,null))['catch'](handleError(_0x2fa054,null));};exports[_0x2194('0x7f')]=function(_0x43ff17,_0x30e44d,_0xc00e72){return db['MailInteraction'][_0x2194('0x54')]({'where':{'id':_0x43ff17[_0x2194('0x51')]['id']}})[_0x2194('0x2d')](handleEntityNotFound(_0x30e44d,null))[_0x2194('0x2d')](function(_0x1244e7){if(_0x1244e7){return _0x1244e7[_0x2194('0x7f')](_0x43ff17['body'][_0x2194('0x60')],_[_0x2194('0x80')](_0x43ff17[_0x2194('0x56')],[_0x2194('0x60'),'id'])||{});}})[_0x2194('0x2d')](respondWithResult(_0x30e44d,null))[_0x2194('0x23')](handleError(_0x30e44d,null));};exports['getInteractions']=function(_0x18a042,_0x438324,_0x55c0d5){var _0x4a4709={'raw':![],'where':{}};var _0x52e548={};var _0xcb5f8e={'count':0x0,'rows':[]};return db[_0x2194('0x39')][_0x2194('0x5e')]({'where':{'id':_0x18a042[_0x2194('0x51')]['id']}})['then'](handleEntityNotFound(_0x438324,null))[_0x2194('0x2d')](function(_0x9fee26){if(_0x9fee26){_0x52e548[_0x2194('0x3b')]=_[_0x2194('0x3c')](db[_0x2194('0x81')][_0x2194('0x3a')]);_0x52e548[_0x2194('0x3d')]=_[_0x2194('0x3c')](_0x18a042[_0x2194('0x3d')]);_0x52e548['filters']=_[_0x2194('0x3f')](_0x52e548[_0x2194('0x3b')],_0x52e548['query']);_0x4a4709[_0x2194('0x40')]=_[_0x2194('0x3f')](_0x52e548[_0x2194('0x3b')],qs['fields'](_0x18a042[_0x2194('0x3d')]['fields']));_0x4a4709[_0x2194('0x40')]=_0x4a4709['attributes'][_0x2194('0x42')]?_0x4a4709[_0x2194('0x40')]:_0x52e548[_0x2194('0x3b')];if(!_0x18a042['query'][_0x2194('0x43')](_0x2194('0x82'))){_0x4a4709[_0x2194('0x2a')]=qs['limit'](_0x18a042['query'][_0x2194('0x2a')]);_0x4a4709[_0x2194('0x29')]=qs[_0x2194('0x29')](_0x18a042[_0x2194('0x3d')][_0x2194('0x29')]);}_0x4a4709['order']=qs[_0x2194('0x45')](_0x18a042[_0x2194('0x3d')]['sort']);_0x4a4709['where']=qs[_0x2194('0x3e')](_[_0x2194('0x46')](_0x18a042[_0x2194('0x3d')],_0x52e548['filters']));_0x4a4709[_0x2194('0x48')][_0x2194('0x5b')]=_0x9fee26['id'];if(_0x18a042[_0x2194('0x3d')][_0x2194('0x47')]){_0x4a4709[_0x2194('0x48')]=_['merge'](_0x4a4709[_0x2194('0x48')],{'$or':_[_0x2194('0x4a')](_0x4a4709[_0x2194('0x40')],function(_0x1b940a){var _0xb2fd8a={};_0xb2fd8a[_0x1b940a]={'$like':'%'+_0x18a042[_0x2194('0x3d')][_0x2194('0x47')]+'%'};return _0xb2fd8a;})});}_0x4a4709=_[_0x2194('0x49')]({},_0x4a4709,_0x18a042['options']);return db[_0x2194('0x81')]['count']({'where':_0x4a4709[_0x2194('0x48')]})[_0x2194('0x2d')](function(_0x44b16a){_0xcb5f8e[_0x2194('0x28')]=_0x44b16a;if(_0x18a042['query'][_0x2194('0x4e')]){_0x4a4709[_0x2194('0x52')]=[{'model':db[_0x2194('0x83')],'as':'Contact','required':![]},{'model':db[_0x2194('0x84')],'as':_0x2194('0x85'),'attributes':[_0x2194('0x32'),_0x2194('0x86'),_0x2194('0x87')],'required':![]},{'model':db[_0x2194('0x88')],'as':_0x2194('0x89'),'attributes':['id','name',_0x2194('0x8a')],'where':_0x18a042[_0x2194('0x3d')][_0x2194('0x8b')]?{'id':_0x18a042[_0x2194('0x3d')][_0x2194('0x8b')]}:undefined,'required':_0x18a042['query'][_0x2194('0x8b')]?!![]:![]}];}return db[_0x2194('0x81')][_0x2194('0x4f')](_0x4a4709);})[_0x2194('0x2d')](function(_0xcbc2dc){_0xcb5f8e[_0x2194('0x50')]=_0xcbc2dc;return _0xcb5f8e;});}})[_0x2194('0x2d')](respondWithFilteredResult(_0x438324,_0x4a4709))[_0x2194('0x23')](handleError(_0x438324,null));};exports[_0x2194('0x8c')]=function(_0x264ab0,_0x4181ea,_0x5e2b31){return db['MailAccount'][_0x2194('0x5e')]({'where':{'id':_0x264ab0[_0x2194('0x51')]['id']}})[_0x2194('0x2d')](handleEntityNotFound(_0x4181ea,null))[_0x2194('0x2d')](function(_0x419399){if(_0x419399){return db['sequelize'][_0x2194('0x8d')](function(_0x5f02fa){return db[_0x2194('0x8e')]['destroy']({'where':{'MailAccountId':_0x264ab0[_0x2194('0x51')]['id']},'transaction':_0x5f02fa})[_0x2194('0x2d')](function(_0x89aa39){var _0x387f5e=_[_0x2194('0x4a')](_0x264ab0[_0x2194('0x56')],function(_0x17626f){_0x17626f['MailAccountId']=_0x264ab0[_0x2194('0x51')]['id'];return _0x17626f;});return db[_0x2194('0x8e')]['bulkCreate'](_0x387f5e,{'transaction':_0x5f02fa});});})[_0x2194('0x2d')](function(){return db['MailApplication'][_0x2194('0x8f')]({'where':{'MailAccountId':_0x264ab0[_0x2194('0x51')]['id']},'order':_0x2194('0x90')});});}})[_0x2194('0x2d')](respondWithResult(_0x4181ea,null))['catch'](handleError(_0x4181ea,null));};exports[_0x2194('0x91')]=function(_0x3f0f61,_0x209708,_0x5972c9){var _0x17a020={};var _0x172475={};var _0x44e570;var _0x362cbf;return db[_0x2194('0x39')]['findOne']({'where':{'id':_0x3f0f61[_0x2194('0x51')]['id']}})[_0x2194('0x2d')](handleEntityNotFound(_0x209708,null))[_0x2194('0x2d')](function(_0x22792e){if(_0x22792e){_0x44e570=_0x22792e;_0x172475[_0x2194('0x3b')]=_[_0x2194('0x3c')](db[_0x2194('0x8e')][_0x2194('0x3a')]);_0x172475[_0x2194('0x3d')]=_[_0x2194('0x3c')](_0x3f0f61[_0x2194('0x3d')]);_0x172475[_0x2194('0x3e')]=_['intersection'](_0x172475['model'],_0x172475[_0x2194('0x3d')]);_0x17a020[_0x2194('0x40')]=_[_0x2194('0x3f')](_0x172475[_0x2194('0x3b')],qs[_0x2194('0x41')](_0x3f0f61['query'][_0x2194('0x41')]));_0x17a020[_0x2194('0x40')]=_0x17a020[_0x2194('0x40')][_0x2194('0x42')]?_0x17a020['attributes']:_0x172475[_0x2194('0x3b')];_0x17a020[_0x2194('0x44')]=qs[_0x2194('0x45')](_0x3f0f61[_0x2194('0x3d')][_0x2194('0x45')]);_0x17a020['where']=qs[_0x2194('0x3e')](_[_0x2194('0x46')](_0x3f0f61[_0x2194('0x3d')],_0x172475[_0x2194('0x3e')]));if(_0x3f0f61[_0x2194('0x3d')][_0x2194('0x47')]){_0x17a020[_0x2194('0x48')]=_[_0x2194('0x49')](_0x17a020[_0x2194('0x48')],{'$or':_[_0x2194('0x4a')](_0x17a020['attributes'],function(_0x262907){var _0x119c83={};_0x119c83[_0x262907]={'$like':'%'+_0x3f0f61[_0x2194('0x3d')][_0x2194('0x47')]+'%'};return _0x119c83;})});}_0x17a020=_[_0x2194('0x49')]({},_0x17a020,_0x3f0f61[_0x2194('0x53')]);return _0x44e570['getApplications'](_0x17a020);}})[_0x2194('0x2d')](function(_0x8f7451){if(_0x8f7451){_0x362cbf=_0x8f7451[_0x2194('0x42')];if(!_0x3f0f61[_0x2194('0x3d')]['hasOwnProperty'](_0x2194('0x82'))){_0x17a020[_0x2194('0x2a')]=qs[_0x2194('0x2a')](_0x3f0f61[_0x2194('0x3d')][_0x2194('0x2a')]);_0x17a020['offset']=qs['offset'](_0x3f0f61[_0x2194('0x3d')][_0x2194('0x29')]);}return _0x44e570[_0x2194('0x91')](_0x17a020);}})[_0x2194('0x2d')](function(_0x231c40){if(_0x231c40){return _0x231c40?{'count':_0x362cbf,'rows':_0x231c40}:null;}})[_0x2194('0x2d')](respondWithResult(_0x209708,null))[_0x2194('0x23')](handleError(_0x209708,null));};exports[_0x2194('0x92')]=function(_0x239bcd,_0x36cb8a,_0x13fdcf){var _0x24c550={'raw':!![],'where':{}};var _0x209f20={};var _0x3449db={'count':0x0,'rows':[]};return db['MailAccount'][_0x2194('0x5e')]({'where':{'id':_0x239bcd[_0x2194('0x51')]['id']}})[_0x2194('0x2d')](handleEntityNotFound(_0x36cb8a,null))[_0x2194('0x2d')](function(_0x397169){if(_0x397169){_0x209f20[_0x2194('0x3b')]=_['keys'](db[_0x2194('0x93')][_0x2194('0x3a')]);_0x209f20[_0x2194('0x3d')]=_['keys'](_0x239bcd[_0x2194('0x3d')]);_0x209f20[_0x2194('0x3e')]=_['intersection'](_0x209f20[_0x2194('0x3b')],_0x209f20[_0x2194('0x3d')]);_0x24c550[_0x2194('0x40')]=_['intersection'](_0x209f20[_0x2194('0x3b')],qs[_0x2194('0x41')](_0x239bcd[_0x2194('0x3d')][_0x2194('0x41')]));_0x24c550[_0x2194('0x40')]=_0x24c550[_0x2194('0x40')][_0x2194('0x42')]?_0x24c550[_0x2194('0x40')]:_0x209f20['model'];if(!_0x239bcd[_0x2194('0x3d')][_0x2194('0x43')](_0x2194('0x82'))){_0x24c550[_0x2194('0x2a')]=qs[_0x2194('0x2a')](_0x239bcd[_0x2194('0x3d')]['limit']);_0x24c550[_0x2194('0x29')]=qs['offset'](_0x239bcd[_0x2194('0x3d')]['offset']);}_0x24c550[_0x2194('0x44')]=qs[_0x2194('0x45')](_0x239bcd[_0x2194('0x3d')][_0x2194('0x45')]);_0x24c550['where']=qs[_0x2194('0x3e')](_[_0x2194('0x46')](_0x239bcd[_0x2194('0x3d')],_0x209f20[_0x2194('0x3e')]));_0x24c550[_0x2194('0x48')]['MailAccountId']=_0x397169['id'];if(_0x239bcd[_0x2194('0x3d')]['filter']){_0x24c550['where']=_['merge'](_0x24c550[_0x2194('0x48')],{'$or':_[_0x2194('0x4a')](_0x24c550['attributes'],function(_0x174f37){var _0x3c2e2f={};_0x3c2e2f[_0x174f37]={'$like':'%'+_0x239bcd[_0x2194('0x3d')][_0x2194('0x47')]+'%'};return _0x3c2e2f;})});}if(_0x239bcd[_0x2194('0x3d')][_0x2194('0x94')]){var _0x4b70b3=_0x239bcd[_0x2194('0x3d')][_0x2194('0x94')][_0x2194('0x95')](',');var _0x459d5b={};_0x459d5b[_0x4b70b3[0x0]]={'$gte':moment(_0x4b70b3[0x1])[_0x2194('0x96')](_0x2194('0x97'))};_0x24c550[_0x2194('0x48')]=_['merge'](_0x24c550['where'],_0x459d5b);}_0x24c550=_[_0x2194('0x49')]({},_0x24c550,_0x239bcd['options']);return db[_0x2194('0x93')][_0x2194('0x28')]({'where':_0x24c550[_0x2194('0x48')]})[_0x2194('0x2d')](function(_0x2dd86e){_0x3449db[_0x2194('0x28')]=_0x2dd86e;if(_0x239bcd['query'][_0x2194('0x4e')]){_0x24c550[_0x2194('0x52')]=[{'all':!![]}];}return db[_0x2194('0x93')][_0x2194('0x4f')](_0x24c550);})[_0x2194('0x2d')](function(_0xe93f15){_0x3449db[_0x2194('0x50')]=_0xe93f15;return _0x3449db;});}})[_0x2194('0x2d')](respondWithFilteredResult(_0x36cb8a,_0x24c550))[_0x2194('0x23')](handleError(_0x36cb8a,null));};exports[_0x2194('0x33')]=function(_0x231925,_0x21deb6,_0x576eab){var _0x39e65e,_0xa3b10b={},_0x1b1c75;if(_0x231925[_0x2194('0x56')]['to']){_0x1b1c75=_0x231925[_0x2194('0x56')]['to'][_0x2194('0x95')](',')[0x0];}return db[_0x2194('0x39')][_0x2194('0x54')]({'where':{'id':_0x231925[_0x2194('0x51')]['id']},'include':[{'model':db['CmList'],'as':_0x2194('0x98'),'include':[{'model':db['CmContact'],'as':_0x2194('0x99'),'where':{'email':_0x1b1c75},'limit':0x1,'order':[[_0x2194('0x9a'),_0x2194('0x9b')]]}]},{'model':db['MailServerOut'],'as':_0x2194('0x38'),'raw':!![]}]})[_0x2194('0x2d')](handleEntityNotFound(_0x21deb6,null))[_0x2194('0x2d')](function(_0x3de9f5){if(_0x3de9f5){_0x39e65e=_0x3de9f5;if(_0x3de9f5['Smtp']){if(_['isNil'](_0x231925[_0x2194('0x56')][_0x2194('0x9c')])){_0x231925[_0x2194('0x56')][_0x2194('0x9c')]=util[_0x2194('0x96')]('%s\x20<%s>',_0x3de9f5[_0x2194('0x32')],_0x3de9f5['email']||_0x3de9f5[_0x2194('0x38')][_0x2194('0x6c')]);}if(_0x231925[_0x2194('0x56')]['attachments']&&_0x231925[_0x2194('0x56')][_0x2194('0x9d')][_0x2194('0x42')]){for(var _0x281ac4=0x0;_0x281ac4<_0x231925[_0x2194('0x56')][_0x2194('0x9d')][_0x2194('0x42')];_0x281ac4+=0x1){_0x231925['body']['attachments'][_0x281ac4]={'filename':_0x231925['body']['attachments'][_0x281ac4][_0x2194('0x32')],'path':path['join'](config['root'],_0x2194('0x9e'),_0x231925[_0x2194('0x56')][_0x2194('0x9d')][_0x281ac4][_0x2194('0x9f')])};}}var _0x380cf8={'tls':{'rejectUnauthorized':![]}};if(_[_0x2194('0x67')](_0x3de9f5[_0x2194('0x38')]['service'])){if(_0x3de9f5[_0x2194('0x38')][_0x2194('0xa0')]){_0x380cf8[_0x2194('0xa1')]={'user':_0x3de9f5[_0x2194('0x38')][_0x2194('0x6c')],'pass':_0x3de9f5['Smtp']['pass']};}_0x380cf8[_0x2194('0x71')]=_0x3de9f5[_0x2194('0x38')][_0x2194('0x71')];_0x380cf8['port']=_0x3de9f5['Smtp'][_0x2194('0x72')];_0x380cf8[_0x2194('0xa2')]=_0x3de9f5[_0x2194('0x38')][_0x2194('0xa2')];}else{_0x380cf8[_0x2194('0x73')]=_0x3de9f5['Smtp'][_0x2194('0x73')];_0x380cf8[_0x2194('0xa1')]={'user':_0x3de9f5[_0x2194('0x38')][_0x2194('0x6c')],'pass':_0x3de9f5[_0x2194('0x38')][_0x2194('0x6f')]};}return respondWithRpcPromise(_0x2194('0xa3'),'sendMail',{'account':_0x380cf8,'message':_0x231925[_0x2194('0x56')]});}else{throw new Error(_0x2194('0xa4'));}}})[_0x2194('0x2d')](function(_0x5a8f3e){if(_0x5a8f3e){_0xa3b10b=_0x5a8f3e;if(_0x39e65e['List']){if(_0x39e65e[_0x2194('0x98')]['Contacts']['length']){return _0x39e65e[_0x2194('0x98')][_0x2194('0x99')][0x0];}else{return db[_0x2194('0x83')][_0x2194('0x5d')](_[_0x2194('0x12')](_0x231925['body'],{'firstName':_0x231925[_0x2194('0x56')]['to'],'email':_0x231925['body']['to'],'phone':_0x231925[_0x2194('0x56')]['to'],'ListId':_0x39e65e['ListId']}));}}else{throw new Error(_0x2194('0xa4'));}}})[_0x2194('0x2d')](function(_0x1ce53d){if(_0x1ce53d){var _0xbd9ca0={'UserId':_0x231925[_0x2194('0x6c')]['id'],'ContactId':_0x1ce53d['id'],'MailAccountId':_0x39e65e['id'],'inReplyTo':_0xa3b10b[_0x2194('0xa5')],'to':_0x231925[_0x2194('0x56')][_0x2194('0x9c')],'cc':_0x231925['body']['cc'],'subject':_0x231925[_0x2194('0x56')]['subject'],'attach':_0x231925[_0x2194('0x56')][_0x2194('0xa6')],'firstMsgDirection':_0x2194('0xa7'),'lastMsgAt':moment()[_0x2194('0x96')](_0x2194('0x97')),'lastMsgDirection':_0x2194('0xa7'),'lastMsgBody':_0x231925['body'][_0x2194('0x56')],'Messages':[_[_0x2194('0x49')](_0x231925[_0x2194('0x56')],{'messageId':_0xa3b10b[_0x2194('0xa5')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x39e65e['id'],'UserId':_0x231925[_0x2194('0x6c')]['id'],'ContactId':_0x1ce53d['id']})]};if(_0x231925['body'][_0x2194('0xa8')]){_0xbd9ca0=_[_0x2194('0x49')](_0xbd9ca0,_0x231925[_0x2194('0x56')][_0x2194('0xa8')]);}return db[_0x2194('0x81')][_0x2194('0x5d')](_0xbd9ca0,{'include':[{'model':db['MailMessage'],'as':_0x2194('0xa9')}]});}})[_0x2194('0x2d')](respondWithResult(_0x21deb6,null))[_0x2194('0x23')](handleError(_0x21deb6,null));};exports['verifySmtp']=function(_0x17c891,_0x3ab0d7,_0x4c6908){return db['MailAccount'][_0x2194('0x54')]({'where':{'id':_0x17c891[_0x2194('0x51')]['id']},'include':[{'model':db[_0x2194('0x37')],'as':_0x2194('0x38'),'raw':!![]}]})[_0x2194('0x2d')](handleEntityNotFound(_0x3ab0d7,null))['then'](function(_0x1d2296){if(_0x1d2296&&_0x1d2296['Smtp']){var _0x1813a5={'id':_0x1d2296['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1d2296['Smtp'][_0x2194('0x73')]){_0x1813a5[_0x2194('0x73')]=_0x1d2296[_0x2194('0x38')][_0x2194('0x73')];}else{_0x1813a5['host']=_0x1d2296[_0x2194('0x38')][_0x2194('0x71')];_0x1813a5[_0x2194('0x72')]=_0x1d2296[_0x2194('0x38')][_0x2194('0x72')];_0x1813a5[_0x2194('0xa2')]=_0x1d2296[_0x2194('0x38')][_0x2194('0xa2')];}if(_0x1d2296['Smtp'][_0x2194('0xa0')]){_0x1813a5['auth']={'user':_0x1d2296['Smtp']['user'],'pass':_0x1d2296[_0x2194('0x38')][_0x2194('0x6f')]};}return respondWithRpcPromise(_0x2194('0xaa'),_0x2194('0xab'),{'account':_0x1813a5});}})[_0x2194('0x2d')](respondWithResult(_0x3ab0d7,null))['catch'](handleError(_0x3ab0d7,null));};exports[_0x2194('0x30')]=function(_0x508251,_0x300c98){return db[_0x2194('0x39')][_0x2194('0x54')]({'where':{'id':_0x508251['params']['id']}})[_0x2194('0x2d')](handleEntityNotFound(_0x300c98,null))[_0x2194('0x2d')](function(_0x5c5522){if(_0x5c5522&&_0x5c5522[_0x2194('0x73')]){throw new db[(_0x2194('0xac'))][(_0x2194('0xad'))](_0x2194('0xae'));}return _0x5c5522;})[_0x2194('0x2d')](removeEntity(_0x300c98,null))[_0x2194('0x23')](handleError(_0x300c98,null));};exports['addAgents']=function(_0x3d8473,_0x49c6b8,_0x16a5a1){return db['MailAccount'][_0x2194('0x54')]({'where':{'id':_0x3d8473[_0x2194('0x51')]['id']}})[_0x2194('0x2d')](handleEntityNotFound(_0x49c6b8,null))[_0x2194('0x2d')](function(_0x525c07){if(_0x525c07){return _0x525c07[_0x2194('0xaf')](_0x3d8473['body'][_0x2194('0x60')],_[_0x2194('0x80')](_0x3d8473[_0x2194('0x56')],[_0x2194('0x60'),'id'])||{})[_0x2194('0xb0')](function(_0x118da6){for(var _0x551f8e=0x0;_0x551f8e<_0x3d8473[_0x2194('0x56')][_0x2194('0x60')][_0x2194('0x42')];_0x551f8e+=0x1){socket[_0x2194('0xb1')](_0x2194('0xb2'),{'UserId':_0x3d8473[_0x2194('0x56')][_0x2194('0x60')][_0x551f8e],'MailAccountId':_0x3d8473[_0x2194('0x51')]['id']});}return _0x118da6;});}})[_0x2194('0x2d')](respondWithResult(_0x49c6b8,null))['catch'](handleError(_0x49c6b8,null));};exports[_0x2194('0xb3')]=function(_0x429c0a,_0x109dc7,_0x2da4fc){var _0xef2de2;return db[_0x2194('0x39')]['find']({'where':{'id':_0x429c0a[_0x2194('0x51')]['id']}})[_0x2194('0x2d')](handleEntityNotFound(_0x109dc7,null))[_0x2194('0x2d')](function(_0x4ac685){if(_0x4ac685){return _0x4ac685['removeAgents'](_0x429c0a[_0x2194('0x3d')]['ids'])[_0x2194('0x2d')](function(_0x1a1d6e){if(_[_0x2194('0xb4')](_0x429c0a[_0x2194('0x3d')][_0x2194('0x60')])){for(var _0x278b59=0x0;_0x278b59<_0x429c0a[_0x2194('0x3d')][_0x2194('0x60')][_0x2194('0x42')];_0x278b59+=0x1){socket[_0x2194('0xb1')]('userMailAccount:remove',{'UserId':_0x429c0a[_0x2194('0x3d')][_0x2194('0x60')][_0x278b59],'MailAccountId':_0x429c0a[_0x2194('0x51')]['id']});}}else{socket[_0x2194('0xb1')](_0x2194('0xb5'),{'UserId':_0x429c0a['query']['ids'],'MailAccountId':_0x429c0a[_0x2194('0x51')]['id']});}});}})['then'](respondWithStatusCode(_0x109dc7,null))[_0x2194('0x23')](handleError(_0x109dc7,null));};exports[_0x2194('0xb6')]=function(_0x468099,_0x3004a9,_0x5699d2){var _0x5b668e={};var _0x643fc9={};var _0x23e08f;var _0x3705e5;return db[_0x2194('0x39')][_0x2194('0x5e')]({'where':{'id':_0x468099[_0x2194('0x51')]['id']}})[_0x2194('0x2d')](handleEntityNotFound(_0x3004a9,null))['then'](function(_0x185147){if(_0x185147){_0x23e08f=_0x185147;_0x643fc9[_0x2194('0x3b')]=_[_0x2194('0x3c')](db['User'][_0x2194('0x3a')]);_0x643fc9['query']=_[_0x2194('0x3c')](_0x468099[_0x2194('0x3d')]);_0x643fc9[_0x2194('0x3e')]=_[_0x2194('0x3f')](_0x643fc9[_0x2194('0x3b')],_0x643fc9['query']);_0x5b668e[_0x2194('0x40')]=_[_0x2194('0x3f')](_0x643fc9['model'],qs[_0x2194('0x41')](_0x468099[_0x2194('0x3d')]['fields']));_0x5b668e['attributes']=_0x5b668e[_0x2194('0x40')]['length']?_0x5b668e[_0x2194('0x40')]:_0x643fc9['model'];_0x5b668e[_0x2194('0x44')]=qs['sort'](_0x468099['query'][_0x2194('0x45')]);_0x5b668e[_0x2194('0x48')]=qs[_0x2194('0x3e')](_['pick'](_0x468099[_0x2194('0x3d')],_0x643fc9['filters']));if(_0x468099[_0x2194('0x3d')][_0x2194('0x47')]){_0x5b668e['where']=_[_0x2194('0x49')](_0x5b668e[_0x2194('0x48')],{'$or':_[_0x2194('0x4a')](_0x5b668e[_0x2194('0x40')],function(_0x2cb027){var _0x358c86={};_0x358c86[_0x2cb027]={'$like':'%'+_0x468099[_0x2194('0x3d')][_0x2194('0x47')]+'%'};return _0x358c86;})});}_0x5b668e=_[_0x2194('0x49')]({},_0x5b668e,_0x468099[_0x2194('0x53')]);return _0x23e08f[_0x2194('0xb6')](_0x5b668e);}})[_0x2194('0x2d')](function(_0x2d13f2){if(_0x2d13f2){_0x3705e5=_0x2d13f2[_0x2194('0x42')];if(!_0x468099[_0x2194('0x3d')][_0x2194('0x43')](_0x2194('0x82'))){_0x5b668e[_0x2194('0x2a')]=qs[_0x2194('0x2a')](_0x468099[_0x2194('0x3d')][_0x2194('0x2a')]);_0x5b668e['offset']=qs[_0x2194('0x29')](_0x468099[_0x2194('0x3d')][_0x2194('0x29')]);}return _0x23e08f[_0x2194('0xb6')](_0x5b668e);}})[_0x2194('0x2d')](function(_0x28f7ac){if(_0x28f7ac){return _0x28f7ac?{'count':_0x3705e5,'rows':_0x28f7ac}:null;}})[_0x2194('0x2d')](respondWithResult(_0x3004a9,null))[_0x2194('0x23')](handleError(_0x3004a9,null));};
\ No newline at end of file
index a64e511..51a26e4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf4d5=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xf4d5,0x138));var _0x5f4d=function(_0x22a1b0,_0x235470){_0x22a1b0=_0x22a1b0-0x0;var _0x99019e=_0xf4d5[_0x22a1b0];return _0x99019e;};'use strict';var EventEmitter=require(_0x5f4d('0x0'));var MailAccount=require(_0x5f4d('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x5f4d('0x2')](0x0);var events={'afterCreate':_0x5f4d('0x3'),'afterUpdate':_0x5f4d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x94a577){return function(_0x1709d5,_0xa53f1e,_0x43d7a7){MailAccountEvents['emit'](_0x94a577+':'+_0x1709d5['id'],_0x1709d5);MailAccountEvents[_0x5f4d('0x5')](_0x94a577,_0x1709d5);_0x43d7a7(null);};}for(var e in events){if(events[_0x5f4d('0x6')](e)){var event=events[e];MailAccount[_0x5f4d('0x7')](e,emitEvent(event));}}module[_0x5f4d('0x8')]=MailAccountEvents;
\ No newline at end of file
+var _0x3dad=['exports','../../mysqldb','MailAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x5a7dd3,_0x26b7cf){var _0x2f4d07=function(_0x280510){while(--_0x280510){_0x5a7dd3['push'](_0x5a7dd3['shift']());}};_0x2f4d07(++_0x26b7cf);}(_0x3dad,0x17b));var _0xd3da=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x3dad[_0x502c7d];return _0x30b7ed;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0xd3da('0x0'))['db'][_0xd3da('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xd3da('0x2')](0x0);var events={'afterCreate':_0xd3da('0x3'),'afterUpdate':'update','afterDestroy':_0xd3da('0x4')};function emitEvent(_0x4b33da){return function(_0x5b1df4,_0x164c0a,_0x19f7f9){MailAccountEvents[_0xd3da('0x5')](_0x4b33da+':'+_0x5b1df4['id'],_0x5b1df4);MailAccountEvents[_0xd3da('0x5')](_0x4b33da,_0x5b1df4);_0x19f7f9(null);};}for(var e in events){if(events[_0xd3da('0x6')](e)){var event=events[e];MailAccount[_0xd3da('0x7')](e,emitEvent(event));}}module[_0xd3da('0x8')]=MailAccountEvents;
\ No newline at end of file
index 5fd5da0..105665d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x43ce=['moment','exports','mail_accounts','lodash','../../config/logger','api'];(function(_0x2beeb9,_0x415c85){var _0x3f7f25=function(_0x1890d1){while(--_0x1890d1){_0x2beeb9['push'](_0x2beeb9['shift']());}};_0x3f7f25(++_0x415c85);}(_0x43ce,0x117));var _0xe43c=function(_0x2e2053,_0x5794d3){_0x2e2053=_0x2e2053-0x0;var _0x2fbc78=_0x43ce[_0x2e2053];return _0x2fbc78;};'use strict';var _=require(_0xe43c('0x0'));var util=require('util');var logger=require(_0xe43c('0x1'))(_0xe43c('0x2'));var moment=require(_0xe43c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./mailAccount.attributes');module[_0xe43c('0x4')]=function(_0x221d40,_0x29053d){return _0x221d40['define']('MailAccount',attributes,{'tableName':_0xe43c('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x8946=['define','MailAccount','lodash','api','moment','bluebird','request-promise','./mailAccount.attributes'];(function(_0x1a00c0,_0x3a8c77){var _0x2fd2db=function(_0x5ec45f){while(--_0x5ec45f){_0x1a00c0['push'](_0x1a00c0['shift']());}};_0x2fd2db(++_0x3a8c77);}(_0x8946,0x92));var _0x6894=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x8946[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x6894('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6894('0x1'));var moment=require(_0x6894('0x2'));var BPromise=require(_0x6894('0x3'));var rp=require(_0x6894('0x4'));var attributes=require(_0x6894('0x5'));module['exports']=function(_0x1380ec,_0x10abdb){return _0x1380ec[_0x6894('0x6')](_0x6894('0x7'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index c7db32b..3cf1b7e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x38ec=['limit','map','include','model','ShowMailAccount','find','debug','body','difference','keys','createdAt','ListId','from','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','Contacts','updatedAt','DESC','Applications','MailServerOut','Smtp','omit','applications','list','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','CmContact','create','List\x20not\x20found','contact','messageId','generate','subject','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','spread','attach','format','interaction','get','created','attachments','originCc','bcc','Attachments','UserId','unshift','agent','startRouting','Start','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','options','raw','where','attributes'];(function(_0x19e800,_0x1d7cb0){var _0xd20191=function(_0x2d457f){while(--_0x2d457f){_0x19e800['push'](_0x19e800['shift']());}};_0xd20191(++_0x1d7cb0);}(_0x38ec,0x160));var _0xc38e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x38ec[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xc38e('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc38e('0x1'));var fs=require('fs');var Redis=require(_0xc38e('0x2'));var db=require(_0xc38e('0x3'))['db'];var utils=require(_0xc38e('0x4'));var logger=require('../../config/logger')(_0xc38e('0x5'));var config=require('../../config/environment');var jayson=require(_0xc38e('0x6'));var client=jayson[_0xc38e('0x7')][_0xc38e('0x8')]({'port':0x232c});config[_0xc38e('0x9')]=_['defaults'](config[_0xc38e('0x9')],{'host':_0xc38e('0xa'),'port':0x18eb});var socket=require(_0xc38e('0xb'))(new Redis(config[_0xc38e('0x9')]));require(_0xc38e('0xc'))[_0xc38e('0xd')](socket);function respondWithRpcPromise(_0x59c67f,_0x225916,_0x589411){return new BPromise(function(_0x245c28,_0x5bb7d0){return client[_0xc38e('0xe')](_0x59c67f,_0x589411)[_0xc38e('0xf')](function(_0x4c1e80){logger[_0xc38e('0x10')](_0xc38e('0x11'),_0x225916,'request\x20sent');logger['debug'](_0xc38e('0x12'),_0x225916,_0xc38e('0x13'),JSON[_0xc38e('0x14')](_0x4c1e80));if(_0x4c1e80['error']){if(_0x4c1e80[_0xc38e('0x15')][_0xc38e('0x16')]===0x1f4){logger[_0xc38e('0x15')](_0xc38e('0x11'),_0x225916,_0x4c1e80[_0xc38e('0x15')][_0xc38e('0x17')]);return _0x5bb7d0(_0x4c1e80[_0xc38e('0x15')][_0xc38e('0x17')]);}logger[_0xc38e('0x15')](_0xc38e('0x11'),_0x225916,_0x4c1e80['error'][_0xc38e('0x17')]);return _0x245c28(_0x4c1e80[_0xc38e('0x15')][_0xc38e('0x17')]);}else{logger['info'](_0xc38e('0x11'),_0x225916,_0xc38e('0x13'));_0x245c28(_0x4c1e80[_0xc38e('0x18')][_0xc38e('0x17')]);}})[_0xc38e('0x19')](function(_0x12fad2){logger[_0xc38e('0x15')](_0xc38e('0x11'),_0x225916,_0x12fad2);_0x5bb7d0(_0x12fad2);});});}exports[_0xc38e('0x1a')]=function(_0x1f079f){var _0x5a1c59=this;return new Promise(function(_0x46c3b9,_0x1a45a6){return db[_0xc38e('0x1b')]['findAll']({'raw':_0x1f079f[_0xc38e('0x1c')]?_0x1f079f[_0xc38e('0x1c')][_0xc38e('0x1d')]===undefined?!![]:![]:!![],'where':_0x1f079f[_0xc38e('0x1c')]?_0x1f079f['options'][_0xc38e('0x1e')]||null:null,'attributes':_0x1f079f['options']?_0x1f079f[_0xc38e('0x1c')][_0xc38e('0x1f')]||null:null,'limit':_0x1f079f['options']?_0x1f079f[_0xc38e('0x1c')][_0xc38e('0x20')]||null:null,'include':_0x1f079f[_0xc38e('0x1c')]?_0x1f079f[_0xc38e('0x1c')]['include']?_[_0xc38e('0x21')](_0x1f079f[_0xc38e('0x1c')][_0xc38e('0x22')],function(_0x5b91a7){return{'model':db[_0x5b91a7[_0xc38e('0x23')]],'as':_0x5b91a7['as'],'attributes':_0x5b91a7['attributes'],'include':_0x5b91a7[_0xc38e('0x22')]?_[_0xc38e('0x21')](_0x5b91a7[_0xc38e('0x22')],function(_0x2f6c7d){return{'model':db[_0x2f6c7d[_0xc38e('0x23')]],'as':_0x2f6c7d['as'],'attributes':_0x2f6c7d[_0xc38e('0x1f')],'include':_0x2f6c7d[_0xc38e('0x22')]?_['map'](_0x2f6c7d[_0xc38e('0x22')],function(_0x1e9488){return{'model':db[_0x1e9488[_0xc38e('0x23')]],'as':_0x1e9488['as'],'attributes':_0x1e9488[_0xc38e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc38e('0xf')](function(_0x1c1d64){logger[_0xc38e('0x10')](_0xc38e('0x1a'),_0x1f079f);logger['debug'](_0xc38e('0x1a'),_0x1f079f,JSON['stringify'](_0x1c1d64));_0x46c3b9(_0x1c1d64);})['catch'](function(_0x5ab039){logger[_0xc38e('0x15')](_0xc38e('0x1a'),_0x5ab039[_0xc38e('0x17')],_0x1f079f);_0x1a45a6(_0x5a1c59['error'](0x1f4,_0x5ab039[_0xc38e('0x17')]));});});};exports[_0xc38e('0x24')]=function(_0x321300){var _0x57f036=this;return new Promise(function(_0x432992,_0x5abbb1){return db[_0xc38e('0x1b')][_0xc38e('0x25')]({'raw':_0x321300['options']?_0x321300['options'][_0xc38e('0x1d')]===undefined?!![]:![]:!![],'where':_0x321300['options']?_0x321300[_0xc38e('0x1c')]['where']||null:null,'attributes':_0x321300['options']?_0x321300[_0xc38e('0x1c')][_0xc38e('0x1f')]||null:null,'include':_0x321300[_0xc38e('0x1c')]?_0x321300[_0xc38e('0x1c')][_0xc38e('0x22')]?_[_0xc38e('0x21')](_0x321300['options']['include'],function(_0x511b0f){return{'model':db[_0x511b0f[_0xc38e('0x23')]],'as':_0x511b0f['as'],'attributes':_0x511b0f[_0xc38e('0x1f')],'include':_0x511b0f[_0xc38e('0x22')]?_[_0xc38e('0x21')](_0x511b0f[_0xc38e('0x22')],function(_0x2064ab){return{'model':db[_0x2064ab[_0xc38e('0x23')]],'as':_0x2064ab['as'],'attributes':_0x2064ab['attributes'],'include':_0x2064ab[_0xc38e('0x22')]?_['map'](_0x2064ab[_0xc38e('0x22')],function(_0x30e757){return{'model':db[_0x30e757[_0xc38e('0x23')]],'as':_0x30e757['as'],'attributes':_0x30e757[_0xc38e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc38e('0xf')](function(_0x277da4){logger[_0xc38e('0x10')]('ShowMailAccount',_0x321300);logger[_0xc38e('0x26')](_0xc38e('0x24'),_0x321300,JSON['stringify'](_0x277da4));_0x432992(_0x277da4);})[_0xc38e('0x19')](function(_0x2a302a){logger['error'](_0xc38e('0x24'),_0x2a302a['message'],_0x321300);_0x5abbb1(_0x57f036[_0xc38e('0x15')](0x1f4,_0x2a302a[_0xc38e('0x17')]));});});};exports['NotifyMailAccount']=function(_0x565c62){var _0x33b9aa=this;return new Promise(function(_0x4a2ba3,_0x5c1698){var _0x231d20={'body':_0x565c62[_0xc38e('0x27')],'channel':'mail'};var _0x59a7ff=_[_0xc38e('0x28')](_[_0xc38e('0x29')](db['CmContact']['rawAttributes']),[_0xc38e('0x2a'),'updatedAt','CompanyId',_0xc38e('0x2b')]);var _0xc20bfa=![];if(_0x565c62[_0xc38e('0x27')]['id']){delete _0x565c62[_0xc38e('0x27')]['id'];}if(_['isNil'](_0x565c62['body'][_0xc38e('0x2c')])){return _0x5c1698(_0x33b9aa[_0xc38e('0x15')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xc38e('0x2d')](_0x565c62[_0xc38e('0x27')][_0xc38e('0x27')])||_0x565c62[_0xc38e('0x27')][_0xc38e('0x27')]===''){return _0x5c1698(_0x33b9aa[_0xc38e('0x15')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x565c62[_0xc38e('0x27')][_0xc38e('0x2e')])){return _0x5c1698(_0x33b9aa[_0xc38e('0x15')](0x1f4,_0xc38e('0x2f')+_0x59a7ff));}if(!_[_0xc38e('0x30')](_0x59a7ff,_0x565c62[_0xc38e('0x27')]['mapKey'])){return _0x5c1698(_0x33b9aa[_0xc38e('0x15')](0x1f4,_0xc38e('0x31')+_0x59a7ff));}var _0x4ca154={};_0x4ca154[_0x565c62[_0xc38e('0x27')][_0xc38e('0x2e')]]=_0x565c62[_0xc38e('0x27')]['from'];return db[_0xc38e('0x1b')][_0xc38e('0x25')]({'where':{'id':_0x565c62[_0xc38e('0x32')]['id']},'include':[{'model':db['CmList'],'as':_0xc38e('0x33'),'include':[{'model':db['CmContact'],'as':_0xc38e('0x34'),'where':_0x4ca154,'limit':0x1,'order':[[_0xc38e('0x35'),_0xc38e('0x36')]]}]},{'model':db['MailApplication'],'as':_0xc38e('0x37')},{'model':db[_0xc38e('0x38')],'as':_0xc38e('0x39')}]})[_0xc38e('0xf')](function(_0x1473bc){if(_0x1473bc&&_0x1473bc[_0xc38e('0x33')]){var _0x2e1223=_0x1473bc['get']({'plain':!![]});_0x231d20['account']=_[_0xc38e('0x3a')](_0x2e1223,[_0xc38e('0x37'),_0xc38e('0x33')]);_0x231d20[_0xc38e('0x3b')]=_0x2e1223[_0xc38e('0x37')];_0x231d20[_0xc38e('0x3c')]=_0x2e1223[_0xc38e('0x33')];_0x231d20['applications']=_[_0xc38e('0x3d')](_0x231d20[_0xc38e('0x3b')],[_0xc38e('0x3e')],[_0xc38e('0x3f')]);if(_0x231d20[_0xc38e('0x32')]&&_0x231d20[_0xc38e('0x32')][_0xc38e('0x40')]){_0x231d20[_0xc38e('0x3b')][_0xc38e('0x41')]({'id':0x0,'priority':_0x231d20[_0xc38e('0x3b')][_0xc38e('0x42')]+0x1,'app':_0xc38e('0x43'),'appdata':_0xc38e('0x40'),'interval':_0xc38e('0x44')});}if(_0x231d20[_0xc38e('0x32')]['Applications']){delete _0x231d20['account'][_0xc38e('0x37')];}if(_0x231d20[_0xc38e('0x32')][_0xc38e('0x33')]){delete _0x231d20[_0xc38e('0x32')][_0xc38e('0x33')];}if(_0x2e1223[_0xc38e('0x33')][_0xc38e('0x34')][_0xc38e('0x42')]){return _0x2e1223[_0xc38e('0x33')]['Contacts'][0x0];}var _0x33c687=_['defaults'](_0x565c62[_0xc38e('0x27')],{'firstName':_0x565c62[_0xc38e('0x27')]['from'],'ListId':_0x2e1223['ListId']});_0x33c687[_0x565c62[_0xc38e('0x27')]['mapKey']]=_0x565c62['body'][_0xc38e('0x2c')];return db[_0xc38e('0x45')][_0xc38e('0x46')](_0x33c687);}else{throw new Error(_0xc38e('0x47'));}})[_0xc38e('0xf')](function(_0x3f9c2a){_0x231d20[_0xc38e('0x48')]=_0x3f9c2a;if(_0x3f9c2a){if(!_0x565c62[_0xc38e('0x27')]['message'][_0xc38e('0x49')]){_0x565c62[_0xc38e('0x27')]['message'][_0xc38e('0x49')]=rs[_0xc38e('0x4a')]()+'\x20'+_0x565c62[_0xc38e('0x27')][_0xc38e('0x17')][_0xc38e('0x2c')];}var _0x26f3e8={'ContactId':_0x3f9c2a['id'],'MailAccountId':_0x565c62[_0xc38e('0x32')]['id'],'inReplyTo':_0x565c62['body'][_0xc38e('0x17')][_0xc38e('0x49')],'to':_0x565c62[_0xc38e('0x27')][_0xc38e('0x17')][_0xc38e('0x2c')],'cc':_0x565c62['body']['message']['cc'],'subject':_0x565c62['body']['message'][_0xc38e('0x4b')],'attach':_0x565c62[_0xc38e('0x27')]['message']['attach'],'lastMsgAt':moment()['format'](_0xc38e('0x4c')),'lastMsgDirection':'in','lastMsgBody':_0x565c62['body'][_0xc38e('0x27')]};return db[_0xc38e('0x4d')]['find']({'where':{'closed':![],'MailAccountId':_0x565c62[_0xc38e('0x32')]['id']},'include':[{'model':db[_0xc38e('0x4e')],'as':_0xc38e('0x4f'),'attributes':[_0xc38e('0x49')],'where':{'messageId':_0x565c62[_0xc38e('0x27')][_0xc38e('0x17')][_0xc38e('0x50')]}}]})[_0xc38e('0xf')](function(_0x714860){if(_0x714860){return[_0x714860,![]];}return db[_0xc38e('0x4d')][_0xc38e('0x46')](_0x26f3e8)[_0xc38e('0xf')](function(_0x7871e7){return[_0x7871e7,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xc38e('0x51')](function(_0x4fcf23,_0x241b79){if(_0x4fcf23){_0xc20bfa=_0x241b79;if(!_0x241b79){return _0x4fcf23['update']({'inReplyTo':_0x565c62['body'][_0xc38e('0x17')][_0xc38e('0x49')],'to':_0x565c62[_0xc38e('0x27')][_0xc38e('0x17')]['from'],'cc':_0x565c62[_0xc38e('0x27')][_0xc38e('0x17')]['cc'],'subject':_0x565c62[_0xc38e('0x27')][_0xc38e('0x17')]['subject'],'attach':_0x4fcf23[_0xc38e('0x52')]?_0x4fcf23[_0xc38e('0x52')]:_0x565c62[_0xc38e('0x27')]['message'][_0xc38e('0x52')],'substatus':null,'substatusAt':moment()[_0xc38e('0x53')](_0xc38e('0x4c')),'lastMsgAt':moment()[_0xc38e('0x53')](_0xc38e('0x4c')),'lastMsgDirection':'in','lastMsgBody':_0x565c62[_0xc38e('0x27')][_0xc38e('0x27')]});}else{return _0x4fcf23;}}})[_0xc38e('0xf')](function(_0x3c7219){_0x231d20[_0xc38e('0x54')]=_0x3c7219[_0xc38e('0x55')]({'plain':!![]});_0x231d20[_0xc38e('0x54')][_0xc38e('0x56')]=_0xc20bfa;return db['MailMessage'][_0xc38e('0x46')]({'body':_0x565c62[_0xc38e('0x27')][_0xc38e('0x27')],'MailAccountId':_0x565c62['account']['id'],'MailInteractionId':_0x3c7219['id'],'direction':'in','ContactId':_0x231d20[_0xc38e('0x48')]['id'],'messageId':_0x565c62[_0xc38e('0x27')][_0xc38e('0x17')][_0xc38e('0x49')],'from':_0x565c62[_0xc38e('0x27')][_0xc38e('0x17')][_0xc38e('0x2c')],'to':_0x565c62[_0xc38e('0x27')][_0xc38e('0x17')]['to'],'cc':_0x565c62[_0xc38e('0x27')][_0xc38e('0x17')]['cc'],'subject':_0x565c62['body'][_0xc38e('0x17')]['subject'],'attach':_0x565c62['body'][_0xc38e('0x17')][_0xc38e('0x52')],'Attachments':_0x565c62[_0xc38e('0x27')]['message'][_0xc38e('0x57')],'originTo':_0x565c62[_0xc38e('0x27')][_0xc38e('0x17')]['originTo'],'originCc':_0x565c62['body'][_0xc38e('0x17')][_0xc38e('0x58')],'bcc':_0x565c62['body'][_0xc38e('0x17')][_0xc38e('0x59')]},{'include':[{'model':db['Attachment'],'as':_0xc38e('0x5a')}]});})[_0xc38e('0xf')](function(_0x454a43){_0x231d20[_0xc38e('0x17')]=_0x454a43;if(_0x231d20['interaction']['UserId']){return db['User'][_0xc38e('0x25')]({'attributes':['id','name'],'where':{'id':_0x231d20[_0xc38e('0x54')][_0xc38e('0x5b')]}})[_0xc38e('0xf')](function(_0x30544e){if(_0x30544e){_0x231d20['applications'][_0xc38e('0x5c')]({'id':0x0,'priority':0x0,'app':_0xc38e('0x5d'),'appdata':_0x30544e['name']+','+(_0x231d20[_0xc38e('0x32')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xc38e('0x5e'),_0x231d20);});}return respondWithRpcPromise(_0xc38e('0x5f'),'startRouting',_0x231d20);})[_0xc38e('0xf')](function(_0x5e9b22){_0x4a2ba3(_0x5e9b22);})['catch'](function(_0x3c2b34){_0x5c1698(_0x33b9aa[_0xc38e('0x15')](0x1f4,_0x3c2b34[_0xc38e('0x17')]));});});};
\ No newline at end of file
+var _0x4503=['Start','startRouting','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailAccount','findAll','options','where','attributes','limit','include','model','map','ShowMailAccount','find','raw','NotifyMailAccount','body','mail','difference','keys','CmContact','createdAt','CompanyId','isNil','from','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','MailAccount','account','Contacts','updatedAt','DESC','MailApplication','Applications','Smtp','List','get','applications','list','orderBy','asc','autoclose','push','length','*,*,*,*','ListId','contact','messageId','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','Contact\x20not\x20found','spread','update','subject','interaction','created','create','attachments','originTo','originCc','bcc','Attachment','Attachments','UserId','name','unshift','agent'];(function(_0xb38f43,_0x320390){var _0x187d52=function(_0x2b5a58){while(--_0x2b5a58){_0xb38f43['push'](_0xb38f43['shift']());}};_0x187d52(++_0x320390);}(_0x4503,0xcc));var _0x3450=function(_0x4ab12f,_0x33c4a3){_0x4ab12f=_0x4ab12f-0x0;var _0x16be6f=_0x4503[_0x4ab12f];return _0x16be6f;};'use strict';var _=require('lodash');var util=require(_0x3450('0x0'));var moment=require('moment');var BPromise=require(_0x3450('0x1'));var rs=require(_0x3450('0x2'));var fs=require('fs');var Redis=require(_0x3450('0x3'));var db=require(_0x3450('0x4'))['db'];var utils=require(_0x3450('0x5'));var logger=require('../../config/logger')(_0x3450('0x6'));var config=require(_0x3450('0x7'));var jayson=require(_0x3450('0x8'));var client=jayson[_0x3450('0x9')][_0x3450('0xa')]({'port':0x232c});config[_0x3450('0xb')]=_[_0x3450('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3450('0xd'))(new Redis(config[_0x3450('0xb')]));require(_0x3450('0xe'))[_0x3450('0xf')](socket);function respondWithRpcPromise(_0x7be68c,_0x531fc9,_0x6a33a8){return new BPromise(function(_0x5de9da,_0x5e1ef2){return client[_0x3450('0x10')](_0x7be68c,_0x6a33a8)[_0x3450('0x11')](function(_0x30c494){logger[_0x3450('0x12')](_0x3450('0x13'),_0x531fc9,'request\x20sent');logger['debug'](_0x3450('0x14'),_0x531fc9,_0x3450('0x15'),JSON[_0x3450('0x16')](_0x30c494));if(_0x30c494[_0x3450('0x17')]){if(_0x30c494[_0x3450('0x17')][_0x3450('0x18')]===0x1f4){logger[_0x3450('0x17')](_0x3450('0x13'),_0x531fc9,_0x30c494[_0x3450('0x17')]['message']);return _0x5e1ef2(_0x30c494[_0x3450('0x17')][_0x3450('0x19')]);}logger[_0x3450('0x17')](_0x3450('0x13'),_0x531fc9,_0x30c494[_0x3450('0x17')][_0x3450('0x19')]);return _0x5de9da(_0x30c494[_0x3450('0x17')][_0x3450('0x19')]);}else{logger[_0x3450('0x12')](_0x3450('0x13'),_0x531fc9,_0x3450('0x15'));_0x5de9da(_0x30c494[_0x3450('0x1a')][_0x3450('0x19')]);}})[_0x3450('0x1b')](function(_0x2383ac){logger['error']('MailAccount,\x20%s,\x20%s',_0x531fc9,_0x2383ac);_0x5e1ef2(_0x2383ac);});});}exports[_0x3450('0x1c')]=function(_0x3fe6b7){var _0x2b8004=this;return new Promise(function(_0x45da22,_0x31497a){return db['MailAccount'][_0x3450('0x1d')]({'raw':_0x3fe6b7[_0x3450('0x1e')]?_0x3fe6b7[_0x3450('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3fe6b7[_0x3450('0x1e')]?_0x3fe6b7[_0x3450('0x1e')][_0x3450('0x1f')]||null:null,'attributes':_0x3fe6b7['options']?_0x3fe6b7[_0x3450('0x1e')][_0x3450('0x20')]||null:null,'limit':_0x3fe6b7[_0x3450('0x1e')]?_0x3fe6b7[_0x3450('0x1e')][_0x3450('0x21')]||null:null,'include':_0x3fe6b7['options']?_0x3fe6b7[_0x3450('0x1e')][_0x3450('0x22')]?_['map'](_0x3fe6b7[_0x3450('0x1e')][_0x3450('0x22')],function(_0x2da4d9){return{'model':db[_0x2da4d9[_0x3450('0x23')]],'as':_0x2da4d9['as'],'attributes':_0x2da4d9[_0x3450('0x20')],'include':_0x2da4d9['include']?_[_0x3450('0x24')](_0x2da4d9[_0x3450('0x22')],function(_0x5a17d9){return{'model':db[_0x5a17d9[_0x3450('0x23')]],'as':_0x5a17d9['as'],'attributes':_0x5a17d9['attributes'],'include':_0x5a17d9[_0x3450('0x22')]?_[_0x3450('0x24')](_0x5a17d9['include'],function(_0x3d422a){return{'model':db[_0x3d422a['model']],'as':_0x3d422a['as'],'attributes':_0x3d422a[_0x3450('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3450('0x11')](function(_0x372e7e){logger[_0x3450('0x12')](_0x3450('0x1c'),_0x3fe6b7);logger['debug'](_0x3450('0x1c'),_0x3fe6b7,JSON[_0x3450('0x16')](_0x372e7e));_0x45da22(_0x372e7e);})[_0x3450('0x1b')](function(_0x3e582a){logger[_0x3450('0x17')](_0x3450('0x1c'),_0x3e582a[_0x3450('0x19')],_0x3fe6b7);_0x31497a(_0x2b8004[_0x3450('0x17')](0x1f4,_0x3e582a[_0x3450('0x19')]));});});};exports[_0x3450('0x25')]=function(_0x508869){var _0x5738d0=this;return new Promise(function(_0x22b9be,_0x1b349f){return db['MailAccount'][_0x3450('0x26')]({'raw':_0x508869[_0x3450('0x1e')]?_0x508869['options'][_0x3450('0x27')]===undefined?!![]:![]:!![],'where':_0x508869[_0x3450('0x1e')]?_0x508869['options'][_0x3450('0x1f')]||null:null,'attributes':_0x508869[_0x3450('0x1e')]?_0x508869[_0x3450('0x1e')][_0x3450('0x20')]||null:null,'include':_0x508869[_0x3450('0x1e')]?_0x508869[_0x3450('0x1e')][_0x3450('0x22')]?_['map'](_0x508869[_0x3450('0x1e')][_0x3450('0x22')],function(_0x1765c4){return{'model':db[_0x1765c4[_0x3450('0x23')]],'as':_0x1765c4['as'],'attributes':_0x1765c4[_0x3450('0x20')],'include':_0x1765c4[_0x3450('0x22')]?_[_0x3450('0x24')](_0x1765c4[_0x3450('0x22')],function(_0x15c43b){return{'model':db[_0x15c43b[_0x3450('0x23')]],'as':_0x15c43b['as'],'attributes':_0x15c43b[_0x3450('0x20')],'include':_0x15c43b[_0x3450('0x22')]?_[_0x3450('0x24')](_0x15c43b[_0x3450('0x22')],function(_0x16bf1f){return{'model':db[_0x16bf1f[_0x3450('0x23')]],'as':_0x16bf1f['as'],'attributes':_0x16bf1f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c5912){logger[_0x3450('0x12')](_0x3450('0x25'),_0x508869);logger['debug'](_0x3450('0x25'),_0x508869,JSON[_0x3450('0x16')](_0x3c5912));_0x22b9be(_0x3c5912);})[_0x3450('0x1b')](function(_0x3a4071){logger[_0x3450('0x17')]('ShowMailAccount',_0x3a4071[_0x3450('0x19')],_0x508869);_0x1b349f(_0x5738d0[_0x3450('0x17')](0x1f4,_0x3a4071[_0x3450('0x19')]));});});};exports[_0x3450('0x28')]=function(_0x5495b7){var _0x4781ae=this;return new Promise(function(_0x35c64c,_0x2ae2c0){var _0x5d85d8={'body':_0x5495b7[_0x3450('0x29')],'channel':_0x3450('0x2a')};var _0x4aa93e=_[_0x3450('0x2b')](_[_0x3450('0x2c')](db[_0x3450('0x2d')]['rawAttributes']),[_0x3450('0x2e'),'updatedAt',_0x3450('0x2f'),'ListId']);var _0x57f091=![];if(_0x5495b7['body']['id']){delete _0x5495b7[_0x3450('0x29')]['id'];}if(_[_0x3450('0x30')](_0x5495b7[_0x3450('0x29')][_0x3450('0x31')])){return _0x2ae2c0(_0x4781ae[_0x3450('0x17')](0x1f4,_0x3450('0x32')));}if(_[_0x3450('0x30')](_0x5495b7[_0x3450('0x29')][_0x3450('0x29')])||_0x5495b7[_0x3450('0x29')][_0x3450('0x29')]===''){return _0x2ae2c0(_0x4781ae['error'](0x1f4,_0x3450('0x33')));}if(_[_0x3450('0x30')](_0x5495b7[_0x3450('0x29')][_0x3450('0x34')])){return _0x2ae2c0(_0x4781ae[_0x3450('0x17')](0x1f4,_0x3450('0x35')+_0x4aa93e));}if(!_['includes'](_0x4aa93e,_0x5495b7[_0x3450('0x29')][_0x3450('0x34')])){return _0x2ae2c0(_0x4781ae[_0x3450('0x17')](0x1f4,_0x3450('0x36')+_0x4aa93e));}var _0x5cc468={};_0x5cc468[_0x5495b7['body']['mapKey']]=_0x5495b7['body'][_0x3450('0x31')];return db[_0x3450('0x37')][_0x3450('0x26')]({'where':{'id':_0x5495b7[_0x3450('0x38')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x3450('0x39'),'where':_0x5cc468,'limit':0x1,'order':[[_0x3450('0x3a'),_0x3450('0x3b')]]}]},{'model':db[_0x3450('0x3c')],'as':_0x3450('0x3d')},{'model':db['MailServerOut'],'as':_0x3450('0x3e')}]})[_0x3450('0x11')](function(_0x579998){if(_0x579998&&_0x579998[_0x3450('0x3f')]){var _0x31ec86=_0x579998[_0x3450('0x40')]({'plain':!![]});_0x5d85d8['account']=_['omit'](_0x31ec86,[_0x3450('0x3d'),'List']);_0x5d85d8[_0x3450('0x41')]=_0x31ec86[_0x3450('0x3d')];_0x5d85d8[_0x3450('0x42')]=_0x31ec86[_0x3450('0x3f')];_0x5d85d8[_0x3450('0x41')]=_[_0x3450('0x43')](_0x5d85d8[_0x3450('0x41')],['priority'],[_0x3450('0x44')]);if(_0x5d85d8[_0x3450('0x38')]&&_0x5d85d8['account'][_0x3450('0x45')]){_0x5d85d8[_0x3450('0x41')][_0x3450('0x46')]({'id':0x0,'priority':_0x5d85d8[_0x3450('0x41')][_0x3450('0x47')]+0x1,'app':'close','appdata':_0x3450('0x45'),'interval':_0x3450('0x48')});}if(_0x5d85d8[_0x3450('0x38')]['Applications']){delete _0x5d85d8[_0x3450('0x38')]['Applications'];}if(_0x5d85d8[_0x3450('0x38')][_0x3450('0x3f')]){delete _0x5d85d8['account'][_0x3450('0x3f')];}if(_0x31ec86[_0x3450('0x3f')]['Contacts'][_0x3450('0x47')]){return _0x31ec86['List'][_0x3450('0x39')][0x0];}var _0x26dcca=_[_0x3450('0xc')](_0x5495b7[_0x3450('0x29')],{'firstName':_0x5495b7[_0x3450('0x29')][_0x3450('0x31')],'ListId':_0x31ec86[_0x3450('0x49')]});_0x26dcca[_0x5495b7[_0x3450('0x29')]['mapKey']]=_0x5495b7[_0x3450('0x29')][_0x3450('0x31')];return db[_0x3450('0x2d')]['create'](_0x26dcca);}else{throw new Error('List\x20not\x20found');}})[_0x3450('0x11')](function(_0xd6f185){_0x5d85d8[_0x3450('0x4a')]=_0xd6f185;if(_0xd6f185){if(!_0x5495b7[_0x3450('0x29')][_0x3450('0x19')][_0x3450('0x4b')]){_0x5495b7[_0x3450('0x29')][_0x3450('0x19')]['messageId']=rs['generate']()+'\x20'+_0x5495b7[_0x3450('0x29')][_0x3450('0x19')]['from'];}var _0x2b1afe={'ContactId':_0xd6f185['id'],'MailAccountId':_0x5495b7['account']['id'],'inReplyTo':_0x5495b7['body'][_0x3450('0x19')][_0x3450('0x4b')],'to':_0x5495b7[_0x3450('0x29')][_0x3450('0x19')][_0x3450('0x31')],'cc':_0x5495b7[_0x3450('0x29')]['message']['cc'],'subject':_0x5495b7[_0x3450('0x29')]['message']['subject'],'attach':_0x5495b7[_0x3450('0x29')][_0x3450('0x19')][_0x3450('0x4c')],'lastMsgAt':moment()[_0x3450('0x4d')](_0x3450('0x4e')),'lastMsgDirection':'in','lastMsgBody':_0x5495b7['body'][_0x3450('0x29')]};return db[_0x3450('0x4f')][_0x3450('0x26')]({'where':{'closed':![],'MailAccountId':_0x5495b7[_0x3450('0x38')]['id']},'include':[{'model':db[_0x3450('0x50')],'as':_0x3450('0x51'),'attributes':[_0x3450('0x4b')],'where':{'messageId':_0x5495b7[_0x3450('0x29')][_0x3450('0x19')]['inReplyTo']}}]})[_0x3450('0x11')](function(_0x1a811e){if(_0x1a811e){return[_0x1a811e,![]];}return db['MailInteraction']['create'](_0x2b1afe)[_0x3450('0x11')](function(_0x5df4bc){return[_0x5df4bc,!![]];});});}else{throw new Error(_0x3450('0x52'));}})[_0x3450('0x53')](function(_0x6c05bb,_0x1aeaf1){if(_0x6c05bb){_0x57f091=_0x1aeaf1;if(!_0x1aeaf1){return _0x6c05bb[_0x3450('0x54')]({'inReplyTo':_0x5495b7[_0x3450('0x29')]['message'][_0x3450('0x4b')],'to':_0x5495b7[_0x3450('0x29')][_0x3450('0x19')]['from'],'cc':_0x5495b7[_0x3450('0x29')][_0x3450('0x19')]['cc'],'subject':_0x5495b7[_0x3450('0x29')][_0x3450('0x19')][_0x3450('0x55')],'attach':_0x6c05bb[_0x3450('0x4c')]?_0x6c05bb[_0x3450('0x4c')]:_0x5495b7['body'][_0x3450('0x19')][_0x3450('0x4c')],'substatus':null,'substatusAt':moment()[_0x3450('0x4d')](_0x3450('0x4e')),'lastMsgAt':moment()[_0x3450('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x5495b7[_0x3450('0x29')]['body']});}else{return _0x6c05bb;}}})[_0x3450('0x11')](function(_0x580704){_0x5d85d8[_0x3450('0x56')]=_0x580704[_0x3450('0x40')]({'plain':!![]});_0x5d85d8['interaction'][_0x3450('0x57')]=_0x57f091;return db[_0x3450('0x50')][_0x3450('0x58')]({'body':_0x5495b7[_0x3450('0x29')]['body'],'MailAccountId':_0x5495b7[_0x3450('0x38')]['id'],'MailInteractionId':_0x580704['id'],'direction':'in','ContactId':_0x5d85d8[_0x3450('0x4a')]['id'],'messageId':_0x5495b7[_0x3450('0x29')][_0x3450('0x19')]['messageId'],'from':_0x5495b7[_0x3450('0x29')]['message'][_0x3450('0x31')],'to':_0x5495b7[_0x3450('0x29')][_0x3450('0x19')]['to'],'cc':_0x5495b7[_0x3450('0x29')][_0x3450('0x19')]['cc'],'subject':_0x5495b7[_0x3450('0x29')]['message'][_0x3450('0x55')],'attach':_0x5495b7[_0x3450('0x29')][_0x3450('0x19')][_0x3450('0x4c')],'Attachments':_0x5495b7[_0x3450('0x29')][_0x3450('0x19')][_0x3450('0x59')],'originTo':_0x5495b7[_0x3450('0x29')]['message'][_0x3450('0x5a')],'originCc':_0x5495b7['body'][_0x3450('0x19')][_0x3450('0x5b')],'bcc':_0x5495b7[_0x3450('0x29')][_0x3450('0x19')][_0x3450('0x5c')]},{'include':[{'model':db[_0x3450('0x5d')],'as':_0x3450('0x5e')}]});})[_0x3450('0x11')](function(_0x3ac376){_0x5d85d8[_0x3450('0x19')]=_0x3ac376;if(_0x5d85d8['interaction'][_0x3450('0x5f')]){return db['User'][_0x3450('0x26')]({'attributes':['id',_0x3450('0x60')],'where':{'id':_0x5d85d8[_0x3450('0x56')][_0x3450('0x5f')]}})['then'](function(_0x3eb6c2){if(_0x3eb6c2){_0x5d85d8[_0x3450('0x41')][_0x3450('0x61')]({'id':0x0,'priority':0x0,'app':_0x3450('0x62'),'appdata':_0x3eb6c2[_0x3450('0x60')]+','+(_0x5d85d8[_0x3450('0x38')]['waitForTheAssignedAgent']||0xa),'interval':_0x3450('0x48')});}return respondWithRpcPromise(_0x3450('0x63'),'startRouting',_0x5d85d8);});}return respondWithRpcPromise('Start',_0x3450('0x64'),_0x5d85d8);})[_0x3450('0x11')](function(_0x4dacbd){_0x35c64c(_0x4dacbd);})[_0x3450('0x1b')](function(_0x496f08){_0x2ae2c0(_0x4781ae[_0x3450('0x17')](0x1f4,_0x496f08[_0x3450('0x19')]));});});};
\ No newline at end of file
index e668560..4ff8943 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1658=['length','mailAccount:','save','update','removeListener'];(function(_0x171fdc,_0x16ae91){var _0x3782ea=function(_0x58b691){while(--_0x58b691){_0x171fdc['push'](_0x171fdc['shift']());}};_0x3782ea(++_0x16ae91);}(_0x1658,0x110));var _0x8165=function(_0x355e7f,_0x18d2cf){_0x355e7f=_0x355e7f-0x0;var _0x4aec9f=_0x1658[_0x355e7f];return _0x4aec9f;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x8165('0x0'),'remove',_0x8165('0x1')];function createListener(_0x274448,_0x384a39){return function(_0x5b3f98){_0x384a39['emit'](_0x274448,_0x5b3f98);};}function removeListener(_0x5d1b68,_0x51e3cd){return function(){MailAccountEvents[_0x8165('0x2')](_0x5d1b68,_0x51e3cd);};}exports['register']=function(_0xf9644f){for(var _0x2bb06a=0x0,_0x27ccb6=events[_0x8165('0x3')];_0x2bb06a<_0x27ccb6;_0x2bb06a++){var _0x12a383=events[_0x2bb06a];var _0x103675=createListener(_0x8165('0x4')+_0x12a383,_0xf9644f);MailAccountEvents['on'](_0x12a383,_0x103675);}};
\ No newline at end of file
+var _0x4cf4=['save','remove','update','emit','removeListener','register','length'];(function(_0x11fe8c,_0x4f9c71){var _0x455f44=function(_0xbf078c){while(--_0xbf078c){_0x11fe8c['push'](_0x11fe8c['shift']());}};_0x455f44(++_0x4f9c71);}(_0x4cf4,0xbd));var _0x44cf=function(_0x4dda18,_0x393cf6){_0x4dda18=_0x4dda18-0x0;var _0x3ff252=_0x4cf4[_0x4dda18];return _0x3ff252;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x44cf('0x0'),_0x44cf('0x1'),_0x44cf('0x2')];function createListener(_0x2d9952,_0xd097e6){return function(_0x23c4e4){_0xd097e6[_0x44cf('0x3')](_0x2d9952,_0x23c4e4);};}function removeListener(_0x3252fb,_0x569284){return function(){MailAccountEvents[_0x44cf('0x4')](_0x3252fb,_0x569284);};}exports[_0x44cf('0x5')]=function(_0x391abe){for(var _0x104943=0x0,_0x2c9151=events[_0x44cf('0x6')];_0x104943<_0x2c9151;_0x104943++){var _0x3ab868=events[_0x104943];var _0x536748=createListener('mailAccount:'+_0x3ab868,_0x391abe);MailAccountEvents['on'](_0x3ab868,_0x536748);}};
\ No newline at end of file
index c1fbe04..a4f334e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc788=['update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id','isAuthenticated','show','put'];(function(_0xbcd604,_0x5c6862){var _0x16a71e=function(_0xa68500){while(--_0xa68500){_0xbcd604['push'](_0xbcd604['shift']());}};_0x16a71e(++_0x5c6862);}(_0xc788,0xc4));var _0x8c78=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0xc788[_0x9dfc10];return _0x4f938a;};'use strict';var multer=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var path=require(_0x8c78('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c78('0x3')]();var auth=require(_0x8c78('0x4'));var interaction=require(_0x8c78('0x5'));var config=require(_0x8c78('0x6'));var controller=require(_0x8c78('0x7'));router['get'](_0x8c78('0x8'),auth[_0x8c78('0x9')](),controller[_0x8c78('0xa')]);router[_0x8c78('0xb')](_0x8c78('0x8'),auth['isAuthenticated'](),controller[_0x8c78('0xc')]);router[_0x8c78('0xd')](_0x8c78('0x8'),auth[_0x8c78('0x9')](),controller[_0x8c78('0xe')]);module[_0x8c78('0xf')]=router;
\ No newline at end of file
+var _0x402f=['/:id','isAuthenticated','show','put','delete','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','./mailApplication.controller'];(function(_0x2f6932,_0x178ca5){var _0x160b07=function(_0x1722be){while(--_0x1722be){_0x2f6932['push'](_0x2f6932['shift']());}};_0x160b07(++_0x178ca5);}(_0x402f,0x6f));var _0xf402=function(_0x47847a,_0x4834d3){_0x47847a=_0x47847a-0x0;var _0x3d6690=_0x402f[_0x47847a];return _0x3d6690;};'use strict';var multer=require(_0xf402('0x0'));var util=require('util');var path=require(_0xf402('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf402('0x2')]();var auth=require(_0xf402('0x3'));var interaction=require(_0xf402('0x4'));var config=require('../../config/environment');var controller=require(_0xf402('0x5'));router['get'](_0xf402('0x6'),auth[_0xf402('0x7')](),controller[_0xf402('0x8')]);router[_0xf402('0x9')](_0xf402('0x6'),auth['isAuthenticated'](),controller['update']);router[_0xf402('0xa')](_0xf402('0x6'),auth[_0xf402('0x7')](),controller[_0xf402('0xb')]);module[_0xf402('0xc')]=router;
\ No newline at end of file
index 678f899..ef4b613 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcd9f=['STRING','*,*,*,*','sequelize','exports'];(function(_0x2e997e,_0x4edf31){var _0x5a6cb1=function(_0x3904da){while(--_0x3904da){_0x2e997e['push'](_0x2e997e['shift']());}};_0x5a6cb1(++_0x4edf31);}(_0xcd9f,0x1b6));var _0xfcd9=function(_0x573d8f,_0x2fcad2){_0x573d8f=_0x573d8f-0x0;var _0xc340f3=_0xcd9f[_0x573d8f];return _0xc340f3;};'use strict';var Sequelize=require(_0xfcd9('0x0'));module[_0xfcd9('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xfcd9('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xfcd9('0x2')](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0xfcd9('0x2')]},'interval':{'type':Sequelize[_0xfcd9('0x2')],'defaultValue':_0xfcd9('0x3')}};
\ No newline at end of file
+var _0xb9bd=['STRING','*,*,*,*','sequelize','exports','INTEGER','noop'];(function(_0x29d233,_0x54524f){var _0x1eb3f1=function(_0x298741){while(--_0x298741){_0x29d233['push'](_0x29d233['shift']());}};_0x1eb3f1(++_0x54524f);}(_0xb9bd,0x104));var _0xdb9b=function(_0x581ddf,_0x1b781a){_0x581ddf=_0x581ddf-0x0;var _0x338e9e=_0xb9bd[_0x581ddf];return _0x338e9e;};'use strict';var Sequelize=require(_0xdb9b('0x0'));module[_0xdb9b('0x1')]={'priority':{'type':Sequelize[_0xdb9b('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdb9b('0x3')},'appdata':{'type':Sequelize[_0xdb9b('0x4')](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0xdb9b('0x4')]},'interval':{'type':Sequelize[_0xdb9b('0x4')],'defaultValue':_0xdb9b('0x5')}};
\ No newline at end of file
index 8e5422c..4549d90 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['Content-Range','apply','reject','save','then','error','stack','send','show','params','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','model','fields','length','includeAll','merge','find','catch','body','destroy','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','sendStatus','status','end','json','count','offset','limit','set'];(function(_0x1d8d2a,_0x104f26){var _0x146cdf=function(_0x3f402f){while(--_0x3f402f){_0x1d8d2a['push'](_0x1d8d2a['shift']());}};_0x146cdf(++_0x104f26);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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 authService=require(_0x0a9e('0xe'));var hardwareService=require(_0x0a9e('0xf'));var Redis=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xcc;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x13')](_0x36471c);}return _0x273d4d[_0x0a9e('0x14')](_0x36471c)[_0x0a9e('0x15')]();};}function respondWithResult(_0x5db4b0,_0x4283ce){_0x4283ce=_0x4283ce||0xc8;return function(_0x239b12){if(_0x239b12){return _0x5db4b0[_0x0a9e('0x14')](_0x4283ce)[_0x0a9e('0x16')](_0x239b12);}};}function respondWithFilteredResult(_0x44dcfd,_0x4d5611){return function(_0x52a03d){if(_0x52a03d){var _0x22dccb=_0x52a03d[_0x0a9e('0x17')],_0x5d0880=_0x4d5611[_0x0a9e('0x18')],_0x1985b6=_0x4d5611['offset']+_0x4d5611[_0x0a9e('0x19')],_0x519dfd;if(_0x1985b6>=_0x22dccb){_0x1985b6=_0x22dccb;_0x519dfd=0xc8;}else{_0x519dfd=0xce;}_0x44dcfd['status'](_0x519dfd);return _0x44dcfd[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5d0880+'-'+_0x1985b6+'/'+_0x22dccb)[_0x0a9e('0x16')](_0x52a03d);}return null;};}function patchUpdates(_0x205fd6){return function(_0x31b1ca){try{jsonpatch[_0x0a9e('0x1c')](_0x31b1ca,_0x205fd6,!![]);}catch(_0x530eb7){return BPromise[_0x0a9e('0x1d')](_0x530eb7);}return _0x31b1ca[_0x0a9e('0x1e')]();};}function saveUpdates(_0x112016,_0x1c696a){return function(_0x105080){if(_0x105080){return _0x105080['update'](_0x112016)[_0x0a9e('0x1f')](function(_0x155cce){return _0x155cce;});}return null;};}function removeEntity(_0x53682f,_0x20f109){return function(_0x5a09ef){if(_0x5a09ef){return _0x5a09ef['destroy']()[_0x0a9e('0x1f')](function(){_0x53682f[_0x0a9e('0x14')](0xcc)[_0x0a9e('0x15')]();});}};}function handleEntityNotFound(_0x30bae6,_0x4abc77){return function(_0xfb6e48){if(!_0xfb6e48){_0x30bae6[_0x0a9e('0x13')](0x194);}return _0xfb6e48;};}function handleError(_0x3b45bc,_0x4d00e6){_0x4d00e6=_0x4d00e6||0x1f4;return function(_0x370d86){logger[_0x0a9e('0x20')](_0x370d86[_0x0a9e('0x21')]);if(_0x370d86['name']){delete _0x370d86['name'];}_0x3b45bc[_0x0a9e('0x14')](_0x4d00e6)[_0x0a9e('0x22')](_0x370d86);};}exports[_0x0a9e('0x23')]=function(_0x33161b,_0x526cf3){var _0x384319={'raw':!![],'where':{'id':_0x33161b[_0x0a9e('0x24')]['id']}},_0x479bc4={};_0x479bc4['model']=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x479bc4[_0x0a9e('0x28')]=_[_0x0a9e('0x25')](_0x33161b[_0x0a9e('0x28')]);_0x479bc4[_0x0a9e('0x29')]=_[_0x0a9e('0x2a')](_0x479bc4['model'],_0x479bc4[_0x0a9e('0x28')]);_0x384319[_0x0a9e('0x2b')]=_[_0x0a9e('0x2a')](_0x479bc4[_0x0a9e('0x2c')],qs['fields'](_0x33161b[_0x0a9e('0x28')][_0x0a9e('0x2d')]));_0x384319[_0x0a9e('0x2b')]=_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x2e')]?_0x384319[_0x0a9e('0x2b')]:_0x479bc4[_0x0a9e('0x2c')];if(_0x33161b[_0x0a9e('0x28')][_0x0a9e('0x2f')]){_0x384319['include']=[{'all':!![]}];}_0x384319=_[_0x0a9e('0x30')]({},_0x384319,_0x33161b['options']);return db[_0x0a9e('0x26')][_0x0a9e('0x31')](_0x384319)[_0x0a9e('0x1f')](handleEntityNotFound(_0x526cf3,null))[_0x0a9e('0x1f')](respondWithResult(_0x526cf3,null))[_0x0a9e('0x32')](handleError(_0x526cf3,null));};exports['update']=function(_0x66c1d2,_0x46f0a5){if(_0x66c1d2[_0x0a9e('0x33')]['id']){delete _0x66c1d2[_0x0a9e('0x33')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x31')]({'where':{'id':_0x66c1d2[_0x0a9e('0x24')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x46f0a5,null))['then'](saveUpdates(_0x66c1d2[_0x0a9e('0x33')],null))['then'](respondWithResult(_0x46f0a5,null))[_0x0a9e('0x32')](handleError(_0x46f0a5,null));};exports[_0x0a9e('0x34')]=function(_0x2b7e7f,_0x3f3d41){return db['MailApplication'][_0x0a9e('0x31')]({'where':{'id':_0x2b7e7f[_0x0a9e('0x24')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x3f3d41,null))[_0x0a9e('0x1f')](removeEntity(_0x3f3d41,null))['catch'](handleError(_0x3f3d41,null));};
\ No newline at end of file
+var _0xa9e0=['Content-Range','apply','reject','save','then','error','stack','send','show','params','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','model','fields','length','includeAll','merge','find','catch','body','destroy','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','sendStatus','status','end','json','count','offset','limit','set'];(function(_0xfae424,_0x4e945a){var _0x235859=function(_0x396c39){while(--_0x396c39){_0xfae424['push'](_0xfae424['shift']());}};_0x235859(++_0x4e945a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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 authService=require(_0x0a9e('0xe'));var hardwareService=require(_0x0a9e('0xf'));var Redis=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xcc;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x13')](_0x36471c);}return _0x273d4d[_0x0a9e('0x14')](_0x36471c)[_0x0a9e('0x15')]();};}function respondWithResult(_0x5db4b0,_0x4283ce){_0x4283ce=_0x4283ce||0xc8;return function(_0x239b12){if(_0x239b12){return _0x5db4b0[_0x0a9e('0x14')](_0x4283ce)[_0x0a9e('0x16')](_0x239b12);}};}function respondWithFilteredResult(_0x44dcfd,_0x4d5611){return function(_0x52a03d){if(_0x52a03d){var _0x22dccb=_0x52a03d[_0x0a9e('0x17')],_0x5d0880=_0x4d5611[_0x0a9e('0x18')],_0x1985b6=_0x4d5611['offset']+_0x4d5611[_0x0a9e('0x19')],_0x519dfd;if(_0x1985b6>=_0x22dccb){_0x1985b6=_0x22dccb;_0x519dfd=0xc8;}else{_0x519dfd=0xce;}_0x44dcfd['status'](_0x519dfd);return _0x44dcfd[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5d0880+'-'+_0x1985b6+'/'+_0x22dccb)[_0x0a9e('0x16')](_0x52a03d);}return null;};}function patchUpdates(_0x205fd6){return function(_0x31b1ca){try{jsonpatch[_0x0a9e('0x1c')](_0x31b1ca,_0x205fd6,!![]);}catch(_0x530eb7){return BPromise[_0x0a9e('0x1d')](_0x530eb7);}return _0x31b1ca[_0x0a9e('0x1e')]();};}function saveUpdates(_0x112016,_0x1c696a){return function(_0x105080){if(_0x105080){return _0x105080['update'](_0x112016)[_0x0a9e('0x1f')](function(_0x155cce){return _0x155cce;});}return null;};}function removeEntity(_0x53682f,_0x20f109){return function(_0x5a09ef){if(_0x5a09ef){return _0x5a09ef['destroy']()[_0x0a9e('0x1f')](function(){_0x53682f[_0x0a9e('0x14')](0xcc)[_0x0a9e('0x15')]();});}};}function handleEntityNotFound(_0x30bae6,_0x4abc77){return function(_0xfb6e48){if(!_0xfb6e48){_0x30bae6[_0x0a9e('0x13')](0x194);}return _0xfb6e48;};}function handleError(_0x3b45bc,_0x4d00e6){_0x4d00e6=_0x4d00e6||0x1f4;return function(_0x370d86){logger[_0x0a9e('0x20')](_0x370d86[_0x0a9e('0x21')]);if(_0x370d86['name']){delete _0x370d86['name'];}_0x3b45bc[_0x0a9e('0x14')](_0x4d00e6)[_0x0a9e('0x22')](_0x370d86);};}exports[_0x0a9e('0x23')]=function(_0x33161b,_0x526cf3){var _0x384319={'raw':!![],'where':{'id':_0x33161b[_0x0a9e('0x24')]['id']}},_0x479bc4={};_0x479bc4['model']=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x479bc4[_0x0a9e('0x28')]=_[_0x0a9e('0x25')](_0x33161b[_0x0a9e('0x28')]);_0x479bc4[_0x0a9e('0x29')]=_[_0x0a9e('0x2a')](_0x479bc4['model'],_0x479bc4[_0x0a9e('0x28')]);_0x384319[_0x0a9e('0x2b')]=_[_0x0a9e('0x2a')](_0x479bc4[_0x0a9e('0x2c')],qs['fields'](_0x33161b[_0x0a9e('0x28')][_0x0a9e('0x2d')]));_0x384319[_0x0a9e('0x2b')]=_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x2e')]?_0x384319[_0x0a9e('0x2b')]:_0x479bc4[_0x0a9e('0x2c')];if(_0x33161b[_0x0a9e('0x28')][_0x0a9e('0x2f')]){_0x384319['include']=[{'all':!![]}];}_0x384319=_[_0x0a9e('0x30')]({},_0x384319,_0x33161b['options']);return db[_0x0a9e('0x26')][_0x0a9e('0x31')](_0x384319)[_0x0a9e('0x1f')](handleEntityNotFound(_0x526cf3,null))[_0x0a9e('0x1f')](respondWithResult(_0x526cf3,null))[_0x0a9e('0x32')](handleError(_0x526cf3,null));};exports['update']=function(_0x66c1d2,_0x46f0a5){if(_0x66c1d2[_0x0a9e('0x33')]['id']){delete _0x66c1d2[_0x0a9e('0x33')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x31')]({'where':{'id':_0x66c1d2[_0x0a9e('0x24')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x46f0a5,null))['then'](saveUpdates(_0x66c1d2[_0x0a9e('0x33')],null))['then'](respondWithResult(_0x46f0a5,null))[_0x0a9e('0x32')](handleError(_0x46f0a5,null));};exports[_0x0a9e('0x34')]=function(_0x2b7e7f,_0x3f3d41){return db['MailApplication'][_0x0a9e('0x31')]({'where':{'id':_0x2b7e7f[_0x0a9e('0x24')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x3f3d41,null))[_0x0a9e('0x1f')](removeEntity(_0x3f3d41,null))['catch'](handleError(_0x3f3d41,null));};
\ No newline at end of file
index 2fa3f7f..1ff62f4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf0c7=['MailApplication','mail_applications','../../config/logger','moment','bluebird','request-promise','./mailApplication.attributes','exports','define'];(function(_0x2820ad,_0x3db242){var _0x1c3275=function(_0x4e55fd){while(--_0x4e55fd){_0x2820ad['push'](_0x2820ad['shift']());}};_0x1c3275(++_0x3db242);}(_0xf0c7,0xad));var _0x7f0c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf0c7[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7f0c('0x0'))('api');var moment=require(_0x7f0c('0x1'));var BPromise=require(_0x7f0c('0x2'));var rp=require(_0x7f0c('0x3'));var attributes=require(_0x7f0c('0x4'));module[_0x7f0c('0x5')]=function(_0x344675,_0x116c91){return _0x344675[_0x7f0c('0x6')](_0x7f0c('0x7'),attributes,{'tableName':_0x7f0c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x9d31=['moment','bluebird','./mailApplication.attributes','define','MailApplication','mail_applications','lodash','../../config/logger','api'];(function(_0x33412a,_0x4c8c34){var _0x24e668=function(_0x5c4714){while(--_0x5c4714){_0x33412a['push'](_0x33412a['shift']());}};_0x24e668(++_0x4c8c34);}(_0x9d31,0x16e));var _0x19d3=function(_0x3a9af1,_0x222e37){_0x3a9af1=_0x3a9af1-0x0;var _0x38e5fd=_0x9d31[_0x3a9af1];return _0x38e5fd;};'use strict';var _=require(_0x19d3('0x0'));var util=require('util');var logger=require(_0x19d3('0x1'))(_0x19d3('0x2'));var moment=require(_0x19d3('0x3'));var BPromise=require(_0x19d3('0x4'));var rp=require('request-promise');var attributes=require(_0x19d3('0x5'));module['exports']=function(_0x6ab781,_0x55e0ee){return _0x6ab781[_0x19d3('0x6')](_0x19d3('0x7'),attributes,{'tableName':_0x19d3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 389ea5d..ce551a9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','update','options','raw','attributes','limit','lodash','util','moment'];(function(_0x17c216,_0x1eed2a){var _0x2b2b39=function(_0x26a65a){while(--_0x26a65a){_0x17c216['push'](_0x17c216['shift']());}};_0x2b2b39(++_0x1eed2a);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('MailApplication,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['MailApplication'][_0x7995('0x19')](_0x291317['body'],{'raw':_0x291317['options']?_0x291317[_0x7995('0x1a')][_0x7995('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x291317['options']?_0x291317[_0x7995('0x1a')]['where']||null:null,'attributes':_0x291317['options']?_0x291317[_0x7995('0x1a')][_0x7995('0x1c')]||null:null,'limit':_0x291317[_0x7995('0x1a')]?_0x291317[_0x7995('0x1a')][_0x7995('0x1d')]||null:null})[_0x7995('0xc')](function(_0x5d40ae){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x5d40ae));_0x37a7d4(_0x5d40ae);})[_0x7995('0x17')](function(_0x475351){logger[_0x7995('0x13')]('UpdateMailApplication',_0x475351[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x475351[_0x7995('0x15')]));});});};
\ No newline at end of file
+var _0x9957=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','update','options','raw','attributes','limit','lodash','util','moment'];(function(_0x30c484,_0x33bf4b){var _0x34b408=function(_0x4c33dd){while(--_0x4c33dd){_0x30c484['push'](_0x30c484['shift']());}};_0x34b408(++_0x33bf4b);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('MailApplication,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['MailApplication'][_0x7995('0x19')](_0x291317['body'],{'raw':_0x291317['options']?_0x291317[_0x7995('0x1a')][_0x7995('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x291317['options']?_0x291317[_0x7995('0x1a')]['where']||null:null,'attributes':_0x291317['options']?_0x291317[_0x7995('0x1a')][_0x7995('0x1c')]||null:null,'limit':_0x291317[_0x7995('0x1a')]?_0x291317[_0x7995('0x1a')][_0x7995('0x1d')]||null:null})[_0x7995('0xc')](function(_0x5d40ae){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x5d40ae));_0x37a7d4(_0x5d40ae);})[_0x7995('0x17')](function(_0x475351){logger[_0x7995('0x13')]('UpdateMailApplication',_0x475351[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x475351[_0x7995('0x15')]));});});};
\ No newline at end of file
index f9863ce..ecc1ea0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe5f1=['delete','mailinteraction:destroy','removeTags','exports','multer','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','mailinteraction:addtags','mail','mailinteraction:update','update'];(function(_0x12f596,_0x398fea){var _0x3fbeab=function(_0x29e0dc){while(--_0x29e0dc){_0x12f596['push'](_0x12f596['shift']());}};_0x3fbeab(++_0x398fea);}(_0xe5f1,0xee));var _0x1e5f=function(_0x47e85c,_0x320f49){_0x47e85c=_0x47e85c-0x0;var _0x4f53b2=_0xe5f1[_0x47e85c];return _0x4f53b2;};'use strict';var multer=require(_0x1e5f('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1e5f('0x1')]();var auth=require(_0x1e5f('0x2'));var interaction=require(_0x1e5f('0x3'));var config=require('../../config/environment');var controller=require('./mailInteraction.controller');router[_0x1e5f('0x4')]('/',auth[_0x1e5f('0x5')](),controller[_0x1e5f('0x6')]);router[_0x1e5f('0x4')](_0x1e5f('0x7'),auth[_0x1e5f('0x5')](),controller['describe']);router[_0x1e5f('0x4')](_0x1e5f('0x8'),auth[_0x1e5f('0x5')](),controller[_0x1e5f('0x9')]);router[_0x1e5f('0x4')](_0x1e5f('0xa'),auth['isAuthenticated'](),controller[_0x1e5f('0xb')]);router['get']('/:id/download',auth[_0x1e5f('0x5')](),controller[_0x1e5f('0xc')]);router[_0x1e5f('0xd')]('/',auth[_0x1e5f('0x5')](),controller[_0x1e5f('0xe')]);router['post'](_0x1e5f('0xa'),auth[_0x1e5f('0x5')](),controller[_0x1e5f('0xf')]);router[_0x1e5f('0xd')](_0x1e5f('0x10'),auth['isAuthenticated'](),interaction[_0x1e5f('0x11')]('mail',_0x1e5f('0x12')),controller['addTags']);router['put'](_0x1e5f('0x8'),auth['isAuthenticated'](),interaction['tracked'](_0x1e5f('0x13'),_0x1e5f('0x14')),controller[_0x1e5f('0x15')]);router[_0x1e5f('0x16')](_0x1e5f('0x8'),auth[_0x1e5f('0x5')](),interaction[_0x1e5f('0x11')](_0x1e5f('0x13'),_0x1e5f('0x17')),controller['destroy']);router[_0x1e5f('0x16')](_0x1e5f('0x10'),auth[_0x1e5f('0x5')](),controller[_0x1e5f('0x18')]);module[_0x1e5f('0x19')]=router;
\ No newline at end of file
+var _0xf2b9=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id/messages','download','post','create','/:id/tags','tracked','mailinteraction:addtags','addTags','/:id','mail','mailinteraction:update','update','delete','destroy','removeTags','exports','multer','path','express','Router'];(function(_0x3895b7,_0xd4796b){var _0x3f3b8c=function(_0x43a116){while(--_0x43a116){_0x3895b7['push'](_0x3895b7['shift']());}};_0x3f3b8c(++_0xd4796b);}(_0xf2b9,0x192));var _0x9f2b=function(_0x25d610,_0x15a903){_0x25d610=_0x25d610-0x0;var _0x4b7e04=_0xf2b9[_0x25d610];return _0x4b7e04;};'use strict';var multer=require(_0x9f2b('0x0'));var util=require('util');var path=require(_0x9f2b('0x1'));var timeout=require('connect-timeout');var express=require(_0x9f2b('0x2'));var router=express[_0x9f2b('0x3')]();var auth=require(_0x9f2b('0x4'));var interaction=require(_0x9f2b('0x5'));var config=require(_0x9f2b('0x6'));var controller=require(_0x9f2b('0x7'));router[_0x9f2b('0x8')]('/',auth[_0x9f2b('0x9')](),controller[_0x9f2b('0xa')]);router['get'](_0x9f2b('0xb'),auth[_0x9f2b('0x9')](),controller[_0x9f2b('0xc')]);router['get']('/:id',auth[_0x9f2b('0x9')](),controller['show']);router[_0x9f2b('0x8')](_0x9f2b('0xd'),auth[_0x9f2b('0x9')](),controller['getMessages']);router['get']('/:id/download',auth[_0x9f2b('0x9')](),controller[_0x9f2b('0xe')]);router[_0x9f2b('0xf')]('/',auth['isAuthenticated'](),controller[_0x9f2b('0x10')]);router['post']('/:id/messages',auth[_0x9f2b('0x9')](),controller['addMessage']);router[_0x9f2b('0xf')](_0x9f2b('0x11'),auth[_0x9f2b('0x9')](),interaction[_0x9f2b('0x12')]('mail',_0x9f2b('0x13')),controller[_0x9f2b('0x14')]);router['put'](_0x9f2b('0x15'),auth[_0x9f2b('0x9')](),interaction[_0x9f2b('0x12')](_0x9f2b('0x16'),_0x9f2b('0x17')),controller[_0x9f2b('0x18')]);router[_0x9f2b('0x19')](_0x9f2b('0x15'),auth[_0x9f2b('0x9')](),interaction[_0x9f2b('0x12')]('mail','mailinteraction:destroy'),controller[_0x9f2b('0x1a')]);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0x9f2b('0x1b')]);module[_0x9f2b('0x1c')]=router;
\ No newline at end of file
index 75defdc..d62ba75 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2f36=['join','sequelize','html-to-text','iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM','out','getDataValue','lastMsgBody','fromString','split'];(function(_0xc54faf,_0x3ad988){var _0x88476f=function(_0x1a2d62){while(--_0x1a2d62){_0xc54faf['push'](_0xc54faf['shift']());}};_0x88476f(++_0x3ad988);}(_0x2f36,0x191));var _0x62f3=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x2f36[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require(_0x62f3('0x0'));var htmlToText=require(_0x62f3('0x1'));var iconv=require(_0x62f3('0x2'));module[_0x62f3('0x3')]={'closed':{'type':Sequelize[_0x62f3('0x4')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x62f3('0x5')]},'disposition':{'type':Sequelize[_0x62f3('0x6')]},'note':{'type':Sequelize[_0x62f3('0x6')]},'inReplyTo':{'type':Sequelize[_0x62f3('0x6')](0x1fe)},'to':{'type':Sequelize[_0x62f3('0x6')]},'cc':{'type':Sequelize[_0x62f3('0x7')](_0x62f3('0x8'))},'subject':{'type':Sequelize[_0x62f3('0x7')]()},'attach':{'type':Sequelize[_0x62f3('0x4')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x62f3('0x5')]},'substatus':{'type':Sequelize[_0x62f3('0x6')](0x3c)},'substatusAt':{'type':Sequelize[_0x62f3('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x62f3('0x9')]('in',_0x62f3('0xa')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x62f3('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x62f3('0x9')]('in',_0x62f3('0xa')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x62f3('0x7')](_0x62f3('0x8')),'get':function(){try{return this[_0x62f3('0xb')](_0x62f3('0xc'))?htmlToText[_0x62f3('0xd')](this[_0x62f3('0xb')](_0x62f3('0xc')),{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'ignoreImage':!![]})[_0x62f3('0xe')]('\x0a')['slice'](0x0,0x6)[_0x62f3('0xf')]('\x0a'):null;}catch(_0x36122b){return null;}}}};
\ No newline at end of file
+var _0x33b9=['BOOLEAN','DATE','STRING','TEXT','long','ENUM','out','getDataValue','lastMsgBody','split','slice','sequelize','iconv','exports'];(function(_0x1644d9,_0x559419){var _0x5ea68=function(_0x22485a){while(--_0x22485a){_0x1644d9['push'](_0x1644d9['shift']());}};_0x5ea68(++_0x559419);}(_0x33b9,0x1a1));var _0x933b=function(_0xb76a44,_0x159ecf){_0xb76a44=_0xb76a44-0x0;var _0x1290b3=_0x33b9[_0xb76a44];return _0x1290b3;};'use strict';var Sequelize=require(_0x933b('0x0'));var htmlToText=require('html-to-text');var iconv=require(_0x933b('0x1'));module[_0x933b('0x2')]={'closed':{'type':Sequelize[_0x933b('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x933b('0x4')]},'disposition':{'type':Sequelize[_0x933b('0x5')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x933b('0x5')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x933b('0x6')](_0x933b('0x7'))},'subject':{'type':Sequelize[_0x933b('0x6')]()},'attach':{'type':Sequelize[_0x933b('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x933b('0x4')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x933b('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x933b('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x933b('0x8')]('in',_0x933b('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x933b('0x6')]('long'),'get':function(){try{return this[_0x933b('0xa')](_0x933b('0xb'))?htmlToText['fromString'](this['getDataValue']('lastMsgBody'),{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'ignoreImage':!![]})[_0x933b('0xc')]('\x0a')[_0x933b('0xd')](0x0,0x6)['join']('\x0a'):null;}catch(_0x56cc65){return null;}}}};
\ No newline at end of file
index a40743b..f9361a6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdb1a=['addMessage','ids','omit','hasOwnProperty','MailInteractionId','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','findAll','spread','emit','mailInteractionTags:save','removeTags','unix','root','server','attachments','files','tmp','join','getMessages','Attachment','Attachments','mkdirSync','each','from','subject','basename','existsSync','type','readFileSync','build','writeFileSync','format','message%d.eml','download','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','end','status','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','MailInteraction','rawAttributes','keys','query','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','field','options','tag','include','push','Tags','distinct','MailMessage','Messages','createdAt','read','includeAll','fullname','CmContact','User','Owner','internal','MailAccount','Account','direction','Tag','color','rows','catch','show','filters','find','create','body','params','describe'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xdb1a,0x1bc));var _0xadb1=function(_0x59a50e,_0x578844){_0x59a50e=_0x59a50e-0x0;var _0x1e4bef=_0xdb1a[_0x59a50e];return _0x1e4bef;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xadb1('0x0'));var rimraf=require(_0xadb1('0x1'));var zipdir=require(_0xadb1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xadb1('0x3'));var moment=require('moment');var BPromise=require(_0xadb1('0x4'));var Mustache=require(_0xadb1('0x5'));var util=require(_0xadb1('0x6'));var path=require(_0xadb1('0x7'));var sox=require(_0xadb1('0x8'));var csv=require(_0xadb1('0x9'));var ejs=require(_0xadb1('0xa'));var fs=require('fs');var _=require(_0xadb1('0xb'));var squel=require('squel');var crypto=require(_0xadb1('0xc'));var jsforce=require(_0xadb1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xadb1('0x9'));var querystring=require(_0xadb1('0xe'));var Papa=require(_0xadb1('0xf'));var authService=require(_0xadb1('0x10'));var hardwareService=require(_0xadb1('0x11'));var Redis=require(_0xadb1('0x12'));var qs=require(_0xadb1('0x13'));var logger=require(_0xadb1('0x14'))(_0xadb1('0x15'));var utils=require('../../config/utils');var config=require(_0xadb1('0x16'));var db=require(_0xadb1('0x17'))['db'];config[_0xadb1('0x18')]=_['defaults'](config[_0xadb1('0x18')],{'host':_0xadb1('0x19'),'port':0x18eb});var socket=require(_0xadb1('0x1a'))(new Redis(config[_0xadb1('0x18')]));require(_0xadb1('0x1b'))['register'](socket);function respondWithStatusCode(_0x26a768,_0x1bffbe){_0x1bffbe=_0x1bffbe||0xcc;return function(_0x1f7544){if(_0x1f7544){return _0x26a768[_0xadb1('0x1c')](_0x1bffbe);}return _0x26a768['status'](_0x1bffbe)[_0xadb1('0x1d')]();};}function respondWithResult(_0x71ff15,_0x1bacb3){_0x1bacb3=_0x1bacb3||0xc8;return function(_0x5bc7ad){if(_0x5bc7ad){return _0x71ff15[_0xadb1('0x1e')](_0x1bacb3)['json'](_0x5bc7ad);}};}function respondWithFilteredResult(_0x38905b,_0x58e986){return function(_0x391007){if(_0x391007){var _0x46c28b=_0x391007[_0xadb1('0x1f')],_0x328111=_0x58e986[_0xadb1('0x20')],_0xa4949c=_0x58e986[_0xadb1('0x20')]+_0x58e986['limit'],_0x243b08;if(_0xa4949c>=_0x46c28b){_0xa4949c=_0x46c28b;_0x243b08=0xc8;}else{_0x243b08=0xce;}_0x38905b[_0xadb1('0x1e')](_0x243b08);return _0x38905b[_0xadb1('0x21')](_0xadb1('0x22'),_0x328111+'-'+_0xa4949c+'/'+_0x46c28b)[_0xadb1('0x23')](_0x391007);}return null;};}function patchUpdates(_0x5e6660){return function(_0xf649ae){try{jsonpatch[_0xadb1('0x24')](_0xf649ae,_0x5e6660,!![]);}catch(_0x49b848){return BPromise[_0xadb1('0x25')](_0x49b848);}return _0xf649ae[_0xadb1('0x26')]();};}function saveUpdates(_0x247bd6,_0x5e336e){return function(_0x44e39d){if(_0x44e39d){return _0x44e39d[_0xadb1('0x27')](_0x247bd6)[_0xadb1('0x28')](function(_0x3b2b0d){return _0x3b2b0d;});}return null;};}function removeEntity(_0x3c91e1,_0x149898){return function(_0x22128b){if(_0x22128b){return _0x22128b[_0xadb1('0x29')]()[_0xadb1('0x28')](function(){_0x3c91e1['status'](0xcc)[_0xadb1('0x1d')]();});}};}function handleEntityNotFound(_0x5b4175,_0x597803){return function(_0x3a8b8e){if(!_0x3a8b8e){_0x5b4175[_0xadb1('0x1c')](0x194);}return _0x3a8b8e;};}function handleError(_0x3fec16,_0xf1add){_0xf1add=_0xf1add||0x1f4;return function(_0x234ebb){logger[_0xadb1('0x2a')](_0x234ebb[_0xadb1('0x2b')]);if(_0x234ebb[_0xadb1('0x2c')]){delete _0x234ebb['name'];}_0x3fec16['status'](_0xf1add)[_0xadb1('0x2d')](_0x234ebb);};}exports[_0xadb1('0x2e')]=function(_0x46149a,_0x2a1bea){var _0x28ef46={},_0x5ec39d={},_0x46a63a={'count':0x0,'rows':[]};var _0x2ebbf6=db[_0xadb1('0x2f')][_0xadb1('0x30')];_0x5ec39d['model']=_[_0xadb1('0x31')](_0x2ebbf6);_0x5ec39d[_0xadb1('0x32')]=_[_0xadb1('0x31')](_0x46149a['query']);_0x5ec39d['filters']=_[_0xadb1('0x33')](_0x5ec39d[_0xadb1('0x34')],_0x5ec39d[_0xadb1('0x32')]);_0x28ef46[_0xadb1('0x35')]=_[_0xadb1('0x33')](_0x5ec39d[_0xadb1('0x34')],qs[_0xadb1('0x36')](_0x46149a[_0xadb1('0x32')][_0xadb1('0x36')]));_0x28ef46[_0xadb1('0x35')]=_0x28ef46[_0xadb1('0x35')][_0xadb1('0x37')]?_0x28ef46[_0xadb1('0x35')]:_0x5ec39d[_0xadb1('0x34')];if(!_0x46149a[_0xadb1('0x32')]['hasOwnProperty'](_0xadb1('0x38'))){_0x28ef46[_0xadb1('0x39')]=qs['limit'](_0x46149a['query'][_0xadb1('0x39')]);_0x28ef46[_0xadb1('0x20')]=qs[_0xadb1('0x20')](_0x46149a['query'][_0xadb1('0x20')]);}_0x28ef46[_0xadb1('0x3a')]=qs[_0xadb1('0x3b')](_0x46149a[_0xadb1('0x32')][_0xadb1('0x3b')]);_0x28ef46[_0xadb1('0x3c')]=qs['filters'](_[_0xadb1('0x3d')](_0x46149a[_0xadb1('0x32')],_0x5ec39d['filters']));if(_0x46149a[_0xadb1('0x32')][_0xadb1('0x3e')]){_0x28ef46[_0xadb1('0x3c')]=_[_0xadb1('0x3f')](_0x28ef46['where'],{'$or':_['map'](_0x2ebbf6,function(_0x51acfc){if(_0x51acfc['type']['key']!==_0xadb1('0x40')){var _0x2bcf2d={};_0x2bcf2d[_0x51acfc[_0xadb1('0x41')]]={'$like':'%'+_0x46149a['query'][_0xadb1('0x3e')]+'%'};return _0x2bcf2d;}})});}_0x28ef46=_[_0xadb1('0x3f')]({},_0x28ef46,_0x46149a[_0xadb1('0x42')]);var _0x40ca05={'where':_0x28ef46['where']};_0x40ca05['include']=[];if(_0x46149a[_0xadb1('0x32')][_0xadb1('0x43')]){_0x40ca05[_0xadb1('0x44')][_0xadb1('0x45')]({'model':db['Tag'],'as':_0xadb1('0x46'),'attributes':['id'],'where':{'id':_0x46149a['query'][_0xadb1('0x43')]},'required':!![]});_0x40ca05[_0xadb1('0x47')]=!![];}if(_0x46149a[_0xadb1('0x32')]['read']){_0x40ca05[_0xadb1('0x44')][_0xadb1('0x45')]({'model':db[_0xadb1('0x48')],'as':_0xadb1('0x49'),'attributes':['id','direction',_0xadb1('0x4a'),_0xadb1('0x4b')],'where':{'direction':'in','read':_0x46149a[_0xadb1('0x32')]['read']||![]},'required':!![]});_0x40ca05['distinct']=!![];}return db[_0xadb1('0x2f')]['count'](_0x40ca05)[_0xadb1('0x28')](function(_0x483dcb){_0x46a63a[_0xadb1('0x1f')]=_0x483dcb;if(_0x46149a['query'][_0xadb1('0x4c')]){_0x28ef46[_0xadb1('0x44')]=[{'model':db['User'],'as':'Users','required':![],'attributes':['id',_0xadb1('0x2c'),_0xadb1('0x4d')]},{'model':db[_0xadb1('0x4e')],'as':'Contact','required':![]},{'model':db[_0xadb1('0x4f')],'as':_0xadb1('0x50'),'attributes':[_0xadb1('0x2c'),_0xadb1('0x4d'),_0xadb1('0x51')],'required':![]},{'model':db[_0xadb1('0x52')],'as':_0xadb1('0x53'),'attributes':[_0xadb1('0x2c'),'key','email'],'required':![]},{'model':db[_0xadb1('0x48')],'as':_0xadb1('0x49'),'attributes':['id',_0xadb1('0x54'),_0xadb1('0x4a'),'read'],'where':{'direction':'in','read':_0x46149a[_0xadb1('0x32')]['read']||![]},'required':_0x46149a[_0xadb1('0x32')][_0xadb1('0x4b')]||![]},{'model':db[_0xadb1('0x55')],'as':_0xadb1('0x46'),'attributes':['id',_0xadb1('0x2c'),_0xadb1('0x56')],'required':_0x46149a['query']['tag']?!![]:![]},{'model':db[_0xadb1('0x55')],'as':'ThroughTags','attributes':['id','name',_0xadb1('0x56')],'through':_0x46149a[_0xadb1('0x32')][_0xadb1('0x43')]?{'attributes':[],'where':{'TagId':_0x46149a[_0xadb1('0x32')][_0xadb1('0x43')]||undefined}}:{},'required':_0x46149a[_0xadb1('0x32')][_0xadb1('0x43')]?!![]:![]}];}return db[_0xadb1('0x2f')]['findAll'](_0x28ef46);})[_0xadb1('0x28')](function(_0x2fa9de){_0x46a63a[_0xadb1('0x57')]=_0x2fa9de;return _0x46a63a;})[_0xadb1('0x28')](respondWithFilteredResult(_0x2a1bea,_0x28ef46))[_0xadb1('0x58')](handleError(_0x2a1bea,null));};exports[_0xadb1('0x59')]=function(_0x298b84,_0x2a5334){var _0x237579={'raw':![],'where':{'id':_0x298b84['params']['id']}},_0x536047={};_0x536047[_0xadb1('0x34')]=_[_0xadb1('0x31')](db['MailInteraction'][_0xadb1('0x30')]);_0x536047[_0xadb1('0x32')]=_[_0xadb1('0x31')](_0x298b84[_0xadb1('0x32')]);_0x536047[_0xadb1('0x5a')]=_[_0xadb1('0x33')](_0x536047[_0xadb1('0x34')],_0x536047[_0xadb1('0x32')]);_0x237579[_0xadb1('0x35')]=_[_0xadb1('0x33')](_0x536047[_0xadb1('0x34')],qs[_0xadb1('0x36')](_0x298b84[_0xadb1('0x32')][_0xadb1('0x36')]));_0x237579['attributes']=_0x237579[_0xadb1('0x35')][_0xadb1('0x37')]?_0x237579[_0xadb1('0x35')]:_0x536047[_0xadb1('0x34')];if(_0x298b84[_0xadb1('0x32')][_0xadb1('0x4c')]){_0x237579[_0xadb1('0x44')]=[{'all':!![]}];}_0x237579=_[_0xadb1('0x3f')]({},_0x237579,_0x298b84[_0xadb1('0x42')]);return db[_0xadb1('0x2f')][_0xadb1('0x5b')](_0x237579)['then'](handleEntityNotFound(_0x2a5334,null))[_0xadb1('0x28')](respondWithResult(_0x2a5334,null))[_0xadb1('0x58')](handleError(_0x2a5334,null));};exports[_0xadb1('0x5c')]=function(_0x433ffa,_0x30e249){return db[_0xadb1('0x2f')][_0xadb1('0x5c')](_0x433ffa[_0xadb1('0x5d')],{})[_0xadb1('0x28')](respondWithResult(_0x30e249,0xc9))[_0xadb1('0x58')](handleError(_0x30e249,null));};exports[_0xadb1('0x27')]=function(_0x514a07,_0x2697f6){if(_0x514a07['body']['id']){delete _0x514a07[_0xadb1('0x5d')]['id'];}return db['MailInteraction'][_0xadb1('0x5b')]({'where':{'id':_0x514a07[_0xadb1('0x5e')]['id']}})[_0xadb1('0x28')](handleEntityNotFound(_0x2697f6,null))[_0xadb1('0x28')](saveUpdates(_0x514a07[_0xadb1('0x5d')],null))[_0xadb1('0x28')](respondWithResult(_0x2697f6,null))['catch'](handleError(_0x2697f6,null));};exports['destroy']=function(_0x4176fc,_0x1fc6e1){return db['MailInteraction'][_0xadb1('0x5b')]({'where':{'id':_0x4176fc['params']['id']}})['then'](handleEntityNotFound(_0x1fc6e1,null))[_0xadb1('0x28')](removeEntity(_0x1fc6e1,null))[_0xadb1('0x58')](handleError(_0x1fc6e1,null));};exports[_0xadb1('0x5f')]=function(_0x26d571,_0x927841){return db[_0xadb1('0x2f')][_0xadb1('0x5f')]()['then'](respondWithResult(_0x927841,null))[_0xadb1('0x58')](handleError(_0x927841,null));};exports[_0xadb1('0x60')]=function(_0xcf2c84,_0x17990c,_0x4e8aa0){return db[_0xadb1('0x48')][_0xadb1('0x5b')]({'where':{'id':_0xcf2c84[_0xadb1('0x5e')]['id']}})['then'](handleEntityNotFound(_0x17990c,null))[_0xadb1('0x28')](function(_0x3c7b60){if(_0x3c7b60){return _0x3c7b60[_0xadb1('0x60')](_0xcf2c84['body'][_0xadb1('0x61')],_[_0xadb1('0x62')](_0xcf2c84['body'],['ids','id'])||{});}})[_0xadb1('0x28')](respondWithResult(_0x17990c,null))[_0xadb1('0x58')](handleError(_0x17990c,null));};exports['getMessages']=function(_0xbd8e,_0x41b44a,_0x3a68f0){var _0x50d40e={'raw':![],'where':{}};var _0x37099f={};var _0x3cf9e7={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0xbd8e['params']['id']}})['then'](handleEntityNotFound(_0x41b44a,null))[_0xadb1('0x28')](function(_0xe61f08){if(_0xe61f08){_0x37099f[_0xadb1('0x34')]=_[_0xadb1('0x31')](db['MailMessage'][_0xadb1('0x30')]);_0x37099f[_0xadb1('0x32')]=_[_0xadb1('0x31')](_0xbd8e[_0xadb1('0x32')]);_0x37099f[_0xadb1('0x5a')]=_[_0xadb1('0x33')](_0x37099f[_0xadb1('0x34')],_0x37099f[_0xadb1('0x32')]);_0x50d40e[_0xadb1('0x35')]=_[_0xadb1('0x33')](_0x37099f[_0xadb1('0x34')],qs[_0xadb1('0x36')](_0xbd8e['query'][_0xadb1('0x36')]));_0x50d40e[_0xadb1('0x35')]=_0x50d40e[_0xadb1('0x35')]['length']?_0x50d40e[_0xadb1('0x35')]:_0x37099f['model'];if(!_0xbd8e[_0xadb1('0x32')][_0xadb1('0x63')](_0xadb1('0x38'))){_0x50d40e[_0xadb1('0x39')]=qs[_0xadb1('0x39')](_0xbd8e[_0xadb1('0x32')][_0xadb1('0x39')]);_0x50d40e[_0xadb1('0x20')]=qs[_0xadb1('0x20')](_0xbd8e['query'][_0xadb1('0x20')]);}_0x50d40e[_0xadb1('0x3a')]=qs[_0xadb1('0x3b')](_0xbd8e[_0xadb1('0x32')]['sort']);_0x50d40e[_0xadb1('0x3c')]=qs[_0xadb1('0x5a')](_[_0xadb1('0x3d')](_0xbd8e[_0xadb1('0x32')],_0x37099f[_0xadb1('0x5a')]));_0x50d40e['where'][_0xadb1('0x64')]=_0xe61f08['id'];if(_0xbd8e[_0xadb1('0x32')][_0xadb1('0x3e')]){_0x50d40e[_0xadb1('0x3c')]=_[_0xadb1('0x3f')](_0x50d40e[_0xadb1('0x3c')],{'$or':_[_0xadb1('0x65')](_0x50d40e[_0xadb1('0x35')],function(_0x2bdf62){var _0x20a655={};_0x20a655[_0x2bdf62]={'$like':'%'+_0xbd8e[_0xadb1('0x32')]['filter']+'%'};return _0x20a655;})});}if(_0xbd8e['query'][_0xadb1('0x66')]){var _0x32cc93=_0xbd8e[_0xadb1('0x32')][_0xadb1('0x66')][_0xadb1('0x67')](',');var _0x25e5ed={};_0x25e5ed[_0x32cc93[0x0]]={'$gte':moment(_0x32cc93[0x1])['format'](_0xadb1('0x68'))};_0x50d40e[_0xadb1('0x3c')]=_[_0xadb1('0x3f')](_0x50d40e[_0xadb1('0x3c')],_0x25e5ed);}_0x50d40e=_[_0xadb1('0x3f')]({},_0x50d40e,_0xbd8e[_0xadb1('0x42')]);return db[_0xadb1('0x48')][_0xadb1('0x1f')]({'where':_0x50d40e[_0xadb1('0x3c')]})[_0xadb1('0x28')](function(_0x106718){_0x3cf9e7[_0xadb1('0x1f')]=_0x106718;if(_0xbd8e['query']['includeAll']){_0x50d40e[_0xadb1('0x44')]=[{'all':!![]}];}return db[_0xadb1('0x48')][_0xadb1('0x69')](_0x50d40e);})['then'](function(_0x2dc3ba){_0x3cf9e7[_0xadb1('0x57')]=_0x2dc3ba;return _0x3cf9e7;});}})[_0xadb1('0x28')](respondWithFilteredResult(_0x41b44a,_0x50d40e))[_0xadb1('0x58')](handleError(_0x41b44a,null));};exports['addTags']=function(_0xa2d4bc,_0x4fa997,_0x39deda){return db[_0xadb1('0x2f')][_0xadb1('0x5b')]({'where':{'id':_0xa2d4bc[_0xadb1('0x5e')]['id']}})[_0xadb1('0x28')](handleEntityNotFound(_0x4fa997,null))['then'](function(_0x51bc79){if(_0x51bc79){return _0x51bc79['setTags'](_0xa2d4bc[_0xadb1('0x5d')][_0xadb1('0x61')],_['omit'](_0xa2d4bc[_0xadb1('0x5d')],[_0xadb1('0x61'),'id'])||{})[_0xadb1('0x6a')](function(){return db[_0xadb1('0x55')][_0xadb1('0x69')]({'attributes':['id',_0xadb1('0x2c'),_0xadb1('0x56')],'where':{'id':_0xa2d4bc[_0xadb1('0x5d')][_0xadb1('0x61')]}});})[_0xadb1('0x28')](function(_0x6450cf){socket[_0xadb1('0x6b')](_0xadb1('0x6c'),{'id':Number(_0xa2d4bc['params']['id']),'tags':_0x6450cf||[]});return{'id':Number(_0xa2d4bc[_0xadb1('0x5e')]['id']),'tags':_0x6450cf||[]};});}})[_0xadb1('0x28')](respondWithResult(_0x4fa997,null))[_0xadb1('0x58')](handleError(_0x4fa997,null));};exports['removeTags']=function(_0x1606e1,_0x53b3b3,_0x896c86){var _0x1abe06;return db[_0xadb1('0x2f')][_0xadb1('0x5b')]({'where':{'id':_0x1606e1[_0xadb1('0x5e')]['id']}})[_0xadb1('0x28')](handleEntityNotFound(_0x53b3b3,null))['then'](function(_0x50cfed){if(_0x50cfed){return _0x50cfed[_0xadb1('0x6d')](_0x1606e1[_0xadb1('0x32')]['ids']);}})[_0xadb1('0x28')](respondWithStatusCode(_0x53b3b3,null))['catch'](handleError(_0x53b3b3,null));};exports['download']=function(_0x32f773,_0x6fd2a5){var _0x2e43cc=moment()[_0xadb1('0x6e')]()['toString']();var _0x1510e6=path['join'](config[_0xadb1('0x6f')],_0xadb1('0x70'),'files',_0xadb1('0x71'));var _0x552904=path['join'](config['root'],_0xadb1('0x70'),_0xadb1('0x72'),_0xadb1('0x73'));var _0x1845c5=path[_0xadb1('0x74')](_0x552904,_0x2e43cc);var _0x54ebb0=util['format']('interaction-%s.zip',_0x2e43cc);var _0x176b0=path[_0xadb1('0x74')](_0x552904,_0x54ebb0);var _0x1f6e22=![];return db[_0xadb1('0x2f')][_0xadb1('0x5b')]({'where':{'id':_0x32f773[_0xadb1('0x5e')]['id']}})[_0xadb1('0x28')](handleEntityNotFound(_0x6fd2a5,null))[_0xadb1('0x28')](function(_0x2319e3){if(_0x2319e3){return _0x2319e3[_0xadb1('0x75')]({'attributes':['id',_0xadb1('0x5d'),'from','to','cc','subject','createdAt'],'where':{'secret':![]},'include':_0x32f773[_0xadb1('0x32')]['attachments']?[{'model':db[_0xadb1('0x76')],'as':_0xadb1('0x77')}]:undefined,'order':qs[_0xadb1('0x3b')]('id')});}return[];})[_0xadb1('0x28')](function(_0x50f6fd){_0x1f6e22=_0x50f6fd[_0xadb1('0x37')];if(_0x50f6fd[_0xadb1('0x37')]){fs[_0xadb1('0x78')](_0x1845c5);return BPromise[_0xadb1('0x79')](_0x50f6fd,function(_0x338074,_0x50b5ca){var _0x20b4c8=_0x338074;var _0x29563e={'from':_0x20b4c8[_0xadb1('0x7a')],'to':_0x20b4c8['to'],'subject':_0x20b4c8[_0xadb1('0x7b')],'html':_0x20b4c8[_0xadb1('0x5d')],'attachments':[]};return new BPromise(function(_0xda509f,_0x5a0a1b){if(_0x338074[_0xadb1('0x77')]){for(var _0x16cb02=0x0;_0x16cb02<_0x338074[_0xadb1('0x77')][_0xadb1('0x37')];_0x16cb02++){var _0x3c7308=_0x338074[_0xadb1('0x77')][_0x16cb02];var _0x303045=path[_0xadb1('0x74')](_0x1510e6,_0x3c7308[_0xadb1('0x7c')]);if(fs[_0xadb1('0x7d')](_0x303045)){_0x29563e[_0xadb1('0x71')][_0xadb1('0x45')]({'name':_0x3c7308[_0xadb1('0x2c')],'contentType':_0x3c7308[_0xadb1('0x7e')],'data':fs[_0xadb1('0x7f')](_0x303045)});}}}emlformat[_0xadb1('0x80')](_0x29563e,function(_0x4b018c,_0x413ed5){if(_0x4b018c)return _0x5a0a1b(_0x4b018c);fs[_0xadb1('0x81')](path[_0xadb1('0x74')](_0x1845c5,util[_0xadb1('0x82')](_0xadb1('0x83'),_0x50b5ca)),_0x413ed5);return _0xda509f(_0x413ed5);});});});}})['then'](function(){if(_0x1f6e22){return new BPromise(function(_0x2d0b3b,_0x4d27cf){zipdir(_0x1845c5,{'saveTo':_0x176b0},function(_0x41ec98,_0x1f2bdc){if(_0x41ec98)return _0x4d27cf(_0x41ec98);return _0x2d0b3b(_0x1f2bdc);});});}})[_0xadb1('0x28')](function(){if(_0x1f6e22){return new BPromise(function(_0x693ad4,_0x1a0fb3){rimraf(_0x1845c5,function(_0x79591d){if(_0x79591d)_0x1a0fb3(_0x79591d);return _0x693ad4();});});}})[_0xadb1('0x28')](function(){if(_0x1f6e22){return _0x6fd2a5[_0xadb1('0x84')](_0x176b0,_0x54ebb0,function(_0x309923){if(_0x309923){console['log'](_0xadb1('0x85'),_0x309923);}else{fs[_0xadb1('0x86')](_0x176b0);}});}else{return _0x6fd2a5['sendStatus'](0xc8);}})['catch'](handleError(_0x6fd2a5,null));};
\ No newline at end of file
+var _0x9a5c=['path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','apply','save','update','then','destroy','stack','name','send','index','MailInteraction','rawAttributes','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','type','key','field','options','include','push','Tag','Tags','tag','distinct','read','MailMessage','direction','createdAt','User','Users','fullname','CmContact','Contact','Owner','internal','Account','email','Messages','color','ThroughTags','findAll','rows','catch','show','params','keys','length','includeAll','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','spread','mailInteractionTags:save','removeTags','download','toString','join','root','server','files','attachments','tmp','format','from','subject','Attachment','Attachments','mkdirSync','each','basename','existsSync','readFileSync','build','writeFileSync','log','err','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x9d8f50,_0x1cc2c1){var _0x171f13=function(_0x119eec){while(--_0x119eec){_0x9d8f50['push'](_0x9d8f50['shift']());}};_0x171f13(++_0x1cc2c1);}(_0x9a5c,0x184));var _0xc9a5=function(_0x3858e6,_0xfb5f5b){_0x3858e6=_0x3858e6-0x0;var _0x22c3e3=_0x9a5c[_0x3858e6];return _0x22c3e3;};'use strict';var pdf=require(_0xc9a5('0x0'));var emlformat=require(_0xc9a5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc9a5('0x2'));var jsonpatch=require(_0xc9a5('0x3'));var rp=require(_0xc9a5('0x4'));var moment=require(_0xc9a5('0x5'));var BPromise=require(_0xc9a5('0x6'));var Mustache=require(_0xc9a5('0x7'));var util=require('util');var path=require(_0xc9a5('0x8'));var sox=require(_0xc9a5('0x9'));var csv=require(_0xc9a5('0xa'));var ejs=require(_0xc9a5('0xb'));var fs=require('fs');var _=require(_0xc9a5('0xc'));var squel=require(_0xc9a5('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc9a5('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc9a5('0xf'));var Papa=require('papaparse');var authService=require(_0xc9a5('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0xc9a5('0x11'));var qs=require(_0xc9a5('0x12'));var logger=require(_0xc9a5('0x13'))(_0xc9a5('0x14'));var utils=require(_0xc9a5('0x15'));var config=require(_0xc9a5('0x16'));var db=require(_0xc9a5('0x17'))['db'];config['redis']=_[_0xc9a5('0x18')](config[_0xc9a5('0x19')],{'host':_0xc9a5('0x1a'),'port':0x18eb});var socket=require(_0xc9a5('0x1b'))(new Redis(config[_0xc9a5('0x19')]));require(_0xc9a5('0x1c'))[_0xc9a5('0x1d')](socket);function respondWithStatusCode(_0xa54f8e,_0xe9e31e){_0xe9e31e=_0xe9e31e||0xcc;return function(_0x1e5439){if(_0x1e5439){return _0xa54f8e[_0xc9a5('0x1e')](_0xe9e31e);}return _0xa54f8e[_0xc9a5('0x1f')](_0xe9e31e)[_0xc9a5('0x20')]();};}function respondWithResult(_0x46f9ab,_0x422973){_0x422973=_0x422973||0xc8;return function(_0x50bb71){if(_0x50bb71){return _0x46f9ab['status'](_0x422973)[_0xc9a5('0x21')](_0x50bb71);}};}function respondWithFilteredResult(_0x2746bb,_0x6eb994){return function(_0x4ef3c6){if(_0x4ef3c6){var _0x1d8a4a=_0x4ef3c6[_0xc9a5('0x22')],_0x18581c=_0x6eb994[_0xc9a5('0x23')],_0x4a0193=_0x6eb994[_0xc9a5('0x23')]+_0x6eb994[_0xc9a5('0x24')],_0x2f21a8;if(_0x4a0193>=_0x1d8a4a){_0x4a0193=_0x1d8a4a;_0x2f21a8=0xc8;}else{_0x2f21a8=0xce;}_0x2746bb[_0xc9a5('0x1f')](_0x2f21a8);return _0x2746bb['set']('Content-Range',_0x18581c+'-'+_0x4a0193+'/'+_0x1d8a4a)[_0xc9a5('0x21')](_0x4ef3c6);}return null;};}function patchUpdates(_0x564ef5){return function(_0x5093f2){try{jsonpatch[_0xc9a5('0x25')](_0x5093f2,_0x564ef5,!![]);}catch(_0x390277){return BPromise['reject'](_0x390277);}return _0x5093f2[_0xc9a5('0x26')]();};}function saveUpdates(_0x13ca04,_0x16328c){return function(_0x50b7f2){if(_0x50b7f2){return _0x50b7f2[_0xc9a5('0x27')](_0x13ca04)[_0xc9a5('0x28')](function(_0x23af68){return _0x23af68;});}return null;};}function removeEntity(_0x480718,_0x45d35b){return function(_0x18c41e){if(_0x18c41e){return _0x18c41e[_0xc9a5('0x29')]()[_0xc9a5('0x28')](function(){_0x480718[_0xc9a5('0x1f')](0xcc)[_0xc9a5('0x20')]();});}};}function handleEntityNotFound(_0x5eaaa8,_0x3887b8){return function(_0x1071f5){if(!_0x1071f5){_0x5eaaa8[_0xc9a5('0x1e')](0x194);}return _0x1071f5;};}function handleError(_0x46e3a5,_0x5963f0){_0x5963f0=_0x5963f0||0x1f4;return function(_0x4cbd72){logger['error'](_0x4cbd72[_0xc9a5('0x2a')]);if(_0x4cbd72[_0xc9a5('0x2b')]){delete _0x4cbd72[_0xc9a5('0x2b')];}_0x46e3a5[_0xc9a5('0x1f')](_0x5963f0)[_0xc9a5('0x2c')](_0x4cbd72);};}exports[_0xc9a5('0x2d')]=function(_0x35f595,_0x56b1f2){var _0x143f9a={},_0x4c8286={},_0x4e13b2={'count':0x0,'rows':[]};var _0x15cef0=db[_0xc9a5('0x2e')][_0xc9a5('0x2f')];_0x4c8286[_0xc9a5('0x30')]=_['keys'](_0x15cef0);_0x4c8286['query']=_['keys'](_0x35f595[_0xc9a5('0x31')]);_0x4c8286[_0xc9a5('0x32')]=_[_0xc9a5('0x33')](_0x4c8286['model'],_0x4c8286[_0xc9a5('0x31')]);_0x143f9a[_0xc9a5('0x34')]=_[_0xc9a5('0x33')](_0x4c8286[_0xc9a5('0x30')],qs[_0xc9a5('0x35')](_0x35f595[_0xc9a5('0x31')][_0xc9a5('0x35')]));_0x143f9a[_0xc9a5('0x34')]=_0x143f9a[_0xc9a5('0x34')]['length']?_0x143f9a[_0xc9a5('0x34')]:_0x4c8286['model'];if(!_0x35f595[_0xc9a5('0x31')]['hasOwnProperty'](_0xc9a5('0x36'))){_0x143f9a['limit']=qs[_0xc9a5('0x24')](_0x35f595[_0xc9a5('0x31')]['limit']);_0x143f9a[_0xc9a5('0x23')]=qs['offset'](_0x35f595['query']['offset']);}_0x143f9a[_0xc9a5('0x37')]=qs[_0xc9a5('0x38')](_0x35f595[_0xc9a5('0x31')][_0xc9a5('0x38')]);_0x143f9a[_0xc9a5('0x39')]=qs[_0xc9a5('0x32')](_[_0xc9a5('0x3a')](_0x35f595['query'],_0x4c8286['filters']));if(_0x35f595[_0xc9a5('0x31')][_0xc9a5('0x3b')]){_0x143f9a[_0xc9a5('0x39')]=_[_0xc9a5('0x3c')](_0x143f9a[_0xc9a5('0x39')],{'$or':_['map'](_0x15cef0,function(_0x34d6a6){if(_0x34d6a6[_0xc9a5('0x3d')][_0xc9a5('0x3e')]!=='VIRTUAL'){var _0x2c3142={};_0x2c3142[_0x34d6a6[_0xc9a5('0x3f')]]={'$like':'%'+_0x35f595[_0xc9a5('0x31')][_0xc9a5('0x3b')]+'%'};return _0x2c3142;}})});}_0x143f9a=_[_0xc9a5('0x3c')]({},_0x143f9a,_0x35f595[_0xc9a5('0x40')]);var _0x4fa21e={'where':_0x143f9a[_0xc9a5('0x39')]};_0x4fa21e[_0xc9a5('0x41')]=[];if(_0x35f595[_0xc9a5('0x31')]['tag']){_0x4fa21e[_0xc9a5('0x41')][_0xc9a5('0x42')]({'model':db[_0xc9a5('0x43')],'as':_0xc9a5('0x44'),'attributes':['id'],'where':{'id':_0x35f595['query'][_0xc9a5('0x45')]},'required':!![]});_0x4fa21e[_0xc9a5('0x46')]=!![];}if(_0x35f595[_0xc9a5('0x31')][_0xc9a5('0x47')]){_0x4fa21e[_0xc9a5('0x41')][_0xc9a5('0x42')]({'model':db[_0xc9a5('0x48')],'as':'Messages','attributes':['id',_0xc9a5('0x49'),_0xc9a5('0x4a'),_0xc9a5('0x47')],'where':{'direction':'in','read':_0x35f595['query'][_0xc9a5('0x47')]||![]},'required':!![]});_0x4fa21e[_0xc9a5('0x46')]=!![];}return db[_0xc9a5('0x2e')]['count'](_0x4fa21e)[_0xc9a5('0x28')](function(_0x19adfc){_0x4e13b2[_0xc9a5('0x22')]=_0x19adfc;if(_0x35f595['query']['includeAll']){_0x143f9a[_0xc9a5('0x41')]=[{'model':db[_0xc9a5('0x4b')],'as':_0xc9a5('0x4c'),'required':![],'attributes':['id','name',_0xc9a5('0x4d')]},{'model':db[_0xc9a5('0x4e')],'as':_0xc9a5('0x4f'),'required':![]},{'model':db[_0xc9a5('0x4b')],'as':_0xc9a5('0x50'),'attributes':[_0xc9a5('0x2b'),_0xc9a5('0x4d'),_0xc9a5('0x51')],'required':![]},{'model':db['MailAccount'],'as':_0xc9a5('0x52'),'attributes':['name','key',_0xc9a5('0x53')],'required':![]},{'model':db['MailMessage'],'as':_0xc9a5('0x54'),'attributes':['id',_0xc9a5('0x49'),_0xc9a5('0x4a'),_0xc9a5('0x47')],'where':{'direction':'in','read':_0x35f595['query'][_0xc9a5('0x47')]||![]},'required':_0x35f595[_0xc9a5('0x31')][_0xc9a5('0x47')]||![]},{'model':db[_0xc9a5('0x43')],'as':_0xc9a5('0x44'),'attributes':['id',_0xc9a5('0x2b'),_0xc9a5('0x55')],'required':_0x35f595[_0xc9a5('0x31')][_0xc9a5('0x45')]?!![]:![]},{'model':db['Tag'],'as':_0xc9a5('0x56'),'attributes':['id','name',_0xc9a5('0x55')],'through':_0x35f595['query'][_0xc9a5('0x45')]?{'attributes':[],'where':{'TagId':_0x35f595[_0xc9a5('0x31')][_0xc9a5('0x45')]||undefined}}:{},'required':_0x35f595[_0xc9a5('0x31')][_0xc9a5('0x45')]?!![]:![]}];}return db[_0xc9a5('0x2e')][_0xc9a5('0x57')](_0x143f9a);})['then'](function(_0x44ef84){_0x4e13b2[_0xc9a5('0x58')]=_0x44ef84;return _0x4e13b2;})[_0xc9a5('0x28')](respondWithFilteredResult(_0x56b1f2,_0x143f9a))[_0xc9a5('0x59')](handleError(_0x56b1f2,null));};exports[_0xc9a5('0x5a')]=function(_0x309353,_0x55ba76){var _0x14d106={'raw':![],'where':{'id':_0x309353[_0xc9a5('0x5b')]['id']}},_0x2566a3={};_0x2566a3['model']=_[_0xc9a5('0x5c')](db[_0xc9a5('0x2e')][_0xc9a5('0x2f')]);_0x2566a3[_0xc9a5('0x31')]=_[_0xc9a5('0x5c')](_0x309353[_0xc9a5('0x31')]);_0x2566a3[_0xc9a5('0x32')]=_['intersection'](_0x2566a3['model'],_0x2566a3[_0xc9a5('0x31')]);_0x14d106['attributes']=_[_0xc9a5('0x33')](_0x2566a3[_0xc9a5('0x30')],qs['fields'](_0x309353[_0xc9a5('0x31')][_0xc9a5('0x35')]));_0x14d106[_0xc9a5('0x34')]=_0x14d106[_0xc9a5('0x34')][_0xc9a5('0x5d')]?_0x14d106[_0xc9a5('0x34')]:_0x2566a3[_0xc9a5('0x30')];if(_0x309353[_0xc9a5('0x31')][_0xc9a5('0x5e')]){_0x14d106[_0xc9a5('0x41')]=[{'all':!![]}];}_0x14d106=_[_0xc9a5('0x3c')]({},_0x14d106,_0x309353['options']);return db[_0xc9a5('0x2e')][_0xc9a5('0x5f')](_0x14d106)[_0xc9a5('0x28')](handleEntityNotFound(_0x55ba76,null))[_0xc9a5('0x28')](respondWithResult(_0x55ba76,null))[_0xc9a5('0x59')](handleError(_0x55ba76,null));};exports[_0xc9a5('0x60')]=function(_0x43cab4,_0x51cfdc){return db['MailInteraction'][_0xc9a5('0x60')](_0x43cab4[_0xc9a5('0x61')],{})[_0xc9a5('0x28')](respondWithResult(_0x51cfdc,0xc9))[_0xc9a5('0x59')](handleError(_0x51cfdc,null));};exports['update']=function(_0x34ad28,_0x6837ce){if(_0x34ad28[_0xc9a5('0x61')]['id']){delete _0x34ad28['body']['id'];}return db[_0xc9a5('0x2e')][_0xc9a5('0x5f')]({'where':{'id':_0x34ad28[_0xc9a5('0x5b')]['id']}})[_0xc9a5('0x28')](handleEntityNotFound(_0x6837ce,null))[_0xc9a5('0x28')](saveUpdates(_0x34ad28[_0xc9a5('0x61')],null))[_0xc9a5('0x28')](respondWithResult(_0x6837ce,null))[_0xc9a5('0x59')](handleError(_0x6837ce,null));};exports[_0xc9a5('0x29')]=function(_0x57de84,_0x2dc17e){return db[_0xc9a5('0x2e')][_0xc9a5('0x5f')]({'where':{'id':_0x57de84[_0xc9a5('0x5b')]['id']}})[_0xc9a5('0x28')](handleEntityNotFound(_0x2dc17e,null))['then'](removeEntity(_0x2dc17e,null))[_0xc9a5('0x59')](handleError(_0x2dc17e,null));};exports[_0xc9a5('0x62')]=function(_0x329ee5,_0xb1aec7){return db[_0xc9a5('0x2e')]['describe']()['then'](respondWithResult(_0xb1aec7,null))[_0xc9a5('0x59')](handleError(_0xb1aec7,null));};exports[_0xc9a5('0x63')]=function(_0x3e01f3,_0x457b9d,_0x36a404){return db[_0xc9a5('0x48')][_0xc9a5('0x5f')]({'where':{'id':_0x3e01f3[_0xc9a5('0x5b')]['id']}})['then'](handleEntityNotFound(_0x457b9d,null))['then'](function(_0x5d0c0e){if(_0x5d0c0e){return _0x5d0c0e['addMessage'](_0x3e01f3['body'][_0xc9a5('0x64')],_[_0xc9a5('0x65')](_0x3e01f3[_0xc9a5('0x61')],[_0xc9a5('0x64'),'id'])||{});}})['then'](respondWithResult(_0x457b9d,null))[_0xc9a5('0x59')](handleError(_0x457b9d,null));};exports[_0xc9a5('0x66')]=function(_0x425919,_0x2521c1,_0x48afb7){var _0x5bf02d={'raw':![],'where':{}};var _0x2b3b77={};var _0x3936f9={'count':0x0,'rows':[]};return db['MailInteraction'][_0xc9a5('0x67')]({'where':{'id':_0x425919[_0xc9a5('0x5b')]['id']}})[_0xc9a5('0x28')](handleEntityNotFound(_0x2521c1,null))[_0xc9a5('0x28')](function(_0x22f24a){if(_0x22f24a){_0x2b3b77[_0xc9a5('0x30')]=_['keys'](db[_0xc9a5('0x48')][_0xc9a5('0x2f')]);_0x2b3b77[_0xc9a5('0x31')]=_[_0xc9a5('0x5c')](_0x425919[_0xc9a5('0x31')]);_0x2b3b77[_0xc9a5('0x32')]=_['intersection'](_0x2b3b77['model'],_0x2b3b77[_0xc9a5('0x31')]);_0x5bf02d[_0xc9a5('0x34')]=_[_0xc9a5('0x33')](_0x2b3b77[_0xc9a5('0x30')],qs[_0xc9a5('0x35')](_0x425919['query'][_0xc9a5('0x35')]));_0x5bf02d[_0xc9a5('0x34')]=_0x5bf02d[_0xc9a5('0x34')][_0xc9a5('0x5d')]?_0x5bf02d[_0xc9a5('0x34')]:_0x2b3b77['model'];if(!_0x425919[_0xc9a5('0x31')][_0xc9a5('0x68')](_0xc9a5('0x36'))){_0x5bf02d['limit']=qs['limit'](_0x425919['query'][_0xc9a5('0x24')]);_0x5bf02d[_0xc9a5('0x23')]=qs[_0xc9a5('0x23')](_0x425919[_0xc9a5('0x31')]['offset']);}_0x5bf02d[_0xc9a5('0x37')]=qs[_0xc9a5('0x38')](_0x425919[_0xc9a5('0x31')][_0xc9a5('0x38')]);_0x5bf02d[_0xc9a5('0x39')]=qs[_0xc9a5('0x32')](_[_0xc9a5('0x3a')](_0x425919['query'],_0x2b3b77[_0xc9a5('0x32')]));_0x5bf02d['where']['MailInteractionId']=_0x22f24a['id'];if(_0x425919[_0xc9a5('0x31')][_0xc9a5('0x3b')]){_0x5bf02d[_0xc9a5('0x39')]=_['merge'](_0x5bf02d[_0xc9a5('0x39')],{'$or':_['map'](_0x5bf02d[_0xc9a5('0x34')],function(_0x412699){var _0x5a7991={};_0x5a7991[_0x412699]={'$like':'%'+_0x425919[_0xc9a5('0x31')][_0xc9a5('0x3b')]+'%'};return _0x5a7991;})});}if(_0x425919[_0xc9a5('0x31')]['$gte']){var _0x81d8c=_0x425919['query']['$gte']['split'](',');var _0x39b3a3={};_0x39b3a3[_0x81d8c[0x0]]={'$gte':moment(_0x81d8c[0x1])['format'](_0xc9a5('0x69'))};_0x5bf02d[_0xc9a5('0x39')]=_[_0xc9a5('0x3c')](_0x5bf02d[_0xc9a5('0x39')],_0x39b3a3);}_0x5bf02d=_[_0xc9a5('0x3c')]({},_0x5bf02d,_0x425919[_0xc9a5('0x40')]);return db[_0xc9a5('0x48')]['count']({'where':_0x5bf02d['where']})['then'](function(_0x22a441){_0x3936f9['count']=_0x22a441;if(_0x425919['query'][_0xc9a5('0x5e')]){_0x5bf02d[_0xc9a5('0x41')]=[{'all':!![]}];}return db['MailMessage'][_0xc9a5('0x57')](_0x5bf02d);})[_0xc9a5('0x28')](function(_0x379c3d){_0x3936f9[_0xc9a5('0x58')]=_0x379c3d;return _0x3936f9;});}})[_0xc9a5('0x28')](respondWithFilteredResult(_0x2521c1,_0x5bf02d))[_0xc9a5('0x59')](handleError(_0x2521c1,null));};exports['addTags']=function(_0x4c40a2,_0x3a58d6,_0x3890e4){return db[_0xc9a5('0x2e')][_0xc9a5('0x5f')]({'where':{'id':_0x4c40a2[_0xc9a5('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3a58d6,null))[_0xc9a5('0x28')](function(_0x439660){if(_0x439660){return _0x439660['setTags'](_0x4c40a2[_0xc9a5('0x61')][_0xc9a5('0x64')],_[_0xc9a5('0x65')](_0x4c40a2['body'],[_0xc9a5('0x64'),'id'])||{})[_0xc9a5('0x6a')](function(){return db[_0xc9a5('0x43')][_0xc9a5('0x57')]({'attributes':['id',_0xc9a5('0x2b'),_0xc9a5('0x55')],'where':{'id':_0x4c40a2[_0xc9a5('0x61')][_0xc9a5('0x64')]}});})[_0xc9a5('0x28')](function(_0x35b2c1){socket['emit'](_0xc9a5('0x6b'),{'id':Number(_0x4c40a2[_0xc9a5('0x5b')]['id']),'tags':_0x35b2c1||[]});return{'id':Number(_0x4c40a2['params']['id']),'tags':_0x35b2c1||[]};});}})[_0xc9a5('0x28')](respondWithResult(_0x3a58d6,null))[_0xc9a5('0x59')](handleError(_0x3a58d6,null));};exports[_0xc9a5('0x6c')]=function(_0x315803,_0x4d7ffb,_0x25ceae){var _0xaa9df3;return db[_0xc9a5('0x2e')][_0xc9a5('0x5f')]({'where':{'id':_0x315803[_0xc9a5('0x5b')]['id']}})[_0xc9a5('0x28')](handleEntityNotFound(_0x4d7ffb,null))[_0xc9a5('0x28')](function(_0x2552b3){if(_0x2552b3){return _0x2552b3[_0xc9a5('0x6c')](_0x315803[_0xc9a5('0x31')][_0xc9a5('0x64')]);}})[_0xc9a5('0x28')](respondWithStatusCode(_0x4d7ffb,null))['catch'](handleError(_0x4d7ffb,null));};exports[_0xc9a5('0x6d')]=function(_0x4d88c5,_0x5dbb0f){var _0x16cf39=moment()['unix']()[_0xc9a5('0x6e')]();var _0x17506d=path[_0xc9a5('0x6f')](config[_0xc9a5('0x70')],_0xc9a5('0x71'),_0xc9a5('0x72'),_0xc9a5('0x73'));var _0x220557=path[_0xc9a5('0x6f')](config[_0xc9a5('0x70')],_0xc9a5('0x71'),_0xc9a5('0x72'),_0xc9a5('0x74'));var _0x21fca7=path[_0xc9a5('0x6f')](_0x220557,_0x16cf39);var _0x4fa88f=util[_0xc9a5('0x75')]('interaction-%s.zip',_0x16cf39);var _0x237da6=path[_0xc9a5('0x6f')](_0x220557,_0x4fa88f);var _0x1939cd=![];return db['MailInteraction'][_0xc9a5('0x5f')]({'where':{'id':_0x4d88c5[_0xc9a5('0x5b')]['id']}})[_0xc9a5('0x28')](handleEntityNotFound(_0x5dbb0f,null))[_0xc9a5('0x28')](function(_0x36105e){if(_0x36105e){return _0x36105e[_0xc9a5('0x66')]({'attributes':['id','body',_0xc9a5('0x76'),'to','cc',_0xc9a5('0x77'),_0xc9a5('0x4a')],'where':{'secret':![]},'include':_0x4d88c5['query'][_0xc9a5('0x73')]?[{'model':db[_0xc9a5('0x78')],'as':_0xc9a5('0x79')}]:undefined,'order':qs[_0xc9a5('0x38')]('id')});}return[];})[_0xc9a5('0x28')](function(_0x49b7a0){_0x1939cd=_0x49b7a0[_0xc9a5('0x5d')];if(_0x49b7a0[_0xc9a5('0x5d')]){fs[_0xc9a5('0x7a')](_0x21fca7);return BPromise[_0xc9a5('0x7b')](_0x49b7a0,function(_0x3bbff9,_0x194e6d){var _0xa159ac=_0x3bbff9;var _0x1b0682={'from':_0xa159ac['from'],'to':_0xa159ac['to'],'subject':_0xa159ac[_0xc9a5('0x77')],'html':_0xa159ac['body'],'attachments':[]};return new BPromise(function(_0xff2644,_0x22f5b7){if(_0x3bbff9['Attachments']){for(var _0x216dfe=0x0;_0x216dfe<_0x3bbff9['Attachments'][_0xc9a5('0x5d')];_0x216dfe++){var _0x3203a5=_0x3bbff9['Attachments'][_0x216dfe];var _0x49bcbf=path[_0xc9a5('0x6f')](_0x17506d,_0x3203a5[_0xc9a5('0x7c')]);if(fs[_0xc9a5('0x7d')](_0x49bcbf)){_0x1b0682['attachments'][_0xc9a5('0x42')]({'name':_0x3203a5['name'],'contentType':_0x3203a5[_0xc9a5('0x3d')],'data':fs[_0xc9a5('0x7e')](_0x49bcbf)});}}}emlformat[_0xc9a5('0x7f')](_0x1b0682,function(_0x435094,_0x3aafec){if(_0x435094)return _0x22f5b7(_0x435094);fs[_0xc9a5('0x80')](path['join'](_0x21fca7,util[_0xc9a5('0x75')]('message%d.eml',_0x194e6d)),_0x3aafec);return _0xff2644(_0x3aafec);});});});}})[_0xc9a5('0x28')](function(){if(_0x1939cd){return new BPromise(function(_0x51502c,_0x194130){zipdir(_0x21fca7,{'saveTo':_0x237da6},function(_0x16dcf8,_0x1c37bd){if(_0x16dcf8)return _0x194130(_0x16dcf8);return _0x51502c(_0x1c37bd);});});}})[_0xc9a5('0x28')](function(){if(_0x1939cd){return new BPromise(function(_0x1ff586,_0x96d41){rimraf(_0x21fca7,function(_0x3583c4){if(_0x3583c4)_0x96d41(_0x3583c4);return _0x1ff586();});});}})['then'](function(){if(_0x1939cd){return _0x5dbb0f['download'](_0x237da6,_0x4fa88f,function(_0x4d41da){if(_0x4d41da){console[_0xc9a5('0x81')](_0xc9a5('0x82'),_0x4d41da);}else{fs[_0xc9a5('0x83')](_0x237da6);}});}else{return _0x5dbb0f[_0xc9a5('0x1e')](0xc8);}})[_0xc9a5('0x59')](handleError(_0x5dbb0f,null));};
\ No newline at end of file
index fd21e38..9a58d8e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5392=['hook','exports','events','../../mysqldb','MailInteraction','save','update','remove','emit','hasOwnProperty'];(function(_0x46f521,_0x11747b){var _0x1489d2=function(_0x368041){while(--_0x368041){_0x46f521['push'](_0x46f521['shift']());}};_0x1489d2(++_0x11747b);}(_0x5392,0x138));var _0x2539=function(_0x885c7f,_0xd3f99c){_0x885c7f=_0x885c7f-0x0;var _0x1149ea=_0x5392[_0x885c7f];return _0x1149ea;};'use strict';var EventEmitter=require(_0x2539('0x0'));var MailInteraction=require(_0x2539('0x1'))['db'][_0x2539('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2539('0x3'),'afterUpdate':_0x2539('0x4'),'afterDestroy':_0x2539('0x5')};function emitEvent(_0xf28cd){return function(_0x1f68b7,_0x819b8b,_0x5299ac){MailInteractionEvents['emit'](_0xf28cd+':'+_0x1f68b7['id'],_0x1f68b7);MailInteractionEvents[_0x2539('0x6')](_0xf28cd,_0x1f68b7);_0x5299ac(null);};}for(var e in events){if(events[_0x2539('0x7')](e)){var event=events[e];MailInteraction[_0x2539('0x8')](e,emitEvent(event));}}module[_0x2539('0x9')]=MailInteractionEvents;
\ No newline at end of file
+var _0x7bfd=['emit','hasOwnProperty','hook','events','../../mysqldb','MailInteraction','update','remove'];(function(_0x426e65,_0xa277b){var _0xeecc7c=function(_0x35fdd3){while(--_0x35fdd3){_0x426e65['push'](_0x426e65['shift']());}};_0xeecc7c(++_0xa277b);}(_0x7bfd,0x8b));var _0xd7bf=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x7bfd[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require(_0xd7bf('0x0'));var MailInteraction=require(_0xd7bf('0x1'))['db'][_0xd7bf('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd7bf('0x3'),'afterDestroy':_0xd7bf('0x4')};function emitEvent(_0x353d54){return function(_0x43f84f,_0x11a3be,_0x3b2437){MailInteractionEvents[_0xd7bf('0x5')](_0x353d54+':'+_0x43f84f['id'],_0x43f84f);MailInteractionEvents[_0xd7bf('0x5')](_0x353d54,_0x43f84f);_0x3b2437(null);};}for(var e in events){if(events[_0xd7bf('0x6')](e)){var event=events[e];MailInteraction[_0xd7bf('0x7')](e,emitEvent(event));}}module['exports']=MailInteractionEvents;
\ No newline at end of file
index 7e512e3..954c8ce 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x219d=['util','../../config/logger','api','moment','bluebird','request-promise','./mailInteraction.attributes','exports','mail_interactions','utf8mb4','lodash'];(function(_0x1a934a,_0x3f6d10){var _0x59e40a=function(_0x32d4ab){while(--_0x32d4ab){_0x1a934a['push'](_0x1a934a['shift']());}};_0x59e40a(++_0x3f6d10);}(_0x219d,0xa4));var _0xd219=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x219d[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0xd219('0x0'));var util=require(_0xd219('0x1'));var logger=require(_0xd219('0x2'))(_0xd219('0x3'));var moment=require(_0xd219('0x4'));var BPromise=require(_0xd219('0x5'));var rp=require(_0xd219('0x6'));var attributes=require(_0xd219('0x7'));module[_0xd219('0x8')]=function(_0x3e0efa,_0x1e590b){return _0x3e0efa['define']('MailInteraction',attributes,{'tableName':_0xd219('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd219('0xa'),'collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file
+var _0x7091=['changed','substatus','substatusAt','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','exports','MailInteraction','format','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x51edca,_0x18ad70){var _0x2b77ec=function(_0x55a549){while(--_0x55a549){_0x51edca['push'](_0x51edca['shift']());}};_0x2b77ec(++_0x18ad70);}(_0x7091,0xc4));var _0x1709=function(_0x3adca7,_0x587c60){_0x3adca7=_0x3adca7-0x0;var _0x4504cf=_0x7091[_0x3adca7];return _0x4504cf;};'use strict';var _=require('lodash');var util=require(_0x1709('0x0'));var logger=require(_0x1709('0x1'))(_0x1709('0x2'));var moment=require(_0x1709('0x3'));var BPromise=require(_0x1709('0x4'));var rp=require(_0x1709('0x5'));var attributes=require('./mailInteraction.attributes');module[_0x1709('0x6')]=function(_0x1ac011,_0x2bc59e){return _0x1ac011['define'](_0x1709('0x7'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1df4ab,_0x846fcf,_0x483013){if(_0x1df4ab['substatus']){_0x1df4ab['substatusAt']=moment()[_0x1709('0x8')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x1df4ab[_0x1709('0x9')]){_0x1df4ab[_0x1709('0xa')]=moment()['format'](_0x1709('0xb'));}_0x483013(null,_0x846fcf);},'beforeUpdate':function(_0x26f140,_0x3a5973,_0x1376ff){if(_0x26f140[_0x1709('0xc')](_0x1709('0xd'))){_0x26f140[_0x1709('0xe')]=moment()[_0x1709('0x8')](_0x1709('0xb'));}if(_0x26f140[_0x1709('0xc')]('closed')){_0x26f140['closedAt']=moment()[_0x1709('0x8')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1376ff(null,_0x26f140);}},'charset':'utf8mb4','collate':_0x1709('0xf')});};
\ No newline at end of file
index 20a9e30..a8c277b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6691=['find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','options','raw','attributes','AddTagsToMailInteraction'];(function(_0x4f83a6,_0x41dcae){var _0x48b8e8=function(_0x352d67){while(--_0x352d67){_0x4f83a6['push'](_0x4f83a6['shift']());}};_0x48b8e8(++_0x41dcae);}(_0x6691,0x12d));var _0x1669=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6691[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x1669('0x0'));var util=require(_0x1669('0x1'));var moment=require(_0x1669('0x2'));var BPromise=require(_0x1669('0x3'));var rs=require(_0x1669('0x4'));var fs=require('fs');var Redis=require(_0x1669('0x5'));var db=require(_0x1669('0x6'))['db'];var utils=require(_0x1669('0x7'));var logger=require(_0x1669('0x8'))(_0x1669('0x9'));var config=require('../../config/environment');var jayson=require(_0x1669('0xa'));var client=jayson[_0x1669('0xb')][_0x1669('0xc')]({'port':0x232a});config[_0x1669('0xd')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1669('0xe'))(new Redis(config['redis']));require('./mailInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x56e0ee,_0x52b44f,_0x408538){return new BPromise(function(_0x93d633,_0xdf793d){return client[_0x1669('0xf')](_0x56e0ee,_0x408538)[_0x1669('0x10')](function(_0x3d6f5e){logger[_0x1669('0x11')](_0x1669('0x12'),_0x52b44f,_0x1669('0x13'));logger[_0x1669('0x14')](_0x1669('0x15'),_0x52b44f,_0x1669('0x13'),JSON[_0x1669('0x16')](_0x3d6f5e));if(_0x3d6f5e[_0x1669('0x17')]){if(_0x3d6f5e[_0x1669('0x17')][_0x1669('0x18')]===0x1f4){logger[_0x1669('0x17')](_0x1669('0x12'),_0x52b44f,_0x3d6f5e[_0x1669('0x17')][_0x1669('0x19')]);return _0xdf793d(_0x3d6f5e[_0x1669('0x17')][_0x1669('0x19')]);}logger[_0x1669('0x17')]('MailInteraction,\x20%s,\x20%s',_0x52b44f,_0x3d6f5e[_0x1669('0x17')][_0x1669('0x19')]);return _0x93d633(_0x3d6f5e[_0x1669('0x17')][_0x1669('0x19')]);}else{logger[_0x1669('0x11')]('MailInteraction,\x20%s,\x20%s',_0x52b44f,'request\x20sent');_0x93d633(_0x3d6f5e[_0x1669('0x1a')][_0x1669('0x19')]);}})[_0x1669('0x1b')](function(_0x4fcf1c){logger[_0x1669('0x17')](_0x1669('0x12'),_0x52b44f,_0x4fcf1c);_0xdf793d(_0x4fcf1c);});});}exports[_0x1669('0x1c')]=function(_0x59853b){var _0x31483f=this;return new Promise(function(_0x42cc8a,_0x51297e){return db[_0x1669('0x1d')][_0x1669('0x1e')](_0x59853b['body'],{'raw':_0x59853b[_0x1669('0x1f')]?_0x59853b[_0x1669('0x1f')][_0x1669('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59853b[_0x1669('0x1f')]?_0x59853b[_0x1669('0x1f')]['where']||null:null,'attributes':_0x59853b[_0x1669('0x1f')]?_0x59853b[_0x1669('0x1f')][_0x1669('0x21')]||null:null,'limit':_0x59853b['options']?_0x59853b[_0x1669('0x1f')]['limit']||null:null})['then'](function(_0x238ce2){logger['info'](_0x1669('0x1c'),_0x59853b);logger[_0x1669('0x14')](_0x1669('0x1c'),_0x59853b,JSON[_0x1669('0x16')](_0x238ce2));_0x42cc8a(_0x238ce2);})[_0x1669('0x1b')](function(_0x660cc7){logger[_0x1669('0x17')]('UpdateMailInteraction',_0x660cc7[_0x1669('0x19')],_0x59853b);_0x51297e(_0x31483f['error'](0x1f4,_0x660cc7[_0x1669('0x19')]));});});};exports[_0x1669('0x22')]=function(_0x4fcf88){return new Promise(function(_0xfca7c6,_0x590053){return db[_0x1669('0x1d')][_0x1669('0x23')]({'where':_0x4fcf88[_0x1669('0x1f')]?_0x4fcf88[_0x1669('0x1f')]['where']||null:null})['then'](function(_0x47fbda){if(_0x47fbda){return _0x47fbda[_0x1669('0x24')](_0x4fcf88[_0x1669('0x25')][_0x1669('0x26')],_[_0x1669('0x27')](_0x4fcf88[_0x1669('0x25')],['ids','id'])||{});}})[_0x1669('0x28')](function(_0xc17e95){logger[_0x1669('0x11')](_0x1669('0x29'),_0x4fcf88);logger[_0x1669('0x14')](_0x1669('0x29'),_0x4fcf88,JSON[_0x1669('0x16')](_0xc17e95));_0xfca7c6(_0xc17e95);})[_0x1669('0x1b')](function(_0x496df9){logger[_0x1669('0x17')]('AddTags',_0x496df9[_0x1669('0x19')],_0x4fcf88);_0x590053(_this['error'](0x1f4,_0x496df9['message']));});});};
\ No newline at end of file
+var _0x5031=['where','attributes','AddTagsToMailInteraction','find','addTags','ids','spread','AddTags','stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw'];(function(_0x5942c6,_0x3db044){var _0x2871c3=function(_0x44f6c4){while(--_0x44f6c4){_0x5942c6['push'](_0x5942c6['shift']());}};_0x2871c3(++_0x3db044);}(_0x5031,0x144));var _0x1503=function(_0x36d219,_0x4c120e){_0x36d219=_0x36d219-0x0;var _0x3dcd8f=_0x5031[_0x36d219];return _0x3dcd8f;};'use strict';var _=require(_0x1503('0x0'));var util=require(_0x1503('0x1'));var moment=require(_0x1503('0x2'));var BPromise=require(_0x1503('0x3'));var rs=require(_0x1503('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1503('0x5'));var logger=require(_0x1503('0x6'))(_0x1503('0x7'));var config=require(_0x1503('0x8'));var jayson=require(_0x1503('0x9'));var client=jayson[_0x1503('0xa')][_0x1503('0xb')]({'port':0x232a});config[_0x1503('0xc')]=_[_0x1503('0xd')](config['redis'],{'host':_0x1503('0xe'),'port':0x18eb});var socket=require(_0x1503('0xf'))(new Redis(config['redis']));require(_0x1503('0x10'))[_0x1503('0x11')](socket);function respondWithRpcPromise(_0x285307,_0xef165d,_0x3b056c){return new BPromise(function(_0x477fab,_0x32a232){return client[_0x1503('0x12')](_0x285307,_0x3b056c)[_0x1503('0x13')](function(_0x1bb027){logger['info'](_0x1503('0x14'),_0xef165d,_0x1503('0x15'));logger[_0x1503('0x16')](_0x1503('0x17'),_0xef165d,_0x1503('0x15'),JSON['stringify'](_0x1bb027));if(_0x1bb027[_0x1503('0x18')]){if(_0x1bb027[_0x1503('0x18')][_0x1503('0x19')]===0x1f4){logger[_0x1503('0x18')](_0x1503('0x14'),_0xef165d,_0x1bb027[_0x1503('0x18')][_0x1503('0x1a')]);return _0x32a232(_0x1bb027[_0x1503('0x18')][_0x1503('0x1a')]);}logger[_0x1503('0x18')](_0x1503('0x14'),_0xef165d,_0x1bb027[_0x1503('0x18')][_0x1503('0x1a')]);return _0x477fab(_0x1bb027[_0x1503('0x18')][_0x1503('0x1a')]);}else{logger[_0x1503('0x1b')](_0x1503('0x14'),_0xef165d,_0x1503('0x15'));_0x477fab(_0x1bb027[_0x1503('0x1c')]['message']);}})[_0x1503('0x1d')](function(_0x264b05){logger[_0x1503('0x18')](_0x1503('0x14'),_0xef165d,_0x264b05);_0x32a232(_0x264b05);});});}exports[_0x1503('0x1e')]=function(_0x501f7c){var _0x55058d=this;return new Promise(function(_0x4c69bc,_0x57a7ea){return db[_0x1503('0x1f')][_0x1503('0x20')](_0x501f7c[_0x1503('0x21')],{'raw':_0x501f7c[_0x1503('0x22')]?_0x501f7c['options'][_0x1503('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x501f7c[_0x1503('0x22')]?_0x501f7c[_0x1503('0x22')][_0x1503('0x24')]||null:null,'attributes':_0x501f7c[_0x1503('0x22')]?_0x501f7c[_0x1503('0x22')][_0x1503('0x25')]||null:null,'limit':_0x501f7c[_0x1503('0x22')]?_0x501f7c[_0x1503('0x22')]['limit']||null:null})[_0x1503('0x13')](function(_0x575e99){logger[_0x1503('0x1b')](_0x1503('0x1e'),_0x501f7c);logger[_0x1503('0x16')](_0x1503('0x1e'),_0x501f7c,JSON['stringify'](_0x575e99));_0x4c69bc(_0x575e99);})[_0x1503('0x1d')](function(_0x2057bd){logger[_0x1503('0x18')](_0x1503('0x1e'),_0x2057bd[_0x1503('0x1a')],_0x501f7c);_0x57a7ea(_0x55058d[_0x1503('0x18')](0x1f4,_0x2057bd['message']));});});};exports[_0x1503('0x26')]=function(_0x1ec97b){return new Promise(function(_0xd56da4,_0xc5ccef){return db[_0x1503('0x1f')][_0x1503('0x27')]({'where':_0x1ec97b[_0x1503('0x22')]?_0x1ec97b[_0x1503('0x22')][_0x1503('0x24')]||null:null})[_0x1503('0x13')](function(_0x58d1df){if(_0x58d1df){return _0x58d1df[_0x1503('0x28')](_0x1ec97b[_0x1503('0x21')][_0x1503('0x29')],_['omit'](_0x1ec97b['body'],['ids','id'])||{});}})[_0x1503('0x2a')](function(_0x53fa5e){logger['info'](_0x1503('0x2b'),_0x1ec97b);logger[_0x1503('0x16')](_0x1503('0x2b'),_0x1ec97b,JSON[_0x1503('0x2c')](_0x53fa5e));_0xd56da4(_0x53fa5e);})['catch'](function(_0x2cea16){logger['error'](_0x1503('0x2b'),_0x2cea16[_0x1503('0x1a')],_0x1ec97b);_0xc5ccef(_this[_0x1503('0x18')](0x1f4,_0x2cea16[_0x1503('0x1a')]));});});};
\ No newline at end of file
index 88ee0ec..e2e1ede 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6288=['register','length','mailInteraction:','remove','removeListener'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x6288,0x116));var _0x8628=function(_0x1d7b23,_0x75416d){_0x1d7b23=_0x1d7b23-0x0;var _0x50fd26=_0x6288[_0x1d7b23];return _0x50fd26;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save',_0x8628('0x0'),'update'];function createListener(_0x30f7d0,_0x4390b3){return function(_0x36fea4){_0x4390b3['emit'](_0x30f7d0,_0x36fea4);};}function removeListener(_0x18400a,_0x4a6709){return function(){MailInteractionEvents[_0x8628('0x1')](_0x18400a,_0x4a6709);};}exports[_0x8628('0x2')]=function(_0x4c3d53){for(var _0x5a7315=0x0,_0x43308e=events[_0x8628('0x3')];_0x5a7315<_0x43308e;_0x5a7315++){var _0x5bc87f=events[_0x5a7315];var _0x476df2=createListener(_0x8628('0x4')+_0x5bc87f,_0x4c3d53);MailInteractionEvents['on'](_0x5bc87f,_0x476df2);}};
\ No newline at end of file
+var _0x03c0=['./mailInteraction.events','save','remove','emit','removeListener','register','length','mailInteraction:'];(function(_0x518f87,_0xcd4d9b){var _0x57968f=function(_0x216c81){while(--_0x216c81){_0x518f87['push'](_0x518f87['shift']());}};_0x57968f(++_0xcd4d9b);}(_0x03c0,0x1b0));var _0x003c=function(_0x57a353,_0x21498d){_0x57a353=_0x57a353-0x0;var _0x4d1690=_0x03c0[_0x57a353];return _0x4d1690;};'use strict';var MailInteractionEvents=require(_0x003c('0x0'));var events=[_0x003c('0x1'),_0x003c('0x2'),'update'];function createListener(_0x3f8315,_0x4cfada){return function(_0x47927b){_0x4cfada[_0x003c('0x3')](_0x3f8315,_0x47927b);};}function removeListener(_0x1903d7,_0x50d076){return function(){MailInteractionEvents[_0x003c('0x4')](_0x1903d7,_0x50d076);};}exports[_0x003c('0x5')]=function(_0x450889){for(var _0x383389=0x0,_0x362619=events[_0x003c('0x6')];_0x383389<_0x362619;_0x383389++){var _0x5e6d32=events[_0x383389];var _0x518866=createListener(_0x003c('0x7')+_0x5e6d32,_0x450889);MailInteractionEvents['on'](_0x5e6d32,_0x518866);}};
\ No newline at end of file
index 9595007..7bed68b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5d17=['/:id/download','post','mail','mailmessage:create','create','put','/:id/accept','accept','reject','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x18d264,_0x10d90f){var _0x33bcb2=function(_0x198dc6){while(--_0x198dc6){_0x18d264['push'](_0x18d264['shift']());}};_0x33bcb2(++_0x10d90f);}(_0x5d17,0x114));var _0x75d1=function(_0x18fb16,_0x45edbc){_0x18fb16=_0x18fb16-0x0;var _0x147b0d=_0x5d17[_0x18fb16];return _0x147b0d;};'use strict';var multer=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75d1('0x2'));var router=express[_0x75d1('0x3')]();var auth=require(_0x75d1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x75d1('0x5'));var controller=require(_0x75d1('0x6'));router[_0x75d1('0x7')]('/',auth[_0x75d1('0x8')](),controller['index']);router[_0x75d1('0x7')](_0x75d1('0x9'),auth[_0x75d1('0x8')](),controller[_0x75d1('0xa')]);router[_0x75d1('0x7')](_0x75d1('0xb'),auth[_0x75d1('0x8')](),controller['show']);router['get'](_0x75d1('0xc'),auth['isAuthenticated'](),controller['download']);router[_0x75d1('0xd')]('/',auth[_0x75d1('0x8')](),interaction['tracked'](_0x75d1('0xe'),_0x75d1('0xf')),controller[_0x75d1('0x10')]);router[_0x75d1('0x11')](_0x75d1('0xb'),auth[_0x75d1('0x8')](),controller['update']);router[_0x75d1('0x11')](_0x75d1('0x12'),auth[_0x75d1('0x8')](),controller[_0x75d1('0x13')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x75d1('0x14')]);router[_0x75d1('0x15')](_0x75d1('0xb'),auth['isAuthenticated'](),controller[_0x75d1('0x16')]);module[_0x75d1('0x17')]=router;
\ No newline at end of file
+var _0x814b=['post','tracked','mailmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/download','download'];(function(_0x488102,_0x4c1053){var _0x62017c=function(_0x4a339f){while(--_0x4a339f){_0x488102['push'](_0x488102['shift']());}};_0x62017c(++_0x4c1053);}(_0x814b,0x1a2));var _0xb814=function(_0x324d77,_0x307ef7){_0x324d77=_0x324d77-0x0;var _0x2a77a7=_0x814b[_0x324d77];return _0x2a77a7;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['describe']);router[_0xb814('0x9')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0x9')](_0xb814('0xf'),auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0x11')]('/',auth[_0xb814('0xa')](),interaction[_0xb814('0x12')]('mail',_0xb814('0x13')),controller['create']);router[_0xb814('0x14')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0x15')]);router[_0xb814('0x14')](_0xb814('0x16'),auth[_0xb814('0xa')](),controller[_0xb814('0x17')]);router[_0xb814('0x14')](_0xb814('0x18'),auth[_0xb814('0xa')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0x1b')]);module[_0xb814('0x1c')]=router;
\ No newline at end of file
index c039607..2133049 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xef3c=['TEXT','DATE','lodash','exports','long','BOOLEAN','out','STRING'];(function(_0x3902c1,_0x1c9eb2){var _0x1266cc=function(_0x50c2c5){while(--_0x50c2c5){_0x3902c1['push'](_0x3902c1['shift']());}};_0x1266cc(++_0x1c9eb2);}(_0xef3c,0xaa));var _0xcef3=function(_0x24f479,_0x3046bf){_0x24f479=_0x24f479-0x0;var _0x425a42=_0xef3c[_0x24f479];return _0x425a42;};'use strict';var Sequelize=require('sequelize');var _=require(_0xcef3('0x0'));module[_0xcef3('0x1')]={'body':{'type':Sequelize['TEXT'](_0xcef3('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xcef3('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xcef3('0x4')),'defaultValue':_0xcef3('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xcef3('0x5')]},'to':{'type':Sequelize[_0xcef3('0x6')](_0xcef3('0x2'))},'cc':{'type':Sequelize[_0xcef3('0x6')]('long')},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xcef3('0x7')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xcef3('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xcef3('0x7')]},'originTo':{'type':Sequelize[_0xcef3('0x6')](_0xcef3('0x2'))},'originCc':{'type':Sequelize[_0xcef3('0x6')]('long')}};
\ No newline at end of file
+var _0x5b35=['DATE','INTEGER','lodash','exports','TEXT','long','BOOLEAN','ENUM','out'];(function(_0x50bbec,_0x33529a){var _0x396400=function(_0x160bda){while(--_0x160bda){_0x50bbec['push'](_0x50bbec['shift']());}};_0x396400(++_0x33529a);}(_0x5b35,0x110));var _0x55b3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5b35[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');var _=require(_0x55b3('0x0'));module[_0x55b3('0x1')]={'body':{'type':Sequelize[_0x55b3('0x2')](_0x55b3('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x55b3('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x55b3('0x5')]('in',_0x55b3('0x6')),'defaultValue':_0x55b3('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x55b3('0x2')](_0x55b3('0x3'))},'cc':{'type':Sequelize[_0x55b3('0x2')](_0x55b3('0x3'))},'bcc':{'type':Sequelize[_0x55b3('0x2')](_0x55b3('0x3'))},'subject':{'type':Sequelize[_0x55b3('0x2')]},'sentAt':{'type':Sequelize[_0x55b3('0x7')]},'attach':{'type':Sequelize[_0x55b3('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x55b3('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x55b3('0x7')]},'originTo':{'type':Sequelize[_0x55b3('0x2')]('long')},'originCc':{'type':Sequelize['TEXT']('long')}};
\ No newline at end of file
index 0b4b6ab..0169258 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa523=['channel','event','EventManager','mail-interactions','reject','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectmessage','unix','toString','server','files','tmp','message-%s.eml','from','subject','Attachment','Attachments','existsSync','push','type','build','writeFileSync','download','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','client','http','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','json','offset','status','set','Content-Range','update','then','destroy','end','stack','send','index','MailMessage','rawAttributes','keys','query','model','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','pick','filters','filter','where','merge','map','key','VIRTUAL','field','options','count','includeAll','include','findAll','rows','show','body','find','params','describe','create','direction','out','MailAccount','findOne','MailAccountId','Smtp','isNil','service','host','port','secure','auth','user','pass','attachments','join','root','server/files/attachments','basename','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','UserId','CmContact','Contact','get','MailInteraction','MailInteractionId','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','null','AcceptMessage','manual','interface','SIP/%s'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0xa523,0xb9));var _0x3a52=function(_0x3832b1,_0x1636c6){_0x3832b1=_0x3832b1-0x0;var _0x33371c=_0xa523[_0x3832b1];return _0x33371c;};'use strict';var pdf=require(_0x3a52('0x0'));var emlformat=require(_0x3a52('0x1'));var rimraf=require(_0x3a52('0x2'));var zipdir=require(_0x3a52('0x3'));var jsonpatch=require(_0x3a52('0x4'));var rp=require(_0x3a52('0x5'));var moment=require('moment');var BPromise=require(_0x3a52('0x6'));var Mustache=require(_0x3a52('0x7'));var util=require(_0x3a52('0x8'));var path=require(_0x3a52('0x9'));var sox=require(_0x3a52('0xa'));var csv=require(_0x3a52('0xb'));var ejs=require(_0x3a52('0xc'));var fs=require('fs');var _=require(_0x3a52('0xd'));var squel=require(_0x3a52('0xe'));var crypto=require(_0x3a52('0xf'));var jsforce=require(_0x3a52('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x3a52('0xb'));var querystring=require('querystring');var Papa=require(_0x3a52('0x11'));var authService=require(_0x3a52('0x12'));var hardwareService=require(_0x3a52('0x13'));var Redis=require(_0x3a52('0x14'));var qs=require(_0x3a52('0x15'));var logger=require(_0x3a52('0x16'))(_0x3a52('0x17'));var utils=require(_0x3a52('0x18'));var config=require(_0x3a52('0x19'));var db=require(_0x3a52('0x1a'))['db'];config[_0x3a52('0x1b')]=_['defaults'](config['redis'],{'host':_0x3a52('0x1c'),'port':0x18eb});var socket=require(_0x3a52('0x1d'))(new Redis(config['redis']));require('./mailMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9003=jayson[_0x3a52('0x1e')][_0x3a52('0x1f')]({'port':0x232b});var client9002=jayson['client'][_0x3a52('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2a3000,_0x568b05,_0x4e7212,_0x5942d6){return new BPromise(function(_0x3b0f6b,_0x51edc1){var _0x1b3485=_0x5942d6||client;return _0x1b3485[_0x3a52('0x20')](_0x2a3000,_0x4e7212)['then'](function(_0x4e458a){logger[_0x3a52('0x21')](_0x3a52('0x22'),_0x568b05,_0x3a52('0x23'));logger[_0x3a52('0x24')](_0x3a52('0x25'),_0x568b05,_0x3a52('0x23'),JSON[_0x3a52('0x26')](_0x4e458a));if(_0x4e458a[_0x3a52('0x27')]){if(_0x4e458a[_0x3a52('0x27')][_0x3a52('0x28')]===0x1f4){logger[_0x3a52('0x27')]('MailMessage,\x20%s,\x20%s',_0x568b05,_0x4e458a[_0x3a52('0x27')][_0x3a52('0x29')]);return _0x51edc1(_0x4e458a['error'][_0x3a52('0x29')]);}logger[_0x3a52('0x27')](_0x3a52('0x22'),_0x568b05,_0x4e458a[_0x3a52('0x27')][_0x3a52('0x29')]);return _0x3b0f6b(_0x4e458a[_0x3a52('0x27')][_0x3a52('0x29')]);}else{logger[_0x3a52('0x21')](_0x3a52('0x22'),_0x568b05,'request\x20sent');_0x3b0f6b(_0x4e458a[_0x3a52('0x2a')][_0x3a52('0x29')]);}})[_0x3a52('0x2b')](function(_0x417a0d){logger[_0x3a52('0x27')](_0x3a52('0x22'),_0x568b05,_0x417a0d);_0x51edc1(_0x417a0d);});});}function respondWithStatusCode(_0x5631d9,_0x2ee637){_0x2ee637=_0x2ee637||0xcc;return function(_0x299784){if(_0x299784){return _0x5631d9[_0x3a52('0x2c')](_0x2ee637);}return _0x5631d9['status'](_0x2ee637)['end']();};}function respondWithResult(_0x1a04f4,_0x1d01b1){_0x1d01b1=_0x1d01b1||0xc8;return function(_0x389a77){if(_0x389a77){return _0x1a04f4['status'](_0x1d01b1)[_0x3a52('0x2d')](_0x389a77);}};}function respondWithFilteredResult(_0x1e42f6,_0x366dba){return function(_0x2d170b){if(_0x2d170b){var _0x315d24=_0x2d170b['count'],_0x14b0b8=_0x366dba[_0x3a52('0x2e')],_0x2dcdf6=_0x366dba['offset']+_0x366dba['limit'],_0x2b2fcc;if(_0x2dcdf6>=_0x315d24){_0x2dcdf6=_0x315d24;_0x2b2fcc=0xc8;}else{_0x2b2fcc=0xce;}_0x1e42f6[_0x3a52('0x2f')](_0x2b2fcc);return _0x1e42f6[_0x3a52('0x30')](_0x3a52('0x31'),_0x14b0b8+'-'+_0x2dcdf6+'/'+_0x315d24)['json'](_0x2d170b);}return null;};}function patchUpdates(_0x8dc174){return function(_0x49732f){try{jsonpatch['apply'](_0x49732f,_0x8dc174,!![]);}catch(_0xcfb6bc){return BPromise['reject'](_0xcfb6bc);}return _0x49732f['save']();};}function saveUpdates(_0x4c4f67,_0x54baff){return function(_0x58498c){if(_0x58498c){return _0x58498c[_0x3a52('0x32')](_0x4c4f67)[_0x3a52('0x33')](function(_0x43d543){return _0x43d543;});}return null;};}function removeEntity(_0x3efbbd,_0x14ae64){return function(_0x1dee80){if(_0x1dee80){return _0x1dee80[_0x3a52('0x34')]()['then'](function(){_0x3efbbd[_0x3a52('0x2f')](0xcc)[_0x3a52('0x35')]();});}};}function handleEntityNotFound(_0x374193,_0x19438c){return function(_0x4e5666){if(!_0x4e5666){_0x374193[_0x3a52('0x2c')](0x194);}return _0x4e5666;};}function handleError(_0x1efd58,_0x5c6140){_0x5c6140=_0x5c6140||0x1f4;return function(_0x321eb5){logger[_0x3a52('0x27')](_0x321eb5[_0x3a52('0x36')]);if(_0x321eb5['name']){delete _0x321eb5['name'];}_0x1efd58['status'](_0x5c6140)[_0x3a52('0x37')](_0x321eb5);};}exports[_0x3a52('0x38')]=function(_0x1de402,_0x495e8d){var _0x26dc3f={},_0x1806a6={},_0x5e0bf6={'count':0x0,'rows':[]};var _0x25c277=db[_0x3a52('0x39')][_0x3a52('0x3a')];_0x1806a6['model']=_[_0x3a52('0x3b')](_0x25c277);_0x1806a6[_0x3a52('0x3c')]=_['keys'](_0x1de402[_0x3a52('0x3c')]);_0x1806a6['filters']=_['intersection'](_0x1806a6[_0x3a52('0x3d')],_0x1806a6[_0x3a52('0x3c')]);_0x26dc3f[_0x3a52('0x3e')]=_[_0x3a52('0x3f')](_0x1806a6[_0x3a52('0x3d')],qs[_0x3a52('0x40')](_0x1de402[_0x3a52('0x3c')][_0x3a52('0x40')]));_0x26dc3f[_0x3a52('0x3e')]=_0x26dc3f[_0x3a52('0x3e')][_0x3a52('0x41')]?_0x26dc3f[_0x3a52('0x3e')]:_0x1806a6[_0x3a52('0x3d')];if(!_0x1de402[_0x3a52('0x3c')][_0x3a52('0x42')]('nolimit')){_0x26dc3f['limit']=qs[_0x3a52('0x43')](_0x1de402[_0x3a52('0x3c')]['limit']);_0x26dc3f[_0x3a52('0x2e')]=qs[_0x3a52('0x2e')](_0x1de402['query'][_0x3a52('0x2e')]);}_0x26dc3f[_0x3a52('0x44')]=qs[_0x3a52('0x45')](_0x1de402[_0x3a52('0x3c')]['sort']);_0x26dc3f['where']=qs['filters'](_[_0x3a52('0x46')](_0x1de402[_0x3a52('0x3c')],_0x1806a6[_0x3a52('0x47')]));if(_0x1de402[_0x3a52('0x3c')][_0x3a52('0x48')]){_0x26dc3f[_0x3a52('0x49')]=_[_0x3a52('0x4a')](_0x26dc3f[_0x3a52('0x49')],{'$or':_[_0x3a52('0x4b')](_0x25c277,function(_0x40e10b){if(_0x40e10b['type'][_0x3a52('0x4c')]!==_0x3a52('0x4d')){var _0x517ff6={};_0x517ff6[_0x40e10b[_0x3a52('0x4e')]]={'$like':'%'+_0x1de402[_0x3a52('0x3c')][_0x3a52('0x48')]+'%'};return _0x517ff6;}})});}_0x26dc3f=_[_0x3a52('0x4a')]({},_0x26dc3f,_0x1de402[_0x3a52('0x4f')]);var _0xbd835e={'where':_0x26dc3f['where']};return db[_0x3a52('0x39')][_0x3a52('0x50')](_0xbd835e)[_0x3a52('0x33')](function(_0x87db46){_0x5e0bf6['count']=_0x87db46;if(_0x1de402[_0x3a52('0x3c')][_0x3a52('0x51')]){_0x26dc3f[_0x3a52('0x52')]=[{'all':!![]}];}return db['MailMessage'][_0x3a52('0x53')](_0x26dc3f);})[_0x3a52('0x33')](function(_0xe1a50b){_0x5e0bf6[_0x3a52('0x54')]=_0xe1a50b;return _0x5e0bf6;})[_0x3a52('0x33')](respondWithFilteredResult(_0x495e8d,_0x26dc3f))['catch'](handleError(_0x495e8d,null));};exports[_0x3a52('0x55')]=function(_0x515d6c,_0x548839){var _0x2965c7={'raw':!![],'where':{'id':_0x515d6c['params']['id']}},_0x1e7fde={};_0x1e7fde[_0x3a52('0x3d')]=_[_0x3a52('0x3b')](db[_0x3a52('0x39')]['rawAttributes']);_0x1e7fde[_0x3a52('0x3c')]=_['keys'](_0x515d6c[_0x3a52('0x3c')]);_0x1e7fde[_0x3a52('0x47')]=_[_0x3a52('0x3f')](_0x1e7fde['model'],_0x1e7fde[_0x3a52('0x3c')]);_0x2965c7[_0x3a52('0x3e')]=_['intersection'](_0x1e7fde[_0x3a52('0x3d')],qs[_0x3a52('0x40')](_0x515d6c['query'][_0x3a52('0x40')]));_0x2965c7[_0x3a52('0x3e')]=_0x2965c7['attributes']['length']?_0x2965c7['attributes']:_0x1e7fde[_0x3a52('0x3d')];if(_0x515d6c['query'][_0x3a52('0x51')]){_0x2965c7[_0x3a52('0x52')]=[{'all':!![]}];}_0x2965c7=_[_0x3a52('0x4a')]({},_0x2965c7,_0x515d6c[_0x3a52('0x4f')]);return db[_0x3a52('0x39')]['find'](_0x2965c7)['then'](handleEntityNotFound(_0x548839,null))['then'](respondWithResult(_0x548839,null))[_0x3a52('0x2b')](handleError(_0x548839,null));};exports[_0x3a52('0x32')]=function(_0x2d37fb,_0x2161b6){if(_0x2d37fb[_0x3a52('0x56')]['id']){delete _0x2d37fb[_0x3a52('0x56')]['id'];}return db['MailMessage'][_0x3a52('0x57')]({'where':{'id':_0x2d37fb[_0x3a52('0x58')]['id']}})[_0x3a52('0x33')](handleEntityNotFound(_0x2161b6,null))[_0x3a52('0x33')](saveUpdates(_0x2d37fb[_0x3a52('0x56')],null))['then'](respondWithResult(_0x2161b6,null))[_0x3a52('0x2b')](handleError(_0x2161b6,null));};exports[_0x3a52('0x34')]=function(_0x4cd687,_0x35d73a){return db[_0x3a52('0x39')][_0x3a52('0x57')]({'where':{'id':_0x4cd687[_0x3a52('0x58')]['id']}})['then'](handleEntityNotFound(_0x35d73a,null))[_0x3a52('0x33')](removeEntity(_0x35d73a,null))[_0x3a52('0x2b')](handleError(_0x35d73a,null));};exports[_0x3a52('0x59')]=function(_0x1113ee,_0x484312){return db['MailMessage'][_0x3a52('0x59')]()[_0x3a52('0x33')](respondWithResult(_0x484312,null))['catch'](handleError(_0x484312,null));};exports[_0x3a52('0x5a')]=function(_0x23e2ee,_0x182e34){return db[_0x3a52('0x39')][_0x3a52('0x5a')](_0x23e2ee[_0x3a52('0x56')])['then'](function(_0x1433e9){if(_0x1433e9){if(_0x1433e9[_0x3a52('0x5b')]===_0x3a52('0x5c')&&!_0x1433e9['secret']){return db[_0x3a52('0x5d')][_0x3a52('0x5e')]({'where':{'id':_0x1433e9[_0x3a52('0x5f')]},'include':[{'model':db['MailServerOut'],'as':_0x3a52('0x60'),'raw':!![]}]})[_0x3a52('0x33')](function(_0xc5b796){if(_0xc5b796&&_0xc5b796[_0x3a52('0x60')]){var _0x32dfac={'tls':{'rejectUnauthorized':![]}};if(_[_0x3a52('0x61')](_0xc5b796['Smtp'][_0x3a52('0x62')])){_0x32dfac[_0x3a52('0x63')]=_0xc5b796[_0x3a52('0x60')]['host'];_0x32dfac[_0x3a52('0x64')]=_0xc5b796[_0x3a52('0x60')]['port'];_0x32dfac[_0x3a52('0x65')]=_0xc5b796['Smtp'][_0x3a52('0x65')];if(_0xc5b796['Smtp']['authentication']){_0x32dfac[_0x3a52('0x66')]={'user':_0xc5b796[_0x3a52('0x60')][_0x3a52('0x67')],'pass':_0xc5b796[_0x3a52('0x60')][_0x3a52('0x68')]};}}else{_0x32dfac[_0x3a52('0x62')]=_0xc5b796[_0x3a52('0x60')][_0x3a52('0x62')];_0x32dfac[_0x3a52('0x66')]={'user':_0xc5b796['Smtp'][_0x3a52('0x67')],'pass':_0xc5b796[_0x3a52('0x60')][_0x3a52('0x68')]};_0x32dfac[_0x3a52('0x65')]=_0xc5b796['Smtp'][_0x3a52('0x65')];}if(_0x23e2ee[_0x3a52('0x56')][_0x3a52('0x69')]&&_0x23e2ee['body'][_0x3a52('0x69')][_0x3a52('0x41')]){for(var _0x5de28a=0x0;_0x5de28a<_0x23e2ee[_0x3a52('0x56')][_0x3a52('0x69')][_0x3a52('0x41')];_0x5de28a+=0x1){_0x23e2ee[_0x3a52('0x56')][_0x3a52('0x69')][_0x5de28a]={'filename':_0x23e2ee[_0x3a52('0x56')][_0x3a52('0x69')][_0x5de28a]['name'],'path':path[_0x3a52('0x6a')](config[_0x3a52('0x6b')],_0x3a52('0x6c'),_0x23e2ee[_0x3a52('0x56')][_0x3a52('0x69')][_0x5de28a][_0x3a52('0x6d')])};}}return{'account':_0x32dfac,'message':_0x23e2ee[_0x3a52('0x56')]};}})[_0x3a52('0x33')](function(_0x2e0b96){if(_0x2e0b96){return respondWithRpcPromise(_0x3a52('0x6e'),_0x3a52('0x6f'),_0x2e0b96,client9003)['then'](function(_0x373833){return _0x1433e9['update']({'read':!![],'messageId':_0x373833['messageId'],'sentAt':moment()[_0x3a52('0x70')](_0x3a52('0x71'))});})[_0x3a52('0x2b')](function(_0x2631cd){logger['error']('%s',JSON['stringify'](_0x2631cd));return _0x1433e9;});}return _0x1433e9;});}return _0x1433e9;}})[_0x3a52('0x33')](respondWithResult(_0x182e34,0xc9))[_0x3a52('0x2b')](handleError(_0x182e34,null));};var interaction_log=require(_0x3a52('0x16'))('mail-interactions');exports[_0x3a52('0x72')]=function(_0x3b6111,_0x43b8b3,_0x11a569){var _0x565919={'channel':_0x3a52('0x73')};if(_0x3b6111[_0x3a52('0x56')]['id']){delete _0x3b6111[_0x3a52('0x56')]['id'];}_0x3b6111[_0x3a52('0x56')][_0x3a52('0x74')]=!![];_0x3b6111[_0x3a52('0x56')]['readAt']=moment()['format'](_0x3a52('0x71'));_0x3b6111[_0x3a52('0x56')][_0x3a52('0x75')]=_0x3b6111[_0x3a52('0x56')][_0x3a52('0x75')]||_0x3b6111[_0x3a52('0x67')]['id'];return db[_0x3a52('0x39')]['find']({'where':{'id':_0x3b6111[_0x3a52('0x58')]['id'],'UserId':null},'include':[{'model':db[_0x3a52('0x76')],'as':_0x3a52('0x77')}]})['then'](handleEntityNotFound(_0x43b8b3,null))['then'](saveUpdates(_0x3b6111[_0x3a52('0x56')],null))['then'](function(_0x488dcc){if(_0x488dcc){_0x565919['message']=_0x488dcc[_0x3a52('0x78')]({'plain':!![]});return db[_0x3a52('0x79')][_0x3a52('0x57')]({'where':{'id':_0x488dcc[_0x3a52('0x7a')]}});}return null;})[_0x3a52('0x33')](handleEntityNotFound(_0x43b8b3,null))['then'](function(_0x3b2da0){if(_0x3b2da0){return _0x3b2da0[_0x3a52('0x32')]({'UserId':_0x3b6111[_0x3a52('0x56')]['UserId'],'read1stAt':_[_0x3a52('0x61')](_0x3b2da0['read1stAt'])?moment()[_0x3a52('0x70')](_0x3a52('0x71')):undefined});}return null;})[_0x3a52('0x33')](function(_0x25a5a5){if(_0x25a5a5){_0x565919[_0x3a52('0x7b')]=_0x25a5a5['get']({'plain':!![]});interaction_log['info'](_0x3a52('0x7c'),_0x3b6111[_0x3a52('0x67')]['id'],_0x3b6111[_0x3a52('0x67')][_0x3a52('0x7d')],_0x3b6111['user']['role'],_0x565919[_0x3a52('0x7b')]['id'],_0x3b6111['body']?JSON[_0x3a52('0x26')](_0x3b6111[_0x3a52('0x56')]):_0x3a52('0x7e'));return respondWithRpcPromise(_0x3a52('0x7f'),'acceptMessage',_0x565919);}return null;})[_0x3a52('0x33')](function(_0x435c58){if(_0x435c58){if(_0x3b6111[_0x3a52('0x56')][_0x3a52('0x80')]){_0x565919[_0x3a52('0x29')][_0x3a52('0x81')]=util[_0x3a52('0x70')](_0x3a52('0x82'),_0x3b6111[_0x3a52('0x67')][_0x3a52('0x7d')]);_0x565919[_0x3a52('0x29')][_0x3a52('0x83')]=_0x565919[_0x3a52('0x83')];_0x565919[_0x3a52('0x29')][_0x3a52('0x84')]='accept';return respondWithRpcPromise(_0x3a52('0x85'),'EventManager',{'event':'acceptmessage','message':_0x565919['message']},client9002)[_0x3a52('0x33')](function(){return _0x565919;});}return _0x565919;}return null;})[_0x3a52('0x33')](respondWithResult(_0x43b8b3,null))[_0x3a52('0x2b')](handleError(_0x43b8b3,null));};var interaction_log=require('../../config/logger')(_0x3a52('0x86'));exports[_0x3a52('0x87')]=function(_0x48ca02,_0xa06c3c,_0x398c00){var _0xe74dd7={'agent':{},'channel':_0x3a52('0x73')};if(_0x48ca02[_0x3a52('0x56')]['id']){delete _0x48ca02['body']['id'];}_0x48ca02[_0x3a52('0x56')][_0x3a52('0x75')]=_0x48ca02[_0x3a52('0x56')][_0x3a52('0x75')]||_0x48ca02[_0x3a52('0x67')]['id'];_0xe74dd7[_0x3a52('0x88')]['id']=_0x48ca02['body']['UserId'];return db['MailMessage']['find']({'where':{'id':_0x48ca02[_0x3a52('0x58')]['id'],'UserId':null}})[_0x3a52('0x33')](handleEntityNotFound(_0xa06c3c,null))[_0x3a52('0x33')](function(_0x336c1f){if(_0x336c1f){_0xe74dd7['message']=_0x336c1f[_0x3a52('0x78')]({'plain':!![]});return db['MailInteraction'][_0x3a52('0x57')]({'where':{'id':_0x336c1f[_0x3a52('0x7a')]}});}return null;})[_0x3a52('0x33')](handleEntityNotFound(_0xa06c3c,null))[_0x3a52('0x33')](function(_0x1b32c7){if(_0x1b32c7){_0xe74dd7[_0x3a52('0x7b')]=_0x1b32c7[_0x3a52('0x78')]({'plain':!![]});interaction_log[_0x3a52('0x21')](_0x3a52('0x89'),_0x48ca02[_0x3a52('0x67')]['id'],_0x48ca02['user'][_0x3a52('0x7d')],_0x48ca02[_0x3a52('0x67')][_0x3a52('0x8a')],_0xe74dd7[_0x3a52('0x7b')]['id'],_0x48ca02[_0x3a52('0x56')]?JSON[_0x3a52('0x26')](_0x48ca02['body']):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0xe74dd7);}return null;})[_0x3a52('0x33')](function(_0x49652d){if(_0x49652d){_0x49652d[_0x3a52('0x29')]['interface']=util[_0x3a52('0x70')](_0x3a52('0x82'),_0x48ca02[_0x3a52('0x67')][_0x3a52('0x7d')]);_0x49652d['message'][_0x3a52('0x83')]=_0xe74dd7[_0x3a52('0x83')];_0x49652d['message'][_0x3a52('0x84')]=_0x3a52('0x87');respondWithRpcPromise(_0x3a52('0x85'),_0x3a52('0x85'),{'event':_0x3a52('0x8b'),'message':_0x49652d[_0x3a52('0x29')]},client9002);return _0xe74dd7;}return null;})[_0x3a52('0x33')](respondWithResult(_0xa06c3c,null))[_0x3a52('0x2b')](handleError(_0xa06c3c,null));};exports['download']=function(_0x32e702,_0x5853da){var _0x182c0d=moment()[_0x3a52('0x8c')]()[_0x3a52('0x8d')]();var _0x133f3e=path['join'](config[_0x3a52('0x6b')],_0x3a52('0x8e'),_0x3a52('0x8f'),_0x3a52('0x90'));var _0x3c5e85=path[_0x3a52('0x6a')](config[_0x3a52('0x6b')],_0x3a52('0x8e'),_0x3a52('0x8f'),_0x3a52('0x69'));var _0x11fd06=util[_0x3a52('0x70')](_0x3a52('0x91'),_0x182c0d);return db['MailMessage']['find']({'where':{'id':_0x32e702[_0x3a52('0x58')]['id']},'attributes':['id',_0x3a52('0x56'),_0x3a52('0x92'),'to','cc',_0x3a52('0x93'),'createdAt'],'include':_0x32e702[_0x3a52('0x3c')][_0x3a52('0x69')]?[{'model':db[_0x3a52('0x94')],'as':_0x3a52('0x95')}]:undefined})[_0x3a52('0x33')](handleEntityNotFound(_0x5853da,null))[_0x3a52('0x33')](function(_0xce3412){if(_0xce3412){var _0x403b53=_0xce3412;var _0x49a51d={'from':_0x403b53[_0x3a52('0x92')],'to':_0x403b53['to'],'subject':_0x403b53['subject'],'html':_0x403b53['body'],'attachments':[]};return new BPromise(function(_0x5e09a6,_0x45bbd1){if(_0xce3412[_0x3a52('0x95')]){for(var _0x41266d=0x0;_0x41266d<_0xce3412['Attachments'][_0x3a52('0x41')];_0x41266d++){var _0x4b6644=_0xce3412[_0x3a52('0x95')][_0x41266d];var _0xf53f4e=path[_0x3a52('0x6a')](_0x3c5e85,_0x4b6644[_0x3a52('0x6d')]);if(fs[_0x3a52('0x96')](_0xf53f4e)){_0x49a51d[_0x3a52('0x69')][_0x3a52('0x97')]({'name':_0x4b6644['name'],'contentType':_0x4b6644[_0x3a52('0x98')],'data':fs['readFileSync'](_0xf53f4e)});}}}emlformat[_0x3a52('0x99')](_0x49a51d,function(_0x45139f,_0x42eb6d){if(_0x45139f)return _0x45bbd1(_0x45139f);fs[_0x3a52('0x9a')](path['join'](_0x133f3e,_0x11fd06),_0x42eb6d);return _0x5e09a6(_0x42eb6d);});});}})[_0x3a52('0x33')](function(_0x47d06e){if(_0x47d06e){return _0x5853da[_0x3a52('0x9b')](path[_0x3a52('0x6a')](_0x133f3e,_0x11fd06),_0x11fd06,function(_0xc2f4dd){if(_0xc2f4dd){console['log'](_0x3a52('0x9c'),_0xc2f4dd);}else{fs[_0x3a52('0x9d')](path['join'](_0x133f3e,_0x11fd06));}});}})[_0x3a52('0x2b')](handleError(_0x5853da,null));};
\ No newline at end of file
+var _0x7310=['order','sort','where','filter','map','type','key','VIRTUAL','field','merge','options','includeAll','include','findAll','rows','catch','attributes','length','find','body','params','describe','create','out','secret','MailAccount','findOne','MailAccountId','MailServerOut','Smtp','isNil','service','port','secure','authentication','auth','pass','user','attachments','root','basename','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','accept','mail','read','readAt','UserId','CmContact','Contact','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','mail-interactions','reject','RejectMessage','rejectMessage','toString','join','server','files','tmp','message-%s.eml','subject','Attachment','Attachments','from','existsSync','push','readFileSync','writeFileSync','download','log','err','unlinkSync','html-pdf','rimraf','zip-dir','bluebird','util','path','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','status','end','count','offset','limit','json','apply','save','update','destroy','sendStatus','stack','name','send','index','MailMessage','rawAttributes','model','query','keys','filters','intersection','fields','hasOwnProperty','nolimit'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7310,0x183));var _0x0731=function(_0x2934a3,_0x4c940b){_0x2934a3=_0x2934a3-0x0;var _0x147e65=_0x7310[_0x2934a3];return _0x147e65;};'use strict';var pdf=require(_0x0731('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0731('0x1'));var zipdir=require(_0x0731('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0731('0x3'));var Mustache=require('mustache');var util=require(_0x0731('0x4'));var path=require(_0x0731('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0731('0x6'));var fs=require('fs');var _=require(_0x0731('0x7'));var squel=require('squel');var crypto=require(_0x0731('0x8'));var jsforce=require(_0x0731('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0731('0xa'));var Papa=require(_0x0731('0xb'));var authService=require(_0x0731('0xc'));var hardwareService=require(_0x0731('0xd'));var Redis=require(_0x0731('0xe'));var qs=require(_0x0731('0xf'));var logger=require('../../config/logger')(_0x0731('0x10'));var utils=require(_0x0731('0x11'));var config=require(_0x0731('0x12'));var db=require(_0x0731('0x13'))['db'];config[_0x0731('0x14')]=_['defaults'](config[_0x0731('0x14')],{'host':_0x0731('0x15'),'port':0x18eb});var socket=require(_0x0731('0x16'))(new Redis(config['redis']));require('./mailMessage.socket')['register'](socket);var jayson=require(_0x0731('0x17'));var client=jayson[_0x0731('0x18')]['http']({'port':0x232c});var client9003=jayson['client'][_0x0731('0x19')]({'port':0x232b});var client9002=jayson['client'][_0x0731('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x140f80,_0x543a7e,_0x553dbf,_0x11d2d2){return new BPromise(function(_0x54955c,_0x35c546){var _0x441bc6=_0x11d2d2||client;return _0x441bc6['request'](_0x140f80,_0x553dbf)[_0x0731('0x1a')](function(_0x316357){logger[_0x0731('0x1b')](_0x0731('0x1c'),_0x543a7e,_0x0731('0x1d'));logger['debug'](_0x0731('0x1e'),_0x543a7e,_0x0731('0x1d'),JSON[_0x0731('0x1f')](_0x316357));if(_0x316357['error']){if(_0x316357['error'][_0x0731('0x20')]===0x1f4){logger['error'](_0x0731('0x1c'),_0x543a7e,_0x316357[_0x0731('0x21')]['message']);return _0x35c546(_0x316357[_0x0731('0x21')][_0x0731('0x22')]);}logger[_0x0731('0x21')]('MailMessage,\x20%s,\x20%s',_0x543a7e,_0x316357[_0x0731('0x21')][_0x0731('0x22')]);return _0x54955c(_0x316357[_0x0731('0x21')]['message']);}else{logger[_0x0731('0x1b')](_0x0731('0x1c'),_0x543a7e,_0x0731('0x1d'));_0x54955c(_0x316357['result'][_0x0731('0x22')]);}})['catch'](function(_0x1e3c59){logger[_0x0731('0x21')](_0x0731('0x1c'),_0x543a7e,_0x1e3c59);_0x35c546(_0x1e3c59);});});}function respondWithStatusCode(_0x461a11,_0x354061){_0x354061=_0x354061||0xcc;return function(_0x14caa5){if(_0x14caa5){return _0x461a11['sendStatus'](_0x354061);}return _0x461a11[_0x0731('0x23')](_0x354061)[_0x0731('0x24')]();};}function respondWithResult(_0x2a852e,_0x4e05f2){_0x4e05f2=_0x4e05f2||0xc8;return function(_0x19283e){if(_0x19283e){return _0x2a852e[_0x0731('0x23')](_0x4e05f2)['json'](_0x19283e);}};}function respondWithFilteredResult(_0xae80b1,_0x1fb90f){return function(_0x22249c){if(_0x22249c){var _0xc873af=_0x22249c[_0x0731('0x25')],_0x155e57=_0x1fb90f[_0x0731('0x26')],_0x47ef90=_0x1fb90f[_0x0731('0x26')]+_0x1fb90f[_0x0731('0x27')],_0x122b83;if(_0x47ef90>=_0xc873af){_0x47ef90=_0xc873af;_0x122b83=0xc8;}else{_0x122b83=0xce;}_0xae80b1[_0x0731('0x23')](_0x122b83);return _0xae80b1['set']('Content-Range',_0x155e57+'-'+_0x47ef90+'/'+_0xc873af)[_0x0731('0x28')](_0x22249c);}return null;};}function patchUpdates(_0x1f3f72){return function(_0x2a8c56){try{jsonpatch[_0x0731('0x29')](_0x2a8c56,_0x1f3f72,!![]);}catch(_0x57565e){return BPromise['reject'](_0x57565e);}return _0x2a8c56[_0x0731('0x2a')]();};}function saveUpdates(_0x2c5661,_0x3c6a14){return function(_0x376ec7){if(_0x376ec7){return _0x376ec7[_0x0731('0x2b')](_0x2c5661)['then'](function(_0x555931){return _0x555931;});}return null;};}function removeEntity(_0x2ea3b1,_0x476cd6){return function(_0x1bd55c){if(_0x1bd55c){return _0x1bd55c[_0x0731('0x2c')]()[_0x0731('0x1a')](function(){_0x2ea3b1[_0x0731('0x23')](0xcc)[_0x0731('0x24')]();});}};}function handleEntityNotFound(_0x2a81f3,_0x407a4c){return function(_0x3d0921){if(!_0x3d0921){_0x2a81f3[_0x0731('0x2d')](0x194);}return _0x3d0921;};}function handleError(_0x14833f,_0x421a1e){_0x421a1e=_0x421a1e||0x1f4;return function(_0xa79594){logger[_0x0731('0x21')](_0xa79594[_0x0731('0x2e')]);if(_0xa79594['name']){delete _0xa79594[_0x0731('0x2f')];}_0x14833f['status'](_0x421a1e)[_0x0731('0x30')](_0xa79594);};}exports[_0x0731('0x31')]=function(_0x346cc6,_0x74c7b4){var _0x53cb47={},_0x3dbc11={},_0x49c960={'count':0x0,'rows':[]};var _0x2197b0=db[_0x0731('0x32')][_0x0731('0x33')];_0x3dbc11[_0x0731('0x34')]=_['keys'](_0x2197b0);_0x3dbc11[_0x0731('0x35')]=_[_0x0731('0x36')](_0x346cc6['query']);_0x3dbc11[_0x0731('0x37')]=_[_0x0731('0x38')](_0x3dbc11['model'],_0x3dbc11[_0x0731('0x35')]);_0x53cb47['attributes']=_[_0x0731('0x38')](_0x3dbc11[_0x0731('0x34')],qs[_0x0731('0x39')](_0x346cc6['query'][_0x0731('0x39')]));_0x53cb47['attributes']=_0x53cb47['attributes']['length']?_0x53cb47['attributes']:_0x3dbc11[_0x0731('0x34')];if(!_0x346cc6[_0x0731('0x35')][_0x0731('0x3a')](_0x0731('0x3b'))){_0x53cb47['limit']=qs[_0x0731('0x27')](_0x346cc6['query'][_0x0731('0x27')]);_0x53cb47[_0x0731('0x26')]=qs['offset'](_0x346cc6[_0x0731('0x35')][_0x0731('0x26')]);}_0x53cb47[_0x0731('0x3c')]=qs['sort'](_0x346cc6['query'][_0x0731('0x3d')]);_0x53cb47[_0x0731('0x3e')]=qs[_0x0731('0x37')](_['pick'](_0x346cc6[_0x0731('0x35')],_0x3dbc11[_0x0731('0x37')]));if(_0x346cc6[_0x0731('0x35')][_0x0731('0x3f')]){_0x53cb47[_0x0731('0x3e')]=_['merge'](_0x53cb47[_0x0731('0x3e')],{'$or':_[_0x0731('0x40')](_0x2197b0,function(_0x219dfe){if(_0x219dfe[_0x0731('0x41')][_0x0731('0x42')]!==_0x0731('0x43')){var _0x1ba9b9={};_0x1ba9b9[_0x219dfe[_0x0731('0x44')]]={'$like':'%'+_0x346cc6[_0x0731('0x35')][_0x0731('0x3f')]+'%'};return _0x1ba9b9;}})});}_0x53cb47=_[_0x0731('0x45')]({},_0x53cb47,_0x346cc6[_0x0731('0x46')]);var _0x353fa4={'where':_0x53cb47[_0x0731('0x3e')]};return db[_0x0731('0x32')]['count'](_0x353fa4)['then'](function(_0x3f7543){_0x49c960[_0x0731('0x25')]=_0x3f7543;if(_0x346cc6[_0x0731('0x35')][_0x0731('0x47')]){_0x53cb47[_0x0731('0x48')]=[{'all':!![]}];}return db[_0x0731('0x32')][_0x0731('0x49')](_0x53cb47);})[_0x0731('0x1a')](function(_0x345d6c){_0x49c960[_0x0731('0x4a')]=_0x345d6c;return _0x49c960;})['then'](respondWithFilteredResult(_0x74c7b4,_0x53cb47))[_0x0731('0x4b')](handleError(_0x74c7b4,null));};exports['show']=function(_0x508f39,_0x5a6da9){var _0x27fffb={'raw':!![],'where':{'id':_0x508f39['params']['id']}},_0x460c91={};_0x460c91['model']=_[_0x0731('0x36')](db[_0x0731('0x32')][_0x0731('0x33')]);_0x460c91[_0x0731('0x35')]=_[_0x0731('0x36')](_0x508f39['query']);_0x460c91[_0x0731('0x37')]=_[_0x0731('0x38')](_0x460c91[_0x0731('0x34')],_0x460c91[_0x0731('0x35')]);_0x27fffb[_0x0731('0x4c')]=_[_0x0731('0x38')](_0x460c91[_0x0731('0x34')],qs[_0x0731('0x39')](_0x508f39['query'][_0x0731('0x39')]));_0x27fffb[_0x0731('0x4c')]=_0x27fffb[_0x0731('0x4c')][_0x0731('0x4d')]?_0x27fffb['attributes']:_0x460c91[_0x0731('0x34')];if(_0x508f39[_0x0731('0x35')][_0x0731('0x47')]){_0x27fffb[_0x0731('0x48')]=[{'all':!![]}];}_0x27fffb=_[_0x0731('0x45')]({},_0x27fffb,_0x508f39[_0x0731('0x46')]);return db[_0x0731('0x32')][_0x0731('0x4e')](_0x27fffb)[_0x0731('0x1a')](handleEntityNotFound(_0x5a6da9,null))[_0x0731('0x1a')](respondWithResult(_0x5a6da9,null))['catch'](handleError(_0x5a6da9,null));};exports['update']=function(_0x13850b,_0x4077af){if(_0x13850b[_0x0731('0x4f')]['id']){delete _0x13850b[_0x0731('0x4f')]['id'];}return db[_0x0731('0x32')][_0x0731('0x4e')]({'where':{'id':_0x13850b['params']['id']}})[_0x0731('0x1a')](handleEntityNotFound(_0x4077af,null))[_0x0731('0x1a')](saveUpdates(_0x13850b['body'],null))[_0x0731('0x1a')](respondWithResult(_0x4077af,null))['catch'](handleError(_0x4077af,null));};exports[_0x0731('0x2c')]=function(_0x2058af,_0x1f2128){return db[_0x0731('0x32')][_0x0731('0x4e')]({'where':{'id':_0x2058af[_0x0731('0x50')]['id']}})[_0x0731('0x1a')](handleEntityNotFound(_0x1f2128,null))[_0x0731('0x1a')](removeEntity(_0x1f2128,null))[_0x0731('0x4b')](handleError(_0x1f2128,null));};exports[_0x0731('0x51')]=function(_0x543f95,_0x1ca6f2){return db[_0x0731('0x32')][_0x0731('0x51')]()[_0x0731('0x1a')](respondWithResult(_0x1ca6f2,null))[_0x0731('0x4b')](handleError(_0x1ca6f2,null));};exports[_0x0731('0x52')]=function(_0x5dcc88,_0x3cf6c0){return db[_0x0731('0x32')][_0x0731('0x52')](_0x5dcc88[_0x0731('0x4f')])[_0x0731('0x1a')](function(_0x4eda81){if(_0x4eda81){if(_0x4eda81['direction']===_0x0731('0x53')&&!_0x4eda81[_0x0731('0x54')]){return db[_0x0731('0x55')][_0x0731('0x56')]({'where':{'id':_0x4eda81[_0x0731('0x57')]},'include':[{'model':db[_0x0731('0x58')],'as':_0x0731('0x59'),'raw':!![]}]})[_0x0731('0x1a')](function(_0x1ef97f){if(_0x1ef97f&&_0x1ef97f[_0x0731('0x59')]){var _0x467a1c={'tls':{'rejectUnauthorized':![]}};if(_[_0x0731('0x5a')](_0x1ef97f[_0x0731('0x59')][_0x0731('0x5b')])){_0x467a1c['host']=_0x1ef97f[_0x0731('0x59')]['host'];_0x467a1c['port']=_0x1ef97f[_0x0731('0x59')][_0x0731('0x5c')];_0x467a1c[_0x0731('0x5d')]=_0x1ef97f[_0x0731('0x59')][_0x0731('0x5d')];if(_0x1ef97f[_0x0731('0x59')][_0x0731('0x5e')]){_0x467a1c[_0x0731('0x5f')]={'user':_0x1ef97f[_0x0731('0x59')]['user'],'pass':_0x1ef97f['Smtp'][_0x0731('0x60')]};}}else{_0x467a1c[_0x0731('0x5b')]=_0x1ef97f['Smtp'][_0x0731('0x5b')];_0x467a1c[_0x0731('0x5f')]={'user':_0x1ef97f['Smtp'][_0x0731('0x61')],'pass':_0x1ef97f['Smtp'][_0x0731('0x60')]};_0x467a1c[_0x0731('0x5d')]=_0x1ef97f[_0x0731('0x59')][_0x0731('0x5d')];}if(_0x5dcc88[_0x0731('0x4f')][_0x0731('0x62')]&&_0x5dcc88[_0x0731('0x4f')][_0x0731('0x62')]['length']){for(var _0x110d59=0x0;_0x110d59<_0x5dcc88[_0x0731('0x4f')][_0x0731('0x62')][_0x0731('0x4d')];_0x110d59+=0x1){_0x5dcc88[_0x0731('0x4f')]['attachments'][_0x110d59]={'filename':_0x5dcc88[_0x0731('0x4f')][_0x0731('0x62')][_0x110d59][_0x0731('0x2f')],'path':path['join'](config[_0x0731('0x63')],'server/files/attachments',_0x5dcc88[_0x0731('0x4f')][_0x0731('0x62')][_0x110d59][_0x0731('0x64')])};}}return{'account':_0x467a1c,'message':_0x5dcc88[_0x0731('0x4f')]};}})[_0x0731('0x1a')](function(_0x4d15fb){if(_0x4d15fb){return respondWithRpcPromise(_0x0731('0x65'),'sendMail',_0x4d15fb,client9003)['then'](function(_0x29e2bf){return _0x4eda81[_0x0731('0x2b')]({'read':!![],'messageId':_0x29e2bf[_0x0731('0x66')],'sentAt':moment()[_0x0731('0x67')](_0x0731('0x68'))});})[_0x0731('0x4b')](function(_0x57b19a){logger[_0x0731('0x21')]('%s',JSON[_0x0731('0x1f')](_0x57b19a));return _0x4eda81;});}return _0x4eda81;});}return _0x4eda81;}})[_0x0731('0x1a')](respondWithResult(_0x3cf6c0,0xc9))[_0x0731('0x4b')](handleError(_0x3cf6c0,null));};var interaction_log=require(_0x0731('0x69'))('mail-interactions');exports[_0x0731('0x6a')]=function(_0x2530d5,_0x4f4bb5,_0x2d2f2e){var _0x2cfaef={'channel':_0x0731('0x6b')};if(_0x2530d5['body']['id']){delete _0x2530d5['body']['id'];}_0x2530d5[_0x0731('0x4f')][_0x0731('0x6c')]=!![];_0x2530d5[_0x0731('0x4f')][_0x0731('0x6d')]=moment()['format'](_0x0731('0x68'));_0x2530d5[_0x0731('0x4f')][_0x0731('0x6e')]=_0x2530d5[_0x0731('0x4f')]['UserId']||_0x2530d5['user']['id'];return db['MailMessage'][_0x0731('0x4e')]({'where':{'id':_0x2530d5['params']['id'],'UserId':null},'include':[{'model':db[_0x0731('0x6f')],'as':_0x0731('0x70')}]})[_0x0731('0x1a')](handleEntityNotFound(_0x4f4bb5,null))[_0x0731('0x1a')](saveUpdates(_0x2530d5['body'],null))[_0x0731('0x1a')](function(_0x1eee50){if(_0x1eee50){_0x2cfaef[_0x0731('0x22')]=_0x1eee50[_0x0731('0x71')]({'plain':!![]});return db[_0x0731('0x72')][_0x0731('0x4e')]({'where':{'id':_0x1eee50[_0x0731('0x73')]}});}return null;})[_0x0731('0x1a')](handleEntityNotFound(_0x4f4bb5,null))[_0x0731('0x1a')](function(_0x55a492){if(_0x55a492){return _0x55a492[_0x0731('0x2b')]({'UserId':_0x2530d5[_0x0731('0x4f')][_0x0731('0x6e')],'read1stAt':_[_0x0731('0x5a')](_0x55a492[_0x0731('0x74')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0731('0x1a')](function(_0x85d985){if(_0x85d985){_0x2cfaef[_0x0731('0x75')]=_0x85d985['get']({'plain':!![]});interaction_log[_0x0731('0x1b')](_0x0731('0x76'),_0x2530d5['user']['id'],_0x2530d5[_0x0731('0x61')][_0x0731('0x2f')],_0x2530d5['user']['role'],_0x2cfaef['interaction']['id'],_0x2530d5['body']?JSON['stringify'](_0x2530d5['body']):_0x0731('0x77'));return respondWithRpcPromise(_0x0731('0x78'),'acceptMessage',_0x2cfaef);}return null;})[_0x0731('0x1a')](function(_0x3ca32b){if(_0x3ca32b){if(_0x2530d5['body']['manual']){_0x2cfaef['message'][_0x0731('0x79')]=util[_0x0731('0x67')](_0x0731('0x7a'),_0x2530d5[_0x0731('0x61')][_0x0731('0x2f')]);_0x2cfaef[_0x0731('0x22')][_0x0731('0x7b')]=_0x2cfaef[_0x0731('0x7b')];_0x2cfaef[_0x0731('0x22')][_0x0731('0x7c')]=_0x0731('0x6a');return respondWithRpcPromise(_0x0731('0x7d'),_0x0731('0x7d'),{'event':_0x0731('0x7e'),'message':_0x2cfaef['message']},client9002)[_0x0731('0x1a')](function(){return _0x2cfaef;});}return _0x2cfaef;}return null;})[_0x0731('0x1a')](respondWithResult(_0x4f4bb5,null))[_0x0731('0x4b')](handleError(_0x4f4bb5,null));};var interaction_log=require(_0x0731('0x69'))(_0x0731('0x7f'));exports[_0x0731('0x80')]=function(_0x6cd6cb,_0x55ce56,_0x5ec159){var _0x22b067={'agent':{},'channel':'mail'};if(_0x6cd6cb['body']['id']){delete _0x6cd6cb['body']['id'];}_0x6cd6cb[_0x0731('0x4f')][_0x0731('0x6e')]=_0x6cd6cb[_0x0731('0x4f')][_0x0731('0x6e')]||_0x6cd6cb[_0x0731('0x61')]['id'];_0x22b067['agent']['id']=_0x6cd6cb[_0x0731('0x4f')][_0x0731('0x6e')];return db[_0x0731('0x32')][_0x0731('0x4e')]({'where':{'id':_0x6cd6cb[_0x0731('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x55ce56,null))[_0x0731('0x1a')](function(_0x2ab904){if(_0x2ab904){_0x22b067[_0x0731('0x22')]=_0x2ab904[_0x0731('0x71')]({'plain':!![]});return db['MailInteraction'][_0x0731('0x4e')]({'where':{'id':_0x2ab904[_0x0731('0x73')]}});}return null;})['then'](handleEntityNotFound(_0x55ce56,null))['then'](function(_0x25caae){if(_0x25caae){_0x22b067[_0x0731('0x75')]=_0x25caae[_0x0731('0x71')]({'plain':!![]});interaction_log[_0x0731('0x1b')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x6cd6cb['user']['id'],_0x6cd6cb[_0x0731('0x61')][_0x0731('0x2f')],_0x6cd6cb[_0x0731('0x61')]['role'],_0x22b067[_0x0731('0x75')]['id'],_0x6cd6cb[_0x0731('0x4f')]?JSON[_0x0731('0x1f')](_0x6cd6cb[_0x0731('0x4f')]):_0x0731('0x77'));return respondWithRpcPromise(_0x0731('0x81'),_0x0731('0x82'),_0x22b067);}return null;})[_0x0731('0x1a')](function(_0x2c0c88){if(_0x2c0c88){_0x2c0c88[_0x0731('0x22')][_0x0731('0x79')]=util[_0x0731('0x67')]('SIP/%s',_0x6cd6cb['user'][_0x0731('0x2f')]);_0x2c0c88['message'][_0x0731('0x7b')]=_0x22b067['channel'];_0x2c0c88[_0x0731('0x22')]['event']='reject';respondWithRpcPromise('EventManager',_0x0731('0x7d'),{'event':'rejectmessage','message':_0x2c0c88['message']},client9002);return _0x22b067;}return null;})[_0x0731('0x1a')](respondWithResult(_0x55ce56,null))['catch'](handleError(_0x55ce56,null));};exports['download']=function(_0x472792,_0x198ef2){var _0x29f643=moment()['unix']()[_0x0731('0x83')]();var _0x3eb6a4=path[_0x0731('0x84')](config[_0x0731('0x63')],_0x0731('0x85'),_0x0731('0x86'),_0x0731('0x87'));var _0x362998=path['join'](config[_0x0731('0x63')],'server','files',_0x0731('0x62'));var _0x3847ab=util[_0x0731('0x67')](_0x0731('0x88'),_0x29f643);return db[_0x0731('0x32')][_0x0731('0x4e')]({'where':{'id':_0x472792[_0x0731('0x50')]['id']},'attributes':['id',_0x0731('0x4f'),'from','to','cc',_0x0731('0x89'),'createdAt'],'include':_0x472792[_0x0731('0x35')]['attachments']?[{'model':db[_0x0731('0x8a')],'as':_0x0731('0x8b')}]:undefined})['then'](handleEntityNotFound(_0x198ef2,null))[_0x0731('0x1a')](function(_0x2f113e){if(_0x2f113e){var _0x4c2552=_0x2f113e;var _0x5907ad={'from':_0x4c2552[_0x0731('0x8c')],'to':_0x4c2552['to'],'subject':_0x4c2552[_0x0731('0x89')],'html':_0x4c2552['body'],'attachments':[]};return new BPromise(function(_0x4f8f59,_0x1fd447){if(_0x2f113e[_0x0731('0x8b')]){for(var _0x1e7f1a=0x0;_0x1e7f1a<_0x2f113e['Attachments'][_0x0731('0x4d')];_0x1e7f1a++){var _0x21305b=_0x2f113e[_0x0731('0x8b')][_0x1e7f1a];var _0x11fa83=path['join'](_0x362998,_0x21305b[_0x0731('0x64')]);if(fs[_0x0731('0x8d')](_0x11fa83)){_0x5907ad[_0x0731('0x62')][_0x0731('0x8e')]({'name':_0x21305b[_0x0731('0x2f')],'contentType':_0x21305b[_0x0731('0x41')],'data':fs[_0x0731('0x8f')](_0x11fa83)});}}}emlformat['build'](_0x5907ad,function(_0x2bc664,_0x4e7a8d){if(_0x2bc664)return _0x1fd447(_0x2bc664);fs[_0x0731('0x90')](path[_0x0731('0x84')](_0x3eb6a4,_0x3847ab),_0x4e7a8d);return _0x4f8f59(_0x4e7a8d);});});}})[_0x0731('0x1a')](function(_0x517fe8){if(_0x517fe8){return _0x198ef2[_0x0731('0x91')](path['join'](_0x3eb6a4,_0x3847ab),_0x3847ab,function(_0x54fb2a){if(_0x54fb2a){console[_0x0731('0x92')](_0x0731('0x93'),_0x54fb2a);}else{fs[_0x0731('0x94')](path[_0x0731('0x84')](_0x3eb6a4,_0x3847ab));}});}})['catch'](handleError(_0x198ef2,null));};
\ No newline at end of file
index ff8ed0e..89c0d21 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6334=['hasOwnProperty','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','emit'];(function(_0x4c96ae,_0x45faaf){var _0x259063=function(_0x19a442){while(--_0x19a442){_0x4c96ae['push'](_0x4c96ae['shift']());}};_0x259063(++_0x45faaf);}(_0x6334,0x119));var _0x4633=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0x6334[_0x2d61b2];return _0x12df89;};'use strict';var EventEmitter=require(_0x4633('0x0'));var MailMessage=require(_0x4633('0x1'))['db'][_0x4633('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x4633('0x3')](0x0);var events={'afterCreate':_0x4633('0x4'),'afterUpdate':_0x4633('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1099be){return function(_0x205442,_0x2a2b3c,_0x3572d1){MailMessageEvents[_0x4633('0x6')](_0x1099be+':'+_0x205442['id'],_0x205442);MailMessageEvents[_0x4633('0x6')](_0x1099be,_0x205442);_0x3572d1(null);};}for(var e in events){if(events[_0x4633('0x7')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x4633('0x8')]=MailMessageEvents;
\ No newline at end of file
+var _0x0763=['events','MailMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x0763,0x87));var _0x3076=function(_0x3e91a9,_0x53c466){_0x3e91a9=_0x3e91a9-0x0;var _0x25c9ad=_0x0763[_0x3e91a9];return _0x25c9ad;};'use strict';var EventEmitter=require(_0x3076('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x3076('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x3076('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3076('0x3'),'afterDestroy':_0x3076('0x4')};function emitEvent(_0x3ae0c9){return function(_0xecc289,_0x55bd44,_0x3eba05){MailMessageEvents[_0x3076('0x5')](_0x3ae0c9+':'+_0xecc289['id'],_0xecc289);MailMessageEvents[_0x3076('0x5')](_0x3ae0c9,_0xecc289);_0x3eba05(null);};}for(var e in events){if(events[_0x3076('0x6')](e)){var event=events[e];MailMessage[_0x3076('0x7')](e,emitEvent(event));}}module[_0x3076('0x8')]=MailMessageEvents;
\ No newline at end of file
index 89e4766..b2518da 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0c11=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0c11,0x179));var _0x10c1=function(_0x456032,_0x1a799d){_0x456032=_0x456032-0x0;var _0x1a53cd=_0x0c11[_0x456032];return _0x1a53cd;};'use strict';var _=require(_0x10c1('0x0'));var util=require(_0x10c1('0x1'));var logger=require(_0x10c1('0x2'))(_0x10c1('0x3'));var moment=require(_0x10c1('0x4'));var BPromise=require(_0x10c1('0x5'));var rp=require(_0x10c1('0x6'));var attributes=require(_0x10c1('0x7'));module[_0x10c1('0x8')]=function(_0x3cf33b,_0x3232e2){return _0x3cf33b[_0x10c1('0x9')](_0x10c1('0xa'),attributes,{'tableName':_0x10c1('0xb'),'paranoid':![],'indexes':[{'name':_0x10c1('0xc'),'fields':[_0x10c1('0xc')]}],'timestamps':!![],'charset':_0x10c1('0xd'),'collate':_0x10c1('0xe')});};
\ No newline at end of file
+var _0x94f1=['catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','models','get','direction','toLowerCase','out','isNil','findOne','MailInteractionId','then','update','createdAt','body'];(function(_0x34490e,_0x508bec){var _0x3dfa06=function(_0x285483){while(--_0x285483){_0x34490e['push'](_0x34490e['shift']());}};_0x3dfa06(++_0x508bec);}(_0x94f1,0x162));var _0x194f=function(_0x3ace70,_0x425d44){_0x3ace70=_0x3ace70-0x0;var _0xb25da3=_0x94f1[_0x3ace70];return _0xb25da3;};'use strict';var _=require(_0x194f('0x0'));var util=require(_0x194f('0x1'));var logger=require(_0x194f('0x2'))(_0x194f('0x3'));var moment=require(_0x194f('0x4'));var BPromise=require(_0x194f('0x5'));var rp=require(_0x194f('0x6'));var attributes=require(_0x194f('0x7'));module[_0x194f('0x8')]=function(_0x25fbf5,_0x4c2437){return _0x25fbf5['define'](_0x194f('0x9'),attributes,{'tableName':_0x194f('0xa'),'paranoid':![],'indexes':[{'name':_0x194f('0xb'),'fields':['messageId']}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e3286,_0x220561,_0x4a0ef){var _0x4b5ef4=_0x25fbf5[_0x194f('0xc')];var _0x706994=_0x2e3286[_0x194f('0xd')]({'plain':!![]});if(_0x706994[_0x194f('0xe')][_0x194f('0xf')]()==='in'||_0x706994[_0x194f('0xe')][_0x194f('0xf')]()===_0x194f('0x10')&&!_0x706994['secret']&&!_[_0x194f('0x11')](_0x706994['UserId'])){_0x4b5ef4['MailInteraction'][_0x194f('0x12')]({'where':{'id':_0x706994[_0x194f('0x13')]}})[_0x194f('0x14')](function(_0x148ef6){if(_0x148ef6){_0x148ef6[_0x194f('0x15')]({'lastMsgAt':_0x706994[_0x194f('0x16')],'lastMsgDirection':_0x706994[_0x194f('0xe')][_0x194f('0xf')](),'lastMsgBody':_0x706994[_0x194f('0x17')]});}})[_0x194f('0x18')](function(_0x2d5501){console[_0x194f('0x19')](_0x2d5501);});}_0x4a0ef();}},'charset':_0x194f('0x1a'),'collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file
index f7e0091..3c7cf80 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6c32=['CreateMailMessage','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','MailMessage','create','body'];(function(_0x4f716e,_0x45191f){var _0x486be9=function(_0x4eafd2){while(--_0x4eafd2){_0x4f716e['push'](_0x4f716e['shift']());}};_0x486be9(++_0x45191f);}(_0x6c32,0xb5));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x26c3('0x0'));var util=require('util');var moment=require(_0x26c3('0x1'));var BPromise=require('bluebird');var rs=require(_0x26c3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x26c3('0x3'))['db'];var utils=require(_0x26c3('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x26c3('0x5'));var jayson=require(_0x26c3('0x6'));var client=jayson[_0x26c3('0x7')][_0x26c3('0x8')]({'port':0x232a});config[_0x26c3('0x9')]=_[_0x26c3('0xa')](config[_0x26c3('0x9')],{'host':_0x26c3('0xb'),'port':0x18eb});var socket=require(_0x26c3('0xc'))(new Redis(config[_0x26c3('0x9')]));require('./mailMessage.socket')['register'](socket);function respondWithRpcPromise(_0x3a2f06,_0x5f2097,_0x24de21){return new BPromise(function(_0xc6e3b4,_0x4b7ab2){return client[_0x26c3('0xd')](_0x3a2f06,_0x24de21)[_0x26c3('0xe')](function(_0x431d15){logger[_0x26c3('0xf')](_0x26c3('0x10'),_0x5f2097,'request\x20sent');logger[_0x26c3('0x11')](_0x26c3('0x12'),_0x5f2097,_0x26c3('0x13'),JSON[_0x26c3('0x14')](_0x431d15));if(_0x431d15[_0x26c3('0x15')]){if(_0x431d15[_0x26c3('0x15')][_0x26c3('0x16')]===0x1f4){logger[_0x26c3('0x15')]('MailMessage,\x20%s,\x20%s',_0x5f2097,_0x431d15['error'][_0x26c3('0x17')]);return _0x4b7ab2(_0x431d15[_0x26c3('0x15')][_0x26c3('0x17')]);}logger[_0x26c3('0x15')](_0x26c3('0x10'),_0x5f2097,_0x431d15[_0x26c3('0x15')]['message']);return _0xc6e3b4(_0x431d15[_0x26c3('0x15')][_0x26c3('0x17')]);}else{logger['info'](_0x26c3('0x10'),_0x5f2097,'request\x20sent');_0xc6e3b4(_0x431d15[_0x26c3('0x18')]['message']);}})[_0x26c3('0x19')](function(_0xdd7a33){logger[_0x26c3('0x15')](_0x26c3('0x10'),_0x5f2097,_0xdd7a33);_0x4b7ab2(_0xdd7a33);});});}exports['CreateMailMessage']=function(_0x3ba156){var _0x47bc19=this;return new Promise(function(_0x16441c,_0x48ea4a){return db[_0x26c3('0x1a')][_0x26c3('0x1b')](_0x3ba156[_0x26c3('0x1c')],{'raw':_0x3ba156['options']?_0x3ba156['options']['raw']===undefined?!![]:![]:!![]})[_0x26c3('0xe')](function(_0xba4076){logger[_0x26c3('0xf')](_0x26c3('0x1d'),_0x3ba156);logger[_0x26c3('0x11')]('CreateMailMessage',_0x3ba156,JSON[_0x26c3('0x14')](_0xba4076));_0x16441c(_0xba4076);})['catch'](function(_0x3316a7){logger[_0x26c3('0x15')](_0x26c3('0x1d'),_0x3316a7[_0x26c3('0x17')],_0x3ba156);_0x48ea4a(_0x47bc19[_0x26c3('0x15')](0x1f4,_0x3316a7[_0x26c3('0x17')]));});});};
\ No newline at end of file
+var _0x2e8a=['socket.io-emitter','register','request','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','MailMessage,\x20%s,\x20%s','result','catch','CreateMailMessage','MailMessage','body','options','raw','util','moment','randomstring','ioredis','../../config/utils','client','http','redis','localhost'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x2e8a,0xc7));var _0xa2e8=function(_0x3ee9b2,_0xa090bb){_0x3ee9b2=_0x3ee9b2-0x0;var _0x51ac3e=_0x2e8a[_0x3ee9b2];return _0x51ac3e;};'use strict';var _=require('lodash');var util=require(_0xa2e8('0x0'));var moment=require(_0xa2e8('0x1'));var BPromise=require('bluebird');var rs=require(_0xa2e8('0x2'));var fs=require('fs');var Redis=require(_0xa2e8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa2e8('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa2e8('0x5')][_0xa2e8('0x6')]({'port':0x232a});config[_0xa2e8('0x7')]=_['defaults'](config[_0xa2e8('0x7')],{'host':_0xa2e8('0x8'),'port':0x18eb});var socket=require(_0xa2e8('0x9'))(new Redis(config[_0xa2e8('0x7')]));require('./mailMessage.socket')[_0xa2e8('0xa')](socket);function respondWithRpcPromise(_0x56285e,_0x46cbb3,_0x3802c7){return new BPromise(function(_0x3d6b97,_0x31fa5a){return client[_0xa2e8('0xb')](_0x56285e,_0x3802c7)['then'](function(_0x264a38){logger[_0xa2e8('0xc')]('MailMessage,\x20%s,\x20%s',_0x46cbb3,_0xa2e8('0xd'));logger['debug'](_0xa2e8('0xe'),_0x46cbb3,_0xa2e8('0xd'),JSON[_0xa2e8('0xf')](_0x264a38));if(_0x264a38['error']){if(_0x264a38['error']['code']===0x1f4){logger[_0xa2e8('0x10')]('MailMessage,\x20%s,\x20%s',_0x46cbb3,_0x264a38[_0xa2e8('0x10')]['message']);return _0x31fa5a(_0x264a38[_0xa2e8('0x10')][_0xa2e8('0x11')]);}logger[_0xa2e8('0x10')](_0xa2e8('0x12'),_0x46cbb3,_0x264a38[_0xa2e8('0x10')][_0xa2e8('0x11')]);return _0x3d6b97(_0x264a38['error'][_0xa2e8('0x11')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x46cbb3,_0xa2e8('0xd'));_0x3d6b97(_0x264a38[_0xa2e8('0x13')][_0xa2e8('0x11')]);}})[_0xa2e8('0x14')](function(_0x3063ab){logger['error']('MailMessage,\x20%s,\x20%s',_0x46cbb3,_0x3063ab);_0x31fa5a(_0x3063ab);});});}exports[_0xa2e8('0x15')]=function(_0x3c18dd){var _0x1b9d58=this;return new Promise(function(_0x1a6bbc,_0xd8f70){return db[_0xa2e8('0x16')]['create'](_0x3c18dd[_0xa2e8('0x17')],{'raw':_0x3c18dd[_0xa2e8('0x18')]?_0x3c18dd[_0xa2e8('0x18')][_0xa2e8('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x527a3f){logger[_0xa2e8('0xc')](_0xa2e8('0x15'),_0x3c18dd);logger['debug']('CreateMailMessage',_0x3c18dd,JSON['stringify'](_0x527a3f));_0x1a6bbc(_0x527a3f);})[_0xa2e8('0x14')](function(_0x3bd01e){logger[_0xa2e8('0x10')](_0xa2e8('0x15'),_0x3bd01e[_0xa2e8('0x11')],_0x3c18dd);_0xd8f70(_0x1b9d58[_0xa2e8('0x10')](0x1f4,_0x3bd01e[_0xa2e8('0x11')]));});});};
\ No newline at end of file
index f06b211..b2c8a06 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa6a9=['register','length','./mailMessage.events','save','remove','update','emit','removeListener'];(function(_0x38d6e8,_0x21c3b9){var _0x37e27f=function(_0x2e9a3e){while(--_0x2e9a3e){_0x38d6e8['push'](_0x38d6e8['shift']());}};_0x37e27f(++_0x21c3b9);}(_0xa6a9,0x102));var _0x9a6a=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0xa6a9[_0x2e8418];return _0x548fe6;};'use strict';var MailMessageEvents=require(_0x9a6a('0x0'));var events=[_0x9a6a('0x1'),_0x9a6a('0x2'),_0x9a6a('0x3')];function createListener(_0x14e04b,_0xe8525b){return function(_0x45cb03){_0xe8525b[_0x9a6a('0x4')](_0x14e04b,_0x45cb03);};}function removeListener(_0x582c4f,_0x1c0467){return function(){MailMessageEvents[_0x9a6a('0x5')](_0x582c4f,_0x1c0467);};}exports[_0x9a6a('0x6')]=function(_0x7baaa7){for(var _0x168236=0x0,_0x58a218=events[_0x9a6a('0x7')];_0x168236<_0x58a218;_0x168236++){var _0x43b589=events[_0x168236];var _0x396dcb=createListener('mailMessage:'+_0x43b589,_0x7baaa7);MailMessageEvents['on'](_0x43b589,_0x396dcb);}};
\ No newline at end of file
+var _0xa2c7=['length','mailMessage:','save','remove','update','removeListener','register'];(function(_0x438988,_0x154cdc){var _0xdebf42=function(_0x238ead){while(--_0x238ead){_0x438988['push'](_0x438988['shift']());}};_0xdebf42(++_0x154cdc);}(_0xa2c7,0x80));var _0x7a2c=function(_0x4ed32d,_0x327695){_0x4ed32d=_0x4ed32d-0x0;var _0xf624df=_0xa2c7[_0x4ed32d];return _0xf624df;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x7a2c('0x0'),_0x7a2c('0x1'),_0x7a2c('0x2')];function createListener(_0x47f55b,_0x34ea0f){return function(_0x175af0){_0x34ea0f['emit'](_0x47f55b,_0x175af0);};}function removeListener(_0x3fa8fa,_0x40583){return function(){MailMessageEvents[_0x7a2c('0x3')](_0x3fa8fa,_0x40583);};}exports[_0x7a2c('0x4')]=function(_0x35d56b){for(var _0x47a74c=0x0,_0x222ec2=events[_0x7a2c('0x5')];_0x47a74c<_0x222ec2;_0x47a74c++){var _0x4597e6=events[_0x47a74c];var _0x3bf55e=createListener(_0x7a2c('0x6')+_0x4597e6,_0x35d56b);MailMessageEvents['on'](_0x4597e6,_0x3bf55e);}};
\ No newline at end of file
index 8993af6..cf1c9c7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x601b=['delete','destroy','/:id/teams','removeAgents','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getAgents','create','addTeams','/:id/users','addAgents','put','update'];(function(_0x140d25,_0x50a0d4){var _0x5985e7=function(_0x4f60f3){while(--_0x4f60f3){_0x140d25['push'](_0x140d25['shift']());}};_0x5985e7(++_0x50a0d4);}(_0x601b,0xb4));var _0xb601=function(_0x7854e8,_0x2c4428){_0x7854e8=_0x7854e8-0x0;var _0x53473a=_0x601b[_0x7854e8];return _0x53473a;};'use strict';var multer=require(_0xb601('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb601('0x1'));var express=require(_0xb601('0x2'));var router=express[_0xb601('0x3')]();var auth=require(_0xb601('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb601('0x5'));var controller=require('./mailQueue.controller');router[_0xb601('0x6')]('/',auth[_0xb601('0x7')](),controller[_0xb601('0x8')]);router[_0xb601('0x6')](_0xb601('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xb601('0xa'),auth[_0xb601('0x7')](),controller[_0xb601('0xb')]);router[_0xb601('0x6')](_0xb601('0xc'),auth[_0xb601('0x7')](),controller['getMembers']);router[_0xb601('0x6')]('/:id/teams',auth[_0xb601('0x7')](),controller['getTeams']);router[_0xb601('0x6')]('/:id/users',auth[_0xb601('0x7')](),controller[_0xb601('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb601('0xe')]);router['post']('/:id/teams',auth[_0xb601('0x7')](),controller[_0xb601('0xf')]);router['post'](_0xb601('0x10'),auth[_0xb601('0x7')](),controller[_0xb601('0x11')]);router[_0xb601('0x12')](_0xb601('0xa'),auth[_0xb601('0x7')](),controller[_0xb601('0x13')]);router[_0xb601('0x14')](_0xb601('0xa'),auth[_0xb601('0x7')](),controller[_0xb601('0x15')]);router['delete'](_0xb601('0x16'),auth[_0xb601('0x7')](),controller['removeTeams']);router[_0xb601('0x14')](_0xb601('0x10'),auth[_0xb601('0x7')](),controller[_0xb601('0x17')]);module[_0xb601('0x18')]=router;
\ No newline at end of file
+var _0xbdba=['/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','create','post','addTeams','put','update','delete','destroy','removeAgents','exports','util','express','Router','../../components/auth/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','/describe','describe'];(function(_0x230e39,_0x5341){var _0xa804e=function(_0xe14796){while(--_0xe14796){_0x230e39['push'](_0x230e39['shift']());}};_0xa804e(++_0x5341);}(_0xbdba,0x1ca));var _0xabdb=function(_0x3f517e,_0x3fb6de){_0x3f517e=_0x3f517e-0x0;var _0x220216=_0xbdba[_0x3f517e];return _0x220216;};'use strict';var multer=require('multer');var util=require(_0xabdb('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xabdb('0x1'));var router=express[_0xabdb('0x2')]();var auth=require(_0xabdb('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xabdb('0x4'));var controller=require(_0xabdb('0x5'));router[_0xabdb('0x6')]('/',auth[_0xabdb('0x7')](),controller['index']);router[_0xabdb('0x6')](_0xabdb('0x8'),auth[_0xabdb('0x7')](),controller[_0xabdb('0x9')]);router[_0xabdb('0x6')](_0xabdb('0xa'),auth[_0xabdb('0x7')](),controller[_0xabdb('0xb')]);router[_0xabdb('0x6')](_0xabdb('0xc'),auth[_0xabdb('0x7')](),controller[_0xabdb('0xd')]);router[_0xabdb('0x6')](_0xabdb('0xe'),auth[_0xabdb('0x7')](),controller['getTeams']);router[_0xabdb('0x6')](_0xabdb('0xf'),auth[_0xabdb('0x7')](),controller[_0xabdb('0x10')]);router['post']('/',auth[_0xabdb('0x7')](),controller[_0xabdb('0x11')]);router[_0xabdb('0x12')](_0xabdb('0xe'),auth[_0xabdb('0x7')](),controller[_0xabdb('0x13')]);router[_0xabdb('0x12')](_0xabdb('0xf'),auth[_0xabdb('0x7')](),controller['addAgents']);router[_0xabdb('0x14')](_0xabdb('0xa'),auth[_0xabdb('0x7')](),controller[_0xabdb('0x15')]);router[_0xabdb('0x16')](_0xabdb('0xa'),auth[_0xabdb('0x7')](),controller[_0xabdb('0x17')]);router[_0xabdb('0x16')](_0xabdb('0xe'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xabdb('0x16')](_0xabdb('0xf'),auth[_0xabdb('0x7')](),controller[_0xabdb('0x18')]);module[_0xabdb('0x19')]=router;
\ No newline at end of file
index 16e1a51..0adc242 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe0f3=['ENUM','beepall','sequelize','exports','STRING','name'];(function(_0x17e3eb,_0x247074){var _0x51885d=function(_0x214fd0){while(--_0x214fd0){_0x17e3eb['push'](_0x17e3eb['shift']());}};_0x51885d(++_0x247074);}(_0xe0f3,0xf2));var _0x3e0f=function(_0x5be5af,_0x47f09e){_0x5be5af=_0x5be5af-0x0;var _0x854c06=_0xe0f3[_0x5be5af];return _0x854c06;};'use strict';var Sequelize=require(_0x3e0f('0x0'));module[_0x3e0f('0x1')]={'name':{'type':Sequelize[_0x3e0f('0x2')],'unique':_0x3e0f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3e0f('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3e0f('0x4')]('rrmemory',_0x3e0f('0x5'),'roundrobin')}};
\ No newline at end of file
+var _0xe78a=['ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x302b78,_0x285273){var _0x24b681=function(_0x3dd6d1){while(--_0x3dd6d1){_0x302b78['push'](_0x302b78['shift']());}};_0x24b681(++_0x285273);}(_0xe78a,0x10b));var _0xae78=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe78a[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xae78('0x0'));module[_0xae78('0x1')]={'name':{'type':Sequelize[_0xae78('0x2')],'unique':_0xae78('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xae78('0x2')]},'timeout':{'type':Sequelize[_0xae78('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xae78('0x5')](_0xae78('0x6'),'beepall',_0xae78('0x7'))}};
\ No newline at end of file
index c0b8e51..a129b26 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['stack','name','index','MailQueue','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','map','type','key','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','MailQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserMailQueue','pick','MailQueueId','findAll','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','Team','Agents','union','addAgents','penalty','ids','removeTeams','omit','emit','removeAgents','isArray','userMailQueue:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','error'];(function(_0x333e56,_0x5ed0d9){var _0x14524c=function(_0x1c2d7d){while(--_0x1c2d7d){_0x333e56['push'](_0x333e56['shift']());}};_0x14524c(++_0x5ed0d9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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 authService=require(_0x0a9e('0xe'));var hardwareService=require(_0x0a9e('0xf'));var Redis=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x0a9e('0x13')]=_[_0x0a9e('0x14')](config[_0x0a9e('0x13')],{'host':_0x0a9e('0x15'),'port':0x18eb});var socket=require(_0x0a9e('0x16'))(new Redis(config[_0x0a9e('0x13')]));require('./mailQueue.socket')[_0x0a9e('0x17')](socket);function respondWithStatusCode(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xcc;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x18')](_0x2b4227);}return _0x239b12[_0x0a9e('0x19')](_0x2b4227)['end']();};}function respondWithResult(_0x22dccb,_0x5d0880){_0x5d0880=_0x5d0880||0xc8;return function(_0x1985b6){if(_0x1985b6){return _0x22dccb['status'](_0x5d0880)[_0x0a9e('0x1a')](_0x1985b6);}};}function respondWithFilteredResult(_0x12066b,_0x48f32d){return function(_0x225616){if(_0x225616){var _0x5a0a06=_0x225616[_0x0a9e('0x1b')],_0x459eb1=_0x48f32d[_0x0a9e('0x1c')],_0x478723=_0x48f32d[_0x0a9e('0x1c')]+_0x48f32d[_0x0a9e('0x1d')],_0x106033;if(_0x478723>=_0x5a0a06){_0x478723=_0x5a0a06;_0x106033=0xc8;}else{_0x106033=0xce;}_0x12066b[_0x0a9e('0x19')](_0x106033);return _0x12066b[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x459eb1+'-'+_0x478723+'/'+_0x5a0a06)[_0x0a9e('0x1a')](_0x225616);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x20')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x21')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x22')](_0x5a09ef)[_0x0a9e('0x23')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x24')]()[_0x0a9e('0x23')](function(){var _0x370d86=_0x2fb0e4[_0x0a9e('0x25')]({'plain':!![]});var _0x16b1ca='MailQueues';return db['UserProfileResource'][_0x0a9e('0x24')]({'where':{'type':_0x16b1ca,'resourceId':_0x370d86['id']}})[_0x0a9e('0x23')](function(){return _0x2fb0e4;});})[_0x0a9e('0x23')](function(){_0x4abc77[_0x0a9e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x384319,_0x479bc4){return function(_0x45a1e7){if(!_0x45a1e7){_0x384319['sendStatus'](0x194);}return _0x45a1e7;};}function handleError(_0x1dc186,_0x34dc65){_0x34dc65=_0x34dc65||0x1f4;return function(_0x25fba9){logger[_0x0a9e('0x26')](_0x25fba9[_0x0a9e('0x27')]);if(_0x25fba9[_0x0a9e('0x28')]){delete _0x25fba9[_0x0a9e('0x28')];}_0x1dc186[_0x0a9e('0x19')](_0x34dc65)['send'](_0x25fba9);};}exports[_0x0a9e('0x29')]=function(_0x468813,_0x2b1f27){var _0x2ec755={},_0x5c877d={},_0x15b200={'count':0x0,'rows':[]};var _0x40e7a3=db[_0x0a9e('0x2a')][_0x0a9e('0x2b')];_0x5c877d[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x40e7a3);_0x5c877d[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x468813[_0x0a9e('0x2e')]);_0x5c877d['filters']=_[_0x0a9e('0x2f')](_0x5c877d['model'],_0x5c877d[_0x0a9e('0x2e')]);_0x2ec755[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x5c877d[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x468813['query'][_0x0a9e('0x31')]));_0x2ec755[_0x0a9e('0x30')]=_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x2ec755[_0x0a9e('0x30')]:_0x5c877d[_0x0a9e('0x2c')];if(!_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x2ec755[_0x0a9e('0x1d')]=qs['limit'](_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x2ec755[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x468813['query'][_0x0a9e('0x1c')]);}_0x2ec755[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x468813[_0x0a9e('0x2e')]['sort']);_0x2ec755['where']=qs[_0x0a9e('0x36')](_['pick'](_0x468813[_0x0a9e('0x2e')],_0x5c877d[_0x0a9e('0x36')]));if(_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]){_0x2ec755['where']=_[_0x0a9e('0x38')](_0x2ec755[_0x0a9e('0x39')],{'$or':_[_0x0a9e('0x3a')](_0x40e7a3,function(_0x533942){if(_0x533942[_0x0a9e('0x3b')][_0x0a9e('0x3c')]!==_0x0a9e('0x3d')){var _0x4c1c0e={};_0x4c1c0e[_0x533942['field']]={'$like':'%'+_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x4c1c0e;}})});}_0x2ec755=_['merge']({},_0x2ec755,_0x468813[_0x0a9e('0x3e')]);var _0x419125={'where':_0x2ec755[_0x0a9e('0x39')]};return db[_0x0a9e('0x2a')]['count'](_0x419125)['then'](function(_0x15e37d){_0x15b200[_0x0a9e('0x1b')]=_0x15e37d;if(_0x468813['query'][_0x0a9e('0x3f')]){_0x2ec755[_0x0a9e('0x40')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')]['findAll'](_0x2ec755);})[_0x0a9e('0x23')](function(_0x2cfea9){_0x15b200[_0x0a9e('0x41')]=_0x2cfea9;return _0x15b200;})[_0x0a9e('0x23')](respondWithFilteredResult(_0x2b1f27,_0x2ec755))[_0x0a9e('0x42')](handleError(_0x2b1f27,null));};exports[_0x0a9e('0x43')]=function(_0x2881b3,_0x45a9b8){var _0x23b089={'raw':!![],'where':{'id':_0x2881b3[_0x0a9e('0x44')]['id']}},_0x3da2cd={};_0x3da2cd[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x3da2cd['query']=_['keys'](_0x2881b3[_0x0a9e('0x2e')]);_0x3da2cd[_0x0a9e('0x36')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],_0x3da2cd[_0x0a9e('0x2e')]);_0x23b089[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x23b089[_0x0a9e('0x30')]=_0x23b089['attributes'][_0x0a9e('0x32')]?_0x23b089[_0x0a9e('0x30')]:_0x3da2cd[_0x0a9e('0x2c')];if(_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x3f')]){_0x23b089[_0x0a9e('0x40')]=[{'all':!![]}];}_0x23b089=_[_0x0a9e('0x38')]({},_0x23b089,_0x2881b3[_0x0a9e('0x3e')]);return db['MailQueue'][_0x0a9e('0x45')](_0x23b089)['then'](handleEntityNotFound(_0x45a9b8,null))[_0x0a9e('0x23')](respondWithResult(_0x45a9b8,null))[_0x0a9e('0x42')](handleError(_0x45a9b8,null));};exports[_0x0a9e('0x46')]=function(_0x562fb4,_0x14bec2){return db[_0x0a9e('0x2a')][_0x0a9e('0x46')](_0x562fb4[_0x0a9e('0x47')],{})[_0x0a9e('0x23')](function(_0x37be73){var _0x45bf7f=_0x562fb4['user'][_0x0a9e('0x25')]({'plain':!![]});if(!_0x45bf7f)throw new Error(_0x0a9e('0x48'));if(_0x45bf7f[_0x0a9e('0x49')]===_0x0a9e('0x4a')){var _0x409789=_0x37be73[_0x0a9e('0x25')]({'plain':!![]});var _0x6054ee=_0x0a9e('0x4b');return db[_0x0a9e('0x4c')]['find']({'where':{'name':_0x6054ee,'userProfileId':_0x45bf7f[_0x0a9e('0x4d')]},'raw':!![]})[_0x0a9e('0x23')](function(_0x4f7240){if(_0x4f7240&&_0x4f7240['autoAssociation']===0x0){return db['UserProfileResource'][_0x0a9e('0x46')]({'name':_0x409789[_0x0a9e('0x28')],'resourceId':_0x409789['id'],'type':_0x4f7240[_0x0a9e('0x28')],'sectionId':_0x4f7240['id']},{})[_0x0a9e('0x23')](function(){return _0x37be73;});}else{return _0x37be73;}})[_0x0a9e('0x42')](function(_0x30decb){logger[_0x0a9e('0x26')](_0x0a9e('0x4e'),_0x30decb);throw _0x30decb;});}return _0x37be73;})['then'](respondWithResult(_0x14bec2,0xc9))['catch'](handleError(_0x14bec2,null));};exports['update']=function(_0x39d77d,_0x204173){if(_0x39d77d[_0x0a9e('0x47')]['id']){delete _0x39d77d['body']['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x39d77d['params']['id']}})['then'](handleEntityNotFound(_0x204173,null))[_0x0a9e('0x23')](saveUpdates(_0x39d77d['body'],null))[_0x0a9e('0x23')](respondWithResult(_0x204173,null))['catch'](handleError(_0x204173,null));};exports[_0x0a9e('0x24')]=function(_0x3c20b2,_0x439340){return db['MailQueue'][_0x0a9e('0x45')]({'where':{'id':_0x3c20b2[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x439340,null))['then'](removeEntity(_0x439340,null))[_0x0a9e('0x42')](handleError(_0x439340,null));};exports[_0x0a9e('0x4f')]=function(_0x49c095,_0x145931){return db['MailQueue'][_0x0a9e('0x4f')]()['then'](respondWithResult(_0x145931,null))[_0x0a9e('0x42')](handleError(_0x145931,null));};exports['getMembers']=function(_0x5da27d,_0x5df0ad,_0x2da03c){var _0x47de4c={'raw':!![],'where':{}},_0x2f7092={},_0x65432;return db[_0x0a9e('0x2a')][_0x0a9e('0x50')]({'where':{'id':_0x5da27d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x5df0ad,null))[_0x0a9e('0x23')](function(_0x28d814){if(_0x28d814){_0x65432=_0x28d814['get']({'plain':!![]});_0x2f7092[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x51')][_0x0a9e('0x2b')]);_0x2f7092[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5da27d['query']);_0x2f7092[_0x0a9e('0x36')]=_[_0x0a9e('0x2f')](_0x2f7092['model'],_0x2f7092[_0x0a9e('0x2e')]);_0x47de4c['attributes']=_[_0x0a9e('0x2f')](_0x2f7092['model'],qs['fields'](_0x5da27d['query'][_0x0a9e('0x31')]));_0x47de4c['attributes']=_0x47de4c[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x47de4c[_0x0a9e('0x30')]:_0x2f7092[_0x0a9e('0x2c')];if(!_0x5da27d[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x47de4c[_0x0a9e('0x1d')]=qs['limit'](_0x5da27d[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x47de4c[_0x0a9e('0x1c')]=qs['offset'](_0x5da27d[_0x0a9e('0x2e')][_0x0a9e('0x1c')]);}_0x47de4c[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x5da27d['query'][_0x0a9e('0x35')]);_0x47de4c[_0x0a9e('0x39')]=qs['filters'](_[_0x0a9e('0x52')](_0x5da27d[_0x0a9e('0x2e')],_0x2f7092[_0x0a9e('0x36')]));_0x47de4c[_0x0a9e('0x39')][_0x0a9e('0x53')]=_0x28d814['id'];if(_0x5da27d['query'][_0x0a9e('0x37')]){_0x47de4c[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x47de4c['where'],{'$or':_[_0x0a9e('0x3a')](_0x47de4c['attributes'],function(_0x5211e3){var _0x242745={};_0x242745[_0x5211e3]={'$like':'%'+_0x5da27d[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x242745;})});}_0x47de4c=_[_0x0a9e('0x38')]({},_0x47de4c,_0x5da27d[_0x0a9e('0x3e')]);return db[_0x0a9e('0x51')][_0x0a9e('0x54')](_0x47de4c);}})[_0x0a9e('0x23')](function(_0x2d7205){if(_0x2d7205){return db[_0x0a9e('0x55')][_0x0a9e('0x56')]({'where':{'id':_[_0x0a9e('0x3a')](_0x2d7205,_0x0a9e('0x57')),'role':_0x0a9e('0x58')},'attributes':['id',_0x0a9e('0x28'),_0x0a9e('0x59'),_0x0a9e('0x5a'),_0x0a9e('0x5b')]});}})['then'](function(_0x1b0b98){if(_0x1b0b98){return{'count':_0x1b0b98[_0x0a9e('0x1b')],'rows':_[_0x0a9e('0x3a')](_0x1b0b98['rows'],function(_0x1148a1){return{'membername':_0x1148a1[_0x0a9e('0x28')],'UserId':_0x1148a1['id'],'queue_name':_0x65432['name'],'MailQueueId':_0x65432['id'],'interface':util[_0x0a9e('0x5c')](_0x0a9e('0x5d'),_0x0a9e('0x5e'),_0x1148a1[_0x0a9e('0x28')]),'penalty':0x0,'paused':_0x1148a1[_0x0a9e('0x59')],'createdAt':_0x1148a1['createdAt'],'updatedAt':_0x1148a1['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5df0ad,_0x47de4c))[_0x0a9e('0x42')](handleError(_0x5df0ad,null));};exports[_0x0a9e('0x5f')]=function(_0x1104ad,_0x23a7d3,_0x6abd03){var _0x380ab3={};var _0xeef20={};var _0x1a0677;var _0x5512d1;return db[_0x0a9e('0x2a')][_0x0a9e('0x50')]({'where':{'id':_0x1104ad[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x23a7d3,null))[_0x0a9e('0x23')](function(_0x583b2e){if(_0x583b2e){_0x1a0677=_0x583b2e;_0xeef20[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db['Team'][_0x0a9e('0x2b')]);_0xeef20[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x1104ad[_0x0a9e('0x2e')]);_0xeef20['filters']=_[_0x0a9e('0x2f')](_0xeef20[_0x0a9e('0x2c')],_0xeef20[_0x0a9e('0x2e')]);_0x380ab3[_0x0a9e('0x30')]=_['intersection'](_0xeef20[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x1104ad[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x380ab3['attributes']=_0x380ab3[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x380ab3[_0x0a9e('0x30')]:_0xeef20[_0x0a9e('0x2c')];_0x380ab3[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x1104ad[_0x0a9e('0x2e')][_0x0a9e('0x35')]);_0x380ab3[_0x0a9e('0x39')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0x52')](_0x1104ad[_0x0a9e('0x2e')],_0xeef20[_0x0a9e('0x36')]));if(_0x1104ad[_0x0a9e('0x2e')]['filter']){_0x380ab3[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x380ab3[_0x0a9e('0x39')],{'$or':_['map'](_0x380ab3[_0x0a9e('0x30')],function(_0x33dda0){var _0x8cea96={};_0x8cea96[_0x33dda0]={'$like':'%'+_0x1104ad[_0x0a9e('0x2e')]['filter']+'%'};return _0x8cea96;})});}_0x380ab3=_['merge']({},_0x380ab3,_0x1104ad[_0x0a9e('0x3e')]);return _0x1a0677[_0x0a9e('0x5f')](_0x380ab3);}})['then'](function(_0x45108c){if(_0x45108c){_0x5512d1=_0x45108c['length'];if(!_0x1104ad[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x380ab3[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x1104ad[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x380ab3[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x1104ad[_0x0a9e('0x2e')]['offset']);}return _0x1a0677[_0x0a9e('0x5f')](_0x380ab3);}})[_0x0a9e('0x23')](function(_0x45c109){if(_0x45c109){return _0x45c109?{'count':_0x5512d1,'rows':_0x45c109}:null;}})[_0x0a9e('0x23')](respondWithResult(_0x23a7d3,null))['catch'](handleError(_0x23a7d3,null));};exports[_0x0a9e('0x60')]=function(_0xf0db1,_0x4bf3a5,_0x1d6834){var _0x5b7940=[];var _0x163710;return db[_0x0a9e('0x61')][_0x0a9e('0x54')]({'where':{'id':_0xf0db1[_0x0a9e('0x47')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0a9e('0x62'),'attributes':['id'],'raw':!![]}]})[_0x0a9e('0x23')](function(_0x94dcf5){if(_0x94dcf5){for(var _0x5ac73d=0x0;_0x5ac73d<_0x94dcf5[_0x0a9e('0x32')];_0x5ac73d+=0x1){for(var _0x36e975=0x0;_0x36e975<_0x94dcf5[_0x5ac73d]['Agents']['length'];_0x36e975+=0x1){_0x5b7940=_[_0x0a9e('0x63')](_0x5b7940,[_0x94dcf5[_0x5ac73d]['Agents'][_0x36e975]['id']]);}}return _0x5b7940;}})['then'](function(_0x4dc6b3){if(_0x4dc6b3){return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0xf0db1[_0x0a9e('0x44')]['id']}});}})[_0x0a9e('0x23')](function(_0x3c6dd6){if(_0x3c6dd6){_0x163710=_0x3c6dd6;return _0x163710[_0x0a9e('0x64')](_0x5b7940,{'penalty':_0xf0db1['body'][_0x0a9e('0x65')]});}})['then'](function(_0x2871c1){if(_0x2871c1){return _0x163710[_0x0a9e('0x60')](_0xf0db1[_0x0a9e('0x47')][_0x0a9e('0x66')]);}})['then'](handleEntityNotFound(_0x4bf3a5,null))[_0x0a9e('0x23')](respondWithStatusCode(_0x4bf3a5,null))[_0x0a9e('0x42')](handleError(_0x4bf3a5,null));};exports[_0x0a9e('0x67')]=function(_0x5b74c3,_0xb6e411,_0x21e592){var _0x2a563d=[];var _0x22063c;return db[_0x0a9e('0x61')][_0x0a9e('0x54')]({'where':{'id':_0x5b74c3[_0x0a9e('0x2e')][_0x0a9e('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0a9e('0x62'),'attributes':['id'],'raw':!![]}]})[_0x0a9e('0x23')](function(_0x589ff3){if(_0x589ff3){for(var _0x40e0f0=0x0;_0x40e0f0<_0x589ff3[_0x0a9e('0x32')];_0x40e0f0+=0x1){for(var _0x3a1974=0x0;_0x3a1974<_0x589ff3[_0x40e0f0]['Agents'][_0x0a9e('0x32')];_0x3a1974+=0x1){_0x2a563d=_['union'](_0x2a563d,[_0x589ff3[_0x40e0f0][_0x0a9e('0x62')][_0x3a1974]['id']]);}}return _0x2a563d;}})[_0x0a9e('0x23')](function(_0x558a87){if(_0x558a87){return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x5b74c3[_0x0a9e('0x44')]['id']}});}})[_0x0a9e('0x23')](function(_0x3a9a85){if(_0x3a9a85){_0x22063c=_0x3a9a85;return _0x22063c['removeAgents'](_0x2a563d);}})[_0x0a9e('0x23')](function(_0x31d25a){if(_0x22063c){return _0x22063c[_0x0a9e('0x67')](_0x5b74c3[_0x0a9e('0x2e')][_0x0a9e('0x66')]);}})[_0x0a9e('0x23')](handleEntityNotFound(_0xb6e411,null))[_0x0a9e('0x23')](respondWithStatusCode(_0xb6e411,null))[_0x0a9e('0x42')](handleError(_0xb6e411,null));};exports[_0x0a9e('0x64')]=function(_0x31af8c,_0x151956,_0x3754e2){return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x31af8c[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x151956,null))[_0x0a9e('0x23')](function(_0x2ed526){if(_0x2ed526){return _0x2ed526[_0x0a9e('0x64')](_0x31af8c['body'][_0x0a9e('0x66')],_[_0x0a9e('0x68')](_0x31af8c['body'],[_0x0a9e('0x66'),'id'])||{})['spread'](function(_0x45d113){for(var _0x27041d=0x0;_0x27041d<_0x31af8c[_0x0a9e('0x47')][_0x0a9e('0x66')]['length'];_0x27041d+=0x1){socket[_0x0a9e('0x69')]('userMailQueue:save',{'UserId':_0x31af8c[_0x0a9e('0x47')][_0x0a9e('0x66')][_0x27041d],'MailQueueId':_0x31af8c['params']['id']});}return _0x45d113;});}})[_0x0a9e('0x23')](respondWithResult(_0x151956,null))[_0x0a9e('0x42')](handleError(_0x151956,null));};exports[_0x0a9e('0x6a')]=function(_0x4ab276,_0x4c788f,_0x1b82b7){var _0x6ba2be;return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x4ab276[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x4c788f,null))[_0x0a9e('0x23')](function(_0x3c75b9){if(_0x3c75b9){return _0x3c75b9[_0x0a9e('0x6a')](_0x4ab276['query'][_0x0a9e('0x66')])['then'](function(_0x287324){if(_[_0x0a9e('0x6b')](_0x4ab276[_0x0a9e('0x2e')][_0x0a9e('0x66')])){for(var _0x1b61d5=0x0;_0x1b61d5<_0x4ab276['query'][_0x0a9e('0x66')][_0x0a9e('0x32')];_0x1b61d5+=0x1){socket[_0x0a9e('0x69')](_0x0a9e('0x6c'),{'UserId':_0x4ab276[_0x0a9e('0x2e')]['ids'][_0x1b61d5],'MailQueueId':_0x4ab276['params']['id']});}}else{socket[_0x0a9e('0x69')]('userMailQueue:remove',{'UserId':_0x4ab276[_0x0a9e('0x2e')][_0x0a9e('0x66')],'MailQueueId':_0x4ab276[_0x0a9e('0x44')]['id']});}});}})[_0x0a9e('0x23')](respondWithStatusCode(_0x4c788f,null))[_0x0a9e('0x42')](handleError(_0x4c788f,null));};exports[_0x0a9e('0x6d')]=function(_0x596312,_0x4db918,_0x1889ed){var _0x5dfbe2={};var _0x2469d1={};var _0x5c689c;var _0x427ccc;return db['MailQueue']['findOne']({'where':{'id':_0x596312[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x4db918,null))['then'](function(_0x170af6){if(_0x170af6){_0x5c689c=_0x170af6;_0x2469d1[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x55')][_0x0a9e('0x2b')]);_0x2469d1['query']=_['keys'](_0x596312[_0x0a9e('0x2e')]);_0x2469d1[_0x0a9e('0x36')]=_[_0x0a9e('0x2f')](_0x2469d1[_0x0a9e('0x2c')],_0x2469d1[_0x0a9e('0x2e')]);_0x5dfbe2['attributes']=_[_0x0a9e('0x2f')](_0x2469d1[_0x0a9e('0x2c')],qs['fields'](_0x596312[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x5dfbe2[_0x0a9e('0x30')]=_0x5dfbe2[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x5dfbe2[_0x0a9e('0x30')]:_0x2469d1[_0x0a9e('0x2c')];_0x5dfbe2[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x596312[_0x0a9e('0x2e')]['sort']);_0x5dfbe2[_0x0a9e('0x39')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0x52')](_0x596312[_0x0a9e('0x2e')],_0x2469d1[_0x0a9e('0x36')]));if(_0x596312['query']['filter']){_0x5dfbe2[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x5dfbe2[_0x0a9e('0x39')],{'$or':_[_0x0a9e('0x3a')](_0x5dfbe2[_0x0a9e('0x30')],function(_0x59e46f){var _0x1339d0={};_0x1339d0[_0x59e46f]={'$like':'%'+_0x596312[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x1339d0;})});}_0x5dfbe2=_['merge']({},_0x5dfbe2,_0x596312[_0x0a9e('0x3e')]);return _0x5c689c['getAgents'](_0x5dfbe2);}})[_0x0a9e('0x23')](function(_0x4799d4){if(_0x4799d4){_0x427ccc=_0x4799d4[_0x0a9e('0x32')];if(!_0x596312[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x5dfbe2[_0x0a9e('0x1d')]=qs['limit'](_0x596312[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x5dfbe2[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x596312[_0x0a9e('0x2e')][_0x0a9e('0x1c')]);}return _0x5c689c[_0x0a9e('0x6d')](_0x5dfbe2);}})[_0x0a9e('0x23')](function(_0x2aaf07){if(_0x2aaf07){return _0x2aaf07?{'count':_0x427ccc,'rows':_0x2aaf07}:null;}})[_0x0a9e('0x23')](respondWithResult(_0x4db918,null))[_0x0a9e('0x42')](handleError(_0x4db918,null));};
\ No newline at end of file
+var _0xa9e0=['stack','name','index','MailQueue','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','map','type','key','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','MailQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserMailQueue','pick','MailQueueId','findAll','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','Team','Agents','union','addAgents','penalty','ids','removeTeams','omit','emit','removeAgents','isArray','userMailQueue:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','error'];(function(_0x5f15f4,_0x5efcaf){var _0x17d662=function(_0x59516d){while(--_0x59516d){_0x5f15f4['push'](_0x5f15f4['shift']());}};_0x17d662(++_0x5efcaf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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 authService=require(_0x0a9e('0xe'));var hardwareService=require(_0x0a9e('0xf'));var Redis=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x0a9e('0x13')]=_[_0x0a9e('0x14')](config[_0x0a9e('0x13')],{'host':_0x0a9e('0x15'),'port':0x18eb});var socket=require(_0x0a9e('0x16'))(new Redis(config[_0x0a9e('0x13')]));require('./mailQueue.socket')[_0x0a9e('0x17')](socket);function respondWithStatusCode(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xcc;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x18')](_0x2b4227);}return _0x239b12[_0x0a9e('0x19')](_0x2b4227)['end']();};}function respondWithResult(_0x22dccb,_0x5d0880){_0x5d0880=_0x5d0880||0xc8;return function(_0x1985b6){if(_0x1985b6){return _0x22dccb['status'](_0x5d0880)[_0x0a9e('0x1a')](_0x1985b6);}};}function respondWithFilteredResult(_0x12066b,_0x48f32d){return function(_0x225616){if(_0x225616){var _0x5a0a06=_0x225616[_0x0a9e('0x1b')],_0x459eb1=_0x48f32d[_0x0a9e('0x1c')],_0x478723=_0x48f32d[_0x0a9e('0x1c')]+_0x48f32d[_0x0a9e('0x1d')],_0x106033;if(_0x478723>=_0x5a0a06){_0x478723=_0x5a0a06;_0x106033=0xc8;}else{_0x106033=0xce;}_0x12066b[_0x0a9e('0x19')](_0x106033);return _0x12066b[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x459eb1+'-'+_0x478723+'/'+_0x5a0a06)[_0x0a9e('0x1a')](_0x225616);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x20')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x21')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x22')](_0x5a09ef)[_0x0a9e('0x23')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x24')]()[_0x0a9e('0x23')](function(){var _0x370d86=_0x2fb0e4[_0x0a9e('0x25')]({'plain':!![]});var _0x16b1ca='MailQueues';return db['UserProfileResource'][_0x0a9e('0x24')]({'where':{'type':_0x16b1ca,'resourceId':_0x370d86['id']}})[_0x0a9e('0x23')](function(){return _0x2fb0e4;});})[_0x0a9e('0x23')](function(){_0x4abc77[_0x0a9e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x384319,_0x479bc4){return function(_0x45a1e7){if(!_0x45a1e7){_0x384319['sendStatus'](0x194);}return _0x45a1e7;};}function handleError(_0x1dc186,_0x34dc65){_0x34dc65=_0x34dc65||0x1f4;return function(_0x25fba9){logger[_0x0a9e('0x26')](_0x25fba9[_0x0a9e('0x27')]);if(_0x25fba9[_0x0a9e('0x28')]){delete _0x25fba9[_0x0a9e('0x28')];}_0x1dc186[_0x0a9e('0x19')](_0x34dc65)['send'](_0x25fba9);};}exports[_0x0a9e('0x29')]=function(_0x468813,_0x2b1f27){var _0x2ec755={},_0x5c877d={},_0x15b200={'count':0x0,'rows':[]};var _0x40e7a3=db[_0x0a9e('0x2a')][_0x0a9e('0x2b')];_0x5c877d[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x40e7a3);_0x5c877d[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x468813[_0x0a9e('0x2e')]);_0x5c877d['filters']=_[_0x0a9e('0x2f')](_0x5c877d['model'],_0x5c877d[_0x0a9e('0x2e')]);_0x2ec755[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x5c877d[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x468813['query'][_0x0a9e('0x31')]));_0x2ec755[_0x0a9e('0x30')]=_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x2ec755[_0x0a9e('0x30')]:_0x5c877d[_0x0a9e('0x2c')];if(!_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x2ec755[_0x0a9e('0x1d')]=qs['limit'](_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x2ec755[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x468813['query'][_0x0a9e('0x1c')]);}_0x2ec755[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x468813[_0x0a9e('0x2e')]['sort']);_0x2ec755['where']=qs[_0x0a9e('0x36')](_['pick'](_0x468813[_0x0a9e('0x2e')],_0x5c877d[_0x0a9e('0x36')]));if(_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]){_0x2ec755['where']=_[_0x0a9e('0x38')](_0x2ec755[_0x0a9e('0x39')],{'$or':_[_0x0a9e('0x3a')](_0x40e7a3,function(_0x533942){if(_0x533942[_0x0a9e('0x3b')][_0x0a9e('0x3c')]!==_0x0a9e('0x3d')){var _0x4c1c0e={};_0x4c1c0e[_0x533942['field']]={'$like':'%'+_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x4c1c0e;}})});}_0x2ec755=_['merge']({},_0x2ec755,_0x468813[_0x0a9e('0x3e')]);var _0x419125={'where':_0x2ec755[_0x0a9e('0x39')]};return db[_0x0a9e('0x2a')]['count'](_0x419125)['then'](function(_0x15e37d){_0x15b200[_0x0a9e('0x1b')]=_0x15e37d;if(_0x468813['query'][_0x0a9e('0x3f')]){_0x2ec755[_0x0a9e('0x40')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')]['findAll'](_0x2ec755);})[_0x0a9e('0x23')](function(_0x2cfea9){_0x15b200[_0x0a9e('0x41')]=_0x2cfea9;return _0x15b200;})[_0x0a9e('0x23')](respondWithFilteredResult(_0x2b1f27,_0x2ec755))[_0x0a9e('0x42')](handleError(_0x2b1f27,null));};exports[_0x0a9e('0x43')]=function(_0x2881b3,_0x45a9b8){var _0x23b089={'raw':!![],'where':{'id':_0x2881b3[_0x0a9e('0x44')]['id']}},_0x3da2cd={};_0x3da2cd[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x3da2cd['query']=_['keys'](_0x2881b3[_0x0a9e('0x2e')]);_0x3da2cd[_0x0a9e('0x36')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],_0x3da2cd[_0x0a9e('0x2e')]);_0x23b089[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x23b089[_0x0a9e('0x30')]=_0x23b089['attributes'][_0x0a9e('0x32')]?_0x23b089[_0x0a9e('0x30')]:_0x3da2cd[_0x0a9e('0x2c')];if(_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x3f')]){_0x23b089[_0x0a9e('0x40')]=[{'all':!![]}];}_0x23b089=_[_0x0a9e('0x38')]({},_0x23b089,_0x2881b3[_0x0a9e('0x3e')]);return db['MailQueue'][_0x0a9e('0x45')](_0x23b089)['then'](handleEntityNotFound(_0x45a9b8,null))[_0x0a9e('0x23')](respondWithResult(_0x45a9b8,null))[_0x0a9e('0x42')](handleError(_0x45a9b8,null));};exports[_0x0a9e('0x46')]=function(_0x562fb4,_0x14bec2){return db[_0x0a9e('0x2a')][_0x0a9e('0x46')](_0x562fb4[_0x0a9e('0x47')],{})[_0x0a9e('0x23')](function(_0x37be73){var _0x45bf7f=_0x562fb4['user'][_0x0a9e('0x25')]({'plain':!![]});if(!_0x45bf7f)throw new Error(_0x0a9e('0x48'));if(_0x45bf7f[_0x0a9e('0x49')]===_0x0a9e('0x4a')){var _0x409789=_0x37be73[_0x0a9e('0x25')]({'plain':!![]});var _0x6054ee=_0x0a9e('0x4b');return db[_0x0a9e('0x4c')]['find']({'where':{'name':_0x6054ee,'userProfileId':_0x45bf7f[_0x0a9e('0x4d')]},'raw':!![]})[_0x0a9e('0x23')](function(_0x4f7240){if(_0x4f7240&&_0x4f7240['autoAssociation']===0x0){return db['UserProfileResource'][_0x0a9e('0x46')]({'name':_0x409789[_0x0a9e('0x28')],'resourceId':_0x409789['id'],'type':_0x4f7240[_0x0a9e('0x28')],'sectionId':_0x4f7240['id']},{})[_0x0a9e('0x23')](function(){return _0x37be73;});}else{return _0x37be73;}})[_0x0a9e('0x42')](function(_0x30decb){logger[_0x0a9e('0x26')](_0x0a9e('0x4e'),_0x30decb);throw _0x30decb;});}return _0x37be73;})['then'](respondWithResult(_0x14bec2,0xc9))['catch'](handleError(_0x14bec2,null));};exports['update']=function(_0x39d77d,_0x204173){if(_0x39d77d[_0x0a9e('0x47')]['id']){delete _0x39d77d['body']['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x39d77d['params']['id']}})['then'](handleEntityNotFound(_0x204173,null))[_0x0a9e('0x23')](saveUpdates(_0x39d77d['body'],null))[_0x0a9e('0x23')](respondWithResult(_0x204173,null))['catch'](handleError(_0x204173,null));};exports[_0x0a9e('0x24')]=function(_0x3c20b2,_0x439340){return db['MailQueue'][_0x0a9e('0x45')]({'where':{'id':_0x3c20b2[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x439340,null))['then'](removeEntity(_0x439340,null))[_0x0a9e('0x42')](handleError(_0x439340,null));};exports[_0x0a9e('0x4f')]=function(_0x49c095,_0x145931){return db['MailQueue'][_0x0a9e('0x4f')]()['then'](respondWithResult(_0x145931,null))[_0x0a9e('0x42')](handleError(_0x145931,null));};exports['getMembers']=function(_0x5da27d,_0x5df0ad,_0x2da03c){var _0x47de4c={'raw':!![],'where':{}},_0x2f7092={},_0x65432;return db[_0x0a9e('0x2a')][_0x0a9e('0x50')]({'where':{'id':_0x5da27d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x5df0ad,null))[_0x0a9e('0x23')](function(_0x28d814){if(_0x28d814){_0x65432=_0x28d814['get']({'plain':!![]});_0x2f7092[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x51')][_0x0a9e('0x2b')]);_0x2f7092[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5da27d['query']);_0x2f7092[_0x0a9e('0x36')]=_[_0x0a9e('0x2f')](_0x2f7092['model'],_0x2f7092[_0x0a9e('0x2e')]);_0x47de4c['attributes']=_[_0x0a9e('0x2f')](_0x2f7092['model'],qs['fields'](_0x5da27d['query'][_0x0a9e('0x31')]));_0x47de4c['attributes']=_0x47de4c[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x47de4c[_0x0a9e('0x30')]:_0x2f7092[_0x0a9e('0x2c')];if(!_0x5da27d[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x47de4c[_0x0a9e('0x1d')]=qs['limit'](_0x5da27d[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x47de4c[_0x0a9e('0x1c')]=qs['offset'](_0x5da27d[_0x0a9e('0x2e')][_0x0a9e('0x1c')]);}_0x47de4c[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x5da27d['query'][_0x0a9e('0x35')]);_0x47de4c[_0x0a9e('0x39')]=qs['filters'](_[_0x0a9e('0x52')](_0x5da27d[_0x0a9e('0x2e')],_0x2f7092[_0x0a9e('0x36')]));_0x47de4c[_0x0a9e('0x39')][_0x0a9e('0x53')]=_0x28d814['id'];if(_0x5da27d['query'][_0x0a9e('0x37')]){_0x47de4c[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x47de4c['where'],{'$or':_[_0x0a9e('0x3a')](_0x47de4c['attributes'],function(_0x5211e3){var _0x242745={};_0x242745[_0x5211e3]={'$like':'%'+_0x5da27d[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x242745;})});}_0x47de4c=_[_0x0a9e('0x38')]({},_0x47de4c,_0x5da27d[_0x0a9e('0x3e')]);return db[_0x0a9e('0x51')][_0x0a9e('0x54')](_0x47de4c);}})[_0x0a9e('0x23')](function(_0x2d7205){if(_0x2d7205){return db[_0x0a9e('0x55')][_0x0a9e('0x56')]({'where':{'id':_[_0x0a9e('0x3a')](_0x2d7205,_0x0a9e('0x57')),'role':_0x0a9e('0x58')},'attributes':['id',_0x0a9e('0x28'),_0x0a9e('0x59'),_0x0a9e('0x5a'),_0x0a9e('0x5b')]});}})['then'](function(_0x1b0b98){if(_0x1b0b98){return{'count':_0x1b0b98[_0x0a9e('0x1b')],'rows':_[_0x0a9e('0x3a')](_0x1b0b98['rows'],function(_0x1148a1){return{'membername':_0x1148a1[_0x0a9e('0x28')],'UserId':_0x1148a1['id'],'queue_name':_0x65432['name'],'MailQueueId':_0x65432['id'],'interface':util[_0x0a9e('0x5c')](_0x0a9e('0x5d'),_0x0a9e('0x5e'),_0x1148a1[_0x0a9e('0x28')]),'penalty':0x0,'paused':_0x1148a1[_0x0a9e('0x59')],'createdAt':_0x1148a1['createdAt'],'updatedAt':_0x1148a1['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5df0ad,_0x47de4c))[_0x0a9e('0x42')](handleError(_0x5df0ad,null));};exports[_0x0a9e('0x5f')]=function(_0x1104ad,_0x23a7d3,_0x6abd03){var _0x380ab3={};var _0xeef20={};var _0x1a0677;var _0x5512d1;return db[_0x0a9e('0x2a')][_0x0a9e('0x50')]({'where':{'id':_0x1104ad[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x23a7d3,null))[_0x0a9e('0x23')](function(_0x583b2e){if(_0x583b2e){_0x1a0677=_0x583b2e;_0xeef20[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db['Team'][_0x0a9e('0x2b')]);_0xeef20[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x1104ad[_0x0a9e('0x2e')]);_0xeef20['filters']=_[_0x0a9e('0x2f')](_0xeef20[_0x0a9e('0x2c')],_0xeef20[_0x0a9e('0x2e')]);_0x380ab3[_0x0a9e('0x30')]=_['intersection'](_0xeef20[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x1104ad[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x380ab3['attributes']=_0x380ab3[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x380ab3[_0x0a9e('0x30')]:_0xeef20[_0x0a9e('0x2c')];_0x380ab3[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x1104ad[_0x0a9e('0x2e')][_0x0a9e('0x35')]);_0x380ab3[_0x0a9e('0x39')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0x52')](_0x1104ad[_0x0a9e('0x2e')],_0xeef20[_0x0a9e('0x36')]));if(_0x1104ad[_0x0a9e('0x2e')]['filter']){_0x380ab3[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x380ab3[_0x0a9e('0x39')],{'$or':_['map'](_0x380ab3[_0x0a9e('0x30')],function(_0x33dda0){var _0x8cea96={};_0x8cea96[_0x33dda0]={'$like':'%'+_0x1104ad[_0x0a9e('0x2e')]['filter']+'%'};return _0x8cea96;})});}_0x380ab3=_['merge']({},_0x380ab3,_0x1104ad[_0x0a9e('0x3e')]);return _0x1a0677[_0x0a9e('0x5f')](_0x380ab3);}})['then'](function(_0x45108c){if(_0x45108c){_0x5512d1=_0x45108c['length'];if(!_0x1104ad[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x380ab3[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x1104ad[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x380ab3[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x1104ad[_0x0a9e('0x2e')]['offset']);}return _0x1a0677[_0x0a9e('0x5f')](_0x380ab3);}})[_0x0a9e('0x23')](function(_0x45c109){if(_0x45c109){return _0x45c109?{'count':_0x5512d1,'rows':_0x45c109}:null;}})[_0x0a9e('0x23')](respondWithResult(_0x23a7d3,null))['catch'](handleError(_0x23a7d3,null));};exports[_0x0a9e('0x60')]=function(_0xf0db1,_0x4bf3a5,_0x1d6834){var _0x5b7940=[];var _0x163710;return db[_0x0a9e('0x61')][_0x0a9e('0x54')]({'where':{'id':_0xf0db1[_0x0a9e('0x47')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0a9e('0x62'),'attributes':['id'],'raw':!![]}]})[_0x0a9e('0x23')](function(_0x94dcf5){if(_0x94dcf5){for(var _0x5ac73d=0x0;_0x5ac73d<_0x94dcf5[_0x0a9e('0x32')];_0x5ac73d+=0x1){for(var _0x36e975=0x0;_0x36e975<_0x94dcf5[_0x5ac73d]['Agents']['length'];_0x36e975+=0x1){_0x5b7940=_[_0x0a9e('0x63')](_0x5b7940,[_0x94dcf5[_0x5ac73d]['Agents'][_0x36e975]['id']]);}}return _0x5b7940;}})['then'](function(_0x4dc6b3){if(_0x4dc6b3){return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0xf0db1[_0x0a9e('0x44')]['id']}});}})[_0x0a9e('0x23')](function(_0x3c6dd6){if(_0x3c6dd6){_0x163710=_0x3c6dd6;return _0x163710[_0x0a9e('0x64')](_0x5b7940,{'penalty':_0xf0db1['body'][_0x0a9e('0x65')]});}})['then'](function(_0x2871c1){if(_0x2871c1){return _0x163710[_0x0a9e('0x60')](_0xf0db1[_0x0a9e('0x47')][_0x0a9e('0x66')]);}})['then'](handleEntityNotFound(_0x4bf3a5,null))[_0x0a9e('0x23')](respondWithStatusCode(_0x4bf3a5,null))[_0x0a9e('0x42')](handleError(_0x4bf3a5,null));};exports[_0x0a9e('0x67')]=function(_0x5b74c3,_0xb6e411,_0x21e592){var _0x2a563d=[];var _0x22063c;return db[_0x0a9e('0x61')][_0x0a9e('0x54')]({'where':{'id':_0x5b74c3[_0x0a9e('0x2e')][_0x0a9e('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0a9e('0x62'),'attributes':['id'],'raw':!![]}]})[_0x0a9e('0x23')](function(_0x589ff3){if(_0x589ff3){for(var _0x40e0f0=0x0;_0x40e0f0<_0x589ff3[_0x0a9e('0x32')];_0x40e0f0+=0x1){for(var _0x3a1974=0x0;_0x3a1974<_0x589ff3[_0x40e0f0]['Agents'][_0x0a9e('0x32')];_0x3a1974+=0x1){_0x2a563d=_['union'](_0x2a563d,[_0x589ff3[_0x40e0f0][_0x0a9e('0x62')][_0x3a1974]['id']]);}}return _0x2a563d;}})[_0x0a9e('0x23')](function(_0x558a87){if(_0x558a87){return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x5b74c3[_0x0a9e('0x44')]['id']}});}})[_0x0a9e('0x23')](function(_0x3a9a85){if(_0x3a9a85){_0x22063c=_0x3a9a85;return _0x22063c['removeAgents'](_0x2a563d);}})[_0x0a9e('0x23')](function(_0x31d25a){if(_0x22063c){return _0x22063c[_0x0a9e('0x67')](_0x5b74c3[_0x0a9e('0x2e')][_0x0a9e('0x66')]);}})[_0x0a9e('0x23')](handleEntityNotFound(_0xb6e411,null))[_0x0a9e('0x23')](respondWithStatusCode(_0xb6e411,null))[_0x0a9e('0x42')](handleError(_0xb6e411,null));};exports[_0x0a9e('0x64')]=function(_0x31af8c,_0x151956,_0x3754e2){return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x31af8c[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x151956,null))[_0x0a9e('0x23')](function(_0x2ed526){if(_0x2ed526){return _0x2ed526[_0x0a9e('0x64')](_0x31af8c['body'][_0x0a9e('0x66')],_[_0x0a9e('0x68')](_0x31af8c['body'],[_0x0a9e('0x66'),'id'])||{})['spread'](function(_0x45d113){for(var _0x27041d=0x0;_0x27041d<_0x31af8c[_0x0a9e('0x47')][_0x0a9e('0x66')]['length'];_0x27041d+=0x1){socket[_0x0a9e('0x69')]('userMailQueue:save',{'UserId':_0x31af8c[_0x0a9e('0x47')][_0x0a9e('0x66')][_0x27041d],'MailQueueId':_0x31af8c['params']['id']});}return _0x45d113;});}})[_0x0a9e('0x23')](respondWithResult(_0x151956,null))[_0x0a9e('0x42')](handleError(_0x151956,null));};exports[_0x0a9e('0x6a')]=function(_0x4ab276,_0x4c788f,_0x1b82b7){var _0x6ba2be;return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x4ab276[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x4c788f,null))[_0x0a9e('0x23')](function(_0x3c75b9){if(_0x3c75b9){return _0x3c75b9[_0x0a9e('0x6a')](_0x4ab276['query'][_0x0a9e('0x66')])['then'](function(_0x287324){if(_[_0x0a9e('0x6b')](_0x4ab276[_0x0a9e('0x2e')][_0x0a9e('0x66')])){for(var _0x1b61d5=0x0;_0x1b61d5<_0x4ab276['query'][_0x0a9e('0x66')][_0x0a9e('0x32')];_0x1b61d5+=0x1){socket[_0x0a9e('0x69')](_0x0a9e('0x6c'),{'UserId':_0x4ab276[_0x0a9e('0x2e')]['ids'][_0x1b61d5],'MailQueueId':_0x4ab276['params']['id']});}}else{socket[_0x0a9e('0x69')]('userMailQueue:remove',{'UserId':_0x4ab276[_0x0a9e('0x2e')][_0x0a9e('0x66')],'MailQueueId':_0x4ab276[_0x0a9e('0x44')]['id']});}});}})[_0x0a9e('0x23')](respondWithStatusCode(_0x4c788f,null))[_0x0a9e('0x42')](handleError(_0x4c788f,null));};exports[_0x0a9e('0x6d')]=function(_0x596312,_0x4db918,_0x1889ed){var _0x5dfbe2={};var _0x2469d1={};var _0x5c689c;var _0x427ccc;return db['MailQueue']['findOne']({'where':{'id':_0x596312[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x4db918,null))['then'](function(_0x170af6){if(_0x170af6){_0x5c689c=_0x170af6;_0x2469d1[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x55')][_0x0a9e('0x2b')]);_0x2469d1['query']=_['keys'](_0x596312[_0x0a9e('0x2e')]);_0x2469d1[_0x0a9e('0x36')]=_[_0x0a9e('0x2f')](_0x2469d1[_0x0a9e('0x2c')],_0x2469d1[_0x0a9e('0x2e')]);_0x5dfbe2['attributes']=_[_0x0a9e('0x2f')](_0x2469d1[_0x0a9e('0x2c')],qs['fields'](_0x596312[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x5dfbe2[_0x0a9e('0x30')]=_0x5dfbe2[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x5dfbe2[_0x0a9e('0x30')]:_0x2469d1[_0x0a9e('0x2c')];_0x5dfbe2[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x596312[_0x0a9e('0x2e')]['sort']);_0x5dfbe2[_0x0a9e('0x39')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0x52')](_0x596312[_0x0a9e('0x2e')],_0x2469d1[_0x0a9e('0x36')]));if(_0x596312['query']['filter']){_0x5dfbe2[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x5dfbe2[_0x0a9e('0x39')],{'$or':_[_0x0a9e('0x3a')](_0x5dfbe2[_0x0a9e('0x30')],function(_0x59e46f){var _0x1339d0={};_0x1339d0[_0x59e46f]={'$like':'%'+_0x596312[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x1339d0;})});}_0x5dfbe2=_['merge']({},_0x5dfbe2,_0x596312[_0x0a9e('0x3e')]);return _0x5c689c['getAgents'](_0x5dfbe2);}})[_0x0a9e('0x23')](function(_0x4799d4){if(_0x4799d4){_0x427ccc=_0x4799d4[_0x0a9e('0x32')];if(!_0x596312[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x5dfbe2[_0x0a9e('0x1d')]=qs['limit'](_0x596312[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x5dfbe2[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x596312[_0x0a9e('0x2e')][_0x0a9e('0x1c')]);}return _0x5c689c[_0x0a9e('0x6d')](_0x5dfbe2);}})[_0x0a9e('0x23')](function(_0x2aaf07){if(_0x2aaf07){return _0x2aaf07?{'count':_0x427ccc,'rows':_0x2aaf07}:null;}})[_0x0a9e('0x23')](respondWithResult(_0x4db918,null))[_0x0a9e('0x42')](handleError(_0x4db918,null));};
\ No newline at end of file
index ebf90dd..0739326 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6da7=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailQueue','save'];(function(_0x3ef45e,_0xe84f33){var _0x69e7c=function(_0x43ba11){while(--_0x43ba11){_0x3ef45e['push'](_0x3ef45e['shift']());}};_0x69e7c(++_0xe84f33);}(_0x6da7,0x18c));var _0x76da=function(_0x49983a,_0x245b5b){_0x49983a=_0x49983a-0x0;var _0x25feb9=_0x6da7[_0x49983a];return _0x25feb9;};'use strict';var EventEmitter=require(_0x76da('0x0'));var MailQueue=require(_0x76da('0x1'))['db'][_0x76da('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x76da('0x3'),'afterUpdate':'update','afterDestroy':_0x76da('0x4')};function emitEvent(_0xdbd62a){return function(_0x45f397,_0x15915f,_0x4949de){MailQueueEvents[_0x76da('0x5')](_0xdbd62a+':'+_0x45f397['id'],_0x45f397);MailQueueEvents[_0x76da('0x5')](_0xdbd62a,_0x45f397);_0x4949de(null);};}for(var e in events){if(events[_0x76da('0x6')](e)){var event=events[e];MailQueue[_0x76da('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents;
\ No newline at end of file
+var _0xdae0=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','MailQueue','setMaxListeners','save'];(function(_0x2479e6,_0x1134ea){var _0x2c9f2b=function(_0x4080eb){while(--_0x4080eb){_0x2479e6['push'](_0x2479e6['shift']());}};_0x2c9f2b(++_0x1134ea);}(_0xdae0,0xd4));var _0x0dae=function(_0x4629d4,_0x4e065b){_0x4629d4=_0x4629d4-0x0;var _0x264a30=_0xdae0[_0x4629d4];return _0x264a30;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x0dae('0x0'))['db'][_0x0dae('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x0dae('0x2')](0x0);var events={'afterCreate':_0x0dae('0x3'),'afterUpdate':'update','afterDestroy':_0x0dae('0x4')};function emitEvent(_0x457ef6){return function(_0x53fde4,_0x939ac5,_0x5655c7){MailQueueEvents[_0x0dae('0x5')](_0x457ef6+':'+_0x53fde4['id'],_0x53fde4);MailQueueEvents['emit'](_0x457ef6,_0x53fde4);_0x5655c7(null);};}for(var e in events){if(events[_0x0dae('0x6')](e)){var event=events[e];MailQueue[_0x0dae('0x7')](e,emitEvent(event));}}module[_0x0dae('0x8')]=MailQueueEvents;
\ No newline at end of file
index 31b82f3..1cb4865 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1339=['request-promise','./mailQueue.attributes','exports','define','../../config/logger','api','moment','bluebird'];(function(_0x168794,_0x2abf4a){var _0x5451d7=function(_0x346be9){while(--_0x346be9){_0x168794['push'](_0x168794['shift']());}};_0x5451d7(++_0x2abf4a);}(_0x1339,0x1c4));var _0x9133=function(_0x4ce35b,_0x2526f3){_0x4ce35b=_0x4ce35b-0x0;var _0x46e4d8=_0x1339[_0x4ce35b];return _0x46e4d8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9133('0x0'))(_0x9133('0x1'));var moment=require(_0x9133('0x2'));var BPromise=require(_0x9133('0x3'));var rp=require(_0x9133('0x4'));var attributes=require(_0x9133('0x5'));module[_0x9133('0x6')]=function(_0x1f0e59,_0x701d49){return _0x1f0e59[_0x9133('0x7')]('MailQueue',attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x32b3=['define','MailQueue','mail_queues','lodash','util','../../config/logger','api','./mailQueue.attributes','exports'];(function(_0x3dc09e,_0x14c9bc){var _0x13babf=function(_0x29a586){while(--_0x29a586){_0x3dc09e['push'](_0x3dc09e['shift']());}};_0x13babf(++_0x14c9bc);}(_0x32b3,0xc9));var _0x332b=function(_0x1c68d9,_0x1591f1){_0x1c68d9=_0x1c68d9-0x0;var _0x5a47f8=_0x32b3[_0x1c68d9];return _0x5a47f8;};'use strict';var _=require(_0x332b('0x0'));var util=require(_0x332b('0x1'));var logger=require(_0x332b('0x2'))(_0x332b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x332b('0x4'));module[_0x332b('0x5')]=function(_0x28f5ca,_0x3381ee){return _0x28f5ca[_0x332b('0x6')](_0x332b('0x7'),attributes,{'tableName':_0x332b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index ee1558a..f31fc1f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe243=['../../config/utils','../../config/logger','rpc','../../config/environment','redis','localhost','register','request','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetMailQueue','findAll','options','raw','where','include','map','model','attributes','then','ShowMailQueue','MailQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x24e674,_0x25eafd){var _0x23801f=function(_0xcc6621){while(--_0xcc6621){_0x24e674['push'](_0x24e674['shift']());}};_0x23801f(++_0x25eafd);}(_0xe243,0x14f));var _0x3e24=function(_0x23d2a0,_0x516174){_0x23d2a0=_0x23d2a0-0x0;var _0x409e80=_0xe243[_0x23d2a0];return _0x409e80;};'use strict';var _=require(_0x3e24('0x0'));var util=require(_0x3e24('0x1'));var moment=require(_0x3e24('0x2'));var BPromise=require(_0x3e24('0x3'));var rs=require(_0x3e24('0x4'));var fs=require('fs');var Redis=require(_0x3e24('0x5'));var db=require(_0x3e24('0x6'))['db'];var utils=require(_0x3e24('0x7'));var logger=require(_0x3e24('0x8'))(_0x3e24('0x9'));var config=require(_0x3e24('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x3e24('0xb')],{'host':_0x3e24('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailQueue.socket')[_0x3e24('0xd')](socket);function respondWithRpcPromise(_0x2ddaf1,_0x37e991,_0xc76e8d){return new BPromise(function(_0x466db2,_0x2153fd){return client[_0x3e24('0xe')](_0x2ddaf1,_0xc76e8d)['then'](function(_0x593727){logger['info'](_0x3e24('0xf'),_0x37e991,_0x3e24('0x10'));logger[_0x3e24('0x11')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x37e991,_0x3e24('0x10'),JSON[_0x3e24('0x12')](_0x593727));if(_0x593727[_0x3e24('0x13')]){if(_0x593727['error'][_0x3e24('0x14')]===0x1f4){logger[_0x3e24('0x13')](_0x3e24('0xf'),_0x37e991,_0x593727['error']['message']);return _0x2153fd(_0x593727['error'][_0x3e24('0x15')]);}logger[_0x3e24('0x13')](_0x3e24('0xf'),_0x37e991,_0x593727[_0x3e24('0x13')]['message']);return _0x466db2(_0x593727[_0x3e24('0x13')]['message']);}else{logger[_0x3e24('0x16')]('MailQueue,\x20%s,\x20%s',_0x37e991,_0x3e24('0x10'));_0x466db2(_0x593727[_0x3e24('0x17')][_0x3e24('0x15')]);}})[_0x3e24('0x18')](function(_0x36d0e2){logger[_0x3e24('0x13')](_0x3e24('0xf'),_0x37e991,_0x36d0e2);_0x2153fd(_0x36d0e2);});});}exports[_0x3e24('0x19')]=function(_0x1d32ec){var _0x29806a=this;return new Promise(function(_0x2b5968,_0x41dbc2){return db['MailQueue'][_0x3e24('0x1a')]({'raw':_0x1d32ec[_0x3e24('0x1b')]?_0x1d32ec[_0x3e24('0x1b')][_0x3e24('0x1c')]===undefined?!![]:![]:!![],'where':_0x1d32ec[_0x3e24('0x1b')]?_0x1d32ec[_0x3e24('0x1b')][_0x3e24('0x1d')]||null:null,'attributes':_0x1d32ec[_0x3e24('0x1b')]?_0x1d32ec[_0x3e24('0x1b')]['attributes']||null:null,'limit':_0x1d32ec[_0x3e24('0x1b')]?_0x1d32ec['options']['limit']||null:null,'include':_0x1d32ec['options']?_0x1d32ec['options'][_0x3e24('0x1e')]?_[_0x3e24('0x1f')](_0x1d32ec[_0x3e24('0x1b')][_0x3e24('0x1e')],function(_0x5f2cc0){return{'model':db[_0x5f2cc0[_0x3e24('0x20')]],'as':_0x5f2cc0['as'],'attributes':_0x5f2cc0['attributes'],'include':_0x5f2cc0[_0x3e24('0x1e')]?_[_0x3e24('0x1f')](_0x5f2cc0[_0x3e24('0x1e')],function(_0x5464ff){return{'model':db[_0x5464ff[_0x3e24('0x20')]],'as':_0x5464ff['as'],'attributes':_0x5464ff[_0x3e24('0x21')],'include':_0x5464ff[_0x3e24('0x1e')]?_[_0x3e24('0x1f')](_0x5464ff[_0x3e24('0x1e')],function(_0x409723){return{'model':db[_0x409723['model']],'as':_0x409723['as'],'attributes':_0x409723['attributes']};}):[]};}):[]};}):[]:[]})[_0x3e24('0x22')](function(_0x97412){logger[_0x3e24('0x16')]('GetMailQueue',_0x1d32ec);logger['debug'](_0x3e24('0x19'),_0x1d32ec,JSON['stringify'](_0x97412));_0x2b5968(_0x97412);})[_0x3e24('0x18')](function(_0x5553bf){logger['error']('GetMailQueue',_0x5553bf[_0x3e24('0x15')],_0x1d32ec);_0x41dbc2(_0x29806a[_0x3e24('0x13')](0x1f4,_0x5553bf['message']));});});};exports[_0x3e24('0x23')]=function(_0x4a74f1){var _0x11147b=this;return new Promise(function(_0x2ce53f,_0x103e38){return db[_0x3e24('0x24')][_0x3e24('0x25')]({'raw':_0x4a74f1[_0x3e24('0x1b')]?_0x4a74f1[_0x3e24('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4a74f1[_0x3e24('0x1b')]?_0x4a74f1[_0x3e24('0x1b')][_0x3e24('0x1d')]||null:null,'attributes':_0x4a74f1[_0x3e24('0x1b')]?_0x4a74f1[_0x3e24('0x1b')][_0x3e24('0x21')]||null:null,'include':_0x4a74f1[_0x3e24('0x1b')]?_0x4a74f1[_0x3e24('0x1b')][_0x3e24('0x1e')]?_[_0x3e24('0x1f')](_0x4a74f1['options'][_0x3e24('0x1e')],function(_0x3aa5e6){return{'model':db[_0x3aa5e6['model']],'as':_0x3aa5e6['as'],'attributes':_0x3aa5e6['attributes'],'include':_0x3aa5e6[_0x3e24('0x1e')]?_[_0x3e24('0x1f')](_0x3aa5e6[_0x3e24('0x1e')],function(_0x39e6d2){return{'model':db[_0x39e6d2[_0x3e24('0x20')]],'as':_0x39e6d2['as'],'attributes':_0x39e6d2[_0x3e24('0x21')],'include':_0x39e6d2['include']?_[_0x3e24('0x1f')](_0x39e6d2[_0x3e24('0x1e')],function(_0x32c56d){return{'model':db[_0x32c56d[_0x3e24('0x20')]],'as':_0x32c56d['as'],'attributes':_0x32c56d[_0x3e24('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3e24('0x22')](function(_0x27429f){logger[_0x3e24('0x16')](_0x3e24('0x23'),_0x4a74f1);logger[_0x3e24('0x11')]('ShowMailQueue',_0x4a74f1,JSON[_0x3e24('0x12')](_0x27429f));_0x2ce53f(_0x27429f);})[_0x3e24('0x18')](function(_0x1b056b){logger[_0x3e24('0x13')](_0x3e24('0x23'),_0x1b056b[_0x3e24('0x15')],_0x4a74f1);_0x103e38(_0x11147b[_0x3e24('0x13')](0x1f4,_0x1b056b[_0x3e24('0x15')]));});});};
\ No newline at end of file
+var _0xa939=['redis','defaults','localhost','./mailQueue.socket','request','then','request\x20sent','error','message','info','result','catch','MailQueue,\x20%s,\x20%s','GetMailQueue','MailQueue','findAll','options','where','attributes','include','map','model','debug','stringify','ShowMailQueue','find','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x32b0da,_0x11790c){var _0x78f994=function(_0x4ae08b){while(--_0x4ae08b){_0x32b0da['push'](_0x32b0da['shift']());}};_0x78f994(++_0x11790c);}(_0xa939,0x143));var _0x9a93=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0xa939[_0x24259d];return _0x5a701;};'use strict';var _=require('lodash');var util=require(_0x9a93('0x0'));var moment=require(_0x9a93('0x1'));var BPromise=require('bluebird');var rs=require(_0x9a93('0x2'));var fs=require('fs');var Redis=require(_0x9a93('0x3'));var db=require(_0x9a93('0x4'))['db'];var utils=require(_0x9a93('0x5'));var logger=require('../../config/logger')(_0x9a93('0x6'));var config=require(_0x9a93('0x7'));var jayson=require(_0x9a93('0x8'));var client=jayson['client'][_0x9a93('0x9')]({'port':0x232a});config[_0x9a93('0xa')]=_[_0x9a93('0xb')](config[_0x9a93('0xa')],{'host':_0x9a93('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9a93('0xa')]));require(_0x9a93('0xd'))['register'](socket);function respondWithRpcPromise(_0x562fc0,_0x3d88d6,_0x3a3953){return new BPromise(function(_0x12b69e,_0x4d686a){return client[_0x9a93('0xe')](_0x562fc0,_0x3a3953)[_0x9a93('0xf')](function(_0x17610d){logger['info']('MailQueue,\x20%s,\x20%s',_0x3d88d6,_0x9a93('0x10'));logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0x3d88d6,'request\x20sent',JSON['stringify'](_0x17610d));if(_0x17610d[_0x9a93('0x11')]){if(_0x17610d['error']['code']===0x1f4){logger[_0x9a93('0x11')]('MailQueue,\x20%s,\x20%s',_0x3d88d6,_0x17610d[_0x9a93('0x11')][_0x9a93('0x12')]);return _0x4d686a(_0x17610d['error'][_0x9a93('0x12')]);}logger[_0x9a93('0x11')]('MailQueue,\x20%s,\x20%s',_0x3d88d6,_0x17610d[_0x9a93('0x11')]['message']);return _0x12b69e(_0x17610d[_0x9a93('0x11')]['message']);}else{logger[_0x9a93('0x13')]('MailQueue,\x20%s,\x20%s',_0x3d88d6,_0x9a93('0x10'));_0x12b69e(_0x17610d[_0x9a93('0x14')][_0x9a93('0x12')]);}})[_0x9a93('0x15')](function(_0x4e737e){logger[_0x9a93('0x11')](_0x9a93('0x16'),_0x3d88d6,_0x4e737e);_0x4d686a(_0x4e737e);});});}exports[_0x9a93('0x17')]=function(_0x58f573){var _0x39564c=this;return new Promise(function(_0x2abca4,_0x2549bc){return db[_0x9a93('0x18')][_0x9a93('0x19')]({'raw':_0x58f573[_0x9a93('0x1a')]?_0x58f573['options']['raw']===undefined?!![]:![]:!![],'where':_0x58f573['options']?_0x58f573[_0x9a93('0x1a')][_0x9a93('0x1b')]||null:null,'attributes':_0x58f573['options']?_0x58f573[_0x9a93('0x1a')][_0x9a93('0x1c')]||null:null,'limit':_0x58f573[_0x9a93('0x1a')]?_0x58f573['options']['limit']||null:null,'include':_0x58f573['options']?_0x58f573[_0x9a93('0x1a')][_0x9a93('0x1d')]?_[_0x9a93('0x1e')](_0x58f573[_0x9a93('0x1a')][_0x9a93('0x1d')],function(_0x3c8ae5){return{'model':db[_0x3c8ae5['model']],'as':_0x3c8ae5['as'],'attributes':_0x3c8ae5['attributes'],'include':_0x3c8ae5[_0x9a93('0x1d')]?_['map'](_0x3c8ae5[_0x9a93('0x1d')],function(_0xc4f237){return{'model':db[_0xc4f237['model']],'as':_0xc4f237['as'],'attributes':_0xc4f237[_0x9a93('0x1c')],'include':_0xc4f237[_0x9a93('0x1d')]?_[_0x9a93('0x1e')](_0xc4f237['include'],function(_0x290890){return{'model':db[_0x290890[_0x9a93('0x1f')]],'as':_0x290890['as'],'attributes':_0x290890['attributes']};}):[]};}):[]};}):[]:[]})[_0x9a93('0xf')](function(_0x4d6551){logger[_0x9a93('0x13')]('GetMailQueue',_0x58f573);logger[_0x9a93('0x20')](_0x9a93('0x17'),_0x58f573,JSON[_0x9a93('0x21')](_0x4d6551));_0x2abca4(_0x4d6551);})[_0x9a93('0x15')](function(_0x1f0076){logger['error'](_0x9a93('0x17'),_0x1f0076[_0x9a93('0x12')],_0x58f573);_0x2549bc(_0x39564c['error'](0x1f4,_0x1f0076[_0x9a93('0x12')]));});});};exports[_0x9a93('0x22')]=function(_0x2c3d6c){var _0x2aab33=this;return new Promise(function(_0x11b45a,_0x5797cc){return db[_0x9a93('0x18')][_0x9a93('0x23')]({'raw':_0x2c3d6c[_0x9a93('0x1a')]?_0x2c3d6c[_0x9a93('0x1a')][_0x9a93('0x24')]===undefined?!![]:![]:!![],'where':_0x2c3d6c['options']?_0x2c3d6c[_0x9a93('0x1a')][_0x9a93('0x1b')]||null:null,'attributes':_0x2c3d6c['options']?_0x2c3d6c[_0x9a93('0x1a')][_0x9a93('0x1c')]||null:null,'include':_0x2c3d6c[_0x9a93('0x1a')]?_0x2c3d6c[_0x9a93('0x1a')][_0x9a93('0x1d')]?_[_0x9a93('0x1e')](_0x2c3d6c[_0x9a93('0x1a')][_0x9a93('0x1d')],function(_0x19d93b){return{'model':db[_0x19d93b[_0x9a93('0x1f')]],'as':_0x19d93b['as'],'attributes':_0x19d93b[_0x9a93('0x1c')],'include':_0x19d93b['include']?_[_0x9a93('0x1e')](_0x19d93b[_0x9a93('0x1d')],function(_0x28ac8a){return{'model':db[_0x28ac8a['model']],'as':_0x28ac8a['as'],'attributes':_0x28ac8a['attributes'],'include':_0x28ac8a[_0x9a93('0x1d')]?_[_0x9a93('0x1e')](_0x28ac8a['include'],function(_0x304633){return{'model':db[_0x304633['model']],'as':_0x304633['as'],'attributes':_0x304633[_0x9a93('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1fba8a){logger[_0x9a93('0x13')](_0x9a93('0x22'),_0x2c3d6c);logger[_0x9a93('0x20')]('ShowMailQueue',_0x2c3d6c,JSON[_0x9a93('0x21')](_0x1fba8a));_0x11b45a(_0x1fba8a);})['catch'](function(_0x18ea80){logger['error'](_0x9a93('0x22'),_0x18ea80['message'],_0x2c3d6c);_0x5797cc(_0x2aab33[_0x9a93('0x11')](0x1f4,_0x18ea80[_0x9a93('0x12')]));});});};
\ No newline at end of file
index 9ec8853..465a317 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe0b8=['emit','register','length','mailQueue:','./mailQueue.events','save','update'];(function(_0x446208,_0xb483fb){var _0xe49563=function(_0x1d3a21){while(--_0x1d3a21){_0x446208['push'](_0x446208['shift']());}};_0xe49563(++_0xb483fb);}(_0xe0b8,0xe4));var _0x8e0b=function(_0xa2a5c9,_0x5209c1){_0xa2a5c9=_0xa2a5c9-0x0;var _0x46291f=_0xe0b8[_0xa2a5c9];return _0x46291f;};'use strict';var MailQueueEvents=require(_0x8e0b('0x0'));var events=[_0x8e0b('0x1'),'remove',_0x8e0b('0x2')];function createListener(_0x3d5b8e,_0x281bf7){return function(_0x4ee13e){_0x281bf7[_0x8e0b('0x3')](_0x3d5b8e,_0x4ee13e);};}function removeListener(_0x4eb646,_0x39c9ce){return function(){MailQueueEvents['removeListener'](_0x4eb646,_0x39c9ce);};}exports[_0x8e0b('0x4')]=function(_0x378994){for(var _0x55adc5=0x0,_0x160887=events[_0x8e0b('0x5')];_0x55adc5<_0x160887;_0x55adc5++){var _0xaec343=events[_0x55adc5];var _0x5ca7a7=createListener(_0x8e0b('0x6')+_0xaec343,_0x378994);MailQueueEvents['on'](_0xaec343,_0x5ca7a7);}};
\ No newline at end of file
+var _0x7ee1=['mailQueue:','./mailQueue.events','save','remove','update','emit','removeListener','length'];(function(_0x5492d7,_0x1f600e){var _0x117b88=function(_0x12dc91){while(--_0x12dc91){_0x5492d7['push'](_0x5492d7['shift']());}};_0x117b88(++_0x1f600e);}(_0x7ee1,0xb9));var _0x17ee=function(_0x84a031,_0x5c0bad){_0x84a031=_0x84a031-0x0;var _0x273fb1=_0x7ee1[_0x84a031];return _0x273fb1;};'use strict';var MailQueueEvents=require(_0x17ee('0x0'));var events=[_0x17ee('0x1'),_0x17ee('0x2'),_0x17ee('0x3')];function createListener(_0x23cd26,_0x414ecf){return function(_0x1542fb){_0x414ecf[_0x17ee('0x4')](_0x23cd26,_0x1542fb);};}function removeListener(_0x2cdc8c,_0x18d8df){return function(){MailQueueEvents[_0x17ee('0x5')](_0x2cdc8c,_0x18d8df);};}exports['register']=function(_0x2dac68){for(var _0x281167=0x0,_0x7dde5=events[_0x17ee('0x6')];_0x281167<_0x7dde5;_0x281167++){var _0x497543=events[_0x281167];var _0x448ec8=createListener(_0x17ee('0x7')+_0x497543,_0x2dac68);MailQueueEvents['on'](_0x497543,_0x448ec8);}};
\ No newline at end of file
index 17d7225..11510fa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2e23=['isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get'];(function(_0x846dab,_0x6919da){var _0x590ba9=function(_0x7687aa){while(--_0x7687aa){_0x846dab['push'](_0x846dab['shift']());}};_0x590ba9(++_0x6919da);}(_0x2e23,0x161));var _0x32e2=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x2e23[_0x4e9628];return _0x27bc8c;};'use strict';var multer=require(_0x32e2('0x0'));var util=require('util');var path=require(_0x32e2('0x1'));var timeout=require(_0x32e2('0x2'));var express=require(_0x32e2('0x3'));var router=express[_0x32e2('0x4')]();var auth=require(_0x32e2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x32e2('0x6'));var controller=require('./mailQueueReport.controller');router[_0x32e2('0x7')]('/',auth[_0x32e2('0x8')](),controller[_0x32e2('0x9')]);router['get'](_0x32e2('0xa'),auth['isAuthenticated'](),controller[_0x32e2('0xb')]);router['get'](_0x32e2('0xc'),auth[_0x32e2('0x8')](),controller[_0x32e2('0xd')]);router[_0x32e2('0xe')]('/',auth[_0x32e2('0x8')](),controller['create']);router[_0x32e2('0xf')](_0x32e2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x32e2('0x10')]('/:id',auth[_0x32e2('0x8')](),controller[_0x32e2('0x11')]);module[_0x32e2('0x12')]=router;
\ No newline at end of file
+var _0x1619=['/:id','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','post','put'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x1619,0xfc));var _0x9161=function(_0xb3a433,_0x3326c7){_0xb3a433=_0xb3a433-0x0;var _0x2fa2e2=_0x1619[_0xb3a433];return _0x2fa2e2;};'use strict';var multer=require('multer');var util=require(_0x9161('0x0'));var path=require(_0x9161('0x1'));var timeout=require(_0x9161('0x2'));var express=require(_0x9161('0x3'));var router=express['Router']();var auth=require(_0x9161('0x4'));var interaction=require(_0x9161('0x5'));var config=require(_0x9161('0x6'));var controller=require('./mailQueueReport.controller');router[_0x9161('0x7')]('/',auth[_0x9161('0x8')](),controller['index']);router['get'](_0x9161('0x9'),auth[_0x9161('0x8')](),controller[_0x9161('0xa')]);router[_0x9161('0x7')]('/:id',auth[_0x9161('0x8')](),controller[_0x9161('0xb')]);router[_0x9161('0xc')]('/',auth[_0x9161('0x8')](),controller['create']);router[_0x9161('0xd')](_0x9161('0xe'),auth['isAuthenticated'](),controller[_0x9161('0xf')]);router[_0x9161('0x10')](_0x9161('0xe'),auth[_0x9161('0x8')](),controller[_0x9161('0x11')]);module[_0x9161('0x12')]=router;
\ No newline at end of file
index 5490985..4923dfe 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x729c=['moment','sequelize','exports','STRING','DATE'];(function(_0xff8af1,_0x386da2){var _0x51d65c=function(_0x3a3a94){while(--_0x3a3a94){_0xff8af1['push'](_0xff8af1['shift']());}};_0x51d65c(++_0x386da2);}(_0x729c,0x1b8));var _0xc729=function(_0x58ff7f,_0x5798ba){_0x58ff7f=_0x58ff7f-0x0;var _0x103507=_0x729c[_0x58ff7f];return _0x103507;};'use strict';var moment=require(_0xc729('0x0'));var Sequelize=require(_0xc729('0x1'));module[_0xc729('0x2')]={'uniqueid':{'type':Sequelize[_0xc729('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xc729('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xc729('0x4')]},'reason':{'type':Sequelize[_0xc729('0x3')]}};
\ No newline at end of file
+var _0xc441=['STRING','DATE','moment','sequelize','exports'];(function(_0xc2bcfd,_0x4ba494){var _0x5687b7=function(_0x2b6d8d){while(--_0x2b6d8d){_0xc2bcfd['push'](_0xc2bcfd['shift']());}};_0x5687b7(++_0x4ba494);}(_0xc441,0x188));var _0x1c44=function(_0x4205ac,_0x3f212b){_0x4205ac=_0x4205ac-0x0;var _0x283146=_0xc441[_0x4205ac];return _0x283146;};'use strict';var moment=require(_0x1c44('0x0'));var Sequelize=require(_0x1c44('0x1'));module[_0x1c44('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x1c44('0x3')]},'joinAt':{'type':Sequelize[_0x1c44('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x1c44('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x1c44('0x3')]}};
\ No newline at end of file
index e4bd2de..9971169 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf235=['count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','MailQueueReport','rawAttributes','model','keys','query','filters','attributes','intersection','fields','nolimit','sort','where','filter','merge','map','type','key','VIRTUAL','options','include','findAll','rows','catch','show','params','length','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0xd7a30,_0x5890d2){var _0x445a54=function(_0x3506df){while(--_0x3506df){_0xd7a30['push'](_0xd7a30['shift']());}};_0x445a54(++_0x5890d2);}(_0xf235,0x1ef));var _0x5f23=function(_0x1fabba,_0x2496ef){_0x1fabba=_0x1fabba-0x0;var _0x86fc5d=_0xf235[_0x1fabba];return _0x86fc5d;};'use strict';var pdf=require(_0x5f23('0x0'));var emlformat=require(_0x5f23('0x1'));var rimraf=require(_0x5f23('0x2'));var zipdir=require(_0x5f23('0x3'));var jsonpatch=require(_0x5f23('0x4'));var rp=require('request-promise');var moment=require(_0x5f23('0x5'));var BPromise=require(_0x5f23('0x6'));var Mustache=require(_0x5f23('0x7'));var util=require(_0x5f23('0x8'));var path=require(_0x5f23('0x9'));var sox=require('sox');var csv=require(_0x5f23('0xa'));var ejs=require(_0x5f23('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5f23('0xc'));var crypto=require(_0x5f23('0xd'));var jsforce=require(_0x5f23('0xe'));var deskjs=require(_0x5f23('0xf'));var toCsv=require(_0x5f23('0xa'));var querystring=require(_0x5f23('0x10'));var Papa=require(_0x5f23('0x11'));var authService=require(_0x5f23('0x12'));var hardwareService=require(_0x5f23('0x13'));var Redis=require(_0x5f23('0x14'));var qs=require('../../components/parsers/qs');var logger=require(_0x5f23('0x15'))(_0x5f23('0x16'));var utils=require(_0x5f23('0x17'));var config=require(_0x5f23('0x18'));var db=require(_0x5f23('0x19'))['db'];function respondWithStatusCode(_0x480b3e,_0x507ad2){_0x507ad2=_0x507ad2||0xcc;return function(_0x3f0fd5){if(_0x3f0fd5){return _0x480b3e[_0x5f23('0x1a')](_0x507ad2);}return _0x480b3e[_0x5f23('0x1b')](_0x507ad2)[_0x5f23('0x1c')]();};}function respondWithResult(_0x4a9a3e,_0x27732c){_0x27732c=_0x27732c||0xc8;return function(_0x50158c){if(_0x50158c){return _0x4a9a3e[_0x5f23('0x1b')](_0x27732c)[_0x5f23('0x1d')](_0x50158c);}};}function respondWithFilteredResult(_0x5125c9,_0x2a902){return function(_0x16a297){if(_0x16a297){var _0x5f54b0=_0x16a297[_0x5f23('0x1e')],_0x395461=_0x2a902[_0x5f23('0x1f')],_0x2cb54a=_0x2a902[_0x5f23('0x1f')]+_0x2a902[_0x5f23('0x20')],_0x4e8f7c;if(_0x2cb54a>=_0x5f54b0){_0x2cb54a=_0x5f54b0;_0x4e8f7c=0xc8;}else{_0x4e8f7c=0xce;}_0x5125c9[_0x5f23('0x1b')](_0x4e8f7c);return _0x5125c9[_0x5f23('0x21')](_0x5f23('0x22'),_0x395461+'-'+_0x2cb54a+'/'+_0x5f54b0)[_0x5f23('0x1d')](_0x16a297);}return null;};}function patchUpdates(_0x26019d){return function(_0xacbb6f){try{jsonpatch[_0x5f23('0x23')](_0xacbb6f,_0x26019d,!![]);}catch(_0x8444b9){return BPromise[_0x5f23('0x24')](_0x8444b9);}return _0xacbb6f[_0x5f23('0x25')]();};}function saveUpdates(_0x190d0d,_0x4dbf4d){return function(_0x50466c){if(_0x50466c){return _0x50466c[_0x5f23('0x26')](_0x190d0d)[_0x5f23('0x27')](function(_0x5f254f){return _0x5f254f;});}return null;};}function removeEntity(_0x133e37,_0x5b3481){return function(_0x3b1843){if(_0x3b1843){return _0x3b1843[_0x5f23('0x28')]()['then'](function(){_0x133e37[_0x5f23('0x1b')](0xcc)[_0x5f23('0x1c')]();});}};}function handleEntityNotFound(_0x2ed697,_0x1ea91f){return function(_0x122d17){if(!_0x122d17){_0x2ed697[_0x5f23('0x1a')](0x194);}return _0x122d17;};}function handleError(_0x105c45,_0xdd0881){_0xdd0881=_0xdd0881||0x1f4;return function(_0x597b4b){logger[_0x5f23('0x29')](_0x597b4b['stack']);if(_0x597b4b[_0x5f23('0x2a')]){delete _0x597b4b[_0x5f23('0x2a')];}_0x105c45['status'](_0xdd0881)[_0x5f23('0x2b')](_0x597b4b);};}exports[_0x5f23('0x2c')]=function(_0x1bb199,_0xc74275){var _0xecb59f={},_0x200ad3={},_0x4bc7ff={'count':0x0,'rows':[]};var _0x5230fe=db[_0x5f23('0x2d')][_0x5f23('0x2e')];_0x200ad3[_0x5f23('0x2f')]=_[_0x5f23('0x30')](_0x5230fe);_0x200ad3[_0x5f23('0x31')]=_[_0x5f23('0x30')](_0x1bb199[_0x5f23('0x31')]);_0x200ad3[_0x5f23('0x32')]=_['intersection'](_0x200ad3['model'],_0x200ad3[_0x5f23('0x31')]);_0xecb59f[_0x5f23('0x33')]=_[_0x5f23('0x34')](_0x200ad3[_0x5f23('0x2f')],qs[_0x5f23('0x35')](_0x1bb199['query'][_0x5f23('0x35')]));_0xecb59f['attributes']=_0xecb59f[_0x5f23('0x33')]['length']?_0xecb59f[_0x5f23('0x33')]:_0x200ad3[_0x5f23('0x2f')];if(!_0x1bb199[_0x5f23('0x31')]['hasOwnProperty'](_0x5f23('0x36'))){_0xecb59f[_0x5f23('0x20')]=qs[_0x5f23('0x20')](_0x1bb199[_0x5f23('0x31')][_0x5f23('0x20')]);_0xecb59f[_0x5f23('0x1f')]=qs[_0x5f23('0x1f')](_0x1bb199[_0x5f23('0x31')][_0x5f23('0x1f')]);}_0xecb59f['order']=qs['sort'](_0x1bb199['query'][_0x5f23('0x37')]);_0xecb59f[_0x5f23('0x38')]=qs['filters'](_['pick'](_0x1bb199[_0x5f23('0x31')],_0x200ad3[_0x5f23('0x32')]));if(_0x1bb199[_0x5f23('0x31')][_0x5f23('0x39')]){_0xecb59f[_0x5f23('0x38')]=_[_0x5f23('0x3a')](_0xecb59f[_0x5f23('0x38')],{'$or':_[_0x5f23('0x3b')](_0x5230fe,function(_0x122942){if(_0x122942[_0x5f23('0x3c')][_0x5f23('0x3d')]!==_0x5f23('0x3e')){var _0x25f3e0={};_0x25f3e0[_0x122942['field']]={'$like':'%'+_0x1bb199[_0x5f23('0x31')][_0x5f23('0x39')]+'%'};return _0x25f3e0;}})});}_0xecb59f=_[_0x5f23('0x3a')]({},_0xecb59f,_0x1bb199[_0x5f23('0x3f')]);var _0xcba113={'where':_0xecb59f[_0x5f23('0x38')]};return db[_0x5f23('0x2d')][_0x5f23('0x1e')](_0xcba113)[_0x5f23('0x27')](function(_0x3289fa){_0x4bc7ff[_0x5f23('0x1e')]=_0x3289fa;if(_0x1bb199['query']['includeAll']){_0xecb59f[_0x5f23('0x40')]=[{'all':!![]}];}return db[_0x5f23('0x2d')][_0x5f23('0x41')](_0xecb59f);})[_0x5f23('0x27')](function(_0xb82ffe){_0x4bc7ff[_0x5f23('0x42')]=_0xb82ffe;return _0x4bc7ff;})['then'](respondWithFilteredResult(_0xc74275,_0xecb59f))[_0x5f23('0x43')](handleError(_0xc74275,null));};exports[_0x5f23('0x44')]=function(_0x21acaf,_0xce830b){var _0x409a4e={'raw':!![],'where':{'id':_0x21acaf[_0x5f23('0x45')]['id']}},_0x4128f0={};_0x4128f0[_0x5f23('0x2f')]=_[_0x5f23('0x30')](db[_0x5f23('0x2d')][_0x5f23('0x2e')]);_0x4128f0[_0x5f23('0x31')]=_[_0x5f23('0x30')](_0x21acaf[_0x5f23('0x31')]);_0x4128f0[_0x5f23('0x32')]=_[_0x5f23('0x34')](_0x4128f0[_0x5f23('0x2f')],_0x4128f0[_0x5f23('0x31')]);_0x409a4e[_0x5f23('0x33')]=_[_0x5f23('0x34')](_0x4128f0['model'],qs['fields'](_0x21acaf[_0x5f23('0x31')][_0x5f23('0x35')]));_0x409a4e[_0x5f23('0x33')]=_0x409a4e[_0x5f23('0x33')][_0x5f23('0x46')]?_0x409a4e[_0x5f23('0x33')]:_0x4128f0[_0x5f23('0x2f')];if(_0x21acaf['query']['includeAll']){_0x409a4e[_0x5f23('0x40')]=[{'all':!![]}];}_0x409a4e=_['merge']({},_0x409a4e,_0x21acaf[_0x5f23('0x3f')]);return db['MailQueueReport']['find'](_0x409a4e)[_0x5f23('0x27')](handleEntityNotFound(_0xce830b,null))[_0x5f23('0x27')](respondWithResult(_0xce830b,null))[_0x5f23('0x43')](handleError(_0xce830b,null));};exports[_0x5f23('0x47')]=function(_0xbed224,_0x30ba3e){return db[_0x5f23('0x2d')][_0x5f23('0x47')](_0xbed224[_0x5f23('0x48')],{})[_0x5f23('0x27')](respondWithResult(_0x30ba3e,0xc9))[_0x5f23('0x43')](handleError(_0x30ba3e,null));};exports[_0x5f23('0x26')]=function(_0x3e8a98,_0x556497){if(_0x3e8a98[_0x5f23('0x48')]['id']){delete _0x3e8a98['body']['id'];}return db['MailQueueReport'][_0x5f23('0x49')]({'where':{'id':_0x3e8a98[_0x5f23('0x45')]['id']}})[_0x5f23('0x27')](handleEntityNotFound(_0x556497,null))[_0x5f23('0x27')](saveUpdates(_0x3e8a98['body'],null))[_0x5f23('0x27')](respondWithResult(_0x556497,null))[_0x5f23('0x43')](handleError(_0x556497,null));};exports['destroy']=function(_0xa9c48c,_0x46fddb){return db[_0x5f23('0x2d')][_0x5f23('0x49')]({'where':{'id':_0xa9c48c['params']['id']}})['then'](handleEntityNotFound(_0x46fddb,null))[_0x5f23('0x27')](removeEntity(_0x46fddb,null))[_0x5f23('0x43')](handleError(_0x46fddb,null));};exports['describe']=function(_0x9054f0,_0x5b1f70){return db[_0x5f23('0x2d')][_0x5f23('0x4a')]()[_0x5f23('0x27')](respondWithResult(_0x5b1f70,null))[_0x5f23('0x43')](handleError(_0x5b1f70,null));};
\ No newline at end of file
+var _0x8550=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','show','create','body','find','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','stack','send','index','MailQueueReport','rawAttributes','keys','query','filters','intersection','model'];(function(_0x4275d5,_0x4a0e7f){var _0x4876ef=function(_0x506625){while(--_0x506625){_0x4275d5['push'](_0x4275d5['shift']());}};_0x4876ef(++_0x4a0e7f);}(_0x8550,0xa5));var _0x0855=function(_0x17baa6,_0x2bcad7){_0x17baa6=_0x17baa6-0x0;var _0x1f68e1=_0x8550[_0x17baa6];return _0x1f68e1;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0855('0x0'));var jsonpatch=require(_0x0855('0x1'));var rp=require(_0x0855('0x2'));var moment=require(_0x0855('0x3'));var BPromise=require(_0x0855('0x4'));var Mustache=require(_0x0855('0x5'));var util=require('util');var path=require(_0x0855('0x6'));var sox=require(_0x0855('0x7'));var csv=require('to-csv');var ejs=require(_0x0855('0x8'));var fs=require('fs');var _=require(_0x0855('0x9'));var squel=require(_0x0855('0xa'));var crypto=require(_0x0855('0xb'));var jsforce=require(_0x0855('0xc'));var deskjs=require(_0x0855('0xd'));var toCsv=require(_0x0855('0xe'));var querystring=require(_0x0855('0xf'));var Papa=require('papaparse');var authService=require(_0x0855('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0x0855('0x11'));var logger=require(_0x0855('0x12'))('api');var utils=require(_0x0855('0x13'));var config=require(_0x0855('0x14'));var db=require(_0x0855('0x15'))['db'];function respondWithStatusCode(_0xa9af27,_0x2d7666){_0x2d7666=_0x2d7666||0xcc;return function(_0x3c637b){if(_0x3c637b){return _0xa9af27[_0x0855('0x16')](_0x2d7666);}return _0xa9af27[_0x0855('0x17')](_0x2d7666)[_0x0855('0x18')]();};}function respondWithResult(_0x198f12,_0x3edb93){_0x3edb93=_0x3edb93||0xc8;return function(_0x56d698){if(_0x56d698){return _0x198f12[_0x0855('0x17')](_0x3edb93)[_0x0855('0x19')](_0x56d698);}};}function respondWithFilteredResult(_0x1017aa,_0x4a4d3b){return function(_0x4a12ed){if(_0x4a12ed){var _0x4fe6af=_0x4a12ed[_0x0855('0x1a')],_0x5efaf8=_0x4a4d3b['offset'],_0x4a200f=_0x4a4d3b[_0x0855('0x1b')]+_0x4a4d3b[_0x0855('0x1c')],_0x30e58c;if(_0x4a200f>=_0x4fe6af){_0x4a200f=_0x4fe6af;_0x30e58c=0xc8;}else{_0x30e58c=0xce;}_0x1017aa[_0x0855('0x17')](_0x30e58c);return _0x1017aa[_0x0855('0x1d')]('Content-Range',_0x5efaf8+'-'+_0x4a200f+'/'+_0x4fe6af)[_0x0855('0x19')](_0x4a12ed);}return null;};}function patchUpdates(_0x263dd){return function(_0x1332e9){try{jsonpatch['apply'](_0x1332e9,_0x263dd,!![]);}catch(_0x3630e7){return BPromise[_0x0855('0x1e')](_0x3630e7);}return _0x1332e9[_0x0855('0x1f')]();};}function saveUpdates(_0x2c489a,_0x242178){return function(_0x59d0bc){if(_0x59d0bc){return _0x59d0bc[_0x0855('0x20')](_0x2c489a)[_0x0855('0x21')](function(_0x3b4c57){return _0x3b4c57;});}return null;};}function removeEntity(_0x20a6f9,_0x5ab584){return function(_0x7f2ca3){if(_0x7f2ca3){return _0x7f2ca3[_0x0855('0x22')]()[_0x0855('0x21')](function(){_0x20a6f9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46796f,_0x128035){return function(_0x1c6f4f){if(!_0x1c6f4f){_0x46796f[_0x0855('0x16')](0x194);}return _0x1c6f4f;};}function handleError(_0x5ad295,_0x425b4a){_0x425b4a=_0x425b4a||0x1f4;return function(_0x19621d){logger['error'](_0x19621d[_0x0855('0x23')]);if(_0x19621d['name']){delete _0x19621d['name'];}_0x5ad295['status'](_0x425b4a)[_0x0855('0x24')](_0x19621d);};}exports[_0x0855('0x25')]=function(_0x11edb2,_0x3cbe27){var _0x54f5fe={},_0x4c8439={},_0x4d4a37={'count':0x0,'rows':[]};var _0x1286d4=db[_0x0855('0x26')][_0x0855('0x27')];_0x4c8439['model']=_[_0x0855('0x28')](_0x1286d4);_0x4c8439['query']=_[_0x0855('0x28')](_0x11edb2[_0x0855('0x29')]);_0x4c8439[_0x0855('0x2a')]=_[_0x0855('0x2b')](_0x4c8439[_0x0855('0x2c')],_0x4c8439[_0x0855('0x29')]);_0x54f5fe[_0x0855('0x2d')]=_[_0x0855('0x2b')](_0x4c8439[_0x0855('0x2c')],qs[_0x0855('0x2e')](_0x11edb2[_0x0855('0x29')][_0x0855('0x2e')]));_0x54f5fe[_0x0855('0x2d')]=_0x54f5fe[_0x0855('0x2d')][_0x0855('0x2f')]?_0x54f5fe['attributes']:_0x4c8439[_0x0855('0x2c')];if(!_0x11edb2['query'][_0x0855('0x30')](_0x0855('0x31'))){_0x54f5fe[_0x0855('0x1c')]=qs['limit'](_0x11edb2['query']['limit']);_0x54f5fe[_0x0855('0x1b')]=qs[_0x0855('0x1b')](_0x11edb2[_0x0855('0x29')]['offset']);}_0x54f5fe[_0x0855('0x32')]=qs[_0x0855('0x33')](_0x11edb2[_0x0855('0x29')][_0x0855('0x33')]);_0x54f5fe[_0x0855('0x34')]=qs['filters'](_[_0x0855('0x35')](_0x11edb2[_0x0855('0x29')],_0x4c8439[_0x0855('0x2a')]));if(_0x11edb2['query'][_0x0855('0x36')]){_0x54f5fe[_0x0855('0x34')]=_[_0x0855('0x37')](_0x54f5fe['where'],{'$or':_['map'](_0x1286d4,function(_0x4080b8){if(_0x4080b8[_0x0855('0x38')][_0x0855('0x39')]!==_0x0855('0x3a')){var _0x46196e={};_0x46196e[_0x4080b8[_0x0855('0x3b')]]={'$like':'%'+_0x11edb2[_0x0855('0x29')][_0x0855('0x36')]+'%'};return _0x46196e;}})});}_0x54f5fe=_['merge']({},_0x54f5fe,_0x11edb2[_0x0855('0x3c')]);var _0x3d4560={'where':_0x54f5fe[_0x0855('0x34')]};return db[_0x0855('0x26')][_0x0855('0x1a')](_0x3d4560)['then'](function(_0x586c57){_0x4d4a37[_0x0855('0x1a')]=_0x586c57;if(_0x11edb2['query'][_0x0855('0x3d')]){_0x54f5fe[_0x0855('0x3e')]=[{'all':!![]}];}return db[_0x0855('0x26')][_0x0855('0x3f')](_0x54f5fe);})[_0x0855('0x21')](function(_0x4dd61c){_0x4d4a37[_0x0855('0x40')]=_0x4dd61c;return _0x4d4a37;})['then'](respondWithFilteredResult(_0x3cbe27,_0x54f5fe))[_0x0855('0x41')](handleError(_0x3cbe27,null));};exports[_0x0855('0x42')]=function(_0x61c4c5,_0x455c01){var _0x92d36e={'raw':!![],'where':{'id':_0x61c4c5['params']['id']}},_0x5a32f3={};_0x5a32f3['model']=_[_0x0855('0x28')](db[_0x0855('0x26')][_0x0855('0x27')]);_0x5a32f3[_0x0855('0x29')]=_['keys'](_0x61c4c5[_0x0855('0x29')]);_0x5a32f3[_0x0855('0x2a')]=_[_0x0855('0x2b')](_0x5a32f3['model'],_0x5a32f3[_0x0855('0x29')]);_0x92d36e[_0x0855('0x2d')]=_[_0x0855('0x2b')](_0x5a32f3[_0x0855('0x2c')],qs[_0x0855('0x2e')](_0x61c4c5[_0x0855('0x29')][_0x0855('0x2e')]));_0x92d36e[_0x0855('0x2d')]=_0x92d36e[_0x0855('0x2d')][_0x0855('0x2f')]?_0x92d36e[_0x0855('0x2d')]:_0x5a32f3[_0x0855('0x2c')];if(_0x61c4c5[_0x0855('0x29')][_0x0855('0x3d')]){_0x92d36e[_0x0855('0x3e')]=[{'all':!![]}];}_0x92d36e=_[_0x0855('0x37')]({},_0x92d36e,_0x61c4c5[_0x0855('0x3c')]);return db[_0x0855('0x26')]['find'](_0x92d36e)['then'](handleEntityNotFound(_0x455c01,null))[_0x0855('0x21')](respondWithResult(_0x455c01,null))[_0x0855('0x41')](handleError(_0x455c01,null));};exports[_0x0855('0x43')]=function(_0x5f231a,_0x234cc0){return db[_0x0855('0x26')][_0x0855('0x43')](_0x5f231a[_0x0855('0x44')],{})[_0x0855('0x21')](respondWithResult(_0x234cc0,0xc9))['catch'](handleError(_0x234cc0,null));};exports[_0x0855('0x20')]=function(_0x29edef,_0x502f8c){if(_0x29edef[_0x0855('0x44')]['id']){delete _0x29edef[_0x0855('0x44')]['id'];}return db[_0x0855('0x26')][_0x0855('0x45')]({'where':{'id':_0x29edef['params']['id']}})[_0x0855('0x21')](handleEntityNotFound(_0x502f8c,null))[_0x0855('0x21')](saveUpdates(_0x29edef[_0x0855('0x44')],null))[_0x0855('0x21')](respondWithResult(_0x502f8c,null))[_0x0855('0x41')](handleError(_0x502f8c,null));};exports[_0x0855('0x22')]=function(_0x276943,_0x44e693){return db[_0x0855('0x26')][_0x0855('0x45')]({'where':{'id':_0x276943['params']['id']}})['then'](handleEntityNotFound(_0x44e693,null))['then'](removeEntity(_0x44e693,null))[_0x0855('0x41')](handleError(_0x44e693,null));};exports['describe']=function(_0x46a01b,_0x1dede0){return db['MailQueueReport']['describe']()[_0x0855('0x21')](respondWithResult(_0x1dede0,null))[_0x0855('0x41')](handleError(_0x1dede0,null));};
\ No newline at end of file
index 9e06f69..c5eff4f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3b9c=['util','../../config/logger','moment','bluebird','request-promise','exports','MailQueueReport','uniqueid','lodash'];(function(_0x4f018a,_0x350704){var _0x56f3a6=function(_0x5cecfe){while(--_0x5cecfe){_0x4f018a['push'](_0x4f018a['shift']());}};_0x56f3a6(++_0x350704);}(_0x3b9c,0x1ca));var _0xc3b9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3b9c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc3b9('0x0'));var util=require(_0xc3b9('0x1'));var logger=require(_0xc3b9('0x2'))('api');var moment=require(_0xc3b9('0x3'));var BPromise=require(_0xc3b9('0x4'));var rp=require(_0xc3b9('0x5'));var attributes=require('./mailQueueReport.attributes');module[_0xc3b9('0x6')]=function(_0x517dce,_0x3f1a29){return _0x517dce['define'](_0xc3b9('0x7'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xc3b9('0x8'),'fields':['uniqueid']}],'timestamps':!![]});};
\ No newline at end of file
+var _0x1f62=['lodash','../../config/logger','api','bluebird','request-promise','./mailQueueReport.attributes','exports','report_mail_queue','uniqueid'];(function(_0x2e02e9,_0x2b54dc){var _0x55a46a=function(_0x122936){while(--_0x122936){_0x2e02e9['push'](_0x2e02e9['shift']());}};_0x55a46a(++_0x2b54dc);}(_0x1f62,0x105));var _0x21f6=function(_0x5e9876,_0x16052d){_0x5e9876=_0x5e9876-0x0;var _0x576c48=_0x1f62[_0x5e9876];return _0x576c48;};'use strict';var _=require(_0x21f6('0x0'));var util=require('util');var logger=require(_0x21f6('0x1'))(_0x21f6('0x2'));var moment=require('moment');var BPromise=require(_0x21f6('0x3'));var rp=require(_0x21f6('0x4'));var attributes=require(_0x21f6('0x5'));module[_0x21f6('0x6')]=function(_0x2bed68,_0x4878e2){return _0x2bed68['define']('MailQueueReport',attributes,{'tableName':_0x21f6('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x21f6('0x8')]}],'timestamps':!![]});};
\ No newline at end of file
index 9001f8a..e2b3ce0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xab78=['lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','MailQueueReport','options','raw','CreateMailQueueReport','update','body','where','attributes','limit','UpdateMailQueueReport'];(function(_0x57f8fe,_0x3e3402){var _0x38dfb8=function(_0x5b4c83){while(--_0x5b4c83){_0x57f8fe['push'](_0x57f8fe['shift']());}};_0x38dfb8(++_0x3e3402);}(_0xab78,0x1a0));var _0x8ab7=function(_0xe6117a,_0x488cd3){_0xe6117a=_0xe6117a-0x0;var _0x2c2e11=_0xab78[_0xe6117a];return _0x2c2e11;};'use strict';var _=require(_0x8ab7('0x0'));var util=require(_0x8ab7('0x1'));var moment=require('moment');var BPromise=require(_0x8ab7('0x2'));var rs=require(_0x8ab7('0x3'));var fs=require('fs');var Redis=require(_0x8ab7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8ab7('0x5'))(_0x8ab7('0x6'));var config=require(_0x8ab7('0x7'));var jayson=require(_0x8ab7('0x8'));var client=jayson['client'][_0x8ab7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3255d,_0x117648,_0xbfa76){return new BPromise(function(_0x55a368,_0x2bb57a){return client[_0x8ab7('0xa')](_0x3255d,_0xbfa76)[_0x8ab7('0xb')](function(_0xb3cab7){logger['info'](_0x8ab7('0xc'),_0x117648,_0x8ab7('0xd'));logger[_0x8ab7('0xe')](_0x8ab7('0xf'),_0x117648,'request\x20sent',JSON[_0x8ab7('0x10')](_0xb3cab7));if(_0xb3cab7[_0x8ab7('0x11')]){if(_0xb3cab7[_0x8ab7('0x11')]['code']===0x1f4){logger[_0x8ab7('0x11')](_0x8ab7('0xc'),_0x117648,_0xb3cab7[_0x8ab7('0x11')][_0x8ab7('0x12')]);return _0x2bb57a(_0xb3cab7[_0x8ab7('0x11')]['message']);}logger['error'](_0x8ab7('0xc'),_0x117648,_0xb3cab7[_0x8ab7('0x11')][_0x8ab7('0x12')]);return _0x55a368(_0xb3cab7[_0x8ab7('0x11')][_0x8ab7('0x12')]);}else{logger[_0x8ab7('0x13')](_0x8ab7('0xc'),_0x117648,_0x8ab7('0xd'));_0x55a368(_0xb3cab7[_0x8ab7('0x14')][_0x8ab7('0x12')]);}})[_0x8ab7('0x15')](function(_0x2d10bc){logger[_0x8ab7('0x11')](_0x8ab7('0xc'),_0x117648,_0x2d10bc);_0x2bb57a(_0x2d10bc);});});}exports['CreateMailQueueReport']=function(_0x28e4fa){var _0x54d777=this;return new Promise(function(_0x3df347,_0x44d5da){return db[_0x8ab7('0x16')]['create'](_0x28e4fa['body'],{'raw':_0x28e4fa['options']?_0x28e4fa[_0x8ab7('0x17')][_0x8ab7('0x18')]===undefined?!![]:![]:!![]})[_0x8ab7('0xb')](function(_0x163631){logger[_0x8ab7('0x13')](_0x8ab7('0x19'),_0x28e4fa);logger[_0x8ab7('0xe')](_0x8ab7('0x19'),_0x28e4fa,JSON[_0x8ab7('0x10')](_0x163631));_0x3df347(_0x163631);})[_0x8ab7('0x15')](function(_0x4b690e){logger[_0x8ab7('0x11')](_0x8ab7('0x19'),_0x4b690e[_0x8ab7('0x12')],_0x28e4fa);_0x44d5da(_0x54d777[_0x8ab7('0x11')](0x1f4,_0x4b690e[_0x8ab7('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1e7688){var _0x11054c=this;return new Promise(function(_0x50584e,_0x7c93aa){return db[_0x8ab7('0x16')][_0x8ab7('0x1a')](_0x1e7688[_0x8ab7('0x1b')],{'raw':_0x1e7688['options']?_0x1e7688[_0x8ab7('0x17')][_0x8ab7('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e7688[_0x8ab7('0x17')]?_0x1e7688[_0x8ab7('0x17')][_0x8ab7('0x1c')]||null:null,'attributes':_0x1e7688[_0x8ab7('0x17')]?_0x1e7688[_0x8ab7('0x17')][_0x8ab7('0x1d')]||null:null,'limit':_0x1e7688['options']?_0x1e7688['options'][_0x8ab7('0x1e')]||null:null})['then'](function(_0x5c8582){logger[_0x8ab7('0x13')](_0x8ab7('0x1f'),_0x1e7688);logger[_0x8ab7('0xe')]('UpdateMailQueueReport',_0x1e7688,JSON[_0x8ab7('0x10')](_0x5c8582));_0x50584e(_0x5c8582);})[_0x8ab7('0x15')](function(_0x4608c2){logger['error']('UpdateMailQueueReport',_0x4608c2[_0x8ab7('0x12')],_0x1e7688);_0x7c93aa(_0x11054c[_0x8ab7('0x11')](0x1f4,_0x4608c2[_0x8ab7('0x12')]));});});};
\ No newline at end of file
+var _0x7ce7=['info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','create','body','options','UpdateMailQueueReport','update','where','attributes','limit','util','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','then'];(function(_0x22abb7,_0x15eb01){var _0x5ba042=function(_0x45d741){while(--_0x45d741){_0x22abb7['push'](_0x22abb7['shift']());}};_0x5ba042(++_0x15eb01);}(_0x7ce7,0x180));var _0x77ce=function(_0x54ba4e,_0x1b1469){_0x54ba4e=_0x54ba4e-0x0;var _0x54b422=_0x7ce7[_0x54ba4e];return _0x54b422;};'use strict';var _=require('lodash');var util=require(_0x77ce('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x77ce('0x1'));var db=require(_0x77ce('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x77ce('0x3'))(_0x77ce('0x4'));var config=require('../../config/environment');var jayson=require(_0x77ce('0x5'));var client=jayson[_0x77ce('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45aa53,_0x126733,_0x3b4acc){return new BPromise(function(_0x27cd70,_0x590f85){return client['request'](_0x45aa53,_0x3b4acc)[_0x77ce('0x7')](function(_0x5b2ef2){logger[_0x77ce('0x8')](_0x77ce('0x9'),_0x126733,_0x77ce('0xa'));logger[_0x77ce('0xb')](_0x77ce('0xc'),_0x126733,_0x77ce('0xa'),JSON[_0x77ce('0xd')](_0x5b2ef2));if(_0x5b2ef2[_0x77ce('0xe')]){if(_0x5b2ef2[_0x77ce('0xe')][_0x77ce('0xf')]===0x1f4){logger[_0x77ce('0xe')]('MailQueueReport,\x20%s,\x20%s',_0x126733,_0x5b2ef2[_0x77ce('0xe')]['message']);return _0x590f85(_0x5b2ef2['error'][_0x77ce('0x10')]);}logger[_0x77ce('0xe')](_0x77ce('0x9'),_0x126733,_0x5b2ef2[_0x77ce('0xe')][_0x77ce('0x10')]);return _0x27cd70(_0x5b2ef2[_0x77ce('0xe')][_0x77ce('0x10')]);}else{logger[_0x77ce('0x8')](_0x77ce('0x9'),_0x126733,'request\x20sent');_0x27cd70(_0x5b2ef2['result'][_0x77ce('0x10')]);}})[_0x77ce('0x11')](function(_0x50bc64){logger['error'](_0x77ce('0x9'),_0x126733,_0x50bc64);_0x590f85(_0x50bc64);});});}exports[_0x77ce('0x12')]=function(_0x4d036c){var _0x12a701=this;return new Promise(function(_0x3aab91,_0xbfc8e){return db[_0x77ce('0x13')][_0x77ce('0x14')](_0x4d036c[_0x77ce('0x15')],{'raw':_0x4d036c[_0x77ce('0x16')]?_0x4d036c[_0x77ce('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x77ce('0x7')](function(_0x5d51b0){logger[_0x77ce('0x8')](_0x77ce('0x12'),_0x4d036c);logger[_0x77ce('0xb')](_0x77ce('0x12'),_0x4d036c,JSON['stringify'](_0x5d51b0));_0x3aab91(_0x5d51b0);})['catch'](function(_0x4f9a2d){logger[_0x77ce('0xe')]('CreateMailQueueReport',_0x4f9a2d[_0x77ce('0x10')],_0x4d036c);_0xbfc8e(_0x12a701[_0x77ce('0xe')](0x1f4,_0x4f9a2d[_0x77ce('0x10')]));});});};exports[_0x77ce('0x17')]=function(_0x171e51){var _0x26a3c1=this;return new Promise(function(_0x4b9165,_0x244020){return db['MailQueueReport'][_0x77ce('0x18')](_0x171e51['body'],{'raw':_0x171e51[_0x77ce('0x16')]?_0x171e51[_0x77ce('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x171e51[_0x77ce('0x16')]?_0x171e51[_0x77ce('0x16')][_0x77ce('0x19')]||null:null,'attributes':_0x171e51[_0x77ce('0x16')]?_0x171e51[_0x77ce('0x16')][_0x77ce('0x1a')]||null:null,'limit':_0x171e51[_0x77ce('0x16')]?_0x171e51['options'][_0x77ce('0x1b')]||null:null})[_0x77ce('0x7')](function(_0x3dee96){logger[_0x77ce('0x8')](_0x77ce('0x17'),_0x171e51);logger[_0x77ce('0xb')]('UpdateMailQueueReport',_0x171e51,JSON[_0x77ce('0xd')](_0x3dee96));_0x4b9165(_0x3dee96);})[_0x77ce('0x11')](function(_0x24caa4){logger[_0x77ce('0xe')](_0x77ce('0x17'),_0x24caa4[_0x77ce('0x10')],_0x171e51);_0x244020(_0x26a3c1[_0x77ce('0xe')](0x1f4,_0x24caa4[_0x77ce('0x10')]));});});};
\ No newline at end of file
index 1dbcdec..73b7423 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5d17=['../../components/auth/service','../../config/environment','exports','multer','util','express','Router'];(function(_0x4f4a36,_0x371b5d){var _0x3fd9e4=function(_0x59637f){while(--_0x59637f){_0x4f4a36['push'](_0x4f4a36['shift']());}};_0x3fd9e4(++_0x371b5d);}(_0x5d17,0x114));var _0x75d1=function(_0x166b97,_0x2833d5){_0x166b97=_0x166b97-0x0;var _0x4d3c9a=_0x5d17[_0x166b97];return _0x4d3c9a;};'use strict';var multer=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75d1('0x2'));var router=express[_0x75d1('0x3')]();var auth=require(_0x75d1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x75d1('0x5'));module[_0x75d1('0x6')]=router;
\ No newline at end of file
+var _0x2d72=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x3ce3f1,_0x549676){var _0x4eccfc=function(_0x2e8b0e){while(--_0x2e8b0e){_0x3ce3f1['push'](_0x3ce3f1['shift']());}};_0x4eccfc(++_0x549676);}(_0x2d72,0xa8));var _0x22d7=function(_0x573ad5,_0x26df8f){_0x573ad5=_0x573ad5-0x0;var _0x2d4371=_0x2d72[_0x573ad5];return _0x2d4371;};'use strict';var multer=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var path=require(_0x22d7('0x2'));var timeout=require(_0x22d7('0x3'));var express=require(_0x22d7('0x4'));var router=express[_0x22d7('0x5')]();var auth=require(_0x22d7('0x6'));var interaction=require(_0x22d7('0x7'));var config=require(_0x22d7('0x8'));module[_0x22d7('0x9')]=router;
\ No newline at end of file
index d52a296..139e006 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd691=['exports','STRING','BOOLEAN','username','INTEGER','INBOX','sequelize'];(function(_0x252699,_0x134b4e){var _0x56d0c6=function(_0x5551a8){while(--_0x5551a8){_0x252699['push'](_0x252699['shift']());}};_0x56d0c6(++_0x134b4e);}(_0xd691,0xe6));var _0x1d69=function(_0x35485a,_0x91cdd4){_0x35485a=_0x35485a-0x0;var _0x5148e6=_0xd691[_0x35485a];return _0x5148e6;};'use strict';var Sequelize=require(_0x1d69('0x0'));module[_0x1d69('0x1')]={'description':{'type':Sequelize[_0x1d69('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x1d69('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x1d69('0x2')],'unique':_0x1d69('0x4')},'password':{'type':Sequelize[_0x1d69('0x2')]},'port':{'type':Sequelize[_0x1d69('0x5')]},'tls':{'type':Sequelize[_0x1d69('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x1d69('0x2')],'defaultValue':_0x1d69('0x6')},'connTimeout':{'type':Sequelize[_0x1d69('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x1d69('0x5')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0xf109=['INTEGER','BOOLEAN','INBOX','sequelize','exports','STRING','username'];(function(_0x4e61a9,_0x4576f1){var _0x455af1=function(_0x148d3b){while(--_0x148d3b){_0x4e61a9['push'](_0x4e61a9['shift']());}};_0x455af1(++_0x4576f1);}(_0xf109,0xce));var _0x9f10=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xf109[_0xc8a931];return _0x28bd27;};'use strict';var Sequelize=require(_0x9f10('0x0'));module[_0x9f10('0x1')]={'description':{'type':Sequelize[_0x9f10('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING'],'unique':_0x9f10('0x3')},'password':{'type':Sequelize[_0x9f10('0x2')]},'port':{'type':Sequelize[_0x9f10('0x4')]},'tls':{'type':Sequelize[_0x9f10('0x5')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x9f10('0x2')],'defaultValue':_0x9f10('0x6')},'connTimeout':{'type':Sequelize[_0x9f10('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x9f10('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x9f10('0x2')]}};
\ No newline at end of file
index ec2a30d..289d779 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa74f=['request-promise','./mailServerIn.attributes','exports','mail_servers_in','../../config/logger','bluebird'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xa74f,0x9a));var _0xfa74=function(_0x30d87a,_0xf3a07f){_0x30d87a=_0x30d87a-0x0;var _0x48f64b=_0xa74f[_0x30d87a];return _0x48f64b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfa74('0x0'))('api');var moment=require('moment');var BPromise=require(_0xfa74('0x1'));var rp=require(_0xfa74('0x2'));var attributes=require(_0xfa74('0x3'));module[_0xfa74('0x4')]=function(_0x5b367b,_0x141625){return _0x5b367b['define']('MailServerIn',attributes,{'tableName':_0xfa74('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xb4e6=['lodash','../../config/logger','api','moment','bluebird','request-promise','./mailServerIn.attributes','exports','define','MailServerIn'];(function(_0x21f171,_0x34a9bb){var _0x40bf78=function(_0x4b686c){while(--_0x4b686c){_0x21f171['push'](_0x21f171['shift']());}};_0x40bf78(++_0x34a9bb);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x11a55c,_0x4eced9){_0x11a55c=_0x11a55c-0x0;var _0x26c390=_0xb4e6[_0x11a55c];return _0x26c390;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var attributes=require(_0x6b4e('0x6'));module[_0x6b4e('0x7')]=function(_0x52313b,_0x40da90){return _0x52313b[_0x6b4e('0x8')](_0x6b4e('0x9'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 6174d48..739c07e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfc03=['request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http'];(function(_0x52c1f6,_0x4eda0b){var _0x4df981=function(_0x71aa7){while(--_0x71aa7){_0x52c1f6['push'](_0x52c1f6['shift']());}};_0x4df981(++_0x4eda0b);}(_0xfc03,0xde));var _0x3fc0=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xfc03[_0x26f702];return _0x11417d;};'use strict';var _=require(_0x3fc0('0x0'));var util=require(_0x3fc0('0x1'));var moment=require(_0x3fc0('0x2'));var BPromise=require('bluebird');var rs=require(_0x3fc0('0x3'));var fs=require('fs');var Redis=require(_0x3fc0('0x4'));var db=require(_0x3fc0('0x5'))['db'];var utils=require(_0x3fc0('0x6'));var logger=require('../../config/logger')(_0x3fc0('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3fc0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4434ba,_0x3c3c33,_0x3aa2f4){return new BPromise(function(_0x3fb1a3,_0x5d9c6b){return client[_0x3fc0('0x9')](_0x4434ba,_0x3aa2f4)[_0x3fc0('0xa')](function(_0x1e2e4e){logger[_0x3fc0('0xb')](_0x3fc0('0xc'),_0x3c3c33,_0x3fc0('0xd'));logger[_0x3fc0('0xe')](_0x3fc0('0xf'),_0x3c3c33,_0x3fc0('0xd'),JSON['stringify'](_0x1e2e4e));if(_0x1e2e4e['error']){if(_0x1e2e4e['error'][_0x3fc0('0x10')]===0x1f4){logger[_0x3fc0('0x11')]('MailServerIn,\x20%s,\x20%s',_0x3c3c33,_0x1e2e4e['error'][_0x3fc0('0x12')]);return _0x5d9c6b(_0x1e2e4e[_0x3fc0('0x11')][_0x3fc0('0x12')]);}logger[_0x3fc0('0x11')](_0x3fc0('0xc'),_0x3c3c33,_0x1e2e4e['error']['message']);return _0x3fb1a3(_0x1e2e4e[_0x3fc0('0x11')][_0x3fc0('0x12')]);}else{logger[_0x3fc0('0xb')]('MailServerIn,\x20%s,\x20%s',_0x3c3c33,_0x3fc0('0xd'));_0x3fb1a3(_0x1e2e4e[_0x3fc0('0x13')][_0x3fc0('0x12')]);}})[_0x3fc0('0x14')](function(_0x1c65f2){logger[_0x3fc0('0x11')]('MailServerIn,\x20%s,\x20%s',_0x3c3c33,_0x1c65f2);_0x5d9c6b(_0x1c65f2);});});}exports[_0x3fc0('0x15')]=function(_0x21f739){var _0x11e96c=this;return new Promise(function(_0x4954ea,_0x294a40){return db[_0x3fc0('0x16')][_0x3fc0('0x17')]({'raw':_0x21f739[_0x3fc0('0x18')]?_0x21f739[_0x3fc0('0x18')][_0x3fc0('0x19')]===undefined?!![]:![]:!![],'where':_0x21f739[_0x3fc0('0x18')]?_0x21f739['options'][_0x3fc0('0x1a')]||null:null,'attributes':_0x21f739[_0x3fc0('0x18')]?_0x21f739[_0x3fc0('0x18')][_0x3fc0('0x1b')]||null:null,'limit':_0x21f739[_0x3fc0('0x18')]?_0x21f739[_0x3fc0('0x18')][_0x3fc0('0x1c')]||null:null,'include':_0x21f739[_0x3fc0('0x18')]?_0x21f739[_0x3fc0('0x18')][_0x3fc0('0x1d')]?_[_0x3fc0('0x1e')](_0x21f739[_0x3fc0('0x18')][_0x3fc0('0x1d')],function(_0x918011){return{'model':db[_0x918011[_0x3fc0('0x1f')]],'as':_0x918011['as'],'attributes':_0x918011['attributes'],'include':_0x918011[_0x3fc0('0x1d')]?_[_0x3fc0('0x1e')](_0x918011[_0x3fc0('0x1d')],function(_0x5dbb6f){return{'model':db[_0x5dbb6f[_0x3fc0('0x1f')]],'as':_0x5dbb6f['as'],'attributes':_0x5dbb6f[_0x3fc0('0x1b')],'include':_0x5dbb6f[_0x3fc0('0x1d')]?_[_0x3fc0('0x1e')](_0x5dbb6f['include'],function(_0xaf7f5f){return{'model':db[_0xaf7f5f['model']],'as':_0xaf7f5f['as'],'attributes':_0xaf7f5f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4404b7){logger['info'](_0x3fc0('0x15'),_0x21f739);logger[_0x3fc0('0xe')](_0x3fc0('0x15'),_0x21f739,JSON[_0x3fc0('0x20')](_0x4404b7));_0x4954ea(_0x4404b7);})[_0x3fc0('0x14')](function(_0x2eff72){logger[_0x3fc0('0x11')]('GetMailServerIn',_0x2eff72[_0x3fc0('0x12')],_0x21f739);_0x294a40(_0x11e96c[_0x3fc0('0x11')](0x1f4,_0x2eff72[_0x3fc0('0x12')]));});});};
\ No newline at end of file
+var _0x179b=['debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','MailServerIn','options','raw','where','limit','include','map','attributes','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent'];(function(_0x184a56,_0x4c7fbe){var _0x5407ed=function(_0x3d3b41){while(--_0x3d3b41){_0x184a56['push'](_0x184a56['shift']());}};_0x5407ed(++_0x4c7fbe);}(_0x179b,0x171));var _0xb179=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x179b[_0x341e0f];return _0x59555a;};'use strict';var _=require(_0xb179('0x0'));var util=require('util');var moment=require(_0xb179('0x1'));var BPromise=require(_0xb179('0x2'));var rs=require(_0xb179('0x3'));var fs=require('fs');var Redis=require(_0xb179('0x4'));var db=require(_0xb179('0x5'))['db'];var utils=require(_0xb179('0x6'));var logger=require(_0xb179('0x7'))(_0xb179('0x8'));var config=require(_0xb179('0x9'));var jayson=require(_0xb179('0xa'));var client=jayson[_0xb179('0xb')][_0xb179('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ae1e6,_0x1d573d,_0x1f3434){return new BPromise(function(_0x4691f5,_0x34be63){return client[_0xb179('0xd')](_0x1ae1e6,_0x1f3434)['then'](function(_0x59a451){logger[_0xb179('0xe')]('MailServerIn,\x20%s,\x20%s',_0x1d573d,_0xb179('0xf'));logger[_0xb179('0x10')](_0xb179('0x11'),_0x1d573d,'request\x20sent',JSON[_0xb179('0x12')](_0x59a451));if(_0x59a451[_0xb179('0x13')]){if(_0x59a451[_0xb179('0x13')][_0xb179('0x14')]===0x1f4){logger[_0xb179('0x13')](_0xb179('0x15'),_0x1d573d,_0x59a451['error'][_0xb179('0x16')]);return _0x34be63(_0x59a451[_0xb179('0x13')][_0xb179('0x16')]);}logger[_0xb179('0x13')](_0xb179('0x15'),_0x1d573d,_0x59a451[_0xb179('0x13')]['message']);return _0x4691f5(_0x59a451['error'][_0xb179('0x16')]);}else{logger[_0xb179('0xe')](_0xb179('0x15'),_0x1d573d,_0xb179('0xf'));_0x4691f5(_0x59a451[_0xb179('0x17')][_0xb179('0x16')]);}})[_0xb179('0x18')](function(_0xeb06c5){logger[_0xb179('0x13')]('MailServerIn,\x20%s,\x20%s',_0x1d573d,_0xeb06c5);_0x34be63(_0xeb06c5);});});}exports[_0xb179('0x19')]=function(_0x159b9e){var _0x350ffd=this;return new Promise(function(_0x46abd8,_0xf67544){return db[_0xb179('0x1a')]['findAll']({'raw':_0x159b9e['options']?_0x159b9e[_0xb179('0x1b')][_0xb179('0x1c')]===undefined?!![]:![]:!![],'where':_0x159b9e[_0xb179('0x1b')]?_0x159b9e[_0xb179('0x1b')][_0xb179('0x1d')]||null:null,'attributes':_0x159b9e[_0xb179('0x1b')]?_0x159b9e['options']['attributes']||null:null,'limit':_0x159b9e[_0xb179('0x1b')]?_0x159b9e[_0xb179('0x1b')][_0xb179('0x1e')]||null:null,'include':_0x159b9e[_0xb179('0x1b')]?_0x159b9e[_0xb179('0x1b')][_0xb179('0x1f')]?_[_0xb179('0x20')](_0x159b9e[_0xb179('0x1b')][_0xb179('0x1f')],function(_0x149a1c){return{'model':db[_0x149a1c['model']],'as':_0x149a1c['as'],'attributes':_0x149a1c[_0xb179('0x21')],'include':_0x149a1c[_0xb179('0x1f')]?_[_0xb179('0x20')](_0x149a1c[_0xb179('0x1f')],function(_0x2f96d7){return{'model':db[_0x2f96d7['model']],'as':_0x2f96d7['as'],'attributes':_0x2f96d7[_0xb179('0x21')],'include':_0x2f96d7['include']?_['map'](_0x2f96d7[_0xb179('0x1f')],function(_0x39b951){return{'model':db[_0x39b951['model']],'as':_0x39b951['as'],'attributes':_0x39b951[_0xb179('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb179('0x22')](function(_0x3251f5){logger[_0xb179('0xe')](_0xb179('0x19'),_0x159b9e);logger['debug'](_0xb179('0x19'),_0x159b9e,JSON[_0xb179('0x12')](_0x3251f5));_0x46abd8(_0x3251f5);})['catch'](function(_0x7d0f30){logger[_0xb179('0x13')](_0xb179('0x19'),_0x7d0f30['message'],_0x159b9e);_0xf67544(_0x350ffd[_0xb179('0x13')](0x1f4,_0x7d0f30[_0xb179('0x16')]));});});};
\ No newline at end of file
index 0370263..d485eab 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5c37=['express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x2bccd4,_0x3d4a58){var _0x434602=function(_0x2d468e){while(--_0x2d468e){_0x2bccd4['push'](_0x2bccd4['shift']());}};_0x434602(++_0x3d4a58);}(_0x5c37,0x96));var _0x75c3=function(_0x381379,_0x3f3b86){_0x381379=_0x381379-0x0;var _0x3e1063=_0x5c37[_0x381379];return _0x3e1063;};'use strict';var multer=require(_0x75c3('0x0'));var util=require(_0x75c3('0x1'));var path=require(_0x75c3('0x2'));var timeout=require('connect-timeout');var express=require(_0x75c3('0x3'));var router=express[_0x75c3('0x4')]();var auth=require(_0x75c3('0x5'));var interaction=require(_0x75c3('0x6'));var config=require('../../config/environment');var controller=require('./mailServerOut.controller');router[_0x75c3('0x7')]('/',auth[_0x75c3('0x8')](),controller['index']);router['get']('/:id',auth[_0x75c3('0x8')](),controller[_0x75c3('0x9')]);router['post']('/',auth[_0x75c3('0x8')](),controller[_0x75c3('0xa')]);router[_0x75c3('0xb')](_0x75c3('0xc'),auth[_0x75c3('0x8')](),controller[_0x75c3('0xd')]);router[_0x75c3('0xe')](_0x75c3('0xc'),auth[_0x75c3('0x8')](),controller[_0x75c3('0xf')]);module[_0x75c3('0x10')]=router;
\ No newline at end of file
+var _0x3dfb=['connect-timeout','express','Router','../../components/auth/service','./mailServerOut.controller','get','isAuthenticated','show','put','/:id','delete','destroy','exports','multer','path'];(function(_0x4769eb,_0x2308b4){var _0x3db2f5=function(_0x9998a0){while(--_0x9998a0){_0x4769eb['push'](_0x4769eb['shift']());}};_0x3db2f5(++_0x2308b4);}(_0x3dfb,0xa3));var _0xb3df=function(_0x4e6149,_0x131d78){_0x4e6149=_0x4e6149-0x0;var _0x45cb82=_0x3dfb[_0x4e6149];return _0x45cb82;};'use strict';var multer=require(_0xb3df('0x0'));var util=require('util');var path=require(_0xb3df('0x1'));var timeout=require(_0xb3df('0x2'));var express=require(_0xb3df('0x3'));var router=express[_0xb3df('0x4')]();var auth=require(_0xb3df('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb3df('0x6'));router[_0xb3df('0x7')]('/',auth[_0xb3df('0x8')](),controller['index']);router[_0xb3df('0x7')]('/:id',auth[_0xb3df('0x8')](),controller[_0xb3df('0x9')]);router['post']('/',auth[_0xb3df('0x8')](),controller['create']);router[_0xb3df('0xa')](_0xb3df('0xb'),auth[_0xb3df('0x8')](),controller['update']);router[_0xb3df('0xc')]('/:id',auth[_0xb3df('0x8')](),controller[_0xb3df('0xd')]);module[_0xb3df('0xe')]=router;
\ No newline at end of file
index 328c7a1..62c6233 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2453=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x438856,_0x3cb432){var _0x18692d=function(_0x20aeb4){while(--_0x20aeb4){_0x438856['push'](_0x438856['shift']());}};_0x18692d(++_0x3cb432);}(_0x2453,0xa9));var _0x3245=function(_0xb3a3b9,_0x323427){_0xb3a3b9=_0xb3a3b9-0x0;var _0x2de1bb=_0x2453[_0xb3a3b9];return _0x2de1bb;};'use strict';var Sequelize=require(_0x3245('0x0'));module[_0x3245('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x3245('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x3245('0x2')]},'port':{'type':Sequelize[_0x3245('0x3')]},'secure':{'type':Sequelize[_0x3245('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x3245('0x2')]},'authentication':{'type':Sequelize[_0x3245('0x4')],'defaultValue':!![]}};
\ No newline at end of file
+var _0x03f0=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x10c814,_0x2c5349){var _0x3620e8=function(_0x2da52a){while(--_0x2da52a){_0x10c814['push'](_0x10c814['shift']());}};_0x3620e8(++_0x2c5349);}(_0x03f0,0xe4));var _0x003f=function(_0x4a5357,_0x1dd03d){_0x4a5357=_0x4a5357-0x0;var _0x14cb1e=_0x03f0[_0x4a5357];return _0x14cb1e;};'use strict';var Sequelize=require(_0x003f('0x0'));module[_0x003f('0x1')]={'description':{'type':Sequelize[_0x003f('0x2')]},'host':{'type':Sequelize[_0x003f('0x2')]},'user':{'type':Sequelize[_0x003f('0x2')]},'pass':{'type':Sequelize[_0x003f('0x2')]},'port':{'type':Sequelize[_0x003f('0x3')]},'secure':{'type':Sequelize[_0x003f('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x003f('0x2')]},'authentication':{'type':Sequelize[_0x003f('0x4')],'defaultValue':!![]}};
\ No newline at end of file
index 17f887f..d7a3357 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9c44=['ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','sendStatus','status','json','count','offset','limit','save','update','then','error','stack','name','send','index','MailServerOut','rawAttributes','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','key','field','options','includeAll','include','findAll','catch','show','params','fields','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv'];(function(_0x1b22bb,_0x3fd5cf){var _0x4611b5=function(_0x3f2db6){while(--_0x3f2db6){_0x1b22bb['push'](_0x1b22bb['shift']());}};_0x4611b5(++_0x3fd5cf);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49c4('0x0'));var zipdir=require(_0x49c4('0x1'));var jsonpatch=require(_0x49c4('0x2'));var rp=require(_0x49c4('0x3'));var moment=require(_0x49c4('0x4'));var BPromise=require(_0x49c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49c4('0x6'));var sox=require('sox');var csv=require(_0x49c4('0x7'));var ejs=require(_0x49c4('0x8'));var fs=require('fs');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('0x7'));var querystring=require(_0x49c4('0xd'));var Papa=require(_0x49c4('0xe'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x49c4('0xf'));var qs=require(_0x49c4('0x10'));var logger=require('../../config/logger')(_0x49c4('0x11'));var utils=require(_0x49c4('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d19bf,_0x6d1b08){_0x6d1b08=_0x6d1b08||0xcc;return function(_0x5487cd){if(_0x5487cd){return _0x1d19bf[_0x49c4('0x13')](_0x6d1b08);}return _0x1d19bf[_0x49c4('0x14')](_0x6d1b08)['end']();};}function respondWithResult(_0x1909fe,_0x280996){_0x280996=_0x280996||0xc8;return function(_0x21f15a){if(_0x21f15a){return _0x1909fe[_0x49c4('0x14')](_0x280996)[_0x49c4('0x15')](_0x21f15a);}};}function respondWithFilteredResult(_0x18211c,_0x75ea8){return function(_0x3de397){if(_0x3de397){var _0x58d177=_0x3de397[_0x49c4('0x16')],_0x3acd06=_0x75ea8[_0x49c4('0x17')],_0x141003=_0x75ea8['offset']+_0x75ea8[_0x49c4('0x18')],_0x13a2db;if(_0x141003>=_0x58d177){_0x141003=_0x58d177;_0x13a2db=0xc8;}else{_0x13a2db=0xce;}_0x18211c[_0x49c4('0x14')](_0x13a2db);return _0x18211c['set']('Content-Range',_0x3acd06+'-'+_0x141003+'/'+_0x58d177)[_0x49c4('0x15')](_0x3de397);}return null;};}function patchUpdates(_0x2f82d5){return function(_0x3addb2){try{jsonpatch['apply'](_0x3addb2,_0x2f82d5,!![]);}catch(_0x24856d){return BPromise['reject'](_0x24856d);}return _0x3addb2[_0x49c4('0x19')]();};}function saveUpdates(_0x1806c2,_0xe31fcc){return function(_0x291526){if(_0x291526){return _0x291526[_0x49c4('0x1a')](_0x1806c2)[_0x49c4('0x1b')](function(_0x280893){return _0x280893;});}return null;};}function removeEntity(_0x46e475,_0x2197d2){return function(_0x578447){if(_0x578447){return _0x578447['destroy']()['then'](function(){_0x46e475[_0x49c4('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x592bb8,_0x2263ae){return function(_0x15581b){if(!_0x15581b){_0x592bb8[_0x49c4('0x13')](0x194);}return _0x15581b;};}function handleError(_0xd335e4,_0x4811c4){_0x4811c4=_0x4811c4||0x1f4;return function(_0x5850f2){logger[_0x49c4('0x1c')](_0x5850f2[_0x49c4('0x1d')]);if(_0x5850f2['name']){delete _0x5850f2[_0x49c4('0x1e')];}_0xd335e4[_0x49c4('0x14')](_0x4811c4)[_0x49c4('0x1f')](_0x5850f2);};}exports[_0x49c4('0x20')]=function(_0x531d92,_0x543ea2){var _0x449960={},_0x53c199={},_0x3800b7={'count':0x0,'rows':[]};var _0x3852b2=db[_0x49c4('0x21')][_0x49c4('0x22')];_0x53c199['model']=_[_0x49c4('0x23')](_0x3852b2);_0x53c199[_0x49c4('0x24')]=_[_0x49c4('0x23')](_0x531d92[_0x49c4('0x24')]);_0x53c199[_0x49c4('0x25')]=_[_0x49c4('0x26')](_0x53c199[_0x49c4('0x27')],_0x53c199[_0x49c4('0x24')]);_0x449960[_0x49c4('0x28')]=_[_0x49c4('0x26')](_0x53c199[_0x49c4('0x27')],qs['fields'](_0x531d92['query']['fields']));_0x449960[_0x49c4('0x28')]=_0x449960[_0x49c4('0x28')][_0x49c4('0x29')]?_0x449960[_0x49c4('0x28')]:_0x53c199[_0x49c4('0x27')];if(!_0x531d92['query'][_0x49c4('0x2a')](_0x49c4('0x2b'))){_0x449960[_0x49c4('0x18')]=qs[_0x49c4('0x18')](_0x531d92['query']['limit']);_0x449960[_0x49c4('0x17')]=qs[_0x49c4('0x17')](_0x531d92[_0x49c4('0x24')][_0x49c4('0x17')]);}_0x449960[_0x49c4('0x2c')]=qs['sort'](_0x531d92[_0x49c4('0x24')][_0x49c4('0x2d')]);_0x449960[_0x49c4('0x2e')]=qs['filters'](_['pick'](_0x531d92[_0x49c4('0x24')],_0x53c199[_0x49c4('0x25')]));if(_0x531d92[_0x49c4('0x24')][_0x49c4('0x2f')]){_0x449960[_0x49c4('0x2e')]=_[_0x49c4('0x30')](_0x449960[_0x49c4('0x2e')],{'$or':_[_0x49c4('0x31')](_0x3852b2,function(_0x3209cd){if(_0x3209cd['type'][_0x49c4('0x32')]!=='VIRTUAL'){var _0xdda586={};_0xdda586[_0x3209cd[_0x49c4('0x33')]]={'$like':'%'+_0x531d92[_0x49c4('0x24')][_0x49c4('0x2f')]+'%'};return _0xdda586;}})});}_0x449960=_['merge']({},_0x449960,_0x531d92[_0x49c4('0x34')]);var _0x31f3ff={'where':_0x449960[_0x49c4('0x2e')]};return db['MailServerOut'][_0x49c4('0x16')](_0x31f3ff)[_0x49c4('0x1b')](function(_0x178987){_0x3800b7[_0x49c4('0x16')]=_0x178987;if(_0x531d92[_0x49c4('0x24')][_0x49c4('0x35')]){_0x449960[_0x49c4('0x36')]=[{'all':!![]}];}return db[_0x49c4('0x21')][_0x49c4('0x37')](_0x449960);})[_0x49c4('0x1b')](function(_0x1e506a){_0x3800b7['rows']=_0x1e506a;return _0x3800b7;})[_0x49c4('0x1b')](respondWithFilteredResult(_0x543ea2,_0x449960))[_0x49c4('0x38')](handleError(_0x543ea2,null));};exports[_0x49c4('0x39')]=function(_0x23aa32,_0x41ad28){var _0x29dd5d={'raw':!![],'where':{'id':_0x23aa32[_0x49c4('0x3a')]['id']}},_0x1be62d={};_0x1be62d[_0x49c4('0x27')]=_[_0x49c4('0x23')](db[_0x49c4('0x21')][_0x49c4('0x22')]);_0x1be62d[_0x49c4('0x24')]=_['keys'](_0x23aa32[_0x49c4('0x24')]);_0x1be62d['filters']=_[_0x49c4('0x26')](_0x1be62d[_0x49c4('0x27')],_0x1be62d[_0x49c4('0x24')]);_0x29dd5d[_0x49c4('0x28')]=_[_0x49c4('0x26')](_0x1be62d[_0x49c4('0x27')],qs['fields'](_0x23aa32['query'][_0x49c4('0x3b')]));_0x29dd5d[_0x49c4('0x28')]=_0x29dd5d[_0x49c4('0x28')][_0x49c4('0x29')]?_0x29dd5d['attributes']:_0x1be62d[_0x49c4('0x27')];if(_0x23aa32[_0x49c4('0x24')][_0x49c4('0x35')]){_0x29dd5d[_0x49c4('0x36')]=[{'all':!![]}];}_0x29dd5d=_[_0x49c4('0x30')]({},_0x29dd5d,_0x23aa32[_0x49c4('0x34')]);return db[_0x49c4('0x21')][_0x49c4('0x3c')](_0x29dd5d)[_0x49c4('0x1b')](handleEntityNotFound(_0x41ad28,null))['then'](respondWithResult(_0x41ad28,null))[_0x49c4('0x38')](handleError(_0x41ad28,null));};exports['create']=function(_0x33696e,_0x628423){return db[_0x49c4('0x21')][_0x49c4('0x3d')](_0x33696e[_0x49c4('0x3e')],{})['then'](respondWithResult(_0x628423,0xc9))[_0x49c4('0x38')](handleError(_0x628423,null));};exports[_0x49c4('0x1a')]=function(_0x384862,_0x254d07){if(_0x384862[_0x49c4('0x3e')]['id']){delete _0x384862[_0x49c4('0x3e')]['id'];}return db[_0x49c4('0x21')]['find']({'where':{'id':_0x384862[_0x49c4('0x3a')]['id']}})['then'](handleEntityNotFound(_0x254d07,null))[_0x49c4('0x1b')](saveUpdates(_0x384862[_0x49c4('0x3e')],null))[_0x49c4('0x1b')](respondWithResult(_0x254d07,null))[_0x49c4('0x38')](handleError(_0x254d07,null));};exports[_0x49c4('0x3f')]=function(_0x30bea5,_0x2c6be1){return db['MailServerOut'][_0x49c4('0x3c')]({'where':{'id':_0x30bea5[_0x49c4('0x3a')]['id']}})['then'](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x1b')](removeEntity(_0x2c6be1,null))[_0x49c4('0x38')](handleError(_0x2c6be1,null));};
\ No newline at end of file
+var _0x9c44=['ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','sendStatus','status','json','count','offset','limit','save','update','then','error','stack','name','send','index','MailServerOut','rawAttributes','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','key','field','options','includeAll','include','findAll','catch','show','params','fields','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv'];(function(_0x1497a5,_0x3102f8){var _0x8ec850=function(_0x246ca6){while(--_0x246ca6){_0x1497a5['push'](_0x1497a5['shift']());}};_0x8ec850(++_0x3102f8);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49c4('0x0'));var zipdir=require(_0x49c4('0x1'));var jsonpatch=require(_0x49c4('0x2'));var rp=require(_0x49c4('0x3'));var moment=require(_0x49c4('0x4'));var BPromise=require(_0x49c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49c4('0x6'));var sox=require('sox');var csv=require(_0x49c4('0x7'));var ejs=require(_0x49c4('0x8'));var fs=require('fs');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('0x7'));var querystring=require(_0x49c4('0xd'));var Papa=require(_0x49c4('0xe'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x49c4('0xf'));var qs=require(_0x49c4('0x10'));var logger=require('../../config/logger')(_0x49c4('0x11'));var utils=require(_0x49c4('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d19bf,_0x6d1b08){_0x6d1b08=_0x6d1b08||0xcc;return function(_0x5487cd){if(_0x5487cd){return _0x1d19bf[_0x49c4('0x13')](_0x6d1b08);}return _0x1d19bf[_0x49c4('0x14')](_0x6d1b08)['end']();};}function respondWithResult(_0x1909fe,_0x280996){_0x280996=_0x280996||0xc8;return function(_0x21f15a){if(_0x21f15a){return _0x1909fe[_0x49c4('0x14')](_0x280996)[_0x49c4('0x15')](_0x21f15a);}};}function respondWithFilteredResult(_0x18211c,_0x75ea8){return function(_0x3de397){if(_0x3de397){var _0x58d177=_0x3de397[_0x49c4('0x16')],_0x3acd06=_0x75ea8[_0x49c4('0x17')],_0x141003=_0x75ea8['offset']+_0x75ea8[_0x49c4('0x18')],_0x13a2db;if(_0x141003>=_0x58d177){_0x141003=_0x58d177;_0x13a2db=0xc8;}else{_0x13a2db=0xce;}_0x18211c[_0x49c4('0x14')](_0x13a2db);return _0x18211c['set']('Content-Range',_0x3acd06+'-'+_0x141003+'/'+_0x58d177)[_0x49c4('0x15')](_0x3de397);}return null;};}function patchUpdates(_0x2f82d5){return function(_0x3addb2){try{jsonpatch['apply'](_0x3addb2,_0x2f82d5,!![]);}catch(_0x24856d){return BPromise['reject'](_0x24856d);}return _0x3addb2[_0x49c4('0x19')]();};}function saveUpdates(_0x1806c2,_0xe31fcc){return function(_0x291526){if(_0x291526){return _0x291526[_0x49c4('0x1a')](_0x1806c2)[_0x49c4('0x1b')](function(_0x280893){return _0x280893;});}return null;};}function removeEntity(_0x46e475,_0x2197d2){return function(_0x578447){if(_0x578447){return _0x578447['destroy']()['then'](function(){_0x46e475[_0x49c4('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x592bb8,_0x2263ae){return function(_0x15581b){if(!_0x15581b){_0x592bb8[_0x49c4('0x13')](0x194);}return _0x15581b;};}function handleError(_0xd335e4,_0x4811c4){_0x4811c4=_0x4811c4||0x1f4;return function(_0x5850f2){logger[_0x49c4('0x1c')](_0x5850f2[_0x49c4('0x1d')]);if(_0x5850f2['name']){delete _0x5850f2[_0x49c4('0x1e')];}_0xd335e4[_0x49c4('0x14')](_0x4811c4)[_0x49c4('0x1f')](_0x5850f2);};}exports[_0x49c4('0x20')]=function(_0x531d92,_0x543ea2){var _0x449960={},_0x53c199={},_0x3800b7={'count':0x0,'rows':[]};var _0x3852b2=db[_0x49c4('0x21')][_0x49c4('0x22')];_0x53c199['model']=_[_0x49c4('0x23')](_0x3852b2);_0x53c199[_0x49c4('0x24')]=_[_0x49c4('0x23')](_0x531d92[_0x49c4('0x24')]);_0x53c199[_0x49c4('0x25')]=_[_0x49c4('0x26')](_0x53c199[_0x49c4('0x27')],_0x53c199[_0x49c4('0x24')]);_0x449960[_0x49c4('0x28')]=_[_0x49c4('0x26')](_0x53c199[_0x49c4('0x27')],qs['fields'](_0x531d92['query']['fields']));_0x449960[_0x49c4('0x28')]=_0x449960[_0x49c4('0x28')][_0x49c4('0x29')]?_0x449960[_0x49c4('0x28')]:_0x53c199[_0x49c4('0x27')];if(!_0x531d92['query'][_0x49c4('0x2a')](_0x49c4('0x2b'))){_0x449960[_0x49c4('0x18')]=qs[_0x49c4('0x18')](_0x531d92['query']['limit']);_0x449960[_0x49c4('0x17')]=qs[_0x49c4('0x17')](_0x531d92[_0x49c4('0x24')][_0x49c4('0x17')]);}_0x449960[_0x49c4('0x2c')]=qs['sort'](_0x531d92[_0x49c4('0x24')][_0x49c4('0x2d')]);_0x449960[_0x49c4('0x2e')]=qs['filters'](_['pick'](_0x531d92[_0x49c4('0x24')],_0x53c199[_0x49c4('0x25')]));if(_0x531d92[_0x49c4('0x24')][_0x49c4('0x2f')]){_0x449960[_0x49c4('0x2e')]=_[_0x49c4('0x30')](_0x449960[_0x49c4('0x2e')],{'$or':_[_0x49c4('0x31')](_0x3852b2,function(_0x3209cd){if(_0x3209cd['type'][_0x49c4('0x32')]!=='VIRTUAL'){var _0xdda586={};_0xdda586[_0x3209cd[_0x49c4('0x33')]]={'$like':'%'+_0x531d92[_0x49c4('0x24')][_0x49c4('0x2f')]+'%'};return _0xdda586;}})});}_0x449960=_['merge']({},_0x449960,_0x531d92[_0x49c4('0x34')]);var _0x31f3ff={'where':_0x449960[_0x49c4('0x2e')]};return db['MailServerOut'][_0x49c4('0x16')](_0x31f3ff)[_0x49c4('0x1b')](function(_0x178987){_0x3800b7[_0x49c4('0x16')]=_0x178987;if(_0x531d92[_0x49c4('0x24')][_0x49c4('0x35')]){_0x449960[_0x49c4('0x36')]=[{'all':!![]}];}return db[_0x49c4('0x21')][_0x49c4('0x37')](_0x449960);})[_0x49c4('0x1b')](function(_0x1e506a){_0x3800b7['rows']=_0x1e506a;return _0x3800b7;})[_0x49c4('0x1b')](respondWithFilteredResult(_0x543ea2,_0x449960))[_0x49c4('0x38')](handleError(_0x543ea2,null));};exports[_0x49c4('0x39')]=function(_0x23aa32,_0x41ad28){var _0x29dd5d={'raw':!![],'where':{'id':_0x23aa32[_0x49c4('0x3a')]['id']}},_0x1be62d={};_0x1be62d[_0x49c4('0x27')]=_[_0x49c4('0x23')](db[_0x49c4('0x21')][_0x49c4('0x22')]);_0x1be62d[_0x49c4('0x24')]=_['keys'](_0x23aa32[_0x49c4('0x24')]);_0x1be62d['filters']=_[_0x49c4('0x26')](_0x1be62d[_0x49c4('0x27')],_0x1be62d[_0x49c4('0x24')]);_0x29dd5d[_0x49c4('0x28')]=_[_0x49c4('0x26')](_0x1be62d[_0x49c4('0x27')],qs['fields'](_0x23aa32['query'][_0x49c4('0x3b')]));_0x29dd5d[_0x49c4('0x28')]=_0x29dd5d[_0x49c4('0x28')][_0x49c4('0x29')]?_0x29dd5d['attributes']:_0x1be62d[_0x49c4('0x27')];if(_0x23aa32[_0x49c4('0x24')][_0x49c4('0x35')]){_0x29dd5d[_0x49c4('0x36')]=[{'all':!![]}];}_0x29dd5d=_[_0x49c4('0x30')]({},_0x29dd5d,_0x23aa32[_0x49c4('0x34')]);return db[_0x49c4('0x21')][_0x49c4('0x3c')](_0x29dd5d)[_0x49c4('0x1b')](handleEntityNotFound(_0x41ad28,null))['then'](respondWithResult(_0x41ad28,null))[_0x49c4('0x38')](handleError(_0x41ad28,null));};exports['create']=function(_0x33696e,_0x628423){return db[_0x49c4('0x21')][_0x49c4('0x3d')](_0x33696e[_0x49c4('0x3e')],{})['then'](respondWithResult(_0x628423,0xc9))[_0x49c4('0x38')](handleError(_0x628423,null));};exports[_0x49c4('0x1a')]=function(_0x384862,_0x254d07){if(_0x384862[_0x49c4('0x3e')]['id']){delete _0x384862[_0x49c4('0x3e')]['id'];}return db[_0x49c4('0x21')]['find']({'where':{'id':_0x384862[_0x49c4('0x3a')]['id']}})['then'](handleEntityNotFound(_0x254d07,null))[_0x49c4('0x1b')](saveUpdates(_0x384862[_0x49c4('0x3e')],null))[_0x49c4('0x1b')](respondWithResult(_0x254d07,null))[_0x49c4('0x38')](handleError(_0x254d07,null));};exports[_0x49c4('0x3f')]=function(_0x30bea5,_0x2c6be1){return db['MailServerOut'][_0x49c4('0x3c')]({'where':{'id':_0x30bea5[_0x49c4('0x3a')]['id']}})['then'](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x1b')](removeEntity(_0x2c6be1,null))[_0x49c4('0x38')](handleError(_0x2c6be1,null));};
\ No newline at end of file
index f8a0d68..495e858 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3831=['bluebird','request-promise','exports','lodash','../../config/logger','api','moment'];(function(_0x451104,_0x44850b){var _0x1ce890=function(_0x366691){while(--_0x366691){_0x451104['push'](_0x451104['shift']());}};_0x1ce890(++_0x44850b);}(_0x3831,0x14c));var _0x1383=function(_0x437e08,_0x1cab6c){_0x437e08=_0x437e08-0x0;var _0xcf57f2=_0x3831[_0x437e08];return _0xcf57f2;};'use strict';var _=require(_0x1383('0x0'));var util=require('util');var logger=require(_0x1383('0x1'))(_0x1383('0x2'));var moment=require(_0x1383('0x3'));var BPromise=require(_0x1383('0x4'));var rp=require(_0x1383('0x5'));var attributes=require('./mailServerOut.attributes');module[_0x1383('0x6')]=function(_0x573874,_0x21ea2c){return _0x573874['define']('MailServerOut',attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x07e8=['../../config/logger','moment','request-promise','define','mail_servers_out','lodash','util'];(function(_0x581714,_0x19b53c){var _0x3b9dad=function(_0x3b88d5){while(--_0x3b88d5){_0x581714['push'](_0x581714['shift']());}};_0x3b9dad(++_0x19b53c);}(_0x07e8,0x10f));var _0x807e=function(_0x304954,_0x319bf8){_0x304954=_0x304954-0x0;var _0x3afe3a=_0x07e8[_0x304954];return _0x3afe3a;};'use strict';var _=require(_0x807e('0x0'));var util=require(_0x807e('0x1'));var logger=require(_0x807e('0x2'))('api');var moment=require(_0x807e('0x3'));var BPromise=require('bluebird');var rp=require(_0x807e('0x4'));var attributes=require('./mailServerOut.attributes');module['exports']=function(_0x2c423b,_0x2dddb4){return _0x2c423b[_0x807e('0x5')]('MailServerOut',attributes,{'tableName':_0x807e('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 55641ff..8f95b3e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x83a0=['client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1cf95c,_0x4bd6f6){var _0x5245b6=function(_0xab1d9c){while(--_0xab1d9c){_0x1cf95c['push'](_0x1cf95c['shift']());}};_0x5245b6(++_0x4bd6f6);}(_0x83a0,0xc5));var _0x083a=function(_0x44766f,_0x2d31ae){_0x44766f=_0x44766f-0x0;var _0x227d88=_0x83a0[_0x44766f];return _0x227d88;};'use strict';var _=require(_0x083a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x083a('0x1'));var rs=require(_0x083a('0x2'));var fs=require('fs');var Redis=require(_0x083a('0x3'));var db=require(_0x083a('0x4'))['db'];var utils=require(_0x083a('0x5'));var logger=require(_0x083a('0x6'))(_0x083a('0x7'));var config=require(_0x083a('0x8'));var jayson=require(_0x083a('0x9'));var client=jayson[_0x083a('0xa')][_0x083a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc09dc3,_0x57214d,_0xc3777){return new BPromise(function(_0x4f5a09,_0xabda14){return client[_0x083a('0xc')](_0xc09dc3,_0xc3777)[_0x083a('0xd')](function(_0x584fe4){logger[_0x083a('0xe')](_0x083a('0xf'),_0x57214d,_0x083a('0x10'));logger[_0x083a('0x11')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x57214d,_0x083a('0x10'),JSON[_0x083a('0x12')](_0x584fe4));if(_0x584fe4[_0x083a('0x13')]){if(_0x584fe4['error'][_0x083a('0x14')]===0x1f4){logger[_0x083a('0x13')]('MailServerOut,\x20%s,\x20%s',_0x57214d,_0x584fe4['error'][_0x083a('0x15')]);return _0xabda14(_0x584fe4['error'][_0x083a('0x15')]);}logger[_0x083a('0x13')]('MailServerOut,\x20%s,\x20%s',_0x57214d,_0x584fe4[_0x083a('0x13')][_0x083a('0x15')]);return _0x4f5a09(_0x584fe4[_0x083a('0x13')]['message']);}else{logger[_0x083a('0xe')](_0x083a('0xf'),_0x57214d,_0x083a('0x10'));_0x4f5a09(_0x584fe4[_0x083a('0x16')][_0x083a('0x15')]);}})['catch'](function(_0x33167d){logger[_0x083a('0x13')](_0x083a('0xf'),_0x57214d,_0x33167d);_0xabda14(_0x33167d);});});}
\ No newline at end of file
+var _0x124d=['error','message','result','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify','code'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0x124d,0x146));var _0xd124=function(_0x3bc1e4,_0x2f8669){_0x3bc1e4=_0x3bc1e4-0x0;var _0x55aeac=_0x124d[_0x3bc1e4];return _0x55aeac;};'use strict';var _=require(_0xd124('0x0'));var util=require('util');var moment=require(_0xd124('0x1'));var BPromise=require('bluebird');var rs=require(_0xd124('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd124('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd124('0x4'))(_0xd124('0x5'));var config=require(_0xd124('0x6'));var jayson=require(_0xd124('0x7'));var client=jayson['client'][_0xd124('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10e008,_0x17d9ed,_0x4ee756){return new BPromise(function(_0x480f03,_0x158516){return client[_0xd124('0x9')](_0x10e008,_0x4ee756)[_0xd124('0xa')](function(_0x1bafe3){logger[_0xd124('0xb')](_0xd124('0xc'),_0x17d9ed,_0xd124('0xd'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0x17d9ed,_0xd124('0xd'),JSON[_0xd124('0xe')](_0x1bafe3));if(_0x1bafe3['error']){if(_0x1bafe3['error'][_0xd124('0xf')]===0x1f4){logger[_0xd124('0x10')]('MailServerOut,\x20%s,\x20%s',_0x17d9ed,_0x1bafe3[_0xd124('0x10')][_0xd124('0x11')]);return _0x158516(_0x1bafe3[_0xd124('0x10')][_0xd124('0x11')]);}logger[_0xd124('0x10')](_0xd124('0xc'),_0x17d9ed,_0x1bafe3[_0xd124('0x10')]['message']);return _0x480f03(_0x1bafe3[_0xd124('0x10')][_0xd124('0x11')]);}else{logger[_0xd124('0xb')]('MailServerOut,\x20%s,\x20%s',_0x17d9ed,_0xd124('0xd'));_0x480f03(_0x1bafe3[_0xd124('0x12')][_0xd124('0x11')]);}})['catch'](function(_0x3776fc){logger[_0xd124('0x10')]('MailServerOut,\x20%s,\x20%s',_0x17d9ed,_0x3776fc);_0x158516(_0x3776fc);});});}
\ No newline at end of file
index 96ba818..8cf2666 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x752d=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer'];(function(_0x7a0cc7,_0x1ae700){var _0x37408c=function(_0x192de3){while(--_0x192de3){_0x7a0cc7['push'](_0x7a0cc7['shift']());}};_0x37408c(++_0x1ae700);}(_0x752d,0xaf));var _0xd752=function(_0x565094,_0x475a80){_0x565094=_0x565094-0x0;var _0x1e35c6=_0x752d[_0x565094];return _0x1e35c6;};'use strict';var multer=require(_0xd752('0x0'));var util=require(_0xd752('0x1'));var path=require(_0xd752('0x2'));var timeout=require(_0xd752('0x3'));var express=require(_0xd752('0x4'));var router=express[_0xd752('0x5')]();var auth=require(_0xd752('0x6'));var interaction=require(_0xd752('0x7'));var config=require(_0xd752('0x8'));var controller=require(_0xd752('0x9'));router[_0xd752('0xa')]('/',auth[_0xd752('0xb')](),controller['index']);router[_0xd752('0xa')](_0xd752('0xc'),auth[_0xd752('0xb')](),controller[_0xd752('0xd')]);router[_0xd752('0xa')](_0xd752('0xe'),auth['isAuthenticated'](),controller[_0xd752('0xf')]);router[_0xd752('0x10')]('/',auth[_0xd752('0xb')](),controller[_0xd752('0x11')]);router[_0xd752('0x12')](_0xd752('0xe'),auth[_0xd752('0xb')](),controller['update']);router[_0xd752('0x13')](_0xd752('0xe'),auth[_0xd752('0xb')](),controller[_0xd752('0x14')]);module[_0xd752('0x15')]=router;
\ No newline at end of file
+var _0x74f5=['create','put','delete','destroy','path','express','Router','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x1c5cdd,_0x114f5c){var _0x41438d=function(_0x501f31){while(--_0x501f31){_0x1c5cdd['push'](_0x1c5cdd['shift']());}};_0x41438d(++_0x114f5c);}(_0x74f5,0x16c));var _0x574f=function(_0x1529a3,_0x529f63){_0x1529a3=_0x1529a3-0x0;var _0x1a0d4b=_0x74f5[_0x1529a3];return _0x1a0d4b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x574f('0x0'));var timeout=require('connect-timeout');var express=require(_0x574f('0x1'));var router=express[_0x574f('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x574f('0x3'));var config=require(_0x574f('0x4'));var controller=require(_0x574f('0x5'));router[_0x574f('0x6')]('/',auth[_0x574f('0x7')](),controller[_0x574f('0x8')]);router[_0x574f('0x6')](_0x574f('0x9'),auth['isAuthenticated'](),controller[_0x574f('0xa')]);router[_0x574f('0x6')](_0x574f('0xb'),auth[_0x574f('0x7')](),controller[_0x574f('0xc')]);router[_0x574f('0xd')]('/',auth[_0x574f('0x7')](),controller[_0x574f('0xe')]);router[_0x574f('0xf')](_0x574f('0xb'),auth[_0x574f('0x7')](),controller['update']);router[_0x574f('0x10')](_0x574f('0xb'),auth[_0x574f('0x7')](),controller[_0x574f('0x11')]);module['exports']=router;
\ No newline at end of file
index 3911cd8..8f4cbe9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x42f4=['STRING','name','sequelize'];(function(_0x2ba9ac,_0xa1fdc4){var _0x1b0fc9=function(_0x4343de){while(--_0x4343de){_0x2ba9ac['push'](_0x2ba9ac['shift']());}};_0x1b0fc9(++_0xa1fdc4);}(_0x42f4,0x19d));var _0x442f=function(_0x35a274,_0x98b399){_0x35a274=_0x35a274-0x0;var _0x40d905=_0x42f4[_0x35a274];return _0x40d905;};'use strict';var Sequelize=require(_0x442f('0x0'));module['exports']={'name':{'type':Sequelize[_0x442f('0x1')],'unique':_0x442f('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x442f('0x1')]}};
\ No newline at end of file
+var _0xc686=['STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc686,0x148));var _0x6c68=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xc686[_0x56482c];return _0x5aae7a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6c68('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6c68('0x0')]}};
\ No newline at end of file
index 349d2cc..a5f4ba2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8d0a=['desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','MailSubstatus','rawAttributes','keys','query','model','attributes','intersection','fields','length','nolimit','sort','where','filters','pick','filter','map','type','key','VIRTUAL','field','merge','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x5a4d4c,_0x2bef70){var _0x561128=function(_0x52a32c){while(--_0x52a32c){_0x5a4d4c['push'](_0x5a4d4c['shift']());}};_0x561128(++_0x2bef70);}(_0x8d0a,0x172));var _0xa8d0=function(_0x255d98,_0x1315c1){_0x255d98=_0x255d98-0x0;var _0x40ec9f=_0x8d0a[_0x255d98];return _0x40ec9f;};'use strict';var pdf=require(_0xa8d0('0x0'));var emlformat=require(_0xa8d0('0x1'));var rimraf=require(_0xa8d0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa8d0('0x3'));var rp=require(_0xa8d0('0x4'));var moment=require('moment');var BPromise=require(_0xa8d0('0x5'));var Mustache=require(_0xa8d0('0x6'));var util=require(_0xa8d0('0x7'));var path=require('path');var sox=require(_0xa8d0('0x8'));var csv=require(_0xa8d0('0x9'));var ejs=require(_0xa8d0('0xa'));var fs=require('fs');var _=require(_0xa8d0('0xb'));var squel=require(_0xa8d0('0xc'));var crypto=require(_0xa8d0('0xd'));var jsforce=require(_0xa8d0('0xe'));var deskjs=require(_0xa8d0('0xf'));var toCsv=require(_0xa8d0('0x9'));var querystring=require(_0xa8d0('0x10'));var Papa=require(_0xa8d0('0x11'));var authService=require(_0xa8d0('0x12'));var hardwareService=require(_0xa8d0('0x13'));var Redis=require(_0xa8d0('0x14'));var qs=require(_0xa8d0('0x15'));var logger=require(_0xa8d0('0x16'))(_0xa8d0('0x17'));var utils=require(_0xa8d0('0x18'));var config=require(_0xa8d0('0x19'));var db=require(_0xa8d0('0x1a'))['db'];function respondWithStatusCode(_0x4d7543,_0x5caa24){_0x5caa24=_0x5caa24||0xcc;return function(_0x318fb1){if(_0x318fb1){return _0x4d7543[_0xa8d0('0x1b')](_0x5caa24);}return _0x4d7543['status'](_0x5caa24)['end']();};}function respondWithResult(_0x16093f,_0x2af6fc){_0x2af6fc=_0x2af6fc||0xc8;return function(_0x3ecc36){if(_0x3ecc36){return _0x16093f[_0xa8d0('0x1c')](_0x2af6fc)[_0xa8d0('0x1d')](_0x3ecc36);}};}function respondWithFilteredResult(_0x18f935,_0x192b0a){return function(_0x1daf70){if(_0x1daf70){var _0x2871cb=_0x1daf70[_0xa8d0('0x1e')],_0x238e85=_0x192b0a[_0xa8d0('0x1f')],_0xfa19ee=_0x192b0a['offset']+_0x192b0a[_0xa8d0('0x20')],_0x575f69;if(_0xfa19ee>=_0x2871cb){_0xfa19ee=_0x2871cb;_0x575f69=0xc8;}else{_0x575f69=0xce;}_0x18f935[_0xa8d0('0x1c')](_0x575f69);return _0x18f935[_0xa8d0('0x21')](_0xa8d0('0x22'),_0x238e85+'-'+_0xfa19ee+'/'+_0x2871cb)[_0xa8d0('0x1d')](_0x1daf70);}return null;};}function patchUpdates(_0x48e8c5){return function(_0x35554e){try{jsonpatch[_0xa8d0('0x23')](_0x35554e,_0x48e8c5,!![]);}catch(_0x213de2){return BPromise[_0xa8d0('0x24')](_0x213de2);}return _0x35554e[_0xa8d0('0x25')]();};}function saveUpdates(_0x16e479,_0x21a6ca){return function(_0x595452){if(_0x595452){return _0x595452[_0xa8d0('0x26')](_0x16e479)[_0xa8d0('0x27')](function(_0x3c8843){return _0x3c8843;});}return null;};}function removeEntity(_0x3ceb45,_0x4b003f){return function(_0x31cf4f){if(_0x31cf4f){return _0x31cf4f[_0xa8d0('0x28')]()[_0xa8d0('0x27')](function(){_0x3ceb45[_0xa8d0('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x150080,_0x30a566){return function(_0x20ae2c){if(!_0x20ae2c){_0x150080[_0xa8d0('0x1b')](0x194);}return _0x20ae2c;};}function handleError(_0x55e6e0,_0x35b4a6){_0x35b4a6=_0x35b4a6||0x1f4;return function(_0x3e5d26){logger[_0xa8d0('0x29')](_0x3e5d26['stack']);if(_0x3e5d26[_0xa8d0('0x2a')]){delete _0x3e5d26['name'];}_0x55e6e0[_0xa8d0('0x1c')](_0x35b4a6)[_0xa8d0('0x2b')](_0x3e5d26);};}exports['index']=function(_0x5d7292,_0x216045){var _0x5d9a04={},_0x312a29={},_0x327673={'count':0x0,'rows':[]};var _0x3cc8fd=db[_0xa8d0('0x2c')][_0xa8d0('0x2d')];_0x312a29['model']=_[_0xa8d0('0x2e')](_0x3cc8fd);_0x312a29[_0xa8d0('0x2f')]=_[_0xa8d0('0x2e')](_0x5d7292['query']);_0x312a29['filters']=_['intersection'](_0x312a29[_0xa8d0('0x30')],_0x312a29[_0xa8d0('0x2f')]);_0x5d9a04[_0xa8d0('0x31')]=_[_0xa8d0('0x32')](_0x312a29[_0xa8d0('0x30')],qs[_0xa8d0('0x33')](_0x5d7292[_0xa8d0('0x2f')]['fields']));_0x5d9a04[_0xa8d0('0x31')]=_0x5d9a04['attributes'][_0xa8d0('0x34')]?_0x5d9a04['attributes']:_0x312a29['model'];if(!_0x5d7292['query']['hasOwnProperty'](_0xa8d0('0x35'))){_0x5d9a04[_0xa8d0('0x20')]=qs['limit'](_0x5d7292['query'][_0xa8d0('0x20')]);_0x5d9a04[_0xa8d0('0x1f')]=qs[_0xa8d0('0x1f')](_0x5d7292[_0xa8d0('0x2f')][_0xa8d0('0x1f')]);}_0x5d9a04['order']=qs['sort'](_0x5d7292[_0xa8d0('0x2f')][_0xa8d0('0x36')]);_0x5d9a04[_0xa8d0('0x37')]=qs[_0xa8d0('0x38')](_[_0xa8d0('0x39')](_0x5d7292[_0xa8d0('0x2f')],_0x312a29['filters']));if(_0x5d7292[_0xa8d0('0x2f')][_0xa8d0('0x3a')]){_0x5d9a04[_0xa8d0('0x37')]=_['merge'](_0x5d9a04[_0xa8d0('0x37')],{'$or':_[_0xa8d0('0x3b')](_0x3cc8fd,function(_0x285f08){if(_0x285f08[_0xa8d0('0x3c')][_0xa8d0('0x3d')]!==_0xa8d0('0x3e')){var _0x133d39={};_0x133d39[_0x285f08[_0xa8d0('0x3f')]]={'$like':'%'+_0x5d7292[_0xa8d0('0x2f')][_0xa8d0('0x3a')]+'%'};return _0x133d39;}})});}_0x5d9a04=_[_0xa8d0('0x40')]({},_0x5d9a04,_0x5d7292['options']);var _0x232515={'where':_0x5d9a04['where']};return db[_0xa8d0('0x2c')][_0xa8d0('0x1e')](_0x232515)[_0xa8d0('0x27')](function(_0x584f75){_0x327673[_0xa8d0('0x1e')]=_0x584f75;if(_0x5d7292[_0xa8d0('0x2f')][_0xa8d0('0x41')]){_0x5d9a04['include']=[{'all':!![]}];}return db[_0xa8d0('0x2c')][_0xa8d0('0x42')](_0x5d9a04);})[_0xa8d0('0x27')](function(_0x3c3080){_0x327673[_0xa8d0('0x43')]=_0x3c3080;return _0x327673;})[_0xa8d0('0x27')](respondWithFilteredResult(_0x216045,_0x5d9a04))[_0xa8d0('0x44')](handleError(_0x216045,null));};exports[_0xa8d0('0x45')]=function(_0x2e2778,_0x48399a){var _0x21371d={'raw':!![],'where':{'id':_0x2e2778[_0xa8d0('0x46')]['id']}},_0x1193f6={};_0x1193f6[_0xa8d0('0x30')]=_[_0xa8d0('0x2e')](db[_0xa8d0('0x2c')][_0xa8d0('0x2d')]);_0x1193f6[_0xa8d0('0x2f')]=_[_0xa8d0('0x2e')](_0x2e2778['query']);_0x1193f6[_0xa8d0('0x38')]=_['intersection'](_0x1193f6[_0xa8d0('0x30')],_0x1193f6[_0xa8d0('0x2f')]);_0x21371d['attributes']=_[_0xa8d0('0x32')](_0x1193f6['model'],qs[_0xa8d0('0x33')](_0x2e2778[_0xa8d0('0x2f')][_0xa8d0('0x33')]));_0x21371d['attributes']=_0x21371d['attributes'][_0xa8d0('0x34')]?_0x21371d[_0xa8d0('0x31')]:_0x1193f6[_0xa8d0('0x30')];if(_0x2e2778[_0xa8d0('0x2f')][_0xa8d0('0x41')]){_0x21371d[_0xa8d0('0x47')]=[{'all':!![]}];}_0x21371d=_[_0xa8d0('0x40')]({},_0x21371d,_0x2e2778[_0xa8d0('0x48')]);return db['MailSubstatus'][_0xa8d0('0x49')](_0x21371d)['then'](handleEntityNotFound(_0x48399a,null))[_0xa8d0('0x27')](respondWithResult(_0x48399a,null))['catch'](handleError(_0x48399a,null));};exports[_0xa8d0('0x4a')]=function(_0x44df67,_0x3b48f2){return db['MailSubstatus'][_0xa8d0('0x4a')](_0x44df67[_0xa8d0('0x4b')],{})[_0xa8d0('0x27')](respondWithResult(_0x3b48f2,0xc9))[_0xa8d0('0x44')](handleError(_0x3b48f2,null));};exports[_0xa8d0('0x26')]=function(_0x38abbf,_0x2b0f77){if(_0x38abbf[_0xa8d0('0x4b')]['id']){delete _0x38abbf[_0xa8d0('0x4b')]['id'];}return db[_0xa8d0('0x2c')][_0xa8d0('0x49')]({'where':{'id':_0x38abbf[_0xa8d0('0x46')]['id']}})[_0xa8d0('0x27')](handleEntityNotFound(_0x2b0f77,null))[_0xa8d0('0x27')](saveUpdates(_0x38abbf[_0xa8d0('0x4b')],null))['then'](respondWithResult(_0x2b0f77,null))['catch'](handleError(_0x2b0f77,null));};exports[_0xa8d0('0x28')]=function(_0x15f801,_0x3ddebe){return db[_0xa8d0('0x2c')][_0xa8d0('0x49')]({'where':{'id':_0x15f801[_0xa8d0('0x46')]['id']}})[_0xa8d0('0x27')](handleEntityNotFound(_0x3ddebe,null))[_0xa8d0('0x27')](removeEntity(_0x3ddebe,null))[_0xa8d0('0x44')](handleError(_0x3ddebe,null));};exports[_0xa8d0('0x4c')]=function(_0x2c4ef4,_0x2e9112){return db[_0xa8d0('0x2c')]['describe']()[_0xa8d0('0x27')](respondWithResult(_0x2e9112,null))[_0xa8d0('0x44')](handleError(_0x2e9112,null));};
\ No newline at end of file
+var _0x6c65=['end','count','offset','Content-Range','json','apply','reject','update','then','destroy','error','stack','send','MailSubstatus','rawAttributes','model','keys','query','filters','intersection','fields','attributes','nolimit','limit','order','sort','pick','filter','where','map','type','key','VIRTUAL','merge','options','includeAll','include','rows','show','params','length','catch','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status'];(function(_0x41cb4b,_0x200468){var _0x1719c1=function(_0x53ad61){while(--_0x53ad61){_0x41cb4b['push'](_0x41cb4b['shift']());}};_0x1719c1(++_0x200468);}(_0x6c65,0x78));var _0x56c6=function(_0x49d940,_0x516f31){_0x49d940=_0x49d940-0x0;var _0x3201be=_0x6c65[_0x49d940];return _0x3201be;};'use strict';var pdf=require(_0x56c6('0x0'));var emlformat=require(_0x56c6('0x1'));var rimraf=require(_0x56c6('0x2'));var zipdir=require(_0x56c6('0x3'));var jsonpatch=require(_0x56c6('0x4'));var rp=require(_0x56c6('0x5'));var moment=require('moment');var BPromise=require(_0x56c6('0x6'));var Mustache=require(_0x56c6('0x7'));var util=require(_0x56c6('0x8'));var path=require(_0x56c6('0x9'));var sox=require(_0x56c6('0xa'));var csv=require('to-csv');var ejs=require(_0x56c6('0xb'));var fs=require('fs');var _=require(_0x56c6('0xc'));var squel=require(_0x56c6('0xd'));var crypto=require(_0x56c6('0xe'));var jsforce=require(_0x56c6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x56c6('0x10'));var querystring=require(_0x56c6('0x11'));var Papa=require(_0x56c6('0x12'));var authService=require('../../components/auth/service');var hardwareService=require(_0x56c6('0x13'));var Redis=require(_0x56c6('0x14'));var qs=require(_0x56c6('0x15'));var logger=require(_0x56c6('0x16'))(_0x56c6('0x17'));var utils=require(_0x56c6('0x18'));var config=require('../../config/environment');var db=require(_0x56c6('0x19'))['db'];function respondWithStatusCode(_0x5d9a9d,_0x5e412f){_0x5e412f=_0x5e412f||0xcc;return function(_0x1d7c67){if(_0x1d7c67){return _0x5d9a9d[_0x56c6('0x1a')](_0x5e412f);}return _0x5d9a9d[_0x56c6('0x1b')](_0x5e412f)[_0x56c6('0x1c')]();};}function respondWithResult(_0x54ac65,_0x29fff0){_0x29fff0=_0x29fff0||0xc8;return function(_0x511316){if(_0x511316){return _0x54ac65[_0x56c6('0x1b')](_0x29fff0)['json'](_0x511316);}};}function respondWithFilteredResult(_0x277e4f,_0x596c86){return function(_0x557189){if(_0x557189){var _0x4b47ce=_0x557189[_0x56c6('0x1d')],_0x4d0838=_0x596c86['offset'],_0x3e6082=_0x596c86[_0x56c6('0x1e')]+_0x596c86['limit'],_0x56d5fb;if(_0x3e6082>=_0x4b47ce){_0x3e6082=_0x4b47ce;_0x56d5fb=0xc8;}else{_0x56d5fb=0xce;}_0x277e4f[_0x56c6('0x1b')](_0x56d5fb);return _0x277e4f['set'](_0x56c6('0x1f'),_0x4d0838+'-'+_0x3e6082+'/'+_0x4b47ce)[_0x56c6('0x20')](_0x557189);}return null;};}function patchUpdates(_0x4a6b95){return function(_0x219dca){try{jsonpatch[_0x56c6('0x21')](_0x219dca,_0x4a6b95,!![]);}catch(_0x27b5b0){return BPromise[_0x56c6('0x22')](_0x27b5b0);}return _0x219dca['save']();};}function saveUpdates(_0x4ed561,_0x46de48){return function(_0x413ca7){if(_0x413ca7){return _0x413ca7[_0x56c6('0x23')](_0x4ed561)[_0x56c6('0x24')](function(_0x58bc6f){return _0x58bc6f;});}return null;};}function removeEntity(_0x1cd575,_0x1bc637){return function(_0x55271c){if(_0x55271c){return _0x55271c[_0x56c6('0x25')]()['then'](function(){_0x1cd575['status'](0xcc)[_0x56c6('0x1c')]();});}};}function handleEntityNotFound(_0x1f1bb1,_0x17dd94){return function(_0x5c6682){if(!_0x5c6682){_0x1f1bb1[_0x56c6('0x1a')](0x194);}return _0x5c6682;};}function handleError(_0x12af1d,_0x44664f){_0x44664f=_0x44664f||0x1f4;return function(_0x235c7a){logger[_0x56c6('0x26')](_0x235c7a[_0x56c6('0x27')]);if(_0x235c7a['name']){delete _0x235c7a['name'];}_0x12af1d[_0x56c6('0x1b')](_0x44664f)[_0x56c6('0x28')](_0x235c7a);};}exports['index']=function(_0x33f95e,_0x53766a){var _0x2e6b1a={},_0x52e761={},_0x7ef8d9={'count':0x0,'rows':[]};var _0x5827e7=db[_0x56c6('0x29')][_0x56c6('0x2a')];_0x52e761[_0x56c6('0x2b')]=_[_0x56c6('0x2c')](_0x5827e7);_0x52e761[_0x56c6('0x2d')]=_[_0x56c6('0x2c')](_0x33f95e[_0x56c6('0x2d')]);_0x52e761[_0x56c6('0x2e')]=_[_0x56c6('0x2f')](_0x52e761[_0x56c6('0x2b')],_0x52e761[_0x56c6('0x2d')]);_0x2e6b1a['attributes']=_[_0x56c6('0x2f')](_0x52e761[_0x56c6('0x2b')],qs['fields'](_0x33f95e['query'][_0x56c6('0x30')]));_0x2e6b1a['attributes']=_0x2e6b1a[_0x56c6('0x31')]['length']?_0x2e6b1a[_0x56c6('0x31')]:_0x52e761[_0x56c6('0x2b')];if(!_0x33f95e[_0x56c6('0x2d')]['hasOwnProperty'](_0x56c6('0x32'))){_0x2e6b1a[_0x56c6('0x33')]=qs[_0x56c6('0x33')](_0x33f95e[_0x56c6('0x2d')][_0x56c6('0x33')]);_0x2e6b1a[_0x56c6('0x1e')]=qs[_0x56c6('0x1e')](_0x33f95e[_0x56c6('0x2d')][_0x56c6('0x1e')]);}_0x2e6b1a[_0x56c6('0x34')]=qs['sort'](_0x33f95e[_0x56c6('0x2d')][_0x56c6('0x35')]);_0x2e6b1a['where']=qs[_0x56c6('0x2e')](_[_0x56c6('0x36')](_0x33f95e[_0x56c6('0x2d')],_0x52e761[_0x56c6('0x2e')]));if(_0x33f95e[_0x56c6('0x2d')][_0x56c6('0x37')]){_0x2e6b1a[_0x56c6('0x38')]=_['merge'](_0x2e6b1a[_0x56c6('0x38')],{'$or':_[_0x56c6('0x39')](_0x5827e7,function(_0x3d6807){if(_0x3d6807[_0x56c6('0x3a')][_0x56c6('0x3b')]!==_0x56c6('0x3c')){var _0x35059c={};_0x35059c[_0x3d6807['field']]={'$like':'%'+_0x33f95e['query'][_0x56c6('0x37')]+'%'};return _0x35059c;}})});}_0x2e6b1a=_[_0x56c6('0x3d')]({},_0x2e6b1a,_0x33f95e[_0x56c6('0x3e')]);var _0x36fff9={'where':_0x2e6b1a[_0x56c6('0x38')]};return db[_0x56c6('0x29')][_0x56c6('0x1d')](_0x36fff9)[_0x56c6('0x24')](function(_0x433723){_0x7ef8d9[_0x56c6('0x1d')]=_0x433723;if(_0x33f95e['query'][_0x56c6('0x3f')]){_0x2e6b1a[_0x56c6('0x40')]=[{'all':!![]}];}return db[_0x56c6('0x29')]['findAll'](_0x2e6b1a);})[_0x56c6('0x24')](function(_0x74516a){_0x7ef8d9[_0x56c6('0x41')]=_0x74516a;return _0x7ef8d9;})['then'](respondWithFilteredResult(_0x53766a,_0x2e6b1a))['catch'](handleError(_0x53766a,null));};exports[_0x56c6('0x42')]=function(_0x2dea5d,_0x42e601){var _0x1aea30={'raw':!![],'where':{'id':_0x2dea5d[_0x56c6('0x43')]['id']}},_0xf5fc4d={};_0xf5fc4d[_0x56c6('0x2b')]=_[_0x56c6('0x2c')](db[_0x56c6('0x29')][_0x56c6('0x2a')]);_0xf5fc4d[_0x56c6('0x2d')]=_[_0x56c6('0x2c')](_0x2dea5d[_0x56c6('0x2d')]);_0xf5fc4d['filters']=_[_0x56c6('0x2f')](_0xf5fc4d[_0x56c6('0x2b')],_0xf5fc4d[_0x56c6('0x2d')]);_0x1aea30['attributes']=_[_0x56c6('0x2f')](_0xf5fc4d[_0x56c6('0x2b')],qs[_0x56c6('0x30')](_0x2dea5d[_0x56c6('0x2d')][_0x56c6('0x30')]));_0x1aea30[_0x56c6('0x31')]=_0x1aea30[_0x56c6('0x31')][_0x56c6('0x44')]?_0x1aea30['attributes']:_0xf5fc4d[_0x56c6('0x2b')];if(_0x2dea5d['query']['includeAll']){_0x1aea30[_0x56c6('0x40')]=[{'all':!![]}];}_0x1aea30=_[_0x56c6('0x3d')]({},_0x1aea30,_0x2dea5d[_0x56c6('0x3e')]);return db[_0x56c6('0x29')]['find'](_0x1aea30)[_0x56c6('0x24')](handleEntityNotFound(_0x42e601,null))[_0x56c6('0x24')](respondWithResult(_0x42e601,null))[_0x56c6('0x45')](handleError(_0x42e601,null));};exports['create']=function(_0x2044b3,_0x36c272){return db[_0x56c6('0x29')][_0x56c6('0x46')](_0x2044b3[_0x56c6('0x47')],{})['then'](respondWithResult(_0x36c272,0xc9))[_0x56c6('0x45')](handleError(_0x36c272,null));};exports[_0x56c6('0x23')]=function(_0x3e4c8,_0x2c7a7e){if(_0x3e4c8[_0x56c6('0x47')]['id']){delete _0x3e4c8[_0x56c6('0x47')]['id'];}return db[_0x56c6('0x29')][_0x56c6('0x48')]({'where':{'id':_0x3e4c8[_0x56c6('0x43')]['id']}})[_0x56c6('0x24')](handleEntityNotFound(_0x2c7a7e,null))[_0x56c6('0x24')](saveUpdates(_0x3e4c8['body'],null))[_0x56c6('0x24')](respondWithResult(_0x2c7a7e,null))['catch'](handleError(_0x2c7a7e,null));};exports[_0x56c6('0x25')]=function(_0x58cfa5,_0x5b449f){return db[_0x56c6('0x29')][_0x56c6('0x48')]({'where':{'id':_0x58cfa5[_0x56c6('0x43')]['id']}})[_0x56c6('0x24')](handleEntityNotFound(_0x5b449f,null))[_0x56c6('0x24')](removeEntity(_0x5b449f,null))[_0x56c6('0x45')](handleError(_0x5b449f,null));};exports[_0x56c6('0x49')]=function(_0x1ad8bf,_0x1f3b81){return db[_0x56c6('0x29')]['describe']()[_0x56c6('0x24')](respondWithResult(_0x1f3b81,null))[_0x56c6('0x45')](handleError(_0x1f3b81,null));};
\ No newline at end of file
index 3855f36..1abcc02 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd856=['../../config/logger','moment','bluebird','request-promise','./mailSubstatus.attributes','exports','define','MailSubstatus','lodash','util'];(function(_0x1de755,_0x4c69e4){var _0x17b58c=function(_0x4da068){while(--_0x4da068){_0x1de755['push'](_0x1de755['shift']());}};_0x17b58c(++_0x4c69e4);}(_0xd856,0x1f2));var _0x6d85=function(_0x29c3b9,_0x4adaf7){_0x29c3b9=_0x29c3b9-0x0;var _0x637286=_0xd856[_0x29c3b9];return _0x637286;};'use strict';var _=require(_0x6d85('0x0'));var util=require(_0x6d85('0x1'));var logger=require(_0x6d85('0x2'))('api');var moment=require(_0x6d85('0x3'));var BPromise=require(_0x6d85('0x4'));var rp=require(_0x6d85('0x5'));var attributes=require(_0x6d85('0x6'));module[_0x6d85('0x7')]=function(_0x8b0087,_0x48e822){return _0x8b0087[_0x6d85('0x8')](_0x6d85('0x9'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xa226=['request-promise','exports','define','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4a2a59,_0x3a0a01){var _0x1e31d6=function(_0x1a5904){while(--_0x1a5904){_0x4a2a59['push'](_0x4a2a59['shift']());}};_0x1e31d6(++_0x3a0a01);}(_0xa226,0x19c));var _0x6a22=function(_0x508c7d,_0x417cc8){_0x508c7d=_0x508c7d-0x0;var _0x173c8f=_0xa226[_0x508c7d];return _0x173c8f;};'use strict';var _=require(_0x6a22('0x0'));var util=require(_0x6a22('0x1'));var logger=require(_0x6a22('0x2'))(_0x6a22('0x3'));var moment=require(_0x6a22('0x4'));var BPromise=require(_0x6a22('0x5'));var rp=require(_0x6a22('0x6'));var attributes=require('./mailSubstatus.attributes');module[_0x6a22('0x7')]=function(_0x48781a,_0x57a297){return _0x48781a[_0x6a22('0x8')](_0x6a22('0x9'),attributes,{'tableName':_0x6a22('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 5eee3e7..998e339 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0e85=['code','MailSubstatus,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','error'];(function(_0x27edb0,_0x41bd7b){var _0x31f134=function(_0x4a71d8){while(--_0x4a71d8){_0x27edb0['push'](_0x27edb0['shift']());}};_0x31f134(++_0x41bd7b);}(_0x0e85,0x101));var _0x50e8=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x0e85[_0x9dfc10];return _0x4f938a;};'use strict';var _=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var moment=require(_0x50e8('0x2'));var BPromise=require(_0x50e8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x50e8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x50e8('0x5'))(_0x50e8('0x6'));var config=require('../../config/environment');var jayson=require(_0x50e8('0x7'));var client=jayson[_0x50e8('0x8')][_0x50e8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19df22,_0x2c3a9d,_0xfbc398){return new BPromise(function(_0x476daf,_0x3efb11){return client['request'](_0x19df22,_0xfbc398)['then'](function(_0x160537){logger[_0x50e8('0xa')]('MailSubstatus,\x20%s,\x20%s',_0x2c3a9d,_0x50e8('0xb'));logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x2c3a9d,_0x50e8('0xb'),JSON['stringify'](_0x160537));if(_0x160537[_0x50e8('0xc')]){if(_0x160537[_0x50e8('0xc')][_0x50e8('0xd')]===0x1f4){logger['error'](_0x50e8('0xe'),_0x2c3a9d,_0x160537[_0x50e8('0xc')][_0x50e8('0xf')]);return _0x3efb11(_0x160537['error'][_0x50e8('0xf')]);}logger['error'](_0x50e8('0xe'),_0x2c3a9d,_0x160537[_0x50e8('0xc')][_0x50e8('0xf')]);return _0x476daf(_0x160537[_0x50e8('0xc')][_0x50e8('0xf')]);}else{logger[_0x50e8('0xa')](_0x50e8('0xe'),_0x2c3a9d,_0x50e8('0xb'));_0x476daf(_0x160537[_0x50e8('0x10')][_0x50e8('0xf')]);}})[_0x50e8('0x11')](function(_0x364f63){logger['error'](_0x50e8('0xe'),_0x2c3a9d,_0x364f63);_0x3efb11(_0x364f63);});});}
\ No newline at end of file
+var _0xfdd3=['MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfdd3,0xdc));var _0x3fdd=function(_0x4e139e,_0x44a8ae){_0x4e139e=_0x4e139e-0x0;var _0x2986fb=_0xfdd3[_0x4e139e];return _0x2986fb;};'use strict';var _=require(_0x3fdd('0x0'));var util=require(_0x3fdd('0x1'));var moment=require(_0x3fdd('0x2'));var BPromise=require(_0x3fdd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3fdd('0x4'));var db=require(_0x3fdd('0x5'))['db'];var utils=require(_0x3fdd('0x6'));var logger=require(_0x3fdd('0x7'))('rpc');var config=require(_0x3fdd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3fdd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55ea47,_0x543e55,_0x27fd14){return new BPromise(function(_0xb00ccd,_0x421ec6){return client['request'](_0x55ea47,_0x27fd14)['then'](function(_0x3c85dd){logger[_0x3fdd('0xa')](_0x3fdd('0xb'),_0x543e55,'request\x20sent');logger[_0x3fdd('0xc')](_0x3fdd('0xd'),_0x543e55,_0x3fdd('0xe'),JSON[_0x3fdd('0xf')](_0x3c85dd));if(_0x3c85dd['error']){if(_0x3c85dd[_0x3fdd('0x10')][_0x3fdd('0x11')]===0x1f4){logger[_0x3fdd('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x543e55,_0x3c85dd[_0x3fdd('0x10')]['message']);return _0x421ec6(_0x3c85dd[_0x3fdd('0x10')][_0x3fdd('0x12')]);}logger[_0x3fdd('0x10')](_0x3fdd('0xb'),_0x543e55,_0x3c85dd['error'][_0x3fdd('0x12')]);return _0xb00ccd(_0x3c85dd[_0x3fdd('0x10')][_0x3fdd('0x12')]);}else{logger['info'](_0x3fdd('0xb'),_0x543e55,'request\x20sent');_0xb00ccd(_0x3c85dd[_0x3fdd('0x13')][_0x3fdd('0x12')]);}})[_0x3fdd('0x14')](function(_0x455c9b){logger['error'](_0x3fdd('0xb'),_0x543e55,_0x455c9b);_0x421ec6(_0x455c9b);});});}
\ No newline at end of file
index 15ed231..8c8b494 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1883=['put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create'];(function(_0x28d164,_0x275c50){var _0x30a0e9=function(_0x45bc65){while(--_0x45bc65){_0x28d164['push'](_0x28d164['shift']());}};_0x30a0e9(++_0x275c50);}(_0x1883,0xab));var _0x3188=function(_0x31d03a,_0x473d2c){_0x31d03a=_0x31d03a-0x0;var _0x355f25=_0x1883[_0x31d03a];return _0x355f25;};'use strict';var multer=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var path=require(_0x3188('0x2'));var timeout=require(_0x3188('0x3'));var express=require(_0x3188('0x4'));var router=express[_0x3188('0x5')]();var auth=require(_0x3188('0x6'));var interaction=require(_0x3188('0x7'));var config=require(_0x3188('0x8'));var controller=require(_0x3188('0x9'));router[_0x3188('0xa')]('/',auth[_0x3188('0xb')](),controller[_0x3188('0xc')]);router[_0x3188('0xa')](_0x3188('0xd'),auth[_0x3188('0xb')](),controller[_0x3188('0xe')]);router['get'](_0x3188('0xf'),auth[_0x3188('0xb')](),controller['show']);router[_0x3188('0x10')]('/',auth['isAuthenticated'](),controller[_0x3188('0x11')]);router[_0x3188('0x12')](_0x3188('0xf'),auth[_0x3188('0xb')](),controller['update']);router[_0x3188('0x13')](_0x3188('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x3188('0x14')]=router;
\ No newline at end of file
+var _0xaa3f=['/describe','describe','/:id','post','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get'];(function(_0x3f29ae,_0x39e060){var _0x256a2f=function(_0x129c38){while(--_0x129c38){_0x3f29ae['push'](_0x3f29ae['shift']());}};_0x256a2f(++_0x39e060);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x39f6f7,_0x49f3d0){_0x39f6f7=_0x39f6f7-0x0;var _0x1d8a16=_0xaa3f[_0x39f6f7];return _0x1d8a16;};'use strict';var multer=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var path=require(_0xfaa3('0x2'));var timeout=require(_0xfaa3('0x3'));var express=require(_0xfaa3('0x4'));var router=express[_0xfaa3('0x5')]();var auth=require(_0xfaa3('0x6'));var interaction=require(_0xfaa3('0x7'));var config=require(_0xfaa3('0x8'));var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0xfaa3('0x9')](),controller['index']);router[_0xfaa3('0xa')](_0xfaa3('0xb'),auth[_0xfaa3('0x9')](),controller[_0xfaa3('0xc')]);router[_0xfaa3('0xa')](_0xfaa3('0xd'),auth[_0xfaa3('0x9')](),controller['show']);router[_0xfaa3('0xe')]('/',auth[_0xfaa3('0x9')](),controller['create']);router['put'](_0xfaa3('0xd'),auth[_0xfaa3('0x9')](),controller[_0xfaa3('0xf')]);router[_0xfaa3('0x10')](_0xfaa3('0xd'),auth[_0xfaa3('0x9')](),controller['destroy']);module[_0xfaa3('0x11')]=router;
\ No newline at end of file
index 10c9684..ad19b96 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x15de=['STRING','ENUM','account','agent','queue','DATE','NOW','sequelize'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x15de,0x1af));var _0xe15d=function(_0x4eb6ec,_0x7f2520){_0x4eb6ec=_0x4eb6ec-0x0;var _0x58881b=_0x15de[_0x4eb6ec];return _0x58881b;};'use strict';var moment=require('moment');var Sequelize=require(_0xe15d('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe15d('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe15d('0x2')](_0xe15d('0x3'),_0xe15d('0x4'),_0xe15d('0x5')),'allowNull':![],'defaultValue':_0xe15d('0x5')},'transferredAt':{'type':Sequelize[_0xe15d('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xe15d('0x7')]}};
\ No newline at end of file
+var _0x88e0=['account','agent','queue','DATE','NOW','sequelize','exports','STRING','ENUM'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x88e0,0x1c7));var _0x088e=function(_0x43a2b4,_0xa2f6a7){_0x43a2b4=_0x43a2b4-0x0;var _0x2cd0ab=_0x88e0[_0x43a2b4];return _0x2cd0ab;};'use strict';var moment=require('moment');var Sequelize=require(_0x088e('0x0'));module[_0x088e('0x1')]={'uniqueid':{'type':Sequelize[_0x088e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x088e('0x3')](_0x088e('0x4'),_0x088e('0x5'),_0x088e('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x088e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x088e('0x8')]}};
\ No newline at end of file
index 3177f76..c14235e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4fc2=['../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','index','MailTransferReport','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','key','VIRTUAL','field','options','includeAll','findAll','catch','show','params','include','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis'];(function(_0x1734f9,_0x558efb){var _0x22f0dc=function(_0x43ab1b){while(--_0x43ab1b){_0x1734f9['push'](_0x1734f9['shift']());}};_0x22f0dc(++_0x558efb);}(_0x4fc2,0x111));var _0x24fc=function(_0x4b60cc,_0x2e5e22){_0x4b60cc=_0x4b60cc-0x0;var _0x116ffe=_0x4fc2[_0x4b60cc];return _0x116ffe;};'use strict';var pdf=require(_0x24fc('0x0'));var emlformat=require(_0x24fc('0x1'));var rimraf=require(_0x24fc('0x2'));var zipdir=require(_0x24fc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x24fc('0x4'));var moment=require(_0x24fc('0x5'));var BPromise=require(_0x24fc('0x6'));var Mustache=require('mustache');var util=require(_0x24fc('0x7'));var path=require(_0x24fc('0x8'));var sox=require('sox');var csv=require(_0x24fc('0x9'));var ejs=require(_0x24fc('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x24fc('0xb'));var crypto=require(_0x24fc('0xc'));var jsforce=require(_0x24fc('0xd'));var deskjs=require(_0x24fc('0xe'));var toCsv=require(_0x24fc('0x9'));var querystring=require(_0x24fc('0xf'));var Papa=require('papaparse');var authService=require(_0x24fc('0x10'));var hardwareService=require(_0x24fc('0x11'));var Redis=require(_0x24fc('0x12'));var qs=require(_0x24fc('0x13'));var logger=require(_0x24fc('0x14'))(_0x24fc('0x15'));var utils=require(_0x24fc('0x16'));var config=require(_0x24fc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bd032,_0x1cde5d){_0x1cde5d=_0x1cde5d||0xcc;return function(_0x5cc65e){if(_0x5cc65e){return _0x3bd032[_0x24fc('0x18')](_0x1cde5d);}return _0x3bd032[_0x24fc('0x19')](_0x1cde5d)[_0x24fc('0x1a')]();};}function respondWithResult(_0x3bc30b,_0x30f19b){_0x30f19b=_0x30f19b||0xc8;return function(_0x326276){if(_0x326276){return _0x3bc30b['status'](_0x30f19b)[_0x24fc('0x1b')](_0x326276);}};}function respondWithFilteredResult(_0x18c0a7,_0x2ffed3){return function(_0x42cbe8){if(_0x42cbe8){var _0x4acd36=_0x42cbe8[_0x24fc('0x1c')],_0x2ac989=_0x2ffed3[_0x24fc('0x1d')],_0x588543=_0x2ffed3[_0x24fc('0x1d')]+_0x2ffed3[_0x24fc('0x1e')],_0x4af098;if(_0x588543>=_0x4acd36){_0x588543=_0x4acd36;_0x4af098=0xc8;}else{_0x4af098=0xce;}_0x18c0a7['status'](_0x4af098);return _0x18c0a7[_0x24fc('0x1f')](_0x24fc('0x20'),_0x2ac989+'-'+_0x588543+'/'+_0x4acd36)[_0x24fc('0x1b')](_0x42cbe8);}return null;};}function patchUpdates(_0x8ac114){return function(_0x4c5a43){try{jsonpatch[_0x24fc('0x21')](_0x4c5a43,_0x8ac114,!![]);}catch(_0x4073e0){return BPromise[_0x24fc('0x22')](_0x4073e0);}return _0x4c5a43['save']();};}function saveUpdates(_0x32a57d,_0x36a771){return function(_0xbf1d6b){if(_0xbf1d6b){return _0xbf1d6b[_0x24fc('0x23')](_0x32a57d)['then'](function(_0x323beb){return _0x323beb;});}return null;};}function removeEntity(_0x545939,_0x339b50){return function(_0x591c8f){if(_0x591c8f){return _0x591c8f[_0x24fc('0x24')]()[_0x24fc('0x25')](function(){_0x545939[_0x24fc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x313a25,_0x552035){return function(_0x35a9c7){if(!_0x35a9c7){_0x313a25[_0x24fc('0x18')](0x194);}return _0x35a9c7;};}function handleError(_0x36a9b4,_0x34b5b2){_0x34b5b2=_0x34b5b2||0x1f4;return function(_0x3296fc){logger[_0x24fc('0x26')](_0x3296fc[_0x24fc('0x27')]);if(_0x3296fc[_0x24fc('0x28')]){delete _0x3296fc[_0x24fc('0x28')];}_0x36a9b4[_0x24fc('0x19')](_0x34b5b2)['send'](_0x3296fc);};}exports[_0x24fc('0x29')]=function(_0x16f27f,_0x3ee302){var _0x5bb4c8={},_0xf2f77d={},_0x3d1ec8={'count':0x0,'rows':[]};var _0x35f9f9=db[_0x24fc('0x2a')][_0x24fc('0x2b')];_0xf2f77d[_0x24fc('0x2c')]=_['keys'](_0x35f9f9);_0xf2f77d[_0x24fc('0x2d')]=_[_0x24fc('0x2e')](_0x16f27f[_0x24fc('0x2d')]);_0xf2f77d[_0x24fc('0x2f')]=_[_0x24fc('0x30')](_0xf2f77d['model'],_0xf2f77d['query']);_0x5bb4c8['attributes']=_[_0x24fc('0x30')](_0xf2f77d['model'],qs[_0x24fc('0x31')](_0x16f27f[_0x24fc('0x2d')][_0x24fc('0x31')]));_0x5bb4c8[_0x24fc('0x32')]=_0x5bb4c8['attributes'][_0x24fc('0x33')]?_0x5bb4c8[_0x24fc('0x32')]:_0xf2f77d['model'];if(!_0x16f27f[_0x24fc('0x2d')][_0x24fc('0x34')]('nolimit')){_0x5bb4c8['limit']=qs[_0x24fc('0x1e')](_0x16f27f['query'][_0x24fc('0x1e')]);_0x5bb4c8[_0x24fc('0x1d')]=qs['offset'](_0x16f27f[_0x24fc('0x2d')][_0x24fc('0x1d')]);}_0x5bb4c8[_0x24fc('0x35')]=qs[_0x24fc('0x36')](_0x16f27f[_0x24fc('0x2d')][_0x24fc('0x36')]);_0x5bb4c8[_0x24fc('0x37')]=qs[_0x24fc('0x2f')](_[_0x24fc('0x38')](_0x16f27f['query'],_0xf2f77d[_0x24fc('0x2f')]));if(_0x16f27f[_0x24fc('0x2d')][_0x24fc('0x39')]){_0x5bb4c8[_0x24fc('0x37')]=_[_0x24fc('0x3a')](_0x5bb4c8['where'],{'$or':_['map'](_0x35f9f9,function(_0xd52d10){if(_0xd52d10['type'][_0x24fc('0x3b')]!==_0x24fc('0x3c')){var _0x10399f={};_0x10399f[_0xd52d10[_0x24fc('0x3d')]]={'$like':'%'+_0x16f27f['query'][_0x24fc('0x39')]+'%'};return _0x10399f;}})});}_0x5bb4c8=_['merge']({},_0x5bb4c8,_0x16f27f[_0x24fc('0x3e')]);var _0x3b8fb6={'where':_0x5bb4c8[_0x24fc('0x37')]};return db[_0x24fc('0x2a')][_0x24fc('0x1c')](_0x3b8fb6)['then'](function(_0xadedb4){_0x3d1ec8[_0x24fc('0x1c')]=_0xadedb4;if(_0x16f27f[_0x24fc('0x2d')][_0x24fc('0x3f')]){_0x5bb4c8['include']=[{'all':!![]}];}return db[_0x24fc('0x2a')][_0x24fc('0x40')](_0x5bb4c8);})['then'](function(_0xf40435){_0x3d1ec8['rows']=_0xf40435;return _0x3d1ec8;})[_0x24fc('0x25')](respondWithFilteredResult(_0x3ee302,_0x5bb4c8))[_0x24fc('0x41')](handleError(_0x3ee302,null));};exports[_0x24fc('0x42')]=function(_0x1e045a,_0x431189){var _0x278b18={'raw':!![],'where':{'id':_0x1e045a[_0x24fc('0x43')]['id']}},_0x77b959={};_0x77b959['model']=_[_0x24fc('0x2e')](db[_0x24fc('0x2a')][_0x24fc('0x2b')]);_0x77b959['query']=_[_0x24fc('0x2e')](_0x1e045a[_0x24fc('0x2d')]);_0x77b959['filters']=_[_0x24fc('0x30')](_0x77b959[_0x24fc('0x2c')],_0x77b959[_0x24fc('0x2d')]);_0x278b18['attributes']=_[_0x24fc('0x30')](_0x77b959[_0x24fc('0x2c')],qs['fields'](_0x1e045a[_0x24fc('0x2d')][_0x24fc('0x31')]));_0x278b18[_0x24fc('0x32')]=_0x278b18[_0x24fc('0x32')]['length']?_0x278b18[_0x24fc('0x32')]:_0x77b959[_0x24fc('0x2c')];if(_0x1e045a[_0x24fc('0x2d')][_0x24fc('0x3f')]){_0x278b18[_0x24fc('0x44')]=[{'all':!![]}];}_0x278b18=_['merge']({},_0x278b18,_0x1e045a[_0x24fc('0x3e')]);return db[_0x24fc('0x2a')][_0x24fc('0x45')](_0x278b18)[_0x24fc('0x25')](handleEntityNotFound(_0x431189,null))['then'](respondWithResult(_0x431189,null))[_0x24fc('0x41')](handleError(_0x431189,null));};exports[_0x24fc('0x46')]=function(_0x5ea251,_0x5bbb6c){return db[_0x24fc('0x2a')]['create'](_0x5ea251['body'],{})[_0x24fc('0x25')](respondWithResult(_0x5bbb6c,0xc9))['catch'](handleError(_0x5bbb6c,null));};exports[_0x24fc('0x23')]=function(_0x264854,_0x5052c8){if(_0x264854['body']['id']){delete _0x264854[_0x24fc('0x47')]['id'];}return db[_0x24fc('0x2a')][_0x24fc('0x45')]({'where':{'id':_0x264854[_0x24fc('0x43')]['id']}})[_0x24fc('0x25')](handleEntityNotFound(_0x5052c8,null))[_0x24fc('0x25')](saveUpdates(_0x264854[_0x24fc('0x47')],null))[_0x24fc('0x25')](respondWithResult(_0x5052c8,null))['catch'](handleError(_0x5052c8,null));};exports['destroy']=function(_0x266378,_0x2f1a99){return db[_0x24fc('0x2a')]['find']({'where':{'id':_0x266378['params']['id']}})[_0x24fc('0x25')](handleEntityNotFound(_0x2f1a99,null))[_0x24fc('0x25')](removeEntity(_0x2f1a99,null))[_0x24fc('0x41')](handleError(_0x2f1a99,null));};exports[_0x24fc('0x48')]=function(_0x21f8b8,_0x42e22a){return db[_0x24fc('0x2a')][_0x24fc('0x48')]()[_0x24fc('0x25')](respondWithResult(_0x42e22a,null))[_0x24fc('0x41')](handleError(_0x42e22a,null));};
\ No newline at end of file
+var _0xda3f=['set','Content-Range','apply','save','then','destroy','error','name','send','index','MailTransferReport','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','merge','type','key','options','includeAll','findAll','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','moment','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status'];(function(_0x339b73,_0x5a6856){var _0x162667=function(_0x5ebb6c){while(--_0x5ebb6c){_0x339b73['push'](_0x339b73['shift']());}};_0x162667(++_0x5a6856);}(_0xda3f,0xec));var _0xfda3=function(_0x329678,_0x3e2b18){_0x329678=_0x329678-0x0;var _0x100f71=_0xda3f[_0x329678];return _0x100f71;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfda3('0x0'));var rimraf=require(_0xfda3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfda3('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfda3('0x3'));var util=require(_0xfda3('0x4'));var path=require('path');var sox=require(_0xfda3('0x5'));var csv=require(_0xfda3('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x6'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var authService=require(_0xfda3('0xd'));var hardwareService=require(_0xfda3('0xe'));var Redis=require(_0xfda3('0xf'));var qs=require(_0xfda3('0x10'));var logger=require(_0xfda3('0x11'))('api');var utils=require(_0xfda3('0x12'));var config=require(_0xfda3('0x13'));var db=require(_0xfda3('0x14'))['db'];function respondWithStatusCode(_0x11afc1,_0x1443f4){_0x1443f4=_0x1443f4||0xcc;return function(_0x4b77ea){if(_0x4b77ea){return _0x11afc1[_0xfda3('0x15')](_0x1443f4);}return _0x11afc1['status'](_0x1443f4)[_0xfda3('0x16')]();};}function respondWithResult(_0x1e7a55,_0x4929fa){_0x4929fa=_0x4929fa||0xc8;return function(_0x501588){if(_0x501588){return _0x1e7a55['status'](_0x4929fa)[_0xfda3('0x17')](_0x501588);}};}function respondWithFilteredResult(_0x477fc0,_0x5ea793){return function(_0x57a229){if(_0x57a229){var _0x533365=_0x57a229[_0xfda3('0x18')],_0x80ea80=_0x5ea793[_0xfda3('0x19')],_0x474707=_0x5ea793[_0xfda3('0x19')]+_0x5ea793[_0xfda3('0x1a')],_0x249dc6;if(_0x474707>=_0x533365){_0x474707=_0x533365;_0x249dc6=0xc8;}else{_0x249dc6=0xce;}_0x477fc0[_0xfda3('0x1b')](_0x249dc6);return _0x477fc0[_0xfda3('0x1c')](_0xfda3('0x1d'),_0x80ea80+'-'+_0x474707+'/'+_0x533365)['json'](_0x57a229);}return null;};}function patchUpdates(_0x15ddb9){return function(_0x1bbdda){try{jsonpatch[_0xfda3('0x1e')](_0x1bbdda,_0x15ddb9,!![]);}catch(_0x32855a){return BPromise['reject'](_0x32855a);}return _0x1bbdda[_0xfda3('0x1f')]();};}function saveUpdates(_0x43cfac,_0x2ee74c){return function(_0x51e731){if(_0x51e731){return _0x51e731['update'](_0x43cfac)[_0xfda3('0x20')](function(_0x38d428){return _0x38d428;});}return null;};}function removeEntity(_0x4ea9f5,_0x545320){return function(_0x3cf5a9){if(_0x3cf5a9){return _0x3cf5a9[_0xfda3('0x21')]()[_0xfda3('0x20')](function(){_0x4ea9f5[_0xfda3('0x1b')](0xcc)[_0xfda3('0x16')]();});}};}function handleEntityNotFound(_0x2b84b7,_0x2677f6){return function(_0xc6fb9a){if(!_0xc6fb9a){_0x2b84b7[_0xfda3('0x15')](0x194);}return _0xc6fb9a;};}function handleError(_0x5499f5,_0x82341b){_0x82341b=_0x82341b||0x1f4;return function(_0x2d5b44){logger[_0xfda3('0x22')](_0x2d5b44['stack']);if(_0x2d5b44[_0xfda3('0x23')]){delete _0x2d5b44[_0xfda3('0x23')];}_0x5499f5[_0xfda3('0x1b')](_0x82341b)[_0xfda3('0x24')](_0x2d5b44);};}exports[_0xfda3('0x25')]=function(_0xad9f7b,_0x514d2a){var _0x3c6d7d={},_0x1e87fe={},_0x2bef2b={'count':0x0,'rows':[]};var _0x1f2884=db[_0xfda3('0x26')]['rawAttributes'];_0x1e87fe[_0xfda3('0x27')]=_[_0xfda3('0x28')](_0x1f2884);_0x1e87fe[_0xfda3('0x29')]=_[_0xfda3('0x28')](_0xad9f7b[_0xfda3('0x29')]);_0x1e87fe[_0xfda3('0x2a')]=_[_0xfda3('0x2b')](_0x1e87fe['model'],_0x1e87fe['query']);_0x3c6d7d[_0xfda3('0x2c')]=_['intersection'](_0x1e87fe['model'],qs[_0xfda3('0x2d')](_0xad9f7b[_0xfda3('0x29')][_0xfda3('0x2d')]));_0x3c6d7d[_0xfda3('0x2c')]=_0x3c6d7d[_0xfda3('0x2c')][_0xfda3('0x2e')]?_0x3c6d7d[_0xfda3('0x2c')]:_0x1e87fe[_0xfda3('0x27')];if(!_0xad9f7b[_0xfda3('0x29')]['hasOwnProperty'](_0xfda3('0x2f'))){_0x3c6d7d[_0xfda3('0x1a')]=qs[_0xfda3('0x1a')](_0xad9f7b[_0xfda3('0x29')][_0xfda3('0x1a')]);_0x3c6d7d[_0xfda3('0x19')]=qs[_0xfda3('0x19')](_0xad9f7b[_0xfda3('0x29')][_0xfda3('0x19')]);}_0x3c6d7d['order']=qs['sort'](_0xad9f7b[_0xfda3('0x29')][_0xfda3('0x30')]);_0x3c6d7d['where']=qs[_0xfda3('0x2a')](_[_0xfda3('0x31')](_0xad9f7b[_0xfda3('0x29')],_0x1e87fe['filters']));if(_0xad9f7b[_0xfda3('0x29')][_0xfda3('0x32')]){_0x3c6d7d[_0xfda3('0x33')]=_[_0xfda3('0x34')](_0x3c6d7d[_0xfda3('0x33')],{'$or':_['map'](_0x1f2884,function(_0xc6dd4e){if(_0xc6dd4e[_0xfda3('0x35')][_0xfda3('0x36')]!=='VIRTUAL'){var _0x373c96={};_0x373c96[_0xc6dd4e['field']]={'$like':'%'+_0xad9f7b[_0xfda3('0x29')][_0xfda3('0x32')]+'%'};return _0x373c96;}})});}_0x3c6d7d=_[_0xfda3('0x34')]({},_0x3c6d7d,_0xad9f7b[_0xfda3('0x37')]);var _0x21c5cc={'where':_0x3c6d7d[_0xfda3('0x33')]};return db[_0xfda3('0x26')][_0xfda3('0x18')](_0x21c5cc)['then'](function(_0x24c7ad){_0x2bef2b[_0xfda3('0x18')]=_0x24c7ad;if(_0xad9f7b[_0xfda3('0x29')][_0xfda3('0x38')]){_0x3c6d7d['include']=[{'all':!![]}];}return db[_0xfda3('0x26')][_0xfda3('0x39')](_0x3c6d7d);})[_0xfda3('0x20')](function(_0x5bad90){_0x2bef2b['rows']=_0x5bad90;return _0x2bef2b;})[_0xfda3('0x20')](respondWithFilteredResult(_0x514d2a,_0x3c6d7d))[_0xfda3('0x3a')](handleError(_0x514d2a,null));};exports[_0xfda3('0x3b')]=function(_0x1aaa6c,_0x2b415d){var _0x115f20={'raw':!![],'where':{'id':_0x1aaa6c[_0xfda3('0x3c')]['id']}},_0x40b814={};_0x40b814[_0xfda3('0x27')]=_[_0xfda3('0x28')](db['MailTransferReport'][_0xfda3('0x3d')]);_0x40b814[_0xfda3('0x29')]=_['keys'](_0x1aaa6c[_0xfda3('0x29')]);_0x40b814['filters']=_['intersection'](_0x40b814['model'],_0x40b814[_0xfda3('0x29')]);_0x115f20[_0xfda3('0x2c')]=_[_0xfda3('0x2b')](_0x40b814[_0xfda3('0x27')],qs['fields'](_0x1aaa6c[_0xfda3('0x29')][_0xfda3('0x2d')]));_0x115f20[_0xfda3('0x2c')]=_0x115f20[_0xfda3('0x2c')]['length']?_0x115f20[_0xfda3('0x2c')]:_0x40b814[_0xfda3('0x27')];if(_0x1aaa6c[_0xfda3('0x29')]['includeAll']){_0x115f20['include']=[{'all':!![]}];}_0x115f20=_[_0xfda3('0x34')]({},_0x115f20,_0x1aaa6c[_0xfda3('0x37')]);return db[_0xfda3('0x26')][_0xfda3('0x3e')](_0x115f20)[_0xfda3('0x20')](handleEntityNotFound(_0x2b415d,null))[_0xfda3('0x20')](respondWithResult(_0x2b415d,null))[_0xfda3('0x3a')](handleError(_0x2b415d,null));};exports[_0xfda3('0x3f')]=function(_0x12b533,_0x3ed533){return db[_0xfda3('0x26')][_0xfda3('0x3f')](_0x12b533[_0xfda3('0x40')],{})[_0xfda3('0x20')](respondWithResult(_0x3ed533,0xc9))['catch'](handleError(_0x3ed533,null));};exports['update']=function(_0x52b5c3,_0x2acde1){if(_0x52b5c3[_0xfda3('0x40')]['id']){delete _0x52b5c3[_0xfda3('0x40')]['id'];}return db[_0xfda3('0x26')][_0xfda3('0x3e')]({'where':{'id':_0x52b5c3[_0xfda3('0x3c')]['id']}})[_0xfda3('0x20')](handleEntityNotFound(_0x2acde1,null))[_0xfda3('0x20')](saveUpdates(_0x52b5c3[_0xfda3('0x40')],null))['then'](respondWithResult(_0x2acde1,null))[_0xfda3('0x3a')](handleError(_0x2acde1,null));};exports[_0xfda3('0x21')]=function(_0x481356,_0x36aa3a){return db[_0xfda3('0x26')]['find']({'where':{'id':_0x481356[_0xfda3('0x3c')]['id']}})[_0xfda3('0x20')](handleEntityNotFound(_0x36aa3a,null))[_0xfda3('0x20')](removeEntity(_0x36aa3a,null))['catch'](handleError(_0x36aa3a,null));};exports[_0xfda3('0x41')]=function(_0x39c96f,_0x11addf){return db['MailTransferReport'][_0xfda3('0x41')]()[_0xfda3('0x20')](respondWithResult(_0x11addf,null))[_0xfda3('0x3a')](handleError(_0x11addf,null));};
\ No newline at end of file
index e310436..cfd48a7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa217=['exports','define','MailTransferReport','uniqueid','util','api','moment','bluebird','request-promise','./mailTransferReport.attributes'];(function(_0x16e594,_0x41bb0b){var _0x582ccc=function(_0x471c37){while(--_0x471c37){_0x16e594['push'](_0x16e594['shift']());}};_0x582ccc(++_0x41bb0b);}(_0xa217,0x1b2));var _0x7a21=function(_0x5d98f1,_0x5e6890){_0x5d98f1=_0x5d98f1-0x0;var _0x7dd486=_0xa217[_0x5d98f1];return _0x7dd486;};'use strict';var _=require('lodash');var util=require(_0x7a21('0x0'));var logger=require('../../config/logger')(_0x7a21('0x1'));var moment=require(_0x7a21('0x2'));var BPromise=require(_0x7a21('0x3'));var rp=require(_0x7a21('0x4'));var attributes=require(_0x7a21('0x5'));module[_0x7a21('0x6')]=function(_0x216ebb,_0x2ca250){return _0x216ebb[_0x7a21('0x7')](_0x7a21('0x8'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x7a21('0x9'),'fields':[_0x7a21('0x9')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x4091=['exports','define','MailTransferReport','report_mail_transfer','uniqueid','../../config/logger','api','moment','request-promise','./mailTransferReport.attributes'];(function(_0x4281a8,_0x1e8ea0){var _0x20a08=function(_0x599193){while(--_0x599193){_0x4281a8['push'](_0x4281a8['shift']());}};_0x20a08(++_0x1e8ea0);}(_0x4091,0x181));var _0x1409=function(_0x4f9105,_0x587b0c){_0x4f9105=_0x4f9105-0x0;var _0x9f8a21=_0x4091[_0x4f9105];return _0x9f8a21;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1409('0x0'))(_0x1409('0x1'));var moment=require(_0x1409('0x2'));var BPromise=require('bluebird');var rp=require(_0x1409('0x3'));var attributes=require(_0x1409('0x4'));module[_0x1409('0x5')]=function(_0x3d0b1f,_0x479576){return _0x3d0b1f[_0x1409('0x6')](_0x1409('0x7'),attributes,{'tableName':_0x1409('0x8'),'paranoid':![],'indexes':[{'name':_0x1409('0x9'),'fields':[_0x1409('0x9')]}],'timestamps':!![]});};
\ No newline at end of file
index 7f61413..b220971 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6d4b=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0xb66df,_0x4fb5ce){var _0x42a702=function(_0x252d1d){while(--_0x252d1d){_0xb66df['push'](_0xb66df['shift']());}};_0x42a702(++_0x4fb5ce);}(_0x6d4b,0x1b4));var _0xb6d4=function(_0x2d20f3,_0xbc107c){_0x2d20f3=_0x2d20f3-0x0;var _0x5674be=_0x6d4b[_0x2d20f3];return _0x5674be;};'use strict';var _=require(_0xb6d4('0x0'));var util=require(_0xb6d4('0x1'));var moment=require('moment');var BPromise=require(_0xb6d4('0x2'));var rs=require(_0xb6d4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb6d4('0x4'));var logger=require(_0xb6d4('0x5'))('rpc');var config=require(_0xb6d4('0x6'));var jayson=require(_0xb6d4('0x7'));var client=jayson[_0xb6d4('0x8')][_0xb6d4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ef79e,_0x9bf906,_0xf11f71){return new BPromise(function(_0x5881e1,_0x306dbf){return client[_0xb6d4('0xa')](_0x5ef79e,_0xf11f71)['then'](function(_0xa73a98){logger[_0xb6d4('0xb')](_0xb6d4('0xc'),_0x9bf906,_0xb6d4('0xd'));logger[_0xb6d4('0xe')](_0xb6d4('0xf'),_0x9bf906,_0xb6d4('0xd'),JSON[_0xb6d4('0x10')](_0xa73a98));if(_0xa73a98[_0xb6d4('0x11')]){if(_0xa73a98[_0xb6d4('0x11')][_0xb6d4('0x12')]===0x1f4){logger['error'](_0xb6d4('0xc'),_0x9bf906,_0xa73a98['error']['message']);return _0x306dbf(_0xa73a98[_0xb6d4('0x11')][_0xb6d4('0x13')]);}logger[_0xb6d4('0x11')](_0xb6d4('0xc'),_0x9bf906,_0xa73a98[_0xb6d4('0x11')][_0xb6d4('0x13')]);return _0x5881e1(_0xa73a98[_0xb6d4('0x11')][_0xb6d4('0x13')]);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x9bf906,_0xb6d4('0xd'));_0x5881e1(_0xa73a98[_0xb6d4('0x14')][_0xb6d4('0x13')]);}})[_0xb6d4('0x15')](function(_0x575b09){logger[_0xb6d4('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x9bf906,_0x575b09);_0x306dbf(_0x575b09);});});}
\ No newline at end of file
+var _0x9ffb=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','lodash','util'];(function(_0x682399,_0x112e36){var _0x20e37b=function(_0x3cea82){while(--_0x3cea82){_0x682399['push'](_0x682399['shift']());}};_0x20e37b(++_0x112e36);}(_0x9ffb,0xee));var _0xb9ff=function(_0x4ba080,_0x32e87c){_0x4ba080=_0x4ba080-0x0;var _0x5e3580=_0x9ffb[_0x4ba080];return _0x5e3580;};'use strict';var _=require(_0xb9ff('0x0'));var util=require(_0xb9ff('0x1'));var moment=require(_0xb9ff('0x2'));var BPromise=require(_0xb9ff('0x3'));var rs=require(_0xb9ff('0x4'));var fs=require('fs');var Redis=require(_0xb9ff('0x5'));var db=require(_0xb9ff('0x6'))['db'];var utils=require(_0xb9ff('0x7'));var logger=require(_0xb9ff('0x8'))('rpc');var config=require(_0xb9ff('0x9'));var jayson=require(_0xb9ff('0xa'));var client=jayson[_0xb9ff('0xb')][_0xb9ff('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x49dee5,_0x2a9121,_0x2f82e1){return new BPromise(function(_0x5d25ba,_0x360e05){return client[_0xb9ff('0xd')](_0x49dee5,_0x2f82e1)[_0xb9ff('0xe')](function(_0x23d1a6){logger[_0xb9ff('0xf')](_0xb9ff('0x10'),_0x2a9121,_0xb9ff('0x11'));logger[_0xb9ff('0x12')](_0xb9ff('0x13'),_0x2a9121,_0xb9ff('0x11'),JSON['stringify'](_0x23d1a6));if(_0x23d1a6['error']){if(_0x23d1a6['error'][_0xb9ff('0x14')]===0x1f4){logger[_0xb9ff('0x15')](_0xb9ff('0x10'),_0x2a9121,_0x23d1a6[_0xb9ff('0x15')][_0xb9ff('0x16')]);return _0x360e05(_0x23d1a6[_0xb9ff('0x15')][_0xb9ff('0x16')]);}logger[_0xb9ff('0x15')]('MailTransferReport,\x20%s,\x20%s',_0x2a9121,_0x23d1a6[_0xb9ff('0x15')][_0xb9ff('0x16')]);return _0x5d25ba(_0x23d1a6[_0xb9ff('0x15')][_0xb9ff('0x16')]);}else{logger[_0xb9ff('0xf')](_0xb9ff('0x10'),_0x2a9121,_0xb9ff('0x11'));_0x5d25ba(_0x23d1a6[_0xb9ff('0x17')][_0xb9ff('0x16')]);}})['catch'](function(_0x3ba309){logger[_0xb9ff('0x15')](_0xb9ff('0x10'),_0x2a9121,_0x3ba309);_0x360e05(_0x3ba309);});});}
\ No newline at end of file
index 9462008..45596d4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9913=['create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','describe','/:id','isAuthenticated','show','post'];(function(_0x34f710,_0x477617){var _0x54e40e=function(_0x362917){while(--_0x362917){_0x34f710['push'](_0x34f710['shift']());}};_0x54e40e(++_0x477617);}(_0x9913,0x16e));var _0x3991=function(_0x3fcc20,_0x57c31b){_0x3fcc20=_0x3fcc20-0x0;var _0x15d3ce=_0x9913[_0x3fcc20];return _0x15d3ce;};'use strict';var multer=require(_0x3991('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3991('0x1'));var express=require(_0x3991('0x2'));var router=express[_0x3991('0x3')]();var auth=require(_0x3991('0x4'));var interaction=require(_0x3991('0x5'));var config=require(_0x3991('0x6'));var controller=require(_0x3991('0x7'));router[_0x3991('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3991('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x3991('0x9')]);router[_0x3991('0x8')](_0x3991('0xa'),auth[_0x3991('0xb')](),controller[_0x3991('0xc')]);router[_0x3991('0xd')]('/',auth[_0x3991('0xb')](),controller[_0x3991('0xe')]);router[_0x3991('0xf')](_0x3991('0xa'),auth[_0x3991('0xb')](),controller[_0x3991('0x10')]);router[_0x3991('0x11')]('/:id',auth[_0x3991('0xb')](),controller[_0x3991('0x12')]);module[_0x3991('0x13')]=router;
\ No newline at end of file
+var _0x374e=['exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','index','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy'];(function(_0xd4f3d,_0x54d270){var _0x73964b=function(_0x4ab540){while(--_0x4ab540){_0xd4f3d['push'](_0xd4f3d['shift']());}};_0x73964b(++_0x54d270);}(_0x374e,0x141));var _0xe374=function(_0x102cd2,_0x2b6376){_0x102cd2=_0x102cd2-0x0;var _0x323930=_0x374e[_0x102cd2];return _0x323930;};'use strict';var multer=require(_0xe374('0x0'));var util=require('util');var path=require(_0xe374('0x1'));var timeout=require(_0xe374('0x2'));var express=require(_0xe374('0x3'));var router=express['Router']();var auth=require(_0xe374('0x4'));var interaction=require(_0xe374('0x5'));var config=require(_0xe374('0x6'));var controller=require(_0xe374('0x7'));router[_0xe374('0x8')]('/',auth['isAuthenticated'](),controller[_0xe374('0x9')]);router[_0xe374('0x8')]('/describe',auth[_0xe374('0xa')](),controller[_0xe374('0xb')]);router[_0xe374('0x8')](_0xe374('0xc'),auth[_0xe374('0xa')](),controller[_0xe374('0xd')]);router[_0xe374('0xe')]('/',auth[_0xe374('0xa')](),controller['create']);router[_0xe374('0xf')]('/:id',auth[_0xe374('0xa')](),controller[_0xe374('0x10')]);router[_0xe374('0x11')](_0xe374('0xc'),auth[_0xe374('0xa')](),controller[_0xe374('0x12')]);module[_0xe374('0x13')]=router;
\ No newline at end of file
index 63b225f..408dc5b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc2c9=['moment','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','seconds','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize'];(function(_0x3a2deb,_0x2f8c2d){var _0x203ab0=function(_0x5d8343){while(--_0x5d8343){_0x3a2deb['push'](_0x3a2deb['shift']());}};_0x203ab0(++_0x2f8c2d);}(_0xc2c9,0x11c));var _0x9c2c=function(_0x20dd87,_0x386277){_0x20dd87=_0x20dd87-0x0;var _0x1abe67=_0xc2c9[_0x20dd87];return _0x1abe67;};'use strict';var Sequelize=require(_0x9c2c('0x0'));var moment=require(_0x9c2c('0x1'));module['exports']={'channel':{'type':Sequelize[_0x9c2c('0x2')]},'membername':{'type':Sequelize[_0x9c2c('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9c2c('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x9c2c('0x3')},'duration':{'type':Sequelize[_0x9c2c('0x4')]},'enterAt':{'type':Sequelize[_0x9c2c('0x5')]},'exitAt':{'type':Sequelize[_0x9c2c('0x5')],'set':function(_0x35dec1){var _0x5a6fe3=moment(_0x35dec1);var _0x5a3f05=moment(this['getDataValue'](_0x9c2c('0x6')));var _0x1d6104=_0x5a6fe3['diff'](_0x5a3f05,_0x9c2c('0x7'));this[_0x9c2c('0x8')](_0x9c2c('0x9'),_0x35dec1);this[_0x9c2c('0x8')](_0x9c2c('0xa'),_0x1d6104||null);}},'data1':{'type':Sequelize[_0x9c2c('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x9c2c('0x2')],'comment':_0x9c2c('0xb')},'data3':{'type':Sequelize[_0x9c2c('0x2')],'comment':_0x9c2c('0xc')},'data4':{'type':Sequelize[_0x9c2c('0x2')],'comment':_0x9c2c('0xd')},'data5':{'type':Sequelize['STRING'],'comment':_0x9c2c('0xe')},'role':{'type':Sequelize[_0x9c2c('0x2')]},'internal':{'type':Sequelize[_0x9c2c('0x4')]},'uniqueid':{'type':Sequelize[_0x9c2c('0x2')]}};
\ No newline at end of file
+var _0x8362=['moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','sequelize'];(function(_0x484609,_0x4d4b51){var _0x3c099=function(_0x1295b6){while(--_0x1295b6){_0x484609['push'](_0x484609['shift']());}};_0x3c099(++_0x4d4b51);}(_0x8362,0x149));var _0x2836=function(_0x311b83,_0x39316c){_0x311b83=_0x311b83-0x0;var _0x5800b8=_0x8362[_0x311b83];return _0x5800b8;};'use strict';var Sequelize=require(_0x2836('0x0'));var moment=require(_0x2836('0x1'));module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x2836('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2836('0x2')],'defaultValue':_0x2836('0x3'),'comment':_0x2836('0x4')},'duration':{'type':Sequelize[_0x2836('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x2836('0x6')],'set':function(_0x2949a7){var _0xbdb3f0=moment(_0x2949a7);var _0x5c6abe=moment(this[_0x2836('0x7')](_0x2836('0x8')));var _0x3cde43=_0xbdb3f0[_0x2836('0x9')](_0x5c6abe,_0x2836('0xa'));this[_0x2836('0xb')](_0x2836('0xc'),_0x2949a7);this[_0x2836('0xb')](_0x2836('0xd'),_0x3cde43||null);}},'data1':{'type':Sequelize[_0x2836('0x2')],'comment':_0x2836('0xe')},'data2':{'type':Sequelize[_0x2836('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x2836('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize['STRING'],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x2836('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x2836('0x5')]},'uniqueid':{'type':Sequelize[_0x2836('0x2')]}};
\ No newline at end of file
index a963fbf..f1f44dd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2f68=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','key','VIRTUAL','field','filter','then','include','findAll','show','params','includeAll','options','find','create','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/utils','../../mysqldb','status','json','count','offset','limit','Content-Range','reject','save','update','destroy','sendStatus','error','name','send','index','MemberReport','rawAttributes','model','query','keys'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0x2f68,0x12b));var _0x82f6=function(_0x186223,_0x21a38e){_0x186223=_0x186223-0x0;var _0x3dc609=_0x2f68[_0x186223];return _0x3dc609;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x82f6('0x0'));var rimraf=require(_0x82f6('0x1'));var zipdir=require(_0x82f6('0x2'));var jsonpatch=require(_0x82f6('0x3'));var rp=require(_0x82f6('0x4'));var moment=require('moment');var BPromise=require(_0x82f6('0x5'));var Mustache=require(_0x82f6('0x6'));var util=require(_0x82f6('0x7'));var path=require(_0x82f6('0x8'));var sox=require(_0x82f6('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x82f6('0xa'));var squel=require('squel');var crypto=require(_0x82f6('0xb'));var jsforce=require(_0x82f6('0xc'));var deskjs=require(_0x82f6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x82f6('0xe'));var Papa=require(_0x82f6('0xf'));var authService=require(_0x82f6('0x10'));var hardwareService=require(_0x82f6('0x11'));var Redis=require('ioredis');var qs=require(_0x82f6('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x82f6('0x13'));var config=require('../../config/environment');var db=require(_0x82f6('0x14'))['db'];function respondWithStatusCode(_0x27def8,_0x4d8700){_0x4d8700=_0x4d8700||0xcc;return function(_0x470319){if(_0x470319){return _0x27def8['sendStatus'](_0x4d8700);}return _0x27def8[_0x82f6('0x15')](_0x4d8700)['end']();};}function respondWithResult(_0x4d139a,_0x22d172){_0x22d172=_0x22d172||0xc8;return function(_0xb4c0d7){if(_0xb4c0d7){return _0x4d139a[_0x82f6('0x15')](_0x22d172)[_0x82f6('0x16')](_0xb4c0d7);}};}function respondWithFilteredResult(_0x318a29,_0x28f3cf){return function(_0x3b0252){if(_0x3b0252){var _0x376b4b=_0x3b0252[_0x82f6('0x17')],_0x447987=_0x28f3cf[_0x82f6('0x18')],_0x42ef53=_0x28f3cf[_0x82f6('0x18')]+_0x28f3cf[_0x82f6('0x19')],_0x3ca73f;if(_0x42ef53>=_0x376b4b){_0x42ef53=_0x376b4b;_0x3ca73f=0xc8;}else{_0x3ca73f=0xce;}_0x318a29[_0x82f6('0x15')](_0x3ca73f);return _0x318a29['set'](_0x82f6('0x1a'),_0x447987+'-'+_0x42ef53+'/'+_0x376b4b)[_0x82f6('0x16')](_0x3b0252);}return null;};}function patchUpdates(_0x32b458){return function(_0x15c8c6){try{jsonpatch['apply'](_0x15c8c6,_0x32b458,!![]);}catch(_0x2de7b4){return BPromise[_0x82f6('0x1b')](_0x2de7b4);}return _0x15c8c6[_0x82f6('0x1c')]();};}function saveUpdates(_0xb22355,_0x52ebaf){return function(_0x3abb44){if(_0x3abb44){return _0x3abb44[_0x82f6('0x1d')](_0xb22355)['then'](function(_0x238de3){return _0x238de3;});}return null;};}function removeEntity(_0x2e65a2,_0x38e9e1){return function(_0x52085d){if(_0x52085d){return _0x52085d[_0x82f6('0x1e')]()['then'](function(){_0x2e65a2[_0x82f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37fb0c,_0xf58240){return function(_0xe45c){if(!_0xe45c){_0x37fb0c[_0x82f6('0x1f')](0x194);}return _0xe45c;};}function handleError(_0x390681,_0x4b9384){_0x4b9384=_0x4b9384||0x1f4;return function(_0x6aa93d){logger[_0x82f6('0x20')](_0x6aa93d['stack']);if(_0x6aa93d[_0x82f6('0x21')]){delete _0x6aa93d['name'];}_0x390681[_0x82f6('0x15')](_0x4b9384)[_0x82f6('0x22')](_0x6aa93d);};}exports[_0x82f6('0x23')]=function(_0x4b734e,_0x44a8ec){var _0x215991={},_0x547ce7={},_0x3350f2={'count':0x0,'rows':[]};var _0x1856af=db[_0x82f6('0x24')][_0x82f6('0x25')];_0x547ce7[_0x82f6('0x26')]=_['keys'](_0x1856af);_0x547ce7[_0x82f6('0x27')]=_[_0x82f6('0x28')](_0x4b734e[_0x82f6('0x27')]);_0x547ce7[_0x82f6('0x29')]=_[_0x82f6('0x2a')](_0x547ce7['model'],_0x547ce7[_0x82f6('0x27')]);_0x215991['attributes']=_[_0x82f6('0x2a')](_0x547ce7['model'],qs[_0x82f6('0x2b')](_0x4b734e['query'][_0x82f6('0x2b')]));_0x215991[_0x82f6('0x2c')]=_0x215991[_0x82f6('0x2c')][_0x82f6('0x2d')]?_0x215991['attributes']:_0x547ce7[_0x82f6('0x26')];if(!_0x4b734e['query'][_0x82f6('0x2e')](_0x82f6('0x2f'))){_0x215991['limit']=qs[_0x82f6('0x19')](_0x4b734e['query'][_0x82f6('0x19')]);_0x215991[_0x82f6('0x18')]=qs[_0x82f6('0x18')](_0x4b734e[_0x82f6('0x27')][_0x82f6('0x18')]);}_0x215991['order']=qs['sort'](_0x4b734e[_0x82f6('0x27')][_0x82f6('0x30')]);_0x215991[_0x82f6('0x31')]=qs[_0x82f6('0x29')](_[_0x82f6('0x32')](_0x4b734e[_0x82f6('0x27')],_0x547ce7[_0x82f6('0x29')]));if(_0x4b734e[_0x82f6('0x27')]['filter']){_0x215991[_0x82f6('0x31')]=_[_0x82f6('0x33')](_0x215991[_0x82f6('0x31')],{'$or':_['map'](_0x1856af,function(_0x2887bc){if(_0x2887bc[_0x82f6('0x34')][_0x82f6('0x35')]!==_0x82f6('0x36')){var _0x48d561={};_0x48d561[_0x2887bc[_0x82f6('0x37')]]={'$like':'%'+_0x4b734e[_0x82f6('0x27')][_0x82f6('0x38')]+'%'};return _0x48d561;}})});}_0x215991=_[_0x82f6('0x33')]({},_0x215991,_0x4b734e['options']);var _0x209edd={'where':_0x215991[_0x82f6('0x31')]};return db[_0x82f6('0x24')][_0x82f6('0x17')](_0x209edd)[_0x82f6('0x39')](function(_0x572858){_0x3350f2[_0x82f6('0x17')]=_0x572858;if(_0x4b734e[_0x82f6('0x27')]['includeAll']){_0x215991[_0x82f6('0x3a')]=[{'all':!![]}];}return db[_0x82f6('0x24')][_0x82f6('0x3b')](_0x215991);})[_0x82f6('0x39')](function(_0x39760e){_0x3350f2['rows']=_0x39760e;return _0x3350f2;})[_0x82f6('0x39')](respondWithFilteredResult(_0x44a8ec,_0x215991))['catch'](handleError(_0x44a8ec,null));};exports[_0x82f6('0x3c')]=function(_0x4d341d,_0x2e5b13){var _0x2be4b0={'raw':!![],'where':{'id':_0x4d341d[_0x82f6('0x3d')]['id']}},_0x200571={};_0x200571['model']=_['keys'](db[_0x82f6('0x24')][_0x82f6('0x25')]);_0x200571[_0x82f6('0x27')]=_[_0x82f6('0x28')](_0x4d341d[_0x82f6('0x27')]);_0x200571[_0x82f6('0x29')]=_[_0x82f6('0x2a')](_0x200571['model'],_0x200571[_0x82f6('0x27')]);_0x2be4b0[_0x82f6('0x2c')]=_[_0x82f6('0x2a')](_0x200571[_0x82f6('0x26')],qs['fields'](_0x4d341d[_0x82f6('0x27')][_0x82f6('0x2b')]));_0x2be4b0[_0x82f6('0x2c')]=_0x2be4b0[_0x82f6('0x2c')][_0x82f6('0x2d')]?_0x2be4b0[_0x82f6('0x2c')]:_0x200571[_0x82f6('0x26')];if(_0x4d341d[_0x82f6('0x27')][_0x82f6('0x3e')]){_0x2be4b0[_0x82f6('0x3a')]=[{'all':!![]}];}_0x2be4b0=_[_0x82f6('0x33')]({},_0x2be4b0,_0x4d341d[_0x82f6('0x3f')]);return db[_0x82f6('0x24')][_0x82f6('0x40')](_0x2be4b0)[_0x82f6('0x39')](handleEntityNotFound(_0x2e5b13,null))['then'](respondWithResult(_0x2e5b13,null))['catch'](handleError(_0x2e5b13,null));};exports[_0x82f6('0x41')]=function(_0x55bdf3,_0x2315c1){return db[_0x82f6('0x24')][_0x82f6('0x41')](_0x55bdf3['body'],{})[_0x82f6('0x39')](respondWithResult(_0x2315c1,0xc9))[_0x82f6('0x42')](handleError(_0x2315c1,null));};exports['update']=function(_0x5860bb,_0x1b0b1d){if(_0x5860bb['body']['id']){delete _0x5860bb['body']['id'];}return db[_0x82f6('0x24')]['find']({'where':{'id':_0x5860bb['params']['id']}})[_0x82f6('0x39')](handleEntityNotFound(_0x1b0b1d,null))['then'](saveUpdates(_0x5860bb['body'],null))[_0x82f6('0x39')](respondWithResult(_0x1b0b1d,null))['catch'](handleError(_0x1b0b1d,null));};exports[_0x82f6('0x1e')]=function(_0xff24e,_0x419d86){return db[_0x82f6('0x24')][_0x82f6('0x40')]({'where':{'id':_0xff24e[_0x82f6('0x3d')]['id']}})['then'](handleEntityNotFound(_0x419d86,null))['then'](removeEntity(_0x419d86,null))[_0x82f6('0x42')](handleError(_0x419d86,null));};exports[_0x82f6('0x43')]=function(_0x27a312,_0x3caab1){return db[_0x82f6('0x24')][_0x82f6('0x43')]()['then'](respondWithResult(_0x3caab1,null))[_0x82f6('0x42')](handleError(_0x3caab1,null));};
\ No newline at end of file
+var _0xfecc=['jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','end','json','count','offset','status','reject','save','destroy','then','sendStatus','error','stack','name','send','MemberReport','rawAttributes','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','map','type','key','field','options','includeAll','include','findAll','catch','show','params','keys','length','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','crypto'];(function(_0x179511,_0x20179d){var _0x4f76de=function(_0x6b4b7c){while(--_0x6b4b7c){_0x179511['push'](_0x179511['shift']());}};_0x4f76de(++_0x20179d);}(_0xfecc,0x107));var _0xcfec=function(_0x41d851,_0x22fdd1){_0x41d851=_0x41d851-0x0;var _0x5c11d5=_0xfecc[_0x41d851];return _0x5c11d5;};'use strict';var pdf=require(_0xcfec('0x0'));var emlformat=require(_0xcfec('0x1'));var rimraf=require(_0xcfec('0x2'));var zipdir=require(_0xcfec('0x3'));var jsonpatch=require(_0xcfec('0x4'));var rp=require(_0xcfec('0x5'));var moment=require(_0xcfec('0x6'));var BPromise=require(_0xcfec('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xcfec('0x8'));var sox=require(_0xcfec('0x9'));var csv=require(_0xcfec('0xa'));var ejs=require(_0xcfec('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xcfec('0xc'));var jsforce=require(_0xcfec('0xd'));var deskjs=require(_0xcfec('0xe'));var toCsv=require(_0xcfec('0xa'));var querystring=require('querystring');var Papa=require(_0xcfec('0xf'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0xcfec('0x10'));var qs=require(_0xcfec('0x11'));var logger=require(_0xcfec('0x12'))(_0xcfec('0x13'));var utils=require(_0xcfec('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf3cad0,_0x3e270a){_0x3e270a=_0x3e270a||0xcc;return function(_0x22bab4){if(_0x22bab4){return _0xf3cad0['sendStatus'](_0x3e270a);}return _0xf3cad0['status'](_0x3e270a)[_0xcfec('0x15')]();};}function respondWithResult(_0x267b8e,_0x258636){_0x258636=_0x258636||0xc8;return function(_0x2aaeaf){if(_0x2aaeaf){return _0x267b8e['status'](_0x258636)[_0xcfec('0x16')](_0x2aaeaf);}};}function respondWithFilteredResult(_0x2224d8,_0x5576d1){return function(_0xe73e43){if(_0xe73e43){var _0x3f24a4=_0xe73e43[_0xcfec('0x17')],_0x275d7e=_0x5576d1['offset'],_0x273ea5=_0x5576d1[_0xcfec('0x18')]+_0x5576d1['limit'],_0x38d071;if(_0x273ea5>=_0x3f24a4){_0x273ea5=_0x3f24a4;_0x38d071=0xc8;}else{_0x38d071=0xce;}_0x2224d8[_0xcfec('0x19')](_0x38d071);return _0x2224d8['set']('Content-Range',_0x275d7e+'-'+_0x273ea5+'/'+_0x3f24a4)['json'](_0xe73e43);}return null;};}function patchUpdates(_0x167f3c){return function(_0x5e5399){try{jsonpatch['apply'](_0x5e5399,_0x167f3c,!![]);}catch(_0x14e57d){return BPromise[_0xcfec('0x1a')](_0x14e57d);}return _0x5e5399[_0xcfec('0x1b')]();};}function saveUpdates(_0x341745,_0xdc5786){return function(_0xccd7e8){if(_0xccd7e8){return _0xccd7e8['update'](_0x341745)['then'](function(_0x2dda78){return _0x2dda78;});}return null;};}function removeEntity(_0x17978b,_0x9688bd){return function(_0x1b145e){if(_0x1b145e){return _0x1b145e[_0xcfec('0x1c')]()[_0xcfec('0x1d')](function(){_0x17978b['status'](0xcc)[_0xcfec('0x15')]();});}};}function handleEntityNotFound(_0x2be113,_0x23d14f){return function(_0x24b555){if(!_0x24b555){_0x2be113[_0xcfec('0x1e')](0x194);}return _0x24b555;};}function handleError(_0x354fdd,_0x239a4c){_0x239a4c=_0x239a4c||0x1f4;return function(_0x5a5940){logger[_0xcfec('0x1f')](_0x5a5940[_0xcfec('0x20')]);if(_0x5a5940[_0xcfec('0x21')]){delete _0x5a5940[_0xcfec('0x21')];}_0x354fdd[_0xcfec('0x19')](_0x239a4c)[_0xcfec('0x22')](_0x5a5940);};}exports['index']=function(_0xc6aa55,_0x33f530){var _0x3ccfc9={},_0x42baa2={},_0x40b26d={'count':0x0,'rows':[]};var _0x4c3144=db[_0xcfec('0x23')][_0xcfec('0x24')];_0x42baa2['model']=_['keys'](_0x4c3144);_0x42baa2[_0xcfec('0x25')]=_['keys'](_0xc6aa55[_0xcfec('0x25')]);_0x42baa2[_0xcfec('0x26')]=_[_0xcfec('0x27')](_0x42baa2[_0xcfec('0x28')],_0x42baa2[_0xcfec('0x25')]);_0x3ccfc9['attributes']=_[_0xcfec('0x27')](_0x42baa2[_0xcfec('0x28')],qs[_0xcfec('0x29')](_0xc6aa55[_0xcfec('0x25')][_0xcfec('0x29')]));_0x3ccfc9[_0xcfec('0x2a')]=_0x3ccfc9['attributes']['length']?_0x3ccfc9['attributes']:_0x42baa2[_0xcfec('0x28')];if(!_0xc6aa55[_0xcfec('0x25')][_0xcfec('0x2b')](_0xcfec('0x2c'))){_0x3ccfc9[_0xcfec('0x2d')]=qs[_0xcfec('0x2d')](_0xc6aa55[_0xcfec('0x25')][_0xcfec('0x2d')]);_0x3ccfc9['offset']=qs[_0xcfec('0x18')](_0xc6aa55[_0xcfec('0x25')][_0xcfec('0x18')]);}_0x3ccfc9[_0xcfec('0x2e')]=qs[_0xcfec('0x2f')](_0xc6aa55[_0xcfec('0x25')][_0xcfec('0x2f')]);_0x3ccfc9[_0xcfec('0x30')]=qs[_0xcfec('0x26')](_[_0xcfec('0x31')](_0xc6aa55[_0xcfec('0x25')],_0x42baa2['filters']));if(_0xc6aa55['query']['filter']){_0x3ccfc9[_0xcfec('0x30')]=_[_0xcfec('0x32')](_0x3ccfc9[_0xcfec('0x30')],{'$or':_[_0xcfec('0x33')](_0x4c3144,function(_0x200b50){if(_0x200b50[_0xcfec('0x34')][_0xcfec('0x35')]!=='VIRTUAL'){var _0x54bb77={};_0x54bb77[_0x200b50[_0xcfec('0x36')]]={'$like':'%'+_0xc6aa55['query']['filter']+'%'};return _0x54bb77;}})});}_0x3ccfc9=_[_0xcfec('0x32')]({},_0x3ccfc9,_0xc6aa55[_0xcfec('0x37')]);var _0x52e546={'where':_0x3ccfc9[_0xcfec('0x30')]};return db[_0xcfec('0x23')][_0xcfec('0x17')](_0x52e546)[_0xcfec('0x1d')](function(_0x1d9f69){_0x40b26d[_0xcfec('0x17')]=_0x1d9f69;if(_0xc6aa55['query'][_0xcfec('0x38')]){_0x3ccfc9[_0xcfec('0x39')]=[{'all':!![]}];}return db['MemberReport'][_0xcfec('0x3a')](_0x3ccfc9);})[_0xcfec('0x1d')](function(_0x1a4558){_0x40b26d['rows']=_0x1a4558;return _0x40b26d;})[_0xcfec('0x1d')](respondWithFilteredResult(_0x33f530,_0x3ccfc9))[_0xcfec('0x3b')](handleError(_0x33f530,null));};exports[_0xcfec('0x3c')]=function(_0x1a8a56,_0x12c279){var _0xc72f89={'raw':!![],'where':{'id':_0x1a8a56[_0xcfec('0x3d')]['id']}},_0x58f9d0={};_0x58f9d0['model']=_['keys'](db['MemberReport'][_0xcfec('0x24')]);_0x58f9d0['query']=_[_0xcfec('0x3e')](_0x1a8a56[_0xcfec('0x25')]);_0x58f9d0[_0xcfec('0x26')]=_[_0xcfec('0x27')](_0x58f9d0[_0xcfec('0x28')],_0x58f9d0[_0xcfec('0x25')]);_0xc72f89['attributes']=_[_0xcfec('0x27')](_0x58f9d0['model'],qs[_0xcfec('0x29')](_0x1a8a56[_0xcfec('0x25')][_0xcfec('0x29')]));_0xc72f89['attributes']=_0xc72f89['attributes'][_0xcfec('0x3f')]?_0xc72f89[_0xcfec('0x2a')]:_0x58f9d0[_0xcfec('0x28')];if(_0x1a8a56['query']['includeAll']){_0xc72f89[_0xcfec('0x39')]=[{'all':!![]}];}_0xc72f89=_[_0xcfec('0x32')]({},_0xc72f89,_0x1a8a56['options']);return db[_0xcfec('0x23')][_0xcfec('0x40')](_0xc72f89)['then'](handleEntityNotFound(_0x12c279,null))[_0xcfec('0x1d')](respondWithResult(_0x12c279,null))['catch'](handleError(_0x12c279,null));};exports[_0xcfec('0x41')]=function(_0x24111f,_0x15c2e5){return db['MemberReport'][_0xcfec('0x41')](_0x24111f[_0xcfec('0x42')],{})[_0xcfec('0x1d')](respondWithResult(_0x15c2e5,0xc9))[_0xcfec('0x3b')](handleError(_0x15c2e5,null));};exports[_0xcfec('0x43')]=function(_0x2c738b,_0x7751e0){if(_0x2c738b['body']['id']){delete _0x2c738b[_0xcfec('0x42')]['id'];}return db['MemberReport'][_0xcfec('0x40')]({'where':{'id':_0x2c738b[_0xcfec('0x3d')]['id']}})[_0xcfec('0x1d')](handleEntityNotFound(_0x7751e0,null))['then'](saveUpdates(_0x2c738b[_0xcfec('0x42')],null))[_0xcfec('0x1d')](respondWithResult(_0x7751e0,null))['catch'](handleError(_0x7751e0,null));};exports[_0xcfec('0x1c')]=function(_0x1d7bb6,_0x4521af){return db[_0xcfec('0x23')][_0xcfec('0x40')]({'where':{'id':_0x1d7bb6[_0xcfec('0x3d')]['id']}})[_0xcfec('0x1d')](handleEntityNotFound(_0x4521af,null))[_0xcfec('0x1d')](removeEntity(_0x4521af,null))[_0xcfec('0x3b')](handleError(_0x4521af,null));};exports[_0xcfec('0x44')]=function(_0x4a57cc,_0xac6128){return db[_0xcfec('0x23')][_0xcfec('0x44')]()['then'](respondWithResult(_0xac6128,null))[_0xcfec('0x3b')](handleError(_0xac6128,null));};
\ No newline at end of file
index fa67267..7321a40 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2a19=['request-promise','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','interface','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5d5bcb,_0x25e2ea){var _0x4ea5eb=function(_0x36782b){while(--_0x36782b){_0x5d5bcb['push'](_0x5d5bcb['shift']());}};_0x4ea5eb(++_0x25e2ea);}(_0x2a19,0x14a));var _0x92a1=function(_0x8d1439,_0x552101){_0x8d1439=_0x8d1439-0x0;var _0x5e4509=_0x2a19[_0x8d1439];return _0x5e4509;};'use strict';var _=require(_0x92a1('0x0'));var util=require(_0x92a1('0x1'));var logger=require(_0x92a1('0x2'))(_0x92a1('0x3'));var moment=require(_0x92a1('0x4'));var BPromise=require(_0x92a1('0x5'));var rp=require(_0x92a1('0x6'));var attributes=require(_0x92a1('0x7'));module[_0x92a1('0x8')]=function(_0x345ac5,_0x17ea5f){return _0x345ac5[_0x92a1('0x9')](_0x92a1('0xa'),attributes,{'tableName':_0x92a1('0xb'),'paranoid':![],'indexes':[{'name':_0x92a1('0xc'),'fields':['membername',_0x92a1('0xd')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x69dc=['MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','bluebird','define'];(function(_0x266bc7,_0x52832b){var _0x1b04ff=function(_0x2b821b){while(--_0x2b821b){_0x266bc7['push'](_0x266bc7['shift']());}};_0x1b04ff(++_0x52832b);}(_0x69dc,0x123));var _0xc69d=function(_0x10e025,_0x5e230b){_0x10e025=_0x10e025-0x0;var _0x23e9c0=_0x69dc[_0x10e025];return _0x23e9c0;};'use strict';var _=require(_0xc69d('0x0'));var util=require(_0xc69d('0x1'));var logger=require(_0xc69d('0x2'))(_0xc69d('0x3'));var moment=require('moment');var BPromise=require(_0xc69d('0x4'));var rp=require('request-promise');var attributes=require('./memberReport.attributes');module['exports']=function(_0x207b55,_0x575336){return _0x207b55[_0xc69d('0x5')](_0xc69d('0x6'),attributes,{'tableName':_0xc69d('0x7'),'paranoid':![],'indexes':[{'name':_0xc69d('0x8'),'fields':[_0xc69d('0x9'),_0xc69d('0xa')]}],'timestamps':!![]});};
\ No newline at end of file
index 2666df8..e897c85 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa0a8=['map','include','model','then','debug','stringify','CreateMemberReport','MemberReport','body','catch','UpdateMemberReport','update','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','result','GetMemberReport','options','raw','where','attributes','limit'];(function(_0xa57936,_0x4698d8){var _0x327085=function(_0x3d47a8){while(--_0x3d47a8){_0xa57936['push'](_0xa57936['shift']());}};_0x327085(++_0x4698d8);}(_0xa0a8,0xfc));var _0x8a0a=function(_0x34ecfb,_0x2cfac9){_0x34ecfb=_0x34ecfb-0x0;var _0x2abc3e=_0xa0a8[_0x34ecfb];return _0x2abc3e;};'use strict';var _=require(_0x8a0a('0x0'));var util=require(_0x8a0a('0x1'));var moment=require('moment');var BPromise=require(_0x8a0a('0x2'));var rs=require(_0x8a0a('0x3'));var fs=require('fs');var Redis=require(_0x8a0a('0x4'));var db=require(_0x8a0a('0x5'))['db'];var utils=require(_0x8a0a('0x6'));var logger=require(_0x8a0a('0x7'))(_0x8a0a('0x8'));var config=require(_0x8a0a('0x9'));var jayson=require(_0x8a0a('0xa'));var client=jayson[_0x8a0a('0xb')][_0x8a0a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x589075,_0x1cd842,_0x24e030){return new BPromise(function(_0x299bc3,_0x1587c6){return client[_0x8a0a('0xd')](_0x589075,_0x24e030)['then'](function(_0x1783ac){logger[_0x8a0a('0xe')](_0x8a0a('0xf'),_0x1cd842,_0x8a0a('0x10'));logger['debug'](_0x8a0a('0x11'),_0x1cd842,_0x8a0a('0x10'),JSON['stringify'](_0x1783ac));if(_0x1783ac[_0x8a0a('0x12')]){if(_0x1783ac[_0x8a0a('0x12')][_0x8a0a('0x13')]===0x1f4){logger[_0x8a0a('0x12')](_0x8a0a('0xf'),_0x1cd842,_0x1783ac[_0x8a0a('0x12')][_0x8a0a('0x14')]);return _0x1587c6(_0x1783ac[_0x8a0a('0x12')][_0x8a0a('0x14')]);}logger[_0x8a0a('0x12')](_0x8a0a('0xf'),_0x1cd842,_0x1783ac[_0x8a0a('0x12')]['message']);return _0x299bc3(_0x1783ac['error']['message']);}else{logger[_0x8a0a('0xe')](_0x8a0a('0xf'),_0x1cd842,_0x8a0a('0x10'));_0x299bc3(_0x1783ac[_0x8a0a('0x15')][_0x8a0a('0x14')]);}})['catch'](function(_0x36cbcb){logger['error'](_0x8a0a('0xf'),_0x1cd842,_0x36cbcb);_0x1587c6(_0x36cbcb);});});}exports[_0x8a0a('0x16')]=function(_0x13c76f){var _0x1ce0cb=this;return new Promise(function(_0xc9afd2,_0x29cbe0){return db['MemberReport']['findAll']({'raw':_0x13c76f[_0x8a0a('0x17')]?_0x13c76f[_0x8a0a('0x17')][_0x8a0a('0x18')]===undefined?!![]:![]:!![],'where':_0x13c76f['options']?_0x13c76f[_0x8a0a('0x17')][_0x8a0a('0x19')]||null:null,'attributes':_0x13c76f[_0x8a0a('0x17')]?_0x13c76f[_0x8a0a('0x17')][_0x8a0a('0x1a')]||null:null,'limit':_0x13c76f['options']?_0x13c76f[_0x8a0a('0x17')][_0x8a0a('0x1b')]||null:null,'include':_0x13c76f[_0x8a0a('0x17')]?_0x13c76f[_0x8a0a('0x17')]['include']?_[_0x8a0a('0x1c')](_0x13c76f['options'][_0x8a0a('0x1d')],function(_0x490bfc){return{'model':db[_0x490bfc[_0x8a0a('0x1e')]],'as':_0x490bfc['as'],'attributes':_0x490bfc['attributes'],'include':_0x490bfc[_0x8a0a('0x1d')]?_[_0x8a0a('0x1c')](_0x490bfc[_0x8a0a('0x1d')],function(_0x5600e8){return{'model':db[_0x5600e8[_0x8a0a('0x1e')]],'as':_0x5600e8['as'],'attributes':_0x5600e8['attributes'],'include':_0x5600e8[_0x8a0a('0x1d')]?_[_0x8a0a('0x1c')](_0x5600e8['include'],function(_0x35f321){return{'model':db[_0x35f321[_0x8a0a('0x1e')]],'as':_0x35f321['as'],'attributes':_0x35f321[_0x8a0a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8a0a('0x1f')](function(_0x42cc58){logger[_0x8a0a('0xe')](_0x8a0a('0x16'),_0x13c76f);logger[_0x8a0a('0x20')](_0x8a0a('0x16'),_0x13c76f,JSON[_0x8a0a('0x21')](_0x42cc58));_0xc9afd2(_0x42cc58);})['catch'](function(_0x4f6155){logger['error'](_0x8a0a('0x16'),_0x4f6155['message'],_0x13c76f);_0x29cbe0(_0x1ce0cb[_0x8a0a('0x12')](0x1f4,_0x4f6155['message']));});});};exports[_0x8a0a('0x22')]=function(_0x5dd6fc){var _0x3d1c5a=this;return new Promise(function(_0x1075dc,_0x48a343){return db[_0x8a0a('0x23')]['create'](_0x5dd6fc[_0x8a0a('0x24')],{'raw':_0x5dd6fc[_0x8a0a('0x17')]?_0x5dd6fc[_0x8a0a('0x17')][_0x8a0a('0x18')]===undefined?!![]:![]:!![]})[_0x8a0a('0x1f')](function(_0x868129){logger[_0x8a0a('0xe')](_0x8a0a('0x22'),_0x5dd6fc);logger[_0x8a0a('0x20')](_0x8a0a('0x22'),_0x5dd6fc,JSON[_0x8a0a('0x21')](_0x868129));_0x1075dc(_0x868129);})[_0x8a0a('0x25')](function(_0x29cb25){logger[_0x8a0a('0x12')]('CreateMemberReport',_0x29cb25[_0x8a0a('0x14')],_0x5dd6fc);_0x48a343(_0x3d1c5a['error'](0x1f4,_0x29cb25[_0x8a0a('0x14')]));});});};exports[_0x8a0a('0x26')]=function(_0x4d5e01){var _0x133817=this;return new Promise(function(_0x2b3226,_0x5790fc){return db[_0x8a0a('0x23')][_0x8a0a('0x27')](_0x4d5e01['body'],{'raw':_0x4d5e01[_0x8a0a('0x17')]?_0x4d5e01[_0x8a0a('0x17')][_0x8a0a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d5e01['options']?_0x4d5e01['options'][_0x8a0a('0x19')]||null:null,'attributes':_0x4d5e01[_0x8a0a('0x17')]?_0x4d5e01['options'][_0x8a0a('0x1a')]||null:null,'limit':_0x4d5e01[_0x8a0a('0x17')]?_0x4d5e01[_0x8a0a('0x17')][_0x8a0a('0x1b')]||null:null})[_0x8a0a('0x1f')](function(_0x985426){logger[_0x8a0a('0xe')](_0x8a0a('0x26'),_0x4d5e01);logger[_0x8a0a('0x20')](_0x8a0a('0x26'),_0x4d5e01,JSON[_0x8a0a('0x21')](_0x985426));_0x2b3226(_0x985426);})[_0x8a0a('0x25')](function(_0x443cee){logger['error'](_0x8a0a('0x26'),_0x443cee['message'],_0x4d5e01);_0x5790fc(_0x133817[_0x8a0a('0x12')](0x1f4,_0x443cee[_0x8a0a('0x14')]));});});};
\ No newline at end of file
+var _0x4b8b=['../../config/environment','jayson/promise','client','http','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','options','raw','where','limit','include','model','map','attributes','GetMemberReport','catch','MemberReport','create','CreateMemberReport','UpdateMemberReport','update','body','then','lodash','util','moment','bluebird','../../mysqldb','rpc'];(function(_0x312e44,_0x37b531){var _0x116d72=function(_0x3efcff){while(--_0x3efcff){_0x312e44['push'](_0x312e44['shift']());}};_0x116d72(++_0x37b531);}(_0x4b8b,0x17b));var _0xb4b8=function(_0x128188,_0x418a16){_0x128188=_0x128188-0x0;var _0x4bc209=_0x4b8b[_0x128188];return _0x4bc209;};'use strict';var _=require(_0xb4b8('0x0'));var util=require(_0xb4b8('0x1'));var moment=require(_0xb4b8('0x2'));var BPromise=require(_0xb4b8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb4b8('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb4b8('0x5'));var config=require(_0xb4b8('0x6'));var jayson=require(_0xb4b8('0x7'));var client=jayson[_0xb4b8('0x8')][_0xb4b8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x427e00,_0xe727d,_0x29e745){return new BPromise(function(_0x4a0761,_0x5439d4){return client['request'](_0x427e00,_0x29e745)['then'](function(_0xfcded5){logger[_0xb4b8('0xa')](_0xb4b8('0xb'),_0xe727d,'request\x20sent');logger[_0xb4b8('0xc')](_0xb4b8('0xd'),_0xe727d,_0xb4b8('0xe'),JSON[_0xb4b8('0xf')](_0xfcded5));if(_0xfcded5[_0xb4b8('0x10')]){if(_0xfcded5[_0xb4b8('0x10')]['code']===0x1f4){logger[_0xb4b8('0x10')](_0xb4b8('0xb'),_0xe727d,_0xfcded5[_0xb4b8('0x10')]['message']);return _0x5439d4(_0xfcded5['error'][_0xb4b8('0x11')]);}logger[_0xb4b8('0x10')]('MemberReport,\x20%s,\x20%s',_0xe727d,_0xfcded5[_0xb4b8('0x10')][_0xb4b8('0x11')]);return _0x4a0761(_0xfcded5[_0xb4b8('0x10')]['message']);}else{logger[_0xb4b8('0xa')](_0xb4b8('0xb'),_0xe727d,_0xb4b8('0xe'));_0x4a0761(_0xfcded5['result'][_0xb4b8('0x11')]);}})['catch'](function(_0x5a4428){logger[_0xb4b8('0x10')](_0xb4b8('0xb'),_0xe727d,_0x5a4428);_0x5439d4(_0x5a4428);});});}exports['GetMemberReport']=function(_0x5d88f1){var _0x454f2c=this;return new Promise(function(_0x5c5df5,_0x38b3ee){return db['MemberReport']['findAll']({'raw':_0x5d88f1[_0xb4b8('0x12')]?_0x5d88f1[_0xb4b8('0x12')][_0xb4b8('0x13')]===undefined?!![]:![]:!![],'where':_0x5d88f1[_0xb4b8('0x12')]?_0x5d88f1['options'][_0xb4b8('0x14')]||null:null,'attributes':_0x5d88f1[_0xb4b8('0x12')]?_0x5d88f1[_0xb4b8('0x12')]['attributes']||null:null,'limit':_0x5d88f1['options']?_0x5d88f1['options'][_0xb4b8('0x15')]||null:null,'include':_0x5d88f1[_0xb4b8('0x12')]?_0x5d88f1[_0xb4b8('0x12')]['include']?_['map'](_0x5d88f1[_0xb4b8('0x12')][_0xb4b8('0x16')],function(_0x25035a){return{'model':db[_0x25035a[_0xb4b8('0x17')]],'as':_0x25035a['as'],'attributes':_0x25035a['attributes'],'include':_0x25035a[_0xb4b8('0x16')]?_[_0xb4b8('0x18')](_0x25035a[_0xb4b8('0x16')],function(_0x291e1e){return{'model':db[_0x291e1e['model']],'as':_0x291e1e['as'],'attributes':_0x291e1e[_0xb4b8('0x19')],'include':_0x291e1e['include']?_['map'](_0x291e1e[_0xb4b8('0x16')],function(_0x4cde34){return{'model':db[_0x4cde34[_0xb4b8('0x17')]],'as':_0x4cde34['as'],'attributes':_0x4cde34[_0xb4b8('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x819f93){logger[_0xb4b8('0xa')](_0xb4b8('0x1a'),_0x5d88f1);logger['debug'](_0xb4b8('0x1a'),_0x5d88f1,JSON[_0xb4b8('0xf')](_0x819f93));_0x5c5df5(_0x819f93);})[_0xb4b8('0x1b')](function(_0x52d140){logger[_0xb4b8('0x10')](_0xb4b8('0x1a'),_0x52d140['message'],_0x5d88f1);_0x38b3ee(_0x454f2c[_0xb4b8('0x10')](0x1f4,_0x52d140[_0xb4b8('0x11')]));});});};exports['CreateMemberReport']=function(_0x1ecfa4){var _0x6c1e19=this;return new Promise(function(_0x5e3d0e,_0x202705){return db[_0xb4b8('0x1c')][_0xb4b8('0x1d')](_0x1ecfa4['body'],{'raw':_0x1ecfa4[_0xb4b8('0x12')]?_0x1ecfa4[_0xb4b8('0x12')][_0xb4b8('0x13')]===undefined?!![]:![]:!![]})['then'](function(_0x5ea48d){logger[_0xb4b8('0xa')](_0xb4b8('0x1e'),_0x1ecfa4);logger['debug'](_0xb4b8('0x1e'),_0x1ecfa4,JSON[_0xb4b8('0xf')](_0x5ea48d));_0x5e3d0e(_0x5ea48d);})['catch'](function(_0x3f9659){logger[_0xb4b8('0x10')]('CreateMemberReport',_0x3f9659[_0xb4b8('0x11')],_0x1ecfa4);_0x202705(_0x6c1e19[_0xb4b8('0x10')](0x1f4,_0x3f9659[_0xb4b8('0x11')]));});});};exports[_0xb4b8('0x1f')]=function(_0x5cde6c){var _0x3796db=this;return new Promise(function(_0x3e3304,_0x26dd8c){return db[_0xb4b8('0x1c')][_0xb4b8('0x20')](_0x5cde6c[_0xb4b8('0x21')],{'raw':_0x5cde6c[_0xb4b8('0x12')]?_0x5cde6c['options'][_0xb4b8('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cde6c[_0xb4b8('0x12')]?_0x5cde6c['options']['where']||null:null,'attributes':_0x5cde6c[_0xb4b8('0x12')]?_0x5cde6c[_0xb4b8('0x12')][_0xb4b8('0x19')]||null:null,'limit':_0x5cde6c['options']?_0x5cde6c[_0xb4b8('0x12')]['limit']||null:null})[_0xb4b8('0x22')](function(_0xcf86dd){logger['info']('UpdateMemberReport',_0x5cde6c);logger['debug']('UpdateMemberReport',_0x5cde6c,JSON[_0xb4b8('0xf')](_0xcf86dd));_0x3e3304(_0xcf86dd);})[_0xb4b8('0x1b')](function(_0xae1801){logger['error']('UpdateMemberReport',_0xae1801[_0xb4b8('0x11')],_0x5cde6c);_0x26dd8c(_0x3796db[_0xb4b8('0x10')](0x1f4,_0xae1801[_0xb4b8('0x11')]));});});};
\ No newline at end of file
index d6361b4..28353ab 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1963=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','util','path','connect-timeout'];(function(_0x5ddb91,_0x50a3c6){var _0x222f31=function(_0x543d54){while(--_0x543d54){_0x5ddb91['push'](_0x5ddb91['shift']());}};_0x222f31(++_0x50a3c6);}(_0x1963,0x171));var _0x3196=function(_0x4110da,_0x85f1af){_0x4110da=_0x4110da-0x0;var _0x5b0b30=_0x1963[_0x4110da];return _0x5b0b30;};'use strict';var multer=require('multer');var util=require(_0x3196('0x0'));var path=require(_0x3196('0x1'));var timeout=require(_0x3196('0x2'));var express=require(_0x3196('0x3'));var router=express[_0x3196('0x4')]();var auth=require(_0x3196('0x5'));var interaction=require(_0x3196('0x6'));var config=require(_0x3196('0x7'));var controller=require(_0x3196('0x8'));router[_0x3196('0x9')]('/',controller[_0x3196('0xa')]);module[_0x3196('0xb')]=router;
\ No newline at end of file
+var _0xe925=['index','exports','util','connect-timeout','express','Router','./migration.controller'];(function(_0x112c25,_0x420745){var _0x2baa31=function(_0x5272d6){while(--_0x5272d6){_0x112c25['push'](_0x112c25['shift']());}};_0x2baa31(++_0x420745);}(_0xe925,0xc6));var _0x5e92=function(_0x1747ff,_0x3298c7){_0x1747ff=_0x1747ff-0x0;var _0x395929=_0xe925[_0x1747ff];return _0x395929;};'use strict';var multer=require('multer');var util=require(_0x5e92('0x0'));var path=require('path');var timeout=require(_0x5e92('0x1'));var express=require(_0x5e92('0x2'));var router=express[_0x5e92('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5e92('0x4'));router['get']('/',controller[_0x5e92('0x5')]);module[_0x5e92('0x6')]=router;
\ No newline at end of file
index e590467..f52b244 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3713=['sequelize','exports','STRING'];(function(_0x5bccb8,_0x45866){var _0x3ec26a=function(_0x4f0876){while(--_0x4f0876){_0x5bccb8['push'](_0x5bccb8['shift']());}};_0x3ec26a(++_0x45866);}(_0x3713,0xa2));var _0x3371=function(_0x230df0,_0x244d3c){_0x230df0=_0x230df0-0x0;var _0xf0cd24=_0x3713[_0x230df0];return _0xf0cd24;};'use strict';var Sequelize=require(_0x3371('0x0'));module[_0x3371('0x1')]={'version':{'type':Sequelize[_0x3371('0x2')],'primaryKey':!![],'autoIncrement':![]}};
\ No newline at end of file
+var _0x3d2f=['exports','sequelize'];(function(_0x578f24,_0x27afc9){var _0xbbe012=function(_0x36c4dd){while(--_0x36c4dd){_0x578f24['push'](_0x578f24['shift']());}};_0xbbe012(++_0x27afc9);}(_0x3d2f,0x18f));var _0xf3d2=function(_0x3eea50,_0x54d651){_0x3eea50=_0x3eea50-0x0;var _0x3f1f0e=_0x3d2f[_0x3eea50];return _0x3f1f0e;};'use strict';var Sequelize=require(_0xf3d2('0x0'));module[_0xf3d2('0x1')]={'version':{'type':Sequelize['STRING'],'primaryKey':!![],'autoIncrement':![]}};
\ No newline at end of file
index 344f523..253c9d2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8811=['../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','update','error','stack','name','send','Migration','rawAttributes','keys','query','intersection','model','fields','attributes','length','nolimit','limit','where','filters','pick','filter','merge','map','type','key','VIRTUAL','options','then','includeAll','include','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x8811,0x1a2));var _0x1881=function(_0x15bd45,_0x2267f4){_0x15bd45=_0x15bd45-0x0;var _0x127818=_0x8811[_0x15bd45];return _0x127818;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1881('0x0'));var rimraf=require(_0x1881('0x1'));var zipdir=require(_0x1881('0x2'));var jsonpatch=require(_0x1881('0x3'));var rp=require(_0x1881('0x4'));var moment=require(_0x1881('0x5'));var BPromise=require(_0x1881('0x6'));var Mustache=require(_0x1881('0x7'));var util=require('util');var path=require(_0x1881('0x8'));var sox=require(_0x1881('0x9'));var csv=require(_0x1881('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1881('0xb'));var squel=require(_0x1881('0xc'));var crypto=require(_0x1881('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1881('0xe'));var toCsv=require(_0x1881('0xa'));var querystring=require(_0x1881('0xf'));var Papa=require('papaparse');var authService=require(_0x1881('0x10'));var hardwareService=require(_0x1881('0x11'));var Redis=require('ioredis');var qs=require(_0x1881('0x12'));var logger=require(_0x1881('0x13'))('api');var utils=require(_0x1881('0x14'));var config=require(_0x1881('0x15'));var db=require(_0x1881('0x16'))['db'];function respondWithStatusCode(_0x78dadf,_0x5a0edb){_0x5a0edb=_0x5a0edb||0xcc;return function(_0x559b7e){if(_0x559b7e){return _0x78dadf[_0x1881('0x17')](_0x5a0edb);}return _0x78dadf[_0x1881('0x18')](_0x5a0edb)[_0x1881('0x19')]();};}function respondWithResult(_0x4411eb,_0x18f348){_0x18f348=_0x18f348||0xc8;return function(_0x175580){if(_0x175580){return _0x4411eb[_0x1881('0x18')](_0x18f348)[_0x1881('0x1a')](_0x175580);}};}function respondWithFilteredResult(_0x4a0086,_0x1343f8){return function(_0x3ffe50){if(_0x3ffe50){var _0x22f32d=_0x3ffe50[_0x1881('0x1b')],_0x4b73dd=_0x1343f8[_0x1881('0x1c')],_0x292234=_0x1343f8[_0x1881('0x1c')]+_0x1343f8['limit'],_0x501ad8;if(_0x292234>=_0x22f32d){_0x292234=_0x22f32d;_0x501ad8=0xc8;}else{_0x501ad8=0xce;}_0x4a0086[_0x1881('0x18')](_0x501ad8);return _0x4a0086[_0x1881('0x1d')](_0x1881('0x1e'),_0x4b73dd+'-'+_0x292234+'/'+_0x22f32d)[_0x1881('0x1a')](_0x3ffe50);}return null;};}function patchUpdates(_0x350c6a){return function(_0x13706c){try{jsonpatch[_0x1881('0x1f')](_0x13706c,_0x350c6a,!![]);}catch(_0x184941){return BPromise['reject'](_0x184941);}return _0x13706c['save']();};}function saveUpdates(_0x5daf85,_0x52fc62){return function(_0x1a1452){if(_0x1a1452){return _0x1a1452[_0x1881('0x20')](_0x5daf85)['then'](function(_0x15357b){return _0x15357b;});}return null;};}function removeEntity(_0x500542,_0x188be2){return function(_0x2d2bd4){if(_0x2d2bd4){return _0x2d2bd4['destroy']()['then'](function(){_0x500542[_0x1881('0x18')](0xcc)[_0x1881('0x19')]();});}};}function handleEntityNotFound(_0x309f35,_0x138bda){return function(_0x3c5376){if(!_0x3c5376){_0x309f35['sendStatus'](0x194);}return _0x3c5376;};}function handleError(_0x5beeac,_0x1a086c){_0x1a086c=_0x1a086c||0x1f4;return function(_0x6e05fb){logger[_0x1881('0x21')](_0x6e05fb[_0x1881('0x22')]);if(_0x6e05fb[_0x1881('0x23')]){delete _0x6e05fb[_0x1881('0x23')];}_0x5beeac[_0x1881('0x18')](_0x1a086c)[_0x1881('0x24')](_0x6e05fb);};}exports['index']=function(_0x31646f,_0x956224){var _0x31335c={},_0x2f714c={},_0x517414={'count':0x0,'rows':[]};var _0x3be7b1=db[_0x1881('0x25')][_0x1881('0x26')];_0x2f714c['model']=_[_0x1881('0x27')](_0x3be7b1);_0x2f714c[_0x1881('0x28')]=_['keys'](_0x31646f[_0x1881('0x28')]);_0x2f714c['filters']=_[_0x1881('0x29')](_0x2f714c['model'],_0x2f714c[_0x1881('0x28')]);_0x31335c['attributes']=_[_0x1881('0x29')](_0x2f714c[_0x1881('0x2a')],qs['fields'](_0x31646f[_0x1881('0x28')][_0x1881('0x2b')]));_0x31335c['attributes']=_0x31335c[_0x1881('0x2c')][_0x1881('0x2d')]?_0x31335c[_0x1881('0x2c')]:_0x2f714c[_0x1881('0x2a')];if(!_0x31646f[_0x1881('0x28')]['hasOwnProperty'](_0x1881('0x2e'))){_0x31335c['limit']=qs['limit'](_0x31646f['query'][_0x1881('0x2f')]);_0x31335c[_0x1881('0x1c')]=qs['offset'](_0x31646f[_0x1881('0x28')][_0x1881('0x1c')]);}_0x31335c['order']=qs['sort'](_0x31646f['query']['sort']);_0x31335c[_0x1881('0x30')]=qs[_0x1881('0x31')](_[_0x1881('0x32')](_0x31646f[_0x1881('0x28')],_0x2f714c[_0x1881('0x31')]));if(_0x31646f[_0x1881('0x28')][_0x1881('0x33')]){_0x31335c[_0x1881('0x30')]=_[_0x1881('0x34')](_0x31335c[_0x1881('0x30')],{'$or':_[_0x1881('0x35')](_0x3be7b1,function(_0x2a1190){if(_0x2a1190[_0x1881('0x36')][_0x1881('0x37')]!==_0x1881('0x38')){var _0x1889a7={};_0x1889a7[_0x2a1190['field']]={'$like':'%'+_0x31646f[_0x1881('0x28')][_0x1881('0x33')]+'%'};return _0x1889a7;}})});}_0x31335c=_[_0x1881('0x34')]({},_0x31335c,_0x31646f[_0x1881('0x39')]);var _0x1b10c1={'where':_0x31335c['where']};return db['Migration'][_0x1881('0x1b')](_0x1b10c1)[_0x1881('0x3a')](function(_0x2de30e){_0x517414[_0x1881('0x1b')]=_0x2de30e;if(_0x31646f['query'][_0x1881('0x3b')]){_0x31335c[_0x1881('0x3c')]=[{'all':!![]}];}return db[_0x1881('0x25')][_0x1881('0x3d')](_0x31335c);})['then'](function(_0x240c2f){_0x517414['rows']=_0x240c2f;return _0x517414;})[_0x1881('0x3a')](respondWithFilteredResult(_0x956224,_0x31335c))['catch'](handleError(_0x956224,null));};
\ No newline at end of file
+var _0xfbb1=['merge','options','includeAll','include','findAll','rows','catch','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','update','then','error','stack','name','send','index','Migration','rawAttributes','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','key','VIRTUAL','field'];(function(_0x3a0a99,_0x5e07f2){var _0x4b04e2=function(_0x2af4a8){while(--_0x2af4a8){_0x3a0a99['push'](_0x3a0a99['shift']());}};_0x4b04e2(++_0x5e07f2);}(_0xfbb1,0x1e3));var _0x1fbb=function(_0x38f737,_0x54f685){_0x38f737=_0x38f737-0x0;var _0x7afda3=_0xfbb1[_0x38f737];return _0x7afda3;};'use strict';var pdf=require(_0x1fbb('0x0'));var emlformat=require(_0x1fbb('0x1'));var rimraf=require(_0x1fbb('0x2'));var zipdir=require(_0x1fbb('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1fbb('0x4'));var moment=require(_0x1fbb('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1fbb('0x6'));var sox=require(_0x1fbb('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x1fbb('0x8'));var squel=require(_0x1fbb('0x9'));var crypto=require(_0x1fbb('0xa'));var jsforce=require(_0x1fbb('0xb'));var deskjs=require(_0x1fbb('0xc'));var toCsv=require(_0x1fbb('0xd'));var querystring=require(_0x1fbb('0xe'));var Papa=require(_0x1fbb('0xf'));var authService=require(_0x1fbb('0x10'));var hardwareService=require(_0x1fbb('0x11'));var Redis=require(_0x1fbb('0x12'));var qs=require(_0x1fbb('0x13'));var logger=require(_0x1fbb('0x14'))(_0x1fbb('0x15'));var utils=require('../../config/utils');var config=require(_0x1fbb('0x16'));var db=require(_0x1fbb('0x17'))['db'];function respondWithStatusCode(_0x11388f,_0x5f4f34){_0x5f4f34=_0x5f4f34||0xcc;return function(_0x25b843){if(_0x25b843){return _0x11388f[_0x1fbb('0x18')](_0x5f4f34);}return _0x11388f['status'](_0x5f4f34)[_0x1fbb('0x19')]();};}function respondWithResult(_0x3fecb9,_0x169b97){_0x169b97=_0x169b97||0xc8;return function(_0x30619d){if(_0x30619d){return _0x3fecb9[_0x1fbb('0x1a')](_0x169b97)[_0x1fbb('0x1b')](_0x30619d);}};}function respondWithFilteredResult(_0x192dd5,_0x351535){return function(_0x2c9fc5){if(_0x2c9fc5){var _0x197266=_0x2c9fc5[_0x1fbb('0x1c')],_0x6de006=_0x351535['offset'],_0x4bde3b=_0x351535[_0x1fbb('0x1d')]+_0x351535[_0x1fbb('0x1e')],_0x5f336e;if(_0x4bde3b>=_0x197266){_0x4bde3b=_0x197266;_0x5f336e=0xc8;}else{_0x5f336e=0xce;}_0x192dd5[_0x1fbb('0x1a')](_0x5f336e);return _0x192dd5[_0x1fbb('0x1f')]('Content-Range',_0x6de006+'-'+_0x4bde3b+'/'+_0x197266)[_0x1fbb('0x1b')](_0x2c9fc5);}return null;};}function patchUpdates(_0x5b2a74){return function(_0x2a0945){try{jsonpatch[_0x1fbb('0x20')](_0x2a0945,_0x5b2a74,!![]);}catch(_0xb846a2){return BPromise['reject'](_0xb846a2);}return _0x2a0945['save']();};}function saveUpdates(_0x172d93,_0x16a7af){return function(_0x4ead5e){if(_0x4ead5e){return _0x4ead5e[_0x1fbb('0x21')](_0x172d93)[_0x1fbb('0x22')](function(_0x214676){return _0x214676;});}return null;};}function removeEntity(_0x3e90ce,_0x4265ef){return function(_0x1fed03){if(_0x1fed03){return _0x1fed03['destroy']()['then'](function(){_0x3e90ce[_0x1fbb('0x1a')](0xcc)[_0x1fbb('0x19')]();});}};}function handleEntityNotFound(_0xd941ad,_0x20b282){return function(_0x567236){if(!_0x567236){_0xd941ad['sendStatus'](0x194);}return _0x567236;};}function handleError(_0x1ffd6f,_0x4ca736){_0x4ca736=_0x4ca736||0x1f4;return function(_0x44b68c){logger[_0x1fbb('0x23')](_0x44b68c[_0x1fbb('0x24')]);if(_0x44b68c[_0x1fbb('0x25')]){delete _0x44b68c[_0x1fbb('0x25')];}_0x1ffd6f['status'](_0x4ca736)[_0x1fbb('0x26')](_0x44b68c);};}exports[_0x1fbb('0x27')]=function(_0x338ced,_0xd5fb0c){var _0x267bbe={},_0x598da7={},_0x50e51f={'count':0x0,'rows':[]};var _0x12fbe8=db[_0x1fbb('0x28')][_0x1fbb('0x29')];_0x598da7['model']=_[_0x1fbb('0x2a')](_0x12fbe8);_0x598da7[_0x1fbb('0x2b')]=_[_0x1fbb('0x2a')](_0x338ced[_0x1fbb('0x2b')]);_0x598da7[_0x1fbb('0x2c')]=_['intersection'](_0x598da7[_0x1fbb('0x2d')],_0x598da7[_0x1fbb('0x2b')]);_0x267bbe[_0x1fbb('0x2e')]=_[_0x1fbb('0x2f')](_0x598da7['model'],qs['fields'](_0x338ced[_0x1fbb('0x2b')][_0x1fbb('0x30')]));_0x267bbe['attributes']=_0x267bbe['attributes'][_0x1fbb('0x31')]?_0x267bbe['attributes']:_0x598da7[_0x1fbb('0x2d')];if(!_0x338ced[_0x1fbb('0x2b')][_0x1fbb('0x32')](_0x1fbb('0x33'))){_0x267bbe['limit']=qs[_0x1fbb('0x1e')](_0x338ced['query'][_0x1fbb('0x1e')]);_0x267bbe[_0x1fbb('0x1d')]=qs[_0x1fbb('0x1d')](_0x338ced[_0x1fbb('0x2b')][_0x1fbb('0x1d')]);}_0x267bbe[_0x1fbb('0x34')]=qs[_0x1fbb('0x35')](_0x338ced['query'][_0x1fbb('0x35')]);_0x267bbe[_0x1fbb('0x36')]=qs['filters'](_[_0x1fbb('0x37')](_0x338ced['query'],_0x598da7['filters']));if(_0x338ced[_0x1fbb('0x2b')][_0x1fbb('0x38')]){_0x267bbe[_0x1fbb('0x36')]=_['merge'](_0x267bbe[_0x1fbb('0x36')],{'$or':_['map'](_0x12fbe8,function(_0x341272){if(_0x341272[_0x1fbb('0x39')][_0x1fbb('0x3a')]!==_0x1fbb('0x3b')){var _0x1e5e04={};_0x1e5e04[_0x341272[_0x1fbb('0x3c')]]={'$like':'%'+_0x338ced[_0x1fbb('0x2b')][_0x1fbb('0x38')]+'%'};return _0x1e5e04;}})});}_0x267bbe=_[_0x1fbb('0x3d')]({},_0x267bbe,_0x338ced[_0x1fbb('0x3e')]);var _0x34a944={'where':_0x267bbe['where']};return db[_0x1fbb('0x28')][_0x1fbb('0x1c')](_0x34a944)[_0x1fbb('0x22')](function(_0x189a14){_0x50e51f[_0x1fbb('0x1c')]=_0x189a14;if(_0x338ced[_0x1fbb('0x2b')][_0x1fbb('0x3f')]){_0x267bbe[_0x1fbb('0x40')]=[{'all':!![]}];}return db['Migration'][_0x1fbb('0x41')](_0x267bbe);})[_0x1fbb('0x22')](function(_0x548025){_0x50e51f[_0x1fbb('0x42')]=_0x548025;return _0x50e51f;})[_0x1fbb('0x22')](respondWithFilteredResult(_0xd5fb0c,_0x267bbe))[_0x1fbb('0x43')](handleError(_0xd5fb0c,null));};
\ No newline at end of file
index 795cb26..1338337 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc0d7=['moment','bluebird','request-promise','./migration.attributes','exports','define','migrations','api'];(function(_0x65c0bb,_0x82e7b8){var _0x320bd5=function(_0x6e1675){while(--_0x6e1675){_0x65c0bb['push'](_0x65c0bb['shift']());}};_0x320bd5(++_0x82e7b8);}(_0xc0d7,0x7f));var _0x7c0d=function(_0x3d3546,_0x1687d4){_0x3d3546=_0x3d3546-0x0;var _0x44fe75=_0xc0d7[_0x3d3546];return _0x44fe75;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7c0d('0x0'));var moment=require(_0x7c0d('0x1'));var BPromise=require(_0x7c0d('0x2'));var rp=require(_0x7c0d('0x3'));var attributes=require(_0x7c0d('0x4'));module[_0x7c0d('0x5')]=function(_0xfbd3c8,_0x276b49){return _0xfbd3c8[_0x7c0d('0x6')]('Migration',attributes,{'tableName':_0x7c0d('0x7'),'paranoid':![],'indexes':[],'timestamps':![]});};
\ No newline at end of file
+var _0xf5b6=['exports','migrations','../../config/logger','api','moment','bluebird','./migration.attributes'];(function(_0x50e30b,_0x216368){var _0x4b7300=function(_0x8f06d7){while(--_0x8f06d7){_0x50e30b['push'](_0x50e30b['shift']());}};_0x4b7300(++_0x216368);}(_0xf5b6,0x1b4));var _0x6f5b=function(_0x1cbdf3,_0x2d887b){_0x1cbdf3=_0x1cbdf3-0x0;var _0x49ca5d=_0xf5b6[_0x1cbdf3];return _0x49ca5d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6f5b('0x0'))(_0x6f5b('0x1'));var moment=require(_0x6f5b('0x2'));var BPromise=require(_0x6f5b('0x3'));var rp=require('request-promise');var attributes=require(_0x6f5b('0x4'));module[_0x6f5b('0x5')]=function(_0x2dea52,_0x475ec4){return _0x2dea52['define']('Migration',attributes,{'tableName':_0x6f5b('0x6'),'paranoid':![],'indexes':[],'timestamps':![]});};
\ No newline at end of file
index 9cfb769..fcbd830 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','Migration,\x20%s,\x20%s','message','catch','util'];(function(_0x352255,_0x4f5adf){var _0x2d1931=function(_0x25a103){while(--_0x25a103){_0x352255['push'](_0x352255['shift']());}};_0x2d1931(++_0x4f5adf);}(_0xedd9,0xfc));var _0x9edd=function(_0x3e1c7f,_0x2d927b){_0x3e1c7f=_0x3e1c7f-0x0;var _0x5f3213=_0xedd9[_0x3e1c7f];return _0x5f3213;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('Migration,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('Migration,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});}
\ No newline at end of file
+var _0x9a19=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3f94f9,_0x42774b){var _0x46f84f=function(_0xa080d8){while(--_0xa080d8){_0x3f94f9['push'](_0x3f94f9['shift']());}};_0x46f84f(++_0x42774b);}(_0x9a19,0x114));var _0x99a1=function(_0x10dc64,_0x11bb29){_0x10dc64=_0x10dc64-0x0;var _0x9cf98d=_0x9a19[_0x10dc64];return _0x9cf98d;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var moment=require(_0x99a1('0x2'));var BPromise=require('bluebird');var rs=require(_0x99a1('0x3'));var fs=require('fs');var Redis=require(_0x99a1('0x4'));var db=require(_0x99a1('0x5'))['db'];var utils=require(_0x99a1('0x6'));var logger=require(_0x99a1('0x7'))(_0x99a1('0x8'));var config=require(_0x99a1('0x9'));var jayson=require(_0x99a1('0xa'));var client=jayson[_0x99a1('0xb')][_0x99a1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x65045d,_0x523b9e,_0x4d2a5c){return new BPromise(function(_0x5aa6c2,_0x56f50){return client[_0x99a1('0xd')](_0x65045d,_0x4d2a5c)['then'](function(_0x5874fc){logger[_0x99a1('0xe')](_0x99a1('0xf'),_0x523b9e,_0x99a1('0x10'));logger[_0x99a1('0x11')](_0x99a1('0x12'),_0x523b9e,'request\x20sent',JSON[_0x99a1('0x13')](_0x5874fc));if(_0x5874fc[_0x99a1('0x14')]){if(_0x5874fc[_0x99a1('0x14')][_0x99a1('0x15')]===0x1f4){logger[_0x99a1('0x14')](_0x99a1('0xf'),_0x523b9e,_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);return _0x56f50(_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);}logger[_0x99a1('0x14')](_0x99a1('0xf'),_0x523b9e,_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);return _0x5aa6c2(_0x5874fc[_0x99a1('0x14')]['message']);}else{logger[_0x99a1('0xe')](_0x99a1('0xf'),_0x523b9e,_0x99a1('0x10'));_0x5aa6c2(_0x5874fc[_0x99a1('0x17')][_0x99a1('0x16')]);}})[_0x99a1('0x18')](function(_0x1ca878){logger['error']('Migration,\x20%s,\x20%s',_0x523b9e,_0x1ca878);_0x56f50(_0x1ca878);});});}
\ No newline at end of file
index 7b0b14e..01ee98c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbe25=['destroy','exports','multer','util','path','connect-timeout','express','./network.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete'];(function(_0x5198d3,_0x28f2ce){var _0xb145dd=function(_0x88d32f){while(--_0x88d32f){_0x5198d3['push'](_0x5198d3['shift']());}};_0xb145dd(++_0x28f2ce);}(_0xbe25,0x1ab));var _0x5be2=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xbe25[_0x344a3f];return _0x264712;};'use strict';var multer=require(_0x5be2('0x0'));var util=require(_0x5be2('0x1'));var path=require(_0x5be2('0x2'));var timeout=require(_0x5be2('0x3'));var express=require(_0x5be2('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5be2('0x5'));router[_0x5be2('0x6')]('/',auth[_0x5be2('0x7')](),controller[_0x5be2('0x8')]);router[_0x5be2('0x6')](_0x5be2('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x5be2('0xa')]('/',auth[_0x5be2('0x7')](),controller[_0x5be2('0xb')]);router[_0x5be2('0xc')](_0x5be2('0x9'),auth[_0x5be2('0x7')](),controller[_0x5be2('0xd')]);router[_0x5be2('0xe')](_0x5be2('0x9'),auth['isAuthenticated'](),controller[_0x5be2('0xf')]);module[_0x5be2('0x10')]=router;
\ No newline at end of file
+var _0x7b47=['/:id','show','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x18d366,_0x52cb78){var _0x1c38b6=function(_0x2971e9){while(--_0x2971e9){_0x18d366['push'](_0x18d366['shift']());}};_0x1c38b6(++_0x52cb78);}(_0x7b47,0x118));var _0x77b4=function(_0x4f5393,_0x2cf8c3){_0x4f5393=_0x4f5393-0x0;var _0x1a97c3=_0x7b47[_0x4f5393];return _0x1a97c3;};'use strict';var multer=require('multer');var util=require(_0x77b4('0x0'));var path=require('path');var timeout=require(_0x77b4('0x1'));var express=require(_0x77b4('0x2'));var router=express[_0x77b4('0x3')]();var auth=require(_0x77b4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x77b4('0x5'));var controller=require('./network.controller');router[_0x77b4('0x6')]('/',auth[_0x77b4('0x7')](),controller[_0x77b4('0x8')]);router[_0x77b4('0x6')](_0x77b4('0x9'),auth[_0x77b4('0x7')](),controller[_0x77b4('0xa')]);router['post']('/',auth[_0x77b4('0x7')](),controller[_0x77b4('0xb')]);router[_0x77b4('0xc')]('/:id',auth[_0x77b4('0x7')](),controller[_0x77b4('0xd')]);router[_0x77b4('0xe')](_0x77b4('0x9'),auth[_0x77b4('0x7')](),controller[_0x77b4('0xf')]);module[_0x77b4('0x10')]=router;
\ No newline at end of file
index 5df00db..9905247 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x230e=['exports','localnet','externip','sequelize'];(function(_0x422945,_0x159d82){var _0x2dda86=function(_0x131744){while(--_0x131744){_0x422945['push'](_0x422945['shift']());}};_0x2dda86(++_0x159d82);}(_0x230e,0x16f));var _0xe230=function(_0x1415ac,_0x48591f){_0x1415ac=_0x1415ac-0x0;var _0x40e7eb=_0x230e[_0x1415ac];return _0x40e7eb;};'use strict';var Sequelize=require(_0xe230('0x0'));module[_0xe230('0x1')]={'type':{'type':Sequelize['ENUM'](_0xe230('0x2'),_0xe230('0x3'))},'value':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0xe1b6=['exports','ENUM','externip','STRING','sequelize'];(function(_0x2125f0,_0x2f23b9){var _0x12d6eb=function(_0x7a43ea){while(--_0x7a43ea){_0x2125f0['push'](_0x2125f0['shift']());}};_0x12d6eb(++_0x2f23b9);}(_0xe1b6,0x167));var _0x6e1b=function(_0xafc59,_0x447d7a){_0xafc59=_0xafc59-0x0;var _0x291af8=_0xe1b6[_0xafc59];return _0x291af8;};'use strict';var Sequelize=require(_0x6e1b('0x0'));module[_0x6e1b('0x1')]={'type':{'type':Sequelize[_0x6e1b('0x2')]('localnet',_0x6e1b('0x3'))},'value':{'type':Sequelize[_0x6e1b('0x4')]}};
\ No newline at end of file
index fce1b76..6f5db0c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8b62=['html-pdf','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','Network','rawAttributes','keys','query','intersection','attributes','model','fields','length','limit','order','sort','filters','pick','filter','where','merge','map','type','VIRTUAL','field','options','include','findAll','rows','show','params','find','create','sequelize','transaction','body','join','root','utf8','render','writeFileSync','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','Reload','chan_sip.so','readFileSync','server/files/templates/network.ejs'];(function(_0x9beaba,_0x279c65){var _0x3637bf=function(_0x4d2f4d){while(--_0x4d2f4d){_0x9beaba['push'](_0x9beaba['shift']());}};_0x3637bf(++_0x279c65);}(_0x8b62,0x184));var _0x28b6=function(_0x6aad74,_0x32ecf4){_0x6aad74=_0x6aad74-0x0;var _0x5b1c38=_0x8b62[_0x6aad74];return _0x5b1c38;};'use strict';var pdf=require(_0x28b6('0x0'));var emlformat=require(_0x28b6('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x28b6('0x2'));var rp=require(_0x28b6('0x3'));var moment=require('moment');var BPromise=require(_0x28b6('0x4'));var Mustache=require('mustache');var util=require(_0x28b6('0x5'));var path=require(_0x28b6('0x6'));var sox=require(_0x28b6('0x7'));var csv=require(_0x28b6('0x8'));var ejs=require(_0x28b6('0x9'));var fs=require('fs');var _=require(_0x28b6('0xa'));var squel=require(_0x28b6('0xb'));var crypto=require(_0x28b6('0xc'));var jsforce=require(_0x28b6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x28b6('0x8'));var querystring=require(_0x28b6('0xe'));var Papa=require(_0x28b6('0xf'));var authService=require(_0x28b6('0x10'));var hardwareService=require(_0x28b6('0x11'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x28b6('0x12'))(_0x28b6('0x13'));var utils=require(_0x28b6('0x14'));var config=require(_0x28b6('0x15'));var db=require(_0x28b6('0x16'))['db'];var jayson=require(_0x28b6('0x17'));var client=jayson['client'][_0x28b6('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x3d670e,_0x479849,_0x19331d,_0x2c3afe){return new BPromise(function(_0x5f3897,_0x559cb5){var _0x5e2ed3=_0x2c3afe||client;return _0x5e2ed3[_0x28b6('0x19')](_0x3d670e,_0x19331d)[_0x28b6('0x1a')](function(_0x20a5e2){logger[_0x28b6('0x1b')](_0x28b6('0x1c'),_0x479849,_0x28b6('0x1d'));logger[_0x28b6('0x1e')](_0x28b6('0x1f'),_0x479849,_0x28b6('0x1d'),JSON['stringify'](_0x20a5e2));if(_0x20a5e2['error']){if(_0x20a5e2[_0x28b6('0x20')][_0x28b6('0x21')]===0x1f4){logger[_0x28b6('0x20')](_0x28b6('0x1c'),_0x479849,_0x20a5e2[_0x28b6('0x20')]['message']);return _0x559cb5(_0x20a5e2[_0x28b6('0x20')][_0x28b6('0x22')]);}logger[_0x28b6('0x20')](_0x28b6('0x1c'),_0x479849,_0x20a5e2['error'][_0x28b6('0x22')]);return _0x5f3897(_0x20a5e2[_0x28b6('0x20')][_0x28b6('0x22')]);}else{logger['info'](_0x28b6('0x1c'),_0x479849,_0x28b6('0x1d'));_0x5f3897(_0x20a5e2[_0x28b6('0x23')]['message']);}})[_0x28b6('0x24')](function(_0x3c5734){logger[_0x28b6('0x20')](_0x28b6('0x1c'),_0x479849,_0x3c5734);_0x559cb5(_0x3c5734);});});}function respondWithStatusCode(_0x367bc9,_0x225440){_0x225440=_0x225440||0xcc;return function(_0x4acc15){if(_0x4acc15){return _0x367bc9[_0x28b6('0x25')](_0x225440);}return _0x367bc9[_0x28b6('0x26')](_0x225440)['end']();};}function respondWithResult(_0x360d61,_0x3b7b4d){_0x3b7b4d=_0x3b7b4d||0xc8;return function(_0x447997){if(_0x447997){return _0x360d61['status'](_0x3b7b4d)['json'](_0x447997);}};}function respondWithFilteredResult(_0x74c4b7,_0x4bc0f6){return function(_0x5fa74a){if(_0x5fa74a){var _0x1c6884=_0x5fa74a[_0x28b6('0x27')],_0x31e09b=_0x4bc0f6['offset'],_0xa553aa=_0x4bc0f6[_0x28b6('0x28')]+_0x4bc0f6['limit'],_0x13df58;if(_0xa553aa>=_0x1c6884){_0xa553aa=_0x1c6884;_0x13df58=0xc8;}else{_0x13df58=0xce;}_0x74c4b7[_0x28b6('0x26')](_0x13df58);return _0x74c4b7[_0x28b6('0x29')](_0x28b6('0x2a'),_0x31e09b+'-'+_0xa553aa+'/'+_0x1c6884)[_0x28b6('0x2b')](_0x5fa74a);}return null;};}function patchUpdates(_0x5657){return function(_0x5cc993){try{jsonpatch[_0x28b6('0x2c')](_0x5cc993,_0x5657,!![]);}catch(_0x5b47d1){return BPromise[_0x28b6('0x2d')](_0x5b47d1);}return _0x5cc993[_0x28b6('0x2e')]();};}function saveUpdates(_0x1af939,_0x29ed54){return function(_0x53b799){if(_0x53b799){return _0x53b799[_0x28b6('0x2f')](_0x1af939)[_0x28b6('0x1a')](function(_0x2f9a03){return _0x2f9a03;});}return null;};}function removeEntity(_0x8dea80,_0x321a2f){return function(_0x521ac1){if(_0x521ac1){return _0x521ac1[_0x28b6('0x30')]()[_0x28b6('0x1a')](function(){_0x8dea80['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f4c09,_0x533be8){return function(_0x4a9f1e){if(!_0x4a9f1e){_0x2f4c09['sendStatus'](0x194);}return _0x4a9f1e;};}function handleError(_0x477b41,_0x4a813c){_0x4a813c=_0x4a813c||0x1f4;return function(_0x981af2){logger[_0x28b6('0x20')](_0x981af2[_0x28b6('0x31')]);if(_0x981af2[_0x28b6('0x32')]){delete _0x981af2[_0x28b6('0x32')];}_0x477b41['status'](_0x4a813c)[_0x28b6('0x33')](_0x981af2);};}exports[_0x28b6('0x34')]=function(_0x159f5e,_0x49a0c5){var _0xf91c73={},_0x36f567={},_0x516219={'count':0x0,'rows':[]};var _0x1fb8e1=db[_0x28b6('0x35')][_0x28b6('0x36')];_0x36f567['model']=_[_0x28b6('0x37')](_0x1fb8e1);_0x36f567[_0x28b6('0x38')]=_[_0x28b6('0x37')](_0x159f5e[_0x28b6('0x38')]);_0x36f567['filters']=_[_0x28b6('0x39')](_0x36f567['model'],_0x36f567[_0x28b6('0x38')]);_0xf91c73[_0x28b6('0x3a')]=_['intersection'](_0x36f567[_0x28b6('0x3b')],qs['fields'](_0x159f5e[_0x28b6('0x38')][_0x28b6('0x3c')]));_0xf91c73[_0x28b6('0x3a')]=_0xf91c73[_0x28b6('0x3a')][_0x28b6('0x3d')]?_0xf91c73['attributes']:_0x36f567[_0x28b6('0x3b')];if(!_0x159f5e['query']['hasOwnProperty']('nolimit')){_0xf91c73[_0x28b6('0x3e')]=qs['limit'](_0x159f5e[_0x28b6('0x38')][_0x28b6('0x3e')]);_0xf91c73[_0x28b6('0x28')]=qs[_0x28b6('0x28')](_0x159f5e[_0x28b6('0x38')][_0x28b6('0x28')]);}_0xf91c73[_0x28b6('0x3f')]=qs['sort'](_0x159f5e['query'][_0x28b6('0x40')]);_0xf91c73['where']=qs[_0x28b6('0x41')](_[_0x28b6('0x42')](_0x159f5e['query'],_0x36f567[_0x28b6('0x41')]));if(_0x159f5e['query'][_0x28b6('0x43')]){_0xf91c73[_0x28b6('0x44')]=_[_0x28b6('0x45')](_0xf91c73[_0x28b6('0x44')],{'$or':_[_0x28b6('0x46')](_0x1fb8e1,function(_0x37c68b){if(_0x37c68b[_0x28b6('0x47')]['key']!==_0x28b6('0x48')){var _0x5d3560={};_0x5d3560[_0x37c68b[_0x28b6('0x49')]]={'$like':'%'+_0x159f5e[_0x28b6('0x38')][_0x28b6('0x43')]+'%'};return _0x5d3560;}})});}_0xf91c73=_[_0x28b6('0x45')]({},_0xf91c73,_0x159f5e[_0x28b6('0x4a')]);var _0x197b05={'where':_0xf91c73[_0x28b6('0x44')]};return db[_0x28b6('0x35')][_0x28b6('0x27')](_0x197b05)[_0x28b6('0x1a')](function(_0x8b647){_0x516219[_0x28b6('0x27')]=_0x8b647;if(_0x159f5e[_0x28b6('0x38')]['includeAll']){_0xf91c73[_0x28b6('0x4b')]=[{'all':!![]}];}return db['Network'][_0x28b6('0x4c')](_0xf91c73);})[_0x28b6('0x1a')](function(_0x99698b){_0x516219[_0x28b6('0x4d')]=_0x99698b;return _0x516219;})[_0x28b6('0x1a')](respondWithFilteredResult(_0x49a0c5,_0xf91c73))[_0x28b6('0x24')](handleError(_0x49a0c5,null));};exports[_0x28b6('0x4e')]=function(_0x2377b3,_0x5bd574){var _0x42f85c={'raw':!![],'where':{'id':_0x2377b3[_0x28b6('0x4f')]['id']}},_0x255c49={};_0x255c49['model']=_[_0x28b6('0x37')](db[_0x28b6('0x35')][_0x28b6('0x36')]);_0x255c49['query']=_['keys'](_0x2377b3[_0x28b6('0x38')]);_0x255c49[_0x28b6('0x41')]=_['intersection'](_0x255c49[_0x28b6('0x3b')],_0x255c49['query']);_0x42f85c[_0x28b6('0x3a')]=_[_0x28b6('0x39')](_0x255c49[_0x28b6('0x3b')],qs[_0x28b6('0x3c')](_0x2377b3[_0x28b6('0x38')][_0x28b6('0x3c')]));_0x42f85c[_0x28b6('0x3a')]=_0x42f85c[_0x28b6('0x3a')][_0x28b6('0x3d')]?_0x42f85c[_0x28b6('0x3a')]:_0x255c49[_0x28b6('0x3b')];if(_0x2377b3[_0x28b6('0x38')]['includeAll']){_0x42f85c['include']=[{'all':!![]}];}_0x42f85c=_[_0x28b6('0x45')]({},_0x42f85c,_0x2377b3[_0x28b6('0x4a')]);return db[_0x28b6('0x35')][_0x28b6('0x50')](_0x42f85c)['then'](handleEntityNotFound(_0x5bd574,null))['then'](respondWithResult(_0x5bd574,null))[_0x28b6('0x24')](handleError(_0x5bd574,null));};exports[_0x28b6('0x51')]=function(_0x4b16b4,_0xe3211b,_0x50453d){var _0x496c99;return db[_0x28b6('0x52')][_0x28b6('0x53')](function(_0x2c5298){return db[_0x28b6('0x35')][_0x28b6('0x51')](_0x4b16b4[_0x28b6('0x54')],{'raw':!![]})[_0x28b6('0x1a')](function(_0xcf60eb){_0x496c99=_0xcf60eb;return db[_0x28b6('0x35')][_0x28b6('0x4c')]({'where':{'type':_0x4b16b4[_0x28b6('0x54')][_0x28b6('0x47')]},'raw':!![]});})['then'](function(_0xf37327){var _0x5a1417=fs['readFileSync'](path[_0x28b6('0x55')](config[_0x28b6('0x56')],'server/files/templates/network.ejs'),_0x28b6('0x57'));var _0xbf8d6a=ejs[_0x28b6('0x58')](_0x5a1417,{'networks':_0xf37327||[]});fs[_0x28b6('0x59')](util[_0x28b6('0x5a')](_0x28b6('0x5b'),_0x4b16b4[_0x28b6('0x54')][_0x28b6('0x47')][_0x28b6('0x5c')]()),_0xbf8d6a);})[_0x28b6('0x1a')](function(){return respondWithRpcPromise(_0x28b6('0x5d'),_0x28b6('0x51'),{'module':_0x28b6('0x5e')});})[_0x28b6('0x1a')](function(){return _0x496c99;});})[_0x28b6('0x1a')](respondWithResult(_0xe3211b,0xc9))['catch'](handleError(_0xe3211b,null));};exports[_0x28b6('0x2f')]=function(_0x24b281,_0x1255aa,_0x4e66f1){var _0x24f81f;return db[_0x28b6('0x52')][_0x28b6('0x53')](function(_0x380053){return db[_0x28b6('0x35')][_0x28b6('0x50')]({'where':{'id':_0x24b281[_0x28b6('0x4f')]['id']}})[_0x28b6('0x1a')](handleEntityNotFound(_0x1255aa,null))[_0x28b6('0x1a')](saveUpdates(_0x24b281[_0x28b6('0x54')],null))['then'](function(_0x1e3530){if(_0x1e3530){_0x24f81f=_0x1e3530;return db[_0x28b6('0x35')][_0x28b6('0x4c')]({'where':{'type':_0x24f81f[_0x28b6('0x47')]},'raw':!![]});}return null;})[_0x28b6('0x1a')](function(_0x118611){if(_0x118611){var _0x4e1f22=fs[_0x28b6('0x5f')](path[_0x28b6('0x55')](config['root'],'server/files/templates/network.ejs'),_0x28b6('0x57'));var _0x22a711=ejs[_0x28b6('0x58')](_0x4e1f22,{'networks':_0x118611||[]});fs[_0x28b6('0x59')](util['format'](_0x28b6('0x5b'),_0x24f81f['type'][_0x28b6('0x5c')]()),_0x22a711);return respondWithRpcPromise(_0x28b6('0x5d'),_0x28b6('0x2f'),{'module':_0x28b6('0x5e')});}return null;})[_0x28b6('0x1a')](function(_0x408f83){if(_0x408f83){return _0x24f81f;}return null;});})['then'](respondWithResult(_0x1255aa,null))['catch'](handleError(_0x1255aa,null));};exports[_0x28b6('0x30')]=function(_0x37b7ff,_0x3851c1,_0x1351e0){var _0x107f29;return db[_0x28b6('0x35')]['find']({'where':{'id':_0x37b7ff[_0x28b6('0x4f')]['id']}})[_0x28b6('0x1a')](function(_0x11b788){_0x107f29=_0x11b788;return _0x11b788;})['then'](handleEntityNotFound(_0x3851c1,null))[_0x28b6('0x1a')](removeEntity(_0x3851c1,null))[_0x28b6('0x1a')](function(){if(_0x107f29){return db[_0x28b6('0x35')][_0x28b6('0x4c')]({'where':{'type':_0x107f29[_0x28b6('0x47')]},'raw':!![]});}})[_0x28b6('0x1a')](function(_0x2b88be){if(_0x2b88be){var _0x2ae4ba=fs[_0x28b6('0x5f')](path[_0x28b6('0x55')](config[_0x28b6('0x56')],_0x28b6('0x60')),_0x28b6('0x57'));var _0x2575c0=ejs[_0x28b6('0x58')](_0x2ae4ba,{'networks':_0x2b88be||[]});fs[_0x28b6('0x59')](util[_0x28b6('0x5a')](_0x28b6('0x5b'),_0x107f29[_0x28b6('0x47')]['toLowerCase']()),_0x2575c0);return respondWithRpcPromise('Reload','destroy',{'module':_0x28b6('0x5e')});}})[_0x28b6('0x24')](handleError(_0x3851c1,null));};
\ No newline at end of file
+var _0xb44e=['filter','where','merge','map','type','VIRTUAL','field','options','Network','includeAll','include','findAll','rows','params','find','catch','create','sequelize','transaction','body','readFileSync','join','root','server/files/templates/network.ejs','render','writeFileSync','format','toLowerCase','Reload','chan_sip.so','/etc/asterisk/sip_xcally_%s.conf','utf8','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','then','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','index','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x4956e7,_0x17fe2c){var _0x1f33e9=function(_0x23ce8a){while(--_0x23ce8a){_0x4956e7['push'](_0x4956e7['shift']());}};_0x1f33e9(++_0x17fe2c);}(_0xb44e,0x82));var _0xeb44=function(_0x175e89,_0x20835f){_0x175e89=_0x175e89-0x0;var _0x2ed996=_0xb44e[_0x175e89];return _0x2ed996;};'use strict';var pdf=require(_0xeb44('0x0'));var emlformat=require(_0xeb44('0x1'));var rimraf=require(_0xeb44('0x2'));var zipdir=require(_0xeb44('0x3'));var jsonpatch=require(_0xeb44('0x4'));var rp=require('request-promise');var moment=require(_0xeb44('0x5'));var BPromise=require(_0xeb44('0x6'));var Mustache=require(_0xeb44('0x7'));var util=require(_0xeb44('0x8'));var path=require(_0xeb44('0x9'));var sox=require('sox');var csv=require(_0xeb44('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeb44('0xb'));var squel=require(_0xeb44('0xc'));var crypto=require(_0xeb44('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xeb44('0xa'));var querystring=require(_0xeb44('0xe'));var Papa=require('papaparse');var authService=require(_0xeb44('0xf'));var hardwareService=require(_0xeb44('0x10'));var Redis=require(_0xeb44('0x11'));var qs=require(_0xeb44('0x12'));var logger=require(_0xeb44('0x13'))(_0xeb44('0x14'));var utils=require(_0xeb44('0x15'));var config=require(_0xeb44('0x16'));var db=require(_0xeb44('0x17'))['db'];var jayson=require(_0xeb44('0x18'));var client=jayson[_0xeb44('0x19')][_0xeb44('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x686656,_0x1b49d6,_0x1b1109,_0x4fc2c8){return new BPromise(function(_0x4aa1bd,_0x4bdd57){var _0x55af09=_0x4fc2c8||client;return _0x55af09['request'](_0x686656,_0x1b1109)[_0xeb44('0x1b')](function(_0x50c763){logger['info'](_0xeb44('0x1c'),_0x1b49d6,_0xeb44('0x1d'));logger['debug'](_0xeb44('0x1e'),_0x1b49d6,_0xeb44('0x1d'),JSON[_0xeb44('0x1f')](_0x50c763));if(_0x50c763[_0xeb44('0x20')]){if(_0x50c763[_0xeb44('0x20')][_0xeb44('0x21')]===0x1f4){logger[_0xeb44('0x20')]('Network,\x20%s,\x20%s',_0x1b49d6,_0x50c763[_0xeb44('0x20')][_0xeb44('0x22')]);return _0x4bdd57(_0x50c763[_0xeb44('0x20')][_0xeb44('0x22')]);}logger['error'](_0xeb44('0x1c'),_0x1b49d6,_0x50c763[_0xeb44('0x20')][_0xeb44('0x22')]);return _0x4aa1bd(_0x50c763[_0xeb44('0x20')][_0xeb44('0x22')]);}else{logger['info'](_0xeb44('0x1c'),_0x1b49d6,_0xeb44('0x1d'));_0x4aa1bd(_0x50c763[_0xeb44('0x23')][_0xeb44('0x22')]);}})['catch'](function(_0x4ac586){logger[_0xeb44('0x20')](_0xeb44('0x1c'),_0x1b49d6,_0x4ac586);_0x4bdd57(_0x4ac586);});});}function respondWithStatusCode(_0x1885e3,_0x180cf6){_0x180cf6=_0x180cf6||0xcc;return function(_0x5c3361){if(_0x5c3361){return _0x1885e3[_0xeb44('0x24')](_0x180cf6);}return _0x1885e3[_0xeb44('0x25')](_0x180cf6)[_0xeb44('0x26')]();};}function respondWithResult(_0x177f80,_0x59ddf0){_0x59ddf0=_0x59ddf0||0xc8;return function(_0x3c5333){if(_0x3c5333){return _0x177f80[_0xeb44('0x25')](_0x59ddf0)[_0xeb44('0x27')](_0x3c5333);}};}function respondWithFilteredResult(_0x483214,_0x38a93f){return function(_0x96f6c7){if(_0x96f6c7){var _0x4ea48f=_0x96f6c7[_0xeb44('0x28')],_0x107008=_0x38a93f[_0xeb44('0x29')],_0xda40d9=_0x38a93f[_0xeb44('0x29')]+_0x38a93f[_0xeb44('0x2a')],_0x3fc2e1;if(_0xda40d9>=_0x4ea48f){_0xda40d9=_0x4ea48f;_0x3fc2e1=0xc8;}else{_0x3fc2e1=0xce;}_0x483214[_0xeb44('0x25')](_0x3fc2e1);return _0x483214[_0xeb44('0x2b')]('Content-Range',_0x107008+'-'+_0xda40d9+'/'+_0x4ea48f)[_0xeb44('0x27')](_0x96f6c7);}return null;};}function patchUpdates(_0x512a00){return function(_0x209531){try{jsonpatch[_0xeb44('0x2c')](_0x209531,_0x512a00,!![]);}catch(_0x25a172){return BPromise[_0xeb44('0x2d')](_0x25a172);}return _0x209531[_0xeb44('0x2e')]();};}function saveUpdates(_0x1cd9f8,_0x3a4427){return function(_0x5dcdcc){if(_0x5dcdcc){return _0x5dcdcc[_0xeb44('0x2f')](_0x1cd9f8)[_0xeb44('0x1b')](function(_0x4353c1){return _0x4353c1;});}return null;};}function removeEntity(_0x570811,_0x3f3e0a){return function(_0x11a50e){if(_0x11a50e){return _0x11a50e[_0xeb44('0x30')]()[_0xeb44('0x1b')](function(){_0x570811[_0xeb44('0x25')](0xcc)[_0xeb44('0x26')]();});}};}function handleEntityNotFound(_0x5f134d,_0x5bbd53){return function(_0x7ac591){if(!_0x7ac591){_0x5f134d[_0xeb44('0x24')](0x194);}return _0x7ac591;};}function handleError(_0x2aea4f,_0x56b9ad){_0x56b9ad=_0x56b9ad||0x1f4;return function(_0xd4d103){logger[_0xeb44('0x20')](_0xd4d103[_0xeb44('0x31')]);if(_0xd4d103[_0xeb44('0x32')]){delete _0xd4d103[_0xeb44('0x32')];}_0x2aea4f[_0xeb44('0x25')](_0x56b9ad)['send'](_0xd4d103);};}exports[_0xeb44('0x33')]=function(_0x5bc7ef,_0x1edc97){var _0x2d158a={},_0xab1c11={},_0x4e7299={'count':0x0,'rows':[]};var _0x30cef2=db['Network'][_0xeb44('0x34')];_0xab1c11[_0xeb44('0x35')]=_[_0xeb44('0x36')](_0x30cef2);_0xab1c11[_0xeb44('0x37')]=_[_0xeb44('0x36')](_0x5bc7ef[_0xeb44('0x37')]);_0xab1c11[_0xeb44('0x38')]=_['intersection'](_0xab1c11[_0xeb44('0x35')],_0xab1c11['query']);_0x2d158a[_0xeb44('0x39')]=_[_0xeb44('0x3a')](_0xab1c11[_0xeb44('0x35')],qs[_0xeb44('0x3b')](_0x5bc7ef['query'][_0xeb44('0x3b')]));_0x2d158a[_0xeb44('0x39')]=_0x2d158a[_0xeb44('0x39')][_0xeb44('0x3c')]?_0x2d158a[_0xeb44('0x39')]:_0xab1c11['model'];if(!_0x5bc7ef['query'][_0xeb44('0x3d')](_0xeb44('0x3e'))){_0x2d158a[_0xeb44('0x2a')]=qs['limit'](_0x5bc7ef[_0xeb44('0x37')][_0xeb44('0x2a')]);_0x2d158a[_0xeb44('0x29')]=qs[_0xeb44('0x29')](_0x5bc7ef[_0xeb44('0x37')]['offset']);}_0x2d158a[_0xeb44('0x3f')]=qs[_0xeb44('0x40')](_0x5bc7ef[_0xeb44('0x37')][_0xeb44('0x40')]);_0x2d158a['where']=qs['filters'](_[_0xeb44('0x41')](_0x5bc7ef[_0xeb44('0x37')],_0xab1c11[_0xeb44('0x38')]));if(_0x5bc7ef[_0xeb44('0x37')][_0xeb44('0x42')]){_0x2d158a[_0xeb44('0x43')]=_[_0xeb44('0x44')](_0x2d158a['where'],{'$or':_[_0xeb44('0x45')](_0x30cef2,function(_0x1718df){if(_0x1718df[_0xeb44('0x46')]['key']!==_0xeb44('0x47')){var _0x4be467={};_0x4be467[_0x1718df[_0xeb44('0x48')]]={'$like':'%'+_0x5bc7ef[_0xeb44('0x37')][_0xeb44('0x42')]+'%'};return _0x4be467;}})});}_0x2d158a=_['merge']({},_0x2d158a,_0x5bc7ef[_0xeb44('0x49')]);var _0x43ed33={'where':_0x2d158a['where']};return db[_0xeb44('0x4a')][_0xeb44('0x28')](_0x43ed33)[_0xeb44('0x1b')](function(_0x437ba1){_0x4e7299['count']=_0x437ba1;if(_0x5bc7ef[_0xeb44('0x37')][_0xeb44('0x4b')]){_0x2d158a[_0xeb44('0x4c')]=[{'all':!![]}];}return db[_0xeb44('0x4a')][_0xeb44('0x4d')](_0x2d158a);})['then'](function(_0x322387){_0x4e7299[_0xeb44('0x4e')]=_0x322387;return _0x4e7299;})[_0xeb44('0x1b')](respondWithFilteredResult(_0x1edc97,_0x2d158a))['catch'](handleError(_0x1edc97,null));};exports['show']=function(_0x2ff397,_0x48e32c){var _0xad0394={'raw':!![],'where':{'id':_0x2ff397[_0xeb44('0x4f')]['id']}},_0x5a1851={};_0x5a1851[_0xeb44('0x35')]=_[_0xeb44('0x36')](db['Network'][_0xeb44('0x34')]);_0x5a1851[_0xeb44('0x37')]=_[_0xeb44('0x36')](_0x2ff397[_0xeb44('0x37')]);_0x5a1851[_0xeb44('0x38')]=_[_0xeb44('0x3a')](_0x5a1851[_0xeb44('0x35')],_0x5a1851[_0xeb44('0x37')]);_0xad0394[_0xeb44('0x39')]=_['intersection'](_0x5a1851[_0xeb44('0x35')],qs['fields'](_0x2ff397[_0xeb44('0x37')][_0xeb44('0x3b')]));_0xad0394[_0xeb44('0x39')]=_0xad0394[_0xeb44('0x39')][_0xeb44('0x3c')]?_0xad0394[_0xeb44('0x39')]:_0x5a1851[_0xeb44('0x35')];if(_0x2ff397['query'][_0xeb44('0x4b')]){_0xad0394[_0xeb44('0x4c')]=[{'all':!![]}];}_0xad0394=_['merge']({},_0xad0394,_0x2ff397[_0xeb44('0x49')]);return db[_0xeb44('0x4a')][_0xeb44('0x50')](_0xad0394)[_0xeb44('0x1b')](handleEntityNotFound(_0x48e32c,null))[_0xeb44('0x1b')](respondWithResult(_0x48e32c,null))[_0xeb44('0x51')](handleError(_0x48e32c,null));};exports[_0xeb44('0x52')]=function(_0x1cadc9,_0x4c5d21,_0x19277d){var _0x11940c;return db[_0xeb44('0x53')][_0xeb44('0x54')](function(_0x513602){return db[_0xeb44('0x4a')][_0xeb44('0x52')](_0x1cadc9['body'],{'raw':!![]})[_0xeb44('0x1b')](function(_0x42eda7){_0x11940c=_0x42eda7;return db[_0xeb44('0x4a')][_0xeb44('0x4d')]({'where':{'type':_0x1cadc9[_0xeb44('0x55')]['type']},'raw':!![]});})[_0xeb44('0x1b')](function(_0x524000){var _0xca8b7a=fs[_0xeb44('0x56')](path[_0xeb44('0x57')](config[_0xeb44('0x58')],_0xeb44('0x59')),'utf8');var _0x3fc651=ejs[_0xeb44('0x5a')](_0xca8b7a,{'networks':_0x524000||[]});fs[_0xeb44('0x5b')](util[_0xeb44('0x5c')]('/etc/asterisk/sip_xcally_%s.conf',_0x1cadc9[_0xeb44('0x55')]['type'][_0xeb44('0x5d')]()),_0x3fc651);})['then'](function(){return respondWithRpcPromise(_0xeb44('0x5e'),_0xeb44('0x52'),{'module':_0xeb44('0x5f')});})[_0xeb44('0x1b')](function(){return _0x11940c;});})[_0xeb44('0x1b')](respondWithResult(_0x4c5d21,0xc9))['catch'](handleError(_0x4c5d21,null));};exports[_0xeb44('0x2f')]=function(_0x208402,_0x5d50b6,_0x273fcb){var _0x2822b5;return db[_0xeb44('0x53')][_0xeb44('0x54')](function(_0x4b6755){return db['Network']['find']({'where':{'id':_0x208402[_0xeb44('0x4f')]['id']}})[_0xeb44('0x1b')](handleEntityNotFound(_0x5d50b6,null))['then'](saveUpdates(_0x208402[_0xeb44('0x55')],null))[_0xeb44('0x1b')](function(_0x16d700){if(_0x16d700){_0x2822b5=_0x16d700;return db[_0xeb44('0x4a')][_0xeb44('0x4d')]({'where':{'type':_0x2822b5[_0xeb44('0x46')]},'raw':!![]});}return null;})[_0xeb44('0x1b')](function(_0x26a8a2){if(_0x26a8a2){var _0x4ee19b=fs[_0xeb44('0x56')](path[_0xeb44('0x57')](config['root'],'server/files/templates/network.ejs'),'utf8');var _0x47d0c9=ejs[_0xeb44('0x5a')](_0x4ee19b,{'networks':_0x26a8a2||[]});fs['writeFileSync'](util['format'](_0xeb44('0x60'),_0x2822b5[_0xeb44('0x46')][_0xeb44('0x5d')]()),_0x47d0c9);return respondWithRpcPromise(_0xeb44('0x5e'),_0xeb44('0x2f'),{'module':'chan_sip.so'});}return null;})['then'](function(_0xbb340e){if(_0xbb340e){return _0x2822b5;}return null;});})[_0xeb44('0x1b')](respondWithResult(_0x5d50b6,null))['catch'](handleError(_0x5d50b6,null));};exports[_0xeb44('0x30')]=function(_0x1d5eb1,_0x494ec3,_0x3f4ec7){var _0xe6b0be;return db[_0xeb44('0x4a')][_0xeb44('0x50')]({'where':{'id':_0x1d5eb1[_0xeb44('0x4f')]['id']}})[_0xeb44('0x1b')](function(_0x3663d7){_0xe6b0be=_0x3663d7;return _0x3663d7;})[_0xeb44('0x1b')](handleEntityNotFound(_0x494ec3,null))['then'](removeEntity(_0x494ec3,null))[_0xeb44('0x1b')](function(){if(_0xe6b0be){return db['Network']['findAll']({'where':{'type':_0xe6b0be[_0xeb44('0x46')]},'raw':!![]});}})[_0xeb44('0x1b')](function(_0x12bc6b){if(_0x12bc6b){var _0x11a101=fs[_0xeb44('0x56')](path[_0xeb44('0x57')](config[_0xeb44('0x58')],'server/files/templates/network.ejs'),_0xeb44('0x61'));var _0x4cd8da=ejs[_0xeb44('0x5a')](_0x11a101,{'networks':_0x12bc6b||[]});fs[_0xeb44('0x5b')](util[_0xeb44('0x5c')](_0xeb44('0x60'),_0xe6b0be[_0xeb44('0x46')][_0xeb44('0x5d')]()),_0x4cd8da);return respondWithRpcPromise(_0xeb44('0x5e'),'destroy',{'module':_0xeb44('0x5f')});}})[_0xeb44('0x51')](handleError(_0x494ec3,null));};
\ No newline at end of file
index 0af8fc2..277e494 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1186=['lodash','util','../../config/logger','bluebird','define','network'];(function(_0x44f3a1,_0x47ded1){var _0x235638=function(_0x58e52d){while(--_0x58e52d){_0x44f3a1['push'](_0x44f3a1['shift']());}};_0x235638(++_0x47ded1);}(_0x1186,0x78));var _0x6118=function(_0x1dd001,_0x497201){_0x1dd001=_0x1dd001-0x0;var _0x45f77f=_0x1186[_0x1dd001];return _0x45f77f;};'use strict';var _=require(_0x6118('0x0'));var util=require(_0x6118('0x1'));var logger=require(_0x6118('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6118('0x3'));var rp=require('request-promise');var attributes=require('./network.attributes');module['exports']=function(_0x4d8352,_0x3480a1){return _0x4d8352[_0x6118('0x4')]('Network',attributes,{'tableName':_0x6118('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x1313=['lodash','util','api','moment','exports','define','Network'];(function(_0x21291d,_0x244d40){var _0x1ab0a3=function(_0x42c297){while(--_0x42c297){_0x21291d['push'](_0x21291d['shift']());}};_0x1ab0a3(++_0x244d40);}(_0x1313,0x8c));var _0x3131=function(_0xefdb72,_0x33581b){_0xefdb72=_0xefdb72-0x0;var _0x40d816=_0x1313[_0xefdb72];return _0x40d816;};'use strict';var _=require(_0x3131('0x0'));var util=require(_0x3131('0x1'));var logger=require('../../config/logger')(_0x3131('0x2'));var moment=require(_0x3131('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./network.attributes');module[_0x3131('0x4')]=function(_0x4f71d8,_0x347c70){return _0x4f71d8[_0x3131('0x5')](_0x3131('0x6'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index ba4333b..e000f83 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5fd1=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','Network,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash'];(function(_0x434f85,_0x241072){var _0x14c8af=function(_0x391746){while(--_0x391746){_0x434f85['push'](_0x434f85['shift']());}};_0x14c8af(++_0x241072);}(_0x5fd1,0x155));var _0x15fd=function(_0x2eaa86,_0x614702){_0x2eaa86=_0x2eaa86-0x0;var _0x11767f=_0x5fd1[_0x2eaa86];return _0x11767f;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var moment=require(_0x15fd('0x1'));var BPromise=require(_0x15fd('0x2'));var rs=require(_0x15fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x15fd('0x4'));var logger=require(_0x15fd('0x5'))(_0x15fd('0x6'));var config=require('../../config/environment');var jayson=require(_0x15fd('0x7'));var client=jayson[_0x15fd('0x8')][_0x15fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e88bf,_0x225728,_0x534e63){return new BPromise(function(_0x210e90,_0x1ee117){return client[_0x15fd('0xa')](_0x2e88bf,_0x534e63)['then'](function(_0x2d2fbb){logger['info'](_0x15fd('0xb'),_0x225728,_0x15fd('0xc'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x225728,'request\x20sent',JSON[_0x15fd('0xd')](_0x2d2fbb));if(_0x2d2fbb[_0x15fd('0xe')]){if(_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0xf')]===0x1f4){logger[_0x15fd('0xe')](_0x15fd('0xb'),_0x225728,_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);return _0x1ee117(_0x2d2fbb[_0x15fd('0xe')]['message']);}logger['error']('Network,\x20%s,\x20%s',_0x225728,_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);return _0x210e90(_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);}else{logger[_0x15fd('0x11')](_0x15fd('0xb'),_0x225728,_0x15fd('0xc'));_0x210e90(_0x2d2fbb[_0x15fd('0x12')]['message']);}})['catch'](function(_0x25f139){logger['error'](_0x15fd('0xb'),_0x225728,_0x25f139);_0x1ee117(_0x25f139);});});}
\ No newline at end of file
+var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x143cfd,_0x2912b3){var _0x4355a6=function(_0x493fc2){while(--_0x493fc2){_0x143cfd['push'](_0x143cfd['shift']());}};_0x4355a6(++_0x2912b3);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xc4aa[_0x1928c9];return _0x51b5fb;};'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')]('Network,\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 2f0a52c..e5adcc4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x46eb=['get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents','post','addDisposition','addAnswer','/:id/notify','addAgents','send','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller'];(function(_0x58f152,_0x48eee4){var _0x56f250=function(_0x45a1a0){while(--_0x45a1a0){_0x58f152['push'](_0x58f152['shift']());}};_0x56f250(++_0x48eee4);}(_0x46eb,0x16a));var _0xb46e=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x46eb[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xb46e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb46e('0x1'));var express=require(_0xb46e('0x2'));var router=express[_0xb46e('0x3')]();var auth=require(_0xb46e('0x4'));var interaction=require(_0xb46e('0x5'));var config=require(_0xb46e('0x6'));var controller=require(_0xb46e('0x7'));router[_0xb46e('0x8')]('/',auth[_0xb46e('0x9')](),controller['index']);router[_0xb46e('0x8')](_0xb46e('0xa'),auth[_0xb46e('0x9')](),controller[_0xb46e('0xb')]);router[_0xb46e('0x8')]('/:id',auth[_0xb46e('0x9')](),controller[_0xb46e('0xc')]);router[_0xb46e('0x8')](_0xb46e('0xd'),auth[_0xb46e('0x9')](),controller[_0xb46e('0xe')]);router['get'](_0xb46e('0xf'),auth[_0xb46e('0x9')](),controller[_0xb46e('0x10')]);router['get'](_0xb46e('0x11'),auth[_0xb46e('0x9')](),controller['getApplications']);router[_0xb46e('0x8')](_0xb46e('0x12'),auth[_0xb46e('0x9')](),controller[_0xb46e('0x13')]);router[_0xb46e('0x8')](_0xb46e('0x14'),auth[_0xb46e('0x9')](),controller[_0xb46e('0x15')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xb46e('0x16')](_0xb46e('0xd'),auth[_0xb46e('0x9')](),controller[_0xb46e('0x17')]);router['post'](_0xb46e('0xf'),auth[_0xb46e('0x9')](),controller[_0xb46e('0x18')]);router[_0xb46e('0x16')](_0xb46e('0x19'),controller['notify']);router[_0xb46e('0x16')](_0xb46e('0x11'),auth[_0xb46e('0x9')](),controller['addApplications']);router[_0xb46e('0x16')](_0xb46e('0x14'),auth[_0xb46e('0x9')](),controller[_0xb46e('0x1a')]);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0xb46e('0x1b')]);router[_0xb46e('0x1c')](_0xb46e('0x1d'),auth[_0xb46e('0x9')](),controller[_0xb46e('0x1e')]);router[_0xb46e('0x1f')](_0xb46e('0x1d'),auth[_0xb46e('0x9')](),controller[_0xb46e('0x20')]);router[_0xb46e('0x1f')](_0xb46e('0xd'),auth[_0xb46e('0x9')](),controller[_0xb46e('0x21')]);router[_0xb46e('0x1f')](_0xb46e('0xf'),auth[_0xb46e('0x9')](),controller[_0xb46e('0x22')]);router[_0xb46e('0x1f')](_0xb46e('0x14'),auth[_0xb46e('0x9')](),controller[_0xb46e('0x23')]);module[_0xb46e('0x24')]=router;
\ No newline at end of file
+var _0x7afb=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller'];(function(_0x2a20c5,_0x10249c){var _0x1a1732=function(_0x4e9882){while(--_0x4e9882){_0x2a20c5['push'](_0x2a20c5['shift']());}};_0x1a1732(++_0x10249c);}(_0x7afb,0x1c6));var _0xb7af=function(_0x42f529,_0x4b7f7b){_0x42f529=_0x42f529-0x0;var _0x28a722=_0x7afb[_0x42f529];return _0x28a722;};'use strict';var multer=require(_0xb7af('0x0'));var util=require(_0xb7af('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb7af('0x2'));var router=express[_0xb7af('0x3')]();var auth=require(_0xb7af('0x4'));var interaction=require(_0xb7af('0x5'));var config=require(_0xb7af('0x6'));var controller=require(_0xb7af('0x7'));router[_0xb7af('0x8')]('/',auth[_0xb7af('0x9')](),controller[_0xb7af('0xa')]);router['get'](_0xb7af('0xb'),auth[_0xb7af('0x9')](),controller[_0xb7af('0xc')]);router[_0xb7af('0x8')](_0xb7af('0xd'),auth[_0xb7af('0x9')](),controller[_0xb7af('0xe')]);router[_0xb7af('0x8')](_0xb7af('0xf'),auth[_0xb7af('0x9')](),controller[_0xb7af('0x10')]);router[_0xb7af('0x8')](_0xb7af('0x11'),auth[_0xb7af('0x9')](),controller[_0xb7af('0x12')]);router[_0xb7af('0x8')](_0xb7af('0x13'),auth[_0xb7af('0x9')](),controller[_0xb7af('0x14')]);router['get'](_0xb7af('0x15'),auth[_0xb7af('0x9')](),controller[_0xb7af('0x16')]);router[_0xb7af('0x8')](_0xb7af('0x17'),auth['isAuthenticated'](),controller[_0xb7af('0x18')]);router[_0xb7af('0x19')]('/',auth[_0xb7af('0x9')](),controller[_0xb7af('0x1a')]);router[_0xb7af('0x19')](_0xb7af('0xf'),auth['isAuthenticated'](),controller[_0xb7af('0x1b')]);router[_0xb7af('0x19')](_0xb7af('0x11'),auth[_0xb7af('0x9')](),controller[_0xb7af('0x1c')]);router[_0xb7af('0x19')](_0xb7af('0x1d'),controller[_0xb7af('0x1e')]);router[_0xb7af('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0xb7af('0x1f')]);router['post'](_0xb7af('0x17'),auth['isAuthenticated'](),controller[_0xb7af('0x20')]);router[_0xb7af('0x19')](_0xb7af('0x21'),auth[_0xb7af('0x9')](),controller[_0xb7af('0x22')]);router[_0xb7af('0x23')]('/:id',auth[_0xb7af('0x9')](),controller[_0xb7af('0x24')]);router[_0xb7af('0x25')](_0xb7af('0xd'),auth[_0xb7af('0x9')](),controller[_0xb7af('0x26')]);router[_0xb7af('0x25')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0xb7af('0x25')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xb7af('0x27')]);router[_0xb7af('0x25')](_0xb7af('0x17'),auth[_0xb7af('0x9')](),controller[_0xb7af('0x28')]);module[_0xb7af('0x29')]=router;
\ No newline at end of file
index a17b2e7..75a65fa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0aed=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','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'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x0aed,0xaa));var _0xd0ae=function(_0x4c075b,_0x56c2e7){_0x4c075b=_0x4c075b-0x0;var _0x228448=_0x0aed[_0x4c075b];return _0x228448;};'use strict';var Sequelize=require(_0xd0ae('0x0'));var rs=require(_0xd0ae('0x1'));module[_0xd0ae('0x2')]={'name':{'type':Sequelize[_0xd0ae('0x3')],'unique':_0xd0ae('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xd0ae('0x3')]},'token':{'type':Sequelize[_0xd0ae('0x3')],'defaultValue':function(){return rs[_0xd0ae('0x5')]();}},'replyUri':{'type':Sequelize[_0xd0ae('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xd0ae('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xd0ae('0x6')],'defaultValue':function(){return _0xd0ae('0x7');}},'notificationSound':{'type':Sequelize[_0xd0ae('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd0ae('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd0ae('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xd0ae('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd0ae('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd0ae('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd0ae('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0xd0ae('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xd0ae('0x8')],'defaultValue':![],'comment':_0xd0ae('0xb'),'set':function(_0xb490a4){if(!_0xb490a4)this['setDataValue'](_0xd0ae('0xc'),null);this[_0xd0ae('0xd')](_0xd0ae('0xe'),_0xb490a4);}}};
\ No newline at end of file
+var _0xe0b5=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}'];(function(_0x3cf3ba,_0x398d60){var _0x5da3c5=function(_0x1fce8a){while(--_0x1fce8a){_0x3cf3ba['push'](_0x3cf3ba['shift']());}};_0x5da3c5(++_0x398d60);}(_0xe0b5,0xe2));var _0x5e0b=function(_0x30dd7b,_0xbc6b1a){_0x30dd7b=_0x30dd7b-0x0;var _0x1941df=_0xe0b5[_0x30dd7b];return _0x1941df;};'use strict';var Sequelize=require(_0x5e0b('0x0'));var rs=require(_0x5e0b('0x1'));module[_0x5e0b('0x2')]={'name':{'type':Sequelize[_0x5e0b('0x3')],'unique':_0x5e0b('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x5e0b('0x3')]},'token':{'type':Sequelize[_0x5e0b('0x3')],'defaultValue':function(){return rs[_0x5e0b('0x5')]();}},'replyUri':{'type':Sequelize[_0x5e0b('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5e0b('0x6')],'defaultValue':function(){return _0x5e0b('0x7');}},'notificationSound':{'type':Sequelize[_0x5e0b('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5e0b('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5e0b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x5e0b('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5e0b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5e0b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x5e0b('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x5e0b('0x8')],'defaultValue':![],'comment':_0x5e0b('0xb'),'set':function(_0x264d86){if(!_0x264d86)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0x5e0b('0xc'),_0x264d86);}}};
\ No newline at end of file
index 307a505..e0091ac 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4fd0=['threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','created','interaction','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','Contact','User','Owner','fullname','internal','Tags','color','tag','addAgents','emit','removeAgents','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','push','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../mysqldb','redis','defaults','localhost','./openchannelAccount.socket','register','jayson/promise','client','http','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','json','count','offset','limit','status','set','Content-Range','apply','reject','update','destroy','OpenchannelAccounts','UserProfileResource','name','send','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','key','VIRTUAL','filter','options','includeAll','include','rows','params','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','findOne','OpenchannelAccountId','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','contact','firstName','lastName'];(function(_0x589433,_0x3cd1d3){var _0x3976fc=function(_0x4958ae){while(--_0x4958ae){_0x589433['push'](_0x589433['shift']());}};_0x3976fc(++_0x3cd1d3);}(_0x4fd0,0xe3));var _0x04fd=function(_0x255840,_0x411b6e){_0x255840=_0x255840-0x0;var _0x40dad5=_0x4fd0[_0x255840];return _0x40dad5;};'use strict';var pdf=require(_0x04fd('0x0'));var emlformat=require(_0x04fd('0x1'));var rimraf=require(_0x04fd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x04fd('0x3'));var rp=require(_0x04fd('0x4'));var moment=require(_0x04fd('0x5'));var BPromise=require(_0x04fd('0x6'));var Mustache=require(_0x04fd('0x7'));var util=require(_0x04fd('0x8'));var path=require('path');var sox=require(_0x04fd('0x9'));var csv=require(_0x04fd('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x04fd('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x04fd('0xc'));var toCsv=require(_0x04fd('0xa'));var querystring=require(_0x04fd('0xd'));var Papa=require(_0x04fd('0xe'));var authService=require(_0x04fd('0xf'));var hardwareService=require(_0x04fd('0x10'));var Redis=require(_0x04fd('0x11'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x04fd('0x12'))['db'];config[_0x04fd('0x13')]=_[_0x04fd('0x14')](config[_0x04fd('0x13')],{'host':_0x04fd('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x04fd('0x13')]));require(_0x04fd('0x16'))[_0x04fd('0x17')](socket);var jayson=require(_0x04fd('0x18'));var client=jayson[_0x04fd('0x19')][_0x04fd('0x1a')]({'port':0x232c});var client9002=jayson[_0x04fd('0x19')][_0x04fd('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xc62b50,_0x2cdad3,_0x538ecc,_0x240dd3){return new BPromise(function(_0x248ebe,_0xd83011){var _0x2f2571=_0x240dd3||client;return _0x2f2571['request'](_0xc62b50,_0x538ecc)[_0x04fd('0x1b')](function(_0x59be60){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x2cdad3,_0x04fd('0x1c'));logger[_0x04fd('0x1d')](_0x04fd('0x1e'),_0x2cdad3,_0x04fd('0x1c'),JSON[_0x04fd('0x1f')](_0x59be60));if(_0x59be60[_0x04fd('0x20')]){if(_0x59be60[_0x04fd('0x20')][_0x04fd('0x21')]===0x1f4){logger[_0x04fd('0x20')](_0x04fd('0x22'),_0x2cdad3,_0x59be60[_0x04fd('0x20')][_0x04fd('0x23')]);return _0xd83011(_0x59be60[_0x04fd('0x20')]['message']);}logger['error'](_0x04fd('0x22'),_0x2cdad3,_0x59be60[_0x04fd('0x20')][_0x04fd('0x23')]);return _0x248ebe(_0x59be60[_0x04fd('0x20')]['message']);}else{logger[_0x04fd('0x24')](_0x04fd('0x22'),_0x2cdad3,'request\x20sent');_0x248ebe(_0x59be60[_0x04fd('0x25')][_0x04fd('0x23')]);}})[_0x04fd('0x26')](function(_0x40f5aa){logger[_0x04fd('0x20')](_0x04fd('0x22'),_0x2cdad3,_0x40f5aa);_0xd83011(_0x40f5aa);});});}function respondWithStatusCode(_0x2500f0,_0x4d4ce6){_0x4d4ce6=_0x4d4ce6||0xcc;return function(_0x43388a){if(_0x43388a){return _0x2500f0[_0x04fd('0x27')](_0x4d4ce6);}return _0x2500f0['status'](_0x4d4ce6)['end']();};}function respondWithResult(_0x3f575b,_0x40bce3){_0x40bce3=_0x40bce3||0xc8;return function(_0x341e8d){if(_0x341e8d){return _0x3f575b['status'](_0x40bce3)[_0x04fd('0x28')](_0x341e8d);}};}function respondWithFilteredResult(_0x20490e,_0x159773){return function(_0x4785c7){if(_0x4785c7){var _0xa6b9a5=_0x4785c7[_0x04fd('0x29')],_0x511a12=_0x159773[_0x04fd('0x2a')],_0x3b5e67=_0x159773[_0x04fd('0x2a')]+_0x159773[_0x04fd('0x2b')],_0x52500b;if(_0x3b5e67>=_0xa6b9a5){_0x3b5e67=_0xa6b9a5;_0x52500b=0xc8;}else{_0x52500b=0xce;}_0x20490e[_0x04fd('0x2c')](_0x52500b);return _0x20490e[_0x04fd('0x2d')](_0x04fd('0x2e'),_0x511a12+'-'+_0x3b5e67+'/'+_0xa6b9a5)[_0x04fd('0x28')](_0x4785c7);}return null;};}function patchUpdates(_0x164758){return function(_0x451c39){try{jsonpatch[_0x04fd('0x2f')](_0x451c39,_0x164758,!![]);}catch(_0x4dbe19){return BPromise[_0x04fd('0x30')](_0x4dbe19);}return _0x451c39['save']();};}function saveUpdates(_0xc00b2d,_0x3b2003){return function(_0x210f37){if(_0x210f37){return _0x210f37[_0x04fd('0x31')](_0xc00b2d)[_0x04fd('0x1b')](function(_0x50fd23){return _0x50fd23;});}return null;};}function removeEntity(_0x56a0cd,_0x225be1){return function(_0x4299f2){if(_0x4299f2){return _0x4299f2[_0x04fd('0x32')]()[_0x04fd('0x1b')](function(){var _0x1e7bb7=_0x4299f2['get']({'plain':!![]});var _0x4d2127=_0x04fd('0x33');return db[_0x04fd('0x34')][_0x04fd('0x32')]({'where':{'type':_0x4d2127,'resourceId':_0x1e7bb7['id']}})[_0x04fd('0x1b')](function(){return _0x4299f2;});})[_0x04fd('0x1b')](function(){_0x56a0cd[_0x04fd('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fbe7a,_0x559ffd){return function(_0x5b8b0e){if(!_0x5b8b0e){_0x1fbe7a['sendStatus'](0x194);}return _0x5b8b0e;};}function handleError(_0x447da1,_0x3a7ef1){_0x3a7ef1=_0x3a7ef1||0x1f4;return function(_0x344ab5){logger[_0x04fd('0x20')](_0x344ab5['stack']);if(_0x344ab5['name']){delete _0x344ab5[_0x04fd('0x35')];}_0x447da1[_0x04fd('0x2c')](_0x3a7ef1)[_0x04fd('0x36')](_0x344ab5);};}exports['index']=function(_0x385b6c,_0x31846a){var _0x49fa41={'include':[{'model':db[_0x04fd('0x37')],'as':_0x04fd('0x38')}]},_0xee47b7={},_0x4db17d={'count':0x0,'rows':[]};var _0x30719e=db[_0x04fd('0x39')][_0x04fd('0x3a')];_0xee47b7['model']=_['keys'](_0x30719e);_0xee47b7[_0x04fd('0x3b')]=_[_0x04fd('0x3c')](_0x385b6c[_0x04fd('0x3b')]);_0xee47b7[_0x04fd('0x3d')]=_[_0x04fd('0x3e')](_0xee47b7['model'],_0xee47b7[_0x04fd('0x3b')]);_0x49fa41['attributes']=_[_0x04fd('0x3e')](_0xee47b7[_0x04fd('0x3f')],qs[_0x04fd('0x40')](_0x385b6c['query'][_0x04fd('0x40')]));_0x49fa41[_0x04fd('0x41')]=_0x49fa41[_0x04fd('0x41')][_0x04fd('0x42')]?_0x49fa41['attributes']:_0xee47b7[_0x04fd('0x3f')];if(!_0x385b6c[_0x04fd('0x3b')][_0x04fd('0x43')](_0x04fd('0x44'))){_0x49fa41[_0x04fd('0x2b')]=qs[_0x04fd('0x2b')](_0x385b6c[_0x04fd('0x3b')]['limit']);_0x49fa41[_0x04fd('0x2a')]=qs[_0x04fd('0x2a')](_0x385b6c['query'][_0x04fd('0x2a')]);}_0x49fa41[_0x04fd('0x45')]=qs[_0x04fd('0x46')](_0x385b6c[_0x04fd('0x3b')][_0x04fd('0x46')]);_0x49fa41[_0x04fd('0x47')]=qs[_0x04fd('0x3d')](_[_0x04fd('0x48')](_0x385b6c[_0x04fd('0x3b')],_0xee47b7[_0x04fd('0x3d')]));if(_0x385b6c[_0x04fd('0x3b')]['filter']){_0x49fa41['where']=_[_0x04fd('0x49')](_0x49fa41['where'],{'$or':_[_0x04fd('0x4a')](_0x30719e,function(_0x2ed1ea){if(_0x2ed1ea[_0x04fd('0x4b')][_0x04fd('0x4c')]!==_0x04fd('0x4d')){var _0x55bf8a={};_0x55bf8a[_0x2ed1ea['field']]={'$like':'%'+_0x385b6c[_0x04fd('0x3b')][_0x04fd('0x4e')]+'%'};return _0x55bf8a;}})});}_0x49fa41=_[_0x04fd('0x49')]({},_0x49fa41,_0x385b6c[_0x04fd('0x4f')]);var _0x35d905={'where':_0x49fa41[_0x04fd('0x47')]};return db[_0x04fd('0x39')][_0x04fd('0x29')](_0x35d905)[_0x04fd('0x1b')](function(_0x168878){_0x4db17d[_0x04fd('0x29')]=_0x168878;if(_0x385b6c[_0x04fd('0x3b')][_0x04fd('0x50')]){_0x49fa41[_0x04fd('0x51')]=[{'all':!![]}];}return db[_0x04fd('0x39')]['findAll'](_0x49fa41);})['then'](function(_0x1a3b5f){_0x4db17d[_0x04fd('0x52')]=_0x1a3b5f;return _0x4db17d;})[_0x04fd('0x1b')](respondWithFilteredResult(_0x31846a,_0x49fa41))[_0x04fd('0x26')](handleError(_0x31846a,null));};exports['show']=function(_0x3ba1b7,_0x588684){var _0x411d90={'raw':![],'where':{'id':_0x3ba1b7[_0x04fd('0x53')]['id']},'include':[{'model':db[_0x04fd('0x37')],'as':_0x04fd('0x38')}]},_0x1851ed={};_0x1851ed[_0x04fd('0x3f')]=_['keys'](db[_0x04fd('0x39')]['rawAttributes']);_0x1851ed[_0x04fd('0x3b')]=_['keys'](_0x3ba1b7[_0x04fd('0x3b')]);_0x1851ed[_0x04fd('0x3d')]=_[_0x04fd('0x3e')](_0x1851ed[_0x04fd('0x3f')],_0x1851ed['query']);_0x411d90[_0x04fd('0x41')]=_[_0x04fd('0x3e')](_0x1851ed[_0x04fd('0x3f')],qs[_0x04fd('0x40')](_0x3ba1b7[_0x04fd('0x3b')]['fields']));_0x411d90[_0x04fd('0x41')]=_0x411d90[_0x04fd('0x41')]['length']?_0x411d90[_0x04fd('0x41')]:_0x1851ed[_0x04fd('0x3f')];if(_0x3ba1b7[_0x04fd('0x3b')][_0x04fd('0x50')]){_0x411d90[_0x04fd('0x51')]=[{'all':!![]}];}_0x411d90=_[_0x04fd('0x49')]({},_0x411d90,_0x3ba1b7[_0x04fd('0x4f')]);return db[_0x04fd('0x39')]['find'](_0x411d90)[_0x04fd('0x1b')](handleEntityNotFound(_0x588684,null))[_0x04fd('0x1b')](respondWithResult(_0x588684,null))[_0x04fd('0x26')](handleError(_0x588684,null));};exports[_0x04fd('0x54')]=function(_0x4f2f8d,_0x4e64a1){return db[_0x04fd('0x39')][_0x04fd('0x54')](_0x4f2f8d[_0x04fd('0x55')],{})[_0x04fd('0x1b')](function(_0x2bd0bf){var _0x1cb6cf=_0x4f2f8d['user'][_0x04fd('0x56')]({'plain':!![]});if(!_0x1cb6cf)throw new Error(_0x04fd('0x57'));if(_0x1cb6cf[_0x04fd('0x58')]===_0x04fd('0x59')){var _0x57b83f=_0x2bd0bf['get']({'plain':!![]});var _0x797d2='OpenchannelAccounts';return db[_0x04fd('0x5a')]['find']({'where':{'name':_0x797d2,'userProfileId':_0x1cb6cf['userProfileId']},'raw':!![]})[_0x04fd('0x1b')](function(_0x5c68ab){if(_0x5c68ab&&_0x5c68ab[_0x04fd('0x5b')]===0x0){return db[_0x04fd('0x34')][_0x04fd('0x54')]({'name':_0x57b83f[_0x04fd('0x35')],'resourceId':_0x57b83f['id'],'type':_0x5c68ab[_0x04fd('0x35')],'sectionId':_0x5c68ab['id']},{})[_0x04fd('0x1b')](function(){return _0x2bd0bf;});}else{return _0x2bd0bf;}})[_0x04fd('0x26')](function(_0x525f69){logger[_0x04fd('0x20')](_0x04fd('0x5c'),_0x525f69);throw _0x525f69;});}return _0x2bd0bf;})[_0x04fd('0x1b')](respondWithResult(_0x4e64a1,0xc9))[_0x04fd('0x26')](handleError(_0x4e64a1,null));};exports['update']=function(_0x10b22a,_0x3b5e94){if(_0x10b22a[_0x04fd('0x55')]['id']){delete _0x10b22a[_0x04fd('0x55')]['id'];}return db['OpenchannelAccount'][_0x04fd('0x5d')]({'where':{'id':_0x10b22a[_0x04fd('0x53')]['id']},'include':[{'model':db[_0x04fd('0x37')],'as':_0x04fd('0x38')}]})[_0x04fd('0x1b')](handleEntityNotFound(_0x3b5e94,null))[_0x04fd('0x1b')](saveUpdates(_0x10b22a['body'],null))[_0x04fd('0x1b')](function(_0x1ad7d4){if(_0x1ad7d4&&_0x10b22a[_0x04fd('0x55')][_0x04fd('0x38')]){return db[_0x04fd('0x37')]['update'](_0x10b22a[_0x04fd('0x55')][_0x04fd('0x38')],{'where':{'OpenchannelAccountId':_0x1ad7d4['id']}})['then'](function(){return _0x1ad7d4;});}return _0x1ad7d4;})[_0x04fd('0x1b')](respondWithResult(_0x3b5e94,null))[_0x04fd('0x26')](handleError(_0x3b5e94,null));};exports['destroy']=function(_0x2673f6,_0x3d625d){return db[_0x04fd('0x39')][_0x04fd('0x5d')]({'where':{'id':_0x2673f6[_0x04fd('0x53')]['id']}})[_0x04fd('0x1b')](handleEntityNotFound(_0x3d625d,null))[_0x04fd('0x1b')](removeEntity(_0x3d625d,null))[_0x04fd('0x26')](handleError(_0x3d625d,null));};exports[_0x04fd('0x5e')]=function(_0x48e8a4,_0x2f7975){return db['OpenchannelAccount'][_0x04fd('0x5e')]()[_0x04fd('0x1b')](respondWithResult(_0x2f7975,null))[_0x04fd('0x26')](handleError(_0x2f7975,null));};exports[_0x04fd('0x5f')]=function(_0xe12d70,_0x550b9f,_0x5924b6){if(_0xe12d70[_0x04fd('0x55')]['id']){delete _0xe12d70[_0x04fd('0x55')]['id'];}return db[_0x04fd('0x39')][_0x04fd('0x5d')]({'where':{'id':_0xe12d70[_0x04fd('0x53')]['id']}})[_0x04fd('0x1b')](handleEntityNotFound(_0x550b9f,null))['then'](function(_0x4c040c){if(_0x4c040c){_0xe12d70[_0x04fd('0x55')][_0x04fd('0x60')]=_0x4c040c['id'];return db[_0x04fd('0x61')][_0x04fd('0x54')](_0xe12d70[_0x04fd('0x55')]);}})[_0x04fd('0x1b')](respondWithResult(_0x550b9f,null))['catch'](handleError(_0x550b9f,null));};exports[_0x04fd('0x62')]=function(_0x41283c,_0x560f11,_0x50c89b){var _0x49f60d={'raw':![],'where':{}};var _0x4dce28={};var _0x16014d={'count':0x0,'rows':[]};return db[_0x04fd('0x39')][_0x04fd('0x63')]({'where':{'id':_0x41283c[_0x04fd('0x53')]['id']}})[_0x04fd('0x1b')](handleEntityNotFound(_0x560f11,null))[_0x04fd('0x1b')](function(_0x11f893){if(_0x11f893){_0x4dce28[_0x04fd('0x3f')]=_[_0x04fd('0x3c')](db[_0x04fd('0x61')][_0x04fd('0x3a')]);_0x4dce28['query']=_[_0x04fd('0x3c')](_0x41283c[_0x04fd('0x3b')]);_0x4dce28['filters']=_[_0x04fd('0x3e')](_0x4dce28[_0x04fd('0x3f')],_0x4dce28[_0x04fd('0x3b')]);_0x49f60d[_0x04fd('0x41')]=_[_0x04fd('0x3e')](_0x4dce28[_0x04fd('0x3f')],qs[_0x04fd('0x40')](_0x41283c['query'][_0x04fd('0x40')]));_0x49f60d['attributes']=_0x49f60d[_0x04fd('0x41')][_0x04fd('0x42')]?_0x49f60d[_0x04fd('0x41')]:_0x4dce28[_0x04fd('0x3f')];if(!_0x41283c[_0x04fd('0x3b')][_0x04fd('0x43')](_0x04fd('0x44'))){_0x49f60d[_0x04fd('0x2b')]=qs['limit'](_0x41283c[_0x04fd('0x3b')]['limit']);_0x49f60d[_0x04fd('0x2a')]=qs[_0x04fd('0x2a')](_0x41283c['query'][_0x04fd('0x2a')]);}_0x49f60d[_0x04fd('0x45')]=qs['sort'](_0x41283c[_0x04fd('0x3b')][_0x04fd('0x46')]);_0x49f60d[_0x04fd('0x47')]=qs['filters'](_[_0x04fd('0x48')](_0x41283c[_0x04fd('0x3b')],_0x4dce28[_0x04fd('0x3d')]));_0x49f60d[_0x04fd('0x47')][_0x04fd('0x64')]=_0x11f893['id'];if(_0x41283c['query'][_0x04fd('0x4e')]){_0x49f60d[_0x04fd('0x47')]=_[_0x04fd('0x49')](_0x49f60d[_0x04fd('0x47')],{'$or':_[_0x04fd('0x4a')](_0x49f60d[_0x04fd('0x41')],function(_0x37a2e6){var _0x5327b7={};_0x5327b7[_0x37a2e6]={'$like':'%'+_0x41283c[_0x04fd('0x3b')][_0x04fd('0x4e')]+'%'};return _0x5327b7;})});}_0x49f60d=_[_0x04fd('0x49')]({},_0x49f60d,_0x41283c['options']);return db['Disposition'][_0x04fd('0x29')]({'where':_0x49f60d['where']})['then'](function(_0x4c4f9e){_0x16014d[_0x04fd('0x29')]=_0x4c4f9e;if(_0x41283c[_0x04fd('0x3b')][_0x04fd('0x50')]){_0x49f60d[_0x04fd('0x51')]=[{'all':!![]}];}return db[_0x04fd('0x61')][_0x04fd('0x65')](_0x49f60d);})[_0x04fd('0x1b')](function(_0x529e03){_0x16014d[_0x04fd('0x52')]=_0x529e03;return _0x16014d;});}})[_0x04fd('0x1b')](respondWithFilteredResult(_0x560f11,_0x49f60d))[_0x04fd('0x26')](handleError(_0x560f11,null));};exports[_0x04fd('0x66')]=function(_0x36975d,_0xc226cf,_0x1fe081){var _0x598f26;return db[_0x04fd('0x39')][_0x04fd('0x5d')]({'where':{'id':_0x36975d[_0x04fd('0x53')]['id']}})[_0x04fd('0x1b')](handleEntityNotFound(_0xc226cf,null))['then'](function(_0x185de7){if(_0x185de7){return _0x185de7['removeDispositions'](_0x36975d['query']['ids']);}})['then'](respondWithStatusCode(_0xc226cf,null))['catch'](handleError(_0xc226cf,null));};exports[_0x04fd('0x67')]=function(_0x49ed0e,_0x2b6a4a,_0x290a5c){if(_0x49ed0e[_0x04fd('0x55')]['id']){delete _0x49ed0e[_0x04fd('0x55')]['id'];}return db[_0x04fd('0x39')][_0x04fd('0x5d')]({'where':{'id':_0x49ed0e[_0x04fd('0x53')]['id']}})[_0x04fd('0x1b')](handleEntityNotFound(_0x2b6a4a,null))[_0x04fd('0x1b')](function(_0x238945){if(_0x238945){_0x49ed0e[_0x04fd('0x55')][_0x04fd('0x64')]=_0x238945['id'];return db[_0x04fd('0x68')]['create'](_0x49ed0e['body']);}})[_0x04fd('0x1b')](respondWithResult(_0x2b6a4a,null))['catch'](handleError(_0x2b6a4a,null));};exports[_0x04fd('0x69')]=function(_0x15bf10,_0x1d62b8,_0x18f31a){var _0x37bf22={'raw':![],'where':{}};var _0x21a7e0={};var _0x3ac8a3={'count':0x0,'rows':[]};return db[_0x04fd('0x39')][_0x04fd('0x63')]({'where':{'id':_0x15bf10[_0x04fd('0x53')]['id']}})['then'](handleEntityNotFound(_0x1d62b8,null))[_0x04fd('0x1b')](function(_0x32fa4e){if(_0x32fa4e){_0x21a7e0['model']=_['keys'](db[_0x04fd('0x68')][_0x04fd('0x3a')]);_0x21a7e0[_0x04fd('0x3b')]=_[_0x04fd('0x3c')](_0x15bf10[_0x04fd('0x3b')]);_0x21a7e0[_0x04fd('0x3d')]=_['intersection'](_0x21a7e0[_0x04fd('0x3f')],_0x21a7e0[_0x04fd('0x3b')]);_0x37bf22[_0x04fd('0x41')]=_[_0x04fd('0x3e')](_0x21a7e0[_0x04fd('0x3f')],qs[_0x04fd('0x40')](_0x15bf10['query']['fields']));_0x37bf22[_0x04fd('0x41')]=_0x37bf22[_0x04fd('0x41')][_0x04fd('0x42')]?_0x37bf22[_0x04fd('0x41')]:_0x21a7e0[_0x04fd('0x3f')];if(!_0x15bf10['query'][_0x04fd('0x43')](_0x04fd('0x44'))){_0x37bf22[_0x04fd('0x2b')]=qs[_0x04fd('0x2b')](_0x15bf10[_0x04fd('0x3b')][_0x04fd('0x2b')]);_0x37bf22['offset']=qs['offset'](_0x15bf10[_0x04fd('0x3b')][_0x04fd('0x2a')]);}_0x37bf22[_0x04fd('0x45')]=qs[_0x04fd('0x46')](_0x15bf10[_0x04fd('0x3b')][_0x04fd('0x46')]);_0x37bf22[_0x04fd('0x47')]=qs[_0x04fd('0x3d')](_[_0x04fd('0x48')](_0x15bf10[_0x04fd('0x3b')],_0x21a7e0['filters']));_0x37bf22['where']['OpenchannelAccountId']=_0x32fa4e['id'];if(_0x15bf10[_0x04fd('0x3b')]['filter']){_0x37bf22[_0x04fd('0x47')]=_[_0x04fd('0x49')](_0x37bf22[_0x04fd('0x47')],{'$or':_[_0x04fd('0x4a')](_0x37bf22[_0x04fd('0x41')],function(_0x47f3d4){var _0x16ad55={};_0x16ad55[_0x47f3d4]={'$like':'%'+_0x15bf10['query'][_0x04fd('0x4e')]+'%'};return _0x16ad55;})});}_0x37bf22=_[_0x04fd('0x49')]({},_0x37bf22,_0x15bf10[_0x04fd('0x4f')]);return db['CannedAnswer']['count']({'where':_0x37bf22['where']})['then'](function(_0xbc04fb){_0x3ac8a3['count']=_0xbc04fb;if(_0x15bf10[_0x04fd('0x3b')][_0x04fd('0x50')]){_0x37bf22[_0x04fd('0x51')]=[{'all':!![]}];}return db['CannedAnswer'][_0x04fd('0x65')](_0x37bf22);})['then'](function(_0x4e7e4d){_0x3ac8a3[_0x04fd('0x52')]=_0x4e7e4d;return _0x3ac8a3;});}})[_0x04fd('0x1b')](respondWithFilteredResult(_0x1d62b8,_0x37bf22))[_0x04fd('0x26')](handleError(_0x1d62b8,null));};exports[_0x04fd('0x6a')]=function(_0xd736ea,_0x2d402d,_0x291d87){var _0x5a63e1;return db['OpenchannelAccount'][_0x04fd('0x5d')]({'where':{'id':_0xd736ea[_0x04fd('0x53')]['id']}})[_0x04fd('0x1b')](handleEntityNotFound(_0x2d402d,null))[_0x04fd('0x1b')](function(_0x1833ab){if(_0x1833ab){return _0x1833ab[_0x04fd('0x6a')](_0xd736ea[_0x04fd('0x3b')][_0x04fd('0x6b')]);}})['then'](respondWithStatusCode(_0x2d402d,null))[_0x04fd('0x26')](handleError(_0x2d402d,null));};exports[_0x04fd('0x6c')]=function(_0x42163b,_0x301265,_0x36c937){var _0x1a4ddc={'body':_0x42163b['body'],'channel':'openchannel'};var _0x510da9=[];var _0x179b9c=[];var _0x1e8d48={};var _0x143192=![];return db[_0x04fd('0x6d')]['describe']()[_0x04fd('0x1b')](function(_0x2844c6){if(!_0x2844c6){throw new db[(_0x04fd('0x6e'))][(_0x04fd('0x6f'))](_0x04fd('0x70'));}_0x510da9=_[_0x04fd('0x71')](_[_0x04fd('0x3c')](_0x2844c6),[_0x04fd('0x72'),_0x04fd('0x73')]);_0x179b9c=_[_0x04fd('0x71')](_[_0x04fd('0x3c')](_0x2844c6),[_0x04fd('0x72'),'updatedAt',_0x04fd('0x74'),_0x04fd('0x75')]);if(_0x42163b[_0x04fd('0x55')]['id']){delete _0x42163b[_0x04fd('0x55')]['id'];}if(_[_0x04fd('0x76')](_0x42163b[_0x04fd('0x55')]['from'])){throw new db[(_0x04fd('0x6e'))][(_0x04fd('0x6f'))](_0x04fd('0x77'));}if(_['isNil'](_0x42163b['body'][_0x04fd('0x55')])||_0x42163b['body']['body']===''){throw new db[(_0x04fd('0x6e'))][(_0x04fd('0x6f'))](_0x04fd('0x78'));}if(_[_0x04fd('0x76')](_0x42163b[_0x04fd('0x55')]['mapKey'])){throw new db[(_0x04fd('0x6e'))][(_0x04fd('0x6f'))](_0x04fd('0x79')+_0x179b9c);}if(!_[_0x04fd('0x7a')](_0x179b9c,_0x42163b[_0x04fd('0x55')][_0x04fd('0x7b')])){throw new db[(_0x04fd('0x6e'))][(_0x04fd('0x6f'))](_0x04fd('0x7c')+_0x179b9c);}_0x1e8d48[_0x42163b[_0x04fd('0x55')][_0x04fd('0x7b')]]=_0x42163b[_0x04fd('0x55')][_0x04fd('0x7d')];})['then'](function(){return db['OpenchannelAccount'][_0x04fd('0x5d')]({'where':{'id':_0x42163b[_0x04fd('0x53')]['id']},'include':[{'model':db[_0x04fd('0x7e')],'as':_0x04fd('0x7f'),'include':[{'model':db[_0x04fd('0x6d')],'as':_0x04fd('0x80'),'where':_0x1e8d48,'limit':0x1,'order':[[_0x04fd('0x73'),_0x04fd('0x81')]]}]},{'model':db[_0x04fd('0x82')],'as':_0x04fd('0x83')}]});})[_0x04fd('0x1b')](handleEntityNotFound(_0x301265,null))[_0x04fd('0x1b')](function(_0x13de55){if(_0x13de55&&_0x13de55[_0x04fd('0x7f')]){_0x1a4ddc[_0x04fd('0x84')]=_0x13de55;_0x1a4ddc[_0x04fd('0x85')]=_0x13de55[_0x04fd('0x83')];_0x1a4ddc[_0x04fd('0x86')]=_0x13de55[_0x04fd('0x7f')];_0x1a4ddc['applications']=_[_0x04fd('0x87')](_0x1a4ddc[_0x04fd('0x85')],[_0x04fd('0x88')],[_0x04fd('0x89')]);if(_0x1a4ddc['account'][_0x04fd('0x83')]){delete _0x1a4ddc[_0x04fd('0x84')][_0x04fd('0x83')];}if(_0x1a4ddc['account'][_0x04fd('0x7f')]&&_0x1a4ddc[_0x04fd('0x84')][_0x04fd('0x7f')][_0x04fd('0x80')][_0x04fd('0x42')]){return _0x1a4ddc[_0x04fd('0x84')][_0x04fd('0x7f')][_0x04fd('0x80')][0x0];}var _0x5a65b4=_[_0x04fd('0x14')](_0x42163b[_0x04fd('0x55')],{'firstName':_0x42163b['body'][_0x04fd('0x7d')],'ListId':_0x13de55['ListId']});_0x5a65b4[_0x42163b[_0x04fd('0x55')]['mapKey']]=_0x42163b['body'][_0x04fd('0x7d')];return db[_0x04fd('0x6d')][_0x04fd('0x54')](_0x5a65b4,{'fields':_0x510da9,'raw':!![]});}})[_0x04fd('0x1b')](handleEntityNotFound(_0x301265,null))['then'](function(_0x4f8ae1){_0x1a4ddc[_0x04fd('0x8a')]=_0x4f8ae1;if(_0x4f8ae1){var _0x1c7dd0={'ContactId':_0x4f8ae1['id'],'OpenchannelAccountId':_0x42163b['params']['id'],'from':(_0x4f8ae1[_0x04fd('0x8b')]||'')+'\x20'+(_0x4f8ae1[_0x04fd('0x8c')]||'')};var _0x35add3={'OpenchannelAccountId':_0x42163b[_0x04fd('0x53')]['id'],'closed':![]};if(_0x42163b[_0x04fd('0x55')]['threadId']){_0x35add3[_0x04fd('0x8d')]=_0x42163b[_0x04fd('0x55')][_0x04fd('0x8d')];return db[_0x04fd('0x8e')]['find']({'where':_0x35add3})[_0x04fd('0x1b')](function(_0x160e9f){if(_0x160e9f){return[_0x160e9f,![]];}_0x1c7dd0['threadId']=_0x42163b[_0x04fd('0x55')][_0x04fd('0x8d')];_0x1c7dd0[_0x04fd('0x8f')]=_0x42163b[_0x04fd('0x55')][_0x04fd('0x8f')];return db['OpenchannelInteraction'][_0x04fd('0x54')](_0x1c7dd0)[_0x04fd('0x1b')](function(_0x3caa2c){return[_0x3caa2c,!![]];});});}else{_0x35add3[_0x04fd('0x8d')]=null;}_0x35add3[_0x04fd('0x90')]=_0x4f8ae1['id'];return db[_0x04fd('0x8e')][_0x04fd('0x5d')]({'where':_0x35add3})[_0x04fd('0x1b')](function(_0x44cc3a){if(_0x44cc3a){return[_0x44cc3a,![]];}return db['OpenchannelInteraction'][_0x04fd('0x54')](_0x1c7dd0)[_0x04fd('0x1b')](function(_0x5c475c){return[_0x5c475c,!![]];});});}})[_0x04fd('0x91')](function(_0x3be598,_0x1c24e3){if(_0x3be598){_0x143192=_0x1c24e3;if(!_0x1c24e3){var _0x237e2d={'from':(_0x1a4ddc['contact'][_0x04fd('0x8b')]||'')+'\x20'+(_0x1a4ddc[_0x04fd('0x8a')][_0x04fd('0x8c')]||'')};if(_0x42163b[_0x04fd('0x55')]['threadId']&&_0x42163b['body'][_0x04fd('0x92')]&&_0x42163b[_0x04fd('0x55')][_0x04fd('0x8d')]!=_0x42163b['body'][_0x04fd('0x92')]){_0x237e2d[_0x04fd('0x8d')]=_0x42163b['body'][_0x04fd('0x92')];}return _0x3be598['update'](_0x237e2d);}else{return _0x3be598;}}})['then'](function(_0x23997e){_0x1a4ddc['interaction']=_0x23997e[_0x04fd('0x56')]({'plain':!![]});_0x1a4ddc['interaction'][_0x04fd('0x93')]=_0x143192;if(_0x1a4ddc[_0x04fd('0x94')][_0x04fd('0x93')]){if(_0x1a4ddc['account']['autoclose']){_0x1a4ddc[_0x04fd('0x85')]['push']({'id':0x0,'priority':_0x1a4ddc[_0x04fd('0x85')][_0x04fd('0x42')]+0x1,'app':_0x04fd('0x95'),'appdata':_0x04fd('0x96'),'interval':_0x04fd('0x97')});}}return db[_0x04fd('0x98')]['create']({'body':_0x42163b[_0x04fd('0x55')][_0x04fd('0x55')],'OpenchannelAccountId':_0x42163b[_0x04fd('0x53')]['id'],'OpenchannelInteractionId':_0x23997e['id'],'direction':'in','ContactId':_0x1a4ddc['contact']['id'],'AttachmentId':_0x42163b[_0x04fd('0x55')][_0x04fd('0x99')]});})[_0x04fd('0x1b')](function(_0x39cbae){_0x1a4ddc[_0x04fd('0x23')]=_0x39cbae;if(_0x1a4ddc[_0x04fd('0x94')][_0x04fd('0x9a')]){return db['User'][_0x04fd('0x5d')]({'attributes':['id',_0x04fd('0x35')],'where':{'id':_0x1a4ddc['interaction'][_0x04fd('0x9a')]}})[_0x04fd('0x1b')](function(_0x4f03fa){if(_0x4f03fa){_0x1a4ddc[_0x04fd('0x85')][_0x04fd('0x9b')]({'id':0x0,'priority':0x0,'app':_0x04fd('0x9c'),'appdata':_0x4f03fa[_0x04fd('0x35')]+','+(_0x1a4ddc[_0x04fd('0x84')][_0x04fd('0x9d')]||0xa),'interval':'*,*,*,*'});_0x1a4ddc[_0x04fd('0x9e')]=![];}return respondWithRpcPromise(_0x04fd('0x9f'),_0x04fd('0xa0'),_0x1a4ddc);});}return respondWithRpcPromise(_0x04fd('0x9f'),'startRouting',_0x1a4ddc);})[_0x04fd('0x1b')](function(_0x1fe583){respondWithRpcPromise(_0x04fd('0xa1'),_0x04fd('0xa1'),{'event':_0x04fd('0x6c'),'message':_0x1fe583},client9002);return _0x1fe583;})['then'](respondWithResult(_0x301265,null))[_0x04fd('0x26')](handleError(_0x301265,null));};exports['addApplications']=function(_0x135b4e,_0x5c81a5,_0x25b9d0){return db[_0x04fd('0x39')][_0x04fd('0x63')]({'where':{'id':_0x135b4e[_0x04fd('0x53')]['id']}})[_0x04fd('0x1b')](handleEntityNotFound(_0x5c81a5,null))['then'](function(_0x86cced){if(_0x86cced){return db[_0x04fd('0xa2')][_0x04fd('0xa3')](function(_0x5433f6){return db[_0x04fd('0x82')][_0x04fd('0x32')]({'where':{'OpenchannelAccountId':_0x135b4e['params']['id']},'transaction':_0x5433f6})[_0x04fd('0x1b')](function(_0x2f8ef1){var _0x3130b9=_[_0x04fd('0x4a')](_0x135b4e[_0x04fd('0x55')],function(_0x4c9094){_0x4c9094[_0x04fd('0x64')]=_0x135b4e[_0x04fd('0x53')]['id'];return _0x4c9094;});return db['OpenchannelApplication'][_0x04fd('0xa4')](_0x3130b9,{'transaction':_0x5433f6});});})[_0x04fd('0x1b')](function(){return db[_0x04fd('0x82')][_0x04fd('0xa5')]({'where':{'OpenchannelAccountId':_0x135b4e['params']['id']},'order':_0x04fd('0x88')});});}})[_0x04fd('0x1b')](respondWithResult(_0x5c81a5,null))['catch'](handleError(_0x5c81a5,null));};exports[_0x04fd('0xa6')]=function(_0x35b441,_0x7c816c,_0x540a13){var _0x5a8530={};var _0x5ea63d={};var _0x7b46c5;var _0x471dbf;return db['OpenchannelAccount'][_0x04fd('0x63')]({'where':{'id':_0x35b441[_0x04fd('0x53')]['id']}})[_0x04fd('0x1b')](handleEntityNotFound(_0x7c816c,null))[_0x04fd('0x1b')](function(_0x239c8c){if(_0x239c8c){_0x7b46c5=_0x239c8c;_0x5ea63d[_0x04fd('0x3f')]=_[_0x04fd('0x3c')](db[_0x04fd('0x82')][_0x04fd('0x3a')]);_0x5ea63d[_0x04fd('0x3b')]=_['keys'](_0x35b441[_0x04fd('0x3b')]);_0x5ea63d[_0x04fd('0x3d')]=_[_0x04fd('0x3e')](_0x5ea63d[_0x04fd('0x3f')],_0x5ea63d[_0x04fd('0x3b')]);_0x5a8530[_0x04fd('0x41')]=_[_0x04fd('0x3e')](_0x5ea63d[_0x04fd('0x3f')],qs[_0x04fd('0x40')](_0x35b441[_0x04fd('0x3b')]['fields']));_0x5a8530[_0x04fd('0x41')]=_0x5a8530['attributes'][_0x04fd('0x42')]?_0x5a8530[_0x04fd('0x41')]:_0x5ea63d[_0x04fd('0x3f')];_0x5a8530[_0x04fd('0x45')]=qs['sort'](_0x35b441[_0x04fd('0x3b')][_0x04fd('0x46')]);_0x5a8530[_0x04fd('0x47')]=qs[_0x04fd('0x3d')](_['pick'](_0x35b441[_0x04fd('0x3b')],_0x5ea63d[_0x04fd('0x3d')]));if(_0x35b441[_0x04fd('0x3b')][_0x04fd('0x4e')]){_0x5a8530[_0x04fd('0x47')]=_[_0x04fd('0x49')](_0x5a8530['where'],{'$or':_[_0x04fd('0x4a')](_0x5a8530[_0x04fd('0x41')],function(_0x387f48){var _0x5bd88b={};_0x5bd88b[_0x387f48]={'$like':'%'+_0x35b441[_0x04fd('0x3b')]['filter']+'%'};return _0x5bd88b;})});}_0x5a8530=_['merge']({},_0x5a8530,_0x35b441[_0x04fd('0x4f')]);return _0x7b46c5[_0x04fd('0xa6')](_0x5a8530);}})[_0x04fd('0x1b')](function(_0x1e55bb){if(_0x1e55bb){_0x471dbf=_0x1e55bb['length'];if(!_0x35b441[_0x04fd('0x3b')][_0x04fd('0x43')](_0x04fd('0x44'))){_0x5a8530[_0x04fd('0x2b')]=qs[_0x04fd('0x2b')](_0x35b441[_0x04fd('0x3b')][_0x04fd('0x2b')]);_0x5a8530[_0x04fd('0x2a')]=qs[_0x04fd('0x2a')](_0x35b441[_0x04fd('0x3b')]['offset']);}return _0x7b46c5[_0x04fd('0xa6')](_0x5a8530);}})[_0x04fd('0x1b')](function(_0x2bf07e){if(_0x2bf07e){return _0x2bf07e?{'count':_0x471dbf,'rows':_0x2bf07e}:null;}})[_0x04fd('0x1b')](respondWithResult(_0x7c816c,null))['catch'](handleError(_0x7c816c,null));};exports['getInteractions']=function(_0x18cd4d,_0x1cd8ad,_0x659dca){var _0x3e9e90={'raw':![],'where':{}};var _0x166696={};var _0x5359f0={'count':0x0,'rows':[]};return db[_0x04fd('0x39')][_0x04fd('0x63')]({'where':{'id':_0x18cd4d[_0x04fd('0x53')]['id']}})[_0x04fd('0x1b')](handleEntityNotFound(_0x1cd8ad,null))[_0x04fd('0x1b')](function(_0x34d520){if(_0x34d520){_0x166696['model']=_[_0x04fd('0x3c')](db[_0x04fd('0x8e')][_0x04fd('0x3a')]);_0x166696[_0x04fd('0x3b')]=_['keys'](_0x18cd4d[_0x04fd('0x3b')]);_0x166696[_0x04fd('0x3d')]=_[_0x04fd('0x3e')](_0x166696[_0x04fd('0x3f')],_0x166696[_0x04fd('0x3b')]);_0x3e9e90[_0x04fd('0x41')]=_['intersection'](_0x166696['model'],qs[_0x04fd('0x40')](_0x18cd4d[_0x04fd('0x3b')][_0x04fd('0x40')]));_0x3e9e90[_0x04fd('0x41')]=_0x3e9e90[_0x04fd('0x41')]['length']?_0x3e9e90[_0x04fd('0x41')]:_0x166696[_0x04fd('0x3f')];if(!_0x18cd4d['query'][_0x04fd('0x43')](_0x04fd('0x44'))){_0x3e9e90['limit']=qs[_0x04fd('0x2b')](_0x18cd4d[_0x04fd('0x3b')][_0x04fd('0x2b')]);_0x3e9e90[_0x04fd('0x2a')]=qs[_0x04fd('0x2a')](_0x18cd4d[_0x04fd('0x3b')]['offset']);}_0x3e9e90[_0x04fd('0x45')]=qs['sort'](_0x18cd4d['query'][_0x04fd('0x46')]);_0x3e9e90[_0x04fd('0x47')]=qs[_0x04fd('0x3d')](_[_0x04fd('0x48')](_0x18cd4d[_0x04fd('0x3b')],_0x166696[_0x04fd('0x3d')]));_0x3e9e90['where'][_0x04fd('0x64')]=_0x34d520['id'];if(_0x18cd4d[_0x04fd('0x3b')][_0x04fd('0x4e')]){_0x3e9e90[_0x04fd('0x47')]=_[_0x04fd('0x49')](_0x3e9e90[_0x04fd('0x47')],{'$or':_[_0x04fd('0x4a')](_0x3e9e90[_0x04fd('0x41')],function(_0x17537e){var _0x55f4a5={};_0x55f4a5[_0x17537e]={'$like':'%'+_0x18cd4d['query'][_0x04fd('0x4e')]+'%'};return _0x55f4a5;})});}_0x3e9e90=_[_0x04fd('0x49')]({},_0x3e9e90,_0x18cd4d[_0x04fd('0x4f')]);return db[_0x04fd('0x8e')][_0x04fd('0x29')]({'where':_0x3e9e90[_0x04fd('0x47')]})['then'](function(_0xe00952){_0x5359f0['count']=_0xe00952;if(_0x18cd4d['query'][_0x04fd('0x50')]){_0x3e9e90[_0x04fd('0x51')]=[{'model':db[_0x04fd('0x6d')],'as':_0x04fd('0xa7'),'required':![]},{'model':db[_0x04fd('0xa8')],'as':_0x04fd('0xa9'),'attributes':['name',_0x04fd('0xaa'),_0x04fd('0xab')],'required':![]},{'model':db['Tag'],'as':_0x04fd('0xac'),'attributes':['id',_0x04fd('0x35'),_0x04fd('0xad')],'where':_0x18cd4d['query']['tag']?{'id':_0x18cd4d[_0x04fd('0x3b')][_0x04fd('0xae')]}:undefined,'required':_0x18cd4d[_0x04fd('0x3b')][_0x04fd('0xae')]?!![]:![]}];}return db[_0x04fd('0x8e')]['findAll'](_0x3e9e90);})[_0x04fd('0x1b')](function(_0x356f14){_0x5359f0[_0x04fd('0x52')]=_0x356f14;return _0x5359f0;});}})[_0x04fd('0x1b')](respondWithFilteredResult(_0x1cd8ad,_0x3e9e90))[_0x04fd('0x26')](handleError(_0x1cd8ad,null));};exports[_0x04fd('0xaf')]=function(_0x2283d4,_0x1c5a22,_0x3dc815){return db[_0x04fd('0x39')][_0x04fd('0x5d')]({'where':{'id':_0x2283d4[_0x04fd('0x53')]['id']}})[_0x04fd('0x1b')](handleEntityNotFound(_0x1c5a22,null))['then'](function(_0x371445){if(_0x371445){return _0x371445['addAgents'](_0x2283d4[_0x04fd('0x55')][_0x04fd('0x6b')],_['omit'](_0x2283d4['body'],[_0x04fd('0x6b'),'id'])||{})[_0x04fd('0x91')](function(_0x514321){for(var _0x3c45fb=0x0;_0x3c45fb<_0x2283d4[_0x04fd('0x55')][_0x04fd('0x6b')]['length'];_0x3c45fb+=0x1){socket[_0x04fd('0xb0')]('userOpenchannelAccount:save',{'UserId':_0x2283d4[_0x04fd('0x55')][_0x04fd('0x6b')][_0x3c45fb],'OpenchannelAccountId':_0x2283d4['params']['id']});}return _0x514321;});}})['then'](respondWithResult(_0x1c5a22,null))[_0x04fd('0x26')](handleError(_0x1c5a22,null));};exports[_0x04fd('0xb1')]=function(_0x1f1039,_0x40c984,_0x2cd424){var _0x5586c7;return db[_0x04fd('0x39')][_0x04fd('0x5d')]({'where':{'id':_0x1f1039[_0x04fd('0x53')]['id']}})['then'](handleEntityNotFound(_0x40c984,null))[_0x04fd('0x1b')](function(_0xf3c731){if(_0xf3c731){return _0xf3c731[_0x04fd('0xb1')](_0x1f1039['query'][_0x04fd('0x6b')])[_0x04fd('0x1b')](function(_0x25e690){if(_['isArray'](_0x1f1039[_0x04fd('0x3b')][_0x04fd('0x6b')])){for(var _0xaeb894=0x0;_0xaeb894<_0x1f1039[_0x04fd('0x3b')]['ids'][_0x04fd('0x42')];_0xaeb894+=0x1){socket[_0x04fd('0xb0')](_0x04fd('0xb2'),{'UserId':_0x1f1039['query']['ids'][_0xaeb894],'OpenchannelAccountId':_0x1f1039['params']['id']});}}else{socket[_0x04fd('0xb0')]('userOpenchannelAccount:remove',{'UserId':_0x1f1039[_0x04fd('0x3b')][_0x04fd('0x6b')],'OpenchannelAccountId':_0x1f1039[_0x04fd('0x53')]['id']});}});}})[_0x04fd('0x1b')](respondWithStatusCode(_0x40c984,null))[_0x04fd('0x26')](handleError(_0x40c984,null));};exports['getAgents']=function(_0x10ee6b,_0x46ad43,_0x344e67){var _0x5f2ca3={};var _0x105c51={};var _0x2ca78f;var _0x53588b;return db[_0x04fd('0x39')][_0x04fd('0x63')]({'where':{'id':_0x10ee6b['params']['id']}})[_0x04fd('0x1b')](handleEntityNotFound(_0x46ad43,null))[_0x04fd('0x1b')](function(_0x19b721){if(_0x19b721){_0x2ca78f=_0x19b721;_0x105c51[_0x04fd('0x3f')]=_['keys'](db['User'][_0x04fd('0x3a')]);_0x105c51[_0x04fd('0x3b')]=_[_0x04fd('0x3c')](_0x10ee6b[_0x04fd('0x3b')]);_0x105c51[_0x04fd('0x3d')]=_[_0x04fd('0x3e')](_0x105c51['model'],_0x105c51[_0x04fd('0x3b')]);_0x5f2ca3['attributes']=_[_0x04fd('0x3e')](_0x105c51[_0x04fd('0x3f')],qs['fields'](_0x10ee6b[_0x04fd('0x3b')]['fields']));_0x5f2ca3[_0x04fd('0x41')]=_0x5f2ca3[_0x04fd('0x41')][_0x04fd('0x42')]?_0x5f2ca3['attributes']:_0x105c51[_0x04fd('0x3f')];_0x5f2ca3[_0x04fd('0x45')]=qs[_0x04fd('0x46')](_0x10ee6b['query'][_0x04fd('0x46')]);_0x5f2ca3['where']=qs[_0x04fd('0x3d')](_[_0x04fd('0x48')](_0x10ee6b['query'],_0x105c51['filters']));if(_0x10ee6b['query'][_0x04fd('0x4e')]){_0x5f2ca3[_0x04fd('0x47')]=_['merge'](_0x5f2ca3[_0x04fd('0x47')],{'$or':_[_0x04fd('0x4a')](_0x5f2ca3['attributes'],function(_0x3c974a){var _0x564648={};_0x564648[_0x3c974a]={'$like':'%'+_0x10ee6b[_0x04fd('0x3b')][_0x04fd('0x4e')]+'%'};return _0x564648;})});}_0x5f2ca3=_[_0x04fd('0x49')]({},_0x5f2ca3,_0x10ee6b[_0x04fd('0x4f')]);return _0x2ca78f[_0x04fd('0xb3')](_0x5f2ca3);}})[_0x04fd('0x1b')](function(_0x490712){if(_0x490712){_0x53588b=_0x490712[_0x04fd('0x42')];if(!_0x10ee6b[_0x04fd('0x3b')][_0x04fd('0x43')](_0x04fd('0x44'))){_0x5f2ca3[_0x04fd('0x2b')]=qs[_0x04fd('0x2b')](_0x10ee6b[_0x04fd('0x3b')][_0x04fd('0x2b')]);_0x5f2ca3[_0x04fd('0x2a')]=qs[_0x04fd('0x2a')](_0x10ee6b['query'][_0x04fd('0x2a')]);}return _0x2ca78f['getAgents'](_0x5f2ca3);}})['then'](function(_0xafef48){if(_0xafef48){return _0xafef48?{'count':_0x53588b,'rows':_0xafef48}:null;}})['then'](respondWithResult(_0x46ad43,null))['catch'](handleError(_0x46ad43,null));};exports[_0x04fd('0x36')]=function(_0x3eb3ee,_0x39bdb4,_0x3d61de){var _0x1f9bd5,_0x1a4e69,_0x36309f;if(_[_0x04fd('0x76')](_0x3eb3ee[_0x04fd('0x55')][_0x04fd('0x55')])||_0x3eb3ee[_0x04fd('0x55')][_0x04fd('0x55')]===''){throw new db[(_0x04fd('0x6e'))]['ValidationError'](_0x04fd('0x78'));}if(_[_0x04fd('0x76')](_0x3eb3ee[_0x04fd('0x55')]['to'])){}_0x1f9bd5=_0x3eb3ee[_0x04fd('0x55')]['to'];return db[_0x04fd('0x39')][_0x04fd('0x63')]({'where':{'id':_0x3eb3ee[_0x04fd('0x53')]['id']}})['then'](handleEntityNotFound(_0x39bdb4,null))['then'](function(_0x45f409){if(_0x45f409){return db[_0x04fd('0x39')][_0x04fd('0x5d')]({'where':{'id':_0x45f409['id']},'include':[{'model':db[_0x04fd('0x7e')],'as':'List','include':[{'model':db[_0x04fd('0x6d')],'as':_0x04fd('0x80'),'where':{[_0x45f409['mapKey']]:_0x1f9bd5},'limit':0x1,'order':[[_0x04fd('0x73'),'DESC']]}]}]})[_0x04fd('0x1b')](handleEntityNotFound(_0x39bdb4,null))[_0x04fd('0x1b')](function(_0x586706){if(_0x586706&&_0x586706['List']){_0x1a4e69=_0x586706['get']({'plain':!![]});if(_0x1a4e69[_0x04fd('0x7f')]&&_0x1a4e69[_0x04fd('0x7f')]['Contacts'][_0x04fd('0x42')]){return _0x1a4e69[_0x04fd('0x7f')][_0x04fd('0x80')][0x0];}return db[_0x04fd('0x6d')]['create'](_[_0x04fd('0x14')](_0x3eb3ee[_0x04fd('0x55')],{'firstName':_0x1f9bd5,[_0x586706[_0x04fd('0x7b')]]:_0x1f9bd5,'phone':_0x1f9bd5,'ListId':_0x1a4e69[_0x04fd('0x75')]}));}})['then'](handleEntityNotFound(_0x39bdb4,null))[_0x04fd('0x1b')](function(_0x2091f7){if(_0x2091f7){_0x36309f=_0x2091f7;return db[_0x04fd('0x8e')][_0x04fd('0x5d')]({'where':{'ContactId':_0x36309f['id'],'closed':![],'OpenchannelAccountId':_0x1a4e69['id']}})['then'](function(_0x455a03){if(_0x455a03){return[_0x455a03,![]];}return db[_0x04fd('0x8e')][_0x04fd('0x54')]({'UserId':_0x3eb3ee[_0x04fd('0x59')]['id'],'ContactId':_0x36309f['id'],'OpenchannelAccountId':_0x1a4e69['id'],'lastMsgDirection':_0x04fd('0xb4'),'Messages':[_[_0x04fd('0x49')](_0x3eb3ee['body'],{'read':![],'body':_0x3eb3ee['body']['body'],'OpenchannelAccountId':_0x1a4e69['id'],'UserId':_0x3eb3ee[_0x04fd('0x59')]['id'],'ContactId':_0x36309f['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x04fd('0xb5')}]})[_0x04fd('0x1b')](function(_0x5bf329){return[_0x5bf329,!![]];});});}})[_0x04fd('0x91')](function(_0x592c56,_0x4c478b){if(_0x4c478b){return _0x592c56;}return db[_0x04fd('0x98')][_0x04fd('0x54')](_['merge'](_0x3eb3ee[_0x04fd('0x55')],{'read':![],'body':_0x3eb3ee['body'][_0x04fd('0x55')],'OpenchannelAccountId':_0x1a4e69['id'],'OpenchannelInteractionId':_0x592c56['id'],'UserId':_0x3eb3ee[_0x04fd('0x59')]['id'],'ContactId':_0x36309f['id']}))[_0x04fd('0x1b')](function(_0x52397a){_0x592c56[_0x04fd('0xb6')]['Messages']=[];_0x592c56[_0x04fd('0xb6')]['Messages'][_0x04fd('0xb7')](_0x52397a[_0x04fd('0xb6')]);return _0x592c56;});});}})['then'](respondWithResult(_0x39bdb4,null))[_0x04fd('0x26')](handleError(_0x39bdb4,null));};
\ No newline at end of file
+var _0xa0bb=['priority','asc','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','lastName','messageId','interaction','created','autoclose','push','close','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','sequelize','OpenchannelAccountId','bulkCreate','findAndCountAll','getApplications','Contact','Owner','internal','Tag','color','tag','addAgents','ids','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','dataValues','Messages','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','update','destroy','get','OpenchannelAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','keys','query','intersection','model','attributes','fields','length','sort','where','filters','pick','merge','map','type','key','VIRTUAL','filter','options','include','rows','show','params','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpnechannelAccountId','getDispositions','findOne','Disposition','hasOwnProperty','nolimit','includeAll','findAll','removeDispositions','CannedAnswer','order','removeAnswers','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','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','OpenchannelApplication','Applications','account','applications','orderBy'];(function(_0x455b18,_0x2462c9){var _0x53848f=function(_0x3de7de){while(--_0x3de7de){_0x455b18['push'](_0x455b18['shift']());}};_0x53848f(++_0x2462c9);}(_0xa0bb,0xee));var _0xba0b=function(_0x28c694,_0x504b0a){_0x28c694=_0x28c694-0x0;var _0x17156e=_0xa0bb[_0x28c694];return _0x17156e;};'use strict';var pdf=require(_0xba0b('0x0'));var emlformat=require(_0xba0b('0x1'));var rimraf=require(_0xba0b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xba0b('0x3'));var rp=require(_0xba0b('0x4'));var moment=require(_0xba0b('0x5'));var BPromise=require(_0xba0b('0x6'));var Mustache=require(_0xba0b('0x7'));var util=require(_0xba0b('0x8'));var path=require(_0xba0b('0x9'));var sox=require(_0xba0b('0xa'));var csv=require(_0xba0b('0xb'));var ejs=require(_0xba0b('0xc'));var fs=require('fs');var _=require(_0xba0b('0xd'));var squel=require(_0xba0b('0xe'));var crypto=require(_0xba0b('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xba0b('0x10'));var toCsv=require(_0xba0b('0xb'));var querystring=require(_0xba0b('0x11'));var Papa=require(_0xba0b('0x12'));var authService=require('../../components/auth/service');var hardwareService=require(_0xba0b('0x13'));var Redis=require(_0xba0b('0x14'));var qs=require(_0xba0b('0x15'));var logger=require(_0xba0b('0x16'))(_0xba0b('0x17'));var utils=require(_0xba0b('0x18'));var config=require('../../config/environment');var db=require(_0xba0b('0x19'))['db'];config[_0xba0b('0x1a')]=_[_0xba0b('0x1b')](config[_0xba0b('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xba0b('0x1c'))(new Redis(config[_0xba0b('0x1a')]));require(_0xba0b('0x1d'))[_0xba0b('0x1e')](socket);var jayson=require(_0xba0b('0x1f'));var client=jayson[_0xba0b('0x20')][_0xba0b('0x21')]({'port':0x232c});var client9002=jayson['client'][_0xba0b('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x2926f7,_0x59bfeb,_0x1c6c6e,_0xf884f3){return new BPromise(function(_0x251bcd,_0x256392){var _0xae5321=_0xf884f3||client;return _0xae5321[_0xba0b('0x22')](_0x2926f7,_0x1c6c6e)[_0xba0b('0x23')](function(_0x27d092){logger[_0xba0b('0x24')](_0xba0b('0x25'),_0x59bfeb,_0xba0b('0x26'));logger[_0xba0b('0x27')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x59bfeb,_0xba0b('0x26'),JSON['stringify'](_0x27d092));if(_0x27d092['error']){if(_0x27d092['error'][_0xba0b('0x28')]===0x1f4){logger[_0xba0b('0x29')](_0xba0b('0x25'),_0x59bfeb,_0x27d092[_0xba0b('0x29')][_0xba0b('0x2a')]);return _0x256392(_0x27d092[_0xba0b('0x29')]['message']);}logger[_0xba0b('0x29')]('OpenchannelAccount,\x20%s,\x20%s',_0x59bfeb,_0x27d092['error']['message']);return _0x251bcd(_0x27d092[_0xba0b('0x29')][_0xba0b('0x2a')]);}else{logger[_0xba0b('0x24')](_0xba0b('0x25'),_0x59bfeb,_0xba0b('0x26'));_0x251bcd(_0x27d092[_0xba0b('0x2b')][_0xba0b('0x2a')]);}})[_0xba0b('0x2c')](function(_0x4968a2){logger['error'](_0xba0b('0x25'),_0x59bfeb,_0x4968a2);_0x256392(_0x4968a2);});});}function respondWithStatusCode(_0x3d2c90,_0x3e5f6b){_0x3e5f6b=_0x3e5f6b||0xcc;return function(_0x22cc50){if(_0x22cc50){return _0x3d2c90[_0xba0b('0x2d')](_0x3e5f6b);}return _0x3d2c90['status'](_0x3e5f6b)[_0xba0b('0x2e')]();};}function respondWithResult(_0x4e7815,_0x3d380b){_0x3d380b=_0x3d380b||0xc8;return function(_0x386930){if(_0x386930){return _0x4e7815[_0xba0b('0x2f')](_0x3d380b)[_0xba0b('0x30')](_0x386930);}};}function respondWithFilteredResult(_0x46bcf6,_0x3dfa8c){return function(_0x28c023){if(_0x28c023){var _0x188b0d=_0x28c023[_0xba0b('0x31')],_0x354bd1=_0x3dfa8c[_0xba0b('0x32')],_0xdeb000=_0x3dfa8c['offset']+_0x3dfa8c[_0xba0b('0x33')],_0x2cfac0;if(_0xdeb000>=_0x188b0d){_0xdeb000=_0x188b0d;_0x2cfac0=0xc8;}else{_0x2cfac0=0xce;}_0x46bcf6['status'](_0x2cfac0);return _0x46bcf6['set'](_0xba0b('0x34'),_0x354bd1+'-'+_0xdeb000+'/'+_0x188b0d)[_0xba0b('0x30')](_0x28c023);}return null;};}function patchUpdates(_0x1c415c){return function(_0x2f24a5){try{jsonpatch[_0xba0b('0x35')](_0x2f24a5,_0x1c415c,!![]);}catch(_0x2085fc){return BPromise[_0xba0b('0x36')](_0x2085fc);}return _0x2f24a5['save']();};}function saveUpdates(_0x2dffc4,_0x4edd14){return function(_0x785304){if(_0x785304){return _0x785304[_0xba0b('0x37')](_0x2dffc4)['then'](function(_0xf16a2c){return _0xf16a2c;});}return null;};}function removeEntity(_0x4cab44,_0x588b9d){return function(_0xf5f1cc){if(_0xf5f1cc){return _0xf5f1cc[_0xba0b('0x38')]()['then'](function(){var _0x502631=_0xf5f1cc[_0xba0b('0x39')]({'plain':!![]});var _0x98e698=_0xba0b('0x3a');return db[_0xba0b('0x3b')][_0xba0b('0x38')]({'where':{'type':_0x98e698,'resourceId':_0x502631['id']}})[_0xba0b('0x23')](function(){return _0xf5f1cc;});})[_0xba0b('0x23')](function(){_0x4cab44[_0xba0b('0x2f')](0xcc)[_0xba0b('0x2e')]();});}};}function handleEntityNotFound(_0x3b74f0,_0x5016f2){return function(_0xd4c8ef){if(!_0xd4c8ef){_0x3b74f0[_0xba0b('0x2d')](0x194);}return _0xd4c8ef;};}function handleError(_0x4516de,_0x464628){_0x464628=_0x464628||0x1f4;return function(_0x183d99){logger['error'](_0x183d99['stack']);if(_0x183d99[_0xba0b('0x3c')]){delete _0x183d99[_0xba0b('0x3c')];}_0x4516de[_0xba0b('0x2f')](_0x464628)[_0xba0b('0x3d')](_0x183d99);};}exports[_0xba0b('0x3e')]=function(_0x4c07c8,_0x9e99f4){var _0x4b919e={'include':[{'model':db[_0xba0b('0x3f')],'as':_0xba0b('0x40')}]},_0x1b2f30={},_0x653956={'count':0x0,'rows':[]};var _0x482347=db[_0xba0b('0x41')][_0xba0b('0x42')];_0x1b2f30['model']=_[_0xba0b('0x43')](_0x482347);_0x1b2f30[_0xba0b('0x44')]=_[_0xba0b('0x43')](_0x4c07c8[_0xba0b('0x44')]);_0x1b2f30['filters']=_[_0xba0b('0x45')](_0x1b2f30[_0xba0b('0x46')],_0x1b2f30[_0xba0b('0x44')]);_0x4b919e[_0xba0b('0x47')]=_[_0xba0b('0x45')](_0x1b2f30[_0xba0b('0x46')],qs[_0xba0b('0x48')](_0x4c07c8[_0xba0b('0x44')]['fields']));_0x4b919e[_0xba0b('0x47')]=_0x4b919e['attributes'][_0xba0b('0x49')]?_0x4b919e['attributes']:_0x1b2f30['model'];if(!_0x4c07c8['query']['hasOwnProperty']('nolimit')){_0x4b919e[_0xba0b('0x33')]=qs[_0xba0b('0x33')](_0x4c07c8['query'][_0xba0b('0x33')]);_0x4b919e[_0xba0b('0x32')]=qs[_0xba0b('0x32')](_0x4c07c8[_0xba0b('0x44')][_0xba0b('0x32')]);}_0x4b919e['order']=qs[_0xba0b('0x4a')](_0x4c07c8['query'][_0xba0b('0x4a')]);_0x4b919e[_0xba0b('0x4b')]=qs[_0xba0b('0x4c')](_[_0xba0b('0x4d')](_0x4c07c8[_0xba0b('0x44')],_0x1b2f30[_0xba0b('0x4c')]));if(_0x4c07c8[_0xba0b('0x44')]['filter']){_0x4b919e[_0xba0b('0x4b')]=_[_0xba0b('0x4e')](_0x4b919e['where'],{'$or':_[_0xba0b('0x4f')](_0x482347,function(_0x18cfa2){if(_0x18cfa2[_0xba0b('0x50')][_0xba0b('0x51')]!==_0xba0b('0x52')){var _0x18b27e={};_0x18b27e[_0x18cfa2['field']]={'$like':'%'+_0x4c07c8[_0xba0b('0x44')][_0xba0b('0x53')]+'%'};return _0x18b27e;}})});}_0x4b919e=_['merge']({},_0x4b919e,_0x4c07c8[_0xba0b('0x54')]);var _0x1199bd={'where':_0x4b919e[_0xba0b('0x4b')]};return db[_0xba0b('0x41')][_0xba0b('0x31')](_0x1199bd)[_0xba0b('0x23')](function(_0x309116){_0x653956[_0xba0b('0x31')]=_0x309116;if(_0x4c07c8[_0xba0b('0x44')]['includeAll']){_0x4b919e[_0xba0b('0x55')]=[{'all':!![]}];}return db[_0xba0b('0x41')]['findAll'](_0x4b919e);})['then'](function(_0x1ed135){_0x653956[_0xba0b('0x56')]=_0x1ed135;return _0x653956;})[_0xba0b('0x23')](respondWithFilteredResult(_0x9e99f4,_0x4b919e))['catch'](handleError(_0x9e99f4,null));};exports[_0xba0b('0x57')]=function(_0x199572,_0x26cb37){var _0x441606={'raw':![],'where':{'id':_0x199572[_0xba0b('0x58')]['id']},'include':[{'model':db[_0xba0b('0x3f')],'as':_0xba0b('0x40')}]},_0x1034c2={};_0x1034c2[_0xba0b('0x46')]=_[_0xba0b('0x43')](db['OpenchannelAccount']['rawAttributes']);_0x1034c2[_0xba0b('0x44')]=_[_0xba0b('0x43')](_0x199572['query']);_0x1034c2[_0xba0b('0x4c')]=_[_0xba0b('0x45')](_0x1034c2[_0xba0b('0x46')],_0x1034c2[_0xba0b('0x44')]);_0x441606[_0xba0b('0x47')]=_[_0xba0b('0x45')](_0x1034c2[_0xba0b('0x46')],qs['fields'](_0x199572[_0xba0b('0x44')][_0xba0b('0x48')]));_0x441606[_0xba0b('0x47')]=_0x441606[_0xba0b('0x47')]['length']?_0x441606[_0xba0b('0x47')]:_0x1034c2[_0xba0b('0x46')];if(_0x199572[_0xba0b('0x44')]['includeAll']){_0x441606[_0xba0b('0x55')]=[{'all':!![]}];}_0x441606=_[_0xba0b('0x4e')]({},_0x441606,_0x199572['options']);return db[_0xba0b('0x41')][_0xba0b('0x59')](_0x441606)[_0xba0b('0x23')](handleEntityNotFound(_0x26cb37,null))[_0xba0b('0x23')](respondWithResult(_0x26cb37,null))[_0xba0b('0x2c')](handleError(_0x26cb37,null));};exports['create']=function(_0x24e95c,_0x4d7775){return db['OpenchannelAccount'][_0xba0b('0x5a')](_0x24e95c[_0xba0b('0x5b')],{})[_0xba0b('0x23')](function(_0x27fe8b){var _0x1a8536=_0x24e95c['user'][_0xba0b('0x39')]({'plain':!![]});if(!_0x1a8536)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a8536[_0xba0b('0x5c')]===_0xba0b('0x5d')){var _0x259133=_0x27fe8b[_0xba0b('0x39')]({'plain':!![]});var _0x21ee5d=_0xba0b('0x3a');return db[_0xba0b('0x5e')][_0xba0b('0x59')]({'where':{'name':_0x21ee5d,'userProfileId':_0x1a8536[_0xba0b('0x5f')]},'raw':!![]})['then'](function(_0x1ddbf5){if(_0x1ddbf5&&_0x1ddbf5[_0xba0b('0x60')]===0x0){return db[_0xba0b('0x3b')][_0xba0b('0x5a')]({'name':_0x259133[_0xba0b('0x3c')],'resourceId':_0x259133['id'],'type':_0x1ddbf5[_0xba0b('0x3c')],'sectionId':_0x1ddbf5['id']},{})['then'](function(){return _0x27fe8b;});}else{return _0x27fe8b;}})['catch'](function(_0x355abe){logger[_0xba0b('0x29')](_0xba0b('0x61'),_0x355abe);throw _0x355abe;});}return _0x27fe8b;})['then'](respondWithResult(_0x4d7775,0xc9))[_0xba0b('0x2c')](handleError(_0x4d7775,null));};exports[_0xba0b('0x37')]=function(_0x25988e,_0xadfaa7){if(_0x25988e['body']['id']){delete _0x25988e[_0xba0b('0x5b')]['id'];}return db['OpenchannelAccount'][_0xba0b('0x59')]({'where':{'id':_0x25988e['params']['id']},'include':[{'model':db[_0xba0b('0x3f')],'as':_0xba0b('0x40')}]})[_0xba0b('0x23')](handleEntityNotFound(_0xadfaa7,null))[_0xba0b('0x23')](saveUpdates(_0x25988e['body'],null))[_0xba0b('0x23')](function(_0x5ea62a){if(_0x5ea62a&&_0x25988e[_0xba0b('0x5b')]['mandatoryDispositionPause']){return db[_0xba0b('0x3f')][_0xba0b('0x37')](_0x25988e[_0xba0b('0x5b')]['mandatoryDispositionPause'],{'where':{'OpenchannelAccountId':_0x5ea62a['id']}})[_0xba0b('0x23')](function(){return _0x5ea62a;});}return _0x5ea62a;})[_0xba0b('0x23')](respondWithResult(_0xadfaa7,null))[_0xba0b('0x2c')](handleError(_0xadfaa7,null));};exports['destroy']=function(_0x4808f3,_0x44eee8){return db[_0xba0b('0x41')][_0xba0b('0x59')]({'where':{'id':_0x4808f3[_0xba0b('0x58')]['id']}})[_0xba0b('0x23')](handleEntityNotFound(_0x44eee8,null))[_0xba0b('0x23')](removeEntity(_0x44eee8,null))[_0xba0b('0x2c')](handleError(_0x44eee8,null));};exports[_0xba0b('0x62')]=function(_0x193b3e,_0x1fc9fe){return db[_0xba0b('0x41')]['describe']()[_0xba0b('0x23')](respondWithResult(_0x1fc9fe,null))['catch'](handleError(_0x1fc9fe,null));};exports[_0xba0b('0x63')]=function(_0x3f1412,_0x3d196a,_0x5ad7fe){if(_0x3f1412[_0xba0b('0x5b')]['id']){delete _0x3f1412[_0xba0b('0x5b')]['id'];}return db['OpenchannelAccount'][_0xba0b('0x59')]({'where':{'id':_0x3f1412[_0xba0b('0x58')]['id']}})[_0xba0b('0x23')](handleEntityNotFound(_0x3d196a,null))[_0xba0b('0x23')](function(_0x15dfcf){if(_0x15dfcf){_0x3f1412[_0xba0b('0x5b')][_0xba0b('0x64')]=_0x15dfcf['id'];return db['Disposition'][_0xba0b('0x5a')](_0x3f1412[_0xba0b('0x5b')]);}})[_0xba0b('0x23')](respondWithResult(_0x3d196a,null))[_0xba0b('0x2c')](handleError(_0x3d196a,null));};exports[_0xba0b('0x65')]=function(_0x205169,_0x269cc4,_0x511d99){var _0x591d2a={'raw':![],'where':{}};var _0x2188e6={};var _0xfb2e91={'count':0x0,'rows':[]};return db[_0xba0b('0x41')][_0xba0b('0x66')]({'where':{'id':_0x205169[_0xba0b('0x58')]['id']}})[_0xba0b('0x23')](handleEntityNotFound(_0x269cc4,null))[_0xba0b('0x23')](function(_0x2612c3){if(_0x2612c3){_0x2188e6[_0xba0b('0x46')]=_['keys'](db[_0xba0b('0x67')][_0xba0b('0x42')]);_0x2188e6[_0xba0b('0x44')]=_[_0xba0b('0x43')](_0x205169['query']);_0x2188e6[_0xba0b('0x4c')]=_[_0xba0b('0x45')](_0x2188e6[_0xba0b('0x46')],_0x2188e6['query']);_0x591d2a[_0xba0b('0x47')]=_[_0xba0b('0x45')](_0x2188e6[_0xba0b('0x46')],qs[_0xba0b('0x48')](_0x205169[_0xba0b('0x44')][_0xba0b('0x48')]));_0x591d2a['attributes']=_0x591d2a['attributes'][_0xba0b('0x49')]?_0x591d2a[_0xba0b('0x47')]:_0x2188e6[_0xba0b('0x46')];if(!_0x205169[_0xba0b('0x44')][_0xba0b('0x68')](_0xba0b('0x69'))){_0x591d2a[_0xba0b('0x33')]=qs[_0xba0b('0x33')](_0x205169[_0xba0b('0x44')][_0xba0b('0x33')]);_0x591d2a[_0xba0b('0x32')]=qs[_0xba0b('0x32')](_0x205169[_0xba0b('0x44')]['offset']);}_0x591d2a['order']=qs[_0xba0b('0x4a')](_0x205169[_0xba0b('0x44')][_0xba0b('0x4a')]);_0x591d2a[_0xba0b('0x4b')]=qs[_0xba0b('0x4c')](_[_0xba0b('0x4d')](_0x205169['query'],_0x2188e6[_0xba0b('0x4c')]));_0x591d2a['where']['OpenchannelAccountId']=_0x2612c3['id'];if(_0x205169[_0xba0b('0x44')][_0xba0b('0x53')]){_0x591d2a[_0xba0b('0x4b')]=_[_0xba0b('0x4e')](_0x591d2a['where'],{'$or':_['map'](_0x591d2a[_0xba0b('0x47')],function(_0x58c1a8){var _0x3b7493={};_0x3b7493[_0x58c1a8]={'$like':'%'+_0x205169[_0xba0b('0x44')]['filter']+'%'};return _0x3b7493;})});}_0x591d2a=_[_0xba0b('0x4e')]({},_0x591d2a,_0x205169['options']);return db[_0xba0b('0x67')][_0xba0b('0x31')]({'where':_0x591d2a[_0xba0b('0x4b')]})[_0xba0b('0x23')](function(_0x5a43c4){_0xfb2e91[_0xba0b('0x31')]=_0x5a43c4;if(_0x205169[_0xba0b('0x44')][_0xba0b('0x6a')]){_0x591d2a[_0xba0b('0x55')]=[{'all':!![]}];}return db[_0xba0b('0x67')][_0xba0b('0x6b')](_0x591d2a);})[_0xba0b('0x23')](function(_0x412480){_0xfb2e91[_0xba0b('0x56')]=_0x412480;return _0xfb2e91;});}})[_0xba0b('0x23')](respondWithFilteredResult(_0x269cc4,_0x591d2a))[_0xba0b('0x2c')](handleError(_0x269cc4,null));};exports[_0xba0b('0x6c')]=function(_0xedd1a4,_0x599cc3,_0x38b3f3){var _0x37d958;return db[_0xba0b('0x41')][_0xba0b('0x59')]({'where':{'id':_0xedd1a4[_0xba0b('0x58')]['id']}})[_0xba0b('0x23')](handleEntityNotFound(_0x599cc3,null))[_0xba0b('0x23')](function(_0x405af6){if(_0x405af6){return _0x405af6['removeDispositions'](_0xedd1a4[_0xba0b('0x44')]['ids']);}})['then'](respondWithStatusCode(_0x599cc3,null))['catch'](handleError(_0x599cc3,null));};exports['addAnswer']=function(_0x12a559,_0x512308,_0x4d8c80){if(_0x12a559[_0xba0b('0x5b')]['id']){delete _0x12a559[_0xba0b('0x5b')]['id'];}return db[_0xba0b('0x41')][_0xba0b('0x59')]({'where':{'id':_0x12a559[_0xba0b('0x58')]['id']}})[_0xba0b('0x23')](handleEntityNotFound(_0x512308,null))['then'](function(_0x10a0a8){if(_0x10a0a8){_0x12a559['body']['OpenchannelAccountId']=_0x10a0a8['id'];return db[_0xba0b('0x6d')]['create'](_0x12a559[_0xba0b('0x5b')]);}})[_0xba0b('0x23')](respondWithResult(_0x512308,null))[_0xba0b('0x2c')](handleError(_0x512308,null));};exports['getAnswers']=function(_0x2b4bda,_0x50ee83,_0x149269){var _0x587bb6={'raw':![],'where':{}};var _0x1398ce={};var _0x419799={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xba0b('0x66')]({'where':{'id':_0x2b4bda['params']['id']}})['then'](handleEntityNotFound(_0x50ee83,null))[_0xba0b('0x23')](function(_0x3724bc){if(_0x3724bc){_0x1398ce[_0xba0b('0x46')]=_[_0xba0b('0x43')](db[_0xba0b('0x6d')][_0xba0b('0x42')]);_0x1398ce[_0xba0b('0x44')]=_[_0xba0b('0x43')](_0x2b4bda[_0xba0b('0x44')]);_0x1398ce[_0xba0b('0x4c')]=_['intersection'](_0x1398ce[_0xba0b('0x46')],_0x1398ce[_0xba0b('0x44')]);_0x587bb6[_0xba0b('0x47')]=_['intersection'](_0x1398ce[_0xba0b('0x46')],qs[_0xba0b('0x48')](_0x2b4bda['query']['fields']));_0x587bb6[_0xba0b('0x47')]=_0x587bb6[_0xba0b('0x47')]['length']?_0x587bb6[_0xba0b('0x47')]:_0x1398ce['model'];if(!_0x2b4bda[_0xba0b('0x44')][_0xba0b('0x68')]('nolimit')){_0x587bb6['limit']=qs['limit'](_0x2b4bda['query'][_0xba0b('0x33')]);_0x587bb6[_0xba0b('0x32')]=qs[_0xba0b('0x32')](_0x2b4bda[_0xba0b('0x44')][_0xba0b('0x32')]);}_0x587bb6[_0xba0b('0x6e')]=qs[_0xba0b('0x4a')](_0x2b4bda[_0xba0b('0x44')][_0xba0b('0x4a')]);_0x587bb6[_0xba0b('0x4b')]=qs[_0xba0b('0x4c')](_[_0xba0b('0x4d')](_0x2b4bda[_0xba0b('0x44')],_0x1398ce[_0xba0b('0x4c')]));_0x587bb6[_0xba0b('0x4b')]['OpenchannelAccountId']=_0x3724bc['id'];if(_0x2b4bda[_0xba0b('0x44')][_0xba0b('0x53')]){_0x587bb6[_0xba0b('0x4b')]=_['merge'](_0x587bb6[_0xba0b('0x4b')],{'$or':_['map'](_0x587bb6[_0xba0b('0x47')],function(_0x219121){var _0x39289b={};_0x39289b[_0x219121]={'$like':'%'+_0x2b4bda['query'][_0xba0b('0x53')]+'%'};return _0x39289b;})});}_0x587bb6=_[_0xba0b('0x4e')]({},_0x587bb6,_0x2b4bda[_0xba0b('0x54')]);return db[_0xba0b('0x6d')][_0xba0b('0x31')]({'where':_0x587bb6[_0xba0b('0x4b')]})[_0xba0b('0x23')](function(_0x466282){_0x419799[_0xba0b('0x31')]=_0x466282;if(_0x2b4bda[_0xba0b('0x44')][_0xba0b('0x6a')]){_0x587bb6[_0xba0b('0x55')]=[{'all':!![]}];}return db[_0xba0b('0x6d')]['findAll'](_0x587bb6);})[_0xba0b('0x23')](function(_0x5e902c){_0x419799['rows']=_0x5e902c;return _0x419799;});}})[_0xba0b('0x23')](respondWithFilteredResult(_0x50ee83,_0x587bb6))[_0xba0b('0x2c')](handleError(_0x50ee83,null));};exports['removeAnswers']=function(_0x503f64,_0x5d9081,_0x7f434a){var _0x811cf2;return db[_0xba0b('0x41')]['find']({'where':{'id':_0x503f64[_0xba0b('0x58')]['id']}})['then'](handleEntityNotFound(_0x5d9081,null))['then'](function(_0x27ddd1){if(_0x27ddd1){return _0x27ddd1[_0xba0b('0x6f')](_0x503f64['query']['ids']);}})['then'](respondWithStatusCode(_0x5d9081,null))[_0xba0b('0x2c')](handleError(_0x5d9081,null));};exports['notify']=function(_0x41214a,_0x24ac62,_0xd0f1b){var _0x281941={'body':_0x41214a[_0xba0b('0x5b')],'channel':_0xba0b('0x70')};var _0x315dc7=[];var _0x15c334=[];var _0x35d8d6={};var _0x5dc29b=![];return db[_0xba0b('0x71')][_0xba0b('0x62')]()[_0xba0b('0x23')](function(_0x5a6a1f){if(!_0x5a6a1f){throw new db[(_0xba0b('0x72'))][(_0xba0b('0x73'))](_0xba0b('0x74'));}_0x315dc7=_[_0xba0b('0x75')](_['keys'](_0x5a6a1f),[_0xba0b('0x76'),_0xba0b('0x77')]);_0x15c334=_[_0xba0b('0x75')](_[_0xba0b('0x43')](_0x5a6a1f),[_0xba0b('0x76'),'updatedAt',_0xba0b('0x78'),_0xba0b('0x79')]);if(_0x41214a['body']['id']){delete _0x41214a[_0xba0b('0x5b')]['id'];}if(_[_0xba0b('0x7a')](_0x41214a[_0xba0b('0x5b')][_0xba0b('0x7b')])){throw new db[(_0xba0b('0x72'))][(_0xba0b('0x73'))]('from\x20is\x20mandatory');}if(_[_0xba0b('0x7a')](_0x41214a[_0xba0b('0x5b')][_0xba0b('0x5b')])||_0x41214a['body'][_0xba0b('0x5b')]===''){throw new db[(_0xba0b('0x72'))][(_0xba0b('0x73'))](_0xba0b('0x7c'));}if(_[_0xba0b('0x7a')](_0x41214a['body'][_0xba0b('0x7d')])){throw new db[(_0xba0b('0x72'))][(_0xba0b('0x73'))](_0xba0b('0x7e')+_0x15c334);}if(!_[_0xba0b('0x7f')](_0x15c334,_0x41214a[_0xba0b('0x5b')][_0xba0b('0x7d')])){throw new db['Sequelize']['ValidationError'](_0xba0b('0x80')+_0x15c334);}_0x35d8d6[_0x41214a['body'][_0xba0b('0x7d')]]=_0x41214a[_0xba0b('0x5b')]['from'];})['then'](function(){return db['OpenchannelAccount'][_0xba0b('0x59')]({'where':{'id':_0x41214a['params']['id']},'include':[{'model':db[_0xba0b('0x81')],'as':_0xba0b('0x82'),'include':[{'model':db[_0xba0b('0x71')],'as':_0xba0b('0x83'),'where':_0x35d8d6,'limit':0x1,'order':[[_0xba0b('0x77'),_0xba0b('0x84')]]}]},{'model':db[_0xba0b('0x85')],'as':_0xba0b('0x86')}]});})[_0xba0b('0x23')](handleEntityNotFound(_0x24ac62,null))[_0xba0b('0x23')](function(_0x142a39){if(_0x142a39&&_0x142a39[_0xba0b('0x82')]){_0x281941[_0xba0b('0x87')]=_0x142a39;_0x281941[_0xba0b('0x88')]=_0x142a39[_0xba0b('0x86')];_0x281941['list']=_0x142a39['List'];_0x281941[_0xba0b('0x88')]=_[_0xba0b('0x89')](_0x281941[_0xba0b('0x88')],[_0xba0b('0x8a')],[_0xba0b('0x8b')]);if(_0x281941[_0xba0b('0x87')][_0xba0b('0x86')]){delete _0x281941[_0xba0b('0x87')][_0xba0b('0x86')];}if(_0x281941[_0xba0b('0x87')][_0xba0b('0x82')]&&_0x281941[_0xba0b('0x87')][_0xba0b('0x82')]['Contacts'][_0xba0b('0x49')]){return _0x281941[_0xba0b('0x87')][_0xba0b('0x82')][_0xba0b('0x83')][0x0];}var _0x50e61c=_['defaults'](_0x41214a[_0xba0b('0x5b')],{'firstName':_0x41214a[_0xba0b('0x5b')][_0xba0b('0x7b')],'ListId':_0x142a39[_0xba0b('0x79')]});_0x50e61c[_0x41214a[_0xba0b('0x5b')][_0xba0b('0x7d')]]=_0x41214a[_0xba0b('0x5b')][_0xba0b('0x7b')];return db[_0xba0b('0x71')]['create'](_0x50e61c,{'fields':_0x315dc7,'raw':!![]});}})[_0xba0b('0x23')](handleEntityNotFound(_0x24ac62,null))['then'](function(_0x17b47f){_0x281941[_0xba0b('0x8c')]=_0x17b47f;if(_0x17b47f){var _0x3c109d={'ContactId':_0x17b47f['id'],'OpenchannelAccountId':_0x41214a['params']['id'],'from':(_0x17b47f[_0xba0b('0x8d')]||'')+'\x20'+(_0x17b47f['lastName']||'')};var _0x307f03={'OpenchannelAccountId':_0x41214a[_0xba0b('0x58')]['id'],'closed':![]};if(_0x41214a[_0xba0b('0x5b')]['threadId']){_0x307f03[_0xba0b('0x8e')]=_0x41214a['body'][_0xba0b('0x8e')];return db[_0xba0b('0x8f')][_0xba0b('0x59')]({'where':_0x307f03})['then'](function(_0x461ada){if(_0x461ada){return[_0x461ada,![]];}_0x3c109d['threadId']=_0x41214a[_0xba0b('0x5b')]['threadId'];_0x3c109d[_0xba0b('0x90')]=_0x41214a['body']['externalUrl'];return db[_0xba0b('0x8f')]['create'](_0x3c109d)[_0xba0b('0x23')](function(_0x5135a5){return[_0x5135a5,!![]];});});}else{_0x307f03[_0xba0b('0x8e')]=null;}_0x307f03[_0xba0b('0x91')]=_0x17b47f['id'];return db[_0xba0b('0x8f')][_0xba0b('0x59')]({'where':_0x307f03})['then'](function(_0x15b307){if(_0x15b307){return[_0x15b307,![]];}return db['OpenchannelInteraction'][_0xba0b('0x5a')](_0x3c109d)[_0xba0b('0x23')](function(_0x32b926){return[_0x32b926,!![]];});});}})[_0xba0b('0x92')](function(_0x228d81,_0x1e7ed2){if(_0x228d81){_0x5dc29b=_0x1e7ed2;if(!_0x1e7ed2){var _0x749977={'from':(_0x281941[_0xba0b('0x8c')][_0xba0b('0x8d')]||'')+'\x20'+(_0x281941[_0xba0b('0x8c')][_0xba0b('0x93')]||'')};if(_0x41214a['body'][_0xba0b('0x8e')]&&_0x41214a[_0xba0b('0x5b')][_0xba0b('0x94')]&&_0x41214a[_0xba0b('0x5b')][_0xba0b('0x8e')]!=_0x41214a[_0xba0b('0x5b')][_0xba0b('0x94')]){_0x749977[_0xba0b('0x8e')]=_0x41214a['body']['messageId'];}return _0x228d81['update'](_0x749977);}else{return _0x228d81;}}})[_0xba0b('0x23')](function(_0x3b7b34){_0x281941[_0xba0b('0x95')]=_0x3b7b34[_0xba0b('0x39')]({'plain':!![]});_0x281941[_0xba0b('0x95')][_0xba0b('0x96')]=_0x5dc29b;if(_0x281941[_0xba0b('0x95')]['created']){if(_0x281941[_0xba0b('0x87')][_0xba0b('0x97')]){_0x281941['applications'][_0xba0b('0x98')]({'id':0x0,'priority':_0x281941[_0xba0b('0x88')]['length']+0x1,'app':_0xba0b('0x99'),'appdata':'unmanaged','interval':_0xba0b('0x9a')});}}return db['OpenchannelMessage'][_0xba0b('0x5a')]({'body':_0x41214a[_0xba0b('0x5b')]['body'],'OpenchannelAccountId':_0x41214a[_0xba0b('0x58')]['id'],'OpenchannelInteractionId':_0x3b7b34['id'],'direction':'in','ContactId':_0x281941[_0xba0b('0x8c')]['id'],'AttachmentId':_0x41214a['body'][_0xba0b('0x9b')]});})['then'](function(_0x7e13b1){_0x281941['message']=_0x7e13b1;if(_0x281941[_0xba0b('0x95')][_0xba0b('0x9c')]){return db[_0xba0b('0x9d')]['find']({'attributes':['id',_0xba0b('0x3c')],'where':{'id':_0x281941[_0xba0b('0x95')]['UserId']}})[_0xba0b('0x23')](function(_0x24656f){if(_0x24656f){_0x281941[_0xba0b('0x88')][_0xba0b('0x9e')]({'id':0x0,'priority':0x0,'app':_0xba0b('0x9f'),'appdata':_0x24656f[_0xba0b('0x3c')]+','+(_0x281941['account'][_0xba0b('0xa0')]||0xa),'interval':_0xba0b('0x9a')});_0x281941[_0xba0b('0xa1')]=![];}return respondWithRpcPromise(_0xba0b('0xa2'),_0xba0b('0xa3'),_0x281941);});}return respondWithRpcPromise('Start','startRouting',_0x281941);})[_0xba0b('0x23')](function(_0xbfa2b8){respondWithRpcPromise(_0xba0b('0xa4'),_0xba0b('0xa4'),{'event':'notify','message':_0xbfa2b8},client9002);return _0xbfa2b8;})[_0xba0b('0x23')](respondWithResult(_0x24ac62,null))[_0xba0b('0x2c')](handleError(_0x24ac62,null));};exports['addApplications']=function(_0x105c96,_0x32f909,_0x292225){return db[_0xba0b('0x41')][_0xba0b('0x66')]({'where':{'id':_0x105c96[_0xba0b('0x58')]['id']}})['then'](handleEntityNotFound(_0x32f909,null))[_0xba0b('0x23')](function(_0x32f444){if(_0x32f444){return db[_0xba0b('0xa5')]['transaction'](function(_0x3279cd){return db[_0xba0b('0x85')][_0xba0b('0x38')]({'where':{'OpenchannelAccountId':_0x105c96[_0xba0b('0x58')]['id']},'transaction':_0x3279cd})[_0xba0b('0x23')](function(_0x4180e7){var _0x3dcfe7=_[_0xba0b('0x4f')](_0x105c96['body'],function(_0x1c8fc0){_0x1c8fc0[_0xba0b('0xa6')]=_0x105c96[_0xba0b('0x58')]['id'];return _0x1c8fc0;});return db[_0xba0b('0x85')][_0xba0b('0xa7')](_0x3dcfe7,{'transaction':_0x3279cd});});})['then'](function(){return db['OpenchannelApplication'][_0xba0b('0xa8')]({'where':{'OpenchannelAccountId':_0x105c96[_0xba0b('0x58')]['id']},'order':_0xba0b('0x8a')});});}})[_0xba0b('0x23')](respondWithResult(_0x32f909,null))[_0xba0b('0x2c')](handleError(_0x32f909,null));};exports[_0xba0b('0xa9')]=function(_0x5b6822,_0x540d97,_0x6a46d0){var _0x580a78={};var _0x3f0146={};var _0x3a4a91;var _0x3144cc;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x5b6822[_0xba0b('0x58')]['id']}})[_0xba0b('0x23')](handleEntityNotFound(_0x540d97,null))['then'](function(_0x22d3c8){if(_0x22d3c8){_0x3a4a91=_0x22d3c8;_0x3f0146[_0xba0b('0x46')]=_['keys'](db['OpenchannelApplication'][_0xba0b('0x42')]);_0x3f0146[_0xba0b('0x44')]=_[_0xba0b('0x43')](_0x5b6822[_0xba0b('0x44')]);_0x3f0146[_0xba0b('0x4c')]=_[_0xba0b('0x45')](_0x3f0146[_0xba0b('0x46')],_0x3f0146[_0xba0b('0x44')]);_0x580a78[_0xba0b('0x47')]=_[_0xba0b('0x45')](_0x3f0146[_0xba0b('0x46')],qs['fields'](_0x5b6822[_0xba0b('0x44')][_0xba0b('0x48')]));_0x580a78[_0xba0b('0x47')]=_0x580a78['attributes'][_0xba0b('0x49')]?_0x580a78[_0xba0b('0x47')]:_0x3f0146[_0xba0b('0x46')];_0x580a78[_0xba0b('0x6e')]=qs['sort'](_0x5b6822[_0xba0b('0x44')][_0xba0b('0x4a')]);_0x580a78[_0xba0b('0x4b')]=qs[_0xba0b('0x4c')](_[_0xba0b('0x4d')](_0x5b6822['query'],_0x3f0146['filters']));if(_0x5b6822[_0xba0b('0x44')][_0xba0b('0x53')]){_0x580a78['where']=_[_0xba0b('0x4e')](_0x580a78['where'],{'$or':_[_0xba0b('0x4f')](_0x580a78[_0xba0b('0x47')],function(_0x40d464){var _0x495d24={};_0x495d24[_0x40d464]={'$like':'%'+_0x5b6822['query'][_0xba0b('0x53')]+'%'};return _0x495d24;})});}_0x580a78=_['merge']({},_0x580a78,_0x5b6822['options']);return _0x3a4a91[_0xba0b('0xa9')](_0x580a78);}})[_0xba0b('0x23')](function(_0x56825b){if(_0x56825b){_0x3144cc=_0x56825b[_0xba0b('0x49')];if(!_0x5b6822[_0xba0b('0x44')][_0xba0b('0x68')](_0xba0b('0x69'))){_0x580a78[_0xba0b('0x33')]=qs['limit'](_0x5b6822[_0xba0b('0x44')][_0xba0b('0x33')]);_0x580a78[_0xba0b('0x32')]=qs[_0xba0b('0x32')](_0x5b6822['query'][_0xba0b('0x32')]);}return _0x3a4a91[_0xba0b('0xa9')](_0x580a78);}})[_0xba0b('0x23')](function(_0x90965a){if(_0x90965a){return _0x90965a?{'count':_0x3144cc,'rows':_0x90965a}:null;}})[_0xba0b('0x23')](respondWithResult(_0x540d97,null))[_0xba0b('0x2c')](handleError(_0x540d97,null));};exports['getInteractions']=function(_0x3802b5,_0x57b279,_0x5df218){var _0x528ef7={'raw':![],'where':{}};var _0x46b0e0={};var _0x1513cf={'count':0x0,'rows':[]};return db[_0xba0b('0x41')][_0xba0b('0x66')]({'where':{'id':_0x3802b5[_0xba0b('0x58')]['id']}})['then'](handleEntityNotFound(_0x57b279,null))['then'](function(_0x2489c2){if(_0x2489c2){_0x46b0e0['model']=_[_0xba0b('0x43')](db['OpenchannelInteraction']['rawAttributes']);_0x46b0e0[_0xba0b('0x44')]=_['keys'](_0x3802b5['query']);_0x46b0e0[_0xba0b('0x4c')]=_[_0xba0b('0x45')](_0x46b0e0[_0xba0b('0x46')],_0x46b0e0[_0xba0b('0x44')]);_0x528ef7[_0xba0b('0x47')]=_[_0xba0b('0x45')](_0x46b0e0[_0xba0b('0x46')],qs['fields'](_0x3802b5[_0xba0b('0x44')][_0xba0b('0x48')]));_0x528ef7[_0xba0b('0x47')]=_0x528ef7['attributes']['length']?_0x528ef7[_0xba0b('0x47')]:_0x46b0e0[_0xba0b('0x46')];if(!_0x3802b5[_0xba0b('0x44')][_0xba0b('0x68')](_0xba0b('0x69'))){_0x528ef7[_0xba0b('0x33')]=qs['limit'](_0x3802b5[_0xba0b('0x44')][_0xba0b('0x33')]);_0x528ef7['offset']=qs['offset'](_0x3802b5['query'][_0xba0b('0x32')]);}_0x528ef7[_0xba0b('0x6e')]=qs['sort'](_0x3802b5[_0xba0b('0x44')][_0xba0b('0x4a')]);_0x528ef7[_0xba0b('0x4b')]=qs[_0xba0b('0x4c')](_['pick'](_0x3802b5[_0xba0b('0x44')],_0x46b0e0[_0xba0b('0x4c')]));_0x528ef7[_0xba0b('0x4b')]['OpenchannelAccountId']=_0x2489c2['id'];if(_0x3802b5[_0xba0b('0x44')]['filter']){_0x528ef7['where']=_[_0xba0b('0x4e')](_0x528ef7[_0xba0b('0x4b')],{'$or':_[_0xba0b('0x4f')](_0x528ef7[_0xba0b('0x47')],function(_0x2a17c4){var _0x5d9a82={};_0x5d9a82[_0x2a17c4]={'$like':'%'+_0x3802b5[_0xba0b('0x44')][_0xba0b('0x53')]+'%'};return _0x5d9a82;})});}_0x528ef7=_[_0xba0b('0x4e')]({},_0x528ef7,_0x3802b5[_0xba0b('0x54')]);return db[_0xba0b('0x8f')][_0xba0b('0x31')]({'where':_0x528ef7[_0xba0b('0x4b')]})[_0xba0b('0x23')](function(_0x15798c){_0x1513cf[_0xba0b('0x31')]=_0x15798c;if(_0x3802b5[_0xba0b('0x44')][_0xba0b('0x6a')]){_0x528ef7[_0xba0b('0x55')]=[{'model':db[_0xba0b('0x71')],'as':_0xba0b('0xaa'),'required':![]},{'model':db[_0xba0b('0x9d')],'as':_0xba0b('0xab'),'attributes':[_0xba0b('0x3c'),'fullname',_0xba0b('0xac')],'required':![]},{'model':db[_0xba0b('0xad')],'as':'Tags','attributes':['id',_0xba0b('0x3c'),_0xba0b('0xae')],'where':_0x3802b5['query'][_0xba0b('0xaf')]?{'id':_0x3802b5[_0xba0b('0x44')][_0xba0b('0xaf')]}:undefined,'required':_0x3802b5['query'][_0xba0b('0xaf')]?!![]:![]}];}return db['OpenchannelInteraction'][_0xba0b('0x6b')](_0x528ef7);})[_0xba0b('0x23')](function(_0x23cbf1){_0x1513cf['rows']=_0x23cbf1;return _0x1513cf;});}})['then'](respondWithFilteredResult(_0x57b279,_0x528ef7))[_0xba0b('0x2c')](handleError(_0x57b279,null));};exports[_0xba0b('0xb0')]=function(_0x19f72e,_0x3dd4d4,_0x8f7f4d){return db[_0xba0b('0x41')][_0xba0b('0x59')]({'where':{'id':_0x19f72e[_0xba0b('0x58')]['id']}})['then'](handleEntityNotFound(_0x3dd4d4,null))['then'](function(_0x503d47){if(_0x503d47){return _0x503d47[_0xba0b('0xb0')](_0x19f72e[_0xba0b('0x5b')][_0xba0b('0xb1')],_[_0xba0b('0xb2')](_0x19f72e[_0xba0b('0x5b')],[_0xba0b('0xb1'),'id'])||{})[_0xba0b('0x92')](function(_0x395707){for(var _0x55e659=0x0;_0x55e659<_0x19f72e[_0xba0b('0x5b')][_0xba0b('0xb1')][_0xba0b('0x49')];_0x55e659+=0x1){socket[_0xba0b('0xb3')](_0xba0b('0xb4'),{'UserId':_0x19f72e[_0xba0b('0x5b')][_0xba0b('0xb1')][_0x55e659],'OpenchannelAccountId':_0x19f72e[_0xba0b('0x58')]['id']});}return _0x395707;});}})[_0xba0b('0x23')](respondWithResult(_0x3dd4d4,null))['catch'](handleError(_0x3dd4d4,null));};exports[_0xba0b('0xb5')]=function(_0x72927d,_0x52244e,_0x4790eb){var _0x53e1e4;return db[_0xba0b('0x41')][_0xba0b('0x59')]({'where':{'id':_0x72927d[_0xba0b('0x58')]['id']}})[_0xba0b('0x23')](handleEntityNotFound(_0x52244e,null))[_0xba0b('0x23')](function(_0x12af37){if(_0x12af37){return _0x12af37[_0xba0b('0xb5')](_0x72927d['query'][_0xba0b('0xb1')])['then'](function(_0x5bdbd1){if(_['isArray'](_0x72927d['query'][_0xba0b('0xb1')])){for(var _0x5bd4eb=0x0;_0x5bd4eb<_0x72927d[_0xba0b('0x44')][_0xba0b('0xb1')]['length'];_0x5bd4eb+=0x1){socket[_0xba0b('0xb3')](_0xba0b('0xb6'),{'UserId':_0x72927d[_0xba0b('0x44')][_0xba0b('0xb1')][_0x5bd4eb],'OpenchannelAccountId':_0x72927d[_0xba0b('0x58')]['id']});}}else{socket[_0xba0b('0xb3')](_0xba0b('0xb6'),{'UserId':_0x72927d['query'][_0xba0b('0xb1')],'OpenchannelAccountId':_0x72927d[_0xba0b('0x58')]['id']});}});}})['then'](respondWithStatusCode(_0x52244e,null))[_0xba0b('0x2c')](handleError(_0x52244e,null));};exports[_0xba0b('0xb7')]=function(_0x31e189,_0x1ce6ae,_0x58ac04){var _0x3a3b12={};var _0x47a48a={};var _0x3428a9;var _0x36a654;return db[_0xba0b('0x41')][_0xba0b('0x66')]({'where':{'id':_0x31e189[_0xba0b('0x58')]['id']}})[_0xba0b('0x23')](handleEntityNotFound(_0x1ce6ae,null))[_0xba0b('0x23')](function(_0x2e37d7){if(_0x2e37d7){_0x3428a9=_0x2e37d7;_0x47a48a[_0xba0b('0x46')]=_['keys'](db[_0xba0b('0x9d')][_0xba0b('0x42')]);_0x47a48a['query']=_[_0xba0b('0x43')](_0x31e189[_0xba0b('0x44')]);_0x47a48a[_0xba0b('0x4c')]=_[_0xba0b('0x45')](_0x47a48a[_0xba0b('0x46')],_0x47a48a['query']);_0x3a3b12['attributes']=_[_0xba0b('0x45')](_0x47a48a['model'],qs[_0xba0b('0x48')](_0x31e189['query'][_0xba0b('0x48')]));_0x3a3b12[_0xba0b('0x47')]=_0x3a3b12[_0xba0b('0x47')][_0xba0b('0x49')]?_0x3a3b12['attributes']:_0x47a48a[_0xba0b('0x46')];_0x3a3b12['order']=qs[_0xba0b('0x4a')](_0x31e189['query'][_0xba0b('0x4a')]);_0x3a3b12['where']=qs[_0xba0b('0x4c')](_[_0xba0b('0x4d')](_0x31e189[_0xba0b('0x44')],_0x47a48a[_0xba0b('0x4c')]));if(_0x31e189[_0xba0b('0x44')][_0xba0b('0x53')]){_0x3a3b12[_0xba0b('0x4b')]=_['merge'](_0x3a3b12[_0xba0b('0x4b')],{'$or':_[_0xba0b('0x4f')](_0x3a3b12[_0xba0b('0x47')],function(_0x1b9ddf){var _0x278568={};_0x278568[_0x1b9ddf]={'$like':'%'+_0x31e189[_0xba0b('0x44')][_0xba0b('0x53')]+'%'};return _0x278568;})});}_0x3a3b12=_[_0xba0b('0x4e')]({},_0x3a3b12,_0x31e189['options']);return _0x3428a9[_0xba0b('0xb7')](_0x3a3b12);}})['then'](function(_0x378c25){if(_0x378c25){_0x36a654=_0x378c25[_0xba0b('0x49')];if(!_0x31e189[_0xba0b('0x44')][_0xba0b('0x68')](_0xba0b('0x69'))){_0x3a3b12[_0xba0b('0x33')]=qs[_0xba0b('0x33')](_0x31e189['query'][_0xba0b('0x33')]);_0x3a3b12[_0xba0b('0x32')]=qs[_0xba0b('0x32')](_0x31e189[_0xba0b('0x44')][_0xba0b('0x32')]);}return _0x3428a9[_0xba0b('0xb7')](_0x3a3b12);}})[_0xba0b('0x23')](function(_0x384b82){if(_0x384b82){return _0x384b82?{'count':_0x36a654,'rows':_0x384b82}:null;}})['then'](respondWithResult(_0x1ce6ae,null))[_0xba0b('0x2c')](handleError(_0x1ce6ae,null));};exports[_0xba0b('0x3d')]=function(_0x41ad00,_0x1d1afa,_0x3b4346){var _0x4e0481,_0x3e3d09,_0x152fda;if(_[_0xba0b('0x7a')](_0x41ad00[_0xba0b('0x5b')]['body'])||_0x41ad00[_0xba0b('0x5b')][_0xba0b('0x5b')]===''){throw new db[(_0xba0b('0x72'))][(_0xba0b('0x73'))](_0xba0b('0x7c'));}if(_[_0xba0b('0x7a')](_0x41ad00[_0xba0b('0x5b')]['to'])){}_0x4e0481=_0x41ad00['body']['to'];return db[_0xba0b('0x41')]['findOne']({'where':{'id':_0x41ad00[_0xba0b('0x58')]['id']}})['then'](handleEntityNotFound(_0x1d1afa,null))['then'](function(_0x5bba2e){if(_0x5bba2e){return db[_0xba0b('0x41')][_0xba0b('0x59')]({'where':{'id':_0x5bba2e['id']},'include':[{'model':db[_0xba0b('0x81')],'as':_0xba0b('0x82'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{[_0x5bba2e[_0xba0b('0x7d')]]:_0x4e0481},'limit':0x1,'order':[[_0xba0b('0x77'),_0xba0b('0x84')]]}]}]})[_0xba0b('0x23')](handleEntityNotFound(_0x1d1afa,null))[_0xba0b('0x23')](function(_0x4fc4ef){if(_0x4fc4ef&&_0x4fc4ef['List']){_0x3e3d09=_0x4fc4ef[_0xba0b('0x39')]({'plain':!![]});if(_0x3e3d09[_0xba0b('0x82')]&&_0x3e3d09[_0xba0b('0x82')][_0xba0b('0x83')][_0xba0b('0x49')]){return _0x3e3d09['List'][_0xba0b('0x83')][0x0];}return db['CmContact'][_0xba0b('0x5a')](_[_0xba0b('0x1b')](_0x41ad00[_0xba0b('0x5b')],{'firstName':_0x4e0481,[_0x4fc4ef[_0xba0b('0x7d')]]:_0x4e0481,'phone':_0x4e0481,'ListId':_0x3e3d09[_0xba0b('0x79')]}));}})[_0xba0b('0x23')](handleEntityNotFound(_0x1d1afa,null))['then'](function(_0x18c399){if(_0x18c399){_0x152fda=_0x18c399;return db[_0xba0b('0x8f')][_0xba0b('0x59')]({'where':{'ContactId':_0x152fda['id'],'closed':![],'OpenchannelAccountId':_0x3e3d09['id']}})[_0xba0b('0x23')](function(_0x55e4b6){if(_0x55e4b6){return[_0x55e4b6,![]];}return db['OpenchannelInteraction'][_0xba0b('0x5a')]({'UserId':_0x41ad00[_0xba0b('0x5d')]['id'],'ContactId':_0x152fda['id'],'OpenchannelAccountId':_0x3e3d09['id'],'lastMsgDirection':_0xba0b('0xb8'),'Messages':[_[_0xba0b('0x4e')](_0x41ad00[_0xba0b('0x5b')],{'read':![],'body':_0x41ad00[_0xba0b('0x5b')][_0xba0b('0x5b')],'OpenchannelAccountId':_0x3e3d09['id'],'UserId':_0x41ad00[_0xba0b('0x5d')]['id'],'ContactId':_0x152fda['id']})]},{'include':[{'model':db[_0xba0b('0xb9')],'as':'Messages'}]})[_0xba0b('0x23')](function(_0x137a0d){return[_0x137a0d,!![]];});});}})[_0xba0b('0x92')](function(_0x38cd68,_0x498690){if(_0x498690){return _0x38cd68;}return db[_0xba0b('0xb9')]['create'](_['merge'](_0x41ad00['body'],{'read':![],'body':_0x41ad00[_0xba0b('0x5b')]['body'],'OpenchannelAccountId':_0x3e3d09['id'],'OpenchannelInteractionId':_0x38cd68['id'],'UserId':_0x41ad00[_0xba0b('0x5d')]['id'],'ContactId':_0x152fda['id']}))['then'](function(_0x1744b4){_0x38cd68[_0xba0b('0xba')]['Messages']=[];_0x38cd68['dataValues'][_0xba0b('0xbb')][_0xba0b('0x98')](_0x1744b4[_0xba0b('0xba')]);return _0x38cd68;});});}})[_0xba0b('0x23')](respondWithResult(_0x1d1afa,null))[_0xba0b('0x2c')](handleError(_0x1d1afa,null));};
\ No newline at end of file
index 2fd6a35..e8aaffc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8a63=['save','update','remove','emit','hasOwnProperty','hook','exports','events','OpenchannelAccount','setMaxListeners'];(function(_0x1b3564,_0x16c919){var _0x504069=function(_0x9322b6){while(--_0x9322b6){_0x1b3564['push'](_0x1b3564['shift']());}};_0x504069(++_0x16c919);}(_0x8a63,0x1dd));var _0x38a6=function(_0x5e6116,_0x4bae08){_0x5e6116=_0x5e6116-0x0;var _0x29bf86=_0x8a63[_0x5e6116];return _0x29bf86;};'use strict';var EventEmitter=require(_0x38a6('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x38a6('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x38a6('0x2')](0x0);var events={'afterCreate':_0x38a6('0x3'),'afterUpdate':_0x38a6('0x4'),'afterDestroy':_0x38a6('0x5')};function emitEvent(_0x400c8e){return function(_0x47f54b,_0x266ea3,_0x27fa7b){OpenchannelAccountEvents[_0x38a6('0x6')](_0x400c8e+':'+_0x47f54b['id'],_0x47f54b);OpenchannelAccountEvents[_0x38a6('0x6')](_0x400c8e,_0x47f54b);_0x27fa7b(null);};}for(var e in events){if(events[_0x38a6('0x7')](e)){var event=events[e];OpenchannelAccount[_0x38a6('0x8')](e,emitEvent(event));}}module[_0x38a6('0x9')]=OpenchannelAccountEvents;
\ No newline at end of file
+var _0x50ea=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners'];(function(_0x25d633,_0x350a31){var _0x448788=function(_0x5d0464){while(--_0x5d0464){_0x25d633['push'](_0x25d633['shift']());}};_0x448788(++_0x350a31);}(_0x50ea,0x1ca));var _0xa50e=function(_0x56e19b,_0x53f5c5){_0x56e19b=_0x56e19b-0x0;var _0x4d47c8=_0x50ea[_0x56e19b];return _0x4d47c8;};'use strict';var EventEmitter=require(_0xa50e('0x0'));var OpenchannelAccount=require(_0xa50e('0x1'))['db'][_0xa50e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xa50e('0x3')](0x0);var events={'afterCreate':_0xa50e('0x4'),'afterUpdate':_0xa50e('0x5'),'afterDestroy':_0xa50e('0x6')};function emitEvent(_0x10b335){return function(_0x4a3473,_0x56d5d1,_0x207cef){OpenchannelAccountEvents[_0xa50e('0x7')](_0x10b335+':'+_0x4a3473['id'],_0x4a3473);OpenchannelAccountEvents[_0xa50e('0x7')](_0x10b335,_0x4a3473);_0x207cef(null);};}for(var e in events){if(events[_0xa50e('0x8')](e)){var event=events[e];OpenchannelAccount[_0xa50e('0x9')](e,emitEvent(event));}}module[_0xa50e('0xa')]=OpenchannelAccountEvents;
\ No newline at end of file
index 96850c5..0d6dc95 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbdb7=['exports','openchannel_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./openchannelAccount.attributes'];(function(_0x509da2,_0xd2f81a){var _0x277535=function(_0x4823bb){while(--_0x4823bb){_0x509da2['push'](_0x509da2['shift']());}};_0x277535(++_0xd2f81a);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1ac0dd,_0x5a1e5f){_0x1ac0dd=_0x1ac0dd-0x0;var _0x31fc81=_0xbdb7[_0x1ac0dd];return _0x31fc81;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var moment=require(_0x7bdb('0x4'));var BPromise=require(_0x7bdb('0x5'));var rp=require(_0x7bdb('0x6'));var attributes=require(_0x7bdb('0x7'));module[_0x7bdb('0x8')]=function(_0x47aec5,_0x28542c){return _0x47aec5['define']('OpenchannelAccount',attributes,{'tableName':_0x7bdb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xbdb7=['exports','openchannel_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./openchannelAccount.attributes'];(function(_0x5c5c52,_0x36d085){var _0x4229ff=function(_0x3806df){while(--_0x3806df){_0x5c5c52['push'](_0x5c5c52['shift']());}};_0x4229ff(++_0x36d085);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x391507,_0x564142){_0x391507=_0x391507-0x0;var _0x47fdc4=_0xbdb7[_0x391507];return _0x47fdc4;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var moment=require(_0x7bdb('0x4'));var BPromise=require(_0x7bdb('0x5'));var rp=require(_0x7bdb('0x6'));var attributes=require(_0x7bdb('0x7'));module[_0x7bdb('0x8')]=function(_0x47aec5,_0x28542c){return _0x47aec5['define']('OpenchannelAccount',attributes,{'tableName':_0x7bdb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 5288329..fc4a8fa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x326f=['catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','register','request','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result'];(function(_0x24deba,_0x3c0e0b){var _0x1b79cc=function(_0x5ce205){while(--_0x5ce205){_0x24deba['push'](_0x24deba['shift']());}};_0x1b79cc(++_0x3c0e0b);}(_0x326f,0xd1));var _0xf326=function(_0xe0521,_0x19b9b2){_0xe0521=_0xe0521-0x0;var _0x2c77ea=_0x326f[_0xe0521];return _0x2c77ea;};'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});config[_0xf326('0xb')]=_[_0xf326('0xc')](config[_0xf326('0xb')],{'host':_0xf326('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelAccount.socket')[_0xf326('0xe')](socket);function respondWithRpcPromise(_0x1fc80e,_0x163416,_0x2686e1){return new BPromise(function(_0x1f3a33,_0x5db9d7){return client[_0xf326('0xf')](_0x1fc80e,_0x2686e1)['then'](function(_0x1cf441){logger['info'](_0xf326('0x10'),_0x163416,'request\x20sent');logger[_0xf326('0x11')](_0xf326('0x12'),_0x163416,'request\x20sent',JSON[_0xf326('0x13')](_0x1cf441));if(_0x1cf441[_0xf326('0x14')]){if(_0x1cf441[_0xf326('0x14')][_0xf326('0x15')]===0x1f4){logger['error'](_0xf326('0x10'),_0x163416,_0x1cf441['error']['message']);return _0x5db9d7(_0x1cf441[_0xf326('0x14')][_0xf326('0x16')]);}logger[_0xf326('0x14')](_0xf326('0x10'),_0x163416,_0x1cf441[_0xf326('0x14')][_0xf326('0x16')]);return _0x1f3a33(_0x1cf441[_0xf326('0x14')][_0xf326('0x16')]);}else{logger['info'](_0xf326('0x10'),_0x163416,_0xf326('0x17'));_0x1f3a33(_0x1cf441[_0xf326('0x18')][_0xf326('0x16')]);}})[_0xf326('0x19')](function(_0x311af0){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x163416,_0x311af0);_0x5db9d7(_0x311af0);});});}
\ No newline at end of file
+var _0x7a54=['result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x4a3e8a,_0x518bd0){_0x4a3e8a=_0x4a3e8a-0x0;var _0x39b955=_0x7a54[_0x4a3e8a];return _0x39b955;};'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});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelAccount,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}
\ No newline at end of file
index fae4a77..58d1f45 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb5cd=['openchannelAccount:','./openchannelAccount.events','save','remove','emit','length'];(function(_0x5ae307,_0x32c66d){var _0x31c0fb=function(_0x181858){while(--_0x181858){_0x5ae307['push'](_0x5ae307['shift']());}};_0x31c0fb(++_0x32c66d);}(_0xb5cd,0x8b));var _0xdb5c=function(_0x20865f,_0x49849f){_0x20865f=_0x20865f-0x0;var _0x14129b=_0xb5cd[_0x20865f];return _0x14129b;};'use strict';var OpenchannelAccountEvents=require(_0xdb5c('0x0'));var events=[_0xdb5c('0x1'),_0xdb5c('0x2'),'update'];function createListener(_0x23257e,_0x281c2f){return function(_0x16f443){_0x281c2f[_0xdb5c('0x3')](_0x23257e,_0x16f443);};}function removeListener(_0x7dede4,_0x77e161){return function(){OpenchannelAccountEvents['removeListener'](_0x7dede4,_0x77e161);};}exports['register']=function(_0x232ab5){for(var _0x31a139=0x0,_0x149a53=events[_0xdb5c('0x4')];_0x31a139<_0x149a53;_0x31a139++){var _0x4311cf=events[_0x31a139];var _0x55363a=createListener(_0xdb5c('0x5')+_0x4311cf,_0x232ab5);OpenchannelAccountEvents['on'](_0x4311cf,_0x55363a);}};
\ No newline at end of file
+var _0x9791=['./openchannelAccount.events','save','remove','update','emit','removeListener','register','length','openchannelAccount:'];(function(_0x5c5caf,_0x4e6aa8){var _0x24ffcf=function(_0xd080af){while(--_0xd080af){_0x5c5caf['push'](_0x5c5caf['shift']());}};_0x24ffcf(++_0x4e6aa8);}(_0x9791,0x132));var _0x1979=function(_0x28ef23,_0x2544b5){_0x28ef23=_0x28ef23-0x0;var _0x4333ca=_0x9791[_0x28ef23];return _0x4333ca;};'use strict';var OpenchannelAccountEvents=require(_0x1979('0x0'));var events=[_0x1979('0x1'),_0x1979('0x2'),_0x1979('0x3')];function createListener(_0x4410b9,_0x27a624){return function(_0x8fe657){_0x27a624[_0x1979('0x4')](_0x4410b9,_0x8fe657);};}function removeListener(_0x331aeb,_0x4e38cf){return function(){OpenchannelAccountEvents[_0x1979('0x5')](_0x331aeb,_0x4e38cf);};}exports[_0x1979('0x6')]=function(_0x58e86c){for(var _0x52f95c=0x0,_0x557401=events[_0x1979('0x7')];_0x52f95c<_0x557401;_0x52f95c++){var _0xef2876=events[_0x52f95c];var _0x1927fc=createListener(_0x1979('0x8')+_0xef2876,_0x58e86c);OpenchannelAccountEvents['on'](_0xef2876,_0x1927fc);}};
\ No newline at end of file
index 81a6f42..06c9cec 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xba15=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','/:id','isAuthenticated','post','create','update','destroy'];(function(_0x4b5d26,_0x1a39be){var _0x265b9b=function(_0x42225d){while(--_0x42225d){_0x4b5d26['push'](_0x4b5d26['shift']());}};_0x265b9b(++_0x1a39be);}(_0xba15,0xb0));var _0x5ba1=function(_0x1d0cd4,_0x514246){_0x1d0cd4=_0x1d0cd4-0x0;var _0x57aa32=_0xba15[_0x1d0cd4];return _0x57aa32;};'use strict';var multer=require(_0x5ba1('0x0'));var util=require(_0x5ba1('0x1'));var path=require('path');var timeout=require(_0x5ba1('0x2'));var express=require(_0x5ba1('0x3'));var router=express[_0x5ba1('0x4')]();var auth=require(_0x5ba1('0x5'));var interaction=require(_0x5ba1('0x6'));var config=require(_0x5ba1('0x7'));var controller=require(_0x5ba1('0x8'));router[_0x5ba1('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5ba1('0x9')](_0x5ba1('0xa'),auth[_0x5ba1('0xb')](),controller['show']);router[_0x5ba1('0xc')]('/',auth[_0x5ba1('0xb')](),controller[_0x5ba1('0xd')]);router['put'](_0x5ba1('0xa'),auth[_0x5ba1('0xb')](),controller[_0x5ba1('0xe')]);router['delete'](_0x5ba1('0xa'),auth[_0x5ba1('0xb')](),controller[_0x5ba1('0xf')]);module['exports']=router;
\ No newline at end of file
+var _0xb8bf=['/:id','show','isAuthenticated','create','put','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index'];(function(_0x59008b,_0x75ea97){var _0x20359c=function(_0x3e3199){while(--_0x3e3199){_0x59008b['push'](_0x59008b['shift']());}};_0x20359c(++_0x75ea97);}(_0xb8bf,0x171));var _0xfb8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb8bf[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xfb8b('0x0'));var util=require(_0xfb8b('0x1'));var path=require(_0xfb8b('0x2'));var timeout=require('connect-timeout');var express=require(_0xfb8b('0x3'));var router=express[_0xfb8b('0x4')]();var auth=require(_0xfb8b('0x5'));var interaction=require(_0xfb8b('0x6'));var config=require(_0xfb8b('0x7'));var controller=require(_0xfb8b('0x8'));router[_0xfb8b('0x9')]('/',auth['isAuthenticated'](),controller[_0xfb8b('0xa')]);router[_0xfb8b('0x9')](_0xfb8b('0xb'),auth['isAuthenticated'](),controller[_0xfb8b('0xc')]);router['post']('/',auth[_0xfb8b('0xd')](),controller[_0xfb8b('0xe')]);router[_0xfb8b('0xf')](_0xfb8b('0xb'),auth[_0xfb8b('0xd')](),controller[_0xfb8b('0x10')]);router[_0xfb8b('0x11')](_0xfb8b('0xb'),auth['isAuthenticated'](),controller[_0xfb8b('0x12')]);module['exports']=router;
\ No newline at end of file
index cc39285..eef1e6d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa7c0=['INTEGER','STRING','noop','*,*,*,*','sequelize','exports'];(function(_0x2e51f0,_0x339cb1){var _0xc970e=function(_0x34c096){while(--_0x34c096){_0x2e51f0['push'](_0x2e51f0['shift']());}};_0xc970e(++_0x339cb1);}(_0xa7c0,0x70));var _0x0a7c=function(_0x3b63af,_0x50797a){_0x3b63af=_0x3b63af-0x0;var _0x57ead8=_0xa7c0[_0x3b63af];return _0x57ead8;};'use strict';var Sequelize=require(_0x0a7c('0x0'));module[_0x0a7c('0x1')]={'priority':{'type':Sequelize[_0x0a7c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0a7c('0x3')],'allowNull':![],'defaultValue':_0x0a7c('0x4')},'appdata':{'type':Sequelize[_0x0a7c('0x3')](0x1000),'defaultValue':''},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x0a7c('0x5')}};
\ No newline at end of file
+var _0x8f4a=['noop','STRING','*,*,*,*','exports','INTEGER'];(function(_0xc228ee,_0x2dff92){var _0x305b2b=function(_0x26e470){while(--_0x26e470){_0xc228ee['push'](_0xc228ee['shift']());}};_0x305b2b(++_0x2dff92);}(_0x8f4a,0x19d));var _0xa8f4=function(_0x4507c8,_0x1926d2){_0x4507c8=_0x4507c8-0x0;var _0x140816=_0x8f4a[_0x4507c8];return _0x140816;};'use strict';var Sequelize=require('sequelize');module[_0xa8f4('0x0')]={'priority':{'type':Sequelize[_0xa8f4('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa8f4('0x2')},'appdata':{'type':Sequelize['STRING'](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0xa8f4('0x3')]},'interval':{'type':Sequelize[_0xa8f4('0x3')],'defaultValue':_0xa8f4('0x4')}};
\ No newline at end of file
index 82a071e..2937e95 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1206=['sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','update','destroy','end','error','stack','name','send','index','OpenchannelApplication','rawAttributes','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','key','VIRTUAL','field','then','includeAll','catch','show','params','fields','length','include','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment'];(function(_0x16e892,_0x132763){var _0x229775=function(_0x406f42){while(--_0x406f42){_0x16e892['push'](_0x16e892['shift']());}};_0x229775(++_0x132763);}(_0x1206,0x1d3));var _0x6120=function(_0x27f004,_0x1a1e9d){_0x27f004=_0x27f004-0x0;var _0x411a9d=_0x1206[_0x27f004];return _0x411a9d;};'use strict';var pdf=require(_0x6120('0x0'));var emlformat=require(_0x6120('0x1'));var rimraf=require(_0x6120('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6120('0x3'));var rp=require(_0x6120('0x4'));var moment=require(_0x6120('0x5'));var BPromise=require(_0x6120('0x6'));var Mustache=require(_0x6120('0x7'));var util=require(_0x6120('0x8'));var path=require(_0x6120('0x9'));var sox=require('sox');var csv=require(_0x6120('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6120('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6120('0xc'));var deskjs=require(_0x6120('0xd'));var toCsv=require(_0x6120('0xa'));var querystring=require(_0x6120('0xe'));var Papa=require(_0x6120('0xf'));var authService=require(_0x6120('0x10'));var hardwareService=require(_0x6120('0x11'));var Redis=require(_0x6120('0x12'));var qs=require(_0x6120('0x13'));var logger=require(_0x6120('0x14'))('api');var utils=require(_0x6120('0x15'));var config=require(_0x6120('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7437e7,_0x191e7d){_0x191e7d=_0x191e7d||0xcc;return function(_0x441111){if(_0x441111){return _0x7437e7[_0x6120('0x17')](_0x191e7d);}return _0x7437e7[_0x6120('0x18')](_0x191e7d)['end']();};}function respondWithResult(_0xb797b9,_0x1d9f62){_0x1d9f62=_0x1d9f62||0xc8;return function(_0x15b088){if(_0x15b088){return _0xb797b9[_0x6120('0x18')](_0x1d9f62)[_0x6120('0x19')](_0x15b088);}};}function respondWithFilteredResult(_0x11907a,_0x1a8bd3){return function(_0x10d0f9){if(_0x10d0f9){var _0x1ddb7d=_0x10d0f9[_0x6120('0x1a')],_0x1fb96d=_0x1a8bd3['offset'],_0x329cb1=_0x1a8bd3[_0x6120('0x1b')]+_0x1a8bd3[_0x6120('0x1c')],_0x5c06a5;if(_0x329cb1>=_0x1ddb7d){_0x329cb1=_0x1ddb7d;_0x5c06a5=0xc8;}else{_0x5c06a5=0xce;}_0x11907a[_0x6120('0x18')](_0x5c06a5);return _0x11907a['set'](_0x6120('0x1d'),_0x1fb96d+'-'+_0x329cb1+'/'+_0x1ddb7d)[_0x6120('0x19')](_0x10d0f9);}return null;};}function patchUpdates(_0x433154){return function(_0x553fdc){try{jsonpatch[_0x6120('0x1e')](_0x553fdc,_0x433154,!![]);}catch(_0x3e7366){return BPromise[_0x6120('0x1f')](_0x3e7366);}return _0x553fdc['save']();};}function saveUpdates(_0x560a2a,_0x290747){return function(_0x318b4a){if(_0x318b4a){return _0x318b4a[_0x6120('0x20')](_0x560a2a)['then'](function(_0x26407a){return _0x26407a;});}return null;};}function removeEntity(_0x58a544,_0x543cb5){return function(_0x1d2cf3){if(_0x1d2cf3){return _0x1d2cf3[_0x6120('0x21')]()['then'](function(){_0x58a544[_0x6120('0x18')](0xcc)[_0x6120('0x22')]();});}};}function handleEntityNotFound(_0x3f9309,_0x42cc3d){return function(_0x1b3bc5){if(!_0x1b3bc5){_0x3f9309[_0x6120('0x17')](0x194);}return _0x1b3bc5;};}function handleError(_0x5a471f,_0x576e8d){_0x576e8d=_0x576e8d||0x1f4;return function(_0x1f1fae){logger[_0x6120('0x23')](_0x1f1fae[_0x6120('0x24')]);if(_0x1f1fae[_0x6120('0x25')]){delete _0x1f1fae[_0x6120('0x25')];}_0x5a471f[_0x6120('0x18')](_0x576e8d)[_0x6120('0x26')](_0x1f1fae);};}exports[_0x6120('0x27')]=function(_0x119293,_0x2939fd){var _0x558b74={},_0x3237d1={},_0xec5007={'count':0x0,'rows':[]};var _0x1252b8=db[_0x6120('0x28')][_0x6120('0x29')];_0x3237d1[_0x6120('0x2a')]=_[_0x6120('0x2b')](_0x1252b8);_0x3237d1[_0x6120('0x2c')]=_[_0x6120('0x2b')](_0x119293['query']);_0x3237d1[_0x6120('0x2d')]=_[_0x6120('0x2e')](_0x3237d1[_0x6120('0x2a')],_0x3237d1[_0x6120('0x2c')]);_0x558b74[_0x6120('0x2f')]=_[_0x6120('0x2e')](_0x3237d1[_0x6120('0x2a')],qs['fields'](_0x119293['query']['fields']));_0x558b74[_0x6120('0x2f')]=_0x558b74['attributes']['length']?_0x558b74['attributes']:_0x3237d1[_0x6120('0x2a')];if(!_0x119293[_0x6120('0x2c')][_0x6120('0x30')](_0x6120('0x31'))){_0x558b74[_0x6120('0x1c')]=qs[_0x6120('0x1c')](_0x119293['query'][_0x6120('0x1c')]);_0x558b74[_0x6120('0x1b')]=qs['offset'](_0x119293[_0x6120('0x2c')][_0x6120('0x1b')]);}_0x558b74['order']=qs['sort'](_0x119293['query'][_0x6120('0x32')]);_0x558b74[_0x6120('0x33')]=qs[_0x6120('0x2d')](_[_0x6120('0x34')](_0x119293[_0x6120('0x2c')],_0x3237d1[_0x6120('0x2d')]));if(_0x119293[_0x6120('0x2c')][_0x6120('0x35')]){_0x558b74[_0x6120('0x33')]=_[_0x6120('0x36')](_0x558b74[_0x6120('0x33')],{'$or':_['map'](_0x1252b8,function(_0x3e6463){if(_0x3e6463[_0x6120('0x37')][_0x6120('0x38')]!==_0x6120('0x39')){var _0x31b608={};_0x31b608[_0x3e6463[_0x6120('0x3a')]]={'$like':'%'+_0x119293[_0x6120('0x2c')][_0x6120('0x35')]+'%'};return _0x31b608;}})});}_0x558b74=_[_0x6120('0x36')]({},_0x558b74,_0x119293['options']);var _0x332939={'where':_0x558b74[_0x6120('0x33')]};return db[_0x6120('0x28')]['count'](_0x332939)[_0x6120('0x3b')](function(_0x57445b){_0xec5007[_0x6120('0x1a')]=_0x57445b;if(_0x119293[_0x6120('0x2c')][_0x6120('0x3c')]){_0x558b74['include']=[{'all':!![]}];}return db[_0x6120('0x28')]['findAll'](_0x558b74);})[_0x6120('0x3b')](function(_0x446bd5){_0xec5007['rows']=_0x446bd5;return _0xec5007;})['then'](respondWithFilteredResult(_0x2939fd,_0x558b74))[_0x6120('0x3d')](handleError(_0x2939fd,null));};exports[_0x6120('0x3e')]=function(_0x57a3f5,_0x5194f4){var _0x35dd6e={'raw':!![],'where':{'id':_0x57a3f5[_0x6120('0x3f')]['id']}},_0x504692={};_0x504692['model']=_[_0x6120('0x2b')](db[_0x6120('0x28')][_0x6120('0x29')]);_0x504692[_0x6120('0x2c')]=_[_0x6120('0x2b')](_0x57a3f5['query']);_0x504692[_0x6120('0x2d')]=_['intersection'](_0x504692[_0x6120('0x2a')],_0x504692[_0x6120('0x2c')]);_0x35dd6e['attributes']=_[_0x6120('0x2e')](_0x504692[_0x6120('0x2a')],qs[_0x6120('0x40')](_0x57a3f5[_0x6120('0x2c')][_0x6120('0x40')]));_0x35dd6e[_0x6120('0x2f')]=_0x35dd6e[_0x6120('0x2f')][_0x6120('0x41')]?_0x35dd6e['attributes']:_0x504692[_0x6120('0x2a')];if(_0x57a3f5[_0x6120('0x2c')]['includeAll']){_0x35dd6e[_0x6120('0x42')]=[{'all':!![]}];}_0x35dd6e=_[_0x6120('0x36')]({},_0x35dd6e,_0x57a3f5['options']);return db['OpenchannelApplication'][_0x6120('0x43')](_0x35dd6e)['then'](handleEntityNotFound(_0x5194f4,null))[_0x6120('0x3b')](respondWithResult(_0x5194f4,null))[_0x6120('0x3d')](handleError(_0x5194f4,null));};exports[_0x6120('0x44')]=function(_0xfc528d,_0x3927a3){return db[_0x6120('0x28')]['create'](_0xfc528d[_0x6120('0x45')],{})['then'](respondWithResult(_0x3927a3,0xc9))[_0x6120('0x3d')](handleError(_0x3927a3,null));};exports[_0x6120('0x20')]=function(_0x501731,_0x51d215){if(_0x501731[_0x6120('0x45')]['id']){delete _0x501731[_0x6120('0x45')]['id'];}return db[_0x6120('0x28')]['find']({'where':{'id':_0x501731[_0x6120('0x3f')]['id']}})['then'](handleEntityNotFound(_0x51d215,null))['then'](saveUpdates(_0x501731['body'],null))['then'](respondWithResult(_0x51d215,null))['catch'](handleError(_0x51d215,null));};exports[_0x6120('0x21')]=function(_0x5d940b,_0x237a1b){return db[_0x6120('0x28')][_0x6120('0x43')]({'where':{'id':_0x5d940b[_0x6120('0x3f')]['id']}})[_0x6120('0x3b')](handleEntityNotFound(_0x237a1b,null))[_0x6120('0x3b')](removeEntity(_0x237a1b,null))['catch'](handleError(_0x237a1b,null));};
\ No newline at end of file
+var _0xde70=['filters','model','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','merge','type','key','VIRTUAL','field','filter','includeAll','include','findAll','catch','length','options','find','create','body','update','params','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','crypto','jsforce','querystring','papaparse','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','then','destroy','error','name','send','OpenchannelApplication','rawAttributes','query','keys'];(function(_0x5550b3,_0x2d0ee0){var _0x4b8fc4=function(_0x22393a){while(--_0x22393a){_0x5550b3['push'](_0x5550b3['shift']());}};_0x4b8fc4(++_0x2d0ee0);}(_0xde70,0x164));var _0x0de7=function(_0x3f6368,_0x9ba37f){_0x3f6368=_0x3f6368-0x0;var _0x75cea4=_0xde70[_0x3f6368];return _0x75cea4;};'use strict';var pdf=require(_0x0de7('0x0'));var emlformat=require(_0x0de7('0x1'));var rimraf=require(_0x0de7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0de7('0x3'));var rp=require('request-promise');var moment=require(_0x0de7('0x4'));var BPromise=require(_0x0de7('0x5'));var Mustache=require(_0x0de7('0x6'));var util=require(_0x0de7('0x7'));var path=require(_0x0de7('0x8'));var sox=require('sox');var csv=require(_0x0de7('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0de7('0xa'));var jsforce=require(_0x0de7('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0de7('0xc'));var Papa=require(_0x0de7('0xd'));var authService=require('../../components/auth/service');var hardwareService=require(_0x0de7('0xe'));var Redis=require(_0x0de7('0xf'));var qs=require('../../components/parsers/qs');var logger=require(_0x0de7('0x10'))(_0x0de7('0x11'));var utils=require(_0x0de7('0x12'));var config=require(_0x0de7('0x13'));var db=require(_0x0de7('0x14'))['db'];function respondWithStatusCode(_0x4b1765,_0x594f90){_0x594f90=_0x594f90||0xcc;return function(_0x2f3ddb){if(_0x2f3ddb){return _0x4b1765[_0x0de7('0x15')](_0x594f90);}return _0x4b1765[_0x0de7('0x16')](_0x594f90)[_0x0de7('0x17')]();};}function respondWithResult(_0x3704df,_0x5eb4a7){_0x5eb4a7=_0x5eb4a7||0xc8;return function(_0x478a41){if(_0x478a41){return _0x3704df[_0x0de7('0x16')](_0x5eb4a7)[_0x0de7('0x18')](_0x478a41);}};}function respondWithFilteredResult(_0x3a5792,_0x2938c3){return function(_0x14b89a){if(_0x14b89a){var _0x339ff3=_0x14b89a[_0x0de7('0x19')],_0x12efbf=_0x2938c3[_0x0de7('0x1a')],_0x12b5e8=_0x2938c3[_0x0de7('0x1a')]+_0x2938c3['limit'],_0xe2480b;if(_0x12b5e8>=_0x339ff3){_0x12b5e8=_0x339ff3;_0xe2480b=0xc8;}else{_0xe2480b=0xce;}_0x3a5792['status'](_0xe2480b);return _0x3a5792['set'](_0x0de7('0x1b'),_0x12efbf+'-'+_0x12b5e8+'/'+_0x339ff3)[_0x0de7('0x18')](_0x14b89a);}return null;};}function patchUpdates(_0x5335a7){return function(_0x201d9a){try{jsonpatch[_0x0de7('0x1c')](_0x201d9a,_0x5335a7,!![]);}catch(_0x29a6cd){return BPromise[_0x0de7('0x1d')](_0x29a6cd);}return _0x201d9a[_0x0de7('0x1e')]();};}function saveUpdates(_0x4f1482,_0x25f9b2){return function(_0x131536){if(_0x131536){return _0x131536['update'](_0x4f1482)[_0x0de7('0x1f')](function(_0x931560){return _0x931560;});}return null;};}function removeEntity(_0x155b6e,_0x418b1c){return function(_0x3521fb){if(_0x3521fb){return _0x3521fb[_0x0de7('0x20')]()[_0x0de7('0x1f')](function(){_0x155b6e['status'](0xcc)[_0x0de7('0x17')]();});}};}function handleEntityNotFound(_0x3e431f,_0x3c4d71){return function(_0x65ff5c){if(!_0x65ff5c){_0x3e431f['sendStatus'](0x194);}return _0x65ff5c;};}function handleError(_0x29f8cb,_0x49fd33){_0x49fd33=_0x49fd33||0x1f4;return function(_0x556c43){logger[_0x0de7('0x21')](_0x556c43['stack']);if(_0x556c43[_0x0de7('0x22')]){delete _0x556c43[_0x0de7('0x22')];}_0x29f8cb['status'](_0x49fd33)[_0x0de7('0x23')](_0x556c43);};}exports['index']=function(_0x437dff,_0x102b2e){var _0x337151={},_0xded6cb={},_0x17b10d={'count':0x0,'rows':[]};var _0x5c7218=db[_0x0de7('0x24')][_0x0de7('0x25')];_0xded6cb['model']=_['keys'](_0x5c7218);_0xded6cb[_0x0de7('0x26')]=_[_0x0de7('0x27')](_0x437dff['query']);_0xded6cb[_0x0de7('0x28')]=_['intersection'](_0xded6cb[_0x0de7('0x29')],_0xded6cb[_0x0de7('0x26')]);_0x337151[_0x0de7('0x2a')]=_['intersection'](_0xded6cb['model'],qs[_0x0de7('0x2b')](_0x437dff[_0x0de7('0x26')][_0x0de7('0x2b')]));_0x337151[_0x0de7('0x2a')]=_0x337151[_0x0de7('0x2a')]['length']?_0x337151[_0x0de7('0x2a')]:_0xded6cb[_0x0de7('0x29')];if(!_0x437dff[_0x0de7('0x26')][_0x0de7('0x2c')](_0x0de7('0x2d'))){_0x337151[_0x0de7('0x2e')]=qs[_0x0de7('0x2e')](_0x437dff[_0x0de7('0x26')][_0x0de7('0x2e')]);_0x337151[_0x0de7('0x1a')]=qs[_0x0de7('0x1a')](_0x437dff[_0x0de7('0x26')][_0x0de7('0x1a')]);}_0x337151['order']=qs[_0x0de7('0x2f')](_0x437dff['query'][_0x0de7('0x2f')]);_0x337151[_0x0de7('0x30')]=qs[_0x0de7('0x28')](_['pick'](_0x437dff[_0x0de7('0x26')],_0xded6cb['filters']));if(_0x437dff[_0x0de7('0x26')]['filter']){_0x337151[_0x0de7('0x30')]=_[_0x0de7('0x31')](_0x337151[_0x0de7('0x30')],{'$or':_['map'](_0x5c7218,function(_0x285bcb){if(_0x285bcb[_0x0de7('0x32')][_0x0de7('0x33')]!==_0x0de7('0x34')){var _0x29aa0c={};_0x29aa0c[_0x285bcb[_0x0de7('0x35')]]={'$like':'%'+_0x437dff[_0x0de7('0x26')][_0x0de7('0x36')]+'%'};return _0x29aa0c;}})});}_0x337151=_['merge']({},_0x337151,_0x437dff['options']);var _0x4c627d={'where':_0x337151[_0x0de7('0x30')]};return db[_0x0de7('0x24')][_0x0de7('0x19')](_0x4c627d)[_0x0de7('0x1f')](function(_0x28247a){_0x17b10d['count']=_0x28247a;if(_0x437dff[_0x0de7('0x26')][_0x0de7('0x37')]){_0x337151[_0x0de7('0x38')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x0de7('0x39')](_0x337151);})[_0x0de7('0x1f')](function(_0x1df9e3){_0x17b10d['rows']=_0x1df9e3;return _0x17b10d;})[_0x0de7('0x1f')](respondWithFilteredResult(_0x102b2e,_0x337151))[_0x0de7('0x3a')](handleError(_0x102b2e,null));};exports['show']=function(_0x2f78fb,_0x412289){var _0x3af00f={'raw':!![],'where':{'id':_0x2f78fb['params']['id']}},_0x483935={};_0x483935[_0x0de7('0x29')]=_[_0x0de7('0x27')](db[_0x0de7('0x24')]['rawAttributes']);_0x483935[_0x0de7('0x26')]=_[_0x0de7('0x27')](_0x2f78fb[_0x0de7('0x26')]);_0x483935[_0x0de7('0x28')]=_['intersection'](_0x483935['model'],_0x483935['query']);_0x3af00f['attributes']=_['intersection'](_0x483935[_0x0de7('0x29')],qs[_0x0de7('0x2b')](_0x2f78fb[_0x0de7('0x26')][_0x0de7('0x2b')]));_0x3af00f[_0x0de7('0x2a')]=_0x3af00f[_0x0de7('0x2a')][_0x0de7('0x3b')]?_0x3af00f[_0x0de7('0x2a')]:_0x483935[_0x0de7('0x29')];if(_0x2f78fb[_0x0de7('0x26')][_0x0de7('0x37')]){_0x3af00f[_0x0de7('0x38')]=[{'all':!![]}];}_0x3af00f=_[_0x0de7('0x31')]({},_0x3af00f,_0x2f78fb[_0x0de7('0x3c')]);return db[_0x0de7('0x24')][_0x0de7('0x3d')](_0x3af00f)['then'](handleEntityNotFound(_0x412289,null))['then'](respondWithResult(_0x412289,null))['catch'](handleError(_0x412289,null));};exports[_0x0de7('0x3e')]=function(_0x5b944f,_0x37e9a4){return db['OpenchannelApplication'][_0x0de7('0x3e')](_0x5b944f[_0x0de7('0x3f')],{})[_0x0de7('0x1f')](respondWithResult(_0x37e9a4,0xc9))['catch'](handleError(_0x37e9a4,null));};exports[_0x0de7('0x40')]=function(_0x5ad381,_0x326aa5){if(_0x5ad381[_0x0de7('0x3f')]['id']){delete _0x5ad381[_0x0de7('0x3f')]['id'];}return db[_0x0de7('0x24')][_0x0de7('0x3d')]({'where':{'id':_0x5ad381[_0x0de7('0x41')]['id']}})['then'](handleEntityNotFound(_0x326aa5,null))[_0x0de7('0x1f')](saveUpdates(_0x5ad381[_0x0de7('0x3f')],null))[_0x0de7('0x1f')](respondWithResult(_0x326aa5,null))['catch'](handleError(_0x326aa5,null));};exports[_0x0de7('0x20')]=function(_0x4dc813,_0x286a49){return db[_0x0de7('0x24')][_0x0de7('0x3d')]({'where':{'id':_0x4dc813[_0x0de7('0x41')]['id']}})[_0x0de7('0x1f')](handleEntityNotFound(_0x286a49,null))[_0x0de7('0x1f')](removeEntity(_0x286a49,null))[_0x0de7('0x3a')](handleError(_0x286a49,null));};
\ No newline at end of file
index 9dfc448..8f2843e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8bb6=['../../config/logger','api','moment','request-promise','exports','OpenchannelApplication','util'];(function(_0x4701fd,_0x4d85aa){var _0x44b225=function(_0x2fe28a){while(--_0x2fe28a){_0x4701fd['push'](_0x4701fd['shift']());}};_0x44b225(++_0x4d85aa);}(_0x8bb6,0xe6));var _0x68bb=function(_0x3809e3,_0x132e51){_0x3809e3=_0x3809e3-0x0;var _0x334579=_0x8bb6[_0x3809e3];return _0x334579;};'use strict';var _=require('lodash');var util=require(_0x68bb('0x0'));var logger=require(_0x68bb('0x1'))(_0x68bb('0x2'));var moment=require(_0x68bb('0x3'));var BPromise=require('bluebird');var rp=require(_0x68bb('0x4'));var attributes=require('./openchannelApplication.attributes');module[_0x68bb('0x5')]=function(_0x16d312,_0x264796){return _0x16d312['define'](_0x68bb('0x6'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x3f7c=['lodash','util','../../config/logger','moment','bluebird','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications'];(function(_0x10caed,_0x1938bf){var _0xf825d=function(_0x7b87fb){while(--_0x7b87fb){_0x10caed['push'](_0x10caed['shift']());}};_0xf825d(++_0x1938bf);}(_0x3f7c,0xd2));var _0xc3f7=function(_0x5354c9,_0x3e203b){_0x5354c9=_0x5354c9-0x0;var _0x5e8b63=_0x3f7c[_0x5354c9];return _0x5e8b63;};'use strict';var _=require(_0xc3f7('0x0'));var util=require(_0xc3f7('0x1'));var logger=require(_0xc3f7('0x2'))('api');var moment=require(_0xc3f7('0x3'));var BPromise=require(_0xc3f7('0x4'));var rp=require('request-promise');var attributes=require(_0xc3f7('0x5'));module[_0xc3f7('0x6')]=function(_0x36265f,_0x18d0c7){return _0x36265f[_0xc3f7('0x7')](_0xc3f7('0x8'),attributes,{'tableName':_0xc3f7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 5cbdf7f..2020ff5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3caf=['stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','where','limit','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s'];(function(_0x4d4f61,_0x56d7a7){var _0x297414=function(_0x30d055){while(--_0x30d055){_0x4d4f61['push'](_0x4d4f61['shift']());}};_0x297414(++_0x56d7a7);}(_0x3caf,0x108));var _0xf3ca=function(_0xc9671e,_0x5ae235){_0xc9671e=_0xc9671e-0x0;var _0x54957a=_0x3caf[_0xc9671e];return _0x54957a;};'use strict';var _=require('lodash');var util=require(_0xf3ca('0x0'));var moment=require('moment');var BPromise=require(_0xf3ca('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf3ca('0x2'))['db'];var utils=require(_0xf3ca('0x3'));var logger=require(_0xf3ca('0x4'))(_0xf3ca('0x5'));var config=require(_0xf3ca('0x6'));var jayson=require(_0xf3ca('0x7'));var client=jayson[_0xf3ca('0x8')][_0xf3ca('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x339c4c,_0x53411c,_0x5e741f){return new BPromise(function(_0x2bad8f,_0x497fec){return client[_0xf3ca('0xa')](_0x339c4c,_0x5e741f)[_0xf3ca('0xb')](function(_0x4661a0){logger[_0xf3ca('0xc')]('OpenchannelApplication,\x20%s,\x20%s',_0x53411c,_0xf3ca('0xd'));logger[_0xf3ca('0xe')](_0xf3ca('0xf'),_0x53411c,_0xf3ca('0xd'),JSON[_0xf3ca('0x10')](_0x4661a0));if(_0x4661a0[_0xf3ca('0x11')]){if(_0x4661a0[_0xf3ca('0x11')][_0xf3ca('0x12')]===0x1f4){logger['error'](_0xf3ca('0x13'),_0x53411c,_0x4661a0[_0xf3ca('0x11')][_0xf3ca('0x14')]);return _0x497fec(_0x4661a0[_0xf3ca('0x11')][_0xf3ca('0x14')]);}logger[_0xf3ca('0x11')](_0xf3ca('0x13'),_0x53411c,_0x4661a0[_0xf3ca('0x11')][_0xf3ca('0x14')]);return _0x2bad8f(_0x4661a0[_0xf3ca('0x11')][_0xf3ca('0x14')]);}else{logger[_0xf3ca('0xc')]('OpenchannelApplication,\x20%s,\x20%s',_0x53411c,_0xf3ca('0xd'));_0x2bad8f(_0x4661a0['result'][_0xf3ca('0x14')]);}})[_0xf3ca('0x15')](function(_0x5acef1){logger[_0xf3ca('0x11')](_0xf3ca('0x13'),_0x53411c,_0x5acef1);_0x497fec(_0x5acef1);});});}exports[_0xf3ca('0x16')]=function(_0x23130e){var _0x2bfffd=this;return new Promise(function(_0x4e2a44,_0x4b042f){return db[_0xf3ca('0x17')][_0xf3ca('0x18')](_0x23130e['body'],{'raw':_0x23130e[_0xf3ca('0x19')]?_0x23130e[_0xf3ca('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23130e['options']?_0x23130e['options'][_0xf3ca('0x1a')]||null:null,'attributes':_0x23130e[_0xf3ca('0x19')]?_0x23130e[_0xf3ca('0x19')]['attributes']||null:null,'limit':_0x23130e[_0xf3ca('0x19')]?_0x23130e[_0xf3ca('0x19')][_0xf3ca('0x1b')]||null:null})[_0xf3ca('0xb')](function(_0x1eb801){logger['info']('UpdateOpenchannelApplication',_0x23130e);logger[_0xf3ca('0xe')](_0xf3ca('0x16'),_0x23130e,JSON[_0xf3ca('0x10')](_0x1eb801));_0x4e2a44(_0x1eb801);})[_0xf3ca('0x15')](function(_0x1dc0b9){logger[_0xf3ca('0x11')](_0xf3ca('0x16'),_0x1dc0b9[_0xf3ca('0x14')],_0x23130e);_0x4b042f(_0x2bfffd[_0xf3ca('0x11')](0x1f4,_0x1dc0b9[_0xf3ca('0x14')]));});});};
\ No newline at end of file
+var _0x3387=['options','where','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','message','result','UpdateOpenchannelApplication','update'];(function(_0x368dbc,_0x1b3ddc){var _0x257b6b=function(_0x4cef54){while(--_0x4cef54){_0x368dbc['push'](_0x368dbc['shift']());}};_0x257b6b(++_0x1b3ddc);}(_0x3387,0x1a5));var _0x7338=function(_0xac3117,_0x5a8ea8){_0xac3117=_0xac3117-0x0;var _0x3abace=_0x3387[_0xac3117];return _0x3abace;};'use strict';var _=require(_0x7338('0x0'));var util=require(_0x7338('0x1'));var moment=require(_0x7338('0x2'));var BPromise=require(_0x7338('0x3'));var rs=require(_0x7338('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7338('0x5'));var logger=require('../../config/logger')(_0x7338('0x6'));var config=require(_0x7338('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7338('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xfe9bd,_0x7a914b,_0x19540a){return new BPromise(function(_0x70eddb,_0x59863a){return client[_0x7338('0x9')](_0xfe9bd,_0x19540a)[_0x7338('0xa')](function(_0x34ff1d){logger[_0x7338('0xb')](_0x7338('0xc'),_0x7a914b,_0x7338('0xd'));logger[_0x7338('0xe')](_0x7338('0xf'),_0x7a914b,'request\x20sent',JSON['stringify'](_0x34ff1d));if(_0x34ff1d[_0x7338('0x10')]){if(_0x34ff1d['error']['code']===0x1f4){logger[_0x7338('0x10')](_0x7338('0xc'),_0x7a914b,_0x34ff1d['error'][_0x7338('0x11')]);return _0x59863a(_0x34ff1d[_0x7338('0x10')]['message']);}logger[_0x7338('0x10')](_0x7338('0xc'),_0x7a914b,_0x34ff1d[_0x7338('0x10')][_0x7338('0x11')]);return _0x70eddb(_0x34ff1d['error'][_0x7338('0x11')]);}else{logger[_0x7338('0xb')](_0x7338('0xc'),_0x7a914b,_0x7338('0xd'));_0x70eddb(_0x34ff1d[_0x7338('0x12')][_0x7338('0x11')]);}})['catch'](function(_0x5de3f3){logger['error'](_0x7338('0xc'),_0x7a914b,_0x5de3f3);_0x59863a(_0x5de3f3);});});}exports[_0x7338('0x13')]=function(_0x466232){var _0x5a4c67=this;return new Promise(function(_0x4f0ed4,_0x35010e){return db['OpenchannelApplication'][_0x7338('0x14')](_0x466232['body'],{'raw':_0x466232[_0x7338('0x15')]?_0x466232[_0x7338('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x466232[_0x7338('0x15')]?_0x466232['options'][_0x7338('0x16')]||null:null,'attributes':_0x466232['options']?_0x466232[_0x7338('0x15')][_0x7338('0x17')]||null:null,'limit':_0x466232[_0x7338('0x15')]?_0x466232[_0x7338('0x15')][_0x7338('0x18')]||null:null})[_0x7338('0xa')](function(_0x5cca62){logger[_0x7338('0xb')](_0x7338('0x13'),_0x466232);logger[_0x7338('0xe')]('UpdateOpenchannelApplication',_0x466232,JSON[_0x7338('0x19')](_0x5cca62));_0x4f0ed4(_0x5cca62);})['catch'](function(_0xf620){logger[_0x7338('0x10')](_0x7338('0x13'),_0xf620[_0x7338('0x11')],_0x466232);_0x35010e(_0x5a4c67[_0x7338('0x10')](0x1f4,_0xf620[_0x7338('0x11')]));});});};
\ No newline at end of file
index 473fb5d..7299afb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd0d9=['openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','get','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','/:id/tags','tracked','openchannel','addTags','put'];(function(_0x42c6f1,_0x338d7b){var _0x3c7398=function(_0x151494){while(--_0x151494){_0x42c6f1['push'](_0x42c6f1['shift']());}};_0x3c7398(++_0x338d7b);}(_0xd0d9,0x1e7));var _0x9d0d=function(_0x83e839,_0x1a85fe){_0x83e839=_0x83e839-0x0;var _0x16e346=_0xd0d9[_0x83e839];return _0x16e346;};'use strict';var multer=require(_0x9d0d('0x0'));var util=require(_0x9d0d('0x1'));var path=require(_0x9d0d('0x2'));var timeout=require(_0x9d0d('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x9d0d('0x4'));var interaction=require(_0x9d0d('0x5'));var config=require(_0x9d0d('0x6'));var controller=require(_0x9d0d('0x7'));router['get']('/',auth[_0x9d0d('0x8')](),controller[_0x9d0d('0x9')]);router[_0x9d0d('0xa')]('/describe',auth[_0x9d0d('0x8')](),controller[_0x9d0d('0xb')]);router['get'](_0x9d0d('0xc'),auth['isAuthenticated'](),controller[_0x9d0d('0xd')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x9d0d('0xe')]);router[_0x9d0d('0xa')](_0x9d0d('0xf'),auth[_0x9d0d('0x8')](),controller[_0x9d0d('0x10')]);router[_0x9d0d('0x11')]('/',auth[_0x9d0d('0x8')](),controller[_0x9d0d('0x12')]);router['post'](_0x9d0d('0x13'),auth[_0x9d0d('0x8')](),controller['addMessage']);router[_0x9d0d('0x11')](_0x9d0d('0x14'),auth[_0x9d0d('0x8')](),interaction[_0x9d0d('0x15')](_0x9d0d('0x16'),'openchannelinteraction:addtags'),controller[_0x9d0d('0x17')]);router[_0x9d0d('0x18')](_0x9d0d('0xc'),auth[_0x9d0d('0x8')](),interaction[_0x9d0d('0x15')](_0x9d0d('0x16'),_0x9d0d('0x19')),controller[_0x9d0d('0x1a')]);router[_0x9d0d('0x1b')](_0x9d0d('0xc'),auth[_0x9d0d('0x8')](),interaction['tracked'](_0x9d0d('0x16'),_0x9d0d('0x1c')),controller[_0x9d0d('0x1d')]);router[_0x9d0d('0x1b')](_0x9d0d('0x14'),auth[_0x9d0d('0x8')](),controller[_0x9d0d('0x1e')]);module[_0x9d0d('0x1f')]=router;
\ No newline at end of file
+var _0xa7bb=['/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','multer','util','connect-timeout','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','get'];(function(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0xa7bb,0x160));var _0xba7b=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0xa7bb[_0x3de8a4];return _0x4635cf;};'use strict';var multer=require(_0xba7b('0x0'));var util=require(_0xba7b('0x1'));var path=require('path');var timeout=require(_0xba7b('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xba7b('0x3'));var controller=require(_0xba7b('0x4'));router['get']('/',auth[_0xba7b('0x5')](),controller[_0xba7b('0x6')]);router[_0xba7b('0x7')](_0xba7b('0x8'),auth['isAuthenticated'](),controller[_0xba7b('0x9')]);router[_0xba7b('0x7')](_0xba7b('0xa'),auth[_0xba7b('0x5')](),controller[_0xba7b('0xb')]);router[_0xba7b('0x7')](_0xba7b('0xc'),auth[_0xba7b('0x5')](),controller[_0xba7b('0xd')]);router[_0xba7b('0x7')](_0xba7b('0xe'),auth[_0xba7b('0x5')](),controller[_0xba7b('0xf')]);router[_0xba7b('0x10')]('/',auth[_0xba7b('0x5')](),controller[_0xba7b('0x11')]);router[_0xba7b('0x10')](_0xba7b('0xc'),auth['isAuthenticated'](),controller[_0xba7b('0x12')]);router[_0xba7b('0x10')](_0xba7b('0x13'),auth[_0xba7b('0x5')](),interaction[_0xba7b('0x14')](_0xba7b('0x15'),_0xba7b('0x16')),controller[_0xba7b('0x17')]);router[_0xba7b('0x18')](_0xba7b('0xa'),auth['isAuthenticated'](),interaction[_0xba7b('0x14')]('openchannel',_0xba7b('0x19')),controller[_0xba7b('0x1a')]);router[_0xba7b('0x1b')]('/:id',auth[_0xba7b('0x5')](),interaction[_0xba7b('0x14')](_0xba7b('0x15'),_0xba7b('0x1c')),controller[_0xba7b('0x1d')]);router[_0xba7b('0x1b')](_0xba7b('0x13'),auth[_0xba7b('0x5')](),controller['removeTags']);module['exports']=router;
\ No newline at end of file
index 5849ca2..5dbecdf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1052=['BOOLEAN','DATE','STRING','out','sequelize','exports'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x1052,0xf4));var _0x2105=function(_0x64bfc4,_0x46d7fe){_0x64bfc4=_0x64bfc4-0x0;var _0x4f6d04=_0x1052[_0x64bfc4];return _0x4f6d04;};'use strict';var Sequelize=require(_0x2105('0x0'));module[_0x2105('0x1')]={'closed':{'type':Sequelize[_0x2105('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2105('0x3')]},'disposition':{'type':Sequelize[_0x2105('0x4')]},'note':{'type':Sequelize[_0x2105('0x4')]},'read1stAt':{'type':Sequelize[_0x2105('0x3')]},'threadId':{'type':Sequelize[_0x2105('0x4')]},'externalUrl':{'type':Sequelize[_0x2105('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x2105('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x2263=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x2263,0x6e));var _0x3226=function(_0x599c94,_0x464f0e){_0x599c94=_0x599c94-0x0;var _0x34e215=_0x2263[_0x599c94];return _0x34e215;};'use strict';var Sequelize=require(_0x3226('0x0'));module[_0x3226('0x1')]={'closed':{'type':Sequelize[_0x3226('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3226('0x3')]},'disposition':{'type':Sequelize[_0x3226('0x4')]},'note':{'type':Sequelize[_0x3226('0x4')]},'read1stAt':{'type':Sequelize[_0x3226('0x3')]},'threadId':{'type':Sequelize[_0x3226('0x4')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x3226('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x3226('0x5')]('in',_0x3226('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x3226('0x4')]}};
\ No newline at end of file
index 7b5ec06..97e555d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x355e=['$gte','format','rows','addTags','setTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','files','tmp','attachments','firstName','Attachment','1cm','<hr>','<div\x20style=\x22border-style:\x20solid;\x20border-width:\x201px;\x20margin:\x203px;\x22>','<p\x20style=\x22margin:\x203px;\x22>%s:\x20%s</p>','</div>','basename','existsSync','createReadStream','pipe','createWriteStream','toFile','.pdf','log','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','status','end','json','offset','limit','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','name','OpenchannelInteraction','rawAttributes','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','map','type','key','VIRTUAL','options','include','push','Tag','tag','distinct','read','OpenchannelMessage','direction','count','then','includeAll','User','Users','fullname','CmContact','Contact','Owner','internal','OpenchannelAccount','Messages','createdAt','color','ThroughTags','findAll','catch','show','params','find','create','body','describe','addMessage','ids','omit','getMessages','nolimit','order','filter','merge'];(function(_0xde9447,_0x45a41c){var _0x3760b7=function(_0x592400){while(--_0x592400){_0xde9447['push'](_0xde9447['shift']());}};_0x3760b7(++_0x45a41c);}(_0x355e,0xa7));var _0xe355=function(_0x565675,_0x1e467c){_0x565675=_0x565675-0x0;var _0x468999=_0x355e[_0x565675];return _0x468999;};'use strict';var pdf=require(_0xe355('0x0'));var emlformat=require(_0xe355('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe355('0x2'));var jsonpatch=require(_0xe355('0x3'));var rp=require(_0xe355('0x4'));var moment=require(_0xe355('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe355('0x6'));var path=require(_0xe355('0x7'));var sox=require(_0xe355('0x8'));var csv=require(_0xe355('0x9'));var ejs=require(_0xe355('0xa'));var fs=require('fs');var _=require(_0xe355('0xb'));var squel=require(_0xe355('0xc'));var crypto=require(_0xe355('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe355('0xe'));var toCsv=require(_0xe355('0x9'));var querystring=require(_0xe355('0xf'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0xe355('0x10'));var Redis=require(_0xe355('0x11'));var qs=require('../../components/parsers/qs');var logger=require(_0xe355('0x12'))(_0xe355('0x13'));var utils=require(_0xe355('0x14'));var config=require('../../config/environment');var db=require(_0xe355('0x15'))['db'];config[_0xe355('0x16')]=_[_0xe355('0x17')](config[_0xe355('0x16')],{'host':_0xe355('0x18'),'port':0x18eb});var socket=require(_0xe355('0x19'))(new Redis(config[_0xe355('0x16')]));require(_0xe355('0x1a'))[_0xe355('0x1b')](socket);function respondWithStatusCode(_0x54ec53,_0x3ac130){_0x3ac130=_0x3ac130||0xcc;return function(_0x13a1b7){if(_0x13a1b7){return _0x54ec53['sendStatus'](_0x3ac130);}return _0x54ec53[_0xe355('0x1c')](_0x3ac130)[_0xe355('0x1d')]();};}function respondWithResult(_0x338099,_0x26abf6){_0x26abf6=_0x26abf6||0xc8;return function(_0x1a604){if(_0x1a604){return _0x338099[_0xe355('0x1c')](_0x26abf6)[_0xe355('0x1e')](_0x1a604);}};}function respondWithFilteredResult(_0x548c1c,_0x2e2230){return function(_0x1b602e){if(_0x1b602e){var _0x4b9c31=_0x1b602e['count'],_0x1266d5=_0x2e2230[_0xe355('0x1f')],_0x1d71b0=_0x2e2230[_0xe355('0x1f')]+_0x2e2230[_0xe355('0x20')],_0x3d5fc5;if(_0x1d71b0>=_0x4b9c31){_0x1d71b0=_0x4b9c31;_0x3d5fc5=0xc8;}else{_0x3d5fc5=0xce;}_0x548c1c[_0xe355('0x1c')](_0x3d5fc5);return _0x548c1c['set'](_0xe355('0x21'),_0x1266d5+'-'+_0x1d71b0+'/'+_0x4b9c31)[_0xe355('0x1e')](_0x1b602e);}return null;};}function patchUpdates(_0x2f4c55){return function(_0x4d100a){try{jsonpatch[_0xe355('0x22')](_0x4d100a,_0x2f4c55,!![]);}catch(_0x33e5ef){return BPromise[_0xe355('0x23')](_0x33e5ef);}return _0x4d100a[_0xe355('0x24')]();};}function saveUpdates(_0x20f237,_0x2eca9){return function(_0x1f0408){if(_0x1f0408){return _0x1f0408[_0xe355('0x25')](_0x20f237)['then'](function(_0x4c5304){return _0x4c5304;});}return null;};}function removeEntity(_0x1987f3,_0x5aae40){return function(_0x38e1ba){if(_0x38e1ba){return _0x38e1ba[_0xe355('0x26')]()['then'](function(){_0x1987f3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52063a,_0x349533){return function(_0x20858d){if(!_0x20858d){_0x52063a[_0xe355('0x27')](0x194);}return _0x20858d;};}function handleError(_0x5bad20,_0x458a0d){_0x458a0d=_0x458a0d||0x1f4;return function(_0x1034ee){logger[_0xe355('0x28')](_0x1034ee[_0xe355('0x29')]);if(_0x1034ee[_0xe355('0x2a')]){delete _0x1034ee['name'];}_0x5bad20['status'](_0x458a0d)['send'](_0x1034ee);};}exports['index']=function(_0x1ac0dd,_0x572a2d){var _0x3b9178={},_0x24dda1={},_0x2b961d={'count':0x0,'rows':[]};var _0x34b1eb=db[_0xe355('0x2b')][_0xe355('0x2c')];_0x24dda1[_0xe355('0x2d')]=_['keys'](_0x34b1eb);_0x24dda1['query']=_[_0xe355('0x2e')](_0x1ac0dd[_0xe355('0x2f')]);_0x24dda1['filters']=_['intersection'](_0x24dda1['model'],_0x24dda1['query']);_0x3b9178['attributes']=_[_0xe355('0x30')](_0x24dda1[_0xe355('0x2d')],qs['fields'](_0x1ac0dd[_0xe355('0x2f')][_0xe355('0x31')]));_0x3b9178[_0xe355('0x32')]=_0x3b9178[_0xe355('0x32')][_0xe355('0x33')]?_0x3b9178[_0xe355('0x32')]:_0x24dda1[_0xe355('0x2d')];if(!_0x1ac0dd['query'][_0xe355('0x34')]('nolimit')){_0x3b9178[_0xe355('0x20')]=qs[_0xe355('0x20')](_0x1ac0dd[_0xe355('0x2f')][_0xe355('0x20')]);_0x3b9178[_0xe355('0x1f')]=qs[_0xe355('0x1f')](_0x1ac0dd[_0xe355('0x2f')]['offset']);}_0x3b9178['order']=qs[_0xe355('0x35')](_0x1ac0dd[_0xe355('0x2f')][_0xe355('0x35')]);_0x3b9178[_0xe355('0x36')]=qs[_0xe355('0x37')](_[_0xe355('0x38')](_0x1ac0dd[_0xe355('0x2f')],_0x24dda1[_0xe355('0x37')]));if(_0x1ac0dd[_0xe355('0x2f')]['filter']){_0x3b9178[_0xe355('0x36')]=_['merge'](_0x3b9178[_0xe355('0x36')],{'$or':_[_0xe355('0x39')](_0x34b1eb,function(_0x46317c){if(_0x46317c[_0xe355('0x3a')][_0xe355('0x3b')]!==_0xe355('0x3c')){var _0x1c4514={};_0x1c4514[_0x46317c['field']]={'$like':'%'+_0x1ac0dd[_0xe355('0x2f')]['filter']+'%'};return _0x1c4514;}})});}_0x3b9178=_['merge']({},_0x3b9178,_0x1ac0dd[_0xe355('0x3d')]);var _0x26d8f5={'where':_0x3b9178[_0xe355('0x36')]};_0x26d8f5['include']=[];if(_0x1ac0dd[_0xe355('0x2f')]['tag']){_0x26d8f5[_0xe355('0x3e')][_0xe355('0x3f')]({'model':db[_0xe355('0x40')],'as':'Tags','attributes':['id'],'where':{'id':_0x1ac0dd[_0xe355('0x2f')][_0xe355('0x41')]},'required':!![]});_0x26d8f5[_0xe355('0x42')]=!![];}if(_0x1ac0dd[_0xe355('0x2f')][_0xe355('0x43')]){_0x26d8f5[_0xe355('0x3e')]['push']({'model':db[_0xe355('0x44')],'as':'Messages','attributes':['id',_0xe355('0x45'),'createdAt',_0xe355('0x43')],'where':{'direction':'in','read':_0x1ac0dd[_0xe355('0x2f')]['read']||![]},'required':!![]});_0x26d8f5[_0xe355('0x42')]=!![];}return db['OpenchannelInteraction'][_0xe355('0x46')](_0x26d8f5)[_0xe355('0x47')](function(_0x38426b){_0x2b961d[_0xe355('0x46')]=_0x38426b;if(_0x1ac0dd['query'][_0xe355('0x48')]){_0x3b9178[_0xe355('0x3e')]=[{'model':db[_0xe355('0x49')],'as':_0xe355('0x4a'),'required':![],'attributes':['id',_0xe355('0x2a'),_0xe355('0x4b')]},{'model':db[_0xe355('0x4c')],'as':_0xe355('0x4d'),'required':![]},{'model':db[_0xe355('0x49')],'as':_0xe355('0x4e'),'attributes':['name',_0xe355('0x4b'),_0xe355('0x4f')],'required':![]},{'model':db[_0xe355('0x50')],'as':'Account','attributes':[_0xe355('0x2a'),_0xe355('0x3b')],'required':![]},{'model':db[_0xe355('0x44')],'as':_0xe355('0x51'),'attributes':['id',_0xe355('0x45'),_0xe355('0x52'),_0xe355('0x43')],'where':{'direction':'in','read':_0x1ac0dd[_0xe355('0x2f')]['read']||![]},'required':_0x1ac0dd[_0xe355('0x2f')][_0xe355('0x43')]||![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0xe355('0x53')],'required':_0x1ac0dd[_0xe355('0x2f')][_0xe355('0x41')]?!![]:![]},{'model':db[_0xe355('0x40')],'as':_0xe355('0x54'),'attributes':['id',_0xe355('0x2a'),_0xe355('0x53')],'through':_0x1ac0dd[_0xe355('0x2f')][_0xe355('0x41')]?{'attributes':[],'where':{'TagId':_0x1ac0dd[_0xe355('0x2f')][_0xe355('0x41')]||undefined}}:{},'required':_0x1ac0dd[_0xe355('0x2f')]['tag']?!![]:![]}];}return db[_0xe355('0x2b')][_0xe355('0x55')](_0x3b9178);})['then'](function(_0x4cbef4){_0x2b961d['rows']=_0x4cbef4;return _0x2b961d;})['then'](respondWithFilteredResult(_0x572a2d,_0x3b9178))[_0xe355('0x56')](handleError(_0x572a2d,null));};exports[_0xe355('0x57')]=function(_0x1b5584,_0x490af1){var _0x28acb4={'raw':![],'where':{'id':_0x1b5584[_0xe355('0x58')]['id']}},_0x124bc9={};_0x124bc9[_0xe355('0x2d')]=_['keys'](db['OpenchannelInteraction'][_0xe355('0x2c')]);_0x124bc9[_0xe355('0x2f')]=_[_0xe355('0x2e')](_0x1b5584[_0xe355('0x2f')]);_0x124bc9['filters']=_[_0xe355('0x30')](_0x124bc9[_0xe355('0x2d')],_0x124bc9[_0xe355('0x2f')]);_0x28acb4['attributes']=_[_0xe355('0x30')](_0x124bc9[_0xe355('0x2d')],qs[_0xe355('0x31')](_0x1b5584[_0xe355('0x2f')][_0xe355('0x31')]));_0x28acb4[_0xe355('0x32')]=_0x28acb4[_0xe355('0x32')][_0xe355('0x33')]?_0x28acb4[_0xe355('0x32')]:_0x124bc9[_0xe355('0x2d')];if(_0x1b5584[_0xe355('0x2f')][_0xe355('0x48')]){_0x28acb4[_0xe355('0x3e')]=[{'all':!![]}];}_0x28acb4=_['merge']({},_0x28acb4,_0x1b5584[_0xe355('0x3d')]);return db[_0xe355('0x2b')][_0xe355('0x59')](_0x28acb4)[_0xe355('0x47')](handleEntityNotFound(_0x490af1,null))[_0xe355('0x47')](respondWithResult(_0x490af1,null))[_0xe355('0x56')](handleError(_0x490af1,null));};exports[_0xe355('0x5a')]=function(_0x31fe2d,_0x1b9da0){return db[_0xe355('0x2b')][_0xe355('0x5a')](_0x31fe2d[_0xe355('0x5b')],{})[_0xe355('0x47')](respondWithResult(_0x1b9da0,0xc9))[_0xe355('0x56')](handleError(_0x1b9da0,null));};exports[_0xe355('0x25')]=function(_0x21cdc5,_0x3711a3){if(_0x21cdc5['body']['id']){delete _0x21cdc5[_0xe355('0x5b')]['id'];}return db[_0xe355('0x2b')][_0xe355('0x59')]({'where':{'id':_0x21cdc5[_0xe355('0x58')]['id']}})['then'](handleEntityNotFound(_0x3711a3,null))['then'](saveUpdates(_0x21cdc5[_0xe355('0x5b')],null))[_0xe355('0x47')](respondWithResult(_0x3711a3,null))[_0xe355('0x56')](handleError(_0x3711a3,null));};exports[_0xe355('0x26')]=function(_0x213ff6,_0x3064e4){return db[_0xe355('0x2b')][_0xe355('0x59')]({'where':{'id':_0x213ff6[_0xe355('0x58')]['id']}})[_0xe355('0x47')](handleEntityNotFound(_0x3064e4,null))[_0xe355('0x47')](removeEntity(_0x3064e4,null))[_0xe355('0x56')](handleError(_0x3064e4,null));};exports[_0xe355('0x5c')]=function(_0x5ba438,_0x34a5e1){return db[_0xe355('0x2b')][_0xe355('0x5c')]()['then'](respondWithResult(_0x34a5e1,null))['catch'](handleError(_0x34a5e1,null));};exports[_0xe355('0x5d')]=function(_0x55e4d2,_0x42985f,_0x19c032){return db[_0xe355('0x44')][_0xe355('0x59')]({'where':{'id':_0x55e4d2[_0xe355('0x58')]['id']}})[_0xe355('0x47')](handleEntityNotFound(_0x42985f,null))['then'](function(_0x5e2dc5){if(_0x5e2dc5){return _0x5e2dc5[_0xe355('0x5d')](_0x55e4d2['body'][_0xe355('0x5e')],_[_0xe355('0x5f')](_0x55e4d2[_0xe355('0x5b')],[_0xe355('0x5e'),'id'])||{});}})[_0xe355('0x47')](respondWithResult(_0x42985f,null))['catch'](handleError(_0x42985f,null));};exports[_0xe355('0x60')]=function(_0x29dec5,_0xf36af,_0x95a4f9){var _0xf1ded8={'raw':![],'where':{}};var _0x5de9de={};var _0x1585a0={'count':0x0,'rows':[]};return db[_0xe355('0x2b')]['findOne']({'where':{'id':_0x29dec5[_0xe355('0x58')]['id']}})[_0xe355('0x47')](handleEntityNotFound(_0xf36af,null))[_0xe355('0x47')](function(_0x5b5b7d){if(_0x5b5b7d){_0x5de9de[_0xe355('0x2d')]=_[_0xe355('0x2e')](db[_0xe355('0x44')]['rawAttributes']);_0x5de9de['query']=_[_0xe355('0x2e')](_0x29dec5['query']);_0x5de9de[_0xe355('0x37')]=_[_0xe355('0x30')](_0x5de9de[_0xe355('0x2d')],_0x5de9de[_0xe355('0x2f')]);_0xf1ded8[_0xe355('0x32')]=_[_0xe355('0x30')](_0x5de9de[_0xe355('0x2d')],qs['fields'](_0x29dec5[_0xe355('0x2f')][_0xe355('0x31')]));_0xf1ded8['attributes']=_0xf1ded8[_0xe355('0x32')][_0xe355('0x33')]?_0xf1ded8[_0xe355('0x32')]:_0x5de9de[_0xe355('0x2d')];if(!_0x29dec5[_0xe355('0x2f')][_0xe355('0x34')](_0xe355('0x61'))){_0xf1ded8['limit']=qs[_0xe355('0x20')](_0x29dec5[_0xe355('0x2f')][_0xe355('0x20')]);_0xf1ded8[_0xe355('0x1f')]=qs[_0xe355('0x1f')](_0x29dec5['query'][_0xe355('0x1f')]);}_0xf1ded8[_0xe355('0x62')]=qs[_0xe355('0x35')](_0x29dec5[_0xe355('0x2f')][_0xe355('0x35')]);_0xf1ded8[_0xe355('0x36')]=qs[_0xe355('0x37')](_[_0xe355('0x38')](_0x29dec5[_0xe355('0x2f')],_0x5de9de[_0xe355('0x37')]));_0xf1ded8[_0xe355('0x36')]['OpenchannelInteractionId']=_0x5b5b7d['id'];if(_0x29dec5['query'][_0xe355('0x63')]){_0xf1ded8[_0xe355('0x36')]=_[_0xe355('0x64')](_0xf1ded8[_0xe355('0x36')],{'$or':_['map'](_0xf1ded8[_0xe355('0x32')],function(_0x411695){var _0x27dd24={};_0x27dd24[_0x411695]={'$like':'%'+_0x29dec5[_0xe355('0x2f')]['filter']+'%'};return _0x27dd24;})});}if(_0x29dec5[_0xe355('0x2f')][_0xe355('0x65')]){var _0x28037d=_0x29dec5['query'][_0xe355('0x65')]['split'](',');var _0x422ef6={};_0x422ef6[_0x28037d[0x0]]={'$gte':moment(_0x28037d[0x1])[_0xe355('0x66')]('YYYY-MM-DD\x20HH:mm:ss')};_0xf1ded8[_0xe355('0x36')]=_[_0xe355('0x64')](_0xf1ded8[_0xe355('0x36')],_0x422ef6);}_0xf1ded8=_[_0xe355('0x64')]({},_0xf1ded8,_0x29dec5[_0xe355('0x3d')]);return db['OpenchannelMessage'][_0xe355('0x46')]({'where':_0xf1ded8['where']})[_0xe355('0x47')](function(_0x500b30){_0x1585a0['count']=_0x500b30;if(_0x29dec5['query'][_0xe355('0x48')]){_0xf1ded8[_0xe355('0x3e')]=[{'all':!![]}];}return db[_0xe355('0x44')][_0xe355('0x55')](_0xf1ded8);})[_0xe355('0x47')](function(_0x3449f2){_0x1585a0[_0xe355('0x67')]=_0x3449f2;return _0x1585a0;});}})[_0xe355('0x47')](respondWithFilteredResult(_0xf36af,_0xf1ded8))[_0xe355('0x56')](handleError(_0xf36af,null));};exports[_0xe355('0x68')]=function(_0x2059aa,_0x22e263,_0x15c5ee){return db['OpenchannelInteraction']['find']({'where':{'id':_0x2059aa[_0xe355('0x58')]['id']}})[_0xe355('0x47')](handleEntityNotFound(_0x22e263,null))[_0xe355('0x47')](function(_0x4e3f25){if(_0x4e3f25){return _0x4e3f25[_0xe355('0x69')](_0x2059aa['body'][_0xe355('0x5e')],_[_0xe355('0x5f')](_0x2059aa[_0xe355('0x5b')],[_0xe355('0x5e'),'id'])||{})[_0xe355('0x6a')](function(){return db['Tag']['findAll']({'attributes':['id','name',_0xe355('0x53')],'where':{'id':_0x2059aa[_0xe355('0x5b')][_0xe355('0x5e')]}});})['then'](function(_0x2e649a){socket[_0xe355('0x6b')](_0xe355('0x6c'),{'id':Number(_0x2059aa[_0xe355('0x58')]['id']),'tags':_0x2e649a||[]});return{'id':Number(_0x2059aa[_0xe355('0x58')]['id']),'tags':_0x2e649a||[]};});}})['then'](respondWithResult(_0x22e263,null))['catch'](handleError(_0x22e263,null));};exports[_0xe355('0x6d')]=function(_0x34994d,_0x1ea17b,_0x55f633){var _0x1766c7;return db[_0xe355('0x2b')]['find']({'where':{'id':_0x34994d[_0xe355('0x58')]['id']}})[_0xe355('0x47')](handleEntityNotFound(_0x1ea17b,null))[_0xe355('0x47')](function(_0x130efa){if(_0x130efa){return _0x130efa[_0xe355('0x6d')](_0x34994d[_0xe355('0x2f')][_0xe355('0x5e')]);}})['then'](respondWithStatusCode(_0x1ea17b,null))[_0xe355('0x56')](handleError(_0x1ea17b,null));};exports[_0xe355('0x6e')]=function(_0x148d74,_0x1e6ffa){var _0x805abc=moment()[_0xe355('0x6f')]()[_0xe355('0x70')]();var _0x33f2ae=path[_0xe355('0x71')](config[_0xe355('0x72')],'server',_0xe355('0x73'),_0xe355('0x74'));var _0x38826a=path['join'](config[_0xe355('0x72')],'server',_0xe355('0x73'),_0xe355('0x75'));var _0x66d6b5=path[_0xe355('0x71')](_0x33f2ae,_0x805abc);var _0x5b0671=util[_0xe355('0x66')]('interaction-%s.zip',_0x805abc);var _0x532704=path['join'](_0x33f2ae,_0x5b0671);var _0x502ec2=![];return db[_0xe355('0x2b')][_0xe355('0x59')]({'where':{'id':_0x148d74[_0xe355('0x58')]['id']},'include':[{'model':db['OpenchannelMessage'],'as':_0xe355('0x51'),'attributes':['id',_0xe355('0x5b')],'include':[{'model':db[_0xe355('0x49')],'as':'User','attributes':['id','fullname'],'raw':!![]},{'model':db[_0xe355('0x4c')],'as':'Contact','attributes':['id',_0xe355('0x76')],'raw':!![]},{'model':db[_0xe355('0x77')],'as':_0xe355('0x77'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x1e6ffa,null))[_0xe355('0x47')](function(_0x4744b5){if(_0x4744b5){_0x502ec2=!![];var _0x102ada='';var _0x16cc48={'format':'Letter','border':_0xe355('0x78')};fs['mkdirSync'](_0x66d6b5);_0x102ada+=util['format']('<h1>Openchannel\x20Interaction:\x20#%d</h1>',_0x4744b5['id']);_0x102ada+=util['format']('<h2>Date:\x20%s</h2>',moment()['format']('MMMM\x20Do\x20YYYY,\x20HH:mm:ss')[_0xe355('0x70')]());_0x102ada+=_0xe355('0x79');for(var _0x1465fc=0x0;_0x1465fc<_0x4744b5[_0xe355('0x51')][_0xe355('0x33')];_0x1465fc++){var _0x3913b3=_0x4744b5[_0xe355('0x51')][_0x1465fc];_0x102ada+=_0xe355('0x7a');_0x102ada+=util[_0xe355('0x66')](_0xe355('0x7b'),_0x3913b3[_0xe355('0x49')]?_0x3913b3[_0xe355('0x49')][_0xe355('0x4b')]:_0x3913b3[_0xe355('0x4d')]['firstName'],_0x3913b3[_0xe355('0x5b')]);_0x102ada+=_0xe355('0x7c');if(_0x3913b3['Attachment']){var _0xeeb463=_0x3913b3[_0xe355('0x77')];var _0x41bdf7=path['join'](_0x38826a,_0xeeb463[_0xe355('0x7d')]);if(fs[_0xe355('0x7e')](_0x41bdf7)){fs[_0xe355('0x7f')](_0x41bdf7)[_0xe355('0x80')](fs[_0xe355('0x81')](path['join'](_0x66d6b5,_0xeeb463['basename'])));}}}return new BPromise(function(_0x6f7b1a,_0x6daffe){pdf[_0xe355('0x5a')](_0x102ada,_0x16cc48)[_0xe355('0x82')](path['join'](_0x66d6b5,'interaction-'+_0x805abc+_0xe355('0x83')),function(_0x445e31,_0x101fc7){if(_0x445e31)return _0x6daffe(_0x445e31);_0x6f7b1a(_0x101fc7);});});}})[_0xe355('0x47')](function(){if(_0x502ec2){return new BPromise(function(_0x44fcf0,_0x4a1f87){zipdir(_0x66d6b5,{'saveTo':_0x532704},function(_0x475b78,_0x2ba89f){if(_0x475b78)return _0x4a1f87(_0x475b78);return _0x44fcf0(_0x2ba89f);});});}})[_0xe355('0x47')](function(){if(_0x502ec2){return new BPromise(function(_0x361923,_0x9d05d5){rimraf(_0x66d6b5,function(_0x1892bb){if(_0x1892bb)_0x9d05d5(_0x1892bb);return _0x361923();});});}})[_0xe355('0x47')](function(){if(_0x502ec2){return _0x1e6ffa['download'](_0x532704,_0x5b0671,function(_0x478bfb){if(_0x478bfb){console[_0xe355('0x84')]('err',_0x478bfb);}else{fs[_0xe355('0x85')](_0x532704);}});}else{return _0x1e6ffa[_0xe355('0x27')](0xc8);}})[_0xe355('0x56')](handleError(_0x1e6ffa,null));};
\ No newline at end of file
+var _0x4693=['log','err','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','offset','set','apply','save','update','then','error','stack','name','send','OpenchannelInteraction','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','map','type','field','options','include','tag','Tag','distinct','push','OpenchannelMessage','Messages','direction','createdAt','read','count','includeAll','Users','fullname','CmContact','User','Owner','OpenchannelAccount','key','Tags','ThroughTags','findAll','rows','catch','params','rawAttributes','merge','create','body','find','destroy','addMessage','ids','omit','getMessages','findOne','$gte','split','format','addTags','setTags','spread','color','emit','removeTags','unix','toString','join','root','server','tmp','files','attachments','Contact','firstName','Attachment','Letter','1cm','<h1>Openchannel\x20Interaction:\x20#%d</h1>','<h2>Date:\x20%s</h2>','<hr>','<div\x20style=\x22border-style:\x20solid;\x20border-width:\x201px;\x20margin:\x203px;\x22>','</div>','pipe','basename','toFile','.pdf','download'];(function(_0x5798fb,_0x502401){var _0x13608b=function(_0x57a076){while(--_0x57a076){_0x5798fb['push'](_0x5798fb['shift']());}};_0x13608b(++_0x502401);}(_0x4693,0x18b));var _0x3469=function(_0x52d701,_0x149706){_0x52d701=_0x52d701-0x0;var _0x4579b5=_0x4693[_0x52d701];return _0x4579b5;};'use strict';var pdf=require(_0x3469('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3469('0x1'));var zipdir=require(_0x3469('0x2'));var jsonpatch=require(_0x3469('0x3'));var rp=require(_0x3469('0x4'));var moment=require(_0x3469('0x5'));var BPromise=require(_0x3469('0x6'));var Mustache=require(_0x3469('0x7'));var util=require(_0x3469('0x8'));var path=require(_0x3469('0x9'));var sox=require('sox');var csv=require(_0x3469('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3469('0xb'));var squel=require(_0x3469('0xc'));var crypto=require(_0x3469('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3469('0xe'));var toCsv=require(_0x3469('0xa'));var querystring=require('querystring');var Papa=require(_0x3469('0xf'));var authService=require('../../components/auth/service');var hardwareService=require(_0x3469('0x10'));var Redis=require(_0x3469('0x11'));var qs=require(_0x3469('0x12'));var logger=require(_0x3469('0x13'))(_0x3469('0x14'));var utils=require(_0x3469('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x3469('0x16')]=_['defaults'](config[_0x3469('0x16')],{'host':_0x3469('0x17'),'port':0x18eb});var socket=require(_0x3469('0x18'))(new Redis(config[_0x3469('0x16')]));require(_0x3469('0x19'))[_0x3469('0x1a')](socket);function respondWithStatusCode(_0x58636c,_0x5ce5d0){_0x5ce5d0=_0x5ce5d0||0xcc;return function(_0x16a5f3){if(_0x16a5f3){return _0x58636c[_0x3469('0x1b')](_0x5ce5d0);}return _0x58636c[_0x3469('0x1c')](_0x5ce5d0)[_0x3469('0x1d')]();};}function respondWithResult(_0x4b565a,_0x3d7ad8){_0x3d7ad8=_0x3d7ad8||0xc8;return function(_0x18c472){if(_0x18c472){return _0x4b565a[_0x3469('0x1c')](_0x3d7ad8)['json'](_0x18c472);}};}function respondWithFilteredResult(_0xc118c8,_0x2b3950){return function(_0xa5f8c7){if(_0xa5f8c7){var _0x3cdd50=_0xa5f8c7['count'],_0x4c4725=_0x2b3950[_0x3469('0x1e')],_0x18b084=_0x2b3950['offset']+_0x2b3950['limit'],_0x142905;if(_0x18b084>=_0x3cdd50){_0x18b084=_0x3cdd50;_0x142905=0xc8;}else{_0x142905=0xce;}_0xc118c8['status'](_0x142905);return _0xc118c8[_0x3469('0x1f')]('Content-Range',_0x4c4725+'-'+_0x18b084+'/'+_0x3cdd50)['json'](_0xa5f8c7);}return null;};}function patchUpdates(_0x4c6956){return function(_0x562d6b){try{jsonpatch[_0x3469('0x20')](_0x562d6b,_0x4c6956,!![]);}catch(_0x5da9b2){return BPromise['reject'](_0x5da9b2);}return _0x562d6b[_0x3469('0x21')]();};}function saveUpdates(_0xf393d0,_0x4df079){return function(_0x51fc8b){if(_0x51fc8b){return _0x51fc8b[_0x3469('0x22')](_0xf393d0)[_0x3469('0x23')](function(_0x321728){return _0x321728;});}return null;};}function removeEntity(_0x2c9fdf,_0x4d4495){return function(_0x20dfee){if(_0x20dfee){return _0x20dfee['destroy']()[_0x3469('0x23')](function(){_0x2c9fdf[_0x3469('0x1c')](0xcc)[_0x3469('0x1d')]();});}};}function handleEntityNotFound(_0x1baccd,_0x2d8155){return function(_0x52a356){if(!_0x52a356){_0x1baccd[_0x3469('0x1b')](0x194);}return _0x52a356;};}function handleError(_0x589729,_0x1169e1){_0x1169e1=_0x1169e1||0x1f4;return function(_0x2ba232){logger[_0x3469('0x24')](_0x2ba232[_0x3469('0x25')]);if(_0x2ba232[_0x3469('0x26')]){delete _0x2ba232[_0x3469('0x26')];}_0x589729['status'](_0x1169e1)[_0x3469('0x27')](_0x2ba232);};}exports['index']=function(_0x526714,_0x1ad3f6){var _0x191fa4={},_0x3a716e={},_0x49178b={'count':0x0,'rows':[]};var _0xbd30aa=db[_0x3469('0x28')]['rawAttributes'];_0x3a716e[_0x3469('0x29')]=_[_0x3469('0x2a')](_0xbd30aa);_0x3a716e[_0x3469('0x2b')]=_[_0x3469('0x2a')](_0x526714[_0x3469('0x2b')]);_0x3a716e['filters']=_[_0x3469('0x2c')](_0x3a716e[_0x3469('0x29')],_0x3a716e['query']);_0x191fa4['attributes']=_[_0x3469('0x2c')](_0x3a716e['model'],qs[_0x3469('0x2d')](_0x526714[_0x3469('0x2b')][_0x3469('0x2d')]));_0x191fa4[_0x3469('0x2e')]=_0x191fa4[_0x3469('0x2e')][_0x3469('0x2f')]?_0x191fa4[_0x3469('0x2e')]:_0x3a716e[_0x3469('0x29')];if(!_0x526714[_0x3469('0x2b')][_0x3469('0x30')](_0x3469('0x31'))){_0x191fa4[_0x3469('0x32')]=qs[_0x3469('0x32')](_0x526714['query'][_0x3469('0x32')]);_0x191fa4[_0x3469('0x1e')]=qs[_0x3469('0x1e')](_0x526714[_0x3469('0x2b')]['offset']);}_0x191fa4[_0x3469('0x33')]=qs[_0x3469('0x34')](_0x526714['query'][_0x3469('0x34')]);_0x191fa4[_0x3469('0x35')]=qs[_0x3469('0x36')](_[_0x3469('0x37')](_0x526714[_0x3469('0x2b')],_0x3a716e[_0x3469('0x36')]));if(_0x526714['query'][_0x3469('0x38')]){_0x191fa4['where']=_['merge'](_0x191fa4[_0x3469('0x35')],{'$or':_[_0x3469('0x39')](_0xbd30aa,function(_0x4cff8a){if(_0x4cff8a[_0x3469('0x3a')]['key']!=='VIRTUAL'){var _0x4f2a87={};_0x4f2a87[_0x4cff8a[_0x3469('0x3b')]]={'$like':'%'+_0x526714[_0x3469('0x2b')][_0x3469('0x38')]+'%'};return _0x4f2a87;}})});}_0x191fa4=_['merge']({},_0x191fa4,_0x526714[_0x3469('0x3c')]);var _0xe14215={'where':_0x191fa4['where']};_0xe14215[_0x3469('0x3d')]=[];if(_0x526714['query'][_0x3469('0x3e')]){_0xe14215[_0x3469('0x3d')]['push']({'model':db[_0x3469('0x3f')],'as':'Tags','attributes':['id'],'where':{'id':_0x526714[_0x3469('0x2b')][_0x3469('0x3e')]},'required':!![]});_0xe14215[_0x3469('0x40')]=!![];}if(_0x526714['query']['read']){_0xe14215[_0x3469('0x3d')][_0x3469('0x41')]({'model':db[_0x3469('0x42')],'as':_0x3469('0x43'),'attributes':['id',_0x3469('0x44'),_0x3469('0x45'),_0x3469('0x46')],'where':{'direction':'in','read':_0x526714['query'][_0x3469('0x46')]||![]},'required':!![]});_0xe14215[_0x3469('0x40')]=!![];}return db['OpenchannelInteraction'][_0x3469('0x47')](_0xe14215)['then'](function(_0x8bc45a){_0x49178b[_0x3469('0x47')]=_0x8bc45a;if(_0x526714[_0x3469('0x2b')][_0x3469('0x48')]){_0x191fa4[_0x3469('0x3d')]=[{'model':db['User'],'as':_0x3469('0x49'),'required':![],'attributes':['id',_0x3469('0x26'),_0x3469('0x4a')]},{'model':db[_0x3469('0x4b')],'as':'Contact','required':![]},{'model':db[_0x3469('0x4c')],'as':_0x3469('0x4d'),'attributes':[_0x3469('0x26'),'fullname','internal'],'required':![]},{'model':db[_0x3469('0x4e')],'as':'Account','attributes':[_0x3469('0x26'),_0x3469('0x4f')],'required':![]},{'model':db['OpenchannelMessage'],'as':_0x3469('0x43'),'attributes':['id',_0x3469('0x44'),_0x3469('0x45'),_0x3469('0x46')],'where':{'direction':'in','read':_0x526714[_0x3469('0x2b')]['read']||![]},'required':_0x526714[_0x3469('0x2b')][_0x3469('0x46')]||![]},{'model':db[_0x3469('0x3f')],'as':_0x3469('0x50'),'attributes':['id',_0x3469('0x26'),'color'],'required':_0x526714['query'][_0x3469('0x3e')]?!![]:![]},{'model':db[_0x3469('0x3f')],'as':_0x3469('0x51'),'attributes':['id','name','color'],'through':_0x526714[_0x3469('0x2b')]['tag']?{'attributes':[],'where':{'TagId':_0x526714['query']['tag']||undefined}}:{},'required':_0x526714['query']['tag']?!![]:![]}];}return db[_0x3469('0x28')][_0x3469('0x52')](_0x191fa4);})['then'](function(_0x39040a){_0x49178b[_0x3469('0x53')]=_0x39040a;return _0x49178b;})['then'](respondWithFilteredResult(_0x1ad3f6,_0x191fa4))[_0x3469('0x54')](handleError(_0x1ad3f6,null));};exports['show']=function(_0x321ebf,_0x1d0aa2){var _0x499439={'raw':![],'where':{'id':_0x321ebf[_0x3469('0x55')]['id']}},_0x251cf4={};_0x251cf4[_0x3469('0x29')]=_[_0x3469('0x2a')](db[_0x3469('0x28')][_0x3469('0x56')]);_0x251cf4[_0x3469('0x2b')]=_['keys'](_0x321ebf[_0x3469('0x2b')]);_0x251cf4[_0x3469('0x36')]=_[_0x3469('0x2c')](_0x251cf4[_0x3469('0x29')],_0x251cf4[_0x3469('0x2b')]);_0x499439[_0x3469('0x2e')]=_[_0x3469('0x2c')](_0x251cf4[_0x3469('0x29')],qs[_0x3469('0x2d')](_0x321ebf[_0x3469('0x2b')][_0x3469('0x2d')]));_0x499439[_0x3469('0x2e')]=_0x499439[_0x3469('0x2e')][_0x3469('0x2f')]?_0x499439['attributes']:_0x251cf4[_0x3469('0x29')];if(_0x321ebf['query'][_0x3469('0x48')]){_0x499439[_0x3469('0x3d')]=[{'all':!![]}];}_0x499439=_[_0x3469('0x57')]({},_0x499439,_0x321ebf[_0x3469('0x3c')]);return db['OpenchannelInteraction']['find'](_0x499439)['then'](handleEntityNotFound(_0x1d0aa2,null))[_0x3469('0x23')](respondWithResult(_0x1d0aa2,null))[_0x3469('0x54')](handleError(_0x1d0aa2,null));};exports['create']=function(_0x21db34,_0x5db3e3){return db[_0x3469('0x28')][_0x3469('0x58')](_0x21db34[_0x3469('0x59')],{})[_0x3469('0x23')](respondWithResult(_0x5db3e3,0xc9))['catch'](handleError(_0x5db3e3,null));};exports[_0x3469('0x22')]=function(_0x15f158,_0x357c21){if(_0x15f158['body']['id']){delete _0x15f158[_0x3469('0x59')]['id'];}return db[_0x3469('0x28')][_0x3469('0x5a')]({'where':{'id':_0x15f158['params']['id']}})[_0x3469('0x23')](handleEntityNotFound(_0x357c21,null))[_0x3469('0x23')](saveUpdates(_0x15f158[_0x3469('0x59')],null))['then'](respondWithResult(_0x357c21,null))[_0x3469('0x54')](handleError(_0x357c21,null));};exports[_0x3469('0x5b')]=function(_0x4c66ba,_0x6139cc){return db[_0x3469('0x28')][_0x3469('0x5a')]({'where':{'id':_0x4c66ba[_0x3469('0x55')]['id']}})['then'](handleEntityNotFound(_0x6139cc,null))['then'](removeEntity(_0x6139cc,null))['catch'](handleError(_0x6139cc,null));};exports['describe']=function(_0x13670d,_0x510802){return db['OpenchannelInteraction']['describe']()['then'](respondWithResult(_0x510802,null))[_0x3469('0x54')](handleError(_0x510802,null));};exports['addMessage']=function(_0x2c0a0e,_0x2780a9,_0x1bb66b){return db['OpenchannelMessage'][_0x3469('0x5a')]({'where':{'id':_0x2c0a0e[_0x3469('0x55')]['id']}})[_0x3469('0x23')](handleEntityNotFound(_0x2780a9,null))[_0x3469('0x23')](function(_0x2b8776){if(_0x2b8776){return _0x2b8776[_0x3469('0x5c')](_0x2c0a0e[_0x3469('0x59')][_0x3469('0x5d')],_[_0x3469('0x5e')](_0x2c0a0e['body'],[_0x3469('0x5d'),'id'])||{});}})[_0x3469('0x23')](respondWithResult(_0x2780a9,null))['catch'](handleError(_0x2780a9,null));};exports[_0x3469('0x5f')]=function(_0x52107c,_0x29b917,_0x290397){var _0x367e44={'raw':![],'where':{}};var _0x3e3e21={};var _0x5c6f77={'count':0x0,'rows':[]};return db[_0x3469('0x28')][_0x3469('0x60')]({'where':{'id':_0x52107c[_0x3469('0x55')]['id']}})[_0x3469('0x23')](handleEntityNotFound(_0x29b917,null))[_0x3469('0x23')](function(_0x3638b4){if(_0x3638b4){_0x3e3e21['model']=_['keys'](db[_0x3469('0x42')][_0x3469('0x56')]);_0x3e3e21['query']=_['keys'](_0x52107c[_0x3469('0x2b')]);_0x3e3e21[_0x3469('0x36')]=_[_0x3469('0x2c')](_0x3e3e21[_0x3469('0x29')],_0x3e3e21[_0x3469('0x2b')]);_0x367e44['attributes']=_[_0x3469('0x2c')](_0x3e3e21[_0x3469('0x29')],qs[_0x3469('0x2d')](_0x52107c['query']['fields']));_0x367e44[_0x3469('0x2e')]=_0x367e44[_0x3469('0x2e')][_0x3469('0x2f')]?_0x367e44['attributes']:_0x3e3e21[_0x3469('0x29')];if(!_0x52107c['query'][_0x3469('0x30')](_0x3469('0x31'))){_0x367e44[_0x3469('0x32')]=qs[_0x3469('0x32')](_0x52107c[_0x3469('0x2b')][_0x3469('0x32')]);_0x367e44[_0x3469('0x1e')]=qs[_0x3469('0x1e')](_0x52107c[_0x3469('0x2b')][_0x3469('0x1e')]);}_0x367e44[_0x3469('0x33')]=qs[_0x3469('0x34')](_0x52107c[_0x3469('0x2b')]['sort']);_0x367e44[_0x3469('0x35')]=qs['filters'](_['pick'](_0x52107c['query'],_0x3e3e21[_0x3469('0x36')]));_0x367e44[_0x3469('0x35')]['OpenchannelInteractionId']=_0x3638b4['id'];if(_0x52107c[_0x3469('0x2b')][_0x3469('0x38')]){_0x367e44[_0x3469('0x35')]=_[_0x3469('0x57')](_0x367e44[_0x3469('0x35')],{'$or':_[_0x3469('0x39')](_0x367e44[_0x3469('0x2e')],function(_0x55de24){var _0x5bba93={};_0x5bba93[_0x55de24]={'$like':'%'+_0x52107c['query'][_0x3469('0x38')]+'%'};return _0x5bba93;})});}if(_0x52107c[_0x3469('0x2b')][_0x3469('0x61')]){var _0x4b9e80=_0x52107c[_0x3469('0x2b')][_0x3469('0x61')][_0x3469('0x62')](',');var _0x3e2432={};_0x3e2432[_0x4b9e80[0x0]]={'$gte':moment(_0x4b9e80[0x1])[_0x3469('0x63')]('YYYY-MM-DD\x20HH:mm:ss')};_0x367e44[_0x3469('0x35')]=_['merge'](_0x367e44[_0x3469('0x35')],_0x3e2432);}_0x367e44=_[_0x3469('0x57')]({},_0x367e44,_0x52107c[_0x3469('0x3c')]);return db[_0x3469('0x42')][_0x3469('0x47')]({'where':_0x367e44['where']})[_0x3469('0x23')](function(_0x256c7e){_0x5c6f77['count']=_0x256c7e;if(_0x52107c[_0x3469('0x2b')]['includeAll']){_0x367e44[_0x3469('0x3d')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x3469('0x52')](_0x367e44);})[_0x3469('0x23')](function(_0x102e9d){_0x5c6f77['rows']=_0x102e9d;return _0x5c6f77;});}})[_0x3469('0x23')](respondWithFilteredResult(_0x29b917,_0x367e44))[_0x3469('0x54')](handleError(_0x29b917,null));};exports[_0x3469('0x64')]=function(_0x13687e,_0x3ce1e7,_0x337cc2){return db[_0x3469('0x28')][_0x3469('0x5a')]({'where':{'id':_0x13687e[_0x3469('0x55')]['id']}})[_0x3469('0x23')](handleEntityNotFound(_0x3ce1e7,null))['then'](function(_0x1058f1){if(_0x1058f1){return _0x1058f1[_0x3469('0x65')](_0x13687e[_0x3469('0x59')][_0x3469('0x5d')],_[_0x3469('0x5e')](_0x13687e[_0x3469('0x59')],[_0x3469('0x5d'),'id'])||{})[_0x3469('0x66')](function(){return db[_0x3469('0x3f')][_0x3469('0x52')]({'attributes':['id','name',_0x3469('0x67')],'where':{'id':_0x13687e[_0x3469('0x59')]['ids']}});})[_0x3469('0x23')](function(_0x4d9830){socket[_0x3469('0x68')]('openchannelInteractionTags:save',{'id':Number(_0x13687e[_0x3469('0x55')]['id']),'tags':_0x4d9830||[]});return{'id':Number(_0x13687e['params']['id']),'tags':_0x4d9830||[]};});}})['then'](respondWithResult(_0x3ce1e7,null))[_0x3469('0x54')](handleError(_0x3ce1e7,null));};exports[_0x3469('0x69')]=function(_0x136829,_0x1a9ba2,_0x5da4de){var _0x49b98f;return db[_0x3469('0x28')][_0x3469('0x5a')]({'where':{'id':_0x136829['params']['id']}})[_0x3469('0x23')](handleEntityNotFound(_0x1a9ba2,null))[_0x3469('0x23')](function(_0x54172e){if(_0x54172e){return _0x54172e[_0x3469('0x69')](_0x136829[_0x3469('0x2b')][_0x3469('0x5d')]);}})[_0x3469('0x23')](respondWithStatusCode(_0x1a9ba2,null))['catch'](handleError(_0x1a9ba2,null));};exports['download']=function(_0x33ce4d,_0x42f90c){var _0x91cc58=moment()[_0x3469('0x6a')]()[_0x3469('0x6b')]();var _0x41f163=path[_0x3469('0x6c')](config[_0x3469('0x6d')],_0x3469('0x6e'),'files',_0x3469('0x6f'));var _0x1fbc4d=path[_0x3469('0x6c')](config[_0x3469('0x6d')],'server',_0x3469('0x70'),_0x3469('0x71'));var _0x3ea79e=path[_0x3469('0x6c')](_0x41f163,_0x91cc58);var _0xc27b45=util['format']('interaction-%s.zip',_0x91cc58);var _0x2d994d=path['join'](_0x41f163,_0xc27b45);var _0x12924e=![];return db[_0x3469('0x28')][_0x3469('0x5a')]({'where':{'id':_0x33ce4d[_0x3469('0x55')]['id']},'include':[{'model':db['OpenchannelMessage'],'as':_0x3469('0x43'),'attributes':['id',_0x3469('0x59')],'include':[{'model':db[_0x3469('0x4c')],'as':'User','attributes':['id','fullname'],'raw':!![]},{'model':db[_0x3469('0x4b')],'as':_0x3469('0x72'),'attributes':['id',_0x3469('0x73')],'raw':!![]},{'model':db['Attachment'],'as':_0x3469('0x74'),'raw':!![]}]}]})[_0x3469('0x23')](handleEntityNotFound(_0x42f90c,null))['then'](function(_0xa2b54e){if(_0xa2b54e){_0x12924e=!![];var _0x264caa='';var _0x165dff={'format':_0x3469('0x75'),'border':_0x3469('0x76')};fs['mkdirSync'](_0x3ea79e);_0x264caa+=util['format'](_0x3469('0x77'),_0xa2b54e['id']);_0x264caa+=util[_0x3469('0x63')](_0x3469('0x78'),moment()['format']('MMMM\x20Do\x20YYYY,\x20HH:mm:ss')[_0x3469('0x6b')]());_0x264caa+=_0x3469('0x79');for(var _0x5db27a=0x0;_0x5db27a<_0xa2b54e[_0x3469('0x43')][_0x3469('0x2f')];_0x5db27a++){var _0x1bab16=_0xa2b54e[_0x3469('0x43')][_0x5db27a];_0x264caa+=_0x3469('0x7a');_0x264caa+=util[_0x3469('0x63')]('<p\x20style=\x22margin:\x203px;\x22>%s:\x20%s</p>',_0x1bab16[_0x3469('0x4c')]?_0x1bab16[_0x3469('0x4c')][_0x3469('0x4a')]:_0x1bab16[_0x3469('0x72')][_0x3469('0x73')],_0x1bab16['body']);_0x264caa+=_0x3469('0x7b');if(_0x1bab16[_0x3469('0x74')]){var _0x2354aa=_0x1bab16[_0x3469('0x74')];var _0x288ba6=path[_0x3469('0x6c')](_0x1fbc4d,_0x2354aa['basename']);if(fs['existsSync'](_0x288ba6)){fs['createReadStream'](_0x288ba6)[_0x3469('0x7c')](fs['createWriteStream'](path['join'](_0x3ea79e,_0x2354aa[_0x3469('0x7d')])));}}}return new BPromise(function(_0x9f31ae,_0x132e21){pdf['create'](_0x264caa,_0x165dff)[_0x3469('0x7e')](path['join'](_0x3ea79e,'interaction-'+_0x91cc58+_0x3469('0x7f')),function(_0x263717,_0x3df746){if(_0x263717)return _0x132e21(_0x263717);_0x9f31ae(_0x3df746);});});}})[_0x3469('0x23')](function(){if(_0x12924e){return new BPromise(function(_0xc41d96,_0x4a58e4){zipdir(_0x3ea79e,{'saveTo':_0x2d994d},function(_0x3277e0,_0x3626c0){if(_0x3277e0)return _0x4a58e4(_0x3277e0);return _0xc41d96(_0x3626c0);});});}})[_0x3469('0x23')](function(){if(_0x12924e){return new BPromise(function(_0x1c7f57,_0x243bd8){rimraf(_0x3ea79e,function(_0x1c4f0a){if(_0x1c4f0a)_0x243bd8(_0x1c4f0a);return _0x1c7f57();});});}})[_0x3469('0x23')](function(){if(_0x12924e){return _0x42f90c[_0x3469('0x80')](_0x2d994d,_0xc27b45,function(_0x2c63f0){if(_0x2c63f0){console[_0x3469('0x81')](_0x3469('0x82'),_0x2c63f0);}else{fs['unlinkSync'](_0x2d994d);}});}else{return _0x42f90c[_0x3469('0x1b')](0xc8);}})[_0x3469('0x54')](handleError(_0x42f90c,null));};
\ No newline at end of file
index 89cc313..70e8387 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6582=['OpenchannelInteraction','setMaxListeners','save','update','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x6582,0xd6));var _0x2658=function(_0x448f50,_0x5587ba){_0x448f50=_0x448f50-0x0;var _0x2af4c3=_0x6582[_0x448f50];return _0x2af4c3;};'use strict';var EventEmitter=require(_0x2658('0x0'));var OpenchannelInteraction=require(_0x2658('0x1'))['db'][_0x2658('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x2658('0x3')](0x0);var events={'afterCreate':_0x2658('0x4'),'afterUpdate':_0x2658('0x5'),'afterDestroy':'remove'};function emitEvent(_0x322d55){return function(_0x22e81f,_0x4b1633,_0x17ffdc){OpenchannelInteractionEvents[_0x2658('0x6')](_0x322d55+':'+_0x22e81f['id'],_0x22e81f);OpenchannelInteractionEvents[_0x2658('0x6')](_0x322d55,_0x22e81f);_0x17ffdc(null);};}for(var e in events){if(events[_0x2658('0x7')](e)){var event=events[e];OpenchannelInteraction[_0x2658('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents;
\ No newline at end of file
+var _0xb1cd=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelInteraction','setMaxListeners','save'];(function(_0x2bc53e,_0x43e108){var _0x55cea3=function(_0x3db686){while(--_0x3db686){_0x2bc53e['push'](_0x2bc53e['shift']());}};_0x55cea3(++_0x43e108);}(_0xb1cd,0x9c));var _0xdb1c=function(_0x50d993,_0x300507){_0x50d993=_0x50d993-0x0;var _0x5483d4=_0xb1cd[_0x50d993];return _0x5483d4;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xdb1c('0x0'))['db'][_0xdb1c('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xdb1c('0x2')](0x0);var events={'afterCreate':_0xdb1c('0x3'),'afterUpdate':_0xdb1c('0x4'),'afterDestroy':_0xdb1c('0x5')};function emitEvent(_0x6842aa){return function(_0x220323,_0x9265c7,_0xbdf566){OpenchannelInteractionEvents[_0xdb1c('0x6')](_0x6842aa+':'+_0x220323['id'],_0x220323);OpenchannelInteractionEvents['emit'](_0x6842aa,_0x220323);_0xbdf566(null);};}for(var e in events){if(events[_0xdb1c('0x7')](e)){var event=events[e];OpenchannelInteraction[_0xdb1c('0x8')](e,emitEvent(event));}}module[_0xdb1c('0x9')]=OpenchannelInteractionEvents;
\ No newline at end of file
index b1bc7c8..96bde57 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4f5c=['util','../../config/logger','api','moment','bluebird','request-promise','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','lodash'];(function(_0x559863,_0x20859d){var _0x458366=function(_0x3ec6a5){while(--_0x3ec6a5){_0x559863['push'](_0x559863['shift']());}};_0x458366(++_0x20859d);}(_0x4f5c,0xef));var _0xc4f5=function(_0xcee2a7,_0x1c7f6e){_0xcee2a7=_0xcee2a7-0x0;var _0x1347fc=_0x4f5c[_0xcee2a7];return _0x1347fc;};'use strict';var _=require(_0xc4f5('0x0'));var util=require(_0xc4f5('0x1'));var logger=require(_0xc4f5('0x2'))(_0xc4f5('0x3'));var moment=require(_0xc4f5('0x4'));var BPromise=require(_0xc4f5('0x5'));var rp=require(_0xc4f5('0x6'));var attributes=require(_0xc4f5('0x7'));module[_0xc4f5('0x8')]=function(_0xaf8d60,_0xa3c280){return _0xaf8d60[_0xc4f5('0x9')](_0xc4f5('0xa'),attributes,{'tableName':_0xc4f5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x3b02=['OpenchannelInteraction','openchannel_interactions','changed','closedAt','format','lodash','util','../../config/logger','api','bluebird','exports','define'];(function(_0x228ac9,_0x42f065){var _0x69fe02=function(_0x210551){while(--_0x210551){_0x228ac9['push'](_0x228ac9['shift']());}};_0x69fe02(++_0x42f065);}(_0x3b02,0xb9));var _0x23b0=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x3b02[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0x23b0('0x0'));var util=require(_0x23b0('0x1'));var logger=require(_0x23b0('0x2'))(_0x23b0('0x3'));var moment=require('moment');var BPromise=require(_0x23b0('0x4'));var rp=require('request-promise');var attributes=require('./openchannelInteraction.attributes');module[_0x23b0('0x5')]=function(_0x8c193b,_0x3f138b){return _0x8c193b[_0x23b0('0x6')](_0x23b0('0x7'),attributes,{'tableName':_0x23b0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x21b902,_0x5c7c47,_0x3b59b4){if(_0x21b902[_0x23b0('0x9')]('closed')){_0x21b902[_0x23b0('0xa')]=moment()[_0x23b0('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3b59b4(null,_0x21b902);}}});};
\ No newline at end of file
index d9e9269..c7011e8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x71ab=['message','OpenchannelInteraction,\x20%s,\x20%s','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','options','raw','where','attributes','limit','debug','AddTagsToOpenchannelInteraction','find','body','omit','spread','AddTags','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','request\x20sent','stringify','error'];(function(_0x297a24,_0x14cffd){var _0x192419=function(_0x54343c){while(--_0x54343c){_0x297a24['push'](_0x297a24['shift']());}};_0x192419(++_0x14cffd);}(_0x71ab,0x64));var _0xb71a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x71ab[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var moment=require('moment');var BPromise=require(_0xb71a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb71a('0x2'));var db=require(_0xb71a('0x3'))['db'];var utils=require(_0xb71a('0x4'));var logger=require(_0xb71a('0x5'))(_0xb71a('0x6'));var config=require(_0xb71a('0x7'));var jayson=require(_0xb71a('0x8'));var client=jayson[_0xb71a('0x9')][_0xb71a('0xa')]({'port':0x232a});config[_0xb71a('0xb')]=_[_0xb71a('0xc')](config[_0xb71a('0xb')],{'host':_0xb71a('0xd'),'port':0x18eb});var socket=require(_0xb71a('0xe'))(new Redis(config[_0xb71a('0xb')]));require(_0xb71a('0xf'))[_0xb71a('0x10')](socket);function respondWithRpcPromise(_0x2e8883,_0x517eed,_0xfec897){return new BPromise(function(_0x58956d,_0x3d7bd7){return client[_0xb71a('0x11')](_0x2e8883,_0xfec897)[_0xb71a('0x12')](function(_0x591311){logger[_0xb71a('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x517eed,_0xb71a('0x14'));logger['debug']('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x517eed,_0xb71a('0x14'),JSON[_0xb71a('0x15')](_0x591311));if(_0x591311[_0xb71a('0x16')]){if(_0x591311[_0xb71a('0x16')]['code']===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x517eed,_0x591311[_0xb71a('0x16')][_0xb71a('0x17')]);return _0x3d7bd7(_0x591311[_0xb71a('0x16')][_0xb71a('0x17')]);}logger[_0xb71a('0x16')](_0xb71a('0x18'),_0x517eed,_0x591311[_0xb71a('0x16')][_0xb71a('0x17')]);return _0x58956d(_0x591311[_0xb71a('0x16')]['message']);}else{logger[_0xb71a('0x13')](_0xb71a('0x18'),_0x517eed,_0xb71a('0x14'));_0x58956d(_0x591311[_0xb71a('0x19')][_0xb71a('0x17')]);}})[_0xb71a('0x1a')](function(_0x349de1){logger[_0xb71a('0x16')](_0xb71a('0x18'),_0x517eed,_0x349de1);_0x3d7bd7(_0x349de1);});});}exports[_0xb71a('0x1b')]=function(_0x16394a){var _0x494899=this;return new Promise(function(_0x5bb77a,_0x1358f2){return db[_0xb71a('0x1c')]['update'](_0x16394a['body'],{'raw':_0x16394a[_0xb71a('0x1d')]?_0x16394a['options'][_0xb71a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16394a[_0xb71a('0x1d')]?_0x16394a[_0xb71a('0x1d')][_0xb71a('0x1f')]||null:null,'attributes':_0x16394a[_0xb71a('0x1d')]?_0x16394a[_0xb71a('0x1d')][_0xb71a('0x20')]||null:null,'limit':_0x16394a[_0xb71a('0x1d')]?_0x16394a['options'][_0xb71a('0x21')]||null:null})[_0xb71a('0x12')](function(_0x353930){logger[_0xb71a('0x13')](_0xb71a('0x1b'),_0x16394a);logger[_0xb71a('0x22')](_0xb71a('0x1b'),_0x16394a,JSON[_0xb71a('0x15')](_0x353930));_0x5bb77a(_0x353930);})[_0xb71a('0x1a')](function(_0x2a847a){logger[_0xb71a('0x16')](_0xb71a('0x1b'),_0x2a847a[_0xb71a('0x17')],_0x16394a);_0x1358f2(_0x494899['error'](0x1f4,_0x2a847a[_0xb71a('0x17')]));});});};exports[_0xb71a('0x23')]=function(_0x1689ce){return new Promise(function(_0x358954,_0x2fbd73){return db[_0xb71a('0x1c')][_0xb71a('0x24')]({'where':_0x1689ce[_0xb71a('0x1d')]?_0x1689ce[_0xb71a('0x1d')][_0xb71a('0x1f')]||null:null})[_0xb71a('0x12')](function(_0x542ffd){if(_0x542ffd){return _0x542ffd['addTags'](_0x1689ce[_0xb71a('0x25')]['ids'],_[_0xb71a('0x26')](_0x1689ce[_0xb71a('0x25')],['ids','id'])||{});}})[_0xb71a('0x27')](function(_0xa42f25){logger[_0xb71a('0x13')](_0xb71a('0x28'),_0x1689ce);logger[_0xb71a('0x22')](_0xb71a('0x28'),_0x1689ce,JSON['stringify'](_0xa42f25));_0x358954(_0xa42f25);})[_0xb71a('0x1a')](function(_0x3f137a){logger[_0xb71a('0x16')](_0xb71a('0x28'),_0x3f137a['message'],_0x1689ce);_0x2fbd73(_this[_0xb71a('0x16')](0x1f4,_0x3f137a[_0xb71a('0x17')]));});});};
\ No newline at end of file
+var _0x7ee1=['jayson/promise','http','redis','socket.io-emitter','./openchannelInteraction.socket','request','then','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','OpenchannelInteraction','update','body','options','raw','where','limit','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','find','omit','ids','AddTags','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x387cde,_0x482cdd){var _0x52fd42=function(_0x1f6e0b){while(--_0x1f6e0b){_0x387cde['push'](_0x387cde['shift']());}};_0x52fd42(++_0x482cdd);}(_0x7ee1,0x8d));var _0x17ee=function(_0x5f0a37,_0x4c0869){_0x5f0a37=_0x5f0a37-0x0;var _0x4a7101=_0x7ee1[_0x5f0a37];return _0x4a7101;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x17ee('0x1'));var fs=require('fs');var Redis=require(_0x17ee('0x2'));var db=require(_0x17ee('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x17ee('0x4'))(_0x17ee('0x5'));var config=require(_0x17ee('0x6'));var jayson=require(_0x17ee('0x7'));var client=jayson['client'][_0x17ee('0x8')]({'port':0x232a});config[_0x17ee('0x9')]=_['defaults'](config[_0x17ee('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x17ee('0xa'))(new Redis(config[_0x17ee('0x9')]));require(_0x17ee('0xb'))['register'](socket);function respondWithRpcPromise(_0x4b6374,_0x4d6bb5,_0x17f935){return new BPromise(function(_0x4ee1e0,_0x155964){return client[_0x17ee('0xc')](_0x4b6374,_0x17f935)[_0x17ee('0xd')](function(_0x3d4f0f){logger['info'](_0x17ee('0xe'),_0x4d6bb5,'request\x20sent');logger[_0x17ee('0xf')](_0x17ee('0x10'),_0x4d6bb5,_0x17ee('0x11'),JSON[_0x17ee('0x12')](_0x3d4f0f));if(_0x3d4f0f[_0x17ee('0x13')]){if(_0x3d4f0f[_0x17ee('0x13')][_0x17ee('0x14')]===0x1f4){logger[_0x17ee('0x13')](_0x17ee('0xe'),_0x4d6bb5,_0x3d4f0f[_0x17ee('0x13')][_0x17ee('0x15')]);return _0x155964(_0x3d4f0f['error']['message']);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x4d6bb5,_0x3d4f0f[_0x17ee('0x13')][_0x17ee('0x15')]);return _0x4ee1e0(_0x3d4f0f[_0x17ee('0x13')][_0x17ee('0x15')]);}else{logger[_0x17ee('0x16')](_0x17ee('0xe'),_0x4d6bb5,_0x17ee('0x11'));_0x4ee1e0(_0x3d4f0f['result'][_0x17ee('0x15')]);}})[_0x17ee('0x17')](function(_0x215bc7){logger[_0x17ee('0x13')](_0x17ee('0xe'),_0x4d6bb5,_0x215bc7);_0x155964(_0x215bc7);});});}exports['UpdateOpenchannelInteraction']=function(_0x393720){var _0x587784=this;return new Promise(function(_0x18e8cd,_0x4bbe10){return db[_0x17ee('0x18')][_0x17ee('0x19')](_0x393720[_0x17ee('0x1a')],{'raw':_0x393720[_0x17ee('0x1b')]?_0x393720[_0x17ee('0x1b')][_0x17ee('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x393720[_0x17ee('0x1b')]?_0x393720[_0x17ee('0x1b')][_0x17ee('0x1d')]||null:null,'attributes':_0x393720[_0x17ee('0x1b')]?_0x393720[_0x17ee('0x1b')]['attributes']||null:null,'limit':_0x393720['options']?_0x393720[_0x17ee('0x1b')][_0x17ee('0x1e')]||null:null})[_0x17ee('0xd')](function(_0x9b379d){logger[_0x17ee('0x16')](_0x17ee('0x1f'),_0x393720);logger[_0x17ee('0xf')](_0x17ee('0x1f'),_0x393720,JSON[_0x17ee('0x12')](_0x9b379d));_0x18e8cd(_0x9b379d);})[_0x17ee('0x17')](function(_0xfcfade){logger[_0x17ee('0x13')]('UpdateOpenchannelInteraction',_0xfcfade[_0x17ee('0x15')],_0x393720);_0x4bbe10(_0x587784[_0x17ee('0x13')](0x1f4,_0xfcfade[_0x17ee('0x15')]));});});};exports[_0x17ee('0x20')]=function(_0x125513){return new Promise(function(_0x51a561,_0x38237c){return db[_0x17ee('0x18')][_0x17ee('0x21')]({'where':_0x125513['options']?_0x125513[_0x17ee('0x1b')][_0x17ee('0x1d')]||null:null})['then'](function(_0x2046fb){if(_0x2046fb){return _0x2046fb['addTags'](_0x125513[_0x17ee('0x1a')]['ids'],_[_0x17ee('0x22')](_0x125513[_0x17ee('0x1a')],[_0x17ee('0x23'),'id'])||{});}})['spread'](function(_0x3e513a){logger[_0x17ee('0x16')]('AddTags',_0x125513);logger[_0x17ee('0xf')](_0x17ee('0x24'),_0x125513,JSON[_0x17ee('0x12')](_0x3e513a));_0x51a561(_0x3e513a);})['catch'](function(_0x4bf36c){logger[_0x17ee('0x13')](_0x17ee('0x24'),_0x4bf36c[_0x17ee('0x15')],_0x125513);_0x38237c(_this[_0x17ee('0x13')](0x1f4,_0x4bf36c['message']));});});};
\ No newline at end of file
index 21dda61..13c6c50 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb4e3=['register','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','removeListener'];(function(_0x152db2,_0x8dc4e4){var _0xd714ec=function(_0x8c0d70){while(--_0x8c0d70){_0x152db2['push'](_0x152db2['shift']());}};_0xd714ec(++_0x8dc4e4);}(_0xb4e3,0x1f2));var _0x3b4e=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0xb4e3[_0x20c9b2];return _0x2c6030;};'use strict';var OpenchannelInteractionEvents=require(_0x3b4e('0x0'));var events=[_0x3b4e('0x1'),_0x3b4e('0x2'),_0x3b4e('0x3')];function createListener(_0x57b34f,_0x14dbb0){return function(_0x4a24e3){_0x14dbb0[_0x3b4e('0x4')](_0x57b34f,_0x4a24e3);};}function removeListener(_0xbd6200,_0x3fe35f){return function(){OpenchannelInteractionEvents[_0x3b4e('0x5')](_0xbd6200,_0x3fe35f);};}exports[_0x3b4e('0x6')]=function(_0x1e1f0c){for(var _0x420b85=0x0,_0x52769d=events['length'];_0x420b85<_0x52769d;_0x420b85++){var _0x43158f=events[_0x420b85];var _0x140e40=createListener(_0x3b4e('0x7')+_0x43158f,_0x1e1f0c);OpenchannelInteractionEvents['on'](_0x43158f,_0x140e40);}};
\ No newline at end of file
+var _0x298c=['register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','removeListener'];(function(_0x239712,_0x370b55){var _0x491d7f=function(_0x54c96a){while(--_0x54c96a){_0x239712['push'](_0x239712['shift']());}};_0x491d7f(++_0x370b55);}(_0x298c,0xc0));var _0xc298=function(_0x160d52,_0x27ed76){_0x160d52=_0x160d52-0x0;var _0x5ebb2e=_0x298c[_0x160d52];return _0x5ebb2e;};'use strict';var OpenchannelInteractionEvents=require(_0xc298('0x0'));var events=[_0xc298('0x1'),_0xc298('0x2'),_0xc298('0x3')];function createListener(_0x2cbe90,_0x3fa3c9){return function(_0x136502){_0x3fa3c9[_0xc298('0x4')](_0x2cbe90,_0x136502);};}function removeListener(_0x39b485,_0x28e3c3){return function(){OpenchannelInteractionEvents[_0xc298('0x5')](_0x39b485,_0x28e3c3);};}exports[_0xc298('0x6')]=function(_0x3d2787){for(var _0x24038a=0x0,_0x5bd7e8=events[_0xc298('0x7')];_0x24038a<_0x5bd7e8;_0x24038a++){var _0x1f56ae=events[_0x24038a];var _0x4f5401=createListener(_0xc298('0x8')+_0x1f56ae,_0x3d2787);OpenchannelInteractionEvents['on'](_0x1f56ae,_0x4f5401);}};
\ No newline at end of file
index 077be55..99a71e4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xed95=['../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','/describe','describe','/:id','tracked','openchannel','openchannelmessage:create','update','put','accept','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x21ca26,_0x200761){var _0x15d313=function(_0xaf0c5c){while(--_0xaf0c5c){_0x21ca26['push'](_0x21ca26['shift']());}};_0x15d313(++_0x200761);}(_0xed95,0xb9));var _0x5ed9=function(_0x3eae06,_0x33fa4e){_0x3eae06=_0x3eae06-0x0;var _0x49b4c1=_0xed95[_0x3eae06];return _0x49b4c1;};'use strict';var multer=require(_0x5ed9('0x0'));var util=require(_0x5ed9('0x1'));var path=require(_0x5ed9('0x2'));var timeout=require(_0x5ed9('0x3'));var express=require(_0x5ed9('0x4'));var router=express[_0x5ed9('0x5')]();var auth=require(_0x5ed9('0x6'));var interaction=require(_0x5ed9('0x7'));var config=require(_0x5ed9('0x8'));var controller=require(_0x5ed9('0x9'));router[_0x5ed9('0xa')]('/',auth[_0x5ed9('0xb')](),controller['index']);router['get'](_0x5ed9('0xc'),auth[_0x5ed9('0xb')](),controller[_0x5ed9('0xd')]);router[_0x5ed9('0xa')](_0x5ed9('0xe'),auth[_0x5ed9('0xb')](),controller['show']);router['post']('/',auth[_0x5ed9('0xb')](),interaction[_0x5ed9('0xf')](_0x5ed9('0x10'),_0x5ed9('0x11')),controller['create']);router['put'](_0x5ed9('0xe'),auth[_0x5ed9('0xb')](),controller[_0x5ed9('0x12')]);router[_0x5ed9('0x13')]('/:id/accept',auth[_0x5ed9('0xb')](),controller[_0x5ed9('0x14')]);router[_0x5ed9('0x13')]('/:id/reject',auth['isAuthenticated'](),controller[_0x5ed9('0x15')]);router[_0x5ed9('0x16')]('/:id',auth[_0x5ed9('0xb')](),controller[_0x5ed9('0x17')]);module['exports']=router;
\ No newline at end of file
+var _0xea1a=['../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','/:id/accept','accept','put','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x4b9a68,_0x1f2175){var _0x3c791a=function(_0x1f82e9){while(--_0x1f82e9){_0x4b9a68['push'](_0x4b9a68['shift']());}};_0x3c791a(++_0x1f2175);}(_0xea1a,0x158));var _0xaea1=function(_0xefa4a8,_0x383833){_0xefa4a8=_0xefa4a8-0x0;var _0xff6ea2=_0xea1a[_0xefa4a8];return _0xff6ea2;};'use strict';var multer=require(_0xaea1('0x0'));var util=require(_0xaea1('0x1'));var path=require(_0xaea1('0x2'));var timeout=require(_0xaea1('0x3'));var express=require('express');var router=express[_0xaea1('0x4')]();var auth=require(_0xaea1('0x5'));var interaction=require(_0xaea1('0x6'));var config=require(_0xaea1('0x7'));var controller=require(_0xaea1('0x8'));router[_0xaea1('0x9')]('/',auth[_0xaea1('0xa')](),controller[_0xaea1('0xb')]);router['get'](_0xaea1('0xc'),auth[_0xaea1('0xa')](),controller[_0xaea1('0xd')]);router['get'](_0xaea1('0xe'),auth['isAuthenticated'](),controller[_0xaea1('0xf')]);router['post']('/',auth[_0xaea1('0xa')](),interaction['tracked']('openchannel','openchannelmessage:create'),controller[_0xaea1('0x10')]);router['put']('/:id',auth[_0xaea1('0xa')](),controller[_0xaea1('0x11')]);router['put'](_0xaea1('0x12'),auth[_0xaea1('0xa')](),controller[_0xaea1('0x13')]);router[_0xaea1('0x14')](_0xaea1('0x15'),auth[_0xaea1('0xa')](),controller[_0xaea1('0x16')]);router['delete'](_0xaea1('0xe'),auth[_0xaea1('0xa')](),controller[_0xaea1('0x17')]);module[_0xaea1('0x18')]=router;
\ No newline at end of file
index 303ed14..9fe6fd4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x224b=['out','DATE','exports','TEXT','BOOLEAN'];(function(_0x1b22bc,_0xe4edc9){var _0x11f4e8=function(_0x3aa000){while(--_0x3aa000){_0x1b22bc['push'](_0x1b22bc['shift']());}};_0x11f4e8(++_0xe4edc9);}(_0x224b,0x8e));var _0xb224=function(_0x38ba9c,_0x1daf18){_0x38ba9c=_0x38ba9c-0x0;var _0x4de41d=_0x224b[_0x38ba9c];return _0x4de41d;};'use strict';var Sequelize=require('sequelize');module[_0xb224('0x0')]={'body':{'type':Sequelize[_0xb224('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xb224('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xb224('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xb224('0x3')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xb224('0x4')]}};
\ No newline at end of file
+var _0x5d41=['sequelize','exports','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x4c3070,_0xc2fb4c){var _0x536a44=function(_0x1412a5){while(--_0x1412a5){_0x4c3070['push'](_0x4c3070['shift']());}};_0x536a44(++_0xc2fb4c);}(_0x5d41,0xcb));var _0x15d4=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x5d41[_0x1a36a5];return _0x746243;};'use strict';var Sequelize=require(_0x15d4('0x0'));module[_0x15d4('0x1')]={'body':{'type':Sequelize[_0x15d4('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x15d4('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x15d4('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x15d4('0x4')]('in','out'),'defaultValue':_0x15d4('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x15d4('0x6')]}};
\ No newline at end of file
index 1e96360..10fe5f2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb3b3=['hasOwnProperty','nolimit','limit','order','sort','where','merge','map','type','key','VIRTUAL','filter','includeAll','include','params','rawAttributes','find','create','body','openchannel-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','openchannel','agent','role','rejectmessage','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','destroy','stack','name','index','OpenchannelMessage','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x96f74c,_0xfc30a4){var _0x379222=function(_0x1bbde9){while(--_0x1bbde9){_0x96f74c['push'](_0x96f74c['shift']());}};_0x379222(++_0xfc30a4);}(_0xb3b3,0x11b));var _0x3b3b=function(_0xc7ca5f,_0x5eb60b){_0xc7ca5f=_0xc7ca5f-0x0;var _0x15bbea=_0xb3b3[_0xc7ca5f];return _0x15bbea;};'use strict';var pdf=require(_0x3b3b('0x0'));var emlformat=require(_0x3b3b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3b3b('0x2'));var rp=require(_0x3b3b('0x3'));var moment=require(_0x3b3b('0x4'));var BPromise=require(_0x3b3b('0x5'));var Mustache=require(_0x3b3b('0x6'));var util=require('util');var path=require(_0x3b3b('0x7'));var sox=require(_0x3b3b('0x8'));var csv=require('to-csv');var ejs=require(_0x3b3b('0x9'));var fs=require('fs');var _=require(_0x3b3b('0xa'));var squel=require(_0x3b3b('0xb'));var crypto=require(_0x3b3b('0xc'));var jsforce=require(_0x3b3b('0xd'));var deskjs=require(_0x3b3b('0xe'));var toCsv=require(_0x3b3b('0xf'));var querystring=require('querystring');var Papa=require(_0x3b3b('0x10'));var authService=require(_0x3b3b('0x11'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0x3b3b('0x12'));var logger=require(_0x3b3b('0x13'))(_0x3b3b('0x14'));var utils=require(_0x3b3b('0x15'));var config=require(_0x3b3b('0x16'));var db=require(_0x3b3b('0x17'))['db'];config[_0x3b3b('0x18')]=_[_0x3b3b('0x19')](config[_0x3b3b('0x18')],{'host':_0x3b3b('0x1a'),'port':0x18eb});var socket=require(_0x3b3b('0x1b'))(new Redis(config[_0x3b3b('0x18')]));require(_0x3b3b('0x1c'))[_0x3b3b('0x1d')](socket);var jayson=require(_0x3b3b('0x1e'));var client=jayson[_0x3b3b('0x1f')][_0x3b3b('0x20')]({'port':0x232c});var client9002=jayson[_0x3b3b('0x1f')][_0x3b3b('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x46a948,_0x144d5f,_0x57a121,_0x436511){return new BPromise(function(_0x2c05b4,_0x4bb252){var _0x1be84b=_0x436511||client;return _0x1be84b[_0x3b3b('0x21')](_0x46a948,_0x57a121)[_0x3b3b('0x22')](function(_0x445914){logger[_0x3b3b('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x144d5f,_0x3b3b('0x24'));logger[_0x3b3b('0x25')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x144d5f,_0x3b3b('0x24'),JSON[_0x3b3b('0x26')](_0x445914));if(_0x445914[_0x3b3b('0x27')]){if(_0x445914[_0x3b3b('0x27')]['code']===0x1f4){logger[_0x3b3b('0x27')](_0x3b3b('0x28'),_0x144d5f,_0x445914['error']['message']);return _0x4bb252(_0x445914[_0x3b3b('0x27')]['message']);}logger[_0x3b3b('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x144d5f,_0x445914['error'][_0x3b3b('0x29')]);return _0x2c05b4(_0x445914[_0x3b3b('0x27')][_0x3b3b('0x29')]);}else{logger['info'](_0x3b3b('0x28'),_0x144d5f,'request\x20sent');_0x2c05b4(_0x445914[_0x3b3b('0x2a')][_0x3b3b('0x29')]);}})[_0x3b3b('0x2b')](function(_0x201dc3){logger[_0x3b3b('0x27')](_0x3b3b('0x28'),_0x144d5f,_0x201dc3);_0x4bb252(_0x201dc3);});});}function respondWithStatusCode(_0xc4d036,_0x56949a){_0x56949a=_0x56949a||0xcc;return function(_0x2c84b4){if(_0x2c84b4){return _0xc4d036[_0x3b3b('0x2c')](_0x56949a);}return _0xc4d036[_0x3b3b('0x2d')](_0x56949a)[_0x3b3b('0x2e')]();};}function respondWithResult(_0x2d4b8a,_0x2d9b72){_0x2d9b72=_0x2d9b72||0xc8;return function(_0x2ea225){if(_0x2ea225){return _0x2d4b8a[_0x3b3b('0x2d')](_0x2d9b72)[_0x3b3b('0x2f')](_0x2ea225);}};}function respondWithFilteredResult(_0x3d7862,_0xf8122e){return function(_0x539d5d){if(_0x539d5d){var _0x283ec7=_0x539d5d[_0x3b3b('0x30')],_0x21f9ed=_0xf8122e[_0x3b3b('0x31')],_0x14b997=_0xf8122e['offset']+_0xf8122e['limit'],_0x4846c5;if(_0x14b997>=_0x283ec7){_0x14b997=_0x283ec7;_0x4846c5=0xc8;}else{_0x4846c5=0xce;}_0x3d7862[_0x3b3b('0x2d')](_0x4846c5);return _0x3d7862['set'](_0x3b3b('0x32'),_0x21f9ed+'-'+_0x14b997+'/'+_0x283ec7)[_0x3b3b('0x2f')](_0x539d5d);}return null;};}function patchUpdates(_0x4cef7f){return function(_0x208ce2){try{jsonpatch[_0x3b3b('0x33')](_0x208ce2,_0x4cef7f,!![]);}catch(_0x4702dd){return BPromise[_0x3b3b('0x34')](_0x4702dd);}return _0x208ce2[_0x3b3b('0x35')]();};}function saveUpdates(_0x59b827,_0xf5feba){return function(_0x2ee343){if(_0x2ee343){return _0x2ee343[_0x3b3b('0x36')](_0x59b827)['then'](function(_0x57bb44){return _0x57bb44;});}return null;};}function removeEntity(_0x119006,_0x350902){return function(_0x58cfdf){if(_0x58cfdf){return _0x58cfdf[_0x3b3b('0x37')]()['then'](function(){_0x119006[_0x3b3b('0x2d')](0xcc)[_0x3b3b('0x2e')]();});}};}function handleEntityNotFound(_0x3b4ae9,_0x3de745){return function(_0x1f7df1){if(!_0x1f7df1){_0x3b4ae9['sendStatus'](0x194);}return _0x1f7df1;};}function handleError(_0x1d6af5,_0x3b8c91){_0x3b8c91=_0x3b8c91||0x1f4;return function(_0x1b8b5e){logger[_0x3b3b('0x27')](_0x1b8b5e[_0x3b3b('0x38')]);if(_0x1b8b5e[_0x3b3b('0x39')]){delete _0x1b8b5e[_0x3b3b('0x39')];}_0x1d6af5['status'](_0x3b8c91)['send'](_0x1b8b5e);};}exports[_0x3b3b('0x3a')]=function(_0x511a7c,_0x3358c3){var _0x488e9e={},_0x16df55={},_0x2f2a31={'count':0x0,'rows':[]};var _0x3ead3a=db[_0x3b3b('0x3b')]['rawAttributes'];_0x16df55[_0x3b3b('0x3c')]=_[_0x3b3b('0x3d')](_0x3ead3a);_0x16df55[_0x3b3b('0x3e')]=_[_0x3b3b('0x3d')](_0x511a7c[_0x3b3b('0x3e')]);_0x16df55[_0x3b3b('0x3f')]=_[_0x3b3b('0x40')](_0x16df55['model'],_0x16df55[_0x3b3b('0x3e')]);_0x488e9e[_0x3b3b('0x41')]=_[_0x3b3b('0x40')](_0x16df55['model'],qs['fields'](_0x511a7c[_0x3b3b('0x3e')][_0x3b3b('0x42')]));_0x488e9e[_0x3b3b('0x41')]=_0x488e9e['attributes'][_0x3b3b('0x43')]?_0x488e9e[_0x3b3b('0x41')]:_0x16df55[_0x3b3b('0x3c')];if(!_0x511a7c[_0x3b3b('0x3e')][_0x3b3b('0x44')](_0x3b3b('0x45'))){_0x488e9e[_0x3b3b('0x46')]=qs['limit'](_0x511a7c[_0x3b3b('0x3e')][_0x3b3b('0x46')]);_0x488e9e[_0x3b3b('0x31')]=qs[_0x3b3b('0x31')](_0x511a7c[_0x3b3b('0x3e')][_0x3b3b('0x31')]);}_0x488e9e[_0x3b3b('0x47')]=qs[_0x3b3b('0x48')](_0x511a7c[_0x3b3b('0x3e')][_0x3b3b('0x48')]);_0x488e9e[_0x3b3b('0x49')]=qs['filters'](_['pick'](_0x511a7c[_0x3b3b('0x3e')],_0x16df55[_0x3b3b('0x3f')]));if(_0x511a7c[_0x3b3b('0x3e')]['filter']){_0x488e9e[_0x3b3b('0x49')]=_[_0x3b3b('0x4a')](_0x488e9e[_0x3b3b('0x49')],{'$or':_[_0x3b3b('0x4b')](_0x3ead3a,function(_0x251442){if(_0x251442[_0x3b3b('0x4c')][_0x3b3b('0x4d')]!==_0x3b3b('0x4e')){var _0x2aabd8={};_0x2aabd8[_0x251442['field']]={'$like':'%'+_0x511a7c[_0x3b3b('0x3e')][_0x3b3b('0x4f')]+'%'};return _0x2aabd8;}})});}_0x488e9e=_[_0x3b3b('0x4a')]({},_0x488e9e,_0x511a7c['options']);var _0x463425={'where':_0x488e9e['where']};return db[_0x3b3b('0x3b')][_0x3b3b('0x30')](_0x463425)[_0x3b3b('0x22')](function(_0x22e059){_0x2f2a31['count']=_0x22e059;if(_0x511a7c['query'][_0x3b3b('0x50')]){_0x488e9e[_0x3b3b('0x51')]=[{'all':!![]}];}return db[_0x3b3b('0x3b')]['findAll'](_0x488e9e);})[_0x3b3b('0x22')](function(_0x1f1f2f){_0x2f2a31['rows']=_0x1f1f2f;return _0x2f2a31;})[_0x3b3b('0x22')](respondWithFilteredResult(_0x3358c3,_0x488e9e))[_0x3b3b('0x2b')](handleError(_0x3358c3,null));};exports['show']=function(_0x1ea701,_0x139328){var _0x15d466={'raw':!![],'where':{'id':_0x1ea701[_0x3b3b('0x52')]['id']}},_0x72e7f9={};_0x72e7f9['model']=_['keys'](db[_0x3b3b('0x3b')][_0x3b3b('0x53')]);_0x72e7f9['query']=_[_0x3b3b('0x3d')](_0x1ea701[_0x3b3b('0x3e')]);_0x72e7f9[_0x3b3b('0x3f')]=_[_0x3b3b('0x40')](_0x72e7f9['model'],_0x72e7f9[_0x3b3b('0x3e')]);_0x15d466[_0x3b3b('0x41')]=_[_0x3b3b('0x40')](_0x72e7f9['model'],qs[_0x3b3b('0x42')](_0x1ea701['query'][_0x3b3b('0x42')]));_0x15d466[_0x3b3b('0x41')]=_0x15d466['attributes'][_0x3b3b('0x43')]?_0x15d466[_0x3b3b('0x41')]:_0x72e7f9[_0x3b3b('0x3c')];if(_0x1ea701[_0x3b3b('0x3e')][_0x3b3b('0x50')]){_0x15d466[_0x3b3b('0x51')]=[{'all':!![]}];}_0x15d466=_['merge']({},_0x15d466,_0x1ea701['options']);return db['OpenchannelMessage'][_0x3b3b('0x54')](_0x15d466)[_0x3b3b('0x22')](handleEntityNotFound(_0x139328,null))[_0x3b3b('0x22')](respondWithResult(_0x139328,null))['catch'](handleError(_0x139328,null));};exports[_0x3b3b('0x55')]=function(_0x57fefb,_0x16cd81){return db[_0x3b3b('0x3b')][_0x3b3b('0x55')](_0x57fefb[_0x3b3b('0x56')],{})[_0x3b3b('0x22')](respondWithResult(_0x16cd81,0xc9))[_0x3b3b('0x2b')](handleError(_0x16cd81,null));};exports[_0x3b3b('0x36')]=function(_0x33e523,_0x15c2c6){if(_0x33e523[_0x3b3b('0x56')]['id']){delete _0x33e523[_0x3b3b('0x56')]['id'];}return db[_0x3b3b('0x3b')]['find']({'where':{'id':_0x33e523[_0x3b3b('0x52')]['id']}})[_0x3b3b('0x22')](handleEntityNotFound(_0x15c2c6,null))['then'](saveUpdates(_0x33e523[_0x3b3b('0x56')],null))['then'](respondWithResult(_0x15c2c6,null))['catch'](handleError(_0x15c2c6,null));};exports[_0x3b3b('0x37')]=function(_0x2f8100,_0x448181){return db[_0x3b3b('0x3b')]['find']({'where':{'id':_0x2f8100['params']['id']}})[_0x3b3b('0x22')](handleEntityNotFound(_0x448181,null))['then'](removeEntity(_0x448181,null))['catch'](handleError(_0x448181,null));};exports['describe']=function(_0x1ef00c,_0x3fa505){return db[_0x3b3b('0x3b')]['describe']()[_0x3b3b('0x22')](respondWithResult(_0x3fa505,null))['catch'](handleError(_0x3fa505,null));};var interaction_log=require(_0x3b3b('0x13'))(_0x3b3b('0x57'));exports['accept']=function(_0x8a4510,_0x247976,_0x483e84){var _0x16010e={'channel':'openchannel'};if(_0x8a4510['body']['id']){delete _0x8a4510[_0x3b3b('0x56')]['id'];}_0x8a4510[_0x3b3b('0x56')][_0x3b3b('0x58')]=!![];_0x8a4510['body'][_0x3b3b('0x59')]=moment()[_0x3b3b('0x5a')](_0x3b3b('0x5b'));_0x8a4510[_0x3b3b('0x56')]['UserId']=_0x8a4510[_0x3b3b('0x56')][_0x3b3b('0x5c')]||_0x8a4510['user']['id'];return db['OpenchannelMessage'][_0x3b3b('0x54')]({'where':{'id':_0x8a4510['params']['id'],'UserId':null},'include':[{'model':db[_0x3b3b('0x5d')],'as':_0x3b3b('0x5e')}]})[_0x3b3b('0x22')](handleEntityNotFound(_0x247976,null))[_0x3b3b('0x22')](saveUpdates(_0x8a4510[_0x3b3b('0x56')],null))[_0x3b3b('0x22')](function(_0x1605c4){if(_0x1605c4){_0x16010e['message']=_0x1605c4[_0x3b3b('0x5f')]({'plain':!![]});return db[_0x3b3b('0x60')][_0x3b3b('0x54')]({'where':{'id':_0x1605c4[_0x3b3b('0x61')]}});}return null;})[_0x3b3b('0x22')](handleEntityNotFound(_0x247976,null))[_0x3b3b('0x22')](function(_0x1ffe0b){if(_0x1ffe0b){return _0x1ffe0b[_0x3b3b('0x36')]({'UserId':_0x8a4510[_0x3b3b('0x56')][_0x3b3b('0x5c')],'read1stAt':_['isNil'](_0x1ffe0b[_0x3b3b('0x62')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x3b3b('0x22')](function(_0x412cd9){if(_0x412cd9){_0x16010e[_0x3b3b('0x63')]=_0x412cd9[_0x3b3b('0x5f')]({'plain':!![]});interaction_log[_0x3b3b('0x23')](_0x3b3b('0x64'),_0x8a4510[_0x3b3b('0x65')]['id'],_0x8a4510[_0x3b3b('0x65')][_0x3b3b('0x39')],_0x8a4510[_0x3b3b('0x65')]['role'],_0x16010e[_0x3b3b('0x63')]['id'],_0x8a4510[_0x3b3b('0x56')]?JSON['stringify'](_0x8a4510[_0x3b3b('0x56')]):_0x3b3b('0x66'));return respondWithRpcPromise(_0x3b3b('0x67'),_0x3b3b('0x68'),_0x16010e);}return null;})[_0x3b3b('0x22')](function(_0x4fe5eb){if(_0x4fe5eb){if(_0x8a4510[_0x3b3b('0x56')][_0x3b3b('0x69')]){_0x16010e[_0x3b3b('0x29')][_0x3b3b('0x6a')]=util[_0x3b3b('0x5a')](_0x3b3b('0x6b'),_0x8a4510[_0x3b3b('0x65')]['name']);_0x16010e['message'][_0x3b3b('0x6c')]=_0x16010e[_0x3b3b('0x6c')];_0x16010e[_0x3b3b('0x29')][_0x3b3b('0x6d')]=_0x3b3b('0x6e');return respondWithRpcPromise(_0x3b3b('0x6f'),_0x3b3b('0x6f'),{'event':_0x3b3b('0x70'),'message':_0x16010e[_0x3b3b('0x29')]},client9002)['then'](function(){return _0x16010e;});}return _0x16010e;}return null;})['then'](respondWithResult(_0x247976,null))[_0x3b3b('0x2b')](handleError(_0x247976,null));};var interaction_log=require(_0x3b3b('0x13'))('openchannel-interactions');exports[_0x3b3b('0x34')]=function(_0x52c8e8,_0x4e9caf,_0x1d9231){var _0x3f4026={'agent':{},'channel':_0x3b3b('0x71')};if(_0x52c8e8[_0x3b3b('0x56')]['id']){delete _0x52c8e8[_0x3b3b('0x56')]['id'];}_0x52c8e8[_0x3b3b('0x56')][_0x3b3b('0x5c')]=_0x52c8e8[_0x3b3b('0x56')]['UserId']||_0x52c8e8[_0x3b3b('0x65')]['id'];_0x3f4026[_0x3b3b('0x72')]['id']=_0x52c8e8[_0x3b3b('0x56')]['UserId'];return db['OpenchannelMessage'][_0x3b3b('0x54')]({'where':{'id':_0x52c8e8[_0x3b3b('0x52')]['id'],'UserId':null}})[_0x3b3b('0x22')](handleEntityNotFound(_0x4e9caf,null))[_0x3b3b('0x22')](function(_0xcbf506){if(_0xcbf506){_0x3f4026[_0x3b3b('0x29')]=_0xcbf506[_0x3b3b('0x5f')]({'plain':!![]});return db[_0x3b3b('0x60')]['find']({'where':{'id':_0xcbf506[_0x3b3b('0x61')]}});}return null;})[_0x3b3b('0x22')](handleEntityNotFound(_0x4e9caf,null))[_0x3b3b('0x22')](function(_0x447ef5){if(_0x447ef5){_0x3f4026[_0x3b3b('0x63')]=_0x447ef5[_0x3b3b('0x5f')]({'plain':!![]});interaction_log[_0x3b3b('0x23')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x52c8e8[_0x3b3b('0x65')]['id'],_0x52c8e8[_0x3b3b('0x65')][_0x3b3b('0x39')],_0x52c8e8[_0x3b3b('0x65')][_0x3b3b('0x73')],_0x3f4026[_0x3b3b('0x63')]['id'],_0x52c8e8[_0x3b3b('0x56')]?JSON[_0x3b3b('0x26')](_0x52c8e8['body']):_0x3b3b('0x66'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x3f4026);}return null;})[_0x3b3b('0x22')](function(_0x36ee95){if(_0x36ee95){_0x36ee95[_0x3b3b('0x29')][_0x3b3b('0x6a')]=util['format'](_0x3b3b('0x6b'),_0x52c8e8['user'][_0x3b3b('0x39')]);_0x36ee95[_0x3b3b('0x29')][_0x3b3b('0x6c')]=_0x3f4026[_0x3b3b('0x6c')];_0x36ee95[_0x3b3b('0x29')][_0x3b3b('0x6d')]=_0x3b3b('0x34');respondWithRpcPromise(_0x3b3b('0x6f'),'EventManager',{'event':_0x3b3b('0x74'),'message':_0x36ee95[_0x3b3b('0x29')]},client9002);return _0x3f4026;}return null;})[_0x3b3b('0x22')](respondWithResult(_0x4e9caf,null))['catch'](handleError(_0x4e9caf,null));};
\ No newline at end of file
+var _0x0710=['api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','OpenchannelMessage','rawAttributes','keys','query','filters','intersection','model','fields','attributes','length','limit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','include','rows','show','params','includeAll','find','create','body','describe','openchannel-interactions','accept','read','format','UserId','user','CmContact','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','acceptMessage','manual','SIP/%s','channel','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','event','rejectmessage','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0710,0x1cf));var _0x0071=function(_0x224a6b,_0x3e57fb){_0x224a6b=_0x224a6b-0x0;var _0x50e049=_0x0710[_0x224a6b];return _0x50e049;};'use strict';var pdf=require(_0x0071('0x0'));var emlformat=require(_0x0071('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0071('0x2'));var jsonpatch=require(_0x0071('0x3'));var rp=require(_0x0071('0x4'));var moment=require(_0x0071('0x5'));var BPromise=require(_0x0071('0x6'));var Mustache=require('mustache');var util=require(_0x0071('0x7'));var path=require(_0x0071('0x8'));var sox=require(_0x0071('0x9'));var csv=require(_0x0071('0xa'));var ejs=require(_0x0071('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0071('0xc'));var crypto=require(_0x0071('0xd'));var jsforce=require(_0x0071('0xe'));var deskjs=require(_0x0071('0xf'));var toCsv=require(_0x0071('0xa'));var querystring=require('querystring');var Papa=require(_0x0071('0x10'));var authService=require(_0x0071('0x11'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x0071('0x12'));var qs=require(_0x0071('0x13'));var logger=require(_0x0071('0x14'))(_0x0071('0x15'));var utils=require(_0x0071('0x16'));var config=require(_0x0071('0x17'));var db=require(_0x0071('0x18'))['db'];config[_0x0071('0x19')]=_[_0x0071('0x1a')](config[_0x0071('0x19')],{'host':_0x0071('0x1b'),'port':0x18eb});var socket=require(_0x0071('0x1c'))(new Redis(config['redis']));require(_0x0071('0x1d'))['register'](socket);var jayson=require(_0x0071('0x1e'));var client=jayson[_0x0071('0x1f')][_0x0071('0x20')]({'port':0x232c});var client9002=jayson[_0x0071('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9a75cb,_0x38f7e7,_0x3b1373,_0x51cfdc){return new BPromise(function(_0x43f6de,_0x292d2f){var _0x347e5b=_0x51cfdc||client;return _0x347e5b[_0x0071('0x21')](_0x9a75cb,_0x3b1373)[_0x0071('0x22')](function(_0x16f5d0){logger[_0x0071('0x23')](_0x0071('0x24'),_0x38f7e7,_0x0071('0x25'));logger[_0x0071('0x26')](_0x0071('0x27'),_0x38f7e7,_0x0071('0x25'),JSON[_0x0071('0x28')](_0x16f5d0));if(_0x16f5d0[_0x0071('0x29')]){if(_0x16f5d0[_0x0071('0x29')]['code']===0x1f4){logger['error'](_0x0071('0x24'),_0x38f7e7,_0x16f5d0[_0x0071('0x29')]['message']);return _0x292d2f(_0x16f5d0[_0x0071('0x29')][_0x0071('0x2a')]);}logger[_0x0071('0x29')](_0x0071('0x24'),_0x38f7e7,_0x16f5d0[_0x0071('0x29')][_0x0071('0x2a')]);return _0x43f6de(_0x16f5d0[_0x0071('0x29')][_0x0071('0x2a')]);}else{logger[_0x0071('0x23')](_0x0071('0x24'),_0x38f7e7,_0x0071('0x25'));_0x43f6de(_0x16f5d0[_0x0071('0x2b')][_0x0071('0x2a')]);}})[_0x0071('0x2c')](function(_0x27986e){logger[_0x0071('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x38f7e7,_0x27986e);_0x292d2f(_0x27986e);});});}function respondWithStatusCode(_0x2e2d79,_0x14c4ca){_0x14c4ca=_0x14c4ca||0xcc;return function(_0x5533e1){if(_0x5533e1){return _0x2e2d79[_0x0071('0x2d')](_0x14c4ca);}return _0x2e2d79[_0x0071('0x2e')](_0x14c4ca)[_0x0071('0x2f')]();};}function respondWithResult(_0x75193f,_0xb296b3){_0xb296b3=_0xb296b3||0xc8;return function(_0xf13c8f){if(_0xf13c8f){return _0x75193f[_0x0071('0x2e')](_0xb296b3)[_0x0071('0x30')](_0xf13c8f);}};}function respondWithFilteredResult(_0x570161,_0x1d0228){return function(_0x38817c){if(_0x38817c){var _0xbfac86=_0x38817c[_0x0071('0x31')],_0x68e4a8=_0x1d0228[_0x0071('0x32')],_0x1bfe44=_0x1d0228[_0x0071('0x32')]+_0x1d0228['limit'],_0x18a386;if(_0x1bfe44>=_0xbfac86){_0x1bfe44=_0xbfac86;_0x18a386=0xc8;}else{_0x18a386=0xce;}_0x570161[_0x0071('0x2e')](_0x18a386);return _0x570161[_0x0071('0x33')](_0x0071('0x34'),_0x68e4a8+'-'+_0x1bfe44+'/'+_0xbfac86)[_0x0071('0x30')](_0x38817c);}return null;};}function patchUpdates(_0x142539){return function(_0x32dc6a){try{jsonpatch[_0x0071('0x35')](_0x32dc6a,_0x142539,!![]);}catch(_0x3f2fa5){return BPromise[_0x0071('0x36')](_0x3f2fa5);}return _0x32dc6a[_0x0071('0x37')]();};}function saveUpdates(_0x5a9649,_0x5ececd){return function(_0x4a20b3){if(_0x4a20b3){return _0x4a20b3[_0x0071('0x38')](_0x5a9649)[_0x0071('0x22')](function(_0x466386){return _0x466386;});}return null;};}function removeEntity(_0x13138d,_0x41798c){return function(_0xa6830d){if(_0xa6830d){return _0xa6830d[_0x0071('0x39')]()[_0x0071('0x22')](function(){_0x13138d[_0x0071('0x2e')](0xcc)[_0x0071('0x2f')]();});}};}function handleEntityNotFound(_0x396bf5,_0x499022){return function(_0x1138ee){if(!_0x1138ee){_0x396bf5[_0x0071('0x2d')](0x194);}return _0x1138ee;};}function handleError(_0x35f4a7,_0x274b77){_0x274b77=_0x274b77||0x1f4;return function(_0x54c378){logger[_0x0071('0x29')](_0x54c378[_0x0071('0x3a')]);if(_0x54c378[_0x0071('0x3b')]){delete _0x54c378[_0x0071('0x3b')];}_0x35f4a7['status'](_0x274b77)['send'](_0x54c378);};}exports[_0x0071('0x3c')]=function(_0xf58a49,_0x5ed3aa){var _0x17cc7b={},_0xdc7706={},_0x1510a4={'count':0x0,'rows':[]};var _0xb648e1=db[_0x0071('0x3d')][_0x0071('0x3e')];_0xdc7706['model']=_['keys'](_0xb648e1);_0xdc7706['query']=_[_0x0071('0x3f')](_0xf58a49[_0x0071('0x40')]);_0xdc7706[_0x0071('0x41')]=_[_0x0071('0x42')](_0xdc7706['model'],_0xdc7706[_0x0071('0x40')]);_0x17cc7b['attributes']=_['intersection'](_0xdc7706[_0x0071('0x43')],qs[_0x0071('0x44')](_0xf58a49['query'][_0x0071('0x44')]));_0x17cc7b[_0x0071('0x45')]=_0x17cc7b['attributes'][_0x0071('0x46')]?_0x17cc7b[_0x0071('0x45')]:_0xdc7706[_0x0071('0x43')];if(!_0xf58a49['query']['hasOwnProperty']('nolimit')){_0x17cc7b[_0x0071('0x47')]=qs[_0x0071('0x47')](_0xf58a49['query']['limit']);_0x17cc7b[_0x0071('0x32')]=qs[_0x0071('0x32')](_0xf58a49[_0x0071('0x40')][_0x0071('0x32')]);}_0x17cc7b[_0x0071('0x48')]=qs[_0x0071('0x49')](_0xf58a49['query']['sort']);_0x17cc7b[_0x0071('0x4a')]=qs[_0x0071('0x41')](_[_0x0071('0x4b')](_0xf58a49[_0x0071('0x40')],_0xdc7706['filters']));if(_0xf58a49[_0x0071('0x40')][_0x0071('0x4c')]){_0x17cc7b[_0x0071('0x4a')]=_[_0x0071('0x4d')](_0x17cc7b[_0x0071('0x4a')],{'$or':_[_0x0071('0x4e')](_0xb648e1,function(_0x4e1956){if(_0x4e1956[_0x0071('0x4f')][_0x0071('0x50')]!==_0x0071('0x51')){var _0x5af5b0={};_0x5af5b0[_0x4e1956[_0x0071('0x52')]]={'$like':'%'+_0xf58a49['query'][_0x0071('0x4c')]+'%'};return _0x5af5b0;}})});}_0x17cc7b=_[_0x0071('0x4d')]({},_0x17cc7b,_0xf58a49[_0x0071('0x53')]);var _0x1c046f={'where':_0x17cc7b[_0x0071('0x4a')]};return db[_0x0071('0x3d')][_0x0071('0x31')](_0x1c046f)[_0x0071('0x22')](function(_0x39e82e){_0x1510a4[_0x0071('0x31')]=_0x39e82e;if(_0xf58a49[_0x0071('0x40')]['includeAll']){_0x17cc7b[_0x0071('0x54')]=[{'all':!![]}];}return db[_0x0071('0x3d')]['findAll'](_0x17cc7b);})[_0x0071('0x22')](function(_0xd3f4b4){_0x1510a4[_0x0071('0x55')]=_0xd3f4b4;return _0x1510a4;})['then'](respondWithFilteredResult(_0x5ed3aa,_0x17cc7b))[_0x0071('0x2c')](handleError(_0x5ed3aa,null));};exports[_0x0071('0x56')]=function(_0x5e64b3,_0x57af85){var _0x4be6f3={'raw':!![],'where':{'id':_0x5e64b3[_0x0071('0x57')]['id']}},_0x138a0e={};_0x138a0e[_0x0071('0x43')]=_[_0x0071('0x3f')](db[_0x0071('0x3d')][_0x0071('0x3e')]);_0x138a0e[_0x0071('0x40')]=_['keys'](_0x5e64b3[_0x0071('0x40')]);_0x138a0e[_0x0071('0x41')]=_[_0x0071('0x42')](_0x138a0e[_0x0071('0x43')],_0x138a0e[_0x0071('0x40')]);_0x4be6f3[_0x0071('0x45')]=_[_0x0071('0x42')](_0x138a0e[_0x0071('0x43')],qs[_0x0071('0x44')](_0x5e64b3[_0x0071('0x40')][_0x0071('0x44')]));_0x4be6f3[_0x0071('0x45')]=_0x4be6f3[_0x0071('0x45')][_0x0071('0x46')]?_0x4be6f3[_0x0071('0x45')]:_0x138a0e[_0x0071('0x43')];if(_0x5e64b3[_0x0071('0x40')][_0x0071('0x58')]){_0x4be6f3[_0x0071('0x54')]=[{'all':!![]}];}_0x4be6f3=_['merge']({},_0x4be6f3,_0x5e64b3['options']);return db[_0x0071('0x3d')][_0x0071('0x59')](_0x4be6f3)[_0x0071('0x22')](handleEntityNotFound(_0x57af85,null))[_0x0071('0x22')](respondWithResult(_0x57af85,null))[_0x0071('0x2c')](handleError(_0x57af85,null));};exports[_0x0071('0x5a')]=function(_0x54ed86,_0x2fa6e0){return db[_0x0071('0x3d')][_0x0071('0x5a')](_0x54ed86[_0x0071('0x5b')],{})['then'](respondWithResult(_0x2fa6e0,0xc9))[_0x0071('0x2c')](handleError(_0x2fa6e0,null));};exports[_0x0071('0x38')]=function(_0x61479c,_0x79c7e3){if(_0x61479c['body']['id']){delete _0x61479c[_0x0071('0x5b')]['id'];}return db[_0x0071('0x3d')][_0x0071('0x59')]({'where':{'id':_0x61479c[_0x0071('0x57')]['id']}})['then'](handleEntityNotFound(_0x79c7e3,null))['then'](saveUpdates(_0x61479c['body'],null))[_0x0071('0x22')](respondWithResult(_0x79c7e3,null))[_0x0071('0x2c')](handleError(_0x79c7e3,null));};exports[_0x0071('0x39')]=function(_0x565454,_0x1dc207){return db['OpenchannelMessage'][_0x0071('0x59')]({'where':{'id':_0x565454[_0x0071('0x57')]['id']}})[_0x0071('0x22')](handleEntityNotFound(_0x1dc207,null))['then'](removeEntity(_0x1dc207,null))['catch'](handleError(_0x1dc207,null));};exports[_0x0071('0x5c')]=function(_0x3750ae,_0x25eee1){return db[_0x0071('0x3d')][_0x0071('0x5c')]()[_0x0071('0x22')](respondWithResult(_0x25eee1,null))[_0x0071('0x2c')](handleError(_0x25eee1,null));};var interaction_log=require(_0x0071('0x14'))(_0x0071('0x5d'));exports[_0x0071('0x5e')]=function(_0x223a80,_0xcd5060,_0x398710){var _0x54dffa={'channel':'openchannel'};if(_0x223a80[_0x0071('0x5b')]['id']){delete _0x223a80['body']['id'];}_0x223a80['body'][_0x0071('0x5f')]=!![];_0x223a80[_0x0071('0x5b')]['readAt']=moment()[_0x0071('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x223a80[_0x0071('0x5b')][_0x0071('0x61')]=_0x223a80[_0x0071('0x5b')][_0x0071('0x61')]||_0x223a80[_0x0071('0x62')]['id'];return db[_0x0071('0x3d')][_0x0071('0x59')]({'where':{'id':_0x223a80[_0x0071('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x0071('0x63')],'as':_0x0071('0x64')}]})['then'](handleEntityNotFound(_0xcd5060,null))['then'](saveUpdates(_0x223a80[_0x0071('0x5b')],null))[_0x0071('0x22')](function(_0x34bfa1){if(_0x34bfa1){_0x54dffa['message']=_0x34bfa1[_0x0071('0x65')]({'plain':!![]});return db[_0x0071('0x66')][_0x0071('0x59')]({'where':{'id':_0x34bfa1[_0x0071('0x67')]}});}return null;})[_0x0071('0x22')](handleEntityNotFound(_0xcd5060,null))[_0x0071('0x22')](function(_0x13711d){if(_0x13711d){return _0x13711d[_0x0071('0x38')]({'UserId':_0x223a80[_0x0071('0x5b')][_0x0071('0x61')],'read1stAt':_[_0x0071('0x68')](_0x13711d[_0x0071('0x69')])?moment()[_0x0071('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x545eba){if(_0x545eba){_0x54dffa[_0x0071('0x6a')]=_0x545eba[_0x0071('0x65')]({'plain':!![]});interaction_log[_0x0071('0x23')](_0x0071('0x6b'),_0x223a80['user']['id'],_0x223a80[_0x0071('0x62')][_0x0071('0x3b')],_0x223a80[_0x0071('0x62')]['role'],_0x54dffa[_0x0071('0x6a')]['id'],_0x223a80[_0x0071('0x5b')]?JSON[_0x0071('0x28')](_0x223a80[_0x0071('0x5b')]):'null');return respondWithRpcPromise('AcceptMessage',_0x0071('0x6c'),_0x54dffa);}return null;})[_0x0071('0x22')](function(_0x1791b0){if(_0x1791b0){if(_0x223a80[_0x0071('0x5b')][_0x0071('0x6d')]){_0x54dffa['message']['interface']=util[_0x0071('0x60')](_0x0071('0x6e'),_0x223a80[_0x0071('0x62')]['name']);_0x54dffa['message'][_0x0071('0x6f')]=_0x54dffa[_0x0071('0x6f')];_0x54dffa['message']['event']=_0x0071('0x5e');return respondWithRpcPromise(_0x0071('0x70'),_0x0071('0x70'),{'event':_0x0071('0x71'),'message':_0x54dffa[_0x0071('0x2a')]},client9002)[_0x0071('0x22')](function(){return _0x54dffa;});}return _0x54dffa;}return null;})[_0x0071('0x22')](respondWithResult(_0xcd5060,null))['catch'](handleError(_0xcd5060,null));};var interaction_log=require(_0x0071('0x14'))('openchannel-interactions');exports['reject']=function(_0x491399,_0x3ccf26,_0x5df36c){var _0x334418={'agent':{},'channel':'openchannel'};if(_0x491399[_0x0071('0x5b')]['id']){delete _0x491399[_0x0071('0x5b')]['id'];}_0x491399[_0x0071('0x5b')][_0x0071('0x61')]=_0x491399[_0x0071('0x5b')][_0x0071('0x61')]||_0x491399[_0x0071('0x62')]['id'];_0x334418['agent']['id']=_0x491399[_0x0071('0x5b')]['UserId'];return db[_0x0071('0x3d')][_0x0071('0x59')]({'where':{'id':_0x491399[_0x0071('0x57')]['id'],'UserId':null}})[_0x0071('0x22')](handleEntityNotFound(_0x3ccf26,null))[_0x0071('0x22')](function(_0x41a7ba){if(_0x41a7ba){_0x334418[_0x0071('0x2a')]=_0x41a7ba[_0x0071('0x65')]({'plain':!![]});return db[_0x0071('0x66')]['find']({'where':{'id':_0x41a7ba[_0x0071('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x3ccf26,null))[_0x0071('0x22')](function(_0x25631d){if(_0x25631d){_0x334418[_0x0071('0x6a')]=_0x25631d[_0x0071('0x65')]({'plain':!![]});interaction_log[_0x0071('0x23')](_0x0071('0x72'),_0x491399[_0x0071('0x62')]['id'],_0x491399[_0x0071('0x62')][_0x0071('0x3b')],_0x491399[_0x0071('0x62')][_0x0071('0x73')],_0x334418[_0x0071('0x6a')]['id'],_0x491399[_0x0071('0x5b')]?JSON[_0x0071('0x28')](_0x491399['body']):_0x0071('0x74'));return respondWithRpcPromise(_0x0071('0x75'),_0x0071('0x76'),_0x334418);}return null;})['then'](function(_0x2e59ac){if(_0x2e59ac){_0x2e59ac[_0x0071('0x2a')]['interface']=util[_0x0071('0x60')]('SIP/%s',_0x491399[_0x0071('0x62')][_0x0071('0x3b')]);_0x2e59ac[_0x0071('0x2a')][_0x0071('0x6f')]=_0x334418[_0x0071('0x6f')];_0x2e59ac[_0x0071('0x2a')][_0x0071('0x77')]=_0x0071('0x36');respondWithRpcPromise(_0x0071('0x70'),_0x0071('0x70'),{'event':_0x0071('0x78'),'message':_0x2e59ac['message']},client9002);return _0x334418;}return null;})[_0x0071('0x22')](respondWithResult(_0x3ccf26,null))[_0x0071('0x2c')](handleError(_0x3ccf26,null));};
\ No newline at end of file
index a8ac3e1..266c869 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0cee=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','emit'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x0cee,0x12f));var _0xe0ce=function(_0x12881f,_0x51cbb0){_0x12881f=_0x12881f-0x0;var _0xe88b03=_0x0cee[_0x12881f];return _0xe88b03;};'use strict';var EventEmitter=require(_0xe0ce('0x0'));var OpenchannelMessage=require(_0xe0ce('0x1'))['db'][_0xe0ce('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xe0ce('0x3')](0x0);var events={'afterCreate':_0xe0ce('0x4'),'afterUpdate':_0xe0ce('0x5'),'afterDestroy':'remove'};function emitEvent(_0x563553){return function(_0xe181aa,_0x3e377b,_0xe84b07){OpenchannelMessageEvents[_0xe0ce('0x6')](_0x563553+':'+_0xe181aa['id'],_0xe181aa);OpenchannelMessageEvents[_0xe0ce('0x6')](_0x563553,_0xe181aa);_0xe84b07(null);};}for(var e in events){if(events[_0xe0ce('0x7')](e)){var event=events[e];OpenchannelMessage[_0xe0ce('0x8')](e,emitEvent(event));}}module[_0xe0ce('0x9')]=OpenchannelMessageEvents;
\ No newline at end of file
+var _0x2fee=['hook','exports','events','OpenchannelMessage','save','remove','emit','hasOwnProperty'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x2fee,0x11a));var _0xe2fe=function(_0x14ef3e,_0x508efb){_0x14ef3e=_0x14ef3e-0x0;var _0x3b4b08=_0x2fee[_0x14ef3e];return _0x3b4b08;};'use strict';var EventEmitter=require(_0xe2fe('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0xe2fe('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe2fe('0x2'),'afterUpdate':'update','afterDestroy':_0xe2fe('0x3')};function emitEvent(_0x3dff76){return function(_0x4ca9af,_0x15f1a2,_0x2676cd){OpenchannelMessageEvents[_0xe2fe('0x4')](_0x3dff76+':'+_0x4ca9af['id'],_0x4ca9af);OpenchannelMessageEvents['emit'](_0x3dff76,_0x4ca9af);_0x2676cd(null);};}for(var e in events){if(events[_0xe2fe('0x5')](e)){var event=events[e];OpenchannelMessage[_0xe2fe('0x6')](e,emitEvent(event));}}module[_0xe2fe('0x7')]=OpenchannelMessageEvents;
\ No newline at end of file
index cf57550..109ee06 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc7ed=['update','createdAt','catch','error','CmContact','OpenchannelAccount','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','POST','method','GET','threadId','body','Interaction','inspect','finally','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','./openchannelMessage.attributes','exports','define','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','then'];(function(_0x4643ae,_0x588d99){var _0x59ccef=function(_0x41879c){while(--_0x41879c){_0x4643ae['push'](_0x4643ae['shift']());}};_0x59ccef(++_0x588d99);}(_0xc7ed,0x164));var _0xdc7e=function(_0xb14376,_0x5b0bf2){_0xb14376=_0xb14376-0x0;var _0x232f52=_0xc7ed[_0xb14376];return _0x232f52;};'use strict';var _=require(_0xdc7e('0x0'));var util=require(_0xdc7e('0x1'));var logger=require(_0xdc7e('0x2'))(_0xdc7e('0x3'));var moment=require('moment');var BPromise=require(_0xdc7e('0x4'));var rp=require(_0xdc7e('0x5'));var attributes=require(_0xdc7e('0x6'));module[_0xdc7e('0x7')]=function(_0x459ec5,_0x3a1fbd){return _0x459ec5[_0xdc7e('0x8')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x34651c,_0x559be0,_0x496bc9){var _0x2539f0=_0x459ec5[_0xdc7e('0x9')];var _0x418851=_0x34651c[_0xdc7e('0xa')]({'plain':!![]});if(_0x418851[_0xdc7e('0xb')][_0xdc7e('0xc')]()==='in'||_0x418851['direction'][_0xdc7e('0xc')]()===_0xdc7e('0xd')&&!_0x418851[_0xdc7e('0xe')]&&!_[_0xdc7e('0xf')](_0x418851[_0xdc7e('0x10')])){_0x2539f0[_0xdc7e('0x11')]['findOne']({'where':{'id':_0x418851[_0xdc7e('0x12')]}})[_0xdc7e('0x13')](function(_0x12f5df){if(_0x12f5df){_0x12f5df[_0xdc7e('0x14')]({'lastMsgAt':_0x418851[_0xdc7e('0x15')],'lastMsgDirection':_0x418851[_0xdc7e('0xb')][_0xdc7e('0xc')](),'lastMsgBody':_0x418851['body']});}})[_0xdc7e('0x16')](function(_0x474265){console[_0xdc7e('0x17')](_0x474265);});}if(_0x418851[_0xdc7e('0xb')]===_0xdc7e('0xd')&&!_0x418851[_0xdc7e('0xe')]){var _0x337b45;_0x2539f0[_0xdc7e('0x18')]['describe']()[_0xdc7e('0x13')](function(_0x514a0b){return _0x2539f0[_0xdc7e('0x19')]['find']({'where':{'id':_0x418851[_0xdc7e('0x1a')]},'include':[{'model':_0x2539f0[_0xdc7e('0x11')],'as':_0xdc7e('0x1b'),'where':{'id':_0x418851[_0xdc7e('0x12')]},'limit':0x1,'include':[{'model':_0x2539f0[_0xdc7e('0x18')],'as':_0xdc7e('0x1c'),'attributes':_[_0xdc7e('0x1d')](_0x514a0b)}]}]});})[_0xdc7e('0x13')](function(_0x57946c){_0x337b45=_0x57946c[_0xdc7e('0xa')]({'plain':!![]});if(_0x337b45&&_0x337b45[_0xdc7e('0x1e')]){logger[_0xdc7e('0x1f')](_0xdc7e('0x20'),_0xdc7e('0x21'),util[_0xdc7e('0x22')](_0xdc7e('0x23'),_0x418851['id'],_0x337b45[_0xdc7e('0x1e')]));if(_0x337b45[_0xdc7e('0x1b')]&&_0x337b45['Interactions'][_0xdc7e('0x24')]){_0x418851['Interaction']=_[_0xdc7e('0x25')](_0x337b45[_0xdc7e('0x1b')][0x0],_0xdc7e('0x1c'));_0x418851['Contact']=_0x337b45['Interactions'][0x0][_0xdc7e('0x1c')];}var _0x559be0={'method':_0xdc7e('0x26'),'uri':encodeURI(_0x337b45[_0xdc7e('0x1e')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x559be0[_0xdc7e('0x27')]){case _0xdc7e('0x28'):_0x559be0['qs']=_0x418851;break;case _0xdc7e('0x26'):_0x559be0['body']=_0x418851;break;}return rp(_0x559be0)[_0xdc7e('0x13')](function(_0x469ac7){logger['info'](_0xdc7e('0x20'),_0xdc7e('0x21'),util[_0xdc7e('0x22')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x418851['id'],_0x337b45[_0xdc7e('0x1e')]));if(_0x469ac7['body'][_0xdc7e('0x29')]&&_0x469ac7[_0xdc7e('0x2a')]['threadId']!=_0x418851[_0xdc7e('0x2b')][_0xdc7e('0x29')]){return _0x2539f0['OpenchannelInteraction'][_0xdc7e('0x14')]({'threadId':_0x469ac7[_0xdc7e('0x2a')][_0xdc7e('0x29')]},{'logging':!![],'where':{'id':_0x418851[_0xdc7e('0x2b')]['id']}});}else{return;}})[_0xdc7e('0x13')](function(){return _0x34651c[_0xdc7e('0x14')]({'read':!![]});})[_0xdc7e('0x16')](function(_0x2bcb4d){logger['error']('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xdc7e('0x2c')](_0x2bcb4d,{'showHidden':![],'depth':null}));_0x496bc9();});}else{_0x496bc9();}})[_0xdc7e('0x2d')](function(){_0x496bc9();});}else{_0x496bc9();}}},'charset':_0xdc7e('0x2e'),'collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file
+var _0x1746=['bluebird','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','models','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','body','catch','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','Contact','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','finally','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x1746,0xc3));var _0x6174=function(_0x377c28,_0x4ad433){_0x377c28=_0x377c28-0x0;var _0x6b6b67=_0x1746[_0x377c28];return _0x6b6b67;};'use strict';var _=require(_0x6174('0x0'));var util=require(_0x6174('0x1'));var logger=require(_0x6174('0x2'))(_0x6174('0x3'));var moment=require(_0x6174('0x4'));var BPromise=require(_0x6174('0x5'));var rp=require('request-promise');var attributes=require(_0x6174('0x6'));module[_0x6174('0x7')]=function(_0x2afb71,_0x541296){return _0x2afb71[_0x6174('0x8')](_0x6174('0x9'),attributes,{'tableName':_0x6174('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4d9c2e,_0x5df1ff,_0xfe0837){var _0x3bdd8f=_0x2afb71[_0x6174('0xb')];var _0x125d51=_0x4d9c2e['get']({'plain':!![]});if(_0x125d51[_0x6174('0xc')]['toLowerCase']()==='in'||_0x125d51[_0x6174('0xc')][_0x6174('0xd')]()===_0x6174('0xe')&&!_0x125d51[_0x6174('0xf')]&&!_[_0x6174('0x10')](_0x125d51[_0x6174('0x11')])){_0x3bdd8f[_0x6174('0x12')][_0x6174('0x13')]({'where':{'id':_0x125d51[_0x6174('0x14')]}})[_0x6174('0x15')](function(_0x5527a2){if(_0x5527a2){_0x5527a2[_0x6174('0x16')]({'lastMsgAt':_0x125d51['createdAt'],'lastMsgDirection':_0x125d51[_0x6174('0xc')][_0x6174('0xd')](),'lastMsgBody':_0x125d51[_0x6174('0x17')]});}})[_0x6174('0x18')](function(_0x401313){console[_0x6174('0x19')](_0x401313);});}if(_0x125d51[_0x6174('0xc')]==='out'&&!_0x125d51[_0x6174('0xf')]){var _0x59fcd1;_0x3bdd8f[_0x6174('0x1a')][_0x6174('0x1b')]()[_0x6174('0x15')](function(_0x244388){return _0x3bdd8f[_0x6174('0x1c')][_0x6174('0x1d')]({'where':{'id':_0x125d51[_0x6174('0x1e')]},'include':[{'model':_0x3bdd8f['OpenchannelInteraction'],'as':_0x6174('0x1f'),'where':{'id':_0x125d51[_0x6174('0x14')]},'limit':0x1,'include':[{'model':_0x3bdd8f['CmContact'],'as':'Contact','attributes':_['keys'](_0x244388)}]}]});})[_0x6174('0x15')](function(_0x56a219){_0x59fcd1=_0x56a219[_0x6174('0x20')]({'plain':!![]});if(_0x59fcd1&&_0x59fcd1[_0x6174('0x21')]){logger[_0x6174('0x22')](_0x6174('0x23'),_0x6174('0x24'),util[_0x6174('0x25')](_0x6174('0x26'),_0x125d51['id'],_0x59fcd1[_0x6174('0x21')]));if(_0x59fcd1[_0x6174('0x1f')]&&_0x59fcd1[_0x6174('0x1f')][_0x6174('0x27')]){_0x125d51[_0x6174('0x28')]=_[_0x6174('0x29')](_0x59fcd1['Interactions'][0x0],_0x6174('0x2a'));_0x125d51[_0x6174('0x2a')]=_0x59fcd1[_0x6174('0x1f')][0x0]['Contact'];}var _0x5df1ff={'method':_0x6174('0x2b'),'uri':encodeURI(_0x59fcd1[_0x6174('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5df1ff[_0x6174('0x2c')]){case _0x6174('0x2d'):_0x5df1ff['qs']=_0x125d51;break;case _0x6174('0x2b'):_0x5df1ff[_0x6174('0x17')]=_0x125d51;break;}return rp(_0x5df1ff)[_0x6174('0x15')](function(_0x203e4f){logger['info'](_0x6174('0x23'),_0x6174('0x24'),util[_0x6174('0x25')](_0x6174('0x2e'),_0x125d51['id'],_0x59fcd1[_0x6174('0x21')]));if(_0x203e4f[_0x6174('0x17')][_0x6174('0x2f')]&&_0x203e4f['body'][_0x6174('0x2f')]!=_0x125d51[_0x6174('0x28')]['threadId']){return _0x3bdd8f[_0x6174('0x12')][_0x6174('0x16')]({'threadId':_0x203e4f[_0x6174('0x17')]['threadId']},{'logging':!![],'where':{'id':_0x125d51['Interaction']['id']}});}else{return;}})[_0x6174('0x15')](function(){return _0x4d9c2e[_0x6174('0x16')]({'read':!![]});})[_0x6174('0x18')](function(_0xa2a49b){logger['error'](_0x6174('0x23'),_0x6174('0x24'),util['inspect'](_0xa2a49b,{'showHidden':![],'depth':null}));_0xfe0837();});}else{_0xfe0837();}})[_0x6174('0x30')](function(){_0xfe0837();});}else{_0xfe0837();}}},'charset':_0x6174('0x31'),'collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file
index 06daa32..6e934a4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x92e3=['lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','body','options','raw'];(function(_0x43ebd3,_0x4827e5){var _0xf90201=function(_0x295d4d){while(--_0x295d4d){_0x43ebd3['push'](_0x43ebd3['shift']());}};_0xf90201(++_0x4827e5);}(_0x92e3,0x1dc));var _0x392e=function(_0x3338b9,_0x54bbcf){_0x3338b9=_0x3338b9-0x0;var _0x3f7a4f=_0x92e3[_0x3338b9];return _0x3f7a4f;};'use strict';var _=require(_0x392e('0x0'));var util=require(_0x392e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x392e('0x2'))['db'];var utils=require(_0x392e('0x3'));var logger=require(_0x392e('0x4'))(_0x392e('0x5'));var config=require(_0x392e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x392e('0x7')]({'port':0x232a});config[_0x392e('0x8')]=_[_0x392e('0x9')](config[_0x392e('0x8')],{'host':_0x392e('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x392e('0x8')]));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x30da5c,_0x315bbd,_0x8b15c5){return new BPromise(function(_0x49b1ea,_0x358d1f){return client[_0x392e('0xb')](_0x30da5c,_0x8b15c5)[_0x392e('0xc')](function(_0x1bdb42){logger[_0x392e('0xd')](_0x392e('0xe'),_0x315bbd,_0x392e('0xf'));logger[_0x392e('0x10')](_0x392e('0x11'),_0x315bbd,'request\x20sent',JSON[_0x392e('0x12')](_0x1bdb42));if(_0x1bdb42[_0x392e('0x13')]){if(_0x1bdb42[_0x392e('0x13')][_0x392e('0x14')]===0x1f4){logger['error'](_0x392e('0xe'),_0x315bbd,_0x1bdb42[_0x392e('0x13')][_0x392e('0x15')]);return _0x358d1f(_0x1bdb42[_0x392e('0x13')][_0x392e('0x15')]);}logger[_0x392e('0x13')](_0x392e('0xe'),_0x315bbd,_0x1bdb42[_0x392e('0x13')]['message']);return _0x49b1ea(_0x1bdb42['error'][_0x392e('0x15')]);}else{logger[_0x392e('0xd')](_0x392e('0xe'),_0x315bbd,_0x392e('0xf'));_0x49b1ea(_0x1bdb42[_0x392e('0x16')][_0x392e('0x15')]);}})[_0x392e('0x17')](function(_0x5659b4){logger[_0x392e('0x13')](_0x392e('0xe'),_0x315bbd,_0x5659b4);_0x358d1f(_0x5659b4);});});}exports[_0x392e('0x18')]=function(_0x2c0ca4){var _0x4684b0=this;return new Promise(function(_0x17c008,_0x265c61){return db['OpenchannelMessage']['create'](_0x2c0ca4[_0x392e('0x19')],{'raw':_0x2c0ca4[_0x392e('0x1a')]?_0x2c0ca4[_0x392e('0x1a')][_0x392e('0x1b')]===undefined?!![]:![]:!![]})[_0x392e('0xc')](function(_0x476ce0){logger[_0x392e('0xd')](_0x392e('0x18'),_0x2c0ca4);logger['debug'](_0x392e('0x18'),_0x2c0ca4,JSON[_0x392e('0x12')](_0x476ce0));_0x17c008(_0x476ce0);})['catch'](function(_0x120cc8){logger[_0x392e('0x13')](_0x392e('0x18'),_0x120cc8['message'],_0x2c0ca4);_0x265c61(_0x4684b0[_0x392e('0x13')](0x1f4,_0x120cc8[_0x392e('0x15')]));});});};
\ No newline at end of file
+var _0xd816=['code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','info','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','stringify','error'];(function(_0x39186f,_0x17042f){var _0x48a8a4=function(_0x2f63fd){while(--_0x2f63fd){_0x39186f['push'](_0x39186f['shift']());}};_0x48a8a4(++_0x17042f);}(_0xd816,0x18b));var _0x6d81=function(_0x167583,_0x5be195){_0x167583=_0x167583-0x0;var _0x182dda=_0xd816[_0x167583];return _0x182dda;};'use strict';var _=require('lodash');var util=require(_0x6d81('0x0'));var moment=require(_0x6d81('0x1'));var BPromise=require(_0x6d81('0x2'));var rs=require(_0x6d81('0x3'));var fs=require('fs');var Redis=require(_0x6d81('0x4'));var db=require(_0x6d81('0x5'))['db'];var utils=require(_0x6d81('0x6'));var logger=require(_0x6d81('0x7'))(_0x6d81('0x8'));var config=require('../../config/environment');var jayson=require(_0x6d81('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x6d81('0xa')]=_[_0x6d81('0xb')](config['redis'],{'host':_0x6d81('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6d81('0xd'))[_0x6d81('0xe')](socket);function respondWithRpcPromise(_0x1213a7,_0x2ef1d2,_0x1686c3){return new BPromise(function(_0xe6a403,_0x105bda){return client[_0x6d81('0xf')](_0x1213a7,_0x1686c3)[_0x6d81('0x10')](function(_0x543f58){logger['info'](_0x6d81('0x11'),_0x2ef1d2,'request\x20sent');logger[_0x6d81('0x12')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x2ef1d2,'request\x20sent',JSON[_0x6d81('0x13')](_0x543f58));if(_0x543f58[_0x6d81('0x14')]){if(_0x543f58[_0x6d81('0x14')][_0x6d81('0x15')]===0x1f4){logger[_0x6d81('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x2ef1d2,_0x543f58[_0x6d81('0x14')][_0x6d81('0x16')]);return _0x105bda(_0x543f58[_0x6d81('0x14')][_0x6d81('0x16')]);}logger['error'](_0x6d81('0x11'),_0x2ef1d2,_0x543f58[_0x6d81('0x14')][_0x6d81('0x16')]);return _0xe6a403(_0x543f58[_0x6d81('0x14')][_0x6d81('0x16')]);}else{logger['info'](_0x6d81('0x11'),_0x2ef1d2,'request\x20sent');_0xe6a403(_0x543f58[_0x6d81('0x17')][_0x6d81('0x16')]);}})[_0x6d81('0x18')](function(_0x51ba89){logger['error'](_0x6d81('0x11'),_0x2ef1d2,_0x51ba89);_0x105bda(_0x51ba89);});});}exports[_0x6d81('0x19')]=function(_0x27800c){var _0x3d0fae=this;return new Promise(function(_0x1f58c1,_0x401850){return db[_0x6d81('0x1a')][_0x6d81('0x1b')](_0x27800c[_0x6d81('0x1c')],{'raw':_0x27800c[_0x6d81('0x1d')]?_0x27800c[_0x6d81('0x1d')][_0x6d81('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x1ea181){logger[_0x6d81('0x1f')](_0x6d81('0x19'),_0x27800c);logger['debug'](_0x6d81('0x19'),_0x27800c,JSON[_0x6d81('0x13')](_0x1ea181));_0x1f58c1(_0x1ea181);})['catch'](function(_0x3f5978){logger['error'](_0x6d81('0x19'),_0x3f5978[_0x6d81('0x16')],_0x27800c);_0x401850(_0x3d0fae[_0x6d81('0x14')](0x1f4,_0x3f5978[_0x6d81('0x16')]));});});};
\ No newline at end of file
index 1228657..06f2d88 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x66fa=['removeListener','register','length','./openchannelMessage.events','save','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x66fa,0x168));var _0xa66f=function(_0xa8e4b2,_0x1cafea){_0xa8e4b2=_0xa8e4b2-0x0;var _0x2a04fe=_0x66fa[_0xa8e4b2];return _0x2a04fe;};'use strict';var OpenchannelMessageEvents=require(_0xa66f('0x0'));var events=[_0xa66f('0x1'),_0xa66f('0x2'),'update'];function createListener(_0x4a6840,_0x3dc747){return function(_0x2325d7){_0x3dc747[_0xa66f('0x3')](_0x4a6840,_0x2325d7);};}function removeListener(_0x2e663b,_0x2143e6){return function(){OpenchannelMessageEvents[_0xa66f('0x4')](_0x2e663b,_0x2143e6);};}exports[_0xa66f('0x5')]=function(_0x4532ee){for(var _0x25a7a0=0x0,_0x33bd0d=events[_0xa66f('0x6')];_0x25a7a0<_0x33bd0d;_0x25a7a0++){var _0x5b7cf7=events[_0x25a7a0];var _0x1cf624=createListener('openchannelMessage:'+_0x5b7cf7,_0x4532ee);OpenchannelMessageEvents['on'](_0x5b7cf7,_0x1cf624);}};
\ No newline at end of file
+var _0xdc97=['./openchannelMessage.events','save','remove','emit','removeListener','register','openchannelMessage:'];(function(_0x4536a4,_0x55af7b){var _0x4fd1c1=function(_0x4c68cd){while(--_0x4c68cd){_0x4536a4['push'](_0x4536a4['shift']());}};_0x4fd1c1(++_0x55af7b);}(_0xdc97,0x13b));var _0x7dc9=function(_0x4f5aed,_0x32f718){_0x4f5aed=_0x4f5aed-0x0;var _0x37440b=_0xdc97[_0x4f5aed];return _0x37440b;};'use strict';var OpenchannelMessageEvents=require(_0x7dc9('0x0'));var events=[_0x7dc9('0x1'),_0x7dc9('0x2'),'update'];function createListener(_0x2913e6,_0x4f5c88){return function(_0x228e39){_0x4f5c88[_0x7dc9('0x3')](_0x2913e6,_0x228e39);};}function removeListener(_0x478a95,_0x2a77c1){return function(){OpenchannelMessageEvents[_0x7dc9('0x4')](_0x478a95,_0x2a77c1);};}exports[_0x7dc9('0x5')]=function(_0x3ba3ca){for(var _0x589f02=0x0,_0x2636ef=events['length'];_0x589f02<_0x2636ef;_0x589f02++){var _0x4b3229=events[_0x589f02];var _0x2ff923=createListener(_0x7dc9('0x6')+_0x4b3229,_0x3ba3ca);OpenchannelMessageEvents['on'](_0x4b3229,_0x2ff923);}};
\ No newline at end of file
index 93fc671..52cb060 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5cb6=['put','update','destroy','removeTeams','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','getTeams','post','create','/:id/teams','addTeams','/:id/users'];(function(_0x126fb9,_0x122c59){var _0xc8a3b1=function(_0x355744){while(--_0x355744){_0x126fb9['push'](_0x126fb9['shift']());}};_0xc8a3b1(++_0x122c59);}(_0x5cb6,0x16f));var _0x65cb=function(_0x308e4f,_0x134e25){_0x308e4f=_0x308e4f-0x0;var _0x17ab35=_0x5cb6[_0x308e4f];return _0x17ab35;};'use strict';var multer=require(_0x65cb('0x0'));var util=require(_0x65cb('0x1'));var path=require(_0x65cb('0x2'));var timeout=require(_0x65cb('0x3'));var express=require(_0x65cb('0x4'));var router=express[_0x65cb('0x5')]();var auth=require(_0x65cb('0x6'));var interaction=require(_0x65cb('0x7'));var config=require(_0x65cb('0x8'));var controller=require(_0x65cb('0x9'));router[_0x65cb('0xa')]('/',auth[_0x65cb('0xb')](),controller[_0x65cb('0xc')]);router['get']('/describe',auth[_0x65cb('0xb')](),controller[_0x65cb('0xd')]);router[_0x65cb('0xa')](_0x65cb('0xe'),auth[_0x65cb('0xb')](),controller['show']);router[_0x65cb('0xa')](_0x65cb('0xf'),auth[_0x65cb('0xb')](),controller[_0x65cb('0x10')]);router[_0x65cb('0xa')]('/:id/teams',auth[_0x65cb('0xb')](),controller[_0x65cb('0x11')]);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x65cb('0x12')]('/',auth[_0x65cb('0xb')](),controller[_0x65cb('0x13')]);router[_0x65cb('0x12')](_0x65cb('0x14'),auth[_0x65cb('0xb')](),controller[_0x65cb('0x15')]);router[_0x65cb('0x12')](_0x65cb('0x16'),auth[_0x65cb('0xb')](),controller['addAgents']);router[_0x65cb('0x17')](_0x65cb('0xe'),auth[_0x65cb('0xb')](),controller[_0x65cb('0x18')]);router['delete'](_0x65cb('0xe'),auth[_0x65cb('0xb')](),controller[_0x65cb('0x19')]);router['delete'](_0x65cb('0x14'),auth[_0x65cb('0xb')](),controller[_0x65cb('0x1a')]);router[_0x65cb('0x1b')](_0x65cb('0x16'),auth[_0x65cb('0xb')](),controller[_0x65cb('0x1c')]);module[_0x65cb('0x1d')]=router;
\ No newline at end of file
+var _0x9600=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','index','get','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','/:id','delete','destroy','removeAgents','util','path'];(function(_0x54fe11,_0x16e78d){var _0x15086c=function(_0x4e63ed){while(--_0x4e63ed){_0x54fe11['push'](_0x54fe11['shift']());}};_0x15086c(++_0x16e78d);}(_0x9600,0xb6));var _0x0960=function(_0x32cafb,_0x159017){_0x32cafb=_0x32cafb-0x0;var _0x4e09de=_0x9600[_0x32cafb];return _0x4e09de;};'use strict';var multer=require('multer');var util=require(_0x0960('0x0'));var path=require(_0x0960('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0960('0x2')]();var auth=require(_0x0960('0x3'));var interaction=require(_0x0960('0x4'));var config=require(_0x0960('0x5'));var controller=require(_0x0960('0x6'));router['get']('/',auth[_0x0960('0x7')](),controller[_0x0960('0x8')]);router['get']('/describe',auth[_0x0960('0x7')](),controller['describe']);router[_0x0960('0x9')]('/:id',auth[_0x0960('0x7')](),controller['show']);router[_0x0960('0x9')](_0x0960('0xa'),auth['isAuthenticated'](),controller[_0x0960('0xb')]);router[_0x0960('0x9')](_0x0960('0xc'),auth[_0x0960('0x7')](),controller[_0x0960('0xd')]);router[_0x0960('0x9')](_0x0960('0xe'),auth[_0x0960('0x7')](),controller[_0x0960('0xf')]);router[_0x0960('0x10')]('/',auth[_0x0960('0x7')](),controller[_0x0960('0x11')]);router[_0x0960('0x10')](_0x0960('0xc'),auth[_0x0960('0x7')](),controller['addTeams']);router[_0x0960('0x10')]('/:id/users',auth[_0x0960('0x7')](),controller[_0x0960('0x12')]);router['put'](_0x0960('0x13'),auth[_0x0960('0x7')](),controller['update']);router[_0x0960('0x14')](_0x0960('0x13'),auth[_0x0960('0x7')](),controller[_0x0960('0x15')]);router['delete'](_0x0960('0xc'),auth[_0x0960('0x7')](),controller['removeTeams']);router['delete'](_0x0960('0xe'),auth[_0x0960('0x7')](),controller[_0x0960('0x16')]);module['exports']=router;
\ No newline at end of file
index 82e72cc..0809d6a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf413=['sequelize','exports','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x45d80c,_0x35c0ff){var _0x449a98=function(_0x1b5ab7){while(--_0x1b5ab7){_0x45d80c['push'](_0x45d80c['shift']());}};_0x449a98(++_0x35c0ff);}(_0xf413,0xd9));var _0x3f41=function(_0x1877a1,_0x38ea7c){_0x1877a1=_0x1877a1-0x0;var _0x3d39f3=_0xf413[_0x1877a1];return _0x3d39f3;};'use strict';var Sequelize=require(_0x3f41('0x0'));module[_0x3f41('0x1')]={'name':{'type':Sequelize[_0x3f41('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3f41('0x2')]},'timeout':{'type':Sequelize[_0x3f41('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3f41('0x4')](_0x3f41('0x5'),_0x3f41('0x6'),'roundrobin')}};
\ No newline at end of file
+var _0x2376=['name','INTEGER','ENUM','beepall','sequelize','exports','STRING'];(function(_0x5a14fc,_0x2dded4){var _0xb06e7b=function(_0xf2667c){while(--_0xf2667c){_0x5a14fc['push'](_0x5a14fc['shift']());}};_0xb06e7b(++_0x2dded4);}(_0x2376,0x90));var _0x6237=function(_0x3a8f7f,_0x334556){_0x3a8f7f=_0x3a8f7f-0x0;var _0x5e2d1f=_0x2376[_0x3a8f7f];return _0x5e2d1f;};'use strict';var Sequelize=require(_0x6237('0x0'));module[_0x6237('0x1')]={'name':{'type':Sequelize[_0x6237('0x2')],'unique':_0x6237('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6237('0x2')]},'timeout':{'type':Sequelize[_0x6237('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6237('0x5')]('rrmemory',_0x6237('0x6'),'roundrobin')}};
\ No newline at end of file
index f35afef..9b5a1ac 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd8b0=['length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','key','VIRTUAL','field','options','includeAll','include','OpenchannelQueue','findAll','rows','params','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','describe','getMembers','UserOpenchannelQueue','pick','OpenchannelQueueId','map','User','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','format','SIP','getTeams','findOne','Team','addTeams','ids','Agents','union','addAgents','removeTeams','omit','spread','emit','userOpenchannelQueue:save','removeAgents','isArray','userOpenchannelQueue:remove','getAgents','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','OpenchannelQueues','end','error','name','index','rawAttributes','keys','query','filters','intersection','model','attributes','fields'];(function(_0x4fc117,_0x18b65a){var _0x359a74=function(_0x3e459c){while(--_0x3e459c){_0x4fc117['push'](_0x4fc117['shift']());}};_0x359a74(++_0x18b65a);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var authService=require(_0x0d8b('0xe'));var hardwareService=require(_0x0d8b('0xf'));var Redis=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var logger=require(_0x0d8b('0x12'))('api');var utils=require(_0x0d8b('0x13'));var config=require('../../config/environment');var db=require(_0x0d8b('0x14'))['db'];config[_0x0d8b('0x15')]=_[_0x0d8b('0x16')](config[_0x0d8b('0x15')],{'host':_0x0d8b('0x17'),'port':0x18eb});var socket=require(_0x0d8b('0x18'))(new Redis(config[_0x0d8b('0x15')]));require(_0x0d8b('0x19'))[_0x0d8b('0x1a')](socket);function respondWithStatusCode(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xcc;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x1b')](_0x5ad086);}return _0x2ce75e[_0x0d8b('0x1c')](_0x5ad086)['end']();};}function respondWithResult(_0x23eb7b,_0xa86349){_0xa86349=_0xa86349||0xc8;return function(_0x17f7df){if(_0x17f7df){return _0x23eb7b[_0x0d8b('0x1c')](_0xa86349)[_0x0d8b('0x1d')](_0x17f7df);}};}function respondWithFilteredResult(_0x5cd485,_0x106a01){return function(_0x4586c2){if(_0x4586c2){var _0x2fd0fc=_0x4586c2[_0x0d8b('0x1e')],_0x5fecbd=_0x106a01[_0x0d8b('0x1f')],_0x333674=_0x106a01['offset']+_0x106a01[_0x0d8b('0x20')],_0x18dd2d;if(_0x333674>=_0x2fd0fc){_0x333674=_0x2fd0fc;_0x18dd2d=0xc8;}else{_0x18dd2d=0xce;}_0x5cd485[_0x0d8b('0x1c')](_0x18dd2d);return _0x5cd485[_0x0d8b('0x21')](_0x0d8b('0x22'),_0x5fecbd+'-'+_0x333674+'/'+_0x2fd0fc)[_0x0d8b('0x1d')](_0x4586c2);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x23')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x24')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x25')](_0x54a9a7)[_0x0d8b('0x26')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x27')]()[_0x0d8b('0x26')](function(){var _0x27b695=_0x2c64e2['get']({'plain':!![]});var _0xe8bbee=_0x0d8b('0x28');return db['UserProfileResource'][_0x0d8b('0x27')]({'where':{'type':_0xe8bbee,'resourceId':_0x27b695['id']}})['then'](function(){return _0x2c64e2;});})[_0x0d8b('0x26')](function(){_0x38efc8[_0x0d8b('0x1c')](0xcc)[_0x0d8b('0x29')]();});}};}function handleEntityNotFound(_0x4fe6f9,_0x59a905){return function(_0x28f639){if(!_0x28f639){_0x4fe6f9[_0x0d8b('0x1b')](0x194);}return _0x28f639;};}function handleError(_0x4c05ee,_0xcbc4ac){_0xcbc4ac=_0xcbc4ac||0x1f4;return function(_0x59aa83){logger[_0x0d8b('0x2a')](_0x59aa83['stack']);if(_0x59aa83[_0x0d8b('0x2b')]){delete _0x59aa83['name'];}_0x4c05ee[_0x0d8b('0x1c')](_0xcbc4ac)['send'](_0x59aa83);};}exports[_0x0d8b('0x2c')]=function(_0x544735,_0x3c8887){var _0x106e4c={},_0x2c058d={},_0x56120a={'count':0x0,'rows':[]};var _0x4c80a2=db['OpenchannelQueue'][_0x0d8b('0x2d')];_0x2c058d['model']=_[_0x0d8b('0x2e')](_0x4c80a2);_0x2c058d['query']=_['keys'](_0x544735[_0x0d8b('0x2f')]);_0x2c058d[_0x0d8b('0x30')]=_[_0x0d8b('0x31')](_0x2c058d[_0x0d8b('0x32')],_0x2c058d[_0x0d8b('0x2f')]);_0x106e4c[_0x0d8b('0x33')]=_[_0x0d8b('0x31')](_0x2c058d[_0x0d8b('0x32')],qs['fields'](_0x544735[_0x0d8b('0x2f')][_0x0d8b('0x34')]));_0x106e4c['attributes']=_0x106e4c[_0x0d8b('0x33')][_0x0d8b('0x35')]?_0x106e4c[_0x0d8b('0x33')]:_0x2c058d['model'];if(!_0x544735[_0x0d8b('0x2f')][_0x0d8b('0x36')](_0x0d8b('0x37'))){_0x106e4c[_0x0d8b('0x20')]=qs[_0x0d8b('0x20')](_0x544735['query'][_0x0d8b('0x20')]);_0x106e4c[_0x0d8b('0x1f')]=qs['offset'](_0x544735[_0x0d8b('0x2f')][_0x0d8b('0x1f')]);}_0x106e4c[_0x0d8b('0x38')]=qs[_0x0d8b('0x39')](_0x544735[_0x0d8b('0x2f')]['sort']);_0x106e4c['where']=qs[_0x0d8b('0x30')](_['pick'](_0x544735['query'],_0x2c058d[_0x0d8b('0x30')]));if(_0x544735[_0x0d8b('0x2f')][_0x0d8b('0x3a')]){_0x106e4c[_0x0d8b('0x3b')]=_[_0x0d8b('0x3c')](_0x106e4c[_0x0d8b('0x3b')],{'$or':_['map'](_0x4c80a2,function(_0x6e5bab){if(_0x6e5bab[_0x0d8b('0x3d')][_0x0d8b('0x3e')]!==_0x0d8b('0x3f')){var _0x338ed3={};_0x338ed3[_0x6e5bab[_0x0d8b('0x40')]]={'$like':'%'+_0x544735[_0x0d8b('0x2f')]['filter']+'%'};return _0x338ed3;}})});}_0x106e4c=_[_0x0d8b('0x3c')]({},_0x106e4c,_0x544735[_0x0d8b('0x41')]);var _0x3fa955={'where':_0x106e4c[_0x0d8b('0x3b')]};return db['OpenchannelQueue'][_0x0d8b('0x1e')](_0x3fa955)['then'](function(_0x37b26c){_0x56120a[_0x0d8b('0x1e')]=_0x37b26c;if(_0x544735[_0x0d8b('0x2f')][_0x0d8b('0x42')]){_0x106e4c[_0x0d8b('0x43')]=[{'all':!![]}];}return db[_0x0d8b('0x44')][_0x0d8b('0x45')](_0x106e4c);})[_0x0d8b('0x26')](function(_0x89ab0d){_0x56120a[_0x0d8b('0x46')]=_0x89ab0d;return _0x56120a;})['then'](respondWithFilteredResult(_0x3c8887,_0x106e4c))['catch'](handleError(_0x3c8887,null));};exports['show']=function(_0x4d0811,_0x524d79){var _0x1a46f6={'raw':!![],'where':{'id':_0x4d0811[_0x0d8b('0x47')]['id']}},_0x402fe0={};_0x402fe0['model']=_['keys'](db[_0x0d8b('0x44')][_0x0d8b('0x2d')]);_0x402fe0[_0x0d8b('0x2f')]=_['keys'](_0x4d0811[_0x0d8b('0x2f')]);_0x402fe0[_0x0d8b('0x30')]=_['intersection'](_0x402fe0['model'],_0x402fe0[_0x0d8b('0x2f')]);_0x1a46f6['attributes']=_[_0x0d8b('0x31')](_0x402fe0['model'],qs['fields'](_0x4d0811[_0x0d8b('0x2f')][_0x0d8b('0x34')]));_0x1a46f6['attributes']=_0x1a46f6['attributes']['length']?_0x1a46f6['attributes']:_0x402fe0[_0x0d8b('0x32')];if(_0x4d0811[_0x0d8b('0x2f')][_0x0d8b('0x42')]){_0x1a46f6['include']=[{'all':!![]}];}_0x1a46f6=_[_0x0d8b('0x3c')]({},_0x1a46f6,_0x4d0811[_0x0d8b('0x41')]);return db[_0x0d8b('0x44')][_0x0d8b('0x48')](_0x1a46f6)[_0x0d8b('0x26')](handleEntityNotFound(_0x524d79,null))[_0x0d8b('0x26')](respondWithResult(_0x524d79,null))[_0x0d8b('0x49')](handleError(_0x524d79,null));};exports[_0x0d8b('0x4a')]=function(_0x384a5e,_0x1f2077){return db[_0x0d8b('0x44')][_0x0d8b('0x4a')](_0x384a5e[_0x0d8b('0x4b')],{})[_0x0d8b('0x26')](function(_0x570af8){var _0xdfcf32=_0x384a5e[_0x0d8b('0x4c')][_0x0d8b('0x4d')]({'plain':!![]});if(!_0xdfcf32)throw new Error(_0x0d8b('0x4e'));if(_0xdfcf32['role']===_0x0d8b('0x4c')){var _0x4d8850=_0x570af8['get']({'plain':!![]});var _0x39a31d=_0x0d8b('0x28');return db[_0x0d8b('0x4f')][_0x0d8b('0x48')]({'where':{'name':_0x39a31d,'userProfileId':_0xdfcf32['userProfileId']},'raw':!![]})[_0x0d8b('0x26')](function(_0x1106d6){if(_0x1106d6&&_0x1106d6[_0x0d8b('0x50')]===0x0){return db[_0x0d8b('0x51')][_0x0d8b('0x4a')]({'name':_0x4d8850['name'],'resourceId':_0x4d8850['id'],'type':_0x1106d6['name'],'sectionId':_0x1106d6['id']},{})['then'](function(){return _0x570af8;});}else{return _0x570af8;}})['catch'](function(_0x368ede){logger[_0x0d8b('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x368ede);throw _0x368ede;});}return _0x570af8;})['then'](respondWithResult(_0x1f2077,0xc9))[_0x0d8b('0x49')](handleError(_0x1f2077,null));};exports[_0x0d8b('0x25')]=function(_0x5c5bd7,_0x5ef6c3){if(_0x5c5bd7[_0x0d8b('0x4b')]['id']){delete _0x5c5bd7[_0x0d8b('0x4b')]['id'];}return db[_0x0d8b('0x44')][_0x0d8b('0x48')]({'where':{'id':_0x5c5bd7[_0x0d8b('0x47')]['id']}})['then'](handleEntityNotFound(_0x5ef6c3,null))[_0x0d8b('0x26')](saveUpdates(_0x5c5bd7[_0x0d8b('0x4b')],null))['then'](respondWithResult(_0x5ef6c3,null))['catch'](handleError(_0x5ef6c3,null));};exports[_0x0d8b('0x27')]=function(_0x3f2d95,_0x546fef){return db['OpenchannelQueue'][_0x0d8b('0x48')]({'where':{'id':_0x3f2d95[_0x0d8b('0x47')]['id']}})[_0x0d8b('0x26')](handleEntityNotFound(_0x546fef,null))[_0x0d8b('0x26')](removeEntity(_0x546fef,null))['catch'](handleError(_0x546fef,null));};exports[_0x0d8b('0x52')]=function(_0x598e03,_0x5c271c){return db[_0x0d8b('0x44')][_0x0d8b('0x52')]()['then'](respondWithResult(_0x5c271c,null))['catch'](handleError(_0x5c271c,null));};exports[_0x0d8b('0x53')]=function(_0x3d7161,_0xccc2a9,_0x2c1eb0){var _0x3afc3a={'raw':!![],'where':{}},_0xb66e76={},_0x3978e5;return db[_0x0d8b('0x44')]['findOne']({'where':{'id':_0x3d7161[_0x0d8b('0x47')]['id']}})[_0x0d8b('0x26')](handleEntityNotFound(_0xccc2a9,null))[_0x0d8b('0x26')](function(_0x3c7efb){if(_0x3c7efb){_0x3978e5=_0x3c7efb[_0x0d8b('0x4d')]({'plain':!![]});_0xb66e76[_0x0d8b('0x32')]=_[_0x0d8b('0x2e')](db[_0x0d8b('0x54')][_0x0d8b('0x2d')]);_0xb66e76['query']=_[_0x0d8b('0x2e')](_0x3d7161[_0x0d8b('0x2f')]);_0xb66e76[_0x0d8b('0x30')]=_[_0x0d8b('0x31')](_0xb66e76[_0x0d8b('0x32')],_0xb66e76['query']);_0x3afc3a[_0x0d8b('0x33')]=_[_0x0d8b('0x31')](_0xb66e76[_0x0d8b('0x32')],qs[_0x0d8b('0x34')](_0x3d7161[_0x0d8b('0x2f')]['fields']));_0x3afc3a['attributes']=_0x3afc3a[_0x0d8b('0x33')][_0x0d8b('0x35')]?_0x3afc3a[_0x0d8b('0x33')]:_0xb66e76[_0x0d8b('0x32')];if(!_0x3d7161['query'][_0x0d8b('0x36')](_0x0d8b('0x37'))){_0x3afc3a[_0x0d8b('0x20')]=qs['limit'](_0x3d7161[_0x0d8b('0x2f')]['limit']);_0x3afc3a[_0x0d8b('0x1f')]=qs[_0x0d8b('0x1f')](_0x3d7161[_0x0d8b('0x2f')][_0x0d8b('0x1f')]);}_0x3afc3a[_0x0d8b('0x38')]=qs[_0x0d8b('0x39')](_0x3d7161['query'][_0x0d8b('0x39')]);_0x3afc3a['where']=qs[_0x0d8b('0x30')](_[_0x0d8b('0x55')](_0x3d7161[_0x0d8b('0x2f')],_0xb66e76[_0x0d8b('0x30')]));_0x3afc3a['where'][_0x0d8b('0x56')]=_0x3c7efb['id'];if(_0x3d7161[_0x0d8b('0x2f')][_0x0d8b('0x3a')]){_0x3afc3a[_0x0d8b('0x3b')]=_[_0x0d8b('0x3c')](_0x3afc3a[_0x0d8b('0x3b')],{'$or':_[_0x0d8b('0x57')](_0x3afc3a[_0x0d8b('0x33')],function(_0x2ce282){var _0x34affb={};_0x34affb[_0x2ce282]={'$like':'%'+_0x3d7161['query']['filter']+'%'};return _0x34affb;})});}_0x3afc3a=_[_0x0d8b('0x3c')]({},_0x3afc3a,_0x3d7161[_0x0d8b('0x41')]);return db['UserOpenchannelQueue'][_0x0d8b('0x45')](_0x3afc3a);}})['then'](function(_0x5cc960){if(_0x5cc960){return db[_0x0d8b('0x58')][_0x0d8b('0x59')]({'where':{'id':_['map'](_0x5cc960,'UserId'),'role':_0x0d8b('0x5a')},'attributes':['id',_0x0d8b('0x2b'),_0x0d8b('0x5b'),_0x0d8b('0x5c'),_0x0d8b('0x5d')]});}})[_0x0d8b('0x26')](function(_0x40d265){if(_0x40d265){return{'count':_0x40d265['count'],'rows':_[_0x0d8b('0x57')](_0x40d265['rows'],function(_0x1a203e){return{'membername':_0x1a203e[_0x0d8b('0x2b')],'UserId':_0x1a203e['id'],'queue_name':_0x3978e5[_0x0d8b('0x2b')],'OpenchannelQueueId':_0x3978e5['id'],'interface':util[_0x0d8b('0x5e')]('%s/%s',_0x0d8b('0x5f'),_0x1a203e['name']),'penalty':0x0,'paused':_0x1a203e[_0x0d8b('0x5b')],'createdAt':_0x1a203e[_0x0d8b('0x5d')],'updatedAt':_0x1a203e[_0x0d8b('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0d8b('0x26')](respondWithFilteredResult(_0xccc2a9,_0x3afc3a))[_0x0d8b('0x49')](handleError(_0xccc2a9,null));};exports[_0x0d8b('0x60')]=function(_0x3e927c,_0x91aa89,_0x266a69){var _0x44aa74={};var _0x4eb07e={};var _0x1436b3;var _0x54c28b;return db[_0x0d8b('0x44')][_0x0d8b('0x61')]({'where':{'id':_0x3e927c['params']['id']}})[_0x0d8b('0x26')](handleEntityNotFound(_0x91aa89,null))['then'](function(_0x10c318){if(_0x10c318){_0x1436b3=_0x10c318;_0x4eb07e[_0x0d8b('0x32')]=_[_0x0d8b('0x2e')](db[_0x0d8b('0x62')][_0x0d8b('0x2d')]);_0x4eb07e[_0x0d8b('0x2f')]=_[_0x0d8b('0x2e')](_0x3e927c[_0x0d8b('0x2f')]);_0x4eb07e['filters']=_[_0x0d8b('0x31')](_0x4eb07e[_0x0d8b('0x32')],_0x4eb07e['query']);_0x44aa74[_0x0d8b('0x33')]=_[_0x0d8b('0x31')](_0x4eb07e[_0x0d8b('0x32')],qs[_0x0d8b('0x34')](_0x3e927c[_0x0d8b('0x2f')][_0x0d8b('0x34')]));_0x44aa74[_0x0d8b('0x33')]=_0x44aa74[_0x0d8b('0x33')][_0x0d8b('0x35')]?_0x44aa74[_0x0d8b('0x33')]:_0x4eb07e[_0x0d8b('0x32')];_0x44aa74[_0x0d8b('0x38')]=qs['sort'](_0x3e927c[_0x0d8b('0x2f')][_0x0d8b('0x39')]);_0x44aa74[_0x0d8b('0x3b')]=qs['filters'](_['pick'](_0x3e927c[_0x0d8b('0x2f')],_0x4eb07e[_0x0d8b('0x30')]));if(_0x3e927c[_0x0d8b('0x2f')]['filter']){_0x44aa74['where']=_[_0x0d8b('0x3c')](_0x44aa74[_0x0d8b('0x3b')],{'$or':_[_0x0d8b('0x57')](_0x44aa74[_0x0d8b('0x33')],function(_0x2a2b58){var _0x3f7895={};_0x3f7895[_0x2a2b58]={'$like':'%'+_0x3e927c[_0x0d8b('0x2f')][_0x0d8b('0x3a')]+'%'};return _0x3f7895;})});}_0x44aa74=_[_0x0d8b('0x3c')]({},_0x44aa74,_0x3e927c[_0x0d8b('0x41')]);return _0x1436b3[_0x0d8b('0x60')](_0x44aa74);}})[_0x0d8b('0x26')](function(_0x3b060e){if(_0x3b060e){_0x54c28b=_0x3b060e['length'];if(!_0x3e927c[_0x0d8b('0x2f')][_0x0d8b('0x36')]('nolimit')){_0x44aa74['limit']=qs[_0x0d8b('0x20')](_0x3e927c[_0x0d8b('0x2f')][_0x0d8b('0x20')]);_0x44aa74[_0x0d8b('0x1f')]=qs[_0x0d8b('0x1f')](_0x3e927c[_0x0d8b('0x2f')]['offset']);}return _0x1436b3['getTeams'](_0x44aa74);}})['then'](function(_0x1f1eae){if(_0x1f1eae){return _0x1f1eae?{'count':_0x54c28b,'rows':_0x1f1eae}:null;}})[_0x0d8b('0x26')](respondWithResult(_0x91aa89,null))[_0x0d8b('0x49')](handleError(_0x91aa89,null));};exports[_0x0d8b('0x63')]=function(_0x3f1eee,_0x21d620,_0x5ef461){var _0x302426=[];var _0x1d173f;return db['Team'][_0x0d8b('0x45')]({'where':{'id':_0x3f1eee['body'][_0x0d8b('0x64')]},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x58')],'as':_0x0d8b('0x65'),'attributes':['id'],'raw':!![]}]})[_0x0d8b('0x26')](function(_0x10c7ab){if(_0x10c7ab){for(var _0x8fae7f=0x0;_0x8fae7f<_0x10c7ab[_0x0d8b('0x35')];_0x8fae7f+=0x1){for(var _0xb73e32=0x0;_0xb73e32<_0x10c7ab[_0x8fae7f][_0x0d8b('0x65')][_0x0d8b('0x35')];_0xb73e32+=0x1){_0x302426=_[_0x0d8b('0x66')](_0x302426,[_0x10c7ab[_0x8fae7f][_0x0d8b('0x65')][_0xb73e32]['id']]);}}return _0x302426;}})['then'](function(_0x4dd64b){if(_0x4dd64b){return db[_0x0d8b('0x44')][_0x0d8b('0x48')]({'where':{'id':_0x3f1eee[_0x0d8b('0x47')]['id']}});}})[_0x0d8b('0x26')](function(_0xf91ecd){if(_0xf91ecd){_0x1d173f=_0xf91ecd;return _0x1d173f[_0x0d8b('0x67')](_0x302426,{'penalty':_0x3f1eee[_0x0d8b('0x4b')]['penalty']});}})[_0x0d8b('0x26')](function(_0x4c3948){if(_0x4c3948){return _0x1d173f[_0x0d8b('0x63')](_0x3f1eee['body']['ids']);}})[_0x0d8b('0x26')](handleEntityNotFound(_0x21d620,null))[_0x0d8b('0x26')](respondWithStatusCode(_0x21d620,null))[_0x0d8b('0x49')](handleError(_0x21d620,null));};exports[_0x0d8b('0x68')]=function(_0x2cf02c,_0x2eece2,_0x3c7b9b){var _0x180eda=[];var _0x35267a;return db[_0x0d8b('0x62')][_0x0d8b('0x45')]({'where':{'id':_0x2cf02c[_0x0d8b('0x2f')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x58')],'as':_0x0d8b('0x65'),'attributes':['id'],'raw':!![]}]})[_0x0d8b('0x26')](function(_0x5eba19){if(_0x5eba19){for(var _0x4ce443=0x0;_0x4ce443<_0x5eba19[_0x0d8b('0x35')];_0x4ce443+=0x1){for(var _0x671705=0x0;_0x671705<_0x5eba19[_0x4ce443][_0x0d8b('0x65')][_0x0d8b('0x35')];_0x671705+=0x1){_0x180eda=_[_0x0d8b('0x66')](_0x180eda,[_0x5eba19[_0x4ce443][_0x0d8b('0x65')][_0x671705]['id']]);}}return _0x180eda;}})['then'](function(_0x1a96ce){if(_0x1a96ce){return db[_0x0d8b('0x44')][_0x0d8b('0x48')]({'where':{'id':_0x2cf02c[_0x0d8b('0x47')]['id']}});}})[_0x0d8b('0x26')](function(_0x55ea97){if(_0x55ea97){_0x35267a=_0x55ea97;return _0x35267a['removeAgents'](_0x180eda);}})[_0x0d8b('0x26')](function(_0x41ea29){if(_0x35267a){return _0x35267a[_0x0d8b('0x68')](_0x2cf02c['query'][_0x0d8b('0x64')]);}})[_0x0d8b('0x26')](handleEntityNotFound(_0x2eece2,null))[_0x0d8b('0x26')](respondWithStatusCode(_0x2eece2,null))['catch'](handleError(_0x2eece2,null));};exports[_0x0d8b('0x67')]=function(_0x3bc6d5,_0xeca283,_0x9ec9bc){return db[_0x0d8b('0x44')][_0x0d8b('0x48')]({'where':{'id':_0x3bc6d5[_0x0d8b('0x47')]['id']}})[_0x0d8b('0x26')](handleEntityNotFound(_0xeca283,null))[_0x0d8b('0x26')](function(_0x4bb4c7){if(_0x4bb4c7){return _0x4bb4c7[_0x0d8b('0x67')](_0x3bc6d5[_0x0d8b('0x4b')][_0x0d8b('0x64')],_[_0x0d8b('0x69')](_0x3bc6d5[_0x0d8b('0x4b')],[_0x0d8b('0x64'),'id'])||{})[_0x0d8b('0x6a')](function(_0x673201){for(var _0x35ebba=0x0;_0x35ebba<_0x3bc6d5['body']['ids'][_0x0d8b('0x35')];_0x35ebba+=0x1){socket[_0x0d8b('0x6b')](_0x0d8b('0x6c'),{'UserId':_0x3bc6d5[_0x0d8b('0x4b')]['ids'][_0x35ebba],'OpenchannelQueueId':_0x3bc6d5[_0x0d8b('0x47')]['id']});}return _0x673201;});}})[_0x0d8b('0x26')](respondWithResult(_0xeca283,null))['catch'](handleError(_0xeca283,null));};exports[_0x0d8b('0x6d')]=function(_0x4e1b5b,_0x4fb226,_0x2e5f7a){var _0x33965a;return db[_0x0d8b('0x44')][_0x0d8b('0x48')]({'where':{'id':_0x4e1b5b[_0x0d8b('0x47')]['id']}})[_0x0d8b('0x26')](handleEntityNotFound(_0x4fb226,null))[_0x0d8b('0x26')](function(_0x4ceb3a){if(_0x4ceb3a){return _0x4ceb3a[_0x0d8b('0x6d')](_0x4e1b5b['query']['ids'])[_0x0d8b('0x26')](function(_0x5c50f2){if(_[_0x0d8b('0x6e')](_0x4e1b5b[_0x0d8b('0x2f')]['ids'])){for(var _0x12f2bb=0x0;_0x12f2bb<_0x4e1b5b['query']['ids'][_0x0d8b('0x35')];_0x12f2bb+=0x1){socket[_0x0d8b('0x6b')](_0x0d8b('0x6f'),{'UserId':_0x4e1b5b[_0x0d8b('0x2f')][_0x0d8b('0x64')][_0x12f2bb],'OpenchannelQueueId':_0x4e1b5b['params']['id']});}}else{socket['emit'](_0x0d8b('0x6f'),{'UserId':_0x4e1b5b[_0x0d8b('0x2f')][_0x0d8b('0x64')],'OpenchannelQueueId':_0x4e1b5b[_0x0d8b('0x47')]['id']});}});}})[_0x0d8b('0x26')](respondWithStatusCode(_0x4fb226,null))[_0x0d8b('0x49')](handleError(_0x4fb226,null));};exports[_0x0d8b('0x70')]=function(_0x21bfd1,_0x4e3dd1,_0x5ab046){var _0x3582d3={};var _0x2640a6={};var _0x4a453b;var _0x551995;return db['OpenchannelQueue'][_0x0d8b('0x61')]({'where':{'id':_0x21bfd1[_0x0d8b('0x47')]['id']}})[_0x0d8b('0x26')](handleEntityNotFound(_0x4e3dd1,null))['then'](function(_0x21643d){if(_0x21643d){_0x4a453b=_0x21643d;_0x2640a6[_0x0d8b('0x32')]=_[_0x0d8b('0x2e')](db['User'][_0x0d8b('0x2d')]);_0x2640a6['query']=_[_0x0d8b('0x2e')](_0x21bfd1['query']);_0x2640a6[_0x0d8b('0x30')]=_[_0x0d8b('0x31')](_0x2640a6[_0x0d8b('0x32')],_0x2640a6[_0x0d8b('0x2f')]);_0x3582d3[_0x0d8b('0x33')]=_['intersection'](_0x2640a6[_0x0d8b('0x32')],qs['fields'](_0x21bfd1[_0x0d8b('0x2f')]['fields']));_0x3582d3[_0x0d8b('0x33')]=_0x3582d3['attributes']['length']?_0x3582d3[_0x0d8b('0x33')]:_0x2640a6[_0x0d8b('0x32')];_0x3582d3['order']=qs[_0x0d8b('0x39')](_0x21bfd1[_0x0d8b('0x2f')][_0x0d8b('0x39')]);_0x3582d3['where']=qs['filters'](_['pick'](_0x21bfd1[_0x0d8b('0x2f')],_0x2640a6[_0x0d8b('0x30')]));if(_0x21bfd1[_0x0d8b('0x2f')][_0x0d8b('0x3a')]){_0x3582d3[_0x0d8b('0x3b')]=_[_0x0d8b('0x3c')](_0x3582d3[_0x0d8b('0x3b')],{'$or':_[_0x0d8b('0x57')](_0x3582d3[_0x0d8b('0x33')],function(_0xba602f){var _0x4dc5bd={};_0x4dc5bd[_0xba602f]={'$like':'%'+_0x21bfd1[_0x0d8b('0x2f')][_0x0d8b('0x3a')]+'%'};return _0x4dc5bd;})});}_0x3582d3=_[_0x0d8b('0x3c')]({},_0x3582d3,_0x21bfd1['options']);return _0x4a453b[_0x0d8b('0x70')](_0x3582d3);}})[_0x0d8b('0x26')](function(_0x13bce2){if(_0x13bce2){_0x551995=_0x13bce2[_0x0d8b('0x35')];if(!_0x21bfd1[_0x0d8b('0x2f')][_0x0d8b('0x36')](_0x0d8b('0x37'))){_0x3582d3[_0x0d8b('0x20')]=qs[_0x0d8b('0x20')](_0x21bfd1[_0x0d8b('0x2f')][_0x0d8b('0x20')]);_0x3582d3[_0x0d8b('0x1f')]=qs['offset'](_0x21bfd1[_0x0d8b('0x2f')][_0x0d8b('0x1f')]);}return _0x4a453b[_0x0d8b('0x70')](_0x3582d3);}})[_0x0d8b('0x26')](function(_0x590889){if(_0x590889){return _0x590889?{'count':_0x551995,'rows':_0x590889}:null;}})['then'](respondWithResult(_0x4e3dd1,null))[_0x0d8b('0x49')](handleError(_0x4e3dd1,null));};
\ No newline at end of file
+var _0xd8b0=['length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','key','VIRTUAL','field','options','includeAll','include','OpenchannelQueue','findAll','rows','params','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','describe','getMembers','UserOpenchannelQueue','pick','OpenchannelQueueId','map','User','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','format','SIP','getTeams','findOne','Team','addTeams','ids','Agents','union','addAgents','removeTeams','omit','spread','emit','userOpenchannelQueue:save','removeAgents','isArray','userOpenchannelQueue:remove','getAgents','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','OpenchannelQueues','end','error','name','index','rawAttributes','keys','query','filters','intersection','model','attributes','fields'];(function(_0x4db3de,_0x1a8488){var _0x521438=function(_0x3c7ad5){while(--_0x3c7ad5){_0x4db3de['push'](_0x4db3de['shift']());}};_0x521438(++_0x1a8488);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var authService=require(_0x0d8b('0xe'));var hardwareService=require(_0x0d8b('0xf'));var Redis=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var logger=require(_0x0d8b('0x12'))('api');var utils=require(_0x0d8b('0x13'));var config=require('../../config/environment');var db=require(_0x0d8b('0x14'))['db'];config[_0x0d8b('0x15')]=_[_0x0d8b('0x16')](config[_0x0d8b('0x15')],{'host':_0x0d8b('0x17'),'port':0x18eb});var socket=require(_0x0d8b('0x18'))(new Redis(config[_0x0d8b('0x15')]));require(_0x0d8b('0x19'))[_0x0d8b('0x1a')](socket);function respondWithStatusCode(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xcc;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x1b')](_0x5ad086);}return _0x2ce75e[_0x0d8b('0x1c')](_0x5ad086)['end']();};}function respondWithResult(_0x23eb7b,_0xa86349){_0xa86349=_0xa86349||0xc8;return function(_0x17f7df){if(_0x17f7df){return _0x23eb7b[_0x0d8b('0x1c')](_0xa86349)[_0x0d8b('0x1d')](_0x17f7df);}};}function respondWithFilteredResult(_0x5cd485,_0x106a01){return function(_0x4586c2){if(_0x4586c2){var _0x2fd0fc=_0x4586c2[_0x0d8b('0x1e')],_0x5fecbd=_0x106a01[_0x0d8b('0x1f')],_0x333674=_0x106a01['offset']+_0x106a01[_0x0d8b('0x20')],_0x18dd2d;if(_0x333674>=_0x2fd0fc){_0x333674=_0x2fd0fc;_0x18dd2d=0xc8;}else{_0x18dd2d=0xce;}_0x5cd485[_0x0d8b('0x1c')](_0x18dd2d);return _0x5cd485[_0x0d8b('0x21')](_0x0d8b('0x22'),_0x5fecbd+'-'+_0x333674+'/'+_0x2fd0fc)[_0x0d8b('0x1d')](_0x4586c2);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x23')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x24')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x25')](_0x54a9a7)[_0x0d8b('0x26')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x27')]()[_0x0d8b('0x26')](function(){var _0x27b695=_0x2c64e2['get']({'plain':!![]});var _0xe8bbee=_0x0d8b('0x28');return db['UserProfileResource'][_0x0d8b('0x27')]({'where':{'type':_0xe8bbee,'resourceId':_0x27b695['id']}})['then'](function(){return _0x2c64e2;});})[_0x0d8b('0x26')](function(){_0x38efc8[_0x0d8b('0x1c')](0xcc)[_0x0d8b('0x29')]();});}};}function handleEntityNotFound(_0x4fe6f9,_0x59a905){return function(_0x28f639){if(!_0x28f639){_0x4fe6f9[_0x0d8b('0x1b')](0x194);}return _0x28f639;};}function handleError(_0x4c05ee,_0xcbc4ac){_0xcbc4ac=_0xcbc4ac||0x1f4;return function(_0x59aa83){logger[_0x0d8b('0x2a')](_0x59aa83['stack']);if(_0x59aa83[_0x0d8b('0x2b')]){delete _0x59aa83['name'];}_0x4c05ee[_0x0d8b('0x1c')](_0xcbc4ac)['send'](_0x59aa83);};}exports[_0x0d8b('0x2c')]=function(_0x544735,_0x3c8887){var _0x106e4c={},_0x2c058d={},_0x56120a={'count':0x0,'rows':[]};var _0x4c80a2=db['OpenchannelQueue'][_0x0d8b('0x2d')];_0x2c058d['model']=_[_0x0d8b('0x2e')](_0x4c80a2);_0x2c058d['query']=_['keys'](_0x544735[_0x0d8b('0x2f')]);_0x2c058d[_0x0d8b('0x30')]=_[_0x0d8b('0x31')](_0x2c058d[_0x0d8b('0x32')],_0x2c058d[_0x0d8b('0x2f')]);_0x106e4c[_0x0d8b('0x33')]=_[_0x0d8b('0x31')](_0x2c058d[_0x0d8b('0x32')],qs['fields'](_0x544735[_0x0d8b('0x2f')][_0x0d8b('0x34')]));_0x106e4c['attributes']=_0x106e4c[_0x0d8b('0x33')][_0x0d8b('0x35')]?_0x106e4c[_0x0d8b('0x33')]:_0x2c058d['model'];if(!_0x544735[_0x0d8b('0x2f')][_0x0d8b('0x36')](_0x0d8b('0x37'))){_0x106e4c[_0x0d8b('0x20')]=qs[_0x0d8b('0x20')](_0x544735['query'][_0x0d8b('0x20')]);_0x106e4c[_0x0d8b('0x1f')]=qs['offset'](_0x544735[_0x0d8b('0x2f')][_0x0d8b('0x1f')]);}_0x106e4c[_0x0d8b('0x38')]=qs[_0x0d8b('0x39')](_0x544735[_0x0d8b('0x2f')]['sort']);_0x106e4c['where']=qs[_0x0d8b('0x30')](_['pick'](_0x544735['query'],_0x2c058d[_0x0d8b('0x30')]));if(_0x544735[_0x0d8b('0x2f')][_0x0d8b('0x3a')]){_0x106e4c[_0x0d8b('0x3b')]=_[_0x0d8b('0x3c')](_0x106e4c[_0x0d8b('0x3b')],{'$or':_['map'](_0x4c80a2,function(_0x6e5bab){if(_0x6e5bab[_0x0d8b('0x3d')][_0x0d8b('0x3e')]!==_0x0d8b('0x3f')){var _0x338ed3={};_0x338ed3[_0x6e5bab[_0x0d8b('0x40')]]={'$like':'%'+_0x544735[_0x0d8b('0x2f')]['filter']+'%'};return _0x338ed3;}})});}_0x106e4c=_[_0x0d8b('0x3c')]({},_0x106e4c,_0x544735[_0x0d8b('0x41')]);var _0x3fa955={'where':_0x106e4c[_0x0d8b('0x3b')]};return db['OpenchannelQueue'][_0x0d8b('0x1e')](_0x3fa955)['then'](function(_0x37b26c){_0x56120a[_0x0d8b('0x1e')]=_0x37b26c;if(_0x544735[_0x0d8b('0x2f')][_0x0d8b('0x42')]){_0x106e4c[_0x0d8b('0x43')]=[{'all':!![]}];}return db[_0x0d8b('0x44')][_0x0d8b('0x45')](_0x106e4c);})[_0x0d8b('0x26')](function(_0x89ab0d){_0x56120a[_0x0d8b('0x46')]=_0x89ab0d;return _0x56120a;})['then'](respondWithFilteredResult(_0x3c8887,_0x106e4c))['catch'](handleError(_0x3c8887,null));};exports['show']=function(_0x4d0811,_0x524d79){var _0x1a46f6={'raw':!![],'where':{'id':_0x4d0811[_0x0d8b('0x47')]['id']}},_0x402fe0={};_0x402fe0['model']=_['keys'](db[_0x0d8b('0x44')][_0x0d8b('0x2d')]);_0x402fe0[_0x0d8b('0x2f')]=_['keys'](_0x4d0811[_0x0d8b('0x2f')]);_0x402fe0[_0x0d8b('0x30')]=_['intersection'](_0x402fe0['model'],_0x402fe0[_0x0d8b('0x2f')]);_0x1a46f6['attributes']=_[_0x0d8b('0x31')](_0x402fe0['model'],qs['fields'](_0x4d0811[_0x0d8b('0x2f')][_0x0d8b('0x34')]));_0x1a46f6['attributes']=_0x1a46f6['attributes']['length']?_0x1a46f6['attributes']:_0x402fe0[_0x0d8b('0x32')];if(_0x4d0811[_0x0d8b('0x2f')][_0x0d8b('0x42')]){_0x1a46f6['include']=[{'all':!![]}];}_0x1a46f6=_[_0x0d8b('0x3c')]({},_0x1a46f6,_0x4d0811[_0x0d8b('0x41')]);return db[_0x0d8b('0x44')][_0x0d8b('0x48')](_0x1a46f6)[_0x0d8b('0x26')](handleEntityNotFound(_0x524d79,null))[_0x0d8b('0x26')](respondWithResult(_0x524d79,null))[_0x0d8b('0x49')](handleError(_0x524d79,null));};exports[_0x0d8b('0x4a')]=function(_0x384a5e,_0x1f2077){return db[_0x0d8b('0x44')][_0x0d8b('0x4a')](_0x384a5e[_0x0d8b('0x4b')],{})[_0x0d8b('0x26')](function(_0x570af8){var _0xdfcf32=_0x384a5e[_0x0d8b('0x4c')][_0x0d8b('0x4d')]({'plain':!![]});if(!_0xdfcf32)throw new Error(_0x0d8b('0x4e'));if(_0xdfcf32['role']===_0x0d8b('0x4c')){var _0x4d8850=_0x570af8['get']({'plain':!![]});var _0x39a31d=_0x0d8b('0x28');return db[_0x0d8b('0x4f')][_0x0d8b('0x48')]({'where':{'name':_0x39a31d,'userProfileId':_0xdfcf32['userProfileId']},'raw':!![]})[_0x0d8b('0x26')](function(_0x1106d6){if(_0x1106d6&&_0x1106d6[_0x0d8b('0x50')]===0x0){return db[_0x0d8b('0x51')][_0x0d8b('0x4a')]({'name':_0x4d8850['name'],'resourceId':_0x4d8850['id'],'type':_0x1106d6['name'],'sectionId':_0x1106d6['id']},{})['then'](function(){return _0x570af8;});}else{return _0x570af8;}})['catch'](function(_0x368ede){logger[_0x0d8b('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x368ede);throw _0x368ede;});}return _0x570af8;})['then'](respondWithResult(_0x1f2077,0xc9))[_0x0d8b('0x49')](handleError(_0x1f2077,null));};exports[_0x0d8b('0x25')]=function(_0x5c5bd7,_0x5ef6c3){if(_0x5c5bd7[_0x0d8b('0x4b')]['id']){delete _0x5c5bd7[_0x0d8b('0x4b')]['id'];}return db[_0x0d8b('0x44')][_0x0d8b('0x48')]({'where':{'id':_0x5c5bd7[_0x0d8b('0x47')]['id']}})['then'](handleEntityNotFound(_0x5ef6c3,null))[_0x0d8b('0x26')](saveUpdates(_0x5c5bd7[_0x0d8b('0x4b')],null))['then'](respondWithResult(_0x5ef6c3,null))['catch'](handleError(_0x5ef6c3,null));};exports[_0x0d8b('0x27')]=function(_0x3f2d95,_0x546fef){return db['OpenchannelQueue'][_0x0d8b('0x48')]({'where':{'id':_0x3f2d95[_0x0d8b('0x47')]['id']}})[_0x0d8b('0x26')](handleEntityNotFound(_0x546fef,null))[_0x0d8b('0x26')](removeEntity(_0x546fef,null))['catch'](handleError(_0x546fef,null));};exports[_0x0d8b('0x52')]=function(_0x598e03,_0x5c271c){return db[_0x0d8b('0x44')][_0x0d8b('0x52')]()['then'](respondWithResult(_0x5c271c,null))['catch'](handleError(_0x5c271c,null));};exports[_0x0d8b('0x53')]=function(_0x3d7161,_0xccc2a9,_0x2c1eb0){var _0x3afc3a={'raw':!![],'where':{}},_0xb66e76={},_0x3978e5;return db[_0x0d8b('0x44')]['findOne']({'where':{'id':_0x3d7161[_0x0d8b('0x47')]['id']}})[_0x0d8b('0x26')](handleEntityNotFound(_0xccc2a9,null))[_0x0d8b('0x26')](function(_0x3c7efb){if(_0x3c7efb){_0x3978e5=_0x3c7efb[_0x0d8b('0x4d')]({'plain':!![]});_0xb66e76[_0x0d8b('0x32')]=_[_0x0d8b('0x2e')](db[_0x0d8b('0x54')][_0x0d8b('0x2d')]);_0xb66e76['query']=_[_0x0d8b('0x2e')](_0x3d7161[_0x0d8b('0x2f')]);_0xb66e76[_0x0d8b('0x30')]=_[_0x0d8b('0x31')](_0xb66e76[_0x0d8b('0x32')],_0xb66e76['query']);_0x3afc3a[_0x0d8b('0x33')]=_[_0x0d8b('0x31')](_0xb66e76[_0x0d8b('0x32')],qs[_0x0d8b('0x34')](_0x3d7161[_0x0d8b('0x2f')]['fields']));_0x3afc3a['attributes']=_0x3afc3a[_0x0d8b('0x33')][_0x0d8b('0x35')]?_0x3afc3a[_0x0d8b('0x33')]:_0xb66e76[_0x0d8b('0x32')];if(!_0x3d7161['query'][_0x0d8b('0x36')](_0x0d8b('0x37'))){_0x3afc3a[_0x0d8b('0x20')]=qs['limit'](_0x3d7161[_0x0d8b('0x2f')]['limit']);_0x3afc3a[_0x0d8b('0x1f')]=qs[_0x0d8b('0x1f')](_0x3d7161[_0x0d8b('0x2f')][_0x0d8b('0x1f')]);}_0x3afc3a[_0x0d8b('0x38')]=qs[_0x0d8b('0x39')](_0x3d7161['query'][_0x0d8b('0x39')]);_0x3afc3a['where']=qs[_0x0d8b('0x30')](_[_0x0d8b('0x55')](_0x3d7161[_0x0d8b('0x2f')],_0xb66e76[_0x0d8b('0x30')]));_0x3afc3a['where'][_0x0d8b('0x56')]=_0x3c7efb['id'];if(_0x3d7161[_0x0d8b('0x2f')][_0x0d8b('0x3a')]){_0x3afc3a[_0x0d8b('0x3b')]=_[_0x0d8b('0x3c')](_0x3afc3a[_0x0d8b('0x3b')],{'$or':_[_0x0d8b('0x57')](_0x3afc3a[_0x0d8b('0x33')],function(_0x2ce282){var _0x34affb={};_0x34affb[_0x2ce282]={'$like':'%'+_0x3d7161['query']['filter']+'%'};return _0x34affb;})});}_0x3afc3a=_[_0x0d8b('0x3c')]({},_0x3afc3a,_0x3d7161[_0x0d8b('0x41')]);return db['UserOpenchannelQueue'][_0x0d8b('0x45')](_0x3afc3a);}})['then'](function(_0x5cc960){if(_0x5cc960){return db[_0x0d8b('0x58')][_0x0d8b('0x59')]({'where':{'id':_['map'](_0x5cc960,'UserId'),'role':_0x0d8b('0x5a')},'attributes':['id',_0x0d8b('0x2b'),_0x0d8b('0x5b'),_0x0d8b('0x5c'),_0x0d8b('0x5d')]});}})[_0x0d8b('0x26')](function(_0x40d265){if(_0x40d265){return{'count':_0x40d265['count'],'rows':_[_0x0d8b('0x57')](_0x40d265['rows'],function(_0x1a203e){return{'membername':_0x1a203e[_0x0d8b('0x2b')],'UserId':_0x1a203e['id'],'queue_name':_0x3978e5[_0x0d8b('0x2b')],'OpenchannelQueueId':_0x3978e5['id'],'interface':util[_0x0d8b('0x5e')]('%s/%s',_0x0d8b('0x5f'),_0x1a203e['name']),'penalty':0x0,'paused':_0x1a203e[_0x0d8b('0x5b')],'createdAt':_0x1a203e[_0x0d8b('0x5d')],'updatedAt':_0x1a203e[_0x0d8b('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0d8b('0x26')](respondWithFilteredResult(_0xccc2a9,_0x3afc3a))[_0x0d8b('0x49')](handleError(_0xccc2a9,null));};exports[_0x0d8b('0x60')]=function(_0x3e927c,_0x91aa89,_0x266a69){var _0x44aa74={};var _0x4eb07e={};var _0x1436b3;var _0x54c28b;return db[_0x0d8b('0x44')][_0x0d8b('0x61')]({'where':{'id':_0x3e927c['params']['id']}})[_0x0d8b('0x26')](handleEntityNotFound(_0x91aa89,null))['then'](function(_0x10c318){if(_0x10c318){_0x1436b3=_0x10c318;_0x4eb07e[_0x0d8b('0x32')]=_[_0x0d8b('0x2e')](db[_0x0d8b('0x62')][_0x0d8b('0x2d')]);_0x4eb07e[_0x0d8b('0x2f')]=_[_0x0d8b('0x2e')](_0x3e927c[_0x0d8b('0x2f')]);_0x4eb07e['filters']=_[_0x0d8b('0x31')](_0x4eb07e[_0x0d8b('0x32')],_0x4eb07e['query']);_0x44aa74[_0x0d8b('0x33')]=_[_0x0d8b('0x31')](_0x4eb07e[_0x0d8b('0x32')],qs[_0x0d8b('0x34')](_0x3e927c[_0x0d8b('0x2f')][_0x0d8b('0x34')]));_0x44aa74[_0x0d8b('0x33')]=_0x44aa74[_0x0d8b('0x33')][_0x0d8b('0x35')]?_0x44aa74[_0x0d8b('0x33')]:_0x4eb07e[_0x0d8b('0x32')];_0x44aa74[_0x0d8b('0x38')]=qs['sort'](_0x3e927c[_0x0d8b('0x2f')][_0x0d8b('0x39')]);_0x44aa74[_0x0d8b('0x3b')]=qs['filters'](_['pick'](_0x3e927c[_0x0d8b('0x2f')],_0x4eb07e[_0x0d8b('0x30')]));if(_0x3e927c[_0x0d8b('0x2f')]['filter']){_0x44aa74['where']=_[_0x0d8b('0x3c')](_0x44aa74[_0x0d8b('0x3b')],{'$or':_[_0x0d8b('0x57')](_0x44aa74[_0x0d8b('0x33')],function(_0x2a2b58){var _0x3f7895={};_0x3f7895[_0x2a2b58]={'$like':'%'+_0x3e927c[_0x0d8b('0x2f')][_0x0d8b('0x3a')]+'%'};return _0x3f7895;})});}_0x44aa74=_[_0x0d8b('0x3c')]({},_0x44aa74,_0x3e927c[_0x0d8b('0x41')]);return _0x1436b3[_0x0d8b('0x60')](_0x44aa74);}})[_0x0d8b('0x26')](function(_0x3b060e){if(_0x3b060e){_0x54c28b=_0x3b060e['length'];if(!_0x3e927c[_0x0d8b('0x2f')][_0x0d8b('0x36')]('nolimit')){_0x44aa74['limit']=qs[_0x0d8b('0x20')](_0x3e927c[_0x0d8b('0x2f')][_0x0d8b('0x20')]);_0x44aa74[_0x0d8b('0x1f')]=qs[_0x0d8b('0x1f')](_0x3e927c[_0x0d8b('0x2f')]['offset']);}return _0x1436b3['getTeams'](_0x44aa74);}})['then'](function(_0x1f1eae){if(_0x1f1eae){return _0x1f1eae?{'count':_0x54c28b,'rows':_0x1f1eae}:null;}})[_0x0d8b('0x26')](respondWithResult(_0x91aa89,null))[_0x0d8b('0x49')](handleError(_0x91aa89,null));};exports[_0x0d8b('0x63')]=function(_0x3f1eee,_0x21d620,_0x5ef461){var _0x302426=[];var _0x1d173f;return db['Team'][_0x0d8b('0x45')]({'where':{'id':_0x3f1eee['body'][_0x0d8b('0x64')]},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x58')],'as':_0x0d8b('0x65'),'attributes':['id'],'raw':!![]}]})[_0x0d8b('0x26')](function(_0x10c7ab){if(_0x10c7ab){for(var _0x8fae7f=0x0;_0x8fae7f<_0x10c7ab[_0x0d8b('0x35')];_0x8fae7f+=0x1){for(var _0xb73e32=0x0;_0xb73e32<_0x10c7ab[_0x8fae7f][_0x0d8b('0x65')][_0x0d8b('0x35')];_0xb73e32+=0x1){_0x302426=_[_0x0d8b('0x66')](_0x302426,[_0x10c7ab[_0x8fae7f][_0x0d8b('0x65')][_0xb73e32]['id']]);}}return _0x302426;}})['then'](function(_0x4dd64b){if(_0x4dd64b){return db[_0x0d8b('0x44')][_0x0d8b('0x48')]({'where':{'id':_0x3f1eee[_0x0d8b('0x47')]['id']}});}})[_0x0d8b('0x26')](function(_0xf91ecd){if(_0xf91ecd){_0x1d173f=_0xf91ecd;return _0x1d173f[_0x0d8b('0x67')](_0x302426,{'penalty':_0x3f1eee[_0x0d8b('0x4b')]['penalty']});}})[_0x0d8b('0x26')](function(_0x4c3948){if(_0x4c3948){return _0x1d173f[_0x0d8b('0x63')](_0x3f1eee['body']['ids']);}})[_0x0d8b('0x26')](handleEntityNotFound(_0x21d620,null))[_0x0d8b('0x26')](respondWithStatusCode(_0x21d620,null))[_0x0d8b('0x49')](handleError(_0x21d620,null));};exports[_0x0d8b('0x68')]=function(_0x2cf02c,_0x2eece2,_0x3c7b9b){var _0x180eda=[];var _0x35267a;return db[_0x0d8b('0x62')][_0x0d8b('0x45')]({'where':{'id':_0x2cf02c[_0x0d8b('0x2f')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x58')],'as':_0x0d8b('0x65'),'attributes':['id'],'raw':!![]}]})[_0x0d8b('0x26')](function(_0x5eba19){if(_0x5eba19){for(var _0x4ce443=0x0;_0x4ce443<_0x5eba19[_0x0d8b('0x35')];_0x4ce443+=0x1){for(var _0x671705=0x0;_0x671705<_0x5eba19[_0x4ce443][_0x0d8b('0x65')][_0x0d8b('0x35')];_0x671705+=0x1){_0x180eda=_[_0x0d8b('0x66')](_0x180eda,[_0x5eba19[_0x4ce443][_0x0d8b('0x65')][_0x671705]['id']]);}}return _0x180eda;}})['then'](function(_0x1a96ce){if(_0x1a96ce){return db[_0x0d8b('0x44')][_0x0d8b('0x48')]({'where':{'id':_0x2cf02c[_0x0d8b('0x47')]['id']}});}})[_0x0d8b('0x26')](function(_0x55ea97){if(_0x55ea97){_0x35267a=_0x55ea97;return _0x35267a['removeAgents'](_0x180eda);}})[_0x0d8b('0x26')](function(_0x41ea29){if(_0x35267a){return _0x35267a[_0x0d8b('0x68')](_0x2cf02c['query'][_0x0d8b('0x64')]);}})[_0x0d8b('0x26')](handleEntityNotFound(_0x2eece2,null))[_0x0d8b('0x26')](respondWithStatusCode(_0x2eece2,null))['catch'](handleError(_0x2eece2,null));};exports[_0x0d8b('0x67')]=function(_0x3bc6d5,_0xeca283,_0x9ec9bc){return db[_0x0d8b('0x44')][_0x0d8b('0x48')]({'where':{'id':_0x3bc6d5[_0x0d8b('0x47')]['id']}})[_0x0d8b('0x26')](handleEntityNotFound(_0xeca283,null))[_0x0d8b('0x26')](function(_0x4bb4c7){if(_0x4bb4c7){return _0x4bb4c7[_0x0d8b('0x67')](_0x3bc6d5[_0x0d8b('0x4b')][_0x0d8b('0x64')],_[_0x0d8b('0x69')](_0x3bc6d5[_0x0d8b('0x4b')],[_0x0d8b('0x64'),'id'])||{})[_0x0d8b('0x6a')](function(_0x673201){for(var _0x35ebba=0x0;_0x35ebba<_0x3bc6d5['body']['ids'][_0x0d8b('0x35')];_0x35ebba+=0x1){socket[_0x0d8b('0x6b')](_0x0d8b('0x6c'),{'UserId':_0x3bc6d5[_0x0d8b('0x4b')]['ids'][_0x35ebba],'OpenchannelQueueId':_0x3bc6d5[_0x0d8b('0x47')]['id']});}return _0x673201;});}})[_0x0d8b('0x26')](respondWithResult(_0xeca283,null))['catch'](handleError(_0xeca283,null));};exports[_0x0d8b('0x6d')]=function(_0x4e1b5b,_0x4fb226,_0x2e5f7a){var _0x33965a;return db[_0x0d8b('0x44')][_0x0d8b('0x48')]({'where':{'id':_0x4e1b5b[_0x0d8b('0x47')]['id']}})[_0x0d8b('0x26')](handleEntityNotFound(_0x4fb226,null))[_0x0d8b('0x26')](function(_0x4ceb3a){if(_0x4ceb3a){return _0x4ceb3a[_0x0d8b('0x6d')](_0x4e1b5b['query']['ids'])[_0x0d8b('0x26')](function(_0x5c50f2){if(_[_0x0d8b('0x6e')](_0x4e1b5b[_0x0d8b('0x2f')]['ids'])){for(var _0x12f2bb=0x0;_0x12f2bb<_0x4e1b5b['query']['ids'][_0x0d8b('0x35')];_0x12f2bb+=0x1){socket[_0x0d8b('0x6b')](_0x0d8b('0x6f'),{'UserId':_0x4e1b5b[_0x0d8b('0x2f')][_0x0d8b('0x64')][_0x12f2bb],'OpenchannelQueueId':_0x4e1b5b['params']['id']});}}else{socket['emit'](_0x0d8b('0x6f'),{'UserId':_0x4e1b5b[_0x0d8b('0x2f')][_0x0d8b('0x64')],'OpenchannelQueueId':_0x4e1b5b[_0x0d8b('0x47')]['id']});}});}})[_0x0d8b('0x26')](respondWithStatusCode(_0x4fb226,null))[_0x0d8b('0x49')](handleError(_0x4fb226,null));};exports[_0x0d8b('0x70')]=function(_0x21bfd1,_0x4e3dd1,_0x5ab046){var _0x3582d3={};var _0x2640a6={};var _0x4a453b;var _0x551995;return db['OpenchannelQueue'][_0x0d8b('0x61')]({'where':{'id':_0x21bfd1[_0x0d8b('0x47')]['id']}})[_0x0d8b('0x26')](handleEntityNotFound(_0x4e3dd1,null))['then'](function(_0x21643d){if(_0x21643d){_0x4a453b=_0x21643d;_0x2640a6[_0x0d8b('0x32')]=_[_0x0d8b('0x2e')](db['User'][_0x0d8b('0x2d')]);_0x2640a6['query']=_[_0x0d8b('0x2e')](_0x21bfd1['query']);_0x2640a6[_0x0d8b('0x30')]=_[_0x0d8b('0x31')](_0x2640a6[_0x0d8b('0x32')],_0x2640a6[_0x0d8b('0x2f')]);_0x3582d3[_0x0d8b('0x33')]=_['intersection'](_0x2640a6[_0x0d8b('0x32')],qs['fields'](_0x21bfd1[_0x0d8b('0x2f')]['fields']));_0x3582d3[_0x0d8b('0x33')]=_0x3582d3['attributes']['length']?_0x3582d3[_0x0d8b('0x33')]:_0x2640a6[_0x0d8b('0x32')];_0x3582d3['order']=qs[_0x0d8b('0x39')](_0x21bfd1[_0x0d8b('0x2f')][_0x0d8b('0x39')]);_0x3582d3['where']=qs['filters'](_['pick'](_0x21bfd1[_0x0d8b('0x2f')],_0x2640a6[_0x0d8b('0x30')]));if(_0x21bfd1[_0x0d8b('0x2f')][_0x0d8b('0x3a')]){_0x3582d3[_0x0d8b('0x3b')]=_[_0x0d8b('0x3c')](_0x3582d3[_0x0d8b('0x3b')],{'$or':_[_0x0d8b('0x57')](_0x3582d3[_0x0d8b('0x33')],function(_0xba602f){var _0x4dc5bd={};_0x4dc5bd[_0xba602f]={'$like':'%'+_0x21bfd1[_0x0d8b('0x2f')][_0x0d8b('0x3a')]+'%'};return _0x4dc5bd;})});}_0x3582d3=_[_0x0d8b('0x3c')]({},_0x3582d3,_0x21bfd1['options']);return _0x4a453b[_0x0d8b('0x70')](_0x3582d3);}})[_0x0d8b('0x26')](function(_0x13bce2){if(_0x13bce2){_0x551995=_0x13bce2[_0x0d8b('0x35')];if(!_0x21bfd1[_0x0d8b('0x2f')][_0x0d8b('0x36')](_0x0d8b('0x37'))){_0x3582d3[_0x0d8b('0x20')]=qs[_0x0d8b('0x20')](_0x21bfd1[_0x0d8b('0x2f')][_0x0d8b('0x20')]);_0x3582d3[_0x0d8b('0x1f')]=qs['offset'](_0x21bfd1[_0x0d8b('0x2f')][_0x0d8b('0x1f')]);}return _0x4a453b[_0x0d8b('0x70')](_0x3582d3);}})[_0x0d8b('0x26')](function(_0x590889){if(_0x590889){return _0x590889?{'count':_0x551995,'rows':_0x590889}:null;}})['then'](respondWithResult(_0x4e3dd1,null))[_0x0d8b('0x49')](handleError(_0x4e3dd1,null));};
\ No newline at end of file
index cdbeb03..055b9d4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdda4=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x28e74e,_0x53fdf1){var _0xb45ac1=function(_0x311a7a){while(--_0x311a7a){_0x28e74e['push'](_0x28e74e['shift']());}};_0xb45ac1(++_0x53fdf1);}(_0xdda4,0x189));var _0x4dda=function(_0x3f00ee,_0x1d1673){_0x3f00ee=_0x3f00ee-0x0;var _0x18a07e=_0xdda4[_0x3f00ee];return _0x18a07e;};'use strict';var EventEmitter=require(_0x4dda('0x0'));var OpenchannelQueue=require(_0x4dda('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x4dda('0x2')](0x0);var events={'afterCreate':_0x4dda('0x3'),'afterUpdate':_0x4dda('0x4'),'afterDestroy':'remove'};function emitEvent(_0x381ffb){return function(_0x101f20,_0xc7c019,_0x91b0ba){OpenchannelQueueEvents[_0x4dda('0x5')](_0x381ffb+':'+_0x101f20['id'],_0x101f20);OpenchannelQueueEvents['emit'](_0x381ffb,_0x101f20);_0x91b0ba(null);};}for(var e in events){if(events[_0x4dda('0x6')](e)){var event=events[e];OpenchannelQueue[_0x4dda('0x7')](e,emitEvent(event));}}module[_0x4dda('0x8')]=OpenchannelQueueEvents;
\ No newline at end of file
+var _0x87dc=['hasOwnProperty','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit'];(function(_0x2cd980,_0x1c026a){var _0x316ea6=function(_0x45d6de){while(--_0x45d6de){_0x2cd980['push'](_0x2cd980['shift']());}};_0x316ea6(++_0x1c026a);}(_0x87dc,0x110));var _0xc87d=function(_0x1b43ed,_0x43468a){_0x1b43ed=_0x1b43ed-0x0;var _0x1d0a5c=_0x87dc[_0x1b43ed];return _0x1d0a5c;};'use strict';var EventEmitter=require(_0xc87d('0x0'));var OpenchannelQueue=require(_0xc87d('0x1'))['db'][_0xc87d('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xc87d('0x3')](0x0);var events={'afterCreate':_0xc87d('0x4'),'afterUpdate':_0xc87d('0x5'),'afterDestroy':_0xc87d('0x6')};function emitEvent(_0xcbb22){return function(_0xdf2b15,_0x222c55,_0x49099c){OpenchannelQueueEvents[_0xc87d('0x7')](_0xcbb22+':'+_0xdf2b15['id'],_0xdf2b15);OpenchannelQueueEvents['emit'](_0xcbb22,_0xdf2b15);_0x49099c(null);};}for(var e in events){if(events[_0xc87d('0x8')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0xc87d('0x9')]=OpenchannelQueueEvents;
\ No newline at end of file
index 139a0bd..322c72f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf4eb=['OpenchannelQueue','openchannel_queues','lodash','bluebird','exports','define'];(function(_0x1039b3,_0x46cf35){var _0x334b16=function(_0x2119ad){while(--_0x2119ad){_0x1039b3['push'](_0x1039b3['shift']());}};_0x334b16(++_0x46cf35);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3dac80,_0x3d7a35){_0x3dac80=_0x3dac80-0x0;var _0x48148f=_0xf4eb[_0x3dac80];return _0x48148f;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbf4e('0x1'));var rp=require('request-promise');var attributes=require('./openchannelQueue.attributes');module[_0xbf4e('0x2')]=function(_0x1c7606,_0x32d1d7){return _0x1c7606[_0xbf4e('0x3')](_0xbf4e('0x4'),attributes,{'tableName':_0xbf4e('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xe13a=['request-promise','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','util','../../config/logger','api','moment'];(function(_0xc97133,_0x4eb84b){var _0x3e7d95=function(_0x7120d2){while(--_0x7120d2){_0xc97133['push'](_0xc97133['shift']());}};_0x3e7d95(++_0x4eb84b);}(_0xe13a,0x178));var _0xae13=function(_0x5166a5,_0x3f0883){_0x5166a5=_0x5166a5-0x0;var _0x4c3b7e=_0xe13a[_0x5166a5];return _0x4c3b7e;};'use strict';var _=require('lodash');var util=require(_0xae13('0x0'));var logger=require(_0xae13('0x1'))(_0xae13('0x2'));var moment=require(_0xae13('0x3'));var BPromise=require('bluebird');var rp=require(_0xae13('0x4'));var attributes=require(_0xae13('0x5'));module[_0xae13('0x6')]=function(_0x10abd7,_0x28a89a){return _0x10abd7[_0xae13('0x7')](_0xae13('0x8'),attributes,{'tableName':_0xae13('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 50b3774..7f74237 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc5c7=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','localhost','redis','./openchannelQueue.socket','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','where','attributes','limit','include','map','model','ShowOpenchannelQueue','raw','util','moment','bluebird','randomstring','ioredis'];(function(_0x326aa7,_0x12dceb){var _0x3955b2=function(_0x1fc290){while(--_0x1fc290){_0x326aa7['push'](_0x326aa7['shift']());}};_0x3955b2(++_0x12dceb);}(_0xc5c7,0x1cf));var _0x7c5c=function(_0x420417,_0x2cf536){_0x420417=_0x420417-0x0;var _0x36e1e0=_0xc5c7[_0x420417];return _0x36e1e0;};'use strict';var _=require('lodash');var util=require(_0x7c5c('0x0'));var moment=require(_0x7c5c('0x1'));var BPromise=require(_0x7c5c('0x2'));var rs=require(_0x7c5c('0x3'));var fs=require('fs');var Redis=require(_0x7c5c('0x4'));var db=require(_0x7c5c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c5c('0x6'))(_0x7c5c('0x7'));var config=require(_0x7c5c('0x8'));var jayson=require(_0x7c5c('0x9'));var client=jayson[_0x7c5c('0xa')]['http']({'port':0x232a});config['redis']=_[_0x7c5c('0xb')](config['redis'],{'host':_0x7c5c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7c5c('0xd')]));require(_0x7c5c('0xe'))['register'](socket);function respondWithRpcPromise(_0x4f0093,_0x17597c,_0x1cd540){return new BPromise(function(_0x5c7073,_0x39fbdf){return client['request'](_0x4f0093,_0x1cd540)[_0x7c5c('0xf')](function(_0x5bb950){logger[_0x7c5c('0x10')](_0x7c5c('0x11'),_0x17597c,'request\x20sent');logger[_0x7c5c('0x12')](_0x7c5c('0x13'),_0x17597c,_0x7c5c('0x14'),JSON[_0x7c5c('0x15')](_0x5bb950));if(_0x5bb950[_0x7c5c('0x16')]){if(_0x5bb950[_0x7c5c('0x16')][_0x7c5c('0x17')]===0x1f4){logger[_0x7c5c('0x16')](_0x7c5c('0x11'),_0x17597c,_0x5bb950[_0x7c5c('0x16')][_0x7c5c('0x18')]);return _0x39fbdf(_0x5bb950[_0x7c5c('0x16')][_0x7c5c('0x18')]);}logger[_0x7c5c('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x17597c,_0x5bb950['error'][_0x7c5c('0x18')]);return _0x5c7073(_0x5bb950[_0x7c5c('0x16')][_0x7c5c('0x18')]);}else{logger[_0x7c5c('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x17597c,_0x7c5c('0x14'));_0x5c7073(_0x5bb950[_0x7c5c('0x19')][_0x7c5c('0x18')]);}})[_0x7c5c('0x1a')](function(_0x1215a3){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x17597c,_0x1215a3);_0x39fbdf(_0x1215a3);});});}exports[_0x7c5c('0x1b')]=function(_0x32f191){var _0x2a5877=this;return new Promise(function(_0x5e821e,_0x170896){return db[_0x7c5c('0x1c')][_0x7c5c('0x1d')]({'raw':_0x32f191[_0x7c5c('0x1e')]?_0x32f191[_0x7c5c('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x32f191[_0x7c5c('0x1e')]?_0x32f191[_0x7c5c('0x1e')][_0x7c5c('0x1f')]||null:null,'attributes':_0x32f191['options']?_0x32f191[_0x7c5c('0x1e')][_0x7c5c('0x20')]||null:null,'limit':_0x32f191['options']?_0x32f191[_0x7c5c('0x1e')][_0x7c5c('0x21')]||null:null,'include':_0x32f191[_0x7c5c('0x1e')]?_0x32f191[_0x7c5c('0x1e')][_0x7c5c('0x22')]?_[_0x7c5c('0x23')](_0x32f191[_0x7c5c('0x1e')][_0x7c5c('0x22')],function(_0x4673f8){return{'model':db[_0x4673f8[_0x7c5c('0x24')]],'as':_0x4673f8['as'],'attributes':_0x4673f8[_0x7c5c('0x20')],'include':_0x4673f8['include']?_[_0x7c5c('0x23')](_0x4673f8['include'],function(_0x5a5402){return{'model':db[_0x5a5402[_0x7c5c('0x24')]],'as':_0x5a5402['as'],'attributes':_0x5a5402['attributes'],'include':_0x5a5402[_0x7c5c('0x22')]?_[_0x7c5c('0x23')](_0x5a5402[_0x7c5c('0x22')],function(_0x1b8d20){return{'model':db[_0x1b8d20['model']],'as':_0x1b8d20['as'],'attributes':_0x1b8d20['attributes']};}):[]};}):[]};}):[]:[]})[_0x7c5c('0xf')](function(_0x1467fa){logger[_0x7c5c('0x10')](_0x7c5c('0x1b'),_0x32f191);logger['debug'](_0x7c5c('0x1b'),_0x32f191,JSON[_0x7c5c('0x15')](_0x1467fa));_0x5e821e(_0x1467fa);})[_0x7c5c('0x1a')](function(_0x36bf25){logger[_0x7c5c('0x16')](_0x7c5c('0x1b'),_0x36bf25[_0x7c5c('0x18')],_0x32f191);_0x170896(_0x2a5877['error'](0x1f4,_0x36bf25[_0x7c5c('0x18')]));});});};exports[_0x7c5c('0x25')]=function(_0x56a073){var _0x34b6a0=this;return new Promise(function(_0x382215,_0x300e6c){return db[_0x7c5c('0x1c')]['find']({'raw':_0x56a073[_0x7c5c('0x1e')]?_0x56a073['options'][_0x7c5c('0x26')]===undefined?!![]:![]:!![],'where':_0x56a073[_0x7c5c('0x1e')]?_0x56a073['options'][_0x7c5c('0x1f')]||null:null,'attributes':_0x56a073[_0x7c5c('0x1e')]?_0x56a073[_0x7c5c('0x1e')]['attributes']||null:null,'include':_0x56a073['options']?_0x56a073[_0x7c5c('0x1e')][_0x7c5c('0x22')]?_['map'](_0x56a073['options'][_0x7c5c('0x22')],function(_0x49e8ee){return{'model':db[_0x49e8ee[_0x7c5c('0x24')]],'as':_0x49e8ee['as'],'attributes':_0x49e8ee[_0x7c5c('0x20')],'include':_0x49e8ee[_0x7c5c('0x22')]?_[_0x7c5c('0x23')](_0x49e8ee[_0x7c5c('0x22')],function(_0x12c320){return{'model':db[_0x12c320['model']],'as':_0x12c320['as'],'attributes':_0x12c320[_0x7c5c('0x20')],'include':_0x12c320['include']?_[_0x7c5c('0x23')](_0x12c320[_0x7c5c('0x22')],function(_0x2490de){return{'model':db[_0x2490de['model']],'as':_0x2490de['as'],'attributes':_0x2490de[_0x7c5c('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7c5c('0xf')](function(_0xf8bf29){logger[_0x7c5c('0x10')](_0x7c5c('0x25'),_0x56a073);logger[_0x7c5c('0x12')](_0x7c5c('0x25'),_0x56a073,JSON[_0x7c5c('0x15')](_0xf8bf29));_0x382215(_0xf8bf29);})['catch'](function(_0x46076e){logger[_0x7c5c('0x16')](_0x7c5c('0x25'),_0x46076e[_0x7c5c('0x18')],_0x56a073);_0x300e6c(_0x34b6a0[_0x7c5c('0x16')](0x1f4,_0x46076e[_0x7c5c('0x18')]));});});};
\ No newline at end of file
+var _0x07c3=['code','message','info','request\x20sent','result','catch','OpenchannelQueue','options','attributes','limit','include','map','model','GetOpenchannelQueue','find','raw','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3bff0d,_0x1b280b){var _0x477181=function(_0x40b501){while(--_0x40b501){_0x3bff0d['push'](_0x3bff0d['shift']());}};_0x477181(++_0x1b280b);}(_0x07c3,0x1bf));var _0x307c=function(_0x1e7ead,_0x7f6227){_0x1e7ead=_0x1e7ead-0x0;var _0x3912b2=_0x07c3[_0x1e7ead];return _0x3912b2;};'use strict';var _=require(_0x307c('0x0'));var util=require(_0x307c('0x1'));var moment=require(_0x307c('0x2'));var BPromise=require(_0x307c('0x3'));var rs=require(_0x307c('0x4'));var fs=require('fs');var Redis=require(_0x307c('0x5'));var db=require(_0x307c('0x6'))['db'];var utils=require(_0x307c('0x7'));var logger=require('../../config/logger')(_0x307c('0x8'));var config=require(_0x307c('0x9'));var jayson=require(_0x307c('0xa'));var client=jayson[_0x307c('0xb')][_0x307c('0xc')]({'port':0x232a});config[_0x307c('0xd')]=_[_0x307c('0xe')](config[_0x307c('0xd')],{'host':_0x307c('0xf'),'port':0x18eb});var socket=require(_0x307c('0x10'))(new Redis(config[_0x307c('0xd')]));require(_0x307c('0x11'))[_0x307c('0x12')](socket);function respondWithRpcPromise(_0x352f5a,_0x3c4a4c,_0x5d2d0f){return new BPromise(function(_0x8777ee,_0xe8236d){return client[_0x307c('0x13')](_0x352f5a,_0x5d2d0f)[_0x307c('0x14')](function(_0x4c1b82){logger['info'](_0x307c('0x15'),_0x3c4a4c,'request\x20sent');logger[_0x307c('0x16')](_0x307c('0x17'),_0x3c4a4c,'request\x20sent',JSON[_0x307c('0x18')](_0x4c1b82));if(_0x4c1b82[_0x307c('0x19')]){if(_0x4c1b82[_0x307c('0x19')][_0x307c('0x1a')]===0x1f4){logger[_0x307c('0x19')](_0x307c('0x15'),_0x3c4a4c,_0x4c1b82[_0x307c('0x19')][_0x307c('0x1b')]);return _0xe8236d(_0x4c1b82[_0x307c('0x19')][_0x307c('0x1b')]);}logger[_0x307c('0x19')](_0x307c('0x15'),_0x3c4a4c,_0x4c1b82['error'][_0x307c('0x1b')]);return _0x8777ee(_0x4c1b82[_0x307c('0x19')][_0x307c('0x1b')]);}else{logger[_0x307c('0x1c')](_0x307c('0x15'),_0x3c4a4c,_0x307c('0x1d'));_0x8777ee(_0x4c1b82[_0x307c('0x1e')][_0x307c('0x1b')]);}})[_0x307c('0x1f')](function(_0x5e03d0){logger['error'](_0x307c('0x15'),_0x3c4a4c,_0x5e03d0);_0xe8236d(_0x5e03d0);});});}exports['GetOpenchannelQueue']=function(_0x409e5b){var _0x5dafd3=this;return new Promise(function(_0x4cf649,_0x4bcc1a){return db[_0x307c('0x20')]['findAll']({'raw':_0x409e5b[_0x307c('0x21')]?_0x409e5b[_0x307c('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x409e5b[_0x307c('0x21')]?_0x409e5b[_0x307c('0x21')]['where']||null:null,'attributes':_0x409e5b[_0x307c('0x21')]?_0x409e5b[_0x307c('0x21')][_0x307c('0x22')]||null:null,'limit':_0x409e5b[_0x307c('0x21')]?_0x409e5b[_0x307c('0x21')][_0x307c('0x23')]||null:null,'include':_0x409e5b[_0x307c('0x21')]?_0x409e5b[_0x307c('0x21')][_0x307c('0x24')]?_[_0x307c('0x25')](_0x409e5b['options'][_0x307c('0x24')],function(_0x58c383){return{'model':db[_0x58c383['model']],'as':_0x58c383['as'],'attributes':_0x58c383[_0x307c('0x22')],'include':_0x58c383[_0x307c('0x24')]?_[_0x307c('0x25')](_0x58c383[_0x307c('0x24')],function(_0x25dede){return{'model':db[_0x25dede[_0x307c('0x26')]],'as':_0x25dede['as'],'attributes':_0x25dede['attributes'],'include':_0x25dede[_0x307c('0x24')]?_[_0x307c('0x25')](_0x25dede[_0x307c('0x24')],function(_0x54da33){return{'model':db[_0x54da33[_0x307c('0x26')]],'as':_0x54da33['as'],'attributes':_0x54da33[_0x307c('0x22')]};}):[]};}):[]};}):[]:[]})[_0x307c('0x14')](function(_0x12d9a9){logger[_0x307c('0x1c')](_0x307c('0x27'),_0x409e5b);logger['debug'](_0x307c('0x27'),_0x409e5b,JSON[_0x307c('0x18')](_0x12d9a9));_0x4cf649(_0x12d9a9);})[_0x307c('0x1f')](function(_0x313fcf){logger[_0x307c('0x19')](_0x307c('0x27'),_0x313fcf[_0x307c('0x1b')],_0x409e5b);_0x4bcc1a(_0x5dafd3[_0x307c('0x19')](0x1f4,_0x313fcf[_0x307c('0x1b')]));});});};exports['ShowOpenchannelQueue']=function(_0x29c0c4){var _0x1985fb=this;return new Promise(function(_0x325961,_0x1a706a){return db[_0x307c('0x20')][_0x307c('0x28')]({'raw':_0x29c0c4[_0x307c('0x21')]?_0x29c0c4[_0x307c('0x21')][_0x307c('0x29')]===undefined?!![]:![]:!![],'where':_0x29c0c4[_0x307c('0x21')]?_0x29c0c4[_0x307c('0x21')]['where']||null:null,'attributes':_0x29c0c4[_0x307c('0x21')]?_0x29c0c4[_0x307c('0x21')]['attributes']||null:null,'include':_0x29c0c4[_0x307c('0x21')]?_0x29c0c4[_0x307c('0x21')]['include']?_[_0x307c('0x25')](_0x29c0c4['options'][_0x307c('0x24')],function(_0x246a20){return{'model':db[_0x246a20[_0x307c('0x26')]],'as':_0x246a20['as'],'attributes':_0x246a20[_0x307c('0x22')],'include':_0x246a20[_0x307c('0x24')]?_[_0x307c('0x25')](_0x246a20[_0x307c('0x24')],function(_0x4a9adb){return{'model':db[_0x4a9adb[_0x307c('0x26')]],'as':_0x4a9adb['as'],'attributes':_0x4a9adb[_0x307c('0x22')],'include':_0x4a9adb[_0x307c('0x24')]?_[_0x307c('0x25')](_0x4a9adb[_0x307c('0x24')],function(_0x1b7575){return{'model':db[_0x1b7575[_0x307c('0x26')]],'as':_0x1b7575['as'],'attributes':_0x1b7575['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x549aee){logger[_0x307c('0x1c')](_0x307c('0x2a'),_0x29c0c4);logger[_0x307c('0x16')]('ShowOpenchannelQueue',_0x29c0c4,JSON[_0x307c('0x18')](_0x549aee));_0x325961(_0x549aee);})['catch'](function(_0x3d14c8){logger[_0x307c('0x19')](_0x307c('0x2a'),_0x3d14c8[_0x307c('0x1b')],_0x29c0c4);_0x1a706a(_0x1985fb[_0x307c('0x19')](0x1f4,_0x3d14c8[_0x307c('0x1b')]));});});};
\ No newline at end of file
index 58a550f..cd6bbf2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['register','length','openchannelQueue:','./openchannelQueue.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var OpenchannelQueueEvents=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(){OpenchannelQueueEvents[_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);OpenchannelQueueEvents['on'](_0x5f41ea,_0x503809);}};
\ No newline at end of file
+var _0xa9e0=['register','length','openchannelQueue:','./openchannelQueue.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(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var OpenchannelQueueEvents=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(){OpenchannelQueueEvents[_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);OpenchannelQueueEvents['on'](_0x5f41ea,_0x503809);}};
\ No newline at end of file
index 9c024db..3a916c7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x3b4b1d,_0x15029e){var _0x488c36=function(_0x56c8b3){while(--_0x56c8b3){_0x3b4b1d['push'](_0x3b4b1d['shift']());}};_0x488c36(++_0x15029e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router;
\ No newline at end of file
+var _0xb10b=['../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x3cec45,_0x37d817){var _0x51d691=function(_0x2c671f){while(--_0x2c671f){_0x3cec45['push'](_0x3cec45['shift']());}};_0x51d691(++_0x37d817);}(_0xb10b,0x12a));var _0xbb10=function(_0x14634f,_0x5ed190){_0x14634f=_0x14634f-0x0;var _0x5021f9=_0xb10b[_0x14634f];return _0x5021f9;};'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 auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0xe')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0xf')]);router['put']('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router[_0xbb10('0x11')]('/:id',auth[_0xbb10('0x9')](),controller['destroy']);module[_0xbb10('0x12')]=router;
\ No newline at end of file
index 66e5333..83b25bb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3129=['exports','STRING','DATE','sequelize'];(function(_0x49b166,_0x264c05){var _0x11ebeb=function(_0x360e77){while(--_0x360e77){_0x49b166['push'](_0x49b166['shift']());}};_0x11ebeb(++_0x264c05);}(_0x3129,0x16f));var _0x9312=function(_0x149162,_0x13e8f8){_0x149162=_0x149162-0x0;var _0x162ab5=_0x3129[_0x149162];return _0x162ab5;};'use strict';var moment=require('moment');var Sequelize=require(_0x9312('0x0'));module[_0x9312('0x1')]={'uniqueid':{'type':Sequelize[_0x9312('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9312('0x2')]},'joinAt':{'type':Sequelize[_0x9312('0x3')]},'leaveAt':{'type':Sequelize[_0x9312('0x3')]},'acceptAt':{'type':Sequelize[_0x9312('0x3')]},'exitAt':{'type':Sequelize[_0x9312('0x3')]},'reason':{'type':Sequelize[_0x9312('0x2')]}};
\ No newline at end of file
+var _0xefcf=['exports','STRING','DATE','moment','sequelize'];(function(_0x58f37a,_0x1fd9c0){var _0x4a1861=function(_0x140f98){while(--_0x140f98){_0x58f37a['push'](_0x58f37a['shift']());}};_0x4a1861(++_0x1fd9c0);}(_0xefcf,0xb2));var _0xfefc=function(_0x14bb2f,_0x3c8ed0){_0x14bb2f=_0x14bb2f-0x0;var _0x5e2041=_0xefcf[_0x14bb2f];return _0x5e2041;};'use strict';var moment=require(_0xfefc('0x0'));var Sequelize=require(_0xfefc('0x1'));module[_0xfefc('0x2')]={'uniqueid':{'type':Sequelize[_0xfefc('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xfefc('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xfefc('0x4')]},'acceptAt':{'type':Sequelize[_0xfefc('0x4')]},'exitAt':{'type':Sequelize[_0xfefc('0x4')]},'reason':{'type':Sequelize[_0xfefc('0x3')]}};
\ No newline at end of file
index 2f43d2a..6ea47ba 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9b5c=['rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','describe','html-pdf','zip-dir','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','reject','save','update','then','destroy','stack','name','index','OpenchannelQueueReport'];(function(_0x69b0bf,_0x248a70){var _0x53a201=function(_0x5d1c3f){while(--_0x5d1c3f){_0x69b0bf['push'](_0x69b0bf['shift']());}};_0x53a201(++_0x248a70);}(_0x9b5c,0x1b0));var _0xc9b5=function(_0x3a94b5,_0x6c2384){_0x3a94b5=_0x3a94b5-0x0;var _0x4800a4=_0x9b5c[_0x3a94b5];return _0x4800a4;};'use strict';var pdf=require(_0xc9b5('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc9b5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc9b5('0x2'));var BPromise=require(_0xc9b5('0x3'));var Mustache=require('mustache');var util=require(_0xc9b5('0x4'));var path=require(_0xc9b5('0x5'));var sox=require('sox');var csv=require(_0xc9b5('0x6'));var ejs=require(_0xc9b5('0x7'));var fs=require('fs');var _=require(_0xc9b5('0x8'));var squel=require(_0xc9b5('0x9'));var crypto=require(_0xc9b5('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc9b5('0xb'));var toCsv=require(_0xc9b5('0x6'));var querystring=require(_0xc9b5('0xc'));var Papa=require(_0xc9b5('0xd'));var authService=require(_0xc9b5('0xe'));var hardwareService=require(_0xc9b5('0xf'));var Redis=require(_0xc9b5('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0xc9b5('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xc9b5('0x12'));var db=require(_0xc9b5('0x13'))['db'];function respondWithStatusCode(_0x166457,_0xbcf343){_0xbcf343=_0xbcf343||0xcc;return function(_0x5ce227){if(_0x5ce227){return _0x166457[_0xc9b5('0x14')](_0xbcf343);}return _0x166457[_0xc9b5('0x15')](_0xbcf343)[_0xc9b5('0x16')]();};}function respondWithResult(_0x65a129,_0x2d0d16){_0x2d0d16=_0x2d0d16||0xc8;return function(_0x415836){if(_0x415836){return _0x65a129[_0xc9b5('0x15')](_0x2d0d16)['json'](_0x415836);}};}function respondWithFilteredResult(_0x892f9c,_0x5de758){return function(_0x389093){if(_0x389093){var _0x4b800b=_0x389093[_0xc9b5('0x17')],_0x11ce04=_0x5de758[_0xc9b5('0x18')],_0x3cbe2e=_0x5de758[_0xc9b5('0x18')]+_0x5de758[_0xc9b5('0x19')],_0x287b7b;if(_0x3cbe2e>=_0x4b800b){_0x3cbe2e=_0x4b800b;_0x287b7b=0xc8;}else{_0x287b7b=0xce;}_0x892f9c[_0xc9b5('0x15')](_0x287b7b);return _0x892f9c['set'](_0xc9b5('0x1a'),_0x11ce04+'-'+_0x3cbe2e+'/'+_0x4b800b)[_0xc9b5('0x1b')](_0x389093);}return null;};}function patchUpdates(_0x16fb75){return function(_0x3708cd){try{jsonpatch['apply'](_0x3708cd,_0x16fb75,!![]);}catch(_0x3cbeb7){return BPromise[_0xc9b5('0x1c')](_0x3cbeb7);}return _0x3708cd[_0xc9b5('0x1d')]();};}function saveUpdates(_0x5e4096,_0xc52598){return function(_0x5a73b7){if(_0x5a73b7){return _0x5a73b7[_0xc9b5('0x1e')](_0x5e4096)[_0xc9b5('0x1f')](function(_0x3eaebb){return _0x3eaebb;});}return null;};}function removeEntity(_0x585d58,_0x5bbf7f){return function(_0x432675){if(_0x432675){return _0x432675[_0xc9b5('0x20')]()[_0xc9b5('0x1f')](function(){_0x585d58[_0xc9b5('0x15')](0xcc)[_0xc9b5('0x16')]();});}};}function handleEntityNotFound(_0x1d627e,_0x403655){return function(_0x1b9ad3){if(!_0x1b9ad3){_0x1d627e[_0xc9b5('0x14')](0x194);}return _0x1b9ad3;};}function handleError(_0x223862,_0x4d52b4){_0x4d52b4=_0x4d52b4||0x1f4;return function(_0x3011ce){logger['error'](_0x3011ce[_0xc9b5('0x21')]);if(_0x3011ce[_0xc9b5('0x22')]){delete _0x3011ce[_0xc9b5('0x22')];}_0x223862['status'](_0x4d52b4)['send'](_0x3011ce);};}exports[_0xc9b5('0x23')]=function(_0x428ded,_0x58e5fb){var _0x483c67={},_0x19a346={},_0x126ea0={'count':0x0,'rows':[]};var _0x2026d5=db[_0xc9b5('0x24')][_0xc9b5('0x25')];_0x19a346[_0xc9b5('0x26')]=_[_0xc9b5('0x27')](_0x2026d5);_0x19a346[_0xc9b5('0x28')]=_[_0xc9b5('0x27')](_0x428ded[_0xc9b5('0x28')]);_0x19a346[_0xc9b5('0x29')]=_[_0xc9b5('0x2a')](_0x19a346['model'],_0x19a346['query']);_0x483c67[_0xc9b5('0x2b')]=_[_0xc9b5('0x2a')](_0x19a346[_0xc9b5('0x26')],qs[_0xc9b5('0x2c')](_0x428ded['query'][_0xc9b5('0x2c')]));_0x483c67[_0xc9b5('0x2b')]=_0x483c67[_0xc9b5('0x2b')][_0xc9b5('0x2d')]?_0x483c67[_0xc9b5('0x2b')]:_0x19a346[_0xc9b5('0x26')];if(!_0x428ded[_0xc9b5('0x28')][_0xc9b5('0x2e')](_0xc9b5('0x2f'))){_0x483c67[_0xc9b5('0x19')]=qs[_0xc9b5('0x19')](_0x428ded['query'][_0xc9b5('0x19')]);_0x483c67[_0xc9b5('0x18')]=qs['offset'](_0x428ded['query'][_0xc9b5('0x18')]);}_0x483c67[_0xc9b5('0x30')]=qs['sort'](_0x428ded[_0xc9b5('0x28')][_0xc9b5('0x31')]);_0x483c67['where']=qs[_0xc9b5('0x29')](_[_0xc9b5('0x32')](_0x428ded[_0xc9b5('0x28')],_0x19a346[_0xc9b5('0x29')]));if(_0x428ded['query'][_0xc9b5('0x33')]){_0x483c67[_0xc9b5('0x34')]=_[_0xc9b5('0x35')](_0x483c67[_0xc9b5('0x34')],{'$or':_['map'](_0x2026d5,function(_0x2b2a42){if(_0x2b2a42['type']['key']!==_0xc9b5('0x36')){var _0x2c7651={};_0x2c7651[_0x2b2a42['field']]={'$like':'%'+_0x428ded['query'][_0xc9b5('0x33')]+'%'};return _0x2c7651;}})});}_0x483c67=_[_0xc9b5('0x35')]({},_0x483c67,_0x428ded['options']);var _0x400838={'where':_0x483c67[_0xc9b5('0x34')]};return db['OpenchannelQueueReport'][_0xc9b5('0x17')](_0x400838)[_0xc9b5('0x1f')](function(_0x53aa97){_0x126ea0[_0xc9b5('0x17')]=_0x53aa97;if(_0x428ded[_0xc9b5('0x28')][_0xc9b5('0x37')]){_0x483c67[_0xc9b5('0x38')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xc9b5('0x39')](_0x483c67);})[_0xc9b5('0x1f')](function(_0x5e1f71){_0x126ea0[_0xc9b5('0x3a')]=_0x5e1f71;return _0x126ea0;})[_0xc9b5('0x1f')](respondWithFilteredResult(_0x58e5fb,_0x483c67))[_0xc9b5('0x3b')](handleError(_0x58e5fb,null));};exports[_0xc9b5('0x3c')]=function(_0x39004a,_0x24b308){var _0x4e61bf={'raw':!![],'where':{'id':_0x39004a[_0xc9b5('0x3d')]['id']}},_0x3fe7fd={};_0x3fe7fd[_0xc9b5('0x26')]=_[_0xc9b5('0x27')](db['OpenchannelQueueReport'][_0xc9b5('0x25')]);_0x3fe7fd['query']=_['keys'](_0x39004a[_0xc9b5('0x28')]);_0x3fe7fd[_0xc9b5('0x29')]=_[_0xc9b5('0x2a')](_0x3fe7fd['model'],_0x3fe7fd['query']);_0x4e61bf[_0xc9b5('0x2b')]=_[_0xc9b5('0x2a')](_0x3fe7fd[_0xc9b5('0x26')],qs[_0xc9b5('0x2c')](_0x39004a[_0xc9b5('0x28')][_0xc9b5('0x2c')]));_0x4e61bf['attributes']=_0x4e61bf[_0xc9b5('0x2b')][_0xc9b5('0x2d')]?_0x4e61bf[_0xc9b5('0x2b')]:_0x3fe7fd[_0xc9b5('0x26')];if(_0x39004a['query']['includeAll']){_0x4e61bf['include']=[{'all':!![]}];}_0x4e61bf=_[_0xc9b5('0x35')]({},_0x4e61bf,_0x39004a[_0xc9b5('0x3e')]);return db['OpenchannelQueueReport']['find'](_0x4e61bf)[_0xc9b5('0x1f')](handleEntityNotFound(_0x24b308,null))[_0xc9b5('0x1f')](respondWithResult(_0x24b308,null))['catch'](handleError(_0x24b308,null));};exports['create']=function(_0x10fc6c,_0x35c673){return db[_0xc9b5('0x24')][_0xc9b5('0x3f')](_0x10fc6c[_0xc9b5('0x40')],{})[_0xc9b5('0x1f')](respondWithResult(_0x35c673,0xc9))[_0xc9b5('0x3b')](handleError(_0x35c673,null));};exports[_0xc9b5('0x1e')]=function(_0x55fdd6,_0x42a8f1){if(_0x55fdd6[_0xc9b5('0x40')]['id']){delete _0x55fdd6[_0xc9b5('0x40')]['id'];}return db[_0xc9b5('0x24')][_0xc9b5('0x41')]({'where':{'id':_0x55fdd6[_0xc9b5('0x3d')]['id']}})[_0xc9b5('0x1f')](handleEntityNotFound(_0x42a8f1,null))[_0xc9b5('0x1f')](saveUpdates(_0x55fdd6[_0xc9b5('0x40')],null))[_0xc9b5('0x1f')](respondWithResult(_0x42a8f1,null))[_0xc9b5('0x3b')](handleError(_0x42a8f1,null));};exports[_0xc9b5('0x20')]=function(_0x1272fb,_0x2e4565){return db[_0xc9b5('0x24')][_0xc9b5('0x41')]({'where':{'id':_0x1272fb[_0xc9b5('0x3d')]['id']}})[_0xc9b5('0x1f')](handleEntityNotFound(_0x2e4565,null))[_0xc9b5('0x1f')](removeEntity(_0x2e4565,null))['catch'](handleError(_0x2e4565,null));};exports[_0xc9b5('0x42')]=function(_0xfc3eb8,_0x4e6fb4){return db['OpenchannelQueueReport'][_0xc9b5('0x42')]()[_0xc9b5('0x1f')](respondWithResult(_0x4e6fb4,null))[_0xc9b5('0x3b')](handleError(_0x4e6fb4,null));};
\ No newline at end of file
+var _0xa8c4=['field','count','include','findAll','rows','catch','show','params','length','includeAll','create','body','update','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','limit','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','index','OpenchannelQueueReport','rawAttributes','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','merge','map','type','VIRTUAL'];(function(_0x38a19c,_0x389f2e){var _0x16e10e=function(_0x229896){while(--_0x229896){_0x38a19c['push'](_0x38a19c['shift']());}};_0x16e10e(++_0x389f2e);}(_0xa8c4,0x181));var _0x4a8c=function(_0x13891e,_0x4977fc){_0x13891e=_0x13891e-0x0;var _0x3d679a=_0xa8c4[_0x13891e];return _0x3d679a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4a8c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4a8c('0x1'));var jsonpatch=require(_0x4a8c('0x2'));var rp=require(_0x4a8c('0x3'));var moment=require(_0x4a8c('0x4'));var BPromise=require(_0x4a8c('0x5'));var Mustache=require(_0x4a8c('0x6'));var util=require(_0x4a8c('0x7'));var path=require(_0x4a8c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4a8c('0x9'));var fs=require('fs');var _=require(_0x4a8c('0xa'));var squel=require(_0x4a8c('0xb'));var crypto=require('crypto');var jsforce=require(_0x4a8c('0xc'));var deskjs=require(_0x4a8c('0xd'));var toCsv=require(_0x4a8c('0xe'));var querystring=require(_0x4a8c('0xf'));var Papa=require(_0x4a8c('0x10'));var authService=require(_0x4a8c('0x11'));var hardwareService=require(_0x4a8c('0x12'));var Redis=require(_0x4a8c('0x13'));var qs=require('../../components/parsers/qs');var logger=require(_0x4a8c('0x14'))(_0x4a8c('0x15'));var utils=require(_0x4a8c('0x16'));var config=require(_0x4a8c('0x17'));var db=require(_0x4a8c('0x18'))['db'];function respondWithStatusCode(_0x367a27,_0x345397){_0x345397=_0x345397||0xcc;return function(_0x54fa2a){if(_0x54fa2a){return _0x367a27['sendStatus'](_0x345397);}return _0x367a27['status'](_0x345397)['end']();};}function respondWithResult(_0x33ad66,_0x44bbe6){_0x44bbe6=_0x44bbe6||0xc8;return function(_0xb5b61f){if(_0xb5b61f){return _0x33ad66[_0x4a8c('0x19')](_0x44bbe6)[_0x4a8c('0x1a')](_0xb5b61f);}};}function respondWithFilteredResult(_0x2ba9ca,_0x8fd533){return function(_0x1891d7){if(_0x1891d7){var _0x1f8bbd=_0x1891d7['count'],_0x23a5ff=_0x8fd533['offset'],_0x4480df=_0x8fd533['offset']+_0x8fd533[_0x4a8c('0x1b')],_0x2f0c28;if(_0x4480df>=_0x1f8bbd){_0x4480df=_0x1f8bbd;_0x2f0c28=0xc8;}else{_0x2f0c28=0xce;}_0x2ba9ca[_0x4a8c('0x19')](_0x2f0c28);return _0x2ba9ca['set'](_0x4a8c('0x1c'),_0x23a5ff+'-'+_0x4480df+'/'+_0x1f8bbd)[_0x4a8c('0x1a')](_0x1891d7);}return null;};}function patchUpdates(_0x1bc7fc){return function(_0x1f7739){try{jsonpatch[_0x4a8c('0x1d')](_0x1f7739,_0x1bc7fc,!![]);}catch(_0x1542be){return BPromise[_0x4a8c('0x1e')](_0x1542be);}return _0x1f7739[_0x4a8c('0x1f')]();};}function saveUpdates(_0x37a58e,_0xb4412c){return function(_0x10337d){if(_0x10337d){return _0x10337d['update'](_0x37a58e)[_0x4a8c('0x20')](function(_0xd728a5){return _0xd728a5;});}return null;};}function removeEntity(_0x45dc53,_0x2096e8){return function(_0x4cae4e){if(_0x4cae4e){return _0x4cae4e[_0x4a8c('0x21')]()[_0x4a8c('0x20')](function(){_0x45dc53[_0x4a8c('0x19')](0xcc)[_0x4a8c('0x22')]();});}};}function handleEntityNotFound(_0x9cf78a,_0x9cb2d3){return function(_0x4dcfd9){if(!_0x4dcfd9){_0x9cf78a[_0x4a8c('0x23')](0x194);}return _0x4dcfd9;};}function handleError(_0x6f44eb,_0x47b82f){_0x47b82f=_0x47b82f||0x1f4;return function(_0x2aa78c){logger[_0x4a8c('0x24')](_0x2aa78c[_0x4a8c('0x25')]);if(_0x2aa78c[_0x4a8c('0x26')]){delete _0x2aa78c[_0x4a8c('0x26')];}_0x6f44eb[_0x4a8c('0x19')](_0x47b82f)['send'](_0x2aa78c);};}exports[_0x4a8c('0x27')]=function(_0x324c8f,_0x1c0d36){var _0x3f4a7c={},_0x20387e={},_0x4128e4={'count':0x0,'rows':[]};var _0x79c557=db[_0x4a8c('0x28')][_0x4a8c('0x29')];_0x20387e['model']=_[_0x4a8c('0x2a')](_0x79c557);_0x20387e[_0x4a8c('0x2b')]=_[_0x4a8c('0x2a')](_0x324c8f[_0x4a8c('0x2b')]);_0x20387e[_0x4a8c('0x2c')]=_[_0x4a8c('0x2d')](_0x20387e[_0x4a8c('0x2e')],_0x20387e[_0x4a8c('0x2b')]);_0x3f4a7c[_0x4a8c('0x2f')]=_[_0x4a8c('0x2d')](_0x20387e[_0x4a8c('0x2e')],qs[_0x4a8c('0x30')](_0x324c8f[_0x4a8c('0x2b')][_0x4a8c('0x30')]));_0x3f4a7c[_0x4a8c('0x2f')]=_0x3f4a7c['attributes']['length']?_0x3f4a7c[_0x4a8c('0x2f')]:_0x20387e[_0x4a8c('0x2e')];if(!_0x324c8f[_0x4a8c('0x2b')][_0x4a8c('0x31')](_0x4a8c('0x32'))){_0x3f4a7c[_0x4a8c('0x1b')]=qs[_0x4a8c('0x1b')](_0x324c8f['query'][_0x4a8c('0x1b')]);_0x3f4a7c['offset']=qs['offset'](_0x324c8f[_0x4a8c('0x2b')][_0x4a8c('0x33')]);}_0x3f4a7c[_0x4a8c('0x34')]=qs[_0x4a8c('0x35')](_0x324c8f[_0x4a8c('0x2b')][_0x4a8c('0x35')]);_0x3f4a7c[_0x4a8c('0x36')]=qs[_0x4a8c('0x2c')](_['pick'](_0x324c8f[_0x4a8c('0x2b')],_0x20387e[_0x4a8c('0x2c')]));if(_0x324c8f[_0x4a8c('0x2b')]['filter']){_0x3f4a7c['where']=_[_0x4a8c('0x37')](_0x3f4a7c[_0x4a8c('0x36')],{'$or':_[_0x4a8c('0x38')](_0x79c557,function(_0x576ea0){if(_0x576ea0[_0x4a8c('0x39')]['key']!==_0x4a8c('0x3a')){var _0x453068={};_0x453068[_0x576ea0[_0x4a8c('0x3b')]]={'$like':'%'+_0x324c8f['query']['filter']+'%'};return _0x453068;}})});}_0x3f4a7c=_['merge']({},_0x3f4a7c,_0x324c8f['options']);var _0x24071c={'where':_0x3f4a7c['where']};return db[_0x4a8c('0x28')][_0x4a8c('0x3c')](_0x24071c)[_0x4a8c('0x20')](function(_0x4678d4){_0x4128e4[_0x4a8c('0x3c')]=_0x4678d4;if(_0x324c8f['query']['includeAll']){_0x3f4a7c[_0x4a8c('0x3d')]=[{'all':!![]}];}return db[_0x4a8c('0x28')][_0x4a8c('0x3e')](_0x3f4a7c);})[_0x4a8c('0x20')](function(_0x37c4e3){_0x4128e4[_0x4a8c('0x3f')]=_0x37c4e3;return _0x4128e4;})[_0x4a8c('0x20')](respondWithFilteredResult(_0x1c0d36,_0x3f4a7c))[_0x4a8c('0x40')](handleError(_0x1c0d36,null));};exports[_0x4a8c('0x41')]=function(_0x181dc4,_0x372a5d){var _0x342dda={'raw':!![],'where':{'id':_0x181dc4[_0x4a8c('0x42')]['id']}},_0x701deb={};_0x701deb['model']=_[_0x4a8c('0x2a')](db[_0x4a8c('0x28')]['rawAttributes']);_0x701deb[_0x4a8c('0x2b')]=_[_0x4a8c('0x2a')](_0x181dc4[_0x4a8c('0x2b')]);_0x701deb[_0x4a8c('0x2c')]=_['intersection'](_0x701deb['model'],_0x701deb[_0x4a8c('0x2b')]);_0x342dda[_0x4a8c('0x2f')]=_['intersection'](_0x701deb[_0x4a8c('0x2e')],qs[_0x4a8c('0x30')](_0x181dc4[_0x4a8c('0x2b')]['fields']));_0x342dda[_0x4a8c('0x2f')]=_0x342dda[_0x4a8c('0x2f')][_0x4a8c('0x43')]?_0x342dda[_0x4a8c('0x2f')]:_0x701deb[_0x4a8c('0x2e')];if(_0x181dc4['query'][_0x4a8c('0x44')]){_0x342dda[_0x4a8c('0x3d')]=[{'all':!![]}];}_0x342dda=_[_0x4a8c('0x37')]({},_0x342dda,_0x181dc4['options']);return db[_0x4a8c('0x28')]['find'](_0x342dda)[_0x4a8c('0x20')](handleEntityNotFound(_0x372a5d,null))[_0x4a8c('0x20')](respondWithResult(_0x372a5d,null))[_0x4a8c('0x40')](handleError(_0x372a5d,null));};exports['create']=function(_0x444c46,_0x19bbd0){return db['OpenchannelQueueReport'][_0x4a8c('0x45')](_0x444c46[_0x4a8c('0x46')],{})['then'](respondWithResult(_0x19bbd0,0xc9))[_0x4a8c('0x40')](handleError(_0x19bbd0,null));};exports[_0x4a8c('0x47')]=function(_0x53ea80,_0x2fe1f9){if(_0x53ea80[_0x4a8c('0x46')]['id']){delete _0x53ea80[_0x4a8c('0x46')]['id'];}return db[_0x4a8c('0x28')][_0x4a8c('0x48')]({'where':{'id':_0x53ea80['params']['id']}})[_0x4a8c('0x20')](handleEntityNotFound(_0x2fe1f9,null))[_0x4a8c('0x20')](saveUpdates(_0x53ea80['body'],null))[_0x4a8c('0x20')](respondWithResult(_0x2fe1f9,null))['catch'](handleError(_0x2fe1f9,null));};exports[_0x4a8c('0x21')]=function(_0x116226,_0x7c5e26){return db[_0x4a8c('0x28')]['find']({'where':{'id':_0x116226[_0x4a8c('0x42')]['id']}})[_0x4a8c('0x20')](handleEntityNotFound(_0x7c5e26,null))[_0x4a8c('0x20')](removeEntity(_0x7c5e26,null))[_0x4a8c('0x40')](handleError(_0x7c5e26,null));};exports[_0x4a8c('0x49')]=function(_0xef8c3c,_0xed059d){return db['OpenchannelQueueReport'][_0x4a8c('0x49')]()[_0x4a8c('0x20')](respondWithResult(_0xed059d,null))['catch'](handleError(_0xed059d,null));};
\ No newline at end of file
index e13b9fb..295c6b0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc57c=['./openchannelQueueReport.attributes','exports','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1ad159,_0x12c5d7){var _0x27eb2c=function(_0x2e6433){while(--_0x2e6433){_0x1ad159['push'](_0x1ad159['shift']());}};_0x27eb2c(++_0x12c5d7);}(_0xc57c,0x9f));var _0xcc57=function(_0x316acc,_0x1e9637){_0x316acc=_0x316acc-0x0;var _0x24aa96=_0xc57c[_0x316acc];return _0x24aa96;};'use strict';var _=require(_0xcc57('0x0'));var util=require('util');var logger=require(_0xcc57('0x1'))(_0xcc57('0x2'));var moment=require(_0xcc57('0x3'));var BPromise=require(_0xcc57('0x4'));var rp=require(_0xcc57('0x5'));var attributes=require(_0xcc57('0x6'));module[_0xcc57('0x7')]=function(_0x217b01,_0x436b87){return _0x217b01['define'](_0xcc57('0x8'),attributes,{'tableName':_0xcc57('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xcc57('0xa')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xb4a3=['report_openchannel_queue','uniqueid','lodash','util','api','moment','bluebird','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0xf86b2e,_0x12120a){var _0x4c9206=function(_0xd3a153){while(--_0xd3a153){_0xf86b2e['push'](_0xf86b2e['shift']());}};_0x4c9206(++_0x12120a);}(_0xb4a3,0x174));var _0x3b4a=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xb4a3[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0x3b4a('0x0'));var util=require(_0x3b4a('0x1'));var logger=require('../../config/logger')(_0x3b4a('0x2'));var moment=require(_0x3b4a('0x3'));var BPromise=require(_0x3b4a('0x4'));var rp=require('request-promise');var attributes=require(_0x3b4a('0x5'));module[_0x3b4a('0x6')]=function(_0x4e05a2,_0x2735d2){return _0x4e05a2['define'](_0x3b4a('0x7'),attributes,{'tableName':_0x3b4a('0x8'),'paranoid':![],'indexes':[{'name':_0x3b4a('0x9'),'fields':['uniqueid']}],'timestamps':!![]});};
\ No newline at end of file
index f486941..a957102 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1b61=['create','body','options','CreateOpenchannelQueueReport','stringify','UpdateOpenchannelQueueReport','update','raw','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','OpenchannelQueueReport'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x1b61,0x11a));var _0x11b6=function(_0x2d48a2,_0x34ffa6){_0x2d48a2=_0x2d48a2-0x0;var _0x2ba1cb=_0x1b61[_0x2d48a2];return _0x2ba1cb;};'use strict';var _=require(_0x11b6('0x0'));var util=require(_0x11b6('0x1'));var moment=require(_0x11b6('0x2'));var BPromise=require(_0x11b6('0x3'));var rs=require(_0x11b6('0x4'));var fs=require('fs');var Redis=require(_0x11b6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x11b6('0x6'));var logger=require('../../config/logger')(_0x11b6('0x7'));var config=require(_0x11b6('0x8'));var jayson=require(_0x11b6('0x9'));var client=jayson[_0x11b6('0xa')][_0x11b6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e3a19,_0x35768d,_0x3e9ab1){return new BPromise(function(_0x5b7c51,_0x5f47d3){return client[_0x11b6('0xc')](_0x1e3a19,_0x3e9ab1)[_0x11b6('0xd')](function(_0x36aa1b){logger['info'](_0x11b6('0xe'),_0x35768d,_0x11b6('0xf'));logger['debug'](_0x11b6('0x10'),_0x35768d,'request\x20sent',JSON['stringify'](_0x36aa1b));if(_0x36aa1b[_0x11b6('0x11')]){if(_0x36aa1b[_0x11b6('0x11')][_0x11b6('0x12')]===0x1f4){logger[_0x11b6('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x35768d,_0x36aa1b[_0x11b6('0x11')][_0x11b6('0x13')]);return _0x5f47d3(_0x36aa1b[_0x11b6('0x11')][_0x11b6('0x13')]);}logger[_0x11b6('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x35768d,_0x36aa1b[_0x11b6('0x11')][_0x11b6('0x13')]);return _0x5b7c51(_0x36aa1b[_0x11b6('0x11')][_0x11b6('0x13')]);}else{logger[_0x11b6('0x14')](_0x11b6('0xe'),_0x35768d,_0x11b6('0xf'));_0x5b7c51(_0x36aa1b[_0x11b6('0x15')][_0x11b6('0x13')]);}})[_0x11b6('0x16')](function(_0x528d3f){logger[_0x11b6('0x11')](_0x11b6('0xe'),_0x35768d,_0x528d3f);_0x5f47d3(_0x528d3f);});});}exports['CreateOpenchannelQueueReport']=function(_0x123c83){var _0xc41df3=this;return new Promise(function(_0x4b00ff,_0x3ad0bf){return db[_0x11b6('0x17')][_0x11b6('0x18')](_0x123c83[_0x11b6('0x19')],{'raw':_0x123c83[_0x11b6('0x1a')]?_0x123c83[_0x11b6('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5a4334){logger[_0x11b6('0x14')](_0x11b6('0x1b'),_0x123c83);logger['debug']('CreateOpenchannelQueueReport',_0x123c83,JSON[_0x11b6('0x1c')](_0x5a4334));_0x4b00ff(_0x5a4334);})[_0x11b6('0x16')](function(_0x5778e0){logger[_0x11b6('0x11')](_0x11b6('0x1b'),_0x5778e0[_0x11b6('0x13')],_0x123c83);_0x3ad0bf(_0xc41df3[_0x11b6('0x11')](0x1f4,_0x5778e0[_0x11b6('0x13')]));});});};exports[_0x11b6('0x1d')]=function(_0x234a56){var _0x404ac3=this;return new Promise(function(_0x46f560,_0x2d798d){return db['OpenchannelQueueReport'][_0x11b6('0x1e')](_0x234a56[_0x11b6('0x19')],{'raw':_0x234a56[_0x11b6('0x1a')]?_0x234a56[_0x11b6('0x1a')][_0x11b6('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x234a56[_0x11b6('0x1a')]?_0x234a56[_0x11b6('0x1a')][_0x11b6('0x20')]||null:null,'attributes':_0x234a56[_0x11b6('0x1a')]?_0x234a56[_0x11b6('0x1a')][_0x11b6('0x21')]||null:null,'limit':_0x234a56[_0x11b6('0x1a')]?_0x234a56[_0x11b6('0x1a')]['limit']||null:null})['then'](function(_0x47b51f){logger[_0x11b6('0x14')](_0x11b6('0x1d'),_0x234a56);logger['debug'](_0x11b6('0x1d'),_0x234a56,JSON[_0x11b6('0x1c')](_0x47b51f));_0x46f560(_0x47b51f);})[_0x11b6('0x16')](function(_0x175847){logger[_0x11b6('0x11')](_0x11b6('0x1d'),_0x175847[_0x11b6('0x13')],_0x234a56);_0x2d798d(_0x404ac3['error'](0x1f4,_0x175847['message']));});});};
\ No newline at end of file
+var _0x4f15=['client','request','then','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','info','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','stringify','UpdateOpenchannelQueueReport','update','where','attributes','limit','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x5ae998,_0x373148){var _0x429830=function(_0x1f626b){while(--_0x1f626b){_0x5ae998['push'](_0x5ae998['shift']());}};_0x429830(++_0x373148);}(_0x4f15,0x158));var _0x54f1=function(_0x8af08b,_0x27948a){_0x8af08b=_0x8af08b-0x0;var _0x4f7795=_0x4f15[_0x8af08b];return _0x4f7795;};'use strict';var _=require('lodash');var util=require(_0x54f1('0x0'));var moment=require(_0x54f1('0x1'));var BPromise=require(_0x54f1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x54f1('0x3'));var db=require(_0x54f1('0x4'))['db'];var utils=require(_0x54f1('0x5'));var logger=require(_0x54f1('0x6'))('rpc');var config=require(_0x54f1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x54f1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5847f5,_0x2c795b,_0x433414){return new BPromise(function(_0x58354e,_0x222156){return client[_0x54f1('0x9')](_0x5847f5,_0x433414)[_0x54f1('0xa')](function(_0x44d020){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x2c795b,_0x54f1('0xb'));logger[_0x54f1('0xc')](_0x54f1('0xd'),_0x2c795b,'request\x20sent',JSON['stringify'](_0x44d020));if(_0x44d020[_0x54f1('0xe')]){if(_0x44d020[_0x54f1('0xe')][_0x54f1('0xf')]===0x1f4){logger[_0x54f1('0xe')](_0x54f1('0x10'),_0x2c795b,_0x44d020[_0x54f1('0xe')]['message']);return _0x222156(_0x44d020[_0x54f1('0xe')][_0x54f1('0x11')]);}logger[_0x54f1('0xe')](_0x54f1('0x10'),_0x2c795b,_0x44d020[_0x54f1('0xe')][_0x54f1('0x11')]);return _0x58354e(_0x44d020['error'][_0x54f1('0x11')]);}else{logger[_0x54f1('0x12')](_0x54f1('0x10'),_0x2c795b,_0x54f1('0xb'));_0x58354e(_0x44d020['result'][_0x54f1('0x11')]);}})[_0x54f1('0x13')](function(_0x3097e7){logger[_0x54f1('0xe')](_0x54f1('0x10'),_0x2c795b,_0x3097e7);_0x222156(_0x3097e7);});});}exports[_0x54f1('0x14')]=function(_0x2152e3){var _0x14fdb4=this;return new Promise(function(_0x6c4804,_0x3e6c25){return db[_0x54f1('0x15')][_0x54f1('0x16')](_0x2152e3[_0x54f1('0x17')],{'raw':_0x2152e3[_0x54f1('0x18')]?_0x2152e3[_0x54f1('0x18')][_0x54f1('0x19')]===undefined?!![]:![]:!![]})[_0x54f1('0xa')](function(_0x49e7fc){logger[_0x54f1('0x12')](_0x54f1('0x14'),_0x2152e3);logger[_0x54f1('0xc')]('CreateOpenchannelQueueReport',_0x2152e3,JSON[_0x54f1('0x1a')](_0x49e7fc));_0x6c4804(_0x49e7fc);})[_0x54f1('0x13')](function(_0xf1e256){logger[_0x54f1('0xe')](_0x54f1('0x14'),_0xf1e256['message'],_0x2152e3);_0x3e6c25(_0x14fdb4[_0x54f1('0xe')](0x1f4,_0xf1e256[_0x54f1('0x11')]));});});};exports[_0x54f1('0x1b')]=function(_0x27023c){var _0x289320=this;return new Promise(function(_0x119f26,_0x1c5e45){return db['OpenchannelQueueReport'][_0x54f1('0x1c')](_0x27023c[_0x54f1('0x17')],{'raw':_0x27023c[_0x54f1('0x18')]?_0x27023c[_0x54f1('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27023c[_0x54f1('0x18')]?_0x27023c['options'][_0x54f1('0x1d')]||null:null,'attributes':_0x27023c[_0x54f1('0x18')]?_0x27023c[_0x54f1('0x18')][_0x54f1('0x1e')]||null:null,'limit':_0x27023c['options']?_0x27023c[_0x54f1('0x18')][_0x54f1('0x1f')]||null:null})[_0x54f1('0xa')](function(_0x59596b){logger[_0x54f1('0x12')](_0x54f1('0x1b'),_0x27023c);logger[_0x54f1('0xc')](_0x54f1('0x1b'),_0x27023c,JSON[_0x54f1('0x1a')](_0x59596b));_0x119f26(_0x59596b);})[_0x54f1('0x13')](function(_0x2b03f0){logger[_0x54f1('0xe')]('UpdateOpenchannelQueueReport',_0x2b03f0[_0x54f1('0x11')],_0x27023c);_0x1c5e45(_0x289320[_0x54f1('0xe')](0x1f4,_0x2b03f0[_0x54f1('0x11')]));});});};
\ No newline at end of file
index 4b9c725..5581f2e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3d65=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','/describe','isAuthenticated','/:id','show','post','create','put','delete','destroy'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3d65,0x131));var _0x53d6=function(_0x3f8309,_0x38eb50){_0x3f8309=_0x3f8309-0x0;var _0xa496c7=_0x3d65[_0x3f8309];return _0xa496c7;};'use strict';var multer=require(_0x53d6('0x0'));var util=require(_0x53d6('0x1'));var path=require('path');var timeout=require(_0x53d6('0x2'));var express=require(_0x53d6('0x3'));var router=express[_0x53d6('0x4')]();var auth=require(_0x53d6('0x5'));var interaction=require(_0x53d6('0x6'));var config=require(_0x53d6('0x7'));var controller=require(_0x53d6('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x53d6('0x9'),auth[_0x53d6('0xa')](),controller['describe']);router['get'](_0x53d6('0xb'),auth[_0x53d6('0xa')](),controller[_0x53d6('0xc')]);router[_0x53d6('0xd')]('/',auth[_0x53d6('0xa')](),controller[_0x53d6('0xe')]);router[_0x53d6('0xf')]('/:id',auth[_0x53d6('0xa')](),controller['update']);router[_0x53d6('0x10')](_0x53d6('0xb'),auth['isAuthenticated'](),controller[_0x53d6('0x11')]);module[_0x53d6('0x12')]=router;
\ No newline at end of file
+var _0x412d=['isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelTransferReport.controller','get'];(function(_0xd63e3a,_0x1bd6eb){var _0x19c178=function(_0x56be0d){while(--_0x56be0d){_0xd63e3a['push'](_0xd63e3a['shift']());}};_0x19c178(++_0x1bd6eb);}(_0x412d,0xe7));var _0xd412=function(_0x5cad0e,_0x2076ba){_0x5cad0e=_0x5cad0e-0x0;var _0xd127dc=_0x412d[_0x5cad0e];return _0xd127dc;};'use strict';var multer=require(_0xd412('0x0'));var util=require('util');var path=require(_0xd412('0x1'));var timeout=require(_0xd412('0x2'));var express=require(_0xd412('0x3'));var router=express[_0xd412('0x4')]();var auth=require(_0xd412('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd412('0x6'));var controller=require(_0xd412('0x7'));router[_0xd412('0x8')]('/',auth[_0xd412('0x9')](),controller[_0xd412('0xa')]);router[_0xd412('0x8')](_0xd412('0xb'),auth[_0xd412('0x9')](),controller[_0xd412('0xc')]);router['get'](_0xd412('0xd'),auth['isAuthenticated'](),controller[_0xd412('0xe')]);router['post']('/',auth[_0xd412('0x9')](),controller[_0xd412('0xf')]);router[_0xd412('0x10')](_0xd412('0xd'),auth[_0xd412('0x9')](),controller[_0xd412('0x11')]);router[_0xd412('0x12')](_0xd412('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xd412('0x13')]=router;
\ No newline at end of file
index ad07acd..fc73d5f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x23d8=['moment','exports','ENUM','account','agent','DATE'];(function(_0x17279b,_0x4f50f8){var _0x1a5aa7=function(_0x11eef7){while(--_0x11eef7){_0x17279b['push'](_0x17279b['shift']());}};_0x1a5aa7(++_0x4f50f8);}(_0x23d8,0x174));var _0x823d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x23d8[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x823d('0x0'));var Sequelize=require('sequelize');module[_0x823d('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x823d('0x2')](_0x823d('0x3'),_0x823d('0x4'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x823d('0x5')],'allowNull':![],'defaultValue':Sequelize['NOW']}};
\ No newline at end of file
+var _0xe47a=['DATE','moment','ENUM','account','queue'];(function(_0x4caf0d,_0x580ea2){var _0x473297=function(_0xf159ac){while(--_0xf159ac){_0x4caf0d['push'](_0x4caf0d['shift']());}};_0x473297(++_0x580ea2);}(_0xe47a,0x1cd));var _0xae47=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xe47a[_0x1969a7];return _0x3d665f;};'use strict';var moment=require(_0xae47('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xae47('0x1')](_0xae47('0x2'),'agent',_0xae47('0x3')),'allowNull':![],'defaultValue':_0xae47('0x3')},'transferredAt':{'type':Sequelize[_0xae47('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}};
\ No newline at end of file
index 7d6dc48..c8b4bb2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbec5=['length','hasOwnProperty','order','sort','filter','where','merge','map','type','VIRTUAL','options','OpenchannelTransferReport','count','includeAll','findAll','catch','show','params','create','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','rawAttributes','model','keys','query','filters','intersection','fields','attributes'];(function(_0x1d0b8c,_0x29540e){var _0x366cfa=function(_0x1c110a){while(--_0x1c110a){_0x1d0b8c['push'](_0x1d0b8c['shift']());}};_0x366cfa(++_0x29540e);}(_0xbec5,0xe5));var _0x5bec=function(_0x402731,_0x43c115){_0x402731=_0x402731-0x0;var _0x111736=_0xbec5[_0x402731];return _0x111736;};'use strict';var pdf=require(_0x5bec('0x0'));var emlformat=require(_0x5bec('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5bec('0x2'));var jsonpatch=require(_0x5bec('0x3'));var rp=require(_0x5bec('0x4'));var moment=require(_0x5bec('0x5'));var BPromise=require(_0x5bec('0x6'));var Mustache=require('mustache');var util=require(_0x5bec('0x7'));var path=require(_0x5bec('0x8'));var sox=require(_0x5bec('0x9'));var csv=require('to-csv');var ejs=require(_0x5bec('0xa'));var fs=require('fs');var _=require(_0x5bec('0xb'));var squel=require(_0x5bec('0xc'));var crypto=require(_0x5bec('0xd'));var jsforce=require(_0x5bec('0xe'));var deskjs=require(_0x5bec('0xf'));var toCsv=require(_0x5bec('0x10'));var querystring=require(_0x5bec('0x11'));var Papa=require('papaparse');var authService=require(_0x5bec('0x12'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x5bec('0x13'));var qs=require(_0x5bec('0x14'));var logger=require(_0x5bec('0x15'))('api');var utils=require(_0x5bec('0x16'));var config=require(_0x5bec('0x17'));var db=require(_0x5bec('0x18'))['db'];function respondWithStatusCode(_0x57ffc4,_0x6bee21){_0x6bee21=_0x6bee21||0xcc;return function(_0x1c888f){if(_0x1c888f){return _0x57ffc4['sendStatus'](_0x6bee21);}return _0x57ffc4[_0x5bec('0x19')](_0x6bee21)[_0x5bec('0x1a')]();};}function respondWithResult(_0x35393a,_0x6888a4){_0x6888a4=_0x6888a4||0xc8;return function(_0x3198e0){if(_0x3198e0){return _0x35393a[_0x5bec('0x19')](_0x6888a4)[_0x5bec('0x1b')](_0x3198e0);}};}function respondWithFilteredResult(_0x43fd2a,_0x259588){return function(_0x3ebc41){if(_0x3ebc41){var _0x31b9e4=_0x3ebc41['count'],_0x325daf=_0x259588[_0x5bec('0x1c')],_0x11fb8e=_0x259588[_0x5bec('0x1c')]+_0x259588[_0x5bec('0x1d')],_0x506639;if(_0x11fb8e>=_0x31b9e4){_0x11fb8e=_0x31b9e4;_0x506639=0xc8;}else{_0x506639=0xce;}_0x43fd2a[_0x5bec('0x19')](_0x506639);return _0x43fd2a['set']('Content-Range',_0x325daf+'-'+_0x11fb8e+'/'+_0x31b9e4)[_0x5bec('0x1b')](_0x3ebc41);}return null;};}function patchUpdates(_0x6c0d35){return function(_0x4e0191){try{jsonpatch[_0x5bec('0x1e')](_0x4e0191,_0x6c0d35,!![]);}catch(_0xa7e223){return BPromise[_0x5bec('0x1f')](_0xa7e223);}return _0x4e0191[_0x5bec('0x20')]();};}function saveUpdates(_0x554f9f,_0xab397b){return function(_0x5be91c){if(_0x5be91c){return _0x5be91c[_0x5bec('0x21')](_0x554f9f)[_0x5bec('0x22')](function(_0x3e1896){return _0x3e1896;});}return null;};}function removeEntity(_0x43a62d,_0xfed23){return function(_0x5e154e){if(_0x5e154e){return _0x5e154e[_0x5bec('0x23')]()['then'](function(){_0x43a62d[_0x5bec('0x19')](0xcc)[_0x5bec('0x1a')]();});}};}function handleEntityNotFound(_0x5b2636,_0xa414f8){return function(_0xbef70b){if(!_0xbef70b){_0x5b2636['sendStatus'](0x194);}return _0xbef70b;};}function handleError(_0x45afb7,_0x218c13){_0x218c13=_0x218c13||0x1f4;return function(_0x43d460){logger[_0x5bec('0x24')](_0x43d460[_0x5bec('0x25')]);if(_0x43d460[_0x5bec('0x26')]){delete _0x43d460[_0x5bec('0x26')];}_0x45afb7['status'](_0x218c13)['send'](_0x43d460);};}exports['index']=function(_0x2961bd,_0x2cdd2f){var _0x338c25={},_0x4939a5={},_0x2b3b2c={'count':0x0,'rows':[]};var _0x472e54=db['OpenchannelTransferReport'][_0x5bec('0x27')];_0x4939a5[_0x5bec('0x28')]=_['keys'](_0x472e54);_0x4939a5['query']=_[_0x5bec('0x29')](_0x2961bd[_0x5bec('0x2a')]);_0x4939a5[_0x5bec('0x2b')]=_[_0x5bec('0x2c')](_0x4939a5[_0x5bec('0x28')],_0x4939a5[_0x5bec('0x2a')]);_0x338c25['attributes']=_[_0x5bec('0x2c')](_0x4939a5['model'],qs[_0x5bec('0x2d')](_0x2961bd[_0x5bec('0x2a')][_0x5bec('0x2d')]));_0x338c25[_0x5bec('0x2e')]=_0x338c25['attributes'][_0x5bec('0x2f')]?_0x338c25[_0x5bec('0x2e')]:_0x4939a5[_0x5bec('0x28')];if(!_0x2961bd['query'][_0x5bec('0x30')]('nolimit')){_0x338c25[_0x5bec('0x1d')]=qs[_0x5bec('0x1d')](_0x2961bd[_0x5bec('0x2a')]['limit']);_0x338c25[_0x5bec('0x1c')]=qs[_0x5bec('0x1c')](_0x2961bd['query'][_0x5bec('0x1c')]);}_0x338c25[_0x5bec('0x31')]=qs[_0x5bec('0x32')](_0x2961bd[_0x5bec('0x2a')][_0x5bec('0x32')]);_0x338c25['where']=qs[_0x5bec('0x2b')](_['pick'](_0x2961bd[_0x5bec('0x2a')],_0x4939a5[_0x5bec('0x2b')]));if(_0x2961bd[_0x5bec('0x2a')][_0x5bec('0x33')]){_0x338c25[_0x5bec('0x34')]=_[_0x5bec('0x35')](_0x338c25['where'],{'$or':_[_0x5bec('0x36')](_0x472e54,function(_0xb515bb){if(_0xb515bb[_0x5bec('0x37')]['key']!==_0x5bec('0x38')){var _0x355707={};_0x355707[_0xb515bb['field']]={'$like':'%'+_0x2961bd[_0x5bec('0x2a')]['filter']+'%'};return _0x355707;}})});}_0x338c25=_[_0x5bec('0x35')]({},_0x338c25,_0x2961bd[_0x5bec('0x39')]);var _0x402e5d={'where':_0x338c25['where']};return db[_0x5bec('0x3a')][_0x5bec('0x3b')](_0x402e5d)[_0x5bec('0x22')](function(_0x139859){_0x2b3b2c[_0x5bec('0x3b')]=_0x139859;if(_0x2961bd[_0x5bec('0x2a')][_0x5bec('0x3c')]){_0x338c25['include']=[{'all':!![]}];}return db[_0x5bec('0x3a')][_0x5bec('0x3d')](_0x338c25);})[_0x5bec('0x22')](function(_0x414d59){_0x2b3b2c['rows']=_0x414d59;return _0x2b3b2c;})[_0x5bec('0x22')](respondWithFilteredResult(_0x2cdd2f,_0x338c25))[_0x5bec('0x3e')](handleError(_0x2cdd2f,null));};exports[_0x5bec('0x3f')]=function(_0x57e07c,_0x54ecf3){var _0x1a57e3={'raw':!![],'where':{'id':_0x57e07c[_0x5bec('0x40')]['id']}},_0x153d02={};_0x153d02[_0x5bec('0x28')]=_[_0x5bec('0x29')](db['OpenchannelTransferReport']['rawAttributes']);_0x153d02[_0x5bec('0x2a')]=_['keys'](_0x57e07c[_0x5bec('0x2a')]);_0x153d02[_0x5bec('0x2b')]=_[_0x5bec('0x2c')](_0x153d02['model'],_0x153d02[_0x5bec('0x2a')]);_0x1a57e3[_0x5bec('0x2e')]=_['intersection'](_0x153d02[_0x5bec('0x28')],qs[_0x5bec('0x2d')](_0x57e07c[_0x5bec('0x2a')][_0x5bec('0x2d')]));_0x1a57e3[_0x5bec('0x2e')]=_0x1a57e3[_0x5bec('0x2e')][_0x5bec('0x2f')]?_0x1a57e3['attributes']:_0x153d02['model'];if(_0x57e07c[_0x5bec('0x2a')]['includeAll']){_0x1a57e3['include']=[{'all':!![]}];}_0x1a57e3=_[_0x5bec('0x35')]({},_0x1a57e3,_0x57e07c['options']);return db['OpenchannelTransferReport']['find'](_0x1a57e3)[_0x5bec('0x22')](handleEntityNotFound(_0x54ecf3,null))[_0x5bec('0x22')](respondWithResult(_0x54ecf3,null))[_0x5bec('0x3e')](handleError(_0x54ecf3,null));};exports[_0x5bec('0x41')]=function(_0x48858a,_0x387ad9){return db[_0x5bec('0x3a')][_0x5bec('0x41')](_0x48858a[_0x5bec('0x42')],{})['then'](respondWithResult(_0x387ad9,0xc9))[_0x5bec('0x3e')](handleError(_0x387ad9,null));};exports[_0x5bec('0x21')]=function(_0x2bbb1a,_0x51a3f9){if(_0x2bbb1a[_0x5bec('0x42')]['id']){delete _0x2bbb1a['body']['id'];}return db[_0x5bec('0x3a')][_0x5bec('0x43')]({'where':{'id':_0x2bbb1a[_0x5bec('0x40')]['id']}})[_0x5bec('0x22')](handleEntityNotFound(_0x51a3f9,null))['then'](saveUpdates(_0x2bbb1a[_0x5bec('0x42')],null))[_0x5bec('0x22')](respondWithResult(_0x51a3f9,null))[_0x5bec('0x3e')](handleError(_0x51a3f9,null));};exports[_0x5bec('0x23')]=function(_0x35b250,_0x123758){return db[_0x5bec('0x3a')]['find']({'where':{'id':_0x35b250[_0x5bec('0x40')]['id']}})[_0x5bec('0x22')](handleEntityNotFound(_0x123758,null))['then'](removeEntity(_0x123758,null))[_0x5bec('0x3e')](handleError(_0x123758,null));};exports[_0x5bec('0x44')]=function(_0x34ee24,_0x43ddbf){return db[_0x5bec('0x3a')][_0x5bec('0x44')]()[_0x5bec('0x22')](respondWithResult(_0x43ddbf,null))['catch'](handleError(_0x43ddbf,null));};
\ No newline at end of file
+var _0xe5b3=['sort','where','map','type','VIRTUAL','field','options','OpenchannelTransferReport','rows','catch','show','params','includeAll','include','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order'];(function(_0x523d91,_0x4fe3c3){var _0xff960f=function(_0x2da5a9){while(--_0x2da5a9){_0x523d91['push'](_0x523d91['shift']());}};_0xff960f(++_0x4fe3c3);}(_0xe5b3,0x133));var _0x3e5b=function(_0x50c9b7,_0x14f813){_0x50c9b7=_0x50c9b7-0x0;var _0x202f64=_0xe5b3[_0x50c9b7];return _0x202f64;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3e5b('0x0'));var rimraf=require(_0x3e5b('0x1'));var zipdir=require(_0x3e5b('0x2'));var jsonpatch=require(_0x3e5b('0x3'));var rp=require(_0x3e5b('0x4'));var moment=require(_0x3e5b('0x5'));var BPromise=require(_0x3e5b('0x6'));var Mustache=require(_0x3e5b('0x7'));var util=require(_0x3e5b('0x8'));var path=require(_0x3e5b('0x9'));var sox=require(_0x3e5b('0xa'));var csv=require('to-csv');var ejs=require(_0x3e5b('0xb'));var fs=require('fs');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('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x3e5b('0x11'));var hardwareService=require(_0x3e5b('0x12'));var Redis=require(_0x3e5b('0x13'));var qs=require(_0x3e5b('0x14'));var logger=require(_0x3e5b('0x15'))('api');var utils=require(_0x3e5b('0x16'));var config=require('../../config/environment');var db=require(_0x3e5b('0x17'))['db'];function respondWithStatusCode(_0x382273,_0x4d69dd){_0x4d69dd=_0x4d69dd||0xcc;return function(_0x374068){if(_0x374068){return _0x382273[_0x3e5b('0x18')](_0x4d69dd);}return _0x382273[_0x3e5b('0x19')](_0x4d69dd)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x560010,_0x39a2a1){_0x39a2a1=_0x39a2a1||0xc8;return function(_0x5f2f9c){if(_0x5f2f9c){return _0x560010['status'](_0x39a2a1)['json'](_0x5f2f9c);}};}function respondWithFilteredResult(_0x3754e3,_0x3f5368){return function(_0x17aaa3){if(_0x17aaa3){var _0x4fb471=_0x17aaa3[_0x3e5b('0x1b')],_0x1f81a7=_0x3f5368[_0x3e5b('0x1c')],_0x59ddc0=_0x3f5368['offset']+_0x3f5368[_0x3e5b('0x1d')],_0x56a453;if(_0x59ddc0>=_0x4fb471){_0x59ddc0=_0x4fb471;_0x56a453=0xc8;}else{_0x56a453=0xce;}_0x3754e3[_0x3e5b('0x19')](_0x56a453);return _0x3754e3['set'](_0x3e5b('0x1e'),_0x1f81a7+'-'+_0x59ddc0+'/'+_0x4fb471)[_0x3e5b('0x1f')](_0x17aaa3);}return null;};}function patchUpdates(_0x52696c){return function(_0x4b189d){try{jsonpatch[_0x3e5b('0x20')](_0x4b189d,_0x52696c,!![]);}catch(_0x20806a){return BPromise[_0x3e5b('0x21')](_0x20806a);}return _0x4b189d[_0x3e5b('0x22')]();};}function saveUpdates(_0x24de5b,_0x1564b5){return function(_0x447d36){if(_0x447d36){return _0x447d36[_0x3e5b('0x23')](_0x24de5b)[_0x3e5b('0x24')](function(_0x3d95f3){return _0x3d95f3;});}return null;};}function removeEntity(_0x2b977c,_0x11e5cf){return function(_0x2d77cc){if(_0x2d77cc){return _0x2d77cc[_0x3e5b('0x25')]()['then'](function(){_0x2b977c[_0x3e5b('0x19')](0xcc)[_0x3e5b('0x1a')]();});}};}function handleEntityNotFound(_0x2146d4,_0x150674){return function(_0x50039b){if(!_0x50039b){_0x2146d4[_0x3e5b('0x18')](0x194);}return _0x50039b;};}function handleError(_0x5b33bb,_0x2f9e42){_0x2f9e42=_0x2f9e42||0x1f4;return function(_0x36d960){logger['error'](_0x36d960[_0x3e5b('0x26')]);if(_0x36d960[_0x3e5b('0x27')]){delete _0x36d960[_0x3e5b('0x27')];}_0x5b33bb[_0x3e5b('0x19')](_0x2f9e42)[_0x3e5b('0x28')](_0x36d960);};}exports[_0x3e5b('0x29')]=function(_0x160e87,_0x2ddf57){var _0x4c4b89={},_0x1c7278={},_0x505f40={'count':0x0,'rows':[]};var _0xb70ab4=db['OpenchannelTransferReport'][_0x3e5b('0x2a')];_0x1c7278[_0x3e5b('0x2b')]=_[_0x3e5b('0x2c')](_0xb70ab4);_0x1c7278[_0x3e5b('0x2d')]=_[_0x3e5b('0x2c')](_0x160e87[_0x3e5b('0x2d')]);_0x1c7278[_0x3e5b('0x2e')]=_[_0x3e5b('0x2f')](_0x1c7278[_0x3e5b('0x2b')],_0x1c7278[_0x3e5b('0x2d')]);_0x4c4b89[_0x3e5b('0x30')]=_['intersection'](_0x1c7278[_0x3e5b('0x2b')],qs[_0x3e5b('0x31')](_0x160e87[_0x3e5b('0x2d')][_0x3e5b('0x31')]));_0x4c4b89[_0x3e5b('0x30')]=_0x4c4b89[_0x3e5b('0x30')][_0x3e5b('0x32')]?_0x4c4b89['attributes']:_0x1c7278[_0x3e5b('0x2b')];if(!_0x160e87['query']['hasOwnProperty'](_0x3e5b('0x33'))){_0x4c4b89[_0x3e5b('0x1d')]=qs['limit'](_0x160e87[_0x3e5b('0x2d')][_0x3e5b('0x1d')]);_0x4c4b89[_0x3e5b('0x1c')]=qs[_0x3e5b('0x1c')](_0x160e87[_0x3e5b('0x2d')][_0x3e5b('0x1c')]);}_0x4c4b89[_0x3e5b('0x34')]=qs[_0x3e5b('0x35')](_0x160e87[_0x3e5b('0x2d')][_0x3e5b('0x35')]);_0x4c4b89[_0x3e5b('0x36')]=qs[_0x3e5b('0x2e')](_['pick'](_0x160e87[_0x3e5b('0x2d')],_0x1c7278[_0x3e5b('0x2e')]));if(_0x160e87['query']['filter']){_0x4c4b89[_0x3e5b('0x36')]=_['merge'](_0x4c4b89[_0x3e5b('0x36')],{'$or':_[_0x3e5b('0x37')](_0xb70ab4,function(_0xb2349c){if(_0xb2349c[_0x3e5b('0x38')]['key']!==_0x3e5b('0x39')){var _0x4cdcb1={};_0x4cdcb1[_0xb2349c[_0x3e5b('0x3a')]]={'$like':'%'+_0x160e87['query']['filter']+'%'};return _0x4cdcb1;}})});}_0x4c4b89=_['merge']({},_0x4c4b89,_0x160e87[_0x3e5b('0x3b')]);var _0x174ebf={'where':_0x4c4b89[_0x3e5b('0x36')]};return db[_0x3e5b('0x3c')][_0x3e5b('0x1b')](_0x174ebf)[_0x3e5b('0x24')](function(_0x5466ac){_0x505f40['count']=_0x5466ac;if(_0x160e87['query']['includeAll']){_0x4c4b89['include']=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0x4c4b89);})[_0x3e5b('0x24')](function(_0x349de0){_0x505f40[_0x3e5b('0x3d')]=_0x349de0;return _0x505f40;})[_0x3e5b('0x24')](respondWithFilteredResult(_0x2ddf57,_0x4c4b89))[_0x3e5b('0x3e')](handleError(_0x2ddf57,null));};exports[_0x3e5b('0x3f')]=function(_0x2c56bc,_0x423be2){var _0x222d0f={'raw':!![],'where':{'id':_0x2c56bc[_0x3e5b('0x40')]['id']}},_0xbbc6b={};_0xbbc6b['model']=_[_0x3e5b('0x2c')](db[_0x3e5b('0x3c')][_0x3e5b('0x2a')]);_0xbbc6b[_0x3e5b('0x2d')]=_[_0x3e5b('0x2c')](_0x2c56bc[_0x3e5b('0x2d')]);_0xbbc6b[_0x3e5b('0x2e')]=_[_0x3e5b('0x2f')](_0xbbc6b[_0x3e5b('0x2b')],_0xbbc6b[_0x3e5b('0x2d')]);_0x222d0f[_0x3e5b('0x30')]=_['intersection'](_0xbbc6b['model'],qs['fields'](_0x2c56bc['query'][_0x3e5b('0x31')]));_0x222d0f[_0x3e5b('0x30')]=_0x222d0f[_0x3e5b('0x30')][_0x3e5b('0x32')]?_0x222d0f[_0x3e5b('0x30')]:_0xbbc6b[_0x3e5b('0x2b')];if(_0x2c56bc[_0x3e5b('0x2d')][_0x3e5b('0x41')]){_0x222d0f[_0x3e5b('0x42')]=[{'all':!![]}];}_0x222d0f=_[_0x3e5b('0x43')]({},_0x222d0f,_0x2c56bc['options']);return db[_0x3e5b('0x3c')][_0x3e5b('0x44')](_0x222d0f)[_0x3e5b('0x24')](handleEntityNotFound(_0x423be2,null))[_0x3e5b('0x24')](respondWithResult(_0x423be2,null))[_0x3e5b('0x3e')](handleError(_0x423be2,null));};exports['create']=function(_0x588ee7,_0x495217){return db[_0x3e5b('0x3c')][_0x3e5b('0x45')](_0x588ee7[_0x3e5b('0x46')],{})['then'](respondWithResult(_0x495217,0xc9))['catch'](handleError(_0x495217,null));};exports[_0x3e5b('0x23')]=function(_0x313c51,_0x123947){if(_0x313c51['body']['id']){delete _0x313c51['body']['id'];}return db[_0x3e5b('0x3c')]['find']({'where':{'id':_0x313c51[_0x3e5b('0x40')]['id']}})[_0x3e5b('0x24')](handleEntityNotFound(_0x123947,null))[_0x3e5b('0x24')](saveUpdates(_0x313c51[_0x3e5b('0x46')],null))[_0x3e5b('0x24')](respondWithResult(_0x123947,null))[_0x3e5b('0x3e')](handleError(_0x123947,null));};exports[_0x3e5b('0x25')]=function(_0x3ea5aa,_0x339852){return db['OpenchannelTransferReport'][_0x3e5b('0x44')]({'where':{'id':_0x3ea5aa['params']['id']}})[_0x3e5b('0x24')](handleEntityNotFound(_0x339852,null))[_0x3e5b('0x24')](removeEntity(_0x339852,null))[_0x3e5b('0x3e')](handleError(_0x339852,null));};exports[_0x3e5b('0x47')]=function(_0x291e4d,_0x3a4f26){return db[_0x3e5b('0x3c')][_0x3e5b('0x47')]()[_0x3e5b('0x24')](respondWithResult(_0x3a4f26,null))[_0x3e5b('0x3e')](handleError(_0x3a4f26,null));};
\ No newline at end of file
index 06ef3ad..0972907 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','./openchannelTransferReport.attributes','exports','define'];(function(_0x4cd39c,_0x2220e0){var _0x197f67=function(_0x2fa2bc){while(--_0x2fa2bc){_0x4cd39c['push'](_0x4cd39c['shift']());}};_0x197f67(++_0x2220e0);}(_0x7a54,0x106));var _0x47a5=function(_0x161c63,_0xb68c10){_0x161c63=_0x161c63-0x0;var _0x1d64f5=_0x7a54[_0x161c63];return _0x1d64f5;};'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 attributes=require(_0x47a5('0x5'));module[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){return _0x2a1a7e[_0x47a5('0x7')]('OpenchannelTransferReport',attributes,{'tableName':_0x47a5('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0x9')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x7a54=['report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','./openchannelTransferReport.attributes','exports','define'];(function(_0x4e610d,_0x520c2d){var _0x581a7c=function(_0x544b46){while(--_0x544b46){_0x4e610d['push'](_0x4e610d['shift']());}};_0x581a7c(++_0x520c2d);}(_0x7a54,0x106));var _0x47a5=function(_0x1e579f,_0x322fcc){_0x1e579f=_0x1e579f-0x0;var _0x1e2c1e=_0x7a54[_0x1e579f];return _0x1e2c1e;};'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 attributes=require(_0x47a5('0x5'));module[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){return _0x2a1a7e[_0x47a5('0x7')]('OpenchannelTransferReport',attributes,{'tableName':_0x47a5('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0x9')]}],'timestamps':!![]});};
\ No newline at end of file
index 47d441c..7b3567e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdd51=['stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x401676,_0x3f1436){var _0x4f13fe=function(_0xd2f197){while(--_0xd2f197){_0x401676['push'](_0x401676['shift']());}};_0x4f13fe(++_0x3f1436);}(_0xdd51,0x8b));var _0x1dd5=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xdd51[_0x4fc9e6];return _0x551d28;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1dd5('0x0'));var BPromise=require(_0x1dd5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1dd5('0x2'));var db=require(_0x1dd5('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1dd5('0x4'))('rpc');var config=require(_0x1dd5('0x5'));var jayson=require(_0x1dd5('0x6'));var client=jayson[_0x1dd5('0x7')][_0x1dd5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4fce4d,_0x2122af,_0x3fb235){return new BPromise(function(_0x37de4b,_0xa56eb8){return client['request'](_0x4fce4d,_0x3fb235)[_0x1dd5('0x9')](function(_0x2569b8){logger[_0x1dd5('0xa')](_0x1dd5('0xb'),_0x2122af,_0x1dd5('0xc'));logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x2122af,_0x1dd5('0xc'),JSON[_0x1dd5('0xd')](_0x2569b8));if(_0x2569b8['error']){if(_0x2569b8[_0x1dd5('0xe')][_0x1dd5('0xf')]===0x1f4){logger['error'](_0x1dd5('0xb'),_0x2122af,_0x2569b8[_0x1dd5('0xe')]['message']);return _0xa56eb8(_0x2569b8[_0x1dd5('0xe')][_0x1dd5('0x10')]);}logger[_0x1dd5('0xe')](_0x1dd5('0xb'),_0x2122af,_0x2569b8['error'][_0x1dd5('0x10')]);return _0x37de4b(_0x2569b8[_0x1dd5('0xe')][_0x1dd5('0x10')]);}else{logger[_0x1dd5('0xa')](_0x1dd5('0xb'),_0x2122af,'request\x20sent');_0x37de4b(_0x2569b8[_0x1dd5('0x11')]['message']);}})[_0x1dd5('0x12')](function(_0x697ff0){logger[_0x1dd5('0xe')](_0x1dd5('0xb'),_0x2122af,_0x697ff0);_0xa56eb8(_0x697ff0);});});}
\ No newline at end of file
+var _0x48b9=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','request\x20sent','stringify','code','error','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x57b9e3,_0x2a0bc7){var _0x32d7dc=function(_0x70b150){while(--_0x70b150){_0x57b9e3['push'](_0x57b9e3['shift']());}};_0x32d7dc(++_0x2a0bc7);}(_0x48b9,0x1b3));var _0x948b=function(_0x1e4c37,_0xdf253e){_0x1e4c37=_0x1e4c37-0x0;var _0xec3469=_0x48b9[_0x1e4c37];return _0xec3469;};'use strict';var _=require(_0x948b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x948b('0x1'));var rs=require(_0x948b('0x2'));var fs=require('fs');var Redis=require(_0x948b('0x3'));var db=require(_0x948b('0x4'))['db'];var utils=require(_0x948b('0x5'));var logger=require(_0x948b('0x6'))(_0x948b('0x7'));var config=require(_0x948b('0x8'));var jayson=require(_0x948b('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5c5518,_0x58bb73,_0x4a5499){return new BPromise(function(_0x2874dc,_0x56e544){return client[_0x948b('0xa')](_0x5c5518,_0x4a5499)['then'](function(_0x45b821){logger[_0x948b('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x58bb73,'request\x20sent');logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x58bb73,_0x948b('0xc'),JSON[_0x948b('0xd')](_0x45b821));if(_0x45b821['error']){if(_0x45b821['error'][_0x948b('0xe')]===0x1f4){logger[_0x948b('0xf')](_0x948b('0x10'),_0x58bb73,_0x45b821[_0x948b('0xf')][_0x948b('0x11')]);return _0x56e544(_0x45b821[_0x948b('0xf')][_0x948b('0x11')]);}logger[_0x948b('0xf')](_0x948b('0x10'),_0x58bb73,_0x45b821['error'][_0x948b('0x11')]);return _0x2874dc(_0x45b821[_0x948b('0xf')][_0x948b('0x11')]);}else{logger[_0x948b('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x58bb73,_0x948b('0xc'));_0x2874dc(_0x45b821[_0x948b('0x12')][_0x948b('0x11')]);}})[_0x948b('0x13')](function(_0x43ed56){logger[_0x948b('0xf')](_0x948b('0x10'),_0x58bb73,_0x43ed56);_0x56e544(_0x43ed56);});});}
\ No newline at end of file
index 9579d21..ae6d87c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1ddc=['create','put','update','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./pause.controller','isAuthenticated','index','/:id'];(function(_0x13f2ec,_0x407206){var _0x389ca9=function(_0x43d7d6){while(--_0x43d7d6){_0x13f2ec['push'](_0x13f2ec['shift']());}};_0x389ca9(++_0x407206);}(_0x1ddc,0x6e));var _0xc1dd=function(_0x158bd2,_0x244c08){_0x158bd2=_0x158bd2-0x0;var _0x53c3dc=_0x1ddc[_0x158bd2];return _0x53c3dc;};'use strict';var multer=require('multer');var util=require(_0xc1dd('0x0'));var path=require(_0xc1dd('0x1'));var timeout=require(_0xc1dd('0x2'));var express=require('express');var router=express[_0xc1dd('0x3')]();var auth=require(_0xc1dd('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc1dd('0x5'));var controller=require(_0xc1dd('0x6'));router['get']('/',auth[_0xc1dd('0x7')](),controller[_0xc1dd('0x8')]);router['get'](_0xc1dd('0x9'),auth[_0xc1dd('0x7')](),controller['show']);router['post']('/',auth[_0xc1dd('0x7')](),controller[_0xc1dd('0xa')]);router[_0xc1dd('0xb')](_0xc1dd('0x9'),auth['isAuthenticated'](),controller[_0xc1dd('0xc')]);router[_0xc1dd('0xd')](_0xc1dd('0x9'),auth[_0xc1dd('0x7')](),controller['destroy']);module[_0xc1dd('0xe')]=router;
\ No newline at end of file
+var _0xc298=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x4fb3ae,_0x416351){var _0x171934=function(_0x3aedef){while(--_0x3aedef){_0x4fb3ae['push'](_0x4fb3ae['shift']());}};_0x171934(++_0x416351);}(_0xc298,0x143));var _0x8c29=function(_0x4c6a95,_0x47b0bf){_0x4c6a95=_0x4c6a95-0x0;var _0x286c80=_0xc298[_0x4c6a95];return _0x286c80;};'use strict';var multer=require('multer');var util=require(_0x8c29('0x0'));var path=require(_0x8c29('0x1'));var timeout=require(_0x8c29('0x2'));var express=require(_0x8c29('0x3'));var router=express[_0x8c29('0x4')]();var auth=require(_0x8c29('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8c29('0x6'));var controller=require(_0x8c29('0x7'));router[_0x8c29('0x8')]('/',auth[_0x8c29('0x9')](),controller[_0x8c29('0xa')]);router['get'](_0x8c29('0xb'),auth[_0x8c29('0x9')](),controller[_0x8c29('0xc')]);router[_0x8c29('0xd')]('/',auth[_0x8c29('0x9')](),controller[_0x8c29('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x8c29('0xf')]);router[_0x8c29('0x10')](_0x8c29('0xb'),auth[_0x8c29('0x9')](),controller[_0x8c29('0x11')]);module[_0x8c29('0x12')]=router;
\ No newline at end of file
index 946fbd3..aacafad 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x694c=['exports','STRING','name','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x694c,0x103));var _0xc694=function(_0x14ff51,_0x14491b){_0x14ff51=_0x14ff51-0x0;var _0x4e0122=_0x694c[_0x14ff51];return _0x4e0122;};'use strict';var Sequelize=require(_0xc694('0x0'));module[_0xc694('0x1')]={'name':{'type':Sequelize[_0xc694('0x2')],'unique':_0xc694('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x6db3=['name','sequelize','STRING'];(function(_0x47aa04,_0x36b09f){var _0x52c60f=function(_0x3aad20){while(--_0x3aad20){_0x47aa04['push'](_0x47aa04['shift']());}};_0x52c60f(++_0x36b09f);}(_0x6db3,0xaf));var _0x36db=function(_0xf50d55,_0x37166b){_0xf50d55=_0xf50d55-0x0;var _0x3a8cf8=_0x6db3[_0xf50d55];return _0x3a8cf8;};'use strict';var Sequelize=require(_0x36db('0x0'));module['exports']={'name':{'type':Sequelize[_0x36db('0x1')],'unique':_0x36db('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x36db('0x1')]}};
\ No newline at end of file
index 0ff9006..9451d48 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3418=['crypto','desk.js','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','sendStatus','status','count','offset','set','Content-Range','save','then','destroy','get','Pauses','UserProfileResource','end','error','stack','name','send','index','Pause','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','where','map','type','key','VIRTUAL','merge','options','include','rows','show','params','rawAttributes','fields','length','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','lodash','squel'];(function(_0x1c908e,_0x39024e){var _0x592a8a=function(_0x3efa7a){while(--_0x3efa7a){_0x1c908e['push'](_0x1c908e['shift']());}};_0x592a8a(++_0x39024e);}(_0x3418,0x8d));var _0x8341=function(_0x2a6320,_0x31db15){_0x2a6320=_0x2a6320-0x0;var _0x42c239=_0x3418[_0x2a6320];return _0x42c239;};'use strict';var pdf=require(_0x8341('0x0'));var emlformat=require(_0x8341('0x1'));var rimraf=require(_0x8341('0x2'));var zipdir=require(_0x8341('0x3'));var jsonpatch=require(_0x8341('0x4'));var rp=require(_0x8341('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8341('0x6'));var util=require('util');var path=require('path');var sox=require(_0x8341('0x7'));var csv=require(_0x8341('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8341('0x9'));var squel=require(_0x8341('0xa'));var crypto=require(_0x8341('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8341('0xc'));var toCsv=require(_0x8341('0x8'));var querystring=require('querystring');var Papa=require(_0x8341('0xd'));var authService=require('../../components/auth/service');var hardwareService=require(_0x8341('0xe'));var Redis=require(_0x8341('0xf'));var qs=require(_0x8341('0x10'));var logger=require(_0x8341('0x11'))(_0x8341('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d3478,_0x2bd291){_0x2bd291=_0x2bd291||0xcc;return function(_0x8746da){if(_0x8746da){return _0x4d3478[_0x8341('0x13')](_0x2bd291);}return _0x4d3478[_0x8341('0x14')](_0x2bd291)['end']();};}function respondWithResult(_0x1da2ff,_0x36249e){_0x36249e=_0x36249e||0xc8;return function(_0xee13db){if(_0xee13db){return _0x1da2ff['status'](_0x36249e)['json'](_0xee13db);}};}function respondWithFilteredResult(_0x1215e6,_0x14246c){return function(_0x4a3e3c){if(_0x4a3e3c){var _0x4c2737=_0x4a3e3c[_0x8341('0x15')],_0x49a19c=_0x14246c[_0x8341('0x16')],_0x53635a=_0x14246c[_0x8341('0x16')]+_0x14246c['limit'],_0x48b7cd;if(_0x53635a>=_0x4c2737){_0x53635a=_0x4c2737;_0x48b7cd=0xc8;}else{_0x48b7cd=0xce;}_0x1215e6[_0x8341('0x14')](_0x48b7cd);return _0x1215e6[_0x8341('0x17')](_0x8341('0x18'),_0x49a19c+'-'+_0x53635a+'/'+_0x4c2737)['json'](_0x4a3e3c);}return null;};}function patchUpdates(_0x18336d){return function(_0x52a171){try{jsonpatch['apply'](_0x52a171,_0x18336d,!![]);}catch(_0x7c8ab7){return BPromise['reject'](_0x7c8ab7);}return _0x52a171[_0x8341('0x19')]();};}function saveUpdates(_0x599c42,_0x305290){return function(_0x49c5ec){if(_0x49c5ec){return _0x49c5ec['update'](_0x599c42)[_0x8341('0x1a')](function(_0x252bb6){return _0x252bb6;});}return null;};}function removeEntity(_0x281047,_0x19bd6a){return function(_0x1875c8){if(_0x1875c8){return _0x1875c8[_0x8341('0x1b')]()[_0x8341('0x1a')](function(){var _0x1d4edd=_0x1875c8[_0x8341('0x1c')]({'plain':!![]});var _0x18db66=_0x8341('0x1d');return db[_0x8341('0x1e')][_0x8341('0x1b')]({'where':{'type':_0x18db66,'resourceId':_0x1d4edd['id']}})[_0x8341('0x1a')](function(){return _0x1875c8;});})[_0x8341('0x1a')](function(){_0x281047[_0x8341('0x14')](0xcc)[_0x8341('0x1f')]();});}};}function handleEntityNotFound(_0x1df429,_0x138c43){return function(_0x6e8c38){if(!_0x6e8c38){_0x1df429['sendStatus'](0x194);}return _0x6e8c38;};}function handleError(_0x111712,_0x8ebc4f){_0x8ebc4f=_0x8ebc4f||0x1f4;return function(_0x1cd26c){logger[_0x8341('0x20')](_0x1cd26c[_0x8341('0x21')]);if(_0x1cd26c['name']){delete _0x1cd26c[_0x8341('0x22')];}_0x111712['status'](_0x8ebc4f)[_0x8341('0x23')](_0x1cd26c);};}exports[_0x8341('0x24')]=function(_0x1d1c6d,_0xe5e23){var _0x489576={},_0x49e37a={},_0x329bf8={'count':0x0,'rows':[]};var _0x478c81=db[_0x8341('0x25')]['rawAttributes'];_0x49e37a[_0x8341('0x26')]=_[_0x8341('0x27')](_0x478c81);_0x49e37a['query']=_[_0x8341('0x27')](_0x1d1c6d[_0x8341('0x28')]);_0x49e37a[_0x8341('0x29')]=_[_0x8341('0x2a')](_0x49e37a['model'],_0x49e37a['query']);_0x489576[_0x8341('0x2b')]=_[_0x8341('0x2a')](_0x49e37a[_0x8341('0x26')],qs['fields'](_0x1d1c6d['query']['fields']));_0x489576['attributes']=_0x489576[_0x8341('0x2b')]['length']?_0x489576[_0x8341('0x2b')]:_0x49e37a[_0x8341('0x26')];if(!_0x1d1c6d[_0x8341('0x28')][_0x8341('0x2c')](_0x8341('0x2d'))){_0x489576[_0x8341('0x2e')]=qs[_0x8341('0x2e')](_0x1d1c6d[_0x8341('0x28')][_0x8341('0x2e')]);_0x489576[_0x8341('0x16')]=qs[_0x8341('0x16')](_0x1d1c6d[_0x8341('0x28')]['offset']);}_0x489576[_0x8341('0x2f')]=qs[_0x8341('0x30')](_0x1d1c6d[_0x8341('0x28')][_0x8341('0x30')]);_0x489576['where']=qs['filters'](_[_0x8341('0x31')](_0x1d1c6d['query'],_0x49e37a[_0x8341('0x29')]));if(_0x1d1c6d[_0x8341('0x28')]['filter']){_0x489576[_0x8341('0x32')]=_['merge'](_0x489576['where'],{'$or':_[_0x8341('0x33')](_0x478c81,function(_0x19c5bd){if(_0x19c5bd[_0x8341('0x34')][_0x8341('0x35')]!==_0x8341('0x36')){var _0x5d01c5={};_0x5d01c5[_0x19c5bd['field']]={'$like':'%'+_0x1d1c6d[_0x8341('0x28')]['filter']+'%'};return _0x5d01c5;}})});}_0x489576=_[_0x8341('0x37')]({},_0x489576,_0x1d1c6d[_0x8341('0x38')]);var _0x334922={'where':_0x489576[_0x8341('0x32')]};return db[_0x8341('0x25')]['count'](_0x334922)[_0x8341('0x1a')](function(_0xb94e2f){_0x329bf8[_0x8341('0x15')]=_0xb94e2f;if(_0x1d1c6d[_0x8341('0x28')]['includeAll']){_0x489576[_0x8341('0x39')]=[{'all':!![]}];}return db[_0x8341('0x25')]['findAll'](_0x489576);})['then'](function(_0xa45054){_0x329bf8[_0x8341('0x3a')]=_0xa45054;return _0x329bf8;})['then'](respondWithFilteredResult(_0xe5e23,_0x489576))['catch'](handleError(_0xe5e23,null));};exports[_0x8341('0x3b')]=function(_0x1db7fc,_0x106968){var _0x2b10f2={'raw':!![],'where':{'id':_0x1db7fc[_0x8341('0x3c')]['id']}},_0x4cd838={};_0x4cd838['model']=_[_0x8341('0x27')](db['Pause'][_0x8341('0x3d')]);_0x4cd838['query']=_[_0x8341('0x27')](_0x1db7fc['query']);_0x4cd838[_0x8341('0x29')]=_[_0x8341('0x2a')](_0x4cd838[_0x8341('0x26')],_0x4cd838[_0x8341('0x28')]);_0x2b10f2[_0x8341('0x2b')]=_[_0x8341('0x2a')](_0x4cd838[_0x8341('0x26')],qs[_0x8341('0x3e')](_0x1db7fc[_0x8341('0x28')]['fields']));_0x2b10f2['attributes']=_0x2b10f2[_0x8341('0x2b')][_0x8341('0x3f')]?_0x2b10f2[_0x8341('0x2b')]:_0x4cd838[_0x8341('0x26')];if(_0x1db7fc['query'][_0x8341('0x40')]){_0x2b10f2['include']=[{'all':!![]}];}_0x2b10f2=_[_0x8341('0x37')]({},_0x2b10f2,_0x1db7fc[_0x8341('0x38')]);return db['Pause']['find'](_0x2b10f2)[_0x8341('0x1a')](handleEntityNotFound(_0x106968,null))[_0x8341('0x1a')](respondWithResult(_0x106968,null))[_0x8341('0x41')](handleError(_0x106968,null));};exports['create']=function(_0x14404b,_0x3661ec){return db[_0x8341('0x25')][_0x8341('0x42')](_0x14404b[_0x8341('0x43')],{})[_0x8341('0x1a')](function(_0x2e47ea){var _0x3fce4b=_0x14404b[_0x8341('0x44')][_0x8341('0x1c')]({'plain':!![]});if(!_0x3fce4b)throw new Error(_0x8341('0x45'));if(_0x3fce4b[_0x8341('0x46')]===_0x8341('0x44')){var _0xdc96c2=_0x2e47ea[_0x8341('0x1c')]({'plain':!![]});var _0x29d310=_0x8341('0x1d');return db[_0x8341('0x47')][_0x8341('0x48')]({'where':{'name':_0x29d310,'userProfileId':_0x3fce4b['userProfileId']},'raw':!![]})[_0x8341('0x1a')](function(_0x420b27){if(_0x420b27&&_0x420b27[_0x8341('0x49')]===0x0){return db[_0x8341('0x1e')][_0x8341('0x42')]({'name':_0xdc96c2[_0x8341('0x22')],'resourceId':_0xdc96c2['id'],'type':_0x420b27[_0x8341('0x22')],'sectionId':_0x420b27['id']},{})[_0x8341('0x1a')](function(){return _0x2e47ea;});}else{return _0x2e47ea;}})[_0x8341('0x41')](function(_0x21857e){logger[_0x8341('0x20')](_0x8341('0x4a'),_0x21857e);throw _0x21857e;});}return _0x2e47ea;})['then'](respondWithResult(_0x3661ec,0xc9))[_0x8341('0x41')](handleError(_0x3661ec,null));};exports[_0x8341('0x4b')]=function(_0x41f351,_0x3d9e19){if(_0x41f351[_0x8341('0x43')]['id']){delete _0x41f351[_0x8341('0x43')]['id'];}return db['Pause'][_0x8341('0x48')]({'where':{'id':_0x41f351['params']['id']}})[_0x8341('0x1a')](handleEntityNotFound(_0x3d9e19,null))[_0x8341('0x1a')](saveUpdates(_0x41f351[_0x8341('0x43')],null))['then'](respondWithResult(_0x3d9e19,null))[_0x8341('0x41')](handleError(_0x3d9e19,null));};exports[_0x8341('0x1b')]=function(_0x59aea2,_0x12d6b6){return db['Pause'][_0x8341('0x48')]({'where':{'id':_0x59aea2[_0x8341('0x3c')]['id']}})[_0x8341('0x1a')](handleEntityNotFound(_0x12d6b6,null))['then'](removeEntity(_0x12d6b6,null))[_0x8341('0x41')](handleError(_0x12d6b6,null));};
\ No newline at end of file
+var _0xbfaf=['../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','Pauses','UserProfileResource','error','name','index','Pause','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','map','type','key','VIRTUAL','field','filter','includeAll','include','rows','show','params','rawAttributes','merge','options','find','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse'];(function(_0x4efd6f,_0x18984){var _0x1b8afd=function(_0x2501cb){while(--_0x2501cb){_0x4efd6f['push'](_0x4efd6f['shift']());}};_0x1b8afd(++_0x18984);}(_0xbfaf,0x198));var _0xfbfa=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0xbfaf[_0x504df1];return _0x1063b5;};'use strict';var pdf=require(_0xfbfa('0x0'));var emlformat=require(_0xfbfa('0x1'));var rimraf=require(_0xfbfa('0x2'));var zipdir=require(_0xfbfa('0x3'));var jsonpatch=require(_0xfbfa('0x4'));var rp=require(_0xfbfa('0x5'));var moment=require(_0xfbfa('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xfbfa('0x7'));var util=require(_0xfbfa('0x8'));var path=require(_0xfbfa('0x9'));var sox=require(_0xfbfa('0xa'));var csv=require(_0xfbfa('0xb'));var ejs=require(_0xfbfa('0xc'));var fs=require('fs');var _=require(_0xfbfa('0xd'));var squel=require(_0xfbfa('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfbfa('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfbfa('0x10'));var authService=require(_0xfbfa('0x11'));var hardwareService=require(_0xfbfa('0x12'));var Redis=require(_0xfbfa('0x13'));var qs=require(_0xfbfa('0x14'));var logger=require(_0xfbfa('0x15'))(_0xfbfa('0x16'));var utils=require(_0xfbfa('0x17'));var config=require('../../config/environment');var db=require(_0xfbfa('0x18'))['db'];function respondWithStatusCode(_0x2b6021,_0x538bec){_0x538bec=_0x538bec||0xcc;return function(_0x6dfa63){if(_0x6dfa63){return _0x2b6021[_0xfbfa('0x19')](_0x538bec);}return _0x2b6021[_0xfbfa('0x1a')](_0x538bec)[_0xfbfa('0x1b')]();};}function respondWithResult(_0x179af0,_0x5d1388){_0x5d1388=_0x5d1388||0xc8;return function(_0x3560ad){if(_0x3560ad){return _0x179af0[_0xfbfa('0x1a')](_0x5d1388)[_0xfbfa('0x1c')](_0x3560ad);}};}function respondWithFilteredResult(_0xd53196,_0x1a000b){return function(_0x179a74){if(_0x179a74){var _0x2bfbac=_0x179a74[_0xfbfa('0x1d')],_0x26bdda=_0x1a000b[_0xfbfa('0x1e')],_0x119ceb=_0x1a000b[_0xfbfa('0x1e')]+_0x1a000b[_0xfbfa('0x1f')],_0x20f657;if(_0x119ceb>=_0x2bfbac){_0x119ceb=_0x2bfbac;_0x20f657=0xc8;}else{_0x20f657=0xce;}_0xd53196[_0xfbfa('0x1a')](_0x20f657);return _0xd53196[_0xfbfa('0x20')](_0xfbfa('0x21'),_0x26bdda+'-'+_0x119ceb+'/'+_0x2bfbac)[_0xfbfa('0x1c')](_0x179a74);}return null;};}function patchUpdates(_0x368607){return function(_0x5ee0bf){try{jsonpatch[_0xfbfa('0x22')](_0x5ee0bf,_0x368607,!![]);}catch(_0x35197b){return BPromise[_0xfbfa('0x23')](_0x35197b);}return _0x5ee0bf[_0xfbfa('0x24')]();};}function saveUpdates(_0x174320,_0x578649){return function(_0x25eab4){if(_0x25eab4){return _0x25eab4['update'](_0x174320)[_0xfbfa('0x25')](function(_0x4bd29a){return _0x4bd29a;});}return null;};}function removeEntity(_0x210cbb,_0x1dc8ae){return function(_0x55f365){if(_0x55f365){return _0x55f365[_0xfbfa('0x26')]()[_0xfbfa('0x25')](function(){var _0x10f54c=_0x55f365['get']({'plain':!![]});var _0x1e6e03=_0xfbfa('0x27');return db[_0xfbfa('0x28')][_0xfbfa('0x26')]({'where':{'type':_0x1e6e03,'resourceId':_0x10f54c['id']}})[_0xfbfa('0x25')](function(){return _0x55f365;});})[_0xfbfa('0x25')](function(){_0x210cbb[_0xfbfa('0x1a')](0xcc)[_0xfbfa('0x1b')]();});}};}function handleEntityNotFound(_0x39c36e,_0x4b3119){return function(_0x4e8d21){if(!_0x4e8d21){_0x39c36e[_0xfbfa('0x19')](0x194);}return _0x4e8d21;};}function handleError(_0x39af5b,_0x2e135c){_0x2e135c=_0x2e135c||0x1f4;return function(_0x5e3a45){logger[_0xfbfa('0x29')](_0x5e3a45['stack']);if(_0x5e3a45['name']){delete _0x5e3a45[_0xfbfa('0x2a')];}_0x39af5b[_0xfbfa('0x1a')](_0x2e135c)['send'](_0x5e3a45);};}exports[_0xfbfa('0x2b')]=function(_0x167ab9,_0x597d3d){var _0x8d7528={},_0x12794f={},_0x5b0b84={'count':0x0,'rows':[]};var _0x1e3c8b=db[_0xfbfa('0x2c')]['rawAttributes'];_0x12794f[_0xfbfa('0x2d')]=_[_0xfbfa('0x2e')](_0x1e3c8b);_0x12794f['query']=_[_0xfbfa('0x2e')](_0x167ab9['query']);_0x12794f[_0xfbfa('0x2f')]=_[_0xfbfa('0x30')](_0x12794f[_0xfbfa('0x2d')],_0x12794f[_0xfbfa('0x31')]);_0x8d7528[_0xfbfa('0x32')]=_[_0xfbfa('0x30')](_0x12794f[_0xfbfa('0x2d')],qs[_0xfbfa('0x33')](_0x167ab9['query'][_0xfbfa('0x33')]));_0x8d7528[_0xfbfa('0x32')]=_0x8d7528[_0xfbfa('0x32')][_0xfbfa('0x34')]?_0x8d7528['attributes']:_0x12794f[_0xfbfa('0x2d')];if(!_0x167ab9[_0xfbfa('0x31')][_0xfbfa('0x35')](_0xfbfa('0x36'))){_0x8d7528[_0xfbfa('0x1f')]=qs[_0xfbfa('0x1f')](_0x167ab9[_0xfbfa('0x31')]['limit']);_0x8d7528[_0xfbfa('0x1e')]=qs[_0xfbfa('0x1e')](_0x167ab9['query'][_0xfbfa('0x1e')]);}_0x8d7528[_0xfbfa('0x37')]=qs[_0xfbfa('0x38')](_0x167ab9[_0xfbfa('0x31')][_0xfbfa('0x38')]);_0x8d7528['where']=qs[_0xfbfa('0x2f')](_['pick'](_0x167ab9['query'],_0x12794f[_0xfbfa('0x2f')]));if(_0x167ab9[_0xfbfa('0x31')]['filter']){_0x8d7528[_0xfbfa('0x39')]=_['merge'](_0x8d7528[_0xfbfa('0x39')],{'$or':_[_0xfbfa('0x3a')](_0x1e3c8b,function(_0x53d391){if(_0x53d391[_0xfbfa('0x3b')][_0xfbfa('0x3c')]!==_0xfbfa('0x3d')){var _0x50018b={};_0x50018b[_0x53d391[_0xfbfa('0x3e')]]={'$like':'%'+_0x167ab9['query'][_0xfbfa('0x3f')]+'%'};return _0x50018b;}})});}_0x8d7528=_['merge']({},_0x8d7528,_0x167ab9['options']);var _0xd82545={'where':_0x8d7528['where']};return db[_0xfbfa('0x2c')]['count'](_0xd82545)[_0xfbfa('0x25')](function(_0x3d45c3){_0x5b0b84[_0xfbfa('0x1d')]=_0x3d45c3;if(_0x167ab9['query'][_0xfbfa('0x40')]){_0x8d7528[_0xfbfa('0x41')]=[{'all':!![]}];}return db['Pause']['findAll'](_0x8d7528);})[_0xfbfa('0x25')](function(_0x37f29d){_0x5b0b84[_0xfbfa('0x42')]=_0x37f29d;return _0x5b0b84;})[_0xfbfa('0x25')](respondWithFilteredResult(_0x597d3d,_0x8d7528))['catch'](handleError(_0x597d3d,null));};exports[_0xfbfa('0x43')]=function(_0xa848f5,_0x593c35){var _0x2eb7d9={'raw':!![],'where':{'id':_0xa848f5[_0xfbfa('0x44')]['id']}},_0x43b593={};_0x43b593[_0xfbfa('0x2d')]=_['keys'](db[_0xfbfa('0x2c')][_0xfbfa('0x45')]);_0x43b593[_0xfbfa('0x31')]=_['keys'](_0xa848f5['query']);_0x43b593[_0xfbfa('0x2f')]=_[_0xfbfa('0x30')](_0x43b593['model'],_0x43b593[_0xfbfa('0x31')]);_0x2eb7d9[_0xfbfa('0x32')]=_[_0xfbfa('0x30')](_0x43b593[_0xfbfa('0x2d')],qs[_0xfbfa('0x33')](_0xa848f5['query']['fields']));_0x2eb7d9[_0xfbfa('0x32')]=_0x2eb7d9['attributes']['length']?_0x2eb7d9[_0xfbfa('0x32')]:_0x43b593[_0xfbfa('0x2d')];if(_0xa848f5['query'][_0xfbfa('0x40')]){_0x2eb7d9[_0xfbfa('0x41')]=[{'all':!![]}];}_0x2eb7d9=_[_0xfbfa('0x46')]({},_0x2eb7d9,_0xa848f5[_0xfbfa('0x47')]);return db[_0xfbfa('0x2c')][_0xfbfa('0x48')](_0x2eb7d9)[_0xfbfa('0x25')](handleEntityNotFound(_0x593c35,null))['then'](respondWithResult(_0x593c35,null))[_0xfbfa('0x49')](handleError(_0x593c35,null));};exports[_0xfbfa('0x4a')]=function(_0x30c297,_0x4bfc34){return db[_0xfbfa('0x2c')]['create'](_0x30c297['body'],{})['then'](function(_0x3f318d){var _0x4ef3e4=_0x30c297['user'][_0xfbfa('0x4b')]({'plain':!![]});if(!_0x4ef3e4)throw new Error(_0xfbfa('0x4c'));if(_0x4ef3e4[_0xfbfa('0x4d')]===_0xfbfa('0x4e')){var _0x17fe3a=_0x3f318d[_0xfbfa('0x4b')]({'plain':!![]});var _0x2fa8dc=_0xfbfa('0x27');return db[_0xfbfa('0x4f')]['find']({'where':{'name':_0x2fa8dc,'userProfileId':_0x4ef3e4[_0xfbfa('0x50')]},'raw':!![]})['then'](function(_0x34a003){if(_0x34a003&&_0x34a003[_0xfbfa('0x51')]===0x0){return db['UserProfileResource'][_0xfbfa('0x4a')]({'name':_0x17fe3a[_0xfbfa('0x2a')],'resourceId':_0x17fe3a['id'],'type':_0x34a003[_0xfbfa('0x2a')],'sectionId':_0x34a003['id']},{})['then'](function(){return _0x3f318d;});}else{return _0x3f318d;}})['catch'](function(_0x1a5f12){logger[_0xfbfa('0x29')](_0xfbfa('0x52'),_0x1a5f12);throw _0x1a5f12;});}return _0x3f318d;})[_0xfbfa('0x25')](respondWithResult(_0x4bfc34,0xc9))['catch'](handleError(_0x4bfc34,null));};exports[_0xfbfa('0x53')]=function(_0x2d53fa,_0xd708b0){if(_0x2d53fa[_0xfbfa('0x54')]['id']){delete _0x2d53fa[_0xfbfa('0x54')]['id'];}return db['Pause'][_0xfbfa('0x48')]({'where':{'id':_0x2d53fa['params']['id']}})[_0xfbfa('0x25')](handleEntityNotFound(_0xd708b0,null))[_0xfbfa('0x25')](saveUpdates(_0x2d53fa[_0xfbfa('0x54')],null))[_0xfbfa('0x25')](respondWithResult(_0xd708b0,null))[_0xfbfa('0x49')](handleError(_0xd708b0,null));};exports[_0xfbfa('0x26')]=function(_0x46191e,_0x3e8ffb){return db['Pause'][_0xfbfa('0x48')]({'where':{'id':_0x46191e[_0xfbfa('0x44')]['id']}})[_0xfbfa('0x25')](handleEntityNotFound(_0x3e8ffb,null))[_0xfbfa('0x25')](removeEntity(_0x3e8ffb,null))[_0xfbfa('0x49')](handleError(_0x3e8ffb,null));};
\ No newline at end of file
index 7cf5f02..126ab14 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe330=['../../config/logger','moment','bluebird','request-promise','./pause.attributes','define','Pause','tools_pauses','lodash'];(function(_0x49b24a,_0x53f2d8){var _0x277f64=function(_0x3af795){while(--_0x3af795){_0x49b24a['push'](_0x49b24a['shift']());}};_0x277f64(++_0x53f2d8);}(_0xe330,0x1dc));var _0x0e33=function(_0x193bed,_0x50370c){_0x193bed=_0x193bed-0x0;var _0x403556=_0xe330[_0x193bed];return _0x403556;};'use strict';var _=require(_0x0e33('0x0'));var util=require('util');var logger=require(_0x0e33('0x1'))('api');var moment=require(_0x0e33('0x2'));var BPromise=require(_0x0e33('0x3'));var rp=require(_0x0e33('0x4'));var attributes=require(_0x0e33('0x5'));module['exports']=function(_0x519209,_0x267ab5){return _0x519209[_0x0e33('0x6')](_0x0e33('0x7'),attributes,{'tableName':_0x0e33('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x973d=['api','bluebird','./pause.attributes','exports','tools_pauses','util','../../config/logger'];(function(_0x270899,_0x309e77){var _0x10910c=function(_0x48d1f2){while(--_0x48d1f2){_0x270899['push'](_0x270899['shift']());}};_0x10910c(++_0x309e77);}(_0x973d,0x140));var _0xd973=function(_0x2923a0,_0x409dea){_0x2923a0=_0x2923a0-0x0;var _0x35930e=_0x973d[_0x2923a0];return _0x35930e;};'use strict';var _=require('lodash');var util=require(_0xd973('0x0'));var logger=require(_0xd973('0x1'))(_0xd973('0x2'));var moment=require('moment');var BPromise=require(_0xd973('0x3'));var rp=require('request-promise');var attributes=require(_0xd973('0x4'));module[_0xd973('0x5')]=function(_0x5a3696,_0x23c2bc){return _0x5a3696['define']('Pause',attributes,{'tableName':_0xd973('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 2548475..d1587ba 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2308=['include','model','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','request\x20sent','Pause,\x20%s,\x20%s,\x20%s','stringify','error','Pause,\x20%s,\x20%s','message','info','result','ShowPause','Pause','options','where','attributes','map'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x2308,0x108));var _0x8230=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x2308[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0x8230('0x0'));var util=require('util');var moment=require(_0x8230('0x1'));var BPromise=require(_0x8230('0x2'));var rs=require(_0x8230('0x3'));var fs=require('fs');var Redis=require(_0x8230('0x4'));var db=require(_0x8230('0x5'))['db'];var utils=require(_0x8230('0x6'));var logger=require(_0x8230('0x7'))('rpc');var config=require(_0x8230('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8230('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19990d,_0x26ca48,_0x1938b6){return new BPromise(function(_0x2344b0,_0x1b89be){return client[_0x8230('0xa')](_0x19990d,_0x1938b6)[_0x8230('0xb')](function(_0x3885f3){logger['info']('Pause,\x20%s,\x20%s',_0x26ca48,_0x8230('0xc'));logger['debug'](_0x8230('0xd'),_0x26ca48,_0x8230('0xc'),JSON[_0x8230('0xe')](_0x3885f3));if(_0x3885f3[_0x8230('0xf')]){if(_0x3885f3[_0x8230('0xf')]['code']===0x1f4){logger[_0x8230('0xf')](_0x8230('0x10'),_0x26ca48,_0x3885f3[_0x8230('0xf')][_0x8230('0x11')]);return _0x1b89be(_0x3885f3[_0x8230('0xf')][_0x8230('0x11')]);}logger['error']('Pause,\x20%s,\x20%s',_0x26ca48,_0x3885f3[_0x8230('0xf')][_0x8230('0x11')]);return _0x2344b0(_0x3885f3[_0x8230('0xf')][_0x8230('0x11')]);}else{logger[_0x8230('0x12')](_0x8230('0x10'),_0x26ca48,_0x8230('0xc'));_0x2344b0(_0x3885f3[_0x8230('0x13')]['message']);}})['catch'](function(_0x317c66){logger[_0x8230('0xf')](_0x8230('0x10'),_0x26ca48,_0x317c66);_0x1b89be(_0x317c66);});});}exports[_0x8230('0x14')]=function(_0x293c54){var _0x2310b4=this;return new Promise(function(_0x33099c,_0x3da24e){return db[_0x8230('0x15')]['find']({'raw':_0x293c54['options']?_0x293c54[_0x8230('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x293c54[_0x8230('0x16')]?_0x293c54[_0x8230('0x16')][_0x8230('0x17')]||null:null,'attributes':_0x293c54[_0x8230('0x16')]?_0x293c54[_0x8230('0x16')][_0x8230('0x18')]||null:null,'include':_0x293c54['options']?_0x293c54[_0x8230('0x16')]['include']?_[_0x8230('0x19')](_0x293c54[_0x8230('0x16')][_0x8230('0x1a')],function(_0x338e94){return{'model':db[_0x338e94[_0x8230('0x1b')]],'as':_0x338e94['as'],'attributes':_0x338e94[_0x8230('0x18')],'include':_0x338e94[_0x8230('0x1a')]?_[_0x8230('0x19')](_0x338e94[_0x8230('0x1a')],function(_0x51604c){return{'model':db[_0x51604c[_0x8230('0x1b')]],'as':_0x51604c['as'],'attributes':_0x51604c[_0x8230('0x18')],'include':_0x51604c[_0x8230('0x1a')]?_['map'](_0x51604c[_0x8230('0x1a')],function(_0xae7f97){return{'model':db[_0xae7f97[_0x8230('0x1b')]],'as':_0xae7f97['as'],'attributes':_0xae7f97['attributes']};}):[]};}):[]};}):[]:[]})[_0x8230('0xb')](function(_0x1d3fb5){logger[_0x8230('0x12')](_0x8230('0x14'),_0x293c54);logger[_0x8230('0x1c')](_0x8230('0x14'),_0x293c54,JSON[_0x8230('0xe')](_0x1d3fb5));_0x33099c(_0x1d3fb5);})['catch'](function(_0x5d5014){logger[_0x8230('0xf')]('ShowPause',_0x5d5014['message'],_0x293c54);_0x3da24e(_0x2310b4[_0x8230('0xf')](0x1f4,_0x5d5014['message']));});});};
\ No newline at end of file
+var _0x3487=['Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowPause','Pause','find','options','where','attributes','include','model','map','then','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','Pause,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4b91e6,_0x17dab7){var _0xe65bda=function(_0x47630f){while(--_0x47630f){_0x4b91e6['push'](_0x4b91e6['shift']());}};_0xe65bda(++_0x17dab7);}(_0x3487,0xd8));var _0x7348=function(_0x1f27df,_0x4f1a64){_0x1f27df=_0x1f27df-0x0;var _0x286ee2=_0x3487[_0x1f27df];return _0x286ee2;};'use strict';var _=require(_0x7348('0x0'));var util=require(_0x7348('0x1'));var moment=require(_0x7348('0x2'));var BPromise=require('bluebird');var rs=require(_0x7348('0x3'));var fs=require('fs');var Redis=require(_0x7348('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7348('0x5'));var logger=require(_0x7348('0x6'))('rpc');var config=require(_0x7348('0x7'));var jayson=require(_0x7348('0x8'));var client=jayson[_0x7348('0x9')][_0x7348('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x591fbe,_0x323568,_0x488767){return new BPromise(function(_0x4ddafb,_0x40e2d1){return client[_0x7348('0xb')](_0x591fbe,_0x488767)['then'](function(_0x5d1819){logger['info'](_0x7348('0xc'),_0x323568,_0x7348('0xd'));logger[_0x7348('0xe')](_0x7348('0xf'),_0x323568,'request\x20sent',JSON[_0x7348('0x10')](_0x5d1819));if(_0x5d1819[_0x7348('0x11')]){if(_0x5d1819[_0x7348('0x11')][_0x7348('0x12')]===0x1f4){logger[_0x7348('0x11')]('Pause,\x20%s,\x20%s',_0x323568,_0x5d1819[_0x7348('0x11')][_0x7348('0x13')]);return _0x40e2d1(_0x5d1819['error'][_0x7348('0x13')]);}logger[_0x7348('0x11')]('Pause,\x20%s,\x20%s',_0x323568,_0x5d1819[_0x7348('0x11')][_0x7348('0x13')]);return _0x4ddafb(_0x5d1819[_0x7348('0x11')][_0x7348('0x13')]);}else{logger[_0x7348('0x14')]('Pause,\x20%s,\x20%s',_0x323568,_0x7348('0xd'));_0x4ddafb(_0x5d1819[_0x7348('0x15')]['message']);}})[_0x7348('0x16')](function(_0x3f7084){logger[_0x7348('0x11')]('Pause,\x20%s,\x20%s',_0x323568,_0x3f7084);_0x40e2d1(_0x3f7084);});});}exports[_0x7348('0x17')]=function(_0x3f14cb){var _0x2becc7=this;return new Promise(function(_0x14122c,_0xd45a03){return db[_0x7348('0x18')][_0x7348('0x19')]({'raw':_0x3f14cb[_0x7348('0x1a')]?_0x3f14cb[_0x7348('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3f14cb[_0x7348('0x1a')]?_0x3f14cb['options'][_0x7348('0x1b')]||null:null,'attributes':_0x3f14cb[_0x7348('0x1a')]?_0x3f14cb['options'][_0x7348('0x1c')]||null:null,'include':_0x3f14cb[_0x7348('0x1a')]?_0x3f14cb[_0x7348('0x1a')][_0x7348('0x1d')]?_['map'](_0x3f14cb[_0x7348('0x1a')][_0x7348('0x1d')],function(_0x540b7e){return{'model':db[_0x540b7e[_0x7348('0x1e')]],'as':_0x540b7e['as'],'attributes':_0x540b7e[_0x7348('0x1c')],'include':_0x540b7e['include']?_['map'](_0x540b7e[_0x7348('0x1d')],function(_0x11eae8){return{'model':db[_0x11eae8[_0x7348('0x1e')]],'as':_0x11eae8['as'],'attributes':_0x11eae8[_0x7348('0x1c')],'include':_0x11eae8[_0x7348('0x1d')]?_[_0x7348('0x1f')](_0x11eae8[_0x7348('0x1d')],function(_0x5857f2){return{'model':db[_0x5857f2[_0x7348('0x1e')]],'as':_0x5857f2['as'],'attributes':_0x5857f2[_0x7348('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7348('0x20')](function(_0xd965d6){logger[_0x7348('0x14')](_0x7348('0x17'),_0x3f14cb);logger['debug'](_0x7348('0x17'),_0x3f14cb,JSON[_0x7348('0x10')](_0xd965d6));_0x14122c(_0xd965d6);})['catch'](function(_0xc41bea){logger[_0x7348('0x11')](_0x7348('0x17'),_0xc41bea[_0x7348('0x13')],_0x3f14cb);_0xd45a03(_0x2becc7[_0x7348('0x11')](0x1f4,_0xc41bea[_0x7348('0x13')]));});});};
\ No newline at end of file
index fd74e27..b93524d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9697=['post','single','file','upload','webhookPost','put','update','delete','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','now'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9697,0x1b6));var _0x7969=function(_0x58c0a7,_0x4afc08){_0x58c0a7=_0x58c0a7-0x0;var _0x18f837=_0x9697[_0x58c0a7];return _0x18f837;};'use strict';var multer=require(_0x7969('0x0'));var util=require(_0x7969('0x1'));var path=require(_0x7969('0x2'));var timeout=require(_0x7969('0x3'));var express=require(_0x7969('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7969('0x5'));var config=require(_0x7969('0x6'));var controller=require(_0x7969('0x7'));router[_0x7969('0x8')]('/',auth[_0x7969('0x9')](),controller[_0x7969('0xa')]);router[_0x7969('0x8')](_0x7969('0xb'),controller[_0x7969('0xc')]);router[_0x7969('0x8')](_0x7969('0xd'),auth[_0x7969('0x9')](),controller['show']);router[_0x7969('0x8')](_0x7969('0xe'),auth['isAuthenticated'](),controller[_0x7969('0xf')]);var upload=multer({'storage':multer[_0x7969('0x10')]({'destination':function(_0x4cbb3a,_0x21eb29,_0x33f67f){_0x33f67f(null,path[_0x7969('0x11')](config[_0x7969('0x12')],_0x7969('0x13')));},'filename':function(_0x49ab10,_0x41e360,_0x510a12){_0x41e360[_0x7969('0x14')]=_0x41e360['originalname'][_0x7969('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x510a12(null,util[_0x7969('0x16')]('%s-%s%s',path['basename'](_0x41e360[_0x7969('0x14')],path['extname'](_0x41e360[_0x7969('0x14')])),Date[_0x7969('0x17')](),path['extname'](_0x41e360[_0x7969('0x14')])));}})});router[_0x7969('0x18')]('/',upload[_0x7969('0x19')](_0x7969('0x1a')),controller[_0x7969('0x1b')]);router[_0x7969('0x18')]('/webhook',controller[_0x7969('0x1c')]);router[_0x7969('0x1d')](_0x7969('0xd'),auth[_0x7969('0x9')](),controller[_0x7969('0x1e')]);router[_0x7969('0x1f')]('/:id',auth['isAuthenticated'](),controller[_0x7969('0x1f')]);module[_0x7969('0x20')]=router;
\ No newline at end of file
+var _0xbf41=['file','upload','webhookPost','put','/:id','update','delete','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/webhook','webhookGet','isAuthenticated','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','format','%s-%s%s','basename','now','extname','post'];(function(_0x422e1f,_0x27dae5){var _0x55f806=function(_0x272920){while(--_0x272920){_0x422e1f['push'](_0x422e1f['shift']());}};_0x55f806(++_0x27dae5);}(_0xbf41,0x1e7));var _0x1bf4=function(_0x1582a3,_0x142ded){_0x1582a3=_0x1582a3-0x0;var _0x11cac2=_0xbf41[_0x1582a3];return _0x11cac2;};'use strict';var multer=require(_0x1bf4('0x0'));var util=require('util');var path=require(_0x1bf4('0x1'));var timeout=require('connect-timeout');var express=require(_0x1bf4('0x2'));var router=express[_0x1bf4('0x3')]();var auth=require(_0x1bf4('0x4'));var interaction=require(_0x1bf4('0x5'));var config=require(_0x1bf4('0x6'));var controller=require('./plugin.controller');router[_0x1bf4('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x1bf4('0x8'),controller[_0x1bf4('0x9')]);router[_0x1bf4('0x7')]('/:id',auth[_0x1bf4('0xa')](),controller[_0x1bf4('0xb')]);router['get'](_0x1bf4('0xc'),auth[_0x1bf4('0xa')](),controller[_0x1bf4('0xd')]);var upload=multer({'storage':multer[_0x1bf4('0xe')]({'destination':function(_0xe7e70a,_0x102cf6,_0xa207c4){_0xa207c4(null,path[_0x1bf4('0xf')](config[_0x1bf4('0x10')],_0x1bf4('0x11')));},'filename':function(_0x55e746,_0x4465d4,_0x1350e3){_0x4465d4['originalname']=_0x4465d4[_0x1bf4('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1350e3(null,util[_0x1bf4('0x13')](_0x1bf4('0x14'),path[_0x1bf4('0x15')](_0x4465d4['originalname'],path['extname'](_0x4465d4[_0x1bf4('0x12')])),Date[_0x1bf4('0x16')](),path[_0x1bf4('0x17')](_0x4465d4['originalname'])));}})});router[_0x1bf4('0x18')]('/',upload['single'](_0x1bf4('0x19')),controller[_0x1bf4('0x1a')]);router['post'](_0x1bf4('0x8'),controller[_0x1bf4('0x1b')]);router[_0x1bf4('0x1c')](_0x1bf4('0x1d'),auth['isAuthenticated'](),controller[_0x1bf4('0x1e')]);router['delete'](_0x1bf4('0x1d'),auth['isAuthenticated'](),controller[_0x1bf4('0x1f')]);module['exports']=router;
\ No newline at end of file
index cdabf3f..c36fd40 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6340=['BOOLEAN','agentOnly','always','never','sequelize','exports','ENUM','html','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x6340,0x100));var _0x0634=function(_0x3f55de,_0x3ae98f){_0x3f55de=_0x3f55de-0x0;var _0x2698de=_0x6340[_0x3f55de];return _0x2698de;};'use strict';var Sequelize=require(_0x0634('0x0'));module[_0x0634('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0634('0x2')](_0x0634('0x3'),_0x0634('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x0634('0x5')]},'path':{'type':Sequelize[_0x0634('0x6')],'comment':_0x0634('0x7')},'active':{'type':Sequelize[_0x0634('0x8')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x0634('0x2')]('adminOnly',_0x0634('0x9'),_0x0634('0xa'),_0x0634('0xb')),'defaultValue':_0x0634('0xa'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x0634('0x6')]},'adminUrl':{'type':Sequelize[_0x0634('0x6')]},'agentUrl':{'type':Sequelize[_0x0634('0x6')]},'scriptName':{'type':Sequelize[_0x0634('0x6')]},'scriptPath':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x08aa=['ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','exports','STRING'];(function(_0x3b47c8,_0x3590f8){var _0x22f579=function(_0x292855){while(--_0x292855){_0x3b47c8['push'](_0x3b47c8['shift']());}};_0x22f579(++_0x3590f8);}(_0x08aa,0x9a));var _0xa08a=function(_0x41766a,_0x59349f){_0x41766a=_0x41766a-0x0;var _0x14e5ac=_0x08aa[_0x41766a];return _0x14e5ac;};'use strict';var Sequelize=require('sequelize');module[_0xa08a('0x0')]={'name':{'type':Sequelize[_0xa08a('0x1')]},'type':{'type':Sequelize[_0xa08a('0x2')](_0xa08a('0x3'),_0xa08a('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xa08a('0x5')]},'path':{'type':Sequelize[_0xa08a('0x1')],'comment':_0xa08a('0x6')},'active':{'type':Sequelize[_0xa08a('0x7')],'defaultValue':0x0,'comment':_0xa08a('0x8')},'sidebar':{'type':Sequelize['ENUM'](_0xa08a('0x9'),_0xa08a('0xa'),_0xa08a('0xb'),_0xa08a('0xc')),'defaultValue':_0xa08a('0xb'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xa08a('0x1')]},'adminUrl':{'type':Sequelize[_0xa08a('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xa08a('0x1')]},'scriptPath':{'type':Sequelize['STRING']}};
\ No newline at end of file
index f7703c9..e7b4cab 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4f03=['extract-zip','archiver','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','get','Plugins','UserProfileResource','end','error','name','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','map','type','field','filter','options','Plugin','includeAll','include','findAll','rows','catch','show','params','find','download','root','format','%s.zip','basename','createWriteStream','warning','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','**/*','server/files/plugins','dirname','node_modules/**/*','join','finalize','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','some','manifest.json','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','parameters','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','scriptPath','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','method','%s%s','headers','content-length','endsWith','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','ioredis'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4f03,0x8e));var _0x34f0=function(_0x5c38cd,_0x5a6b4e){_0x5c38cd=_0x5c38cd-0x0;var _0xc985ef=_0x4f03[_0x5c38cd];return _0xc985ef;};'use strict';var pdf=require(_0x34f0('0x0'));var emlformat=require(_0x34f0('0x1'));var rimraf=require(_0x34f0('0x2'));var zipdir=require(_0x34f0('0x3'));var jsonpatch=require(_0x34f0('0x4'));var rp=require('request-promise');var moment=require(_0x34f0('0x5'));var BPromise=require(_0x34f0('0x6'));var Mustache=require(_0x34f0('0x7'));var util=require('util');var path=require(_0x34f0('0x8'));var sox=require(_0x34f0('0x9'));var csv=require(_0x34f0('0xa'));var ejs=require(_0x34f0('0xb'));var fs=require('fs');var _=require(_0x34f0('0xc'));var squel=require(_0x34f0('0xd'));var crypto=require(_0x34f0('0xe'));var jsforce=require(_0x34f0('0xf'));var deskjs=require(_0x34f0('0x10'));var toCsv=require(_0x34f0('0xa'));var querystring=require(_0x34f0('0x11'));var Papa=require(_0x34f0('0x12'));var authService=require(_0x34f0('0x13'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x34f0('0x14'));var extract=require(_0x34f0('0x15'));var rimraf=require(_0x34f0('0x2'));var archiver=require(_0x34f0('0x16'));var qs=require(_0x34f0('0x17'));var logger=require(_0x34f0('0x18'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x34f0('0x19'))['db'];config['redis']=_['defaults'](config[_0x34f0('0x1a')],{'host':_0x34f0('0x1b'),'port':0x18eb});var socket=require(_0x34f0('0x1c'))(new Redis(config[_0x34f0('0x1a')]));require(_0x34f0('0x1d'))[_0x34f0('0x1e')](socket);function respondWithStatusCode(_0x2fc0d6,_0x3b8452){_0x3b8452=_0x3b8452||0xcc;return function(_0x50c8c7){if(_0x50c8c7){return _0x2fc0d6[_0x34f0('0x1f')](_0x3b8452);}return _0x2fc0d6[_0x34f0('0x20')](_0x3b8452)['end']();};}function respondWithResult(_0x3e1c73,_0x25e43c){_0x25e43c=_0x25e43c||0xc8;return function(_0x292938){if(_0x292938){return _0x3e1c73[_0x34f0('0x20')](_0x25e43c)[_0x34f0('0x21')](_0x292938);}};}function respondWithFilteredResult(_0x21a4fe,_0x13386b){return function(_0x57f548){if(_0x57f548){var _0x33060b=_0x57f548[_0x34f0('0x22')],_0x1b6135=_0x13386b[_0x34f0('0x23')],_0x1b1876=_0x13386b[_0x34f0('0x23')]+_0x13386b[_0x34f0('0x24')],_0x5ef091;if(_0x1b1876>=_0x33060b){_0x1b1876=_0x33060b;_0x5ef091=0xc8;}else{_0x5ef091=0xce;}_0x21a4fe[_0x34f0('0x20')](_0x5ef091);return _0x21a4fe[_0x34f0('0x25')](_0x34f0('0x26'),_0x1b6135+'-'+_0x1b1876+'/'+_0x33060b)['json'](_0x57f548);}return null;};}function patchUpdates(_0x1b69ff){return function(_0x44ec42){try{jsonpatch['apply'](_0x44ec42,_0x1b69ff,!![]);}catch(_0x45d1e0){return BPromise[_0x34f0('0x27')](_0x45d1e0);}return _0x44ec42['save']();};}function saveUpdates(_0x2ae0bd,_0x12aead){return function(_0x2d32e8){if(_0x2d32e8){return _0x2d32e8[_0x34f0('0x28')](_0x2ae0bd)[_0x34f0('0x29')](function(_0x46767e){return _0x46767e;});}return null;};}function removeEntity(_0x3b1298,_0x386dd6){return function(_0x507366){if(_0x507366){return _0x507366[_0x34f0('0x2a')]()[_0x34f0('0x29')](function(){var _0x20d615=_0x507366[_0x34f0('0x2b')]({'plain':!![]});var _0x409336=_0x34f0('0x2c');return db[_0x34f0('0x2d')][_0x34f0('0x2a')]({'where':{'type':_0x409336,'resourceId':_0x20d615['id']}})['then'](function(){return _0x507366;});})[_0x34f0('0x29')](function(){_0x3b1298[_0x34f0('0x20')](0xcc)[_0x34f0('0x2e')]();});}};}function handleEntityNotFound(_0x13df57,_0x1c5c49){return function(_0x46385e){if(!_0x46385e){_0x13df57['sendStatus'](0x194);}return _0x46385e;};}function handleError(_0x17b255,_0x2cdb19){_0x2cdb19=_0x2cdb19||0x1f4;return function(_0x15c2ee){logger[_0x34f0('0x2f')](_0x15c2ee['stack']);if(_0x15c2ee[_0x34f0('0x30')]){delete _0x15c2ee[_0x34f0('0x30')];}_0x17b255['status'](_0x2cdb19)['send'](_0x15c2ee);};}exports['index']=function(_0x287723,_0x4ba482){var _0x29b954={},_0x1bec12={},_0xc27bc7={'count':0x0,'rows':[]};var _0x1825ff=db['Plugin'][_0x34f0('0x31')];_0x1bec12[_0x34f0('0x32')]=_[_0x34f0('0x33')](_0x1825ff);_0x1bec12[_0x34f0('0x34')]=_[_0x34f0('0x33')](_0x287723[_0x34f0('0x34')]);_0x1bec12[_0x34f0('0x35')]=_[_0x34f0('0x36')](_0x1bec12['model'],_0x1bec12['query']);_0x29b954[_0x34f0('0x37')]=_[_0x34f0('0x36')](_0x1bec12['model'],qs[_0x34f0('0x38')](_0x287723[_0x34f0('0x34')]['fields']));_0x29b954[_0x34f0('0x37')]=_0x29b954[_0x34f0('0x37')][_0x34f0('0x39')]?_0x29b954[_0x34f0('0x37')]:_0x1bec12['model'];if(!_0x287723[_0x34f0('0x34')][_0x34f0('0x3a')](_0x34f0('0x3b'))){_0x29b954[_0x34f0('0x24')]=qs['limit'](_0x287723['query'][_0x34f0('0x24')]);_0x29b954[_0x34f0('0x23')]=qs['offset'](_0x287723[_0x34f0('0x34')][_0x34f0('0x23')]);}_0x29b954[_0x34f0('0x3c')]=qs[_0x34f0('0x3d')](_0x287723['query']['sort']);_0x29b954[_0x34f0('0x3e')]=qs[_0x34f0('0x35')](_['pick'](_0x287723[_0x34f0('0x34')],_0x1bec12[_0x34f0('0x35')]));if(_0x287723[_0x34f0('0x34')]['filter']){_0x29b954[_0x34f0('0x3e')]=_[_0x34f0('0x3f')](_0x29b954[_0x34f0('0x3e')],{'$or':_[_0x34f0('0x40')](_0x1825ff,function(_0x318f12){if(_0x318f12[_0x34f0('0x41')]['key']!=='VIRTUAL'){var _0x3b51f1={};_0x3b51f1[_0x318f12[_0x34f0('0x42')]]={'$like':'%'+_0x287723['query'][_0x34f0('0x43')]+'%'};return _0x3b51f1;}})});}_0x29b954=_[_0x34f0('0x3f')]({},_0x29b954,_0x287723[_0x34f0('0x44')]);var _0xa621f0={'where':_0x29b954[_0x34f0('0x3e')]};return db[_0x34f0('0x45')][_0x34f0('0x22')](_0xa621f0)['then'](function(_0x28df47){_0xc27bc7[_0x34f0('0x22')]=_0x28df47;if(_0x287723[_0x34f0('0x34')][_0x34f0('0x46')]){_0x29b954[_0x34f0('0x47')]=[{'all':!![]}];}return db[_0x34f0('0x45')][_0x34f0('0x48')](_0x29b954);})[_0x34f0('0x29')](function(_0x30d758){_0xc27bc7[_0x34f0('0x49')]=_0x30d758;return _0xc27bc7;})[_0x34f0('0x29')](respondWithFilteredResult(_0x4ba482,_0x29b954))[_0x34f0('0x4a')](handleError(_0x4ba482,null));};exports[_0x34f0('0x4b')]=function(_0x58d459,_0x2139b0){var _0x1369d3={'raw':!![],'where':{'id':_0x58d459[_0x34f0('0x4c')]['id']}},_0x8c996c={};_0x8c996c['model']=_[_0x34f0('0x33')](db[_0x34f0('0x45')][_0x34f0('0x31')]);_0x8c996c[_0x34f0('0x34')]=_['keys'](_0x58d459[_0x34f0('0x34')]);_0x8c996c[_0x34f0('0x35')]=_['intersection'](_0x8c996c['model'],_0x8c996c['query']);_0x1369d3[_0x34f0('0x37')]=_[_0x34f0('0x36')](_0x8c996c['model'],qs[_0x34f0('0x38')](_0x58d459[_0x34f0('0x34')][_0x34f0('0x38')]));_0x1369d3['attributes']=_0x1369d3[_0x34f0('0x37')][_0x34f0('0x39')]?_0x1369d3[_0x34f0('0x37')]:_0x8c996c[_0x34f0('0x32')];if(_0x58d459[_0x34f0('0x34')][_0x34f0('0x46')]){_0x1369d3['include']=[{'all':!![]}];}_0x1369d3=_[_0x34f0('0x3f')]({},_0x1369d3,_0x58d459['options']);return db['Plugin'][_0x34f0('0x4d')](_0x1369d3)[_0x34f0('0x29')](handleEntityNotFound(_0x2139b0,null))[_0x34f0('0x29')](respondWithResult(_0x2139b0,null))['catch'](handleError(_0x2139b0,null));};exports[_0x34f0('0x4e')]=function(_0x5a8e20,_0x284e3a,_0x4aedba){return db[_0x34f0('0x45')][_0x34f0('0x4d')]({'where':{'id':_0x5a8e20[_0x34f0('0x4c')]['id']},'attributes':[_0x34f0('0x30'),_0x34f0('0x8')],'raw':!![]})[_0x34f0('0x29')](handleEntityNotFound(_0x284e3a,null))[_0x34f0('0x29')](function(_0x1effb6){if(_0x1effb6){var _0x1c1960=path['join'](config[_0x34f0('0x4f')],'server/files/plugins',util[_0x34f0('0x50')](_0x34f0('0x51'),path[_0x34f0('0x52')](_0x1effb6[_0x34f0('0x8')])));var _0x3ea572=fs[_0x34f0('0x53')](_0x1c1960);var _0x562ddb=archiver('zip',{'zlib':{'level':0x9}});_0x562ddb['on'](_0x34f0('0x54'),function(_0x5682cd){if(_0x5682cd['code']===_0x34f0('0x55')){logger[_0x34f0('0x2f')](_0x5682cd);}else{throw new db['Sequelize'][(_0x34f0('0x56'))](_0x34f0('0x57'));}});_0x562ddb['on'](_0x34f0('0x2f'),function(_0x337228){throw new db[(_0x34f0('0x58'))][(_0x34f0('0x56'))](_0x34f0('0x57'));});_0x562ddb[_0x34f0('0x59')](_0x3ea572);_0x562ddb[_0x34f0('0x5a')](_0x34f0('0x5b'),{'cwd':path['join'](config['root'],_0x34f0('0x5c'),path[_0x34f0('0x5d')](_0x1effb6['path'])),'ignore':[path['join'](path[_0x34f0('0x52')](_0x1effb6[_0x34f0('0x8')]),_0x34f0('0x5e')),path[_0x34f0('0x5f')](path[_0x34f0('0x52')](_0x1effb6['path']),'attachments/**/*')],'nodir':!![]})[_0x34f0('0x60')]();_0x3ea572['on']('close',function(){if(!fs[_0x34f0('0x61')](_0x1c1960)){throw new db[(_0x34f0('0x58'))][(_0x34f0('0x56'))](_0x34f0('0x62'));}return _0x284e3a[_0x34f0('0x4e')](_0x1c1960,util[_0x34f0('0x50')](_0x34f0('0x51'),path['basename'](_0x1effb6[_0x34f0('0x8')])),function(_0x5ef868){if(_0x5ef868){throw new db[(_0x34f0('0x58'))][(_0x34f0('0x56'))](_0x34f0('0x63'));}fs['unlinkSync'](_0x1c1960);logger[_0x34f0('0x64')]('Download\x20completed');logger[_0x34f0('0x64')]('Temporary\x20file\x20removed');});});}return null;})[_0x34f0('0x4a')](handleError(_0x284e3a,null));};exports['upload']=function(_0x12851c,_0x88a54b,_0x1a78f6){var _0x33d64c=path['basename'](_0x12851c[_0x34f0('0x65')][_0x34f0('0x66')],path[_0x34f0('0x67')](_0x12851c[_0x34f0('0x65')][_0x34f0('0x66')]));var _0x45a428=path['join'](config[_0x34f0('0x4f')],_0x34f0('0x5c'),_0x12851c[_0x34f0('0x65')][_0x34f0('0x66')]);var _0x865e4a=path[_0x34f0('0x5f')](config[_0x34f0('0x4f')],_0x34f0('0x5c'),_0x33d64c);logger['info'](_0x34f0('0x68'),_0x45a428);logger['info'](_0x34f0('0x69'),_0x865e4a);try{fs[_0x34f0('0x6a')](_0x45a428,parseInt(_0x34f0('0x6b'),0x8));extract(_0x45a428,{'dir':_0x865e4a},function(_0x80fe32){if(_0x80fe32){logger[_0x34f0('0x2f')](_0x80fe32);handleError(_0x80fe32,!![]);};var _0x21fde0=fs[_0x34f0('0x6c')](_0x865e4a);if(_0x21fde0['length']>0x1){removeReferences(_0x45a428,_0x865e4a);logger[_0x34f0('0x2f')](_0x34f0('0x6d'));return _0x1a78f6(new Error(_0x34f0('0x6d')));}var _0x24e651=fs[_0x34f0('0x6e')](path[_0x34f0('0x5f')](_0x865e4a,_0x21fde0[0x0]));if(_0x24e651[_0x34f0('0x6f')]()){removeReferences(_0x45a428,_0x865e4a);logger[_0x34f0('0x2f')](_0x34f0('0x6d'));return _0x1a78f6(new Error(_0x34f0('0x6d')));}if(_0x24e651['isDirectory']()){var _0x581b27=fs[_0x34f0('0x6c')](path[_0x34f0('0x5f')](_0x865e4a,_0x21fde0[0x0]));if(_0x581b27[_0x34f0('0x39')]===0x0){removeReferences(_0x45a428,_0x865e4a);logger[_0x34f0('0x2f')](_0x34f0('0x6d'));return _0x1a78f6(new Error(_0x34f0('0x6d')));}var _0x70b92=_0x581b27[_0x34f0('0x70')](function(_0x426555){return _0x426555===_0x34f0('0x71');});if(!_0x70b92){return _0x1a78f6(new Error('Plugin\x20manifest\x20missing'));}var _0x27a659=fs[_0x34f0('0x72')](path[_0x34f0('0x5f')](_0x865e4a,_0x21fde0[0x0],'manifest.json'));var _0x2d551e=JSON[_0x34f0('0x73')](_0x27a659);if(_0x34f0('0x74')==typeof _0x2d551e[_0x34f0('0x30')]){return _0x1a78f6(new Error(_0x34f0('0x75')));}if(_0x34f0('0x74')==typeof _0x2d551e[_0x34f0('0x41')]){return _0x1a78f6(new Error(_0x34f0('0x76')));}if('undefined'==typeof _0x2d551e[_0x34f0('0x77')]){return _0x1a78f6(new Error(_0x34f0('0x78')));}if(_0x34f0('0x74')==typeof _0x2d551e['parameters']){return _0x1a78f6(new Error(_0x34f0('0x79')));}if(_0x2d551e[_0x34f0('0x41')]===_0x34f0('0x7a')){if(_0x34f0('0x74')==typeof _0x2d551e['parameters'][_0x34f0('0x7b')]){return _0x1a78f6(new Error(_0x34f0('0x7c')));}if('undefined'==typeof _0x2d551e[_0x34f0('0x7d')][_0x34f0('0x7b')]['admin']&&_0x34f0('0x74')==typeof _0x2d551e[_0x34f0('0x7d')][_0x34f0('0x7b')]['agent']){return _0x1a78f6(new Error(_0x34f0('0x7e')));}}else if(_0x2d551e[_0x34f0('0x41')]===_0x34f0('0x7f')){if('undefined'==typeof _0x2d551e[_0x34f0('0x7d')]['scriptName']){return _0x1a78f6(new Error(_0x34f0('0x80')));}if('undefined'==typeof _0x2d551e[_0x34f0('0x7d')]['scriptPath']){return _0x1a78f6(new Error(_0x34f0('0x81')));}}else{return _0x1a78f6(new Error(_0x34f0('0x82')));}var _0xf6c708=_0x2d551e[_0x34f0('0x30')];var _0x46bddd=_0x2d551e[_0x34f0('0x83')];var _0x15047f=_0x2d551e[_0x34f0('0x41')];var _0x1a925d=_0x2d551e[_0x34f0('0x84')]?_0x2d551e['sidebar']:_0x34f0('0x85');var _0x295f96=_0x2d551e['icon']?_0x2d551e[_0x34f0('0x86')]:_0x34f0('0x87');var _0x1c36b2='';var _0x811dc3='';var _0x1f4e32='';var _0x557d08='';var _0x3dfbac=_0x2d551e[_0x34f0('0x77')];if(_0x15047f==='html'){if(_0x34f0('0x74')!=typeof _0x2d551e[_0x34f0('0x7d')][_0x34f0('0x7b')][_0x34f0('0x88')]){var _0x542e67=_0x2d551e[_0x34f0('0x7d')][_0x34f0('0x7b')][_0x34f0('0x88')];if(!/^(f|ht)tps?:\/\//i[_0x34f0('0x89')](_0x542e67)){_0x1c36b2=path[_0x34f0('0x5f')](_0x34f0('0x8a'),_0x33d64c,_0x21fde0[0x0],_0x542e67);}else{_0x1c36b2=_0x542e67;}}else{logger['info'](_0x34f0('0x8b'));}if('undefined'!=typeof _0x2d551e[_0x34f0('0x7d')]['views']['agent']){var _0x503a97=_0x2d551e['parameters'][_0x34f0('0x7b')][_0x34f0('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0x34f0('0x89')](_0x503a97)){_0x811dc3=path[_0x34f0('0x5f')](_0x34f0('0x8a'),_0x33d64c,_0x21fde0[0x0],_0x503a97);}else{_0x811dc3=_0x503a97;}}else{logger[_0x34f0('0x64')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x15047f===_0x34f0('0x7f')){_0x1f4e32=_0x2d551e['parameters']['scriptName'];_0x557d08=_0x2d551e[_0x34f0('0x7d')][_0x34f0('0x8d')];if(_0x34f0('0x74')!=typeof _0x2d551e[_0x34f0('0x7d')]['views']){if(_0x34f0('0x74')!=typeof _0x2d551e[_0x34f0('0x7d')][_0x34f0('0x7b')][_0x34f0('0x88')]){var _0x542e67=_0x2d551e[_0x34f0('0x7d')][_0x34f0('0x7b')][_0x34f0('0x88')];if(!/^(f|ht)tps?:\/\//i[_0x34f0('0x89')](_0x542e67)){_0x1c36b2=path[_0x34f0('0x5f')](_0x34f0('0x8a'),_0x33d64c,_0x21fde0[0x0],_0x542e67);}else{_0x1c36b2=_0x542e67;}}if(_0x34f0('0x74')!=typeof _0x2d551e[_0x34f0('0x7d')][_0x34f0('0x7b')][_0x34f0('0x8c')]){var _0x503a97=_0x2d551e[_0x34f0('0x7d')]['views'][_0x34f0('0x8c')];if(!/^(f|ht)tps?:\/\//i['test'](_0x503a97)){_0x811dc3=path[_0x34f0('0x5f')](_0x34f0('0x8a'),_0x33d64c,_0x21fde0[0x0],_0x503a97);}else{_0x811dc3=_0x503a97;}}}}var _0x1c18e7={'name':_0xf6c708,'description':_0x46bddd,'path':path[_0x34f0('0x5f')](_0x33d64c,_0x21fde0[0x0]),'type':_0x15047f,'sidebar':_0x1a925d,'icon':_0x295f96,'adminUrl':_0x1c36b2,'agentUrl':_0x811dc3,'scriptName':_0x1f4e32,'scriptPath':_0x557d08,'version':_0x3dfbac};removeReferences(_0x45a428,null);return db[_0x34f0('0x45')][_0x34f0('0x8e')](_0x1c18e7)[_0x34f0('0x29')](function(_0x6d15f4){var _0x5e2869={'role':_0x12851c[_0x34f0('0x8f')][_0x34f0('0x90')],'userProfileId':_0x12851c['body']['userProfileId']};if(!_0x5e2869)throw new Error(_0x34f0('0x91'));if(_0x5e2869[_0x34f0('0x90')]==='user'){var _0x390b01=_0x6d15f4[_0x34f0('0x2b')]({'plain':!![]});return db[_0x34f0('0x92')][_0x34f0('0x4d')]({'where':{'name':_0x34f0('0x2c'),'userProfileId':_0x5e2869[_0x34f0('0x93')]},'raw':!![]})['then'](function(_0x154926){if(_0x154926&&_0x154926[_0x34f0('0x94')]===0x0){return db[_0x34f0('0x2d')][_0x34f0('0x8e')]({'name':_0x390b01[_0x34f0('0x30')],'resourceId':_0x390b01['id'],'type':_0x154926[_0x34f0('0x30')],'sectionId':_0x154926['id']},{})[_0x34f0('0x29')](function(){return _0x6d15f4;});}else{return _0x6d15f4;}})[_0x34f0('0x4a')](function(_0x54f965){logger['error'](_0x34f0('0x95'),_0x54f965);throw _0x54f965;});}return _0x6d15f4;})[_0x34f0('0x29')](respondWithResult(_0x88a54b,null))[_0x34f0('0x4a')](handleError(_0x88a54b,null));}});}catch(_0x56fc83){_0x88a54b['status'](0x1f4)[_0x34f0('0x96')](_0x56fc83);}};function removeReferences(_0x56ebeb,_0xf37057){try{if(_0x56ebeb){fs['unlinkSync'](_0x56ebeb);logger[_0x34f0('0x64')](_0x34f0('0x97'));}if(_0xf37057){rimraf(_0xf37057,function(){});logger[_0x34f0('0x64')](_0x34f0('0x98'));}}catch(_0x37cb85){logger[_0x34f0('0x2f')](_0x37cb85);}}exports[_0x34f0('0x28')]=function(_0xee08f6,_0x4acd4e,_0x103223){return db[_0x34f0('0x45')]['find']({'where':{'id':_0xee08f6[_0x34f0('0x4c')]['id']}})[_0x34f0('0x29')](handleEntityNotFound(_0x4acd4e,null))[_0x34f0('0x29')](saveUpdates(_0xee08f6[_0x34f0('0x8f')],null))[_0x34f0('0x29')](respondWithResult(_0x4acd4e,null))[_0x34f0('0x4a')](handleError(_0x4acd4e,null));};exports['delete']=function(_0x3d9b8e,_0x13182c,_0x45979e){return db['Plugin']['find']({'where':{'id':_0x3d9b8e[_0x34f0('0x4c')]['id']}})[_0x34f0('0x29')](function(_0x37ac9f){if(_0x37ac9f){return _0x37ac9f[_0x34f0('0x2a')]();}})[_0x34f0('0x29')](function(_0x483818){rimraf(path[_0x34f0('0x5f')](config[_0x34f0('0x4f')],_0x34f0('0x5c'),path[_0x34f0('0x5d')](_0x483818['path'])),function(){});return _0x483818;})[_0x34f0('0x29')](handleEntityNotFound(_0x13182c,null))[_0x34f0('0x29')](respondWithStatusCode(_0x13182c,null))[_0x34f0('0x4a')](handleError(_0x13182c,null));};exports['webhookGet']=function(_0x2b569c,_0x282e4c,_0x3c51a9){return BPromise[_0x34f0('0x99')]()[_0x34f0('0x29')](function(){if(!_0x2b569c[_0x34f0('0x34')][_0x34f0('0x8')]){throw new Error(_0x34f0('0x9a'));}if(!_0x2b569c[_0x34f0('0x34')][_0x34f0('0x9b')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x27ec55=_0x2b569c[_0x34f0('0x34')][_0x34f0('0x9c')]?_0x2b569c[_0x34f0('0x34')]['hostname']+':'+_0x2b569c[_0x34f0('0x34')][_0x34f0('0x9b')]:'http://localhost:'+_0x2b569c[_0x34f0('0x34')][_0x34f0('0x9b')];var _0x55a453=_0x2b569c[_0x34f0('0x34')][_0x34f0('0x21')]?_0x2b569c[_0x34f0('0x34')][_0x34f0('0x21')]:!![];var _0x3950ed=_0x2b569c[_0x34f0('0x34')]['encoding']?_0x2b569c[_0x34f0('0x34')]['encoding']:null;var _0x4be45b={'method':_0x2b569c[_0x34f0('0x9d')],'uri':util[_0x34f0('0x50')](_0x34f0('0x9e'),_0x27ec55,_0x2b569c[_0x34f0('0x34')][_0x34f0('0x8')]),'json':_0x55a453,'resolveWithFullResponse':!![],'encoding':_0x3950ed,'qs':_0x2b569c[_0x34f0('0x34')]};if(_0x2b569c[_0x34f0('0x9f')]){_0x4be45b[_0x34f0('0x9f')]=_0x2b569c[_0x34f0('0x9f')];if(_0x4be45b[_0x34f0('0x9f')][_0x34f0('0xa0')]){delete _0x4be45b[_0x34f0('0x9f')][_0x34f0('0xa0')];}}return rp(_0x4be45b);})[_0x34f0('0x29')](function(_0x5daaaf){if(_0x5daaaf){_0x282e4c[_0x34f0('0x25')](_0x5daaaf['headers']);logger[_0x34f0('0x64')](_0x5daaaf[_0x34f0('0x8f')]);if(_[_0x34f0('0xa1')](_0x2b569c['query'][_0x34f0('0x8')],_0x34f0('0x4e'))&&_0x5daaaf[_0x34f0('0xa2')]==0x1f4){return _0x282e4c[_0x34f0('0x1f')](_0x5daaaf[_0x34f0('0xa2')]);}else{return _0x282e4c['status'](_0x5daaaf[_0x34f0('0xa2')])[_0x34f0('0x96')](_0x5daaaf['body']);}}else{return _0x282e4c[_0x34f0('0x1f')](0xc8);}})['catch'](handleError(_0x282e4c,null));};exports['webhookPost']=function(_0x548bd2,_0x923ee,_0x283ec3){return BPromise[_0x34f0('0x99')]()[_0x34f0('0x29')](function(){if(!_0x548bd2[_0x34f0('0x34')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x548bd2['query'][_0x34f0('0x9b')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x303020=_0x548bd2[_0x34f0('0x34')][_0x34f0('0x9c')]?_0x548bd2[_0x34f0('0x34')][_0x34f0('0x9c')]+':'+_0x548bd2[_0x34f0('0x34')][_0x34f0('0x9b')]:'http://localhost:'+_0x548bd2[_0x34f0('0x34')][_0x34f0('0x9b')];var _0x4b4ef5=_0x548bd2[_0x34f0('0x34')][_0x34f0('0x21')]?_0x548bd2[_0x34f0('0x34')][_0x34f0('0x21')]:!![];var _0x413003=_0x548bd2['query']['encoding']?_0x548bd2['query']['encoding']:null;var _0x3452b3={'method':_0x548bd2[_0x34f0('0x9d')],'uri':util[_0x34f0('0x50')](_0x34f0('0x9e'),_0x303020,_0x548bd2['query'][_0x34f0('0x8')]),'json':_0x4b4ef5,'resolveWithFullResponse':!![],'encoding':_0x413003,'body':_0x548bd2[_0x34f0('0x8f')]};if(_0x548bd2[_0x34f0('0x9f')]){_0x3452b3['headers']=_0x548bd2[_0x34f0('0x9f')];if(_0x3452b3[_0x34f0('0x9f')]['content-length']){delete _0x3452b3[_0x34f0('0x9f')][_0x34f0('0xa0')];}}return rp(_0x3452b3);})[_0x34f0('0x29')](function(_0x250b8a){if(_0x250b8a){_0x923ee[_0x34f0('0x25')](_0x250b8a[_0x34f0('0x9f')]);logger[_0x34f0('0x64')](_0x250b8a['body']);return _0x923ee['status'](_0x250b8a[_0x34f0('0xa2')])[_0x34f0('0x96')](_0x250b8a[_0x34f0('0x8f')]);}else{return _0x923ee[_0x34f0('0x1f')](0xc8);}})[_0x34f0('0x4a')](handleError(_0x923ee,null));};
\ No newline at end of file
+var _0xf82c=['key','field','options','includeAll','include','findAll','rows','catch','params','Plugin','find','download','format','basename','createWriteStream','zip','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','join','root','server/files/plugins','dirname','close','existsSync','Plugin\x20not\x20found','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','upload','extname','filename','file','Plugin\x20upload\x20filepath:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','type','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','icon','test','Warning:\x20admin\x20view\x20not\x20specified','agent','plugins','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','encoding','method','%s%s','headers','content-length','statusCode','webhookPost','http://localhost:','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','../../config/license/hardware','ioredis','extract-zip','rimraf','archiver','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','get','Plugins','UserProfileResource','destroy','error','name','send','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf82c,0x1af));var _0xcf82=function(_0x42923e,_0x217eeb){_0x42923e=_0x42923e-0x0;var _0x429e81=_0xf82c[_0x42923e];return _0x429e81;};'use strict';var pdf=require(_0xcf82('0x0'));var emlformat=require(_0xcf82('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xcf82('0x2'));var jsonpatch=require(_0xcf82('0x3'));var rp=require(_0xcf82('0x4'));var moment=require(_0xcf82('0x5'));var BPromise=require(_0xcf82('0x6'));var Mustache=require(_0xcf82('0x7'));var util=require('util');var path=require(_0xcf82('0x8'));var sox=require(_0xcf82('0x9'));var csv=require(_0xcf82('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcf82('0xb'));var squel=require(_0xcf82('0xc'));var crypto=require(_0xcf82('0xd'));var jsforce=require(_0xcf82('0xe'));var deskjs=require(_0xcf82('0xf'));var toCsv=require(_0xcf82('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0xcf82('0x10'));var Redis=require(_0xcf82('0x11'));var extract=require(_0xcf82('0x12'));var rimraf=require(_0xcf82('0x13'));var archiver=require(_0xcf82('0x14'));var qs=require(_0xcf82('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xcf82('0x16'));var db=require(_0xcf82('0x17'))['db'];config[_0xcf82('0x18')]=_['defaults'](config[_0xcf82('0x18')],{'host':_0xcf82('0x19'),'port':0x18eb});var socket=require(_0xcf82('0x1a'))(new Redis(config[_0xcf82('0x18')]));require(_0xcf82('0x1b'))[_0xcf82('0x1c')](socket);function respondWithStatusCode(_0x143538,_0x30a5a4){_0x30a5a4=_0x30a5a4||0xcc;return function(_0x31e9ba){if(_0x31e9ba){return _0x143538[_0xcf82('0x1d')](_0x30a5a4);}return _0x143538[_0xcf82('0x1e')](_0x30a5a4)[_0xcf82('0x1f')]();};}function respondWithResult(_0x5a0684,_0xd25236){_0xd25236=_0xd25236||0xc8;return function(_0xa76207){if(_0xa76207){return _0x5a0684[_0xcf82('0x1e')](_0xd25236)[_0xcf82('0x20')](_0xa76207);}};}function respondWithFilteredResult(_0x25b95f,_0x1549e2){return function(_0xe23b09){if(_0xe23b09){var _0x4c8702=_0xe23b09[_0xcf82('0x21')],_0x2fc0b1=_0x1549e2[_0xcf82('0x22')],_0x24b583=_0x1549e2['offset']+_0x1549e2[_0xcf82('0x23')],_0x749555;if(_0x24b583>=_0x4c8702){_0x24b583=_0x4c8702;_0x749555=0xc8;}else{_0x749555=0xce;}_0x25b95f['status'](_0x749555);return _0x25b95f[_0xcf82('0x24')]('Content-Range',_0x2fc0b1+'-'+_0x24b583+'/'+_0x4c8702)[_0xcf82('0x20')](_0xe23b09);}return null;};}function patchUpdates(_0x5ef599){return function(_0x59d355){try{jsonpatch['apply'](_0x59d355,_0x5ef599,!![]);}catch(_0x255335){return BPromise[_0xcf82('0x25')](_0x255335);}return _0x59d355[_0xcf82('0x26')]();};}function saveUpdates(_0x39c780,_0x450baa){return function(_0x4b2367){if(_0x4b2367){return _0x4b2367[_0xcf82('0x27')](_0x39c780)[_0xcf82('0x28')](function(_0x49f121){return _0x49f121;});}return null;};}function removeEntity(_0x571c97,_0x4e2bbd){return function(_0x211cf9){if(_0x211cf9){return _0x211cf9['destroy']()[_0xcf82('0x28')](function(){var _0x4b70dc=_0x211cf9[_0xcf82('0x29')]({'plain':!![]});var _0x4b62d7=_0xcf82('0x2a');return db[_0xcf82('0x2b')][_0xcf82('0x2c')]({'where':{'type':_0x4b62d7,'resourceId':_0x4b70dc['id']}})[_0xcf82('0x28')](function(){return _0x211cf9;});})[_0xcf82('0x28')](function(){_0x571c97[_0xcf82('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7024b3,_0x41938a){return function(_0x56791d){if(!_0x56791d){_0x7024b3[_0xcf82('0x1d')](0x194);}return _0x56791d;};}function handleError(_0x591f3e,_0x1fee4d){_0x1fee4d=_0x1fee4d||0x1f4;return function(_0x42e5ae){logger[_0xcf82('0x2d')](_0x42e5ae['stack']);if(_0x42e5ae[_0xcf82('0x2e')]){delete _0x42e5ae[_0xcf82('0x2e')];}_0x591f3e[_0xcf82('0x1e')](_0x1fee4d)[_0xcf82('0x2f')](_0x42e5ae);};}exports['index']=function(_0xc7dbf6,_0x182abe){var _0x1d7890={},_0x3f1b95={},_0x5735cf={'count':0x0,'rows':[]};var _0x24b851=db['Plugin'][_0xcf82('0x30')];_0x3f1b95[_0xcf82('0x31')]=_[_0xcf82('0x32')](_0x24b851);_0x3f1b95[_0xcf82('0x33')]=_['keys'](_0xc7dbf6[_0xcf82('0x33')]);_0x3f1b95[_0xcf82('0x34')]=_['intersection'](_0x3f1b95[_0xcf82('0x31')],_0x3f1b95[_0xcf82('0x33')]);_0x1d7890[_0xcf82('0x35')]=_[_0xcf82('0x36')](_0x3f1b95['model'],qs[_0xcf82('0x37')](_0xc7dbf6[_0xcf82('0x33')]['fields']));_0x1d7890[_0xcf82('0x35')]=_0x1d7890[_0xcf82('0x35')][_0xcf82('0x38')]?_0x1d7890[_0xcf82('0x35')]:_0x3f1b95[_0xcf82('0x31')];if(!_0xc7dbf6[_0xcf82('0x33')]['hasOwnProperty'](_0xcf82('0x39'))){_0x1d7890['limit']=qs[_0xcf82('0x23')](_0xc7dbf6['query']['limit']);_0x1d7890['offset']=qs[_0xcf82('0x22')](_0xc7dbf6['query'][_0xcf82('0x22')]);}_0x1d7890[_0xcf82('0x3a')]=qs[_0xcf82('0x3b')](_0xc7dbf6[_0xcf82('0x33')][_0xcf82('0x3b')]);_0x1d7890[_0xcf82('0x3c')]=qs['filters'](_['pick'](_0xc7dbf6[_0xcf82('0x33')],_0x3f1b95[_0xcf82('0x34')]));if(_0xc7dbf6[_0xcf82('0x33')][_0xcf82('0x3d')]){_0x1d7890[_0xcf82('0x3c')]=_[_0xcf82('0x3e')](_0x1d7890['where'],{'$or':_[_0xcf82('0x3f')](_0x24b851,function(_0x5477b9){if(_0x5477b9['type'][_0xcf82('0x40')]!=='VIRTUAL'){var _0x47c8a0={};_0x47c8a0[_0x5477b9[_0xcf82('0x41')]]={'$like':'%'+_0xc7dbf6[_0xcf82('0x33')][_0xcf82('0x3d')]+'%'};return _0x47c8a0;}})});}_0x1d7890=_[_0xcf82('0x3e')]({},_0x1d7890,_0xc7dbf6[_0xcf82('0x42')]);var _0x28b498={'where':_0x1d7890['where']};return db['Plugin'][_0xcf82('0x21')](_0x28b498)[_0xcf82('0x28')](function(_0x499035){_0x5735cf['count']=_0x499035;if(_0xc7dbf6[_0xcf82('0x33')][_0xcf82('0x43')]){_0x1d7890[_0xcf82('0x44')]=[{'all':!![]}];}return db['Plugin'][_0xcf82('0x45')](_0x1d7890);})[_0xcf82('0x28')](function(_0x5b70e5){_0x5735cf[_0xcf82('0x46')]=_0x5b70e5;return _0x5735cf;})[_0xcf82('0x28')](respondWithFilteredResult(_0x182abe,_0x1d7890))[_0xcf82('0x47')](handleError(_0x182abe,null));};exports['show']=function(_0x394328,_0x2bb154){var _0x19df0e={'raw':!![],'where':{'id':_0x394328[_0xcf82('0x48')]['id']}},_0x38d4f2={};_0x38d4f2[_0xcf82('0x31')]=_[_0xcf82('0x32')](db[_0xcf82('0x49')][_0xcf82('0x30')]);_0x38d4f2[_0xcf82('0x33')]=_[_0xcf82('0x32')](_0x394328[_0xcf82('0x33')]);_0x38d4f2[_0xcf82('0x34')]=_['intersection'](_0x38d4f2['model'],_0x38d4f2[_0xcf82('0x33')]);_0x19df0e[_0xcf82('0x35')]=_[_0xcf82('0x36')](_0x38d4f2[_0xcf82('0x31')],qs['fields'](_0x394328[_0xcf82('0x33')][_0xcf82('0x37')]));_0x19df0e[_0xcf82('0x35')]=_0x19df0e['attributes'][_0xcf82('0x38')]?_0x19df0e[_0xcf82('0x35')]:_0x38d4f2['model'];if(_0x394328['query'][_0xcf82('0x43')]){_0x19df0e[_0xcf82('0x44')]=[{'all':!![]}];}_0x19df0e=_[_0xcf82('0x3e')]({},_0x19df0e,_0x394328[_0xcf82('0x42')]);return db[_0xcf82('0x49')][_0xcf82('0x4a')](_0x19df0e)['then'](handleEntityNotFound(_0x2bb154,null))[_0xcf82('0x28')](respondWithResult(_0x2bb154,null))['catch'](handleError(_0x2bb154,null));};exports[_0xcf82('0x4b')]=function(_0x45f5cc,_0x559ec1,_0xdb58bc){return db[_0xcf82('0x49')]['find']({'where':{'id':_0x45f5cc[_0xcf82('0x48')]['id']},'attributes':[_0xcf82('0x2e'),_0xcf82('0x8')],'raw':!![]})[_0xcf82('0x28')](handleEntityNotFound(_0x559ec1,null))[_0xcf82('0x28')](function(_0x1d189b){if(_0x1d189b){var _0x3a055d=path['join'](config['root'],'server/files/plugins',util[_0xcf82('0x4c')]('%s.zip',path[_0xcf82('0x4d')](_0x1d189b[_0xcf82('0x8')])));var _0x1f616e=fs[_0xcf82('0x4e')](_0x3a055d);var _0x12f5f7=archiver(_0xcf82('0x4f'),{'zlib':{'level':0x9}});_0x12f5f7['on']('warning',function(_0x102287){if(_0x102287[_0xcf82('0x50')]==='ENOENT'){logger[_0xcf82('0x2d')](_0x102287);}else{throw new db[(_0xcf82('0x51'))][(_0xcf82('0x52'))](_0xcf82('0x53'));}});_0x12f5f7['on']('error',function(_0x533864){throw new db[(_0xcf82('0x51'))][(_0xcf82('0x52'))](_0xcf82('0x53'));});_0x12f5f7[_0xcf82('0x54')](_0x1f616e);_0x12f5f7[_0xcf82('0x55')](_0xcf82('0x56'),{'cwd':path[_0xcf82('0x57')](config[_0xcf82('0x58')],_0xcf82('0x59'),path[_0xcf82('0x5a')](_0x1d189b[_0xcf82('0x8')])),'ignore':[path['join'](path[_0xcf82('0x4d')](_0x1d189b[_0xcf82('0x8')]),'node_modules/**/*'),path[_0xcf82('0x57')](path[_0xcf82('0x4d')](_0x1d189b['path']),'attachments/**/*')],'nodir':!![]})['finalize']();_0x1f616e['on'](_0xcf82('0x5b'),function(){if(!fs[_0xcf82('0x5c')](_0x3a055d)){throw new db[(_0xcf82('0x51'))][(_0xcf82('0x52'))](_0xcf82('0x5d'));}return _0x559ec1[_0xcf82('0x4b')](_0x3a055d,util['format'](_0xcf82('0x5e'),path[_0xcf82('0x4d')](_0x1d189b[_0xcf82('0x8')])),function(_0x41e59e){if(_0x41e59e){throw new db[(_0xcf82('0x51'))][(_0xcf82('0x52'))](_0xcf82('0x5f'));}fs[_0xcf82('0x60')](_0x3a055d);logger[_0xcf82('0x61')](_0xcf82('0x62'));logger['info']('Temporary\x20file\x20removed');});});}return null;})['catch'](handleError(_0x559ec1,null));};exports[_0xcf82('0x63')]=function(_0x16e2f1,_0x4edf5d,_0x407a11){var _0x581891=path[_0xcf82('0x4d')](_0x16e2f1['file']['filename'],path[_0xcf82('0x64')](_0x16e2f1['file'][_0xcf82('0x65')]));var _0x40306d=path[_0xcf82('0x57')](config[_0xcf82('0x58')],_0xcf82('0x59'),_0x16e2f1[_0xcf82('0x66')][_0xcf82('0x65')]);var _0x256312=path['join'](config[_0xcf82('0x58')],_0xcf82('0x59'),_0x581891);logger[_0xcf82('0x61')](_0xcf82('0x67'),_0x40306d);logger[_0xcf82('0x61')]('Plugin\x20upload\x20destination:\x20%s',_0x256312);try{fs[_0xcf82('0x68')](_0x40306d,parseInt('0777',0x8));extract(_0x40306d,{'dir':_0x256312},function(_0x18065d){if(_0x18065d){logger[_0xcf82('0x2d')](_0x18065d);handleError(_0x18065d,!![]);};var _0x1fe936=fs[_0xcf82('0x69')](_0x256312);if(_0x1fe936['length']>0x1){removeReferences(_0x40306d,_0x256312);logger[_0xcf82('0x2d')]('Invalid\x20plugin\x20structure');return _0x407a11(new Error(_0xcf82('0x6a')));}var _0x46a378=fs[_0xcf82('0x6b')](path[_0xcf82('0x57')](_0x256312,_0x1fe936[0x0]));if(_0x46a378[_0xcf82('0x6c')]()){removeReferences(_0x40306d,_0x256312);logger[_0xcf82('0x2d')](_0xcf82('0x6a'));return _0x407a11(new Error(_0xcf82('0x6a')));}if(_0x46a378[_0xcf82('0x6d')]()){var _0x1ae8f1=fs[_0xcf82('0x69')](path[_0xcf82('0x57')](_0x256312,_0x1fe936[0x0]));if(_0x1ae8f1[_0xcf82('0x38')]===0x0){removeReferences(_0x40306d,_0x256312);logger['error'](_0xcf82('0x6a'));return _0x407a11(new Error('Invalid\x20plugin\x20structure'));}var _0x1b1795=_0x1ae8f1[_0xcf82('0x6e')](function(_0x59a1bb){return _0x59a1bb===_0xcf82('0x6f');});if(!_0x1b1795){return _0x407a11(new Error(_0xcf82('0x70')));}var _0x3888c2=fs[_0xcf82('0x71')](path[_0xcf82('0x57')](_0x256312,_0x1fe936[0x0],_0xcf82('0x6f')));var _0x23dcbb=JSON[_0xcf82('0x72')](_0x3888c2);if(_0xcf82('0x73')==typeof _0x23dcbb[_0xcf82('0x2e')]){return _0x407a11(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x23dcbb[_0xcf82('0x74')]){return _0x407a11(new Error(_0xcf82('0x75')));}if('undefined'==typeof _0x23dcbb[_0xcf82('0x76')]){return _0x407a11(new Error(_0xcf82('0x77')));}if(_0xcf82('0x73')==typeof _0x23dcbb[_0xcf82('0x78')]){return _0x407a11(new Error(_0xcf82('0x79')));}if(_0x23dcbb[_0xcf82('0x74')]===_0xcf82('0x7a')){if('undefined'==typeof _0x23dcbb[_0xcf82('0x78')]['views']){return _0x407a11(new Error(_0xcf82('0x7b')));}if(_0xcf82('0x73')==typeof _0x23dcbb[_0xcf82('0x78')][_0xcf82('0x7c')][_0xcf82('0x7d')]&&_0xcf82('0x73')==typeof _0x23dcbb[_0xcf82('0x78')][_0xcf82('0x7c')]['agent']){return _0x407a11(new Error(_0xcf82('0x7e')));}}else if(_0x23dcbb[_0xcf82('0x74')]===_0xcf82('0x7f')){if(_0xcf82('0x73')==typeof _0x23dcbb['parameters'][_0xcf82('0x80')]){return _0x407a11(new Error(_0xcf82('0x81')));}if(_0xcf82('0x73')==typeof _0x23dcbb[_0xcf82('0x78')][_0xcf82('0x82')]){return _0x407a11(new Error(_0xcf82('0x83')));}}else{return _0x407a11(new Error(_0xcf82('0x84')));}var _0x2bb935=_0x23dcbb['name'];var _0x2a56a1=_0x23dcbb['description'];var _0x81b516=_0x23dcbb['type'];var _0x2b6217=_0x23dcbb[_0xcf82('0x85')]?_0x23dcbb[_0xcf82('0x85')]:'always';var _0x1cafc6=_0x23dcbb[_0xcf82('0x86')]?_0x23dcbb[_0xcf82('0x86')]:'icon-apps';var _0x2f74f6='';var _0xf4505='';var _0x2b7d48='';var _0x8ad71a='';var _0x3bc7cf=_0x23dcbb[_0xcf82('0x76')];if(_0x81b516===_0xcf82('0x7a')){if(_0xcf82('0x73')!=typeof _0x23dcbb['parameters'][_0xcf82('0x7c')][_0xcf82('0x7d')]){var _0x502ae0=_0x23dcbb['parameters']['views'][_0xcf82('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0xcf82('0x87')](_0x502ae0)){_0x2f74f6=path[_0xcf82('0x57')]('plugins',_0x581891,_0x1fe936[0x0],_0x502ae0);}else{_0x2f74f6=_0x502ae0;}}else{logger[_0xcf82('0x61')](_0xcf82('0x88'));}if('undefined'!=typeof _0x23dcbb[_0xcf82('0x78')][_0xcf82('0x7c')][_0xcf82('0x89')]){var _0x28574f=_0x23dcbb['parameters'][_0xcf82('0x7c')][_0xcf82('0x89')];if(!/^(f|ht)tps?:\/\//i[_0xcf82('0x87')](_0x28574f)){_0xf4505=path['join'](_0xcf82('0x8a'),_0x581891,_0x1fe936[0x0],_0x28574f);}else{_0xf4505=_0x28574f;}}else{logger[_0xcf82('0x61')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x81b516===_0xcf82('0x7f')){_0x2b7d48=_0x23dcbb[_0xcf82('0x78')][_0xcf82('0x80')];_0x8ad71a=_0x23dcbb['parameters'][_0xcf82('0x82')];if('undefined'!=typeof _0x23dcbb['parameters'][_0xcf82('0x7c')]){if('undefined'!=typeof _0x23dcbb[_0xcf82('0x78')][_0xcf82('0x7c')][_0xcf82('0x7d')]){var _0x502ae0=_0x23dcbb[_0xcf82('0x78')][_0xcf82('0x7c')][_0xcf82('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0xcf82('0x87')](_0x502ae0)){_0x2f74f6=path[_0xcf82('0x57')](_0xcf82('0x8a'),_0x581891,_0x1fe936[0x0],_0x502ae0);}else{_0x2f74f6=_0x502ae0;}}if(_0xcf82('0x73')!=typeof _0x23dcbb[_0xcf82('0x78')][_0xcf82('0x7c')][_0xcf82('0x89')]){var _0x28574f=_0x23dcbb[_0xcf82('0x78')][_0xcf82('0x7c')][_0xcf82('0x89')];if(!/^(f|ht)tps?:\/\//i['test'](_0x28574f)){_0xf4505=path['join']('plugins',_0x581891,_0x1fe936[0x0],_0x28574f);}else{_0xf4505=_0x28574f;}}}}var _0x25a0a0={'name':_0x2bb935,'description':_0x2a56a1,'path':path['join'](_0x581891,_0x1fe936[0x0]),'type':_0x81b516,'sidebar':_0x2b6217,'icon':_0x1cafc6,'adminUrl':_0x2f74f6,'agentUrl':_0xf4505,'scriptName':_0x2b7d48,'scriptPath':_0x8ad71a,'version':_0x3bc7cf};removeReferences(_0x40306d,null);return db['Plugin'][_0xcf82('0x8b')](_0x25a0a0)['then'](function(_0x49cbc8){var _0x3c8e43={'role':_0x16e2f1['body'][_0xcf82('0x8c')],'userProfileId':_0x16e2f1[_0xcf82('0x8d')][_0xcf82('0x8e')]};if(!_0x3c8e43)throw new Error(_0xcf82('0x8f'));if(_0x3c8e43['role']===_0xcf82('0x90')){var _0x4e7dc1=_0x49cbc8[_0xcf82('0x29')]({'plain':!![]});return db[_0xcf82('0x91')][_0xcf82('0x4a')]({'where':{'name':'Plugins','userProfileId':_0x3c8e43['userProfileId']},'raw':!![]})[_0xcf82('0x28')](function(_0x4ee5bd){if(_0x4ee5bd&&_0x4ee5bd[_0xcf82('0x92')]===0x0){return db[_0xcf82('0x2b')][_0xcf82('0x8b')]({'name':_0x4e7dc1[_0xcf82('0x2e')],'resourceId':_0x4e7dc1['id'],'type':_0x4ee5bd[_0xcf82('0x2e')],'sectionId':_0x4ee5bd['id']},{})[_0xcf82('0x28')](function(){return _0x49cbc8;});}else{return _0x49cbc8;}})[_0xcf82('0x47')](function(_0x4e2790){logger[_0xcf82('0x2d')](_0xcf82('0x93'),_0x4e2790);throw _0x4e2790;});}return _0x49cbc8;})['then'](respondWithResult(_0x4edf5d,null))['catch'](handleError(_0x4edf5d,null));}});}catch(_0x29f2fe){_0x4edf5d['status'](0x1f4)[_0xcf82('0x2f')](_0x29f2fe);}};function removeReferences(_0x348b41,_0x395e6c){try{if(_0x348b41){fs[_0xcf82('0x60')](_0x348b41);logger[_0xcf82('0x61')](_0xcf82('0x94'));}if(_0x395e6c){rimraf(_0x395e6c,function(){});logger[_0xcf82('0x61')](_0xcf82('0x95'));}}catch(_0x384710){logger[_0xcf82('0x2d')](_0x384710);}}exports[_0xcf82('0x27')]=function(_0x34a9b1,_0x3ba324,_0x4d55de){return db[_0xcf82('0x49')]['find']({'where':{'id':_0x34a9b1['params']['id']}})[_0xcf82('0x28')](handleEntityNotFound(_0x3ba324,null))[_0xcf82('0x28')](saveUpdates(_0x34a9b1[_0xcf82('0x8d')],null))[_0xcf82('0x28')](respondWithResult(_0x3ba324,null))[_0xcf82('0x47')](handleError(_0x3ba324,null));};exports[_0xcf82('0x96')]=function(_0x2013c5,_0x28f02a,_0x4ae34c){return db[_0xcf82('0x49')][_0xcf82('0x4a')]({'where':{'id':_0x2013c5[_0xcf82('0x48')]['id']}})['then'](function(_0x153d08){if(_0x153d08){return _0x153d08[_0xcf82('0x2c')]();}})['then'](function(_0x2b8dd3){rimraf(path['join'](config['root'],_0xcf82('0x59'),path[_0xcf82('0x5a')](_0x2b8dd3[_0xcf82('0x8')])),function(){});return _0x2b8dd3;})[_0xcf82('0x28')](handleEntityNotFound(_0x28f02a,null))[_0xcf82('0x28')](respondWithStatusCode(_0x28f02a,null))['catch'](handleError(_0x28f02a,null));};exports[_0xcf82('0x97')]=function(_0x4fdeaf,_0x33c8d6,_0x5882f9){return BPromise[_0xcf82('0x98')]()[_0xcf82('0x28')](function(){if(!_0x4fdeaf['query'][_0xcf82('0x8')]){throw new Error(_0xcf82('0x99'));}if(!_0x4fdeaf[_0xcf82('0x33')]['port']){throw new Error(_0xcf82('0x9a'));}var _0x5a9070=_0x4fdeaf[_0xcf82('0x33')][_0xcf82('0x9b')]?_0x4fdeaf['query']['hostname']+':'+_0x4fdeaf[_0xcf82('0x33')][_0xcf82('0x9c')]:'http://localhost:'+_0x4fdeaf[_0xcf82('0x33')][_0xcf82('0x9c')];var _0xe8a30c=_0x4fdeaf['query']['json']?_0x4fdeaf[_0xcf82('0x33')][_0xcf82('0x20')]:!![];var _0x258b6b=_0x4fdeaf[_0xcf82('0x33')][_0xcf82('0x9d')]?_0x4fdeaf[_0xcf82('0x33')][_0xcf82('0x9d')]:null;var _0x3a7903={'method':_0x4fdeaf[_0xcf82('0x9e')],'uri':util['format'](_0xcf82('0x9f'),_0x5a9070,_0x4fdeaf[_0xcf82('0x33')]['path']),'json':_0xe8a30c,'resolveWithFullResponse':!![],'encoding':_0x258b6b,'qs':_0x4fdeaf[_0xcf82('0x33')]};if(_0x4fdeaf['headers']){_0x3a7903[_0xcf82('0xa0')]=_0x4fdeaf[_0xcf82('0xa0')];if(_0x3a7903[_0xcf82('0xa0')][_0xcf82('0xa1')]){delete _0x3a7903[_0xcf82('0xa0')]['content-length'];}}return rp(_0x3a7903);})[_0xcf82('0x28')](function(_0x147e56){if(_0x147e56){_0x33c8d6['set'](_0x147e56[_0xcf82('0xa0')]);logger[_0xcf82('0x61')](_0x147e56[_0xcf82('0x8d')]);if(_['endsWith'](_0x4fdeaf[_0xcf82('0x33')][_0xcf82('0x8')],'download')&&_0x147e56[_0xcf82('0xa2')]==0x1f4){return _0x33c8d6[_0xcf82('0x1d')](_0x147e56[_0xcf82('0xa2')]);}else{return _0x33c8d6['status'](_0x147e56[_0xcf82('0xa2')])[_0xcf82('0x2f')](_0x147e56[_0xcf82('0x8d')]);}}else{return _0x33c8d6[_0xcf82('0x1d')](0xc8);}})['catch'](handleError(_0x33c8d6,null));};exports[_0xcf82('0xa3')]=function(_0xf121fb,_0x5c3202,_0x3187f0){return BPromise[_0xcf82('0x98')]()['then'](function(){if(!_0xf121fb[_0xcf82('0x33')][_0xcf82('0x8')]){throw new Error(_0xcf82('0x99'));}if(!_0xf121fb[_0xcf82('0x33')][_0xcf82('0x9c')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3bc835=_0xf121fb['query']['hostname']?_0xf121fb[_0xcf82('0x33')]['hostname']+':'+_0xf121fb[_0xcf82('0x33')]['port']:_0xcf82('0xa4')+_0xf121fb[_0xcf82('0x33')]['port'];var _0x26d46b=_0xf121fb[_0xcf82('0x33')]['json']?_0xf121fb[_0xcf82('0x33')][_0xcf82('0x20')]:!![];var _0x43876c=_0xf121fb[_0xcf82('0x33')][_0xcf82('0x9d')]?_0xf121fb[_0xcf82('0x33')]['encoding']:null;var _0x187d94={'method':_0xf121fb[_0xcf82('0x9e')],'uri':util['format'](_0xcf82('0x9f'),_0x3bc835,_0xf121fb[_0xcf82('0x33')][_0xcf82('0x8')]),'json':_0x26d46b,'resolveWithFullResponse':!![],'encoding':_0x43876c,'body':_0xf121fb[_0xcf82('0x8d')]};if(_0xf121fb['headers']){_0x187d94['headers']=_0xf121fb[_0xcf82('0xa0')];if(_0x187d94['headers']['content-length']){delete _0x187d94['headers'][_0xcf82('0xa1')];}}return rp(_0x187d94);})['then'](function(_0x2f4f37){if(_0x2f4f37){_0x5c3202[_0xcf82('0x24')](_0x2f4f37[_0xcf82('0xa0')]);logger['info'](_0x2f4f37[_0xcf82('0x8d')]);return _0x5c3202[_0xcf82('0x1e')](_0x2f4f37[_0xcf82('0xa2')])['send'](_0x2f4f37[_0xcf82('0x8d')]);}else{return _0x5c3202['sendStatus'](0xc8);}})[_0xcf82('0x47')](handleError(_0x5c3202,null));};
\ No newline at end of file
index 6a5126c..1a03d64 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['Plugin','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x467ee0,_0x1bead4){var _0x33e684=function(_0x14caf4){while(--_0x14caf4){_0x467ee0['push'](_0x467ee0['shift']());}};_0x33e684(++_0x1bead4);}(_0x7a54,0x106));var _0x47a5=function(_0x44f476,_0x158e43){_0x44f476=_0x44f476-0x0;var _0x156f62=_0x7a54[_0x44f476];return _0x156f62;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var Plugin=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47a5('0x3'),'afterUpdate':_0x47a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f7f12){return function(_0x11bf85,_0x2a1a7e,_0x3717e1){PluginEvents[_0x47a5('0x5')](_0x5f7f12+':'+_0x11bf85['id'],_0x11bf85);PluginEvents['emit'](_0x5f7f12,_0x11bf85);_0x3717e1(null);};}for(var e in events){if(events[_0x47a5('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x47a5('0x7')]=PluginEvents;
\ No newline at end of file
+var _0x7a54=['Plugin','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x5491f5,_0x192d88){var _0x1134e5=function(_0x4bf6f0){while(--_0x4bf6f0){_0x5491f5['push'](_0x5491f5['shift']());}};_0x1134e5(++_0x192d88);}(_0x7a54,0x106));var _0x47a5=function(_0x5ed064,_0x750e6c){_0x5ed064=_0x5ed064-0x0;var _0x4bb25f=_0x7a54[_0x5ed064];return _0x4bb25f;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var Plugin=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47a5('0x3'),'afterUpdate':_0x47a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f7f12){return function(_0x11bf85,_0x2a1a7e,_0x3717e1){PluginEvents[_0x47a5('0x5')](_0x5f7f12+':'+_0x11bf85['id'],_0x11bf85);PluginEvents['emit'](_0x5f7f12,_0x11bf85);_0x3717e1(null);};}for(var e in events){if(events[_0x47a5('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x47a5('0x7')]=PluginEvents;
\ No newline at end of file
index 99c75f9..19f50a9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7ee9=['plugins','lodash','util','moment','request-promise','./plugin.attributes','exports','Plugin'];(function(_0x509885,_0x51ccf0){var _0x33386a=function(_0x90ab0e){while(--_0x90ab0e){_0x509885['push'](_0x509885['shift']());}};_0x33386a(++_0x51ccf0);}(_0x7ee9,0xa9));var _0x97ee=function(_0x3198fd,_0x3729d8){_0x3198fd=_0x3198fd-0x0;var _0x2dd0b=_0x7ee9[_0x3198fd];return _0x2dd0b;};'use strict';var _=require(_0x97ee('0x0'));var util=require(_0x97ee('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x97ee('0x2'));var BPromise=require('bluebird');var rp=require(_0x97ee('0x3'));var attributes=require(_0x97ee('0x4'));module[_0x97ee('0x5')]=function(_0x1cc822,_0xfc5fd7){return _0x1cc822['define'](_0x97ee('0x6'),attributes,{'tableName':_0x97ee('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x96f5=['Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./plugin.attributes','exports'];(function(_0x5428eb,_0x340ca7){var _0x40dbac=function(_0x25385b){while(--_0x25385b){_0x5428eb['push'](_0x5428eb['shift']());}};_0x40dbac(++_0x340ca7);}(_0x96f5,0x65));var _0x596f=function(_0x50ca8f,_0x26f447){_0x50ca8f=_0x50ca8f-0x0;var _0x1ca9bf=_0x96f5[_0x50ca8f];return _0x1ca9bf;};'use strict';var _=require(_0x596f('0x0'));var util=require(_0x596f('0x1'));var logger=require(_0x596f('0x2'))(_0x596f('0x3'));var moment=require(_0x596f('0x4'));var BPromise=require(_0x596f('0x5'));var rp=require(_0x596f('0x6'));var attributes=require(_0x596f('0x7'));module[_0x596f('0x8')]=function(_0x3909a6,_0x59dfb3){return _0x3909a6['define'](_0x596f('0x9'),attributes,{'tableName':_0x596f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index b803b34..c2a80c2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x68fd=['Plugin,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','stringify','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','request','then','info'];(function(_0x235e7e,_0x5079e9){var _0x30410e=function(_0x437257){while(--_0x437257){_0x235e7e['push'](_0x235e7e['shift']());}};_0x30410e(++_0x5079e9);}(_0x68fd,0x1e9));var _0xd68f=function(_0x56acb9,_0x490076){_0x56acb9=_0x56acb9-0x0;var _0x1b27cc=_0x68fd[_0x56acb9];return _0x1b27cc;};'use strict';var _=require(_0xd68f('0x0'));var util=require('util');var moment=require(_0xd68f('0x1'));var BPromise=require(_0xd68f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd68f('0x3'));var db=require(_0xd68f('0x4'))['db'];var utils=require(_0xd68f('0x5'));var logger=require(_0xd68f('0x6'))(_0xd68f('0x7'));var config=require(_0xd68f('0x8'));var jayson=require(_0xd68f('0x9'));var client=jayson[_0xd68f('0xa')][_0xd68f('0xb')]({'port':0x232a});config['redis']=_[_0xd68f('0xc')](config[_0xd68f('0xd')],{'host':_0xd68f('0xe'),'port':0x18eb});var socket=require(_0xd68f('0xf'))(new Redis(config[_0xd68f('0xd')]));require(_0xd68f('0x10'))[_0xd68f('0x11')](socket);function respondWithRpcPromise(_0x4ff4ee,_0x52514d,_0x1c397a){return new BPromise(function(_0x59ac71,_0x114bda){return client[_0xd68f('0x12')](_0x4ff4ee,_0x1c397a)[_0xd68f('0x13')](function(_0x27001e){logger[_0xd68f('0x14')](_0xd68f('0x15'),_0x52514d,_0xd68f('0x16'));logger['debug']('Plugin,\x20%s,\x20%s,\x20%s',_0x52514d,'request\x20sent',JSON['stringify'](_0x27001e));if(_0x27001e[_0xd68f('0x17')]){if(_0x27001e[_0xd68f('0x17')]['code']===0x1f4){logger[_0xd68f('0x17')](_0xd68f('0x15'),_0x52514d,_0x27001e[_0xd68f('0x17')][_0xd68f('0x18')]);return _0x114bda(_0x27001e[_0xd68f('0x17')][_0xd68f('0x18')]);}logger[_0xd68f('0x17')]('Plugin,\x20%s,\x20%s',_0x52514d,_0x27001e[_0xd68f('0x17')]['message']);return _0x59ac71(_0x27001e['error'][_0xd68f('0x18')]);}else{logger[_0xd68f('0x14')](_0xd68f('0x15'),_0x52514d,_0xd68f('0x16'));_0x59ac71(_0x27001e[_0xd68f('0x19')][_0xd68f('0x18')]);}})[_0xd68f('0x1a')](function(_0x47fdbc){logger['error'](_0xd68f('0x15'),_0x52514d,_0x47fdbc);_0x114bda(_0x47fdbc);});});}exports[_0xd68f('0x1b')]=function(_0x3722da){var _0x459452=this;return new Promise(function(_0x24065d,_0x4c192f){return db[_0xd68f('0x1c')][_0xd68f('0x1d')](_0x3722da[_0xd68f('0x1e')],{'raw':_0x3722da['options']?_0x3722da[_0xd68f('0x1f')][_0xd68f('0x20')]===undefined?!![]:![]:!![]})[_0xd68f('0x13')](function(_0x590e04){logger['info'](_0xd68f('0x1b'),_0x3722da);logger['debug']('CreatePlugin',_0x3722da,JSON[_0xd68f('0x21')](_0x590e04));_0x24065d(_0x590e04);})[_0xd68f('0x1a')](function(_0xde6c97){logger[_0xd68f('0x17')](_0xd68f('0x1b'),_0xde6c97[_0xd68f('0x18')],_0x3722da);_0x4c192f(_0x459452[_0xd68f('0x17')](0x1f4,_0xde6c97[_0xd68f('0x18')]));});});};
\ No newline at end of file
+var _0xd1da=['body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','then','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','Plugin,\x20%s,\x20%s','message','info','result','catch','CreatePlugin','create'];(function(_0x1cd577,_0x180f2a){var _0x790837=function(_0x2cace5){while(--_0x2cace5){_0x1cd577['push'](_0x1cd577['shift']());}};_0x790837(++_0x180f2a);}(_0xd1da,0x143));var _0xad1d=function(_0x3aaf97,_0x4fa2e8){_0x3aaf97=_0x3aaf97-0x0;var _0xeba75e=_0xd1da[_0x3aaf97];return _0xeba75e;};'use strict';var _=require(_0xad1d('0x0'));var util=require(_0xad1d('0x1'));var moment=require(_0xad1d('0x2'));var BPromise=require(_0xad1d('0x3'));var rs=require(_0xad1d('0x4'));var fs=require('fs');var Redis=require(_0xad1d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xad1d('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xad1d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xad1d('0x8')][_0xad1d('0x9')]({'port':0x232a});config[_0xad1d('0xa')]=_[_0xad1d('0xb')](config['redis'],{'host':_0xad1d('0xc'),'port':0x18eb});var socket=require(_0xad1d('0xd'))(new Redis(config[_0xad1d('0xa')]));require(_0xad1d('0xe'))[_0xad1d('0xf')](socket);function respondWithRpcPromise(_0x3cf1b1,_0x317534,_0x17dba2){return new BPromise(function(_0xdc4a2,_0x284508){return client['request'](_0x3cf1b1,_0x17dba2)[_0xad1d('0x10')](function(_0x25069c){logger['info']('Plugin,\x20%s,\x20%s',_0x317534,_0xad1d('0x11'));logger[_0xad1d('0x12')](_0xad1d('0x13'),_0x317534,'request\x20sent',JSON['stringify'](_0x25069c));if(_0x25069c[_0xad1d('0x14')]){if(_0x25069c[_0xad1d('0x14')][_0xad1d('0x15')]===0x1f4){logger[_0xad1d('0x14')](_0xad1d('0x16'),_0x317534,_0x25069c[_0xad1d('0x14')]['message']);return _0x284508(_0x25069c[_0xad1d('0x14')][_0xad1d('0x17')]);}logger[_0xad1d('0x14')](_0xad1d('0x16'),_0x317534,_0x25069c[_0xad1d('0x14')]['message']);return _0xdc4a2(_0x25069c[_0xad1d('0x14')][_0xad1d('0x17')]);}else{logger[_0xad1d('0x18')](_0xad1d('0x16'),_0x317534,_0xad1d('0x11'));_0xdc4a2(_0x25069c[_0xad1d('0x19')][_0xad1d('0x17')]);}})[_0xad1d('0x1a')](function(_0x38b1fa){logger[_0xad1d('0x14')](_0xad1d('0x16'),_0x317534,_0x38b1fa);_0x284508(_0x38b1fa);});});}exports[_0xad1d('0x1b')]=function(_0x121381){var _0xd0e559=this;return new Promise(function(_0x1d9868,_0x50e62e){return db['Plugin'][_0xad1d('0x1c')](_0x121381[_0xad1d('0x1d')],{'raw':_0x121381[_0xad1d('0x1e')]?_0x121381[_0xad1d('0x1e')][_0xad1d('0x1f')]===undefined?!![]:![]:!![]})[_0xad1d('0x10')](function(_0x13bb97){logger[_0xad1d('0x18')](_0xad1d('0x1b'),_0x121381);logger['debug'](_0xad1d('0x1b'),_0x121381,JSON['stringify'](_0x13bb97));_0x1d9868(_0x13bb97);})['catch'](function(_0x451388){logger[_0xad1d('0x14')]('CreatePlugin',_0x451388[_0xad1d('0x17')],_0x121381);_0x50e62e(_0xd0e559[_0xad1d('0x14')](0x1f4,_0x451388['message']));});});};
\ No newline at end of file
index ed2e9d5..edf3aa1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x679f=['emit','register','length','plugin:','./plugin.events'];(function(_0x3271d2,_0x28b697){var _0x3415f9=function(_0x57b145){while(--_0x57b145){_0x3271d2['push'](_0x3271d2['shift']());}};_0x3415f9(++_0x28b697);}(_0x679f,0xc2));var _0xf679=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x679f[_0x59ee6f];return _0x4c0979;};'use strict';var PluginEvents=require(_0xf679('0x0'));var events=['save','remove','update'];function createListener(_0x1865e7,_0x30e414){return function(_0x57fa54){_0x30e414[_0xf679('0x1')](_0x1865e7,_0x57fa54);};}function removeListener(_0x1e37f8,_0x5518d5){return function(){PluginEvents['removeListener'](_0x1e37f8,_0x5518d5);};}exports[_0xf679('0x2')]=function(_0x256876){for(var _0x2e0bc7=0x0,_0x4ba21b=events[_0xf679('0x3')];_0x2e0bc7<_0x4ba21b;_0x2e0bc7++){var _0x8349fe=events[_0x2e0bc7];var _0x4a1afa=createListener(_0xf679('0x4')+_0x8349fe,_0x256876);PluginEvents['on'](_0x8349fe,_0x4a1afa);}};
\ No newline at end of file
+var _0xffa1=['removeListener','register','length','plugin:','./plugin.events','save','remove','update','emit'];(function(_0x27da2f,_0x550937){var _0x1b0801=function(_0x42d3e6){while(--_0x42d3e6){_0x27da2f['push'](_0x27da2f['shift']());}};_0x1b0801(++_0x550937);}(_0xffa1,0xaf));var _0x1ffa=function(_0x215a9f,_0x5457c5){_0x215a9f=_0x215a9f-0x0;var _0x183073=_0xffa1[_0x215a9f];return _0x183073;};'use strict';var PluginEvents=require(_0x1ffa('0x0'));var events=[_0x1ffa('0x1'),_0x1ffa('0x2'),_0x1ffa('0x3')];function createListener(_0x2b3c64,_0x5e0584){return function(_0x2af6b5){_0x5e0584[_0x1ffa('0x4')](_0x2b3c64,_0x2af6b5);};}function removeListener(_0x775853,_0x15fc67){return function(){PluginEvents[_0x1ffa('0x5')](_0x775853,_0x15fc67);};}exports[_0x1ffa('0x6')]=function(_0x372769){for(var _0x1d2dde=0x0,_0x38c4ea=events[_0x1ffa('0x7')];_0x1d2dde<_0x38c4ea;_0x1d2dde++){var _0x93d7e8=events[_0x1d2dde];var _0x30ffc7=createListener(_0x1ffa('0x8')+_0x93d7e8,_0x372769);PluginEvents['on'](_0x93d7e8,_0x30ffc7);}};
\ No newline at end of file
index 863e3e3..013667c 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(_0x4ad264,_0x5922cd){var _0x1599e9=function(_0x56c167){while(--_0x56c167){_0x4ad264['push'](_0x4ad264['shift']());}};_0x1599e9(++_0x5922cd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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(_0x521e41,_0x34e57f){var _0x25b247=function(_0x461ae9){while(--_0x461ae9){_0x521e41['push'](_0x521e41['shift']());}};_0x25b247(++_0x34e57f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 e48be9c..08cc507 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc075=['name','send','list','then','reject','express','motion2','length','catch','show','describe','body','script','join','../../files/plugins','cwd','dirname','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','params','Unknown\x20status','destroy','lodash','api','path','child_process','exec','bluebird','sendStatus','status','json','stack'];(function(_0x4983f4,_0x2150a2){var _0x43551c=function(_0x33462a){while(--_0x33462a){_0x4983f4['push'](_0x4983f4['shift']());}};_0x43551c(++_0x2150a2);}(_0xc075,0x1a6));var _0x5c07=function(_0x307287,_0x2e63f4){_0x307287=_0x307287-0x0;var _0x36aea5=_0xc075[_0x307287];return _0x36aea5;};'use strict';var _=require(_0x5c07('0x0'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0x5c07('0x1'));var path=require(_0x5c07('0x2'));var exec=require(_0x5c07('0x3'))[_0x5c07('0x4')];var BPromise=require(_0x5c07('0x5'));function handleEntityNotFound(_0x32ff87,_0x5a179c){return function(_0x2d72d4){if(!_0x2d72d4){_0x32ff87[_0x5c07('0x6')](0x194);;}return _0x2d72d4;};}function respondWithResult(_0x3ca549,_0x54d3d6){_0x54d3d6=_0x54d3d6||0xc8;return function(_0x1ca99f){if(_0x1ca99f){return _0x3ca549[_0x5c07('0x7')](_0x54d3d6)[_0x5c07('0x8')](_0x1ca99f);}return null;};}function handleError(_0x16121f,_0x462705){_0x462705=_0x462705||0x1f4;return function(_0x32005a){logger['error'](_0x32005a[_0x5c07('0x9')]);if(_0x32005a[_0x5c07('0xa')]){delete _0x32005a['name'];}_0x16121f[_0x5c07('0x7')](_0x462705)[_0x5c07('0xb')](_0x32005a);};}function execChildProcess(){return new BPromise(function(_0x331bb5,_0x5c5136){exec('npm\x20install',function(_0x467e22,_0x205eb6,_0x425e8f){logger['info'](_0x205eb6);logger['info'](_0x425e8f);if(_0x467e22){logger['error'](_0x467e22);return _0x5c5136(_0x467e22);}return _0x331bb5(_0x205eb6);});});}exports['index']=function(_0x289a0f,_0x4e3f87){return pm2[_0x5c07('0xc')]()[_0x5c07('0xd')](function(_0x5eb889){if(_0x5eb889){var _0x289c15=_[_0x5c07('0xe')](_0x5eb889,function(_0x139bc0){return _0x139bc0[_0x5c07('0xa')]===_0x5c07('0xf')||_0x139bc0[_0x5c07('0xa')]===_0x5c07('0x10');});return{'rows':_0x289c15,'count':_0x289c15[_0x5c07('0x11')]};}return null;})[_0x5c07('0xd')](respondWithResult(_0x4e3f87,null))[_0x5c07('0x12')](handleError(_0x4e3f87,null));};exports[_0x5c07('0x13')]=function(_0x166d42,_0x106e5d){return pm2[_0x5c07('0x14')](_0x166d42['params']['id'])['then'](respondWithResult(_0x106e5d,null))[_0x5c07('0xd')](handleEntityNotFound(_0x106e5d,null))[_0x5c07('0x12')](handleError(_0x106e5d,null));};exports['create']=function(_0x4774e4,_0x501ec1){if(_0x4774e4[_0x5c07('0x15')][_0x5c07('0xa')]&&_0x4774e4[_0x5c07('0x15')][_0x5c07('0x16')]){var _0x1a7716=path[_0x5c07('0x17')](__dirname,_0x5c07('0x18'),_0x4774e4[_0x5c07('0x15')][_0x5c07('0x16')]);var _0xddb9a9=process[_0x5c07('0x19')]();process['chdir'](path[_0x5c07('0x1a')](_0x1a7716));return execChildProcess()[_0x5c07('0xd')](function(_0x8801d8){process['chdir'](_0xddb9a9);return pm2['start']({'name':_0x4774e4[_0x5c07('0x15')][_0x5c07('0xa')],'script':_0x1a7716});})[_0x5c07('0xd')](function(_0x4d9696){pm2[_0x5c07('0x1b')]();return _0x4d9696[0x0];})[_0x5c07('0xd')](respondWithResult(_0x501ec1,0xc9))[_0x5c07('0x12')](handleError(_0x501ec1,null));}else{return _0x501ec1[_0x5c07('0x7')](0x1f4)[_0x5c07('0xb')]({'message':_0x5c07('0x1c')});}};exports[_0x5c07('0x1d')]=function(_0x1cc7e7,_0x375961){if(_0x1cc7e7[_0x5c07('0x15')]['id']){delete _0x1cc7e7[_0x5c07('0x15')]['id'];}var _0x4f7d17={'online':_0x5c07('0x1e'),'stopped':_0x5c07('0x1f')};if(_0x4f7d17[_0x5c07('0x20')](_0x1cc7e7['body'][_0x5c07('0x7')])){return pm2[_0x4f7d17[_0x1cc7e7[_0x5c07('0x15')][_0x5c07('0x7')]]](_0x1cc7e7[_0x5c07('0x21')]['id'])[_0x5c07('0xd')](respondWithResult(_0x375961,0xc8))['catch'](handleError(_0x375961,null));}else{return _0x375961[_0x5c07('0x7')](0x1f4)['send']({'message':_0x5c07('0x22')});}};exports[_0x5c07('0x23')]=function(_0x1933a7,_0x290593){if(_0x1933a7[_0x5c07('0x15')]['id']){delete _0x1933a7[_0x5c07('0x15')]['id'];}if(_0x1933a7[_0x5c07('0x21')]['id']){return pm2['delete'](_0x1933a7[_0x5c07('0x21')]['id'])[_0x5c07('0xd')](function(_0x2f3ecb){pm2[_0x5c07('0x1b')]();return _0x2f3ecb[0x0];})['then'](respondWithResult(_0x290593,null))[_0x5c07('0x12')](handleError(_0x290593,null));}else{return _0x290593[_0x5c07('0x7')](0x1f4)[_0x5c07('0xb')]({'message':'Unknown\x20id'});}};
\ No newline at end of file
+var _0x122f=['error','stack','name','status','send','npm\x20install','info','index','list','reject','length','catch','params','then','create','body','script','../../files/plugins','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','path','child_process','sendStatus','json'];(function(_0x3b18e6,_0x35e310){var _0xaf05b7=function(_0x5f0cc8){while(--_0x5f0cc8){_0x3b18e6['push'](_0x3b18e6['shift']());}};_0xaf05b7(++_0x35e310);}(_0x122f,0xd1));var _0xf122=function(_0xf46bd9,_0x322826){_0xf46bd9=_0xf46bd9-0x0;var _0x2763c3=_0x122f[_0xf46bd9];return _0x2763c3;};'use strict';var _=require(_0xf122('0x0'));var pm2=require(_0xf122('0x1'));var logger=require(_0xf122('0x2'))('api');var path=require(_0xf122('0x3'));var exec=require(_0xf122('0x4'))['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0x182b6a,_0x2a38e7){return function(_0x4b39eb){if(!_0x4b39eb){_0x182b6a[_0xf122('0x5')](0x194);;}return _0x4b39eb;};}function respondWithResult(_0x142216,_0x47f78b){_0x47f78b=_0x47f78b||0xc8;return function(_0x5a00b0){if(_0x5a00b0){return _0x142216['status'](_0x47f78b)[_0xf122('0x6')](_0x5a00b0);}return null;};}function handleError(_0x1ec5fa,_0x44f63f){_0x44f63f=_0x44f63f||0x1f4;return function(_0x2f1357){logger[_0xf122('0x7')](_0x2f1357[_0xf122('0x8')]);if(_0x2f1357[_0xf122('0x9')]){delete _0x2f1357['name'];}_0x1ec5fa[_0xf122('0xa')](_0x44f63f)[_0xf122('0xb')](_0x2f1357);};}function execChildProcess(){return new BPromise(function(_0x5564ba,_0xb18cd6){exec(_0xf122('0xc'),function(_0x36751a,_0x3a5ef0,_0x15f085){logger['info'](_0x3a5ef0);logger[_0xf122('0xd')](_0x15f085);if(_0x36751a){logger['error'](_0x36751a);return _0xb18cd6(_0x36751a);}return _0x5564ba(_0x3a5ef0);});});}exports[_0xf122('0xe')]=function(_0x716ae7,_0x4a2242){return pm2[_0xf122('0xf')]()['then'](function(_0x186d81){if(_0x186d81){var _0x1a6524=_[_0xf122('0x10')](_0x186d81,function(_0x22d688){return _0x22d688[_0xf122('0x9')]==='express'||_0x22d688[_0xf122('0x9')]==='motion2';});return{'rows':_0x1a6524,'count':_0x1a6524[_0xf122('0x11')]};}return null;})['then'](respondWithResult(_0x4a2242,null))[_0xf122('0x12')](handleError(_0x4a2242,null));};exports['show']=function(_0x28f309,_0x5713ac){return pm2['describe'](_0x28f309[_0xf122('0x13')]['id'])['then'](respondWithResult(_0x5713ac,null))[_0xf122('0x14')](handleEntityNotFound(_0x5713ac,null))[_0xf122('0x12')](handleError(_0x5713ac,null));};exports[_0xf122('0x15')]=function(_0x55d467,_0x4dcb9e){if(_0x55d467[_0xf122('0x16')][_0xf122('0x9')]&&_0x55d467['body'][_0xf122('0x17')]){var _0x164bf6=path['join'](__dirname,_0xf122('0x18'),_0x55d467[_0xf122('0x16')][_0xf122('0x17')]);var _0xe46ae5=process['cwd']();process[_0xf122('0x19')](path[_0xf122('0x1a')](_0x164bf6));return execChildProcess()[_0xf122('0x14')](function(_0x4d7ff4){process['chdir'](_0xe46ae5);return pm2['start']({'name':_0x55d467[_0xf122('0x16')][_0xf122('0x9')],'script':_0x164bf6});})['then'](function(_0x1ecd71){pm2[_0xf122('0x1b')]();return _0x1ecd71[0x0];})[_0xf122('0x14')](respondWithResult(_0x4dcb9e,0xc9))[_0xf122('0x12')](handleError(_0x4dcb9e,null));}else{return _0x4dcb9e[_0xf122('0xa')](0x1f4)['send']({'message':_0xf122('0x1c')});}};exports[_0xf122('0x1d')]=function(_0xd0214e,_0x139205){if(_0xd0214e[_0xf122('0x16')]['id']){delete _0xd0214e[_0xf122('0x16')]['id'];}var _0x153b6b={'online':_0xf122('0x1e'),'stopped':'stop'};if(_0x153b6b[_0xf122('0x1f')](_0xd0214e[_0xf122('0x16')][_0xf122('0xa')])){return pm2[_0x153b6b[_0xd0214e[_0xf122('0x16')][_0xf122('0xa')]]](_0xd0214e[_0xf122('0x13')]['id'])[_0xf122('0x14')](respondWithResult(_0x139205,0xc8))[_0xf122('0x12')](handleError(_0x139205,null));}else{return _0x139205[_0xf122('0xa')](0x1f4)[_0xf122('0xb')]({'message':_0xf122('0x20')});}};exports[_0xf122('0x21')]=function(_0x3b6b26,_0x42deef){if(_0x3b6b26[_0xf122('0x16')]['id']){delete _0x3b6b26['body']['id'];}if(_0x3b6b26[_0xf122('0x13')]['id']){return pm2[_0xf122('0x22')](_0x3b6b26[_0xf122('0x13')]['id'])['then'](function(_0x2c3f26){pm2[_0xf122('0x1b')]();return _0x2c3f26[0x0];})[_0xf122('0x14')](respondWithResult(_0x42deef,null))[_0xf122('0x12')](handleError(_0x42deef,null));}else{return _0x42deef[_0xf122('0xa')](0x1f4)[_0xf122('0xb')]({'message':_0xf122('0x23')});}};
\ No newline at end of file
index 7baa495..cd3fdb8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7f05=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','express'];(function(_0x254ef8,_0x1e60a0){var _0x5bb5b7=function(_0x48ecbe){while(--_0x48ecbe){_0x254ef8['push'](_0x254ef8['shift']());}};_0x5bb5b7(++_0x1e60a0);}(_0x7f05,0xdc));var _0x57f0=function(_0x466f14,_0x4de814){_0x466f14=_0x466f14-0x0;var _0x15ce28=_0x7f05[_0x466f14];return _0x15ce28;};'use strict';var multer=require(_0x57f0('0x0'));var util=require(_0x57f0('0x1'));var path=require(_0x57f0('0x2'));var timeout=require('connect-timeout');var express=require(_0x57f0('0x3'));var router=express['Router']();var auth=require(_0x57f0('0x4'));var interaction=require(_0x57f0('0x5'));var config=require('../../config/environment');module[_0x57f0('0x6')]=router;
\ No newline at end of file
+var _0xecb2=['multer','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x1154f3,_0x93c2e5){var _0x56a730=function(_0x3cc8b0){while(--_0x3cc8b0){_0x1154f3['push'](_0x1154f3['shift']());}};_0x56a730(++_0x93c2e5);}(_0xecb2,0xf6));var _0x2ecb=function(_0x30cf05,_0x22199d){_0x30cf05=_0x30cf05-0x0;var _0x5685e1=_0xecb2[_0x30cf05];return _0x5685e1;};'use strict';var multer=require(_0x2ecb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2ecb('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x2ecb('0x2'));var interaction=require(_0x2ecb('0x3'));var config=require(_0x2ecb('0x4'));module[_0x2ecb('0x5')]=router;
\ No newline at end of file
index 7e43fdc..ecdebf6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x18fd=['sequelize','INTEGER','STRING','DATE'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x18fd,0x188));var _0xd18f=function(_0x1168a1,_0xa0d8c9){_0x1168a1=_0x1168a1-0x0;var _0xcc5ad8=_0x18fd[_0x1168a1];return _0xcc5ad8;};'use strict';var Sequelize=require(_0xd18f('0x0'));module['exports']={'state':{'type':Sequelize[_0xd18f('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xd18f('0x2')]},'scheduledat':{'type':Sequelize[_0xd18f('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xd18f('0x3')]},'responsetime':{'type':Sequelize[_0xd18f('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xd18f('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xd18f('0x2')]}};
\ No newline at end of file
+var _0xedc8=['exports','INTEGER','DATE','STRING','sequelize'];(function(_0x55d080,_0x359d79){var _0x23538c=function(_0x5109c1){while(--_0x5109c1){_0x55d080['push'](_0x55d080['shift']());}};_0x23538c(++_0x359d79);}(_0xedc8,0x90));var _0x8edc=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xedc8[_0x2235bf];return _0x4c3a64;};'use strict';var Sequelize=require(_0x8edc('0x0'));module[_0x8edc('0x1')]={'state':{'type':Sequelize[_0x8edc('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x8edc('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x8edc('0x3')]},'responsetime':{'type':Sequelize[_0x8edc('0x3')]},'ringtime':{'type':Sequelize[_0x8edc('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x8edc('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x8edc('0x4')]}};
\ No newline at end of file
index ba3fb31..9afd64a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x872b=['exports','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x872b,0x1cf));var _0xb872=function(_0x3062ff,_0x594115){_0x3062ff=_0x3062ff-0x0;var _0x2e9a17=_0x872b[_0x3062ff];return _0x2e9a17;};'use strict';var _=require(_0xb872('0x0'));var util=require(_0xb872('0x1'));var logger=require(_0xb872('0x2'))(_0xb872('0x3'));var moment=require(_0xb872('0x4'));var BPromise=require(_0xb872('0x5'));var rp=require(_0xb872('0x6'));var attributes=require('./reportAgentPreview.attributes');module[_0xb872('0x7')]=function(_0x24b407,_0x3ab217){return _0x24b407['define'](_0xb872('0x8'),attributes,{'tableName':_0xb872('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xe133=['../../config/logger','api','bluebird','./reportAgentPreview.attributes','ReportAgentPreview'];(function(_0x59b44a,_0x255a0f){var _0x2b4277=function(_0x461c43){while(--_0x461c43){_0x59b44a['push'](_0x59b44a['shift']());}};_0x2b4277(++_0x255a0f);}(_0xe133,0xe1));var _0x3e13=function(_0x4438e8,_0x2b3aac){_0x4438e8=_0x4438e8-0x0;var _0x5f51ab=_0xe133[_0x4438e8];return _0x5f51ab;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3e13('0x0'))(_0x3e13('0x1'));var moment=require('moment');var BPromise=require(_0x3e13('0x2'));var rp=require('request-promise');var attributes=require(_0x3e13('0x3'));module['exports']=function(_0x3488e4,_0x21e88f){return _0x3488e4['define'](_0x3e13('0x4'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index ff71957..e44c352 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2f3c=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2f3c,0x11c));var _0xc2f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2f3c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc2f3('0x0'));var util=require(_0xc2f3('0x1'));var moment=require('moment');var BPromise=require(_0xc2f3('0x2'));var rs=require(_0xc2f3('0x3'));var fs=require('fs');var Redis=require(_0xc2f3('0x4'));var db=require(_0xc2f3('0x5'))['db'];var utils=require(_0xc2f3('0x6'));var logger=require(_0xc2f3('0x7'))(_0xc2f3('0x8'));var config=require(_0xc2f3('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc2f3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36cf9f,_0x311edc,_0x1cb957){return new BPromise(function(_0x1b7d3e,_0x300963){return client[_0xc2f3('0xb')](_0x36cf9f,_0x1cb957)[_0xc2f3('0xc')](function(_0x446cf6){logger[_0xc2f3('0xd')](_0xc2f3('0xe'),_0x311edc,_0xc2f3('0xf'));logger[_0xc2f3('0x10')](_0xc2f3('0x11'),_0x311edc,'request\x20sent',JSON['stringify'](_0x446cf6));if(_0x446cf6['error']){if(_0x446cf6[_0xc2f3('0x12')][_0xc2f3('0x13')]===0x1f4){logger['error'](_0xc2f3('0xe'),_0x311edc,_0x446cf6[_0xc2f3('0x12')][_0xc2f3('0x14')]);return _0x300963(_0x446cf6['error'][_0xc2f3('0x14')]);}logger[_0xc2f3('0x12')](_0xc2f3('0xe'),_0x311edc,_0x446cf6['error'][_0xc2f3('0x14')]);return _0x1b7d3e(_0x446cf6[_0xc2f3('0x12')][_0xc2f3('0x14')]);}else{logger[_0xc2f3('0xd')](_0xc2f3('0xe'),_0x311edc,_0xc2f3('0xf'));_0x1b7d3e(_0x446cf6['result'][_0xc2f3('0x14')]);}})[_0xc2f3('0x15')](function(_0x578d99){logger['error'](_0xc2f3('0xe'),_0x311edc,_0x578d99);_0x300963(_0x578d99);});});}exports[_0xc2f3('0x16')]=function(_0x76a509){var _0x2edb11=this;return new Promise(function(_0x276787,_0x6a0eae){return db[_0xc2f3('0x17')][_0xc2f3('0x18')](_0x76a509[_0xc2f3('0x19')],{'raw':_0x76a509[_0xc2f3('0x1a')]?_0x76a509['options'][_0xc2f3('0x1b')]===undefined?!![]:![]:!![]})[_0xc2f3('0xc')](function(_0x1079b0){logger['info'](_0xc2f3('0x16'),_0x76a509);logger[_0xc2f3('0x10')](_0xc2f3('0x16'),_0x76a509,JSON[_0xc2f3('0x1c')](_0x1079b0));_0x276787(_0x1079b0);})[_0xc2f3('0x15')](function(_0x33238c){logger['error'](_0xc2f3('0x16'),_0x33238c[_0xc2f3('0x14')],_0x76a509);_0x6a0eae(_0x2edb11[_0xc2f3('0x12')](0x1f4,_0x33238c[_0xc2f3('0x14')]));});});};
\ No newline at end of file
+var _0x4f6a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','then','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','CreateReportAgentPreview','create','body','options','raw','catch','lodash','util','bluebird','randomstring'];(function(_0x2db78b,_0x25a3ac){var _0x41a3b8=function(_0xda6ed6){while(--_0xda6ed6){_0x2db78b['push'](_0x2db78b['shift']());}};_0x41a3b8(++_0x25a3ac);}(_0x4f6a,0xb9));var _0xa4f6=function(_0x1a3488,_0x3874b0){_0x1a3488=_0x1a3488-0x0;var _0x8398da=_0x4f6a[_0x1a3488];return _0x8398da;};'use strict';var _=require(_0xa4f6('0x0'));var util=require(_0xa4f6('0x1'));var moment=require('moment');var BPromise=require(_0xa4f6('0x2'));var rs=require(_0xa4f6('0x3'));var fs=require('fs');var Redis=require(_0xa4f6('0x4'));var db=require(_0xa4f6('0x5'))['db'];var utils=require(_0xa4f6('0x6'));var logger=require(_0xa4f6('0x7'))('rpc');var config=require(_0xa4f6('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3b89ed,_0x31c820,_0x188d5f){return new BPromise(function(_0x41deb4,_0x4714c6){return client[_0xa4f6('0x9')](_0x3b89ed,_0x188d5f)[_0xa4f6('0xa')](function(_0x5081eb){logger[_0xa4f6('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x31c820,_0xa4f6('0xc'));logger[_0xa4f6('0xd')](_0xa4f6('0xe'),_0x31c820,_0xa4f6('0xc'),JSON[_0xa4f6('0xf')](_0x5081eb));if(_0x5081eb[_0xa4f6('0x10')]){if(_0x5081eb[_0xa4f6('0x10')][_0xa4f6('0x11')]===0x1f4){logger[_0xa4f6('0x10')](_0xa4f6('0x12'),_0x31c820,_0x5081eb[_0xa4f6('0x10')][_0xa4f6('0x13')]);return _0x4714c6(_0x5081eb[_0xa4f6('0x10')][_0xa4f6('0x13')]);}logger[_0xa4f6('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x31c820,_0x5081eb[_0xa4f6('0x10')][_0xa4f6('0x13')]);return _0x41deb4(_0x5081eb[_0xa4f6('0x10')][_0xa4f6('0x13')]);}else{logger[_0xa4f6('0xb')](_0xa4f6('0x12'),_0x31c820,_0xa4f6('0xc'));_0x41deb4(_0x5081eb[_0xa4f6('0x14')][_0xa4f6('0x13')]);}})['catch'](function(_0x1eee2e){logger[_0xa4f6('0x10')](_0xa4f6('0x12'),_0x31c820,_0x1eee2e);_0x4714c6(_0x1eee2e);});});}exports[_0xa4f6('0x15')]=function(_0x3ca5c9){var _0x95b576=this;return new Promise(function(_0xb58715,_0x4f7e58){return db['ReportAgentPreview'][_0xa4f6('0x16')](_0x3ca5c9[_0xa4f6('0x17')],{'raw':_0x3ca5c9[_0xa4f6('0x18')]?_0x3ca5c9[_0xa4f6('0x18')][_0xa4f6('0x19')]===undefined?!![]:![]:!![]})[_0xa4f6('0xa')](function(_0x4ba601){logger[_0xa4f6('0xb')](_0xa4f6('0x15'),_0x3ca5c9);logger[_0xa4f6('0xd')](_0xa4f6('0x15'),_0x3ca5c9,JSON[_0xa4f6('0xf')](_0x4ba601));_0xb58715(_0x4ba601);})[_0xa4f6('0x1a')](function(_0x3a774a){logger[_0xa4f6('0x10')](_0xa4f6('0x15'),_0x3a774a[_0xa4f6('0x13')],_0x3ca5c9);_0x4f7e58(_0x95b576[_0xa4f6('0x10')](0x1f4,_0x3a774a['message']));});});};
\ No newline at end of file
index 1bc40cf..24d1ee7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf672=['util','path','express','../../components/auth/service','./rpc.controller','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','/outbound','outbound','outboundChannels','/agents','put','/agents/:id/capacity','/telephones','telephones','trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/sms/queues/:id','showSmsQueues','/agents/:id/notify','exports','multer'];(function(_0x340ae3,_0x297191){var _0x3f230b=function(_0x59a938){while(--_0x59a938){_0x340ae3['push'](_0x340ae3['shift']());}};_0x3f230b(++_0x297191);}(_0xf672,0xc5));var _0x2f67=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xf672[_0x36eaaa];return _0x461349;};'use strict';var multer=require(_0x2f67('0x0'));var util=require(_0x2f67('0x1'));var path=require(_0x2f67('0x2'));var express=require(_0x2f67('0x3'));var router=express['Router']();var auth=require(_0x2f67('0x4'));var controller=require(_0x2f67('0x5'));router[_0x2f67('0x6')](_0x2f67('0x7'),auth['isAuthenticated'](),controller[_0x2f67('0x8')]);router[_0x2f67('0x6')](_0x2f67('0x9'),auth[_0x2f67('0xa')](),controller['voiceChannelMixMonitor']);router[_0x2f67('0x6')]('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller[_0x2f67('0xb')]);router['get'](_0x2f67('0xc'),auth[_0x2f67('0xa')](),controller[_0x2f67('0xd')]);router[_0x2f67('0x6')](_0x2f67('0xe'),auth[_0x2f67('0xa')](),controller[_0x2f67('0xf')]);router[_0x2f67('0x6')](_0x2f67('0x10'),auth[_0x2f67('0xa')](),controller[_0x2f67('0x11')]);router[_0x2f67('0x6')]('/mail/accounts',auth[_0x2f67('0xa')](),controller[_0x2f67('0x12')]);router['get'](_0x2f67('0x13'),auth['isAuthenticated'](),controller[_0x2f67('0x14')]);router['get'](_0x2f67('0x15'),auth[_0x2f67('0xa')](),controller[_0x2f67('0x16')]);router['get']('/fax/queues',auth[_0x2f67('0xa')](),controller[_0x2f67('0x17')]);router[_0x2f67('0x6')](_0x2f67('0x18'),auth[_0x2f67('0xa')](),controller[_0x2f67('0x19')]);router[_0x2f67('0x6')]('/voice/queues/channels',auth['isAuthenticated'](),controller['voiceQueuesChannels']);router['get']('/voice/queues/channels/:uniqueid',auth[_0x2f67('0xa')](),controller[_0x2f67('0x1a')]);router['get']('/voice/queues/channels/:uniqueid/hangup',auth[_0x2f67('0xa')](),controller[_0x2f67('0x1b')]);router[_0x2f67('0x6')](_0x2f67('0x1c'),auth[_0x2f67('0xa')](),controller['voiceQueuesChannelRedirect']);router['get'](_0x2f67('0x1d'),auth[_0x2f67('0xa')](),controller['showVoiceQueues']);router[_0x2f67('0x6')](_0x2f67('0x1e'),auth[_0x2f67('0xa')](),controller[_0x2f67('0x1f')]);router[_0x2f67('0x6')]('/outbound/channels',auth[_0x2f67('0xa')](),controller[_0x2f67('0x20')]);router[_0x2f67('0x6')](_0x2f67('0x21'),auth[_0x2f67('0xa')](),controller['agents']);router[_0x2f67('0x22')](_0x2f67('0x23'),auth[_0x2f67('0xa')](),controller['agentCapacity']);router['get'](_0x2f67('0x24'),auth[_0x2f67('0xa')](),controller[_0x2f67('0x25')]);router[_0x2f67('0x6')]('/trunks',auth[_0x2f67('0xa')](),controller[_0x2f67('0x26')]);router[_0x2f67('0x6')](_0x2f67('0x27'),auth['isAuthenticated'](),controller[_0x2f67('0x28')]);router[_0x2f67('0x6')]('/fax/accounts',auth[_0x2f67('0xa')](),controller[_0x2f67('0x29')]);router[_0x2f67('0x6')](_0x2f67('0x2a'),auth[_0x2f67('0xa')](),controller[_0x2f67('0x2b')]);router[_0x2f67('0x6')](_0x2f67('0x2c'),auth[_0x2f67('0xa')](),controller['mailQueuesWaitingInteractions']);router['get']('/openchannel/queues/waitinginteractions',auth[_0x2f67('0xa')](),controller[_0x2f67('0x2d')]);router['get']('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x2f67('0x2e')]);router[_0x2f67('0x6')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x2f67('0x2f')]);router[_0x2f67('0x30')](_0x2f67('0x31'),auth['isAuthenticated'](),controller[_0x2f67('0x32')]('mail'));router[_0x2f67('0x6')](_0x2f67('0x33'),auth[_0x2f67('0xa')](),controller[_0x2f67('0x34')]);router[_0x2f67('0x30')]('/chat/queues/:id/notify',auth[_0x2f67('0xa')](),controller[_0x2f67('0x32')]('chat'));router['get'](_0x2f67('0x35'),auth[_0x2f67('0xa')](),controller[_0x2f67('0x36')]);router[_0x2f67('0x30')](_0x2f67('0x37'),auth[_0x2f67('0xa')](),controller['queueNotify']('fax'));router['get']('/fax/queues/:id',auth['isAuthenticated'](),controller[_0x2f67('0x38')]);router[_0x2f67('0x30')]('/openchannel/queues/:id/notify',auth['isAuthenticated'](),controller[_0x2f67('0x32')](_0x2f67('0x39')));router[_0x2f67('0x6')](_0x2f67('0x3a'),auth[_0x2f67('0xa')](),controller[_0x2f67('0x3b')]);router[_0x2f67('0x30')](_0x2f67('0x3c'),auth[_0x2f67('0xa')](),controller[_0x2f67('0x32')](_0x2f67('0x3d')));router[_0x2f67('0x6')](_0x2f67('0x3e'),auth[_0x2f67('0xa')](),controller[_0x2f67('0x3f')]);router[_0x2f67('0x30')](_0x2f67('0x40'),auth[_0x2f67('0xa')](),controller['agentNotify']);module[_0x2f67('0x41')]=router;
\ No newline at end of file
+var _0x285b=['/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','/outbound','outbound','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/campaigns','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','showSmsQueues','/agents/:id/notify','agentNotify','exports','multer','path','express','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor'];(function(_0x2ff8e9,_0x1c1cea){var _0x26924f=function(_0x14c169){while(--_0x14c169){_0x2ff8e9['push'](_0x2ff8e9['shift']());}};_0x26924f(++_0x1c1cea);}(_0x285b,0x171));var _0xb285=function(_0x3e0ab0,_0x35630b){_0x3e0ab0=_0x3e0ab0-0x0;var _0x25f268=_0x285b[_0x3e0ab0];return _0x25f268;};'use strict';var multer=require(_0xb285('0x0'));var util=require('util');var path=require(_0xb285('0x1'));var express=require(_0xb285('0x2'));var router=express['Router']();var auth=require(_0xb285('0x3'));var controller=require(_0xb285('0x4'));router[_0xb285('0x5')](_0xb285('0x6'),auth[_0xb285('0x7')](),controller[_0xb285('0x8')]);router[_0xb285('0x5')](_0xb285('0x9'),auth[_0xb285('0x7')](),controller[_0xb285('0xa')]);router['get'](_0xb285('0xb'),auth[_0xb285('0x7')](),controller[_0xb285('0xc')]);router['get']('/voice/queues',auth[_0xb285('0x7')](),controller[_0xb285('0xd')]);router[_0xb285('0x5')](_0xb285('0xe'),auth['isAuthenticated'](),controller[_0xb285('0xf')]);router['get'](_0xb285('0x10'),auth[_0xb285('0x7')](),controller[_0xb285('0x11')]);router[_0xb285('0x5')](_0xb285('0x12'),auth[_0xb285('0x7')](),controller[_0xb285('0x13')]);router[_0xb285('0x5')](_0xb285('0x14'),auth[_0xb285('0x7')](),controller['openchannelQueues']);router['get'](_0xb285('0x15'),auth[_0xb285('0x7')](),controller[_0xb285('0x16')]);router[_0xb285('0x5')]('/fax/queues',auth[_0xb285('0x7')](),controller[_0xb285('0x17')]);router[_0xb285('0x5')](_0xb285('0x18'),auth['isAuthenticated'](),controller[_0xb285('0x19')]);router['get'](_0xb285('0x1a'),auth[_0xb285('0x7')](),controller[_0xb285('0x1b')]);router['get'](_0xb285('0x1c'),auth[_0xb285('0x7')](),controller[_0xb285('0x1d')]);router[_0xb285('0x5')](_0xb285('0x1e'),auth[_0xb285('0x7')](),controller[_0xb285('0x1f')]);router[_0xb285('0x5')](_0xb285('0x20'),auth['isAuthenticated'](),controller[_0xb285('0x21')]);router[_0xb285('0x5')](_0xb285('0x22'),auth[_0xb285('0x7')](),controller['showVoiceQueues']);router[_0xb285('0x5')](_0xb285('0x23'),auth['isAuthenticated'](),controller[_0xb285('0x24')]);router[_0xb285('0x5')]('/outbound/channels',auth['isAuthenticated'](),controller[_0xb285('0x25')]);router[_0xb285('0x5')](_0xb285('0x26'),auth[_0xb285('0x7')](),controller[_0xb285('0x27')]);router[_0xb285('0x28')](_0xb285('0x29'),auth[_0xb285('0x7')](),controller[_0xb285('0x2a')]);router[_0xb285('0x5')](_0xb285('0x2b'),auth['isAuthenticated'](),controller[_0xb285('0x2c')]);router[_0xb285('0x5')]('/trunks',auth[_0xb285('0x7')](),controller['trunks']);router[_0xb285('0x5')](_0xb285('0x2d'),auth[_0xb285('0x7')](),controller[_0xb285('0x2e')]);router[_0xb285('0x5')](_0xb285('0x2f'),auth[_0xb285('0x7')](),controller[_0xb285('0x30')]);router[_0xb285('0x5')]('/chat/queues/waitinginteractions',auth[_0xb285('0x7')](),controller[_0xb285('0x31')]);router[_0xb285('0x5')](_0xb285('0x32'),auth[_0xb285('0x7')](),controller[_0xb285('0x33')]);router[_0xb285('0x5')]('/openchannel/queues/waitinginteractions',auth[_0xb285('0x7')](),controller[_0xb285('0x34')]);router[_0xb285('0x5')](_0xb285('0x35'),auth[_0xb285('0x7')](),controller['smsQueuesWaitingInteractions']);router['get'](_0xb285('0x36'),auth[_0xb285('0x7')](),controller[_0xb285('0x37')]);router[_0xb285('0x38')](_0xb285('0x39'),auth[_0xb285('0x7')](),controller[_0xb285('0x3a')]('mail'));router[_0xb285('0x5')](_0xb285('0x3b'),auth[_0xb285('0x7')](),controller[_0xb285('0x3c')]);router['post'](_0xb285('0x3d'),auth[_0xb285('0x7')](),controller[_0xb285('0x3a')](_0xb285('0x3e')));router[_0xb285('0x5')](_0xb285('0x3f'),auth['isAuthenticated'](),controller[_0xb285('0x40')]);router[_0xb285('0x38')]('/fax/queues/:id/notify',auth[_0xb285('0x7')](),controller[_0xb285('0x3a')]('fax'));router[_0xb285('0x5')](_0xb285('0x41'),auth['isAuthenticated'](),controller[_0xb285('0x42')]);router[_0xb285('0x38')](_0xb285('0x43'),auth[_0xb285('0x7')](),controller[_0xb285('0x3a')](_0xb285('0x44')));router[_0xb285('0x5')](_0xb285('0x45'),auth[_0xb285('0x7')](),controller['showOpenchannelQueues']);router[_0xb285('0x38')](_0xb285('0x46'),auth[_0xb285('0x7')](),controller[_0xb285('0x3a')](_0xb285('0x47')));router[_0xb285('0x5')]('/sms/queues/:id',auth[_0xb285('0x7')](),controller[_0xb285('0x48')]);router[_0xb285('0x38')](_0xb285('0x49'),auth[_0xb285('0x7')](),controller[_0xb285('0x4a')]);module[_0xb285('0x4b')]=router;
\ No newline at end of file
index 77e2b27..9c18456 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x555e=['agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','update','MessageId','Start','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','http','client','request','error','message','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','VoiceChannels','query','then','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','OutboundChannels','agents','Agents','agentCapacity','body','user','interaction','findAll','INTERACTION','length','format','updateAttributes','MemberReport','findOrCreate','SIP/%s','interface','agent','internal','AgentCapacity','capacity','Telephones','trunks','Trunks','Campaigns','ChatQueues','MailQueues','mailAccounts','MailAccounts','showOpenchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','faxQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','Interaction','InteractionId','From','QueueId','TransferReport','queue','*,*,*,*'];(function(_0x14d456,_0x5c81fa){var _0x236893=function(_0x10f5ee){while(--_0x10f5ee){_0x14d456['push'](_0x14d456['shift']());}};_0x236893(++_0x5c81fa);}(_0x555e,0x161));var _0xe555=function(_0x356f71,_0x759c4c){_0x356f71=_0x356f71-0x0;var _0x1ccf9f=_0x555e[_0x356f71];return _0x1ccf9f;};'use strict';var BPromise=require(_0xe555('0x0'));var moment=require(_0xe555('0x1'));var _=require(_0xe555('0x2'));var util=require(_0xe555('0x3'));var db=require(_0xe555('0x4'))['db'];var logger=require(_0xe555('0x5'))(_0xe555('0x6'));var jayson=require(_0xe555('0x7'));var amiClient=jayson['client'][_0xe555('0x8')]({'port':0x232a});var mailClient=jayson[_0xe555('0x9')][_0xe555('0x8')]({'port':0x232b});var routingClient=jayson[_0xe555('0x9')][_0xe555('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x389736,_0x3ad382,_0x31296f){return new BPromise(function(_0x24ed90,_0x4c78ea){var _0x5d5ceb=_0x31296f?_0x31296f:amiClient;return _0x5d5ceb[_0xe555('0xa')](_0x389736,_0x3ad382)['then'](function(_0x283ba3){if(_0x283ba3[_0xe555('0xb')]){if(_0x283ba3[_0xe555('0xb')]['code']===0x1f4){return _0x4c78ea(_0x283ba3[_0xe555('0xb')][_0xe555('0xc')]);}return _0x24ed90(_0x283ba3[_0xe555('0xb')][_0xe555('0xc')]);}else{_0x24ed90(_0x283ba3['result']);}})[_0xe555('0xd')](function(_0x471758){_0x4c78ea(_0x471758);});});}function respondWithResult(_0x237c23,_0x417900){_0x417900=_0x417900||0xc8;return function(_0xea2d69){if(_0xea2d69){return _0x237c23[_0xe555('0xe')](_0x417900)[_0xe555('0xf')](_0xea2d69);}return _0x237c23[_0xe555('0x10')](0x194);};}function handleError(_0x260021,_0x7abfb6){_0x7abfb6=_0x7abfb6||0x1f4;return function(_0x670aa6){logger[_0xe555('0xb')](_0x670aa6[_0xe555('0x11')]);if(_0x670aa6[_0xe555('0x12')]){delete _0x670aa6[_0xe555('0x12')];}_0x260021[_0xe555('0xe')](_0x7abfb6)[_0xe555('0x13')](_0x670aa6);};}function findById(_0x5cc25e){return function(_0x577ce2){if(!_[_0xe555('0x14')](_0x5cc25e)&&!_['isNil'](_0x577ce2)&&!_['isNil'](_0x577ce2[_0xe555('0x15')])){return _[_0xe555('0x16')](_0x577ce2[_0xe555('0x15')],function(_0x14050a){return _0x14050a['id']==_0x5cc25e;});}return null;};}exports['voiceChannels']=function(_0x573106,_0x83d8f3){return respondWithRpcPromise(_0xe555('0x17'),_0x573106[_0xe555('0x18')])[_0xe555('0x19')](respondWithResult(_0x83d8f3,null))[_0xe555('0xd')](handleError(_0x83d8f3,null));};exports['voiceChannelMixMonitor']=function(_0x4fd05d,_0x25fc0c){return respondWithRpcPromise(_0xe555('0x1a'),_[_0xe555('0x1b')](_0x4fd05d['query'],_0x4fd05d[_0xe555('0x1c')]))[_0xe555('0x19')](respondWithResult(_0x25fc0c,null))[_0xe555('0xd')](handleError(_0x25fc0c,null));};exports[_0xe555('0x1d')]=function(_0x25371a,_0x4098ba){return respondWithRpcPromise(_0xe555('0x1e'),_['merge'](_0x25371a[_0xe555('0x18')],_0x25371a[_0xe555('0x1c')]))[_0xe555('0x19')](respondWithResult(_0x4098ba,null))[_0xe555('0xd')](handleError(_0x4098ba,null));};exports[_0xe555('0x1f')]=function(_0x449f49,_0xe81a6e){return respondWithRpcPromise('VoiceQueues',_0x449f49[_0xe555('0x18')])[_0xe555('0x19')](respondWithResult(_0xe81a6e,null))[_0xe555('0xd')](handleError(_0xe81a6e,null));};exports['showVoiceQueues']=function(_0x476f0f,_0x24120c){return respondWithRpcPromise(_0xe555('0x20'),_0x476f0f[_0xe555('0x18')])[_0xe555('0x19')](findById(_0x476f0f['params']['id']))[_0xe555('0x19')](respondWithResult(_0x24120c,null))[_0xe555('0xd')](handleError(_0x24120c,null));};exports[_0xe555('0x21')]=function(_0x3dfc8f,_0x3e3f62){return respondWithRpcPromise(_0xe555('0x22'),_[_0xe555('0x1b')](_0x3dfc8f[_0xe555('0x18')],_0x3dfc8f['params']))[_0xe555('0x19')](respondWithResult(_0x3e3f62,null))['catch'](handleError(_0x3e3f62,null));};exports[_0xe555('0x23')]=function(_0x57470f,_0x68d15d){return respondWithRpcPromise(_0xe555('0x24'),_0x57470f['query'])[_0xe555('0x19')](respondWithResult(_0x68d15d,null))[_0xe555('0xd')](handleError(_0x68d15d,null));};exports[_0xe555('0x25')]=function(_0x561c8c,_0x4c282f){return respondWithRpcPromise(_0xe555('0x26'),_[_0xe555('0x1b')](_0x561c8c[_0xe555('0x18')],_0x561c8c['params']))[_0xe555('0x19')](respondWithResult(_0x4c282f,null))['catch'](handleError(_0x4c282f,null));};exports[_0xe555('0x27')]=function(_0x7bde65,_0x98f318){return respondWithRpcPromise(_0xe555('0x28'),_[_0xe555('0x1b')](_0x7bde65[_0xe555('0x18')],_0x7bde65[_0xe555('0x1c')]))['then'](respondWithResult(_0x98f318,null))[_0xe555('0xd')](handleError(_0x98f318,null));};exports[_0xe555('0x29')]=function(_0x29d8b9,_0x561fb5){return respondWithRpcPromise(_0xe555('0x2a'),_[_0xe555('0x1b')](_0x29d8b9[_0xe555('0x18')],_0x29d8b9[_0xe555('0x1c')]))[_0xe555('0x19')](respondWithResult(_0x561fb5,null))[_0xe555('0xd')](handleError(_0x561fb5,null));};exports['outbound']=function(_0x1bbaff,_0x49c031){return respondWithRpcPromise('Outbound',_0x1bbaff[_0xe555('0x18')])[_0xe555('0x19')](respondWithResult(_0x49c031,null))[_0xe555('0xd')](handleError(_0x49c031,null));};exports['outboundChannels']=function(_0x24b120,_0x3b2920){return respondWithRpcPromise(_0xe555('0x2b'),_0x24b120[_0xe555('0x18')])[_0xe555('0x19')](respondWithResult(_0x3b2920,null))[_0xe555('0xd')](handleError(_0x3b2920,null));};exports[_0xe555('0x2c')]=function(_0x2a300e,_0x240979){var _0x8b17da;return respondWithRpcPromise(_0xe555('0x2d'),_0x2a300e['query'])['then'](function(_0x55bfa6){_0x8b17da=_0x55bfa6;return respondWithRpcPromise('Agents',_0x2a300e[_0xe555('0x18')],routingClient);})['then'](function(_0x4b9aec){return _['merge']({},_0x4b9aec,_0x8b17da);})[_0xe555('0x19')](respondWithResult(_0x240979,null))[_0xe555('0xd')](handleError(_0x240979,null));};exports[_0xe555('0x2e')]=function(_0x5670e9,_0x1e686d){if(_0x5670e9[_0xe555('0x2f')]&&_0x5670e9[_0xe555('0x2f')]['interaction']&&_0x5670e9['user']&&_0x5670e9[_0xe555('0x30')][_0xe555('0x12')]){for(var _0x4b3381 in _0x5670e9[_0xe555('0x2f')]['interaction']){if(_0x5670e9[_0xe555('0x2f')][_0xe555('0x31')]['hasOwnProperty'](_0x4b3381)){db['MemberReport'][_0xe555('0x32')]({'where':{'channel':_0x4b3381,'membername':_0x5670e9['user'][_0xe555('0x12')],'type':_0xe555('0x33'),'exitAt':null,'uniqueid':_0x5670e9[_0xe555('0x2f')][_0xe555('0x31')][_0x4b3381]&&_0x5670e9['body'][_0xe555('0x31')][_0x4b3381][_0xe555('0x34')]?{'$notIn':_0x5670e9[_0xe555('0x2f')][_0xe555('0x31')][_0x4b3381]}:{'$ne':null}}})['then'](function(_0x16bfef){var _0x1e3219=moment()[_0xe555('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x23afc5=0x0,_0x7d2b78=_0x16bfef[_0xe555('0x34')];_0x23afc5<_0x7d2b78;_0x23afc5+=0x1){_0x16bfef[_0x23afc5][_0xe555('0x36')]({'exitAt':_0x1e3219});}});for(var _0xfa6878=0x0;_0xfa6878<_0x5670e9['body'][_0xe555('0x31')][_0x4b3381]['length'];_0xfa6878+=0x1){db[_0xe555('0x37')][_0xe555('0x38')]({'where':{'channel':_0x4b3381,'membername':_0x5670e9[_0xe555('0x30')]['name'],'type':_0xe555('0x33'),'uniqueid':_0x5670e9['body'][_0xe555('0x31')][_0x4b3381][_0xfa6878],'exitAt':null},'defaults':{'channel':_0x4b3381,'membername':_0x5670e9[_0xe555('0x30')][_0xe555('0x12')],'interface':_[_0xe555('0x14')](_0x5670e9[_0xe555('0x30')]['interface'])?util['format'](_0xe555('0x39'),_0x5670e9[_0xe555('0x30')][_0xe555('0x12')]):_0x5670e9[_0xe555('0x30')][_0xe555('0x3a')],'type':_0xe555('0x33'),'enterAt':moment()[_0xe555('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xe555('0x3b'),'internal':_0x5670e9['user'][_0xe555('0x3c')],'uniqueid':_0x5670e9[_0xe555('0x2f')][_0xe555('0x31')][_0x4b3381][_0xfa6878]}});}}}}return respondWithRpcPromise(_0xe555('0x3d'),{'id':_0x5670e9[_0xe555('0x1c')]['id'],'capacity':_0x5670e9['body'][_0xe555('0x3e')]},routingClient)[_0xe555('0x19')](respondWithResult(_0x1e686d,null))['catch'](handleError(_0x1e686d,null));};exports['telephones']=function(_0x34f5bc,_0x54006f){return respondWithRpcPromise(_0xe555('0x3f'),_0x34f5bc['query'])[_0xe555('0x19')](respondWithResult(_0x54006f,null))['catch'](handleError(_0x54006f,null));};exports[_0xe555('0x40')]=function(_0x157e46,_0x372243){return respondWithRpcPromise(_0xe555('0x41'),_0x157e46[_0xe555('0x18')])['then'](respondWithResult(_0x372243,null))[_0xe555('0xd')](handleError(_0x372243,null));};exports['campaigns']=function(_0x274bf7,_0x448ff2){return respondWithRpcPromise(_0xe555('0x42'),_0x274bf7[_0xe555('0x18')])[_0xe555('0x19')](respondWithResult(_0x448ff2,null))[_0xe555('0xd')](handleError(_0x448ff2,null));};exports['chatQueues']=function(_0x1b5325,_0x59e7c0){return respondWithRpcPromise(_0xe555('0x43'),_0x1b5325['query'],routingClient)['then'](respondWithResult(_0x59e7c0,null))['catch'](handleError(_0x59e7c0,null));};exports['showChatQueues']=function(_0x1dff30,_0x3efe8e){return respondWithRpcPromise(_0xe555('0x43'),_0x1dff30[_0xe555('0x18')],routingClient)[_0xe555('0x19')](findById(_0x1dff30[_0xe555('0x1c')]['id']))['then'](respondWithResult(_0x3efe8e,null))[_0xe555('0xd')](handleError(_0x3efe8e,null));};exports['mailQueues']=function(_0x86accd,_0xa2bf51){return respondWithRpcPromise(_0xe555('0x44'),_0x86accd[_0xe555('0x18')],routingClient)[_0xe555('0x19')](respondWithResult(_0xa2bf51,null))[_0xe555('0xd')](handleError(_0xa2bf51,null));};exports['showMailQueues']=function(_0x33c487,_0x47c9ba){return respondWithRpcPromise('MailQueues',_0x33c487[_0xe555('0x18')],routingClient)[_0xe555('0x19')](findById(_0x33c487[_0xe555('0x1c')]['id']))['then'](respondWithResult(_0x47c9ba,null))['catch'](handleError(_0x47c9ba,null));};exports[_0xe555('0x45')]=function(_0x5b9ec5,_0x382145){return respondWithRpcPromise(_0xe555('0x46'),_0x5b9ec5[_0xe555('0x18')],mailClient)[_0xe555('0x19')](respondWithResult(_0x382145,null))[_0xe555('0xd')](handleError(_0x382145,null));};exports['openchannelQueues']=function(_0x37cff0,_0x32845d){return respondWithRpcPromise('OpenchannelQueues',_0x37cff0[_0xe555('0x18')],routingClient)['then'](respondWithResult(_0x32845d,null))[_0xe555('0xd')](handleError(_0x32845d,null));};exports[_0xe555('0x47')]=function(_0x57b2e4,_0x2a6f4e){return respondWithRpcPromise(_0xe555('0x48'),_0x57b2e4[_0xe555('0x18')],routingClient)[_0xe555('0x19')](findById(_0x57b2e4[_0xe555('0x1c')]['id']))[_0xe555('0x19')](respondWithResult(_0x2a6f4e,null))[_0xe555('0xd')](handleError(_0x2a6f4e,null));};exports[_0xe555('0x49')]=function(_0x3929b3,_0x3c824f){return respondWithRpcPromise(_0xe555('0x4a'),_0x3929b3['query'],routingClient)[_0xe555('0x19')](respondWithResult(_0x3c824f,null))[_0xe555('0xd')](handleError(_0x3c824f,null));};exports[_0xe555('0x4b')]=function(_0x920344,_0x55e771){return respondWithRpcPromise(_0xe555('0x4a'),_0x920344['query'],routingClient)['then'](findById(_0x920344[_0xe555('0x1c')]['id']))[_0xe555('0x19')](respondWithResult(_0x55e771,null))['catch'](handleError(_0x55e771,null));};exports[_0xe555('0x4c')]=function(_0x17b312,_0x40691e){return respondWithRpcPromise('FaxQueues',_0x17b312[_0xe555('0x18')],routingClient)[_0xe555('0x19')](respondWithResult(_0x40691e,null))['catch'](handleError(_0x40691e,null));};exports['showFaxQueues']=function(_0x5dacd4,_0xcc7606){return respondWithRpcPromise(_0xe555('0x4d'),_0x5dacd4[_0xe555('0x18')],routingClient)[_0xe555('0x19')](findById(_0x5dacd4['params']['id']))[_0xe555('0x19')](respondWithResult(_0xcc7606,null))[_0xe555('0xd')](handleError(_0xcc7606,null));};exports[_0xe555('0x4e')]=function(_0x132685,_0x93ea1c){return respondWithRpcPromise('FaxAccounts',_0x132685['query'])[_0xe555('0x19')](respondWithResult(_0x93ea1c,null))[_0xe555('0xd')](handleError(_0x93ea1c,null));};exports[_0xe555('0x4f')]=function(_0x412206,_0x43b0f9){return respondWithRpcPromise(_0xe555('0x50'),_0x412206['query'],routingClient)[_0xe555('0x19')](respondWithResult(_0x43b0f9,null))[_0xe555('0xd')](handleError(_0x43b0f9,null));};exports[_0xe555('0x51')]=function(_0x28aad0,_0x24c0b8){return respondWithRpcPromise(_0xe555('0x52'),_0x28aad0[_0xe555('0x18')],routingClient)[_0xe555('0x19')](respondWithResult(_0x24c0b8,null))[_0xe555('0xd')](handleError(_0x24c0b8,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x1d1a61,_0x3db946){return respondWithRpcPromise(_0xe555('0x53'),_0x1d1a61[_0xe555('0x18')],routingClient)['then'](respondWithResult(_0x3db946,null))[_0xe555('0xd')](handleError(_0x3db946,null));};exports[_0xe555('0x54')]=function(_0x1b1e04,_0x346518){return respondWithRpcPromise(_0xe555('0x55'),_0x1b1e04[_0xe555('0x18')],routingClient)['then'](respondWithResult(_0x346518,null))[_0xe555('0xd')](handleError(_0x346518,null));};exports[_0xe555('0x56')]=function(_0x1d0eb1,_0x2a873d){return respondWithRpcPromise(_0xe555('0x57'),_0x1d0eb1['query'],routingClient)[_0xe555('0x19')](respondWithResult(_0x2a873d,null))[_0xe555('0xd')](handleError(_0x2a873d,null));};exports[_0xe555('0x58')]=function(_0x5a9765){return function(_0x2cc273,_0x4549bd){var _0x6663c3,_0x254fc3;var _0x50e63a=_[_0xe555('0x59')](_0x5a9765);var _0x5ecccb=_0x5a9765===_0xe555('0x5a')?'Website':_0xe555('0x5b');return db[_0x50e63a+_0xe555('0x5c')][_0xe555('0x5d')]({'raw':!![],'where':{'id':_0x2cc273['params']['id']}})[_0xe555('0x19')](function(_0x159321){if(_[_0xe555('0x14')](_0x159321)){throw new Error(_0x50e63a+_0xe555('0x5e'));}_0x6663c3=_0x159321;return db[_0x50e63a+_0xe555('0x5f')][_0xe555('0x5d')]({'where':{'id':_0x2cc273[_0xe555('0x2f')]['messageId']},'include':[{'model':db[_0x50e63a+_0xe555('0x60')],'as':'Interaction'},{'model':db[_0x50e63a+_0x5ecccb],'as':'Account'}]});})['then'](function(_0xd2af0c){if(_[_0xe555('0x14')](_0xd2af0c)){throw new Error(_0x50e63a+'\x20Message\x20not\x20found');}_0x254fc3=_0xd2af0c;return _0xd2af0c['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x2cb760={'uniqueid':_0x5a9765+'.'+_0x254fc3['id']+'.'+_0x254fc3[_0xe555('0x60')]['id'],'FromUserId':_0x2cc273[_0xe555('0x30')]['id'],'type':'queue'};_0x2cb760[_0x50e63a+'MessageId']=_0x254fc3['id'];_0x2cb760[_0x50e63a+_0xe555('0x61')]=_0x254fc3[_0xe555('0x60')]['id'];_0x2cb760[_0xe555('0x62')+_0x50e63a+_0x5ecccb+'Id']=_0x254fc3[_0xe555('0x5b')]['id'];_0x2cb760['To'+_0x50e63a+_0xe555('0x63')]=_0x6663c3['id'];return db[_0x50e63a+_0xe555('0x64')]['create'](_0x2cb760);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x5a9765,'interaction':_0x254fc3['Interaction'],'message':_0x254fc3,'account':_0x254fc3[_0xe555('0x5b')],'applications':[{'id':0x0,'priority':0x1,'app':_0xe555('0x65'),'appdata':_0x6663c3[_0xe555('0x12')]+','+(_0x254fc3[_0xe555('0x5b')]['queueTransferTimeout']||0x12c),'interval':_0xe555('0x66')}]},routingClient);})['then'](respondWithResult(_0x4549bd,null))['catch'](handleError(_0x4549bd,null));};};exports[_0xe555('0x67')]=function(_0x1f5bf3,_0x29d5e2){var _0x39a4f3,_0x5472b9;if(_[_0xe555('0x14')](_0x1f5bf3[_0xe555('0x2f')][_0xe555('0x68')])){throw new Error(_0xe555('0x69'));}var _0x55fb54=_0x1f5bf3[_0xe555('0x2f')][_0xe555('0x68')];var _0x2ae428=_[_0xe555('0x59')](_0x55fb54);var _0x534175=_0x55fb54===_0xe555('0x5a')?_0xe555('0x6a'):_0xe555('0x5b');return db[_0xe555('0x6b')][_0xe555('0x5d')]({'raw':!![],'where':{'id':_0x1f5bf3[_0xe555('0x1c')]['id'],'role':_0xe555('0x3b')}})[_0xe555('0x19')](function(_0x1584db){if(_[_0xe555('0x14')](_0x1584db)){throw new Error(_0xe555('0x6c'));}_0x39a4f3=_0x1584db;return db[_0x2ae428+'Message']['findOne']({'where':{'id':_0x1f5bf3['body'][_0xe555('0x6d')]},'include':[{'model':db[_0x2ae428+_0xe555('0x60')],'as':_0xe555('0x60')},{'model':db[_0x2ae428+_0x534175],'as':_0xe555('0x5b')}]});})[_0xe555('0x19')](function(_0x3dd4f3){if(_[_0xe555('0x14')](_0x3dd4f3)){throw new Error(_0x2ae428+_0xe555('0x6e'));}_0x5472b9=_0x3dd4f3;return _0x3dd4f3[_0xe555('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})[_0xe555('0x19')](function(){var _0x957699={'uniqueid':_0x55fb54+'.'+_0x5472b9['id']+'.'+_0x5472b9[_0xe555('0x60')]['id'],'FromUserId':_0x1f5bf3[_0xe555('0x30')]['id'],'type':_0xe555('0x65'),'ToUserId':_0x39a4f3['id']};_0x957699[_0x2ae428+_0xe555('0x70')]=_0x5472b9['id'];_0x957699[_0x2ae428+_0xe555('0x61')]=_0x5472b9[_0xe555('0x60')]['id'];_0x957699[_0xe555('0x62')+_0x2ae428+_0x534175+'Id']=_0x5472b9[_0xe555('0x5b')]['id'];return db[_0x2ae428+'TransferReport']['create'](_0x957699);})[_0xe555('0x19')](function(){return respondWithRpcPromise(_0xe555('0x71'),{'channel':_0x55fb54,'interaction':_0x5472b9[_0xe555('0x60')],'message':_0x5472b9,'account':_0x5472b9[_0xe555('0x5b')],'applications':[{'id':0x0,'priority':0x1,'app':_0xe555('0x3b'),'appdata':_0x39a4f3['name']+','+(_0x5472b9['Account']['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xe555('0x19')](respondWithResult(_0x29d5e2,null))[_0xe555('0xd')](handleError(_0x29d5e2,null));};
\ No newline at end of file
+var _0x6bba=['VoiceQueuesChannelHangup','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','body','interaction','user','MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','findOrCreate','interface','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','Campaigns','showChatQueues','ChatQueues','mailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','FaxQueues','showFaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','queue','MessageId','InteractionId','From','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','update','TransferReport','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','then','code','error','message','result','catch','status','json','name','send','isNil','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup'];(function(_0x3c5a33,_0x1090de){var _0x190505=function(_0x49c328){while(--_0x49c328){_0x3c5a33['push'](_0x3c5a33['shift']());}};_0x190505(++_0x1090de);}(_0x6bba,0x12f));var _0xa6bb=function(_0x4b4844,_0x2f0dfb){_0x4b4844=_0x4b4844-0x0;var _0x575192=_0x6bba[_0x4b4844];return _0x575192;};'use strict';var BPromise=require(_0xa6bb('0x0'));var moment=require(_0xa6bb('0x1'));var _=require(_0xa6bb('0x2'));var util=require('util');var db=require(_0xa6bb('0x3'))['db'];var logger=require(_0xa6bb('0x4'))(_0xa6bb('0x5'));var jayson=require(_0xa6bb('0x6'));var amiClient=jayson[_0xa6bb('0x7')][_0xa6bb('0x8')]({'port':0x232a});var mailClient=jayson[_0xa6bb('0x7')][_0xa6bb('0x8')]({'port':0x232b});var routingClient=jayson[_0xa6bb('0x7')][_0xa6bb('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x1e1226,_0x39436e,_0x1f25ab){return new BPromise(function(_0xcb4886,_0x803d27){var _0x48e605=_0x1f25ab?_0x1f25ab:amiClient;return _0x48e605['request'](_0x1e1226,_0x39436e)[_0xa6bb('0x9')](function(_0x3f89ca){if(_0x3f89ca['error']){if(_0x3f89ca['error'][_0xa6bb('0xa')]===0x1f4){return _0x803d27(_0x3f89ca[_0xa6bb('0xb')][_0xa6bb('0xc')]);}return _0xcb4886(_0x3f89ca[_0xa6bb('0xb')]['message']);}else{_0xcb4886(_0x3f89ca[_0xa6bb('0xd')]);}})[_0xa6bb('0xe')](function(_0x4684ff){_0x803d27(_0x4684ff);});});}function respondWithResult(_0xe6b8c0,_0x7dbf9f){_0x7dbf9f=_0x7dbf9f||0xc8;return function(_0x2cc44a){if(_0x2cc44a){return _0xe6b8c0[_0xa6bb('0xf')](_0x7dbf9f)[_0xa6bb('0x10')](_0x2cc44a);}return _0xe6b8c0['sendStatus'](0x194);};}function handleError(_0x150414,_0x5d11e7){_0x5d11e7=_0x5d11e7||0x1f4;return function(_0x53a3b0){logger[_0xa6bb('0xb')](_0x53a3b0['stack']);if(_0x53a3b0['name']){delete _0x53a3b0[_0xa6bb('0x11')];}_0x150414[_0xa6bb('0xf')](_0x5d11e7)[_0xa6bb('0x12')](_0x53a3b0);};}function findById(_0x31b444){return function(_0x256c0d){if(!_[_0xa6bb('0x13')](_0x31b444)&&!_[_0xa6bb('0x13')](_0x256c0d)&&!_[_0xa6bb('0x13')](_0x256c0d['rows'])){return _['find'](_0x256c0d[_0xa6bb('0x14')],function(_0x23c00c){return _0x23c00c['id']==_0x31b444;});}return null;};}exports[_0xa6bb('0x15')]=function(_0x47e2b2,_0x5b9bdc){return respondWithRpcPromise(_0xa6bb('0x16'),_0x47e2b2[_0xa6bb('0x17')])['then'](respondWithResult(_0x5b9bdc,null))[_0xa6bb('0xe')](handleError(_0x5b9bdc,null));};exports[_0xa6bb('0x18')]=function(_0x2f3089,_0x39b6b6){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xa6bb('0x19')](_0x2f3089[_0xa6bb('0x17')],_0x2f3089['params']))[_0xa6bb('0x9')](respondWithResult(_0x39b6b6,null))[_0xa6bb('0xe')](handleError(_0x39b6b6,null));};exports[_0xa6bb('0x1a')]=function(_0x399767,_0x25a36f){return respondWithRpcPromise(_0xa6bb('0x1b'),_['merge'](_0x399767[_0xa6bb('0x17')],_0x399767[_0xa6bb('0x1c')]))[_0xa6bb('0x9')](respondWithResult(_0x25a36f,null))[_0xa6bb('0xe')](handleError(_0x25a36f,null));};exports[_0xa6bb('0x1d')]=function(_0x27a22e,_0x4d7625){return respondWithRpcPromise(_0xa6bb('0x1e'),_0x27a22e[_0xa6bb('0x17')])[_0xa6bb('0x9')](respondWithResult(_0x4d7625,null))[_0xa6bb('0xe')](handleError(_0x4d7625,null));};exports[_0xa6bb('0x1f')]=function(_0x34f82b,_0x2db8df){return respondWithRpcPromise(_0xa6bb('0x1e'),_0x34f82b['query'])[_0xa6bb('0x9')](findById(_0x34f82b['params']['id']))[_0xa6bb('0x9')](respondWithResult(_0x2db8df,null))[_0xa6bb('0xe')](handleError(_0x2db8df,null));};exports[_0xa6bb('0x20')]=function(_0x28fec0,_0xfe9cca){return respondWithRpcPromise(_0xa6bb('0x21'),_[_0xa6bb('0x19')](_0x28fec0[_0xa6bb('0x17')],_0x28fec0[_0xa6bb('0x1c')]))[_0xa6bb('0x9')](respondWithResult(_0xfe9cca,null))[_0xa6bb('0xe')](handleError(_0xfe9cca,null));};exports[_0xa6bb('0x22')]=function(_0x4e63b8,_0x35d426){return respondWithRpcPromise(_0xa6bb('0x23'),_0x4e63b8[_0xa6bb('0x17')])[_0xa6bb('0x9')](respondWithResult(_0x35d426,null))[_0xa6bb('0xe')](handleError(_0x35d426,null));};exports[_0xa6bb('0x24')]=function(_0x12a747,_0x84a57a){return respondWithRpcPromise(_0xa6bb('0x25'),_[_0xa6bb('0x19')](_0x12a747[_0xa6bb('0x17')],_0x12a747['params']))[_0xa6bb('0x9')](respondWithResult(_0x84a57a,null))[_0xa6bb('0xe')](handleError(_0x84a57a,null));};exports[_0xa6bb('0x26')]=function(_0x2d235c,_0x4d4496){return respondWithRpcPromise(_0xa6bb('0x27'),_['merge'](_0x2d235c['query'],_0x2d235c[_0xa6bb('0x1c')]))['then'](respondWithResult(_0x4d4496,null))[_0xa6bb('0xe')](handleError(_0x4d4496,null));};exports['voiceQueuesChannelRedirect']=function(_0x4d94cb,_0x1bb2d9){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xa6bb('0x19')](_0x4d94cb['query'],_0x4d94cb[_0xa6bb('0x1c')]))[_0xa6bb('0x9')](respondWithResult(_0x1bb2d9,null))[_0xa6bb('0xe')](handleError(_0x1bb2d9,null));};exports[_0xa6bb('0x28')]=function(_0xe47cec,_0x166d92){return respondWithRpcPromise(_0xa6bb('0x29'),_0xe47cec[_0xa6bb('0x17')])[_0xa6bb('0x9')](respondWithResult(_0x166d92,null))[_0xa6bb('0xe')](handleError(_0x166d92,null));};exports[_0xa6bb('0x2a')]=function(_0x30c464,_0x223212){return respondWithRpcPromise(_0xa6bb('0x2b'),_0x30c464[_0xa6bb('0x17')])['then'](respondWithResult(_0x223212,null))[_0xa6bb('0xe')](handleError(_0x223212,null));};exports[_0xa6bb('0x2c')]=function(_0x2e86da,_0x1acf2e){var _0x37fd1a;return respondWithRpcPromise(_0xa6bb('0x2d'),_0x2e86da[_0xa6bb('0x17')])[_0xa6bb('0x9')](function(_0x1a6343){_0x37fd1a=_0x1a6343;return respondWithRpcPromise(_0xa6bb('0x2d'),_0x2e86da[_0xa6bb('0x17')],routingClient);})[_0xa6bb('0x9')](function(_0x567ec9){return _[_0xa6bb('0x19')]({},_0x567ec9,_0x37fd1a);})[_0xa6bb('0x9')](respondWithResult(_0x1acf2e,null))[_0xa6bb('0xe')](handleError(_0x1acf2e,null));};exports['agentCapacity']=function(_0x377e4b,_0x250d54){if(_0x377e4b[_0xa6bb('0x2e')]&&_0x377e4b['body'][_0xa6bb('0x2f')]&&_0x377e4b[_0xa6bb('0x30')]&&_0x377e4b[_0xa6bb('0x30')][_0xa6bb('0x11')]){for(var _0xa12d4f in _0x377e4b[_0xa6bb('0x2e')][_0xa6bb('0x2f')]){if(_0x377e4b['body'][_0xa6bb('0x2f')]['hasOwnProperty'](_0xa12d4f)){db[_0xa6bb('0x31')]['findAll']({'where':{'channel':_0xa12d4f,'membername':_0x377e4b[_0xa6bb('0x30')]['name'],'type':_0xa6bb('0x32'),'exitAt':null,'uniqueid':_0x377e4b[_0xa6bb('0x2e')][_0xa6bb('0x2f')][_0xa12d4f]&&_0x377e4b[_0xa6bb('0x2e')][_0xa6bb('0x2f')][_0xa12d4f][_0xa6bb('0x33')]?{'$notIn':_0x377e4b[_0xa6bb('0x2e')][_0xa6bb('0x2f')][_0xa12d4f]}:{'$ne':null}}})[_0xa6bb('0x9')](function(_0x5dafa3){var _0x2225a6=moment()[_0xa6bb('0x34')](_0xa6bb('0x35'));for(var _0x331108=0x0,_0x6416f1=_0x5dafa3[_0xa6bb('0x33')];_0x331108<_0x6416f1;_0x331108+=0x1){_0x5dafa3[_0x331108]['updateAttributes']({'exitAt':_0x2225a6});}});for(var _0x5d8dd9=0x0;_0x5d8dd9<_0x377e4b['body'][_0xa6bb('0x2f')][_0xa12d4f][_0xa6bb('0x33')];_0x5d8dd9+=0x1){db[_0xa6bb('0x31')][_0xa6bb('0x36')]({'where':{'channel':_0xa12d4f,'membername':_0x377e4b['user']['name'],'type':_0xa6bb('0x32'),'uniqueid':_0x377e4b[_0xa6bb('0x2e')][_0xa6bb('0x2f')][_0xa12d4f][_0x5d8dd9],'exitAt':null},'defaults':{'channel':_0xa12d4f,'membername':_0x377e4b['user'][_0xa6bb('0x11')],'interface':_['isNil'](_0x377e4b[_0xa6bb('0x30')][_0xa6bb('0x37')])?util['format']('SIP/%s',_0x377e4b['user'][_0xa6bb('0x11')]):_0x377e4b[_0xa6bb('0x30')][_0xa6bb('0x37')],'type':_0xa6bb('0x32'),'enterAt':moment()[_0xa6bb('0x34')](_0xa6bb('0x35')),'role':_0xa6bb('0x38'),'internal':_0x377e4b[_0xa6bb('0x30')][_0xa6bb('0x39')],'uniqueid':_0x377e4b[_0xa6bb('0x2e')][_0xa6bb('0x2f')][_0xa12d4f][_0x5d8dd9]}});}}}}return respondWithRpcPromise(_0xa6bb('0x3a'),{'id':_0x377e4b[_0xa6bb('0x1c')]['id'],'capacity':_0x377e4b[_0xa6bb('0x2e')][_0xa6bb('0x3b')]},routingClient)[_0xa6bb('0x9')](respondWithResult(_0x250d54,null))[_0xa6bb('0xe')](handleError(_0x250d54,null));};exports[_0xa6bb('0x3c')]=function(_0x288f6e,_0xd40c84){return respondWithRpcPromise(_0xa6bb('0x3d'),_0x288f6e[_0xa6bb('0x17')])[_0xa6bb('0x9')](respondWithResult(_0xd40c84,null))[_0xa6bb('0xe')](handleError(_0xd40c84,null));};exports[_0xa6bb('0x3e')]=function(_0x69a957,_0x473e3a){return respondWithRpcPromise(_0xa6bb('0x3f'),_0x69a957[_0xa6bb('0x17')])[_0xa6bb('0x9')](respondWithResult(_0x473e3a,null))['catch'](handleError(_0x473e3a,null));};exports['campaigns']=function(_0x20b097,_0x3ec4ba){return respondWithRpcPromise(_0xa6bb('0x40'),_0x20b097[_0xa6bb('0x17')])[_0xa6bb('0x9')](respondWithResult(_0x3ec4ba,null))[_0xa6bb('0xe')](handleError(_0x3ec4ba,null));};exports['chatQueues']=function(_0x2ab912,_0x1b7153){return respondWithRpcPromise('ChatQueues',_0x2ab912['query'],routingClient)[_0xa6bb('0x9')](respondWithResult(_0x1b7153,null))[_0xa6bb('0xe')](handleError(_0x1b7153,null));};exports[_0xa6bb('0x41')]=function(_0x133311,_0x4a16a7){return respondWithRpcPromise(_0xa6bb('0x42'),_0x133311[_0xa6bb('0x17')],routingClient)[_0xa6bb('0x9')](findById(_0x133311[_0xa6bb('0x1c')]['id']))[_0xa6bb('0x9')](respondWithResult(_0x4a16a7,null))[_0xa6bb('0xe')](handleError(_0x4a16a7,null));};exports[_0xa6bb('0x43')]=function(_0x2436a3,_0x4d640b){return respondWithRpcPromise('MailQueues',_0x2436a3[_0xa6bb('0x17')],routingClient)[_0xa6bb('0x9')](respondWithResult(_0x4d640b,null))[_0xa6bb('0xe')](handleError(_0x4d640b,null));};exports[_0xa6bb('0x44')]=function(_0x533d45,_0x38b301){return respondWithRpcPromise('MailQueues',_0x533d45[_0xa6bb('0x17')],routingClient)['then'](findById(_0x533d45[_0xa6bb('0x1c')]['id']))[_0xa6bb('0x9')](respondWithResult(_0x38b301,null))[_0xa6bb('0xe')](handleError(_0x38b301,null));};exports[_0xa6bb('0x45')]=function(_0x4715fd,_0x2c26ac){return respondWithRpcPromise(_0xa6bb('0x46'),_0x4715fd[_0xa6bb('0x17')],mailClient)[_0xa6bb('0x9')](respondWithResult(_0x2c26ac,null))[_0xa6bb('0xe')](handleError(_0x2c26ac,null));};exports[_0xa6bb('0x47')]=function(_0x521951,_0x6a8993){return respondWithRpcPromise(_0xa6bb('0x48'),_0x521951[_0xa6bb('0x17')],routingClient)[_0xa6bb('0x9')](respondWithResult(_0x6a8993,null))[_0xa6bb('0xe')](handleError(_0x6a8993,null));};exports['showOpenchannelQueues']=function(_0x4a9c54,_0x2617c4){return respondWithRpcPromise('OpenchannelQueues',_0x4a9c54[_0xa6bb('0x17')],routingClient)[_0xa6bb('0x9')](findById(_0x4a9c54[_0xa6bb('0x1c')]['id']))[_0xa6bb('0x9')](respondWithResult(_0x2617c4,null))['catch'](handleError(_0x2617c4,null));};exports[_0xa6bb('0x49')]=function(_0x4b4026,_0x434994){return respondWithRpcPromise(_0xa6bb('0x4a'),_0x4b4026[_0xa6bb('0x17')],routingClient)['then'](respondWithResult(_0x434994,null))[_0xa6bb('0xe')](handleError(_0x434994,null));};exports[_0xa6bb('0x4b')]=function(_0x21c4e4,_0x51778e){return respondWithRpcPromise(_0xa6bb('0x4a'),_0x21c4e4[_0xa6bb('0x17')],routingClient)['then'](findById(_0x21c4e4[_0xa6bb('0x1c')]['id']))[_0xa6bb('0x9')](respondWithResult(_0x51778e,null))['catch'](handleError(_0x51778e,null));};exports['faxQueues']=function(_0x23b52f,_0x3f0202){return respondWithRpcPromise(_0xa6bb('0x4c'),_0x23b52f[_0xa6bb('0x17')],routingClient)['then'](respondWithResult(_0x3f0202,null))[_0xa6bb('0xe')](handleError(_0x3f0202,null));};exports[_0xa6bb('0x4d')]=function(_0x1f2bb6,_0x89c9d3){return respondWithRpcPromise(_0xa6bb('0x4c'),_0x1f2bb6[_0xa6bb('0x17')],routingClient)[_0xa6bb('0x9')](findById(_0x1f2bb6[_0xa6bb('0x1c')]['id']))[_0xa6bb('0x9')](respondWithResult(_0x89c9d3,null))['catch'](handleError(_0x89c9d3,null));};exports[_0xa6bb('0x4e')]=function(_0x33cfdb,_0x2186e7){return respondWithRpcPromise('FaxAccounts',_0x33cfdb[_0xa6bb('0x17')])[_0xa6bb('0x9')](respondWithResult(_0x2186e7,null))[_0xa6bb('0xe')](handleError(_0x2186e7,null));};exports[_0xa6bb('0x4f')]=function(_0x1a313c,_0x3fb407){return respondWithRpcPromise(_0xa6bb('0x50'),_0x1a313c[_0xa6bb('0x17')],routingClient)[_0xa6bb('0x9')](respondWithResult(_0x3fb407,null))['catch'](handleError(_0x3fb407,null));};exports[_0xa6bb('0x51')]=function(_0x3366ab,_0x1c5a21){return respondWithRpcPromise(_0xa6bb('0x52'),_0x3366ab[_0xa6bb('0x17')],routingClient)[_0xa6bb('0x9')](respondWithResult(_0x1c5a21,null))[_0xa6bb('0xe')](handleError(_0x1c5a21,null));};exports[_0xa6bb('0x53')]=function(_0x47e2da,_0x3c2091){return respondWithRpcPromise(_0xa6bb('0x54'),_0x47e2da['query'],routingClient)[_0xa6bb('0x9')](respondWithResult(_0x3c2091,null))[_0xa6bb('0xe')](handleError(_0x3c2091,null));};exports['smsQueuesWaitingInteractions']=function(_0x141855,_0x4506e0){return respondWithRpcPromise(_0xa6bb('0x55'),_0x141855[_0xa6bb('0x17')],routingClient)['then'](respondWithResult(_0x4506e0,null))['catch'](handleError(_0x4506e0,null));};exports[_0xa6bb('0x56')]=function(_0x29f32e,_0x2cc2f5){return respondWithRpcPromise(_0xa6bb('0x57'),_0x29f32e['query'],routingClient)[_0xa6bb('0x9')](respondWithResult(_0x2cc2f5,null))[_0xa6bb('0xe')](handleError(_0x2cc2f5,null));};exports['queueNotify']=function(_0x1c0b5f){return function(_0x4feca4,_0x44febd){var _0x4a7edd,_0x49296d;var _0x471d25=_[_0xa6bb('0x58')](_0x1c0b5f);var _0x6e049c=_0x1c0b5f===_0xa6bb('0x59')?_0xa6bb('0x5a'):_0xa6bb('0x5b');return db[_0x471d25+_0xa6bb('0x5c')][_0xa6bb('0x5d')]({'raw':!![],'where':{'id':_0x4feca4[_0xa6bb('0x1c')]['id']}})[_0xa6bb('0x9')](function(_0xc9b0b){if(_[_0xa6bb('0x13')](_0xc9b0b)){throw new Error(_0x471d25+_0xa6bb('0x5e'));}_0x4a7edd=_0xc9b0b;return db[_0x471d25+_0xa6bb('0x5f')][_0xa6bb('0x5d')]({'where':{'id':_0x4feca4['body'][_0xa6bb('0x60')]},'include':[{'model':db[_0x471d25+_0xa6bb('0x61')],'as':_0xa6bb('0x61')},{'model':db[_0x471d25+_0x6e049c],'as':'Account'}]});})[_0xa6bb('0x9')](function(_0x11cc27){if(_[_0xa6bb('0x13')](_0x11cc27)){throw new Error(_0x471d25+_0xa6bb('0x62'));}_0x49296d=_0x11cc27;return _0x11cc27['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xa6bb('0x9')](function(){var _0x274bc0={'uniqueid':_0x1c0b5f+'.'+_0x49296d['id']+'.'+_0x49296d['Interaction']['id'],'FromUserId':_0x4feca4[_0xa6bb('0x30')]['id'],'type':_0xa6bb('0x63')};_0x274bc0[_0x471d25+_0xa6bb('0x64')]=_0x49296d['id'];_0x274bc0[_0x471d25+_0xa6bb('0x65')]=_0x49296d[_0xa6bb('0x61')]['id'];_0x274bc0[_0xa6bb('0x66')+_0x471d25+_0x6e049c+'Id']=_0x49296d[_0xa6bb('0x5b')]['id'];_0x274bc0['To'+_0x471d25+'QueueId']=_0x4a7edd['id'];return db[_0x471d25+'TransferReport'][_0xa6bb('0x67')](_0x274bc0);})['then'](function(){return respondWithRpcPromise(_0xa6bb('0x68'),{'channel':_0x1c0b5f,'interaction':_0x49296d[_0xa6bb('0x61')],'message':_0x49296d,'account':_0x49296d[_0xa6bb('0x5b')],'applications':[{'id':0x0,'priority':0x1,'app':_0xa6bb('0x63'),'appdata':_0x4a7edd[_0xa6bb('0x11')]+','+(_0x49296d[_0xa6bb('0x5b')][_0xa6bb('0x69')]||0x12c),'interval':_0xa6bb('0x6a')}]},routingClient);})[_0xa6bb('0x9')](respondWithResult(_0x44febd,null))[_0xa6bb('0xe')](handleError(_0x44febd,null));};};exports[_0xa6bb('0x6b')]=function(_0x57e5f2,_0x44c126){var _0x36a514,_0x28dc12;if(_[_0xa6bb('0x13')](_0x57e5f2[_0xa6bb('0x2e')][_0xa6bb('0x6c')])){throw new Error(_0xa6bb('0x6d'));}var _0x496fc7=_0x57e5f2[_0xa6bb('0x2e')][_0xa6bb('0x6c')];var _0x4583cf=_[_0xa6bb('0x58')](_0x496fc7);var _0x58d537=_0x496fc7==='chat'?_0xa6bb('0x5a'):'Account';return db[_0xa6bb('0x6e')][_0xa6bb('0x5d')]({'raw':!![],'where':{'id':_0x57e5f2[_0xa6bb('0x1c')]['id'],'role':_0xa6bb('0x38')}})[_0xa6bb('0x9')](function(_0x35815c){if(_[_0xa6bb('0x13')](_0x35815c)){throw new Error('Agent\x20not\x20found');}_0x36a514=_0x35815c;return db[_0x4583cf+_0xa6bb('0x5f')][_0xa6bb('0x5d')]({'where':{'id':_0x57e5f2['body'][_0xa6bb('0x60')]},'include':[{'model':db[_0x4583cf+_0xa6bb('0x61')],'as':'Interaction'},{'model':db[_0x4583cf+_0x58d537],'as':'Account'}]});})[_0xa6bb('0x9')](function(_0x382a8d){if(_[_0xa6bb('0x13')](_0x382a8d)){throw new Error(_0x4583cf+_0xa6bb('0x62'));}_0x28dc12=_0x382a8d;return _0x382a8d[_0xa6bb('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa6bb('0x9')](function(){var _0xd3df92={'uniqueid':_0x496fc7+'.'+_0x28dc12['id']+'.'+_0x28dc12[_0xa6bb('0x61')]['id'],'FromUserId':_0x57e5f2[_0xa6bb('0x30')]['id'],'type':_0xa6bb('0x63'),'ToUserId':_0x36a514['id']};_0xd3df92[_0x4583cf+_0xa6bb('0x64')]=_0x28dc12['id'];_0xd3df92[_0x4583cf+_0xa6bb('0x65')]=_0x28dc12[_0xa6bb('0x61')]['id'];_0xd3df92['From'+_0x4583cf+_0x58d537+'Id']=_0x28dc12[_0xa6bb('0x5b')]['id'];return db[_0x4583cf+_0xa6bb('0x70')][_0xa6bb('0x67')](_0xd3df92);})[_0xa6bb('0x9')](function(){return respondWithRpcPromise(_0xa6bb('0x68'),{'channel':_0x496fc7,'interaction':_0x28dc12[_0xa6bb('0x61')],'message':_0x28dc12,'account':_0x28dc12[_0xa6bb('0x5b')],'applications':[{'id':0x0,'priority':0x1,'app':_0xa6bb('0x38'),'appdata':_0x36a514[_0xa6bb('0x11')]+','+(_0x28dc12[_0xa6bb('0x5b')][_0xa6bb('0x71')]||0x12c),'interval':_0xa6bb('0x6a')}]},routingClient);})[_0xa6bb('0x9')](respondWithResult(_0x44c126,null))[_0xa6bb('0xe')](handleError(_0x44c126,null));};
\ No newline at end of file
index 23cd832..0c2a817 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe2db=['show','get','/:id/run','run','create','delete','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./schedule.controller','isAuthenticated','/:id'];(function(_0x4b1969,_0x1ae50e){var _0x4b53dc=function(_0x3e137c){while(--_0x3e137c){_0x4b1969['push'](_0x4b1969['shift']());}};_0x4b53dc(++_0x1ae50e);}(_0xe2db,0x1b6));var _0xbe2d=function(_0x34833a,_0x43894e){_0x34833a=_0x34833a-0x0;var _0x38b772=_0xe2db[_0x34833a];return _0x38b772;};'use strict';var multer=require(_0xbe2d('0x0'));var util=require(_0xbe2d('0x1'));var path=require(_0xbe2d('0x2'));var timeout=require(_0xbe2d('0x3'));var express=require('express');var router=express[_0xbe2d('0x4')]();var auth=require(_0xbe2d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbe2d('0x6'));var controller=require(_0xbe2d('0x7'));router['get']('/',auth[_0xbe2d('0x8')](),controller['index']);router['get'](_0xbe2d('0x9'),auth['isAuthenticated'](),controller[_0xbe2d('0xa')]);router[_0xbe2d('0xb')](_0xbe2d('0xc'),auth['isAuthenticated'](),controller[_0xbe2d('0xd')]);router['post']('/',auth[_0xbe2d('0x8')](),controller[_0xbe2d('0xe')]);router['put'](_0xbe2d('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xbe2d('0xf')](_0xbe2d('0x9'),auth[_0xbe2d('0x8')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
+var _0xaece=['Router','../../components/interaction/service','./schedule.controller','isAuthenticated','index','get','/:id','show','/:id/run','run','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x67cb7,_0x5e5fe0){var _0x5ce2c1=function(_0x3c3203){while(--_0x3c3203){_0x67cb7['push'](_0x67cb7['shift']());}};_0x5ce2c1(++_0x5e5fe0);}(_0xaece,0xb8));var _0xeaec=function(_0x183546,_0x2f4f6c){_0x183546=_0x183546-0x0;var _0x2ef4db=_0xaece[_0x183546];return _0x2ef4db;};'use strict';var multer=require(_0xeaec('0x0'));var util=require(_0xeaec('0x1'));var path=require(_0xeaec('0x2'));var timeout=require(_0xeaec('0x3'));var express=require(_0xeaec('0x4'));var router=express[_0xeaec('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xeaec('0x6'));var config=require('../../config/environment');var controller=require(_0xeaec('0x7'));router['get']('/',auth[_0xeaec('0x8')](),controller[_0xeaec('0x9')]);router[_0xeaec('0xa')](_0xeaec('0xb'),auth['isAuthenticated'](),controller[_0xeaec('0xc')]);router[_0xeaec('0xa')](_0xeaec('0xd'),auth[_0xeaec('0x8')](),controller[_0xeaec('0xe')]);router['post']('/',auth[_0xeaec('0x8')](),controller[_0xeaec('0xf')]);router[_0xeaec('0x10')](_0xeaec('0xb'),auth[_0xeaec('0x8')](),controller[_0xeaec('0x11')]);router[_0xeaec('0x12')](_0xeaec('0xb'),auth[_0xeaec('0x8')](),controller[_0xeaec('0x13')]);module[_0xeaec('0x14')]=router;
\ No newline at end of file
index 0083e46..923b23b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf6e0=['custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','days','hours','minutes','csv','xlsx'];(function(_0xb819a5,_0x40af38){var _0x27a3a0=function(_0x12d8ef){while(--_0x12d8ef){_0xb819a5['push'](_0xb819a5['shift']());}};_0x27a3a0(++_0x40af38);}(_0xf6e0,0x192));var _0x0f6e=function(_0x473b32,_0x28822d){_0x473b32=_0x473b32-0x0;var _0x1d6698=_0xf6e0[_0x473b32];return _0x1d6698;};'use strict';var Sequelize=require(_0x0f6e('0x0'));module[_0x0f6e('0x1')]={'name':{'type':Sequelize[_0x0f6e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x0f6e('0x2')]},'active':{'type':Sequelize[_0x0f6e('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x0f6e('0x2')],'allowNull':![],'defaultValue':_0x0f6e('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x0f6e('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x0f6e('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x0f6e('0x7')](_0x0f6e('0x8'),_0x0f6e('0x9'),_0x0f6e('0xa'),'weeks',_0x0f6e('0xb'),_0x0f6e('0xc'),_0x0f6e('0xd')),'allowNull':![],'defaultValue':_0x0f6e('0xb')},'output':{'type':Sequelize[_0x0f6e('0x7')](_0x0f6e('0xe'),'pdf',_0x0f6e('0xf')),'allowNull':![],'defaultValue':_0x0f6e('0xe')},'type':{'type':Sequelize[_0x0f6e('0x7')](_0x0f6e('0x10'),_0x0f6e('0x11')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x0f6e('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x0f6e('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x0f6e('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x0f6e('0x3')],'defaultValue':!![]}};
\ No newline at end of file
+var _0x1c35=['custom','default','TEXT','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','months','hours','minutes','days','csv','xlsx'];(function(_0x4329e5,_0x406525){var _0x4350cb=function(_0x2fd2ba){while(--_0x2fd2ba){_0x4329e5['push'](_0x4329e5['shift']());}};_0x4350cb(++_0x406525);}(_0x1c35,0x69));var _0x51c3=function(_0x3d8fbc,_0x5f363a){_0x3d8fbc=_0x3d8fbc-0x0;var _0xd4281c=_0x1c35[_0x3d8fbc];return _0xd4281c;};'use strict';var Sequelize=require(_0x51c3('0x0'));module['exports']={'name':{'type':Sequelize[_0x51c3('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x51c3('0x1')]},'active':{'type':Sequelize[_0x51c3('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x51c3('0x1')],'allowNull':![],'defaultValue':_0x51c3('0x3')},'startAt':{'type':Sequelize[_0x51c3('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x51c3('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x51c3('0x6')](_0x51c3('0x7'),'quarters',_0x51c3('0x8'),'weeks','days',_0x51c3('0x9'),_0x51c3('0xa')),'allowNull':![],'defaultValue':_0x51c3('0xb')},'output':{'type':Sequelize[_0x51c3('0x6')](_0x51c3('0xc'),'pdf',_0x51c3('0xd')),'allowNull':![],'defaultValue':_0x51c3('0xc')},'type':{'type':Sequelize['ENUM'](_0x51c3('0xe'),_0x51c3('0xf')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x51c3('0x1')]},'cc':{'type':Sequelize[_0x51c3('0x10')]},'bcc':{'type':Sequelize[_0x51c3('0x10')]},'sendIfEmpty':{'type':Sequelize[_0x51c3('0x2')],'defaultValue':!![]}};
\ No newline at end of file
index fa5d65a..715b609 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbd21=['error','stack','name','send','index','Schedule','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','map','VIRTUAL','field','filter','merge','options','include','findAll','show','params','keys','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','limit','set','json','apply','reject','save','update','then','get','Scheduler','UserProfileResource','destroy'];(function(_0x55c4db,_0x293304){var _0x58ba84=function(_0xfc9c76){while(--_0xfc9c76){_0x55c4db['push'](_0x55c4db['shift']());}};_0x58ba84(++_0x293304);}(_0xbd21,0xd7));var _0x1bd2=function(_0x4a8342,_0x23f3a6){_0x4a8342=_0x4a8342-0x0;var _0x444b96=_0xbd21[_0x4a8342];return _0x444b96;};'use strict';var pdf=require(_0x1bd2('0x0'));var emlformat=require(_0x1bd2('0x1'));var rimraf=require(_0x1bd2('0x2'));var zipdir=require(_0x1bd2('0x3'));var jsonpatch=require(_0x1bd2('0x4'));var rp=require(_0x1bd2('0x5'));var moment=require(_0x1bd2('0x6'));var BPromise=require(_0x1bd2('0x7'));var Mustache=require(_0x1bd2('0x8'));var util=require('util');var path=require(_0x1bd2('0x9'));var sox=require(_0x1bd2('0xa'));var csv=require('to-csv');var ejs=require(_0x1bd2('0xb'));var fs=require('fs');var _=require(_0x1bd2('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1bd2('0xd'));var deskjs=require(_0x1bd2('0xe'));var toCsv=require(_0x1bd2('0xf'));var querystring=require(_0x1bd2('0x10'));var Papa=require(_0x1bd2('0x11'));var authService=require(_0x1bd2('0x12'));var hardwareService=require(_0x1bd2('0x13'));var Redis=require(_0x1bd2('0x14'));var qs=require(_0x1bd2('0x15'));var logger=require(_0x1bd2('0x16'))(_0x1bd2('0x17'));var utils=require(_0x1bd2('0x18'));var config=require(_0x1bd2('0x19'));var db=require(_0x1bd2('0x1a'))['db'];function respondWithStatusCode(_0x17772a,_0x4ba1b0){_0x4ba1b0=_0x4ba1b0||0xcc;return function(_0x3f9868){if(_0x3f9868){return _0x17772a[_0x1bd2('0x1b')](_0x4ba1b0);}return _0x17772a[_0x1bd2('0x1c')](_0x4ba1b0)[_0x1bd2('0x1d')]();};}function respondWithResult(_0x386013,_0x463402){_0x463402=_0x463402||0xc8;return function(_0x401555){if(_0x401555){return _0x386013[_0x1bd2('0x1c')](_0x463402)['json'](_0x401555);}};}function respondWithFilteredResult(_0x32bbda,_0x274345){return function(_0x29ca9f){if(_0x29ca9f){var _0x5db1ad=_0x29ca9f[_0x1bd2('0x1e')],_0x3abe3f=_0x274345['offset'],_0x11fe66=_0x274345['offset']+_0x274345[_0x1bd2('0x1f')],_0x2039b1;if(_0x11fe66>=_0x5db1ad){_0x11fe66=_0x5db1ad;_0x2039b1=0xc8;}else{_0x2039b1=0xce;}_0x32bbda[_0x1bd2('0x1c')](_0x2039b1);return _0x32bbda[_0x1bd2('0x20')]('Content-Range',_0x3abe3f+'-'+_0x11fe66+'/'+_0x5db1ad)[_0x1bd2('0x21')](_0x29ca9f);}return null;};}function patchUpdates(_0x299ee9){return function(_0x4a14e1){try{jsonpatch[_0x1bd2('0x22')](_0x4a14e1,_0x299ee9,!![]);}catch(_0x3b679a){return BPromise[_0x1bd2('0x23')](_0x3b679a);}return _0x4a14e1[_0x1bd2('0x24')]();};}function saveUpdates(_0x45d806,_0x351ea8){return function(_0x331362){if(_0x331362){return _0x331362[_0x1bd2('0x25')](_0x45d806)[_0x1bd2('0x26')](function(_0x2f0a3c){return _0x2f0a3c;});}return null;};}function removeEntity(_0x2c81ad,_0x409cc2){return function(_0x3727c7){if(_0x3727c7){return _0x3727c7['destroy']()[_0x1bd2('0x26')](function(){var _0x40d8f7=_0x3727c7[_0x1bd2('0x27')]({'plain':!![]});var _0x4b020a=_0x1bd2('0x28');return db[_0x1bd2('0x29')][_0x1bd2('0x2a')]({'where':{'type':_0x4b020a,'resourceId':_0x40d8f7['id']}})[_0x1bd2('0x26')](function(){return _0x3727c7;});})[_0x1bd2('0x26')](function(){_0x2c81ad[_0x1bd2('0x1c')](0xcc)[_0x1bd2('0x1d')]();});}};}function handleEntityNotFound(_0x6de324,_0x1686b5){return function(_0x20ae5a){if(!_0x20ae5a){_0x6de324[_0x1bd2('0x1b')](0x194);}return _0x20ae5a;};}function handleError(_0x19cc49,_0x3a7aae){_0x3a7aae=_0x3a7aae||0x1f4;return function(_0x2c2d8b){logger[_0x1bd2('0x2b')](_0x2c2d8b[_0x1bd2('0x2c')]);if(_0x2c2d8b[_0x1bd2('0x2d')]){delete _0x2c2d8b[_0x1bd2('0x2d')];}_0x19cc49[_0x1bd2('0x1c')](_0x3a7aae)[_0x1bd2('0x2e')](_0x2c2d8b);};}exports[_0x1bd2('0x2f')]=function(_0x36cc86,_0xd0b9bb){var _0x44fcf5={},_0x1bb1b8={},_0x57a083={'count':0x0,'rows':[]};var _0x5166ce=db[_0x1bd2('0x30')][_0x1bd2('0x31')];_0x1bb1b8[_0x1bd2('0x32')]=_['keys'](_0x5166ce);_0x1bb1b8[_0x1bd2('0x33')]=_['keys'](_0x36cc86[_0x1bd2('0x33')]);_0x1bb1b8[_0x1bd2('0x34')]=_[_0x1bd2('0x35')](_0x1bb1b8[_0x1bd2('0x32')],_0x1bb1b8['query']);_0x44fcf5[_0x1bd2('0x36')]=_[_0x1bd2('0x35')](_0x1bb1b8[_0x1bd2('0x32')],qs[_0x1bd2('0x37')](_0x36cc86['query'][_0x1bd2('0x37')]));_0x44fcf5[_0x1bd2('0x36')]=_0x44fcf5[_0x1bd2('0x36')][_0x1bd2('0x38')]?_0x44fcf5[_0x1bd2('0x36')]:_0x1bb1b8['model'];if(!_0x36cc86[_0x1bd2('0x33')][_0x1bd2('0x39')](_0x1bd2('0x3a'))){_0x44fcf5[_0x1bd2('0x1f')]=qs['limit'](_0x36cc86['query']['limit']);_0x44fcf5[_0x1bd2('0x3b')]=qs['offset'](_0x36cc86[_0x1bd2('0x33')][_0x1bd2('0x3b')]);}_0x44fcf5[_0x1bd2('0x3c')]=qs[_0x1bd2('0x3d')](_0x36cc86[_0x1bd2('0x33')][_0x1bd2('0x3d')]);_0x44fcf5[_0x1bd2('0x3e')]=qs['filters'](_['pick'](_0x36cc86[_0x1bd2('0x33')],_0x1bb1b8[_0x1bd2('0x34')]));if(_0x36cc86['query']['filter']){_0x44fcf5[_0x1bd2('0x3e')]=_['merge'](_0x44fcf5[_0x1bd2('0x3e')],{'$or':_[_0x1bd2('0x3f')](_0x5166ce,function(_0x460fee){if(_0x460fee['type']['key']!==_0x1bd2('0x40')){var _0x14607c={};_0x14607c[_0x460fee[_0x1bd2('0x41')]]={'$like':'%'+_0x36cc86[_0x1bd2('0x33')][_0x1bd2('0x42')]+'%'};return _0x14607c;}})});}_0x44fcf5=_[_0x1bd2('0x43')]({},_0x44fcf5,_0x36cc86[_0x1bd2('0x44')]);var _0x31302c={'where':_0x44fcf5[_0x1bd2('0x3e')]};return db[_0x1bd2('0x30')]['count'](_0x31302c)['then'](function(_0x339fee){_0x57a083[_0x1bd2('0x1e')]=_0x339fee;if(_0x36cc86[_0x1bd2('0x33')]['includeAll']){_0x44fcf5[_0x1bd2('0x45')]=[{'all':!![]}];}return db['Schedule'][_0x1bd2('0x46')](_0x44fcf5);})[_0x1bd2('0x26')](function(_0x47353f){_0x57a083['rows']=_0x47353f;return _0x57a083;})[_0x1bd2('0x26')](respondWithFilteredResult(_0xd0b9bb,_0x44fcf5))['catch'](handleError(_0xd0b9bb,null));};exports[_0x1bd2('0x47')]=function(_0x58c883,_0x35a553){var _0x1a7587={'raw':![],'where':{'id':_0x58c883[_0x1bd2('0x48')]['id']}},_0x1530f3={};_0x1530f3[_0x1bd2('0x32')]=_[_0x1bd2('0x49')](db['Schedule'][_0x1bd2('0x31')]);_0x1530f3[_0x1bd2('0x33')]=_[_0x1bd2('0x49')](_0x58c883[_0x1bd2('0x33')]);_0x1530f3[_0x1bd2('0x34')]=_['intersection'](_0x1530f3['model'],_0x1530f3[_0x1bd2('0x33')]);_0x1a7587[_0x1bd2('0x36')]=_[_0x1bd2('0x35')](_0x1530f3['model'],qs['fields'](_0x58c883[_0x1bd2('0x33')]['fields']));_0x1a7587[_0x1bd2('0x36')]=_0x1a7587[_0x1bd2('0x36')][_0x1bd2('0x38')]?_0x1a7587[_0x1bd2('0x36')]:_0x1530f3[_0x1bd2('0x32')];if(_0x58c883['query'][_0x1bd2('0x4a')]){_0x1a7587[_0x1bd2('0x45')]=[{'all':!![]}];}_0x1a7587=_[_0x1bd2('0x43')]({},_0x1a7587,_0x58c883['options']);return db[_0x1bd2('0x30')][_0x1bd2('0x4b')](_0x1a7587)[_0x1bd2('0x26')](handleEntityNotFound(_0x35a553,null))['then'](respondWithResult(_0x35a553,null))[_0x1bd2('0x4c')](handleError(_0x35a553,null));};exports[_0x1bd2('0x4d')]=function(_0x2e57b5,_0x69621){return db['Schedule']['create'](_0x2e57b5[_0x1bd2('0x4e')],{})[_0x1bd2('0x26')](function(_0x5b48d2){var _0x24831e=_0x2e57b5['user'][_0x1bd2('0x27')]({'plain':!![]});if(!_0x24831e)throw new Error(_0x1bd2('0x4f'));if(_0x24831e[_0x1bd2('0x50')]===_0x1bd2('0x51')){var _0x3ab85b=_0x5b48d2[_0x1bd2('0x27')]({'plain':!![]});var _0x2993ce='Scheduler';return db['UserProfileSection']['find']({'where':{'name':_0x2993ce,'userProfileId':_0x24831e[_0x1bd2('0x52')]},'raw':!![]})[_0x1bd2('0x26')](function(_0x4b17ab){if(_0x4b17ab&&_0x4b17ab[_0x1bd2('0x53')]===0x0){return db['UserProfileResource'][_0x1bd2('0x4d')]({'name':_0x3ab85b[_0x1bd2('0x2d')],'resourceId':_0x3ab85b['id'],'type':_0x4b17ab[_0x1bd2('0x2d')],'sectionId':_0x4b17ab['id']},{})['then'](function(){return _0x5b48d2;});}else{return _0x5b48d2;}})[_0x1bd2('0x4c')](function(_0x461760){logger[_0x1bd2('0x2b')](_0x1bd2('0x54'),_0x461760);throw _0x461760;});}return _0x5b48d2;})['then'](respondWithResult(_0x69621,0xc9))[_0x1bd2('0x4c')](handleError(_0x69621,null));};exports['update']=function(_0x1ff988,_0x5d7d13){if(_0x1ff988[_0x1bd2('0x4e')]['id']){delete _0x1ff988['body']['id'];}return db[_0x1bd2('0x30')][_0x1bd2('0x4b')]({'where':{'id':_0x1ff988[_0x1bd2('0x48')]['id']}})[_0x1bd2('0x26')](handleEntityNotFound(_0x5d7d13,null))[_0x1bd2('0x26')](saveUpdates(_0x1ff988[_0x1bd2('0x4e')],null))[_0x1bd2('0x26')](respondWithResult(_0x5d7d13,null))['catch'](handleError(_0x5d7d13,null));};exports[_0x1bd2('0x2a')]=function(_0xef9661,_0x464f89){return db[_0x1bd2('0x30')]['find']({'where':{'id':_0xef9661[_0x1bd2('0x48')]['id']}})[_0x1bd2('0x26')](handleEntityNotFound(_0x464f89,null))[_0x1bd2('0x26')](removeEntity(_0x464f89,null))[_0x1bd2('0x4c')](handleError(_0x464f89,null));};exports[_0x1bd2('0x55')]=function(_0x5c468b,_0x143fc8,_0x15bf4a){var _0x2b89af=require('../../config/schedule');return db[_0x1bd2('0x30')][_0x1bd2('0x4b')]({'where':{'id':_0x5c468b[_0x1bd2('0x48')]['id']},'raw':!![]})[_0x1bd2('0x26')](handleEntityNotFound(_0x143fc8,null))[_0x1bd2('0x26')](function(){_0x2b89af[_0x1bd2('0x55')](_0x5c468b['params']['id']);})[_0x1bd2('0x26')](respondWithStatusCode(_0x143fc8,null))[_0x1bd2('0x4c')](handleError(_0x143fc8,null));};
\ No newline at end of file
+var _0x916f=['name','send','index','Schedule','rawAttributes','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','fast-json-patch','request-promise','moment','util','path','to-csv','squel','crypto','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','get','Scheduler','UserProfileResource','error','stack'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x916f,0xcd));var _0xf916=function(_0x292419,_0x298ef2){_0x292419=_0x292419-0x0;var _0x20dc90=_0x916f[_0x292419];return _0x20dc90;};'use strict';var pdf=require(_0xf916('0x0'));var emlformat=require(_0xf916('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf916('0x2'));var rp=require(_0xf916('0x3'));var moment=require(_0xf916('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf916('0x5'));var path=require(_0xf916('0x6'));var sox=require('sox');var csv=require(_0xf916('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf916('0x8'));var crypto=require(_0xf916('0x9'));var jsforce=require(_0xf916('0xa'));var deskjs=require(_0xf916('0xb'));var toCsv=require(_0xf916('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0xf916('0xc'));var hardwareService=require(_0xf916('0xd'));var Redis=require(_0xf916('0xe'));var qs=require(_0xf916('0xf'));var logger=require(_0xf916('0x10'))('api');var utils=require(_0xf916('0x11'));var config=require(_0xf916('0x12'));var db=require(_0xf916('0x13'))['db'];function respondWithStatusCode(_0x200f4b,_0x4f8cf0){_0x4f8cf0=_0x4f8cf0||0xcc;return function(_0x839d26){if(_0x839d26){return _0x200f4b[_0xf916('0x14')](_0x4f8cf0);}return _0x200f4b[_0xf916('0x15')](_0x4f8cf0)[_0xf916('0x16')]();};}function respondWithResult(_0x3439a4,_0x3b19c6){_0x3b19c6=_0x3b19c6||0xc8;return function(_0x240294){if(_0x240294){return _0x3439a4['status'](_0x3b19c6)[_0xf916('0x17')](_0x240294);}};}function respondWithFilteredResult(_0x4f1541,_0x56fc11){return function(_0x1c8f0d){if(_0x1c8f0d){var _0x379037=_0x1c8f0d[_0xf916('0x18')],_0x33d576=_0x56fc11['offset'],_0x595730=_0x56fc11[_0xf916('0x19')]+_0x56fc11[_0xf916('0x1a')],_0x3b0c1d;if(_0x595730>=_0x379037){_0x595730=_0x379037;_0x3b0c1d=0xc8;}else{_0x3b0c1d=0xce;}_0x4f1541['status'](_0x3b0c1d);return _0x4f1541['set'](_0xf916('0x1b'),_0x33d576+'-'+_0x595730+'/'+_0x379037)['json'](_0x1c8f0d);}return null;};}function patchUpdates(_0x18224e){return function(_0x199661){try{jsonpatch[_0xf916('0x1c')](_0x199661,_0x18224e,!![]);}catch(_0x2c51cb){return BPromise[_0xf916('0x1d')](_0x2c51cb);}return _0x199661['save']();};}function saveUpdates(_0x2529e4,_0x351860){return function(_0x321164){if(_0x321164){return _0x321164[_0xf916('0x1e')](_0x2529e4)[_0xf916('0x1f')](function(_0x37bce1){return _0x37bce1;});}return null;};}function removeEntity(_0x53e42e,_0x14c4c4){return function(_0x34fc14){if(_0x34fc14){return _0x34fc14[_0xf916('0x20')]()[_0xf916('0x1f')](function(){var _0x3ee469=_0x34fc14[_0xf916('0x21')]({'plain':!![]});var _0x1821d9=_0xf916('0x22');return db[_0xf916('0x23')][_0xf916('0x20')]({'where':{'type':_0x1821d9,'resourceId':_0x3ee469['id']}})[_0xf916('0x1f')](function(){return _0x34fc14;});})[_0xf916('0x1f')](function(){_0x53e42e[_0xf916('0x15')](0xcc)[_0xf916('0x16')]();});}};}function handleEntityNotFound(_0x4f355d,_0x318892){return function(_0x40e508){if(!_0x40e508){_0x4f355d['sendStatus'](0x194);}return _0x40e508;};}function handleError(_0x47cf81,_0x1a1c1f){_0x1a1c1f=_0x1a1c1f||0x1f4;return function(_0x3a2d02){logger[_0xf916('0x24')](_0x3a2d02[_0xf916('0x25')]);if(_0x3a2d02[_0xf916('0x26')]){delete _0x3a2d02[_0xf916('0x26')];}_0x47cf81[_0xf916('0x15')](_0x1a1c1f)[_0xf916('0x27')](_0x3a2d02);};}exports[_0xf916('0x28')]=function(_0xde2a4e,_0x1df65f){var _0x1f366c={},_0x1d8fdf={},_0x44cfc1={'count':0x0,'rows':[]};var _0x17b4fa=db[_0xf916('0x29')][_0xf916('0x2a')];_0x1d8fdf[_0xf916('0x2b')]=_[_0xf916('0x2c')](_0x17b4fa);_0x1d8fdf['query']=_[_0xf916('0x2c')](_0xde2a4e['query']);_0x1d8fdf[_0xf916('0x2d')]=_[_0xf916('0x2e')](_0x1d8fdf['model'],_0x1d8fdf[_0xf916('0x2f')]);_0x1f366c[_0xf916('0x30')]=_[_0xf916('0x2e')](_0x1d8fdf[_0xf916('0x2b')],qs[_0xf916('0x31')](_0xde2a4e[_0xf916('0x2f')][_0xf916('0x31')]));_0x1f366c['attributes']=_0x1f366c[_0xf916('0x30')][_0xf916('0x32')]?_0x1f366c['attributes']:_0x1d8fdf['model'];if(!_0xde2a4e['query'][_0xf916('0x33')](_0xf916('0x34'))){_0x1f366c[_0xf916('0x1a')]=qs[_0xf916('0x1a')](_0xde2a4e['query'][_0xf916('0x1a')]);_0x1f366c[_0xf916('0x19')]=qs[_0xf916('0x19')](_0xde2a4e[_0xf916('0x2f')][_0xf916('0x19')]);}_0x1f366c[_0xf916('0x35')]=qs['sort'](_0xde2a4e[_0xf916('0x2f')][_0xf916('0x36')]);_0x1f366c[_0xf916('0x37')]=qs[_0xf916('0x2d')](_[_0xf916('0x38')](_0xde2a4e[_0xf916('0x2f')],_0x1d8fdf['filters']));if(_0xde2a4e[_0xf916('0x2f')][_0xf916('0x39')]){_0x1f366c[_0xf916('0x37')]=_[_0xf916('0x3a')](_0x1f366c['where'],{'$or':_[_0xf916('0x3b')](_0x17b4fa,function(_0x2451ad){if(_0x2451ad[_0xf916('0x3c')][_0xf916('0x3d')]!==_0xf916('0x3e')){var _0x279594={};_0x279594[_0x2451ad[_0xf916('0x3f')]]={'$like':'%'+_0xde2a4e[_0xf916('0x2f')]['filter']+'%'};return _0x279594;}})});}_0x1f366c=_[_0xf916('0x3a')]({},_0x1f366c,_0xde2a4e[_0xf916('0x40')]);var _0x1a18b4={'where':_0x1f366c[_0xf916('0x37')]};return db['Schedule']['count'](_0x1a18b4)[_0xf916('0x1f')](function(_0x288c01){_0x44cfc1['count']=_0x288c01;if(_0xde2a4e[_0xf916('0x2f')][_0xf916('0x41')]){_0x1f366c[_0xf916('0x42')]=[{'all':!![]}];}return db[_0xf916('0x29')][_0xf916('0x43')](_0x1f366c);})[_0xf916('0x1f')](function(_0x42fdd3){_0x44cfc1[_0xf916('0x44')]=_0x42fdd3;return _0x44cfc1;})['then'](respondWithFilteredResult(_0x1df65f,_0x1f366c))['catch'](handleError(_0x1df65f,null));};exports['show']=function(_0x422fb7,_0x7eef2b){var _0x3a4b81={'raw':![],'where':{'id':_0x422fb7[_0xf916('0x45')]['id']}},_0x32aefc={};_0x32aefc[_0xf916('0x2b')]=_['keys'](db[_0xf916('0x29')][_0xf916('0x2a')]);_0x32aefc[_0xf916('0x2f')]=_['keys'](_0x422fb7[_0xf916('0x2f')]);_0x32aefc[_0xf916('0x2d')]=_[_0xf916('0x2e')](_0x32aefc[_0xf916('0x2b')],_0x32aefc[_0xf916('0x2f')]);_0x3a4b81[_0xf916('0x30')]=_[_0xf916('0x2e')](_0x32aefc['model'],qs[_0xf916('0x31')](_0x422fb7['query'][_0xf916('0x31')]));_0x3a4b81[_0xf916('0x30')]=_0x3a4b81[_0xf916('0x30')][_0xf916('0x32')]?_0x3a4b81[_0xf916('0x30')]:_0x32aefc[_0xf916('0x2b')];if(_0x422fb7[_0xf916('0x2f')][_0xf916('0x41')]){_0x3a4b81[_0xf916('0x42')]=[{'all':!![]}];}_0x3a4b81=_[_0xf916('0x3a')]({},_0x3a4b81,_0x422fb7[_0xf916('0x40')]);return db[_0xf916('0x29')][_0xf916('0x46')](_0x3a4b81)['then'](handleEntityNotFound(_0x7eef2b,null))[_0xf916('0x1f')](respondWithResult(_0x7eef2b,null))['catch'](handleError(_0x7eef2b,null));};exports[_0xf916('0x47')]=function(_0x15a262,_0x484d0b){return db[_0xf916('0x29')][_0xf916('0x47')](_0x15a262[_0xf916('0x48')],{})['then'](function(_0x1888ff){var _0x1e6ba7=_0x15a262[_0xf916('0x49')][_0xf916('0x21')]({'plain':!![]});if(!_0x1e6ba7)throw new Error(_0xf916('0x4a'));if(_0x1e6ba7[_0xf916('0x4b')]===_0xf916('0x49')){var _0x1dc3b3=_0x1888ff['get']({'plain':!![]});var _0xad08c8=_0xf916('0x22');return db[_0xf916('0x4c')][_0xf916('0x46')]({'where':{'name':_0xad08c8,'userProfileId':_0x1e6ba7[_0xf916('0x4d')]},'raw':!![]})[_0xf916('0x1f')](function(_0x52693e){if(_0x52693e&&_0x52693e[_0xf916('0x4e')]===0x0){return db['UserProfileResource'][_0xf916('0x47')]({'name':_0x1dc3b3[_0xf916('0x26')],'resourceId':_0x1dc3b3['id'],'type':_0x52693e[_0xf916('0x26')],'sectionId':_0x52693e['id']},{})['then'](function(){return _0x1888ff;});}else{return _0x1888ff;}})[_0xf916('0x4f')](function(_0x50492b){logger['error'](_0xf916('0x50'),_0x50492b);throw _0x50492b;});}return _0x1888ff;})[_0xf916('0x1f')](respondWithResult(_0x484d0b,0xc9))[_0xf916('0x4f')](handleError(_0x484d0b,null));};exports[_0xf916('0x1e')]=function(_0x2c809f,_0x1cd3f5){if(_0x2c809f[_0xf916('0x48')]['id']){delete _0x2c809f['body']['id'];}return db['Schedule'][_0xf916('0x46')]({'where':{'id':_0x2c809f[_0xf916('0x45')]['id']}})['then'](handleEntityNotFound(_0x1cd3f5,null))['then'](saveUpdates(_0x2c809f[_0xf916('0x48')],null))[_0xf916('0x1f')](respondWithResult(_0x1cd3f5,null))[_0xf916('0x4f')](handleError(_0x1cd3f5,null));};exports[_0xf916('0x20')]=function(_0x46f0ff,_0x105f3b){return db[_0xf916('0x29')]['find']({'where':{'id':_0x46f0ff['params']['id']}})[_0xf916('0x1f')](handleEntityNotFound(_0x105f3b,null))[_0xf916('0x1f')](removeEntity(_0x105f3b,null))[_0xf916('0x4f')](handleError(_0x105f3b,null));};exports['run']=function(_0x20d402,_0x4d7d97,_0x43addf){var _0x357cb2=require('../../config/schedule');return db[_0xf916('0x29')][_0xf916('0x46')]({'where':{'id':_0x20d402[_0xf916('0x45')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4d7d97,null))['then'](function(){_0x357cb2['run'](_0x20d402['params']['id']);})[_0xf916('0x1f')](respondWithStatusCode(_0x4d7d97,null))[_0xf916('0x4f')](handleError(_0x4d7d97,null));};
\ No newline at end of file
index e6b72ae..10c21d5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf58d=['./schedule.attributes','exports','Schedule','tools_schedules','lodash','moment','request-promise'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xf58d,0xd6));var _0xdf58=function(_0xf1b947,_0x8fed91){_0xf1b947=_0xf1b947-0x0;var _0x50bb78=_0xf58d[_0xf1b947];return _0x50bb78;};'use strict';var _=require(_0xdf58('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xdf58('0x1'));var BPromise=require('bluebird');var rp=require(_0xdf58('0x2'));var attributes=require(_0xdf58('0x3'));module[_0xdf58('0x4')]=function(_0x48e2bd,_0x271a19){return _0x48e2bd['define'](_0xdf58('0x5'),attributes,{'tableName':_0xdf58('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x287c=['api','moment','bluebird','request-promise','./schedule.attributes','define','Schedule','util'];(function(_0x555488,_0x242026){var _0x3c6772=function(_0x3d0682){while(--_0x3d0682){_0x555488['push'](_0x555488['shift']());}};_0x3c6772(++_0x242026);}(_0x287c,0x1bf));var _0xc287=function(_0x22e13d,_0x1472d2){_0x22e13d=_0x22e13d-0x0;var _0x555726=_0x287c[_0x22e13d];return _0x555726;};'use strict';var _=require('lodash');var util=require(_0xc287('0x0'));var logger=require('../../config/logger')(_0xc287('0x1'));var moment=require(_0xc287('0x2'));var BPromise=require(_0xc287('0x3'));var rp=require(_0xc287('0x4'));var attributes=require(_0xc287('0x5'));module['exports']=function(_0x26a00c,_0x2ccb82){return _0x26a00c[_0xc287('0x6')](_0xc287('0x7'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 3ed6a12..c9a5f60 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3e58=['message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','Schedule,\x20%s,\x20%s'];(function(_0x37e97f,_0x50191f){var _0x340877=function(_0x48425e){while(--_0x48425e){_0x37e97f['push'](_0x37e97f['shift']());}};_0x340877(++_0x50191f);}(_0x3e58,0x17c));var _0x83e5=function(_0x59c2cb,_0x671ebb){_0x59c2cb=_0x59c2cb-0x0;var _0x4d2910=_0x3e58[_0x59c2cb];return _0x4d2910;};'use strict';var _=require('lodash');var util=require(_0x83e5('0x0'));var moment=require('moment');var BPromise=require(_0x83e5('0x1'));var rs=require(_0x83e5('0x2'));var fs=require('fs');var Redis=require(_0x83e5('0x3'));var db=require(_0x83e5('0x4'))['db'];var utils=require(_0x83e5('0x5'));var logger=require(_0x83e5('0x6'))(_0x83e5('0x7'));var config=require('../../config/environment');var jayson=require(_0x83e5('0x8'));var client=jayson[_0x83e5('0x9')][_0x83e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a5121,_0x3b2a8e,_0x4e5ef1){return new BPromise(function(_0xc72af1,_0x4e0a7a){return client[_0x83e5('0xb')](_0x5a5121,_0x4e5ef1)['then'](function(_0x6acc18){logger[_0x83e5('0xc')]('Schedule,\x20%s,\x20%s',_0x3b2a8e,_0x83e5('0xd'));logger['debug'](_0x83e5('0xe'),_0x3b2a8e,_0x83e5('0xd'),JSON[_0x83e5('0xf')](_0x6acc18));if(_0x6acc18[_0x83e5('0x10')]){if(_0x6acc18[_0x83e5('0x10')][_0x83e5('0x11')]===0x1f4){logger[_0x83e5('0x10')](_0x83e5('0x12'),_0x3b2a8e,_0x6acc18[_0x83e5('0x10')][_0x83e5('0x13')]);return _0x4e0a7a(_0x6acc18[_0x83e5('0x10')][_0x83e5('0x13')]);}logger[_0x83e5('0x10')](_0x83e5('0x12'),_0x3b2a8e,_0x6acc18[_0x83e5('0x10')][_0x83e5('0x13')]);return _0xc72af1(_0x6acc18[_0x83e5('0x10')][_0x83e5('0x13')]);}else{logger[_0x83e5('0xc')](_0x83e5('0x12'),_0x3b2a8e,'request\x20sent');_0xc72af1(_0x6acc18['result'][_0x83e5('0x13')]);}})[_0x83e5('0x14')](function(_0xb3b21a){logger['error']('Schedule,\x20%s,\x20%s',_0x3b2a8e,_0xb3b21a);_0x4e0a7a(_0xb3b21a);});});}
\ No newline at end of file
+var _0x7646=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird'];(function(_0xca115,_0x3bc5ae){var _0x405361=function(_0x3a5856){while(--_0x3a5856){_0xca115['push'](_0xca115['shift']());}};_0x405361(++_0x3bc5ae);}(_0x7646,0x183));var _0x6764=function(_0x2257d3,_0x5960ec){_0x2257d3=_0x2257d3-0x0;var _0x45933d=_0x7646[_0x2257d3];return _0x45933d;};'use strict';var _=require(_0x6764('0x0'));var util=require(_0x6764('0x1'));var moment=require(_0x6764('0x2'));var BPromise=require(_0x6764('0x3'));var rs=require(_0x6764('0x4'));var fs=require('fs');var Redis=require(_0x6764('0x5'));var db=require(_0x6764('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6764('0x7'))(_0x6764('0x8'));var config=require(_0x6764('0x9'));var jayson=require(_0x6764('0xa'));var client=jayson[_0x6764('0xb')][_0x6764('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb220c0,_0x206c70,_0x3d247e){return new BPromise(function(_0x1e4598,_0x95a392){return client[_0x6764('0xd')](_0xb220c0,_0x3d247e)[_0x6764('0xe')](function(_0x7eb94c){logger[_0x6764('0xf')](_0x6764('0x10'),_0x206c70,_0x6764('0x11'));logger[_0x6764('0x12')](_0x6764('0x13'),_0x206c70,_0x6764('0x11'),JSON[_0x6764('0x14')](_0x7eb94c));if(_0x7eb94c[_0x6764('0x15')]){if(_0x7eb94c[_0x6764('0x15')]['code']===0x1f4){logger[_0x6764('0x15')](_0x6764('0x10'),_0x206c70,_0x7eb94c[_0x6764('0x15')]['message']);return _0x95a392(_0x7eb94c[_0x6764('0x15')][_0x6764('0x16')]);}logger[_0x6764('0x15')]('Schedule,\x20%s,\x20%s',_0x206c70,_0x7eb94c[_0x6764('0x15')]['message']);return _0x1e4598(_0x7eb94c[_0x6764('0x15')][_0x6764('0x16')]);}else{logger['info']('Schedule,\x20%s,\x20%s',_0x206c70,'request\x20sent');_0x1e4598(_0x7eb94c['result'][_0x6764('0x16')]);}})['catch'](function(_0x1553c9){logger[_0x6764('0x15')](_0x6764('0x10'),_0x206c70,_0x1553c9);_0x95a392(_0x1553c9);});});}
\ No newline at end of file
index 012f246..24f63cf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x034b=['extname','originalname','post','/:id/logo','single','file','addLogo','server/files/images/logos/','%s%s','logologin','addLogoLogin','preferred','put','/:id','update','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','show','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','diskStorage','join','root','format'];(function(_0x2264a5,_0x42a516){var _0x49f28b=function(_0x42c967){while(--_0x42c967){_0x2264a5['push'](_0x2264a5['shift']());}};_0x49f28b(++_0x42a516);}(_0x034b,0x191));var _0xb034=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x034b[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xb034('0x0'));var util=require('util');var path=require(_0xb034('0x1'));var timeout=require('connect-timeout');var express=require(_0xb034('0x2'));var router=express['Router']();var auth=require(_0xb034('0x3'));var interaction=require(_0xb034('0x4'));var config=require(_0xb034('0x5'));var controller=require(_0xb034('0x6'));router[_0xb034('0x7')]('/',auth[_0xb034('0x8')](),controller[_0xb034('0x9')]);router[_0xb034('0x7')]('/:id',controller[_0xb034('0xa')]);router[_0xb034('0x7')]('/:id/logo',controller['getLogo']);router[_0xb034('0x7')](_0xb034('0xb'),controller[_0xb034('0xc')]);router[_0xb034('0x7')](_0xb034('0xd'),controller['gdpr']);router[_0xb034('0x7')](_0xb034('0xe'),controller['getPreferred']);var upload=multer({'storage':multer[_0xb034('0xf')]({'destination':function(_0x17ad4b,_0x367973,_0x4eb74d){_0x4eb74d(null,path[_0xb034('0x10')](config[_0xb034('0x11')],'server/files/images/logos/'));},'filename':function(_0x2ffe76,_0x4d57e6,_0x215f0d){_0x215f0d(null,util[_0xb034('0x12')]('%s%s','logo',path[_0xb034('0x13')](_0x4d57e6[_0xb034('0x14')])));}})});router[_0xb034('0x15')](_0xb034('0x16'),upload[_0xb034('0x17')](_0xb034('0x18')),controller[_0xb034('0x19')]);var upload=multer({'storage':multer[_0xb034('0xf')]({'destination':function(_0x22178b,_0x5b8254,_0x2b82de){_0x2b82de(null,path[_0xb034('0x10')](config['root'],_0xb034('0x1a')));},'filename':function(_0x13017e,_0x1347f8,_0x457f25){_0x457f25(null,util[_0xb034('0x12')](_0xb034('0x1b'),_0xb034('0x1c'),path[_0xb034('0x13')](_0x1347f8['originalname'])));}})});router[_0xb034('0x15')]('/:id/logo_login',upload[_0xb034('0x17')]('file'),controller[_0xb034('0x1d')]);var upload=multer({'storage':multer[_0xb034('0xf')]({'destination':function(_0x780718,_0x4cd737,_0x279d73){_0x279d73(null,path[_0xb034('0x10')](config[_0xb034('0x11')],'server/files/images/logos/'));},'filename':function(_0x544002,_0x5010b2,_0x5fc35){_0x5fc35(null,util[_0xb034('0x12')](_0xb034('0x1b'),_0xb034('0x1e'),path[_0xb034('0x13')](_0x5010b2[_0xb034('0x14')])));}})});router[_0xb034('0x15')]('/:id/preferred',upload[_0xb034('0x17')]('file'),controller['addPreferred']);router[_0xb034('0x1f')](_0xb034('0x20'),auth[_0xb034('0x8')](),controller[_0xb034('0x21')]);module[_0xb034('0x22')]=router;
\ No newline at end of file
+var _0x92e7=['../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','/:id/preferred','getPreferred','diskStorage','join','server/files/images/logos/','format','%s%s','logo','originalname','post','file','addLogo','root','logologin','extname','single','addLogoLogin','update','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0xe0987,_0x9dd1d5){var _0x440bcd=function(_0x26aa1c){while(--_0x26aa1c){_0xe0987['push'](_0xe0987['shift']());}};_0x440bcd(++_0x9dd1d5);}(_0x92e7,0x82));var _0x792e=function(_0x482f44,_0x44d0bf){_0x482f44=_0x482f44-0x0;var _0x39fdf9=_0x92e7[_0x482f44];return _0x39fdf9;};'use strict';var multer=require(_0x792e('0x0'));var util=require(_0x792e('0x1'));var path=require(_0x792e('0x2'));var timeout=require(_0x792e('0x3'));var express=require(_0x792e('0x4'));var router=express['Router']();var auth=require(_0x792e('0x5'));var interaction=require(_0x792e('0x6'));var config=require('../../config/environment');var controller=require('./setting.controller');router[_0x792e('0x7')]('/',auth[_0x792e('0x8')](),controller['index']);router['get'](_0x792e('0x9'),controller[_0x792e('0xa')]);router[_0x792e('0x7')](_0x792e('0xb'),controller[_0x792e('0xc')]);router['get'](_0x792e('0xd'),controller['getLogoLogin']);router[_0x792e('0x7')](_0x792e('0xe'),controller['gdpr']);router['get'](_0x792e('0xf'),controller[_0x792e('0x10')]);var upload=multer({'storage':multer[_0x792e('0x11')]({'destination':function(_0x36c22c,_0x56b73c,_0xcc27e9){_0xcc27e9(null,path[_0x792e('0x12')](config['root'],_0x792e('0x13')));},'filename':function(_0x43b0b9,_0x469dcf,_0x527d6e){_0x527d6e(null,util[_0x792e('0x14')](_0x792e('0x15'),_0x792e('0x16'),path['extname'](_0x469dcf[_0x792e('0x17')])));}})});router[_0x792e('0x18')](_0x792e('0xb'),upload['single'](_0x792e('0x19')),controller[_0x792e('0x1a')]);var upload=multer({'storage':multer[_0x792e('0x11')]({'destination':function(_0x2077ee,_0x2e5757,_0x4aa64c){_0x4aa64c(null,path[_0x792e('0x12')](config[_0x792e('0x1b')],'server/files/images/logos/'));},'filename':function(_0x1e6fab,_0x49f2b5,_0x3e2ccf){_0x3e2ccf(null,util[_0x792e('0x14')](_0x792e('0x15'),_0x792e('0x1c'),path[_0x792e('0x1d')](_0x49f2b5[_0x792e('0x17')])));}})});router[_0x792e('0x18')](_0x792e('0xd'),upload[_0x792e('0x1e')](_0x792e('0x19')),controller[_0x792e('0x1f')]);var upload=multer({'storage':multer[_0x792e('0x11')]({'destination':function(_0x54f075,_0x4cd819,_0x866f1b){_0x866f1b(null,path[_0x792e('0x12')](config[_0x792e('0x1b')],'server/files/images/logos/'));},'filename':function(_0x32e1df,_0xc0f3b1,_0x1ba4da){_0x1ba4da(null,util['format']('%s%s','preferred',path[_0x792e('0x1d')](_0xc0f3b1[_0x792e('0x17')])));}})});router[_0x792e('0x18')](_0x792e('0xf'),upload[_0x792e('0x1e')]('file'),controller['addPreferred']);router['put'](_0x792e('0x9'),auth[_0x792e('0x8')](),controller[_0x792e('0x20')]);module[_0x792e('0x21')]=router;
\ No newline at end of file
index 5db9faa..7fb63bf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf26b=['exports','INTEGER','min_mailbox','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xf26b,0x142));var _0xbf26=function(_0x2d99d4,_0x32db5a){_0x2d99d4=_0x2d99d4-0x0;var _0x137524=_0xf26b[_0x2d99d4];return _0x137524;};'use strict';var Sequelize=require('sequelize');module[_0xbf26('0x0')]={'min_internal':{'type':Sequelize[_0xbf26('0x1')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xbf26('0x1')](0xb),'unique':_0xbf26('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xbf26('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xbf26('0x3')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0xbf26('0x3')]},'defaultLogo':{'type':Sequelize[_0xbf26('0x4')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0xbf26('0x4')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xbf26('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xbf26('0x4')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xbf26('0x4')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xbf26('0x4')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xbf26('0x3')]},'turnaddr':{'type':Sequelize[_0xbf26('0x3')]},'turnusername':{'type':Sequelize[_0xbf26('0x3')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0xbf26('0x3')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xbf26('0x4')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xbf26('0x3')],'defaultValue':_0xbf26('0x5')},'enableEmailPreview':{'type':Sequelize[_0xbf26('0x4')],'defaultValue':![]},'split':{'type':Sequelize[_0xbf26('0x4')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xbf26('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xbf26('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xbf26('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xbf26('0x3')],'defaultValue':_0xbf26('0x6')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xbf26('0x3')]},'defaultPreferred':{'type':Sequelize[_0xbf26('0x4')],'defaultValue':!![]}};
\ No newline at end of file
+var _0xb519=['BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','sequelize','exports','min_internal','min_mailbox','INTEGER','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x39d42d,_0x98d847){var _0x274011=function(_0x2b7a74){while(--_0x2b7a74){_0x39d42d['push'](_0x39d42d['shift']());}};_0x274011(++_0x98d847);}(_0xb519,0x1df));var _0x9b51=function(_0x1856a3,_0x5a84c3){_0x1856a3=_0x1856a3-0x0;var _0x40be29=_0xb519[_0x1856a3];return _0x40be29;};'use strict';var Sequelize=require(_0x9b51('0x0'));module[_0x9b51('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x9b51('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x9b51('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x9b51('0x4')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x9b51('0x5')],'defaultValue':_0x9b51('0x6')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x9b51('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x9b51('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x9b51('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x9b51('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x9b51('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x9b51('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x9b51('0x5')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x9b51('0x5')]},'turnpassword':{'type':Sequelize[_0x9b51('0x5')]},'pageTitle':{'type':Sequelize[_0x9b51('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x9b51('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x9b51('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x9b51('0x4')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x9b51('0x5')],'defaultValue':_0x9b51('0x8')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x9b51('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x9b51('0x4')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x9b51('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x9b51('0x4')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x9b51('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}};
\ No newline at end of file
index b291f31..a88516a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3cae=['root','server/files/templates/stun.ejs','render','readFileSync','server/files/templates/turn.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','/etc/asterisk/turn_xcally.conf','Reload','res_stun_monitor.so','filename','logo','file','body','addLogoLogin','loginLogo','../../config/license/util','getLicense','preferred','defaultLogo','defaultPreferred','existsSync','toLower','default_logo.png','upperFirst','custom','Sequelize','ValidationError','download','getLogoLogin','defaultLoginLogo','default_loginLogo.png','default','Logo\x20not\x20found','gdpr','securePassword','addPreferred','getPreferred','server/files/images/logos','default_preferred.png','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','save','update','stack','name','send','index','Setting','rawAttributes','model','keys','query','intersection','attributes','fields','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','field','options','count','include','show','params','includeAll','find','get','join'];(function(_0x3dc9ca,_0x27d22d){var _0x34e736=function(_0x34cdad){while(--_0x34cdad){_0x3dc9ca['push'](_0x3dc9ca['shift']());}};_0x34e736(++_0x27d22d);}(_0x3cae,0x117));var _0xe3ca=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x3cae[_0x1e3c16];return _0x47a0c9;};'use strict';var pdf=require(_0xe3ca('0x0'));var emlformat=require(_0xe3ca('0x1'));var rimraf=require(_0xe3ca('0x2'));var zipdir=require(_0xe3ca('0x3'));var jsonpatch=require(_0xe3ca('0x4'));var rp=require(_0xe3ca('0x5'));var moment=require(_0xe3ca('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xe3ca('0x7'));var util=require(_0xe3ca('0x8'));var path=require('path');var sox=require(_0xe3ca('0x9'));var csv=require('to-csv');var ejs=require(_0xe3ca('0xa'));var fs=require('fs');var _=require(_0xe3ca('0xb'));var squel=require(_0xe3ca('0xc'));var crypto=require('crypto');var jsforce=require(_0xe3ca('0xd'));var deskjs=require(_0xe3ca('0xe'));var toCsv=require(_0xe3ca('0xf'));var querystring=require(_0xe3ca('0x10'));var Papa=require(_0xe3ca('0x11'));var authService=require(_0xe3ca('0x12'));var hardwareService=require(_0xe3ca('0x13'));var Redis=require('ioredis');var qs=require(_0xe3ca('0x14'));var logger=require('../../config/logger')(_0xe3ca('0x15'));var utils=require(_0xe3ca('0x16'));var config=require(_0xe3ca('0x17'));var db=require(_0xe3ca('0x18'))['db'];var jayson=require(_0xe3ca('0x19'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3ff241,_0x5f1c02,_0x35b0f1,_0xb3af46){return new BPromise(function(_0x4857f0,_0x3d62e2){var _0x3a9455=_0xb3af46||client;return _0x3a9455[_0xe3ca('0x1a')](_0x3ff241,_0x35b0f1)[_0xe3ca('0x1b')](function(_0x9ef773){logger[_0xe3ca('0x1c')](_0xe3ca('0x1d'),_0x5f1c02,_0xe3ca('0x1e'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x5f1c02,_0xe3ca('0x1e'),JSON[_0xe3ca('0x1f')](_0x9ef773));if(_0x9ef773[_0xe3ca('0x20')]){if(_0x9ef773[_0xe3ca('0x20')][_0xe3ca('0x21')]===0x1f4){logger[_0xe3ca('0x20')]('Setting,\x20%s,\x20%s',_0x5f1c02,_0x9ef773[_0xe3ca('0x20')][_0xe3ca('0x22')]);return _0x3d62e2(_0x9ef773[_0xe3ca('0x20')]['message']);}logger['error']('Setting,\x20%s,\x20%s',_0x5f1c02,_0x9ef773[_0xe3ca('0x20')]['message']);return _0x4857f0(_0x9ef773['error'][_0xe3ca('0x22')]);}else{logger[_0xe3ca('0x1c')](_0xe3ca('0x1d'),_0x5f1c02,_0xe3ca('0x1e'));_0x4857f0(_0x9ef773[_0xe3ca('0x23')]['message']);}})[_0xe3ca('0x24')](function(_0x3ab26e){logger['error'](_0xe3ca('0x1d'),_0x5f1c02,_0x3ab26e);_0x3d62e2(_0x3ab26e);});});}function respondWithStatusCode(_0x2d732f,_0x33dc04){_0x33dc04=_0x33dc04||0xcc;return function(_0xd681a7){if(_0xd681a7){return _0x2d732f[_0xe3ca('0x25')](_0x33dc04);}return _0x2d732f[_0xe3ca('0x26')](_0x33dc04)[_0xe3ca('0x27')]();};}function respondWithResult(_0x25b39e,_0x477ec7){_0x477ec7=_0x477ec7||0xc8;return function(_0x2fafd9){if(_0x2fafd9){return _0x25b39e[_0xe3ca('0x26')](_0x477ec7)['json'](_0x2fafd9);}};}function respondWithFilteredResult(_0x16e1d6,_0x5740af){return function(_0x11ec88){if(_0x11ec88){var _0x2fffe4=_0x11ec88['count'],_0x3de0ef=_0x5740af[_0xe3ca('0x28')],_0x452096=_0x5740af[_0xe3ca('0x28')]+_0x5740af[_0xe3ca('0x29')],_0x576491;if(_0x452096>=_0x2fffe4){_0x452096=_0x2fffe4;_0x576491=0xc8;}else{_0x576491=0xce;}_0x16e1d6['status'](_0x576491);return _0x16e1d6[_0xe3ca('0x2a')](_0xe3ca('0x2b'),_0x3de0ef+'-'+_0x452096+'/'+_0x2fffe4)[_0xe3ca('0x2c')](_0x11ec88);}return null;};}function patchUpdates(_0x17d3c7){return function(_0x532662){try{jsonpatch['apply'](_0x532662,_0x17d3c7,!![]);}catch(_0xf90c19){return BPromise['reject'](_0xf90c19);}return _0x532662[_0xe3ca('0x2d')]();};}function saveUpdates(_0x5cf384,_0x5576b4){return function(_0xd5e714){if(_0xd5e714){return _0xd5e714[_0xe3ca('0x2e')](_0x5cf384)[_0xe3ca('0x1b')](function(_0x51c5b5){return _0x51c5b5;});}return null;};}function removeEntity(_0x12e51d,_0x5ee00b){return function(_0x11dd1d){if(_0x11dd1d){return _0x11dd1d['destroy']()['then'](function(){_0x12e51d[_0xe3ca('0x26')](0xcc)[_0xe3ca('0x27')]();});}};}function handleEntityNotFound(_0x896c0b,_0x2f0cb9){return function(_0x1143ca){if(!_0x1143ca){_0x896c0b[_0xe3ca('0x25')](0x194);}return _0x1143ca;};}function handleError(_0x1e8145,_0x4417d9){_0x4417d9=_0x4417d9||0x1f4;return function(_0x1b9931){logger[_0xe3ca('0x20')](_0x1b9931[_0xe3ca('0x2f')]);if(_0x1b9931[_0xe3ca('0x30')]){delete _0x1b9931['name'];}_0x1e8145[_0xe3ca('0x26')](_0x4417d9)[_0xe3ca('0x31')](_0x1b9931);};}exports[_0xe3ca('0x32')]=function(_0xf3a1d2,_0xdf7c28){var _0x3aeba2={},_0x59413d={},_0x125e03={'count':0x0,'rows':[]};var _0x2bc3fc=db[_0xe3ca('0x33')][_0xe3ca('0x34')];_0x59413d[_0xe3ca('0x35')]=_[_0xe3ca('0x36')](_0x2bc3fc);_0x59413d[_0xe3ca('0x37')]=_[_0xe3ca('0x36')](_0xf3a1d2[_0xe3ca('0x37')]);_0x59413d['filters']=_[_0xe3ca('0x38')](_0x59413d[_0xe3ca('0x35')],_0x59413d['query']);_0x3aeba2[_0xe3ca('0x39')]=_[_0xe3ca('0x38')](_0x59413d[_0xe3ca('0x35')],qs['fields'](_0xf3a1d2[_0xe3ca('0x37')][_0xe3ca('0x3a')]));_0x3aeba2['attributes']=_0x3aeba2[_0xe3ca('0x39')]['length']?_0x3aeba2['attributes']:_0x59413d[_0xe3ca('0x35')];if(!_0xf3a1d2[_0xe3ca('0x37')]['hasOwnProperty'](_0xe3ca('0x3b'))){_0x3aeba2[_0xe3ca('0x29')]=qs[_0xe3ca('0x29')](_0xf3a1d2[_0xe3ca('0x37')][_0xe3ca('0x29')]);_0x3aeba2[_0xe3ca('0x28')]=qs[_0xe3ca('0x28')](_0xf3a1d2[_0xe3ca('0x37')][_0xe3ca('0x28')]);}_0x3aeba2['order']=qs[_0xe3ca('0x3c')](_0xf3a1d2[_0xe3ca('0x37')][_0xe3ca('0x3c')]);_0x3aeba2[_0xe3ca('0x3d')]=qs[_0xe3ca('0x3e')](_[_0xe3ca('0x3f')](_0xf3a1d2[_0xe3ca('0x37')],_0x59413d[_0xe3ca('0x3e')]));if(_0xf3a1d2[_0xe3ca('0x37')][_0xe3ca('0x40')]){_0x3aeba2[_0xe3ca('0x3d')]=_[_0xe3ca('0x41')](_0x3aeba2[_0xe3ca('0x3d')],{'$or':_['map'](_0x2bc3fc,function(_0x275010){if(_0x275010[_0xe3ca('0x42')]['key']!==_0xe3ca('0x43')){var _0x312ee7={};_0x312ee7[_0x275010[_0xe3ca('0x44')]]={'$like':'%'+_0xf3a1d2[_0xe3ca('0x37')][_0xe3ca('0x40')]+'%'};return _0x312ee7;}})});}_0x3aeba2=_[_0xe3ca('0x41')]({},_0x3aeba2,_0xf3a1d2[_0xe3ca('0x45')]);var _0x210e45={'where':_0x3aeba2[_0xe3ca('0x3d')]};return db[_0xe3ca('0x33')][_0xe3ca('0x46')](_0x210e45)['then'](function(_0xe21aca){_0x125e03[_0xe3ca('0x46')]=_0xe21aca;if(_0xf3a1d2['query']['includeAll']){_0x3aeba2[_0xe3ca('0x47')]=[{'all':!![]}];}return db[_0xe3ca('0x33')]['findAll'](_0x3aeba2);})[_0xe3ca('0x1b')](function(_0x31b4f7){_0x125e03['rows']=_0x31b4f7;return _0x125e03;})['then'](respondWithFilteredResult(_0xdf7c28,_0x3aeba2))[_0xe3ca('0x24')](handleError(_0xdf7c28,null));};exports[_0xe3ca('0x48')]=function(_0xf8c0ad,_0x409c60){var _0x139c91={'raw':![],'where':{'id':_0xf8c0ad[_0xe3ca('0x49')]['id']}},_0x5242f6={};_0x5242f6[_0xe3ca('0x35')]=_[_0xe3ca('0x36')](db[_0xe3ca('0x33')][_0xe3ca('0x34')]);_0x5242f6[_0xe3ca('0x37')]=_[_0xe3ca('0x36')](_0xf8c0ad[_0xe3ca('0x37')]);_0x5242f6[_0xe3ca('0x3e')]=_['intersection'](_0x5242f6['model'],_0x5242f6['query']);_0x139c91[_0xe3ca('0x39')]=_[_0xe3ca('0x38')](_0x5242f6[_0xe3ca('0x35')],qs['fields'](_0xf8c0ad['query'][_0xe3ca('0x3a')]));_0x139c91[_0xe3ca('0x39')]=_0x139c91[_0xe3ca('0x39')]['length']?_0x139c91['attributes']:_0x5242f6[_0xe3ca('0x35')];if(_0xf8c0ad['query'][_0xe3ca('0x4a')]){_0x139c91[_0xe3ca('0x47')]=[{'all':!![]}];}_0x139c91=_[_0xe3ca('0x41')]({},_0x139c91,_0xf8c0ad[_0xe3ca('0x45')]);return db[_0xe3ca('0x33')][_0xe3ca('0x4b')](_0x139c91)[_0xe3ca('0x1b')](handleEntityNotFound(_0x409c60,null))[_0xe3ca('0x1b')](respondWithResult(_0x409c60,null))[_0xe3ca('0x24')](handleError(_0x409c60,null));};exports[_0xe3ca('0x2e')]=function(_0x187220,_0x51d29f,_0xf2cee7){var _0x466be2;return db['Setting'][_0xe3ca('0x4b')]({'where':{'id':_0x187220[_0xe3ca('0x49')]['id']}})[_0xe3ca('0x1b')](handleEntityNotFound(_0x51d29f,null))[_0xe3ca('0x1b')](saveUpdates(_0x187220['body'],null))['then'](function(_0x2e0a7c){if(_0x2e0a7c){_0x466be2=_0x2e0a7c[_0xe3ca('0x4c')]({'plain':!![]});var _0x45109f=fs['readFileSync'](path[_0xe3ca('0x4d')](config[_0xe3ca('0x4e')],_0xe3ca('0x4f')),'utf8');var _0x1b650e=ejs[_0xe3ca('0x50')](_0x45109f,_0x466be2);var _0x27cef9=fs[_0xe3ca('0x51')](path[_0xe3ca('0x4d')](config[_0xe3ca('0x4e')],_0xe3ca('0x52')),_0xe3ca('0x53'));var _0x402c92=ejs['render'](_0x27cef9,_0x466be2);fs[_0xe3ca('0x54')](_0xe3ca('0x55'),_0x1b650e);fs[_0xe3ca('0x54')](_0xe3ca('0x56'),_0x402c92);return respondWithRpcPromise(_0xe3ca('0x57'),_0xe3ca('0x2e'),{'module':_0xe3ca('0x58')});}})['then'](function(){return respondWithRpcPromise(_0xe3ca('0x57'),_0xe3ca('0x2e'),{'module':'res_rtp_asterisk.so'});})[_0xe3ca('0x1b')](function(){return _0x466be2||null;})[_0xe3ca('0x1b')](respondWithResult(_0x51d29f,null))['catch'](handleError(_0x51d29f,null));};exports['addLogo']=function(_0x213c59,_0x320665,_0xec2366){if(_0x213c59['file']&&_0x213c59['file'][_0xe3ca('0x59')]){_0x213c59['body'][_0xe3ca('0x5a')]=_0x213c59[_0xe3ca('0x5b')][_0xe3ca('0x59')];}return db[_0xe3ca('0x33')][_0xe3ca('0x4b')]({'where':{'id':_0x213c59[_0xe3ca('0x49')]['id']}})[_0xe3ca('0x1b')](handleEntityNotFound(_0x320665,null))[_0xe3ca('0x1b')](saveUpdates(_0x213c59[_0xe3ca('0x5c')],null))[_0xe3ca('0x1b')](respondWithResult(_0x320665,null))['catch'](handleError(_0x320665,null));};exports[_0xe3ca('0x5d')]=function(_0x223899,_0x28ccd6,_0x32c62a){if(_0x223899[_0xe3ca('0x5b')]&&_0x223899['file'][_0xe3ca('0x59')]){_0x223899[_0xe3ca('0x5c')][_0xe3ca('0x5e')]=_0x223899[_0xe3ca('0x5b')][_0xe3ca('0x59')];}return db[_0xe3ca('0x33')][_0xe3ca('0x4b')]({'where':{'id':_0x223899[_0xe3ca('0x49')]['id']}})[_0xe3ca('0x1b')](handleEntityNotFound(_0x28ccd6,null))[_0xe3ca('0x1b')](saveUpdates(_0x223899[_0xe3ca('0x5c')],null))['then'](respondWithResult(_0x28ccd6,null))['catch'](handleError(_0x28ccd6,null));};var utilLicense=require(_0xe3ca('0x5f'));exports['getLogo']=function(_0x395c08,_0x138285,_0x225fbf){var _0x2f3ddc='server/files/images/logos';var _0x30acba={'custom':![]};return utilLicense[_0xe3ca('0x60')]()['then'](function(_0x5e042b){if(_0x5e042b){_0x30acba=_0x5e042b;}return db[_0xe3ca('0x33')][_0xe3ca('0x4b')]({'where':{'id':_0x395c08[_0xe3ca('0x49')]['id']},'attributes':[_0xe3ca('0x5a'),_0xe3ca('0x5e'),_0xe3ca('0x61'),_0xe3ca('0x62'),'defaultLoginLogo',_0xe3ca('0x63')],'raw':!![]});})[_0xe3ca('0x1b')](handleEntityNotFound(_0x138285,null))[_0xe3ca('0x1b')](function(_0x26829c){if(_0x26829c){var _0x4da4f1=_0x26829c['logo']&&fs[_0xe3ca('0x64')](path[_0xe3ca('0x4d')](config[_0xe3ca('0x4e')],_0x2f3ddc,_[_0xe3ca('0x65')](_0x26829c[_0xe3ca('0x5a')])))?path['join'](config[_0xe3ca('0x4e')],_0x2f3ddc,_[_0xe3ca('0x65')](_0x26829c[_0xe3ca('0x5a')])):path[_0xe3ca('0x4d')](config[_0xe3ca('0x4e')],_0x2f3ddc,_[_0xe3ca('0x65')](_0xe3ca('0x66')));var _0x7c1f3a='default'+_[_0xe3ca('0x67')](_0xe3ca('0x5a'));if(_0x26829c[_0x7c1f3a]||!_0x30acba[_0xe3ca('0x68')]){_0x4da4f1=path[_0xe3ca('0x4d')](config[_0xe3ca('0x4e')],_0x2f3ddc,_[_0xe3ca('0x65')]('default_logo.png'));}if(!fs[_0xe3ca('0x64')](_0x4da4f1)){throw new db[(_0xe3ca('0x69'))][(_0xe3ca('0x6a'))]('Logo\x20not\x20found');}return _0x138285[_0xe3ca('0x6b')](_0x4da4f1);}})[_0xe3ca('0x24')](handleError(_0x138285,null));};var utilLicense=require('../../config/license/util');exports[_0xe3ca('0x6c')]=function(_0x3f12b9,_0x323af2,_0xf48d34){var _0x44d3e8='server/files/images/logos';var _0x405d8f={'custom':![]};return utilLicense[_0xe3ca('0x60')]()['then'](function(_0x126461){if(_0x126461){_0x405d8f=_0x126461;}return db[_0xe3ca('0x33')]['find']({'where':{'id':_0x3f12b9[_0xe3ca('0x49')]['id']},'attributes':[_0xe3ca('0x5a'),'loginLogo',_0xe3ca('0x61'),_0xe3ca('0x62'),_0xe3ca('0x6d'),_0xe3ca('0x63')],'raw':!![]});})[_0xe3ca('0x1b')](handleEntityNotFound(_0x323af2,null))[_0xe3ca('0x1b')](function(_0x18f212){if(_0x18f212){var _0x5a122b=_0x18f212['loginLogo']&&fs[_0xe3ca('0x64')](path[_0xe3ca('0x4d')](config[_0xe3ca('0x4e')],_0x44d3e8,_[_0xe3ca('0x65')](_0x18f212['loginLogo'])))?path[_0xe3ca('0x4d')](config['root'],_0x44d3e8,_[_0xe3ca('0x65')](_0x18f212[_0xe3ca('0x5e')])):path[_0xe3ca('0x4d')](config[_0xe3ca('0x4e')],_0x44d3e8,_[_0xe3ca('0x65')](_0xe3ca('0x6e')));var _0xc605d7=_0xe3ca('0x6f')+_[_0xe3ca('0x67')]('loginLogo');if(_0x18f212[_0xc605d7]||!_0x405d8f['custom']){_0x5a122b=path['join'](config[_0xe3ca('0x4e')],_0x44d3e8,_['toLower'](_0xe3ca('0x6e')));}if(!fs['existsSync'](_0x5a122b)){throw new db[(_0xe3ca('0x69'))]['ValidationError'](_0xe3ca('0x70'));}return _0x323af2[_0xe3ca('0x6b')](_0x5a122b);}})[_0xe3ca('0x24')](handleError(_0x323af2,null));};exports[_0xe3ca('0x71')]=function(_0x534cbc,_0x5dc26a){return db[_0xe3ca('0x33')][_0xe3ca('0x4b')]({'where':{'id':_0x534cbc[_0xe3ca('0x49')]['id']},'attributes':[_0xe3ca('0x72')]})[_0xe3ca('0x1b')](respondWithResult(_0x5dc26a,null))[_0xe3ca('0x24')](handleError(_0x5dc26a,null));};exports[_0xe3ca('0x73')]=function(_0x435e60,_0x3a22dd,_0x1c6959){if(_0x435e60['file']&&_0x435e60[_0xe3ca('0x5b')][_0xe3ca('0x59')]){_0x435e60[_0xe3ca('0x5c')][_0xe3ca('0x61')]=_0x435e60[_0xe3ca('0x5b')]['filename'];}return db[_0xe3ca('0x33')][_0xe3ca('0x4b')]({'where':{'id':_0x435e60[_0xe3ca('0x49')]['id']}})[_0xe3ca('0x1b')](handleEntityNotFound(_0x3a22dd,null))[_0xe3ca('0x1b')](saveUpdates(_0x435e60['body'],null))['then'](respondWithResult(_0x3a22dd,null))[_0xe3ca('0x24')](handleError(_0x3a22dd,null));};var utilLicense=require(_0xe3ca('0x5f'));exports[_0xe3ca('0x74')]=function(_0x201f1c,_0x17148d,_0x5e56e7){var _0x3b16df=_0xe3ca('0x75');var _0x8237dc={'custom':![]};return utilLicense[_0xe3ca('0x60')]()['then'](function(_0x1476de){if(_0x1476de){_0x8237dc=_0x1476de;}return db[_0xe3ca('0x33')]['find']({'where':{'id':_0x201f1c[_0xe3ca('0x49')]['id']},'attributes':[_0xe3ca('0x5a'),_0xe3ca('0x5e'),_0xe3ca('0x61'),'defaultLogo',_0xe3ca('0x6d'),'defaultPreferred'],'raw':!![]});})['then'](handleEntityNotFound(_0x17148d,null))['then'](function(_0x49028b){if(_0x49028b){var _0x5e7ad3=_0x49028b['preferred']&&fs[_0xe3ca('0x64')](path['join'](config[_0xe3ca('0x4e')],_0x3b16df,_[_0xe3ca('0x65')](_0x49028b[_0xe3ca('0x61')])))?path[_0xe3ca('0x4d')](config[_0xe3ca('0x4e')],_0x3b16df,_[_0xe3ca('0x65')](_0x49028b[_0xe3ca('0x61')])):path[_0xe3ca('0x4d')](config[_0xe3ca('0x4e')],_0x3b16df,_['toLower']('default_preferred.png'));var _0x19f7d3=_0xe3ca('0x6f')+_[_0xe3ca('0x67')](_0xe3ca('0x61'));if(_0x49028b[_0x19f7d3]||!_0x8237dc[_0xe3ca('0x68')]||!_0x8237dc[_0xe3ca('0x61')]){_0x5e7ad3=path[_0xe3ca('0x4d')](config[_0xe3ca('0x4e')],_0x3b16df,_[_0xe3ca('0x65')](_0xe3ca('0x76')));}if(!fs['existsSync'](_0x5e7ad3)){throw new db['Sequelize'][(_0xe3ca('0x6a'))](_0xe3ca('0x70'));}return _0x17148d[_0xe3ca('0x6b')](_0x5e7ad3);}})[_0xe3ca('0x24')](handleError(_0x17148d,null));};
\ No newline at end of file
+var _0xf470=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','Setting,\x20%s,\x20%s','message','info','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','index','Setting','rawAttributes','model','keys','filters','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','key','VIRTUAL','field','includeAll','include','findAll','rows','show','params','options','find','body','get','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','update','Reload','file','filename','logo','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','defaultLogo','defaultPreferred','existsSync','toLower','default_logo.png','upperFirst','Logo\x20not\x20found','preferred','defaultLoginLogo','default_loginLogo.png','default','custom','Sequelize','ValidationError','download','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','html-pdf'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xf470,0xfd));var _0x0f47=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xf470[_0x1928c9];return _0x51b5fb;};'use strict';var pdf=require(_0x0f47('0x0'));var emlformat=require(_0x0f47('0x1'));var rimraf=require(_0x0f47('0x2'));var zipdir=require(_0x0f47('0x3'));var jsonpatch=require(_0x0f47('0x4'));var rp=require(_0x0f47('0x5'));var moment=require('moment');var BPromise=require(_0x0f47('0x6'));var Mustache=require(_0x0f47('0x7'));var util=require('util');var path=require(_0x0f47('0x8'));var sox=require(_0x0f47('0x9'));var csv=require(_0x0f47('0xa'));var ejs=require(_0x0f47('0xb'));var fs=require('fs');var _=require(_0x0f47('0xc'));var squel=require(_0x0f47('0xd'));var crypto=require(_0x0f47('0xe'));var jsforce=require(_0x0f47('0xf'));var deskjs=require(_0x0f47('0x10'));var toCsv=require(_0x0f47('0xa'));var querystring=require(_0x0f47('0x11'));var Papa=require(_0x0f47('0x12'));var authService=require(_0x0f47('0x13'));var hardwareService=require(_0x0f47('0x14'));var Redis=require(_0x0f47('0x15'));var qs=require(_0x0f47('0x16'));var logger=require(_0x0f47('0x17'))(_0x0f47('0x18'));var utils=require(_0x0f47('0x19'));var config=require('../../config/environment');var db=require(_0x0f47('0x1a'))['db'];var jayson=require(_0x0f47('0x1b'));var client=jayson[_0x0f47('0x1c')][_0x0f47('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x128b8c,_0x4ce7e6,_0x4e0eb4,_0x33da37){return new BPromise(function(_0xc73c4e,_0x42ace5){var _0x327f2f=_0x33da37||client;return _0x327f2f[_0x0f47('0x1e')](_0x128b8c,_0x4e0eb4)['then'](function(_0x32eedc){logger['info']('Setting,\x20%s,\x20%s',_0x4ce7e6,_0x0f47('0x1f'));logger[_0x0f47('0x20')](_0x0f47('0x21'),_0x4ce7e6,_0x0f47('0x1f'),JSON[_0x0f47('0x22')](_0x32eedc));if(_0x32eedc[_0x0f47('0x23')]){if(_0x32eedc[_0x0f47('0x23')]['code']===0x1f4){logger[_0x0f47('0x23')](_0x0f47('0x24'),_0x4ce7e6,_0x32eedc['error'][_0x0f47('0x25')]);return _0x42ace5(_0x32eedc[_0x0f47('0x23')][_0x0f47('0x25')]);}logger[_0x0f47('0x23')](_0x0f47('0x24'),_0x4ce7e6,_0x32eedc[_0x0f47('0x23')][_0x0f47('0x25')]);return _0xc73c4e(_0x32eedc[_0x0f47('0x23')][_0x0f47('0x25')]);}else{logger[_0x0f47('0x26')](_0x0f47('0x24'),_0x4ce7e6,'request\x20sent');_0xc73c4e(_0x32eedc['result']['message']);}})[_0x0f47('0x27')](function(_0x5a0c8c){logger['error'](_0x0f47('0x24'),_0x4ce7e6,_0x5a0c8c);_0x42ace5(_0x5a0c8c);});});}function respondWithStatusCode(_0x19d346,_0x456611){_0x456611=_0x456611||0xcc;return function(_0x19a68c){if(_0x19a68c){return _0x19d346[_0x0f47('0x28')](_0x456611);}return _0x19d346[_0x0f47('0x29')](_0x456611)[_0x0f47('0x2a')]();};}function respondWithResult(_0x4e753b,_0x4fb61b){_0x4fb61b=_0x4fb61b||0xc8;return function(_0x165f4f){if(_0x165f4f){return _0x4e753b[_0x0f47('0x29')](_0x4fb61b)[_0x0f47('0x2b')](_0x165f4f);}};}function respondWithFilteredResult(_0x49f2ff,_0x365482){return function(_0x41a31e){if(_0x41a31e){var _0x3e1fb0=_0x41a31e[_0x0f47('0x2c')],_0x17c7cf=_0x365482[_0x0f47('0x2d')],_0x513fa1=_0x365482[_0x0f47('0x2d')]+_0x365482[_0x0f47('0x2e')],_0x2955b9;if(_0x513fa1>=_0x3e1fb0){_0x513fa1=_0x3e1fb0;_0x2955b9=0xc8;}else{_0x2955b9=0xce;}_0x49f2ff[_0x0f47('0x29')](_0x2955b9);return _0x49f2ff[_0x0f47('0x2f')](_0x0f47('0x30'),_0x17c7cf+'-'+_0x513fa1+'/'+_0x3e1fb0)[_0x0f47('0x2b')](_0x41a31e);}return null;};}function patchUpdates(_0x2648f1){return function(_0x8e5d1f){try{jsonpatch[_0x0f47('0x31')](_0x8e5d1f,_0x2648f1,!![]);}catch(_0x4ff1ef){return BPromise[_0x0f47('0x32')](_0x4ff1ef);}return _0x8e5d1f[_0x0f47('0x33')]();};}function saveUpdates(_0xd503e4,_0x1a0d44){return function(_0x2475cf){if(_0x2475cf){return _0x2475cf['update'](_0xd503e4)[_0x0f47('0x34')](function(_0x3e62a4){return _0x3e62a4;});}return null;};}function removeEntity(_0x472626,_0x503fd2){return function(_0x3b762e){if(_0x3b762e){return _0x3b762e[_0x0f47('0x35')]()[_0x0f47('0x34')](function(){_0x472626[_0x0f47('0x29')](0xcc)[_0x0f47('0x2a')]();});}};}function handleEntityNotFound(_0x52006a,_0x52767c){return function(_0x53ea2e){if(!_0x53ea2e){_0x52006a['sendStatus'](0x194);}return _0x53ea2e;};}function handleError(_0x29d2e9,_0x4f0aab){_0x4f0aab=_0x4f0aab||0x1f4;return function(_0xdb5135){logger['error'](_0xdb5135[_0x0f47('0x36')]);if(_0xdb5135[_0x0f47('0x37')]){delete _0xdb5135[_0x0f47('0x37')];}_0x29d2e9[_0x0f47('0x29')](_0x4f0aab)['send'](_0xdb5135);};}exports[_0x0f47('0x38')]=function(_0xee9cd,_0x3dd653){var _0x164175={},_0x38a3ce={},_0x4d7d38={'count':0x0,'rows':[]};var _0x1c4e1a=db[_0x0f47('0x39')][_0x0f47('0x3a')];_0x38a3ce[_0x0f47('0x3b')]=_[_0x0f47('0x3c')](_0x1c4e1a);_0x38a3ce['query']=_['keys'](_0xee9cd['query']);_0x38a3ce[_0x0f47('0x3d')]=_[_0x0f47('0x3e')](_0x38a3ce[_0x0f47('0x3b')],_0x38a3ce['query']);_0x164175[_0x0f47('0x3f')]=_[_0x0f47('0x3e')](_0x38a3ce['model'],qs['fields'](_0xee9cd['query'][_0x0f47('0x40')]));_0x164175['attributes']=_0x164175[_0x0f47('0x3f')][_0x0f47('0x41')]?_0x164175['attributes']:_0x38a3ce[_0x0f47('0x3b')];if(!_0xee9cd[_0x0f47('0x42')][_0x0f47('0x43')](_0x0f47('0x44'))){_0x164175[_0x0f47('0x2e')]=qs[_0x0f47('0x2e')](_0xee9cd[_0x0f47('0x42')][_0x0f47('0x2e')]);_0x164175['offset']=qs[_0x0f47('0x2d')](_0xee9cd[_0x0f47('0x42')][_0x0f47('0x2d')]);}_0x164175[_0x0f47('0x45')]=qs[_0x0f47('0x46')](_0xee9cd[_0x0f47('0x42')]['sort']);_0x164175[_0x0f47('0x47')]=qs['filters'](_[_0x0f47('0x48')](_0xee9cd[_0x0f47('0x42')],_0x38a3ce['filters']));if(_0xee9cd[_0x0f47('0x42')][_0x0f47('0x49')]){_0x164175[_0x0f47('0x47')]=_[_0x0f47('0x4a')](_0x164175[_0x0f47('0x47')],{'$or':_['map'](_0x1c4e1a,function(_0x4a2305){if(_0x4a2305[_0x0f47('0x4b')][_0x0f47('0x4c')]!==_0x0f47('0x4d')){var _0xd5390={};_0xd5390[_0x4a2305[_0x0f47('0x4e')]]={'$like':'%'+_0xee9cd[_0x0f47('0x42')][_0x0f47('0x49')]+'%'};return _0xd5390;}})});}_0x164175=_['merge']({},_0x164175,_0xee9cd['options']);var _0x446db3={'where':_0x164175[_0x0f47('0x47')]};return db[_0x0f47('0x39')]['count'](_0x446db3)[_0x0f47('0x34')](function(_0x3cd6ae){_0x4d7d38[_0x0f47('0x2c')]=_0x3cd6ae;if(_0xee9cd[_0x0f47('0x42')][_0x0f47('0x4f')]){_0x164175[_0x0f47('0x50')]=[{'all':!![]}];}return db[_0x0f47('0x39')][_0x0f47('0x51')](_0x164175);})[_0x0f47('0x34')](function(_0x5a4b7e){_0x4d7d38[_0x0f47('0x52')]=_0x5a4b7e;return _0x4d7d38;})[_0x0f47('0x34')](respondWithFilteredResult(_0x3dd653,_0x164175))[_0x0f47('0x27')](handleError(_0x3dd653,null));};exports[_0x0f47('0x53')]=function(_0x3daec3,_0x2dab07){var _0x259763={'raw':![],'where':{'id':_0x3daec3[_0x0f47('0x54')]['id']}},_0x359dfa={};_0x359dfa['model']=_['keys'](db[_0x0f47('0x39')][_0x0f47('0x3a')]);_0x359dfa[_0x0f47('0x42')]=_[_0x0f47('0x3c')](_0x3daec3[_0x0f47('0x42')]);_0x359dfa[_0x0f47('0x3d')]=_[_0x0f47('0x3e')](_0x359dfa['model'],_0x359dfa[_0x0f47('0x42')]);_0x259763[_0x0f47('0x3f')]=_[_0x0f47('0x3e')](_0x359dfa[_0x0f47('0x3b')],qs[_0x0f47('0x40')](_0x3daec3[_0x0f47('0x42')][_0x0f47('0x40')]));_0x259763['attributes']=_0x259763[_0x0f47('0x3f')][_0x0f47('0x41')]?_0x259763[_0x0f47('0x3f')]:_0x359dfa[_0x0f47('0x3b')];if(_0x3daec3['query'][_0x0f47('0x4f')]){_0x259763[_0x0f47('0x50')]=[{'all':!![]}];}_0x259763=_[_0x0f47('0x4a')]({},_0x259763,_0x3daec3[_0x0f47('0x55')]);return db[_0x0f47('0x39')][_0x0f47('0x56')](_0x259763)[_0x0f47('0x34')](handleEntityNotFound(_0x2dab07,null))[_0x0f47('0x34')](respondWithResult(_0x2dab07,null))[_0x0f47('0x27')](handleError(_0x2dab07,null));};exports['update']=function(_0x120a02,_0xd460b7,_0x159644){var _0x3c1b8c;return db[_0x0f47('0x39')][_0x0f47('0x56')]({'where':{'id':_0x120a02[_0x0f47('0x54')]['id']}})[_0x0f47('0x34')](handleEntityNotFound(_0xd460b7,null))[_0x0f47('0x34')](saveUpdates(_0x120a02[_0x0f47('0x57')],null))[_0x0f47('0x34')](function(_0x25ae7d){if(_0x25ae7d){_0x3c1b8c=_0x25ae7d[_0x0f47('0x58')]({'plain':!![]});var _0x558f6b=fs[_0x0f47('0x59')](path[_0x0f47('0x5a')](config[_0x0f47('0x5b')],'server/files/templates/stun.ejs'),_0x0f47('0x5c'));var _0x31a09b=ejs[_0x0f47('0x5d')](_0x558f6b,_0x3c1b8c);var _0x2a817f=fs[_0x0f47('0x59')](path['join'](config[_0x0f47('0x5b')],'server/files/templates/turn.ejs'),_0x0f47('0x5c'));var _0xf6f30=ejs[_0x0f47('0x5d')](_0x2a817f,_0x3c1b8c);fs[_0x0f47('0x5e')](_0x0f47('0x5f'),_0x31a09b);fs[_0x0f47('0x5e')]('/etc/asterisk/turn_xcally.conf',_0xf6f30);return respondWithRpcPromise('Reload',_0x0f47('0x60'),{'module':'res_stun_monitor.so'});}})[_0x0f47('0x34')](function(){return respondWithRpcPromise(_0x0f47('0x61'),_0x0f47('0x60'),{'module':'res_rtp_asterisk.so'});})['then'](function(){return _0x3c1b8c||null;})['then'](respondWithResult(_0xd460b7,null))['catch'](handleError(_0xd460b7,null));};exports['addLogo']=function(_0x222be6,_0x650220,_0x255b3f){if(_0x222be6[_0x0f47('0x62')]&&_0x222be6['file'][_0x0f47('0x63')]){_0x222be6['body'][_0x0f47('0x64')]=_0x222be6[_0x0f47('0x62')][_0x0f47('0x63')];}return db[_0x0f47('0x39')][_0x0f47('0x56')]({'where':{'id':_0x222be6[_0x0f47('0x54')]['id']}})[_0x0f47('0x34')](handleEntityNotFound(_0x650220,null))[_0x0f47('0x34')](saveUpdates(_0x222be6[_0x0f47('0x57')],null))[_0x0f47('0x34')](respondWithResult(_0x650220,null))[_0x0f47('0x27')](handleError(_0x650220,null));};exports[_0x0f47('0x65')]=function(_0x227aae,_0x3fd03b,_0x5da95d){if(_0x227aae[_0x0f47('0x62')]&&_0x227aae[_0x0f47('0x62')][_0x0f47('0x63')]){_0x227aae[_0x0f47('0x57')][_0x0f47('0x66')]=_0x227aae[_0x0f47('0x62')][_0x0f47('0x63')];}return db[_0x0f47('0x39')][_0x0f47('0x56')]({'where':{'id':_0x227aae[_0x0f47('0x54')]['id']}})[_0x0f47('0x34')](handleEntityNotFound(_0x3fd03b,null))[_0x0f47('0x34')](saveUpdates(_0x227aae[_0x0f47('0x57')],null))['then'](respondWithResult(_0x3fd03b,null))[_0x0f47('0x27')](handleError(_0x3fd03b,null));};var utilLicense=require(_0x0f47('0x67'));exports[_0x0f47('0x68')]=function(_0x80fbde,_0x192ead,_0x58a976){var _0x14d193=_0x0f47('0x69');var _0x206a55={'custom':![]};return utilLicense[_0x0f47('0x6a')]()[_0x0f47('0x34')](function(_0x878e54){if(_0x878e54){_0x206a55=_0x878e54;}return db[_0x0f47('0x39')]['find']({'where':{'id':_0x80fbde[_0x0f47('0x54')]['id']},'attributes':[_0x0f47('0x64'),_0x0f47('0x66'),'preferred',_0x0f47('0x6b'),'defaultLoginLogo',_0x0f47('0x6c')],'raw':!![]});})[_0x0f47('0x34')](handleEntityNotFound(_0x192ead,null))[_0x0f47('0x34')](function(_0x3b6beb){if(_0x3b6beb){var _0x31c68c=_0x3b6beb[_0x0f47('0x64')]&&fs[_0x0f47('0x6d')](path['join'](config[_0x0f47('0x5b')],_0x14d193,_[_0x0f47('0x6e')](_0x3b6beb[_0x0f47('0x64')])))?path[_0x0f47('0x5a')](config[_0x0f47('0x5b')],_0x14d193,_['toLower'](_0x3b6beb[_0x0f47('0x64')])):path[_0x0f47('0x5a')](config['root'],_0x14d193,_[_0x0f47('0x6e')](_0x0f47('0x6f')));var _0xd41509='default'+_[_0x0f47('0x70')]('logo');if(_0x3b6beb[_0xd41509]||!_0x206a55['custom']){_0x31c68c=path[_0x0f47('0x5a')](config['root'],_0x14d193,_['toLower'](_0x0f47('0x6f')));}if(!fs[_0x0f47('0x6d')](_0x31c68c)){throw new db['Sequelize']['ValidationError'](_0x0f47('0x71'));}return _0x192ead['download'](_0x31c68c);}})['catch'](handleError(_0x192ead,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x1571f1,_0x53293d,_0x2f142b){var _0x5e9543=_0x0f47('0x69');var _0x139ad4={'custom':![]};return utilLicense[_0x0f47('0x6a')]()['then'](function(_0xe2f51c){if(_0xe2f51c){_0x139ad4=_0xe2f51c;}return db[_0x0f47('0x39')]['find']({'where':{'id':_0x1571f1[_0x0f47('0x54')]['id']},'attributes':['logo',_0x0f47('0x66'),_0x0f47('0x72'),'defaultLogo',_0x0f47('0x73'),_0x0f47('0x6c')],'raw':!![]});})[_0x0f47('0x34')](handleEntityNotFound(_0x53293d,null))[_0x0f47('0x34')](function(_0x1c7def){if(_0x1c7def){var _0x5ab65e=_0x1c7def[_0x0f47('0x66')]&&fs[_0x0f47('0x6d')](path[_0x0f47('0x5a')](config[_0x0f47('0x5b')],_0x5e9543,_['toLower'](_0x1c7def['loginLogo'])))?path['join'](config[_0x0f47('0x5b')],_0x5e9543,_[_0x0f47('0x6e')](_0x1c7def[_0x0f47('0x66')])):path[_0x0f47('0x5a')](config['root'],_0x5e9543,_[_0x0f47('0x6e')](_0x0f47('0x74')));var _0x12409d=_0x0f47('0x75')+_['upperFirst']('loginLogo');if(_0x1c7def[_0x12409d]||!_0x139ad4[_0x0f47('0x76')]){_0x5ab65e=path['join'](config['root'],_0x5e9543,_[_0x0f47('0x6e')]('default_loginLogo.png'));}if(!fs[_0x0f47('0x6d')](_0x5ab65e)){throw new db[(_0x0f47('0x77'))][(_0x0f47('0x78'))](_0x0f47('0x71'));}return _0x53293d[_0x0f47('0x79')](_0x5ab65e);}})[_0x0f47('0x27')](handleError(_0x53293d,null));};exports[_0x0f47('0x7a')]=function(_0x54262d,_0x141c13){return db['Setting'][_0x0f47('0x56')]({'where':{'id':_0x54262d[_0x0f47('0x54')]['id']},'attributes':[_0x0f47('0x7b')]})['then'](respondWithResult(_0x141c13,null))[_0x0f47('0x27')](handleError(_0x141c13,null));};exports[_0x0f47('0x7c')]=function(_0x3b6620,_0x1c225f,_0x3b64ff){if(_0x3b6620['file']&&_0x3b6620[_0x0f47('0x62')][_0x0f47('0x63')]){_0x3b6620[_0x0f47('0x57')][_0x0f47('0x72')]=_0x3b6620[_0x0f47('0x62')][_0x0f47('0x63')];}return db[_0x0f47('0x39')][_0x0f47('0x56')]({'where':{'id':_0x3b6620[_0x0f47('0x54')]['id']}})[_0x0f47('0x34')](handleEntityNotFound(_0x1c225f,null))['then'](saveUpdates(_0x3b6620[_0x0f47('0x57')],null))[_0x0f47('0x34')](respondWithResult(_0x1c225f,null))[_0x0f47('0x27')](handleError(_0x1c225f,null));};var utilLicense=require('../../config/license/util');exports[_0x0f47('0x7d')]=function(_0x5f0896,_0x1a1d03,_0x44502a){var _0x6f8325=_0x0f47('0x69');var _0x300b43={'custom':![]};return utilLicense[_0x0f47('0x6a')]()[_0x0f47('0x34')](function(_0x3eef57){if(_0x3eef57){_0x300b43=_0x3eef57;}return db[_0x0f47('0x39')][_0x0f47('0x56')]({'where':{'id':_0x5f0896[_0x0f47('0x54')]['id']},'attributes':['logo','loginLogo',_0x0f47('0x72'),_0x0f47('0x6b'),'defaultLoginLogo',_0x0f47('0x6c')],'raw':!![]});})['then'](handleEntityNotFound(_0x1a1d03,null))['then'](function(_0x152464){if(_0x152464){var _0x42aa42=_0x152464[_0x0f47('0x72')]&&fs['existsSync'](path['join'](config[_0x0f47('0x5b')],_0x6f8325,_[_0x0f47('0x6e')](_0x152464['preferred'])))?path[_0x0f47('0x5a')](config[_0x0f47('0x5b')],_0x6f8325,_[_0x0f47('0x6e')](_0x152464[_0x0f47('0x72')])):path[_0x0f47('0x5a')](config[_0x0f47('0x5b')],_0x6f8325,_['toLower'](_0x0f47('0x7e')));var _0x20d82c='default'+_[_0x0f47('0x70')](_0x0f47('0x72'));if(_0x152464[_0x20d82c]||!_0x300b43[_0x0f47('0x76')]||!_0x300b43['preferred']){_0x42aa42=path['join'](config[_0x0f47('0x5b')],_0x6f8325,_['toLower']('default_preferred.png'));}if(!fs['existsSync'](_0x42aa42)){throw new db['Sequelize'][(_0x0f47('0x78'))](_0x0f47('0x71'));}return _0x1a1d03['download'](_0x42aa42);}})[_0x0f47('0x27')](handleError(_0x1a1d03,null));};
\ No newline at end of file
index 03c1047..31539ed 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd6cc=['./setting.attributes','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x149a9b,_0x5bb275){var _0x2c2bf6=function(_0xfe0c14){while(--_0xfe0c14){_0x149a9b['push'](_0x149a9b['shift']());}};_0x2c2bf6(++_0x5bb275);}(_0xd6cc,0x16c));var _0xcd6c=function(_0x17e74a,_0x26b6c1){_0x17e74a=_0x17e74a-0x0;var _0x3dd6c5=_0xd6cc[_0x17e74a];return _0x3dd6c5;};'use strict';var _=require(_0xcd6c('0x0'));var util=require('util');var logger=require(_0xcd6c('0x1'))(_0xcd6c('0x2'));var moment=require(_0xcd6c('0x3'));var BPromise=require(_0xcd6c('0x4'));var rp=require(_0xcd6c('0x5'));var attributes=require(_0xcd6c('0x6'));module['exports']=function(_0x1183e0,_0xc2b44a){return _0x1183e0[_0xcd6c('0x7')](_0xcd6c('0x8'),attributes,{'tableName':_0xcd6c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x1939=['Setting','settings','../../config/logger','api','moment','bluebird','request-promise','./setting.attributes','exports','define'];(function(_0x36bf46,_0x3d8db9){var _0x1d0a72=function(_0x328e8d){while(--_0x328e8d){_0x36bf46['push'](_0x36bf46['shift']());}};_0x1d0a72(++_0x3d8db9);}(_0x1939,0x66));var _0x9193=function(_0x159468,_0x19e94c){_0x159468=_0x159468-0x0;var _0x2d9008=_0x1939[_0x159468];return _0x2d9008;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9193('0x0'))(_0x9193('0x1'));var moment=require(_0x9193('0x2'));var BPromise=require(_0x9193('0x3'));var rp=require(_0x9193('0x4'));var attributes=require(_0x9193('0x5'));module[_0x9193('0x6')]=function(_0x5b675d,_0x30e0bf){return _0x5b675d[_0x9193('0x7')](_0x9193('0x8'),attributes,{'tableName':_0x9193('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 394daaf..0a31c4e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc8e6=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','Setting,\x20%s,\x20%s','message','info','catch'];(function(_0x540ecc,_0x3dab5d){var _0x1ad207=function(_0x17989d){while(--_0x17989d){_0x540ecc['push'](_0x540ecc['shift']());}};_0x1ad207(++_0x3dab5d);}(_0xc8e6,0xf2));var _0x6c8e=function(_0x115fc9,_0x22021c){_0x115fc9=_0x115fc9-0x0;var _0x2d4bc2=_0xc8e6[_0x115fc9];return _0x2d4bc2;};'use strict';var _=require(_0x6c8e('0x0'));var util=require(_0x6c8e('0x1'));var moment=require(_0x6c8e('0x2'));var BPromise=require(_0x6c8e('0x3'));var rs=require(_0x6c8e('0x4'));var fs=require('fs');var Redis=require(_0x6c8e('0x5'));var db=require(_0x6c8e('0x6'))['db'];var utils=require(_0x6c8e('0x7'));var logger=require(_0x6c8e('0x8'))(_0x6c8e('0x9'));var config=require('../../config/environment');var jayson=require(_0x6c8e('0xa'));var client=jayson[_0x6c8e('0xb')][_0x6c8e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4194e8,_0x42def4,_0x29ba48){return new BPromise(function(_0x50f695,_0xedd697){return client[_0x6c8e('0xd')](_0x4194e8,_0x29ba48)[_0x6c8e('0xe')](function(_0x5bbc07){logger['info']('Setting,\x20%s,\x20%s',_0x42def4,_0x6c8e('0xf'));logger['debug'](_0x6c8e('0x10'),_0x42def4,'request\x20sent',JSON['stringify'](_0x5bbc07));if(_0x5bbc07[_0x6c8e('0x11')]){if(_0x5bbc07[_0x6c8e('0x11')]['code']===0x1f4){logger['error'](_0x6c8e('0x12'),_0x42def4,_0x5bbc07[_0x6c8e('0x11')][_0x6c8e('0x13')]);return _0xedd697(_0x5bbc07[_0x6c8e('0x11')][_0x6c8e('0x13')]);}logger['error'](_0x6c8e('0x12'),_0x42def4,_0x5bbc07['error'][_0x6c8e('0x13')]);return _0x50f695(_0x5bbc07[_0x6c8e('0x11')][_0x6c8e('0x13')]);}else{logger[_0x6c8e('0x14')](_0x6c8e('0x12'),_0x42def4,'request\x20sent');_0x50f695(_0x5bbc07['result'][_0x6c8e('0x13')]);}})[_0x6c8e('0x15')](function(_0x5e3be3){logger[_0x6c8e('0x11')]('Setting,\x20%s,\x20%s',_0x42def4,_0x5e3be3);_0xedd697(_0x5e3be3);});});}
\ No newline at end of file
+var _0x8bf3=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3defef,_0x520ee3){var _0x319e86=function(_0x576a34){while(--_0x576a34){_0x3defef['push'](_0x3defef['shift']());}};_0x319e86(++_0x520ee3);}(_0x8bf3,0x130));var _0x38bf=function(_0x38110e,_0x33ddf2){_0x38110e=_0x38110e-0x0;var _0x301557=_0x8bf3[_0x38110e];return _0x301557;};'use strict';var _=require(_0x38bf('0x0'));var util=require(_0x38bf('0x1'));var moment=require(_0x38bf('0x2'));var BPromise=require(_0x38bf('0x3'));var rs=require(_0x38bf('0x4'));var fs=require('fs');var Redis=require(_0x38bf('0x5'));var db=require(_0x38bf('0x6'))['db'];var utils=require(_0x38bf('0x7'));var logger=require(_0x38bf('0x8'))('rpc');var config=require(_0x38bf('0x9'));var jayson=require(_0x38bf('0xa'));var client=jayson[_0x38bf('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42404a,_0x5ae702,_0x2015c3){return new BPromise(function(_0xb62e53,_0x231fcd){return client[_0x38bf('0xc')](_0x42404a,_0x2015c3)[_0x38bf('0xd')](function(_0x7b13f9){logger[_0x38bf('0xe')](_0x38bf('0xf'),_0x5ae702,_0x38bf('0x10'));logger[_0x38bf('0x11')]('Setting,\x20%s,\x20%s,\x20%s',_0x5ae702,'request\x20sent',JSON[_0x38bf('0x12')](_0x7b13f9));if(_0x7b13f9[_0x38bf('0x13')]){if(_0x7b13f9[_0x38bf('0x13')][_0x38bf('0x14')]===0x1f4){logger[_0x38bf('0x13')](_0x38bf('0xf'),_0x5ae702,_0x7b13f9[_0x38bf('0x13')][_0x38bf('0x15')]);return _0x231fcd(_0x7b13f9[_0x38bf('0x13')]['message']);}logger[_0x38bf('0x13')](_0x38bf('0xf'),_0x5ae702,_0x7b13f9[_0x38bf('0x13')][_0x38bf('0x15')]);return _0xb62e53(_0x7b13f9[_0x38bf('0x13')][_0x38bf('0x15')]);}else{logger[_0x38bf('0xe')](_0x38bf('0xf'),_0x5ae702,'request\x20sent');_0xb62e53(_0x7b13f9['result'][_0x38bf('0x15')]);}})[_0x38bf('0x16')](function(_0x5173e2){logger[_0x38bf('0x13')](_0x38bf('0xf'),_0x5ae702,_0x5173e2);_0x231fcd(_0x5173e2);});});}
\ No newline at end of file
index 7451686..76bdf67 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4743=['/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','post','create','addDisposition','/:id/notify','notify','addApplications','/:id/send','status','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','isAuthenticated','get','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications'];(function(_0xd766e0,_0x366027){var _0x31e7ca=function(_0x506ee9){while(--_0x506ee9){_0xd766e0['push'](_0xd766e0['shift']());}};_0x31e7ca(++_0x366027);}(_0x4743,0x173));var _0x3474=function(_0x12399a,_0x2462c2){_0x12399a=_0x12399a-0x0;var _0x590db3=_0x4743[_0x12399a];return _0x590db3;};'use strict';var multer=require(_0x3474('0x0'));var util=require(_0x3474('0x1'));var path=require(_0x3474('0x2'));var timeout=require(_0x3474('0x3'));var express=require(_0x3474('0x4'));var router=express[_0x3474('0x5')]();var auth=require(_0x3474('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3474('0x7'));var controller=require(_0x3474('0x8'));router['get']('/',auth[_0x3474('0x9')](),controller['index']);router[_0x3474('0xa')](_0x3474('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x3474('0xa')](_0x3474('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x3474('0xa')](_0x3474('0xd'),auth[_0x3474('0x9')](),controller[_0x3474('0xe')]);router['get'](_0x3474('0xf'),auth[_0x3474('0x9')](),controller[_0x3474('0x10')]);router['get'](_0x3474('0x11'),auth['isAuthenticated'](),controller[_0x3474('0x12')]);router[_0x3474('0xa')](_0x3474('0x13'),auth[_0x3474('0x9')](),controller[_0x3474('0x14')]);router[_0x3474('0xa')](_0x3474('0x15'),controller[_0x3474('0x16')]);router[_0x3474('0xa')](_0x3474('0x17'),auth['isAuthenticated'](),controller['getAgents']);router[_0x3474('0x18')]('/',auth[_0x3474('0x9')](),controller[_0x3474('0x19')]);router[_0x3474('0x18')](_0x3474('0xd'),auth[_0x3474('0x9')](),controller[_0x3474('0x1a')]);router[_0x3474('0x18')](_0x3474('0xf'),auth[_0x3474('0x9')](),controller['addAnswer']);router[_0x3474('0x18')](_0x3474('0x1b'),controller[_0x3474('0x1c')]);router[_0x3474('0x18')](_0x3474('0x11'),auth[_0x3474('0x9')](),controller[_0x3474('0x1d')]);router[_0x3474('0x18')](_0x3474('0x1e'),auth[_0x3474('0x9')](),controller['send']);router[_0x3474('0x18')](_0x3474('0x15'),controller[_0x3474('0x1f')]);router[_0x3474('0x18')](_0x3474('0x17'),auth['isAuthenticated'](),controller[_0x3474('0x20')]);router[_0x3474('0x21')](_0x3474('0xc'),auth[_0x3474('0x9')](),controller[_0x3474('0x22')]);router[_0x3474('0x23')](_0x3474('0xc'),auth[_0x3474('0x9')](),controller[_0x3474('0x24')]);router['delete'](_0x3474('0xd'),auth[_0x3474('0x9')](),controller['removeDispositions']);router[_0x3474('0x23')](_0x3474('0xf'),auth[_0x3474('0x9')](),controller['removeAnswers']);router[_0x3474('0x23')](_0x3474('0x17'),auth[_0x3474('0x9')](),controller[_0x3474('0x25')]);module[_0x3474('0x26')]=router;
\ No newline at end of file
+var _0x0068=['removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','create','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','delete','destroy'];(function(_0x2c14e5,_0x36fc3f){var _0x2ffa4b=function(_0xad2b7){while(--_0xad2b7){_0x2c14e5['push'](_0x2c14e5['shift']());}};_0x2ffa4b(++_0x36fc3f);}(_0x0068,0xa0));var _0x8006=function(_0x56e4b7,_0x4c0b79){_0x56e4b7=_0x56e4b7-0x0;var _0x463c26=_0x0068[_0x56e4b7];return _0x463c26;};'use strict';var multer=require(_0x8006('0x0'));var util=require(_0x8006('0x1'));var path=require(_0x8006('0x2'));var timeout=require(_0x8006('0x3'));var express=require(_0x8006('0x4'));var router=express[_0x8006('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8006('0x6'));router[_0x8006('0x7')]('/',auth[_0x8006('0x8')](),controller[_0x8006('0x9')]);router[_0x8006('0x7')](_0x8006('0xa'),auth[_0x8006('0x8')](),controller[_0x8006('0xb')]);router[_0x8006('0x7')](_0x8006('0xc'),auth[_0x8006('0x8')](),controller['show']);router['get'](_0x8006('0xd'),auth[_0x8006('0x8')](),controller[_0x8006('0xe')]);router['get']('/:id/canned_answers',auth[_0x8006('0x8')](),controller[_0x8006('0xf')]);router[_0x8006('0x7')]('/:id/applications',auth['isAuthenticated'](),controller[_0x8006('0x10')]);router[_0x8006('0x7')](_0x8006('0x11'),auth[_0x8006('0x8')](),controller[_0x8006('0x12')]);router[_0x8006('0x7')](_0x8006('0x13'),controller[_0x8006('0x14')]);router[_0x8006('0x7')](_0x8006('0x15'),auth[_0x8006('0x8')](),controller[_0x8006('0x16')]);router[_0x8006('0x17')]('/',auth[_0x8006('0x8')](),controller[_0x8006('0x18')]);router[_0x8006('0x17')](_0x8006('0xd'),auth[_0x8006('0x8')](),controller['addDisposition']);router['post'](_0x8006('0x19'),auth[_0x8006('0x8')](),controller[_0x8006('0x1a')]);router[_0x8006('0x17')](_0x8006('0x1b'),controller[_0x8006('0x1c')]);router['post']('/:id/applications',auth[_0x8006('0x8')](),controller[_0x8006('0x1d')]);router[_0x8006('0x17')]('/:id/send',auth[_0x8006('0x8')](),controller[_0x8006('0x1e')]);router['post'](_0x8006('0x13'),controller[_0x8006('0x1f')]);router[_0x8006('0x17')](_0x8006('0x15'),auth[_0x8006('0x8')](),controller[_0x8006('0x20')]);router['put'](_0x8006('0xc'),auth[_0x8006('0x8')](),controller['update']);router[_0x8006('0x21')](_0x8006('0xc'),auth[_0x8006('0x8')](),controller[_0x8006('0x22')]);router[_0x8006('0x21')](_0x8006('0xd'),auth[_0x8006('0x8')](),controller[_0x8006('0x23')]);router['delete'](_0x8006('0x19'),auth[_0x8006('0x8')](),controller[_0x8006('0x24')]);router[_0x8006('0x21')](_0x8006('0x15'),auth['isAuthenticated'](),controller[_0x8006('0x25')]);module[_0x8006('0x26')]=router;
\ No newline at end of file
index 8fea556..827de41 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0f64=['BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','randomstring','exports','name','STRING','generate','ENUM','twilio','connectel','plivo','clickatell','csc','intelepeer','TEXT','Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}','INTEGER'];(function(_0x35acd8,_0x25e69){var _0x2d7fb9=function(_0x1d98fc){while(--_0x1d98fc){_0x35acd8['push'](_0x35acd8['shift']());}};_0x2d7fb9(++_0x25e69);}(_0x0f64,0x16b));var _0x40f6=function(_0x343b3f,_0x101674){_0x343b3f=_0x343b3f-0x0;var _0x4465a4=_0x0f64[_0x343b3f];return _0x4465a4;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x40f6('0x0'));module[_0x40f6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x40f6('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x40f6('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x40f6('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x40f6('0x3')],'defaultValue':function(){return rs[_0x40f6('0x4')]();}},'phone':{'type':Sequelize[_0x40f6('0x3')]},'type':{'type':Sequelize[_0x40f6('0x5')](_0x40f6('0x6'),'skebby',_0x40f6('0x7'),'clicksend',_0x40f6('0x8'),_0x40f6('0x9'),_0x40f6('0xa'),'infobip',_0x40f6('0xb'))},'accountSid':{'type':Sequelize[_0x40f6('0x3')]},'authId':{'type':Sequelize[_0x40f6('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x40f6('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x40f6('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x40f6('0x3')]},'senderString':{'type':Sequelize[_0x40f6('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x40f6('0x3')]},'notificationTemplate':{'type':Sequelize[_0x40f6('0xc')],'defaultValue':function(){return _0x40f6('0xd');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x40f6('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x40f6('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x40f6('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x40f6('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x40f6('0xe')],'comment':_0x40f6('0x10')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5906fa){if(!_0x5906fa)this['setDataValue'](_0x40f6('0x11'),null);this['setDataValue']('mandatoryDisposition',_0x5906fa);}}};
\ No newline at end of file
+var _0xae05=['skebby','connectel','plivo','csc','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM'];(function(_0x59aeb3,_0x32f513){var _0x3c6521=function(_0x1129b2){while(--_0x1129b2){_0x59aeb3['push'](_0x59aeb3['shift']());}};_0x3c6521(++_0x32f513);}(_0xae05,0x12a));var _0x5ae0=function(_0x54f859,_0x59d463){_0x54f859=_0x54f859-0x0;var _0x17a08b=_0xae05[_0x54f859];return _0x17a08b;};'use strict';var Sequelize=require(_0x5ae0('0x0'));var rs=require(_0x5ae0('0x1'));module[_0x5ae0('0x2')]={'name':{'type':Sequelize[_0x5ae0('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x5ae0('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x5ae0('0x3')],'defaultValue':function(){return rs[_0x5ae0('0x4')]();}},'phone':{'type':Sequelize[_0x5ae0('0x3')]},'type':{'type':Sequelize[_0x5ae0('0x5')]('twilio',_0x5ae0('0x6'),_0x5ae0('0x7'),'clicksend',_0x5ae0('0x8'),'clickatell',_0x5ae0('0x9'),'infobip',_0x5ae0('0xa'))},'accountSid':{'type':Sequelize[_0x5ae0('0x3')]},'authId':{'type':Sequelize[_0x5ae0('0x3')]},'authToken':{'type':Sequelize[_0x5ae0('0x3')]},'smsMethod':{'type':Sequelize[_0x5ae0('0x5')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x5ae0('0x3')]},'apiKey':{'type':Sequelize[_0x5ae0('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x5ae0('0xb')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x5ae0('0xc')],'defaultValue':function(){return _0x5ae0('0xd');}},'notificationSound':{'type':Sequelize[_0x5ae0('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5ae0('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5ae0('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5ae0('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5ae0('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5ae0('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x5ae0('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5ae0('0xe')],'comment':_0x5ae0('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x5ae0('0xb')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x41bdcc){if(!_0x41bdcc)this[_0x5ae0('0x10')](_0x5ae0('0x11'),null);this[_0x5ae0('0x10')](_0x5ae0('0x12'),_0x41bdcc);}}};
\ No newline at end of file
index fb8c458..ac558f2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1fe1=['replyMessageId','intelepeer','refid','Sequelize','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','list','omit','defaults','SmsInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','<?xml\x20version=\x221.0\x22\x20encoding=\x22UTF-8\x22?>\x0a<Response></Response>','addApplications','sequelize','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','Messages','dataValues','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','clickatell','redif','DELIVRD','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','register','jayson/promise','http','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','show','params','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','describe','SmsAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','findOne','pick','removeAnswers','notify','SmsApplication','account','applications','orderBy','priority','asc','Applications','CmContact','ValidationError','difference','createdAt','updatedAt','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','text','connectel','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','fromNumber'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1fe1,0x128));var _0x11fe=function(_0x528c98,_0x3f58be){_0x528c98=_0x528c98-0x0;var _0x5c9ae6=_0x1fe1[_0x528c98];return _0x5c9ae6;};'use strict';var pdf=require(_0x11fe('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x11fe('0x1'));var jsonpatch=require(_0x11fe('0x2'));var rp=require(_0x11fe('0x3'));var moment=require('moment');var BPromise=require(_0x11fe('0x4'));var Mustache=require('mustache');var util=require(_0x11fe('0x5'));var path=require(_0x11fe('0x6'));var sox=require(_0x11fe('0x7'));var csv=require(_0x11fe('0x8'));var ejs=require(_0x11fe('0x9'));var fs=require('fs');var _=require(_0x11fe('0xa'));var squel=require(_0x11fe('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x11fe('0xc'));var toCsv=require(_0x11fe('0x8'));var querystring=require(_0x11fe('0xd'));var Papa=require('papaparse');var authService=require(_0x11fe('0xe'));var hardwareService=require(_0x11fe('0xf'));var Redis=require(_0x11fe('0x10'));var qs=require(_0x11fe('0x11'));var logger=require(_0x11fe('0x12'))(_0x11fe('0x13'));var utils=require(_0x11fe('0x14'));var config=require(_0x11fe('0x15'));var db=require('../../mysqldb')['db'];config[_0x11fe('0x16')]=_['defaults'](config[_0x11fe('0x16')],{'host':_0x11fe('0x17'),'port':0x18eb});var socket=require(_0x11fe('0x18'))(new Redis(config[_0x11fe('0x16')]));require('./smsAccount.socket')[_0x11fe('0x19')](socket);var jayson=require(_0x11fe('0x1a'));var client=jayson['client'][_0x11fe('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x31bf2c,_0x2166d9,_0xb0a33e,_0x4fcb7f){return new BPromise(function(_0x2d810f,_0x42f326){var _0x3b2205=_0x4fcb7f||client;return _0x3b2205[_0x11fe('0x1c')](_0x31bf2c,_0xb0a33e)[_0x11fe('0x1d')](function(_0x3140ca){logger[_0x11fe('0x1e')]('SmsAccount,\x20%s,\x20%s',_0x2166d9,_0x11fe('0x1f'));logger[_0x11fe('0x20')](_0x11fe('0x21'),_0x2166d9,_0x11fe('0x1f'),JSON[_0x11fe('0x22')](_0x3140ca));if(_0x3140ca[_0x11fe('0x23')]){if(_0x3140ca['error']['code']===0x1f4){logger[_0x11fe('0x23')](_0x11fe('0x24'),_0x2166d9,_0x3140ca['error'][_0x11fe('0x25')]);return _0x42f326(_0x3140ca[_0x11fe('0x23')][_0x11fe('0x25')]);}logger[_0x11fe('0x23')](_0x11fe('0x24'),_0x2166d9,_0x3140ca['error'][_0x11fe('0x25')]);return _0x2d810f(_0x3140ca[_0x11fe('0x23')][_0x11fe('0x25')]);}else{logger['info'](_0x11fe('0x24'),_0x2166d9,_0x11fe('0x1f'));_0x2d810f(_0x3140ca[_0x11fe('0x26')][_0x11fe('0x25')]);}})[_0x11fe('0x27')](function(_0x16dbaa){logger[_0x11fe('0x23')](_0x11fe('0x24'),_0x2166d9,_0x16dbaa);_0x42f326(_0x16dbaa);});});}function respondWithStatusCode(_0x2b3bb8,_0x3bd21e){_0x3bd21e=_0x3bd21e||0xcc;return function(_0x414f67){if(_0x414f67){return _0x2b3bb8[_0x11fe('0x28')](_0x3bd21e);}return _0x2b3bb8[_0x11fe('0x29')](_0x3bd21e)['end']();};}function respondWithResult(_0x26384c,_0x334561){_0x334561=_0x334561||0xc8;return function(_0x1d77bf){if(_0x1d77bf){return _0x26384c[_0x11fe('0x29')](_0x334561)[_0x11fe('0x2a')](_0x1d77bf);}};}function respondWithFilteredResult(_0x361b4d,_0x19f505){return function(_0x119891){if(_0x119891){var _0x3d03a5=_0x119891[_0x11fe('0x2b')],_0x1869c5=_0x19f505[_0x11fe('0x2c')],_0x5a16fa=_0x19f505[_0x11fe('0x2c')]+_0x19f505[_0x11fe('0x2d')],_0x3b07b0;if(_0x5a16fa>=_0x3d03a5){_0x5a16fa=_0x3d03a5;_0x3b07b0=0xc8;}else{_0x3b07b0=0xce;}_0x361b4d[_0x11fe('0x29')](_0x3b07b0);return _0x361b4d[_0x11fe('0x2e')]('Content-Range',_0x1869c5+'-'+_0x5a16fa+'/'+_0x3d03a5)[_0x11fe('0x2a')](_0x119891);}return null;};}function patchUpdates(_0x29368a){return function(_0x1183df){try{jsonpatch[_0x11fe('0x2f')](_0x1183df,_0x29368a,!![]);}catch(_0x285597){return BPromise[_0x11fe('0x30')](_0x285597);}return _0x1183df[_0x11fe('0x31')]();};}function saveUpdates(_0x4f090e,_0x4e52a4){return function(_0x4fc43a){if(_0x4fc43a){return _0x4fc43a[_0x11fe('0x32')](_0x4f090e)[_0x11fe('0x1d')](function(_0x5d9ba2){return _0x5d9ba2;});}return null;};}function removeEntity(_0x45b5bf,_0x16ba45){return function(_0x3ff47b){if(_0x3ff47b){return _0x3ff47b[_0x11fe('0x33')]()[_0x11fe('0x1d')](function(){var _0x5d85df=_0x3ff47b[_0x11fe('0x34')]({'plain':!![]});var _0xeeab9=_0x11fe('0x35');return db[_0x11fe('0x36')][_0x11fe('0x33')]({'where':{'type':_0xeeab9,'resourceId':_0x5d85df['id']}})['then'](function(){return _0x3ff47b;});})[_0x11fe('0x1d')](function(){_0x45b5bf[_0x11fe('0x29')](0xcc)[_0x11fe('0x37')]();});}};}function handleEntityNotFound(_0x3f51d1,_0x5afc4d){return function(_0x42c9c0){if(!_0x42c9c0){_0x3f51d1[_0x11fe('0x28')](0x194);}return _0x42c9c0;};}function handleError(_0x4ca5b0,_0x242278){_0x242278=_0x242278||0x1f4;return function(_0x54a8ce){logger['error'](_0x54a8ce[_0x11fe('0x38')]);if(_0x54a8ce[_0x11fe('0x39')]){delete _0x54a8ce['name'];}_0x4ca5b0[_0x11fe('0x29')](_0x242278)[_0x11fe('0x3a')](_0x54a8ce);};}exports[_0x11fe('0x3b')]=function(_0x26e4f5,_0x3f4ef3){var _0x266780={'include':[{'model':db[_0x11fe('0x3c')],'as':_0x11fe('0x3d')}]},_0x664621={},_0x279fa2={'count':0x0,'rows':[]};var _0x45e394=db[_0x11fe('0x3e')][_0x11fe('0x3f')];_0x664621[_0x11fe('0x40')]=_[_0x11fe('0x41')](_0x45e394);_0x664621[_0x11fe('0x42')]=_[_0x11fe('0x41')](_0x26e4f5[_0x11fe('0x42')]);_0x664621[_0x11fe('0x43')]=_[_0x11fe('0x44')](_0x664621[_0x11fe('0x40')],_0x664621[_0x11fe('0x42')]);_0x266780[_0x11fe('0x45')]=_['intersection'](_0x664621[_0x11fe('0x40')],qs['fields'](_0x26e4f5[_0x11fe('0x42')][_0x11fe('0x46')]));_0x266780[_0x11fe('0x45')]=_0x266780['attributes'][_0x11fe('0x47')]?_0x266780[_0x11fe('0x45')]:_0x664621[_0x11fe('0x40')];if(!_0x26e4f5['query'][_0x11fe('0x48')](_0x11fe('0x49'))){_0x266780[_0x11fe('0x2d')]=qs['limit'](_0x26e4f5[_0x11fe('0x42')]['limit']);_0x266780[_0x11fe('0x2c')]=qs[_0x11fe('0x2c')](_0x26e4f5[_0x11fe('0x42')][_0x11fe('0x2c')]);}_0x266780[_0x11fe('0x4a')]=qs[_0x11fe('0x4b')](_0x26e4f5[_0x11fe('0x42')]['sort']);_0x266780[_0x11fe('0x4c')]=qs[_0x11fe('0x43')](_['pick'](_0x26e4f5['query'],_0x664621[_0x11fe('0x43')]));if(_0x26e4f5['query'][_0x11fe('0x4d')]){_0x266780['where']=_[_0x11fe('0x4e')](_0x266780[_0x11fe('0x4c')],{'$or':_[_0x11fe('0x4f')](_0x45e394,function(_0x20564e){if(_0x20564e[_0x11fe('0x50')][_0x11fe('0x51')]!==_0x11fe('0x52')){var _0x2fb6be={};_0x2fb6be[_0x20564e[_0x11fe('0x53')]]={'$like':'%'+_0x26e4f5['query']['filter']+'%'};return _0x2fb6be;}})});}_0x266780=_[_0x11fe('0x4e')]({},_0x266780,_0x26e4f5[_0x11fe('0x54')]);var _0x4a29ba={'where':_0x266780['where']};return db[_0x11fe('0x3e')][_0x11fe('0x2b')](_0x4a29ba)[_0x11fe('0x1d')](function(_0x34e9fc){_0x279fa2['count']=_0x34e9fc;if(_0x26e4f5['query'][_0x11fe('0x55')]){_0x266780[_0x11fe('0x56')]=[{'all':!![]}];}return db[_0x11fe('0x3e')][_0x11fe('0x57')](_0x266780);})[_0x11fe('0x1d')](function(_0xaa6d1f){_0x279fa2[_0x11fe('0x58')]=_0xaa6d1f;return _0x279fa2;})['then'](respondWithFilteredResult(_0x3f4ef3,_0x266780))[_0x11fe('0x27')](handleError(_0x3f4ef3,null));};exports[_0x11fe('0x59')]=function(_0x1e979a,_0x42706a){var _0x294701={'raw':![],'where':{'id':_0x1e979a[_0x11fe('0x5a')]['id']},'include':[{'model':db[_0x11fe('0x3c')],'as':_0x11fe('0x3d')}]},_0x2448e7={};_0x2448e7[_0x11fe('0x40')]=_[_0x11fe('0x41')](db[_0x11fe('0x3e')][_0x11fe('0x3f')]);_0x2448e7[_0x11fe('0x42')]=_[_0x11fe('0x41')](_0x1e979a[_0x11fe('0x42')]);_0x2448e7[_0x11fe('0x43')]=_[_0x11fe('0x44')](_0x2448e7[_0x11fe('0x40')],_0x2448e7[_0x11fe('0x42')]);_0x294701[_0x11fe('0x45')]=_['intersection'](_0x2448e7[_0x11fe('0x40')],qs[_0x11fe('0x46')](_0x1e979a[_0x11fe('0x42')]['fields']));_0x294701[_0x11fe('0x45')]=_0x294701[_0x11fe('0x45')][_0x11fe('0x47')]?_0x294701[_0x11fe('0x45')]:_0x2448e7[_0x11fe('0x40')];if(_0x1e979a['query'][_0x11fe('0x55')]){_0x294701[_0x11fe('0x56')]=[{'all':!![]}];}_0x294701=_['merge']({},_0x294701,_0x1e979a['options']);return db[_0x11fe('0x3e')][_0x11fe('0x5b')](_0x294701)[_0x11fe('0x1d')](handleEntityNotFound(_0x42706a,null))[_0x11fe('0x1d')](respondWithResult(_0x42706a,null))[_0x11fe('0x27')](handleError(_0x42706a,null));};exports[_0x11fe('0x5c')]=function(_0x1f67f3,_0x40a9f4){return db[_0x11fe('0x3e')][_0x11fe('0x5c')](_0x1f67f3[_0x11fe('0x5d')],{})[_0x11fe('0x1d')](function(_0x183627){var _0x4f6325=_0x1f67f3[_0x11fe('0x5e')][_0x11fe('0x34')]({'plain':!![]});if(!_0x4f6325)throw new Error(_0x11fe('0x5f'));if(_0x4f6325[_0x11fe('0x60')]===_0x11fe('0x5e')){var _0x22995a=_0x183627['get']({'plain':!![]});var _0x2909a8=_0x11fe('0x35');return db[_0x11fe('0x61')][_0x11fe('0x5b')]({'where':{'name':_0x2909a8,'userProfileId':_0x4f6325[_0x11fe('0x62')]},'raw':!![]})[_0x11fe('0x1d')](function(_0x226a9e){if(_0x226a9e&&_0x226a9e[_0x11fe('0x63')]===0x0){return db[_0x11fe('0x36')][_0x11fe('0x5c')]({'name':_0x22995a[_0x11fe('0x39')],'resourceId':_0x22995a['id'],'type':_0x226a9e[_0x11fe('0x39')],'sectionId':_0x226a9e['id']},{})['then'](function(){return _0x183627;});}else{return _0x183627;}})[_0x11fe('0x27')](function(_0x1f6427){logger[_0x11fe('0x23')](_0x11fe('0x64'),_0x1f6427);throw _0x1f6427;});}return _0x183627;})[_0x11fe('0x1d')](respondWithResult(_0x40a9f4,0xc9))[_0x11fe('0x27')](handleError(_0x40a9f4,null));};exports[_0x11fe('0x32')]=function(_0x1d3e5e,_0x85df60){if(_0x1d3e5e[_0x11fe('0x5d')]['id']){delete _0x1d3e5e['body']['id'];}return db[_0x11fe('0x3e')][_0x11fe('0x5b')]({'where':{'id':_0x1d3e5e[_0x11fe('0x5a')]['id']},'include':[{'model':db[_0x11fe('0x3c')],'as':_0x11fe('0x3d')}]})['then'](handleEntityNotFound(_0x85df60,null))['then'](saveUpdates(_0x1d3e5e[_0x11fe('0x5d')],null))['then'](function(_0x318727){if(_0x318727&&_0x1d3e5e[_0x11fe('0x5d')][_0x11fe('0x3d')]){return db[_0x11fe('0x3c')][_0x11fe('0x32')](_0x1d3e5e[_0x11fe('0x5d')]['mandatoryDispositionPause'],{'where':{'SmsAccountId':_0x318727['id']}})[_0x11fe('0x1d')](function(){return _0x318727;});}return _0x318727;})[_0x11fe('0x1d')](respondWithResult(_0x85df60,null))[_0x11fe('0x27')](handleError(_0x85df60,null));};exports['destroy']=function(_0xb169f6,_0x2571b4){return db[_0x11fe('0x3e')][_0x11fe('0x5b')]({'where':{'id':_0xb169f6[_0x11fe('0x5a')]['id']}})[_0x11fe('0x1d')](handleEntityNotFound(_0x2571b4,null))['then'](removeEntity(_0x2571b4,null))['catch'](handleError(_0x2571b4,null));};exports[_0x11fe('0x65')]=function(_0x55dd93,_0x26d9be){return db[_0x11fe('0x3e')][_0x11fe('0x65')]()[_0x11fe('0x1d')](respondWithResult(_0x26d9be,null))[_0x11fe('0x27')](handleError(_0x26d9be,null));};exports['addDisposition']=function(_0x1d6ce0,_0x1ed979,_0x4a4190){if(_0x1d6ce0[_0x11fe('0x5d')]['id']){delete _0x1d6ce0['body']['id'];}return db[_0x11fe('0x3e')][_0x11fe('0x5b')]({'where':{'id':_0x1d6ce0['params']['id']}})[_0x11fe('0x1d')](handleEntityNotFound(_0x1ed979,null))[_0x11fe('0x1d')](function(_0x56969d){if(_0x56969d){_0x1d6ce0[_0x11fe('0x5d')][_0x11fe('0x66')]=_0x56969d['id'];return db[_0x11fe('0x67')][_0x11fe('0x5c')](_0x1d6ce0[_0x11fe('0x5d')]);}})[_0x11fe('0x1d')](respondWithResult(_0x1ed979,null))[_0x11fe('0x27')](handleError(_0x1ed979,null));};exports[_0x11fe('0x68')]=function(_0x3b13cd,_0x11f85e,_0x3bac4f){var _0x2731eb={'raw':![],'where':{}};var _0x444582={};var _0x3950be={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x3b13cd[_0x11fe('0x5a')]['id']}})[_0x11fe('0x1d')](handleEntityNotFound(_0x11f85e,null))[_0x11fe('0x1d')](function(_0x37e602){if(_0x37e602){_0x444582['model']=_['keys'](db['Disposition']['rawAttributes']);_0x444582[_0x11fe('0x42')]=_[_0x11fe('0x41')](_0x3b13cd[_0x11fe('0x42')]);_0x444582[_0x11fe('0x43')]=_['intersection'](_0x444582[_0x11fe('0x40')],_0x444582[_0x11fe('0x42')]);_0x2731eb['attributes']=_[_0x11fe('0x44')](_0x444582[_0x11fe('0x40')],qs['fields'](_0x3b13cd['query'][_0x11fe('0x46')]));_0x2731eb[_0x11fe('0x45')]=_0x2731eb[_0x11fe('0x45')][_0x11fe('0x47')]?_0x2731eb['attributes']:_0x444582[_0x11fe('0x40')];if(!_0x3b13cd[_0x11fe('0x42')][_0x11fe('0x48')]('nolimit')){_0x2731eb[_0x11fe('0x2d')]=qs[_0x11fe('0x2d')](_0x3b13cd[_0x11fe('0x42')][_0x11fe('0x2d')]);_0x2731eb[_0x11fe('0x2c')]=qs['offset'](_0x3b13cd['query']['offset']);}_0x2731eb[_0x11fe('0x4a')]=qs[_0x11fe('0x4b')](_0x3b13cd[_0x11fe('0x42')][_0x11fe('0x4b')]);_0x2731eb['where']=qs[_0x11fe('0x43')](_['pick'](_0x3b13cd[_0x11fe('0x42')],_0x444582[_0x11fe('0x43')]));_0x2731eb[_0x11fe('0x4c')][_0x11fe('0x66')]=_0x37e602['id'];if(_0x3b13cd[_0x11fe('0x42')][_0x11fe('0x4d')]){_0x2731eb[_0x11fe('0x4c')]=_[_0x11fe('0x4e')](_0x2731eb[_0x11fe('0x4c')],{'$or':_['map'](_0x2731eb[_0x11fe('0x45')],function(_0x2a254b){var _0x5cfcad={};_0x5cfcad[_0x2a254b]={'$like':'%'+_0x3b13cd['query'][_0x11fe('0x4d')]+'%'};return _0x5cfcad;})});}_0x2731eb=_[_0x11fe('0x4e')]({},_0x2731eb,_0x3b13cd[_0x11fe('0x54')]);return db[_0x11fe('0x67')][_0x11fe('0x2b')]({'where':_0x2731eb[_0x11fe('0x4c')]})[_0x11fe('0x1d')](function(_0x544254){_0x3950be[_0x11fe('0x2b')]=_0x544254;if(_0x3b13cd[_0x11fe('0x42')][_0x11fe('0x55')]){_0x2731eb[_0x11fe('0x56')]=[{'all':!![]}];}return db[_0x11fe('0x67')]['findAll'](_0x2731eb);})[_0x11fe('0x1d')](function(_0x78ee5d){_0x3950be['rows']=_0x78ee5d;return _0x3950be;});}})[_0x11fe('0x1d')](respondWithFilteredResult(_0x11f85e,_0x2731eb))[_0x11fe('0x27')](handleError(_0x11f85e,null));};exports[_0x11fe('0x69')]=function(_0x1ab650,_0x119012,_0x4713dc){var _0xd5c2c2;return db['SmsAccount'][_0x11fe('0x5b')]({'where':{'id':_0x1ab650['params']['id']}})['then'](handleEntityNotFound(_0x119012,null))[_0x11fe('0x1d')](function(_0x1c7b05){if(_0x1c7b05){return _0x1c7b05['removeDispositions'](_0x1ab650[_0x11fe('0x42')][_0x11fe('0x6a')]);}})[_0x11fe('0x1d')](respondWithStatusCode(_0x119012,null))[_0x11fe('0x27')](handleError(_0x119012,null));};exports[_0x11fe('0x6b')]=function(_0x5d8a76,_0x1b7b32,_0x215b12){if(_0x5d8a76['body']['id']){delete _0x5d8a76[_0x11fe('0x5d')]['id'];}return db['SmsAccount'][_0x11fe('0x5b')]({'where':{'id':_0x5d8a76[_0x11fe('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1b7b32,null))['then'](function(_0x1ba42e){if(_0x1ba42e){_0x5d8a76[_0x11fe('0x5d')]['SmsAccountId']=_0x1ba42e['id'];return db[_0x11fe('0x6c')][_0x11fe('0x5c')](_0x5d8a76[_0x11fe('0x5d')]);}})[_0x11fe('0x1d')](respondWithResult(_0x1b7b32,null))[_0x11fe('0x27')](handleError(_0x1b7b32,null));};exports['getAnswers']=function(_0x5f0181,_0x643636,_0x44ea3b){var _0x4a458c={'raw':![],'where':{}};var _0x49f14a={};var _0x3d2933={'count':0x0,'rows':[]};return db['SmsAccount'][_0x11fe('0x6d')]({'where':{'id':_0x5f0181[_0x11fe('0x5a')]['id']}})[_0x11fe('0x1d')](handleEntityNotFound(_0x643636,null))[_0x11fe('0x1d')](function(_0x2f075a){if(_0x2f075a){_0x49f14a['model']=_['keys'](db['CannedAnswer']['rawAttributes']);_0x49f14a[_0x11fe('0x42')]=_[_0x11fe('0x41')](_0x5f0181[_0x11fe('0x42')]);_0x49f14a[_0x11fe('0x43')]=_[_0x11fe('0x44')](_0x49f14a[_0x11fe('0x40')],_0x49f14a['query']);_0x4a458c[_0x11fe('0x45')]=_[_0x11fe('0x44')](_0x49f14a['model'],qs[_0x11fe('0x46')](_0x5f0181['query'][_0x11fe('0x46')]));_0x4a458c['attributes']=_0x4a458c[_0x11fe('0x45')]['length']?_0x4a458c[_0x11fe('0x45')]:_0x49f14a[_0x11fe('0x40')];if(!_0x5f0181['query']['hasOwnProperty'](_0x11fe('0x49'))){_0x4a458c['limit']=qs[_0x11fe('0x2d')](_0x5f0181[_0x11fe('0x42')][_0x11fe('0x2d')]);_0x4a458c[_0x11fe('0x2c')]=qs['offset'](_0x5f0181[_0x11fe('0x42')][_0x11fe('0x2c')]);}_0x4a458c[_0x11fe('0x4a')]=qs['sort'](_0x5f0181[_0x11fe('0x42')][_0x11fe('0x4b')]);_0x4a458c[_0x11fe('0x4c')]=qs[_0x11fe('0x43')](_[_0x11fe('0x6e')](_0x5f0181[_0x11fe('0x42')],_0x49f14a[_0x11fe('0x43')]));_0x4a458c['where'][_0x11fe('0x66')]=_0x2f075a['id'];if(_0x5f0181[_0x11fe('0x42')][_0x11fe('0x4d')]){_0x4a458c['where']=_[_0x11fe('0x4e')](_0x4a458c[_0x11fe('0x4c')],{'$or':_[_0x11fe('0x4f')](_0x4a458c[_0x11fe('0x45')],function(_0x2491a7){var _0x85a390={};_0x85a390[_0x2491a7]={'$like':'%'+_0x5f0181[_0x11fe('0x42')][_0x11fe('0x4d')]+'%'};return _0x85a390;})});}_0x4a458c=_[_0x11fe('0x4e')]({},_0x4a458c,_0x5f0181[_0x11fe('0x54')]);return db['CannedAnswer'][_0x11fe('0x2b')]({'where':_0x4a458c[_0x11fe('0x4c')]})[_0x11fe('0x1d')](function(_0x8c1469){_0x3d2933[_0x11fe('0x2b')]=_0x8c1469;if(_0x5f0181[_0x11fe('0x42')][_0x11fe('0x55')]){_0x4a458c[_0x11fe('0x56')]=[{'all':!![]}];}return db[_0x11fe('0x6c')][_0x11fe('0x57')](_0x4a458c);})[_0x11fe('0x1d')](function(_0x491700){_0x3d2933[_0x11fe('0x58')]=_0x491700;return _0x3d2933;});}})[_0x11fe('0x1d')](respondWithFilteredResult(_0x643636,_0x4a458c))[_0x11fe('0x27')](handleError(_0x643636,null));};exports[_0x11fe('0x6f')]=function(_0x39ac61,_0x21fe7c,_0x5ee40f){var _0x1ed2e3;return db[_0x11fe('0x3e')]['find']({'where':{'id':_0x39ac61[_0x11fe('0x5a')]['id']}})[_0x11fe('0x1d')](handleEntityNotFound(_0x21fe7c,null))['then'](function(_0x2ac277){if(_0x2ac277){return _0x2ac277[_0x11fe('0x6f')](_0x39ac61[_0x11fe('0x42')][_0x11fe('0x6a')]);}})[_0x11fe('0x1d')](respondWithStatusCode(_0x21fe7c,null))[_0x11fe('0x27')](handleError(_0x21fe7c,null));};exports[_0x11fe('0x70')]=function(_0x1c04fb,_0x49c29f,_0x2c5104){var _0x5c76e3={'channel':'sms'};var _0x315e77=[];var _0x2ecaec=[];var _0x54b7ad={};return db['SmsAccount']['find']({'where':{'id':_0x1c04fb['params']['id']},'include':[{'model':db[_0x11fe('0x71')],'as':'Applications'}]})[_0x11fe('0x1d')](handleEntityNotFound(_0x49c29f,null))[_0x11fe('0x1d')](function(_0x5e63a5){_0x5c76e3[_0x11fe('0x72')]=_0x5e63a5;_0x5c76e3[_0x11fe('0x73')]=_[_0x11fe('0x74')](_0x5e63a5['Applications'],[_0x11fe('0x75')],[_0x11fe('0x76')]);if(_0x5c76e3['account'][_0x11fe('0x77')]){delete _0x5c76e3[_0x11fe('0x72')][_0x11fe('0x77')];}return db[_0x11fe('0x78')]['describe']();})['then'](function(_0x111ee5){if(!_0x111ee5){throw new db['Sequelize'][(_0x11fe('0x79'))]('no\x20available\x20attributes');}_0x315e77=_[_0x11fe('0x7a')](_[_0x11fe('0x41')](_0x111ee5),[_0x11fe('0x7b'),_0x11fe('0x7c')]);_0x2ecaec=_[_0x11fe('0x7a')](_[_0x11fe('0x41')](_0x111ee5),[_0x11fe('0x7b'),_0x11fe('0x7c'),'CompanyId',_0x11fe('0x7d')]);_0x5c76e3[_0x11fe('0x5d')]={'mapKey':_0x11fe('0x7e')};if(_0x5c76e3[_0x11fe('0x72')][_0x11fe('0x50')]){switch(_0x5c76e3[_0x11fe('0x72')]['type']){case _0x11fe('0x7f'):_0x5c76e3['body'][_0x11fe('0x80')]=_0x1c04fb['body']['From'];_0x5c76e3[_0x11fe('0x5d')][_0x11fe('0x5d')]=_0x1c04fb[_0x11fe('0x5d')][_0x11fe('0x81')];_0x5c76e3['body'][_0x11fe('0x82')]=_0x1c04fb['body'][_0x11fe('0x83')];break;case _0x11fe('0x84'):_0x5c76e3['body'][_0x11fe('0x80')]='+'+_0x1c04fb[_0x11fe('0x5d')]['sender'];_0x5c76e3['body'][_0x11fe('0x5d')]=_0x1c04fb['body'][_0x11fe('0x85')];break;case _0x11fe('0x86'):_0x5c76e3[_0x11fe('0x5d')][_0x11fe('0x80')]=_0x1c04fb[_0x11fe('0x5d')][_0x11fe('0x80')];_0x5c76e3[_0x11fe('0x5d')]['body']=_0x1c04fb[_0x11fe('0x5d')][_0x11fe('0x25')];break;case _0x11fe('0x87'):_0x5c76e3[_0x11fe('0x5d')][_0x11fe('0x80')]=_0x1c04fb[_0x11fe('0x5d')]['from'];_0x5c76e3[_0x11fe('0x5d')][_0x11fe('0x5d')]=_0x1c04fb[_0x11fe('0x5d')][_0x11fe('0x5d')];_0x5c76e3[_0x11fe('0x5d')][_0x11fe('0x82')]=_0x1c04fb[_0x11fe('0x5d')][_0x11fe('0x88')];break;case _0x11fe('0x89'):_0x5c76e3[_0x11fe('0x5d')][_0x11fe('0x80')]=_0x1c04fb[_0x11fe('0x5d')]['From'];_0x5c76e3[_0x11fe('0x5d')][_0x11fe('0x5d')]=_0x1c04fb[_0x11fe('0x5d')][_0x11fe('0x8a')];_0x5c76e3[_0x11fe('0x5d')]['messageId']=_0x1c04fb[_0x11fe('0x5d')][_0x11fe('0x8b')];break;case _0x11fe('0x8c'):_0x5c76e3[_0x11fe('0x5d')][_0x11fe('0x80')]='+'+_0x1c04fb[_0x11fe('0x5d')][_0x11fe('0x8d')][0x0][_0x11fe('0x80')];_0x5c76e3[_0x11fe('0x5d')][_0x11fe('0x5d')]=_0x1c04fb[_0x11fe('0x5d')][_0x11fe('0x8d')][0x0][_0x11fe('0x85')];_0x5c76e3['body'][_0x11fe('0x82')]=_0x1c04fb[_0x11fe('0x5d')][_0x11fe('0x8d')][0x0][_0x11fe('0x82')];break;case _0x11fe('0x8e'):_0x5c76e3[_0x11fe('0x5d')][_0x11fe('0x80')]=_0x1c04fb[_0x11fe('0x5d')][_0x11fe('0x8f')];_0x5c76e3[_0x11fe('0x5d')][_0x11fe('0x5d')]=_0x1c04fb[_0x11fe('0x5d')][_0x11fe('0x90')]['message'];break;case'clickatell':_0x5c76e3[_0x11fe('0x5d')][_0x11fe('0x80')]=_0x1c04fb[_0x11fe('0x5d')][_0x11fe('0x91')];_0x5c76e3[_0x11fe('0x5d')]['body']=_0x1c04fb[_0x11fe('0x5d')][_0x11fe('0x85')];_0x5c76e3[_0x11fe('0x5d')]['messageId']=_0x1c04fb['body'][_0x11fe('0x92')];break;case _0x11fe('0x93'):_0x5c76e3[_0x11fe('0x5d')]['from']=_0x1c04fb[_0x11fe('0x5d')]['from'];_0x5c76e3[_0x11fe('0x5d')]['body']=_0x1c04fb[_0x11fe('0x5d')][_0x11fe('0x25')];_0x5c76e3[_0x11fe('0x5d')][_0x11fe('0x82')]=_0x1c04fb['body'][_0x11fe('0x94')];break;}}if(_0x5c76e3[_0x11fe('0x5d')]['id']){delete _0x5c76e3[_0x11fe('0x5d')]['id'];}if(_['isNil'](_0x5c76e3[_0x11fe('0x5d')][_0x11fe('0x80')])){throw new db[(_0x11fe('0x95'))][(_0x11fe('0x79'))]('from\x20is\x20mandatory');}if(_[_0x11fe('0x96')](_0x5c76e3[_0x11fe('0x5d')][_0x11fe('0x5d')])||_0x5c76e3[_0x11fe('0x5d')]['body']===''){throw new db[(_0x11fe('0x95'))][(_0x11fe('0x79'))](_0x11fe('0x97'));}if(_[_0x11fe('0x96')](_0x5c76e3[_0x11fe('0x5d')][_0x11fe('0x98')])){throw new db[(_0x11fe('0x95'))][(_0x11fe('0x79'))](_0x11fe('0x99')+_0x2ecaec);}if(!_[_0x11fe('0x9a')](_0x2ecaec,_0x5c76e3[_0x11fe('0x5d')][_0x11fe('0x98')])){throw new db[(_0x11fe('0x95'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2ecaec);}_0x54b7ad[_0x5c76e3[_0x11fe('0x5d')]['mapKey']]=_0x5c76e3[_0x11fe('0x5d')][_0x11fe('0x80')];return db[_0x11fe('0x9b')][_0x11fe('0x5b')]({'where':{'id':_0x5c76e3[_0x11fe('0x72')][_0x11fe('0x7d')]},'include':[{'model':db['CmContact'],'as':_0x11fe('0x9c'),'where':_0x54b7ad,'limit':0x1,'order':[[_0x11fe('0x7c'),_0x11fe('0x9d')]]}]});})['then'](handleEntityNotFound(_0x49c29f,null))['then'](function(_0x1bb0cc){if(_0x1bb0cc){_0x5c76e3[_0x11fe('0x9e')]=_[_0x11fe('0x9f')](_0x1bb0cc,[_0x11fe('0x9c')]);if(_0x1bb0cc[_0x11fe('0x9c')][_0x11fe('0x47')]){return _0x1bb0cc[_0x11fe('0x9c')][0x0];}var _0x1c308d=_[_0x11fe('0xa0')](_0x5c76e3[_0x11fe('0x5d')],{'firstName':_0x5c76e3[_0x11fe('0x5d')][_0x11fe('0x80')],'ListId':_0x1bb0cc['id']});_0x1c308d[_0x5c76e3['body']['mapKey']]=_0x5c76e3[_0x11fe('0x5d')]['from'];return db[_0x11fe('0x78')][_0x11fe('0x5c')](_0x1c308d,{'fields':_0x315e77,'raw':!![]});}})['then'](handleEntityNotFound(_0x49c29f,null))['then'](function(_0x1d5669){if(_0x1d5669){_0x5c76e3['contact']=_0x1d5669;var _0x2b8ede={'ContactId':_0x1d5669['id'],'phone':_0x5c76e3[_0x11fe('0x5d')][_0x11fe('0x80')],'SmsAccountId':_0x1c04fb[_0x11fe('0x5a')]['id']};var _0x229ebf={'ContactId':_0x1d5669['id'],'SmsAccountId':_0x1c04fb[_0x11fe('0x5a')]['id'],'closed':![]};return db[_0x11fe('0xa1')][_0x11fe('0x5b')]({'where':_0x229ebf})[_0x11fe('0x1d')](function(_0x1583b3){if(_0x1583b3){return[_0x1583b3,![]];}return db[_0x11fe('0xa1')][_0x11fe('0x5c')](_0x2b8ede)[_0x11fe('0x1d')](function(_0x11173e){return[_0x11173e,!![]];});});}})['spread'](function(_0x190462,_0x4018ba){_0x5c76e3[_0x11fe('0xa2')]=_0x190462[_0x11fe('0x34')]({'plain':!![]});_0x5c76e3[_0x11fe('0xa2')][_0x11fe('0xa3')]=![];if(_0x4018ba){if(_0x5c76e3[_0x11fe('0x72')][_0x11fe('0xa4')]){_0x5c76e3[_0x11fe('0x73')][_0x11fe('0xa5')]({'id':0x0,'priority':_0x5c76e3['applications'][_0x11fe('0x47')]+0x1,'app':_0x11fe('0xa6'),'appdata':_0x11fe('0xa7'),'interval':_0x11fe('0xa8')});}_0x5c76e3[_0x11fe('0xa2')]['created']=!![];}return db[_0x11fe('0xa9')]['create']({'phone':_0x5c76e3[_0x11fe('0x5d')][_0x11fe('0x80')],'messageId':_0x5c76e3[_0x11fe('0x5d')][_0x11fe('0x82')],'body':_0x5c76e3[_0x11fe('0x5d')]['body'],'SmsAccountId':_0x1c04fb[_0x11fe('0x5a')]['id'],'SmsInteractionId':_0x190462['id'],'direction':'in','ContactId':_0x190462[_0x11fe('0xaa')],'AttachmentId':_0x5c76e3['body'][_0x11fe('0xab')]});})[_0x11fe('0x1d')](function(_0x5969c3){_0x5c76e3[_0x11fe('0x25')]=_0x5969c3;if(_0x5c76e3[_0x11fe('0xa2')][_0x11fe('0xac')]){return db[_0x11fe('0xad')][_0x11fe('0x5b')]({'attributes':['id',_0x11fe('0x39')],'where':{'id':_0x5c76e3['interaction'][_0x11fe('0xac')]}})['then'](function(_0x5796f1){if(_0x5796f1){_0x5c76e3[_0x11fe('0x73')]['unshift']({'id':0x0,'priority':0x0,'app':_0x11fe('0xae'),'appdata':_0x5796f1[_0x11fe('0x39')]+','+(_0x5c76e3[_0x11fe('0x72')][_0x11fe('0xaf')]||0xa),'interval':_0x11fe('0xa8')});}return respondWithRpcPromise(_0x11fe('0xb0'),_0x11fe('0xb1'),_0x5c76e3);});}return respondWithRpcPromise(_0x11fe('0xb0'),_0x11fe('0xb1'),_0x5c76e3);})['then'](function(_0x402c46){if(_0x402c46){var _0xffd2a9=0xc8;var _0x44ac80='receiveMessage';logger[_0x11fe('0x1e')](_0x11fe('0x21'),_0x44ac80,_0xffd2a9,_0x11fe('0xb2'));logger[_0x11fe('0x20')](_0x11fe('0xb3'),_0x44ac80,_0xffd2a9,'entity\x20found',JSON['stringify'](_0x402c46));if(_0x5c76e3['account'][_0x11fe('0x50')]===_0x11fe('0x7f')){return _0x49c29f['status'](_0xffd2a9)['set']('Content-Type',_0x11fe('0xb4'))[_0x11fe('0x3a')](_0x11fe('0xb5'));}else{return _0x49c29f[_0x11fe('0x29')](_0xffd2a9)[_0x11fe('0x2a')](_0x402c46);}}})[_0x11fe('0x27')](handleError(_0x49c29f,null));};exports[_0x11fe('0xb6')]=function(_0x28a371,_0x2d080b,_0x45e2a2){return db[_0x11fe('0x3e')][_0x11fe('0x6d')]({'where':{'id':_0x28a371['params']['id']}})['then'](handleEntityNotFound(_0x2d080b,null))['then'](function(_0x3037ad){if(_0x3037ad){return db[_0x11fe('0xb7')]['transaction'](function(_0x5d4e2b){return db[_0x11fe('0x71')][_0x11fe('0x33')]({'where':{'SmsAccountId':_0x28a371[_0x11fe('0x5a')]['id']},'transaction':_0x5d4e2b})['then'](function(_0xefe635){var _0x161b97=_[_0x11fe('0x4f')](_0x28a371[_0x11fe('0x5d')],function(_0x2995c2){_0x2995c2[_0x11fe('0x66')]=_0x28a371[_0x11fe('0x5a')]['id'];return _0x2995c2;});return db[_0x11fe('0x71')][_0x11fe('0xb8')](_0x161b97,{'transaction':_0x5d4e2b});});})[_0x11fe('0x1d')](function(){return db[_0x11fe('0x71')][_0x11fe('0xb9')]({'where':{'SmsAccountId':_0x28a371[_0x11fe('0x5a')]['id']},'order':_0x11fe('0x75')});});}})[_0x11fe('0x1d')](respondWithResult(_0x2d080b,null))[_0x11fe('0x27')](handleError(_0x2d080b,null));};exports[_0x11fe('0xba')]=function(_0x147c89,_0x5415a2,_0x3a84d8){var _0x3c8d78={};var _0x2a1c62={};var _0x25ed01;var _0x1f0d35;return db[_0x11fe('0x3e')][_0x11fe('0x6d')]({'where':{'id':_0x147c89[_0x11fe('0x5a')]['id']}})[_0x11fe('0x1d')](handleEntityNotFound(_0x5415a2,null))[_0x11fe('0x1d')](function(_0x2a5704){if(_0x2a5704){_0x25ed01=_0x2a5704;_0x2a1c62[_0x11fe('0x40')]=_['keys'](db[_0x11fe('0x71')][_0x11fe('0x3f')]);_0x2a1c62['query']=_[_0x11fe('0x41')](_0x147c89[_0x11fe('0x42')]);_0x2a1c62[_0x11fe('0x43')]=_[_0x11fe('0x44')](_0x2a1c62[_0x11fe('0x40')],_0x2a1c62[_0x11fe('0x42')]);_0x3c8d78['attributes']=_[_0x11fe('0x44')](_0x2a1c62[_0x11fe('0x40')],qs[_0x11fe('0x46')](_0x147c89[_0x11fe('0x42')][_0x11fe('0x46')]));_0x3c8d78[_0x11fe('0x45')]=_0x3c8d78[_0x11fe('0x45')][_0x11fe('0x47')]?_0x3c8d78['attributes']:_0x2a1c62[_0x11fe('0x40')];_0x3c8d78[_0x11fe('0x4a')]=qs[_0x11fe('0x4b')](_0x147c89['query'][_0x11fe('0x4b')]);_0x3c8d78[_0x11fe('0x4c')]=qs['filters'](_[_0x11fe('0x6e')](_0x147c89[_0x11fe('0x42')],_0x2a1c62[_0x11fe('0x43')]));if(_0x147c89[_0x11fe('0x42')][_0x11fe('0x4d')]){_0x3c8d78[_0x11fe('0x4c')]=_[_0x11fe('0x4e')](_0x3c8d78[_0x11fe('0x4c')],{'$or':_[_0x11fe('0x4f')](_0x3c8d78[_0x11fe('0x45')],function(_0x21ff7c){var _0xf512a5={};_0xf512a5[_0x21ff7c]={'$like':'%'+_0x147c89['query']['filter']+'%'};return _0xf512a5;})});}_0x3c8d78=_[_0x11fe('0x4e')]({},_0x3c8d78,_0x147c89[_0x11fe('0x54')]);return _0x25ed01[_0x11fe('0xba')](_0x3c8d78);}})['then'](function(_0x241153){if(_0x241153){_0x1f0d35=_0x241153[_0x11fe('0x47')];if(!_0x147c89[_0x11fe('0x42')][_0x11fe('0x48')](_0x11fe('0x49'))){_0x3c8d78[_0x11fe('0x2d')]=qs[_0x11fe('0x2d')](_0x147c89[_0x11fe('0x42')]['limit']);_0x3c8d78[_0x11fe('0x2c')]=qs[_0x11fe('0x2c')](_0x147c89['query'][_0x11fe('0x2c')]);}return _0x25ed01[_0x11fe('0xba')](_0x3c8d78);}})[_0x11fe('0x1d')](function(_0x5add8b){if(_0x5add8b){return _0x5add8b?{'count':_0x1f0d35,'rows':_0x5add8b}:null;}})[_0x11fe('0x1d')](respondWithResult(_0x5415a2,null))[_0x11fe('0x27')](handleError(_0x5415a2,null));};exports[_0x11fe('0xbb')]=function(_0x245148,_0x577058,_0x4d5752){var _0x49485d={'raw':![],'where':{}};var _0x50ff45={};var _0x16d012={'count':0x0,'rows':[]};return db[_0x11fe('0x3e')]['findOne']({'where':{'id':_0x245148[_0x11fe('0x5a')]['id']}})['then'](handleEntityNotFound(_0x577058,null))[_0x11fe('0x1d')](function(_0x5ed04e){if(_0x5ed04e){_0x50ff45[_0x11fe('0x40')]=_[_0x11fe('0x41')](db[_0x11fe('0xa1')]['rawAttributes']);_0x50ff45[_0x11fe('0x42')]=_[_0x11fe('0x41')](_0x245148[_0x11fe('0x42')]);_0x50ff45['filters']=_[_0x11fe('0x44')](_0x50ff45[_0x11fe('0x40')],_0x50ff45['query']);_0x49485d[_0x11fe('0x45')]=_['intersection'](_0x50ff45['model'],qs[_0x11fe('0x46')](_0x245148[_0x11fe('0x42')][_0x11fe('0x46')]));_0x49485d['attributes']=_0x49485d[_0x11fe('0x45')][_0x11fe('0x47')]?_0x49485d[_0x11fe('0x45')]:_0x50ff45[_0x11fe('0x40')];if(!_0x245148[_0x11fe('0x42')][_0x11fe('0x48')](_0x11fe('0x49'))){_0x49485d['limit']=qs['limit'](_0x245148[_0x11fe('0x42')][_0x11fe('0x2d')]);_0x49485d[_0x11fe('0x2c')]=qs[_0x11fe('0x2c')](_0x245148[_0x11fe('0x42')]['offset']);}_0x49485d['order']=qs[_0x11fe('0x4b')](_0x245148[_0x11fe('0x42')][_0x11fe('0x4b')]);_0x49485d[_0x11fe('0x4c')]=qs[_0x11fe('0x43')](_[_0x11fe('0x6e')](_0x245148['query'],_0x50ff45[_0x11fe('0x43')]));_0x49485d[_0x11fe('0x4c')][_0x11fe('0x66')]=_0x5ed04e['id'];if(_0x245148[_0x11fe('0x42')][_0x11fe('0x4d')]){_0x49485d['where']=_[_0x11fe('0x4e')](_0x49485d[_0x11fe('0x4c')],{'$or':_[_0x11fe('0x4f')](_0x49485d['attributes'],function(_0x1f1d76){var _0x41abeb={};_0x41abeb[_0x1f1d76]={'$like':'%'+_0x245148[_0x11fe('0x42')][_0x11fe('0x4d')]+'%'};return _0x41abeb;})});}_0x49485d=_[_0x11fe('0x4e')]({},_0x49485d,_0x245148[_0x11fe('0x54')]);return db[_0x11fe('0xa1')][_0x11fe('0x2b')]({'where':_0x49485d[_0x11fe('0x4c')]})[_0x11fe('0x1d')](function(_0x3ec29c){_0x16d012[_0x11fe('0x2b')]=_0x3ec29c;if(_0x245148[_0x11fe('0x42')][_0x11fe('0x55')]){_0x49485d[_0x11fe('0x56')]=[{'model':db[_0x11fe('0x78')],'as':_0x11fe('0xbc'),'required':![]},{'model':db[_0x11fe('0xad')],'as':'Owner','attributes':[_0x11fe('0x39'),_0x11fe('0xbd'),_0x11fe('0xbe')],'required':![]},{'model':db[_0x11fe('0xbf')],'as':_0x11fe('0xc0'),'attributes':['id',_0x11fe('0x39'),_0x11fe('0xc1')],'where':_0x245148[_0x11fe('0x42')][_0x11fe('0xc2')]?{'id':_0x245148[_0x11fe('0x42')][_0x11fe('0xc2')]}:undefined,'required':_0x245148[_0x11fe('0x42')]['tag']?!![]:![]}];}return db[_0x11fe('0xa1')][_0x11fe('0x57')](_0x49485d);})['then'](function(_0x41577e){_0x16d012['rows']=_0x41577e;return _0x16d012;});}})[_0x11fe('0x1d')](respondWithFilteredResult(_0x577058,_0x49485d))[_0x11fe('0x27')](handleError(_0x577058,null));};exports[_0x11fe('0x3a')]=function(_0xbf0b8b,_0x478573,_0x394d71){var _0x159e80,_0x55ea86,_0xe8869b;if(_[_0x11fe('0x96')](_0xbf0b8b[_0x11fe('0x5d')][_0x11fe('0x5d')])||_0xbf0b8b[_0x11fe('0x5d')]['body']===''){throw new db[(_0x11fe('0x95'))]['ValidationError'](_0x11fe('0x97'));}if(_[_0x11fe('0x96')](_0xbf0b8b[_0x11fe('0x5d')]['to'])){throw new db['Sequelize']['ValidationError'](_0x11fe('0xc3'));}_0x159e80=_0xbf0b8b[_0x11fe('0x5d')]['to'];return db['SmsAccount'][_0x11fe('0x5b')]({'where':{'id':_0xbf0b8b[_0x11fe('0x5a')]['id']},'include':[{'model':db[_0x11fe('0x9b')],'as':_0x11fe('0xc4'),'include':[{'model':db[_0x11fe('0x78')],'as':_0x11fe('0x9c'),'where':{'mobile':_0x159e80},'limit':0x1,'order':[['updatedAt',_0x11fe('0x9d')]]}]}]})[_0x11fe('0x1d')](handleEntityNotFound(_0x478573,null))['then'](function(_0x2166ee){if(_0x2166ee&&_0x2166ee[_0x11fe('0xc4')]){_0x55ea86=_0x2166ee[_0x11fe('0x34')]({'plain':!![]});if(_0x55ea86[_0x11fe('0xc4')]&&_0x55ea86[_0x11fe('0xc4')][_0x11fe('0x9c')][_0x11fe('0x47')]){return _0x55ea86[_0x11fe('0xc4')][_0x11fe('0x9c')][0x0];}return db[_0x11fe('0x78')][_0x11fe('0x5c')](_[_0x11fe('0xa0')](_0xbf0b8b[_0x11fe('0x5d')],{'firstName':_0x159e80,'mobile':_0x159e80,'phone':_0x159e80,'ListId':_0x55ea86['ListId']}));}})[_0x11fe('0x1d')](handleEntityNotFound(_0x478573,null))[_0x11fe('0x1d')](function(_0x361274){if(_0x361274){_0xe8869b=_0x361274;return db[_0x11fe('0xa1')][_0x11fe('0x5b')]({'where':{'ContactId':_0xe8869b['id'],'closed':![],'SmsAccountId':_0x55ea86['id']}})[_0x11fe('0x1d')](function(_0x4be3ce){if(_0x4be3ce){return[_0x4be3ce,![]];}return db[_0x11fe('0xa1')]['create']({'UserId':_0xbf0b8b['user']['id'],'ContactId':_0xe8869b['id'],'SmsAccountId':_0x55ea86['id'],'phone':_0x159e80,'firstMsgDirection':'out','Messages':[_[_0x11fe('0x4e')](_0xbf0b8b[_0x11fe('0x5d')],{'read':![],'body':_0xbf0b8b['body'][_0x11fe('0x5d')],'phone':_0x159e80,'SmsAccountId':_0x55ea86['id'],'UserId':_0xbf0b8b[_0x11fe('0x5e')]['id'],'ContactId':_0xe8869b['id']})]},{'include':[{'model':db[_0x11fe('0xa9')],'as':_0x11fe('0xc5')}]})[_0x11fe('0x1d')](function(_0x52b004){return[_0x52b004,!![]];});});}})['spread'](function(_0x46c1ba,_0x59affc){if(_0x59affc){return _0x46c1ba;}return db[_0x11fe('0xa9')][_0x11fe('0x5c')](_[_0x11fe('0x4e')](_0xbf0b8b[_0x11fe('0x5d')],{'read':![],'body':_0xbf0b8b['body'][_0x11fe('0x5d')],'phone':_0x159e80,'SmsAccountId':_0x55ea86['id'],'SmsInteractionId':_0x46c1ba['id'],'UserId':_0xbf0b8b[_0x11fe('0x5e')]['id'],'ContactId':_0xe8869b['id']}))['then'](function(_0x282448){_0x46c1ba[_0x11fe('0xc6')][_0x11fe('0xc5')]=[];_0x46c1ba[_0x11fe('0xc6')]['Messages']['push'](_0x282448['dataValues']);return _0x46c1ba;});})[_0x11fe('0x1d')](respondWithResult(_0x478573,null))['catch'](handleError(_0x478573,null));};exports['status']=function(_0x2bd442,_0x2c7be7,_0x4fa105){if(_0x2bd442[_0x11fe('0x5d')]['id']){delete _0x2bd442['body']['id'];}console[_0x11fe('0xc7')](_0x11fe('0xc8'),_0x2bd442[_0x11fe('0x5d')]);var _0x4c06b2,_0x30a0af,_0x483650;return db['SmsAccount'][_0x11fe('0x5b')]({'where':{'id':_0x2bd442[_0x11fe('0x5a')]['id']}})[_0x11fe('0x1d')](handleEntityNotFound(_0x2c7be7,null))[_0x11fe('0x1d')](function(_0x3f5890){if(_0x3f5890){_0x483650=_0x3f5890;logger[_0x11fe('0x20')](_0x11fe('0x21'),_0x11fe('0x29'),_0x11fe('0xc9'),_0x3f5890[_0x11fe('0x50')],util[_0x11fe('0xca')](_0x2bd442[_0x11fe('0x5d')],{'showHidden':![],'depth':null}));switch(_0x3f5890[_0x11fe('0x50')]){case _0x11fe('0x84'):if(_0x2bd442[_0x11fe('0x5d')][_0x11fe('0xcb')]&&_0x2bd442[_0x11fe('0x5d')]['status']){_0x30a0af=_0x2bd442[_0x11fe('0x5d')][_0x11fe('0x29')];return db['SmsMessage']['find']({'where':{'messageId':_0x2bd442[_0x11fe('0x5d')][_0x11fe('0xcb')]}});}break;case _0x11fe('0x86'):if(_0x2bd442[_0x11fe('0x5d')][_0x11fe('0xcc')]&&_0x2bd442[_0x11fe('0x5d')][_0x11fe('0xcd')]){_0x30a0af=_0x2bd442[_0x11fe('0x5d')][_0x11fe('0xcd')];return db[_0x11fe('0xa9')][_0x11fe('0x5b')]({'where':{'messageId':_0x2bd442[_0x11fe('0x5d')][_0x11fe('0xcc')]}});}break;case'clicksend':if(_0x2bd442[_0x11fe('0x5d')][_0x11fe('0x88')]&&_0x2bd442[_0x11fe('0x5d')]['status_code']){_0x30a0af=_0x2bd442[_0x11fe('0x5d')][_0x11fe('0xce')];return db[_0x11fe('0xa9')][_0x11fe('0x5b')]({'where':{'messageId':_0x2bd442[_0x11fe('0x5d')]['message_id']}});}break;case _0x11fe('0x8c'):var _0x4b43cf=_0x2bd442['body'][_0x11fe('0x8d')][0x0];if(_0x4b43cf[_0x11fe('0x82')]&&_0x4b43cf[_0x11fe('0x29')][_0x11fe('0xcf')]===_0x11fe('0xd0')){_0x30a0af=_0x4b43cf[_0x11fe('0x29')][_0x11fe('0xcf')];return db['SmsMessage']['find']({'where':{'messageId':_0x4b43cf['messageId']}});}break;case _0x11fe('0xd1'):if(_0x2bd442[_0x11fe('0x5d')][_0x11fe('0x82')]&&_0x2bd442[_0x11fe('0x5d')]['status']){_0x30a0af=_0x2bd442['body'][_0x11fe('0x29')];return db[_0x11fe('0xa9')][_0x11fe('0x5b')]({'where':{'messageId':_0x2bd442[_0x11fe('0x5d')]['messageId']}});}break;case'intelepeer':if(_0x2bd442[_0x11fe('0x5d')]['redif']&&_0x2bd442[_0x11fe('0x5d')][_0x11fe('0x29')]){_0x30a0af=_0x2bd442[_0x11fe('0x5d')][_0x11fe('0x29')];return db[_0x11fe('0xa9')][_0x11fe('0x5b')]({'where':{'messageId':_0x2bd442[_0x11fe('0x5d')][_0x11fe('0xd2')]}});}break;}}})[_0x11fe('0x1d')](handleEntityNotFound(_0x2c7be7,null))['then'](function(_0x3a23e4){if(_0x3a23e4){_0x4c06b2=_0x3a23e4;switch(_0x483650[_0x11fe('0x50')]){case _0x11fe('0x84'):if(_0x30a0af===_0x11fe('0xd0')){return _0x4c06b2[_0x11fe('0x32')]({'read':!![]});}else{logger['error'](_0x11fe('0x21'),_0x11fe('0x29'),'skebby',util[_0x11fe('0xca')](_0x2bd442['body'],{'showHidden':![],'depth':null}));}break;case _0x11fe('0x86'):if(_0x30a0af==='1'){return _0x4c06b2[_0x11fe('0x32')]({'read':!![]});}else{logger[_0x11fe('0x23')](_0x11fe('0x21'),_0x11fe('0x29'),'skebby',util[_0x11fe('0xca')](_0x2bd442[_0x11fe('0x5d')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x2bd442[_0x11fe('0x5d')]['error_code']&&_0x30a0af>=0xc8&&_0x30a0af<=0xce){return _0x4c06b2[_0x11fe('0x32')]({'read':!![]});}else{logger[_0x11fe('0x23')](_0x11fe('0x21'),_0x11fe('0x29'),_0x11fe('0x87'),util[_0x11fe('0xca')](_0x2bd442[_0x11fe('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x11fe('0x8c'):var _0x129a48=_0x2bd442[_0x11fe('0x5d')][_0x11fe('0x8d')][0x0];if(_0x129a48[_0x11fe('0x29')][_0x11fe('0xcf')]===_0x11fe('0xd0')){return _0x4c06b2[_0x11fe('0x32')]({'read':!![]});}else{logger[_0x11fe('0x23')](_0x11fe('0x21'),'status',_0x11fe('0x8c'),util[_0x11fe('0xca')](_0x2bd442[_0x11fe('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x11fe('0xd1'):if(_0x30a0af=='DELIVERED_TO_GATEWAY'||_0x30a0af=='RECEIVED_BY_RECIPIENT'){return _0x4c06b2[_0x11fe('0x32')]({'read':!![]});}else{logger[_0x11fe('0x23')](_0x11fe('0x21'),'status',_0x11fe('0xd1'),util[_0x11fe('0xca')](_0x2bd442[_0x11fe('0x5d')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x30a0af===_0x11fe('0xd3')||_0x30a0af==='ACCEPTD'){return _0x4c06b2['update']({'read':!![]});}else{logger[_0x11fe('0x23')](_0x11fe('0x21'),_0x11fe('0x29'),_0x11fe('0x93'),util[_0x11fe('0xca')](_0x2bd442[_0x11fe('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x4c06b2;}})[_0x11fe('0x1d')](respondWithResult(_0x2c7be7,null))[_0x11fe('0x27')](handleError(_0x2c7be7,null));};exports['statusGet']=function(_0x287d35,_0x311f42,_0x2a8c55){var _0x4c02de,_0x37b7b4,_0x51162d;return db[_0x11fe('0x3e')][_0x11fe('0x5b')]({'where':{'id':_0x287d35[_0x11fe('0x5a')]['id']}})[_0x11fe('0x1d')](handleEntityNotFound(_0x311f42,null))[_0x11fe('0x1d')](function(_0x40cc88){if(_0x40cc88){_0x51162d=_0x40cc88;logger[_0x11fe('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x11fe('0x29'),_0x11fe('0xc9'),_0x40cc88['type'],util[_0x11fe('0xca')](_0x287d35[_0x11fe('0x42')],{'showHidden':![],'depth':null}));switch(_0x40cc88[_0x11fe('0x50')]){case _0x11fe('0x8e'):if(_0x287d35['query'][_0x11fe('0xd4')]&&_0x287d35[_0x11fe('0x42')][_0x11fe('0xd5')]){_0x37b7b4=_0x287d35['query'][_0x11fe('0xd5')];return db[_0x11fe('0xa9')][_0x11fe('0x5b')]({'where':{'messageId':_0x287d35[_0x11fe('0x42')][_0x11fe('0xd4')]}});}break;}}})[_0x11fe('0x1d')](handleEntityNotFound(_0x311f42,null))[_0x11fe('0x1d')](function(_0xac55b4){if(_0xac55b4){_0x4c02de=_0xac55b4;switch(_0x51162d[_0x11fe('0x50')]){case _0x11fe('0x8e'):if(_0x37b7b4==='2'||_0x37b7b4==='6'){return _0x4c02de[_0x11fe('0x32')]({'read':!![]});}else{logger['error'](_0x11fe('0x21'),_0x11fe('0x29'),_0x11fe('0x8e'),util[_0x11fe('0xca')](_0x287d35[_0x11fe('0x42')],{'showHidden':![],'depth':null}));};break;}return _0x4c02de;}})[_0x11fe('0x1d')](respondWithResult(_0x311f42,null))[_0x11fe('0x27')](handleError(_0x311f42,null));};exports[_0x11fe('0xd6')]=function(_0x43652f,_0x29af89,_0x2aa21e){return db['SmsAccount']['find']({'where':{'id':_0x43652f[_0x11fe('0x5a')]['id']}})[_0x11fe('0x1d')](handleEntityNotFound(_0x29af89,null))['then'](function(_0x382f3c){if(_0x382f3c){return _0x382f3c[_0x11fe('0xd6')](_0x43652f[_0x11fe('0x5d')][_0x11fe('0x6a')],_[_0x11fe('0x9f')](_0x43652f[_0x11fe('0x5d')],[_0x11fe('0x6a'),'id'])||{})['spread'](function(_0x20fd4a){for(var _0x1c528b=0x0;_0x1c528b<_0x43652f[_0x11fe('0x5d')][_0x11fe('0x6a')]['length'];_0x1c528b+=0x1){socket[_0x11fe('0xd7')](_0x11fe('0xd8'),{'UserId':_0x43652f[_0x11fe('0x5d')][_0x11fe('0x6a')][_0x1c528b],'SmsAccountId':_0x43652f['params']['id']});}return _0x20fd4a;});}})[_0x11fe('0x1d')](respondWithResult(_0x29af89,null))[_0x11fe('0x27')](handleError(_0x29af89,null));};exports[_0x11fe('0xd9')]=function(_0xe28d00,_0x278617,_0x4c5eed){var _0x4cf977;return db[_0x11fe('0x3e')][_0x11fe('0x5b')]({'where':{'id':_0xe28d00[_0x11fe('0x5a')]['id']}})['then'](handleEntityNotFound(_0x278617,null))[_0x11fe('0x1d')](function(_0x4e666f){if(_0x4e666f){return _0x4e666f['removeAgents'](_0xe28d00['query'][_0x11fe('0x6a')])[_0x11fe('0x1d')](function(_0x346efd){if(_[_0x11fe('0xda')](_0xe28d00[_0x11fe('0x42')][_0x11fe('0x6a')])){for(var _0x745990=0x0;_0x745990<_0xe28d00[_0x11fe('0x42')]['ids'][_0x11fe('0x47')];_0x745990+=0x1){socket['emit'](_0x11fe('0xdb'),{'UserId':_0xe28d00[_0x11fe('0x42')][_0x11fe('0x6a')][_0x745990],'SmsAccountId':_0xe28d00[_0x11fe('0x5a')]['id']});}}else{socket[_0x11fe('0xd7')]('userSmsAccount:remove',{'UserId':_0xe28d00[_0x11fe('0x42')]['ids'],'SmsAccountId':_0xe28d00[_0x11fe('0x5a')]['id']});}});}})[_0x11fe('0x1d')](respondWithStatusCode(_0x278617,null))[_0x11fe('0x27')](handleError(_0x278617,null));};exports[_0x11fe('0xdc')]=function(_0x1efc92,_0x1c6ab8,_0x5edb68){var _0xc6bce5={};var _0xbfeb83={};var _0x368e14;var _0x5b5c64;return db[_0x11fe('0x3e')]['findOne']({'where':{'id':_0x1efc92['params']['id']}})['then'](handleEntityNotFound(_0x1c6ab8,null))[_0x11fe('0x1d')](function(_0x3fe660){if(_0x3fe660){_0x368e14=_0x3fe660;_0xbfeb83[_0x11fe('0x40')]=_[_0x11fe('0x41')](db[_0x11fe('0xad')]['rawAttributes']);_0xbfeb83[_0x11fe('0x42')]=_[_0x11fe('0x41')](_0x1efc92[_0x11fe('0x42')]);_0xbfeb83[_0x11fe('0x43')]=_['intersection'](_0xbfeb83['model'],_0xbfeb83[_0x11fe('0x42')]);_0xc6bce5[_0x11fe('0x45')]=_['intersection'](_0xbfeb83[_0x11fe('0x40')],qs[_0x11fe('0x46')](_0x1efc92[_0x11fe('0x42')][_0x11fe('0x46')]));_0xc6bce5['attributes']=_0xc6bce5[_0x11fe('0x45')][_0x11fe('0x47')]?_0xc6bce5[_0x11fe('0x45')]:_0xbfeb83[_0x11fe('0x40')];_0xc6bce5[_0x11fe('0x4a')]=qs[_0x11fe('0x4b')](_0x1efc92[_0x11fe('0x42')]['sort']);_0xc6bce5[_0x11fe('0x4c')]=qs['filters'](_[_0x11fe('0x6e')](_0x1efc92['query'],_0xbfeb83[_0x11fe('0x43')]));if(_0x1efc92[_0x11fe('0x42')]['filter']){_0xc6bce5['where']=_[_0x11fe('0x4e')](_0xc6bce5[_0x11fe('0x4c')],{'$or':_[_0x11fe('0x4f')](_0xc6bce5[_0x11fe('0x45')],function(_0x3d9d5b){var _0x31f670={};_0x31f670[_0x3d9d5b]={'$like':'%'+_0x1efc92[_0x11fe('0x42')][_0x11fe('0x4d')]+'%'};return _0x31f670;})});}_0xc6bce5=_[_0x11fe('0x4e')]({},_0xc6bce5,_0x1efc92['options']);return _0x368e14[_0x11fe('0xdc')](_0xc6bce5);}})[_0x11fe('0x1d')](function(_0x2e529f){if(_0x2e529f){_0x5b5c64=_0x2e529f[_0x11fe('0x47')];if(!_0x1efc92[_0x11fe('0x42')][_0x11fe('0x48')](_0x11fe('0x49'))){_0xc6bce5['limit']=qs[_0x11fe('0x2d')](_0x1efc92['query'][_0x11fe('0x2d')]);_0xc6bce5['offset']=qs[_0x11fe('0x2c')](_0x1efc92[_0x11fe('0x42')][_0x11fe('0x2c')]);}return _0x368e14['getAgents'](_0xc6bce5);}})[_0x11fe('0x1d')](function(_0x19f4f2){if(_0x19f4f2){return _0x19f4f2?{'count':_0x5b5c64,'rows':_0x19f4f2}:null;}})[_0x11fe('0x1d')](respondWithResult(_0x1c6ab8,null))[_0x11fe('0x27')](handleError(_0x1c6ab8,null));};
\ No newline at end of file
+var _0x8d53=['isArray','emit','userSmsAccount:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','redis','defaults','localhost','./smsAccount.socket','register','jayson/promise','client','http','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','limit','Content-Range','apply','reject','save','update','then','get','SmsAccounts','destroy','stack','name','send','Pause','mandatoryDispositionPause','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','field','merge','options','SmsAccount','count','includeAll','include','findAll','show','params','rawAttributes','create','body','user','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','pick','SmsAccountId','map','removeDispositions','ids','CannedAnswer','getAnswers','rows','removeAnswers','sms','SmsApplication','Applications','account','orderBy','priority','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','type','twilio','From','Body','MessageSid','skebby','text','connectel','from','clicksend','messageId','message_id','Text','MessageUUID','infobip','results','segmentedMessage','fromNumber','replyMessageId','isNil','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','Contacts','omit','contact','SmsInteraction','autoclose','applications','push','unmanaged','*,*,*,*','interaction','created','ContactId','AttachmentId','UserId','User','unshift','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','<?xml\x20version=\x221.0\x22\x20encoding=\x22UTF-8\x22?>\x0a<Response></Response>','addApplications','sequelize','transaction','bulkCreate','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','CmList','List','DESC','out','SmsMessage','Messages','spread','dataValues','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','clickatell','intelepeer','redif','inspect','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','message-id','csc','addAgents','userSmsAccount:save','removeAgents'];(function(_0x327e8b,_0x912506){var _0x89151=function(_0x25f76c){while(--_0x25f76c){_0x327e8b['push'](_0x327e8b['shift']());}};_0x89151(++_0x912506);}(_0x8d53,0x1c2));var _0x38d5=function(_0x600da7,_0x5be4ff){_0x600da7=_0x600da7-0x0;var _0x57489b=_0x8d53[_0x600da7];return _0x57489b;};'use strict';var pdf=require(_0x38d5('0x0'));var emlformat=require(_0x38d5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x38d5('0x2'));var jsonpatch=require(_0x38d5('0x3'));var rp=require(_0x38d5('0x4'));var moment=require(_0x38d5('0x5'));var BPromise=require(_0x38d5('0x6'));var Mustache=require(_0x38d5('0x7'));var util=require(_0x38d5('0x8'));var path=require(_0x38d5('0x9'));var sox=require('sox');var csv=require(_0x38d5('0xa'));var ejs=require(_0x38d5('0xb'));var fs=require('fs');var _=require(_0x38d5('0xc'));var squel=require('squel');var crypto=require(_0x38d5('0xd'));var jsforce=require(_0x38d5('0xe'));var deskjs=require(_0x38d5('0xf'));var toCsv=require(_0x38d5('0xa'));var querystring=require(_0x38d5('0x10'));var Papa=require('papaparse');var authService=require(_0x38d5('0x11'));var hardwareService=require(_0x38d5('0x12'));var Redis=require('ioredis');var qs=require(_0x38d5('0x13'));var logger=require(_0x38d5('0x14'))(_0x38d5('0x15'));var utils=require(_0x38d5('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x38d5('0x17')]=_[_0x38d5('0x18')](config['redis'],{'host':_0x38d5('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x38d5('0x17')]));require(_0x38d5('0x1a'))[_0x38d5('0x1b')](socket);var jayson=require(_0x38d5('0x1c'));var client=jayson[_0x38d5('0x1d')][_0x38d5('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x5a5f89,_0x41656c,_0x4c8f0f,_0xa455d1){return new BPromise(function(_0x53e995,_0x44cfa8){var _0x463e2e=_0xa455d1||client;return _0x463e2e[_0x38d5('0x1f')](_0x5a5f89,_0x4c8f0f)['then'](function(_0x1e5353){logger[_0x38d5('0x20')](_0x38d5('0x21'),_0x41656c,_0x38d5('0x22'));logger[_0x38d5('0x23')](_0x38d5('0x24'),_0x41656c,'request\x20sent',JSON[_0x38d5('0x25')](_0x1e5353));if(_0x1e5353['error']){if(_0x1e5353['error']['code']===0x1f4){logger[_0x38d5('0x26')](_0x38d5('0x21'),_0x41656c,_0x1e5353[_0x38d5('0x26')]['message']);return _0x44cfa8(_0x1e5353['error'][_0x38d5('0x27')]);}logger[_0x38d5('0x26')](_0x38d5('0x21'),_0x41656c,_0x1e5353['error'][_0x38d5('0x27')]);return _0x53e995(_0x1e5353['error'][_0x38d5('0x27')]);}else{logger[_0x38d5('0x20')]('SmsAccount,\x20%s,\x20%s',_0x41656c,'request\x20sent');_0x53e995(_0x1e5353[_0x38d5('0x28')]['message']);}})[_0x38d5('0x29')](function(_0x5a9084){logger[_0x38d5('0x26')](_0x38d5('0x21'),_0x41656c,_0x5a9084);_0x44cfa8(_0x5a9084);});});}function respondWithStatusCode(_0x141fa0,_0x5b9552){_0x5b9552=_0x5b9552||0xcc;return function(_0x4b33ea){if(_0x4b33ea){return _0x141fa0[_0x38d5('0x2a')](_0x5b9552);}return _0x141fa0['status'](_0x5b9552)[_0x38d5('0x2b')]();};}function respondWithResult(_0x1f8d11,_0x12d220){_0x12d220=_0x12d220||0xc8;return function(_0x30520b){if(_0x30520b){return _0x1f8d11[_0x38d5('0x2c')](_0x12d220)[_0x38d5('0x2d')](_0x30520b);}};}function respondWithFilteredResult(_0xbe992b,_0x169274){return function(_0x1aed23){if(_0x1aed23){var _0x2b4349=_0x1aed23['count'],_0x33d883=_0x169274['offset'],_0x3a8879=_0x169274['offset']+_0x169274[_0x38d5('0x2e')],_0x341af1;if(_0x3a8879>=_0x2b4349){_0x3a8879=_0x2b4349;_0x341af1=0xc8;}else{_0x341af1=0xce;}_0xbe992b[_0x38d5('0x2c')](_0x341af1);return _0xbe992b['set'](_0x38d5('0x2f'),_0x33d883+'-'+_0x3a8879+'/'+_0x2b4349)[_0x38d5('0x2d')](_0x1aed23);}return null;};}function patchUpdates(_0x2f18e4){return function(_0x1ad9ad){try{jsonpatch[_0x38d5('0x30')](_0x1ad9ad,_0x2f18e4,!![]);}catch(_0x594fdb){return BPromise[_0x38d5('0x31')](_0x594fdb);}return _0x1ad9ad[_0x38d5('0x32')]();};}function saveUpdates(_0x37eb5c,_0x1e9ba3){return function(_0x4c9cb7){if(_0x4c9cb7){return _0x4c9cb7[_0x38d5('0x33')](_0x37eb5c)['then'](function(_0x1bb116){return _0x1bb116;});}return null;};}function removeEntity(_0x54ac2b,_0x1c79ac){return function(_0x26694c){if(_0x26694c){return _0x26694c['destroy']()[_0x38d5('0x34')](function(){var _0xcc3677=_0x26694c[_0x38d5('0x35')]({'plain':!![]});var _0x5729ae=_0x38d5('0x36');return db['UserProfileResource'][_0x38d5('0x37')]({'where':{'type':_0x5729ae,'resourceId':_0xcc3677['id']}})[_0x38d5('0x34')](function(){return _0x26694c;});})[_0x38d5('0x34')](function(){_0x54ac2b[_0x38d5('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21833c,_0x1dcc96){return function(_0x51f439){if(!_0x51f439){_0x21833c[_0x38d5('0x2a')](0x194);}return _0x51f439;};}function handleError(_0x13858f,_0x294ff1){_0x294ff1=_0x294ff1||0x1f4;return function(_0x2e14c4){logger[_0x38d5('0x26')](_0x2e14c4[_0x38d5('0x38')]);if(_0x2e14c4[_0x38d5('0x39')]){delete _0x2e14c4[_0x38d5('0x39')];}_0x13858f['status'](_0x294ff1)[_0x38d5('0x3a')](_0x2e14c4);};}exports['index']=function(_0x2d0a21,_0x27d6f5){var _0x40f65f={'include':[{'model':db[_0x38d5('0x3b')],'as':_0x38d5('0x3c')}]},_0x59ebab={},_0x4999a2={'count':0x0,'rows':[]};var _0x11541f=db['SmsAccount']['rawAttributes'];_0x59ebab[_0x38d5('0x3d')]=_[_0x38d5('0x3e')](_0x11541f);_0x59ebab[_0x38d5('0x3f')]=_[_0x38d5('0x3e')](_0x2d0a21['query']);_0x59ebab[_0x38d5('0x40')]=_[_0x38d5('0x41')](_0x59ebab[_0x38d5('0x3d')],_0x59ebab[_0x38d5('0x3f')]);_0x40f65f['attributes']=_['intersection'](_0x59ebab['model'],qs[_0x38d5('0x42')](_0x2d0a21[_0x38d5('0x3f')][_0x38d5('0x42')]));_0x40f65f[_0x38d5('0x43')]=_0x40f65f[_0x38d5('0x43')][_0x38d5('0x44')]?_0x40f65f['attributes']:_0x59ebab[_0x38d5('0x3d')];if(!_0x2d0a21[_0x38d5('0x3f')][_0x38d5('0x45')](_0x38d5('0x46'))){_0x40f65f[_0x38d5('0x2e')]=qs[_0x38d5('0x2e')](_0x2d0a21['query'][_0x38d5('0x2e')]);_0x40f65f[_0x38d5('0x47')]=qs[_0x38d5('0x47')](_0x2d0a21[_0x38d5('0x3f')][_0x38d5('0x47')]);}_0x40f65f[_0x38d5('0x48')]=qs[_0x38d5('0x49')](_0x2d0a21[_0x38d5('0x3f')][_0x38d5('0x49')]);_0x40f65f[_0x38d5('0x4a')]=qs[_0x38d5('0x40')](_['pick'](_0x2d0a21[_0x38d5('0x3f')],_0x59ebab['filters']));if(_0x2d0a21['query'][_0x38d5('0x4b')]){_0x40f65f['where']=_['merge'](_0x40f65f['where'],{'$or':_['map'](_0x11541f,function(_0x48b5e7){if(_0x48b5e7['type']['key']!=='VIRTUAL'){var _0x125616={};_0x125616[_0x48b5e7[_0x38d5('0x4c')]]={'$like':'%'+_0x2d0a21[_0x38d5('0x3f')][_0x38d5('0x4b')]+'%'};return _0x125616;}})});}_0x40f65f=_[_0x38d5('0x4d')]({},_0x40f65f,_0x2d0a21[_0x38d5('0x4e')]);var _0x597501={'where':_0x40f65f[_0x38d5('0x4a')]};return db[_0x38d5('0x4f')][_0x38d5('0x50')](_0x597501)[_0x38d5('0x34')](function(_0x1ff490){_0x4999a2[_0x38d5('0x50')]=_0x1ff490;if(_0x2d0a21[_0x38d5('0x3f')][_0x38d5('0x51')]){_0x40f65f[_0x38d5('0x52')]=[{'all':!![]}];}return db[_0x38d5('0x4f')][_0x38d5('0x53')](_0x40f65f);})[_0x38d5('0x34')](function(_0x59923b){_0x4999a2['rows']=_0x59923b;return _0x4999a2;})['then'](respondWithFilteredResult(_0x27d6f5,_0x40f65f))[_0x38d5('0x29')](handleError(_0x27d6f5,null));};exports[_0x38d5('0x54')]=function(_0xeacf8c,_0x4012eb){var _0x2f0589={'raw':![],'where':{'id':_0xeacf8c[_0x38d5('0x55')]['id']},'include':[{'model':db[_0x38d5('0x3b')],'as':_0x38d5('0x3c')}]},_0xe1cce1={};_0xe1cce1[_0x38d5('0x3d')]=_[_0x38d5('0x3e')](db[_0x38d5('0x4f')][_0x38d5('0x56')]);_0xe1cce1[_0x38d5('0x3f')]=_['keys'](_0xeacf8c[_0x38d5('0x3f')]);_0xe1cce1[_0x38d5('0x40')]=_[_0x38d5('0x41')](_0xe1cce1[_0x38d5('0x3d')],_0xe1cce1['query']);_0x2f0589[_0x38d5('0x43')]=_['intersection'](_0xe1cce1['model'],qs[_0x38d5('0x42')](_0xeacf8c[_0x38d5('0x3f')][_0x38d5('0x42')]));_0x2f0589[_0x38d5('0x43')]=_0x2f0589[_0x38d5('0x43')][_0x38d5('0x44')]?_0x2f0589[_0x38d5('0x43')]:_0xe1cce1['model'];if(_0xeacf8c[_0x38d5('0x3f')][_0x38d5('0x51')]){_0x2f0589['include']=[{'all':!![]}];}_0x2f0589=_['merge']({},_0x2f0589,_0xeacf8c['options']);return db[_0x38d5('0x4f')]['find'](_0x2f0589)[_0x38d5('0x34')](handleEntityNotFound(_0x4012eb,null))[_0x38d5('0x34')](respondWithResult(_0x4012eb,null))[_0x38d5('0x29')](handleError(_0x4012eb,null));};exports[_0x38d5('0x57')]=function(_0x147b05,_0xc11b0b){return db[_0x38d5('0x4f')][_0x38d5('0x57')](_0x147b05[_0x38d5('0x58')],{})['then'](function(_0x303dd8){var _0x5e2ccb=_0x147b05[_0x38d5('0x59')][_0x38d5('0x35')]({'plain':!![]});if(!_0x5e2ccb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e2ccb['role']===_0x38d5('0x59')){var _0x432003=_0x303dd8[_0x38d5('0x35')]({'plain':!![]});var _0xf8ba6f=_0x38d5('0x36');return db[_0x38d5('0x5a')][_0x38d5('0x5b')]({'where':{'name':_0xf8ba6f,'userProfileId':_0x5e2ccb['userProfileId']},'raw':!![]})['then'](function(_0x28b1ca){if(_0x28b1ca&&_0x28b1ca[_0x38d5('0x5c')]===0x0){return db[_0x38d5('0x5d')]['create']({'name':_0x432003['name'],'resourceId':_0x432003['id'],'type':_0x28b1ca[_0x38d5('0x39')],'sectionId':_0x28b1ca['id']},{})[_0x38d5('0x34')](function(){return _0x303dd8;});}else{return _0x303dd8;}})[_0x38d5('0x29')](function(_0x1de5ef){logger[_0x38d5('0x26')](_0x38d5('0x5e'),_0x1de5ef);throw _0x1de5ef;});}return _0x303dd8;})[_0x38d5('0x34')](respondWithResult(_0xc11b0b,0xc9))[_0x38d5('0x29')](handleError(_0xc11b0b,null));};exports['update']=function(_0x1e9016,_0x360d54){if(_0x1e9016[_0x38d5('0x58')]['id']){delete _0x1e9016['body']['id'];}return db[_0x38d5('0x4f')][_0x38d5('0x5b')]({'where':{'id':_0x1e9016[_0x38d5('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x38d5('0x3c')}]})[_0x38d5('0x34')](handleEntityNotFound(_0x360d54,null))[_0x38d5('0x34')](saveUpdates(_0x1e9016[_0x38d5('0x58')],null))[_0x38d5('0x34')](function(_0x658266){if(_0x658266&&_0x1e9016[_0x38d5('0x58')]['mandatoryDispositionPause']){return db[_0x38d5('0x3b')][_0x38d5('0x33')](_0x1e9016['body']['mandatoryDispositionPause'],{'where':{'SmsAccountId':_0x658266['id']}})[_0x38d5('0x34')](function(){return _0x658266;});}return _0x658266;})['then'](respondWithResult(_0x360d54,null))[_0x38d5('0x29')](handleError(_0x360d54,null));};exports['destroy']=function(_0x1a48d0,_0x4672df){return db[_0x38d5('0x4f')][_0x38d5('0x5b')]({'where':{'id':_0x1a48d0[_0x38d5('0x55')]['id']}})['then'](handleEntityNotFound(_0x4672df,null))[_0x38d5('0x34')](removeEntity(_0x4672df,null))[_0x38d5('0x29')](handleError(_0x4672df,null));};exports[_0x38d5('0x5f')]=function(_0x41385c,_0x49e7ab){return db['SmsAccount'][_0x38d5('0x5f')]()[_0x38d5('0x34')](respondWithResult(_0x49e7ab,null))[_0x38d5('0x29')](handleError(_0x49e7ab,null));};exports[_0x38d5('0x60')]=function(_0x114484,_0x31de09,_0x582949){if(_0x114484[_0x38d5('0x58')]['id']){delete _0x114484[_0x38d5('0x58')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x114484[_0x38d5('0x55')]['id']}})['then'](handleEntityNotFound(_0x31de09,null))[_0x38d5('0x34')](function(_0x59d104){if(_0x59d104){_0x114484['body']['SmsAccountId']=_0x59d104['id'];return db[_0x38d5('0x61')][_0x38d5('0x57')](_0x114484['body']);}})[_0x38d5('0x34')](respondWithResult(_0x31de09,null))[_0x38d5('0x29')](handleError(_0x31de09,null));};exports[_0x38d5('0x62')]=function(_0xb465f0,_0x3d7bcc,_0x4fbf6f){var _0x395764={'raw':![],'where':{}};var _0x43a4c8={};var _0x519146={'count':0x0,'rows':[]};return db[_0x38d5('0x4f')][_0x38d5('0x63')]({'where':{'id':_0xb465f0[_0x38d5('0x55')]['id']}})[_0x38d5('0x34')](handleEntityNotFound(_0x3d7bcc,null))[_0x38d5('0x34')](function(_0x28788f){if(_0x28788f){_0x43a4c8[_0x38d5('0x3d')]=_[_0x38d5('0x3e')](db['Disposition'][_0x38d5('0x56')]);_0x43a4c8[_0x38d5('0x3f')]=_[_0x38d5('0x3e')](_0xb465f0[_0x38d5('0x3f')]);_0x43a4c8[_0x38d5('0x40')]=_[_0x38d5('0x41')](_0x43a4c8[_0x38d5('0x3d')],_0x43a4c8[_0x38d5('0x3f')]);_0x395764[_0x38d5('0x43')]=_[_0x38d5('0x41')](_0x43a4c8['model'],qs['fields'](_0xb465f0[_0x38d5('0x3f')][_0x38d5('0x42')]));_0x395764[_0x38d5('0x43')]=_0x395764[_0x38d5('0x43')]['length']?_0x395764[_0x38d5('0x43')]:_0x43a4c8['model'];if(!_0xb465f0[_0x38d5('0x3f')][_0x38d5('0x45')](_0x38d5('0x46'))){_0x395764[_0x38d5('0x2e')]=qs[_0x38d5('0x2e')](_0xb465f0[_0x38d5('0x3f')][_0x38d5('0x2e')]);_0x395764[_0x38d5('0x47')]=qs['offset'](_0xb465f0['query'][_0x38d5('0x47')]);}_0x395764[_0x38d5('0x48')]=qs[_0x38d5('0x49')](_0xb465f0[_0x38d5('0x3f')][_0x38d5('0x49')]);_0x395764[_0x38d5('0x4a')]=qs['filters'](_[_0x38d5('0x64')](_0xb465f0['query'],_0x43a4c8[_0x38d5('0x40')]));_0x395764[_0x38d5('0x4a')][_0x38d5('0x65')]=_0x28788f['id'];if(_0xb465f0[_0x38d5('0x3f')][_0x38d5('0x4b')]){_0x395764[_0x38d5('0x4a')]=_['merge'](_0x395764[_0x38d5('0x4a')],{'$or':_[_0x38d5('0x66')](_0x395764[_0x38d5('0x43')],function(_0x570d48){var _0x483d25={};_0x483d25[_0x570d48]={'$like':'%'+_0xb465f0['query'][_0x38d5('0x4b')]+'%'};return _0x483d25;})});}_0x395764=_[_0x38d5('0x4d')]({},_0x395764,_0xb465f0[_0x38d5('0x4e')]);return db[_0x38d5('0x61')][_0x38d5('0x50')]({'where':_0x395764[_0x38d5('0x4a')]})[_0x38d5('0x34')](function(_0x211106){_0x519146[_0x38d5('0x50')]=_0x211106;if(_0xb465f0['query'][_0x38d5('0x51')]){_0x395764[_0x38d5('0x52')]=[{'all':!![]}];}return db['Disposition'][_0x38d5('0x53')](_0x395764);})['then'](function(_0x4b2f29){_0x519146['rows']=_0x4b2f29;return _0x519146;});}})[_0x38d5('0x34')](respondWithFilteredResult(_0x3d7bcc,_0x395764))[_0x38d5('0x29')](handleError(_0x3d7bcc,null));};exports[_0x38d5('0x67')]=function(_0x58afb7,_0x449682,_0x3c6095){var _0xe41908;return db[_0x38d5('0x4f')]['find']({'where':{'id':_0x58afb7['params']['id']}})[_0x38d5('0x34')](handleEntityNotFound(_0x449682,null))[_0x38d5('0x34')](function(_0x544395){if(_0x544395){return _0x544395[_0x38d5('0x67')](_0x58afb7[_0x38d5('0x3f')][_0x38d5('0x68')]);}})[_0x38d5('0x34')](respondWithStatusCode(_0x449682,null))['catch'](handleError(_0x449682,null));};exports['addAnswer']=function(_0x44a5ec,_0x4422f4,_0x162b20){if(_0x44a5ec[_0x38d5('0x58')]['id']){delete _0x44a5ec[_0x38d5('0x58')]['id'];}return db[_0x38d5('0x4f')][_0x38d5('0x5b')]({'where':{'id':_0x44a5ec[_0x38d5('0x55')]['id']}})[_0x38d5('0x34')](handleEntityNotFound(_0x4422f4,null))[_0x38d5('0x34')](function(_0x1cb91e){if(_0x1cb91e){_0x44a5ec[_0x38d5('0x58')][_0x38d5('0x65')]=_0x1cb91e['id'];return db[_0x38d5('0x69')]['create'](_0x44a5ec[_0x38d5('0x58')]);}})['then'](respondWithResult(_0x4422f4,null))['catch'](handleError(_0x4422f4,null));};exports[_0x38d5('0x6a')]=function(_0x32e180,_0x3bf43b,_0x639e5a){var _0x165b12={'raw':![],'where':{}};var _0x5c2d6d={};var _0x124cc6={'count':0x0,'rows':[]};return db[_0x38d5('0x4f')][_0x38d5('0x63')]({'where':{'id':_0x32e180[_0x38d5('0x55')]['id']}})[_0x38d5('0x34')](handleEntityNotFound(_0x3bf43b,null))[_0x38d5('0x34')](function(_0x18faac){if(_0x18faac){_0x5c2d6d['model']=_[_0x38d5('0x3e')](db[_0x38d5('0x69')][_0x38d5('0x56')]);_0x5c2d6d[_0x38d5('0x3f')]=_[_0x38d5('0x3e')](_0x32e180[_0x38d5('0x3f')]);_0x5c2d6d[_0x38d5('0x40')]=_[_0x38d5('0x41')](_0x5c2d6d[_0x38d5('0x3d')],_0x5c2d6d[_0x38d5('0x3f')]);_0x165b12[_0x38d5('0x43')]=_['intersection'](_0x5c2d6d[_0x38d5('0x3d')],qs[_0x38d5('0x42')](_0x32e180[_0x38d5('0x3f')][_0x38d5('0x42')]));_0x165b12[_0x38d5('0x43')]=_0x165b12[_0x38d5('0x43')]['length']?_0x165b12[_0x38d5('0x43')]:_0x5c2d6d[_0x38d5('0x3d')];if(!_0x32e180[_0x38d5('0x3f')][_0x38d5('0x45')](_0x38d5('0x46'))){_0x165b12[_0x38d5('0x2e')]=qs[_0x38d5('0x2e')](_0x32e180[_0x38d5('0x3f')][_0x38d5('0x2e')]);_0x165b12[_0x38d5('0x47')]=qs[_0x38d5('0x47')](_0x32e180[_0x38d5('0x3f')][_0x38d5('0x47')]);}_0x165b12[_0x38d5('0x48')]=qs[_0x38d5('0x49')](_0x32e180[_0x38d5('0x3f')][_0x38d5('0x49')]);_0x165b12['where']=qs[_0x38d5('0x40')](_[_0x38d5('0x64')](_0x32e180[_0x38d5('0x3f')],_0x5c2d6d[_0x38d5('0x40')]));_0x165b12[_0x38d5('0x4a')][_0x38d5('0x65')]=_0x18faac['id'];if(_0x32e180[_0x38d5('0x3f')][_0x38d5('0x4b')]){_0x165b12[_0x38d5('0x4a')]=_[_0x38d5('0x4d')](_0x165b12['where'],{'$or':_[_0x38d5('0x66')](_0x165b12['attributes'],function(_0x4dd9cc){var _0x5655f9={};_0x5655f9[_0x4dd9cc]={'$like':'%'+_0x32e180['query'][_0x38d5('0x4b')]+'%'};return _0x5655f9;})});}_0x165b12=_[_0x38d5('0x4d')]({},_0x165b12,_0x32e180[_0x38d5('0x4e')]);return db[_0x38d5('0x69')][_0x38d5('0x50')]({'where':_0x165b12[_0x38d5('0x4a')]})['then'](function(_0x5d20e7){_0x124cc6[_0x38d5('0x50')]=_0x5d20e7;if(_0x32e180[_0x38d5('0x3f')][_0x38d5('0x51')]){_0x165b12[_0x38d5('0x52')]=[{'all':!![]}];}return db[_0x38d5('0x69')][_0x38d5('0x53')](_0x165b12);})[_0x38d5('0x34')](function(_0x3996ec){_0x124cc6[_0x38d5('0x6b')]=_0x3996ec;return _0x124cc6;});}})[_0x38d5('0x34')](respondWithFilteredResult(_0x3bf43b,_0x165b12))[_0x38d5('0x29')](handleError(_0x3bf43b,null));};exports[_0x38d5('0x6c')]=function(_0xbd7a27,_0x1ae7e2,_0x504d25){var _0x1d39e2;return db['SmsAccount'][_0x38d5('0x5b')]({'where':{'id':_0xbd7a27['params']['id']}})[_0x38d5('0x34')](handleEntityNotFound(_0x1ae7e2,null))['then'](function(_0x539b51){if(_0x539b51){return _0x539b51['removeAnswers'](_0xbd7a27[_0x38d5('0x3f')][_0x38d5('0x68')]);}})[_0x38d5('0x34')](respondWithStatusCode(_0x1ae7e2,null))[_0x38d5('0x29')](handleError(_0x1ae7e2,null));};exports['notify']=function(_0x1dbdf3,_0x5b1174,_0x881709){var _0x2a015f={'channel':_0x38d5('0x6d')};var _0x54aece=[];var _0x32beac=[];var _0x43f9c3={};return db[_0x38d5('0x4f')]['find']({'where':{'id':_0x1dbdf3['params']['id']},'include':[{'model':db[_0x38d5('0x6e')],'as':_0x38d5('0x6f')}]})[_0x38d5('0x34')](handleEntityNotFound(_0x5b1174,null))[_0x38d5('0x34')](function(_0x28222a){_0x2a015f[_0x38d5('0x70')]=_0x28222a;_0x2a015f['applications']=_[_0x38d5('0x71')](_0x28222a[_0x38d5('0x6f')],[_0x38d5('0x72')],[_0x38d5('0x73')]);if(_0x2a015f[_0x38d5('0x70')][_0x38d5('0x6f')]){delete _0x2a015f[_0x38d5('0x70')][_0x38d5('0x6f')];}return db[_0x38d5('0x74')][_0x38d5('0x5f')]();})[_0x38d5('0x34')](function(_0x1ed1c5){if(!_0x1ed1c5){throw new db[(_0x38d5('0x75'))]['ValidationError'](_0x38d5('0x76'));}_0x54aece=_[_0x38d5('0x77')](_[_0x38d5('0x3e')](_0x1ed1c5),[_0x38d5('0x78'),_0x38d5('0x79')]);_0x32beac=_['difference'](_[_0x38d5('0x3e')](_0x1ed1c5),['createdAt','updatedAt',_0x38d5('0x7a'),_0x38d5('0x7b')]);_0x2a015f['body']={'mapKey':_0x38d5('0x7c')};if(_0x2a015f[_0x38d5('0x70')][_0x38d5('0x7d')]){switch(_0x2a015f['account'][_0x38d5('0x7d')]){case _0x38d5('0x7e'):_0x2a015f[_0x38d5('0x58')]['from']=_0x1dbdf3[_0x38d5('0x58')][_0x38d5('0x7f')];_0x2a015f[_0x38d5('0x58')][_0x38d5('0x58')]=_0x1dbdf3[_0x38d5('0x58')][_0x38d5('0x80')];_0x2a015f['body']['messageId']=_0x1dbdf3[_0x38d5('0x58')][_0x38d5('0x81')];break;case _0x38d5('0x82'):_0x2a015f['body']['from']='+'+_0x1dbdf3['body']['sender'];_0x2a015f['body'][_0x38d5('0x58')]=_0x1dbdf3[_0x38d5('0x58')][_0x38d5('0x83')];break;case _0x38d5('0x84'):_0x2a015f[_0x38d5('0x58')][_0x38d5('0x85')]=_0x1dbdf3[_0x38d5('0x58')][_0x38d5('0x85')];_0x2a015f['body'][_0x38d5('0x58')]=_0x1dbdf3['body'][_0x38d5('0x27')];break;case _0x38d5('0x86'):_0x2a015f[_0x38d5('0x58')][_0x38d5('0x85')]=_0x1dbdf3[_0x38d5('0x58')][_0x38d5('0x85')];_0x2a015f[_0x38d5('0x58')]['body']=_0x1dbdf3[_0x38d5('0x58')][_0x38d5('0x58')];_0x2a015f[_0x38d5('0x58')][_0x38d5('0x87')]=_0x1dbdf3[_0x38d5('0x58')][_0x38d5('0x88')];break;case'plivo':_0x2a015f[_0x38d5('0x58')][_0x38d5('0x85')]=_0x1dbdf3['body']['From'];_0x2a015f['body']['body']=_0x1dbdf3['body'][_0x38d5('0x89')];_0x2a015f['body']['messageId']=_0x1dbdf3['body'][_0x38d5('0x8a')];break;case _0x38d5('0x8b'):_0x2a015f[_0x38d5('0x58')][_0x38d5('0x85')]='+'+_0x1dbdf3[_0x38d5('0x58')][_0x38d5('0x8c')][0x0][_0x38d5('0x85')];_0x2a015f['body']['body']=_0x1dbdf3[_0x38d5('0x58')][_0x38d5('0x8c')][0x0][_0x38d5('0x83')];_0x2a015f[_0x38d5('0x58')][_0x38d5('0x87')]=_0x1dbdf3[_0x38d5('0x58')][_0x38d5('0x8c')][0x0][_0x38d5('0x87')];break;case'csc':_0x2a015f[_0x38d5('0x58')][_0x38d5('0x85')]=_0x1dbdf3[_0x38d5('0x58')]['originatingAddress'];_0x2a015f[_0x38d5('0x58')][_0x38d5('0x58')]=_0x1dbdf3[_0x38d5('0x58')][_0x38d5('0x8d')][_0x38d5('0x27')];break;case'clickatell':_0x2a015f['body'][_0x38d5('0x85')]=_0x1dbdf3[_0x38d5('0x58')][_0x38d5('0x8e')];_0x2a015f['body']['body']=_0x1dbdf3['body'][_0x38d5('0x83')];_0x2a015f[_0x38d5('0x58')]['messageId']=_0x1dbdf3['body'][_0x38d5('0x8f')];break;case'intelepeer':_0x2a015f[_0x38d5('0x58')][_0x38d5('0x85')]=_0x1dbdf3[_0x38d5('0x58')][_0x38d5('0x85')];_0x2a015f[_0x38d5('0x58')][_0x38d5('0x58')]=_0x1dbdf3[_0x38d5('0x58')][_0x38d5('0x27')];_0x2a015f[_0x38d5('0x58')]['messageId']=_0x1dbdf3[_0x38d5('0x58')]['refid'];break;}}if(_0x2a015f[_0x38d5('0x58')]['id']){delete _0x2a015f[_0x38d5('0x58')]['id'];}if(_[_0x38d5('0x90')](_0x2a015f['body']['from'])){throw new db[(_0x38d5('0x75'))][(_0x38d5('0x91'))]('from\x20is\x20mandatory');}if(_[_0x38d5('0x90')](_0x2a015f['body'][_0x38d5('0x58')])||_0x2a015f['body'][_0x38d5('0x58')]===''){throw new db[(_0x38d5('0x75'))][(_0x38d5('0x91'))](_0x38d5('0x92'));}if(_['isNil'](_0x2a015f[_0x38d5('0x58')][_0x38d5('0x93')])){throw new db[(_0x38d5('0x75'))][(_0x38d5('0x91'))](_0x38d5('0x94')+_0x32beac);}if(!_[_0x38d5('0x95')](_0x32beac,_0x2a015f[_0x38d5('0x58')][_0x38d5('0x93')])){throw new db[(_0x38d5('0x75'))][(_0x38d5('0x91'))](_0x38d5('0x96')+_0x32beac);}_0x43f9c3[_0x2a015f[_0x38d5('0x58')][_0x38d5('0x93')]]=_0x2a015f[_0x38d5('0x58')][_0x38d5('0x85')];return db['CmList'][_0x38d5('0x5b')]({'where':{'id':_0x2a015f['account'][_0x38d5('0x7b')]},'include':[{'model':db[_0x38d5('0x74')],'as':_0x38d5('0x97'),'where':_0x43f9c3,'limit':0x1,'order':[[_0x38d5('0x79'),'DESC']]}]});})[_0x38d5('0x34')](handleEntityNotFound(_0x5b1174,null))[_0x38d5('0x34')](function(_0x10651b){if(_0x10651b){_0x2a015f['list']=_[_0x38d5('0x98')](_0x10651b,[_0x38d5('0x97')]);if(_0x10651b[_0x38d5('0x97')]['length']){return _0x10651b[_0x38d5('0x97')][0x0];}var _0x166b73=_[_0x38d5('0x18')](_0x2a015f[_0x38d5('0x58')],{'firstName':_0x2a015f[_0x38d5('0x58')][_0x38d5('0x85')],'ListId':_0x10651b['id']});_0x166b73[_0x2a015f[_0x38d5('0x58')][_0x38d5('0x93')]]=_0x2a015f[_0x38d5('0x58')]['from'];return db[_0x38d5('0x74')][_0x38d5('0x57')](_0x166b73,{'fields':_0x54aece,'raw':!![]});}})[_0x38d5('0x34')](handleEntityNotFound(_0x5b1174,null))[_0x38d5('0x34')](function(_0x4e3c97){if(_0x4e3c97){_0x2a015f[_0x38d5('0x99')]=_0x4e3c97;var _0x604335={'ContactId':_0x4e3c97['id'],'phone':_0x2a015f['body'][_0x38d5('0x85')],'SmsAccountId':_0x1dbdf3[_0x38d5('0x55')]['id']};var _0x1490da={'ContactId':_0x4e3c97['id'],'SmsAccountId':_0x1dbdf3[_0x38d5('0x55')]['id'],'closed':![]};return db[_0x38d5('0x9a')]['find']({'where':_0x1490da})[_0x38d5('0x34')](function(_0x450187){if(_0x450187){return[_0x450187,![]];}return db[_0x38d5('0x9a')]['create'](_0x604335)[_0x38d5('0x34')](function(_0x287619){return[_0x287619,!![]];});});}})['spread'](function(_0x14e81f,_0x3e4d06){_0x2a015f['interaction']=_0x14e81f[_0x38d5('0x35')]({'plain':!![]});_0x2a015f['interaction']['created']=![];if(_0x3e4d06){if(_0x2a015f[_0x38d5('0x70')][_0x38d5('0x9b')]){_0x2a015f[_0x38d5('0x9c')][_0x38d5('0x9d')]({'id':0x0,'priority':_0x2a015f[_0x38d5('0x9c')][_0x38d5('0x44')]+0x1,'app':'close','appdata':_0x38d5('0x9e'),'interval':_0x38d5('0x9f')});}_0x2a015f[_0x38d5('0xa0')][_0x38d5('0xa1')]=!![];}return db['SmsMessage'][_0x38d5('0x57')]({'phone':_0x2a015f[_0x38d5('0x58')][_0x38d5('0x85')],'messageId':_0x2a015f[_0x38d5('0x58')]['messageId'],'body':_0x2a015f[_0x38d5('0x58')][_0x38d5('0x58')],'SmsAccountId':_0x1dbdf3[_0x38d5('0x55')]['id'],'SmsInteractionId':_0x14e81f['id'],'direction':'in','ContactId':_0x14e81f[_0x38d5('0xa2')],'AttachmentId':_0x2a015f[_0x38d5('0x58')][_0x38d5('0xa3')]});})[_0x38d5('0x34')](function(_0x242a45){_0x2a015f['message']=_0x242a45;if(_0x2a015f[_0x38d5('0xa0')][_0x38d5('0xa4')]){return db[_0x38d5('0xa5')][_0x38d5('0x5b')]({'attributes':['id',_0x38d5('0x39')],'where':{'id':_0x2a015f[_0x38d5('0xa0')][_0x38d5('0xa4')]}})[_0x38d5('0x34')](function(_0x1e10d0){if(_0x1e10d0){_0x2a015f[_0x38d5('0x9c')][_0x38d5('0xa6')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1e10d0[_0x38d5('0x39')]+','+(_0x2a015f['account']['waitForTheAssignedAgent']||0xa),'interval':_0x38d5('0x9f')});}return respondWithRpcPromise(_0x38d5('0xa7'),'startRouting',_0x2a015f);});}return respondWithRpcPromise(_0x38d5('0xa7'),_0x38d5('0xa8'),_0x2a015f);})[_0x38d5('0x34')](function(_0x241074){if(_0x241074){var _0x255208=0xc8;var _0x277c25=_0x38d5('0xa9');logger[_0x38d5('0x20')](_0x38d5('0x24'),_0x277c25,_0x255208,_0x38d5('0xaa'));logger[_0x38d5('0x23')](_0x38d5('0xab'),_0x277c25,_0x255208,_0x38d5('0xaa'),JSON[_0x38d5('0x25')](_0x241074));if(_0x2a015f[_0x38d5('0x70')]['type']===_0x38d5('0x7e')){return _0x5b1174[_0x38d5('0x2c')](_0x255208)['set'](_0x38d5('0xac'),'text/xml')[_0x38d5('0x3a')](_0x38d5('0xad'));}else{return _0x5b1174['status'](_0x255208)[_0x38d5('0x2d')](_0x241074);}}})[_0x38d5('0x29')](handleError(_0x5b1174,null));};exports[_0x38d5('0xae')]=function(_0x1922a0,_0x444df9,_0x4ba718){return db[_0x38d5('0x4f')][_0x38d5('0x63')]({'where':{'id':_0x1922a0[_0x38d5('0x55')]['id']}})[_0x38d5('0x34')](handleEntityNotFound(_0x444df9,null))[_0x38d5('0x34')](function(_0x2b71f7){if(_0x2b71f7){return db[_0x38d5('0xaf')][_0x38d5('0xb0')](function(_0x29dd2b){return db[_0x38d5('0x6e')]['destroy']({'where':{'SmsAccountId':_0x1922a0[_0x38d5('0x55')]['id']},'transaction':_0x29dd2b})[_0x38d5('0x34')](function(_0x576e1f){var _0x36ac0c=_['map'](_0x1922a0[_0x38d5('0x58')],function(_0x552fa5){_0x552fa5[_0x38d5('0x65')]=_0x1922a0[_0x38d5('0x55')]['id'];return _0x552fa5;});return db[_0x38d5('0x6e')][_0x38d5('0xb1')](_0x36ac0c,{'transaction':_0x29dd2b});});})[_0x38d5('0x34')](function(){return db[_0x38d5('0x6e')]['findAndCountAll']({'where':{'SmsAccountId':_0x1922a0[_0x38d5('0x55')]['id']},'order':'priority'});});}})[_0x38d5('0x34')](respondWithResult(_0x444df9,null))[_0x38d5('0x29')](handleError(_0x444df9,null));};exports[_0x38d5('0xb2')]=function(_0x55a4a0,_0x52d5a7,_0x321756){var _0x324d4f={};var _0x57c77a={};var _0x5b5cde;var _0x33c837;return db[_0x38d5('0x4f')][_0x38d5('0x63')]({'where':{'id':_0x55a4a0['params']['id']}})['then'](handleEntityNotFound(_0x52d5a7,null))['then'](function(_0x4f65ca){if(_0x4f65ca){_0x5b5cde=_0x4f65ca;_0x57c77a[_0x38d5('0x3d')]=_[_0x38d5('0x3e')](db[_0x38d5('0x6e')][_0x38d5('0x56')]);_0x57c77a[_0x38d5('0x3f')]=_[_0x38d5('0x3e')](_0x55a4a0['query']);_0x57c77a['filters']=_[_0x38d5('0x41')](_0x57c77a[_0x38d5('0x3d')],_0x57c77a['query']);_0x324d4f[_0x38d5('0x43')]=_[_0x38d5('0x41')](_0x57c77a['model'],qs[_0x38d5('0x42')](_0x55a4a0[_0x38d5('0x3f')][_0x38d5('0x42')]));_0x324d4f[_0x38d5('0x43')]=_0x324d4f[_0x38d5('0x43')]['length']?_0x324d4f[_0x38d5('0x43')]:_0x57c77a['model'];_0x324d4f['order']=qs[_0x38d5('0x49')](_0x55a4a0[_0x38d5('0x3f')]['sort']);_0x324d4f[_0x38d5('0x4a')]=qs['filters'](_[_0x38d5('0x64')](_0x55a4a0[_0x38d5('0x3f')],_0x57c77a[_0x38d5('0x40')]));if(_0x55a4a0[_0x38d5('0x3f')][_0x38d5('0x4b')]){_0x324d4f[_0x38d5('0x4a')]=_['merge'](_0x324d4f[_0x38d5('0x4a')],{'$or':_['map'](_0x324d4f['attributes'],function(_0xb94b3d){var _0x3ba21e={};_0x3ba21e[_0xb94b3d]={'$like':'%'+_0x55a4a0[_0x38d5('0x3f')]['filter']+'%'};return _0x3ba21e;})});}_0x324d4f=_[_0x38d5('0x4d')]({},_0x324d4f,_0x55a4a0[_0x38d5('0x4e')]);return _0x5b5cde[_0x38d5('0xb2')](_0x324d4f);}})['then'](function(_0x19e6a7){if(_0x19e6a7){_0x33c837=_0x19e6a7[_0x38d5('0x44')];if(!_0x55a4a0['query'][_0x38d5('0x45')](_0x38d5('0x46'))){_0x324d4f[_0x38d5('0x2e')]=qs['limit'](_0x55a4a0[_0x38d5('0x3f')][_0x38d5('0x2e')]);_0x324d4f[_0x38d5('0x47')]=qs[_0x38d5('0x47')](_0x55a4a0[_0x38d5('0x3f')][_0x38d5('0x47')]);}return _0x5b5cde[_0x38d5('0xb2')](_0x324d4f);}})[_0x38d5('0x34')](function(_0x51ddb2){if(_0x51ddb2){return _0x51ddb2?{'count':_0x33c837,'rows':_0x51ddb2}:null;}})[_0x38d5('0x34')](respondWithResult(_0x52d5a7,null))['catch'](handleError(_0x52d5a7,null));};exports[_0x38d5('0xb3')]=function(_0x629eb5,_0x16de3b,_0x241120){var _0x20b267={'raw':![],'where':{}};var _0x338d15={};var _0x409cc3={'count':0x0,'rows':[]};return db[_0x38d5('0x4f')][_0x38d5('0x63')]({'where':{'id':_0x629eb5[_0x38d5('0x55')]['id']}})['then'](handleEntityNotFound(_0x16de3b,null))[_0x38d5('0x34')](function(_0x43a019){if(_0x43a019){_0x338d15['model']=_[_0x38d5('0x3e')](db[_0x38d5('0x9a')]['rawAttributes']);_0x338d15[_0x38d5('0x3f')]=_['keys'](_0x629eb5[_0x38d5('0x3f')]);_0x338d15[_0x38d5('0x40')]=_[_0x38d5('0x41')](_0x338d15[_0x38d5('0x3d')],_0x338d15[_0x38d5('0x3f')]);_0x20b267[_0x38d5('0x43')]=_[_0x38d5('0x41')](_0x338d15[_0x38d5('0x3d')],qs[_0x38d5('0x42')](_0x629eb5[_0x38d5('0x3f')][_0x38d5('0x42')]));_0x20b267[_0x38d5('0x43')]=_0x20b267[_0x38d5('0x43')][_0x38d5('0x44')]?_0x20b267[_0x38d5('0x43')]:_0x338d15['model'];if(!_0x629eb5[_0x38d5('0x3f')][_0x38d5('0x45')](_0x38d5('0x46'))){_0x20b267[_0x38d5('0x2e')]=qs['limit'](_0x629eb5[_0x38d5('0x3f')][_0x38d5('0x2e')]);_0x20b267[_0x38d5('0x47')]=qs['offset'](_0x629eb5[_0x38d5('0x3f')][_0x38d5('0x47')]);}_0x20b267[_0x38d5('0x48')]=qs['sort'](_0x629eb5[_0x38d5('0x3f')]['sort']);_0x20b267[_0x38d5('0x4a')]=qs[_0x38d5('0x40')](_['pick'](_0x629eb5[_0x38d5('0x3f')],_0x338d15[_0x38d5('0x40')]));_0x20b267[_0x38d5('0x4a')][_0x38d5('0x65')]=_0x43a019['id'];if(_0x629eb5[_0x38d5('0x3f')]['filter']){_0x20b267[_0x38d5('0x4a')]=_[_0x38d5('0x4d')](_0x20b267['where'],{'$or':_[_0x38d5('0x66')](_0x20b267[_0x38d5('0x43')],function(_0x474331){var _0x425ebd={};_0x425ebd[_0x474331]={'$like':'%'+_0x629eb5['query']['filter']+'%'};return _0x425ebd;})});}_0x20b267=_['merge']({},_0x20b267,_0x629eb5[_0x38d5('0x4e')]);return db['SmsInteraction'][_0x38d5('0x50')]({'where':_0x20b267[_0x38d5('0x4a')]})['then'](function(_0x170929){_0x409cc3[_0x38d5('0x50')]=_0x170929;if(_0x629eb5[_0x38d5('0x3f')][_0x38d5('0x51')]){_0x20b267['include']=[{'model':db[_0x38d5('0x74')],'as':'Contact','required':![]},{'model':db[_0x38d5('0xa5')],'as':_0x38d5('0xb4'),'attributes':[_0x38d5('0x39'),_0x38d5('0xb5'),_0x38d5('0xb6')],'required':![]},{'model':db[_0x38d5('0xb7')],'as':_0x38d5('0xb8'),'attributes':['id',_0x38d5('0x39'),_0x38d5('0xb9')],'where':_0x629eb5[_0x38d5('0x3f')][_0x38d5('0xba')]?{'id':_0x629eb5[_0x38d5('0x3f')]['tag']}:undefined,'required':_0x629eb5[_0x38d5('0x3f')][_0x38d5('0xba')]?!![]:![]}];}return db[_0x38d5('0x9a')]['findAll'](_0x20b267);})[_0x38d5('0x34')](function(_0x1df221){_0x409cc3[_0x38d5('0x6b')]=_0x1df221;return _0x409cc3;});}})[_0x38d5('0x34')](respondWithFilteredResult(_0x16de3b,_0x20b267))[_0x38d5('0x29')](handleError(_0x16de3b,null));};exports[_0x38d5('0x3a')]=function(_0x4ba824,_0x245135,_0x5d64f6){var _0x28d240,_0x2153c0,_0x1db86f;if(_['isNil'](_0x4ba824[_0x38d5('0x58')][_0x38d5('0x58')])||_0x4ba824[_0x38d5('0x58')][_0x38d5('0x58')]===''){throw new db[(_0x38d5('0x75'))][(_0x38d5('0x91'))](_0x38d5('0x92'));}if(_[_0x38d5('0x90')](_0x4ba824[_0x38d5('0x58')]['to'])){throw new db[(_0x38d5('0x75'))][(_0x38d5('0x91'))](_0x38d5('0xbb'));}_0x28d240=_0x4ba824[_0x38d5('0x58')]['to'];return db[_0x38d5('0x4f')]['find']({'where':{'id':_0x4ba824[_0x38d5('0x55')]['id']},'include':[{'model':db[_0x38d5('0xbc')],'as':_0x38d5('0xbd'),'include':[{'model':db[_0x38d5('0x74')],'as':_0x38d5('0x97'),'where':{'mobile':_0x28d240},'limit':0x1,'order':[[_0x38d5('0x79'),_0x38d5('0xbe')]]}]}]})[_0x38d5('0x34')](handleEntityNotFound(_0x245135,null))[_0x38d5('0x34')](function(_0x42e7fa){if(_0x42e7fa&&_0x42e7fa['List']){_0x2153c0=_0x42e7fa[_0x38d5('0x35')]({'plain':!![]});if(_0x2153c0['List']&&_0x2153c0[_0x38d5('0xbd')][_0x38d5('0x97')][_0x38d5('0x44')]){return _0x2153c0['List'][_0x38d5('0x97')][0x0];}return db[_0x38d5('0x74')][_0x38d5('0x57')](_[_0x38d5('0x18')](_0x4ba824[_0x38d5('0x58')],{'firstName':_0x28d240,'mobile':_0x28d240,'phone':_0x28d240,'ListId':_0x2153c0[_0x38d5('0x7b')]}));}})['then'](handleEntityNotFound(_0x245135,null))[_0x38d5('0x34')](function(_0xbd5a13){if(_0xbd5a13){_0x1db86f=_0xbd5a13;return db['SmsInteraction'][_0x38d5('0x5b')]({'where':{'ContactId':_0x1db86f['id'],'closed':![],'SmsAccountId':_0x2153c0['id']}})[_0x38d5('0x34')](function(_0x12f5b9){if(_0x12f5b9){return[_0x12f5b9,![]];}return db[_0x38d5('0x9a')][_0x38d5('0x57')]({'UserId':_0x4ba824[_0x38d5('0x59')]['id'],'ContactId':_0x1db86f['id'],'SmsAccountId':_0x2153c0['id'],'phone':_0x28d240,'firstMsgDirection':_0x38d5('0xbf'),'Messages':[_[_0x38d5('0x4d')](_0x4ba824[_0x38d5('0x58')],{'read':![],'body':_0x4ba824[_0x38d5('0x58')][_0x38d5('0x58')],'phone':_0x28d240,'SmsAccountId':_0x2153c0['id'],'UserId':_0x4ba824[_0x38d5('0x59')]['id'],'ContactId':_0x1db86f['id']})]},{'include':[{'model':db[_0x38d5('0xc0')],'as':_0x38d5('0xc1')}]})['then'](function(_0x202281){return[_0x202281,!![]];});});}})[_0x38d5('0xc2')](function(_0x82d81c,_0x19cbb1){if(_0x19cbb1){return _0x82d81c;}return db[_0x38d5('0xc0')][_0x38d5('0x57')](_[_0x38d5('0x4d')](_0x4ba824[_0x38d5('0x58')],{'read':![],'body':_0x4ba824[_0x38d5('0x58')]['body'],'phone':_0x28d240,'SmsAccountId':_0x2153c0['id'],'SmsInteractionId':_0x82d81c['id'],'UserId':_0x4ba824[_0x38d5('0x59')]['id'],'ContactId':_0x1db86f['id']}))[_0x38d5('0x34')](function(_0x24bf9e){_0x82d81c['dataValues'][_0x38d5('0xc1')]=[];_0x82d81c[_0x38d5('0xc3')]['Messages'][_0x38d5('0x9d')](_0x24bf9e[_0x38d5('0xc3')]);return _0x82d81c;});})['then'](respondWithResult(_0x245135,null))[_0x38d5('0x29')](handleError(_0x245135,null));};exports[_0x38d5('0x2c')]=function(_0x279943,_0x4a8948,_0x237ce9){if(_0x279943[_0x38d5('0x58')]['id']){delete _0x279943[_0x38d5('0x58')]['id'];}console[_0x38d5('0xc4')](_0x38d5('0xc5'),_0x279943[_0x38d5('0x58')]);var _0x159fc5,_0x1d0423,_0x3d1639;return db[_0x38d5('0x4f')][_0x38d5('0x5b')]({'where':{'id':_0x279943[_0x38d5('0x55')]['id']}})['then'](handleEntityNotFound(_0x4a8948,null))['then'](function(_0x48bd71){if(_0x48bd71){_0x3d1639=_0x48bd71;logger[_0x38d5('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x38d5('0x2c'),_0x38d5('0xc6'),_0x48bd71[_0x38d5('0x7d')],util['inspect'](_0x279943[_0x38d5('0x58')],{'showHidden':![],'depth':null}));switch(_0x48bd71[_0x38d5('0x7d')]){case _0x38d5('0x82'):if(_0x279943[_0x38d5('0x58')][_0x38d5('0xc7')]&&_0x279943[_0x38d5('0x58')][_0x38d5('0x2c')]){_0x1d0423=_0x279943['body']['status'];return db[_0x38d5('0xc0')][_0x38d5('0x5b')]({'where':{'messageId':_0x279943[_0x38d5('0x58')]['skebby_dispatch_id']}});}break;case _0x38d5('0x84'):if(_0x279943['body'][_0x38d5('0xc8')]&&_0x279943[_0x38d5('0x58')]['statusInt']){_0x1d0423=_0x279943[_0x38d5('0x58')][_0x38d5('0xc9')];return db[_0x38d5('0xc0')][_0x38d5('0x5b')]({'where':{'messageId':_0x279943[_0x38d5('0x58')][_0x38d5('0xc8')]}});}break;case'clicksend':if(_0x279943[_0x38d5('0x58')][_0x38d5('0x88')]&&_0x279943[_0x38d5('0x58')][_0x38d5('0xca')]){_0x1d0423=_0x279943[_0x38d5('0x58')][_0x38d5('0xca')];return db[_0x38d5('0xc0')]['find']({'where':{'messageId':_0x279943[_0x38d5('0x58')][_0x38d5('0x88')]}});}break;case'infobip':var _0x3cbbb7=_0x279943[_0x38d5('0x58')]['results'][0x0];if(_0x3cbbb7[_0x38d5('0x87')]&&_0x3cbbb7['status'][_0x38d5('0xcb')]===_0x38d5('0xcc')){_0x1d0423=_0x3cbbb7[_0x38d5('0x2c')][_0x38d5('0xcb')];return db['SmsMessage']['find']({'where':{'messageId':_0x3cbbb7[_0x38d5('0x87')]}});}break;case _0x38d5('0xcd'):if(_0x279943[_0x38d5('0x58')]['messageId']&&_0x279943[_0x38d5('0x58')][_0x38d5('0x2c')]){_0x1d0423=_0x279943[_0x38d5('0x58')][_0x38d5('0x2c')];return db['SmsMessage'][_0x38d5('0x5b')]({'where':{'messageId':_0x279943[_0x38d5('0x58')][_0x38d5('0x87')]}});}break;case _0x38d5('0xce'):if(_0x279943[_0x38d5('0x58')][_0x38d5('0xcf')]&&_0x279943[_0x38d5('0x58')][_0x38d5('0x2c')]){_0x1d0423=_0x279943[_0x38d5('0x58')][_0x38d5('0x2c')];return db[_0x38d5('0xc0')][_0x38d5('0x5b')]({'where':{'messageId':_0x279943[_0x38d5('0x58')][_0x38d5('0xcf')]}});}break;}}})[_0x38d5('0x34')](handleEntityNotFound(_0x4a8948,null))[_0x38d5('0x34')](function(_0x5b6f58){if(_0x5b6f58){_0x159fc5=_0x5b6f58;switch(_0x3d1639[_0x38d5('0x7d')]){case _0x38d5('0x82'):if(_0x1d0423==='DELIVERED'){return _0x159fc5['update']({'read':!![]});}else{logger['error'](_0x38d5('0x24'),_0x38d5('0x2c'),_0x38d5('0x82'),util[_0x38d5('0xd0')](_0x279943[_0x38d5('0x58')],{'showHidden':![],'depth':null}));}break;case _0x38d5('0x84'):if(_0x1d0423==='1'){return _0x159fc5[_0x38d5('0x33')]({'read':!![]});}else{logger[_0x38d5('0x26')](_0x38d5('0x24'),_0x38d5('0x2c'),_0x38d5('0x82'),util['inspect'](_0x279943[_0x38d5('0x58')],{'showHidden':![],'depth':null}));}break;case _0x38d5('0x86'):if(!_0x279943['body']['error_code']&&_0x1d0423>=0xc8&&_0x1d0423<=0xce){return _0x159fc5['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x38d5('0x86'),util[_0x38d5('0xd0')](_0x279943[_0x38d5('0x58')],{'showHidden':![],'depth':null}));}break;case _0x38d5('0x8b'):var _0x3335e3=_0x279943[_0x38d5('0x58')][_0x38d5('0x8c')][0x0];if(_0x3335e3['status']['groupName']===_0x38d5('0xcc')){return _0x159fc5[_0x38d5('0x33')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x38d5('0x2c'),_0x38d5('0x8b'),util[_0x38d5('0xd0')](_0x279943[_0x38d5('0x58')],{'showHidden':![],'depth':null}));}break;case _0x38d5('0xcd'):if(_0x1d0423==_0x38d5('0xd1')||_0x1d0423==_0x38d5('0xd2')){return _0x159fc5[_0x38d5('0x33')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x38d5('0x2c'),_0x38d5('0xcd'),util[_0x38d5('0xd0')](_0x279943['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x1d0423===_0x38d5('0xd3')||_0x1d0423===_0x38d5('0xd4')){return _0x159fc5[_0x38d5('0x33')]({'read':!![]});}else{logger[_0x38d5('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x38d5('0x2c'),_0x38d5('0xce'),util[_0x38d5('0xd0')](_0x279943[_0x38d5('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x159fc5;}})[_0x38d5('0x34')](respondWithResult(_0x4a8948,null))[_0x38d5('0x29')](handleError(_0x4a8948,null));};exports[_0x38d5('0xd5')]=function(_0x8b01bd,_0x55e341,_0x3a1938){var _0x580128,_0x3927ff,_0x404cca;return db[_0x38d5('0x4f')][_0x38d5('0x5b')]({'where':{'id':_0x8b01bd[_0x38d5('0x55')]['id']}})['then'](handleEntityNotFound(_0x55e341,null))['then'](function(_0xc6b2f){if(_0xc6b2f){_0x404cca=_0xc6b2f;logger[_0x38d5('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x38d5('0x2c'),_0x38d5('0xc6'),_0xc6b2f['type'],util[_0x38d5('0xd0')](_0x8b01bd['query'],{'showHidden':![],'depth':null}));switch(_0xc6b2f[_0x38d5('0x7d')]){case'csc':if(_0x8b01bd[_0x38d5('0x3f')][_0x38d5('0xd6')]&&_0x8b01bd['query']['state']){_0x3927ff=_0x8b01bd[_0x38d5('0x3f')]['state'];return db[_0x38d5('0xc0')]['find']({'where':{'messageId':_0x8b01bd[_0x38d5('0x3f')][_0x38d5('0xd6')]}});}break;}}})[_0x38d5('0x34')](handleEntityNotFound(_0x55e341,null))[_0x38d5('0x34')](function(_0x248fe9){if(_0x248fe9){_0x580128=_0x248fe9;switch(_0x404cca[_0x38d5('0x7d')]){case _0x38d5('0xd7'):if(_0x3927ff==='2'||_0x3927ff==='6'){return _0x580128[_0x38d5('0x33')]({'read':!![]});}else{logger[_0x38d5('0x26')](_0x38d5('0x24'),_0x38d5('0x2c'),_0x38d5('0xd7'),util[_0x38d5('0xd0')](_0x8b01bd[_0x38d5('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0x580128;}})[_0x38d5('0x34')](respondWithResult(_0x55e341,null))['catch'](handleError(_0x55e341,null));};exports[_0x38d5('0xd8')]=function(_0xc59be4,_0x190ff2,_0x27e021){return db[_0x38d5('0x4f')][_0x38d5('0x5b')]({'where':{'id':_0xc59be4['params']['id']}})[_0x38d5('0x34')](handleEntityNotFound(_0x190ff2,null))[_0x38d5('0x34')](function(_0x2eadfe){if(_0x2eadfe){return _0x2eadfe[_0x38d5('0xd8')](_0xc59be4[_0x38d5('0x58')][_0x38d5('0x68')],_[_0x38d5('0x98')](_0xc59be4[_0x38d5('0x58')],[_0x38d5('0x68'),'id'])||{})[_0x38d5('0xc2')](function(_0x569ad5){for(var _0x14460f=0x0;_0x14460f<_0xc59be4[_0x38d5('0x58')][_0x38d5('0x68')][_0x38d5('0x44')];_0x14460f+=0x1){socket['emit'](_0x38d5('0xd9'),{'UserId':_0xc59be4[_0x38d5('0x58')][_0x38d5('0x68')][_0x14460f],'SmsAccountId':_0xc59be4['params']['id']});}return _0x569ad5;});}})[_0x38d5('0x34')](respondWithResult(_0x190ff2,null))[_0x38d5('0x29')](handleError(_0x190ff2,null));};exports['removeAgents']=function(_0x1d6777,_0x45ca1e,_0x21b5d5){var _0x13b988;return db['SmsAccount'][_0x38d5('0x5b')]({'where':{'id':_0x1d6777['params']['id']}})[_0x38d5('0x34')](handleEntityNotFound(_0x45ca1e,null))[_0x38d5('0x34')](function(_0x331bc0){if(_0x331bc0){return _0x331bc0[_0x38d5('0xda')](_0x1d6777[_0x38d5('0x3f')][_0x38d5('0x68')])[_0x38d5('0x34')](function(_0x39a2ad){if(_[_0x38d5('0xdb')](_0x1d6777['query'][_0x38d5('0x68')])){for(var _0x130bfa=0x0;_0x130bfa<_0x1d6777[_0x38d5('0x3f')][_0x38d5('0x68')][_0x38d5('0x44')];_0x130bfa+=0x1){socket[_0x38d5('0xdc')](_0x38d5('0xdd'),{'UserId':_0x1d6777[_0x38d5('0x3f')][_0x38d5('0x68')][_0x130bfa],'SmsAccountId':_0x1d6777[_0x38d5('0x55')]['id']});}}else{socket[_0x38d5('0xdc')](_0x38d5('0xdd'),{'UserId':_0x1d6777['query'][_0x38d5('0x68')],'SmsAccountId':_0x1d6777['params']['id']});}});}})[_0x38d5('0x34')](respondWithStatusCode(_0x45ca1e,null))['catch'](handleError(_0x45ca1e,null));};exports[_0x38d5('0xde')]=function(_0x43c7ba,_0x5f2fad,_0xa3c85a){var _0x48e857={};var _0xcb76f5={};var _0x208c35;var _0x5756de;return db['SmsAccount']['findOne']({'where':{'id':_0x43c7ba[_0x38d5('0x55')]['id']}})[_0x38d5('0x34')](handleEntityNotFound(_0x5f2fad,null))['then'](function(_0x9c4bd){if(_0x9c4bd){_0x208c35=_0x9c4bd;_0xcb76f5[_0x38d5('0x3d')]=_[_0x38d5('0x3e')](db[_0x38d5('0xa5')]['rawAttributes']);_0xcb76f5['query']=_[_0x38d5('0x3e')](_0x43c7ba['query']);_0xcb76f5[_0x38d5('0x40')]=_[_0x38d5('0x41')](_0xcb76f5[_0x38d5('0x3d')],_0xcb76f5[_0x38d5('0x3f')]);_0x48e857[_0x38d5('0x43')]=_[_0x38d5('0x41')](_0xcb76f5['model'],qs['fields'](_0x43c7ba[_0x38d5('0x3f')][_0x38d5('0x42')]));_0x48e857[_0x38d5('0x43')]=_0x48e857[_0x38d5('0x43')][_0x38d5('0x44')]?_0x48e857['attributes']:_0xcb76f5[_0x38d5('0x3d')];_0x48e857['order']=qs[_0x38d5('0x49')](_0x43c7ba[_0x38d5('0x3f')][_0x38d5('0x49')]);_0x48e857['where']=qs['filters'](_['pick'](_0x43c7ba[_0x38d5('0x3f')],_0xcb76f5[_0x38d5('0x40')]));if(_0x43c7ba[_0x38d5('0x3f')][_0x38d5('0x4b')]){_0x48e857[_0x38d5('0x4a')]=_[_0x38d5('0x4d')](_0x48e857[_0x38d5('0x4a')],{'$or':_[_0x38d5('0x66')](_0x48e857[_0x38d5('0x43')],function(_0x25dd02){var _0x55defc={};_0x55defc[_0x25dd02]={'$like':'%'+_0x43c7ba[_0x38d5('0x3f')][_0x38d5('0x4b')]+'%'};return _0x55defc;})});}_0x48e857=_[_0x38d5('0x4d')]({},_0x48e857,_0x43c7ba['options']);return _0x208c35[_0x38d5('0xde')](_0x48e857);}})['then'](function(_0x1c396d){if(_0x1c396d){_0x5756de=_0x1c396d[_0x38d5('0x44')];if(!_0x43c7ba['query'][_0x38d5('0x45')](_0x38d5('0x46'))){_0x48e857[_0x38d5('0x2e')]=qs['limit'](_0x43c7ba['query'][_0x38d5('0x2e')]);_0x48e857[_0x38d5('0x47')]=qs[_0x38d5('0x47')](_0x43c7ba[_0x38d5('0x3f')][_0x38d5('0x47')]);}return _0x208c35[_0x38d5('0xde')](_0x48e857);}})[_0x38d5('0x34')](function(_0x4f8112){if(_0x4f8112){return _0x4f8112?{'count':_0x5756de,'rows':_0x4f8112}:null;}})['then'](respondWithResult(_0x5f2fad,null))[_0x38d5('0x29')](handleError(_0x5f2fad,null));};
\ No newline at end of file
index cd03b0f..5b0ef93 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf429=['hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','hasOwnProperty'];(function(_0x4f3cd4,_0x1cc196){var _0x596365=function(_0x4ef06c){while(--_0x4ef06c){_0x4f3cd4['push'](_0x4f3cd4['shift']());}};_0x596365(++_0x1cc196);}(_0xf429,0x138));var _0x9f42=function(_0x5c84a6,_0x321f95){_0x5c84a6=_0x5c84a6-0x0;var _0xb8c5f0=_0xf429[_0x5c84a6];return _0xb8c5f0;};'use strict';var EventEmitter=require(_0x9f42('0x0'));var SmsAccount=require(_0x9f42('0x1'))['db'][_0x9f42('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x9f42('0x3')](0x0);var events={'afterCreate':_0x9f42('0x4'),'afterUpdate':_0x9f42('0x5'),'afterDestroy':_0x9f42('0x6')};function emitEvent(_0xfaf76b){return function(_0x840d59,_0x23b416,_0x45fa83){SmsAccountEvents['emit'](_0xfaf76b+':'+_0x840d59['id'],_0x840d59);SmsAccountEvents['emit'](_0xfaf76b,_0x840d59);_0x45fa83(null);};}for(var e in events){if(events[_0x9f42('0x7')](e)){var event=events[e];SmsAccount[_0x9f42('0x8')](e,emitEvent(event));}}module[_0x9f42('0x9')]=SmsAccountEvents;
\ No newline at end of file
+var _0x9594=['emit','hasOwnProperty','hook','exports','../../mysqldb','SmsAccount','setMaxListeners','save','remove'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9594,0x79));var _0x4959=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9594[_0x3947c9];return _0x2e7871;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x4959('0x0'))['db'][_0x4959('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x4959('0x2')](0x0);var events={'afterCreate':_0x4959('0x3'),'afterUpdate':'update','afterDestroy':_0x4959('0x4')};function emitEvent(_0x932c79){return function(_0x1b8079,_0x5de294,_0x282792){SmsAccountEvents[_0x4959('0x5')](_0x932c79+':'+_0x1b8079['id'],_0x1b8079);SmsAccountEvents['emit'](_0x932c79,_0x1b8079);_0x282792(null);};}for(var e in events){if(events[_0x4959('0x6')](e)){var event=events[e];SmsAccount[_0x4959('0x7')](e,emitEvent(event));}}module[_0x4959('0x8')]=SmsAccountEvents;
\ No newline at end of file
index 862fdab..6ceb262 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3f8c=['sms_accounts','../../config/logger','api','moment','bluebird','define','SmsAccount'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3f8c,0x104));var _0xc3f8=function(_0x2ab03a,_0x17f399){_0x2ab03a=_0x2ab03a-0x0;var _0x5a7289=_0x3f8c[_0x2ab03a];return _0x5a7289;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc3f8('0x0'))(_0xc3f8('0x1'));var moment=require(_0xc3f8('0x2'));var BPromise=require(_0xc3f8('0x3'));var rp=require('request-promise');var attributes=require('./smsAccount.attributes');module['exports']=function(_0x4e5dbd,_0x51b8b5){return _0x4e5dbd[_0xc3f8('0x4')](_0xc3f8('0x5'),attributes,{'tableName':_0xc3f8('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x902b=['api','moment','bluebird','request-promise','./smsAccount.attributes','define','sms_accounts','lodash','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x902b,0x6a));var _0xb902=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x902b[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xb902('0x0'));var util=require('util');var logger=require(_0xb902('0x1'))(_0xb902('0x2'));var moment=require(_0xb902('0x3'));var BPromise=require(_0xb902('0x4'));var rp=require(_0xb902('0x5'));var attributes=require(_0xb902('0x6'));module['exports']=function(_0x1af7b5,_0x49e5af){return _0x1af7b5[_0xb902('0x7')]('SmsAccount',attributes,{'tableName':_0xb902('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index a602165..febd515 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9526=['defaults','socket.io-emitter','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SmsAccount','find','options','raw','where','attributes','map','include','model','ShowSmsAccount','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x4bdd80,_0x5eaf07){var _0x3c4ecf=function(_0x53a8fd){while(--_0x53a8fd){_0x4bdd80['push'](_0x4bdd80['shift']());}};_0x3c4ecf(++_0x5eaf07);}(_0x9526,0xb2));var _0x6952=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x9526[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6952('0x0'));var BPromise=require(_0x6952('0x1'));var rs=require(_0x6952('0x2'));var fs=require('fs');var Redis=require(_0x6952('0x3'));var db=require(_0x6952('0x4'))['db'];var utils=require(_0x6952('0x5'));var logger=require(_0x6952('0x6'))(_0x6952('0x7'));var config=require(_0x6952('0x8'));var jayson=require(_0x6952('0x9'));var client=jayson[_0x6952('0xa')]['http']({'port':0x232a});config[_0x6952('0xb')]=_[_0x6952('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6952('0xd'))(new Redis(config[_0x6952('0xb')]));require(_0x6952('0xe'))['register'](socket);function respondWithRpcPromise(_0x58f3de,_0x30a851,_0x2e53e4){return new BPromise(function(_0x41ef65,_0x328c54){return client[_0x6952('0xf')](_0x58f3de,_0x2e53e4)[_0x6952('0x10')](function(_0x1a5d9a){logger[_0x6952('0x11')](_0x6952('0x12'),_0x30a851,_0x6952('0x13'));logger[_0x6952('0x14')](_0x6952('0x15'),_0x30a851,_0x6952('0x13'),JSON['stringify'](_0x1a5d9a));if(_0x1a5d9a[_0x6952('0x16')]){if(_0x1a5d9a[_0x6952('0x16')][_0x6952('0x17')]===0x1f4){logger[_0x6952('0x16')](_0x6952('0x12'),_0x30a851,_0x1a5d9a[_0x6952('0x16')][_0x6952('0x18')]);return _0x328c54(_0x1a5d9a[_0x6952('0x16')][_0x6952('0x18')]);}logger[_0x6952('0x16')](_0x6952('0x12'),_0x30a851,_0x1a5d9a[_0x6952('0x16')][_0x6952('0x18')]);return _0x41ef65(_0x1a5d9a[_0x6952('0x16')][_0x6952('0x18')]);}else{logger[_0x6952('0x11')](_0x6952('0x12'),_0x30a851,'request\x20sent');_0x41ef65(_0x1a5d9a[_0x6952('0x19')]['message']);}})[_0x6952('0x1a')](function(_0x58ce7e){logger[_0x6952('0x16')](_0x6952('0x12'),_0x30a851,_0x58ce7e);_0x328c54(_0x58ce7e);});});}exports['ShowSmsAccount']=function(_0x2cbe19){var _0x16b9eb=this;return new Promise(function(_0x1c9ccd,_0x32b86a){return db[_0x6952('0x1b')][_0x6952('0x1c')]({'raw':_0x2cbe19[_0x6952('0x1d')]?_0x2cbe19[_0x6952('0x1d')][_0x6952('0x1e')]===undefined?!![]:![]:!![],'where':_0x2cbe19[_0x6952('0x1d')]?_0x2cbe19[_0x6952('0x1d')][_0x6952('0x1f')]||null:null,'attributes':_0x2cbe19[_0x6952('0x1d')]?_0x2cbe19[_0x6952('0x1d')][_0x6952('0x20')]||null:null,'include':_0x2cbe19['options']?_0x2cbe19[_0x6952('0x1d')]['include']?_[_0x6952('0x21')](_0x2cbe19['options'][_0x6952('0x22')],function(_0x5a9474){return{'model':db[_0x5a9474[_0x6952('0x23')]],'as':_0x5a9474['as'],'attributes':_0x5a9474[_0x6952('0x20')],'include':_0x5a9474[_0x6952('0x22')]?_[_0x6952('0x21')](_0x5a9474[_0x6952('0x22')],function(_0x4a6ac3){return{'model':db[_0x4a6ac3[_0x6952('0x23')]],'as':_0x4a6ac3['as'],'attributes':_0x4a6ac3[_0x6952('0x20')],'include':_0x4a6ac3[_0x6952('0x22')]?_[_0x6952('0x21')](_0x4a6ac3[_0x6952('0x22')],function(_0x27381d){return{'model':db[_0x27381d['model']],'as':_0x27381d['as'],'attributes':_0x27381d[_0x6952('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4eda90){logger['info']('ShowSmsAccount',_0x2cbe19);logger[_0x6952('0x14')](_0x6952('0x24'),_0x2cbe19,JSON[_0x6952('0x25')](_0x4eda90));_0x1c9ccd(_0x4eda90);})[_0x6952('0x1a')](function(_0x14a8ee){logger[_0x6952('0x16')](_0x6952('0x24'),_0x14a8ee[_0x6952('0x18')],_0x2cbe19);_0x32b86a(_0x16b9eb[_0x6952('0x16')](0x1f4,_0x14a8ee[_0x6952('0x18')]));});});};
\ No newline at end of file
+var _0x3fb3=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','socket.io-emitter','./smsAccount.socket','register','request','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','info','result','catch','ShowSmsAccount','options','raw','where','model','attributes','map','include','then','debug','util'];(function(_0xa9db74,_0x45e441){var _0x3c8d7a=function(_0x42607a){while(--_0x42607a){_0xa9db74['push'](_0xa9db74['shift']());}};_0x3c8d7a(++_0x45e441);}(_0x3fb3,0x180));var _0x33fb=function(_0x26f1ac,_0x27807f){_0x26f1ac=_0x26f1ac-0x0;var _0x4fb1ee=_0x3fb3[_0x26f1ac];return _0x4fb1ee;};'use strict';var _=require('lodash');var util=require(_0x33fb('0x0'));var moment=require(_0x33fb('0x1'));var BPromise=require('bluebird');var rs=require(_0x33fb('0x2'));var fs=require('fs');var Redis=require(_0x33fb('0x3'));var db=require(_0x33fb('0x4'))['db'];var utils=require(_0x33fb('0x5'));var logger=require(_0x33fb('0x6'))(_0x33fb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x33fb('0x8')][_0x33fb('0x9')]({'port':0x232a});config[_0x33fb('0xa')]=_['defaults'](config[_0x33fb('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x33fb('0xb'))(new Redis(config['redis']));require(_0x33fb('0xc'))[_0x33fb('0xd')](socket);function respondWithRpcPromise(_0x30b610,_0x262e3a,_0x10f79a){return new BPromise(function(_0x3a780f,_0xf33732){return client[_0x33fb('0xe')](_0x30b610,_0x10f79a)['then'](function(_0x45937f){logger['info']('SmsAccount,\x20%s,\x20%s',_0x262e3a,'request\x20sent');logger['debug'](_0x33fb('0xf'),_0x262e3a,_0x33fb('0x10'),JSON[_0x33fb('0x11')](_0x45937f));if(_0x45937f[_0x33fb('0x12')]){if(_0x45937f[_0x33fb('0x12')][_0x33fb('0x13')]===0x1f4){logger[_0x33fb('0x12')](_0x33fb('0x14'),_0x262e3a,_0x45937f[_0x33fb('0x12')]['message']);return _0xf33732(_0x45937f[_0x33fb('0x12')][_0x33fb('0x15')]);}logger[_0x33fb('0x12')](_0x33fb('0x14'),_0x262e3a,_0x45937f['error'][_0x33fb('0x15')]);return _0x3a780f(_0x45937f[_0x33fb('0x12')]['message']);}else{logger[_0x33fb('0x16')](_0x33fb('0x14'),_0x262e3a,'request\x20sent');_0x3a780f(_0x45937f[_0x33fb('0x17')][_0x33fb('0x15')]);}})[_0x33fb('0x18')](function(_0x30dadf){logger[_0x33fb('0x12')](_0x33fb('0x14'),_0x262e3a,_0x30dadf);_0xf33732(_0x30dadf);});});}exports[_0x33fb('0x19')]=function(_0x3a3129){var _0x2b7403=this;return new Promise(function(_0x231fd7,_0x194de0){return db['SmsAccount']['find']({'raw':_0x3a3129[_0x33fb('0x1a')]?_0x3a3129[_0x33fb('0x1a')][_0x33fb('0x1b')]===undefined?!![]:![]:!![],'where':_0x3a3129['options']?_0x3a3129[_0x33fb('0x1a')][_0x33fb('0x1c')]||null:null,'attributes':_0x3a3129[_0x33fb('0x1a')]?_0x3a3129[_0x33fb('0x1a')]['attributes']||null:null,'include':_0x3a3129[_0x33fb('0x1a')]?_0x3a3129[_0x33fb('0x1a')]['include']?_['map'](_0x3a3129['options']['include'],function(_0x4a829e){return{'model':db[_0x4a829e[_0x33fb('0x1d')]],'as':_0x4a829e['as'],'attributes':_0x4a829e[_0x33fb('0x1e')],'include':_0x4a829e['include']?_[_0x33fb('0x1f')](_0x4a829e['include'],function(_0x705a6c){return{'model':db[_0x705a6c[_0x33fb('0x1d')]],'as':_0x705a6c['as'],'attributes':_0x705a6c['attributes'],'include':_0x705a6c[_0x33fb('0x20')]?_[_0x33fb('0x1f')](_0x705a6c[_0x33fb('0x20')],function(_0x481769){return{'model':db[_0x481769[_0x33fb('0x1d')]],'as':_0x481769['as'],'attributes':_0x481769[_0x33fb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x33fb('0x21')](function(_0x258dbe){logger[_0x33fb('0x16')]('ShowSmsAccount',_0x3a3129);logger[_0x33fb('0x22')](_0x33fb('0x19'),_0x3a3129,JSON[_0x33fb('0x11')](_0x258dbe));_0x231fd7(_0x258dbe);})[_0x33fb('0x18')](function(_0x2c7b13){logger[_0x33fb('0x12')]('ShowSmsAccount',_0x2c7b13['message'],_0x3a3129);_0x194de0(_0x2b7403['error'](0x1f4,_0x2c7b13[_0x33fb('0x15')]));});});};
\ No newline at end of file
index bf67b53..0b5a836 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa86b=['emit','removeListener','smsAccount:','save','remove','update'];(function(_0x3334f7,_0x19f3b4){var _0x6a6455=function(_0x3d8f61){while(--_0x3d8f61){_0x3334f7['push'](_0x3334f7['shift']());}};_0x6a6455(++_0x19f3b4);}(_0xa86b,0x75));var _0xba86=function(_0x18d325,_0x40dc83){_0x18d325=_0x18d325-0x0;var _0x4abc7f=_0xa86b[_0x18d325];return _0x4abc7f;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0xba86('0x0'),_0xba86('0x1'),_0xba86('0x2')];function createListener(_0x228f1e,_0xe50b49){return function(_0x175a50){_0xe50b49[_0xba86('0x3')](_0x228f1e,_0x175a50);};}function removeListener(_0x40fcb7,_0x296dab){return function(){SmsAccountEvents[_0xba86('0x4')](_0x40fcb7,_0x296dab);};}exports['register']=function(_0xaf4f08){for(var _0x3f5051=0x0,_0x444879=events['length'];_0x3f5051<_0x444879;_0x3f5051++){var _0x6ab239=events[_0x3f5051];var _0x58855a=createListener(_0xba86('0x5')+_0x6ab239,_0xaf4f08);SmsAccountEvents['on'](_0x6ab239,_0x58855a);}};
\ No newline at end of file
+var _0x674e=['length','smsAccount:','./smsAccount.events','save','remove','update','removeListener','register'];(function(_0x5892d1,_0x2331e7){var _0x3cd0ee=function(_0x470ef4){while(--_0x470ef4){_0x5892d1['push'](_0x5892d1['shift']());}};_0x3cd0ee(++_0x2331e7);}(_0x674e,0x82));var _0xe674=function(_0x171ff9,_0x59e073){_0x171ff9=_0x171ff9-0x0;var _0x1d6a81=_0x674e[_0x171ff9];return _0x1d6a81;};'use strict';var SmsAccountEvents=require(_0xe674('0x0'));var events=[_0xe674('0x1'),_0xe674('0x2'),_0xe674('0x3')];function createListener(_0x55aa0e,_0x463adc){return function(_0x434928){_0x463adc['emit'](_0x55aa0e,_0x434928);};}function removeListener(_0x5e9d57,_0x8c6cc7){return function(){SmsAccountEvents[_0xe674('0x4')](_0x5e9d57,_0x8c6cc7);};}exports[_0xe674('0x5')]=function(_0x1c5bf3){for(var _0x50065b=0x0,_0x27720c=events[_0xe674('0x6')];_0x50065b<_0x27720c;_0x50065b++){var _0x1faf44=events[_0x50065b];var _0x6ccd35=createListener(_0xe674('0x7')+_0x1faf44,_0x1c5bf3);SmsAccountEvents['on'](_0x1faf44,_0x6ccd35);}};
\ No newline at end of file
index 34bad6d..dd16880 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6cb4=['/:id','isAuthenticated','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x3570da,_0x5cb082){var _0xe9dcc7=function(_0x53dbd0){while(--_0x53dbd0){_0x3570da['push'](_0x3570da['shift']());}};_0xe9dcc7(++_0x5cb082);}(_0x6cb4,0xff));var _0x46cb=function(_0x49d0e7,_0xaf1ab5){_0x49d0e7=_0x49d0e7-0x0;var _0x5e5d13=_0x6cb4[_0x49d0e7];return _0x5e5d13;};'use strict';var multer=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var path=require(_0x46cb('0x2'));var timeout=require(_0x46cb('0x3'));var express=require(_0x46cb('0x4'));var router=express[_0x46cb('0x5')]();var auth=require(_0x46cb('0x6'));var interaction=require(_0x46cb('0x7'));var config=require(_0x46cb('0x8'));var controller=require('./smsApplication.controller');router[_0x46cb('0x9')]('/',auth['isAuthenticated'](),controller[_0x46cb('0xa')]);router['get'](_0x46cb('0xb'),auth[_0x46cb('0xc')](),controller[_0x46cb('0xd')]);router[_0x46cb('0xe')]('/',auth[_0x46cb('0xc')](),controller[_0x46cb('0xf')]);router['put'](_0x46cb('0xb'),auth[_0x46cb('0xc')](),controller['update']);router[_0x46cb('0x10')](_0x46cb('0xb'),auth['isAuthenticated'](),controller[_0x46cb('0x11')]);module[_0x46cb('0x12')]=router;
\ No newline at end of file
+var _0x457b=['./smsApplication.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5d55e9,_0x270829){var _0xf639a2=function(_0x28ffce){while(--_0x28ffce){_0x5d55e9['push'](_0x5d55e9['shift']());}};_0xf639a2(++_0x270829);}(_0x457b,0xca));var _0xb457=function(_0x253476,_0x16b31a){_0x253476=_0x253476-0x0;var _0x134271=_0x457b[_0x253476];return _0x134271;};'use strict';var multer=require(_0xb457('0x0'));var util=require(_0xb457('0x1'));var path=require('path');var timeout=require(_0xb457('0x2'));var express=require(_0xb457('0x3'));var router=express[_0xb457('0x4')]();var auth=require(_0xb457('0x5'));var interaction=require(_0xb457('0x6'));var config=require('../../config/environment');var controller=require(_0xb457('0x7'));router[_0xb457('0x8')]('/',auth[_0xb457('0x9')](),controller[_0xb457('0xa')]);router[_0xb457('0x8')]('/:id',auth[_0xb457('0x9')](),controller[_0xb457('0xb')]);router[_0xb457('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb457('0xd')](_0xb457('0xe'),auth[_0xb457('0x9')](),controller[_0xb457('0xf')]);router[_0xb457('0x10')](_0xb457('0xe'),auth[_0xb457('0x9')](),controller[_0xb457('0x11')]);module[_0xb457('0x12')]=router;
\ No newline at end of file
index 2e00d30..cd30799 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x42c7=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0x42c7,0x12d));var _0x742c=function(_0x2f67cc,_0x5e41eb){_0x2f67cc=_0x2f67cc-0x0;var _0x3adf53=_0x42c7[_0x2f67cc];return _0x3adf53;};'use strict';var Sequelize=require(_0x742c('0x0'));module[_0x742c('0x1')]={'priority':{'type':Sequelize[_0x742c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x742c('0x3')],'allowNull':![],'defaultValue':_0x742c('0x4')},'appdata':{'type':Sequelize[_0x742c('0x3')](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0x742c('0x3')]},'interval':{'type':Sequelize[_0x742c('0x3')],'defaultValue':_0x742c('0x5')}};
\ No newline at end of file
+var _0xb591=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x5ee4e4,_0x5ccafc){var _0x5e8969=function(_0x35c368){while(--_0x35c368){_0x5ee4e4['push'](_0x5ee4e4['shift']());}};_0x5e8969(++_0x5ccafc);}(_0xb591,0x1e3));var _0x1b59=function(_0x3db600,_0x5e4cc0){_0x3db600=_0x3db600-0x0;var _0x47c993=_0xb591[_0x3db600];return _0x47c993;};'use strict';var Sequelize=require(_0x1b59('0x0'));module[_0x1b59('0x1')]={'priority':{'type':Sequelize[_0x1b59('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1b59('0x3')],'allowNull':![],'defaultValue':_0x1b59('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'defaultValue':''},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1b59('0x3')],'defaultValue':_0x1b59('0x5')}};
\ No newline at end of file
index 612e8ff..3ed8fc3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xba86=['util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','index','rawAttributes','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','options','includeAll','include','SmsApplication','findAll','rows','show','params','find','catch','create','body','update','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x409bc3,_0x30f470){var _0xf9f0b5=function(_0x4392f8){while(--_0x4392f8){_0x409bc3['push'](_0x409bc3['shift']());}};_0xf9f0b5(++_0x30f470);}(_0xba86,0x175));var _0x6ba8=function(_0x1532da,_0x36caed){_0x1532da=_0x1532da-0x0;var _0x4654da=_0xba86[_0x1532da];return _0x4654da;};'use strict';var pdf=require(_0x6ba8('0x0'));var emlformat=require(_0x6ba8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6ba8('0x2'));var jsonpatch=require(_0x6ba8('0x3'));var rp=require(_0x6ba8('0x4'));var moment=require(_0x6ba8('0x5'));var BPromise=require(_0x6ba8('0x6'));var Mustache=require('mustache');var util=require(_0x6ba8('0x7'));var path=require(_0x6ba8('0x8'));var sox=require(_0x6ba8('0x9'));var csv=require(_0x6ba8('0xa'));var ejs=require(_0x6ba8('0xb'));var fs=require('fs');var _=require(_0x6ba8('0xc'));var squel=require(_0x6ba8('0xd'));var crypto=require(_0x6ba8('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6ba8('0xf'));var Papa=require(_0x6ba8('0x10'));var authService=require(_0x6ba8('0x11'));var hardwareService=require(_0x6ba8('0x12'));var Redis=require('ioredis');var qs=require(_0x6ba8('0x13'));var logger=require(_0x6ba8('0x14'))(_0x6ba8('0x15'));var utils=require(_0x6ba8('0x16'));var config=require(_0x6ba8('0x17'));var db=require(_0x6ba8('0x18'))['db'];function respondWithStatusCode(_0x4218b2,_0x3cbdd2){_0x3cbdd2=_0x3cbdd2||0xcc;return function(_0x964668){if(_0x964668){return _0x4218b2['sendStatus'](_0x3cbdd2);}return _0x4218b2[_0x6ba8('0x19')](_0x3cbdd2)[_0x6ba8('0x1a')]();};}function respondWithResult(_0x51b430,_0x196f4f){_0x196f4f=_0x196f4f||0xc8;return function(_0x2691a0){if(_0x2691a0){return _0x51b430[_0x6ba8('0x19')](_0x196f4f)[_0x6ba8('0x1b')](_0x2691a0);}};}function respondWithFilteredResult(_0x3fd530,_0x3a5cbe){return function(_0x57deb8){if(_0x57deb8){var _0x5ac7b0=_0x57deb8[_0x6ba8('0x1c')],_0x258877=_0x3a5cbe['offset'],_0xb2978b=_0x3a5cbe['offset']+_0x3a5cbe['limit'],_0x217e86;if(_0xb2978b>=_0x5ac7b0){_0xb2978b=_0x5ac7b0;_0x217e86=0xc8;}else{_0x217e86=0xce;}_0x3fd530[_0x6ba8('0x19')](_0x217e86);return _0x3fd530['set'](_0x6ba8('0x1d'),_0x258877+'-'+_0xb2978b+'/'+_0x5ac7b0)[_0x6ba8('0x1b')](_0x57deb8);}return null;};}function patchUpdates(_0x2a157e){return function(_0x82ff81){try{jsonpatch[_0x6ba8('0x1e')](_0x82ff81,_0x2a157e,!![]);}catch(_0x11ed21){return BPromise[_0x6ba8('0x1f')](_0x11ed21);}return _0x82ff81[_0x6ba8('0x20')]();};}function saveUpdates(_0x24a36a,_0x172d3e){return function(_0x2778a0){if(_0x2778a0){return _0x2778a0['update'](_0x24a36a)[_0x6ba8('0x21')](function(_0x31d732){return _0x31d732;});}return null;};}function removeEntity(_0x29d690,_0xc47b90){return function(_0x375b43){if(_0x375b43){return _0x375b43[_0x6ba8('0x22')]()[_0x6ba8('0x21')](function(){_0x29d690[_0x6ba8('0x19')](0xcc)[_0x6ba8('0x1a')]();});}};}function handleEntityNotFound(_0x4e1589,_0x3d592b){return function(_0x1d7208){if(!_0x1d7208){_0x4e1589[_0x6ba8('0x23')](0x194);}return _0x1d7208;};}function handleError(_0x46cf90,_0x3df549){_0x3df549=_0x3df549||0x1f4;return function(_0x4ecf7b){logger[_0x6ba8('0x24')](_0x4ecf7b['stack']);if(_0x4ecf7b[_0x6ba8('0x25')]){delete _0x4ecf7b[_0x6ba8('0x25')];}_0x46cf90['status'](_0x3df549)[_0x6ba8('0x26')](_0x4ecf7b);};}exports[_0x6ba8('0x27')]=function(_0x368a1a,_0x5496fd){var _0x47a4de={},_0x2f8c53={},_0x5d058b={'count':0x0,'rows':[]};var _0x342c84=db['SmsApplication'][_0x6ba8('0x28')];_0x2f8c53[_0x6ba8('0x29')]=_[_0x6ba8('0x2a')](_0x342c84);_0x2f8c53['query']=_[_0x6ba8('0x2a')](_0x368a1a['query']);_0x2f8c53[_0x6ba8('0x2b')]=_[_0x6ba8('0x2c')](_0x2f8c53[_0x6ba8('0x29')],_0x2f8c53['query']);_0x47a4de['attributes']=_[_0x6ba8('0x2c')](_0x2f8c53[_0x6ba8('0x29')],qs['fields'](_0x368a1a[_0x6ba8('0x2d')][_0x6ba8('0x2e')]));_0x47a4de['attributes']=_0x47a4de[_0x6ba8('0x2f')][_0x6ba8('0x30')]?_0x47a4de[_0x6ba8('0x2f')]:_0x2f8c53[_0x6ba8('0x29')];if(!_0x368a1a[_0x6ba8('0x2d')][_0x6ba8('0x31')](_0x6ba8('0x32'))){_0x47a4de['limit']=qs[_0x6ba8('0x33')](_0x368a1a[_0x6ba8('0x2d')]['limit']);_0x47a4de[_0x6ba8('0x34')]=qs[_0x6ba8('0x34')](_0x368a1a[_0x6ba8('0x2d')][_0x6ba8('0x34')]);}_0x47a4de[_0x6ba8('0x35')]=qs[_0x6ba8('0x36')](_0x368a1a[_0x6ba8('0x2d')][_0x6ba8('0x36')]);_0x47a4de[_0x6ba8('0x37')]=qs[_0x6ba8('0x2b')](_[_0x6ba8('0x38')](_0x368a1a[_0x6ba8('0x2d')],_0x2f8c53[_0x6ba8('0x2b')]));if(_0x368a1a[_0x6ba8('0x2d')][_0x6ba8('0x39')]){_0x47a4de[_0x6ba8('0x37')]=_[_0x6ba8('0x3a')](_0x47a4de[_0x6ba8('0x37')],{'$or':_[_0x6ba8('0x3b')](_0x342c84,function(_0x952aee){if(_0x952aee[_0x6ba8('0x3c')][_0x6ba8('0x3d')]!==_0x6ba8('0x3e')){var _0x21a76b={};_0x21a76b[_0x952aee['field']]={'$like':'%'+_0x368a1a[_0x6ba8('0x2d')][_0x6ba8('0x39')]+'%'};return _0x21a76b;}})});}_0x47a4de=_[_0x6ba8('0x3a')]({},_0x47a4de,_0x368a1a[_0x6ba8('0x3f')]);var _0x1e1e5f={'where':_0x47a4de['where']};return db['SmsApplication'][_0x6ba8('0x1c')](_0x1e1e5f)[_0x6ba8('0x21')](function(_0x163cb9){_0x5d058b[_0x6ba8('0x1c')]=_0x163cb9;if(_0x368a1a[_0x6ba8('0x2d')][_0x6ba8('0x40')]){_0x47a4de[_0x6ba8('0x41')]=[{'all':!![]}];}return db[_0x6ba8('0x42')][_0x6ba8('0x43')](_0x47a4de);})[_0x6ba8('0x21')](function(_0x213d20){_0x5d058b[_0x6ba8('0x44')]=_0x213d20;return _0x5d058b;})[_0x6ba8('0x21')](respondWithFilteredResult(_0x5496fd,_0x47a4de))['catch'](handleError(_0x5496fd,null));};exports[_0x6ba8('0x45')]=function(_0x4fe507,_0x2320bf){var _0x34c01e={'raw':!![],'where':{'id':_0x4fe507[_0x6ba8('0x46')]['id']}},_0xc34d19={};_0xc34d19[_0x6ba8('0x29')]=_[_0x6ba8('0x2a')](db[_0x6ba8('0x42')][_0x6ba8('0x28')]);_0xc34d19[_0x6ba8('0x2d')]=_[_0x6ba8('0x2a')](_0x4fe507[_0x6ba8('0x2d')]);_0xc34d19['filters']=_[_0x6ba8('0x2c')](_0xc34d19[_0x6ba8('0x29')],_0xc34d19[_0x6ba8('0x2d')]);_0x34c01e[_0x6ba8('0x2f')]=_['intersection'](_0xc34d19[_0x6ba8('0x29')],qs[_0x6ba8('0x2e')](_0x4fe507['query'][_0x6ba8('0x2e')]));_0x34c01e[_0x6ba8('0x2f')]=_0x34c01e['attributes']['length']?_0x34c01e['attributes']:_0xc34d19[_0x6ba8('0x29')];if(_0x4fe507[_0x6ba8('0x2d')][_0x6ba8('0x40')]){_0x34c01e[_0x6ba8('0x41')]=[{'all':!![]}];}_0x34c01e=_[_0x6ba8('0x3a')]({},_0x34c01e,_0x4fe507['options']);return db[_0x6ba8('0x42')][_0x6ba8('0x47')](_0x34c01e)[_0x6ba8('0x21')](handleEntityNotFound(_0x2320bf,null))['then'](respondWithResult(_0x2320bf,null))[_0x6ba8('0x48')](handleError(_0x2320bf,null));};exports['create']=function(_0x552f5e,_0x30113f){return db[_0x6ba8('0x42')][_0x6ba8('0x49')](_0x552f5e[_0x6ba8('0x4a')],{})[_0x6ba8('0x21')](respondWithResult(_0x30113f,0xc9))[_0x6ba8('0x48')](handleError(_0x30113f,null));};exports[_0x6ba8('0x4b')]=function(_0x32a1b1,_0x3dd01f){if(_0x32a1b1[_0x6ba8('0x4a')]['id']){delete _0x32a1b1[_0x6ba8('0x4a')]['id'];}return db[_0x6ba8('0x42')][_0x6ba8('0x47')]({'where':{'id':_0x32a1b1[_0x6ba8('0x46')]['id']}})['then'](handleEntityNotFound(_0x3dd01f,null))[_0x6ba8('0x21')](saveUpdates(_0x32a1b1[_0x6ba8('0x4a')],null))[_0x6ba8('0x21')](respondWithResult(_0x3dd01f,null))[_0x6ba8('0x48')](handleError(_0x3dd01f,null));};exports['destroy']=function(_0x4d1333,_0x3316c2){return db[_0x6ba8('0x42')][_0x6ba8('0x47')]({'where':{'id':_0x4d1333['params']['id']}})[_0x6ba8('0x21')](handleEntityNotFound(_0x3316c2,null))['then'](removeEntity(_0x3316c2,null))[_0x6ba8('0x48')](handleError(_0x3316c2,null));};
\ No newline at end of file
+var _0x6bff=['../../config/environment','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','SmsApplication','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','map','type','key','VIRTUAL','field','filter','options','include','findAll','catch','show','params','includeAll','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x6bff,0x1af));var _0xf6bf=function(_0x43496f,_0x3976fb){_0x43496f=_0x43496f-0x0;var _0xab2a5d=_0x6bff[_0x43496f];return _0xab2a5d;};'use strict';var pdf=require(_0xf6bf('0x0'));var emlformat=require(_0xf6bf('0x1'));var rimraf=require(_0xf6bf('0x2'));var zipdir=require(_0xf6bf('0x3'));var jsonpatch=require(_0xf6bf('0x4'));var rp=require(_0xf6bf('0x5'));var moment=require(_0xf6bf('0x6'));var BPromise=require(_0xf6bf('0x7'));var Mustache=require(_0xf6bf('0x8'));var util=require('util');var path=require('path');var sox=require(_0xf6bf('0x9'));var csv=require('to-csv');var ejs=require(_0xf6bf('0xa'));var fs=require('fs');var _=require(_0xf6bf('0xb'));var squel=require(_0xf6bf('0xc'));var crypto=require(_0xf6bf('0xd'));var jsforce=require(_0xf6bf('0xe'));var deskjs=require(_0xf6bf('0xf'));var toCsv=require(_0xf6bf('0x10'));var querystring=require('querystring');var Papa=require(_0xf6bf('0x11'));var authService=require(_0xf6bf('0x12'));var hardwareService=require(_0xf6bf('0x13'));var Redis=require(_0xf6bf('0x14'));var qs=require(_0xf6bf('0x15'));var logger=require(_0xf6bf('0x16'))(_0xf6bf('0x17'));var utils=require(_0xf6bf('0x18'));var config=require(_0xf6bf('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe2541a,_0x149b86){_0x149b86=_0x149b86||0xcc;return function(_0x2c80cf){if(_0x2c80cf){return _0xe2541a[_0xf6bf('0x1a')](_0x149b86);}return _0xe2541a['status'](_0x149b86)[_0xf6bf('0x1b')]();};}function respondWithResult(_0xb57099,_0x4faa5f){_0x4faa5f=_0x4faa5f||0xc8;return function(_0x26393f){if(_0x26393f){return _0xb57099['status'](_0x4faa5f)[_0xf6bf('0x1c')](_0x26393f);}};}function respondWithFilteredResult(_0x369b3d,_0x313770){return function(_0x46088d){if(_0x46088d){var _0x4bfbb7=_0x46088d[_0xf6bf('0x1d')],_0x175cf7=_0x313770[_0xf6bf('0x1e')],_0x190bb2=_0x313770[_0xf6bf('0x1e')]+_0x313770[_0xf6bf('0x1f')],_0x1aa684;if(_0x190bb2>=_0x4bfbb7){_0x190bb2=_0x4bfbb7;_0x1aa684=0xc8;}else{_0x1aa684=0xce;}_0x369b3d[_0xf6bf('0x20')](_0x1aa684);return _0x369b3d[_0xf6bf('0x21')](_0xf6bf('0x22'),_0x175cf7+'-'+_0x190bb2+'/'+_0x4bfbb7)[_0xf6bf('0x1c')](_0x46088d);}return null;};}function patchUpdates(_0x5aa4ad){return function(_0x527adf){try{jsonpatch[_0xf6bf('0x23')](_0x527adf,_0x5aa4ad,!![]);}catch(_0x232b7c){return BPromise['reject'](_0x232b7c);}return _0x527adf[_0xf6bf('0x24')]();};}function saveUpdates(_0x33af2c,_0xec118c){return function(_0x5c4ec9){if(_0x5c4ec9){return _0x5c4ec9[_0xf6bf('0x25')](_0x33af2c)[_0xf6bf('0x26')](function(_0x284c23){return _0x284c23;});}return null;};}function removeEntity(_0x670a0e,_0x37b24d){return function(_0x5a9e86){if(_0x5a9e86){return _0x5a9e86[_0xf6bf('0x27')]()[_0xf6bf('0x26')](function(){_0x670a0e[_0xf6bf('0x20')](0xcc)[_0xf6bf('0x1b')]();});}};}function handleEntityNotFound(_0x1fcdcf,_0x51c0f2){return function(_0x45360d){if(!_0x45360d){_0x1fcdcf['sendStatus'](0x194);}return _0x45360d;};}function handleError(_0x3e0056,_0x1f90a1){_0x1f90a1=_0x1f90a1||0x1f4;return function(_0x3dea24){logger[_0xf6bf('0x28')](_0x3dea24['stack']);if(_0x3dea24[_0xf6bf('0x29')]){delete _0x3dea24[_0xf6bf('0x29')];}_0x3e0056['status'](_0x1f90a1)[_0xf6bf('0x2a')](_0x3dea24);};}exports[_0xf6bf('0x2b')]=function(_0x3ed5f5,_0x45f4fe){var _0x3e685d={},_0x5bfa09={},_0x363566={'count':0x0,'rows':[]};var _0x36dd03=db[_0xf6bf('0x2c')][_0xf6bf('0x2d')];_0x5bfa09[_0xf6bf('0x2e')]=_[_0xf6bf('0x2f')](_0x36dd03);_0x5bfa09[_0xf6bf('0x30')]=_[_0xf6bf('0x2f')](_0x3ed5f5[_0xf6bf('0x30')]);_0x5bfa09[_0xf6bf('0x31')]=_[_0xf6bf('0x32')](_0x5bfa09[_0xf6bf('0x2e')],_0x5bfa09[_0xf6bf('0x30')]);_0x3e685d[_0xf6bf('0x33')]=_[_0xf6bf('0x32')](_0x5bfa09[_0xf6bf('0x2e')],qs[_0xf6bf('0x34')](_0x3ed5f5[_0xf6bf('0x30')][_0xf6bf('0x34')]));_0x3e685d['attributes']=_0x3e685d['attributes'][_0xf6bf('0x35')]?_0x3e685d[_0xf6bf('0x33')]:_0x5bfa09[_0xf6bf('0x2e')];if(!_0x3ed5f5['query']['hasOwnProperty'](_0xf6bf('0x36'))){_0x3e685d[_0xf6bf('0x1f')]=qs[_0xf6bf('0x1f')](_0x3ed5f5[_0xf6bf('0x30')][_0xf6bf('0x1f')]);_0x3e685d[_0xf6bf('0x1e')]=qs['offset'](_0x3ed5f5[_0xf6bf('0x30')]['offset']);}_0x3e685d[_0xf6bf('0x37')]=qs['sort'](_0x3ed5f5[_0xf6bf('0x30')][_0xf6bf('0x38')]);_0x3e685d[_0xf6bf('0x39')]=qs[_0xf6bf('0x31')](_[_0xf6bf('0x3a')](_0x3ed5f5[_0xf6bf('0x30')],_0x5bfa09[_0xf6bf('0x31')]));if(_0x3ed5f5[_0xf6bf('0x30')]['filter']){_0x3e685d['where']=_[_0xf6bf('0x3b')](_0x3e685d[_0xf6bf('0x39')],{'$or':_[_0xf6bf('0x3c')](_0x36dd03,function(_0x12546a){if(_0x12546a[_0xf6bf('0x3d')][_0xf6bf('0x3e')]!==_0xf6bf('0x3f')){var _0x4c5f4d={};_0x4c5f4d[_0x12546a[_0xf6bf('0x40')]]={'$like':'%'+_0x3ed5f5['query'][_0xf6bf('0x41')]+'%'};return _0x4c5f4d;}})});}_0x3e685d=_[_0xf6bf('0x3b')]({},_0x3e685d,_0x3ed5f5[_0xf6bf('0x42')]);var _0x3016a1={'where':_0x3e685d['where']};return db['SmsApplication'][_0xf6bf('0x1d')](_0x3016a1)['then'](function(_0x17ae93){_0x363566[_0xf6bf('0x1d')]=_0x17ae93;if(_0x3ed5f5[_0xf6bf('0x30')]['includeAll']){_0x3e685d[_0xf6bf('0x43')]=[{'all':!![]}];}return db[_0xf6bf('0x2c')][_0xf6bf('0x44')](_0x3e685d);})[_0xf6bf('0x26')](function(_0xbffc1b){_0x363566['rows']=_0xbffc1b;return _0x363566;})['then'](respondWithFilteredResult(_0x45f4fe,_0x3e685d))[_0xf6bf('0x45')](handleError(_0x45f4fe,null));};exports[_0xf6bf('0x46')]=function(_0x5d776b,_0xb84a8a){var _0x1df067={'raw':!![],'where':{'id':_0x5d776b[_0xf6bf('0x47')]['id']}},_0x465894={};_0x465894[_0xf6bf('0x2e')]=_[_0xf6bf('0x2f')](db['SmsApplication'][_0xf6bf('0x2d')]);_0x465894[_0xf6bf('0x30')]=_['keys'](_0x5d776b[_0xf6bf('0x30')]);_0x465894[_0xf6bf('0x31')]=_[_0xf6bf('0x32')](_0x465894[_0xf6bf('0x2e')],_0x465894[_0xf6bf('0x30')]);_0x1df067[_0xf6bf('0x33')]=_['intersection'](_0x465894[_0xf6bf('0x2e')],qs[_0xf6bf('0x34')](_0x5d776b[_0xf6bf('0x30')][_0xf6bf('0x34')]));_0x1df067[_0xf6bf('0x33')]=_0x1df067[_0xf6bf('0x33')][_0xf6bf('0x35')]?_0x1df067['attributes']:_0x465894[_0xf6bf('0x2e')];if(_0x5d776b[_0xf6bf('0x30')][_0xf6bf('0x48')]){_0x1df067[_0xf6bf('0x43')]=[{'all':!![]}];}_0x1df067=_['merge']({},_0x1df067,_0x5d776b['options']);return db[_0xf6bf('0x2c')][_0xf6bf('0x49')](_0x1df067)[_0xf6bf('0x26')](handleEntityNotFound(_0xb84a8a,null))[_0xf6bf('0x26')](respondWithResult(_0xb84a8a,null))[_0xf6bf('0x45')](handleError(_0xb84a8a,null));};exports[_0xf6bf('0x4a')]=function(_0x5051d2,_0x1b3e92){return db[_0xf6bf('0x2c')][_0xf6bf('0x4a')](_0x5051d2['body'],{})['then'](respondWithResult(_0x1b3e92,0xc9))['catch'](handleError(_0x1b3e92,null));};exports[_0xf6bf('0x25')]=function(_0x5e8f74,_0x7982b1){if(_0x5e8f74[_0xf6bf('0x4b')]['id']){delete _0x5e8f74['body']['id'];}return db[_0xf6bf('0x2c')]['find']({'where':{'id':_0x5e8f74[_0xf6bf('0x47')]['id']}})[_0xf6bf('0x26')](handleEntityNotFound(_0x7982b1,null))['then'](saveUpdates(_0x5e8f74['body'],null))['then'](respondWithResult(_0x7982b1,null))[_0xf6bf('0x45')](handleError(_0x7982b1,null));};exports[_0xf6bf('0x27')]=function(_0xe7d182,_0x4031ef){return db[_0xf6bf('0x2c')][_0xf6bf('0x49')]({'where':{'id':_0xe7d182[_0xf6bf('0x47')]['id']}})[_0xf6bf('0x26')](handleEntityNotFound(_0x4031ef,null))[_0xf6bf('0x26')](removeEntity(_0x4031ef,null))[_0xf6bf('0x45')](handleError(_0x4031ef,null));};
\ No newline at end of file
index 21ea41b..bb6806d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x05a2=['define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./smsApplication.attributes','exports'];(function(_0x111e90,_0x246d1b){var _0x36ac16=function(_0x23c183){while(--_0x23c183){_0x111e90['push'](_0x111e90['shift']());}};_0x36ac16(++_0x246d1b);}(_0x05a2,0xab));var _0x205a=function(_0x2c774b,_0x1d030c){_0x2c774b=_0x2c774b-0x0;var _0x48ce46=_0x05a2[_0x2c774b];return _0x48ce46;};'use strict';var _=require(_0x205a('0x0'));var util=require(_0x205a('0x1'));var logger=require(_0x205a('0x2'))(_0x205a('0x3'));var moment=require(_0x205a('0x4'));var BPromise=require(_0x205a('0x5'));var rp=require(_0x205a('0x6'));var attributes=require(_0x205a('0x7'));module[_0x205a('0x8')]=function(_0x4e915c,_0xe5bf67){return _0x4e915c[_0x205a('0x9')]('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xd9d2=['bluebird','request-promise','exports','sms_applications','lodash','util','../../config/logger','api','moment'];(function(_0x54c72d,_0x2d2b0f){var _0x365d9b=function(_0x555e01){while(--_0x555e01){_0x54c72d['push'](_0x54c72d['shift']());}};_0x365d9b(++_0x2d2b0f);}(_0xd9d2,0x151));var _0x2d9d=function(_0xc9df9f,_0x58fc6a){_0xc9df9f=_0xc9df9f-0x0;var _0xe5dc38=_0xd9d2[_0xc9df9f];return _0xe5dc38;};'use strict';var _=require(_0x2d9d('0x0'));var util=require(_0x2d9d('0x1'));var logger=require(_0x2d9d('0x2'))(_0x2d9d('0x3'));var moment=require(_0x2d9d('0x4'));var BPromise=require(_0x2d9d('0x5'));var rp=require(_0x2d9d('0x6'));var attributes=require('./smsApplication.attributes');module[_0x2d9d('0x7')]=function(_0x2df6ec,_0x18d44e){return _0x2df6ec['define']('SmsApplication',attributes,{'tableName':_0x2d9d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 7eff3fb..967506a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8060=['stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xf6ec4,_0x51d880){var _0x2e794b=function(_0x238b83){while(--_0x238b83){_0xf6ec4['push'](_0xf6ec4['shift']());}};_0x2e794b(++_0x51d880);}(_0x8060,0x78));var _0x0806=function(_0x21d532,_0x4552a4){_0x21d532=_0x21d532-0x0;var _0x37bda1=_0x8060[_0x21d532];return _0x37bda1;};'use strict';var _=require(_0x0806('0x0'));var util=require('util');var moment=require(_0x0806('0x1'));var BPromise=require(_0x0806('0x2'));var rs=require(_0x0806('0x3'));var fs=require('fs');var Redis=require(_0x0806('0x4'));var db=require(_0x0806('0x5'))['db'];var utils=require(_0x0806('0x6'));var logger=require(_0x0806('0x7'))('rpc');var config=require(_0x0806('0x8'));var jayson=require(_0x0806('0x9'));var client=jayson[_0x0806('0xa')][_0x0806('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x554b83,_0xf1a8fc,_0x1e657f){return new BPromise(function(_0x42aef0,_0x3e967e){return client[_0x0806('0xc')](_0x554b83,_0x1e657f)[_0x0806('0xd')](function(_0x262777){logger[_0x0806('0xe')](_0x0806('0xf'),_0xf1a8fc,_0x0806('0x10'));logger[_0x0806('0x11')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0xf1a8fc,_0x0806('0x10'),JSON[_0x0806('0x12')](_0x262777));if(_0x262777[_0x0806('0x13')]){if(_0x262777[_0x0806('0x13')]['code']===0x1f4){logger['error'](_0x0806('0xf'),_0xf1a8fc,_0x262777['error']['message']);return _0x3e967e(_0x262777[_0x0806('0x13')][_0x0806('0x14')]);}logger[_0x0806('0x13')](_0x0806('0xf'),_0xf1a8fc,_0x262777[_0x0806('0x13')][_0x0806('0x14')]);return _0x42aef0(_0x262777[_0x0806('0x13')][_0x0806('0x14')]);}else{logger[_0x0806('0xe')](_0x0806('0xf'),_0xf1a8fc,_0x0806('0x10'));_0x42aef0(_0x262777[_0x0806('0x15')]['message']);}})[_0x0806('0x16')](function(_0x1ed17e){logger[_0x0806('0x13')](_0x0806('0xf'),_0xf1a8fc,_0x1ed17e);_0x3e967e(_0x1ed17e);});});}
\ No newline at end of file
+var _0x7340=['stringify','error','message','info','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7340,0xe1));var _0x0734=function(_0x5cae9a,_0x341b1c){_0x5cae9a=_0x5cae9a-0x0;var _0x500e17=_0x7340[_0x5cae9a];return _0x500e17;};'use strict';var _=require('lodash');var util=require(_0x0734('0x0'));var moment=require(_0x0734('0x1'));var BPromise=require(_0x0734('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0734('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0734('0x4'));var logger=require(_0x0734('0x5'))('rpc');var config=require(_0x0734('0x6'));var jayson=require(_0x0734('0x7'));var client=jayson[_0x0734('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xcbc055,_0x40bb1c,_0x5d824f){return new BPromise(function(_0x50ca6a,_0x2f5a48){return client[_0x0734('0x9')](_0xcbc055,_0x5d824f)[_0x0734('0xa')](function(_0x477a7e){logger['info'](_0x0734('0xb'),_0x40bb1c,_0x0734('0xc'));logger[_0x0734('0xd')](_0x0734('0xe'),_0x40bb1c,_0x0734('0xc'),JSON[_0x0734('0xf')](_0x477a7e));if(_0x477a7e[_0x0734('0x10')]){if(_0x477a7e['error']['code']===0x1f4){logger[_0x0734('0x10')](_0x0734('0xb'),_0x40bb1c,_0x477a7e[_0x0734('0x10')][_0x0734('0x11')]);return _0x2f5a48(_0x477a7e[_0x0734('0x10')][_0x0734('0x11')]);}logger[_0x0734('0x10')](_0x0734('0xb'),_0x40bb1c,_0x477a7e[_0x0734('0x10')]['message']);return _0x50ca6a(_0x477a7e[_0x0734('0x10')][_0x0734('0x11')]);}else{logger[_0x0734('0x12')](_0x0734('0xb'),_0x40bb1c,_0x0734('0xc'));_0x50ca6a(_0x477a7e['result'][_0x0734('0x11')]);}})[_0x0734('0x13')](function(_0x4730c0){logger[_0x0734('0x10')](_0x0734('0xb'),_0x40bb1c,_0x4730c0);_0x2f5a48(_0x4730c0);});});}
\ No newline at end of file
index 32315eb..5d4085a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x70a2=['../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','delete','smsinteraction:destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x230daa,_0x2d4dd0){var _0x210dc5=function(_0x455859){while(--_0x455859){_0x230daa['push'](_0x230daa['shift']());}};_0x210dc5(++_0x2d4dd0);}(_0x70a2,0xa2));var _0x270a=function(_0x544baa,_0x1b17fe){_0x544baa=_0x544baa-0x0;var _0x5e8cc1=_0x70a2[_0x544baa];return _0x5e8cc1;};'use strict';var multer=require(_0x270a('0x0'));var util=require('util');var path=require(_0x270a('0x1'));var timeout=require('connect-timeout');var express=require(_0x270a('0x2'));var router=express[_0x270a('0x3')]();var auth=require(_0x270a('0x4'));var interaction=require(_0x270a('0x5'));var config=require(_0x270a('0x6'));var controller=require('./smsInteraction.controller');router[_0x270a('0x7')]('/',auth[_0x270a('0x8')](),controller[_0x270a('0x9')]);router[_0x270a('0x7')](_0x270a('0xa'),auth[_0x270a('0x8')](),controller['describe']);router[_0x270a('0x7')](_0x270a('0xb'),auth[_0x270a('0x8')](),controller[_0x270a('0xc')]);router[_0x270a('0x7')](_0x270a('0xd'),auth[_0x270a('0x8')](),controller[_0x270a('0xe')]);router['get'](_0x270a('0xf'),auth[_0x270a('0x8')](),controller[_0x270a('0x10')]);router[_0x270a('0x11')]('/',auth[_0x270a('0x8')](),controller['create']);router[_0x270a('0x11')](_0x270a('0xd'),auth['isAuthenticated'](),controller[_0x270a('0x12')]);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0x270a('0x13')](_0x270a('0x14'),_0x270a('0x15')),controller[_0x270a('0x16')]);router[_0x270a('0x17')]('/:id',auth['isAuthenticated'](),interaction[_0x270a('0x13')](_0x270a('0x14'),_0x270a('0x18')),controller['update']);router[_0x270a('0x19')](_0x270a('0xb'),auth[_0x270a('0x8')](),interaction[_0x270a('0x13')](_0x270a('0x14'),_0x270a('0x1a')),controller['destroy']);router['delete']('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);module[_0x270a('0x1b')]=router;
\ No newline at end of file
+var _0xe362=['/:id','show','/:id/messages','isAuthenticated','getMessages','/:id/download','download','create','/:id/tags','tracked','sms','smsinteraction:addtags','smsinteraction:update','update','smsinteraction:destroy','destroy','delete','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','index','describe'];(function(_0x5bbb61,_0x18ac63){var _0x42f7a7=function(_0x514de7){while(--_0x514de7){_0x5bbb61['push'](_0x5bbb61['shift']());}};_0x42f7a7(++_0x18ac63);}(_0xe362,0x17b));var _0x2e36=function(_0x3e717f,_0x3c800e){_0x3e717f=_0x3e717f-0x0;var _0x57068e=_0xe362[_0x3e717f];return _0x57068e;};'use strict';var multer=require(_0x2e36('0x0'));var util=require('util');var path=require(_0x2e36('0x1'));var timeout=require(_0x2e36('0x2'));var express=require(_0x2e36('0x3'));var router=express[_0x2e36('0x4')]();var auth=require(_0x2e36('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2e36('0x6'));var controller=require(_0x2e36('0x7'));router[_0x2e36('0x8')]('/',auth['isAuthenticated'](),controller[_0x2e36('0x9')]);router[_0x2e36('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x2e36('0xa')]);router[_0x2e36('0x8')](_0x2e36('0xb'),auth['isAuthenticated'](),controller[_0x2e36('0xc')]);router['get'](_0x2e36('0xd'),auth[_0x2e36('0xe')](),controller[_0x2e36('0xf')]);router[_0x2e36('0x8')](_0x2e36('0x10'),auth[_0x2e36('0xe')](),controller[_0x2e36('0x11')]);router['post']('/',auth[_0x2e36('0xe')](),controller[_0x2e36('0x12')]);router['post'](_0x2e36('0xd'),auth['isAuthenticated'](),controller['addMessage']);router['post'](_0x2e36('0x13'),auth[_0x2e36('0xe')](),interaction[_0x2e36('0x14')](_0x2e36('0x15'),_0x2e36('0x16')),controller['addTags']);router['put'](_0x2e36('0xb'),auth[_0x2e36('0xe')](),interaction[_0x2e36('0x14')](_0x2e36('0x15'),_0x2e36('0x17')),controller[_0x2e36('0x18')]);router['delete'](_0x2e36('0xb'),auth['isAuthenticated'](),interaction[_0x2e36('0x14')]('sms',_0x2e36('0x19')),controller[_0x2e36('0x1a')]);router[_0x2e36('0x1b')]('/:id/tags',auth[_0x2e36('0xe')](),controller[_0x2e36('0x1c')]);module[_0x2e36('0x1d')]=router;
\ No newline at end of file
index ad5d654..58c653c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9cc6=['out','moment','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x243217,_0x522951){var _0x478029=function(_0x18d053){while(--_0x18d053){_0x243217['push'](_0x243217['shift']());}};_0x478029(++_0x522951);}(_0x9cc6,0xb0));var _0x69cc=function(_0x4e0026,_0x2b52b6){_0x4e0026=_0x4e0026-0x0;var _0x3f8ee7=_0x9cc6[_0x4e0026];return _0x3f8ee7;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x69cc('0x0'));module[_0x69cc('0x1')]={'closed':{'type':Sequelize[_0x69cc('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x69cc('0x3')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x69cc('0x4')]},'phone':{'type':Sequelize[_0x69cc('0x4')]},'read1stAt':{'type':Sequelize[_0x69cc('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x69cc('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x69cc('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x69cc('0x5')]('in',_0x69cc('0x6')),'defaultValue':'in','allowNull':![]}};
\ No newline at end of file
+var _0x8ac1=['STRING','out','ENUM','sequelize','moment','exports','DATE'];(function(_0x369534,_0x5557c4){var _0x524bf9=function(_0x24c6fb){while(--_0x24c6fb){_0x369534['push'](_0x369534['shift']());}};_0x524bf9(++_0x5557c4);}(_0x8ac1,0x16f));var _0x18ac=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8ac1[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x18ac('0x0'));var moment=require(_0x18ac('0x1'));module[_0x18ac('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x18ac('0x3')]},'disposition':{'type':Sequelize[_0x18ac('0x4')]},'note':{'type':Sequelize[_0x18ac('0x4')]},'phone':{'type':Sequelize[_0x18ac('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x18ac('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x18ac('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x18ac('0x6')]('in',_0x18ac('0x5')),'defaultValue':'in','allowNull':![]}};
\ No newline at end of file
index 6010959..5cec898 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4986=['socket.io-emitter','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','offset','order','sort','filter','where','merge','map','key','VIRTUAL','field','options','include','push','Tag','Tags','tag','distinct','read','SmsMessage','SmsInteraction','includeAll','User','Users','fullname','CmContact','Owner','Account','Messages','direction','createdAt','color','ThroughTags','findAll','rows','catch','show','params','fields','find','create','body','update','describe','addMessage','ids','omit','getMessages','findOne','rawAttributes','length','pick','SmsInteractionId','$gte','format','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','files','tmp','root','server','attachments','Contact','firstName','Letter','1cm','mkdirSync','<h1>Sms\x20Interaction:\x20#%d</h1>','<h2>Date:\x20%s</h2>','<hr>','<div\x20style=\x22border-style:\x20solid;\x20border-width:\x201px;\x20margin:\x203px;\x22>','<p\x20style=\x22margin:\x203px;\x22>%s:\x20%s</p>','toFile','interaction-','.pdf','log','err','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/utils','../../mysqldb','redis','defaults','localhost'];(function(_0x4222b5,_0x37422c){var _0x425d4c=function(_0x53e442){while(--_0x53e442){_0x4222b5['push'](_0x4222b5['shift']());}};_0x425d4c(++_0x37422c);}(_0x4986,0x6e));var _0x6498=function(_0x3b15d2,_0x4282f6){_0x3b15d2=_0x3b15d2-0x0;var _0x254c19=_0x4986[_0x3b15d2];return _0x254c19;};'use strict';var pdf=require(_0x6498('0x0'));var emlformat=require(_0x6498('0x1'));var rimraf=require(_0x6498('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6498('0x3'));var moment=require(_0x6498('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6498('0x5'));var util=require(_0x6498('0x6'));var path=require(_0x6498('0x7'));var sox=require(_0x6498('0x8'));var csv=require(_0x6498('0x9'));var ejs=require(_0x6498('0xa'));var fs=require('fs');var _=require(_0x6498('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6498('0xc'));var deskjs=require(_0x6498('0xd'));var toCsv=require(_0x6498('0x9'));var querystring=require(_0x6498('0xe'));var Papa=require(_0x6498('0xf'));var authService=require('../../components/auth/service');var hardwareService=require(_0x6498('0x10'));var Redis=require(_0x6498('0x11'));var qs=require(_0x6498('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x6498('0x13'));var config=require('../../config/environment');var db=require(_0x6498('0x14'))['db'];config[_0x6498('0x15')]=_[_0x6498('0x16')](config[_0x6498('0x15')],{'host':_0x6498('0x17'),'port':0x18eb});var socket=require(_0x6498('0x18'))(new Redis(config[_0x6498('0x15')]));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x4769ab,_0xfde02b){_0xfde02b=_0xfde02b||0xcc;return function(_0x3ae8e5){if(_0x3ae8e5){return _0x4769ab[_0x6498('0x19')](_0xfde02b);}return _0x4769ab[_0x6498('0x1a')](_0xfde02b)['end']();};}function respondWithResult(_0x318b75,_0x2ab98d){_0x2ab98d=_0x2ab98d||0xc8;return function(_0x172b0e){if(_0x172b0e){return _0x318b75[_0x6498('0x1a')](_0x2ab98d)[_0x6498('0x1b')](_0x172b0e);}};}function respondWithFilteredResult(_0x1b4083,_0x3fa89d){return function(_0x500d3f){if(_0x500d3f){var _0x43ae3b=_0x500d3f[_0x6498('0x1c')],_0x8b41fe=_0x3fa89d['offset'],_0x2a1247=_0x3fa89d['offset']+_0x3fa89d[_0x6498('0x1d')],_0x2f8fdb;if(_0x2a1247>=_0x43ae3b){_0x2a1247=_0x43ae3b;_0x2f8fdb=0xc8;}else{_0x2f8fdb=0xce;}_0x1b4083[_0x6498('0x1a')](_0x2f8fdb);return _0x1b4083[_0x6498('0x1e')](_0x6498('0x1f'),_0x8b41fe+'-'+_0x2a1247+'/'+_0x43ae3b)[_0x6498('0x1b')](_0x500d3f);}return null;};}function patchUpdates(_0x46c830){return function(_0x32a297){try{jsonpatch[_0x6498('0x20')](_0x32a297,_0x46c830,!![]);}catch(_0x377aef){return BPromise[_0x6498('0x21')](_0x377aef);}return _0x32a297[_0x6498('0x22')]();};}function saveUpdates(_0x1ccaec,_0x39b8d0){return function(_0x87685c){if(_0x87685c){return _0x87685c['update'](_0x1ccaec)['then'](function(_0x2a34d0){return _0x2a34d0;});}return null;};}function removeEntity(_0x514544,_0x46c3f7){return function(_0x30d261){if(_0x30d261){return _0x30d261[_0x6498('0x23')]()[_0x6498('0x24')](function(){_0x514544['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43b1d2,_0x4f9d95){return function(_0x3e8dc7){if(!_0x3e8dc7){_0x43b1d2[_0x6498('0x19')](0x194);}return _0x3e8dc7;};}function handleError(_0x41d43f,_0x271048){_0x271048=_0x271048||0x1f4;return function(_0x1ce28d){logger[_0x6498('0x25')](_0x1ce28d[_0x6498('0x26')]);if(_0x1ce28d[_0x6498('0x27')]){delete _0x1ce28d[_0x6498('0x27')];}_0x41d43f[_0x6498('0x1a')](_0x271048)[_0x6498('0x28')](_0x1ce28d);};}exports[_0x6498('0x29')]=function(_0x64df19,_0x4be06f){var _0x12c9d2={},_0x383d8b={},_0x5eda63={'count':0x0,'rows':[]};var _0x4f78b7=db['SmsInteraction']['rawAttributes'];_0x383d8b[_0x6498('0x2a')]=_[_0x6498('0x2b')](_0x4f78b7);_0x383d8b[_0x6498('0x2c')]=_[_0x6498('0x2b')](_0x64df19['query']);_0x383d8b[_0x6498('0x2d')]=_['intersection'](_0x383d8b['model'],_0x383d8b['query']);_0x12c9d2['attributes']=_[_0x6498('0x2e')](_0x383d8b[_0x6498('0x2a')],qs['fields'](_0x64df19[_0x6498('0x2c')]['fields']));_0x12c9d2[_0x6498('0x2f')]=_0x12c9d2[_0x6498('0x2f')]['length']?_0x12c9d2['attributes']:_0x383d8b[_0x6498('0x2a')];if(!_0x64df19['query'][_0x6498('0x30')](_0x6498('0x31'))){_0x12c9d2['limit']=qs[_0x6498('0x1d')](_0x64df19['query'][_0x6498('0x1d')]);_0x12c9d2[_0x6498('0x32')]=qs[_0x6498('0x32')](_0x64df19[_0x6498('0x2c')][_0x6498('0x32')]);}_0x12c9d2[_0x6498('0x33')]=qs[_0x6498('0x34')](_0x64df19['query'][_0x6498('0x34')]);_0x12c9d2['where']=qs[_0x6498('0x2d')](_['pick'](_0x64df19[_0x6498('0x2c')],_0x383d8b['filters']));if(_0x64df19[_0x6498('0x2c')][_0x6498('0x35')]){_0x12c9d2[_0x6498('0x36')]=_[_0x6498('0x37')](_0x12c9d2[_0x6498('0x36')],{'$or':_[_0x6498('0x38')](_0x4f78b7,function(_0x152b1c){if(_0x152b1c['type'][_0x6498('0x39')]!==_0x6498('0x3a')){var _0x15fe90={};_0x15fe90[_0x152b1c[_0x6498('0x3b')]]={'$like':'%'+_0x64df19[_0x6498('0x2c')][_0x6498('0x35')]+'%'};return _0x15fe90;}})});}_0x12c9d2=_[_0x6498('0x37')]({},_0x12c9d2,_0x64df19[_0x6498('0x3c')]);var _0x5bce22={'where':_0x12c9d2[_0x6498('0x36')]};_0x5bce22[_0x6498('0x3d')]=[];if(_0x64df19[_0x6498('0x2c')]['tag']){_0x5bce22[_0x6498('0x3d')][_0x6498('0x3e')]({'model':db[_0x6498('0x3f')],'as':_0x6498('0x40'),'attributes':['id'],'where':{'id':_0x64df19[_0x6498('0x2c')][_0x6498('0x41')]},'required':!![]});_0x5bce22[_0x6498('0x42')]=!![];}if(_0x64df19[_0x6498('0x2c')][_0x6498('0x43')]){_0x5bce22[_0x6498('0x3d')][_0x6498('0x3e')]({'model':db[_0x6498('0x44')],'as':'Messages','attributes':['id','direction','createdAt',_0x6498('0x43')],'where':{'direction':'in','read':_0x64df19[_0x6498('0x2c')][_0x6498('0x43')]||![]},'required':!![]});_0x5bce22[_0x6498('0x42')]=!![];}return db[_0x6498('0x45')][_0x6498('0x1c')](_0x5bce22)[_0x6498('0x24')](function(_0x5033e3){_0x5eda63[_0x6498('0x1c')]=_0x5033e3;if(_0x64df19[_0x6498('0x2c')][_0x6498('0x46')]){_0x12c9d2[_0x6498('0x3d')]=[{'model':db[_0x6498('0x47')],'as':_0x6498('0x48'),'required':![],'attributes':['id','name',_0x6498('0x49')]},{'model':db[_0x6498('0x4a')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x6498('0x4b'),'attributes':[_0x6498('0x27'),_0x6498('0x49'),'internal'],'required':![]},{'model':db['SmsAccount'],'as':_0x6498('0x4c'),'attributes':['name',_0x6498('0x39')],'required':![]},{'model':db[_0x6498('0x44')],'as':_0x6498('0x4d'),'attributes':['id',_0x6498('0x4e'),_0x6498('0x4f'),_0x6498('0x43')],'where':{'direction':'in','read':_0x64df19['query'][_0x6498('0x43')]||![]},'required':_0x64df19[_0x6498('0x2c')][_0x6498('0x43')]||![]},{'model':db[_0x6498('0x3f')],'as':'Tags','attributes':['id',_0x6498('0x27'),_0x6498('0x50')],'required':_0x64df19[_0x6498('0x2c')][_0x6498('0x41')]?!![]:![]},{'model':db[_0x6498('0x3f')],'as':_0x6498('0x51'),'attributes':['id',_0x6498('0x27'),_0x6498('0x50')],'through':_0x64df19['query'][_0x6498('0x41')]?{'attributes':[],'where':{'TagId':_0x64df19[_0x6498('0x2c')][_0x6498('0x41')]||undefined}}:{},'required':_0x64df19[_0x6498('0x2c')][_0x6498('0x41')]?!![]:![]}];}return db[_0x6498('0x45')][_0x6498('0x52')](_0x12c9d2);})[_0x6498('0x24')](function(_0x2685aa){_0x5eda63[_0x6498('0x53')]=_0x2685aa;return _0x5eda63;})[_0x6498('0x24')](respondWithFilteredResult(_0x4be06f,_0x12c9d2))[_0x6498('0x54')](handleError(_0x4be06f,null));};exports[_0x6498('0x55')]=function(_0x15878d,_0x4650ea){var _0x14b1f9={'raw':![],'where':{'id':_0x15878d[_0x6498('0x56')]['id']}},_0x1ba879={};_0x1ba879[_0x6498('0x2a')]=_[_0x6498('0x2b')](db[_0x6498('0x45')]['rawAttributes']);_0x1ba879[_0x6498('0x2c')]=_[_0x6498('0x2b')](_0x15878d[_0x6498('0x2c')]);_0x1ba879[_0x6498('0x2d')]=_[_0x6498('0x2e')](_0x1ba879[_0x6498('0x2a')],_0x1ba879['query']);_0x14b1f9['attributes']=_[_0x6498('0x2e')](_0x1ba879['model'],qs[_0x6498('0x57')](_0x15878d[_0x6498('0x2c')][_0x6498('0x57')]));_0x14b1f9[_0x6498('0x2f')]=_0x14b1f9[_0x6498('0x2f')]['length']?_0x14b1f9[_0x6498('0x2f')]:_0x1ba879[_0x6498('0x2a')];if(_0x15878d[_0x6498('0x2c')][_0x6498('0x46')]){_0x14b1f9['include']=[{'all':!![]}];}_0x14b1f9=_['merge']({},_0x14b1f9,_0x15878d[_0x6498('0x3c')]);return db['SmsInteraction'][_0x6498('0x58')](_0x14b1f9)[_0x6498('0x24')](handleEntityNotFound(_0x4650ea,null))[_0x6498('0x24')](respondWithResult(_0x4650ea,null))[_0x6498('0x54')](handleError(_0x4650ea,null));};exports[_0x6498('0x59')]=function(_0x1af361,_0x192e8e){return db[_0x6498('0x45')]['create'](_0x1af361[_0x6498('0x5a')],{})[_0x6498('0x24')](respondWithResult(_0x192e8e,0xc9))[_0x6498('0x54')](handleError(_0x192e8e,null));};exports[_0x6498('0x5b')]=function(_0x5c25b3,_0xcc006c){if(_0x5c25b3['body']['id']){delete _0x5c25b3[_0x6498('0x5a')]['id'];}return db['SmsInteraction'][_0x6498('0x58')]({'where':{'id':_0x5c25b3[_0x6498('0x56')]['id']}})['then'](handleEntityNotFound(_0xcc006c,null))['then'](saveUpdates(_0x5c25b3['body'],null))[_0x6498('0x24')](respondWithResult(_0xcc006c,null))[_0x6498('0x54')](handleError(_0xcc006c,null));};exports['destroy']=function(_0x35a41a,_0x68ec4e){return db['SmsInteraction']['find']({'where':{'id':_0x35a41a[_0x6498('0x56')]['id']}})[_0x6498('0x24')](handleEntityNotFound(_0x68ec4e,null))[_0x6498('0x24')](removeEntity(_0x68ec4e,null))[_0x6498('0x54')](handleError(_0x68ec4e,null));};exports[_0x6498('0x5c')]=function(_0x33c930,_0xe61382){return db[_0x6498('0x45')][_0x6498('0x5c')]()['then'](respondWithResult(_0xe61382,null))['catch'](handleError(_0xe61382,null));};exports[_0x6498('0x5d')]=function(_0x112e7f,_0x4f47a5,_0x1e9643){return db[_0x6498('0x44')][_0x6498('0x58')]({'where':{'id':_0x112e7f[_0x6498('0x56')]['id']}})[_0x6498('0x24')](handleEntityNotFound(_0x4f47a5,null))[_0x6498('0x24')](function(_0x50bab7){if(_0x50bab7){return _0x50bab7['addMessage'](_0x112e7f['body'][_0x6498('0x5e')],_[_0x6498('0x5f')](_0x112e7f['body'],[_0x6498('0x5e'),'id'])||{});}})[_0x6498('0x24')](respondWithResult(_0x4f47a5,null))[_0x6498('0x54')](handleError(_0x4f47a5,null));};exports[_0x6498('0x60')]=function(_0x318573,_0xa5d0eb,_0x11f3f7){var _0x178085={'raw':![],'where':{}};var _0x1af28f={};var _0x11080a={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x6498('0x61')]({'where':{'id':_0x318573[_0x6498('0x56')]['id']}})['then'](handleEntityNotFound(_0xa5d0eb,null))['then'](function(_0x5cb912){if(_0x5cb912){_0x1af28f['model']=_[_0x6498('0x2b')](db[_0x6498('0x44')][_0x6498('0x62')]);_0x1af28f[_0x6498('0x2c')]=_['keys'](_0x318573[_0x6498('0x2c')]);_0x1af28f['filters']=_[_0x6498('0x2e')](_0x1af28f[_0x6498('0x2a')],_0x1af28f[_0x6498('0x2c')]);_0x178085[_0x6498('0x2f')]=_[_0x6498('0x2e')](_0x1af28f[_0x6498('0x2a')],qs[_0x6498('0x57')](_0x318573[_0x6498('0x2c')][_0x6498('0x57')]));_0x178085[_0x6498('0x2f')]=_0x178085['attributes'][_0x6498('0x63')]?_0x178085[_0x6498('0x2f')]:_0x1af28f['model'];if(!_0x318573['query']['hasOwnProperty'](_0x6498('0x31'))){_0x178085[_0x6498('0x1d')]=qs['limit'](_0x318573['query'][_0x6498('0x1d')]);_0x178085[_0x6498('0x32')]=qs[_0x6498('0x32')](_0x318573['query'][_0x6498('0x32')]);}_0x178085[_0x6498('0x33')]=qs[_0x6498('0x34')](_0x318573[_0x6498('0x2c')][_0x6498('0x34')]);_0x178085[_0x6498('0x36')]=qs[_0x6498('0x2d')](_[_0x6498('0x64')](_0x318573['query'],_0x1af28f[_0x6498('0x2d')]));_0x178085[_0x6498('0x36')][_0x6498('0x65')]=_0x5cb912['id'];if(_0x318573[_0x6498('0x2c')]['filter']){_0x178085[_0x6498('0x36')]=_[_0x6498('0x37')](_0x178085[_0x6498('0x36')],{'$or':_['map'](_0x178085[_0x6498('0x2f')],function(_0xfe3ed){var _0x13aad2={};_0x13aad2[_0xfe3ed]={'$like':'%'+_0x318573[_0x6498('0x2c')][_0x6498('0x35')]+'%'};return _0x13aad2;})});}if(_0x318573[_0x6498('0x2c')]['$gte']){var _0x1e7668=_0x318573[_0x6498('0x2c')][_0x6498('0x66')]['split'](',');var _0x154b28={};_0x154b28[_0x1e7668[0x0]]={'$gte':moment(_0x1e7668[0x1])[_0x6498('0x67')]('YYYY-MM-DD\x20HH:mm:ss')};_0x178085[_0x6498('0x36')]=_[_0x6498('0x37')](_0x178085[_0x6498('0x36')],_0x154b28);}_0x178085=_[_0x6498('0x37')]({},_0x178085,_0x318573['options']);return db[_0x6498('0x44')][_0x6498('0x1c')]({'where':_0x178085[_0x6498('0x36')]})[_0x6498('0x24')](function(_0x26a737){_0x11080a[_0x6498('0x1c')]=_0x26a737;if(_0x318573[_0x6498('0x2c')][_0x6498('0x46')]){_0x178085[_0x6498('0x3d')]=[{'all':!![]}];}return db['SmsMessage'][_0x6498('0x52')](_0x178085);})[_0x6498('0x24')](function(_0x2503f3){_0x11080a[_0x6498('0x53')]=_0x2503f3;return _0x11080a;});}})[_0x6498('0x24')](respondWithFilteredResult(_0xa5d0eb,_0x178085))[_0x6498('0x54')](handleError(_0xa5d0eb,null));};exports[_0x6498('0x68')]=function(_0x308802,_0x16181c,_0x3f18be){return db[_0x6498('0x45')][_0x6498('0x58')]({'where':{'id':_0x308802[_0x6498('0x56')]['id']}})[_0x6498('0x24')](handleEntityNotFound(_0x16181c,null))[_0x6498('0x24')](function(_0xbebe20){if(_0xbebe20){return _0xbebe20[_0x6498('0x69')](_0x308802[_0x6498('0x5a')][_0x6498('0x5e')],_[_0x6498('0x5f')](_0x308802[_0x6498('0x5a')],[_0x6498('0x5e'),'id'])||{})[_0x6498('0x6a')](function(){return db[_0x6498('0x3f')][_0x6498('0x52')]({'attributes':['id',_0x6498('0x27'),_0x6498('0x50')],'where':{'id':_0x308802['body']['ids']}});})[_0x6498('0x24')](function(_0x1c298b){socket[_0x6498('0x6b')](_0x6498('0x6c'),{'id':Number(_0x308802[_0x6498('0x56')]['id']),'tags':_0x1c298b||[]});return{'id':Number(_0x308802[_0x6498('0x56')]['id']),'tags':_0x1c298b||[]};});}})[_0x6498('0x24')](respondWithResult(_0x16181c,null))[_0x6498('0x54')](handleError(_0x16181c,null));};exports[_0x6498('0x6d')]=function(_0x12fc40,_0x4e8946,_0x40fa8b){var _0x3f9563;return db[_0x6498('0x45')][_0x6498('0x58')]({'where':{'id':_0x12fc40['params']['id']}})[_0x6498('0x24')](handleEntityNotFound(_0x4e8946,null))[_0x6498('0x24')](function(_0x476965){if(_0x476965){return _0x476965[_0x6498('0x6d')](_0x12fc40[_0x6498('0x2c')][_0x6498('0x5e')]);}})['then'](respondWithStatusCode(_0x4e8946,null))['catch'](handleError(_0x4e8946,null));};exports[_0x6498('0x6e')]=function(_0x7baa78,_0xe09cc9){var _0x4f3aab=moment()[_0x6498('0x6f')]()[_0x6498('0x70')]();var _0x28c0df=path[_0x6498('0x71')](config['root'],'server',_0x6498('0x72'),_0x6498('0x73'));var _0x35a168=path[_0x6498('0x71')](config[_0x6498('0x74')],_0x6498('0x75'),_0x6498('0x72'),_0x6498('0x76'));var _0x51f380=path[_0x6498('0x71')](_0x28c0df,_0x4f3aab);var _0x4da692=util[_0x6498('0x67')]('interaction-%s.zip',_0x4f3aab);var _0x56763f=path[_0x6498('0x71')](_0x28c0df,_0x4da692);var _0x5b4404=![];return db[_0x6498('0x45')][_0x6498('0x58')]({'where':{'id':_0x7baa78[_0x6498('0x56')]['id']},'include':[{'model':db[_0x6498('0x44')],'as':_0x6498('0x4d'),'attributes':['id',_0x6498('0x5a')],'include':[{'model':db[_0x6498('0x47')],'as':_0x6498('0x47'),'attributes':['id',_0x6498('0x49')],'raw':!![]},{'model':db[_0x6498('0x4a')],'as':_0x6498('0x77'),'attributes':['id',_0x6498('0x78')],'raw':!![]}]}]})[_0x6498('0x24')](handleEntityNotFound(_0xe09cc9,null))[_0x6498('0x24')](function(_0x394e2d){if(_0x394e2d){_0x5b4404=!![];var _0xa511e9='';var _0xff8015={'format':_0x6498('0x79'),'border':_0x6498('0x7a')};fs[_0x6498('0x7b')](_0x51f380);_0xa511e9+=util['format'](_0x6498('0x7c'),_0x394e2d['id']);_0xa511e9+=util[_0x6498('0x67')](_0x6498('0x7d'),moment()[_0x6498('0x67')]('MMMM\x20Do\x20YYYY,\x20HH:mm:ss')['toString']());_0xa511e9+=_0x6498('0x7e');for(var _0x30b025=0x0;_0x30b025<_0x394e2d['Messages'][_0x6498('0x63')];_0x30b025++){var _0x4a0d10=_0x394e2d[_0x6498('0x4d')][_0x30b025];_0xa511e9+=_0x6498('0x7f');_0xa511e9+=util['format'](_0x6498('0x80'),_0x4a0d10['User']?_0x4a0d10['User'][_0x6498('0x49')]:_0x4a0d10[_0x6498('0x77')][_0x6498('0x78')],_0x4a0d10[_0x6498('0x5a')]);_0xa511e9+='</div>';}return new BPromise(function(_0x5234c9,_0x19588e){pdf['create'](_0xa511e9,_0xff8015)[_0x6498('0x81')](path[_0x6498('0x71')](_0x51f380,_0x6498('0x82')+_0x4f3aab+_0x6498('0x83')),function(_0x54e28c,_0x3116c5){if(_0x54e28c)return _0x19588e(_0x54e28c);_0x5234c9(_0x3116c5);});});}})[_0x6498('0x24')](function(){if(_0x5b4404){return new BPromise(function(_0x26526d,_0x313827){zipdir(_0x51f380,{'saveTo':_0x56763f},function(_0x20e566,_0x28c9ff){if(_0x20e566)return _0x313827(_0x20e566);return _0x26526d(_0x28c9ff);});});}})[_0x6498('0x24')](function(){if(_0x5b4404){return new BPromise(function(_0x3db8f8,_0x1a2476){rimraf(_0x51f380,function(_0x1fe977){if(_0x1fe977)_0x1a2476(_0x1fe977);return _0x3db8f8();});});}})[_0x6498('0x24')](function(){if(_0x5b4404){return _0xe09cc9[_0x6498('0x6e')](_0x56763f,_0x4da692,function(_0x134334){if(_0x134334){console[_0x6498('0x84')](_0x6498('0x85'),_0x134334);}else{fs['unlinkSync'](_0x56763f);}});}else{return _0xe09cc9[_0x6498('0x19')](0xc8);}})['catch'](handleError(_0xe09cc9,null));};
\ No newline at end of file
+var _0x5620=['SmsMessage','direction','createdAt','SmsInteraction','includeAll','User','Users','Contact','Owner','SmsAccount','Account','Tags','color','findAll','catch','show','params','create','body','find','describe','addMessage','ids','omit','getMessages','findOne','length','pick','SmsInteractionId','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','smsInteractionTags:save','removeTags','toString','join','server','files','tmp','root','attachments','format','interaction-%s.zip','Messages','CmContact','firstName','Letter','1cm','mkdirSync','<hr>','<div\x20style=\x22border-style:\x20solid;\x20border-width:\x201px;\x20margin:\x203px;\x22>','<p\x20style=\x22margin:\x203px;\x22>%s:\x20%s</p>','fullname','toFile','interaction-','.pdf','download','log','err','html-pdf','rimraf','zip-dir','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','sendStatus','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','status','error','stack','name','index','rawAttributes','keys','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','filter','merge','map','VIRTUAL','field','options','tag','include','push','Tag','distinct','read'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5620,0xbf));var _0x0562=function(_0x47761d,_0x3f8494){_0x47761d=_0x47761d-0x0;var _0x3d1c05=_0x5620[_0x47761d];return _0x3d1c05;};'use strict';var pdf=require(_0x0562('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0562('0x1'));var zipdir=require(_0x0562('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0562('0x3'));var Mustache=require('mustache');var util=require(_0x0562('0x4'));var path=require('path');var sox=require(_0x0562('0x5'));var csv=require(_0x0562('0x6'));var ejs=require(_0x0562('0x7'));var fs=require('fs');var _=require(_0x0562('0x8'));var squel=require(_0x0562('0x9'));var crypto=require(_0x0562('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0562('0x6'));var querystring=require('querystring');var Papa=require(_0x0562('0xb'));var authService=require(_0x0562('0xc'));var hardwareService=require(_0x0562('0xd'));var Redis=require(_0x0562('0xe'));var qs=require(_0x0562('0xf'));var logger=require('../../config/logger')(_0x0562('0x10'));var utils=require(_0x0562('0x11'));var config=require(_0x0562('0x12'));var db=require(_0x0562('0x13'))['db'];config[_0x0562('0x14')]=_['defaults'](config['redis'],{'host':_0x0562('0x15'),'port':0x18eb});var socket=require(_0x0562('0x16'))(new Redis(config[_0x0562('0x14')]));require(_0x0562('0x17'))['register'](socket);function respondWithStatusCode(_0x160656,_0xe654c7){_0xe654c7=_0xe654c7||0xcc;return function(_0x3ed2c8){if(_0x3ed2c8){return _0x160656[_0x0562('0x18')](_0xe654c7);}return _0x160656['status'](_0xe654c7)[_0x0562('0x19')]();};}function respondWithResult(_0x4ed54d,_0x4711c1){_0x4711c1=_0x4711c1||0xc8;return function(_0x31579e){if(_0x31579e){return _0x4ed54d['status'](_0x4711c1)[_0x0562('0x1a')](_0x31579e);}};}function respondWithFilteredResult(_0x4ea063,_0x2691e4){return function(_0x16d18e){if(_0x16d18e){var _0x426f41=_0x16d18e[_0x0562('0x1b')],_0x554527=_0x2691e4['offset'],_0x9dfcb6=_0x2691e4[_0x0562('0x1c')]+_0x2691e4[_0x0562('0x1d')],_0x5d6341;if(_0x9dfcb6>=_0x426f41){_0x9dfcb6=_0x426f41;_0x5d6341=0xc8;}else{_0x5d6341=0xce;}_0x4ea063['status'](_0x5d6341);return _0x4ea063[_0x0562('0x1e')](_0x0562('0x1f'),_0x554527+'-'+_0x9dfcb6+'/'+_0x426f41)[_0x0562('0x1a')](_0x16d18e);}return null;};}function patchUpdates(_0x90626d){return function(_0x5dbc61){try{jsonpatch[_0x0562('0x20')](_0x5dbc61,_0x90626d,!![]);}catch(_0x5819b8){return BPromise['reject'](_0x5819b8);}return _0x5dbc61['save']();};}function saveUpdates(_0x4bbcf7,_0x35f245){return function(_0x37f493){if(_0x37f493){return _0x37f493[_0x0562('0x21')](_0x4bbcf7)[_0x0562('0x22')](function(_0x14024b){return _0x14024b;});}return null;};}function removeEntity(_0x541e82,_0x5121ee){return function(_0x3e06ab){if(_0x3e06ab){return _0x3e06ab[_0x0562('0x23')]()[_0x0562('0x22')](function(){_0x541e82[_0x0562('0x24')](0xcc)[_0x0562('0x19')]();});}};}function handleEntityNotFound(_0x57c34f,_0x4123e4){return function(_0x98ee54){if(!_0x98ee54){_0x57c34f[_0x0562('0x18')](0x194);}return _0x98ee54;};}function handleError(_0x23d10a,_0x1adf63){_0x1adf63=_0x1adf63||0x1f4;return function(_0xade948){logger[_0x0562('0x25')](_0xade948[_0x0562('0x26')]);if(_0xade948[_0x0562('0x27')]){delete _0xade948[_0x0562('0x27')];}_0x23d10a[_0x0562('0x24')](_0x1adf63)['send'](_0xade948);};}exports[_0x0562('0x28')]=function(_0x4ea641,_0x1acaff){var _0x2ec92b={},_0x5e09e1={},_0x49f584={'count':0x0,'rows':[]};var _0x51ac77=db['SmsInteraction'][_0x0562('0x29')];_0x5e09e1['model']=_[_0x0562('0x2a')](_0x51ac77);_0x5e09e1[_0x0562('0x2b')]=_[_0x0562('0x2a')](_0x4ea641[_0x0562('0x2b')]);_0x5e09e1[_0x0562('0x2c')]=_[_0x0562('0x2d')](_0x5e09e1[_0x0562('0x2e')],_0x5e09e1[_0x0562('0x2b')]);_0x2ec92b[_0x0562('0x2f')]=_[_0x0562('0x2d')](_0x5e09e1['model'],qs[_0x0562('0x30')](_0x4ea641[_0x0562('0x2b')]['fields']));_0x2ec92b['attributes']=_0x2ec92b[_0x0562('0x2f')]['length']?_0x2ec92b['attributes']:_0x5e09e1[_0x0562('0x2e')];if(!_0x4ea641[_0x0562('0x2b')]['hasOwnProperty'](_0x0562('0x31'))){_0x2ec92b[_0x0562('0x1d')]=qs[_0x0562('0x1d')](_0x4ea641['query'][_0x0562('0x1d')]);_0x2ec92b[_0x0562('0x1c')]=qs[_0x0562('0x1c')](_0x4ea641[_0x0562('0x2b')][_0x0562('0x1c')]);}_0x2ec92b[_0x0562('0x32')]=qs['sort'](_0x4ea641[_0x0562('0x2b')][_0x0562('0x33')]);_0x2ec92b[_0x0562('0x34')]=qs[_0x0562('0x2c')](_['pick'](_0x4ea641[_0x0562('0x2b')],_0x5e09e1['filters']));if(_0x4ea641[_0x0562('0x2b')][_0x0562('0x35')]){_0x2ec92b[_0x0562('0x34')]=_[_0x0562('0x36')](_0x2ec92b[_0x0562('0x34')],{'$or':_[_0x0562('0x37')](_0x51ac77,function(_0x249923){if(_0x249923['type']['key']!==_0x0562('0x38')){var _0x265d2b={};_0x265d2b[_0x249923[_0x0562('0x39')]]={'$like':'%'+_0x4ea641['query'][_0x0562('0x35')]+'%'};return _0x265d2b;}})});}_0x2ec92b=_['merge']({},_0x2ec92b,_0x4ea641[_0x0562('0x3a')]);var _0x56c456={'where':_0x2ec92b['where']};_0x56c456['include']=[];if(_0x4ea641[_0x0562('0x2b')][_0x0562('0x3b')]){_0x56c456[_0x0562('0x3c')][_0x0562('0x3d')]({'model':db[_0x0562('0x3e')],'as':'Tags','attributes':['id'],'where':{'id':_0x4ea641[_0x0562('0x2b')][_0x0562('0x3b')]},'required':!![]});_0x56c456[_0x0562('0x3f')]=!![];}if(_0x4ea641[_0x0562('0x2b')][_0x0562('0x40')]){_0x56c456[_0x0562('0x3c')]['push']({'model':db[_0x0562('0x41')],'as':'Messages','attributes':['id',_0x0562('0x42'),_0x0562('0x43'),_0x0562('0x40')],'where':{'direction':'in','read':_0x4ea641['query']['read']||![]},'required':!![]});_0x56c456[_0x0562('0x3f')]=!![];}return db[_0x0562('0x44')][_0x0562('0x1b')](_0x56c456)['then'](function(_0x22afb1){_0x49f584[_0x0562('0x1b')]=_0x22afb1;if(_0x4ea641[_0x0562('0x2b')][_0x0562('0x45')]){_0x2ec92b[_0x0562('0x3c')]=[{'model':db[_0x0562('0x46')],'as':_0x0562('0x47'),'required':![],'attributes':['id','name','fullname']},{'model':db['CmContact'],'as':_0x0562('0x48'),'required':![]},{'model':db[_0x0562('0x46')],'as':_0x0562('0x49'),'attributes':[_0x0562('0x27'),'fullname','internal'],'required':![]},{'model':db[_0x0562('0x4a')],'as':_0x0562('0x4b'),'attributes':[_0x0562('0x27'),'key'],'required':![]},{'model':db[_0x0562('0x41')],'as':'Messages','attributes':['id',_0x0562('0x42'),'createdAt',_0x0562('0x40')],'where':{'direction':'in','read':_0x4ea641[_0x0562('0x2b')][_0x0562('0x40')]||![]},'required':_0x4ea641[_0x0562('0x2b')][_0x0562('0x40')]||![]},{'model':db[_0x0562('0x3e')],'as':_0x0562('0x4c'),'attributes':['id','name',_0x0562('0x4d')],'required':_0x4ea641['query']['tag']?!![]:![]},{'model':db['Tag'],'as':'ThroughTags','attributes':['id',_0x0562('0x27'),_0x0562('0x4d')],'through':_0x4ea641[_0x0562('0x2b')][_0x0562('0x3b')]?{'attributes':[],'where':{'TagId':_0x4ea641[_0x0562('0x2b')]['tag']||undefined}}:{},'required':_0x4ea641['query']['tag']?!![]:![]}];}return db[_0x0562('0x44')][_0x0562('0x4e')](_0x2ec92b);})[_0x0562('0x22')](function(_0x9af18b){_0x49f584['rows']=_0x9af18b;return _0x49f584;})[_0x0562('0x22')](respondWithFilteredResult(_0x1acaff,_0x2ec92b))[_0x0562('0x4f')](handleError(_0x1acaff,null));};exports[_0x0562('0x50')]=function(_0x1fb4b6,_0x4df198){var _0x40759d={'raw':![],'where':{'id':_0x1fb4b6[_0x0562('0x51')]['id']}},_0x269339={};_0x269339[_0x0562('0x2e')]=_['keys'](db[_0x0562('0x44')]['rawAttributes']);_0x269339['query']=_[_0x0562('0x2a')](_0x1fb4b6[_0x0562('0x2b')]);_0x269339[_0x0562('0x2c')]=_['intersection'](_0x269339[_0x0562('0x2e')],_0x269339['query']);_0x40759d[_0x0562('0x2f')]=_[_0x0562('0x2d')](_0x269339[_0x0562('0x2e')],qs[_0x0562('0x30')](_0x1fb4b6['query'][_0x0562('0x30')]));_0x40759d[_0x0562('0x2f')]=_0x40759d[_0x0562('0x2f')]['length']?_0x40759d[_0x0562('0x2f')]:_0x269339[_0x0562('0x2e')];if(_0x1fb4b6[_0x0562('0x2b')][_0x0562('0x45')]){_0x40759d[_0x0562('0x3c')]=[{'all':!![]}];}_0x40759d=_[_0x0562('0x36')]({},_0x40759d,_0x1fb4b6[_0x0562('0x3a')]);return db[_0x0562('0x44')]['find'](_0x40759d)[_0x0562('0x22')](handleEntityNotFound(_0x4df198,null))[_0x0562('0x22')](respondWithResult(_0x4df198,null))[_0x0562('0x4f')](handleError(_0x4df198,null));};exports['create']=function(_0x2c2951,_0xf24e91){return db[_0x0562('0x44')][_0x0562('0x52')](_0x2c2951[_0x0562('0x53')],{})[_0x0562('0x22')](respondWithResult(_0xf24e91,0xc9))[_0x0562('0x4f')](handleError(_0xf24e91,null));};exports['update']=function(_0xc50bb2,_0x19edbf){if(_0xc50bb2['body']['id']){delete _0xc50bb2[_0x0562('0x53')]['id'];}return db[_0x0562('0x44')]['find']({'where':{'id':_0xc50bb2[_0x0562('0x51')]['id']}})['then'](handleEntityNotFound(_0x19edbf,null))[_0x0562('0x22')](saveUpdates(_0xc50bb2[_0x0562('0x53')],null))[_0x0562('0x22')](respondWithResult(_0x19edbf,null))[_0x0562('0x4f')](handleError(_0x19edbf,null));};exports[_0x0562('0x23')]=function(_0x4054b7,_0x5e302c){return db[_0x0562('0x44')][_0x0562('0x54')]({'where':{'id':_0x4054b7['params']['id']}})[_0x0562('0x22')](handleEntityNotFound(_0x5e302c,null))[_0x0562('0x22')](removeEntity(_0x5e302c,null))[_0x0562('0x4f')](handleError(_0x5e302c,null));};exports['describe']=function(_0x21d5f9,_0x54a18b){return db[_0x0562('0x44')][_0x0562('0x55')]()[_0x0562('0x22')](respondWithResult(_0x54a18b,null))['catch'](handleError(_0x54a18b,null));};exports[_0x0562('0x56')]=function(_0x1e9afc,_0xf047e1,_0x23f82f){return db[_0x0562('0x41')][_0x0562('0x54')]({'where':{'id':_0x1e9afc[_0x0562('0x51')]['id']}})[_0x0562('0x22')](handleEntityNotFound(_0xf047e1,null))[_0x0562('0x22')](function(_0x52d397){if(_0x52d397){return _0x52d397['addMessage'](_0x1e9afc[_0x0562('0x53')][_0x0562('0x57')],_[_0x0562('0x58')](_0x1e9afc[_0x0562('0x53')],[_0x0562('0x57'),'id'])||{});}})[_0x0562('0x22')](respondWithResult(_0xf047e1,null))[_0x0562('0x4f')](handleError(_0xf047e1,null));};exports[_0x0562('0x59')]=function(_0x19212e,_0x5fef67,_0x5d1fec){var _0x2a4ccd={'raw':![],'where':{}};var _0xeb8862={};var _0x537df4={'count':0x0,'rows':[]};return db[_0x0562('0x44')][_0x0562('0x5a')]({'where':{'id':_0x19212e[_0x0562('0x51')]['id']}})[_0x0562('0x22')](handleEntityNotFound(_0x5fef67,null))[_0x0562('0x22')](function(_0x331040){if(_0x331040){_0xeb8862[_0x0562('0x2e')]=_['keys'](db[_0x0562('0x41')][_0x0562('0x29')]);_0xeb8862[_0x0562('0x2b')]=_['keys'](_0x19212e[_0x0562('0x2b')]);_0xeb8862['filters']=_[_0x0562('0x2d')](_0xeb8862[_0x0562('0x2e')],_0xeb8862['query']);_0x2a4ccd[_0x0562('0x2f')]=_['intersection'](_0xeb8862[_0x0562('0x2e')],qs[_0x0562('0x30')](_0x19212e[_0x0562('0x2b')][_0x0562('0x30')]));_0x2a4ccd[_0x0562('0x2f')]=_0x2a4ccd[_0x0562('0x2f')][_0x0562('0x5b')]?_0x2a4ccd[_0x0562('0x2f')]:_0xeb8862[_0x0562('0x2e')];if(!_0x19212e['query']['hasOwnProperty'](_0x0562('0x31'))){_0x2a4ccd[_0x0562('0x1d')]=qs['limit'](_0x19212e[_0x0562('0x2b')][_0x0562('0x1d')]);_0x2a4ccd[_0x0562('0x1c')]=qs[_0x0562('0x1c')](_0x19212e[_0x0562('0x2b')][_0x0562('0x1c')]);}_0x2a4ccd[_0x0562('0x32')]=qs[_0x0562('0x33')](_0x19212e[_0x0562('0x2b')][_0x0562('0x33')]);_0x2a4ccd[_0x0562('0x34')]=qs['filters'](_[_0x0562('0x5c')](_0x19212e[_0x0562('0x2b')],_0xeb8862[_0x0562('0x2c')]));_0x2a4ccd[_0x0562('0x34')][_0x0562('0x5d')]=_0x331040['id'];if(_0x19212e[_0x0562('0x2b')][_0x0562('0x35')]){_0x2a4ccd['where']=_[_0x0562('0x36')](_0x2a4ccd[_0x0562('0x34')],{'$or':_[_0x0562('0x37')](_0x2a4ccd['attributes'],function(_0x84daf9){var _0x53662b={};_0x53662b[_0x84daf9]={'$like':'%'+_0x19212e['query'][_0x0562('0x35')]+'%'};return _0x53662b;})});}if(_0x19212e['query']['$gte']){var _0x2ff56e=_0x19212e[_0x0562('0x2b')][_0x0562('0x5e')][_0x0562('0x5f')](',');var _0x2cfc81={};_0x2cfc81[_0x2ff56e[0x0]]={'$gte':moment(_0x2ff56e[0x1])['format'](_0x0562('0x60'))};_0x2a4ccd[_0x0562('0x34')]=_['merge'](_0x2a4ccd[_0x0562('0x34')],_0x2cfc81);}_0x2a4ccd=_[_0x0562('0x36')]({},_0x2a4ccd,_0x19212e[_0x0562('0x3a')]);return db['SmsMessage'][_0x0562('0x1b')]({'where':_0x2a4ccd['where']})[_0x0562('0x22')](function(_0x8af2cf){_0x537df4[_0x0562('0x1b')]=_0x8af2cf;if(_0x19212e['query'][_0x0562('0x45')]){_0x2a4ccd[_0x0562('0x3c')]=[{'all':!![]}];}return db[_0x0562('0x41')]['findAll'](_0x2a4ccd);})['then'](function(_0x250158){_0x537df4[_0x0562('0x61')]=_0x250158;return _0x537df4;});}})['then'](respondWithFilteredResult(_0x5fef67,_0x2a4ccd))[_0x0562('0x4f')](handleError(_0x5fef67,null));};exports[_0x0562('0x62')]=function(_0x1248b4,_0x4c3ff2,_0x3877bd){return db[_0x0562('0x44')]['find']({'where':{'id':_0x1248b4[_0x0562('0x51')]['id']}})['then'](handleEntityNotFound(_0x4c3ff2,null))['then'](function(_0x1c5c5b){if(_0x1c5c5b){return _0x1c5c5b[_0x0562('0x63')](_0x1248b4[_0x0562('0x53')]['ids'],_[_0x0562('0x58')](_0x1248b4[_0x0562('0x53')],['ids','id'])||{})[_0x0562('0x64')](function(){return db['Tag']['findAll']({'attributes':['id',_0x0562('0x27'),_0x0562('0x4d')],'where':{'id':_0x1248b4[_0x0562('0x53')]['ids']}});})[_0x0562('0x22')](function(_0x434e96){socket['emit'](_0x0562('0x65'),{'id':Number(_0x1248b4['params']['id']),'tags':_0x434e96||[]});return{'id':Number(_0x1248b4[_0x0562('0x51')]['id']),'tags':_0x434e96||[]};});}})['then'](respondWithResult(_0x4c3ff2,null))[_0x0562('0x4f')](handleError(_0x4c3ff2,null));};exports[_0x0562('0x66')]=function(_0x523274,_0x5ed31e,_0x42fa60){var _0x1121f7;return db[_0x0562('0x44')]['find']({'where':{'id':_0x523274[_0x0562('0x51')]['id']}})['then'](handleEntityNotFound(_0x5ed31e,null))[_0x0562('0x22')](function(_0x408b92){if(_0x408b92){return _0x408b92[_0x0562('0x66')](_0x523274[_0x0562('0x2b')]['ids']);}})[_0x0562('0x22')](respondWithStatusCode(_0x5ed31e,null))[_0x0562('0x4f')](handleError(_0x5ed31e,null));};exports['download']=function(_0x4e0871,_0x452705){var _0x98794f=moment()['unix']()[_0x0562('0x67')]();var _0x4252cf=path[_0x0562('0x68')](config['root'],_0x0562('0x69'),_0x0562('0x6a'),_0x0562('0x6b'));var _0x12dcc4=path[_0x0562('0x68')](config[_0x0562('0x6c')],_0x0562('0x69'),_0x0562('0x6a'),_0x0562('0x6d'));var _0x917560=path['join'](_0x4252cf,_0x98794f);var _0x8642b9=util[_0x0562('0x6e')](_0x0562('0x6f'),_0x98794f);var _0xff7f8a=path[_0x0562('0x68')](_0x4252cf,_0x8642b9);var _0x32021f=![];return db[_0x0562('0x44')][_0x0562('0x54')]({'where':{'id':_0x4e0871['params']['id']},'include':[{'model':db['SmsMessage'],'as':_0x0562('0x70'),'attributes':['id',_0x0562('0x53')],'include':[{'model':db[_0x0562('0x46')],'as':_0x0562('0x46'),'attributes':['id','fullname'],'raw':!![]},{'model':db[_0x0562('0x71')],'as':_0x0562('0x48'),'attributes':['id',_0x0562('0x72')],'raw':!![]}]}]})[_0x0562('0x22')](handleEntityNotFound(_0x452705,null))[_0x0562('0x22')](function(_0x185a8e){if(_0x185a8e){_0x32021f=!![];var _0x341143='';var _0x28e1d1={'format':_0x0562('0x73'),'border':_0x0562('0x74')};fs[_0x0562('0x75')](_0x917560);_0x341143+=util[_0x0562('0x6e')]('<h1>Sms\x20Interaction:\x20#%d</h1>',_0x185a8e['id']);_0x341143+=util[_0x0562('0x6e')]('<h2>Date:\x20%s</h2>',moment()[_0x0562('0x6e')]('MMMM\x20Do\x20YYYY,\x20HH:mm:ss')['toString']());_0x341143+=_0x0562('0x76');for(var _0x35a5b4=0x0;_0x35a5b4<_0x185a8e[_0x0562('0x70')][_0x0562('0x5b')];_0x35a5b4++){var _0x420287=_0x185a8e[_0x0562('0x70')][_0x35a5b4];_0x341143+=_0x0562('0x77');_0x341143+=util[_0x0562('0x6e')](_0x0562('0x78'),_0x420287[_0x0562('0x46')]?_0x420287[_0x0562('0x46')][_0x0562('0x79')]:_0x420287['Contact'][_0x0562('0x72')],_0x420287['body']);_0x341143+='</div>';}return new BPromise(function(_0x2eb237,_0x287d02){pdf[_0x0562('0x52')](_0x341143,_0x28e1d1)[_0x0562('0x7a')](path[_0x0562('0x68')](_0x917560,_0x0562('0x7b')+_0x98794f+_0x0562('0x7c')),function(_0x2c53ef,_0x271888){if(_0x2c53ef)return _0x287d02(_0x2c53ef);_0x2eb237(_0x271888);});});}})[_0x0562('0x22')](function(){if(_0x32021f){return new BPromise(function(_0x1c1909,_0x2a8d45){zipdir(_0x917560,{'saveTo':_0xff7f8a},function(_0x5c96de,_0x5b2230){if(_0x5c96de)return _0x2a8d45(_0x5c96de);return _0x1c1909(_0x5b2230);});});}})[_0x0562('0x22')](function(){if(_0x32021f){return new BPromise(function(_0x154eaf,_0x56ae78){rimraf(_0x917560,function(_0x35a1f4){if(_0x35a1f4)_0x56ae78(_0x35a1f4);return _0x154eaf();});});}})[_0x0562('0x22')](function(){if(_0x32021f){return _0x452705[_0x0562('0x7d')](_0xff7f8a,_0x8642b9,function(_0x32016a){if(_0x32016a){console[_0x0562('0x7e')](_0x0562('0x7f'),_0x32016a);}else{fs['unlinkSync'](_0xff7f8a);}});}else{return _0x452705[_0x0562('0x18')](0xc8);}})[_0x0562('0x4f')](handleError(_0x452705,null));};
\ No newline at end of file
index d1e9738..4c1fd69 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6bd9=['emit','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6bd9,0xd5));var _0x96bd=function(_0x1488c6,_0x1dc1b1){_0x1488c6=_0x1488c6-0x0;var _0x417664=_0x6bd9[_0x1488c6];return _0x417664;};'use strict';var EventEmitter=require(_0x96bd('0x0'));var SmsInteraction=require(_0x96bd('0x1'))['db']['SmsInteraction'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x96bd('0x2')](0x0);var events={'afterCreate':_0x96bd('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4a3114){return function(_0xa15506,_0x3f20da,_0x3754c1){SmsInteractionEvents['emit'](_0x4a3114+':'+_0xa15506['id'],_0xa15506);SmsInteractionEvents[_0x96bd('0x4')](_0x4a3114,_0xa15506);_0x3754c1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x96bd('0x5')](e,emitEvent(event));}}module[_0x96bd('0x6')]=SmsInteractionEvents;
\ No newline at end of file
+var _0xf5e0=['remove','emit','hook','exports','../../mysqldb','SmsInteraction','setMaxListeners','update'];(function(_0x197085,_0x12bc94){var _0x1c0744=function(_0x5348e4){while(--_0x5348e4){_0x197085['push'](_0x197085['shift']());}};_0x1c0744(++_0x12bc94);}(_0xf5e0,0x84));var _0x0f5e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf5e0[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x0f5e('0x0'))['db'][_0x0f5e('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x0f5e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0f5e('0x3'),'afterDestroy':_0x0f5e('0x4')};function emitEvent(_0x48c0ee){return function(_0xbb1574,_0x440457,_0x56f968){SmsInteractionEvents[_0x0f5e('0x5')](_0x48c0ee+':'+_0xbb1574['id'],_0xbb1574);SmsInteractionEvents[_0x0f5e('0x5')](_0x48c0ee,_0xbb1574);_0x56f968(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x0f5e('0x6')](e,emitEvent(event));}}module[_0x0f5e('0x7')]=SmsInteractionEvents;
\ No newline at end of file
index 70143b6..e2c5581 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7bee=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','define','SmsInteraction','sms_interactions'];(function(_0x4b8a5c,_0x2f7371){var _0x2e38f4=function(_0x155abc){while(--_0x155abc){_0x4b8a5c['push'](_0x4b8a5c['shift']());}};_0x2e38f4(++_0x2f7371);}(_0x7bee,0x168));var _0xe7be=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x7bee[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xe7be('0x0'));var util=require(_0xe7be('0x1'));var logger=require(_0xe7be('0x2'))(_0xe7be('0x3'));var moment=require(_0xe7be('0x4'));var BPromise=require(_0xe7be('0x5'));var rp=require(_0xe7be('0x6'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x12b218,_0x373bf1){return _0x12b218[_0xe7be('0x7')](_0xe7be('0x8'),attributes,{'tableName':_0xe7be('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xfc0c=['sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','bluebird','request-promise','./smsInteraction.attributes','exports','define','SmsInteraction'];(function(_0xb09bdc,_0x1a0c14){var _0xaa7aed=function(_0x42b49c){while(--_0x42b49c){_0xb09bdc['push'](_0xb09bdc['shift']());}};_0xaa7aed(++_0x1a0c14);}(_0xfc0c,0x123));var _0xcfc0=function(_0x553c17,_0x312c34){_0x553c17=_0x553c17-0x0;var _0x22a50f=_0xfc0c[_0x553c17];return _0x22a50f;};'use strict';var _=require('lodash');var util=require(_0xcfc0('0x0'));var logger=require('../../config/logger')(_0xcfc0('0x1'));var moment=require(_0xcfc0('0x2'));var BPromise=require(_0xcfc0('0x3'));var rp=require(_0xcfc0('0x4'));var attributes=require(_0xcfc0('0x5'));module[_0xcfc0('0x6')]=function(_0x205343,_0x5e13b9){return _0x205343[_0xcfc0('0x7')](_0xcfc0('0x8'),attributes,{'tableName':_0xcfc0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2b453e,_0x2f087b,_0x39543e){if(_0x2b453e[_0xcfc0('0xa')](_0xcfc0('0xb'))){_0x2b453e[_0xcfc0('0xc')]=moment()[_0xcfc0('0xd')](_0xcfc0('0xe'));}_0x39543e(null,_0x2b453e);}}});};
\ No newline at end of file
index a237107..585db33 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc4e6=['debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateSmsInteraction','SmsInteraction','options','raw','attributes','stringify','AddTagsToSmsInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x4da022,_0x502afa){var _0x327d96=function(_0x11d7af){while(--_0x11d7af){_0x4da022['push'](_0x4da022['shift']());}};_0x327d96(++_0x502afa);}(_0xc4e6,0x66));var _0x6c4e=function(_0x770f7,_0x3af003){_0x770f7=_0x770f7-0x0;var _0xe797c6=_0xc4e6[_0x770f7];return _0xe797c6;};'use strict';var _=require(_0x6c4e('0x0'));var util=require(_0x6c4e('0x1'));var moment=require('moment');var BPromise=require(_0x6c4e('0x2'));var rs=require(_0x6c4e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c4e('0x4'))['db'];var utils=require(_0x6c4e('0x5'));var logger=require(_0x6c4e('0x6'))(_0x6c4e('0x7'));var config=require(_0x6c4e('0x8'));var jayson=require(_0x6c4e('0x9'));var client=jayson['client'][_0x6c4e('0xa')]({'port':0x232a});config[_0x6c4e('0xb')]=_[_0x6c4e('0xc')](config[_0x6c4e('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6c4e('0xd'))(new Redis(config['redis']));require(_0x6c4e('0xe'))[_0x6c4e('0xf')](socket);function respondWithRpcPromise(_0x11317b,_0x234840,_0x3da9a7){return new BPromise(function(_0x5e7abd,_0x3d4903){return client[_0x6c4e('0x10')](_0x11317b,_0x3da9a7)[_0x6c4e('0x11')](function(_0x44b1a9){logger[_0x6c4e('0x12')](_0x6c4e('0x13'),_0x234840,_0x6c4e('0x14'));logger[_0x6c4e('0x15')](_0x6c4e('0x16'),_0x234840,'request\x20sent',JSON['stringify'](_0x44b1a9));if(_0x44b1a9[_0x6c4e('0x17')]){if(_0x44b1a9[_0x6c4e('0x17')][_0x6c4e('0x18')]===0x1f4){logger[_0x6c4e('0x17')](_0x6c4e('0x13'),_0x234840,_0x44b1a9[_0x6c4e('0x17')][_0x6c4e('0x19')]);return _0x3d4903(_0x44b1a9[_0x6c4e('0x17')][_0x6c4e('0x19')]);}logger[_0x6c4e('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x234840,_0x44b1a9[_0x6c4e('0x17')]['message']);return _0x5e7abd(_0x44b1a9[_0x6c4e('0x17')][_0x6c4e('0x19')]);}else{logger[_0x6c4e('0x12')](_0x6c4e('0x13'),_0x234840,_0x6c4e('0x14'));_0x5e7abd(_0x44b1a9['result'][_0x6c4e('0x19')]);}})[_0x6c4e('0x1a')](function(_0xca7ab0){logger[_0x6c4e('0x17')](_0x6c4e('0x13'),_0x234840,_0xca7ab0);_0x3d4903(_0xca7ab0);});});}exports[_0x6c4e('0x1b')]=function(_0x417907){var _0x152ac9=this;return new Promise(function(_0x59e9d5,_0x317414){return db[_0x6c4e('0x1c')]['update'](_0x417907['body'],{'raw':_0x417907[_0x6c4e('0x1d')]?_0x417907[_0x6c4e('0x1d')][_0x6c4e('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x417907[_0x6c4e('0x1d')]?_0x417907[_0x6c4e('0x1d')]['where']||null:null,'attributes':_0x417907[_0x6c4e('0x1d')]?_0x417907[_0x6c4e('0x1d')][_0x6c4e('0x1f')]||null:null,'limit':_0x417907[_0x6c4e('0x1d')]?_0x417907[_0x6c4e('0x1d')]['limit']||null:null})['then'](function(_0x6ad98){logger[_0x6c4e('0x12')]('UpdateSmsInteraction',_0x417907);logger[_0x6c4e('0x15')](_0x6c4e('0x1b'),_0x417907,JSON[_0x6c4e('0x20')](_0x6ad98));_0x59e9d5(_0x6ad98);})[_0x6c4e('0x1a')](function(_0x100b07){logger[_0x6c4e('0x17')](_0x6c4e('0x1b'),_0x100b07[_0x6c4e('0x19')],_0x417907);_0x317414(_0x152ac9[_0x6c4e('0x17')](0x1f4,_0x100b07['message']));});});};exports[_0x6c4e('0x21')]=function(_0x5578ce){return new Promise(function(_0x19b36b,_0x52e26b){return db['SmsInteraction'][_0x6c4e('0x22')]({'where':_0x5578ce[_0x6c4e('0x1d')]?_0x5578ce[_0x6c4e('0x1d')]['where']||null:null})[_0x6c4e('0x11')](function(_0x13d2c6){if(_0x13d2c6){return _0x13d2c6[_0x6c4e('0x23')](_0x5578ce[_0x6c4e('0x24')][_0x6c4e('0x25')],_[_0x6c4e('0x26')](_0x5578ce['body'],['ids','id'])||{});}})[_0x6c4e('0x27')](function(_0x37186e){logger[_0x6c4e('0x12')](_0x6c4e('0x28'),_0x5578ce);logger['debug'](_0x6c4e('0x28'),_0x5578ce,JSON[_0x6c4e('0x20')](_0x37186e));_0x19b36b(_0x37186e);})['catch'](function(_0xb3da39){logger[_0x6c4e('0x17')](_0x6c4e('0x28'),_0xb3da39[_0x6c4e('0x19')],_0x5578ce);_0x52e26b(_this[_0x6c4e('0x17')](0x1f4,_0xb3da39[_0x6c4e('0x19')]));});});};
\ No newline at end of file
+var _0x76d8=['defaults','localhost','socket.io-emitter','./smsInteraction.socket','request','then','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','SmsInteraction,\x20%s,\x20%s','message','result','UpdateSmsInteraction','SmsInteraction','update','options','where','attributes','limit','stringify','catch','AddTagsToSmsInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis'];(function(_0x17e613,_0x1ad3f6){var _0x49492b=function(_0x32de20){while(--_0x32de20){_0x17e613['push'](_0x17e613['shift']());}};_0x49492b(++_0x1ad3f6);}(_0x76d8,0xcb));var _0x876d=function(_0x6df38b,_0x3f7015){_0x6df38b=_0x6df38b-0x0;var _0xb367b9=_0x76d8[_0x6df38b];return _0xb367b9;};'use strict';var _=require(_0x876d('0x0'));var util=require(_0x876d('0x1'));var moment=require(_0x876d('0x2'));var BPromise=require(_0x876d('0x3'));var rs=require(_0x876d('0x4'));var fs=require('fs');var Redis=require(_0x876d('0x5'));var db=require(_0x876d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x876d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x876d('0x8'));var client=jayson[_0x876d('0x9')][_0x876d('0xa')]({'port':0x232a});config[_0x876d('0xb')]=_[_0x876d('0xc')](config[_0x876d('0xb')],{'host':_0x876d('0xd'),'port':0x18eb});var socket=require(_0x876d('0xe'))(new Redis(config['redis']));require(_0x876d('0xf'))['register'](socket);function respondWithRpcPromise(_0x4d10f9,_0x3b4a6c,_0x2387af){return new BPromise(function(_0x496f2d,_0xd61c16){return client[_0x876d('0x10')](_0x4d10f9,_0x2387af)[_0x876d('0x11')](function(_0x35de48){logger[_0x876d('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x3b4a6c,_0x876d('0x13'));logger[_0x876d('0x14')](_0x876d('0x15'),_0x3b4a6c,_0x876d('0x13'),JSON['stringify'](_0x35de48));if(_0x35de48[_0x876d('0x16')]){if(_0x35de48[_0x876d('0x16')]['code']===0x1f4){logger[_0x876d('0x16')](_0x876d('0x17'),_0x3b4a6c,_0x35de48[_0x876d('0x16')][_0x876d('0x18')]);return _0xd61c16(_0x35de48['error'][_0x876d('0x18')]);}logger[_0x876d('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x3b4a6c,_0x35de48['error'][_0x876d('0x18')]);return _0x496f2d(_0x35de48[_0x876d('0x16')][_0x876d('0x18')]);}else{logger[_0x876d('0x12')](_0x876d('0x17'),_0x3b4a6c,_0x876d('0x13'));_0x496f2d(_0x35de48[_0x876d('0x19')][_0x876d('0x18')]);}})['catch'](function(_0x6b256e){logger[_0x876d('0x16')](_0x876d('0x17'),_0x3b4a6c,_0x6b256e);_0xd61c16(_0x6b256e);});});}exports[_0x876d('0x1a')]=function(_0x2db3be){var _0x21085c=this;return new Promise(function(_0x5327fd,_0x3bb00e){return db[_0x876d('0x1b')][_0x876d('0x1c')](_0x2db3be['body'],{'raw':_0x2db3be['options']?_0x2db3be[_0x876d('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2db3be[_0x876d('0x1d')]?_0x2db3be['options'][_0x876d('0x1e')]||null:null,'attributes':_0x2db3be['options']?_0x2db3be[_0x876d('0x1d')][_0x876d('0x1f')]||null:null,'limit':_0x2db3be[_0x876d('0x1d')]?_0x2db3be[_0x876d('0x1d')][_0x876d('0x20')]||null:null})[_0x876d('0x11')](function(_0x269853){logger[_0x876d('0x12')]('UpdateSmsInteraction',_0x2db3be);logger[_0x876d('0x14')]('UpdateSmsInteraction',_0x2db3be,JSON[_0x876d('0x21')](_0x269853));_0x5327fd(_0x269853);})[_0x876d('0x22')](function(_0x5a7673){logger['error'](_0x876d('0x1a'),_0x5a7673[_0x876d('0x18')],_0x2db3be);_0x3bb00e(_0x21085c['error'](0x1f4,_0x5a7673[_0x876d('0x18')]));});});};exports[_0x876d('0x23')]=function(_0x115dce){return new Promise(function(_0x32ece6,_0x437940){return db[_0x876d('0x1b')][_0x876d('0x24')]({'where':_0x115dce[_0x876d('0x1d')]?_0x115dce[_0x876d('0x1d')][_0x876d('0x1e')]||null:null})[_0x876d('0x11')](function(_0x48f0c7){if(_0x48f0c7){return _0x48f0c7[_0x876d('0x25')](_0x115dce[_0x876d('0x26')][_0x876d('0x27')],_[_0x876d('0x28')](_0x115dce['body'],[_0x876d('0x27'),'id'])||{});}})[_0x876d('0x29')](function(_0x57624c){logger[_0x876d('0x12')]('AddTags',_0x115dce);logger['debug']('AddTags',_0x115dce,JSON['stringify'](_0x57624c));_0x32ece6(_0x57624c);})['catch'](function(_0x290cc8){logger['error'](_0x876d('0x2a'),_0x290cc8[_0x876d('0x18')],_0x115dce);_0x437940(_this[_0x876d('0x16')](0x1f4,_0x290cc8[_0x876d('0x18')]));});});};
\ No newline at end of file
index 28d0186..c65a562 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x02f2=['emit','register','length','smsInteraction:','./smsInteraction.events','save','update'];(function(_0x505820,_0x922251){var _0xe713c3=function(_0x5424ea){while(--_0x5424ea){_0x505820['push'](_0x505820['shift']());}};_0xe713c3(++_0x922251);}(_0x02f2,0x193));var _0x202f=function(_0x4a3ac5,_0x39816a){_0x4a3ac5=_0x4a3ac5-0x0;var _0x923f66=_0x02f2[_0x4a3ac5];return _0x923f66;};'use strict';var SmsInteractionEvents=require(_0x202f('0x0'));var events=[_0x202f('0x1'),'remove',_0x202f('0x2')];function createListener(_0x4db9ca,_0x3af23){return function(_0x450ebf){_0x3af23[_0x202f('0x3')](_0x4db9ca,_0x450ebf);};}function removeListener(_0x2d72e5,_0x1c6a01){return function(){SmsInteractionEvents['removeListener'](_0x2d72e5,_0x1c6a01);};}exports[_0x202f('0x4')]=function(_0x15f40a){for(var _0x3c5885=0x0,_0x57f63d=events[_0x202f('0x5')];_0x3c5885<_0x57f63d;_0x3c5885++){var _0x306d82=events[_0x3c5885];var _0x20eb11=createListener(_0x202f('0x6')+_0x306d82,_0x15f40a);SmsInteractionEvents['on'](_0x306d82,_0x20eb11);}};
\ No newline at end of file
+var _0x24e3=['save','update','emit','removeListener','register','length','smsInteraction:'];(function(_0x5abe66,_0x34c587){var _0x22b8ce=function(_0x1c74df){while(--_0x1c74df){_0x5abe66['push'](_0x5abe66['shift']());}};_0x22b8ce(++_0x34c587);}(_0x24e3,0x1a4));var _0x324e=function(_0xa46421,_0x127548){_0xa46421=_0xa46421-0x0;var _0x4bf651=_0x24e3[_0xa46421];return _0x4bf651;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x324e('0x0'),'remove',_0x324e('0x1')];function createListener(_0x3ab6e1,_0x24d6f3){return function(_0x1c63a4){_0x24d6f3[_0x324e('0x2')](_0x3ab6e1,_0x1c63a4);};}function removeListener(_0x227d4f,_0x7563f0){return function(){SmsInteractionEvents[_0x324e('0x3')](_0x227d4f,_0x7563f0);};}exports[_0x324e('0x4')]=function(_0x5cae2d){for(var _0x351558=0x0,_0x36599b=events[_0x324e('0x5')];_0x351558<_0x36599b;_0x351558++){var _0x34e4e0=events[_0x351558];var _0x304a58=createListener(_0x324e('0x6')+_0x34e4e0,_0x5cae2d);SmsInteractionEvents['on'](_0x34e4e0,_0x304a58);}};
\ No newline at end of file
index ecae57a..7290c65 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf544=['accept','/:id/reject','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','/describe','isAuthenticated','describe','/:id','show','post','tracked','sms','smsmessage:create','/:id/status','status','put','update'];(function(_0x45dd25,_0x21df70){var _0x3ae21c=function(_0x1ec41f){while(--_0x1ec41f){_0x45dd25['push'](_0x45dd25['shift']());}};_0x3ae21c(++_0x21df70);}(_0xf544,0x99));var _0x4f54=function(_0xb3b452,_0x582e8e){_0xb3b452=_0xb3b452-0x0;var _0x238983=_0xf544[_0xb3b452];return _0x238983;};'use strict';var multer=require(_0x4f54('0x0'));var util=require('util');var path=require(_0x4f54('0x1'));var timeout=require(_0x4f54('0x2'));var express=require(_0x4f54('0x3'));var router=express['Router']();var auth=require(_0x4f54('0x4'));var interaction=require(_0x4f54('0x5'));var config=require(_0x4f54('0x6'));var controller=require(_0x4f54('0x7'));router[_0x4f54('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4f54('0x8')](_0x4f54('0x9'),auth[_0x4f54('0xa')](),controller[_0x4f54('0xb')]);router[_0x4f54('0x8')](_0x4f54('0xc'),auth[_0x4f54('0xa')](),controller[_0x4f54('0xd')]);router[_0x4f54('0xe')]('/',auth[_0x4f54('0xa')](),interaction[_0x4f54('0xf')](_0x4f54('0x10'),_0x4f54('0x11')),controller['create']);router[_0x4f54('0xe')](_0x4f54('0x12'),controller[_0x4f54('0x13')]);router[_0x4f54('0x14')](_0x4f54('0xc'),auth[_0x4f54('0xa')](),controller[_0x4f54('0x15')]);router[_0x4f54('0x14')]('/:id/accept',auth['isAuthenticated'](),controller[_0x4f54('0x16')]);router[_0x4f54('0x14')](_0x4f54('0x17'),auth[_0x4f54('0xa')](),controller['reject']);router['delete'](_0x4f54('0xc'),auth[_0x4f54('0xa')](),controller['destroy']);module[_0x4f54('0x18')]=router;
\ No newline at end of file
+var _0xe88b=['smsmessage:create','create','post','/:id/status','put','/:id/accept','/:id/reject','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index','/describe','/:id','tracked','sms'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xe88b,0x195));var _0xbe88=function(_0x10852d,_0x4cdcc6){_0x10852d=_0x10852d-0x0;var _0x13a8d6=_0xe88b[_0x10852d];return _0x13a8d6;};'use strict';var multer=require('multer');var util=require(_0xbe88('0x0'));var path=require(_0xbe88('0x1'));var timeout=require(_0xbe88('0x2'));var express=require(_0xbe88('0x3'));var router=express[_0xbe88('0x4')]();var auth=require(_0xbe88('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsMessage.controller');router[_0xbe88('0x6')]('/',auth[_0xbe88('0x7')](),controller[_0xbe88('0x8')]);router[_0xbe88('0x6')](_0xbe88('0x9'),auth[_0xbe88('0x7')](),controller['describe']);router['get'](_0xbe88('0xa'),auth[_0xbe88('0x7')](),controller['show']);router['post']('/',auth[_0xbe88('0x7')](),interaction[_0xbe88('0xb')](_0xbe88('0xc'),_0xbe88('0xd')),controller[_0xbe88('0xe')]);router[_0xbe88('0xf')](_0xbe88('0x10'),controller['status']);router[_0xbe88('0x11')]('/:id',auth[_0xbe88('0x7')](),controller['update']);router['put'](_0xbe88('0x12'),auth[_0xbe88('0x7')](),controller['accept']);router[_0xbe88('0x11')](_0xbe88('0x13'),auth[_0xbe88('0x7')](),controller['reject']);router[_0xbe88('0x14')](_0xbe88('0xa'),auth[_0xbe88('0x7')](),controller[_0xbe88('0x15')]);module['exports']=router;
\ No newline at end of file
index dc69646..2fb9aea 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6379=['exports','TEXT','medium','BOOLEAN','out','DATE','sequelize'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x6379,0x84));var _0x9637=function(_0x34ea22,_0x1270b3){_0x34ea22=_0x34ea22-0x0;var _0x1ca470=_0x6379[_0x34ea22];return _0x1ca470;};'use strict';var Sequelize=require(_0x9637('0x0'));module[_0x9637('0x1')]={'body':{'type':Sequelize[_0x9637('0x2')](_0x9637('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9637('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x9637('0x5')),'defaultValue':_0x9637('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x9637('0x6')]},'secret':{'type':Sequelize[_0x9637('0x4')],'defaultValue':![]}};
\ No newline at end of file
+var _0xecb2=['sequelize','medium','out','STRING','DATE','BOOLEAN'];(function(_0x4712d4,_0x230548){var _0x17e597=function(_0x3dc648){while(--_0x3dc648){_0x4712d4['push'](_0x4712d4['shift']());}};_0x17e597(++_0x230548);}(_0xecb2,0xf6));var _0x2ecb=function(_0x377b00,_0x49e0d1){_0x377b00=_0x377b00-0x0;var _0x1410c0=_0xecb2[_0x377b00];return _0x1410c0;};'use strict';var Sequelize=require(_0x2ecb('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x2ecb('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x2ecb('0x2')),'defaultValue':_0x2ecb('0x2'),'allowNull':![]},'messageId':{'type':Sequelize[_0x2ecb('0x3')](0xbe)},'phone':{'type':Sequelize[_0x2ecb('0x3')]},'readAt':{'type':Sequelize[_0x2ecb('0x4')]},'secret':{'type':Sequelize[_0x2ecb('0x5')],'defaultValue':![]}};
\ No newline at end of file
index 2c0415a..9b3df9a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5496=['SmsMessage','rawAttributes','model','keys','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','options','count','includeAll','include','rows','show','params','fields','find','create','body','destroy','describe','../../config/logger','sms-interactions','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','manual','interface','channel','event','accept','EventManager','acceptmessage','reject','agent','RejectMessage','rejectMessage','SIP/%s','rejectmessage','SmsAccount','SmsAccountId','debug','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','inspect','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','SmsAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','stack','name','send','index'];(function(_0x18f152,_0x41585a){var _0xa10b34=function(_0x1e9798){while(--_0x1e9798){_0x18f152['push'](_0x18f152['shift']());}};_0xa10b34(++_0x41585a);}(_0x5496,0x175));var _0x6549=function(_0xf560c1,_0x104704){_0xf560c1=_0xf560c1-0x0;var _0x5501b4=_0x5496[_0xf560c1];return _0x5501b4;};'use strict';var pdf=require(_0x6549('0x0'));var emlformat=require(_0x6549('0x1'));var rimraf=require(_0x6549('0x2'));var zipdir=require(_0x6549('0x3'));var jsonpatch=require(_0x6549('0x4'));var rp=require('request-promise');var moment=require(_0x6549('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6549('0x6'));var util=require(_0x6549('0x7'));var path=require(_0x6549('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6549('0x9'));var fs=require('fs');var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var authService=require(_0x6549('0x10'));var hardwareService=require(_0x6549('0x11'));var Redis=require(_0x6549('0x12'));var qs=require(_0x6549('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x6549('0x14'));var config=require(_0x6549('0x15'));var db=require(_0x6549('0x16'))['db'];config[_0x6549('0x17')]=_[_0x6549('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6549('0x19'))(new Redis(config[_0x6549('0x17')]));require('./smsMessage.socket')[_0x6549('0x1a')](socket);var jayson=require(_0x6549('0x1b'));var client=jayson[_0x6549('0x1c')][_0x6549('0x1d')]({'port':0x232c});var client9002=jayson[_0x6549('0x1c')][_0x6549('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x55c112,_0x5db86d,_0x384f75,_0x25da29){return new BPromise(function(_0x47a81a,_0x238a04){var _0x67acc0=_0x25da29||client;return _0x67acc0[_0x6549('0x1e')](_0x55c112,_0x384f75)[_0x6549('0x1f')](function(_0xffc8b9){logger['info']('SmsMessage,\x20%s,\x20%s',_0x5db86d,_0x6549('0x20'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5db86d,_0x6549('0x20'),JSON[_0x6549('0x21')](_0xffc8b9));if(_0xffc8b9[_0x6549('0x22')]){if(_0xffc8b9[_0x6549('0x22')][_0x6549('0x23')]===0x1f4){logger['error'](_0x6549('0x24'),_0x5db86d,_0xffc8b9['error'][_0x6549('0x25')]);return _0x238a04(_0xffc8b9[_0x6549('0x22')][_0x6549('0x25')]);}logger[_0x6549('0x22')](_0x6549('0x24'),_0x5db86d,_0xffc8b9[_0x6549('0x22')][_0x6549('0x25')]);return _0x47a81a(_0xffc8b9[_0x6549('0x22')][_0x6549('0x25')]);}else{logger[_0x6549('0x26')](_0x6549('0x24'),_0x5db86d,_0x6549('0x20'));_0x47a81a(_0xffc8b9[_0x6549('0x27')]['message']);}})[_0x6549('0x28')](function(_0x1bc8db){logger['error'](_0x6549('0x24'),_0x5db86d,_0x1bc8db);_0x238a04(_0x1bc8db);});});}function respondWithStatusCode(_0x29f89e,_0x3768cb){_0x3768cb=_0x3768cb||0xcc;return function(_0x583c7d){if(_0x583c7d){return _0x29f89e[_0x6549('0x29')](_0x3768cb);}return _0x29f89e[_0x6549('0x2a')](_0x3768cb)[_0x6549('0x2b')]();};}function respondWithResult(_0x2900cd,_0x442862){_0x442862=_0x442862||0xc8;return function(_0x3edf02){if(_0x3edf02){return _0x2900cd[_0x6549('0x2a')](_0x442862)[_0x6549('0x2c')](_0x3edf02);}};}function respondWithFilteredResult(_0x4c52f1,_0x1794bc){return function(_0x136518){if(_0x136518){var _0x17fdfb=_0x136518['count'],_0x4c605c=_0x1794bc['offset'],_0x3f1502=_0x1794bc[_0x6549('0x2d')]+_0x1794bc[_0x6549('0x2e')],_0x4acaf5;if(_0x3f1502>=_0x17fdfb){_0x3f1502=_0x17fdfb;_0x4acaf5=0xc8;}else{_0x4acaf5=0xce;}_0x4c52f1['status'](_0x4acaf5);return _0x4c52f1[_0x6549('0x2f')](_0x6549('0x30'),_0x4c605c+'-'+_0x3f1502+'/'+_0x17fdfb)[_0x6549('0x2c')](_0x136518);}return null;};}function patchUpdates(_0x102a21){return function(_0x2aec2c){try{jsonpatch[_0x6549('0x31')](_0x2aec2c,_0x102a21,!![]);}catch(_0x464adf){return BPromise['reject'](_0x464adf);}return _0x2aec2c[_0x6549('0x32')]();};}function saveUpdates(_0x3ebea6,_0x2d52fe){return function(_0x33bf79){if(_0x33bf79){return _0x33bf79[_0x6549('0x33')](_0x3ebea6)[_0x6549('0x1f')](function(_0x564c46){return _0x564c46;});}return null;};}function removeEntity(_0x6b9840,_0x5bb783){return function(_0x302694){if(_0x302694){return _0x302694['destroy']()[_0x6549('0x1f')](function(){_0x6b9840[_0x6549('0x2a')](0xcc)[_0x6549('0x2b')]();});}};}function handleEntityNotFound(_0x589f70,_0x3855ab){return function(_0x2b065d){if(!_0x2b065d){_0x589f70[_0x6549('0x29')](0x194);}return _0x2b065d;};}function handleError(_0x3040e3,_0x5b8624){_0x5b8624=_0x5b8624||0x1f4;return function(_0x54f971){logger['error'](_0x54f971[_0x6549('0x34')]);if(_0x54f971[_0x6549('0x35')]){delete _0x54f971['name'];}_0x3040e3[_0x6549('0x2a')](_0x5b8624)[_0x6549('0x36')](_0x54f971);};}exports[_0x6549('0x37')]=function(_0xcf6db5,_0x3741f5){var _0x4d3050={},_0x499898={},_0x1fcacf={'count':0x0,'rows':[]};var _0x663fec=db[_0x6549('0x38')][_0x6549('0x39')];_0x499898[_0x6549('0x3a')]=_[_0x6549('0x3b')](_0x663fec);_0x499898[_0x6549('0x3c')]=_[_0x6549('0x3b')](_0xcf6db5[_0x6549('0x3c')]);_0x499898[_0x6549('0x3d')]=_['intersection'](_0x499898[_0x6549('0x3a')],_0x499898[_0x6549('0x3c')]);_0x4d3050[_0x6549('0x3e')]=_[_0x6549('0x3f')](_0x499898[_0x6549('0x3a')],qs['fields'](_0xcf6db5['query']['fields']));_0x4d3050[_0x6549('0x3e')]=_0x4d3050[_0x6549('0x3e')][_0x6549('0x40')]?_0x4d3050[_0x6549('0x3e')]:_0x499898['model'];if(!_0xcf6db5['query'][_0x6549('0x41')](_0x6549('0x42'))){_0x4d3050[_0x6549('0x2e')]=qs['limit'](_0xcf6db5[_0x6549('0x3c')]['limit']);_0x4d3050[_0x6549('0x2d')]=qs[_0x6549('0x2d')](_0xcf6db5[_0x6549('0x3c')][_0x6549('0x2d')]);}_0x4d3050[_0x6549('0x43')]=qs[_0x6549('0x44')](_0xcf6db5[_0x6549('0x3c')]['sort']);_0x4d3050[_0x6549('0x45')]=qs[_0x6549('0x3d')](_[_0x6549('0x46')](_0xcf6db5[_0x6549('0x3c')],_0x499898[_0x6549('0x3d')]));if(_0xcf6db5[_0x6549('0x3c')][_0x6549('0x47')]){_0x4d3050[_0x6549('0x45')]=_[_0x6549('0x48')](_0x4d3050[_0x6549('0x45')],{'$or':_[_0x6549('0x49')](_0x663fec,function(_0x3d9351){if(_0x3d9351[_0x6549('0x4a')][_0x6549('0x4b')]!==_0x6549('0x4c')){var _0x1bc338={};_0x1bc338[_0x3d9351['field']]={'$like':'%'+_0xcf6db5[_0x6549('0x3c')][_0x6549('0x47')]+'%'};return _0x1bc338;}})});}_0x4d3050=_[_0x6549('0x48')]({},_0x4d3050,_0xcf6db5[_0x6549('0x4d')]);var _0x52e819={'where':_0x4d3050[_0x6549('0x45')]};return db['SmsMessage'][_0x6549('0x4e')](_0x52e819)[_0x6549('0x1f')](function(_0x4c7ada){_0x1fcacf[_0x6549('0x4e')]=_0x4c7ada;if(_0xcf6db5[_0x6549('0x3c')][_0x6549('0x4f')]){_0x4d3050[_0x6549('0x50')]=[{'all':!![]}];}return db[_0x6549('0x38')]['findAll'](_0x4d3050);})['then'](function(_0xa2acf5){_0x1fcacf[_0x6549('0x51')]=_0xa2acf5;return _0x1fcacf;})[_0x6549('0x1f')](respondWithFilteredResult(_0x3741f5,_0x4d3050))[_0x6549('0x28')](handleError(_0x3741f5,null));};exports[_0x6549('0x52')]=function(_0x49a4d7,_0x22370d){var _0x17e691={'raw':!![],'where':{'id':_0x49a4d7[_0x6549('0x53')]['id']}},_0x1e4f4f={};_0x1e4f4f[_0x6549('0x3a')]=_[_0x6549('0x3b')](db[_0x6549('0x38')][_0x6549('0x39')]);_0x1e4f4f['query']=_[_0x6549('0x3b')](_0x49a4d7['query']);_0x1e4f4f[_0x6549('0x3d')]=_[_0x6549('0x3f')](_0x1e4f4f[_0x6549('0x3a')],_0x1e4f4f['query']);_0x17e691[_0x6549('0x3e')]=_[_0x6549('0x3f')](_0x1e4f4f[_0x6549('0x3a')],qs['fields'](_0x49a4d7[_0x6549('0x3c')][_0x6549('0x54')]));_0x17e691[_0x6549('0x3e')]=_0x17e691[_0x6549('0x3e')][_0x6549('0x40')]?_0x17e691[_0x6549('0x3e')]:_0x1e4f4f['model'];if(_0x49a4d7[_0x6549('0x3c')]['includeAll']){_0x17e691[_0x6549('0x50')]=[{'all':!![]}];}_0x17e691=_[_0x6549('0x48')]({},_0x17e691,_0x49a4d7[_0x6549('0x4d')]);return db[_0x6549('0x38')][_0x6549('0x55')](_0x17e691)[_0x6549('0x1f')](handleEntityNotFound(_0x22370d,null))[_0x6549('0x1f')](respondWithResult(_0x22370d,null))[_0x6549('0x28')](handleError(_0x22370d,null));};exports[_0x6549('0x56')]=function(_0x105e0c,_0x3b7f1a){return db[_0x6549('0x38')]['create'](_0x105e0c[_0x6549('0x57')],{})[_0x6549('0x1f')](respondWithResult(_0x3b7f1a,0xc9))[_0x6549('0x28')](handleError(_0x3b7f1a,null));};exports[_0x6549('0x33')]=function(_0x260097,_0x1ffa23){if(_0x260097[_0x6549('0x57')]['id']){delete _0x260097[_0x6549('0x57')]['id'];}return db['SmsMessage'][_0x6549('0x55')]({'where':{'id':_0x260097[_0x6549('0x53')]['id']}})[_0x6549('0x1f')](handleEntityNotFound(_0x1ffa23,null))[_0x6549('0x1f')](saveUpdates(_0x260097[_0x6549('0x57')],null))[_0x6549('0x1f')](respondWithResult(_0x1ffa23,null))[_0x6549('0x28')](handleError(_0x1ffa23,null));};exports[_0x6549('0x58')]=function(_0x48eff0,_0x201554){return db[_0x6549('0x38')][_0x6549('0x55')]({'where':{'id':_0x48eff0[_0x6549('0x53')]['id']}})[_0x6549('0x1f')](handleEntityNotFound(_0x201554,null))[_0x6549('0x1f')](removeEntity(_0x201554,null))['catch'](handleError(_0x201554,null));};exports[_0x6549('0x59')]=function(_0xe0a696,_0x4bf996){return db[_0x6549('0x38')][_0x6549('0x59')]()[_0x6549('0x1f')](respondWithResult(_0x4bf996,null))['catch'](handleError(_0x4bf996,null));};var interaction_log=require(_0x6549('0x5a'))(_0x6549('0x5b'));exports['accept']=function(_0x407bb8,_0x509f69,_0x3dc12c){var _0x522cd3={'channel':_0x6549('0x5c')};if(_0x407bb8[_0x6549('0x57')]['id']){delete _0x407bb8[_0x6549('0x57')]['id'];}_0x407bb8[_0x6549('0x57')][_0x6549('0x5d')]=!![];_0x407bb8[_0x6549('0x57')][_0x6549('0x5e')]=moment()[_0x6549('0x5f')](_0x6549('0x60'));_0x407bb8[_0x6549('0x57')][_0x6549('0x61')]=_0x407bb8[_0x6549('0x57')][_0x6549('0x61')]||_0x407bb8[_0x6549('0x62')]['id'];return db['SmsMessage'][_0x6549('0x55')]({'where':{'id':_0x407bb8[_0x6549('0x53')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x6549('0x63')}]})[_0x6549('0x1f')](handleEntityNotFound(_0x509f69,null))[_0x6549('0x1f')](saveUpdates(_0x407bb8[_0x6549('0x57')],null))['then'](function(_0x6ff64d){if(_0x6ff64d){_0x522cd3[_0x6549('0x25')]=_0x6ff64d[_0x6549('0x64')]({'plain':!![]});return db[_0x6549('0x65')]['find']({'where':{'id':_0x6ff64d[_0x6549('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x509f69,null))[_0x6549('0x1f')](function(_0x16dc29){if(_0x16dc29){return _0x16dc29[_0x6549('0x33')]({'UserId':_0x407bb8[_0x6549('0x57')][_0x6549('0x61')],'read1stAt':_[_0x6549('0x67')](_0x16dc29[_0x6549('0x68')])?moment()[_0x6549('0x5f')](_0x6549('0x60')):undefined});}return null;})[_0x6549('0x1f')](function(_0x49427f){if(_0x49427f){_0x522cd3[_0x6549('0x69')]=_0x49427f[_0x6549('0x64')]({'plain':!![]});interaction_log[_0x6549('0x26')](_0x6549('0x6a'),_0x407bb8[_0x6549('0x62')]['id'],_0x407bb8[_0x6549('0x62')]['name'],_0x407bb8['user'][_0x6549('0x6b')],_0x522cd3[_0x6549('0x69')]['id'],_0x407bb8[_0x6549('0x57')]?JSON['stringify'](_0x407bb8[_0x6549('0x57')]):_0x6549('0x6c'));return respondWithRpcPromise('AcceptMessage',_0x6549('0x6d'),_0x522cd3);}return null;})[_0x6549('0x1f')](function(_0x46026b){if(_0x46026b){if(_0x407bb8[_0x6549('0x57')][_0x6549('0x6e')]){_0x522cd3[_0x6549('0x25')][_0x6549('0x6f')]=util[_0x6549('0x5f')]('SIP/%s',_0x407bb8[_0x6549('0x62')]['name']);_0x522cd3[_0x6549('0x25')][_0x6549('0x70')]=_0x522cd3['channel'];_0x522cd3[_0x6549('0x25')][_0x6549('0x71')]=_0x6549('0x72');return respondWithRpcPromise('EventManager',_0x6549('0x73'),{'event':_0x6549('0x74'),'message':_0x522cd3[_0x6549('0x25')]},client9002)[_0x6549('0x1f')](function(){return _0x522cd3;});}return _0x522cd3;}return null;})[_0x6549('0x1f')](respondWithResult(_0x509f69,null))[_0x6549('0x28')](handleError(_0x509f69,null));};var interaction_log=require('../../config/logger')(_0x6549('0x5b'));exports[_0x6549('0x75')]=function(_0x1f022d,_0x5a996c,_0x5a860f){var _0x4bcd01={'agent':{},'channel':_0x6549('0x5c')};if(_0x1f022d[_0x6549('0x57')]['id']){delete _0x1f022d[_0x6549('0x57')]['id'];}_0x1f022d['body']['UserId']=_0x1f022d[_0x6549('0x57')]['UserId']||_0x1f022d[_0x6549('0x62')]['id'];_0x4bcd01[_0x6549('0x76')]['id']=_0x1f022d[_0x6549('0x57')][_0x6549('0x61')];return db[_0x6549('0x38')][_0x6549('0x55')]({'where':{'id':_0x1f022d[_0x6549('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5a996c,null))[_0x6549('0x1f')](function(_0x38b330){if(_0x38b330){_0x4bcd01[_0x6549('0x25')]=_0x38b330['get']({'plain':!![]});return db[_0x6549('0x65')][_0x6549('0x55')]({'where':{'id':_0x38b330[_0x6549('0x66')]}});}return null;})[_0x6549('0x1f')](handleEntityNotFound(_0x5a996c,null))[_0x6549('0x1f')](function(_0xf6b6da){if(_0xf6b6da){_0x4bcd01[_0x6549('0x69')]=_0xf6b6da['get']({'plain':!![]});interaction_log[_0x6549('0x26')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1f022d[_0x6549('0x62')]['id'],_0x1f022d[_0x6549('0x62')][_0x6549('0x35')],_0x1f022d[_0x6549('0x62')][_0x6549('0x6b')],_0x4bcd01[_0x6549('0x69')]['id'],_0x1f022d[_0x6549('0x57')]?JSON[_0x6549('0x21')](_0x1f022d['body']):_0x6549('0x6c'));return respondWithRpcPromise(_0x6549('0x77'),_0x6549('0x78'),_0x4bcd01);}return null;})[_0x6549('0x1f')](function(_0x1fa3a4){if(_0x1fa3a4){_0x1fa3a4[_0x6549('0x25')][_0x6549('0x6f')]=util[_0x6549('0x5f')](_0x6549('0x79'),_0x1f022d[_0x6549('0x62')]['name']);_0x1fa3a4[_0x6549('0x25')][_0x6549('0x70')]=_0x4bcd01[_0x6549('0x70')];_0x1fa3a4[_0x6549('0x25')][_0x6549('0x71')]=_0x6549('0x75');respondWithRpcPromise(_0x6549('0x73'),_0x6549('0x73'),{'event':_0x6549('0x7a'),'message':_0x1fa3a4[_0x6549('0x25')]},client9002);return _0x4bcd01;}return null;})[_0x6549('0x1f')](respondWithResult(_0x5a996c,null))[_0x6549('0x28')](handleError(_0x5a996c,null));};exports[_0x6549('0x2a')]=function(_0x44f005,_0x1495be,_0x14fb53){if(_0x44f005[_0x6549('0x57')]['id']){delete _0x44f005[_0x6549('0x57')]['id'];}var _0x4b1652;return db[_0x6549('0x38')][_0x6549('0x55')]({'where':{'id':_0x44f005[_0x6549('0x53')]['id']}})[_0x6549('0x1f')](handleEntityNotFound(_0x1495be,null))[_0x6549('0x1f')](function(_0xfde69e){if(_0xfde69e){_0x4b1652=_0xfde69e;return db[_0x6549('0x7b')][_0x6549('0x55')]({'where':{'id':_0xfde69e[_0x6549('0x7c')]}});}})[_0x6549('0x1f')](handleEntityNotFound(_0x1495be,null))[_0x6549('0x1f')](function(_0x1da2d7){if(_0x1da2d7){logger[_0x6549('0x7d')](_0x6549('0x7e'),_0x6549('0x2a'),_0x6549('0x7f'),_0x1da2d7[_0x6549('0x4a')],util['inspect'](_0x44f005[_0x6549('0x57')],{'showHidden':![],'depth':null}));switch(_0x1da2d7[_0x6549('0x4a')]){case _0x6549('0x80'):if(_0x44f005[_0x6549('0x57')][_0x6549('0x81')]&&_0x44f005[_0x6549('0x57')][_0x6549('0x81')]===_0x4b1652['messageId']){return _0x4b1652[_0x6549('0x33')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6549('0x2a'),'twilio',util[_0x6549('0x82')](_0x44f005[_0x6549('0x57')],{'showHidden':![],'depth':null}));}break;case _0x6549('0x83'):if(_0x44f005[_0x6549('0x57')][_0x6549('0x84')]&&_0x44f005['body'][_0x6549('0x84')]===_0x4b1652['messageId']&&_[_0x6549('0x85')]([_0x6549('0x86'),_0x6549('0x87')],_0x44f005['body'][_0x6549('0x88')])>=0x0){return _0x4b1652[_0x6549('0x33')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6549('0x2a'),_0x6549('0x89'),util[_0x6549('0x82')](_0x44f005[_0x6549('0x57')],{'showHidden':![],'depth':null}));}break;case _0x6549('0x8a'):var _0x1f5263=_0x44f005[_0x6549('0x57')][_0x6549('0x8b')][0x0];if(_0x1f5263[_0x6549('0x2a')][_0x6549('0x8c')]===_0x6549('0x8d')){return _0x4b1652[_0x6549('0x33')]({'read':!![]});}else{logger[_0x6549('0x22')](_0x6549('0x8e'),_0x6549('0x2a'),_0x6549('0x8a'),util[_0x6549('0x82')](_0x44f005[_0x6549('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x4b1652;}})[_0x6549('0x1f')](respondWithResult(_0x1495be,null))['catch'](handleError(_0x1495be,null));};
\ No newline at end of file
+var _0xf61e=['desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','reject','update','destroy','stack','name','send','index','rawAttributes','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','map','type','key','field','options','SmsMessage','includeAll','include','findAll','rows','show','params','find','create','body','describe','sms-interactions','accept','sms','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','SmsAccount','SmsAccountId','inspect','MessageSid','messageId','twilio','plivo','MessageUUID','indexOf','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','DELIVERED','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce'];(function(_0x529059,_0x294a33){var _0x156bc2=function(_0x9bc770){while(--_0x9bc770){_0x529059['push'](_0x529059['shift']());}};_0x156bc2(++_0x294a33);}(_0xf61e,0x191));var _0xef61=function(_0x58b393,_0xdbd98c){_0x58b393=_0x58b393-0x0;var _0x3f4e6a=_0xf61e[_0x58b393];return _0x3f4e6a;};'use strict';var pdf=require(_0xef61('0x0'));var emlformat=require(_0xef61('0x1'));var rimraf=require(_0xef61('0x2'));var zipdir=require(_0xef61('0x3'));var jsonpatch=require(_0xef61('0x4'));var rp=require(_0xef61('0x5'));var moment=require(_0xef61('0x6'));var BPromise=require(_0xef61('0x7'));var Mustache=require(_0xef61('0x8'));var util=require(_0xef61('0x9'));var path=require(_0xef61('0xa'));var sox=require(_0xef61('0xb'));var csv=require('to-csv');var ejs=require(_0xef61('0xc'));var fs=require('fs');var _=require(_0xef61('0xd'));var squel=require('squel');var crypto=require(_0xef61('0xe'));var jsforce=require(_0xef61('0xf'));var deskjs=require(_0xef61('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef61('0x11'));var authService=require(_0xef61('0x12'));var hardwareService=require(_0xef61('0x13'));var Redis=require(_0xef61('0x14'));var qs=require(_0xef61('0x15'));var logger=require(_0xef61('0x16'))(_0xef61('0x17'));var utils=require(_0xef61('0x18'));var config=require(_0xef61('0x19'));var db=require(_0xef61('0x1a'))['db'];config[_0xef61('0x1b')]=_[_0xef61('0x1c')](config[_0xef61('0x1b')],{'host':_0xef61('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xef61('0x1b')]));require('./smsMessage.socket')[_0xef61('0x1e')](socket);var jayson=require(_0xef61('0x1f'));var client=jayson[_0xef61('0x20')][_0xef61('0x21')]({'port':0x232c});var client9002=jayson['client'][_0xef61('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x435beb,_0x1224c2,_0x78ff22,_0x588a61){return new BPromise(function(_0x66fa62,_0xbe23a7){var _0x4f7a62=_0x588a61||client;return _0x4f7a62[_0xef61('0x22')](_0x435beb,_0x78ff22)[_0xef61('0x23')](function(_0x36f558){logger[_0xef61('0x24')](_0xef61('0x25'),_0x1224c2,_0xef61('0x26'));logger[_0xef61('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1224c2,_0xef61('0x26'),JSON[_0xef61('0x28')](_0x36f558));if(_0x36f558['error']){if(_0x36f558[_0xef61('0x29')][_0xef61('0x2a')]===0x1f4){logger[_0xef61('0x29')](_0xef61('0x25'),_0x1224c2,_0x36f558[_0xef61('0x29')][_0xef61('0x2b')]);return _0xbe23a7(_0x36f558[_0xef61('0x29')]['message']);}logger['error'](_0xef61('0x25'),_0x1224c2,_0x36f558['error'][_0xef61('0x2b')]);return _0x66fa62(_0x36f558['error']['message']);}else{logger[_0xef61('0x24')]('SmsMessage,\x20%s,\x20%s',_0x1224c2,'request\x20sent');_0x66fa62(_0x36f558[_0xef61('0x2c')][_0xef61('0x2b')]);}})[_0xef61('0x2d')](function(_0x111bac){logger['error'](_0xef61('0x25'),_0x1224c2,_0x111bac);_0xbe23a7(_0x111bac);});});}function respondWithStatusCode(_0x4e738f,_0x2a6832){_0x2a6832=_0x2a6832||0xcc;return function(_0xb00f83){if(_0xb00f83){return _0x4e738f[_0xef61('0x2e')](_0x2a6832);}return _0x4e738f[_0xef61('0x2f')](_0x2a6832)[_0xef61('0x30')]();};}function respondWithResult(_0x45ece2,_0x258b5a){_0x258b5a=_0x258b5a||0xc8;return function(_0x23837f){if(_0x23837f){return _0x45ece2[_0xef61('0x2f')](_0x258b5a)[_0xef61('0x31')](_0x23837f);}};}function respondWithFilteredResult(_0x3a16ba,_0x18426f){return function(_0xeb9a62){if(_0xeb9a62){var _0x63edd4=_0xeb9a62[_0xef61('0x32')],_0x1f3572=_0x18426f[_0xef61('0x33')],_0x85978=_0x18426f[_0xef61('0x33')]+_0x18426f[_0xef61('0x34')],_0x39c15e;if(_0x85978>=_0x63edd4){_0x85978=_0x63edd4;_0x39c15e=0xc8;}else{_0x39c15e=0xce;}_0x3a16ba[_0xef61('0x2f')](_0x39c15e);return _0x3a16ba['set']('Content-Range',_0x1f3572+'-'+_0x85978+'/'+_0x63edd4)[_0xef61('0x31')](_0xeb9a62);}return null;};}function patchUpdates(_0x36713e){return function(_0x122176){try{jsonpatch['apply'](_0x122176,_0x36713e,!![]);}catch(_0x2bd5b3){return BPromise[_0xef61('0x35')](_0x2bd5b3);}return _0x122176['save']();};}function saveUpdates(_0x474120,_0x5d77f9){return function(_0x4c7fd3){if(_0x4c7fd3){return _0x4c7fd3[_0xef61('0x36')](_0x474120)['then'](function(_0x8ed629){return _0x8ed629;});}return null;};}function removeEntity(_0x5ee9e4,_0x41d9e9){return function(_0x4155a0){if(_0x4155a0){return _0x4155a0[_0xef61('0x37')]()[_0xef61('0x23')](function(){_0x5ee9e4[_0xef61('0x2f')](0xcc)[_0xef61('0x30')]();});}};}function handleEntityNotFound(_0xf8cca2,_0x232cd8){return function(_0x1c622c){if(!_0x1c622c){_0xf8cca2[_0xef61('0x2e')](0x194);}return _0x1c622c;};}function handleError(_0x5f15ef,_0x569db6){_0x569db6=_0x569db6||0x1f4;return function(_0x4ce644){logger[_0xef61('0x29')](_0x4ce644[_0xef61('0x38')]);if(_0x4ce644[_0xef61('0x39')]){delete _0x4ce644['name'];}_0x5f15ef[_0xef61('0x2f')](_0x569db6)[_0xef61('0x3a')](_0x4ce644);};}exports[_0xef61('0x3b')]=function(_0x53bdb9,_0x59b97b){var _0x509cbc={},_0x1bd9af={},_0x595a5a={'count':0x0,'rows':[]};var _0x560d87=db['SmsMessage'][_0xef61('0x3c')];_0x1bd9af[_0xef61('0x3d')]=_[_0xef61('0x3e')](_0x560d87);_0x1bd9af['query']=_['keys'](_0x53bdb9['query']);_0x1bd9af[_0xef61('0x3f')]=_[_0xef61('0x40')](_0x1bd9af['model'],_0x1bd9af[_0xef61('0x41')]);_0x509cbc[_0xef61('0x42')]=_[_0xef61('0x40')](_0x1bd9af[_0xef61('0x3d')],qs['fields'](_0x53bdb9[_0xef61('0x41')][_0xef61('0x43')]));_0x509cbc[_0xef61('0x42')]=_0x509cbc[_0xef61('0x42')]['length']?_0x509cbc['attributes']:_0x1bd9af[_0xef61('0x3d')];if(!_0x53bdb9[_0xef61('0x41')][_0xef61('0x44')]('nolimit')){_0x509cbc[_0xef61('0x34')]=qs[_0xef61('0x34')](_0x53bdb9[_0xef61('0x41')][_0xef61('0x34')]);_0x509cbc['offset']=qs['offset'](_0x53bdb9['query'][_0xef61('0x33')]);}_0x509cbc[_0xef61('0x45')]=qs[_0xef61('0x46')](_0x53bdb9[_0xef61('0x41')][_0xef61('0x46')]);_0x509cbc[_0xef61('0x47')]=qs[_0xef61('0x3f')](_['pick'](_0x53bdb9[_0xef61('0x41')],_0x1bd9af[_0xef61('0x3f')]));if(_0x53bdb9[_0xef61('0x41')][_0xef61('0x48')]){_0x509cbc['where']=_[_0xef61('0x49')](_0x509cbc[_0xef61('0x47')],{'$or':_[_0xef61('0x4a')](_0x560d87,function(_0x11bced){if(_0x11bced[_0xef61('0x4b')][_0xef61('0x4c')]!=='VIRTUAL'){var _0x1c6498={};_0x1c6498[_0x11bced[_0xef61('0x4d')]]={'$like':'%'+_0x53bdb9[_0xef61('0x41')]['filter']+'%'};return _0x1c6498;}})});}_0x509cbc=_[_0xef61('0x49')]({},_0x509cbc,_0x53bdb9[_0xef61('0x4e')]);var _0x14862d={'where':_0x509cbc[_0xef61('0x47')]};return db[_0xef61('0x4f')][_0xef61('0x32')](_0x14862d)['then'](function(_0x9809ea){_0x595a5a[_0xef61('0x32')]=_0x9809ea;if(_0x53bdb9['query'][_0xef61('0x50')]){_0x509cbc[_0xef61('0x51')]=[{'all':!![]}];}return db[_0xef61('0x4f')][_0xef61('0x52')](_0x509cbc);})['then'](function(_0x260c42){_0x595a5a[_0xef61('0x53')]=_0x260c42;return _0x595a5a;})[_0xef61('0x23')](respondWithFilteredResult(_0x59b97b,_0x509cbc))['catch'](handleError(_0x59b97b,null));};exports[_0xef61('0x54')]=function(_0x470e57,_0x53bd30){var _0xe9d203={'raw':!![],'where':{'id':_0x470e57[_0xef61('0x55')]['id']}},_0x132c77={};_0x132c77[_0xef61('0x3d')]=_[_0xef61('0x3e')](db[_0xef61('0x4f')][_0xef61('0x3c')]);_0x132c77['query']=_[_0xef61('0x3e')](_0x470e57['query']);_0x132c77[_0xef61('0x3f')]=_[_0xef61('0x40')](_0x132c77[_0xef61('0x3d')],_0x132c77[_0xef61('0x41')]);_0xe9d203[_0xef61('0x42')]=_[_0xef61('0x40')](_0x132c77[_0xef61('0x3d')],qs[_0xef61('0x43')](_0x470e57[_0xef61('0x41')]['fields']));_0xe9d203[_0xef61('0x42')]=_0xe9d203[_0xef61('0x42')]['length']?_0xe9d203['attributes']:_0x132c77[_0xef61('0x3d')];if(_0x470e57[_0xef61('0x41')]['includeAll']){_0xe9d203[_0xef61('0x51')]=[{'all':!![]}];}_0xe9d203=_['merge']({},_0xe9d203,_0x470e57[_0xef61('0x4e')]);return db[_0xef61('0x4f')][_0xef61('0x56')](_0xe9d203)[_0xef61('0x23')](handleEntityNotFound(_0x53bd30,null))[_0xef61('0x23')](respondWithResult(_0x53bd30,null))[_0xef61('0x2d')](handleError(_0x53bd30,null));};exports['create']=function(_0x474dad,_0x461345){return db['SmsMessage'][_0xef61('0x57')](_0x474dad[_0xef61('0x58')],{})['then'](respondWithResult(_0x461345,0xc9))['catch'](handleError(_0x461345,null));};exports[_0xef61('0x36')]=function(_0x5bc9c2,_0x5dcbbe){if(_0x5bc9c2['body']['id']){delete _0x5bc9c2[_0xef61('0x58')]['id'];}return db[_0xef61('0x4f')]['find']({'where':{'id':_0x5bc9c2[_0xef61('0x55')]['id']}})[_0xef61('0x23')](handleEntityNotFound(_0x5dcbbe,null))[_0xef61('0x23')](saveUpdates(_0x5bc9c2[_0xef61('0x58')],null))[_0xef61('0x23')](respondWithResult(_0x5dcbbe,null))[_0xef61('0x2d')](handleError(_0x5dcbbe,null));};exports[_0xef61('0x37')]=function(_0x3b7701,_0x55c6f3){return db['SmsMessage'][_0xef61('0x56')]({'where':{'id':_0x3b7701[_0xef61('0x55')]['id']}})[_0xef61('0x23')](handleEntityNotFound(_0x55c6f3,null))[_0xef61('0x23')](removeEntity(_0x55c6f3,null))[_0xef61('0x2d')](handleError(_0x55c6f3,null));};exports['describe']=function(_0x258d9d,_0x572d5f){return db['SmsMessage'][_0xef61('0x59')]()[_0xef61('0x23')](respondWithResult(_0x572d5f,null))[_0xef61('0x2d')](handleError(_0x572d5f,null));};var interaction_log=require('../../config/logger')(_0xef61('0x5a'));exports[_0xef61('0x5b')]=function(_0x3f8f66,_0x824157,_0x156888){var _0x2946c6={'channel':_0xef61('0x5c')};if(_0x3f8f66[_0xef61('0x58')]['id']){delete _0x3f8f66[_0xef61('0x58')]['id'];}_0x3f8f66[_0xef61('0x58')]['read']=!![];_0x3f8f66[_0xef61('0x58')]['readAt']=moment()['format'](_0xef61('0x5d'));_0x3f8f66[_0xef61('0x58')][_0xef61('0x5e')]=_0x3f8f66[_0xef61('0x58')][_0xef61('0x5e')]||_0x3f8f66[_0xef61('0x5f')]['id'];return db['SmsMessage']['find']({'where':{'id':_0x3f8f66[_0xef61('0x55')]['id'],'UserId':null},'include':[{'model':db[_0xef61('0x60')],'as':_0xef61('0x61')}]})[_0xef61('0x23')](handleEntityNotFound(_0x824157,null))[_0xef61('0x23')](saveUpdates(_0x3f8f66[_0xef61('0x58')],null))[_0xef61('0x23')](function(_0x33f585){if(_0x33f585){_0x2946c6[_0xef61('0x2b')]=_0x33f585[_0xef61('0x62')]({'plain':!![]});return db[_0xef61('0x63')]['find']({'where':{'id':_0x33f585[_0xef61('0x64')]}});}return null;})[_0xef61('0x23')](handleEntityNotFound(_0x824157,null))['then'](function(_0x4559a6){if(_0x4559a6){return _0x4559a6[_0xef61('0x36')]({'UserId':_0x3f8f66[_0xef61('0x58')][_0xef61('0x5e')],'read1stAt':_[_0xef61('0x65')](_0x4559a6[_0xef61('0x66')])?moment()[_0xef61('0x67')](_0xef61('0x5d')):undefined});}return null;})['then'](function(_0x3ecb8d){if(_0x3ecb8d){_0x2946c6['interaction']=_0x3ecb8d['get']({'plain':!![]});interaction_log['info'](_0xef61('0x68'),_0x3f8f66[_0xef61('0x5f')]['id'],_0x3f8f66[_0xef61('0x5f')]['name'],_0x3f8f66[_0xef61('0x5f')][_0xef61('0x69')],_0x2946c6[_0xef61('0x6a')]['id'],_0x3f8f66[_0xef61('0x58')]?JSON[_0xef61('0x28')](_0x3f8f66[_0xef61('0x58')]):_0xef61('0x6b'));return respondWithRpcPromise(_0xef61('0x6c'),_0xef61('0x6d'),_0x2946c6);}return null;})[_0xef61('0x23')](function(_0x128a95){if(_0x128a95){if(_0x3f8f66[_0xef61('0x58')][_0xef61('0x6e')]){_0x2946c6[_0xef61('0x2b')][_0xef61('0x6f')]=util[_0xef61('0x67')](_0xef61('0x70'),_0x3f8f66[_0xef61('0x5f')]['name']);_0x2946c6[_0xef61('0x2b')][_0xef61('0x71')]=_0x2946c6[_0xef61('0x71')];_0x2946c6[_0xef61('0x2b')][_0xef61('0x72')]=_0xef61('0x5b');return respondWithRpcPromise('EventManager',_0xef61('0x73'),{'event':_0xef61('0x74'),'message':_0x2946c6['message']},client9002)[_0xef61('0x23')](function(){return _0x2946c6;});}return _0x2946c6;}return null;})['then'](respondWithResult(_0x824157,null))[_0xef61('0x2d')](handleError(_0x824157,null));};var interaction_log=require(_0xef61('0x16'))('sms-interactions');exports[_0xef61('0x35')]=function(_0x512415,_0x3cba7f,_0x3f9882){var _0x4c880e={'agent':{},'channel':'sms'};if(_0x512415[_0xef61('0x58')]['id']){delete _0x512415[_0xef61('0x58')]['id'];}_0x512415[_0xef61('0x58')][_0xef61('0x5e')]=_0x512415[_0xef61('0x58')]['UserId']||_0x512415[_0xef61('0x5f')]['id'];_0x4c880e[_0xef61('0x75')]['id']=_0x512415[_0xef61('0x58')][_0xef61('0x5e')];return db[_0xef61('0x4f')][_0xef61('0x56')]({'where':{'id':_0x512415['params']['id'],'UserId':null}})[_0xef61('0x23')](handleEntityNotFound(_0x3cba7f,null))['then'](function(_0x18ed35){if(_0x18ed35){_0x4c880e[_0xef61('0x2b')]=_0x18ed35[_0xef61('0x62')]({'plain':!![]});return db[_0xef61('0x63')][_0xef61('0x56')]({'where':{'id':_0x18ed35[_0xef61('0x64')]}});}return null;})[_0xef61('0x23')](handleEntityNotFound(_0x3cba7f,null))[_0xef61('0x23')](function(_0x46576e){if(_0x46576e){_0x4c880e[_0xef61('0x6a')]=_0x46576e[_0xef61('0x62')]({'plain':!![]});interaction_log[_0xef61('0x24')](_0xef61('0x76'),_0x512415['user']['id'],_0x512415[_0xef61('0x5f')][_0xef61('0x39')],_0x512415[_0xef61('0x5f')][_0xef61('0x69')],_0x4c880e['interaction']['id'],_0x512415[_0xef61('0x58')]?JSON['stringify'](_0x512415['body']):_0xef61('0x6b'));return respondWithRpcPromise('RejectMessage',_0xef61('0x77'),_0x4c880e);}return null;})['then'](function(_0x5a9478){if(_0x5a9478){_0x5a9478[_0xef61('0x2b')][_0xef61('0x6f')]=util['format'](_0xef61('0x70'),_0x512415['user'][_0xef61('0x39')]);_0x5a9478[_0xef61('0x2b')][_0xef61('0x71')]=_0x4c880e[_0xef61('0x71')];_0x5a9478['message'][_0xef61('0x72')]='reject';respondWithRpcPromise(_0xef61('0x73'),_0xef61('0x73'),{'event':_0xef61('0x78'),'message':_0x5a9478[_0xef61('0x2b')]},client9002);return _0x4c880e;}return null;})[_0xef61('0x23')](respondWithResult(_0x3cba7f,null))[_0xef61('0x2d')](handleError(_0x3cba7f,null));};exports[_0xef61('0x2f')]=function(_0x1297c5,_0x3dc32e,_0x540b68){if(_0x1297c5[_0xef61('0x58')]['id']){delete _0x1297c5['body']['id'];}var _0x222239;return db[_0xef61('0x4f')]['find']({'where':{'id':_0x1297c5[_0xef61('0x55')]['id']}})['then'](handleEntityNotFound(_0x3dc32e,null))['then'](function(_0x465fb5){if(_0x465fb5){_0x222239=_0x465fb5;return db[_0xef61('0x79')]['find']({'where':{'id':_0x465fb5[_0xef61('0x7a')]}});}})[_0xef61('0x23')](handleEntityNotFound(_0x3dc32e,null))['then'](function(_0x352633){if(_0x352633){logger[_0xef61('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xef61('0x2f'),'received\x20delivery\x20report\x20from',_0x352633[_0xef61('0x4b')],util[_0xef61('0x7b')](_0x1297c5[_0xef61('0x58')],{'showHidden':![],'depth':null}));switch(_0x352633[_0xef61('0x4b')]){case'twilio':if(_0x1297c5[_0xef61('0x58')][_0xef61('0x7c')]&&_0x1297c5[_0xef61('0x58')]['MessageSid']===_0x222239[_0xef61('0x7d')]){return _0x222239[_0xef61('0x36')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xef61('0x2f'),_0xef61('0x7e'),util[_0xef61('0x7b')](_0x1297c5[_0xef61('0x58')],{'showHidden':![],'depth':null}));}break;case _0xef61('0x7f'):if(_0x1297c5[_0xef61('0x58')][_0xef61('0x80')]&&_0x1297c5[_0xef61('0x58')][_0xef61('0x80')]===_0x222239[_0xef61('0x7d')]&&_[_0xef61('0x81')]([_0xef61('0x82'),_0xef61('0x83')],_0x1297c5[_0xef61('0x58')][_0xef61('0x84')])>=0x0){return _0x222239[_0xef61('0x36')]({'read':!![]});}else{logger['error'](_0xef61('0x85'),_0xef61('0x2f'),_0xef61('0x86'),util[_0xef61('0x7b')](_0x1297c5[_0xef61('0x58')],{'showHidden':![],'depth':null}));}break;case _0xef61('0x87'):var _0x29ef4b=_0x1297c5[_0xef61('0x58')][_0xef61('0x88')][0x0];if(_0x29ef4b[_0xef61('0x2f')][_0xef61('0x89')]===_0xef61('0x8a')){return _0x222239['update']({'read':!![]});}else{logger[_0xef61('0x29')](_0xef61('0x85'),'status',_0xef61('0x87'),util[_0xef61('0x7b')](_0x1297c5[_0xef61('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x222239;}})[_0xef61('0x23')](respondWithResult(_0x3dc32e,null))[_0xef61('0x2d')](handleError(_0x3dc32e,null));};
\ No newline at end of file
index 631e061..64da330 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x95ca=['remove','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','update'];(function(_0x153cfd,_0x484f8d){var _0x563193=function(_0x1d75b9){while(--_0x1d75b9){_0x153cfd['push'](_0x153cfd['shift']());}};_0x563193(++_0x484f8d);}(_0x95ca,0x1ac));var _0xa95c=function(_0x5f47e0,_0x1481d2){_0x5f47e0=_0x5f47e0-0x0;var _0x4f031c=_0x95ca[_0x5f47e0];return _0x4f031c;};'use strict';var EventEmitter=require(_0xa95c('0x0'));var SmsMessage=require(_0xa95c('0x1'))['db'][_0xa95c('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa95c('0x3'),'afterDestroy':_0xa95c('0x4')};function emitEvent(_0x4e02d2){return function(_0x349017,_0x4e2f1c,_0x155335){SmsMessageEvents['emit'](_0x4e02d2+':'+_0x349017['id'],_0x349017);SmsMessageEvents['emit'](_0x4e02d2,_0x349017);_0x155335(null);};}for(var e in events){if(events[_0xa95c('0x5')](e)){var event=events[e];SmsMessage[_0xa95c('0x6')](e,emitEvent(event));}}module[_0xa95c('0x7')]=SmsMessageEvents;
\ No newline at end of file
+var _0x9816=['save','update','remove','emit','hasOwnProperty','hook','events','SmsMessage'];(function(_0x4531b3,_0x13cae2){var _0x44d749=function(_0x7506f5){while(--_0x7506f5){_0x4531b3['push'](_0x4531b3['shift']());}};_0x44d749(++_0x13cae2);}(_0x9816,0x136));var _0x6981=function(_0x4d39c9,_0x3b1007){_0x4d39c9=_0x4d39c9-0x0;var _0xf74f8=_0x9816[_0x4d39c9];return _0xf74f8;};'use strict';var EventEmitter=require(_0x6981('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x6981('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6981('0x2'),'afterUpdate':_0x6981('0x3'),'afterDestroy':_0x6981('0x4')};function emitEvent(_0x275aa9){return function(_0x55c1b9,_0x143b3a,_0x2619c5){SmsMessageEvents[_0x6981('0x5')](_0x275aa9+':'+_0x55c1b9['id'],_0x55c1b9);SmsMessageEvents[_0x6981('0x5')](_0x275aa9,_0x55c1b9);_0x2619c5(null);};}for(var e in events){if(events[_0x6981('0x6')](e)){var event=events[e];SmsMessage[_0x6981('0x7')](e,emitEvent(event));}}module['exports']=SmsMessageEvents;
\ No newline at end of file
index 7c7cf4b..88f36b0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5962=['Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','get','direction','toLowerCase','out','SmsInteraction','SmsInteractionId','update','createdAt','body','catch','secret','find','SmsAccountId','then','type','twilio','accountSid','phone','authToken','create','remote','/api/sms/messages/','/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sms','POST','session_key','deliveryReport','read','senderString','requestid','connectel','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','messages','message_id','clickSend','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20username,\x20password','csc','crypto','apiKey','login','sender','timestamp','sort','length','createHash','hex','GET','https://sms.csc.lv/external/get/send.php?','keys'];(function(_0x16f539,_0x2276fe){var _0x39bbc5=function(_0x4ed4c0){while(--_0x4ed4c0){_0x16f539['push'](_0x16f539['shift']());}};_0x39bbc5(++_0x2276fe);}(_0x5962,0xec));var _0x2596=function(_0x210d7f,_0x2abe4f){_0x210d7f=_0x210d7f-0x0;var _0x42d687=_0x5962[_0x210d7f];return _0x42d687;};'use strict';var _=require(_0x2596('0x0'));var util=require('util');var logger=require(_0x2596('0x1'))(_0x2596('0x2'));var moment=require(_0x2596('0x3'));var BPromise=require(_0x2596('0x4'));var rp=require(_0x2596('0x5'));var attributes=require(_0x2596('0x6'));module[_0x2596('0x7')]=function(_0x432f55,_0x28051e){return _0x432f55[_0x2596('0x8')](_0x2596('0x9'),attributes,{'tableName':_0x2596('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x2596('0xb')]}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5418d1,_0x3b6be2,_0x3c656c){var _0x1c6d16=_0x432f55['models'];var _0x49eca3=_0x5418d1[_0x2596('0xc')]({'plain':!![]});if(_0x49eca3[_0x2596('0xd')][_0x2596('0xe')]()==='in'||_0x49eca3['direction']['toLowerCase']()===_0x2596('0xf')&&!_0x49eca3['secret']&&!_['isNil'](_0x49eca3['UserId'])){_0x1c6d16[_0x2596('0x10')]['findOne']({'where':{'id':_0x49eca3[_0x2596('0x11')]}})['then'](function(_0x578071){if(_0x578071){_0x578071[_0x2596('0x12')]({'lastMsgAt':_0x49eca3[_0x2596('0x13')],'lastMsgDirection':_0x49eca3[_0x2596('0xd')]['toLowerCase'](),'lastMsgBody':_0x49eca3[_0x2596('0x14')]});}})[_0x2596('0x15')](function(_0x18899f){console['error'](_0x18899f);});}if(_0x49eca3['direction']==='out'&&!_0x49eca3[_0x2596('0x16')]){var _0x43ffa2;_0x1c6d16['SmsAccount'][_0x2596('0x17')]({'where':{'id':_0x49eca3[_0x2596('0x18')]},'raw':!![]})[_0x2596('0x19')](function(_0x3ff8eb){_0x43ffa2=_0x3ff8eb;if(_0x43ffa2&&_0x43ffa2['type']){switch(_0x43ffa2[_0x2596('0x1a')]){case'twilio':var _0x275e39=require(_0x2596('0x1b'));if(_0x43ffa2[_0x2596('0x1c')]&&_0x43ffa2['authToken']&&_0x43ffa2[_0x2596('0x1d')]){var _0x5a2600=new _0x275e39(_0x43ffa2[_0x2596('0x1c')],_0x43ffa2[_0x2596('0x1e')]);_0x5a2600['messages'][_0x2596('0x1f')]({'body':_0x49eca3[_0x2596('0x14')],'to':_0x49eca3[_0x2596('0x1d')],'from':_0x43ffa2[_0x2596('0x1d')],'statusCallback':_0x43ffa2[_0x2596('0x20')]+_0x2596('0x21')+_0x49eca3['id']+_0x2596('0x22')+_0x43ffa2[_0x2596('0x23')]})[_0x2596('0x19')](function(_0x67c6a0){if(_0x67c6a0[_0x2596('0x24')]){return _0x5418d1[_0x2596('0x12')]({'messageId':_0x67c6a0[_0x2596('0x24')]});}})[_0x2596('0x15')](function(_0x5e8038){logger[_0x2596('0x25')](_0x2596('0x26'),_0x2596('0x27'),'twilio',util[_0x2596('0x28')](_0x5e8038,{'showHidden':![],'depth':null}));});}else{logger[_0x2596('0x25')](_0x2596('0x26'),_0x2596('0x27'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x2596('0x29'):var _0x57b48c=_0x2596('0x2a');if(_0x43ffa2[_0x2596('0x2b')]&&_0x43ffa2[_0x2596('0x2c')]){var _0x3340a6={'recipient':[_0x49eca3['phone']],'message':_0x49eca3[_0x2596('0x14')],'message_type':_0x43ffa2[_0x2596('0x2d')]};var _0xa28e9e={'url':_0x57b48c+'login?username='+_0x43ffa2['username']+'&password='+_0x43ffa2[_0x2596('0x2c')],'method':'GET'};rp(_0xa28e9e)[_0x2596('0x19')](function(_0x4251c6){var _0x290375=_0x4251c6['split'](';');var _0x20da15={'user_key':_0x290375[0x0],'session_key':_0x290375[0x1]};_0xa28e9e={'url':_0x57b48c+_0x2596('0x2e'),'method':_0x2596('0x2f'),'headers':{'user_key':_0x20da15['user_key'],'Session_key':_0x20da15[_0x2596('0x30')]},'json':!![],'body':_0x3340a6};return rp(_0xa28e9e);})[_0x2596('0x19')](function(_0x19e668){if(_0x19e668['total_sent']>=0x1){var _0x5a861a={'messageId':_0x19e668['internal_order_id']};if(_0x43ffa2['smsMethod']!=='GP'||!_0x43ffa2[_0x2596('0x31')]){_0x5a861a[_0x2596('0x32')]=!![];}return _0x5418d1[_0x2596('0x12')](_0x5a861a);}else{return logger[_0x2596('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby',util[_0x2596('0x28')](_0x19e668,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5b9aef){return logger[_0x2596('0x25')](_0x2596('0x26'),_0x2596('0x27'),_0x2596('0x29'),util[_0x2596('0x28')](_0x5b9aef,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2596('0x26'),_0x2596('0x27'),_0x2596('0x29'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x43ffa2[_0x2596('0x1e')]){var _0x517482={'recipient':_0x49eca3[_0x2596('0x1d')],'message':_0x49eca3[_0x2596('0x14')],'sender':_0x43ffa2[_0x2596('0x33')]||_0x43ffa2[_0x2596('0x1d')],'authorization':_0x43ffa2[_0x2596('0x1e')]};var _0x3b6be2={'method':_0x2596('0x2f'),'uri':'https://smsapi.connectel.se/api/send/','body':_0x517482,'json':!![]};rp(_0x3b6be2)['then'](function(_0x1d7bf2){var _0x4bb12c={'messageId':_0x1d7bf2[_0x2596('0x34')]};if(!_0x43ffa2['deliveryReport']){_0x4bb12c[_0x2596('0x32')]=!![];}return _0x5418d1[_0x2596('0x12')](_0x4bb12c);})[_0x2596('0x15')](function(_0x4e0583){logger[_0x2596('0x25')](_0x2596('0x26'),_0x2596('0x27'),_0x2596('0x35'),util[_0x2596('0x28')](_0x4e0583,{'showHidden':![],'depth':null}));});}else{logger[_0x2596('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2596('0x35'),'Missing\x20parameters:\x20authToken');}break;case _0x2596('0x36'):if(_0x43ffa2[_0x2596('0x2b')]&&_0x43ffa2[_0x2596('0x2c')]){var _0x517482={'messages':[{'source':_0x2596('0x37'),'to':_0x49eca3[_0x2596('0x1d')],'body':_0x49eca3[_0x2596('0x14')],'from':_0x43ffa2['senderString']||_0x43ffa2[_0x2596('0x1d')]}]};var _0x5da81b=util[_0x2596('0x38')](_0x2596('0x39'),_0x43ffa2['username'],_0x43ffa2[_0x2596('0x2c')]);var _0x3b6be2={'method':_0x2596('0x2f'),'uri':_0x2596('0x3a'),'body':_0x517482,'headers':{'Authorization':util[_0x2596('0x38')](_0x2596('0x3b'),new Buffer(_0x5da81b)[_0x2596('0x3c')](_0x2596('0x3d')))},'json':!![]};rp(_0x3b6be2)[_0x2596('0x19')](function(_0x27dd8c){if(_0x27dd8c[_0x2596('0x3e')]>=0xc8&&_0x27dd8c['http_code']<=0xce){if(_0x27dd8c[_0x2596('0x3f')]&&_0x27dd8c[_0x2596('0x3f')][_0x2596('0x40')]>0x0){var _0x31318=_[_0x2596('0x41')](_0x27dd8c[_0x2596('0x3f')][_0x2596('0x42')]);var _0x119a01={'messageId':_0x31318[_0x2596('0x43')]};if(!_0x43ffa2[_0x2596('0x31')]){_0x119a01['read']=!![];}return _0x5418d1[_0x2596('0x12')](_0x119a01);}else{logger[_0x2596('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2596('0x27'),_0x2596('0x44'),util[_0x2596('0x28')](_0x27dd8c,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x2596('0x26'),'afterCreate','clickSend',util[_0x2596('0x28')](_0x27dd8c,{'showHidden':![],'depth':null}));}})[_0x2596('0x15')](function(_0x26ae51){logger[_0x2596('0x25')](_0x2596('0x26'),'afterCreate','clickSend',util[_0x2596('0x28')](_0x26ae51,{'showHidden':![],'depth':null}));});}else{logger[_0x2596('0x25')](_0x2596('0x26'),_0x2596('0x27'),_0x2596('0x44'),'Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x43ffa2[_0x2596('0x45')]&&_0x43ffa2['authToken']){var _0x517482={'dst':_0x49eca3[_0x2596('0x1d')],'text':_0x49eca3[_0x2596('0x14')],'src':_0x43ffa2[_0x2596('0x33')]||_0x43ffa2[_0x2596('0x1d')],'url':_0x43ffa2[_0x2596('0x20')]+_0x2596('0x21')+_0x49eca3['id']+_0x2596('0x22')+_0x43ffa2[_0x2596('0x23')]};var _0x5da81b=util[_0x2596('0x38')](_0x2596('0x39'),_0x43ffa2[_0x2596('0x45')],_0x43ffa2[_0x2596('0x1e')]);var _0x3b6be2={'method':_0x2596('0x2f'),'uri':util[_0x2596('0x38')](_0x2596('0x46'),_0x43ffa2['authId']),'body':_0x517482,'headers':{'Authorization':util[_0x2596('0x38')]('Basic\x20%s',new Buffer(_0x5da81b)['toString'](_0x2596('0x3d')))},'json':!![]};rp(_0x3b6be2)[_0x2596('0x19')](function(_0x3c54b7){var _0x1eeab2={'messageId':_0x3c54b7[_0x2596('0x47')][0x0]};return _0x5418d1[_0x2596('0x12')](_0x1eeab2);})[_0x2596('0x15')](function(_0x1bde81){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','plivo',util[_0x2596('0x28')](_0x1bde81,{'showHidden':![],'depth':null}));});}else{logger[_0x2596('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2596('0x27'),_0x2596('0x48'),_0x2596('0x49'));}break;case _0x2596('0x4a'):if(_0x43ffa2['username']&&_0x43ffa2[_0x2596('0x2c')]){if(_0x43ffa2[_0x2596('0x4b')]){var _0x22017f={'method':'POST','uri':_0x43ffa2['baseUrl']+_0x2596('0x4c'),'body':{'username':_0x43ffa2[_0x2596('0x2b')],'password':_0x43ffa2['password']},'json':!![]};return rp(_0x22017f)[_0x2596('0x19')](function(_0x1edeff){var _0x35b2bc={'method':_0x2596('0x2f'),'uri':_0x43ffa2[_0x2596('0x4b')]+_0x2596('0x4d'),'body':{'messages':[{'from':_0x43ffa2[_0x2596('0x1d')],'destinations':[{'to':_0x49eca3[_0x2596('0x1d')]}],'text':_0x49eca3[_0x2596('0x14')],'notifyUrl':_0x43ffa2[_0x2596('0x20')]+_0x2596('0x21')+_0x49eca3['id']+_0x2596('0x22')+_0x43ffa2[_0x2596('0x23')],'notifyContentType':_0x2596('0x4e'),'callbackData':_0x43ffa2['phone']+';'+_0x49eca3[_0x2596('0x14')]}]},'headers':{'Authorization':_0x2596('0x4f')+_0x1edeff[_0x2596('0x23')]},'json':!![]};return rp(_0x35b2bc)[_0x2596('0x19')](function(_0x117eee){if(_0x117eee[_0x2596('0x42')]){var _0xeeff71={'messageId':_0x117eee[_0x2596('0x42')][0x0][_0x2596('0xb')]};if(!_0x43ffa2[_0x2596('0x31')]){_0xeeff71[_0x2596('0x32')]=!![];}return _0x5418d1['update'](_0xeeff71);}else{return logger[_0x2596('0x25')](_0x2596('0x26'),_0x2596('0x27'),_0x2596('0x4a'),util[_0x2596('0x28')](_0x117eee,{'showHidden':![],'depth':null}));}});})[_0x2596('0x15')](function(_0x90eaea){return logger[_0x2596('0x25')](_0x2596('0x26'),_0x2596('0x27'),_0x2596('0x4a'),util[_0x2596('0x28')](_0x90eaea,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2596('0x26'),_0x2596('0x27'),_0x2596('0x4a'),'Missing\x20parameters:\x20base_url');}}else{logger['error'](_0x2596('0x26'),_0x2596('0x27'),_0x2596('0x4a'),_0x2596('0x50'));}case _0x2596('0x51'):var _0xc2a98a=require(_0x2596('0x52'));if(_0x43ffa2[_0x2596('0x53')]){var _0xa71505={};_0xa71505[_0x2596('0x54')]=_0x43ffa2[_0x2596('0x2b')];_0xa71505[_0x2596('0x1d')]=_0x49eca3[_0x2596('0x1d')];_0xa71505[_0x2596('0x55')]=_0x43ffa2[_0x2596('0x1d')];_0xa71505['text']=_0x49eca3[_0x2596('0x14')];_0xa71505[_0x2596('0x56')]=+new Date();var _0x253465='';var _0x704b93='';var _0x317256=Object['keys'](_0xa71505);_0x317256[_0x2596('0x57')]();for(var _0x2fccb2=0x0;_0x2fccb2<_0x317256[_0x2596('0x58')];_0x2fccb2++){if(_0x253465!=''){_0x253465+='&';}_0x253465+=_0x317256[_0x2fccb2]+'='+encodeURIComponent(_0xa71505[_0x317256[_0x2fccb2]]);_0x704b93+=_0xa71505[_0x317256[_0x2fccb2]];}_0x704b93+=_0x43ffa2['apiKey'];_0x704b93=_0xc2a98a[_0x2596('0x59')]('md5')['update'](_0x704b93)['digest'](_0x2596('0x5a'));if(_0x253465!==''){_0x253465+='&';}_0x253465+='signature='+_0x704b93;var _0xa28e9e={'method':_0x2596('0x5b'),'uri':_0x2596('0x5c')+_0x253465,'json':!![]};return rp(_0xa28e9e)[_0x2596('0x19')](function(_0x585335){var _0x55e50d=Object[_0x2596('0x5d')](_0x585335);if(_0x585335[_0x55e50d[0x0]][_0x2596('0x25')]&&parseInt(_0x585335[_0x55e50d[0x0]][_0x2596('0x25')])===0x0){var _0x4132d3={'messageId':_0x585335[_0x55e50d[0x0]]['id_sms']};if(!_0x43ffa2[_0x2596('0x31')]){_0x4132d3[_0x2596('0x32')]=!![];}return _0x5418d1[_0x2596('0x12')](_0x4132d3);}else{return logger[_0x2596('0x25')](_0x2596('0x26'),_0x2596('0x27'),_0x2596('0x51'),util[_0x2596('0x28')](_0x585335[_0x2596('0x25')],{'showHidden':![],'depth':null}));}})[_0x2596('0x15')](function(_0x499d6c){return logger[_0x2596('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2596('0x27'),_0x2596('0x51'),util[_0x2596('0x28')](_0x499d6c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2596('0x26'),_0x2596('0x27'),'csc',_0x2596('0x5e'));}case _0x2596('0x5f'):if(_0x43ffa2[_0x2596('0x53')]){var _0x470c30={'method':_0x2596('0x2f'),'uri':_0x2596('0x60'),'headers':{'Authorization':_0x43ffa2['apiKey']},'body':{'content':_0x49eca3[_0x2596('0x14')],'to':[_0x49eca3['phone']],'from':_0x43ffa2[_0x2596('0x1d')],'binary':![],'clientMessageId':'uuid','charset':_0x2596('0x61')},'json':!![]};rp(_0x470c30)[_0x2596('0x19')](function(_0x45f27d){if(!_0x45f27d[_0x2596('0x25')]){var _0x3800e5={'messageId':_0x45f27d['messages'][0x0][_0x2596('0x62')]};if(!_0x43ffa2[_0x2596('0x31')]){_0x3800e5[_0x2596('0x32')]=!![];}return _0x5418d1['update'](_0x3800e5);}else{return logger[_0x2596('0x25')](_0x2596('0x26'),'afterCreate',_0x2596('0x5f'),util[_0x2596('0x28')](_0x45f27d[_0x2596('0x25')],{'showHidden':![],'depth':null}));}})[_0x2596('0x15')](function(_0x2c854f){return logger[_0x2596('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2596('0x5f'),util[_0x2596('0x28')](_0x2c854f,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2596('0x27'),'clickatell',_0x2596('0x5e'));}break;case'intelepeer':if(_0x43ffa2[_0x2596('0x53')]){var _0x7afaea={};var _0xa28e9e={'method':_0x2596('0x2f'),'uri':_0x2596('0x63'),'headers':{'Authorization':_0x2596('0x64')+_0x43ffa2[_0x2596('0x53')],'Content-Type':_0x2596('0x4e')},'body':{'from':_0x43ffa2[_0x2596('0x1d')],'to':_0x49eca3[_0x2596('0x1d')],'text':_0x49eca3[_0x2596('0x14')]},'json':!![]};return rp(_0xa28e9e)[_0x2596('0x19')](function(_0x34d2b2){if(_0x34d2b2[_0x2596('0x65')]==0xca){_0x7afaea['message']=_0x34d2b2;var _0x28a6ca={'method':_0x2596('0x2f'),'uri':_0x2596('0x66'),'headers':{'Authorization':_0x2596('0x64')+_0x43ffa2[_0x2596('0x53')],'Content-Type':_0x2596('0x4e')},'body':{'refid':_0x7afaea['message'][_0x2596('0x67')]},'json':!![]};return rp(_0x28a6ca)[_0x2596('0x19')](function(_0x3dffa8){_0x7afaea[_0x2596('0x68')]=_0x3dffa8;var _0x24a681={'messageId':_0x7afaea['message'][_0x2596('0x67')],'read':!![]};return _0x5418d1[_0x2596('0x12')](_0x24a681);});}else{return logger[_0x2596('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2596('0x27'),_0x2596('0x69'),util[_0x2596('0x28')](_0x34d2b2,{'showHidden':![],'depth':null}));}})[_0x2596('0x15')](function(_0x4327a3){return logger[_0x2596('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2596('0x27'),'intelepeer',util[_0x2596('0x28')](_0x4327a3,{'showHidden':![],'depth':null}));});}else{return logger[_0x2596('0x25')](_0x2596('0x26'),_0x2596('0x27'),_0x2596('0x69'),_0x2596('0x6a'));}break;}}})[_0x2596('0x6b')](function(){_0x3c656c();});}else{_0x3c656c();}}},'charset':_0x2596('0x6c'),'collate':_0x2596('0x6d')});};
\ No newline at end of file
+var _0xf42d=['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','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','api','bluebird','request-promise','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','body','catch','error','SmsAccount','find','SmsAccountId','twilio','authToken','accountSid','messages','create','phone','remote','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','password','login?username=','username','GET','split','sms','POST','user_key','total_sent','smsMethod','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/send/','requestid','connectel','Missing\x20parameters:\x20authToken','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','head','data','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','baseUrl','/auth/1/session','/status?token=','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','sender','text','timestamp','sort','length','apiKey','createHash','md5','digest','signature=','https://sms.csc.lv/external/get/send.php?','keys','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','clickatell','intelepeer'];(function(_0x594201,_0x12c7ff){var _0x25344d=function(_0x222cb7){while(--_0x222cb7){_0x594201['push'](_0x594201['shift']());}};_0x25344d(++_0x12c7ff);}(_0xf42d,0xec));var _0xdf42=function(_0x779cdb,_0x189bd2){_0x779cdb=_0x779cdb-0x0;var _0x4e31ec=_0xf42d[_0x779cdb];return _0x4e31ec;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xdf42('0x0'));var moment=require('moment');var BPromise=require(_0xdf42('0x1'));var rp=require(_0xdf42('0x2'));var attributes=require(_0xdf42('0x3'));module[_0xdf42('0x4')]=function(_0x461ecb,_0x1454bd){return _0x461ecb[_0xdf42('0x5')](_0xdf42('0x6'),attributes,{'tableName':_0xdf42('0x7'),'paranoid':![],'indexes':[{'name':_0xdf42('0x8'),'fields':[_0xdf42('0x8')]}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3319ba,_0x486b30,_0x19c839){var _0x24dcca=_0x461ecb['models'];var _0x5080dc=_0x3319ba[_0xdf42('0x9')]({'plain':!![]});if(_0x5080dc[_0xdf42('0xa')][_0xdf42('0xb')]()==='in'||_0x5080dc[_0xdf42('0xa')][_0xdf42('0xb')]()===_0xdf42('0xc')&&!_0x5080dc[_0xdf42('0xd')]&&!_[_0xdf42('0xe')](_0x5080dc[_0xdf42('0xf')])){_0x24dcca[_0xdf42('0x10')][_0xdf42('0x11')]({'where':{'id':_0x5080dc[_0xdf42('0x12')]}})[_0xdf42('0x13')](function(_0x2be216){if(_0x2be216){_0x2be216[_0xdf42('0x14')]({'lastMsgAt':_0x5080dc['createdAt'],'lastMsgDirection':_0x5080dc[_0xdf42('0xa')][_0xdf42('0xb')](),'lastMsgBody':_0x5080dc[_0xdf42('0x15')]});}})[_0xdf42('0x16')](function(_0x50dd0a){console[_0xdf42('0x17')](_0x50dd0a);});}if(_0x5080dc[_0xdf42('0xa')]===_0xdf42('0xc')&&!_0x5080dc['secret']){var _0x337443;_0x24dcca[_0xdf42('0x18')][_0xdf42('0x19')]({'where':{'id':_0x5080dc[_0xdf42('0x1a')]},'raw':!![]})['then'](function(_0x351208){_0x337443=_0x351208;if(_0x337443&&_0x337443['type']){switch(_0x337443['type']){case _0xdf42('0x1b'):var _0x28ffef=require('twilio');if(_0x337443['accountSid']&&_0x337443[_0xdf42('0x1c')]&&_0x337443['phone']){var _0x46d2df=new _0x28ffef(_0x337443[_0xdf42('0x1d')],_0x337443[_0xdf42('0x1c')]);_0x46d2df[_0xdf42('0x1e')][_0xdf42('0x1f')]({'body':_0x5080dc[_0xdf42('0x15')],'to':_0x5080dc['phone'],'from':_0x337443[_0xdf42('0x20')],'statusCallback':_0x337443[_0xdf42('0x21')]+_0xdf42('0x22')+_0x5080dc['id']+'/status?token='+_0x337443[_0xdf42('0x23')]})[_0xdf42('0x13')](function(_0x1163dc){if(_0x1163dc['sid']){return _0x3319ba[_0xdf42('0x14')]({'messageId':_0x1163dc[_0xdf42('0x24')]});}})['catch'](function(_0x25479c){logger[_0xdf42('0x17')](_0xdf42('0x25'),_0xdf42('0x26'),_0xdf42('0x1b'),util[_0xdf42('0x27')](_0x25479c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xdf42('0x25'),_0xdf42('0x26'),_0xdf42('0x1b'),_0xdf42('0x28'));}break;case _0xdf42('0x29'):var _0x410a60='https://api.skebby.it/API/v1.0/REST/';if(_0x337443['username']&&_0x337443[_0xdf42('0x2a')]){var _0x44259a={'recipient':[_0x5080dc[_0xdf42('0x20')]],'message':_0x5080dc[_0xdf42('0x15')],'message_type':_0x337443['smsMethod']};var _0x4dabda={'url':_0x410a60+_0xdf42('0x2b')+_0x337443[_0xdf42('0x2c')]+'&password='+_0x337443['password'],'method':_0xdf42('0x2d')};rp(_0x4dabda)[_0xdf42('0x13')](function(_0x2c1d84){var _0x2902b4=_0x2c1d84[_0xdf42('0x2e')](';');var _0x57bc8e={'user_key':_0x2902b4[0x0],'session_key':_0x2902b4[0x1]};_0x4dabda={'url':_0x410a60+_0xdf42('0x2f'),'method':_0xdf42('0x30'),'headers':{'user_key':_0x57bc8e[_0xdf42('0x31')],'Session_key':_0x57bc8e['session_key']},'json':!![],'body':_0x44259a};return rp(_0x4dabda);})[_0xdf42('0x13')](function(_0x33789d){if(_0x33789d[_0xdf42('0x32')]>=0x1){var _0x53eace={'messageId':_0x33789d['internal_order_id']};if(_0x337443[_0xdf42('0x33')]!=='GP'||!_0x337443[_0xdf42('0x34')]){_0x53eace[_0xdf42('0x35')]=!![];}return _0x3319ba[_0xdf42('0x14')](_0x53eace);}else{return logger[_0xdf42('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdf42('0x26'),_0xdf42('0x29'),util[_0xdf42('0x27')](_0x33789d,{'showHidden':![],'depth':null}));}})[_0xdf42('0x16')](function(_0x12accb){return logger[_0xdf42('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdf42('0x26'),'skebby',util[_0xdf42('0x27')](_0x12accb,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xdf42('0x25'),_0xdf42('0x26'),'skebby',_0xdf42('0x36'));}break;case'connectel':if(_0x337443[_0xdf42('0x1c')]){var _0x2fb15c={'recipient':_0x5080dc[_0xdf42('0x20')],'message':_0x5080dc[_0xdf42('0x15')],'sender':_0x337443[_0xdf42('0x37')]||_0x337443[_0xdf42('0x20')],'authorization':_0x337443['authToken']};var _0x486b30={'method':'POST','uri':_0xdf42('0x38'),'body':_0x2fb15c,'json':!![]};rp(_0x486b30)[_0xdf42('0x13')](function(_0x1e495c){var _0x2033c2={'messageId':_0x1e495c[_0xdf42('0x39')]};if(!_0x337443['deliveryReport']){_0x2033c2['read']=!![];}return _0x3319ba[_0xdf42('0x14')](_0x2033c2);})[_0xdf42('0x16')](function(_0xabe33d){logger[_0xdf42('0x17')](_0xdf42('0x25'),_0xdf42('0x26'),_0xdf42('0x3a'),util[_0xdf42('0x27')](_0xabe33d,{'showHidden':![],'depth':null}));});}else{logger[_0xdf42('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdf42('0x26'),_0xdf42('0x3a'),_0xdf42('0x3b'));}break;case'clicksend':if(_0x337443[_0xdf42('0x2c')]&&_0x337443['password']){var _0x2fb15c={'messages':[{'source':'xCALLY\x20Motion','to':_0x5080dc['phone'],'body':_0x5080dc[_0xdf42('0x15')],'from':_0x337443[_0xdf42('0x37')]||_0x337443['phone']}]};var _0x5473ae=util[_0xdf42('0x3c')](_0xdf42('0x3d'),_0x337443[_0xdf42('0x2c')],_0x337443['password']);var _0x486b30={'method':_0xdf42('0x30'),'uri':_0xdf42('0x3e'),'body':_0x2fb15c,'headers':{'Authorization':util['format'](_0xdf42('0x3f'),new Buffer(_0x5473ae)[_0xdf42('0x40')](_0xdf42('0x41')))},'json':!![]};rp(_0x486b30)[_0xdf42('0x13')](function(_0xd405d0){if(_0xd405d0[_0xdf42('0x42')]>=0xc8&&_0xd405d0['http_code']<=0xce){if(_0xd405d0['data']&&_0xd405d0['data']['queued_count']>0x0){var _0x3aae12=_[_0xdf42('0x43')](_0xd405d0[_0xdf42('0x44')]['messages']);var _0x27bff7={'messageId':_0x3aae12[_0xdf42('0x45')]};if(!_0x337443[_0xdf42('0x34')]){_0x27bff7[_0xdf42('0x35')]=!![];}return _0x3319ba['update'](_0x27bff7);}else{logger[_0xdf42('0x17')](_0xdf42('0x25'),_0xdf42('0x26'),_0xdf42('0x46'),util[_0xdf42('0x27')](_0xd405d0,{'showHidden':![],'depth':null}));}}else{logger[_0xdf42('0x17')](_0xdf42('0x25'),'afterCreate',_0xdf42('0x46'),util[_0xdf42('0x27')](_0xd405d0,{'showHidden':![],'depth':null}));}})[_0xdf42('0x16')](function(_0x3d7c01){logger[_0xdf42('0x17')](_0xdf42('0x25'),_0xdf42('0x26'),_0xdf42('0x46'),util['inspect'](_0x3d7c01,{'showHidden':![],'depth':null}));});}else{logger[_0xdf42('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdf42('0x26'),'clickSend',_0xdf42('0x36'));}break;case _0xdf42('0x47'):if(_0x337443[_0xdf42('0x48')]&&_0x337443[_0xdf42('0x1c')]){var _0x2fb15c={'dst':_0x5080dc[_0xdf42('0x20')],'text':_0x5080dc[_0xdf42('0x15')],'src':_0x337443[_0xdf42('0x37')]||_0x337443['phone'],'url':_0x337443[_0xdf42('0x21')]+_0xdf42('0x22')+_0x5080dc['id']+'/status?token='+_0x337443[_0xdf42('0x23')]};var _0x5473ae=util[_0xdf42('0x3c')](_0xdf42('0x3d'),_0x337443[_0xdf42('0x48')],_0x337443['authToken']);var _0x486b30={'method':_0xdf42('0x30'),'uri':util[_0xdf42('0x3c')](_0xdf42('0x49'),_0x337443[_0xdf42('0x48')]),'body':_0x2fb15c,'headers':{'Authorization':util[_0xdf42('0x3c')](_0xdf42('0x3f'),new Buffer(_0x5473ae)['toString']('base64'))},'json':!![]};rp(_0x486b30)[_0xdf42('0x13')](function(_0x5a60d2){var _0x559349={'messageId':_0x5a60d2[_0xdf42('0x4a')][0x0]};return _0x3319ba[_0xdf42('0x14')](_0x559349);})['catch'](function(_0x21107e){logger[_0xdf42('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdf42('0x26'),_0xdf42('0x47'),util[_0xdf42('0x27')](_0x21107e,{'showHidden':![],'depth':null}));});}else{logger[_0xdf42('0x17')](_0xdf42('0x25'),_0xdf42('0x26'),_0xdf42('0x47'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x337443[_0xdf42('0x2c')]&&_0x337443['password']){if(_0x337443[_0xdf42('0x4b')]){var _0x68da71={'method':_0xdf42('0x30'),'uri':_0x337443[_0xdf42('0x4b')]+_0xdf42('0x4c'),'body':{'username':_0x337443[_0xdf42('0x2c')],'password':_0x337443[_0xdf42('0x2a')]},'json':!![]};return rp(_0x68da71)[_0xdf42('0x13')](function(_0x1adf5a){var _0x233e0c={'method':_0xdf42('0x30'),'uri':_0x337443[_0xdf42('0x4b')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x337443[_0xdf42('0x20')],'destinations':[{'to':_0x5080dc['phone']}],'text':_0x5080dc[_0xdf42('0x15')],'notifyUrl':_0x337443[_0xdf42('0x21')]+_0xdf42('0x22')+_0x5080dc['id']+_0xdf42('0x4d')+_0x337443[_0xdf42('0x23')],'notifyContentType':'application/json','callbackData':_0x337443[_0xdf42('0x20')]+';'+_0x5080dc[_0xdf42('0x15')]}]},'headers':{'Authorization':_0xdf42('0x4e')+_0x1adf5a[_0xdf42('0x23')]},'json':!![]};return rp(_0x233e0c)[_0xdf42('0x13')](function(_0x39869b){if(_0x39869b['messages']){var _0xd12b5b={'messageId':_0x39869b['messages'][0x0][_0xdf42('0x8')]};if(!_0x337443[_0xdf42('0x34')]){_0xd12b5b[_0xdf42('0x35')]=!![];}return _0x3319ba[_0xdf42('0x14')](_0xd12b5b);}else{return logger[_0xdf42('0x17')](_0xdf42('0x25'),'afterCreate',_0xdf42('0x4f'),util[_0xdf42('0x27')](_0x39869b,{'showHidden':![],'depth':null}));}});})[_0xdf42('0x16')](function(_0xd640d8){return logger[_0xdf42('0x17')](_0xdf42('0x25'),_0xdf42('0x26'),_0xdf42('0x4f'),util[_0xdf42('0x27')](_0xd640d8,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xdf42('0x25'),_0xdf42('0x26'),_0xdf42('0x4f'),_0xdf42('0x50'));}}else{logger[_0xdf42('0x17')](_0xdf42('0x25'),'afterCreate',_0xdf42('0x4f'),'Missing\x20parameters:\x20username,\x20password');}case _0xdf42('0x51'):var _0x38ca0c=require('crypto');if(_0x337443['apiKey']){var _0x2b57d5={};_0x2b57d5['login']=_0x337443[_0xdf42('0x2c')];_0x2b57d5['phone']=_0x5080dc[_0xdf42('0x20')];_0x2b57d5[_0xdf42('0x52')]=_0x337443[_0xdf42('0x20')];_0x2b57d5[_0xdf42('0x53')]=_0x5080dc[_0xdf42('0x15')];_0x2b57d5[_0xdf42('0x54')]=+new Date();var _0x5f38fb='';var _0x4ffd84='';var _0x514bf5=Object['keys'](_0x2b57d5);_0x514bf5[_0xdf42('0x55')]();for(var _0xf4b0bf=0x0;_0xf4b0bf<_0x514bf5[_0xdf42('0x56')];_0xf4b0bf++){if(_0x5f38fb!=''){_0x5f38fb+='&';}_0x5f38fb+=_0x514bf5[_0xf4b0bf]+'='+encodeURIComponent(_0x2b57d5[_0x514bf5[_0xf4b0bf]]);_0x4ffd84+=_0x2b57d5[_0x514bf5[_0xf4b0bf]];}_0x4ffd84+=_0x337443[_0xdf42('0x57')];_0x4ffd84=_0x38ca0c[_0xdf42('0x58')](_0xdf42('0x59'))[_0xdf42('0x14')](_0x4ffd84)[_0xdf42('0x5a')]('hex');if(_0x5f38fb!==''){_0x5f38fb+='&';}_0x5f38fb+=_0xdf42('0x5b')+_0x4ffd84;var _0x4dabda={'method':_0xdf42('0x2d'),'uri':_0xdf42('0x5c')+_0x5f38fb,'json':!![]};return rp(_0x4dabda)['then'](function(_0x844623){var _0x55ad32=Object[_0xdf42('0x5d')](_0x844623);if(_0x844623[_0x55ad32[0x0]]['error']&&parseInt(_0x844623[_0x55ad32[0x0]][_0xdf42('0x17')])===0x0){var _0x493c88={'messageId':_0x844623[_0x55ad32[0x0]]['id_sms']};if(!_0x337443[_0xdf42('0x34')]){_0x493c88[_0xdf42('0x35')]=!![];}return _0x3319ba[_0xdf42('0x14')](_0x493c88);}else{return logger[_0xdf42('0x17')](_0xdf42('0x25'),_0xdf42('0x26'),_0xdf42('0x51'),util[_0xdf42('0x27')](_0x844623[_0xdf42('0x17')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x55b40f){return logger[_0xdf42('0x17')](_0xdf42('0x25'),_0xdf42('0x26'),_0xdf42('0x51'),util[_0xdf42('0x27')](_0x55b40f,{'showHidden':![],'depth':null}));});}else{logger[_0xdf42('0x17')](_0xdf42('0x25'),_0xdf42('0x26'),_0xdf42('0x51'),_0xdf42('0x5e'));}case'clickatell':if(_0x337443[_0xdf42('0x57')]){var _0x6b8e38={'method':_0xdf42('0x30'),'uri':_0xdf42('0x5f'),'headers':{'Authorization':_0x337443[_0xdf42('0x57')]},'body':{'content':_0x5080dc['body'],'to':[_0x5080dc['phone']],'from':_0x337443[_0xdf42('0x20')],'binary':![],'clientMessageId':_0xdf42('0x60'),'charset':_0xdf42('0x61')},'json':!![]};rp(_0x6b8e38)[_0xdf42('0x13')](function(_0x571a58){if(!_0x571a58[_0xdf42('0x17')]){var _0x4ceb31={'messageId':_0x571a58['messages'][0x0]['apiMessageId']};if(!_0x337443[_0xdf42('0x34')]){_0x4ceb31[_0xdf42('0x35')]=!![];}return _0x3319ba['update'](_0x4ceb31);}else{return logger[_0xdf42('0x17')](_0xdf42('0x25'),'afterCreate','clickatell',util['inspect'](_0x571a58['error'],{'showHidden':![],'depth':null}));}})[_0xdf42('0x16')](function(_0x1edb43){return logger[_0xdf42('0x17')](_0xdf42('0x25'),_0xdf42('0x26'),_0xdf42('0x62'),util[_0xdf42('0x27')](_0x1edb43,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xdf42('0x25'),_0xdf42('0x26'),_0xdf42('0x62'),'Missing\x20parameters:\x20apiKey');}break;case _0xdf42('0x63'):if(_0x337443[_0xdf42('0x57')]){var _0x27b644={};var _0x4dabda={'method':_0xdf42('0x30'),'uri':_0xdf42('0x64'),'headers':{'Authorization':_0xdf42('0x65')+_0x337443[_0xdf42('0x57')],'Content-Type':_0xdf42('0x66')},'body':{'from':_0x337443[_0xdf42('0x20')],'to':_0x5080dc['phone'],'text':_0x5080dc[_0xdf42('0x15')]},'json':!![]};return rp(_0x4dabda)[_0xdf42('0x13')](function(_0x3f2c4d){if(_0x3f2c4d[_0xdf42('0x67')]==0xca){_0x27b644[_0xdf42('0x68')]=_0x3f2c4d;var _0x4016c3={'method':_0xdf42('0x30'),'uri':_0xdf42('0x69'),'headers':{'Authorization':_0xdf42('0x65')+_0x337443[_0xdf42('0x57')],'Content-Type':'application/json'},'body':{'refid':_0x27b644[_0xdf42('0x68')][_0xdf42('0x6a')]},'json':!![]};return rp(_0x4016c3)[_0xdf42('0x13')](function(_0x1d683b){_0x27b644[_0xdf42('0x6b')]=_0x1d683b;var _0x1dfce7={'messageId':_0x27b644['message'][_0xdf42('0x6a')],'read':!![]};return _0x3319ba[_0xdf42('0x14')](_0x1dfce7);});}else{return logger[_0xdf42('0x17')](_0xdf42('0x25'),_0xdf42('0x26'),_0xdf42('0x63'),util[_0xdf42('0x27')](_0x3f2c4d,{'showHidden':![],'depth':null}));}})[_0xdf42('0x16')](function(_0x1784f7){return logger[_0xdf42('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdf42('0x26'),_0xdf42('0x63'),util[_0xdf42('0x27')](_0x1784f7,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xdf42('0x63'),_0xdf42('0x6c'));}break;}}})[_0xdf42('0x6d')](function(){_0x19c839();});}else{_0x19c839();}}},'charset':_0xdf42('0x6e'),'collate':_0xdf42('0x6f')});};
\ No newline at end of file
index e59f205..078a090 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7fe2=['then','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','info','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request'];(function(_0x5d705e,_0x112925){var _0x5054b2=function(_0x1d0447){while(--_0x1d0447){_0x5d705e['push'](_0x5d705e['shift']());}};_0x5054b2(++_0x112925);}(_0x7fe2,0xb5));var _0x27fe=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x7fe2[_0xaa0309];return _0x5de7ce;};'use strict';var _=require('lodash');var util=require(_0x27fe('0x0'));var moment=require(_0x27fe('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x27fe('0x2'));var db=require(_0x27fe('0x3'))['db'];var utils=require(_0x27fe('0x4'));var logger=require(_0x27fe('0x5'))(_0x27fe('0x6'));var config=require(_0x27fe('0x7'));var jayson=require(_0x27fe('0x8'));var client=jayson[_0x27fe('0x9')]['http']({'port':0x232a});config[_0x27fe('0xa')]=_[_0x27fe('0xb')](config['redis'],{'host':_0x27fe('0xc'),'port':0x18eb});var socket=require(_0x27fe('0xd'))(new Redis(config[_0x27fe('0xa')]));require(_0x27fe('0xe'))[_0x27fe('0xf')](socket);function respondWithRpcPromise(_0x21d769,_0x86cd51,_0xe7b322){return new BPromise(function(_0x27bb65,_0x4ce56a){return client[_0x27fe('0x10')](_0x21d769,_0xe7b322)[_0x27fe('0x11')](function(_0xf01ad6){logger['info']('SmsMessage,\x20%s,\x20%s',_0x86cd51,'request\x20sent');logger[_0x27fe('0x12')](_0x27fe('0x13'),_0x86cd51,'request\x20sent',JSON[_0x27fe('0x14')](_0xf01ad6));if(_0xf01ad6[_0x27fe('0x15')]){if(_0xf01ad6[_0x27fe('0x15')][_0x27fe('0x16')]===0x1f4){logger[_0x27fe('0x15')](_0x27fe('0x17'),_0x86cd51,_0xf01ad6[_0x27fe('0x15')]['message']);return _0x4ce56a(_0xf01ad6[_0x27fe('0x15')][_0x27fe('0x18')]);}logger[_0x27fe('0x15')](_0x27fe('0x17'),_0x86cd51,_0xf01ad6[_0x27fe('0x15')]['message']);return _0x27bb65(_0xf01ad6[_0x27fe('0x15')][_0x27fe('0x18')]);}else{logger['info'](_0x27fe('0x17'),_0x86cd51,'request\x20sent');_0x27bb65(_0xf01ad6['result'][_0x27fe('0x18')]);}})[_0x27fe('0x19')](function(_0x6c3a32){logger[_0x27fe('0x15')](_0x27fe('0x17'),_0x86cd51,_0x6c3a32);_0x4ce56a(_0x6c3a32);});});}exports[_0x27fe('0x1a')]=function(_0x552a8a){var _0x121051=this;return new Promise(function(_0xa02a0,_0x4c61b9){return db[_0x27fe('0x1b')][_0x27fe('0x1c')](_0x552a8a[_0x27fe('0x1d')],{'raw':_0x552a8a['options']?_0x552a8a[_0x27fe('0x1e')][_0x27fe('0x1f')]===undefined?!![]:![]:!![]})[_0x27fe('0x11')](function(_0x5edf05){logger[_0x27fe('0x20')]('CreateSmsMessage',_0x552a8a);logger[_0x27fe('0x12')](_0x27fe('0x1a'),_0x552a8a,JSON['stringify'](_0x5edf05));_0xa02a0(_0x5edf05);})[_0x27fe('0x19')](function(_0x2d36b6){logger[_0x27fe('0x15')](_0x27fe('0x1a'),_0x2d36b6['message'],_0x552a8a);_0x4c61b9(_0x121051[_0x27fe('0x15')](0x1f4,_0x2d36b6[_0x27fe('0x18')]));});});};
\ No newline at end of file
+var _0x2919=['CreateSmsMessage','SmsMessage','body','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsMessage.socket','request','then','info','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsMessage,\x20%s,\x20%s','message'];(function(_0x221b7d,_0x10fe06){var _0x3fea69=function(_0x8d5b81){while(--_0x8d5b81){_0x221b7d['push'](_0x221b7d['shift']());}};_0x3fea69(++_0x10fe06);}(_0x2919,0x14e));var _0x9291=function(_0x36186b,_0x3dd6a7){_0x36186b=_0x36186b-0x0;var _0x5476b6=_0x2919[_0x36186b];return _0x5476b6;};'use strict';var _=require(_0x9291('0x0'));var util=require(_0x9291('0x1'));var moment=require(_0x9291('0x2'));var BPromise=require('bluebird');var rs=require(_0x9291('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9291('0x4'))['db'];var utils=require(_0x9291('0x5'));var logger=require(_0x9291('0x6'))(_0x9291('0x7'));var config=require(_0x9291('0x8'));var jayson=require(_0x9291('0x9'));var client=jayson[_0x9291('0xa')][_0x9291('0xb')]({'port':0x232a});config[_0x9291('0xc')]=_[_0x9291('0xd')](config[_0x9291('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x9291('0xe'))(new Redis(config[_0x9291('0xc')]));require(_0x9291('0xf'))['register'](socket);function respondWithRpcPromise(_0x582603,_0x4dc508,_0x5e4085){return new BPromise(function(_0x34aa99,_0x276d3a){return client[_0x9291('0x10')](_0x582603,_0x5e4085)[_0x9291('0x11')](function(_0x4d3594){logger[_0x9291('0x12')]('SmsMessage,\x20%s,\x20%s',_0x4dc508,'request\x20sent');logger['debug'](_0x9291('0x13'),_0x4dc508,_0x9291('0x14'),JSON[_0x9291('0x15')](_0x4d3594));if(_0x4d3594['error']){if(_0x4d3594[_0x9291('0x16')][_0x9291('0x17')]===0x1f4){logger[_0x9291('0x16')](_0x9291('0x18'),_0x4dc508,_0x4d3594[_0x9291('0x16')][_0x9291('0x19')]);return _0x276d3a(_0x4d3594[_0x9291('0x16')][_0x9291('0x19')]);}logger[_0x9291('0x16')](_0x9291('0x18'),_0x4dc508,_0x4d3594['error']['message']);return _0x34aa99(_0x4d3594['error']['message']);}else{logger['info'](_0x9291('0x18'),_0x4dc508,'request\x20sent');_0x34aa99(_0x4d3594['result'][_0x9291('0x19')]);}})['catch'](function(_0x305903){logger['error'](_0x9291('0x18'),_0x4dc508,_0x305903);_0x276d3a(_0x305903);});});}exports[_0x9291('0x1a')]=function(_0x5c3d07){var _0x4b84db=this;return new Promise(function(_0x226835,_0x302931){return db[_0x9291('0x1b')]['create'](_0x5c3d07[_0x9291('0x1c')],{'raw':_0x5c3d07['options']?_0x5c3d07['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x13a522){logger[_0x9291('0x12')](_0x9291('0x1a'),_0x5c3d07);logger['debug'](_0x9291('0x1a'),_0x5c3d07,JSON[_0x9291('0x15')](_0x13a522));_0x226835(_0x13a522);})[_0x9291('0x1d')](function(_0xf2d670){logger['error'](_0x9291('0x1a'),_0xf2d670[_0x9291('0x19')],_0x5c3d07);_0x302931(_0x4b84db[_0x9291('0x16')](0x1f4,_0xf2d670[_0x9291('0x19')]));});});};
\ No newline at end of file
index c90f034..85d8232 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5178=['save','update','removeListener','register','length','smsMessage:','./smsMessage.events'];(function(_0x2c4b84,_0x18bc7d){var _0x5b0888=function(_0x19d4c8){while(--_0x19d4c8){_0x2c4b84['push'](_0x2c4b84['shift']());}};_0x5b0888(++_0x18bc7d);}(_0x5178,0x195));var _0x8517=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x5178[_0x397e5f];return _0x5302b8;};'use strict';var SmsMessageEvents=require(_0x8517('0x0'));var events=[_0x8517('0x1'),'remove',_0x8517('0x2')];function createListener(_0x2e12e8,_0xf62ebc){return function(_0x69ae2d){_0xf62ebc['emit'](_0x2e12e8,_0x69ae2d);};}function removeListener(_0x3f219e,_0x53a242){return function(){SmsMessageEvents[_0x8517('0x3')](_0x3f219e,_0x53a242);};}exports[_0x8517('0x4')]=function(_0xd6a8b){for(var _0x1a928a=0x0,_0x3a165c=events[_0x8517('0x5')];_0x1a928a<_0x3a165c;_0x1a928a++){var _0x598ab9=events[_0x1a928a];var _0x5d1ef2=createListener(_0x8517('0x6')+_0x598ab9,_0xd6a8b);SmsMessageEvents['on'](_0x598ab9,_0x5d1ef2);}};
\ No newline at end of file
+var _0x42aa=['./smsMessage.events','emit','removeListener','smsMessage:'];(function(_0x3d0332,_0x4edd87){var _0x38f85e=function(_0x318be7){while(--_0x318be7){_0x3d0332['push'](_0x3d0332['shift']());}};_0x38f85e(++_0x4edd87);}(_0x42aa,0x118));var _0xa42a=function(_0x4e88ce,_0x5e85b6){_0x4e88ce=_0x4e88ce-0x0;var _0x11811f=_0x42aa[_0x4e88ce];return _0x11811f;};'use strict';var SmsMessageEvents=require(_0xa42a('0x0'));var events=['save','remove','update'];function createListener(_0x436843,_0x22fe6c){return function(_0xd62fb5){_0x22fe6c[_0xa42a('0x1')](_0x436843,_0xd62fb5);};}function removeListener(_0x5f0890,_0x427d63){return function(){SmsMessageEvents[_0xa42a('0x2')](_0x5f0890,_0x427d63);};}exports['register']=function(_0x18994a){for(var _0x1a55e1=0x0,_0x490bc6=events['length'];_0x1a55e1<_0x490bc6;_0x1a55e1++){var _0x5e845a=events[_0x1a55e1];var _0x1bc195=createListener(_0xa42a('0x3')+_0x5e845a,_0x18994a);SmsMessageEvents['on'](_0x5e845a,_0x1bc195);}};
\ No newline at end of file
index b5cc93c..7ac6d53 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x50b3=['path','connect-timeout','express','Router','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','/:id/teams','removeTeams','delete','removeAgents','multer'];(function(_0x680b65,_0x5b2e9c){var _0x1c2053=function(_0x1128e0){while(--_0x1128e0){_0x680b65['push'](_0x680b65['shift']());}};_0x1c2053(++_0x5b2e9c);}(_0x50b3,0x133));var _0x350b=function(_0x54945e,_0x42f71a){_0x54945e=_0x54945e-0x0;var _0x36eabd=_0x50b3[_0x54945e];return _0x36eabd;};'use strict';var multer=require(_0x350b('0x0'));var util=require('util');var path=require(_0x350b('0x1'));var timeout=require(_0x350b('0x2'));var express=require(_0x350b('0x3'));var router=express[_0x350b('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x350b('0x5'));var controller=require('./smsQueue.controller');router[_0x350b('0x6')]('/',auth['isAuthenticated'](),controller[_0x350b('0x7')]);router[_0x350b('0x6')](_0x350b('0x8'),auth[_0x350b('0x9')](),controller[_0x350b('0xa')]);router['get'](_0x350b('0xb'),auth[_0x350b('0x9')](),controller[_0x350b('0xc')]);router[_0x350b('0x6')](_0x350b('0xd'),auth[_0x350b('0x9')](),controller[_0x350b('0xe')]);router['get']('/:id/teams',auth[_0x350b('0x9')](),controller[_0x350b('0xf')]);router[_0x350b('0x6')](_0x350b('0x10'),auth[_0x350b('0x9')](),controller[_0x350b('0x11')]);router[_0x350b('0x12')]('/',auth['isAuthenticated'](),controller[_0x350b('0x13')]);router[_0x350b('0x12')]('/:id/teams',auth[_0x350b('0x9')](),controller[_0x350b('0x14')]);router['post'](_0x350b('0x10'),auth[_0x350b('0x9')](),controller[_0x350b('0x15')]);router[_0x350b('0x16')]('/:id',auth[_0x350b('0x9')](),controller[_0x350b('0x17')]);router['delete'](_0x350b('0xb'),auth[_0x350b('0x9')](),controller['destroy']);router['delete'](_0x350b('0x18'),auth[_0x350b('0x9')](),controller[_0x350b('0x19')]);router[_0x350b('0x1a')](_0x350b('0x10'),auth['isAuthenticated'](),controller[_0x350b('0x1b')]);module['exports']=router;
\ No newline at end of file
+var _0x8a21=['addTeams','/:id','delete','removeTeams','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','describe','show','/:id/members','/:id/teams','/:id/users','getAgents','post','create'];(function(_0x5043f3,_0x3be189){var _0x4e712c=function(_0x5bfc32){while(--_0x5bfc32){_0x5043f3['push'](_0x5043f3['shift']());}};_0x4e712c(++_0x3be189);}(_0x8a21,0x184));var _0x18a2=function(_0x2bbc07,_0x1e2168){_0x2bbc07=_0x2bbc07-0x0;var _0x6879e4=_0x8a21[_0x2bbc07];return _0x6879e4;};'use strict';var multer=require(_0x18a2('0x0'));var util=require(_0x18a2('0x1'));var path=require('path');var timeout=require(_0x18a2('0x2'));var express=require(_0x18a2('0x3'));var router=express[_0x18a2('0x4')]();var auth=require(_0x18a2('0x5'));var interaction=require(_0x18a2('0x6'));var config=require(_0x18a2('0x7'));var controller=require(_0x18a2('0x8'));router[_0x18a2('0x9')]('/',auth[_0x18a2('0xa')](),controller[_0x18a2('0xb')]);router['get']('/describe',auth[_0x18a2('0xa')](),controller[_0x18a2('0xc')]);router[_0x18a2('0x9')]('/:id',auth[_0x18a2('0xa')](),controller[_0x18a2('0xd')]);router[_0x18a2('0x9')](_0x18a2('0xe'),auth[_0x18a2('0xa')](),controller['getMembers']);router[_0x18a2('0x9')](_0x18a2('0xf'),auth['isAuthenticated'](),controller['getTeams']);router[_0x18a2('0x9')](_0x18a2('0x10'),auth[_0x18a2('0xa')](),controller[_0x18a2('0x11')]);router[_0x18a2('0x12')]('/',auth[_0x18a2('0xa')](),controller[_0x18a2('0x13')]);router[_0x18a2('0x12')]('/:id/teams',auth['isAuthenticated'](),controller[_0x18a2('0x14')]);router[_0x18a2('0x12')](_0x18a2('0x10'),auth[_0x18a2('0xa')](),controller['addAgents']);router['put'](_0x18a2('0x15'),auth[_0x18a2('0xa')](),controller['update']);router[_0x18a2('0x16')]('/:id',auth[_0x18a2('0xa')](),controller['destroy']);router[_0x18a2('0x16')](_0x18a2('0xf'),auth['isAuthenticated'](),controller[_0x18a2('0x17')]);router[_0x18a2('0x16')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router;
\ No newline at end of file
index ca1ac07..da7d446 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4d53=['rrmemory','beepall','roundrobin','exports','STRING','name','INTEGER','ENUM'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x4d53,0x1e3));var _0x34d5=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4d53[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require('sequelize');module[_0x34d5('0x0')]={'name':{'type':Sequelize[_0x34d5('0x1')],'unique':_0x34d5('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x34d5('0x1')]},'timeout':{'type':Sequelize[_0x34d5('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x34d5('0x4')](_0x34d5('0x5'),_0x34d5('0x6'),_0x34d5('0x7'))}};
\ No newline at end of file
+var _0x9d58=['roundrobin','sequelize','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x2ce286,_0x4104e4){var _0x4c471f=function(_0x43326c){while(--_0x43326c){_0x2ce286['push'](_0x2ce286['shift']());}};_0x4c471f(++_0x4104e4);}(_0x9d58,0x179));var _0x89d5=function(_0x56d1b5,_0x289333){_0x56d1b5=_0x56d1b5-0x0;var _0x4ad91e=_0x9d58[_0x56d1b5];return _0x4ad91e;};'use strict';var Sequelize=require(_0x89d5('0x0'));module['exports']={'name':{'type':Sequelize[_0x89d5('0x1')],'unique':_0x89d5('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x89d5('0x1')]},'timeout':{'type':Sequelize[_0x89d5('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x89d5('0x4')](_0x89d5('0x5'),_0x89d5('0x6'),_0x89d5('0x7'))}};
\ No newline at end of file
index a18dc0b..ceff7b9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5997=['sort','where','pick','filters','filter','merge','map','type','VIRTUAL','options','count','rows','params','includeAll','include','catch','create','body','role','user','SmsQueues','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserSmsQueue','nolimit','SmsQueueId','findAll','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','SIP','getTeams','findOne','Team','addTeams','ids','Agents','union','addAgents','penalty','removeTeams','User','removeAgents','omit','userSmsQueue:save','isArray','emit','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','squel','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./smsQueue.socket','register','sendStatus','status','end','offset','limit','json','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','SmsQueue','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x5997,0xa8));var _0x7599=function(_0x11b5d5,_0x272aae){_0x11b5d5=_0x11b5d5-0x0;var _0xb632f9=_0x5997[_0x11b5d5];return _0xb632f9;};'use strict';var pdf=require(_0x7599('0x0'));var emlformat=require(_0x7599('0x1'));var rimraf=require(_0x7599('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7599('0x3'));var rp=require(_0x7599('0x4'));var moment=require(_0x7599('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7599('0x6'));var path=require(_0x7599('0x7'));var sox=require('sox');var csv=require(_0x7599('0x8'));var ejs=require(_0x7599('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7599('0xa'));var crypto=require(_0x7599('0xb'));var jsforce=require(_0x7599('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7599('0x8'));var querystring=require('querystring');var Papa=require(_0x7599('0xd'));var authService=require(_0x7599('0xe'));var hardwareService=require(_0x7599('0xf'));var Redis=require('ioredis');var qs=require(_0x7599('0x10'));var logger=require(_0x7599('0x11'))(_0x7599('0x12'));var utils=require(_0x7599('0x13'));var config=require(_0x7599('0x14'));var db=require(_0x7599('0x15'))['db'];config[_0x7599('0x16')]=_['defaults'](config[_0x7599('0x16')],{'host':_0x7599('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7599('0x16')]));require(_0x7599('0x18'))[_0x7599('0x19')](socket);function respondWithStatusCode(_0x4f5cae,_0x47c9ff){_0x47c9ff=_0x47c9ff||0xcc;return function(_0x25cfd1){if(_0x25cfd1){return _0x4f5cae[_0x7599('0x1a')](_0x47c9ff);}return _0x4f5cae[_0x7599('0x1b')](_0x47c9ff)[_0x7599('0x1c')]();};}function respondWithResult(_0x4c47d2,_0x63d2b7){_0x63d2b7=_0x63d2b7||0xc8;return function(_0x33ab60){if(_0x33ab60){return _0x4c47d2[_0x7599('0x1b')](_0x63d2b7)['json'](_0x33ab60);}};}function respondWithFilteredResult(_0xab644f,_0x23c695){return function(_0x325a31){if(_0x325a31){var _0x1e2e0a=_0x325a31['count'],_0xdb69a2=_0x23c695[_0x7599('0x1d')],_0x164795=_0x23c695[_0x7599('0x1d')]+_0x23c695[_0x7599('0x1e')],_0x1336e4;if(_0x164795>=_0x1e2e0a){_0x164795=_0x1e2e0a;_0x1336e4=0xc8;}else{_0x1336e4=0xce;}_0xab644f[_0x7599('0x1b')](_0x1336e4);return _0xab644f['set']('Content-Range',_0xdb69a2+'-'+_0x164795+'/'+_0x1e2e0a)[_0x7599('0x1f')](_0x325a31);}return null;};}function patchUpdates(_0x3f763f){return function(_0x5cedc4){try{jsonpatch[_0x7599('0x20')](_0x5cedc4,_0x3f763f,!![]);}catch(_0x1fde44){return BPromise[_0x7599('0x21')](_0x1fde44);}return _0x5cedc4[_0x7599('0x22')]();};}function saveUpdates(_0x2bb8f7,_0xd830e0){return function(_0x76baa0){if(_0x76baa0){return _0x76baa0[_0x7599('0x23')](_0x2bb8f7)[_0x7599('0x24')](function(_0x464bed){return _0x464bed;});}return null;};}function removeEntity(_0x598ff6,_0x190841){return function(_0x404650){if(_0x404650){return _0x404650['destroy']()[_0x7599('0x24')](function(){var _0x5d920f=_0x404650[_0x7599('0x25')]({'plain':!![]});var _0x458de8='SmsQueues';return db[_0x7599('0x26')][_0x7599('0x27')]({'where':{'type':_0x458de8,'resourceId':_0x5d920f['id']}})['then'](function(){return _0x404650;});})[_0x7599('0x24')](function(){_0x598ff6[_0x7599('0x1b')](0xcc)[_0x7599('0x1c')]();});}};}function handleEntityNotFound(_0x1de442,_0x4a6bd4){return function(_0x13db90){if(!_0x13db90){_0x1de442['sendStatus'](0x194);}return _0x13db90;};}function handleError(_0x5893c4,_0x2123a3){_0x2123a3=_0x2123a3||0x1f4;return function(_0x58505c){logger[_0x7599('0x28')](_0x58505c[_0x7599('0x29')]);if(_0x58505c[_0x7599('0x2a')]){delete _0x58505c[_0x7599('0x2a')];}_0x5893c4['status'](_0x2123a3)[_0x7599('0x2b')](_0x58505c);};}exports[_0x7599('0x2c')]=function(_0x144ecc,_0x38cece){var _0x592273={},_0x5b0dff={},_0x57daeb={'count':0x0,'rows':[]};var _0x38a6d7=db[_0x7599('0x2d')][_0x7599('0x2e')];_0x5b0dff[_0x7599('0x2f')]=_[_0x7599('0x30')](_0x38a6d7);_0x5b0dff[_0x7599('0x31')]=_['keys'](_0x144ecc[_0x7599('0x31')]);_0x5b0dff['filters']=_[_0x7599('0x32')](_0x5b0dff[_0x7599('0x2f')],_0x5b0dff['query']);_0x592273[_0x7599('0x33')]=_['intersection'](_0x5b0dff[_0x7599('0x2f')],qs[_0x7599('0x34')](_0x144ecc['query'][_0x7599('0x34')]));_0x592273[_0x7599('0x33')]=_0x592273[_0x7599('0x33')][_0x7599('0x35')]?_0x592273['attributes']:_0x5b0dff[_0x7599('0x2f')];if(!_0x144ecc[_0x7599('0x31')][_0x7599('0x36')]('nolimit')){_0x592273[_0x7599('0x1e')]=qs[_0x7599('0x1e')](_0x144ecc[_0x7599('0x31')][_0x7599('0x1e')]);_0x592273[_0x7599('0x1d')]=qs[_0x7599('0x1d')](_0x144ecc[_0x7599('0x31')][_0x7599('0x1d')]);}_0x592273[_0x7599('0x37')]=qs[_0x7599('0x38')](_0x144ecc[_0x7599('0x31')]['sort']);_0x592273[_0x7599('0x39')]=qs['filters'](_[_0x7599('0x3a')](_0x144ecc[_0x7599('0x31')],_0x5b0dff[_0x7599('0x3b')]));if(_0x144ecc['query'][_0x7599('0x3c')]){_0x592273[_0x7599('0x39')]=_[_0x7599('0x3d')](_0x592273[_0x7599('0x39')],{'$or':_[_0x7599('0x3e')](_0x38a6d7,function(_0x543998){if(_0x543998[_0x7599('0x3f')]['key']!==_0x7599('0x40')){var _0x487076={};_0x487076[_0x543998['field']]={'$like':'%'+_0x144ecc[_0x7599('0x31')][_0x7599('0x3c')]+'%'};return _0x487076;}})});}_0x592273=_['merge']({},_0x592273,_0x144ecc[_0x7599('0x41')]);var _0x119080={'where':_0x592273[_0x7599('0x39')]};return db[_0x7599('0x2d')][_0x7599('0x42')](_0x119080)[_0x7599('0x24')](function(_0x603411){_0x57daeb[_0x7599('0x42')]=_0x603411;if(_0x144ecc[_0x7599('0x31')]['includeAll']){_0x592273['include']=[{'all':!![]}];}return db[_0x7599('0x2d')]['findAll'](_0x592273);})['then'](function(_0x2c53cd){_0x57daeb[_0x7599('0x43')]=_0x2c53cd;return _0x57daeb;})[_0x7599('0x24')](respondWithFilteredResult(_0x38cece,_0x592273))['catch'](handleError(_0x38cece,null));};exports['show']=function(_0x15c2e3,_0x523c80){var _0x3bc983={'raw':!![],'where':{'id':_0x15c2e3[_0x7599('0x44')]['id']}},_0x3381e6={};_0x3381e6[_0x7599('0x2f')]=_[_0x7599('0x30')](db['SmsQueue'][_0x7599('0x2e')]);_0x3381e6[_0x7599('0x31')]=_[_0x7599('0x30')](_0x15c2e3[_0x7599('0x31')]);_0x3381e6[_0x7599('0x3b')]=_[_0x7599('0x32')](_0x3381e6[_0x7599('0x2f')],_0x3381e6[_0x7599('0x31')]);_0x3bc983[_0x7599('0x33')]=_[_0x7599('0x32')](_0x3381e6[_0x7599('0x2f')],qs[_0x7599('0x34')](_0x15c2e3[_0x7599('0x31')]['fields']));_0x3bc983['attributes']=_0x3bc983[_0x7599('0x33')]['length']?_0x3bc983[_0x7599('0x33')]:_0x3381e6['model'];if(_0x15c2e3[_0x7599('0x31')][_0x7599('0x45')]){_0x3bc983[_0x7599('0x46')]=[{'all':!![]}];}_0x3bc983=_[_0x7599('0x3d')]({},_0x3bc983,_0x15c2e3['options']);return db[_0x7599('0x2d')]['find'](_0x3bc983)[_0x7599('0x24')](handleEntityNotFound(_0x523c80,null))['then'](respondWithResult(_0x523c80,null))[_0x7599('0x47')](handleError(_0x523c80,null));};exports[_0x7599('0x48')]=function(_0x596612,_0x6d39f1){return db['SmsQueue'][_0x7599('0x48')](_0x596612[_0x7599('0x49')],{})[_0x7599('0x24')](function(_0xa19c61){var _0xb08a9b=_0x596612['user'][_0x7599('0x25')]({'plain':!![]});if(!_0xb08a9b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb08a9b[_0x7599('0x4a')]===_0x7599('0x4b')){var _0x4ddcfd=_0xa19c61[_0x7599('0x25')]({'plain':!![]});var _0xad549a=_0x7599('0x4c');return db[_0x7599('0x4d')][_0x7599('0x4e')]({'where':{'name':_0xad549a,'userProfileId':_0xb08a9b[_0x7599('0x4f')]},'raw':!![]})[_0x7599('0x24')](function(_0xbfa348){if(_0xbfa348&&_0xbfa348['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4ddcfd['name'],'resourceId':_0x4ddcfd['id'],'type':_0xbfa348[_0x7599('0x2a')],'sectionId':_0xbfa348['id']},{})['then'](function(){return _0xa19c61;});}else{return _0xa19c61;}})[_0x7599('0x47')](function(_0xcd5ad2){logger[_0x7599('0x28')](_0x7599('0x50'),_0xcd5ad2);throw _0xcd5ad2;});}return _0xa19c61;})['then'](respondWithResult(_0x6d39f1,0xc9))['catch'](handleError(_0x6d39f1,null));};exports['update']=function(_0x9412e3,_0x44e6fd){if(_0x9412e3[_0x7599('0x49')]['id']){delete _0x9412e3[_0x7599('0x49')]['id'];}return db[_0x7599('0x2d')][_0x7599('0x4e')]({'where':{'id':_0x9412e3[_0x7599('0x44')]['id']}})['then'](handleEntityNotFound(_0x44e6fd,null))['then'](saveUpdates(_0x9412e3[_0x7599('0x49')],null))[_0x7599('0x24')](respondWithResult(_0x44e6fd,null))[_0x7599('0x47')](handleError(_0x44e6fd,null));};exports[_0x7599('0x27')]=function(_0x2ffcc5,_0x26425c){return db[_0x7599('0x2d')][_0x7599('0x4e')]({'where':{'id':_0x2ffcc5[_0x7599('0x44')]['id']}})['then'](handleEntityNotFound(_0x26425c,null))[_0x7599('0x24')](removeEntity(_0x26425c,null))['catch'](handleError(_0x26425c,null));};exports[_0x7599('0x51')]=function(_0x256f75,_0x965ffe){return db[_0x7599('0x2d')][_0x7599('0x51')]()[_0x7599('0x24')](respondWithResult(_0x965ffe,null))[_0x7599('0x47')](handleError(_0x965ffe,null));};exports[_0x7599('0x52')]=function(_0x39bc26,_0x565f8b,_0x1ea6cc){var _0x109cd4={'raw':!![],'where':{}},_0x120ce2={},_0x36f87d;return db[_0x7599('0x2d')]['findOne']({'where':{'id':_0x39bc26['params']['id']}})[_0x7599('0x24')](handleEntityNotFound(_0x565f8b,null))['then'](function(_0x500248){if(_0x500248){_0x36f87d=_0x500248[_0x7599('0x25')]({'plain':!![]});_0x120ce2[_0x7599('0x2f')]=_[_0x7599('0x30')](db[_0x7599('0x53')][_0x7599('0x2e')]);_0x120ce2[_0x7599('0x31')]=_[_0x7599('0x30')](_0x39bc26[_0x7599('0x31')]);_0x120ce2['filters']=_[_0x7599('0x32')](_0x120ce2[_0x7599('0x2f')],_0x120ce2[_0x7599('0x31')]);_0x109cd4['attributes']=_[_0x7599('0x32')](_0x120ce2[_0x7599('0x2f')],qs[_0x7599('0x34')](_0x39bc26[_0x7599('0x31')][_0x7599('0x34')]));_0x109cd4[_0x7599('0x33')]=_0x109cd4[_0x7599('0x33')][_0x7599('0x35')]?_0x109cd4['attributes']:_0x120ce2[_0x7599('0x2f')];if(!_0x39bc26[_0x7599('0x31')][_0x7599('0x36')](_0x7599('0x54'))){_0x109cd4[_0x7599('0x1e')]=qs['limit'](_0x39bc26[_0x7599('0x31')]['limit']);_0x109cd4[_0x7599('0x1d')]=qs['offset'](_0x39bc26[_0x7599('0x31')][_0x7599('0x1d')]);}_0x109cd4[_0x7599('0x37')]=qs[_0x7599('0x38')](_0x39bc26[_0x7599('0x31')][_0x7599('0x38')]);_0x109cd4[_0x7599('0x39')]=qs['filters'](_[_0x7599('0x3a')](_0x39bc26['query'],_0x120ce2[_0x7599('0x3b')]));_0x109cd4[_0x7599('0x39')][_0x7599('0x55')]=_0x500248['id'];if(_0x39bc26[_0x7599('0x31')][_0x7599('0x3c')]){_0x109cd4[_0x7599('0x39')]=_['merge'](_0x109cd4['where'],{'$or':_[_0x7599('0x3e')](_0x109cd4[_0x7599('0x33')],function(_0x524d98){var _0x127644={};_0x127644[_0x524d98]={'$like':'%'+_0x39bc26[_0x7599('0x31')][_0x7599('0x3c')]+'%'};return _0x127644;})});}_0x109cd4=_['merge']({},_0x109cd4,_0x39bc26[_0x7599('0x41')]);return db['UserSmsQueue'][_0x7599('0x56')](_0x109cd4);}})[_0x7599('0x24')](function(_0x4216ca){if(_0x4216ca){return db['User'][_0x7599('0x57')]({'where':{'id':_[_0x7599('0x3e')](_0x4216ca,_0x7599('0x58')),'role':_0x7599('0x59')},'attributes':['id',_0x7599('0x2a'),_0x7599('0x5a'),_0x7599('0x5b'),_0x7599('0x5c')]});}})[_0x7599('0x24')](function(_0x1c9407){if(_0x1c9407){return{'count':_0x1c9407[_0x7599('0x42')],'rows':_['map'](_0x1c9407[_0x7599('0x43')],function(_0x125e6){return{'membername':_0x125e6[_0x7599('0x2a')],'UserId':_0x125e6['id'],'queue_name':_0x36f87d[_0x7599('0x2a')],'SmsQueueId':_0x36f87d['id'],'interface':util[_0x7599('0x5d')]('%s/%s',_0x7599('0x5e'),_0x125e6[_0x7599('0x2a')]),'penalty':0x0,'paused':_0x125e6[_0x7599('0x5a')],'createdAt':_0x125e6[_0x7599('0x5c')],'updatedAt':_0x125e6[_0x7599('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7599('0x24')](respondWithFilteredResult(_0x565f8b,_0x109cd4))[_0x7599('0x47')](handleError(_0x565f8b,null));};exports[_0x7599('0x5f')]=function(_0x1c31f9,_0x25d7cb,_0x5eacc1){var _0x4fb3c1={};var _0x2c2beb={};var _0x148aca;var _0x297332;return db[_0x7599('0x2d')][_0x7599('0x60')]({'where':{'id':_0x1c31f9[_0x7599('0x44')]['id']}})[_0x7599('0x24')](handleEntityNotFound(_0x25d7cb,null))[_0x7599('0x24')](function(_0x183591){if(_0x183591){_0x148aca=_0x183591;_0x2c2beb[_0x7599('0x2f')]=_[_0x7599('0x30')](db[_0x7599('0x61')]['rawAttributes']);_0x2c2beb['query']=_[_0x7599('0x30')](_0x1c31f9[_0x7599('0x31')]);_0x2c2beb['filters']=_['intersection'](_0x2c2beb[_0x7599('0x2f')],_0x2c2beb[_0x7599('0x31')]);_0x4fb3c1[_0x7599('0x33')]=_['intersection'](_0x2c2beb['model'],qs[_0x7599('0x34')](_0x1c31f9[_0x7599('0x31')]['fields']));_0x4fb3c1[_0x7599('0x33')]=_0x4fb3c1['attributes'][_0x7599('0x35')]?_0x4fb3c1['attributes']:_0x2c2beb[_0x7599('0x2f')];_0x4fb3c1[_0x7599('0x37')]=qs['sort'](_0x1c31f9[_0x7599('0x31')]['sort']);_0x4fb3c1[_0x7599('0x39')]=qs[_0x7599('0x3b')](_[_0x7599('0x3a')](_0x1c31f9[_0x7599('0x31')],_0x2c2beb[_0x7599('0x3b')]));if(_0x1c31f9['query'][_0x7599('0x3c')]){_0x4fb3c1[_0x7599('0x39')]=_[_0x7599('0x3d')](_0x4fb3c1[_0x7599('0x39')],{'$or':_[_0x7599('0x3e')](_0x4fb3c1[_0x7599('0x33')],function(_0x5abae5){var _0x23b09c={};_0x23b09c[_0x5abae5]={'$like':'%'+_0x1c31f9[_0x7599('0x31')]['filter']+'%'};return _0x23b09c;})});}_0x4fb3c1=_['merge']({},_0x4fb3c1,_0x1c31f9[_0x7599('0x41')]);return _0x148aca['getTeams'](_0x4fb3c1);}})[_0x7599('0x24')](function(_0x5bb7d1){if(_0x5bb7d1){_0x297332=_0x5bb7d1[_0x7599('0x35')];if(!_0x1c31f9[_0x7599('0x31')][_0x7599('0x36')](_0x7599('0x54'))){_0x4fb3c1[_0x7599('0x1e')]=qs[_0x7599('0x1e')](_0x1c31f9[_0x7599('0x31')][_0x7599('0x1e')]);_0x4fb3c1[_0x7599('0x1d')]=qs[_0x7599('0x1d')](_0x1c31f9[_0x7599('0x31')][_0x7599('0x1d')]);}return _0x148aca['getTeams'](_0x4fb3c1);}})[_0x7599('0x24')](function(_0x2b4fef){if(_0x2b4fef){return _0x2b4fef?{'count':_0x297332,'rows':_0x2b4fef}:null;}})[_0x7599('0x24')](respondWithResult(_0x25d7cb,null))['catch'](handleError(_0x25d7cb,null));};exports[_0x7599('0x62')]=function(_0x2680bd,_0x54a61c,_0x58b596){var _0x142320=[];var _0x2005db;return db[_0x7599('0x61')][_0x7599('0x56')]({'where':{'id':_0x2680bd[_0x7599('0x49')][_0x7599('0x63')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7599('0x64'),'attributes':['id'],'raw':!![]}]})[_0x7599('0x24')](function(_0x58af96){if(_0x58af96){for(var _0x2b0f40=0x0;_0x2b0f40<_0x58af96['length'];_0x2b0f40+=0x1){for(var _0x2c01d6=0x0;_0x2c01d6<_0x58af96[_0x2b0f40][_0x7599('0x64')][_0x7599('0x35')];_0x2c01d6+=0x1){_0x142320=_[_0x7599('0x65')](_0x142320,[_0x58af96[_0x2b0f40]['Agents'][_0x2c01d6]['id']]);}}return _0x142320;}})[_0x7599('0x24')](function(_0x517b45){if(_0x517b45){return db[_0x7599('0x2d')][_0x7599('0x4e')]({'where':{'id':_0x2680bd[_0x7599('0x44')]['id']}});}})[_0x7599('0x24')](function(_0x49d0de){if(_0x49d0de){_0x2005db=_0x49d0de;return _0x2005db[_0x7599('0x66')](_0x142320,{'penalty':_0x2680bd[_0x7599('0x49')][_0x7599('0x67')]});}})[_0x7599('0x24')](function(_0x234205){if(_0x234205){return _0x2005db[_0x7599('0x62')](_0x2680bd['body'][_0x7599('0x63')]);}})['then'](handleEntityNotFound(_0x54a61c,null))[_0x7599('0x24')](respondWithStatusCode(_0x54a61c,null))[_0x7599('0x47')](handleError(_0x54a61c,null));};exports[_0x7599('0x68')]=function(_0x5e84e5,_0x10514d,_0x4231bc){var _0x258592=[];var _0x4db9cd;return db[_0x7599('0x61')][_0x7599('0x56')]({'where':{'id':_0x5e84e5['query'][_0x7599('0x63')]},'attributes':['id'],'include':[{'model':db[_0x7599('0x69')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](function(_0x4fb5e3){if(_0x4fb5e3){for(var _0x3c19ec=0x0;_0x3c19ec<_0x4fb5e3[_0x7599('0x35')];_0x3c19ec+=0x1){for(var _0x5946e1=0x0;_0x5946e1<_0x4fb5e3[_0x3c19ec][_0x7599('0x64')][_0x7599('0x35')];_0x5946e1+=0x1){_0x258592=_['union'](_0x258592,[_0x4fb5e3[_0x3c19ec][_0x7599('0x64')][_0x5946e1]['id']]);}}return _0x258592;}})[_0x7599('0x24')](function(_0xbc1693){if(_0xbc1693){return db[_0x7599('0x2d')][_0x7599('0x4e')]({'where':{'id':_0x5e84e5['params']['id']}});}})['then'](function(_0x4127d3){if(_0x4127d3){_0x4db9cd=_0x4127d3;return _0x4db9cd[_0x7599('0x6a')](_0x258592);}})[_0x7599('0x24')](function(_0x3e6194){if(_0x4db9cd){return _0x4db9cd[_0x7599('0x68')](_0x5e84e5[_0x7599('0x31')][_0x7599('0x63')]);}})[_0x7599('0x24')](handleEntityNotFound(_0x10514d,null))[_0x7599('0x24')](respondWithStatusCode(_0x10514d,null))['catch'](handleError(_0x10514d,null));};exports['addAgents']=function(_0x31e4e8,_0x4a104f,_0x1798e7){return db['SmsQueue'][_0x7599('0x4e')]({'where':{'id':_0x31e4e8[_0x7599('0x44')]['id']}})['then'](handleEntityNotFound(_0x4a104f,null))[_0x7599('0x24')](function(_0xda40f6){if(_0xda40f6){return _0xda40f6[_0x7599('0x66')](_0x31e4e8[_0x7599('0x49')][_0x7599('0x63')],_[_0x7599('0x6b')](_0x31e4e8[_0x7599('0x49')],[_0x7599('0x63'),'id'])||{})['spread'](function(_0x306574){for(var _0x58c37d=0x0;_0x58c37d<_0x31e4e8[_0x7599('0x49')][_0x7599('0x63')][_0x7599('0x35')];_0x58c37d+=0x1){socket['emit'](_0x7599('0x6c'),{'UserId':_0x31e4e8['body']['ids'][_0x58c37d],'SmsQueueId':_0x31e4e8[_0x7599('0x44')]['id']});}return _0x306574;});}})[_0x7599('0x24')](respondWithResult(_0x4a104f,null))['catch'](handleError(_0x4a104f,null));};exports[_0x7599('0x6a')]=function(_0xd41f0,_0x46624a,_0x3d28fa){var _0x55411d;return db[_0x7599('0x2d')]['find']({'where':{'id':_0xd41f0[_0x7599('0x44')]['id']}})['then'](handleEntityNotFound(_0x46624a,null))[_0x7599('0x24')](function(_0x27af85){if(_0x27af85){return _0x27af85[_0x7599('0x6a')](_0xd41f0[_0x7599('0x31')]['ids'])[_0x7599('0x24')](function(_0x56196b){if(_[_0x7599('0x6d')](_0xd41f0[_0x7599('0x31')][_0x7599('0x63')])){for(var _0x51a14d=0x0;_0x51a14d<_0xd41f0[_0x7599('0x31')][_0x7599('0x63')][_0x7599('0x35')];_0x51a14d+=0x1){socket[_0x7599('0x6e')]('userSmsQueue:remove',{'UserId':_0xd41f0[_0x7599('0x31')]['ids'][_0x51a14d],'SmsQueueId':_0xd41f0[_0x7599('0x44')]['id']});}}else{socket[_0x7599('0x6e')]('userSmsQueue:remove',{'UserId':_0xd41f0[_0x7599('0x31')][_0x7599('0x63')],'SmsQueueId':_0xd41f0['params']['id']});}});}})['then'](respondWithStatusCode(_0x46624a,null))[_0x7599('0x47')](handleError(_0x46624a,null));};exports[_0x7599('0x6f')]=function(_0x1cce1e,_0x6b336d,_0x411e4a){var _0x1ae7c2={};var _0x129ba2={};var _0x28ab57;var _0x1535b6;return db[_0x7599('0x2d')][_0x7599('0x60')]({'where':{'id':_0x1cce1e[_0x7599('0x44')]['id']}})[_0x7599('0x24')](handleEntityNotFound(_0x6b336d,null))[_0x7599('0x24')](function(_0x15a9f6){if(_0x15a9f6){_0x28ab57=_0x15a9f6;_0x129ba2[_0x7599('0x2f')]=_[_0x7599('0x30')](db[_0x7599('0x69')][_0x7599('0x2e')]);_0x129ba2['query']=_[_0x7599('0x30')](_0x1cce1e[_0x7599('0x31')]);_0x129ba2[_0x7599('0x3b')]=_['intersection'](_0x129ba2[_0x7599('0x2f')],_0x129ba2['query']);_0x1ae7c2[_0x7599('0x33')]=_[_0x7599('0x32')](_0x129ba2[_0x7599('0x2f')],qs[_0x7599('0x34')](_0x1cce1e[_0x7599('0x31')][_0x7599('0x34')]));_0x1ae7c2[_0x7599('0x33')]=_0x1ae7c2[_0x7599('0x33')]['length']?_0x1ae7c2['attributes']:_0x129ba2['model'];_0x1ae7c2['order']=qs[_0x7599('0x38')](_0x1cce1e[_0x7599('0x31')][_0x7599('0x38')]);_0x1ae7c2[_0x7599('0x39')]=qs[_0x7599('0x3b')](_['pick'](_0x1cce1e[_0x7599('0x31')],_0x129ba2[_0x7599('0x3b')]));if(_0x1cce1e[_0x7599('0x31')][_0x7599('0x3c')]){_0x1ae7c2['where']=_[_0x7599('0x3d')](_0x1ae7c2['where'],{'$or':_['map'](_0x1ae7c2[_0x7599('0x33')],function(_0x4d3732){var _0x376f36={};_0x376f36[_0x4d3732]={'$like':'%'+_0x1cce1e['query'][_0x7599('0x3c')]+'%'};return _0x376f36;})});}_0x1ae7c2=_['merge']({},_0x1ae7c2,_0x1cce1e[_0x7599('0x41')]);return _0x28ab57['getAgents'](_0x1ae7c2);}})['then'](function(_0x5cd8be){if(_0x5cd8be){_0x1535b6=_0x5cd8be[_0x7599('0x35')];if(!_0x1cce1e[_0x7599('0x31')][_0x7599('0x36')]('nolimit')){_0x1ae7c2[_0x7599('0x1e')]=qs[_0x7599('0x1e')](_0x1cce1e[_0x7599('0x31')]['limit']);_0x1ae7c2[_0x7599('0x1d')]=qs['offset'](_0x1cce1e[_0x7599('0x31')][_0x7599('0x1d')]);}return _0x28ab57[_0x7599('0x6f')](_0x1ae7c2);}})['then'](function(_0x367419){if(_0x367419){return _0x367419?{'count':_0x1535b6,'rows':_0x367419}:null;}})['then'](respondWithResult(_0x6b336d,null))[_0x7599('0x47')](handleError(_0x6b336d,null));};
\ No newline at end of file
+var _0x3cc9=['order','sort','where','pick','filter','merge','key','field','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','role','userProfileId','autoAssociation','error','describe','findOne','UserSmsQueue','SmsQueueId','map','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','SIP','getTeams','Team','options','ids','Agents','union','addAgents','penalty','removeTeams','removeAgents','omit','spread','emit','userSmsQueue:save','userSmsQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','redis','defaults','socket.io-emitter','./smsQueue.socket','register','sendStatus','end','status','json','offset','limit','Content-Range','reject','save','update','then','destroy','SmsQueues','UserProfileResource','stack','name','send','index','SmsQueue','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x3cc9,0x11a));var _0x93cc=function(_0x3adca5,_0x56bcf2){_0x3adca5=_0x3adca5-0x0;var _0x100ade=_0x3cc9[_0x3adca5];return _0x100ade;};'use strict';var pdf=require(_0x93cc('0x0'));var emlformat=require(_0x93cc('0x1'));var rimraf=require(_0x93cc('0x2'));var zipdir=require(_0x93cc('0x3'));var jsonpatch=require(_0x93cc('0x4'));var rp=require('request-promise');var moment=require(_0x93cc('0x5'));var BPromise=require(_0x93cc('0x6'));var Mustache=require(_0x93cc('0x7'));var util=require(_0x93cc('0x8'));var path=require('path');var sox=require(_0x93cc('0x9'));var csv=require(_0x93cc('0xa'));var ejs=require(_0x93cc('0xb'));var fs=require('fs');var _=require(_0x93cc('0xc'));var squel=require(_0x93cc('0xd'));var crypto=require(_0x93cc('0xe'));var jsforce=require(_0x93cc('0xf'));var deskjs=require(_0x93cc('0x10'));var toCsv=require(_0x93cc('0xa'));var querystring=require(_0x93cc('0x11'));var Papa=require(_0x93cc('0x12'));var authService=require(_0x93cc('0x13'));var hardwareService=require(_0x93cc('0x14'));var Redis=require(_0x93cc('0x15'));var qs=require(_0x93cc('0x16'));var logger=require(_0x93cc('0x17'))('api');var utils=require(_0x93cc('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x93cc('0x19')]=_[_0x93cc('0x1a')](config[_0x93cc('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x93cc('0x1b'))(new Redis(config[_0x93cc('0x19')]));require(_0x93cc('0x1c'))[_0x93cc('0x1d')](socket);function respondWithStatusCode(_0x4ae571,_0x376878){_0x376878=_0x376878||0xcc;return function(_0x41a1ec){if(_0x41a1ec){return _0x4ae571[_0x93cc('0x1e')](_0x376878);}return _0x4ae571['status'](_0x376878)[_0x93cc('0x1f')]();};}function respondWithResult(_0xad291,_0x3e607e){_0x3e607e=_0x3e607e||0xc8;return function(_0x3b985f){if(_0x3b985f){return _0xad291[_0x93cc('0x20')](_0x3e607e)[_0x93cc('0x21')](_0x3b985f);}};}function respondWithFilteredResult(_0x2af1c2,_0x2b1a5f){return function(_0x58c96f){if(_0x58c96f){var _0x439838=_0x58c96f['count'],_0x3a6500=_0x2b1a5f[_0x93cc('0x22')],_0x3dfaf9=_0x2b1a5f[_0x93cc('0x22')]+_0x2b1a5f[_0x93cc('0x23')],_0x2cb05d;if(_0x3dfaf9>=_0x439838){_0x3dfaf9=_0x439838;_0x2cb05d=0xc8;}else{_0x2cb05d=0xce;}_0x2af1c2[_0x93cc('0x20')](_0x2cb05d);return _0x2af1c2['set'](_0x93cc('0x24'),_0x3a6500+'-'+_0x3dfaf9+'/'+_0x439838)['json'](_0x58c96f);}return null;};}function patchUpdates(_0x2f5c4c){return function(_0x5636fb){try{jsonpatch['apply'](_0x5636fb,_0x2f5c4c,!![]);}catch(_0x3765f5){return BPromise[_0x93cc('0x25')](_0x3765f5);}return _0x5636fb[_0x93cc('0x26')]();};}function saveUpdates(_0x344cfc,_0x538b82){return function(_0x4942bf){if(_0x4942bf){return _0x4942bf[_0x93cc('0x27')](_0x344cfc)[_0x93cc('0x28')](function(_0x3d56ab){return _0x3d56ab;});}return null;};}function removeEntity(_0x3feead,_0x45f520){return function(_0x1f9e98){if(_0x1f9e98){return _0x1f9e98[_0x93cc('0x29')]()[_0x93cc('0x28')](function(){var _0x3f2b35=_0x1f9e98['get']({'plain':!![]});var _0x725b25=_0x93cc('0x2a');return db[_0x93cc('0x2b')][_0x93cc('0x29')]({'where':{'type':_0x725b25,'resourceId':_0x3f2b35['id']}})[_0x93cc('0x28')](function(){return _0x1f9e98;});})[_0x93cc('0x28')](function(){_0x3feead[_0x93cc('0x20')](0xcc)[_0x93cc('0x1f')]();});}};}function handleEntityNotFound(_0x1be07f,_0x16f13b){return function(_0x50dcd5){if(!_0x50dcd5){_0x1be07f[_0x93cc('0x1e')](0x194);}return _0x50dcd5;};}function handleError(_0x42b9c7,_0x54c465){_0x54c465=_0x54c465||0x1f4;return function(_0x29d4b6){logger['error'](_0x29d4b6[_0x93cc('0x2c')]);if(_0x29d4b6[_0x93cc('0x2d')]){delete _0x29d4b6['name'];}_0x42b9c7[_0x93cc('0x20')](_0x54c465)[_0x93cc('0x2e')](_0x29d4b6);};}exports[_0x93cc('0x2f')]=function(_0x37bf9c,_0x13294f){var _0x107058={},_0x5a82c5={},_0x353241={'count':0x0,'rows':[]};var _0x1826fa=db[_0x93cc('0x30')][_0x93cc('0x31')];_0x5a82c5[_0x93cc('0x32')]=_[_0x93cc('0x33')](_0x1826fa);_0x5a82c5[_0x93cc('0x34')]=_[_0x93cc('0x33')](_0x37bf9c[_0x93cc('0x34')]);_0x5a82c5[_0x93cc('0x35')]=_['intersection'](_0x5a82c5[_0x93cc('0x32')],_0x5a82c5[_0x93cc('0x34')]);_0x107058[_0x93cc('0x36')]=_[_0x93cc('0x37')](_0x5a82c5[_0x93cc('0x32')],qs['fields'](_0x37bf9c[_0x93cc('0x34')][_0x93cc('0x38')]));_0x107058['attributes']=_0x107058[_0x93cc('0x36')][_0x93cc('0x39')]?_0x107058[_0x93cc('0x36')]:_0x5a82c5[_0x93cc('0x32')];if(!_0x37bf9c[_0x93cc('0x34')][_0x93cc('0x3a')](_0x93cc('0x3b'))){_0x107058['limit']=qs[_0x93cc('0x23')](_0x37bf9c[_0x93cc('0x34')][_0x93cc('0x23')]);_0x107058['offset']=qs[_0x93cc('0x22')](_0x37bf9c[_0x93cc('0x34')][_0x93cc('0x22')]);}_0x107058[_0x93cc('0x3c')]=qs['sort'](_0x37bf9c[_0x93cc('0x34')][_0x93cc('0x3d')]);_0x107058[_0x93cc('0x3e')]=qs[_0x93cc('0x35')](_[_0x93cc('0x3f')](_0x37bf9c[_0x93cc('0x34')],_0x5a82c5[_0x93cc('0x35')]));if(_0x37bf9c[_0x93cc('0x34')][_0x93cc('0x40')]){_0x107058[_0x93cc('0x3e')]=_[_0x93cc('0x41')](_0x107058[_0x93cc('0x3e')],{'$or':_['map'](_0x1826fa,function(_0x58892f){if(_0x58892f['type'][_0x93cc('0x42')]!=='VIRTUAL'){var _0xfdd8bd={};_0xfdd8bd[_0x58892f[_0x93cc('0x43')]]={'$like':'%'+_0x37bf9c[_0x93cc('0x34')][_0x93cc('0x40')]+'%'};return _0xfdd8bd;}})});}_0x107058=_[_0x93cc('0x41')]({},_0x107058,_0x37bf9c['options']);var _0x1e910c={'where':_0x107058[_0x93cc('0x3e')]};return db[_0x93cc('0x30')][_0x93cc('0x44')](_0x1e910c)[_0x93cc('0x28')](function(_0xb8a993){_0x353241['count']=_0xb8a993;if(_0x37bf9c[_0x93cc('0x34')][_0x93cc('0x45')]){_0x107058[_0x93cc('0x46')]=[{'all':!![]}];}return db[_0x93cc('0x30')][_0x93cc('0x47')](_0x107058);})[_0x93cc('0x28')](function(_0x126348){_0x353241[_0x93cc('0x48')]=_0x126348;return _0x353241;})[_0x93cc('0x28')](respondWithFilteredResult(_0x13294f,_0x107058))[_0x93cc('0x49')](handleError(_0x13294f,null));};exports[_0x93cc('0x4a')]=function(_0x1e44f7,_0x193748){var _0x533d25={'raw':!![],'where':{'id':_0x1e44f7[_0x93cc('0x4b')]['id']}},_0x492558={};_0x492558[_0x93cc('0x32')]=_[_0x93cc('0x33')](db[_0x93cc('0x30')][_0x93cc('0x31')]);_0x492558[_0x93cc('0x34')]=_[_0x93cc('0x33')](_0x1e44f7[_0x93cc('0x34')]);_0x492558['filters']=_[_0x93cc('0x37')](_0x492558[_0x93cc('0x32')],_0x492558[_0x93cc('0x34')]);_0x533d25[_0x93cc('0x36')]=_[_0x93cc('0x37')](_0x492558['model'],qs['fields'](_0x1e44f7[_0x93cc('0x34')][_0x93cc('0x38')]));_0x533d25[_0x93cc('0x36')]=_0x533d25[_0x93cc('0x36')][_0x93cc('0x39')]?_0x533d25[_0x93cc('0x36')]:_0x492558[_0x93cc('0x32')];if(_0x1e44f7[_0x93cc('0x34')][_0x93cc('0x45')]){_0x533d25[_0x93cc('0x46')]=[{'all':!![]}];}_0x533d25=_['merge']({},_0x533d25,_0x1e44f7['options']);return db['SmsQueue'][_0x93cc('0x4c')](_0x533d25)[_0x93cc('0x28')](handleEntityNotFound(_0x193748,null))['then'](respondWithResult(_0x193748,null))[_0x93cc('0x49')](handleError(_0x193748,null));};exports[_0x93cc('0x4d')]=function(_0x2742e6,_0x22cb5a){return db[_0x93cc('0x30')][_0x93cc('0x4d')](_0x2742e6[_0x93cc('0x4e')],{})[_0x93cc('0x28')](function(_0x4bec62){var _0x3ccf23=_0x2742e6[_0x93cc('0x4f')][_0x93cc('0x50')]({'plain':!![]});if(!_0x3ccf23)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ccf23[_0x93cc('0x51')]==='user'){var _0x48b87e=_0x4bec62[_0x93cc('0x50')]({'plain':!![]});var _0x138b77=_0x93cc('0x2a');return db['UserProfileSection'][_0x93cc('0x4c')]({'where':{'name':_0x138b77,'userProfileId':_0x3ccf23[_0x93cc('0x52')]},'raw':!![]})[_0x93cc('0x28')](function(_0xbaa436){if(_0xbaa436&&_0xbaa436[_0x93cc('0x53')]===0x0){return db[_0x93cc('0x2b')][_0x93cc('0x4d')]({'name':_0x48b87e[_0x93cc('0x2d')],'resourceId':_0x48b87e['id'],'type':_0xbaa436[_0x93cc('0x2d')],'sectionId':_0xbaa436['id']},{})[_0x93cc('0x28')](function(){return _0x4bec62;});}else{return _0x4bec62;}})[_0x93cc('0x49')](function(_0x24bac3){logger[_0x93cc('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24bac3);throw _0x24bac3;});}return _0x4bec62;})[_0x93cc('0x28')](respondWithResult(_0x22cb5a,0xc9))[_0x93cc('0x49')](handleError(_0x22cb5a,null));};exports[_0x93cc('0x27')]=function(_0x248f35,_0x5926ac){if(_0x248f35['body']['id']){delete _0x248f35[_0x93cc('0x4e')]['id'];}return db[_0x93cc('0x30')][_0x93cc('0x4c')]({'where':{'id':_0x248f35[_0x93cc('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5926ac,null))[_0x93cc('0x28')](saveUpdates(_0x248f35[_0x93cc('0x4e')],null))[_0x93cc('0x28')](respondWithResult(_0x5926ac,null))['catch'](handleError(_0x5926ac,null));};exports['destroy']=function(_0x1c53bf,_0x5457d6){return db[_0x93cc('0x30')][_0x93cc('0x4c')]({'where':{'id':_0x1c53bf['params']['id']}})[_0x93cc('0x28')](handleEntityNotFound(_0x5457d6,null))[_0x93cc('0x28')](removeEntity(_0x5457d6,null))['catch'](handleError(_0x5457d6,null));};exports['describe']=function(_0x26e4ee,_0x8729f6){return db[_0x93cc('0x30')][_0x93cc('0x55')]()[_0x93cc('0x28')](respondWithResult(_0x8729f6,null))[_0x93cc('0x49')](handleError(_0x8729f6,null));};exports['getMembers']=function(_0x1c99a9,_0x34ff4e,_0x5134c8){var _0x1dea3b={'raw':!![],'where':{}},_0x41c5d2={},_0x19a33a;return db[_0x93cc('0x30')][_0x93cc('0x56')]({'where':{'id':_0x1c99a9[_0x93cc('0x4b')]['id']}})['then'](handleEntityNotFound(_0x34ff4e,null))['then'](function(_0x4edca8){if(_0x4edca8){_0x19a33a=_0x4edca8[_0x93cc('0x50')]({'plain':!![]});_0x41c5d2['model']=_['keys'](db[_0x93cc('0x57')][_0x93cc('0x31')]);_0x41c5d2[_0x93cc('0x34')]=_[_0x93cc('0x33')](_0x1c99a9[_0x93cc('0x34')]);_0x41c5d2['filters']=_[_0x93cc('0x37')](_0x41c5d2['model'],_0x41c5d2[_0x93cc('0x34')]);_0x1dea3b[_0x93cc('0x36')]=_['intersection'](_0x41c5d2[_0x93cc('0x32')],qs[_0x93cc('0x38')](_0x1c99a9[_0x93cc('0x34')][_0x93cc('0x38')]));_0x1dea3b[_0x93cc('0x36')]=_0x1dea3b['attributes'][_0x93cc('0x39')]?_0x1dea3b[_0x93cc('0x36')]:_0x41c5d2['model'];if(!_0x1c99a9['query'][_0x93cc('0x3a')](_0x93cc('0x3b'))){_0x1dea3b[_0x93cc('0x23')]=qs[_0x93cc('0x23')](_0x1c99a9[_0x93cc('0x34')][_0x93cc('0x23')]);_0x1dea3b[_0x93cc('0x22')]=qs[_0x93cc('0x22')](_0x1c99a9[_0x93cc('0x34')]['offset']);}_0x1dea3b[_0x93cc('0x3c')]=qs[_0x93cc('0x3d')](_0x1c99a9[_0x93cc('0x34')]['sort']);_0x1dea3b[_0x93cc('0x3e')]=qs[_0x93cc('0x35')](_[_0x93cc('0x3f')](_0x1c99a9[_0x93cc('0x34')],_0x41c5d2[_0x93cc('0x35')]));_0x1dea3b[_0x93cc('0x3e')][_0x93cc('0x58')]=_0x4edca8['id'];if(_0x1c99a9['query'][_0x93cc('0x40')]){_0x1dea3b[_0x93cc('0x3e')]=_[_0x93cc('0x41')](_0x1dea3b[_0x93cc('0x3e')],{'$or':_[_0x93cc('0x59')](_0x1dea3b['attributes'],function(_0x2e2232){var _0x498281={};_0x498281[_0x2e2232]={'$like':'%'+_0x1c99a9[_0x93cc('0x34')][_0x93cc('0x40')]+'%'};return _0x498281;})});}_0x1dea3b=_[_0x93cc('0x41')]({},_0x1dea3b,_0x1c99a9['options']);return db['UserSmsQueue'][_0x93cc('0x47')](_0x1dea3b);}})['then'](function(_0x781b19){if(_0x781b19){return db[_0x93cc('0x5a')][_0x93cc('0x5b')]({'where':{'id':_[_0x93cc('0x59')](_0x781b19,_0x93cc('0x5c')),'role':_0x93cc('0x5d')},'attributes':['id','name',_0x93cc('0x5e'),_0x93cc('0x5f'),_0x93cc('0x60')]});}})['then'](function(_0x480553){if(_0x480553){return{'count':_0x480553[_0x93cc('0x44')],'rows':_['map'](_0x480553[_0x93cc('0x48')],function(_0x11cca9){return{'membername':_0x11cca9['name'],'UserId':_0x11cca9['id'],'queue_name':_0x19a33a[_0x93cc('0x2d')],'SmsQueueId':_0x19a33a['id'],'interface':util['format']('%s/%s',_0x93cc('0x61'),_0x11cca9[_0x93cc('0x2d')]),'penalty':0x0,'paused':_0x11cca9[_0x93cc('0x5e')],'createdAt':_0x11cca9[_0x93cc('0x60')],'updatedAt':_0x11cca9[_0x93cc('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x34ff4e,_0x1dea3b))[_0x93cc('0x49')](handleError(_0x34ff4e,null));};exports[_0x93cc('0x62')]=function(_0x36ee95,_0x3e9bdd,_0x766ca2){var _0x5cb801={};var _0x5499fb={};var _0x1332ff;var _0x41639f;return db[_0x93cc('0x30')][_0x93cc('0x56')]({'where':{'id':_0x36ee95[_0x93cc('0x4b')]['id']}})[_0x93cc('0x28')](handleEntityNotFound(_0x3e9bdd,null))[_0x93cc('0x28')](function(_0x29e8ee){if(_0x29e8ee){_0x1332ff=_0x29e8ee;_0x5499fb['model']=_[_0x93cc('0x33')](db[_0x93cc('0x63')][_0x93cc('0x31')]);_0x5499fb[_0x93cc('0x34')]=_[_0x93cc('0x33')](_0x36ee95['query']);_0x5499fb[_0x93cc('0x35')]=_[_0x93cc('0x37')](_0x5499fb[_0x93cc('0x32')],_0x5499fb[_0x93cc('0x34')]);_0x5cb801[_0x93cc('0x36')]=_[_0x93cc('0x37')](_0x5499fb[_0x93cc('0x32')],qs[_0x93cc('0x38')](_0x36ee95[_0x93cc('0x34')][_0x93cc('0x38')]));_0x5cb801[_0x93cc('0x36')]=_0x5cb801[_0x93cc('0x36')]['length']?_0x5cb801['attributes']:_0x5499fb['model'];_0x5cb801[_0x93cc('0x3c')]=qs[_0x93cc('0x3d')](_0x36ee95['query'][_0x93cc('0x3d')]);_0x5cb801[_0x93cc('0x3e')]=qs[_0x93cc('0x35')](_[_0x93cc('0x3f')](_0x36ee95[_0x93cc('0x34')],_0x5499fb[_0x93cc('0x35')]));if(_0x36ee95[_0x93cc('0x34')]['filter']){_0x5cb801[_0x93cc('0x3e')]=_[_0x93cc('0x41')](_0x5cb801['where'],{'$or':_[_0x93cc('0x59')](_0x5cb801[_0x93cc('0x36')],function(_0x31902b){var _0x143583={};_0x143583[_0x31902b]={'$like':'%'+_0x36ee95[_0x93cc('0x34')]['filter']+'%'};return _0x143583;})});}_0x5cb801=_[_0x93cc('0x41')]({},_0x5cb801,_0x36ee95[_0x93cc('0x64')]);return _0x1332ff[_0x93cc('0x62')](_0x5cb801);}})[_0x93cc('0x28')](function(_0x4a39a7){if(_0x4a39a7){_0x41639f=_0x4a39a7['length'];if(!_0x36ee95[_0x93cc('0x34')][_0x93cc('0x3a')](_0x93cc('0x3b'))){_0x5cb801[_0x93cc('0x23')]=qs[_0x93cc('0x23')](_0x36ee95[_0x93cc('0x34')][_0x93cc('0x23')]);_0x5cb801[_0x93cc('0x22')]=qs[_0x93cc('0x22')](_0x36ee95[_0x93cc('0x34')][_0x93cc('0x22')]);}return _0x1332ff[_0x93cc('0x62')](_0x5cb801);}})[_0x93cc('0x28')](function(_0x2d525a){if(_0x2d525a){return _0x2d525a?{'count':_0x41639f,'rows':_0x2d525a}:null;}})['then'](respondWithResult(_0x3e9bdd,null))[_0x93cc('0x49')](handleError(_0x3e9bdd,null));};exports['addTeams']=function(_0x5c66a0,_0x2654c2,_0xc5f1ac){var _0x217f95=[];var _0x19b0b0;return db[_0x93cc('0x63')][_0x93cc('0x47')]({'where':{'id':_0x5c66a0[_0x93cc('0x4e')][_0x93cc('0x65')]},'attributes':['id'],'include':[{'model':db[_0x93cc('0x5a')],'as':_0x93cc('0x66'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x560ff3){if(_0x560ff3){for(var _0x5f467d=0x0;_0x5f467d<_0x560ff3['length'];_0x5f467d+=0x1){for(var _0x3221cd=0x0;_0x3221cd<_0x560ff3[_0x5f467d][_0x93cc('0x66')][_0x93cc('0x39')];_0x3221cd+=0x1){_0x217f95=_[_0x93cc('0x67')](_0x217f95,[_0x560ff3[_0x5f467d][_0x93cc('0x66')][_0x3221cd]['id']]);}}return _0x217f95;}})[_0x93cc('0x28')](function(_0x1fed3d){if(_0x1fed3d){return db['SmsQueue'][_0x93cc('0x4c')]({'where':{'id':_0x5c66a0[_0x93cc('0x4b')]['id']}});}})['then'](function(_0x7a6e01){if(_0x7a6e01){_0x19b0b0=_0x7a6e01;return _0x19b0b0[_0x93cc('0x68')](_0x217f95,{'penalty':_0x5c66a0['body'][_0x93cc('0x69')]});}})[_0x93cc('0x28')](function(_0x42cb5b){if(_0x42cb5b){return _0x19b0b0['addTeams'](_0x5c66a0[_0x93cc('0x4e')]['ids']);}})['then'](handleEntityNotFound(_0x2654c2,null))['then'](respondWithStatusCode(_0x2654c2,null))['catch'](handleError(_0x2654c2,null));};exports[_0x93cc('0x6a')]=function(_0xba7380,_0x149ead,_0x3822f6){var _0x26befe=[];var _0x12eaf3;return db[_0x93cc('0x63')][_0x93cc('0x47')]({'where':{'id':_0xba7380[_0x93cc('0x34')][_0x93cc('0x65')]},'attributes':['id'],'include':[{'model':db[_0x93cc('0x5a')],'as':_0x93cc('0x66'),'attributes':['id'],'raw':!![]}]})[_0x93cc('0x28')](function(_0x419201){if(_0x419201){for(var _0x56419e=0x0;_0x56419e<_0x419201['length'];_0x56419e+=0x1){for(var _0x16bb67=0x0;_0x16bb67<_0x419201[_0x56419e][_0x93cc('0x66')][_0x93cc('0x39')];_0x16bb67+=0x1){_0x26befe=_[_0x93cc('0x67')](_0x26befe,[_0x419201[_0x56419e][_0x93cc('0x66')][_0x16bb67]['id']]);}}return _0x26befe;}})[_0x93cc('0x28')](function(_0x553cc1){if(_0x553cc1){return db[_0x93cc('0x30')][_0x93cc('0x4c')]({'where':{'id':_0xba7380[_0x93cc('0x4b')]['id']}});}})['then'](function(_0x5b4c84){if(_0x5b4c84){_0x12eaf3=_0x5b4c84;return _0x12eaf3[_0x93cc('0x6b')](_0x26befe);}})['then'](function(_0x2e7e80){if(_0x12eaf3){return _0x12eaf3[_0x93cc('0x6a')](_0xba7380[_0x93cc('0x34')][_0x93cc('0x65')]);}})[_0x93cc('0x28')](handleEntityNotFound(_0x149ead,null))[_0x93cc('0x28')](respondWithStatusCode(_0x149ead,null))[_0x93cc('0x49')](handleError(_0x149ead,null));};exports[_0x93cc('0x68')]=function(_0x22044a,_0x38f5aa,_0x13e1a3){return db[_0x93cc('0x30')][_0x93cc('0x4c')]({'where':{'id':_0x22044a['params']['id']}})[_0x93cc('0x28')](handleEntityNotFound(_0x38f5aa,null))['then'](function(_0x36c951){if(_0x36c951){return _0x36c951['addAgents'](_0x22044a[_0x93cc('0x4e')][_0x93cc('0x65')],_[_0x93cc('0x6c')](_0x22044a[_0x93cc('0x4e')],[_0x93cc('0x65'),'id'])||{})[_0x93cc('0x6d')](function(_0x3475c6){for(var _0x3bc0a0=0x0;_0x3bc0a0<_0x22044a[_0x93cc('0x4e')][_0x93cc('0x65')][_0x93cc('0x39')];_0x3bc0a0+=0x1){socket[_0x93cc('0x6e')](_0x93cc('0x6f'),{'UserId':_0x22044a[_0x93cc('0x4e')][_0x93cc('0x65')][_0x3bc0a0],'SmsQueueId':_0x22044a[_0x93cc('0x4b')]['id']});}return _0x3475c6;});}})[_0x93cc('0x28')](respondWithResult(_0x38f5aa,null))['catch'](handleError(_0x38f5aa,null));};exports[_0x93cc('0x6b')]=function(_0x57c074,_0xed1f2,_0x1a3769){var _0x17b131;return db[_0x93cc('0x30')][_0x93cc('0x4c')]({'where':{'id':_0x57c074[_0x93cc('0x4b')]['id']}})[_0x93cc('0x28')](handleEntityNotFound(_0xed1f2,null))['then'](function(_0x57d201){if(_0x57d201){return _0x57d201[_0x93cc('0x6b')](_0x57c074[_0x93cc('0x34')]['ids'])[_0x93cc('0x28')](function(_0xc03b2c){if(_['isArray'](_0x57c074['query'][_0x93cc('0x65')])){for(var _0x1feb22=0x0;_0x1feb22<_0x57c074[_0x93cc('0x34')]['ids'][_0x93cc('0x39')];_0x1feb22+=0x1){socket[_0x93cc('0x6e')](_0x93cc('0x70'),{'UserId':_0x57c074['query'][_0x93cc('0x65')][_0x1feb22],'SmsQueueId':_0x57c074[_0x93cc('0x4b')]['id']});}}else{socket['emit'](_0x93cc('0x70'),{'UserId':_0x57c074['query'][_0x93cc('0x65')],'SmsQueueId':_0x57c074[_0x93cc('0x4b')]['id']});}});}})[_0x93cc('0x28')](respondWithStatusCode(_0xed1f2,null))[_0x93cc('0x49')](handleError(_0xed1f2,null));};exports[_0x93cc('0x71')]=function(_0x591711,_0x5d07f8,_0x392363){var _0x2f0e85={};var _0xd99d2d={};var _0x10fb17;var _0x302a05;return db[_0x93cc('0x30')]['findOne']({'where':{'id':_0x591711[_0x93cc('0x4b')]['id']}})[_0x93cc('0x28')](handleEntityNotFound(_0x5d07f8,null))[_0x93cc('0x28')](function(_0x135ed5){if(_0x135ed5){_0x10fb17=_0x135ed5;_0xd99d2d[_0x93cc('0x32')]=_['keys'](db['User'][_0x93cc('0x31')]);_0xd99d2d[_0x93cc('0x34')]=_['keys'](_0x591711[_0x93cc('0x34')]);_0xd99d2d[_0x93cc('0x35')]=_[_0x93cc('0x37')](_0xd99d2d['model'],_0xd99d2d[_0x93cc('0x34')]);_0x2f0e85[_0x93cc('0x36')]=_['intersection'](_0xd99d2d[_0x93cc('0x32')],qs['fields'](_0x591711['query'][_0x93cc('0x38')]));_0x2f0e85[_0x93cc('0x36')]=_0x2f0e85['attributes'][_0x93cc('0x39')]?_0x2f0e85[_0x93cc('0x36')]:_0xd99d2d[_0x93cc('0x32')];_0x2f0e85[_0x93cc('0x3c')]=qs[_0x93cc('0x3d')](_0x591711[_0x93cc('0x34')][_0x93cc('0x3d')]);_0x2f0e85[_0x93cc('0x3e')]=qs['filters'](_[_0x93cc('0x3f')](_0x591711[_0x93cc('0x34')],_0xd99d2d[_0x93cc('0x35')]));if(_0x591711[_0x93cc('0x34')]['filter']){_0x2f0e85['where']=_['merge'](_0x2f0e85['where'],{'$or':_[_0x93cc('0x59')](_0x2f0e85[_0x93cc('0x36')],function(_0x47cff8){var _0x13392f={};_0x13392f[_0x47cff8]={'$like':'%'+_0x591711[_0x93cc('0x34')][_0x93cc('0x40')]+'%'};return _0x13392f;})});}_0x2f0e85=_[_0x93cc('0x41')]({},_0x2f0e85,_0x591711[_0x93cc('0x64')]);return _0x10fb17[_0x93cc('0x71')](_0x2f0e85);}})['then'](function(_0x9d7e38){if(_0x9d7e38){_0x302a05=_0x9d7e38['length'];if(!_0x591711[_0x93cc('0x34')][_0x93cc('0x3a')](_0x93cc('0x3b'))){_0x2f0e85[_0x93cc('0x23')]=qs[_0x93cc('0x23')](_0x591711['query'][_0x93cc('0x23')]);_0x2f0e85[_0x93cc('0x22')]=qs[_0x93cc('0x22')](_0x591711[_0x93cc('0x34')][_0x93cc('0x22')]);}return _0x10fb17[_0x93cc('0x71')](_0x2f0e85);}})[_0x93cc('0x28')](function(_0x2b9500){if(_0x2b9500){return _0x2b9500?{'count':_0x302a05,'rows':_0x2b9500}:null;}})[_0x93cc('0x28')](respondWithResult(_0x5d07f8,null))[_0x93cc('0x49')](handleError(_0x5d07f8,null));};
\ No newline at end of file
index 3085443..b546b37 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x53dd=['SmsQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3ada16,_0x3c84c1){var _0x34395a=function(_0x246020){while(--_0x246020){_0x3ada16['push'](_0x3ada16['shift']());}};_0x34395a(++_0x3c84c1);}(_0x53dd,0xc6));var _0xd53d=function(_0x3b5f65,_0x4c7b24){_0x3b5f65=_0x3b5f65-0x0;var _0x106028=_0x53dd[_0x3b5f65];return _0x106028;};'use strict';var EventEmitter=require(_0xd53d('0x0'));var SmsQueue=require(_0xd53d('0x1'))['db'][_0xd53d('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xd53d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd53d('0x4'),'afterDestroy':_0xd53d('0x5')};function emitEvent(_0x2786d0){return function(_0x3c5f23,_0x506fbd,_0x780812){SmsQueueEvents[_0xd53d('0x6')](_0x2786d0+':'+_0x3c5f23['id'],_0x3c5f23);SmsQueueEvents[_0xd53d('0x6')](_0x2786d0,_0x3c5f23);_0x780812(null);};}for(var e in events){if(events[_0xd53d('0x7')](e)){var event=events[e];SmsQueue[_0xd53d('0x8')](e,emitEvent(event));}}module[_0xd53d('0x9')]=SmsQueueEvents;
\ No newline at end of file
+var _0x695f=['exports','../../mysqldb','SmsQueue','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x592098,_0x25f2ab){var _0x20cc78=function(_0x54418f){while(--_0x54418f){_0x592098['push'](_0x592098['shift']());}};_0x20cc78(++_0x25f2ab);}(_0x695f,0xb1));var _0xf695=function(_0x58e5ae,_0x45ee50){_0x58e5ae=_0x58e5ae-0x0;var _0x114fed=_0x695f[_0x58e5ae];return _0x114fed;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xf695('0x0'))['db'][_0xf695('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xf695('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf695('0x3'),'afterDestroy':'remove'};function emitEvent(_0x45ae47){return function(_0x590cbb,_0x3da6c9,_0x266064){SmsQueueEvents['emit'](_0x45ae47+':'+_0x590cbb['id'],_0x590cbb);SmsQueueEvents[_0xf695('0x4')](_0x45ae47,_0x590cbb);_0x266064(null);};}for(var e in events){if(events[_0xf695('0x5')](e)){var event=events[e];SmsQueue[_0xf695('0x6')](e,emitEvent(event));}}module[_0xf695('0x7')]=SmsQueueEvents;
\ No newline at end of file
index 83f3170..9e036a4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6e70=['define','SmsQueue','sms_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','exports'];(function(_0x552fce,_0x3f24bc){var _0x3e27a2=function(_0xc91154){while(--_0xc91154){_0x552fce['push'](_0x552fce['shift']());}};_0x3e27a2(++_0x3f24bc);}(_0x6e70,0x143));var _0x06e7=function(_0x346adc,_0x594fe8){_0x346adc=_0x346adc-0x0;var _0x145200=_0x6e70[_0x346adc];return _0x145200;};'use strict';var _=require(_0x06e7('0x0'));var util=require(_0x06e7('0x1'));var logger=require(_0x06e7('0x2'))('api');var moment=require(_0x06e7('0x3'));var BPromise=require(_0x06e7('0x4'));var rp=require(_0x06e7('0x5'));var attributes=require('./smsQueue.attributes');module[_0x06e7('0x6')]=function(_0x3e8a75,_0xdeefca){return _0x3e8a75[_0x06e7('0x7')](_0x06e7('0x8'),attributes,{'tableName':_0x06e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x37eb=['api','moment','request-promise','./smsQueue.attributes','sms_queues','lodash','util','../../config/logger'];(function(_0x53e29e,_0x17c540){var _0x54c118=function(_0x45b1bf){while(--_0x45b1bf){_0x53e29e['push'](_0x53e29e['shift']());}};_0x54c118(++_0x17c540);}(_0x37eb,0x16d));var _0xb37e=function(_0x85e247,_0x328ead){_0x85e247=_0x85e247-0x0;var _0x36f437=_0x37eb[_0x85e247];return _0x36f437;};'use strict';var _=require(_0xb37e('0x0'));var util=require(_0xb37e('0x1'));var logger=require(_0xb37e('0x2'))(_0xb37e('0x3'));var moment=require(_0xb37e('0x4'));var BPromise=require('bluebird');var rp=require(_0xb37e('0x5'));var attributes=require(_0xb37e('0x6'));module['exports']=function(_0x43a288,_0x1355f7){return _0x43a288['define']('SmsQueue',attributes,{'tableName':_0xb37e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 1001718..a2d35b2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbc0e=['SmsQueue','findAll','options','raw','where','attributes','limit','map','include','model','GetSmsQueue','debug','stringify','ShowSmsQueue','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch'];(function(_0x5722b5,_0x4c5f26){var _0x32ac18=function(_0x305226){while(--_0x305226){_0x5722b5['push'](_0x5722b5['shift']());}};_0x32ac18(++_0x4c5f26);}(_0xbc0e,0x104));var _0xebc0=function(_0x200af1,_0x4f3801){_0x200af1=_0x200af1-0x0;var _0x181431=_0xbc0e[_0x200af1];return _0x181431;};'use strict';var _=require(_0xebc0('0x0'));var util=require(_0xebc0('0x1'));var moment=require('moment');var BPromise=require(_0xebc0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xebc0('0x3'))['db'];var utils=require(_0xebc0('0x4'));var logger=require(_0xebc0('0x5'))(_0xebc0('0x6'));var config=require(_0xebc0('0x7'));var jayson=require(_0xebc0('0x8'));var client=jayson[_0xebc0('0x9')][_0xebc0('0xa')]({'port':0x232a});config[_0xebc0('0xb')]=_[_0xebc0('0xc')](config['redis'],{'host':_0xebc0('0xd'),'port':0x18eb});var socket=require(_0xebc0('0xe'))(new Redis(config[_0xebc0('0xb')]));require(_0xebc0('0xf'))[_0xebc0('0x10')](socket);function respondWithRpcPromise(_0x26593d,_0x3b360a,_0x233cd7){return new BPromise(function(_0x47bd34,_0x3a3954){return client[_0xebc0('0x11')](_0x26593d,_0x233cd7)[_0xebc0('0x12')](function(_0x4601a4){logger[_0xebc0('0x13')](_0xebc0('0x14'),_0x3b360a,'request\x20sent');logger['debug'](_0xebc0('0x15'),_0x3b360a,_0xebc0('0x16'),JSON['stringify'](_0x4601a4));if(_0x4601a4[_0xebc0('0x17')]){if(_0x4601a4[_0xebc0('0x17')][_0xebc0('0x18')]===0x1f4){logger[_0xebc0('0x17')]('SmsQueue,\x20%s,\x20%s',_0x3b360a,_0x4601a4[_0xebc0('0x17')][_0xebc0('0x19')]);return _0x3a3954(_0x4601a4['error']['message']);}logger[_0xebc0('0x17')](_0xebc0('0x14'),_0x3b360a,_0x4601a4[_0xebc0('0x17')][_0xebc0('0x19')]);return _0x47bd34(_0x4601a4['error'][_0xebc0('0x19')]);}else{logger[_0xebc0('0x13')](_0xebc0('0x14'),_0x3b360a,_0xebc0('0x16'));_0x47bd34(_0x4601a4['result'][_0xebc0('0x19')]);}})[_0xebc0('0x1a')](function(_0x29a422){logger[_0xebc0('0x17')](_0xebc0('0x14'),_0x3b360a,_0x29a422);_0x3a3954(_0x29a422);});});}exports['GetSmsQueue']=function(_0xbf4c60){var _0x4b3d41=this;return new Promise(function(_0xdcdfd4,_0x3fe5d4){return db[_0xebc0('0x1b')][_0xebc0('0x1c')]({'raw':_0xbf4c60[_0xebc0('0x1d')]?_0xbf4c60[_0xebc0('0x1d')][_0xebc0('0x1e')]===undefined?!![]:![]:!![],'where':_0xbf4c60[_0xebc0('0x1d')]?_0xbf4c60[_0xebc0('0x1d')][_0xebc0('0x1f')]||null:null,'attributes':_0xbf4c60['options']?_0xbf4c60[_0xebc0('0x1d')][_0xebc0('0x20')]||null:null,'limit':_0xbf4c60[_0xebc0('0x1d')]?_0xbf4c60[_0xebc0('0x1d')][_0xebc0('0x21')]||null:null,'include':_0xbf4c60['options']?_0xbf4c60[_0xebc0('0x1d')]['include']?_[_0xebc0('0x22')](_0xbf4c60[_0xebc0('0x1d')]['include'],function(_0x48c897){return{'model':db[_0x48c897['model']],'as':_0x48c897['as'],'attributes':_0x48c897['attributes'],'include':_0x48c897[_0xebc0('0x23')]?_[_0xebc0('0x22')](_0x48c897[_0xebc0('0x23')],function(_0x1f6efd){return{'model':db[_0x1f6efd[_0xebc0('0x24')]],'as':_0x1f6efd['as'],'attributes':_0x1f6efd[_0xebc0('0x20')],'include':_0x1f6efd[_0xebc0('0x23')]?_[_0xebc0('0x22')](_0x1f6efd[_0xebc0('0x23')],function(_0x5b4c3b){return{'model':db[_0x5b4c3b[_0xebc0('0x24')]],'as':_0x5b4c3b['as'],'attributes':_0x5b4c3b[_0xebc0('0x20')]};}):[]};}):[]};}):[]:[]})[_0xebc0('0x12')](function(_0x4d9a42){logger[_0xebc0('0x13')](_0xebc0('0x25'),_0xbf4c60);logger[_0xebc0('0x26')](_0xebc0('0x25'),_0xbf4c60,JSON[_0xebc0('0x27')](_0x4d9a42));_0xdcdfd4(_0x4d9a42);})[_0xebc0('0x1a')](function(_0x403ae5){logger[_0xebc0('0x17')](_0xebc0('0x25'),_0x403ae5[_0xebc0('0x19')],_0xbf4c60);_0x3fe5d4(_0x4b3d41[_0xebc0('0x17')](0x1f4,_0x403ae5['message']));});});};exports[_0xebc0('0x28')]=function(_0x7c48a){var _0x10800c=this;return new Promise(function(_0x11169b,_0x1bc577){return db[_0xebc0('0x1b')]['find']({'raw':_0x7c48a[_0xebc0('0x1d')]?_0x7c48a[_0xebc0('0x1d')][_0xebc0('0x1e')]===undefined?!![]:![]:!![],'where':_0x7c48a[_0xebc0('0x1d')]?_0x7c48a[_0xebc0('0x1d')][_0xebc0('0x1f')]||null:null,'attributes':_0x7c48a[_0xebc0('0x1d')]?_0x7c48a[_0xebc0('0x1d')][_0xebc0('0x20')]||null:null,'include':_0x7c48a[_0xebc0('0x1d')]?_0x7c48a[_0xebc0('0x1d')][_0xebc0('0x23')]?_['map'](_0x7c48a[_0xebc0('0x1d')][_0xebc0('0x23')],function(_0x9d3c17){return{'model':db[_0x9d3c17[_0xebc0('0x24')]],'as':_0x9d3c17['as'],'attributes':_0x9d3c17[_0xebc0('0x20')],'include':_0x9d3c17[_0xebc0('0x23')]?_[_0xebc0('0x22')](_0x9d3c17[_0xebc0('0x23')],function(_0x3dca37){return{'model':db[_0x3dca37['model']],'as':_0x3dca37['as'],'attributes':_0x3dca37[_0xebc0('0x20')],'include':_0x3dca37[_0xebc0('0x23')]?_[_0xebc0('0x22')](_0x3dca37[_0xebc0('0x23')],function(_0x46f2aa){return{'model':db[_0x46f2aa[_0xebc0('0x24')]],'as':_0x46f2aa['as'],'attributes':_0x46f2aa['attributes']};}):[]};}):[]};}):[]:[]})[_0xebc0('0x12')](function(_0x21e1ba){logger[_0xebc0('0x13')](_0xebc0('0x28'),_0x7c48a);logger[_0xebc0('0x26')](_0xebc0('0x28'),_0x7c48a,JSON[_0xebc0('0x27')](_0x21e1ba));_0x11169b(_0x21e1ba);})[_0xebc0('0x1a')](function(_0x204bda){logger['error']('ShowSmsQueue',_0x204bda[_0xebc0('0x19')],_0x7c48a);_0x1bc577(_0x10800c[_0xebc0('0x17')](0x1f4,_0x204bda[_0xebc0('0x19')]));});});};
\ No newline at end of file
+var _0x0f83=['error','code','message','info','SmsQueue','findAll','options','where','attributes','limit','map','include','model','then','GetSmsQueue','stringify','ShowSmsQueue','find','raw','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x52dde5,_0x2d33d9){var _0x47efc0=function(_0x29374b){while(--_0x29374b){_0x52dde5['push'](_0x52dde5['shift']());}};_0x47efc0(++_0x2d33d9);}(_0x0f83,0x66));var _0x30f8=function(_0x2a93b1,_0x3563d9){_0x2a93b1=_0x2a93b1-0x0;var _0xfb1537=_0x0f83[_0x2a93b1];return _0xfb1537;};'use strict';var _=require('lodash');var util=require(_0x30f8('0x0'));var moment=require(_0x30f8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x30f8('0x2'));var db=require(_0x30f8('0x3'))['db'];var utils=require(_0x30f8('0x4'));var logger=require(_0x30f8('0x5'))(_0x30f8('0x6'));var config=require('../../config/environment');var jayson=require(_0x30f8('0x7'));var client=jayson[_0x30f8('0x8')][_0x30f8('0x9')]({'port':0x232a});config[_0x30f8('0xa')]=_[_0x30f8('0xb')](config[_0x30f8('0xa')],{'host':_0x30f8('0xc'),'port':0x18eb});var socket=require(_0x30f8('0xd'))(new Redis(config[_0x30f8('0xa')]));require(_0x30f8('0xe'))[_0x30f8('0xf')](socket);function respondWithRpcPromise(_0x463449,_0x289bc7,_0x1fef33){return new BPromise(function(_0x49249d,_0x72eb9){return client[_0x30f8('0x10')](_0x463449,_0x1fef33)['then'](function(_0x4d512d){logger['info'](_0x30f8('0x11'),_0x289bc7,'request\x20sent');logger[_0x30f8('0x12')](_0x30f8('0x13'),_0x289bc7,_0x30f8('0x14'),JSON['stringify'](_0x4d512d));if(_0x4d512d[_0x30f8('0x15')]){if(_0x4d512d['error'][_0x30f8('0x16')]===0x1f4){logger[_0x30f8('0x15')](_0x30f8('0x11'),_0x289bc7,_0x4d512d['error'][_0x30f8('0x17')]);return _0x72eb9(_0x4d512d['error'][_0x30f8('0x17')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x289bc7,_0x4d512d[_0x30f8('0x15')][_0x30f8('0x17')]);return _0x49249d(_0x4d512d[_0x30f8('0x15')]['message']);}else{logger[_0x30f8('0x18')](_0x30f8('0x11'),_0x289bc7,_0x30f8('0x14'));_0x49249d(_0x4d512d['result'][_0x30f8('0x17')]);}})['catch'](function(_0xdce770){logger[_0x30f8('0x15')](_0x30f8('0x11'),_0x289bc7,_0xdce770);_0x72eb9(_0xdce770);});});}exports['GetSmsQueue']=function(_0x590eae){var _0x4efbff=this;return new Promise(function(_0x316c24,_0x82b510){return db[_0x30f8('0x19')][_0x30f8('0x1a')]({'raw':_0x590eae[_0x30f8('0x1b')]?_0x590eae[_0x30f8('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x590eae['options']?_0x590eae[_0x30f8('0x1b')][_0x30f8('0x1c')]||null:null,'attributes':_0x590eae['options']?_0x590eae['options'][_0x30f8('0x1d')]||null:null,'limit':_0x590eae['options']?_0x590eae[_0x30f8('0x1b')][_0x30f8('0x1e')]||null:null,'include':_0x590eae[_0x30f8('0x1b')]?_0x590eae[_0x30f8('0x1b')]['include']?_[_0x30f8('0x1f')](_0x590eae[_0x30f8('0x1b')]['include'],function(_0x1aa55a){return{'model':db[_0x1aa55a['model']],'as':_0x1aa55a['as'],'attributes':_0x1aa55a['attributes'],'include':_0x1aa55a[_0x30f8('0x20')]?_['map'](_0x1aa55a['include'],function(_0xd91b71){return{'model':db[_0xd91b71[_0x30f8('0x21')]],'as':_0xd91b71['as'],'attributes':_0xd91b71[_0x30f8('0x1d')],'include':_0xd91b71[_0x30f8('0x20')]?_[_0x30f8('0x1f')](_0xd91b71['include'],function(_0x14f9f0){return{'model':db[_0x14f9f0[_0x30f8('0x21')]],'as':_0x14f9f0['as'],'attributes':_0x14f9f0[_0x30f8('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x30f8('0x22')](function(_0x579bd7){logger[_0x30f8('0x18')](_0x30f8('0x23'),_0x590eae);logger[_0x30f8('0x12')](_0x30f8('0x23'),_0x590eae,JSON[_0x30f8('0x24')](_0x579bd7));_0x316c24(_0x579bd7);})['catch'](function(_0x15d4e6){logger[_0x30f8('0x15')]('GetSmsQueue',_0x15d4e6[_0x30f8('0x17')],_0x590eae);_0x82b510(_0x4efbff[_0x30f8('0x15')](0x1f4,_0x15d4e6[_0x30f8('0x17')]));});});};exports[_0x30f8('0x25')]=function(_0x202607){var _0x11b45e=this;return new Promise(function(_0x119e3f,_0x284b97){return db[_0x30f8('0x19')][_0x30f8('0x26')]({'raw':_0x202607[_0x30f8('0x1b')]?_0x202607[_0x30f8('0x1b')][_0x30f8('0x27')]===undefined?!![]:![]:!![],'where':_0x202607['options']?_0x202607[_0x30f8('0x1b')][_0x30f8('0x1c')]||null:null,'attributes':_0x202607[_0x30f8('0x1b')]?_0x202607[_0x30f8('0x1b')]['attributes']||null:null,'include':_0x202607[_0x30f8('0x1b')]?_0x202607[_0x30f8('0x1b')][_0x30f8('0x20')]?_[_0x30f8('0x1f')](_0x202607[_0x30f8('0x1b')][_0x30f8('0x20')],function(_0x1a2ffe){return{'model':db[_0x1a2ffe['model']],'as':_0x1a2ffe['as'],'attributes':_0x1a2ffe[_0x30f8('0x1d')],'include':_0x1a2ffe[_0x30f8('0x20')]?_[_0x30f8('0x1f')](_0x1a2ffe['include'],function(_0x5aa0a7){return{'model':db[_0x5aa0a7['model']],'as':_0x5aa0a7['as'],'attributes':_0x5aa0a7[_0x30f8('0x1d')],'include':_0x5aa0a7['include']?_[_0x30f8('0x1f')](_0x5aa0a7[_0x30f8('0x20')],function(_0x37f30a){return{'model':db[_0x37f30a[_0x30f8('0x21')]],'as':_0x37f30a['as'],'attributes':_0x37f30a[_0x30f8('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd43b7e){logger[_0x30f8('0x18')](_0x30f8('0x25'),_0x202607);logger['debug'](_0x30f8('0x25'),_0x202607,JSON[_0x30f8('0x24')](_0xd43b7e));_0x119e3f(_0xd43b7e);})[_0x30f8('0x28')](function(_0xa1be73){logger[_0x30f8('0x15')](_0x30f8('0x25'),_0xa1be73[_0x30f8('0x17')],_0x202607);_0x284b97(_0x11b45e['error'](0x1f4,_0xa1be73[_0x30f8('0x17')]));});});};
\ No newline at end of file
index 5056e8e..9d277bf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9f3=['register','smsQueue:','./smsQueue.events','save','update','emit','removeListener'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xa9f3,0x1de));var _0x3a9f=function(_0x4f10a7,_0x1d52a7){_0x4f10a7=_0x4f10a7-0x0;var _0x33cf4a=_0xa9f3[_0x4f10a7];return _0x33cf4a;};'use strict';var SmsQueueEvents=require(_0x3a9f('0x0'));var events=[_0x3a9f('0x1'),'remove',_0x3a9f('0x2')];function createListener(_0xd925b9,_0x5af71e){return function(_0x5580e1){_0x5af71e[_0x3a9f('0x3')](_0xd925b9,_0x5580e1);};}function removeListener(_0x2b7836,_0x50d15e){return function(){SmsQueueEvents[_0x3a9f('0x4')](_0x2b7836,_0x50d15e);};}exports[_0x3a9f('0x5')]=function(_0x3700ab){for(var _0x502670=0x0,_0x4c5243=events['length'];_0x502670<_0x4c5243;_0x502670++){var _0xdfddfc=events[_0x502670];var _0x29e993=createListener(_0x3a9f('0x6')+_0xdfddfc,_0x3700ab);SmsQueueEvents['on'](_0xdfddfc,_0x29e993);}};
\ No newline at end of file
+var _0xc0a4=['update','emit','register','length','smsQueue:','save','remove'];(function(_0x1c8a19,_0x4ae057){var _0x50a055=function(_0xe56255){while(--_0xe56255){_0x1c8a19['push'](_0x1c8a19['shift']());}};_0x50a055(++_0x4ae057);}(_0xc0a4,0x147));var _0x4c0a=function(_0x1137ba,_0x47bc6c){_0x1137ba=_0x1137ba-0x0;var _0x4555e7=_0xc0a4[_0x1137ba];return _0x4555e7;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x4c0a('0x0'),_0x4c0a('0x1'),_0x4c0a('0x2')];function createListener(_0x489d78,_0x1afa7c){return function(_0x4727a9){_0x1afa7c[_0x4c0a('0x3')](_0x489d78,_0x4727a9);};}function removeListener(_0x23a18d,_0x44b0e7){return function(){SmsQueueEvents['removeListener'](_0x23a18d,_0x44b0e7);};}exports[_0x4c0a('0x4')]=function(_0x1a78a1){for(var _0x12af4b=0x0,_0x457ef9=events[_0x4c0a('0x5')];_0x12af4b<_0x457ef9;_0x12af4b++){var _0x1a64e7=events[_0x12af4b];var _0x4093d5=createListener(_0x4c0a('0x6')+_0x1a64e7,_0x1a78a1);SmsQueueEvents['on'](_0x1a64e7,_0x4093d5);}};
\ No newline at end of file
index 4d6f3b4..feb2ce4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x16ce=['path','connect-timeout','express','Router','../../components/auth/service','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','util'];(function(_0x54ff68,_0x419415){var _0x418e73=function(_0x5241fd){while(--_0x5241fd){_0x54ff68['push'](_0x54ff68['shift']());}};_0x418e73(++_0x419415);}(_0x16ce,0xfb));var _0xe16c=function(_0x1eb17b,_0x218215){_0x1eb17b=_0x1eb17b-0x0;var _0x2ec548=_0x16ce[_0x1eb17b];return _0x2ec548;};'use strict';var multer=require('multer');var util=require(_0xe16c('0x0'));var path=require(_0xe16c('0x1'));var timeout=require(_0xe16c('0x2'));var express=require(_0xe16c('0x3'));var router=express[_0xe16c('0x4')]();var auth=require(_0xe16c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router[_0xe16c('0x6')]('/',auth['isAuthenticated'](),controller[_0xe16c('0x7')]);router[_0xe16c('0x6')](_0xe16c('0x8'),auth[_0xe16c('0x9')](),controller[_0xe16c('0xa')]);router[_0xe16c('0x6')](_0xe16c('0xb'),auth[_0xe16c('0x9')](),controller['show']);router[_0xe16c('0xc')]('/',auth[_0xe16c('0x9')](),controller[_0xe16c('0xd')]);router[_0xe16c('0xe')](_0xe16c('0xb'),auth[_0xe16c('0x9')](),controller[_0xe16c('0xf')]);router[_0xe16c('0x10')](_0xe16c('0xb'),auth[_0xe16c('0x9')](),controller[_0xe16c('0x11')]);module['exports']=router;
\ No newline at end of file
+var _0x287e=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','post','create','put'];(function(_0x3b8683,_0x14065f){var _0xe6aeaa=function(_0x4e35da){while(--_0x4e35da){_0x3b8683['push'](_0x3b8683['shift']());}};_0xe6aeaa(++_0x14065f);}(_0x287e,0x1e3));var _0xe287=function(_0x2768b4,_0x3133f4){_0x2768b4=_0x2768b4-0x0;var _0x2048a3=_0x287e[_0x2768b4];return _0x2048a3;};'use strict';var multer=require(_0xe287('0x0'));var util=require(_0xe287('0x1'));var path=require(_0xe287('0x2'));var timeout=require(_0xe287('0x3'));var express=require(_0xe287('0x4'));var router=express[_0xe287('0x5')]();var auth=require(_0xe287('0x6'));var interaction=require(_0xe287('0x7'));var config=require(_0xe287('0x8'));var controller=require('./smsQueueReport.controller');router[_0xe287('0x9')]('/',auth[_0xe287('0xa')](),controller['index']);router['get'](_0xe287('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xe287('0xc'),auth[_0xe287('0xa')](),controller[_0xe287('0xd')]);router[_0xe287('0xe')]('/',auth[_0xe287('0xa')](),controller[_0xe287('0xf')]);router[_0xe287('0x10')](_0xe287('0xc'),auth[_0xe287('0xa')](),controller[_0xe287('0x11')]);router[_0xe287('0x12')](_0xe287('0xc'),auth['isAuthenticated'](),controller[_0xe287('0x13')]);module['exports']=router;
\ No newline at end of file
index ba4e7bf..743a2de 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa42e=['sequelize','STRING','DATE'];(function(_0x101842,_0x4db31b){var _0x45ce04=function(_0x1754a3){while(--_0x1754a3){_0x101842['push'](_0x101842['shift']());}};_0x45ce04(++_0x4db31b);}(_0xa42e,0x144));var _0xea42=function(_0x12d9de,_0x585f37){_0x12d9de=_0x12d9de-0x0;var _0x47eea4=_0xa42e[_0x12d9de];return _0x47eea4;};'use strict';var moment=require('moment');var Sequelize=require(_0xea42('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xea42('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xea42('0x1')]},'joinAt':{'type':Sequelize[_0xea42('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xea42('0x2')]},'exitAt':{'type':Sequelize[_0xea42('0x2')]},'reason':{'type':Sequelize[_0xea42('0x1')]}};
\ No newline at end of file
+var _0x68d9=['STRING','DATE','moment','sequelize','exports'];(function(_0x41fdfc,_0x2a8ddc){var _0x3140ed=function(_0x4d8483){while(--_0x4d8483){_0x41fdfc['push'](_0x41fdfc['shift']());}};_0x3140ed(++_0x2a8ddc);}(_0x68d9,0x179));var _0x968d=function(_0x125eea,_0x2c7b18){_0x125eea=_0x125eea-0x0;var _0xfc894e=_0x68d9[_0x125eea];return _0xfc894e;};'use strict';var moment=require(_0x968d('0x0'));var Sequelize=require(_0x968d('0x1'));module[_0x968d('0x2')]={'uniqueid':{'type':Sequelize[_0x968d('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x968d('0x3')]},'joinAt':{'type':Sequelize[_0x968d('0x4')]},'leaveAt':{'type':Sequelize[_0x968d('0x4')]},'acceptAt':{'type':Sequelize[_0x968d('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x968d('0x3')]}};
\ No newline at end of file
index 3f22051..f02030e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd7b1=['sort','where','pick','filter','map','type','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','count','offset','limit','json','reject','save','update','then','destroy','sendStatus','name','send','index','SmsQueueReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0xd6165e,_0x2195e1){var _0x207e4f=function(_0xb5ac83){while(--_0xb5ac83){_0xd6165e['push'](_0xd6165e['shift']());}};_0x207e4f(++_0x2195e1);}(_0xd7b1,0x12d));var _0x1d7b=function(_0x76f83f,_0x4307b3){_0x76f83f=_0x76f83f-0x0;var _0x50bb57=_0xd7b1[_0x76f83f];return _0x50bb57;};'use strict';var pdf=require(_0x1d7b('0x0'));var emlformat=require(_0x1d7b('0x1'));var rimraf=require(_0x1d7b('0x2'));var zipdir=require(_0x1d7b('0x3'));var jsonpatch=require(_0x1d7b('0x4'));var rp=require(_0x1d7b('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1d7b('0x6'));var path=require(_0x1d7b('0x7'));var sox=require(_0x1d7b('0x8'));var csv=require(_0x1d7b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1d7b('0xa'));var crypto=require(_0x1d7b('0xb'));var jsforce=require(_0x1d7b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1d7b('0x9'));var querystring=require(_0x1d7b('0xd'));var Papa=require(_0x1d7b('0xe'));var authService=require(_0x1d7b('0xf'));var hardwareService=require(_0x1d7b('0x10'));var Redis=require(_0x1d7b('0x11'));var qs=require(_0x1d7b('0x12'));var logger=require(_0x1d7b('0x13'))('api');var utils=require(_0x1d7b('0x14'));var config=require(_0x1d7b('0x15'));var db=require(_0x1d7b('0x16'))['db'];function respondWithStatusCode(_0x1cfadc,_0x73ab0b){_0x73ab0b=_0x73ab0b||0xcc;return function(_0x266218){if(_0x266218){return _0x1cfadc['sendStatus'](_0x73ab0b);}return _0x1cfadc['status'](_0x73ab0b)[_0x1d7b('0x17')]();};}function respondWithResult(_0x378fb5,_0x494b2c){_0x494b2c=_0x494b2c||0xc8;return function(_0xa81127){if(_0xa81127){return _0x378fb5[_0x1d7b('0x18')](_0x494b2c)['json'](_0xa81127);}};}function respondWithFilteredResult(_0xe6fca5,_0x3a104c){return function(_0xdb223b){if(_0xdb223b){var _0x2e096d=_0xdb223b[_0x1d7b('0x19')],_0x417e49=_0x3a104c[_0x1d7b('0x1a')],_0x4a86e9=_0x3a104c[_0x1d7b('0x1a')]+_0x3a104c[_0x1d7b('0x1b')],_0x1dff3c;if(_0x4a86e9>=_0x2e096d){_0x4a86e9=_0x2e096d;_0x1dff3c=0xc8;}else{_0x1dff3c=0xce;}_0xe6fca5[_0x1d7b('0x18')](_0x1dff3c);return _0xe6fca5['set']('Content-Range',_0x417e49+'-'+_0x4a86e9+'/'+_0x2e096d)[_0x1d7b('0x1c')](_0xdb223b);}return null;};}function patchUpdates(_0x100a25){return function(_0xa803f6){try{jsonpatch['apply'](_0xa803f6,_0x100a25,!![]);}catch(_0x385436){return BPromise[_0x1d7b('0x1d')](_0x385436);}return _0xa803f6[_0x1d7b('0x1e')]();};}function saveUpdates(_0x35b295,_0x56c4a4){return function(_0x4551b9){if(_0x4551b9){return _0x4551b9[_0x1d7b('0x1f')](_0x35b295)[_0x1d7b('0x20')](function(_0x55afb8){return _0x55afb8;});}return null;};}function removeEntity(_0x3c3ec8,_0x2c4f8d){return function(_0x338b5b){if(_0x338b5b){return _0x338b5b[_0x1d7b('0x21')]()['then'](function(){_0x3c3ec8[_0x1d7b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f36e7,_0x3c1f3c){return function(_0x5f03f1){if(!_0x5f03f1){_0x5f36e7[_0x1d7b('0x22')](0x194);}return _0x5f03f1;};}function handleError(_0x3bcfa1,_0x247834){_0x247834=_0x247834||0x1f4;return function(_0x2bd91d){logger['error'](_0x2bd91d['stack']);if(_0x2bd91d[_0x1d7b('0x23')]){delete _0x2bd91d[_0x1d7b('0x23')];}_0x3bcfa1['status'](_0x247834)[_0x1d7b('0x24')](_0x2bd91d);};}exports[_0x1d7b('0x25')]=function(_0x3894f3,_0x162244){var _0x393cbe={},_0x113189={},_0x518888={'count':0x0,'rows':[]};var _0x4a13ce=db[_0x1d7b('0x26')][_0x1d7b('0x27')];_0x113189[_0x1d7b('0x28')]=_[_0x1d7b('0x29')](_0x4a13ce);_0x113189[_0x1d7b('0x2a')]=_['keys'](_0x3894f3[_0x1d7b('0x2a')]);_0x113189[_0x1d7b('0x2b')]=_[_0x1d7b('0x2c')](_0x113189['model'],_0x113189['query']);_0x393cbe[_0x1d7b('0x2d')]=_[_0x1d7b('0x2c')](_0x113189[_0x1d7b('0x28')],qs[_0x1d7b('0x2e')](_0x3894f3[_0x1d7b('0x2a')][_0x1d7b('0x2e')]));_0x393cbe['attributes']=_0x393cbe[_0x1d7b('0x2d')][_0x1d7b('0x2f')]?_0x393cbe[_0x1d7b('0x2d')]:_0x113189[_0x1d7b('0x28')];if(!_0x3894f3[_0x1d7b('0x2a')][_0x1d7b('0x30')]('nolimit')){_0x393cbe[_0x1d7b('0x1b')]=qs[_0x1d7b('0x1b')](_0x3894f3['query'][_0x1d7b('0x1b')]);_0x393cbe[_0x1d7b('0x1a')]=qs[_0x1d7b('0x1a')](_0x3894f3[_0x1d7b('0x2a')]['offset']);}_0x393cbe['order']=qs[_0x1d7b('0x31')](_0x3894f3[_0x1d7b('0x2a')]['sort']);_0x393cbe[_0x1d7b('0x32')]=qs[_0x1d7b('0x2b')](_[_0x1d7b('0x33')](_0x3894f3[_0x1d7b('0x2a')],_0x113189[_0x1d7b('0x2b')]));if(_0x3894f3[_0x1d7b('0x2a')][_0x1d7b('0x34')]){_0x393cbe[_0x1d7b('0x32')]=_['merge'](_0x393cbe[_0x1d7b('0x32')],{'$or':_[_0x1d7b('0x35')](_0x4a13ce,function(_0x406e1d){if(_0x406e1d[_0x1d7b('0x36')]['key']!==_0x1d7b('0x37')){var _0x59dbaa={};_0x59dbaa[_0x406e1d[_0x1d7b('0x38')]]={'$like':'%'+_0x3894f3[_0x1d7b('0x2a')][_0x1d7b('0x34')]+'%'};return _0x59dbaa;}})});}_0x393cbe=_['merge']({},_0x393cbe,_0x3894f3[_0x1d7b('0x39')]);var _0x55d751={'where':_0x393cbe[_0x1d7b('0x32')]};return db[_0x1d7b('0x26')]['count'](_0x55d751)[_0x1d7b('0x20')](function(_0x1adb77){_0x518888['count']=_0x1adb77;if(_0x3894f3['query'][_0x1d7b('0x3a')]){_0x393cbe[_0x1d7b('0x3b')]=[{'all':!![]}];}return db[_0x1d7b('0x26')][_0x1d7b('0x3c')](_0x393cbe);})[_0x1d7b('0x20')](function(_0x5da33a){_0x518888[_0x1d7b('0x3d')]=_0x5da33a;return _0x518888;})[_0x1d7b('0x20')](respondWithFilteredResult(_0x162244,_0x393cbe))[_0x1d7b('0x3e')](handleError(_0x162244,null));};exports[_0x1d7b('0x3f')]=function(_0x146deb,_0x4fcaaf){var _0x35e407={'raw':!![],'where':{'id':_0x146deb[_0x1d7b('0x40')]['id']}},_0x56695a={};_0x56695a['model']=_[_0x1d7b('0x29')](db['SmsQueueReport'][_0x1d7b('0x27')]);_0x56695a[_0x1d7b('0x2a')]=_[_0x1d7b('0x29')](_0x146deb[_0x1d7b('0x2a')]);_0x56695a[_0x1d7b('0x2b')]=_[_0x1d7b('0x2c')](_0x56695a['model'],_0x56695a[_0x1d7b('0x2a')]);_0x35e407['attributes']=_['intersection'](_0x56695a['model'],qs[_0x1d7b('0x2e')](_0x146deb['query']['fields']));_0x35e407[_0x1d7b('0x2d')]=_0x35e407[_0x1d7b('0x2d')][_0x1d7b('0x2f')]?_0x35e407[_0x1d7b('0x2d')]:_0x56695a[_0x1d7b('0x28')];if(_0x146deb[_0x1d7b('0x2a')]['includeAll']){_0x35e407[_0x1d7b('0x3b')]=[{'all':!![]}];}_0x35e407=_[_0x1d7b('0x41')]({},_0x35e407,_0x146deb[_0x1d7b('0x39')]);return db['SmsQueueReport'][_0x1d7b('0x42')](_0x35e407)[_0x1d7b('0x20')](handleEntityNotFound(_0x4fcaaf,null))['then'](respondWithResult(_0x4fcaaf,null))[_0x1d7b('0x3e')](handleError(_0x4fcaaf,null));};exports['create']=function(_0x387d61,_0x538085){return db['SmsQueueReport'][_0x1d7b('0x43')](_0x387d61[_0x1d7b('0x44')],{})['then'](respondWithResult(_0x538085,0xc9))['catch'](handleError(_0x538085,null));};exports['update']=function(_0x5a8997,_0x203cb4){if(_0x5a8997[_0x1d7b('0x44')]['id']){delete _0x5a8997['body']['id'];}return db[_0x1d7b('0x26')][_0x1d7b('0x42')]({'where':{'id':_0x5a8997[_0x1d7b('0x40')]['id']}})['then'](handleEntityNotFound(_0x203cb4,null))[_0x1d7b('0x20')](saveUpdates(_0x5a8997[_0x1d7b('0x44')],null))[_0x1d7b('0x20')](respondWithResult(_0x203cb4,null))['catch'](handleError(_0x203cb4,null));};exports[_0x1d7b('0x21')]=function(_0x271295,_0x2f561a){return db['SmsQueueReport'][_0x1d7b('0x42')]({'where':{'id':_0x271295[_0x1d7b('0x40')]['id']}})[_0x1d7b('0x20')](handleEntityNotFound(_0x2f561a,null))[_0x1d7b('0x20')](removeEntity(_0x2f561a,null))['catch'](handleError(_0x2f561a,null));};exports[_0x1d7b('0x45')]=function(_0x486cb0,_0x2cb5a2){return db[_0x1d7b('0x26')]['describe']()['then'](respondWithResult(_0x2cb5a2,null))[_0x1d7b('0x3e')](handleError(_0x2cb5a2,null));};
\ No newline at end of file
+var _0x39cb=['options','find','catch','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','SmsQueueReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','includeAll','include','findAll','show','params'];(function(_0x478e95,_0x57af41){var _0x2ba047=function(_0x1be277){while(--_0x1be277){_0x478e95['push'](_0x478e95['shift']());}};_0x2ba047(++_0x57af41);}(_0x39cb,0x9e));var _0xb39c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x39cb[_0x3ab51d];return _0x29a04e;};'use strict';var pdf=require(_0xb39c('0x0'));var emlformat=require(_0xb39c('0x1'));var rimraf=require(_0xb39c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb39c('0x3'));var rp=require(_0xb39c('0x4'));var moment=require(_0xb39c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb39c('0x6'));var util=require(_0xb39c('0x7'));var path=require('path');var sox=require(_0xb39c('0x8'));var csv=require(_0xb39c('0x9'));var ejs=require(_0xb39c('0xa'));var fs=require('fs');var _=require(_0xb39c('0xb'));var squel=require(_0xb39c('0xc'));var crypto=require(_0xb39c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb39c('0xe'));var toCsv=require(_0xb39c('0x9'));var querystring=require('querystring');var Papa=require(_0xb39c('0xf'));var authService=require(_0xb39c('0x10'));var hardwareService=require(_0xb39c('0x11'));var Redis=require(_0xb39c('0x12'));var qs=require(_0xb39c('0x13'));var logger=require(_0xb39c('0x14'))(_0xb39c('0x15'));var utils=require(_0xb39c('0x16'));var config=require(_0xb39c('0x17'));var db=require(_0xb39c('0x18'))['db'];function respondWithStatusCode(_0x1f3b9f,_0x1a1cc3){_0x1a1cc3=_0x1a1cc3||0xcc;return function(_0x64a04){if(_0x64a04){return _0x1f3b9f[_0xb39c('0x19')](_0x1a1cc3);}return _0x1f3b9f['status'](_0x1a1cc3)[_0xb39c('0x1a')]();};}function respondWithResult(_0x287646,_0x284ccd){_0x284ccd=_0x284ccd||0xc8;return function(_0x5b15ee){if(_0x5b15ee){return _0x287646[_0xb39c('0x1b')](_0x284ccd)['json'](_0x5b15ee);}};}function respondWithFilteredResult(_0x469cde,_0x3d7ddb){return function(_0xb7a3ba){if(_0xb7a3ba){var _0x4942fc=_0xb7a3ba[_0xb39c('0x1c')],_0xb3cd89=_0x3d7ddb['offset'],_0x20df0f=_0x3d7ddb[_0xb39c('0x1d')]+_0x3d7ddb['limit'],_0x20035f;if(_0x20df0f>=_0x4942fc){_0x20df0f=_0x4942fc;_0x20035f=0xc8;}else{_0x20035f=0xce;}_0x469cde[_0xb39c('0x1b')](_0x20035f);return _0x469cde['set'](_0xb39c('0x1e'),_0xb3cd89+'-'+_0x20df0f+'/'+_0x4942fc)['json'](_0xb7a3ba);}return null;};}function patchUpdates(_0x5a4156){return function(_0x4a1676){try{jsonpatch[_0xb39c('0x1f')](_0x4a1676,_0x5a4156,!![]);}catch(_0x323982){return BPromise[_0xb39c('0x20')](_0x323982);}return _0x4a1676[_0xb39c('0x21')]();};}function saveUpdates(_0x56ea28,_0x19b58f){return function(_0x2c2d11){if(_0x2c2d11){return _0x2c2d11[_0xb39c('0x22')](_0x56ea28)[_0xb39c('0x23')](function(_0xf0366d){return _0xf0366d;});}return null;};}function removeEntity(_0x2d6d77,_0x4560d1){return function(_0x55bbb9){if(_0x55bbb9){return _0x55bbb9[_0xb39c('0x24')]()[_0xb39c('0x23')](function(){_0x2d6d77[_0xb39c('0x1b')](0xcc)[_0xb39c('0x1a')]();});}};}function handleEntityNotFound(_0xa8b80d,_0x121d6f){return function(_0x199e81){if(!_0x199e81){_0xa8b80d['sendStatus'](0x194);}return _0x199e81;};}function handleError(_0x120759,_0x5a40f0){_0x5a40f0=_0x5a40f0||0x1f4;return function(_0x38a519){logger[_0xb39c('0x25')](_0x38a519[_0xb39c('0x26')]);if(_0x38a519[_0xb39c('0x27')]){delete _0x38a519[_0xb39c('0x27')];}_0x120759[_0xb39c('0x1b')](_0x5a40f0)[_0xb39c('0x28')](_0x38a519);};}exports[_0xb39c('0x29')]=function(_0x1ba4cb,_0x50c3ad){var _0x3d83d1={},_0x909da5={},_0x495501={'count':0x0,'rows':[]};var _0x18e0ed=db[_0xb39c('0x2a')][_0xb39c('0x2b')];_0x909da5[_0xb39c('0x2c')]=_[_0xb39c('0x2d')](_0x18e0ed);_0x909da5[_0xb39c('0x2e')]=_[_0xb39c('0x2d')](_0x1ba4cb[_0xb39c('0x2e')]);_0x909da5[_0xb39c('0x2f')]=_[_0xb39c('0x30')](_0x909da5[_0xb39c('0x2c')],_0x909da5['query']);_0x3d83d1[_0xb39c('0x31')]=_['intersection'](_0x909da5[_0xb39c('0x2c')],qs[_0xb39c('0x32')](_0x1ba4cb[_0xb39c('0x2e')]['fields']));_0x3d83d1['attributes']=_0x3d83d1[_0xb39c('0x31')][_0xb39c('0x33')]?_0x3d83d1[_0xb39c('0x31')]:_0x909da5[_0xb39c('0x2c')];if(!_0x1ba4cb[_0xb39c('0x2e')][_0xb39c('0x34')]('nolimit')){_0x3d83d1[_0xb39c('0x35')]=qs['limit'](_0x1ba4cb[_0xb39c('0x2e')][_0xb39c('0x35')]);_0x3d83d1[_0xb39c('0x1d')]=qs['offset'](_0x1ba4cb[_0xb39c('0x2e')][_0xb39c('0x1d')]);}_0x3d83d1[_0xb39c('0x36')]=qs[_0xb39c('0x37')](_0x1ba4cb['query']['sort']);_0x3d83d1[_0xb39c('0x38')]=qs[_0xb39c('0x2f')](_[_0xb39c('0x39')](_0x1ba4cb[_0xb39c('0x2e')],_0x909da5['filters']));if(_0x1ba4cb[_0xb39c('0x2e')][_0xb39c('0x3a')]){_0x3d83d1['where']=_[_0xb39c('0x3b')](_0x3d83d1['where'],{'$or':_[_0xb39c('0x3c')](_0x18e0ed,function(_0x12aa8f){if(_0x12aa8f[_0xb39c('0x3d')][_0xb39c('0x3e')]!==_0xb39c('0x3f')){var _0x3c9634={};_0x3c9634[_0x12aa8f[_0xb39c('0x40')]]={'$like':'%'+_0x1ba4cb[_0xb39c('0x2e')][_0xb39c('0x3a')]+'%'};return _0x3c9634;}})});}_0x3d83d1=_[_0xb39c('0x3b')]({},_0x3d83d1,_0x1ba4cb['options']);var _0x47ea4e={'where':_0x3d83d1[_0xb39c('0x38')]};return db[_0xb39c('0x2a')][_0xb39c('0x1c')](_0x47ea4e)['then'](function(_0x2cc8e8){_0x495501[_0xb39c('0x1c')]=_0x2cc8e8;if(_0x1ba4cb[_0xb39c('0x2e')][_0xb39c('0x41')]){_0x3d83d1[_0xb39c('0x42')]=[{'all':!![]}];}return db[_0xb39c('0x2a')][_0xb39c('0x43')](_0x3d83d1);})[_0xb39c('0x23')](function(_0xfc68bb){_0x495501['rows']=_0xfc68bb;return _0x495501;})[_0xb39c('0x23')](respondWithFilteredResult(_0x50c3ad,_0x3d83d1))['catch'](handleError(_0x50c3ad,null));};exports[_0xb39c('0x44')]=function(_0x1358f5,_0x5bc9cc){var _0x598715={'raw':!![],'where':{'id':_0x1358f5[_0xb39c('0x45')]['id']}},_0x3adedf={};_0x3adedf[_0xb39c('0x2c')]=_[_0xb39c('0x2d')](db[_0xb39c('0x2a')][_0xb39c('0x2b')]);_0x3adedf['query']=_[_0xb39c('0x2d')](_0x1358f5[_0xb39c('0x2e')]);_0x3adedf[_0xb39c('0x2f')]=_[_0xb39c('0x30')](_0x3adedf[_0xb39c('0x2c')],_0x3adedf[_0xb39c('0x2e')]);_0x598715['attributes']=_[_0xb39c('0x30')](_0x3adedf[_0xb39c('0x2c')],qs[_0xb39c('0x32')](_0x1358f5['query'][_0xb39c('0x32')]));_0x598715[_0xb39c('0x31')]=_0x598715[_0xb39c('0x31')]['length']?_0x598715[_0xb39c('0x31')]:_0x3adedf[_0xb39c('0x2c')];if(_0x1358f5[_0xb39c('0x2e')][_0xb39c('0x41')]){_0x598715['include']=[{'all':!![]}];}_0x598715=_[_0xb39c('0x3b')]({},_0x598715,_0x1358f5[_0xb39c('0x46')]);return db['SmsQueueReport'][_0xb39c('0x47')](_0x598715)['then'](handleEntityNotFound(_0x5bc9cc,null))['then'](respondWithResult(_0x5bc9cc,null))[_0xb39c('0x48')](handleError(_0x5bc9cc,null));};exports[_0xb39c('0x49')]=function(_0xc32be8,_0x1fd44d){return db[_0xb39c('0x2a')][_0xb39c('0x49')](_0xc32be8[_0xb39c('0x4a')],{})[_0xb39c('0x23')](respondWithResult(_0x1fd44d,0xc9))[_0xb39c('0x48')](handleError(_0x1fd44d,null));};exports[_0xb39c('0x22')]=function(_0x2c8587,_0x44b492){if(_0x2c8587['body']['id']){delete _0x2c8587[_0xb39c('0x4a')]['id'];}return db[_0xb39c('0x2a')][_0xb39c('0x47')]({'where':{'id':_0x2c8587['params']['id']}})[_0xb39c('0x23')](handleEntityNotFound(_0x44b492,null))[_0xb39c('0x23')](saveUpdates(_0x2c8587['body'],null))[_0xb39c('0x23')](respondWithResult(_0x44b492,null))[_0xb39c('0x48')](handleError(_0x44b492,null));};exports[_0xb39c('0x24')]=function(_0x4e5e17,_0x2eda87){return db[_0xb39c('0x2a')]['find']({'where':{'id':_0x4e5e17[_0xb39c('0x45')]['id']}})[_0xb39c('0x23')](handleEntityNotFound(_0x2eda87,null))['then'](removeEntity(_0x2eda87,null))[_0xb39c('0x48')](handleError(_0x2eda87,null));};exports[_0xb39c('0x4b')]=function(_0x538724,_0x26fd0d){return db[_0xb39c('0x2a')][_0xb39c('0x4b')]()[_0xb39c('0x23')](respondWithResult(_0x26fd0d,null))[_0xb39c('0x48')](handleError(_0x26fd0d,null));};
\ No newline at end of file
index 83ef97b..abd407d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbed8=['./smsQueueReport.attributes','exports','SmsQueueReport','report_sms_queue','uniqueid','../../config/logger','moment','bluebird'];(function(_0x1847e6,_0x445c9e){var _0x411836=function(_0xb69b0f){while(--_0xb69b0f){_0x1847e6['push'](_0x1847e6['shift']());}};_0x411836(++_0x445c9e);}(_0xbed8,0x1b5));var _0x8bed=function(_0x575c75,_0x120aa9){_0x575c75=_0x575c75-0x0;var _0x436370=_0xbed8[_0x575c75];return _0x436370;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8bed('0x0'))('api');var moment=require(_0x8bed('0x1'));var BPromise=require(_0x8bed('0x2'));var rp=require('request-promise');var attributes=require(_0x8bed('0x3'));module[_0x8bed('0x4')]=function(_0x2a2863,_0x2e955b){return _0x2a2863['define'](_0x8bed('0x5'),attributes,{'tableName':_0x8bed('0x6'),'paranoid':![],'indexes':[{'name':_0x8bed('0x7'),'fields':[_0x8bed('0x7')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xc534=['bluebird','request-promise','./smsQueueReport.attributes','SmsQueueReport','report_sms_queue','uniqueid','../../config/logger','moment'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xc534,0x16e));var _0x4c53=function(_0x331085,_0x46ef3b){_0x331085=_0x331085-0x0;var _0x1547f4=_0xc534[_0x331085];return _0x1547f4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4c53('0x0'))('api');var moment=require(_0x4c53('0x1'));var BPromise=require(_0x4c53('0x2'));var rp=require(_0x4c53('0x3'));var attributes=require(_0x4c53('0x4'));module['exports']=function(_0x3a74b8,_0x3f2f97){return _0x3a74b8['define'](_0x4c53('0x5'),attributes,{'tableName':_0x4c53('0x6'),'paranoid':![],'indexes':[{'name':_0x4c53('0x7'),'fields':[_0x4c53('0x7')]}],'timestamps':!![]});};
\ No newline at end of file
index 261f78b..111999b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x14ee=['jayson/promise','client','request','then','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','result','catch','SmsQueueReport','options','CreateSmsQueueReport','UpdateSmsQueueReport','body','where','attributes','lodash','util','randomstring','../../config/logger','rpc','../../config/environment'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x14ee,0xa2));var _0xe14e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x14ee[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe14e('0x0'));var util=require(_0xe14e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe14e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe14e('0x3'))(_0xe14e('0x4'));var config=require(_0xe14e('0x5'));var jayson=require(_0xe14e('0x6'));var client=jayson[_0xe14e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x262a14,_0x894229,_0x35b311){return new BPromise(function(_0x34157f,_0x5f1134){return client[_0xe14e('0x8')](_0x262a14,_0x35b311)[_0xe14e('0x9')](function(_0xe48c24){logger[_0xe14e('0xa')]('SmsQueueReport,\x20%s,\x20%s',_0x894229,_0xe14e('0xb'));logger[_0xe14e('0xc')](_0xe14e('0xd'),_0x894229,_0xe14e('0xb'),JSON[_0xe14e('0xe')](_0xe48c24));if(_0xe48c24[_0xe14e('0xf')]){if(_0xe48c24['error'][_0xe14e('0x10')]===0x1f4){logger['error'](_0xe14e('0x11'),_0x894229,_0xe48c24['error']['message']);return _0x5f1134(_0xe48c24[_0xe14e('0xf')][_0xe14e('0x12')]);}logger['error'](_0xe14e('0x11'),_0x894229,_0xe48c24[_0xe14e('0xf')][_0xe14e('0x12')]);return _0x34157f(_0xe48c24[_0xe14e('0xf')][_0xe14e('0x12')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x894229,_0xe14e('0xb'));_0x34157f(_0xe48c24[_0xe14e('0x13')][_0xe14e('0x12')]);}})[_0xe14e('0x14')](function(_0x3c4db7){logger[_0xe14e('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x894229,_0x3c4db7);_0x5f1134(_0x3c4db7);});});}exports['CreateSmsQueueReport']=function(_0xe90cb3){var _0x41def2=this;return new Promise(function(_0x1624cd,_0x46bbdf){return db[_0xe14e('0x15')]['create'](_0xe90cb3['body'],{'raw':_0xe90cb3[_0xe14e('0x16')]?_0xe90cb3['options']['raw']===undefined?!![]:![]:!![]})[_0xe14e('0x9')](function(_0x4b7bcd){logger[_0xe14e('0xa')]('CreateSmsQueueReport',_0xe90cb3);logger[_0xe14e('0xc')](_0xe14e('0x17'),_0xe90cb3,JSON[_0xe14e('0xe')](_0x4b7bcd));_0x1624cd(_0x4b7bcd);})[_0xe14e('0x14')](function(_0x31d838){logger[_0xe14e('0xf')](_0xe14e('0x17'),_0x31d838[_0xe14e('0x12')],_0xe90cb3);_0x46bbdf(_0x41def2[_0xe14e('0xf')](0x1f4,_0x31d838['message']));});});};exports[_0xe14e('0x18')]=function(_0x2620ec){var _0x223787=this;return new Promise(function(_0x1bea91,_0x2ee4eb){return db[_0xe14e('0x15')]['update'](_0x2620ec[_0xe14e('0x19')],{'raw':_0x2620ec['options']?_0x2620ec['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2620ec[_0xe14e('0x16')]?_0x2620ec[_0xe14e('0x16')][_0xe14e('0x1a')]||null:null,'attributes':_0x2620ec[_0xe14e('0x16')]?_0x2620ec['options'][_0xe14e('0x1b')]||null:null,'limit':_0x2620ec[_0xe14e('0x16')]?_0x2620ec[_0xe14e('0x16')]['limit']||null:null})[_0xe14e('0x9')](function(_0x209426){logger[_0xe14e('0xa')](_0xe14e('0x18'),_0x2620ec);logger[_0xe14e('0xc')](_0xe14e('0x18'),_0x2620ec,JSON[_0xe14e('0xe')](_0x209426));_0x1bea91(_0x209426);})[_0xe14e('0x14')](function(_0x4e3f1d){logger[_0xe14e('0xf')](_0xe14e('0x18'),_0x4e3f1d[_0xe14e('0x12')],_0x2620ec);_0x2ee4eb(_0x223787[_0xe14e('0xf')](0x1f4,_0x4e3f1d['message']));});});};
\ No newline at end of file
+var _0xe54d=['result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','stringify','UpdateSmsQueueReport','update','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe54d,0xa8));var _0xde54=function(_0x556f91,_0x5f5d79){_0x556f91=_0x556f91-0x0;var _0x3dda91=_0xe54d[_0x556f91];return _0x3dda91;};'use strict';var _=require(_0xde54('0x0'));var util=require(_0xde54('0x1'));var moment=require(_0xde54('0x2'));var BPromise=require(_0xde54('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde54('0x4'));var db=require(_0xde54('0x5'))['db'];var utils=require(_0xde54('0x6'));var logger=require(_0xde54('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1dcae6,_0x2fca7c,_0x4d98ba){return new BPromise(function(_0x4669df,_0x3c7e0a){return client[_0xde54('0x8')](_0x1dcae6,_0x4d98ba)[_0xde54('0x9')](function(_0xda94f0){logger[_0xde54('0xa')](_0xde54('0xb'),_0x2fca7c,_0xde54('0xc'));logger[_0xde54('0xd')](_0xde54('0xe'),_0x2fca7c,_0xde54('0xc'),JSON['stringify'](_0xda94f0));if(_0xda94f0[_0xde54('0xf')]){if(_0xda94f0[_0xde54('0xf')][_0xde54('0x10')]===0x1f4){logger['error'](_0xde54('0xb'),_0x2fca7c,_0xda94f0[_0xde54('0xf')][_0xde54('0x11')]);return _0x3c7e0a(_0xda94f0[_0xde54('0xf')]['message']);}logger[_0xde54('0xf')](_0xde54('0xb'),_0x2fca7c,_0xda94f0[_0xde54('0xf')][_0xde54('0x11')]);return _0x4669df(_0xda94f0[_0xde54('0xf')]['message']);}else{logger[_0xde54('0xa')](_0xde54('0xb'),_0x2fca7c,_0xde54('0xc'));_0x4669df(_0xda94f0[_0xde54('0x12')][_0xde54('0x11')]);}})[_0xde54('0x13')](function(_0x1938e4){logger[_0xde54('0xf')](_0xde54('0xb'),_0x2fca7c,_0x1938e4);_0x3c7e0a(_0x1938e4);});});}exports[_0xde54('0x14')]=function(_0x3dad7e){var _0x44ef7c=this;return new Promise(function(_0x2d6cda,_0x19e4d9){return db[_0xde54('0x15')][_0xde54('0x16')](_0x3dad7e[_0xde54('0x17')],{'raw':_0x3dad7e[_0xde54('0x18')]?_0x3dad7e[_0xde54('0x18')][_0xde54('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x4ebc15){logger[_0xde54('0xa')](_0xde54('0x14'),_0x3dad7e);logger[_0xde54('0xd')](_0xde54('0x14'),_0x3dad7e,JSON[_0xde54('0x1a')](_0x4ebc15));_0x2d6cda(_0x4ebc15);})['catch'](function(_0x51fbc9){logger[_0xde54('0xf')](_0xde54('0x14'),_0x51fbc9[_0xde54('0x11')],_0x3dad7e);_0x19e4d9(_0x44ef7c[_0xde54('0xf')](0x1f4,_0x51fbc9[_0xde54('0x11')]));});});};exports[_0xde54('0x1b')]=function(_0x455140){var _0x4114dd=this;return new Promise(function(_0x1cdd4b,_0xa192ec){return db['SmsQueueReport'][_0xde54('0x1c')](_0x455140['body'],{'raw':_0x455140[_0xde54('0x18')]?_0x455140[_0xde54('0x18')][_0xde54('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x455140[_0xde54('0x18')]?_0x455140['options'][_0xde54('0x1d')]||null:null,'attributes':_0x455140['options']?_0x455140['options']['attributes']||null:null,'limit':_0x455140[_0xde54('0x18')]?_0x455140[_0xde54('0x18')][_0xde54('0x1e')]||null:null})[_0xde54('0x9')](function(_0x151fe1){logger[_0xde54('0xa')]('UpdateSmsQueueReport',_0x455140);logger[_0xde54('0xd')](_0xde54('0x1b'),_0x455140,JSON[_0xde54('0x1a')](_0x151fe1));_0x1cdd4b(_0x151fe1);})[_0xde54('0x13')](function(_0x514846){logger[_0xde54('0xf')](_0xde54('0x1b'),_0x514846[_0xde54('0x11')],_0x455140);_0xa192ec(_0x4114dd[_0xde54('0xf')](0x1f4,_0x514846[_0xde54('0x11')]));});});};
\ No newline at end of file
index b3a5bca..aefe5f5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x51a6=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','index','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports','multer','util'];(function(_0x3156e7,_0x3c7ae2){var _0x308e10=function(_0x1ed219){while(--_0x1ed219){_0x3156e7['push'](_0x3156e7['shift']());}};_0x308e10(++_0x3c7ae2);}(_0x51a6,0xc4));var _0x651a=function(_0x3b5f66,_0x1dbfc5){_0x3b5f66=_0x3b5f66-0x0;var _0x4aa1a8=_0x51a6[_0x3b5f66];return _0x4aa1a8;};'use strict';var multer=require(_0x651a('0x0'));var util=require(_0x651a('0x1'));var path=require(_0x651a('0x2'));var timeout=require(_0x651a('0x3'));var express=require(_0x651a('0x4'));var router=express[_0x651a('0x5')]();var auth=require(_0x651a('0x6'));var interaction=require(_0x651a('0x7'));var config=require(_0x651a('0x8'));var controller=require(_0x651a('0x9'));router[_0x651a('0xa')]('/',auth['isAuthenticated'](),controller[_0x651a('0xb')]);router[_0x651a('0xa')]('/describe',auth[_0x651a('0xc')](),controller[_0x651a('0xd')]);router['get'](_0x651a('0xe'),auth[_0x651a('0xc')](),controller[_0x651a('0xf')]);router[_0x651a('0x10')]('/',auth[_0x651a('0xc')](),controller[_0x651a('0x11')]);router[_0x651a('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x651a('0x13')]);router[_0x651a('0x14')]('/:id',auth[_0x651a('0xc')](),controller['destroy']);module[_0x651a('0x15')]=router;
\ No newline at end of file
+var _0xb0ae=['util','express','Router','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update','delete','exports','multer'];(function(_0x2dbddf,_0x4217b7){var _0x299728=function(_0x4a4e64){while(--_0x4a4e64){_0x2dbddf['push'](_0x2dbddf['shift']());}};_0x299728(++_0x4217b7);}(_0xb0ae,0xe3));var _0xeb0a=function(_0x6155d6,_0x474397){_0x6155d6=_0x6155d6-0x0;var _0x20286a=_0xb0ae[_0x6155d6];return _0x20286a;};'use strict';var multer=require(_0xeb0a('0x0'));var util=require(_0xeb0a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xeb0a('0x2'));var router=express[_0xeb0a('0x3')]();var auth=require(_0xeb0a('0x4'));var interaction=require(_0xeb0a('0x5'));var config=require('../../config/environment');var controller=require(_0xeb0a('0x6'));router[_0xeb0a('0x7')]('/',auth[_0xeb0a('0x8')](),controller['index']);router[_0xeb0a('0x7')](_0xeb0a('0x9'),auth[_0xeb0a('0x8')](),controller[_0xeb0a('0xa')]);router[_0xeb0a('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xeb0a('0xb')]);router[_0xeb0a('0xc')]('/',auth[_0xeb0a('0x8')](),controller[_0xeb0a('0xd')]);router[_0xeb0a('0xe')](_0xeb0a('0xf'),auth[_0xeb0a('0x8')](),controller[_0xeb0a('0x10')]);router[_0xeb0a('0x11')](_0xeb0a('0xf'),auth[_0xeb0a('0x8')](),controller['destroy']);module[_0xeb0a('0x12')]=router;
\ No newline at end of file
index d2a433c..5d579c6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc6a7=['queue','NOW','sequelize','exports','STRING','agent'];(function(_0x3ca6f6,_0x3e9153){var _0x5e24d6=function(_0x45078d){while(--_0x45078d){_0x3ca6f6['push'](_0x3ca6f6['shift']());}};_0x5e24d6(++_0x3e9153);}(_0xc6a7,0x15e));var _0x7c6a=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xc6a7[_0x565ed7];return _0x183ad7;};'use strict';var moment=require('moment');var Sequelize=require(_0x7c6a('0x0'));module[_0x7c6a('0x1')]={'uniqueid':{'type':Sequelize[_0x7c6a('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0x7c6a('0x3'),'queue'),'allowNull':![],'defaultValue':_0x7c6a('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x7c6a('0x5')]}};
\ No newline at end of file
+var _0x671f=['queue','DATE','sequelize','STRING','agent'];(function(_0x13e496,_0x47bfac){var _0xa112c4=function(_0x2dfd4f){while(--_0x2dfd4f){_0x13e496['push'](_0x13e496['shift']());}};_0xa112c4(++_0x47bfac);}(_0x671f,0xf7));var _0xf671=function(_0x330727,_0x510d14){_0x330727=_0x330727-0x0;var _0x53c5c0=_0x671f[_0x330727];return _0x53c5c0;};'use strict';var moment=require('moment');var Sequelize=require(_0xf671('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xf671('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0xf671('0x2'),_0xf671('0x3')),'allowNull':![],'defaultValue':_0xf671('0x3')},'transferredAt':{'type':Sequelize[_0xf671('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}};
\ No newline at end of file
index 0b11008..ae3ca88 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4898=['send','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','SmsTransferReport','includeAll','include','rows','catch','params','keys','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name'];(function(_0x28a76a,_0x38bf87){var _0xa74f3f=function(_0x3b27d4){while(--_0x3b27d4){_0x28a76a['push'](_0x28a76a['shift']());}};_0xa74f3f(++_0x38bf87);}(_0x4898,0xb2));var _0x8489=function(_0x34f023,_0x12eb07){_0x34f023=_0x34f023-0x0;var _0xfb53c6=_0x4898[_0x34f023];return _0xfb53c6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8489('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8489('0x1'));var jsonpatch=require(_0x8489('0x2'));var rp=require(_0x8489('0x3'));var moment=require(_0x8489('0x4'));var BPromise=require(_0x8489('0x5'));var Mustache=require(_0x8489('0x6'));var util=require(_0x8489('0x7'));var path=require('path');var sox=require(_0x8489('0x8'));var csv=require('to-csv');var ejs=require(_0x8489('0x9'));var fs=require('fs');var _=require(_0x8489('0xa'));var squel=require(_0x8489('0xb'));var crypto=require(_0x8489('0xc'));var jsforce=require(_0x8489('0xd'));var deskjs=require(_0x8489('0xe'));var toCsv=require(_0x8489('0xf'));var querystring=require(_0x8489('0x10'));var Papa=require(_0x8489('0x11'));var authService=require(_0x8489('0x12'));var hardwareService=require(_0x8489('0x13'));var Redis=require('ioredis');var qs=require(_0x8489('0x14'));var logger=require(_0x8489('0x15'))(_0x8489('0x16'));var utils=require(_0x8489('0x17'));var config=require(_0x8489('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x518085,_0x203e61){_0x203e61=_0x203e61||0xcc;return function(_0x34ffa7){if(_0x34ffa7){return _0x518085[_0x8489('0x19')](_0x203e61);}return _0x518085['status'](_0x203e61)[_0x8489('0x1a')]();};}function respondWithResult(_0x19ba62,_0x21f6de){_0x21f6de=_0x21f6de||0xc8;return function(_0x1572f0){if(_0x1572f0){return _0x19ba62[_0x8489('0x1b')](_0x21f6de)[_0x8489('0x1c')](_0x1572f0);}};}function respondWithFilteredResult(_0x1ba8b3,_0xa03e5a){return function(_0x40c9cc){if(_0x40c9cc){var _0x390f46=_0x40c9cc[_0x8489('0x1d')],_0x5426f0=_0xa03e5a[_0x8489('0x1e')],_0x6d3216=_0xa03e5a[_0x8489('0x1e')]+_0xa03e5a['limit'],_0xa405b4;if(_0x6d3216>=_0x390f46){_0x6d3216=_0x390f46;_0xa405b4=0xc8;}else{_0xa405b4=0xce;}_0x1ba8b3[_0x8489('0x1b')](_0xa405b4);return _0x1ba8b3[_0x8489('0x1f')](_0x8489('0x20'),_0x5426f0+'-'+_0x6d3216+'/'+_0x390f46)['json'](_0x40c9cc);}return null;};}function patchUpdates(_0x4435aa){return function(_0x58b016){try{jsonpatch[_0x8489('0x21')](_0x58b016,_0x4435aa,!![]);}catch(_0x48b709){return BPromise[_0x8489('0x22')](_0x48b709);}return _0x58b016[_0x8489('0x23')]();};}function saveUpdates(_0x50f058,_0x28e83a){return function(_0x1390e5){if(_0x1390e5){return _0x1390e5[_0x8489('0x24')](_0x50f058)[_0x8489('0x25')](function(_0x4416b3){return _0x4416b3;});}return null;};}function removeEntity(_0xb533ba,_0x2394f3){return function(_0x2216dc){if(_0x2216dc){return _0x2216dc[_0x8489('0x26')]()[_0x8489('0x25')](function(){_0xb533ba[_0x8489('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27b407,_0xfef47e){return function(_0x26864b){if(!_0x26864b){_0x27b407[_0x8489('0x19')](0x194);}return _0x26864b;};}function handleError(_0x206091,_0x19bf42){_0x19bf42=_0x19bf42||0x1f4;return function(_0x5ca8ff){logger[_0x8489('0x27')](_0x5ca8ff['stack']);if(_0x5ca8ff[_0x8489('0x28')]){delete _0x5ca8ff['name'];}_0x206091[_0x8489('0x1b')](_0x19bf42)[_0x8489('0x29')](_0x5ca8ff);};}exports['index']=function(_0x3e9c47,_0x12a9ee){var _0x11597e={},_0x3a3087={},_0x59a4d4={'count':0x0,'rows':[]};var _0x3cde8e=db['SmsTransferReport'][_0x8489('0x2a')];_0x3a3087[_0x8489('0x2b')]=_['keys'](_0x3cde8e);_0x3a3087[_0x8489('0x2c')]=_['keys'](_0x3e9c47[_0x8489('0x2c')]);_0x3a3087[_0x8489('0x2d')]=_[_0x8489('0x2e')](_0x3a3087[_0x8489('0x2b')],_0x3a3087[_0x8489('0x2c')]);_0x11597e[_0x8489('0x2f')]=_[_0x8489('0x2e')](_0x3a3087[_0x8489('0x2b')],qs[_0x8489('0x30')](_0x3e9c47[_0x8489('0x2c')]['fields']));_0x11597e[_0x8489('0x2f')]=_0x11597e[_0x8489('0x2f')][_0x8489('0x31')]?_0x11597e[_0x8489('0x2f')]:_0x3a3087[_0x8489('0x2b')];if(!_0x3e9c47[_0x8489('0x2c')][_0x8489('0x32')](_0x8489('0x33'))){_0x11597e['limit']=qs[_0x8489('0x34')](_0x3e9c47['query'][_0x8489('0x34')]);_0x11597e[_0x8489('0x1e')]=qs[_0x8489('0x1e')](_0x3e9c47['query'][_0x8489('0x1e')]);}_0x11597e[_0x8489('0x35')]=qs[_0x8489('0x36')](_0x3e9c47[_0x8489('0x2c')][_0x8489('0x36')]);_0x11597e[_0x8489('0x37')]=qs[_0x8489('0x2d')](_[_0x8489('0x38')](_0x3e9c47[_0x8489('0x2c')],_0x3a3087['filters']));if(_0x3e9c47['query'][_0x8489('0x39')]){_0x11597e[_0x8489('0x37')]=_[_0x8489('0x3a')](_0x11597e[_0x8489('0x37')],{'$or':_[_0x8489('0x3b')](_0x3cde8e,function(_0x244ee0){if(_0x244ee0['type']['key']!==_0x8489('0x3c')){var _0x58efcf={};_0x58efcf[_0x244ee0['field']]={'$like':'%'+_0x3e9c47[_0x8489('0x2c')][_0x8489('0x39')]+'%'};return _0x58efcf;}})});}_0x11597e=_[_0x8489('0x3a')]({},_0x11597e,_0x3e9c47[_0x8489('0x3d')]);var _0x477d1e={'where':_0x11597e[_0x8489('0x37')]};return db[_0x8489('0x3e')][_0x8489('0x1d')](_0x477d1e)['then'](function(_0x11bd69){_0x59a4d4[_0x8489('0x1d')]=_0x11bd69;if(_0x3e9c47[_0x8489('0x2c')][_0x8489('0x3f')]){_0x11597e[_0x8489('0x40')]=[{'all':!![]}];}return db[_0x8489('0x3e')]['findAll'](_0x11597e);})['then'](function(_0x1652b6){_0x59a4d4[_0x8489('0x41')]=_0x1652b6;return _0x59a4d4;})[_0x8489('0x25')](respondWithFilteredResult(_0x12a9ee,_0x11597e))[_0x8489('0x42')](handleError(_0x12a9ee,null));};exports['show']=function(_0x4e0f09,_0x3932bd){var _0x178a2b={'raw':!![],'where':{'id':_0x4e0f09[_0x8489('0x43')]['id']}},_0xa75db={};_0xa75db['model']=_[_0x8489('0x44')](db[_0x8489('0x3e')][_0x8489('0x2a')]);_0xa75db['query']=_[_0x8489('0x44')](_0x4e0f09[_0x8489('0x2c')]);_0xa75db[_0x8489('0x2d')]=_[_0x8489('0x2e')](_0xa75db['model'],_0xa75db[_0x8489('0x2c')]);_0x178a2b[_0x8489('0x2f')]=_['intersection'](_0xa75db['model'],qs[_0x8489('0x30')](_0x4e0f09[_0x8489('0x2c')][_0x8489('0x30')]));_0x178a2b[_0x8489('0x2f')]=_0x178a2b[_0x8489('0x2f')][_0x8489('0x31')]?_0x178a2b['attributes']:_0xa75db['model'];if(_0x4e0f09[_0x8489('0x2c')][_0x8489('0x3f')]){_0x178a2b['include']=[{'all':!![]}];}_0x178a2b=_[_0x8489('0x3a')]({},_0x178a2b,_0x4e0f09[_0x8489('0x3d')]);return db[_0x8489('0x3e')][_0x8489('0x45')](_0x178a2b)[_0x8489('0x25')](handleEntityNotFound(_0x3932bd,null))[_0x8489('0x25')](respondWithResult(_0x3932bd,null))[_0x8489('0x42')](handleError(_0x3932bd,null));};exports[_0x8489('0x46')]=function(_0x2bd1b4,_0x9dc158){return db[_0x8489('0x3e')][_0x8489('0x46')](_0x2bd1b4[_0x8489('0x47')],{})[_0x8489('0x25')](respondWithResult(_0x9dc158,0xc9))[_0x8489('0x42')](handleError(_0x9dc158,null));};exports[_0x8489('0x24')]=function(_0x191c24,_0x35dbcb){if(_0x191c24[_0x8489('0x47')]['id']){delete _0x191c24[_0x8489('0x47')]['id'];}return db[_0x8489('0x3e')][_0x8489('0x45')]({'where':{'id':_0x191c24[_0x8489('0x43')]['id']}})['then'](handleEntityNotFound(_0x35dbcb,null))['then'](saveUpdates(_0x191c24[_0x8489('0x47')],null))[_0x8489('0x25')](respondWithResult(_0x35dbcb,null))['catch'](handleError(_0x35dbcb,null));};exports[_0x8489('0x26')]=function(_0x46241c,_0x16fe03){return db[_0x8489('0x3e')][_0x8489('0x45')]({'where':{'id':_0x46241c[_0x8489('0x43')]['id']}})[_0x8489('0x25')](handleEntityNotFound(_0x16fe03,null))[_0x8489('0x25')](removeEntity(_0x16fe03,null))['catch'](handleError(_0x16fe03,null));};exports[_0x8489('0x48')]=function(_0x21ca2b,_0xe0915b){return db[_0x8489('0x3e')][_0x8489('0x48')]()[_0x8489('0x25')](respondWithResult(_0xe0915b,null))[_0x8489('0x42')](handleError(_0xe0915b,null));};
\ No newline at end of file
+var _0x59a9=['SmsTransferReport','rawAttributes','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','filter','where','merge','map','type','key','VIRTUAL','then','includeAll','findAll','rows','catch','show','keys','include','options','create','update','body','find','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','status','count','offset','Content-Range','save','destroy','end','error','stack','name','index'];(function(_0x3ba608,_0xf5bd32){var _0x204bb4=function(_0xdfa252){while(--_0xdfa252){_0x3ba608['push'](_0x3ba608['shift']());}};_0x204bb4(++_0xf5bd32);}(_0x59a9,0xb0));var _0x959a=function(_0xdf01ef,_0x7d4ccd){_0xdf01ef=_0xdf01ef-0x0;var _0x40514d=_0x59a9[_0xdf01ef];return _0x40514d;};'use strict';var pdf=require(_0x959a('0x0'));var emlformat=require(_0x959a('0x1'));var rimraf=require(_0x959a('0x2'));var zipdir=require(_0x959a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x959a('0x4'));var moment=require(_0x959a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x959a('0x6'));var util=require(_0x959a('0x7'));var path=require(_0x959a('0x8'));var sox=require(_0x959a('0x9'));var csv=require(_0x959a('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x959a('0xb'));var squel=require(_0x959a('0xc'));var crypto=require(_0x959a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x959a('0xe'));var toCsv=require(_0x959a('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x959a('0xf'));var hardwareService=require(_0x959a('0x10'));var Redis=require(_0x959a('0x11'));var qs=require(_0x959a('0x12'));var logger=require('../../config/logger')(_0x959a('0x13'));var utils=require(_0x959a('0x14'));var config=require(_0x959a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51bc32,_0x451a41){_0x451a41=_0x451a41||0xcc;return function(_0x28a58d){if(_0x28a58d){return _0x51bc32[_0x959a('0x16')](_0x451a41);}return _0x51bc32['status'](_0x451a41)['end']();};}function respondWithResult(_0x179750,_0x36fd93){_0x36fd93=_0x36fd93||0xc8;return function(_0x36abb5){if(_0x36abb5){return _0x179750[_0x959a('0x17')](_0x36fd93)['json'](_0x36abb5);}};}function respondWithFilteredResult(_0x1c4d80,_0x206e4f){return function(_0x5b69b5){if(_0x5b69b5){var _0x1796db=_0x5b69b5[_0x959a('0x18')],_0x3cd998=_0x206e4f[_0x959a('0x19')],_0x36f4c2=_0x206e4f[_0x959a('0x19')]+_0x206e4f['limit'],_0x59e502;if(_0x36f4c2>=_0x1796db){_0x36f4c2=_0x1796db;_0x59e502=0xc8;}else{_0x59e502=0xce;}_0x1c4d80[_0x959a('0x17')](_0x59e502);return _0x1c4d80['set'](_0x959a('0x1a'),_0x3cd998+'-'+_0x36f4c2+'/'+_0x1796db)['json'](_0x5b69b5);}return null;};}function patchUpdates(_0x5abec2){return function(_0x45495d){try{jsonpatch['apply'](_0x45495d,_0x5abec2,!![]);}catch(_0x25772a){return BPromise['reject'](_0x25772a);}return _0x45495d[_0x959a('0x1b')]();};}function saveUpdates(_0x3de401,_0x1450ae){return function(_0x5e0a44){if(_0x5e0a44){return _0x5e0a44['update'](_0x3de401)['then'](function(_0x5ad267){return _0x5ad267;});}return null;};}function removeEntity(_0x43a592,_0x122df0){return function(_0x5b29f9){if(_0x5b29f9){return _0x5b29f9[_0x959a('0x1c')]()['then'](function(){_0x43a592[_0x959a('0x17')](0xcc)[_0x959a('0x1d')]();});}};}function handleEntityNotFound(_0x136444,_0x4b56bd){return function(_0x3fc924){if(!_0x3fc924){_0x136444[_0x959a('0x16')](0x194);}return _0x3fc924;};}function handleError(_0x396ef5,_0x1a8ea8){_0x1a8ea8=_0x1a8ea8||0x1f4;return function(_0x327aee){logger[_0x959a('0x1e')](_0x327aee[_0x959a('0x1f')]);if(_0x327aee[_0x959a('0x20')]){delete _0x327aee['name'];}_0x396ef5[_0x959a('0x17')](_0x1a8ea8)['send'](_0x327aee);};}exports[_0x959a('0x21')]=function(_0x163fe3,_0x1d3448){var _0x349a1f={},_0x41ced8={},_0x1325a3={'count':0x0,'rows':[]};var _0x56410b=db[_0x959a('0x22')][_0x959a('0x23')];_0x41ced8[_0x959a('0x24')]=_['keys'](_0x56410b);_0x41ced8[_0x959a('0x25')]=_['keys'](_0x163fe3[_0x959a('0x25')]);_0x41ced8['filters']=_['intersection'](_0x41ced8[_0x959a('0x24')],_0x41ced8[_0x959a('0x25')]);_0x349a1f[_0x959a('0x26')]=_[_0x959a('0x27')](_0x41ced8[_0x959a('0x24')],qs['fields'](_0x163fe3[_0x959a('0x25')][_0x959a('0x28')]));_0x349a1f[_0x959a('0x26')]=_0x349a1f['attributes'][_0x959a('0x29')]?_0x349a1f['attributes']:_0x41ced8[_0x959a('0x24')];if(!_0x163fe3['query'][_0x959a('0x2a')](_0x959a('0x2b'))){_0x349a1f['limit']=qs[_0x959a('0x2c')](_0x163fe3['query'][_0x959a('0x2c')]);_0x349a1f['offset']=qs[_0x959a('0x19')](_0x163fe3[_0x959a('0x25')][_0x959a('0x19')]);}_0x349a1f[_0x959a('0x2d')]=qs['sort'](_0x163fe3[_0x959a('0x25')][_0x959a('0x2e')]);_0x349a1f['where']=qs[_0x959a('0x2f')](_['pick'](_0x163fe3['query'],_0x41ced8[_0x959a('0x2f')]));if(_0x163fe3[_0x959a('0x25')][_0x959a('0x30')]){_0x349a1f[_0x959a('0x31')]=_[_0x959a('0x32')](_0x349a1f[_0x959a('0x31')],{'$or':_[_0x959a('0x33')](_0x56410b,function(_0x227705){if(_0x227705[_0x959a('0x34')][_0x959a('0x35')]!==_0x959a('0x36')){var _0x4302e1={};_0x4302e1[_0x227705['field']]={'$like':'%'+_0x163fe3[_0x959a('0x25')][_0x959a('0x30')]+'%'};return _0x4302e1;}})});}_0x349a1f=_[_0x959a('0x32')]({},_0x349a1f,_0x163fe3['options']);var _0x43db0d={'where':_0x349a1f[_0x959a('0x31')]};return db[_0x959a('0x22')]['count'](_0x43db0d)[_0x959a('0x37')](function(_0x5da1c8){_0x1325a3[_0x959a('0x18')]=_0x5da1c8;if(_0x163fe3[_0x959a('0x25')][_0x959a('0x38')]){_0x349a1f['include']=[{'all':!![]}];}return db[_0x959a('0x22')][_0x959a('0x39')](_0x349a1f);})['then'](function(_0x4a0df2){_0x1325a3[_0x959a('0x3a')]=_0x4a0df2;return _0x1325a3;})[_0x959a('0x37')](respondWithFilteredResult(_0x1d3448,_0x349a1f))[_0x959a('0x3b')](handleError(_0x1d3448,null));};exports[_0x959a('0x3c')]=function(_0xb97da0,_0x57a0d5){var _0x4d1376={'raw':!![],'where':{'id':_0xb97da0['params']['id']}},_0x3a096e={};_0x3a096e[_0x959a('0x24')]=_['keys'](db[_0x959a('0x22')][_0x959a('0x23')]);_0x3a096e[_0x959a('0x25')]=_[_0x959a('0x3d')](_0xb97da0['query']);_0x3a096e[_0x959a('0x2f')]=_['intersection'](_0x3a096e['model'],_0x3a096e[_0x959a('0x25')]);_0x4d1376[_0x959a('0x26')]=_[_0x959a('0x27')](_0x3a096e[_0x959a('0x24')],qs[_0x959a('0x28')](_0xb97da0['query'][_0x959a('0x28')]));_0x4d1376[_0x959a('0x26')]=_0x4d1376[_0x959a('0x26')]['length']?_0x4d1376[_0x959a('0x26')]:_0x3a096e['model'];if(_0xb97da0['query'][_0x959a('0x38')]){_0x4d1376[_0x959a('0x3e')]=[{'all':!![]}];}_0x4d1376=_[_0x959a('0x32')]({},_0x4d1376,_0xb97da0[_0x959a('0x3f')]);return db['SmsTransferReport']['find'](_0x4d1376)['then'](handleEntityNotFound(_0x57a0d5,null))['then'](respondWithResult(_0x57a0d5,null))[_0x959a('0x3b')](handleError(_0x57a0d5,null));};exports[_0x959a('0x40')]=function(_0xb0d56c,_0x57e9d4){return db[_0x959a('0x22')][_0x959a('0x40')](_0xb0d56c['body'],{})[_0x959a('0x37')](respondWithResult(_0x57e9d4,0xc9))['catch'](handleError(_0x57e9d4,null));};exports[_0x959a('0x41')]=function(_0x208149,_0x1905e9){if(_0x208149[_0x959a('0x42')]['id']){delete _0x208149[_0x959a('0x42')]['id'];}return db['SmsTransferReport'][_0x959a('0x43')]({'where':{'id':_0x208149[_0x959a('0x44')]['id']}})[_0x959a('0x37')](handleEntityNotFound(_0x1905e9,null))[_0x959a('0x37')](saveUpdates(_0x208149[_0x959a('0x42')],null))['then'](respondWithResult(_0x1905e9,null))[_0x959a('0x3b')](handleError(_0x1905e9,null));};exports[_0x959a('0x1c')]=function(_0x25c00a,_0x470506){return db[_0x959a('0x22')][_0x959a('0x43')]({'where':{'id':_0x25c00a['params']['id']}})[_0x959a('0x37')](handleEntityNotFound(_0x470506,null))[_0x959a('0x37')](removeEntity(_0x470506,null))['catch'](handleError(_0x470506,null));};exports['describe']=function(_0x38e852,_0x5c4e0b){return db[_0x959a('0x22')][_0x959a('0x45')]()[_0x959a('0x37')](respondWithResult(_0x5c4e0b,null))['catch'](handleError(_0x5c4e0b,null));};
\ No newline at end of file
index 0fcd77e..29149bb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9f62=['exports','define','report_sms_transfer','uniqueid','util','api','moment','bluebird'];(function(_0x2a0a02,_0x360fe7){var _0x4a970f=function(_0x289956){while(--_0x289956){_0x2a0a02['push'](_0x2a0a02['shift']());}};_0x4a970f(++_0x360fe7);}(_0x9f62,0x154));var _0x29f6=function(_0x3c1360,_0x4b610f){_0x3c1360=_0x3c1360-0x0;var _0x3b7932=_0x9f62[_0x3c1360];return _0x3b7932;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var logger=require('../../config/logger')(_0x29f6('0x1'));var moment=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var rp=require('request-promise');var attributes=require('./smsTransferReport.attributes');module[_0x29f6('0x4')]=function(_0x2f0420,_0xefa26c){return _0x2f0420[_0x29f6('0x5')]('SmsTransferReport',attributes,{'tableName':_0x29f6('0x6'),'paranoid':![],'indexes':[{'name':_0x29f6('0x7'),'fields':[_0x29f6('0x7')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xa41a=['moment','bluebird','request-promise','./smsTransferReport.attributes','exports','SmsTransferReport','report_sms_transfer','lodash','util','api'];(function(_0x1a40e9,_0x14d16a){var _0x3f9be5=function(_0x2b5a87){while(--_0x2b5a87){_0x1a40e9['push'](_0x1a40e9['shift']());}};_0x3f9be5(++_0x14d16a);}(_0xa41a,0x6b));var _0xaa41=function(_0x169a02,_0x4258b4){_0x169a02=_0x169a02-0x0;var _0x23abdf=_0xa41a[_0x169a02];return _0x23abdf;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var logger=require('../../config/logger')(_0xaa41('0x2'));var moment=require(_0xaa41('0x3'));var BPromise=require(_0xaa41('0x4'));var rp=require(_0xaa41('0x5'));var attributes=require(_0xaa41('0x6'));module[_0xaa41('0x7')]=function(_0x42896b,_0x251efa){return _0x42896b['define'](_0xaa41('0x8'),attributes,{'tableName':_0xaa41('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});};
\ No newline at end of file
index 5dbc5e7..1f2a8f1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x17a7=['SmsTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info'];(function(_0x543242,_0xeac9fd){var _0x4c99b6=function(_0x47d087){while(--_0x47d087){_0x543242['push'](_0x543242['shift']());}};_0x4c99b6(++_0xeac9fd);}(_0x17a7,0xc2));var _0x717a=function(_0x399380,_0x818b1e){_0x399380=_0x399380-0x0;var _0x778463=_0x17a7[_0x399380];return _0x778463;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x717a('0x0'));var rs=require(_0x717a('0x1'));var fs=require('fs');var Redis=require(_0x717a('0x2'));var db=require(_0x717a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x717a('0x4'))('rpc');var config=require(_0x717a('0x5'));var jayson=require(_0x717a('0x6'));var client=jayson['client'][_0x717a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1ca7a6,_0xd7d2ce,_0x311738){return new BPromise(function(_0x536824,_0x1066d4){return client['request'](_0x1ca7a6,_0x311738)[_0x717a('0x8')](function(_0x567130){logger[_0x717a('0x9')](_0x717a('0xa'),_0xd7d2ce,_0x717a('0xb'));logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0xd7d2ce,_0x717a('0xb'),JSON[_0x717a('0xc')](_0x567130));if(_0x567130[_0x717a('0xd')]){if(_0x567130[_0x717a('0xd')][_0x717a('0xe')]===0x1f4){logger['error'](_0x717a('0xa'),_0xd7d2ce,_0x567130['error'][_0x717a('0xf')]);return _0x1066d4(_0x567130['error']['message']);}logger['error']('SmsTransferReport,\x20%s,\x20%s',_0xd7d2ce,_0x567130[_0x717a('0xd')]['message']);return _0x536824(_0x567130[_0x717a('0xd')]['message']);}else{logger[_0x717a('0x9')]('SmsTransferReport,\x20%s,\x20%s',_0xd7d2ce,_0x717a('0xb'));_0x536824(_0x567130[_0x717a('0x10')][_0x717a('0xf')]);}})['catch'](function(_0x186b4d){logger['error'](_0x717a('0xa'),_0xd7d2ce,_0x186b4d);_0x1066d4(_0x186b4d);});});}
\ No newline at end of file
+var _0x4ccb=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util'];(function(_0x1fd3e2,_0x1a6772){var _0x5a9210=function(_0x37e9c3){while(--_0x37e9c3){_0x1fd3e2['push'](_0x1fd3e2['shift']());}};_0x5a9210(++_0x1a6772);}(_0x4ccb,0x196));var _0xb4cc=function(_0x4393dd,_0x1c3bf5){_0x4393dd=_0x4393dd-0x0;var _0x278f3d=_0x4ccb[_0x4393dd];return _0x278f3d;};'use strict';var _=require(_0xb4cc('0x0'));var util=require(_0xb4cc('0x1'));var moment=require(_0xb4cc('0x2'));var BPromise=require('bluebird');var rs=require(_0xb4cc('0x3'));var fs=require('fs');var Redis=require(_0xb4cc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb4cc('0x5'));var logger=require(_0xb4cc('0x6'))(_0xb4cc('0x7'));var config=require('../../config/environment');var jayson=require(_0xb4cc('0x8'));var client=jayson[_0xb4cc('0x9')][_0xb4cc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c0bdd,_0x370b12,_0x6ba3bf){return new BPromise(function(_0x2129ef,_0x5327a4){return client[_0xb4cc('0xb')](_0x5c0bdd,_0x6ba3bf)[_0xb4cc('0xc')](function(_0xbf893){logger[_0xb4cc('0xd')](_0xb4cc('0xe'),_0x370b12,'request\x20sent');logger[_0xb4cc('0xf')](_0xb4cc('0x10'),_0x370b12,'request\x20sent',JSON[_0xb4cc('0x11')](_0xbf893));if(_0xbf893['error']){if(_0xbf893[_0xb4cc('0x12')][_0xb4cc('0x13')]===0x1f4){logger[_0xb4cc('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x370b12,_0xbf893['error'][_0xb4cc('0x14')]);return _0x5327a4(_0xbf893['error']['message']);}logger[_0xb4cc('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x370b12,_0xbf893['error'][_0xb4cc('0x14')]);return _0x2129ef(_0xbf893[_0xb4cc('0x12')][_0xb4cc('0x14')]);}else{logger['info'](_0xb4cc('0xe'),_0x370b12,_0xb4cc('0x15'));_0x2129ef(_0xbf893[_0xb4cc('0x16')][_0xb4cc('0x14')]);}})[_0xb4cc('0x17')](function(_0x506ef9){logger[_0xb4cc('0x12')](_0xb4cc('0xe'),_0x370b12,_0x506ef9);_0x5327a4(_0x506ef9);});});}
\ No newline at end of file
index 303be72..8fdff6f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xde34=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./sound.controller','get','isAuthenticated','/:id','show','download','diskStorage','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','extname','now','post','single','file','create','put','update'];(function(_0x1e6d9c,_0x14f202){var _0x437359=function(_0x32e3b5){while(--_0x32e3b5){_0x1e6d9c['push'](_0x1e6d9c['shift']());}};_0x437359(++_0x14f202);}(_0xde34,0x1e2));var _0x4de3=function(_0x42ee35,_0x65953c){_0x42ee35=_0x42ee35-0x0;var _0x1bd2a4=_0xde34[_0x42ee35];return _0x1bd2a4;};'use strict';var multer=require(_0x4de3('0x0'));var util=require(_0x4de3('0x1'));var path=require(_0x4de3('0x2'));var timeout=require(_0x4de3('0x3'));var express=require(_0x4de3('0x4'));var router=express[_0x4de3('0x5')]();var auth=require(_0x4de3('0x6'));var interaction=require(_0x4de3('0x7'));var config=require('../../config/environment');var controller=require(_0x4de3('0x8'));router[_0x4de3('0x9')]('/',auth[_0x4de3('0xa')](),controller['index']);router['get'](_0x4de3('0xb'),auth[_0x4de3('0xa')](),controller[_0x4de3('0xc')]);router[_0x4de3('0x9')]('/:id/download',auth[_0x4de3('0xa')](),controller[_0x4de3('0xd')]);var upload=multer({'storage':multer[_0x4de3('0xe')]({'destination':function(_0x5b6caa,_0x621ba9,_0x1217c4){_0x1217c4(null,path['join'](config['root'],_0x4de3('0xf')));},'filename':function(_0x3e9afa,_0x26f67e,_0x3c0fc8){_0x26f67e[_0x4de3('0x10')]=_0x26f67e[_0x4de3('0x10')][_0x4de3('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3c0fc8(null,util['format'](_0x4de3('0x12'),path[_0x4de3('0x13')](_0x26f67e[_0x4de3('0x10')],path[_0x4de3('0x14')](_0x26f67e[_0x4de3('0x10')])),Date[_0x4de3('0x15')](),path[_0x4de3('0x14')](_0x26f67e[_0x4de3('0x10')])));}})});router[_0x4de3('0x16')]('/',upload[_0x4de3('0x17')](_0x4de3('0x18')),controller[_0x4de3('0x19')]);router[_0x4de3('0x1a')](_0x4de3('0xb'),auth[_0x4de3('0xa')](),controller[_0x4de3('0x1b')]);router[_0x4de3('0x1c')](_0x4de3('0xb'),auth['isAuthenticated'](),controller[_0x4de3('0x1c')]);module[_0x4de3('0x1d')]=router;
\ No newline at end of file
+var _0xdeb8=['extname','single','file','create','put','update','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','join','root','server/files/sounds/original/','originalname','replace','%s-%s%s','basename'];(function(_0x3bad98,_0x265549){var _0x4b3aa6=function(_0x4485c6){while(--_0x4485c6){_0x3bad98['push'](_0x3bad98['shift']());}};_0x4b3aa6(++_0x265549);}(_0xdeb8,0x1c7));var _0x8deb=function(_0x44fe8b,_0x5272c4){_0x44fe8b=_0x44fe8b-0x0;var _0x23d910=_0xdeb8[_0x44fe8b];return _0x23d910;};'use strict';var multer=require(_0x8deb('0x0'));var util=require(_0x8deb('0x1'));var path=require('path');var timeout=require(_0x8deb('0x2'));var express=require('express');var router=express[_0x8deb('0x3')]();var auth=require(_0x8deb('0x4'));var interaction=require(_0x8deb('0x5'));var config=require(_0x8deb('0x6'));var controller=require('./sound.controller');router[_0x8deb('0x7')]('/',auth[_0x8deb('0x8')](),controller[_0x8deb('0x9')]);router[_0x8deb('0x7')](_0x8deb('0xa'),auth[_0x8deb('0x8')](),controller[_0x8deb('0xb')]);router[_0x8deb('0x7')](_0x8deb('0xc'),auth[_0x8deb('0x8')](),controller[_0x8deb('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xa212a4,_0x5ab45c,_0x309c37){_0x309c37(null,path[_0x8deb('0xe')](config[_0x8deb('0xf')],_0x8deb('0x10')));},'filename':function(_0x2f6d76,_0x4ed810,_0x551457){_0x4ed810[_0x8deb('0x11')]=_0x4ed810[_0x8deb('0x11')][_0x8deb('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x551457(null,util['format'](_0x8deb('0x13'),path[_0x8deb('0x14')](_0x4ed810[_0x8deb('0x11')],path[_0x8deb('0x15')](_0x4ed810[_0x8deb('0x11')])),Date['now'](),path[_0x8deb('0x15')](_0x4ed810['originalname'])));}})});router['post']('/',upload[_0x8deb('0x16')](_0x8deb('0x17')),controller[_0x8deb('0x18')]);router[_0x8deb('0x19')](_0x8deb('0xa'),auth[_0x8deb('0x8')](),controller[_0x8deb('0x1a')]);router['delete'](_0x8deb('0xa'),auth[_0x8deb('0x8')](),controller['delete']);module[_0x8deb('0x1b')]=router;
\ No newline at end of file
index 3a59d8c..f151927 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x602a=['STRING','name','FLOAT','INTEGER','BIGINT','sequelize','exports'];(function(_0x512974,_0x33e41c){var _0xf888b9=function(_0x3d6568){while(--_0x3d6568){_0x512974['push'](_0x512974['shift']());}};_0xf888b9(++_0x33e41c);}(_0x602a,0x194));var _0xa602=function(_0x559cb4,_0x1d282e){_0x559cb4=_0x559cb4-0x0;var _0x11f154=_0x602a[_0x559cb4];return _0x11f154;};'use strict';var Sequelize=require(_0xa602('0x0'));module[_0xa602('0x1')]={'name':{'type':Sequelize[_0xa602('0x2')],'unique':_0xa602('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xa602('0x2')]},'original_format':{'type':Sequelize[_0xa602('0x2')]},'original_duration':{'type':Sequelize[_0xa602('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xa602('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xa602('0x5')]},'converted_format':{'type':Sequelize[_0xa602('0x2')]},'converted_duration':{'type':Sequelize[_0xa602('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xa602('0x6')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xa602('0x5')]}};
\ No newline at end of file
+var _0xb7ae=['FLOAT','BIGINT','INTEGER','exports','STRING','name'];(function(_0x10193b,_0x3d839a){var _0x1a271b=function(_0x397aba){while(--_0x397aba){_0x10193b['push'](_0x10193b['shift']());}};_0x1a271b(++_0x3d839a);}(_0xb7ae,0xc9));var _0xeb7a=function(_0x4c9643,_0x40c898){_0x4c9643=_0x4c9643-0x0;var _0x182017=_0xb7ae[_0x4c9643];return _0x182017;};'use strict';var Sequelize=require('sequelize');module[_0xeb7a('0x0')]={'name':{'type':Sequelize[_0xeb7a('0x1')],'unique':_0xeb7a('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0xeb7a('0x1')]},'original_duration':{'type':Sequelize[_0xeb7a('0x3')]},'original_sampleCount':{'type':Sequelize[_0xeb7a('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xeb7a('0x4')]},'original_sampleRate':{'type':Sequelize[_0xeb7a('0x5')]},'converted_format':{'type':Sequelize[_0xeb7a('0x1')]},'converted_duration':{'type':Sequelize[_0xeb7a('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xeb7a('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xeb7a('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xeb7a('0x5')]}};
\ No newline at end of file
index cc1df08..d00d14b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6343=['channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','unlinkSync','rimraf','zip-dir','mustache','util','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','stack','send','Sound','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','key','VIRTUAL','merge','options','includeAll','include','findAll','params','rawAttributes','find','catch','download','name','save_name','converted_format','existsSync','root','server/files/sounds/converted','Sequelize','ValidationError','join','format','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','%s.%s','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','error','duration','original_sampleCount','sampleCount'];(function(_0x1a8552,_0x156992){var _0x122b78=function(_0x26a8aa){while(--_0x26a8aa){_0x1a8552['push'](_0x1a8552['shift']());}};_0x122b78(++_0x156992);}(_0x6343,0x168));var _0x3634=function(_0x4985a3,_0x59a9ac){_0x4985a3=_0x4985a3-0x0;var _0x26c857=_0x6343[_0x4985a3];return _0x26c857;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3634('0x0'));var zipdir=require(_0x3634('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3634('0x2'));var util=require(_0x3634('0x3'));var path=require('path');var sox=require(_0x3634('0x4'));var csv=require(_0x3634('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3634('0x6'));var squel=require(_0x3634('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3634('0x8'));var toCsv=require(_0x3634('0x5'));var querystring=require(_0x3634('0x9'));var Papa=require(_0x3634('0xa'));var authService=require(_0x3634('0xb'));var hardwareService=require(_0x3634('0xc'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x3634('0xd'))(_0x3634('0xe'));var utils=require('../../config/utils');var config=require(_0x3634('0xf'));var db=require(_0x3634('0x10'))['db'];function respondWithStatusCode(_0x242c24,_0x1d180f){_0x1d180f=_0x1d180f||0xcc;return function(_0x1e6a04){if(_0x1e6a04){return _0x242c24[_0x3634('0x11')](_0x1d180f);}return _0x242c24[_0x3634('0x12')](_0x1d180f)[_0x3634('0x13')]();};}function respondWithResult(_0x7f5aca,_0x36f54b){_0x36f54b=_0x36f54b||0xc8;return function(_0x299e53){if(_0x299e53){return _0x7f5aca[_0x3634('0x12')](_0x36f54b)[_0x3634('0x14')](_0x299e53);}};}function respondWithFilteredResult(_0x2ad793,_0x5a5063){return function(_0x167247){if(_0x167247){var _0x48787f=_0x167247[_0x3634('0x15')],_0x69609d=_0x5a5063[_0x3634('0x16')],_0x18285c=_0x5a5063['offset']+_0x5a5063[_0x3634('0x17')],_0x2fc628;if(_0x18285c>=_0x48787f){_0x18285c=_0x48787f;_0x2fc628=0xc8;}else{_0x2fc628=0xce;}_0x2ad793['status'](_0x2fc628);return _0x2ad793['set'](_0x3634('0x18'),_0x69609d+'-'+_0x18285c+'/'+_0x48787f)['json'](_0x167247);}return null;};}function patchUpdates(_0x2fac8b){return function(_0x32e3c6){try{jsonpatch[_0x3634('0x19')](_0x32e3c6,_0x2fac8b,!![]);}catch(_0x5603d2){return BPromise[_0x3634('0x1a')](_0x5603d2);}return _0x32e3c6[_0x3634('0x1b')]();};}function saveUpdates(_0x577a6c,_0xeb9231){return function(_0x506281){if(_0x506281){return _0x506281[_0x3634('0x1c')](_0x577a6c)[_0x3634('0x1d')](function(_0x5b77a7){return _0x5b77a7;});}return null;};}function removeEntity(_0x29a343,_0x3df472){return function(_0x206c8e){if(_0x206c8e){return _0x206c8e['destroy']()[_0x3634('0x1d')](function(){var _0x2c8874=_0x206c8e['get']({'plain':!![]});var _0x3936ee='Sounds';return db['UserProfileResource'][_0x3634('0x1e')]({'where':{'type':_0x3936ee,'resourceId':_0x2c8874['id']}})[_0x3634('0x1d')](function(){return _0x206c8e;});})['then'](function(){_0x29a343[_0x3634('0x12')](0xcc)[_0x3634('0x13')]();});}};}function handleEntityNotFound(_0x17db44,_0x225ddc){return function(_0x363ca2){if(!_0x363ca2){_0x17db44[_0x3634('0x11')](0x194);}return _0x363ca2;};}function handleError(_0x38e863,_0x4762b1){_0x4762b1=_0x4762b1||0x1f4;return function(_0x22f1f1){logger['error'](_0x22f1f1[_0x3634('0x1f')]);if(_0x22f1f1['name']){delete _0x22f1f1['name'];}_0x38e863['status'](_0x4762b1)[_0x3634('0x20')](_0x22f1f1);};}exports['index']=function(_0x3bf28b,_0x12b80e){var _0x49804f={},_0x55a77f={},_0x282f73={'count':0x0,'rows':[]};var _0x5bd4e0=db[_0x3634('0x21')]['rawAttributes'];_0x55a77f[_0x3634('0x22')]=_[_0x3634('0x23')](_0x5bd4e0);_0x55a77f[_0x3634('0x24')]=_[_0x3634('0x23')](_0x3bf28b[_0x3634('0x24')]);_0x55a77f[_0x3634('0x25')]=_[_0x3634('0x26')](_0x55a77f[_0x3634('0x22')],_0x55a77f['query']);_0x49804f['attributes']=_['intersection'](_0x55a77f[_0x3634('0x22')],qs['fields'](_0x3bf28b[_0x3634('0x24')][_0x3634('0x27')]));_0x49804f[_0x3634('0x28')]=_0x49804f[_0x3634('0x28')][_0x3634('0x29')]?_0x49804f[_0x3634('0x28')]:_0x55a77f['model'];if(!_0x3bf28b[_0x3634('0x24')][_0x3634('0x2a')](_0x3634('0x2b'))){_0x49804f[_0x3634('0x17')]=qs[_0x3634('0x17')](_0x3bf28b[_0x3634('0x24')][_0x3634('0x17')]);_0x49804f[_0x3634('0x16')]=qs[_0x3634('0x16')](_0x3bf28b['query'][_0x3634('0x16')]);}_0x49804f[_0x3634('0x2c')]=qs[_0x3634('0x2d')](_0x3bf28b[_0x3634('0x24')]['sort']);_0x49804f[_0x3634('0x2e')]=qs[_0x3634('0x25')](_[_0x3634('0x2f')](_0x3bf28b['query'],_0x55a77f['filters']));if(_0x3bf28b['query'][_0x3634('0x30')]){_0x49804f[_0x3634('0x2e')]=_['merge'](_0x49804f[_0x3634('0x2e')],{'$or':_[_0x3634('0x31')](_0x5bd4e0,function(_0x105507){if(_0x105507[_0x3634('0x32')][_0x3634('0x33')]!==_0x3634('0x34')){var _0x431619={};_0x431619[_0x105507['field']]={'$like':'%'+_0x3bf28b[_0x3634('0x24')]['filter']+'%'};return _0x431619;}})});}_0x49804f=_[_0x3634('0x35')]({},_0x49804f,_0x3bf28b[_0x3634('0x36')]);var _0x2f1744={'where':_0x49804f[_0x3634('0x2e')]};return db[_0x3634('0x21')]['count'](_0x2f1744)[_0x3634('0x1d')](function(_0x33af29){_0x282f73[_0x3634('0x15')]=_0x33af29;if(_0x3bf28b[_0x3634('0x24')][_0x3634('0x37')]){_0x49804f[_0x3634('0x38')]=[{'all':!![]}];}return db[_0x3634('0x21')][_0x3634('0x39')](_0x49804f);})[_0x3634('0x1d')](function(_0x523555){_0x282f73['rows']=_0x523555;return _0x282f73;})[_0x3634('0x1d')](respondWithFilteredResult(_0x12b80e,_0x49804f))['catch'](handleError(_0x12b80e,null));};exports['show']=function(_0x5948db,_0x80f1a2){var _0x4d06f9={'raw':!![],'where':{'id':_0x5948db[_0x3634('0x3a')]['id']}},_0x197d65={};_0x197d65['model']=_['keys'](db['Sound'][_0x3634('0x3b')]);_0x197d65[_0x3634('0x24')]=_['keys'](_0x5948db[_0x3634('0x24')]);_0x197d65[_0x3634('0x25')]=_[_0x3634('0x26')](_0x197d65[_0x3634('0x22')],_0x197d65[_0x3634('0x24')]);_0x4d06f9['attributes']=_['intersection'](_0x197d65[_0x3634('0x22')],qs[_0x3634('0x27')](_0x5948db[_0x3634('0x24')][_0x3634('0x27')]));_0x4d06f9[_0x3634('0x28')]=_0x4d06f9[_0x3634('0x28')]['length']?_0x4d06f9[_0x3634('0x28')]:_0x197d65[_0x3634('0x22')];if(_0x5948db[_0x3634('0x24')]['includeAll']){_0x4d06f9['include']=[{'all':!![]}];}_0x4d06f9=_[_0x3634('0x35')]({},_0x4d06f9,_0x5948db[_0x3634('0x36')]);return db[_0x3634('0x21')][_0x3634('0x3c')](_0x4d06f9)[_0x3634('0x1d')](handleEntityNotFound(_0x80f1a2,null))[_0x3634('0x1d')](respondWithResult(_0x80f1a2,null))[_0x3634('0x3d')](handleError(_0x80f1a2,null));};exports[_0x3634('0x3e')]=function(_0x52de40,_0xfb94f0,_0x3401b8){return db[_0x3634('0x21')][_0x3634('0x3c')]({'where':{'id':_0x52de40[_0x3634('0x3a')]['id']},'attributes':[_0x3634('0x3f'),_0x3634('0x40'),_0x3634('0x41')],'raw':!![]})[_0x3634('0x1d')](handleEntityNotFound(_0xfb94f0,null))['then'](function(_0x279d34){if(_0x279d34){if(!fs[_0x3634('0x42')](path['join'](config[_0x3634('0x43')],_0x3634('0x44'),_0x279d34[_0x3634('0x40')]+'.'+_0x279d34[_0x3634('0x41')]))){throw new db[(_0x3634('0x45'))][(_0x3634('0x46'))]('Sound\x20not\x20found');}return _0xfb94f0[_0x3634('0x3e')](path[_0x3634('0x47')](config[_0x3634('0x43')],_0x3634('0x44'),util[_0x3634('0x48')]('%s.%s',_0x279d34[_0x3634('0x40')],_0x279d34[_0x3634('0x41')])),util['format']('%s.%s',_0x279d34[_0x3634('0x3f')],_0x279d34['converted_format']));}return null;})[_0x3634('0x3d')](handleError(_0xfb94f0,null));};exports[_0x3634('0x49')]=function(_0x1943a5,_0x1834a3,_0x5a024e){var _0x274494={'name':path[_0x3634('0x4a')](_0x1943a5[_0x3634('0x4b')][_0x3634('0x4c')],path[_0x3634('0x4d')](_0x1943a5[_0x3634('0x4b')][_0x3634('0x4c')])),'save_name':path[_0x3634('0x4a')](_0x1943a5[_0x3634('0x4b')][_0x3634('0x4e')],path[_0x3634('0x4d')](_0x1943a5[_0x3634('0x4b')]['filename'])),'original_format':path[_0x3634('0x4d')](_0x1943a5[_0x3634('0x4b')][_0x3634('0x4c')])[_0x3634('0x4f')](0x1),'converted_format':_0x3634('0x50')};var _0x15f414=path[_0x3634('0x47')](config[_0x3634('0x43')],_0x3634('0x51'),_0x1943a5['file'][_0x3634('0x4e')]);var _0x2ea4b0=path['join'](config[_0x3634('0x43')],_0x3634('0x44'),util['format'](_0x3634('0x52'),path[_0x3634('0x4a')](_0x1943a5[_0x3634('0x4b')]['filename'],path[_0x3634('0x4d')](_0x1943a5['file'][_0x3634('0x4e')])),_0x274494['converted_format']));logger[_0x3634('0x53')](_0x3634('0x54'),_0x15f414);logger[_0x3634('0x53')]('Sound\x20upload\x20destination:\x20%s',_0x2ea4b0);try{fs[_0x3634('0x55')](_0x15f414,parseInt(_0x3634('0x56'),0x8));var _0x5df700=sox[_0x3634('0x57')](_0x15f414,_0x2ea4b0,{'sampleRate':0x1f40,'format':_0x3634('0x50'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5df700['on'](_0x3634('0x58'),function(_0x6781cb){fs['unlinkSync'](_0x15f414);_0x1834a3[_0x3634('0x12')](0x1f4)[_0x3634('0x20')](_0x6781cb);});_0x5df700['on']('src',function(_0x5b8db4){_0x274494['original_duration']=isNaN(_0x5b8db4[_0x3634('0x59')])?null:_0x5b8db4['duration']*0x3e8;_0x274494[_0x3634('0x5a')]=isNaN(_0x5b8db4[_0x3634('0x5b')])?null:_0x5b8db4[_0x3634('0x5b')];_0x274494['original_channelCount']=isNaN(_0x5b8db4[_0x3634('0x5c')])?null:_0x5b8db4[_0x3634('0x5c')];_0x274494['original_bitRate']=isNaN(_0x5b8db4[_0x3634('0x5d')])?null:_0x5b8db4[_0x3634('0x5d')];_0x274494[_0x3634('0x5e')]=isNaN(_0x5b8db4['sampleRate'])?null:_0x5b8db4[_0x3634('0x5f')];});_0x5df700['on'](_0x3634('0x60'),function(_0x897c0e){_0x274494[_0x3634('0x61')]=isNaN(_0x897c0e[_0x3634('0x59')])?null:_0x897c0e['duration']*0x3e8;_0x274494[_0x3634('0x62')]=isNaN(_0x897c0e[_0x3634('0x5b')])?null:_0x897c0e[_0x3634('0x5b')];_0x274494['converted_channelCount']=isNaN(_0x897c0e[_0x3634('0x5c')])?null:_0x897c0e['channelCount'];_0x274494[_0x3634('0x63')]=isNaN(_0x897c0e[_0x3634('0x5d')])?null:_0x897c0e['bitRate'];_0x274494[_0x3634('0x64')]=isNaN(_0x897c0e[_0x3634('0x5f')])?null:_0x897c0e[_0x3634('0x5f')];});_0x5df700['on']('end',function(){fs[_0x3634('0x55')](_0x2ea4b0,parseInt('0777',0x8));return db['Sound'][_0x3634('0x49')](_0x274494)['then'](function(_0x30fd12){var _0x70898e={'role':_0x1943a5[_0x3634('0x65')][_0x3634('0x66')],'userProfileId':_0x1943a5['body'][_0x3634('0x67')]};if(!_0x70898e)throw new Error(_0x3634('0x68'));if(_0x70898e['role']===_0x3634('0x69')){var _0x5328b3=_0x30fd12[_0x3634('0x6a')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x3634('0x6b'),'userProfileId':_0x70898e[_0x3634('0x67')]},'raw':!![]})[_0x3634('0x1d')](function(_0x55f9dc){if(_0x55f9dc&&_0x55f9dc[_0x3634('0x6c')]===0x0){return db['UserProfileResource'][_0x3634('0x49')]({'name':_0x5328b3[_0x3634('0x3f')],'resourceId':_0x5328b3['id'],'type':_0x55f9dc[_0x3634('0x3f')],'sectionId':_0x55f9dc['id']},{})[_0x3634('0x1d')](function(){return _0x30fd12;});}else{return _0x30fd12;}})[_0x3634('0x3d')](function(_0x11ecfb){logger[_0x3634('0x58')](_0x3634('0x6d'),_0x11ecfb);throw _0x11ecfb;});}return _0x30fd12;})[_0x3634('0x1d')](respondWithResult(_0x1834a3,null))[_0x3634('0x3d')](handleError(_0x1834a3,null));});_0x5df700[_0x3634('0x6e')]();}catch(_0x4bbfed){_0x1834a3['status'](0x1f4)[_0x3634('0x20')](_0x4bbfed);}};exports['update']=function(_0x465712,_0x352d98,_0x3376ef){return db[_0x3634('0x21')][_0x3634('0x3c')]({'where':{'id':_0x465712['params']['id']}})[_0x3634('0x1d')](handleEntityNotFound(_0x352d98,null))[_0x3634('0x1d')](saveUpdates(_[_0x3634('0x2f')](_0x465712[_0x3634('0x65')],[_0x3634('0x3f'),'description']),null))[_0x3634('0x1d')](respondWithResult(_0x352d98,null))[_0x3634('0x3d')](handleError(_0x352d98,null));};exports[_0x3634('0x6f')]=function(_0x363d8b,_0x505424,_0x5c0a54){return db[_0x3634('0x21')][_0x3634('0x3c')]({'where':{'id':_0x363d8b[_0x3634('0x3a')]['id']}})[_0x3634('0x1d')](function(_0x4a5dc1){if(_0x4a5dc1){return _0x4a5dc1[_0x3634('0x1e')]();}})['then'](function(_0x459f53){var _0x543328=path[_0x3634('0x47')](config[_0x3634('0x43')],_0x3634('0x51'),util[_0x3634('0x48')](_0x3634('0x52'),_0x459f53[_0x3634('0x40')],_0x459f53['original_format']));var _0x3007d1=path['join'](config[_0x3634('0x43')],_0x3634('0x44'),util[_0x3634('0x48')](_0x3634('0x52'),_0x459f53[_0x3634('0x40')],_0x459f53[_0x3634('0x41')]));fs[_0x3634('0x70')](_0x543328);fs[_0x3634('0x70')](_0x3007d1);return _0x459f53;})[_0x3634('0x1d')](function(_0x588133){if(_0x588133){return _0x505424[_0x3634('0x12')](0xcc)[_0x3634('0x13')]();}})[_0x3634('0x1d')](handleEntityNotFound(_0x505424,null))[_0x3634('0x3d')](handleError(_0x505424,null));};
\ No newline at end of file
+var _0x0295=['unlinkSync','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','end','0777','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','server/files/sounds/original','original_format','html-pdf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','Sounds','UserProfileResource','stack','name','send','index','Sound','model','keys','query','filters','intersection','attributes','nolimit','sort','where','pick','merge','type','key','VIRTUAL','field','filter','options','includeAll','findAll','show','params','fields','length','include','find','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','catch','basename','originalname','file','filename','extname','substring','wav','%s.%s','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode'];(function(_0x263f4c,_0x438626){var _0x3a78d3=function(_0xbdb00f){while(--_0xbdb00f){_0x263f4c['push'](_0x263f4c['shift']());}};_0x3a78d3(++_0x438626);}(_0x0295,0x1f0));var _0x5029=function(_0x3394a6,_0x7b1ede){_0x3394a6=_0x3394a6-0x0;var _0x4a7909=_0x0295[_0x3394a6];return _0x4a7909;};'use strict';var pdf=require(_0x5029('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5029('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5029('0x2'));var BPromise=require(_0x5029('0x3'));var Mustache=require(_0x5029('0x4'));var util=require(_0x5029('0x5'));var path=require(_0x5029('0x6'));var sox=require(_0x5029('0x7'));var csv=require(_0x5029('0x8'));var ejs=require(_0x5029('0x9'));var fs=require('fs');var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var authService=require(_0x5029('0xd'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x5029('0xe'));var qs=require(_0x5029('0xf'));var logger=require(_0x5029('0x10'))('api');var utils=require(_0x5029('0x11'));var config=require(_0x5029('0x12'));var db=require(_0x5029('0x13'))['db'];function respondWithStatusCode(_0x4f295e,_0x3bc005){_0x3bc005=_0x3bc005||0xcc;return function(_0x2442b2){if(_0x2442b2){return _0x4f295e['sendStatus'](_0x3bc005);}return _0x4f295e['status'](_0x3bc005)['end']();};}function respondWithResult(_0x4aebb6,_0x2484ac){_0x2484ac=_0x2484ac||0xc8;return function(_0x2e0369){if(_0x2e0369){return _0x4aebb6[_0x5029('0x14')](_0x2484ac)[_0x5029('0x15')](_0x2e0369);}};}function respondWithFilteredResult(_0x2c0b33,_0x11c24b){return function(_0xe278b7){if(_0xe278b7){var _0x317c20=_0xe278b7[_0x5029('0x16')],_0x10bf55=_0x11c24b[_0x5029('0x17')],_0x326923=_0x11c24b[_0x5029('0x17')]+_0x11c24b[_0x5029('0x18')],_0x457c73;if(_0x326923>=_0x317c20){_0x326923=_0x317c20;_0x457c73=0xc8;}else{_0x457c73=0xce;}_0x2c0b33['status'](_0x457c73);return _0x2c0b33[_0x5029('0x19')](_0x5029('0x1a'),_0x10bf55+'-'+_0x326923+'/'+_0x317c20)[_0x5029('0x15')](_0xe278b7);}return null;};}function patchUpdates(_0x4902f3){return function(_0x8cea01){try{jsonpatch[_0x5029('0x1b')](_0x8cea01,_0x4902f3,!![]);}catch(_0xaba461){return BPromise['reject'](_0xaba461);}return _0x8cea01[_0x5029('0x1c')]();};}function saveUpdates(_0x5696b1,_0x16485c){return function(_0x8a414c){if(_0x8a414c){return _0x8a414c[_0x5029('0x1d')](_0x5696b1)[_0x5029('0x1e')](function(_0x4b5854){return _0x4b5854;});}return null;};}function removeEntity(_0x47ecca,_0x4c9184){return function(_0x4a49b6){if(_0x4a49b6){return _0x4a49b6[_0x5029('0x1f')]()[_0x5029('0x1e')](function(){var _0x1eb228=_0x4a49b6[_0x5029('0x20')]({'plain':!![]});var _0x16bd22=_0x5029('0x21');return db[_0x5029('0x22')][_0x5029('0x1f')]({'where':{'type':_0x16bd22,'resourceId':_0x1eb228['id']}})[_0x5029('0x1e')](function(){return _0x4a49b6;});})['then'](function(){_0x47ecca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x588d90,_0x45666c){return function(_0x51093c){if(!_0x51093c){_0x588d90['sendStatus'](0x194);}return _0x51093c;};}function handleError(_0x181da0,_0x1e7e61){_0x1e7e61=_0x1e7e61||0x1f4;return function(_0x36d810){logger['error'](_0x36d810[_0x5029('0x23')]);if(_0x36d810[_0x5029('0x24')]){delete _0x36d810['name'];}_0x181da0[_0x5029('0x14')](_0x1e7e61)[_0x5029('0x25')](_0x36d810);};}exports[_0x5029('0x26')]=function(_0x4a24b9,_0x32da06){var _0x251f99={},_0xe5313e={},_0x4b6f92={'count':0x0,'rows':[]};var _0x2cedf6=db[_0x5029('0x27')]['rawAttributes'];_0xe5313e[_0x5029('0x28')]=_[_0x5029('0x29')](_0x2cedf6);_0xe5313e[_0x5029('0x2a')]=_[_0x5029('0x29')](_0x4a24b9[_0x5029('0x2a')]);_0xe5313e[_0x5029('0x2b')]=_[_0x5029('0x2c')](_0xe5313e[_0x5029('0x28')],_0xe5313e[_0x5029('0x2a')]);_0x251f99[_0x5029('0x2d')]=_[_0x5029('0x2c')](_0xe5313e[_0x5029('0x28')],qs['fields'](_0x4a24b9[_0x5029('0x2a')]['fields']));_0x251f99[_0x5029('0x2d')]=_0x251f99['attributes']['length']?_0x251f99[_0x5029('0x2d')]:_0xe5313e[_0x5029('0x28')];if(!_0x4a24b9[_0x5029('0x2a')]['hasOwnProperty'](_0x5029('0x2e'))){_0x251f99[_0x5029('0x18')]=qs[_0x5029('0x18')](_0x4a24b9[_0x5029('0x2a')][_0x5029('0x18')]);_0x251f99[_0x5029('0x17')]=qs[_0x5029('0x17')](_0x4a24b9[_0x5029('0x2a')][_0x5029('0x17')]);}_0x251f99['order']=qs[_0x5029('0x2f')](_0x4a24b9[_0x5029('0x2a')][_0x5029('0x2f')]);_0x251f99[_0x5029('0x30')]=qs['filters'](_[_0x5029('0x31')](_0x4a24b9[_0x5029('0x2a')],_0xe5313e[_0x5029('0x2b')]));if(_0x4a24b9['query']['filter']){_0x251f99[_0x5029('0x30')]=_[_0x5029('0x32')](_0x251f99['where'],{'$or':_['map'](_0x2cedf6,function(_0x9656f2){if(_0x9656f2[_0x5029('0x33')][_0x5029('0x34')]!==_0x5029('0x35')){var _0x33c8c3={};_0x33c8c3[_0x9656f2[_0x5029('0x36')]]={'$like':'%'+_0x4a24b9[_0x5029('0x2a')][_0x5029('0x37')]+'%'};return _0x33c8c3;}})});}_0x251f99=_[_0x5029('0x32')]({},_0x251f99,_0x4a24b9[_0x5029('0x38')]);var _0x3e5b67={'where':_0x251f99[_0x5029('0x30')]};return db[_0x5029('0x27')][_0x5029('0x16')](_0x3e5b67)['then'](function(_0x57c2b5){_0x4b6f92[_0x5029('0x16')]=_0x57c2b5;if(_0x4a24b9[_0x5029('0x2a')][_0x5029('0x39')]){_0x251f99['include']=[{'all':!![]}];}return db[_0x5029('0x27')][_0x5029('0x3a')](_0x251f99);})['then'](function(_0x247789){_0x4b6f92['rows']=_0x247789;return _0x4b6f92;})[_0x5029('0x1e')](respondWithFilteredResult(_0x32da06,_0x251f99))['catch'](handleError(_0x32da06,null));};exports[_0x5029('0x3b')]=function(_0x359838,_0x24a18d){var _0x78768={'raw':!![],'where':{'id':_0x359838[_0x5029('0x3c')]['id']}},_0x346fd9={};_0x346fd9[_0x5029('0x28')]=_[_0x5029('0x29')](db[_0x5029('0x27')]['rawAttributes']);_0x346fd9[_0x5029('0x2a')]=_[_0x5029('0x29')](_0x359838[_0x5029('0x2a')]);_0x346fd9[_0x5029('0x2b')]=_[_0x5029('0x2c')](_0x346fd9[_0x5029('0x28')],_0x346fd9['query']);_0x78768[_0x5029('0x2d')]=_[_0x5029('0x2c')](_0x346fd9[_0x5029('0x28')],qs[_0x5029('0x3d')](_0x359838[_0x5029('0x2a')]['fields']));_0x78768[_0x5029('0x2d')]=_0x78768[_0x5029('0x2d')][_0x5029('0x3e')]?_0x78768[_0x5029('0x2d')]:_0x346fd9[_0x5029('0x28')];if(_0x359838[_0x5029('0x2a')][_0x5029('0x39')]){_0x78768[_0x5029('0x3f')]=[{'all':!![]}];}_0x78768=_[_0x5029('0x32')]({},_0x78768,_0x359838['options']);return db[_0x5029('0x27')][_0x5029('0x40')](_0x78768)[_0x5029('0x1e')](handleEntityNotFound(_0x24a18d,null))[_0x5029('0x1e')](respondWithResult(_0x24a18d,null))['catch'](handleError(_0x24a18d,null));};exports['download']=function(_0x17a515,_0x6185aa,_0x2a07d4){return db[_0x5029('0x27')][_0x5029('0x40')]({'where':{'id':_0x17a515[_0x5029('0x3c')]['id']},'attributes':[_0x5029('0x24'),_0x5029('0x41'),_0x5029('0x42')],'raw':!![]})[_0x5029('0x1e')](handleEntityNotFound(_0x6185aa,null))[_0x5029('0x1e')](function(_0x39370b){if(_0x39370b){if(!fs[_0x5029('0x43')](path[_0x5029('0x44')](config[_0x5029('0x45')],_0x5029('0x46'),_0x39370b[_0x5029('0x41')]+'.'+_0x39370b[_0x5029('0x42')]))){throw new db[(_0x5029('0x47'))][(_0x5029('0x48'))](_0x5029('0x49'));}return _0x6185aa['download'](path[_0x5029('0x44')](config['root'],_0x5029('0x46'),util[_0x5029('0x4a')]('%s.%s',_0x39370b['save_name'],_0x39370b[_0x5029('0x42')])),util['format']('%s.%s',_0x39370b[_0x5029('0x24')],_0x39370b[_0x5029('0x42')]));}return null;})[_0x5029('0x4b')](handleError(_0x6185aa,null));};exports['create']=function(_0x544fb3,_0x1510bb,_0x3d4e9a){var _0x4ddbb7={'name':path[_0x5029('0x4c')](_0x544fb3['file'][_0x5029('0x4d')],path['extname'](_0x544fb3[_0x5029('0x4e')][_0x5029('0x4d')])),'save_name':path[_0x5029('0x4c')](_0x544fb3[_0x5029('0x4e')][_0x5029('0x4f')],path[_0x5029('0x50')](_0x544fb3[_0x5029('0x4e')][_0x5029('0x4f')])),'original_format':path['extname'](_0x544fb3[_0x5029('0x4e')]['originalname'])[_0x5029('0x51')](0x1),'converted_format':_0x5029('0x52')};var _0x57e82e=path[_0x5029('0x44')](config['root'],'server/files/sounds/original',_0x544fb3['file'][_0x5029('0x4f')]);var _0x4b0c5f=path[_0x5029('0x44')](config[_0x5029('0x45')],_0x5029('0x46'),util['format'](_0x5029('0x53'),path['basename'](_0x544fb3['file'][_0x5029('0x4f')],path[_0x5029('0x50')](_0x544fb3[_0x5029('0x4e')][_0x5029('0x4f')])),_0x4ddbb7[_0x5029('0x42')]));logger['info'](_0x5029('0x54'),_0x57e82e);logger[_0x5029('0x55')](_0x5029('0x56'),_0x4b0c5f);try{fs[_0x5029('0x57')](_0x57e82e,parseInt('0777',0x8));var _0x33812b=sox[_0x5029('0x58')](_0x57e82e,_0x4b0c5f,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x33812b['on']('error',function(_0x2afd44){fs[_0x5029('0x59')](_0x57e82e);_0x1510bb[_0x5029('0x14')](0x1f4)[_0x5029('0x25')](_0x2afd44);});_0x33812b['on']('src',function(_0x4208ab){_0x4ddbb7[_0x5029('0x5a')]=isNaN(_0x4208ab[_0x5029('0x5b')])?null:_0x4208ab[_0x5029('0x5b')]*0x3e8;_0x4ddbb7[_0x5029('0x5c')]=isNaN(_0x4208ab[_0x5029('0x5d')])?null:_0x4208ab['sampleCount'];_0x4ddbb7['original_channelCount']=isNaN(_0x4208ab[_0x5029('0x5e')])?null:_0x4208ab[_0x5029('0x5e')];_0x4ddbb7[_0x5029('0x5f')]=isNaN(_0x4208ab['bitRate'])?null:_0x4208ab[_0x5029('0x60')];_0x4ddbb7[_0x5029('0x61')]=isNaN(_0x4208ab[_0x5029('0x62')])?null:_0x4208ab[_0x5029('0x62')];});_0x33812b['on'](_0x5029('0x63'),function(_0x5264c6){_0x4ddbb7[_0x5029('0x64')]=isNaN(_0x5264c6[_0x5029('0x5b')])?null:_0x5264c6[_0x5029('0x5b')]*0x3e8;_0x4ddbb7['converted_sampleCount']=isNaN(_0x5264c6[_0x5029('0x5d')])?null:_0x5264c6['sampleCount'];_0x4ddbb7[_0x5029('0x65')]=isNaN(_0x5264c6['channelCount'])?null:_0x5264c6[_0x5029('0x5e')];_0x4ddbb7[_0x5029('0x66')]=isNaN(_0x5264c6[_0x5029('0x60')])?null:_0x5264c6[_0x5029('0x60')];_0x4ddbb7[_0x5029('0x67')]=isNaN(_0x5264c6[_0x5029('0x62')])?null:_0x5264c6['sampleRate'];});_0x33812b['on'](_0x5029('0x68'),function(){fs[_0x5029('0x57')](_0x4b0c5f,parseInt(_0x5029('0x69'),0x8));return db[_0x5029('0x27')][_0x5029('0x6a')](_0x4ddbb7)['then'](function(_0x13ca47){var _0x4a1fe0={'role':_0x544fb3[_0x5029('0x6b')]['role'],'userProfileId':_0x544fb3[_0x5029('0x6b')]['userProfileId']};if(!_0x4a1fe0)throw new Error(_0x5029('0x6c'));if(_0x4a1fe0['role']==='user'){var _0x440658=_0x13ca47['get']({'plain':!![]});return db[_0x5029('0x6d')][_0x5029('0x40')]({'where':{'name':_0x5029('0x21'),'userProfileId':_0x4a1fe0['userProfileId']},'raw':!![]})[_0x5029('0x1e')](function(_0x490821){if(_0x490821&&_0x490821[_0x5029('0x6e')]===0x0){return db[_0x5029('0x22')][_0x5029('0x6a')]({'name':_0x440658[_0x5029('0x24')],'resourceId':_0x440658['id'],'type':_0x490821[_0x5029('0x24')],'sectionId':_0x490821['id']},{})['then'](function(){return _0x13ca47;});}else{return _0x13ca47;}})[_0x5029('0x4b')](function(_0x364f91){logger['error'](_0x5029('0x6f'),_0x364f91);throw _0x364f91;});}return _0x13ca47;})[_0x5029('0x1e')](respondWithResult(_0x1510bb,null))[_0x5029('0x4b')](handleError(_0x1510bb,null));});_0x33812b[_0x5029('0x70')]();}catch(_0x9b1c13){_0x1510bb[_0x5029('0x14')](0x1f4)['send'](_0x9b1c13);}};exports['update']=function(_0xea7fb4,_0x4c0d6f,_0x3a73d5){return db[_0x5029('0x27')]['find']({'where':{'id':_0xea7fb4[_0x5029('0x3c')]['id']}})['then'](handleEntityNotFound(_0x4c0d6f,null))['then'](saveUpdates(_[_0x5029('0x31')](_0xea7fb4[_0x5029('0x6b')],[_0x5029('0x24'),_0x5029('0x71')]),null))['then'](respondWithResult(_0x4c0d6f,null))[_0x5029('0x4b')](handleError(_0x4c0d6f,null));};exports[_0x5029('0x72')]=function(_0x4a2ce8,_0x269406,_0x73c036){return db['Sound']['find']({'where':{'id':_0x4a2ce8['params']['id']}})[_0x5029('0x1e')](function(_0x60440f){if(_0x60440f){return _0x60440f[_0x5029('0x1f')]();}})[_0x5029('0x1e')](function(_0x46be5a){var _0x2ee3bb=path[_0x5029('0x44')](config[_0x5029('0x45')],_0x5029('0x73'),util['format']('%s.%s',_0x46be5a[_0x5029('0x41')],_0x46be5a[_0x5029('0x74')]));var _0xf51086=path[_0x5029('0x44')](config[_0x5029('0x45')],_0x5029('0x46'),util[_0x5029('0x4a')]('%s.%s',_0x46be5a[_0x5029('0x41')],_0x46be5a[_0x5029('0x42')]));fs[_0x5029('0x59')](_0x2ee3bb);fs['unlinkSync'](_0xf51086);return _0x46be5a;})[_0x5029('0x1e')](function(_0x3d3525){if(_0x3d3525){return _0x269406[_0x5029('0x14')](0xcc)['end']();}})[_0x5029('0x1e')](handleEntityNotFound(_0x269406,null))[_0x5029('0x4b')](handleError(_0x269406,null));};
\ No newline at end of file
index 4487030..3b41114 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8bf5=['request-promise','exports','Sound','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x290c65,_0x44249d){var _0x1d1661=function(_0x48bb41){while(--_0x48bb41){_0x290c65['push'](_0x290c65['shift']());}};_0x1d1661(++_0x44249d);}(_0x8bf5,0xe0));var _0x58bf=function(_0x3f01dd,_0x128e0f){_0x3f01dd=_0x3f01dd-0x0;var _0x4bae40=_0x8bf5[_0x3f01dd];return _0x4bae40;};'use strict';var _=require(_0x58bf('0x0'));var util=require(_0x58bf('0x1'));var logger=require(_0x58bf('0x2'))(_0x58bf('0x3'));var moment=require(_0x58bf('0x4'));var BPromise=require(_0x58bf('0x5'));var rp=require(_0x58bf('0x6'));var attributes=require('./sound.attributes');module[_0x58bf('0x7')]=function(_0x42331d,_0x126aab){return _0x42331d['define'](_0x58bf('0x8'),attributes,{'tableName':_0x58bf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x4b3a=['tools_sounds','lodash','api','moment','bluebird','request-promise','./sound.attributes','exports','define','Sound'];(function(_0x527386,_0x2a11e9){var _0x160e42=function(_0x34255a){while(--_0x34255a){_0x527386['push'](_0x527386['shift']());}};_0x160e42(++_0x2a11e9);}(_0x4b3a,0x137));var _0xa4b3=function(_0x471e59,_0x4fc3de){_0x471e59=_0x471e59-0x0;var _0x64d610=_0x4b3a[_0x471e59];return _0x64d610;};'use strict';var _=require(_0xa4b3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa4b3('0x1'));var moment=require(_0xa4b3('0x2'));var BPromise=require(_0xa4b3('0x3'));var rp=require(_0xa4b3('0x4'));var attributes=require(_0xa4b3('0x5'));module[_0xa4b3('0x6')]=function(_0x2c43d5,_0x2f8da5){return _0x2c43d5[_0xa4b3('0x7')](_0xa4b3('0x8'),attributes,{'tableName':_0xa4b3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 59fb59e..0895fdb 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','Sound,\x20%s,\x20%s','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowSound','Sound','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x4b9273,_0x434262){var _0x1dbc00=function(_0xf86bd6){while(--_0xf86bd6){_0x4b9273['push'](_0x4b9273['shift']());}};_0x1dbc00(++_0x434262);}(_0xb10b,0x12a));var _0xbb10=function(_0x44f974,_0x4db616){_0x44f974=_0x44f974-0x0;var _0x805dbd=_0xb10b[_0x44f974];return _0x805dbd;};'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','Sound,\x20%s,\x20%s','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowSound','Sound','find','options','raw','where','attributes','map','include','model','debug'];(function(_0xbcfc41,_0x38002f){var _0x38c009=function(_0x4a7ea1){while(--_0x4a7ea1){_0xbcfc41['push'](_0xbcfc41['shift']());}};_0x38c009(++_0x38002f);}(_0xb10b,0x12a));var _0xbb10=function(_0x2b26c5,_0x547bea){_0x2b26c5=_0x2b26c5-0x0;var _0xfc7f7f=_0xb10b[_0x2b26c5];return _0xfc7f7f;};'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 16de23d..c95df3f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb5c6=['put','/:id','delete','destroy','exports','util','path','connect-timeout','express','./squareMessage.controller','get','index','isAuthenticated','show','post','create'];(function(_0x3d4787,_0x425210){var _0xbeeb22=function(_0x28888e){while(--_0x28888e){_0x3d4787['push'](_0x3d4787['shift']());}};_0xbeeb22(++_0x425210);}(_0xb5c6,0xe5));var _0x6b5c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xb5c6[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x6b5c('0x0'));var path=require(_0x6b5c('0x1'));var timeout=require(_0x6b5c('0x2'));var express=require(_0x6b5c('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6b5c('0x4'));router[_0x6b5c('0x5')]('/',auth['isAuthenticated'](),controller[_0x6b5c('0x6')]);router[_0x6b5c('0x5')]('/:id',auth[_0x6b5c('0x7')](),controller[_0x6b5c('0x8')]);router[_0x6b5c('0x9')]('/',auth[_0x6b5c('0x7')](),controller[_0x6b5c('0xa')]);router[_0x6b5c('0xb')](_0x6b5c('0xc'),auth[_0x6b5c('0x7')](),controller['update']);router[_0x6b5c('0xd')]('/:id',auth[_0x6b5c('0x7')](),controller[_0x6b5c('0xe')]);module[_0x6b5c('0xf')]=router;
\ No newline at end of file
+var _0xa724=['post','create','put','update','delete','destroy','exports','multer','connect-timeout','Router','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','index','/:id','isAuthenticated','show'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa724,0xf1));var _0x4a72=function(_0x596c48,_0x3bd9e4){_0x596c48=_0x596c48-0x0;var _0x289954=_0xa724[_0x596c48];return _0x289954;};'use strict';var multer=require(_0x4a72('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4a72('0x1'));var express=require('express');var router=express[_0x4a72('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x4a72('0x3'));var config=require(_0x4a72('0x4'));var controller=require(_0x4a72('0x5'));router[_0x4a72('0x6')]('/',auth['isAuthenticated'](),controller[_0x4a72('0x7')]);router['get'](_0x4a72('0x8'),auth[_0x4a72('0x9')](),controller[_0x4a72('0xa')]);router[_0x4a72('0xb')]('/',auth[_0x4a72('0x9')](),controller[_0x4a72('0xc')]);router[_0x4a72('0xd')](_0x4a72('0x8'),auth[_0x4a72('0x9')](),controller[_0x4a72('0xe')]);router[_0x4a72('0xf')](_0x4a72('0x8'),auth['isAuthenticated'](),controller[_0x4a72('0x10')]);module[_0x4a72('0x11')]=router;
\ No newline at end of file
index 8ef44ec..8329139 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1ea1=['ENUM','out','sequelize','exports','STRING','TEXT','medium'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x1ea1,0x198));var _0x11ea=function(_0x5961a3,_0x37ddd1){_0x5961a3=_0x5961a3-0x0;var _0x19cce1=_0x1ea1[_0x5961a3];return _0x19cce1;};'use strict';var Sequelize=require(_0x11ea('0x0'));module[_0x11ea('0x1')]={'uniqueid':{'type':Sequelize[_0x11ea('0x2')]},'body':{'type':Sequelize[_0x11ea('0x3')](_0x11ea('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x11ea('0x5')]('in',_0x11ea('0x6')),'defaultValue':_0x11ea('0x6'),'allowNull':![]}};
\ No newline at end of file
+var _0xb40f=['TEXT','ENUM','out','sequelize','exports','STRING'];(function(_0xf6a7ee,_0x2f0415){var _0x351fad=function(_0x10bec3){while(--_0x10bec3){_0xf6a7ee['push'](_0xf6a7ee['shift']());}};_0x351fad(++_0x2f0415);}(_0xb40f,0xa5));var _0xfb40=function(_0x5aef17,_0x592cd4){_0x5aef17=_0x5aef17-0x0;var _0x43f9d0=_0xb40f[_0x5aef17];return _0x43f9d0;};'use strict';var Sequelize=require(_0xfb40('0x0'));module[_0xfb40('0x1')]={'uniqueid':{'type':Sequelize[_0xfb40('0x2')]},'body':{'type':Sequelize[_0xfb40('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xfb40('0x4')]('in','out'),'defaultValue':_0xfb40('0x5'),'allowNull':![]}};
\ No newline at end of file
index 7ab86af..898e95f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcb1b=['send','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','map','type','key','VIRTUAL','field','options','SquareMessage','includeAll','include','findAll','rows','show','params','merge','create','body','catch','update','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name'];(function(_0xb3b452,_0x582e8e){var _0x238983=function(_0x3bc866){while(--_0x3bc866){_0xb3b452['push'](_0xb3b452['shift']());}};_0x238983(++_0x582e8e);}(_0xcb1b,0x6e));var _0xbcb1=function(_0x15441b,_0x245843){_0x15441b=_0x15441b-0x0;var _0x51aa3f=_0xcb1b[_0x15441b];return _0x51aa3f;};'use strict';var pdf=require(_0xbcb1('0x0'));var emlformat=require(_0xbcb1('0x1'));var rimraf=require(_0xbcb1('0x2'));var zipdir=require(_0xbcb1('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbcb1('0x4'));var moment=require(_0xbcb1('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xbcb1('0x6'));var sox=require('sox');var csv=require(_0xbcb1('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbcb1('0x8'));var squel=require('squel');var crypto=require(_0xbcb1('0x9'));var jsforce=require(_0xbcb1('0xa'));var deskjs=require(_0xbcb1('0xb'));var toCsv=require(_0xbcb1('0x7'));var querystring=require(_0xbcb1('0xc'));var Papa=require(_0xbcb1('0xd'));var authService=require(_0xbcb1('0xe'));var hardwareService=require(_0xbcb1('0xf'));var Redis=require('ioredis');var qs=require(_0xbcb1('0x10'));var logger=require(_0xbcb1('0x11'))(_0xbcb1('0x12'));var utils=require(_0xbcb1('0x13'));var config=require(_0xbcb1('0x14'));var db=require(_0xbcb1('0x15'))['db'];function respondWithStatusCode(_0x33ed6d,_0x3e166b){_0x3e166b=_0x3e166b||0xcc;return function(_0x14400e){if(_0x14400e){return _0x33ed6d['sendStatus'](_0x3e166b);}return _0x33ed6d[_0xbcb1('0x16')](_0x3e166b)[_0xbcb1('0x17')]();};}function respondWithResult(_0x356785,_0x48c1be){_0x48c1be=_0x48c1be||0xc8;return function(_0x30b7a7){if(_0x30b7a7){return _0x356785[_0xbcb1('0x16')](_0x48c1be)[_0xbcb1('0x18')](_0x30b7a7);}};}function respondWithFilteredResult(_0x5a16c3,_0x267a33){return function(_0x170f8c){if(_0x170f8c){var _0x47ef37=_0x170f8c[_0xbcb1('0x19')],_0x27ae44=_0x267a33[_0xbcb1('0x1a')],_0x49e618=_0x267a33[_0xbcb1('0x1a')]+_0x267a33['limit'],_0x1918a0;if(_0x49e618>=_0x47ef37){_0x49e618=_0x47ef37;_0x1918a0=0xc8;}else{_0x1918a0=0xce;}_0x5a16c3['status'](_0x1918a0);return _0x5a16c3[_0xbcb1('0x1b')](_0xbcb1('0x1c'),_0x27ae44+'-'+_0x49e618+'/'+_0x47ef37)[_0xbcb1('0x18')](_0x170f8c);}return null;};}function patchUpdates(_0x2252eb){return function(_0xa8a046){try{jsonpatch[_0xbcb1('0x1d')](_0xa8a046,_0x2252eb,!![]);}catch(_0x287ad5){return BPromise[_0xbcb1('0x1e')](_0x287ad5);}return _0xa8a046[_0xbcb1('0x1f')]();};}function saveUpdates(_0x163fd7,_0x55fe09){return function(_0x34952b){if(_0x34952b){return _0x34952b['update'](_0x163fd7)[_0xbcb1('0x20')](function(_0x558913){return _0x558913;});}return null;};}function removeEntity(_0x1eeff2,_0x244f9a){return function(_0x3ac94f){if(_0x3ac94f){return _0x3ac94f[_0xbcb1('0x21')]()[_0xbcb1('0x20')](function(){_0x1eeff2['status'](0xcc)[_0xbcb1('0x17')]();});}};}function handleEntityNotFound(_0xe50071,_0x2c2131){return function(_0x1224db){if(!_0x1224db){_0xe50071[_0xbcb1('0x22')](0x194);}return _0x1224db;};}function handleError(_0x4329cb,_0x3a6f9b){_0x3a6f9b=_0x3a6f9b||0x1f4;return function(_0x3699fd){logger[_0xbcb1('0x23')](_0x3699fd[_0xbcb1('0x24')]);if(_0x3699fd[_0xbcb1('0x25')]){delete _0x3699fd[_0xbcb1('0x25')];}_0x4329cb['status'](_0x3a6f9b)[_0xbcb1('0x26')](_0x3699fd);};}exports['index']=function(_0x493e9f,_0x3f76c0){var _0x418a7d={},_0x1945da={},_0x571451={'count':0x0,'rows':[]};var _0x5ab1cf=db['SquareMessage'][_0xbcb1('0x27')];_0x1945da[_0xbcb1('0x28')]=_[_0xbcb1('0x29')](_0x5ab1cf);_0x1945da[_0xbcb1('0x2a')]=_[_0xbcb1('0x29')](_0x493e9f[_0xbcb1('0x2a')]);_0x1945da[_0xbcb1('0x2b')]=_[_0xbcb1('0x2c')](_0x1945da[_0xbcb1('0x28')],_0x1945da[_0xbcb1('0x2a')]);_0x418a7d[_0xbcb1('0x2d')]=_[_0xbcb1('0x2c')](_0x1945da[_0xbcb1('0x28')],qs[_0xbcb1('0x2e')](_0x493e9f[_0xbcb1('0x2a')][_0xbcb1('0x2e')]));_0x418a7d['attributes']=_0x418a7d[_0xbcb1('0x2d')][_0xbcb1('0x2f')]?_0x418a7d[_0xbcb1('0x2d')]:_0x1945da[_0xbcb1('0x28')];if(!_0x493e9f[_0xbcb1('0x2a')][_0xbcb1('0x30')](_0xbcb1('0x31'))){_0x418a7d[_0xbcb1('0x32')]=qs['limit'](_0x493e9f[_0xbcb1('0x2a')][_0xbcb1('0x32')]);_0x418a7d[_0xbcb1('0x1a')]=qs[_0xbcb1('0x1a')](_0x493e9f[_0xbcb1('0x2a')]['offset']);}_0x418a7d[_0xbcb1('0x33')]=qs[_0xbcb1('0x34')](_0x493e9f[_0xbcb1('0x2a')]['sort']);_0x418a7d[_0xbcb1('0x35')]=qs[_0xbcb1('0x2b')](_['pick'](_0x493e9f['query'],_0x1945da[_0xbcb1('0x2b')]));if(_0x493e9f[_0xbcb1('0x2a')][_0xbcb1('0x36')]){_0x418a7d['where']=_['merge'](_0x418a7d[_0xbcb1('0x35')],{'$or':_[_0xbcb1('0x37')](_0x5ab1cf,function(_0x5968d7){if(_0x5968d7[_0xbcb1('0x38')][_0xbcb1('0x39')]!==_0xbcb1('0x3a')){var _0x1689af={};_0x1689af[_0x5968d7[_0xbcb1('0x3b')]]={'$like':'%'+_0x493e9f[_0xbcb1('0x2a')][_0xbcb1('0x36')]+'%'};return _0x1689af;}})});}_0x418a7d=_['merge']({},_0x418a7d,_0x493e9f[_0xbcb1('0x3c')]);var _0x1e987b={'where':_0x418a7d['where']};return db[_0xbcb1('0x3d')][_0xbcb1('0x19')](_0x1e987b)[_0xbcb1('0x20')](function(_0x4bfd1a){_0x571451['count']=_0x4bfd1a;if(_0x493e9f[_0xbcb1('0x2a')][_0xbcb1('0x3e')]){_0x418a7d[_0xbcb1('0x3f')]=[{'all':!![]}];}return db[_0xbcb1('0x3d')][_0xbcb1('0x40')](_0x418a7d);})[_0xbcb1('0x20')](function(_0x2f5186){_0x571451[_0xbcb1('0x41')]=_0x2f5186;return _0x571451;})[_0xbcb1('0x20')](respondWithFilteredResult(_0x3f76c0,_0x418a7d))['catch'](handleError(_0x3f76c0,null));};exports[_0xbcb1('0x42')]=function(_0xba858e,_0x5be9a5){var _0x5e8451={'raw':!![],'where':{'id':_0xba858e[_0xbcb1('0x43')]['id']}},_0x385bc2={};_0x385bc2[_0xbcb1('0x28')]=_[_0xbcb1('0x29')](db[_0xbcb1('0x3d')][_0xbcb1('0x27')]);_0x385bc2[_0xbcb1('0x2a')]=_[_0xbcb1('0x29')](_0xba858e[_0xbcb1('0x2a')]);_0x385bc2[_0xbcb1('0x2b')]=_['intersection'](_0x385bc2[_0xbcb1('0x28')],_0x385bc2[_0xbcb1('0x2a')]);_0x5e8451[_0xbcb1('0x2d')]=_[_0xbcb1('0x2c')](_0x385bc2[_0xbcb1('0x28')],qs[_0xbcb1('0x2e')](_0xba858e[_0xbcb1('0x2a')][_0xbcb1('0x2e')]));_0x5e8451['attributes']=_0x5e8451['attributes'][_0xbcb1('0x2f')]?_0x5e8451[_0xbcb1('0x2d')]:_0x385bc2[_0xbcb1('0x28')];if(_0xba858e[_0xbcb1('0x2a')][_0xbcb1('0x3e')]){_0x5e8451[_0xbcb1('0x3f')]=[{'all':!![]}];}_0x5e8451=_[_0xbcb1('0x44')]({},_0x5e8451,_0xba858e['options']);return db['SquareMessage']['find'](_0x5e8451)[_0xbcb1('0x20')](handleEntityNotFound(_0x5be9a5,null))[_0xbcb1('0x20')](respondWithResult(_0x5be9a5,null))['catch'](handleError(_0x5be9a5,null));};exports[_0xbcb1('0x45')]=function(_0x40e2a4,_0x354390){return db[_0xbcb1('0x3d')][_0xbcb1('0x45')](_0x40e2a4[_0xbcb1('0x46')],{})[_0xbcb1('0x20')](respondWithResult(_0x354390,0xc9))[_0xbcb1('0x47')](handleError(_0x354390,null));};exports[_0xbcb1('0x48')]=function(_0x261b8d,_0x135175){if(_0x261b8d[_0xbcb1('0x46')]['id']){delete _0x261b8d['body']['id'];}return db[_0xbcb1('0x3d')][_0xbcb1('0x49')]({'where':{'id':_0x261b8d[_0xbcb1('0x43')]['id']}})[_0xbcb1('0x20')](handleEntityNotFound(_0x135175,null))[_0xbcb1('0x20')](saveUpdates(_0x261b8d[_0xbcb1('0x46')],null))[_0xbcb1('0x20')](respondWithResult(_0x135175,null))[_0xbcb1('0x47')](handleError(_0x135175,null));};exports[_0xbcb1('0x21')]=function(_0x6ec87c,_0x351126){return db[_0xbcb1('0x3d')][_0xbcb1('0x49')]({'where':{'id':_0x6ec87c[_0xbcb1('0x43')]['id']}})[_0xbcb1('0x20')](handleEntityNotFound(_0x351126,null))[_0xbcb1('0x20')](removeEntity(_0x351126,null))[_0xbcb1('0x47')](handleError(_0x351126,null));};
\ No newline at end of file
+var _0x4676=['Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','SquareMessage','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','merge','map','type','VIRTUAL','field','filter','options','include','rows','catch','params','rawAttributes','find','create','body','html-pdf','eml-format','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x4676,0x1c7));var _0x6467=function(_0x58cb66,_0x39609a){_0x58cb66=_0x58cb66-0x0;var _0x6fd160=_0x4676[_0x58cb66];return _0x6fd160;};'use strict';var pdf=require(_0x6467('0x0'));var emlformat=require(_0x6467('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6467('0x2'));var moment=require('moment');var BPromise=require(_0x6467('0x3'));var Mustache=require('mustache');var util=require(_0x6467('0x4'));var path=require(_0x6467('0x5'));var sox=require(_0x6467('0x6'));var csv=require(_0x6467('0x7'));var ejs=require(_0x6467('0x8'));var fs=require('fs');var _=require(_0x6467('0x9'));var squel=require(_0x6467('0xa'));var crypto=require(_0x6467('0xb'));var jsforce=require(_0x6467('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6467('0x7'));var querystring=require(_0x6467('0xd'));var Papa=require(_0x6467('0xe'));var authService=require('../../components/auth/service');var hardwareService=require(_0x6467('0xf'));var Redis=require(_0x6467('0x10'));var qs=require(_0x6467('0x11'));var logger=require(_0x6467('0x12'))(_0x6467('0x13'));var utils=require('../../config/utils');var config=require(_0x6467('0x14'));var db=require(_0x6467('0x15'))['db'];function respondWithStatusCode(_0x1c1629,_0x2e21d8){_0x2e21d8=_0x2e21d8||0xcc;return function(_0x21550e){if(_0x21550e){return _0x1c1629[_0x6467('0x16')](_0x2e21d8);}return _0x1c1629[_0x6467('0x17')](_0x2e21d8)['end']();};}function respondWithResult(_0x594168,_0x48da89){_0x48da89=_0x48da89||0xc8;return function(_0x28a479){if(_0x28a479){return _0x594168[_0x6467('0x17')](_0x48da89)[_0x6467('0x18')](_0x28a479);}};}function respondWithFilteredResult(_0x1a3743,_0x48cca1){return function(_0x31154e){if(_0x31154e){var _0x3e8bb9=_0x31154e[_0x6467('0x19')],_0x5c2e5b=_0x48cca1[_0x6467('0x1a')],_0x298489=_0x48cca1[_0x6467('0x1a')]+_0x48cca1['limit'],_0x1517a4;if(_0x298489>=_0x3e8bb9){_0x298489=_0x3e8bb9;_0x1517a4=0xc8;}else{_0x1517a4=0xce;}_0x1a3743[_0x6467('0x17')](_0x1517a4);return _0x1a3743[_0x6467('0x1b')](_0x6467('0x1c'),_0x5c2e5b+'-'+_0x298489+'/'+_0x3e8bb9)[_0x6467('0x18')](_0x31154e);}return null;};}function patchUpdates(_0x27d160){return function(_0x397b54){try{jsonpatch[_0x6467('0x1d')](_0x397b54,_0x27d160,!![]);}catch(_0xde2d25){return BPromise[_0x6467('0x1e')](_0xde2d25);}return _0x397b54[_0x6467('0x1f')]();};}function saveUpdates(_0x41a868,_0x411a49){return function(_0x3e677c){if(_0x3e677c){return _0x3e677c[_0x6467('0x20')](_0x41a868)[_0x6467('0x21')](function(_0x5cf3f7){return _0x5cf3f7;});}return null;};}function removeEntity(_0x1e285f,_0x389e1d){return function(_0x71687b){if(_0x71687b){return _0x71687b[_0x6467('0x22')]()[_0x6467('0x21')](function(){_0x1e285f['status'](0xcc)[_0x6467('0x23')]();});}};}function handleEntityNotFound(_0x229b60,_0x277eca){return function(_0x1728e7){if(!_0x1728e7){_0x229b60[_0x6467('0x16')](0x194);}return _0x1728e7;};}function handleError(_0x4afcbe,_0x407618){_0x407618=_0x407618||0x1f4;return function(_0x351ac0){logger[_0x6467('0x24')](_0x351ac0[_0x6467('0x25')]);if(_0x351ac0[_0x6467('0x26')]){delete _0x351ac0['name'];}_0x4afcbe[_0x6467('0x17')](_0x407618)['send'](_0x351ac0);};}exports[_0x6467('0x27')]=function(_0x2da7b0,_0x39a777){var _0x12fcbf={},_0x16d99d={},_0x18663a={'count':0x0,'rows':[]};var _0x53caec=db[_0x6467('0x28')]['rawAttributes'];_0x16d99d[_0x6467('0x29')]=_[_0x6467('0x2a')](_0x53caec);_0x16d99d[_0x6467('0x2b')]=_[_0x6467('0x2a')](_0x2da7b0[_0x6467('0x2b')]);_0x16d99d[_0x6467('0x2c')]=_[_0x6467('0x2d')](_0x16d99d[_0x6467('0x29')],_0x16d99d[_0x6467('0x2b')]);_0x12fcbf[_0x6467('0x2e')]=_[_0x6467('0x2d')](_0x16d99d[_0x6467('0x29')],qs[_0x6467('0x2f')](_0x2da7b0[_0x6467('0x2b')][_0x6467('0x2f')]));_0x12fcbf[_0x6467('0x2e')]=_0x12fcbf[_0x6467('0x2e')][_0x6467('0x30')]?_0x12fcbf[_0x6467('0x2e')]:_0x16d99d[_0x6467('0x29')];if(!_0x2da7b0['query']['hasOwnProperty'](_0x6467('0x31'))){_0x12fcbf[_0x6467('0x32')]=qs[_0x6467('0x32')](_0x2da7b0['query']['limit']);_0x12fcbf['offset']=qs[_0x6467('0x1a')](_0x2da7b0[_0x6467('0x2b')][_0x6467('0x1a')]);}_0x12fcbf['order']=qs['sort'](_0x2da7b0['query'][_0x6467('0x33')]);_0x12fcbf[_0x6467('0x34')]=qs['filters'](_[_0x6467('0x35')](_0x2da7b0[_0x6467('0x2b')],_0x16d99d[_0x6467('0x2c')]));if(_0x2da7b0[_0x6467('0x2b')]['filter']){_0x12fcbf[_0x6467('0x34')]=_[_0x6467('0x36')](_0x12fcbf[_0x6467('0x34')],{'$or':_[_0x6467('0x37')](_0x53caec,function(_0x26d02f){if(_0x26d02f[_0x6467('0x38')]['key']!==_0x6467('0x39')){var _0x3cd0fb={};_0x3cd0fb[_0x26d02f[_0x6467('0x3a')]]={'$like':'%'+_0x2da7b0['query'][_0x6467('0x3b')]+'%'};return _0x3cd0fb;}})});}_0x12fcbf=_[_0x6467('0x36')]({},_0x12fcbf,_0x2da7b0[_0x6467('0x3c')]);var _0x544131={'where':_0x12fcbf['where']};return db[_0x6467('0x28')][_0x6467('0x19')](_0x544131)[_0x6467('0x21')](function(_0x2f171e){_0x18663a[_0x6467('0x19')]=_0x2f171e;if(_0x2da7b0['query']['includeAll']){_0x12fcbf[_0x6467('0x3d')]=[{'all':!![]}];}return db[_0x6467('0x28')]['findAll'](_0x12fcbf);})[_0x6467('0x21')](function(_0x5281a4){_0x18663a[_0x6467('0x3e')]=_0x5281a4;return _0x18663a;})[_0x6467('0x21')](respondWithFilteredResult(_0x39a777,_0x12fcbf))[_0x6467('0x3f')](handleError(_0x39a777,null));};exports['show']=function(_0x322b62,_0x110d13){var _0x3e9892={'raw':!![],'where':{'id':_0x322b62[_0x6467('0x40')]['id']}},_0x5e1968={};_0x5e1968[_0x6467('0x29')]=_[_0x6467('0x2a')](db[_0x6467('0x28')][_0x6467('0x41')]);_0x5e1968[_0x6467('0x2b')]=_[_0x6467('0x2a')](_0x322b62['query']);_0x5e1968[_0x6467('0x2c')]=_[_0x6467('0x2d')](_0x5e1968[_0x6467('0x29')],_0x5e1968[_0x6467('0x2b')]);_0x3e9892[_0x6467('0x2e')]=_[_0x6467('0x2d')](_0x5e1968['model'],qs[_0x6467('0x2f')](_0x322b62['query']['fields']));_0x3e9892[_0x6467('0x2e')]=_0x3e9892[_0x6467('0x2e')][_0x6467('0x30')]?_0x3e9892[_0x6467('0x2e')]:_0x5e1968[_0x6467('0x29')];if(_0x322b62['query']['includeAll']){_0x3e9892[_0x6467('0x3d')]=[{'all':!![]}];}_0x3e9892=_[_0x6467('0x36')]({},_0x3e9892,_0x322b62[_0x6467('0x3c')]);return db[_0x6467('0x28')][_0x6467('0x42')](_0x3e9892)[_0x6467('0x21')](handleEntityNotFound(_0x110d13,null))[_0x6467('0x21')](respondWithResult(_0x110d13,null))[_0x6467('0x3f')](handleError(_0x110d13,null));};exports[_0x6467('0x43')]=function(_0x347228,_0xd3e058){return db[_0x6467('0x28')]['create'](_0x347228['body'],{})['then'](respondWithResult(_0xd3e058,0xc9))[_0x6467('0x3f')](handleError(_0xd3e058,null));};exports[_0x6467('0x20')]=function(_0x5e1629,_0x2299ec){if(_0x5e1629[_0x6467('0x44')]['id']){delete _0x5e1629[_0x6467('0x44')]['id'];}return db[_0x6467('0x28')][_0x6467('0x42')]({'where':{'id':_0x5e1629['params']['id']}})[_0x6467('0x21')](handleEntityNotFound(_0x2299ec,null))[_0x6467('0x21')](saveUpdates(_0x5e1629[_0x6467('0x44')],null))[_0x6467('0x21')](respondWithResult(_0x2299ec,null))[_0x6467('0x3f')](handleError(_0x2299ec,null));};exports[_0x6467('0x22')]=function(_0x3df3ca,_0x512578){return db[_0x6467('0x28')][_0x6467('0x42')]({'where':{'id':_0x3df3ca[_0x6467('0x40')]['id']}})[_0x6467('0x21')](handleEntityNotFound(_0x512578,null))[_0x6467('0x21')](removeEntity(_0x512578,null))[_0x6467('0x3f')](handleError(_0x512578,null));};
\ No newline at end of file
index 39b7785..997e472 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd170=['request-promise','./squareMessage.attributes','define','SquareMessage','square_messages','lodash','../../config/logger','api','moment','bluebird'];(function(_0xdfb3c3,_0x59788d){var _0x4f9a74=function(_0x2f1544){while(--_0x2f1544){_0xdfb3c3['push'](_0xdfb3c3['shift']());}};_0x4f9a74(++_0x59788d);}(_0xd170,0x109));var _0x0d17=function(_0x2f4db3,_0x6b109d){_0x2f4db3=_0x2f4db3-0x0;var _0x39ce3e=_0xd170[_0x2f4db3];return _0x39ce3e;};'use strict';var _=require(_0x0d17('0x0'));var util=require('util');var logger=require(_0x0d17('0x1'))(_0x0d17('0x2'));var moment=require(_0x0d17('0x3'));var BPromise=require(_0x0d17('0x4'));var rp=require(_0x0d17('0x5'));var attributes=require(_0x0d17('0x6'));module['exports']=function(_0x18ccd6,_0x2c20b7){return _0x18ccd6[_0x0d17('0x7')](_0x0d17('0x8'),attributes,{'tableName':_0x0d17('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x96c4=['exports','square_messages','util','../../config/logger','api','moment','request-promise','./squareMessage.attributes'];(function(_0x2179f1,_0x21c653){var _0x176ec9=function(_0x4c4a4c){while(--_0x4c4a4c){_0x2179f1['push'](_0x2179f1['shift']());}};_0x176ec9(++_0x21c653);}(_0x96c4,0x10a));var _0x496c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x96c4[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x496c('0x0'));var logger=require(_0x496c('0x1'))(_0x496c('0x2'));var moment=require(_0x496c('0x3'));var BPromise=require('bluebird');var rp=require(_0x496c('0x4'));var attributes=require(_0x496c('0x5'));module[_0x496c('0x6')]=function(_0x451e1e,_0x28e8e5){return _0x451e1e['define']('SquareMessage',attributes,{'tableName':_0x496c('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 47e75b5..169c1f0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5b87=['SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SquareMessage,\x20%s,\x20%s','message','result','catch','CreateSquareMessage','SquareMessage','body','options','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','then','info','debug'];(function(_0x11cd9d,_0x4918f3){var _0x571038=function(_0x5a6b07){while(--_0x5a6b07){_0x11cd9d['push'](_0x11cd9d['shift']());}};_0x571038(++_0x4918f3);}(_0x5b87,0x71));var _0x75b8=function(_0x41b12d,_0x2b74f5){_0x41b12d=_0x41b12d-0x0;var _0x5996d1=_0x5b87[_0x41b12d];return _0x5996d1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x75b8('0x0'));var BPromise=require(_0x75b8('0x1'));var rs=require(_0x75b8('0x2'));var fs=require('fs');var Redis=require(_0x75b8('0x3'));var db=require(_0x75b8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x75b8('0x5'))('rpc');var config=require(_0x75b8('0x6'));var jayson=require(_0x75b8('0x7'));var client=jayson[_0x75b8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f7831,_0x541060,_0x29d83a){return new BPromise(function(_0x1da3f9,_0x5f0aa9){return client['request'](_0x3f7831,_0x29d83a)[_0x75b8('0x9')](function(_0x1b1a5e){logger[_0x75b8('0xa')]('SquareMessage,\x20%s,\x20%s',_0x541060,'request\x20sent');logger[_0x75b8('0xb')](_0x75b8('0xc'),_0x541060,_0x75b8('0xd'),JSON[_0x75b8('0xe')](_0x1b1a5e));if(_0x1b1a5e[_0x75b8('0xf')]){if(_0x1b1a5e[_0x75b8('0xf')]['code']===0x1f4){logger['error'](_0x75b8('0x10'),_0x541060,_0x1b1a5e[_0x75b8('0xf')][_0x75b8('0x11')]);return _0x5f0aa9(_0x1b1a5e[_0x75b8('0xf')][_0x75b8('0x11')]);}logger[_0x75b8('0xf')](_0x75b8('0x10'),_0x541060,_0x1b1a5e[_0x75b8('0xf')]['message']);return _0x1da3f9(_0x1b1a5e[_0x75b8('0xf')][_0x75b8('0x11')]);}else{logger[_0x75b8('0xa')](_0x75b8('0x10'),_0x541060,_0x75b8('0xd'));_0x1da3f9(_0x1b1a5e[_0x75b8('0x12')][_0x75b8('0x11')]);}})[_0x75b8('0x13')](function(_0x22bdcc){logger['error'](_0x75b8('0x10'),_0x541060,_0x22bdcc);_0x5f0aa9(_0x22bdcc);});});}exports[_0x75b8('0x14')]=function(_0x1b985b){var _0x344a12=this;return new Promise(function(_0x2fbeed,_0x28b343){return db[_0x75b8('0x15')]['create'](_0x1b985b[_0x75b8('0x16')],{'raw':_0x1b985b[_0x75b8('0x17')]?_0x1b985b['options'][_0x75b8('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x33e013){logger[_0x75b8('0xa')](_0x75b8('0x14'),_0x1b985b);logger[_0x75b8('0xb')](_0x75b8('0x14'),_0x1b985b,JSON[_0x75b8('0xe')](_0x33e013));_0x2fbeed(_0x33e013);})[_0x75b8('0x13')](function(_0x514dd7){logger['error'](_0x75b8('0x14'),_0x514dd7[_0x75b8('0x11')],_0x1b985b);_0x28b343(_0x344a12[_0x75b8('0xf')](0x1f4,_0x514dd7[_0x75b8('0x11')]));});});};
\ No newline at end of file
+var _0xfb28=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateSquareMessage','SquareMessage','body','options','raw','then','catch','lodash'];(function(_0x1bbb99,_0x18b29c){var _0x7e5706=function(_0x2e7b5b){while(--_0x2e7b5b){_0x1bbb99['push'](_0x1bbb99['shift']());}};_0x7e5706(++_0x18b29c);}(_0xfb28,0x67));var _0x8fb2=function(_0xe4c1,_0x2a01b1){_0xe4c1=_0xe4c1-0x0;var _0x3a12b3=_0xfb28[_0xe4c1];return _0x3a12b3;};'use strict';var _=require(_0x8fb2('0x0'));var util=require(_0x8fb2('0x1'));var moment=require(_0x8fb2('0x2'));var BPromise=require(_0x8fb2('0x3'));var rs=require(_0x8fb2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fb2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8fb2('0x6'))(_0x8fb2('0x7'));var config=require('../../config/environment');var jayson=require(_0x8fb2('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2dad50,_0x29e171,_0x7a3bd8){return new BPromise(function(_0x11f927,_0x2ef1e4){return client['request'](_0x2dad50,_0x7a3bd8)['then'](function(_0x1b5f13){logger['info'](_0x8fb2('0x9'),_0x29e171,_0x8fb2('0xa'));logger[_0x8fb2('0xb')](_0x8fb2('0xc'),_0x29e171,_0x8fb2('0xa'),JSON[_0x8fb2('0xd')](_0x1b5f13));if(_0x1b5f13[_0x8fb2('0xe')]){if(_0x1b5f13['error'][_0x8fb2('0xf')]===0x1f4){logger[_0x8fb2('0xe')](_0x8fb2('0x9'),_0x29e171,_0x1b5f13[_0x8fb2('0xe')]['message']);return _0x2ef1e4(_0x1b5f13[_0x8fb2('0xe')][_0x8fb2('0x10')]);}logger[_0x8fb2('0xe')]('SquareMessage,\x20%s,\x20%s',_0x29e171,_0x1b5f13[_0x8fb2('0xe')][_0x8fb2('0x10')]);return _0x11f927(_0x1b5f13[_0x8fb2('0xe')][_0x8fb2('0x10')]);}else{logger[_0x8fb2('0x11')](_0x8fb2('0x9'),_0x29e171,_0x8fb2('0xa'));_0x11f927(_0x1b5f13[_0x8fb2('0x12')][_0x8fb2('0x10')]);}})['catch'](function(_0x22a2b8){logger['error'](_0x8fb2('0x9'),_0x29e171,_0x22a2b8);_0x2ef1e4(_0x22a2b8);});});}exports[_0x8fb2('0x13')]=function(_0x24f251){var _0x1bb5d6=this;return new Promise(function(_0x44c085,_0x43e38f){return db[_0x8fb2('0x14')]['create'](_0x24f251[_0x8fb2('0x15')],{'raw':_0x24f251['options']?_0x24f251[_0x8fb2('0x16')][_0x8fb2('0x17')]===undefined?!![]:![]:!![]})[_0x8fb2('0x18')](function(_0x12bdb6){logger['info'](_0x8fb2('0x13'),_0x24f251);logger[_0x8fb2('0xb')](_0x8fb2('0x13'),_0x24f251,JSON[_0x8fb2('0xd')](_0x12bdb6));_0x44c085(_0x12bdb6);})[_0x8fb2('0x19')](function(_0x5ec93a){logger[_0x8fb2('0xe')](_0x8fb2('0x13'),_0x5ec93a[_0x8fb2('0x10')],_0x24f251);_0x43e38f(_0x1bb5d6[_0x8fb2('0xe')](0x1f4,_0x5ec93a['message']));});});};
\ No newline at end of file
index f730a0e..088674e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd110=['../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','/:id/test','15s','post','create','/:id','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service'];(function(_0x5e895f,_0x3167d7){var _0x1a6d33=function(_0x1a2c4c){while(--_0x1a2c4c){_0x5e895f['push'](_0x5e895f['shift']());}};_0x1a6d33(++_0x3167d7);}(_0xd110,0x1e8));var _0x0d11=function(_0x4af03c,_0x377a3b){_0x4af03c=_0x4af03c-0x0;var _0x51d938=_0xd110[_0x4af03c];return _0x51d938;};'use strict';var multer=require(_0x0d11('0x0'));var util=require(_0x0d11('0x1'));var path=require(_0x0d11('0x2'));var timeout=require('connect-timeout');var express=require(_0x0d11('0x3'));var router=express[_0x0d11('0x4')]();var auth=require(_0x0d11('0x5'));var interaction=require(_0x0d11('0x6'));var config=require(_0x0d11('0x7'));var controller=require(_0x0d11('0x8'));router[_0x0d11('0x9')]('/',auth[_0x0d11('0xa')](),controller['index']);router[_0x0d11('0x9')]('/:id',auth[_0x0d11('0xa')](),controller['show']);router['get'](_0x0d11('0xb'),auth[_0x0d11('0xa')](),timeout(_0x0d11('0xc')),controller['test']);router[_0x0d11('0xd')]('/',auth['isAuthenticated'](),controller[_0x0d11('0xe')]);router['put'](_0x0d11('0xf'),auth[_0x0d11('0xa')](),controller[_0x0d11('0x10')]);router[_0x0d11('0x11')]('/:id',auth[_0x0d11('0xa')](),controller[_0x0d11('0x12')]);module['exports']=router;
\ No newline at end of file
+var _0x99e9=['/:id','isAuthenticated','/:id/test','15s','test','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x5b7a3b,_0x4c1e11){var _0x47b8ee=function(_0x2290c9){while(--_0x2290c9){_0x5b7a3b['push'](_0x5b7a3b['shift']());}};_0x47b8ee(++_0x4c1e11);}(_0x99e9,0xb4));var _0x999e=function(_0x3e27ba,_0x46b120){_0x3e27ba=_0x3e27ba-0x0;var _0x10b3f2=_0x99e9[_0x3e27ba];return _0x10b3f2;};'use strict';var multer=require('multer');var util=require(_0x999e('0x0'));var path=require(_0x999e('0x1'));var timeout=require(_0x999e('0x2'));var express=require(_0x999e('0x3'));var router=express['Router']();var auth=require(_0x999e('0x4'));var interaction=require(_0x999e('0x5'));var config=require(_0x999e('0x6'));var controller=require('./squareOdbc.controller');router[_0x999e('0x7')]('/',auth['isAuthenticated'](),controller[_0x999e('0x8')]);router[_0x999e('0x7')](_0x999e('0x9'),auth[_0x999e('0xa')](),controller['show']);router[_0x999e('0x7')](_0x999e('0xb'),auth[_0x999e('0xa')](),timeout(_0x999e('0xc')),controller[_0x999e('0xd')]);router[_0x999e('0xe')]('/',auth[_0x999e('0xa')](),controller[_0x999e('0xf')]);router[_0x999e('0x10')](_0x999e('0x9'),auth[_0x999e('0xa')](),controller[_0x999e('0x11')]);router[_0x999e('0x12')](_0x999e('0x9'),auth[_0x999e('0xa')](),controller[_0x999e('0x13')]);module[_0x999e('0x14')]=router;
\ No newline at end of file
index 0eb4e6e..9248466 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7734=['name','sequelize','STRING'];(function(_0xa59a59,_0x4dd9ce){var _0x36e5c3=function(_0x457f1e){while(--_0x457f1e){_0xa59a59['push'](_0xa59a59['shift']());}};_0x36e5c3(++_0x4dd9ce);}(_0x7734,0x1d5));var _0x4773=function(_0x42e9b8,_0x1f24ca){_0x42e9b8=_0x42e9b8-0x0;var _0x35dd16=_0x7734[_0x42e9b8];return _0x35dd16;};'use strict';var Sequelize=require(_0x4773('0x0'));module['exports']={'name':{'type':Sequelize[_0x4773('0x1')],'unique':_0x4773('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x4773('0x1')]},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x5e3f=['name','exports','STRING'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x5e3f,0x11b));var _0xf5e3=function(_0x1f3972,_0x241258){_0x1f3972=_0x1f3972-0x0;var _0x7aaf19=_0x5e3f[_0x1f3972];return _0x7aaf19;};'use strict';var Sequelize=require('sequelize');module[_0xf5e3('0x0')]={'name':{'type':Sequelize[_0xf5e3('0x1')],'unique':_0xf5e3('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xf5e3('0x1')]},'description':{'type':Sequelize[_0xf5e3('0x1')]}};
\ No newline at end of file
index 8b7c647..6f01bff 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc8cc=['catch','show','params','includeAll','include','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','test','dsn','odbc','closeSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','ODBC','UserProfileResource','sendStatus','error','stack','name','send','SquareOdbc','rawAttributes','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','map','type','key','VIRTUAL','field','filter','options','findAll','rows'];(function(_0x2a0453,_0x27d0c1){var _0x4b2533=function(_0x692c81){while(--_0x692c81){_0x2a0453['push'](_0x2a0453['shift']());}};_0x4b2533(++_0x27d0c1);}(_0xc8cc,0x112));var _0xcc8c=function(_0x447fc8,_0x4bc237){_0x447fc8=_0x447fc8-0x0;var _0x4d76dc=_0xc8cc[_0x447fc8];return _0x4d76dc;};'use strict';var pdf=require(_0xcc8c('0x0'));var emlformat=require(_0xcc8c('0x1'));var rimraf=require(_0xcc8c('0x2'));var zipdir=require(_0xcc8c('0x3'));var jsonpatch=require(_0xcc8c('0x4'));var rp=require(_0xcc8c('0x5'));var moment=require(_0xcc8c('0x6'));var BPromise=require(_0xcc8c('0x7'));var Mustache=require(_0xcc8c('0x8'));var util=require('util');var path=require(_0xcc8c('0x9'));var sox=require(_0xcc8c('0xa'));var csv=require(_0xcc8c('0xb'));var ejs=require(_0xcc8c('0xc'));var fs=require('fs');var _=require(_0xcc8c('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcc8c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcc8c('0xb'));var querystring=require(_0xcc8c('0xf'));var Papa=require(_0xcc8c('0x10'));var authService=require(_0xcc8c('0x11'));var hardwareService=require(_0xcc8c('0x12'));var Redis=require(_0xcc8c('0x13'));var qs=require('../../components/parsers/qs');var logger=require(_0xcc8c('0x14'))(_0xcc8c('0x15'));var utils=require(_0xcc8c('0x16'));var config=require('../../config/environment');var db=require(_0xcc8c('0x17'))['db'];function respondWithStatusCode(_0x3d8d66,_0x55bcd7){_0x55bcd7=_0x55bcd7||0xcc;return function(_0x46604e){if(_0x46604e){return _0x3d8d66['sendStatus'](_0x55bcd7);}return _0x3d8d66[_0xcc8c('0x18')](_0x55bcd7)[_0xcc8c('0x19')]();};}function respondWithResult(_0x164362,_0x261c37){_0x261c37=_0x261c37||0xc8;return function(_0x563d08){if(_0x563d08){return _0x164362[_0xcc8c('0x18')](_0x261c37)[_0xcc8c('0x1a')](_0x563d08);}};}function respondWithFilteredResult(_0x52394b,_0xd3b836){return function(_0xe21c35){if(_0xe21c35){var _0x2101c4=_0xe21c35[_0xcc8c('0x1b')],_0x1e3961=_0xd3b836[_0xcc8c('0x1c')],_0x14ea0f=_0xd3b836[_0xcc8c('0x1c')]+_0xd3b836[_0xcc8c('0x1d')],_0x18b45e;if(_0x14ea0f>=_0x2101c4){_0x14ea0f=_0x2101c4;_0x18b45e=0xc8;}else{_0x18b45e=0xce;}_0x52394b[_0xcc8c('0x18')](_0x18b45e);return _0x52394b[_0xcc8c('0x1e')](_0xcc8c('0x1f'),_0x1e3961+'-'+_0x14ea0f+'/'+_0x2101c4)['json'](_0xe21c35);}return null;};}function patchUpdates(_0x3a711c){return function(_0x521c04){try{jsonpatch[_0xcc8c('0x20')](_0x521c04,_0x3a711c,!![]);}catch(_0x324e49){return BPromise[_0xcc8c('0x21')](_0x324e49);}return _0x521c04[_0xcc8c('0x22')]();};}function saveUpdates(_0x136b27,_0x465f19){return function(_0x113bd6){if(_0x113bd6){return _0x113bd6[_0xcc8c('0x23')](_0x136b27)['then'](function(_0x5495ee){return _0x5495ee;});}return null;};}function removeEntity(_0x9cf56c,_0x3d9f0b){return function(_0x28fafc){if(_0x28fafc){return _0x28fafc[_0xcc8c('0x24')]()[_0xcc8c('0x25')](function(){var _0x2f7fa6=_0x28fafc[_0xcc8c('0x26')]({'plain':!![]});var _0xb9772f=_0xcc8c('0x27');return db[_0xcc8c('0x28')][_0xcc8c('0x24')]({'where':{'type':_0xb9772f,'resourceId':_0x2f7fa6['id']}})[_0xcc8c('0x25')](function(){return _0x28fafc;});})[_0xcc8c('0x25')](function(){_0x9cf56c[_0xcc8c('0x18')](0xcc)[_0xcc8c('0x19')]();});}};}function handleEntityNotFound(_0x2fde63,_0xb3d33b){return function(_0x16b0a5){if(!_0x16b0a5){_0x2fde63[_0xcc8c('0x29')](0x194);}return _0x16b0a5;};}function handleError(_0x2e00b3,_0x54fb37){_0x54fb37=_0x54fb37||0x1f4;return function(_0xbdc42a){logger[_0xcc8c('0x2a')](_0xbdc42a[_0xcc8c('0x2b')]);if(_0xbdc42a[_0xcc8c('0x2c')]){delete _0xbdc42a[_0xcc8c('0x2c')];}_0x2e00b3[_0xcc8c('0x18')](_0x54fb37)[_0xcc8c('0x2d')](_0xbdc42a);};}exports['index']=function(_0x120da2,_0x79aa8f){var _0x4af816={},_0x243d33={},_0x154ec7={'count':0x0,'rows':[]};var _0x39d11d=db[_0xcc8c('0x2e')][_0xcc8c('0x2f')];_0x243d33['model']=_['keys'](_0x39d11d);_0x243d33[_0xcc8c('0x30')]=_[_0xcc8c('0x31')](_0x120da2[_0xcc8c('0x30')]);_0x243d33['filters']=_[_0xcc8c('0x32')](_0x243d33[_0xcc8c('0x33')],_0x243d33[_0xcc8c('0x30')]);_0x4af816[_0xcc8c('0x34')]=_[_0xcc8c('0x32')](_0x243d33['model'],qs['fields'](_0x120da2['query'][_0xcc8c('0x35')]));_0x4af816[_0xcc8c('0x34')]=_0x4af816[_0xcc8c('0x34')][_0xcc8c('0x36')]?_0x4af816[_0xcc8c('0x34')]:_0x243d33[_0xcc8c('0x33')];if(!_0x120da2[_0xcc8c('0x30')][_0xcc8c('0x37')](_0xcc8c('0x38'))){_0x4af816[_0xcc8c('0x1d')]=qs['limit'](_0x120da2[_0xcc8c('0x30')]['limit']);_0x4af816['offset']=qs[_0xcc8c('0x1c')](_0x120da2[_0xcc8c('0x30')]['offset']);}_0x4af816[_0xcc8c('0x39')]=qs[_0xcc8c('0x3a')](_0x120da2[_0xcc8c('0x30')][_0xcc8c('0x3a')]);_0x4af816['where']=qs['filters'](_['pick'](_0x120da2[_0xcc8c('0x30')],_0x243d33[_0xcc8c('0x3b')]));if(_0x120da2[_0xcc8c('0x30')]['filter']){_0x4af816['where']=_['merge'](_0x4af816[_0xcc8c('0x3c')],{'$or':_[_0xcc8c('0x3d')](_0x39d11d,function(_0x487d9f){if(_0x487d9f[_0xcc8c('0x3e')][_0xcc8c('0x3f')]!==_0xcc8c('0x40')){var _0x1c7c3f={};_0x1c7c3f[_0x487d9f[_0xcc8c('0x41')]]={'$like':'%'+_0x120da2[_0xcc8c('0x30')][_0xcc8c('0x42')]+'%'};return _0x1c7c3f;}})});}_0x4af816=_['merge']({},_0x4af816,_0x120da2[_0xcc8c('0x43')]);var _0x161964={'where':_0x4af816[_0xcc8c('0x3c')]};return db[_0xcc8c('0x2e')]['count'](_0x161964)[_0xcc8c('0x25')](function(_0xf961db){_0x154ec7[_0xcc8c('0x1b')]=_0xf961db;if(_0x120da2['query']['includeAll']){_0x4af816['include']=[{'all':!![]}];}return db['SquareOdbc'][_0xcc8c('0x44')](_0x4af816);})[_0xcc8c('0x25')](function(_0x4336e8){_0x154ec7[_0xcc8c('0x45')]=_0x4336e8;return _0x154ec7;})[_0xcc8c('0x25')](respondWithFilteredResult(_0x79aa8f,_0x4af816))[_0xcc8c('0x46')](handleError(_0x79aa8f,null));};exports[_0xcc8c('0x47')]=function(_0x23c30c,_0xef7e8e){var _0x2b9c7d={'raw':!![],'where':{'id':_0x23c30c[_0xcc8c('0x48')]['id']}},_0x3e730e={};_0x3e730e[_0xcc8c('0x33')]=_['keys'](db[_0xcc8c('0x2e')][_0xcc8c('0x2f')]);_0x3e730e[_0xcc8c('0x30')]=_[_0xcc8c('0x31')](_0x23c30c['query']);_0x3e730e[_0xcc8c('0x3b')]=_[_0xcc8c('0x32')](_0x3e730e[_0xcc8c('0x33')],_0x3e730e['query']);_0x2b9c7d[_0xcc8c('0x34')]=_[_0xcc8c('0x32')](_0x3e730e[_0xcc8c('0x33')],qs[_0xcc8c('0x35')](_0x23c30c['query'][_0xcc8c('0x35')]));_0x2b9c7d[_0xcc8c('0x34')]=_0x2b9c7d['attributes'][_0xcc8c('0x36')]?_0x2b9c7d['attributes']:_0x3e730e[_0xcc8c('0x33')];if(_0x23c30c[_0xcc8c('0x30')][_0xcc8c('0x49')]){_0x2b9c7d[_0xcc8c('0x4a')]=[{'all':!![]}];}_0x2b9c7d=_[_0xcc8c('0x4b')]({},_0x2b9c7d,_0x23c30c['options']);return db[_0xcc8c('0x2e')][_0xcc8c('0x4c')](_0x2b9c7d)['then'](handleEntityNotFound(_0xef7e8e,null))[_0xcc8c('0x25')](respondWithResult(_0xef7e8e,null))[_0xcc8c('0x46')](handleError(_0xef7e8e,null));};exports[_0xcc8c('0x4d')]=function(_0xc6f9b7,_0x173b69){return db[_0xcc8c('0x2e')][_0xcc8c('0x4d')](_0xc6f9b7[_0xcc8c('0x4e')],{})[_0xcc8c('0x25')](function(_0x16e685){var _0x588b41=_0xc6f9b7[_0xcc8c('0x4f')]['get']({'plain':!![]});if(!_0x588b41)throw new Error(_0xcc8c('0x50'));if(_0x588b41[_0xcc8c('0x51')]==='user'){var _0xbbaf46=_0x16e685[_0xcc8c('0x26')]({'plain':!![]});var _0x5a1162=_0xcc8c('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x5a1162,'userProfileId':_0x588b41['userProfileId']},'raw':!![]})['then'](function(_0x15a826){if(_0x15a826&&_0x15a826['autoAssociation']===0x0){return db[_0xcc8c('0x28')][_0xcc8c('0x4d')]({'name':_0xbbaf46[_0xcc8c('0x2c')],'resourceId':_0xbbaf46['id'],'type':_0x15a826[_0xcc8c('0x2c')],'sectionId':_0x15a826['id']},{})['then'](function(){return _0x16e685;});}else{return _0x16e685;}})[_0xcc8c('0x46')](function(_0x550334){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x550334);throw _0x550334;});}return _0x16e685;})[_0xcc8c('0x25')](respondWithResult(_0x173b69,0xc9))[_0xcc8c('0x46')](handleError(_0x173b69,null));};exports[_0xcc8c('0x23')]=function(_0x21de5f,_0x2b7071){if(_0x21de5f[_0xcc8c('0x4e')]['id']){delete _0x21de5f[_0xcc8c('0x4e')]['id'];}return db[_0xcc8c('0x2e')]['find']({'where':{'id':_0x21de5f[_0xcc8c('0x48')]['id']}})[_0xcc8c('0x25')](handleEntityNotFound(_0x2b7071,null))[_0xcc8c('0x25')](saveUpdates(_0x21de5f['body'],null))[_0xcc8c('0x25')](respondWithResult(_0x2b7071,null))[_0xcc8c('0x46')](handleError(_0x2b7071,null));};exports['destroy']=function(_0x5c5e70,_0x4119ec){return db['SquareOdbc'][_0xcc8c('0x4c')]({'where':{'id':_0x5c5e70['params']['id']}})[_0xcc8c('0x25')](handleEntityNotFound(_0x4119ec,null))[_0xcc8c('0x25')](removeEntity(_0x4119ec,null))['catch'](handleError(_0x4119ec,null));};exports[_0xcc8c('0x52')]=function(_0x7cde54,_0x5eff54,_0x5bff91){var _0x2d6128;return db[_0xcc8c('0x2e')][_0xcc8c('0x4c')]({'where':{'id':_0x7cde54[_0xcc8c('0x48')]['id']},'attributes':['id',_0xcc8c('0x53')]})[_0xcc8c('0x25')](handleEntityNotFound(_0x5eff54,null))[_0xcc8c('0x25')](function(_0x571cd3){if(_0x571cd3){var _0x314e5b=require(_0xcc8c('0x54'))();_0x314e5b['openSync'](_0x571cd3[_0xcc8c('0x53')]);_0x314e5b[_0xcc8c('0x55')]();return _0x571cd3;}})['then'](respondWithResult(_0x5eff54,null))[_0xcc8c('0x46')](handleError(_0x5eff54,null));};
\ No newline at end of file
+var _0x18df=['end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','name','send','index','SquareOdbc','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','key','field','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','odbc','openSync','dsn','closeSync','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','status'];(function(_0x4c2cf8,_0x1a7904){var _0x2dd086=function(_0x665659){while(--_0x665659){_0x4c2cf8['push'](_0x4c2cf8['shift']());}};_0x2dd086(++_0x1a7904);}(_0x18df,0x143));var _0xf18d=function(_0x2ab891,_0x268680){_0x2ab891=_0x2ab891-0x0;var _0x1cd722=_0x18df[_0x2ab891];return _0x1cd722;};'use strict';var pdf=require(_0xf18d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf18d('0x1'));var zipdir=require(_0xf18d('0x2'));var jsonpatch=require(_0xf18d('0x3'));var rp=require('request-promise');var moment=require(_0xf18d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf18d('0x5'));var util=require(_0xf18d('0x6'));var path=require('path');var sox=require(_0xf18d('0x7'));var csv=require(_0xf18d('0x8'));var ejs=require(_0xf18d('0x9'));var fs=require('fs');var _=require(_0xf18d('0xa'));var squel=require(_0xf18d('0xb'));var crypto=require(_0xf18d('0xc'));var jsforce=require(_0xf18d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf18d('0x8'));var querystring=require(_0xf18d('0xe'));var Papa=require(_0xf18d('0xf'));var authService=require(_0xf18d('0x10'));var hardwareService=require(_0xf18d('0x11'));var Redis=require(_0xf18d('0x12'));var qs=require(_0xf18d('0x13'));var logger=require(_0xf18d('0x14'))('api');var utils=require(_0xf18d('0x15'));var config=require(_0xf18d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x239409,_0x22856c){_0x22856c=_0x22856c||0xcc;return function(_0x4ce193){if(_0x4ce193){return _0x239409[_0xf18d('0x17')](_0x22856c);}return _0x239409[_0xf18d('0x18')](_0x22856c)[_0xf18d('0x19')]();};}function respondWithResult(_0x2f6d4f,_0x589929){_0x589929=_0x589929||0xc8;return function(_0xf610ec){if(_0xf610ec){return _0x2f6d4f[_0xf18d('0x18')](_0x589929)[_0xf18d('0x1a')](_0xf610ec);}};}function respondWithFilteredResult(_0x4414c3,_0x5b1dfc){return function(_0x1045d4){if(_0x1045d4){var _0x213c5e=_0x1045d4[_0xf18d('0x1b')],_0x3f53a9=_0x5b1dfc['offset'],_0xd7eeb3=_0x5b1dfc[_0xf18d('0x1c')]+_0x5b1dfc[_0xf18d('0x1d')],_0x225351;if(_0xd7eeb3>=_0x213c5e){_0xd7eeb3=_0x213c5e;_0x225351=0xc8;}else{_0x225351=0xce;}_0x4414c3[_0xf18d('0x18')](_0x225351);return _0x4414c3[_0xf18d('0x1e')](_0xf18d('0x1f'),_0x3f53a9+'-'+_0xd7eeb3+'/'+_0x213c5e)['json'](_0x1045d4);}return null;};}function patchUpdates(_0x371acd){return function(_0xb578c8){try{jsonpatch[_0xf18d('0x20')](_0xb578c8,_0x371acd,!![]);}catch(_0x2719a2){return BPromise[_0xf18d('0x21')](_0x2719a2);}return _0xb578c8[_0xf18d('0x22')]();};}function saveUpdates(_0x4d2776,_0x4e7ab3){return function(_0x7694f3){if(_0x7694f3){return _0x7694f3[_0xf18d('0x23')](_0x4d2776)[_0xf18d('0x24')](function(_0x4373db){return _0x4373db;});}return null;};}function removeEntity(_0x5555e9,_0x599e6e){return function(_0x2b3424){if(_0x2b3424){return _0x2b3424[_0xf18d('0x25')]()[_0xf18d('0x24')](function(){var _0x2da6b1=_0x2b3424[_0xf18d('0x26')]({'plain':!![]});var _0x56269d='ODBC';return db['UserProfileResource']['destroy']({'where':{'type':_0x56269d,'resourceId':_0x2da6b1['id']}})['then'](function(){return _0x2b3424;});})[_0xf18d('0x24')](function(){_0x5555e9[_0xf18d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd1bad6,_0x71c092){return function(_0x205c17){if(!_0x205c17){_0xd1bad6[_0xf18d('0x17')](0x194);}return _0x205c17;};}function handleError(_0x303ca8,_0x5ea3ec){_0x5ea3ec=_0x5ea3ec||0x1f4;return function(_0x31d9d3){logger[_0xf18d('0x27')](_0x31d9d3[_0xf18d('0x28')]);if(_0x31d9d3[_0xf18d('0x29')]){delete _0x31d9d3['name'];}_0x303ca8['status'](_0x5ea3ec)[_0xf18d('0x2a')](_0x31d9d3);};}exports[_0xf18d('0x2b')]=function(_0x3841eb,_0x7bdff3){var _0x5ad2ef={},_0x2b94ee={},_0x108a4e={'count':0x0,'rows':[]};var _0x1af04a=db[_0xf18d('0x2c')][_0xf18d('0x2d')];_0x2b94ee[_0xf18d('0x2e')]=_[_0xf18d('0x2f')](_0x1af04a);_0x2b94ee[_0xf18d('0x30')]=_[_0xf18d('0x2f')](_0x3841eb['query']);_0x2b94ee[_0xf18d('0x31')]=_[_0xf18d('0x32')](_0x2b94ee[_0xf18d('0x2e')],_0x2b94ee[_0xf18d('0x30')]);_0x5ad2ef[_0xf18d('0x33')]=_['intersection'](_0x2b94ee[_0xf18d('0x2e')],qs[_0xf18d('0x34')](_0x3841eb[_0xf18d('0x30')][_0xf18d('0x34')]));_0x5ad2ef['attributes']=_0x5ad2ef['attributes'][_0xf18d('0x35')]?_0x5ad2ef[_0xf18d('0x33')]:_0x2b94ee[_0xf18d('0x2e')];if(!_0x3841eb['query'][_0xf18d('0x36')](_0xf18d('0x37'))){_0x5ad2ef[_0xf18d('0x1d')]=qs[_0xf18d('0x1d')](_0x3841eb[_0xf18d('0x30')]['limit']);_0x5ad2ef[_0xf18d('0x1c')]=qs[_0xf18d('0x1c')](_0x3841eb[_0xf18d('0x30')][_0xf18d('0x1c')]);}_0x5ad2ef['order']=qs[_0xf18d('0x38')](_0x3841eb['query'][_0xf18d('0x38')]);_0x5ad2ef['where']=qs['filters'](_[_0xf18d('0x39')](_0x3841eb[_0xf18d('0x30')],_0x2b94ee[_0xf18d('0x31')]));if(_0x3841eb[_0xf18d('0x30')]['filter']){_0x5ad2ef[_0xf18d('0x3a')]=_[_0xf18d('0x3b')](_0x5ad2ef[_0xf18d('0x3a')],{'$or':_['map'](_0x1af04a,function(_0x2e721a){if(_0x2e721a['type'][_0xf18d('0x3c')]!=='VIRTUAL'){var _0x3eb4fb={};_0x3eb4fb[_0x2e721a[_0xf18d('0x3d')]]={'$like':'%'+_0x3841eb[_0xf18d('0x30')][_0xf18d('0x3e')]+'%'};return _0x3eb4fb;}})});}_0x5ad2ef=_[_0xf18d('0x3b')]({},_0x5ad2ef,_0x3841eb['options']);var _0x33cf62={'where':_0x5ad2ef[_0xf18d('0x3a')]};return db[_0xf18d('0x2c')][_0xf18d('0x1b')](_0x33cf62)['then'](function(_0xabc3e9){_0x108a4e['count']=_0xabc3e9;if(_0x3841eb['query'][_0xf18d('0x3f')]){_0x5ad2ef[_0xf18d('0x40')]=[{'all':!![]}];}return db[_0xf18d('0x2c')][_0xf18d('0x41')](_0x5ad2ef);})[_0xf18d('0x24')](function(_0x384b47){_0x108a4e[_0xf18d('0x42')]=_0x384b47;return _0x108a4e;})[_0xf18d('0x24')](respondWithFilteredResult(_0x7bdff3,_0x5ad2ef))[_0xf18d('0x43')](handleError(_0x7bdff3,null));};exports[_0xf18d('0x44')]=function(_0x4c285c,_0x375762){var _0x6dbe53={'raw':!![],'where':{'id':_0x4c285c[_0xf18d('0x45')]['id']}},_0x207356={};_0x207356[_0xf18d('0x2e')]=_[_0xf18d('0x2f')](db['SquareOdbc'][_0xf18d('0x2d')]);_0x207356[_0xf18d('0x30')]=_[_0xf18d('0x2f')](_0x4c285c[_0xf18d('0x30')]);_0x207356[_0xf18d('0x31')]=_['intersection'](_0x207356['model'],_0x207356['query']);_0x6dbe53[_0xf18d('0x33')]=_[_0xf18d('0x32')](_0x207356['model'],qs[_0xf18d('0x34')](_0x4c285c[_0xf18d('0x30')]['fields']));_0x6dbe53[_0xf18d('0x33')]=_0x6dbe53[_0xf18d('0x33')][_0xf18d('0x35')]?_0x6dbe53[_0xf18d('0x33')]:_0x207356[_0xf18d('0x2e')];if(_0x4c285c['query'][_0xf18d('0x3f')]){_0x6dbe53[_0xf18d('0x40')]=[{'all':!![]}];}_0x6dbe53=_[_0xf18d('0x3b')]({},_0x6dbe53,_0x4c285c[_0xf18d('0x46')]);return db[_0xf18d('0x2c')][_0xf18d('0x47')](_0x6dbe53)[_0xf18d('0x24')](handleEntityNotFound(_0x375762,null))[_0xf18d('0x24')](respondWithResult(_0x375762,null))[_0xf18d('0x43')](handleError(_0x375762,null));};exports[_0xf18d('0x48')]=function(_0x234db3,_0x5143fd){return db[_0xf18d('0x2c')][_0xf18d('0x48')](_0x234db3[_0xf18d('0x49')],{})[_0xf18d('0x24')](function(_0x1e846d){var _0x453996=_0x234db3[_0xf18d('0x4a')][_0xf18d('0x26')]({'plain':!![]});if(!_0x453996)throw new Error(_0xf18d('0x4b'));if(_0x453996[_0xf18d('0x4c')]===_0xf18d('0x4a')){var _0x5d811e=_0x1e846d[_0xf18d('0x26')]({'plain':!![]});var _0x191cb0=_0xf18d('0x4d');return db[_0xf18d('0x4e')][_0xf18d('0x47')]({'where':{'name':_0x191cb0,'userProfileId':_0x453996[_0xf18d('0x4f')]},'raw':!![]})[_0xf18d('0x24')](function(_0x5b9cc7){if(_0x5b9cc7&&_0x5b9cc7[_0xf18d('0x50')]===0x0){return db['UserProfileResource'][_0xf18d('0x48')]({'name':_0x5d811e['name'],'resourceId':_0x5d811e['id'],'type':_0x5b9cc7[_0xf18d('0x29')],'sectionId':_0x5b9cc7['id']},{})[_0xf18d('0x24')](function(){return _0x1e846d;});}else{return _0x1e846d;}})['catch'](function(_0x3a77cd){logger[_0xf18d('0x27')](_0xf18d('0x51'),_0x3a77cd);throw _0x3a77cd;});}return _0x1e846d;})[_0xf18d('0x24')](respondWithResult(_0x5143fd,0xc9))['catch'](handleError(_0x5143fd,null));};exports[_0xf18d('0x23')]=function(_0x3fda60,_0x52da41){if(_0x3fda60[_0xf18d('0x49')]['id']){delete _0x3fda60[_0xf18d('0x49')]['id'];}return db[_0xf18d('0x2c')]['find']({'where':{'id':_0x3fda60['params']['id']}})[_0xf18d('0x24')](handleEntityNotFound(_0x52da41,null))['then'](saveUpdates(_0x3fda60[_0xf18d('0x49')],null))[_0xf18d('0x24')](respondWithResult(_0x52da41,null))[_0xf18d('0x43')](handleError(_0x52da41,null));};exports[_0xf18d('0x25')]=function(_0xb44266,_0x316dc4){return db[_0xf18d('0x2c')][_0xf18d('0x47')]({'where':{'id':_0xb44266[_0xf18d('0x45')]['id']}})[_0xf18d('0x24')](handleEntityNotFound(_0x316dc4,null))[_0xf18d('0x24')](removeEntity(_0x316dc4,null))[_0xf18d('0x43')](handleError(_0x316dc4,null));};exports[_0xf18d('0x52')]=function(_0x290d69,_0xa7c303,_0x524286){var _0x54be8e;return db[_0xf18d('0x2c')][_0xf18d('0x47')]({'where':{'id':_0x290d69[_0xf18d('0x45')]['id']},'attributes':['id','dsn']})[_0xf18d('0x24')](handleEntityNotFound(_0xa7c303,null))['then'](function(_0x51391b){if(_0x51391b){var _0x434336=require(_0xf18d('0x53'))();_0x434336[_0xf18d('0x54')](_0x51391b[_0xf18d('0x55')]);_0x434336[_0xf18d('0x56')]();return _0x51391b;}})['then'](respondWithResult(_0xa7c303,null))['catch'](handleError(_0xa7c303,null));};
\ No newline at end of file
index c35652a..5698acd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1339=['define','SquareOdbc','square_odbc','../../config/logger','api','moment','bluebird','request-promise','./squareOdbc.attributes','exports'];(function(_0x3a634e,_0x273db2){var _0x2ecddb=function(_0x3a9d2d){while(--_0x3a9d2d){_0x3a634e['push'](_0x3a634e['shift']());}};_0x2ecddb(++_0x273db2);}(_0x1339,0x1ed));var _0x9133=function(_0x1b26bd,_0x5f2e46){_0x1b26bd=_0x1b26bd-0x0;var _0x1a5cf5=_0x1339[_0x1b26bd];return _0x1a5cf5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9133('0x0'))(_0x9133('0x1'));var moment=require(_0x9133('0x2'));var BPromise=require(_0x9133('0x3'));var rp=require(_0x9133('0x4'));var attributes=require(_0x9133('0x5'));module[_0x9133('0x6')]=function(_0x110c51,_0x558345){return _0x110c51[_0x9133('0x7')](_0x9133('0x8'),attributes,{'tableName':_0x9133('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x4483=['square_odbc','lodash','util','../../config/logger','moment','bluebird','request-promise','./squareOdbc.attributes','exports','define','SquareOdbc'];(function(_0x2c4ad3,_0x240316){var _0x5b391e=function(_0x422041){while(--_0x422041){_0x2c4ad3['push'](_0x2c4ad3['shift']());}};_0x5b391e(++_0x240316);}(_0x4483,0x1a3));var _0x3448=function(_0x4e3f51,_0x271183){_0x4e3f51=_0x4e3f51-0x0;var _0xffbbb9=_0x4483[_0x4e3f51];return _0xffbbb9;};'use strict';var _=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var logger=require(_0x3448('0x2'))('api');var moment=require(_0x3448('0x3'));var BPromise=require(_0x3448('0x4'));var rp=require(_0x3448('0x5'));var attributes=require(_0x3448('0x6'));module[_0x3448('0x7')]=function(_0x5f5163,_0xeb5b8){return _0x5f5163[_0x3448('0x8')](_0x3448('0x9'),attributes,{'tableName':_0x3448('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index ab16f31..14b65a4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5c5c=['info','SquareOdbc,\x20%s,\x20%s','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareOdbc','find','options','raw','where','attributes','include','model','map','then','ShowSquareOdbc','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request'];(function(_0x32b370,_0x1112f7){var _0x4d2a19=function(_0x40678b){while(--_0x40678b){_0x32b370['push'](_0x32b370['shift']());}};_0x4d2a19(++_0x1112f7);}(_0x5c5c,0x11e));var _0xc5c5=function(_0xf9a4d4,_0x92518f){_0xf9a4d4=_0xf9a4d4-0x0;var _0x44b4e7=_0x5c5c[_0xf9a4d4];return _0x44b4e7;};'use strict';var _=require(_0xc5c5('0x0'));var util=require('util');var moment=require(_0xc5c5('0x1'));var BPromise=require(_0xc5c5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5c5('0x3'));var db=require(_0xc5c5('0x4'))['db'];var utils=require(_0xc5c5('0x5'));var logger=require(_0xc5c5('0x6'))(_0xc5c5('0x7'));var config=require('../../config/environment');var jayson=require(_0xc5c5('0x8'));var client=jayson['client'][_0xc5c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x674329,_0xd8d781,_0xde5d2d){return new BPromise(function(_0x26cf9c,_0xdfd971){return client[_0xc5c5('0xa')](_0x674329,_0xde5d2d)['then'](function(_0x3bc2c1){logger[_0xc5c5('0xb')](_0xc5c5('0xc'),_0xd8d781,'request\x20sent');logger['debug'](_0xc5c5('0xd'),_0xd8d781,_0xc5c5('0xe'),JSON[_0xc5c5('0xf')](_0x3bc2c1));if(_0x3bc2c1[_0xc5c5('0x10')]){if(_0x3bc2c1[_0xc5c5('0x10')][_0xc5c5('0x11')]===0x1f4){logger['error'](_0xc5c5('0xc'),_0xd8d781,_0x3bc2c1[_0xc5c5('0x10')][_0xc5c5('0x12')]);return _0xdfd971(_0x3bc2c1[_0xc5c5('0x10')]['message']);}logger['error'](_0xc5c5('0xc'),_0xd8d781,_0x3bc2c1[_0xc5c5('0x10')]['message']);return _0x26cf9c(_0x3bc2c1[_0xc5c5('0x10')][_0xc5c5('0x12')]);}else{logger[_0xc5c5('0xb')]('SquareOdbc,\x20%s,\x20%s',_0xd8d781,_0xc5c5('0xe'));_0x26cf9c(_0x3bc2c1[_0xc5c5('0x13')][_0xc5c5('0x12')]);}})[_0xc5c5('0x14')](function(_0x28c058){logger[_0xc5c5('0x10')](_0xc5c5('0xc'),_0xd8d781,_0x28c058);_0xdfd971(_0x28c058);});});}exports['ShowSquareOdbc']=function(_0x342cf3){var _0x6540e7=this;return new Promise(function(_0x48d6e3,_0x2e1296){return db[_0xc5c5('0x15')][_0xc5c5('0x16')]({'raw':_0x342cf3[_0xc5c5('0x17')]?_0x342cf3[_0xc5c5('0x17')][_0xc5c5('0x18')]===undefined?!![]:![]:!![],'where':_0x342cf3[_0xc5c5('0x17')]?_0x342cf3['options'][_0xc5c5('0x19')]||null:null,'attributes':_0x342cf3[_0xc5c5('0x17')]?_0x342cf3[_0xc5c5('0x17')][_0xc5c5('0x1a')]||null:null,'include':_0x342cf3[_0xc5c5('0x17')]?_0x342cf3[_0xc5c5('0x17')][_0xc5c5('0x1b')]?_['map'](_0x342cf3[_0xc5c5('0x17')]['include'],function(_0x1cd535){return{'model':db[_0x1cd535[_0xc5c5('0x1c')]],'as':_0x1cd535['as'],'attributes':_0x1cd535['attributes'],'include':_0x1cd535[_0xc5c5('0x1b')]?_['map'](_0x1cd535[_0xc5c5('0x1b')],function(_0x2059ba){return{'model':db[_0x2059ba['model']],'as':_0x2059ba['as'],'attributes':_0x2059ba['attributes'],'include':_0x2059ba[_0xc5c5('0x1b')]?_[_0xc5c5('0x1d')](_0x2059ba[_0xc5c5('0x1b')],function(_0x72b64e){return{'model':db[_0x72b64e[_0xc5c5('0x1c')]],'as':_0x72b64e['as'],'attributes':_0x72b64e['attributes']};}):[]};}):[]};}):[]:[]})[_0xc5c5('0x1e')](function(_0x4b8a1b){logger[_0xc5c5('0xb')](_0xc5c5('0x1f'),_0x342cf3);logger[_0xc5c5('0x20')](_0xc5c5('0x1f'),_0x342cf3,JSON[_0xc5c5('0xf')](_0x4b8a1b));_0x48d6e3(_0x4b8a1b);})[_0xc5c5('0x14')](function(_0x2bcb4f){logger[_0xc5c5('0x10')](_0xc5c5('0x1f'),_0x2bcb4f[_0xc5c5('0x12')],_0x342cf3);_0x2e1296(_0x6540e7['error'](0x1f4,_0x2bcb4f[_0xc5c5('0x12')]));});});};
\ No newline at end of file
+var _0x2c8b=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','ShowSquareOdbc','SquareOdbc','find','options','raw','attributes','include','model','map','catch'];(function(_0x4857e3,_0x39a1f3){var _0x2651f=function(_0x4c61d7){while(--_0x4c61d7){_0x4857e3['push'](_0x4857e3['shift']());}};_0x2651f(++_0x39a1f3);}(_0x2c8b,0x7c));var _0xb2c8=function(_0x4363c3,_0x1aa389){_0x4363c3=_0x4363c3-0x0;var _0x1fb34e=_0x2c8b[_0x4363c3];return _0x1fb34e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb2c8('0x0'));var BPromise=require('bluebird');var rs=require(_0xb2c8('0x1'));var fs=require('fs');var Redis=require(_0xb2c8('0x2'));var db=require(_0xb2c8('0x3'))['db'];var utils=require(_0xb2c8('0x4'));var logger=require(_0xb2c8('0x5'))(_0xb2c8('0x6'));var config=require('../../config/environment');var jayson=require(_0xb2c8('0x7'));var client=jayson[_0xb2c8('0x8')][_0xb2c8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x287745,_0x427d98,_0x18010e){return new BPromise(function(_0xd07695,_0x3c40aa){return client[_0xb2c8('0xa')](_0x287745,_0x18010e)[_0xb2c8('0xb')](function(_0x3baf16){logger['info'](_0xb2c8('0xc'),_0x427d98,_0xb2c8('0xd'));logger[_0xb2c8('0xe')](_0xb2c8('0xf'),_0x427d98,'request\x20sent',JSON[_0xb2c8('0x10')](_0x3baf16));if(_0x3baf16['error']){if(_0x3baf16[_0xb2c8('0x11')][_0xb2c8('0x12')]===0x1f4){logger[_0xb2c8('0x11')](_0xb2c8('0xc'),_0x427d98,_0x3baf16['error'][_0xb2c8('0x13')]);return _0x3c40aa(_0x3baf16[_0xb2c8('0x11')][_0xb2c8('0x13')]);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x427d98,_0x3baf16['error']['message']);return _0xd07695(_0x3baf16[_0xb2c8('0x11')][_0xb2c8('0x13')]);}else{logger[_0xb2c8('0x14')](_0xb2c8('0xc'),_0x427d98,_0xb2c8('0xd'));_0xd07695(_0x3baf16['result'][_0xb2c8('0x13')]);}})['catch'](function(_0x3b71fc){logger[_0xb2c8('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x427d98,_0x3b71fc);_0x3c40aa(_0x3b71fc);});});}exports[_0xb2c8('0x15')]=function(_0x88971e){var _0x46c9bf=this;return new Promise(function(_0xb1a3fe,_0x36ee89){return db[_0xb2c8('0x16')][_0xb2c8('0x17')]({'raw':_0x88971e['options']?_0x88971e[_0xb2c8('0x18')][_0xb2c8('0x19')]===undefined?!![]:![]:!![],'where':_0x88971e[_0xb2c8('0x18')]?_0x88971e[_0xb2c8('0x18')]['where']||null:null,'attributes':_0x88971e[_0xb2c8('0x18')]?_0x88971e[_0xb2c8('0x18')][_0xb2c8('0x1a')]||null:null,'include':_0x88971e[_0xb2c8('0x18')]?_0x88971e[_0xb2c8('0x18')][_0xb2c8('0x1b')]?_['map'](_0x88971e['options']['include'],function(_0x5741f1){return{'model':db[_0x5741f1[_0xb2c8('0x1c')]],'as':_0x5741f1['as'],'attributes':_0x5741f1[_0xb2c8('0x1a')],'include':_0x5741f1[_0xb2c8('0x1b')]?_[_0xb2c8('0x1d')](_0x5741f1[_0xb2c8('0x1b')],function(_0x463693){return{'model':db[_0x463693[_0xb2c8('0x1c')]],'as':_0x463693['as'],'attributes':_0x463693[_0xb2c8('0x1a')],'include':_0x463693['include']?_[_0xb2c8('0x1d')](_0x463693[_0xb2c8('0x1b')],function(_0x2a4167){return{'model':db[_0x2a4167[_0xb2c8('0x1c')]],'as':_0x2a4167['as'],'attributes':_0x2a4167[_0xb2c8('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2417dc){logger['info'](_0xb2c8('0x15'),_0x88971e);logger[_0xb2c8('0xe')](_0xb2c8('0x15'),_0x88971e,JSON[_0xb2c8('0x10')](_0x2417dc));_0xb1a3fe(_0x2417dc);})[_0xb2c8('0x1e')](function(_0x4bd967){logger[_0xb2c8('0x11')](_0xb2c8('0x15'),_0x4bd967[_0xb2c8('0x13')],_0x88971e);_0x36ee89(_0x46c9bf[_0xb2c8('0x11')](0x1f4,_0x4bd967[_0xb2c8('0x13')]));});});};
\ No newline at end of file
index e123f65..e1ae737 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc866=['put','update','/:id','delete','removeUsers','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','get','show','getUsers','post','/:id/users'];(function(_0x245ea0,_0x2a96b9){var _0x110ad6=function(_0x1824b9){while(--_0x1824b9){_0x245ea0['push'](_0x245ea0['shift']());}};_0x110ad6(++_0x2a96b9);}(_0xc866,0x141));var _0x6c86=function(_0x5d9f24,_0x5e849c){_0x5d9f24=_0x5d9f24-0x0;var _0x216546=_0xc866[_0x5d9f24];return _0x216546;};'use strict';var multer=require(_0x6c86('0x0'));var util=require(_0x6c86('0x1'));var path=require(_0x6c86('0x2'));var timeout=require(_0x6c86('0x3'));var express=require(_0x6c86('0x4'));var router=express['Router']();var auth=require(_0x6c86('0x5'));var interaction=require(_0x6c86('0x6'));var config=require(_0x6c86('0x7'));var controller=require(_0x6c86('0x8'));router['get']('/',auth[_0x6c86('0x9')](),controller['index']);router[_0x6c86('0xa')]('/:id',auth[_0x6c86('0x9')](),controller[_0x6c86('0xb')]);router[_0x6c86('0xa')]('/:id/users',auth[_0x6c86('0x9')](),controller[_0x6c86('0xc')]);router[_0x6c86('0xd')]('/',auth[_0x6c86('0x9')](),controller['create']);router['post'](_0x6c86('0xe'),auth[_0x6c86('0x9')](),controller['addUsers']);router[_0x6c86('0xf')]('/:id',auth[_0x6c86('0x9')](),controller[_0x6c86('0x10')]);router['delete'](_0x6c86('0x11'),auth[_0x6c86('0x9')](),controller['destroy']);router[_0x6c86('0x12')]('/:id/users',auth[_0x6c86('0x9')](),controller[_0x6c86('0x13')]);module[_0x6c86('0x14')]=router;
\ No newline at end of file
+var _0xe3f1=['/:id','show','/:id/users','getUsers','post','create','addUsers','update','delete','destroy','removeUsers','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated'];(function(_0x5afb2b,_0x2979d2){var _0x2ba68f=function(_0x1c66ec){while(--_0x1c66ec){_0x5afb2b['push'](_0x5afb2b['shift']());}};_0x2ba68f(++_0x2979d2);}(_0xe3f1,0x7a));var _0x1e3f=function(_0x6ef814,_0x2c690d){_0x6ef814=_0x6ef814-0x0;var _0x327fc1=_0xe3f1[_0x6ef814];return _0x327fc1;};'use strict';var multer=require(_0x1e3f('0x0'));var util=require('util');var path=require(_0x1e3f('0x1'));var timeout=require(_0x1e3f('0x2'));var express=require(_0x1e3f('0x3'));var router=express[_0x1e3f('0x4')]();var auth=require(_0x1e3f('0x5'));var interaction=require(_0x1e3f('0x6'));var config=require('../../config/environment');var controller=require(_0x1e3f('0x7'));router[_0x1e3f('0x8')]('/',auth[_0x1e3f('0x9')](),controller['index']);router[_0x1e3f('0x8')](_0x1e3f('0xa'),auth[_0x1e3f('0x9')](),controller[_0x1e3f('0xb')]);router['get'](_0x1e3f('0xc'),auth[_0x1e3f('0x9')](),controller[_0x1e3f('0xd')]);router[_0x1e3f('0xe')]('/',auth[_0x1e3f('0x9')](),controller[_0x1e3f('0xf')]);router[_0x1e3f('0xe')](_0x1e3f('0xc'),auth[_0x1e3f('0x9')](),controller[_0x1e3f('0x10')]);router['put'](_0x1e3f('0xa'),auth[_0x1e3f('0x9')](),controller[_0x1e3f('0x11')]);router[_0x1e3f('0x12')](_0x1e3f('0xa'),auth[_0x1e3f('0x9')](),controller[_0x1e3f('0x13')]);router[_0x1e3f('0x12')](_0x1e3f('0xc'),auth[_0x1e3f('0x9')](),controller[_0x1e3f('0x14')]);module[_0x1e3f('0x15')]=router;
\ No newline at end of file
index 8105852..fec7f27 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x714c=['production','exports','STRING','name','TEXT','long','getDataValue','preproduction','toString','utf8','BLOB'];(function(_0x328985,_0x16fe30){var _0x5ee9db=function(_0x2d5f11){while(--_0x2d5f11){_0x328985['push'](_0x328985['shift']());}};_0x5ee9db(++_0x16fe30);}(_0x714c,0x18d));var _0xc714=function(_0x5d72da,_0xb7ce32){_0x5d72da=_0x5d72da-0x0;var _0x43ebe7=_0x714c[_0x5d72da];return _0x43ebe7;};'use strict';var Sequelize=require('sequelize');module[_0xc714('0x0')]={'name':{'type':Sequelize[_0xc714('0x1')],'unique':_0xc714('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xc714('0x1')]},'notes':{'type':Sequelize[_0xc714('0x3')]},'preproduction':{'type':Sequelize['BLOB'](_0xc714('0x4')),'get':function(){if(this[_0xc714('0x5')]('preproduction')){return this['getDataValue'](_0xc714('0x6'))[_0xc714('0x7')](_0xc714('0x8'));}}},'production':{'type':Sequelize[_0xc714('0x9')]('long'),'get':function(){if(this['getDataValue'](_0xc714('0xa'))){return this[_0xc714('0x5')](_0xc714('0xa'))[_0xc714('0x7')](_0xc714('0x8'));}}}};
\ No newline at end of file
+var _0x0619=['sequelize','exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production'];(function(_0xc80336,_0x1dcfd0){var _0x5241c2=function(_0x4709b3){while(--_0x4709b3){_0xc80336['push'](_0xc80336['shift']());}};_0x5241c2(++_0x1dcfd0);}(_0x0619,0x90));var _0x9061=function(_0x2a3113,_0x273436){_0x2a3113=_0x2a3113-0x0;var _0x388809=_0x0619[_0x2a3113];return _0x388809;};'use strict';var Sequelize=require(_0x9061('0x0'));module[_0x9061('0x1')]={'name':{'type':Sequelize[_0x9061('0x2')],'unique':_0x9061('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x9061('0x4')]},'preproduction':{'type':Sequelize[_0x9061('0x5')](_0x9061('0x6')),'get':function(){if(this[_0x9061('0x7')](_0x9061('0x8'))){return this[_0x9061('0x7')](_0x9061('0x8'))[_0x9061('0x9')](_0x9061('0xa'));}}},'production':{'type':Sequelize[_0x9061('0x5')](_0x9061('0x6')),'get':function(){if(this['getDataValue'](_0x9061('0xb'))){return this['getDataValue']('production')[_0x9061('0x9')](_0x9061('0xa'));}}}};
\ No newline at end of file
index d4448aa..fdd1587 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xadb5=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','api','../../config/utils','../../config/environment','redis','socket.io-emitter','./squareProject.socket','status','json','count','offset','set','Content-Range','update','then','destroy','get','SquareProjects','UserProfileResource','sendStatus','name','send','index','SquareProject','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','filters','map','key','VIRTUAL','field','includeAll','findAll','rows','catch','show','params','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','error','body','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','findOne','sort','filter','merge','getUsers','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x2338fa,_0x80579a){var _0x42df9b=function(_0x13fe56){while(--_0x13fe56){_0x2338fa['push'](_0x2338fa['shift']());}};_0x42df9b(++_0x80579a);}(_0xadb5,0xad));var _0x5adb=function(_0x4ed7fe,_0x1041ee){_0x4ed7fe=_0x4ed7fe-0x0;var _0x635ce5=_0xadb5[_0x4ed7fe];return _0x635ce5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5adb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5adb('0x1'));var jsonpatch=require(_0x5adb('0x2'));var rp=require(_0x5adb('0x3'));var moment=require('moment');var BPromise=require(_0x5adb('0x4'));var Mustache=require(_0x5adb('0x5'));var util=require(_0x5adb('0x6'));var path=require('path');var sox=require(_0x5adb('0x7'));var csv=require(_0x5adb('0x8'));var ejs=require(_0x5adb('0x9'));var fs=require('fs');var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x8'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var authService=require(_0x5adb('0x11'));var hardwareService=require(_0x5adb('0x12'));var Redis=require(_0x5adb('0x13'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x5adb('0x14'));var utils=require(_0x5adb('0x15'));var config=require(_0x5adb('0x16'));var db=require('../../mysqldb')['db'];config[_0x5adb('0x17')]=_['defaults'](config[_0x5adb('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x5adb('0x18'))(new Redis(config[_0x5adb('0x17')]));require(_0x5adb('0x19'))['register'](socket);function respondWithStatusCode(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xcc;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['sendStatus'](_0x34af2c);}return _0x2a545b[_0x5adb('0x1a')](_0x34af2c)['end']();};}function respondWithResult(_0x367d82,_0x42a482){_0x42a482=_0x42a482||0xc8;return function(_0x30614e){if(_0x30614e){return _0x367d82[_0x5adb('0x1a')](_0x42a482)[_0x5adb('0x1b')](_0x30614e);}};}function respondWithFilteredResult(_0x39d24d,_0xa29dc){return function(_0x42f4c6){if(_0x42f4c6){var _0xb953a6=_0x42f4c6[_0x5adb('0x1c')],_0x529b65=_0xa29dc['offset'],_0x3fff62=_0xa29dc[_0x5adb('0x1d')]+_0xa29dc['limit'],_0x5de028;if(_0x3fff62>=_0xb953a6){_0x3fff62=_0xb953a6;_0x5de028=0xc8;}else{_0x5de028=0xce;}_0x39d24d['status'](_0x5de028);return _0x39d24d[_0x5adb('0x1e')](_0x5adb('0x1f'),_0x529b65+'-'+_0x3fff62+'/'+_0xb953a6)[_0x5adb('0x1b')](_0x42f4c6);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x20')](_0x3754cc)[_0x5adb('0x21')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x22')]()[_0x5adb('0x21')](function(){var _0x3839fb=_0x4b1957[_0x5adb('0x23')]({'plain':!![]});var _0x49f203=_0x5adb('0x24');return db[_0x5adb('0x25')]['destroy']({'where':{'type':_0x49f203,'resourceId':_0x3839fb['id']}})[_0x5adb('0x21')](function(){return _0x4b1957;});})[_0x5adb('0x21')](function(){_0xfd9bb9[_0x5adb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13ad1d,_0xbe21b1){return function(_0x3a4fca){if(!_0x3a4fca){_0x13ad1d[_0x5adb('0x26')](0x194);}return _0x3a4fca;};}function handleError(_0x36459b,_0x1c06c4){_0x1c06c4=_0x1c06c4||0x1f4;return function(_0x4a5d46){logger['error'](_0x4a5d46['stack']);if(_0x4a5d46[_0x5adb('0x27')]){delete _0x4a5d46[_0x5adb('0x27')];}_0x36459b[_0x5adb('0x1a')](_0x1c06c4)[_0x5adb('0x28')](_0x4a5d46);};}exports[_0x5adb('0x29')]=function(_0x4de310,_0x11ec2a){var _0x34b793={},_0x372da1={},_0x3b1fed={'count':0x0,'rows':[]};var _0x450169=db[_0x5adb('0x2a')][_0x5adb('0x2b')];_0x372da1[_0x5adb('0x2c')]=_[_0x5adb('0x2d')](_0x450169);_0x372da1[_0x5adb('0x2e')]=_['keys'](_0x4de310[_0x5adb('0x2e')]);_0x372da1['filters']=_[_0x5adb('0x2f')](_0x372da1[_0x5adb('0x2c')],_0x372da1['query']);_0x34b793[_0x5adb('0x30')]=_[_0x5adb('0x2f')](_0x372da1[_0x5adb('0x2c')],qs['fields'](_0x4de310[_0x5adb('0x2e')][_0x5adb('0x31')]));_0x34b793['attributes']=_0x34b793['attributes'][_0x5adb('0x32')]?_0x34b793['attributes']:_0x372da1[_0x5adb('0x2c')];if(!_0x4de310[_0x5adb('0x2e')][_0x5adb('0x33')](_0x5adb('0x34'))){_0x34b793[_0x5adb('0x35')]=qs['limit'](_0x4de310[_0x5adb('0x2e')][_0x5adb('0x35')]);_0x34b793[_0x5adb('0x1d')]=qs['offset'](_0x4de310['query'][_0x5adb('0x1d')]);}_0x34b793[_0x5adb('0x36')]=qs['sort'](_0x4de310[_0x5adb('0x2e')]['sort']);_0x34b793[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4de310['query'],_0x372da1[_0x5adb('0x39')]));if(_0x4de310[_0x5adb('0x2e')]['filter']){_0x34b793[_0x5adb('0x37')]=_['merge'](_0x34b793[_0x5adb('0x37')],{'$or':_[_0x5adb('0x3a')](_0x450169,function(_0xd5660c){if(_0xd5660c['type'][_0x5adb('0x3b')]!==_0x5adb('0x3c')){var _0xcdaf8e={};_0xcdaf8e[_0xd5660c[_0x5adb('0x3d')]]={'$like':'%'+_0x4de310[_0x5adb('0x2e')]['filter']+'%'};return _0xcdaf8e;}})});}_0x34b793=_['merge']({},_0x34b793,_0x4de310['options']);var _0x599999={'where':_0x34b793[_0x5adb('0x37')]};return db[_0x5adb('0x2a')][_0x5adb('0x1c')](_0x599999)[_0x5adb('0x21')](function(_0x130e18){_0x3b1fed[_0x5adb('0x1c')]=_0x130e18;if(_0x4de310[_0x5adb('0x2e')][_0x5adb('0x3e')]){_0x34b793['include']=[{'all':!![]}];}return db['SquareProject'][_0x5adb('0x3f')](_0x34b793);})['then'](function(_0xa9f72d){_0x3b1fed[_0x5adb('0x40')]=_0xa9f72d;return _0x3b1fed;})[_0x5adb('0x21')](respondWithFilteredResult(_0x11ec2a,_0x34b793))[_0x5adb('0x41')](handleError(_0x11ec2a,null));};exports[_0x5adb('0x42')]=function(_0x522ee5,_0x43d320){var _0x565b03={'raw':![],'where':{'id':_0x522ee5[_0x5adb('0x43')]['id']}},_0x508690={};_0x508690[_0x5adb('0x2c')]=_['keys'](db[_0x5adb('0x2a')][_0x5adb('0x2b')]);_0x508690[_0x5adb('0x2e')]=_[_0x5adb('0x2d')](_0x522ee5[_0x5adb('0x2e')]);_0x508690[_0x5adb('0x39')]=_[_0x5adb('0x2f')](_0x508690['model'],_0x508690['query']);_0x565b03[_0x5adb('0x30')]=_[_0x5adb('0x2f')](_0x508690[_0x5adb('0x2c')],qs[_0x5adb('0x31')](_0x522ee5['query']['fields']));_0x565b03[_0x5adb('0x30')]=_0x565b03[_0x5adb('0x30')][_0x5adb('0x32')]?_0x565b03[_0x5adb('0x30')]:_0x508690[_0x5adb('0x2c')];if(_0x522ee5['query'][_0x5adb('0x3e')]){_0x565b03[_0x5adb('0x44')]=[{'all':!![]}];}_0x565b03=_['merge']({},_0x565b03,_0x522ee5[_0x5adb('0x45')]);return db[_0x5adb('0x2a')][_0x5adb('0x46')](_0x565b03)[_0x5adb('0x21')](handleEntityNotFound(_0x43d320,null))[_0x5adb('0x21')](respondWithResult(_0x43d320,null))[_0x5adb('0x41')](handleError(_0x43d320,null));};exports[_0x5adb('0x47')]=function(_0x54252,_0x49e1a1){return db[_0x5adb('0x2a')]['create'](_0x54252['body'],{})['then'](function(_0x3cd211){var _0x3fbac8=_0x54252[_0x5adb('0x48')]['get']({'plain':!![]});if(!_0x3fbac8)throw new Error(_0x5adb('0x49'));if(_0x3fbac8['role']===_0x5adb('0x48')){var _0x2c3f21=_0x3cd211[_0x5adb('0x23')]({'plain':!![]});var _0x541537=_0x5adb('0x24');return db['UserProfileSection'][_0x5adb('0x46')]({'where':{'name':_0x541537,'userProfileId':_0x3fbac8[_0x5adb('0x4a')]},'raw':!![]})['then'](function(_0x2402a3){if(_0x2402a3&&_0x2402a3[_0x5adb('0x4b')]===0x0){return db[_0x5adb('0x25')][_0x5adb('0x47')]({'name':_0x2c3f21[_0x5adb('0x27')],'resourceId':_0x2c3f21['id'],'type':_0x2402a3['name'],'sectionId':_0x2402a3['id']},{})[_0x5adb('0x21')](function(){return _0x3cd211;});}else{return _0x3cd211;}})[_0x5adb('0x41')](function(_0x3bcf6f){logger[_0x5adb('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3bcf6f);throw _0x3bcf6f;});}return _0x3cd211;})[_0x5adb('0x21')](respondWithResult(_0x49e1a1,0xc9))[_0x5adb('0x41')](handleError(_0x49e1a1,null));};exports[_0x5adb('0x20')]=function(_0x4d98d0,_0x2b34a8){if(_0x4d98d0[_0x5adb('0x4d')]['id']){delete _0x4d98d0[_0x5adb('0x4d')]['id'];}return db[_0x5adb('0x2a')]['find']({'where':{'id':_0x4d98d0[_0x5adb('0x43')]['id']}})[_0x5adb('0x21')](handleEntityNotFound(_0x2b34a8,null))[_0x5adb('0x21')](saveUpdates(_0x4d98d0[_0x5adb('0x4d')],null))[_0x5adb('0x21')](respondWithResult(_0x2b34a8,null))['catch'](handleError(_0x2b34a8,null));};exports[_0x5adb('0x22')]=function(_0x4b8d28,_0x2b790d){return db['SquareProject'][_0x5adb('0x46')]({'where':{'id':_0x4b8d28[_0x5adb('0x43')]['id']}})[_0x5adb('0x21')](handleEntityNotFound(_0x2b790d,null))[_0x5adb('0x21')](removeEntity(_0x2b790d,null))['catch'](handleError(_0x2b790d,null));};exports[_0x5adb('0x4e')]=function(_0x229ae2,_0x24b1f1,_0x53d262){return db['SquareProject']['find']({'where':{'id':_0x229ae2[_0x5adb('0x43')]['id']}})[_0x5adb('0x21')](handleEntityNotFound(_0x24b1f1,null))[_0x5adb('0x21')](function(_0x12a146){if(_0x12a146){return _0x12a146[_0x5adb('0x4e')](_0x229ae2[_0x5adb('0x4d')][_0x5adb('0x4f')],_[_0x5adb('0x50')](_0x229ae2[_0x5adb('0x4d')],[_0x5adb('0x4f'),'id'])||{});}})[_0x5adb('0x21')](respondWithResult(_0x24b1f1,null))[_0x5adb('0x41')](handleError(_0x24b1f1,null));};exports[_0x5adb('0x51')]=function(_0x511746,_0x49f4c8,_0x3d55c2){var _0x27a8e4;return db[_0x5adb('0x2a')][_0x5adb('0x46')]({'where':{'id':_0x511746['params']['id']}})[_0x5adb('0x21')](handleEntityNotFound(_0x49f4c8,null))[_0x5adb('0x21')](function(_0x5d2d2f){if(_0x5d2d2f){return _0x5d2d2f[_0x5adb('0x51')](_0x511746[_0x5adb('0x2e')][_0x5adb('0x4f')])['then'](function(_0x30d185){if(_[_0x5adb('0x52')](_0x511746[_0x5adb('0x2e')][_0x5adb('0x4f')])){for(var _0x330290=0x0;_0x330290<_0x511746[_0x5adb('0x2e')]['ids'][_0x5adb('0x32')];_0x330290+=0x1){socket[_0x5adb('0x53')](_0x5adb('0x54'),{'UserId':_0x511746['query'][_0x5adb('0x4f')][_0x330290],'SquareProjectId':_0x511746[_0x5adb('0x43')]['id']});}}else{socket[_0x5adb('0x53')]('userSquareProject:remove',{'UserId':_0x511746[_0x5adb('0x2e')]['ids'],'SquareProjectId':_0x511746[_0x5adb('0x43')]['id']});}});}})[_0x5adb('0x21')](respondWithStatusCode(_0x49f4c8,null))[_0x5adb('0x41')](handleError(_0x49f4c8,null));};exports['getUsers']=function(_0x192b1f,_0x3627d1,_0x539814){var _0x12711e={};var _0x432a3e={};var _0x248739;var _0x3fcad5;return db['SquareProject'][_0x5adb('0x55')]({'where':{'id':_0x192b1f[_0x5adb('0x43')]['id']}})[_0x5adb('0x21')](handleEntityNotFound(_0x3627d1,null))[_0x5adb('0x21')](function(_0x5b7556){if(_0x5b7556){_0x248739=_0x5b7556;_0x432a3e['model']=_[_0x5adb('0x2d')](db['User']['rawAttributes']);_0x432a3e['query']=_[_0x5adb('0x2d')](_0x192b1f[_0x5adb('0x2e')]);_0x432a3e['filters']=_[_0x5adb('0x2f')](_0x432a3e[_0x5adb('0x2c')],_0x432a3e[_0x5adb('0x2e')]);_0x12711e[_0x5adb('0x30')]=_[_0x5adb('0x2f')](_0x432a3e[_0x5adb('0x2c')],qs[_0x5adb('0x31')](_0x192b1f[_0x5adb('0x2e')]['fields']));_0x12711e['attributes']=_0x12711e['attributes'][_0x5adb('0x32')]?_0x12711e[_0x5adb('0x30')]:_0x432a3e[_0x5adb('0x2c')];_0x12711e[_0x5adb('0x36')]=qs[_0x5adb('0x56')](_0x192b1f[_0x5adb('0x2e')][_0x5adb('0x56')]);_0x12711e[_0x5adb('0x37')]=qs['filters'](_['pick'](_0x192b1f[_0x5adb('0x2e')],_0x432a3e[_0x5adb('0x39')]));if(_0x192b1f[_0x5adb('0x2e')][_0x5adb('0x57')]){_0x12711e[_0x5adb('0x37')]=_[_0x5adb('0x58')](_0x12711e[_0x5adb('0x37')],{'$or':_[_0x5adb('0x3a')](_0x12711e[_0x5adb('0x30')],function(_0x3b5ecf){var _0x484f3d={};_0x484f3d[_0x3b5ecf]={'$like':'%'+_0x192b1f[_0x5adb('0x2e')][_0x5adb('0x57')]+'%'};return _0x484f3d;})});}_0x12711e=_[_0x5adb('0x58')]({},_0x12711e,_0x192b1f['options']);return _0x248739[_0x5adb('0x59')](_0x12711e);}})[_0x5adb('0x21')](function(_0x4f7bd0){if(_0x4f7bd0){_0x3fcad5=_0x4f7bd0[_0x5adb('0x32')];if(!_0x192b1f['query'][_0x5adb('0x33')](_0x5adb('0x34'))){_0x12711e['limit']=qs[_0x5adb('0x35')](_0x192b1f[_0x5adb('0x2e')][_0x5adb('0x35')]);_0x12711e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x192b1f[_0x5adb('0x2e')][_0x5adb('0x1d')]);}return _0x248739[_0x5adb('0x59')](_0x12711e);}})['then'](function(_0x3786b4){if(_0x3786b4){return _0x3786b4?{'count':_0x3fcad5,'rows':_0x3786b4}:null;}})[_0x5adb('0x21')](respondWithResult(_0x3627d1,null))[_0x5adb('0x41')](handleError(_0x3627d1,null));};
\ No newline at end of file
+var _0x1261=['reject','save','update','then','get','SquareProjects','UserProfileResource','destroy','error','name','index','SquareProject','rawAttributes','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','map','key','VIRTUAL','field','filter','includeAll','include','findAll','catch','options','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','count','limit','set','Content-Range'];(function(_0x41a61d,_0x498928){var _0x1265fa=function(_0x27a0e5){while(--_0x27a0e5){_0x41a61d['push'](_0x41a61d['shift']());}};_0x1265fa(++_0x498928);}(_0x1261,0x144));var _0x1126=function(_0x509771,_0x3b6a5d){_0x509771=_0x509771-0x0;var _0x1ed8fe=_0x1261[_0x509771];return _0x1ed8fe;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1126('0x0'));var rimraf=require(_0x1126('0x1'));var zipdir=require(_0x1126('0x2'));var jsonpatch=require(_0x1126('0x3'));var rp=require(_0x1126('0x4'));var moment=require(_0x1126('0x5'));var BPromise=require(_0x1126('0x6'));var Mustache=require(_0x1126('0x7'));var util=require(_0x1126('0x8'));var path=require(_0x1126('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1126('0xa'));var fs=require('fs');var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var authService=require(_0x1126('0x11'));var hardwareService=require(_0x1126('0x12'));var Redis=require(_0x1126('0x13'));var qs=require('../../components/parsers/qs');var logger=require(_0x1126('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x1126('0x15'));var db=require('../../mysqldb')['db'];config[_0x1126('0x16')]=_[_0x1126('0x17')](config[_0x1126('0x16')],{'host':_0x1126('0x18'),'port':0x18eb});var socket=require(_0x1126('0x19'))(new Redis(config[_0x1126('0x16')]));require(_0x1126('0x1a'))[_0x1126('0x1b')](socket);function respondWithStatusCode(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xcc;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x1c')](_0x53a8f0);}return _0x43850b[_0x1126('0x1d')](_0x53a8f0)[_0x1126('0x1e')]();};}function respondWithResult(_0x4be0c6,_0x45149c){_0x45149c=_0x45149c||0xc8;return function(_0x4794a7){if(_0x4794a7){return _0x4be0c6[_0x1126('0x1d')](_0x45149c)[_0x1126('0x1f')](_0x4794a7);}};}function respondWithFilteredResult(_0x257b5f,_0x4e1c97){return function(_0x245cd7){if(_0x245cd7){var _0x1695f6=_0x245cd7[_0x1126('0x20')],_0x4a7b49=_0x4e1c97['offset'],_0x4d2b38=_0x4e1c97['offset']+_0x4e1c97[_0x1126('0x21')],_0x22ae0b;if(_0x4d2b38>=_0x1695f6){_0x4d2b38=_0x1695f6;_0x22ae0b=0xc8;}else{_0x22ae0b=0xce;}_0x257b5f['status'](_0x22ae0b);return _0x257b5f[_0x1126('0x22')](_0x1126('0x23'),_0x4a7b49+'-'+_0x4d2b38+'/'+_0x1695f6)[_0x1126('0x1f')](_0x245cd7);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x24')](_0x56efeb);}return _0x2a08ba[_0x1126('0x25')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x26')](_0x25b24b)[_0x1126('0x27')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x27')](function(){var _0x15bcc3=_0x529dd9[_0x1126('0x28')]({'plain':!![]});var _0x34bcf1=_0x1126('0x29');return db[_0x1126('0x2a')][_0x1126('0x2b')]({'where':{'type':_0x34bcf1,'resourceId':_0x15bcc3['id']}})[_0x1126('0x27')](function(){return _0x529dd9;});})['then'](function(){_0x2175fa[_0x1126('0x1d')](0xcc)[_0x1126('0x1e')]();});}};}function handleEntityNotFound(_0xa293f4,_0x5ddf63){return function(_0x541bc9){if(!_0x541bc9){_0xa293f4[_0x1126('0x1c')](0x194);}return _0x541bc9;};}function handleError(_0x39bf0e,_0x55e195){_0x55e195=_0x55e195||0x1f4;return function(_0x2fb797){logger[_0x1126('0x2c')](_0x2fb797['stack']);if(_0x2fb797[_0x1126('0x2d')]){delete _0x2fb797['name'];}_0x39bf0e[_0x1126('0x1d')](_0x55e195)['send'](_0x2fb797);};}exports[_0x1126('0x2e')]=function(_0x583ce6,_0x378f4d){var _0x5f2611={},_0x5252e0={},_0x4a53ab={'count':0x0,'rows':[]};var _0x17646e=db[_0x1126('0x2f')][_0x1126('0x30')];_0x5252e0['model']=_[_0x1126('0x31')](_0x17646e);_0x5252e0[_0x1126('0x32')]=_['keys'](_0x583ce6[_0x1126('0x32')]);_0x5252e0[_0x1126('0x33')]=_[_0x1126('0x34')](_0x5252e0[_0x1126('0x35')],_0x5252e0['query']);_0x5f2611['attributes']=_[_0x1126('0x34')](_0x5252e0[_0x1126('0x35')],qs[_0x1126('0x36')](_0x583ce6[_0x1126('0x32')]['fields']));_0x5f2611[_0x1126('0x37')]=_0x5f2611[_0x1126('0x37')][_0x1126('0x38')]?_0x5f2611[_0x1126('0x37')]:_0x5252e0[_0x1126('0x35')];if(!_0x583ce6['query'][_0x1126('0x39')](_0x1126('0x3a'))){_0x5f2611[_0x1126('0x21')]=qs[_0x1126('0x21')](_0x583ce6['query']['limit']);_0x5f2611[_0x1126('0x3b')]=qs[_0x1126('0x3b')](_0x583ce6['query'][_0x1126('0x3b')]);}_0x5f2611[_0x1126('0x3c')]=qs[_0x1126('0x3d')](_0x583ce6['query']['sort']);_0x5f2611[_0x1126('0x3e')]=qs[_0x1126('0x33')](_[_0x1126('0x3f')](_0x583ce6[_0x1126('0x32')],_0x5252e0['filters']));if(_0x583ce6[_0x1126('0x32')]['filter']){_0x5f2611[_0x1126('0x3e')]=_[_0x1126('0x40')](_0x5f2611[_0x1126('0x3e')],{'$or':_[_0x1126('0x41')](_0x17646e,function(_0x57e5d2){if(_0x57e5d2['type'][_0x1126('0x42')]!==_0x1126('0x43')){var _0x2939a9={};_0x2939a9[_0x57e5d2[_0x1126('0x44')]]={'$like':'%'+_0x583ce6[_0x1126('0x32')][_0x1126('0x45')]+'%'};return _0x2939a9;}})});}_0x5f2611=_[_0x1126('0x40')]({},_0x5f2611,_0x583ce6['options']);var _0x1c8d8a={'where':_0x5f2611[_0x1126('0x3e')]};return db[_0x1126('0x2f')][_0x1126('0x20')](_0x1c8d8a)[_0x1126('0x27')](function(_0x518de1){_0x4a53ab['count']=_0x518de1;if(_0x583ce6[_0x1126('0x32')][_0x1126('0x46')]){_0x5f2611[_0x1126('0x47')]=[{'all':!![]}];}return db[_0x1126('0x2f')][_0x1126('0x48')](_0x5f2611);})[_0x1126('0x27')](function(_0x5489c0){_0x4a53ab['rows']=_0x5489c0;return _0x4a53ab;})['then'](respondWithFilteredResult(_0x378f4d,_0x5f2611))[_0x1126('0x49')](handleError(_0x378f4d,null));};exports['show']=function(_0xf84005,_0x462da8){var _0x3584a3={'raw':![],'where':{'id':_0xf84005['params']['id']}},_0x1a3584={};_0x1a3584['model']=_[_0x1126('0x31')](db[_0x1126('0x2f')][_0x1126('0x30')]);_0x1a3584['query']=_[_0x1126('0x31')](_0xf84005['query']);_0x1a3584[_0x1126('0x33')]=_['intersection'](_0x1a3584[_0x1126('0x35')],_0x1a3584[_0x1126('0x32')]);_0x3584a3[_0x1126('0x37')]=_['intersection'](_0x1a3584[_0x1126('0x35')],qs[_0x1126('0x36')](_0xf84005[_0x1126('0x32')]['fields']));_0x3584a3['attributes']=_0x3584a3['attributes'][_0x1126('0x38')]?_0x3584a3['attributes']:_0x1a3584[_0x1126('0x35')];if(_0xf84005['query'][_0x1126('0x46')]){_0x3584a3[_0x1126('0x47')]=[{'all':!![]}];}_0x3584a3=_[_0x1126('0x40')]({},_0x3584a3,_0xf84005[_0x1126('0x4a')]);return db[_0x1126('0x2f')]['find'](_0x3584a3)[_0x1126('0x27')](handleEntityNotFound(_0x462da8,null))[_0x1126('0x27')](respondWithResult(_0x462da8,null))['catch'](handleError(_0x462da8,null));};exports[_0x1126('0x4b')]=function(_0x13dc39,_0x575f79){return db[_0x1126('0x2f')][_0x1126('0x4b')](_0x13dc39['body'],{})[_0x1126('0x27')](function(_0xbdde58){var _0x213a76=_0x13dc39['user'][_0x1126('0x28')]({'plain':!![]});if(!_0x213a76)throw new Error(_0x1126('0x4c'));if(_0x213a76[_0x1126('0x4d')]===_0x1126('0x4e')){var _0x224456=_0xbdde58[_0x1126('0x28')]({'plain':!![]});var _0x28f5ee=_0x1126('0x29');return db['UserProfileSection'][_0x1126('0x4f')]({'where':{'name':_0x28f5ee,'userProfileId':_0x213a76['userProfileId']},'raw':!![]})[_0x1126('0x27')](function(_0x2ad118){if(_0x2ad118&&_0x2ad118['autoAssociation']===0x0){return db['UserProfileResource'][_0x1126('0x4b')]({'name':_0x224456[_0x1126('0x2d')],'resourceId':_0x224456['id'],'type':_0x2ad118[_0x1126('0x2d')],'sectionId':_0x2ad118['id']},{})['then'](function(){return _0xbdde58;});}else{return _0xbdde58;}})[_0x1126('0x49')](function(_0x3506d7){logger[_0x1126('0x2c')](_0x1126('0x50'),_0x3506d7);throw _0x3506d7;});}return _0xbdde58;})['then'](respondWithResult(_0x575f79,0xc9))[_0x1126('0x49')](handleError(_0x575f79,null));};exports[_0x1126('0x26')]=function(_0x5c36b9,_0x4bcc08){if(_0x5c36b9['body']['id']){delete _0x5c36b9['body']['id'];}return db[_0x1126('0x2f')][_0x1126('0x4f')]({'where':{'id':_0x5c36b9['params']['id']}})[_0x1126('0x27')](handleEntityNotFound(_0x4bcc08,null))[_0x1126('0x27')](saveUpdates(_0x5c36b9[_0x1126('0x51')],null))[_0x1126('0x27')](respondWithResult(_0x4bcc08,null))[_0x1126('0x49')](handleError(_0x4bcc08,null));};exports['destroy']=function(_0x41cbb6,_0x267592){return db['SquareProject'][_0x1126('0x4f')]({'where':{'id':_0x41cbb6[_0x1126('0x52')]['id']}})[_0x1126('0x27')](handleEntityNotFound(_0x267592,null))[_0x1126('0x27')](removeEntity(_0x267592,null))[_0x1126('0x49')](handleError(_0x267592,null));};exports['addUsers']=function(_0x673c09,_0x49aeaa,_0x868b2c){return db[_0x1126('0x2f')][_0x1126('0x4f')]({'where':{'id':_0x673c09['params']['id']}})[_0x1126('0x27')](handleEntityNotFound(_0x49aeaa,null))[_0x1126('0x27')](function(_0x5763b4){if(_0x5763b4){return _0x5763b4[_0x1126('0x53')](_0x673c09[_0x1126('0x51')][_0x1126('0x54')],_['omit'](_0x673c09[_0x1126('0x51')],[_0x1126('0x54'),'id'])||{});}})[_0x1126('0x27')](respondWithResult(_0x49aeaa,null))[_0x1126('0x49')](handleError(_0x49aeaa,null));};exports[_0x1126('0x55')]=function(_0x26949c,_0x30c848,_0x114be2){var _0x47e53d;return db[_0x1126('0x2f')][_0x1126('0x4f')]({'where':{'id':_0x26949c[_0x1126('0x52')]['id']}})[_0x1126('0x27')](handleEntityNotFound(_0x30c848,null))[_0x1126('0x27')](function(_0x4f5772){if(_0x4f5772){return _0x4f5772[_0x1126('0x55')](_0x26949c[_0x1126('0x32')]['ids'])[_0x1126('0x27')](function(_0x5246aa){if(_[_0x1126('0x56')](_0x26949c[_0x1126('0x32')]['ids'])){for(var _0x3062d6=0x0;_0x3062d6<_0x26949c[_0x1126('0x32')][_0x1126('0x54')]['length'];_0x3062d6+=0x1){socket[_0x1126('0x57')]('userSquareProject:remove',{'UserId':_0x26949c['query'][_0x1126('0x54')][_0x3062d6],'SquareProjectId':_0x26949c[_0x1126('0x52')]['id']});}}else{socket[_0x1126('0x57')](_0x1126('0x58'),{'UserId':_0x26949c[_0x1126('0x32')][_0x1126('0x54')],'SquareProjectId':_0x26949c[_0x1126('0x52')]['id']});}});}})['then'](respondWithStatusCode(_0x30c848,null))[_0x1126('0x49')](handleError(_0x30c848,null));};exports[_0x1126('0x59')]=function(_0x116867,_0xc39c36,_0x3f87aa){var _0x3cd788={};var _0x5a0804={};var _0x5b17d6;var _0x16a343;return db[_0x1126('0x2f')]['findOne']({'where':{'id':_0x116867['params']['id']}})['then'](handleEntityNotFound(_0xc39c36,null))['then'](function(_0x964a2){if(_0x964a2){_0x5b17d6=_0x964a2;_0x5a0804[_0x1126('0x35')]=_[_0x1126('0x31')](db['User'][_0x1126('0x30')]);_0x5a0804[_0x1126('0x32')]=_[_0x1126('0x31')](_0x116867[_0x1126('0x32')]);_0x5a0804[_0x1126('0x33')]=_[_0x1126('0x34')](_0x5a0804[_0x1126('0x35')],_0x5a0804['query']);_0x3cd788[_0x1126('0x37')]=_[_0x1126('0x34')](_0x5a0804[_0x1126('0x35')],qs[_0x1126('0x36')](_0x116867[_0x1126('0x32')]['fields']));_0x3cd788['attributes']=_0x3cd788[_0x1126('0x37')][_0x1126('0x38')]?_0x3cd788['attributes']:_0x5a0804[_0x1126('0x35')];_0x3cd788[_0x1126('0x3c')]=qs[_0x1126('0x3d')](_0x116867[_0x1126('0x32')][_0x1126('0x3d')]);_0x3cd788[_0x1126('0x3e')]=qs[_0x1126('0x33')](_[_0x1126('0x3f')](_0x116867[_0x1126('0x32')],_0x5a0804[_0x1126('0x33')]));if(_0x116867[_0x1126('0x32')][_0x1126('0x45')]){_0x3cd788[_0x1126('0x3e')]=_['merge'](_0x3cd788[_0x1126('0x3e')],{'$or':_[_0x1126('0x41')](_0x3cd788[_0x1126('0x37')],function(_0x53ea9a){var _0x484881={};_0x484881[_0x53ea9a]={'$like':'%'+_0x116867[_0x1126('0x32')][_0x1126('0x45')]+'%'};return _0x484881;})});}_0x3cd788=_[_0x1126('0x40')]({},_0x3cd788,_0x116867[_0x1126('0x4a')]);return _0x5b17d6['getUsers'](_0x3cd788);}})['then'](function(_0x48621e){if(_0x48621e){_0x16a343=_0x48621e[_0x1126('0x38')];if(!_0x116867[_0x1126('0x32')][_0x1126('0x39')](_0x1126('0x3a'))){_0x3cd788['limit']=qs[_0x1126('0x21')](_0x116867['query'][_0x1126('0x21')]);_0x3cd788[_0x1126('0x3b')]=qs[_0x1126('0x3b')](_0x116867[_0x1126('0x32')][_0x1126('0x3b')]);}return _0x5b17d6[_0x1126('0x59')](_0x3cd788);}})[_0x1126('0x27')](function(_0x5f5a36){if(_0x5f5a36){return _0x5f5a36?{'count':_0x16a343,'rows':_0x5f5a36}:null;}})[_0x1126('0x27')](respondWithResult(_0xc39c36,null))['catch'](handleError(_0xc39c36,null));};
\ No newline at end of file
index 6d44cf9..2499e5e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x662a=['exports','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x48d8b5,_0x30639c){var _0x98f767=function(_0x596a32){while(--_0x596a32){_0x48d8b5['push'](_0x48d8b5['shift']());}};_0x98f767(++_0x30639c);}(_0x662a,0x1cf));var _0xa662=function(_0x10fcde,_0x4d806e){_0x10fcde=_0x10fcde-0x0;var _0x14eb61=_0x662a[_0x10fcde];return _0x14eb61;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa662('0x0'),'afterUpdate':_0xa662('0x1'),'afterDestroy':_0xa662('0x2')};function emitEvent(_0x33506d){return function(_0x1a0bc3,_0x1606cc,_0x46bc6b){SquareProjectEvents[_0xa662('0x3')](_0x33506d+':'+_0x1a0bc3['id'],_0x1a0bc3);SquareProjectEvents[_0xa662('0x3')](_0x33506d,_0x1a0bc3);_0x46bc6b(null);};}for(var e in events){if(events[_0xa662('0x4')](e)){var event=events[e];SquareProject[_0xa662('0x5')](e,emitEvent(event));}}module[_0xa662('0x6')]=SquareProjectEvents;
\ No newline at end of file
+var _0x9862=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x226aeb,_0x97312d){var _0x25479f=function(_0x1cc216){while(--_0x1cc216){_0x226aeb['push'](_0x226aeb['shift']());}};_0x25479f(++_0x97312d);}(_0x9862,0x14b));var _0x2986=function(_0x1d62e5,_0x36b741){_0x1d62e5=_0x1d62e5-0x0;var _0x93e0b5=_0x9862[_0x1d62e5];return _0x93e0b5;};'use strict';var EventEmitter=require(_0x2986('0x0'));var SquareProject=require(_0x2986('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x2986('0x2')](0x0);var events={'afterCreate':_0x2986('0x3'),'afterUpdate':_0x2986('0x4'),'afterDestroy':_0x2986('0x5')};function emitEvent(_0x470c09){return function(_0x3f3727,_0x4cf2fd,_0x1a7deb){SquareProjectEvents[_0x2986('0x6')](_0x470c09+':'+_0x3f3727['id'],_0x3f3727);SquareProjectEvents[_0x2986('0x6')](_0x470c09,_0x3f3727);_0x1a7deb(null);};}for(var e in events){if(events[_0x2986('0x7')](e)){var event=events[e];SquareProject[_0x2986('0x8')](e,emitEvent(event));}}module[_0x2986('0x9')]=SquareProjectEvents;
\ No newline at end of file
index 88a8e1a..60210c5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeb74=['exports','lodash','../../config/logger','moment','bluebird','request-promise','./squareProject.attributes'];(function(_0x1c6089,_0x3816e2){var _0x4d97c1=function(_0x3e631b){while(--_0x3e631b){_0x1c6089['push'](_0x1c6089['shift']());}};_0x4d97c1(++_0x3816e2);}(_0xeb74,0x1dd));var _0x4eb7=function(_0x2812fe,_0x29235f){_0x2812fe=_0x2812fe-0x0;var _0x19200f=_0xeb74[_0x2812fe];return _0x19200f;};'use strict';var _=require(_0x4eb7('0x0'));var util=require('util');var logger=require(_0x4eb7('0x1'))('api');var moment=require(_0x4eb7('0x2'));var BPromise=require(_0x4eb7('0x3'));var rp=require(_0x4eb7('0x4'));var attributes=require(_0x4eb7('0x5'));module[_0x4eb7('0x6')]=function(_0x34ffb0,_0x4d932f){return _0x34ffb0['define']('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x3c8e=['define','util','../../config/logger','api','moment','exports'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x3c8e,0xa3));var _0xe3c8=function(_0x41e34d,_0x3ac94d){_0x41e34d=_0x41e34d-0x0;var _0x268f04=_0x3c8e[_0x41e34d];return _0x268f04;};'use strict';var _=require('lodash');var util=require(_0xe3c8('0x0'));var logger=require(_0xe3c8('0x1'))(_0xe3c8('0x2'));var moment=require(_0xe3c8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./squareProject.attributes');module[_0xe3c8('0x4')]=function(_0x103041,_0x505057){return _0x103041[_0xe3c8('0x5')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index a601100..0b55b3f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['catch','ShowSquareProject','find','options','raw','where','attributes','include','map','model','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x1861d4,_0x295ec8){var _0x4df574=function(_0x3838bf){while(--_0x3838bf){_0x1861d4['push'](_0x1861d4['shift']());}};_0x4df574(++_0x295ec8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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});config[_0x0a9e('0xa')]=_[_0x0a9e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xc'))(new Redis(config['redis']));require('./squareProject.socket')[_0x0a9e('0xd')](socket);function respondWithRpcPromise(_0xf81284,_0x307b3e,_0x3ab53f){return new BPromise(function(_0xfeb75b,_0xbd1168){return client['request'](_0xf81284,_0x3ab53f)['then'](function(_0x527cdd){logger['info'](_0x0a9e('0xe'),_0x307b3e,_0x0a9e('0xf'));logger[_0x0a9e('0x10')](_0x0a9e('0x11'),_0x307b3e,_0x0a9e('0xf'),JSON[_0x0a9e('0x12')](_0x527cdd));if(_0x527cdd['error']){if(_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x14')]===0x1f4){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x15')]);return _0xbd1168(_0x527cdd['error'][_0x0a9e('0x15')]);}logger['error'](_0x0a9e('0xe'),_0x307b3e,_0x527cdd['error'][_0x0a9e('0x15')]);return _0xfeb75b(_0x527cdd[_0x0a9e('0x13')]['message']);}else{logger[_0x0a9e('0x16')]('SquareProject,\x20%s,\x20%s',_0x307b3e,_0x0a9e('0xf'));_0xfeb75b(_0x527cdd[_0x0a9e('0x17')][_0x0a9e('0x15')]);}})[_0x0a9e('0x18')](function(_0x31b1ca){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x31b1ca);_0xbd1168(_0x31b1ca);});});}exports[_0x0a9e('0x19')]=function(_0x1314ae){var _0x112016=this;return new Promise(function(_0x1c696a,_0x105080){return db['SquareProject'][_0x0a9e('0x1a')]({'raw':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae['options'][_0x0a9e('0x1c')]===undefined?!![]:![]:!![],'where':_0x1314ae['options']?_0x1314ae['options'][_0x0a9e('0x1d')]||null:null,'attributes':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1e')]||null:null,'include':_0x1314ae['options']?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1f')],function(_0x42ac8f){return{'model':db[_0x42ac8f[_0x0a9e('0x21')]],'as':_0x42ac8f['as'],'attributes':_0x42ac8f['attributes'],'include':_0x42ac8f['include']?_[_0x0a9e('0x20')](_0x42ac8f[_0x0a9e('0x1f')],function(_0x40c424){return{'model':db[_0x40c424[_0x0a9e('0x21')]],'as':_0x40c424['as'],'attributes':_0x40c424['attributes'],'include':_0x40c424[_0x0a9e('0x1f')]?_['map'](_0x40c424[_0x0a9e('0x1f')],function(_0x5bfb33){return{'model':db[_0x5bfb33[_0x0a9e('0x21')]],'as':_0x5bfb33['as'],'attributes':_0x5bfb33[_0x0a9e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x22')](function(_0x14433c){logger[_0x0a9e('0x16')](_0x0a9e('0x19'),_0x1314ae);logger[_0x0a9e('0x10')](_0x0a9e('0x19'),_0x1314ae,JSON['stringify'](_0x14433c));_0x1c696a(_0x14433c);})[_0x0a9e('0x18')](function(_0x468813){logger[_0x0a9e('0x13')](_0x0a9e('0x19'),_0x468813['message'],_0x1314ae);_0x105080(_0x112016[_0x0a9e('0x13')](0x1f4,_0x468813[_0x0a9e('0x15')]));});});};
\ No newline at end of file
+var _0xa9e0=['catch','ShowSquareProject','find','options','raw','where','attributes','include','map','model','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0xa53689,_0x54db2d){var _0x2d2e28=function(_0x80f00){while(--_0x80f00){_0xa53689['push'](_0xa53689['shift']());}};_0x2d2e28(++_0x54db2d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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});config[_0x0a9e('0xa')]=_[_0x0a9e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xc'))(new Redis(config['redis']));require('./squareProject.socket')[_0x0a9e('0xd')](socket);function respondWithRpcPromise(_0xf81284,_0x307b3e,_0x3ab53f){return new BPromise(function(_0xfeb75b,_0xbd1168){return client['request'](_0xf81284,_0x3ab53f)['then'](function(_0x527cdd){logger['info'](_0x0a9e('0xe'),_0x307b3e,_0x0a9e('0xf'));logger[_0x0a9e('0x10')](_0x0a9e('0x11'),_0x307b3e,_0x0a9e('0xf'),JSON[_0x0a9e('0x12')](_0x527cdd));if(_0x527cdd['error']){if(_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x14')]===0x1f4){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x15')]);return _0xbd1168(_0x527cdd['error'][_0x0a9e('0x15')]);}logger['error'](_0x0a9e('0xe'),_0x307b3e,_0x527cdd['error'][_0x0a9e('0x15')]);return _0xfeb75b(_0x527cdd[_0x0a9e('0x13')]['message']);}else{logger[_0x0a9e('0x16')]('SquareProject,\x20%s,\x20%s',_0x307b3e,_0x0a9e('0xf'));_0xfeb75b(_0x527cdd[_0x0a9e('0x17')][_0x0a9e('0x15')]);}})[_0x0a9e('0x18')](function(_0x31b1ca){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x31b1ca);_0xbd1168(_0x31b1ca);});});}exports[_0x0a9e('0x19')]=function(_0x1314ae){var _0x112016=this;return new Promise(function(_0x1c696a,_0x105080){return db['SquareProject'][_0x0a9e('0x1a')]({'raw':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae['options'][_0x0a9e('0x1c')]===undefined?!![]:![]:!![],'where':_0x1314ae['options']?_0x1314ae['options'][_0x0a9e('0x1d')]||null:null,'attributes':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1e')]||null:null,'include':_0x1314ae['options']?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1f')],function(_0x42ac8f){return{'model':db[_0x42ac8f[_0x0a9e('0x21')]],'as':_0x42ac8f['as'],'attributes':_0x42ac8f['attributes'],'include':_0x42ac8f['include']?_[_0x0a9e('0x20')](_0x42ac8f[_0x0a9e('0x1f')],function(_0x40c424){return{'model':db[_0x40c424[_0x0a9e('0x21')]],'as':_0x40c424['as'],'attributes':_0x40c424['attributes'],'include':_0x40c424[_0x0a9e('0x1f')]?_['map'](_0x40c424[_0x0a9e('0x1f')],function(_0x5bfb33){return{'model':db[_0x5bfb33[_0x0a9e('0x21')]],'as':_0x5bfb33['as'],'attributes':_0x5bfb33[_0x0a9e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x22')](function(_0x14433c){logger[_0x0a9e('0x16')](_0x0a9e('0x19'),_0x1314ae);logger[_0x0a9e('0x10')](_0x0a9e('0x19'),_0x1314ae,JSON['stringify'](_0x14433c));_0x1c696a(_0x14433c);})[_0x0a9e('0x18')](function(_0x468813){logger[_0x0a9e('0x13')](_0x0a9e('0x19'),_0x468813['message'],_0x1314ae);_0x105080(_0x112016[_0x0a9e('0x13')](0x1f4,_0x468813[_0x0a9e('0x15')]));});});};
\ No newline at end of file
index 4ff09b3..cfbb61c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf822=['update','emit','removeListener','register','length','squareProject:','./squareProject.events','remove'];(function(_0x131c67,_0x2b64db){var _0x370571=function(_0x4b6ab5){while(--_0x4b6ab5){_0x131c67['push'](_0x131c67['shift']());}};_0x370571(++_0x2b64db);}(_0xf822,0x19e));var _0x2f82=function(_0x2adef5,_0x651f53){_0x2adef5=_0x2adef5-0x0;var _0x2d667f=_0xf822[_0x2adef5];return _0x2d667f;};'use strict';var SquareProjectEvents=require(_0x2f82('0x0'));var events=['save',_0x2f82('0x1'),_0x2f82('0x2')];function createListener(_0x45ab5e,_0x1f9d70){return function(_0xfff58){_0x1f9d70[_0x2f82('0x3')](_0x45ab5e,_0xfff58);};}function removeListener(_0x48a05c,_0x12e2d7){return function(){SquareProjectEvents[_0x2f82('0x4')](_0x48a05c,_0x12e2d7);};}exports[_0x2f82('0x5')]=function(_0x5b73e5){for(var _0x360c8f=0x0,_0x50ec5d=events[_0x2f82('0x6')];_0x360c8f<_0x50ec5d;_0x360c8f++){var _0x236d70=events[_0x360c8f];var _0x24b313=createListener(_0x2f82('0x7')+_0x236d70,_0x5b73e5);SquareProjectEvents['on'](_0x236d70,_0x24b313);}};
\ No newline at end of file
+var _0xcf95=['./squareProject.events','save','emit','removeListener','register','length','squareProject:'];(function(_0x16938f,_0x35e57f){var _0x5c66e9=function(_0x5167d7){while(--_0x5167d7){_0x16938f['push'](_0x16938f['shift']());}};_0x5c66e9(++_0x35e57f);}(_0xcf95,0xa1));var _0x5cf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf95[_0x3dd15e];return _0x231fd0;};'use strict';var SquareProjectEvents=require(_0x5cf9('0x0'));var events=[_0x5cf9('0x1'),'remove','update'];function createListener(_0x548d0c,_0x431989){return function(_0xfeb22f){_0x431989[_0x5cf9('0x2')](_0x548d0c,_0xfeb22f);};}function removeListener(_0x102b24,_0x53e2a1){return function(){SquareProjectEvents[_0x5cf9('0x3')](_0x102b24,_0x53e2a1);};}exports[_0x5cf9('0x4')]=function(_0x5b060f){for(var _0x498d14=0x0,_0x1c0c3a=events[_0x5cf9('0x5')];_0x498d14<_0x1c0c3a;_0x498d14++){var _0x51acd7=events[_0x498d14];var _0x26b0de=createListener(_0x5cf9('0x6')+_0x51acd7,_0x5b060f);SquareProjectEvents['on'](_0x51acd7,_0x26b0de);}};
\ No newline at end of file
index 34419f1..5dbbf7a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4172=['/:id/download','download','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./squareRecording.controller','get','isAuthenticated','index','/:id'];(function(_0x4c6647,_0x58ec36){var _0xb9d959=function(_0x392954){while(--_0x392954){_0x4c6647['push'](_0x4c6647['shift']());}};_0xb9d959(++_0x58ec36);}(_0x4172,0x1aa));var _0x2417=function(_0x315e40,_0x4c01ca){_0x315e40=_0x315e40-0x0;var _0x10ca43=_0x4172[_0x315e40];return _0x10ca43;};'use strict';var multer=require(_0x2417('0x0'));var util=require('util');var path=require(_0x2417('0x1'));var timeout=require(_0x2417('0x2'));var express=require(_0x2417('0x3'));var router=express[_0x2417('0x4')]();var auth=require(_0x2417('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2417('0x6'));router[_0x2417('0x7')]('/',auth[_0x2417('0x8')](),controller[_0x2417('0x9')]);router[_0x2417('0x7')](_0x2417('0xa'),auth[_0x2417('0x8')](),controller['show']);router[_0x2417('0x7')](_0x2417('0xb'),auth['isAuthenticated'](),controller[_0x2417('0xc')]);router[_0x2417('0xd')]('/',auth[_0x2417('0x8')](),controller['create']);router[_0x2417('0xe')](_0x2417('0xa'),auth[_0x2417('0x8')](),controller[_0x2417('0xf')]);router[_0x2417('0x10')]('/:id',auth[_0x2417('0x8')](),controller[_0x2417('0x11')]);module[_0x2417('0x12')]=router;
\ No newline at end of file
+var _0xfbf1=['/:id','show','post','put','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index'];(function(_0x2aa1a4,_0x3fe4e4){var _0x3e588e=function(_0xecc31d){while(--_0xecc31d){_0x2aa1a4['push'](_0x2aa1a4['shift']());}};_0x3e588e(++_0x3fe4e4);}(_0xfbf1,0x1a3));var _0x1fbf=function(_0x52bedc,_0x11415f){_0x52bedc=_0x52bedc-0x0;var _0x172177=_0xfbf1[_0x52bedc];return _0x172177;};'use strict';var multer=require(_0x1fbf('0x0'));var util=require(_0x1fbf('0x1'));var path=require(_0x1fbf('0x2'));var timeout=require(_0x1fbf('0x3'));var express=require(_0x1fbf('0x4'));var router=express[_0x1fbf('0x5')]();var auth=require(_0x1fbf('0x6'));var interaction=require(_0x1fbf('0x7'));var config=require(_0x1fbf('0x8'));var controller=require(_0x1fbf('0x9'));router[_0x1fbf('0xa')]('/',auth[_0x1fbf('0xb')](),controller[_0x1fbf('0xc')]);router['get'](_0x1fbf('0xd'),auth[_0x1fbf('0xb')](),controller[_0x1fbf('0xe')]);router['get']('/:id/download',auth[_0x1fbf('0xb')](),controller['download']);router[_0x1fbf('0xf')]('/',auth[_0x1fbf('0xb')](),controller['create']);router[_0x1fbf('0x10')]('/:id',auth[_0x1fbf('0xb')](),controller['update']);router[_0x1fbf('0x11')](_0x1fbf('0xd'),auth[_0x1fbf('0xb')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
index 3b5c105..7e8de04 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x78d7=['STRING','sequelize','exports'];(function(_0xca70ef,_0x29f15d){var _0x3da0e4=function(_0x525de5){while(--_0x525de5){_0xca70ef['push'](_0xca70ef['shift']());}};_0x3da0e4(++_0x29f15d);}(_0x78d7,0x115));var _0x778d=function(_0x5ef4ba,_0x4a50cb){_0x5ef4ba=_0x5ef4ba-0x0;var _0x44e9ac=_0x78d7[_0x5ef4ba];return _0x44e9ac;};'use strict';var Sequelize=require(_0x778d('0x0'));module[_0x778d('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x778d('0x2')]},'calleridname':{'type':Sequelize[_0x778d('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x778d('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x778d('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x778d('0x2')]},'saveName':{'type':Sequelize[_0x778d('0x2')]},'filename':{'type':Sequelize[_0x778d('0x2')]},'savePath':{'type':Sequelize[_0x778d('0x2')]}};
\ No newline at end of file
+var _0x94b9=['STRING','exports'];(function(_0xac4b82,_0x2a6b37){var _0x471a9b=function(_0x1e645a){while(--_0x1e645a){_0xac4b82['push'](_0xac4b82['shift']());}};_0x471a9b(++_0x2a6b37);}(_0x94b9,0x10b));var _0x994b=function(_0x223d2f,_0x4952d4){_0x223d2f=_0x223d2f-0x0;var _0x275ea5=_0x94b9[_0x223d2f];return _0x275ea5;};'use strict';var Sequelize=require('sequelize');module[_0x994b('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x994b('0x1')]},'calleridname':{'type':Sequelize[_0x994b('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x994b('0x1')]},'priority':{'type':Sequelize[_0x994b('0x1')]},'accountcode':{'type':Sequelize[_0x994b('0x1')]},'dnid':{'type':Sequelize[_0x994b('0x1')]},'projectName':{'type':Sequelize[_0x994b('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x994b('0x1')]},'savePath':{'type':Sequelize[_0x994b('0x1')]}};
\ No newline at end of file
index 417c3b7..afd83de 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc7f5=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../components/parsers/qs','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','SquareRecording','rawAttributes','keys','query','filters','intersection','attributes','model','fields','order','sort','where','pick','filter','type','key','VIRTUAL','field','options','includeAll','include','findAll','then','catch','length','merge','find','create','body','params','download','uniqueid','filename','format','%s.cypher','existsSync','decryptFile','savePath','secrets','recording','Sequelize','SquareRecording\x20not\x20found','unlink','html-pdf','eml-format','fast-json-patch','moment','util','path','to-csv','ejs'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xc7f5,0x1de));var _0x5c7f=function(_0x4cec25,_0x530694){_0x4cec25=_0x4cec25-0x0;var _0x331ad2=_0xc7f5[_0x4cec25];return _0x331ad2;};'use strict';var pdf=require(_0x5c7f('0x0'));var emlformat=require(_0x5c7f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5c7f('0x2'));var rp=require('request-promise');var moment=require(_0x5c7f('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5c7f('0x4'));var path=require(_0x5c7f('0x5'));var sox=require('sox');var csv=require(_0x5c7f('0x6'));var ejs=require(_0x5c7f('0x7'));var fs=require('fs');var _=require(_0x5c7f('0x8'));var squel=require(_0x5c7f('0x9'));var crypto=require(_0x5c7f('0xa'));var jsforce=require(_0x5c7f('0xb'));var deskjs=require(_0x5c7f('0xc'));var toCsv=require(_0x5c7f('0x6'));var querystring=require(_0x5c7f('0xd'));var Papa=require(_0x5c7f('0xe'));var authService=require('../../components/auth/service');var hardwareService=require(_0x5c7f('0xf'));var Redis=require('ioredis');var qs=require(_0x5c7f('0x10'));var logger=require('../../config/logger')(_0x5c7f('0x11'));var utils=require('../../config/utils');var config=require(_0x5c7f('0x12'));var db=require(_0x5c7f('0x13'))['db'];function respondWithStatusCode(_0x709656,_0x5b2231){_0x5b2231=_0x5b2231||0xcc;return function(_0x5a87d4){if(_0x5a87d4){return _0x709656['sendStatus'](_0x5b2231);}return _0x709656[_0x5c7f('0x14')](_0x5b2231)[_0x5c7f('0x15')]();};}function respondWithResult(_0x2d1d89,_0x17ff21){_0x17ff21=_0x17ff21||0xc8;return function(_0x5a285a){if(_0x5a285a){return _0x2d1d89[_0x5c7f('0x14')](_0x17ff21)[_0x5c7f('0x16')](_0x5a285a);}};}function respondWithFilteredResult(_0x14c653,_0x38f0dd){return function(_0x4c0b69){if(_0x4c0b69){var _0x5d2b21=_0x4c0b69[_0x5c7f('0x17')],_0x565bf5=_0x38f0dd['offset'],_0x2a8c48=_0x38f0dd[_0x5c7f('0x18')]+_0x38f0dd[_0x5c7f('0x19')],_0x3302c5;if(_0x2a8c48>=_0x5d2b21){_0x2a8c48=_0x5d2b21;_0x3302c5=0xc8;}else{_0x3302c5=0xce;}_0x14c653[_0x5c7f('0x14')](_0x3302c5);return _0x14c653[_0x5c7f('0x1a')](_0x5c7f('0x1b'),_0x565bf5+'-'+_0x2a8c48+'/'+_0x5d2b21)['json'](_0x4c0b69);}return null;};}function patchUpdates(_0x342014){return function(_0x21a6c8){try{jsonpatch[_0x5c7f('0x1c')](_0x21a6c8,_0x342014,!![]);}catch(_0x317f61){return BPromise[_0x5c7f('0x1d')](_0x317f61);}return _0x21a6c8[_0x5c7f('0x1e')]();};}function saveUpdates(_0x51aa5d,_0x7c777){return function(_0x379ebd){if(_0x379ebd){return _0x379ebd[_0x5c7f('0x1f')](_0x51aa5d)['then'](function(_0x5ec74d){return _0x5ec74d;});}return null;};}function removeEntity(_0x5cbd65,_0x133d35){return function(_0x5e96c5){if(_0x5e96c5){return _0x5e96c5[_0x5c7f('0x20')]()['then'](function(){_0x5cbd65[_0x5c7f('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf7ff18,_0x49bb1c){return function(_0x26c35c){if(!_0x26c35c){_0xf7ff18['sendStatus'](0x194);}return _0x26c35c;};}function handleError(_0x5d8e4b,_0x138d61){_0x138d61=_0x138d61||0x1f4;return function(_0x11109a){logger[_0x5c7f('0x21')](_0x11109a[_0x5c7f('0x22')]);if(_0x11109a[_0x5c7f('0x23')]){delete _0x11109a[_0x5c7f('0x23')];}_0x5d8e4b[_0x5c7f('0x14')](_0x138d61)[_0x5c7f('0x24')](_0x11109a);};}exports[_0x5c7f('0x25')]=function(_0x544b78,_0x14022a){var _0x4c260f={},_0x535861={},_0x4e36eb={'count':0x0,'rows':[]};var _0x3d9169=db[_0x5c7f('0x26')][_0x5c7f('0x27')];_0x535861['model']=_[_0x5c7f('0x28')](_0x3d9169);_0x535861[_0x5c7f('0x29')]=_[_0x5c7f('0x28')](_0x544b78[_0x5c7f('0x29')]);_0x535861[_0x5c7f('0x2a')]=_[_0x5c7f('0x2b')](_0x535861['model'],_0x535861[_0x5c7f('0x29')]);_0x4c260f[_0x5c7f('0x2c')]=_['intersection'](_0x535861[_0x5c7f('0x2d')],qs[_0x5c7f('0x2e')](_0x544b78[_0x5c7f('0x29')][_0x5c7f('0x2e')]));_0x4c260f[_0x5c7f('0x2c')]=_0x4c260f['attributes']['length']?_0x4c260f[_0x5c7f('0x2c')]:_0x535861[_0x5c7f('0x2d')];if(!_0x544b78['query']['hasOwnProperty']('nolimit')){_0x4c260f[_0x5c7f('0x19')]=qs[_0x5c7f('0x19')](_0x544b78[_0x5c7f('0x29')]['limit']);_0x4c260f['offset']=qs[_0x5c7f('0x18')](_0x544b78['query'][_0x5c7f('0x18')]);}_0x4c260f[_0x5c7f('0x2f')]=qs[_0x5c7f('0x30')](_0x544b78[_0x5c7f('0x29')][_0x5c7f('0x30')]);_0x4c260f[_0x5c7f('0x31')]=qs['filters'](_[_0x5c7f('0x32')](_0x544b78[_0x5c7f('0x29')],_0x535861['filters']));if(_0x544b78['query'][_0x5c7f('0x33')]){_0x4c260f[_0x5c7f('0x31')]=_['merge'](_0x4c260f[_0x5c7f('0x31')],{'$or':_['map'](_0x3d9169,function(_0x19a719){if(_0x19a719[_0x5c7f('0x34')][_0x5c7f('0x35')]!==_0x5c7f('0x36')){var _0x2324c6={};_0x2324c6[_0x19a719[_0x5c7f('0x37')]]={'$like':'%'+_0x544b78[_0x5c7f('0x29')]['filter']+'%'};return _0x2324c6;}})});}_0x4c260f=_['merge']({},_0x4c260f,_0x544b78[_0x5c7f('0x38')]);var _0x4b935d={'where':_0x4c260f[_0x5c7f('0x31')]};return db['SquareRecording'][_0x5c7f('0x17')](_0x4b935d)['then'](function(_0x334b76){_0x4e36eb[_0x5c7f('0x17')]=_0x334b76;if(_0x544b78[_0x5c7f('0x29')][_0x5c7f('0x39')]){_0x4c260f[_0x5c7f('0x3a')]=[{'all':!![]}];}return db[_0x5c7f('0x26')][_0x5c7f('0x3b')](_0x4c260f);})[_0x5c7f('0x3c')](function(_0x4edaec){_0x4e36eb['rows']=_0x4edaec;return _0x4e36eb;})[_0x5c7f('0x3c')](respondWithFilteredResult(_0x14022a,_0x4c260f))[_0x5c7f('0x3d')](handleError(_0x14022a,null));};exports['show']=function(_0x1dc047,_0xea60bd){var _0xf18bd5={'raw':!![],'where':{'id':_0x1dc047['params']['id']}},_0x3d50ef={};_0x3d50ef[_0x5c7f('0x2d')]=_[_0x5c7f('0x28')](db[_0x5c7f('0x26')]['rawAttributes']);_0x3d50ef['query']=_['keys'](_0x1dc047[_0x5c7f('0x29')]);_0x3d50ef[_0x5c7f('0x2a')]=_[_0x5c7f('0x2b')](_0x3d50ef[_0x5c7f('0x2d')],_0x3d50ef[_0x5c7f('0x29')]);_0xf18bd5[_0x5c7f('0x2c')]=_[_0x5c7f('0x2b')](_0x3d50ef[_0x5c7f('0x2d')],qs[_0x5c7f('0x2e')](_0x1dc047[_0x5c7f('0x29')][_0x5c7f('0x2e')]));_0xf18bd5['attributes']=_0xf18bd5[_0x5c7f('0x2c')][_0x5c7f('0x3e')]?_0xf18bd5[_0x5c7f('0x2c')]:_0x3d50ef['model'];if(_0x1dc047[_0x5c7f('0x29')][_0x5c7f('0x39')]){_0xf18bd5['include']=[{'all':!![]}];}_0xf18bd5=_[_0x5c7f('0x3f')]({},_0xf18bd5,_0x1dc047[_0x5c7f('0x38')]);return db[_0x5c7f('0x26')][_0x5c7f('0x40')](_0xf18bd5)[_0x5c7f('0x3c')](handleEntityNotFound(_0xea60bd,null))[_0x5c7f('0x3c')](respondWithResult(_0xea60bd,null))['catch'](handleError(_0xea60bd,null));};exports[_0x5c7f('0x41')]=function(_0xd9594a,_0x3f0384){return db['SquareRecording'][_0x5c7f('0x41')](_0xd9594a[_0x5c7f('0x42')],{})[_0x5c7f('0x3c')](respondWithResult(_0x3f0384,0xc9))[_0x5c7f('0x3d')](handleError(_0x3f0384,null));};exports[_0x5c7f('0x1f')]=function(_0x11d7d8,_0x4e6837){if(_0x11d7d8[_0x5c7f('0x42')]['id']){delete _0x11d7d8['body']['id'];}return db['SquareRecording'][_0x5c7f('0x40')]({'where':{'id':_0x11d7d8[_0x5c7f('0x43')]['id']}})[_0x5c7f('0x3c')](handleEntityNotFound(_0x4e6837,null))['then'](saveUpdates(_0x11d7d8['body'],null))[_0x5c7f('0x3c')](respondWithResult(_0x4e6837,null))[_0x5c7f('0x3d')](handleError(_0x4e6837,null));};exports[_0x5c7f('0x20')]=function(_0x16b580,_0x46ade9){return db[_0x5c7f('0x26')][_0x5c7f('0x40')]({'where':{'id':_0x16b580[_0x5c7f('0x43')]['id']}})[_0x5c7f('0x3c')](handleEntityNotFound(_0x46ade9,null))[_0x5c7f('0x3c')](removeEntity(_0x46ade9,null))[_0x5c7f('0x3d')](handleError(_0x46ade9,null));};exports[_0x5c7f('0x44')]=function(_0x572fc9,_0x8b7827,_0xe88d25){var _0x540276=require('../../components/encryptor');var _0x5bd99c=![];var _0x2ed44e={};if(_0x572fc9['query'][_0x5c7f('0x34')]&&_0x572fc9['query']['type']===_0x5c7f('0x45')){_0x2ed44e[_0x5c7f('0x45')]=_0x572fc9[_0x5c7f('0x43')]['id'];}else{_0x2ed44e['id']=_0x572fc9['params']['id'];}return db[_0x5c7f('0x26')]['find']({'where':_0x2ed44e,'attributes':['id','savePath',_0x5c7f('0x46')],'raw':!![]})[_0x5c7f('0x3c')](handleEntityNotFound(_0x8b7827,null))[_0x5c7f('0x3c')](function(_0x3e577a){if(_0x3e577a){var _0x56f6d3=util[_0x5c7f('0x47')](_0x5c7f('0x48'),_0x3e577a['value']);if(fs[_0x5c7f('0x49')](_0x56f6d3)){_0x5bd99c=!![];return _0x540276[_0x5c7f('0x4a')](_0x56f6d3,_0x3e577a[_0x5c7f('0x4b')],config[_0x5c7f('0x4c')][_0x5c7f('0x4d')])[_0x5c7f('0x3c')](function(){return _0x3e577a;});}return _0x3e577a;}})[_0x5c7f('0x3c')](function(_0x3a9d2c){if(_0x3a9d2c){if(!fs['existsSync'](_0x3a9d2c[_0x5c7f('0x4b')])){throw new db[(_0x5c7f('0x4e'))]['ValidationError'](_0x5c7f('0x4f'));}if(_0x3a9d2c[_0x5c7f('0x46')]){return _0x8b7827[_0x5c7f('0x44')](_0x3a9d2c[_0x5c7f('0x4b')],_0x3a9d2c[_0x5c7f('0x46')]+path['extname'](_0x3a9d2c[_0x5c7f('0x4b')]),function(){if(_0x5bd99c){fs[_0x5c7f('0x50')](_0x3a9d2c[_0x5c7f('0x4b')]);}});}else{return _0x8b7827[_0x5c7f('0x44')](_0x3a9d2c[_0x5c7f('0x4b')],function(_0x4f69cf){if(_0x5bd99c){fs['unlink'](_0x3a9d2c[_0x5c7f('0x4b')]);}});}}})[_0x5c7f('0x3d')](handleError(_0x8b7827,null));};
\ No newline at end of file
+var _0x46c4=['save','update','destroy','then','error','stack','name','index','SquareRecording','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','map','type','key','field','count','includeAll','include','findAll','catch','show','params','find','create','body','download','../../components/encryptor','savePath','%s.cypher','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','html-pdf','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','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','json','apply','reject'];(function(_0x4dbebf,_0xfc7f5e){var _0x354f09=function(_0x4f1298){while(--_0x4f1298){_0x4dbebf['push'](_0x4dbebf['shift']());}};_0x354f09(++_0xfc7f5e);}(_0x46c4,0x128));var _0x446c=function(_0x4977f5,_0x114a2e){_0x4977f5=_0x4977f5-0x0;var _0x199df7=_0x46c4[_0x4977f5];return _0x199df7;};'use strict';var pdf=require(_0x446c('0x0'));var emlformat=require(_0x446c('0x1'));var rimraf=require(_0x446c('0x2'));var zipdir=require(_0x446c('0x3'));var jsonpatch=require(_0x446c('0x4'));var rp=require(_0x446c('0x5'));var moment=require(_0x446c('0x6'));var BPromise=require(_0x446c('0x7'));var Mustache=require(_0x446c('0x8'));var util=require(_0x446c('0x9'));var path=require(_0x446c('0xa'));var sox=require(_0x446c('0xb'));var csv=require(_0x446c('0xc'));var ejs=require(_0x446c('0xd'));var fs=require('fs');var _=require(_0x446c('0xe'));var squel=require(_0x446c('0xf'));var crypto=require('crypto');var jsforce=require(_0x446c('0x10'));var deskjs=require(_0x446c('0x11'));var toCsv=require('to-csv');var querystring=require(_0x446c('0x12'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0x446c('0x13'));var Redis=require(_0x446c('0x14'));var qs=require(_0x446c('0x15'));var logger=require(_0x446c('0x16'))(_0x446c('0x17'));var utils=require(_0x446c('0x18'));var config=require(_0x446c('0x19'));var db=require(_0x446c('0x1a'))['db'];function respondWithStatusCode(_0x171d5d,_0x48433b){_0x48433b=_0x48433b||0xcc;return function(_0x387564){if(_0x387564){return _0x171d5d[_0x446c('0x1b')](_0x48433b);}return _0x171d5d[_0x446c('0x1c')](_0x48433b)[_0x446c('0x1d')]();};}function respondWithResult(_0x5e14f4,_0x521dfa){_0x521dfa=_0x521dfa||0xc8;return function(_0x41bb71){if(_0x41bb71){return _0x5e14f4['status'](_0x521dfa)['json'](_0x41bb71);}};}function respondWithFilteredResult(_0x18c3a3,_0xc5db3){return function(_0x29345e){if(_0x29345e){var _0x2e2d5a=_0x29345e['count'],_0x3d72c7=_0xc5db3[_0x446c('0x1e')],_0x49d1a7=_0xc5db3[_0x446c('0x1e')]+_0xc5db3[_0x446c('0x1f')],_0x22231d;if(_0x49d1a7>=_0x2e2d5a){_0x49d1a7=_0x2e2d5a;_0x22231d=0xc8;}else{_0x22231d=0xce;}_0x18c3a3['status'](_0x22231d);return _0x18c3a3[_0x446c('0x20')]('Content-Range',_0x3d72c7+'-'+_0x49d1a7+'/'+_0x2e2d5a)[_0x446c('0x21')](_0x29345e);}return null;};}function patchUpdates(_0x5c8d34){return function(_0x308ffe){try{jsonpatch[_0x446c('0x22')](_0x308ffe,_0x5c8d34,!![]);}catch(_0x2b7526){return BPromise[_0x446c('0x23')](_0x2b7526);}return _0x308ffe[_0x446c('0x24')]();};}function saveUpdates(_0x4a6253,_0x5d5595){return function(_0x48733f){if(_0x48733f){return _0x48733f[_0x446c('0x25')](_0x4a6253)['then'](function(_0x2a9245){return _0x2a9245;});}return null;};}function removeEntity(_0x205fca,_0x11c332){return function(_0x5b5e27){if(_0x5b5e27){return _0x5b5e27[_0x446c('0x26')]()[_0x446c('0x27')](function(){_0x205fca[_0x446c('0x1c')](0xcc)[_0x446c('0x1d')]();});}};}function handleEntityNotFound(_0x14ebd7,_0x18964b){return function(_0xb1356d){if(!_0xb1356d){_0x14ebd7[_0x446c('0x1b')](0x194);}return _0xb1356d;};}function handleError(_0x20b636,_0x3824ee){_0x3824ee=_0x3824ee||0x1f4;return function(_0x5be8e5){logger[_0x446c('0x28')](_0x5be8e5[_0x446c('0x29')]);if(_0x5be8e5[_0x446c('0x2a')]){delete _0x5be8e5[_0x446c('0x2a')];}_0x20b636['status'](_0x3824ee)['send'](_0x5be8e5);};}exports[_0x446c('0x2b')]=function(_0x392832,_0x55b46a){var _0x3bb4d0={},_0x182514={},_0x13045b={'count':0x0,'rows':[]};var _0x501cf8=db[_0x446c('0x2c')][_0x446c('0x2d')];_0x182514[_0x446c('0x2e')]=_[_0x446c('0x2f')](_0x501cf8);_0x182514['query']=_[_0x446c('0x2f')](_0x392832[_0x446c('0x30')]);_0x182514[_0x446c('0x31')]=_['intersection'](_0x182514[_0x446c('0x2e')],_0x182514[_0x446c('0x30')]);_0x3bb4d0[_0x446c('0x32')]=_[_0x446c('0x33')](_0x182514[_0x446c('0x2e')],qs[_0x446c('0x34')](_0x392832[_0x446c('0x30')]['fields']));_0x3bb4d0[_0x446c('0x32')]=_0x3bb4d0[_0x446c('0x32')][_0x446c('0x35')]?_0x3bb4d0[_0x446c('0x32')]:_0x182514[_0x446c('0x2e')];if(!_0x392832[_0x446c('0x30')]['hasOwnProperty'](_0x446c('0x36'))){_0x3bb4d0[_0x446c('0x1f')]=qs[_0x446c('0x1f')](_0x392832[_0x446c('0x30')][_0x446c('0x1f')]);_0x3bb4d0[_0x446c('0x1e')]=qs['offset'](_0x392832[_0x446c('0x30')][_0x446c('0x1e')]);}_0x3bb4d0[_0x446c('0x37')]=qs[_0x446c('0x38')](_0x392832['query']['sort']);_0x3bb4d0[_0x446c('0x39')]=qs[_0x446c('0x31')](_['pick'](_0x392832[_0x446c('0x30')],_0x182514[_0x446c('0x31')]));if(_0x392832['query'][_0x446c('0x3a')]){_0x3bb4d0[_0x446c('0x39')]=_[_0x446c('0x3b')](_0x3bb4d0[_0x446c('0x39')],{'$or':_[_0x446c('0x3c')](_0x501cf8,function(_0xcadef6){if(_0xcadef6[_0x446c('0x3d')][_0x446c('0x3e')]!=='VIRTUAL'){var _0x36b3c6={};_0x36b3c6[_0xcadef6[_0x446c('0x3f')]]={'$like':'%'+_0x392832[_0x446c('0x30')]['filter']+'%'};return _0x36b3c6;}})});}_0x3bb4d0=_[_0x446c('0x3b')]({},_0x3bb4d0,_0x392832['options']);var _0x187b8b={'where':_0x3bb4d0[_0x446c('0x39')]};return db[_0x446c('0x2c')]['count'](_0x187b8b)['then'](function(_0x1d5c1f){_0x13045b[_0x446c('0x40')]=_0x1d5c1f;if(_0x392832[_0x446c('0x30')][_0x446c('0x41')]){_0x3bb4d0[_0x446c('0x42')]=[{'all':!![]}];}return db['SquareRecording'][_0x446c('0x43')](_0x3bb4d0);})[_0x446c('0x27')](function(_0x5d0e13){_0x13045b['rows']=_0x5d0e13;return _0x13045b;})[_0x446c('0x27')](respondWithFilteredResult(_0x55b46a,_0x3bb4d0))[_0x446c('0x44')](handleError(_0x55b46a,null));};exports[_0x446c('0x45')]=function(_0x10bd67,_0x199402){var _0x529c00={'raw':!![],'where':{'id':_0x10bd67[_0x446c('0x46')]['id']}},_0x49d44a={};_0x49d44a[_0x446c('0x2e')]=_['keys'](db[_0x446c('0x2c')][_0x446c('0x2d')]);_0x49d44a[_0x446c('0x30')]=_[_0x446c('0x2f')](_0x10bd67['query']);_0x49d44a[_0x446c('0x31')]=_[_0x446c('0x33')](_0x49d44a[_0x446c('0x2e')],_0x49d44a[_0x446c('0x30')]);_0x529c00['attributes']=_[_0x446c('0x33')](_0x49d44a[_0x446c('0x2e')],qs[_0x446c('0x34')](_0x10bd67[_0x446c('0x30')][_0x446c('0x34')]));_0x529c00[_0x446c('0x32')]=_0x529c00[_0x446c('0x32')][_0x446c('0x35')]?_0x529c00['attributes']:_0x49d44a[_0x446c('0x2e')];if(_0x10bd67[_0x446c('0x30')]['includeAll']){_0x529c00[_0x446c('0x42')]=[{'all':!![]}];}_0x529c00=_['merge']({},_0x529c00,_0x10bd67['options']);return db['SquareRecording'][_0x446c('0x47')](_0x529c00)[_0x446c('0x27')](handleEntityNotFound(_0x199402,null))[_0x446c('0x27')](respondWithResult(_0x199402,null))[_0x446c('0x44')](handleError(_0x199402,null));};exports['create']=function(_0x54034b,_0x162a19){return db[_0x446c('0x2c')][_0x446c('0x48')](_0x54034b[_0x446c('0x49')],{})[_0x446c('0x27')](respondWithResult(_0x162a19,0xc9))[_0x446c('0x44')](handleError(_0x162a19,null));};exports['update']=function(_0x36fb1e,_0x353a23){if(_0x36fb1e[_0x446c('0x49')]['id']){delete _0x36fb1e[_0x446c('0x49')]['id'];}return db[_0x446c('0x2c')][_0x446c('0x47')]({'where':{'id':_0x36fb1e[_0x446c('0x46')]['id']}})[_0x446c('0x27')](handleEntityNotFound(_0x353a23,null))['then'](saveUpdates(_0x36fb1e['body'],null))['then'](respondWithResult(_0x353a23,null))[_0x446c('0x44')](handleError(_0x353a23,null));};exports[_0x446c('0x26')]=function(_0x2ba5f1,_0x1d1f39){return db[_0x446c('0x2c')][_0x446c('0x47')]({'where':{'id':_0x2ba5f1[_0x446c('0x46')]['id']}})[_0x446c('0x27')](handleEntityNotFound(_0x1d1f39,null))['then'](removeEntity(_0x1d1f39,null))[_0x446c('0x44')](handleError(_0x1d1f39,null));};exports[_0x446c('0x4a')]=function(_0x3dcc3b,_0x44decb,_0x40a678){var _0x425c0f=require(_0x446c('0x4b'));var _0x2b88ed=![];var _0x3523a7={};if(_0x3dcc3b[_0x446c('0x30')][_0x446c('0x3d')]&&_0x3dcc3b[_0x446c('0x30')]['type']==='uniqueid'){_0x3523a7['uniqueid']=_0x3dcc3b['params']['id'];}else{_0x3523a7['id']=_0x3dcc3b['params']['id'];}return db[_0x446c('0x2c')]['find']({'where':_0x3523a7,'attributes':['id',_0x446c('0x4c'),'filename'],'raw':!![]})[_0x446c('0x27')](handleEntityNotFound(_0x44decb,null))[_0x446c('0x27')](function(_0x1182e3){if(_0x1182e3){var _0x32bac3=util['format'](_0x446c('0x4d'),_0x1182e3['value']);if(fs['existsSync'](_0x32bac3)){_0x2b88ed=!![];return _0x425c0f['decryptFile'](_0x32bac3,_0x1182e3[_0x446c('0x4c')],config['secrets']['recording'])['then'](function(){return _0x1182e3;});}return _0x1182e3;}})['then'](function(_0x56b45f){if(_0x56b45f){if(!fs['existsSync'](_0x56b45f[_0x446c('0x4c')])){throw new db['Sequelize'][(_0x446c('0x4e'))](_0x446c('0x4f'));}if(_0x56b45f['filename']){return _0x44decb[_0x446c('0x4a')](_0x56b45f[_0x446c('0x4c')],_0x56b45f[_0x446c('0x50')]+path[_0x446c('0x51')](_0x56b45f['savePath']),function(){if(_0x2b88ed){fs['unlink'](_0x56b45f['savePath']);}});}else{return _0x44decb[_0x446c('0x4a')](_0x56b45f['savePath'],function(_0x1d3497){if(_0x2b88ed){fs[_0x446c('0x52')](_0x56b45f[_0x446c('0x4c')]);}});}}})['catch'](handleError(_0x44decb,null));};
\ No newline at end of file
index acacda2..caa8c23 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf3be=['../../config/logger','api','bluebird','define','square_recordings','lodash','util'];(function(_0x178511,_0x1098a6){var _0x4e8824=function(_0x2f04c4){while(--_0x2f04c4){_0x178511['push'](_0x178511['shift']());}};_0x4e8824(++_0x1098a6);}(_0xf3be,0x1e1));var _0xef3b=function(_0x437bff,_0x3bd612){_0x437bff=_0x437bff-0x0;var _0x239ae0=_0xf3be[_0x437bff];return _0x239ae0;};'use strict';var _=require(_0xef3b('0x0'));var util=require(_0xef3b('0x1'));var logger=require(_0xef3b('0x2'))(_0xef3b('0x3'));var moment=require('moment');var BPromise=require(_0xef3b('0x4'));var rp=require('request-promise');var attributes=require('./squareRecording.attributes');module['exports']=function(_0x4bfc98,_0x41dea3){return _0x4bfc98[_0xef3b('0x5')]('SquareRecording',attributes,{'tableName':_0xef3b('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x44ff=['square_recordings','util','../../config/logger','api','exports','SquareRecording'];(function(_0x49c830,_0x3a8996){var _0x48ad54=function(_0x25916f){while(--_0x25916f){_0x49c830['push'](_0x49c830['shift']());}};_0x48ad54(++_0x3a8996);}(_0x44ff,0x1c3));var _0xf44f=function(_0x3ba721,_0x5b8f13){_0x3ba721=_0x3ba721-0x0;var _0x3a3244=_0x44ff[_0x3ba721];return _0x3a3244;};'use strict';var _=require('lodash');var util=require(_0xf44f('0x0'));var logger=require(_0xf44f('0x1'))(_0xf44f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./squareRecording.attributes');module[_0xf44f('0x3')]=function(_0x672258,_0x53c286){return _0x672258['define'](_0xf44f('0x4'),attributes,{'tableName':_0xf44f('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index a4557d3..b4e8329 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x81ab=['SquareRecording','create','body','options','raw','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareRecording,\x20%s,\x20%s','result','catch','CreateSquareRecording'];(function(_0x3f3f24,_0x5553ed){var _0x1e47e3=function(_0x50f315){while(--_0x50f315){_0x3f3f24['push'](_0x3f3f24['shift']());}};_0x1e47e3(++_0x5553ed);}(_0x81ab,0x17f));var _0xb81a=function(_0x5c2c7c,_0xa7d3b1){_0x5c2c7c=_0x5c2c7c-0x0;var _0xea7ffe=_0x81ab[_0x5c2c7c];return _0xea7ffe;};'use strict';var _=require(_0xb81a('0x0'));var util=require('util');var moment=require(_0xb81a('0x1'));var BPromise=require(_0xb81a('0x2'));var rs=require(_0xb81a('0x3'));var fs=require('fs');var Redis=require(_0xb81a('0x4'));var db=require(_0xb81a('0x5'))['db'];var utils=require(_0xb81a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xb81a('0x7'));var jayson=require(_0xb81a('0x8'));var client=jayson['client'][_0xb81a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe26e90,_0x407e83,_0x378254){return new BPromise(function(_0x165615,_0x540816){return client[_0xb81a('0xa')](_0xe26e90,_0x378254)['then'](function(_0x477e10){logger[_0xb81a('0xb')]('SquareRecording,\x20%s,\x20%s',_0x407e83,_0xb81a('0xc'));logger[_0xb81a('0xd')](_0xb81a('0xe'),_0x407e83,_0xb81a('0xc'),JSON[_0xb81a('0xf')](_0x477e10));if(_0x477e10[_0xb81a('0x10')]){if(_0x477e10[_0xb81a('0x10')][_0xb81a('0x11')]===0x1f4){logger[_0xb81a('0x10')]('SquareRecording,\x20%s,\x20%s',_0x407e83,_0x477e10['error'][_0xb81a('0x12')]);return _0x540816(_0x477e10[_0xb81a('0x10')][_0xb81a('0x12')]);}logger[_0xb81a('0x10')](_0xb81a('0x13'),_0x407e83,_0x477e10[_0xb81a('0x10')][_0xb81a('0x12')]);return _0x165615(_0x477e10[_0xb81a('0x10')][_0xb81a('0x12')]);}else{logger[_0xb81a('0xb')]('SquareRecording,\x20%s,\x20%s',_0x407e83,_0xb81a('0xc'));_0x165615(_0x477e10[_0xb81a('0x14')][_0xb81a('0x12')]);}})[_0xb81a('0x15')](function(_0x32b2e4){logger[_0xb81a('0x10')]('SquareRecording,\x20%s,\x20%s',_0x407e83,_0x32b2e4);_0x540816(_0x32b2e4);});});}exports[_0xb81a('0x16')]=function(_0x24282b){var _0x19cc8b=this;return new Promise(function(_0xde70aa,_0xa730f5){return db[_0xb81a('0x17')][_0xb81a('0x18')](_0x24282b[_0xb81a('0x19')],{'raw':_0x24282b['options']?_0x24282b[_0xb81a('0x1a')][_0xb81a('0x1b')]===undefined?!![]:![]:!![]})[_0xb81a('0x1c')](function(_0x8c8ef8){logger[_0xb81a('0xb')]('CreateSquareRecording',_0x24282b);logger[_0xb81a('0xd')]('CreateSquareRecording',_0x24282b,JSON[_0xb81a('0xf')](_0x8c8ef8));_0xde70aa(_0x8c8ef8);})[_0xb81a('0x15')](function(_0x40d8ee){logger[_0xb81a('0x10')]('CreateSquareRecording',_0x40d8ee[_0xb81a('0x12')],_0x24282b);_0xa730f5(_0x19cc8b[_0xb81a('0x10')](0x1f4,_0x40d8ee['message']));});});};
\ No newline at end of file
+var _0xd3b0=['SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareRecording','SquareRecording','create','options','raw','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xee741b,_0x10cf16){var _0x9ce0a2=function(_0x196418){while(--_0x196418){_0xee741b['push'](_0xee741b['shift']());}};_0x9ce0a2(++_0x10cf16);}(_0xd3b0,0xe3));var _0x0d3b=function(_0x46a4b0,_0xc70a7e){_0x46a4b0=_0x46a4b0-0x0;var _0x171243=_0xd3b0[_0x46a4b0];return _0x171243;};'use strict';var _=require('lodash');var util=require(_0x0d3b('0x0'));var moment=require(_0x0d3b('0x1'));var BPromise=require(_0x0d3b('0x2'));var rs=require(_0x0d3b('0x3'));var fs=require('fs');var Redis=require(_0x0d3b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0d3b('0x5'))('rpc');var config=require(_0x0d3b('0x6'));var jayson=require(_0x0d3b('0x7'));var client=jayson[_0x0d3b('0x8')][_0x0d3b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11a3b4,_0x1c030c,_0x29483d){return new BPromise(function(_0x1d2612,_0x1473b0){return client[_0x0d3b('0xa')](_0x11a3b4,_0x29483d)[_0x0d3b('0xb')](function(_0x3108d7){logger[_0x0d3b('0xc')](_0x0d3b('0xd'),_0x1c030c,_0x0d3b('0xe'));logger[_0x0d3b('0xf')](_0x0d3b('0x10'),_0x1c030c,_0x0d3b('0xe'),JSON[_0x0d3b('0x11')](_0x3108d7));if(_0x3108d7[_0x0d3b('0x12')]){if(_0x3108d7[_0x0d3b('0x12')][_0x0d3b('0x13')]===0x1f4){logger[_0x0d3b('0x12')](_0x0d3b('0xd'),_0x1c030c,_0x3108d7[_0x0d3b('0x12')][_0x0d3b('0x14')]);return _0x1473b0(_0x3108d7['error'][_0x0d3b('0x14')]);}logger[_0x0d3b('0x12')](_0x0d3b('0xd'),_0x1c030c,_0x3108d7[_0x0d3b('0x12')][_0x0d3b('0x14')]);return _0x1d2612(_0x3108d7[_0x0d3b('0x12')][_0x0d3b('0x14')]);}else{logger[_0x0d3b('0xc')](_0x0d3b('0xd'),_0x1c030c,_0x0d3b('0xe'));_0x1d2612(_0x3108d7['result'][_0x0d3b('0x14')]);}})[_0x0d3b('0x15')](function(_0x3bf2fb){logger[_0x0d3b('0x12')](_0x0d3b('0xd'),_0x1c030c,_0x3bf2fb);_0x1473b0(_0x3bf2fb);});});}exports[_0x0d3b('0x16')]=function(_0x1166b0){var _0x3e497b=this;return new Promise(function(_0x30d674,_0x426135){return db[_0x0d3b('0x17')][_0x0d3b('0x18')](_0x1166b0['body'],{'raw':_0x1166b0[_0x0d3b('0x19')]?_0x1166b0[_0x0d3b('0x19')][_0x0d3b('0x1a')]===undefined?!![]:![]:!![]})[_0x0d3b('0xb')](function(_0x41d605){logger[_0x0d3b('0xc')](_0x0d3b('0x16'),_0x1166b0);logger[_0x0d3b('0xf')](_0x0d3b('0x16'),_0x1166b0,JSON['stringify'](_0x41d605));_0x30d674(_0x41d605);})[_0x0d3b('0x15')](function(_0x11c1d5){logger['error']('CreateSquareRecording',_0x11c1d5['message'],_0x1166b0);_0x426135(_0x3e497b[_0x0d3b('0x12')](0x1f4,_0x11c1d5[_0x0d3b('0x14')]));});});};
\ No newline at end of file
index ae20d4e..d1d68f7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4efe=['multer','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','index','/describe','isAuthenticated','describe','post','create','/:id','update','delete','destroy','exports'];(function(_0x4e4ca5,_0x1413e8){var _0x27bfeb=function(_0x40337c){while(--_0x40337c){_0x4e4ca5['push'](_0x4e4ca5['shift']());}};_0x27bfeb(++_0x1413e8);}(_0x4efe,0xbb));var _0xe4ef=function(_0x35387d,_0x1ba72f){_0x35387d=_0x35387d-0x0;var _0x3aba56=_0x4efe[_0x35387d];return _0x3aba56;};'use strict';var multer=require(_0xe4ef('0x0'));var util=require('util');var path=require(_0xe4ef('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xe4ef('0x2'));var interaction=require(_0xe4ef('0x3'));var config=require(_0xe4ef('0x4'));var controller=require(_0xe4ef('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xe4ef('0x6')]);router['get'](_0xe4ef('0x7'),auth[_0xe4ef('0x8')](),controller[_0xe4ef('0x9')]);router['get']('/:id',auth[_0xe4ef('0x8')](),controller['show']);router[_0xe4ef('0xa')]('/',auth[_0xe4ef('0x8')](),controller[_0xe4ef('0xb')]);router['put'](_0xe4ef('0xc'),auth[_0xe4ef('0x8')](),controller[_0xe4ef('0xd')]);router[_0xe4ef('0xe')](_0xe4ef('0xc'),auth[_0xe4ef('0x8')](),controller[_0xe4ef('0xf')]);module[_0xe4ef('0x10')]=router;
\ No newline at end of file
+var _0x43d7=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./squareReport.controller','get','isAuthenticated','index','/:id','create'];(function(_0x117f83,_0x54f12a){var _0x4aed47=function(_0x14183d){while(--_0x14183d){_0x117f83['push'](_0x117f83['shift']());}};_0x4aed47(++_0x54f12a);}(_0x43d7,0x1a6));var _0x743d=function(_0x2ae42d,_0x3793){_0x2ae42d=_0x2ae42d-0x0;var _0x4ee5e1=_0x43d7[_0x2ae42d];return _0x4ee5e1;};'use strict';var multer=require(_0x743d('0x0'));var util=require(_0x743d('0x1'));var path=require(_0x743d('0x2'));var timeout=require(_0x743d('0x3'));var express=require('express');var router=express[_0x743d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x743d('0x5'));var config=require('../../config/environment');var controller=require(_0x743d('0x6'));router[_0x743d('0x7')]('/',auth[_0x743d('0x8')](),controller[_0x743d('0x9')]);router[_0x743d('0x7')]('/describe',auth[_0x743d('0x8')](),controller['describe']);router[_0x743d('0x7')](_0x743d('0xa'),auth[_0x743d('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x743d('0xb')]);router['put'](_0x743d('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x743d('0xa'),auth[_0x743d('0x8')](),controller[_0x743d('0xc')]);module[_0x743d('0xd')]=router;
\ No newline at end of file
index 31aec28..b366cab 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc577=['DATE','BOOLEAN','sequelize','STRING'];(function(_0x3dea7d,_0x2cd4ea){var _0x53919a=function(_0x1554e2){while(--_0x1554e2){_0x3dea7d['push'](_0x3dea7d['shift']());}};_0x53919a(++_0x2cd4ea);}(_0xc577,0x172));var _0x7c57=function(_0xaa0140,_0xd6c719){_0xaa0140=_0xaa0140-0x0;var _0x11ac88=_0xc577[_0xaa0140];return _0x11ac88;};'use strict';var Sequelize=require(_0x7c57('0x0'));module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x7c57('0x1')]},'request':{'type':Sequelize[_0x7c57('0x1')]},'channel':{'type':Sequelize[_0x7c57('0x1')]},'language':{'type':Sequelize[_0x7c57('0x1')]},'type':{'type':Sequelize[_0x7c57('0x1')]},'uniqueid':{'type':Sequelize[_0x7c57('0x1')]},'version':{'type':Sequelize[_0x7c57('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7c57('0x1')]},'callingpres':{'type':Sequelize[_0x7c57('0x1')]},'callingani2':{'type':Sequelize[_0x7c57('0x1')]},'callington':{'type':Sequelize[_0x7c57('0x1')]},'callingtns':{'type':Sequelize[_0x7c57('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x7c57('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x7c57('0x1')]},'accountcode':{'type':Sequelize[_0x7c57('0x1')]},'threadid':{'type':Sequelize[_0x7c57('0x1')]},'project_name':{'type':Sequelize[_0x7c57('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7c57('0x2')]},'bot':{'type':Sequelize[_0x7c57('0x3')],'defaultValue':![]}};
\ No newline at end of file
+var _0x0a34=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x752973,_0xb70a5c){var _0x5b4176=function(_0x19c4dd){while(--_0x19c4dd){_0x752973['push'](_0x752973['shift']());}};_0x5b4176(++_0xb70a5c);}(_0x0a34,0x12a));var _0x40a3=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x0a34[_0x1762b4];return _0x29beda;};'use strict';var Sequelize=require(_0x40a3('0x0'));module[_0x40a3('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x40a3('0x2')]},'request':{'type':Sequelize[_0x40a3('0x2')]},'channel':{'type':Sequelize[_0x40a3('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x40a3('0x2')]},'uniqueid':{'type':Sequelize[_0x40a3('0x2')]},'version':{'type':Sequelize[_0x40a3('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x40a3('0x2')]},'callingpres':{'type':Sequelize[_0x40a3('0x2')]},'callingani2':{'type':Sequelize[_0x40a3('0x2')]},'callington':{'type':Sequelize[_0x40a3('0x2')]},'callingtns':{'type':Sequelize[_0x40a3('0x2')]},'dnid':{'type':Sequelize[_0x40a3('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x40a3('0x2')]},'extension':{'type':Sequelize[_0x40a3('0x2')]},'priority':{'type':Sequelize[_0x40a3('0x2')]},'enhanced':{'type':Sequelize[_0x40a3('0x2')]},'accountcode':{'type':Sequelize[_0x40a3('0x2')]},'threadid':{'type':Sequelize[_0x40a3('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x40a3('0x3')]},'leaveAt':{'type':Sequelize[_0x40a3('0x3')]},'bot':{'type':Sequelize[_0x40a3('0x4')],'defaultValue':![]}};
\ No newline at end of file
index 9b3c74f..282bd99 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6dcd=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','key','field','options','includeAll','include','findAll','rows','params','rawAttributes','find','create','body','catch','destroy','describe','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','end','stack','name','send','SquareReport','model','keys','query','filters'];(function(_0x3680af,_0x24f4f2){var _0x282c21=function(_0x5d29b7){while(--_0x5d29b7){_0x3680af['push'](_0x3680af['shift']());}};_0x282c21(++_0x24f4f2);}(_0x6dcd,0x130));var _0xd6dc=function(_0xd16e6,_0x511776){_0xd16e6=_0xd16e6-0x0;var _0x3bb41e=_0x6dcd[_0xd16e6];return _0x3bb41e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd6dc('0x0'));var zipdir=require(_0xd6dc('0x1'));var jsonpatch=require(_0xd6dc('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd6dc('0x3'));var Mustache=require(_0xd6dc('0x4'));var util=require(_0xd6dc('0x5'));var path=require('path');var sox=require(_0xd6dc('0x6'));var csv=require(_0xd6dc('0x7'));var ejs=require(_0xd6dc('0x8'));var fs=require('fs');var _=require(_0xd6dc('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd6dc('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd6dc('0xb'));var authService=require(_0xd6dc('0xc'));var hardwareService=require(_0xd6dc('0xd'));var Redis=require(_0xd6dc('0xe'));var qs=require(_0xd6dc('0xf'));var logger=require('../../config/logger')(_0xd6dc('0x10'));var utils=require(_0xd6dc('0x11'));var config=require(_0xd6dc('0x12'));var db=require(_0xd6dc('0x13'))['db'];function respondWithStatusCode(_0x1d418a,_0x1f879c){_0x1f879c=_0x1f879c||0xcc;return function(_0x59fe48){if(_0x59fe48){return _0x1d418a[_0xd6dc('0x14')](_0x1f879c);}return _0x1d418a['status'](_0x1f879c)['end']();};}function respondWithResult(_0x2b84e7,_0x2bd9f9){_0x2bd9f9=_0x2bd9f9||0xc8;return function(_0x535787){if(_0x535787){return _0x2b84e7[_0xd6dc('0x15')](_0x2bd9f9)[_0xd6dc('0x16')](_0x535787);}};}function respondWithFilteredResult(_0x41a102,_0x596c1e){return function(_0x48fe2b){if(_0x48fe2b){var _0x4e438a=_0x48fe2b[_0xd6dc('0x17')],_0x6a554c=_0x596c1e[_0xd6dc('0x18')],_0x417137=_0x596c1e['offset']+_0x596c1e[_0xd6dc('0x19')],_0x5f2a11;if(_0x417137>=_0x4e438a){_0x417137=_0x4e438a;_0x5f2a11=0xc8;}else{_0x5f2a11=0xce;}_0x41a102['status'](_0x5f2a11);return _0x41a102[_0xd6dc('0x1a')](_0xd6dc('0x1b'),_0x6a554c+'-'+_0x417137+'/'+_0x4e438a)[_0xd6dc('0x16')](_0x48fe2b);}return null;};}function patchUpdates(_0x42fa70){return function(_0x380298){try{jsonpatch['apply'](_0x380298,_0x42fa70,!![]);}catch(_0x442499){return BPromise[_0xd6dc('0x1c')](_0x442499);}return _0x380298[_0xd6dc('0x1d')]();};}function saveUpdates(_0x3b3b16,_0x1e035d){return function(_0x561db6){if(_0x561db6){return _0x561db6[_0xd6dc('0x1e')](_0x3b3b16)[_0xd6dc('0x1f')](function(_0x46ccbc){return _0x46ccbc;});}return null;};}function removeEntity(_0x101bd4,_0x257bf9){return function(_0x4a9fa3){if(_0x4a9fa3){return _0x4a9fa3['destroy']()[_0xd6dc('0x1f')](function(){_0x101bd4[_0xd6dc('0x15')](0xcc)[_0xd6dc('0x20')]();});}};}function handleEntityNotFound(_0x4d3b82,_0x2b6460){return function(_0xe89220){if(!_0xe89220){_0x4d3b82[_0xd6dc('0x14')](0x194);}return _0xe89220;};}function handleError(_0x183a46,_0xef553e){_0xef553e=_0xef553e||0x1f4;return function(_0x5531a8){logger['error'](_0x5531a8[_0xd6dc('0x21')]);if(_0x5531a8[_0xd6dc('0x22')]){delete _0x5531a8['name'];}_0x183a46[_0xd6dc('0x15')](_0xef553e)[_0xd6dc('0x23')](_0x5531a8);};}exports['index']=function(_0x339d05,_0x525460){var _0x5d24ed={},_0x1efb35={},_0x5c2a1c={'count':0x0,'rows':[]};var _0x5563e6=db[_0xd6dc('0x24')]['rawAttributes'];_0x1efb35[_0xd6dc('0x25')]=_[_0xd6dc('0x26')](_0x5563e6);_0x1efb35[_0xd6dc('0x27')]=_[_0xd6dc('0x26')](_0x339d05[_0xd6dc('0x27')]);_0x1efb35[_0xd6dc('0x28')]=_[_0xd6dc('0x29')](_0x1efb35[_0xd6dc('0x25')],_0x1efb35[_0xd6dc('0x27')]);_0x5d24ed['attributes']=_[_0xd6dc('0x29')](_0x1efb35[_0xd6dc('0x25')],qs[_0xd6dc('0x2a')](_0x339d05[_0xd6dc('0x27')][_0xd6dc('0x2a')]));_0x5d24ed['attributes']=_0x5d24ed[_0xd6dc('0x2b')][_0xd6dc('0x2c')]?_0x5d24ed[_0xd6dc('0x2b')]:_0x1efb35[_0xd6dc('0x25')];if(!_0x339d05[_0xd6dc('0x27')][_0xd6dc('0x2d')](_0xd6dc('0x2e'))){_0x5d24ed[_0xd6dc('0x19')]=qs[_0xd6dc('0x19')](_0x339d05['query'][_0xd6dc('0x19')]);_0x5d24ed[_0xd6dc('0x18')]=qs[_0xd6dc('0x18')](_0x339d05[_0xd6dc('0x27')][_0xd6dc('0x18')]);}_0x5d24ed[_0xd6dc('0x2f')]=qs[_0xd6dc('0x30')](_0x339d05[_0xd6dc('0x27')]['sort']);_0x5d24ed[_0xd6dc('0x31')]=qs[_0xd6dc('0x28')](_[_0xd6dc('0x32')](_0x339d05[_0xd6dc('0x27')],_0x1efb35[_0xd6dc('0x28')]));if(_0x339d05['query'][_0xd6dc('0x33')]){_0x5d24ed['where']=_[_0xd6dc('0x34')](_0x5d24ed[_0xd6dc('0x31')],{'$or':_[_0xd6dc('0x35')](_0x5563e6,function(_0x3b9280){if(_0x3b9280['type'][_0xd6dc('0x36')]!=='VIRTUAL'){var _0x3b0135={};_0x3b0135[_0x3b9280[_0xd6dc('0x37')]]={'$like':'%'+_0x339d05[_0xd6dc('0x27')][_0xd6dc('0x33')]+'%'};return _0x3b0135;}})});}_0x5d24ed=_['merge']({},_0x5d24ed,_0x339d05[_0xd6dc('0x38')]);var _0x36a2bf={'where':_0x5d24ed[_0xd6dc('0x31')]};return db['SquareReport']['count'](_0x36a2bf)['then'](function(_0x13d164){_0x5c2a1c['count']=_0x13d164;if(_0x339d05['query'][_0xd6dc('0x39')]){_0x5d24ed[_0xd6dc('0x3a')]=[{'all':!![]}];}return db[_0xd6dc('0x24')][_0xd6dc('0x3b')](_0x5d24ed);})[_0xd6dc('0x1f')](function(_0x5534ed){_0x5c2a1c[_0xd6dc('0x3c')]=_0x5534ed;return _0x5c2a1c;})[_0xd6dc('0x1f')](respondWithFilteredResult(_0x525460,_0x5d24ed))['catch'](handleError(_0x525460,null));};exports['show']=function(_0x13fa27,_0x394a0d){var _0x49ce71={'raw':!![],'where':{'id':_0x13fa27[_0xd6dc('0x3d')]['id']}},_0x353257={};_0x353257['model']=_[_0xd6dc('0x26')](db['SquareReport'][_0xd6dc('0x3e')]);_0x353257['query']=_[_0xd6dc('0x26')](_0x13fa27[_0xd6dc('0x27')]);_0x353257[_0xd6dc('0x28')]=_['intersection'](_0x353257['model'],_0x353257['query']);_0x49ce71[_0xd6dc('0x2b')]=_[_0xd6dc('0x29')](_0x353257[_0xd6dc('0x25')],qs[_0xd6dc('0x2a')](_0x13fa27[_0xd6dc('0x27')][_0xd6dc('0x2a')]));_0x49ce71[_0xd6dc('0x2b')]=_0x49ce71['attributes'][_0xd6dc('0x2c')]?_0x49ce71['attributes']:_0x353257['model'];if(_0x13fa27['query'][_0xd6dc('0x39')]){_0x49ce71[_0xd6dc('0x3a')]=[{'all':!![]}];}_0x49ce71=_['merge']({},_0x49ce71,_0x13fa27[_0xd6dc('0x38')]);return db[_0xd6dc('0x24')][_0xd6dc('0x3f')](_0x49ce71)[_0xd6dc('0x1f')](handleEntityNotFound(_0x394a0d,null))[_0xd6dc('0x1f')](respondWithResult(_0x394a0d,null))['catch'](handleError(_0x394a0d,null));};exports[_0xd6dc('0x40')]=function(_0x44b2b8,_0x7be9b0){return db[_0xd6dc('0x24')][_0xd6dc('0x40')](_0x44b2b8[_0xd6dc('0x41')],{})[_0xd6dc('0x1f')](respondWithResult(_0x7be9b0,0xc9))[_0xd6dc('0x42')](handleError(_0x7be9b0,null));};exports[_0xd6dc('0x1e')]=function(_0x5a80d7,_0x270c66){if(_0x5a80d7['body']['id']){delete _0x5a80d7['body']['id'];}return db['SquareReport'][_0xd6dc('0x3f')]({'where':{'id':_0x5a80d7[_0xd6dc('0x3d')]['id']}})[_0xd6dc('0x1f')](handleEntityNotFound(_0x270c66,null))[_0xd6dc('0x1f')](saveUpdates(_0x5a80d7[_0xd6dc('0x41')],null))[_0xd6dc('0x1f')](respondWithResult(_0x270c66,null))['catch'](handleError(_0x270c66,null));};exports[_0xd6dc('0x43')]=function(_0x1fd590,_0x2cd1a9){return db[_0xd6dc('0x24')][_0xd6dc('0x3f')]({'where':{'id':_0x1fd590[_0xd6dc('0x3d')]['id']}})[_0xd6dc('0x1f')](handleEntityNotFound(_0x2cd1a9,null))[_0xd6dc('0x1f')](removeEntity(_0x2cd1a9,null))[_0xd6dc('0x42')](handleError(_0x2cd1a9,null));};exports[_0xd6dc('0x44')]=function(_0x4ac18a,_0x2dfa11){return db['SquareReport'][_0xd6dc('0x44')]()[_0xd6dc('0x1f')](respondWithResult(_0x2dfa11,null))['catch'](handleError(_0x2dfa11,null));};
\ No newline at end of file
+var _0xf57e=['eml-format','rimraf','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','reject','update','destroy','name','send','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','key','VIRTUAL','field','options','SquareReport','then','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','html-pdf'];(function(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0xf57e,0x1a3));var _0xef57=function(_0x11a95a,_0x51ebf4){_0x11a95a=_0x11a95a-0x0;var _0x569058=_0xf57e[_0x11a95a];return _0x569058;};'use strict';var pdf=require(_0xef57('0x0'));var emlformat=require(_0xef57('0x1'));var rimraf=require(_0xef57('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xef57('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xef57('0x4'));var util=require(_0xef57('0x5'));var path=require(_0xef57('0x6'));var sox=require(_0xef57('0x7'));var csv=require(_0xef57('0x8'));var ejs=require(_0xef57('0x9'));var fs=require('fs');var _=require(_0xef57('0xa'));var squel=require(_0xef57('0xb'));var crypto=require(_0xef57('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xef57('0xd'));var toCsv=require('to-csv');var querystring=require(_0xef57('0xe'));var Papa=require(_0xef57('0xf'));var authService=require(_0xef57('0x10'));var hardwareService=require(_0xef57('0x11'));var Redis=require(_0xef57('0x12'));var qs=require(_0xef57('0x13'));var logger=require(_0xef57('0x14'))('api');var utils=require(_0xef57('0x15'));var config=require(_0xef57('0x16'));var db=require(_0xef57('0x17'))['db'];function respondWithStatusCode(_0x609ca0,_0x52b812){_0x52b812=_0x52b812||0xcc;return function(_0x5f0bf1){if(_0x5f0bf1){return _0x609ca0[_0xef57('0x18')](_0x52b812);}return _0x609ca0['status'](_0x52b812)[_0xef57('0x19')]();};}function respondWithResult(_0x3fe4d1,_0x2fee9e){_0x2fee9e=_0x2fee9e||0xc8;return function(_0x53f0c7){if(_0x53f0c7){return _0x3fe4d1[_0xef57('0x1a')](_0x2fee9e)[_0xef57('0x1b')](_0x53f0c7);}};}function respondWithFilteredResult(_0x8c4a60,_0xa0b047){return function(_0x4b98f5){if(_0x4b98f5){var _0x19e1c6=_0x4b98f5[_0xef57('0x1c')],_0xa39c94=_0xa0b047[_0xef57('0x1d')],_0x3a6cb3=_0xa0b047[_0xef57('0x1d')]+_0xa0b047[_0xef57('0x1e')],_0x2a3b6a;if(_0x3a6cb3>=_0x19e1c6){_0x3a6cb3=_0x19e1c6;_0x2a3b6a=0xc8;}else{_0x2a3b6a=0xce;}_0x8c4a60[_0xef57('0x1a')](_0x2a3b6a);return _0x8c4a60['set']('Content-Range',_0xa39c94+'-'+_0x3a6cb3+'/'+_0x19e1c6)[_0xef57('0x1b')](_0x4b98f5);}return null;};}function patchUpdates(_0x4033b2){return function(_0x2965d7){try{jsonpatch['apply'](_0x2965d7,_0x4033b2,!![]);}catch(_0x6c9ca9){return BPromise[_0xef57('0x1f')](_0x6c9ca9);}return _0x2965d7['save']();};}function saveUpdates(_0x47ef7e,_0x32e4e5){return function(_0x3292ce){if(_0x3292ce){return _0x3292ce[_0xef57('0x20')](_0x47ef7e)['then'](function(_0x495710){return _0x495710;});}return null;};}function removeEntity(_0x44d50c,_0x161bce){return function(_0x3de6cc){if(_0x3de6cc){return _0x3de6cc[_0xef57('0x21')]()['then'](function(){_0x44d50c[_0xef57('0x1a')](0xcc)[_0xef57('0x19')]();});}};}function handleEntityNotFound(_0x5e0e60,_0x4ab0b7){return function(_0xdea237){if(!_0xdea237){_0x5e0e60[_0xef57('0x18')](0x194);}return _0xdea237;};}function handleError(_0x2b00e2,_0x321362){_0x321362=_0x321362||0x1f4;return function(_0x267c1c){logger['error'](_0x267c1c['stack']);if(_0x267c1c['name']){delete _0x267c1c[_0xef57('0x22')];}_0x2b00e2[_0xef57('0x1a')](_0x321362)[_0xef57('0x23')](_0x267c1c);};}exports['index']=function(_0x51eaf4,_0xe8f85){var _0x5b6c08={},_0x370a21={},_0x4a7329={'count':0x0,'rows':[]};var _0x3c2e86=db['SquareReport'][_0xef57('0x24')];_0x370a21[_0xef57('0x25')]=_[_0xef57('0x26')](_0x3c2e86);_0x370a21[_0xef57('0x27')]=_[_0xef57('0x26')](_0x51eaf4[_0xef57('0x27')]);_0x370a21[_0xef57('0x28')]=_['intersection'](_0x370a21[_0xef57('0x25')],_0x370a21[_0xef57('0x27')]);_0x5b6c08[_0xef57('0x29')]=_[_0xef57('0x2a')](_0x370a21[_0xef57('0x25')],qs['fields'](_0x51eaf4[_0xef57('0x27')][_0xef57('0x2b')]));_0x5b6c08['attributes']=_0x5b6c08[_0xef57('0x29')][_0xef57('0x2c')]?_0x5b6c08[_0xef57('0x29')]:_0x370a21[_0xef57('0x25')];if(!_0x51eaf4[_0xef57('0x27')][_0xef57('0x2d')](_0xef57('0x2e'))){_0x5b6c08[_0xef57('0x1e')]=qs[_0xef57('0x1e')](_0x51eaf4[_0xef57('0x27')][_0xef57('0x1e')]);_0x5b6c08[_0xef57('0x1d')]=qs[_0xef57('0x1d')](_0x51eaf4[_0xef57('0x27')][_0xef57('0x1d')]);}_0x5b6c08['order']=qs[_0xef57('0x2f')](_0x51eaf4['query'][_0xef57('0x2f')]);_0x5b6c08[_0xef57('0x30')]=qs[_0xef57('0x28')](_[_0xef57('0x31')](_0x51eaf4[_0xef57('0x27')],_0x370a21[_0xef57('0x28')]));if(_0x51eaf4[_0xef57('0x27')][_0xef57('0x32')]){_0x5b6c08['where']=_[_0xef57('0x33')](_0x5b6c08['where'],{'$or':_[_0xef57('0x34')](_0x3c2e86,function(_0x51ffdb){if(_0x51ffdb['type'][_0xef57('0x35')]!==_0xef57('0x36')){var _0x57b4ce={};_0x57b4ce[_0x51ffdb[_0xef57('0x37')]]={'$like':'%'+_0x51eaf4[_0xef57('0x27')]['filter']+'%'};return _0x57b4ce;}})});}_0x5b6c08=_['merge']({},_0x5b6c08,_0x51eaf4[_0xef57('0x38')]);var _0x340d02={'where':_0x5b6c08['where']};return db[_0xef57('0x39')][_0xef57('0x1c')](_0x340d02)[_0xef57('0x3a')](function(_0x53b221){_0x4a7329['count']=_0x53b221;if(_0x51eaf4['query'][_0xef57('0x3b')]){_0x5b6c08['include']=[{'all':!![]}];}return db[_0xef57('0x39')][_0xef57('0x3c')](_0x5b6c08);})[_0xef57('0x3a')](function(_0x45803e){_0x4a7329[_0xef57('0x3d')]=_0x45803e;return _0x4a7329;})[_0xef57('0x3a')](respondWithFilteredResult(_0xe8f85,_0x5b6c08))[_0xef57('0x3e')](handleError(_0xe8f85,null));};exports[_0xef57('0x3f')]=function(_0x126e60,_0x5a14a0){var _0x4fc937={'raw':!![],'where':{'id':_0x126e60[_0xef57('0x40')]['id']}},_0x54be4c={};_0x54be4c[_0xef57('0x25')]=_[_0xef57('0x26')](db[_0xef57('0x39')]['rawAttributes']);_0x54be4c[_0xef57('0x27')]=_['keys'](_0x126e60[_0xef57('0x27')]);_0x54be4c['filters']=_[_0xef57('0x2a')](_0x54be4c[_0xef57('0x25')],_0x54be4c[_0xef57('0x27')]);_0x4fc937[_0xef57('0x29')]=_[_0xef57('0x2a')](_0x54be4c[_0xef57('0x25')],qs[_0xef57('0x2b')](_0x126e60[_0xef57('0x27')][_0xef57('0x2b')]));_0x4fc937['attributes']=_0x4fc937['attributes'][_0xef57('0x2c')]?_0x4fc937[_0xef57('0x29')]:_0x54be4c[_0xef57('0x25')];if(_0x126e60[_0xef57('0x27')][_0xef57('0x3b')]){_0x4fc937[_0xef57('0x41')]=[{'all':!![]}];}_0x4fc937=_[_0xef57('0x33')]({},_0x4fc937,_0x126e60[_0xef57('0x38')]);return db[_0xef57('0x39')][_0xef57('0x42')](_0x4fc937)['then'](handleEntityNotFound(_0x5a14a0,null))[_0xef57('0x3a')](respondWithResult(_0x5a14a0,null))[_0xef57('0x3e')](handleError(_0x5a14a0,null));};exports['create']=function(_0x6bbd86,_0x266a2f){return db[_0xef57('0x39')][_0xef57('0x43')](_0x6bbd86[_0xef57('0x44')],{})[_0xef57('0x3a')](respondWithResult(_0x266a2f,0xc9))[_0xef57('0x3e')](handleError(_0x266a2f,null));};exports['update']=function(_0x51a71b,_0x39ecd2){if(_0x51a71b[_0xef57('0x44')]['id']){delete _0x51a71b['body']['id'];}return db['SquareReport'][_0xef57('0x42')]({'where':{'id':_0x51a71b['params']['id']}})[_0xef57('0x3a')](handleEntityNotFound(_0x39ecd2,null))[_0xef57('0x3a')](saveUpdates(_0x51a71b[_0xef57('0x44')],null))[_0xef57('0x3a')](respondWithResult(_0x39ecd2,null))[_0xef57('0x3e')](handleError(_0x39ecd2,null));};exports[_0xef57('0x21')]=function(_0x1c79cf,_0x4082b7){return db['SquareReport'][_0xef57('0x42')]({'where':{'id':_0x1c79cf[_0xef57('0x40')]['id']}})[_0xef57('0x3a')](handleEntityNotFound(_0x4082b7,null))[_0xef57('0x3a')](removeEntity(_0x4082b7,null))['catch'](handleError(_0x4082b7,null));};exports[_0xef57('0x45')]=function(_0x159159,_0x34ac29){return db[_0xef57('0x39')][_0xef57('0x45')]()[_0xef57('0x3a')](respondWithResult(_0x34ac29,null))[_0xef57('0x3e')](handleError(_0x34ac29,null));};
\ No newline at end of file
index c523403..9a2bba7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7b3c=['define','report_square','project_name','leaveAt','lodash','util','../../config/logger','moment','bluebird','./squareReport.attributes','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7b3c,0x138));var _0xc7b3=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x7b3c[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xc7b3('0x0'));var util=require(_0xc7b3('0x1'));var logger=require(_0xc7b3('0x2'))('api');var moment=require(_0xc7b3('0x3'));var BPromise=require(_0xc7b3('0x4'));var rp=require('request-promise');var attributes=require(_0xc7b3('0x5'));module[_0xc7b3('0x6')]=function(_0x1c83be,_0x3b5f74){return _0x1c83be[_0xc7b3('0x7')]('SquareReport',attributes,{'tableName':_0xc7b3('0x8'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':['uniqueid',_0xc7b3('0x9')]},{'name':_0xc7b3('0xa'),'fields':['leaveAt']}],'timestamps':!![]});};
\ No newline at end of file
+var _0xd037=['moment','request-promise','./squareReport.attributes','exports','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','api'];(function(_0xc6e0bb,_0x5692f4){var _0x493909=function(_0x5cf4ba){while(--_0x5cf4ba){_0xc6e0bb['push'](_0xc6e0bb['shift']());}};_0x493909(++_0x5692f4);}(_0xd037,0x1b9));var _0x7d03=function(_0x4d25e6,_0x5b3675){_0x4d25e6=_0x4d25e6-0x0;var _0x170161=_0xd037[_0x4d25e6];return _0x170161;};'use strict';var _=require(_0x7d03('0x0'));var util=require(_0x7d03('0x1'));var logger=require('../../config/logger')(_0x7d03('0x2'));var moment=require(_0x7d03('0x3'));var BPromise=require('bluebird');var rp=require(_0x7d03('0x4'));var attributes=require(_0x7d03('0x5'));module[_0x7d03('0x6')]=function(_0x41592f,_0x2bbabe){return _0x41592f['define']('SquareReport',attributes,{'tableName':_0x7d03('0x7'),'paranoid':![],'indexes':[{'name':_0x7d03('0x8'),'fields':[_0x7d03('0x9'),_0x7d03('0xa')]},{'name':_0x7d03('0xb'),'fields':[_0x7d03('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
index 7642095..e4fb369 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9675=['request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareReport,\x20%s,\x20%s','catch','CreateSquareReport','SquareReport','create','options','raw','then','UpdateSquareReport','update','attributes','limit','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info'];(function(_0x507881,_0x23cc61){var _0x2c2063=function(_0x3ddecc){while(--_0x3ddecc){_0x507881['push'](_0x507881['shift']());}};_0x2c2063(++_0x23cc61);}(_0x9675,0x8b));var _0x5967=function(_0x1e1193,_0x36654c){_0x1e1193=_0x1e1193-0x0;var _0x90d6b3=_0x9675[_0x1e1193];return _0x90d6b3;};'use strict';var _=require('lodash');var util=require(_0x5967('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5967('0x1'));var fs=require('fs');var Redis=require(_0x5967('0x2'));var db=require(_0x5967('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5967('0x4'))(_0x5967('0x5'));var config=require(_0x5967('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5967('0x7')][_0x5967('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xcecaa4,_0x3f40c0,_0x581091){return new BPromise(function(_0x514ed1,_0x2a5b23){return client[_0x5967('0x9')](_0xcecaa4,_0x581091)['then'](function(_0x253af6){logger[_0x5967('0xa')]('SquareReport,\x20%s,\x20%s',_0x3f40c0,_0x5967('0xb'));logger[_0x5967('0xc')](_0x5967('0xd'),_0x3f40c0,_0x5967('0xb'),JSON[_0x5967('0xe')](_0x253af6));if(_0x253af6[_0x5967('0xf')]){if(_0x253af6[_0x5967('0xf')][_0x5967('0x10')]===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x3f40c0,_0x253af6['error'][_0x5967('0x11')]);return _0x2a5b23(_0x253af6[_0x5967('0xf')][_0x5967('0x11')]);}logger[_0x5967('0xf')](_0x5967('0x12'),_0x3f40c0,_0x253af6['error']['message']);return _0x514ed1(_0x253af6[_0x5967('0xf')][_0x5967('0x11')]);}else{logger[_0x5967('0xa')](_0x5967('0x12'),_0x3f40c0,_0x5967('0xb'));_0x514ed1(_0x253af6['result'][_0x5967('0x11')]);}})[_0x5967('0x13')](function(_0x8da288){logger[_0x5967('0xf')]('SquareReport,\x20%s,\x20%s',_0x3f40c0,_0x8da288);_0x2a5b23(_0x8da288);});});}exports[_0x5967('0x14')]=function(_0x42ee8a){var _0x4e2ec6=this;return new Promise(function(_0xa0b3ca,_0x46f614){return db[_0x5967('0x15')][_0x5967('0x16')](_0x42ee8a['body'],{'raw':_0x42ee8a['options']?_0x42ee8a[_0x5967('0x17')][_0x5967('0x18')]===undefined?!![]:![]:!![]})[_0x5967('0x19')](function(_0x964fa5){logger[_0x5967('0xa')](_0x5967('0x14'),_0x42ee8a);logger['debug'](_0x5967('0x14'),_0x42ee8a,JSON[_0x5967('0xe')](_0x964fa5));_0xa0b3ca(_0x964fa5);})['catch'](function(_0x4152f6){logger['error'](_0x5967('0x14'),_0x4152f6['message'],_0x42ee8a);_0x46f614(_0x4e2ec6[_0x5967('0xf')](0x1f4,_0x4152f6[_0x5967('0x11')]));});});};exports[_0x5967('0x1a')]=function(_0x5c34ea){var _0xd14495=this;return new Promise(function(_0x3541e0,_0x5360cc){return db[_0x5967('0x15')][_0x5967('0x1b')](_0x5c34ea['body'],{'raw':_0x5c34ea[_0x5967('0x17')]?_0x5c34ea[_0x5967('0x17')][_0x5967('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c34ea[_0x5967('0x17')]?_0x5c34ea[_0x5967('0x17')]['where']||null:null,'attributes':_0x5c34ea[_0x5967('0x17')]?_0x5c34ea[_0x5967('0x17')][_0x5967('0x1c')]||null:null,'limit':_0x5c34ea['options']?_0x5c34ea[_0x5967('0x17')][_0x5967('0x1d')]||null:null})[_0x5967('0x19')](function(_0x264039){logger[_0x5967('0xa')](_0x5967('0x1a'),_0x5c34ea);logger['debug'](_0x5967('0x1a'),_0x5c34ea,JSON[_0x5967('0xe')](_0x264039));_0x3541e0(_0x264039);})[_0x5967('0x13')](function(_0x533525){logger[_0x5967('0xf')]('UpdateSquareReport',_0x533525[_0x5967('0x11')],_0x5c34ea);_0x5360cc(_0xd14495[_0x5967('0xf')](0x1f4,_0x533525['message']));});});};
\ No newline at end of file
+var _0x311a=['rpc','client','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','body','options','raw','update','where','attributes','limit','UpdateSquareReport','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xfff903,_0x246766){var _0x271485=function(_0x41bae9){while(--_0x41bae9){_0xfff903['push'](_0xfff903['shift']());}};_0x271485(++_0x246766);}(_0x311a,0xf9));var _0xa311=function(_0x67ac95,_0x211417){_0x67ac95=_0x67ac95-0x0;var _0x192578=_0x311a[_0x67ac95];return _0x192578;};'use strict';var _=require(_0xa311('0x0'));var util=require(_0xa311('0x1'));var moment=require('moment');var BPromise=require(_0xa311('0x2'));var rs=require(_0xa311('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa311('0x4'))['db'];var utils=require(_0xa311('0x5'));var logger=require(_0xa311('0x6'))(_0xa311('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa311('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x178e41,_0x56b30c,_0x238d54){return new BPromise(function(_0x255452,_0x372645){return client[_0xa311('0x9')](_0x178e41,_0x238d54)[_0xa311('0xa')](function(_0x32c471){logger[_0xa311('0xb')](_0xa311('0xc'),_0x56b30c,_0xa311('0xd'));logger[_0xa311('0xe')](_0xa311('0xf'),_0x56b30c,_0xa311('0xd'),JSON[_0xa311('0x10')](_0x32c471));if(_0x32c471[_0xa311('0x11')]){if(_0x32c471[_0xa311('0x11')][_0xa311('0x12')]===0x1f4){logger['error'](_0xa311('0xc'),_0x56b30c,_0x32c471[_0xa311('0x11')][_0xa311('0x13')]);return _0x372645(_0x32c471[_0xa311('0x11')][_0xa311('0x13')]);}logger[_0xa311('0x11')]('SquareReport,\x20%s,\x20%s',_0x56b30c,_0x32c471['error'][_0xa311('0x13')]);return _0x255452(_0x32c471[_0xa311('0x11')]['message']);}else{logger[_0xa311('0xb')](_0xa311('0xc'),_0x56b30c,_0xa311('0xd'));_0x255452(_0x32c471[_0xa311('0x14')][_0xa311('0x13')]);}})[_0xa311('0x15')](function(_0x604dad){logger['error'](_0xa311('0xc'),_0x56b30c,_0x604dad);_0x372645(_0x604dad);});});}exports[_0xa311('0x16')]=function(_0x382ac2){var _0x530d8d=this;return new Promise(function(_0x471625,_0x391a05){return db[_0xa311('0x17')]['create'](_0x382ac2[_0xa311('0x18')],{'raw':_0x382ac2[_0xa311('0x19')]?_0x382ac2[_0xa311('0x19')][_0xa311('0x1a')]===undefined?!![]:![]:!![]})[_0xa311('0xa')](function(_0x177ed1){logger[_0xa311('0xb')](_0xa311('0x16'),_0x382ac2);logger[_0xa311('0xe')](_0xa311('0x16'),_0x382ac2,JSON[_0xa311('0x10')](_0x177ed1));_0x471625(_0x177ed1);})['catch'](function(_0x3389e9){logger[_0xa311('0x11')]('CreateSquareReport',_0x3389e9['message'],_0x382ac2);_0x391a05(_0x530d8d['error'](0x1f4,_0x3389e9[_0xa311('0x13')]));});});};exports['UpdateSquareReport']=function(_0x423b55){var _0x251e8b=this;return new Promise(function(_0x1fe97e,_0x6b49bf){return db[_0xa311('0x17')][_0xa311('0x1b')](_0x423b55[_0xa311('0x18')],{'raw':_0x423b55[_0xa311('0x19')]?_0x423b55[_0xa311('0x19')][_0xa311('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x423b55['options']?_0x423b55['options'][_0xa311('0x1c')]||null:null,'attributes':_0x423b55[_0xa311('0x19')]?_0x423b55[_0xa311('0x19')][_0xa311('0x1d')]||null:null,'limit':_0x423b55[_0xa311('0x19')]?_0x423b55['options'][_0xa311('0x1e')]||null:null})[_0xa311('0xa')](function(_0x304a75){logger[_0xa311('0xb')](_0xa311('0x1f'),_0x423b55);logger[_0xa311('0xe')](_0xa311('0x1f'),_0x423b55,JSON[_0xa311('0x10')](_0x304a75));_0x1fe97e(_0x304a75);})[_0xa311('0x15')](function(_0x6a87ae){logger[_0xa311('0x11')]('UpdateSquareReport',_0x6a87ae['message'],_0x423b55);_0x6b49bf(_0x251e8b[_0xa311('0x11')](0x1f4,_0x6a87ae[_0xa311('0x13')]));});});};
\ No newline at end of file
index d588e2d..696c039 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4962=['index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get'];(function(_0x50a004,_0x193d84){var _0x5e9992=function(_0x3c8c37){while(--_0x3c8c37){_0x50a004['push'](_0x50a004['shift']());}};_0x5e9992(++_0x193d84);}(_0x4962,0x1c5));var _0x2496=function(_0x9bfa21,_0x7df622){_0x9bfa21=_0x9bfa21-0x0;var _0x4afc1b=_0x4962[_0x9bfa21];return _0x4afc1b;};'use strict';var multer=require(_0x2496('0x0'));var util=require(_0x2496('0x1'));var path=require('path');var timeout=require(_0x2496('0x2'));var express=require(_0x2496('0x3'));var router=express[_0x2496('0x4')]();var auth=require(_0x2496('0x5'));var interaction=require(_0x2496('0x6'));var config=require('../../config/environment');var controller=require(_0x2496('0x7'));router[_0x2496('0x8')]('/',auth['isAuthenticated'](),controller[_0x2496('0x9')]);router['get'](_0x2496('0xa'),auth['isAuthenticated'](),controller[_0x2496('0xb')]);router[_0x2496('0x8')](_0x2496('0xc'),auth[_0x2496('0xd')](),controller[_0x2496('0xe')]);router[_0x2496('0xf')]('/',auth[_0x2496('0xd')](),controller[_0x2496('0x10')]);router[_0x2496('0x11')](_0x2496('0xc'),auth[_0x2496('0xd')](),controller[_0x2496('0x12')]);router[_0x2496('0x13')]('/:id',auth[_0x2496('0xd')](),controller[_0x2496('0x14')]);module[_0x2496('0x15')]=router;
\ No newline at end of file
+var _0x4e39=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','index','/describe','describe','get','/:id','create','put','delete','exports','util'];(function(_0x144927,_0x829632){var _0x6663d1=function(_0xca021c){while(--_0xca021c){_0x144927['push'](_0x144927['shift']());}};_0x6663d1(++_0x829632);}(_0x4e39,0x1e5));var _0x94e3=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x4e39[_0x411017];return _0x2adeea;};'use strict';var multer=require('multer');var util=require(_0x94e3('0x0'));var path=require(_0x94e3('0x1'));var timeout=require(_0x94e3('0x2'));var express=require(_0x94e3('0x3'));var router=express['Router']();var auth=require(_0x94e3('0x4'));var interaction=require(_0x94e3('0x5'));var config=require(_0x94e3('0x6'));var controller=require(_0x94e3('0x7'));router['get']('/',auth[_0x94e3('0x8')](),controller[_0x94e3('0x9')]);router['get'](_0x94e3('0xa'),auth[_0x94e3('0x8')](),controller[_0x94e3('0xb')]);router[_0x94e3('0xc')](_0x94e3('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x94e3('0xe')]);router[_0x94e3('0xf')](_0x94e3('0xd'),auth[_0x94e3('0x8')](),controller['update']);router[_0x94e3('0x10')](_0x94e3('0xd'),auth[_0x94e3('0x8')](),controller['destroy']);module[_0x94e3('0x11')]=router;
\ No newline at end of file
index 9469410..33e0459 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x576a=['TEXT','STRING'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x576a,0x18d));var _0xa576=function(_0xfffb49,_0x24bcbe){_0xfffb49=_0xfffb49-0x0;var _0x4cca64=_0x576a[_0xfffb49];return _0x4cca64;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0xa576('0x0')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xa576('0x1')]},'project_name':{'type':Sequelize[_0xa576('0x0')]},'callerid':{'type':Sequelize[_0xa576('0x0')]}};
\ No newline at end of file
+var _0x5128=['sequelize','exports','STRING','TEXT'];(function(_0x5b0e65,_0x35a69a){var _0x3d3390=function(_0x2efcf4){while(--_0x2efcf4){_0x5b0e65['push'](_0x5b0e65['shift']());}};_0x3d3390(++_0x35a69a);}(_0x5128,0xa8));var _0x8512=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x5128[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x8512('0x0'));module[_0x8512('0x1')]={'uniqueid':{'type':Sequelize[_0x8512('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x8512('0x2')]},'data':{'type':Sequelize[_0x8512('0x3')]},'project_name':{'type':Sequelize[_0x8512('0x2')]},'callerid':{'type':Sequelize[_0x8512('0x2')]}};
\ No newline at end of file
index d1f9c97..398b5a8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf394=['rawAttributes','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','map','type','key','VIRTUAL','rows','show','params','includeAll','include','find','catch','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../mysqldb','status','json','count','offset','limit','Content-Range','reject','update','then','end','sendStatus','error','name','index','SquareDetailsReport'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xf394,0xa9));var _0x4f39=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf394[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require(_0x4f39('0x0'));var emlformat=require(_0x4f39('0x1'));var rimraf=require(_0x4f39('0x2'));var zipdir=require(_0x4f39('0x3'));var jsonpatch=require(_0x4f39('0x4'));var rp=require(_0x4f39('0x5'));var moment=require(_0x4f39('0x6'));var BPromise=require(_0x4f39('0x7'));var Mustache=require(_0x4f39('0x8'));var util=require(_0x4f39('0x9'));var path=require(_0x4f39('0xa'));var sox=require(_0x4f39('0xb'));var csv=require('to-csv');var ejs=require(_0x4f39('0xc'));var fs=require('fs');var _=require(_0x4f39('0xd'));var squel=require(_0x4f39('0xe'));var crypto=require('crypto');var jsforce=require(_0x4f39('0xf'));var deskjs=require(_0x4f39('0x10'));var toCsv=require(_0x4f39('0x11'));var querystring=require(_0x4f39('0x12'));var Papa=require(_0x4f39('0x13'));var authService=require('../../components/auth/service');var hardwareService=require(_0x4f39('0x14'));var Redis=require(_0x4f39('0x15'));var qs=require('../../components/parsers/qs');var logger=require(_0x4f39('0x16'))(_0x4f39('0x17'));var utils=require(_0x4f39('0x18'));var config=require('../../config/environment');var db=require(_0x4f39('0x19'))['db'];function respondWithStatusCode(_0x401a4b,_0x2eda0b){_0x2eda0b=_0x2eda0b||0xcc;return function(_0x38f065){if(_0x38f065){return _0x401a4b['sendStatus'](_0x2eda0b);}return _0x401a4b[_0x4f39('0x1a')](_0x2eda0b)['end']();};}function respondWithResult(_0x1017a2,_0x1889c2){_0x1889c2=_0x1889c2||0xc8;return function(_0x258592){if(_0x258592){return _0x1017a2['status'](_0x1889c2)[_0x4f39('0x1b')](_0x258592);}};}function respondWithFilteredResult(_0xf660e2,_0x3ad97c){return function(_0x21c3d4){if(_0x21c3d4){var _0x5ef241=_0x21c3d4[_0x4f39('0x1c')],_0x22f61e=_0x3ad97c[_0x4f39('0x1d')],_0x466ecc=_0x3ad97c[_0x4f39('0x1d')]+_0x3ad97c[_0x4f39('0x1e')],_0x4e214d;if(_0x466ecc>=_0x5ef241){_0x466ecc=_0x5ef241;_0x4e214d=0xc8;}else{_0x4e214d=0xce;}_0xf660e2[_0x4f39('0x1a')](_0x4e214d);return _0xf660e2['set'](_0x4f39('0x1f'),_0x22f61e+'-'+_0x466ecc+'/'+_0x5ef241)[_0x4f39('0x1b')](_0x21c3d4);}return null;};}function patchUpdates(_0x1881cc){return function(_0x12c63b){try{jsonpatch['apply'](_0x12c63b,_0x1881cc,!![]);}catch(_0x10d8d9){return BPromise[_0x4f39('0x20')](_0x10d8d9);}return _0x12c63b['save']();};}function saveUpdates(_0x4f1c2f,_0x581ea4){return function(_0x564e38){if(_0x564e38){return _0x564e38[_0x4f39('0x21')](_0x4f1c2f)[_0x4f39('0x22')](function(_0x190c00){return _0x190c00;});}return null;};}function removeEntity(_0x51c441,_0x122f36){return function(_0x21f0c0){if(_0x21f0c0){return _0x21f0c0['destroy']()[_0x4f39('0x22')](function(){_0x51c441['status'](0xcc)[_0x4f39('0x23')]();});}};}function handleEntityNotFound(_0x5330ae,_0x47951c){return function(_0x387d73){if(!_0x387d73){_0x5330ae[_0x4f39('0x24')](0x194);}return _0x387d73;};}function handleError(_0x343dfc,_0x1bf096){_0x1bf096=_0x1bf096||0x1f4;return function(_0x384c9e){logger[_0x4f39('0x25')](_0x384c9e['stack']);if(_0x384c9e[_0x4f39('0x26')]){delete _0x384c9e[_0x4f39('0x26')];}_0x343dfc[_0x4f39('0x1a')](_0x1bf096)['send'](_0x384c9e);};}exports[_0x4f39('0x27')]=function(_0x580f54,_0x223a7c){var _0x13a19e={},_0x165950={},_0x5c595c={'count':0x0,'rows':[]};var _0x273f0c=db[_0x4f39('0x28')][_0x4f39('0x29')];_0x165950[_0x4f39('0x2a')]=_['keys'](_0x273f0c);_0x165950[_0x4f39('0x2b')]=_[_0x4f39('0x2c')](_0x580f54[_0x4f39('0x2b')]);_0x165950[_0x4f39('0x2d')]=_[_0x4f39('0x2e')](_0x165950[_0x4f39('0x2a')],_0x165950['query']);_0x13a19e['attributes']=_[_0x4f39('0x2e')](_0x165950[_0x4f39('0x2a')],qs[_0x4f39('0x2f')](_0x580f54[_0x4f39('0x2b')][_0x4f39('0x2f')]));_0x13a19e[_0x4f39('0x30')]=_0x13a19e[_0x4f39('0x30')]['length']?_0x13a19e['attributes']:_0x165950['model'];if(!_0x580f54[_0x4f39('0x2b')][_0x4f39('0x31')](_0x4f39('0x32'))){_0x13a19e[_0x4f39('0x1e')]=qs[_0x4f39('0x1e')](_0x580f54['query'][_0x4f39('0x1e')]);_0x13a19e['offset']=qs['offset'](_0x580f54[_0x4f39('0x2b')][_0x4f39('0x1d')]);}_0x13a19e[_0x4f39('0x33')]=qs[_0x4f39('0x34')](_0x580f54['query']['sort']);_0x13a19e['where']=qs[_0x4f39('0x2d')](_['pick'](_0x580f54[_0x4f39('0x2b')],_0x165950[_0x4f39('0x2d')]));if(_0x580f54[_0x4f39('0x2b')][_0x4f39('0x35')]){_0x13a19e[_0x4f39('0x36')]=_[_0x4f39('0x37')](_0x13a19e[_0x4f39('0x36')],{'$or':_[_0x4f39('0x38')](_0x273f0c,function(_0x22fdcc){if(_0x22fdcc[_0x4f39('0x39')][_0x4f39('0x3a')]!==_0x4f39('0x3b')){var _0x2a6bd7={};_0x2a6bd7[_0x22fdcc['field']]={'$like':'%'+_0x580f54[_0x4f39('0x2b')][_0x4f39('0x35')]+'%'};return _0x2a6bd7;}})});}_0x13a19e=_['merge']({},_0x13a19e,_0x580f54['options']);var _0x31850b={'where':_0x13a19e[_0x4f39('0x36')]};return db[_0x4f39('0x28')][_0x4f39('0x1c')](_0x31850b)['then'](function(_0x55ec96){_0x5c595c[_0x4f39('0x1c')]=_0x55ec96;if(_0x580f54[_0x4f39('0x2b')]['includeAll']){_0x13a19e['include']=[{'all':!![]}];}return db[_0x4f39('0x28')]['findAll'](_0x13a19e);})[_0x4f39('0x22')](function(_0x42c7d9){_0x5c595c[_0x4f39('0x3c')]=_0x42c7d9;return _0x5c595c;})['then'](respondWithFilteredResult(_0x223a7c,_0x13a19e))['catch'](handleError(_0x223a7c,null));};exports[_0x4f39('0x3d')]=function(_0x1795cd,_0x183275){var _0x4367d1={'raw':!![],'where':{'id':_0x1795cd[_0x4f39('0x3e')]['id']}},_0x36fbff={};_0x36fbff['model']=_[_0x4f39('0x2c')](db[_0x4f39('0x28')]['rawAttributes']);_0x36fbff[_0x4f39('0x2b')]=_[_0x4f39('0x2c')](_0x1795cd[_0x4f39('0x2b')]);_0x36fbff[_0x4f39('0x2d')]=_['intersection'](_0x36fbff[_0x4f39('0x2a')],_0x36fbff[_0x4f39('0x2b')]);_0x4367d1[_0x4f39('0x30')]=_['intersection'](_0x36fbff[_0x4f39('0x2a')],qs['fields'](_0x1795cd[_0x4f39('0x2b')][_0x4f39('0x2f')]));_0x4367d1[_0x4f39('0x30')]=_0x4367d1['attributes']['length']?_0x4367d1[_0x4f39('0x30')]:_0x36fbff['model'];if(_0x1795cd[_0x4f39('0x2b')][_0x4f39('0x3f')]){_0x4367d1[_0x4f39('0x40')]=[{'all':!![]}];}_0x4367d1=_['merge']({},_0x4367d1,_0x1795cd['options']);return db[_0x4f39('0x28')][_0x4f39('0x41')](_0x4367d1)['then'](handleEntityNotFound(_0x183275,null))[_0x4f39('0x22')](respondWithResult(_0x183275,null))[_0x4f39('0x42')](handleError(_0x183275,null));};exports['create']=function(_0x10a6b1,_0x4b2b1f){return db['SquareDetailsReport']['create'](_0x10a6b1[_0x4f39('0x43')],{})[_0x4f39('0x22')](respondWithResult(_0x4b2b1f,0xc9))[_0x4f39('0x42')](handleError(_0x4b2b1f,null));};exports[_0x4f39('0x21')]=function(_0x195df7,_0x49d76c){if(_0x195df7[_0x4f39('0x43')]['id']){delete _0x195df7[_0x4f39('0x43')]['id'];}return db['SquareDetailsReport'][_0x4f39('0x41')]({'where':{'id':_0x195df7['params']['id']}})[_0x4f39('0x22')](handleEntityNotFound(_0x49d76c,null))[_0x4f39('0x22')](saveUpdates(_0x195df7[_0x4f39('0x43')],null))[_0x4f39('0x22')](respondWithResult(_0x49d76c,null))['catch'](handleError(_0x49d76c,null));};exports[_0x4f39('0x44')]=function(_0x882e58,_0x4ebd18){return db[_0x4f39('0x28')][_0x4f39('0x41')]({'where':{'id':_0x882e58[_0x4f39('0x3e')]['id']}})[_0x4f39('0x22')](handleEntityNotFound(_0x4ebd18,null))['then'](removeEntity(_0x4ebd18,null))[_0x4f39('0x42')](handleError(_0x4ebd18,null));};exports[_0x4f39('0x45')]=function(_0x34e70d,_0x4e4dee){return db[_0x4f39('0x28')][_0x4f39('0x45')]()['then'](respondWithResult(_0x4e4dee,null))[_0x4f39('0x42')](handleError(_0x4e4dee,null));};
\ No newline at end of file
+var _0xb945=['squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','ioredis','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','SquareDetailsReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','key','VIRTUAL','field','filter','findAll','rows','catch','show','params','includeAll','include','options','find','create','body','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb945,0x120));var _0x5b94=function(_0x276067,_0xe95243){_0x276067=_0x276067-0x0;var _0x2cbf90=_0xb945[_0x276067];return _0x2cbf90;};'use strict';var pdf=require(_0x5b94('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5b94('0x1'));var zipdir=require(_0x5b94('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5b94('0x3'));var moment=require(_0x5b94('0x4'));var BPromise=require(_0x5b94('0x5'));var Mustache=require(_0x5b94('0x6'));var util=require(_0x5b94('0x7'));var path=require(_0x5b94('0x8'));var sox=require('sox');var csv=require(_0x5b94('0x9'));var ejs=require(_0x5b94('0xa'));var fs=require('fs');var _=require(_0x5b94('0xb'));var squel=require(_0x5b94('0xc'));var crypto=require(_0x5b94('0xd'));var jsforce=require(_0x5b94('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5b94('0x9'));var querystring=require(_0x5b94('0xf'));var Papa=require(_0x5b94('0x10'));var authService=require(_0x5b94('0x11'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x5b94('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0x5b94('0x13'))(_0x5b94('0x14'));var utils=require(_0x5b94('0x15'));var config=require(_0x5b94('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22f9e2,_0x4610de){_0x4610de=_0x4610de||0xcc;return function(_0x3e0dde){if(_0x3e0dde){return _0x22f9e2[_0x5b94('0x17')](_0x4610de);}return _0x22f9e2[_0x5b94('0x18')](_0x4610de)[_0x5b94('0x19')]();};}function respondWithResult(_0x54a9b0,_0x2babae){_0x2babae=_0x2babae||0xc8;return function(_0x3867a5){if(_0x3867a5){return _0x54a9b0[_0x5b94('0x18')](_0x2babae)['json'](_0x3867a5);}};}function respondWithFilteredResult(_0x2bd11f,_0x6aae31){return function(_0x39c47b){if(_0x39c47b){var _0x387d16=_0x39c47b[_0x5b94('0x1a')],_0x1f8589=_0x6aae31['offset'],_0x4efecf=_0x6aae31['offset']+_0x6aae31[_0x5b94('0x1b')],_0x46bfaa;if(_0x4efecf>=_0x387d16){_0x4efecf=_0x387d16;_0x46bfaa=0xc8;}else{_0x46bfaa=0xce;}_0x2bd11f['status'](_0x46bfaa);return _0x2bd11f[_0x5b94('0x1c')]('Content-Range',_0x1f8589+'-'+_0x4efecf+'/'+_0x387d16)[_0x5b94('0x1d')](_0x39c47b);}return null;};}function patchUpdates(_0x1bfb79){return function(_0x57f472){try{jsonpatch[_0x5b94('0x1e')](_0x57f472,_0x1bfb79,!![]);}catch(_0x2f8c5d){return BPromise[_0x5b94('0x1f')](_0x2f8c5d);}return _0x57f472[_0x5b94('0x20')]();};}function saveUpdates(_0x5926b3,_0x578021){return function(_0x2f1d9d){if(_0x2f1d9d){return _0x2f1d9d[_0x5b94('0x21')](_0x5926b3)[_0x5b94('0x22')](function(_0x42b5d3){return _0x42b5d3;});}return null;};}function removeEntity(_0x29f2ba,_0x4d5fd6){return function(_0x76fe62){if(_0x76fe62){return _0x76fe62[_0x5b94('0x23')]()[_0x5b94('0x22')](function(){_0x29f2ba[_0x5b94('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f4f9e,_0x2b20bb){return function(_0x54cf72){if(!_0x54cf72){_0x2f4f9e[_0x5b94('0x17')](0x194);}return _0x54cf72;};}function handleError(_0x986720,_0x2af526){_0x2af526=_0x2af526||0x1f4;return function(_0x23a553){logger[_0x5b94('0x24')](_0x23a553[_0x5b94('0x25')]);if(_0x23a553[_0x5b94('0x26')]){delete _0x23a553[_0x5b94('0x26')];}_0x986720[_0x5b94('0x18')](_0x2af526)[_0x5b94('0x27')](_0x23a553);};}exports[_0x5b94('0x28')]=function(_0x587075,_0x5d445a){var _0xb8d786={},_0x42b406={},_0x15e4b5={'count':0x0,'rows':[]};var _0x3eeaff=db[_0x5b94('0x29')][_0x5b94('0x2a')];_0x42b406[_0x5b94('0x2b')]=_[_0x5b94('0x2c')](_0x3eeaff);_0x42b406[_0x5b94('0x2d')]=_['keys'](_0x587075[_0x5b94('0x2d')]);_0x42b406[_0x5b94('0x2e')]=_[_0x5b94('0x2f')](_0x42b406[_0x5b94('0x2b')],_0x42b406[_0x5b94('0x2d')]);_0xb8d786[_0x5b94('0x30')]=_[_0x5b94('0x2f')](_0x42b406['model'],qs['fields'](_0x587075[_0x5b94('0x2d')][_0x5b94('0x31')]));_0xb8d786[_0x5b94('0x30')]=_0xb8d786[_0x5b94('0x30')][_0x5b94('0x32')]?_0xb8d786['attributes']:_0x42b406[_0x5b94('0x2b')];if(!_0x587075[_0x5b94('0x2d')][_0x5b94('0x33')](_0x5b94('0x34'))){_0xb8d786[_0x5b94('0x1b')]=qs[_0x5b94('0x1b')](_0x587075[_0x5b94('0x2d')]['limit']);_0xb8d786['offset']=qs[_0x5b94('0x35')](_0x587075['query'][_0x5b94('0x35')]);}_0xb8d786[_0x5b94('0x36')]=qs[_0x5b94('0x37')](_0x587075['query'][_0x5b94('0x37')]);_0xb8d786[_0x5b94('0x38')]=qs['filters'](_[_0x5b94('0x39')](_0x587075[_0x5b94('0x2d')],_0x42b406[_0x5b94('0x2e')]));if(_0x587075[_0x5b94('0x2d')]['filter']){_0xb8d786[_0x5b94('0x38')]=_[_0x5b94('0x3a')](_0xb8d786[_0x5b94('0x38')],{'$or':_['map'](_0x3eeaff,function(_0x28c940){if(_0x28c940['type'][_0x5b94('0x3b')]!==_0x5b94('0x3c')){var _0x2b7b87={};_0x2b7b87[_0x28c940[_0x5b94('0x3d')]]={'$like':'%'+_0x587075[_0x5b94('0x2d')][_0x5b94('0x3e')]+'%'};return _0x2b7b87;}})});}_0xb8d786=_[_0x5b94('0x3a')]({},_0xb8d786,_0x587075['options']);var _0xc520b6={'where':_0xb8d786['where']};return db[_0x5b94('0x29')][_0x5b94('0x1a')](_0xc520b6)[_0x5b94('0x22')](function(_0x16dadd){_0x15e4b5[_0x5b94('0x1a')]=_0x16dadd;if(_0x587075[_0x5b94('0x2d')]['includeAll']){_0xb8d786['include']=[{'all':!![]}];}return db[_0x5b94('0x29')][_0x5b94('0x3f')](_0xb8d786);})[_0x5b94('0x22')](function(_0x9e14f4){_0x15e4b5[_0x5b94('0x40')]=_0x9e14f4;return _0x15e4b5;})[_0x5b94('0x22')](respondWithFilteredResult(_0x5d445a,_0xb8d786))[_0x5b94('0x41')](handleError(_0x5d445a,null));};exports[_0x5b94('0x42')]=function(_0x98a98b,_0x49456c){var _0xd40c18={'raw':!![],'where':{'id':_0x98a98b[_0x5b94('0x43')]['id']}},_0x5f36de={};_0x5f36de[_0x5b94('0x2b')]=_[_0x5b94('0x2c')](db[_0x5b94('0x29')][_0x5b94('0x2a')]);_0x5f36de[_0x5b94('0x2d')]=_['keys'](_0x98a98b[_0x5b94('0x2d')]);_0x5f36de[_0x5b94('0x2e')]=_[_0x5b94('0x2f')](_0x5f36de[_0x5b94('0x2b')],_0x5f36de['query']);_0xd40c18['attributes']=_[_0x5b94('0x2f')](_0x5f36de[_0x5b94('0x2b')],qs[_0x5b94('0x31')](_0x98a98b['query'][_0x5b94('0x31')]));_0xd40c18['attributes']=_0xd40c18['attributes']['length']?_0xd40c18[_0x5b94('0x30')]:_0x5f36de[_0x5b94('0x2b')];if(_0x98a98b[_0x5b94('0x2d')][_0x5b94('0x44')]){_0xd40c18[_0x5b94('0x45')]=[{'all':!![]}];}_0xd40c18=_[_0x5b94('0x3a')]({},_0xd40c18,_0x98a98b[_0x5b94('0x46')]);return db[_0x5b94('0x29')][_0x5b94('0x47')](_0xd40c18)[_0x5b94('0x22')](handleEntityNotFound(_0x49456c,null))[_0x5b94('0x22')](respondWithResult(_0x49456c,null))[_0x5b94('0x41')](handleError(_0x49456c,null));};exports[_0x5b94('0x48')]=function(_0x31e0bd,_0x2fbdf9){return db[_0x5b94('0x29')][_0x5b94('0x48')](_0x31e0bd[_0x5b94('0x49')],{})[_0x5b94('0x22')](respondWithResult(_0x2fbdf9,0xc9))[_0x5b94('0x41')](handleError(_0x2fbdf9,null));};exports[_0x5b94('0x21')]=function(_0x3e8c42,_0x49ed99){if(_0x3e8c42['body']['id']){delete _0x3e8c42[_0x5b94('0x49')]['id'];}return db[_0x5b94('0x29')][_0x5b94('0x47')]({'where':{'id':_0x3e8c42[_0x5b94('0x43')]['id']}})['then'](handleEntityNotFound(_0x49ed99,null))[_0x5b94('0x22')](saveUpdates(_0x3e8c42[_0x5b94('0x49')],null))[_0x5b94('0x22')](respondWithResult(_0x49ed99,null))[_0x5b94('0x41')](handleError(_0x49ed99,null));};exports[_0x5b94('0x23')]=function(_0x39ef14,_0x2583d1){return db[_0x5b94('0x29')][_0x5b94('0x47')]({'where':{'id':_0x39ef14['params']['id']}})[_0x5b94('0x22')](handleEntityNotFound(_0x2583d1,null))['then'](removeEntity(_0x2583d1,null))['catch'](handleError(_0x2583d1,null));};exports[_0x5b94('0x4a')]=function(_0x2297bf,_0xbeea14){return db[_0x5b94('0x29')]['describe']()[_0x5b94('0x22')](respondWithResult(_0xbeea14,null))['catch'](handleError(_0xbeea14,null));};
\ No newline at end of file
index dc5ae01..cb3dc06 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa990=['request-promise','exports','define','SquareDetailsReport','report_square_details','lodash','util','api','moment'];(function(_0x3cddcb,_0x5e0bbd){var _0x3878e8=function(_0x12afc9){while(--_0x12afc9){_0x3cddcb['push'](_0x3cddcb['shift']());}};_0x3878e8(++_0x5e0bbd);}(_0xa990,0xb0));var _0x0a99=function(_0x2398a5,_0x1823e9){_0x2398a5=_0x2398a5-0x0;var _0x646ee9=_0xa990[_0x2398a5];return _0x646ee9;};'use strict';var _=require(_0x0a99('0x0'));var util=require(_0x0a99('0x1'));var logger=require('../../config/logger')(_0x0a99('0x2'));var moment=require(_0x0a99('0x3'));var BPromise=require('bluebird');var rp=require(_0x0a99('0x4'));var attributes=require('./squareReportDetail.attributes');module[_0x0a99('0x5')]=function(_0xa534e2,_0x3fe165){return _0xa534e2[_0x0a99('0x6')](_0x0a99('0x7'),attributes,{'tableName':_0x0a99('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x4a1c=['request-promise','./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4f6de1,_0xd96515){var _0x3f5b39=function(_0x315b60){while(--_0x315b60){_0x4f6de1['push'](_0x4f6de1['shift']());}};_0x3f5b39(++_0xd96515);}(_0x4a1c,0xe1));var _0xc4a1=function(_0x504f7b,_0x1ac4e0){_0x504f7b=_0x504f7b-0x0;var _0x2b0904=_0x4a1c[_0x504f7b];return _0x2b0904;};'use strict';var _=require(_0xc4a1('0x0'));var util=require(_0xc4a1('0x1'));var logger=require(_0xc4a1('0x2'))('api');var moment=require(_0xc4a1('0x3'));var BPromise=require(_0xc4a1('0x4'));var rp=require(_0xc4a1('0x5'));var attributes=require(_0xc4a1('0x6'));module['exports']=function(_0x384b9,_0x52f6df){return _0x384b9[_0xc4a1('0x7')](_0xc4a1('0x8'),attributes,{'tableName':_0xc4a1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 1fb661b..a2f9c35 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4b47=['create','body','options','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport'];(function(_0x158f54,_0x28bd12){var _0x2faf3c=function(_0x9457a6){while(--_0x9457a6){_0x158f54['push'](_0x158f54['shift']());}};_0x2faf3c(++_0x28bd12);}(_0x4b47,0x1b4));var _0x74b4=function(_0x560f55,_0x1372c1){_0x560f55=_0x560f55-0x0;var _0x499fa4=_0x4b47[_0x560f55];return _0x499fa4;};'use strict';var _=require(_0x74b4('0x0'));var util=require('util');var moment=require(_0x74b4('0x1'));var BPromise=require(_0x74b4('0x2'));var rs=require(_0x74b4('0x3'));var fs=require('fs');var Redis=require(_0x74b4('0x4'));var db=require(_0x74b4('0x5'))['db'];var utils=require(_0x74b4('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x74b4('0x7'));var jayson=require(_0x74b4('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x482278,_0x43b434,_0x75ea22){return new BPromise(function(_0x1ebbb8,_0x318a0a){return client[_0x74b4('0x9')](_0x482278,_0x75ea22)['then'](function(_0x531be6){logger[_0x74b4('0xa')](_0x74b4('0xb'),_0x43b434,'request\x20sent');logger['debug']('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x43b434,_0x74b4('0xc'),JSON[_0x74b4('0xd')](_0x531be6));if(_0x531be6[_0x74b4('0xe')]){if(_0x531be6[_0x74b4('0xe')]['code']===0x1f4){logger[_0x74b4('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x43b434,_0x531be6[_0x74b4('0xe')]['message']);return _0x318a0a(_0x531be6[_0x74b4('0xe')][_0x74b4('0xf')]);}logger[_0x74b4('0xe')](_0x74b4('0xb'),_0x43b434,_0x531be6['error'][_0x74b4('0xf')]);return _0x1ebbb8(_0x531be6[_0x74b4('0xe')]['message']);}else{logger[_0x74b4('0xa')](_0x74b4('0xb'),_0x43b434,_0x74b4('0xc'));_0x1ebbb8(_0x531be6[_0x74b4('0x10')]['message']);}})[_0x74b4('0x11')](function(_0x3906ad){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x43b434,_0x3906ad);_0x318a0a(_0x3906ad);});});}exports[_0x74b4('0x12')]=function(_0x9bbab0){var _0x100630=this;return new Promise(function(_0x4141bb,_0x11c268){return db[_0x74b4('0x13')][_0x74b4('0x14')](_0x9bbab0[_0x74b4('0x15')],{'raw':_0x9bbab0[_0x74b4('0x16')]?_0x9bbab0[_0x74b4('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3d74d4){logger[_0x74b4('0xa')]('CreateSquareDetailsReport',_0x9bbab0);logger[_0x74b4('0x17')]('CreateSquareDetailsReport',_0x9bbab0,JSON['stringify'](_0x3d74d4));_0x4141bb(_0x3d74d4);})[_0x74b4('0x11')](function(_0x437f79){logger[_0x74b4('0xe')](_0x74b4('0x12'),_0x437f79['message'],_0x9bbab0);_0x11c268(_0x100630['error'](0x1f4,_0x437f79[_0x74b4('0xf')]));});});};
\ No newline at end of file
+var _0x5a5a=['info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0x23f50a,_0x1e0fbc){var _0x3d48e2=function(_0x103d6e){while(--_0x103d6e){_0x23f50a['push'](_0x23f50a['shift']());}};_0x3d48e2(++_0x1e0fbc);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x37b2ce,_0x5a6096){_0x37b2ce=_0x37b2ce-0x0;var _0x18e96a=_0x5a5a[_0x37b2ce];return _0x18e96a;};'use strict';var _=require('lodash');var util=require(_0xa5a5('0x0'));var moment=require(_0xa5a5('0x1'));var BPromise=require(_0xa5a5('0x2'));var rs=require(_0xa5a5('0x3'));var fs=require('fs');var Redis=require(_0xa5a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa5a5('0x5'));var logger=require(_0xa5a5('0x6'))(_0xa5a5('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa5a5('0x8')][_0xa5a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5691f1,_0x3ea00f,_0xf2ea20){return new BPromise(function(_0x1234c2,_0x3a23f4){return client[_0xa5a5('0xa')](_0x5691f1,_0xf2ea20)['then'](function(_0x158a80){logger[_0xa5a5('0xb')](_0xa5a5('0xc'),_0x3ea00f,_0xa5a5('0xd'));logger[_0xa5a5('0xe')](_0xa5a5('0xf'),_0x3ea00f,_0xa5a5('0xd'),JSON[_0xa5a5('0x10')](_0x158a80));if(_0x158a80[_0xa5a5('0x11')]){if(_0x158a80[_0xa5a5('0x11')][_0xa5a5('0x12')]===0x1f4){logger[_0xa5a5('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x3ea00f,_0x158a80[_0xa5a5('0x11')][_0xa5a5('0x13')]);return _0x3a23f4(_0x158a80[_0xa5a5('0x11')][_0xa5a5('0x13')]);}logger[_0xa5a5('0x11')](_0xa5a5('0xc'),_0x3ea00f,_0x158a80['error'][_0xa5a5('0x13')]);return _0x1234c2(_0x158a80[_0xa5a5('0x11')][_0xa5a5('0x13')]);}else{logger[_0xa5a5('0xb')](_0xa5a5('0xc'),_0x3ea00f,_0xa5a5('0xd'));_0x1234c2(_0x158a80[_0xa5a5('0x14')][_0xa5a5('0x13')]);}})['catch'](function(_0x3ef56e){logger[_0xa5a5('0x11')](_0xa5a5('0xc'),_0x3ea00f,_0x3ef56e);_0x3a23f4(_0x3ef56e);});});}exports[_0xa5a5('0x15')]=function(_0x3c4cae){var _0x12e2f2=this;return new Promise(function(_0x28c89f,_0x519924){return db[_0xa5a5('0x16')][_0xa5a5('0x17')](_0x3c4cae[_0xa5a5('0x18')],{'raw':_0x3c4cae[_0xa5a5('0x19')]?_0x3c4cae['options'][_0xa5a5('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x2554c0){logger[_0xa5a5('0xb')](_0xa5a5('0x15'),_0x3c4cae);logger[_0xa5a5('0xe')]('CreateSquareDetailsReport',_0x3c4cae,JSON['stringify'](_0x2554c0));_0x28c89f(_0x2554c0);})[_0xa5a5('0x1b')](function(_0x1a258f){logger[_0xa5a5('0x11')]('CreateSquareDetailsReport',_0x1a258f[_0xa5a5('0x13')],_0x3c4cae);_0x519924(_0x12e2f2['error'](0x1f4,_0x1a258f[_0xa5a5('0x13')]));});});};
\ No newline at end of file
index 5f719e2..fc97a93 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5007=['get','index','isAuthenticated','killProcess','exports','express','Router','../../components/auth/service','./system.controller'];(function(_0x6dda45,_0x132e99){var _0x3e8915=function(_0x2e7395){while(--_0x2e7395){_0x6dda45['push'](_0x6dda45['shift']());}};_0x3e8915(++_0x132e99);}(_0x5007,0xcb));var _0x7500=function(_0x4c9f24,_0x3caf4f){_0x4c9f24=_0x4c9f24-0x0;var _0x35391d=_0x5007[_0x4c9f24];return _0x35391d;};'use strict';var express=require(_0x7500('0x0'));var router=express[_0x7500('0x1')]();var auth=require(_0x7500('0x2'));var controller=require(_0x7500('0x3'));router[_0x7500('0x4')]('/',auth['isAuthenticated'](),controller[_0x7500('0x5')]);router[_0x7500('0x4')]('/process/:pid/kill',auth[_0x7500('0x6')](),controller[_0x7500('0x7')]);module[_0x7500('0x8')]=router;
\ No newline at end of file
+var _0xb247=['Router','../../components/auth/service','./system.controller','get','isAuthenticated','/process/:pid/kill','express'];(function(_0x5640b7,_0x48379b){var _0x1dece2=function(_0x41fd7e){while(--_0x41fd7e){_0x5640b7['push'](_0x5640b7['shift']());}};_0x1dece2(++_0x48379b);}(_0xb247,0x13a));var _0x7b24=function(_0x310990,_0x245984){_0x310990=_0x310990-0x0;var _0x648534=_0xb247[_0x310990];return _0x648534;};'use strict';var express=require(_0x7b24('0x0'));var router=express[_0x7b24('0x1')]();var auth=require(_0x7b24('0x2'));var controller=require(_0x7b24('0x3'));router[_0x7b24('0x4')]('/',auth[_0x7b24('0x5')](),controller['index']);router[_0x7b24('0x4')](_0x7b24('0x6'),auth[_0x7b24('0x5')](),controller['killProcess']);module['exports']=router;
\ No newline at end of file
index 19b2bf8..ebca7c8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8b24=['bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','send','getAllData','then','json','killProcess','format','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','SIGINT','status','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process','exec','../../config/logger','api','util'];(function(_0x22f7d1,_0x19996f){var _0x32967b=function(_0x516fc3){while(--_0x516fc3){_0x22f7d1['push'](_0x22f7d1['shift']());}};_0x32967b(++_0x19996f);}(_0x8b24,0x1e8));var _0x48b2=function(_0x477c6b,_0x73b37e){_0x477c6b=_0x477c6b-0x0;var _0x1ecdcc=_0x8b24[_0x477c6b];return _0x1ecdcc;};'use strict';var info=require(_0x48b2('0x0'));var exec=require(_0x48b2('0x1'))[_0x48b2('0x2')];var logger=require(_0x48b2('0x3'))(_0x48b2('0x4'));var util=require(_0x48b2('0x5'));var BPromise=require(_0x48b2('0x6'));var _=require('lodash');function handleError(_0x38ea4a,_0x3bd045,_0x5b5689){_0x3bd045=_0x3bd045||0x1f4;return function(_0x4b816c){logger[_0x48b2('0x7')](_0x48b2('0x8'),_0x5b5689,_0x3bd045,util['inspect'](_0x4b816c,{'showHidden':![],'depth':null}));delete _0x4b816c[_0x48b2('0x9')];_0x38ea4a['status'](_0x3bd045)[_0x48b2('0xa')](_0x4b816c);};}exports['index']=function(_0x31f943,_0x5a1e14){return info[_0x48b2('0xb')]()[_0x48b2('0xc')](function(_0x510fca){return _0x5a1e14['status'](0xc8)[_0x48b2('0xd')](_0x510fca);})['catch'](function(_0x299215){return _0x5a1e14['status'](0x1f4)['json'](_0x299215);});};exports[_0x48b2('0xe')]=function(_0x5df67e,_0x3fe976){var _0x50657f=['components/import/cm'];return new BPromise(function(_0x4d9dd9,_0x58d120){return exec(util[_0x48b2('0xf')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x5df67e['params'][_0x48b2('0x10')]),function(_0x3f9d5b,_0x456221,_0x293302){if(_0x3f9d5b){return _0x58d120(_0x3f9d5b);}return _0x4d9dd9(_0x456221);});})['then'](function(_0x40f9e6){var _0x5e841d=![];var _0x24f16c=_0x40f9e6[_0x48b2('0x11')](/\n/);for(var _0x5714f3=0x0,_0x431ecf=_0x50657f[_0x48b2('0x12')];_0x5714f3<_0x431ecf,_0x5e841d===![];_0x5714f3+=0x1){if(_0x40f9e6[_0x48b2('0x13')](_0x50657f[_0x5714f3])>=0x0){_0x5e841d=!![];}}if(!_0x5e841d){throw new Error(util[_0x48b2('0xf')](_0x48b2('0x14'),_0x5df67e[_0x48b2('0x15')][_0x48b2('0x10')]));}process['kill'](_0x5df67e[_0x48b2('0x15')][_0x48b2('0x10')],_0x48b2('0x16'));return _0x3fe976[_0x48b2('0x17')](0xc8)[_0x48b2('0xd')]({'message':util[_0x48b2('0xf')](_0x48b2('0x18'),_0x5df67e[_0x48b2('0x15')][_0x48b2('0x10')])});})[_0x48b2('0x19')](handleError(_0x3fe976,null,_0x48b2('0xe')));};
\ No newline at end of file
+var _0xd044=['inspect','name','status','send','index','getAllData','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','then','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','api','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s'];(function(_0x45a0d1,_0x3a721e){var _0x2c2a9e=function(_0x3ff9ff){while(--_0x3ff9ff){_0x45a0d1['push'](_0x45a0d1['shift']());}};_0x2c2a9e(++_0x3a721e);}(_0xd044,0x10d));var _0x4d04=function(_0xa8d025,_0x3a5cbe){_0xa8d025=_0xa8d025-0x0;var _0x29e44e=_0xd044[_0xa8d025];return _0x29e44e;};'use strict';var info=require(_0x4d04('0x0'));var exec=require(_0x4d04('0x1'))[_0x4d04('0x2')];var logger=require('../../config/logger')(_0x4d04('0x3'));var util=require('util');var BPromise=require('bluebird');var _=require(_0x4d04('0x4'));function handleError(_0x36bfa5,_0x491947,_0x4b5fa8){_0x491947=_0x491947||0x1f4;return function(_0x297dd5){logger['error'](_0x4d04('0x5'),_0x4b5fa8,_0x491947,util[_0x4d04('0x6')](_0x297dd5,{'showHidden':![],'depth':null}));delete _0x297dd5[_0x4d04('0x7')];_0x36bfa5[_0x4d04('0x8')](_0x491947)[_0x4d04('0x9')](_0x297dd5);};}exports[_0x4d04('0xa')]=function(_0x2d0058,_0x55e2e1){return info[_0x4d04('0xb')]()['then'](function(_0x2ed942){return _0x55e2e1[_0x4d04('0x8')](0xc8)[_0x4d04('0xc')](_0x2ed942);})[_0x4d04('0xd')](function(_0x2a1bfb){return _0x55e2e1[_0x4d04('0x8')](0x1f4)[_0x4d04('0xc')](_0x2a1bfb);});};exports[_0x4d04('0xe')]=function(_0x39674b,_0x534d99){var _0x4fcb3a=[_0x4d04('0xf')];return new BPromise(function(_0x1e2491,_0x468f54){return exec(util[_0x4d04('0x10')](_0x4d04('0x11'),_0x39674b['params'][_0x4d04('0x12')]),function(_0x5d483f,_0x120c5f,_0x5e7c1c){if(_0x5d483f){return _0x468f54(_0x5d483f);}return _0x1e2491(_0x120c5f);});})[_0x4d04('0x13')](function(_0x425b92){var _0x4ff914=![];var _0x580196=_0x425b92[_0x4d04('0x14')](/\n/);for(var _0x20ffdb=0x0,_0x164e8f=_0x4fcb3a['length'];_0x20ffdb<_0x164e8f,_0x4ff914===![];_0x20ffdb+=0x1){if(_0x425b92[_0x4d04('0x15')](_0x4fcb3a[_0x20ffdb])>=0x0){_0x4ff914=!![];}}if(!_0x4ff914){throw new Error(util[_0x4d04('0x10')](_0x4d04('0x16'),_0x39674b[_0x4d04('0x17')][_0x4d04('0x12')]));}process['kill'](_0x39674b['params'][_0x4d04('0x12')],'SIGINT');return _0x534d99['status'](0xc8)[_0x4d04('0xc')]({'message':util[_0x4d04('0x10')](_0x4d04('0x18'),_0x39674b[_0x4d04('0x17')][_0x4d04('0x12')])});})[_0x4d04('0xd')](handleError(_0x534d99,null,_0x4d04('0xe')));};
\ No newline at end of file
index 7c53b48..4641684 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x14a0=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','put','/:id','destroy','exports','util','path'];(function(_0x56fb3c,_0x3474f2){var _0x2261f8=function(_0x382b0e){while(--_0x382b0e){_0x56fb3c['push'](_0x56fb3c['shift']());}};_0x2261f8(++_0x3474f2);}(_0x14a0,0x8e));var _0x014a=function(_0x10572c,_0x33255c){_0x10572c=_0x10572c-0x0;var _0x2af024=_0x14a0[_0x10572c];return _0x2af024;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var auth=require(_0x014a('0x5'));var interaction=require(_0x014a('0x6'));var config=require('../../config/environment');var controller=require('./tag.controller');router[_0x014a('0x7')]('/',auth[_0x014a('0x8')](),controller[_0x014a('0x9')]);router['get']('/:id',auth[_0x014a('0x8')](),controller[_0x014a('0xa')]);router[_0x014a('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x014a('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x014a('0xd'),auth['isAuthenticated'](),controller[_0x014a('0xe')]);module[_0x014a('0xf')]=router;
\ No newline at end of file
+var _0x1a85=['express','../../components/interaction/service','../../config/environment','./tag.controller','isAuthenticated','get','show','/:id','update','delete','destroy','exports','path','connect-timeout'];(function(_0x145b61,_0x5c8355){var _0x45dd44=function(_0x2c932f){while(--_0x2c932f){_0x145b61['push'](_0x145b61['shift']());}};_0x45dd44(++_0x5c8355);}(_0x1a85,0x178));var _0x51a8=function(_0x3cfaea,_0x59581c){_0x3cfaea=_0x3cfaea-0x0;var _0x5131f6=_0x1a85[_0x3cfaea];return _0x5131f6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x51a8('0x0'));var timeout=require(_0x51a8('0x1'));var express=require(_0x51a8('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x51a8('0x3'));var config=require(_0x51a8('0x4'));var controller=require(_0x51a8('0x5'));router['get']('/',auth[_0x51a8('0x6')](),controller['index']);router[_0x51a8('0x7')]('/:id',auth[_0x51a8('0x6')](),controller[_0x51a8('0x8')]);router['post']('/',auth[_0x51a8('0x6')](),controller['create']);router['put'](_0x51a8('0x9'),auth[_0x51a8('0x6')](),controller[_0x51a8('0xa')]);router[_0x51a8('0xb')](_0x51a8('0x9'),auth[_0x51a8('0x6')](),controller[_0x51a8('0xc')]);module[_0x51a8('0xd')]=router;
\ No newline at end of file
index e866a4c..8d4ea74 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xca86=['sequelize','exports','STRING','name','#0091EA'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xca86,0x7d));var _0x6ca8=function(_0x5a412e,_0x13a9e6){_0x5a412e=_0x5a412e-0x0;var _0x305d5d=_0xca86[_0x5a412e];return _0x305d5d;};'use strict';var Sequelize=require(_0x6ca8('0x0'));module[_0x6ca8('0x1')]={'name':{'type':Sequelize[_0x6ca8('0x2')],'unique':_0x6ca8('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x6ca8('0x2')],'defaultValue':_0x6ca8('0x4')},'description':{'type':Sequelize[_0x6ca8('0x2')]}};
\ No newline at end of file
+var _0x112d=['name','#0091EA','sequelize'];(function(_0x226c96,_0x4ca425){var _0x531e12=function(_0x464f6b){while(--_0x464f6b){_0x226c96['push'](_0x226c96['shift']());}};_0x531e12(++_0x4ca425);}(_0x112d,0xd7));var _0xd112=function(_0x296fc3,_0x79efa6){_0x296fc3=_0x296fc3-0x0;var _0x43292f=_0x112d[_0x296fc3];return _0x43292f;};'use strict';var Sequelize=require(_0xd112('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xd112('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0xd112('0x2')},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
index d6a50c5..707bd03 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd117=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/utils','sendStatus','end','status','json','count','offset','limit','set','Content-Range','save','update','then','get','Tags','UserProfileResource','destroy','error','stack','name','send','rawAttributes','keys','query','intersection','model','attributes','hasOwnProperty','filters','pick','filter','where','merge','map','type','VIRTUAL','field','Tag','include','findAll','catch','params','fields','length','includeAll','options','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation'];(function(_0x10ff83,_0x385832){var _0xb99351=function(_0x5edcdf){while(--_0x5edcdf){_0x10ff83['push'](_0x10ff83['shift']());}};_0xb99351(++_0x385832);}(_0xd117,0x182));var _0x7d11=function(_0x3e0b8f,_0x1cddeb){_0x3e0b8f=_0x3e0b8f-0x0;var _0x22f742=_0xd117[_0x3e0b8f];return _0x22f742;};'use strict';var pdf=require(_0x7d11('0x0'));var emlformat=require(_0x7d11('0x1'));var rimraf=require(_0x7d11('0x2'));var zipdir=require(_0x7d11('0x3'));var jsonpatch=require(_0x7d11('0x4'));var rp=require(_0x7d11('0x5'));var moment=require(_0x7d11('0x6'));var BPromise=require(_0x7d11('0x7'));var Mustache=require(_0x7d11('0x8'));var util=require(_0x7d11('0x9'));var path=require(_0x7d11('0xa'));var sox=require(_0x7d11('0xb'));var csv=require(_0x7d11('0xc'));var ejs=require(_0x7d11('0xd'));var fs=require('fs');var _=require(_0x7d11('0xe'));var squel=require(_0x7d11('0xf'));var crypto=require('crypto');var jsforce=require(_0x7d11('0x10'));var deskjs=require(_0x7d11('0x11'));var toCsv=require(_0x7d11('0xc'));var querystring=require('querystring');var Papa=require(_0x7d11('0x12'));var authService=require(_0x7d11('0x13'));var hardwareService=require(_0x7d11('0x14'));var Redis=require('ioredis');var qs=require(_0x7d11('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x7d11('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc52a95,_0x48f576){_0x48f576=_0x48f576||0xcc;return function(_0x4767d5){if(_0x4767d5){return _0xc52a95[_0x7d11('0x17')](_0x48f576);}return _0xc52a95['status'](_0x48f576)[_0x7d11('0x18')]();};}function respondWithResult(_0x20f519,_0x4cda5d){_0x4cda5d=_0x4cda5d||0xc8;return function(_0x324de5){if(_0x324de5){return _0x20f519[_0x7d11('0x19')](_0x4cda5d)[_0x7d11('0x1a')](_0x324de5);}};}function respondWithFilteredResult(_0x2978da,_0x417e2d){return function(_0xeae744){if(_0xeae744){var _0x2a269e=_0xeae744[_0x7d11('0x1b')],_0xb1669e=_0x417e2d[_0x7d11('0x1c')],_0x4aa795=_0x417e2d[_0x7d11('0x1c')]+_0x417e2d[_0x7d11('0x1d')],_0x1db0df;if(_0x4aa795>=_0x2a269e){_0x4aa795=_0x2a269e;_0x1db0df=0xc8;}else{_0x1db0df=0xce;}_0x2978da['status'](_0x1db0df);return _0x2978da[_0x7d11('0x1e')](_0x7d11('0x1f'),_0xb1669e+'-'+_0x4aa795+'/'+_0x2a269e)['json'](_0xeae744);}return null;};}function patchUpdates(_0x5459df){return function(_0x2ca3a2){try{jsonpatch['apply'](_0x2ca3a2,_0x5459df,!![]);}catch(_0x1f9990){return BPromise['reject'](_0x1f9990);}return _0x2ca3a2[_0x7d11('0x20')]();};}function saveUpdates(_0x17e539,_0x328f8e){return function(_0x46f662){if(_0x46f662){return _0x46f662[_0x7d11('0x21')](_0x17e539)[_0x7d11('0x22')](function(_0x4297f8){return _0x4297f8;});}return null;};}function removeEntity(_0x3d2574,_0x5680cb){return function(_0x441917){if(_0x441917){return _0x441917['destroy']()['then'](function(){var _0x5c3898=_0x441917[_0x7d11('0x23')]({'plain':!![]});var _0x3545dc=_0x7d11('0x24');return db[_0x7d11('0x25')][_0x7d11('0x26')]({'where':{'type':_0x3545dc,'resourceId':_0x5c3898['id']}})[_0x7d11('0x22')](function(){return _0x441917;});})[_0x7d11('0x22')](function(){_0x3d2574[_0x7d11('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36c2b4,_0x577ca9){return function(_0x4bfa76){if(!_0x4bfa76){_0x36c2b4['sendStatus'](0x194);}return _0x4bfa76;};}function handleError(_0x3ba092,_0x59cdba){_0x59cdba=_0x59cdba||0x1f4;return function(_0x180e1e){logger[_0x7d11('0x27')](_0x180e1e[_0x7d11('0x28')]);if(_0x180e1e['name']){delete _0x180e1e[_0x7d11('0x29')];}_0x3ba092[_0x7d11('0x19')](_0x59cdba)[_0x7d11('0x2a')](_0x180e1e);};}exports['index']=function(_0x601650,_0x35a789){var _0x18c049={},_0x38f1be={},_0x4c7d6a={'count':0x0,'rows':[]};var _0x1a7745=db['Tag'][_0x7d11('0x2b')];_0x38f1be['model']=_[_0x7d11('0x2c')](_0x1a7745);_0x38f1be[_0x7d11('0x2d')]=_[_0x7d11('0x2c')](_0x601650['query']);_0x38f1be['filters']=_[_0x7d11('0x2e')](_0x38f1be[_0x7d11('0x2f')],_0x38f1be['query']);_0x18c049[_0x7d11('0x30')]=_[_0x7d11('0x2e')](_0x38f1be[_0x7d11('0x2f')],qs['fields'](_0x601650[_0x7d11('0x2d')]['fields']));_0x18c049['attributes']=_0x18c049[_0x7d11('0x30')]['length']?_0x18c049[_0x7d11('0x30')]:_0x38f1be[_0x7d11('0x2f')];if(!_0x601650[_0x7d11('0x2d')][_0x7d11('0x31')]('nolimit')){_0x18c049[_0x7d11('0x1d')]=qs[_0x7d11('0x1d')](_0x601650['query']['limit']);_0x18c049[_0x7d11('0x1c')]=qs[_0x7d11('0x1c')](_0x601650['query'][_0x7d11('0x1c')]);}_0x18c049['order']=qs['sort'](_0x601650[_0x7d11('0x2d')]['sort']);_0x18c049['where']=qs[_0x7d11('0x32')](_[_0x7d11('0x33')](_0x601650[_0x7d11('0x2d')],_0x38f1be[_0x7d11('0x32')]));if(_0x601650[_0x7d11('0x2d')][_0x7d11('0x34')]){_0x18c049[_0x7d11('0x35')]=_[_0x7d11('0x36')](_0x18c049[_0x7d11('0x35')],{'$or':_[_0x7d11('0x37')](_0x1a7745,function(_0x1a9f18){if(_0x1a9f18[_0x7d11('0x38')]['key']!==_0x7d11('0x39')){var _0x49d16b={};_0x49d16b[_0x1a9f18[_0x7d11('0x3a')]]={'$like':'%'+_0x601650[_0x7d11('0x2d')][_0x7d11('0x34')]+'%'};return _0x49d16b;}})});}_0x18c049=_[_0x7d11('0x36')]({},_0x18c049,_0x601650['options']);var _0xd36cd3={'where':_0x18c049[_0x7d11('0x35')]};return db[_0x7d11('0x3b')][_0x7d11('0x1b')](_0xd36cd3)['then'](function(_0x22730e){_0x4c7d6a['count']=_0x22730e;if(_0x601650[_0x7d11('0x2d')]['includeAll']){_0x18c049[_0x7d11('0x3c')]=[{'all':!![]}];}return db[_0x7d11('0x3b')][_0x7d11('0x3d')](_0x18c049);})[_0x7d11('0x22')](function(_0x52c28b){_0x4c7d6a['rows']=_0x52c28b;return _0x4c7d6a;})[_0x7d11('0x22')](respondWithFilteredResult(_0x35a789,_0x18c049))[_0x7d11('0x3e')](handleError(_0x35a789,null));};exports['show']=function(_0x1caef9,_0x28c4ce){var _0x3563e7={'raw':!![],'where':{'id':_0x1caef9[_0x7d11('0x3f')]['id']}},_0x77e1e8={};_0x77e1e8[_0x7d11('0x2f')]=_['keys'](db[_0x7d11('0x3b')]['rawAttributes']);_0x77e1e8[_0x7d11('0x2d')]=_[_0x7d11('0x2c')](_0x1caef9[_0x7d11('0x2d')]);_0x77e1e8[_0x7d11('0x32')]=_[_0x7d11('0x2e')](_0x77e1e8[_0x7d11('0x2f')],_0x77e1e8['query']);_0x3563e7['attributes']=_['intersection'](_0x77e1e8[_0x7d11('0x2f')],qs[_0x7d11('0x40')](_0x1caef9[_0x7d11('0x2d')][_0x7d11('0x40')]));_0x3563e7[_0x7d11('0x30')]=_0x3563e7['attributes'][_0x7d11('0x41')]?_0x3563e7[_0x7d11('0x30')]:_0x77e1e8['model'];if(_0x1caef9[_0x7d11('0x2d')][_0x7d11('0x42')]){_0x3563e7[_0x7d11('0x3c')]=[{'all':!![]}];}_0x3563e7=_['merge']({},_0x3563e7,_0x1caef9[_0x7d11('0x43')]);return db[_0x7d11('0x3b')][_0x7d11('0x44')](_0x3563e7)['then'](handleEntityNotFound(_0x28c4ce,null))[_0x7d11('0x22')](respondWithResult(_0x28c4ce,null))['catch'](handleError(_0x28c4ce,null));};exports[_0x7d11('0x45')]=function(_0x69dbd1,_0x3f33d9){return db[_0x7d11('0x3b')][_0x7d11('0x45')](_0x69dbd1[_0x7d11('0x46')],{})[_0x7d11('0x22')](function(_0x193631){var _0x1da7a4=_0x69dbd1['user']['get']({'plain':!![]});if(!_0x1da7a4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1da7a4[_0x7d11('0x47')]===_0x7d11('0x48')){var _0x20297a=_0x193631[_0x7d11('0x23')]({'plain':!![]});var _0x140acc=_0x7d11('0x24');return db[_0x7d11('0x49')][_0x7d11('0x44')]({'where':{'name':_0x140acc,'userProfileId':_0x1da7a4[_0x7d11('0x4a')]},'raw':!![]})[_0x7d11('0x22')](function(_0x46450e){if(_0x46450e&&_0x46450e[_0x7d11('0x4b')]===0x0){return db['UserProfileResource'][_0x7d11('0x45')]({'name':_0x20297a[_0x7d11('0x29')],'resourceId':_0x20297a['id'],'type':_0x46450e[_0x7d11('0x29')],'sectionId':_0x46450e['id']},{})['then'](function(){return _0x193631;});}else{return _0x193631;}})['catch'](function(_0x14db1c){logger[_0x7d11('0x27')](_0x7d11('0x4c'),_0x14db1c);throw _0x14db1c;});}return _0x193631;})['then'](respondWithResult(_0x3f33d9,0xc9))['catch'](handleError(_0x3f33d9,null));};exports[_0x7d11('0x21')]=function(_0x36af2b,_0x5e6234){if(_0x36af2b[_0x7d11('0x46')]['id']){delete _0x36af2b[_0x7d11('0x46')]['id'];}return db[_0x7d11('0x3b')][_0x7d11('0x44')]({'where':{'id':_0x36af2b['params']['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x5e6234,null))[_0x7d11('0x22')](saveUpdates(_0x36af2b[_0x7d11('0x46')],null))['then'](respondWithResult(_0x5e6234,null))['catch'](handleError(_0x5e6234,null));};exports[_0x7d11('0x26')]=function(_0x3f310b,_0x20a85c){return db[_0x7d11('0x3b')][_0x7d11('0x44')]({'where':{'id':_0x3f310b['params']['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x20a85c,null))[_0x7d11('0x22')](removeEntity(_0x20a85c,null))[_0x7d11('0x3e')](handleError(_0x20a85c,null));};
\ No newline at end of file
+var _0x3266=['filter','merge','map','key','VIRTUAL','field','options','count','includeAll','findAll','rows','catch','show','params','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','json','Content-Range','reject','save','update','destroy','then','get','Tags','UserProfileResource','status','sendStatus','stack','name','send','index','Tag','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','offset','sort','where','pick'];(function(_0x535ad8,_0x3d87a4){var _0x12493b=function(_0x36905b){while(--_0x36905b){_0x535ad8['push'](_0x535ad8['shift']());}};_0x12493b(++_0x3d87a4);}(_0x3266,0x6a));var _0x6326=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0x3266[_0x580647];return _0x5f0792;};'use strict';var pdf=require(_0x6326('0x0'));var emlformat=require(_0x6326('0x1'));var rimraf=require(_0x6326('0x2'));var zipdir=require(_0x6326('0x3'));var jsonpatch=require(_0x6326('0x4'));var rp=require(_0x6326('0x5'));var moment=require(_0x6326('0x6'));var BPromise=require(_0x6326('0x7'));var Mustache=require(_0x6326('0x8'));var util=require('util');var path=require(_0x6326('0x9'));var sox=require('sox');var csv=require(_0x6326('0xa'));var ejs=require(_0x6326('0xb'));var fs=require('fs');var _=require(_0x6326('0xc'));var squel=require('squel');var crypto=require(_0x6326('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6326('0xe'));var toCsv=require(_0x6326('0xa'));var querystring=require(_0x6326('0xf'));var Papa=require(_0x6326('0x10'));var authService=require(_0x6326('0x11'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x6326('0x12'));var qs=require(_0x6326('0x13'));var logger=require(_0x6326('0x14'))(_0x6326('0x15'));var utils=require(_0x6326('0x16'));var config=require(_0x6326('0x17'));var db=require(_0x6326('0x18'))['db'];function respondWithStatusCode(_0x77c4e,_0x40a68a){_0x40a68a=_0x40a68a||0xcc;return function(_0x379358){if(_0x379358){return _0x77c4e['sendStatus'](_0x40a68a);}return _0x77c4e['status'](_0x40a68a)[_0x6326('0x19')]();};}function respondWithResult(_0x136946,_0x591b81){_0x591b81=_0x591b81||0xc8;return function(_0x425878){if(_0x425878){return _0x136946['status'](_0x591b81)[_0x6326('0x1a')](_0x425878);}};}function respondWithFilteredResult(_0x20dcc6,_0x3d6ac0){return function(_0x41c352){if(_0x41c352){var _0x1ed3a3=_0x41c352['count'],_0x2c1879=_0x3d6ac0['offset'],_0x55923a=_0x3d6ac0['offset']+_0x3d6ac0['limit'],_0x1104c5;if(_0x55923a>=_0x1ed3a3){_0x55923a=_0x1ed3a3;_0x1104c5=0xc8;}else{_0x1104c5=0xce;}_0x20dcc6['status'](_0x1104c5);return _0x20dcc6['set'](_0x6326('0x1b'),_0x2c1879+'-'+_0x55923a+'/'+_0x1ed3a3)[_0x6326('0x1a')](_0x41c352);}return null;};}function patchUpdates(_0x2be78e){return function(_0x556c4e){try{jsonpatch['apply'](_0x556c4e,_0x2be78e,!![]);}catch(_0x954ed5){return BPromise[_0x6326('0x1c')](_0x954ed5);}return _0x556c4e[_0x6326('0x1d')]();};}function saveUpdates(_0x3db834,_0x3c08db){return function(_0x25957a){if(_0x25957a){return _0x25957a[_0x6326('0x1e')](_0x3db834)['then'](function(_0x22307f){return _0x22307f;});}return null;};}function removeEntity(_0x549f07,_0x3c5583){return function(_0x3c6cfa){if(_0x3c6cfa){return _0x3c6cfa[_0x6326('0x1f')]()[_0x6326('0x20')](function(){var _0x43cdfc=_0x3c6cfa[_0x6326('0x21')]({'plain':!![]});var _0x225555=_0x6326('0x22');return db[_0x6326('0x23')][_0x6326('0x1f')]({'where':{'type':_0x225555,'resourceId':_0x43cdfc['id']}})[_0x6326('0x20')](function(){return _0x3c6cfa;});})['then'](function(){_0x549f07[_0x6326('0x24')](0xcc)[_0x6326('0x19')]();});}};}function handleEntityNotFound(_0x575701,_0x4e272b){return function(_0x4d28fd){if(!_0x4d28fd){_0x575701[_0x6326('0x25')](0x194);}return _0x4d28fd;};}function handleError(_0x4dae28,_0x33c466){_0x33c466=_0x33c466||0x1f4;return function(_0x1a48da){logger['error'](_0x1a48da[_0x6326('0x26')]);if(_0x1a48da[_0x6326('0x27')]){delete _0x1a48da[_0x6326('0x27')];}_0x4dae28[_0x6326('0x24')](_0x33c466)[_0x6326('0x28')](_0x1a48da);};}exports[_0x6326('0x29')]=function(_0x40e036,_0x27802c){var _0x461e0f={},_0x127744={},_0x4980f6={'count':0x0,'rows':[]};var _0x2a8873=db[_0x6326('0x2a')][_0x6326('0x2b')];_0x127744[_0x6326('0x2c')]=_[_0x6326('0x2d')](_0x2a8873);_0x127744['query']=_[_0x6326('0x2d')](_0x40e036[_0x6326('0x2e')]);_0x127744[_0x6326('0x2f')]=_['intersection'](_0x127744[_0x6326('0x2c')],_0x127744['query']);_0x461e0f['attributes']=_[_0x6326('0x30')](_0x127744[_0x6326('0x2c')],qs[_0x6326('0x31')](_0x40e036[_0x6326('0x2e')][_0x6326('0x31')]));_0x461e0f[_0x6326('0x32')]=_0x461e0f[_0x6326('0x32')][_0x6326('0x33')]?_0x461e0f[_0x6326('0x32')]:_0x127744[_0x6326('0x2c')];if(!_0x40e036[_0x6326('0x2e')][_0x6326('0x34')]('nolimit')){_0x461e0f[_0x6326('0x35')]=qs[_0x6326('0x35')](_0x40e036['query'][_0x6326('0x35')]);_0x461e0f[_0x6326('0x36')]=qs[_0x6326('0x36')](_0x40e036['query'][_0x6326('0x36')]);}_0x461e0f['order']=qs['sort'](_0x40e036[_0x6326('0x2e')][_0x6326('0x37')]);_0x461e0f[_0x6326('0x38')]=qs['filters'](_[_0x6326('0x39')](_0x40e036['query'],_0x127744[_0x6326('0x2f')]));if(_0x40e036['query'][_0x6326('0x3a')]){_0x461e0f[_0x6326('0x38')]=_[_0x6326('0x3b')](_0x461e0f[_0x6326('0x38')],{'$or':_[_0x6326('0x3c')](_0x2a8873,function(_0x207fb1){if(_0x207fb1['type'][_0x6326('0x3d')]!==_0x6326('0x3e')){var _0x489f05={};_0x489f05[_0x207fb1[_0x6326('0x3f')]]={'$like':'%'+_0x40e036['query']['filter']+'%'};return _0x489f05;}})});}_0x461e0f=_[_0x6326('0x3b')]({},_0x461e0f,_0x40e036[_0x6326('0x40')]);var _0x3c170b={'where':_0x461e0f[_0x6326('0x38')]};return db[_0x6326('0x2a')][_0x6326('0x41')](_0x3c170b)['then'](function(_0x485bed){_0x4980f6[_0x6326('0x41')]=_0x485bed;if(_0x40e036['query'][_0x6326('0x42')]){_0x461e0f['include']=[{'all':!![]}];}return db[_0x6326('0x2a')][_0x6326('0x43')](_0x461e0f);})[_0x6326('0x20')](function(_0x1da798){_0x4980f6[_0x6326('0x44')]=_0x1da798;return _0x4980f6;})[_0x6326('0x20')](respondWithFilteredResult(_0x27802c,_0x461e0f))[_0x6326('0x45')](handleError(_0x27802c,null));};exports[_0x6326('0x46')]=function(_0x3b089b,_0x3998ba){var _0x301f9d={'raw':!![],'where':{'id':_0x3b089b[_0x6326('0x47')]['id']}},_0x5d36b1={};_0x5d36b1['model']=_[_0x6326('0x2d')](db[_0x6326('0x2a')][_0x6326('0x2b')]);_0x5d36b1[_0x6326('0x2e')]=_['keys'](_0x3b089b[_0x6326('0x2e')]);_0x5d36b1[_0x6326('0x2f')]=_['intersection'](_0x5d36b1[_0x6326('0x2c')],_0x5d36b1[_0x6326('0x2e')]);_0x301f9d[_0x6326('0x32')]=_[_0x6326('0x30')](_0x5d36b1['model'],qs[_0x6326('0x31')](_0x3b089b[_0x6326('0x2e')][_0x6326('0x31')]));_0x301f9d[_0x6326('0x32')]=_0x301f9d[_0x6326('0x32')][_0x6326('0x33')]?_0x301f9d[_0x6326('0x32')]:_0x5d36b1['model'];if(_0x3b089b[_0x6326('0x2e')][_0x6326('0x42')]){_0x301f9d[_0x6326('0x48')]=[{'all':!![]}];}_0x301f9d=_[_0x6326('0x3b')]({},_0x301f9d,_0x3b089b['options']);return db[_0x6326('0x2a')]['find'](_0x301f9d)[_0x6326('0x20')](handleEntityNotFound(_0x3998ba,null))[_0x6326('0x20')](respondWithResult(_0x3998ba,null))[_0x6326('0x45')](handleError(_0x3998ba,null));};exports[_0x6326('0x49')]=function(_0x183690,_0x5dc727){return db[_0x6326('0x2a')]['create'](_0x183690['body'],{})[_0x6326('0x20')](function(_0x44cf9d){var _0x5b14f4=_0x183690[_0x6326('0x4a')][_0x6326('0x21')]({'plain':!![]});if(!_0x5b14f4)throw new Error(_0x6326('0x4b'));if(_0x5b14f4[_0x6326('0x4c')]===_0x6326('0x4a')){var _0x4f8dc0=_0x44cf9d['get']({'plain':!![]});var _0x2d82c0=_0x6326('0x22');return db[_0x6326('0x4d')][_0x6326('0x4e')]({'where':{'name':_0x2d82c0,'userProfileId':_0x5b14f4[_0x6326('0x4f')]},'raw':!![]})[_0x6326('0x20')](function(_0xdc4522){if(_0xdc4522&&_0xdc4522['autoAssociation']===0x0){return db[_0x6326('0x23')][_0x6326('0x49')]({'name':_0x4f8dc0[_0x6326('0x27')],'resourceId':_0x4f8dc0['id'],'type':_0xdc4522[_0x6326('0x27')],'sectionId':_0xdc4522['id']},{})[_0x6326('0x20')](function(){return _0x44cf9d;});}else{return _0x44cf9d;}})['catch'](function(_0x189bef){logger['error'](_0x6326('0x50'),_0x189bef);throw _0x189bef;});}return _0x44cf9d;})[_0x6326('0x20')](respondWithResult(_0x5dc727,0xc9))['catch'](handleError(_0x5dc727,null));};exports[_0x6326('0x1e')]=function(_0x5040b1,_0xaa4c9d){if(_0x5040b1[_0x6326('0x51')]['id']){delete _0x5040b1[_0x6326('0x51')]['id'];}return db[_0x6326('0x2a')]['find']({'where':{'id':_0x5040b1[_0x6326('0x47')]['id']}})[_0x6326('0x20')](handleEntityNotFound(_0xaa4c9d,null))['then'](saveUpdates(_0x5040b1[_0x6326('0x51')],null))[_0x6326('0x20')](respondWithResult(_0xaa4c9d,null))[_0x6326('0x45')](handleError(_0xaa4c9d,null));};exports['destroy']=function(_0x2bece1,_0x2ac64b){return db['Tag'][_0x6326('0x4e')]({'where':{'id':_0x2bece1['params']['id']}})[_0x6326('0x20')](handleEntityNotFound(_0x2ac64b,null))[_0x6326('0x20')](removeEntity(_0x2ac64b,null))[_0x6326('0x45')](handleError(_0x2ac64b,null));};
\ No newline at end of file
index 151e448..4e0cde4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe62e=['define','Tag','tools_tags','lodash','api','moment','bluebird','request-promise','./tag.attributes','exports'];(function(_0x39cf70,_0x3ec55b){var _0x580424=function(_0x580a4e){while(--_0x580a4e){_0x39cf70['push'](_0x39cf70['shift']());}};_0x580424(++_0x3ec55b);}(_0xe62e,0x1d9));var _0xee62=function(_0x4d4224,_0xae983e){_0x4d4224=_0x4d4224-0x0;var _0xa6f8e0=_0xe62e[_0x4d4224];return _0xa6f8e0;};'use strict';var _=require(_0xee62('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee62('0x1'));var moment=require(_0xee62('0x2'));var BPromise=require(_0xee62('0x3'));var rp=require(_0xee62('0x4'));var attributes=require(_0xee62('0x5'));module[_0xee62('0x6')]=function(_0xc70129,_0x1edaf5){return _0xc70129[_0xee62('0x7')](_0xee62('0x8'),attributes,{'tableName':_0xee62('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x5edd=['Tag','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','./tag.attributes','exports','define'];(function(_0x5babbd,_0x1e8592){var _0x45eed5=function(_0x482235){while(--_0x482235){_0x5babbd['push'](_0x5babbd['shift']());}};_0x45eed5(++_0x1e8592);}(_0x5edd,0x86));var _0xd5ed=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x5edd[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0xd5ed('0x0'));var util=require(_0xd5ed('0x1'));var logger=require(_0xd5ed('0x2'))(_0xd5ed('0x3'));var moment=require(_0xd5ed('0x4'));var BPromise=require(_0xd5ed('0x5'));var rp=require('request-promise');var attributes=require(_0xd5ed('0x6'));module[_0xd5ed('0x7')]=function(_0x391178,_0xde7e2c){return _0x391178[_0xd5ed('0x8')](_0xd5ed('0x9'),attributes,{'tableName':_0xd5ed('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 4d7a773..b5fce49 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xace2=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','Tag,\x20%s,\x20%s'];(function(_0x5cd7a3,_0x1aa14f){var _0x21235d=function(_0x3152a9){while(--_0x3152a9){_0x5cd7a3['push'](_0x5cd7a3['shift']());}};_0x21235d(++_0x1aa14f);}(_0xace2,0x1a5));var _0x2ace=function(_0x2f1114,_0x4561f1){_0x2f1114=_0x2f1114-0x0;var _0x2fe856=_0xace2[_0x2f1114];return _0x2fe856;};'use strict';var _=require(_0x2ace('0x0'));var util=require(_0x2ace('0x1'));var moment=require(_0x2ace('0x2'));var BPromise=require('bluebird');var rs=require(_0x2ace('0x3'));var fs=require('fs');var Redis=require(_0x2ace('0x4'));var db=require(_0x2ace('0x5'))['db'];var utils=require(_0x2ace('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2ace('0x7'));var client=jayson[_0x2ace('0x8')][_0x2ace('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd911c4,_0x3b4b11,_0xcdd648){return new BPromise(function(_0xc102dd,_0xa9847e){return client[_0x2ace('0xa')](_0xd911c4,_0xcdd648)[_0x2ace('0xb')](function(_0x571d04){logger[_0x2ace('0xc')]('Tag,\x20%s,\x20%s',_0x3b4b11,_0x2ace('0xd'));logger['debug'](_0x2ace('0xe'),_0x3b4b11,_0x2ace('0xd'),JSON[_0x2ace('0xf')](_0x571d04));if(_0x571d04[_0x2ace('0x10')]){if(_0x571d04[_0x2ace('0x10')][_0x2ace('0x11')]===0x1f4){logger[_0x2ace('0x10')](_0x2ace('0x12'),_0x3b4b11,_0x571d04[_0x2ace('0x10')][_0x2ace('0x13')]);return _0xa9847e(_0x571d04[_0x2ace('0x10')][_0x2ace('0x13')]);}logger[_0x2ace('0x10')](_0x2ace('0x12'),_0x3b4b11,_0x571d04[_0x2ace('0x10')][_0x2ace('0x13')]);return _0xc102dd(_0x571d04[_0x2ace('0x10')]['message']);}else{logger[_0x2ace('0xc')](_0x2ace('0x12'),_0x3b4b11,_0x2ace('0xd'));_0xc102dd(_0x571d04[_0x2ace('0x14')]['message']);}})[_0x2ace('0x15')](function(_0x5e7b1a){logger[_0x2ace('0x10')](_0x2ace('0x12'),_0x3b4b11,_0x5e7b1a);_0xa9847e(_0x5e7b1a);});});}
\ No newline at end of file
+var _0x1665=['message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5b5b64,_0x29f965){var _0x40a37c=function(_0x1a762e){while(--_0x1a762e){_0x5b5b64['push'](_0x5b5b64['shift']());}};_0x40a37c(++_0x29f965);}(_0x1665,0xd1));var _0x5166=function(_0x229128,_0x273558){_0x229128=_0x229128-0x0;var _0x1875b9=_0x1665[_0x229128];return _0x1875b9;};'use strict';var _=require(_0x5166('0x0'));var util=require(_0x5166('0x1'));var moment=require(_0x5166('0x2'));var BPromise=require(_0x5166('0x3'));var rs=require(_0x5166('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5166('0x5'))['db'];var utils=require(_0x5166('0x6'));var logger=require(_0x5166('0x7'))(_0x5166('0x8'));var config=require(_0x5166('0x9'));var jayson=require(_0x5166('0xa'));var client=jayson['client'][_0x5166('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7d3840,_0x5de539,_0x529799){return new BPromise(function(_0x343040,_0x8498b3){return client[_0x5166('0xc')](_0x7d3840,_0x529799)['then'](function(_0x6f14dd){logger[_0x5166('0xd')](_0x5166('0xe'),_0x5de539,_0x5166('0xf'));logger[_0x5166('0x10')](_0x5166('0x11'),_0x5de539,'request\x20sent',JSON[_0x5166('0x12')](_0x6f14dd));if(_0x6f14dd['error']){if(_0x6f14dd[_0x5166('0x13')][_0x5166('0x14')]===0x1f4){logger[_0x5166('0x13')](_0x5166('0xe'),_0x5de539,_0x6f14dd[_0x5166('0x13')][_0x5166('0x15')]);return _0x8498b3(_0x6f14dd['error']['message']);}logger[_0x5166('0x13')](_0x5166('0xe'),_0x5de539,_0x6f14dd['error'][_0x5166('0x15')]);return _0x343040(_0x6f14dd[_0x5166('0x13')][_0x5166('0x15')]);}else{logger[_0x5166('0xd')](_0x5166('0xe'),_0x5de539,_0x5166('0xf'));_0x343040(_0x6f14dd['result'][_0x5166('0x15')]);}})[_0x5166('0x16')](function(_0x346e61){logger[_0x5166('0x13')](_0x5166('0xe'),_0x5de539,_0x346e61);_0x8498b3(_0x346e61);});});}
\ No newline at end of file
index 62cecf4..b9191d8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd2be=['/:id/users','getAgents','addQueues','addAgents','put','update','delete','/:id/queues','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','isAuthenticated'];(function(_0x3e1bf2,_0x121002){var _0x1de65a=function(_0x53a313){while(--_0x53a313){_0x3e1bf2['push'](_0x3e1bf2['shift']());}};_0x1de65a(++_0x121002);}(_0xd2be,0x86));var _0xed2b=function(_0x9e1faa,_0x425b76){_0x9e1faa=_0x9e1faa-0x0;var _0xdc2c21=_0xd2be[_0x9e1faa];return _0xdc2c21;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xed2b('0x0'));var timeout=require(_0xed2b('0x1'));var express=require(_0xed2b('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xed2b('0x3'));var config=require(_0xed2b('0x4'));var controller=require(_0xed2b('0x5'));router[_0xed2b('0x6')]('/',auth['isAuthenticated'](),controller[_0xed2b('0x7')]);router[_0xed2b('0x6')](_0xed2b('0x8'),auth[_0xed2b('0x9')](),controller['show']);router[_0xed2b('0x6')]('/:id/queues',auth['isAuthenticated'](),controller['getQueues']);router[_0xed2b('0x6')](_0xed2b('0xa'),auth[_0xed2b('0x9')](),controller[_0xed2b('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0xed2b('0x9')](),controller[_0xed2b('0xc')]);router['post'](_0xed2b('0xa'),auth['isAuthenticated'](),controller[_0xed2b('0xd')]);router[_0xed2b('0xe')](_0xed2b('0x8'),auth[_0xed2b('0x9')](),controller[_0xed2b('0xf')]);router[_0xed2b('0x10')](_0xed2b('0x8'),auth[_0xed2b('0x9')](),controller['destroy']);router[_0xed2b('0x10')](_0xed2b('0x11'),auth['isAuthenticated'](),controller['removeQueues']);router[_0xed2b('0x10')](_0xed2b('0xa'),auth[_0xed2b('0x9')](),controller['removeAgents']);module['exports']=router;
\ No newline at end of file
+var _0x6cdd=['getAgents','post','create','addAgents','put','update','delete','destroy','removeQueues','removeAgents','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','isAuthenticated','index','get','/:id','show','/:id/queues','/:id/users'];(function(_0xc5dc23,_0x3d98bd){var _0x5623b7=function(_0x56275f){while(--_0x56275f){_0xc5dc23['push'](_0xc5dc23['shift']());}};_0x5623b7(++_0x3d98bd);}(_0x6cdd,0x8d));var _0xd6cd=function(_0x254457,_0xa5758e){_0x254457=_0x254457-0x0;var _0x3f2140=_0x6cdd[_0x254457];return _0x3f2140;};'use strict';var multer=require('multer');var util=require(_0xd6cd('0x0'));var path=require(_0xd6cd('0x1'));var timeout=require('connect-timeout');var express=require(_0xd6cd('0x2'));var router=express[_0xd6cd('0x3')]();var auth=require(_0xd6cd('0x4'));var interaction=require(_0xd6cd('0x5'));var config=require(_0xd6cd('0x6'));var controller=require(_0xd6cd('0x7'));router['get']('/',auth[_0xd6cd('0x8')](),controller[_0xd6cd('0x9')]);router[_0xd6cd('0xa')](_0xd6cd('0xb'),auth[_0xd6cd('0x8')](),controller[_0xd6cd('0xc')]);router[_0xd6cd('0xa')](_0xd6cd('0xd'),auth[_0xd6cd('0x8')](),controller['getQueues']);router[_0xd6cd('0xa')](_0xd6cd('0xe'),auth[_0xd6cd('0x8')](),controller[_0xd6cd('0xf')]);router[_0xd6cd('0x10')]('/',auth[_0xd6cd('0x8')](),controller[_0xd6cd('0x11')]);router['post']('/:id/queues',auth[_0xd6cd('0x8')](),controller['addQueues']);router[_0xd6cd('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xd6cd('0x12')]);router[_0xd6cd('0x13')](_0xd6cd('0xb'),auth[_0xd6cd('0x8')](),controller[_0xd6cd('0x14')]);router[_0xd6cd('0x15')](_0xd6cd('0xb'),auth['isAuthenticated'](),controller[_0xd6cd('0x16')]);router[_0xd6cd('0x15')](_0xd6cd('0xd'),auth[_0xd6cd('0x8')](),controller[_0xd6cd('0x17')]);router[_0xd6cd('0x15')]('/:id/users',auth[_0xd6cd('0x8')](),controller[_0xd6cd('0x18')]);module[_0xd6cd('0x19')]=router;
\ No newline at end of file
index e815a4b..d43f385 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfb48=['sequelize','exports','STRING','name'];(function(_0x5af066,_0x1f26e6){var _0x31b7c6=function(_0x818958){while(--_0x818958){_0x5af066['push'](_0x5af066['shift']());}};_0x31b7c6(++_0x1f26e6);}(_0xfb48,0xd8));var _0x8fb4=function(_0x412547,_0x1eee49){_0x412547=_0x412547-0x0;var _0x16978e=_0xfb48[_0x412547];return _0x16978e;};'use strict';var Sequelize=require(_0x8fb4('0x0'));module[_0x8fb4('0x1')]={'name':{'type':Sequelize[_0x8fb4('0x2')],'allowNull':![],'unique':_0x8fb4('0x3')},'description':{'type':Sequelize[_0x8fb4('0x2')]}};
\ No newline at end of file
+var _0xd2c8=['sequelize','exports','STRING'];(function(_0x1678c8,_0x1c32f4){var _0x387aa9=function(_0x2803bd){while(--_0x2803bd){_0x1678c8['push'](_0x1678c8['shift']());}};_0x387aa9(++_0x1c32f4);}(_0xd2c8,0x16e));var _0x8d2c=function(_0x12ecd7,_0x3eb217){_0x12ecd7=_0x12ecd7-0x0;var _0x391b77=_0xd2c8[_0x12ecd7];return _0x391b77;};'use strict';var Sequelize=require(_0x8d2c('0x0'));module[_0x8d2c('0x1')]={'name':{'type':Sequelize[_0x8d2c('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x8d2c('0x2')]}};
\ No newline at end of file
index fa67d70..1ba186c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','isValidChannel','channel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','pick','Queues','addQueues','findOne','add','ids','removeQueues','remove','voice','chat','mail','sms','fax','openchannel','each','addAgents','User','findAll','loginInPause','voicePause','UserVoiceQueueRt','upsert','isNil','interface','format','omit','spread','userTeam:save','removeAgents','isArray','emit','userTeam:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','error','stack','name','index','Team','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','map','type','key','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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 authService=require(_0x0a9e('0xe'));var hardwareService=require(_0x0a9e('0xf'));var Redis=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x0a9e('0x13')]=_[_0x0a9e('0x14')](config[_0x0a9e('0x13')],{'host':_0x0a9e('0x15'),'port':0x18eb});var socket=require(_0x0a9e('0x16'))(new Redis(config[_0x0a9e('0x13')]));require('./team.socket')[_0x0a9e('0x17')](socket);function respondWithStatusCode(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xcc;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x18')](_0x2b4227);}return _0x239b12[_0x0a9e('0x19')](_0x2b4227)['end']();};}function respondWithResult(_0x22dccb,_0x5d0880){_0x5d0880=_0x5d0880||0xc8;return function(_0x1985b6){if(_0x1985b6){return _0x22dccb['status'](_0x5d0880)[_0x0a9e('0x1a')](_0x1985b6);}};}function respondWithFilteredResult(_0x12066b,_0x48f32d){return function(_0x225616){if(_0x225616){var _0x5a0a06=_0x225616[_0x0a9e('0x1b')],_0x459eb1=_0x48f32d[_0x0a9e('0x1c')],_0x478723=_0x48f32d[_0x0a9e('0x1c')]+_0x48f32d[_0x0a9e('0x1d')],_0x106033;if(_0x478723>=_0x5a0a06){_0x478723=_0x5a0a06;_0x106033=0xc8;}else{_0x106033=0xce;}_0x12066b[_0x0a9e('0x19')](_0x106033);return _0x12066b[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x459eb1+'-'+_0x478723+'/'+_0x5a0a06)[_0x0a9e('0x1a')](_0x225616);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x20')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x21')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x22')](_0x5a09ef)[_0x0a9e('0x23')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x24')]()[_0x0a9e('0x23')](function(){var _0x370d86=_0x2fb0e4[_0x0a9e('0x25')]({'plain':!![]});var _0x16b1ca='Teams';return db['UserProfileResource'][_0x0a9e('0x24')]({'where':{'type':_0x16b1ca,'resourceId':_0x370d86['id']}})[_0x0a9e('0x23')](function(){return _0x2fb0e4;});})[_0x0a9e('0x23')](function(){_0x4abc77[_0x0a9e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x384319,_0x479bc4){return function(_0x45a1e7){if(!_0x45a1e7){_0x384319['sendStatus'](0x194);}return _0x45a1e7;};}function handleError(_0x1dc186,_0x34dc65){_0x34dc65=_0x34dc65||0x1f4;return function(_0x25fba9){logger[_0x0a9e('0x26')](_0x25fba9[_0x0a9e('0x27')]);if(_0x25fba9[_0x0a9e('0x28')]){delete _0x25fba9[_0x0a9e('0x28')];}_0x1dc186[_0x0a9e('0x19')](_0x34dc65)['send'](_0x25fba9);};}exports[_0x0a9e('0x29')]=function(_0x468813,_0x2b1f27){var _0x2ec755={},_0x5c877d={},_0x15b200={'count':0x0,'rows':[]};var _0x40e7a3=db[_0x0a9e('0x2a')][_0x0a9e('0x2b')];_0x5c877d[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x40e7a3);_0x5c877d[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x468813[_0x0a9e('0x2e')]);_0x5c877d['filters']=_[_0x0a9e('0x2f')](_0x5c877d['model'],_0x5c877d[_0x0a9e('0x2e')]);_0x2ec755[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x5c877d[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x468813['query'][_0x0a9e('0x31')]));_0x2ec755[_0x0a9e('0x30')]=_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x2ec755[_0x0a9e('0x30')]:_0x5c877d[_0x0a9e('0x2c')];if(!_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x2ec755[_0x0a9e('0x1d')]=qs['limit'](_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x2ec755[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x468813['query'][_0x0a9e('0x1c')]);}_0x2ec755[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x468813[_0x0a9e('0x2e')]['sort']);_0x2ec755['where']=qs[_0x0a9e('0x36')](_['pick'](_0x468813[_0x0a9e('0x2e')],_0x5c877d[_0x0a9e('0x36')]));if(_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]){_0x2ec755['where']=_[_0x0a9e('0x38')](_0x2ec755[_0x0a9e('0x39')],{'$or':_[_0x0a9e('0x3a')](_0x40e7a3,function(_0x533942){if(_0x533942[_0x0a9e('0x3b')][_0x0a9e('0x3c')]!==_0x0a9e('0x3d')){var _0x4c1c0e={};_0x4c1c0e[_0x533942['field']]={'$like':'%'+_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x4c1c0e;}})});}_0x2ec755=_['merge']({},_0x2ec755,_0x468813[_0x0a9e('0x3e')]);var _0x419125={'where':_0x2ec755[_0x0a9e('0x39')]};return db[_0x0a9e('0x2a')]['count'](_0x419125)['then'](function(_0x15e37d){_0x15b200[_0x0a9e('0x1b')]=_0x15e37d;if(_0x468813['query'][_0x0a9e('0x3f')]){_0x2ec755[_0x0a9e('0x40')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')]['findAll'](_0x2ec755);})[_0x0a9e('0x23')](function(_0x2cfea9){_0x15b200[_0x0a9e('0x41')]=_0x2cfea9;return _0x15b200;})[_0x0a9e('0x23')](respondWithFilteredResult(_0x2b1f27,_0x2ec755))[_0x0a9e('0x42')](handleError(_0x2b1f27,null));};exports[_0x0a9e('0x43')]=function(_0x2881b3,_0x45a9b8){var _0x23b089={'raw':![],'where':{'id':_0x2881b3[_0x0a9e('0x44')]['id']}},_0x3da2cd={};_0x3da2cd[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x3da2cd['query']=_['keys'](_0x2881b3[_0x0a9e('0x2e')]);_0x3da2cd[_0x0a9e('0x36')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],_0x3da2cd[_0x0a9e('0x2e')]);_0x23b089[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x23b089[_0x0a9e('0x30')]=_0x23b089['attributes'][_0x0a9e('0x32')]?_0x23b089[_0x0a9e('0x30')]:_0x3da2cd[_0x0a9e('0x2c')];if(_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x3f')]){_0x23b089[_0x0a9e('0x40')]=[{'all':!![]}];}_0x23b089=_[_0x0a9e('0x38')]({},_0x23b089,_0x2881b3[_0x0a9e('0x3e')]);return db['Team'][_0x0a9e('0x45')](_0x23b089)['then'](handleEntityNotFound(_0x45a9b8,null))[_0x0a9e('0x23')](respondWithResult(_0x45a9b8,null))[_0x0a9e('0x42')](handleError(_0x45a9b8,null));};exports[_0x0a9e('0x46')]=function(_0x562fb4,_0x14bec2){return db[_0x0a9e('0x2a')][_0x0a9e('0x46')](_0x562fb4[_0x0a9e('0x47')],{})[_0x0a9e('0x23')](function(_0x37be73){var _0x45bf7f=_0x562fb4['user'][_0x0a9e('0x25')]({'plain':!![]});if(!_0x45bf7f)throw new Error(_0x0a9e('0x48'));if(_0x45bf7f[_0x0a9e('0x49')]===_0x0a9e('0x4a')){var _0x409789=_0x37be73[_0x0a9e('0x25')]({'plain':!![]});var _0x6054ee=_0x0a9e('0x4b');return db[_0x0a9e('0x4c')]['find']({'where':{'name':_0x6054ee,'userProfileId':_0x45bf7f[_0x0a9e('0x4d')]},'raw':!![]})[_0x0a9e('0x23')](function(_0x4f7240){if(_0x4f7240&&_0x4f7240['autoAssociation']===0x0){return db['UserProfileResource'][_0x0a9e('0x46')]({'name':_0x409789[_0x0a9e('0x28')],'resourceId':_0x409789['id'],'type':_0x4f7240[_0x0a9e('0x28')],'sectionId':_0x4f7240['id']},{})[_0x0a9e('0x23')](function(){return _0x37be73;});}else{return _0x37be73;}})[_0x0a9e('0x42')](function(_0x30decb){logger[_0x0a9e('0x26')](_0x0a9e('0x4e'),_0x30decb);throw _0x30decb;});}return _0x37be73;})['then'](respondWithResult(_0x14bec2,0xc9))['catch'](handleError(_0x14bec2,null));};exports['update']=function(_0x39d77d,_0x204173){if(_0x39d77d[_0x0a9e('0x47')]['id']){delete _0x39d77d['body']['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x39d77d['params']['id']}})['then'](handleEntityNotFound(_0x204173,null))[_0x0a9e('0x23')](saveUpdates(_0x39d77d['body'],null))[_0x0a9e('0x23')](respondWithResult(_0x204173,null))['catch'](handleError(_0x204173,null));};exports[_0x0a9e('0x24')]=function(_0x3c20b2,_0x439340){return db['Team'][_0x0a9e('0x45')]({'where':{'id':_0x3c20b2[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x439340,null))['then'](removeEntity(_0x439340,null))[_0x0a9e('0x42')](handleError(_0x439340,null));};exports[_0x0a9e('0x4f')]=function(_0x49c095,_0x145931,_0x5ce9ac){return db[_0x0a9e('0x2a')]['findOne']({'where':{'id':_0x49c095[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x145931,null))['then'](function(_0x5df0ad){if(!_0x49c095[_0x0a9e('0x2e')]['channel']||!utils[_0x0a9e('0x50')](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x51')])){throw new db[(_0x0a9e('0x52'))][(_0x0a9e('0x53'))](_0x0a9e('0x54'));}var _0xd10662={};var _0x28d814={};_0x28d814['model']=_[_0x0a9e('0x2d')](db[_[_0x0a9e('0x55')](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x51')][_0x0a9e('0x56')]())+_0x0a9e('0x57')]['rawAttributes']);_0x28d814[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x49c095['query']);_0x28d814[_0x0a9e('0x36')]=_['intersection'](_0x28d814[_0x0a9e('0x2c')],_0x28d814['query']);_0xd10662['attributes']=_['intersection'](_0x28d814[_0x0a9e('0x2c')],qs['fields'](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0xd10662[_0x0a9e('0x30')]=_0xd10662[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0xd10662[_0x0a9e('0x30')]:_0x28d814['model'];_0xd10662[_0x0a9e('0x1d')]=qs['limit'](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0xd10662[_0x0a9e('0x1c')]=qs['offset'](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x1c')]);_0xd10662[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x49c095['query'][_0x0a9e('0x35')]);_0xd10662[_0x0a9e('0x39')]=qs['filters'](_[_0x0a9e('0x58')](_0x49c095[_0x0a9e('0x2e')],_0x28d814[_0x0a9e('0x36')]));_0xd10662=_[_0x0a9e('0x38')]({},_0xd10662,_0x49c095[_0x0a9e('0x3e')]);return _0x5df0ad['get'+_[_0x0a9e('0x55')](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x51')]['toLowerCase']())+_0x0a9e('0x59')](_0xd10662);})['then'](respondWithResult(_0x145931,null))['catch'](handleError(_0x145931,null));};exports[_0x0a9e('0x5a')]=function(_0x4556c5,_0x9375fb,_0x19c995){return db[_0x0a9e('0x2a')][_0x0a9e('0x5b')]({'where':{'id':_0x4556c5[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](function(_0x2d7205){if(_0x2d7205){if(!_0x4556c5[_0x0a9e('0x47')][_0x0a9e('0x51')]||!utils[_0x0a9e('0x50')](_0x4556c5[_0x0a9e('0x47')][_0x0a9e('0x51')])){throw new db[(_0x0a9e('0x52'))][(_0x0a9e('0x53'))](_0x0a9e('0x54'));}return _0x2d7205[_0x0a9e('0x5c')+_['capitalize'](_0x4556c5[_0x0a9e('0x47')][_0x0a9e('0x51')][_0x0a9e('0x56')]())+'Queues'](_0x4556c5[_0x0a9e('0x47')][_0x0a9e('0x5d')]);}return null;})['then'](handleEntityNotFound(_0x9375fb,null))[_0x0a9e('0x23')](respondWithStatusCode(_0x9375fb,null))[_0x0a9e('0x42')](handleError(_0x9375fb,null));};exports[_0x0a9e('0x5e')]=function(_0x427946,_0x13b5c0,_0x4a43a8){return db['Team']['findOne']({'where':{'id':_0x427946[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](function(_0x1104ad){if(_0x1104ad){if(!_0x427946[_0x0a9e('0x2e')][_0x0a9e('0x51')]||!utils[_0x0a9e('0x50')](_0x427946[_0x0a9e('0x2e')][_0x0a9e('0x51')])){throw new db['Sequelize'][(_0x0a9e('0x53'))](_0x0a9e('0x54'));}return _0x1104ad[_0x0a9e('0x5f')+_['capitalize'](_0x427946[_0x0a9e('0x2e')]['channel'][_0x0a9e('0x56')]())+_0x0a9e('0x59')](_0x427946['query'][_0x0a9e('0x5d')]);}return null;})[_0x0a9e('0x23')](handleEntityNotFound(_0x13b5c0,null))[_0x0a9e('0x23')](respondWithStatusCode(_0x13b5c0,null))[_0x0a9e('0x42')](handleError(_0x13b5c0,null));};exports['addAgents']=function(_0x1d442c,_0x2e9552,_0x371533){return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x1d442c[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x2e9552,null))[_0x0a9e('0x23')](function(_0x361b21){if(_0x361b21){return BPromise['each']([_0x0a9e('0x60'),_0x0a9e('0x61'),_0x0a9e('0x62'),_0x0a9e('0x63'),_0x0a9e('0x64'),_0x0a9e('0x65')],function(_0x40fc56){return _0x361b21[_0x0a9e('0x25')+_[_0x0a9e('0x55')](_0x40fc56)+_0x0a9e('0x59')]({'attributes':['id',_0x0a9e('0x28')]})[_0x0a9e('0x23')](function(_0x25744a){return BPromise[_0x0a9e('0x66')](_0x25744a,function(_0x5b35db){return _0x5b35db[_0x0a9e('0x67')](_0x1d442c[_0x0a9e('0x47')][_0x0a9e('0x5d')])['then'](function(){if(_0x40fc56===_0x0a9e('0x60')){return db[_0x0a9e('0x68')][_0x0a9e('0x69')]({'where':{'id':_0x1d442c[_0x0a9e('0x47')]['ids']},'attributes':['id','name',_0x0a9e('0x6a'),_0x0a9e('0x6b'),'interface'],'raw':!![]});}})[_0x0a9e('0x23')](function(_0x53a6a1){if(_0x40fc56===_0x0a9e('0x60')){return BPromise[_0x0a9e('0x66')](_0x53a6a1,function(_0x5637a1){return db[_0x0a9e('0x6c')][_0x0a9e('0x6d')]({'membername':_0x5637a1[_0x0a9e('0x28')],'UserId':_0x5637a1['id'],'queue_name':_0x5b35db[_0x0a9e('0x28')],'VoiceQueueId':_0x5b35db['id'],'interface':_[_0x0a9e('0x6e')](_0x5637a1[_0x0a9e('0x6f')])?util[_0x0a9e('0x70')]('SIP/%s',_0x5637a1[_0x0a9e('0x28')]):_0x5637a1[_0x0a9e('0x6f')],'paused':_0x5637a1[_0x0a9e('0x6b')]||![],'penalty':0x0});});}});});})[_0x0a9e('0x23')](function(){return _0x361b21;});})['then'](function(){return _0x361b21;});}})[_0x0a9e('0x23')](function(_0xf0db1){if(_0xf0db1){return _0xf0db1['addAgents'](_0x1d442c[_0x0a9e('0x47')]['ids'],_[_0x0a9e('0x71')](_0x1d442c[_0x0a9e('0x47')],[_0x0a9e('0x5d'),'id'])||{})[_0x0a9e('0x72')](function(_0x5af453){for(var _0x51ccd7=0x0;_0x51ccd7<_0x1d442c[_0x0a9e('0x47')][_0x0a9e('0x5d')][_0x0a9e('0x32')];_0x51ccd7+=0x1){socket['emit'](_0x0a9e('0x73'),{'UserId':_0x1d442c[_0x0a9e('0x47')]['ids'][_0x51ccd7],'TeamId':_0x1d442c['params']['id']});}return _0x5af453;});}})[_0x0a9e('0x23')](respondWithResult(_0x2e9552,null))['catch'](handleError(_0x2e9552,null));};exports['removeAgents']=function(_0x4dc6b3,_0x81d748,_0xf3601c){var _0x9044fe;return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x4dc6b3[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x81d748,null))[_0x0a9e('0x23')](function(_0x5955f1){if(_0x5955f1){return BPromise[_0x0a9e('0x66')]([_0x0a9e('0x60'),_0x0a9e('0x61'),_0x0a9e('0x62'),'sms',_0x0a9e('0x64'),_0x0a9e('0x65')],function(_0x1d4877){return _0x5955f1['get'+_[_0x0a9e('0x55')](_0x1d4877)+_0x0a9e('0x59')]({'attributes':['id',_0x0a9e('0x28')]})[_0x0a9e('0x23')](function(_0x255e49){return BPromise[_0x0a9e('0x66')](_0x255e49,function(_0x32b9bd){return _0x32b9bd[_0x0a9e('0x74')](_0x4dc6b3['query'][_0x0a9e('0x5d')])[_0x0a9e('0x23')](function(){if(_0x1d4877==='voice'){return db[_0x0a9e('0x6c')][_0x0a9e('0x24')]({'where':{'VoiceQueueId':_0x32b9bd['id'],'UserId':_0x4dc6b3[_0x0a9e('0x2e')]['ids']}});}});});})[_0x0a9e('0x23')](function(){return _0x5955f1;});})['then'](function(){return _0x5955f1;});}})[_0x0a9e('0x23')](function(_0x2b5148){if(_0x2b5148){return _0x2b5148[_0x0a9e('0x74')](_0x4dc6b3[_0x0a9e('0x2e')][_0x0a9e('0x5d')])[_0x0a9e('0x23')](function(_0x16a039){if(_[_0x0a9e('0x75')](_0x4dc6b3['query'][_0x0a9e('0x5d')])){for(var _0x31d25a=0x0;_0x31d25a<_0x4dc6b3[_0x0a9e('0x2e')][_0x0a9e('0x5d')][_0x0a9e('0x32')];_0x31d25a+=0x1){socket[_0x0a9e('0x76')](_0x0a9e('0x77'),{'UserId':_0x4dc6b3[_0x0a9e('0x2e')][_0x0a9e('0x5d')][_0x31d25a],'TeamId':_0x4dc6b3[_0x0a9e('0x44')]['id']});}}else{socket[_0x0a9e('0x76')](_0x0a9e('0x77'),{'UserId':_0x4dc6b3[_0x0a9e('0x2e')]['ids'],'TeamId':_0x4dc6b3[_0x0a9e('0x44')]['id']});}});}})[_0x0a9e('0x23')](respondWithStatusCode(_0x81d748,null))[_0x0a9e('0x42')](handleError(_0x81d748,null));};exports[_0x0a9e('0x78')]=function(_0xb0599a,_0x5d9ddb,_0x3afc8c){var _0x1756c7={};var _0x5ce99d={};var _0x23b447;var _0x5e725e;return db[_0x0a9e('0x2a')][_0x0a9e('0x5b')]({'where':{'id':_0xb0599a[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x5d9ddb,null))['then'](function(_0x3ceba6){if(_0x3ceba6){_0x23b447=_0x3ceba6;_0x5ce99d['model']=_[_0x0a9e('0x2d')](db[_0x0a9e('0x68')]['rawAttributes']);_0x5ce99d[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0xb0599a[_0x0a9e('0x2e')]);_0x5ce99d['filters']=_['intersection'](_0x5ce99d[_0x0a9e('0x2c')],_0x5ce99d[_0x0a9e('0x2e')]);_0x1756c7[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x5ce99d[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0xb0599a[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x1756c7[_0x0a9e('0x30')]=_0x1756c7['attributes'][_0x0a9e('0x32')]?_0x1756c7['attributes']:_0x5ce99d[_0x0a9e('0x2c')];_0x1756c7[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0xb0599a[_0x0a9e('0x2e')][_0x0a9e('0x35')]);_0x1756c7['where']=qs[_0x0a9e('0x36')](_[_0x0a9e('0x58')](_0xb0599a[_0x0a9e('0x2e')],_0x5ce99d[_0x0a9e('0x36')]));if(_0xb0599a[_0x0a9e('0x2e')]['filter']){_0x1756c7['where']=_[_0x0a9e('0x38')](_0x1756c7['where'],{'$or':_[_0x0a9e('0x3a')](_0x1756c7[_0x0a9e('0x30')],function(_0x4672e1){var _0x16313e={};_0x16313e[_0x4672e1]={'$like':'%'+_0xb0599a[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x16313e;})});}_0x1756c7=_['merge']({},_0x1756c7,_0xb0599a['options']);return _0x23b447[_0x0a9e('0x78')](_0x1756c7);}})['then'](function(_0x2469d1){if(_0x2469d1){_0x5e725e=_0x2469d1['length'];if(!_0xb0599a[_0x0a9e('0x2e')]['hasOwnProperty']('nolimit')){_0x1756c7[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0xb0599a['query'][_0x0a9e('0x1d')]);_0x1756c7[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0xb0599a[_0x0a9e('0x2e')][_0x0a9e('0x1c')]);}return _0x23b447['getAgents'](_0x1756c7);}})['then'](function(_0x16449b){if(_0x16449b){return _0x16449b?{'count':_0x5e725e,'rows':_0x16449b}:null;}})[_0x0a9e('0x23')](respondWithResult(_0x5d9ddb,null))[_0x0a9e('0x42')](handleError(_0x5d9ddb,null));};
\ No newline at end of file
+var _0xa9e0=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','isValidChannel','channel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','pick','Queues','addQueues','findOne','add','ids','removeQueues','remove','voice','chat','mail','sms','fax','openchannel','each','addAgents','User','findAll','loginInPause','voicePause','UserVoiceQueueRt','upsert','isNil','interface','format','omit','spread','userTeam:save','removeAgents','isArray','emit','userTeam:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','error','stack','name','index','Team','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','map','type','key','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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 authService=require(_0x0a9e('0xe'));var hardwareService=require(_0x0a9e('0xf'));var Redis=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x0a9e('0x13')]=_[_0x0a9e('0x14')](config[_0x0a9e('0x13')],{'host':_0x0a9e('0x15'),'port':0x18eb});var socket=require(_0x0a9e('0x16'))(new Redis(config[_0x0a9e('0x13')]));require('./team.socket')[_0x0a9e('0x17')](socket);function respondWithStatusCode(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xcc;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x18')](_0x2b4227);}return _0x239b12[_0x0a9e('0x19')](_0x2b4227)['end']();};}function respondWithResult(_0x22dccb,_0x5d0880){_0x5d0880=_0x5d0880||0xc8;return function(_0x1985b6){if(_0x1985b6){return _0x22dccb['status'](_0x5d0880)[_0x0a9e('0x1a')](_0x1985b6);}};}function respondWithFilteredResult(_0x12066b,_0x48f32d){return function(_0x225616){if(_0x225616){var _0x5a0a06=_0x225616[_0x0a9e('0x1b')],_0x459eb1=_0x48f32d[_0x0a9e('0x1c')],_0x478723=_0x48f32d[_0x0a9e('0x1c')]+_0x48f32d[_0x0a9e('0x1d')],_0x106033;if(_0x478723>=_0x5a0a06){_0x478723=_0x5a0a06;_0x106033=0xc8;}else{_0x106033=0xce;}_0x12066b[_0x0a9e('0x19')](_0x106033);return _0x12066b[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x459eb1+'-'+_0x478723+'/'+_0x5a0a06)[_0x0a9e('0x1a')](_0x225616);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x20')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x21')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x22')](_0x5a09ef)[_0x0a9e('0x23')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x24')]()[_0x0a9e('0x23')](function(){var _0x370d86=_0x2fb0e4[_0x0a9e('0x25')]({'plain':!![]});var _0x16b1ca='Teams';return db['UserProfileResource'][_0x0a9e('0x24')]({'where':{'type':_0x16b1ca,'resourceId':_0x370d86['id']}})[_0x0a9e('0x23')](function(){return _0x2fb0e4;});})[_0x0a9e('0x23')](function(){_0x4abc77[_0x0a9e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x384319,_0x479bc4){return function(_0x45a1e7){if(!_0x45a1e7){_0x384319['sendStatus'](0x194);}return _0x45a1e7;};}function handleError(_0x1dc186,_0x34dc65){_0x34dc65=_0x34dc65||0x1f4;return function(_0x25fba9){logger[_0x0a9e('0x26')](_0x25fba9[_0x0a9e('0x27')]);if(_0x25fba9[_0x0a9e('0x28')]){delete _0x25fba9[_0x0a9e('0x28')];}_0x1dc186[_0x0a9e('0x19')](_0x34dc65)['send'](_0x25fba9);};}exports[_0x0a9e('0x29')]=function(_0x468813,_0x2b1f27){var _0x2ec755={},_0x5c877d={},_0x15b200={'count':0x0,'rows':[]};var _0x40e7a3=db[_0x0a9e('0x2a')][_0x0a9e('0x2b')];_0x5c877d[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x40e7a3);_0x5c877d[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x468813[_0x0a9e('0x2e')]);_0x5c877d['filters']=_[_0x0a9e('0x2f')](_0x5c877d['model'],_0x5c877d[_0x0a9e('0x2e')]);_0x2ec755[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x5c877d[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x468813['query'][_0x0a9e('0x31')]));_0x2ec755[_0x0a9e('0x30')]=_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x2ec755[_0x0a9e('0x30')]:_0x5c877d[_0x0a9e('0x2c')];if(!_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x2ec755[_0x0a9e('0x1d')]=qs['limit'](_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x2ec755[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x468813['query'][_0x0a9e('0x1c')]);}_0x2ec755[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x468813[_0x0a9e('0x2e')]['sort']);_0x2ec755['where']=qs[_0x0a9e('0x36')](_['pick'](_0x468813[_0x0a9e('0x2e')],_0x5c877d[_0x0a9e('0x36')]));if(_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]){_0x2ec755['where']=_[_0x0a9e('0x38')](_0x2ec755[_0x0a9e('0x39')],{'$or':_[_0x0a9e('0x3a')](_0x40e7a3,function(_0x533942){if(_0x533942[_0x0a9e('0x3b')][_0x0a9e('0x3c')]!==_0x0a9e('0x3d')){var _0x4c1c0e={};_0x4c1c0e[_0x533942['field']]={'$like':'%'+_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x4c1c0e;}})});}_0x2ec755=_['merge']({},_0x2ec755,_0x468813[_0x0a9e('0x3e')]);var _0x419125={'where':_0x2ec755[_0x0a9e('0x39')]};return db[_0x0a9e('0x2a')]['count'](_0x419125)['then'](function(_0x15e37d){_0x15b200[_0x0a9e('0x1b')]=_0x15e37d;if(_0x468813['query'][_0x0a9e('0x3f')]){_0x2ec755[_0x0a9e('0x40')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')]['findAll'](_0x2ec755);})[_0x0a9e('0x23')](function(_0x2cfea9){_0x15b200[_0x0a9e('0x41')]=_0x2cfea9;return _0x15b200;})[_0x0a9e('0x23')](respondWithFilteredResult(_0x2b1f27,_0x2ec755))[_0x0a9e('0x42')](handleError(_0x2b1f27,null));};exports[_0x0a9e('0x43')]=function(_0x2881b3,_0x45a9b8){var _0x23b089={'raw':![],'where':{'id':_0x2881b3[_0x0a9e('0x44')]['id']}},_0x3da2cd={};_0x3da2cd[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x3da2cd['query']=_['keys'](_0x2881b3[_0x0a9e('0x2e')]);_0x3da2cd[_0x0a9e('0x36')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],_0x3da2cd[_0x0a9e('0x2e')]);_0x23b089[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x23b089[_0x0a9e('0x30')]=_0x23b089['attributes'][_0x0a9e('0x32')]?_0x23b089[_0x0a9e('0x30')]:_0x3da2cd[_0x0a9e('0x2c')];if(_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x3f')]){_0x23b089[_0x0a9e('0x40')]=[{'all':!![]}];}_0x23b089=_[_0x0a9e('0x38')]({},_0x23b089,_0x2881b3[_0x0a9e('0x3e')]);return db['Team'][_0x0a9e('0x45')](_0x23b089)['then'](handleEntityNotFound(_0x45a9b8,null))[_0x0a9e('0x23')](respondWithResult(_0x45a9b8,null))[_0x0a9e('0x42')](handleError(_0x45a9b8,null));};exports[_0x0a9e('0x46')]=function(_0x562fb4,_0x14bec2){return db[_0x0a9e('0x2a')][_0x0a9e('0x46')](_0x562fb4[_0x0a9e('0x47')],{})[_0x0a9e('0x23')](function(_0x37be73){var _0x45bf7f=_0x562fb4['user'][_0x0a9e('0x25')]({'plain':!![]});if(!_0x45bf7f)throw new Error(_0x0a9e('0x48'));if(_0x45bf7f[_0x0a9e('0x49')]===_0x0a9e('0x4a')){var _0x409789=_0x37be73[_0x0a9e('0x25')]({'plain':!![]});var _0x6054ee=_0x0a9e('0x4b');return db[_0x0a9e('0x4c')]['find']({'where':{'name':_0x6054ee,'userProfileId':_0x45bf7f[_0x0a9e('0x4d')]},'raw':!![]})[_0x0a9e('0x23')](function(_0x4f7240){if(_0x4f7240&&_0x4f7240['autoAssociation']===0x0){return db['UserProfileResource'][_0x0a9e('0x46')]({'name':_0x409789[_0x0a9e('0x28')],'resourceId':_0x409789['id'],'type':_0x4f7240[_0x0a9e('0x28')],'sectionId':_0x4f7240['id']},{})[_0x0a9e('0x23')](function(){return _0x37be73;});}else{return _0x37be73;}})[_0x0a9e('0x42')](function(_0x30decb){logger[_0x0a9e('0x26')](_0x0a9e('0x4e'),_0x30decb);throw _0x30decb;});}return _0x37be73;})['then'](respondWithResult(_0x14bec2,0xc9))['catch'](handleError(_0x14bec2,null));};exports['update']=function(_0x39d77d,_0x204173){if(_0x39d77d[_0x0a9e('0x47')]['id']){delete _0x39d77d['body']['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x39d77d['params']['id']}})['then'](handleEntityNotFound(_0x204173,null))[_0x0a9e('0x23')](saveUpdates(_0x39d77d['body'],null))[_0x0a9e('0x23')](respondWithResult(_0x204173,null))['catch'](handleError(_0x204173,null));};exports[_0x0a9e('0x24')]=function(_0x3c20b2,_0x439340){return db['Team'][_0x0a9e('0x45')]({'where':{'id':_0x3c20b2[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x439340,null))['then'](removeEntity(_0x439340,null))[_0x0a9e('0x42')](handleError(_0x439340,null));};exports[_0x0a9e('0x4f')]=function(_0x49c095,_0x145931,_0x5ce9ac){return db[_0x0a9e('0x2a')]['findOne']({'where':{'id':_0x49c095[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x145931,null))['then'](function(_0x5df0ad){if(!_0x49c095[_0x0a9e('0x2e')]['channel']||!utils[_0x0a9e('0x50')](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x51')])){throw new db[(_0x0a9e('0x52'))][(_0x0a9e('0x53'))](_0x0a9e('0x54'));}var _0xd10662={};var _0x28d814={};_0x28d814['model']=_[_0x0a9e('0x2d')](db[_[_0x0a9e('0x55')](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x51')][_0x0a9e('0x56')]())+_0x0a9e('0x57')]['rawAttributes']);_0x28d814[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x49c095['query']);_0x28d814[_0x0a9e('0x36')]=_['intersection'](_0x28d814[_0x0a9e('0x2c')],_0x28d814['query']);_0xd10662['attributes']=_['intersection'](_0x28d814[_0x0a9e('0x2c')],qs['fields'](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0xd10662[_0x0a9e('0x30')]=_0xd10662[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0xd10662[_0x0a9e('0x30')]:_0x28d814['model'];_0xd10662[_0x0a9e('0x1d')]=qs['limit'](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0xd10662[_0x0a9e('0x1c')]=qs['offset'](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x1c')]);_0xd10662[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x49c095['query'][_0x0a9e('0x35')]);_0xd10662[_0x0a9e('0x39')]=qs['filters'](_[_0x0a9e('0x58')](_0x49c095[_0x0a9e('0x2e')],_0x28d814[_0x0a9e('0x36')]));_0xd10662=_[_0x0a9e('0x38')]({},_0xd10662,_0x49c095[_0x0a9e('0x3e')]);return _0x5df0ad['get'+_[_0x0a9e('0x55')](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x51')]['toLowerCase']())+_0x0a9e('0x59')](_0xd10662);})['then'](respondWithResult(_0x145931,null))['catch'](handleError(_0x145931,null));};exports[_0x0a9e('0x5a')]=function(_0x4556c5,_0x9375fb,_0x19c995){return db[_0x0a9e('0x2a')][_0x0a9e('0x5b')]({'where':{'id':_0x4556c5[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](function(_0x2d7205){if(_0x2d7205){if(!_0x4556c5[_0x0a9e('0x47')][_0x0a9e('0x51')]||!utils[_0x0a9e('0x50')](_0x4556c5[_0x0a9e('0x47')][_0x0a9e('0x51')])){throw new db[(_0x0a9e('0x52'))][(_0x0a9e('0x53'))](_0x0a9e('0x54'));}return _0x2d7205[_0x0a9e('0x5c')+_['capitalize'](_0x4556c5[_0x0a9e('0x47')][_0x0a9e('0x51')][_0x0a9e('0x56')]())+'Queues'](_0x4556c5[_0x0a9e('0x47')][_0x0a9e('0x5d')]);}return null;})['then'](handleEntityNotFound(_0x9375fb,null))[_0x0a9e('0x23')](respondWithStatusCode(_0x9375fb,null))[_0x0a9e('0x42')](handleError(_0x9375fb,null));};exports[_0x0a9e('0x5e')]=function(_0x427946,_0x13b5c0,_0x4a43a8){return db['Team']['findOne']({'where':{'id':_0x427946[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](function(_0x1104ad){if(_0x1104ad){if(!_0x427946[_0x0a9e('0x2e')][_0x0a9e('0x51')]||!utils[_0x0a9e('0x50')](_0x427946[_0x0a9e('0x2e')][_0x0a9e('0x51')])){throw new db['Sequelize'][(_0x0a9e('0x53'))](_0x0a9e('0x54'));}return _0x1104ad[_0x0a9e('0x5f')+_['capitalize'](_0x427946[_0x0a9e('0x2e')]['channel'][_0x0a9e('0x56')]())+_0x0a9e('0x59')](_0x427946['query'][_0x0a9e('0x5d')]);}return null;})[_0x0a9e('0x23')](handleEntityNotFound(_0x13b5c0,null))[_0x0a9e('0x23')](respondWithStatusCode(_0x13b5c0,null))[_0x0a9e('0x42')](handleError(_0x13b5c0,null));};exports['addAgents']=function(_0x1d442c,_0x2e9552,_0x371533){return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x1d442c[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x2e9552,null))[_0x0a9e('0x23')](function(_0x361b21){if(_0x361b21){return BPromise['each']([_0x0a9e('0x60'),_0x0a9e('0x61'),_0x0a9e('0x62'),_0x0a9e('0x63'),_0x0a9e('0x64'),_0x0a9e('0x65')],function(_0x40fc56){return _0x361b21[_0x0a9e('0x25')+_[_0x0a9e('0x55')](_0x40fc56)+_0x0a9e('0x59')]({'attributes':['id',_0x0a9e('0x28')]})[_0x0a9e('0x23')](function(_0x25744a){return BPromise[_0x0a9e('0x66')](_0x25744a,function(_0x5b35db){return _0x5b35db[_0x0a9e('0x67')](_0x1d442c[_0x0a9e('0x47')][_0x0a9e('0x5d')])['then'](function(){if(_0x40fc56===_0x0a9e('0x60')){return db[_0x0a9e('0x68')][_0x0a9e('0x69')]({'where':{'id':_0x1d442c[_0x0a9e('0x47')]['ids']},'attributes':['id','name',_0x0a9e('0x6a'),_0x0a9e('0x6b'),'interface'],'raw':!![]});}})[_0x0a9e('0x23')](function(_0x53a6a1){if(_0x40fc56===_0x0a9e('0x60')){return BPromise[_0x0a9e('0x66')](_0x53a6a1,function(_0x5637a1){return db[_0x0a9e('0x6c')][_0x0a9e('0x6d')]({'membername':_0x5637a1[_0x0a9e('0x28')],'UserId':_0x5637a1['id'],'queue_name':_0x5b35db[_0x0a9e('0x28')],'VoiceQueueId':_0x5b35db['id'],'interface':_[_0x0a9e('0x6e')](_0x5637a1[_0x0a9e('0x6f')])?util[_0x0a9e('0x70')]('SIP/%s',_0x5637a1[_0x0a9e('0x28')]):_0x5637a1[_0x0a9e('0x6f')],'paused':_0x5637a1[_0x0a9e('0x6b')]||![],'penalty':0x0});});}});});})[_0x0a9e('0x23')](function(){return _0x361b21;});})['then'](function(){return _0x361b21;});}})[_0x0a9e('0x23')](function(_0xf0db1){if(_0xf0db1){return _0xf0db1['addAgents'](_0x1d442c[_0x0a9e('0x47')]['ids'],_[_0x0a9e('0x71')](_0x1d442c[_0x0a9e('0x47')],[_0x0a9e('0x5d'),'id'])||{})[_0x0a9e('0x72')](function(_0x5af453){for(var _0x51ccd7=0x0;_0x51ccd7<_0x1d442c[_0x0a9e('0x47')][_0x0a9e('0x5d')][_0x0a9e('0x32')];_0x51ccd7+=0x1){socket['emit'](_0x0a9e('0x73'),{'UserId':_0x1d442c[_0x0a9e('0x47')]['ids'][_0x51ccd7],'TeamId':_0x1d442c['params']['id']});}return _0x5af453;});}})[_0x0a9e('0x23')](respondWithResult(_0x2e9552,null))['catch'](handleError(_0x2e9552,null));};exports['removeAgents']=function(_0x4dc6b3,_0x81d748,_0xf3601c){var _0x9044fe;return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x4dc6b3[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x81d748,null))[_0x0a9e('0x23')](function(_0x5955f1){if(_0x5955f1){return BPromise[_0x0a9e('0x66')]([_0x0a9e('0x60'),_0x0a9e('0x61'),_0x0a9e('0x62'),'sms',_0x0a9e('0x64'),_0x0a9e('0x65')],function(_0x1d4877){return _0x5955f1['get'+_[_0x0a9e('0x55')](_0x1d4877)+_0x0a9e('0x59')]({'attributes':['id',_0x0a9e('0x28')]})[_0x0a9e('0x23')](function(_0x255e49){return BPromise[_0x0a9e('0x66')](_0x255e49,function(_0x32b9bd){return _0x32b9bd[_0x0a9e('0x74')](_0x4dc6b3['query'][_0x0a9e('0x5d')])[_0x0a9e('0x23')](function(){if(_0x1d4877==='voice'){return db[_0x0a9e('0x6c')][_0x0a9e('0x24')]({'where':{'VoiceQueueId':_0x32b9bd['id'],'UserId':_0x4dc6b3[_0x0a9e('0x2e')]['ids']}});}});});})[_0x0a9e('0x23')](function(){return _0x5955f1;});})['then'](function(){return _0x5955f1;});}})[_0x0a9e('0x23')](function(_0x2b5148){if(_0x2b5148){return _0x2b5148[_0x0a9e('0x74')](_0x4dc6b3[_0x0a9e('0x2e')][_0x0a9e('0x5d')])[_0x0a9e('0x23')](function(_0x16a039){if(_[_0x0a9e('0x75')](_0x4dc6b3['query'][_0x0a9e('0x5d')])){for(var _0x31d25a=0x0;_0x31d25a<_0x4dc6b3[_0x0a9e('0x2e')][_0x0a9e('0x5d')][_0x0a9e('0x32')];_0x31d25a+=0x1){socket[_0x0a9e('0x76')](_0x0a9e('0x77'),{'UserId':_0x4dc6b3[_0x0a9e('0x2e')][_0x0a9e('0x5d')][_0x31d25a],'TeamId':_0x4dc6b3[_0x0a9e('0x44')]['id']});}}else{socket[_0x0a9e('0x76')](_0x0a9e('0x77'),{'UserId':_0x4dc6b3[_0x0a9e('0x2e')]['ids'],'TeamId':_0x4dc6b3[_0x0a9e('0x44')]['id']});}});}})[_0x0a9e('0x23')](respondWithStatusCode(_0x81d748,null))[_0x0a9e('0x42')](handleError(_0x81d748,null));};exports[_0x0a9e('0x78')]=function(_0xb0599a,_0x5d9ddb,_0x3afc8c){var _0x1756c7={};var _0x5ce99d={};var _0x23b447;var _0x5e725e;return db[_0x0a9e('0x2a')][_0x0a9e('0x5b')]({'where':{'id':_0xb0599a[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x5d9ddb,null))['then'](function(_0x3ceba6){if(_0x3ceba6){_0x23b447=_0x3ceba6;_0x5ce99d['model']=_[_0x0a9e('0x2d')](db[_0x0a9e('0x68')]['rawAttributes']);_0x5ce99d[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0xb0599a[_0x0a9e('0x2e')]);_0x5ce99d['filters']=_['intersection'](_0x5ce99d[_0x0a9e('0x2c')],_0x5ce99d[_0x0a9e('0x2e')]);_0x1756c7[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x5ce99d[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0xb0599a[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x1756c7[_0x0a9e('0x30')]=_0x1756c7['attributes'][_0x0a9e('0x32')]?_0x1756c7['attributes']:_0x5ce99d[_0x0a9e('0x2c')];_0x1756c7[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0xb0599a[_0x0a9e('0x2e')][_0x0a9e('0x35')]);_0x1756c7['where']=qs[_0x0a9e('0x36')](_[_0x0a9e('0x58')](_0xb0599a[_0x0a9e('0x2e')],_0x5ce99d[_0x0a9e('0x36')]));if(_0xb0599a[_0x0a9e('0x2e')]['filter']){_0x1756c7['where']=_[_0x0a9e('0x38')](_0x1756c7['where'],{'$or':_[_0x0a9e('0x3a')](_0x1756c7[_0x0a9e('0x30')],function(_0x4672e1){var _0x16313e={};_0x16313e[_0x4672e1]={'$like':'%'+_0xb0599a[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x16313e;})});}_0x1756c7=_['merge']({},_0x1756c7,_0xb0599a['options']);return _0x23b447[_0x0a9e('0x78')](_0x1756c7);}})['then'](function(_0x2469d1){if(_0x2469d1){_0x5e725e=_0x2469d1['length'];if(!_0xb0599a[_0x0a9e('0x2e')]['hasOwnProperty']('nolimit')){_0x1756c7[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0xb0599a['query'][_0x0a9e('0x1d')]);_0x1756c7[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0xb0599a[_0x0a9e('0x2e')][_0x0a9e('0x1c')]);}return _0x23b447['getAgents'](_0x1756c7);}})['then'](function(_0x16449b){if(_0x16449b){return _0x16449b?{'count':_0x5e725e,'rows':_0x16449b}:null;}})[_0x0a9e('0x23')](respondWithResult(_0x5d9ddb,null))[_0x0a9e('0x42')](handleError(_0x5d9ddb,null));};
\ No newline at end of file
index 229ff37..1a27e62 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xde52=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x4d654c,_0x3f1ac7){var _0x5c47b7=function(_0x1a6045){while(--_0x1a6045){_0x4d654c['push'](_0x4d654c['shift']());}};_0x5c47b7(++_0x3f1ac7);}(_0xde52,0x1c9));var _0x2de5=function(_0x1a1667,_0x2224b1){_0x1a1667=_0x1a1667-0x0;var _0x45a134=_0xde52[_0x1a1667];return _0x45a134;};'use strict';var EventEmitter=require(_0x2de5('0x0'));var Team=require(_0x2de5('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x2de5('0x2')](0x0);var events={'afterCreate':_0x2de5('0x3'),'afterUpdate':_0x2de5('0x4'),'afterDestroy':_0x2de5('0x5')};function emitEvent(_0x4c7047){return function(_0x1cc3a3,_0x1e185d,_0x42a04d){TeamEvents[_0x2de5('0x6')](_0x4c7047+':'+_0x1cc3a3['id'],_0x1cc3a3);TeamEvents[_0x2de5('0x6')](_0x4c7047,_0x1cc3a3);_0x42a04d(null);};}for(var e in events){if(events[_0x2de5('0x7')](e)){var event=events[e];Team[_0x2de5('0x8')](e,emitEvent(event));}}module[_0x2de5('0x9')]=TeamEvents;
\ No newline at end of file
+var _0x853c=['exports','events','../../mysqldb','Team','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x853c,0x6f));var _0xc853=function(_0x3c8ad9,_0x4d76ce){_0x3c8ad9=_0x3c8ad9-0x0;var _0x1f5782=_0x853c[_0x3c8ad9];return _0x1f5782;};'use strict';var EventEmitter=require(_0xc853('0x0'));var Team=require(_0xc853('0x1'))['db'][_0xc853('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xc853('0x3')](0x0);var events={'afterCreate':_0xc853('0x4'),'afterUpdate':_0xc853('0x5'),'afterDestroy':_0xc853('0x6')};function emitEvent(_0x4062d1){return function(_0x4c9676,_0x421f68,_0x4dbe57){TeamEvents[_0xc853('0x7')](_0x4062d1+':'+_0x4c9676['id'],_0x4c9676);TeamEvents[_0xc853('0x7')](_0x4062d1,_0x4c9676);_0x4dbe57(null);};}for(var e in events){if(events[_0xc853('0x8')](e)){var event=events[e];Team[_0xc853('0x9')](e,emitEvent(event));}}module[_0xc853('0xa')]=TeamEvents;
\ No newline at end of file
index de6ec51..e42fa03 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9c44=['../../config/logger','api','moment','bluebird','request-promise','./team.attributes','Team','teams'];(function(_0x32f332,_0x20fe03){var _0x47ccf0=function(_0x27896a){while(--_0x27896a){_0x32f332['push'](_0x32f332['shift']());}};_0x47ccf0(++_0x20fe03);}(_0x9c44,0x178));var _0x49c4=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x9c44[_0x5608a3];return _0x1ed50a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var attributes=require(_0x49c4('0x5'));module['exports']=function(_0x4941f1,_0x41a183){return _0x4941f1['define'](_0x49c4('0x6'),attributes,{'tableName':_0x49c4('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x9c44=['../../config/logger','api','moment','bluebird','request-promise','./team.attributes','Team','teams'];(function(_0xbab913,_0x4e4850){var _0x2ce61f=function(_0x76a00a){while(--_0x76a00a){_0xbab913['push'](_0xbab913['shift']());}};_0x2ce61f(++_0x4e4850);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var attributes=require(_0x49c4('0x5'));module['exports']=function(_0x4941f1,_0x41a183){return _0x4941f1['define'](_0x49c4('0x6'),attributes,{'tableName':_0x49c4('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 2d18215..2c299ed 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7ffa=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','register','then','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util'];(function(_0x54a878,_0x5d76ef){var _0x5cc349=function(_0x11fc41){while(--_0x11fc41){_0x54a878['push'](_0x54a878['shift']());}};_0x5cc349(++_0x5d76ef);}(_0x7ffa,0xc6));var _0xa7ff=function(_0x36424c,_0x62db50){_0x36424c=_0x36424c-0x0;var _0xebacee=_0x7ffa[_0x36424c];return _0xebacee;};'use strict';var _=require(_0xa7ff('0x0'));var util=require(_0xa7ff('0x1'));var moment=require(_0xa7ff('0x2'));var BPromise=require(_0xa7ff('0x3'));var rs=require(_0xa7ff('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa7ff('0x5'));var logger=require(_0xa7ff('0x6'))(_0xa7ff('0x7'));var config=require('../../config/environment');var jayson=require(_0xa7ff('0x8'));var client=jayson[_0xa7ff('0x9')][_0xa7ff('0xa')]({'port':0x232a});config['redis']=_[_0xa7ff('0xb')](config[_0xa7ff('0xc')],{'host':_0xa7ff('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa7ff('0xc')]));require('./team.socket')[_0xa7ff('0xe')](socket);function respondWithRpcPromise(_0x505183,_0x58da6d,_0x2837ba){return new BPromise(function(_0x176221,_0x376691){return client['request'](_0x505183,_0x2837ba)[_0xa7ff('0xf')](function(_0x18ceba){logger['info'](_0xa7ff('0x10'),_0x58da6d,_0xa7ff('0x11'));logger['debug'](_0xa7ff('0x12'),_0x58da6d,'request\x20sent',JSON[_0xa7ff('0x13')](_0x18ceba));if(_0x18ceba['error']){if(_0x18ceba[_0xa7ff('0x14')][_0xa7ff('0x15')]===0x1f4){logger['error'](_0xa7ff('0x10'),_0x58da6d,_0x18ceba[_0xa7ff('0x14')][_0xa7ff('0x16')]);return _0x376691(_0x18ceba[_0xa7ff('0x14')][_0xa7ff('0x16')]);}logger[_0xa7ff('0x14')](_0xa7ff('0x10'),_0x58da6d,_0x18ceba[_0xa7ff('0x14')][_0xa7ff('0x16')]);return _0x176221(_0x18ceba[_0xa7ff('0x14')]['message']);}else{logger[_0xa7ff('0x17')](_0xa7ff('0x10'),_0x58da6d,'request\x20sent');_0x176221(_0x18ceba['result'][_0xa7ff('0x16')]);}})[_0xa7ff('0x18')](function(_0x1defa5){logger[_0xa7ff('0x14')]('Team,\x20%s,\x20%s',_0x58da6d,_0x1defa5);_0x376691(_0x1defa5);});});}
\ No newline at end of file
+var _0x3911=['error','code','Team,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./team.socket','request','then','info','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2953e6,_0x2ae82a){var _0xcf1d71=function(_0x5442f2){while(--_0x5442f2){_0x2953e6['push'](_0x2953e6['shift']());}};_0xcf1d71(++_0x2ae82a);}(_0x3911,0x101));var _0x1391=function(_0xa8d7ef,_0x4b8b3d){_0xa8d7ef=_0xa8d7ef-0x0;var _0x239d5e=_0x3911[_0xa8d7ef];return _0x239d5e;};'use strict';var _=require(_0x1391('0x0'));var util=require(_0x1391('0x1'));var moment=require('moment');var BPromise=require(_0x1391('0x2'));var rs=require(_0x1391('0x3'));var fs=require('fs');var Redis=require(_0x1391('0x4'));var db=require(_0x1391('0x5'))['db'];var utils=require(_0x1391('0x6'));var logger=require(_0x1391('0x7'))(_0x1391('0x8'));var config=require('../../config/environment');var jayson=require(_0x1391('0x9'));var client=jayson[_0x1391('0xa')][_0x1391('0xb')]({'port':0x232a});config['redis']=_[_0x1391('0xc')](config[_0x1391('0xd')],{'host':_0x1391('0xe'),'port':0x18eb});var socket=require(_0x1391('0xf'))(new Redis(config[_0x1391('0xd')]));require(_0x1391('0x10'))['register'](socket);function respondWithRpcPromise(_0x165502,_0x4263ad,_0xedf619){return new BPromise(function(_0x2fc56a,_0x19680a){return client[_0x1391('0x11')](_0x165502,_0xedf619)[_0x1391('0x12')](function(_0x8eb754){logger[_0x1391('0x13')]('Team,\x20%s,\x20%s',_0x4263ad,'request\x20sent');logger['debug'](_0x1391('0x14'),_0x4263ad,_0x1391('0x15'),JSON[_0x1391('0x16')](_0x8eb754));if(_0x8eb754[_0x1391('0x17')]){if(_0x8eb754[_0x1391('0x17')][_0x1391('0x18')]===0x1f4){logger['error'](_0x1391('0x19'),_0x4263ad,_0x8eb754[_0x1391('0x17')][_0x1391('0x1a')]);return _0x19680a(_0x8eb754[_0x1391('0x17')][_0x1391('0x1a')]);}logger[_0x1391('0x17')](_0x1391('0x19'),_0x4263ad,_0x8eb754['error']['message']);return _0x2fc56a(_0x8eb754[_0x1391('0x17')][_0x1391('0x1a')]);}else{logger[_0x1391('0x13')](_0x1391('0x19'),_0x4263ad,_0x1391('0x15'));_0x2fc56a(_0x8eb754['result'][_0x1391('0x1a')]);}})[_0x1391('0x1b')](function(_0x36bcf7){logger['error'](_0x1391('0x19'),_0x4263ad,_0x36bcf7);_0x19680a(_0x36bcf7);});});}
\ No newline at end of file
index 72e33f0..63a00e8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xddd8=['emit','removeListener','register','length','team:','save','remove','update'];(function(_0x362abb,_0x12504a){var _0x398e13=function(_0x287a95){while(--_0x287a95){_0x362abb['push'](_0x362abb['shift']());}};_0x398e13(++_0x12504a);}(_0xddd8,0x6d));var _0x8ddd=function(_0x50fcf0,_0x2bc9f9){_0x50fcf0=_0x50fcf0-0x0;var _0x4acd3c=_0xddd8[_0x50fcf0];return _0x4acd3c;};'use strict';var TeamEvents=require('./team.events');var events=[_0x8ddd('0x0'),_0x8ddd('0x1'),_0x8ddd('0x2')];function createListener(_0x27d934,_0x222e69){return function(_0x9568f7){_0x222e69[_0x8ddd('0x3')](_0x27d934,_0x9568f7);};}function removeListener(_0x2c0088,_0x39cf24){return function(){TeamEvents[_0x8ddd('0x4')](_0x2c0088,_0x39cf24);};}exports[_0x8ddd('0x5')]=function(_0x450ef6){for(var _0x1f346e=0x0,_0x46d156=events[_0x8ddd('0x6')];_0x1f346e<_0x46d156;_0x1f346e++){var _0x70c6a3=events[_0x1f346e];var _0x4315d3=createListener(_0x8ddd('0x7')+_0x70c6a3,_0x450ef6);TeamEvents['on'](_0x70c6a3,_0x4315d3);}};
\ No newline at end of file
+var _0xc6c6=['save','remove','update','emit','length'];(function(_0x5e4ad8,_0xb59ca3){var _0xd071ee=function(_0x48ffe0){while(--_0x48ffe0){_0x5e4ad8['push'](_0x5e4ad8['shift']());}};_0xd071ee(++_0xb59ca3);}(_0xc6c6,0x1c7));var _0x6c6c=function(_0x72895a,_0x433607){_0x72895a=_0x72895a-0x0;var _0x5226d5=_0xc6c6[_0x72895a];return _0x5226d5;};'use strict';var TeamEvents=require('./team.events');var events=[_0x6c6c('0x0'),_0x6c6c('0x1'),_0x6c6c('0x2')];function createListener(_0x55f6d3,_0x3e2c29){return function(_0x1db8c6){_0x3e2c29[_0x6c6c('0x3')](_0x55f6d3,_0x1db8c6);};}function removeListener(_0x36bf25,_0x1b6f4b){return function(){TeamEvents['removeListener'](_0x36bf25,_0x1b6f4b);};}exports['register']=function(_0x394b65){for(var _0x458077=0x0,_0x413276=events[_0x6c6c('0x4')];_0x458077<_0x413276;_0x458077++){var _0x52bc55=events[_0x458077];var _0x34fd7e=createListener('team:'+_0x52bc55,_0x394b65);TeamEvents['on'](_0x52bc55,_0x34fd7e);}};
\ No newline at end of file
index e858f83..c417fce 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8a6d=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','show','post','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2341f9,_0x4e20d0){var _0x58900b=function(_0x319838){while(--_0x319838){_0x2341f9['push'](_0x2341f9['shift']());}};_0x58900b(++_0x4e20d0);}(_0x8a6d,0xb0));var _0xd8a6=function(_0x25ec41,_0x280d74){_0x25ec41=_0x25ec41-0x0;var _0x75769=_0x8a6d[_0x25ec41];return _0x75769;};'use strict';var multer=require(_0xd8a6('0x0'));var util=require(_0xd8a6('0x1'));var path=require(_0xd8a6('0x2'));var timeout=require(_0xd8a6('0x3'));var express=require(_0xd8a6('0x4'));var router=express[_0xd8a6('0x5')]();var auth=require(_0xd8a6('0x6'));var interaction=require(_0xd8a6('0x7'));var config=require(_0xd8a6('0x8'));var controller=require('./template.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xd8a6('0x9')]);router['get'](_0xd8a6('0xa'),auth[_0xd8a6('0xb')](),controller[_0xd8a6('0xc')]);router[_0xd8a6('0xd')]('/',auth[_0xd8a6('0xb')](),controller['create']);router[_0xd8a6('0xe')](_0xd8a6('0xa'),auth[_0xd8a6('0xb')](),controller[_0xd8a6('0xf')]);router['delete'](_0xd8a6('0xa'),auth[_0xd8a6('0xb')](),controller[_0xd8a6('0x10')]);module[_0xd8a6('0x11')]=router;
\ No newline at end of file
+var _0x8062=['get','isAuthenticated','index','show','post','/:id','destroy','exports','multer','path','connect-timeout','express','../../config/environment','./template.controller'];(function(_0x3fc97b,_0x20ca29){var _0x3a0c82=function(_0x1c15ec){while(--_0x1c15ec){_0x3fc97b['push'](_0x3fc97b['shift']());}};_0x3a0c82(++_0x20ca29);}(_0x8062,0xf6));var _0x2806=function(_0x524507,_0x2eee9d){_0x524507=_0x524507-0x0;var _0x20a7d2=_0x8062[_0x524507];return _0x20a7d2;};'use strict';var multer=require(_0x2806('0x0'));var util=require('util');var path=require(_0x2806('0x1'));var timeout=require(_0x2806('0x2'));var express=require(_0x2806('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2806('0x4'));var controller=require(_0x2806('0x5'));router[_0x2806('0x6')]('/',auth[_0x2806('0x7')](),controller[_0x2806('0x8')]);router[_0x2806('0x6')]('/:id',auth[_0x2806('0x7')](),controller[_0x2806('0x9')]);router[_0x2806('0xa')]('/',auth[_0x2806('0x7')](),controller['create']);router['put']('/:id',auth[_0x2806('0x7')](),controller['update']);router['delete'](_0x2806('0xb'),auth['isAuthenticated'](),controller[_0x2806('0xc')]);module[_0x2806('0xd')]=router;
\ No newline at end of file
index 458063f..c4fec29 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x82d3=['sequelize','exports','STRING','TEXT'];(function(_0x2476e6,_0x47e762){var _0x6a2ebf=function(_0x25076f){while(--_0x25076f){_0x2476e6['push'](_0x2476e6['shift']());}};_0x6a2ebf(++_0x47e762);}(_0x82d3,0x90));var _0x382d=function(_0x231721,_0x3dd2a2){_0x231721=_0x231721-0x0;var _0x290e3a=_0x82d3[_0x231721];return _0x290e3a;};'use strict';var Sequelize=require(_0x382d('0x0'));module[_0x382d('0x1')]={'name':{'type':Sequelize[_0x382d('0x2')]},'description':{'type':Sequelize[_0x382d('0x2')]},'html':{'type':Sequelize[_0x382d('0x3')]}};
\ No newline at end of file
+var _0xc439=['sequelize','exports','STRING','TEXT'];(function(_0x57b236,_0x30614e){var _0x4feb29=function(_0x26d3e6){while(--_0x26d3e6){_0x57b236['push'](_0x57b236['shift']());}};_0x4feb29(++_0x30614e);}(_0xc439,0xbc));var _0x9c43=function(_0x5de4fd,_0xccb7b6){_0x5de4fd=_0x5de4fd-0x0;var _0x2d2131=_0xc439[_0x5de4fd];return _0x2d2131;};'use strict';var Sequelize=require(_0x9c43('0x0'));module[_0x9c43('0x1')]={'name':{'type':Sequelize[_0x9c43('0x2')]},'description':{'type':Sequelize[_0x9c43('0x2')]},'html':{'type':Sequelize[_0x9c43('0x3')]}};
\ No newline at end of file
index 475be70..9a80d48 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1813=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','get','Templates','UserProfileResource','sendStatus','error','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','map','VIRTUAL','field','merge','options','Template','includeAll','include','findAll','rows','params','length','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x5b1f05,_0x2ce935){var _0x37b5ae=function(_0x4c1307){while(--_0x4c1307){_0x5b1f05['push'](_0x5b1f05['shift']());}};_0x37b5ae(++_0x2ce935);}(_0x1813,0xa6));var _0x3181=function(_0x4150c7,_0x283881){_0x4150c7=_0x4150c7-0x0;var _0x3a2c93=_0x1813[_0x4150c7];return _0x3a2c93;};'use strict';var pdf=require(_0x3181('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3181('0x1'));var zipdir=require(_0x3181('0x2'));var jsonpatch=require(_0x3181('0x3'));var rp=require(_0x3181('0x4'));var moment=require(_0x3181('0x5'));var BPromise=require(_0x3181('0x6'));var Mustache=require(_0x3181('0x7'));var util=require(_0x3181('0x8'));var path=require(_0x3181('0x9'));var sox=require(_0x3181('0xa'));var csv=require(_0x3181('0xb'));var ejs=require(_0x3181('0xc'));var fs=require('fs');var _=require(_0x3181('0xd'));var squel=require(_0x3181('0xe'));var crypto=require('crypto');var jsforce=require(_0x3181('0xf'));var deskjs=require(_0x3181('0x10'));var toCsv=require(_0x3181('0xb'));var querystring=require(_0x3181('0x11'));var Papa=require(_0x3181('0x12'));var authService=require(_0x3181('0x13'));var hardwareService=require(_0x3181('0x14'));var Redis=require(_0x3181('0x15'));var qs=require(_0x3181('0x16'));var logger=require(_0x3181('0x17'))(_0x3181('0x18'));var utils=require(_0x3181('0x19'));var config=require('../../config/environment');var db=require(_0x3181('0x1a'))['db'];function respondWithStatusCode(_0x1d5426,_0x598d56){_0x598d56=_0x598d56||0xcc;return function(_0x1d998f){if(_0x1d998f){return _0x1d5426['sendStatus'](_0x598d56);}return _0x1d5426['status'](_0x598d56)[_0x3181('0x1b')]();};}function respondWithResult(_0x4589b2,_0x2b00cd){_0x2b00cd=_0x2b00cd||0xc8;return function(_0x29a401){if(_0x29a401){return _0x4589b2[_0x3181('0x1c')](_0x2b00cd)['json'](_0x29a401);}};}function respondWithFilteredResult(_0x42ab92,_0x55852d){return function(_0x3534c4){if(_0x3534c4){var _0x2dc459=_0x3534c4[_0x3181('0x1d')],_0x45a0c0=_0x55852d['offset'],_0x537a2f=_0x55852d[_0x3181('0x1e')]+_0x55852d[_0x3181('0x1f')],_0x23fff9;if(_0x537a2f>=_0x2dc459){_0x537a2f=_0x2dc459;_0x23fff9=0xc8;}else{_0x23fff9=0xce;}_0x42ab92[_0x3181('0x1c')](_0x23fff9);return _0x42ab92[_0x3181('0x20')](_0x3181('0x21'),_0x45a0c0+'-'+_0x537a2f+'/'+_0x2dc459)[_0x3181('0x22')](_0x3534c4);}return null;};}function patchUpdates(_0x10a789){return function(_0x43f59a){try{jsonpatch[_0x3181('0x23')](_0x43f59a,_0x10a789,!![]);}catch(_0x336135){return BPromise[_0x3181('0x24')](_0x336135);}return _0x43f59a[_0x3181('0x25')]();};}function saveUpdates(_0x12563e,_0xc1c84c){return function(_0x441f95){if(_0x441f95){return _0x441f95[_0x3181('0x26')](_0x12563e)['then'](function(_0x13f508){return _0x13f508;});}return null;};}function removeEntity(_0x40ce99,_0x2f86fb){return function(_0x4f1648){if(_0x4f1648){return _0x4f1648[_0x3181('0x27')]()[_0x3181('0x28')](function(){var _0x4b0204=_0x4f1648[_0x3181('0x29')]({'plain':!![]});var _0x19b219=_0x3181('0x2a');return db[_0x3181('0x2b')][_0x3181('0x27')]({'where':{'type':_0x19b219,'resourceId':_0x4b0204['id']}})['then'](function(){return _0x4f1648;});})[_0x3181('0x28')](function(){_0x40ce99['status'](0xcc)[_0x3181('0x1b')]();});}};}function handleEntityNotFound(_0x3fcd6a,_0x2258eb){return function(_0x3698f6){if(!_0x3698f6){_0x3fcd6a[_0x3181('0x2c')](0x194);}return _0x3698f6;};}function handleError(_0x2ef4ff,_0x3b21a0){_0x3b21a0=_0x3b21a0||0x1f4;return function(_0x51d7f7){logger[_0x3181('0x2d')](_0x51d7f7[_0x3181('0x2e')]);if(_0x51d7f7[_0x3181('0x2f')]){delete _0x51d7f7['name'];}_0x2ef4ff['status'](_0x3b21a0)[_0x3181('0x30')](_0x51d7f7);};}exports[_0x3181('0x31')]=function(_0x20faa2,_0x1adb7c){var _0x12aa85={},_0x494e72={},_0x38fb87={'count':0x0,'rows':[]};var _0x5220d4=db['Template'][_0x3181('0x32')];_0x494e72[_0x3181('0x33')]=_[_0x3181('0x34')](_0x5220d4);_0x494e72[_0x3181('0x35')]=_[_0x3181('0x34')](_0x20faa2[_0x3181('0x35')]);_0x494e72[_0x3181('0x36')]=_[_0x3181('0x37')](_0x494e72[_0x3181('0x33')],_0x494e72['query']);_0x12aa85[_0x3181('0x38')]=_[_0x3181('0x37')](_0x494e72['model'],qs[_0x3181('0x39')](_0x20faa2[_0x3181('0x35')][_0x3181('0x39')]));_0x12aa85['attributes']=_0x12aa85['attributes']['length']?_0x12aa85[_0x3181('0x38')]:_0x494e72[_0x3181('0x33')];if(!_0x20faa2[_0x3181('0x35')][_0x3181('0x3a')]('nolimit')){_0x12aa85[_0x3181('0x1f')]=qs[_0x3181('0x1f')](_0x20faa2[_0x3181('0x35')]['limit']);_0x12aa85['offset']=qs[_0x3181('0x1e')](_0x20faa2[_0x3181('0x35')][_0x3181('0x1e')]);}_0x12aa85[_0x3181('0x3b')]=qs[_0x3181('0x3c')](_0x20faa2[_0x3181('0x35')][_0x3181('0x3c')]);_0x12aa85[_0x3181('0x3d')]=qs['filters'](_[_0x3181('0x3e')](_0x20faa2[_0x3181('0x35')],_0x494e72[_0x3181('0x36')]));if(_0x20faa2['query'][_0x3181('0x3f')]){_0x12aa85[_0x3181('0x3d')]=_['merge'](_0x12aa85[_0x3181('0x3d')],{'$or':_[_0x3181('0x40')](_0x5220d4,function(_0x11c77f){if(_0x11c77f['type']['key']!==_0x3181('0x41')){var _0x4a968f={};_0x4a968f[_0x11c77f[_0x3181('0x42')]]={'$like':'%'+_0x20faa2[_0x3181('0x35')]['filter']+'%'};return _0x4a968f;}})});}_0x12aa85=_[_0x3181('0x43')]({},_0x12aa85,_0x20faa2[_0x3181('0x44')]);var _0x421c19={'where':_0x12aa85['where']};return db[_0x3181('0x45')][_0x3181('0x1d')](_0x421c19)[_0x3181('0x28')](function(_0x1625b6){_0x38fb87[_0x3181('0x1d')]=_0x1625b6;if(_0x20faa2[_0x3181('0x35')][_0x3181('0x46')]){_0x12aa85[_0x3181('0x47')]=[{'all':!![]}];}return db[_0x3181('0x45')][_0x3181('0x48')](_0x12aa85);})[_0x3181('0x28')](function(_0x45836c){_0x38fb87[_0x3181('0x49')]=_0x45836c;return _0x38fb87;})[_0x3181('0x28')](respondWithFilteredResult(_0x1adb7c,_0x12aa85))['catch'](handleError(_0x1adb7c,null));};exports['show']=function(_0xf7208f,_0x244b3d){var _0x3909b8={'raw':!![],'where':{'id':_0xf7208f[_0x3181('0x4a')]['id']}},_0x1873d3={};_0x1873d3['model']=_[_0x3181('0x34')](db[_0x3181('0x45')][_0x3181('0x32')]);_0x1873d3[_0x3181('0x35')]=_[_0x3181('0x34')](_0xf7208f[_0x3181('0x35')]);_0x1873d3[_0x3181('0x36')]=_['intersection'](_0x1873d3[_0x3181('0x33')],_0x1873d3['query']);_0x3909b8[_0x3181('0x38')]=_[_0x3181('0x37')](_0x1873d3[_0x3181('0x33')],qs['fields'](_0xf7208f[_0x3181('0x35')]['fields']));_0x3909b8[_0x3181('0x38')]=_0x3909b8[_0x3181('0x38')][_0x3181('0x4b')]?_0x3909b8['attributes']:_0x1873d3['model'];if(_0xf7208f[_0x3181('0x35')][_0x3181('0x46')]){_0x3909b8[_0x3181('0x47')]=[{'all':!![]}];}_0x3909b8=_[_0x3181('0x43')]({},_0x3909b8,_0xf7208f[_0x3181('0x44')]);return db['Template'][_0x3181('0x4c')](_0x3909b8)['then'](handleEntityNotFound(_0x244b3d,null))[_0x3181('0x28')](respondWithResult(_0x244b3d,null))[_0x3181('0x4d')](handleError(_0x244b3d,null));};exports['create']=function(_0xfd5610,_0x71b262){return db[_0x3181('0x45')][_0x3181('0x4e')](_0xfd5610[_0x3181('0x4f')],{})[_0x3181('0x28')](function(_0x259e87){var _0x444d14=_0xfd5610['user'][_0x3181('0x29')]({'plain':!![]});if(!_0x444d14)throw new Error(_0x3181('0x50'));if(_0x444d14['role']===_0x3181('0x51')){var _0x252c98=_0x259e87[_0x3181('0x29')]({'plain':!![]});var _0x4eb462='Templates';return db[_0x3181('0x52')][_0x3181('0x4c')]({'where':{'name':_0x4eb462,'userProfileId':_0x444d14[_0x3181('0x53')]},'raw':!![]})[_0x3181('0x28')](function(_0x4c1b5f){if(_0x4c1b5f&&_0x4c1b5f[_0x3181('0x54')]===0x0){return db[_0x3181('0x2b')][_0x3181('0x4e')]({'name':_0x252c98[_0x3181('0x2f')],'resourceId':_0x252c98['id'],'type':_0x4c1b5f[_0x3181('0x2f')],'sectionId':_0x4c1b5f['id']},{})[_0x3181('0x28')](function(){return _0x259e87;});}else{return _0x259e87;}})[_0x3181('0x4d')](function(_0x1baddb){logger[_0x3181('0x2d')](_0x3181('0x55'),_0x1baddb);throw _0x1baddb;});}return _0x259e87;})[_0x3181('0x28')](respondWithResult(_0x71b262,0xc9))[_0x3181('0x4d')](handleError(_0x71b262,null));};exports[_0x3181('0x26')]=function(_0x4fbc00,_0x28dcf0){if(_0x4fbc00[_0x3181('0x4f')]['id']){delete _0x4fbc00[_0x3181('0x4f')]['id'];}return db[_0x3181('0x45')][_0x3181('0x4c')]({'where':{'id':_0x4fbc00[_0x3181('0x4a')]['id']}})[_0x3181('0x28')](handleEntityNotFound(_0x28dcf0,null))[_0x3181('0x28')](saveUpdates(_0x4fbc00[_0x3181('0x4f')],null))[_0x3181('0x28')](respondWithResult(_0x28dcf0,null))['catch'](handleError(_0x28dcf0,null));};exports[_0x3181('0x27')]=function(_0x20f842,_0x2edbae){return db[_0x3181('0x45')][_0x3181('0x4c')]({'where':{'id':_0x20f842[_0x3181('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2edbae,null))[_0x3181('0x28')](removeEntity(_0x2edbae,null))[_0x3181('0x4d')](handleError(_0x2edbae,null));};
\ No newline at end of file
+var _0x7bf4=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','Content-Range','json','apply','reject','update','then','destroy','get','Templates','UserProfileResource','sendStatus','stack','name','Template','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','map','type','key','VIRTUAL','field','includeAll','include','catch','merge','find','create','body','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format'];(function(_0x50c35b,_0x34272e){var _0x518315=function(_0x13047f){while(--_0x13047f){_0x50c35b['push'](_0x50c35b['shift']());}};_0x518315(++_0x34272e);}(_0x7bf4,0x12a));var _0x47bf=function(_0x413b43,_0x444aea){_0x413b43=_0x413b43-0x0;var _0x2b8c3f=_0x7bf4[_0x413b43];return _0x2b8c3f;};'use strict';var pdf=require(_0x47bf('0x0'));var emlformat=require(_0x47bf('0x1'));var rimraf=require(_0x47bf('0x2'));var zipdir=require(_0x47bf('0x3'));var jsonpatch=require(_0x47bf('0x4'));var rp=require(_0x47bf('0x5'));var moment=require(_0x47bf('0x6'));var BPromise=require(_0x47bf('0x7'));var Mustache=require(_0x47bf('0x8'));var util=require(_0x47bf('0x9'));var path=require(_0x47bf('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x47bf('0xb'));var fs=require('fs');var _=require(_0x47bf('0xc'));var squel=require('squel');var crypto=require(_0x47bf('0xd'));var jsforce=require(_0x47bf('0xe'));var deskjs=require(_0x47bf('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x47bf('0x10'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0x47bf('0x11'));var logger=require('../../config/logger')(_0x47bf('0x12'));var utils=require(_0x47bf('0x13'));var config=require(_0x47bf('0x14'));var db=require(_0x47bf('0x15'))['db'];function respondWithStatusCode(_0x530566,_0x5e5706){_0x5e5706=_0x5e5706||0xcc;return function(_0x4ffe9a){if(_0x4ffe9a){return _0x530566['sendStatus'](_0x5e5706);}return _0x530566[_0x47bf('0x16')](_0x5e5706)[_0x47bf('0x17')]();};}function respondWithResult(_0x42b93c,_0x46e050){_0x46e050=_0x46e050||0xc8;return function(_0x5e85da){if(_0x5e85da){return _0x42b93c[_0x47bf('0x16')](_0x46e050)['json'](_0x5e85da);}};}function respondWithFilteredResult(_0x223069,_0x1d5402){return function(_0x2bd5e5){if(_0x2bd5e5){var _0x42b376=_0x2bd5e5[_0x47bf('0x18')],_0xa4e4a0=_0x1d5402[_0x47bf('0x19')],_0x13941e=_0x1d5402[_0x47bf('0x19')]+_0x1d5402['limit'],_0x3a93b0;if(_0x13941e>=_0x42b376){_0x13941e=_0x42b376;_0x3a93b0=0xc8;}else{_0x3a93b0=0xce;}_0x223069[_0x47bf('0x16')](_0x3a93b0);return _0x223069['set'](_0x47bf('0x1a'),_0xa4e4a0+'-'+_0x13941e+'/'+_0x42b376)[_0x47bf('0x1b')](_0x2bd5e5);}return null;};}function patchUpdates(_0x48438){return function(_0x34a284){try{jsonpatch[_0x47bf('0x1c')](_0x34a284,_0x48438,!![]);}catch(_0x360322){return BPromise[_0x47bf('0x1d')](_0x360322);}return _0x34a284['save']();};}function saveUpdates(_0x29dc7a,_0x3b6169){return function(_0x1e7be9){if(_0x1e7be9){return _0x1e7be9[_0x47bf('0x1e')](_0x29dc7a)[_0x47bf('0x1f')](function(_0x214513){return _0x214513;});}return null;};}function removeEntity(_0x405640,_0x3a2f6d){return function(_0xe01363){if(_0xe01363){return _0xe01363[_0x47bf('0x20')]()['then'](function(){var _0x5d7357=_0xe01363[_0x47bf('0x21')]({'plain':!![]});var _0x16c199=_0x47bf('0x22');return db[_0x47bf('0x23')][_0x47bf('0x20')]({'where':{'type':_0x16c199,'resourceId':_0x5d7357['id']}})[_0x47bf('0x1f')](function(){return _0xe01363;});})[_0x47bf('0x1f')](function(){_0x405640[_0x47bf('0x16')](0xcc)[_0x47bf('0x17')]();});}};}function handleEntityNotFound(_0x2f65c0,_0x50d98c){return function(_0x357dda){if(!_0x357dda){_0x2f65c0[_0x47bf('0x24')](0x194);}return _0x357dda;};}function handleError(_0x2b1ef0,_0x5060ed){_0x5060ed=_0x5060ed||0x1f4;return function(_0x4e6462){logger['error'](_0x4e6462[_0x47bf('0x25')]);if(_0x4e6462[_0x47bf('0x26')]){delete _0x4e6462[_0x47bf('0x26')];}_0x2b1ef0['status'](_0x5060ed)['send'](_0x4e6462);};}exports['index']=function(_0x2c1ff7,_0x45d1ca){var _0x28c17b={},_0x2005cd={},_0x45e43c={'count':0x0,'rows':[]};var _0x51066a=db[_0x47bf('0x27')][_0x47bf('0x28')];_0x2005cd[_0x47bf('0x29')]=_[_0x47bf('0x2a')](_0x51066a);_0x2005cd[_0x47bf('0x2b')]=_[_0x47bf('0x2a')](_0x2c1ff7[_0x47bf('0x2b')]);_0x2005cd[_0x47bf('0x2c')]=_[_0x47bf('0x2d')](_0x2005cd['model'],_0x2005cd[_0x47bf('0x2b')]);_0x28c17b[_0x47bf('0x2e')]=_[_0x47bf('0x2d')](_0x2005cd[_0x47bf('0x29')],qs[_0x47bf('0x2f')](_0x2c1ff7[_0x47bf('0x2b')][_0x47bf('0x2f')]));_0x28c17b[_0x47bf('0x2e')]=_0x28c17b[_0x47bf('0x2e')][_0x47bf('0x30')]?_0x28c17b[_0x47bf('0x2e')]:_0x2005cd[_0x47bf('0x29')];if(!_0x2c1ff7[_0x47bf('0x2b')]['hasOwnProperty'](_0x47bf('0x31'))){_0x28c17b['limit']=qs['limit'](_0x2c1ff7[_0x47bf('0x2b')][_0x47bf('0x32')]);_0x28c17b[_0x47bf('0x19')]=qs[_0x47bf('0x19')](_0x2c1ff7[_0x47bf('0x2b')][_0x47bf('0x19')]);}_0x28c17b[_0x47bf('0x33')]=qs[_0x47bf('0x34')](_0x2c1ff7[_0x47bf('0x2b')][_0x47bf('0x34')]);_0x28c17b['where']=qs[_0x47bf('0x2c')](_[_0x47bf('0x35')](_0x2c1ff7[_0x47bf('0x2b')],_0x2005cd['filters']));if(_0x2c1ff7[_0x47bf('0x2b')][_0x47bf('0x36')]){_0x28c17b[_0x47bf('0x37')]=_['merge'](_0x28c17b[_0x47bf('0x37')],{'$or':_[_0x47bf('0x38')](_0x51066a,function(_0x3b9fe2){if(_0x3b9fe2[_0x47bf('0x39')][_0x47bf('0x3a')]!==_0x47bf('0x3b')){var _0x3c0faf={};_0x3c0faf[_0x3b9fe2[_0x47bf('0x3c')]]={'$like':'%'+_0x2c1ff7[_0x47bf('0x2b')][_0x47bf('0x36')]+'%'};return _0x3c0faf;}})});}_0x28c17b=_['merge']({},_0x28c17b,_0x2c1ff7['options']);var _0x180541={'where':_0x28c17b[_0x47bf('0x37')]};return db[_0x47bf('0x27')][_0x47bf('0x18')](_0x180541)[_0x47bf('0x1f')](function(_0x25a314){_0x45e43c[_0x47bf('0x18')]=_0x25a314;if(_0x2c1ff7[_0x47bf('0x2b')][_0x47bf('0x3d')]){_0x28c17b[_0x47bf('0x3e')]=[{'all':!![]}];}return db[_0x47bf('0x27')]['findAll'](_0x28c17b);})[_0x47bf('0x1f')](function(_0x3ab1fe){_0x45e43c['rows']=_0x3ab1fe;return _0x45e43c;})[_0x47bf('0x1f')](respondWithFilteredResult(_0x45d1ca,_0x28c17b))[_0x47bf('0x3f')](handleError(_0x45d1ca,null));};exports['show']=function(_0x3813d7,_0x49c5ac){var _0x4acaa0={'raw':!![],'where':{'id':_0x3813d7['params']['id']}},_0xb0dc1d={};_0xb0dc1d[_0x47bf('0x29')]=_[_0x47bf('0x2a')](db['Template'][_0x47bf('0x28')]);_0xb0dc1d[_0x47bf('0x2b')]=_[_0x47bf('0x2a')](_0x3813d7[_0x47bf('0x2b')]);_0xb0dc1d[_0x47bf('0x2c')]=_[_0x47bf('0x2d')](_0xb0dc1d[_0x47bf('0x29')],_0xb0dc1d[_0x47bf('0x2b')]);_0x4acaa0[_0x47bf('0x2e')]=_[_0x47bf('0x2d')](_0xb0dc1d['model'],qs[_0x47bf('0x2f')](_0x3813d7['query'][_0x47bf('0x2f')]));_0x4acaa0[_0x47bf('0x2e')]=_0x4acaa0[_0x47bf('0x2e')][_0x47bf('0x30')]?_0x4acaa0[_0x47bf('0x2e')]:_0xb0dc1d[_0x47bf('0x29')];if(_0x3813d7['query'][_0x47bf('0x3d')]){_0x4acaa0[_0x47bf('0x3e')]=[{'all':!![]}];}_0x4acaa0=_[_0x47bf('0x40')]({},_0x4acaa0,_0x3813d7['options']);return db['Template'][_0x47bf('0x41')](_0x4acaa0)[_0x47bf('0x1f')](handleEntityNotFound(_0x49c5ac,null))[_0x47bf('0x1f')](respondWithResult(_0x49c5ac,null))[_0x47bf('0x3f')](handleError(_0x49c5ac,null));};exports[_0x47bf('0x42')]=function(_0x450e2b,_0x4868e2){return db[_0x47bf('0x27')][_0x47bf('0x42')](_0x450e2b[_0x47bf('0x43')],{})[_0x47bf('0x1f')](function(_0x11caa4){var _0x3bbb5a=_0x450e2b['user'][_0x47bf('0x21')]({'plain':!![]});if(!_0x3bbb5a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3bbb5a[_0x47bf('0x44')]==='user'){var _0x5eccc8=_0x11caa4['get']({'plain':!![]});var _0x45cbc7=_0x47bf('0x22');return db[_0x47bf('0x45')][_0x47bf('0x41')]({'where':{'name':_0x45cbc7,'userProfileId':_0x3bbb5a[_0x47bf('0x46')]},'raw':!![]})[_0x47bf('0x1f')](function(_0x5914d6){if(_0x5914d6&&_0x5914d6[_0x47bf('0x47')]===0x0){return db[_0x47bf('0x23')][_0x47bf('0x42')]({'name':_0x5eccc8[_0x47bf('0x26')],'resourceId':_0x5eccc8['id'],'type':_0x5914d6[_0x47bf('0x26')],'sectionId':_0x5914d6['id']},{})['then'](function(){return _0x11caa4;});}else{return _0x11caa4;}})[_0x47bf('0x3f')](function(_0x2eec53){logger[_0x47bf('0x48')](_0x47bf('0x49'),_0x2eec53);throw _0x2eec53;});}return _0x11caa4;})[_0x47bf('0x1f')](respondWithResult(_0x4868e2,0xc9))[_0x47bf('0x3f')](handleError(_0x4868e2,null));};exports[_0x47bf('0x1e')]=function(_0x2466b0,_0x2c6b7f){if(_0x2466b0['body']['id']){delete _0x2466b0[_0x47bf('0x43')]['id'];}return db[_0x47bf('0x27')][_0x47bf('0x41')]({'where':{'id':_0x2466b0['params']['id']}})['then'](handleEntityNotFound(_0x2c6b7f,null))[_0x47bf('0x1f')](saveUpdates(_0x2466b0[_0x47bf('0x43')],null))[_0x47bf('0x1f')](respondWithResult(_0x2c6b7f,null))[_0x47bf('0x3f')](handleError(_0x2c6b7f,null));};exports[_0x47bf('0x20')]=function(_0x2d1918,_0x1a504d){return db[_0x47bf('0x27')][_0x47bf('0x41')]({'where':{'id':_0x2d1918[_0x47bf('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1a504d,null))[_0x47bf('0x1f')](removeEntity(_0x1a504d,null))[_0x47bf('0x3f')](handleError(_0x1a504d,null));};
\ No newline at end of file
index 870e902..61745bc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5569=['bluebird','./template.attributes','Template','tools_templates','lodash','../../config/logger','api','moment'];(function(_0x3d297e,_0x3551ee){var _0x4f36cf=function(_0x44710d){while(--_0x44710d){_0x3d297e['push'](_0x3d297e['shift']());}};_0x4f36cf(++_0x3551ee);}(_0x5569,0x94));var _0x9556=function(_0x117994,_0x46bbbb){_0x117994=_0x117994-0x0;var _0x40814a=_0x5569[_0x117994];return _0x40814a;};'use strict';var _=require(_0x9556('0x0'));var util=require('util');var logger=require(_0x9556('0x1'))(_0x9556('0x2'));var moment=require(_0x9556('0x3'));var BPromise=require(_0x9556('0x4'));var rp=require('request-promise');var attributes=require(_0x9556('0x5'));module['exports']=function(_0x311086,_0x5be74d){return _0x311086['define'](_0x9556('0x6'),attributes,{'tableName':_0x9556('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xd3ad=['request-promise','./template.attributes','exports','define','Template','tools_templates','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1facfc,_0x2ed897){var _0x17e82f=function(_0x53494f){while(--_0x53494f){_0x1facfc['push'](_0x1facfc['shift']());}};_0x17e82f(++_0x2ed897);}(_0xd3ad,0x15b));var _0xdd3a=function(_0x4b93c0,_0x2f0e35){_0x4b93c0=_0x4b93c0-0x0;var _0xba989=_0xd3ad[_0x4b93c0];return _0xba989;};'use strict';var _=require(_0xdd3a('0x0'));var util=require('util');var logger=require(_0xdd3a('0x1'))(_0xdd3a('0x2'));var moment=require(_0xdd3a('0x3'));var BPromise=require(_0xdd3a('0x4'));var rp=require(_0xdd3a('0x5'));var attributes=require(_0xdd3a('0x6'));module[_0xdd3a('0x7')]=function(_0x41df56,_0x3bcf4a){return _0x41df56[_0xdd3a('0x8')](_0xdd3a('0x9'),attributes,{'tableName':_0xdd3a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index dcb1302..06b5062 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4901=['http','request','then','Template,\x20%s,\x20%s','Template,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetTemplate','findAll','options','raw','where','limit','include','map','model','info','debug','lodash','util','moment','randomstring','../../config/logger','../../config/environment','jayson/promise'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x4901,0x155));var _0x1490=function(_0x30d755,_0x188807){_0x30d755=_0x30d755-0x0;var _0xa16cea=_0x4901[_0x30d755];return _0xa16cea;};'use strict';var _=require(_0x1490('0x0'));var util=require(_0x1490('0x1'));var moment=require(_0x1490('0x2'));var BPromise=require('bluebird');var rs=require(_0x1490('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1490('0x4'))('rpc');var config=require(_0x1490('0x5'));var jayson=require(_0x1490('0x6'));var client=jayson['client'][_0x1490('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1ee4b7,_0x556e54,_0x24c228){return new BPromise(function(_0x332321,_0x15bde8){return client[_0x1490('0x8')](_0x1ee4b7,_0x24c228)[_0x1490('0x9')](function(_0x398691){logger['info'](_0x1490('0xa'),_0x556e54,'request\x20sent');logger['debug'](_0x1490('0xb'),_0x556e54,_0x1490('0xc'),JSON['stringify'](_0x398691));if(_0x398691[_0x1490('0xd')]){if(_0x398691[_0x1490('0xd')][_0x1490('0xe')]===0x1f4){logger[_0x1490('0xd')](_0x1490('0xa'),_0x556e54,_0x398691[_0x1490('0xd')][_0x1490('0xf')]);return _0x15bde8(_0x398691[_0x1490('0xd')][_0x1490('0xf')]);}logger[_0x1490('0xd')](_0x1490('0xa'),_0x556e54,_0x398691[_0x1490('0xd')]['message']);return _0x332321(_0x398691[_0x1490('0xd')][_0x1490('0xf')]);}else{logger['info'](_0x1490('0xa'),_0x556e54,_0x1490('0xc'));_0x332321(_0x398691[_0x1490('0x10')][_0x1490('0xf')]);}})[_0x1490('0x11')](function(_0x5bc647){logger[_0x1490('0xd')]('Template,\x20%s,\x20%s',_0x556e54,_0x5bc647);_0x15bde8(_0x5bc647);});});}exports[_0x1490('0x12')]=function(_0x53e967){var _0x1fe196=this;return new Promise(function(_0x28a80f,_0x34f411){return db['Template'][_0x1490('0x13')]({'raw':_0x53e967[_0x1490('0x14')]?_0x53e967[_0x1490('0x14')][_0x1490('0x15')]===undefined?!![]:![]:!![],'where':_0x53e967[_0x1490('0x14')]?_0x53e967['options'][_0x1490('0x16')]||null:null,'attributes':_0x53e967['options']?_0x53e967[_0x1490('0x14')]['attributes']||null:null,'limit':_0x53e967['options']?_0x53e967[_0x1490('0x14')][_0x1490('0x17')]||null:null,'include':_0x53e967['options']?_0x53e967[_0x1490('0x14')][_0x1490('0x18')]?_['map'](_0x53e967[_0x1490('0x14')][_0x1490('0x18')],function(_0x4aa207){return{'model':db[_0x4aa207['model']],'as':_0x4aa207['as'],'attributes':_0x4aa207['attributes'],'include':_0x4aa207[_0x1490('0x18')]?_[_0x1490('0x19')](_0x4aa207[_0x1490('0x18')],function(_0xed6483){return{'model':db[_0xed6483[_0x1490('0x1a')]],'as':_0xed6483['as'],'attributes':_0xed6483['attributes'],'include':_0xed6483[_0x1490('0x18')]?_[_0x1490('0x19')](_0xed6483[_0x1490('0x18')],function(_0x2e96ab){return{'model':db[_0x2e96ab[_0x1490('0x1a')]],'as':_0x2e96ab['as'],'attributes':_0x2e96ab['attributes']};}):[]};}):[]};}):[]:[]})[_0x1490('0x9')](function(_0x2a3766){logger[_0x1490('0x1b')](_0x1490('0x12'),_0x53e967);logger[_0x1490('0x1c')](_0x1490('0x12'),_0x53e967,JSON['stringify'](_0x2a3766));_0x28a80f(_0x2a3766);})[_0x1490('0x11')](function(_0x185688){logger[_0x1490('0xd')](_0x1490('0x12'),_0x185688[_0x1490('0xf')],_0x53e967);_0x34f411(_0x1fe196[_0x1490('0xd')](0x1f4,_0x185688[_0x1490('0xf')]));});});};
\ No newline at end of file
+var _0xd115=['lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Template','findAll','options','raw','limit','include','map','model','attributes','catch','GetTemplate'];(function(_0x147cf7,_0x14dddf){var _0x4aec25=function(_0x1f8fa2){while(--_0x1f8fa2){_0x147cf7['push'](_0x147cf7['shift']());}};_0x4aec25(++_0x14dddf);}(_0xd115,0x10e));var _0x5d11=function(_0x143459,_0x508aa3){_0x143459=_0x143459-0x0;var _0x4ea3e8=_0xd115[_0x143459];return _0x4ea3e8;};'use strict';var _=require(_0x5d11('0x0'));var util=require('util');var moment=require(_0x5d11('0x1'));var BPromise=require('bluebird');var rs=require(_0x5d11('0x2'));var fs=require('fs');var Redis=require(_0x5d11('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5d11('0x4'));var logger=require(_0x5d11('0x5'))(_0x5d11('0x6'));var config=require('../../config/environment');var jayson=require(_0x5d11('0x7'));var client=jayson['client'][_0x5d11('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39e8d5,_0x3dc9b4,_0x340668){return new BPromise(function(_0x3e7526,_0x39838b){return client[_0x5d11('0x9')](_0x39e8d5,_0x340668)[_0x5d11('0xa')](function(_0x51a7f4){logger[_0x5d11('0xb')](_0x5d11('0xc'),_0x3dc9b4,_0x5d11('0xd'));logger['debug'](_0x5d11('0xe'),_0x3dc9b4,'request\x20sent',JSON[_0x5d11('0xf')](_0x51a7f4));if(_0x51a7f4[_0x5d11('0x10')]){if(_0x51a7f4['error'][_0x5d11('0x11')]===0x1f4){logger['error'](_0x5d11('0xc'),_0x3dc9b4,_0x51a7f4[_0x5d11('0x10')][_0x5d11('0x12')]);return _0x39838b(_0x51a7f4[_0x5d11('0x10')][_0x5d11('0x12')]);}logger[_0x5d11('0x10')](_0x5d11('0xc'),_0x3dc9b4,_0x51a7f4['error'][_0x5d11('0x12')]);return _0x3e7526(_0x51a7f4['error'][_0x5d11('0x12')]);}else{logger[_0x5d11('0xb')](_0x5d11('0xc'),_0x3dc9b4,'request\x20sent');_0x3e7526(_0x51a7f4['result'][_0x5d11('0x12')]);}})['catch'](function(_0x34c95a){logger[_0x5d11('0x10')](_0x5d11('0xc'),_0x3dc9b4,_0x34c95a);_0x39838b(_0x34c95a);});});}exports['GetTemplate']=function(_0xa16597){var _0x19c2d8=this;return new Promise(function(_0x504add,_0x39a0bc){return db[_0x5d11('0x13')][_0x5d11('0x14')]({'raw':_0xa16597['options']?_0xa16597[_0x5d11('0x15')][_0x5d11('0x16')]===undefined?!![]:![]:!![],'where':_0xa16597[_0x5d11('0x15')]?_0xa16597[_0x5d11('0x15')]['where']||null:null,'attributes':_0xa16597[_0x5d11('0x15')]?_0xa16597[_0x5d11('0x15')]['attributes']||null:null,'limit':_0xa16597[_0x5d11('0x15')]?_0xa16597[_0x5d11('0x15')][_0x5d11('0x17')]||null:null,'include':_0xa16597['options']?_0xa16597[_0x5d11('0x15')][_0x5d11('0x18')]?_[_0x5d11('0x19')](_0xa16597[_0x5d11('0x15')]['include'],function(_0x32da2e){return{'model':db[_0x32da2e[_0x5d11('0x1a')]],'as':_0x32da2e['as'],'attributes':_0x32da2e[_0x5d11('0x1b')],'include':_0x32da2e[_0x5d11('0x18')]?_[_0x5d11('0x19')](_0x32da2e[_0x5d11('0x18')],function(_0x358ca0){return{'model':db[_0x358ca0[_0x5d11('0x1a')]],'as':_0x358ca0['as'],'attributes':_0x358ca0['attributes'],'include':_0x358ca0[_0x5d11('0x18')]?_['map'](_0x358ca0[_0x5d11('0x18')],function(_0x14a34e){return{'model':db[_0x14a34e[_0x5d11('0x1a')]],'as':_0x14a34e['as'],'attributes':_0x14a34e[_0x5d11('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5d11('0xa')](function(_0x3a904c){logger[_0x5d11('0xb')]('GetTemplate',_0xa16597);logger['debug']('GetTemplate',_0xa16597,JSON[_0x5d11('0xf')](_0x3a904c));_0x504add(_0x3a904c);})[_0x5d11('0x1c')](function(_0x1a8090){logger[_0x5d11('0x10')](_0x5d11('0x1d'),_0x1a8090[_0x5d11('0x12')],_0xa16597);_0x39a0bc(_0x19c2d8[_0x5d11('0x10')](0x1f4,_0x1a8090[_0x5d11('0x12')]));});});};
\ No newline at end of file
index 123dc73..d931952 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xde0f=['exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','index','/:id','isAuthenticated','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','put','update','destroy'];(function(_0x4460c0,_0x125527){var _0x19da2b=function(_0x5db4f5){while(--_0x5db4f5){_0x4460c0['push'](_0x4460c0['shift']());}};_0x19da2b(++_0x125527);}(_0xde0f,0x1bb));var _0xfde0=function(_0x24b2de,_0x1f517b){_0x24b2de=_0x24b2de-0x0;var _0x54ad39=_0xde0f[_0x24b2de];return _0x54ad39;};'use strict';var multer=require('multer');var util=require(_0xfde0('0x0'));var path=require('path');var timeout=require(_0xfde0('0x1'));var express=require(_0xfde0('0x2'));var router=express[_0xfde0('0x3')]();var auth=require(_0xfde0('0x4'));var interaction=require(_0xfde0('0x5'));var config=require(_0xfde0('0x6'));var controller=require(_0xfde0('0x7'));router[_0xfde0('0x8')]('/',auth['isAuthenticated'](),controller[_0xfde0('0x9')]);router[_0xfde0('0x8')](_0xfde0('0xa'),auth[_0xfde0('0xb')](),controller['show']);router['get'](_0xfde0('0xc'),auth[_0xfde0('0xb')](),controller[_0xfde0('0xd')]);router[_0xfde0('0x8')](_0xfde0('0xe'),auth[_0xfde0('0xb')](),controller[_0xfde0('0xf')]);router[_0xfde0('0x8')](_0xfde0('0x10'),auth[_0xfde0('0xb')](),controller[_0xfde0('0x11')]);router[_0xfde0('0x12')]('/',auth[_0xfde0('0xb')](),controller[_0xfde0('0x13')]);router[_0xfde0('0x12')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0xfde0('0x14')]);router['post'](_0xfde0('0xe'),auth[_0xfde0('0xb')](),controller[_0xfde0('0x15')]);router[_0xfde0('0x12')](_0xfde0('0x10'),auth[_0xfde0('0xb')](),controller['addAction']);router[_0xfde0('0x16')](_0xfde0('0xa'),auth[_0xfde0('0xb')](),controller[_0xfde0('0x17')]);router['delete'](_0xfde0('0xa'),auth[_0xfde0('0xb')](),controller[_0xfde0('0x18')]);module[_0xfde0('0x19')]=router;
\ No newline at end of file
+var _0x36c1=['put','update','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','/:id','show','/:id/all_conditions','isAuthenticated','getAllConditions','getAnyConditions','getActions','post','create','/:id/any_conditions','addAnyCondition','/:id/actions'];(function(_0x10ca81,_0x114e37){var _0x420d55=function(_0x561008){while(--_0x561008){_0x10ca81['push'](_0x10ca81['shift']());}};_0x420d55(++_0x114e37);}(_0x36c1,0x1de));var _0x136c=function(_0x2376d1,_0x38eec4){_0x2376d1=_0x2376d1-0x0;var _0x443759=_0x36c1[_0x2376d1];return _0x443759;};'use strict';var multer=require(_0x136c('0x0'));var util=require(_0x136c('0x1'));var path=require(_0x136c('0x2'));var timeout=require('connect-timeout');var express=require(_0x136c('0x3'));var router=express[_0x136c('0x4')]();var auth=require(_0x136c('0x5'));var interaction=require(_0x136c('0x6'));var config=require(_0x136c('0x7'));var controller=require(_0x136c('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x136c('0x9')](_0x136c('0xa'),auth['isAuthenticated'](),controller[_0x136c('0xb')]);router[_0x136c('0x9')](_0x136c('0xc'),auth[_0x136c('0xd')](),controller[_0x136c('0xe')]);router[_0x136c('0x9')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x136c('0xf')]);router[_0x136c('0x9')]('/:id/actions',auth[_0x136c('0xd')](),controller[_0x136c('0x10')]);router[_0x136c('0x11')]('/',auth[_0x136c('0xd')](),controller[_0x136c('0x12')]);router[_0x136c('0x11')](_0x136c('0xc'),auth[_0x136c('0xd')](),controller['addAllCondition']);router['post'](_0x136c('0x13'),auth['isAuthenticated'](),controller[_0x136c('0x14')]);router[_0x136c('0x11')](_0x136c('0x15'),auth[_0x136c('0xd')](),controller['addAction']);router[_0x136c('0x16')](_0x136c('0xa'),auth[_0x136c('0xd')](),controller[_0x136c('0x17')]);router['delete'](_0x136c('0xa'),auth['isAuthenticated'](),controller[_0x136c('0x18')]);module['exports']=router;
\ No newline at end of file
index d7272e3..f25e13c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7116=['exports','STRING','BOOLEAN','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7116,0x153));var _0x6711=function(_0x16e68e,_0x22bed3){_0x16e68e=_0x16e68e-0x0;var _0x1ae45d=_0x7116[_0x16e68e];return _0x1ae45d;};'use strict';var Sequelize=require(_0x6711('0x0'));module[_0x6711('0x1')]={'name':{'type':Sequelize[_0x6711('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6711('0x2')]},'status':{'type':Sequelize[_0x6711('0x3')],'defaultValue':![]}};
\ No newline at end of file
+var _0x5b4b=['BOOLEAN','exports','STRING'];(function(_0xf26d40,_0x2f4f46){var _0x50b68c=function(_0x10aa58){while(--_0x10aa58){_0xf26d40['push'](_0xf26d40['shift']());}};_0x50b68c(++_0x2f4f46);}(_0x5b4b,0x181));var _0xb5b4=function(_0x484599,_0x2d9ace){_0x484599=_0x484599-0x0;var _0x2e4ebf=_0x5b4b[_0x484599];return _0x2e4ebf;};'use strict';var Sequelize=require('sequelize');module[_0xb5b4('0x0')]={'name':{'type':Sequelize[_0xb5b4('0x1')]},'channel':{'type':Sequelize[_0xb5b4('0x1')]},'description':{'type':Sequelize[_0xb5b4('0x1')]},'status':{'type':Sequelize[_0xb5b4('0x2')],'defaultValue':![]}};
\ No newline at end of file
index ba5af50..add4b4f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdf3f=['querystring','papaparse','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','save','update','then','destroy','Triggers','UserProfileResource','error','name','send','index','Trigger','rawAttributes','keys','query','model','intersection','fields','attributes','length','nolimit','limit','order','sort','filters','filter','merge','where','map','type','key','VIRTUAL','field','options','include','rows','catch','show','params','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','TriggerAllId','Condition','findOne','pick','getAllConditions','hasOwnProperty','getAnyConditions','addAction','TriggerId','Action','getActions','html-pdf','rimraf','fast-json-patch','bluebird','to-csv','ejs','lodash','jsforce','desk.js'];(function(_0x2ad1b0,_0x126c55){var _0xf3902c=function(_0x5c6496){while(--_0x5c6496){_0x2ad1b0['push'](_0x2ad1b0['shift']());}};_0xf3902c(++_0x126c55);}(_0xdf3f,0xa5));var _0xfdf3=function(_0x516ffb,_0x5b5b42){_0x516ffb=_0x516ffb-0x0;var _0x319667=_0xdf3f[_0x516ffb];return _0x319667;};'use strict';var pdf=require(_0xfdf3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfdf3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfdf3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfdf3('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xfdf3('0x4'));var ejs=require(_0xfdf3('0x5'));var fs=require('fs');var _=require(_0xfdf3('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfdf3('0x7'));var deskjs=require(_0xfdf3('0x8'));var toCsv=require('to-csv');var querystring=require(_0xfdf3('0x9'));var Papa=require(_0xfdf3('0xa'));var authService=require('../../components/auth/service');var hardwareService=require(_0xfdf3('0xb'));var Redis=require('ioredis');var qs=require(_0xfdf3('0xc'));var logger=require(_0xfdf3('0xd'))(_0xfdf3('0xe'));var utils=require(_0xfdf3('0xf'));var config=require(_0xfdf3('0x10'));var db=require(_0xfdf3('0x11'))['db'];function respondWithStatusCode(_0x114f90,_0x4fcb57){_0x4fcb57=_0x4fcb57||0xcc;return function(_0x5bb703){if(_0x5bb703){return _0x114f90[_0xfdf3('0x12')](_0x4fcb57);}return _0x114f90[_0xfdf3('0x13')](_0x4fcb57)[_0xfdf3('0x14')]();};}function respondWithResult(_0x425dca,_0xce72b2){_0xce72b2=_0xce72b2||0xc8;return function(_0x3fb69c){if(_0x3fb69c){return _0x425dca[_0xfdf3('0x13')](_0xce72b2)[_0xfdf3('0x15')](_0x3fb69c);}};}function respondWithFilteredResult(_0x58be52,_0x2c1aec){return function(_0x34eadc){if(_0x34eadc){var _0x2169f2=_0x34eadc[_0xfdf3('0x16')],_0x81bfde=_0x2c1aec[_0xfdf3('0x17')],_0x6c074d=_0x2c1aec[_0xfdf3('0x17')]+_0x2c1aec['limit'],_0x21c995;if(_0x6c074d>=_0x2169f2){_0x6c074d=_0x2169f2;_0x21c995=0xc8;}else{_0x21c995=0xce;}_0x58be52[_0xfdf3('0x13')](_0x21c995);return _0x58be52['set'](_0xfdf3('0x18'),_0x81bfde+'-'+_0x6c074d+'/'+_0x2169f2)[_0xfdf3('0x15')](_0x34eadc);}return null;};}function patchUpdates(_0x1af84c){return function(_0xafd229){try{jsonpatch[_0xfdf3('0x19')](_0xafd229,_0x1af84c,!![]);}catch(_0x8a6451){return BPromise['reject'](_0x8a6451);}return _0xafd229[_0xfdf3('0x1a')]();};}function saveUpdates(_0x4f74a4,_0xed963e){return function(_0x3b520f){if(_0x3b520f){return _0x3b520f[_0xfdf3('0x1b')](_0x4f74a4)[_0xfdf3('0x1c')](function(_0xa56628){return _0xa56628;});}return null;};}function removeEntity(_0x2617de,_0x3ad532){return function(_0x2d94c2){if(_0x2d94c2){return _0x2d94c2[_0xfdf3('0x1d')]()[_0xfdf3('0x1c')](function(){var _0x2e8206=_0x2d94c2['get']({'plain':!![]});var _0x3258cf=_0xfdf3('0x1e');return db[_0xfdf3('0x1f')][_0xfdf3('0x1d')]({'where':{'type':_0x3258cf,'resourceId':_0x2e8206['id']}})[_0xfdf3('0x1c')](function(){return _0x2d94c2;});})[_0xfdf3('0x1c')](function(){_0x2617de['status'](0xcc)[_0xfdf3('0x14')]();});}};}function handleEntityNotFound(_0x3936f0,_0x15cb0b){return function(_0x5ab340){if(!_0x5ab340){_0x3936f0[_0xfdf3('0x12')](0x194);}return _0x5ab340;};}function handleError(_0x66e3d7,_0x3f05d8){_0x3f05d8=_0x3f05d8||0x1f4;return function(_0x59eac1){logger[_0xfdf3('0x20')](_0x59eac1['stack']);if(_0x59eac1[_0xfdf3('0x21')]){delete _0x59eac1[_0xfdf3('0x21')];}_0x66e3d7[_0xfdf3('0x13')](_0x3f05d8)[_0xfdf3('0x22')](_0x59eac1);};}exports[_0xfdf3('0x23')]=function(_0x391300,_0x121531){var _0x353ed8={},_0x5c2494={},_0x4be55d={'count':0x0,'rows':[]};var _0x2f56e9=db[_0xfdf3('0x24')][_0xfdf3('0x25')];_0x5c2494['model']=_[_0xfdf3('0x26')](_0x2f56e9);_0x5c2494[_0xfdf3('0x27')]=_[_0xfdf3('0x26')](_0x391300[_0xfdf3('0x27')]);_0x5c2494['filters']=_['intersection'](_0x5c2494[_0xfdf3('0x28')],_0x5c2494[_0xfdf3('0x27')]);_0x353ed8['attributes']=_[_0xfdf3('0x29')](_0x5c2494[_0xfdf3('0x28')],qs[_0xfdf3('0x2a')](_0x391300[_0xfdf3('0x27')]['fields']));_0x353ed8[_0xfdf3('0x2b')]=_0x353ed8[_0xfdf3('0x2b')][_0xfdf3('0x2c')]?_0x353ed8[_0xfdf3('0x2b')]:_0x5c2494[_0xfdf3('0x28')];if(!_0x391300['query']['hasOwnProperty'](_0xfdf3('0x2d'))){_0x353ed8[_0xfdf3('0x2e')]=qs[_0xfdf3('0x2e')](_0x391300[_0xfdf3('0x27')]['limit']);_0x353ed8[_0xfdf3('0x17')]=qs['offset'](_0x391300[_0xfdf3('0x27')][_0xfdf3('0x17')]);}_0x353ed8[_0xfdf3('0x2f')]=qs['sort'](_0x391300[_0xfdf3('0x27')][_0xfdf3('0x30')]);_0x353ed8['where']=qs[_0xfdf3('0x31')](_['pick'](_0x391300['query'],_0x5c2494[_0xfdf3('0x31')]));if(_0x391300[_0xfdf3('0x27')][_0xfdf3('0x32')]){_0x353ed8['where']=_[_0xfdf3('0x33')](_0x353ed8[_0xfdf3('0x34')],{'$or':_[_0xfdf3('0x35')](_0x2f56e9,function(_0x2c2a63){if(_0x2c2a63[_0xfdf3('0x36')][_0xfdf3('0x37')]!==_0xfdf3('0x38')){var _0x18acd7={};_0x18acd7[_0x2c2a63[_0xfdf3('0x39')]]={'$like':'%'+_0x391300[_0xfdf3('0x27')][_0xfdf3('0x32')]+'%'};return _0x18acd7;}})});}_0x353ed8=_[_0xfdf3('0x33')]({},_0x353ed8,_0x391300[_0xfdf3('0x3a')]);var _0x5ee424={'where':_0x353ed8['where']};return db['Trigger'][_0xfdf3('0x16')](_0x5ee424)[_0xfdf3('0x1c')](function(_0x38639d){_0x4be55d['count']=_0x38639d;if(_0x391300['query']['includeAll']){_0x353ed8[_0xfdf3('0x3b')]=[{'all':!![]}];}return db[_0xfdf3('0x24')]['findAll'](_0x353ed8);})[_0xfdf3('0x1c')](function(_0x2bb3b8){_0x4be55d[_0xfdf3('0x3c')]=_0x2bb3b8;return _0x4be55d;})[_0xfdf3('0x1c')](respondWithFilteredResult(_0x121531,_0x353ed8))[_0xfdf3('0x3d')](handleError(_0x121531,null));};exports[_0xfdf3('0x3e')]=function(_0xa0f777,_0x3c4c08){var _0x3bd26e={'raw':![],'where':{'id':_0xa0f777[_0xfdf3('0x3f')]['id']}},_0x89b752={};_0x89b752['model']=_[_0xfdf3('0x26')](db[_0xfdf3('0x24')][_0xfdf3('0x25')]);_0x89b752[_0xfdf3('0x27')]=_[_0xfdf3('0x26')](_0xa0f777[_0xfdf3('0x27')]);_0x89b752[_0xfdf3('0x31')]=_[_0xfdf3('0x29')](_0x89b752[_0xfdf3('0x28')],_0x89b752[_0xfdf3('0x27')]);_0x3bd26e[_0xfdf3('0x2b')]=_[_0xfdf3('0x29')](_0x89b752['model'],qs[_0xfdf3('0x2a')](_0xa0f777[_0xfdf3('0x27')]['fields']));_0x3bd26e[_0xfdf3('0x2b')]=_0x3bd26e['attributes'][_0xfdf3('0x2c')]?_0x3bd26e[_0xfdf3('0x2b')]:_0x89b752['model'];if(_0xa0f777['query'][_0xfdf3('0x40')]){_0x3bd26e[_0xfdf3('0x3b')]=[{'all':!![]}];}_0x3bd26e=_[_0xfdf3('0x33')]({},_0x3bd26e,_0xa0f777[_0xfdf3('0x3a')]);return db[_0xfdf3('0x24')][_0xfdf3('0x41')](_0x3bd26e)[_0xfdf3('0x1c')](handleEntityNotFound(_0x3c4c08,null))['then'](respondWithResult(_0x3c4c08,null))[_0xfdf3('0x3d')](handleError(_0x3c4c08,null));};exports[_0xfdf3('0x42')]=function(_0x43f072,_0x1a68ee){return db['Trigger'][_0xfdf3('0x42')](_0x43f072['body'],{})[_0xfdf3('0x1c')](function(_0x4ceb4c){var _0x4fe3d8=_0x43f072[_0xfdf3('0x43')][_0xfdf3('0x44')]({'plain':!![]});if(!_0x4fe3d8)throw new Error(_0xfdf3('0x45'));if(_0x4fe3d8[_0xfdf3('0x46')]===_0xfdf3('0x43')){var _0x48b3db=_0x4ceb4c[_0xfdf3('0x44')]({'plain':!![]});var _0x1ed8a2=_0xfdf3('0x1e');return db['UserProfileSection'][_0xfdf3('0x41')]({'where':{'name':_0x1ed8a2,'userProfileId':_0x4fe3d8[_0xfdf3('0x47')]},'raw':!![]})['then'](function(_0x4b594e){if(_0x4b594e&&_0x4b594e[_0xfdf3('0x48')]===0x0){return db[_0xfdf3('0x1f')][_0xfdf3('0x42')]({'name':_0x48b3db['name'],'resourceId':_0x48b3db['id'],'type':_0x4b594e[_0xfdf3('0x21')],'sectionId':_0x4b594e['id']},{})[_0xfdf3('0x1c')](function(){return _0x4ceb4c;});}else{return _0x4ceb4c;}})[_0xfdf3('0x3d')](function(_0x2442c1){logger[_0xfdf3('0x20')](_0xfdf3('0x49'),_0x2442c1);throw _0x2442c1;});}return _0x4ceb4c;})[_0xfdf3('0x1c')](respondWithResult(_0x1a68ee,0xc9))['catch'](handleError(_0x1a68ee,null));};exports['update']=function(_0x2b65f0,_0x128a0a){if(_0x2b65f0[_0xfdf3('0x4a')]['id']){delete _0x2b65f0[_0xfdf3('0x4a')]['id'];}return db['Trigger']['find']({'where':{'id':_0x2b65f0[_0xfdf3('0x3f')]['id']}})['then'](handleEntityNotFound(_0x128a0a,null))[_0xfdf3('0x1c')](saveUpdates(_0x2b65f0[_0xfdf3('0x4a')],null))[_0xfdf3('0x1c')](respondWithResult(_0x128a0a,null))[_0xfdf3('0x3d')](handleError(_0x128a0a,null));};exports[_0xfdf3('0x1d')]=function(_0x40bb23,_0x31dc5e){return db[_0xfdf3('0x24')]['find']({'where':{'id':_0x40bb23[_0xfdf3('0x3f')]['id']}})[_0xfdf3('0x1c')](handleEntityNotFound(_0x31dc5e,null))[_0xfdf3('0x1c')](removeEntity(_0x31dc5e,null))[_0xfdf3('0x3d')](handleError(_0x31dc5e,null));};exports[_0xfdf3('0x4b')]=function(_0x101fdf,_0x423e73,_0x147fa3){if(_0x101fdf['body']['id']){delete _0x101fdf['body']['id'];}return db['Trigger'][_0xfdf3('0x41')]({'where':{'id':_0x101fdf[_0xfdf3('0x3f')]['id']}})[_0xfdf3('0x1c')](handleEntityNotFound(_0x423e73,null))['then'](function(_0x5a11f3){if(_0x5a11f3){_0x101fdf[_0xfdf3('0x4a')][_0xfdf3('0x4c')]=_0x5a11f3['id'];return db[_0xfdf3('0x4d')][_0xfdf3('0x42')](_0x101fdf[_0xfdf3('0x4a')]);}})[_0xfdf3('0x1c')](respondWithResult(_0x423e73,null))[_0xfdf3('0x3d')](handleError(_0x423e73,null));};exports['addAnyCondition']=function(_0x1e64d0,_0x312485,_0x25ed4f){if(_0x1e64d0[_0xfdf3('0x4a')]['id']){delete _0x1e64d0[_0xfdf3('0x4a')]['id'];}return db['Trigger'][_0xfdf3('0x41')]({'where':{'id':_0x1e64d0[_0xfdf3('0x3f')]['id']}})[_0xfdf3('0x1c')](handleEntityNotFound(_0x312485,null))[_0xfdf3('0x1c')](function(_0x1b0709){if(_0x1b0709){_0x1e64d0[_0xfdf3('0x4a')]['TriggerAnyId']=_0x1b0709['id'];return db[_0xfdf3('0x4d')]['create'](_0x1e64d0[_0xfdf3('0x4a')]);}})[_0xfdf3('0x1c')](respondWithResult(_0x312485,null))[_0xfdf3('0x3d')](handleError(_0x312485,null));};exports['getAllConditions']=function(_0x399d78,_0x35f22a,_0x53e890){var _0x231178={};var _0x4524fb={};var _0x79bb87;var _0x523301;return db['Trigger'][_0xfdf3('0x4e')]({'where':{'id':_0x399d78[_0xfdf3('0x3f')]['id']}})[_0xfdf3('0x1c')](handleEntityNotFound(_0x35f22a,null))['then'](function(_0x204ca4){if(_0x204ca4){_0x79bb87=_0x204ca4;_0x4524fb[_0xfdf3('0x28')]=_[_0xfdf3('0x26')](db[_0xfdf3('0x4d')]['rawAttributes']);_0x4524fb[_0xfdf3('0x27')]=_['keys'](_0x399d78[_0xfdf3('0x27')]);_0x4524fb[_0xfdf3('0x31')]=_[_0xfdf3('0x29')](_0x4524fb[_0xfdf3('0x28')],_0x4524fb['query']);_0x231178['attributes']=_[_0xfdf3('0x29')](_0x4524fb['model'],qs['fields'](_0x399d78[_0xfdf3('0x27')][_0xfdf3('0x2a')]));_0x231178[_0xfdf3('0x2b')]=_0x231178[_0xfdf3('0x2b')]['length']?_0x231178['attributes']:_0x4524fb[_0xfdf3('0x28')];_0x231178['order']=qs[_0xfdf3('0x30')](_0x399d78[_0xfdf3('0x27')][_0xfdf3('0x30')]);_0x231178[_0xfdf3('0x34')]=qs[_0xfdf3('0x31')](_[_0xfdf3('0x4f')](_0x399d78[_0xfdf3('0x27')],_0x4524fb[_0xfdf3('0x31')]));if(_0x399d78[_0xfdf3('0x27')][_0xfdf3('0x32')]){_0x231178['where']=_[_0xfdf3('0x33')](_0x231178[_0xfdf3('0x34')],{'$or':_[_0xfdf3('0x35')](_0x231178[_0xfdf3('0x2b')],function(_0x2ca2ca){var _0x2ca574={};_0x2ca574[_0x2ca2ca]={'$like':'%'+_0x399d78[_0xfdf3('0x27')]['filter']+'%'};return _0x2ca574;})});}_0x231178=_[_0xfdf3('0x33')]({},_0x231178,_0x399d78[_0xfdf3('0x3a')]);return _0x79bb87[_0xfdf3('0x50')](_0x231178);}})[_0xfdf3('0x1c')](function(_0x38feb5){if(_0x38feb5){_0x523301=_0x38feb5[_0xfdf3('0x2c')];if(!_0x399d78[_0xfdf3('0x27')][_0xfdf3('0x51')](_0xfdf3('0x2d'))){_0x231178[_0xfdf3('0x2e')]=qs[_0xfdf3('0x2e')](_0x399d78[_0xfdf3('0x27')]['limit']);_0x231178[_0xfdf3('0x17')]=qs['offset'](_0x399d78[_0xfdf3('0x27')][_0xfdf3('0x17')]);}return _0x79bb87[_0xfdf3('0x50')](_0x231178);}})['then'](function(_0x3d5034){if(_0x3d5034){return _0x3d5034?{'count':_0x523301,'rows':_0x3d5034}:null;}})['then'](respondWithResult(_0x35f22a,null))[_0xfdf3('0x3d')](handleError(_0x35f22a,null));};exports[_0xfdf3('0x52')]=function(_0x29565a,_0x58f085,_0x564017){var _0x4a1910={};var _0x5cd54b={};var _0x24a182;var _0x1347d2;return db[_0xfdf3('0x24')][_0xfdf3('0x4e')]({'where':{'id':_0x29565a[_0xfdf3('0x3f')]['id']}})[_0xfdf3('0x1c')](handleEntityNotFound(_0x58f085,null))[_0xfdf3('0x1c')](function(_0x55c721){if(_0x55c721){_0x24a182=_0x55c721;_0x5cd54b[_0xfdf3('0x28')]=_['keys'](db[_0xfdf3('0x4d')][_0xfdf3('0x25')]);_0x5cd54b[_0xfdf3('0x27')]=_[_0xfdf3('0x26')](_0x29565a[_0xfdf3('0x27')]);_0x5cd54b[_0xfdf3('0x31')]=_[_0xfdf3('0x29')](_0x5cd54b[_0xfdf3('0x28')],_0x5cd54b[_0xfdf3('0x27')]);_0x4a1910[_0xfdf3('0x2b')]=_[_0xfdf3('0x29')](_0x5cd54b[_0xfdf3('0x28')],qs[_0xfdf3('0x2a')](_0x29565a[_0xfdf3('0x27')][_0xfdf3('0x2a')]));_0x4a1910['attributes']=_0x4a1910['attributes']['length']?_0x4a1910[_0xfdf3('0x2b')]:_0x5cd54b[_0xfdf3('0x28')];_0x4a1910[_0xfdf3('0x2f')]=qs[_0xfdf3('0x30')](_0x29565a['query'][_0xfdf3('0x30')]);_0x4a1910[_0xfdf3('0x34')]=qs['filters'](_[_0xfdf3('0x4f')](_0x29565a[_0xfdf3('0x27')],_0x5cd54b[_0xfdf3('0x31')]));if(_0x29565a['query'][_0xfdf3('0x32')]){_0x4a1910[_0xfdf3('0x34')]=_[_0xfdf3('0x33')](_0x4a1910['where'],{'$or':_[_0xfdf3('0x35')](_0x4a1910[_0xfdf3('0x2b')],function(_0x1c3003){var _0x3d6b09={};_0x3d6b09[_0x1c3003]={'$like':'%'+_0x29565a['query'][_0xfdf3('0x32')]+'%'};return _0x3d6b09;})});}_0x4a1910=_[_0xfdf3('0x33')]({},_0x4a1910,_0x29565a[_0xfdf3('0x3a')]);return _0x24a182[_0xfdf3('0x52')](_0x4a1910);}})['then'](function(_0x46957b){if(_0x46957b){_0x1347d2=_0x46957b[_0xfdf3('0x2c')];if(!_0x29565a[_0xfdf3('0x27')][_0xfdf3('0x51')]('nolimit')){_0x4a1910[_0xfdf3('0x2e')]=qs[_0xfdf3('0x2e')](_0x29565a[_0xfdf3('0x27')][_0xfdf3('0x2e')]);_0x4a1910['offset']=qs[_0xfdf3('0x17')](_0x29565a[_0xfdf3('0x27')][_0xfdf3('0x17')]);}return _0x24a182[_0xfdf3('0x52')](_0x4a1910);}})[_0xfdf3('0x1c')](function(_0x2faf44){if(_0x2faf44){return _0x2faf44?{'count':_0x1347d2,'rows':_0x2faf44}:null;}})[_0xfdf3('0x1c')](respondWithResult(_0x58f085,null))['catch'](handleError(_0x58f085,null));};exports[_0xfdf3('0x53')]=function(_0x2908df,_0x4630a8,_0x400b6e){if(_0x2908df['body']['id']){delete _0x2908df[_0xfdf3('0x4a')]['id'];}return db[_0xfdf3('0x24')][_0xfdf3('0x41')]({'where':{'id':_0x2908df[_0xfdf3('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4630a8,null))[_0xfdf3('0x1c')](function(_0x4bba47){if(_0x4bba47){_0x2908df[_0xfdf3('0x4a')][_0xfdf3('0x54')]=_0x4bba47['id'];return db[_0xfdf3('0x55')][_0xfdf3('0x42')](_0x2908df[_0xfdf3('0x4a')]);}})[_0xfdf3('0x1c')](respondWithResult(_0x4630a8,null))[_0xfdf3('0x3d')](handleError(_0x4630a8,null));};exports[_0xfdf3('0x56')]=function(_0x33cc04,_0x52e770,_0x392edc){var _0x22d65d={};var _0x1f9247={};var _0x4b0b53;var _0x14069e;return db[_0xfdf3('0x24')][_0xfdf3('0x4e')]({'where':{'id':_0x33cc04[_0xfdf3('0x3f')]['id']}})[_0xfdf3('0x1c')](handleEntityNotFound(_0x52e770,null))[_0xfdf3('0x1c')](function(_0x41312d){if(_0x41312d){_0x4b0b53=_0x41312d;_0x1f9247[_0xfdf3('0x28')]=_[_0xfdf3('0x26')](db[_0xfdf3('0x55')]['rawAttributes']);_0x1f9247[_0xfdf3('0x27')]=_[_0xfdf3('0x26')](_0x33cc04['query']);_0x1f9247[_0xfdf3('0x31')]=_[_0xfdf3('0x29')](_0x1f9247[_0xfdf3('0x28')],_0x1f9247[_0xfdf3('0x27')]);_0x22d65d[_0xfdf3('0x2b')]=_[_0xfdf3('0x29')](_0x1f9247[_0xfdf3('0x28')],qs['fields'](_0x33cc04[_0xfdf3('0x27')][_0xfdf3('0x2a')]));_0x22d65d[_0xfdf3('0x2b')]=_0x22d65d[_0xfdf3('0x2b')]['length']?_0x22d65d[_0xfdf3('0x2b')]:_0x1f9247['model'];_0x22d65d[_0xfdf3('0x2f')]=qs[_0xfdf3('0x30')](_0x33cc04[_0xfdf3('0x27')][_0xfdf3('0x30')]);_0x22d65d['where']=qs[_0xfdf3('0x31')](_[_0xfdf3('0x4f')](_0x33cc04[_0xfdf3('0x27')],_0x1f9247[_0xfdf3('0x31')]));if(_0x33cc04[_0xfdf3('0x27')][_0xfdf3('0x32')]){_0x22d65d[_0xfdf3('0x34')]=_[_0xfdf3('0x33')](_0x22d65d['where'],{'$or':_['map'](_0x22d65d['attributes'],function(_0x17f40d){var _0x50bda7={};_0x50bda7[_0x17f40d]={'$like':'%'+_0x33cc04['query'][_0xfdf3('0x32')]+'%'};return _0x50bda7;})});}_0x22d65d=_[_0xfdf3('0x33')]({},_0x22d65d,_0x33cc04['options']);return _0x4b0b53[_0xfdf3('0x56')](_0x22d65d);}})[_0xfdf3('0x1c')](function(_0x2aa8f8){if(_0x2aa8f8){_0x14069e=_0x2aa8f8['length'];if(!_0x33cc04['query'][_0xfdf3('0x51')](_0xfdf3('0x2d'))){_0x22d65d[_0xfdf3('0x2e')]=qs[_0xfdf3('0x2e')](_0x33cc04[_0xfdf3('0x27')][_0xfdf3('0x2e')]);_0x22d65d[_0xfdf3('0x17')]=qs['offset'](_0x33cc04[_0xfdf3('0x27')][_0xfdf3('0x17')]);}return _0x4b0b53[_0xfdf3('0x56')](_0x22d65d);}})[_0xfdf3('0x1c')](function(_0xdc89da){if(_0xdc89da){return _0xdc89da?{'count':_0x14069e,'rows':_0xdc89da}:null;}})[_0xfdf3('0x1c')](respondWithResult(_0x52e770,null))['catch'](handleError(_0x52e770,null));};
\ No newline at end of file
+var _0x09ef=['field','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','map','getAnyConditions','TriggerId','Action','getActions','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','then','destroy','Triggers','UserProfileResource','error','stack','name','send','index','Trigger','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','key','VIRTUAL'];(function(_0xf80b3,_0x25d5f3){var _0x10c489=function(_0x3c5aee){while(--_0x3c5aee){_0xf80b3['push'](_0xf80b3['shift']());}};_0x10c489(++_0x25d5f3);}(_0x09ef,0x194));var _0xf09e=function(_0x5164f7,_0x41eae0){_0x5164f7=_0x5164f7-0x0;var _0x535275=_0x09ef[_0x5164f7];return _0x535275;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf09e('0x0'));var jsonpatch=require(_0xf09e('0x1'));var rp=require('request-promise');var moment=require(_0xf09e('0x2'));var BPromise=require(_0xf09e('0x3'));var Mustache=require(_0xf09e('0x4'));var util=require(_0xf09e('0x5'));var path=require(_0xf09e('0x6'));var sox=require('sox');var csv=require(_0xf09e('0x7'));var ejs=require(_0xf09e('0x8'));var fs=require('fs');var _=require(_0xf09e('0x9'));var squel=require(_0xf09e('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf09e('0xb'));var toCsv=require(_0xf09e('0x7'));var querystring=require(_0xf09e('0xc'));var Papa=require(_0xf09e('0xd'));var authService=require(_0xf09e('0xe'));var hardwareService=require(_0xf09e('0xf'));var Redis=require('ioredis');var qs=require(_0xf09e('0x10'));var logger=require('../../config/logger')(_0xf09e('0x11'));var utils=require(_0xf09e('0x12'));var config=require(_0xf09e('0x13'));var db=require(_0xf09e('0x14'))['db'];function respondWithStatusCode(_0xf0614a,_0x12d28c){_0x12d28c=_0x12d28c||0xcc;return function(_0x41c6a5){if(_0x41c6a5){return _0xf0614a[_0xf09e('0x15')](_0x12d28c);}return _0xf0614a['status'](_0x12d28c)[_0xf09e('0x16')]();};}function respondWithResult(_0x794e0e,_0x259ef6){_0x259ef6=_0x259ef6||0xc8;return function(_0x322187){if(_0x322187){return _0x794e0e[_0xf09e('0x17')](_0x259ef6)[_0xf09e('0x18')](_0x322187);}};}function respondWithFilteredResult(_0x3e2807,_0x5b0e15){return function(_0x165f14){if(_0x165f14){var _0x4f743b=_0x165f14[_0xf09e('0x19')],_0x465b5c=_0x5b0e15[_0xf09e('0x1a')],_0x57b372=_0x5b0e15[_0xf09e('0x1a')]+_0x5b0e15[_0xf09e('0x1b')],_0x3f3ea9;if(_0x57b372>=_0x4f743b){_0x57b372=_0x4f743b;_0x3f3ea9=0xc8;}else{_0x3f3ea9=0xce;}_0x3e2807[_0xf09e('0x17')](_0x3f3ea9);return _0x3e2807['set'](_0xf09e('0x1c'),_0x465b5c+'-'+_0x57b372+'/'+_0x4f743b)['json'](_0x165f14);}return null;};}function patchUpdates(_0x4c88b9){return function(_0x2f751a){try{jsonpatch[_0xf09e('0x1d')](_0x2f751a,_0x4c88b9,!![]);}catch(_0x50223b){return BPromise[_0xf09e('0x1e')](_0x50223b);}return _0x2f751a['save']();};}function saveUpdates(_0x1d69c3,_0xe57a32){return function(_0xa65cd8){if(_0xa65cd8){return _0xa65cd8['update'](_0x1d69c3)[_0xf09e('0x1f')](function(_0x2aedf3){return _0x2aedf3;});}return null;};}function removeEntity(_0x4e8231,_0x55f5c0){return function(_0x30b7cb){if(_0x30b7cb){return _0x30b7cb[_0xf09e('0x20')]()[_0xf09e('0x1f')](function(){var _0x2c944f=_0x30b7cb['get']({'plain':!![]});var _0x481b89=_0xf09e('0x21');return db[_0xf09e('0x22')][_0xf09e('0x20')]({'where':{'type':_0x481b89,'resourceId':_0x2c944f['id']}})[_0xf09e('0x1f')](function(){return _0x30b7cb;});})[_0xf09e('0x1f')](function(){_0x4e8231['status'](0xcc)[_0xf09e('0x16')]();});}};}function handleEntityNotFound(_0x554e97,_0x47505f){return function(_0x525a0e){if(!_0x525a0e){_0x554e97[_0xf09e('0x15')](0x194);}return _0x525a0e;};}function handleError(_0x17f5d7,_0x10e509){_0x10e509=_0x10e509||0x1f4;return function(_0x114b11){logger[_0xf09e('0x23')](_0x114b11[_0xf09e('0x24')]);if(_0x114b11[_0xf09e('0x25')]){delete _0x114b11[_0xf09e('0x25')];}_0x17f5d7[_0xf09e('0x17')](_0x10e509)[_0xf09e('0x26')](_0x114b11);};}exports[_0xf09e('0x27')]=function(_0x220be0,_0x5b15db){var _0x4b5042={},_0x41ef3e={},_0x39f822={'count':0x0,'rows':[]};var _0x26df9e=db[_0xf09e('0x28')][_0xf09e('0x29')];_0x41ef3e[_0xf09e('0x2a')]=_['keys'](_0x26df9e);_0x41ef3e[_0xf09e('0x2b')]=_[_0xf09e('0x2c')](_0x220be0[_0xf09e('0x2b')]);_0x41ef3e[_0xf09e('0x2d')]=_[_0xf09e('0x2e')](_0x41ef3e['model'],_0x41ef3e['query']);_0x4b5042[_0xf09e('0x2f')]=_['intersection'](_0x41ef3e['model'],qs[_0xf09e('0x30')](_0x220be0[_0xf09e('0x2b')][_0xf09e('0x30')]));_0x4b5042[_0xf09e('0x2f')]=_0x4b5042[_0xf09e('0x2f')][_0xf09e('0x31')]?_0x4b5042[_0xf09e('0x2f')]:_0x41ef3e[_0xf09e('0x2a')];if(!_0x220be0['query'][_0xf09e('0x32')](_0xf09e('0x33'))){_0x4b5042['limit']=qs[_0xf09e('0x1b')](_0x220be0[_0xf09e('0x2b')]['limit']);_0x4b5042[_0xf09e('0x1a')]=qs[_0xf09e('0x1a')](_0x220be0[_0xf09e('0x2b')]['offset']);}_0x4b5042[_0xf09e('0x34')]=qs['sort'](_0x220be0[_0xf09e('0x2b')][_0xf09e('0x35')]);_0x4b5042['where']=qs['filters'](_[_0xf09e('0x36')](_0x220be0['query'],_0x41ef3e[_0xf09e('0x2d')]));if(_0x220be0['query'][_0xf09e('0x37')]){_0x4b5042['where']=_[_0xf09e('0x38')](_0x4b5042[_0xf09e('0x39')],{'$or':_['map'](_0x26df9e,function(_0x36cebf){if(_0x36cebf[_0xf09e('0x3a')][_0xf09e('0x3b')]!==_0xf09e('0x3c')){var _0x583d1b={};_0x583d1b[_0x36cebf[_0xf09e('0x3d')]]={'$like':'%'+_0x220be0[_0xf09e('0x2b')][_0xf09e('0x37')]+'%'};return _0x583d1b;}})});}_0x4b5042=_[_0xf09e('0x38')]({},_0x4b5042,_0x220be0[_0xf09e('0x3e')]);var _0x25c61c={'where':_0x4b5042[_0xf09e('0x39')]};return db['Trigger'][_0xf09e('0x19')](_0x25c61c)[_0xf09e('0x1f')](function(_0x315e80){_0x39f822[_0xf09e('0x19')]=_0x315e80;if(_0x220be0[_0xf09e('0x2b')][_0xf09e('0x3f')]){_0x4b5042[_0xf09e('0x40')]=[{'all':!![]}];}return db[_0xf09e('0x28')][_0xf09e('0x41')](_0x4b5042);})['then'](function(_0x1e91ae){_0x39f822[_0xf09e('0x42')]=_0x1e91ae;return _0x39f822;})[_0xf09e('0x1f')](respondWithFilteredResult(_0x5b15db,_0x4b5042))[_0xf09e('0x43')](handleError(_0x5b15db,null));};exports['show']=function(_0x352840,_0x344a5c){var _0x5da0b1={'raw':![],'where':{'id':_0x352840[_0xf09e('0x44')]['id']}},_0x2ab1b0={};_0x2ab1b0[_0xf09e('0x2a')]=_['keys'](db['Trigger'][_0xf09e('0x29')]);_0x2ab1b0[_0xf09e('0x2b')]=_[_0xf09e('0x2c')](_0x352840['query']);_0x2ab1b0[_0xf09e('0x2d')]=_[_0xf09e('0x2e')](_0x2ab1b0[_0xf09e('0x2a')],_0x2ab1b0[_0xf09e('0x2b')]);_0x5da0b1[_0xf09e('0x2f')]=_[_0xf09e('0x2e')](_0x2ab1b0[_0xf09e('0x2a')],qs[_0xf09e('0x30')](_0x352840[_0xf09e('0x2b')]['fields']));_0x5da0b1[_0xf09e('0x2f')]=_0x5da0b1[_0xf09e('0x2f')]['length']?_0x5da0b1[_0xf09e('0x2f')]:_0x2ab1b0[_0xf09e('0x2a')];if(_0x352840[_0xf09e('0x2b')][_0xf09e('0x3f')]){_0x5da0b1[_0xf09e('0x40')]=[{'all':!![]}];}_0x5da0b1=_[_0xf09e('0x38')]({},_0x5da0b1,_0x352840[_0xf09e('0x3e')]);return db[_0xf09e('0x28')][_0xf09e('0x45')](_0x5da0b1)['then'](handleEntityNotFound(_0x344a5c,null))[_0xf09e('0x1f')](respondWithResult(_0x344a5c,null))[_0xf09e('0x43')](handleError(_0x344a5c,null));};exports[_0xf09e('0x46')]=function(_0x3d181f,_0x173b51){return db[_0xf09e('0x28')][_0xf09e('0x46')](_0x3d181f[_0xf09e('0x47')],{})[_0xf09e('0x1f')](function(_0x393847){var _0x34109c=_0x3d181f[_0xf09e('0x48')][_0xf09e('0x49')]({'plain':!![]});if(!_0x34109c)throw new Error(_0xf09e('0x4a'));if(_0x34109c[_0xf09e('0x4b')]===_0xf09e('0x48')){var _0x1de436=_0x393847[_0xf09e('0x49')]({'plain':!![]});var _0xdc0774=_0xf09e('0x21');return db[_0xf09e('0x4c')][_0xf09e('0x45')]({'where':{'name':_0xdc0774,'userProfileId':_0x34109c[_0xf09e('0x4d')]},'raw':!![]})[_0xf09e('0x1f')](function(_0x298938){if(_0x298938&&_0x298938[_0xf09e('0x4e')]===0x0){return db[_0xf09e('0x22')][_0xf09e('0x46')]({'name':_0x1de436[_0xf09e('0x25')],'resourceId':_0x1de436['id'],'type':_0x298938['name'],'sectionId':_0x298938['id']},{})['then'](function(){return _0x393847;});}else{return _0x393847;}})['catch'](function(_0x10eada){logger[_0xf09e('0x23')](_0xf09e('0x4f'),_0x10eada);throw _0x10eada;});}return _0x393847;})['then'](respondWithResult(_0x173b51,0xc9))[_0xf09e('0x43')](handleError(_0x173b51,null));};exports[_0xf09e('0x50')]=function(_0x43f482,_0x28d4ff){if(_0x43f482['body']['id']){delete _0x43f482[_0xf09e('0x47')]['id'];}return db[_0xf09e('0x28')][_0xf09e('0x45')]({'where':{'id':_0x43f482[_0xf09e('0x44')]['id']}})[_0xf09e('0x1f')](handleEntityNotFound(_0x28d4ff,null))[_0xf09e('0x1f')](saveUpdates(_0x43f482[_0xf09e('0x47')],null))['then'](respondWithResult(_0x28d4ff,null))[_0xf09e('0x43')](handleError(_0x28d4ff,null));};exports[_0xf09e('0x20')]=function(_0x55ef4c,_0x276a7a){return db[_0xf09e('0x28')]['find']({'where':{'id':_0x55ef4c[_0xf09e('0x44')]['id']}})[_0xf09e('0x1f')](handleEntityNotFound(_0x276a7a,null))[_0xf09e('0x1f')](removeEntity(_0x276a7a,null))[_0xf09e('0x43')](handleError(_0x276a7a,null));};exports[_0xf09e('0x51')]=function(_0x5c7321,_0x1acbcf,_0x1c96c0){if(_0x5c7321[_0xf09e('0x47')]['id']){delete _0x5c7321[_0xf09e('0x47')]['id'];}return db[_0xf09e('0x28')][_0xf09e('0x45')]({'where':{'id':_0x5c7321[_0xf09e('0x44')]['id']}})[_0xf09e('0x1f')](handleEntityNotFound(_0x1acbcf,null))[_0xf09e('0x1f')](function(_0x120f8a){if(_0x120f8a){_0x5c7321[_0xf09e('0x47')][_0xf09e('0x52')]=_0x120f8a['id'];return db[_0xf09e('0x53')][_0xf09e('0x46')](_0x5c7321['body']);}})[_0xf09e('0x1f')](respondWithResult(_0x1acbcf,null))[_0xf09e('0x43')](handleError(_0x1acbcf,null));};exports[_0xf09e('0x54')]=function(_0x197869,_0x5dbfc9,_0x5ca9b6){if(_0x197869['body']['id']){delete _0x197869[_0xf09e('0x47')]['id'];}return db[_0xf09e('0x28')][_0xf09e('0x45')]({'where':{'id':_0x197869['params']['id']}})[_0xf09e('0x1f')](handleEntityNotFound(_0x5dbfc9,null))[_0xf09e('0x1f')](function(_0x5473f0){if(_0x5473f0){_0x197869[_0xf09e('0x47')][_0xf09e('0x55')]=_0x5473f0['id'];return db[_0xf09e('0x53')][_0xf09e('0x46')](_0x197869[_0xf09e('0x47')]);}})[_0xf09e('0x1f')](respondWithResult(_0x5dbfc9,null))[_0xf09e('0x43')](handleError(_0x5dbfc9,null));};exports[_0xf09e('0x56')]=function(_0x1a697a,_0x29fc6e,_0x4083ce){var _0x2a24eb={};var _0x39abbd={};var _0x118f5c;var _0x1e2681;return db[_0xf09e('0x28')][_0xf09e('0x57')]({'where':{'id':_0x1a697a[_0xf09e('0x44')]['id']}})[_0xf09e('0x1f')](handleEntityNotFound(_0x29fc6e,null))[_0xf09e('0x1f')](function(_0x21a955){if(_0x21a955){_0x118f5c=_0x21a955;_0x39abbd['model']=_[_0xf09e('0x2c')](db[_0xf09e('0x53')][_0xf09e('0x29')]);_0x39abbd[_0xf09e('0x2b')]=_[_0xf09e('0x2c')](_0x1a697a[_0xf09e('0x2b')]);_0x39abbd[_0xf09e('0x2d')]=_[_0xf09e('0x2e')](_0x39abbd['model'],_0x39abbd[_0xf09e('0x2b')]);_0x2a24eb[_0xf09e('0x2f')]=_['intersection'](_0x39abbd['model'],qs[_0xf09e('0x30')](_0x1a697a['query'][_0xf09e('0x30')]));_0x2a24eb[_0xf09e('0x2f')]=_0x2a24eb[_0xf09e('0x2f')][_0xf09e('0x31')]?_0x2a24eb[_0xf09e('0x2f')]:_0x39abbd[_0xf09e('0x2a')];_0x2a24eb[_0xf09e('0x34')]=qs['sort'](_0x1a697a[_0xf09e('0x2b')][_0xf09e('0x35')]);_0x2a24eb[_0xf09e('0x39')]=qs[_0xf09e('0x2d')](_[_0xf09e('0x36')](_0x1a697a[_0xf09e('0x2b')],_0x39abbd[_0xf09e('0x2d')]));if(_0x1a697a[_0xf09e('0x2b')]['filter']){_0x2a24eb[_0xf09e('0x39')]=_['merge'](_0x2a24eb['where'],{'$or':_[_0xf09e('0x58')](_0x2a24eb[_0xf09e('0x2f')],function(_0x518400){var _0x5a4d43={};_0x5a4d43[_0x518400]={'$like':'%'+_0x1a697a[_0xf09e('0x2b')][_0xf09e('0x37')]+'%'};return _0x5a4d43;})});}_0x2a24eb=_[_0xf09e('0x38')]({},_0x2a24eb,_0x1a697a[_0xf09e('0x3e')]);return _0x118f5c[_0xf09e('0x56')](_0x2a24eb);}})[_0xf09e('0x1f')](function(_0x239abd){if(_0x239abd){_0x1e2681=_0x239abd[_0xf09e('0x31')];if(!_0x1a697a[_0xf09e('0x2b')][_0xf09e('0x32')]('nolimit')){_0x2a24eb[_0xf09e('0x1b')]=qs[_0xf09e('0x1b')](_0x1a697a[_0xf09e('0x2b')][_0xf09e('0x1b')]);_0x2a24eb['offset']=qs['offset'](_0x1a697a[_0xf09e('0x2b')][_0xf09e('0x1a')]);}return _0x118f5c[_0xf09e('0x56')](_0x2a24eb);}})[_0xf09e('0x1f')](function(_0x41c923){if(_0x41c923){return _0x41c923?{'count':_0x1e2681,'rows':_0x41c923}:null;}})[_0xf09e('0x1f')](respondWithResult(_0x29fc6e,null))[_0xf09e('0x43')](handleError(_0x29fc6e,null));};exports[_0xf09e('0x59')]=function(_0x414a30,_0x29ee5f,_0x13c61c){var _0x186b4e={};var _0x483d3f={};var _0x17aa62;var _0x2f90e0;return db[_0xf09e('0x28')]['findOne']({'where':{'id':_0x414a30[_0xf09e('0x44')]['id']}})[_0xf09e('0x1f')](handleEntityNotFound(_0x29ee5f,null))[_0xf09e('0x1f')](function(_0x4c4d33){if(_0x4c4d33){_0x17aa62=_0x4c4d33;_0x483d3f[_0xf09e('0x2a')]=_[_0xf09e('0x2c')](db['Condition'][_0xf09e('0x29')]);_0x483d3f[_0xf09e('0x2b')]=_[_0xf09e('0x2c')](_0x414a30[_0xf09e('0x2b')]);_0x483d3f[_0xf09e('0x2d')]=_[_0xf09e('0x2e')](_0x483d3f['model'],_0x483d3f[_0xf09e('0x2b')]);_0x186b4e[_0xf09e('0x2f')]=_[_0xf09e('0x2e')](_0x483d3f[_0xf09e('0x2a')],qs[_0xf09e('0x30')](_0x414a30[_0xf09e('0x2b')][_0xf09e('0x30')]));_0x186b4e[_0xf09e('0x2f')]=_0x186b4e[_0xf09e('0x2f')][_0xf09e('0x31')]?_0x186b4e['attributes']:_0x483d3f[_0xf09e('0x2a')];_0x186b4e[_0xf09e('0x34')]=qs['sort'](_0x414a30[_0xf09e('0x2b')][_0xf09e('0x35')]);_0x186b4e['where']=qs[_0xf09e('0x2d')](_[_0xf09e('0x36')](_0x414a30['query'],_0x483d3f[_0xf09e('0x2d')]));if(_0x414a30[_0xf09e('0x2b')][_0xf09e('0x37')]){_0x186b4e[_0xf09e('0x39')]=_[_0xf09e('0x38')](_0x186b4e[_0xf09e('0x39')],{'$or':_['map'](_0x186b4e[_0xf09e('0x2f')],function(_0x132034){var _0x5acb52={};_0x5acb52[_0x132034]={'$like':'%'+_0x414a30['query']['filter']+'%'};return _0x5acb52;})});}_0x186b4e=_[_0xf09e('0x38')]({},_0x186b4e,_0x414a30[_0xf09e('0x3e')]);return _0x17aa62[_0xf09e('0x59')](_0x186b4e);}})[_0xf09e('0x1f')](function(_0x5379b4){if(_0x5379b4){_0x2f90e0=_0x5379b4[_0xf09e('0x31')];if(!_0x414a30[_0xf09e('0x2b')][_0xf09e('0x32')](_0xf09e('0x33'))){_0x186b4e[_0xf09e('0x1b')]=qs[_0xf09e('0x1b')](_0x414a30[_0xf09e('0x2b')][_0xf09e('0x1b')]);_0x186b4e[_0xf09e('0x1a')]=qs[_0xf09e('0x1a')](_0x414a30[_0xf09e('0x2b')]['offset']);}return _0x17aa62['getAnyConditions'](_0x186b4e);}})[_0xf09e('0x1f')](function(_0x4d7868){if(_0x4d7868){return _0x4d7868?{'count':_0x2f90e0,'rows':_0x4d7868}:null;}})[_0xf09e('0x1f')](respondWithResult(_0x29ee5f,null))[_0xf09e('0x43')](handleError(_0x29ee5f,null));};exports['addAction']=function(_0x3ef54d,_0x57f52d,_0x363cf3){if(_0x3ef54d['body']['id']){delete _0x3ef54d['body']['id'];}return db[_0xf09e('0x28')][_0xf09e('0x45')]({'where':{'id':_0x3ef54d[_0xf09e('0x44')]['id']}})[_0xf09e('0x1f')](handleEntityNotFound(_0x57f52d,null))[_0xf09e('0x1f')](function(_0x32b2b3){if(_0x32b2b3){_0x3ef54d[_0xf09e('0x47')][_0xf09e('0x5a')]=_0x32b2b3['id'];return db[_0xf09e('0x5b')][_0xf09e('0x46')](_0x3ef54d[_0xf09e('0x47')]);}})[_0xf09e('0x1f')](respondWithResult(_0x57f52d,null))[_0xf09e('0x43')](handleError(_0x57f52d,null));};exports[_0xf09e('0x5c')]=function(_0x127d80,_0x3edc72,_0x1e0652){var _0x19d292={};var _0x276141={};var _0x3edf16;var _0x5c2a79;return db[_0xf09e('0x28')][_0xf09e('0x57')]({'where':{'id':_0x127d80[_0xf09e('0x44')]['id']}})[_0xf09e('0x1f')](handleEntityNotFound(_0x3edc72,null))['then'](function(_0x2bbdc7){if(_0x2bbdc7){_0x3edf16=_0x2bbdc7;_0x276141[_0xf09e('0x2a')]=_[_0xf09e('0x2c')](db[_0xf09e('0x5b')][_0xf09e('0x29')]);_0x276141['query']=_[_0xf09e('0x2c')](_0x127d80[_0xf09e('0x2b')]);_0x276141[_0xf09e('0x2d')]=_[_0xf09e('0x2e')](_0x276141[_0xf09e('0x2a')],_0x276141[_0xf09e('0x2b')]);_0x19d292[_0xf09e('0x2f')]=_[_0xf09e('0x2e')](_0x276141[_0xf09e('0x2a')],qs[_0xf09e('0x30')](_0x127d80['query'][_0xf09e('0x30')]));_0x19d292[_0xf09e('0x2f')]=_0x19d292[_0xf09e('0x2f')][_0xf09e('0x31')]?_0x19d292[_0xf09e('0x2f')]:_0x276141[_0xf09e('0x2a')];_0x19d292['order']=qs['sort'](_0x127d80['query'][_0xf09e('0x35')]);_0x19d292[_0xf09e('0x39')]=qs['filters'](_['pick'](_0x127d80['query'],_0x276141[_0xf09e('0x2d')]));if(_0x127d80[_0xf09e('0x2b')][_0xf09e('0x37')]){_0x19d292['where']=_[_0xf09e('0x38')](_0x19d292[_0xf09e('0x39')],{'$or':_[_0xf09e('0x58')](_0x19d292[_0xf09e('0x2f')],function(_0x5f032c){var _0x3891ae={};_0x3891ae[_0x5f032c]={'$like':'%'+_0x127d80[_0xf09e('0x2b')][_0xf09e('0x37')]+'%'};return _0x3891ae;})});}_0x19d292=_[_0xf09e('0x38')]({},_0x19d292,_0x127d80[_0xf09e('0x3e')]);return _0x3edf16['getActions'](_0x19d292);}})[_0xf09e('0x1f')](function(_0x44d629){if(_0x44d629){_0x5c2a79=_0x44d629['length'];if(!_0x127d80[_0xf09e('0x2b')][_0xf09e('0x32')](_0xf09e('0x33'))){_0x19d292[_0xf09e('0x1b')]=qs[_0xf09e('0x1b')](_0x127d80[_0xf09e('0x2b')][_0xf09e('0x1b')]);_0x19d292['offset']=qs[_0xf09e('0x1a')](_0x127d80['query'][_0xf09e('0x1a')]);}return _0x3edf16['getActions'](_0x19d292);}})[_0xf09e('0x1f')](function(_0x19f357){if(_0x19f357){return _0x19f357?{'count':_0x5c2a79,'rows':_0x19f357}:null;}})[_0xf09e('0x1f')](respondWithResult(_0x3edc72,null))[_0xf09e('0x43')](handleError(_0x3edc72,null));};
\ No newline at end of file
index 5b1b514..42f1c94 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7158=['util','../../config/logger','bluebird','request-promise','./trigger.attributes','exports','define','tools_triggers','lodash'];(function(_0x4941c6,_0x3ca9f8){var _0x4d3654=function(_0x5295c8){while(--_0x5295c8){_0x4941c6['push'](_0x4941c6['shift']());}};_0x4d3654(++_0x3ca9f8);}(_0x7158,0xc5));var _0x8715=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x7158[_0x3305de];return _0x3b5a84;};'use strict';var _=require(_0x8715('0x0'));var util=require(_0x8715('0x1'));var logger=require(_0x8715('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8715('0x3'));var rp=require(_0x8715('0x4'));var attributes=require(_0x8715('0x5'));module[_0x8715('0x6')]=function(_0x127bc7,_0xafd38f){return _0x127bc7[_0x8715('0x7')]('Trigger',attributes,{'tableName':_0x8715('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x5722=['util','../../config/logger','moment','bluebird','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash'];(function(_0x23453b,_0x1553a2){var _0x462346=function(_0x534b25){while(--_0x534b25){_0x23453b['push'](_0x23453b['shift']());}};_0x462346(++_0x1553a2);}(_0x5722,0xc7));var _0x2572=function(_0x23d86e,_0x1f64ff){_0x23d86e=_0x23d86e-0x0;var _0xaf25c9=_0x5722[_0x23d86e];return _0xaf25c9;};'use strict';var _=require(_0x2572('0x0'));var util=require(_0x2572('0x1'));var logger=require(_0x2572('0x2'))('api');var moment=require(_0x2572('0x3'));var BPromise=require(_0x2572('0x4'));var rp=require('request-promise');var attributes=require(_0x2572('0x5'));module[_0x2572('0x6')]=function(_0x588bc9,_0xa02d01){return _0x588bc9[_0x2572('0x7')](_0x2572('0x8'),attributes,{'tableName':_0x2572('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index e8ed370..4255a95 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeb33=['model','then','GetTrigger','debug','ShowTrigger','Trigger','find','where','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','raw','attributes','limit','include','map'];(function(_0x2c9ec4,_0x67d4db){var _0x5610d0=function(_0x2a7498){while(--_0x2a7498){_0x2c9ec4['push'](_0x2c9ec4['shift']());}};_0x5610d0(++_0x67d4db);}(_0xeb33,0x17e));var _0x3eb3=function(_0x1bcbf7,_0x31bf2a){_0x1bcbf7=_0x1bcbf7-0x0;var _0x4aeb5b=_0xeb33[_0x1bcbf7];return _0x4aeb5b;};'use strict';var _=require(_0x3eb3('0x0'));var util=require(_0x3eb3('0x1'));var moment=require(_0x3eb3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3eb3('0x3'));var db=require(_0x3eb3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3eb3('0x5'))(_0x3eb3('0x6'));var config=require(_0x3eb3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3eb3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fa5b9,_0x82442f,_0x2c150b){return new BPromise(function(_0x45cf6b,_0x734a68){return client[_0x3eb3('0x9')](_0x2fa5b9,_0x2c150b)['then'](function(_0x2e43e0){logger[_0x3eb3('0xa')](_0x3eb3('0xb'),_0x82442f,_0x3eb3('0xc'));logger['debug'](_0x3eb3('0xd'),_0x82442f,_0x3eb3('0xc'),JSON[_0x3eb3('0xe')](_0x2e43e0));if(_0x2e43e0[_0x3eb3('0xf')]){if(_0x2e43e0[_0x3eb3('0xf')][_0x3eb3('0x10')]===0x1f4){logger[_0x3eb3('0xf')]('Trigger,\x20%s,\x20%s',_0x82442f,_0x2e43e0[_0x3eb3('0xf')][_0x3eb3('0x11')]);return _0x734a68(_0x2e43e0[_0x3eb3('0xf')][_0x3eb3('0x11')]);}logger[_0x3eb3('0xf')]('Trigger,\x20%s,\x20%s',_0x82442f,_0x2e43e0[_0x3eb3('0xf')][_0x3eb3('0x11')]);return _0x45cf6b(_0x2e43e0['error'][_0x3eb3('0x11')]);}else{logger[_0x3eb3('0xa')](_0x3eb3('0xb'),_0x82442f,_0x3eb3('0xc'));_0x45cf6b(_0x2e43e0[_0x3eb3('0x12')][_0x3eb3('0x11')]);}})[_0x3eb3('0x13')](function(_0x39ffc3){logger[_0x3eb3('0xf')](_0x3eb3('0xb'),_0x82442f,_0x39ffc3);_0x734a68(_0x39ffc3);});});}exports['GetTrigger']=function(_0x400942){var _0x4a55be=this;return new Promise(function(_0x407f5e,_0x12cdb2){return db['Trigger']['findAll']({'raw':_0x400942[_0x3eb3('0x14')]?_0x400942[_0x3eb3('0x14')][_0x3eb3('0x15')]===undefined?!![]:![]:!![],'where':_0x400942['options']?_0x400942[_0x3eb3('0x14')]['where']||null:null,'attributes':_0x400942[_0x3eb3('0x14')]?_0x400942[_0x3eb3('0x14')][_0x3eb3('0x16')]||null:null,'limit':_0x400942[_0x3eb3('0x14')]?_0x400942[_0x3eb3('0x14')][_0x3eb3('0x17')]||null:null,'include':_0x400942[_0x3eb3('0x14')]?_0x400942[_0x3eb3('0x14')][_0x3eb3('0x18')]?_[_0x3eb3('0x19')](_0x400942[_0x3eb3('0x14')]['include'],function(_0xa182b5){return{'model':db[_0xa182b5[_0x3eb3('0x1a')]],'as':_0xa182b5['as'],'attributes':_0xa182b5[_0x3eb3('0x16')],'include':_0xa182b5['include']?_[_0x3eb3('0x19')](_0xa182b5[_0x3eb3('0x18')],function(_0x440f8b){return{'model':db[_0x440f8b[_0x3eb3('0x1a')]],'as':_0x440f8b['as'],'attributes':_0x440f8b[_0x3eb3('0x16')],'include':_0x440f8b[_0x3eb3('0x18')]?_[_0x3eb3('0x19')](_0x440f8b[_0x3eb3('0x18')],function(_0x2a1ab6){return{'model':db[_0x2a1ab6[_0x3eb3('0x1a')]],'as':_0x2a1ab6['as'],'attributes':_0x2a1ab6[_0x3eb3('0x16')]};}):[]};}):[]};}):[]:[]})[_0x3eb3('0x1b')](function(_0x3f9a46){logger[_0x3eb3('0xa')](_0x3eb3('0x1c'),_0x400942);logger[_0x3eb3('0x1d')](_0x3eb3('0x1c'),_0x400942,JSON[_0x3eb3('0xe')](_0x3f9a46));_0x407f5e(_0x3f9a46);})[_0x3eb3('0x13')](function(_0x2af81d){logger[_0x3eb3('0xf')](_0x3eb3('0x1c'),_0x2af81d['message'],_0x400942);_0x12cdb2(_0x4a55be[_0x3eb3('0xf')](0x1f4,_0x2af81d['message']));});});};exports[_0x3eb3('0x1e')]=function(_0x444920){var _0x418332=this;return new Promise(function(_0x111943,_0x42a76d){return db[_0x3eb3('0x1f')][_0x3eb3('0x20')]({'raw':_0x444920[_0x3eb3('0x14')]?_0x444920[_0x3eb3('0x14')][_0x3eb3('0x15')]===undefined?!![]:![]:!![],'where':_0x444920[_0x3eb3('0x14')]?_0x444920[_0x3eb3('0x14')][_0x3eb3('0x21')]||null:null,'attributes':_0x444920[_0x3eb3('0x14')]?_0x444920[_0x3eb3('0x14')][_0x3eb3('0x16')]||null:null,'include':_0x444920[_0x3eb3('0x14')]?_0x444920['options'][_0x3eb3('0x18')]?_[_0x3eb3('0x19')](_0x444920[_0x3eb3('0x14')]['include'],function(_0x33901b){return{'model':db[_0x33901b[_0x3eb3('0x1a')]],'as':_0x33901b['as'],'attributes':_0x33901b[_0x3eb3('0x16')],'include':_0x33901b['include']?_[_0x3eb3('0x19')](_0x33901b[_0x3eb3('0x18')],function(_0xab42e9){return{'model':db[_0xab42e9[_0x3eb3('0x1a')]],'as':_0xab42e9['as'],'attributes':_0xab42e9[_0x3eb3('0x16')],'include':_0xab42e9['include']?_[_0x3eb3('0x19')](_0xab42e9[_0x3eb3('0x18')],function(_0x3e2625){return{'model':db[_0x3e2625[_0x3eb3('0x1a')]],'as':_0x3e2625['as'],'attributes':_0x3e2625['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x212aa6){logger['info'](_0x3eb3('0x1e'),_0x444920);logger['debug'](_0x3eb3('0x1e'),_0x444920,JSON['stringify'](_0x212aa6));_0x111943(_0x212aa6);})[_0x3eb3('0x13')](function(_0x1140d9){logger[_0x3eb3('0xf')](_0x3eb3('0x1e'),_0x1140d9[_0x3eb3('0x11')],_0x444920);_0x42a76d(_0x418332[_0x3eb3('0xf')](0x1f4,_0x1140d9[_0x3eb3('0x11')]));});});};
\ No newline at end of file
+var _0xa2e1=['../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetTrigger','Trigger','findAll','raw','options','where','attributes','include','map','model','ShowTrigger','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x38cd69,_0x11d7a6){var _0x446a42=function(_0x5c2d90){while(--_0x5c2d90){_0x38cd69['push'](_0x38cd69['shift']());}};_0x446a42(++_0x11d7a6);}(_0xa2e1,0xa9));var _0x1a2e=function(_0x414cb2,_0x3ee94e){_0x414cb2=_0x414cb2-0x0;var _0x350a56=_0xa2e1[_0x414cb2];return _0x350a56;};'use strict';var _=require(_0x1a2e('0x0'));var util=require(_0x1a2e('0x1'));var moment=require(_0x1a2e('0x2'));var BPromise=require(_0x1a2e('0x3'));var rs=require(_0x1a2e('0x4'));var fs=require('fs');var Redis=require(_0x1a2e('0x5'));var db=require(_0x1a2e('0x6'))['db'];var utils=require(_0x1a2e('0x7'));var logger=require('../../config/logger')(_0x1a2e('0x8'));var config=require(_0x1a2e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1a2e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12e9d7,_0x178791,_0x258bca){return new BPromise(function(_0x3c466e,_0x3ada33){return client[_0x1a2e('0xb')](_0x12e9d7,_0x258bca)[_0x1a2e('0xc')](function(_0x11a72c){logger['info'](_0x1a2e('0xd'),_0x178791,'request\x20sent');logger[_0x1a2e('0xe')](_0x1a2e('0xf'),_0x178791,_0x1a2e('0x10'),JSON[_0x1a2e('0x11')](_0x11a72c));if(_0x11a72c[_0x1a2e('0x12')]){if(_0x11a72c[_0x1a2e('0x12')][_0x1a2e('0x13')]===0x1f4){logger['error'](_0x1a2e('0xd'),_0x178791,_0x11a72c[_0x1a2e('0x12')][_0x1a2e('0x14')]);return _0x3ada33(_0x11a72c[_0x1a2e('0x12')]['message']);}logger[_0x1a2e('0x12')]('Trigger,\x20%s,\x20%s',_0x178791,_0x11a72c[_0x1a2e('0x12')][_0x1a2e('0x14')]);return _0x3c466e(_0x11a72c[_0x1a2e('0x12')][_0x1a2e('0x14')]);}else{logger[_0x1a2e('0x15')](_0x1a2e('0xd'),_0x178791,_0x1a2e('0x10'));_0x3c466e(_0x11a72c[_0x1a2e('0x16')][_0x1a2e('0x14')]);}})[_0x1a2e('0x17')](function(_0x283252){logger[_0x1a2e('0x12')](_0x1a2e('0xd'),_0x178791,_0x283252);_0x3ada33(_0x283252);});});}exports[_0x1a2e('0x18')]=function(_0x4888b2){var _0x2091e0=this;return new Promise(function(_0x3fc205,_0x419208){return db[_0x1a2e('0x19')][_0x1a2e('0x1a')]({'raw':_0x4888b2['options']?_0x4888b2['options'][_0x1a2e('0x1b')]===undefined?!![]:![]:!![],'where':_0x4888b2[_0x1a2e('0x1c')]?_0x4888b2['options'][_0x1a2e('0x1d')]||null:null,'attributes':_0x4888b2[_0x1a2e('0x1c')]?_0x4888b2[_0x1a2e('0x1c')][_0x1a2e('0x1e')]||null:null,'limit':_0x4888b2[_0x1a2e('0x1c')]?_0x4888b2[_0x1a2e('0x1c')]['limit']||null:null,'include':_0x4888b2[_0x1a2e('0x1c')]?_0x4888b2[_0x1a2e('0x1c')][_0x1a2e('0x1f')]?_[_0x1a2e('0x20')](_0x4888b2[_0x1a2e('0x1c')][_0x1a2e('0x1f')],function(_0x173fb2){return{'model':db[_0x173fb2[_0x1a2e('0x21')]],'as':_0x173fb2['as'],'attributes':_0x173fb2[_0x1a2e('0x1e')],'include':_0x173fb2[_0x1a2e('0x1f')]?_[_0x1a2e('0x20')](_0x173fb2[_0x1a2e('0x1f')],function(_0x111a35){return{'model':db[_0x111a35[_0x1a2e('0x21')]],'as':_0x111a35['as'],'attributes':_0x111a35['attributes'],'include':_0x111a35[_0x1a2e('0x1f')]?_[_0x1a2e('0x20')](_0x111a35[_0x1a2e('0x1f')],function(_0x37e2be){return{'model':db[_0x37e2be[_0x1a2e('0x21')]],'as':_0x37e2be['as'],'attributes':_0x37e2be[_0x1a2e('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52e52a){logger[_0x1a2e('0x15')](_0x1a2e('0x18'),_0x4888b2);logger['debug'](_0x1a2e('0x18'),_0x4888b2,JSON[_0x1a2e('0x11')](_0x52e52a));_0x3fc205(_0x52e52a);})['catch'](function(_0x33372f){logger[_0x1a2e('0x12')]('GetTrigger',_0x33372f[_0x1a2e('0x14')],_0x4888b2);_0x419208(_0x2091e0[_0x1a2e('0x12')](0x1f4,_0x33372f[_0x1a2e('0x14')]));});});};exports[_0x1a2e('0x22')]=function(_0x243fda){var _0x3e3895=this;return new Promise(function(_0x54e705,_0x24589b){return db[_0x1a2e('0x19')]['find']({'raw':_0x243fda['options']?_0x243fda[_0x1a2e('0x1c')][_0x1a2e('0x1b')]===undefined?!![]:![]:!![],'where':_0x243fda[_0x1a2e('0x1c')]?_0x243fda[_0x1a2e('0x1c')][_0x1a2e('0x1d')]||null:null,'attributes':_0x243fda[_0x1a2e('0x1c')]?_0x243fda[_0x1a2e('0x1c')][_0x1a2e('0x1e')]||null:null,'include':_0x243fda[_0x1a2e('0x1c')]?_0x243fda[_0x1a2e('0x1c')][_0x1a2e('0x1f')]?_[_0x1a2e('0x20')](_0x243fda['options'][_0x1a2e('0x1f')],function(_0x305906){return{'model':db[_0x305906[_0x1a2e('0x21')]],'as':_0x305906['as'],'attributes':_0x305906['attributes'],'include':_0x305906[_0x1a2e('0x1f')]?_['map'](_0x305906[_0x1a2e('0x1f')],function(_0x5e65bc){return{'model':db[_0x5e65bc[_0x1a2e('0x21')]],'as':_0x5e65bc['as'],'attributes':_0x5e65bc[_0x1a2e('0x1e')],'include':_0x5e65bc[_0x1a2e('0x1f')]?_[_0x1a2e('0x20')](_0x5e65bc[_0x1a2e('0x1f')],function(_0x32faf5){return{'model':db[_0x32faf5[_0x1a2e('0x21')]],'as':_0x32faf5['as'],'attributes':_0x32faf5[_0x1a2e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1a2e('0xc')](function(_0x37591b){logger[_0x1a2e('0x15')](_0x1a2e('0x22'),_0x243fda);logger[_0x1a2e('0xe')](_0x1a2e('0x22'),_0x243fda,JSON[_0x1a2e('0x11')](_0x37591b));_0x54e705(_0x37591b);})['catch'](function(_0x45992c){logger[_0x1a2e('0x12')](_0x1a2e('0x22'),_0x45992c['message'],_0x243fda);_0x24589b(_0x3e3895[_0x1a2e('0x12')](0x1f4,_0x45992c['message']));});});};
\ No newline at end of file
index b1c17bc..ebb6258 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6fe2=['get','/:id','show','post','/:id/clone','clone','put','update','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./trunk.controller','isAuthenticated','index'];(function(_0x10bf74,_0x1c0ffd){var _0x27918e=function(_0x58a998){while(--_0x58a998){_0x10bf74['push'](_0x10bf74['shift']());}};_0x27918e(++_0x1c0ffd);}(_0x6fe2,0x14c));var _0x26fe=function(_0x1dffca,_0x13ccd0){_0x1dffca=_0x1dffca-0x0;var _0x368285=_0x6fe2[_0x1dffca];return _0x368285;};'use strict';var multer=require(_0x26fe('0x0'));var util=require(_0x26fe('0x1'));var path=require(_0x26fe('0x2'));var timeout=require(_0x26fe('0x3'));var express=require(_0x26fe('0x4'));var router=express['Router']();var auth=require(_0x26fe('0x5'));var interaction=require(_0x26fe('0x6'));var config=require('../../config/environment');var controller=require(_0x26fe('0x7'));router['get']('/',auth[_0x26fe('0x8')](),controller[_0x26fe('0x9')]);router[_0x26fe('0xa')](_0x26fe('0xb'),auth[_0x26fe('0x8')](),controller[_0x26fe('0xc')]);router[_0x26fe('0xd')](_0x26fe('0xe'),auth[_0x26fe('0x8')](),controller[_0x26fe('0xf')]);router[_0x26fe('0xd')]('/',auth[_0x26fe('0x8')](),controller['create']);router[_0x26fe('0x10')](_0x26fe('0xb'),auth[_0x26fe('0x8')](),controller[_0x26fe('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router;
\ No newline at end of file
+var _0xfaed=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','show','post','/:id/clone','create','put','/:id','update','delete','destroy','exports'];(function(_0x139ff6,_0xddca5){var _0x71b083=function(_0x4cf27a){while(--_0x4cf27a){_0x139ff6['push'](_0x139ff6['shift']());}};_0x71b083(++_0xddca5);}(_0xfaed,0x168));var _0xdfae=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0xfaed[_0x11ce46];return _0x368a1e;};'use strict';var multer=require('multer');var util=require(_0xdfae('0x0'));var path=require(_0xdfae('0x1'));var timeout=require(_0xdfae('0x2'));var express=require(_0xdfae('0x3'));var router=express[_0xdfae('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xdfae('0x5'));var config=require(_0xdfae('0x6'));var controller=require(_0xdfae('0x7'));router[_0xdfae('0x8')]('/',auth[_0xdfae('0x9')](),controller['index']);router[_0xdfae('0x8')]('/:id',auth[_0xdfae('0x9')](),controller[_0xdfae('0xa')]);router[_0xdfae('0xb')](_0xdfae('0xc'),auth[_0xdfae('0x9')](),controller['clone']);router[_0xdfae('0xb')]('/',auth[_0xdfae('0x9')](),controller[_0xdfae('0xd')]);router[_0xdfae('0xe')](_0xdfae('0xf'),auth[_0xdfae('0x9')](),controller[_0xdfae('0x10')]);router[_0xdfae('0x11')]('/:id',auth[_0xdfae('0x9')](),controller[_0xdfae('0x12')]);module[_0xdfae('0x13')]=router;
\ No newline at end of file
index 3f447bf..ad4d242 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2032=['all','ulaw;alaw;gsm','allow','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]','INTEGER','always','accept','refuse','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','exports','STRING','name','friend','user','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','transport','getDataValue','rfc2833','inband','auto','yes','nonat','update','outgoing','setDataValue','join','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'];(function(_0x3eb072,_0x2841bd){var _0x3f455e=function(_0x2ec96b){while(--_0x2ec96b){_0x3eb072['push'](_0x3eb072['shift']());}};_0x3f455e(++_0x2841bd);}(_0x2032,0xd9));var _0x2203=function(_0x50117a,_0x1e9ee1){_0x50117a=_0x50117a-0x0;var _0x2d3927=_0x2032[_0x50117a];return _0x2d3927;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x2203('0x3'),_0x2203('0x4'),'peer'),'allowNull':![],'defaultValue':_0x2203('0x3')},'context':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'defaultValue':_0x2203('0x5')},'callingpres':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x7'),_0x2203('0x8'),_0x2203('0x9'),_0x2203('0xa'),_0x2203('0xb'),_0x2203('0xc'),_0x2203('0xd'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x2203('0x1')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x2203('0x1')]},'remotesecret':{'type':Sequelize[_0x2203('0x1')]},'transport':{'type':Sequelize[_0x2203('0x1')],'defaultValue':'udp','set':function(_0x849049){this['setDataValue'](_0x2203('0xe'),_0x849049?_0x849049['join'](','):null);},'get':function(){return this[_0x2203('0xf')](_0x2203('0xe'))?this['getDataValue']('transport')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x2203('0x10'),'info','shortinfo',_0x2203('0x11'),_0x2203('0x12')),'defaultValue':_0x2203('0x10')},'directmedia':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no',_0x2203('0x14'),_0x2203('0x15'),_0x2203('0x16')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x2203('0x1')]},'nat':{'type':Sequelize[_0x2203('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x3f9ef6){this[_0x2203('0x17')]('nat',_0x3f9ef6?_0x3f9ef6[_0x2203('0x18')](','):null);},'get':function(){return this['getDataValue'](_0x2203('0x19'))?this[_0x2203('0xf')](_0x2203('0x19'))[_0x2203('0x1a')](','):null;},'comment':_0x2203('0x1b')},'callgroup':{'type':Sequelize[_0x2203('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x2203('0x1')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2203('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x2203('0x1c')},'allow':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x3ee25b){this['setDataValue']('allow',_0x3ee25b?_0x3ee25b[_0x2203('0x18')](';'):_0x2203('0x1d'));},'get':function(){return this[_0x2203('0xf')](_0x2203('0x1e'))?this[_0x2203('0xf')](_0x2203('0x1e'))[_0x2203('0x1a')](';'):null;},'comment':_0x2203('0x1f')},'autoframing':{'type':Sequelize['ENUM'](_0x2203('0x13'),'no')},'insecure':{'type':Sequelize[_0x2203('0x1')],'defaultValue':_0x2203('0x20'),'set':function(_0x5f11bf){this[_0x2203('0x17')](_0x2203('0x21'),_0x5f11bf?_0x5f11bf['join'](','):null);},'get':function(){return this[_0x2203('0xf')](_0x2203('0x21'))?this[_0x2203('0xf')](_0x2203('0x21'))[_0x2203('0x1a')](','):null;},'comment':_0x2203('0x22')},'trustrpid':{'type':Sequelize[_0x2203('0x6')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no','never')},'promiscredir':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no')},'useclientcode':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x2203('0x1')]},'callerid':{'type':Sequelize[_0x2203('0x1')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x2203('0x6')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x2203('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no')},'allowsubscribe':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x2203('0x13'),'no')},'ignoresdpversion':{'type':Sequelize[_0x2203('0x6')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x2203('0x1')]},'template':{'type':Sequelize[_0x2203('0x1')]},'videosupport':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no',_0x2203('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2203('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no')},'mailbox':{'type':Sequelize[_0x2203('0x1')]},'session_timers':{'type':Sequelize['ENUM'](_0x2203('0x25'),_0x2203('0x26'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x2203('0x23')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x2203('0x27'),_0x2203('0x28')),'defaultValue':_0x2203('0x28')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x2203('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x2203('0x23')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x2203('0x13'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x2203('0x23')](0xb)},'defaultip':{'type':Sequelize[_0x2203('0x1')]},'defaultuser':{'type':Sequelize[_0x2203('0x1')]},'rtptimeout':{'type':Sequelize[_0x2203('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x2203('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no',_0x2203('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2203('0x1')]},'callbackextension':{'type':Sequelize[_0x2203('0x1')]},'timert1':{'type':Sequelize[_0x2203('0x23')](0xb)},'timerb':{'type':Sequelize[_0x2203('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x2203('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x2203('0x1')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x2203('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x2203('0x1')]},'use_q850_reason':{'type':Sequelize[_0x2203('0x1')]},'maxforwards':{'type':Sequelize[_0x2203('0x23')](0xb)},'encryption':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2203('0x6')]('yes','no')},'force_avp':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no')},'icesupport':{'type':Sequelize[_0x2203('0x6')]('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x2203('0x13'),'no')},'dtlsverify':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no',_0x2203('0x2a'),_0x2203('0x2b'))},'dtlsrekey':{'type':Sequelize[_0x2203('0x23')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x2203('0x1')]},'dtlscipher':{'type':Sequelize[_0x2203('0x1')]},'dtlscafile':{'type':Sequelize[_0x2203('0x1')]},'dtlscapath':{'type':Sequelize[_0x2203('0x1')]},'dtlssetup':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x2c'),_0x2203('0x2d'),_0x2203('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2203('0x1')]},'usereqphone':{'type':Sequelize[_0x2203('0x6')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2203('0x1')]},'recordofffeature':{'type':Sequelize[_0x2203('0x1')]},'call_limit':{'type':Sequelize[_0x2203('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x2203('0x6')]('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x2203('0x13'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x2203('0x1')]},'mohsuggest':{'type':Sequelize[_0x2203('0x1')]},'parkinglot':{'type':Sequelize[_0x2203('0x1')]},'description':{'type':Sequelize[_0x2203('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x2203('0x2f')},'canreinvite':{'type':Sequelize[_0x2203('0x6')]('yes','no',_0x2203('0x14'),_0x2203('0x15'),_0x2203('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2203('0x1')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x2203('0x1')],'defaultValue':'no'}};
\ No newline at end of file
+var _0x2032=['all','ulaw;alaw;gsm','allow','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]','INTEGER','always','accept','refuse','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','exports','STRING','name','friend','user','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','transport','getDataValue','rfc2833','inband','auto','yes','nonat','update','outgoing','setDataValue','join','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'];(function(_0x4c5a6e,_0x3b2cf0){var _0x4c09bd=function(_0x321276){while(--_0x321276){_0x4c5a6e['push'](_0x4c5a6e['shift']());}};_0x4c09bd(++_0x3b2cf0);}(_0x2032,0xd9));var _0x2203=function(_0x5125bc,_0x432add){_0x5125bc=_0x5125bc-0x0;var _0x376bab=_0x2032[_0x5125bc];return _0x376bab;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x2203('0x3'),_0x2203('0x4'),'peer'),'allowNull':![],'defaultValue':_0x2203('0x3')},'context':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'defaultValue':_0x2203('0x5')},'callingpres':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x7'),_0x2203('0x8'),_0x2203('0x9'),_0x2203('0xa'),_0x2203('0xb'),_0x2203('0xc'),_0x2203('0xd'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x2203('0x1')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x2203('0x1')]},'remotesecret':{'type':Sequelize[_0x2203('0x1')]},'transport':{'type':Sequelize[_0x2203('0x1')],'defaultValue':'udp','set':function(_0x849049){this['setDataValue'](_0x2203('0xe'),_0x849049?_0x849049['join'](','):null);},'get':function(){return this[_0x2203('0xf')](_0x2203('0xe'))?this['getDataValue']('transport')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x2203('0x10'),'info','shortinfo',_0x2203('0x11'),_0x2203('0x12')),'defaultValue':_0x2203('0x10')},'directmedia':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no',_0x2203('0x14'),_0x2203('0x15'),_0x2203('0x16')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x2203('0x1')]},'nat':{'type':Sequelize[_0x2203('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x3f9ef6){this[_0x2203('0x17')]('nat',_0x3f9ef6?_0x3f9ef6[_0x2203('0x18')](','):null);},'get':function(){return this['getDataValue'](_0x2203('0x19'))?this[_0x2203('0xf')](_0x2203('0x19'))[_0x2203('0x1a')](','):null;},'comment':_0x2203('0x1b')},'callgroup':{'type':Sequelize[_0x2203('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x2203('0x1')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2203('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x2203('0x1c')},'allow':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x3ee25b){this['setDataValue']('allow',_0x3ee25b?_0x3ee25b[_0x2203('0x18')](';'):_0x2203('0x1d'));},'get':function(){return this[_0x2203('0xf')](_0x2203('0x1e'))?this[_0x2203('0xf')](_0x2203('0x1e'))[_0x2203('0x1a')](';'):null;},'comment':_0x2203('0x1f')},'autoframing':{'type':Sequelize['ENUM'](_0x2203('0x13'),'no')},'insecure':{'type':Sequelize[_0x2203('0x1')],'defaultValue':_0x2203('0x20'),'set':function(_0x5f11bf){this[_0x2203('0x17')](_0x2203('0x21'),_0x5f11bf?_0x5f11bf['join'](','):null);},'get':function(){return this[_0x2203('0xf')](_0x2203('0x21'))?this[_0x2203('0xf')](_0x2203('0x21'))[_0x2203('0x1a')](','):null;},'comment':_0x2203('0x22')},'trustrpid':{'type':Sequelize[_0x2203('0x6')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no','never')},'promiscredir':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no')},'useclientcode':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x2203('0x1')]},'callerid':{'type':Sequelize[_0x2203('0x1')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x2203('0x6')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x2203('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no')},'allowsubscribe':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x2203('0x13'),'no')},'ignoresdpversion':{'type':Sequelize[_0x2203('0x6')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x2203('0x1')]},'template':{'type':Sequelize[_0x2203('0x1')]},'videosupport':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no',_0x2203('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2203('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no')},'mailbox':{'type':Sequelize[_0x2203('0x1')]},'session_timers':{'type':Sequelize['ENUM'](_0x2203('0x25'),_0x2203('0x26'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x2203('0x23')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x2203('0x27'),_0x2203('0x28')),'defaultValue':_0x2203('0x28')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x2203('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x2203('0x23')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x2203('0x13'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x2203('0x23')](0xb)},'defaultip':{'type':Sequelize[_0x2203('0x1')]},'defaultuser':{'type':Sequelize[_0x2203('0x1')]},'rtptimeout':{'type':Sequelize[_0x2203('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x2203('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no',_0x2203('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2203('0x1')]},'callbackextension':{'type':Sequelize[_0x2203('0x1')]},'timert1':{'type':Sequelize[_0x2203('0x23')](0xb)},'timerb':{'type':Sequelize[_0x2203('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x2203('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x2203('0x1')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x2203('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x2203('0x1')]},'use_q850_reason':{'type':Sequelize[_0x2203('0x1')]},'maxforwards':{'type':Sequelize[_0x2203('0x23')](0xb)},'encryption':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2203('0x6')]('yes','no')},'force_avp':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no')},'icesupport':{'type':Sequelize[_0x2203('0x6')]('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x2203('0x13'),'no')},'dtlsverify':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no',_0x2203('0x2a'),_0x2203('0x2b'))},'dtlsrekey':{'type':Sequelize[_0x2203('0x23')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x2203('0x1')]},'dtlscipher':{'type':Sequelize[_0x2203('0x1')]},'dtlscafile':{'type':Sequelize[_0x2203('0x1')]},'dtlscapath':{'type':Sequelize[_0x2203('0x1')]},'dtlssetup':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x2c'),_0x2203('0x2d'),_0x2203('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2203('0x1')]},'usereqphone':{'type':Sequelize[_0x2203('0x6')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2203('0x1')]},'recordofffeature':{'type':Sequelize[_0x2203('0x1')]},'call_limit':{'type':Sequelize[_0x2203('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x2203('0x6')]('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x2203('0x13'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x2203('0x1')]},'mohsuggest':{'type':Sequelize[_0x2203('0x1')]},'parkinglot':{'type':Sequelize[_0x2203('0x1')]},'description':{'type':Sequelize[_0x2203('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x2203('0x2f')},'canreinvite':{'type':Sequelize[_0x2203('0x6')]('yes','no',_0x2203('0x14'),_0x2203('0x15'),_0x2203('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2203('0x1')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x2203('0x1')],'defaultValue':'no'}};
\ No newline at end of file
index 9c70ce0..64da870 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf288=['map','field','filter','options','includeAll','include','findAll','rows','show','params','length','find','get','omit','createdAt','body','updatedAt','create','user','UserProfileSection','userProfileId','UserProfileResource','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','utf8','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','update','server/files/templates/trunk.ejs','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../config/license/hardware','../../components/parsers/qs','../../config/utils','../../mysqldb','jayson/promise','client','http','request','info','request\x20sent','debug','error','message','Trunk,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','count','offset','set','apply','reject','save','destroy','then','Trunks','stack','index','Trunk','rawAttributes','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','limit','sort','where','pick','merge'];(function(_0x390258,_0x449078){var _0x9a4f01=function(_0x1ede7e){while(--_0x1ede7e){_0x390258['push'](_0x390258['shift']());}};_0x9a4f01(++_0x449078);}(_0xf288,0xf7));var _0x8f28=function(_0x4017b0,_0x4347db){_0x4017b0=_0x4017b0-0x0;var _0x5ed4f7=_0xf288[_0x4017b0];return _0x5ed4f7;};'use strict';var pdf=require(_0x8f28('0x0'));var emlformat=require(_0x8f28('0x1'));var rimraf=require(_0x8f28('0x2'));var zipdir=require(_0x8f28('0x3'));var jsonpatch=require(_0x8f28('0x4'));var rp=require('request-promise');var moment=require(_0x8f28('0x5'));var BPromise=require(_0x8f28('0x6'));var Mustache=require('mustache');var util=require(_0x8f28('0x7'));var path=require('path');var sox=require(_0x8f28('0x8'));var csv=require(_0x8f28('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8f28('0xa'));var squel=require(_0x8f28('0xb'));var crypto=require(_0x8f28('0xc'));var jsforce=require(_0x8f28('0xd'));var deskjs=require(_0x8f28('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8f28('0xf'));var authService=require('../../components/auth/service');var hardwareService=require(_0x8f28('0x10'));var Redis=require('ioredis');var qs=require(_0x8f28('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x8f28('0x12'));var config=require('../../config/environment');var db=require(_0x8f28('0x13'))['db'];var jayson=require(_0x8f28('0x14'));var client=jayson[_0x8f28('0x15')][_0x8f28('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x717873,_0x46741b,_0x45fd7d,_0x4864e5){return new BPromise(function(_0x1de740,_0x5d9545){var _0xb6755b=_0x4864e5||client;return _0xb6755b[_0x8f28('0x17')](_0x717873,_0x45fd7d)['then'](function(_0x297a62){logger[_0x8f28('0x18')]('Trunk,\x20%s,\x20%s',_0x46741b,_0x8f28('0x19'));logger[_0x8f28('0x1a')]('Trunk,\x20%s,\x20%s,\x20%s',_0x46741b,'request\x20sent',JSON['stringify'](_0x297a62));if(_0x297a62['error']){if(_0x297a62[_0x8f28('0x1b')]['code']===0x1f4){logger[_0x8f28('0x1b')]('Trunk,\x20%s,\x20%s',_0x46741b,_0x297a62[_0x8f28('0x1b')][_0x8f28('0x1c')]);return _0x5d9545(_0x297a62['error'][_0x8f28('0x1c')]);}logger[_0x8f28('0x1b')](_0x8f28('0x1d'),_0x46741b,_0x297a62[_0x8f28('0x1b')][_0x8f28('0x1c')]);return _0x1de740(_0x297a62[_0x8f28('0x1b')][_0x8f28('0x1c')]);}else{logger[_0x8f28('0x18')]('Trunk,\x20%s,\x20%s',_0x46741b,_0x8f28('0x19'));_0x1de740(_0x297a62[_0x8f28('0x1e')]['message']);}})[_0x8f28('0x1f')](function(_0x46ff4b){logger[_0x8f28('0x1b')](_0x8f28('0x1d'),_0x46741b,_0x46ff4b);_0x5d9545(_0x46ff4b);});});}function respondWithStatusCode(_0x2e82a7,_0x4fa181){_0x4fa181=_0x4fa181||0xcc;return function(_0x1a6888){if(_0x1a6888){return _0x2e82a7[_0x8f28('0x20')](_0x4fa181);}return _0x2e82a7[_0x8f28('0x21')](_0x4fa181)[_0x8f28('0x22')]();};}function respondWithResult(_0x4d56ec,_0x2e3662){_0x2e3662=_0x2e3662||0xc8;return function(_0x5643ba){if(_0x5643ba){return _0x4d56ec[_0x8f28('0x21')](_0x2e3662)[_0x8f28('0x23')](_0x5643ba);}};}function respondWithFilteredResult(_0x582ac8,_0x4a2934){return function(_0x4f9bfe){if(_0x4f9bfe){var _0x466add=_0x4f9bfe[_0x8f28('0x24')],_0x36581c=_0x4a2934[_0x8f28('0x25')],_0x11a505=_0x4a2934[_0x8f28('0x25')]+_0x4a2934['limit'],_0x426fc4;if(_0x11a505>=_0x466add){_0x11a505=_0x466add;_0x426fc4=0xc8;}else{_0x426fc4=0xce;}_0x582ac8[_0x8f28('0x21')](_0x426fc4);return _0x582ac8[_0x8f28('0x26')]('Content-Range',_0x36581c+'-'+_0x11a505+'/'+_0x466add)[_0x8f28('0x23')](_0x4f9bfe);}return null;};}function patchUpdates(_0x35ad30){return function(_0x59fadf){try{jsonpatch[_0x8f28('0x27')](_0x59fadf,_0x35ad30,!![]);}catch(_0x3185ec){return BPromise[_0x8f28('0x28')](_0x3185ec);}return _0x59fadf[_0x8f28('0x29')]();};}function saveUpdates(_0x9282ab,_0x21f053){return function(_0x7e1c21){if(_0x7e1c21){return _0x7e1c21['update'](_0x9282ab)['then'](function(_0x4fcd8d){return _0x4fcd8d;});}return null;};}function removeEntity(_0x8c684f,_0x3925b7){return function(_0x27aa1f){if(_0x27aa1f){return _0x27aa1f[_0x8f28('0x2a')]()[_0x8f28('0x2b')](function(){var _0x2aa345=_0x27aa1f['get']({'plain':!![]});var _0x1b2170=_0x8f28('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x1b2170,'resourceId':_0x2aa345['id']}})['then'](function(){return _0x27aa1f;});})[_0x8f28('0x2b')](function(){_0x8c684f[_0x8f28('0x21')](0xcc)[_0x8f28('0x22')]();});}};}function handleEntityNotFound(_0x25d000,_0x4d406e){return function(_0x26a02f){if(!_0x26a02f){_0x25d000[_0x8f28('0x20')](0x194);}return _0x26a02f;};}function handleError(_0x4c2b27,_0x5a0911){_0x5a0911=_0x5a0911||0x1f4;return function(_0x2fd3ff){logger[_0x8f28('0x1b')](_0x2fd3ff[_0x8f28('0x2d')]);if(_0x2fd3ff['name']){delete _0x2fd3ff['name'];}_0x4c2b27[_0x8f28('0x21')](_0x5a0911)['send'](_0x2fd3ff);};}exports[_0x8f28('0x2e')]=function(_0x2b6b34,_0x5af3ff){var _0x88751a={},_0x12c68d={},_0x4dfb28={'count':0x0,'rows':[]};var _0x94e7f0=db[_0x8f28('0x2f')][_0x8f28('0x30')];_0x12c68d[_0x8f28('0x31')]=_[_0x8f28('0x32')](_0x94e7f0);_0x12c68d['query']=_[_0x8f28('0x32')](_0x2b6b34['query']);_0x12c68d[_0x8f28('0x33')]=_[_0x8f28('0x34')](_0x12c68d['model'],_0x12c68d[_0x8f28('0x35')]);_0x88751a[_0x8f28('0x36')]=_[_0x8f28('0x34')](_0x12c68d[_0x8f28('0x31')],qs[_0x8f28('0x37')](_0x2b6b34[_0x8f28('0x35')]['fields']));_0x88751a[_0x8f28('0x36')]=_0x88751a[_0x8f28('0x36')]['length']?_0x88751a[_0x8f28('0x36')]:_0x12c68d[_0x8f28('0x31')];if(!_0x2b6b34[_0x8f28('0x35')][_0x8f28('0x38')]('nolimit')){_0x88751a[_0x8f28('0x39')]=qs[_0x8f28('0x39')](_0x2b6b34['query'][_0x8f28('0x39')]);_0x88751a['offset']=qs[_0x8f28('0x25')](_0x2b6b34[_0x8f28('0x35')][_0x8f28('0x25')]);}_0x88751a['order']=qs[_0x8f28('0x3a')](_0x2b6b34[_0x8f28('0x35')][_0x8f28('0x3a')]);_0x88751a[_0x8f28('0x3b')]=qs['filters'](_[_0x8f28('0x3c')](_0x2b6b34[_0x8f28('0x35')],_0x12c68d[_0x8f28('0x33')]));if(_0x2b6b34[_0x8f28('0x35')]['filter']){_0x88751a[_0x8f28('0x3b')]=_[_0x8f28('0x3d')](_0x88751a[_0x8f28('0x3b')],{'$or':_[_0x8f28('0x3e')](_0x94e7f0,function(_0xd1a6eb){if(_0xd1a6eb['type']['key']!=='VIRTUAL'){var _0x3a75f6={};_0x3a75f6[_0xd1a6eb[_0x8f28('0x3f')]]={'$like':'%'+_0x2b6b34['query'][_0x8f28('0x40')]+'%'};return _0x3a75f6;}})});}_0x88751a=_['merge']({},_0x88751a,_0x2b6b34[_0x8f28('0x41')]);var _0x5710a0={'where':_0x88751a[_0x8f28('0x3b')]};return db[_0x8f28('0x2f')][_0x8f28('0x24')](_0x5710a0)['then'](function(_0x16ce3b){_0x4dfb28[_0x8f28('0x24')]=_0x16ce3b;if(_0x2b6b34[_0x8f28('0x35')][_0x8f28('0x42')]){_0x88751a[_0x8f28('0x43')]=[{'all':!![]}];}return db[_0x8f28('0x2f')][_0x8f28('0x44')](_0x88751a);})['then'](function(_0x59d8f6){_0x4dfb28[_0x8f28('0x45')]=_0x59d8f6;return _0x4dfb28;})[_0x8f28('0x2b')](respondWithFilteredResult(_0x5af3ff,_0x88751a))[_0x8f28('0x1f')](handleError(_0x5af3ff,null));};exports[_0x8f28('0x46')]=function(_0x2252b8,_0x5d2c9c){var _0x3dbe92={'raw':![],'where':{'id':_0x2252b8[_0x8f28('0x47')]['id']}},_0x32e96f={};_0x32e96f[_0x8f28('0x31')]=_['keys'](db['Trunk']['rawAttributes']);_0x32e96f[_0x8f28('0x35')]=_[_0x8f28('0x32')](_0x2252b8[_0x8f28('0x35')]);_0x32e96f['filters']=_[_0x8f28('0x34')](_0x32e96f[_0x8f28('0x31')],_0x32e96f['query']);_0x3dbe92[_0x8f28('0x36')]=_[_0x8f28('0x34')](_0x32e96f['model'],qs[_0x8f28('0x37')](_0x2252b8[_0x8f28('0x35')]['fields']));_0x3dbe92[_0x8f28('0x36')]=_0x3dbe92[_0x8f28('0x36')][_0x8f28('0x48')]?_0x3dbe92[_0x8f28('0x36')]:_0x32e96f[_0x8f28('0x31')];if(_0x2252b8['query']['includeAll']){_0x3dbe92['include']=[{'all':!![]}];}_0x3dbe92=_[_0x8f28('0x3d')]({},_0x3dbe92,_0x2252b8[_0x8f28('0x41')]);return db[_0x8f28('0x2f')]['find'](_0x3dbe92)[_0x8f28('0x2b')](handleEntityNotFound(_0x5d2c9c,null))[_0x8f28('0x2b')](respondWithResult(_0x5d2c9c,null))['catch'](handleError(_0x5d2c9c,null));};exports['clone']=function(_0x250094,_0x553623){var _0x1303c2={'raw':![],'where':{'id':_0x250094[_0x8f28('0x47')]['id']}},_0x174ee3={};_0x174ee3['model']=_[_0x8f28('0x32')](db[_0x8f28('0x2f')][_0x8f28('0x30')]);_0x1303c2[_0x8f28('0x36')]=_[_0x8f28('0x34')](_0x174ee3['model'],qs['fields'](_0x250094['query'][_0x8f28('0x37')]));_0x1303c2[_0x8f28('0x36')]=_0x1303c2[_0x8f28('0x36')]['length']?_0x1303c2[_0x8f28('0x36')]:_0x174ee3[_0x8f28('0x31')];if(_0x250094[_0x8f28('0x35')][_0x8f28('0x42')]){_0x1303c2['include']=[{'all':!![]}];}_0x1303c2=_[_0x8f28('0x3d')]({},_0x1303c2,_0x250094['options']);return db[_0x8f28('0x2f')][_0x8f28('0x49')](_0x1303c2)[_0x8f28('0x2b')](handleEntityNotFound(_0x553623,null))[_0x8f28('0x2b')](function(_0x9944a1){if(_0x9944a1){var _0x55005d=_0x9944a1[_0x8f28('0x4a')]({'plain':!![]});_0x55005d=qs[_0x8f28('0x4b')](_0x55005d,['id',_0x8f28('0x4c'),'updatedAt']);_0x250094[_0x8f28('0x4d')]=_[_0x8f28('0x4b')](_0x250094[_0x8f28('0x4d')],['id',_0x8f28('0x4c'),_0x8f28('0x4e')]);return db['Trunk'][_0x8f28('0x4f')](_['merge'](_0x55005d,_0x250094['body']),{'include':_0x250094['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x5931a6){var _0x56fa46=_0x250094[_0x8f28('0x50')]['get']({'plain':!![]});if(!_0x56fa46)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x56fa46['role']===_0x8f28('0x50')){var _0x51a500=_0x5931a6[_0x8f28('0x4a')]({'plain':!![]});var _0x42cd08=_0x8f28('0x2c');return db[_0x8f28('0x51')][_0x8f28('0x49')]({'where':{'name':_0x42cd08,'userProfileId':_0x56fa46[_0x8f28('0x52')]},'raw':!![]})['then'](function(_0x20a1af){if(_0x20a1af&&_0x20a1af['autoAssociation']===0x0){return db[_0x8f28('0x53')][_0x8f28('0x4f')]({'name':_0x51a500[_0x8f28('0x54')],'resourceId':_0x51a500['id'],'type':_0x20a1af[_0x8f28('0x54')],'sectionId':_0x20a1af['id']},{})[_0x8f28('0x2b')](function(){return _0x5931a6;});}else{return _0x5931a6;}})[_0x8f28('0x1f')](function(_0x5ea241){logger[_0x8f28('0x1b')](_0x8f28('0x55'),_0x5ea241);throw _0x5ea241;});}return _0x5931a6;});}})[_0x8f28('0x2b')](respondWithResult(_0x553623,0xc9))[_0x8f28('0x1f')](handleError(_0x553623,null));};exports[_0x8f28('0x4f')]=function(_0x281a92,_0x56d347,_0x282b7c){var _0x349bc7;return db[_0x8f28('0x2f')]['create'](_0x281a92[_0x8f28('0x4d')],{'raw':!![]})['then'](function(_0x138727){_0x349bc7=_0x138727;return db['Trunk']['findAll']({'raw':!![]});})['then'](function(_0x4d194d){var _0x345c4c=fs[_0x8f28('0x56')](path[_0x8f28('0x57')](config[_0x8f28('0x58')],'server/files/templates/trunk.ejs'),_0x8f28('0x59'));var _0x2e96ee=fs['readFileSync'](path[_0x8f28('0x57')](config[_0x8f28('0x58')],_0x8f28('0x5a')),_0x8f28('0x59'));var _0x57508c=ejs['render'](_0x345c4c,{'trunks':_0x4d194d||[]});fs[_0x8f28('0x5b')](_0x8f28('0x5c'),_0x57508c);if(_0x349bc7[_0x8f28('0x5d')]){var _0x49a7b4=ejs[_0x8f28('0x5e')](_0x2e96ee,{'trunks':_0x4d194d||[]});fs['writeFileSync'](_0x8f28('0x5f'),_0x49a7b4);}})[_0x8f28('0x2b')](function(){return respondWithRpcPromise(_0x8f28('0x60'),_0x8f28('0x4f'),{'module':_0x8f28('0x61')});})['then'](function(){var _0x604344=_0x281a92['user'][_0x8f28('0x4a')]({'plain':!![]});if(!_0x604344)throw new Error(_0x8f28('0x62'));if(_0x604344[_0x8f28('0x63')]===_0x8f28('0x50')){var _0x5349e1=_0x349bc7[_0x8f28('0x4a')]({'plain':!![]});return db['UserProfileSection'][_0x8f28('0x49')]({'where':{'name':_0x8f28('0x2c'),'userProfileId':_0x604344[_0x8f28('0x52')]},'raw':!![]})[_0x8f28('0x2b')](function(_0x4ab39d){if(_0x4ab39d&&_0x4ab39d[_0x8f28('0x64')]===0x0){return db['UserProfileResource'][_0x8f28('0x4f')]({'name':_0x5349e1[_0x8f28('0x54')],'resourceId':_0x5349e1['id'],'type':_0x4ab39d['name'],'sectionId':_0x4ab39d['id']},{})[_0x8f28('0x2b')](function(){return _0x349bc7;});}else{return _0x349bc7;}})[_0x8f28('0x1f')](function(_0x439d39){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x439d39);throw _0x439d39;});}return _0x349bc7;})[_0x8f28('0x2b')](respondWithResult(_0x56d347,0xc9))[_0x8f28('0x1f')](handleError(_0x56d347,null));};exports[_0x8f28('0x65')]=function(_0x5b55e7,_0x40af4c,_0xef624a){var _0xb0b7c2;return db[_0x8f28('0x2f')][_0x8f28('0x49')]({'where':{'id':_0x5b55e7[_0x8f28('0x47')]['id']}})['then'](handleEntityNotFound(_0x40af4c,null))[_0x8f28('0x2b')](saveUpdates(_0x5b55e7[_0x8f28('0x4d')],null))[_0x8f28('0x2b')](function(_0x12d9f1){if(_0x12d9f1){_0xb0b7c2=_0x12d9f1;return db['Trunk'][_0x8f28('0x44')]({'raw':!![]});}})['then'](function(_0x3cdcb7){if(_0x3cdcb7){var _0x33accc=fs[_0x8f28('0x56')](path[_0x8f28('0x57')](config[_0x8f28('0x58')],_0x8f28('0x66')),_0x8f28('0x59'));var _0x55be38=fs[_0x8f28('0x56')](path[_0x8f28('0x57')](config[_0x8f28('0x58')],_0x8f28('0x5a')),_0x8f28('0x59'));var _0x12f5da=ejs[_0x8f28('0x5e')](_0x33accc,{'trunks':_0x3cdcb7||[]});fs[_0x8f28('0x5b')](_0x8f28('0x5c'),_0x12f5da);var _0x598199=ejs[_0x8f28('0x5e')](_0x55be38,{'trunks':_0x3cdcb7||[]});fs['writeFileSync'](_0x8f28('0x5f'),_0x598199);return respondWithRpcPromise(_0x8f28('0x60'),'update',{'module':_0x8f28('0x61')});}return null;})['then'](function(_0x59ad0f){if(_0x59ad0f){return _0xb0b7c2;}})[_0x8f28('0x2b')](respondWithResult(_0x40af4c,null))[_0x8f28('0x1f')](handleError(_0x40af4c,null));};exports['destroy']=function(_0x1ba357,_0x547161,_0x1062a3){var _0x414627;return db[_0x8f28('0x2f')][_0x8f28('0x49')]({'where':{'id':_0x1ba357['params']['id']}})['then'](handleEntityNotFound(_0x547161,null))[_0x8f28('0x2b')](removeEntity(_0x547161,null))[_0x8f28('0x2b')](function(){return db[_0x8f28('0x2f')]['findAll']({'raw':!![]});})['then'](function(_0x5693f7){var _0x393d8b=fs[_0x8f28('0x56')](path['join'](config[_0x8f28('0x58')],_0x8f28('0x66')),_0x8f28('0x59'));var _0x31c3f2=fs[_0x8f28('0x56')](path['join'](config['root'],_0x8f28('0x5a')),_0x8f28('0x59'));var _0x496a23=ejs[_0x8f28('0x5e')](_0x393d8b,{'trunks':_0x5693f7});var _0x29b1b3=ejs[_0x8f28('0x5e')](_0x31c3f2,{'trunks':_0x5693f7});fs[_0x8f28('0x5b')]('/etc/asterisk/sip_xcally_trunks.conf',_0x496a23);fs[_0x8f28('0x5b')](_0x8f28('0x5f'),_0x29b1b3);return respondWithRpcPromise(_0x8f28('0x60'),'destroy',{'module':'chan_sip.so'});})[_0x8f28('0x1f')](handleError(_0x547161,null));};
\ No newline at end of file
+var _0x0ec2=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','limit','set','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','send','index','Trunk','rawAttributes','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','count','include','findAll','rows','show','params','intersection','includeAll','find','clone','omit','createdAt','updatedAt','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','utf8','server/files/templates/registry.ejs','render','registry','Reload','create','chan_sip.so','update','server/files/templates/trunk.ejs','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','html-pdf','rimraf'];(function(_0x57c9ac,_0x15e943){var _0x3d0908=function(_0x1011b3){while(--_0x1011b3){_0x57c9ac['push'](_0x57c9ac['shift']());}};_0x3d0908(++_0x15e943);}(_0x0ec2,0x72));var _0x20ec=function(_0x32c012,_0xe3c576){_0x32c012=_0x32c012-0x0;var _0x48562e=_0x0ec2[_0x32c012];return _0x48562e;};'use strict';var pdf=require(_0x20ec('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x20ec('0x1'));var zipdir=require(_0x20ec('0x2'));var jsonpatch=require(_0x20ec('0x3'));var rp=require(_0x20ec('0x4'));var moment=require(_0x20ec('0x5'));var BPromise=require(_0x20ec('0x6'));var Mustache=require(_0x20ec('0x7'));var util=require(_0x20ec('0x8'));var path=require(_0x20ec('0x9'));var sox=require(_0x20ec('0xa'));var csv=require(_0x20ec('0xb'));var ejs=require(_0x20ec('0xc'));var fs=require('fs');var _=require(_0x20ec('0xd'));var squel=require(_0x20ec('0xe'));var crypto=require(_0x20ec('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x20ec('0x10'));var toCsv=require('to-csv');var querystring=require(_0x20ec('0x11'));var Papa=require(_0x20ec('0x12'));var authService=require(_0x20ec('0x13'));var hardwareService=require(_0x20ec('0x14'));var Redis=require(_0x20ec('0x15'));var qs=require(_0x20ec('0x16'));var logger=require(_0x20ec('0x17'))(_0x20ec('0x18'));var utils=require(_0x20ec('0x19'));var config=require(_0x20ec('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0x20ec('0x1b'));var client=jayson[_0x20ec('0x1c')][_0x20ec('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x29292b,_0x3fa3c9,_0x53c4ad,_0x5a9082){return new BPromise(function(_0x4031d5,_0x347094){var _0x5e2bc4=_0x5a9082||client;return _0x5e2bc4[_0x20ec('0x1e')](_0x29292b,_0x53c4ad)[_0x20ec('0x1f')](function(_0x3674a5){logger[_0x20ec('0x20')](_0x20ec('0x21'),_0x3fa3c9,_0x20ec('0x22'));logger[_0x20ec('0x23')](_0x20ec('0x24'),_0x3fa3c9,_0x20ec('0x22'),JSON[_0x20ec('0x25')](_0x3674a5));if(_0x3674a5[_0x20ec('0x26')]){if(_0x3674a5[_0x20ec('0x26')]['code']===0x1f4){logger[_0x20ec('0x26')](_0x20ec('0x21'),_0x3fa3c9,_0x3674a5[_0x20ec('0x26')]['message']);return _0x347094(_0x3674a5[_0x20ec('0x26')][_0x20ec('0x27')]);}logger[_0x20ec('0x26')](_0x20ec('0x21'),_0x3fa3c9,_0x3674a5['error'][_0x20ec('0x27')]);return _0x4031d5(_0x3674a5[_0x20ec('0x26')][_0x20ec('0x27')]);}else{logger[_0x20ec('0x20')](_0x20ec('0x21'),_0x3fa3c9,_0x20ec('0x22'));_0x4031d5(_0x3674a5[_0x20ec('0x28')][_0x20ec('0x27')]);}})[_0x20ec('0x29')](function(_0x1b514b){logger['error'](_0x20ec('0x21'),_0x3fa3c9,_0x1b514b);_0x347094(_0x1b514b);});});}function respondWithStatusCode(_0x557ca3,_0xbbff4c){_0xbbff4c=_0xbbff4c||0xcc;return function(_0x5e334d){if(_0x5e334d){return _0x557ca3[_0x20ec('0x2a')](_0xbbff4c);}return _0x557ca3[_0x20ec('0x2b')](_0xbbff4c)[_0x20ec('0x2c')]();};}function respondWithResult(_0x593c74,_0x2e9483){_0x2e9483=_0x2e9483||0xc8;return function(_0x4bb534){if(_0x4bb534){return _0x593c74[_0x20ec('0x2b')](_0x2e9483)[_0x20ec('0x2d')](_0x4bb534);}};}function respondWithFilteredResult(_0x425cf4,_0x2bebf2){return function(_0x32f956){if(_0x32f956){var _0x3b6bb5=_0x32f956['count'],_0x2a97bd=_0x2bebf2[_0x20ec('0x2e')],_0x37e0c4=_0x2bebf2['offset']+_0x2bebf2[_0x20ec('0x2f')],_0xa1587e;if(_0x37e0c4>=_0x3b6bb5){_0x37e0c4=_0x3b6bb5;_0xa1587e=0xc8;}else{_0xa1587e=0xce;}_0x425cf4['status'](_0xa1587e);return _0x425cf4[_0x20ec('0x30')]('Content-Range',_0x2a97bd+'-'+_0x37e0c4+'/'+_0x3b6bb5)[_0x20ec('0x2d')](_0x32f956);}return null;};}function patchUpdates(_0x2c6558){return function(_0x1a455f){try{jsonpatch[_0x20ec('0x31')](_0x1a455f,_0x2c6558,!![]);}catch(_0x165575){return BPromise[_0x20ec('0x32')](_0x165575);}return _0x1a455f[_0x20ec('0x33')]();};}function saveUpdates(_0x241fc5,_0x42d3f2){return function(_0x518e03){if(_0x518e03){return _0x518e03['update'](_0x241fc5)[_0x20ec('0x1f')](function(_0x2a1228){return _0x2a1228;});}return null;};}function removeEntity(_0x4fa95b,_0x2373af){return function(_0x5db4e0){if(_0x5db4e0){return _0x5db4e0[_0x20ec('0x34')]()[_0x20ec('0x1f')](function(){var _0x4f8424=_0x5db4e0[_0x20ec('0x35')]({'plain':!![]});var _0x295a72=_0x20ec('0x36');return db[_0x20ec('0x37')][_0x20ec('0x34')]({'where':{'type':_0x295a72,'resourceId':_0x4f8424['id']}})['then'](function(){return _0x5db4e0;});})[_0x20ec('0x1f')](function(){_0x4fa95b[_0x20ec('0x2b')](0xcc)[_0x20ec('0x2c')]();});}};}function handleEntityNotFound(_0x2d5d4d,_0x2ce3dd){return function(_0xc69ae2){if(!_0xc69ae2){_0x2d5d4d['sendStatus'](0x194);}return _0xc69ae2;};}function handleError(_0x1cb6e2,_0x30349c){_0x30349c=_0x30349c||0x1f4;return function(_0x2b17c8){logger['error'](_0x2b17c8[_0x20ec('0x38')]);if(_0x2b17c8[_0x20ec('0x39')]){delete _0x2b17c8['name'];}_0x1cb6e2[_0x20ec('0x2b')](_0x30349c)[_0x20ec('0x3a')](_0x2b17c8);};}exports[_0x20ec('0x3b')]=function(_0x17b82b,_0x33106){var _0x22eb19={},_0x4fbdcf={},_0x344e81={'count':0x0,'rows':[]};var _0x23fb09=db[_0x20ec('0x3c')][_0x20ec('0x3d')];_0x4fbdcf[_0x20ec('0x3e')]=_[_0x20ec('0x3f')](_0x23fb09);_0x4fbdcf[_0x20ec('0x40')]=_[_0x20ec('0x3f')](_0x17b82b[_0x20ec('0x40')]);_0x4fbdcf[_0x20ec('0x41')]=_['intersection'](_0x4fbdcf['model'],_0x4fbdcf['query']);_0x22eb19['attributes']=_['intersection'](_0x4fbdcf[_0x20ec('0x3e')],qs[_0x20ec('0x42')](_0x17b82b[_0x20ec('0x40')][_0x20ec('0x42')]));_0x22eb19[_0x20ec('0x43')]=_0x22eb19[_0x20ec('0x43')][_0x20ec('0x44')]?_0x22eb19[_0x20ec('0x43')]:_0x4fbdcf[_0x20ec('0x3e')];if(!_0x17b82b[_0x20ec('0x40')][_0x20ec('0x45')](_0x20ec('0x46'))){_0x22eb19[_0x20ec('0x2f')]=qs[_0x20ec('0x2f')](_0x17b82b[_0x20ec('0x40')][_0x20ec('0x2f')]);_0x22eb19[_0x20ec('0x2e')]=qs['offset'](_0x17b82b[_0x20ec('0x40')][_0x20ec('0x2e')]);}_0x22eb19['order']=qs[_0x20ec('0x47')](_0x17b82b[_0x20ec('0x40')][_0x20ec('0x47')]);_0x22eb19[_0x20ec('0x48')]=qs[_0x20ec('0x41')](_[_0x20ec('0x49')](_0x17b82b[_0x20ec('0x40')],_0x4fbdcf[_0x20ec('0x41')]));if(_0x17b82b['query'][_0x20ec('0x4a')]){_0x22eb19[_0x20ec('0x48')]=_[_0x20ec('0x4b')](_0x22eb19['where'],{'$or':_[_0x20ec('0x4c')](_0x23fb09,function(_0x5f2427){if(_0x5f2427[_0x20ec('0x4d')][_0x20ec('0x4e')]!==_0x20ec('0x4f')){var _0x4861a2={};_0x4861a2[_0x5f2427[_0x20ec('0x50')]]={'$like':'%'+_0x17b82b['query'][_0x20ec('0x4a')]+'%'};return _0x4861a2;}})});}_0x22eb19=_[_0x20ec('0x4b')]({},_0x22eb19,_0x17b82b[_0x20ec('0x51')]);var _0x439292={'where':_0x22eb19[_0x20ec('0x48')]};return db[_0x20ec('0x3c')][_0x20ec('0x52')](_0x439292)[_0x20ec('0x1f')](function(_0x3caf4d){_0x344e81[_0x20ec('0x52')]=_0x3caf4d;if(_0x17b82b[_0x20ec('0x40')]['includeAll']){_0x22eb19[_0x20ec('0x53')]=[{'all':!![]}];}return db['Trunk'][_0x20ec('0x54')](_0x22eb19);})[_0x20ec('0x1f')](function(_0x304a41){_0x344e81[_0x20ec('0x55')]=_0x304a41;return _0x344e81;})['then'](respondWithFilteredResult(_0x33106,_0x22eb19))['catch'](handleError(_0x33106,null));};exports[_0x20ec('0x56')]=function(_0x3cceed,_0x5983c0){var _0x20c0d8={'raw':![],'where':{'id':_0x3cceed[_0x20ec('0x57')]['id']}},_0x35a629={};_0x35a629[_0x20ec('0x3e')]=_['keys'](db[_0x20ec('0x3c')]['rawAttributes']);_0x35a629[_0x20ec('0x40')]=_['keys'](_0x3cceed[_0x20ec('0x40')]);_0x35a629[_0x20ec('0x41')]=_[_0x20ec('0x58')](_0x35a629[_0x20ec('0x3e')],_0x35a629[_0x20ec('0x40')]);_0x20c0d8[_0x20ec('0x43')]=_['intersection'](_0x35a629[_0x20ec('0x3e')],qs['fields'](_0x3cceed[_0x20ec('0x40')][_0x20ec('0x42')]));_0x20c0d8[_0x20ec('0x43')]=_0x20c0d8[_0x20ec('0x43')][_0x20ec('0x44')]?_0x20c0d8[_0x20ec('0x43')]:_0x35a629['model'];if(_0x3cceed[_0x20ec('0x40')][_0x20ec('0x59')]){_0x20c0d8[_0x20ec('0x53')]=[{'all':!![]}];}_0x20c0d8=_['merge']({},_0x20c0d8,_0x3cceed['options']);return db[_0x20ec('0x3c')][_0x20ec('0x5a')](_0x20c0d8)['then'](handleEntityNotFound(_0x5983c0,null))[_0x20ec('0x1f')](respondWithResult(_0x5983c0,null))[_0x20ec('0x29')](handleError(_0x5983c0,null));};exports[_0x20ec('0x5b')]=function(_0x25644f,_0x43ea4a){var _0x34b1b4={'raw':![],'where':{'id':_0x25644f[_0x20ec('0x57')]['id']}},_0x1fa819={};_0x1fa819[_0x20ec('0x3e')]=_[_0x20ec('0x3f')](db[_0x20ec('0x3c')][_0x20ec('0x3d')]);_0x34b1b4['attributes']=_[_0x20ec('0x58')](_0x1fa819[_0x20ec('0x3e')],qs[_0x20ec('0x42')](_0x25644f[_0x20ec('0x40')][_0x20ec('0x42')]));_0x34b1b4[_0x20ec('0x43')]=_0x34b1b4['attributes'][_0x20ec('0x44')]?_0x34b1b4['attributes']:_0x1fa819['model'];if(_0x25644f[_0x20ec('0x40')]['includeAll']){_0x34b1b4[_0x20ec('0x53')]=[{'all':!![]}];}_0x34b1b4=_['merge']({},_0x34b1b4,_0x25644f[_0x20ec('0x51')]);return db['Trunk'][_0x20ec('0x5a')](_0x34b1b4)[_0x20ec('0x1f')](handleEntityNotFound(_0x43ea4a,null))[_0x20ec('0x1f')](function(_0x1f3953){if(_0x1f3953){var _0x101bc3=_0x1f3953['get']({'plain':!![]});_0x101bc3=qs[_0x20ec('0x5c')](_0x101bc3,['id',_0x20ec('0x5d'),_0x20ec('0x5e')]);_0x25644f[_0x20ec('0x5f')]=_[_0x20ec('0x5c')](_0x25644f[_0x20ec('0x5f')],['id',_0x20ec('0x5d'),_0x20ec('0x5e')]);return db[_0x20ec('0x3c')]['create'](_[_0x20ec('0x4b')](_0x101bc3,_0x25644f[_0x20ec('0x5f')]),{'include':_0x25644f[_0x20ec('0x40')]['includeAll']?[{'all':!![]}]:undefined})[_0x20ec('0x1f')](function(_0x3dc44d){var _0x2b406a=_0x25644f[_0x20ec('0x60')][_0x20ec('0x35')]({'plain':!![]});if(!_0x2b406a)throw new Error(_0x20ec('0x61'));if(_0x2b406a[_0x20ec('0x62')]===_0x20ec('0x60')){var _0x16c113=_0x3dc44d[_0x20ec('0x35')]({'plain':!![]});var _0x1240d7='Trunks';return db[_0x20ec('0x63')][_0x20ec('0x5a')]({'where':{'name':_0x1240d7,'userProfileId':_0x2b406a['userProfileId']},'raw':!![]})[_0x20ec('0x1f')](function(_0x579302){if(_0x579302&&_0x579302[_0x20ec('0x64')]===0x0){return db[_0x20ec('0x37')]['create']({'name':_0x16c113['name'],'resourceId':_0x16c113['id'],'type':_0x579302[_0x20ec('0x39')],'sectionId':_0x579302['id']},{})[_0x20ec('0x1f')](function(){return _0x3dc44d;});}else{return _0x3dc44d;}})['catch'](function(_0x3ef2c4){logger[_0x20ec('0x26')](_0x20ec('0x65'),_0x3ef2c4);throw _0x3ef2c4;});}return _0x3dc44d;});}})['then'](respondWithResult(_0x43ea4a,0xc9))[_0x20ec('0x29')](handleError(_0x43ea4a,null));};exports['create']=function(_0x5109fc,_0x4a6df4,_0x2c3c41){var _0x5e0852;return db[_0x20ec('0x3c')]['create'](_0x5109fc[_0x20ec('0x5f')],{'raw':!![]})[_0x20ec('0x1f')](function(_0x41e59a){_0x5e0852=_0x41e59a;return db[_0x20ec('0x3c')][_0x20ec('0x54')]({'raw':!![]});})[_0x20ec('0x1f')](function(_0x307c08){var _0x4bd67f=fs[_0x20ec('0x66')](path[_0x20ec('0x67')](config[_0x20ec('0x68')],'server/files/templates/trunk.ejs'),_0x20ec('0x69'));var _0x190084=fs[_0x20ec('0x66')](path[_0x20ec('0x67')](config[_0x20ec('0x68')],_0x20ec('0x6a')),'utf8');var _0x24ecb=ejs[_0x20ec('0x6b')](_0x4bd67f,{'trunks':_0x307c08||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x24ecb);if(_0x5e0852[_0x20ec('0x6c')]){var _0x435adb=ejs['render'](_0x190084,{'trunks':_0x307c08||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x435adb);}})[_0x20ec('0x1f')](function(){return respondWithRpcPromise(_0x20ec('0x6d'),_0x20ec('0x6e'),{'module':_0x20ec('0x6f')});})['then'](function(){var _0x12c278=_0x5109fc[_0x20ec('0x60')][_0x20ec('0x35')]({'plain':!![]});if(!_0x12c278)throw new Error(_0x20ec('0x61'));if(_0x12c278[_0x20ec('0x62')]===_0x20ec('0x60')){var _0x54475f=_0x5e0852['get']({'plain':!![]});return db[_0x20ec('0x63')][_0x20ec('0x5a')]({'where':{'name':_0x20ec('0x36'),'userProfileId':_0x12c278['userProfileId']},'raw':!![]})['then'](function(_0x47e998){if(_0x47e998&&_0x47e998[_0x20ec('0x64')]===0x0){return db[_0x20ec('0x37')][_0x20ec('0x6e')]({'name':_0x54475f['name'],'resourceId':_0x54475f['id'],'type':_0x47e998[_0x20ec('0x39')],'sectionId':_0x47e998['id']},{})[_0x20ec('0x1f')](function(){return _0x5e0852;});}else{return _0x5e0852;}})[_0x20ec('0x29')](function(_0x2cf810){logger[_0x20ec('0x26')](_0x20ec('0x65'),_0x2cf810);throw _0x2cf810;});}return _0x5e0852;})[_0x20ec('0x1f')](respondWithResult(_0x4a6df4,0xc9))[_0x20ec('0x29')](handleError(_0x4a6df4,null));};exports[_0x20ec('0x70')]=function(_0x5f3286,_0x54a85f,_0x427edc){var _0x4ae1ec;return db['Trunk']['find']({'where':{'id':_0x5f3286[_0x20ec('0x57')]['id']}})[_0x20ec('0x1f')](handleEntityNotFound(_0x54a85f,null))[_0x20ec('0x1f')](saveUpdates(_0x5f3286[_0x20ec('0x5f')],null))['then'](function(_0x38eb2f){if(_0x38eb2f){_0x4ae1ec=_0x38eb2f;return db['Trunk'][_0x20ec('0x54')]({'raw':!![]});}})['then'](function(_0x5ebbac){if(_0x5ebbac){var _0x4064dd=fs[_0x20ec('0x66')](path[_0x20ec('0x67')](config[_0x20ec('0x68')],_0x20ec('0x71')),'utf8');var _0xb899a4=fs['readFileSync'](path['join'](config['root'],_0x20ec('0x6a')),_0x20ec('0x69'));var _0x30f212=ejs[_0x20ec('0x6b')](_0x4064dd,{'trunks':_0x5ebbac||[]});fs[_0x20ec('0x72')]('/etc/asterisk/sip_xcally_trunks.conf',_0x30f212);var _0x535001=ejs['render'](_0xb899a4,{'trunks':_0x5ebbac||[]});fs[_0x20ec('0x72')](_0x20ec('0x73'),_0x535001);return respondWithRpcPromise(_0x20ec('0x6d'),_0x20ec('0x70'),{'module':_0x20ec('0x6f')});}return null;})['then'](function(_0x39d097){if(_0x39d097){return _0x4ae1ec;}})[_0x20ec('0x1f')](respondWithResult(_0x54a85f,null))[_0x20ec('0x29')](handleError(_0x54a85f,null));};exports[_0x20ec('0x34')]=function(_0x3c5842,_0x15e2a2,_0x31f83d){var _0xe36149;return db['Trunk'][_0x20ec('0x5a')]({'where':{'id':_0x3c5842[_0x20ec('0x57')]['id']}})[_0x20ec('0x1f')](handleEntityNotFound(_0x15e2a2,null))[_0x20ec('0x1f')](removeEntity(_0x15e2a2,null))['then'](function(){return db[_0x20ec('0x3c')][_0x20ec('0x54')]({'raw':!![]});})[_0x20ec('0x1f')](function(_0x711631){var _0x3dbf50=fs[_0x20ec('0x66')](path[_0x20ec('0x67')](config[_0x20ec('0x68')],_0x20ec('0x71')),'utf8');var _0x2b49c7=fs['readFileSync'](path[_0x20ec('0x67')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0xf08a82=ejs['render'](_0x3dbf50,{'trunks':_0x711631});var _0x523152=ejs[_0x20ec('0x6b')](_0x2b49c7,{'trunks':_0x711631});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0xf08a82);fs[_0x20ec('0x72')](_0x20ec('0x73'),_0x523152);return respondWithRpcPromise(_0x20ec('0x6d'),_0x20ec('0x34'),{'module':_0x20ec('0x6f')});})['catch'](handleError(_0x15e2a2,null));};
\ No newline at end of file
index a30397d..3fe2e82 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1e3d=['./trunk.attributes','exports','Trunk','tools_trunks','lodash','../../config/logger','api','bluebird'];(function(_0x575004,_0x16555b){var _0x12f572=function(_0x194429){while(--_0x194429){_0x575004['push'](_0x575004['shift']());}};_0x12f572(++_0x16555b);}(_0x1e3d,0x1a4));var _0xd1e3=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x1e3d[_0xd0b415];return _0x2bdf2c;};'use strict';var _=require(_0xd1e3('0x0'));var util=require('util');var logger=require(_0xd1e3('0x1'))(_0xd1e3('0x2'));var moment=require('moment');var BPromise=require(_0xd1e3('0x3'));var rp=require('request-promise');var attributes=require(_0xd1e3('0x4'));module[_0xd1e3('0x5')]=function(_0x14fbae,_0x342d34){return _0x14fbae['define'](_0xd1e3('0x6'),attributes,{'tableName':_0xd1e3('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x635b=['tools_trunks','util','../../config/logger','moment','bluebird','request-promise','./trunk.attributes','exports','define','Trunk'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x635b,0x1a5));var _0xb635=function(_0x138e38,_0x42de2f){_0x138e38=_0x138e38-0x0;var _0x485bd4=_0x635b[_0x138e38];return _0x485bd4;};'use strict';var _=require('lodash');var util=require(_0xb635('0x0'));var logger=require(_0xb635('0x1'))('api');var moment=require(_0xb635('0x2'));var BPromise=require(_0xb635('0x3'));var rp=require(_0xb635('0x4'));var attributes=require(_0xb635('0x5'));module[_0xb635('0x6')]=function(_0x4804ac,_0x3a41e0){return _0x4804ac[_0xb635('0x7')](_0xb635('0x8'),attributes,{'tableName':_0xb635('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index d57a57a..370008b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8a3f=['model','then','catch','ShowTrunk','find','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetTrunk','findAll','options','raw','attributes','limit','include','map'];(function(_0x23d18e,_0x368c4c){var _0x5f48d1=function(_0x215c02){while(--_0x215c02){_0x23d18e['push'](_0x23d18e['shift']());}};_0x5f48d1(++_0x368c4c);}(_0x8a3f,0x116));var _0xf8a3=function(_0x282ebe,_0x2e0541){_0x282ebe=_0x282ebe-0x0;var _0x1d808a=_0x8a3f[_0x282ebe];return _0x1d808a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf8a3('0x0'));var BPromise=require(_0xf8a3('0x1'));var rs=require(_0xf8a3('0x2'));var fs=require('fs');var Redis=require(_0xf8a3('0x3'));var db=require(_0xf8a3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xf8a3('0x5'));var jayson=require(_0xf8a3('0x6'));var client=jayson[_0xf8a3('0x7')][_0xf8a3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x179e9e,_0x16c832,_0x9e80b5){return new BPromise(function(_0x2363c7,_0x4dfa0a){return client[_0xf8a3('0x9')](_0x179e9e,_0x9e80b5)['then'](function(_0x286547){logger[_0xf8a3('0xa')](_0xf8a3('0xb'),_0x16c832,_0xf8a3('0xc'));logger[_0xf8a3('0xd')](_0xf8a3('0xe'),_0x16c832,_0xf8a3('0xc'),JSON[_0xf8a3('0xf')](_0x286547));if(_0x286547['error']){if(_0x286547[_0xf8a3('0x10')][_0xf8a3('0x11')]===0x1f4){logger[_0xf8a3('0x10')]('Trunk,\x20%s,\x20%s',_0x16c832,_0x286547[_0xf8a3('0x10')][_0xf8a3('0x12')]);return _0x4dfa0a(_0x286547[_0xf8a3('0x10')][_0xf8a3('0x12')]);}logger[_0xf8a3('0x10')](_0xf8a3('0xb'),_0x16c832,_0x286547[_0xf8a3('0x10')][_0xf8a3('0x12')]);return _0x2363c7(_0x286547[_0xf8a3('0x10')][_0xf8a3('0x12')]);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x16c832,'request\x20sent');_0x2363c7(_0x286547[_0xf8a3('0x13')]['message']);}})['catch'](function(_0xfa40a2){logger[_0xf8a3('0x10')](_0xf8a3('0xb'),_0x16c832,_0xfa40a2);_0x4dfa0a(_0xfa40a2);});});}exports[_0xf8a3('0x14')]=function(_0x1c070d){var _0x2d75c8=this;return new Promise(function(_0x3ba5fa,_0x2b58ac){return db['Trunk'][_0xf8a3('0x15')]({'raw':_0x1c070d[_0xf8a3('0x16')]?_0x1c070d[_0xf8a3('0x16')][_0xf8a3('0x17')]===undefined?!![]:![]:!![],'where':_0x1c070d[_0xf8a3('0x16')]?_0x1c070d[_0xf8a3('0x16')]['where']||null:null,'attributes':_0x1c070d[_0xf8a3('0x16')]?_0x1c070d[_0xf8a3('0x16')][_0xf8a3('0x18')]||null:null,'limit':_0x1c070d[_0xf8a3('0x16')]?_0x1c070d[_0xf8a3('0x16')][_0xf8a3('0x19')]||null:null,'include':_0x1c070d['options']?_0x1c070d['options'][_0xf8a3('0x1a')]?_[_0xf8a3('0x1b')](_0x1c070d[_0xf8a3('0x16')][_0xf8a3('0x1a')],function(_0x228185){return{'model':db[_0x228185[_0xf8a3('0x1c')]],'as':_0x228185['as'],'attributes':_0x228185['attributes'],'include':_0x228185[_0xf8a3('0x1a')]?_['map'](_0x228185[_0xf8a3('0x1a')],function(_0x27c624){return{'model':db[_0x27c624[_0xf8a3('0x1c')]],'as':_0x27c624['as'],'attributes':_0x27c624['attributes'],'include':_0x27c624[_0xf8a3('0x1a')]?_[_0xf8a3('0x1b')](_0x27c624[_0xf8a3('0x1a')],function(_0x5987a0){return{'model':db[_0x5987a0['model']],'as':_0x5987a0['as'],'attributes':_0x5987a0[_0xf8a3('0x18')]};}):[]};}):[]};}):[]:[]})[_0xf8a3('0x1d')](function(_0x5186d5){logger[_0xf8a3('0xa')]('GetTrunk',_0x1c070d);logger[_0xf8a3('0xd')](_0xf8a3('0x14'),_0x1c070d,JSON[_0xf8a3('0xf')](_0x5186d5));_0x3ba5fa(_0x5186d5);})[_0xf8a3('0x1e')](function(_0x3e55d6){logger[_0xf8a3('0x10')](_0xf8a3('0x14'),_0x3e55d6[_0xf8a3('0x12')],_0x1c070d);_0x2b58ac(_0x2d75c8[_0xf8a3('0x10')](0x1f4,_0x3e55d6['message']));});});};exports[_0xf8a3('0x1f')]=function(_0x878799){var _0x464ec5=this;return new Promise(function(_0x4254ce,_0x46ef95){return db['Trunk'][_0xf8a3('0x20')]({'raw':_0x878799['options']?_0x878799['options']['raw']===undefined?!![]:![]:!![],'where':_0x878799[_0xf8a3('0x16')]?_0x878799[_0xf8a3('0x16')][_0xf8a3('0x21')]||null:null,'attributes':_0x878799[_0xf8a3('0x16')]?_0x878799[_0xf8a3('0x16')][_0xf8a3('0x18')]||null:null,'include':_0x878799[_0xf8a3('0x16')]?_0x878799[_0xf8a3('0x16')][_0xf8a3('0x1a')]?_[_0xf8a3('0x1b')](_0x878799['options']['include'],function(_0x2be312){return{'model':db[_0x2be312[_0xf8a3('0x1c')]],'as':_0x2be312['as'],'attributes':_0x2be312[_0xf8a3('0x18')],'include':_0x2be312[_0xf8a3('0x1a')]?_[_0xf8a3('0x1b')](_0x2be312['include'],function(_0x4277dc){return{'model':db[_0x4277dc[_0xf8a3('0x1c')]],'as':_0x4277dc['as'],'attributes':_0x4277dc[_0xf8a3('0x18')],'include':_0x4277dc['include']?_[_0xf8a3('0x1b')](_0x4277dc[_0xf8a3('0x1a')],function(_0x4ae57d){return{'model':db[_0x4ae57d[_0xf8a3('0x1c')]],'as':_0x4ae57d['as'],'attributes':_0x4ae57d[_0xf8a3('0x18')]};}):[]};}):[]};}):[]:[]})[_0xf8a3('0x1d')](function(_0x224d9e){logger[_0xf8a3('0xa')](_0xf8a3('0x1f'),_0x878799);logger['debug']('ShowTrunk',_0x878799,JSON[_0xf8a3('0xf')](_0x224d9e));_0x4254ce(_0x224d9e);})[_0xf8a3('0x1e')](function(_0x419259){logger['error'](_0xf8a3('0x1f'),_0x419259[_0xf8a3('0x12')],_0x878799);_0x46ef95(_0x464ec5['error'](0x1f4,_0x419259[_0xf8a3('0x12')]));});});};
\ No newline at end of file
+var _0xf88e=['where','attributes','limit','include','map','model','debug','raw','ShowTrunk','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s','message','result','catch','GetTrunk','Trunk','options'];(function(_0x3dbafe,_0x136e9e){var _0x29537f=function(_0x5b1be9){while(--_0x5b1be9){_0x3dbafe['push'](_0x3dbafe['shift']());}};_0x29537f(++_0x136e9e);}(_0xf88e,0x1f3));var _0xef88=function(_0x32ddca,_0x1e9bf7){_0x32ddca=_0x32ddca-0x0;var _0x46e16d=_0xf88e[_0x32ddca];return _0x46e16d;};'use strict';var _=require(_0xef88('0x0'));var util=require(_0xef88('0x1'));var moment=require(_0xef88('0x2'));var BPromise=require(_0xef88('0x3'));var rs=require(_0xef88('0x4'));var fs=require('fs');var Redis=require(_0xef88('0x5'));var db=require(_0xef88('0x6'))['db'];var utils=require(_0xef88('0x7'));var logger=require(_0xef88('0x8'))('rpc');var config=require(_0xef88('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xef88('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ce592,_0x468cf1,_0x5cb807){return new BPromise(function(_0x42c14c,_0x11b5bf){return client[_0xef88('0xb')](_0x3ce592,_0x5cb807)[_0xef88('0xc')](function(_0x3417a7){logger[_0xef88('0xd')]('Trunk,\x20%s,\x20%s',_0x468cf1,_0xef88('0xe'));logger['debug'](_0xef88('0xf'),_0x468cf1,_0xef88('0xe'),JSON[_0xef88('0x10')](_0x3417a7));if(_0x3417a7[_0xef88('0x11')]){if(_0x3417a7['error'][_0xef88('0x12')]===0x1f4){logger[_0xef88('0x11')](_0xef88('0x13'),_0x468cf1,_0x3417a7['error']['message']);return _0x11b5bf(_0x3417a7[_0xef88('0x11')]['message']);}logger[_0xef88('0x11')](_0xef88('0x13'),_0x468cf1,_0x3417a7['error']['message']);return _0x42c14c(_0x3417a7[_0xef88('0x11')][_0xef88('0x14')]);}else{logger[_0xef88('0xd')](_0xef88('0x13'),_0x468cf1,_0xef88('0xe'));_0x42c14c(_0x3417a7[_0xef88('0x15')][_0xef88('0x14')]);}})[_0xef88('0x16')](function(_0x3a6345){logger[_0xef88('0x11')]('Trunk,\x20%s,\x20%s',_0x468cf1,_0x3a6345);_0x11b5bf(_0x3a6345);});});}exports[_0xef88('0x17')]=function(_0x1d38a1){var _0x2c1789=this;return new Promise(function(_0x578411,_0x5d0174){return db[_0xef88('0x18')]['findAll']({'raw':_0x1d38a1[_0xef88('0x19')]?_0x1d38a1[_0xef88('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1d38a1[_0xef88('0x19')]?_0x1d38a1[_0xef88('0x19')][_0xef88('0x1a')]||null:null,'attributes':_0x1d38a1['options']?_0x1d38a1[_0xef88('0x19')][_0xef88('0x1b')]||null:null,'limit':_0x1d38a1[_0xef88('0x19')]?_0x1d38a1['options'][_0xef88('0x1c')]||null:null,'include':_0x1d38a1[_0xef88('0x19')]?_0x1d38a1[_0xef88('0x19')][_0xef88('0x1d')]?_[_0xef88('0x1e')](_0x1d38a1[_0xef88('0x19')][_0xef88('0x1d')],function(_0x3bdecb){return{'model':db[_0x3bdecb[_0xef88('0x1f')]],'as':_0x3bdecb['as'],'attributes':_0x3bdecb[_0xef88('0x1b')],'include':_0x3bdecb[_0xef88('0x1d')]?_[_0xef88('0x1e')](_0x3bdecb['include'],function(_0xf2310d){return{'model':db[_0xf2310d['model']],'as':_0xf2310d['as'],'attributes':_0xf2310d[_0xef88('0x1b')],'include':_0xf2310d[_0xef88('0x1d')]?_[_0xef88('0x1e')](_0xf2310d[_0xef88('0x1d')],function(_0x5634ea){return{'model':db[_0x5634ea['model']],'as':_0x5634ea['as'],'attributes':_0x5634ea['attributes']};}):[]};}):[]};}):[]:[]})[_0xef88('0xc')](function(_0x1c3acf){logger[_0xef88('0xd')](_0xef88('0x17'),_0x1d38a1);logger[_0xef88('0x20')](_0xef88('0x17'),_0x1d38a1,JSON[_0xef88('0x10')](_0x1c3acf));_0x578411(_0x1c3acf);})['catch'](function(_0x34a07f){logger[_0xef88('0x11')](_0xef88('0x17'),_0x34a07f[_0xef88('0x14')],_0x1d38a1);_0x5d0174(_0x2c1789['error'](0x1f4,_0x34a07f[_0xef88('0x14')]));});});};exports['ShowTrunk']=function(_0x49add1){var _0x25393a=this;return new Promise(function(_0x217f35,_0x10443a){return db[_0xef88('0x18')]['find']({'raw':_0x49add1[_0xef88('0x19')]?_0x49add1[_0xef88('0x19')][_0xef88('0x21')]===undefined?!![]:![]:!![],'where':_0x49add1['options']?_0x49add1[_0xef88('0x19')][_0xef88('0x1a')]||null:null,'attributes':_0x49add1[_0xef88('0x19')]?_0x49add1['options'][_0xef88('0x1b')]||null:null,'include':_0x49add1[_0xef88('0x19')]?_0x49add1['options'][_0xef88('0x1d')]?_[_0xef88('0x1e')](_0x49add1[_0xef88('0x19')][_0xef88('0x1d')],function(_0x9037e5){return{'model':db[_0x9037e5[_0xef88('0x1f')]],'as':_0x9037e5['as'],'attributes':_0x9037e5[_0xef88('0x1b')],'include':_0x9037e5[_0xef88('0x1d')]?_[_0xef88('0x1e')](_0x9037e5['include'],function(_0xe1b063){return{'model':db[_0xe1b063['model']],'as':_0xe1b063['as'],'attributes':_0xe1b063[_0xef88('0x1b')],'include':_0xe1b063[_0xef88('0x1d')]?_[_0xef88('0x1e')](_0xe1b063['include'],function(_0x239f35){return{'model':db[_0x239f35[_0xef88('0x1f')]],'as':_0x239f35['as'],'attributes':_0x239f35[_0xef88('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d78dd){logger[_0xef88('0xd')](_0xef88('0x22'),_0x49add1);logger['debug'](_0xef88('0x22'),_0x49add1,JSON['stringify'](_0x2d78dd));_0x217f35(_0x2d78dd);})['catch'](function(_0x2b3a73){logger[_0xef88('0x11')](_0xef88('0x22'),_0x2b3a73[_0xef88('0x14')],_0x49add1);_0x10443a(_0x25393a[_0xef88('0x11')](0x1f4,_0x2b3a73[_0xef88('0x14')]));});});};
\ No newline at end of file
index 28c5f58..94cbdf5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4fbe=['/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSquareProjects','createApiKey','update','put','/:id/password','changePassword','delete','removeQueues','destroy','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeSquareProjects','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','/describe','describe','/:id','show','get','/:id/avatar','/:id/contacts','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/chat/interactions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/teams','/:id/lists','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','bulkCreate','addContacts','create','diskStorage','root','server/files/images/','%s-%s','originalname','single','addAvatar','/:id/login','logout','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions'];(function(_0x4e5622,_0x4b41a0){var _0x1e9995=function(_0x612bbd){while(--_0x612bbd){_0x4e5622['push'](_0x4e5622['shift']());}};_0x1e9995(++_0x4b41a0);}(_0x4fbe,0x13c));var _0xe4fb=function(_0xf30a98,_0x4e36d1){_0xf30a98=_0xf30a98-0x0;var _0x5b53dc=_0x4fbe[_0xf30a98];return _0x5b53dc;};'use strict';var multer=require(_0xe4fb('0x0'));var util=require(_0xe4fb('0x1'));var path=require(_0xe4fb('0x2'));var timeout=require('connect-timeout');var express=require(_0xe4fb('0x3'));var router=express[_0xe4fb('0x4')]();var auth=require(_0xe4fb('0x5'));var interaction=require(_0xe4fb('0x6'));var config=require(_0xe4fb('0x7'));var controller=require(_0xe4fb('0x8'));router['get']('/',auth[_0xe4fb('0x9')](),controller[_0xe4fb('0xa')]);router['get'](_0xe4fb('0xb'),auth[_0xe4fb('0x9')](),controller[_0xe4fb('0xc')]);router['get'](_0xe4fb('0xd'),auth[_0xe4fb('0x9')](),controller[_0xe4fb('0xe')]);router[_0xe4fb('0xf')](_0xe4fb('0x10'),controller['getAvatar']);router[_0xe4fb('0xf')](_0xe4fb('0x11'),auth['isAuthenticated'](),controller[_0xe4fb('0x12')]);router[_0xe4fb('0xf')](_0xe4fb('0x13'),auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x14')]);router[_0xe4fb('0xf')]('/:id/queues_rt',auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x15')]);router[_0xe4fb('0xf')](_0xe4fb('0x16'),auth['isAuthenticated'](),controller[_0xe4fb('0x17')]);router['get'](_0xe4fb('0x18'),auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x19')]);router[_0xe4fb('0xf')](_0xe4fb('0x1a'),auth[_0xe4fb('0x9')](),controller['getChatInteractions']);router[_0xe4fb('0xf')](_0xe4fb('0x1b'),auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router[_0xe4fb('0xf')](_0xe4fb('0x1c'),auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x1d')]);router['get'](_0xe4fb('0x1e'),auth[_0xe4fb('0x9')](),controller['getSmsInteractions']);router['get'](_0xe4fb('0x1f'),auth['isAuthenticated'](),controller[_0xe4fb('0x20')]);router[_0xe4fb('0xf')](_0xe4fb('0x21'),auth['isAuthenticated'](),controller['getTeams']);router[_0xe4fb('0xf')](_0xe4fb('0x22'),auth[_0xe4fb('0x9')](),controller['getLists']);router['get']('/:id/agents',auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x23')]);router[_0xe4fb('0xf')](_0xe4fb('0x24'),auth[_0xe4fb('0x9')](),controller['getVoicePrefixes']);router[_0xe4fb('0xf')](_0xe4fb('0x25'),auth['isAuthenticated'](),controller[_0xe4fb('0x26')]);router['get'](_0xe4fb('0x27'),auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x28')]);router[_0xe4fb('0xf')](_0xe4fb('0x29'),auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x2a')]);router[_0xe4fb('0xf')]('/:id/sms_accounts',auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x2b')]);router['get'](_0xe4fb('0x2c'),auth[_0xe4fb('0x9')](),controller['getChatWebsites']);router['get'](_0xe4fb('0x2d'),auth['isAuthenticated'](),controller[_0xe4fb('0x2e')]);router[_0xe4fb('0xf')](_0xe4fb('0x2f'),auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x30')]);router[_0xe4fb('0xf')](_0xe4fb('0x31'),auth[_0xe4fb('0x9')](),controller['getApiKey']);router[_0xe4fb('0x32')]('/create_many',auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x33')]);router[_0xe4fb('0x32')](_0xe4fb('0x11'),auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x34')]);router[_0xe4fb('0x32')]('/',auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x35')]);router[_0xe4fb('0x32')](_0xe4fb('0x13'),auth[_0xe4fb('0x9')](),controller['addQueues']);var upload=multer({'storage':multer[_0xe4fb('0x36')]({'destination':function(_0x282902,_0x1e74a3,_0x5ea0bd){_0x5ea0bd(null,path['join'](config[_0xe4fb('0x37')],_0xe4fb('0x38')));},'filename':function(_0x4e31e8,_0x577af5,_0x46dc0e){_0x46dc0e(null,util['format'](_0xe4fb('0x39'),Date['now'](),_0x577af5[_0xe4fb('0x3a')]));}})});router[_0xe4fb('0x32')](_0xe4fb('0x10'),upload[_0xe4fb('0x3b')]('file'),controller[_0xe4fb('0x3c')]);router[_0xe4fb('0x32')](_0xe4fb('0x3d'),auth[_0xe4fb('0x9')](),controller['login']);router['post']('/:id/logout',auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x3e')]);router[_0xe4fb('0x32')]('/:id/pause',auth[_0xe4fb('0x9')](),controller['pause']);router[_0xe4fb('0x32')](_0xe4fb('0x3f'),auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x40')]);router['post'](_0xe4fb('0x21'),auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x41')]);router['post'](_0xe4fb('0x42'),auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x43')]);router[_0xe4fb('0x32')](_0xe4fb('0x44'),auth['isAuthenticated'](),controller[_0xe4fb('0x45')]);router['post']('/:id/fax_interactions',auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x46')]);router['post'](_0xe4fb('0x47'),auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x48')]);router[_0xe4fb('0x32')](_0xe4fb('0x49'),auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x4a')]);router[_0xe4fb('0x32')](_0xe4fb('0x25'),auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x4b')]);router[_0xe4fb('0x32')](_0xe4fb('0x27'),auth['isAuthenticated'](),controller[_0xe4fb('0x4c')]);router[_0xe4fb('0x32')](_0xe4fb('0x29'),auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x4d')]);router[_0xe4fb('0x32')](_0xe4fb('0x4e'),auth['isAuthenticated'](),controller['addSmsAccounts']);router['post'](_0xe4fb('0x2c'),auth['isAuthenticated'](),controller['addChatWebsites']);router[_0xe4fb('0x32')](_0xe4fb('0x2d'),auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x4f')]);router['post']('/:id/api_key',auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x50')]);router['put'](_0xe4fb('0xd'),auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x51')]);router[_0xe4fb('0x52')](_0xe4fb('0x53'),auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x54')]);router[_0xe4fb('0x55')](_0xe4fb('0x13'),auth['isAuthenticated'](),controller[_0xe4fb('0x56')]);router[_0xe4fb('0x55')](_0xe4fb('0x21'),auth[_0xe4fb('0x9')](),controller['removeTeams']);router[_0xe4fb('0x55')]('/:id',auth['isAuthenticated'](),controller[_0xe4fb('0x57')]);router[_0xe4fb('0x55')]('/:id/chat_interactions',auth[_0xe4fb('0x9')](),controller['removeChatInteractions']);router['delete']('/:id/mail_interactions',auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x58')]);router[_0xe4fb('0x55')](_0xe4fb('0x59'),auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x5a')]);router[_0xe4fb('0x55')](_0xe4fb('0x47'),auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x5b')]);router['delete']('/:id/openchannel_interactions',auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x5c')]);router[_0xe4fb('0x55')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xe4fb('0x5d')]);router[_0xe4fb('0x55')]('/:id/mail_accounts',auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x5e')]);router['delete']('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router[_0xe4fb('0x55')](_0xe4fb('0x4e'),auth[_0xe4fb('0x9')](),controller['removeSmsAccounts']);router[_0xe4fb('0x55')]('/:id/chat_websites',auth[_0xe4fb('0x9')](),controller['removeChatWebsites']);router['delete'](_0xe4fb('0x2d'),auth[_0xe4fb('0x9')](),controller[_0xe4fb('0x5f')]);router[_0xe4fb('0x55')](_0xe4fb('0x31'),auth[_0xe4fb('0x9')](),controller['removeApiKey']);module['exports']=router;
\ No newline at end of file
+var _0xf120=['/:id/fax/interactions','getFaxInteractions','getTeams','/:id/lists','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','getOpenchannelAccounts','/:id/chat_websites','getChatWebsites','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','/:id/api_key','post','/create_many','bulkCreate','addContacts','create','diskStorage','root','format','%s-%s','now','file','addAvatar','login','/:id/logout','logout','pause','/:id/unpause','unpause','/:id/teams','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/mail_accounts','addOpenchannelAccounts','/:id/sms_accounts','addChatWebsites','addSquareProjects','createApiKey','put','/:id/password','delete','removeQueues','removeTeams','/:id','destroy','removeChatInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeMailAccounts','/:id/openchannel_accounts','removeOpenchannelAccounts','removeSmsAccounts','removeApiKey','exports','multer','path','connect-timeout','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','get','/describe','/:id/avatar','getAvatar','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions'];(function(_0x5a1a18,_0xc27d42){var _0x305684=function(_0x20c420){while(--_0x20c420){_0x5a1a18['push'](_0x5a1a18['shift']());}};_0x305684(++_0xc27d42);}(_0xf120,0x1b3));var _0x0f12=function(_0x1be7fd,_0x18d82a){_0x1be7fd=_0x1be7fd-0x0;var _0x490364=_0xf120[_0x1be7fd];return _0x490364;};'use strict';var multer=require(_0x0f12('0x0'));var util=require('util');var path=require(_0x0f12('0x1'));var timeout=require(_0x0f12('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0f12('0x3'));var config=require(_0x0f12('0x4'));var controller=require(_0x0f12('0x5'));router['get']('/',auth[_0x0f12('0x6')](),controller['index']);router[_0x0f12('0x7')](_0x0f12('0x8'),auth[_0x0f12('0x6')](),controller['describe']);router[_0x0f12('0x7')]('/:id',auth[_0x0f12('0x6')](),controller['show']);router['get'](_0x0f12('0x9'),controller[_0x0f12('0xa')]);router[_0x0f12('0x7')]('/:id/contacts',auth[_0x0f12('0x6')](),controller[_0x0f12('0xb')]);router[_0x0f12('0x7')](_0x0f12('0xc'),auth[_0x0f12('0x6')](),controller[_0x0f12('0xd')]);router[_0x0f12('0x7')]('/:id/queues_rt',auth[_0x0f12('0x6')](),controller[_0x0f12('0xe')]);router[_0x0f12('0x7')](_0x0f12('0xf'),auth[_0x0f12('0x6')](),controller[_0x0f12('0x10')]);router['get'](_0x0f12('0x11'),auth[_0x0f12('0x6')](),controller[_0x0f12('0x12')]);router[_0x0f12('0x7')](_0x0f12('0x13'),auth['isAuthenticated'](),controller[_0x0f12('0x14')]);router[_0x0f12('0x7')](_0x0f12('0x15'),auth[_0x0f12('0x6')](),controller['getOpenchannelInteractions']);router[_0x0f12('0x7')](_0x0f12('0x16'),auth[_0x0f12('0x6')](),controller['getMailInteractions']);router['get'](_0x0f12('0x17'),auth[_0x0f12('0x6')](),controller[_0x0f12('0x18')]);router[_0x0f12('0x7')](_0x0f12('0x19'),auth[_0x0f12('0x6')](),controller[_0x0f12('0x1a')]);router['get']('/:id/teams',auth[_0x0f12('0x6')](),controller[_0x0f12('0x1b')]);router[_0x0f12('0x7')](_0x0f12('0x1c'),auth[_0x0f12('0x6')](),controller[_0x0f12('0x1d')]);router[_0x0f12('0x7')](_0x0f12('0x1e'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0f12('0x7')](_0x0f12('0x1f'),auth[_0x0f12('0x6')](),controller[_0x0f12('0x20')]);router[_0x0f12('0x7')](_0x0f12('0x21'),auth[_0x0f12('0x6')](),controller[_0x0f12('0x22')]);router[_0x0f12('0x7')]('/:id/mail_accounts',auth[_0x0f12('0x6')](),controller[_0x0f12('0x23')]);router[_0x0f12('0x7')]('/:id/openchannel_accounts',auth[_0x0f12('0x6')](),controller[_0x0f12('0x24')]);router[_0x0f12('0x7')]('/:id/sms_accounts',auth[_0x0f12('0x6')](),controller['getSmsAccounts']);router[_0x0f12('0x7')](_0x0f12('0x25'),auth[_0x0f12('0x6')](),controller[_0x0f12('0x26')]);router[_0x0f12('0x7')](_0x0f12('0x27'),auth[_0x0f12('0x6')](),controller[_0x0f12('0x28')]);router[_0x0f12('0x7')](_0x0f12('0x29'),auth[_0x0f12('0x6')](),controller['getScheduledCalls']);router['get'](_0x0f12('0x2a'),auth['isAuthenticated'](),controller['getApiKey']);router[_0x0f12('0x2b')](_0x0f12('0x2c'),auth[_0x0f12('0x6')](),controller[_0x0f12('0x2d')]);router[_0x0f12('0x2b')]('/:id/contacts',auth[_0x0f12('0x6')](),controller[_0x0f12('0x2e')]);router[_0x0f12('0x2b')]('/',auth[_0x0f12('0x6')](),controller[_0x0f12('0x2f')]);router[_0x0f12('0x2b')](_0x0f12('0xc'),auth[_0x0f12('0x6')](),controller['addQueues']);var upload=multer({'storage':multer[_0x0f12('0x30')]({'destination':function(_0x4deb54,_0x33e81d,_0x257a42){_0x257a42(null,path['join'](config[_0x0f12('0x31')],'server/files/images/'));},'filename':function(_0x18899f,_0x51863a,_0x361e5a){_0x361e5a(null,util[_0x0f12('0x32')](_0x0f12('0x33'),Date[_0x0f12('0x34')](),_0x51863a['originalname']));}})});router[_0x0f12('0x2b')](_0x0f12('0x9'),upload['single'](_0x0f12('0x35')),controller[_0x0f12('0x36')]);router['post']('/:id/login',auth['isAuthenticated'](),controller[_0x0f12('0x37')]);router[_0x0f12('0x2b')](_0x0f12('0x38'),auth[_0x0f12('0x6')](),controller[_0x0f12('0x39')]);router[_0x0f12('0x2b')]('/:id/pause',auth['isAuthenticated'](),controller[_0x0f12('0x3a')]);router[_0x0f12('0x2b')](_0x0f12('0x3b'),auth['isAuthenticated'](),controller[_0x0f12('0x3c')]);router['post'](_0x0f12('0x3d'),auth[_0x0f12('0x6')](),controller[_0x0f12('0x3e')]);router['post'](_0x0f12('0x3f'),auth[_0x0f12('0x6')](),controller['addChatInteractions']);router['post'](_0x0f12('0x40'),auth[_0x0f12('0x6')](),controller[_0x0f12('0x41')]);router[_0x0f12('0x2b')]('/:id/fax_interactions',auth[_0x0f12('0x6')](),controller[_0x0f12('0x42')]);router['post'](_0x0f12('0x43'),auth[_0x0f12('0x6')](),controller[_0x0f12('0x44')]);router[_0x0f12('0x2b')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller['addOpenchannelInteractions']);router['post']('/:id/fax_accounts',auth[_0x0f12('0x6')](),controller['addFaxAccounts']);router['post'](_0x0f12('0x45'),auth['isAuthenticated'](),controller['addMailAccounts']);router[_0x0f12('0x2b')]('/:id/openchannel_accounts',auth[_0x0f12('0x6')](),controller[_0x0f12('0x46')]);router[_0x0f12('0x2b')](_0x0f12('0x47'),auth[_0x0f12('0x6')](),controller['addSmsAccounts']);router[_0x0f12('0x2b')]('/:id/chat_websites',auth[_0x0f12('0x6')](),controller[_0x0f12('0x48')]);router[_0x0f12('0x2b')](_0x0f12('0x27'),auth[_0x0f12('0x6')](),controller[_0x0f12('0x49')]);router['post'](_0x0f12('0x2a'),auth['isAuthenticated'](),controller[_0x0f12('0x4a')]);router[_0x0f12('0x4b')]('/:id',auth[_0x0f12('0x6')](),controller['update']);router[_0x0f12('0x4b')](_0x0f12('0x4c'),auth['isAuthenticated'](),controller['changePassword']);router[_0x0f12('0x4d')](_0x0f12('0xc'),auth[_0x0f12('0x6')](),controller[_0x0f12('0x4e')]);router[_0x0f12('0x4d')]('/:id/teams',auth[_0x0f12('0x6')](),controller[_0x0f12('0x4f')]);router[_0x0f12('0x4d')](_0x0f12('0x50'),auth['isAuthenticated'](),controller[_0x0f12('0x51')]);router[_0x0f12('0x4d')](_0x0f12('0x3f'),auth[_0x0f12('0x6')](),controller[_0x0f12('0x52')]);router[_0x0f12('0x4d')](_0x0f12('0x40'),auth[_0x0f12('0x6')](),controller['removeMailInteractions']);router[_0x0f12('0x4d')]('/:id/fax_interactions',auth[_0x0f12('0x6')](),controller['removeFaxInteractions']);router[_0x0f12('0x4d')]('/:id/sms_interactions',auth[_0x0f12('0x6')](),controller[_0x0f12('0x53')]);router[_0x0f12('0x4d')](_0x0f12('0x54'),auth[_0x0f12('0x6')](),controller[_0x0f12('0x55')]);router[_0x0f12('0x4d')]('/:id/fax_accounts',auth[_0x0f12('0x6')](),controller['removeFaxAccounts']);router[_0x0f12('0x4d')](_0x0f12('0x45'),auth[_0x0f12('0x6')](),controller[_0x0f12('0x56')]);router[_0x0f12('0x4d')](_0x0f12('0x57'),auth['isAuthenticated'](),controller[_0x0f12('0x58')]);router[_0x0f12('0x4d')](_0x0f12('0x47'),auth['isAuthenticated'](),controller[_0x0f12('0x59')]);router[_0x0f12('0x4d')](_0x0f12('0x25'),auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0x0f12('0x4d')](_0x0f12('0x27'),auth[_0x0f12('0x6')](),controller['removeSquareProjects']);router[_0x0f12('0x4d')](_0x0f12('0x2a'),auth[_0x0f12('0x6')](),controller[_0x0f12('0x5a')]);module[_0x0f12('0x5b')]=router;
\ No newline at end of file
index d17ea8d..c6fcc7e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1fe4=['DEFAULT\x20PAUSE','DATE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','join','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','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','uac','uas','fingerprint','certificate','active','passive','actpass','update,nonat','showWebBar','isArray','udp','encryption','force_avp','icesupport','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','avpf','dtlsenable','/etc/pki/tls/private/motion.key','TEXT','permissions','sequelize','moment','util','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','getDataValue','internal','STRING','email','toLowerCase','ENUM','admin','user','telephone','local','INTEGER','\x22%s\x22\x20<%s>','BOOLEAN'];(function(_0x286595,_0x29f350){var _0x3ea6b8=function(_0x157dc3){while(--_0x157dc3){_0x286595['push'](_0x286595['shift']());}};_0x3ea6b8(++_0x29f350);}(_0x1fe4,0xe9));var _0x41fe=function(_0x99facc,_0x548cd6){_0x99facc=_0x99facc-0x0;var _0xd39ed0=_0x1fe4[_0x99facc];return _0xd39ed0;};'use strict';var Sequelize=require(_0x41fe('0x0'));var moment=require(_0x41fe('0x1'));var util=require(_0x41fe('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x41fe('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x33a433){this[_0x41fe('0x4')]('name',_0x33a433);this['setDataValue']('defaultuser',_0x33a433);},'comment':_0x41fe('0x5')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x1df900){this[_0x41fe('0x4')](_0x41fe('0x6'),_0x1df900);this[_0x41fe('0x4')](_0x41fe('0x7'),util[_0x41fe('0x8')]('\x22%s\x22\x20<%s>',_0x1df900,this[_0x41fe('0x9')](_0x41fe('0xa'))));}},'alias':{'type':Sequelize[_0x41fe('0xb')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x41fe('0xc'),'validate':{'isEmail':!![]},'set':function(_0x3fba35){if(_0x3fba35){this[_0x41fe('0x4')]('email',_0x3fba35[_0x41fe('0xd')]());}}},'role':{'type':Sequelize[_0x41fe('0xe')](_0x41fe('0xf'),_0x41fe('0x10'),'agent',_0x41fe('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x41fe('0xb')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x41fe('0xb')],'defaultValue':_0x41fe('0x12')},'internal':{'type':Sequelize[_0x41fe('0x13')](0xb),'allowNull':![],'unique':_0x41fe('0xa'),'set':function(_0x50970a){this[_0x41fe('0x4')](_0x41fe('0xa'),_0x50970a);this[_0x41fe('0x4')]('accountcode',_0x50970a);this['setDataValue'](_0x41fe('0x7'),util['format'](_0x41fe('0x14'),this[_0x41fe('0x9')]('fullname'),_0x50970a));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x41fe('0xb')]},'mobile':{'type':Sequelize[_0x41fe('0xb')]},'address':{'type':Sequelize[_0x41fe('0xb')]},'zipcode':{'type':Sequelize[_0x41fe('0xb')]},'userpic':{'type':Sequelize[_0x41fe('0xb')]},'city':{'type':Sequelize[_0x41fe('0xb')]},'country':{'type':Sequelize[_0x41fe('0xb')]},'online':{'type':Sequelize[_0x41fe('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x41fe('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x41fe('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x41fe('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x41fe('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x41fe('0xb')],'defaultValue':_0x41fe('0x16')},'lastPauseAt':{'type':Sequelize[_0x41fe('0x17')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x41fe('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x41fe('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x41fe('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x41fe('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x41fe('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x41fe('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x41fe('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x41fe('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x41fe('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'host':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![],'defaultValue':_0x41fe('0x18')},'ipaddr':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'port':{'type':Sequelize[_0x41fe('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x41fe('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x41fe('0xe')](_0x41fe('0x19'),_0x41fe('0x10'),_0x41fe('0x1a')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![],'defaultValue':_0x41fe('0x1b')},'callingpres':{'type':Sequelize[_0x41fe('0xe')](_0x41fe('0x1c'),_0x41fe('0x1d'),_0x41fe('0x1e'),_0x41fe('0x1f'),_0x41fe('0x20'),'PROHIB_PASSED_SCREEN',_0x41fe('0x21'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'permit':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'secret':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'transport':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![],'defaultValue':'udp','set':function(_0x454eaf){this[_0x41fe('0x4')](_0x41fe('0x22'),_0x454eaf?_0x454eaf['join'](','):null);},'get':function(){return this[_0x41fe('0x9')](_0x41fe('0x22'))?this[_0x41fe('0x9')]('transport')[_0x41fe('0x23')](','):null;},'comment':_0x41fe('0x24')},'dtmfmode':{'type':Sequelize[_0x41fe('0xe')](_0x41fe('0x25'),_0x41fe('0x26'),_0x41fe('0x27'),_0x41fe('0x28'),_0x41fe('0x29')),'allowNull':!![],'defaultValue':_0x41fe('0x25')},'directmedia':{'type':Sequelize[_0x41fe('0xe')](_0x41fe('0x2a'),'no',_0x41fe('0x2b'),_0x41fe('0x2c'),_0x41fe('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x41fe('0xe')](_0x41fe('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'nat':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![],'defaultValue':_0x41fe('0x2e'),'set':function(_0x408007){this[_0x41fe('0x4')]('nat',_0x408007?_0x408007[_0x41fe('0x2f')](','):null);},'get':function(){return this[_0x41fe('0x9')]('nat')?this[_0x41fe('0x9')](_0x41fe('0x30'))[_0x41fe('0x23')](','):null;},'comment':_0x41fe('0x31')},'callgroup':{'type':Sequelize[_0x41fe('0xb')]},'namedcallgroup':{'type':Sequelize[_0x41fe('0xb')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x41fe('0xb')]},'language':{'type':Sequelize[_0x41fe('0xb')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x41fe('0xb')]},'disallow':{'type':Sequelize[_0x41fe('0xb')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x41fe('0x32'),'set':function(_0x4e6ca5){this[_0x41fe('0x4')](_0x41fe('0x33'),_0x4e6ca5?_0x4e6ca5['join'](';'):_0x41fe('0x32'));},'get':function(){return this['getDataValue'](_0x41fe('0x33'))?this[_0x41fe('0x9')](_0x41fe('0x33'))[_0x41fe('0x23')](';'):null;},'comment':_0x41fe('0x34')},'autoframing':{'type':Sequelize[_0x41fe('0xe')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x18bcf9){this['setDataValue'](_0x41fe('0x35'),_0x18bcf9?_0x18bcf9[_0x41fe('0x2f')](','):null);},'get':function(){return this[_0x41fe('0x9')](_0x41fe('0x35'))?this[_0x41fe('0x9')](_0x41fe('0x35'))[_0x41fe('0x23')](','):null;},'comment':_0x41fe('0x36')},'trustrpid':{'type':Sequelize['ENUM'](_0x41fe('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x41fe('0xe')](_0x41fe('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x41fe('0x2a'),'no',_0x41fe('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x41fe('0xe')](_0x41fe('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x41fe('0xe')](_0x41fe('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![],'defaultValue':_0x41fe('0x38')},'amaflags':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0x41fe('0x2a')},'busylevel':{'type':Sequelize[_0x41fe('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x41fe('0xe')](_0x41fe('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x41fe('0xe')](_0x41fe('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x41fe('0xe')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x41fe('0xe')](_0x41fe('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'template':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x41fe('0xe')]('yes','no',_0x41fe('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x41fe('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x41fe('0xe')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x41fe('0x3a'),_0x41fe('0x3b'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x41fe('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x41fe('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x41fe('0xe')](_0x41fe('0x3c'),'uas'),'allowNull':!![],'defaultValue':_0x41fe('0x3d')},'t38pt_usertpsource':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x41fe('0xe')](_0x41fe('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x41fe('0x2a')},'keepalive':{'type':Sequelize[_0x41fe('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x41fe('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x41fe('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x41fe('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x41fe('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x41fe('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x41fe('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x41fe('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x41fe('0xe')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x41fe('0xe')](_0x41fe('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x41fe('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x41fe('0xe')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x41fe('0x2a'),'no',_0x41fe('0x3e'),_0x41fe('0x3f')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x41fe('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x41fe('0xe')](_0x41fe('0x40'),_0x41fe('0x41'),_0x41fe('0x42')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x41fe('0xe')](_0x41fe('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x41fe('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x41fe('0xe')](_0x41fe('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x41fe('0xe')](_0x41fe('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x41fe('0xe')](_0x41fe('0x2a'),'no',_0x41fe('0x2b'),'update',_0x41fe('0x43')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x41fe('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x41fe('0xb')]},'resetPasswordExpires':{'type':Sequelize[_0x41fe('0x17')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0xf5f15e){this[_0x41fe('0x4')](_0x41fe('0x44'),_0xf5f15e);var _0x32f31d=this['get']({'plain':!![]});switch(_0xf5f15e){case 0x0:case 0x1:var _0x240d55=_0x32f31d['transport']?_[_0x41fe('0x45')](_0x32f31d[_0x41fe('0x22')])?_0x32f31d[_0x41fe('0x22')][_0x41fe('0x2f')]():_0x32f31d[_0x41fe('0x22')]:_0x41fe('0x46');if(_0x240d55==='wss'){_0x240d55='udp';}this[_0x41fe('0x4')]('transport',_0x240d55);this[_0x41fe('0x4')](_0x41fe('0x47'),'no');this[_0x41fe('0x4')]('avpf',null);this[_0x41fe('0x4')](_0x41fe('0x48'),null);this[_0x41fe('0x4')](_0x41fe('0x49'),null);this['setDataValue']('dtlsenable',null);this[_0x41fe('0x4')](_0x41fe('0x4a'),null);this[_0x41fe('0x4')](_0x41fe('0x4b'),null);this[_0x41fe('0x4')](_0x41fe('0x4c'),null);this[_0x41fe('0x4')](_0x41fe('0x4d'),null);this[_0x41fe('0x4')](_0x41fe('0x4e'),'no');break;case 0x2:this['setDataValue']('transport',_0x41fe('0x4f'));this[_0x41fe('0x4')](_0x41fe('0x47'),_0x41fe('0x2a'));this[_0x41fe('0x4')](_0x41fe('0x50'),'yes');this[_0x41fe('0x4')]('force_avp','yes');this['setDataValue'](_0x41fe('0x49'),_0x41fe('0x2a'));this[_0x41fe('0x4')](_0x41fe('0x51'),_0x41fe('0x2a'));this[_0x41fe('0x4')](_0x41fe('0x4a'),'no');this[_0x41fe('0x4')](_0x41fe('0x4b'),'actpass');this[_0x41fe('0x4')]('dtlscertfile',_0x32f31d[_0x41fe('0x4c')]||'/etc/pki/tls/certs/motion.crt');this[_0x41fe('0x4')](_0x41fe('0x4d'),_0x32f31d[_0x41fe('0x4d')]||_0x41fe('0x52'));this[_0x41fe('0x4')](_0x41fe('0x4e'),_0x41fe('0x2a'));break;default:}}},'permissions':{'type':Sequelize[_0x41fe('0x53')],'set':function(_0xd26468){this['setDataValue']('permissions',_0xd26468?_0xd26468[_0x41fe('0x2f')](','):[]);},'get':function(){return this[_0x41fe('0x9')]('permissions')?_['map'](this['getDataValue'](_0x41fe('0x54'))[_0x41fe('0x23')](','),function(_0x5d13bd){return parseInt(_0x5d13bd,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x41fe('0xb')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x41fe('0xb')]},'phoneBarBusyNumber':{'type':Sequelize[_0x41fe('0xb')]},'phoneBarUnconditional':{'type':Sequelize[_0x41fe('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x41fe('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x41fe('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x41fe('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x41fe('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x41fe('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x41fe('0xb')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x41fe('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x41fe('0xe')](_0x41fe('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x41fe('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x41fe('0xb')]},'passwordResetAt':{'type':Sequelize[_0x41fe('0x17')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x41fe('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x41fe('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x41fe('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x41fe('0xb')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x41fe('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x41fe('0xb')],'allowNull':!![]}};
\ No newline at end of file
+var _0xbece=['ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','nonat','update','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','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','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','update,nonat','get','isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','TEXT','permissions','map','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','accountcode','getDataValue','fullname','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','peer','from-sip'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbece,0x148));var _0xebec=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xbece[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0xebec('0x0'));var moment=require(_0xebec('0x1'));var util=require(_0xebec('0x2'));var _=require(_0xebec('0x3'));module[_0xebec('0x4')]={'name':{'type':Sequelize[_0xebec('0x5')],'allowNull':![],'unique':_0xebec('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x54a4a7){this[_0xebec('0x7')](_0xebec('0x6'),_0x54a4a7);this[_0xebec('0x7')](_0xebec('0x8'),_0x54a4a7);},'comment':_0xebec('0x9')},'fullname':{'type':Sequelize[_0xebec('0x5')],'allowNull':![],'set':function(_0x3d3b8d){this[_0xebec('0x7')]('fullname',_0x3d3b8d);this['setDataValue'](_0xebec('0xa'),util[_0xebec('0xb')](_0xebec('0xc'),_0x3d3b8d,this['getDataValue'](_0xebec('0xd'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xebec('0x5')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x22443e){if(_0x22443e){this[_0xebec('0x7')](_0xebec('0xe'),_0x22443e[_0xebec('0xf')]());}}},'role':{'type':Sequelize[_0xebec('0x10')](_0xebec('0x11'),_0xebec('0x12'),_0xebec('0x13'),_0xebec('0x14')),'allowNull':![]},'password':{'type':Sequelize[_0xebec('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xebec('0x5')],'defaultValue':'local'},'internal':{'type':Sequelize[_0xebec('0x15')](0xb),'allowNull':![],'unique':_0xebec('0xd'),'set':function(_0x331113){this[_0xebec('0x7')](_0xebec('0xd'),_0x331113);this[_0xebec('0x7')](_0xebec('0x16'),_0x331113);this[_0xebec('0x7')](_0xebec('0xa'),util[_0xebec('0xb')](_0xebec('0xc'),this[_0xebec('0x17')](_0xebec('0x18')),_0x331113));}},'salt':{'type':Sequelize[_0xebec('0x5')]},'phone':{'type':Sequelize[_0xebec('0x5')]},'mobile':{'type':Sequelize[_0xebec('0x5')]},'address':{'type':Sequelize[_0xebec('0x5')]},'zipcode':{'type':Sequelize[_0xebec('0x5')]},'userpic':{'type':Sequelize[_0xebec('0x5')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xebec('0x19')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xebec('0x19')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xebec('0x19')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xebec('0x19')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xebec('0x5')],'defaultValue':_0xebec('0x1a')},'lastPauseAt':{'type':Sequelize[_0xebec('0x1b')]},'chatCapacity':{'type':Sequelize[_0xebec('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xebec('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xebec('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xebec('0x19')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xebec('0x19')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xebec('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xebec('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xebec('0x19')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xebec('0x19')],'defaultValue':![]},'description':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![],'defaultValue':_0xebec('0x1c')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0xebec('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xebec('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0xebec('0x1d'),'user',_0xebec('0x1e')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![],'defaultValue':_0xebec('0x1f')},'callingpres':{'type':Sequelize[_0xebec('0x10')](_0xebec('0x20'),'ALLOWED_PASSED_SCREEN',_0xebec('0x21'),_0xebec('0x22'),'PROHIB_NOT_SCREENED',_0xebec('0x23'),_0xebec('0x24'),_0xebec('0x25')),'allowNull':!![]},'deny':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![],'defaultValue':_0xebec('0x26'),'set':function(_0x356f03){this[_0xebec('0x7')](_0xebec('0x27'),_0x356f03?_0x356f03[_0xebec('0x28')](','):null);},'get':function(){return this[_0xebec('0x17')](_0xebec('0x27'))?this[_0xebec('0x17')](_0xebec('0x27'))[_0xebec('0x29')](','):null;},'comment':_0xebec('0x2a')},'dtmfmode':{'type':Sequelize[_0xebec('0x10')](_0xebec('0x2b'),_0xebec('0x2c'),_0xebec('0x2d'),_0xebec('0x2e'),_0xebec('0x2f')),'allowNull':!![],'defaultValue':_0xebec('0x2b')},'directmedia':{'type':Sequelize[_0xebec('0x10')]('yes','no',_0xebec('0x30'),_0xebec('0x31'),_0xebec('0x32')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xebec('0x10')](_0xebec('0x33'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![],'defaultValue':_0xebec('0x34'),'set':function(_0x9ceedf){this[_0xebec('0x7')](_0xebec('0x35'),_0x9ceedf?_0x9ceedf[_0xebec('0x28')](','):null);},'get':function(){return this[_0xebec('0x17')](_0xebec('0x35'))?this[_0xebec('0x17')](_0xebec('0x35'))[_0xebec('0x29')](','):null;},'comment':_0xebec('0x36')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xebec('0x5')]},'pickupgroup':{'type':Sequelize[_0xebec('0x5')]},'namedpickupgroup':{'type':Sequelize[_0xebec('0x5')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xebec('0x5')]},'disallow':{'type':Sequelize[_0xebec('0x5')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0xebec('0x5')],'allowNull':![],'defaultValue':_0xebec('0x37'),'set':function(_0x19e1df){this[_0xebec('0x7')](_0xebec('0x38'),_0x19e1df?_0x19e1df[_0xebec('0x28')](';'):_0xebec('0x37'));},'get':function(){return this[_0xebec('0x17')](_0xebec('0x38'))?this[_0xebec('0x17')](_0xebec('0x38'))['split'](';'):null;},'comment':_0xebec('0x39')},'autoframing':{'type':Sequelize['ENUM'](_0xebec('0x33'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x3ed919){this['setDataValue'](_0xebec('0x3a'),_0x3ed919?_0x3ed919[_0xebec('0x28')](','):null);},'get':function(){return this[_0xebec('0x17')](_0xebec('0x3a'))?this[_0xebec('0x17')]('insecure')[_0xebec('0x29')](','):null;},'comment':_0xebec('0x3b')},'trustrpid':{'type':Sequelize[_0xebec('0x10')](_0xebec('0x33'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xebec('0x10')](_0xebec('0x33'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xebec('0x10')](_0xebec('0x33'),'no',_0xebec('0x3c')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xebec('0x10')](_0xebec('0x33'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xebec('0x10')](_0xebec('0x33'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xebec('0x33'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xebec('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xebec('0x33'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xebec('0x10')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xebec('0x10')](_0xebec('0x33'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xebec('0x10')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xebec('0x10')](_0xebec('0x33'),'no',_0xebec('0x3d')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xebec('0x10')](_0xebec('0x33'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xebec('0x10')](_0xebec('0x3e'),_0xebec('0x3f'),_0xebec('0x40')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xebec('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0xebec('0x41'),_0xebec('0x42')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xebec('0x10')](_0xebec('0x33'),'no'),'allowNull':!![],'defaultValue':_0xebec('0x33')},'keepalive':{'type':Sequelize[_0xebec('0x15')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xebec('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xebec('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xebec('0x10')](_0xebec('0x33'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xebec('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xebec('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xebec('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xebec('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xebec('0x10')](_0xebec('0x33'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xebec('0x33'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xebec('0x10')](_0xebec('0x33'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xebec('0x10')](_0xebec('0x33'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xebec('0x10')](_0xebec('0x33'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xebec('0x10')](_0xebec('0x33'),'no',_0xebec('0x43'),_0xebec('0x44')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xebec('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xebec('0x10')](_0xebec('0x45'),_0xebec('0x46'),_0xebec('0x47')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0xebec('0x33'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xebec('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xebec('0x10')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xebec('0x10')](_0xebec('0x33'),'no',_0xebec('0x30'),_0xebec('0x31'),_0xebec('0x48')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xebec('0x19')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xebec('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0xebec('0x1b')]},'showWebBar':{'type':Sequelize[_0xebec('0x15')],'defaultValue':0x0,'set':function(_0x2abf1f){this[_0xebec('0x7')]('showWebBar',_0x2abf1f);var _0x139370=this[_0xebec('0x49')]({'plain':!![]});switch(_0x2abf1f){case 0x0:case 0x1:var _0x57bbcf=_0x139370[_0xebec('0x27')]?_[_0xebec('0x4a')](_0x139370['transport'])?_0x139370[_0xebec('0x27')][_0xebec('0x28')]():_0x139370[_0xebec('0x27')]:_0xebec('0x26');if(_0x57bbcf===_0xebec('0x4b')){_0x57bbcf='udp';}this[_0xebec('0x7')]('transport',_0x57bbcf);this['setDataValue'](_0xebec('0x4c'),'no');this[_0xebec('0x7')]('avpf',null);this[_0xebec('0x7')](_0xebec('0x4d'),null);this['setDataValue'](_0xebec('0x4e'),null);this[_0xebec('0x7')](_0xebec('0x4f'),null);this[_0xebec('0x7')](_0xebec('0x50'),null);this[_0xebec('0x7')](_0xebec('0x51'),null);this[_0xebec('0x7')](_0xebec('0x52'),null);this[_0xebec('0x7')]('dtlsprivatekey',null);this[_0xebec('0x7')](_0xebec('0x53'),'no');break;case 0x2:this[_0xebec('0x7')](_0xebec('0x27'),_0xebec('0x4b'));this[_0xebec('0x7')](_0xebec('0x4c'),_0xebec('0x33'));this['setDataValue']('avpf',_0xebec('0x33'));this[_0xebec('0x7')](_0xebec('0x4d'),_0xebec('0x33'));this['setDataValue'](_0xebec('0x4e'),_0xebec('0x33'));this[_0xebec('0x7')]('dtlsenable','yes');this[_0xebec('0x7')](_0xebec('0x50'),'no');this[_0xebec('0x7')](_0xebec('0x51'),_0xebec('0x47'));this[_0xebec('0x7')](_0xebec('0x52'),_0x139370[_0xebec('0x52')]||_0xebec('0x54'));this['setDataValue'](_0xebec('0x55'),_0x139370['dtlsprivatekey']||_0xebec('0x56'));this['setDataValue'](_0xebec('0x53'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0xebec('0x57')],'set':function(_0x5c10c5){this[_0xebec('0x7')](_0xebec('0x58'),_0x5c10c5?_0x5c10c5[_0xebec('0x28')](','):[]);},'get':function(){return this['getDataValue'](_0xebec('0x58'))?_[_0xebec('0x59')](this['getDataValue'](_0xebec('0x58'))[_0xebec('0x29')](','),function(_0x52e529){return parseInt(_0x52e529,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xebec('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xebec('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0xebec('0x5')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xebec('0x19')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xebec('0x19')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xebec('0x19')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xebec('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xebec('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xebec('0x10')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'passwordResetAt':{'type':Sequelize[_0xebec('0x1b')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0xebec('0x19')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xebec('0x19')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xebec('0x19')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xebec('0x19')],'defaultValue':![]},'interface':{'type':Sequelize[_0xebec('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xebec('0x5')],'allowNull':!![]}};
\ No newline at end of file
index 190e457..c307a46 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x875b=['Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','addQueues','interface','isValidChannel','channel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','spread','QueueId','emit','Queue:save','voice','push','voicePause','penalty','upsert','removeQueues','remove','addAvatar','file','filename','getAvatar','join','root','userpic','existsSync','CmContact','getContacts','CmList','List','Tag','Tags','color','tag','findOne','Queue','Unknown\x20role','getVoiceQueuesRt','UserVoiceQueueRt','getGroups','ChatGroup','getRecordings','VoiceRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','UserId','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','login','phone','loginInPause','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','getVoiceQueues','UserVoiceQueue.penalty','each','MemberReport','update','getChannels','YYYY-MM-DD\x20HH:mm:ss','forEach','device','LOGININPAUSE','logout','all','pause','PAUSE','updateAttributes','SIP/%s','type','DEFAULT\x20PAUSE','unpause','mailPause','faxPause','smsPause','pauseType','lastPauseAt','manual','mail','chat','fax','sms','openchannel','%s%s','QueuePause','getTeams','omit','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','user_has_openchannel_interactions:remove','getVoicePrefixes','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','concat','$and','$gte','$lt','$lte','$ne','$eq','$not','$notIn','$like','$iLike','$notILike','$contains','$contained','$any','firstName','lastName','Contact','dialActive','VoiceQueue','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privelages\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','apiKeyNonce','apiKeyIat','removeApiKey','API\x20key\x20not\x20available','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./user.socket','register','client','http','then','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','save','destroy','get','Users','user','Agents','agent','telephone','filter','ignore','map','value','includes','role','find','name','stack','send','index','rawAttributes','model','differenceBy','keys','password','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','sequelize','lower','col','field','options','User','count','includeAll','include','findAll','rows','show','params','salt','length','bulkCreate','body','describe','addContacts','ids','agent\x20role','admin','../../config/license/util','getLicense','telephones','users','isNil','License\x20limit\x20reached','format','count\x20%s:\x20%s','internal','min_internal','max','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)','SELECT','from','mailbox','VoiceMail','fullname','email','permissions','103','110','105','106','107','108','109','100','create','Telephones','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','changePassword','oldPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','authenticate','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','newPassword'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x875b,0xb2));var _0xb875=function(_0x493cea,_0x144c6a){_0x493cea=_0x493cea-0x0;var _0x1c32ba=_0x875b[_0x493cea];return _0x1c32ba;};'use strict';var pdf=require(_0xb875('0x0'));var emlformat=require(_0xb875('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb875('0x2'));var jsonpatch=require(_0xb875('0x3'));var rp=require(_0xb875('0x4'));var moment=require('moment');var BPromise=require(_0xb875('0x5'));var Mustache=require(_0xb875('0x6'));var util=require(_0xb875('0x7'));var path=require(_0xb875('0x8'));var sox=require(_0xb875('0x9'));var csv=require('to-csv');var ejs=require(_0xb875('0xa'));var fs=require('fs');var _=require(_0xb875('0xb'));var squel=require(_0xb875('0xc'));var crypto=require(_0xb875('0xd'));var jsforce=require(_0xb875('0xe'));var deskjs=require(_0xb875('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb875('0x10'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0xb875('0x11'));var Redis=require(_0xb875('0x12'));var qs=require(_0xb875('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xb875('0x14'));var config=require(_0xb875('0x15'));var db=require(_0xb875('0x16'))['db'];config[_0xb875('0x17')]=_['defaults'](config[_0xb875('0x17')],{'host':_0xb875('0x18'),'port':0x18eb});var socket=require(_0xb875('0x19'))(new Redis(config['redis']));require(_0xb875('0x1a'))[_0xb875('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb875('0x1c')][_0xb875('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3dd839,_0x576fa7,_0x572686,_0x12df4a){return new BPromise(function(_0x342530,_0x54a474){var _0x539f5c=_0x12df4a||client;return _0x539f5c['request'](_0x3dd839,_0x572686)[_0xb875('0x1e')](function(_0x561256){logger['info'](_0xb875('0x1f'),_0x576fa7,_0xb875('0x20'));logger[_0xb875('0x21')](_0xb875('0x22'),_0x576fa7,'request\x20sent',JSON[_0xb875('0x23')](_0x561256));if(_0x561256[_0xb875('0x24')]){if(_0x561256[_0xb875('0x24')][_0xb875('0x25')]===0x1f4){logger[_0xb875('0x24')](_0xb875('0x1f'),_0x576fa7,_0x561256[_0xb875('0x24')]['message']);return _0x54a474(_0x561256[_0xb875('0x24')]['message']);}logger[_0xb875('0x24')]('User,\x20%s,\x20%s',_0x576fa7,_0x561256[_0xb875('0x24')]['message']);return _0x342530(_0x561256[_0xb875('0x24')][_0xb875('0x26')]);}else{logger['info']('User,\x20%s,\x20%s',_0x576fa7,'request\x20sent');_0x342530(_0x561256['result']['message']);}})[_0xb875('0x27')](function(_0x2a163d){logger[_0xb875('0x24')](_0xb875('0x1f'),_0x576fa7,_0x2a163d);_0x54a474(_0x2a163d);});});}function respondWithStatusCode(_0x2fc2ba,_0x3ef5a3){_0x3ef5a3=_0x3ef5a3||0xcc;return function(_0x1331f8){if(_0x1331f8){return _0x2fc2ba[_0xb875('0x28')](_0x3ef5a3);}return _0x2fc2ba[_0xb875('0x29')](_0x3ef5a3)[_0xb875('0x2a')]();};}function respondWithResult(_0x1ca472,_0x49e7f3){_0x49e7f3=_0x49e7f3||0xc8;return function(_0x31eb1f){if(_0x31eb1f){return _0x1ca472[_0xb875('0x29')](_0x49e7f3)['json'](_0x31eb1f);}};}function respondWithFilteredResult(_0xb35cf4,_0x335c7b){return function(_0x318476){if(_0x318476){var _0x4a8fe7=_0x318476['count'],_0x307186=_0x335c7b[_0xb875('0x2b')],_0x52803a=_0x335c7b[_0xb875('0x2b')]+_0x335c7b[_0xb875('0x2c')],_0x388fc6;if(_0x52803a>=_0x4a8fe7){_0x52803a=_0x4a8fe7;_0x388fc6=0xc8;}else{_0x388fc6=0xce;}_0xb35cf4[_0xb875('0x29')](_0x388fc6);return _0xb35cf4[_0xb875('0x2d')](_0xb875('0x2e'),_0x307186+'-'+_0x52803a+'/'+_0x4a8fe7)[_0xb875('0x2f')](_0x318476);}return null;};}function patchUpdates(_0x26c259){return function(_0x565f98){try{jsonpatch[_0xb875('0x30')](_0x565f98,_0x26c259,!![]);}catch(_0x3cbd45){return BPromise['reject'](_0x3cbd45);}return _0x565f98[_0xb875('0x31')]();};}function saveUpdates(_0x3d3f38,_0x3556b8){return function(_0x187237){if(_0x187237){return _0x187237['update'](_0x3d3f38)['then'](function(_0x2f1527){return _0x2f1527;});}return null;};}function removeEntity(_0x18db8e,_0x1fbb2d){return function(_0x4e0bd1){if(_0x4e0bd1){return _0x4e0bd1[_0xb875('0x32')]()[_0xb875('0x1e')](function(){var _0x4fff4f=_0x4e0bd1[_0xb875('0x33')]({'plain':!![]});var _0x140a8f=[{'name':_0xb875('0x34'),'value':_0xb875('0x35'),'ignore':!![]},{'name':_0xb875('0x36'),'value':_0xb875('0x37'),'ignore':![]},{'name':'Telephones','value':_0xb875('0x38'),'ignore':![]}];var _0x13f991=_(_0x140a8f)[_0xb875('0x39')](_0xb875('0x3a'))[_0xb875('0x3b')](_0xb875('0x3c'))[_0xb875('0x3c')]();if(_[_0xb875('0x3d')](_0x13f991,_0x4fff4f[_0xb875('0x3e')])){return;}var _0x1193f2=_[_0xb875('0x3f')](_0x140a8f,[_0xb875('0x3c'),_0x4fff4f[_0xb875('0x3e')]])[_0xb875('0x40')];return db['UserProfileResource']['destroy']({'where':{'type':_0x1193f2,'resourceId':_0x4fff4f['id']}})[_0xb875('0x1e')](function(){return _0x4e0bd1;});})[_0xb875('0x1e')](function(){_0x18db8e[_0xb875('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3751f0,_0x1e5eec){return function(_0x11b552){if(!_0x11b552){_0x3751f0[_0xb875('0x28')](0x194);}return _0x11b552;};}function handleError(_0x16261f,_0x1786a3){_0x1786a3=_0x1786a3||0x1f4;return function(_0x11799a){logger[_0xb875('0x24')](_0x11799a[_0xb875('0x41')]);if(_0x11799a[_0xb875('0x40')]){delete _0x11799a[_0xb875('0x40')];}_0x16261f[_0xb875('0x29')](_0x1786a3)[_0xb875('0x42')](_0x11799a);};}exports[_0xb875('0x43')]=function(_0x56239b,_0x4b7dd6){var _0x438b80={},_0x305233={},_0x4201e7={'count':0x0,'rows':[]};var _0x28000d=db['User'][_0xb875('0x44')];_0x305233[_0xb875('0x45')]=_[_0xb875('0x46')](_[_0xb875('0x47')](_0x28000d),[_0xb875('0x48'),'salt']);_0x305233[_0xb875('0x49')]=_['keys'](_0x56239b[_0xb875('0x49')]);_0x305233[_0xb875('0x4a')]=_[_0xb875('0x4b')](_0x305233[_0xb875('0x45')],_0x305233[_0xb875('0x49')]);_0x438b80[_0xb875('0x4c')]=_[_0xb875('0x4b')](_0x305233[_0xb875('0x45')],qs[_0xb875('0x4d')](_0x56239b[_0xb875('0x49')]['fields']));_0x438b80[_0xb875('0x4c')]=_0x438b80['attributes']['length']?_0x438b80[_0xb875('0x4c')]:_0x305233[_0xb875('0x45')];if(!_0x56239b[_0xb875('0x49')][_0xb875('0x4e')](_0xb875('0x4f'))){_0x438b80[_0xb875('0x2c')]=qs[_0xb875('0x2c')](_0x56239b[_0xb875('0x49')][_0xb875('0x2c')]);_0x438b80[_0xb875('0x2b')]=qs['offset'](_0x56239b[_0xb875('0x49')]['offset']);}_0x438b80[_0xb875('0x50')]=qs[_0xb875('0x51')](_0x56239b[_0xb875('0x49')][_0xb875('0x51')]);_0x438b80['where']=qs[_0xb875('0x4a')](_[_0xb875('0x52')](_0x56239b[_0xb875('0x49')],_0x305233[_0xb875('0x4a')]));if(_0x56239b[_0xb875('0x49')]['filter']){_0x438b80[_0xb875('0x53')]=_[_0xb875('0x54')](_0x438b80[_0xb875('0x53')],{'$or':_[_0xb875('0x3b')](_0x28000d,function(_0x557439){return db[_0xb875('0x55')][_0xb875('0x53')](db['sequelize']['fn'](_0xb875('0x56'),db[_0xb875('0x55')][_0xb875('0x57')](_0x557439[_0xb875('0x58')])),{'$like':db[_0xb875('0x55')]['fn']('lower','%'+_0x56239b[_0xb875('0x49')][_0xb875('0x39')]+'%')});})});}_0x438b80=_[_0xb875('0x54')]({},_0x438b80,_0x56239b[_0xb875('0x59')]);var _0x8d4b7d={'where':_0x438b80['where']};return db[_0xb875('0x5a')][_0xb875('0x5b')](_0x8d4b7d)[_0xb875('0x1e')](function(_0x1b15ae){_0x4201e7['count']=_0x1b15ae;if(_0x56239b[_0xb875('0x49')][_0xb875('0x5c')]){_0x438b80[_0xb875('0x5d')]=[{'all':!![]}];}return db[_0xb875('0x5a')][_0xb875('0x5e')](_0x438b80);})['then'](function(_0x34120b){_0x4201e7[_0xb875('0x5f')]=_0x34120b;return _0x4201e7;})[_0xb875('0x1e')](respondWithFilteredResult(_0x4b7dd6,_0x438b80))[_0xb875('0x27')](handleError(_0x4b7dd6,null));};exports[_0xb875('0x60')]=function(_0x217651,_0x4199d4){var _0x57c0bd={'raw':![],'where':{'id':_0x217651[_0xb875('0x61')]['id']}},_0x22732d={};_0x22732d[_0xb875('0x45')]=_[_0xb875('0x46')](_['keys'](db['User'][_0xb875('0x44')]),[_0xb875('0x48'),_0xb875('0x62')]);_0x22732d['query']=_[_0xb875('0x47')](_0x217651['query']);_0x22732d[_0xb875('0x4a')]=_['intersection'](_0x22732d[_0xb875('0x45')],_0x22732d[_0xb875('0x49')]);_0x57c0bd[_0xb875('0x4c')]=_[_0xb875('0x4b')](_0x22732d[_0xb875('0x45')],qs[_0xb875('0x4d')](_0x217651[_0xb875('0x49')][_0xb875('0x4d')]));_0x57c0bd[_0xb875('0x4c')]=_0x57c0bd[_0xb875('0x4c')][_0xb875('0x63')]?_0x57c0bd[_0xb875('0x4c')]:_0x22732d['model'];if(_0x217651[_0xb875('0x49')][_0xb875('0x5c')]){_0x57c0bd[_0xb875('0x5d')]=[{'all':!![]}];}_0x57c0bd=_[_0xb875('0x54')]({},_0x57c0bd,_0x217651['options']);return db['User']['find'](_0x57c0bd)[_0xb875('0x1e')](handleEntityNotFound(_0x4199d4,null))[_0xb875('0x1e')](respondWithResult(_0x4199d4,null))[_0xb875('0x27')](handleError(_0x4199d4,null));};exports[_0xb875('0x64')]=function(_0x5e49f9,_0x7e8ef2){return db[_0xb875('0x5a')][_0xb875('0x64')](_0x5e49f9[_0xb875('0x65')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x7e8ef2,0xc9))[_0xb875('0x27')](handleError(_0x7e8ef2,null));};exports['update']=function(_0x1a27af,_0x15c634){if(_0x1a27af[_0xb875('0x65')]['id']){delete _0x1a27af[_0xb875('0x65')]['id'];}return db[_0xb875('0x5a')][_0xb875('0x3f')]({'where':{'id':_0x1a27af[_0xb875('0x61')]['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x15c634,null))[_0xb875('0x1e')](saveUpdates(_0x1a27af[_0xb875('0x65')],null))[_0xb875('0x1e')](respondWithResult(_0x15c634,null))[_0xb875('0x27')](handleError(_0x15c634,null));};exports[_0xb875('0x66')]=function(_0xdc63dd,_0x542235){return db[_0xb875('0x5a')]['describe']()[_0xb875('0x1e')](respondWithResult(_0x542235,null))[_0xb875('0x27')](handleError(_0x542235,null));};exports[_0xb875('0x67')]=function(_0x1586d5,_0x23c630,_0x3a1663){return db['User']['find']({'where':{'id':_0x1586d5['params']['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x23c630,null))[_0xb875('0x1e')](function(_0x4e6f33){if(_0x4e6f33){return _0x4e6f33[_0xb875('0x67')](_0x1586d5[_0xb875('0x65')]['ids'],_['omit'](_0x1586d5[_0xb875('0x65')],[_0xb875('0x68'),'id'])||{});}})[_0xb875('0x1e')](respondWithResult(_0x23c630,null))[_0xb875('0x27')](handleError(_0x23c630,null));};var getLicense=function(_0xf0d275){return new BPromise(function(_0x4e1e20,_0x54b9c3){var _0x58adab=0x0;_0xf0d275[_0xb875('0x65')][_0xb875('0x3e')]===_0xb875('0x37')&&_0x4e1e20(_0xb875('0x69'));return db[_0xb875('0x5a')][_0xb875('0x5b')]({'where':{'$or':[{'role':_0xf0d275[_0xb875('0x65')][_0xb875('0x3e')]==='telephone'?_0xb875('0x38'):[_0xb875('0x6a'),_0xb875('0x35')]}]}})[_0xb875('0x1e')](function(_0x186688){_0x58adab=_0x186688;return require(_0xb875('0x6b'))[_0xb875('0x6c')]();})[_0xb875('0x1e')](function(_0x20d5e7){var _0x5b5826=_0xf0d275[_0xb875('0x65')][_0xb875('0x3e')]===_0xb875('0x38')?_0xb875('0x6d'):_0xb875('0x6e');if(!_[_0xb875('0x6f')](_0x20d5e7[_0x5b5826])&&_0x58adab>=_0x20d5e7[_0x5b5826]){return _0x54b9c3({'message':_0xb875('0x70')});}return _0x4e1e20(util[_0xb875('0x71')](_0xb875('0x72'),_0x5b5826,_0x58adab));})['catch'](function(_0x44fa93){return _0x54b9c3(_0x44fa93);});});};exports['create']=function(_0x4acd5c,_0x3453e9){return getLicense(_0x4acd5c)[_0xb875('0x1e')](function(_0x59d76e){if(!_0x4acd5c[_0xb875('0x65')][_0xb875('0x73')]){var _0x277b4a;return db['Setting']['findById'](0x1)['then'](function(_0x2006db){_0x277b4a=_0x2006db[_0xb875('0x74')];return db['User'][_0xb875('0x75')](_0xb875('0x73'));})['then'](function(_0x216a8f){if(_[_0xb875('0x6f')](_0x216a8f)){if(_0x277b4a){_0x4acd5c['body']['internal']=_0x277b4a;}else{_0x4acd5c[_0xb875('0x65')][_0xb875('0x73')]=0x1;}}else{if(_[_0xb875('0x6f')](_0x277b4a)||_0x277b4a==_0x216a8f){_0x4acd5c[_0xb875('0x65')]['internal']=_0x216a8f+0x1;}else if(_0x277b4a>_0x216a8f){_0x4acd5c['body'][_0xb875('0x73')]=_0x277b4a;}else{return db[_0xb875('0x55')]['query'](_0xb875('0x76'),{'type':db[_0xb875('0x55')]['QueryTypes'][_0xb875('0x77')]})[_0xb875('0x1e')](function(_0x104a04){if(_0x104a04&&_0x104a04[_0xb875('0x63')]){for(var _0x5555df=0x0,_0xde9900=_0x104a04[_0xb875('0x63')];_0x5555df<_0xde9900&&_[_0xb875('0x6f')](_0x4acd5c[_0xb875('0x65')][_0xb875('0x73')]);_0x5555df++){if(_0x277b4a<=_0x104a04[_0x5555df][_0xb875('0x78')]){_0x4acd5c[_0xb875('0x65')][_0xb875('0x73')]=_0x104a04[_0x5555df][_0xb875('0x78')];}else if(_0x277b4a>_0x104a04[_0x5555df][_0xb875('0x78')]&&_0x277b4a<=_0x104a04[_0x5555df]['to']){_0x4acd5c[_0xb875('0x65')][_0xb875('0x73')]=_0x277b4a;}}}if(_[_0xb875('0x6f')](_0x4acd5c[_0xb875('0x65')]['internal'])){_0x4acd5c[_0xb875('0x65')]['internal']=_0x216a8f+0x1;}});}}});}})['then'](function(){if(_0x4acd5c[_0xb875('0x65')]['voicemail']){_0x4acd5c[_0xb875('0x65')][_0xb875('0x79')]=_0x4acd5c[_0xb875('0x65')][_0xb875('0x73')];_0x4acd5c[_0xb875('0x65')][_0xb875('0x7a')]={'mailbox':_0x4acd5c['body'][_0xb875('0x73')],'password':_0x4acd5c[_0xb875('0x65')][_0xb875('0x48')],'fullname':_0x4acd5c['body'][_0xb875('0x7b')],'email':_0x4acd5c[_0xb875('0x65')][_0xb875('0x7c')]};}if(_0x4acd5c[_0xb875('0x65')]&&_0x4acd5c[_0xb875('0x65')][_0xb875('0x3e')]===_0xb875('0x37')){_0x4acd5c[_0xb875('0x65')][_0xb875('0x7d')]=['101','102',_0xb875('0x7e'),_0xb875('0x7f'),'104',_0xb875('0x80'),_0xb875('0x81'),_0xb875('0x82'),_0xb875('0x83'),_0xb875('0x84'),_0xb875('0x85'),'111'];}return db[_0xb875('0x5a')][_0xb875('0x86')](_0x4acd5c[_0xb875('0x65')],{'include':[{'model':db['VoiceMail'],'as':_0xb875('0x7a')}]});})[_0xb875('0x1e')](function(_0x3bf8fc){if(_0x4acd5c[_0xb875('0x65')][_0xb875('0x3e')]===_0xb875('0x35'))return _0x3bf8fc;var _0x3438a0=_0x4acd5c[_0xb875('0x35')][_0xb875('0x33')]({'plain':!![]});if(!_0x3438a0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3438a0['role']===_0xb875('0x35')){var _0x3dd416=_0x3bf8fc['get']({'plain':!![]});var _0x1c766f=[{'name':_0xb875('0x36'),'value':_0xb875('0x37')},{'name':_0xb875('0x87'),'value':'telephone'}];var _0x284767=_['find'](_0x1c766f,[_0xb875('0x3c'),_0x3dd416[_0xb875('0x3e')]])[_0xb875('0x40')];return db[_0xb875('0x88')]['find']({'where':{'name':_0x284767,'userProfileId':_0x3438a0[_0xb875('0x89')]},'raw':!![]})['then'](function(_0x1e56b1){if(_0x1e56b1&&_0x1e56b1['autoAssociation']===0x0){return db[_0xb875('0x8a')][_0xb875('0x86')]({'name':_0x3dd416['name'],'resourceId':_0x3dd416['id'],'type':_0x1e56b1[_0xb875('0x40')],'sectionId':_0x1e56b1['id']},{})[_0xb875('0x1e')](function(){return _0x3bf8fc;});}else{return _0x3bf8fc;}})[_0xb875('0x27')](function(_0x30fa2d){logger[_0xb875('0x24')](_0xb875('0x8b'),_0x30fa2d);throw _0x30fa2d;});}return _0x3bf8fc;})[_0xb875('0x1e')](respondWithResult(_0x3453e9,0xc9))[_0xb875('0x27')](handleError(_0x3453e9,null));};exports[_0xb875('0x8c')]=function(_0x301955,_0x26045b,_0x2de9a1){if(_0x301955[_0xb875('0x65')]['id']){delete _0x301955[_0xb875('0x65')]['id'];}return db[_0xb875('0x5a')][_0xb875('0x3f')]({'where':{'id':_0x301955[_0xb875('0x61')]['id']}})[_0xb875('0x1e')](function(_0x5a70c2){if(_0x5a70c2){if(_0x5a70c2['id']==_0x301955['user']['id']){if(!_0x301955[_0xb875('0x65')][_0xb875('0x8d')]||!_0x301955[_0xb875('0x65')]['newPassword']){throw new db[(_0xb875('0x8e'))][(_0xb875('0x8f'))](_0xb875('0x90'));}if(!_0x5a70c2[_0xb875('0x91')](_0x301955[_0xb875('0x65')]['oldPassword'])){throw new db[(_0xb875('0x8e'))][(_0xb875('0x8f'))]('Wrong\x20credentials');}if(_0x301955['body'][_0xb875('0x8d')]==_0x301955[_0xb875('0x65')]['newPassword']){throw new db[(_0xb875('0x8e'))][(_0xb875('0x8f'))](_0xb875('0x92'));}return _0x5a70c2;}else if(_0x301955[_0xb875('0x35')][_0xb875('0x3e')]==_0xb875('0x6a')){if(!_0x301955[_0xb875('0x65')][_0xb875('0x93')]){throw new db['Sequelize'][(_0xb875('0x8f'))](_0xb875('0x94'));}return _0x5a70c2;}else if(_0x301955[_0xb875('0x35')][_0xb875('0x3e')]=='user'){if(!_0x301955[_0xb875('0x65')][_0xb875('0x93')]){throw new db['Sequelize'][(_0xb875('0x8f'))](_0xb875('0x94'));}if(_0x5a70c2[_0xb875('0x3e')]!=_0xb875('0x37')){throw new db['Sequelize'][(_0xb875('0x8f'))](_0xb875('0x95'));}return _0x5a70c2;}else{throw new db['Sequelize']['ValidationError'](_0xb875('0x95'));}}return null;})['then'](handleEntityNotFound(_0x26045b,null))[_0xb875('0x1e')](saveUpdates({'password':_0x301955[_0xb875('0x65')][_0xb875('0x93')],'passwordResetAt':_0x301955[_0xb875('0x35')]['id']==_0x301955[_0xb875('0x61')]['id']?moment():null},null))[_0xb875('0x1e')](respondWithResult(_0x26045b,null))[_0xb875('0x27')](handleError(_0x26045b,null));};exports[_0xb875('0x96')]=function(_0x36838f,_0xba1043,_0x2d0105){var _0x4d4df5;return db['User'][_0xb875('0x3f')]({'where':{'id':_0x36838f[_0xb875('0x61')]['id']},'attributes':['id',_0xb875('0x40'),_0xb875('0x3e'),'loginInPause','voicePause',_0xb875('0x97')]})[_0xb875('0x1e')](handleEntityNotFound(_0xba1043,null))[_0xb875('0x1e')](function(_0x31ff55){if(_0x31ff55){_0x4d4df5=_0x31ff55;if(!utils[_0xb875('0x98')](_0x36838f[_0xb875('0x65')][_0xb875('0x99')])){throw new db[(_0xb875('0x8e'))][(_0xb875('0x8f'))](_0xb875('0x9a'));}return _0x31ff55[_0xb875('0x9b')+_[_0xb875('0x9c')](_0x36838f[_0xb875('0x65')]['channel'][_0xb875('0x9d')]())+_0xb875('0x9e')](_0x36838f[_0xb875('0x65')][_0xb875('0x68')],{'penalty':_0x36838f[_0xb875('0x65')]['penalty']||0x0});}})[_0xb875('0x9f')](function(_0x36b115){for(var _0x301fbb=0x0;_0x301fbb<_0x36838f[_0xb875('0x65')][_0xb875('0x68')][_0xb875('0x63')];_0x301fbb+=0x1){var _0x1c4165={'UserId':_0x36838f[_0xb875('0x61')]['id']};_0x1c4165[_[_0xb875('0x9c')](_0x36838f[_0xb875('0x65')][_0xb875('0x99')]['toLowerCase']())+_0xb875('0xa0')]=_0x36838f[_0xb875('0x65')][_0xb875('0x68')][_0x301fbb];socket[_0xb875('0xa1')](_0xb875('0x35')+_[_0xb875('0x9c')](_0x36838f[_0xb875('0x65')]['channel'][_0xb875('0x9d')]())+_0xb875('0xa2'),_0x1c4165);}return _0x36b115;})[_0xb875('0x1e')](function(){if(_0x36838f[_0xb875('0x65')]['channel']===_0xb875('0xa3')){return db['VoiceQueue'][_0xb875('0x5e')]({'where':{'id':_0x36838f[_0xb875('0x65')][_0xb875('0x68')]||[]},'raw':!![],'attributes':['id',_0xb875('0x40')]});}})[_0xb875('0x1e')](function(_0x568819){var _0x47f90d=[];if(_0x36838f[_0xb875('0x65')]['channel']===_0xb875('0xa3')&&_0x4d4df5[_0xb875('0x3e')]===_0xb875('0x37')){for(var _0x40c8e9=0x0;_0x40c8e9<_0x568819[_0xb875('0x63')];_0x40c8e9+=0x1){_0x47f90d[_0xb875('0xa4')]({'membername':_0x4d4df5[_0xb875('0x40')],'UserId':_0x4d4df5['id'],'queue_name':_0x568819[_0x40c8e9]['name'],'VoiceQueueId':_0x568819[_0x40c8e9]['id'],'interface':_[_0xb875('0x6f')](_0x4d4df5['interface'])?util[_0xb875('0x71')]('SIP/%s',_0x4d4df5['name']):_0x4d4df5[_0xb875('0x97')],'paused':_0x4d4df5[_0xb875('0xa5')]||![],'penalty':_0x36838f[_0xb875('0x65')][_0xb875('0xa6')]||0x0});}return BPromise['each'](_0x47f90d,function(_0x5c2409){return db['UserVoiceQueueRt'][_0xb875('0xa7')](_0x5c2409);});}return _0x4d4df5;})['then'](respondWithStatusCode(_0xba1043,null))[_0xb875('0x27')](handleError(_0xba1043,null));};exports[_0xb875('0xa8')]=function(_0x59ac85,_0x1e9007,_0x188d87){var _0x2e7855;return db[_0xb875('0x5a')][_0xb875('0x3f')]({'where':{'id':_0x59ac85[_0xb875('0x61')]['id']},'attributes':['id',_0xb875('0x40'),_0xb875('0x3e')]})[_0xb875('0x1e')](handleEntityNotFound(_0x1e9007,null))['then'](function(_0x2e883f){if(_0x2e883f){_0x2e7855=_0x2e883f;if(!_0x59ac85['query'][_0xb875('0x99')]||!utils[_0xb875('0x98')](_0x59ac85[_0xb875('0x49')][_0xb875('0x99')])){throw new db[(_0xb875('0x8e'))][(_0xb875('0x8f'))](_0xb875('0x9a'));}return _0x2e883f[_0xb875('0xa9')+_[_0xb875('0x9c')](_0x59ac85['query'][_0xb875('0x99')]['toLowerCase']())+_0xb875('0x9e')](_0x59ac85[_0xb875('0x49')][_0xb875('0x68')]);}})['then'](function(_0x5c2a97){for(var _0x12c2b9=0x0;_0x12c2b9<_0x59ac85[_0xb875('0x49')][_0xb875('0x68')][_0xb875('0x63')];_0x12c2b9+=0x1){var _0x4a27d4={'UserId':_0x59ac85[_0xb875('0x61')]['id']};_0x4a27d4[_['capitalize'](_0x59ac85[_0xb875('0x49')][_0xb875('0x99')][_0xb875('0x9d')]())+_0xb875('0xa0')]=_0x59ac85[_0xb875('0x49')][_0xb875('0x68')][_0x12c2b9];socket[_0xb875('0xa1')]('user'+_[_0xb875('0x9c')](_0x59ac85[_0xb875('0x49')]['channel']['toLowerCase']())+'Queue:remove',_0x4a27d4);}return _0x5c2a97;})[_0xb875('0x1e')](function(){if(_0x59ac85[_0xb875('0x49')]['channel']===_0xb875('0xa3')){return db['UserVoiceQueueRt']['destroy']({'where':{'UserId':_0x59ac85[_0xb875('0x61')]['id'],'VoiceQueueId':_0x59ac85[_0xb875('0x49')][_0xb875('0x68')]},'individualHooks':!![]})[_0xb875('0x1e')](function(){return _0x2e7855;});}return _0x2e7855;})[_0xb875('0x1e')](respondWithStatusCode(_0x1e9007,null))[_0xb875('0x27')](handleError(_0x1e9007,null));};exports[_0xb875('0xaa')]=function(_0x1dab87,_0x58c492,_0x946bb5){_0x1dab87[_0xb875('0x65')]['userpic']=_0x1dab87[_0xb875('0xab')][_0xb875('0xac')];return db[_0xb875('0x5a')]['find']({'where':{'id':_0x1dab87[_0xb875('0x61')]['id']}})['then'](handleEntityNotFound(_0x58c492,null))[_0xb875('0x1e')](saveUpdates(_0x1dab87[_0xb875('0x65')],null))[_0xb875('0x1e')](respondWithResult(_0x58c492,null))['catch'](handleError(_0x58c492,null));};exports[_0xb875('0xad')]=function(_0x347f84,_0x2fe275,_0x1fc658){var _0x5eb6ca=path[_0xb875('0xae')](config[_0xb875('0xaf')],'server/files/images/logos/default_profile.png');return db[_0xb875('0x5a')][_0xb875('0x3f')]({'where':{'id':_0x347f84[_0xb875('0x61')]['id']},'attributes':['id',_0xb875('0xb0')],'raw':!![]})['then'](handleEntityNotFound(_0x2fe275,null))[_0xb875('0x1e')](function(_0x2ed8d3){if(_0x2ed8d3){if(_[_0xb875('0x6f')](_0x2ed8d3['userpic'])){return _0x2fe275['download'](_0x5eb6ca);}else{if(!fs[_0xb875('0xb1')](path[_0xb875('0xae')](config['root'],'server/files/images/',_0x2ed8d3[_0xb875('0xb0')]))){return _0x2fe275['download'](_0x5eb6ca);}return _0x2fe275['download'](path[_0xb875('0xae')](config[_0xb875('0xaf')],'server/files/images/',_0x2ed8d3[_0xb875('0xb0')]));}}})['catch'](handleError(_0x2fe275,null));};exports['getContacts']=function(_0x126da0,_0x5cf4e3,_0x3a2a79){var _0x20ff7c={};var _0x5dc7fc={};var _0x2b28e0;var _0x1b198a;return db[_0xb875('0x5a')]['findOne']({'where':{'id':_0x126da0[_0xb875('0x61')]['id']}})['then'](handleEntityNotFound(_0x5cf4e3,null))[_0xb875('0x1e')](function(_0x432e81){if(_0x432e81){_0x2b28e0=_0x432e81;_0x5dc7fc[_0xb875('0x45')]=_[_0xb875('0x47')](db[_0xb875('0xb2')][_0xb875('0x44')]);_0x5dc7fc[_0xb875('0x49')]=_[_0xb875('0x47')](_0x126da0[_0xb875('0x49')]);_0x5dc7fc[_0xb875('0x4a')]=_[_0xb875('0x4b')](_0x5dc7fc[_0xb875('0x45')],_0x5dc7fc[_0xb875('0x49')]);_0x20ff7c[_0xb875('0x4c')]=_[_0xb875('0x4b')](_0x5dc7fc[_0xb875('0x45')],qs[_0xb875('0x4d')](_0x126da0[_0xb875('0x49')][_0xb875('0x4d')]));_0x20ff7c['attributes']=_0x20ff7c[_0xb875('0x4c')][_0xb875('0x63')]?_0x20ff7c['attributes']:_0x5dc7fc[_0xb875('0x45')];_0x20ff7c[_0xb875('0x50')]=qs['sort'](_0x126da0[_0xb875('0x49')][_0xb875('0x51')]);_0x20ff7c[_0xb875('0x53')]=qs[_0xb875('0x4a')](_['pick'](_0x126da0[_0xb875('0x49')],_0x5dc7fc[_0xb875('0x4a')]));if(_0x126da0[_0xb875('0x49')][_0xb875('0x39')]){_0x20ff7c[_0xb875('0x53')]=_[_0xb875('0x54')](_0x20ff7c[_0xb875('0x53')],{'$or':_[_0xb875('0x3b')](_0x20ff7c[_0xb875('0x4c')],function(_0xf8ec9f){var _0x341d33={};_0x341d33[_0xf8ec9f]={'$like':'%'+_0x126da0[_0xb875('0x49')][_0xb875('0x39')]+'%'};return _0x341d33;})});}_0x20ff7c=_[_0xb875('0x54')]({},_0x20ff7c,_0x126da0['options']);return _0x2b28e0[_0xb875('0xb3')](_0x20ff7c);}})['then'](function(_0x397363){if(_0x397363){_0x1b198a=_0x397363[_0xb875('0x63')];if(_0x126da0[_0xb875('0x49')]['hasOwnProperty'](_0xb875('0x5c'))){_0x20ff7c['include']=[{'model':db[_0xb875('0xb4')],'as':_0xb875('0xb5'),'required':![]},{'model':db[_0xb875('0xb6')],'as':_0xb875('0xb7'),'attributes':['id',_0xb875('0x40'),_0xb875('0xb8')],'where':_0x126da0[_0xb875('0x49')]['tag']?{'id':_0x126da0[_0xb875('0x49')][_0xb875('0xb9')]}:undefined,'required':_0x126da0[_0xb875('0x49')][_0xb875('0xb9')]?!![]:![]}];}if(!_0x126da0[_0xb875('0x49')]['hasOwnProperty'](_0xb875('0x4f'))){_0x20ff7c[_0xb875('0x2c')]=qs[_0xb875('0x2c')](_0x126da0[_0xb875('0x49')][_0xb875('0x2c')]);_0x20ff7c[_0xb875('0x2b')]=qs['offset'](_0x126da0[_0xb875('0x49')][_0xb875('0x2b')]);}return _0x2b28e0['getContacts'](_0x20ff7c);}})[_0xb875('0x1e')](function(_0x2aa7df){if(_0x2aa7df){return _0x2aa7df?{'count':_0x1b198a,'rows':_0x2aa7df}:null;}})[_0xb875('0x1e')](respondWithResult(_0x5cf4e3,null))[_0xb875('0x27')](handleError(_0x5cf4e3,null));};exports['getQueues']=function(_0x2a7fd7,_0x28e82b,_0x3a1e1a){var _0x3450af;var _0xc8e1b6;var _0x17df7a={};var _0x9385f6;return db[_0xb875('0x5a')][_0xb875('0xba')]({'where':{'id':_0x2a7fd7[_0xb875('0x61')]['id']},'attributes':['id',_0xb875('0x40'),_0xb875('0x3e')]})['then'](handleEntityNotFound(_0x28e82b,null))[_0xb875('0x1e')](function(_0x5956e1){if(!utils['isValidChannel'](_0x2a7fd7['query']['channel'])){throw new db[(_0xb875('0x8e'))][(_0xb875('0x8f'))](_0xb875('0x9a'));}_0x3450af=_0x5956e1;var _0xccf4c2={};_0xccf4c2['model']=_[_0xb875('0x47')](db[_['capitalize'](_0x2a7fd7['query'][_0xb875('0x99')])+_0xb875('0xbb')][_0xb875('0x44')]);_0xccf4c2[_0xb875('0x49')]=_[_0xb875('0x47')](_0x2a7fd7[_0xb875('0x49')]);_0xccf4c2[_0xb875('0x4a')]=_[_0xb875('0x4b')](_0xccf4c2[_0xb875('0x45')],_0xccf4c2[_0xb875('0x49')]);_0x17df7a[_0xb875('0x4c')]=_[_0xb875('0x4b')](_0xccf4c2['model'],qs[_0xb875('0x4d')](_0x2a7fd7[_0xb875('0x49')][_0xb875('0x4d')]));_0x17df7a['attributes']=_0x17df7a['attributes']['length']?_0x17df7a['attributes']:_0xccf4c2['model'];_0x17df7a['order']=qs[_0xb875('0x51')](_0x2a7fd7[_0xb875('0x49')][_0xb875('0x51')]);_0x17df7a[_0xb875('0x53')]=qs['filters'](_[_0xb875('0x52')](_0x2a7fd7[_0xb875('0x49')],_0xccf4c2[_0xb875('0x4a')]));if(_0x2a7fd7[_0xb875('0x49')][_0xb875('0x39')]){_0x17df7a[_0xb875('0x53')]=_[_0xb875('0x54')](_0x17df7a[_0xb875('0x53')],{'$or':_['map'](_0x17df7a['attributes'],function(_0x4202c6){var _0x5de951={};_0x5de951[_0x4202c6]={'$like':'%'+_0x2a7fd7['query'][_0xb875('0x39')]+'%'};return _0x5de951;})});}_0x17df7a=_[_0xb875('0x54')]({},_0x17df7a,_0x2a7fd7[_0xb875('0x59')]);switch(_0x3450af[_0xb875('0x3e')]){case _0xb875('0x6a'):return db[_[_0xb875('0x9c')](_0x2a7fd7[_0xb875('0x49')][_0xb875('0x99')])+_0xb875('0xbb')][_0xb875('0x5e')](_0x17df7a);case'user':case _0xb875('0x37'):return _0x3450af[_0xb875('0x33')+_['capitalize'](_0x2a7fd7[_0xb875('0x49')]['channel'])+_0xb875('0x9e')](_0x17df7a);default:throw new db[(_0xb875('0x8e'))][(_0xb875('0x8f'))](_0xb875('0xbc'));}})[_0xb875('0x1e')](function(_0x26e122){_0x9385f6=_0x26e122[_0xb875('0x63')];if(!_0x2a7fd7[_0xb875('0x49')][_0xb875('0x4e')](_0xb875('0x4f'))){_0x17df7a[_0xb875('0x2c')]=qs[_0xb875('0x2c')](_0x2a7fd7[_0xb875('0x49')]['limit']);_0x17df7a[_0xb875('0x2b')]=qs[_0xb875('0x2b')](_0x2a7fd7[_0xb875('0x49')]['offset']);}switch(_0x3450af['role']){case _0xb875('0x6a'):return db[_[_0xb875('0x9c')](_0x2a7fd7[_0xb875('0x49')][_0xb875('0x99')])+_0xb875('0xbb')]['findAll'](_0x17df7a);case _0xb875('0x35'):case _0xb875('0x37'):return _0x3450af['get'+_[_0xb875('0x9c')](_0x2a7fd7['query'][_0xb875('0x99')])+_0xb875('0x9e')](_0x17df7a);}})[_0xb875('0x1e')](function(_0xc08028){return{'count':_0x9385f6,'rows':_0xc08028};})[_0xb875('0x1e')](respondWithResult(_0x28e82b,null))[_0xb875('0x27')](handleError(_0x28e82b,null));};exports[_0xb875('0xbd')]=function(_0xdc8cf7,_0x4cc795,_0x179ad0){var _0x199e64={};var _0x49657f={};var _0x19f09d;var _0x4a6131;return db[_0xb875('0x5a')][_0xb875('0xba')]({'where':{'id':_0xdc8cf7[_0xb875('0x61')]['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x4cc795,null))[_0xb875('0x1e')](function(_0x56f4f3){if(_0x56f4f3){_0x19f09d=_0x56f4f3;_0x49657f[_0xb875('0x45')]=_[_0xb875('0x47')](db[_0xb875('0xbe')]['rawAttributes']);_0x49657f[_0xb875('0x49')]=_['keys'](_0xdc8cf7['query']);_0x49657f[_0xb875('0x4a')]=_[_0xb875('0x4b')](_0x49657f[_0xb875('0x45')],_0x49657f[_0xb875('0x49')]);_0x199e64[_0xb875('0x4c')]=_[_0xb875('0x4b')](_0x49657f[_0xb875('0x45')],qs['fields'](_0xdc8cf7['query']['fields']));_0x199e64[_0xb875('0x4c')]=_0x199e64['attributes'][_0xb875('0x63')]?_0x199e64[_0xb875('0x4c')]:_0x49657f['model'];_0x199e64[_0xb875('0x50')]=qs[_0xb875('0x51')](_0xdc8cf7['query'][_0xb875('0x51')]);_0x199e64[_0xb875('0x53')]=qs[_0xb875('0x4a')](_[_0xb875('0x52')](_0xdc8cf7['query'],_0x49657f[_0xb875('0x4a')]));if(_0xdc8cf7[_0xb875('0x49')][_0xb875('0x39')]){_0x199e64[_0xb875('0x53')]=_[_0xb875('0x54')](_0x199e64['where'],{'$or':_[_0xb875('0x3b')](_0x199e64[_0xb875('0x4c')],function(_0x3d118e){var _0x5778ad={};_0x5778ad[_0x3d118e]={'$like':'%'+_0xdc8cf7[_0xb875('0x49')][_0xb875('0x39')]+'%'};return _0x5778ad;})});}_0x199e64=_[_0xb875('0x54')]({},_0x199e64,_0xdc8cf7[_0xb875('0x59')]);return _0x19f09d[_0xb875('0xbd')](_0x199e64);}})[_0xb875('0x1e')](function(_0x68a681){if(_0x68a681){_0x4a6131=_0x68a681[_0xb875('0x63')];if(!_0xdc8cf7['query'][_0xb875('0x4e')](_0xb875('0x4f'))){_0x199e64['limit']=qs[_0xb875('0x2c')](_0xdc8cf7['query'][_0xb875('0x2c')]);_0x199e64[_0xb875('0x2b')]=qs[_0xb875('0x2b')](_0xdc8cf7[_0xb875('0x49')]['offset']);}return _0x19f09d['getVoiceQueuesRt'](_0x199e64);}})[_0xb875('0x1e')](function(_0x49ae96){if(_0x49ae96){return _0x49ae96?{'count':_0x4a6131,'rows':_0x49ae96}:null;}})[_0xb875('0x1e')](respondWithResult(_0x4cc795,null))['catch'](handleError(_0x4cc795,null));};exports[_0xb875('0xbf')]=function(_0x1a8b6c,_0x231c09,_0x5142f9){var _0x108a06={};var _0x2d200a={};var _0xde85f3;var _0x1d4518;return db['User'][_0xb875('0xba')]({'where':{'id':_0x1a8b6c[_0xb875('0x61')]['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x231c09,null))[_0xb875('0x1e')](function(_0x4b5bde){if(_0x4b5bde){_0xde85f3=_0x4b5bde;_0x2d200a[_0xb875('0x45')]=_['keys'](db[_0xb875('0xc0')][_0xb875('0x44')]);_0x2d200a[_0xb875('0x49')]=_[_0xb875('0x47')](_0x1a8b6c['query']);_0x2d200a['filters']=_['intersection'](_0x2d200a[_0xb875('0x45')],_0x2d200a[_0xb875('0x49')]);_0x108a06['attributes']=_[_0xb875('0x4b')](_0x2d200a[_0xb875('0x45')],qs[_0xb875('0x4d')](_0x1a8b6c[_0xb875('0x49')][_0xb875('0x4d')]));_0x108a06[_0xb875('0x4c')]=_0x108a06['attributes']['length']?_0x108a06[_0xb875('0x4c')]:_0x2d200a[_0xb875('0x45')];_0x108a06['order']=qs[_0xb875('0x51')](_0x1a8b6c['query'][_0xb875('0x51')]);_0x108a06[_0xb875('0x53')]=qs['filters'](_[_0xb875('0x52')](_0x1a8b6c['query'],_0x2d200a['filters']));if(_0x1a8b6c[_0xb875('0x49')][_0xb875('0x39')]){_0x108a06[_0xb875('0x53')]=_[_0xb875('0x54')](_0x108a06[_0xb875('0x53')],{'$or':_[_0xb875('0x3b')](_0x108a06['attributes'],function(_0x2eac16){var _0x48057b={};_0x48057b[_0x2eac16]={'$like':'%'+_0x1a8b6c[_0xb875('0x49')]['filter']+'%'};return _0x48057b;})});}_0x108a06=_[_0xb875('0x54')]({},_0x108a06,_0x1a8b6c[_0xb875('0x59')]);return _0xde85f3[_0xb875('0xbf')](_0x108a06);}})['then'](function(_0x38e7e0){if(_0x38e7e0){_0x1d4518=_0x38e7e0['length'];if(!_0x1a8b6c[_0xb875('0x49')][_0xb875('0x4e')](_0xb875('0x4f'))){_0x108a06[_0xb875('0x2c')]=qs[_0xb875('0x2c')](_0x1a8b6c[_0xb875('0x49')]['limit']);_0x108a06[_0xb875('0x2b')]=qs[_0xb875('0x2b')](_0x1a8b6c[_0xb875('0x49')][_0xb875('0x2b')]);}return _0xde85f3[_0xb875('0xbf')](_0x108a06);}})[_0xb875('0x1e')](function(_0x1f65b0){if(_0x1f65b0){return _0x1f65b0?{'count':_0x1d4518,'rows':_0x1f65b0}:null;}})['then'](respondWithResult(_0x231c09,null))[_0xb875('0x27')](handleError(_0x231c09,null));};exports[_0xb875('0xc1')]=function(_0x3e04fc,_0x5358cb,_0x58c871){var _0x13290b={'raw':!![],'where':{}};var _0x535c4b={};var _0x41a39b={'count':0x0,'rows':[]};return db[_0xb875('0x5a')][_0xb875('0xba')]({'where':{'id':_0x3e04fc[_0xb875('0x61')]['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x5358cb,null))[_0xb875('0x1e')](function(_0x497162){if(_0x497162){_0x535c4b[_0xb875('0x45')]=_[_0xb875('0x47')](db[_0xb875('0xc2')][_0xb875('0x44')]);_0x535c4b[_0xb875('0x49')]=_[_0xb875('0x47')](_0x3e04fc[_0xb875('0x49')]);_0x535c4b['filters']=_[_0xb875('0x4b')](_0x535c4b[_0xb875('0x45')],_0x535c4b[_0xb875('0x49')]);_0x13290b[_0xb875('0x4c')]=_['intersection'](_0x535c4b[_0xb875('0x45')],qs['fields'](_0x3e04fc[_0xb875('0x49')][_0xb875('0x4d')]));_0x13290b['attributes']=_0x13290b[_0xb875('0x4c')][_0xb875('0x63')]?_0x13290b[_0xb875('0x4c')]:_0x535c4b['model'];if(!_0x3e04fc[_0xb875('0x49')]['hasOwnProperty'](_0xb875('0x4f'))){_0x13290b['limit']=qs['limit'](_0x3e04fc[_0xb875('0x49')]['limit']);_0x13290b[_0xb875('0x2b')]=qs['offset'](_0x3e04fc['query'][_0xb875('0x2b')]);}_0x13290b[_0xb875('0x50')]=qs['sort'](_0x3e04fc[_0xb875('0x49')][_0xb875('0x51')]);_0x13290b[_0xb875('0x53')]=qs[_0xb875('0x4a')](_[_0xb875('0x52')](_0x3e04fc[_0xb875('0x49')],_0x535c4b[_0xb875('0x4a')]));_0x13290b[_0xb875('0x53')]['UserId']=_0x497162['id'];if(_0x3e04fc[_0xb875('0x49')][_0xb875('0x39')]){_0x13290b[_0xb875('0x53')]=_[_0xb875('0x54')](_0x13290b['where'],{'$or':_[_0xb875('0x3b')](_0x13290b['attributes'],function(_0x556b2d){var _0x12ba2f={};_0x12ba2f[_0x556b2d]={'$like':'%'+_0x3e04fc['query'][_0xb875('0x39')]+'%'};return _0x12ba2f;})});}_0x13290b=_['merge']({},_0x13290b,_0x3e04fc[_0xb875('0x59')]);return db[_0xb875('0xc2')][_0xb875('0x5b')]({'where':_0x13290b[_0xb875('0x53')]})[_0xb875('0x1e')](function(_0x1c87cd){_0x41a39b[_0xb875('0x5b')]=_0x1c87cd;if(_0x3e04fc[_0xb875('0x49')][_0xb875('0x5c')]){_0x13290b['include']=[{'all':!![]}];}return db[_0xb875('0xc2')][_0xb875('0x5e')](_0x13290b);})[_0xb875('0x1e')](function(_0x361cdb){_0x41a39b['rows']=_0x361cdb;return _0x41a39b;});}})[_0xb875('0x1e')](respondWithFilteredResult(_0x5358cb,_0x13290b))['catch'](handleError(_0x5358cb,null));};exports[_0xb875('0xc3')]=function(_0x423ff5,_0x5263b7,_0x3df587){var _0x4fa900={};var _0x239d17={};var _0x62784b;var _0x3f04b5;return db['User'][_0xb875('0xba')]({'where':{'id':_0x423ff5[_0xb875('0x61')]['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x5263b7,null))['then'](function(_0x34cdf8){if(_0x34cdf8){_0x62784b=_0x34cdf8;_0x239d17['model']=_[_0xb875('0x47')](db[_0xb875('0xc4')]['rawAttributes']);_0x239d17[_0xb875('0x49')]=_['keys'](_0x423ff5[_0xb875('0x49')]);_0x239d17[_0xb875('0x4a')]=_[_0xb875('0x4b')](_0x239d17['model'],_0x239d17[_0xb875('0x49')]);_0x4fa900['attributes']=_[_0xb875('0x4b')](_0x239d17[_0xb875('0x45')],qs[_0xb875('0x4d')](_0x423ff5[_0xb875('0x49')][_0xb875('0x4d')]));_0x4fa900['attributes']=_0x4fa900[_0xb875('0x4c')]['length']?_0x4fa900[_0xb875('0x4c')]:_0x239d17[_0xb875('0x45')];_0x4fa900['order']=qs[_0xb875('0x51')](_0x423ff5[_0xb875('0x49')][_0xb875('0x51')]);_0x4fa900[_0xb875('0x53')]=qs[_0xb875('0x4a')](_[_0xb875('0x52')](_0x423ff5['query'],_0x239d17[_0xb875('0x4a')]));if(_0x423ff5[_0xb875('0x49')][_0xb875('0x39')]){_0x4fa900[_0xb875('0x53')]=_[_0xb875('0x54')](_0x4fa900[_0xb875('0x53')],{'$or':_['map'](_0x4fa900[_0xb875('0x4c')],function(_0xd55d38){var _0x3ba640={};_0x3ba640[_0xd55d38]={'$like':'%'+_0x423ff5[_0xb875('0x49')][_0xb875('0x39')]+'%'};return _0x3ba640;})});}_0x4fa900=_[_0xb875('0x54')]({},_0x4fa900,_0x423ff5[_0xb875('0x59')]);return _0x62784b['getChatInteractions'](_0x4fa900);}})[_0xb875('0x1e')](function(_0x12ae2d){if(_0x12ae2d){_0x3f04b5=_0x12ae2d[_0xb875('0x63')];if(!_0x423ff5['query'][_0xb875('0x4e')]('nolimit')){_0x4fa900['limit']=qs[_0xb875('0x2c')](_0x423ff5[_0xb875('0x49')][_0xb875('0x2c')]);_0x4fa900[_0xb875('0x2b')]=qs[_0xb875('0x2b')](_0x423ff5['query'][_0xb875('0x2b')]);}return _0x62784b[_0xb875('0xc3')](_0x4fa900);}})[_0xb875('0x1e')](function(_0x577e13){if(_0x577e13){return _0x577e13?{'count':_0x3f04b5,'rows':_0x577e13}:null;}})[_0xb875('0x1e')](respondWithResult(_0x5263b7,null))[_0xb875('0x27')](handleError(_0x5263b7,null));};exports[_0xb875('0xc5')]=function(_0x4c6d9d,_0x53288e,_0x2e3ea4){var _0x3d19f1={};var _0x652009={};var _0x312af8;var _0x2cd564;return db[_0xb875('0x5a')][_0xb875('0xba')]({'where':{'id':_0x4c6d9d[_0xb875('0x61')]['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x53288e,null))[_0xb875('0x1e')](function(_0x491221){if(_0x491221){_0x312af8=_0x491221;_0x652009[_0xb875('0x45')]=_[_0xb875('0x47')](db[_0xb875('0xc6')][_0xb875('0x44')]);_0x652009['query']=_['keys'](_0x4c6d9d[_0xb875('0x49')]);_0x652009[_0xb875('0x4a')]=_[_0xb875('0x4b')](_0x652009[_0xb875('0x45')],_0x652009[_0xb875('0x49')]);_0x3d19f1[_0xb875('0x4c')]=_['intersection'](_0x652009[_0xb875('0x45')],qs[_0xb875('0x4d')](_0x4c6d9d[_0xb875('0x49')][_0xb875('0x4d')]));_0x3d19f1[_0xb875('0x4c')]=_0x3d19f1['attributes'][_0xb875('0x63')]?_0x3d19f1[_0xb875('0x4c')]:_0x652009[_0xb875('0x45')];_0x3d19f1[_0xb875('0x50')]=qs[_0xb875('0x51')](_0x4c6d9d['query'][_0xb875('0x51')]);_0x3d19f1[_0xb875('0x53')]=qs[_0xb875('0x4a')](_[_0xb875('0x52')](_0x4c6d9d[_0xb875('0x49')],_0x652009['filters']));if(_0x4c6d9d['query'][_0xb875('0x39')]){_0x3d19f1[_0xb875('0x53')]=_[_0xb875('0x54')](_0x3d19f1[_0xb875('0x53')],{'$or':_[_0xb875('0x3b')](_0x3d19f1[_0xb875('0x4c')],function(_0x3026ff){var _0x3c2331={};_0x3c2331[_0x3026ff]={'$like':'%'+_0x4c6d9d['query'][_0xb875('0x39')]+'%'};return _0x3c2331;})});}_0x3d19f1=_[_0xb875('0x54')]({},_0x3d19f1,_0x4c6d9d[_0xb875('0x59')]);return _0x312af8[_0xb875('0xc5')](_0x3d19f1);}})[_0xb875('0x1e')](function(_0x43e726){if(_0x43e726){_0x2cd564=_0x43e726[_0xb875('0x63')];if(!_0x4c6d9d[_0xb875('0x49')][_0xb875('0x4e')](_0xb875('0x4f'))){_0x3d19f1[_0xb875('0x2c')]=qs['limit'](_0x4c6d9d[_0xb875('0x49')][_0xb875('0x2c')]);_0x3d19f1[_0xb875('0x2b')]=qs['offset'](_0x4c6d9d[_0xb875('0x49')][_0xb875('0x2b')]);}return _0x312af8[_0xb875('0xc5')](_0x3d19f1);}})[_0xb875('0x1e')](function(_0x4fbb27){if(_0x4fbb27){return _0x4fbb27?{'count':_0x2cd564,'rows':_0x4fbb27}:null;}})[_0xb875('0x1e')](respondWithResult(_0x53288e,null))['catch'](handleError(_0x53288e,null));};exports[_0xb875('0xc7')]=function(_0x3b8d66,_0x22192c,_0x4771a8){var _0xb3971e={'raw':!![],'where':{}};var _0x133853={};var _0x482676={'count':0x0,'rows':[]};return db['User'][_0xb875('0xba')]({'where':{'id':_0x3b8d66[_0xb875('0x61')]['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x22192c,null))['then'](function(_0x52052d){if(_0x52052d){_0x133853['model']=_[_0xb875('0x47')](db[_0xb875('0xc8')][_0xb875('0x44')]);_0x133853['query']=_[_0xb875('0x47')](_0x3b8d66[_0xb875('0x49')]);_0x133853[_0xb875('0x4a')]=_[_0xb875('0x4b')](_0x133853[_0xb875('0x45')],_0x133853['query']);_0xb3971e['attributes']=_[_0xb875('0x4b')](_0x133853[_0xb875('0x45')],qs['fields'](_0x3b8d66[_0xb875('0x49')][_0xb875('0x4d')]));_0xb3971e[_0xb875('0x4c')]=_0xb3971e[_0xb875('0x4c')][_0xb875('0x63')]?_0xb3971e[_0xb875('0x4c')]:_0x133853['model'];if(!_0x3b8d66[_0xb875('0x49')][_0xb875('0x4e')](_0xb875('0x4f'))){_0xb3971e[_0xb875('0x2c')]=qs[_0xb875('0x2c')](_0x3b8d66[_0xb875('0x49')][_0xb875('0x2c')]);_0xb3971e[_0xb875('0x2b')]=qs[_0xb875('0x2b')](_0x3b8d66[_0xb875('0x49')][_0xb875('0x2b')]);}_0xb3971e[_0xb875('0x50')]=qs[_0xb875('0x51')](_0x3b8d66[_0xb875('0x49')][_0xb875('0x51')]);_0xb3971e[_0xb875('0x53')]=qs[_0xb875('0x4a')](_[_0xb875('0x52')](_0x3b8d66[_0xb875('0x49')],_0x133853[_0xb875('0x4a')]));_0xb3971e[_0xb875('0x53')][_0xb875('0xc9')]=_0x52052d['id'];if(_0x3b8d66[_0xb875('0x49')]['filter']){_0xb3971e[_0xb875('0x53')]=_[_0xb875('0x54')](_0xb3971e[_0xb875('0x53')],{'$or':_[_0xb875('0x3b')](_0xb3971e['attributes'],function(_0x233a0d){var _0x126993={};_0x126993[_0x233a0d]={'$like':'%'+_0x3b8d66[_0xb875('0x49')][_0xb875('0x39')]+'%'};return _0x126993;})});}_0xb3971e=_[_0xb875('0x54')]({},_0xb3971e,_0x3b8d66[_0xb875('0x59')]);return db['MailInteraction'][_0xb875('0x5b')]({'where':_0xb3971e[_0xb875('0x53')]})[_0xb875('0x1e')](function(_0x1b1712){_0x482676[_0xb875('0x5b')]=_0x1b1712;if(_0x3b8d66[_0xb875('0x49')]['includeAll']){_0xb3971e[_0xb875('0x5d')]=[{'all':!![]}];}return db[_0xb875('0xc8')]['findAll'](_0xb3971e);})['then'](function(_0xb82893){_0x482676['rows']=_0xb82893;return _0x482676;});}})[_0xb875('0x1e')](respondWithFilteredResult(_0x22192c,_0xb3971e))['catch'](handleError(_0x22192c,null));};exports['getSmsInteractions']=function(_0x3919c5,_0x5055bc,_0x62e5af){var _0x301579={};var _0x1e8826={};var _0x4d6f83;var _0x5a8360;return db[_0xb875('0x5a')][_0xb875('0xba')]({'where':{'id':_0x3919c5['params']['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x5055bc,null))['then'](function(_0x4237db){if(_0x4237db){_0x4d6f83=_0x4237db;_0x1e8826[_0xb875('0x45')]=_[_0xb875('0x47')](db[_0xb875('0xca')][_0xb875('0x44')]);_0x1e8826[_0xb875('0x49')]=_['keys'](_0x3919c5[_0xb875('0x49')]);_0x1e8826[_0xb875('0x4a')]=_['intersection'](_0x1e8826['model'],_0x1e8826[_0xb875('0x49')]);_0x301579[_0xb875('0x4c')]=_[_0xb875('0x4b')](_0x1e8826[_0xb875('0x45')],qs['fields'](_0x3919c5['query'][_0xb875('0x4d')]));_0x301579[_0xb875('0x4c')]=_0x301579[_0xb875('0x4c')][_0xb875('0x63')]?_0x301579['attributes']:_0x1e8826[_0xb875('0x45')];_0x301579[_0xb875('0x50')]=qs['sort'](_0x3919c5[_0xb875('0x49')]['sort']);_0x301579[_0xb875('0x53')]=qs[_0xb875('0x4a')](_['pick'](_0x3919c5[_0xb875('0x49')],_0x1e8826[_0xb875('0x4a')]));if(_0x3919c5[_0xb875('0x49')][_0xb875('0x39')]){_0x301579['where']=_[_0xb875('0x54')](_0x301579[_0xb875('0x53')],{'$or':_[_0xb875('0x3b')](_0x301579[_0xb875('0x4c')],function(_0x3a534e){var _0x18259f={};_0x18259f[_0x3a534e]={'$like':'%'+_0x3919c5['query']['filter']+'%'};return _0x18259f;})});}_0x301579=_[_0xb875('0x54')]({},_0x301579,_0x3919c5[_0xb875('0x59')]);return _0x4d6f83[_0xb875('0xcb')](_0x301579);}})['then'](function(_0x57de27){if(_0x57de27){_0x5a8360=_0x57de27['length'];if(!_0x3919c5[_0xb875('0x49')][_0xb875('0x4e')](_0xb875('0x4f'))){_0x301579[_0xb875('0x2c')]=qs[_0xb875('0x2c')](_0x3919c5[_0xb875('0x49')][_0xb875('0x2c')]);_0x301579[_0xb875('0x2b')]=qs[_0xb875('0x2b')](_0x3919c5[_0xb875('0x49')][_0xb875('0x2b')]);}return _0x4d6f83[_0xb875('0xcb')](_0x301579);}})[_0xb875('0x1e')](function(_0x52f9f9){if(_0x52f9f9){return _0x52f9f9?{'count':_0x5a8360,'rows':_0x52f9f9}:null;}})['then'](respondWithResult(_0x5055bc,null))[_0xb875('0x27')](handleError(_0x5055bc,null));};exports[_0xb875('0xcc')]=function(_0x3313d0,_0x5e840e,_0xd13a4d){var _0xf48920={};var _0x44c5fa={};var _0x33608e;var _0x276450;return db[_0xb875('0x5a')][_0xb875('0xba')]({'where':{'id':_0x3313d0[_0xb875('0x61')]['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x5e840e,null))[_0xb875('0x1e')](function(_0xf9b5df){if(_0xf9b5df){_0x33608e=_0xf9b5df;_0x44c5fa[_0xb875('0x45')]=_[_0xb875('0x47')](db[_0xb875('0xcd')][_0xb875('0x44')]);_0x44c5fa[_0xb875('0x49')]=_[_0xb875('0x47')](_0x3313d0['query']);_0x44c5fa[_0xb875('0x4a')]=_[_0xb875('0x4b')](_0x44c5fa[_0xb875('0x45')],_0x44c5fa[_0xb875('0x49')]);_0xf48920['attributes']=_[_0xb875('0x4b')](_0x44c5fa[_0xb875('0x45')],qs[_0xb875('0x4d')](_0x3313d0['query'][_0xb875('0x4d')]));_0xf48920['attributes']=_0xf48920['attributes'][_0xb875('0x63')]?_0xf48920[_0xb875('0x4c')]:_0x44c5fa['model'];_0xf48920[_0xb875('0x50')]=qs[_0xb875('0x51')](_0x3313d0[_0xb875('0x49')][_0xb875('0x51')]);_0xf48920[_0xb875('0x53')]=qs[_0xb875('0x4a')](_['pick'](_0x3313d0[_0xb875('0x49')],_0x44c5fa[_0xb875('0x4a')]));if(_0x3313d0[_0xb875('0x49')][_0xb875('0x39')]){_0xf48920[_0xb875('0x53')]=_[_0xb875('0x54')](_0xf48920[_0xb875('0x53')],{'$or':_[_0xb875('0x3b')](_0xf48920[_0xb875('0x4c')],function(_0x4563bb){var _0xab91eb={};_0xab91eb[_0x4563bb]={'$like':'%'+_0x3313d0[_0xb875('0x49')][_0xb875('0x39')]+'%'};return _0xab91eb;})});}_0xf48920=_['merge']({},_0xf48920,_0x3313d0[_0xb875('0x59')]);return _0x33608e[_0xb875('0xcc')](_0xf48920);}})[_0xb875('0x1e')](function(_0xa7dad6){if(_0xa7dad6){_0x276450=_0xa7dad6[_0xb875('0x63')];if(!_0x3313d0['query'][_0xb875('0x4e')](_0xb875('0x4f'))){_0xf48920[_0xb875('0x2c')]=qs[_0xb875('0x2c')](_0x3313d0[_0xb875('0x49')][_0xb875('0x2c')]);_0xf48920['offset']=qs[_0xb875('0x2b')](_0x3313d0[_0xb875('0x49')][_0xb875('0x2b')]);}return _0x33608e[_0xb875('0xcc')](_0xf48920);}})[_0xb875('0x1e')](function(_0x2d75dc){if(_0x2d75dc){return _0x2d75dc?{'count':_0x276450,'rows':_0x2d75dc}:null;}})[_0xb875('0x1e')](respondWithResult(_0x5e840e,null))[_0xb875('0x27')](handleError(_0x5e840e,null));};exports[_0xb875('0xce')]=function(_0x22da23,_0x4cd74c,_0x1e0df1){var _0x2766cd;var _0x3807b7;var _0x5e0356;return db[_0xb875('0x5a')][_0xb875('0x3f')]({'where':{'id':_0x22da23[_0xb875('0x61')]['id'],'role':_0xb875('0x37')},'attributes':['id',_0xb875('0x40'),_0xb875('0xcf'),'mobile',_0xb875('0x3e'),_0xb875('0x73'),_0xb875('0xd0')]})['then'](handleEntityNotFound(_0x4cd74c,null))[_0xb875('0x1e')](function(_0x3ec369){if(_0x3ec369){_0x2766cd=_0x3ec369;if(_0x22da23[_0xb875('0x65')]['interface']){_0x5e0356=util[_0xb875('0x71')]('LOCAL/%s@from-sip/n',_0x2766cd[_0x22da23['body'][_0xb875('0x97')]]);}else if(_0x22da23[_0xb875('0x65')][_0xb875('0xd1')]){_0x5e0356=util[_0xb875('0x71')]('SIP/%s',_0x22da23[_0xb875('0x65')]['intrf']);}else{_0x5e0356=util['format']('SIP/%s',_0x2766cd['name']);}socket['to'](util['format'](_0xb875('0xd2'),_0x2766cd[_0xb875('0x40')]))[_0xb875('0xa1')](_0xb875('0xd3'),{'ip':_0x22da23[_0xb875('0xd4')][_0xb875('0xd5')]||_0x22da23[_0xb875('0xd6')][_0xb875('0xd7')]||_0x22da23[_0xb875('0xd8')][_0xb875('0xd7')]||_0x22da23[_0xb875('0xd6')]['socket']['remoteAddress']});return db[_0xb875('0xbe')][_0xb875('0x32')]({'where':{'membername':_0x2766cd['name']},'individualHooks':!![]});}})['then'](function(_0x511a6f){if(_0x2766cd){return _0x2766cd[_0xb875('0xd9')]({'raw':!![]});}})[_0xb875('0x1e')](function(_0x8987c6){var _0x541417=[];if(_0x8987c6){_0x3807b7=_0x8987c6;if(_0x3807b7['length']){for(var _0x1232b1=0x0;_0x1232b1<_0x3807b7['length'];_0x1232b1++){_0x541417['push']({'membername':_0x2766cd['name'],'UserId':_0x2766cd['id'],'queue_name':_0x3807b7[_0x1232b1][_0xb875('0x40')],'VoiceQueueId':_0x3807b7[_0x1232b1]['id'],'interface':_0x5e0356,'paused':_0x2766cd['loginInPause']||![],'penalty':_0x3807b7[_0x1232b1][_0xb875('0xda')]||0x0});}return BPromise[_0xb875('0xdb')](_0x541417,function(_0x41bfed){return db[_0xb875('0xbe')]['upsert'](_0x41bfed);});}}})[_0xb875('0x1e')](function(){return db[_0xb875('0xdc')][_0xb875('0x5e')]({'where':{'membername':_0x2766cd[_0xb875('0x40')],'exitAt':null}});})[_0xb875('0x1e')](function(_0x10fe7f){var _0x1698bc=[];_0x10fe7f['forEach'](function(_0x18badf){_0x1698bc['push'](_0x18badf[_0xb875('0xdd')]({'exitAt':moment()[_0xb875('0x71')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x1698bc);})[_0xb875('0x1e')](function(){var _0x17286f=[];var _0x3cb2ba=[];var _0x4eb0d6=utils[_0xb875('0xde')]();var _0x34bd85={'membername':_0x2766cd[_0xb875('0x40')],'interface':_0x5e0356,'enterAt':moment()[_0xb875('0x71')](_0xb875('0xdf')),'role':_0x2766cd[_0xb875('0x3e')],'internal':_0x2766cd[_0xb875('0x73')]};_0x4eb0d6[_0xb875('0xe0')](function(_0x52d6c1){_0x17286f[_0xb875('0xa4')](_[_0xb875('0x54')]({'channel':_0x52d6c1,'type':'LOGIN','data1':_0x22da23['body'][_0xb875('0xe1')],'data2':_0x5e0356},_0x34bd85));if(_0x2766cd[_0xb875('0xd0')]){_0x3cb2ba['push'](_[_0xb875('0x54')]({'channel':_0x52d6c1,'type':'PAUSE','data1':_0xb875('0xe2')},_0x34bd85));}});return db[_0xb875('0xdc')][_0xb875('0x64')](_0x17286f['concat'](_0x3cb2ba),{'individualHooks':!![]});})[_0xb875('0x1e')](function(){return _0x2766cd[_0xb875('0xdd')]({'online':!![],'lastLoginAt':moment()[_0xb875('0x71')](_0xb875('0xdf')),'voicePause':_0x2766cd[_0xb875('0xd0')]||![],'mailPause':_0x2766cd['loginInPause']||![],'chatPause':_0x2766cd[_0xb875('0xd0')]||![],'faxPause':_0x2766cd[_0xb875('0xd0')]||![],'smsPause':_0x2766cd[_0xb875('0xd0')]||![],'openchannelPause':_0x2766cd[_0xb875('0xd0')]||![],'pauseType':_0x2766cd[_0xb875('0xd0')]?_0xb875('0xe2'):null,'interface':_0x5e0356,'lastPauseAt':moment()['format'](_0xb875('0xdf'))});})[_0xb875('0x1e')](respondWithResult(_0x4cd74c,null))[_0xb875('0x27')](handleError(_0x4cd74c,null));};exports[_0xb875('0xe3')]=function(_0x27042a,_0xfe3374,_0x5c6d87){var _0x2f5303;return db['User'][_0xb875('0x3f')]({'where':{'id':_0x27042a[_0xb875('0x61')]['id'],'role':_0xb875('0x37')},'attributes':['id',_0xb875('0x40'),_0xb875('0x3e')]})[_0xb875('0x1e')](handleEntityNotFound(_0xfe3374,null))[_0xb875('0x1e')](function(_0x5520d6){if(_0x5520d6){_0x2f5303=_0x5520d6;return db[_0xb875('0xbe')][_0xb875('0x32')]({'where':{'membername':_0x2f5303['name']},'individualHooks':!![]});}})[_0xb875('0x1e')](function(){return db[_0xb875('0xdc')]['findAll']({'where':{'membername':_0x2f5303[_0xb875('0x40')],'exitAt':null}});})[_0xb875('0x1e')](function(_0x1a65b7){var _0x2c799d=[];_0x1a65b7['forEach'](function(_0x4713c7){_0x2c799d[_0xb875('0xa4')](_0x4713c7['update']({'exitAt':moment()[_0xb875('0x71')](_0xb875('0xdf'))}));});return BPromise[_0xb875('0xe4')](_0x2c799d);})[_0xb875('0x1e')](function(){return _0x2f5303[_0xb875('0xdd')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'interface':null});})['then'](respondWithResult(_0xfe3374,null))['catch'](handleError(_0xfe3374,null));};exports['pause']=function(_0x943946,_0x397b4c,_0x3bd8f3){var _0xbee56f;return db['UserVoiceQueueRt'][_0xb875('0xdd')]({'paused':0x1},{'where':{'UserId':_0x943946[_0xb875('0x61')]['id']},'individualHooks':!![]})[_0xb875('0x1e')](function(){return db[_0xb875('0x5a')][_0xb875('0x3f')]({'where':{'id':_0x943946[_0xb875('0x61')]['id'],'role':'agent'},'attributes':['id',_0xb875('0x40'),_0xb875('0x3e'),_0xb875('0x73'),_0xb875('0x97')]});})['then'](handleEntityNotFound(_0x397b4c,null))[_0xb875('0x1e')](function(_0x3ae321){if(_0x3ae321){_0xbee56f=_0x3ae321;return respondWithRpcPromise('QueuePause',_0xb875('0xe5'),{'id':_0xbee56f['id'],'name':_0xbee56f[_0xb875('0x40')],'pause':!![]});}})['then'](function(){if(_0xbee56f){return db['MemberReport']['findAll']({'where':{'membername':_0xbee56f[_0xb875('0x40')],'type':_0xb875('0xe6'),'exitAt':null}});}})[_0xb875('0x1e')](function(_0x80573a){if(_0x80573a[_0xb875('0x63')]){var _0x4db79a=moment()[_0xb875('0x71')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x47f081=0x0,_0x5132d6=_0x80573a['length'];_0x47f081<_0x5132d6;_0x47f081++){_0x80573a[_0x47f081][_0xb875('0xe7')]({'exitAt':_0x4db79a});}}})['then'](function(){var _0x3430c8=[];var _0x2c11c9=utils['getChannels']();_0x2c11c9['forEach'](function(_0x1c5fac){_0x3430c8[_0xb875('0xa4')]({'channel':_0x1c5fac,'membername':_0xbee56f[_0xb875('0x40')],'interface':_[_0xb875('0x6f')](_0xbee56f['interface'])?util[_0xb875('0x71')](_0xb875('0xe8'),_0xbee56f[_0xb875('0x40')]):_0xbee56f[_0xb875('0x97')],'type':_0xb875('0xe6'),'enterAt':moment()['format'](_0xb875('0xdf')),'data1':_0x943946[_0xb875('0x65')][_0xb875('0xe9')]||'DEFAULT\x20PAUSE','role':_0xbee56f[_0xb875('0x3e')],'internal':_0xbee56f[_0xb875('0x73')]});});return db[_0xb875('0xdc')][_0xb875('0x64')](_0x3430c8,{'individualHooks':!![]});})[_0xb875('0x1e')](function(){return _0xbee56f['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x943946[_0xb875('0x65')][_0xb875('0xe9')]||_0xb875('0xea'),'lastPauseAt':moment()[_0xb875('0x71')](_0xb875('0xdf'))});})[_0xb875('0x1e')](respondWithResult(_0x397b4c,null))[_0xb875('0x27')](handleError(_0x397b4c,null));};exports[_0xb875('0xeb')]=function(_0x42f355,_0x138116,_0x16ad61){var _0x523278;return db['User'][_0xb875('0x3f')]({'where':{'id':_0x42f355[_0xb875('0x61')]['id']},'attributes':['id','name','role',_0xb875('0xa5'),_0xb875('0xec'),'chatPause',_0xb875('0xed'),'openchannelPause',_0xb875('0xee'),_0xb875('0xef'),_0xb875('0xf0')]})[_0xb875('0x1e')](handleEntityNotFound(_0x138116,null))[_0xb875('0x1e')](function(_0x30e19d){if(_0x30e19d){_0x523278=_0x30e19d;if(_0x42f355[_0xb875('0x65')][_0xb875('0x99')]&&!utils[_0xb875('0x98')](_0x42f355[_0xb875('0x65')][_0xb875('0x99')])){throw new db[(_0xb875('0x8e'))][(_0xb875('0x8f'))]('Unknown\x20channel');}switch(_0x42f355[_0xb875('0x65')][_0xb875('0x99')]){case _0xb875('0xa3'):return respondWithRpcPromise('QueuePause',_0xb875('0xeb'),{'id':_0x523278['id'],'name':_0x523278['name'],'pause':![]})[_0xb875('0x1e')](function(){return db[_0xb875('0xbe')][_0xb875('0xdd')]({'paused':0x0},{'where':{'UserId':_0x523278['id']},'individualHooks':!![]});})[_0xb875('0x1e')](function(){return db[_0xb875('0xdc')][_0xb875('0x3f')]({'where':{'channel':_0x42f355['body'][_0xb875('0x99')],'membername':_0x523278[_0xb875('0x40')],'type':_0xb875('0xe6'),'exitAt':null}});})[_0xb875('0x1e')](function(_0x4ce53e){if(_0x4ce53e){return _0x4ce53e[_0xb875('0xdd')]({'exitAt':moment()[_0xb875('0x71')](_0xb875('0xdf')),'data2':_0xb875('0xf1')},{'individualHooks':!![]});}return null;})[_0xb875('0x1e')](function(){return _0x523278['update']({'voicePause':![]});});case _0xb875('0xf2'):case _0xb875('0xf3'):case _0xb875('0xf4'):case _0xb875('0xf5'):case _0xb875('0xf6'):return db[_0xb875('0xdc')][_0xb875('0x3f')]({'where':{'channel':_0x42f355[_0xb875('0x65')][_0xb875('0x99')],'membername':_0x523278['name'],'type':_0xb875('0xe6'),'exitAt':null}})[_0xb875('0x1e')](function(_0x203bc5){if(_0x203bc5){return _0x203bc5[_0xb875('0xdd')]({'exitAt':moment()[_0xb875('0x71')](_0xb875('0xdf')),'data2':_0xb875('0xf1')},{'individualHooks':!![]});}return null;})[_0xb875('0x1e')](function(){var _0x5c3574={};_[_0xb875('0x2d')](_0x5c3574,util[_0xb875('0x71')](_0xb875('0xf7'),_0x42f355[_0xb875('0x65')][_0xb875('0x99')],'Pause'),![]);return _0x523278[_0xb875('0xdd')](_0x5c3574);});default:return respondWithRpcPromise(_0xb875('0xf8'),_0xb875('0xeb'),{'id':_0x523278['id'],'name':_0x523278['name'],'pause':![]})['then'](function(){return db[_0xb875('0xbe')][_0xb875('0xdd')]({'paused':0x0},{'where':{'UserId':_0x523278['id']}});})[_0xb875('0x1e')](function(){return db[_0xb875('0xdc')][_0xb875('0x5e')]({'where':{'membername':_0x523278['name'],'type':_0xb875('0xe6'),'exitAt':null}});})['then'](function(_0x37e5e7){var _0x66ab18=[];_0x37e5e7[_0xb875('0xe0')](function(_0x2a661c){_0x66ab18[_0xb875('0xa4')](_0x2a661c[_0xb875('0xdd')]({'exitAt':moment()[_0xb875('0x71')](_0xb875('0xdf')),'data2':_0xb875('0xf1')}));});return BPromise[_0xb875('0xe4')](_0x66ab18);})[_0xb875('0x1e')](function(){return _0x523278[_0xb875('0xdd')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xb875('0x1e')](respondWithResult(_0x138116,null))[_0xb875('0x27')](handleError(_0x138116,null));};exports[_0xb875('0xf9')]=function(_0x3d86dc,_0x28361b,_0x4f1d24){var _0xaedb45={};var _0xe6ae9d={};var _0x96b955;var _0x5ae843;return db[_0xb875('0x5a')][_0xb875('0xba')]({'where':{'id':_0x3d86dc['params']['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x28361b,null))[_0xb875('0x1e')](function(_0x184d7f){if(_0x184d7f){_0x96b955=_0x184d7f;_0xe6ae9d[_0xb875('0x45')]=_['keys'](db['Team']['rawAttributes']);_0xe6ae9d[_0xb875('0x49')]=_[_0xb875('0x47')](_0x3d86dc[_0xb875('0x49')]);_0xe6ae9d[_0xb875('0x4a')]=_[_0xb875('0x4b')](_0xe6ae9d[_0xb875('0x45')],_0xe6ae9d['query']);_0xaedb45[_0xb875('0x4c')]=_[_0xb875('0x4b')](_0xe6ae9d[_0xb875('0x45')],qs[_0xb875('0x4d')](_0x3d86dc['query']['fields']));_0xaedb45[_0xb875('0x4c')]=_0xaedb45[_0xb875('0x4c')][_0xb875('0x63')]?_0xaedb45[_0xb875('0x4c')]:_0xe6ae9d[_0xb875('0x45')];_0xaedb45[_0xb875('0x50')]=qs[_0xb875('0x51')](_0x3d86dc[_0xb875('0x49')]['sort']);_0xaedb45['where']=qs['filters'](_[_0xb875('0x52')](_0x3d86dc[_0xb875('0x49')],_0xe6ae9d[_0xb875('0x4a')]));if(_0x3d86dc['query']['filter']){_0xaedb45['where']=_[_0xb875('0x54')](_0xaedb45[_0xb875('0x53')],{'$or':_[_0xb875('0x3b')](_0xaedb45[_0xb875('0x4c')],function(_0x387a1c){var _0x1b6074={};_0x1b6074[_0x387a1c]={'$like':'%'+_0x3d86dc[_0xb875('0x49')][_0xb875('0x39')]+'%'};return _0x1b6074;})});}_0xaedb45=_[_0xb875('0x54')]({},_0xaedb45,_0x3d86dc[_0xb875('0x59')]);return _0x96b955[_0xb875('0xf9')](_0xaedb45);}})[_0xb875('0x1e')](function(_0x5f4d7a){if(_0x5f4d7a){_0x5ae843=_0x5f4d7a['length'];if(!_0x3d86dc[_0xb875('0x49')][_0xb875('0x4e')](_0xb875('0x4f'))){_0xaedb45['limit']=qs[_0xb875('0x2c')](_0x3d86dc[_0xb875('0x49')][_0xb875('0x2c')]);_0xaedb45[_0xb875('0x2b')]=qs[_0xb875('0x2b')](_0x3d86dc[_0xb875('0x49')]['offset']);}return _0x96b955['getTeams'](_0xaedb45);}})['then'](function(_0x2c6a77){if(_0x2c6a77){return _0x2c6a77?{'count':_0x5ae843,'rows':_0x2c6a77}:null;}})[_0xb875('0x1e')](respondWithResult(_0x28361b,null))[_0xb875('0x27')](handleError(_0x28361b,null));};exports['addTeams']=function(_0x6f83c0,_0x3b1b18,_0x38a5f0){return db[_0xb875('0x5a')][_0xb875('0x3f')]({'where':{'id':_0x6f83c0[_0xb875('0x61')]['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x3b1b18,null))[_0xb875('0x1e')](function(_0xd35a9f){if(_0xd35a9f){return _0xd35a9f['addTeams'](_0x6f83c0[_0xb875('0x65')][_0xb875('0x68')],_[_0xb875('0xfa')](_0x6f83c0[_0xb875('0x65')],['ids','id'])||{});}})[_0xb875('0x1e')](respondWithResult(_0x3b1b18,null))[_0xb875('0x27')](handleError(_0x3b1b18,null));};exports['removeTeams']=function(_0x333444,_0x474f06,_0x581c39){var _0x267628;return db[_0xb875('0x5a')][_0xb875('0x3f')]({'where':{'id':_0x333444[_0xb875('0x61')]['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x474f06,null))[_0xb875('0x1e')](function(_0x17e98d){if(_0x17e98d){return _0x17e98d['removeTeams'](_0x333444[_0xb875('0x49')]['ids']);}})[_0xb875('0x1e')](respondWithStatusCode(_0x474f06,null))[_0xb875('0x27')](handleError(_0x474f06,null));};exports[_0xb875('0xfb')]=function(_0x5e652f,_0x2f275c,_0x3f8734){var _0x44b10d={};var _0x206656={};var _0x2063f5;var _0x546615;return db[_0xb875('0x5a')][_0xb875('0xba')]({'where':{'id':_0x5e652f[_0xb875('0x61')]['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x2f275c,null))['then'](function(_0x469d6c){if(_0x469d6c){_0x2063f5=_0x469d6c;_0x206656['model']=_[_0xb875('0x47')](db[_0xb875('0xb4')][_0xb875('0x44')]);_0x206656[_0xb875('0x49')]=_[_0xb875('0x47')](_0x5e652f['query']);_0x206656[_0xb875('0x4a')]=_[_0xb875('0x4b')](_0x206656['model'],_0x206656[_0xb875('0x49')]);_0x44b10d[_0xb875('0x4c')]=_[_0xb875('0x4b')](_0x206656[_0xb875('0x45')],qs['fields'](_0x5e652f[_0xb875('0x49')][_0xb875('0x4d')]));_0x44b10d['attributes']=_0x44b10d[_0xb875('0x4c')][_0xb875('0x63')]?_0x44b10d[_0xb875('0x4c')]:_0x206656[_0xb875('0x45')];_0x44b10d[_0xb875('0x50')]=qs[_0xb875('0x51')](_0x5e652f[_0xb875('0x49')][_0xb875('0x51')]);_0x44b10d['where']=qs[_0xb875('0x4a')](_[_0xb875('0x52')](_0x5e652f[_0xb875('0x49')],_0x206656[_0xb875('0x4a')]));if(_0x5e652f[_0xb875('0x49')][_0xb875('0x39')]){_0x44b10d[_0xb875('0x53')]=_[_0xb875('0x54')](_0x44b10d[_0xb875('0x53')],{'$or':_[_0xb875('0x3b')](_0x44b10d[_0xb875('0x4c')],function(_0x547330){var _0x46ebd0={};_0x46ebd0[_0x547330]={'$like':'%'+_0x5e652f['query']['filter']+'%'};return _0x46ebd0;})});}_0x44b10d=_[_0xb875('0x54')]({},_0x44b10d,_0x5e652f['options']);return _0x2063f5[_0xb875('0xfb')](_0x44b10d);}})[_0xb875('0x1e')](function(_0x4e0635){if(_0x4e0635){_0x546615=_0x4e0635['length'];if(!_0x5e652f[_0xb875('0x49')]['hasOwnProperty'](_0xb875('0x4f'))){_0x44b10d['limit']=qs[_0xb875('0x2c')](_0x5e652f[_0xb875('0x49')][_0xb875('0x2c')]);_0x44b10d[_0xb875('0x2b')]=qs[_0xb875('0x2b')](_0x5e652f[_0xb875('0x49')][_0xb875('0x2b')]);}return _0x2063f5[_0xb875('0xfb')](_0x44b10d);}})[_0xb875('0x1e')](function(_0x484ad){if(_0x484ad){return _0x484ad?{'count':_0x546615,'rows':_0x484ad}:null;}})['then'](respondWithResult(_0x2f275c,null))[_0xb875('0x27')](handleError(_0x2f275c,null));};exports[_0xb875('0xfc')]=function(_0x210e62,_0x25f89b,_0x12e8fe){var _0x2915e0={};var _0x1ee49d={};var _0x198d48;var _0x57f0c3;return db[_0xb875('0x5a')][_0xb875('0xba')]({'where':{'id':_0x210e62['params']['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x25f89b,null))[_0xb875('0x1e')](function(_0x155539){if(_0x155539){_0x198d48=_0x155539;_0x1ee49d['model']=_[_0xb875('0x47')](db[_0xb875('0x5a')][_0xb875('0x44')]);_0x1ee49d[_0xb875('0x49')]=_['keys'](_0x210e62[_0xb875('0x49')]);_0x1ee49d[_0xb875('0x4a')]=_[_0xb875('0x4b')](_0x1ee49d[_0xb875('0x45')],_0x1ee49d[_0xb875('0x49')]);_0x2915e0[_0xb875('0x4c')]=_[_0xb875('0x4b')](_0x1ee49d[_0xb875('0x45')],qs[_0xb875('0x4d')](_0x210e62['query']['fields']));_0x2915e0[_0xb875('0x4c')]=_0x2915e0['attributes'][_0xb875('0x63')]?_0x2915e0[_0xb875('0x4c')]:_0x1ee49d[_0xb875('0x45')];_0x2915e0['order']=qs['sort'](_0x210e62[_0xb875('0x49')][_0xb875('0x51')]);_0x2915e0[_0xb875('0x53')]=qs[_0xb875('0x4a')](_[_0xb875('0x52')](_0x210e62[_0xb875('0x49')],_0x1ee49d[_0xb875('0x4a')]));if(_0x210e62[_0xb875('0x49')][_0xb875('0x39')]){_0x2915e0['where']=_[_0xb875('0x54')](_0x2915e0[_0xb875('0x53')],{'$or':_['map'](_0x2915e0['attributes'],function(_0x24b64d){var _0x27b8c9={};_0x27b8c9[_0x24b64d]={'$like':'%'+_0x210e62[_0xb875('0x49')][_0xb875('0x39')]+'%'};return _0x27b8c9;})});}_0x2915e0[_0xb875('0x45')]=db[_0xb875('0x5a')];_0x2915e0['as']=_0xb875('0x36');_0x2915e0=_[_0xb875('0x54')]({},_0x2915e0,_0x210e62[_0xb875('0x59')]);return _0x198d48[_0xb875('0xd9')]({'include':[_0x2915e0]});}})[_0xb875('0x1e')](function(_0x503340){if(_0x503340){var _0x35107e={},_0xb29f02=[],_0x14392e=0x0;for(var _0x3c33cd=0x0;_0x3c33cd<_0x503340[_0xb875('0x63')];_0x3c33cd+=0x1){for(var _0x6b10a4=0x0,_0x60145d;_0x6b10a4<_0x503340[_0x3c33cd][_0xb875('0x36')][_0xb875('0x63')];_0x6b10a4+=0x1){_0x60145d=_0x503340[_0x3c33cd][_0xb875('0x36')][_0x6b10a4]['get']({'plain':!![]});_0x35107e[_0x60145d['id']]=_0x60145d;}}_0x35107e=_[_0xb875('0xfd')](_0x35107e);for(var _0x332b4f=qs[_0xb875('0x2b')](_0x210e62[_0xb875('0x49')][_0xb875('0x2b')]);_0x332b4f<_0x35107e['length']&&_0xb29f02[_0xb875('0x63')]<qs[_0xb875('0x2c')](_0x210e62[_0xb875('0x49')][_0xb875('0x2c')]);_0x332b4f+=0x1){if(_0x35107e[_0x332b4f]){_0xb29f02[_0xb875('0xa4')](_0x35107e[_0x332b4f]);}}return{'count':_0x35107e['length'],'rows':_0xb29f02};}})[_0xb875('0x1e')](respondWithResult(_0x25f89b,null))[_0xb875('0x27')](handleError(_0x25f89b,null));};exports[_0xb875('0x32')]=function(_0x365d86,_0x2fc63f){if(_0x365d86['user']['id']==_0x365d86[_0xb875('0x61')]['id']){return _0x2fc63f[_0xb875('0x29')](0x1f4)[_0xb875('0x42')]({'message':_0xb875('0xfe')});}return db[_0xb875('0x5a')][_0xb875('0x3f')]({'where':{'id':_0x365d86[_0xb875('0x61')]['id']}})['then'](handleEntityNotFound(_0x2fc63f,null))[_0xb875('0x1e')](removeEntity(_0x2fc63f,null))[_0xb875('0x27')](handleError(_0x2fc63f,null));};exports[_0xb875('0xff')]=function(_0x9a1b1b,_0x177ac0,_0x26e1ec){return db[_0xb875('0x5a')][_0xb875('0x3f')]({'where':{'id':_0x9a1b1b[_0xb875('0x61')]['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x177ac0,null))['then'](function(_0x523fd2){if(_0x523fd2){return _0x523fd2['addChatInteractions'](_0x9a1b1b[_0xb875('0x65')][_0xb875('0x68')],_[_0xb875('0xfa')](_0x9a1b1b[_0xb875('0x65')],[_0xb875('0x68'),'id'])||{})[_0xb875('0x9f')](function(){for(var _0x24b499=0x0;_0x24b499<_0x9a1b1b['body']['ids']['length'];_0x24b499+=0x1){socket[_0xb875('0xa1')](_0xb875('0x100'),{'ChatInteractionId':Number(_0x9a1b1b['body'][_0xb875('0x68')][_0x24b499]),'UserId':Number(_0x9a1b1b[_0xb875('0x61')]['id'])});}return _0x9a1b1b[_0xb875('0x65')][_0xb875('0x68')];});}})[_0xb875('0x1e')](respondWithResult(_0x177ac0,null))[_0xb875('0x27')](handleError(_0x177ac0,null));};exports[_0xb875('0x101')]=function(_0x2cd716,_0x996b15,_0x2848c8){var _0x383c4c;return db[_0xb875('0x5a')][_0xb875('0x3f')]({'where':{'id':_0x2cd716['params']['id']}})['then'](handleEntityNotFound(_0x996b15,null))['then'](function(_0xdf19fd){if(_0xdf19fd){return _0xdf19fd[_0xb875('0x101')](_0x2cd716['query'][_0xb875('0x68')])['then'](function(_0x106cc5){if(_[_0xb875('0x102')](_0x2cd716['query'][_0xb875('0x68')])){for(var _0x44b563=0x0;_0x44b563<_0x2cd716['query'][_0xb875('0x68')][_0xb875('0x63')];_0x44b563+=0x1){socket[_0xb875('0xa1')](_0xb875('0x103'),{'ChatInteractionId':Number(_0x2cd716[_0xb875('0x49')][_0xb875('0x68')][_0x44b563]),'UserId':Number(_0x2cd716[_0xb875('0x61')]['id'])});}}else{socket[_0xb875('0xa1')](_0xb875('0x103'),{'ChatInteractionId':Number(_0x2cd716[_0xb875('0x49')][_0xb875('0x68')]),'UserId':Number(_0x2cd716[_0xb875('0x61')]['id'])});}});}})[_0xb875('0x1e')](respondWithStatusCode(_0x996b15,null))[_0xb875('0x27')](handleError(_0x996b15,null));};exports[_0xb875('0x104')]=function(_0x411e87,_0x547d83,_0xb67ec5){return db[_0xb875('0x5a')]['find']({'where':{'id':_0x411e87[_0xb875('0x61')]['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x547d83,null))[_0xb875('0x1e')](function(_0x30b576){if(_0x30b576){return _0x30b576[_0xb875('0x104')](_0x411e87['body'][_0xb875('0x68')],_[_0xb875('0xfa')](_0x411e87[_0xb875('0x65')],[_0xb875('0x68'),'id'])||{})[_0xb875('0x9f')](function(){for(var _0xd1265f=0x0;_0xd1265f<_0x411e87[_0xb875('0x65')][_0xb875('0x68')][_0xb875('0x63')];_0xd1265f+=0x1){socket[_0xb875('0xa1')](_0xb875('0x105'),{'MailInteractionId':Number(_0x411e87['body'][_0xb875('0x68')][_0xd1265f]),'UserId':Number(_0x411e87[_0xb875('0x61')]['id'])});}return _0x411e87[_0xb875('0x65')][_0xb875('0x68')];});}})['then'](respondWithResult(_0x547d83,null))[_0xb875('0x27')](handleError(_0x547d83,null));};exports[_0xb875('0x106')]=function(_0x43c306,_0x150a13,_0x34d304){var _0x1c25f0;return db[_0xb875('0x5a')][_0xb875('0x3f')]({'where':{'id':_0x43c306[_0xb875('0x61')]['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x150a13,null))[_0xb875('0x1e')](function(_0x570dd0){if(_0x570dd0){return _0x570dd0[_0xb875('0x106')](_0x43c306[_0xb875('0x49')][_0xb875('0x68')])['then'](function(_0x176e9b){if(_[_0xb875('0x102')](_0x43c306[_0xb875('0x49')]['ids'])){for(var _0x4970c8=0x0;_0x4970c8<_0x43c306[_0xb875('0x49')][_0xb875('0x68')][_0xb875('0x63')];_0x4970c8+=0x1){socket[_0xb875('0xa1')](_0xb875('0x107'),{'MailInteractionId':Number(_0x43c306['query'][_0xb875('0x68')][_0x4970c8]),'UserId':Number(_0x43c306['params']['id'])});}}else{socket['emit'](_0xb875('0x107'),{'MailInteractionId':Number(_0x43c306[_0xb875('0x49')][_0xb875('0x68')]),'UserId':Number(_0x43c306[_0xb875('0x61')]['id'])});}});}})[_0xb875('0x1e')](respondWithStatusCode(_0x150a13,null))[_0xb875('0x27')](handleError(_0x150a13,null));};exports[_0xb875('0x108')]=function(_0x2fdc5f,_0x3285eb,_0x4ddd79){return db[_0xb875('0x5a')][_0xb875('0x3f')]({'where':{'id':_0x2fdc5f[_0xb875('0x61')]['id']}})['then'](handleEntityNotFound(_0x3285eb,null))['then'](function(_0x552559){if(_0x552559){return _0x552559['addFaxInteractions'](_0x2fdc5f['body']['ids'],_[_0xb875('0xfa')](_0x2fdc5f[_0xb875('0x65')],[_0xb875('0x68'),'id'])||{})[_0xb875('0x9f')](function(){for(var _0x3ad83f=0x0;_0x3ad83f<_0x2fdc5f['body']['ids']['length'];_0x3ad83f+=0x1){socket[_0xb875('0xa1')]('user_has_fax_interactions:save',{'FaxInteractionId':Number(_0x2fdc5f[_0xb875('0x65')][_0xb875('0x68')][_0x3ad83f]),'UserId':Number(_0x2fdc5f[_0xb875('0x61')]['id'])});}return _0x2fdc5f[_0xb875('0x65')][_0xb875('0x68')];});}})[_0xb875('0x1e')](respondWithResult(_0x3285eb,null))['catch'](handleError(_0x3285eb,null));};exports[_0xb875('0x109')]=function(_0x255a6f,_0x5390dd,_0x189426){var _0x1a3b7f;return db[_0xb875('0x5a')][_0xb875('0x3f')]({'where':{'id':_0x255a6f[_0xb875('0x61')]['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x5390dd,null))[_0xb875('0x1e')](function(_0x51c576){if(_0x51c576){return _0x51c576[_0xb875('0x109')](_0x255a6f[_0xb875('0x49')][_0xb875('0x68')])[_0xb875('0x1e')](function(_0x2b7df6){if(_['isArray'](_0x255a6f[_0xb875('0x49')][_0xb875('0x68')])){for(var _0x2f95e4=0x0;_0x2f95e4<_0x255a6f[_0xb875('0x49')][_0xb875('0x68')][_0xb875('0x63')];_0x2f95e4+=0x1){socket[_0xb875('0xa1')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x255a6f[_0xb875('0x49')]['ids'][_0x2f95e4]),'UserId':Number(_0x255a6f[_0xb875('0x61')]['id'])});}}else{socket[_0xb875('0xa1')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x255a6f['query'][_0xb875('0x68')]),'UserId':Number(_0x255a6f['params']['id'])});}});}})[_0xb875('0x1e')](respondWithStatusCode(_0x5390dd,null))['catch'](handleError(_0x5390dd,null));};exports[_0xb875('0x10a')]=function(_0x2fe581,_0x295dbe,_0x48aec0){return db['User'][_0xb875('0x3f')]({'where':{'id':_0x2fe581[_0xb875('0x61')]['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x295dbe,null))['then'](function(_0x21c7ab){if(_0x21c7ab){return _0x21c7ab[_0xb875('0x10a')](_0x2fe581[_0xb875('0x65')][_0xb875('0x68')],_[_0xb875('0xfa')](_0x2fe581[_0xb875('0x65')],[_0xb875('0x68'),'id'])||{})[_0xb875('0x9f')](function(){for(var _0x1d8916=0x0;_0x1d8916<_0x2fe581[_0xb875('0x65')][_0xb875('0x68')][_0xb875('0x63')];_0x1d8916+=0x1){socket['emit'](_0xb875('0x10b'),{'SmsInteractionId':Number(_0x2fe581[_0xb875('0x65')]['ids'][_0x1d8916]),'UserId':Number(_0x2fe581[_0xb875('0x61')]['id'])});}return _0x2fe581[_0xb875('0x65')][_0xb875('0x68')];});}})[_0xb875('0x1e')](respondWithResult(_0x295dbe,null))['catch'](handleError(_0x295dbe,null));};exports[_0xb875('0x10c')]=function(_0x426b02,_0x4a6926,_0x3d8814){var _0x4d22d6;return db[_0xb875('0x5a')]['find']({'where':{'id':_0x426b02[_0xb875('0x61')]['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x4a6926,null))[_0xb875('0x1e')](function(_0x2b8f19){if(_0x2b8f19){return _0x2b8f19[_0xb875('0x10c')](_0x426b02[_0xb875('0x49')][_0xb875('0x68')])[_0xb875('0x1e')](function(_0x485d27){if(_[_0xb875('0x102')](_0x426b02[_0xb875('0x49')][_0xb875('0x68')])){for(var _0x269a5e=0x0;_0x269a5e<_0x426b02['query'][_0xb875('0x68')]['length'];_0x269a5e+=0x1){socket[_0xb875('0xa1')](_0xb875('0x10d'),{'SmsInteractionId':Number(_0x426b02[_0xb875('0x49')]['ids'][_0x269a5e]),'UserId':Number(_0x426b02[_0xb875('0x61')]['id'])});}}else{socket[_0xb875('0xa1')](_0xb875('0x10d'),{'SmsInteractionId':Number(_0x426b02['query'][_0xb875('0x68')]),'UserId':Number(_0x426b02[_0xb875('0x61')]['id'])});}});}})[_0xb875('0x1e')](respondWithStatusCode(_0x4a6926,null))['catch'](handleError(_0x4a6926,null));};exports[_0xb875('0x10e')]=function(_0x23949e,_0x3276d9,_0x527744){return db[_0xb875('0x5a')]['find']({'where':{'id':_0x23949e['params']['id']}})['then'](handleEntityNotFound(_0x3276d9,null))[_0xb875('0x1e')](function(_0x4475d6){if(_0x4475d6){return _0x4475d6[_0xb875('0x10e')](_0x23949e[_0xb875('0x65')]['ids'],_[_0xb875('0xfa')](_0x23949e[_0xb875('0x65')],[_0xb875('0x68'),'id'])||{})['spread'](function(){for(var _0x350f79=0x0;_0x350f79<_0x23949e[_0xb875('0x65')][_0xb875('0x68')][_0xb875('0x63')];_0x350f79+=0x1){socket[_0xb875('0xa1')](_0xb875('0x10f'),{'OpenchannelInteractionId':Number(_0x23949e[_0xb875('0x65')][_0xb875('0x68')][_0x350f79]),'UserId':Number(_0x23949e['params']['id'])});}return _0x23949e[_0xb875('0x65')][_0xb875('0x68')];});}})['then'](respondWithResult(_0x3276d9,null))['catch'](handleError(_0x3276d9,null));};exports['removeOpenchannelInteractions']=function(_0x1158ac,_0x566dac,_0x1f2834){var _0x222e4a;return db['User'][_0xb875('0x3f')]({'where':{'id':_0x1158ac[_0xb875('0x61')]['id']}})['then'](handleEntityNotFound(_0x566dac,null))[_0xb875('0x1e')](function(_0x4d7e83){if(_0x4d7e83){return _0x4d7e83['removeOpenchannelInteractions'](_0x1158ac[_0xb875('0x49')][_0xb875('0x68')])[_0xb875('0x1e')](function(_0x1ac3ec){if(_[_0xb875('0x102')](_0x1158ac[_0xb875('0x49')][_0xb875('0x68')])){for(var _0x2a625f=0x0;_0x2a625f<_0x1158ac[_0xb875('0x49')]['ids'][_0xb875('0x63')];_0x2a625f+=0x1){socket['emit'](_0xb875('0x110'),{'OpenchannelInteractionId':Number(_0x1158ac['query'][_0xb875('0x68')][_0x2a625f]),'UserId':Number(_0x1158ac[_0xb875('0x61')]['id'])});}}else{socket[_0xb875('0xa1')](_0xb875('0x110'),{'OpenchannelInteractionId':Number(_0x1158ac['query'][_0xb875('0x68')]),'UserId':Number(_0x1158ac['params']['id'])});}});}})[_0xb875('0x1e')](respondWithStatusCode(_0x566dac,null))['catch'](handleError(_0x566dac,null));};exports[_0xb875('0x111')]=function(_0x305e80,_0x4eb9ef,_0x4ba9a7){var _0x33739a={};var _0xf22d99={};var _0x23d8cd;var _0x357960;return db[_0xb875('0x5a')][_0xb875('0xba')]({'where':{'id':_0x305e80[_0xb875('0x61')]['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x4eb9ef,null))[_0xb875('0x1e')](function(_0x2367c4){if(_0x2367c4){_0x23d8cd=_0x2367c4;_0xf22d99[_0xb875('0x45')]=_[_0xb875('0x47')](db['VoicePrefix']['rawAttributes']);_0xf22d99[_0xb875('0x49')]=_[_0xb875('0x47')](_0x305e80['query']);_0xf22d99[_0xb875('0x4a')]=_[_0xb875('0x4b')](_0xf22d99[_0xb875('0x45')],_0xf22d99[_0xb875('0x49')]);_0x33739a[_0xb875('0x4c')]=_['intersection'](_0xf22d99['model'],qs[_0xb875('0x4d')](_0x305e80[_0xb875('0x49')]['fields']));_0x33739a['attributes']=_0x33739a[_0xb875('0x4c')]['length']?_0x33739a[_0xb875('0x4c')]:_0xf22d99[_0xb875('0x45')];_0x33739a[_0xb875('0x50')]=qs[_0xb875('0x51')](_0x305e80['query']['sort']);_0x33739a[_0xb875('0x53')]=qs[_0xb875('0x4a')](_[_0xb875('0x52')](_0x305e80[_0xb875('0x49')],_0xf22d99['filters']));if(_0x305e80[_0xb875('0x49')][_0xb875('0x39')]){_0x33739a[_0xb875('0x53')]=_[_0xb875('0x54')](_0x33739a['where'],{'$or':_[_0xb875('0x3b')](_0x33739a[_0xb875('0x4c')],function(_0x50eaa8){var _0x20c3e5={};_0x20c3e5[_0x50eaa8]={'$like':'%'+_0x305e80[_0xb875('0x49')][_0xb875('0x39')]+'%'};return _0x20c3e5;})});}_0x33739a=_['merge']({},_0x33739a,_0x305e80[_0xb875('0x59')]);return _0x23d8cd['getVoicePrefixes'](_0x33739a);}})[_0xb875('0x1e')](function(_0x5245c0){if(_0x5245c0){_0x357960=_0x5245c0[_0xb875('0x63')];if(!_0x305e80[_0xb875('0x49')][_0xb875('0x4e')](_0xb875('0x4f'))){_0x33739a[_0xb875('0x2c')]=qs[_0xb875('0x2c')](_0x305e80[_0xb875('0x49')][_0xb875('0x2c')]);_0x33739a['offset']=qs[_0xb875('0x2b')](_0x305e80['query'][_0xb875('0x2b')]);}return _0x23d8cd['getVoicePrefixes'](_0x33739a);}})['then'](function(_0x568fda){if(_0x568fda){return _0x568fda?{'count':_0x357960,'rows':_0x568fda}:null;}})[_0xb875('0x1e')](respondWithResult(_0x4eb9ef,null))[_0xb875('0x27')](handleError(_0x4eb9ef,null));};exports[_0xb875('0x112')]=function(_0x4e64fa,_0x2e2976,_0x2bec55){var _0x283e9c={};var _0x3987d5={};var _0x4b0dd5;var _0x24d62b;return db[_0xb875('0x5a')][_0xb875('0xba')]({'where':{'id':_0x4e64fa[_0xb875('0x61')]['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x2e2976,null))[_0xb875('0x1e')](function(_0x5664e7){if(_0x5664e7){_0x4b0dd5=_0x5664e7;_0x3987d5[_0xb875('0x45')]=_[_0xb875('0x47')](db['FaxAccount']['rawAttributes']);_0x3987d5['query']=_[_0xb875('0x47')](_0x4e64fa['query']);_0x3987d5[_0xb875('0x4a')]=_[_0xb875('0x4b')](_0x3987d5[_0xb875('0x45')],_0x3987d5['query']);_0x283e9c[_0xb875('0x4c')]=_[_0xb875('0x4b')](_0x3987d5[_0xb875('0x45')],qs[_0xb875('0x4d')](_0x4e64fa[_0xb875('0x49')][_0xb875('0x4d')]));_0x283e9c[_0xb875('0x4c')]=_0x283e9c[_0xb875('0x4c')][_0xb875('0x63')]?_0x283e9c[_0xb875('0x4c')]:_0x3987d5[_0xb875('0x45')];_0x283e9c['order']=qs['sort'](_0x4e64fa[_0xb875('0x49')][_0xb875('0x51')]);_0x283e9c[_0xb875('0x53')]=qs[_0xb875('0x4a')](_[_0xb875('0x52')](_0x4e64fa[_0xb875('0x49')],_0x3987d5[_0xb875('0x4a')]));if(_0x4e64fa[_0xb875('0x49')][_0xb875('0x39')]){_0x283e9c[_0xb875('0x53')]=_[_0xb875('0x54')](_0x283e9c[_0xb875('0x53')],{'$or':_['map'](_0x283e9c[_0xb875('0x4c')],function(_0x580b4f){var _0x2647df={};_0x2647df[_0x580b4f]={'$like':'%'+_0x4e64fa[_0xb875('0x49')][_0xb875('0x39')]+'%'};return _0x2647df;})});}_0x283e9c=_['merge']({},_0x283e9c,_0x4e64fa[_0xb875('0x59')]);return _0x4b0dd5[_0xb875('0x112')](_0x283e9c);}})[_0xb875('0x1e')](function(_0xa64f03){if(_0xa64f03){_0x24d62b=_0xa64f03[_0xb875('0x63')];if(!_0x4e64fa[_0xb875('0x49')][_0xb875('0x4e')](_0xb875('0x4f'))){_0x283e9c['limit']=qs['limit'](_0x4e64fa['query'][_0xb875('0x2c')]);_0x283e9c[_0xb875('0x2b')]=qs['offset'](_0x4e64fa['query'][_0xb875('0x2b')]);}return _0x4b0dd5[_0xb875('0x112')](_0x283e9c);}})[_0xb875('0x1e')](function(_0x4bcd8b){if(_0x4bcd8b){return _0x4bcd8b?{'count':_0x24d62b,'rows':_0x4bcd8b}:null;}})[_0xb875('0x1e')](respondWithResult(_0x2e2976,null))['catch'](handleError(_0x2e2976,null));};exports[_0xb875('0x113')]=function(_0x561ffe,_0x1f591c,_0x1aa4a0){return db[_0xb875('0x5a')][_0xb875('0x3f')]({'where':{'id':_0x561ffe[_0xb875('0x61')]['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x1f591c,null))['then'](function(_0x53e691){if(_0x53e691){return _0x53e691[_0xb875('0x113')](_0x561ffe['body'][_0xb875('0x68')],_[_0xb875('0xfa')](_0x561ffe[_0xb875('0x65')],[_0xb875('0x68'),'id'])||{});}})[_0xb875('0x1e')](respondWithResult(_0x1f591c,null))[_0xb875('0x27')](handleError(_0x1f591c,null));};exports[_0xb875('0x114')]=function(_0x3a1b46,_0x115b62,_0x2b902c){var _0x172eec;return db[_0xb875('0x5a')][_0xb875('0x3f')]({'where':{'id':_0x3a1b46['params']['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x115b62,null))['then'](function(_0x5bbaec){if(_0x5bbaec){return _0x5bbaec['removeFaxAccounts'](_0x3a1b46[_0xb875('0x49')][_0xb875('0x68')]);}})['then'](respondWithStatusCode(_0x115b62,null))['catch'](handleError(_0x115b62,null));};exports['getMailAccounts']=function(_0x54f325,_0x210aaa,_0x5251fb){var _0x2294b2={};var _0x188072={};var _0x5d11d9;var _0x50f31c;return db[_0xb875('0x5a')][_0xb875('0xba')]({'where':{'id':_0x54f325[_0xb875('0x61')]['id']}})['then'](handleEntityNotFound(_0x210aaa,null))[_0xb875('0x1e')](function(_0xfa3671){if(_0xfa3671){_0x5d11d9=_0xfa3671;_0x188072[_0xb875('0x45')]=_['keys'](db['MailAccount']['rawAttributes']);_0x188072[_0xb875('0x49')]=_['keys'](_0x54f325[_0xb875('0x49')]);_0x188072['filters']=_[_0xb875('0x4b')](_0x188072[_0xb875('0x45')],_0x188072[_0xb875('0x49')]);_0x2294b2[_0xb875('0x4c')]=_[_0xb875('0x4b')](_0x188072['model'],qs[_0xb875('0x4d')](_0x54f325[_0xb875('0x49')][_0xb875('0x4d')]));_0x2294b2[_0xb875('0x4c')]=_0x2294b2[_0xb875('0x4c')][_0xb875('0x63')]?_0x2294b2['attributes']:_0x188072[_0xb875('0x45')];_0x2294b2[_0xb875('0x50')]=qs[_0xb875('0x51')](_0x54f325['query'][_0xb875('0x51')]);_0x2294b2[_0xb875('0x53')]=qs[_0xb875('0x4a')](_[_0xb875('0x52')](_0x54f325['query'],_0x188072[_0xb875('0x4a')]));if(_0x54f325[_0xb875('0x49')][_0xb875('0x39')]){_0x2294b2[_0xb875('0x53')]=_[_0xb875('0x54')](_0x2294b2[_0xb875('0x53')],{'$or':_[_0xb875('0x3b')](_0x2294b2['attributes'],function(_0x290996){var _0x460b4a={};_0x460b4a[_0x290996]={'$like':'%'+_0x54f325[_0xb875('0x49')]['filter']+'%'};return _0x460b4a;})});}_0x2294b2=_['merge']({},_0x2294b2,_0x54f325[_0xb875('0x59')]);return _0x5d11d9[_0xb875('0x115')](_0x2294b2);}})['then'](function(_0x454c24){if(_0x454c24){_0x50f31c=_0x454c24[_0xb875('0x63')];if(!_0x54f325[_0xb875('0x49')][_0xb875('0x4e')](_0xb875('0x4f'))){_0x2294b2[_0xb875('0x2c')]=qs[_0xb875('0x2c')](_0x54f325['query']['limit']);_0x2294b2['offset']=qs[_0xb875('0x2b')](_0x54f325['query'][_0xb875('0x2b')]);}return _0x5d11d9['getMailAccounts'](_0x2294b2);}})[_0xb875('0x1e')](function(_0x4d309e){if(_0x4d309e){return _0x4d309e?{'count':_0x50f31c,'rows':_0x4d309e}:null;}})['then'](respondWithResult(_0x210aaa,null))['catch'](handleError(_0x210aaa,null));};exports[_0xb875('0x116')]=function(_0x29fde4,_0x56f95e,_0x52860a){return db[_0xb875('0x5a')]['find']({'where':{'id':_0x29fde4[_0xb875('0x61')]['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x56f95e,null))[_0xb875('0x1e')](function(_0x8a1ea9){if(_0x8a1ea9){return _0x8a1ea9[_0xb875('0x116')](_0x29fde4['body'][_0xb875('0x68')],_['omit'](_0x29fde4[_0xb875('0x65')],[_0xb875('0x68'),'id'])||{});}})['then'](respondWithResult(_0x56f95e,null))['catch'](handleError(_0x56f95e,null));};exports[_0xb875('0x117')]=function(_0x328358,_0x37a161,_0x4b9550){var _0x4943bf;return db[_0xb875('0x5a')][_0xb875('0x3f')]({'where':{'id':_0x328358[_0xb875('0x61')]['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x37a161,null))[_0xb875('0x1e')](function(_0x45653e){if(_0x45653e){return _0x45653e[_0xb875('0x117')](_0x328358[_0xb875('0x49')]['ids']);}})[_0xb875('0x1e')](respondWithStatusCode(_0x37a161,null))['catch'](handleError(_0x37a161,null));};exports[_0xb875('0x118')]=function(_0x308761,_0x4753e8,_0x265709){var _0x13aab2={};var _0x50ab74={};var _0x41bbf7;var _0x240e42;return db['User'][_0xb875('0xba')]({'where':{'id':_0x308761[_0xb875('0x61')]['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x4753e8,null))[_0xb875('0x1e')](function(_0x50b211){if(_0x50b211){_0x41bbf7=_0x50b211;_0x50ab74[_0xb875('0x45')]=_['keys'](db[_0xb875('0x119')][_0xb875('0x44')]);_0x50ab74['query']=_[_0xb875('0x47')](_0x308761[_0xb875('0x49')]);_0x50ab74['filters']=_[_0xb875('0x4b')](_0x50ab74[_0xb875('0x45')],_0x50ab74['query']);_0x13aab2[_0xb875('0x4c')]=_[_0xb875('0x4b')](_0x50ab74[_0xb875('0x45')],qs['fields'](_0x308761[_0xb875('0x49')][_0xb875('0x4d')]));_0x13aab2['attributes']=_0x13aab2[_0xb875('0x4c')]['length']?_0x13aab2[_0xb875('0x4c')]:_0x50ab74[_0xb875('0x45')];_0x13aab2[_0xb875('0x50')]=qs[_0xb875('0x51')](_0x308761[_0xb875('0x49')][_0xb875('0x51')]);_0x13aab2['where']=qs[_0xb875('0x4a')](_[_0xb875('0x52')](_0x308761[_0xb875('0x49')],_0x50ab74[_0xb875('0x4a')]));if(_0x308761[_0xb875('0x49')][_0xb875('0x39')]){_0x13aab2[_0xb875('0x53')]=_[_0xb875('0x54')](_0x13aab2['where'],{'$or':_['map'](_0x13aab2['attributes'],function(_0x51223f){var _0x3d3d29={};_0x3d3d29[_0x51223f]={'$like':'%'+_0x308761[_0xb875('0x49')][_0xb875('0x39')]+'%'};return _0x3d3d29;})});}_0x13aab2=_[_0xb875('0x54')]({},_0x13aab2,_0x308761[_0xb875('0x59')]);return _0x41bbf7[_0xb875('0x118')](_0x13aab2);}})[_0xb875('0x1e')](function(_0x57ef0f){if(_0x57ef0f){_0x240e42=_0x57ef0f[_0xb875('0x63')];if(!_0x308761[_0xb875('0x49')]['hasOwnProperty'](_0xb875('0x4f'))){_0x13aab2['limit']=qs[_0xb875('0x2c')](_0x308761[_0xb875('0x49')][_0xb875('0x2c')]);_0x13aab2[_0xb875('0x2b')]=qs[_0xb875('0x2b')](_0x308761[_0xb875('0x49')]['offset']);}return _0x41bbf7[_0xb875('0x118')](_0x13aab2);}})[_0xb875('0x1e')](function(_0x471cb7){if(_0x471cb7){return _0x471cb7?{'count':_0x240e42,'rows':_0x471cb7}:null;}})[_0xb875('0x1e')](respondWithResult(_0x4753e8,null))[_0xb875('0x27')](handleError(_0x4753e8,null));};exports['addOpenchannelAccounts']=function(_0x3a322d,_0x34873e,_0x27e37a){return db[_0xb875('0x5a')][_0xb875('0x3f')]({'where':{'id':_0x3a322d[_0xb875('0x61')]['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x34873e,null))[_0xb875('0x1e')](function(_0x28ba3e){if(_0x28ba3e){return _0x28ba3e['addOpenchannelAccounts'](_0x3a322d[_0xb875('0x65')]['ids'],_[_0xb875('0xfa')](_0x3a322d[_0xb875('0x65')],[_0xb875('0x68'),'id'])||{});}})[_0xb875('0x1e')](respondWithResult(_0x34873e,null))['catch'](handleError(_0x34873e,null));};exports[_0xb875('0x11a')]=function(_0x3cefcb,_0x39a16a,_0x52befe){var _0x141059;return db['User'][_0xb875('0x3f')]({'where':{'id':_0x3cefcb['params']['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x39a16a,null))['then'](function(_0x3604e9){if(_0x3604e9){return _0x3604e9['removeOpenchannelAccounts'](_0x3cefcb[_0xb875('0x49')][_0xb875('0x68')]);}})[_0xb875('0x1e')](respondWithStatusCode(_0x39a16a,null))[_0xb875('0x27')](handleError(_0x39a16a,null));};exports[_0xb875('0x11b')]=function(_0xbea7ea,_0xd38f76,_0x4e0c8a){var _0x52d053={};var _0x49401e={};var _0x2147aa;var _0x3e2535;return db[_0xb875('0x5a')][_0xb875('0xba')]({'where':{'id':_0xbea7ea[_0xb875('0x61')]['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0xd38f76,null))['then'](function(_0x3c44e5){if(_0x3c44e5){_0x2147aa=_0x3c44e5;_0x49401e[_0xb875('0x45')]=_[_0xb875('0x47')](db[_0xb875('0x11c')]['rawAttributes']);_0x49401e[_0xb875('0x49')]=_['keys'](_0xbea7ea['query']);_0x49401e[_0xb875('0x4a')]=_[_0xb875('0x4b')](_0x49401e[_0xb875('0x45')],_0x49401e[_0xb875('0x49')]);_0x52d053[_0xb875('0x4c')]=_['intersection'](_0x49401e[_0xb875('0x45')],qs['fields'](_0xbea7ea[_0xb875('0x49')][_0xb875('0x4d')]));_0x52d053['attributes']=_0x52d053[_0xb875('0x4c')][_0xb875('0x63')]?_0x52d053[_0xb875('0x4c')]:_0x49401e['model'];_0x52d053['order']=qs[_0xb875('0x51')](_0xbea7ea['query'][_0xb875('0x51')]);_0x52d053[_0xb875('0x53')]=qs[_0xb875('0x4a')](_['pick'](_0xbea7ea[_0xb875('0x49')],_0x49401e[_0xb875('0x4a')]));if(_0xbea7ea[_0xb875('0x49')][_0xb875('0x39')]){_0x52d053[_0xb875('0x53')]=_[_0xb875('0x54')](_0x52d053[_0xb875('0x53')],{'$or':_[_0xb875('0x3b')](_0x52d053[_0xb875('0x4c')],function(_0x5578fc){var _0x40ce55={};_0x40ce55[_0x5578fc]={'$like':'%'+_0xbea7ea[_0xb875('0x49')]['filter']+'%'};return _0x40ce55;})});}_0x52d053=_['merge']({},_0x52d053,_0xbea7ea['options']);return _0x2147aa['getSmsAccounts'](_0x52d053);}})[_0xb875('0x1e')](function(_0x424215){if(_0x424215){_0x3e2535=_0x424215[_0xb875('0x63')];if(!_0xbea7ea[_0xb875('0x49')]['hasOwnProperty']('nolimit')){_0x52d053['limit']=qs[_0xb875('0x2c')](_0xbea7ea['query'][_0xb875('0x2c')]);_0x52d053[_0xb875('0x2b')]=qs['offset'](_0xbea7ea[_0xb875('0x49')][_0xb875('0x2b')]);}return _0x2147aa[_0xb875('0x11b')](_0x52d053);}})['then'](function(_0x149423){if(_0x149423){return _0x149423?{'count':_0x3e2535,'rows':_0x149423}:null;}})[_0xb875('0x1e')](respondWithResult(_0xd38f76,null))['catch'](handleError(_0xd38f76,null));};exports[_0xb875('0x11d')]=function(_0x348c3d,_0x416a47,_0x22819c){return db['User']['find']({'where':{'id':_0x348c3d['params']['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x416a47,null))['then'](function(_0x41d01c){if(_0x41d01c){return _0x41d01c[_0xb875('0x11d')](_0x348c3d[_0xb875('0x65')][_0xb875('0x68')],_[_0xb875('0xfa')](_0x348c3d[_0xb875('0x65')],[_0xb875('0x68'),'id'])||{});}})[_0xb875('0x1e')](respondWithResult(_0x416a47,null))[_0xb875('0x27')](handleError(_0x416a47,null));};exports[_0xb875('0x11e')]=function(_0x37ac6c,_0x25bce3,_0x4e846e){var _0x471870;return db[_0xb875('0x5a')][_0xb875('0x3f')]({'where':{'id':_0x37ac6c['params']['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x25bce3,null))['then'](function(_0x4e2926){if(_0x4e2926){return _0x4e2926[_0xb875('0x11e')](_0x37ac6c[_0xb875('0x49')]['ids']);}})[_0xb875('0x1e')](respondWithStatusCode(_0x25bce3,null))[_0xb875('0x27')](handleError(_0x25bce3,null));};exports[_0xb875('0x11f')]=function(_0x44e1ae,_0x54ebac,_0x47ae3b){var _0x20fc96={};var _0x5ad980={};var _0x65e991;var _0x2d8c30;return db[_0xb875('0x5a')][_0xb875('0xba')]({'where':{'id':_0x44e1ae['params']['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x54ebac,null))['then'](function(_0x577d4d){if(_0x577d4d){_0x65e991=_0x577d4d;_0x5ad980[_0xb875('0x45')]=_['keys'](db[_0xb875('0x120')][_0xb875('0x44')]);_0x5ad980[_0xb875('0x49')]=_[_0xb875('0x47')](_0x44e1ae[_0xb875('0x49')]);_0x5ad980[_0xb875('0x4a')]=_['intersection'](_0x5ad980[_0xb875('0x45')],_0x5ad980[_0xb875('0x49')]);_0x20fc96['attributes']=_['intersection'](_0x5ad980[_0xb875('0x45')],qs[_0xb875('0x4d')](_0x44e1ae['query'][_0xb875('0x4d')]));_0x20fc96[_0xb875('0x4c')]=_0x20fc96[_0xb875('0x4c')][_0xb875('0x63')]?_0x20fc96[_0xb875('0x4c')]:_0x5ad980[_0xb875('0x45')];_0x20fc96[_0xb875('0x50')]=qs[_0xb875('0x51')](_0x44e1ae[_0xb875('0x49')][_0xb875('0x51')]);_0x20fc96[_0xb875('0x53')]=qs['filters'](_[_0xb875('0x52')](_0x44e1ae[_0xb875('0x49')],_0x5ad980[_0xb875('0x4a')]));if(_0x44e1ae[_0xb875('0x49')][_0xb875('0x39')]){_0x20fc96['where']=_[_0xb875('0x54')](_0x20fc96['where'],{'$or':_[_0xb875('0x3b')](_0x20fc96[_0xb875('0x4c')],function(_0x493979){var _0x5cad2f={};_0x5cad2f[_0x493979]={'$like':'%'+_0x44e1ae['query'][_0xb875('0x39')]+'%'};return _0x5cad2f;})});}_0x20fc96=_[_0xb875('0x54')]({},_0x20fc96,_0x44e1ae[_0xb875('0x59')]);return _0x65e991[_0xb875('0x11f')](_0x20fc96);}})['then'](function(_0xceb62b){if(_0xceb62b){_0x2d8c30=_0xceb62b['length'];if(!_0x44e1ae[_0xb875('0x49')]['hasOwnProperty'](_0xb875('0x4f'))){_0x20fc96[_0xb875('0x2c')]=qs[_0xb875('0x2c')](_0x44e1ae[_0xb875('0x49')][_0xb875('0x2c')]);_0x20fc96[_0xb875('0x2b')]=qs[_0xb875('0x2b')](_0x44e1ae['query'][_0xb875('0x2b')]);}return _0x65e991[_0xb875('0x11f')](_0x20fc96);}})[_0xb875('0x1e')](function(_0x32df69){if(_0x32df69){return _0x32df69?{'count':_0x2d8c30,'rows':_0x32df69}:null;}})[_0xb875('0x1e')](respondWithResult(_0x54ebac,null))[_0xb875('0x27')](handleError(_0x54ebac,null));};exports[_0xb875('0x121')]=function(_0x5986b4,_0x16a686,_0x25e253){return db[_0xb875('0x5a')][_0xb875('0x3f')]({'where':{'id':_0x5986b4[_0xb875('0x61')]['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x16a686,null))[_0xb875('0x1e')](function(_0x3bcf39){if(_0x3bcf39){return _0x3bcf39[_0xb875('0x121')](_0x5986b4[_0xb875('0x65')]['ids'],_[_0xb875('0xfa')](_0x5986b4[_0xb875('0x65')],['ids','id'])||{});}})[_0xb875('0x1e')](respondWithResult(_0x16a686,null))[_0xb875('0x27')](handleError(_0x16a686,null));};exports['removeChatWebsites']=function(_0x224ba6,_0x5660d9,_0x5d0a75){var _0x2ef2d8;return db['User'][_0xb875('0x3f')]({'where':{'id':_0x224ba6[_0xb875('0x61')]['id']}})['then'](handleEntityNotFound(_0x5660d9,null))[_0xb875('0x1e')](function(_0x1580fa){if(_0x1580fa){return _0x1580fa[_0xb875('0x122')](_0x224ba6[_0xb875('0x49')][_0xb875('0x68')]);}})['then'](respondWithStatusCode(_0x5660d9,null))[_0xb875('0x27')](handleError(_0x5660d9,null));};exports[_0xb875('0x123')]=function(_0x5b2438,_0x138b88,_0x2f96b7){var _0x50dc15={};var _0x44c040={};var _0x15c83d;var _0x45846d;return db['User'][_0xb875('0xba')]({'where':{'id':_0x5b2438[_0xb875('0x61')]['id']}})['then'](handleEntityNotFound(_0x138b88,null))[_0xb875('0x1e')](function(_0x5ea39e){if(_0x5ea39e){_0x15c83d=_0x5ea39e;_0x44c040['model']=_[_0xb875('0x47')](db['SquareProject'][_0xb875('0x44')]);_0x44c040[_0xb875('0x49')]=_[_0xb875('0x47')](_0x5b2438[_0xb875('0x49')]);_0x44c040[_0xb875('0x4a')]=_[_0xb875('0x4b')](_0x44c040['model'],_0x44c040[_0xb875('0x49')]);_0x50dc15[_0xb875('0x4c')]=_[_0xb875('0x4b')](_0x44c040[_0xb875('0x45')],qs[_0xb875('0x4d')](_0x5b2438['query'][_0xb875('0x4d')]));_0x50dc15[_0xb875('0x4c')]=_0x50dc15[_0xb875('0x4c')][_0xb875('0x63')]?_0x50dc15[_0xb875('0x4c')]:_0x44c040[_0xb875('0x45')];_0x50dc15[_0xb875('0x50')]=qs[_0xb875('0x51')](_0x5b2438[_0xb875('0x49')]['sort']);_0x50dc15['where']=qs[_0xb875('0x4a')](_[_0xb875('0x52')](_0x5b2438[_0xb875('0x49')],_0x44c040[_0xb875('0x4a')]));if(_0x5b2438[_0xb875('0x49')][_0xb875('0x39')]){_0x50dc15['where']=_[_0xb875('0x54')](_0x50dc15[_0xb875('0x53')],{'$or':_[_0xb875('0x3b')](_0x50dc15[_0xb875('0x4c')],function(_0x3bd1b7){var _0x84c4fb={};_0x84c4fb[_0x3bd1b7]={'$like':'%'+_0x5b2438[_0xb875('0x49')]['filter']+'%'};return _0x84c4fb;})});}_0x50dc15=_[_0xb875('0x54')]({},_0x50dc15,_0x5b2438[_0xb875('0x59')]);return _0x15c83d['getSquareProjects'](_0x50dc15);}})['then'](function(_0x544273){if(_0x544273){_0x45846d=_0x544273[_0xb875('0x63')];if(!_0x5b2438[_0xb875('0x49')][_0xb875('0x4e')](_0xb875('0x4f'))){_0x50dc15[_0xb875('0x2c')]=qs[_0xb875('0x2c')](_0x5b2438[_0xb875('0x49')][_0xb875('0x2c')]);_0x50dc15['offset']=qs[_0xb875('0x2b')](_0x5b2438['query'][_0xb875('0x2b')]);}return _0x15c83d['getSquareProjects'](_0x50dc15);}})['then'](function(_0x1fcdcd){if(_0x1fcdcd){return _0x1fcdcd?{'count':_0x45846d,'rows':_0x1fcdcd}:null;}})[_0xb875('0x1e')](respondWithResult(_0x138b88,null))['catch'](handleError(_0x138b88,null));};exports[_0xb875('0x124')]=function(_0x4f6581,_0xefc6d8,_0xcb6201){return db[_0xb875('0x5a')][_0xb875('0x3f')]({'where':{'id':_0x4f6581['params']['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0xefc6d8,null))[_0xb875('0x1e')](function(_0x48aee9){if(_0x48aee9){return _0x48aee9[_0xb875('0x124')](_0x4f6581[_0xb875('0x65')][_0xb875('0x68')],_[_0xb875('0xfa')](_0x4f6581[_0xb875('0x65')],[_0xb875('0x68'),'id'])||{});}})[_0xb875('0x1e')](respondWithResult(_0xefc6d8,null))[_0xb875('0x27')](handleError(_0xefc6d8,null));};exports[_0xb875('0x125')]=function(_0x47c55d,_0x48112b,_0x37b739){var _0x1a31bf;return db['User'][_0xb875('0x3f')]({'where':{'id':_0x47c55d[_0xb875('0x61')]['id']}})[_0xb875('0x1e')](handleEntityNotFound(_0x48112b,null))[_0xb875('0x1e')](function(_0x4a44ff){if(_0x4a44ff){return _0x4a44ff['removeSquareProjects'](_0x47c55d[_0xb875('0x49')][_0xb875('0x68')]);}})[_0xb875('0x1e')](respondWithStatusCode(_0x48112b,null))[_0xb875('0x27')](handleError(_0x48112b,null));};exports[_0xb875('0x126')]=function(_0x365205,_0x43deca){var _0x3fcf46={},_0x598e73={},_0x5c20e2={'count':0x0,'rows':[]};var _0xbcf996=db[_0xb875('0x127')][_0xb875('0x44')];_0x598e73[_0xb875('0x45')]=_[_0xb875('0x47')](_0xbcf996);_0x598e73[_0xb875('0x49')]=_[_0xb875('0x47')](_0x365205['query']);_0x598e73[_0xb875('0x4a')]=_[_0xb875('0x4b')](_0x598e73['model'],_0x598e73[_0xb875('0x49')]);_0x598e73['filters']=_[_0xb875('0x128')](_0x598e73[_0xb875('0x4a')],[_0xb875('0x129'),'$or','$gt',_0xb875('0x12a'),_0xb875('0x12b'),_0xb875('0x12c'),_0xb875('0x12d'),_0xb875('0x12e'),_0xb875('0x12f'),'$between','$notBetween','$in',_0xb875('0x130'),_0xb875('0x131'),'$notLike',_0xb875('0x132'),_0xb875('0x133'),_0xb875('0x131'),'$overlap',_0xb875('0x134'),_0xb875('0x135'),_0xb875('0x136')]);_0x3fcf46[_0xb875('0x4c')]=_[_0xb875('0x4b')](_0x598e73[_0xb875('0x45')],qs[_0xb875('0x4d')](_0x365205[_0xb875('0x49')]['fields']));_0x3fcf46[_0xb875('0x4c')]=_0x3fcf46[_0xb875('0x4c')][_0xb875('0x63')]?_0x3fcf46[_0xb875('0x4c')]:_0x598e73[_0xb875('0x45')];if(!_0x365205['query']['hasOwnProperty'](_0xb875('0x4f'))){_0x3fcf46[_0xb875('0x2c')]=qs[_0xb875('0x2c')](_0x365205[_0xb875('0x49')][_0xb875('0x2c')]);_0x3fcf46[_0xb875('0x2b')]=qs[_0xb875('0x2b')](_0x365205['query'][_0xb875('0x2b')]);}_0x3fcf46['order']=qs[_0xb875('0x51')](_0x365205[_0xb875('0x49')]['sort']);_0x3fcf46['where']=qs[_0xb875('0x4a')](_['pick'](_0x365205['query'],_0x598e73['filters']));if(_0x365205[_0xb875('0x49')][_0xb875('0x39')]){_0x3fcf46[_0xb875('0x53')]=_['merge'](_0x3fcf46[_0xb875('0x53')],{'$or':_[_0xb875('0x3b')](_0x3fcf46[_0xb875('0x4c')],function(_0x88a44e){var _0x4300e0={};_0x4300e0[_0x88a44e]={'$like':'%'+_0x365205[_0xb875('0x49')][_0xb875('0x39')]+'%'};return _0x4300e0;})});}_0x3fcf46['where']={'$and':[_0x3fcf46[_0xb875('0x53')],{'$or':[{'UserId':_0x365205[_0xb875('0x61')]['id']},{'OwnerId':_0x365205[_0xb875('0x61')]['id']}]}]};_0x3fcf46=_[_0xb875('0x54')]({},_0x3fcf46,_0x365205[_0xb875('0x59')]);var _0x507ca4={'where':_0x3fcf46[_0xb875('0x53')]};return db[_0xb875('0x127')][_0xb875('0x5b')](_0x507ca4)[_0xb875('0x1e')](function(_0x45cb6a){_0x5c20e2[_0xb875('0x5b')]=_0x45cb6a;if(_0x365205[_0xb875('0x49')]['includeAll']){_0x3fcf46[_0xb875('0x5d')]=[{'attributes':['id',_0xb875('0x137'),_0xb875('0x138'),_0xb875('0xcf')],'model':db[_0xb875('0xb2')],'as':_0xb875('0x139')},{'attributes':['id',_0xb875('0x40'),_0xb875('0x13a')],'model':db[_0xb875('0x13b')],'as':_0xb875('0xbb')}];}return db[_0xb875('0x127')][_0xb875('0x5e')](_0x3fcf46);})[_0xb875('0x1e')](function(_0x5d0165){_0x5c20e2[_0xb875('0x5f')]=_0x5d0165;return _0x5c20e2;})[_0xb875('0x1e')](respondWithFilteredResult(_0x43deca,_0x3fcf46))['catch'](handleError(_0x43deca,null));};exports[_0xb875('0x13c')]=function(_0x368e7f,_0x59d3c5,_0x131dd1){if(!_[_0xb875('0x6f')](_0x368e7f[_0xb875('0x35')]['id'])&&(_0x368e7f['user'][_0xb875('0x3e')]=='admin'||_0x368e7f[_0xb875('0x35')][_0xb875('0x3e')]=='user')){return db[_0xb875('0x5a')][_0xb875('0x3f')]({'where':{'id':_0x368e7f[_0xb875('0x61')]['id']}})[_0xb875('0x1e')](function(_0x4dfae1){var _0x543699=authService[_0xb875('0x13d')](_0x4dfae1);if(_0x543699)return _0x59d3c5['status'](0xc8)['json']({'api_key':_0x543699});else return _0x59d3c5['status'](0xcc)[_0xb875('0x2f')]({'message':_0xb875('0x13e')});})[_0xb875('0x27')](handleError(_0x59d3c5,0x193));}else{return _0x59d3c5[_0xb875('0x29')](0x191)[_0xb875('0x2f')]({'message':_0xb875('0x13f')});}};exports[_0xb875('0x140')]=function(_0x1e5a88,_0x184e22,_0x2884a1){var _0x2e2ba9;if(!_[_0xb875('0x6f')](_0x1e5a88[_0xb875('0x35')]['id'])&&(_0x1e5a88[_0xb875('0x35')][_0xb875('0x3e')]=='admin'||_0x1e5a88['user'][_0xb875('0x3e')]=='user')){return db[_0xb875('0x5a')][_0xb875('0x3f')]({'where':{'id':_0x1e5a88[_0xb875('0x61')]['id']}})['then'](function(_0x343a5a){return[_0x343a5a,authService[_0xb875('0x141')](_0x343a5a)];})[_0xb875('0x1e')](function(_0xc6f130){_0x2e2ba9=_0xc6f130;return db['User'][_0xb875('0xdd')]({'apiKeyNonce':_0x2e2ba9[0x0][_0xb875('0x142')],'apiKeyIat':_0x2e2ba9[0x0][_0xb875('0x143')]},{'where':{'id':_0x1e5a88[_0xb875('0x61')]['id']}});})[_0xb875('0x1e')](function(){return _0x184e22[_0xb875('0x29')](0xc8)[_0xb875('0x2f')]({'api_key':_0x2e2ba9[0x1]});})[_0xb875('0x27')](handleError(_0x184e22,0x193));}else{return _0x184e22[_0xb875('0x29')](0x191)[_0xb875('0x2f')]({'message':'You\x20don\x27t\x20have\x20sufficient\x20privelages\x20to\x20access\x20this\x20resource.'});}};exports[_0xb875('0x144')]=function(_0x878272,_0xd87416,_0x25eeea){if(!_[_0xb875('0x6f')](_0x878272[_0xb875('0x35')]['id'])&&(_0x878272['user'][_0xb875('0x3e')]==_0xb875('0x6a')||_0x878272['user']['role']=='user')){return db[_0xb875('0x5a')]['find']({'where':{'id':_0x878272[_0xb875('0x61')]['id']}})['then'](handleEntityNotFound(_0xd87416,null))[_0xb875('0x1e')](function(_0x64e2f2){if(_0x64e2f2&&_0x64e2f2['apiKeyNonce']&&_0x64e2f2['apiKeyIat'])return _0x64e2f2;else throw{'message':_0xb875('0x145')};})[_0xb875('0x1e')](function(_0x2d8540){return db[_0xb875('0x5a')][_0xb875('0xdd')]({'apiKeyNonce':null,'apiKeyIat':null},{'where':{'id':_0x878272[_0xb875('0x61')]['id']}});})[_0xb875('0x1e')](respondWithStatusCode(_0xd87416,0xc8))[_0xb875('0x27')](handleError(_0xd87416,0x193));}else{return _0xd87416[_0xb875('0x29')](0x191)[_0xb875('0x2f')]({'message':_0xb875('0x13f')});}};
\ No newline at end of file
+var _0x714d=['$eq','$not','$notBetween','$notIn','$like','$iLike','$notILike','$overlap','$contains','$contained','CmHopper','firstName','lastName','Contact','dialActive','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privelages\x20to\x20access\x20this\x20resource.','createApiKey','apiKeyNonce','apiKeyIat','removeApiKey','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./user.socket','register','jayson/promise','http','request','then','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','User,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','get','Users','user','agent','Telephones','filter','ignore','map','includes','find','value','role','name','UserProfileResource','destroy','stack','send','index','User','model','differenceBy','keys','salt','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','sequelize','col','field','lower','merge','includeAll','findAll','rows','params','rawAttributes','password','include','bulkCreate','body','describe','addContacts','ids','omit','agent\x20role','telephone','admin','../../config/license/util','telephones','isNil','License\x20limit\x20reached','count\x20%s:\x20%s','create','Setting','findById','min_internal','max','internal','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','VoiceMail','email','permissions','102','110','104','105','106','107','108','109','100','111','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','UserProfileSection','userProfileId','autoAssociation','changePassword','oldPassword','newPassword','ValidationError','authenticate','Sequelize','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','voicePause','interface','isValidChannel','channel','Unknown\x20channel','add','capitalize','Queues','penalty','spread','toLowerCase','emit','Queue:save','voice','VoiceQueue','push','format','upsert','removeQueues','remove','QueueId','Queue:remove','UserVoiceQueueRt','addAvatar','userpic','file','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getContacts','findOne','CmContact','CmList','List','Tag','Tags','color','tag','getQueues','Queue','options','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getChatInteractions','ChatInteraction','getOpenchannelInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','phone','mobile','loginInPause','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','getVoiceQueues','UserVoiceQueue.penalty','each','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','all','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','concat','update','logout','pause','QueuePause','updateAttributes','SIP/%s','type','DEFAULT\x20PAUSE','unpause','faxPause','lastPauseAt','manual','mail','chat','sms','openchannel','%s%s','Pause','Team','getTeams','addTeams','removeTeams','getLists','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','isArray','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','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','$gte','$lte'];(function(_0x3c0a2b,_0x3a2522){var _0x93b608=function(_0x5782ee){while(--_0x5782ee){_0x3c0a2b['push'](_0x3c0a2b['shift']());}};_0x93b608(++_0x3a2522);}(_0x714d,0x168));var _0xd714=function(_0x3e73d4,_0x435c35){_0x3e73d4=_0x3e73d4-0x0;var _0x375e6d=_0x714d[_0x3e73d4];return _0x375e6d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd714('0x0'));var zipdir=require(_0xd714('0x1'));var jsonpatch=require(_0xd714('0x2'));var rp=require(_0xd714('0x3'));var moment=require(_0xd714('0x4'));var BPromise=require(_0xd714('0x5'));var Mustache=require(_0xd714('0x6'));var util=require(_0xd714('0x7'));var path=require(_0xd714('0x8'));var sox=require(_0xd714('0x9'));var csv=require(_0xd714('0xa'));var ejs=require(_0xd714('0xb'));var fs=require('fs');var _=require(_0xd714('0xc'));var squel=require(_0xd714('0xd'));var crypto=require(_0xd714('0xe'));var jsforce=require(_0xd714('0xf'));var deskjs=require(_0xd714('0x10'));var toCsv=require(_0xd714('0xa'));var querystring=require(_0xd714('0x11'));var Papa=require(_0xd714('0x12'));var authService=require(_0xd714('0x13'));var hardwareService=require(_0xd714('0x14'));var Redis=require(_0xd714('0x15'));var qs=require(_0xd714('0x16'));var logger=require(_0xd714('0x17'))(_0xd714('0x18'));var utils=require(_0xd714('0x19'));var config=require(_0xd714('0x1a'));var db=require(_0xd714('0x1b'))['db'];config[_0xd714('0x1c')]=_[_0xd714('0x1d')](config[_0xd714('0x1c')],{'host':_0xd714('0x1e'),'port':0x18eb});var socket=require(_0xd714('0x1f'))(new Redis(config[_0xd714('0x1c')]));require(_0xd714('0x20'))[_0xd714('0x21')](socket);var jayson=require(_0xd714('0x22'));var client=jayson['client'][_0xd714('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x52db7b,_0x4eaac1,_0x442cd3,_0x14c2c9){return new BPromise(function(_0x7f3efd,_0x22372f){var _0x55b09a=_0x14c2c9||client;return _0x55b09a[_0xd714('0x24')](_0x52db7b,_0x442cd3)[_0xd714('0x25')](function(_0x3bd769){logger['info']('User,\x20%s,\x20%s',_0x4eaac1,_0xd714('0x26'));logger[_0xd714('0x27')](_0xd714('0x28'),_0x4eaac1,_0xd714('0x26'),JSON[_0xd714('0x29')](_0x3bd769));if(_0x3bd769[_0xd714('0x2a')]){if(_0x3bd769[_0xd714('0x2a')][_0xd714('0x2b')]===0x1f4){logger['error'](_0xd714('0x2c'),_0x4eaac1,_0x3bd769[_0xd714('0x2a')]['message']);return _0x22372f(_0x3bd769[_0xd714('0x2a')][_0xd714('0x2d')]);}logger['error'](_0xd714('0x2c'),_0x4eaac1,_0x3bd769[_0xd714('0x2a')]['message']);return _0x7f3efd(_0x3bd769[_0xd714('0x2a')][_0xd714('0x2d')]);}else{logger[_0xd714('0x2e')](_0xd714('0x2c'),_0x4eaac1,_0xd714('0x26'));_0x7f3efd(_0x3bd769[_0xd714('0x2f')][_0xd714('0x2d')]);}})[_0xd714('0x30')](function(_0x3f66a6){logger[_0xd714('0x2a')]('User,\x20%s,\x20%s',_0x4eaac1,_0x3f66a6);_0x22372f(_0x3f66a6);});});}function respondWithStatusCode(_0x4de87f,_0x4db504){_0x4db504=_0x4db504||0xcc;return function(_0x268fa8){if(_0x268fa8){return _0x4de87f[_0xd714('0x31')](_0x4db504);}return _0x4de87f[_0xd714('0x32')](_0x4db504)[_0xd714('0x33')]();};}function respondWithResult(_0x290044,_0x1649e1){_0x1649e1=_0x1649e1||0xc8;return function(_0x137aa6){if(_0x137aa6){return _0x290044['status'](_0x1649e1)[_0xd714('0x34')](_0x137aa6);}};}function respondWithFilteredResult(_0x25a5a9,_0x39cac3){return function(_0x3845b5){if(_0x3845b5){var _0x5acaba=_0x3845b5[_0xd714('0x35')],_0x33d2a5=_0x39cac3[_0xd714('0x36')],_0x3fcafc=_0x39cac3[_0xd714('0x36')]+_0x39cac3[_0xd714('0x37')],_0x206a29;if(_0x3fcafc>=_0x5acaba){_0x3fcafc=_0x5acaba;_0x206a29=0xc8;}else{_0x206a29=0xce;}_0x25a5a9[_0xd714('0x32')](_0x206a29);return _0x25a5a9[_0xd714('0x38')](_0xd714('0x39'),_0x33d2a5+'-'+_0x3fcafc+'/'+_0x5acaba)[_0xd714('0x34')](_0x3845b5);}return null;};}function patchUpdates(_0x1f02a6){return function(_0x4f868b){try{jsonpatch[_0xd714('0x3a')](_0x4f868b,_0x1f02a6,!![]);}catch(_0x10a16c){return BPromise[_0xd714('0x3b')](_0x10a16c);}return _0x4f868b['save']();};}function saveUpdates(_0x4c67c6,_0x436a37){return function(_0xe6a73b){if(_0xe6a73b){return _0xe6a73b['update'](_0x4c67c6)[_0xd714('0x25')](function(_0x2e3d82){return _0x2e3d82;});}return null;};}function removeEntity(_0x59b701,_0x1abe60){return function(_0x11a369){if(_0x11a369){return _0x11a369['destroy']()[_0xd714('0x25')](function(){var _0x501f96=_0x11a369[_0xd714('0x3c')]({'plain':!![]});var _0x4950bf=[{'name':_0xd714('0x3d'),'value':_0xd714('0x3e'),'ignore':!![]},{'name':'Agents','value':_0xd714('0x3f'),'ignore':![]},{'name':_0xd714('0x40'),'value':'telephone','ignore':![]}];var _0xa5520d=_(_0x4950bf)[_0xd714('0x41')](_0xd714('0x42'))[_0xd714('0x43')]('value')['value']();if(_[_0xd714('0x44')](_0xa5520d,_0x501f96['role'])){return;}var _0x30a8cd=_[_0xd714('0x45')](_0x4950bf,[_0xd714('0x46'),_0x501f96[_0xd714('0x47')]])[_0xd714('0x48')];return db[_0xd714('0x49')][_0xd714('0x4a')]({'where':{'type':_0x30a8cd,'resourceId':_0x501f96['id']}})[_0xd714('0x25')](function(){return _0x11a369;});})[_0xd714('0x25')](function(){_0x59b701[_0xd714('0x32')](0xcc)[_0xd714('0x33')]();});}};}function handleEntityNotFound(_0x497dae,_0x389903){return function(_0x11e1cf){if(!_0x11e1cf){_0x497dae['sendStatus'](0x194);}return _0x11e1cf;};}function handleError(_0x37fe5d,_0x53e8ce){_0x53e8ce=_0x53e8ce||0x1f4;return function(_0xef9f6d){logger['error'](_0xef9f6d[_0xd714('0x4b')]);if(_0xef9f6d[_0xd714('0x48')]){delete _0xef9f6d[_0xd714('0x48')];}_0x37fe5d['status'](_0x53e8ce)[_0xd714('0x4c')](_0xef9f6d);};}exports[_0xd714('0x4d')]=function(_0x5cc5ab,_0x5e1146){var _0x5c1714={},_0x2c5542={},_0xe2bf39={'count':0x0,'rows':[]};var _0x4022f3=db[_0xd714('0x4e')]['rawAttributes'];_0x2c5542[_0xd714('0x4f')]=_[_0xd714('0x50')](_[_0xd714('0x51')](_0x4022f3),['password',_0xd714('0x52')]);_0x2c5542[_0xd714('0x53')]=_[_0xd714('0x51')](_0x5cc5ab[_0xd714('0x53')]);_0x2c5542[_0xd714('0x54')]=_[_0xd714('0x55')](_0x2c5542[_0xd714('0x4f')],_0x2c5542[_0xd714('0x53')]);_0x5c1714[_0xd714('0x56')]=_[_0xd714('0x55')](_0x2c5542[_0xd714('0x4f')],qs[_0xd714('0x57')](_0x5cc5ab[_0xd714('0x53')][_0xd714('0x57')]));_0x5c1714[_0xd714('0x56')]=_0x5c1714[_0xd714('0x56')][_0xd714('0x58')]?_0x5c1714['attributes']:_0x2c5542[_0xd714('0x4f')];if(!_0x5cc5ab['query'][_0xd714('0x59')](_0xd714('0x5a'))){_0x5c1714[_0xd714('0x37')]=qs[_0xd714('0x37')](_0x5cc5ab[_0xd714('0x53')][_0xd714('0x37')]);_0x5c1714['offset']=qs[_0xd714('0x36')](_0x5cc5ab['query'][_0xd714('0x36')]);}_0x5c1714[_0xd714('0x5b')]=qs[_0xd714('0x5c')](_0x5cc5ab[_0xd714('0x53')][_0xd714('0x5c')]);_0x5c1714[_0xd714('0x5d')]=qs[_0xd714('0x54')](_[_0xd714('0x5e')](_0x5cc5ab['query'],_0x2c5542['filters']));if(_0x5cc5ab[_0xd714('0x53')]['filter']){_0x5c1714['where']=_['merge'](_0x5c1714['where'],{'$or':_[_0xd714('0x43')](_0x4022f3,function(_0x500e4e){return db[_0xd714('0x5f')][_0xd714('0x5d')](db[_0xd714('0x5f')]['fn']('lower',db[_0xd714('0x5f')][_0xd714('0x60')](_0x500e4e[_0xd714('0x61')])),{'$like':db[_0xd714('0x5f')]['fn'](_0xd714('0x62'),'%'+_0x5cc5ab[_0xd714('0x53')]['filter']+'%')});})});}_0x5c1714=_[_0xd714('0x63')]({},_0x5c1714,_0x5cc5ab['options']);var _0x3a9068={'where':_0x5c1714[_0xd714('0x5d')]};return db['User']['count'](_0x3a9068)[_0xd714('0x25')](function(_0x1e15a0){_0xe2bf39[_0xd714('0x35')]=_0x1e15a0;if(_0x5cc5ab['query'][_0xd714('0x64')]){_0x5c1714['include']=[{'all':!![]}];}return db[_0xd714('0x4e')][_0xd714('0x65')](_0x5c1714);})['then'](function(_0x25112b){_0xe2bf39[_0xd714('0x66')]=_0x25112b;return _0xe2bf39;})['then'](respondWithFilteredResult(_0x5e1146,_0x5c1714))[_0xd714('0x30')](handleError(_0x5e1146,null));};exports['show']=function(_0x5a937a,_0x40ba01){var _0x2ebb00={'raw':![],'where':{'id':_0x5a937a[_0xd714('0x67')]['id']}},_0x2c1342={};_0x2c1342[_0xd714('0x4f')]=_[_0xd714('0x50')](_[_0xd714('0x51')](db[_0xd714('0x4e')][_0xd714('0x68')]),[_0xd714('0x69'),_0xd714('0x52')]);_0x2c1342[_0xd714('0x53')]=_['keys'](_0x5a937a[_0xd714('0x53')]);_0x2c1342[_0xd714('0x54')]=_[_0xd714('0x55')](_0x2c1342['model'],_0x2c1342['query']);_0x2ebb00[_0xd714('0x56')]=_['intersection'](_0x2c1342[_0xd714('0x4f')],qs['fields'](_0x5a937a['query'][_0xd714('0x57')]));_0x2ebb00[_0xd714('0x56')]=_0x2ebb00[_0xd714('0x56')][_0xd714('0x58')]?_0x2ebb00['attributes']:_0x2c1342[_0xd714('0x4f')];if(_0x5a937a['query']['includeAll']){_0x2ebb00[_0xd714('0x6a')]=[{'all':!![]}];}_0x2ebb00=_[_0xd714('0x63')]({},_0x2ebb00,_0x5a937a['options']);return db[_0xd714('0x4e')][_0xd714('0x45')](_0x2ebb00)[_0xd714('0x25')](handleEntityNotFound(_0x40ba01,null))['then'](respondWithResult(_0x40ba01,null))[_0xd714('0x30')](handleError(_0x40ba01,null));};exports[_0xd714('0x6b')]=function(_0x44126f,_0x18d48c){return db[_0xd714('0x4e')][_0xd714('0x6b')](_0x44126f[_0xd714('0x6c')],{'raw':![],'individualHooks':!![]})[_0xd714('0x25')](respondWithResult(_0x18d48c,0xc9))[_0xd714('0x30')](handleError(_0x18d48c,null));};exports['update']=function(_0x4c8b4d,_0x35ed76){if(_0x4c8b4d[_0xd714('0x6c')]['id']){delete _0x4c8b4d['body']['id'];}return db[_0xd714('0x4e')][_0xd714('0x45')]({'where':{'id':_0x4c8b4d[_0xd714('0x67')]['id']}})['then'](handleEntityNotFound(_0x35ed76,null))[_0xd714('0x25')](saveUpdates(_0x4c8b4d[_0xd714('0x6c')],null))[_0xd714('0x25')](respondWithResult(_0x35ed76,null))[_0xd714('0x30')](handleError(_0x35ed76,null));};exports[_0xd714('0x6d')]=function(_0x3514c1,_0x16b776){return db[_0xd714('0x4e')][_0xd714('0x6d')]()[_0xd714('0x25')](respondWithResult(_0x16b776,null))[_0xd714('0x30')](handleError(_0x16b776,null));};exports[_0xd714('0x6e')]=function(_0x2c17a3,_0x229459,_0xc47115){return db['User'][_0xd714('0x45')]({'where':{'id':_0x2c17a3[_0xd714('0x67')]['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x229459,null))['then'](function(_0x15b0db){if(_0x15b0db){return _0x15b0db['addContacts'](_0x2c17a3[_0xd714('0x6c')][_0xd714('0x6f')],_[_0xd714('0x70')](_0x2c17a3[_0xd714('0x6c')],['ids','id'])||{});}})[_0xd714('0x25')](respondWithResult(_0x229459,null))['catch'](handleError(_0x229459,null));};var getLicense=function(_0x5d3d2c){return new BPromise(function(_0x38c9f3,_0x25c54e){var _0xa1718a=0x0;_0x5d3d2c[_0xd714('0x6c')][_0xd714('0x47')]===_0xd714('0x3f')&&_0x38c9f3(_0xd714('0x71'));return db[_0xd714('0x4e')][_0xd714('0x35')]({'where':{'$or':[{'role':_0x5d3d2c[_0xd714('0x6c')][_0xd714('0x47')]===_0xd714('0x72')?_0xd714('0x72'):[_0xd714('0x73'),_0xd714('0x3e')]}]}})['then'](function(_0xa11219){_0xa1718a=_0xa11219;return require(_0xd714('0x74'))['getLicense']();})[_0xd714('0x25')](function(_0x2dd653){var _0x57b05a=_0x5d3d2c[_0xd714('0x6c')][_0xd714('0x47')]===_0xd714('0x72')?_0xd714('0x75'):'users';if(!_[_0xd714('0x76')](_0x2dd653[_0x57b05a])&&_0xa1718a>=_0x2dd653[_0x57b05a]){return _0x25c54e({'message':_0xd714('0x77')});}return _0x38c9f3(util['format'](_0xd714('0x78'),_0x57b05a,_0xa1718a));})[_0xd714('0x30')](function(_0x2d0f4a){return _0x25c54e(_0x2d0f4a);});});};exports[_0xd714('0x79')]=function(_0x55189e,_0x4870dc){return getLicense(_0x55189e)[_0xd714('0x25')](function(_0x452369){if(!_0x55189e['body']['internal']){var _0xa0c3fe;return db[_0xd714('0x7a')][_0xd714('0x7b')](0x1)[_0xd714('0x25')](function(_0x3c70b9){_0xa0c3fe=_0x3c70b9[_0xd714('0x7c')];return db[_0xd714('0x4e')][_0xd714('0x7d')](_0xd714('0x7e'));})[_0xd714('0x25')](function(_0x2be4b9){if(_[_0xd714('0x76')](_0x2be4b9)){if(_0xa0c3fe){_0x55189e[_0xd714('0x6c')][_0xd714('0x7e')]=_0xa0c3fe;}else{_0x55189e[_0xd714('0x6c')][_0xd714('0x7e')]=0x1;}}else{if(_['isNil'](_0xa0c3fe)||_0xa0c3fe==_0x2be4b9){_0x55189e[_0xd714('0x6c')][_0xd714('0x7e')]=_0x2be4b9+0x1;}else if(_0xa0c3fe>_0x2be4b9){_0x55189e[_0xd714('0x6c')]['internal']=_0xa0c3fe;}else{return db[_0xd714('0x5f')]['query'](_0xd714('0x7f'),{'type':db[_0xd714('0x5f')][_0xd714('0x80')][_0xd714('0x81')]})[_0xd714('0x25')](function(_0x1cf98e){if(_0x1cf98e&&_0x1cf98e[_0xd714('0x58')]){for(var _0x11ad80=0x0,_0x481b76=_0x1cf98e[_0xd714('0x58')];_0x11ad80<_0x481b76&&_['isNil'](_0x55189e[_0xd714('0x6c')][_0xd714('0x7e')]);_0x11ad80++){if(_0xa0c3fe<=_0x1cf98e[_0x11ad80][_0xd714('0x82')]){_0x55189e['body']['internal']=_0x1cf98e[_0x11ad80][_0xd714('0x82')];}else if(_0xa0c3fe>_0x1cf98e[_0x11ad80][_0xd714('0x82')]&&_0xa0c3fe<=_0x1cf98e[_0x11ad80]['to']){_0x55189e[_0xd714('0x6c')][_0xd714('0x7e')]=_0xa0c3fe;}}}if(_[_0xd714('0x76')](_0x55189e[_0xd714('0x6c')][_0xd714('0x7e')])){_0x55189e['body'][_0xd714('0x7e')]=_0x2be4b9+0x1;}});}}});}})[_0xd714('0x25')](function(){if(_0x55189e[_0xd714('0x6c')][_0xd714('0x83')]){_0x55189e[_0xd714('0x6c')]['mailbox']=_0x55189e['body'][_0xd714('0x7e')];_0x55189e['body'][_0xd714('0x84')]={'mailbox':_0x55189e[_0xd714('0x6c')][_0xd714('0x7e')],'password':_0x55189e[_0xd714('0x6c')]['password'],'fullname':_0x55189e[_0xd714('0x6c')]['fullname'],'email':_0x55189e[_0xd714('0x6c')][_0xd714('0x85')]};}if(_0x55189e[_0xd714('0x6c')]&&_0x55189e[_0xd714('0x6c')]['role']===_0xd714('0x3f')){_0x55189e['body'][_0xd714('0x86')]=['101',_0xd714('0x87'),'103',_0xd714('0x88'),_0xd714('0x89'),_0xd714('0x8a'),_0xd714('0x8b'),_0xd714('0x8c'),_0xd714('0x8d'),_0xd714('0x8e'),_0xd714('0x8f'),_0xd714('0x90')];}return db['User'][_0xd714('0x79')](_0x55189e[_0xd714('0x6c')],{'include':[{'model':db[_0xd714('0x84')],'as':_0xd714('0x84')}]});})['then'](function(_0x35b162){if(_0x55189e[_0xd714('0x6c')][_0xd714('0x47')]===_0xd714('0x3e'))return _0x35b162;var _0x4b84d8=_0x55189e['user'][_0xd714('0x3c')]({'plain':!![]});if(!_0x4b84d8)throw new Error(_0xd714('0x91'));if(_0x4b84d8['role']===_0xd714('0x3e')){var _0x3fdef6=_0x35b162[_0xd714('0x3c')]({'plain':!![]});var _0x4b3c65=[{'name':_0xd714('0x92'),'value':_0xd714('0x3f')},{'name':_0xd714('0x40'),'value':'telephone'}];var _0x42495e=_['find'](_0x4b3c65,['value',_0x3fdef6[_0xd714('0x47')]])[_0xd714('0x48')];return db[_0xd714('0x93')][_0xd714('0x45')]({'where':{'name':_0x42495e,'userProfileId':_0x4b84d8[_0xd714('0x94')]},'raw':!![]})[_0xd714('0x25')](function(_0x520a96){if(_0x520a96&&_0x520a96[_0xd714('0x95')]===0x0){return db[_0xd714('0x49')][_0xd714('0x79')]({'name':_0x3fdef6['name'],'resourceId':_0x3fdef6['id'],'type':_0x520a96['name'],'sectionId':_0x520a96['id']},{})['then'](function(){return _0x35b162;});}else{return _0x35b162;}})[_0xd714('0x30')](function(_0x100373){logger[_0xd714('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x100373);throw _0x100373;});}return _0x35b162;})[_0xd714('0x25')](respondWithResult(_0x4870dc,0xc9))[_0xd714('0x30')](handleError(_0x4870dc,null));};exports[_0xd714('0x96')]=function(_0x556fdc,_0x5471e8,_0x850cc6){if(_0x556fdc[_0xd714('0x6c')]['id']){delete _0x556fdc[_0xd714('0x6c')]['id'];}return db[_0xd714('0x4e')][_0xd714('0x45')]({'where':{'id':_0x556fdc['params']['id']}})[_0xd714('0x25')](function(_0x2b5103){if(_0x2b5103){if(_0x2b5103['id']==_0x556fdc['user']['id']){if(!_0x556fdc[_0xd714('0x6c')][_0xd714('0x97')]||!_0x556fdc['body'][_0xd714('0x98')]){throw new db['Sequelize'][(_0xd714('0x99'))]('Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword');}if(!_0x2b5103[_0xd714('0x9a')](_0x556fdc[_0xd714('0x6c')][_0xd714('0x97')])){throw new db['Sequelize'][(_0xd714('0x99'))]('Wrong\x20credentials');}if(_0x556fdc[_0xd714('0x6c')]['oldPassword']==_0x556fdc[_0xd714('0x6c')][_0xd714('0x98')]){throw new db[(_0xd714('0x9b'))]['ValidationError'](_0xd714('0x9c'));}return _0x2b5103;}else if(_0x556fdc[_0xd714('0x3e')][_0xd714('0x47')]==_0xd714('0x73')){if(!_0x556fdc[_0xd714('0x6c')][_0xd714('0x98')]){throw new db['Sequelize']['ValidationError'](_0xd714('0x9d'));}return _0x2b5103;}else if(_0x556fdc[_0xd714('0x3e')][_0xd714('0x47')]==_0xd714('0x3e')){if(!_0x556fdc['body'][_0xd714('0x98')]){throw new db[(_0xd714('0x9b'))][(_0xd714('0x99'))](_0xd714('0x9d'));}if(_0x2b5103[_0xd714('0x47')]!=_0xd714('0x3f')){throw new db[(_0xd714('0x9b'))]['ValidationError']('Unauthorized');}return _0x2b5103;}else{throw new db[(_0xd714('0x9b'))]['ValidationError'](_0xd714('0x9e'));}}return null;})[_0xd714('0x25')](handleEntityNotFound(_0x5471e8,null))[_0xd714('0x25')](saveUpdates({'password':_0x556fdc['body'][_0xd714('0x98')],'passwordResetAt':_0x556fdc['user']['id']==_0x556fdc['params']['id']?moment():null},null))['then'](respondWithResult(_0x5471e8,null))[_0xd714('0x30')](handleError(_0x5471e8,null));};exports['addQueues']=function(_0x2d5e3e,_0x5f2d26,_0x5be542){var _0x3edf1c;return db['User']['find']({'where':{'id':_0x2d5e3e[_0xd714('0x67')]['id']},'attributes':['id',_0xd714('0x48'),_0xd714('0x47'),'loginInPause',_0xd714('0x9f'),_0xd714('0xa0')]})[_0xd714('0x25')](handleEntityNotFound(_0x5f2d26,null))[_0xd714('0x25')](function(_0x27bbc7){if(_0x27bbc7){_0x3edf1c=_0x27bbc7;if(!utils[_0xd714('0xa1')](_0x2d5e3e[_0xd714('0x6c')][_0xd714('0xa2')])){throw new db[(_0xd714('0x9b'))][(_0xd714('0x99'))](_0xd714('0xa3'));}return _0x27bbc7[_0xd714('0xa4')+_[_0xd714('0xa5')](_0x2d5e3e['body']['channel']['toLowerCase']())+_0xd714('0xa6')](_0x2d5e3e[_0xd714('0x6c')][_0xd714('0x6f')],{'penalty':_0x2d5e3e[_0xd714('0x6c')][_0xd714('0xa7')]||0x0});}})[_0xd714('0xa8')](function(_0x17eb13){for(var _0x482768=0x0;_0x482768<_0x2d5e3e['body'][_0xd714('0x6f')]['length'];_0x482768+=0x1){var _0x57e8f7={'UserId':_0x2d5e3e['params']['id']};_0x57e8f7[_[_0xd714('0xa5')](_0x2d5e3e[_0xd714('0x6c')]['channel'][_0xd714('0xa9')]())+'QueueId']=_0x2d5e3e[_0xd714('0x6c')]['ids'][_0x482768];socket[_0xd714('0xaa')](_0xd714('0x3e')+_[_0xd714('0xa5')](_0x2d5e3e[_0xd714('0x6c')][_0xd714('0xa2')][_0xd714('0xa9')]())+_0xd714('0xab'),_0x57e8f7);}return _0x17eb13;})[_0xd714('0x25')](function(){if(_0x2d5e3e[_0xd714('0x6c')][_0xd714('0xa2')]===_0xd714('0xac')){return db[_0xd714('0xad')][_0xd714('0x65')]({'where':{'id':_0x2d5e3e[_0xd714('0x6c')][_0xd714('0x6f')]||[]},'raw':!![],'attributes':['id',_0xd714('0x48')]});}})[_0xd714('0x25')](function(_0x150ecc){var _0x2abfc8=[];if(_0x2d5e3e[_0xd714('0x6c')][_0xd714('0xa2')]===_0xd714('0xac')&&_0x3edf1c[_0xd714('0x47')]==='agent'){for(var _0xcf7d20=0x0;_0xcf7d20<_0x150ecc[_0xd714('0x58')];_0xcf7d20+=0x1){_0x2abfc8[_0xd714('0xae')]({'membername':_0x3edf1c[_0xd714('0x48')],'UserId':_0x3edf1c['id'],'queue_name':_0x150ecc[_0xcf7d20]['name'],'VoiceQueueId':_0x150ecc[_0xcf7d20]['id'],'interface':_[_0xd714('0x76')](_0x3edf1c[_0xd714('0xa0')])?util[_0xd714('0xaf')]('SIP/%s',_0x3edf1c['name']):_0x3edf1c[_0xd714('0xa0')],'paused':_0x3edf1c[_0xd714('0x9f')]||![],'penalty':_0x2d5e3e[_0xd714('0x6c')][_0xd714('0xa7')]||0x0});}return BPromise['each'](_0x2abfc8,function(_0x205057){return db['UserVoiceQueueRt'][_0xd714('0xb0')](_0x205057);});}return _0x3edf1c;})[_0xd714('0x25')](respondWithStatusCode(_0x5f2d26,null))[_0xd714('0x30')](handleError(_0x5f2d26,null));};exports[_0xd714('0xb1')]=function(_0x6405eb,_0x51d56d,_0x1ea1eb){var _0x7654d8;return db[_0xd714('0x4e')][_0xd714('0x45')]({'where':{'id':_0x6405eb[_0xd714('0x67')]['id']},'attributes':['id','name',_0xd714('0x47')]})[_0xd714('0x25')](handleEntityNotFound(_0x51d56d,null))[_0xd714('0x25')](function(_0x4d28ce){if(_0x4d28ce){_0x7654d8=_0x4d28ce;if(!_0x6405eb[_0xd714('0x53')][_0xd714('0xa2')]||!utils[_0xd714('0xa1')](_0x6405eb[_0xd714('0x53')]['channel'])){throw new db[(_0xd714('0x9b'))][(_0xd714('0x99'))](_0xd714('0xa3'));}return _0x4d28ce[_0xd714('0xb2')+_['capitalize'](_0x6405eb[_0xd714('0x53')][_0xd714('0xa2')][_0xd714('0xa9')]())+_0xd714('0xa6')](_0x6405eb[_0xd714('0x53')]['ids']);}})[_0xd714('0x25')](function(_0xb58181){for(var _0x186fcb=0x0;_0x186fcb<_0x6405eb['query']['ids'][_0xd714('0x58')];_0x186fcb+=0x1){var _0x2c6fa1={'UserId':_0x6405eb['params']['id']};_0x2c6fa1[_[_0xd714('0xa5')](_0x6405eb[_0xd714('0x53')][_0xd714('0xa2')][_0xd714('0xa9')]())+_0xd714('0xb3')]=_0x6405eb[_0xd714('0x53')][_0xd714('0x6f')][_0x186fcb];socket['emit'](_0xd714('0x3e')+_[_0xd714('0xa5')](_0x6405eb[_0xd714('0x53')]['channel'][_0xd714('0xa9')]())+_0xd714('0xb4'),_0x2c6fa1);}return _0xb58181;})[_0xd714('0x25')](function(){if(_0x6405eb[_0xd714('0x53')][_0xd714('0xa2')]===_0xd714('0xac')){return db[_0xd714('0xb5')][_0xd714('0x4a')]({'where':{'UserId':_0x6405eb['params']['id'],'VoiceQueueId':_0x6405eb[_0xd714('0x53')][_0xd714('0x6f')]},'individualHooks':!![]})['then'](function(){return _0x7654d8;});}return _0x7654d8;})[_0xd714('0x25')](respondWithStatusCode(_0x51d56d,null))[_0xd714('0x30')](handleError(_0x51d56d,null));};exports[_0xd714('0xb6')]=function(_0x5b8324,_0x1b46df,_0x52b085){_0x5b8324[_0xd714('0x6c')][_0xd714('0xb7')]=_0x5b8324[_0xd714('0xb8')]['filename'];return db[_0xd714('0x4e')]['find']({'where':{'id':_0x5b8324[_0xd714('0x67')]['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x1b46df,null))['then'](saveUpdates(_0x5b8324[_0xd714('0x6c')],null))['then'](respondWithResult(_0x1b46df,null))['catch'](handleError(_0x1b46df,null));};exports[_0xd714('0xb9')]=function(_0xbfaa3,_0x2ebe4b,_0x40b976){var _0x39c6b2=path[_0xd714('0xba')](config[_0xd714('0xbb')],_0xd714('0xbc'));return db[_0xd714('0x4e')][_0xd714('0x45')]({'where':{'id':_0xbfaa3['params']['id']},'attributes':['id',_0xd714('0xb7')],'raw':!![]})[_0xd714('0x25')](handleEntityNotFound(_0x2ebe4b,null))['then'](function(_0xb4057b){if(_0xb4057b){if(_['isNil'](_0xb4057b['userpic'])){return _0x2ebe4b[_0xd714('0xbd')](_0x39c6b2);}else{if(!fs[_0xd714('0xbe')](path['join'](config[_0xd714('0xbb')],_0xd714('0xbf'),_0xb4057b['userpic']))){return _0x2ebe4b['download'](_0x39c6b2);}return _0x2ebe4b['download'](path[_0xd714('0xba')](config['root'],_0xd714('0xbf'),_0xb4057b[_0xd714('0xb7')]));}}})[_0xd714('0x30')](handleError(_0x2ebe4b,null));};exports[_0xd714('0xc0')]=function(_0x22e5be,_0x498e56,_0x35b505){var _0x3d45c5={};var _0x502be4={};var _0x44a93f;var _0x546ebb;return db['User'][_0xd714('0xc1')]({'where':{'id':_0x22e5be[_0xd714('0x67')]['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x498e56,null))[_0xd714('0x25')](function(_0x15ebd7){if(_0x15ebd7){_0x44a93f=_0x15ebd7;_0x502be4['model']=_['keys'](db[_0xd714('0xc2')]['rawAttributes']);_0x502be4[_0xd714('0x53')]=_[_0xd714('0x51')](_0x22e5be[_0xd714('0x53')]);_0x502be4[_0xd714('0x54')]=_['intersection'](_0x502be4[_0xd714('0x4f')],_0x502be4[_0xd714('0x53')]);_0x3d45c5[_0xd714('0x56')]=_[_0xd714('0x55')](_0x502be4[_0xd714('0x4f')],qs[_0xd714('0x57')](_0x22e5be[_0xd714('0x53')][_0xd714('0x57')]));_0x3d45c5[_0xd714('0x56')]=_0x3d45c5[_0xd714('0x56')]['length']?_0x3d45c5['attributes']:_0x502be4[_0xd714('0x4f')];_0x3d45c5['order']=qs[_0xd714('0x5c')](_0x22e5be[_0xd714('0x53')][_0xd714('0x5c')]);_0x3d45c5[_0xd714('0x5d')]=qs['filters'](_[_0xd714('0x5e')](_0x22e5be[_0xd714('0x53')],_0x502be4['filters']));if(_0x22e5be[_0xd714('0x53')][_0xd714('0x41')]){_0x3d45c5[_0xd714('0x5d')]=_[_0xd714('0x63')](_0x3d45c5[_0xd714('0x5d')],{'$or':_[_0xd714('0x43')](_0x3d45c5[_0xd714('0x56')],function(_0x518bc9){var _0x136eaf={};_0x136eaf[_0x518bc9]={'$like':'%'+_0x22e5be[_0xd714('0x53')][_0xd714('0x41')]+'%'};return _0x136eaf;})});}_0x3d45c5=_[_0xd714('0x63')]({},_0x3d45c5,_0x22e5be['options']);return _0x44a93f[_0xd714('0xc0')](_0x3d45c5);}})[_0xd714('0x25')](function(_0x4d17c7){if(_0x4d17c7){_0x546ebb=_0x4d17c7['length'];if(_0x22e5be['query'][_0xd714('0x59')](_0xd714('0x64'))){_0x3d45c5[_0xd714('0x6a')]=[{'model':db[_0xd714('0xc3')],'as':_0xd714('0xc4'),'required':![]},{'model':db[_0xd714('0xc5')],'as':_0xd714('0xc6'),'attributes':['id','name',_0xd714('0xc7')],'where':_0x22e5be[_0xd714('0x53')][_0xd714('0xc8')]?{'id':_0x22e5be[_0xd714('0x53')][_0xd714('0xc8')]}:undefined,'required':_0x22e5be[_0xd714('0x53')][_0xd714('0xc8')]?!![]:![]}];}if(!_0x22e5be[_0xd714('0x53')]['hasOwnProperty']('nolimit')){_0x3d45c5[_0xd714('0x37')]=qs['limit'](_0x22e5be['query']['limit']);_0x3d45c5[_0xd714('0x36')]=qs[_0xd714('0x36')](_0x22e5be[_0xd714('0x53')]['offset']);}return _0x44a93f[_0xd714('0xc0')](_0x3d45c5);}})[_0xd714('0x25')](function(_0x421d75){if(_0x421d75){return _0x421d75?{'count':_0x546ebb,'rows':_0x421d75}:null;}})[_0xd714('0x25')](respondWithResult(_0x498e56,null))[_0xd714('0x30')](handleError(_0x498e56,null));};exports[_0xd714('0xc9')]=function(_0xf92e90,_0x1a653b,_0x333605){var _0x2f6080;var _0x448408;var _0xe48e99={};var _0x467c98;return db[_0xd714('0x4e')][_0xd714('0xc1')]({'where':{'id':_0xf92e90[_0xd714('0x67')]['id']},'attributes':['id','name',_0xd714('0x47')]})[_0xd714('0x25')](handleEntityNotFound(_0x1a653b,null))['then'](function(_0x450797){if(!utils['isValidChannel'](_0xf92e90['query'][_0xd714('0xa2')])){throw new db[(_0xd714('0x9b'))][(_0xd714('0x99'))](_0xd714('0xa3'));}_0x2f6080=_0x450797;var _0x79ac4c={};_0x79ac4c[_0xd714('0x4f')]=_[_0xd714('0x51')](db[_['capitalize'](_0xf92e90[_0xd714('0x53')]['channel'])+_0xd714('0xca')]['rawAttributes']);_0x79ac4c[_0xd714('0x53')]=_[_0xd714('0x51')](_0xf92e90['query']);_0x79ac4c[_0xd714('0x54')]=_['intersection'](_0x79ac4c[_0xd714('0x4f')],_0x79ac4c['query']);_0xe48e99['attributes']=_[_0xd714('0x55')](_0x79ac4c[_0xd714('0x4f')],qs[_0xd714('0x57')](_0xf92e90['query'][_0xd714('0x57')]));_0xe48e99[_0xd714('0x56')]=_0xe48e99[_0xd714('0x56')][_0xd714('0x58')]?_0xe48e99[_0xd714('0x56')]:_0x79ac4c[_0xd714('0x4f')];_0xe48e99[_0xd714('0x5b')]=qs[_0xd714('0x5c')](_0xf92e90[_0xd714('0x53')][_0xd714('0x5c')]);_0xe48e99[_0xd714('0x5d')]=qs['filters'](_[_0xd714('0x5e')](_0xf92e90[_0xd714('0x53')],_0x79ac4c[_0xd714('0x54')]));if(_0xf92e90[_0xd714('0x53')]['filter']){_0xe48e99[_0xd714('0x5d')]=_[_0xd714('0x63')](_0xe48e99[_0xd714('0x5d')],{'$or':_[_0xd714('0x43')](_0xe48e99[_0xd714('0x56')],function(_0x4c78ab){var _0x5bd3ad={};_0x5bd3ad[_0x4c78ab]={'$like':'%'+_0xf92e90[_0xd714('0x53')]['filter']+'%'};return _0x5bd3ad;})});}_0xe48e99=_[_0xd714('0x63')]({},_0xe48e99,_0xf92e90[_0xd714('0xcb')]);switch(_0x2f6080[_0xd714('0x47')]){case _0xd714('0x73'):return db[_[_0xd714('0xa5')](_0xf92e90['query'][_0xd714('0xa2')])+_0xd714('0xca')][_0xd714('0x65')](_0xe48e99);case _0xd714('0x3e'):case _0xd714('0x3f'):return _0x2f6080['get'+_[_0xd714('0xa5')](_0xf92e90[_0xd714('0x53')][_0xd714('0xa2')])+_0xd714('0xa6')](_0xe48e99);default:throw new db['Sequelize'][(_0xd714('0x99'))](_0xd714('0xcc'));}})[_0xd714('0x25')](function(_0x5be70a){_0x467c98=_0x5be70a['length'];if(!_0xf92e90['query'][_0xd714('0x59')](_0xd714('0x5a'))){_0xe48e99[_0xd714('0x37')]=qs[_0xd714('0x37')](_0xf92e90[_0xd714('0x53')][_0xd714('0x37')]);_0xe48e99[_0xd714('0x36')]=qs[_0xd714('0x36')](_0xf92e90[_0xd714('0x53')]['offset']);}switch(_0x2f6080[_0xd714('0x47')]){case _0xd714('0x73'):return db[_[_0xd714('0xa5')](_0xf92e90[_0xd714('0x53')][_0xd714('0xa2')])+_0xd714('0xca')]['findAll'](_0xe48e99);case'user':case'agent':return _0x2f6080[_0xd714('0x3c')+_[_0xd714('0xa5')](_0xf92e90['query'][_0xd714('0xa2')])+'Queues'](_0xe48e99);}})[_0xd714('0x25')](function(_0x1b08d6){return{'count':_0x467c98,'rows':_0x1b08d6};})[_0xd714('0x25')](respondWithResult(_0x1a653b,null))['catch'](handleError(_0x1a653b,null));};exports[_0xd714('0xcd')]=function(_0x4e7042,_0x2750a7,_0x4f7f81){var _0x584886={};var _0xdc08cf={};var _0x591b59;var _0x2cf27f;return db['User'][_0xd714('0xc1')]({'where':{'id':_0x4e7042[_0xd714('0x67')]['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x2750a7,null))['then'](function(_0x50fc63){if(_0x50fc63){_0x591b59=_0x50fc63;_0xdc08cf[_0xd714('0x4f')]=_['keys'](db[_0xd714('0xb5')]['rawAttributes']);_0xdc08cf[_0xd714('0x53')]=_[_0xd714('0x51')](_0x4e7042[_0xd714('0x53')]);_0xdc08cf[_0xd714('0x54')]=_[_0xd714('0x55')](_0xdc08cf[_0xd714('0x4f')],_0xdc08cf[_0xd714('0x53')]);_0x584886[_0xd714('0x56')]=_[_0xd714('0x55')](_0xdc08cf[_0xd714('0x4f')],qs['fields'](_0x4e7042[_0xd714('0x53')][_0xd714('0x57')]));_0x584886[_0xd714('0x56')]=_0x584886[_0xd714('0x56')][_0xd714('0x58')]?_0x584886[_0xd714('0x56')]:_0xdc08cf['model'];_0x584886[_0xd714('0x5b')]=qs[_0xd714('0x5c')](_0x4e7042[_0xd714('0x53')]['sort']);_0x584886[_0xd714('0x5d')]=qs[_0xd714('0x54')](_[_0xd714('0x5e')](_0x4e7042[_0xd714('0x53')],_0xdc08cf[_0xd714('0x54')]));if(_0x4e7042[_0xd714('0x53')][_0xd714('0x41')]){_0x584886[_0xd714('0x5d')]=_[_0xd714('0x63')](_0x584886[_0xd714('0x5d')],{'$or':_[_0xd714('0x43')](_0x584886[_0xd714('0x56')],function(_0xe1923d){var _0x12afa6={};_0x12afa6[_0xe1923d]={'$like':'%'+_0x4e7042['query']['filter']+'%'};return _0x12afa6;})});}_0x584886=_[_0xd714('0x63')]({},_0x584886,_0x4e7042[_0xd714('0xcb')]);return _0x591b59[_0xd714('0xcd')](_0x584886);}})[_0xd714('0x25')](function(_0x220948){if(_0x220948){_0x2cf27f=_0x220948['length'];if(!_0x4e7042[_0xd714('0x53')][_0xd714('0x59')](_0xd714('0x5a'))){_0x584886[_0xd714('0x37')]=qs[_0xd714('0x37')](_0x4e7042[_0xd714('0x53')][_0xd714('0x37')]);_0x584886['offset']=qs['offset'](_0x4e7042[_0xd714('0x53')]['offset']);}return _0x591b59[_0xd714('0xcd')](_0x584886);}})[_0xd714('0x25')](function(_0x367dc5){if(_0x367dc5){return _0x367dc5?{'count':_0x2cf27f,'rows':_0x367dc5}:null;}})[_0xd714('0x25')](respondWithResult(_0x2750a7,null))[_0xd714('0x30')](handleError(_0x2750a7,null));};exports[_0xd714('0xce')]=function(_0x2f7e60,_0x140d8f,_0x22b4e3){var _0x2c2920={};var _0x1b00c0={};var _0xfe772;var _0x22584c;return db['User'][_0xd714('0xc1')]({'where':{'id':_0x2f7e60[_0xd714('0x67')]['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x140d8f,null))['then'](function(_0x3b9875){if(_0x3b9875){_0xfe772=_0x3b9875;_0x1b00c0['model']=_[_0xd714('0x51')](db[_0xd714('0xcf')][_0xd714('0x68')]);_0x1b00c0[_0xd714('0x53')]=_[_0xd714('0x51')](_0x2f7e60[_0xd714('0x53')]);_0x1b00c0[_0xd714('0x54')]=_[_0xd714('0x55')](_0x1b00c0['model'],_0x1b00c0['query']);_0x2c2920['attributes']=_[_0xd714('0x55')](_0x1b00c0[_0xd714('0x4f')],qs[_0xd714('0x57')](_0x2f7e60[_0xd714('0x53')][_0xd714('0x57')]));_0x2c2920[_0xd714('0x56')]=_0x2c2920[_0xd714('0x56')][_0xd714('0x58')]?_0x2c2920[_0xd714('0x56')]:_0x1b00c0['model'];_0x2c2920['order']=qs['sort'](_0x2f7e60[_0xd714('0x53')][_0xd714('0x5c')]);_0x2c2920[_0xd714('0x5d')]=qs[_0xd714('0x54')](_[_0xd714('0x5e')](_0x2f7e60[_0xd714('0x53')],_0x1b00c0[_0xd714('0x54')]));if(_0x2f7e60[_0xd714('0x53')][_0xd714('0x41')]){_0x2c2920[_0xd714('0x5d')]=_['merge'](_0x2c2920[_0xd714('0x5d')],{'$or':_['map'](_0x2c2920['attributes'],function(_0x5843f5){var _0x149373={};_0x149373[_0x5843f5]={'$like':'%'+_0x2f7e60['query']['filter']+'%'};return _0x149373;})});}_0x2c2920=_[_0xd714('0x63')]({},_0x2c2920,_0x2f7e60[_0xd714('0xcb')]);return _0xfe772['getGroups'](_0x2c2920);}})[_0xd714('0x25')](function(_0xd5f73c){if(_0xd5f73c){_0x22584c=_0xd5f73c[_0xd714('0x58')];if(!_0x2f7e60[_0xd714('0x53')]['hasOwnProperty'](_0xd714('0x5a'))){_0x2c2920['limit']=qs[_0xd714('0x37')](_0x2f7e60[_0xd714('0x53')]['limit']);_0x2c2920[_0xd714('0x36')]=qs['offset'](_0x2f7e60[_0xd714('0x53')]['offset']);}return _0xfe772[_0xd714('0xce')](_0x2c2920);}})[_0xd714('0x25')](function(_0x181d33){if(_0x181d33){return _0x181d33?{'count':_0x22584c,'rows':_0x181d33}:null;}})[_0xd714('0x25')](respondWithResult(_0x140d8f,null))[_0xd714('0x30')](handleError(_0x140d8f,null));};exports[_0xd714('0xd0')]=function(_0x541f4e,_0x5cc5bf,_0x2ab1d2){var _0xe251f9={'raw':!![],'where':{}};var _0x52c282={};var _0x1700a3={'count':0x0,'rows':[]};return db[_0xd714('0x4e')][_0xd714('0xc1')]({'where':{'id':_0x541f4e[_0xd714('0x67')]['id']}})['then'](handleEntityNotFound(_0x5cc5bf,null))[_0xd714('0x25')](function(_0xf55c40){if(_0xf55c40){_0x52c282['model']=_['keys'](db[_0xd714('0xd1')][_0xd714('0x68')]);_0x52c282[_0xd714('0x53')]=_[_0xd714('0x51')](_0x541f4e[_0xd714('0x53')]);_0x52c282[_0xd714('0x54')]=_['intersection'](_0x52c282['model'],_0x52c282['query']);_0xe251f9[_0xd714('0x56')]=_['intersection'](_0x52c282[_0xd714('0x4f')],qs[_0xd714('0x57')](_0x541f4e[_0xd714('0x53')][_0xd714('0x57')]));_0xe251f9[_0xd714('0x56')]=_0xe251f9[_0xd714('0x56')][_0xd714('0x58')]?_0xe251f9[_0xd714('0x56')]:_0x52c282[_0xd714('0x4f')];if(!_0x541f4e['query'][_0xd714('0x59')](_0xd714('0x5a'))){_0xe251f9['limit']=qs[_0xd714('0x37')](_0x541f4e[_0xd714('0x53')][_0xd714('0x37')]);_0xe251f9[_0xd714('0x36')]=qs[_0xd714('0x36')](_0x541f4e[_0xd714('0x53')][_0xd714('0x36')]);}_0xe251f9[_0xd714('0x5b')]=qs[_0xd714('0x5c')](_0x541f4e[_0xd714('0x53')][_0xd714('0x5c')]);_0xe251f9[_0xd714('0x5d')]=qs[_0xd714('0x54')](_[_0xd714('0x5e')](_0x541f4e[_0xd714('0x53')],_0x52c282[_0xd714('0x54')]));_0xe251f9[_0xd714('0x5d')][_0xd714('0xd2')]=_0xf55c40['id'];if(_0x541f4e[_0xd714('0x53')][_0xd714('0x41')]){_0xe251f9[_0xd714('0x5d')]=_[_0xd714('0x63')](_0xe251f9['where'],{'$or':_['map'](_0xe251f9[_0xd714('0x56')],function(_0x308d8b){var _0x2ee0ae={};_0x2ee0ae[_0x308d8b]={'$like':'%'+_0x541f4e[_0xd714('0x53')][_0xd714('0x41')]+'%'};return _0x2ee0ae;})});}_0xe251f9=_[_0xd714('0x63')]({},_0xe251f9,_0x541f4e[_0xd714('0xcb')]);return db['VoiceRecording']['count']({'where':_0xe251f9[_0xd714('0x5d')]})['then'](function(_0x5db068){_0x1700a3['count']=_0x5db068;if(_0x541f4e['query'][_0xd714('0x64')]){_0xe251f9[_0xd714('0x6a')]=[{'all':!![]}];}return db[_0xd714('0xd1')][_0xd714('0x65')](_0xe251f9);})[_0xd714('0x25')](function(_0x5022b5){_0x1700a3[_0xd714('0x66')]=_0x5022b5;return _0x1700a3;});}})['then'](respondWithFilteredResult(_0x5cc5bf,_0xe251f9))[_0xd714('0x30')](handleError(_0x5cc5bf,null));};exports[_0xd714('0xd3')]=function(_0x10b526,_0x48740d,_0x44356e){var _0x3bc24c={};var _0x1f1712={};var _0x426d2f;var _0x3c82de;return db[_0xd714('0x4e')]['findOne']({'where':{'id':_0x10b526[_0xd714('0x67')]['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x48740d,null))['then'](function(_0x597e76){if(_0x597e76){_0x426d2f=_0x597e76;_0x1f1712[_0xd714('0x4f')]=_[_0xd714('0x51')](db[_0xd714('0xd4')][_0xd714('0x68')]);_0x1f1712['query']=_[_0xd714('0x51')](_0x10b526[_0xd714('0x53')]);_0x1f1712['filters']=_[_0xd714('0x55')](_0x1f1712['model'],_0x1f1712['query']);_0x3bc24c[_0xd714('0x56')]=_[_0xd714('0x55')](_0x1f1712[_0xd714('0x4f')],qs[_0xd714('0x57')](_0x10b526[_0xd714('0x53')][_0xd714('0x57')]));_0x3bc24c[_0xd714('0x56')]=_0x3bc24c['attributes']['length']?_0x3bc24c['attributes']:_0x1f1712[_0xd714('0x4f')];_0x3bc24c[_0xd714('0x5b')]=qs['sort'](_0x10b526['query'][_0xd714('0x5c')]);_0x3bc24c[_0xd714('0x5d')]=qs['filters'](_[_0xd714('0x5e')](_0x10b526[_0xd714('0x53')],_0x1f1712[_0xd714('0x54')]));if(_0x10b526[_0xd714('0x53')][_0xd714('0x41')]){_0x3bc24c[_0xd714('0x5d')]=_[_0xd714('0x63')](_0x3bc24c[_0xd714('0x5d')],{'$or':_[_0xd714('0x43')](_0x3bc24c[_0xd714('0x56')],function(_0x1f1242){var _0x19c6b1={};_0x19c6b1[_0x1f1242]={'$like':'%'+_0x10b526[_0xd714('0x53')][_0xd714('0x41')]+'%'};return _0x19c6b1;})});}_0x3bc24c=_[_0xd714('0x63')]({},_0x3bc24c,_0x10b526['options']);return _0x426d2f['getChatInteractions'](_0x3bc24c);}})[_0xd714('0x25')](function(_0x235b08){if(_0x235b08){_0x3c82de=_0x235b08['length'];if(!_0x10b526[_0xd714('0x53')][_0xd714('0x59')](_0xd714('0x5a'))){_0x3bc24c[_0xd714('0x37')]=qs[_0xd714('0x37')](_0x10b526['query'][_0xd714('0x37')]);_0x3bc24c[_0xd714('0x36')]=qs['offset'](_0x10b526[_0xd714('0x53')][_0xd714('0x36')]);}return _0x426d2f[_0xd714('0xd3')](_0x3bc24c);}})[_0xd714('0x25')](function(_0x9017ea){if(_0x9017ea){return _0x9017ea?{'count':_0x3c82de,'rows':_0x9017ea}:null;}})['then'](respondWithResult(_0x48740d,null))[_0xd714('0x30')](handleError(_0x48740d,null));};exports[_0xd714('0xd5')]=function(_0x20693e,_0x2e0571,_0x369f52){var _0x41c91d={};var _0x2e5337={};var _0x27baae;var _0x140de1;return db[_0xd714('0x4e')][_0xd714('0xc1')]({'where':{'id':_0x20693e[_0xd714('0x67')]['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x2e0571,null))['then'](function(_0x2db428){if(_0x2db428){_0x27baae=_0x2db428;_0x2e5337['model']=_[_0xd714('0x51')](db['OpenchannelInteraction'][_0xd714('0x68')]);_0x2e5337[_0xd714('0x53')]=_[_0xd714('0x51')](_0x20693e[_0xd714('0x53')]);_0x2e5337[_0xd714('0x54')]=_[_0xd714('0x55')](_0x2e5337[_0xd714('0x4f')],_0x2e5337[_0xd714('0x53')]);_0x41c91d[_0xd714('0x56')]=_[_0xd714('0x55')](_0x2e5337['model'],qs[_0xd714('0x57')](_0x20693e[_0xd714('0x53')]['fields']));_0x41c91d[_0xd714('0x56')]=_0x41c91d[_0xd714('0x56')][_0xd714('0x58')]?_0x41c91d['attributes']:_0x2e5337[_0xd714('0x4f')];_0x41c91d['order']=qs[_0xd714('0x5c')](_0x20693e[_0xd714('0x53')][_0xd714('0x5c')]);_0x41c91d[_0xd714('0x5d')]=qs[_0xd714('0x54')](_[_0xd714('0x5e')](_0x20693e[_0xd714('0x53')],_0x2e5337[_0xd714('0x54')]));if(_0x20693e[_0xd714('0x53')][_0xd714('0x41')]){_0x41c91d['where']=_['merge'](_0x41c91d[_0xd714('0x5d')],{'$or':_[_0xd714('0x43')](_0x41c91d[_0xd714('0x56')],function(_0xb72a7f){var _0x361dd5={};_0x361dd5[_0xb72a7f]={'$like':'%'+_0x20693e[_0xd714('0x53')][_0xd714('0x41')]+'%'};return _0x361dd5;})});}_0x41c91d=_['merge']({},_0x41c91d,_0x20693e[_0xd714('0xcb')]);return _0x27baae[_0xd714('0xd5')](_0x41c91d);}})[_0xd714('0x25')](function(_0x44d654){if(_0x44d654){_0x140de1=_0x44d654[_0xd714('0x58')];if(!_0x20693e[_0xd714('0x53')][_0xd714('0x59')](_0xd714('0x5a'))){_0x41c91d['limit']=qs[_0xd714('0x37')](_0x20693e['query']['limit']);_0x41c91d[_0xd714('0x36')]=qs[_0xd714('0x36')](_0x20693e[_0xd714('0x53')][_0xd714('0x36')]);}return _0x27baae['getOpenchannelInteractions'](_0x41c91d);}})[_0xd714('0x25')](function(_0x5beaff){if(_0x5beaff){return _0x5beaff?{'count':_0x140de1,'rows':_0x5beaff}:null;}})[_0xd714('0x25')](respondWithResult(_0x2e0571,null))[_0xd714('0x30')](handleError(_0x2e0571,null));};exports['getMailInteractions']=function(_0x5b818d,_0x11dc49,_0x58fdc7){var _0x178589={'raw':!![],'where':{}};var _0x2904f3={};var _0x4937f2={'count':0x0,'rows':[]};return db[_0xd714('0x4e')][_0xd714('0xc1')]({'where':{'id':_0x5b818d[_0xd714('0x67')]['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x11dc49,null))[_0xd714('0x25')](function(_0x11de00){if(_0x11de00){_0x2904f3[_0xd714('0x4f')]=_[_0xd714('0x51')](db[_0xd714('0xd6')][_0xd714('0x68')]);_0x2904f3[_0xd714('0x53')]=_[_0xd714('0x51')](_0x5b818d['query']);_0x2904f3[_0xd714('0x54')]=_[_0xd714('0x55')](_0x2904f3[_0xd714('0x4f')],_0x2904f3[_0xd714('0x53')]);_0x178589[_0xd714('0x56')]=_[_0xd714('0x55')](_0x2904f3['model'],qs[_0xd714('0x57')](_0x5b818d[_0xd714('0x53')]['fields']));_0x178589['attributes']=_0x178589[_0xd714('0x56')][_0xd714('0x58')]?_0x178589[_0xd714('0x56')]:_0x2904f3[_0xd714('0x4f')];if(!_0x5b818d[_0xd714('0x53')][_0xd714('0x59')](_0xd714('0x5a'))){_0x178589[_0xd714('0x37')]=qs[_0xd714('0x37')](_0x5b818d['query'][_0xd714('0x37')]);_0x178589[_0xd714('0x36')]=qs[_0xd714('0x36')](_0x5b818d[_0xd714('0x53')][_0xd714('0x36')]);}_0x178589[_0xd714('0x5b')]=qs[_0xd714('0x5c')](_0x5b818d[_0xd714('0x53')][_0xd714('0x5c')]);_0x178589['where']=qs['filters'](_[_0xd714('0x5e')](_0x5b818d[_0xd714('0x53')],_0x2904f3[_0xd714('0x54')]));_0x178589['where'][_0xd714('0xd2')]=_0x11de00['id'];if(_0x5b818d['query'][_0xd714('0x41')]){_0x178589[_0xd714('0x5d')]=_[_0xd714('0x63')](_0x178589[_0xd714('0x5d')],{'$or':_[_0xd714('0x43')](_0x178589[_0xd714('0x56')],function(_0x1556fc){var _0x16c9d7={};_0x16c9d7[_0x1556fc]={'$like':'%'+_0x5b818d[_0xd714('0x53')]['filter']+'%'};return _0x16c9d7;})});}_0x178589=_[_0xd714('0x63')]({},_0x178589,_0x5b818d['options']);return db['MailInteraction'][_0xd714('0x35')]({'where':_0x178589[_0xd714('0x5d')]})[_0xd714('0x25')](function(_0x5de5f8){_0x4937f2[_0xd714('0x35')]=_0x5de5f8;if(_0x5b818d[_0xd714('0x53')][_0xd714('0x64')]){_0x178589[_0xd714('0x6a')]=[{'all':!![]}];}return db[_0xd714('0xd6')][_0xd714('0x65')](_0x178589);})['then'](function(_0xd82236){_0x4937f2[_0xd714('0x66')]=_0xd82236;return _0x4937f2;});}})['then'](respondWithFilteredResult(_0x11dc49,_0x178589))['catch'](handleError(_0x11dc49,null));};exports[_0xd714('0xd7')]=function(_0x5eaf91,_0x2a0d60,_0x41157b){var _0x1b6f0d={};var _0x5bb914={};var _0x845d3c;var _0x23daa2;return db['User'][_0xd714('0xc1')]({'where':{'id':_0x5eaf91['params']['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x2a0d60,null))[_0xd714('0x25')](function(_0x3644b2){if(_0x3644b2){_0x845d3c=_0x3644b2;_0x5bb914[_0xd714('0x4f')]=_['keys'](db['SmsInteraction'][_0xd714('0x68')]);_0x5bb914[_0xd714('0x53')]=_[_0xd714('0x51')](_0x5eaf91[_0xd714('0x53')]);_0x5bb914[_0xd714('0x54')]=_[_0xd714('0x55')](_0x5bb914['model'],_0x5bb914[_0xd714('0x53')]);_0x1b6f0d['attributes']=_['intersection'](_0x5bb914['model'],qs[_0xd714('0x57')](_0x5eaf91[_0xd714('0x53')]['fields']));_0x1b6f0d[_0xd714('0x56')]=_0x1b6f0d[_0xd714('0x56')]['length']?_0x1b6f0d[_0xd714('0x56')]:_0x5bb914[_0xd714('0x4f')];_0x1b6f0d['order']=qs[_0xd714('0x5c')](_0x5eaf91[_0xd714('0x53')][_0xd714('0x5c')]);_0x1b6f0d[_0xd714('0x5d')]=qs['filters'](_[_0xd714('0x5e')](_0x5eaf91['query'],_0x5bb914[_0xd714('0x54')]));if(_0x5eaf91['query'][_0xd714('0x41')]){_0x1b6f0d[_0xd714('0x5d')]=_[_0xd714('0x63')](_0x1b6f0d[_0xd714('0x5d')],{'$or':_[_0xd714('0x43')](_0x1b6f0d['attributes'],function(_0x202203){var _0x6a6231={};_0x6a6231[_0x202203]={'$like':'%'+_0x5eaf91['query'][_0xd714('0x41')]+'%'};return _0x6a6231;})});}_0x1b6f0d=_[_0xd714('0x63')]({},_0x1b6f0d,_0x5eaf91[_0xd714('0xcb')]);return _0x845d3c[_0xd714('0xd7')](_0x1b6f0d);}})[_0xd714('0x25')](function(_0x235ae8){if(_0x235ae8){_0x23daa2=_0x235ae8[_0xd714('0x58')];if(!_0x5eaf91['query'][_0xd714('0x59')]('nolimit')){_0x1b6f0d[_0xd714('0x37')]=qs[_0xd714('0x37')](_0x5eaf91['query'][_0xd714('0x37')]);_0x1b6f0d[_0xd714('0x36')]=qs[_0xd714('0x36')](_0x5eaf91[_0xd714('0x53')][_0xd714('0x36')]);}return _0x845d3c['getSmsInteractions'](_0x1b6f0d);}})[_0xd714('0x25')](function(_0x495571){if(_0x495571){return _0x495571?{'count':_0x23daa2,'rows':_0x495571}:null;}})['then'](respondWithResult(_0x2a0d60,null))[_0xd714('0x30')](handleError(_0x2a0d60,null));};exports[_0xd714('0xd8')]=function(_0x1a0ad5,_0x1a8855,_0x50b3e8){var _0x23c851={};var _0x2f8333={};var _0x3b83a3;var _0x31e741;return db[_0xd714('0x4e')]['findOne']({'where':{'id':_0x1a0ad5['params']['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x1a8855,null))[_0xd714('0x25')](function(_0x43b345){if(_0x43b345){_0x3b83a3=_0x43b345;_0x2f8333['model']=_[_0xd714('0x51')](db[_0xd714('0xd9')][_0xd714('0x68')]);_0x2f8333[_0xd714('0x53')]=_[_0xd714('0x51')](_0x1a0ad5[_0xd714('0x53')]);_0x2f8333[_0xd714('0x54')]=_[_0xd714('0x55')](_0x2f8333['model'],_0x2f8333['query']);_0x23c851[_0xd714('0x56')]=_['intersection'](_0x2f8333[_0xd714('0x4f')],qs['fields'](_0x1a0ad5[_0xd714('0x53')]['fields']));_0x23c851[_0xd714('0x56')]=_0x23c851[_0xd714('0x56')]['length']?_0x23c851['attributes']:_0x2f8333[_0xd714('0x4f')];_0x23c851[_0xd714('0x5b')]=qs['sort'](_0x1a0ad5[_0xd714('0x53')][_0xd714('0x5c')]);_0x23c851['where']=qs[_0xd714('0x54')](_[_0xd714('0x5e')](_0x1a0ad5[_0xd714('0x53')],_0x2f8333['filters']));if(_0x1a0ad5['query']['filter']){_0x23c851[_0xd714('0x5d')]=_[_0xd714('0x63')](_0x23c851[_0xd714('0x5d')],{'$or':_[_0xd714('0x43')](_0x23c851[_0xd714('0x56')],function(_0xa8e815){var _0x6e76f1={};_0x6e76f1[_0xa8e815]={'$like':'%'+_0x1a0ad5[_0xd714('0x53')][_0xd714('0x41')]+'%'};return _0x6e76f1;})});}_0x23c851=_[_0xd714('0x63')]({},_0x23c851,_0x1a0ad5[_0xd714('0xcb')]);return _0x3b83a3['getFaxInteractions'](_0x23c851);}})[_0xd714('0x25')](function(_0x3cf836){if(_0x3cf836){_0x31e741=_0x3cf836[_0xd714('0x58')];if(!_0x1a0ad5[_0xd714('0x53')][_0xd714('0x59')](_0xd714('0x5a'))){_0x23c851[_0xd714('0x37')]=qs['limit'](_0x1a0ad5['query'][_0xd714('0x37')]);_0x23c851[_0xd714('0x36')]=qs[_0xd714('0x36')](_0x1a0ad5['query'][_0xd714('0x36')]);}return _0x3b83a3[_0xd714('0xd8')](_0x23c851);}})[_0xd714('0x25')](function(_0xe47850){if(_0xe47850){return _0xe47850?{'count':_0x31e741,'rows':_0xe47850}:null;}})[_0xd714('0x25')](respondWithResult(_0x1a8855,null))[_0xd714('0x30')](handleError(_0x1a8855,null));};exports['login']=function(_0x3fb05f,_0x34b269,_0x3603d7){var _0x494343;var _0xcc24e8;var _0x11b549;return db[_0xd714('0x4e')][_0xd714('0x45')]({'where':{'id':_0x3fb05f[_0xd714('0x67')]['id'],'role':_0xd714('0x3f')},'attributes':['id','name',_0xd714('0xda'),_0xd714('0xdb'),_0xd714('0x47'),_0xd714('0x7e'),_0xd714('0xdc')]})['then'](handleEntityNotFound(_0x34b269,null))[_0xd714('0x25')](function(_0x136cb7){if(_0x136cb7){_0x494343=_0x136cb7;if(_0x3fb05f[_0xd714('0x6c')][_0xd714('0xa0')]){_0x11b549=util['format'](_0xd714('0xdd'),_0x494343[_0x3fb05f[_0xd714('0x6c')]['interface']]);}else if(_0x3fb05f[_0xd714('0x6c')][_0xd714('0xde')]){_0x11b549=util[_0xd714('0xaf')]('SIP/%s',_0x3fb05f[_0xd714('0x6c')][_0xd714('0xde')]);}else{_0x11b549=util[_0xd714('0xaf')]('SIP/%s',_0x494343['name']);}socket['to'](util[_0xd714('0xaf')](_0xd714('0xdf'),_0x494343['name']))[_0xd714('0xaa')](_0xd714('0xe0'),{'ip':_0x3fb05f[_0xd714('0xe1')][_0xd714('0xe2')]||_0x3fb05f[_0xd714('0xe3')][_0xd714('0xe4')]||_0x3fb05f[_0xd714('0xe5')][_0xd714('0xe4')]||_0x3fb05f['connection']['socket'][_0xd714('0xe4')]});return db[_0xd714('0xb5')]['destroy']({'where':{'membername':_0x494343[_0xd714('0x48')]},'individualHooks':!![]});}})['then'](function(_0x3f94e2){if(_0x494343){return _0x494343[_0xd714('0xe6')]({'raw':!![]});}})[_0xd714('0x25')](function(_0x40c1e1){var _0x481be3=[];if(_0x40c1e1){_0xcc24e8=_0x40c1e1;if(_0xcc24e8[_0xd714('0x58')]){for(var _0x1016a8=0x0;_0x1016a8<_0xcc24e8[_0xd714('0x58')];_0x1016a8++){_0x481be3['push']({'membername':_0x494343['name'],'UserId':_0x494343['id'],'queue_name':_0xcc24e8[_0x1016a8]['name'],'VoiceQueueId':_0xcc24e8[_0x1016a8]['id'],'interface':_0x11b549,'paused':_0x494343[_0xd714('0xdc')]||![],'penalty':_0xcc24e8[_0x1016a8][_0xd714('0xe7')]||0x0});}return BPromise[_0xd714('0xe8')](_0x481be3,function(_0x1e024f){return db[_0xd714('0xb5')][_0xd714('0xb0')](_0x1e024f);});}}})[_0xd714('0x25')](function(){return db[_0xd714('0xe9')][_0xd714('0x65')]({'where':{'membername':_0x494343['name'],'exitAt':null}});})[_0xd714('0x25')](function(_0xb03b71){var _0xd31ed2=[];_0xb03b71[_0xd714('0xea')](function(_0x18c39d){_0xd31ed2[_0xd714('0xae')](_0x18c39d['update']({'exitAt':moment()['format'](_0xd714('0xeb'))}));});return BPromise[_0xd714('0xec')](_0xd31ed2);})[_0xd714('0x25')](function(){var _0x5153ea=[];var _0x143953=[];var _0x303b12=utils[_0xd714('0xed')]();var _0x47ebad={'membername':_0x494343['name'],'interface':_0x11b549,'enterAt':moment()[_0xd714('0xaf')](_0xd714('0xeb')),'role':_0x494343[_0xd714('0x47')],'internal':_0x494343['internal']};_0x303b12[_0xd714('0xea')](function(_0xe19444){_0x5153ea[_0xd714('0xae')](_[_0xd714('0x63')]({'channel':_0xe19444,'type':_0xd714('0xee'),'data1':_0x3fb05f[_0xd714('0x6c')][_0xd714('0xef')],'data2':_0x11b549},_0x47ebad));if(_0x494343['loginInPause']){_0x143953[_0xd714('0xae')](_[_0xd714('0x63')]({'channel':_0xe19444,'type':_0xd714('0xf0'),'data1':_0xd714('0xf1')},_0x47ebad));}});return db['MemberReport'][_0xd714('0x6b')](_0x5153ea[_0xd714('0xf2')](_0x143953),{'individualHooks':!![]});})[_0xd714('0x25')](function(){return _0x494343[_0xd714('0xf3')]({'online':!![],'lastLoginAt':moment()['format'](_0xd714('0xeb')),'voicePause':_0x494343[_0xd714('0xdc')]||![],'mailPause':_0x494343[_0xd714('0xdc')]||![],'chatPause':_0x494343[_0xd714('0xdc')]||![],'faxPause':_0x494343[_0xd714('0xdc')]||![],'smsPause':_0x494343[_0xd714('0xdc')]||![],'openchannelPause':_0x494343[_0xd714('0xdc')]||![],'pauseType':_0x494343[_0xd714('0xdc')]?_0xd714('0xf1'):null,'interface':_0x11b549,'lastPauseAt':moment()[_0xd714('0xaf')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xd714('0x25')](respondWithResult(_0x34b269,null))[_0xd714('0x30')](handleError(_0x34b269,null));};exports[_0xd714('0xf4')]=function(_0x5f2242,_0x197cea,_0x52d803){var _0x50bbc7;return db['User'][_0xd714('0x45')]({'where':{'id':_0x5f2242['params']['id'],'role':_0xd714('0x3f')},'attributes':['id',_0xd714('0x48'),'role']})[_0xd714('0x25')](handleEntityNotFound(_0x197cea,null))['then'](function(_0xb83692){if(_0xb83692){_0x50bbc7=_0xb83692;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x50bbc7[_0xd714('0x48')]},'individualHooks':!![]});}})[_0xd714('0x25')](function(){return db[_0xd714('0xe9')]['findAll']({'where':{'membername':_0x50bbc7['name'],'exitAt':null}});})['then'](function(_0x10fd1a){var _0x44913e=[];_0x10fd1a[_0xd714('0xea')](function(_0xd5289a){_0x44913e['push'](_0xd5289a['update']({'exitAt':moment()[_0xd714('0xaf')](_0xd714('0xeb'))}));});return BPromise['all'](_0x44913e);})[_0xd714('0x25')](function(){return _0x50bbc7[_0xd714('0xf3')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'interface':null});})['then'](respondWithResult(_0x197cea,null))[_0xd714('0x30')](handleError(_0x197cea,null));};exports[_0xd714('0xf5')]=function(_0x2570f4,_0x1f04a6,_0x57ac55){var _0x449dda;return db[_0xd714('0xb5')][_0xd714('0xf3')]({'paused':0x1},{'where':{'UserId':_0x2570f4[_0xd714('0x67')]['id']},'individualHooks':!![]})[_0xd714('0x25')](function(){return db['User'][_0xd714('0x45')]({'where':{'id':_0x2570f4[_0xd714('0x67')]['id'],'role':_0xd714('0x3f')},'attributes':['id',_0xd714('0x48'),'role',_0xd714('0x7e'),_0xd714('0xa0')]});})[_0xd714('0x25')](handleEntityNotFound(_0x1f04a6,null))[_0xd714('0x25')](function(_0x550e03){if(_0x550e03){_0x449dda=_0x550e03;return respondWithRpcPromise(_0xd714('0xf6'),_0xd714('0xf5'),{'id':_0x449dda['id'],'name':_0x449dda[_0xd714('0x48')],'pause':!![]});}})[_0xd714('0x25')](function(){if(_0x449dda){return db[_0xd714('0xe9')]['findAll']({'where':{'membername':_0x449dda[_0xd714('0x48')],'type':_0xd714('0xf0'),'exitAt':null}});}})[_0xd714('0x25')](function(_0x41092c){if(_0x41092c[_0xd714('0x58')]){var _0x42d885=moment()[_0xd714('0xaf')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x59097a=0x0,_0x1a8535=_0x41092c[_0xd714('0x58')];_0x59097a<_0x1a8535;_0x59097a++){_0x41092c[_0x59097a][_0xd714('0xf7')]({'exitAt':_0x42d885});}}})[_0xd714('0x25')](function(){var _0x33bceb=[];var _0x256fe7=utils[_0xd714('0xed')]();_0x256fe7['forEach'](function(_0x781d19){_0x33bceb[_0xd714('0xae')]({'channel':_0x781d19,'membername':_0x449dda[_0xd714('0x48')],'interface':_['isNil'](_0x449dda[_0xd714('0xa0')])?util[_0xd714('0xaf')](_0xd714('0xf8'),_0x449dda[_0xd714('0x48')]):_0x449dda[_0xd714('0xa0')],'type':_0xd714('0xf0'),'enterAt':moment()[_0xd714('0xaf')](_0xd714('0xeb')),'data1':_0x2570f4[_0xd714('0x6c')][_0xd714('0xf9')]||'DEFAULT\x20PAUSE','role':_0x449dda[_0xd714('0x47')],'internal':_0x449dda[_0xd714('0x7e')]});});return db[_0xd714('0xe9')][_0xd714('0x6b')](_0x33bceb,{'individualHooks':!![]});})[_0xd714('0x25')](function(){return _0x449dda[_0xd714('0xf3')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x2570f4[_0xd714('0x6c')][_0xd714('0xf9')]||_0xd714('0xfa'),'lastPauseAt':moment()['format'](_0xd714('0xeb'))});})[_0xd714('0x25')](respondWithResult(_0x1f04a6,null))['catch'](handleError(_0x1f04a6,null));};exports[_0xd714('0xfb')]=function(_0x3ee783,_0x4eba49,_0xf982c4){var _0x4050c2;return db['User'][_0xd714('0x45')]({'where':{'id':_0x3ee783[_0xd714('0x67')]['id']},'attributes':['id',_0xd714('0x48'),_0xd714('0x47'),'voicePause','mailPause','chatPause',_0xd714('0xfc'),'openchannelPause','smsPause','pauseType',_0xd714('0xfd')]})['then'](handleEntityNotFound(_0x4eba49,null))[_0xd714('0x25')](function(_0x346247){if(_0x346247){_0x4050c2=_0x346247;if(_0x3ee783[_0xd714('0x6c')]['channel']&&!utils['isValidChannel'](_0x3ee783[_0xd714('0x6c')][_0xd714('0xa2')])){throw new db['Sequelize']['ValidationError'](_0xd714('0xa3'));}switch(_0x3ee783[_0xd714('0x6c')][_0xd714('0xa2')]){case _0xd714('0xac'):return respondWithRpcPromise('QueuePause',_0xd714('0xfb'),{'id':_0x4050c2['id'],'name':_0x4050c2['name'],'pause':![]})[_0xd714('0x25')](function(){return db[_0xd714('0xb5')]['update']({'paused':0x0},{'where':{'UserId':_0x4050c2['id']},'individualHooks':!![]});})[_0xd714('0x25')](function(){return db[_0xd714('0xe9')][_0xd714('0x45')]({'where':{'channel':_0x3ee783[_0xd714('0x6c')][_0xd714('0xa2')],'membername':_0x4050c2[_0xd714('0x48')],'type':_0xd714('0xf0'),'exitAt':null}});})[_0xd714('0x25')](function(_0x4dbc79){if(_0x4dbc79){return _0x4dbc79[_0xd714('0xf3')]({'exitAt':moment()[_0xd714('0xaf')](_0xd714('0xeb')),'data2':_0xd714('0xfe')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x4050c2[_0xd714('0xf3')]({'voicePause':![]});});case _0xd714('0xff'):case _0xd714('0x100'):case'fax':case _0xd714('0x101'):case _0xd714('0x102'):return db[_0xd714('0xe9')]['find']({'where':{'channel':_0x3ee783[_0xd714('0x6c')][_0xd714('0xa2')],'membername':_0x4050c2['name'],'type':_0xd714('0xf0'),'exitAt':null}})[_0xd714('0x25')](function(_0x304ec2){if(_0x304ec2){return _0x304ec2['update']({'exitAt':moment()[_0xd714('0xaf')](_0xd714('0xeb')),'data2':_0xd714('0xfe')},{'individualHooks':!![]});}return null;})[_0xd714('0x25')](function(){var _0x48152a={};_[_0xd714('0x38')](_0x48152a,util[_0xd714('0xaf')](_0xd714('0x103'),_0x3ee783['body'][_0xd714('0xa2')],_0xd714('0x104')),![]);return _0x4050c2[_0xd714('0xf3')](_0x48152a);});default:return respondWithRpcPromise('QueuePause',_0xd714('0xfb'),{'id':_0x4050c2['id'],'name':_0x4050c2[_0xd714('0x48')],'pause':![]})[_0xd714('0x25')](function(){return db['UserVoiceQueueRt'][_0xd714('0xf3')]({'paused':0x0},{'where':{'UserId':_0x4050c2['id']}});})[_0xd714('0x25')](function(){return db['MemberReport'][_0xd714('0x65')]({'where':{'membername':_0x4050c2['name'],'type':_0xd714('0xf0'),'exitAt':null}});})[_0xd714('0x25')](function(_0x427df5){var _0x591f51=[];_0x427df5[_0xd714('0xea')](function(_0x5ac563){_0x591f51['push'](_0x5ac563[_0xd714('0xf3')]({'exitAt':moment()[_0xd714('0xaf')](_0xd714('0xeb')),'data2':_0xd714('0xfe')}));});return BPromise[_0xd714('0xec')](_0x591f51);})['then'](function(){return _0x4050c2['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xd714('0x25')](respondWithResult(_0x4eba49,null))[_0xd714('0x30')](handleError(_0x4eba49,null));};exports['getTeams']=function(_0x44f11a,_0x5af3f2,_0x1e6322){var _0x3594df={};var _0x2b6159={};var _0x2c3dc7;var _0x33d065;return db[_0xd714('0x4e')][_0xd714('0xc1')]({'where':{'id':_0x44f11a['params']['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x5af3f2,null))[_0xd714('0x25')](function(_0x40faff){if(_0x40faff){_0x2c3dc7=_0x40faff;_0x2b6159['model']=_[_0xd714('0x51')](db[_0xd714('0x105')][_0xd714('0x68')]);_0x2b6159[_0xd714('0x53')]=_[_0xd714('0x51')](_0x44f11a['query']);_0x2b6159['filters']=_[_0xd714('0x55')](_0x2b6159[_0xd714('0x4f')],_0x2b6159['query']);_0x3594df[_0xd714('0x56')]=_['intersection'](_0x2b6159[_0xd714('0x4f')],qs['fields'](_0x44f11a[_0xd714('0x53')][_0xd714('0x57')]));_0x3594df[_0xd714('0x56')]=_0x3594df[_0xd714('0x56')][_0xd714('0x58')]?_0x3594df[_0xd714('0x56')]:_0x2b6159['model'];_0x3594df[_0xd714('0x5b')]=qs[_0xd714('0x5c')](_0x44f11a['query'][_0xd714('0x5c')]);_0x3594df[_0xd714('0x5d')]=qs[_0xd714('0x54')](_['pick'](_0x44f11a[_0xd714('0x53')],_0x2b6159[_0xd714('0x54')]));if(_0x44f11a[_0xd714('0x53')][_0xd714('0x41')]){_0x3594df[_0xd714('0x5d')]=_[_0xd714('0x63')](_0x3594df[_0xd714('0x5d')],{'$or':_[_0xd714('0x43')](_0x3594df[_0xd714('0x56')],function(_0x1ed9fa){var _0x714b0f={};_0x714b0f[_0x1ed9fa]={'$like':'%'+_0x44f11a[_0xd714('0x53')][_0xd714('0x41')]+'%'};return _0x714b0f;})});}_0x3594df=_['merge']({},_0x3594df,_0x44f11a['options']);return _0x2c3dc7[_0xd714('0x106')](_0x3594df);}})[_0xd714('0x25')](function(_0x1ac2d5){if(_0x1ac2d5){_0x33d065=_0x1ac2d5[_0xd714('0x58')];if(!_0x44f11a[_0xd714('0x53')][_0xd714('0x59')]('nolimit')){_0x3594df[_0xd714('0x37')]=qs[_0xd714('0x37')](_0x44f11a[_0xd714('0x53')]['limit']);_0x3594df[_0xd714('0x36')]=qs[_0xd714('0x36')](_0x44f11a[_0xd714('0x53')]['offset']);}return _0x2c3dc7['getTeams'](_0x3594df);}})[_0xd714('0x25')](function(_0x57dd4c){if(_0x57dd4c){return _0x57dd4c?{'count':_0x33d065,'rows':_0x57dd4c}:null;}})[_0xd714('0x25')](respondWithResult(_0x5af3f2,null))['catch'](handleError(_0x5af3f2,null));};exports[_0xd714('0x107')]=function(_0x3ed711,_0x3b7529,_0x79c725){return db[_0xd714('0x4e')][_0xd714('0x45')]({'where':{'id':_0x3ed711['params']['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x3b7529,null))[_0xd714('0x25')](function(_0x5a492d){if(_0x5a492d){return _0x5a492d[_0xd714('0x107')](_0x3ed711['body'][_0xd714('0x6f')],_[_0xd714('0x70')](_0x3ed711[_0xd714('0x6c')],['ids','id'])||{});}})[_0xd714('0x25')](respondWithResult(_0x3b7529,null))[_0xd714('0x30')](handleError(_0x3b7529,null));};exports[_0xd714('0x108')]=function(_0x461eed,_0x1fc270,_0x44e51b){var _0x38492b;return db[_0xd714('0x4e')][_0xd714('0x45')]({'where':{'id':_0x461eed['params']['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x1fc270,null))[_0xd714('0x25')](function(_0x369ade){if(_0x369ade){return _0x369ade[_0xd714('0x108')](_0x461eed[_0xd714('0x53')]['ids']);}})[_0xd714('0x25')](respondWithStatusCode(_0x1fc270,null))['catch'](handleError(_0x1fc270,null));};exports[_0xd714('0x109')]=function(_0x54ef64,_0xe502ab,_0x3b3b9b){var _0x4abd4f={};var _0x671e51={};var _0x50e8fb;var _0xce1519;return db[_0xd714('0x4e')][_0xd714('0xc1')]({'where':{'id':_0x54ef64[_0xd714('0x67')]['id']}})['then'](handleEntityNotFound(_0xe502ab,null))[_0xd714('0x25')](function(_0x1f9b61){if(_0x1f9b61){_0x50e8fb=_0x1f9b61;_0x671e51[_0xd714('0x4f')]=_['keys'](db[_0xd714('0xc3')]['rawAttributes']);_0x671e51['query']=_[_0xd714('0x51')](_0x54ef64[_0xd714('0x53')]);_0x671e51[_0xd714('0x54')]=_[_0xd714('0x55')](_0x671e51['model'],_0x671e51[_0xd714('0x53')]);_0x4abd4f['attributes']=_[_0xd714('0x55')](_0x671e51['model'],qs[_0xd714('0x57')](_0x54ef64['query'][_0xd714('0x57')]));_0x4abd4f['attributes']=_0x4abd4f[_0xd714('0x56')][_0xd714('0x58')]?_0x4abd4f[_0xd714('0x56')]:_0x671e51['model'];_0x4abd4f[_0xd714('0x5b')]=qs[_0xd714('0x5c')](_0x54ef64[_0xd714('0x53')]['sort']);_0x4abd4f[_0xd714('0x5d')]=qs[_0xd714('0x54')](_[_0xd714('0x5e')](_0x54ef64[_0xd714('0x53')],_0x671e51['filters']));if(_0x54ef64[_0xd714('0x53')]['filter']){_0x4abd4f[_0xd714('0x5d')]=_['merge'](_0x4abd4f[_0xd714('0x5d')],{'$or':_[_0xd714('0x43')](_0x4abd4f['attributes'],function(_0x5350dd){var _0x4da753={};_0x4da753[_0x5350dd]={'$like':'%'+_0x54ef64[_0xd714('0x53')]['filter']+'%'};return _0x4da753;})});}_0x4abd4f=_[_0xd714('0x63')]({},_0x4abd4f,_0x54ef64[_0xd714('0xcb')]);return _0x50e8fb[_0xd714('0x109')](_0x4abd4f);}})[_0xd714('0x25')](function(_0x27d2fd){if(_0x27d2fd){_0xce1519=_0x27d2fd[_0xd714('0x58')];if(!_0x54ef64[_0xd714('0x53')][_0xd714('0x59')](_0xd714('0x5a'))){_0x4abd4f[_0xd714('0x37')]=qs['limit'](_0x54ef64[_0xd714('0x53')][_0xd714('0x37')]);_0x4abd4f[_0xd714('0x36')]=qs[_0xd714('0x36')](_0x54ef64[_0xd714('0x53')][_0xd714('0x36')]);}return _0x50e8fb[_0xd714('0x109')](_0x4abd4f);}})[_0xd714('0x25')](function(_0x5eaf94){if(_0x5eaf94){return _0x5eaf94?{'count':_0xce1519,'rows':_0x5eaf94}:null;}})[_0xd714('0x25')](respondWithResult(_0xe502ab,null))[_0xd714('0x30')](handleError(_0xe502ab,null));};exports['getAgents']=function(_0xe87e07,_0x147b7a,_0x3cdba5){var _0x14356f={};var _0x339452={};var _0x415d0c;var _0x57adb6;return db[_0xd714('0x4e')][_0xd714('0xc1')]({'where':{'id':_0xe87e07[_0xd714('0x67')]['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x147b7a,null))[_0xd714('0x25')](function(_0x4da037){if(_0x4da037){_0x415d0c=_0x4da037;_0x339452['model']=_[_0xd714('0x51')](db[_0xd714('0x4e')]['rawAttributes']);_0x339452[_0xd714('0x53')]=_[_0xd714('0x51')](_0xe87e07[_0xd714('0x53')]);_0x339452['filters']=_[_0xd714('0x55')](_0x339452[_0xd714('0x4f')],_0x339452[_0xd714('0x53')]);_0x14356f[_0xd714('0x56')]=_[_0xd714('0x55')](_0x339452[_0xd714('0x4f')],qs['fields'](_0xe87e07['query'][_0xd714('0x57')]));_0x14356f[_0xd714('0x56')]=_0x14356f[_0xd714('0x56')][_0xd714('0x58')]?_0x14356f[_0xd714('0x56')]:_0x339452[_0xd714('0x4f')];_0x14356f[_0xd714('0x5b')]=qs[_0xd714('0x5c')](_0xe87e07[_0xd714('0x53')][_0xd714('0x5c')]);_0x14356f[_0xd714('0x5d')]=qs[_0xd714('0x54')](_['pick'](_0xe87e07[_0xd714('0x53')],_0x339452['filters']));if(_0xe87e07[_0xd714('0x53')]['filter']){_0x14356f[_0xd714('0x5d')]=_['merge'](_0x14356f[_0xd714('0x5d')],{'$or':_[_0xd714('0x43')](_0x14356f[_0xd714('0x56')],function(_0x1f0580){var _0x27247e={};_0x27247e[_0x1f0580]={'$like':'%'+_0xe87e07['query'][_0xd714('0x41')]+'%'};return _0x27247e;})});}_0x14356f[_0xd714('0x4f')]=db[_0xd714('0x4e')];_0x14356f['as']=_0xd714('0x92');_0x14356f=_[_0xd714('0x63')]({},_0x14356f,_0xe87e07[_0xd714('0xcb')]);return _0x415d0c[_0xd714('0xe6')]({'include':[_0x14356f]});}})[_0xd714('0x25')](function(_0x2b2a25){if(_0x2b2a25){var _0x3186d6={},_0x3a7ac3=[],_0x2d35b1=0x0;for(var _0x518d69=0x0;_0x518d69<_0x2b2a25[_0xd714('0x58')];_0x518d69+=0x1){for(var _0x3ba9ac=0x0,_0x270b00;_0x3ba9ac<_0x2b2a25[_0x518d69][_0xd714('0x92')]['length'];_0x3ba9ac+=0x1){_0x270b00=_0x2b2a25[_0x518d69][_0xd714('0x92')][_0x3ba9ac][_0xd714('0x3c')]({'plain':!![]});_0x3186d6[_0x270b00['id']]=_0x270b00;}}_0x3186d6=_['values'](_0x3186d6);for(var _0x30868d=qs[_0xd714('0x36')](_0xe87e07[_0xd714('0x53')][_0xd714('0x36')]);_0x30868d<_0x3186d6[_0xd714('0x58')]&&_0x3a7ac3[_0xd714('0x58')]<qs[_0xd714('0x37')](_0xe87e07[_0xd714('0x53')][_0xd714('0x37')]);_0x30868d+=0x1){if(_0x3186d6[_0x30868d]){_0x3a7ac3[_0xd714('0xae')](_0x3186d6[_0x30868d]);}}return{'count':_0x3186d6[_0xd714('0x58')],'rows':_0x3a7ac3};}})['then'](respondWithResult(_0x147b7a,null))[_0xd714('0x30')](handleError(_0x147b7a,null));};exports[_0xd714('0x4a')]=function(_0x39d4ec,_0x7e4980){if(_0x39d4ec['user']['id']==_0x39d4ec[_0xd714('0x67')]['id']){return _0x7e4980['status'](0x1f4)[_0xd714('0x4c')]({'message':_0xd714('0x10a')});}return db[_0xd714('0x4e')][_0xd714('0x45')]({'where':{'id':_0x39d4ec[_0xd714('0x67')]['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x7e4980,null))[_0xd714('0x25')](removeEntity(_0x7e4980,null))[_0xd714('0x30')](handleError(_0x7e4980,null));};exports[_0xd714('0x10b')]=function(_0x5aba79,_0x5d9d6,_0x48cee2){return db[_0xd714('0x4e')][_0xd714('0x45')]({'where':{'id':_0x5aba79[_0xd714('0x67')]['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x5d9d6,null))[_0xd714('0x25')](function(_0x109ba6){if(_0x109ba6){return _0x109ba6['addChatInteractions'](_0x5aba79['body'][_0xd714('0x6f')],_[_0xd714('0x70')](_0x5aba79[_0xd714('0x6c')],[_0xd714('0x6f'),'id'])||{})[_0xd714('0xa8')](function(){for(var _0x44da5d=0x0;_0x44da5d<_0x5aba79['body'][_0xd714('0x6f')][_0xd714('0x58')];_0x44da5d+=0x1){socket[_0xd714('0xaa')](_0xd714('0x10c'),{'ChatInteractionId':Number(_0x5aba79[_0xd714('0x6c')]['ids'][_0x44da5d]),'UserId':Number(_0x5aba79[_0xd714('0x67')]['id'])});}return _0x5aba79[_0xd714('0x6c')]['ids'];});}})[_0xd714('0x25')](respondWithResult(_0x5d9d6,null))[_0xd714('0x30')](handleError(_0x5d9d6,null));};exports['removeChatInteractions']=function(_0x2db373,_0x42b951,_0x4fd080){var _0x54ccc2;return db[_0xd714('0x4e')][_0xd714('0x45')]({'where':{'id':_0x2db373['params']['id']}})['then'](handleEntityNotFound(_0x42b951,null))[_0xd714('0x25')](function(_0x838348){if(_0x838348){return _0x838348[_0xd714('0x10d')](_0x2db373[_0xd714('0x53')][_0xd714('0x6f')])[_0xd714('0x25')](function(_0x48c427){if(_['isArray'](_0x2db373[_0xd714('0x53')][_0xd714('0x6f')])){for(var _0x55b852=0x0;_0x55b852<_0x2db373[_0xd714('0x53')][_0xd714('0x6f')][_0xd714('0x58')];_0x55b852+=0x1){socket['emit'](_0xd714('0x10e'),{'ChatInteractionId':Number(_0x2db373[_0xd714('0x53')][_0xd714('0x6f')][_0x55b852]),'UserId':Number(_0x2db373['params']['id'])});}}else{socket['emit'](_0xd714('0x10e'),{'ChatInteractionId':Number(_0x2db373[_0xd714('0x53')][_0xd714('0x6f')]),'UserId':Number(_0x2db373[_0xd714('0x67')]['id'])});}});}})['then'](respondWithStatusCode(_0x42b951,null))[_0xd714('0x30')](handleError(_0x42b951,null));};exports['addMailInteractions']=function(_0x1b0f38,_0x1783a6,_0x7d6cdc){return db['User']['find']({'where':{'id':_0x1b0f38[_0xd714('0x67')]['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x1783a6,null))[_0xd714('0x25')](function(_0x11ffcd){if(_0x11ffcd){return _0x11ffcd[_0xd714('0x10f')](_0x1b0f38[_0xd714('0x6c')]['ids'],_[_0xd714('0x70')](_0x1b0f38['body'],[_0xd714('0x6f'),'id'])||{})[_0xd714('0xa8')](function(){for(var _0x997cf4=0x0;_0x997cf4<_0x1b0f38['body'][_0xd714('0x6f')][_0xd714('0x58')];_0x997cf4+=0x1){socket['emit']('user_has_mail_interactions:save',{'MailInteractionId':Number(_0x1b0f38[_0xd714('0x6c')][_0xd714('0x6f')][_0x997cf4]),'UserId':Number(_0x1b0f38['params']['id'])});}return _0x1b0f38[_0xd714('0x6c')][_0xd714('0x6f')];});}})[_0xd714('0x25')](respondWithResult(_0x1783a6,null))[_0xd714('0x30')](handleError(_0x1783a6,null));};exports[_0xd714('0x110')]=function(_0x3f1ea5,_0x292591,_0x541ddf){var _0x53a7f8;return db['User'][_0xd714('0x45')]({'where':{'id':_0x3f1ea5['params']['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x292591,null))[_0xd714('0x25')](function(_0x50871a){if(_0x50871a){return _0x50871a[_0xd714('0x110')](_0x3f1ea5['query'][_0xd714('0x6f')])['then'](function(_0x160c48){if(_[_0xd714('0x111')](_0x3f1ea5[_0xd714('0x53')][_0xd714('0x6f')])){for(var _0x59b2c9=0x0;_0x59b2c9<_0x3f1ea5[_0xd714('0x53')][_0xd714('0x6f')][_0xd714('0x58')];_0x59b2c9+=0x1){socket[_0xd714('0xaa')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x3f1ea5[_0xd714('0x53')][_0xd714('0x6f')][_0x59b2c9]),'UserId':Number(_0x3f1ea5['params']['id'])});}}else{socket['emit'](_0xd714('0x112'),{'MailInteractionId':Number(_0x3f1ea5['query'][_0xd714('0x6f')]),'UserId':Number(_0x3f1ea5[_0xd714('0x67')]['id'])});}});}})[_0xd714('0x25')](respondWithStatusCode(_0x292591,null))['catch'](handleError(_0x292591,null));};exports['addFaxInteractions']=function(_0x3ae40e,_0x5b13d8,_0x58f04f){return db['User']['find']({'where':{'id':_0x3ae40e[_0xd714('0x67')]['id']}})['then'](handleEntityNotFound(_0x5b13d8,null))['then'](function(_0xf20e6c){if(_0xf20e6c){return _0xf20e6c[_0xd714('0x113')](_0x3ae40e['body'][_0xd714('0x6f')],_[_0xd714('0x70')](_0x3ae40e[_0xd714('0x6c')],['ids','id'])||{})[_0xd714('0xa8')](function(){for(var _0x25965d=0x0;_0x25965d<_0x3ae40e[_0xd714('0x6c')][_0xd714('0x6f')][_0xd714('0x58')];_0x25965d+=0x1){socket['emit'](_0xd714('0x114'),{'FaxInteractionId':Number(_0x3ae40e[_0xd714('0x6c')]['ids'][_0x25965d]),'UserId':Number(_0x3ae40e['params']['id'])});}return _0x3ae40e[_0xd714('0x6c')][_0xd714('0x6f')];});}})[_0xd714('0x25')](respondWithResult(_0x5b13d8,null))[_0xd714('0x30')](handleError(_0x5b13d8,null));};exports[_0xd714('0x115')]=function(_0x3312b1,_0x310548,_0x4efd47){var _0x291ab5;return db[_0xd714('0x4e')][_0xd714('0x45')]({'where':{'id':_0x3312b1[_0xd714('0x67')]['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x310548,null))[_0xd714('0x25')](function(_0x1ca4de){if(_0x1ca4de){return _0x1ca4de[_0xd714('0x115')](_0x3312b1[_0xd714('0x53')][_0xd714('0x6f')])[_0xd714('0x25')](function(_0x2845bc){if(_[_0xd714('0x111')](_0x3312b1['query'][_0xd714('0x6f')])){for(var _0x3dd095=0x0;_0x3dd095<_0x3312b1['query'][_0xd714('0x6f')]['length'];_0x3dd095+=0x1){socket['emit'](_0xd714('0x116'),{'FaxInteractionId':Number(_0x3312b1[_0xd714('0x53')][_0xd714('0x6f')][_0x3dd095]),'UserId':Number(_0x3312b1[_0xd714('0x67')]['id'])});}}else{socket['emit'](_0xd714('0x116'),{'FaxInteractionId':Number(_0x3312b1[_0xd714('0x53')][_0xd714('0x6f')]),'UserId':Number(_0x3312b1[_0xd714('0x67')]['id'])});}});}})[_0xd714('0x25')](respondWithStatusCode(_0x310548,null))[_0xd714('0x30')](handleError(_0x310548,null));};exports[_0xd714('0x117')]=function(_0x3f35ac,_0x461ea2,_0x55e06c){return db[_0xd714('0x4e')]['find']({'where':{'id':_0x3f35ac['params']['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x461ea2,null))[_0xd714('0x25')](function(_0x368c57){if(_0x368c57){return _0x368c57['addSmsInteractions'](_0x3f35ac[_0xd714('0x6c')][_0xd714('0x6f')],_['omit'](_0x3f35ac[_0xd714('0x6c')],[_0xd714('0x6f'),'id'])||{})[_0xd714('0xa8')](function(){for(var _0x486a87=0x0;_0x486a87<_0x3f35ac[_0xd714('0x6c')][_0xd714('0x6f')]['length'];_0x486a87+=0x1){socket[_0xd714('0xaa')](_0xd714('0x118'),{'SmsInteractionId':Number(_0x3f35ac[_0xd714('0x6c')]['ids'][_0x486a87]),'UserId':Number(_0x3f35ac[_0xd714('0x67')]['id'])});}return _0x3f35ac[_0xd714('0x6c')]['ids'];});}})[_0xd714('0x25')](respondWithResult(_0x461ea2,null))[_0xd714('0x30')](handleError(_0x461ea2,null));};exports['removeSmsInteractions']=function(_0x43bdb6,_0x4e510d,_0x5d17b3){var _0x59fccd;return db[_0xd714('0x4e')][_0xd714('0x45')]({'where':{'id':_0x43bdb6[_0xd714('0x67')]['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x4e510d,null))[_0xd714('0x25')](function(_0x448cbe){if(_0x448cbe){return _0x448cbe[_0xd714('0x119')](_0x43bdb6['query'][_0xd714('0x6f')])[_0xd714('0x25')](function(_0x6a9541){if(_[_0xd714('0x111')](_0x43bdb6[_0xd714('0x53')][_0xd714('0x6f')])){for(var _0x643042=0x0;_0x643042<_0x43bdb6[_0xd714('0x53')][_0xd714('0x6f')][_0xd714('0x58')];_0x643042+=0x1){socket[_0xd714('0xaa')](_0xd714('0x11a'),{'SmsInteractionId':Number(_0x43bdb6[_0xd714('0x53')][_0xd714('0x6f')][_0x643042]),'UserId':Number(_0x43bdb6[_0xd714('0x67')]['id'])});}}else{socket['emit'](_0xd714('0x11a'),{'SmsInteractionId':Number(_0x43bdb6['query'][_0xd714('0x6f')]),'UserId':Number(_0x43bdb6[_0xd714('0x67')]['id'])});}});}})[_0xd714('0x25')](respondWithStatusCode(_0x4e510d,null))['catch'](handleError(_0x4e510d,null));};exports[_0xd714('0x11b')]=function(_0x394aaa,_0x2792f7,_0x15f382){return db[_0xd714('0x4e')]['find']({'where':{'id':_0x394aaa['params']['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x2792f7,null))[_0xd714('0x25')](function(_0xfa1128){if(_0xfa1128){return _0xfa1128[_0xd714('0x11b')](_0x394aaa['body']['ids'],_[_0xd714('0x70')](_0x394aaa[_0xd714('0x6c')],[_0xd714('0x6f'),'id'])||{})[_0xd714('0xa8')](function(){for(var _0x2d2971=0x0;_0x2d2971<_0x394aaa[_0xd714('0x6c')][_0xd714('0x6f')][_0xd714('0x58')];_0x2d2971+=0x1){socket[_0xd714('0xaa')](_0xd714('0x11c'),{'OpenchannelInteractionId':Number(_0x394aaa[_0xd714('0x6c')][_0xd714('0x6f')][_0x2d2971]),'UserId':Number(_0x394aaa['params']['id'])});}return _0x394aaa[_0xd714('0x6c')][_0xd714('0x6f')];});}})[_0xd714('0x25')](respondWithResult(_0x2792f7,null))['catch'](handleError(_0x2792f7,null));};exports[_0xd714('0x11d')]=function(_0x46ced2,_0x469d9b,_0x36a17d){var _0x4900ff;return db[_0xd714('0x4e')][_0xd714('0x45')]({'where':{'id':_0x46ced2[_0xd714('0x67')]['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x469d9b,null))[_0xd714('0x25')](function(_0x52b572){if(_0x52b572){return _0x52b572[_0xd714('0x11d')](_0x46ced2['query'][_0xd714('0x6f')])['then'](function(_0xea0caa){if(_[_0xd714('0x111')](_0x46ced2['query'][_0xd714('0x6f')])){for(var _0x19e439=0x0;_0x19e439<_0x46ced2['query']['ids']['length'];_0x19e439+=0x1){socket[_0xd714('0xaa')](_0xd714('0x11e'),{'OpenchannelInteractionId':Number(_0x46ced2[_0xd714('0x53')][_0xd714('0x6f')][_0x19e439]),'UserId':Number(_0x46ced2[_0xd714('0x67')]['id'])});}}else{socket[_0xd714('0xaa')](_0xd714('0x11e'),{'OpenchannelInteractionId':Number(_0x46ced2['query'][_0xd714('0x6f')]),'UserId':Number(_0x46ced2['params']['id'])});}});}})['then'](respondWithStatusCode(_0x469d9b,null))['catch'](handleError(_0x469d9b,null));};exports[_0xd714('0x11f')]=function(_0x57d7f3,_0x5c8db0,_0x3ed0c8){var _0x22b947={};var _0x31252e={};var _0x47137f;var _0x194b68;return db[_0xd714('0x4e')][_0xd714('0xc1')]({'where':{'id':_0x57d7f3['params']['id']}})['then'](handleEntityNotFound(_0x5c8db0,null))[_0xd714('0x25')](function(_0x276298){if(_0x276298){_0x47137f=_0x276298;_0x31252e[_0xd714('0x4f')]=_[_0xd714('0x51')](db[_0xd714('0x120')][_0xd714('0x68')]);_0x31252e[_0xd714('0x53')]=_[_0xd714('0x51')](_0x57d7f3['query']);_0x31252e[_0xd714('0x54')]=_[_0xd714('0x55')](_0x31252e[_0xd714('0x4f')],_0x31252e[_0xd714('0x53')]);_0x22b947['attributes']=_[_0xd714('0x55')](_0x31252e[_0xd714('0x4f')],qs[_0xd714('0x57')](_0x57d7f3[_0xd714('0x53')]['fields']));_0x22b947[_0xd714('0x56')]=_0x22b947['attributes']['length']?_0x22b947[_0xd714('0x56')]:_0x31252e[_0xd714('0x4f')];_0x22b947['order']=qs[_0xd714('0x5c')](_0x57d7f3[_0xd714('0x53')][_0xd714('0x5c')]);_0x22b947[_0xd714('0x5d')]=qs[_0xd714('0x54')](_['pick'](_0x57d7f3[_0xd714('0x53')],_0x31252e[_0xd714('0x54')]));if(_0x57d7f3[_0xd714('0x53')]['filter']){_0x22b947[_0xd714('0x5d')]=_[_0xd714('0x63')](_0x22b947[_0xd714('0x5d')],{'$or':_[_0xd714('0x43')](_0x22b947['attributes'],function(_0x2c7ba1){var _0x33bb98={};_0x33bb98[_0x2c7ba1]={'$like':'%'+_0x57d7f3[_0xd714('0x53')][_0xd714('0x41')]+'%'};return _0x33bb98;})});}_0x22b947=_[_0xd714('0x63')]({},_0x22b947,_0x57d7f3[_0xd714('0xcb')]);return _0x47137f[_0xd714('0x11f')](_0x22b947);}})[_0xd714('0x25')](function(_0xb9782a){if(_0xb9782a){_0x194b68=_0xb9782a[_0xd714('0x58')];if(!_0x57d7f3['query'][_0xd714('0x59')](_0xd714('0x5a'))){_0x22b947[_0xd714('0x37')]=qs[_0xd714('0x37')](_0x57d7f3[_0xd714('0x53')][_0xd714('0x37')]);_0x22b947[_0xd714('0x36')]=qs[_0xd714('0x36')](_0x57d7f3[_0xd714('0x53')][_0xd714('0x36')]);}return _0x47137f[_0xd714('0x11f')](_0x22b947);}})[_0xd714('0x25')](function(_0x58e0dd){if(_0x58e0dd){return _0x58e0dd?{'count':_0x194b68,'rows':_0x58e0dd}:null;}})[_0xd714('0x25')](respondWithResult(_0x5c8db0,null))[_0xd714('0x30')](handleError(_0x5c8db0,null));};exports[_0xd714('0x121')]=function(_0x20c2cb,_0x15962f,_0x4eda1a){var _0x455f28={};var _0x41cfad={};var _0xdffdfc;var _0x49f692;return db[_0xd714('0x4e')][_0xd714('0xc1')]({'where':{'id':_0x20c2cb[_0xd714('0x67')]['id']}})['then'](handleEntityNotFound(_0x15962f,null))[_0xd714('0x25')](function(_0x134dca){if(_0x134dca){_0xdffdfc=_0x134dca;_0x41cfad[_0xd714('0x4f')]=_[_0xd714('0x51')](db[_0xd714('0x122')][_0xd714('0x68')]);_0x41cfad['query']=_[_0xd714('0x51')](_0x20c2cb[_0xd714('0x53')]);_0x41cfad[_0xd714('0x54')]=_[_0xd714('0x55')](_0x41cfad[_0xd714('0x4f')],_0x41cfad[_0xd714('0x53')]);_0x455f28[_0xd714('0x56')]=_[_0xd714('0x55')](_0x41cfad[_0xd714('0x4f')],qs[_0xd714('0x57')](_0x20c2cb[_0xd714('0x53')][_0xd714('0x57')]));_0x455f28['attributes']=_0x455f28[_0xd714('0x56')][_0xd714('0x58')]?_0x455f28[_0xd714('0x56')]:_0x41cfad[_0xd714('0x4f')];_0x455f28[_0xd714('0x5b')]=qs['sort'](_0x20c2cb[_0xd714('0x53')][_0xd714('0x5c')]);_0x455f28[_0xd714('0x5d')]=qs[_0xd714('0x54')](_[_0xd714('0x5e')](_0x20c2cb[_0xd714('0x53')],_0x41cfad[_0xd714('0x54')]));if(_0x20c2cb[_0xd714('0x53')][_0xd714('0x41')]){_0x455f28[_0xd714('0x5d')]=_[_0xd714('0x63')](_0x455f28[_0xd714('0x5d')],{'$or':_['map'](_0x455f28[_0xd714('0x56')],function(_0x531fa4){var _0x5162c8={};_0x5162c8[_0x531fa4]={'$like':'%'+_0x20c2cb['query'][_0xd714('0x41')]+'%'};return _0x5162c8;})});}_0x455f28=_[_0xd714('0x63')]({},_0x455f28,_0x20c2cb[_0xd714('0xcb')]);return _0xdffdfc[_0xd714('0x121')](_0x455f28);}})[_0xd714('0x25')](function(_0x83c890){if(_0x83c890){_0x49f692=_0x83c890['length'];if(!_0x20c2cb[_0xd714('0x53')]['hasOwnProperty']('nolimit')){_0x455f28[_0xd714('0x37')]=qs[_0xd714('0x37')](_0x20c2cb['query'][_0xd714('0x37')]);_0x455f28['offset']=qs[_0xd714('0x36')](_0x20c2cb[_0xd714('0x53')][_0xd714('0x36')]);}return _0xdffdfc[_0xd714('0x121')](_0x455f28);}})[_0xd714('0x25')](function(_0x14210d){if(_0x14210d){return _0x14210d?{'count':_0x49f692,'rows':_0x14210d}:null;}})[_0xd714('0x25')](respondWithResult(_0x15962f,null))[_0xd714('0x30')](handleError(_0x15962f,null));};exports[_0xd714('0x123')]=function(_0x144a1a,_0x1764cc,_0x21b169){return db['User'][_0xd714('0x45')]({'where':{'id':_0x144a1a[_0xd714('0x67')]['id']}})['then'](handleEntityNotFound(_0x1764cc,null))['then'](function(_0x3374b9){if(_0x3374b9){return _0x3374b9[_0xd714('0x123')](_0x144a1a[_0xd714('0x6c')]['ids'],_[_0xd714('0x70')](_0x144a1a['body'],[_0xd714('0x6f'),'id'])||{});}})[_0xd714('0x25')](respondWithResult(_0x1764cc,null))[_0xd714('0x30')](handleError(_0x1764cc,null));};exports[_0xd714('0x124')]=function(_0x2cc151,_0x2a2def,_0x5e3d43){var _0x1f594a;return db[_0xd714('0x4e')]['find']({'where':{'id':_0x2cc151[_0xd714('0x67')]['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x2a2def,null))[_0xd714('0x25')](function(_0x2d0f0c){if(_0x2d0f0c){return _0x2d0f0c['removeFaxAccounts'](_0x2cc151[_0xd714('0x53')][_0xd714('0x6f')]);}})[_0xd714('0x25')](respondWithStatusCode(_0x2a2def,null))[_0xd714('0x30')](handleError(_0x2a2def,null));};exports['getMailAccounts']=function(_0x189ed9,_0x5f40db,_0x10e40b){var _0x5a2875={};var _0x579e9c={};var _0x91ac64;var _0x2fa610;return db[_0xd714('0x4e')][_0xd714('0xc1')]({'where':{'id':_0x189ed9[_0xd714('0x67')]['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x5f40db,null))[_0xd714('0x25')](function(_0x1b42d4){if(_0x1b42d4){_0x91ac64=_0x1b42d4;_0x579e9c[_0xd714('0x4f')]=_[_0xd714('0x51')](db[_0xd714('0x125')][_0xd714('0x68')]);_0x579e9c[_0xd714('0x53')]=_[_0xd714('0x51')](_0x189ed9[_0xd714('0x53')]);_0x579e9c[_0xd714('0x54')]=_[_0xd714('0x55')](_0x579e9c[_0xd714('0x4f')],_0x579e9c['query']);_0x5a2875[_0xd714('0x56')]=_[_0xd714('0x55')](_0x579e9c[_0xd714('0x4f')],qs['fields'](_0x189ed9[_0xd714('0x53')][_0xd714('0x57')]));_0x5a2875[_0xd714('0x56')]=_0x5a2875[_0xd714('0x56')][_0xd714('0x58')]?_0x5a2875[_0xd714('0x56')]:_0x579e9c[_0xd714('0x4f')];_0x5a2875[_0xd714('0x5b')]=qs['sort'](_0x189ed9[_0xd714('0x53')][_0xd714('0x5c')]);_0x5a2875[_0xd714('0x5d')]=qs[_0xd714('0x54')](_[_0xd714('0x5e')](_0x189ed9[_0xd714('0x53')],_0x579e9c[_0xd714('0x54')]));if(_0x189ed9[_0xd714('0x53')][_0xd714('0x41')]){_0x5a2875['where']=_[_0xd714('0x63')](_0x5a2875[_0xd714('0x5d')],{'$or':_[_0xd714('0x43')](_0x5a2875['attributes'],function(_0x3972b6){var _0x56c2a6={};_0x56c2a6[_0x3972b6]={'$like':'%'+_0x189ed9[_0xd714('0x53')][_0xd714('0x41')]+'%'};return _0x56c2a6;})});}_0x5a2875=_[_0xd714('0x63')]({},_0x5a2875,_0x189ed9[_0xd714('0xcb')]);return _0x91ac64[_0xd714('0x126')](_0x5a2875);}})[_0xd714('0x25')](function(_0x4ba0b4){if(_0x4ba0b4){_0x2fa610=_0x4ba0b4[_0xd714('0x58')];if(!_0x189ed9['query']['hasOwnProperty'](_0xd714('0x5a'))){_0x5a2875[_0xd714('0x37')]=qs[_0xd714('0x37')](_0x189ed9['query'][_0xd714('0x37')]);_0x5a2875['offset']=qs['offset'](_0x189ed9['query'][_0xd714('0x36')]);}return _0x91ac64[_0xd714('0x126')](_0x5a2875);}})[_0xd714('0x25')](function(_0x26fad7){if(_0x26fad7){return _0x26fad7?{'count':_0x2fa610,'rows':_0x26fad7}:null;}})[_0xd714('0x25')](respondWithResult(_0x5f40db,null))[_0xd714('0x30')](handleError(_0x5f40db,null));};exports[_0xd714('0x127')]=function(_0x3e35dd,_0x42884c,_0x2e1921){return db['User'][_0xd714('0x45')]({'where':{'id':_0x3e35dd[_0xd714('0x67')]['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x42884c,null))[_0xd714('0x25')](function(_0x298b12){if(_0x298b12){return _0x298b12[_0xd714('0x127')](_0x3e35dd[_0xd714('0x6c')][_0xd714('0x6f')],_[_0xd714('0x70')](_0x3e35dd[_0xd714('0x6c')],['ids','id'])||{});}})[_0xd714('0x25')](respondWithResult(_0x42884c,null))[_0xd714('0x30')](handleError(_0x42884c,null));};exports[_0xd714('0x128')]=function(_0x425802,_0x36f47a,_0x3a6c16){var _0x1f59f6;return db['User'][_0xd714('0x45')]({'where':{'id':_0x425802[_0xd714('0x67')]['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x36f47a,null))[_0xd714('0x25')](function(_0x178a40){if(_0x178a40){return _0x178a40[_0xd714('0x128')](_0x425802['query'][_0xd714('0x6f')]);}})[_0xd714('0x25')](respondWithStatusCode(_0x36f47a,null))[_0xd714('0x30')](handleError(_0x36f47a,null));};exports[_0xd714('0x129')]=function(_0x2e8b82,_0x303348,_0xb32dd0){var _0x1a0d33={};var _0x49096f={};var _0x11f85a;var _0x3ac90c;return db[_0xd714('0x4e')][_0xd714('0xc1')]({'where':{'id':_0x2e8b82[_0xd714('0x67')]['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x303348,null))[_0xd714('0x25')](function(_0x49e463){if(_0x49e463){_0x11f85a=_0x49e463;_0x49096f[_0xd714('0x4f')]=_[_0xd714('0x51')](db['OpenchannelAccount'][_0xd714('0x68')]);_0x49096f[_0xd714('0x53')]=_[_0xd714('0x51')](_0x2e8b82[_0xd714('0x53')]);_0x49096f['filters']=_[_0xd714('0x55')](_0x49096f[_0xd714('0x4f')],_0x49096f['query']);_0x1a0d33[_0xd714('0x56')]=_['intersection'](_0x49096f['model'],qs[_0xd714('0x57')](_0x2e8b82['query']['fields']));_0x1a0d33[_0xd714('0x56')]=_0x1a0d33['attributes'][_0xd714('0x58')]?_0x1a0d33[_0xd714('0x56')]:_0x49096f[_0xd714('0x4f')];_0x1a0d33[_0xd714('0x5b')]=qs[_0xd714('0x5c')](_0x2e8b82[_0xd714('0x53')][_0xd714('0x5c')]);_0x1a0d33[_0xd714('0x5d')]=qs[_0xd714('0x54')](_['pick'](_0x2e8b82[_0xd714('0x53')],_0x49096f[_0xd714('0x54')]));if(_0x2e8b82[_0xd714('0x53')][_0xd714('0x41')]){_0x1a0d33[_0xd714('0x5d')]=_[_0xd714('0x63')](_0x1a0d33['where'],{'$or':_[_0xd714('0x43')](_0x1a0d33[_0xd714('0x56')],function(_0x26885b){var _0x4aa509={};_0x4aa509[_0x26885b]={'$like':'%'+_0x2e8b82[_0xd714('0x53')]['filter']+'%'};return _0x4aa509;})});}_0x1a0d33=_[_0xd714('0x63')]({},_0x1a0d33,_0x2e8b82[_0xd714('0xcb')]);return _0x11f85a[_0xd714('0x129')](_0x1a0d33);}})['then'](function(_0x5be7a4){if(_0x5be7a4){_0x3ac90c=_0x5be7a4['length'];if(!_0x2e8b82[_0xd714('0x53')]['hasOwnProperty']('nolimit')){_0x1a0d33[_0xd714('0x37')]=qs[_0xd714('0x37')](_0x2e8b82['query'][_0xd714('0x37')]);_0x1a0d33[_0xd714('0x36')]=qs['offset'](_0x2e8b82[_0xd714('0x53')]['offset']);}return _0x11f85a[_0xd714('0x129')](_0x1a0d33);}})['then'](function(_0x4fdc55){if(_0x4fdc55){return _0x4fdc55?{'count':_0x3ac90c,'rows':_0x4fdc55}:null;}})[_0xd714('0x25')](respondWithResult(_0x303348,null))[_0xd714('0x30')](handleError(_0x303348,null));};exports['addOpenchannelAccounts']=function(_0x49338e,_0x121e0b,_0x359b5d){return db[_0xd714('0x4e')]['find']({'where':{'id':_0x49338e[_0xd714('0x67')]['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x121e0b,null))[_0xd714('0x25')](function(_0x159abd){if(_0x159abd){return _0x159abd[_0xd714('0x12a')](_0x49338e[_0xd714('0x6c')][_0xd714('0x6f')],_[_0xd714('0x70')](_0x49338e[_0xd714('0x6c')],[_0xd714('0x6f'),'id'])||{});}})[_0xd714('0x25')](respondWithResult(_0x121e0b,null))[_0xd714('0x30')](handleError(_0x121e0b,null));};exports[_0xd714('0x12b')]=function(_0x3b4190,_0x582f9a,_0x194d84){var _0x47c167;return db['User'][_0xd714('0x45')]({'where':{'id':_0x3b4190['params']['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x582f9a,null))['then'](function(_0x54aa7b){if(_0x54aa7b){return _0x54aa7b[_0xd714('0x12b')](_0x3b4190[_0xd714('0x53')]['ids']);}})['then'](respondWithStatusCode(_0x582f9a,null))[_0xd714('0x30')](handleError(_0x582f9a,null));};exports['getSmsAccounts']=function(_0x5da723,_0x1d5ce8,_0x274141){var _0x5d4e29={};var _0x455f7c={};var _0x51c056;var _0x298d46;return db[_0xd714('0x4e')][_0xd714('0xc1')]({'where':{'id':_0x5da723[_0xd714('0x67')]['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x1d5ce8,null))[_0xd714('0x25')](function(_0xd862a2){if(_0xd862a2){_0x51c056=_0xd862a2;_0x455f7c[_0xd714('0x4f')]=_[_0xd714('0x51')](db['SmsAccount']['rawAttributes']);_0x455f7c[_0xd714('0x53')]=_[_0xd714('0x51')](_0x5da723[_0xd714('0x53')]);_0x455f7c[_0xd714('0x54')]=_[_0xd714('0x55')](_0x455f7c[_0xd714('0x4f')],_0x455f7c[_0xd714('0x53')]);_0x5d4e29[_0xd714('0x56')]=_[_0xd714('0x55')](_0x455f7c[_0xd714('0x4f')],qs[_0xd714('0x57')](_0x5da723[_0xd714('0x53')][_0xd714('0x57')]));_0x5d4e29['attributes']=_0x5d4e29[_0xd714('0x56')]['length']?_0x5d4e29['attributes']:_0x455f7c[_0xd714('0x4f')];_0x5d4e29['order']=qs['sort'](_0x5da723[_0xd714('0x53')][_0xd714('0x5c')]);_0x5d4e29[_0xd714('0x5d')]=qs[_0xd714('0x54')](_[_0xd714('0x5e')](_0x5da723[_0xd714('0x53')],_0x455f7c[_0xd714('0x54')]));if(_0x5da723['query'][_0xd714('0x41')]){_0x5d4e29[_0xd714('0x5d')]=_[_0xd714('0x63')](_0x5d4e29[_0xd714('0x5d')],{'$or':_['map'](_0x5d4e29['attributes'],function(_0x386786){var _0x4ee28b={};_0x4ee28b[_0x386786]={'$like':'%'+_0x5da723[_0xd714('0x53')][_0xd714('0x41')]+'%'};return _0x4ee28b;})});}_0x5d4e29=_[_0xd714('0x63')]({},_0x5d4e29,_0x5da723[_0xd714('0xcb')]);return _0x51c056[_0xd714('0x12c')](_0x5d4e29);}})[_0xd714('0x25')](function(_0x257fd9){if(_0x257fd9){_0x298d46=_0x257fd9[_0xd714('0x58')];if(!_0x5da723[_0xd714('0x53')]['hasOwnProperty'](_0xd714('0x5a'))){_0x5d4e29[_0xd714('0x37')]=qs[_0xd714('0x37')](_0x5da723[_0xd714('0x53')][_0xd714('0x37')]);_0x5d4e29[_0xd714('0x36')]=qs[_0xd714('0x36')](_0x5da723[_0xd714('0x53')][_0xd714('0x36')]);}return _0x51c056[_0xd714('0x12c')](_0x5d4e29);}})[_0xd714('0x25')](function(_0xd4cec1){if(_0xd4cec1){return _0xd4cec1?{'count':_0x298d46,'rows':_0xd4cec1}:null;}})[_0xd714('0x25')](respondWithResult(_0x1d5ce8,null))['catch'](handleError(_0x1d5ce8,null));};exports[_0xd714('0x12d')]=function(_0x5a822b,_0x3fef3c,_0x113754){return db[_0xd714('0x4e')][_0xd714('0x45')]({'where':{'id':_0x5a822b[_0xd714('0x67')]['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x3fef3c,null))[_0xd714('0x25')](function(_0x177b00){if(_0x177b00){return _0x177b00['addSmsAccounts'](_0x5a822b['body']['ids'],_[_0xd714('0x70')](_0x5a822b[_0xd714('0x6c')],[_0xd714('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x3fef3c,null))[_0xd714('0x30')](handleError(_0x3fef3c,null));};exports['removeSmsAccounts']=function(_0x17f2a4,_0x40cf6f,_0x4686d7){var _0x4b90f6;return db[_0xd714('0x4e')]['find']({'where':{'id':_0x17f2a4['params']['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x40cf6f,null))['then'](function(_0x4e1489){if(_0x4e1489){return _0x4e1489[_0xd714('0x12e')](_0x17f2a4[_0xd714('0x53')]['ids']);}})[_0xd714('0x25')](respondWithStatusCode(_0x40cf6f,null))['catch'](handleError(_0x40cf6f,null));};exports[_0xd714('0x12f')]=function(_0x1c7f9b,_0x47b5c2,_0x2a4c89){var _0xda899c={};var _0x2cf019={};var _0x53fdf7;var _0x4b6aab;return db[_0xd714('0x4e')][_0xd714('0xc1')]({'where':{'id':_0x1c7f9b['params']['id']}})['then'](handleEntityNotFound(_0x47b5c2,null))[_0xd714('0x25')](function(_0x24c5b9){if(_0x24c5b9){_0x53fdf7=_0x24c5b9;_0x2cf019[_0xd714('0x4f')]=_['keys'](db[_0xd714('0x130')][_0xd714('0x68')]);_0x2cf019[_0xd714('0x53')]=_[_0xd714('0x51')](_0x1c7f9b[_0xd714('0x53')]);_0x2cf019[_0xd714('0x54')]=_[_0xd714('0x55')](_0x2cf019['model'],_0x2cf019[_0xd714('0x53')]);_0xda899c['attributes']=_[_0xd714('0x55')](_0x2cf019[_0xd714('0x4f')],qs[_0xd714('0x57')](_0x1c7f9b[_0xd714('0x53')]['fields']));_0xda899c[_0xd714('0x56')]=_0xda899c['attributes'][_0xd714('0x58')]?_0xda899c[_0xd714('0x56')]:_0x2cf019[_0xd714('0x4f')];_0xda899c['order']=qs['sort'](_0x1c7f9b[_0xd714('0x53')][_0xd714('0x5c')]);_0xda899c[_0xd714('0x5d')]=qs[_0xd714('0x54')](_[_0xd714('0x5e')](_0x1c7f9b[_0xd714('0x53')],_0x2cf019['filters']));if(_0x1c7f9b[_0xd714('0x53')][_0xd714('0x41')]){_0xda899c[_0xd714('0x5d')]=_[_0xd714('0x63')](_0xda899c[_0xd714('0x5d')],{'$or':_[_0xd714('0x43')](_0xda899c['attributes'],function(_0x2a59b7){var _0x57b3f6={};_0x57b3f6[_0x2a59b7]={'$like':'%'+_0x1c7f9b[_0xd714('0x53')][_0xd714('0x41')]+'%'};return _0x57b3f6;})});}_0xda899c=_['merge']({},_0xda899c,_0x1c7f9b[_0xd714('0xcb')]);return _0x53fdf7[_0xd714('0x12f')](_0xda899c);}})[_0xd714('0x25')](function(_0xdb7dfd){if(_0xdb7dfd){_0x4b6aab=_0xdb7dfd[_0xd714('0x58')];if(!_0x1c7f9b['query'][_0xd714('0x59')](_0xd714('0x5a'))){_0xda899c[_0xd714('0x37')]=qs[_0xd714('0x37')](_0x1c7f9b[_0xd714('0x53')][_0xd714('0x37')]);_0xda899c[_0xd714('0x36')]=qs[_0xd714('0x36')](_0x1c7f9b[_0xd714('0x53')]['offset']);}return _0x53fdf7[_0xd714('0x12f')](_0xda899c);}})[_0xd714('0x25')](function(_0x413841){if(_0x413841){return _0x413841?{'count':_0x4b6aab,'rows':_0x413841}:null;}})['then'](respondWithResult(_0x47b5c2,null))[_0xd714('0x30')](handleError(_0x47b5c2,null));};exports[_0xd714('0x131')]=function(_0x581e4d,_0x410127,_0x108ae1){return db[_0xd714('0x4e')]['find']({'where':{'id':_0x581e4d['params']['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x410127,null))[_0xd714('0x25')](function(_0x59d163){if(_0x59d163){return _0x59d163[_0xd714('0x131')](_0x581e4d[_0xd714('0x6c')]['ids'],_[_0xd714('0x70')](_0x581e4d[_0xd714('0x6c')],['ids','id'])||{});}})[_0xd714('0x25')](respondWithResult(_0x410127,null))[_0xd714('0x30')](handleError(_0x410127,null));};exports['removeChatWebsites']=function(_0x196341,_0x2e4121,_0x24a47b){var _0xa76cbb;return db[_0xd714('0x4e')]['find']({'where':{'id':_0x196341[_0xd714('0x67')]['id']}})['then'](handleEntityNotFound(_0x2e4121,null))[_0xd714('0x25')](function(_0x568c76){if(_0x568c76){return _0x568c76[_0xd714('0x132')](_0x196341['query']['ids']);}})[_0xd714('0x25')](respondWithStatusCode(_0x2e4121,null))['catch'](handleError(_0x2e4121,null));};exports[_0xd714('0x133')]=function(_0x45d232,_0x28b05c,_0x5bba68){var _0x132224={};var _0x5061e5={};var _0xcfbfa;var _0x31ea94;return db['User']['findOne']({'where':{'id':_0x45d232[_0xd714('0x67')]['id']}})['then'](handleEntityNotFound(_0x28b05c,null))['then'](function(_0x3ea118){if(_0x3ea118){_0xcfbfa=_0x3ea118;_0x5061e5[_0xd714('0x4f')]=_[_0xd714('0x51')](db[_0xd714('0x134')]['rawAttributes']);_0x5061e5[_0xd714('0x53')]=_[_0xd714('0x51')](_0x45d232[_0xd714('0x53')]);_0x5061e5[_0xd714('0x54')]=_[_0xd714('0x55')](_0x5061e5[_0xd714('0x4f')],_0x5061e5[_0xd714('0x53')]);_0x132224[_0xd714('0x56')]=_['intersection'](_0x5061e5[_0xd714('0x4f')],qs[_0xd714('0x57')](_0x45d232['query'][_0xd714('0x57')]));_0x132224[_0xd714('0x56')]=_0x132224[_0xd714('0x56')][_0xd714('0x58')]?_0x132224['attributes']:_0x5061e5['model'];_0x132224['order']=qs[_0xd714('0x5c')](_0x45d232[_0xd714('0x53')][_0xd714('0x5c')]);_0x132224[_0xd714('0x5d')]=qs[_0xd714('0x54')](_[_0xd714('0x5e')](_0x45d232[_0xd714('0x53')],_0x5061e5[_0xd714('0x54')]));if(_0x45d232[_0xd714('0x53')][_0xd714('0x41')]){_0x132224[_0xd714('0x5d')]=_[_0xd714('0x63')](_0x132224['where'],{'$or':_['map'](_0x132224[_0xd714('0x56')],function(_0x4ca05f){var _0x37cb6c={};_0x37cb6c[_0x4ca05f]={'$like':'%'+_0x45d232[_0xd714('0x53')][_0xd714('0x41')]+'%'};return _0x37cb6c;})});}_0x132224=_[_0xd714('0x63')]({},_0x132224,_0x45d232['options']);return _0xcfbfa['getSquareProjects'](_0x132224);}})[_0xd714('0x25')](function(_0x2f571a){if(_0x2f571a){_0x31ea94=_0x2f571a['length'];if(!_0x45d232[_0xd714('0x53')][_0xd714('0x59')](_0xd714('0x5a'))){_0x132224['limit']=qs[_0xd714('0x37')](_0x45d232[_0xd714('0x53')][_0xd714('0x37')]);_0x132224[_0xd714('0x36')]=qs[_0xd714('0x36')](_0x45d232[_0xd714('0x53')][_0xd714('0x36')]);}return _0xcfbfa[_0xd714('0x133')](_0x132224);}})[_0xd714('0x25')](function(_0x29ffaa){if(_0x29ffaa){return _0x29ffaa?{'count':_0x31ea94,'rows':_0x29ffaa}:null;}})['then'](respondWithResult(_0x28b05c,null))[_0xd714('0x30')](handleError(_0x28b05c,null));};exports[_0xd714('0x135')]=function(_0x180927,_0x1bb591,_0x459263){return db[_0xd714('0x4e')]['find']({'where':{'id':_0x180927['params']['id']}})[_0xd714('0x25')](handleEntityNotFound(_0x1bb591,null))[_0xd714('0x25')](function(_0x21143e){if(_0x21143e){return _0x21143e[_0xd714('0x135')](_0x180927['body'][_0xd714('0x6f')],_[_0xd714('0x70')](_0x180927[_0xd714('0x6c')],[_0xd714('0x6f'),'id'])||{});}})[_0xd714('0x25')](respondWithResult(_0x1bb591,null))[_0xd714('0x30')](handleError(_0x1bb591,null));};exports[_0xd714('0x136')]=function(_0x26476d,_0x370f1e,_0x13b1ad){var _0x23001a;return db[_0xd714('0x4e')][_0xd714('0x45')]({'where':{'id':_0x26476d[_0xd714('0x67')]['id']}})['then'](handleEntityNotFound(_0x370f1e,null))[_0xd714('0x25')](function(_0x22895b){if(_0x22895b){return _0x22895b['removeSquareProjects'](_0x26476d[_0xd714('0x53')][_0xd714('0x6f')]);}})[_0xd714('0x25')](respondWithStatusCode(_0x370f1e,null))[_0xd714('0x30')](handleError(_0x370f1e,null));};exports[_0xd714('0x137')]=function(_0x29cd25,_0x18522d){var _0x1c781e={},_0x49e340={},_0x2504bb={'count':0x0,'rows':[]};var _0x507757=db['CmHopper'][_0xd714('0x68')];_0x49e340[_0xd714('0x4f')]=_['keys'](_0x507757);_0x49e340[_0xd714('0x53')]=_['keys'](_0x29cd25['query']);_0x49e340[_0xd714('0x54')]=_['intersection'](_0x49e340[_0xd714('0x4f')],_0x49e340[_0xd714('0x53')]);_0x49e340[_0xd714('0x54')]=_['concat'](_0x49e340[_0xd714('0x54')],['$and','$or','$gt',_0xd714('0x138'),'$lt',_0xd714('0x139'),'$ne',_0xd714('0x13a'),_0xd714('0x13b'),'$between',_0xd714('0x13c'),'$in',_0xd714('0x13d'),_0xd714('0x13e'),'$notLike',_0xd714('0x13f'),_0xd714('0x140'),_0xd714('0x13e'),_0xd714('0x141'),_0xd714('0x142'),_0xd714('0x143'),'$any']);_0x1c781e[_0xd714('0x56')]=_['intersection'](_0x49e340['model'],qs[_0xd714('0x57')](_0x29cd25[_0xd714('0x53')][_0xd714('0x57')]));_0x1c781e['attributes']=_0x1c781e['attributes']['length']?_0x1c781e[_0xd714('0x56')]:_0x49e340[_0xd714('0x4f')];if(!_0x29cd25[_0xd714('0x53')][_0xd714('0x59')](_0xd714('0x5a'))){_0x1c781e['limit']=qs[_0xd714('0x37')](_0x29cd25[_0xd714('0x53')][_0xd714('0x37')]);_0x1c781e['offset']=qs['offset'](_0x29cd25['query'][_0xd714('0x36')]);}_0x1c781e['order']=qs[_0xd714('0x5c')](_0x29cd25[_0xd714('0x53')]['sort']);_0x1c781e[_0xd714('0x5d')]=qs[_0xd714('0x54')](_[_0xd714('0x5e')](_0x29cd25['query'],_0x49e340[_0xd714('0x54')]));if(_0x29cd25[_0xd714('0x53')][_0xd714('0x41')]){_0x1c781e[_0xd714('0x5d')]=_[_0xd714('0x63')](_0x1c781e[_0xd714('0x5d')],{'$or':_[_0xd714('0x43')](_0x1c781e[_0xd714('0x56')],function(_0x20950d){var _0x19e165={};_0x19e165[_0x20950d]={'$like':'%'+_0x29cd25['query']['filter']+'%'};return _0x19e165;})});}_0x1c781e[_0xd714('0x5d')]={'$and':[_0x1c781e[_0xd714('0x5d')],{'$or':[{'UserId':_0x29cd25[_0xd714('0x67')]['id']},{'OwnerId':_0x29cd25['params']['id']}]}]};_0x1c781e=_[_0xd714('0x63')]({},_0x1c781e,_0x29cd25[_0xd714('0xcb')]);var _0x5df445={'where':_0x1c781e['where']};return db[_0xd714('0x144')][_0xd714('0x35')](_0x5df445)[_0xd714('0x25')](function(_0x34a738){_0x2504bb[_0xd714('0x35')]=_0x34a738;if(_0x29cd25['query']['includeAll']){_0x1c781e[_0xd714('0x6a')]=[{'attributes':['id',_0xd714('0x145'),_0xd714('0x146'),_0xd714('0xda')],'model':db[_0xd714('0xc2')],'as':_0xd714('0x147')},{'attributes':['id',_0xd714('0x48'),_0xd714('0x148')],'model':db[_0xd714('0xad')],'as':'Queue'}];}return db[_0xd714('0x144')][_0xd714('0x65')](_0x1c781e);})['then'](function(_0x51974b){_0x2504bb[_0xd714('0x66')]=_0x51974b;return _0x2504bb;})[_0xd714('0x25')](respondWithFilteredResult(_0x18522d,_0x1c781e))[_0xd714('0x30')](handleError(_0x18522d,null));};exports[_0xd714('0x149')]=function(_0x1b52ff,_0x334302,_0x31c937){if(!_[_0xd714('0x76')](_0x1b52ff['user']['id'])&&(_0x1b52ff[_0xd714('0x3e')][_0xd714('0x47')]==_0xd714('0x73')||_0x1b52ff['user'][_0xd714('0x47')]==_0xd714('0x3e'))){return db[_0xd714('0x4e')][_0xd714('0x45')]({'where':{'id':_0x1b52ff[_0xd714('0x67')]['id']}})['then'](function(_0x4240f9){var _0x21d49d=authService[_0xd714('0x14a')](_0x4240f9);if(_0x21d49d)return _0x334302[_0xd714('0x32')](0xc8)[_0xd714('0x34')]({'api_key':_0x21d49d});else return _0x334302[_0xd714('0x32')](0xcc)[_0xd714('0x34')]({'message':_0xd714('0x14b')});})[_0xd714('0x30')](handleError(_0x334302,0x193));}else{return _0x334302[_0xd714('0x32')](0x191)[_0xd714('0x34')]({'message':_0xd714('0x14c')});}};exports[_0xd714('0x14d')]=function(_0x6dd08c,_0x2ba10a,_0x12c6b6){var _0x24f97e;if(!_[_0xd714('0x76')](_0x6dd08c[_0xd714('0x3e')]['id'])&&(_0x6dd08c['user'][_0xd714('0x47')]==_0xd714('0x73')||_0x6dd08c[_0xd714('0x3e')][_0xd714('0x47')]=='user')){return db[_0xd714('0x4e')]['find']({'where':{'id':_0x6dd08c['params']['id']}})[_0xd714('0x25')](function(_0xcd9da0){return[_0xcd9da0,authService['generateApiKey'](_0xcd9da0)];})['then'](function(_0x30cca2){_0x24f97e=_0x30cca2;return db[_0xd714('0x4e')][_0xd714('0xf3')]({'apiKeyNonce':_0x24f97e[0x0][_0xd714('0x14e')],'apiKeyIat':_0x24f97e[0x0][_0xd714('0x14f')]},{'where':{'id':_0x6dd08c[_0xd714('0x67')]['id']}});})[_0xd714('0x25')](function(){return _0x2ba10a[_0xd714('0x32')](0xc8)['json']({'api_key':_0x24f97e[0x1]});})['catch'](handleError(_0x2ba10a,0x193));}else{return _0x2ba10a[_0xd714('0x32')](0x191)[_0xd714('0x34')]({'message':'You\x20don\x27t\x20have\x20sufficient\x20privelages\x20to\x20access\x20this\x20resource.'});}};exports[_0xd714('0x150')]=function(_0x11c6c3,_0x591e96,_0x271b1e){if(!_['isNil'](_0x11c6c3[_0xd714('0x3e')]['id'])&&(_0x11c6c3['user'][_0xd714('0x47')]==_0xd714('0x73')||_0x11c6c3[_0xd714('0x3e')][_0xd714('0x47')]==_0xd714('0x3e'))){return db['User']['find']({'where':{'id':_0x11c6c3[_0xd714('0x67')]['id']}})['then'](handleEntityNotFound(_0x591e96,null))[_0xd714('0x25')](function(_0x57fd5d){if(_0x57fd5d&&_0x57fd5d['apiKeyNonce']&&_0x57fd5d[_0xd714('0x14f')])return _0x57fd5d;else throw{'message':'API\x20key\x20not\x20available'};})[_0xd714('0x25')](function(_0x413d2d){return db[_0xd714('0x4e')][_0xd714('0xf3')]({'apiKeyNonce':null,'apiKeyIat':null},{'where':{'id':_0x11c6c3['params']['id']}});})[_0xd714('0x25')](respondWithStatusCode(_0x591e96,0xc8))['catch'](handleError(_0x591e96,0x193));}else{return _0x591e96[_0xd714('0x32')](0x191)[_0xd714('0x34')]({'message':'You\x20don\x27t\x20have\x20sufficient\x20privelages\x20to\x20access\x20this\x20resource.'});}};
\ No newline at end of file
index 71e4a2b..2632405 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc4aa=['../../mysqldb','User','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xc4aa[_0x45d55e];return _0x29812a;};'use strict';var EventEmitter=require(_0xac4a('0x0'));var User=require(_0xac4a('0x1'))['db'][_0xac4a('0x2')];var UserEvents=new EventEmitter();UserEvents[_0xac4a('0x3')](0x0);var events={'afterCreate':_0xac4a('0x4'),'afterUpdate':_0xac4a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5cda73){return function(_0x47d4f6,_0x2f48ed,_0x15b967){UserEvents[_0xac4a('0x6')](_0x5cda73+':'+_0x47d4f6['id'],_0x47d4f6);UserEvents[_0xac4a('0x6')](_0x5cda73,_0x47d4f6);_0x15b967(null);};}for(var e in events){if(events[_0xac4a('0x7')](e)){var event=events[e];User[_0xac4a('0x8')](e,emitEvent(event));}}module[_0xac4a('0x9')]=UserEvents;
\ No newline at end of file
+var _0x4975=['User','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x54c9dd,_0x233a86){var _0x855156=function(_0x2dd60b){while(--_0x2dd60b){_0x54c9dd['push'](_0x54c9dd['shift']());}};_0x855156(++_0x233a86);}(_0x4975,0x86));var _0x5497=function(_0x2d8209,_0x58b6bb){_0x2d8209=_0x2d8209-0x0;var _0x29bf12=_0x4975[_0x2d8209];return _0x29bf12;};'use strict';var EventEmitter=require(_0x5497('0x0'));var User=require('../../mysqldb')['db'][_0x5497('0x1')];var UserEvents=new EventEmitter();UserEvents[_0x5497('0x2')](0x0);var events={'afterCreate':_0x5497('0x3'),'afterUpdate':_0x5497('0x4'),'afterDestroy':_0x5497('0x5')};function emitEvent(_0x235986){return function(_0x14cecb,_0xeb31af,_0xbb1888){UserEvents[_0x5497('0x6')](_0x235986+':'+_0x14cecb['id'],_0x14cecb);UserEvents['emit'](_0x235986,_0x14cecb);_0xbb1888(null);};}for(var e in events){if(events[_0x5497('0x7')](e)){var event=events[e];User['hook'](e,emitEvent(event));}}module[_0x5497('0x8')]=UserEvents;
\ No newline at end of file
index f94f65b..b797055 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['findAll','internal','concat','catch','exports','define','User','users','utf8','utf8_bin','updateMd5Password','changed','updatePassword','bulkCreate','chanspy','then','VoiceExtension','destroy','encryptPassword','function','Missing\x20Callback','randomBytes','toString','salt','base64','sha1','pbkdf2','indexOf','Invalid\x20password','makeSalt','md5secret','bluebird','crypto','util','./user.attributes','length','context','from-sip','system','format','%s%s','prefix','record','push','merge','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','wav','gsm','Set','CDR(type)=internal','extensionMonitor','includes','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','Dial','SIP/%s,,tTxXU(xcally-mixmonitor-context)','SIP/%s,,tTxX','Hangup','priority','defaults'];(function(_0x4ec009,_0x310897){var _0x358461=function(_0x2e5f3c){while(--_0x2e5f3c){_0x4ec009['push'](_0x4ec009['shift']());}};_0x358461(++_0x310897);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var BPromise=require(_0x0a9e('0x0'));var crypto=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var md5=require('md5');var _=require('lodash');var attributes=require(_0x0a9e('0x3'));var authTypes=['google'];var validatePresenceOf=function(_0x333808){return _0x333808&&_0x333808[_0x0a9e('0x4')];};var getChanSpyApplications=function(_0x2ab90b,_0x991246,_0x981158){var _0x57b080={'context':_0x2ab90b[_0x0a9e('0x5')]||_0x0a9e('0x6'),'type':_0x0a9e('0x7'),'isApp':![],'UserId':_0x2ab90b['id']};var _0x5f41ea=[];for(var _0x503809=0x0,_0xe42b77=0x1;_0x503809<_0x981158['length'];_0x503809++,_0xe42b77=0x1){var _0x52cace={'exten':util[_0x0a9e('0x8')](_0x0a9e('0x9'),_0x981158[_0x503809][_0x0a9e('0xa')],_0x991246),'ChanSpyId':_0x981158[_0x503809]['id']};if(_0x981158[_0x503809][_0x0a9e('0xb')]){_0x5f41ea[_0x0a9e('0xc')](_[_0x0a9e('0xd')]({'app':'MixMonitor','appdata':util['format']('${UNIQUEID}.%s,ab',_0x981158[_0x503809]['recordingFormat']),'priority':_0xe42b77++},_0x57b080,_0x52cace));}if(_0x981158[_0x503809][_0x0a9e('0xe')]){_0x5f41ea[_0x0a9e('0xc')](_[_0x0a9e('0xd')]({'app':_0x0a9e('0xf'),'appdata':_0x981158[_0x503809][_0x0a9e('0x10')],'priority':_0xe42b77++},_0x57b080,_0x52cace));}_0x5f41ea[_0x0a9e('0xc')](_['merge']({'app':_0x0a9e('0x11'),'appdata':util[_0x0a9e('0x8')](_0x0a9e('0x12'),_0x2ab90b[_0x0a9e('0x13')],_0x981158[_0x503809][_0x0a9e('0x14')]?_0x981158[_0x503809][_0x0a9e('0x14')]['join'](''):''),'priority':_0xe42b77++},_0x57b080,_0x52cace));if(_0x981158[_0x503809][_0x0a9e('0xb')]){_0x5f41ea['push'](_[_0x0a9e('0xd')]({'app':'StopMixMonitor','priority':_0xe42b77++},_0x57b080,_0x52cace));}}return _0x5f41ea;};var getUserApplications=function(_0x16033c,_0x12066b){var _0x48f32d=[_0x0a9e('0x15'),'WAV',_0x0a9e('0x16')];var _0x478723={'context':_0x16033c[_0x0a9e('0x5')]||_0x0a9e('0x6'),'exten':_0x12066b,'type':_0x0a9e('0x7'),'isApp':![],'UserId':_0x16033c['id']};var _0x2eb11f=[{'app':_0x0a9e('0x17'),'appdata':_0x0a9e('0x18')}];if(_0x16033c[_0x0a9e('0x19')]&&_[_0x0a9e('0x1a')](_0x48f32d,_0x16033c[_0x0a9e('0x19')])){_0x2eb11f[_0x0a9e('0xc')]({'app':'Set','appdata':_0x0a9e('0x1b')});_0x2eb11f[_0x0a9e('0xc')]({'app':'Set','appdata':util[_0x0a9e('0x8')]('_XCALLY_MIXMONITOR_FORMAT=%s',_0x16033c['extensionMonitor'])});_0x2eb11f[_0x0a9e('0xc')]({'app':_0x0a9e('0x1c'),'appdata':util[_0x0a9e('0x8')](_0x0a9e('0x1d'),_0x16033c['name'])});}else{_0x2eb11f[_0x0a9e('0xc')]({'app':_0x0a9e('0x1c'),'appdata':util[_0x0a9e('0x8')](_0x0a9e('0x1e'),_0x16033c[_0x0a9e('0x13')])});}_0x2eb11f[_0x0a9e('0xc')]({'app':_0x0a9e('0x1f')});for(var _0x5ea472=0x0;_0x5ea472<_0x2eb11f['length'];_0x5ea472++){_0x2eb11f[_0x5ea472][_0x0a9e('0x20')]=_0x5ea472+0x1;_0x2eb11f[_0x5ea472]=_[_0x0a9e('0x21')](_0x2eb11f[_0x5ea472],_0x478723);}return _0x2eb11f;};var getChanSpyPromise=function(_0x40c424,_0x33161b){return new BPromise(function(_0x526cf3,_0x384319){return _0x40c424['VoiceChanSpy'][_0x0a9e('0x22')]()['then'](function(_0x1dc186){if(_0x1dc186){var _0x34dc65=getChanSpyApplications(_0x33161b,_0x33161b[_0x0a9e('0x23')],_0x1dc186);if(_0x33161b[_0x0a9e('0x23')]!=_0x33161b[_0x0a9e('0x13')]){_0x34dc65=_0x34dc65[_0x0a9e('0x24')](getChanSpyApplications(_0x33161b,_0x33161b[_0x0a9e('0x13')],_0x1dc186));}return _0x526cf3(_0x34dc65);}return _0x526cf3([]);})[_0x0a9e('0x25')](function(_0x5a101a){_0x384319(_0x5a101a);});});};module[_0x0a9e('0x26')]=function(_0x468813,_0x2b1f27){var _0x2ec755=_0x468813['models'];return _0x468813[_0x0a9e('0x27')](_0x0a9e('0x28'),attributes,{'tableName':_0x0a9e('0x29'),'charset':_0x0a9e('0x2a'),'collate':_0x0a9e('0x2b'),'hooks':{'beforeCreate':function(_0x563b45,_0x296f41,_0x2e8759){_0x563b45[_0x0a9e('0x2c')]();_0x563b45['updatePassword'](_0x2e8759);},'beforeUpdate':function(_0x426950,_0x5d1e0e,_0x2407f9){if(_0x426950[_0x0a9e('0x2d')](_0x0a9e('0x10'))){_0x426950[_0x0a9e('0x2c')]();return _0x426950[_0x0a9e('0x2e')](_0x2407f9);}_0x2407f9();},'afterCreate':function(_0x5180f1,_0x66c1d2,_0x46f0a5){var _0x40cb85=getUserApplications(_0x5180f1,_0x5180f1[_0x0a9e('0x23')]);if(_0x5180f1[_0x0a9e('0x23')]!=_0x5180f1[_0x0a9e('0x13')]){_0x40cb85=_0x40cb85[_0x0a9e('0x24')](getUserApplications(_0x5180f1,_0x5180f1[_0x0a9e('0x13')]));}return _0x2ec755['VoiceExtension'][_0x0a9e('0x2f')](_0x40cb85)['then'](function(){if(_0x5180f1[_0x0a9e('0x30')]){return getChanSpyPromise(_0x2ec755,_0x5180f1);}})[_0x0a9e('0x31')](function(_0x2b7e7f){if(_0x2b7e7f&&_0x2b7e7f[_0x0a9e('0x4')]){return _0x2ec755['VoiceExtension'][_0x0a9e('0x2f')](_0x2b7e7f);}})[_0x0a9e('0x31')](function(){_0x46f0a5();})[_0x0a9e('0x25')](function(_0x15de0e){_0x46f0a5(_0x15de0e);});},'afterUpdate':function(_0x4853b1,_0x54135e,_0x1e8694){return BPromise['resolve']()[_0x0a9e('0x31')](function(){if(_0x4853b1[_0x0a9e('0x2d')](_0x0a9e('0x30'))||_0x4853b1[_0x0a9e('0x2d')]('context')){return _0x2ec755[_0x0a9e('0x32')][_0x0a9e('0x33')]({'where':{'UserId':_0x4853b1['id'],'type':_0x0a9e('0x7'),'ChanSpyId':{'$ne':null}}})['then'](function(){if(_0x4853b1[_0x0a9e('0x30')]){return getChanSpyPromise(_0x2ec755,_0x4853b1)[_0x0a9e('0x31')](function(_0x289467){if(_0x289467&&_0x289467['length']){return _0x2ec755['VoiceExtension'][_0x0a9e('0x2f')](_0x289467);}});}});}})[_0x0a9e('0x31')](function(){if(_0x4853b1['changed'](_0x0a9e('0x19'))||_0x4853b1[_0x0a9e('0x2d')](_0x0a9e('0x5'))){return _0x2ec755[_0x0a9e('0x32')]['destroy']({'where':{'UserId':_0x4853b1['id'],'type':'system','ChanSpyId':null}})[_0x0a9e('0x31')](function(){var _0x45b3d0=getUserApplications(_0x4853b1,_0x4853b1['internal']);if(_0x4853b1[_0x0a9e('0x23')]!=_0x4853b1[_0x0a9e('0x13')]){_0x45b3d0=_0x45b3d0[_0x0a9e('0x24')](getUserApplications(_0x4853b1,_0x4853b1['name']));}return _0x2ec755[_0x0a9e('0x32')][_0x0a9e('0x2f')](_0x45b3d0);});}})[_0x0a9e('0x31')](function(){_0x1e8694();})[_0x0a9e('0x25')](function(_0x13cb1f){_0x1e8694(_0x13cb1f);});},'afterDestroy':function(_0xeaa5e5,_0x2881b3){return _0x2ec755[_0x0a9e('0x32')][_0x0a9e('0x33')]({'where':{'UserId':_0xeaa5e5['id'],'type':_0x0a9e('0x7')}});}},'instanceMethods':{'authenticate':function(_0x2c3711,_0x148007){if(!_0x148007){return this[_0x0a9e('0x10')]===this[_0x0a9e('0x34')](_0x2c3711);}var _0x37f6cc=this;this['encryptPassword'](_0x2c3711,function(_0x52628e,_0x473fdc){if(_0x52628e){_0x148007(_0x52628e);}if(_0x37f6cc[_0x0a9e('0x10')]===_0x473fdc){_0x148007(null,!![]);}else{_0x148007(null,![]);}});},'makeSalt':function(_0x405c8f,_0x315881){var _0x1a69dd=0x10;if(typeof arguments[0x0]===_0x0a9e('0x35')){_0x315881=arguments[0x0];_0x405c8f=_0x1a69dd;}else if(typeof arguments[0x1]===_0x0a9e('0x35')){_0x315881=arguments[0x1];}else{throw new Error(_0x0a9e('0x36'));}if(!_0x405c8f){_0x405c8f=_0x1a69dd;}return crypto[_0x0a9e('0x37')](_0x405c8f,function(_0x25c6e6,_0x2c2cb0){if(_0x25c6e6){_0x315881(_0x25c6e6);}return _0x315881(null,_0x2c2cb0[_0x0a9e('0x38')]('base64'));});},'encryptPassword':function(_0x117c99,_0x138b8b){if(!_0x117c99||!this[_0x0a9e('0x39')]){return _0x138b8b?_0x138b8b(null):null;}var _0xfbd5ad=0x2710;var _0x2e8caf=0x40;var _0xbe9d19=new Buffer(this[_0x0a9e('0x39')],_0x0a9e('0x3a'));if(!_0x138b8b){return crypto['pbkdf2Sync'](_0x117c99,_0xbe9d19,_0xfbd5ad,_0x2e8caf,_0x0a9e('0x3b'))['toString'](_0x0a9e('0x3a'));}return crypto[_0x0a9e('0x3c')](_0x117c99,_0xbe9d19,_0xfbd5ad,_0x2e8caf,_0x0a9e('0x3b'),function(_0x562fb4,_0x14bec2){if(_0x562fb4){_0x138b8b(_0x562fb4);}return _0x138b8b(null,_0x14bec2[_0x0a9e('0x38')](_0x0a9e('0x3a')));});},'updatePassword':function(_0x34aa5a){if(!this[_0x0a9e('0x10')]){return _0x34aa5a(null);}if(!validatePresenceOf(this[_0x0a9e('0x10')])&&authTypes[_0x0a9e('0x3d')](this['provider'])===-0x1){_0x34aa5a(new Error(_0x0a9e('0x3e')));}var _0x1bde3c=this;this[_0x0a9e('0x3f')](function(_0x16f976,_0x409789){if(_0x16f976){return _0x34aa5a(_0x16f976);}_0x1bde3c[_0x0a9e('0x39')]=_0x409789;_0x1bde3c[_0x0a9e('0x34')](_0x1bde3c[_0x0a9e('0x10')],function(_0x34febd,_0x58a5c2){if(_0x34febd){_0x34aa5a(_0x34febd);}_0x1bde3c[_0x0a9e('0x10')]=_0x58a5c2;_0x34aa5a(null);});});},'updateMd5Password':function(){this[_0x0a9e('0x40')]=md5(this['name']+':asterisk:'+this['password']);return this[_0x0a9e('0x40')];}}});};
\ No newline at end of file
+var _0xa9e0=['findAll','internal','concat','catch','exports','define','User','users','utf8','utf8_bin','updateMd5Password','changed','updatePassword','bulkCreate','chanspy','then','VoiceExtension','destroy','encryptPassword','function','Missing\x20Callback','randomBytes','toString','salt','base64','sha1','pbkdf2','indexOf','Invalid\x20password','makeSalt','md5secret','bluebird','crypto','util','./user.attributes','length','context','from-sip','system','format','%s%s','prefix','record','push','merge','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','wav','gsm','Set','CDR(type)=internal','extensionMonitor','includes','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','Dial','SIP/%s,,tTxXU(xcally-mixmonitor-context)','SIP/%s,,tTxX','Hangup','priority','defaults'];(function(_0x4e0d72,_0x45b1dc){var _0x11c4b1=function(_0x2b5788){while(--_0x2b5788){_0x4e0d72['push'](_0x4e0d72['shift']());}};_0x11c4b1(++_0x45b1dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var BPromise=require(_0x0a9e('0x0'));var crypto=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var md5=require('md5');var _=require('lodash');var attributes=require(_0x0a9e('0x3'));var authTypes=['google'];var validatePresenceOf=function(_0x333808){return _0x333808&&_0x333808[_0x0a9e('0x4')];};var getChanSpyApplications=function(_0x2ab90b,_0x991246,_0x981158){var _0x57b080={'context':_0x2ab90b[_0x0a9e('0x5')]||_0x0a9e('0x6'),'type':_0x0a9e('0x7'),'isApp':![],'UserId':_0x2ab90b['id']};var _0x5f41ea=[];for(var _0x503809=0x0,_0xe42b77=0x1;_0x503809<_0x981158['length'];_0x503809++,_0xe42b77=0x1){var _0x52cace={'exten':util[_0x0a9e('0x8')](_0x0a9e('0x9'),_0x981158[_0x503809][_0x0a9e('0xa')],_0x991246),'ChanSpyId':_0x981158[_0x503809]['id']};if(_0x981158[_0x503809][_0x0a9e('0xb')]){_0x5f41ea[_0x0a9e('0xc')](_[_0x0a9e('0xd')]({'app':'MixMonitor','appdata':util['format']('${UNIQUEID}.%s,ab',_0x981158[_0x503809]['recordingFormat']),'priority':_0xe42b77++},_0x57b080,_0x52cace));}if(_0x981158[_0x503809][_0x0a9e('0xe')]){_0x5f41ea[_0x0a9e('0xc')](_[_0x0a9e('0xd')]({'app':_0x0a9e('0xf'),'appdata':_0x981158[_0x503809][_0x0a9e('0x10')],'priority':_0xe42b77++},_0x57b080,_0x52cace));}_0x5f41ea[_0x0a9e('0xc')](_['merge']({'app':_0x0a9e('0x11'),'appdata':util[_0x0a9e('0x8')](_0x0a9e('0x12'),_0x2ab90b[_0x0a9e('0x13')],_0x981158[_0x503809][_0x0a9e('0x14')]?_0x981158[_0x503809][_0x0a9e('0x14')]['join'](''):''),'priority':_0xe42b77++},_0x57b080,_0x52cace));if(_0x981158[_0x503809][_0x0a9e('0xb')]){_0x5f41ea['push'](_[_0x0a9e('0xd')]({'app':'StopMixMonitor','priority':_0xe42b77++},_0x57b080,_0x52cace));}}return _0x5f41ea;};var getUserApplications=function(_0x16033c,_0x12066b){var _0x48f32d=[_0x0a9e('0x15'),'WAV',_0x0a9e('0x16')];var _0x478723={'context':_0x16033c[_0x0a9e('0x5')]||_0x0a9e('0x6'),'exten':_0x12066b,'type':_0x0a9e('0x7'),'isApp':![],'UserId':_0x16033c['id']};var _0x2eb11f=[{'app':_0x0a9e('0x17'),'appdata':_0x0a9e('0x18')}];if(_0x16033c[_0x0a9e('0x19')]&&_[_0x0a9e('0x1a')](_0x48f32d,_0x16033c[_0x0a9e('0x19')])){_0x2eb11f[_0x0a9e('0xc')]({'app':'Set','appdata':_0x0a9e('0x1b')});_0x2eb11f[_0x0a9e('0xc')]({'app':'Set','appdata':util[_0x0a9e('0x8')]('_XCALLY_MIXMONITOR_FORMAT=%s',_0x16033c['extensionMonitor'])});_0x2eb11f[_0x0a9e('0xc')]({'app':_0x0a9e('0x1c'),'appdata':util[_0x0a9e('0x8')](_0x0a9e('0x1d'),_0x16033c['name'])});}else{_0x2eb11f[_0x0a9e('0xc')]({'app':_0x0a9e('0x1c'),'appdata':util[_0x0a9e('0x8')](_0x0a9e('0x1e'),_0x16033c[_0x0a9e('0x13')])});}_0x2eb11f[_0x0a9e('0xc')]({'app':_0x0a9e('0x1f')});for(var _0x5ea472=0x0;_0x5ea472<_0x2eb11f['length'];_0x5ea472++){_0x2eb11f[_0x5ea472][_0x0a9e('0x20')]=_0x5ea472+0x1;_0x2eb11f[_0x5ea472]=_[_0x0a9e('0x21')](_0x2eb11f[_0x5ea472],_0x478723);}return _0x2eb11f;};var getChanSpyPromise=function(_0x40c424,_0x33161b){return new BPromise(function(_0x526cf3,_0x384319){return _0x40c424['VoiceChanSpy'][_0x0a9e('0x22')]()['then'](function(_0x1dc186){if(_0x1dc186){var _0x34dc65=getChanSpyApplications(_0x33161b,_0x33161b[_0x0a9e('0x23')],_0x1dc186);if(_0x33161b[_0x0a9e('0x23')]!=_0x33161b[_0x0a9e('0x13')]){_0x34dc65=_0x34dc65[_0x0a9e('0x24')](getChanSpyApplications(_0x33161b,_0x33161b[_0x0a9e('0x13')],_0x1dc186));}return _0x526cf3(_0x34dc65);}return _0x526cf3([]);})[_0x0a9e('0x25')](function(_0x5a101a){_0x384319(_0x5a101a);});});};module[_0x0a9e('0x26')]=function(_0x468813,_0x2b1f27){var _0x2ec755=_0x468813['models'];return _0x468813[_0x0a9e('0x27')](_0x0a9e('0x28'),attributes,{'tableName':_0x0a9e('0x29'),'charset':_0x0a9e('0x2a'),'collate':_0x0a9e('0x2b'),'hooks':{'beforeCreate':function(_0x563b45,_0x296f41,_0x2e8759){_0x563b45[_0x0a9e('0x2c')]();_0x563b45['updatePassword'](_0x2e8759);},'beforeUpdate':function(_0x426950,_0x5d1e0e,_0x2407f9){if(_0x426950[_0x0a9e('0x2d')](_0x0a9e('0x10'))){_0x426950[_0x0a9e('0x2c')]();return _0x426950[_0x0a9e('0x2e')](_0x2407f9);}_0x2407f9();},'afterCreate':function(_0x5180f1,_0x66c1d2,_0x46f0a5){var _0x40cb85=getUserApplications(_0x5180f1,_0x5180f1[_0x0a9e('0x23')]);if(_0x5180f1[_0x0a9e('0x23')]!=_0x5180f1[_0x0a9e('0x13')]){_0x40cb85=_0x40cb85[_0x0a9e('0x24')](getUserApplications(_0x5180f1,_0x5180f1[_0x0a9e('0x13')]));}return _0x2ec755['VoiceExtension'][_0x0a9e('0x2f')](_0x40cb85)['then'](function(){if(_0x5180f1[_0x0a9e('0x30')]){return getChanSpyPromise(_0x2ec755,_0x5180f1);}})[_0x0a9e('0x31')](function(_0x2b7e7f){if(_0x2b7e7f&&_0x2b7e7f[_0x0a9e('0x4')]){return _0x2ec755['VoiceExtension'][_0x0a9e('0x2f')](_0x2b7e7f);}})[_0x0a9e('0x31')](function(){_0x46f0a5();})[_0x0a9e('0x25')](function(_0x15de0e){_0x46f0a5(_0x15de0e);});},'afterUpdate':function(_0x4853b1,_0x54135e,_0x1e8694){return BPromise['resolve']()[_0x0a9e('0x31')](function(){if(_0x4853b1[_0x0a9e('0x2d')](_0x0a9e('0x30'))||_0x4853b1[_0x0a9e('0x2d')]('context')){return _0x2ec755[_0x0a9e('0x32')][_0x0a9e('0x33')]({'where':{'UserId':_0x4853b1['id'],'type':_0x0a9e('0x7'),'ChanSpyId':{'$ne':null}}})['then'](function(){if(_0x4853b1[_0x0a9e('0x30')]){return getChanSpyPromise(_0x2ec755,_0x4853b1)[_0x0a9e('0x31')](function(_0x289467){if(_0x289467&&_0x289467['length']){return _0x2ec755['VoiceExtension'][_0x0a9e('0x2f')](_0x289467);}});}});}})[_0x0a9e('0x31')](function(){if(_0x4853b1['changed'](_0x0a9e('0x19'))||_0x4853b1[_0x0a9e('0x2d')](_0x0a9e('0x5'))){return _0x2ec755[_0x0a9e('0x32')]['destroy']({'where':{'UserId':_0x4853b1['id'],'type':'system','ChanSpyId':null}})[_0x0a9e('0x31')](function(){var _0x45b3d0=getUserApplications(_0x4853b1,_0x4853b1['internal']);if(_0x4853b1[_0x0a9e('0x23')]!=_0x4853b1[_0x0a9e('0x13')]){_0x45b3d0=_0x45b3d0[_0x0a9e('0x24')](getUserApplications(_0x4853b1,_0x4853b1['name']));}return _0x2ec755[_0x0a9e('0x32')][_0x0a9e('0x2f')](_0x45b3d0);});}})[_0x0a9e('0x31')](function(){_0x1e8694();})[_0x0a9e('0x25')](function(_0x13cb1f){_0x1e8694(_0x13cb1f);});},'afterDestroy':function(_0xeaa5e5,_0x2881b3){return _0x2ec755[_0x0a9e('0x32')][_0x0a9e('0x33')]({'where':{'UserId':_0xeaa5e5['id'],'type':_0x0a9e('0x7')}});}},'instanceMethods':{'authenticate':function(_0x2c3711,_0x148007){if(!_0x148007){return this[_0x0a9e('0x10')]===this[_0x0a9e('0x34')](_0x2c3711);}var _0x37f6cc=this;this['encryptPassword'](_0x2c3711,function(_0x52628e,_0x473fdc){if(_0x52628e){_0x148007(_0x52628e);}if(_0x37f6cc[_0x0a9e('0x10')]===_0x473fdc){_0x148007(null,!![]);}else{_0x148007(null,![]);}});},'makeSalt':function(_0x405c8f,_0x315881){var _0x1a69dd=0x10;if(typeof arguments[0x0]===_0x0a9e('0x35')){_0x315881=arguments[0x0];_0x405c8f=_0x1a69dd;}else if(typeof arguments[0x1]===_0x0a9e('0x35')){_0x315881=arguments[0x1];}else{throw new Error(_0x0a9e('0x36'));}if(!_0x405c8f){_0x405c8f=_0x1a69dd;}return crypto[_0x0a9e('0x37')](_0x405c8f,function(_0x25c6e6,_0x2c2cb0){if(_0x25c6e6){_0x315881(_0x25c6e6);}return _0x315881(null,_0x2c2cb0[_0x0a9e('0x38')]('base64'));});},'encryptPassword':function(_0x117c99,_0x138b8b){if(!_0x117c99||!this[_0x0a9e('0x39')]){return _0x138b8b?_0x138b8b(null):null;}var _0xfbd5ad=0x2710;var _0x2e8caf=0x40;var _0xbe9d19=new Buffer(this[_0x0a9e('0x39')],_0x0a9e('0x3a'));if(!_0x138b8b){return crypto['pbkdf2Sync'](_0x117c99,_0xbe9d19,_0xfbd5ad,_0x2e8caf,_0x0a9e('0x3b'))['toString'](_0x0a9e('0x3a'));}return crypto[_0x0a9e('0x3c')](_0x117c99,_0xbe9d19,_0xfbd5ad,_0x2e8caf,_0x0a9e('0x3b'),function(_0x562fb4,_0x14bec2){if(_0x562fb4){_0x138b8b(_0x562fb4);}return _0x138b8b(null,_0x14bec2[_0x0a9e('0x38')](_0x0a9e('0x3a')));});},'updatePassword':function(_0x34aa5a){if(!this[_0x0a9e('0x10')]){return _0x34aa5a(null);}if(!validatePresenceOf(this[_0x0a9e('0x10')])&&authTypes[_0x0a9e('0x3d')](this['provider'])===-0x1){_0x34aa5a(new Error(_0x0a9e('0x3e')));}var _0x1bde3c=this;this[_0x0a9e('0x3f')](function(_0x16f976,_0x409789){if(_0x16f976){return _0x34aa5a(_0x16f976);}_0x1bde3c[_0x0a9e('0x39')]=_0x409789;_0x1bde3c[_0x0a9e('0x34')](_0x1bde3c[_0x0a9e('0x10')],function(_0x34febd,_0x58a5c2){if(_0x34febd){_0x34aa5a(_0x34febd);}_0x1bde3c[_0x0a9e('0x10')]=_0x58a5c2;_0x34aa5a(null);});});},'updateMd5Password':function(){this[_0x0a9e('0x40')]=md5(this['name']+':asterisk:'+this['password']);return this[_0x0a9e('0x40')];}}});};
\ No newline at end of file
index 3220522..a1c49ed 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5f2f=['set','%s%s','Pause','all','LogoutUser','findOne','destroy','LoginUser','mobile','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','loginInPause','UserVoiceQueue.penalty','LOGIN','callysquare','merge','LOGININPAUSE','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','User','findAll','options','raw','where','attributes','limit','include','map','model','GetUser','find','ShowUser','PauseUser','name','role','internal','interface','UserVoiceQueueRt','update','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','MemberReport','bulkCreate','isValidChannel','channel','Unknown\x20channel','voice','system','mail','chat','fax','openchannel'];(function(_0x4abcf1,_0x52c2b9){var _0x335d0c=function(_0x52d1b2){while(--_0x52d1b2){_0x4abcf1['push'](_0x4abcf1['shift']());}};_0x335d0c(++_0x52c2b9);}(_0x5f2f,0x73));var _0xf5f2=function(_0xdb93c5,_0x2efa9b){_0xdb93c5=_0xdb93c5-0x0;var _0x384014=_0x5f2f[_0xdb93c5];return _0x384014;};'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});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./user.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['GetUser']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')]({'raw':_0x34706d['options']?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![],'where':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x21')]||null:null,'attributes':_0x34706d['options']?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x22')]||null:null,'limit':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x23')]||null:null,'include':_0x34706d['options']?_0x34706d['options'][_0xf5f2('0x24')]?_[_0xf5f2('0x25')](_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x24')],function(_0xf6c58d){return{'model':db[_0xf6c58d[_0xf5f2('0x26')]],'as':_0xf6c58d['as'],'attributes':_0xf6c58d[_0xf5f2('0x22')],'include':_0xf6c58d[_0xf5f2('0x24')]?_[_0xf5f2('0x25')](_0xf6c58d['include'],function(_0xaa2602){return{'model':db[_0xaa2602[_0xf5f2('0x26')]],'as':_0xaa2602['as'],'attributes':_0xaa2602[_0xf5f2('0x22')],'include':_0xaa2602[_0xf5f2('0x24')]?_[_0xf5f2('0x25')](_0xaa2602[_0xf5f2('0x24')],function(_0x5b6672){return{'model':db[_0x5b6672['model']],'as':_0x5b6672['as'],'attributes':_0x5b6672[_0xf5f2('0x22')]};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x11')](function(_0x11c771){logger['info']('GetUser',_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x27'),_0x34706d,JSON[_0xf5f2('0x16')](_0x11c771));_0x49dac2(_0x11c771);})[_0xf5f2('0x1c')](function(_0x1b381e){logger['error']('GetUser',_0x1b381e[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e['error'](0x1f4,_0x1b381e[_0xf5f2('0x19')]));});});};exports['ShowUser']=function(_0x45b643){var _0x31087c=this;return new Promise(function(_0x7b6817,_0x428770){return db[_0xf5f2('0x1d')][_0xf5f2('0x28')]({'raw':_0x45b643[_0xf5f2('0x1f')]?_0x45b643[_0xf5f2('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x45b643[_0xf5f2('0x1f')]?_0x45b643[_0xf5f2('0x1f')][_0xf5f2('0x21')]||null:null,'attributes':_0x45b643[_0xf5f2('0x1f')]?_0x45b643[_0xf5f2('0x1f')][_0xf5f2('0x22')]||null:null,'include':_0x45b643[_0xf5f2('0x1f')]?_0x45b643['options'][_0xf5f2('0x24')]?_[_0xf5f2('0x25')](_0x45b643['options'][_0xf5f2('0x24')],function(_0x4b8c42){return{'model':db[_0x4b8c42[_0xf5f2('0x26')]],'as':_0x4b8c42['as'],'attributes':_0x4b8c42[_0xf5f2('0x22')],'include':_0x4b8c42[_0xf5f2('0x24')]?_[_0xf5f2('0x25')](_0x4b8c42['include'],function(_0x5a98d7){return{'model':db[_0x5a98d7[_0xf5f2('0x26')]],'as':_0x5a98d7['as'],'attributes':_0x5a98d7[_0xf5f2('0x22')],'include':_0x5a98d7[_0xf5f2('0x24')]?_['map'](_0x5a98d7[_0xf5f2('0x24')],function(_0x4f7f80){return{'model':db[_0x4f7f80[_0xf5f2('0x26')]],'as':_0x4f7f80['as'],'attributes':_0x4f7f80['attributes']};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x11')](function(_0x456764){logger['info'](_0xf5f2('0x29'),_0x45b643);logger[_0xf5f2('0x14')](_0xf5f2('0x29'),_0x45b643,JSON[_0xf5f2('0x16')](_0x456764));_0x7b6817(_0x456764);})['catch'](function(_0x5d2d82){logger[_0xf5f2('0x17')](_0xf5f2('0x29'),_0x5d2d82[_0xf5f2('0x19')],_0x45b643);_0x428770(_0x31087c[_0xf5f2('0x17')](0x1f4,_0x5d2d82[_0xf5f2('0x19')]));});});};exports[_0xf5f2('0x2a')]=function(_0x2bc20e){var _0x4c0ac7=this;return new Promise(function(_0x110fe5,_0x3b4ea6){var _0x536501;return db[_0xf5f2('0x1d')][_0xf5f2('0x28')]({'where':_0x2bc20e[_0xf5f2('0x1f')][_0xf5f2('0x21')]||{},'attributes':['id',_0xf5f2('0x2b'),_0xf5f2('0x2c'),_0xf5f2('0x2d'),_0xf5f2('0x2e')]})['then'](function(_0x31c3c){if(_0x31c3c){_0x536501=_0x31c3c;return db[_0xf5f2('0x2f')][_0xf5f2('0x30')]({'paused':0x1},{'where':{'UserId':_0x536501['id']},'individualHooks':!![]});}})['then'](function(){if(_0x536501){return db['MemberReport']['findAll']({'where':{'membername':_0x536501[_0xf5f2('0x2b')],'type':_0xf5f2('0x31'),'exitAt':null}});}})['then'](function(_0x106272){if(_0x536501){if(_0x106272&&_0x106272[_0xf5f2('0x32')]){var _0x28e33f=moment()[_0xf5f2('0x33')](_0xf5f2('0x34'));for(var _0x2b3b1c=0x0,_0x1a6ec1=_0x106272[_0xf5f2('0x32')];_0x2b3b1c<_0x1a6ec1;_0x2b3b1c++){_0x106272[_0x2b3b1c][_0xf5f2('0x35')]({'exitAt':_0x28e33f});}}}})[_0xf5f2('0x11')](function(){if(_0x536501){var _0x444317=[];var _0x4773cd=utils[_0xf5f2('0x36')]();_0x4773cd[_0xf5f2('0x37')](function(_0x4faeed){_0x444317[_0xf5f2('0x38')]({'channel':_0x4faeed,'membername':_0x536501['name'],'interface':_[_0xf5f2('0x39')](_0x536501[_0xf5f2('0x2e')])?util[_0xf5f2('0x33')](_0xf5f2('0x3a'),_0x536501[_0xf5f2('0x2b')]):_0x536501[_0xf5f2('0x2e')],'type':'PAUSE','enterAt':moment()[_0xf5f2('0x33')](_0xf5f2('0x34')),'data1':_0x2bc20e[_0xf5f2('0x3b')][_0xf5f2('0x3c')]||_0xf5f2('0x3d'),'role':_0x536501[_0xf5f2('0x2c')],'internal':_0x536501[_0xf5f2('0x2d')],'uniqueid':_0x2bc20e[_0xf5f2('0x3b')]['uniqueid']||null});});return db[_0xf5f2('0x3e')][_0xf5f2('0x3f')](_0x444317,{'individualHooks':!![]});}})[_0xf5f2('0x11')](function(){if(_0x536501){return _0x536501['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x2bc20e[_0xf5f2('0x3b')][_0xf5f2('0x3c')]||_0xf5f2('0x3d'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xf5f2('0x11')](function(_0x27c472){_0x110fe5(_0x27c472);})['catch'](function(_0x14aa81){_0x3b4ea6(_0x4c0ac7['error'](0x1f4,_0x14aa81[_0xf5f2('0x19')]));});});};exports['UnpauseUser']=function(_0x2cbd9d){var _0x5d9120=this;return new Promise(function(_0x2d9017,_0xb8ea3a){var _0xbb658c;return db[_0xf5f2('0x1d')]['findOne']({'where':_0x2cbd9d[_0xf5f2('0x1f')][_0xf5f2('0x21')]||{},'attributes':['id','name']})['then'](function(_0xc3d4f){if(_0xc3d4f){_0xbb658c=_0xc3d4f;if(_0x2cbd9d[_0xf5f2('0x3b')]['channel']&&!utils[_0xf5f2('0x40')](_0x2cbd9d[_0xf5f2('0x3b')][_0xf5f2('0x41')])){throw new Error(_0xf5f2('0x42'));}switch(_0x2cbd9d['body']['channel']){case _0xf5f2('0x43'):return db[_0xf5f2('0x2f')]['update']({'paused':0x0},{'where':{'UserId':_0xbb658c['id']}})[_0xf5f2('0x11')](function(){return db[_0xf5f2('0x3e')][_0xf5f2('0x28')]({'where':{'channel':_0x2cbd9d[_0xf5f2('0x3b')][_0xf5f2('0x41')],'membername':_0xbb658c[_0xf5f2('0x2b')],'type':_0xf5f2('0x31'),'exitAt':null}});})['then'](function(_0x59e8ef){if(_0x59e8ef){return _0x59e8ef[_0xf5f2('0x30')]({'exitAt':moment()[_0xf5f2('0x33')](_0xf5f2('0x34')),'data2':_0xf5f2('0x44')},{'individualHooks':!![]});}return null;})[_0xf5f2('0x11')](function(){return _0xbb658c['update']({'voicePause':![]});});case _0xf5f2('0x45'):case _0xf5f2('0x46'):case _0xf5f2('0x47'):case'sms':case _0xf5f2('0x48'):return db['MemberReport'][_0xf5f2('0x28')]({'where':{'channel':_0x2cbd9d[_0xf5f2('0x3b')][_0xf5f2('0x41')],'membername':_0xbb658c[_0xf5f2('0x2b')],'type':'PAUSE','exitAt':null}})['then'](function(_0x756f1f){return _0x756f1f['update']({'exitAt':moment()[_0xf5f2('0x33')](_0xf5f2('0x34')),'data2':'system'},{'individualHooks':!![]});})[_0xf5f2('0x11')](function(){var _0xa4c0be={};_[_0xf5f2('0x49')](_0xa4c0be,util['format'](_0xf5f2('0x4a'),_0x2cbd9d[_0xf5f2('0x3b')][_0xf5f2('0x41')],_0xf5f2('0x4b')),![]);return _0xbb658c['update'](_0xa4c0be);});default:return db[_0xf5f2('0x2f')]['update']({'paused':0x0},{'where':{'UserId':_0xbb658c['id']}})[_0xf5f2('0x11')](function(){return db[_0xf5f2('0x3e')][_0xf5f2('0x1e')]({'where':{'membername':_0xbb658c[_0xf5f2('0x2b')],'type':_0xf5f2('0x31'),'exitAt':null}});})['then'](function(_0xda8dda){var _0xacd80=[];_0xda8dda[_0xf5f2('0x37')](function(_0x212639){_0xacd80[_0xf5f2('0x38')](_0x212639['update']({'exitAt':moment()[_0xf5f2('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'}));});return BPromise[_0xf5f2('0x4c')](_0xacd80);})['then'](function(){return _0xbb658c[_0xf5f2('0x30')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xf5f2('0x11')](function(_0x420784){_0x2d9017(_0x420784);})[_0xf5f2('0x1c')](function(_0x5767fc){_0xb8ea3a(_0x5d9120[_0xf5f2('0x17')](0x1f4,_0x5767fc[_0xf5f2('0x19')]));});});};exports[_0xf5f2('0x4d')]=function(_0x18c41f){var _0x15b680=this;return new Promise(function(_0x35d868,_0x158768){var _0x4a7be9;return db[_0xf5f2('0x1d')][_0xf5f2('0x4e')]({'where':_0x18c41f[_0xf5f2('0x1f')][_0xf5f2('0x21')]||{},'attributes':['id','name']})[_0xf5f2('0x11')](function(_0x4cce08){if(_0x4cce08){_0x4a7be9=_0x4cce08;return db[_0xf5f2('0x2f')][_0xf5f2('0x4f')]({'where':{'membername':_0x4a7be9['name']},'individualHooks':!![]});}})[_0xf5f2('0x11')](function(){if(_0x4a7be9){return db[_0xf5f2('0x3e')][_0xf5f2('0x1e')]({'where':{'membername':_0x4a7be9[_0xf5f2('0x2b')],'exitAt':null}});}})[_0xf5f2('0x11')](function(_0x4bd113){if(_0x4a7be9){if(_0x4bd113&&_0x4bd113[_0xf5f2('0x32')]){var _0x21c107=[];_0x4bd113[_0xf5f2('0x37')](function(_0xbf9f55){_0x21c107[_0xf5f2('0x38')](_0xbf9f55[_0xf5f2('0x30')]({'exitAt':moment()['format'](_0xf5f2('0x34'))}));});return BPromise[_0xf5f2('0x4c')](_0x21c107);}}})['then'](function(){if(_0x4a7be9){return _0x4a7be9[_0xf5f2('0x30')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xf5f2('0x11')](function(_0x377aad){_0x35d868(_0x377aad);})['catch'](function(_0x551cc9){_0x158768(_0x15b680['error'](0x1f4,_0x551cc9[_0xf5f2('0x19')]));});});};exports[_0xf5f2('0x50')]=function(_0x35f6a2){var _0x450691=this;return new Promise(function(_0x55da4d,_0x4d878e){var _0x278b76;var _0x3a98b4;var _0xc10cf3;var _0xe8a9b7;return db[_0xf5f2('0x1d')][_0xf5f2('0x4e')]({'where':_0x35f6a2[_0xf5f2('0x1f')][_0xf5f2('0x21')]||{},'attributes':['id',_0xf5f2('0x2b'),_0xf5f2('0x2c'),_0xf5f2('0x51'),'phone','internal','loginInPause',_0xf5f2('0x2e')]})[_0xf5f2('0x11')](function(_0x3d3181){if(_0x3d3181){_0x278b76=_0x3d3181;_0xe8a9b7=_0x35f6a2[_0xf5f2('0x3b')][_0xf5f2('0x2e')]?_0x35f6a2['body'][_0xf5f2('0x2e')]:util[_0xf5f2('0x33')](_0xf5f2('0x3a'),_0x278b76[_0xf5f2('0x2b')]);return db[_0xf5f2('0x1d')]['count']({'where':{'role':_0xf5f2('0x52'),'online':!![],'id':{'$ne':_0x278b76['id']}}});}})[_0xf5f2('0x11')](function(_0x517c15){if(_0x517c15){_0xc10cf3=_0x517c15;return require(_0xf5f2('0x53'))[_0xf5f2('0x54')]();}})[_0xf5f2('0x11')](function(_0x30ac41){if(_0x30ac41&&_0x30ac41['agents']&&_0xc10cf3>=_0x30ac41[_0xf5f2('0x55')]){throw new Error(_0xf5f2('0x56'));}})[_0xf5f2('0x11')](function(){if(_0x278b76){return db[_0xf5f2('0x2f')][_0xf5f2('0x4f')]({'where':{'membername':_0x278b76['name']},'individualHooks':!![]});}})['then'](function(){if(_0x278b76){return _0x278b76[_0xf5f2('0x57')]({'raw':!![]});}})[_0xf5f2('0x11')](function(_0x17eb69){if(_0x278b76){if(_0x17eb69){var _0xe3ea1e=[];_0x3a98b4=_0x17eb69;if(_0x3a98b4['length']){for(var _0x5a2f9f=0x0;_0x5a2f9f<_0x3a98b4[_0xf5f2('0x32')];_0x5a2f9f++){_0xe3ea1e['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0x278b76['name'],'UserId':_0x278b76['id'],'queue_name':_0x3a98b4[_0x5a2f9f][_0xf5f2('0x2b')],'VoiceQueueId':_0x3a98b4[_0x5a2f9f]['id'],'interface':_0xe8a9b7,'paused':_0x278b76[_0xf5f2('0x58')]||![],'penalty':_0x3a98b4[_0x5a2f9f][_0xf5f2('0x59')]||0x0}));}return BPromise[_0xf5f2('0x4c')](_0xe3ea1e);}}}})[_0xf5f2('0x11')](function(){if(_0x278b76){return db[_0xf5f2('0x3e')][_0xf5f2('0x1e')]({'where':{'membername':_0x278b76[_0xf5f2('0x2b')],'exitAt':null}});}})[_0xf5f2('0x11')](function(_0x26b251){if(_0x278b76){if(_0x26b251&&_0x26b251[_0xf5f2('0x32')]){var _0x2afeac=[];_0x26b251[_0xf5f2('0x37')](function(_0x1680a6){_0x2afeac[_0xf5f2('0x38')](_0x1680a6[_0xf5f2('0x30')]({'exitAt':moment()[_0xf5f2('0x33')](_0xf5f2('0x34'))}));});return BPromise['all'](_0x2afeac);}}})[_0xf5f2('0x11')](function(_0x35299d){if(_0x278b76){var _0x21043b=[];var _0x2811ad=[];var _0x18c353=utils[_0xf5f2('0x36')]();var _0x16491c={'membername':_0x278b76[_0xf5f2('0x2b')],'interface':_0xe8a9b7,'enterAt':moment()['format'](_0xf5f2('0x34')),'role':_0x278b76['role'],'internal':_0x278b76['internal']};_0x18c353['forEach'](function(_0x53449e){_0x21043b['push'](_['merge']({'channel':_0x53449e,'type':_0xf5f2('0x5a'),'data1':_0xf5f2('0x5b'),'data2':_0xe8a9b7},_0x16491c));if(_0x278b76[_0xf5f2('0x58')]){_0x2811ad[_0xf5f2('0x38')](_[_0xf5f2('0x5c')]({'channel':_0x53449e,'type':_0xf5f2('0x31'),'data1':'LOGININPAUSE'},_0x16491c));}});return db['MemberReport'][_0xf5f2('0x3f')](_0x21043b['concat'](_0x2811ad),{'individualHooks':!![]});}})[_0xf5f2('0x11')](function(){if(_0x278b76){return _0x278b76[_0xf5f2('0x30')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x278b76[_0xf5f2('0x58')]||![],'mailPause':_0x278b76[_0xf5f2('0x58')]||![],'chatPause':_0x278b76['loginInPause']||![],'faxPause':_0x278b76[_0xf5f2('0x58')]||![],'smsPause':_0x278b76[_0xf5f2('0x58')]||![],'openchannelPause':_0x278b76['loginInPause']||![],'pauseType':_0x278b76[_0xf5f2('0x58')]?_0xf5f2('0x5d'):null,'lastPauseAt':moment()[_0xf5f2('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0xe8a9b7});}})[_0xf5f2('0x11')](function(_0xc28adc){_0x55da4d(_0xc28adc);})[_0xf5f2('0x1c')](function(_0x3247c4){_0x4d878e(_0x450691[_0xf5f2('0x17')](0x1f4,_0x3247c4[_0xf5f2('0x19')]));});});};
\ No newline at end of file
+var _0x5f2f=['set','%s%s','Pause','all','LogoutUser','findOne','destroy','LoginUser','mobile','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','loginInPause','UserVoiceQueue.penalty','LOGIN','callysquare','merge','LOGININPAUSE','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','User','findAll','options','raw','where','attributes','limit','include','map','model','GetUser','find','ShowUser','PauseUser','name','role','internal','interface','UserVoiceQueueRt','update','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','MemberReport','bulkCreate','isValidChannel','channel','Unknown\x20channel','voice','system','mail','chat','fax','openchannel'];(function(_0x36b271,_0x45f2b8){var _0x3de391=function(_0x5d56aa){while(--_0x5d56aa){_0x36b271['push'](_0x36b271['shift']());}};_0x3de391(++_0x45f2b8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x282c11,_0x2740f5){_0x282c11=_0x282c11-0x0;var _0x25115d=_0x5f2f[_0x282c11];return _0x25115d;};'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});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./user.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['GetUser']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')]({'raw':_0x34706d['options']?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![],'where':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x21')]||null:null,'attributes':_0x34706d['options']?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x22')]||null:null,'limit':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x23')]||null:null,'include':_0x34706d['options']?_0x34706d['options'][_0xf5f2('0x24')]?_[_0xf5f2('0x25')](_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x24')],function(_0xf6c58d){return{'model':db[_0xf6c58d[_0xf5f2('0x26')]],'as':_0xf6c58d['as'],'attributes':_0xf6c58d[_0xf5f2('0x22')],'include':_0xf6c58d[_0xf5f2('0x24')]?_[_0xf5f2('0x25')](_0xf6c58d['include'],function(_0xaa2602){return{'model':db[_0xaa2602[_0xf5f2('0x26')]],'as':_0xaa2602['as'],'attributes':_0xaa2602[_0xf5f2('0x22')],'include':_0xaa2602[_0xf5f2('0x24')]?_[_0xf5f2('0x25')](_0xaa2602[_0xf5f2('0x24')],function(_0x5b6672){return{'model':db[_0x5b6672['model']],'as':_0x5b6672['as'],'attributes':_0x5b6672[_0xf5f2('0x22')]};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x11')](function(_0x11c771){logger['info']('GetUser',_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x27'),_0x34706d,JSON[_0xf5f2('0x16')](_0x11c771));_0x49dac2(_0x11c771);})[_0xf5f2('0x1c')](function(_0x1b381e){logger['error']('GetUser',_0x1b381e[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e['error'](0x1f4,_0x1b381e[_0xf5f2('0x19')]));});});};exports['ShowUser']=function(_0x45b643){var _0x31087c=this;return new Promise(function(_0x7b6817,_0x428770){return db[_0xf5f2('0x1d')][_0xf5f2('0x28')]({'raw':_0x45b643[_0xf5f2('0x1f')]?_0x45b643[_0xf5f2('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x45b643[_0xf5f2('0x1f')]?_0x45b643[_0xf5f2('0x1f')][_0xf5f2('0x21')]||null:null,'attributes':_0x45b643[_0xf5f2('0x1f')]?_0x45b643[_0xf5f2('0x1f')][_0xf5f2('0x22')]||null:null,'include':_0x45b643[_0xf5f2('0x1f')]?_0x45b643['options'][_0xf5f2('0x24')]?_[_0xf5f2('0x25')](_0x45b643['options'][_0xf5f2('0x24')],function(_0x4b8c42){return{'model':db[_0x4b8c42[_0xf5f2('0x26')]],'as':_0x4b8c42['as'],'attributes':_0x4b8c42[_0xf5f2('0x22')],'include':_0x4b8c42[_0xf5f2('0x24')]?_[_0xf5f2('0x25')](_0x4b8c42['include'],function(_0x5a98d7){return{'model':db[_0x5a98d7[_0xf5f2('0x26')]],'as':_0x5a98d7['as'],'attributes':_0x5a98d7[_0xf5f2('0x22')],'include':_0x5a98d7[_0xf5f2('0x24')]?_['map'](_0x5a98d7[_0xf5f2('0x24')],function(_0x4f7f80){return{'model':db[_0x4f7f80[_0xf5f2('0x26')]],'as':_0x4f7f80['as'],'attributes':_0x4f7f80['attributes']};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x11')](function(_0x456764){logger['info'](_0xf5f2('0x29'),_0x45b643);logger[_0xf5f2('0x14')](_0xf5f2('0x29'),_0x45b643,JSON[_0xf5f2('0x16')](_0x456764));_0x7b6817(_0x456764);})['catch'](function(_0x5d2d82){logger[_0xf5f2('0x17')](_0xf5f2('0x29'),_0x5d2d82[_0xf5f2('0x19')],_0x45b643);_0x428770(_0x31087c[_0xf5f2('0x17')](0x1f4,_0x5d2d82[_0xf5f2('0x19')]));});});};exports[_0xf5f2('0x2a')]=function(_0x2bc20e){var _0x4c0ac7=this;return new Promise(function(_0x110fe5,_0x3b4ea6){var _0x536501;return db[_0xf5f2('0x1d')][_0xf5f2('0x28')]({'where':_0x2bc20e[_0xf5f2('0x1f')][_0xf5f2('0x21')]||{},'attributes':['id',_0xf5f2('0x2b'),_0xf5f2('0x2c'),_0xf5f2('0x2d'),_0xf5f2('0x2e')]})['then'](function(_0x31c3c){if(_0x31c3c){_0x536501=_0x31c3c;return db[_0xf5f2('0x2f')][_0xf5f2('0x30')]({'paused':0x1},{'where':{'UserId':_0x536501['id']},'individualHooks':!![]});}})['then'](function(){if(_0x536501){return db['MemberReport']['findAll']({'where':{'membername':_0x536501[_0xf5f2('0x2b')],'type':_0xf5f2('0x31'),'exitAt':null}});}})['then'](function(_0x106272){if(_0x536501){if(_0x106272&&_0x106272[_0xf5f2('0x32')]){var _0x28e33f=moment()[_0xf5f2('0x33')](_0xf5f2('0x34'));for(var _0x2b3b1c=0x0,_0x1a6ec1=_0x106272[_0xf5f2('0x32')];_0x2b3b1c<_0x1a6ec1;_0x2b3b1c++){_0x106272[_0x2b3b1c][_0xf5f2('0x35')]({'exitAt':_0x28e33f});}}}})[_0xf5f2('0x11')](function(){if(_0x536501){var _0x444317=[];var _0x4773cd=utils[_0xf5f2('0x36')]();_0x4773cd[_0xf5f2('0x37')](function(_0x4faeed){_0x444317[_0xf5f2('0x38')]({'channel':_0x4faeed,'membername':_0x536501['name'],'interface':_[_0xf5f2('0x39')](_0x536501[_0xf5f2('0x2e')])?util[_0xf5f2('0x33')](_0xf5f2('0x3a'),_0x536501[_0xf5f2('0x2b')]):_0x536501[_0xf5f2('0x2e')],'type':'PAUSE','enterAt':moment()[_0xf5f2('0x33')](_0xf5f2('0x34')),'data1':_0x2bc20e[_0xf5f2('0x3b')][_0xf5f2('0x3c')]||_0xf5f2('0x3d'),'role':_0x536501[_0xf5f2('0x2c')],'internal':_0x536501[_0xf5f2('0x2d')],'uniqueid':_0x2bc20e[_0xf5f2('0x3b')]['uniqueid']||null});});return db[_0xf5f2('0x3e')][_0xf5f2('0x3f')](_0x444317,{'individualHooks':!![]});}})[_0xf5f2('0x11')](function(){if(_0x536501){return _0x536501['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x2bc20e[_0xf5f2('0x3b')][_0xf5f2('0x3c')]||_0xf5f2('0x3d'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xf5f2('0x11')](function(_0x27c472){_0x110fe5(_0x27c472);})['catch'](function(_0x14aa81){_0x3b4ea6(_0x4c0ac7['error'](0x1f4,_0x14aa81[_0xf5f2('0x19')]));});});};exports['UnpauseUser']=function(_0x2cbd9d){var _0x5d9120=this;return new Promise(function(_0x2d9017,_0xb8ea3a){var _0xbb658c;return db[_0xf5f2('0x1d')]['findOne']({'where':_0x2cbd9d[_0xf5f2('0x1f')][_0xf5f2('0x21')]||{},'attributes':['id','name']})['then'](function(_0xc3d4f){if(_0xc3d4f){_0xbb658c=_0xc3d4f;if(_0x2cbd9d[_0xf5f2('0x3b')]['channel']&&!utils[_0xf5f2('0x40')](_0x2cbd9d[_0xf5f2('0x3b')][_0xf5f2('0x41')])){throw new Error(_0xf5f2('0x42'));}switch(_0x2cbd9d['body']['channel']){case _0xf5f2('0x43'):return db[_0xf5f2('0x2f')]['update']({'paused':0x0},{'where':{'UserId':_0xbb658c['id']}})[_0xf5f2('0x11')](function(){return db[_0xf5f2('0x3e')][_0xf5f2('0x28')]({'where':{'channel':_0x2cbd9d[_0xf5f2('0x3b')][_0xf5f2('0x41')],'membername':_0xbb658c[_0xf5f2('0x2b')],'type':_0xf5f2('0x31'),'exitAt':null}});})['then'](function(_0x59e8ef){if(_0x59e8ef){return _0x59e8ef[_0xf5f2('0x30')]({'exitAt':moment()[_0xf5f2('0x33')](_0xf5f2('0x34')),'data2':_0xf5f2('0x44')},{'individualHooks':!![]});}return null;})[_0xf5f2('0x11')](function(){return _0xbb658c['update']({'voicePause':![]});});case _0xf5f2('0x45'):case _0xf5f2('0x46'):case _0xf5f2('0x47'):case'sms':case _0xf5f2('0x48'):return db['MemberReport'][_0xf5f2('0x28')]({'where':{'channel':_0x2cbd9d[_0xf5f2('0x3b')][_0xf5f2('0x41')],'membername':_0xbb658c[_0xf5f2('0x2b')],'type':'PAUSE','exitAt':null}})['then'](function(_0x756f1f){return _0x756f1f['update']({'exitAt':moment()[_0xf5f2('0x33')](_0xf5f2('0x34')),'data2':'system'},{'individualHooks':!![]});})[_0xf5f2('0x11')](function(){var _0xa4c0be={};_[_0xf5f2('0x49')](_0xa4c0be,util['format'](_0xf5f2('0x4a'),_0x2cbd9d[_0xf5f2('0x3b')][_0xf5f2('0x41')],_0xf5f2('0x4b')),![]);return _0xbb658c['update'](_0xa4c0be);});default:return db[_0xf5f2('0x2f')]['update']({'paused':0x0},{'where':{'UserId':_0xbb658c['id']}})[_0xf5f2('0x11')](function(){return db[_0xf5f2('0x3e')][_0xf5f2('0x1e')]({'where':{'membername':_0xbb658c[_0xf5f2('0x2b')],'type':_0xf5f2('0x31'),'exitAt':null}});})['then'](function(_0xda8dda){var _0xacd80=[];_0xda8dda[_0xf5f2('0x37')](function(_0x212639){_0xacd80[_0xf5f2('0x38')](_0x212639['update']({'exitAt':moment()[_0xf5f2('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'}));});return BPromise[_0xf5f2('0x4c')](_0xacd80);})['then'](function(){return _0xbb658c[_0xf5f2('0x30')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xf5f2('0x11')](function(_0x420784){_0x2d9017(_0x420784);})[_0xf5f2('0x1c')](function(_0x5767fc){_0xb8ea3a(_0x5d9120[_0xf5f2('0x17')](0x1f4,_0x5767fc[_0xf5f2('0x19')]));});});};exports[_0xf5f2('0x4d')]=function(_0x18c41f){var _0x15b680=this;return new Promise(function(_0x35d868,_0x158768){var _0x4a7be9;return db[_0xf5f2('0x1d')][_0xf5f2('0x4e')]({'where':_0x18c41f[_0xf5f2('0x1f')][_0xf5f2('0x21')]||{},'attributes':['id','name']})[_0xf5f2('0x11')](function(_0x4cce08){if(_0x4cce08){_0x4a7be9=_0x4cce08;return db[_0xf5f2('0x2f')][_0xf5f2('0x4f')]({'where':{'membername':_0x4a7be9['name']},'individualHooks':!![]});}})[_0xf5f2('0x11')](function(){if(_0x4a7be9){return db[_0xf5f2('0x3e')][_0xf5f2('0x1e')]({'where':{'membername':_0x4a7be9[_0xf5f2('0x2b')],'exitAt':null}});}})[_0xf5f2('0x11')](function(_0x4bd113){if(_0x4a7be9){if(_0x4bd113&&_0x4bd113[_0xf5f2('0x32')]){var _0x21c107=[];_0x4bd113[_0xf5f2('0x37')](function(_0xbf9f55){_0x21c107[_0xf5f2('0x38')](_0xbf9f55[_0xf5f2('0x30')]({'exitAt':moment()['format'](_0xf5f2('0x34'))}));});return BPromise[_0xf5f2('0x4c')](_0x21c107);}}})['then'](function(){if(_0x4a7be9){return _0x4a7be9[_0xf5f2('0x30')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xf5f2('0x11')](function(_0x377aad){_0x35d868(_0x377aad);})['catch'](function(_0x551cc9){_0x158768(_0x15b680['error'](0x1f4,_0x551cc9[_0xf5f2('0x19')]));});});};exports[_0xf5f2('0x50')]=function(_0x35f6a2){var _0x450691=this;return new Promise(function(_0x55da4d,_0x4d878e){var _0x278b76;var _0x3a98b4;var _0xc10cf3;var _0xe8a9b7;return db[_0xf5f2('0x1d')][_0xf5f2('0x4e')]({'where':_0x35f6a2[_0xf5f2('0x1f')][_0xf5f2('0x21')]||{},'attributes':['id',_0xf5f2('0x2b'),_0xf5f2('0x2c'),_0xf5f2('0x51'),'phone','internal','loginInPause',_0xf5f2('0x2e')]})[_0xf5f2('0x11')](function(_0x3d3181){if(_0x3d3181){_0x278b76=_0x3d3181;_0xe8a9b7=_0x35f6a2[_0xf5f2('0x3b')][_0xf5f2('0x2e')]?_0x35f6a2['body'][_0xf5f2('0x2e')]:util[_0xf5f2('0x33')](_0xf5f2('0x3a'),_0x278b76[_0xf5f2('0x2b')]);return db[_0xf5f2('0x1d')]['count']({'where':{'role':_0xf5f2('0x52'),'online':!![],'id':{'$ne':_0x278b76['id']}}});}})[_0xf5f2('0x11')](function(_0x517c15){if(_0x517c15){_0xc10cf3=_0x517c15;return require(_0xf5f2('0x53'))[_0xf5f2('0x54')]();}})[_0xf5f2('0x11')](function(_0x30ac41){if(_0x30ac41&&_0x30ac41['agents']&&_0xc10cf3>=_0x30ac41[_0xf5f2('0x55')]){throw new Error(_0xf5f2('0x56'));}})[_0xf5f2('0x11')](function(){if(_0x278b76){return db[_0xf5f2('0x2f')][_0xf5f2('0x4f')]({'where':{'membername':_0x278b76['name']},'individualHooks':!![]});}})['then'](function(){if(_0x278b76){return _0x278b76[_0xf5f2('0x57')]({'raw':!![]});}})[_0xf5f2('0x11')](function(_0x17eb69){if(_0x278b76){if(_0x17eb69){var _0xe3ea1e=[];_0x3a98b4=_0x17eb69;if(_0x3a98b4['length']){for(var _0x5a2f9f=0x0;_0x5a2f9f<_0x3a98b4[_0xf5f2('0x32')];_0x5a2f9f++){_0xe3ea1e['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0x278b76['name'],'UserId':_0x278b76['id'],'queue_name':_0x3a98b4[_0x5a2f9f][_0xf5f2('0x2b')],'VoiceQueueId':_0x3a98b4[_0x5a2f9f]['id'],'interface':_0xe8a9b7,'paused':_0x278b76[_0xf5f2('0x58')]||![],'penalty':_0x3a98b4[_0x5a2f9f][_0xf5f2('0x59')]||0x0}));}return BPromise[_0xf5f2('0x4c')](_0xe3ea1e);}}}})[_0xf5f2('0x11')](function(){if(_0x278b76){return db[_0xf5f2('0x3e')][_0xf5f2('0x1e')]({'where':{'membername':_0x278b76[_0xf5f2('0x2b')],'exitAt':null}});}})[_0xf5f2('0x11')](function(_0x26b251){if(_0x278b76){if(_0x26b251&&_0x26b251[_0xf5f2('0x32')]){var _0x2afeac=[];_0x26b251[_0xf5f2('0x37')](function(_0x1680a6){_0x2afeac[_0xf5f2('0x38')](_0x1680a6[_0xf5f2('0x30')]({'exitAt':moment()[_0xf5f2('0x33')](_0xf5f2('0x34'))}));});return BPromise['all'](_0x2afeac);}}})[_0xf5f2('0x11')](function(_0x35299d){if(_0x278b76){var _0x21043b=[];var _0x2811ad=[];var _0x18c353=utils[_0xf5f2('0x36')]();var _0x16491c={'membername':_0x278b76[_0xf5f2('0x2b')],'interface':_0xe8a9b7,'enterAt':moment()['format'](_0xf5f2('0x34')),'role':_0x278b76['role'],'internal':_0x278b76['internal']};_0x18c353['forEach'](function(_0x53449e){_0x21043b['push'](_['merge']({'channel':_0x53449e,'type':_0xf5f2('0x5a'),'data1':_0xf5f2('0x5b'),'data2':_0xe8a9b7},_0x16491c));if(_0x278b76[_0xf5f2('0x58')]){_0x2811ad[_0xf5f2('0x38')](_[_0xf5f2('0x5c')]({'channel':_0x53449e,'type':_0xf5f2('0x31'),'data1':'LOGININPAUSE'},_0x16491c));}});return db['MemberReport'][_0xf5f2('0x3f')](_0x21043b['concat'](_0x2811ad),{'individualHooks':!![]});}})[_0xf5f2('0x11')](function(){if(_0x278b76){return _0x278b76[_0xf5f2('0x30')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x278b76[_0xf5f2('0x58')]||![],'mailPause':_0x278b76[_0xf5f2('0x58')]||![],'chatPause':_0x278b76['loginInPause']||![],'faxPause':_0x278b76[_0xf5f2('0x58')]||![],'smsPause':_0x278b76[_0xf5f2('0x58')]||![],'openchannelPause':_0x278b76['loginInPause']||![],'pauseType':_0x278b76[_0xf5f2('0x58')]?_0xf5f2('0x5d'):null,'lastPauseAt':moment()[_0xf5f2('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0xe8a9b7});}})[_0xf5f2('0x11')](function(_0xc28adc){_0x55da4d(_0xc28adc);})[_0xf5f2('0x1c')](function(_0x3247c4){_0x4d878e(_0x450691[_0xf5f2('0x17')](0x1f4,_0x3247c4[_0xf5f2('0x19')]));});});};
\ No newline at end of file
index 3dc90fb..4466388 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbfed=['length','user:','remove','update','emit','register'];(function(_0x6b072e,_0x3ed7a9){var _0x49b8bf=function(_0x559487){while(--_0x559487){_0x6b072e['push'](_0x6b072e['shift']());}};_0x49b8bf(++_0x3ed7a9);}(_0xbfed,0x1b8));var _0xdbfe=function(_0x19a90e,_0xe14b0b){_0x19a90e=_0x19a90e-0x0;var _0xa49b11=_0xbfed[_0x19a90e];return _0xa49b11;};'use strict';var UserEvents=require('./user.events');var events=['save',_0xdbfe('0x0'),_0xdbfe('0x1')];function createListener(_0x11826e,_0x4a0f1a){return function(_0x104d0f){_0x4a0f1a[_0xdbfe('0x2')](_0x11826e,_0x104d0f);};}function removeListener(_0xcb7b31,_0x4ca3cc){return function(){UserEvents['removeListener'](_0xcb7b31,_0x4ca3cc);};}exports[_0xdbfe('0x3')]=function(_0x575b13){for(var _0x1705d5=0x0,_0x181a1a=events[_0xdbfe('0x4')];_0x1705d5<_0x181a1a;_0x1705d5++){var _0x28d36c=events[_0x1705d5];var _0x28228a=createListener(_0xdbfe('0x5')+_0x28d36c,_0x575b13);UserEvents['on'](_0x28d36c,_0x28228a);}};
\ No newline at end of file
+var _0x6678=['remove','update','emit','user:','./user.events','save'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x6678,0x1ae));var _0x8667=function(_0x16db8b,_0xca7d28){_0x16db8b=_0x16db8b-0x0;var _0x5ba017=_0x6678[_0x16db8b];return _0x5ba017;};'use strict';var UserEvents=require(_0x8667('0x0'));var events=[_0x8667('0x1'),_0x8667('0x2'),_0x8667('0x3')];function createListener(_0x50625f,_0x64dbb1){return function(_0x19b1fb){_0x64dbb1[_0x8667('0x4')](_0x50625f,_0x19b1fb);};}function removeListener(_0x5ad74f,_0x22c225){return function(){UserEvents['removeListener'](_0x5ad74f,_0x22c225);};}exports['register']=function(_0x5b4c69){for(var _0xf0932=0x0,_0x1efe23=events['length'];_0xf0932<_0x1efe23;_0xf0932++){var _0x4e5d86=events[_0xf0932];var _0x42d308=createListener(_0x8667('0x5')+_0x4e5d86,_0x5b4c69);UserEvents['on'](_0x4e5d86,_0x42d308);}};
\ No newline at end of file
index 91e374e..dbebced 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb470=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','exports','multer','util','path'];(function(_0x155f58,_0x4d0489){var _0x51fb9d=function(_0x5d93ae){while(--_0x5d93ae){_0x155f58['push'](_0x155f58['shift']());}};_0x51fb9d(++_0x4d0489);}(_0xb470,0x75));var _0x0b47=function(_0x1e05b6,_0x2cf429){_0x1e05b6=_0x1e05b6-0x0;var _0x195b63=_0xb470[_0x1e05b6];return _0x195b63;};'use strict';var multer=require(_0x0b47('0x0'));var util=require(_0x0b47('0x1'));var path=require(_0x0b47('0x2'));var timeout=require(_0x0b47('0x3'));var express=require('express');var router=express[_0x0b47('0x4')]();var auth=require(_0x0b47('0x5'));var interaction=require(_0x0b47('0x6'));var config=require('../../config/environment');module[_0x0b47('0x7')]=router;
\ No newline at end of file
+var _0xfcf0=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfcf0,0x138));var _0x0fcf=function(_0x528497,_0x147e87){_0x528497=_0x528497-0x0;var _0x392d59=_0xfcf0[_0x528497];return _0x392d59;};'use strict';var multer=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var path=require('path');var timeout=require(_0x0fcf('0x2'));var express=require(_0x0fcf('0x3'));var router=express[_0x0fcf('0x4')]();var auth=require(_0x0fcf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0fcf('0x6'));module[_0x0fcf('0x7')]=router;
\ No newline at end of file
index 60497b2..7c7746d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x961c=['exports','sequelize'];(function(_0x3bb962,_0x49cb14){var _0x2106b0=function(_0x4aba78){while(--_0x4aba78){_0x3bb962['push'](_0x3bb962['shift']());}};_0x2106b0(++_0x49cb14);}(_0x961c,0xe1));var _0xc961=function(_0x32dc42,_0x83a9dc){_0x32dc42=_0x32dc42-0x0;var _0x5af3d6=_0x961c[_0x32dc42];return _0x5af3d6;};'use strict';var Sequelize=require(_0xc961('0x0'));module[_0xc961('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}};
\ No newline at end of file
+var _0xd782=['sequelize','exports'];(function(_0x80c8c3,_0x3e0f28){var _0x26670a=function(_0xe9483c){while(--_0xe9483c){_0x80c8c3['push'](_0x80c8c3['shift']());}};_0x26670a(++_0x3e0f28);}(_0xd782,0x198));var _0x2d78=function(_0x4ea67b,_0x857bd0){_0x4ea67b=_0x4ea67b-0x0;var _0x4047fe=_0xd782[_0x4ea67b];return _0x4047fe;};'use strict';var Sequelize=require(_0x2d78('0x0'));module[_0x2d78('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}};
\ No newline at end of file
index a75da80..bc45615 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x705f=['../../config/logger','moment','bluebird','request-promise','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues'];(function(_0x3b8dca,_0x8acea3){var _0x5394c0=function(_0x2e6add){while(--_0x2e6add){_0x3b8dca['push'](_0x3b8dca['shift']());}};_0x5394c0(++_0x8acea3);}(_0x705f,0x75));var _0xf705=function(_0x5517c0,_0x358609){_0x5517c0=_0x5517c0-0x0;var _0x33803b=_0x705f[_0x5517c0];return _0x33803b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf705('0x0'))('api');var moment=require(_0xf705('0x1'));var BPromise=require(_0xf705('0x2'));var rp=require(_0xf705('0x3'));var attributes=require(_0xf705('0x4'));module[_0xf705('0x5')]=function(_0x47514c,_0x9045cf){return _0x47514c[_0xf705('0x6')](_0xf705('0x7'),attributes,{'tableName':_0xf705('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xfff0=['user_has_chat_queues','util','../../config/logger','api','bluebird','request-promise','./userChatQueue.attributes','UserChatQueue'];(function(_0x528fba,_0x148d12){var _0x562b9c=function(_0xd0f6c){while(--_0xd0f6c){_0x528fba['push'](_0x528fba['shift']());}};_0x562b9c(++_0x148d12);}(_0xfff0,0x139));var _0x0fff=function(_0x51ea97,_0x581de7){_0x51ea97=_0x51ea97-0x0;var _0x3de433=_0xfff0[_0x51ea97];return _0x3de433;};'use strict';var _=require('lodash');var util=require(_0x0fff('0x0'));var logger=require(_0x0fff('0x1'))(_0x0fff('0x2'));var moment=require('moment');var BPromise=require(_0x0fff('0x3'));var rp=require(_0x0fff('0x4'));var attributes=require(_0x0fff('0x5'));module['exports']=function(_0x2cd3d5,_0x17911e){return _0x2cd3d5['define'](_0x0fff('0x6'),attributes,{'tableName':_0x0fff('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index fac0f6c..fd12b3c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4c08=['lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','client','http','request','then','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','UserChatQueue,\x20%s,\x20%s','message'];(function(_0x502245,_0x3192a6){var _0x2fe2ae=function(_0x4cd7a8){while(--_0x4cd7a8){_0x502245['push'](_0x502245['shift']());}};_0x2fe2ae(++_0x3192a6);}(_0x4c08,0x1ee));var _0x84c0=function(_0x4d7f3f,_0x4d2803){_0x4d7f3f=_0x4d7f3f-0x0;var _0x5d67cc=_0x4c08[_0x4d7f3f];return _0x5d67cc;};'use strict';var _=require(_0x84c0('0x0'));var util=require('util');var moment=require(_0x84c0('0x1'));var BPromise=require(_0x84c0('0x2'));var rs=require(_0x84c0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x84c0('0x4'));var logger=require(_0x84c0('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x84c0('0x6')][_0x84c0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3bf8bf,_0x4f8c5e,_0x1e3b03){return new BPromise(function(_0x537b6b,_0x47a760){return client[_0x84c0('0x8')](_0x3bf8bf,_0x1e3b03)[_0x84c0('0x9')](function(_0x2a66f5){logger[_0x84c0('0xa')]('UserChatQueue,\x20%s,\x20%s',_0x4f8c5e,_0x84c0('0xb'));logger[_0x84c0('0xc')](_0x84c0('0xd'),_0x4f8c5e,_0x84c0('0xb'),JSON[_0x84c0('0xe')](_0x2a66f5));if(_0x2a66f5['error']){if(_0x2a66f5['error'][_0x84c0('0xf')]===0x1f4){logger[_0x84c0('0x10')](_0x84c0('0x11'),_0x4f8c5e,_0x2a66f5['error'][_0x84c0('0x12')]);return _0x47a760(_0x2a66f5['error']['message']);}logger[_0x84c0('0x10')](_0x84c0('0x11'),_0x4f8c5e,_0x2a66f5[_0x84c0('0x10')][_0x84c0('0x12')]);return _0x537b6b(_0x2a66f5['error'][_0x84c0('0x12')]);}else{logger[_0x84c0('0xa')]('UserChatQueue,\x20%s,\x20%s',_0x4f8c5e,_0x84c0('0xb'));_0x537b6b(_0x2a66f5['result'][_0x84c0('0x12')]);}})['catch'](function(_0x2b41f3){logger[_0x84c0('0x10')](_0x84c0('0x11'),_0x4f8c5e,_0x2b41f3);_0x47a760(_0x2b41f3);});});}
\ No newline at end of file
+var _0xdc69=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x583d9f,_0x3b6f86){var _0x32c99f=function(_0x47da93){while(--_0x47da93){_0x583d9f['push'](_0x583d9f['shift']());}};_0x32c99f(++_0x3b6f86);}(_0xdc69,0x177));var _0x9dc6=function(_0x1ac77b,_0x10ee7a){_0x1ac77b=_0x1ac77b-0x0;var _0x161584=_0xdc69[_0x1ac77b];return _0x161584;};'use strict';var _=require(_0x9dc6('0x0'));var util=require(_0x9dc6('0x1'));var moment=require(_0x9dc6('0x2'));var BPromise=require(_0x9dc6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9dc6('0x4'));var db=require(_0x9dc6('0x5'))['db'];var utils=require(_0x9dc6('0x6'));var logger=require(_0x9dc6('0x7'))(_0x9dc6('0x8'));var config=require(_0x9dc6('0x9'));var jayson=require(_0x9dc6('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x9bfd44,_0x444146,_0x1ee8bc){return new BPromise(function(_0x4de5a1,_0x5d5062){return client['request'](_0x9bfd44,_0x1ee8bc)[_0x9dc6('0xb')](function(_0x15fb60){logger[_0x9dc6('0xc')](_0x9dc6('0xd'),_0x444146,_0x9dc6('0xe'));logger[_0x9dc6('0xf')](_0x9dc6('0x10'),_0x444146,_0x9dc6('0xe'),JSON[_0x9dc6('0x11')](_0x15fb60));if(_0x15fb60[_0x9dc6('0x12')]){if(_0x15fb60['error'][_0x9dc6('0x13')]===0x1f4){logger['error'](_0x9dc6('0xd'),_0x444146,_0x15fb60[_0x9dc6('0x12')][_0x9dc6('0x14')]);return _0x5d5062(_0x15fb60[_0x9dc6('0x12')][_0x9dc6('0x14')]);}logger[_0x9dc6('0x12')](_0x9dc6('0xd'),_0x444146,_0x15fb60[_0x9dc6('0x12')][_0x9dc6('0x14')]);return _0x4de5a1(_0x15fb60[_0x9dc6('0x12')][_0x9dc6('0x14')]);}else{logger[_0x9dc6('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x444146,_0x9dc6('0xe'));_0x4de5a1(_0x15fb60['result'][_0x9dc6('0x14')]);}})[_0x9dc6('0x15')](function(_0x2c8db7){logger[_0x9dc6('0x12')](_0x9dc6('0xd'),_0x444146,_0x2c8db7);_0x5d5062(_0x2c8db7);});});}
\ No newline at end of file
index e19f830..f9081bb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdb8b=['../../config/environment','exports','util','path','connect-timeout','../../components/auth/service'];(function(_0xf3f111,_0x25400b){var _0x14726d=function(_0x37e7ed){while(--_0x37e7ed){_0xf3f111['push'](_0xf3f111['shift']());}};_0x14726d(++_0x25400b);}(_0xdb8b,0x1c4));var _0xbdb8=function(_0x5b58e9,_0x2dd3a1){_0x5b58e9=_0x5b58e9-0x0;var _0x52f3db=_0xdb8b[_0x5b58e9];return _0x52f3db;};'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 auth=require(_0xbdb8('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xbdb8('0x4'));module[_0xbdb8('0x5')]=router;
\ No newline at end of file
+var _0x5430=['Router','../../config/environment','multer','util','path','connect-timeout','express'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x5430,0x10c));var _0x0543=function(_0x458868,_0x359c9c){_0x458868=_0x458868-0x0;var _0x15258e=_0x5430[_0x458868];return _0x15258e;};'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 auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0543('0x6'));module['exports']=router;
\ No newline at end of file
index 78e6c4b..dbbb67d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1476=['exports','INTEGER','STRING','sequelize'];(function(_0x34b7ed,_0x99529d){var _0x3b2ca4=function(_0x3a8728){while(--_0x3a8728){_0x34b7ed['push'](_0x34b7ed['shift']());}};_0x3b2ca4(++_0x99529d);}(_0x1476,0x1af));var _0x6147=function(_0x58f0ed,_0x1ee749){_0x58f0ed=_0x58f0ed-0x0;var _0x253a71=_0x1476[_0x58f0ed];return _0x253a71;};'use strict';var Sequelize=require(_0x6147('0x0'));module[_0x6147('0x1')]={'penalty':{'type':Sequelize[_0x6147('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x6147('0x3')]}};
\ No newline at end of file
+var _0x60cb=['sequelize','INTEGER'];(function(_0x232600,_0x33de63){var _0x3fc338=function(_0x33cb50){while(--_0x33cb50){_0x232600['push'](_0x232600['shift']());}};_0x3fc338(++_0x33de63);}(_0x60cb,0x172));var _0xb60c=function(_0x68b0b2,_0x2401fb){_0x68b0b2=_0x68b0b2-0x0;var _0x369b3b=_0x60cb[_0x68b0b2];return _0x369b3b;};'use strict';var Sequelize=require(_0xb60c('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xb60c('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}};
\ No newline at end of file
index e7ba7b2..a01b28c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x00bb=['../../config/logger','moment','request-promise','./userFaxQueue.attributes','lodash','util'];(function(_0x4f352d,_0x50444e){var _0x259cf2=function(_0x1122cf){while(--_0x1122cf){_0x4f352d['push'](_0x4f352d['shift']());}};_0x259cf2(++_0x50444e);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x00bb[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var logger=require(_0xb00b('0x2'))('api');var moment=require(_0xb00b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb00b('0x4'));var attributes=require(_0xb00b('0x5'));module['exports']=function(_0x14b5d0,_0x2dbd25){return _0x14b5d0['define']('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x98a8=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','exports','define','UserFaxQueue'];(function(_0x4f6e2e,_0x1f293a){var _0x4d2830=function(_0x1aa462){while(--_0x1aa462){_0x4f6e2e['push'](_0x4f6e2e['shift']());}};_0x4d2830(++_0x1f293a);}(_0x98a8,0x12c));var _0x898a=function(_0x3c8220,_0x476f0e){_0x3c8220=_0x3c8220-0x0;var _0x3c6c19=_0x98a8[_0x3c8220];return _0x3c6c19;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var logger=require(_0x898a('0x2'))(_0x898a('0x3'));var moment=require(_0x898a('0x4'));var BPromise=require(_0x898a('0x5'));var rp=require(_0x898a('0x6'));var attributes=require('./userFaxQueue.attributes');module[_0x898a('0x7')]=function(_0xf84a19,_0x1b3dd0){return _0xf84a19[_0x898a('0x8')](_0x898a('0x9'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 43ca99f..c929a3e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0abf=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','lodash','util','bluebird','ioredis'];(function(_0x4a45b4,_0x59804f){var _0x1a99c9=function(_0x3aa517){while(--_0x3aa517){_0x4a45b4['push'](_0x4a45b4['shift']());}};_0x1a99c9(++_0x59804f);}(_0x0abf,0x119));var _0xf0ab=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x0abf[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0xf0ab('0x0'));var util=require(_0xf0ab('0x1'));var moment=require('moment');var BPromise=require(_0xf0ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0ab('0x3'));var db=require(_0xf0ab('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0ab('0x5'))('rpc');var config=require(_0xf0ab('0x6'));var jayson=require(_0xf0ab('0x7'));var client=jayson['client'][_0xf0ab('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e641a,_0x5a9179,_0x5c867b){return new BPromise(function(_0x41bb32,_0x5dbce6){return client[_0xf0ab('0x9')](_0x5e641a,_0x5c867b)[_0xf0ab('0xa')](function(_0x5af246){logger['info'](_0xf0ab('0xb'),_0x5a9179,_0xf0ab('0xc'));logger[_0xf0ab('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x5a9179,_0xf0ab('0xc'),JSON['stringify'](_0x5af246));if(_0x5af246[_0xf0ab('0xe')]){if(_0x5af246['error'][_0xf0ab('0xf')]===0x1f4){logger[_0xf0ab('0xe')](_0xf0ab('0xb'),_0x5a9179,_0x5af246[_0xf0ab('0xe')][_0xf0ab('0x10')]);return _0x5dbce6(_0x5af246['error'][_0xf0ab('0x10')]);}logger[_0xf0ab('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x5a9179,_0x5af246[_0xf0ab('0xe')][_0xf0ab('0x10')]);return _0x41bb32(_0x5af246[_0xf0ab('0xe')][_0xf0ab('0x10')]);}else{logger[_0xf0ab('0x11')](_0xf0ab('0xb'),_0x5a9179,_0xf0ab('0xc'));_0x41bb32(_0x5af246[_0xf0ab('0x12')][_0xf0ab('0x10')]);}})['catch'](function(_0x24662f){logger[_0xf0ab('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x5a9179,_0x24662f);_0x5dbce6(_0x24662f);});});}
\ No newline at end of file
+var _0x850a=['../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1bdb49,_0x351b19){var _0x1195c9=function(_0x4a1111){while(--_0x4a1111){_0x1bdb49['push'](_0x1bdb49['shift']());}};_0x1195c9(++_0x351b19);}(_0x850a,0x180));var _0xa850=function(_0x310a1b,_0x4c9129){_0x310a1b=_0x310a1b-0x0;var _0xdea206=_0x850a[_0x310a1b];return _0xdea206;};'use strict';var _=require(_0xa850('0x0'));var util=require(_0xa850('0x1'));var moment=require(_0xa850('0x2'));var BPromise=require(_0xa850('0x3'));var rs=require(_0xa850('0x4'));var fs=require('fs');var Redis=require(_0xa850('0x5'));var db=require(_0xa850('0x6'))['db'];var utils=require(_0xa850('0x7'));var logger=require('../../config/logger')(_0xa850('0x8'));var config=require(_0xa850('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa850('0xa')][_0xa850('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x91f23f,_0x3114dd,_0x1bd078){return new BPromise(function(_0xc1ee67,_0x1160d5){return client[_0xa850('0xc')](_0x91f23f,_0x1bd078)[_0xa850('0xd')](function(_0x213ac4){logger[_0xa850('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x3114dd,_0xa850('0xf'));logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x3114dd,'request\x20sent',JSON[_0xa850('0x10')](_0x213ac4));if(_0x213ac4[_0xa850('0x11')]){if(_0x213ac4[_0xa850('0x11')][_0xa850('0x12')]===0x1f4){logger[_0xa850('0x11')](_0xa850('0x13'),_0x3114dd,_0x213ac4[_0xa850('0x11')]['message']);return _0x1160d5(_0x213ac4[_0xa850('0x11')][_0xa850('0x14')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x3114dd,_0x213ac4[_0xa850('0x11')][_0xa850('0x14')]);return _0xc1ee67(_0x213ac4[_0xa850('0x11')][_0xa850('0x14')]);}else{logger[_0xa850('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x3114dd,'request\x20sent');_0xc1ee67(_0x213ac4[_0xa850('0x15')][_0xa850('0x14')]);}})[_0xa850('0x16')](function(_0x201f21){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x3114dd,_0x201f21);_0x1160d5(_0x201f21);});});}
\ No newline at end of file
index 0f19b9e..6fe5d21 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7409=['../../config/environment','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x50d50f,_0x26a408){var _0x4603b2=function(_0x359e02){while(--_0x359e02){_0x50d50f['push'](_0x50d50f['shift']());}};_0x4603b2(++_0x26a408);}(_0x7409,0x6e));var _0x9740=function(_0x348021,_0x24fc80){_0x348021=_0x348021-0x0;var _0x426682=_0x7409[_0x348021];return _0x426682;};'use strict';var multer=require(_0x9740('0x0'));var util=require(_0x9740('0x1'));var path=require('path');var timeout=require(_0x9740('0x2'));var express=require(_0x9740('0x3'));var router=express[_0x9740('0x4')]();var auth=require(_0x9740('0x5'));var interaction=require(_0x9740('0x6'));var config=require(_0x9740('0x7'));module[_0x9740('0x8')]=router;
\ No newline at end of file
+var _0x2e65=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','exports','multer','util'];(function(_0x3f046a,_0x2015d0){var _0x1f0e0b=function(_0x168552){while(--_0x168552){_0x3f046a['push'](_0x3f046a['shift']());}};_0x1f0e0b(++_0x2015d0);}(_0x2e65,0x193));var _0x52e6=function(_0x46f1a6,_0xc7a582){_0x46f1a6=_0x46f1a6-0x0;var _0x38429a=_0x2e65[_0x46f1a6];return _0x38429a;};'use strict';var multer=require(_0x52e6('0x0'));var util=require(_0x52e6('0x1'));var path=require(_0x52e6('0x2'));var timeout=require(_0x52e6('0x3'));var express=require(_0x52e6('0x4'));var router=express[_0x52e6('0x5')]();var auth=require(_0x52e6('0x6'));var interaction=require(_0x52e6('0x7'));var config=require('../../config/environment');module[_0x52e6('0x8')]=router;
\ No newline at end of file
index 4a73159..953ca2d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x879b=['INTEGER','exports'];(function(_0x38a316,_0x79d7e3){var _0x50d7cc=function(_0x24daeb){while(--_0x24daeb){_0x38a316['push'](_0x38a316['shift']());}};_0x50d7cc(++_0x79d7e3);}(_0x879b,0x13f));var _0xb879=function(_0x2fff52,_0x1580ac){_0x2fff52=_0x2fff52-0x0;var _0x4fef52=_0x879b[_0x2fff52];return _0x4fef52;};'use strict';var Sequelize=require('sequelize');module[_0xb879('0x0')]={'penalty':{'type':Sequelize[_0xb879('0x1')],'defaultValue':0x0}};
\ No newline at end of file
+var _0xa4c3=['exports','INTEGER','sequelize'];(function(_0x1b6311,_0x42ec20){var _0x25aab6=function(_0x139a77){while(--_0x139a77){_0x1b6311['push'](_0x1b6311['shift']());}};_0x25aab6(++_0x42ec20);}(_0xa4c3,0xda));var _0x3a4c=function(_0x456623,_0x3ccea6){_0x456623=_0x456623-0x0;var _0x21700e=_0xa4c3[_0x456623];return _0x21700e;};'use strict';var Sequelize=require(_0x3a4c('0x0'));module[_0x3a4c('0x1')]={'penalty':{'type':Sequelize[_0x3a4c('0x2')],'defaultValue':0x0}};
\ No newline at end of file
index d23ab49..de5fc7e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0120=['define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./userMailQueue.attributes','exports'];(function(_0x2c569b,_0x5c405d){var _0x749b04=function(_0x5c0545){while(--_0x5c0545){_0x2c569b['push'](_0x2c569b['shift']());}};_0x749b04(++_0x5c405d);}(_0x0120,0x6f));var _0x0012=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x0120[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var logger=require(_0x0012('0x2'))(_0x0012('0x3'));var moment=require(_0x0012('0x4'));var BPromise=require(_0x0012('0x5'));var rp=require(_0x0012('0x6'));var attributes=require(_0x0012('0x7'));module[_0x0012('0x8')]=function(_0x302029,_0x3505ab){return _0x302029[_0x0012('0x9')]('UserMailQueue',attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x225b=['moment','request-promise','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','api'];(function(_0x586c56,_0x5a9018){var _0x918b76=function(_0x5b8395){while(--_0x5b8395){_0x586c56['push'](_0x586c56['shift']());}};_0x918b76(++_0x5a9018);}(_0x225b,0xb1));var _0xb225=function(_0x62b1a9,_0x3d25f9){_0x62b1a9=_0x62b1a9-0x0;var _0x665bbe=_0x225b[_0x62b1a9];return _0x665bbe;};'use strict';var _=require(_0xb225('0x0'));var util=require(_0xb225('0x1'));var logger=require('../../config/logger')(_0xb225('0x2'));var moment=require(_0xb225('0x3'));var BPromise=require('bluebird');var rp=require(_0xb225('0x4'));var attributes=require('./userMailQueue.attributes');module[_0xb225('0x5')]=function(_0x5d0e82,_0x144e6c){return _0x5d0e82[_0xb225('0x6')](_0xb225('0x7'),attributes,{'tableName':_0xb225('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 7ed05e6..81dfad3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe029=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe029,0x1f4));var _0x9e02=function(_0x45d7b0,_0x3e54f7){_0x45d7b0=_0x45d7b0-0x0;var _0x390b67=_0xe029[_0x45d7b0];return _0x390b67;};'use strict';var _=require(_0x9e02('0x0'));var util=require(_0x9e02('0x1'));var moment=require(_0x9e02('0x2'));var BPromise=require('bluebird');var rs=require(_0x9e02('0x3'));var fs=require('fs');var Redis=require(_0x9e02('0x4'));var db=require(_0x9e02('0x5'))['db'];var utils=require(_0x9e02('0x6'));var logger=require('../../config/logger')(_0x9e02('0x7'));var config=require(_0x9e02('0x8'));var jayson=require(_0x9e02('0x9'));var client=jayson[_0x9e02('0xa')][_0x9e02('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26a0a0,_0x59ccd4,_0x389ccd){return new BPromise(function(_0x481f59,_0x2865bf){return client[_0x9e02('0xc')](_0x26a0a0,_0x389ccd)['then'](function(_0x40fe1c){logger[_0x9e02('0xd')](_0x9e02('0xe'),_0x59ccd4,_0x9e02('0xf'));logger[_0x9e02('0x10')](_0x9e02('0x11'),_0x59ccd4,_0x9e02('0xf'),JSON[_0x9e02('0x12')](_0x40fe1c));if(_0x40fe1c[_0x9e02('0x13')]){if(_0x40fe1c[_0x9e02('0x13')]['code']===0x1f4){logger['error']('UserMailQueue,\x20%s,\x20%s',_0x59ccd4,_0x40fe1c[_0x9e02('0x13')][_0x9e02('0x14')]);return _0x2865bf(_0x40fe1c[_0x9e02('0x13')][_0x9e02('0x14')]);}logger[_0x9e02('0x13')](_0x9e02('0xe'),_0x59ccd4,_0x40fe1c[_0x9e02('0x13')][_0x9e02('0x14')]);return _0x481f59(_0x40fe1c[_0x9e02('0x13')][_0x9e02('0x14')]);}else{logger[_0x9e02('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x59ccd4,_0x9e02('0xf'));_0x481f59(_0x40fe1c[_0x9e02('0x15')]['message']);}})[_0x9e02('0x16')](function(_0x1ad6b5){logger[_0x9e02('0x13')](_0x9e02('0xe'),_0x59ccd4,_0x1ad6b5);_0x2865bf(_0x1ad6b5);});});}
\ No newline at end of file
+var _0xce02=['jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0xce02,0x19f));var _0x2ce0=function(_0x5dc03e,_0x54e60c){_0x5dc03e=_0x5dc03e-0x0;var _0x466a07=_0xce02[_0x5dc03e];return _0x466a07;};'use strict';var _=require(_0x2ce0('0x0'));var util=require(_0x2ce0('0x1'));var moment=require(_0x2ce0('0x2'));var BPromise=require(_0x2ce0('0x3'));var rs=require(_0x2ce0('0x4'));var fs=require('fs');var Redis=require(_0x2ce0('0x5'));var db=require(_0x2ce0('0x6'))['db'];var utils=require(_0x2ce0('0x7'));var logger=require(_0x2ce0('0x8'))('rpc');var config=require(_0x2ce0('0x9'));var jayson=require(_0x2ce0('0xa'));var client=jayson[_0x2ce0('0xb')][_0x2ce0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1cdae6,_0xde7194,_0x24ad9f){return new BPromise(function(_0x4b702e,_0x34c6cf){return client[_0x2ce0('0xd')](_0x1cdae6,_0x24ad9f)[_0x2ce0('0xe')](function(_0x9bc063){logger[_0x2ce0('0xf')](_0x2ce0('0x10'),_0xde7194,_0x2ce0('0x11'));logger[_0x2ce0('0x12')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0xde7194,_0x2ce0('0x11'),JSON[_0x2ce0('0x13')](_0x9bc063));if(_0x9bc063['error']){if(_0x9bc063[_0x2ce0('0x14')][_0x2ce0('0x15')]===0x1f4){logger['error'](_0x2ce0('0x10'),_0xde7194,_0x9bc063[_0x2ce0('0x14')][_0x2ce0('0x16')]);return _0x34c6cf(_0x9bc063[_0x2ce0('0x14')][_0x2ce0('0x16')]);}logger[_0x2ce0('0x14')](_0x2ce0('0x10'),_0xde7194,_0x9bc063['error'][_0x2ce0('0x16')]);return _0x4b702e(_0x9bc063[_0x2ce0('0x14')][_0x2ce0('0x16')]);}else{logger[_0x2ce0('0xf')](_0x2ce0('0x10'),_0xde7194,_0x2ce0('0x11'));_0x4b702e(_0x9bc063[_0x2ce0('0x17')][_0x2ce0('0x16')]);}})[_0x2ce0('0x18')](function(_0x4255fe){logger[_0x2ce0('0x14')](_0x2ce0('0x10'),_0xde7194,_0x4255fe);_0x34c6cf(_0x4255fe);});});}
\ No newline at end of file
index 378acf0..a520ab1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x02a7=['../../components/interaction/service','../../config/environment','exports','util','express','Router','../../components/auth/service'];(function(_0x44606e,_0x2bf244){var _0xe68388=function(_0x488a30){while(--_0x488a30){_0x44606e['push'](_0x44606e['shift']());}};_0xe68388(++_0x2bf244);}(_0x02a7,0x7a));var _0x702a=function(_0x2a812c,_0x4c6edf){_0x2a812c=_0x2a812c-0x0;var _0x48554f=_0x02a7[_0x2a812c];return _0x48554f;};'use strict';var multer=require('multer');var util=require(_0x702a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x702a('0x1'));var router=express[_0x702a('0x2')]();var auth=require(_0x702a('0x3'));var interaction=require(_0x702a('0x4'));var config=require(_0x702a('0x5'));module[_0x702a('0x6')]=router;
\ No newline at end of file
+var _0x5a5a=['exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x52a2be,_0x4bd252){_0x52a2be=_0x52a2be-0x0;var _0x246f1d=_0x5a5a[_0x52a2be];return _0x246f1d;};'use strict';var multer=require('multer');var util=require(_0xa5a5('0x0'));var path=require(_0xa5a5('0x1'));var timeout=require(_0xa5a5('0x2'));var express=require(_0xa5a5('0x3'));var router=express[_0xa5a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa5a5('0x5'));var config=require(_0xa5a5('0x6'));module[_0xa5a5('0x7')]=router;
\ No newline at end of file
index 9c38d38..23b5343 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbb7e=['sequelize','exports','INTEGER'];(function(_0x198781,_0x3c1bb5){var _0x87240=function(_0x407865){while(--_0x407865){_0x198781['push'](_0x198781['shift']());}};_0x87240(++_0x3c1bb5);}(_0xbb7e,0x165));var _0xebb7=function(_0x35c721,_0x2e76b1){_0x35c721=_0x35c721-0x0;var _0x530e36=_0xbb7e[_0x35c721];return _0x530e36;};'use strict';var Sequelize=require(_0xebb7('0x0'));module[_0xebb7('0x1')]={'penalty':{'type':Sequelize[_0xebb7('0x2')],'defaultValue':0x0}};
\ No newline at end of file
+var _0xc45c=['INTEGER','sequelize','exports'];(function(_0xca33b4,_0x31f0d8){var _0x55d5a6=function(_0x53c084){while(--_0x53c084){_0xca33b4['push'](_0xca33b4['shift']());}};_0x55d5a6(++_0x31f0d8);}(_0xc45c,0x94));var _0xcc45=function(_0x195217,_0x27b6ea){_0x195217=_0x195217-0x0;var _0x420c7b=_0xc45c[_0x195217];return _0x420c7b;};'use strict';var Sequelize=require(_0xcc45('0x0'));module[_0xcc45('0x1')]={'penalty':{'type':Sequelize[_0xcc45('0x2')],'defaultValue':0x0}};
\ No newline at end of file
index b33dc0b..98ed89b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5974=['lodash','../../config/logger','moment','bluebird','request-promise','exports','define','UserOpenchannelQueue','user_has_openchannel_queues'];(function(_0x5c2c7c,_0xa7d3b1){var _0xea7ffe=function(_0x471f17){while(--_0x471f17){_0x5c2c7c['push'](_0x5c2c7c['shift']());}};_0xea7ffe(++_0xa7d3b1);}(_0x5974,0xe1));var _0x4597=function(_0x4629ee,_0x5802d8){_0x4629ee=_0x4629ee-0x0;var _0x47fb5b=_0x5974[_0x4629ee];return _0x47fb5b;};'use strict';var _=require(_0x4597('0x0'));var util=require('util');var logger=require(_0x4597('0x1'))('api');var moment=require(_0x4597('0x2'));var BPromise=require(_0x4597('0x3'));var rp=require(_0x4597('0x4'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x4597('0x5')]=function(_0x55eb6d,_0x46a5c8){return _0x55eb6d[_0x4597('0x6')](_0x4597('0x7'),attributes,{'tableName':_0x4597('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xe02f=['../../config/logger','moment','request-promise','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe02f,0x1ee));var _0xfe02=function(_0x2bf8ac,_0x4226be){_0x2bf8ac=_0x2bf8ac-0x0;var _0x3ef094=_0xe02f[_0x2bf8ac];return _0x3ef094;};'use strict';var _=require('lodash');var util=require(_0xfe02('0x0'));var logger=require(_0xfe02('0x1'))('api');var moment=require(_0xfe02('0x2'));var BPromise=require('bluebird');var rp=require(_0xfe02('0x3'));var attributes=require(_0xfe02('0x4'));module[_0xfe02('0x5')]=function(_0x11f8c4,_0x20787d){return _0x11f8c4[_0xfe02('0x6')](_0xfe02('0x7'),attributes,{'tableName':_0xfe02('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index f3ae896..6f93489 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd4fc=['http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x870b62,_0x2143f9){var _0x2dcb39=function(_0x2fb63d){while(--_0x2fb63d){_0x870b62['push'](_0x870b62['shift']());}};_0x2dcb39(++_0x2143f9);}(_0xd4fc,0xdb));var _0xcd4f=function(_0x385ab2,_0x382968){_0x385ab2=_0x385ab2-0x0;var _0x490821=_0xd4fc[_0x385ab2];return _0x490821;};'use strict';var _=require(_0xcd4f('0x0'));var util=require(_0xcd4f('0x1'));var moment=require(_0xcd4f('0x2'));var BPromise=require('bluebird');var rs=require(_0xcd4f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd4f('0x4'))['db'];var utils=require(_0xcd4f('0x5'));var logger=require(_0xcd4f('0x6'))(_0xcd4f('0x7'));var config=require(_0xcd4f('0x8'));var jayson=require(_0xcd4f('0x9'));var client=jayson[_0xcd4f('0xa')][_0xcd4f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12a458,_0x32689c,_0x508399){return new BPromise(function(_0x15ddbb,_0xbe30c8){return client['request'](_0x12a458,_0x508399)[_0xcd4f('0xc')](function(_0x3c5fa9){logger[_0xcd4f('0xd')](_0xcd4f('0xe'),_0x32689c,'request\x20sent');logger[_0xcd4f('0xf')](_0xcd4f('0x10'),_0x32689c,'request\x20sent',JSON['stringify'](_0x3c5fa9));if(_0x3c5fa9[_0xcd4f('0x11')]){if(_0x3c5fa9['error'][_0xcd4f('0x12')]===0x1f4){logger[_0xcd4f('0x11')](_0xcd4f('0xe'),_0x32689c,_0x3c5fa9[_0xcd4f('0x11')][_0xcd4f('0x13')]);return _0xbe30c8(_0x3c5fa9[_0xcd4f('0x11')]['message']);}logger[_0xcd4f('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x32689c,_0x3c5fa9[_0xcd4f('0x11')][_0xcd4f('0x13')]);return _0x15ddbb(_0x3c5fa9[_0xcd4f('0x11')][_0xcd4f('0x13')]);}else{logger[_0xcd4f('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x32689c,_0xcd4f('0x14'));_0x15ddbb(_0x3c5fa9[_0xcd4f('0x15')][_0xcd4f('0x13')]);}})[_0xcd4f('0x16')](function(_0x5c276a){logger[_0xcd4f('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x32689c,_0x5c276a);_0xbe30c8(_0x5c276a);});});}
\ No newline at end of file
+var _0x363b=['code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x131b78,_0xdc1f76){var _0x1b5ece=function(_0x284dcb){while(--_0x284dcb){_0x131b78['push'](_0x131b78['shift']());}};_0x1b5ece(++_0xdc1f76);}(_0x363b,0x14d));var _0xb363=function(_0x52775e,_0x44001a){_0x52775e=_0x52775e-0x0;var _0x5e3cae=_0x363b[_0x52775e];return _0x5e3cae;};'use strict';var _=require('lodash');var util=require(_0xb363('0x0'));var moment=require(_0xb363('0x1'));var BPromise=require(_0xb363('0x2'));var rs=require(_0xb363('0x3'));var fs=require('fs');var Redis=require(_0xb363('0x4'));var db=require(_0xb363('0x5'))['db'];var utils=require(_0xb363('0x6'));var logger=require('../../config/logger')(_0xb363('0x7'));var config=require(_0xb363('0x8'));var jayson=require(_0xb363('0x9'));var client=jayson[_0xb363('0xa')][_0xb363('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe9991e,_0x1ec5a1,_0x6e5e08){return new BPromise(function(_0x3bedda,_0x45a509){return client[_0xb363('0xc')](_0xe9991e,_0x6e5e08)['then'](function(_0xccb7ee){logger[_0xb363('0xd')](_0xb363('0xe'),_0x1ec5a1,_0xb363('0xf'));logger[_0xb363('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x1ec5a1,_0xb363('0xf'),JSON[_0xb363('0x11')](_0xccb7ee));if(_0xccb7ee[_0xb363('0x12')]){if(_0xccb7ee[_0xb363('0x12')][_0xb363('0x13')]===0x1f4){logger[_0xb363('0x12')](_0xb363('0xe'),_0x1ec5a1,_0xccb7ee['error'][_0xb363('0x14')]);return _0x45a509(_0xccb7ee[_0xb363('0x12')][_0xb363('0x14')]);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x1ec5a1,_0xccb7ee[_0xb363('0x12')]['message']);return _0x3bedda(_0xccb7ee[_0xb363('0x12')][_0xb363('0x14')]);}else{logger[_0xb363('0xd')](_0xb363('0xe'),_0x1ec5a1,_0xb363('0xf'));_0x3bedda(_0xccb7ee['result']['message']);}})[_0xb363('0x15')](function(_0x5ad389){logger[_0xb363('0x12')](_0xb363('0xe'),_0x1ec5a1,_0x5ad389);_0x45a509(_0x5ad389);});});}
\ No newline at end of file
index 3bd7dde..a161d8d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9a30=['express','Router','../../config/environment','isAuthenticated','index','describe','get','/:id','/:id/resources','getResources','post','create','/:id/clone','clone','/:id/sections','addSections','addResources','put','update','delete','destroy','removeResources','multer','util','path','connect-timeout'];(function(_0x164773,_0x415b8d){var _0xf751a0=function(_0x1cbfcf){while(--_0x1cbfcf){_0x164773['push'](_0x164773['shift']());}};_0xf751a0(++_0x415b8d);}(_0x9a30,0x19c));var _0x09a3=function(_0x5640db,_0x521b2e){_0x5640db=_0x5640db-0x0;var _0x43557c=_0x9a30[_0x5640db];return _0x43557c;};'use strict';var multer=require(_0x09a3('0x0'));var util=require(_0x09a3('0x1'));var path=require(_0x09a3('0x2'));var timeout=require(_0x09a3('0x3'));var express=require(_0x09a3('0x4'));var router=express[_0x09a3('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x09a3('0x6'));var controller=require('./userProfile.controller');router['get']('/',auth[_0x09a3('0x7')](),controller[_0x09a3('0x8')]);router['get']('/describe',auth[_0x09a3('0x7')](),controller[_0x09a3('0x9')]);router[_0x09a3('0xa')](_0x09a3('0xb'),auth[_0x09a3('0x7')](),controller['show']);router[_0x09a3('0xa')](_0x09a3('0xc'),auth[_0x09a3('0x7')](),controller[_0x09a3('0xd')]);router[_0x09a3('0xe')]('/',auth['isAuthenticated'](),controller[_0x09a3('0xf')]);router[_0x09a3('0xe')](_0x09a3('0x10'),auth[_0x09a3('0x7')](),controller[_0x09a3('0x11')]);router[_0x09a3('0xe')](_0x09a3('0x12'),auth[_0x09a3('0x7')](),controller[_0x09a3('0x13')]);router[_0x09a3('0xe')](_0x09a3('0xc'),auth[_0x09a3('0x7')](),controller[_0x09a3('0x14')]);router[_0x09a3('0x15')](_0x09a3('0xb'),auth[_0x09a3('0x7')](),controller[_0x09a3('0x16')]);router[_0x09a3('0x17')](_0x09a3('0xb'),auth[_0x09a3('0x7')](),controller[_0x09a3('0x18')]);router['delete'](_0x09a3('0x12'),auth[_0x09a3('0x7')](),controller['removeSections']);router[_0x09a3('0x17')](_0x09a3('0xc'),auth[_0x09a3('0x7')](),controller[_0x09a3('0x19')]);module['exports']=router;
\ No newline at end of file
+var _0x9708=['/describe','show','getResources','post','create','/:id/clone','clone','/:id/resources','addResources','/:id','update','delete','destroy','/:id/sections','removeResources','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index'];(function(_0x383412,_0x5c8108){var _0x309a87=function(_0x36fc4b){while(--_0x36fc4b){_0x383412['push'](_0x383412['shift']());}};_0x309a87(++_0x5c8108);}(_0x9708,0x91));var _0x8970=function(_0x236c89,_0xd76ba9){_0x236c89=_0x236c89-0x0;var _0x3b2a15=_0x9708[_0x236c89];return _0x3b2a15;};'use strict';var multer=require(_0x8970('0x0'));var util=require(_0x8970('0x1'));var path=require('path');var timeout=require(_0x8970('0x2'));var express=require('express');var router=express[_0x8970('0x3')]();var auth=require(_0x8970('0x4'));var interaction=require(_0x8970('0x5'));var config=require(_0x8970('0x6'));var controller=require(_0x8970('0x7'));router[_0x8970('0x8')]('/',auth[_0x8970('0x9')](),controller[_0x8970('0xa')]);router[_0x8970('0x8')](_0x8970('0xb'),auth[_0x8970('0x9')](),controller['describe']);router[_0x8970('0x8')]('/:id',auth[_0x8970('0x9')](),controller[_0x8970('0xc')]);router[_0x8970('0x8')]('/:id/resources',auth[_0x8970('0x9')](),controller[_0x8970('0xd')]);router[_0x8970('0xe')]('/',auth[_0x8970('0x9')](),controller[_0x8970('0xf')]);router[_0x8970('0xe')](_0x8970('0x10'),auth[_0x8970('0x9')](),controller[_0x8970('0x11')]);router[_0x8970('0xe')]('/:id/sections',auth[_0x8970('0x9')](),controller['addSections']);router['post'](_0x8970('0x12'),auth[_0x8970('0x9')](),controller[_0x8970('0x13')]);router['put'](_0x8970('0x14'),auth[_0x8970('0x9')](),controller[_0x8970('0x15')]);router[_0x8970('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x8970('0x17')]);router['delete'](_0x8970('0x18'),auth['isAuthenticated'](),controller['removeSections']);router['delete'](_0x8970('0x12'),auth[_0x8970('0x9')](),controller[_0x8970('0x19')]);module['exports']=router;
\ No newline at end of file
index 4b50dcc..2bf7c02 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0d7c=['setDataValue','crudPermissions','join','getDataValue','sequelize','exports','STRING'];(function(_0x2eb159,_0x584ce4){var _0x4e47ca=function(_0x551935){while(--_0x551935){_0x2eb159['push'](_0x2eb159['shift']());}};_0x4e47ca(++_0x584ce4);}(_0x0d7c,0xcf));var _0xc0d7=function(_0x533e4e,_0x4eba54){_0x533e4e=_0x533e4e-0x0;var _0x1f14bb=_0x0d7c[_0x533e4e];return _0x1f14bb;};'use strict';var Sequelize=require(_0xc0d7('0x0'));module[_0xc0d7('0x1')]={'name':{'type':Sequelize[_0xc0d7('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0xc0d7('0x2')],'set':function(_0x1dedbe){this[_0xc0d7('0x3')](_0xc0d7('0x4'),_0x1dedbe?_0x1dedbe[_0xc0d7('0x5')](''):[]);},'get':function(){return this[_0xc0d7('0x6')](_0xc0d7('0x4'))?this[_0xc0d7('0x6')](_0xc0d7('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xc0d7('0x2')],'allowNull':!![]}};
\ No newline at end of file
+var _0xdb85=['STRING','setDataValue','crudPermissions','getDataValue','split','sequelize','exports'];(function(_0x35e388,_0x18d3f9){var _0x28f976=function(_0x5c9b73){while(--_0x5c9b73){_0x35e388['push'](_0x35e388['shift']());}};_0x28f976(++_0x18d3f9);}(_0xdb85,0x171));var _0x5db8=function(_0x895358,_0x32f914){_0x895358=_0x895358-0x0;var _0x26e26e=_0xdb85[_0x895358];return _0x26e26e;};'use strict';var Sequelize=require(_0x5db8('0x0'));module[_0x5db8('0x1')]={'name':{'type':Sequelize[_0x5db8('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x127fa9){this[_0x5db8('0x3')](_0x5db8('0x4'),_0x127fa9?_0x127fa9['join'](''):[]);},'get':function(){return this[_0x5db8('0x5')](_0x5db8('0x4'))?this[_0x5db8('0x5')](_0x5db8('0x4'))[_0x5db8('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x5db8('0x2')],'allowNull':!![]}};
\ No newline at end of file
index 6906d70..e6577eb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc0c3=['intervals','Interval','pauses','Pause','Schedule','sounds','Sound','tags','templates','Template','Trigger','trunks','Variable','plugins','Plugin','Reports','metrics','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','ioredis','api','../../config/utils','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','offset','limit','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','rawAttributes','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','map','key','VIRTUAL','options','UserProfile','count','include','findAll','rows','catch','params','find','create','body','length','get','omit','updatedAt','crudPermissions','sequelize','transaction','includeAll','UserProfileSection','each','autoAssociation','UserProfileResource','createdAt','sectionId','Resources','describe','addSections','push','removeSections','ids','addResources','userProfileId','bulkCreate','removeResources','getResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','Invalid\x20section\x20\x27','findOne','all','ignore','isEmpty','childModel','pick','field','foreignKey','resourceIds','resourceFields','forEach','type','AnalyticExtractedReport','default','reportId','DefaultReports','custom','CmContact','Tags','tag','Tag','ThroughTags','color','value','resourceId','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','ListId','lists','CmList','companies','CmCompany','ChatQueue','chatwebsites','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','agent','Telephones','role','telephone','VoiceQueues','QueueCampaigns','queue','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','SmsAccount','teams','Team','voicequeues','queuecampaigns','users','Users','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','dispositions','Disposition','customdashboards','Dashboard'];(function(_0x2823f8,_0x1370e6){var _0x545b48=function(_0xbb753f){while(--_0xbb753f){_0x2823f8['push'](_0x2823f8['shift']());}};_0x545b48(++_0x1370e6);}(_0xc0c3,0xf6));var _0x3c0c=function(_0x473d6e,_0x3e4f2a){_0x473d6e=_0x473d6e-0x0;var _0x54a1db=_0xc0c3[_0x473d6e];return _0x54a1db;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3c0c('0x0'));var rimraf=require(_0x3c0c('0x1'));var zipdir=require(_0x3c0c('0x2'));var jsonpatch=require(_0x3c0c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3c0c('0x4'));var Mustache=require(_0x3c0c('0x5'));var util=require(_0x3c0c('0x6'));var path=require(_0x3c0c('0x7'));var sox=require(_0x3c0c('0x8'));var csv=require(_0x3c0c('0x9'));var ejs=require(_0x3c0c('0xa'));var fs=require('fs');var _=require(_0x3c0c('0xb'));var squel=require(_0x3c0c('0xc'));var crypto=require(_0x3c0c('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3c0c('0x9'));var querystring=require(_0x3c0c('0xe'));var Papa=require(_0x3c0c('0xf'));var authService=require(_0x3c0c('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x3c0c('0x11'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x3c0c('0x12'));var utils=require(_0x3c0c('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x3c0c('0x14')],{'host':_0x3c0c('0x15'),'port':0x18eb});var socket=require(_0x3c0c('0x16'))(new Redis(config[_0x3c0c('0x14')]));require(_0x3c0c('0x17'))[_0x3c0c('0x18')](socket);function respondWithStatusCode(_0x6d2c74,_0x437fdf){_0x437fdf=_0x437fdf||0xcc;return function(_0x1a2e12){if(_0x1a2e12){return _0x6d2c74[_0x3c0c('0x19')](_0x437fdf);}return _0x6d2c74[_0x3c0c('0x1a')](_0x437fdf)['end']();};}function respondWithResult(_0x26daf4,_0x222365){_0x222365=_0x222365||0xc8;return function(_0x40b1ca){if(_0x40b1ca){return _0x26daf4[_0x3c0c('0x1a')](_0x222365)[_0x3c0c('0x1b')](_0x40b1ca);}};}function respondWithFilteredResult(_0xb6e50a,_0x379d67){return function(_0x192928){if(_0x192928){var _0x2e0868=_0x192928['count'],_0x2260ed=_0x379d67[_0x3c0c('0x1c')],_0x50b64c=_0x379d67[_0x3c0c('0x1c')]+_0x379d67[_0x3c0c('0x1d')],_0x2fb72f;if(_0x50b64c>=_0x2e0868){_0x50b64c=_0x2e0868;_0x2fb72f=0xc8;}else{_0x2fb72f=0xce;}_0xb6e50a[_0x3c0c('0x1a')](_0x2fb72f);return _0xb6e50a[_0x3c0c('0x1e')](_0x3c0c('0x1f'),_0x2260ed+'-'+_0x50b64c+'/'+_0x2e0868)[_0x3c0c('0x1b')](_0x192928);}return null;};}function patchUpdates(_0x4ca727){return function(_0x38c4fc){try{jsonpatch['apply'](_0x38c4fc,_0x4ca727,!![]);}catch(_0x567f10){return BPromise[_0x3c0c('0x20')](_0x567f10);}return _0x38c4fc['save']();};}function saveUpdates(_0x2aa72d,_0x34bdfb){return function(_0x493359){if(_0x493359){return _0x493359[_0x3c0c('0x21')](_0x2aa72d)[_0x3c0c('0x22')](function(_0x3628af){return _0x3628af;});}return null;};}function removeEntity(_0x286688,_0x1c21d3){return function(_0xc205c6){if(_0xc205c6){return _0xc205c6[_0x3c0c('0x23')]()[_0x3c0c('0x22')](function(){_0x286688[_0x3c0c('0x1a')](0xcc)[_0x3c0c('0x24')]();});}};}function handleEntityNotFound(_0x3e3cab,_0x4b8d4c){return function(_0xce1ef6){if(!_0xce1ef6){_0x3e3cab[_0x3c0c('0x19')](0x194);}return _0xce1ef6;};}function handleError(_0x4a89bf,_0x4abb72){_0x4abb72=_0x4abb72||0x1f4;return function(_0x5c3b0a){logger[_0x3c0c('0x25')](_0x5c3b0a[_0x3c0c('0x26')]);if(_0x5c3b0a[_0x3c0c('0x27')]){delete _0x5c3b0a[_0x3c0c('0x27')];}_0x4a89bf[_0x3c0c('0x1a')](_0x4abb72)[_0x3c0c('0x28')](_0x5c3b0a);};}exports['index']=function(_0x100423,_0x1960bb){var _0x12bd0b={},_0xae22e1={},_0x5bbfcd={'count':0x0,'rows':[]};var _0x11a206=db['UserProfile'][_0x3c0c('0x29')];_0xae22e1[_0x3c0c('0x2a')]=_[_0x3c0c('0x2b')](_0x11a206);_0xae22e1['query']=_[_0x3c0c('0x2b')](_0x100423['query']);_0xae22e1['filters']=_[_0x3c0c('0x2c')](_0xae22e1[_0x3c0c('0x2a')],_0xae22e1[_0x3c0c('0x2d')]);_0x12bd0b[_0x3c0c('0x2e')]=_[_0x3c0c('0x2c')](_0xae22e1[_0x3c0c('0x2a')],qs[_0x3c0c('0x2f')](_0x100423[_0x3c0c('0x2d')]['fields']));_0x12bd0b[_0x3c0c('0x2e')]=_0x12bd0b[_0x3c0c('0x2e')]['length']?_0x12bd0b[_0x3c0c('0x2e')]:_0xae22e1[_0x3c0c('0x2a')];if(!_0x100423[_0x3c0c('0x2d')][_0x3c0c('0x30')](_0x3c0c('0x31'))){_0x12bd0b[_0x3c0c('0x1d')]=qs[_0x3c0c('0x1d')](_0x100423[_0x3c0c('0x2d')][_0x3c0c('0x1d')]);_0x12bd0b['offset']=qs[_0x3c0c('0x1c')](_0x100423[_0x3c0c('0x2d')][_0x3c0c('0x1c')]);}_0x12bd0b[_0x3c0c('0x32')]=qs['sort'](_0x100423[_0x3c0c('0x2d')][_0x3c0c('0x33')]);_0x12bd0b['where']=qs[_0x3c0c('0x34')](_['pick'](_0x100423[_0x3c0c('0x2d')],_0xae22e1[_0x3c0c('0x34')]));if(_0x100423['query'][_0x3c0c('0x35')]){_0x12bd0b[_0x3c0c('0x36')]=_[_0x3c0c('0x37')](_0x12bd0b['where'],{'$or':_[_0x3c0c('0x38')](_0x11a206,function(_0x2e0da3){if(_0x2e0da3['type'][_0x3c0c('0x39')]!==_0x3c0c('0x3a')){var _0x1befe7={};_0x1befe7[_0x2e0da3['field']]={'$like':'%'+_0x100423[_0x3c0c('0x2d')][_0x3c0c('0x35')]+'%'};return _0x1befe7;}})});}_0x12bd0b=_[_0x3c0c('0x37')]({},_0x12bd0b,_0x100423[_0x3c0c('0x3b')]);var _0x5a9395={'where':_0x12bd0b[_0x3c0c('0x36')]};return db[_0x3c0c('0x3c')][_0x3c0c('0x3d')](_0x5a9395)[_0x3c0c('0x22')](function(_0xb2cb1f){_0x5bbfcd[_0x3c0c('0x3d')]=_0xb2cb1f;if(_0x100423[_0x3c0c('0x2d')]['includeAll']){_0x12bd0b[_0x3c0c('0x3e')]=[{'all':!![]}];}return db[_0x3c0c('0x3c')][_0x3c0c('0x3f')](_0x12bd0b);})[_0x3c0c('0x22')](function(_0x10bd22){_0x5bbfcd[_0x3c0c('0x40')]=_0x10bd22;return _0x5bbfcd;})[_0x3c0c('0x22')](respondWithFilteredResult(_0x1960bb,_0x12bd0b))[_0x3c0c('0x41')](handleError(_0x1960bb,null));};exports['show']=function(_0x3510c6,_0x48b582){var _0xce611a={'raw':![],'where':{'id':_0x3510c6[_0x3c0c('0x42')]['id']}},_0x583007={};_0x583007[_0x3c0c('0x2a')]=_[_0x3c0c('0x2b')](db[_0x3c0c('0x3c')][_0x3c0c('0x29')]);_0x583007[_0x3c0c('0x2d')]=_[_0x3c0c('0x2b')](_0x3510c6[_0x3c0c('0x2d')]);_0x583007[_0x3c0c('0x34')]=_[_0x3c0c('0x2c')](_0x583007['model'],_0x583007['query']);_0xce611a[_0x3c0c('0x2e')]=_[_0x3c0c('0x2c')](_0x583007[_0x3c0c('0x2a')],qs[_0x3c0c('0x2f')](_0x3510c6[_0x3c0c('0x2d')][_0x3c0c('0x2f')]));_0xce611a['attributes']=_0xce611a[_0x3c0c('0x2e')]['length']?_0xce611a[_0x3c0c('0x2e')]:_0x583007[_0x3c0c('0x2a')];if(_0x3510c6[_0x3c0c('0x2d')]['includeAll']){_0xce611a['include']=[{'all':!![]}];}_0xce611a=_[_0x3c0c('0x37')]({},_0xce611a,_0x3510c6['options']);return db['UserProfile'][_0x3c0c('0x43')](_0xce611a)[_0x3c0c('0x22')](handleEntityNotFound(_0x48b582,null))['then'](respondWithResult(_0x48b582,null))[_0x3c0c('0x41')](handleError(_0x48b582,null));};exports[_0x3c0c('0x44')]=function(_0x253881,_0xc70e7e){return db[_0x3c0c('0x3c')][_0x3c0c('0x44')](_0x253881[_0x3c0c('0x45')],{})[_0x3c0c('0x22')](respondWithResult(_0xc70e7e,0xc9))[_0x3c0c('0x41')](handleError(_0xc70e7e,null));};exports['clone']=function(_0x35f42b,_0x27f484){var _0x2ba87c={'raw':![],'where':{'id':_0x35f42b[_0x3c0c('0x42')]['id']}},_0x2e0bdd={};_0x2e0bdd[_0x3c0c('0x2a')]=_[_0x3c0c('0x2b')](db[_0x3c0c('0x3c')][_0x3c0c('0x29')]);_0x2ba87c[_0x3c0c('0x2e')]=_[_0x3c0c('0x2c')](_0x2e0bdd[_0x3c0c('0x2a')],qs[_0x3c0c('0x2f')](_0x35f42b[_0x3c0c('0x2d')][_0x3c0c('0x2f')]));_0x2ba87c['attributes']=_0x2ba87c[_0x3c0c('0x2e')][_0x3c0c('0x46')]?_0x2ba87c[_0x3c0c('0x2e')]:_0x2e0bdd[_0x3c0c('0x2a')];if(_0x35f42b['query']['includeAll']){_0x2ba87c[_0x3c0c('0x3e')]=[{'all':!![]}];}_0x2ba87c=_[_0x3c0c('0x37')]({},_0x2ba87c,_0x35f42b[_0x3c0c('0x3b')]);return db[_0x3c0c('0x3c')][_0x3c0c('0x43')](_0x2ba87c)[_0x3c0c('0x22')](handleEntityNotFound(_0x27f484,null))[_0x3c0c('0x22')](function(_0x491826){if(_0x491826){var _0x67e43d=_0x491826[_0x3c0c('0x47')]({'plain':!![]});_0x67e43d=qs[_0x3c0c('0x48')](_0x67e43d,['id','createdAt',_0x3c0c('0x49'),_0x3c0c('0x4a')]);_0x35f42b[_0x3c0c('0x45')]=_['omit'](_0x35f42b[_0x3c0c('0x45')],['id','createdAt',_0x3c0c('0x49')]);return db[_0x3c0c('0x4b')][_0x3c0c('0x4c')](function(_0x3d7ee0){return db[_0x3c0c('0x3c')][_0x3c0c('0x44')](_[_0x3c0c('0x37')](_0x67e43d,_0x35f42b['body']),{'include':_0x35f42b[_0x3c0c('0x2d')][_0x3c0c('0x4d')]?[{'all':!![]}]:undefined,'transaction':_0x3d7ee0})[_0x3c0c('0x22')](function(_0x4303cb){var _0x523de4=_0x4303cb['get']({'plain':!![]});return db[_0x3c0c('0x4e')][_0x3c0c('0x3f')]({'where':{'userProfileId':_0x35f42b['params']['id']},'raw':!![]})['then'](function(_0x91798){if(_0x91798){return BPromise[_0x3c0c('0x4f')](_0x91798,function(_0x5aee8e){return new BPromise(function(_0x18d403,_0x33f015){if(_0x5aee8e[_0x3c0c('0x50')]===null||_0x5aee8e[_0x3c0c('0x50')]===0x1)_0x18d403(null);return db[_0x3c0c('0x51')][_0x3c0c('0x3f')]({'where':{'sectionId':_0x5aee8e['id']},'raw':!![]})[_0x3c0c('0x22')](function(_0x17483f){var _0x5dc4c5=_[_0x3c0c('0x38')](_0x17483f,function(_0x2fa6f6){return qs['omit'](_0x2fa6f6,['id',_0x3c0c('0x52'),'updatedAt',_0x3c0c('0x53')]);});_0x18d403(_0x5dc4c5);})[_0x3c0c('0x41')](function(_0x5f2fc1){_0x33f015(_0x5f2fc1);});})[_0x3c0c('0x22')](function(_0x503584){var _0x450639=qs['omit'](_0x5aee8e,['id',_0x3c0c('0x52'),_0x3c0c('0x49')]);_0x450639['userProfileId']=_0x523de4['id'];if(_0x503584)_0x450639[_0x3c0c('0x54')]=_0x503584;return _0x450639;})[_0x3c0c('0x22')](function(_0x2d2199){return db[_0x3c0c('0x4e')][_0x3c0c('0x44')](_0x2d2199,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x3d7ee0});});})[_0x3c0c('0x22')](function(){return _0x523de4;});}});});});}})[_0x3c0c('0x22')](respondWithResult(_0x27f484,0xc9))[_0x3c0c('0x41')](handleError(_0x27f484,null));};exports['update']=function(_0x164913,_0x3f9e07){if(_0x164913[_0x3c0c('0x45')]['id']){delete _0x164913[_0x3c0c('0x45')]['id'];}return db[_0x3c0c('0x3c')][_0x3c0c('0x43')]({'where':{'id':_0x164913[_0x3c0c('0x42')]['id']}})[_0x3c0c('0x22')](handleEntityNotFound(_0x3f9e07,null))['then'](saveUpdates(_0x164913[_0x3c0c('0x45')],null))[_0x3c0c('0x22')](respondWithResult(_0x3f9e07,null))['catch'](handleError(_0x3f9e07,null));};exports[_0x3c0c('0x23')]=function(_0x5802f2,_0x92dc22){return db['UserProfile'][_0x3c0c('0x43')]({'where':{'id':_0x5802f2[_0x3c0c('0x42')]['id']}})['then'](handleEntityNotFound(_0x92dc22,null))[_0x3c0c('0x22')](removeEntity(_0x92dc22,null))[_0x3c0c('0x41')](handleError(_0x92dc22,null));};exports[_0x3c0c('0x55')]=function(_0x5b2a60,_0x1363ed){return db[_0x3c0c('0x3c')][_0x3c0c('0x55')]()[_0x3c0c('0x22')](respondWithResult(_0x1363ed,null))['catch'](handleError(_0x1363ed,null));};exports[_0x3c0c('0x56')]=function(_0x104f9f,_0x22a807){var _0x34a4b2=_0x104f9f['body'];return db['UserProfile'][_0x3c0c('0x43')]({'where':{'id':_0x104f9f[_0x3c0c('0x42')]['id']}})[_0x3c0c('0x22')](handleEntityNotFound(_0x22a807,null))[_0x3c0c('0x22')](function(_0x54f72d){if(_0x54f72d){return db[_0x3c0c('0x4b')]['transaction'](function(_0x163440){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x104f9f[_0x3c0c('0x42')]['id'],'sectionId':_['map'](_0x34a4b2,function(_0x14fb4b){return _0x14fb4b[_0x3c0c('0x53')];})},'transaction':_0x163440})[_0x3c0c('0x22')](function(){var _0x1169af=_[_0x3c0c('0x38')](_0x34a4b2,function(_0x51bdc8){_0x51bdc8['userProfileId']=_0x104f9f[_0x3c0c('0x42')]['id'];return _0x51bdc8;});var _0x20d94f=[];return BPromise[_0x3c0c('0x4f')](_0x1169af,function(_0x283a69){return db[_0x3c0c('0x4e')][_0x3c0c('0x44')](_0x283a69,{'include':[{'model':db[_0x3c0c('0x51')],'as':_0x3c0c('0x54')}],'raw':!![],'transaction':_0x163440})[_0x3c0c('0x22')](function(_0x146efd){_0x20d94f[_0x3c0c('0x57')](_0x146efd['get']({'plain':!![]}));});})[_0x3c0c('0x22')](function(){return _0x20d94f;});});});}})[_0x3c0c('0x22')](function(_0x2c5974){return _0x2c5974;})[_0x3c0c('0x22')](respondWithResult(_0x22a807,null))[_0x3c0c('0x41')](handleError(_0x22a807,null));};exports[_0x3c0c('0x58')]=function(_0x493741,_0x4f3c7d){var _0x5c3e83;return db[_0x3c0c('0x3c')]['find']({'where':{'id':_0x493741[_0x3c0c('0x42')]['id']},'attributes':['id',_0x3c0c('0x27')]})[_0x3c0c('0x22')](handleEntityNotFound(_0x4f3c7d,null))[_0x3c0c('0x22')](function(_0x597b3d){if(_0x597b3d){_0x5c3e83=_0x597b3d;return db[_0x3c0c('0x4e')][_0x3c0c('0x23')]({'where':{'userProfileId':_0x493741[_0x3c0c('0x42')]['id'],'sectionId':_0x493741['query'][_0x3c0c('0x59')]}});}})['then'](function(){return _0x5c3e83;})[_0x3c0c('0x22')](respondWithStatusCode(_0x4f3c7d,null))[_0x3c0c('0x41')](handleError(_0x4f3c7d,null));};exports[_0x3c0c('0x5a')]=function(_0x3dc342,_0xdf1b83){return db[_0x3c0c('0x3c')]['find']({'where':{'id':_0x3dc342[_0x3c0c('0x42')]['id']}})['then'](handleEntityNotFound(_0xdf1b83,null))[_0x3c0c('0x22')](function(_0x35084e){if(_0x35084e){return db['sequelize'][_0x3c0c('0x4c')](function(_0x4904ff){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x3dc342[_0x3c0c('0x42')]['id']},'attributes':['id'],'raw':!![]})[_0x3c0c('0x22')](function(_0x5e51cc){if(_0x5e51cc){return db[_0x3c0c('0x4e')][_0x3c0c('0x23')]({'where':{'userProfileId':_0x3dc342['params']['id'],'id':_[_0x3c0c('0x38')](_0x5e51cc,function(_0x9d1e62){return _0x9d1e62['id'];})},'transaction':_0x4904ff});}})[_0x3c0c('0x22')](function(_0x5d01a8){var _0xa54497=_[_0x3c0c('0x38')](_0x3dc342[_0x3c0c('0x45')],function(_0x5d87f7){_0x5d87f7[_0x3c0c('0x5b')]=_0x3dc342[_0x3c0c('0x42')]['id'];return _0x5d87f7;});return db[_0x3c0c('0x4e')]['bulkCreate'](_0xa54497,{'raw':!![],'transaction':_0x4904ff});})[_0x3c0c('0x22')](function(_0x48473a){var _0x484c7b=_[_0x3c0c('0x35')](_[_0x3c0c('0x38')](_0x48473a,function(_0x5ea94a){return _0x5ea94a[_0x3c0c('0x47')]({'plain':!![]});}),{'includeAll':![]});if(_0x484c7b){return db[_0x3c0c('0x4e')][_0x3c0c('0x3f')]({'where':{'userProfileId':_0x3dc342[_0x3c0c('0x42')]['id'],'sectionId':_[_0x3c0c('0x38')](_0x484c7b,function(_0x54e63b){return _0x54e63b[_0x3c0c('0x53')];})},'attributes':['id',_0x3c0c('0x53')],'raw':!![]})[_0x3c0c('0x22')](function(_0x575156){var _0x1ab756=_[_0x3c0c('0x38')](_0x3dc342[_0x3c0c('0x45')],function(_0x469e10){_0x469e10[_0x3c0c('0x5b')]=_0x3dc342[_0x3c0c('0x42')]['id'];return _0x469e10;});return db[_0x3c0c('0x51')][_0x3c0c('0x5c')](_0x1ab756,{'raw':!![],'transaction':_0x4904ff});});}})[_0x3c0c('0x41')](handleError(_0xdf1b83,null));});}})['then'](function(_0x43ade1){var _0x283b82=_[_0x3c0c('0x38')](_0x43ade1,function(_0x472f28){return _0x472f28[_0x3c0c('0x47')]({'plain':!![]});});})[_0x3c0c('0x22')](respondWithResult(_0xdf1b83,null))['catch'](handleError(_0xdf1b83,null));};exports[_0x3c0c('0x5d')]=function(_0xe9db1f,_0x253a0f,_0x2587b0){var _0x443f6f;return db[_0x3c0c('0x3c')][_0x3c0c('0x43')]({'where':{'id':_0xe9db1f['params']['id']}})[_0x3c0c('0x22')](handleEntityNotFound(_0x253a0f,null))['then'](function(_0x12472c){if(_0x12472c){return _0x12472c[_0x3c0c('0x5d')](_0xe9db1f[_0x3c0c('0x2d')]['ids']);}})['then'](respondWithStatusCode(_0x253a0f,null))['catch'](handleError(_0x253a0f,null));};exports[_0x3c0c('0x5e')]=function(_0x4deb23,_0x512bb7){var _0x5138a3={'raw':![],'where':{}};var _0x4cdbde={};var _0xad9c49={'count':0x0,'rows':[]};var _0x33a9f9=_0x4deb23[_0x3c0c('0x2d')][_0x3c0c('0x5f')];if(typeof _0x33a9f9===_0x3c0c('0x60')){throw new db[(_0x3c0c('0x61'))][(_0x3c0c('0x62'))](_0x3c0c('0x63'));}var _0xacd24e=_0x4deb23[_0x3c0c('0x2d')][_0x3c0c('0x64')]||![];var _0x133deb=getQueryModels(_0x33a9f9,_0xacd24e);if(typeof _0x133deb['childModel']===_0x3c0c('0x60')){throw new db['Sequelize'][(_0x3c0c('0x62'))](_0x3c0c('0x65')+_0x33a9f9+'\x27');}var _0x56897f=[];if(!_['isEmpty'](_0x133deb['parentSections'])){_0x56897f=_0x133deb['parentSections'];}else{_0x56897f=[{'name':_0x33a9f9}];}return db['UserProfile']['findOne']({'where':{'id':_0x4deb23['params']['id']}})['then'](handleEntityNotFound(_0x512bb7,null))[_0x3c0c('0x22')](function(_0x4b86b7){if(_0x4b86b7){var _0xf6a7b7=[];for(var _0x1135aa=0x0;_0x1135aa<_0x56897f[_0x3c0c('0x46')];_0x1135aa++){_0xf6a7b7[_0x3c0c('0x57')](db[_0x3c0c('0x4e')][_0x3c0c('0x66')]({'where':{'userProfileId':_0x4b86b7['id'],'name':_0x56897f[_0x1135aa]['name']},'raw':!![]}));}return BPromise[_0x3c0c('0x67')](_0xf6a7b7);}})[_0x3c0c('0x22')](function(_0x31d4e6){var _0x139416=_[_0x3c0c('0x35')](_0x31d4e6,function(_0x4251bc){return _0x4251bc?_0x4251bc:undefined;});var _0x1619c2=_[_0x3c0c('0x35')](_0x56897f,[_0x3c0c('0x68'),!![]]);var _0x4f0d0d=_[_0x3c0c('0x69')](_0x139416)&&_[_0x3c0c('0x69')](_0x1619c2)?null:_['union'](_0x1619c2,_0x139416);if(_0x4f0d0d){var _0x2a281d=[];for(var _0x168470=0x0;_0x168470<_0x4f0d0d[_0x3c0c('0x46')];_0x168470++){var _0x33349f=_[_0x3c0c('0x43')](_0x56897f,function(_0x5010b7){return _0x4f0d0d[_0x168470]?_0x5010b7[_0x3c0c('0x27')]===_0x4f0d0d[_0x168470][_0x3c0c('0x27')]:null;});if(_0x33349f){if(_0x4f0d0d[_0x168470][_0x3c0c('0x68')]){_0x2a281d['push'](getAllResources(_0x133deb[_0x3c0c('0x6a')],_0x4f0d0d[_0x168470]));}else{if(!_0x4f0d0d[_0x168470][_0x3c0c('0x50')]){_0x2a281d[_0x3c0c('0x57')](getAllowedResources(_0x33349f,_0x4f0d0d[_0x168470]));}else{if(_0x33349f[_0x3c0c('0x2a')]){_0x2a281d[_0x3c0c('0x57')](getAllFilteredResources(_0x33349f,_0x4f0d0d[_0x168470]));}}}}}return BPromise['all'](_0x2a281d);}else{return null;}})[_0x3c0c('0x22')](function(_0x2dfac6){var _0x5b385a=_0x2dfac6;var _0x5da06a=null;if(_0x5b385a){_0x5da06a=_0x5b385a[_0x3c0c('0x46')]===0x1?_0x5b385a[0x0]:null;}if(_0x5da06a||_0x5b385a){var _0x15790a=db[_0x133deb[_0x3c0c('0x6a')]][_0x3c0c('0x29')];_0x4cdbde[_0x3c0c('0x2a')]=_['keys'](_0x15790a);_0x4cdbde[_0x3c0c('0x2d')]=_[_0x3c0c('0x2b')](_0x4deb23['query']);_0x4cdbde[_0x3c0c('0x34')]=_[_0x3c0c('0x2c')](_0x4cdbde[_0x3c0c('0x2a')],_0x4cdbde['query']);_0x5138a3['attributes']=_[_0x3c0c('0x2c')](_0x4cdbde[_0x3c0c('0x2a')],qs[_0x3c0c('0x2f')](_0x4deb23[_0x3c0c('0x2d')][_0x3c0c('0x2f')]));_0x5138a3['attributes']=_0x5138a3[_0x3c0c('0x2e')][_0x3c0c('0x46')]?_0x5138a3['attributes']:_0x4cdbde[_0x3c0c('0x2a')];if(!_0x4deb23['query'][_0x3c0c('0x30')](_0x3c0c('0x31'))){_0x5138a3[_0x3c0c('0x1d')]=qs[_0x3c0c('0x1d')](_0x4deb23[_0x3c0c('0x2d')]['limit']);_0x5138a3[_0x3c0c('0x1c')]=qs[_0x3c0c('0x1c')](_0x4deb23[_0x3c0c('0x2d')]['offset']);}_0x5138a3[_0x3c0c('0x32')]=qs['sort'](_0x4deb23[_0x3c0c('0x2d')][_0x3c0c('0x33')]);_0x5138a3[_0x3c0c('0x36')]=qs[_0x3c0c('0x34')](_[_0x3c0c('0x6b')](_0x4deb23['query'],_0x4cdbde[_0x3c0c('0x34')]));var _0x1ed604=[];if(_0x5da06a){var _0x1d9555=_['find'](_0x56897f,[_0x3c0c('0x27'),_0x5da06a[_0x3c0c('0x27')]]);if(_0x1d9555[_0x3c0c('0x6c')]){var _0x319039={};_0x319039[_0x1d9555[_0x3c0c('0x6d')]]=_0x5da06a['resourceFields'];_0x1ed604[_0x3c0c('0x57')](_0x319039);}else{_0x5138a3['where']['id']=_0x5da06a[_0x3c0c('0x6e')];}}else{var _0x1ed604=[];for(var _0x72cbe2=0x0;_0x72cbe2<_0x5b385a[_0x3c0c('0x46')];_0x72cbe2++){var _0x1d9555=_[_0x3c0c('0x43')](_0x56897f,['name',_0x5b385a[_0x72cbe2][_0x3c0c('0x27')]]);if(_0x1d9555['field']){var _0x319039={};if(_0x1d9555[_0x3c0c('0x6c')]==='id'){_0x319039[_0x1d9555[_0x3c0c('0x6d')]]=_0x5b385a[_0x72cbe2][_0x3c0c('0x6e')];}else{_0x319039[_0x1d9555[_0x3c0c('0x6d')]]=_0x5b385a[_0x72cbe2][_0x3c0c('0x6f')];}_0x1ed604[_0x3c0c('0x57')](_0x319039);}else{if(!_0x5138a3[_0x3c0c('0x36')]['id'])_0x5138a3['where']['id']=[];_0x5b385a[_0x72cbe2][_0x3c0c('0x6e')][_0x3c0c('0x70')](function(_0x5bb145){_0x5138a3[_0x3c0c('0x36')]['id']['push'](_0x5bb145);});}}}if(!_[_0x3c0c('0x69')](_0x1ed604)){_0x5138a3[_0x3c0c('0x36')]=_[_0x3c0c('0x37')](_0x5138a3['where'],{'$or':_0x1ed604});}if(_0x4deb23['query'][_0x3c0c('0x35')]){_0x5138a3[_0x3c0c('0x36')]=_['merge'](_0x5138a3[_0x3c0c('0x36')],{'$or':_[_0x3c0c('0x38')](_0x15790a,function(_0x493341){if(_0x493341[_0x3c0c('0x71')][_0x3c0c('0x39')]!=='VIRTUAL'){var _0x1056f8={};_0x1056f8[_0x493341[_0x3c0c('0x6c')]]={'$like':'%'+_0x4deb23[_0x3c0c('0x2d')][_0x3c0c('0x35')]+'%'};return _0x1056f8;}})});}_0x5138a3=_[_0x3c0c('0x37')]({},_0x5138a3,_0x4deb23[_0x3c0c('0x3b')]);if(_0x5da06a&&!_0x5da06a['autoAssociation']&&_0x133deb['childModel']===_0x3c0c('0x72')){if(_0x4deb23[_0x3c0c('0x2d')]['includeAll']){_0x5138a3[_0x3c0c('0x3e')]=[{'all':!![]}];}return db[_0x133deb[_0x3c0c('0x6a')]]['findAll'](_0x5138a3)[_0x3c0c('0x22')](function(_0x248c19){var _0x39c46=[];_0x248c19[_0x3c0c('0x70')](function(_0x4ba8ed){var _0x192299;switch(_0x4ba8ed['reportType']){case _0x3c0c('0x73'):_0x192299=_[_0x3c0c('0x43')](_0x5da06a['resourceIds'],function(_0x45f88f){return _0x45f88f['id']===_0x4ba8ed[_0x3c0c('0x74')]&&_0x45f88f[_0x3c0c('0x71')]===_0x3c0c('0x75');});break;case _0x3c0c('0x76'):_0x192299=_[_0x3c0c('0x43')](_0x5da06a['resourceIds'],function(_0x3428c2){return _0x3428c2['id']===_0x4ba8ed[_0x3c0c('0x74')]&&_0x3428c2['type']==='CustomReports';});break;}if(_0x192299)_0x39c46[_0x3c0c('0x57')](_0x4ba8ed);});_0xad9c49['count']=_0x39c46[_0x3c0c('0x46')];_0xad9c49[_0x3c0c('0x40')]=_0x39c46;return _0xad9c49;});}else{return db[_0x133deb[_0x3c0c('0x6a')]][_0x3c0c('0x3d')]({'where':_0x5138a3[_0x3c0c('0x36')]})[_0x3c0c('0x22')](function(_0x28d455){_0xad9c49[_0x3c0c('0x3d')]=_0x28d455;if(_0x4deb23[_0x3c0c('0x2d')][_0x3c0c('0x4d')]){if(_0x133deb[_0x3c0c('0x6a')]===_0x3c0c('0x77')){_0x5138a3[_0x3c0c('0x3e')]=[{'model':db['Tag'],'as':_0x3c0c('0x78'),'attributes':['id','name','color'],'required':_0x4deb23[_0x3c0c('0x2d')][_0x3c0c('0x79')]?!![]:![]},{'model':db[_0x3c0c('0x7a')],'as':_0x3c0c('0x7b'),'attributes':['id',_0x3c0c('0x27'),_0x3c0c('0x7c')],'through':_0x4deb23[_0x3c0c('0x2d')]['tag']?{'attributes':[],'where':{'TagId':_0x4deb23[_0x3c0c('0x2d')][_0x3c0c('0x79')]||undefined}}:{},'required':_0x4deb23[_0x3c0c('0x2d')][_0x3c0c('0x79')]?!![]:![]}];}else{_0x5138a3[_0x3c0c('0x3e')]=[{'all':!![]}];}}return db[_0x133deb[_0x3c0c('0x6a')]][_0x3c0c('0x3f')](_0x5138a3);})[_0x3c0c('0x22')](function(_0x1b7fcc){_0xad9c49[_0x3c0c('0x40')]=_0x1b7fcc;return _0xad9c49;});}}else{return _0xad9c49;}})[_0x3c0c('0x22')](respondWithFilteredResult(_0x512bb7,_0x5138a3))[_0x3c0c('0x41')](handleError(_0x512bb7,null));};function getAllResources(_0x31dd2e,_0xdda0e){return new BPromise(function(_0x56c70f,_0x4bafe8){if(_0xdda0e){var _0x4f805b=_0xdda0e[_0x3c0c('0x35')]?{[_0xdda0e[_0x3c0c('0x35')]['field']]:_0xdda0e[_0x3c0c('0x35')][_0x3c0c('0x7d')]}:undefined;return db[_0x31dd2e][_0x3c0c('0x3f')]({'where':_0x4f805b,'raw':!![]})['then'](function(_0x3ea730){_0xdda0e['resourceIds']=_[_0x3c0c('0x38')](_0x3ea730,'id');_0x56c70f(_0xdda0e);})['catch'](function(_0x18930e){_0x4bafe8(_0x18930e);});}else{_0x56c70f(null);}});}function getAllFilteredResources(_0x39540a,_0x31a0fd){return new BPromise(function(_0x2e551a,_0x53e141){var _0x373948=_0x39540a[_0x3c0c('0x35')]?{[_0x39540a[_0x3c0c('0x35')][_0x3c0c('0x6c')]]:_0x39540a['filter']['value']}:undefined;return db[_0x39540a[_0x3c0c('0x2a')]][_0x3c0c('0x3f')]({'where':_0x373948,'raw':!![]})['then'](function(_0x10451b){_0x31a0fd[_0x3c0c('0x6f')]=_[_0x3c0c('0x38')](_0x10451b,function(_0x5a8874){return _0x5a8874[_0x3c0c('0x27')];});_0x2e551a(_0x31a0fd);})[_0x3c0c('0x41')](function(_0x3aa3da){_0x53e141(_0x3aa3da);});});}function getAllowedResources(_0x4f73bc,_0x991cb0){return new BPromise(function(_0x3e1d47,_0x3df8fa){if(_0x991cb0){return db['UserProfileResource'][_0x3c0c('0x3f')]({'where':{'sectionId':_0x991cb0['id']},'raw':!![]})[_0x3c0c('0x22')](function(_0x3d1a19){if(_0x4f73bc[_0x3c0c('0x6c')]&&_0x4f73bc['field']!=='id'){_0x991cb0['resourceFields']=_[_0x3c0c('0x38')](_0x3d1a19,function(_0x1badd0){return _0x1badd0[_0x4f73bc['field']];});}else{if(_0x4f73bc['childModel']===_0x3c0c('0x72')){_0x991cb0[_0x3c0c('0x6e')]=_['map'](_0x3d1a19,function(_0x3d6744){return{'id':_0x3d6744[_0x3c0c('0x7e')],'type':_0x3d6744[_0x3c0c('0x71')]};});}else{_0x991cb0[_0x3c0c('0x6e')]=_[_0x3c0c('0x38')](_0x3d1a19,function(_0x2b2cdb){return _0x2b2cdb[_0x3c0c('0x7e')];});}}_0x3e1d47(_0x991cb0);})[_0x3c0c('0x41')](function(_0x54b5b3){_0x3df8fa(_0x54b5b3);});}else{_0x3e1d47(null);}});}function getQueryModels(_0x260c6d,_0x3afdc8){var _0x4a9354=_0x260c6d[_0x3c0c('0x7f')]();var _0x3ca022={'childModel':undefined,'parentSections':[]};switch(_0x4a9354){case _0x3c0c('0x80'):_0x3ca022['childModel']=_0x3c0c('0x81');break;case _0x3c0c('0x82'):_0x3ca022['childModel']=_0x3c0c('0x83');break;case _0x3c0c('0x84'):_0x3ca022[_0x3c0c('0x6a')]=_0x3c0c('0x85');_0x3ca022[_0x3c0c('0x86')]=[{'name':_0x3c0c('0x87'),'field':_0x3c0c('0x27'),'foreignKey':_0x3c0c('0x88')}];break;case _0x3c0c('0x89'):_0x3ca022[_0x3c0c('0x6a')]='JscriptyProject';break;case'contacts':_0x3ca022['childModel']=_0x3c0c('0x77');_0x3ca022[_0x3c0c('0x86')]=[{'name':'Lists','field':'id','foreignKey':_0x3c0c('0x8a')}];break;case _0x3c0c('0x8b'):_0x3ca022[_0x3c0c('0x6a')]=_0x3c0c('0x8c');break;case _0x3c0c('0x8d'):_0x3ca022[_0x3c0c('0x6a')]=_0x3c0c('0x8e');break;case'globalcustomfields':_0x3ca022[_0x3c0c('0x6a')]='CmCustomField';break;case'chatqueues':_0x3ca022[_0x3c0c('0x6a')]=_0x3c0c('0x8f');break;case _0x3c0c('0x90'):_0x3ca022[_0x3c0c('0x6a')]='ChatWebsite';break;case _0x3c0c('0x91'):_0x3ca022[_0x3c0c('0x6a')]=_0x3c0c('0x92');break;case _0x3c0c('0x93'):_0x3ca022[_0x3c0c('0x6a')]=_0x3c0c('0x94');break;case _0x3c0c('0x95'):case _0x3c0c('0x96'):case _0x3c0c('0x97'):_0x3ca022[_0x3c0c('0x6a')]=_0x3c0c('0x98');break;case _0x3c0c('0x99'):_0x3ca022[_0x3c0c('0x6a')]=_0x3c0c('0x9a');break;case _0x3c0c('0x9b'):_0x3ca022[_0x3c0c('0x6a')]=_0x3c0c('0x9c');break;case _0x3c0c('0x9d'):_0x3ca022[_0x3c0c('0x6a')]=_0x3c0c('0x9e');_0x3ca022[_0x3c0c('0x86')]=[{'name':_0x3c0c('0x9f'),'field':_0x3c0c('0x27'),'foreignKey':_0x3c0c('0xa0'),'model':_0x3c0c('0xa1'),'filter':{'field':'role','value':[_0x3c0c('0xa2')]}},{'name':_0x3c0c('0xa3'),'field':_0x3c0c('0x27'),'foreignKey':_0x3c0c('0xa0'),'model':_0x3c0c('0xa1'),'filter':{'field':_0x3c0c('0xa4'),'value':[_0x3c0c('0xa5')]}},{'name':_0x3c0c('0xa6'),'field':_0x3c0c('0x27'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x3c0c('0x71'),'value':['inbound']}},{'name':_0x3c0c('0xa7'),'field':'name','foreignKey':_0x3c0c('0xa8'),'model':_0x3c0c('0xa9'),'filter':{'field':_0x3c0c('0x71'),'value':[_0x3c0c('0xaa')]}}];break;case _0x3c0c('0xab'):_0x3ca022[_0x3c0c('0x6a')]=_0x3c0c('0xac');break;case _0x3c0c('0xad'):_0x3ca022['childModel']=_0x3c0c('0xae');break;case'voiceprefixes':_0x3ca022['childModel']=_0x3c0c('0xaf');break;case _0x3c0c('0xb0'):_0x3ca022[_0x3c0c('0x6a')]=_0x3c0c('0xb1');break;case _0x3c0c('0xb2'):_0x3ca022[_0x3c0c('0x6a')]=_0x3c0c('0xb3');break;case _0x3c0c('0xb4'):_0x3ca022['childModel']=_0x3c0c('0xb5');break;case _0x3c0c('0xb6'):_0x3ca022[_0x3c0c('0x6a')]='MailSubstatus';break;case _0x3c0c('0xb7'):_0x3ca022[_0x3c0c('0x6a')]=_0x3c0c('0xb8');break;case _0x3c0c('0xb9'):_0x3ca022['childModel']='OpenchannelAccount';break;case _0x3c0c('0xba'):_0x3ca022[_0x3c0c('0x6a')]=_0x3c0c('0xbb');break;case _0x3c0c('0xbc'):_0x3ca022[_0x3c0c('0x6a')]=_0x3c0c('0xbd');break;case _0x3c0c('0xbe'):_0x3ca022[_0x3c0c('0x6a')]=_0x3c0c('0xbf');break;case _0x3c0c('0xc0'):case _0x3c0c('0xc1'):_0x3ca022['childModel']='VoiceQueue';if(_0x3afdc8){_0x3ca022[_0x3c0c('0x86')]=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case _0x3c0c('0xc2'):case'agents':case'telephones':_0x3ca022['childModel']=_0x3c0c('0xa1');if(_0x3afdc8){_0x3ca022[_0x3c0c('0x86')]=[{'name':_0x3c0c('0xc3'),'filter':{'field':'role','value':[_0x3c0c('0xc4'),'user']},'ignore':!![]},{'name':_0x3c0c('0x9f')},{'name':_0x3c0c('0xa3')}];}break;case _0x3c0c('0xc5'):_0x3ca022['childModel']=_0x3c0c('0xc6');break;case _0x3c0c('0xc7'):_0x3ca022[_0x3c0c('0x6a')]='SalesforceAccount';break;case _0x3c0c('0xc8'):_0x3ca022[_0x3c0c('0x6a')]='FreshdeskAccount';break;case _0x3c0c('0xc9'):_0x3ca022[_0x3c0c('0x6a')]=_0x3c0c('0xca');break;case _0x3c0c('0xcb'):_0x3ca022['childModel']=_0x3c0c('0xcc');break;case _0x3c0c('0xcd'):_0x3ca022[_0x3c0c('0x6a')]=_0x3c0c('0xce');break;case _0x3c0c('0xcf'):_0x3ca022[_0x3c0c('0x6a')]='User';break;case'cannedanswers':_0x3ca022[_0x3c0c('0x6a')]='CannedAnswer';break;case _0x3c0c('0xd0'):_0x3ca022[_0x3c0c('0x6a')]=_0x3c0c('0xd1');break;case _0x3c0c('0xd2'):_0x3ca022['childModel']=_0x3c0c('0xd3');break;case _0x3c0c('0xd4'):_0x3ca022[_0x3c0c('0x6a')]=_0x3c0c('0xd5');break;case _0x3c0c('0xd6'):_0x3ca022[_0x3c0c('0x6a')]=_0x3c0c('0xd7');break;case'scheduler':_0x3ca022[_0x3c0c('0x6a')]=_0x3c0c('0xd8');break;case _0x3c0c('0xd9'):_0x3ca022['childModel']=_0x3c0c('0xda');break;case _0x3c0c('0xdb'):_0x3ca022[_0x3c0c('0x6a')]=_0x3c0c('0x7a');break;case _0x3c0c('0xdc'):_0x3ca022[_0x3c0c('0x6a')]=_0x3c0c('0xdd');break;case'triggers':_0x3ca022[_0x3c0c('0x6a')]=_0x3c0c('0xde');break;case _0x3c0c('0xdf'):_0x3ca022[_0x3c0c('0x6a')]='Trunk';break;case'variables':_0x3ca022[_0x3c0c('0x6a')]=_0x3c0c('0xe0');break;case _0x3c0c('0xe1'):_0x3ca022[_0x3c0c('0x6a')]=_0x3c0c('0xe2');break;case'extractedreports':_0x3ca022[_0x3c0c('0x6a')]=_0x3c0c('0x72');_0x3ca022[_0x3c0c('0x86')]=[{'name':_0x3c0c('0xe3'),'field':'id','foreignKey':_0x3c0c('0x74')}];break;case _0x3c0c('0xe4'):_0x3ca022[_0x3c0c('0x6a')]='AnalyticMetric';break;default:return _0x3ca022;}return _0x3ca022;}
\ No newline at end of file
+var _0x28ab=['SmsAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','sounds','Sound','Template','triggers','Trigger','trunks','Trunk','variables','Variable','Plugin','extractedreports','Reports','metrics','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../mysqldb','redis','defaults','./userProfile.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','sendStatus','error','stack','name','send','index','UserProfile','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','key','VIRTUAL','field','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','get','createdAt','crudPermissions','omit','updatedAt','UserProfileSection','each','autoAssociation','UserProfileResource','map','sectionId','userProfileId','Resources','describe','addSections','sequelize','transaction','push','removeSections','ids','addResources','bulkCreate','removeResources','getResources','section','undefined','Sequelize','mergeResources','childModel','Invalid\x20section\x20\x27','isEmpty','parentSections','findOne','all','filter','ignore','union','pick','resourceFields','resourceIds','foreignKey','forEach','reportType','reportId','DefaultReports','custom','CustomReports','CmContact','Tag','Tags','tag','ThroughTags','color','value','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','SquareProject','SquareOdbc','SquareRecording','projectName','projects','contacts','ListId','lists','CmList','CmCompany','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','User','role','Telephones','telephone','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','SmsQueue','smsaccounts'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x28ab,0x1f3));var _0xb28a=function(_0x58fab8,_0x206884){_0x58fab8=_0x58fab8-0x0;var _0x42110a=_0x28ab[_0x58fab8];return _0x42110a;};'use strict';var pdf=require(_0xb28a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb28a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb28a('0x2'));var rp=require(_0xb28a('0x3'));var moment=require(_0xb28a('0x4'));var BPromise=require(_0xb28a('0x5'));var Mustache=require('mustache');var util=require(_0xb28a('0x6'));var path=require('path');var sox=require(_0xb28a('0x7'));var csv=require(_0xb28a('0x8'));var ejs=require(_0xb28a('0x9'));var fs=require('fs');var _=require(_0xb28a('0xa'));var squel=require(_0xb28a('0xb'));var crypto=require(_0xb28a('0xc'));var jsforce=require(_0xb28a('0xd'));var deskjs=require(_0xb28a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb28a('0xf'));var Papa=require(_0xb28a('0x10'));var authService=require(_0xb28a('0x11'));var hardwareService=require(_0xb28a('0x12'));var Redis=require(_0xb28a('0x13'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xb28a('0x14'))['db'];config[_0xb28a('0x15')]=_[_0xb28a('0x16')](config[_0xb28a('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb28a('0x15')]));require(_0xb28a('0x17'))[_0xb28a('0x18')](socket);function respondWithStatusCode(_0x53eb2d,_0x3435a8){_0x3435a8=_0x3435a8||0xcc;return function(_0x161e04){if(_0x161e04){return _0x53eb2d['sendStatus'](_0x3435a8);}return _0x53eb2d[_0xb28a('0x19')](_0x3435a8)[_0xb28a('0x1a')]();};}function respondWithResult(_0x348862,_0x51e331){_0x51e331=_0x51e331||0xc8;return function(_0x577e40){if(_0x577e40){return _0x348862['status'](_0x51e331)[_0xb28a('0x1b')](_0x577e40);}};}function respondWithFilteredResult(_0x34ae3e,_0x2609dc){return function(_0x57053b){if(_0x57053b){var _0x3d186a=_0x57053b[_0xb28a('0x1c')],_0x316d65=_0x2609dc[_0xb28a('0x1d')],_0x340bf3=_0x2609dc[_0xb28a('0x1d')]+_0x2609dc[_0xb28a('0x1e')],_0x1f08cf;if(_0x340bf3>=_0x3d186a){_0x340bf3=_0x3d186a;_0x1f08cf=0xc8;}else{_0x1f08cf=0xce;}_0x34ae3e[_0xb28a('0x19')](_0x1f08cf);return _0x34ae3e[_0xb28a('0x1f')](_0xb28a('0x20'),_0x316d65+'-'+_0x340bf3+'/'+_0x3d186a)[_0xb28a('0x1b')](_0x57053b);}return null;};}function patchUpdates(_0x3d7819){return function(_0x46512e){try{jsonpatch[_0xb28a('0x21')](_0x46512e,_0x3d7819,!![]);}catch(_0x13212d){return BPromise['reject'](_0x13212d);}return _0x46512e['save']();};}function saveUpdates(_0x4f417d,_0x5cef18){return function(_0x570e7d){if(_0x570e7d){return _0x570e7d[_0xb28a('0x22')](_0x4f417d)[_0xb28a('0x23')](function(_0x345a15){return _0x345a15;});}return null;};}function removeEntity(_0x175256,_0x3ae708){return function(_0x65b795){if(_0x65b795){return _0x65b795[_0xb28a('0x24')]()['then'](function(){_0x175256[_0xb28a('0x19')](0xcc)[_0xb28a('0x1a')]();});}};}function handleEntityNotFound(_0x56bc5a,_0x36e8e2){return function(_0x1291fd){if(!_0x1291fd){_0x56bc5a[_0xb28a('0x25')](0x194);}return _0x1291fd;};}function handleError(_0x3b1de4,_0x9fa13f){_0x9fa13f=_0x9fa13f||0x1f4;return function(_0x55d078){logger[_0xb28a('0x26')](_0x55d078[_0xb28a('0x27')]);if(_0x55d078['name']){delete _0x55d078[_0xb28a('0x28')];}_0x3b1de4[_0xb28a('0x19')](_0x9fa13f)[_0xb28a('0x29')](_0x55d078);};}exports[_0xb28a('0x2a')]=function(_0x4fb8f8,_0x29e934){var _0x1c8452={},_0x1f15e9={},_0x21dc3e={'count':0x0,'rows':[]};var _0x41daf2=db[_0xb28a('0x2b')][_0xb28a('0x2c')];_0x1f15e9[_0xb28a('0x2d')]=_[_0xb28a('0x2e')](_0x41daf2);_0x1f15e9[_0xb28a('0x2f')]=_[_0xb28a('0x2e')](_0x4fb8f8['query']);_0x1f15e9[_0xb28a('0x30')]=_[_0xb28a('0x31')](_0x1f15e9[_0xb28a('0x2d')],_0x1f15e9[_0xb28a('0x2f')]);_0x1c8452[_0xb28a('0x32')]=_['intersection'](_0x1f15e9[_0xb28a('0x2d')],qs[_0xb28a('0x33')](_0x4fb8f8[_0xb28a('0x2f')][_0xb28a('0x33')]));_0x1c8452[_0xb28a('0x32')]=_0x1c8452[_0xb28a('0x32')][_0xb28a('0x34')]?_0x1c8452[_0xb28a('0x32')]:_0x1f15e9['model'];if(!_0x4fb8f8[_0xb28a('0x2f')][_0xb28a('0x35')](_0xb28a('0x36'))){_0x1c8452[_0xb28a('0x1e')]=qs[_0xb28a('0x1e')](_0x4fb8f8[_0xb28a('0x2f')][_0xb28a('0x1e')]);_0x1c8452[_0xb28a('0x1d')]=qs[_0xb28a('0x1d')](_0x4fb8f8[_0xb28a('0x2f')][_0xb28a('0x1d')]);}_0x1c8452[_0xb28a('0x37')]=qs[_0xb28a('0x38')](_0x4fb8f8[_0xb28a('0x2f')]['sort']);_0x1c8452[_0xb28a('0x39')]=qs[_0xb28a('0x30')](_['pick'](_0x4fb8f8[_0xb28a('0x2f')],_0x1f15e9[_0xb28a('0x30')]));if(_0x4fb8f8[_0xb28a('0x2f')]['filter']){_0x1c8452[_0xb28a('0x39')]=_[_0xb28a('0x3a')](_0x1c8452['where'],{'$or':_['map'](_0x41daf2,function(_0x259fff){if(_0x259fff[_0xb28a('0x3b')][_0xb28a('0x3c')]!==_0xb28a('0x3d')){var _0xda8f39={};_0xda8f39[_0x259fff[_0xb28a('0x3e')]]={'$like':'%'+_0x4fb8f8[_0xb28a('0x2f')]['filter']+'%'};return _0xda8f39;}})});}_0x1c8452=_[_0xb28a('0x3a')]({},_0x1c8452,_0x4fb8f8[_0xb28a('0x3f')]);var _0x2fcbdc={'where':_0x1c8452['where']};return db['UserProfile'][_0xb28a('0x1c')](_0x2fcbdc)[_0xb28a('0x23')](function(_0x34fd48){_0x21dc3e['count']=_0x34fd48;if(_0x4fb8f8[_0xb28a('0x2f')][_0xb28a('0x40')]){_0x1c8452['include']=[{'all':!![]}];}return db[_0xb28a('0x2b')][_0xb28a('0x41')](_0x1c8452);})[_0xb28a('0x23')](function(_0x4a0bab){_0x21dc3e[_0xb28a('0x42')]=_0x4a0bab;return _0x21dc3e;})['then'](respondWithFilteredResult(_0x29e934,_0x1c8452))[_0xb28a('0x43')](handleError(_0x29e934,null));};exports[_0xb28a('0x44')]=function(_0x1720ed,_0x1ace65){var _0x15cc9c={'raw':![],'where':{'id':_0x1720ed[_0xb28a('0x45')]['id']}},_0x11e0cb={};_0x11e0cb[_0xb28a('0x2d')]=_[_0xb28a('0x2e')](db[_0xb28a('0x2b')][_0xb28a('0x2c')]);_0x11e0cb['query']=_[_0xb28a('0x2e')](_0x1720ed[_0xb28a('0x2f')]);_0x11e0cb['filters']=_['intersection'](_0x11e0cb[_0xb28a('0x2d')],_0x11e0cb[_0xb28a('0x2f')]);_0x15cc9c[_0xb28a('0x32')]=_[_0xb28a('0x31')](_0x11e0cb[_0xb28a('0x2d')],qs[_0xb28a('0x33')](_0x1720ed[_0xb28a('0x2f')][_0xb28a('0x33')]));_0x15cc9c[_0xb28a('0x32')]=_0x15cc9c[_0xb28a('0x32')][_0xb28a('0x34')]?_0x15cc9c['attributes']:_0x11e0cb[_0xb28a('0x2d')];if(_0x1720ed[_0xb28a('0x2f')][_0xb28a('0x40')]){_0x15cc9c[_0xb28a('0x46')]=[{'all':!![]}];}_0x15cc9c=_['merge']({},_0x15cc9c,_0x1720ed[_0xb28a('0x3f')]);return db[_0xb28a('0x2b')][_0xb28a('0x47')](_0x15cc9c)[_0xb28a('0x23')](handleEntityNotFound(_0x1ace65,null))[_0xb28a('0x23')](respondWithResult(_0x1ace65,null))['catch'](handleError(_0x1ace65,null));};exports[_0xb28a('0x48')]=function(_0x377abc,_0xc438b){return db[_0xb28a('0x2b')][_0xb28a('0x48')](_0x377abc[_0xb28a('0x49')],{})[_0xb28a('0x23')](respondWithResult(_0xc438b,0xc9))[_0xb28a('0x43')](handleError(_0xc438b,null));};exports['clone']=function(_0x4bf3da,_0x12b5b5){var _0x5469e3={'raw':![],'where':{'id':_0x4bf3da[_0xb28a('0x45')]['id']}},_0x9e618d={};_0x9e618d['model']=_[_0xb28a('0x2e')](db['UserProfile'][_0xb28a('0x2c')]);_0x5469e3[_0xb28a('0x32')]=_[_0xb28a('0x31')](_0x9e618d[_0xb28a('0x2d')],qs[_0xb28a('0x33')](_0x4bf3da[_0xb28a('0x2f')]['fields']));_0x5469e3[_0xb28a('0x32')]=_0x5469e3['attributes'][_0xb28a('0x34')]?_0x5469e3[_0xb28a('0x32')]:_0x9e618d[_0xb28a('0x2d')];if(_0x4bf3da['query']['includeAll']){_0x5469e3[_0xb28a('0x46')]=[{'all':!![]}];}_0x5469e3=_['merge']({},_0x5469e3,_0x4bf3da['options']);return db[_0xb28a('0x2b')][_0xb28a('0x47')](_0x5469e3)[_0xb28a('0x23')](handleEntityNotFound(_0x12b5b5,null))[_0xb28a('0x23')](function(_0x7078bc){if(_0x7078bc){var _0x2f34e7=_0x7078bc[_0xb28a('0x4a')]({'plain':!![]});_0x2f34e7=qs['omit'](_0x2f34e7,['id',_0xb28a('0x4b'),'updatedAt',_0xb28a('0x4c')]);_0x4bf3da['body']=_[_0xb28a('0x4d')](_0x4bf3da['body'],['id',_0xb28a('0x4b'),_0xb28a('0x4e')]);return db['sequelize']['transaction'](function(_0x149a7f){return db[_0xb28a('0x2b')][_0xb28a('0x48')](_[_0xb28a('0x3a')](_0x2f34e7,_0x4bf3da[_0xb28a('0x49')]),{'include':_0x4bf3da[_0xb28a('0x2f')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x149a7f})[_0xb28a('0x23')](function(_0xc69250){var _0xafed13=_0xc69250['get']({'plain':!![]});return db[_0xb28a('0x4f')][_0xb28a('0x41')]({'where':{'userProfileId':_0x4bf3da[_0xb28a('0x45')]['id']},'raw':!![]})['then'](function(_0x24c1d7){if(_0x24c1d7){return BPromise[_0xb28a('0x50')](_0x24c1d7,function(_0xa376d3){return new BPromise(function(_0x521f17,_0x328842){if(_0xa376d3[_0xb28a('0x51')]===null||_0xa376d3[_0xb28a('0x51')]===0x1)_0x521f17(null);return db[_0xb28a('0x52')][_0xb28a('0x41')]({'where':{'sectionId':_0xa376d3['id']},'raw':!![]})[_0xb28a('0x23')](function(_0x12f8fd){var _0x53166d=_[_0xb28a('0x53')](_0x12f8fd,function(_0x47cf1f){return qs[_0xb28a('0x4d')](_0x47cf1f,['id',_0xb28a('0x4b'),_0xb28a('0x4e'),_0xb28a('0x54')]);});_0x521f17(_0x53166d);})[_0xb28a('0x43')](function(_0x4aaf6c){_0x328842(_0x4aaf6c);});})['then'](function(_0x293feb){var _0x2d707e=qs[_0xb28a('0x4d')](_0xa376d3,['id','createdAt',_0xb28a('0x4e')]);_0x2d707e[_0xb28a('0x55')]=_0xafed13['id'];if(_0x293feb)_0x2d707e[_0xb28a('0x56')]=_0x293feb;return _0x2d707e;})[_0xb28a('0x23')](function(_0x54c2ea){return db[_0xb28a('0x4f')][_0xb28a('0x48')](_0x54c2ea,{'include':[{'model':db[_0xb28a('0x52')],'as':_0xb28a('0x56')}],'raw':!![],'transaction':_0x149a7f});});})['then'](function(){return _0xafed13;});}});});});}})[_0xb28a('0x23')](respondWithResult(_0x12b5b5,0xc9))[_0xb28a('0x43')](handleError(_0x12b5b5,null));};exports[_0xb28a('0x22')]=function(_0x3c31c2,_0x3b49ed){if(_0x3c31c2[_0xb28a('0x49')]['id']){delete _0x3c31c2['body']['id'];}return db[_0xb28a('0x2b')][_0xb28a('0x47')]({'where':{'id':_0x3c31c2[_0xb28a('0x45')]['id']}})[_0xb28a('0x23')](handleEntityNotFound(_0x3b49ed,null))[_0xb28a('0x23')](saveUpdates(_0x3c31c2[_0xb28a('0x49')],null))['then'](respondWithResult(_0x3b49ed,null))[_0xb28a('0x43')](handleError(_0x3b49ed,null));};exports[_0xb28a('0x24')]=function(_0x641ac3,_0x3032ca){return db[_0xb28a('0x2b')][_0xb28a('0x47')]({'where':{'id':_0x641ac3['params']['id']}})[_0xb28a('0x23')](handleEntityNotFound(_0x3032ca,null))['then'](removeEntity(_0x3032ca,null))['catch'](handleError(_0x3032ca,null));};exports[_0xb28a('0x57')]=function(_0x5b3254,_0x2822ed){return db[_0xb28a('0x2b')][_0xb28a('0x57')]()[_0xb28a('0x23')](respondWithResult(_0x2822ed,null))[_0xb28a('0x43')](handleError(_0x2822ed,null));};exports[_0xb28a('0x58')]=function(_0x44f071,_0x370736){var _0x4cce28=_0x44f071[_0xb28a('0x49')];return db['UserProfile'][_0xb28a('0x47')]({'where':{'id':_0x44f071[_0xb28a('0x45')]['id']}})[_0xb28a('0x23')](handleEntityNotFound(_0x370736,null))[_0xb28a('0x23')](function(_0x45301e){if(_0x45301e){return db[_0xb28a('0x59')][_0xb28a('0x5a')](function(_0x2cce3c){return db[_0xb28a('0x4f')][_0xb28a('0x24')]({'where':{'userProfileId':_0x44f071['params']['id'],'sectionId':_[_0xb28a('0x53')](_0x4cce28,function(_0x303f69){return _0x303f69[_0xb28a('0x54')];})},'transaction':_0x2cce3c})[_0xb28a('0x23')](function(){var _0x167b43=_['map'](_0x4cce28,function(_0xb88e41){_0xb88e41['userProfileId']=_0x44f071[_0xb28a('0x45')]['id'];return _0xb88e41;});var _0x9d0661=[];return BPromise[_0xb28a('0x50')](_0x167b43,function(_0x30172a){return db[_0xb28a('0x4f')][_0xb28a('0x48')](_0x30172a,{'include':[{'model':db[_0xb28a('0x52')],'as':_0xb28a('0x56')}],'raw':!![],'transaction':_0x2cce3c})[_0xb28a('0x23')](function(_0x5dc324){_0x9d0661[_0xb28a('0x5b')](_0x5dc324[_0xb28a('0x4a')]({'plain':!![]}));});})[_0xb28a('0x23')](function(){return _0x9d0661;});});});}})[_0xb28a('0x23')](function(_0x1609db){return _0x1609db;})['then'](respondWithResult(_0x370736,null))[_0xb28a('0x43')](handleError(_0x370736,null));};exports[_0xb28a('0x5c')]=function(_0x3f5f81,_0x268e28){var _0x3e7d27;return db['UserProfile'][_0xb28a('0x47')]({'where':{'id':_0x3f5f81['params']['id']},'attributes':['id','name']})[_0xb28a('0x23')](handleEntityNotFound(_0x268e28,null))[_0xb28a('0x23')](function(_0xbc5298){if(_0xbc5298){_0x3e7d27=_0xbc5298;return db[_0xb28a('0x4f')]['destroy']({'where':{'userProfileId':_0x3f5f81['params']['id'],'sectionId':_0x3f5f81[_0xb28a('0x2f')][_0xb28a('0x5d')]}});}})[_0xb28a('0x23')](function(){return _0x3e7d27;})[_0xb28a('0x23')](respondWithStatusCode(_0x268e28,null))[_0xb28a('0x43')](handleError(_0x268e28,null));};exports[_0xb28a('0x5e')]=function(_0x4f4f82,_0x317a49){return db[_0xb28a('0x2b')][_0xb28a('0x47')]({'where':{'id':_0x4f4f82['params']['id']}})[_0xb28a('0x23')](handleEntityNotFound(_0x317a49,null))[_0xb28a('0x23')](function(_0x55c55b){if(_0x55c55b){return db[_0xb28a('0x59')][_0xb28a('0x5a')](function(_0x4e6657){return db[_0xb28a('0x4f')]['findAll']({'where':{'userProfileId':_0x4f4f82[_0xb28a('0x45')]['id']},'attributes':['id'],'raw':!![]})[_0xb28a('0x23')](function(_0x55d183){if(_0x55d183){return db[_0xb28a('0x4f')][_0xb28a('0x24')]({'where':{'userProfileId':_0x4f4f82[_0xb28a('0x45')]['id'],'id':_['map'](_0x55d183,function(_0x26d355){return _0x26d355['id'];})},'transaction':_0x4e6657});}})['then'](function(_0x50c946){var _0x460e76=_[_0xb28a('0x53')](_0x4f4f82[_0xb28a('0x49')],function(_0x535396){_0x535396[_0xb28a('0x55')]=_0x4f4f82[_0xb28a('0x45')]['id'];return _0x535396;});return db['UserProfileSection'][_0xb28a('0x5f')](_0x460e76,{'raw':!![],'transaction':_0x4e6657});})[_0xb28a('0x23')](function(_0x54d40a){var _0x286a15=_['filter'](_[_0xb28a('0x53')](_0x54d40a,function(_0x11f9e0){return _0x11f9e0[_0xb28a('0x4a')]({'plain':!![]});}),{'includeAll':![]});if(_0x286a15){return db[_0xb28a('0x4f')]['findAll']({'where':{'userProfileId':_0x4f4f82['params']['id'],'sectionId':_['map'](_0x286a15,function(_0xa70b85){return _0xa70b85[_0xb28a('0x54')];})},'attributes':['id',_0xb28a('0x54')],'raw':!![]})[_0xb28a('0x23')](function(_0x3fb817){var _0x2f9dc5=_[_0xb28a('0x53')](_0x4f4f82[_0xb28a('0x49')],function(_0x74ea52){_0x74ea52['userProfileId']=_0x4f4f82[_0xb28a('0x45')]['id'];return _0x74ea52;});return db['UserProfileResource'][_0xb28a('0x5f')](_0x2f9dc5,{'raw':!![],'transaction':_0x4e6657});});}})[_0xb28a('0x43')](handleError(_0x317a49,null));});}})['then'](function(_0x26e85e){var _0xa0d0c1=_['map'](_0x26e85e,function(_0x141524){return _0x141524[_0xb28a('0x4a')]({'plain':!![]});});})[_0xb28a('0x23')](respondWithResult(_0x317a49,null))['catch'](handleError(_0x317a49,null));};exports[_0xb28a('0x60')]=function(_0x4bcd1a,_0x486021,_0x526448){var _0x5deb9b;return db['UserProfile'][_0xb28a('0x47')]({'where':{'id':_0x4bcd1a[_0xb28a('0x45')]['id']}})[_0xb28a('0x23')](handleEntityNotFound(_0x486021,null))[_0xb28a('0x23')](function(_0x2199d0){if(_0x2199d0){return _0x2199d0[_0xb28a('0x60')](_0x4bcd1a[_0xb28a('0x2f')][_0xb28a('0x5d')]);}})[_0xb28a('0x23')](respondWithStatusCode(_0x486021,null))['catch'](handleError(_0x486021,null));};exports[_0xb28a('0x61')]=function(_0x2cc834,_0x4a80b2){var _0x38b8bc={'raw':![],'where':{}};var _0x2fd8cb={};var _0x35c4e2={'count':0x0,'rows':[]};var _0x5386c9=_0x2cc834[_0xb28a('0x2f')][_0xb28a('0x62')];if(typeof _0x5386c9===_0xb28a('0x63')){throw new db[(_0xb28a('0x64'))]['ValidationError']('Unknown\x20section');}var _0x5ddb7d=_0x2cc834[_0xb28a('0x2f')][_0xb28a('0x65')]||![];var _0xd6fe64=getQueryModels(_0x5386c9,_0x5ddb7d);if(typeof _0xd6fe64[_0xb28a('0x66')]===_0xb28a('0x63')){throw new db[(_0xb28a('0x64'))]['ValidationError'](_0xb28a('0x67')+_0x5386c9+'\x27');}var _0x2b214b=[];if(!_[_0xb28a('0x68')](_0xd6fe64[_0xb28a('0x69')])){_0x2b214b=_0xd6fe64[_0xb28a('0x69')];}else{_0x2b214b=[{'name':_0x5386c9}];}return db['UserProfile'][_0xb28a('0x6a')]({'where':{'id':_0x2cc834[_0xb28a('0x45')]['id']}})[_0xb28a('0x23')](handleEntityNotFound(_0x4a80b2,null))['then'](function(_0x3d796c){if(_0x3d796c){var _0x22955c=[];for(var _0x4541a1=0x0;_0x4541a1<_0x2b214b[_0xb28a('0x34')];_0x4541a1++){_0x22955c[_0xb28a('0x5b')](db[_0xb28a('0x4f')]['findOne']({'where':{'userProfileId':_0x3d796c['id'],'name':_0x2b214b[_0x4541a1][_0xb28a('0x28')]},'raw':!![]}));}return BPromise[_0xb28a('0x6b')](_0x22955c);}})[_0xb28a('0x23')](function(_0x56751e){var _0x3f6e7b=_[_0xb28a('0x6c')](_0x56751e,function(_0x5ed6ed){return _0x5ed6ed?_0x5ed6ed:undefined;});var _0x28bdb5=_[_0xb28a('0x6c')](_0x2b214b,[_0xb28a('0x6d'),!![]]);var _0x2a6431=_[_0xb28a('0x68')](_0x3f6e7b)&&_['isEmpty'](_0x28bdb5)?null:_[_0xb28a('0x6e')](_0x28bdb5,_0x3f6e7b);if(_0x2a6431){var _0x4ac42b=[];for(var _0x2e133d=0x0;_0x2e133d<_0x2a6431[_0xb28a('0x34')];_0x2e133d++){var _0x4606c7=_['find'](_0x2b214b,function(_0x4b708d){return _0x2a6431[_0x2e133d]?_0x4b708d['name']===_0x2a6431[_0x2e133d][_0xb28a('0x28')]:null;});if(_0x4606c7){if(_0x2a6431[_0x2e133d][_0xb28a('0x6d')]){_0x4ac42b['push'](getAllResources(_0xd6fe64['childModel'],_0x2a6431[_0x2e133d]));}else{if(!_0x2a6431[_0x2e133d][_0xb28a('0x51')]){_0x4ac42b[_0xb28a('0x5b')](getAllowedResources(_0x4606c7,_0x2a6431[_0x2e133d]));}else{if(_0x4606c7[_0xb28a('0x2d')]){_0x4ac42b[_0xb28a('0x5b')](getAllFilteredResources(_0x4606c7,_0x2a6431[_0x2e133d]));}}}}}return BPromise[_0xb28a('0x6b')](_0x4ac42b);}else{return null;}})[_0xb28a('0x23')](function(_0x47093b){var _0x4a51dc=_0x47093b;var _0x296fec=null;if(_0x4a51dc){_0x296fec=_0x4a51dc['length']===0x1?_0x4a51dc[0x0]:null;}if(_0x296fec||_0x4a51dc){var _0x8d24e5=db[_0xd6fe64[_0xb28a('0x66')]][_0xb28a('0x2c')];_0x2fd8cb[_0xb28a('0x2d')]=_[_0xb28a('0x2e')](_0x8d24e5);_0x2fd8cb[_0xb28a('0x2f')]=_[_0xb28a('0x2e')](_0x2cc834['query']);_0x2fd8cb[_0xb28a('0x30')]=_['intersection'](_0x2fd8cb[_0xb28a('0x2d')],_0x2fd8cb['query']);_0x38b8bc[_0xb28a('0x32')]=_['intersection'](_0x2fd8cb[_0xb28a('0x2d')],qs[_0xb28a('0x33')](_0x2cc834[_0xb28a('0x2f')][_0xb28a('0x33')]));_0x38b8bc[_0xb28a('0x32')]=_0x38b8bc['attributes'][_0xb28a('0x34')]?_0x38b8bc[_0xb28a('0x32')]:_0x2fd8cb['model'];if(!_0x2cc834['query']['hasOwnProperty'](_0xb28a('0x36'))){_0x38b8bc[_0xb28a('0x1e')]=qs[_0xb28a('0x1e')](_0x2cc834['query'][_0xb28a('0x1e')]);_0x38b8bc[_0xb28a('0x1d')]=qs[_0xb28a('0x1d')](_0x2cc834[_0xb28a('0x2f')][_0xb28a('0x1d')]);}_0x38b8bc[_0xb28a('0x37')]=qs[_0xb28a('0x38')](_0x2cc834['query'][_0xb28a('0x38')]);_0x38b8bc[_0xb28a('0x39')]=qs[_0xb28a('0x30')](_[_0xb28a('0x6f')](_0x2cc834[_0xb28a('0x2f')],_0x2fd8cb['filters']));var _0x2d70c7=[];if(_0x296fec){var _0x29a001=_['find'](_0x2b214b,[_0xb28a('0x28'),_0x296fec['name']]);if(_0x29a001[_0xb28a('0x3e')]){var _0xc2c1b1={};_0xc2c1b1[_0x29a001['foreignKey']]=_0x296fec[_0xb28a('0x70')];_0x2d70c7[_0xb28a('0x5b')](_0xc2c1b1);}else{_0x38b8bc[_0xb28a('0x39')]['id']=_0x296fec[_0xb28a('0x71')];}}else{var _0x2d70c7=[];for(var _0x47e0a9=0x0;_0x47e0a9<_0x4a51dc[_0xb28a('0x34')];_0x47e0a9++){var _0x29a001=_[_0xb28a('0x47')](_0x2b214b,[_0xb28a('0x28'),_0x4a51dc[_0x47e0a9]['name']]);if(_0x29a001[_0xb28a('0x3e')]){var _0xc2c1b1={};if(_0x29a001['field']==='id'){_0xc2c1b1[_0x29a001['foreignKey']]=_0x4a51dc[_0x47e0a9][_0xb28a('0x71')];}else{_0xc2c1b1[_0x29a001[_0xb28a('0x72')]]=_0x4a51dc[_0x47e0a9][_0xb28a('0x70')];}_0x2d70c7[_0xb28a('0x5b')](_0xc2c1b1);}else{if(!_0x38b8bc[_0xb28a('0x39')]['id'])_0x38b8bc['where']['id']=[];_0x4a51dc[_0x47e0a9][_0xb28a('0x71')][_0xb28a('0x73')](function(_0x521e0c){_0x38b8bc['where']['id']['push'](_0x521e0c);});}}}if(!_['isEmpty'](_0x2d70c7)){_0x38b8bc[_0xb28a('0x39')]=_[_0xb28a('0x3a')](_0x38b8bc['where'],{'$or':_0x2d70c7});}if(_0x2cc834[_0xb28a('0x2f')][_0xb28a('0x6c')]){_0x38b8bc['where']=_[_0xb28a('0x3a')](_0x38b8bc[_0xb28a('0x39')],{'$or':_[_0xb28a('0x53')](_0x8d24e5,function(_0x12493c){if(_0x12493c[_0xb28a('0x3b')][_0xb28a('0x3c')]!==_0xb28a('0x3d')){var _0x522adf={};_0x522adf[_0x12493c[_0xb28a('0x3e')]]={'$like':'%'+_0x2cc834[_0xb28a('0x2f')][_0xb28a('0x6c')]+'%'};return _0x522adf;}})});}_0x38b8bc=_[_0xb28a('0x3a')]({},_0x38b8bc,_0x2cc834['options']);if(_0x296fec&&!_0x296fec['autoAssociation']&&_0xd6fe64[_0xb28a('0x66')]==='AnalyticExtractedReport'){if(_0x2cc834[_0xb28a('0x2f')][_0xb28a('0x40')]){_0x38b8bc['include']=[{'all':!![]}];}return db[_0xd6fe64[_0xb28a('0x66')]]['findAll'](_0x38b8bc)[_0xb28a('0x23')](function(_0x506bb0){var _0x22cd13=[];_0x506bb0[_0xb28a('0x73')](function(_0x342f41){var _0xc063d0;switch(_0x342f41[_0xb28a('0x74')]){case'default':_0xc063d0=_[_0xb28a('0x47')](_0x296fec[_0xb28a('0x71')],function(_0x369dfd){return _0x369dfd['id']===_0x342f41[_0xb28a('0x75')]&&_0x369dfd[_0xb28a('0x3b')]===_0xb28a('0x76');});break;case _0xb28a('0x77'):_0xc063d0=_[_0xb28a('0x47')](_0x296fec[_0xb28a('0x71')],function(_0x5c6fd8){return _0x5c6fd8['id']===_0x342f41[_0xb28a('0x75')]&&_0x5c6fd8['type']===_0xb28a('0x78');});break;}if(_0xc063d0)_0x22cd13[_0xb28a('0x5b')](_0x342f41);});_0x35c4e2[_0xb28a('0x1c')]=_0x22cd13[_0xb28a('0x34')];_0x35c4e2[_0xb28a('0x42')]=_0x22cd13;return _0x35c4e2;});}else{return db[_0xd6fe64[_0xb28a('0x66')]][_0xb28a('0x1c')]({'where':_0x38b8bc[_0xb28a('0x39')]})['then'](function(_0x2dca39){_0x35c4e2[_0xb28a('0x1c')]=_0x2dca39;if(_0x2cc834['query'][_0xb28a('0x40')]){if(_0xd6fe64[_0xb28a('0x66')]===_0xb28a('0x79')){_0x38b8bc[_0xb28a('0x46')]=[{'model':db[_0xb28a('0x7a')],'as':_0xb28a('0x7b'),'attributes':['id','name','color'],'required':_0x2cc834[_0xb28a('0x2f')][_0xb28a('0x7c')]?!![]:![]},{'model':db[_0xb28a('0x7a')],'as':_0xb28a('0x7d'),'attributes':['id','name',_0xb28a('0x7e')],'through':_0x2cc834['query']['tag']?{'attributes':[],'where':{'TagId':_0x2cc834[_0xb28a('0x2f')][_0xb28a('0x7c')]||undefined}}:{},'required':_0x2cc834[_0xb28a('0x2f')][_0xb28a('0x7c')]?!![]:![]}];}else{_0x38b8bc['include']=[{'all':!![]}];}}return db[_0xd6fe64[_0xb28a('0x66')]][_0xb28a('0x41')](_0x38b8bc);})[_0xb28a('0x23')](function(_0x45396b){_0x35c4e2[_0xb28a('0x42')]=_0x45396b;return _0x35c4e2;});}}else{return _0x35c4e2;}})[_0xb28a('0x23')](respondWithFilteredResult(_0x4a80b2,_0x38b8bc))[_0xb28a('0x43')](handleError(_0x4a80b2,null));};function getAllResources(_0x4d9f72,_0x3caab5){return new BPromise(function(_0x5222cd,_0x37e0a2){if(_0x3caab5){var _0xd75974=_0x3caab5[_0xb28a('0x6c')]?{[_0x3caab5['filter']['field']]:_0x3caab5['filter']['value']}:undefined;return db[_0x4d9f72]['findAll']({'where':_0xd75974,'raw':!![]})[_0xb28a('0x23')](function(_0x6b3dc1){_0x3caab5[_0xb28a('0x71')]=_['map'](_0x6b3dc1,'id');_0x5222cd(_0x3caab5);})[_0xb28a('0x43')](function(_0x594cd2){_0x37e0a2(_0x594cd2);});}else{_0x5222cd(null);}});}function getAllFilteredResources(_0x4ded08,_0x1e14fd){return new BPromise(function(_0x4de193,_0x3bdd7e){var _0xbf3f80=_0x4ded08[_0xb28a('0x6c')]?{[_0x4ded08[_0xb28a('0x6c')][_0xb28a('0x3e')]]:_0x4ded08[_0xb28a('0x6c')][_0xb28a('0x7f')]}:undefined;return db[_0x4ded08[_0xb28a('0x2d')]][_0xb28a('0x41')]({'where':_0xbf3f80,'raw':!![]})[_0xb28a('0x23')](function(_0x4b44ec){_0x1e14fd[_0xb28a('0x70')]=_[_0xb28a('0x53')](_0x4b44ec,function(_0x38de99){return _0x38de99[_0xb28a('0x28')];});_0x4de193(_0x1e14fd);})[_0xb28a('0x43')](function(_0x3ed91c){_0x3bdd7e(_0x3ed91c);});});}function getAllowedResources(_0x2153ef,_0x1ea82c){return new BPromise(function(_0x251da2,_0x5f5bb7){if(_0x1ea82c){return db[_0xb28a('0x52')][_0xb28a('0x41')]({'where':{'sectionId':_0x1ea82c['id']},'raw':!![]})['then'](function(_0x32346e){if(_0x2153ef[_0xb28a('0x3e')]&&_0x2153ef[_0xb28a('0x3e')]!=='id'){_0x1ea82c['resourceFields']=_[_0xb28a('0x53')](_0x32346e,function(_0x4a407f){return _0x4a407f[_0x2153ef[_0xb28a('0x3e')]];});}else{if(_0x2153ef[_0xb28a('0x66')]===_0xb28a('0x80')){_0x1ea82c[_0xb28a('0x71')]=_[_0xb28a('0x53')](_0x32346e,function(_0x560146){return{'id':_0x560146[_0xb28a('0x81')],'type':_0x560146[_0xb28a('0x3b')]};});}else{_0x1ea82c[_0xb28a('0x71')]=_[_0xb28a('0x53')](_0x32346e,function(_0x3572fb){return _0x3572fb[_0xb28a('0x81')];});}}_0x251da2(_0x1ea82c);})[_0xb28a('0x43')](function(_0x6a675a){_0x5f5bb7(_0x6a675a);});}else{_0x251da2(null);}});}function getQueryModels(_0x4c49f1,_0x266d17){var _0x445f12=_0x4c49f1[_0xb28a('0x82')]();var _0x462f4f={'childModel':undefined,'parentSections':[]};switch(_0x445f12){case _0xb28a('0x83'):_0x462f4f[_0xb28a('0x66')]=_0xb28a('0x84');break;case'odbc':_0x462f4f[_0xb28a('0x66')]=_0xb28a('0x85');break;case'squarerecordings':_0x462f4f[_0xb28a('0x66')]=_0xb28a('0x86');_0x462f4f[_0xb28a('0x69')]=[{'name':'SquareProjects','field':_0xb28a('0x28'),'foreignKey':_0xb28a('0x87')}];break;case _0xb28a('0x88'):_0x462f4f[_0xb28a('0x66')]='JscriptyProject';break;case _0xb28a('0x89'):_0x462f4f[_0xb28a('0x66')]=_0xb28a('0x79');_0x462f4f[_0xb28a('0x69')]=[{'name':'Lists','field':'id','foreignKey':_0xb28a('0x8a')}];break;case _0xb28a('0x8b'):_0x462f4f[_0xb28a('0x66')]=_0xb28a('0x8c');break;case'companies':_0x462f4f[_0xb28a('0x66')]=_0xb28a('0x8d');break;case _0xb28a('0x8e'):_0x462f4f[_0xb28a('0x66')]='CmCustomField';break;case _0xb28a('0x8f'):_0x462f4f[_0xb28a('0x66')]=_0xb28a('0x90');break;case _0xb28a('0x91'):_0x462f4f[_0xb28a('0x66')]=_0xb28a('0x92');break;case'faxqueues':_0x462f4f[_0xb28a('0x66')]=_0xb28a('0x93');break;case _0xb28a('0x94'):_0x462f4f[_0xb28a('0x66')]=_0xb28a('0x95');break;case _0xb28a('0x96'):case _0xb28a('0x97'):case'outboundroutes':_0x462f4f[_0xb28a('0x66')]=_0xb28a('0x98');break;case _0xb28a('0x99'):_0x462f4f[_0xb28a('0x66')]=_0xb28a('0x9a');break;case _0xb28a('0x9b'):_0x462f4f[_0xb28a('0x66')]=_0xb28a('0x9c');break;case _0xb28a('0x9d'):_0x462f4f['childModel']=_0xb28a('0x9e');_0x462f4f[_0xb28a('0x69')]=[{'name':_0xb28a('0x9f'),'field':_0xb28a('0x28'),'foreignKey':'membername','model':_0xb28a('0xa0'),'filter':{'field':_0xb28a('0xa1'),'value':['agent']}},{'name':_0xb28a('0xa2'),'field':_0xb28a('0x28'),'foreignKey':'membername','model':_0xb28a('0xa0'),'filter':{'field':_0xb28a('0xa1'),'value':[_0xb28a('0xa3')]}},{'name':'VoiceQueues','field':_0xb28a('0x28'),'foreignKey':_0xb28a('0xa4'),'model':_0xb28a('0xa5'),'filter':{'field':_0xb28a('0x3b'),'value':[_0xb28a('0xa6')]}},{'name':_0xb28a('0xa7'),'field':_0xb28a('0x28'),'foreignKey':_0xb28a('0xa4'),'model':_0xb28a('0xa5'),'filter':{'field':'type','value':[_0xb28a('0xa8')]}}];break;case _0xb28a('0xa9'):_0x462f4f['childModel']='VoiceMusicOnHold';break;case _0xb28a('0xaa'):_0x462f4f[_0xb28a('0x66')]=_0xb28a('0xab');break;case _0xb28a('0xac'):_0x462f4f[_0xb28a('0x66')]=_0xb28a('0xad');break;case'ivrcampaigns':_0x462f4f[_0xb28a('0x66')]=_0xb28a('0xae');break;case _0xb28a('0xaf'):_0x462f4f['childModel']=_0xb28a('0xb0');break;case'mailaccounts':_0x462f4f[_0xb28a('0x66')]=_0xb28a('0xb1');break;case _0xb28a('0xb2'):_0x462f4f[_0xb28a('0x66')]=_0xb28a('0xb3');break;case _0xb28a('0xb4'):_0x462f4f['childModel']=_0xb28a('0xb5');break;case'openchannelaccounts':_0x462f4f[_0xb28a('0x66')]=_0xb28a('0xb6');break;case'smsqueues':_0x462f4f[_0xb28a('0x66')]=_0xb28a('0xb7');break;case _0xb28a('0xb8'):_0x462f4f['childModel']=_0xb28a('0xb9');break;case _0xb28a('0xba'):_0x462f4f[_0xb28a('0x66')]=_0xb28a('0xbb');break;case _0xb28a('0xbc'):case _0xb28a('0xbd'):_0x462f4f[_0xb28a('0x66')]=_0xb28a('0xa5');if(_0x266d17){_0x462f4f[_0xb28a('0x69')]=[{'name':'VoiceQueues'},{'name':_0xb28a('0xa7')}];}break;case _0xb28a('0xbe'):case _0xb28a('0xbf'):case _0xb28a('0xc0'):_0x462f4f[_0xb28a('0x66')]='User';if(_0x266d17){_0x462f4f[_0xb28a('0x69')]=[{'name':'Users','filter':{'field':_0xb28a('0xa1'),'value':['admin',_0xb28a('0xc1')]},'ignore':!![]},{'name':_0xb28a('0x9f')},{'name':_0xb28a('0xa2')}];}break;case _0xb28a('0xc2'):_0x462f4f['childModel']=_0xb28a('0xc3');break;case _0xb28a('0xc4'):_0x462f4f[_0xb28a('0x66')]=_0xb28a('0xc5');break;case'freshdeskaccounts':_0x462f4f[_0xb28a('0x66')]=_0xb28a('0xc6');break;case'sugarcrmaccounts':_0x462f4f[_0xb28a('0x66')]=_0xb28a('0xc7');break;case'deskaccounts':_0x462f4f[_0xb28a('0x66')]=_0xb28a('0xc8');break;case _0xb28a('0xc9'):_0x462f4f['childModel']=_0xb28a('0xca');break;case _0xb28a('0xcb'):_0x462f4f['childModel']='User';break;case _0xb28a('0xcc'):_0x462f4f[_0xb28a('0x66')]=_0xb28a('0xcd');break;case _0xb28a('0xce'):_0x462f4f[_0xb28a('0x66')]=_0xb28a('0xcf');break;case _0xb28a('0xd0'):_0x462f4f[_0xb28a('0x66')]=_0xb28a('0xd1');break;case _0xb28a('0xd2'):_0x462f4f[_0xb28a('0x66')]=_0xb28a('0xd3');break;case _0xb28a('0xd4'):_0x462f4f[_0xb28a('0x66')]=_0xb28a('0xd5');break;case _0xb28a('0xd6'):_0x462f4f[_0xb28a('0x66')]='Schedule';break;case _0xb28a('0xd7'):_0x462f4f[_0xb28a('0x66')]=_0xb28a('0xd8');break;case'tags':_0x462f4f[_0xb28a('0x66')]=_0xb28a('0x7a');break;case'templates':_0x462f4f[_0xb28a('0x66')]=_0xb28a('0xd9');break;case _0xb28a('0xda'):_0x462f4f[_0xb28a('0x66')]=_0xb28a('0xdb');break;case _0xb28a('0xdc'):_0x462f4f[_0xb28a('0x66')]=_0xb28a('0xdd');break;case _0xb28a('0xde'):_0x462f4f['childModel']=_0xb28a('0xdf');break;case'plugins':_0x462f4f[_0xb28a('0x66')]=_0xb28a('0xe0');break;case _0xb28a('0xe1'):_0x462f4f[_0xb28a('0x66')]='AnalyticExtractedReport';_0x462f4f['parentSections']=[{'name':_0xb28a('0xe2'),'field':'id','foreignKey':_0xb28a('0x75')}];break;case _0xb28a('0xe3'):_0x462f4f[_0xb28a('0x66')]='AnalyticMetric';break;default:return _0x462f4f;}return _0x462f4f;}
\ No newline at end of file
index cbef370..26dd880 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeb5d=['hook','exports','events','../../mysqldb','UserProfile','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x2ad9ed,_0x1e083b){var _0x526d09=function(_0x5c1951){while(--_0x5c1951){_0x2ad9ed['push'](_0x2ad9ed['shift']());}};_0x526d09(++_0x1e083b);}(_0xeb5d,0x174));var _0xdeb5=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xeb5d[_0x178e48];return _0x440d7e;};'use strict';var EventEmitter=require(_0xdeb5('0x0'));var UserProfile=require(_0xdeb5('0x1'))['db'][_0xdeb5('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xdeb5('0x3')](0x0);var events={'afterCreate':_0xdeb5('0x4'),'afterUpdate':'update','afterDestroy':_0xdeb5('0x5')};function emitEvent(_0x40456d){return function(_0x3a7a0d,_0x158500,_0x531731){UserProfileEvents[_0xdeb5('0x6')](_0x40456d+':'+_0x3a7a0d['id'],_0x3a7a0d);UserProfileEvents['emit'](_0x40456d,_0x3a7a0d);_0x531731(null);};}for(var e in events){if(events[_0xdeb5('0x7')](e)){var event=events[e];UserProfile[_0xdeb5('0x8')](e,emitEvent(event));}}module[_0xdeb5('0x9')]=UserProfileEvents;
\ No newline at end of file
+var _0x1939=['exports','events','UserProfile','setMaxListeners','save','remove','emit','hook'];(function(_0x529490,_0x3cb86c){var _0x568dbe=function(_0x2841cd){while(--_0x2841cd){_0x529490['push'](_0x529490['shift']());}};_0x568dbe(++_0x3cb86c);}(_0x1939,0x1d1));var _0x9193=function(_0x24529e,_0x20b864){_0x24529e=_0x24529e-0x0;var _0x4f37ba=_0x1939[_0x24529e];return _0x4f37ba;};'use strict';var EventEmitter=require(_0x9193('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x9193('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x9193('0x2')](0x0);var events={'afterCreate':_0x9193('0x3'),'afterUpdate':'update','afterDestroy':_0x9193('0x4')};function emitEvent(_0x4415e0){return function(_0x31aa3c,_0x35b1c4,_0x544579){UserProfileEvents[_0x9193('0x5')](_0x4415e0+':'+_0x31aa3c['id'],_0x31aa3c);UserProfileEvents[_0x9193('0x5')](_0x4415e0,_0x31aa3c);_0x544579(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x9193('0x6')](e,emitEvent(event));}}module[_0x9193('0x7')]=UserProfileEvents;
\ No newline at end of file
index 1da319d..03cb713 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb012=['define','UserProfile','lodash','../../config/logger','api','bluebird','request-promise','./userProfile.attributes','exports'];(function(_0x49fcfc,_0x104175){var _0x4ab162=function(_0x2fb28b){while(--_0x2fb28b){_0x49fcfc['push'](_0x49fcfc['shift']());}};_0x4ab162(++_0x104175);}(_0xb012,0x13d));var _0x2b01=function(_0x49dc43,_0x25d6d2){_0x49dc43=_0x49dc43-0x0;var _0x3e7d23=_0xb012[_0x49dc43];return _0x3e7d23;};'use strict';var _=require(_0x2b01('0x0'));var util=require('util');var logger=require(_0x2b01('0x1'))(_0x2b01('0x2'));var moment=require('moment');var BPromise=require(_0x2b01('0x3'));var rp=require(_0x2b01('0x4'));var attributes=require(_0x2b01('0x5'));module[_0x2b01('0x6')]=function(_0x3f3c8f,_0x331bdb){return _0x3f3c8f[_0x2b01('0x7')](_0x2b01('0x8'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x277f=['exports','define','user_profiles','lodash','../../config/logger','api','moment','bluebird','./userProfile.attributes'];(function(_0x1e1020,_0xd64a27){var _0x464719=function(_0x376ffa){while(--_0x376ffa){_0x1e1020['push'](_0x1e1020['shift']());}};_0x464719(++_0xd64a27);}(_0x277f,0x13e));var _0xf277=function(_0x2470c8,_0x4408fb){_0x2470c8=_0x2470c8-0x0;var _0x83e1e=_0x277f[_0x2470c8];return _0x83e1e;};'use strict';var _=require(_0xf277('0x0'));var util=require('util');var logger=require(_0xf277('0x1'))(_0xf277('0x2'));var moment=require(_0xf277('0x3'));var BPromise=require(_0xf277('0x4'));var rp=require('request-promise');var attributes=require(_0xf277('0x5'));module[_0xf277('0x6')]=function(_0x20a7e1,_0x33bf78){return _0x20a7e1[_0xf277('0x7')]('UserProfile',attributes,{'tableName':_0xf277('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index b45b3c9..51b92e0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc3cc=['catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x16b667,_0xadec02){var _0x58620e=function(_0x5db60b){while(--_0x5db60b){_0x16b667['push'](_0x16b667['shift']());}};_0x58620e(++_0xadec02);}(_0xc3cc,0x1c9));var _0xcc3c=function(_0x2665a3,_0x3bac99){_0x2665a3=_0x2665a3-0x0;var _0x586de6=_0xc3cc[_0x2665a3];return _0x586de6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcc3c('0x0'));var BPromise=require('bluebird');var rs=require(_0xcc3c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc3c('0x2'))['db'];var utils=require(_0xcc3c('0x3'));var logger=require(_0xcc3c('0x4'))('rpc');var config=require(_0xcc3c('0x5'));var jayson=require(_0xcc3c('0x6'));var client=jayson[_0xcc3c('0x7')][_0xcc3c('0x8')]({'port':0x232a});config[_0xcc3c('0x9')]=_[_0xcc3c('0xa')](config[_0xcc3c('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc3c('0x9')]));require('./userProfile.socket')[_0xcc3c('0xb')](socket);function respondWithRpcPromise(_0x119ed3,_0x3d89df,_0x3eb055){return new BPromise(function(_0x3d7832,_0x31966f){return client[_0xcc3c('0xc')](_0x119ed3,_0x3eb055)[_0xcc3c('0xd')](function(_0x3320cd){logger[_0xcc3c('0xe')](_0xcc3c('0xf'),_0x3d89df,_0xcc3c('0x10'));logger['debug'](_0xcc3c('0x11'),_0x3d89df,_0xcc3c('0x10'),JSON[_0xcc3c('0x12')](_0x3320cd));if(_0x3320cd[_0xcc3c('0x13')]){if(_0x3320cd[_0xcc3c('0x13')][_0xcc3c('0x14')]===0x1f4){logger[_0xcc3c('0x13')](_0xcc3c('0xf'),_0x3d89df,_0x3320cd[_0xcc3c('0x13')][_0xcc3c('0x15')]);return _0x31966f(_0x3320cd[_0xcc3c('0x13')]['message']);}logger['error'](_0xcc3c('0xf'),_0x3d89df,_0x3320cd[_0xcc3c('0x13')][_0xcc3c('0x15')]);return _0x3d7832(_0x3320cd[_0xcc3c('0x13')][_0xcc3c('0x15')]);}else{logger['info'](_0xcc3c('0xf'),_0x3d89df,_0xcc3c('0x10'));_0x3d7832(_0x3320cd[_0xcc3c('0x16')][_0xcc3c('0x15')]);}})[_0xcc3c('0x17')](function(_0x3b53e9){logger['error']('UserProfile,\x20%s,\x20%s',_0x3d89df,_0x3b53e9);_0x31966f(_0x3b53e9);});});}
\ No newline at end of file
+var _0x6612=['localhost','socket.io-emitter','then','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','util','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults'];(function(_0x4f4c11,_0xdb6add){var _0x4dfd33=function(_0x163cfe){while(--_0x163cfe){_0x4f4c11['push'](_0x4f4c11['shift']());}};_0x4dfd33(++_0xdb6add);}(_0x6612,0x182));var _0x2661=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x6612[_0x3054be];return _0x3df150;};'use strict';var _=require('lodash');var util=require(_0x2661('0x0'));var moment=require('moment');var BPromise=require(_0x2661('0x1'));var rs=require(_0x2661('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2661('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2661('0x4'));var config=require(_0x2661('0x5'));var jayson=require(_0x2661('0x6'));var client=jayson[_0x2661('0x7')]['http']({'port':0x232a});config[_0x2661('0x8')]=_[_0x2661('0x9')](config[_0x2661('0x8')],{'host':_0x2661('0xa'),'port':0x18eb});var socket=require(_0x2661('0xb'))(new Redis(config['redis']));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x25951e,_0x43b4e5,_0x3bd799){return new BPromise(function(_0x3af9ce,_0x5deb10){return client['request'](_0x25951e,_0x3bd799)[_0x2661('0xc')](function(_0x13d83d){logger['info'](_0x2661('0xd'),_0x43b4e5,'request\x20sent');logger[_0x2661('0xe')](_0x2661('0xf'),_0x43b4e5,'request\x20sent',JSON[_0x2661('0x10')](_0x13d83d));if(_0x13d83d[_0x2661('0x11')]){if(_0x13d83d['error'][_0x2661('0x12')]===0x1f4){logger[_0x2661('0x11')]('UserProfile,\x20%s,\x20%s',_0x43b4e5,_0x13d83d[_0x2661('0x11')]['message']);return _0x5deb10(_0x13d83d[_0x2661('0x11')][_0x2661('0x13')]);}logger[_0x2661('0x11')]('UserProfile,\x20%s,\x20%s',_0x43b4e5,_0x13d83d[_0x2661('0x11')][_0x2661('0x13')]);return _0x3af9ce(_0x13d83d['error'][_0x2661('0x13')]);}else{logger['info'](_0x2661('0xd'),_0x43b4e5,_0x2661('0x14'));_0x3af9ce(_0x13d83d['result'][_0x2661('0x13')]);}})[_0x2661('0x15')](function(_0x2d90e8){logger[_0x2661('0x11')](_0x2661('0xd'),_0x43b4e5,_0x2d90e8);_0x5deb10(_0x2d90e8);});});}
\ No newline at end of file
index 63c19d0..d32be21 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x16cc=['userProfile:','save','remove','update','emit','removeListener','register'];(function(_0x461b52,_0x20b9ed){var _0x2c3811=function(_0xba555c){while(--_0xba555c){_0x461b52['push'](_0x461b52['shift']());}};_0x2c3811(++_0x20b9ed);}(_0x16cc,0x120));var _0xc16c=function(_0x3415b5,_0x8dfe24){_0x3415b5=_0x3415b5-0x0;var _0x193501=_0x16cc[_0x3415b5];return _0x193501;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xc16c('0x0'),_0xc16c('0x1'),_0xc16c('0x2')];function createListener(_0x29c693,_0x203166){return function(_0xef5c6){_0x203166[_0xc16c('0x3')](_0x29c693,_0xef5c6);};}function removeListener(_0x5b0f8b,_0x10c787){return function(){UserProfileEvents[_0xc16c('0x4')](_0x5b0f8b,_0x10c787);};}exports[_0xc16c('0x5')]=function(_0x1019ec){for(var _0x5ea82b=0x0,_0x3492da=events['length'];_0x5ea82b<_0x3492da;_0x5ea82b++){var _0x828798=events[_0x5ea82b];var _0x14d607=createListener(_0xc16c('0x6')+_0x828798,_0x1019ec);UserProfileEvents['on'](_0x828798,_0x14d607);}};
\ No newline at end of file
+var _0xaeab=['emit','removeListener','register','length','userProfile:','./userProfile.events','remove'];(function(_0x403893,_0x1f8cb3){var _0x49e45d=function(_0x719ab6){while(--_0x719ab6){_0x403893['push'](_0x403893['shift']());}};_0x49e45d(++_0x1f8cb3);}(_0xaeab,0x91));var _0xbaea=function(_0x6e4a84,_0x1655c5){_0x6e4a84=_0x6e4a84-0x0;var _0x187995=_0xaeab[_0x6e4a84];return _0x187995;};'use strict';var UserProfileEvents=require(_0xbaea('0x0'));var events=['save',_0xbaea('0x1'),'update'];function createListener(_0x2eb81e,_0x236fca){return function(_0x2e3da7){_0x236fca[_0xbaea('0x2')](_0x2eb81e,_0x2e3da7);};}function removeListener(_0x36e839,_0xbe1ff5){return function(){UserProfileEvents[_0xbaea('0x3')](_0x36e839,_0xbe1ff5);};}exports[_0xbaea('0x4')]=function(_0x1ae44e){for(var _0x1e4331=0x0,_0x5bfed3=events[_0xbaea('0x5')];_0x1e4331<_0x5bfed3;_0x1e4331++){var _0x267afb=events[_0x1e4331];var _0x202d96=createListener(_0xbaea('0x6')+_0x267afb,_0x1ae44e);UserProfileEvents['on'](_0x267afb,_0x202d96);}};
\ No newline at end of file
index 3a0de30..d376715 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xba37=['delete','destroy','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','index','isAuthenticated','describe','/:id','show','post','create','put'];(function(_0x2a453b,_0x479c50){var _0x132f79=function(_0x5e3d83){while(--_0x5e3d83){_0x2a453b['push'](_0x2a453b['shift']());}};_0x132f79(++_0x479c50);}(_0xba37,0xb6));var _0x7ba3=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xba37[_0x411017];return _0x2adeea;};'use strict';var multer=require(_0x7ba3('0x0'));var util=require('util');var path=require(_0x7ba3('0x1'));var timeout=require('connect-timeout');var express=require(_0x7ba3('0x2'));var router=express['Router']();var auth=require(_0x7ba3('0x3'));var interaction=require(_0x7ba3('0x4'));var config=require(_0x7ba3('0x5'));var controller=require(_0x7ba3('0x6'));router[_0x7ba3('0x7')]('/',auth['isAuthenticated'](),controller[_0x7ba3('0x8')]);router['get']('/describe',auth[_0x7ba3('0x9')](),controller[_0x7ba3('0xa')]);router['get'](_0x7ba3('0xb'),auth[_0x7ba3('0x9')](),controller[_0x7ba3('0xc')]);router[_0x7ba3('0xd')]('/',auth[_0x7ba3('0x9')](),controller[_0x7ba3('0xe')]);router[_0x7ba3('0xf')](_0x7ba3('0xb'),auth[_0x7ba3('0x9')](),controller['update']);router[_0x7ba3('0x10')](_0x7ba3('0xb'),auth[_0x7ba3('0x9')](),controller[_0x7ba3('0x11')]);module['exports']=router;
\ No newline at end of file
+var _0xc7da=['/describe','/:id','show','post','create','update','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x39938c,_0x2b1ea5){var _0x4340a5=function(_0x2cc9fc){while(--_0x2cc9fc){_0x39938c['push'](_0x39938c['shift']());}};_0x4340a5(++_0x2b1ea5);}(_0xc7da,0xf2));var _0xac7d=function(_0x4f9cf9,_0x5ac7ce){_0x4f9cf9=_0x4f9cf9-0x0;var _0x5d53bc=_0xc7da[_0x4f9cf9];return _0x5d53bc;};'use strict';var multer=require(_0xac7d('0x0'));var util=require(_0xac7d('0x1'));var path=require(_0xac7d('0x2'));var timeout=require('connect-timeout');var express=require(_0xac7d('0x3'));var router=express[_0xac7d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xac7d('0x5'));var config=require(_0xac7d('0x6'));var controller=require('./userProfileResource.controller');router[_0xac7d('0x7')]('/',auth[_0xac7d('0x8')](),controller[_0xac7d('0x9')]);router[_0xac7d('0x7')](_0xac7d('0xa'),auth[_0xac7d('0x8')](),controller['describe']);router[_0xac7d('0x7')](_0xac7d('0xb'),auth[_0xac7d('0x8')](),controller[_0xac7d('0xc')]);router[_0xac7d('0xd')]('/',auth[_0xac7d('0x8')](),controller[_0xac7d('0xe')]);router['put'](_0xac7d('0xb'),auth[_0xac7d('0x8')](),controller[_0xac7d('0xf')]);router['delete'](_0xac7d('0xb'),auth[_0xac7d('0x8')](),controller[_0xac7d('0x10')]);module[_0xac7d('0x11')]=router;
\ No newline at end of file
index ce108c4..8fac396 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x43ae=['INTEGER','sequelize','exports','STRING'];(function(_0x5ba9e2,_0x11c3c1){var _0x2dcb53=function(_0x3ebbb2){while(--_0x3ebbb2){_0x5ba9e2['push'](_0x5ba9e2['shift']());}};_0x2dcb53(++_0x11c3c1);}(_0x43ae,0x175));var _0xe43a=function(_0x5e1f45,_0x2a79d5){_0x5e1f45=_0x5e1f45-0x0;var _0x52e85a=_0x43ae[_0x5e1f45];return _0x52e85a;};'use strict';var Sequelize=require(_0xe43a('0x0'));module[_0xe43a('0x1')]={'name':{'type':Sequelize[_0xe43a('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xe43a('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xe43a('0x2')],'allowNull':![]}};
\ No newline at end of file
+var _0x2d4f=['STRING','sequelize','INTEGER'];(function(_0x46d269,_0x471a3b){var _0x1a241f=function(_0x6fe49b){while(--_0x6fe49b){_0x46d269['push'](_0x46d269['shift']());}};_0x1a241f(++_0x471a3b);}(_0x2d4f,0x7f));var _0xf2d4=function(_0x5704bd,_0x3be59){_0x5704bd=_0x5704bd-0x0;var _0x32fd3d=_0x2d4f[_0x5704bd];return _0x32fd3d;};'use strict';var Sequelize=require(_0xf2d4('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xf2d4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xf2d4('0x2')],'allowNull':![]}};
\ No newline at end of file
index c49bfea..4245345 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb10b=['includeAll','findAll','catch','params','model','options','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','send','index','UserProfileResource','rawAttributes','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','key','VIRTUAL','field','count'];(function(_0x31cfc6,_0x4df1e2){var _0x20c752=function(_0x2fa208){while(--_0x2fa208){_0x31cfc6['push'](_0x31cfc6['shift']());}};_0x20c752(++_0x4df1e2);}(_0xb10b,0x12a));var _0xbb10=function(_0x42aabd,_0x217ade){_0x42aabd=_0x42aabd-0x0;var _0x2e83fb=_0xb10b[_0x42aabd];return _0x2e83fb;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');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('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var hardwareService=require(_0xbb10('0x13'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require(_0xbb10('0x16'));var config=require('../../config/environment');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x5be7e0,_0x44fb19){_0x44fb19=_0x44fb19||0xcc;return function(_0x916a32){if(_0x916a32){return _0x5be7e0[_0xbb10('0x18')](_0x44fb19);}return _0x5be7e0[_0xbb10('0x19')](_0x44fb19)[_0xbb10('0x1a')]();};}function respondWithResult(_0x147230,_0x58a612){_0x58a612=_0x58a612||0xc8;return function(_0x26e021){if(_0x26e021){return _0x147230[_0xbb10('0x19')](_0x58a612)[_0xbb10('0x1b')](_0x26e021);}};}function respondWithFilteredResult(_0x17fd46,_0x3df17b){return function(_0x2f2ebf){if(_0x2f2ebf){var _0x24a57b=_0x2f2ebf['count'],_0x36b5e8=_0x3df17b[_0xbb10('0x1c')],_0x3e26f4=_0x3df17b[_0xbb10('0x1c')]+_0x3df17b[_0xbb10('0x1d')],_0x2b184e;if(_0x3e26f4>=_0x24a57b){_0x3e26f4=_0x24a57b;_0x2b184e=0xc8;}else{_0x2b184e=0xce;}_0x17fd46[_0xbb10('0x19')](_0x2b184e);return _0x17fd46[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x36b5e8+'-'+_0x3e26f4+'/'+_0x24a57b)[_0xbb10('0x1b')](_0x2f2ebf);}return null;};}function patchUpdates(_0x30efc6){return function(_0xbf2906){try{jsonpatch[_0xbb10('0x20')](_0xbf2906,_0x30efc6,!![]);}catch(_0x48b6e9){return BPromise[_0xbb10('0x21')](_0x48b6e9);}return _0xbf2906[_0xbb10('0x22')]();};}function saveUpdates(_0x388fab,_0x109908){return function(_0xdf237d){if(_0xdf237d){return _0xdf237d[_0xbb10('0x23')](_0x388fab)['then'](function(_0x12f888){return _0x12f888;});}return null;};}function removeEntity(_0x12ef77,_0x50aea1){return function(_0x4c4b0d){if(_0x4c4b0d){return _0x4c4b0d[_0xbb10('0x24')]()[_0xbb10('0x25')](function(){_0x12ef77[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x445761,_0x1824b7){return function(_0x407cb4){if(!_0x407cb4){_0x445761[_0xbb10('0x18')](0x194);}return _0x407cb4;};}function handleError(_0x7f2377,_0x395404){_0x395404=_0x395404||0x1f4;return function(_0x3ba6cd){logger[_0xbb10('0x26')](_0x3ba6cd['stack']);if(_0x3ba6cd['name']){delete _0x3ba6cd['name'];}_0x7f2377[_0xbb10('0x19')](_0x395404)[_0xbb10('0x27')](_0x3ba6cd);};}exports[_0xbb10('0x28')]=function(_0x4e25ff,_0x2fdde9){var _0x24d586={},_0x6ed43b={},_0x1d5e95={'count':0x0,'rows':[]};var _0x1acce9=db[_0xbb10('0x29')][_0xbb10('0x2a')];_0x6ed43b['model']=_[_0xbb10('0x2b')](_0x1acce9);_0x6ed43b[_0xbb10('0x2c')]=_[_0xbb10('0x2b')](_0x4e25ff[_0xbb10('0x2c')]);_0x6ed43b[_0xbb10('0x2d')]=_[_0xbb10('0x2e')](_0x6ed43b['model'],_0x6ed43b[_0xbb10('0x2c')]);_0x24d586['attributes']=_[_0xbb10('0x2e')](_0x6ed43b['model'],qs[_0xbb10('0x2f')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x2f')]));_0x24d586['attributes']=_0x24d586['attributes'][_0xbb10('0x30')]?_0x24d586[_0xbb10('0x31')]:_0x6ed43b['model'];if(!_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x32')](_0xbb10('0x33'))){_0x24d586[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x1d')]);_0x24d586['offset']=qs[_0xbb10('0x1c')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x1c')]);}_0x24d586[_0xbb10('0x34')]=qs[_0xbb10('0x35')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x35')]);_0x24d586[_0xbb10('0x36')]=qs[_0xbb10('0x2d')](_['pick'](_0x4e25ff[_0xbb10('0x2c')],_0x6ed43b[_0xbb10('0x2d')]));if(_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x37')]){_0x24d586['where']=_[_0xbb10('0x38')](_0x24d586['where'],{'$or':_['map'](_0x1acce9,function(_0x3eb3cc){if(_0x3eb3cc[_0xbb10('0x39')][_0xbb10('0x3a')]!==_0xbb10('0x3b')){var _0x15d895={};_0x15d895[_0x3eb3cc[_0xbb10('0x3c')]]={'$like':'%'+_0x4e25ff['query'][_0xbb10('0x37')]+'%'};return _0x15d895;}})});}_0x24d586=_[_0xbb10('0x38')]({},_0x24d586,_0x4e25ff['options']);var _0x5e3fbd={'where':_0x24d586['where']};return db[_0xbb10('0x29')][_0xbb10('0x3d')](_0x5e3fbd)[_0xbb10('0x25')](function(_0x4d5a9b){_0x1d5e95[_0xbb10('0x3d')]=_0x4d5a9b;if(_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x3e')]){_0x24d586['include']=[{'all':!![]}];}return db[_0xbb10('0x29')][_0xbb10('0x3f')](_0x24d586);})[_0xbb10('0x25')](function(_0x446f49){_0x1d5e95['rows']=_0x446f49;return _0x1d5e95;})[_0xbb10('0x25')](respondWithFilteredResult(_0x2fdde9,_0x24d586))[_0xbb10('0x40')](handleError(_0x2fdde9,null));};exports['show']=function(_0xe2040f,_0x2e3214){var _0x44d6ae={'raw':![],'where':{'id':_0xe2040f[_0xbb10('0x41')]['id']}},_0x3a9934={};_0x3a9934[_0xbb10('0x42')]=_['keys'](db[_0xbb10('0x29')][_0xbb10('0x2a')]);_0x3a9934[_0xbb10('0x2c')]=_[_0xbb10('0x2b')](_0xe2040f['query']);_0x3a9934[_0xbb10('0x2d')]=_[_0xbb10('0x2e')](_0x3a9934[_0xbb10('0x42')],_0x3a9934[_0xbb10('0x2c')]);_0x44d6ae['attributes']=_[_0xbb10('0x2e')](_0x3a9934[_0xbb10('0x42')],qs['fields'](_0xe2040f['query'][_0xbb10('0x2f')]));_0x44d6ae['attributes']=_0x44d6ae[_0xbb10('0x31')][_0xbb10('0x30')]?_0x44d6ae['attributes']:_0x3a9934[_0xbb10('0x42')];if(_0xe2040f[_0xbb10('0x2c')][_0xbb10('0x3e')]){_0x44d6ae['include']=[{'all':!![]}];}_0x44d6ae=_[_0xbb10('0x38')]({},_0x44d6ae,_0xe2040f[_0xbb10('0x43')]);return db[_0xbb10('0x29')][_0xbb10('0x44')](_0x44d6ae)[_0xbb10('0x25')](handleEntityNotFound(_0x2e3214,null))[_0xbb10('0x25')](respondWithResult(_0x2e3214,null))[_0xbb10('0x40')](handleError(_0x2e3214,null));};exports[_0xbb10('0x45')]=function(_0x205bb4,_0x43b948){return db[_0xbb10('0x29')][_0xbb10('0x45')](_0x205bb4['body'],{})[_0xbb10('0x25')](respondWithResult(_0x43b948,0xc9))[_0xbb10('0x40')](handleError(_0x43b948,null));};exports['update']=function(_0x14e1cb,_0x2f5027){if(_0x14e1cb[_0xbb10('0x46')]['id']){delete _0x14e1cb[_0xbb10('0x46')]['id'];}return db[_0xbb10('0x29')][_0xbb10('0x44')]({'where':{'id':_0x14e1cb[_0xbb10('0x41')]['id']}})['then'](handleEntityNotFound(_0x2f5027,null))['then'](saveUpdates(_0x14e1cb[_0xbb10('0x46')],null))[_0xbb10('0x25')](respondWithResult(_0x2f5027,null))[_0xbb10('0x40')](handleError(_0x2f5027,null));};exports['destroy']=function(_0x5f0c12,_0x3cd6f3){return db[_0xbb10('0x29')][_0xbb10('0x44')]({'where':{'id':_0x5f0c12[_0xbb10('0x41')]['id']}})[_0xbb10('0x25')](handleEntityNotFound(_0x3cd6f3,null))[_0xbb10('0x25')](removeEntity(_0x3cd6f3,null))[_0xbb10('0x40')](handleError(_0x3cd6f3,null));};exports[_0xbb10('0x47')]=function(_0x2626d8,_0x3d7e7e){return db['UserProfileResource']['describe']()[_0xbb10('0x25')](respondWithResult(_0x3d7e7e,null))[_0xbb10('0x40')](handleError(_0x3d7e7e,null));};
\ No newline at end of file
+var _0xb10b=['includeAll','findAll','catch','params','model','options','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','send','index','UserProfileResource','rawAttributes','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','key','VIRTUAL','field','count'];(function(_0x214642,_0xc9fac6){var _0x4ec937=function(_0x14b3a8){while(--_0x14b3a8){_0x214642['push'](_0x214642['shift']());}};_0x4ec937(++_0xc9fac6);}(_0xb10b,0x12a));var _0xbb10=function(_0x1d656c,_0x14fba4){_0x1d656c=_0x1d656c-0x0;var _0x4eeb25=_0xb10b[_0x1d656c];return _0x4eeb25;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');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('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var hardwareService=require(_0xbb10('0x13'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require(_0xbb10('0x16'));var config=require('../../config/environment');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x5be7e0,_0x44fb19){_0x44fb19=_0x44fb19||0xcc;return function(_0x916a32){if(_0x916a32){return _0x5be7e0[_0xbb10('0x18')](_0x44fb19);}return _0x5be7e0[_0xbb10('0x19')](_0x44fb19)[_0xbb10('0x1a')]();};}function respondWithResult(_0x147230,_0x58a612){_0x58a612=_0x58a612||0xc8;return function(_0x26e021){if(_0x26e021){return _0x147230[_0xbb10('0x19')](_0x58a612)[_0xbb10('0x1b')](_0x26e021);}};}function respondWithFilteredResult(_0x17fd46,_0x3df17b){return function(_0x2f2ebf){if(_0x2f2ebf){var _0x24a57b=_0x2f2ebf['count'],_0x36b5e8=_0x3df17b[_0xbb10('0x1c')],_0x3e26f4=_0x3df17b[_0xbb10('0x1c')]+_0x3df17b[_0xbb10('0x1d')],_0x2b184e;if(_0x3e26f4>=_0x24a57b){_0x3e26f4=_0x24a57b;_0x2b184e=0xc8;}else{_0x2b184e=0xce;}_0x17fd46[_0xbb10('0x19')](_0x2b184e);return _0x17fd46[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x36b5e8+'-'+_0x3e26f4+'/'+_0x24a57b)[_0xbb10('0x1b')](_0x2f2ebf);}return null;};}function patchUpdates(_0x30efc6){return function(_0xbf2906){try{jsonpatch[_0xbb10('0x20')](_0xbf2906,_0x30efc6,!![]);}catch(_0x48b6e9){return BPromise[_0xbb10('0x21')](_0x48b6e9);}return _0xbf2906[_0xbb10('0x22')]();};}function saveUpdates(_0x388fab,_0x109908){return function(_0xdf237d){if(_0xdf237d){return _0xdf237d[_0xbb10('0x23')](_0x388fab)['then'](function(_0x12f888){return _0x12f888;});}return null;};}function removeEntity(_0x12ef77,_0x50aea1){return function(_0x4c4b0d){if(_0x4c4b0d){return _0x4c4b0d[_0xbb10('0x24')]()[_0xbb10('0x25')](function(){_0x12ef77[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x445761,_0x1824b7){return function(_0x407cb4){if(!_0x407cb4){_0x445761[_0xbb10('0x18')](0x194);}return _0x407cb4;};}function handleError(_0x7f2377,_0x395404){_0x395404=_0x395404||0x1f4;return function(_0x3ba6cd){logger[_0xbb10('0x26')](_0x3ba6cd['stack']);if(_0x3ba6cd['name']){delete _0x3ba6cd['name'];}_0x7f2377[_0xbb10('0x19')](_0x395404)[_0xbb10('0x27')](_0x3ba6cd);};}exports[_0xbb10('0x28')]=function(_0x4e25ff,_0x2fdde9){var _0x24d586={},_0x6ed43b={},_0x1d5e95={'count':0x0,'rows':[]};var _0x1acce9=db[_0xbb10('0x29')][_0xbb10('0x2a')];_0x6ed43b['model']=_[_0xbb10('0x2b')](_0x1acce9);_0x6ed43b[_0xbb10('0x2c')]=_[_0xbb10('0x2b')](_0x4e25ff[_0xbb10('0x2c')]);_0x6ed43b[_0xbb10('0x2d')]=_[_0xbb10('0x2e')](_0x6ed43b['model'],_0x6ed43b[_0xbb10('0x2c')]);_0x24d586['attributes']=_[_0xbb10('0x2e')](_0x6ed43b['model'],qs[_0xbb10('0x2f')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x2f')]));_0x24d586['attributes']=_0x24d586['attributes'][_0xbb10('0x30')]?_0x24d586[_0xbb10('0x31')]:_0x6ed43b['model'];if(!_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x32')](_0xbb10('0x33'))){_0x24d586[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x1d')]);_0x24d586['offset']=qs[_0xbb10('0x1c')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x1c')]);}_0x24d586[_0xbb10('0x34')]=qs[_0xbb10('0x35')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x35')]);_0x24d586[_0xbb10('0x36')]=qs[_0xbb10('0x2d')](_['pick'](_0x4e25ff[_0xbb10('0x2c')],_0x6ed43b[_0xbb10('0x2d')]));if(_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x37')]){_0x24d586['where']=_[_0xbb10('0x38')](_0x24d586['where'],{'$or':_['map'](_0x1acce9,function(_0x3eb3cc){if(_0x3eb3cc[_0xbb10('0x39')][_0xbb10('0x3a')]!==_0xbb10('0x3b')){var _0x15d895={};_0x15d895[_0x3eb3cc[_0xbb10('0x3c')]]={'$like':'%'+_0x4e25ff['query'][_0xbb10('0x37')]+'%'};return _0x15d895;}})});}_0x24d586=_[_0xbb10('0x38')]({},_0x24d586,_0x4e25ff['options']);var _0x5e3fbd={'where':_0x24d586['where']};return db[_0xbb10('0x29')][_0xbb10('0x3d')](_0x5e3fbd)[_0xbb10('0x25')](function(_0x4d5a9b){_0x1d5e95[_0xbb10('0x3d')]=_0x4d5a9b;if(_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x3e')]){_0x24d586['include']=[{'all':!![]}];}return db[_0xbb10('0x29')][_0xbb10('0x3f')](_0x24d586);})[_0xbb10('0x25')](function(_0x446f49){_0x1d5e95['rows']=_0x446f49;return _0x1d5e95;})[_0xbb10('0x25')](respondWithFilteredResult(_0x2fdde9,_0x24d586))[_0xbb10('0x40')](handleError(_0x2fdde9,null));};exports['show']=function(_0xe2040f,_0x2e3214){var _0x44d6ae={'raw':![],'where':{'id':_0xe2040f[_0xbb10('0x41')]['id']}},_0x3a9934={};_0x3a9934[_0xbb10('0x42')]=_['keys'](db[_0xbb10('0x29')][_0xbb10('0x2a')]);_0x3a9934[_0xbb10('0x2c')]=_[_0xbb10('0x2b')](_0xe2040f['query']);_0x3a9934[_0xbb10('0x2d')]=_[_0xbb10('0x2e')](_0x3a9934[_0xbb10('0x42')],_0x3a9934[_0xbb10('0x2c')]);_0x44d6ae['attributes']=_[_0xbb10('0x2e')](_0x3a9934[_0xbb10('0x42')],qs['fields'](_0xe2040f['query'][_0xbb10('0x2f')]));_0x44d6ae['attributes']=_0x44d6ae[_0xbb10('0x31')][_0xbb10('0x30')]?_0x44d6ae['attributes']:_0x3a9934[_0xbb10('0x42')];if(_0xe2040f[_0xbb10('0x2c')][_0xbb10('0x3e')]){_0x44d6ae['include']=[{'all':!![]}];}_0x44d6ae=_[_0xbb10('0x38')]({},_0x44d6ae,_0xe2040f[_0xbb10('0x43')]);return db[_0xbb10('0x29')][_0xbb10('0x44')](_0x44d6ae)[_0xbb10('0x25')](handleEntityNotFound(_0x2e3214,null))[_0xbb10('0x25')](respondWithResult(_0x2e3214,null))[_0xbb10('0x40')](handleError(_0x2e3214,null));};exports[_0xbb10('0x45')]=function(_0x205bb4,_0x43b948){return db[_0xbb10('0x29')][_0xbb10('0x45')](_0x205bb4['body'],{})[_0xbb10('0x25')](respondWithResult(_0x43b948,0xc9))[_0xbb10('0x40')](handleError(_0x43b948,null));};exports['update']=function(_0x14e1cb,_0x2f5027){if(_0x14e1cb[_0xbb10('0x46')]['id']){delete _0x14e1cb[_0xbb10('0x46')]['id'];}return db[_0xbb10('0x29')][_0xbb10('0x44')]({'where':{'id':_0x14e1cb[_0xbb10('0x41')]['id']}})['then'](handleEntityNotFound(_0x2f5027,null))['then'](saveUpdates(_0x14e1cb[_0xbb10('0x46')],null))[_0xbb10('0x25')](respondWithResult(_0x2f5027,null))[_0xbb10('0x40')](handleError(_0x2f5027,null));};exports['destroy']=function(_0x5f0c12,_0x3cd6f3){return db[_0xbb10('0x29')][_0xbb10('0x44')]({'where':{'id':_0x5f0c12[_0xbb10('0x41')]['id']}})[_0xbb10('0x25')](handleEntityNotFound(_0x3cd6f3,null))[_0xbb10('0x25')](removeEntity(_0x3cd6f3,null))[_0xbb10('0x40')](handleError(_0x3cd6f3,null));};exports[_0xbb10('0x47')]=function(_0x2626d8,_0x3d7e7e){return db['UserProfileResource']['describe']()[_0xbb10('0x25')](respondWithResult(_0x3d7e7e,null))[_0xbb10('0x40')](handleError(_0x3d7e7e,null));};
\ No newline at end of file
index 2b0ec47..7327e62 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x38db=['../../config/logger','request-promise','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash'];(function(_0x1e7159,_0x15e3ed){var _0x2e0dd8=function(_0x7b088f){while(--_0x7b088f){_0x1e7159['push'](_0x1e7159['shift']());}};_0x2e0dd8(++_0x15e3ed);}(_0x38db,0x1cb));var _0xb38d=function(_0x4b1305,_0x548ac3){_0x4b1305=_0x4b1305-0x0;var _0x12d9f9=_0x38db[_0x4b1305];return _0x12d9f9;};'use strict';var _=require(_0xb38d('0x0'));var util=require('util');var logger=require(_0xb38d('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb38d('0x2'));var attributes=require('./userProfileResource.attributes');module[_0xb38d('0x3')]=function(_0x447f81,_0x45257a){return _0x447f81[_0xb38d('0x4')](_0xb38d('0x5'),attributes,{'tableName':_0xb38d('0x6'),'paranoid':![],'indexes':[{'name':_0xb38d('0x7'),'fields':[_0xb38d('0x8'),_0xb38d('0x9')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xe988=['api','moment','request-promise','./userProfileResource.attributes','exports','define','UserProfileResource','compositeIndex','resourceId','sectionId','lodash','../../config/logger'];(function(_0x17d526,_0xdaab7f){var _0xfcca40=function(_0x5388dc){while(--_0x5388dc){_0x17d526['push'](_0x17d526['shift']());}};_0xfcca40(++_0xdaab7f);}(_0xe988,0x196));var _0x8e98=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xe988[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x8e98('0x0'));var util=require('util');var logger=require(_0x8e98('0x1'))(_0x8e98('0x2'));var moment=require(_0x8e98('0x3'));var BPromise=require('bluebird');var rp=require(_0x8e98('0x4'));var attributes=require(_0x8e98('0x5'));module[_0x8e98('0x6')]=function(_0x4de0a1,_0x5f5cab){return _0x4de0a1[_0x8e98('0x7')](_0x8e98('0x8'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x8e98('0x9'),'fields':[_0x8e98('0xa'),_0x8e98('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
index 965a9fe..02ef432 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x4137,0xf8));var _0x7413=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x4137[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});}
\ No newline at end of file
+var _0xffd6=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xffd6,0x97));var _0x6ffd=function(_0x28f32c,_0x4cc342){_0x28f32c=_0x28f32c-0x0;var _0x355402=_0xffd6[_0x28f32c];return _0x355402;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var moment=require(_0x6ffd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ffd('0x3'));var db=require(_0x6ffd('0x4'))['db'];var utils=require(_0x6ffd('0x5'));var logger=require('../../config/logger')(_0x6ffd('0x6'));var config=require(_0x6ffd('0x7'));var jayson=require(_0x6ffd('0x8'));var client=jayson[_0x6ffd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x122b71,_0xeefe34,_0x2445a0){return new BPromise(function(_0x1fbbe6,_0x1d8b50){return client['request'](_0x122b71,_0x2445a0)[_0x6ffd('0xa')](function(_0x417f34){logger['info'](_0x6ffd('0xb'),_0xeefe34,_0x6ffd('0xc'));logger[_0x6ffd('0xd')](_0x6ffd('0xe'),_0xeefe34,_0x6ffd('0xc'),JSON[_0x6ffd('0xf')](_0x417f34));if(_0x417f34[_0x6ffd('0x10')]){if(_0x417f34['error'][_0x6ffd('0x11')]===0x1f4){logger[_0x6ffd('0x10')]('UserProfileResource,\x20%s,\x20%s',_0xeefe34,_0x417f34[_0x6ffd('0x10')][_0x6ffd('0x12')]);return _0x1d8b50(_0x417f34[_0x6ffd('0x10')][_0x6ffd('0x12')]);}logger['error'](_0x6ffd('0xb'),_0xeefe34,_0x417f34['error'][_0x6ffd('0x12')]);return _0x1fbbe6(_0x417f34['error'][_0x6ffd('0x12')]);}else{logger[_0x6ffd('0x13')](_0x6ffd('0xb'),_0xeefe34,'request\x20sent');_0x1fbbe6(_0x417f34[_0x6ffd('0x14')][_0x6ffd('0x12')]);}})[_0x6ffd('0x15')](function(_0x3394b2){logger[_0x6ffd('0x10')](_0x6ffd('0xb'),_0xeefe34,_0x3394b2);_0x1d8b50(_0x3394b2);});});}
\ No newline at end of file
index 27b9290..be8c0bc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4dc6=['isAuthenticated','describe','/:id','post','put','destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x4dc6,0xcb));var _0x64dc=function(_0x2aa3ec,_0x1ce125){_0x2aa3ec=_0x2aa3ec-0x0;var _0x5eaeac=_0x4dc6[_0x2aa3ec];return _0x5eaeac;};'use strict';var multer=require(_0x64dc('0x0'));var util=require('util');var path=require(_0x64dc('0x1'));var timeout=require('connect-timeout');var express=require(_0x64dc('0x2'));var router=express['Router']();var auth=require(_0x64dc('0x3'));var interaction=require(_0x64dc('0x4'));var config=require(_0x64dc('0x5'));var controller=require('./userProfileSection.controller');router[_0x64dc('0x6')]('/',auth[_0x64dc('0x7')](),controller['index']);router[_0x64dc('0x6')]('/describe',auth[_0x64dc('0x7')](),controller[_0x64dc('0x8')]);router[_0x64dc('0x6')](_0x64dc('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x64dc('0xa')]('/',auth[_0x64dc('0x7')](),controller['create']);router[_0x64dc('0xb')]('/:id',auth[_0x64dc('0x7')](),controller['update']);router['delete'](_0x64dc('0x9'),auth['isAuthenticated'](),controller[_0x64dc('0xc')]);module[_0x64dc('0xd')]=router;
\ No newline at end of file
+var _0xb106=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','post','create','put','/:id','update','delete','multer'];(function(_0x3c314d,_0x49c7dd){var _0x47d060=function(_0x3a7b18){while(--_0x3a7b18){_0x3c314d['push'](_0x3c314d['shift']());}};_0x47d060(++_0x49c7dd);}(_0xb106,0x153));var _0x6b10=function(_0x560d2a,_0x4a9f54){_0x560d2a=_0x560d2a-0x0;var _0x3df62d=_0xb106[_0x560d2a];return _0x3df62d;};'use strict';var multer=require(_0x6b10('0x0'));var util=require(_0x6b10('0x1'));var path=require(_0x6b10('0x2'));var timeout=require(_0x6b10('0x3'));var express=require(_0x6b10('0x4'));var router=express[_0x6b10('0x5')]();var auth=require(_0x6b10('0x6'));var interaction=require(_0x6b10('0x7'));var config=require('../../config/environment');var controller=require(_0x6b10('0x8'));router[_0x6b10('0x9')]('/',auth[_0x6b10('0xa')](),controller[_0x6b10('0xb')]);router[_0x6b10('0x9')](_0x6b10('0xc'),auth[_0x6b10('0xa')](),controller[_0x6b10('0xd')]);router[_0x6b10('0x9')]('/:id',auth[_0x6b10('0xa')](),controller['show']);router[_0x6b10('0xe')]('/',auth['isAuthenticated'](),controller[_0x6b10('0xf')]);router[_0x6b10('0x10')](_0x6b10('0x11'),auth[_0x6b10('0xa')](),controller[_0x6b10('0x12')]);router[_0x6b10('0x13')]('/:id',auth[_0x6b10('0xa')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
index 9721c62..2d19960 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xedd9=['exports','STRING','INTEGER','BOOLEAN','crudPermissions','join','getDataValue'];(function(_0x3cf98f,_0x1c1740){var _0x3ab1d9=function(_0x1f60c5){while(--_0x1f60c5){_0x3cf98f['push'](_0x3cf98f['shift']());}};_0x3ab1d9(++_0x1c1740);}(_0xedd9,0xfc));var _0x9edd=function(_0x507552,_0xf25887){_0x507552=_0x507552-0x0;var _0x358510=_0xedd9[_0x507552];return _0x358510;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'name':{'type':Sequelize[_0x9edd('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x9edd('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x9edd('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x9edd('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x9edd('0x1')],'set':function(_0x36b53f){this['setDataValue'](_0x9edd('0x4'),_0x36b53f?_0x36b53f[_0x9edd('0x5')](''):[]);},'get':function(){return this[_0x9edd('0x6')](_0x9edd('0x4'))?this['getDataValue'](_0x9edd('0x4'))['split'](''):[];}}};
\ No newline at end of file
+var _0xa9e0=['crudPermissions','join','getDataValue','sequelize','exports','STRING','BOOLEAN','setDataValue'];(function(_0xac675,_0x546017){var _0x20d7b6=function(_0x542c4f){while(--_0x542c4f){_0xac675['push'](_0xac675['shift']());}};_0x20d7b6(++_0x546017);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x0a9e('0x2')],'set':function(_0x432180){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x432180?_0x432180[_0x0a9e('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x0a9e('0x5'))?this[_0x0a9e('0x7')](_0x0a9e('0x5'))['split'](''):[];}}};
\ No newline at end of file
index 7baeb3d..3e0b508 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x19a5=['key','VIRTUAL','field','options','UserProfileSection','count','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','body','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','name','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type'];(function(_0x25e905,_0x42f080){var _0x4d1f16=function(_0x575f79){while(--_0x575f79){_0x25e905['push'](_0x25e905['shift']());}};_0x4d1f16(++_0x42f080);}(_0x19a5,0x132));var _0x519a=function(_0x1d4636,_0x22cfe5){_0x1d4636=_0x1d4636-0x0;var _0x2eba57=_0x19a5[_0x1d4636];return _0x2eba57;};'use strict';var pdf=require(_0x519a('0x0'));var emlformat=require(_0x519a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x519a('0x2'));var jsonpatch=require(_0x519a('0x3'));var rp=require(_0x519a('0x4'));var moment=require('moment');var BPromise=require(_0x519a('0x5'));var Mustache=require(_0x519a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x519a('0x7'));var csv=require(_0x519a('0x8'));var ejs=require(_0x519a('0x9'));var fs=require('fs');var _=require(_0x519a('0xa'));var squel=require(_0x519a('0xb'));var crypto=require('crypto');var jsforce=require(_0x519a('0xc'));var deskjs=require(_0x519a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x519a('0xe'));var Papa=require(_0x519a('0xf'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x519a('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0x519a('0x11'))(_0x519a('0x12'));var utils=require(_0x519a('0x13'));var config=require('../../config/environment');var db=require(_0x519a('0x14'))['db'];function respondWithStatusCode(_0xa779b9,_0x5739ff){_0x5739ff=_0x5739ff||0xcc;return function(_0x65048c){if(_0x65048c){return _0xa779b9[_0x519a('0x15')](_0x5739ff);}return _0xa779b9[_0x519a('0x16')](_0x5739ff)[_0x519a('0x17')]();};}function respondWithResult(_0xf9b04,_0x2944e2){_0x2944e2=_0x2944e2||0xc8;return function(_0xd15bea){if(_0xd15bea){return _0xf9b04[_0x519a('0x16')](_0x2944e2)[_0x519a('0x18')](_0xd15bea);}};}function respondWithFilteredResult(_0xec8df8,_0x468078){return function(_0x7cade){if(_0x7cade){var _0x110558=_0x7cade['count'],_0x5ee2a8=_0x468078['offset'],_0x5e5347=_0x468078[_0x519a('0x19')]+_0x468078[_0x519a('0x1a')],_0x8f4269;if(_0x5e5347>=_0x110558){_0x5e5347=_0x110558;_0x8f4269=0xc8;}else{_0x8f4269=0xce;}_0xec8df8[_0x519a('0x16')](_0x8f4269);return _0xec8df8[_0x519a('0x1b')](_0x519a('0x1c'),_0x5ee2a8+'-'+_0x5e5347+'/'+_0x110558)[_0x519a('0x18')](_0x7cade);}return null;};}function patchUpdates(_0x23a8f2){return function(_0x962f15){try{jsonpatch[_0x519a('0x1d')](_0x962f15,_0x23a8f2,!![]);}catch(_0x2ffc51){return BPromise[_0x519a('0x1e')](_0x2ffc51);}return _0x962f15[_0x519a('0x1f')]();};}function saveUpdates(_0x3af1a4,_0x3bff8e){return function(_0x14cde1){if(_0x14cde1){return _0x14cde1[_0x519a('0x20')](_0x3af1a4)['then'](function(_0x25ea68){return _0x25ea68;});}return null;};}function removeEntity(_0x3838bd,_0x40bd7b){return function(_0x548fc2){if(_0x548fc2){return _0x548fc2['destroy']()[_0x519a('0x21')](function(){_0x3838bd['status'](0xcc)[_0x519a('0x17')]();});}};}function handleEntityNotFound(_0x6da8e2,_0x36d13b){return function(_0x1b8a36){if(!_0x1b8a36){_0x6da8e2[_0x519a('0x15')](0x194);}return _0x1b8a36;};}function handleError(_0x1e36c0,_0x57f5b6){_0x57f5b6=_0x57f5b6||0x1f4;return function(_0x59e0eb){logger[_0x519a('0x22')](_0x59e0eb['stack']);if(_0x59e0eb[_0x519a('0x23')]){delete _0x59e0eb['name'];}_0x1e36c0[_0x519a('0x16')](_0x57f5b6)['send'](_0x59e0eb);};}exports['index']=function(_0x2811e0,_0x487ef8){var _0x40b181={},_0x10ffa3={},_0x3f93ac={'count':0x0,'rows':[]};var _0x319a94=db['UserProfileSection']['rawAttributes'];_0x10ffa3['model']=_[_0x519a('0x24')](_0x319a94);_0x10ffa3[_0x519a('0x25')]=_[_0x519a('0x24')](_0x2811e0[_0x519a('0x25')]);_0x10ffa3[_0x519a('0x26')]=_[_0x519a('0x27')](_0x10ffa3[_0x519a('0x28')],_0x10ffa3[_0x519a('0x25')]);_0x40b181['attributes']=_[_0x519a('0x27')](_0x10ffa3[_0x519a('0x28')],qs['fields'](_0x2811e0[_0x519a('0x25')][_0x519a('0x29')]));_0x40b181['attributes']=_0x40b181[_0x519a('0x2a')][_0x519a('0x2b')]?_0x40b181['attributes']:_0x10ffa3['model'];if(!_0x2811e0[_0x519a('0x25')][_0x519a('0x2c')](_0x519a('0x2d'))){_0x40b181[_0x519a('0x1a')]=qs[_0x519a('0x1a')](_0x2811e0[_0x519a('0x25')]['limit']);_0x40b181[_0x519a('0x19')]=qs[_0x519a('0x19')](_0x2811e0[_0x519a('0x25')][_0x519a('0x19')]);}_0x40b181[_0x519a('0x2e')]=qs[_0x519a('0x2f')](_0x2811e0[_0x519a('0x25')][_0x519a('0x2f')]);_0x40b181['where']=qs[_0x519a('0x26')](_[_0x519a('0x30')](_0x2811e0[_0x519a('0x25')],_0x10ffa3[_0x519a('0x26')]));if(_0x2811e0['query'][_0x519a('0x31')]){_0x40b181[_0x519a('0x32')]=_[_0x519a('0x33')](_0x40b181[_0x519a('0x32')],{'$or':_[_0x519a('0x34')](_0x319a94,function(_0x128ed3){if(_0x128ed3[_0x519a('0x35')][_0x519a('0x36')]!==_0x519a('0x37')){var _0x2ad3c0={};_0x2ad3c0[_0x128ed3[_0x519a('0x38')]]={'$like':'%'+_0x2811e0['query'][_0x519a('0x31')]+'%'};return _0x2ad3c0;}})});}_0x40b181=_[_0x519a('0x33')]({},_0x40b181,_0x2811e0[_0x519a('0x39')]);var _0x8711b2={'where':_0x40b181[_0x519a('0x32')]};return db[_0x519a('0x3a')][_0x519a('0x3b')](_0x8711b2)[_0x519a('0x21')](function(_0x36c92){_0x3f93ac[_0x519a('0x3b')]=_0x36c92;if(_0x2811e0[_0x519a('0x25')][_0x519a('0x3c')]){_0x40b181[_0x519a('0x3d')]=[{'all':!![]}];}return db[_0x519a('0x3a')][_0x519a('0x3e')](_0x40b181);})[_0x519a('0x21')](function(_0x272fe3){_0x3f93ac[_0x519a('0x3f')]=_0x272fe3;return _0x3f93ac;})[_0x519a('0x21')](respondWithFilteredResult(_0x487ef8,_0x40b181))['catch'](handleError(_0x487ef8,null));};exports[_0x519a('0x40')]=function(_0x8295fc,_0x304c31){var _0x169d75={'raw':![],'where':{'id':_0x8295fc[_0x519a('0x41')]['id']}},_0x240f11={};_0x240f11[_0x519a('0x28')]=_[_0x519a('0x24')](db[_0x519a('0x3a')][_0x519a('0x42')]);_0x240f11[_0x519a('0x25')]=_[_0x519a('0x24')](_0x8295fc[_0x519a('0x25')]);_0x240f11[_0x519a('0x26')]=_[_0x519a('0x27')](_0x240f11['model'],_0x240f11[_0x519a('0x25')]);_0x169d75[_0x519a('0x2a')]=_[_0x519a('0x27')](_0x240f11[_0x519a('0x28')],qs[_0x519a('0x29')](_0x8295fc[_0x519a('0x25')][_0x519a('0x29')]));_0x169d75[_0x519a('0x2a')]=_0x169d75[_0x519a('0x2a')][_0x519a('0x2b')]?_0x169d75[_0x519a('0x2a')]:_0x240f11['model'];if(_0x8295fc[_0x519a('0x25')][_0x519a('0x3c')]){_0x169d75['include']=[{'all':!![]}];}_0x169d75=_[_0x519a('0x33')]({},_0x169d75,_0x8295fc[_0x519a('0x39')]);return db[_0x519a('0x3a')][_0x519a('0x43')](_0x169d75)[_0x519a('0x21')](handleEntityNotFound(_0x304c31,null))[_0x519a('0x21')](respondWithResult(_0x304c31,null))[_0x519a('0x44')](handleError(_0x304c31,null));};exports['create']=function(_0x4a40e9,_0x80585f){return db['UserProfileSection']['create'](_0x4a40e9['body'],{})[_0x519a('0x21')](respondWithResult(_0x80585f,0xc9))[_0x519a('0x44')](handleError(_0x80585f,null));};exports[_0x519a('0x20')]=function(_0x5cf6e0,_0x26036f){if(_0x5cf6e0[_0x519a('0x45')]['id']){delete _0x5cf6e0[_0x519a('0x45')]['id'];}return db[_0x519a('0x3a')]['find']({'where':{'id':_0x5cf6e0[_0x519a('0x41')]['id']}})[_0x519a('0x21')](handleEntityNotFound(_0x26036f,null))[_0x519a('0x21')](saveUpdates(_0x5cf6e0[_0x519a('0x45')],null))['then'](respondWithResult(_0x26036f,null))[_0x519a('0x44')](handleError(_0x26036f,null));};exports[_0x519a('0x46')]=function(_0x41eeb4,_0x31721a){return db['UserProfileSection'][_0x519a('0x43')]({'where':{'id':_0x41eeb4[_0x519a('0x41')]['id']}})[_0x519a('0x21')](handleEntityNotFound(_0x31721a,null))[_0x519a('0x21')](removeEntity(_0x31721a,null))[_0x519a('0x44')](handleError(_0x31721a,null));};exports[_0x519a('0x47')]=function(_0x161122,_0x2f96a3){return db[_0x519a('0x3a')][_0x519a('0x47')]()['then'](respondWithResult(_0x2f96a3,null))['catch'](handleError(_0x2f96a3,null));};
\ No newline at end of file
+var _0xc23b=['map','type','merge','options','count','includeAll','include','findAll','rows','show','params','rawAttributes','keys','find','create','body','catch','html-pdf','rimraf','fast-json-patch','moment','bluebird','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','UserProfileSection','model','query','intersection','fields','attributes','length','nolimit','order','sort','filters','filter','where'];(function(_0x3807d1,_0x5010fe){var _0x48248f=function(_0x1fe6ad){while(--_0x1fe6ad){_0x3807d1['push'](_0x3807d1['shift']());}};_0x48248f(++_0x5010fe);}(_0xc23b,0x160));var _0xbc23=function(_0x347471,_0x1c9a02){_0x347471=_0x347471-0x0;var _0x422b6a=_0xc23b[_0x347471];return _0x422b6a;};'use strict';var pdf=require(_0xbc23('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbc23('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbc23('0x2'));var rp=require('request-promise');var moment=require(_0xbc23('0x3'));var BPromise=require(_0xbc23('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xbc23('0x5'));var csv=require('to-csv');var ejs=require(_0xbc23('0x6'));var fs=require('fs');var _=require(_0xbc23('0x7'));var squel=require(_0xbc23('0x8'));var crypto=require(_0xbc23('0x9'));var jsforce=require(_0xbc23('0xa'));var deskjs=require(_0xbc23('0xb'));var toCsv=require(_0xbc23('0xc'));var querystring=require(_0xbc23('0xd'));var Papa=require('papaparse');var authService=require(_0xbc23('0xe'));var hardwareService=require(_0xbc23('0xf'));var Redis=require(_0xbc23('0x10'));var qs=require(_0xbc23('0x11'));var logger=require(_0xbc23('0x12'))('api');var utils=require(_0xbc23('0x13'));var config=require(_0xbc23('0x14'));var db=require(_0xbc23('0x15'))['db'];function respondWithStatusCode(_0x105632,_0x24cf0b){_0x24cf0b=_0x24cf0b||0xcc;return function(_0x22f895){if(_0x22f895){return _0x105632['sendStatus'](_0x24cf0b);}return _0x105632[_0xbc23('0x16')](_0x24cf0b)[_0xbc23('0x17')]();};}function respondWithResult(_0x2d9757,_0x5223f3){_0x5223f3=_0x5223f3||0xc8;return function(_0x41b629){if(_0x41b629){return _0x2d9757['status'](_0x5223f3)[_0xbc23('0x18')](_0x41b629);}};}function respondWithFilteredResult(_0x53f412,_0x5d97e1){return function(_0x42cfef){if(_0x42cfef){var _0x10b4ee=_0x42cfef['count'],_0x80ffff=_0x5d97e1['offset'],_0x4ec91e=_0x5d97e1[_0xbc23('0x19')]+_0x5d97e1[_0xbc23('0x1a')],_0x4458e3;if(_0x4ec91e>=_0x10b4ee){_0x4ec91e=_0x10b4ee;_0x4458e3=0xc8;}else{_0x4458e3=0xce;}_0x53f412[_0xbc23('0x16')](_0x4458e3);return _0x53f412[_0xbc23('0x1b')](_0xbc23('0x1c'),_0x80ffff+'-'+_0x4ec91e+'/'+_0x10b4ee)[_0xbc23('0x18')](_0x42cfef);}return null;};}function patchUpdates(_0x1666f5){return function(_0xfdd3c4){try{jsonpatch['apply'](_0xfdd3c4,_0x1666f5,!![]);}catch(_0x4249fb){return BPromise['reject'](_0x4249fb);}return _0xfdd3c4[_0xbc23('0x1d')]();};}function saveUpdates(_0x14b775,_0x23927f){return function(_0x5ce6d7){if(_0x5ce6d7){return _0x5ce6d7[_0xbc23('0x1e')](_0x14b775)[_0xbc23('0x1f')](function(_0x2f7bd4){return _0x2f7bd4;});}return null;};}function removeEntity(_0xa3a197,_0x465a39){return function(_0x185b14){if(_0x185b14){return _0x185b14[_0xbc23('0x20')]()[_0xbc23('0x1f')](function(){_0xa3a197[_0xbc23('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5322dd,_0xae9958){return function(_0x1aa0ee){if(!_0x1aa0ee){_0x5322dd[_0xbc23('0x21')](0x194);}return _0x1aa0ee;};}function handleError(_0x1ce318,_0x3e534f){_0x3e534f=_0x3e534f||0x1f4;return function(_0x97c4aa){logger[_0xbc23('0x22')](_0x97c4aa[_0xbc23('0x23')]);if(_0x97c4aa[_0xbc23('0x24')]){delete _0x97c4aa['name'];}_0x1ce318[_0xbc23('0x16')](_0x3e534f)['send'](_0x97c4aa);};}exports['index']=function(_0x6c74dc,_0x46dbe6){var _0x28973c={},_0x3ff7={},_0x1272f0={'count':0x0,'rows':[]};var _0x5ac7e8=db[_0xbc23('0x25')]['rawAttributes'];_0x3ff7[_0xbc23('0x26')]=_['keys'](_0x5ac7e8);_0x3ff7[_0xbc23('0x27')]=_['keys'](_0x6c74dc[_0xbc23('0x27')]);_0x3ff7['filters']=_[_0xbc23('0x28')](_0x3ff7[_0xbc23('0x26')],_0x3ff7[_0xbc23('0x27')]);_0x28973c['attributes']=_['intersection'](_0x3ff7[_0xbc23('0x26')],qs['fields'](_0x6c74dc[_0xbc23('0x27')][_0xbc23('0x29')]));_0x28973c[_0xbc23('0x2a')]=_0x28973c['attributes'][_0xbc23('0x2b')]?_0x28973c['attributes']:_0x3ff7['model'];if(!_0x6c74dc[_0xbc23('0x27')]['hasOwnProperty'](_0xbc23('0x2c'))){_0x28973c['limit']=qs[_0xbc23('0x1a')](_0x6c74dc[_0xbc23('0x27')][_0xbc23('0x1a')]);_0x28973c[_0xbc23('0x19')]=qs['offset'](_0x6c74dc['query']['offset']);}_0x28973c[_0xbc23('0x2d')]=qs[_0xbc23('0x2e')](_0x6c74dc[_0xbc23('0x27')]['sort']);_0x28973c['where']=qs[_0xbc23('0x2f')](_['pick'](_0x6c74dc[_0xbc23('0x27')],_0x3ff7[_0xbc23('0x2f')]));if(_0x6c74dc[_0xbc23('0x27')][_0xbc23('0x30')]){_0x28973c['where']=_['merge'](_0x28973c[_0xbc23('0x31')],{'$or':_[_0xbc23('0x32')](_0x5ac7e8,function(_0xb0097d){if(_0xb0097d[_0xbc23('0x33')]['key']!=='VIRTUAL'){var _0x15bf15={};_0x15bf15[_0xb0097d['field']]={'$like':'%'+_0x6c74dc[_0xbc23('0x27')][_0xbc23('0x30')]+'%'};return _0x15bf15;}})});}_0x28973c=_[_0xbc23('0x34')]({},_0x28973c,_0x6c74dc[_0xbc23('0x35')]);var _0x568fec={'where':_0x28973c[_0xbc23('0x31')]};return db[_0xbc23('0x25')]['count'](_0x568fec)[_0xbc23('0x1f')](function(_0x50abd2){_0x1272f0[_0xbc23('0x36')]=_0x50abd2;if(_0x6c74dc[_0xbc23('0x27')][_0xbc23('0x37')]){_0x28973c[_0xbc23('0x38')]=[{'all':!![]}];}return db[_0xbc23('0x25')][_0xbc23('0x39')](_0x28973c);})[_0xbc23('0x1f')](function(_0x5ca758){_0x1272f0[_0xbc23('0x3a')]=_0x5ca758;return _0x1272f0;})[_0xbc23('0x1f')](respondWithFilteredResult(_0x46dbe6,_0x28973c))['catch'](handleError(_0x46dbe6,null));};exports[_0xbc23('0x3b')]=function(_0xcd73f0,_0x320872){var _0x5a6886={'raw':![],'where':{'id':_0xcd73f0[_0xbc23('0x3c')]['id']}},_0x590b0b={};_0x590b0b[_0xbc23('0x26')]=_['keys'](db[_0xbc23('0x25')][_0xbc23('0x3d')]);_0x590b0b[_0xbc23('0x27')]=_[_0xbc23('0x3e')](_0xcd73f0['query']);_0x590b0b[_0xbc23('0x2f')]=_['intersection'](_0x590b0b['model'],_0x590b0b[_0xbc23('0x27')]);_0x5a6886[_0xbc23('0x2a')]=_['intersection'](_0x590b0b[_0xbc23('0x26')],qs['fields'](_0xcd73f0[_0xbc23('0x27')][_0xbc23('0x29')]));_0x5a6886[_0xbc23('0x2a')]=_0x5a6886['attributes'][_0xbc23('0x2b')]?_0x5a6886[_0xbc23('0x2a')]:_0x590b0b[_0xbc23('0x26')];if(_0xcd73f0[_0xbc23('0x27')][_0xbc23('0x37')]){_0x5a6886[_0xbc23('0x38')]=[{'all':!![]}];}_0x5a6886=_[_0xbc23('0x34')]({},_0x5a6886,_0xcd73f0[_0xbc23('0x35')]);return db[_0xbc23('0x25')][_0xbc23('0x3f')](_0x5a6886)[_0xbc23('0x1f')](handleEntityNotFound(_0x320872,null))[_0xbc23('0x1f')](respondWithResult(_0x320872,null))['catch'](handleError(_0x320872,null));};exports['create']=function(_0xeec8e3,_0x3cb134){return db['UserProfileSection'][_0xbc23('0x40')](_0xeec8e3[_0xbc23('0x41')],{})[_0xbc23('0x1f')](respondWithResult(_0x3cb134,0xc9))[_0xbc23('0x42')](handleError(_0x3cb134,null));};exports[_0xbc23('0x1e')]=function(_0x33d6e2,_0x4d692c){if(_0x33d6e2['body']['id']){delete _0x33d6e2[_0xbc23('0x41')]['id'];}return db[_0xbc23('0x25')][_0xbc23('0x3f')]({'where':{'id':_0x33d6e2[_0xbc23('0x3c')]['id']}})['then'](handleEntityNotFound(_0x4d692c,null))[_0xbc23('0x1f')](saveUpdates(_0x33d6e2[_0xbc23('0x41')],null))[_0xbc23('0x1f')](respondWithResult(_0x4d692c,null))[_0xbc23('0x42')](handleError(_0x4d692c,null));};exports[_0xbc23('0x20')]=function(_0x53f3c3,_0x3f3aa7){return db[_0xbc23('0x25')][_0xbc23('0x3f')]({'where':{'id':_0x53f3c3[_0xbc23('0x3c')]['id']}})[_0xbc23('0x1f')](handleEntityNotFound(_0x3f3aa7,null))[_0xbc23('0x1f')](removeEntity(_0x3f3aa7,null))[_0xbc23('0x42')](handleError(_0x3f3aa7,null));};exports['describe']=function(_0x45a172,_0x27c4cc){return db[_0xbc23('0x25')]['describe']()[_0xbc23('0x1f')](respondWithResult(_0x27c4cc,null))['catch'](handleError(_0x27c4cc,null));};
\ No newline at end of file
index 14e74a3..7617f15 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd8c0=['api','bluebird','./userProfileSection.attributes','exports','UserProfileSection','user_profile_has_sections','sectionId','userProfileId','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8c0,0x76));var _0x0d8c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd8c0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0d8c('0x0'));var util=require(_0x0d8c('0x1'));var logger=require('../../config/logger')(_0x0d8c('0x2'));var moment=require('moment');var BPromise=require(_0x0d8c('0x3'));var rp=require('request-promise');var attributes=require(_0x0d8c('0x4'));module[_0x0d8c('0x5')]=function(_0x4f0f67,_0x30d918){return _0x4f0f67['define'](_0x0d8c('0x6'),attributes,{'tableName':_0x0d8c('0x7'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x0d8c('0x8'),_0x0d8c('0x9')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xe3d7=['UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','util','../../config/logger','api','moment','bluebird','request-promise','./userProfileSection.attributes','define'];(function(_0x5ad220,_0x27407e){var _0xdec77d=function(_0x58d736){while(--_0x58d736){_0x5ad220['push'](_0x5ad220['shift']());}};_0xdec77d(++_0x27407e);}(_0xe3d7,0x109));var _0x7e3d=function(_0x16f467,_0x52679c){_0x16f467=_0x16f467-0x0;var _0x49a744=_0xe3d7[_0x16f467];return _0x49a744;};'use strict';var _=require('lodash');var util=require(_0x7e3d('0x0'));var logger=require(_0x7e3d('0x1'))(_0x7e3d('0x2'));var moment=require(_0x7e3d('0x3'));var BPromise=require(_0x7e3d('0x4'));var rp=require(_0x7e3d('0x5'));var attributes=require(_0x7e3d('0x6'));module['exports']=function(_0x17d2f7,_0xee216b){return _0x17d2f7[_0x7e3d('0x7')](_0x7e3d('0x8'),attributes,{'tableName':_0x7e3d('0x9'),'paranoid':![],'indexes':[{'name':_0x7e3d('0xa'),'fields':[_0x7e3d('0xb'),_0x7e3d('0xc')]}],'timestamps':!![]});};
\ No newline at end of file
index 01752dc..5cf6e2e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3adf=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x3adf,0x1a6));var _0xf3ad=function(_0x334672,_0x42f550){_0x334672=_0x334672-0x0;var _0x7cb6dc=_0x3adf[_0x334672];return _0x7cb6dc;};'use strict';var _=require(_0xf3ad('0x0'));var util=require(_0xf3ad('0x1'));var moment=require(_0xf3ad('0x2'));var BPromise=require(_0xf3ad('0x3'));var rs=require(_0xf3ad('0x4'));var fs=require('fs');var Redis=require(_0xf3ad('0x5'));var db=require(_0xf3ad('0x6'))['db'];var utils=require(_0xf3ad('0x7'));var logger=require(_0xf3ad('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x23d40f,_0x5c7928,_0x271a91){return new BPromise(function(_0x54a71b,_0x3f5d1c){return client[_0xf3ad('0x9')](_0x23d40f,_0x271a91)[_0xf3ad('0xa')](function(_0xec5ffa){logger[_0xf3ad('0xb')](_0xf3ad('0xc'),_0x5c7928,_0xf3ad('0xd'));logger[_0xf3ad('0xe')](_0xf3ad('0xf'),_0x5c7928,_0xf3ad('0xd'),JSON['stringify'](_0xec5ffa));if(_0xec5ffa[_0xf3ad('0x10')]){if(_0xec5ffa[_0xf3ad('0x10')][_0xf3ad('0x11')]===0x1f4){logger[_0xf3ad('0x10')](_0xf3ad('0xc'),_0x5c7928,_0xec5ffa[_0xf3ad('0x10')][_0xf3ad('0x12')]);return _0x3f5d1c(_0xec5ffa['error'][_0xf3ad('0x12')]);}logger[_0xf3ad('0x10')](_0xf3ad('0xc'),_0x5c7928,_0xec5ffa[_0xf3ad('0x10')][_0xf3ad('0x12')]);return _0x54a71b(_0xec5ffa[_0xf3ad('0x10')][_0xf3ad('0x12')]);}else{logger[_0xf3ad('0xb')](_0xf3ad('0xc'),_0x5c7928,_0xf3ad('0xd'));_0x54a71b(_0xec5ffa[_0xf3ad('0x13')][_0xf3ad('0x12')]);}})[_0xf3ad('0x14')](function(_0x4df05e){logger[_0xf3ad('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x5c7928,_0x4df05e);_0x3f5d1c(_0x4df05e);});});}
\ No newline at end of file
+var _0xfa78=['stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x414554,_0x2216ff){var _0x2ccba5=function(_0x5441b9){while(--_0x5441b9){_0x414554['push'](_0x414554['shift']());}};_0x2ccba5(++_0x2216ff);}(_0xfa78,0x1d4));var _0x8fa7=function(_0xf3613b,_0x1c2b71){_0xf3613b=_0xf3613b-0x0;var _0x299eac=_0xfa78[_0xf3613b];return _0x299eac;};'use strict';var _=require('lodash');var util=require(_0x8fa7('0x0'));var moment=require(_0x8fa7('0x1'));var BPromise=require(_0x8fa7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8fa7('0x3'));var db=require(_0x8fa7('0x4'))['db'];var utils=require(_0x8fa7('0x5'));var logger=require('../../config/logger')(_0x8fa7('0x6'));var config=require(_0x8fa7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8fa7('0x8')][_0x8fa7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1bc857,_0x4091c4,_0x19a0b9){return new BPromise(function(_0x406213,_0x4ac872){return client[_0x8fa7('0xa')](_0x1bc857,_0x19a0b9)['then'](function(_0x4a0a2d){logger[_0x8fa7('0xb')](_0x8fa7('0xc'),_0x4091c4,_0x8fa7('0xd'));logger[_0x8fa7('0xe')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x4091c4,_0x8fa7('0xd'),JSON[_0x8fa7('0xf')](_0x4a0a2d));if(_0x4a0a2d[_0x8fa7('0x10')]){if(_0x4a0a2d['error'][_0x8fa7('0x11')]===0x1f4){logger[_0x8fa7('0x10')](_0x8fa7('0xc'),_0x4091c4,_0x4a0a2d[_0x8fa7('0x10')][_0x8fa7('0x12')]);return _0x4ac872(_0x4a0a2d['error'][_0x8fa7('0x12')]);}logger[_0x8fa7('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x4091c4,_0x4a0a2d['error'][_0x8fa7('0x12')]);return _0x406213(_0x4a0a2d[_0x8fa7('0x10')][_0x8fa7('0x12')]);}else{logger[_0x8fa7('0xb')](_0x8fa7('0xc'),_0x4091c4,_0x8fa7('0xd'));_0x406213(_0x4a0a2d[_0x8fa7('0x13')][_0x8fa7('0x12')]);}})[_0x8fa7('0x14')](function(_0x58a229){logger[_0x8fa7('0x10')](_0x8fa7('0xc'),_0x4091c4,_0x58a229);_0x4ac872(_0x58a229);});});}
\ No newline at end of file
index aaf9ae7..a685750 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7b84=['../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x7b84,0x17c));var _0x47b8=function(_0x10c2c8,_0x214e47){_0x10c2c8=_0x10c2c8-0x0;var _0x2946ef=_0x7b84[_0x10c2c8];return _0x2946ef;};'use strict';var multer=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var path=require(_0x47b8('0x2'));var timeout=require(_0x47b8('0x3'));var express=require(_0x47b8('0x4'));var router=express[_0x47b8('0x5')]();var auth=require(_0x47b8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x47b8('0x7'));module[_0x47b8('0x8')]=router;
\ No newline at end of file
+var _0x7a54=['path','express','Router','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x46a143,_0x2c8a99){_0x46a143=_0x46a143-0x0;var _0x4036fa=_0x7a54[_0x46a143];return _0x4036fa;};'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 auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));module[_0x47a5('0x7')]=router;
\ No newline at end of file
index 630e4b3..b6ab1a7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe130=['INTEGER','sequelize','exports'];(function(_0x8e8ca7,_0x5a5e07){var _0x561381=function(_0x2f4bda){while(--_0x2f4bda){_0x8e8ca7['push'](_0x8e8ca7['shift']());}};_0x561381(++_0x5a5e07);}(_0xe130,0x1db));var _0x0e13=function(_0x495994,_0x21ba58){_0x495994=_0x495994-0x0;var _0x13b6c9=_0xe130[_0x495994];return _0x13b6c9;};'use strict';var Sequelize=require(_0x0e13('0x0'));module[_0x0e13('0x1')]={'penalty':{'type':Sequelize[_0x0e13('0x2')],'defaultValue':0x0}};
\ No newline at end of file
+var _0x3eb1=['exports'];(function(_0x1236b9,_0x5dabc2){var _0x1c8736=function(_0x4a82ba){while(--_0x4a82ba){_0x1236b9['push'](_0x1236b9['shift']());}};_0x1c8736(++_0x5dabc2);}(_0x3eb1,0x9c));var _0x13eb=function(_0x4bd06e,_0x593701){_0x4bd06e=_0x4bd06e-0x0;var _0x85ebb=_0x3eb1[_0x4bd06e];return _0x85ebb;};'use strict';var Sequelize=require('sequelize');module[_0x13eb('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}};
\ No newline at end of file
index 6d016a8..d5d7bcc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x930a=['UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','moment','./userSmsQueue.attributes','exports'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x930a,0x13a));var _0xa930=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x930a[_0x413feb];return _0x40ee88;};'use strict';var _=require('lodash');var util=require(_0xa930('0x0'));var logger=require(_0xa930('0x1'))(_0xa930('0x2'));var moment=require(_0xa930('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xa930('0x4'));module[_0xa930('0x5')]=function(_0x2656d2,_0x23c52e){return _0x2656d2['define'](_0xa930('0x6'),attributes,{'tableName':_0xa930('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x0c22=['../../config/logger','api','moment','bluebird','request-promise','exports','define','UserSmsQueue','user_has_sms_queues','util'];(function(_0x26b240,_0x4d8775){var _0x75734a=function(_0x49700a){while(--_0x49700a){_0x26b240['push'](_0x26b240['shift']());}};_0x75734a(++_0x4d8775);}(_0x0c22,0x1c1));var _0x20c2=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0c22[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0x20c2('0x0'));var logger=require(_0x20c2('0x1'))(_0x20c2('0x2'));var moment=require(_0x20c2('0x3'));var BPromise=require(_0x20c2('0x4'));var rp=require(_0x20c2('0x5'));var attributes=require('./userSmsQueue.attributes');module[_0x20c2('0x6')]=function(_0x1d4437,_0xb8fe2f){return _0x1d4437[_0x20c2('0x7')](_0x20c2('0x8'),attributes,{'tableName':_0x20c2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 1785be1..2ac38af 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6469=['UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6469,0x1ab));var _0x9646=function(_0xdd7388,_0x343813){_0xdd7388=_0xdd7388-0x0;var _0x21c968=_0x6469[_0xdd7388];return _0x21c968;};'use strict';var _=require('lodash');var util=require(_0x9646('0x0'));var moment=require(_0x9646('0x1'));var BPromise=require(_0x9646('0x2'));var rs=require(_0x9646('0x3'));var fs=require('fs');var Redis=require(_0x9646('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9646('0x5'));var logger=require(_0x9646('0x6'))('rpc');var config=require(_0x9646('0x7'));var jayson=require(_0x9646('0x8'));var client=jayson[_0x9646('0x9')][_0x9646('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a4ee2,_0x319e8d,_0x52e4bc){return new BPromise(function(_0x5509bd,_0x465377){return client[_0x9646('0xb')](_0x3a4ee2,_0x52e4bc)[_0x9646('0xc')](function(_0x5e1f9d){logger[_0x9646('0xd')](_0x9646('0xe'),_0x319e8d,_0x9646('0xf'));logger[_0x9646('0x10')](_0x9646('0x11'),_0x319e8d,_0x9646('0xf'),JSON['stringify'](_0x5e1f9d));if(_0x5e1f9d['error']){if(_0x5e1f9d[_0x9646('0x12')]['code']===0x1f4){logger[_0x9646('0x12')](_0x9646('0xe'),_0x319e8d,_0x5e1f9d['error'][_0x9646('0x13')]);return _0x465377(_0x5e1f9d[_0x9646('0x12')]['message']);}logger[_0x9646('0x12')](_0x9646('0xe'),_0x319e8d,_0x5e1f9d['error'][_0x9646('0x13')]);return _0x5509bd(_0x5e1f9d[_0x9646('0x12')][_0x9646('0x13')]);}else{logger[_0x9646('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x319e8d,_0x9646('0xf'));_0x5509bd(_0x5e1f9d[_0x9646('0x14')][_0x9646('0x13')]);}})['catch'](function(_0x3306f1){logger[_0x9646('0x12')](_0x9646('0xe'),_0x319e8d,_0x3306f1);_0x465377(_0x3306f1);});});}
\ No newline at end of file
+var _0x3b96=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x496f2c,_0x333179){var _0x242388=function(_0x13f0a4){while(--_0x13f0a4){_0x496f2c['push'](_0x496f2c['shift']());}};_0x242388(++_0x333179);}(_0x3b96,0xbd));var _0x63b9=function(_0x59dd15,_0x4ff69e){_0x59dd15=_0x59dd15-0x0;var _0x28d93d=_0x3b96[_0x59dd15];return _0x28d93d;};'use strict';var _=require(_0x63b9('0x0'));var util=require('util');var moment=require(_0x63b9('0x1'));var BPromise=require(_0x63b9('0x2'));var rs=require(_0x63b9('0x3'));var fs=require('fs');var Redis=require(_0x63b9('0x4'));var db=require(_0x63b9('0x5'))['db'];var utils=require(_0x63b9('0x6'));var logger=require(_0x63b9('0x7'))(_0x63b9('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x63b9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a086c,_0x4e8117,_0x275b29){return new BPromise(function(_0xf62eaf,_0xe584c1){return client[_0x63b9('0xa')](_0x1a086c,_0x275b29)['then'](function(_0x459265){logger[_0x63b9('0xb')](_0x63b9('0xc'),_0x4e8117,_0x63b9('0xd'));logger[_0x63b9('0xe')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x4e8117,'request\x20sent',JSON[_0x63b9('0xf')](_0x459265));if(_0x459265[_0x63b9('0x10')]){if(_0x459265[_0x63b9('0x10')][_0x63b9('0x11')]===0x1f4){logger[_0x63b9('0x10')](_0x63b9('0xc'),_0x4e8117,_0x459265[_0x63b9('0x10')]['message']);return _0xe584c1(_0x459265[_0x63b9('0x10')][_0x63b9('0x12')]);}logger[_0x63b9('0x10')](_0x63b9('0xc'),_0x4e8117,_0x459265[_0x63b9('0x10')][_0x63b9('0x12')]);return _0xf62eaf(_0x459265['error']['message']);}else{logger[_0x63b9('0xb')](_0x63b9('0xc'),_0x4e8117,_0x63b9('0xd'));_0xf62eaf(_0x459265[_0x63b9('0x13')]['message']);}})[_0x63b9('0x14')](function(_0x37d79d){logger[_0x63b9('0x10')](_0x63b9('0xc'),_0x4e8117,_0x37d79d);_0xe584c1(_0x37d79d);});});}
\ No newline at end of file
index 8fadb5f..ad0de96 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0650=['path','connect-timeout','Router','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0650,0xed));var _0x0065=function(_0x21363f,_0x41a233){_0x21363f=_0x21363f-0x0;var _0x3a6aad=_0x0650[_0x21363f];return _0x3a6aad;};'use strict';var multer=require(_0x0065('0x0'));var util=require('util');var path=require(_0x0065('0x1'));var timeout=require(_0x0065('0x2'));var express=require('express');var router=express[_0x0065('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0065('0x4'));var config=require(_0x0065('0x5'));module[_0x0065('0x6')]=router;
\ No newline at end of file
+var _0xd9fb=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports','multer','util','path'];(function(_0x16ea3e,_0x35ab2f){var _0x713c5=function(_0x5ac6b0){while(--_0x5ac6b0){_0x16ea3e['push'](_0x16ea3e['shift']());}};_0x713c5(++_0x35ab2f);}(_0xd9fb,0x189));var _0xbd9f=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xd9fb[_0x173441];return _0x2423a8;};'use strict';var multer=require(_0xbd9f('0x0'));var util=require(_0xbd9f('0x1'));var path=require(_0xbd9f('0x2'));var timeout=require(_0xbd9f('0x3'));var express=require(_0xbd9f('0x4'));var router=express[_0xbd9f('0x5')]();var auth=require(_0xbd9f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbd9f('0x7'));module[_0xbd9f('0x8')]=router;
\ No newline at end of file
index 50764f5..358fcb4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2252=['INTEGER','sequelize'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x2252,0x9b));var _0x2225=function(_0x309e20,_0x4f1ff3){_0x309e20=_0x309e20-0x0;var _0x2af783=_0x2252[_0x309e20];return _0x2af783;};'use strict';var Sequelize=require(_0x2225('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x2225('0x1')],'defaultValue':0x0}};
\ No newline at end of file
+var _0x79b0=['INTEGER','sequelize'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x79b0,0x111));var _0x079b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x79b0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x079b('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x079b('0x1')],'defaultValue':0x0}};
\ No newline at end of file
index 0f39a27..5718c4f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5fad=['../../config/logger','api','moment','bluebird','request-promise','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','util'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x5fad,0x171));var _0xd5fa=function(_0x21cc45,_0x22eff2){_0x21cc45=_0x21cc45-0x0;var _0x169c76=_0x5fad[_0x21cc45];return _0x169c76;};'use strict';var _=require('lodash');var util=require(_0xd5fa('0x0'));var logger=require(_0xd5fa('0x1'))(_0xd5fa('0x2'));var moment=require(_0xd5fa('0x3'));var BPromise=require(_0xd5fa('0x4'));var rp=require(_0xd5fa('0x5'));var attributes=require(_0xd5fa('0x6'));module[_0xd5fa('0x7')]=function(_0x3548d5,_0x15122e){return _0x3548d5[_0xd5fa('0x8')](_0xd5fa('0x9'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x781e=['UserVoiceQueue','user_has_voice_queues','lodash','util','api','moment','request-promise','./userVoiceQueue.attributes','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x781e,0xda));var _0xe781=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x781e[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xe781('0x0'));var util=require(_0xe781('0x1'));var logger=require('../../config/logger')(_0xe781('0x2'));var moment=require(_0xe781('0x3'));var BPromise=require('bluebird');var rp=require(_0xe781('0x4'));var attributes=require(_0xe781('0x5'));module['exports']=function(_0x116570,_0x207abf){return _0x116570[_0xe781('0x6')](_0xe781('0x7'),attributes,{'tableName':_0xe781('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 9038411..59cce0b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc34c=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring'];(function(_0x23a673,_0x31e4bc){var _0x2213b7=function(_0x3c5dcc){while(--_0x3c5dcc){_0x23a673['push'](_0x23a673['shift']());}};_0x2213b7(++_0x31e4bc);}(_0xc34c,0x131));var _0xcc34=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xc34c[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xcc34('0x0'));var util=require('util');var moment=require(_0xcc34('0x1'));var BPromise=require('bluebird');var rs=require(_0xcc34('0x2'));var fs=require('fs');var Redis=require(_0xcc34('0x3'));var db=require(_0xcc34('0x4'))['db'];var utils=require(_0xcc34('0x5'));var logger=require('../../config/logger')(_0xcc34('0x6'));var config=require(_0xcc34('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcc34('0x8')][_0xcc34('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b8f1d,_0x9b5180,_0x2b94f6){return new BPromise(function(_0x5e3ebc,_0x43b74d){return client['request'](_0x4b8f1d,_0x2b94f6)[_0xcc34('0xa')](function(_0x558194){logger[_0xcc34('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x9b5180,_0xcc34('0xc'));logger[_0xcc34('0xd')](_0xcc34('0xe'),_0x9b5180,_0xcc34('0xc'),JSON[_0xcc34('0xf')](_0x558194));if(_0x558194[_0xcc34('0x10')]){if(_0x558194[_0xcc34('0x10')][_0xcc34('0x11')]===0x1f4){logger[_0xcc34('0x10')](_0xcc34('0x12'),_0x9b5180,_0x558194[_0xcc34('0x10')][_0xcc34('0x13')]);return _0x43b74d(_0x558194['error'][_0xcc34('0x13')]);}logger[_0xcc34('0x10')](_0xcc34('0x12'),_0x9b5180,_0x558194[_0xcc34('0x10')][_0xcc34('0x13')]);return _0x5e3ebc(_0x558194[_0xcc34('0x10')][_0xcc34('0x13')]);}else{logger[_0xcc34('0xb')](_0xcc34('0x12'),_0x9b5180,'request\x20sent');_0x5e3ebc(_0x558194[_0xcc34('0x14')][_0xcc34('0x13')]);}})[_0xcc34('0x15')](function(_0xedb424){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x9b5180,_0xedb424);_0x43b74d(_0xedb424);});});}
\ No newline at end of file
+var _0xeb8c=['result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','message'];(function(_0xcebe89,_0x59a469){var _0x47dfa3=function(_0xfaba77){while(--_0xfaba77){_0xcebe89['push'](_0xcebe89['shift']());}};_0x47dfa3(++_0x59a469);}(_0xeb8c,0xce));var _0xceb8=function(_0x54ccdd,_0x1b32db){_0x54ccdd=_0x54ccdd-0x0;var _0x2e87d8=_0xeb8c[_0x54ccdd];return _0x2e87d8;};'use strict';var _=require('lodash');var util=require(_0xceb8('0x0'));var moment=require(_0xceb8('0x1'));var BPromise=require(_0xceb8('0x2'));var rs=require(_0xceb8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xceb8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xceb8('0x5'))(_0xceb8('0x6'));var config=require(_0xceb8('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xceb8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x50be98,_0x2f5e90,_0x57bfc3){return new BPromise(function(_0x5584c4,_0x7332b6){return client['request'](_0x50be98,_0x57bfc3)['then'](function(_0x684958){logger[_0xceb8('0x9')]('UserVoiceQueue,\x20%s,\x20%s',_0x2f5e90,_0xceb8('0xa'));logger[_0xceb8('0xb')](_0xceb8('0xc'),_0x2f5e90,_0xceb8('0xa'),JSON['stringify'](_0x684958));if(_0x684958[_0xceb8('0xd')]){if(_0x684958[_0xceb8('0xd')]['code']===0x1f4){logger[_0xceb8('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x2f5e90,_0x684958[_0xceb8('0xd')][_0xceb8('0xe')]);return _0x7332b6(_0x684958[_0xceb8('0xd')][_0xceb8('0xe')]);}logger[_0xceb8('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x2f5e90,_0x684958[_0xceb8('0xd')][_0xceb8('0xe')]);return _0x5584c4(_0x684958[_0xceb8('0xd')]['message']);}else{logger[_0xceb8('0x9')]('UserVoiceQueue,\x20%s,\x20%s',_0x2f5e90,_0xceb8('0xa'));_0x5584c4(_0x684958[_0xceb8('0xf')][_0xceb8('0xe')]);}})[_0xceb8('0x10')](function(_0x2c005a){logger[_0xceb8('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x2f5e90,_0x2c005a);_0x7332b6(_0x2c005a);});});}
\ No newline at end of file
index 0ce5125..2500594 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2525=['../../config/environment','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x241d88,_0x44b2ea){var _0x1028fc=function(_0x4a7bb1){while(--_0x4a7bb1){_0x241d88['push'](_0x241d88['shift']());}};_0x1028fc(++_0x44b2ea);}(_0x2525,0x1f0));var _0x5252=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x2525[_0x31e29a];return _0x32d892;};'use strict';var multer=require(_0x5252('0x0'));var util=require(_0x5252('0x1'));var path=require(_0x5252('0x2'));var timeout=require(_0x5252('0x3'));var express=require(_0x5252('0x4'));var router=express[_0x5252('0x5')]();var auth=require(_0x5252('0x6'));var interaction=require(_0x5252('0x7'));var config=require(_0x5252('0x8'));module['exports']=router;
\ No newline at end of file
+var _0xcaaf=['../../components/auth/service','../../config/environment','multer','path','Router'];(function(_0x37ef2f,_0x23822e){var _0x5943c4=function(_0x48e2d1){while(--_0x48e2d1){_0x37ef2f['push'](_0x37ef2f['shift']());}};_0x5943c4(++_0x23822e);}(_0xcaaf,0x66));var _0xfcaa=function(_0x106cd5,_0x90baca){_0x106cd5=_0x106cd5-0x0;var _0x5b1516=_0xcaaf[_0x106cd5];return _0x5b1516;};'use strict';var multer=require(_0xfcaa('0x0'));var util=require('util');var path=require(_0xfcaa('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfcaa('0x2')]();var auth=require(_0xfcaa('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xfcaa('0x4'));module['exports']=router;
\ No newline at end of file
index e692c26..389b7a6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2b0c=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports','INTEGER'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x2b0c,0x1a1));var _0xc2b0=function(_0x2134b7,_0x1eb5e2){_0x2134b7=_0x2134b7-0x0;var _0x6c5914=_0x2b0c[_0x2134b7];return _0x6c5914;};'use strict';var Sequelize=require(_0xc2b0('0x0'));module[_0xc2b0('0x1')]={'uniqueid':{'type':Sequelize[_0xc2b0('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xc2b0('0x3')},'membername':{'type':Sequelize[_0xc2b0('0x4')],'allowNull':![],'comment':_0xc2b0('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xc2b0('0x4')],'allowNull':![],'unique':_0xc2b0('0x5'),'comment':_0xc2b0('0x3')},'VoiceQueueId':{'type':Sequelize[_0xc2b0('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xc2b0('0x4')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xc2b0('0x2')](0xb),'defaultValue':0x0,'comment':_0xc2b0('0x3')},'paused':{'type':Sequelize[_0xc2b0('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}};
\ No newline at end of file
+var _0xc42e=['INTEGER','queue_interface','exports','Required\x20by\x20Asterisk','STRING'];(function(_0x16637f,_0x2ce106){var _0x424067=function(_0x1773e8){while(--_0x1773e8){_0x16637f['push'](_0x16637f['shift']());}};_0x424067(++_0x2ce106);}(_0xc42e,0x13d));var _0xec42=function(_0xe2e5a7,_0x213d71){_0xe2e5a7=_0xe2e5a7-0x0;var _0x1658e5=_0xc42e[_0xe2e5a7];return _0x1658e5;};'use strict';var Sequelize=require('sequelize');module[_0xec42('0x0')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0xec42('0x1')},'membername':{'type':Sequelize[_0xec42('0x2')],'allowNull':![],'comment':_0xec42('0x1')},'UserId':{'type':Sequelize[_0xec42('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0xec42('0x1')},'VoiceQueueId':{'type':Sequelize[_0xec42('0x3')],'allowNull':![]},'interface':{'type':Sequelize[_0xec42('0x2')],'allowNull':![],'unique':_0xec42('0x4'),'comment':_0xec42('0x1')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xec42('0x1')},'paused':{'type':Sequelize[_0xec42('0x3')](0xb),'defaultValue':0x0,'comment':_0xec42('0x1')}};
\ No newline at end of file
index 842abf1..f2a1399 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x25b1=['emit','hook','events','../../mysqldb','UserVoiceQueueRt','save','update','remove'];(function(_0x50ec47,_0x6b2ba4){var _0x4274a1=function(_0x5e0909){while(--_0x5e0909){_0x50ec47['push'](_0x50ec47['shift']());}};_0x4274a1(++_0x6b2ba4);}(_0x25b1,0x1da));var _0x125b=function(_0x256057,_0x164e78){_0x256057=_0x256057-0x0;var _0xe7f4d3=_0x25b1[_0x256057];return _0xe7f4d3;};'use strict';var EventEmitter=require(_0x125b('0x0'));var UserVoiceQueueRt=require(_0x125b('0x1'))['db'][_0x125b('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x125b('0x3'),'afterUpdate':_0x125b('0x4'),'afterDestroy':_0x125b('0x5')};function emitEvent(_0x2307a6){return function(_0x250fc7,_0x216029,_0x2da6a1){UserVoiceQueueRtEvents['emit'](_0x2307a6+':'+_0x250fc7['id'],_0x250fc7);UserVoiceQueueRtEvents[_0x125b('0x6')](_0x2307a6,_0x250fc7);_0x2da6a1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x125b('0x7')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents;
\ No newline at end of file
+var _0x0b42=['save','remove','hook','exports','events','UserVoiceQueueRt','setMaxListeners'];(function(_0x19a48d,_0x54ab53){var _0x231729=function(_0xd2949f){while(--_0xd2949f){_0x19a48d['push'](_0x19a48d['shift']());}};_0x231729(++_0x54ab53);}(_0x0b42,0x10e));var _0x20b4=function(_0x1779e4,_0x253056){_0x1779e4=_0x1779e4-0x0;var _0x415255=_0x0b42[_0x1779e4];return _0x415255;};'use strict';var EventEmitter=require(_0x20b4('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x20b4('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x20b4('0x2')](0x0);var events={'afterCreate':_0x20b4('0x3'),'afterUpdate':'update','afterDestroy':_0x20b4('0x4')};function emitEvent(_0xc30c18){return function(_0x77a431,_0x531986,_0x4ea9a7){UserVoiceQueueRtEvents['emit'](_0xc30c18+':'+_0x77a431['id'],_0x77a431);UserVoiceQueueRtEvents['emit'](_0xc30c18,_0x77a431);_0x4ea9a7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x20b4('0x5')](e,emitEvent(event));}}module[_0x20b4('0x6')]=UserVoiceQueueRtEvents;
\ No newline at end of file
index b5f2f12..c9abdb7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x455a=['util','api','moment','request-promise','exports','define','user_has_voice_queues_rt','lodash'];(function(_0x5beb86,_0x10db7c){var _0x2aeb7d=function(_0x1472f3){while(--_0x1472f3){_0x5beb86['push'](_0x5beb86['shift']());}};_0x2aeb7d(++_0x10db7c);}(_0x455a,0x7f));var _0xa455=function(_0x534817,_0x55cc0a){_0x534817=_0x534817-0x0;var _0x4e3ecb=_0x455a[_0x534817];return _0x4e3ecb;};'use strict';var _=require(_0xa455('0x0'));var util=require(_0xa455('0x1'));var logger=require('../../config/logger')(_0xa455('0x2'));var moment=require(_0xa455('0x3'));var BPromise=require('bluebird');var rp=require(_0xa455('0x4'));var attributes=require('./userVoiceQueueRt.attributes');module[_0xa455('0x5')]=function(_0x37c75e,_0x1987e4){return _0x37c75e[_0xa455('0x6')]('UserVoiceQueueRt',attributes,{'tableName':_0xa455('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x9a76=['user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','./userVoiceQueueRt.attributes','define'];(function(_0x538cac,_0x581ad1){var _0x554759=function(_0x25eb48){while(--_0x25eb48){_0x538cac['push'](_0x538cac['shift']());}};_0x554759(++_0x581ad1);}(_0x9a76,0x184));var _0x69a7=function(_0x3e8f4d,_0x3e418a){_0x3e8f4d=_0x3e8f4d-0x0;var _0x484a14=_0x9a76[_0x3e8f4d];return _0x484a14;};'use strict';var _=require(_0x69a7('0x0'));var util=require(_0x69a7('0x1'));var logger=require(_0x69a7('0x2'))(_0x69a7('0x3'));var moment=require(_0x69a7('0x4'));var BPromise=require(_0x69a7('0x5'));var rp=require('request-promise');var attributes=require(_0x69a7('0x6'));module['exports']=function(_0x5006ef,_0x560e54){return _0x5006ef[_0x69a7('0x7')]('UserVoiceQueueRt',attributes,{'tableName':_0x69a7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 2a1181c..8fdfbb3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5c25=['GetVoiceQueueRtPauses','findAll','options','raw','where','COUNT','sequelize','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','stringify','catch','lodash','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','request','then','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','UserVoiceQueueRt,\x20%s,\x20%s','info','result'];(function(_0x5b3820,_0x51889c){var _0x442af8=function(_0x597ee1){while(--_0x597ee1){_0x5b3820['push'](_0x5b3820['shift']());}};_0x442af8(++_0x51889c);}(_0x5c25,0x181));var _0x55c2=function(_0x498e1c,_0xd545ca){_0x498e1c=_0x498e1c-0x0;var _0xb11ed3=_0x5c25[_0x498e1c];return _0xb11ed3;};'use strict';var _=require(_0x55c2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x55c2('0x1'));var db=require(_0x55c2('0x2'))['db'];var utils=require(_0x55c2('0x3'));var logger=require('../../config/logger')(_0x55c2('0x4'));var config=require(_0x55c2('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x55c2('0x6')][_0x55c2('0x7')]({'port':0x232a});config[_0x55c2('0x8')]=_[_0x55c2('0x9')](config[_0x55c2('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x55c2('0xa'))(new Redis(config[_0x55c2('0x8')]));require('./userVoiceQueueRt.socket')[_0x55c2('0xb')](socket);function respondWithRpcPromise(_0x26c0ba,_0x48999c,_0x294528){return new BPromise(function(_0x1ebaf3,_0x5a850c){return client[_0x55c2('0xc')](_0x26c0ba,_0x294528)[_0x55c2('0xd')](function(_0x41c4d0){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x48999c,'request\x20sent');logger[_0x55c2('0xe')](_0x55c2('0xf'),_0x48999c,_0x55c2('0x10'),JSON['stringify'](_0x41c4d0));if(_0x41c4d0['error']){if(_0x41c4d0['error'][_0x55c2('0x11')]===0x1f4){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x48999c,_0x41c4d0[_0x55c2('0x12')][_0x55c2('0x13')]);return _0x5a850c(_0x41c4d0[_0x55c2('0x12')][_0x55c2('0x13')]);}logger[_0x55c2('0x12')](_0x55c2('0x14'),_0x48999c,_0x41c4d0[_0x55c2('0x12')]['message']);return _0x1ebaf3(_0x41c4d0[_0x55c2('0x12')][_0x55c2('0x13')]);}else{logger[_0x55c2('0x15')](_0x55c2('0x14'),_0x48999c,_0x55c2('0x10'));_0x1ebaf3(_0x41c4d0[_0x55c2('0x16')]['message']);}})['catch'](function(_0x1a5955){logger[_0x55c2('0x12')](_0x55c2('0x14'),_0x48999c,_0x1a5955);_0x5a850c(_0x1a5955);});});}exports[_0x55c2('0x17')]=function(_0x427c81){var _0x13a8c2=this;return new Promise(function(_0x5e180d,_0x90ecd1){return db['UserVoiceQueueRt'][_0x55c2('0x18')]({'raw':_0x427c81[_0x55c2('0x19')]?_0x427c81[_0x55c2('0x19')][_0x55c2('0x1a')]===undefined?!![]:![]:!![],'where':_0x427c81[_0x55c2('0x19')]?_0x427c81[_0x55c2('0x19')][_0x55c2('0x1b')]||null:null,'attributes':[[db['sequelize']['fn'](_0x55c2('0x1c'),db[_0x55c2('0x1d')]['fn']('IF',db[_0x55c2('0x1d')]['literal'](_0x55c2('0x1e')))),_0x55c2('0x1f')]]})['then'](function(_0x1e2881){logger[_0x55c2('0x15')]('GetVoiceQueueRtPauses',_0x427c81);logger[_0x55c2('0xe')](_0x55c2('0x17'),_0x427c81,JSON[_0x55c2('0x20')](_0x1e2881));_0x5e180d(_0x1e2881);})[_0x55c2('0x21')](function(_0xe18847){logger[_0x55c2('0x12')]('GetVoiceQueueRtPauses',_0xe18847[_0x55c2('0x13')],_0x427c81);_0x90ecd1(_0x13a8c2[_0x55c2('0x12')](0x1f4,_0xe18847[_0x55c2('0x13')]));});});};
\ No newline at end of file
+var _0x01e1=['outboundQueuePauses','debug','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','./userVoiceQueueRt.socket','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null'];(function(_0x23d34a,_0x288f2c){var _0x45de67=function(_0x295b7b){while(--_0x295b7b){_0x23d34a['push'](_0x23d34a['shift']());}};_0x45de67(++_0x288f2c);}(_0x01e1,0xbc));var _0x101e=function(_0x3ba44e,_0x29cbfb){_0x3ba44e=_0x3ba44e-0x0;var _0x4cc630=_0x01e1[_0x3ba44e];return _0x4cc630;};'use strict';var _=require('lodash');var util=require(_0x101e('0x0'));var moment=require(_0x101e('0x1'));var BPromise=require('bluebird');var rs=require(_0x101e('0x2'));var fs=require('fs');var Redis=require(_0x101e('0x3'));var db=require(_0x101e('0x4'))['db'];var utils=require(_0x101e('0x5'));var logger=require(_0x101e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x101e('0x7')][_0x101e('0x8')]({'port':0x232a});config[_0x101e('0x9')]=_[_0x101e('0xa')](config[_0x101e('0x9')],{'host':_0x101e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x101e('0xc'))[_0x101e('0xd')](socket);function respondWithRpcPromise(_0x151e2b,_0x46acce,_0x7690af){return new BPromise(function(_0x415e00,_0x597ad2){return client[_0x101e('0xe')](_0x151e2b,_0x7690af)[_0x101e('0xf')](function(_0xee4ff5){logger['info'](_0x101e('0x10'),_0x46acce,_0x101e('0x11'));logger['debug'](_0x101e('0x12'),_0x46acce,_0x101e('0x11'),JSON[_0x101e('0x13')](_0xee4ff5));if(_0xee4ff5[_0x101e('0x14')]){if(_0xee4ff5['error']['code']===0x1f4){logger[_0x101e('0x14')](_0x101e('0x10'),_0x46acce,_0xee4ff5[_0x101e('0x14')]['message']);return _0x597ad2(_0xee4ff5[_0x101e('0x14')][_0x101e('0x15')]);}logger[_0x101e('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x46acce,_0xee4ff5[_0x101e('0x14')]['message']);return _0x415e00(_0xee4ff5[_0x101e('0x14')][_0x101e('0x15')]);}else{logger[_0x101e('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x46acce,_0x101e('0x11'));_0x415e00(_0xee4ff5[_0x101e('0x17')][_0x101e('0x15')]);}})['catch'](function(_0x1f9874){logger[_0x101e('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x46acce,_0x1f9874);_0x597ad2(_0x1f9874);});});}exports[_0x101e('0x18')]=function(_0xbd2c50){var _0x5251e3=this;return new Promise(function(_0x6da80c,_0x5191b4){return db[_0x101e('0x19')][_0x101e('0x1a')]({'raw':_0xbd2c50[_0x101e('0x1b')]?_0xbd2c50[_0x101e('0x1b')][_0x101e('0x1c')]===undefined?!![]:![]:!![],'where':_0xbd2c50['options']?_0xbd2c50[_0x101e('0x1b')][_0x101e('0x1d')]||null:null,'attributes':[[db[_0x101e('0x1e')]['fn'](_0x101e('0x1f'),db[_0x101e('0x1e')]['fn']('IF',db['sequelize'][_0x101e('0x20')](_0x101e('0x21')))),_0x101e('0x22')]]})[_0x101e('0xf')](function(_0x1fb377){logger[_0x101e('0x16')](_0x101e('0x18'),_0xbd2c50);logger[_0x101e('0x23')](_0x101e('0x18'),_0xbd2c50,JSON['stringify'](_0x1fb377));_0x6da80c(_0x1fb377);})[_0x101e('0x24')](function(_0x1142a9){logger[_0x101e('0x14')](_0x101e('0x18'),_0x1142a9[_0x101e('0x15')],_0xbd2c50);_0x5191b4(_0x5251e3[_0x101e('0x14')](0x1f4,_0x1142a9[_0x101e('0x15')]));});});};
\ No newline at end of file
index 2282dbe..a12556a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8f9d=['removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','emit'];(function(_0x53ee9a,_0x1db711){var _0x443611=function(_0x5534bf){while(--_0x5534bf){_0x53ee9a['push'](_0x53ee9a['shift']());}};_0x443611(++_0x1db711);}(_0x8f9d,0x93));var _0xd8f9=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x8f9d[_0xfae23b];return _0x200640;};'use strict';var UserVoiceQueueRtEvents=require(_0xd8f9('0x0'));var events=['save',_0xd8f9('0x1'),'update'];function createListener(_0x682953,_0x421dcb){return function(_0x119296){_0x421dcb[_0xd8f9('0x2')](_0x682953,_0x119296);};}function removeListener(_0x1f9331,_0x1b82b8){return function(){UserVoiceQueueRtEvents[_0xd8f9('0x3')](_0x1f9331,_0x1b82b8);};}exports['register']=function(_0x1c37be){for(var _0x24dd1e=0x0,_0x25d417=events[_0xd8f9('0x4')];_0x24dd1e<_0x25d417;_0x24dd1e++){var _0xf6105=events[_0x24dd1e];var _0x5c410f=createListener(_0xd8f9('0x5')+_0xf6105,_0x1c37be);UserVoiceQueueRtEvents['on'](_0xf6105,_0x5c410f);}};
\ No newline at end of file
+var _0xbd51=['removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','update'];(function(_0x2e471d,_0x2613f2){var _0x595a55=function(_0x197959){while(--_0x197959){_0x2e471d['push'](_0x2e471d['shift']());}};_0x595a55(++_0x2613f2);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x441d74,_0x123668){_0x441d74=_0x441d74-0x0;var _0x48a571=_0xbd51[_0x441d74];return _0x48a571;};'use strict';var UserVoiceQueueRtEvents=require(_0x1bd5('0x0'));var events=['save',_0x1bd5('0x1'),_0x1bd5('0x2')];function createListener(_0x3b9f71,_0x1a9dcc){return function(_0x545aac){_0x1a9dcc['emit'](_0x3b9f71,_0x545aac);};}function removeListener(_0x58af16,_0x531028){return function(){UserVoiceQueueRtEvents[_0x1bd5('0x3')](_0x58af16,_0x531028);};}exports[_0x1bd5('0x4')]=function(_0x43e6b6){for(var _0x59ddfb=0x0,_0x29abea=events[_0x1bd5('0x5')];_0x59ddfb<_0x29abea;_0x59ddfb++){var _0x19077c=events[_0x59ddfb];var _0x27d58f=createListener(_0x1bd5('0x6')+_0x19077c,_0x43e6b6);UserVoiceQueueRtEvents['on'](_0x19077c,_0x27d58f);}};
\ No newline at end of file
index 5a6fb66..63cbb2b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe706=['update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0xe706,0xa3));var _0x6e70=function(_0x461c9e,_0x9a67cd){_0x461c9e=_0x461c9e-0x0;var _0x144e35=_0xe706[_0x461c9e];return _0x144e35;};'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 auth=require(_0x6e70('0x5'));var interaction=require(_0x6e70('0x6'));var config=require(_0x6e70('0x7'));var controller=require(_0x6e70('0x8'));router[_0x6e70('0x9')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x9')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xd')]);router[_0x6e70('0xe')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0xf')]);router[_0x6e70('0x10')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x11')]);router[_0x6e70('0x12')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x13')]);module['exports']=router;
\ No newline at end of file
+var _0x4522=['destroy','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete'];(function(_0x3f2a90,_0x50baf1){var _0xb46279=function(_0x5e47b5){while(--_0x5e47b5){_0x3f2a90['push'](_0x3f2a90['shift']());}};_0xb46279(++_0x50baf1);}(_0x4522,0x1a0));var _0x2452=function(_0x1fc30c,_0x52214a){_0x1fc30c=_0x1fc30c-0x0;var _0x120ad4=_0x4522[_0x1fc30c];return _0x120ad4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2452('0x0'));var timeout=require(_0x2452('0x1'));var express=require(_0x2452('0x2'));var router=express['Router']();var auth=require(_0x2452('0x3'));var interaction=require(_0x2452('0x4'));var config=require(_0x2452('0x5'));var controller=require(_0x2452('0x6'));router[_0x2452('0x7')]('/',auth[_0x2452('0x8')](),controller[_0x2452('0x9')]);router[_0x2452('0x7')](_0x2452('0xa'),auth[_0x2452('0x8')](),controller[_0x2452('0xb')]);router[_0x2452('0xc')]('/',auth[_0x2452('0x8')](),controller[_0x2452('0xd')]);router[_0x2452('0xe')](_0x2452('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x2452('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x2452('0x10')]);module[_0x2452('0x11')]=router;
\ No newline at end of file
index 21b6fdf..a86f655 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1bb2=['exports','STRING','name'];(function(_0x4c6111,_0x5f5b50){var _0x1e119b=function(_0xd92098){while(--_0xd92098){_0x4c6111['push'](_0x4c6111['shift']());}};_0x1e119b(++_0x5f5b50);}(_0x1bb2,0xc6));var _0x21bb=function(_0x18e4e8,_0x2f85db){_0x18e4e8=_0x18e4e8-0x0;var _0x64449b=_0x1bb2[_0x18e4e8];return _0x64449b;};'use strict';var Sequelize=require('sequelize');module[_0x21bb('0x0')]={'name':{'type':Sequelize[_0x21bb('0x1')],'unique':_0x21bb('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0xde8a=['sequelize','exports','STRING','name'];(function(_0x2c8c52,_0x4a4cc9){var _0x3ab886=function(_0x36567e){while(--_0x36567e){_0x2c8c52['push'](_0x2c8c52['shift']());}};_0x3ab886(++_0x4a4cc9);}(_0xde8a,0x9c));var _0xade8=function(_0x2e6fd9,_0x5199ef){_0x2e6fd9=_0x2e6fd9-0x0;var _0x2cc806=_0xde8a[_0x2e6fd9];return _0x2cc806;};'use strict';var Sequelize=require(_0xade8('0x0'));module[_0xade8('0x1')]={'name':{'type':Sequelize[_0xade8('0x2')],'unique':_0xade8('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xade8('0x2')]}};
\ No newline at end of file
index feaf2d4..7bb2cff 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x742a=['lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','Variables','UserProfileResource','destroy','error','stack','name','send','index','Variable','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','filters','filter','where','merge','type','key','VIRTUAL','field','then','include','findAll','catch','show','params','includeAll','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x5cbcfd,_0xde8cf7){var _0x30daf1=function(_0x421880){while(--_0x421880){_0x5cbcfd['push'](_0x5cbcfd['shift']());}};_0x30daf1(++_0xde8cf7);}(_0x742a,0x1eb));var _0xa742=function(_0x4d94db,_0x5a2d71){_0x4d94db=_0x4d94db-0x0;var _0x41d157=_0x742a[_0x4d94db];return _0x41d157;};'use strict';var pdf=require(_0xa742('0x0'));var emlformat=require(_0xa742('0x1'));var rimraf=require(_0xa742('0x2'));var zipdir=require(_0xa742('0x3'));var jsonpatch=require(_0xa742('0x4'));var rp=require(_0xa742('0x5'));var moment=require(_0xa742('0x6'));var BPromise=require(_0xa742('0x7'));var Mustache=require(_0xa742('0x8'));var util=require(_0xa742('0x9'));var path=require(_0xa742('0xa'));var sox=require(_0xa742('0xb'));var csv=require(_0xa742('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa742('0xd'));var squel=require(_0xa742('0xe'));var crypto=require('crypto');var jsforce=require(_0xa742('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa742('0xc'));var querystring=require(_0xa742('0x10'));var Papa=require(_0xa742('0x11'));var authService=require(_0xa742('0x12'));var hardwareService=require(_0xa742('0x13'));var Redis=require('ioredis');var qs=require(_0xa742('0x14'));var logger=require(_0xa742('0x15'))(_0xa742('0x16'));var utils=require(_0xa742('0x17'));var config=require(_0xa742('0x18'));var db=require(_0xa742('0x19'))['db'];function respondWithStatusCode(_0x4ea9be,_0x3750bd){_0x3750bd=_0x3750bd||0xcc;return function(_0x35424c){if(_0x35424c){return _0x4ea9be[_0xa742('0x1a')](_0x3750bd);}return _0x4ea9be[_0xa742('0x1b')](_0x3750bd)[_0xa742('0x1c')]();};}function respondWithResult(_0x21b805,_0x54e9be){_0x54e9be=_0x54e9be||0xc8;return function(_0x2189a8){if(_0x2189a8){return _0x21b805[_0xa742('0x1b')](_0x54e9be)[_0xa742('0x1d')](_0x2189a8);}};}function respondWithFilteredResult(_0x5a6ab9,_0x2bb6c6){return function(_0x51da4e){if(_0x51da4e){var _0x3e9149=_0x51da4e[_0xa742('0x1e')],_0x3bf050=_0x2bb6c6['offset'],_0x13e226=_0x2bb6c6['offset']+_0x2bb6c6[_0xa742('0x1f')],_0x4103a0;if(_0x13e226>=_0x3e9149){_0x13e226=_0x3e9149;_0x4103a0=0xc8;}else{_0x4103a0=0xce;}_0x5a6ab9[_0xa742('0x1b')](_0x4103a0);return _0x5a6ab9[_0xa742('0x20')](_0xa742('0x21'),_0x3bf050+'-'+_0x13e226+'/'+_0x3e9149)[_0xa742('0x1d')](_0x51da4e);}return null;};}function patchUpdates(_0x3226fa){return function(_0x425bc6){try{jsonpatch[_0xa742('0x22')](_0x425bc6,_0x3226fa,!![]);}catch(_0x8c4b79){return BPromise[_0xa742('0x23')](_0x8c4b79);}return _0x425bc6[_0xa742('0x24')]();};}function saveUpdates(_0x396dcc,_0x353057){return function(_0x3b1b7a){if(_0x3b1b7a){return _0x3b1b7a['update'](_0x396dcc)['then'](function(_0x270f6c){return _0x270f6c;});}return null;};}function removeEntity(_0x5af4cb,_0x64a430){return function(_0x377cca){if(_0x377cca){return _0x377cca['destroy']()['then'](function(){var _0xa597af=_0x377cca['get']({'plain':!![]});var _0x215fa9=_0xa742('0x25');return db[_0xa742('0x26')][_0xa742('0x27')]({'where':{'type':_0x215fa9,'resourceId':_0xa597af['id']}})['then'](function(){return _0x377cca;});})['then'](function(){_0x5af4cb[_0xa742('0x1b')](0xcc)[_0xa742('0x1c')]();});}};}function handleEntityNotFound(_0x5219cc,_0x340bb7){return function(_0x4b241d){if(!_0x4b241d){_0x5219cc[_0xa742('0x1a')](0x194);}return _0x4b241d;};}function handleError(_0x5cc154,_0x576668){_0x576668=_0x576668||0x1f4;return function(_0x573a9a){logger[_0xa742('0x28')](_0x573a9a[_0xa742('0x29')]);if(_0x573a9a['name']){delete _0x573a9a[_0xa742('0x2a')];}_0x5cc154[_0xa742('0x1b')](_0x576668)[_0xa742('0x2b')](_0x573a9a);};}exports[_0xa742('0x2c')]=function(_0x2abd35,_0x29491a){var _0x1608a7={},_0x1cae3e={},_0x5074db={'count':0x0,'rows':[]};var _0x3d05ad=db[_0xa742('0x2d')][_0xa742('0x2e')];_0x1cae3e[_0xa742('0x2f')]=_[_0xa742('0x30')](_0x3d05ad);_0x1cae3e[_0xa742('0x31')]=_[_0xa742('0x30')](_0x2abd35[_0xa742('0x31')]);_0x1cae3e['filters']=_[_0xa742('0x32')](_0x1cae3e['model'],_0x1cae3e[_0xa742('0x31')]);_0x1608a7[_0xa742('0x33')]=_['intersection'](_0x1cae3e[_0xa742('0x2f')],qs['fields'](_0x2abd35[_0xa742('0x31')][_0xa742('0x34')]));_0x1608a7[_0xa742('0x33')]=_0x1608a7[_0xa742('0x33')][_0xa742('0x35')]?_0x1608a7['attributes']:_0x1cae3e[_0xa742('0x2f')];if(!_0x2abd35[_0xa742('0x31')][_0xa742('0x36')](_0xa742('0x37'))){_0x1608a7[_0xa742('0x1f')]=qs[_0xa742('0x1f')](_0x2abd35[_0xa742('0x31')][_0xa742('0x1f')]);_0x1608a7[_0xa742('0x38')]=qs[_0xa742('0x38')](_0x2abd35[_0xa742('0x31')][_0xa742('0x38')]);}_0x1608a7[_0xa742('0x39')]=qs[_0xa742('0x3a')](_0x2abd35[_0xa742('0x31')][_0xa742('0x3a')]);_0x1608a7['where']=qs[_0xa742('0x3b')](_['pick'](_0x2abd35['query'],_0x1cae3e['filters']));if(_0x2abd35[_0xa742('0x31')][_0xa742('0x3c')]){_0x1608a7[_0xa742('0x3d')]=_[_0xa742('0x3e')](_0x1608a7[_0xa742('0x3d')],{'$or':_['map'](_0x3d05ad,function(_0x312613){if(_0x312613[_0xa742('0x3f')][_0xa742('0x40')]!==_0xa742('0x41')){var _0xae84cc={};_0xae84cc[_0x312613[_0xa742('0x42')]]={'$like':'%'+_0x2abd35[_0xa742('0x31')][_0xa742('0x3c')]+'%'};return _0xae84cc;}})});}_0x1608a7=_['merge']({},_0x1608a7,_0x2abd35['options']);var _0x4fb77f={'where':_0x1608a7[_0xa742('0x3d')]};return db[_0xa742('0x2d')][_0xa742('0x1e')](_0x4fb77f)[_0xa742('0x43')](function(_0x448c4a){_0x5074db['count']=_0x448c4a;if(_0x2abd35[_0xa742('0x31')]['includeAll']){_0x1608a7[_0xa742('0x44')]=[{'all':!![]}];}return db[_0xa742('0x2d')][_0xa742('0x45')](_0x1608a7);})[_0xa742('0x43')](function(_0x59e52c){_0x5074db['rows']=_0x59e52c;return _0x5074db;})[_0xa742('0x43')](respondWithFilteredResult(_0x29491a,_0x1608a7))[_0xa742('0x46')](handleError(_0x29491a,null));};exports[_0xa742('0x47')]=function(_0xd4fc47,_0x4f0804){var _0x1da088={'raw':!![],'where':{'id':_0xd4fc47[_0xa742('0x48')]['id']}},_0x3925d9={};_0x3925d9[_0xa742('0x2f')]=_[_0xa742('0x30')](db[_0xa742('0x2d')]['rawAttributes']);_0x3925d9[_0xa742('0x31')]=_[_0xa742('0x30')](_0xd4fc47[_0xa742('0x31')]);_0x3925d9[_0xa742('0x3b')]=_[_0xa742('0x32')](_0x3925d9['model'],_0x3925d9['query']);_0x1da088[_0xa742('0x33')]=_[_0xa742('0x32')](_0x3925d9['model'],qs[_0xa742('0x34')](_0xd4fc47[_0xa742('0x31')]['fields']));_0x1da088['attributes']=_0x1da088['attributes'][_0xa742('0x35')]?_0x1da088['attributes']:_0x3925d9[_0xa742('0x2f')];if(_0xd4fc47[_0xa742('0x31')][_0xa742('0x49')]){_0x1da088['include']=[{'all':!![]}];}_0x1da088=_[_0xa742('0x3e')]({},_0x1da088,_0xd4fc47[_0xa742('0x4a')]);return db[_0xa742('0x2d')][_0xa742('0x4b')](_0x1da088)[_0xa742('0x43')](handleEntityNotFound(_0x4f0804,null))[_0xa742('0x43')](respondWithResult(_0x4f0804,null))['catch'](handleError(_0x4f0804,null));};exports[_0xa742('0x4c')]=function(_0x11b32a,_0xdccda1){return db['Variable'][_0xa742('0x4c')](_0x11b32a['body'],{})['then'](function(_0x56b30c){var _0x52b28b=_0x11b32a[_0xa742('0x4d')][_0xa742('0x4e')]({'plain':!![]});if(!_0x52b28b)throw new Error(_0xa742('0x4f'));if(_0x52b28b['role']===_0xa742('0x4d')){var _0xcc21ff=_0x56b30c['get']({'plain':!![]});var _0x54a670='Variables';return db[_0xa742('0x50')][_0xa742('0x4b')]({'where':{'name':_0x54a670,'userProfileId':_0x52b28b['userProfileId']},'raw':!![]})[_0xa742('0x43')](function(_0x15795b){if(_0x15795b&&_0x15795b[_0xa742('0x51')]===0x0){return db[_0xa742('0x26')][_0xa742('0x4c')]({'name':_0xcc21ff[_0xa742('0x2a')],'resourceId':_0xcc21ff['id'],'type':_0x15795b[_0xa742('0x2a')],'sectionId':_0x15795b['id']},{})['then'](function(){return _0x56b30c;});}else{return _0x56b30c;}})[_0xa742('0x46')](function(_0x5498dd){logger[_0xa742('0x28')](_0xa742('0x52'),_0x5498dd);throw _0x5498dd;});}return _0x56b30c;})[_0xa742('0x43')](respondWithResult(_0xdccda1,0xc9))[_0xa742('0x46')](handleError(_0xdccda1,null));};exports['update']=function(_0x2c7f72,_0xba1a62){if(_0x2c7f72['body']['id']){delete _0x2c7f72[_0xa742('0x53')]['id'];}return db[_0xa742('0x2d')][_0xa742('0x4b')]({'where':{'id':_0x2c7f72[_0xa742('0x48')]['id']}})[_0xa742('0x43')](handleEntityNotFound(_0xba1a62,null))[_0xa742('0x43')](saveUpdates(_0x2c7f72[_0xa742('0x53')],null))[_0xa742('0x43')](respondWithResult(_0xba1a62,null))['catch'](handleError(_0xba1a62,null));};exports[_0xa742('0x27')]=function(_0x4516a6,_0x10732a){return db[_0xa742('0x2d')][_0xa742('0x4b')]({'where':{'id':_0x4516a6[_0xa742('0x48')]['id']}})[_0xa742('0x43')](handleEntityNotFound(_0x10732a,null))[_0xa742('0x43')](removeEntity(_0x10732a,null))[_0xa742('0x46')](handleError(_0x10732a,null));};
\ No newline at end of file
+var _0x89d8=['../../components/parsers/qs','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','Variables','UserProfileResource','sendStatus','name','send','index','Variable','rawAttributes','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','key','VIRTUAL','field','options','includeAll','include','findAll','catch','params','find','create','body','role','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','ioredis'];(function(_0x1ef104,_0x276740){var _0xcece1b=function(_0x18c2c8){while(--_0x18c2c8){_0x1ef104['push'](_0x1ef104['shift']());}};_0xcece1b(++_0x276740);}(_0x89d8,0x16a));var _0x889d=function(_0x3d1ab4,_0x4a1ce5){_0x3d1ab4=_0x3d1ab4-0x0;var _0x18f7c1=_0x89d8[_0x3d1ab4];return _0x18f7c1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x889d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x889d('0x1'));var jsonpatch=require(_0x889d('0x2'));var rp=require(_0x889d('0x3'));var moment=require(_0x889d('0x4'));var BPromise=require(_0x889d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x889d('0x6'));var sox=require(_0x889d('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x889d('0x8'));var squel=require(_0x889d('0x9'));var crypto=require(_0x889d('0xa'));var jsforce=require(_0x889d('0xb'));var deskjs=require(_0x889d('0xc'));var toCsv=require(_0x889d('0xd'));var querystring=require(_0x889d('0xe'));var Papa=require(_0x889d('0xf'));var authService=require(_0x889d('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x889d('0x11'));var qs=require(_0x889d('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x889d('0x13'));var config=require('../../config/environment');var db=require(_0x889d('0x14'))['db'];function respondWithStatusCode(_0x8e6fb0,_0x2b838b){_0x2b838b=_0x2b838b||0xcc;return function(_0x18f5bd){if(_0x18f5bd){return _0x8e6fb0['sendStatus'](_0x2b838b);}return _0x8e6fb0[_0x889d('0x15')](_0x2b838b)[_0x889d('0x16')]();};}function respondWithResult(_0x281d01,_0x19b54b){_0x19b54b=_0x19b54b||0xc8;return function(_0x4cd9a9){if(_0x4cd9a9){return _0x281d01[_0x889d('0x15')](_0x19b54b)[_0x889d('0x17')](_0x4cd9a9);}};}function respondWithFilteredResult(_0x33a486,_0x581a30){return function(_0x311890){if(_0x311890){var _0x10643a=_0x311890[_0x889d('0x18')],_0x4f7b4c=_0x581a30[_0x889d('0x19')],_0x2dd4d7=_0x581a30[_0x889d('0x19')]+_0x581a30[_0x889d('0x1a')],_0x5d7eba;if(_0x2dd4d7>=_0x10643a){_0x2dd4d7=_0x10643a;_0x5d7eba=0xc8;}else{_0x5d7eba=0xce;}_0x33a486[_0x889d('0x15')](_0x5d7eba);return _0x33a486[_0x889d('0x1b')](_0x889d('0x1c'),_0x4f7b4c+'-'+_0x2dd4d7+'/'+_0x10643a)[_0x889d('0x17')](_0x311890);}return null;};}function patchUpdates(_0x15648e){return function(_0xeb43c3){try{jsonpatch[_0x889d('0x1d')](_0xeb43c3,_0x15648e,!![]);}catch(_0x477f69){return BPromise['reject'](_0x477f69);}return _0xeb43c3[_0x889d('0x1e')]();};}function saveUpdates(_0x22875f,_0x1d8b9b){return function(_0x327f10){if(_0x327f10){return _0x327f10[_0x889d('0x1f')](_0x22875f)[_0x889d('0x20')](function(_0xf1676d){return _0xf1676d;});}return null;};}function removeEntity(_0x3f8d35,_0x41c543){return function(_0x40b486){if(_0x40b486){return _0x40b486[_0x889d('0x21')]()['then'](function(){var _0x4886c3=_0x40b486[_0x889d('0x22')]({'plain':!![]});var _0x2f5b8c=_0x889d('0x23');return db[_0x889d('0x24')][_0x889d('0x21')]({'where':{'type':_0x2f5b8c,'resourceId':_0x4886c3['id']}})[_0x889d('0x20')](function(){return _0x40b486;});})['then'](function(){_0x3f8d35[_0x889d('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9c41be,_0x3dc218){return function(_0x5e3a37){if(!_0x5e3a37){_0x9c41be[_0x889d('0x25')](0x194);}return _0x5e3a37;};}function handleError(_0x154b04,_0xdeb393){_0xdeb393=_0xdeb393||0x1f4;return function(_0x2bfca7){logger['error'](_0x2bfca7['stack']);if(_0x2bfca7[_0x889d('0x26')]){delete _0x2bfca7[_0x889d('0x26')];}_0x154b04[_0x889d('0x15')](_0xdeb393)[_0x889d('0x27')](_0x2bfca7);};}exports[_0x889d('0x28')]=function(_0x145769,_0x1c6d24){var _0xadb1b={},_0x344d8a={},_0x49c98d={'count':0x0,'rows':[]};var _0x3cf674=db[_0x889d('0x29')][_0x889d('0x2a')];_0x344d8a[_0x889d('0x2b')]=_[_0x889d('0x2c')](_0x3cf674);_0x344d8a[_0x889d('0x2d')]=_[_0x889d('0x2c')](_0x145769[_0x889d('0x2d')]);_0x344d8a[_0x889d('0x2e')]=_[_0x889d('0x2f')](_0x344d8a[_0x889d('0x2b')],_0x344d8a[_0x889d('0x2d')]);_0xadb1b['attributes']=_['intersection'](_0x344d8a[_0x889d('0x2b')],qs['fields'](_0x145769[_0x889d('0x2d')][_0x889d('0x30')]));_0xadb1b['attributes']=_0xadb1b[_0x889d('0x31')]['length']?_0xadb1b[_0x889d('0x31')]:_0x344d8a[_0x889d('0x2b')];if(!_0x145769[_0x889d('0x2d')][_0x889d('0x32')](_0x889d('0x33'))){_0xadb1b[_0x889d('0x1a')]=qs[_0x889d('0x1a')](_0x145769[_0x889d('0x2d')][_0x889d('0x1a')]);_0xadb1b[_0x889d('0x19')]=qs['offset'](_0x145769[_0x889d('0x2d')][_0x889d('0x19')]);}_0xadb1b[_0x889d('0x34')]=qs['sort'](_0x145769[_0x889d('0x2d')][_0x889d('0x35')]);_0xadb1b[_0x889d('0x36')]=qs['filters'](_['pick'](_0x145769[_0x889d('0x2d')],_0x344d8a['filters']));if(_0x145769[_0x889d('0x2d')][_0x889d('0x37')]){_0xadb1b[_0x889d('0x36')]=_[_0x889d('0x38')](_0xadb1b[_0x889d('0x36')],{'$or':_['map'](_0x3cf674,function(_0x37bb2c){if(_0x37bb2c[_0x889d('0x39')][_0x889d('0x3a')]!==_0x889d('0x3b')){var _0xc437ad={};_0xc437ad[_0x37bb2c[_0x889d('0x3c')]]={'$like':'%'+_0x145769['query'][_0x889d('0x37')]+'%'};return _0xc437ad;}})});}_0xadb1b=_[_0x889d('0x38')]({},_0xadb1b,_0x145769[_0x889d('0x3d')]);var _0x12ce09={'where':_0xadb1b[_0x889d('0x36')]};return db[_0x889d('0x29')][_0x889d('0x18')](_0x12ce09)[_0x889d('0x20')](function(_0x35b02f){_0x49c98d[_0x889d('0x18')]=_0x35b02f;if(_0x145769[_0x889d('0x2d')][_0x889d('0x3e')]){_0xadb1b[_0x889d('0x3f')]=[{'all':!![]}];}return db[_0x889d('0x29')][_0x889d('0x40')](_0xadb1b);})['then'](function(_0x56ff8e){_0x49c98d['rows']=_0x56ff8e;return _0x49c98d;})['then'](respondWithFilteredResult(_0x1c6d24,_0xadb1b))[_0x889d('0x41')](handleError(_0x1c6d24,null));};exports['show']=function(_0x230ac4,_0x2e4460){var _0x48730b={'raw':!![],'where':{'id':_0x230ac4[_0x889d('0x42')]['id']}},_0x37de7c={};_0x37de7c[_0x889d('0x2b')]=_[_0x889d('0x2c')](db[_0x889d('0x29')]['rawAttributes']);_0x37de7c[_0x889d('0x2d')]=_[_0x889d('0x2c')](_0x230ac4['query']);_0x37de7c[_0x889d('0x2e')]=_[_0x889d('0x2f')](_0x37de7c[_0x889d('0x2b')],_0x37de7c[_0x889d('0x2d')]);_0x48730b[_0x889d('0x31')]=_[_0x889d('0x2f')](_0x37de7c[_0x889d('0x2b')],qs[_0x889d('0x30')](_0x230ac4['query']['fields']));_0x48730b[_0x889d('0x31')]=_0x48730b[_0x889d('0x31')]['length']?_0x48730b['attributes']:_0x37de7c[_0x889d('0x2b')];if(_0x230ac4[_0x889d('0x2d')][_0x889d('0x3e')]){_0x48730b[_0x889d('0x3f')]=[{'all':!![]}];}_0x48730b=_[_0x889d('0x38')]({},_0x48730b,_0x230ac4[_0x889d('0x3d')]);return db[_0x889d('0x29')][_0x889d('0x43')](_0x48730b)[_0x889d('0x20')](handleEntityNotFound(_0x2e4460,null))[_0x889d('0x20')](respondWithResult(_0x2e4460,null))[_0x889d('0x41')](handleError(_0x2e4460,null));};exports[_0x889d('0x44')]=function(_0x555bc7,_0xd8d29a){return db[_0x889d('0x29')]['create'](_0x555bc7[_0x889d('0x45')],{})[_0x889d('0x20')](function(_0xc7529e){var _0x34123e=_0x555bc7['user']['get']({'plain':!![]});if(!_0x34123e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x34123e[_0x889d('0x46')]===_0x889d('0x47')){var _0x3b2b83=_0xc7529e['get']({'plain':!![]});var _0x57754e=_0x889d('0x23');return db['UserProfileSection']['find']({'where':{'name':_0x57754e,'userProfileId':_0x34123e[_0x889d('0x48')]},'raw':!![]})[_0x889d('0x20')](function(_0x1cc734){if(_0x1cc734&&_0x1cc734[_0x889d('0x49')]===0x0){return db[_0x889d('0x24')][_0x889d('0x44')]({'name':_0x3b2b83['name'],'resourceId':_0x3b2b83['id'],'type':_0x1cc734[_0x889d('0x26')],'sectionId':_0x1cc734['id']},{})[_0x889d('0x20')](function(){return _0xc7529e;});}else{return _0xc7529e;}})[_0x889d('0x41')](function(_0x51c23b){logger[_0x889d('0x4a')](_0x889d('0x4b'),_0x51c23b);throw _0x51c23b;});}return _0xc7529e;})[_0x889d('0x20')](respondWithResult(_0xd8d29a,0xc9))[_0x889d('0x41')](handleError(_0xd8d29a,null));};exports['update']=function(_0x1c60ce,_0x208b2a){if(_0x1c60ce[_0x889d('0x45')]['id']){delete _0x1c60ce['body']['id'];}return db['Variable'][_0x889d('0x43')]({'where':{'id':_0x1c60ce[_0x889d('0x42')]['id']}})[_0x889d('0x20')](handleEntityNotFound(_0x208b2a,null))[_0x889d('0x20')](saveUpdates(_0x1c60ce['body'],null))[_0x889d('0x20')](respondWithResult(_0x208b2a,null))[_0x889d('0x41')](handleError(_0x208b2a,null));};exports[_0x889d('0x21')]=function(_0x12e06d,_0x5f5b53){return db['Variable']['find']({'where':{'id':_0x12e06d[_0x889d('0x42')]['id']}})[_0x889d('0x20')](handleEntityNotFound(_0x5f5b53,null))[_0x889d('0x20')](removeEntity(_0x5f5b53,null))[_0x889d('0x41')](handleError(_0x5f5b53,null));};
\ No newline at end of file
index ef27165..d567a34 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x326f=['define','Variable','lodash','api','moment','bluebird','request-promise','./variable.attributes','exports'];(function(_0x2723d2,_0x49c1d2){var _0x5d667c=function(_0x59a3f8){while(--_0x59a3f8){_0x2723d2['push'](_0x2723d2['shift']());}};_0x5d667c(++_0x49c1d2);}(_0x326f,0xd1));var _0xf326=function(_0x444f4a,_0x4e1bdc){_0x444f4a=_0x444f4a-0x0;var _0x65e013=_0x326f[_0x444f4a];return _0x65e013;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var attributes=require(_0xf326('0x5'));module[_0xf326('0x6')]=function(_0x9445c6,_0xf1c243){return _0x9445c6[_0xf326('0x7')](_0xf326('0x8'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x814b=['../../config/logger','api','moment','bluebird','./variable.attributes','exports','define','Variable','lodash','util'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0x814b,0x1a2));var _0xb814=function(_0x1b892b,_0x4efe48){_0x1b892b=_0x1b892b-0x0;var _0xa99e57=_0x814b[_0x1b892b];return _0xa99e57;};'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 attributes=require(_0xb814('0x6'));module[_0xb814('0x7')]=function(_0x258866,_0x4237bc){return _0x258866[_0xb814('0x8')](_0xb814('0x9'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 85770db..18c8710 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xac8e=['client','http','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowVariable','Variable','options','raw','attributes','map','include','model','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x261a49,_0x5db17f){var _0x56f4fa=function(_0x2bd325){while(--_0x2bd325){_0x261a49['push'](_0x261a49['shift']());}};_0x56f4fa(++_0x5db17f);}(_0xac8e,0x1d6));var _0xeac8=function(_0x267bbc,_0xa208b9){_0x267bbc=_0x267bbc-0x0;var _0x388895=_0xac8e[_0x267bbc];return _0x388895;};'use strict';var _=require(_0xeac8('0x0'));var util=require(_0xeac8('0x1'));var moment=require(_0xeac8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeac8('0x3'));var db=require(_0xeac8('0x4'))['db'];var utils=require(_0xeac8('0x5'));var logger=require(_0xeac8('0x6'))(_0xeac8('0x7'));var config=require(_0xeac8('0x8'));var jayson=require(_0xeac8('0x9'));var client=jayson[_0xeac8('0xa')][_0xeac8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23eb91,_0xa6e5e8,_0x37841a){return new BPromise(function(_0x46229d,_0xdd46f7){return client['request'](_0x23eb91,_0x37841a)[_0xeac8('0xc')](function(_0xe2d53e){logger[_0xeac8('0xd')](_0xeac8('0xe'),_0xa6e5e8,'request\x20sent');logger[_0xeac8('0xf')](_0xeac8('0x10'),_0xa6e5e8,_0xeac8('0x11'),JSON[_0xeac8('0x12')](_0xe2d53e));if(_0xe2d53e[_0xeac8('0x13')]){if(_0xe2d53e[_0xeac8('0x13')][_0xeac8('0x14')]===0x1f4){logger[_0xeac8('0x13')](_0xeac8('0xe'),_0xa6e5e8,_0xe2d53e[_0xeac8('0x13')]['message']);return _0xdd46f7(_0xe2d53e[_0xeac8('0x13')][_0xeac8('0x15')]);}logger[_0xeac8('0x13')](_0xeac8('0xe'),_0xa6e5e8,_0xe2d53e[_0xeac8('0x13')][_0xeac8('0x15')]);return _0x46229d(_0xe2d53e[_0xeac8('0x13')][_0xeac8('0x15')]);}else{logger[_0xeac8('0xd')](_0xeac8('0xe'),_0xa6e5e8,_0xeac8('0x11'));_0x46229d(_0xe2d53e[_0xeac8('0x16')][_0xeac8('0x15')]);}})[_0xeac8('0x17')](function(_0x1385e5){logger[_0xeac8('0x13')](_0xeac8('0xe'),_0xa6e5e8,_0x1385e5);_0xdd46f7(_0x1385e5);});});}exports[_0xeac8('0x18')]=function(_0x30b2d2){var _0x1512bb=this;return new Promise(function(_0x3d20ee,_0x3c3450){return db[_0xeac8('0x19')]['find']({'raw':_0x30b2d2[_0xeac8('0x1a')]?_0x30b2d2['options'][_0xeac8('0x1b')]===undefined?!![]:![]:!![],'where':_0x30b2d2['options']?_0x30b2d2['options']['where']||null:null,'attributes':_0x30b2d2['options']?_0x30b2d2[_0xeac8('0x1a')][_0xeac8('0x1c')]||null:null,'include':_0x30b2d2[_0xeac8('0x1a')]?_0x30b2d2[_0xeac8('0x1a')]['include']?_[_0xeac8('0x1d')](_0x30b2d2[_0xeac8('0x1a')][_0xeac8('0x1e')],function(_0x36e24b){return{'model':db[_0x36e24b[_0xeac8('0x1f')]],'as':_0x36e24b['as'],'attributes':_0x36e24b[_0xeac8('0x1c')],'include':_0x36e24b[_0xeac8('0x1e')]?_['map'](_0x36e24b['include'],function(_0x1ee171){return{'model':db[_0x1ee171['model']],'as':_0x1ee171['as'],'attributes':_0x1ee171[_0xeac8('0x1c')],'include':_0x1ee171[_0xeac8('0x1e')]?_[_0xeac8('0x1d')](_0x1ee171[_0xeac8('0x1e')],function(_0x32e2db){return{'model':db[_0x32e2db[_0xeac8('0x1f')]],'as':_0x32e2db['as'],'attributes':_0x32e2db['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x488d96){logger['info'](_0xeac8('0x18'),_0x30b2d2);logger[_0xeac8('0xf')](_0xeac8('0x18'),_0x30b2d2,JSON[_0xeac8('0x12')](_0x488d96));_0x3d20ee(_0x488d96);})[_0xeac8('0x17')](function(_0x181077){logger['error'](_0xeac8('0x18'),_0x181077[_0xeac8('0x15')],_0x30b2d2);_0x3c3450(_0x1512bb[_0xeac8('0x13')](0x1f4,_0x181077[_0xeac8('0x15')]));});});};
\ No newline at end of file
+var _0x8863=['Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','ShowVariable','Variable','find','options','raw','where','attributes','map','include','model','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then'];(function(_0xeee470,_0x28b16f){var _0x114c95=function(_0x74ce3a){while(--_0x74ce3a){_0xeee470['push'](_0xeee470['shift']());}};_0x114c95(++_0x28b16f);}(_0x8863,0xaa));var _0x3886=function(_0x22d02c,_0x15300f){_0x22d02c=_0x22d02c-0x0;var _0x5158f1=_0x8863[_0x22d02c];return _0x5158f1;};'use strict';var _=require(_0x3886('0x0'));var util=require('util');var moment=require(_0x3886('0x1'));var BPromise=require(_0x3886('0x2'));var rs=require(_0x3886('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3886('0x4'));var logger=require(_0x3886('0x5'))('rpc');var config=require(_0x3886('0x6'));var jayson=require(_0x3886('0x7'));var client=jayson['client'][_0x3886('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23a29e,_0x428557,_0x556013){return new BPromise(function(_0x32806b,_0x1a63de){return client['request'](_0x23a29e,_0x556013)[_0x3886('0x9')](function(_0x41f71c){logger['info'](_0x3886('0xa'),_0x428557,'request\x20sent');logger[_0x3886('0xb')](_0x3886('0xc'),_0x428557,_0x3886('0xd'),JSON[_0x3886('0xe')](_0x41f71c));if(_0x41f71c['error']){if(_0x41f71c[_0x3886('0xf')]['code']===0x1f4){logger[_0x3886('0xf')](_0x3886('0xa'),_0x428557,_0x41f71c[_0x3886('0xf')][_0x3886('0x10')]);return _0x1a63de(_0x41f71c['error']['message']);}logger[_0x3886('0xf')](_0x3886('0xa'),_0x428557,_0x41f71c[_0x3886('0xf')][_0x3886('0x10')]);return _0x32806b(_0x41f71c['error']['message']);}else{logger[_0x3886('0x11')](_0x3886('0xa'),_0x428557,'request\x20sent');_0x32806b(_0x41f71c[_0x3886('0x12')][_0x3886('0x10')]);}})[_0x3886('0x13')](function(_0x5e4edc){logger[_0x3886('0xf')](_0x3886('0xa'),_0x428557,_0x5e4edc);_0x1a63de(_0x5e4edc);});});}exports[_0x3886('0x14')]=function(_0x2be6c6){var _0x1ba5e3=this;return new Promise(function(_0x10a0d9,_0x4b77b6){return db[_0x3886('0x15')][_0x3886('0x16')]({'raw':_0x2be6c6[_0x3886('0x17')]?_0x2be6c6[_0x3886('0x17')][_0x3886('0x18')]===undefined?!![]:![]:!![],'where':_0x2be6c6[_0x3886('0x17')]?_0x2be6c6[_0x3886('0x17')][_0x3886('0x19')]||null:null,'attributes':_0x2be6c6[_0x3886('0x17')]?_0x2be6c6[_0x3886('0x17')][_0x3886('0x1a')]||null:null,'include':_0x2be6c6[_0x3886('0x17')]?_0x2be6c6['options']['include']?_[_0x3886('0x1b')](_0x2be6c6[_0x3886('0x17')][_0x3886('0x1c')],function(_0x31a6d3){return{'model':db[_0x31a6d3['model']],'as':_0x31a6d3['as'],'attributes':_0x31a6d3[_0x3886('0x1a')],'include':_0x31a6d3['include']?_['map'](_0x31a6d3[_0x3886('0x1c')],function(_0x18ad2e){return{'model':db[_0x18ad2e[_0x3886('0x1d')]],'as':_0x18ad2e['as'],'attributes':_0x18ad2e['attributes'],'include':_0x18ad2e[_0x3886('0x1c')]?_[_0x3886('0x1b')](_0x18ad2e['include'],function(_0x18a991){return{'model':db[_0x18a991[_0x3886('0x1d')]],'as':_0x18a991['as'],'attributes':_0x18a991[_0x3886('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51a498){logger['info'](_0x3886('0x14'),_0x2be6c6);logger[_0x3886('0xb')](_0x3886('0x14'),_0x2be6c6,JSON[_0x3886('0xe')](_0x51a498));_0x10a0d9(_0x51a498);})[_0x3886('0x13')](function(_0xa8ab43){logger['error']('ShowVariable',_0xa8ab43[_0x3886('0x10')],_0x2be6c6);_0x4b77b6(_0x1ba5e3[_0x3886('0xf')](0x1f4,_0xa8ab43['message']));});});};
\ No newline at end of file
index d6f819c..78a1700 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8b59=['canUpdate','fetch','/reset','reset','/pull','pull','/restart','/migrations','exports','express','get','isAuthenticated'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x8b59,0x99));var _0x98b5=function(_0x318f7c,_0x1b55b6){_0x318f7c=_0x318f7c-0x0;var _0x46819f=_0x8b59[_0x318f7c];return _0x46819f;};'use strict';var express=require(_0x98b5('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0x98b5('0x1')]('/',controller['index']);router[_0x98b5('0x1')]('/fetch',auth[_0x98b5('0x2')](),auth[_0x98b5('0x3')](),controller[_0x98b5('0x4')]);router[_0x98b5('0x1')](_0x98b5('0x5'),auth[_0x98b5('0x2')](),auth[_0x98b5('0x3')](),controller[_0x98b5('0x6')]);router['get'](_0x98b5('0x7'),auth[_0x98b5('0x2')](),auth[_0x98b5('0x3')](),controller[_0x98b5('0x8')]);router[_0x98b5('0x1')](_0x98b5('0x9'),auth[_0x98b5('0x2')](),controller['restart']);router[_0x98b5('0x1')](_0x98b5('0xa'),controller['migrations']);module[_0x98b5('0xb')]=router;
\ No newline at end of file
+var _0x1be0=['migrations','exports','express','./version.controller','index','get','/fetch','fetch','isAuthenticated','reset','canUpdate','pull','/restart','restart'];(function(_0x418a21,_0xd06751){var _0xeffcdc=function(_0xbdef35){while(--_0xbdef35){_0x418a21['push'](_0x418a21['shift']());}};_0xeffcdc(++_0xd06751);}(_0x1be0,0xc6));var _0x01be=function(_0x2a8dfd,_0x329de8){_0x2a8dfd=_0x2a8dfd-0x0;var _0x1d7ea6=_0x1be0[_0x2a8dfd];return _0x1d7ea6;};'use strict';var express=require(_0x01be('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x01be('0x1'));router['get']('/',controller[_0x01be('0x2')]);router[_0x01be('0x3')](_0x01be('0x4'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x01be('0x5')]);router[_0x01be('0x3')]('/reset',auth[_0x01be('0x6')](),auth['canUpdate'](),controller[_0x01be('0x7')]);router[_0x01be('0x3')]('/pull',auth['isAuthenticated'](),auth[_0x01be('0x8')](),controller[_0x01be('0x9')]);router['get'](_0x01be('0xa'),auth[_0x01be('0x6')](),controller[_0x01be('0xb')]);router['get']('/migrations',controller[_0x01be('0xc')]);module[_0x01be('0xd')]=router;
\ No newline at end of file
index 7e836c9..ef0b470 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['master','error','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','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.','root','server','exports','.js','catch','umzug','path','pkginfo','exec','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','version','latest','fetch','tags','status','json','origin'];(function(_0x5ccf87,_0x21b407){var _0x5ab929=function(_0x299f55){while(--_0x299f55){_0x5ccf87['push'](_0x5ccf87['shift']());}};_0x5ab929(++_0x21b407);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var Umzug=require(_0x0a9e('0x0'));var path=require(_0x0a9e('0x1'));var pkginfo=require(_0x0a9e('0x2'))(module,'version');var exec=require('child_process')[_0x0a9e('0x3')];var db=require('../../mysqldb')['db'];var config=require(_0x0a9e('0x4'));var pm2=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var git=require(_0x0a9e('0x8'))(config['root']);exports[_0x0a9e('0x9')]=function(_0x441e3a,_0x2cc193){var _0x5f41ea={'current':module['exports'][_0x0a9e('0xa')],'phonebar':0x2};if(_0x441e3a['query']&&_0x441e3a['query'][_0x0a9e('0xb')]){return git[_0x0a9e('0xc')]()[_0x0a9e('0xd')](function(_0x3ab53f,_0xfeb75b){_0x5f41ea[_0x0a9e('0xb')]=(_0x3ab53f?module['exports']['version']:_0xfeb75b['latest'])||'2.0.0';return _0x2cc193[_0x0a9e('0xe')](0xc8)[_0x0a9e('0xf')](_0x5f41ea);});}else{return _0x2cc193[_0x0a9e('0xe')](0xc8)[_0x0a9e('0xf')](_0x5f41ea);}};exports[_0x0a9e('0xc')]=function(_0x69aeb7,_0x5db4b0){return git[_0x0a9e('0xc')]([_0x0a9e('0x10'),_0x0a9e('0x11')],function(_0x281129){if(_0x281129){logger[_0x0a9e('0x12')](_0x281129);return _0x5db4b0[_0x0a9e('0xe')](0x1f4)['json'](_0x281129);}logger[_0x0a9e('0x13')]('git\x20fetch');return _0x5db4b0[_0x0a9e('0xe')](0xc8)['json']({'output':_0x0a9e('0x14')});});};exports[_0x0a9e('0x15')]=function(_0x48f32d,_0x225616){return git['reset']([_0x0a9e('0x16'),_0x0a9e('0x17')],function(_0x106033){if(_0x106033){logger[_0x0a9e('0x12')](_0x106033);return _0x225616[_0x0a9e('0xe')](0x1f4)[_0x0a9e('0xf')](_0x106033);}logger[_0x0a9e('0x13')](_0x0a9e('0x18'));return _0x225616[_0x0a9e('0xe')](0xc8)[_0x0a9e('0xf')]({'output':_0x0a9e('0x19')});});};exports[_0x0a9e('0x1a')]=function(_0x4bb1e3,_0x2c3407){exec(_0x0a9e('0x1b'),function(_0x53682f,_0x20f109,_0x5a09ef){logger['info'](_0x20f109);logger[_0x0a9e('0x13')](_0x5a09ef);if(_0x53682f){logger[_0x0a9e('0x12')](_0x53682f);return _0x2c3407[_0x0a9e('0xe')](0x1f4)[_0x0a9e('0xf')](_0x53682f);}return _0x2c3407['status'](0xc8)[_0x0a9e('0xf')]({'output':_0x20f109});});};exports[_0x0a9e('0x1c')]=function(_0x3b45bc,_0x4d00e6){return pm2[_0x0a9e('0x1c')](_0x0a9e('0x1d'))[_0x0a9e('0x1e')](function(_0x5ea472){logger['info'](_0x0a9e('0x1f'),_0x5ea472);return _0x4d00e6[_0x0a9e('0xe')](0xc8)[_0x0a9e('0xf')]({'output':_0x0a9e('0x20')});})['catch'](function(_0x384319){logger['error'](_0x384319);return _0x4d00e6[_0x0a9e('0xe')](0x1f4)['json'](_0x384319);});};exports[_0x0a9e('0x21')]=function(_0x34dc65,_0x25fba9){var _0x14433c=new Umzug({'storage':_0x0a9e('0x22'),'storageOptions':{'model':db[_0x0a9e('0x23')],'modelName':_0x0a9e('0x23'),'columnName':_0x0a9e('0xa')},'migrations':{'params':[db['sequelize'][_0x0a9e('0x24')](),db[_0x0a9e('0x22')][_0x0a9e('0x25')],function(){throw new Error(_0x0a9e('0x26'));}],'path':path['join'](config[_0x0a9e('0x27')],_0x0a9e('0x28'),_0x0a9e('0x21')),'pattern':/\.js$/}});_0x14433c['up']({'from':module[_0x0a9e('0x29')][_0x0a9e('0xa')]+_0x0a9e('0x2a')})[_0x0a9e('0x1e')](function(){return _0x25fba9[_0x0a9e('0xe')](0xc8)[_0x0a9e('0xf')]({'output':'Database\x20Migration\x20Completed!'});})[_0x0a9e('0x2b')](function(_0x5d1e0e){return _0x25fba9[_0x0a9e('0xe')](0x1f4)[_0x0a9e('0xf')](_0x5d1e0e);});};
\ No newline at end of file
+var _0x9957=['status','json','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','catch','migrations','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','server','.js','Database\x20Migration\x20Completed!','umzug','path','pkginfo','version','exec','../../mysqldb','../../config/environment','../../config/pm2','update','simple-git','root','index','exports','query','latest','fetch','tags'];(function(_0x2d524f,_0x26ae1c){var _0x489f1c=function(_0x67f868){while(--_0x67f868){_0x2d524f['push'](_0x2d524f['shift']());}};_0x489f1c(++_0x26ae1c);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var Umzug=require(_0x7995('0x0'));var path=require(_0x7995('0x1'));var pkginfo=require(_0x7995('0x2'))(module,_0x7995('0x3'));var exec=require('child_process')[_0x7995('0x4')];var db=require(_0x7995('0x5'))['db'];var config=require(_0x7995('0x6'));var pm2=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var git=require(_0x7995('0x9'))(config[_0x7995('0xa')]);exports[_0x7995('0xb')]=function(_0xbda126,_0x326741){var _0x4996ca={'current':module[_0x7995('0xc')][_0x7995('0x3')],'phonebar':0x2};if(_0xbda126['query']&&_0xbda126[_0x7995('0xd')][_0x7995('0xe')]){return git[_0x7995('0xf')]()[_0x7995('0x10')](function(_0x3c1d19,_0x1e400a){_0x4996ca[_0x7995('0xe')]=(_0x3c1d19?module['exports'][_0x7995('0x3')]:_0x1e400a[_0x7995('0xe')])||'2.0.0';return _0x326741[_0x7995('0x11')](0xc8)[_0x7995('0x12')](_0x4996ca);});}else{return _0x326741[_0x7995('0x11')](0xc8)[_0x7995('0x12')](_0x4996ca);}};exports[_0x7995('0xf')]=function(_0x23999f,_0x2bbe7a){return git['fetch'](['origin',_0x7995('0x13')],function(_0x2233dd){if(_0x2233dd){logger[_0x7995('0x14')](_0x2233dd);return _0x2bbe7a[_0x7995('0x11')](0x1f4)[_0x7995('0x12')](_0x2233dd);}logger[_0x7995('0x15')](_0x7995('0x16'));return _0x2bbe7a[_0x7995('0x11')](0xc8)['json']({'output':_0x7995('0x17')});});};exports['reset']=function(_0x2f832e,_0x37f297){return git[_0x7995('0x18')]([_0x7995('0x19'),_0x7995('0x1a')],function(_0x37a7d4){if(_0x37a7d4){logger['error'](_0x37a7d4);return _0x37f297['status'](0x1f4)[_0x7995('0x12')](_0x37a7d4);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x37f297[_0x7995('0x11')](0xc8)[_0x7995('0x12')]({'output':'git\x20reset\x20--hard'});});};exports[_0x7995('0x1b')]=function(_0x51f276,_0x4b1a8e){exec(_0x7995('0x1c'),function(_0x327b1f,_0x350fd9,_0x1a8568){logger[_0x7995('0x15')](_0x350fd9);logger[_0x7995('0x15')](_0x1a8568);if(_0x327b1f){logger['error'](_0x327b1f);return _0x4b1a8e[_0x7995('0x11')](0x1f4)[_0x7995('0x12')](_0x327b1f);}return _0x4b1a8e[_0x7995('0x11')](0xc8)[_0x7995('0x12')]({'output':_0x350fd9});});};exports[_0x7995('0x1d')]=function(_0x13bc35,_0x475351){return pm2[_0x7995('0x1d')]('motion2')[_0x7995('0x1e')](function(_0x34e70c){logger[_0x7995('0x15')](_0x7995('0x1f'),_0x34e70c);return _0x475351[_0x7995('0x11')](0xc8)[_0x7995('0x12')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x7995('0x20')](function(_0x5911c3){logger[_0x7995('0x14')](_0x5911c3);return _0x475351[_0x7995('0x11')](0x1f4)[_0x7995('0x12')](_0x5911c3);});};exports[_0x7995('0x21')]=function(_0x11c1eb,_0x4b6f99){var _0x9b2a15=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x7995('0x22')],'modelName':_0x7995('0x22'),'columnName':_0x7995('0x3')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db['sequelize'][_0x7995('0x23')],function(){throw new Error(_0x7995('0x24'));}],'path':path[_0x7995('0x25')](config[_0x7995('0xa')],_0x7995('0x26'),_0x7995('0x21')),'pattern':/\.js$/}});_0x9b2a15['up']({'from':module['exports']['version']+_0x7995('0x27')})['then'](function(){return _0x4b6f99[_0x7995('0x11')](0xc8)[_0x7995('0x12')]({'output':_0x7995('0x28')});})[_0x7995('0x20')](function(_0x1f7d27){return _0x4b6f99['status'](0x1f4)[_0x7995('0x12')](_0x1f7d27);});};
\ No newline at end of file
index 8dc90b0..ca5aafd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5430=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','isAuthenticated','index','get','/describe','/:id','show','post','put','update','delete'];(function(_0x1eee57,_0x32ecd2){var _0x280af6=function(_0x2d8a64){while(--_0x2d8a64){_0x1eee57['push'](_0x1eee57['shift']());}};_0x280af6(++_0x32ecd2);}(_0x5430,0x10c));var _0x0543=function(_0x48e01b,_0x6b323d){_0x48e01b=_0x48e01b-0x0;var _0x40e989=_0x5430[_0x48e01b];return _0x40e989;};'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 auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0543('0x6'));var controller=require('./voiceAgentReport.controller');router['get']('/',auth[_0x0543('0x7')](),controller[_0x0543('0x8')]);router[_0x0543('0x9')](_0x0543('0xa'),auth[_0x0543('0x7')](),controller['describe']);router[_0x0543('0x9')](_0x0543('0xb'),auth[_0x0543('0x7')](),controller[_0x0543('0xc')]);router[_0x0543('0xd')]('/',auth[_0x0543('0x7')](),controller['create']);router[_0x0543('0xe')](_0x0543('0xb'),auth['isAuthenticated'](),controller[_0x0543('0xf')]);router[_0x0543('0x10')](_0x0543('0xb'),auth[_0x0543('0x7')](),controller[_0x0543('0x11')]);module[_0x0543('0x12')]=router;
\ No newline at end of file
+var _0x7880=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','post','create','put','/:id','update','destroy','exports'];(function(_0x1d3cc8,_0x21646b){var _0x4cc91f=function(_0x2ba3fd){while(--_0x2ba3fd){_0x1d3cc8['push'](_0x1d3cc8['shift']());}};_0x4cc91f(++_0x21646b);}(_0x7880,0x1f4));var _0x0788=function(_0x5ddd87,_0x4cee42){_0x5ddd87=_0x5ddd87-0x0;var _0x4e4161=_0x7880[_0x5ddd87];return _0x4e4161;};'use strict';var multer=require('multer');var util=require(_0x0788('0x0'));var path=require(_0x0788('0x1'));var timeout=require(_0x0788('0x2'));var express=require(_0x0788('0x3'));var router=express[_0x0788('0x4')]();var auth=require(_0x0788('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0788('0x6'));var controller=require(_0x0788('0x7'));router[_0x0788('0x8')]('/',auth[_0x0788('0x9')](),controller[_0x0788('0xa')]);router[_0x0788('0x8')](_0x0788('0xb'),auth[_0x0788('0x9')](),controller[_0x0788('0xc')]);router[_0x0788('0x8')]('/:id',auth[_0x0788('0x9')](),controller['show']);router[_0x0788('0xd')]('/',auth['isAuthenticated'](),controller[_0x0788('0xe')]);router[_0x0788('0xf')](_0x0788('0x10'),auth[_0x0788('0x9')](),controller[_0x0788('0x11')]);router['delete'](_0x0788('0x10'),auth[_0x0788('0x9')](),controller[_0x0788('0x12')]);module[_0x0788('0x13')]=router;
\ No newline at end of file
index f988e3e..a5356fd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb9b1=['BOOLEAN','INTEGER','sequelize','exports','STRING','DATE'];(function(_0x2468b5,_0x506b9e){var _0x1056e4=function(_0x26da1c){while(--_0x26da1c){_0x2468b5['push'](_0x2468b5['shift']());}};_0x1056e4(++_0x506b9e);}(_0xb9b1,0x128));var _0x1b9b=function(_0x36b502,_0x2ffe34){_0x36b502=_0x36b502-0x0;var _0x5018af=_0xb9b1[_0x36b502];return _0x5018af;};'use strict';var Sequelize=require(_0x1b9b('0x0'));module[_0x1b9b('0x1')]={'type':{'type':Sequelize[_0x1b9b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x1b9b('0x2')]},'calleridname':{'type':Sequelize[_0x1b9b('0x2')]},'queue':{'type':Sequelize[_0x1b9b('0x2')]},'interface':{'type':Sequelize[_0x1b9b('0x2')]},'membername':{'type':Sequelize[_0x1b9b('0x2')]},'agentcalledAt':{'type':Sequelize[_0x1b9b('0x3')]},'agentconnectAt':{'type':Sequelize[_0x1b9b('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x1b9b('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x1b9b('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x1b9b('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x1b9b('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x1b9b('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x1b9b('0x5')]},'agentacw':{'type':Sequelize[_0x1b9b('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x1b9b('0x2')]},'lastevent':{'type':Sequelize[_0x1b9b('0x2')]},'channel':{'type':Sequelize[_0x1b9b('0x2')]},'channelstate':{'type':Sequelize[_0x1b9b('0x5')]},'channelstatedesc':{'type':Sequelize[_0x1b9b('0x2')]},'connectedlinenum':{'type':Sequelize[_0x1b9b('0x2')]},'connectedlinename':{'type':Sequelize[_0x1b9b('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x1b9b('0x2')]},'context':{'type':Sequelize[_0x1b9b('0x2')]},'exten':{'type':Sequelize[_0x1b9b('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x1b9b('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x1b9b('0x2')]},'destcalleridnum':{'type':Sequelize[_0x1b9b('0x2')]},'destcalleridname':{'type':Sequelize[_0x1b9b('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x1b9b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x1b9b('0x2')]},'destlanguage':{'type':Sequelize[_0x1b9b('0x2')]},'destaccountcode':{'type':Sequelize[_0x1b9b('0x2')]},'destcontext':{'type':Sequelize[_0x1b9b('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x1b9b('0x2')]},'destuniqueid':{'type':Sequelize[_0x1b9b('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x1b9b('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0xbeec=['DATE','INTEGER','BOOLEAN','exports','STRING'];(function(_0x5a3fc7,_0x2243e6){var _0x1a4b05=function(_0x1645c0){while(--_0x1645c0){_0x5a3fc7['push'](_0x5a3fc7['shift']());}};_0x1a4b05(++_0x2243e6);}(_0xbeec,0x1c5));var _0xcbee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbeec[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xcbee('0x0')]={'type':{'type':Sequelize[_0xcbee('0x1')]},'uniqueid':{'type':Sequelize[_0xcbee('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xcbee('0x1')]},'queue':{'type':Sequelize[_0xcbee('0x1')]},'interface':{'type':Sequelize[_0xcbee('0x1')]},'membername':{'type':Sequelize[_0xcbee('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xcbee('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xcbee('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xcbee('0x2')]},'agentdumpAt':{'type':Sequelize[_0xcbee('0x2')]},'holdtime':{'type':Sequelize[_0xcbee('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xcbee('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xcbee('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xcbee('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xcbee('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xcbee('0x1')]},'channelstate':{'type':Sequelize[_0xcbee('0x3')]},'channelstatedesc':{'type':Sequelize[_0xcbee('0x1')]},'connectedlinenum':{'type':Sequelize[_0xcbee('0x1')]},'connectedlinename':{'type':Sequelize[_0xcbee('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xcbee('0x1')]},'context':{'type':Sequelize[_0xcbee('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xcbee('0x1')]},'destchannel':{'type':Sequelize[_0xcbee('0x1')]},'destchannelstate':{'type':Sequelize[_0xcbee('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xcbee('0x1')]},'destcalleridname':{'type':Sequelize[_0xcbee('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xcbee('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xcbee('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xcbee('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xcbee('0x1')]},'destpriority':{'type':Sequelize[_0xcbee('0x1')]},'destuniqueid':{'type':Sequelize[_0xcbee('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xcbee('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xcbee('0x1')]}};
\ No newline at end of file
index 0938c17..0c72e14 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2c54=['show','params','rawAttributes','length','options','find','create','catch','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','destroy','then','end','stack','name','index','VoiceAgentReport','model','keys','query','intersection','attributes','fields','hasOwnProperty','limit','order','where','filters','filter','merge','type','key','VIRTUAL','count','includeAll','include','findAll','rows'];(function(_0x1cd1ef,_0x49a3bb){var _0x43b467=function(_0x4660ce){while(--_0x4660ce){_0x1cd1ef['push'](_0x1cd1ef['shift']());}};_0x43b467(++_0x49a3bb);}(_0x2c54,0x136));var _0x42c5=function(_0x6a7dea,_0x59ee84){_0x6a7dea=_0x6a7dea-0x0;var _0x249ec8=_0x2c54[_0x6a7dea];return _0x249ec8;};'use strict';var pdf=require(_0x42c5('0x0'));var emlformat=require(_0x42c5('0x1'));var rimraf=require(_0x42c5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x42c5('0x3'));var rp=require(_0x42c5('0x4'));var moment=require(_0x42c5('0x5'));var BPromise=require(_0x42c5('0x6'));var Mustache=require(_0x42c5('0x7'));var util=require(_0x42c5('0x8'));var path=require('path');var sox=require(_0x42c5('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x42c5('0xa'));var squel=require(_0x42c5('0xb'));var crypto=require(_0x42c5('0xc'));var jsforce=require(_0x42c5('0xd'));var deskjs=require(_0x42c5('0xe'));var toCsv=require(_0x42c5('0xf'));var querystring=require(_0x42c5('0x10'));var Papa=require(_0x42c5('0x11'));var authService=require(_0x42c5('0x12'));var hardwareService=require(_0x42c5('0x13'));var Redis=require(_0x42c5('0x14'));var qs=require(_0x42c5('0x15'));var logger=require(_0x42c5('0x16'))(_0x42c5('0x17'));var utils=require(_0x42c5('0x18'));var config=require(_0x42c5('0x19'));var db=require(_0x42c5('0x1a'))['db'];function respondWithStatusCode(_0x3a4e16,_0xb5c314){_0xb5c314=_0xb5c314||0xcc;return function(_0x43793e){if(_0x43793e){return _0x3a4e16[_0x42c5('0x1b')](_0xb5c314);}return _0x3a4e16[_0x42c5('0x1c')](_0xb5c314)['end']();};}function respondWithResult(_0x5d02a3,_0x1b1db5){_0x1b1db5=_0x1b1db5||0xc8;return function(_0xc17623){if(_0xc17623){return _0x5d02a3[_0x42c5('0x1c')](_0x1b1db5)[_0x42c5('0x1d')](_0xc17623);}};}function respondWithFilteredResult(_0x47affc,_0x374218){return function(_0x22d052){if(_0x22d052){var _0x5c9ac2=_0x22d052['count'],_0x4efb1a=_0x374218[_0x42c5('0x1e')],_0x323705=_0x374218['offset']+_0x374218['limit'],_0x4967b4;if(_0x323705>=_0x5c9ac2){_0x323705=_0x5c9ac2;_0x4967b4=0xc8;}else{_0x4967b4=0xce;}_0x47affc[_0x42c5('0x1c')](_0x4967b4);return _0x47affc[_0x42c5('0x1f')](_0x42c5('0x20'),_0x4efb1a+'-'+_0x323705+'/'+_0x5c9ac2)[_0x42c5('0x1d')](_0x22d052);}return null;};}function patchUpdates(_0x431f4e){return function(_0xac2a76){try{jsonpatch[_0x42c5('0x21')](_0xac2a76,_0x431f4e,!![]);}catch(_0x34f31b){return BPromise[_0x42c5('0x22')](_0x34f31b);}return _0xac2a76[_0x42c5('0x23')]();};}function saveUpdates(_0x156209,_0x51023){return function(_0x11c6e8){if(_0x11c6e8){return _0x11c6e8[_0x42c5('0x24')](_0x156209)['then'](function(_0x102294){return _0x102294;});}return null;};}function removeEntity(_0x233841,_0x401083){return function(_0x56fc64){if(_0x56fc64){return _0x56fc64[_0x42c5('0x25')]()[_0x42c5('0x26')](function(){_0x233841['status'](0xcc)[_0x42c5('0x27')]();});}};}function handleEntityNotFound(_0xd577c8,_0x2d8143){return function(_0x3166b5){if(!_0x3166b5){_0xd577c8[_0x42c5('0x1b')](0x194);}return _0x3166b5;};}function handleError(_0x4119bf,_0x5cca39){_0x5cca39=_0x5cca39||0x1f4;return function(_0x2d319d){logger['error'](_0x2d319d[_0x42c5('0x28')]);if(_0x2d319d[_0x42c5('0x29')]){delete _0x2d319d['name'];}_0x4119bf[_0x42c5('0x1c')](_0x5cca39)['send'](_0x2d319d);};}exports[_0x42c5('0x2a')]=function(_0x45e9bf,_0x1058dc){var _0x4096c0={},_0x2cb126={},_0x4431ff={'count':0x0,'rows':[]};var _0x4d852b=db[_0x42c5('0x2b')]['rawAttributes'];_0x2cb126[_0x42c5('0x2c')]=_[_0x42c5('0x2d')](_0x4d852b);_0x2cb126[_0x42c5('0x2e')]=_[_0x42c5('0x2d')](_0x45e9bf['query']);_0x2cb126['filters']=_[_0x42c5('0x2f')](_0x2cb126[_0x42c5('0x2c')],_0x2cb126['query']);_0x4096c0[_0x42c5('0x30')]=_['intersection'](_0x2cb126[_0x42c5('0x2c')],qs['fields'](_0x45e9bf[_0x42c5('0x2e')][_0x42c5('0x31')]));_0x4096c0[_0x42c5('0x30')]=_0x4096c0['attributes']['length']?_0x4096c0[_0x42c5('0x30')]:_0x2cb126[_0x42c5('0x2c')];if(!_0x45e9bf[_0x42c5('0x2e')][_0x42c5('0x32')]('nolimit')){_0x4096c0['limit']=qs[_0x42c5('0x33')](_0x45e9bf[_0x42c5('0x2e')][_0x42c5('0x33')]);_0x4096c0[_0x42c5('0x1e')]=qs[_0x42c5('0x1e')](_0x45e9bf['query'][_0x42c5('0x1e')]);}_0x4096c0[_0x42c5('0x34')]=qs['sort'](_0x45e9bf[_0x42c5('0x2e')]['sort']);_0x4096c0[_0x42c5('0x35')]=qs[_0x42c5('0x36')](_['pick'](_0x45e9bf['query'],_0x2cb126['filters']));if(_0x45e9bf['query'][_0x42c5('0x37')]){_0x4096c0[_0x42c5('0x35')]=_[_0x42c5('0x38')](_0x4096c0[_0x42c5('0x35')],{'$or':_['map'](_0x4d852b,function(_0xc12705){if(_0xc12705[_0x42c5('0x39')][_0x42c5('0x3a')]!==_0x42c5('0x3b')){var _0x481202={};_0x481202[_0xc12705['field']]={'$like':'%'+_0x45e9bf[_0x42c5('0x2e')]['filter']+'%'};return _0x481202;}})});}_0x4096c0=_['merge']({},_0x4096c0,_0x45e9bf['options']);var _0x189d0d={'where':_0x4096c0[_0x42c5('0x35')]};return db[_0x42c5('0x2b')][_0x42c5('0x3c')](_0x189d0d)[_0x42c5('0x26')](function(_0x19c854){_0x4431ff[_0x42c5('0x3c')]=_0x19c854;if(_0x45e9bf[_0x42c5('0x2e')][_0x42c5('0x3d')]){_0x4096c0[_0x42c5('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x42c5('0x3f')](_0x4096c0);})[_0x42c5('0x26')](function(_0x6b53ee){_0x4431ff[_0x42c5('0x40')]=_0x6b53ee;return _0x4431ff;})[_0x42c5('0x26')](respondWithFilteredResult(_0x1058dc,_0x4096c0))['catch'](handleError(_0x1058dc,null));};exports[_0x42c5('0x41')]=function(_0x52a853,_0x9692f1){var _0x3b4d4c={'raw':![],'where':{'id':_0x52a853[_0x42c5('0x42')]['id']}},_0x116cbf={};_0x116cbf[_0x42c5('0x2c')]=_[_0x42c5('0x2d')](db[_0x42c5('0x2b')][_0x42c5('0x43')]);_0x116cbf[_0x42c5('0x2e')]=_[_0x42c5('0x2d')](_0x52a853[_0x42c5('0x2e')]);_0x116cbf[_0x42c5('0x36')]=_[_0x42c5('0x2f')](_0x116cbf[_0x42c5('0x2c')],_0x116cbf[_0x42c5('0x2e')]);_0x3b4d4c[_0x42c5('0x30')]=_[_0x42c5('0x2f')](_0x116cbf[_0x42c5('0x2c')],qs[_0x42c5('0x31')](_0x52a853[_0x42c5('0x2e')][_0x42c5('0x31')]));_0x3b4d4c['attributes']=_0x3b4d4c[_0x42c5('0x30')][_0x42c5('0x44')]?_0x3b4d4c['attributes']:_0x116cbf[_0x42c5('0x2c')];if(_0x52a853[_0x42c5('0x2e')]['includeAll']){_0x3b4d4c[_0x42c5('0x3e')]=[{'all':!![]}];}_0x3b4d4c=_[_0x42c5('0x38')]({},_0x3b4d4c,_0x52a853[_0x42c5('0x45')]);return db[_0x42c5('0x2b')][_0x42c5('0x46')](_0x3b4d4c)[_0x42c5('0x26')](handleEntityNotFound(_0x9692f1,null))[_0x42c5('0x26')](respondWithResult(_0x9692f1,null))['catch'](handleError(_0x9692f1,null));};exports['create']=function(_0x45c6ed,_0x91085){return db[_0x42c5('0x2b')][_0x42c5('0x47')](_0x45c6ed['body'],{})['then'](respondWithResult(_0x91085,0xc9))[_0x42c5('0x48')](handleError(_0x91085,null));};exports[_0x42c5('0x24')]=function(_0x4539a3,_0x39f9cf){if(_0x4539a3[_0x42c5('0x49')]['id']){delete _0x4539a3['body']['id'];}return db[_0x42c5('0x2b')][_0x42c5('0x46')]({'where':{'id':_0x4539a3[_0x42c5('0x42')]['id']}})[_0x42c5('0x26')](handleEntityNotFound(_0x39f9cf,null))['then'](saveUpdates(_0x4539a3[_0x42c5('0x49')],null))[_0x42c5('0x26')](respondWithResult(_0x39f9cf,null))[_0x42c5('0x48')](handleError(_0x39f9cf,null));};exports[_0x42c5('0x25')]=function(_0x20cac2,_0x11f594){return db[_0x42c5('0x2b')][_0x42c5('0x46')]({'where':{'id':_0x20cac2[_0x42c5('0x42')]['id']}})[_0x42c5('0x26')](handleEntityNotFound(_0x11f594,null))['then'](removeEntity(_0x11f594,null))[_0x42c5('0x48')](handleError(_0x11f594,null));};exports[_0x42c5('0x4a')]=function(_0x175323,_0x5176d7){return db[_0x42c5('0x2b')][_0x42c5('0x4a')]()['then'](respondWithResult(_0x5176d7,null))[_0x42c5('0x48')](handleError(_0x5176d7,null));};
\ No newline at end of file
+var _0x6e5f=['keys','query','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','include','rows','show','params','find','create','body','catch','describe','html-pdf','eml-format','zip-dir','request-promise','bluebird','util','sox','ejs','lodash','squel','desk.js','to-csv','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','name','send','index','VoiceAgentReport','rawAttributes','model'];(function(_0x14e3ca,_0x56f083){var _0x5bb0bc=function(_0x4b1b45){while(--_0x4b1b45){_0x14e3ca['push'](_0x14e3ca['shift']());}};_0x5bb0bc(++_0x56f083);}(_0x6e5f,0x1bc));var _0xf6e5=function(_0x465fe1,_0x2856ad){_0x465fe1=_0x465fe1-0x0;var _0xe1746a=_0x6e5f[_0x465fe1];return _0xe1746a;};'use strict';var pdf=require(_0xf6e5('0x0'));var emlformat=require(_0xf6e5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf6e5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf6e5('0x3'));var moment=require('moment');var BPromise=require(_0xf6e5('0x4'));var Mustache=require('mustache');var util=require(_0xf6e5('0x5'));var path=require('path');var sox=require(_0xf6e5('0x6'));var csv=require('to-csv');var ejs=require(_0xf6e5('0x7'));var fs=require('fs');var _=require(_0xf6e5('0x8'));var squel=require(_0xf6e5('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf6e5('0xa'));var toCsv=require(_0xf6e5('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0xf6e5('0xc'));var hardwareService=require(_0xf6e5('0xd'));var Redis=require(_0xf6e5('0xe'));var qs=require(_0xf6e5('0xf'));var logger=require('../../config/logger')(_0xf6e5('0x10'));var utils=require('../../config/utils');var config=require(_0xf6e5('0x11'));var db=require(_0xf6e5('0x12'))['db'];function respondWithStatusCode(_0x40dc82,_0x156025){_0x156025=_0x156025||0xcc;return function(_0x300c70){if(_0x300c70){return _0x40dc82['sendStatus'](_0x156025);}return _0x40dc82[_0xf6e5('0x13')](_0x156025)[_0xf6e5('0x14')]();};}function respondWithResult(_0x4e400c,_0x48ece8){_0x48ece8=_0x48ece8||0xc8;return function(_0x38aac5){if(_0x38aac5){return _0x4e400c['status'](_0x48ece8)['json'](_0x38aac5);}};}function respondWithFilteredResult(_0x5eee42,_0x397cb1){return function(_0x31a18c){if(_0x31a18c){var _0x14ee5a=_0x31a18c[_0xf6e5('0x15')],_0x1b1d10=_0x397cb1['offset'],_0x550cc8=_0x397cb1[_0xf6e5('0x16')]+_0x397cb1['limit'],_0x18db30;if(_0x550cc8>=_0x14ee5a){_0x550cc8=_0x14ee5a;_0x18db30=0xc8;}else{_0x18db30=0xce;}_0x5eee42[_0xf6e5('0x13')](_0x18db30);return _0x5eee42[_0xf6e5('0x17')](_0xf6e5('0x18'),_0x1b1d10+'-'+_0x550cc8+'/'+_0x14ee5a)[_0xf6e5('0x19')](_0x31a18c);}return null;};}function patchUpdates(_0xc94dee){return function(_0x3ac2b6){try{jsonpatch[_0xf6e5('0x1a')](_0x3ac2b6,_0xc94dee,!![]);}catch(_0x3eec93){return BPromise[_0xf6e5('0x1b')](_0x3eec93);}return _0x3ac2b6[_0xf6e5('0x1c')]();};}function saveUpdates(_0x4e60ac,_0x4ec0d0){return function(_0xaa8a47){if(_0xaa8a47){return _0xaa8a47[_0xf6e5('0x1d')](_0x4e60ac)[_0xf6e5('0x1e')](function(_0x3a4908){return _0x3a4908;});}return null;};}function removeEntity(_0x59051e,_0x502021){return function(_0x2d2054){if(_0x2d2054){return _0x2d2054['destroy']()[_0xf6e5('0x1e')](function(){_0x59051e['status'](0xcc)[_0xf6e5('0x14')]();});}};}function handleEntityNotFound(_0x4bf61e,_0x1a108b){return function(_0x1c452c){if(!_0x1c452c){_0x4bf61e[_0xf6e5('0x1f')](0x194);}return _0x1c452c;};}function handleError(_0x6f7a00,_0x301443){_0x301443=_0x301443||0x1f4;return function(_0xb83250){logger[_0xf6e5('0x20')](_0xb83250['stack']);if(_0xb83250[_0xf6e5('0x21')]){delete _0xb83250[_0xf6e5('0x21')];}_0x6f7a00[_0xf6e5('0x13')](_0x301443)[_0xf6e5('0x22')](_0xb83250);};}exports[_0xf6e5('0x23')]=function(_0x8693,_0x38898f){var _0x3ca7cf={},_0x1b44d8={},_0x943df8={'count':0x0,'rows':[]};var _0x236926=db[_0xf6e5('0x24')][_0xf6e5('0x25')];_0x1b44d8[_0xf6e5('0x26')]=_[_0xf6e5('0x27')](_0x236926);_0x1b44d8[_0xf6e5('0x28')]=_[_0xf6e5('0x27')](_0x8693['query']);_0x1b44d8[_0xf6e5('0x29')]=_[_0xf6e5('0x2a')](_0x1b44d8[_0xf6e5('0x26')],_0x1b44d8[_0xf6e5('0x28')]);_0x3ca7cf[_0xf6e5('0x2b')]=_[_0xf6e5('0x2a')](_0x1b44d8[_0xf6e5('0x26')],qs[_0xf6e5('0x2c')](_0x8693[_0xf6e5('0x28')][_0xf6e5('0x2c')]));_0x3ca7cf[_0xf6e5('0x2b')]=_0x3ca7cf[_0xf6e5('0x2b')][_0xf6e5('0x2d')]?_0x3ca7cf[_0xf6e5('0x2b')]:_0x1b44d8['model'];if(!_0x8693[_0xf6e5('0x28')]['hasOwnProperty']('nolimit')){_0x3ca7cf[_0xf6e5('0x2e')]=qs[_0xf6e5('0x2e')](_0x8693[_0xf6e5('0x28')][_0xf6e5('0x2e')]);_0x3ca7cf[_0xf6e5('0x16')]=qs[_0xf6e5('0x16')](_0x8693[_0xf6e5('0x28')][_0xf6e5('0x16')]);}_0x3ca7cf[_0xf6e5('0x2f')]=qs[_0xf6e5('0x30')](_0x8693['query']['sort']);_0x3ca7cf[_0xf6e5('0x31')]=qs[_0xf6e5('0x29')](_[_0xf6e5('0x32')](_0x8693[_0xf6e5('0x28')],_0x1b44d8[_0xf6e5('0x29')]));if(_0x8693['query'][_0xf6e5('0x33')]){_0x3ca7cf['where']=_[_0xf6e5('0x34')](_0x3ca7cf[_0xf6e5('0x31')],{'$or':_[_0xf6e5('0x35')](_0x236926,function(_0x1bdf92){if(_0x1bdf92[_0xf6e5('0x36')][_0xf6e5('0x37')]!==_0xf6e5('0x38')){var _0xc9fc0a={};_0xc9fc0a[_0x1bdf92[_0xf6e5('0x39')]]={'$like':'%'+_0x8693[_0xf6e5('0x28')]['filter']+'%'};return _0xc9fc0a;}})});}_0x3ca7cf=_[_0xf6e5('0x34')]({},_0x3ca7cf,_0x8693[_0xf6e5('0x3a')]);var _0x5a3ec3={'where':_0x3ca7cf[_0xf6e5('0x31')]};return db[_0xf6e5('0x24')][_0xf6e5('0x15')](_0x5a3ec3)[_0xf6e5('0x1e')](function(_0x4cf0ca){_0x943df8[_0xf6e5('0x15')]=_0x4cf0ca;if(_0x8693[_0xf6e5('0x28')][_0xf6e5('0x3b')]){_0x3ca7cf[_0xf6e5('0x3c')]=[{'all':!![]}];}return db['VoiceAgentReport']['findAll'](_0x3ca7cf);})[_0xf6e5('0x1e')](function(_0x47343a){_0x943df8[_0xf6e5('0x3d')]=_0x47343a;return _0x943df8;})[_0xf6e5('0x1e')](respondWithFilteredResult(_0x38898f,_0x3ca7cf))['catch'](handleError(_0x38898f,null));};exports[_0xf6e5('0x3e')]=function(_0x50ea2d,_0x23586b){var _0x1af222={'raw':![],'where':{'id':_0x50ea2d[_0xf6e5('0x3f')]['id']}},_0x557bb3={};_0x557bb3[_0xf6e5('0x26')]=_['keys'](db[_0xf6e5('0x24')]['rawAttributes']);_0x557bb3[_0xf6e5('0x28')]=_[_0xf6e5('0x27')](_0x50ea2d['query']);_0x557bb3['filters']=_[_0xf6e5('0x2a')](_0x557bb3[_0xf6e5('0x26')],_0x557bb3[_0xf6e5('0x28')]);_0x1af222[_0xf6e5('0x2b')]=_['intersection'](_0x557bb3[_0xf6e5('0x26')],qs['fields'](_0x50ea2d[_0xf6e5('0x28')][_0xf6e5('0x2c')]));_0x1af222[_0xf6e5('0x2b')]=_0x1af222[_0xf6e5('0x2b')][_0xf6e5('0x2d')]?_0x1af222['attributes']:_0x557bb3['model'];if(_0x50ea2d[_0xf6e5('0x28')][_0xf6e5('0x3b')]){_0x1af222['include']=[{'all':!![]}];}_0x1af222=_['merge']({},_0x1af222,_0x50ea2d[_0xf6e5('0x3a')]);return db[_0xf6e5('0x24')][_0xf6e5('0x40')](_0x1af222)[_0xf6e5('0x1e')](handleEntityNotFound(_0x23586b,null))[_0xf6e5('0x1e')](respondWithResult(_0x23586b,null))['catch'](handleError(_0x23586b,null));};exports[_0xf6e5('0x41')]=function(_0x10e5fe,_0x84e58f){return db[_0xf6e5('0x24')]['create'](_0x10e5fe[_0xf6e5('0x42')],{})[_0xf6e5('0x1e')](respondWithResult(_0x84e58f,0xc9))[_0xf6e5('0x43')](handleError(_0x84e58f,null));};exports[_0xf6e5('0x1d')]=function(_0x363f43,_0x5af444){if(_0x363f43[_0xf6e5('0x42')]['id']){delete _0x363f43[_0xf6e5('0x42')]['id'];}return db[_0xf6e5('0x24')][_0xf6e5('0x40')]({'where':{'id':_0x363f43[_0xf6e5('0x3f')]['id']}})[_0xf6e5('0x1e')](handleEntityNotFound(_0x5af444,null))[_0xf6e5('0x1e')](saveUpdates(_0x363f43[_0xf6e5('0x42')],null))[_0xf6e5('0x1e')](respondWithResult(_0x5af444,null))['catch'](handleError(_0x5af444,null));};exports['destroy']=function(_0x3e5a06,_0x498308){return db[_0xf6e5('0x24')][_0xf6e5('0x40')]({'where':{'id':_0x3e5a06[_0xf6e5('0x3f')]['id']}})[_0xf6e5('0x1e')](handleEntityNotFound(_0x498308,null))[_0xf6e5('0x1e')](removeEntity(_0x498308,null))[_0xf6e5('0x43')](handleError(_0x498308,null));};exports[_0xf6e5('0x44')]=function(_0x4562e4,_0x4fdb07){return db[_0xf6e5('0x24')]['describe']()[_0xf6e5('0x1e')](respondWithResult(_0x4fdb07,null))['catch'](handleError(_0x4fdb07,null));};
\ No newline at end of file
index 1b4b3c7..0ced70f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8348=['uniqueid','bluebird','request-promise','./voiceAgentReport.attributes','define','VoiceAgentReport'];(function(_0x378386,_0x5caab9){var _0x40dffb=function(_0x2b2e54){while(--_0x2b2e54){_0x378386['push'](_0x378386['shift']());}};_0x40dffb(++_0x5caab9);}(_0x8348,0xd3));var _0x8834=function(_0x5e8141,_0x12f928){_0x5e8141=_0x5e8141-0x0;var _0x277ef1=_0x8348[_0x5e8141];return _0x277ef1;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8834('0x0'));var rp=require(_0x8834('0x1'));var attributes=require(_0x8834('0x2'));module['exports']=function(_0x17ba53,_0x287269){return _0x17ba53[_0x8834('0x3')](_0x8834('0x4'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x8834('0x5'),'destuniqueid']}],'timestamps':!![]});};
\ No newline at end of file
+var _0x7c1e=['define','report_agent','uniqueid','destuniqueid','./voiceAgentReport.attributes'];(function(_0xbc2f9e,_0x4c9be1){var _0x4a9601=function(_0x2821df){while(--_0x2821df){_0xbc2f9e['push'](_0xbc2f9e['shift']());}};_0x4a9601(++_0x4c9be1);}(_0x7c1e,0x14e));var _0xe7c1=function(_0xe29ebe,_0x37fc28){_0xe29ebe=_0xe29ebe-0x0;var _0x1ad9cd=_0x7c1e[_0xe29ebe];return _0x1ad9cd;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xe7c1('0x0'));module['exports']=function(_0x21ed5b,_0x15226e){return _0x21ed5b[_0xe7c1('0x1')]('VoiceAgentReport',attributes,{'tableName':_0xe7c1('0x2'),'paranoid':![],'indexes':[{'fields':[_0xe7c1('0x3'),_0xe7c1('0x4')]}],'timestamps':!![]});};
\ No newline at end of file
index 8c855c2..3cd3b0d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceAgentReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','VoiceAgentReport','create','body','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','where','attributes','limit','then','lodash','util'];(function(_0xf35ae7,_0x419928){var _0x4f9e45=function(_0x54f644){while(--_0x54f644){_0xf35ae7['push'](_0xf35ae7['shift']());}};_0x4f9e45(++_0x419928);}(_0x7a54,0x106));var _0x47a5=function(_0x59afc1,_0x530e07){_0x59afc1=_0x59afc1-0x0;var _0x5e77d6=_0x7a54[_0x59afc1];return _0x5e77d6;};'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')]('VoiceAgentReport,\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['CreateVoiceAgentReport']=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')]('CreateVoiceAgentReport',_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')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});};
\ No newline at end of file
+var _0x814b=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateVoiceAgentReport','body','raw','stringify','VoiceAgentReport','update','options','where','attributes','limit','UpdateVoiceAgentReport','lodash','util'];(function(_0x2e7c1b,_0x232f79){var _0x42f565=function(_0x31ee5a){while(--_0x31ee5a){_0x2e7c1b['push'](_0x2e7c1b['shift']());}};_0x42f565(++_0x232f79);}(_0x814b,0x1a2));var _0xb814=function(_0x3b3933,_0x4a5bd2){_0x3b3933=_0x3b3933-0x0;var _0x41d2c4=_0x814b[_0x3b3933];return _0x41d2c4;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['VoiceAgentReport']['create'](_0x55ba16[_0xb814('0x19')],{'raw':_0x55ba16['options']?_0x55ba16['options'][_0xb814('0x1a')]===undefined?!![]:![]:!![]})[_0xb814('0xd')](function(_0x25b6b6){logger['info'](_0xb814('0x18'),_0x55ba16);logger['debug'](_0xb814('0x18'),_0x55ba16,JSON[_0xb814('0x1b')](_0x25b6b6));_0xfac75b(_0x25b6b6);})[_0xb814('0x17')](function(_0x470e81){logger[_0xb814('0x13')](_0xb814('0x18'),_0x470e81[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x470e81[_0xb814('0x15')]));});});};exports['UpdateVoiceAgentReport']=function(_0x3f81d0){var _0x457dac=this;return new Promise(function(_0x31c7ec,_0x208927){return db[_0xb814('0x1c')][_0xb814('0x1d')](_0x3f81d0[_0xb814('0x19')],{'raw':_0x3f81d0['options']?_0x3f81d0[_0xb814('0x1e')][_0xb814('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f81d0[_0xb814('0x1e')]?_0x3f81d0[_0xb814('0x1e')][_0xb814('0x1f')]||null:null,'attributes':_0x3f81d0[_0xb814('0x1e')]?_0x3f81d0[_0xb814('0x1e')][_0xb814('0x20')]||null:null,'limit':_0x3f81d0['options']?_0x3f81d0[_0xb814('0x1e')][_0xb814('0x21')]||null:null})['then'](function(_0x9008b2){logger[_0xb814('0xe')](_0xb814('0x22'),_0x3f81d0);logger['debug'](_0xb814('0x22'),_0x3f81d0,JSON[_0xb814('0x1b')](_0x9008b2));_0x31c7ec(_0x9008b2);})['catch'](function(_0x338a28){logger['error'](_0xb814('0x22'),_0x338a28['message'],_0x3f81d0);_0x208927(_0x457dac['error'](0x1f4,_0x338a28[_0xb814('0x15')]));});});};
\ No newline at end of file
index e8bb713..287a8cf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x70ac=['Router','../../config/environment','get','/describe','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x70ac,0x1a5));var _0xc70a=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x70ac[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require(_0xc70a('0x0'));var util=require(_0xc70a('0x1'));var path=require(_0xc70a('0x2'));var timeout=require('connect-timeout');var express=require(_0xc70a('0x3'));var router=express[_0xc70a('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc70a('0x5'));var controller=require('./voiceCallReport.controller');router[_0xc70a('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc70a('0x6')](_0xc70a('0x7'),auth[_0xc70a('0x8')](),controller['describe']);router[_0xc70a('0x6')](_0xc70a('0x9'),auth[_0xc70a('0x8')](),controller['show']);router[_0xc70a('0xa')]('/',auth[_0xc70a('0x8')](),controller[_0xc70a('0xb')]);router[_0xc70a('0xc')](_0xc70a('0x9'),auth[_0xc70a('0x8')](),controller[_0xc70a('0xd')]);router[_0xc70a('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xc70a('0xf')]);module[_0xc70a('0x10')]=router;
\ No newline at end of file
+var _0xb656=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','exports','multer','util'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb656,0x152));var _0x6b65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb656[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6b65('0x0'));var util=require(_0x6b65('0x1'));var path=require(_0x6b65('0x2'));var timeout=require(_0x6b65('0x3'));var express=require(_0x6b65('0x4'));var router=express['Router']();var auth=require(_0x6b65('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6b65('0x6'));var controller=require(_0x6b65('0x7'));router[_0x6b65('0x8')]('/',auth[_0x6b65('0x9')](),controller[_0x6b65('0xa')]);router['get'](_0x6b65('0xb'),auth[_0x6b65('0x9')](),controller['describe']);router[_0x6b65('0x8')](_0x6b65('0xc'),auth[_0x6b65('0x9')](),controller[_0x6b65('0xd')]);router[_0x6b65('0xe')]('/',auth[_0x6b65('0x9')](),controller[_0x6b65('0xf')]);router[_0x6b65('0x10')]('/:id',auth[_0x6b65('0x9')](),controller[_0x6b65('0x11')]);router[_0x6b65('0x12')](_0x6b65('0xc'),auth[_0x6b65('0x9')](),controller['destroy']);module[_0x6b65('0x13')]=router;
\ No newline at end of file
index 7609393..46b4307 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3ea2=['inbound','outbound','outbound-fax','dialer','DATE','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x1b165e,_0x26b02b){var _0x2d6dde=function(_0x539c22){while(--_0x539c22){_0x1b165e['push'](_0x1b165e['shift']());}};_0x2d6dde(++_0x26b02b);}(_0x3ea2,0x16e));var _0x23ea=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0x3ea2[_0x163040];return _0x364667;};'use strict';var Sequelize=require(_0x23ea('0x0'));module[_0x23ea('0x1')]={'uniqueid':{'type':Sequelize[_0x23ea('0x2')]},'type':{'type':Sequelize[_0x23ea('0x3')](_0x23ea('0x4'),'internal',_0x23ea('0x5'),'inbound-fax',_0x23ea('0x6'),_0x23ea('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x23ea('0x2')]},'source':{'type':Sequelize[_0x23ea('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x23ea('0x2')]},'channel':{'type':Sequelize[_0x23ea('0x2')]},'destinationchannel':{'type':Sequelize[_0x23ea('0x2')]},'lastapplication':{'type':Sequelize[_0x23ea('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x23ea('0x8')]},'answertime':{'type':Sequelize[_0x23ea('0x8')]},'endtime':{'type':Sequelize[_0x23ea('0x8')]},'duration':{'type':Sequelize[_0x23ea('0x9')]},'billableseconds':{'type':Sequelize[_0x23ea('0x9')]},'mohtime':{'type':Sequelize[_0x23ea('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x23ea('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x23ea('0x2')]},'userDisposition':{'type':Sequelize[_0x23ea('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x23ea('0x2')]},'routeid':{'type':Sequelize[_0x23ea('0x9')]}};
\ No newline at end of file
+var _0x1a38=['inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','STRING','inbound','internal','outbound'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x1a38,0x1c9));var _0x81a3=function(_0x4bd950,_0x184ed5){_0x4bd950=_0x4bd950-0x0;var _0x5dc59a=_0x1a38[_0x4bd950];return _0x5dc59a;};'use strict';var Sequelize=require(_0x81a3('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x81a3('0x1')]},'type':{'type':Sequelize['ENUM'](_0x81a3('0x2'),_0x81a3('0x3'),_0x81a3('0x4'),_0x81a3('0x5'),_0x81a3('0x6'),_0x81a3('0x7'))},'tag':{'type':Sequelize[_0x81a3('0x1')]},'accountcode':{'type':Sequelize[_0x81a3('0x1')]},'source':{'type':Sequelize[_0x81a3('0x1')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x81a3('0x1')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x81a3('0x1')]},'destinationchannel':{'type':Sequelize[_0x81a3('0x1')]},'lastapplication':{'type':Sequelize[_0x81a3('0x1')]},'lastdata':{'type':Sequelize[_0x81a3('0x8')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x81a3('0x9')]},'endtime':{'type':Sequelize[_0x81a3('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x81a3('0xa')]},'mohtime':{'type':Sequelize[_0x81a3('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x81a3('0x1')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x81a3('0x1')]},'note':{'type':Sequelize[_0x81a3('0x1')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x81a3('0xa')]}};
\ No newline at end of file
index 6000102..fbca7c5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x143b=['json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','VoiceCallReport','rawAttributes','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','map','key','VIRTUAL','field','merge','where','includeAll','include','fullname','User','findAll','catch','params','length','options','find','body','describe','uniqueid','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','ioredis','../../config/utils','sendStatus','status','end'];(function(_0x20df6,_0x4018b9){var _0x2e1133=function(_0x4e2b7d){while(--_0x4e2b7d){_0x20df6['push'](_0x20df6['shift']());}};_0x2e1133(++_0x4018b9);}(_0x143b,0x77));var _0xb143=function(_0xba4a60,_0x1961cf){_0xba4a60=_0xba4a60-0x0;var _0x227640=_0x143b[_0xba4a60];return _0x227640;};'use strict';var pdf=require(_0xb143('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb143('0x1'));var zipdir=require(_0xb143('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb143('0x3'));var moment=require('moment');var BPromise=require(_0xb143('0x4'));var Mustache=require(_0xb143('0x5'));var util=require('util');var path=require(_0xb143('0x6'));var sox=require(_0xb143('0x7'));var csv=require(_0xb143('0x8'));var ejs=require(_0xb143('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb143('0xa'));var crypto=require(_0xb143('0xb'));var jsforce=require(_0xb143('0xc'));var deskjs=require(_0xb143('0xd'));var toCsv=require(_0xb143('0x8'));var querystring=require(_0xb143('0xe'));var Papa=require('papaparse');var authService=require(_0xb143('0xf'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0xb143('0x10'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require(_0xb143('0x11'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a08ef,_0x30c48f){_0x30c48f=_0x30c48f||0xcc;return function(_0x14fcd3){if(_0x14fcd3){return _0x5a08ef[_0xb143('0x12')](_0x30c48f);}return _0x5a08ef[_0xb143('0x13')](_0x30c48f)[_0xb143('0x14')]();};}function respondWithResult(_0x233a95,_0x48335b){_0x48335b=_0x48335b||0xc8;return function(_0x19080f){if(_0x19080f){return _0x233a95[_0xb143('0x13')](_0x48335b)[_0xb143('0x15')](_0x19080f);}};}function respondWithFilteredResult(_0x3b207a,_0x521685){return function(_0x45f175){if(_0x45f175){var _0x324dba=_0x45f175[_0xb143('0x16')],_0x2d8a27=_0x521685[_0xb143('0x17')],_0x5d17e2=_0x521685[_0xb143('0x17')]+_0x521685[_0xb143('0x18')],_0x39d16d;if(_0x5d17e2>=_0x324dba){_0x5d17e2=_0x324dba;_0x39d16d=0xc8;}else{_0x39d16d=0xce;}_0x3b207a[_0xb143('0x13')](_0x39d16d);return _0x3b207a[_0xb143('0x19')](_0xb143('0x1a'),_0x2d8a27+'-'+_0x5d17e2+'/'+_0x324dba)[_0xb143('0x15')](_0x45f175);}return null;};}function patchUpdates(_0x238c01){return function(_0x49df02){try{jsonpatch[_0xb143('0x1b')](_0x49df02,_0x238c01,!![]);}catch(_0x185dcb){return BPromise[_0xb143('0x1c')](_0x185dcb);}return _0x49df02[_0xb143('0x1d')]();};}function saveUpdates(_0x4e4dbf,_0x576645){return function(_0x3bd96c){if(_0x3bd96c){return _0x3bd96c['update'](_0x4e4dbf)[_0xb143('0x1e')](function(_0xa7bc35){return _0xa7bc35;});}return null;};}function removeEntity(_0x1d0435,_0x15cfc4){return function(_0x427337){if(_0x427337){return _0x427337[_0xb143('0x1f')]()[_0xb143('0x1e')](function(){_0x1d0435[_0xb143('0x13')](0xcc)[_0xb143('0x14')]();});}};}function handleEntityNotFound(_0x41a1cf,_0x2bd963){return function(_0x6494cb){if(!_0x6494cb){_0x41a1cf[_0xb143('0x12')](0x194);}return _0x6494cb;};}function handleError(_0x3014cf,_0x48bde1){_0x48bde1=_0x48bde1||0x1f4;return function(_0x1a064e){logger[_0xb143('0x20')](_0x1a064e[_0xb143('0x21')]);if(_0x1a064e[_0xb143('0x22')]){delete _0x1a064e[_0xb143('0x22')];}_0x3014cf[_0xb143('0x13')](_0x48bde1)[_0xb143('0x23')](_0x1a064e);};}exports[_0xb143('0x24')]=function(_0x4fe287,_0x2bcc8b){var _0x59aea2={},_0x27914d={},_0x35891a={'count':0x0,'rows':[]};var _0xfb9994=db[_0xb143('0x25')][_0xb143('0x26')];_0x27914d[_0xb143('0x27')]=_[_0xb143('0x28')](_0xfb9994);_0x27914d[_0xb143('0x29')]=_[_0xb143('0x28')](_0x4fe287['query']);_0x27914d['filters']=_[_0xb143('0x2a')](_0x27914d[_0xb143('0x27')],_0x27914d['query']);_0x59aea2[_0xb143('0x2b')]=_['intersection'](_0x27914d[_0xb143('0x27')],qs[_0xb143('0x2c')](_0x4fe287[_0xb143('0x29')]['fields']));_0x59aea2[_0xb143('0x2b')]=_0x59aea2[_0xb143('0x2b')]['length']?_0x59aea2[_0xb143('0x2b')]:_0x27914d['model'];if(!_0x4fe287['query'][_0xb143('0x2d')](_0xb143('0x2e'))){_0x59aea2[_0xb143('0x18')]=qs[_0xb143('0x18')](_0x4fe287[_0xb143('0x29')][_0xb143('0x18')]);_0x59aea2[_0xb143('0x17')]=qs['offset'](_0x4fe287[_0xb143('0x29')]['offset']);}_0x59aea2[_0xb143('0x2f')]=qs[_0xb143('0x30')](_0x4fe287[_0xb143('0x29')][_0xb143('0x30')]);_0x59aea2['where']=qs[_0xb143('0x31')](_['pick'](_0x4fe287[_0xb143('0x29')],_0x27914d[_0xb143('0x31')]));if(_0x4fe287[_0xb143('0x29')][_0xb143('0x32')]){_0x59aea2['where']=_['merge'](_0x59aea2['where'],{'$or':_[_0xb143('0x33')](_0xfb9994,function(_0x21eb5c){if(_0x21eb5c['type'][_0xb143('0x34')]!==_0xb143('0x35')){var _0x13b1e2={};_0x13b1e2[_0x21eb5c[_0xb143('0x36')]]={'$like':'%'+_0x4fe287[_0xb143('0x29')]['filter']+'%'};return _0x13b1e2;}})});}_0x59aea2=_[_0xb143('0x37')]({},_0x59aea2,_0x4fe287['options']);var _0x3dffc8={'where':_0x59aea2[_0xb143('0x38')]};return db['VoiceCallReport']['count'](_0x3dffc8)[_0xb143('0x1e')](function(_0x133b02){_0x35891a[_0xb143('0x16')]=_0x133b02;if(_0x4fe287[_0xb143('0x29')][_0xb143('0x39')]){_0x59aea2[_0xb143('0x3a')]=[{'attributes':['id',_0xb143('0x22'),_0xb143('0x3b'),'alias'],'model':db[_0xb143('0x3c')],'as':_0xb143('0x3c')}];}return db[_0xb143('0x25')][_0xb143('0x3d')](_0x59aea2);})[_0xb143('0x1e')](function(_0x4332a1){_0x35891a['rows']=_0x4332a1;return _0x35891a;})[_0xb143('0x1e')](respondWithFilteredResult(_0x2bcc8b,_0x59aea2))[_0xb143('0x3e')](handleError(_0x2bcc8b,null));};exports['show']=function(_0x3c016c,_0x5deacb){var _0x5b1314={'raw':!![],'where':{'id':_0x3c016c[_0xb143('0x3f')]['id']}},_0x59e00e={};_0x59e00e['model']=_[_0xb143('0x28')](db[_0xb143('0x25')][_0xb143('0x26')]);_0x59e00e['query']=_[_0xb143('0x28')](_0x3c016c[_0xb143('0x29')]);_0x59e00e[_0xb143('0x31')]=_[_0xb143('0x2a')](_0x59e00e[_0xb143('0x27')],_0x59e00e[_0xb143('0x29')]);_0x5b1314['attributes']=_[_0xb143('0x2a')](_0x59e00e[_0xb143('0x27')],qs['fields'](_0x3c016c['query'][_0xb143('0x2c')]));_0x5b1314[_0xb143('0x2b')]=_0x5b1314['attributes'][_0xb143('0x40')]?_0x5b1314[_0xb143('0x2b')]:_0x59e00e[_0xb143('0x27')];if(_0x3c016c['query'][_0xb143('0x39')]){_0x5b1314['include']=[{'all':!![]}];}_0x5b1314=_[_0xb143('0x37')]({},_0x5b1314,_0x3c016c[_0xb143('0x41')]);return db[_0xb143('0x25')][_0xb143('0x42')](_0x5b1314)[_0xb143('0x1e')](handleEntityNotFound(_0x5deacb,null))[_0xb143('0x1e')](respondWithResult(_0x5deacb,null))[_0xb143('0x3e')](handleError(_0x5deacb,null));};exports['create']=function(_0x3ad6af,_0x2a0476){return db['VoiceCallReport']['create'](_0x3ad6af[_0xb143('0x43')],{})[_0xb143('0x1e')](respondWithResult(_0x2a0476,0xc9))[_0xb143('0x3e')](handleError(_0x2a0476,null));};exports[_0xb143('0x1f')]=function(_0x2a3fe5,_0x576a02){return db[_0xb143('0x25')]['find']({'where':{'id':_0x2a3fe5['params']['id']}})[_0xb143('0x1e')](handleEntityNotFound(_0x576a02,null))[_0xb143('0x1e')](removeEntity(_0x576a02,null))[_0xb143('0x3e')](handleError(_0x576a02,null));};exports['describe']=function(_0x4ea910,_0x35aea5){return db[_0xb143('0x25')][_0xb143('0x44')]()[_0xb143('0x1e')](respondWithResult(_0x35aea5,null))['catch'](handleError(_0x35aea5,null));};exports['update']=function(_0x506484,_0x298b92){if(_0x506484[_0xb143('0x43')][_0xb143('0x45')]){delete _0x506484[_0xb143('0x43')][_0xb143('0x45')];}return db[_0xb143('0x25')][_0xb143('0x42')]({'where':{'uniqueid':_0x506484[_0xb143('0x3f')]['id'],'UserId':{'$or':[null,_0x506484['user']['id']]}}})[_0xb143('0x1e')](handleEntityNotFound(_0x298b92,null))[_0xb143('0x1e')](saveUpdates(_0x506484[_0xb143('0x43')],null))[_0xb143('0x1e')](respondWithResult(_0x298b92,null))[_0xb143('0x3e')](handleError(_0x298b92,null));};
\ No newline at end of file
+var _0xd368=['includeAll','merge','create','find','describe','body','uniqueid','user','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','sendStatus','status','end','limit','json','apply','reject','save','update','destroy','then','stack','name','VoiceCallReport','rawAttributes','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','offset','order','where','pick','filter','type','key','VIRTUAL','field','options','count','include','alias','User','findAll','rows','catch','show','params'];(function(_0x1d6785,_0x1b754e){var _0x486c95=function(_0x2987f6){while(--_0x2987f6){_0x1d6785['push'](_0x1d6785['shift']());}};_0x486c95(++_0x1b754e);}(_0xd368,0x170));var _0x8d36=function(_0x6f432e,_0x23b287){_0x6f432e=_0x6f432e-0x0;var _0xb2cfe0=_0xd368[_0x6f432e];return _0xb2cfe0;};'use strict';var pdf=require(_0x8d36('0x0'));var emlformat=require(_0x8d36('0x1'));var rimraf=require(_0x8d36('0x2'));var zipdir=require(_0x8d36('0x3'));var jsonpatch=require(_0x8d36('0x4'));var rp=require(_0x8d36('0x5'));var moment=require('moment');var BPromise=require(_0x8d36('0x6'));var Mustache=require(_0x8d36('0x7'));var util=require(_0x8d36('0x8'));var path=require(_0x8d36('0x9'));var sox=require(_0x8d36('0xa'));var csv=require(_0x8d36('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8d36('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8d36('0xb'));var querystring=require(_0x8d36('0xd'));var Papa=require(_0x8d36('0xe'));var authService=require(_0x8d36('0xf'));var hardwareService=require(_0x8d36('0x10'));var Redis=require(_0x8d36('0x11'));var qs=require(_0x8d36('0x12'));var logger=require('../../config/logger')(_0x8d36('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c51c5,_0x10d588){_0x10d588=_0x10d588||0xcc;return function(_0x1fee97){if(_0x1fee97){return _0x3c51c5[_0x8d36('0x14')](_0x10d588);}return _0x3c51c5[_0x8d36('0x15')](_0x10d588)[_0x8d36('0x16')]();};}function respondWithResult(_0x9fc2a6,_0x385ff6){_0x385ff6=_0x385ff6||0xc8;return function(_0x2fdb89){if(_0x2fdb89){return _0x9fc2a6[_0x8d36('0x15')](_0x385ff6)['json'](_0x2fdb89);}};}function respondWithFilteredResult(_0x127786,_0x3876cc){return function(_0x541d7d){if(_0x541d7d){var _0x35cec3=_0x541d7d['count'],_0x32b27d=_0x3876cc['offset'],_0x4d22a0=_0x3876cc['offset']+_0x3876cc[_0x8d36('0x17')],_0x197bbc;if(_0x4d22a0>=_0x35cec3){_0x4d22a0=_0x35cec3;_0x197bbc=0xc8;}else{_0x197bbc=0xce;}_0x127786[_0x8d36('0x15')](_0x197bbc);return _0x127786['set']('Content-Range',_0x32b27d+'-'+_0x4d22a0+'/'+_0x35cec3)[_0x8d36('0x18')](_0x541d7d);}return null;};}function patchUpdates(_0x1ae1db){return function(_0x439f7a){try{jsonpatch[_0x8d36('0x19')](_0x439f7a,_0x1ae1db,!![]);}catch(_0x224383){return BPromise[_0x8d36('0x1a')](_0x224383);}return _0x439f7a[_0x8d36('0x1b')]();};}function saveUpdates(_0x4dad65,_0x175229){return function(_0x1811b6){if(_0x1811b6){return _0x1811b6[_0x8d36('0x1c')](_0x4dad65)['then'](function(_0x43edb1){return _0x43edb1;});}return null;};}function removeEntity(_0x113f16,_0x36ef6b){return function(_0x3dce44){if(_0x3dce44){return _0x3dce44[_0x8d36('0x1d')]()[_0x8d36('0x1e')](function(){_0x113f16[_0x8d36('0x15')](0xcc)[_0x8d36('0x16')]();});}};}function handleEntityNotFound(_0x5679f3,_0x5662b3){return function(_0x2ef807){if(!_0x2ef807){_0x5679f3[_0x8d36('0x14')](0x194);}return _0x2ef807;};}function handleError(_0x32fa4f,_0x2f0e61){_0x2f0e61=_0x2f0e61||0x1f4;return function(_0x3ab3da){logger['error'](_0x3ab3da[_0x8d36('0x1f')]);if(_0x3ab3da[_0x8d36('0x20')]){delete _0x3ab3da[_0x8d36('0x20')];}_0x32fa4f['status'](_0x2f0e61)['send'](_0x3ab3da);};}exports['index']=function(_0x330525,_0x373144){var _0x276d41={},_0x1e6a51={},_0x4d906a={'count':0x0,'rows':[]};var _0x1a2d47=db[_0x8d36('0x21')][_0x8d36('0x22')];_0x1e6a51['model']=_[_0x8d36('0x23')](_0x1a2d47);_0x1e6a51['query']=_[_0x8d36('0x23')](_0x330525[_0x8d36('0x24')]);_0x1e6a51[_0x8d36('0x25')]=_[_0x8d36('0x26')](_0x1e6a51[_0x8d36('0x27')],_0x1e6a51[_0x8d36('0x24')]);_0x276d41['attributes']=_[_0x8d36('0x26')](_0x1e6a51[_0x8d36('0x27')],qs[_0x8d36('0x28')](_0x330525['query']['fields']));_0x276d41[_0x8d36('0x29')]=_0x276d41[_0x8d36('0x29')][_0x8d36('0x2a')]?_0x276d41[_0x8d36('0x29')]:_0x1e6a51[_0x8d36('0x27')];if(!_0x330525[_0x8d36('0x24')][_0x8d36('0x2b')](_0x8d36('0x2c'))){_0x276d41[_0x8d36('0x17')]=qs['limit'](_0x330525[_0x8d36('0x24')][_0x8d36('0x17')]);_0x276d41[_0x8d36('0x2d')]=qs[_0x8d36('0x2d')](_0x330525[_0x8d36('0x24')]['offset']);}_0x276d41[_0x8d36('0x2e')]=qs['sort'](_0x330525[_0x8d36('0x24')]['sort']);_0x276d41[_0x8d36('0x2f')]=qs[_0x8d36('0x25')](_[_0x8d36('0x30')](_0x330525[_0x8d36('0x24')],_0x1e6a51[_0x8d36('0x25')]));if(_0x330525[_0x8d36('0x24')][_0x8d36('0x31')]){_0x276d41['where']=_['merge'](_0x276d41[_0x8d36('0x2f')],{'$or':_['map'](_0x1a2d47,function(_0x33011a){if(_0x33011a[_0x8d36('0x32')][_0x8d36('0x33')]!==_0x8d36('0x34')){var _0x3d66f6={};_0x3d66f6[_0x33011a[_0x8d36('0x35')]]={'$like':'%'+_0x330525[_0x8d36('0x24')][_0x8d36('0x31')]+'%'};return _0x3d66f6;}})});}_0x276d41=_['merge']({},_0x276d41,_0x330525[_0x8d36('0x36')]);var _0x1f3c08={'where':_0x276d41['where']};return db['VoiceCallReport'][_0x8d36('0x37')](_0x1f3c08)[_0x8d36('0x1e')](function(_0x379154){_0x4d906a[_0x8d36('0x37')]=_0x379154;if(_0x330525['query']['includeAll']){_0x276d41[_0x8d36('0x38')]=[{'attributes':['id',_0x8d36('0x20'),'fullname',_0x8d36('0x39')],'model':db[_0x8d36('0x3a')],'as':_0x8d36('0x3a')}];}return db['VoiceCallReport'][_0x8d36('0x3b')](_0x276d41);})[_0x8d36('0x1e')](function(_0x119998){_0x4d906a[_0x8d36('0x3c')]=_0x119998;return _0x4d906a;})[_0x8d36('0x1e')](respondWithFilteredResult(_0x373144,_0x276d41))[_0x8d36('0x3d')](handleError(_0x373144,null));};exports[_0x8d36('0x3e')]=function(_0x3ed572,_0x3f8201){var _0x2e049b={'raw':!![],'where':{'id':_0x3ed572[_0x8d36('0x3f')]['id']}},_0x205973={};_0x205973[_0x8d36('0x27')]=_[_0x8d36('0x23')](db[_0x8d36('0x21')]['rawAttributes']);_0x205973['query']=_[_0x8d36('0x23')](_0x3ed572['query']);_0x205973[_0x8d36('0x25')]=_[_0x8d36('0x26')](_0x205973[_0x8d36('0x27')],_0x205973[_0x8d36('0x24')]);_0x2e049b[_0x8d36('0x29')]=_['intersection'](_0x205973[_0x8d36('0x27')],qs[_0x8d36('0x28')](_0x3ed572[_0x8d36('0x24')][_0x8d36('0x28')]));_0x2e049b[_0x8d36('0x29')]=_0x2e049b['attributes'][_0x8d36('0x2a')]?_0x2e049b['attributes']:_0x205973['model'];if(_0x3ed572[_0x8d36('0x24')][_0x8d36('0x40')]){_0x2e049b['include']=[{'all':!![]}];}_0x2e049b=_[_0x8d36('0x41')]({},_0x2e049b,_0x3ed572[_0x8d36('0x36')]);return db[_0x8d36('0x21')]['find'](_0x2e049b)[_0x8d36('0x1e')](handleEntityNotFound(_0x3f8201,null))['then'](respondWithResult(_0x3f8201,null))[_0x8d36('0x3d')](handleError(_0x3f8201,null));};exports[_0x8d36('0x42')]=function(_0x16b79b,_0x4c7097){return db['VoiceCallReport'][_0x8d36('0x42')](_0x16b79b['body'],{})['then'](respondWithResult(_0x4c7097,0xc9))[_0x8d36('0x3d')](handleError(_0x4c7097,null));};exports[_0x8d36('0x1d')]=function(_0x1a8cd2,_0x4bfcc0){return db[_0x8d36('0x21')][_0x8d36('0x43')]({'where':{'id':_0x1a8cd2['params']['id']}})[_0x8d36('0x1e')](handleEntityNotFound(_0x4bfcc0,null))[_0x8d36('0x1e')](removeEntity(_0x4bfcc0,null))[_0x8d36('0x3d')](handleError(_0x4bfcc0,null));};exports[_0x8d36('0x44')]=function(_0x5dac29,_0x2e027c){return db[_0x8d36('0x21')][_0x8d36('0x44')]()[_0x8d36('0x1e')](respondWithResult(_0x2e027c,null))[_0x8d36('0x3d')](handleError(_0x2e027c,null));};exports[_0x8d36('0x1c')]=function(_0x511751,_0x355479){if(_0x511751[_0x8d36('0x45')]['uniqueid']){delete _0x511751['body'][_0x8d36('0x46')];}return db['VoiceCallReport']['find']({'where':{'uniqueid':_0x511751[_0x8d36('0x3f')]['id'],'UserId':{'$or':[null,_0x511751[_0x8d36('0x47')]['id']]}}})[_0x8d36('0x1e')](handleEntityNotFound(_0x355479,null))[_0x8d36('0x1e')](saveUpdates(_0x511751['body'],null))[_0x8d36('0x1e')](respondWithResult(_0x355479,null))[_0x8d36('0x3d')](handleError(_0x355479,null));};
\ No newline at end of file
index 0e8db07..b73e8ff 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc4a8=['uniqueid','util','../../config/logger','api','request-promise','./voiceCallReport.attributes','exports','define','VoiceCallReport'];(function(_0x19e0ec,_0x3afd18){var _0x4ebc69=function(_0x2b3bc5){while(--_0x2b3bc5){_0x19e0ec['push'](_0x19e0ec['shift']());}};_0x4ebc69(++_0x3afd18);}(_0xc4a8,0x160));var _0x8c4a=function(_0x4a9df3,_0x243a32){_0x4a9df3=_0x4a9df3-0x0;var _0x3a06d0=_0xc4a8[_0x4a9df3];return _0x3a06d0;};'use strict';var _=require('lodash');var util=require(_0x8c4a('0x0'));var logger=require(_0x8c4a('0x1'))(_0x8c4a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8c4a('0x3'));var attributes=require(_0x8c4a('0x4'));module[_0x8c4a('0x5')]=function(_0x1a26aa,_0x3397c0){return _0x1a26aa[_0x8c4a('0x6')](_0x8c4a('0x7'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x8c4a('0x8')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x2255=['moment','bluebird','./voiceCallReport.attributes','define','report_call','uniqueid','lodash','util'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x2255,0x10e));var _0x5225=function(_0x530427,_0x4fd7b9){_0x530427=_0x530427-0x0;var _0x3b4c73=_0x2255[_0x530427];return _0x3b4c73;};'use strict';var _=require(_0x5225('0x0'));var util=require(_0x5225('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5225('0x2'));var BPromise=require(_0x5225('0x3'));var rp=require('request-promise');var attributes=require(_0x5225('0x4'));module['exports']=function(_0x260865,_0x5e9f12){return _0x260865[_0x5225('0x5')]('VoiceCallReport',attributes,{'tableName':_0x5225('0x6'),'paranoid':![],'indexes':[{'fields':[_0x5225('0x7')]}],'timestamps':!![]});};
\ No newline at end of file
index 9d1d48b..87d3004 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x564b=['rpc','../../config/environment','jayson/promise','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','include','model','map','CreateVoiceCallReport','create','UpdateVoiceCallReport','update','body','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x564b,0x146));var _0xb564=function(_0x2cd250,_0x56a54e){_0x2cd250=_0x2cd250-0x0;var _0x298465=_0x564b[_0x2cd250];return _0x298465;};'use strict';var _=require(_0xb564('0x0'));var util=require(_0xb564('0x1'));var moment=require(_0xb564('0x2'));var BPromise=require(_0xb564('0x3'));var rs=require(_0xb564('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb564('0x5'))['db'];var utils=require(_0xb564('0x6'));var logger=require('../../config/logger')(_0xb564('0x7'));var config=require(_0xb564('0x8'));var jayson=require(_0xb564('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b65f8,_0x3d31cc,_0x485f16){return new BPromise(function(_0x163181,_0x237461){return client['request'](_0x2b65f8,_0x485f16)[_0xb564('0xa')](function(_0x513361){logger[_0xb564('0xb')](_0xb564('0xc'),_0x3d31cc,_0xb564('0xd'));logger[_0xb564('0xe')](_0xb564('0xf'),_0x3d31cc,_0xb564('0xd'),JSON[_0xb564('0x10')](_0x513361));if(_0x513361[_0xb564('0x11')]){if(_0x513361[_0xb564('0x11')][_0xb564('0x12')]===0x1f4){logger['error'](_0xb564('0xc'),_0x3d31cc,_0x513361['error'][_0xb564('0x13')]);return _0x237461(_0x513361['error'][_0xb564('0x13')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x3d31cc,_0x513361[_0xb564('0x11')][_0xb564('0x13')]);return _0x163181(_0x513361['error']['message']);}else{logger[_0xb564('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x3d31cc,_0xb564('0xd'));_0x163181(_0x513361[_0xb564('0x14')]['message']);}})[_0xb564('0x15')](function(_0x1ef125){logger[_0xb564('0x11')](_0xb564('0xc'),_0x3d31cc,_0x1ef125);_0x237461(_0x1ef125);});});}exports[_0xb564('0x16')]=function(_0x15134a){var _0x154bfd=this;return new Promise(function(_0x50bb82,_0x34bb7e){return db[_0xb564('0x17')][_0xb564('0x18')]({'raw':_0x15134a[_0xb564('0x19')]?_0x15134a['options'][_0xb564('0x1a')]===undefined?!![]:![]:!![],'where':_0x15134a[_0xb564('0x19')]?_0x15134a[_0xb564('0x19')][_0xb564('0x1b')]||null:null,'attributes':_0x15134a[_0xb564('0x19')]?_0x15134a[_0xb564('0x19')][_0xb564('0x1c')]||null:null,'limit':_0x15134a['options']?_0x15134a[_0xb564('0x19')]['limit']||null:null,'include':_0x15134a['options']?_0x15134a[_0xb564('0x19')][_0xb564('0x1d')]?_['map'](_0x15134a[_0xb564('0x19')][_0xb564('0x1d')],function(_0x176224){return{'model':db[_0x176224[_0xb564('0x1e')]],'as':_0x176224['as'],'attributes':_0x176224[_0xb564('0x1c')],'include':_0x176224[_0xb564('0x1d')]?_[_0xb564('0x1f')](_0x176224[_0xb564('0x1d')],function(_0x3e1d1b){return{'model':db[_0x3e1d1b[_0xb564('0x1e')]],'as':_0x3e1d1b['as'],'attributes':_0x3e1d1b['attributes'],'include':_0x3e1d1b[_0xb564('0x1d')]?_[_0xb564('0x1f')](_0x3e1d1b[_0xb564('0x1d')],function(_0x248fd0){return{'model':db[_0x248fd0['model']],'as':_0x248fd0['as'],'attributes':_0x248fd0[_0xb564('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb564('0xa')](function(_0x37e949){logger['info'](_0xb564('0x16'),_0x15134a);logger[_0xb564('0xe')](_0xb564('0x16'),_0x15134a,JSON[_0xb564('0x10')](_0x37e949));_0x50bb82(_0x37e949);})['catch'](function(_0x3e23ad){logger[_0xb564('0x11')](_0xb564('0x16'),_0x3e23ad['message'],_0x15134a);_0x34bb7e(_0x154bfd['error'](0x1f4,_0x3e23ad[_0xb564('0x13')]));});});};exports[_0xb564('0x20')]=function(_0x9a7837){var _0x34e1d8=this;return new Promise(function(_0xd0bb99,_0x2a0b12){return db['VoiceCallReport'][_0xb564('0x21')](_0x9a7837['body'],{'raw':_0x9a7837[_0xb564('0x19')]?_0x9a7837[_0xb564('0x19')][_0xb564('0x1a')]===undefined?!![]:![]:!![]})[_0xb564('0xa')](function(_0x5c69eb){logger[_0xb564('0xb')](_0xb564('0x20'),_0x9a7837);logger[_0xb564('0xe')](_0xb564('0x20'),_0x9a7837,JSON['stringify'](_0x5c69eb));_0xd0bb99(_0x5c69eb);})['catch'](function(_0x13442e){logger[_0xb564('0x11')](_0xb564('0x20'),_0x13442e[_0xb564('0x13')],_0x9a7837);_0x2a0b12(_0x34e1d8[_0xb564('0x11')](0x1f4,_0x13442e[_0xb564('0x13')]));});});};exports[_0xb564('0x22')]=function(_0x72e0d4){var _0x518fbf=this;return new Promise(function(_0x541a06,_0xaf2650){return db[_0xb564('0x17')][_0xb564('0x23')](_0x72e0d4[_0xb564('0x24')],{'raw':_0x72e0d4[_0xb564('0x19')]?_0x72e0d4['options'][_0xb564('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x72e0d4['options']?_0x72e0d4[_0xb564('0x19')]['where']||null:null,'attributes':_0x72e0d4['options']?_0x72e0d4[_0xb564('0x19')][_0xb564('0x1c')]||null:null,'limit':_0x72e0d4[_0xb564('0x19')]?_0x72e0d4[_0xb564('0x19')]['limit']||null:null})[_0xb564('0xa')](function(_0x53308e){logger[_0xb564('0xb')](_0xb564('0x22'),_0x72e0d4);logger[_0xb564('0xe')](_0xb564('0x22'),_0x72e0d4,JSON[_0xb564('0x10')](_0x53308e));_0x541a06(_0x53308e);})[_0xb564('0x15')](function(_0x529188){logger['error'](_0xb564('0x22'),_0x529188[_0xb564('0x13')],_0x72e0d4);_0xaf2650(_0x518fbf[_0xb564('0x11')](0x1f4,_0x529188[_0xb564('0x13')]));});});};
\ No newline at end of file
+var _0x2f70=['then','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','VoiceCallReport,\x20%s,\x20%s','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','limit','map','include','model','attributes','stringify','CreateVoiceCallReport','body','UpdateVoiceCallReport','update','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x33a8e5,_0x3bf8f6){var _0x203fc1=function(_0x6c00ce){while(--_0x6c00ce){_0x33a8e5['push'](_0x33a8e5['shift']());}};_0x203fc1(++_0x3bf8f6);}(_0x2f70,0x1d3));var _0x02f7=function(_0x16c9db,_0x58d2e8){_0x16c9db=_0x16c9db-0x0;var _0x5411d8=_0x2f70[_0x16c9db];return _0x5411d8;};'use strict';var _=require(_0x02f7('0x0'));var util=require('util');var moment=require(_0x02f7('0x1'));var BPromise=require(_0x02f7('0x2'));var rs=require(_0x02f7('0x3'));var fs=require('fs');var Redis=require(_0x02f7('0x4'));var db=require(_0x02f7('0x5'))['db'];var utils=require(_0x02f7('0x6'));var logger=require('../../config/logger')(_0x02f7('0x7'));var config=require(_0x02f7('0x8'));var jayson=require(_0x02f7('0x9'));var client=jayson[_0x02f7('0xa')][_0x02f7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5769e1,_0x54c121,_0x539ee0){return new BPromise(function(_0x80f06b,_0x4dd85b){return client[_0x02f7('0xc')](_0x5769e1,_0x539ee0)[_0x02f7('0xd')](function(_0x30620f){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x54c121,_0x02f7('0xe'));logger[_0x02f7('0xf')](_0x02f7('0x10'),_0x54c121,_0x02f7('0xe'),JSON['stringify'](_0x30620f));if(_0x30620f[_0x02f7('0x11')]){if(_0x30620f[_0x02f7('0x11')][_0x02f7('0x12')]===0x1f4){logger[_0x02f7('0x11')](_0x02f7('0x13'),_0x54c121,_0x30620f[_0x02f7('0x11')]['message']);return _0x4dd85b(_0x30620f[_0x02f7('0x11')]['message']);}logger[_0x02f7('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x54c121,_0x30620f[_0x02f7('0x11')][_0x02f7('0x14')]);return _0x80f06b(_0x30620f[_0x02f7('0x11')][_0x02f7('0x14')]);}else{logger[_0x02f7('0x15')](_0x02f7('0x13'),_0x54c121,_0x02f7('0xe'));_0x80f06b(_0x30620f[_0x02f7('0x16')][_0x02f7('0x14')]);}})[_0x02f7('0x17')](function(_0x76bd99){logger[_0x02f7('0x11')](_0x02f7('0x13'),_0x54c121,_0x76bd99);_0x4dd85b(_0x76bd99);});});}exports[_0x02f7('0x18')]=function(_0x488b41){var _0x1a5d63=this;return new Promise(function(_0x345465,_0x10ac0f){return db[_0x02f7('0x19')][_0x02f7('0x1a')]({'raw':_0x488b41[_0x02f7('0x1b')]?_0x488b41[_0x02f7('0x1b')][_0x02f7('0x1c')]===undefined?!![]:![]:!![],'where':_0x488b41['options']?_0x488b41['options'][_0x02f7('0x1d')]||null:null,'attributes':_0x488b41[_0x02f7('0x1b')]?_0x488b41['options']['attributes']||null:null,'limit':_0x488b41['options']?_0x488b41[_0x02f7('0x1b')][_0x02f7('0x1e')]||null:null,'include':_0x488b41[_0x02f7('0x1b')]?_0x488b41[_0x02f7('0x1b')]['include']?_[_0x02f7('0x1f')](_0x488b41['options'][_0x02f7('0x20')],function(_0x44b01e){return{'model':db[_0x44b01e[_0x02f7('0x21')]],'as':_0x44b01e['as'],'attributes':_0x44b01e[_0x02f7('0x22')],'include':_0x44b01e[_0x02f7('0x20')]?_[_0x02f7('0x1f')](_0x44b01e['include'],function(_0x315f84){return{'model':db[_0x315f84[_0x02f7('0x21')]],'as':_0x315f84['as'],'attributes':_0x315f84['attributes'],'include':_0x315f84[_0x02f7('0x20')]?_['map'](_0x315f84[_0x02f7('0x20')],function(_0x42485c){return{'model':db[_0x42485c[_0x02f7('0x21')]],'as':_0x42485c['as'],'attributes':_0x42485c[_0x02f7('0x22')]};}):[]};}):[]};}):[]:[]})[_0x02f7('0xd')](function(_0x28d869){logger['info'](_0x02f7('0x18'),_0x488b41);logger[_0x02f7('0xf')](_0x02f7('0x18'),_0x488b41,JSON[_0x02f7('0x23')](_0x28d869));_0x345465(_0x28d869);})[_0x02f7('0x17')](function(_0x106903){logger[_0x02f7('0x11')](_0x02f7('0x18'),_0x106903['message'],_0x488b41);_0x10ac0f(_0x1a5d63['error'](0x1f4,_0x106903[_0x02f7('0x14')]));});});};exports[_0x02f7('0x24')]=function(_0x120904){var _0x49ced6=this;return new Promise(function(_0x419287,_0x4638e5){return db[_0x02f7('0x19')]['create'](_0x120904[_0x02f7('0x25')],{'raw':_0x120904[_0x02f7('0x1b')]?_0x120904[_0x02f7('0x1b')][_0x02f7('0x1c')]===undefined?!![]:![]:!![]})[_0x02f7('0xd')](function(_0x253e17){logger[_0x02f7('0x15')](_0x02f7('0x24'),_0x120904);logger['debug'](_0x02f7('0x24'),_0x120904,JSON['stringify'](_0x253e17));_0x419287(_0x253e17);})['catch'](function(_0x45479d){logger[_0x02f7('0x11')](_0x02f7('0x24'),_0x45479d[_0x02f7('0x14')],_0x120904);_0x4638e5(_0x49ced6[_0x02f7('0x11')](0x1f4,_0x45479d['message']));});});};exports[_0x02f7('0x26')]=function(_0x20e393){var _0x25a21d=this;return new Promise(function(_0x594a9a,_0x9d9199){return db[_0x02f7('0x19')][_0x02f7('0x27')](_0x20e393['body'],{'raw':_0x20e393[_0x02f7('0x1b')]?_0x20e393[_0x02f7('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20e393[_0x02f7('0x1b')]?_0x20e393[_0x02f7('0x1b')][_0x02f7('0x1d')]||null:null,'attributes':_0x20e393[_0x02f7('0x1b')]?_0x20e393[_0x02f7('0x1b')][_0x02f7('0x22')]||null:null,'limit':_0x20e393[_0x02f7('0x1b')]?_0x20e393['options'][_0x02f7('0x1e')]||null:null})[_0x02f7('0xd')](function(_0x5a7cbb){logger[_0x02f7('0x15')](_0x02f7('0x26'),_0x20e393);logger[_0x02f7('0xf')](_0x02f7('0x26'),_0x20e393,JSON['stringify'](_0x5a7cbb));_0x594a9a(_0x5a7cbb);})['catch'](function(_0x3fde7a){logger[_0x02f7('0x11')](_0x02f7('0x26'),_0x3fde7a['message'],_0x20e393);_0x9d9199(_0x25a21d[_0x02f7('0x11')](0x1f4,_0x3fde7a[_0x02f7('0x14')]));});});};
\ No newline at end of file
index a097637..950529d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x09d1=['./voiceChanSpy.controller','/:id','isAuthenticated','show','post','put','update','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3b949e,_0x2e6f3e){var _0x3f725f=function(_0x953554){while(--_0x953554){_0x3b949e['push'](_0x3b949e['shift']());}};_0x3f725f(++_0x2e6f3e);}(_0x09d1,0x99));var _0x109d=function(_0x5df6c2,_0x35ee27){_0x5df6c2=_0x5df6c2-0x0;var _0x25f862=_0x09d1[_0x5df6c2];return _0x25f862;};'use strict';var multer=require(_0x109d('0x0'));var util=require('util');var path=require(_0x109d('0x1'));var timeout=require(_0x109d('0x2'));var express=require('express');var router=express[_0x109d('0x3')]();var auth=require(_0x109d('0x4'));var interaction=require(_0x109d('0x5'));var config=require(_0x109d('0x6'));var controller=require(_0x109d('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x109d('0x8'),auth[_0x109d('0x9')](),controller[_0x109d('0xa')]);router[_0x109d('0xb')]('/',auth[_0x109d('0x9')](),controller['create']);router[_0x109d('0xc')](_0x109d('0x8'),auth[_0x109d('0x9')](),controller[_0x109d('0xd')]);router['delete'](_0x109d('0x8'),auth[_0x109d('0x9')](),controller[_0x109d('0xe')]);module[_0x109d('0xf')]=router;
\ No newline at end of file
+var _0xf8fa=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','show','post','create','put','delete','/:id','destroy','exports','multer','util'];(function(_0x465289,_0x431373){var _0x35b182=function(_0x5e8bf6){while(--_0x5e8bf6){_0x465289['push'](_0x465289['shift']());}};_0x35b182(++_0x431373);}(_0xf8fa,0x1ec));var _0xaf8f=function(_0x5a299c,_0x2b97e5){_0x5a299c=_0x5a299c-0x0;var _0x5d886e=_0xf8fa[_0x5a299c];return _0x5d886e;};'use strict';var multer=require(_0xaf8f('0x0'));var util=require(_0xaf8f('0x1'));var path=require(_0xaf8f('0x2'));var timeout=require(_0xaf8f('0x3'));var express=require(_0xaf8f('0x4'));var router=express['Router']();var auth=require(_0xaf8f('0x5'));var interaction=require(_0xaf8f('0x6'));var config=require(_0xaf8f('0x7'));var controller=require(_0xaf8f('0x8'));router[_0xaf8f('0x9')]('/',auth[_0xaf8f('0xa')](),controller['index']);router[_0xaf8f('0x9')]('/:id',auth[_0xaf8f('0xa')](),controller[_0xaf8f('0xb')]);router[_0xaf8f('0xc')]('/',auth[_0xaf8f('0xa')](),controller[_0xaf8f('0xd')]);router[_0xaf8f('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xaf8f('0xf')](_0xaf8f('0x10'),auth[_0xaf8f('0xa')](),controller[_0xaf8f('0x11')]);module[_0xaf8f('0x12')]=router;
\ No newline at end of file
index a5d7199..e4a235b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8080=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','options','join'];(function(_0x3fb905,_0x1f93d7){var _0x29e405=function(_0x53c91e){while(--_0x53c91e){_0x3fb905['push'](_0x3fb905['shift']());}};_0x29e405(++_0x1f93d7);}(_0x8080,0xb7));var _0x0808=function(_0xd87df8,_0x53ed80){_0xd87df8=_0xd87df8-0x0;var _0x448d2c=_0x8080[_0xd87df8];return _0x448d2c;};'use strict';var Sequelize=require(_0x0808('0x0'));module[_0x0808('0x1')]={'name':{'type':Sequelize[_0x0808('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x0808('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x50c202){this['setDataValue'](_0x0808('0x4'),_0x50c202?_0x50c202[_0x0808('0x5')](''):[]);},'get':function(){return this[_0x0808('0x6')](_0x0808('0x4'))?this['getDataValue']('options')[_0x0808('0x7')](''):[];}},'auth':{'type':Sequelize[_0x0808('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x0808('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x9538=['sequelize','exports','name','STRING','setDataValue','join','getDataValue','options','BOOLEAN'];(function(_0x5b1e8c,_0x15e11f){var _0x19bab8=function(_0x40c668){while(--_0x40c668){_0x5b1e8c['push'](_0x5b1e8c['shift']());}};_0x19bab8(++_0x15e11f);}(_0x9538,0xfc));var _0x8953=function(_0x536d7b,_0x587f4b){_0x536d7b=_0x536d7b-0x0;var _0x23cdaf=_0x9538[_0x536d7b];return _0x23cdaf;};'use strict';var Sequelize=require(_0x8953('0x0'));module[_0x8953('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0x8953('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x8953('0x3')],'set':function(_0x2bbc3a){this[_0x8953('0x4')]('options',_0x2bbc3a?_0x2bbc3a[_0x8953('0x5')](''):[]);},'get':function(){return this[_0x8953('0x6')](_0x8953('0x7'))?this[_0x8953('0x6')](_0x8953('0x7'))['split'](''):[];}},'auth':{'type':Sequelize[_0x8953('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x8953('0x3')]},'record':{'type':Sequelize[_0x8953('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x8953('0x3')]},'description':{'type':Sequelize[_0x8953('0x3')]}};
\ No newline at end of file
index 2962616..7068655 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5ddc=['crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','end','status','offset','limit','set','json','reject','save','then','destroy','get','ChanSpies','UserProfileResource','error','stack','name','send','index','VoiceChanSpy','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','key','VIRTUAL','field','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','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','path','sox','to-csv','ejs','lodash','squel'];(function(_0x1543c5,_0x29b955){var _0x37332d=function(_0x3bea92){while(--_0x3bea92){_0x1543c5['push'](_0x1543c5['shift']());}};_0x37332d(++_0x29b955);}(_0x5ddc,0x13d));var _0xc5dd=function(_0x39d2c9,_0x507b4c){_0x39d2c9=_0x39d2c9-0x0;var _0x14563d=_0x5ddc[_0x39d2c9];return _0x14563d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc5dd('0x0'));var rimraf=require(_0xc5dd('0x1'));var zipdir=require(_0xc5dd('0x2'));var jsonpatch=require(_0xc5dd('0x3'));var rp=require(_0xc5dd('0x4'));var moment=require(_0xc5dd('0x5'));var BPromise=require(_0xc5dd('0x6'));var Mustache=require(_0xc5dd('0x7'));var util=require(_0xc5dd('0x8'));var path=require(_0xc5dd('0x9'));var sox=require(_0xc5dd('0xa'));var csv=require(_0xc5dd('0xb'));var ejs=require(_0xc5dd('0xc'));var fs=require('fs');var _=require(_0xc5dd('0xd'));var squel=require(_0xc5dd('0xe'));var crypto=require(_0xc5dd('0xf'));var jsforce=require(_0xc5dd('0x10'));var deskjs=require(_0xc5dd('0x11'));var toCsv=require(_0xc5dd('0xb'));var querystring=require(_0xc5dd('0x12'));var Papa=require(_0xc5dd('0x13'));var authService=require('../../components/auth/service');var hardwareService=require(_0xc5dd('0x14'));var Redis=require('ioredis');var qs=require(_0xc5dd('0x15'));var logger=require('../../config/logger')(_0xc5dd('0x16'));var utils=require(_0xc5dd('0x17'));var config=require(_0xc5dd('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a96cf,_0x21e12b){_0x21e12b=_0x21e12b||0xcc;return function(_0x221de6){if(_0x221de6){return _0x3a96cf[_0xc5dd('0x19')](_0x21e12b);}return _0x3a96cf['status'](_0x21e12b)[_0xc5dd('0x1a')]();};}function respondWithResult(_0x5738e5,_0x399be6){_0x399be6=_0x399be6||0xc8;return function(_0x4bb49a){if(_0x4bb49a){return _0x5738e5[_0xc5dd('0x1b')](_0x399be6)['json'](_0x4bb49a);}};}function respondWithFilteredResult(_0x221afd,_0x444d6a){return function(_0x32810b){if(_0x32810b){var _0x4d4774=_0x32810b['count'],_0x3a2c72=_0x444d6a[_0xc5dd('0x1c')],_0x435b97=_0x444d6a['offset']+_0x444d6a[_0xc5dd('0x1d')],_0x362e8c;if(_0x435b97>=_0x4d4774){_0x435b97=_0x4d4774;_0x362e8c=0xc8;}else{_0x362e8c=0xce;}_0x221afd[_0xc5dd('0x1b')](_0x362e8c);return _0x221afd[_0xc5dd('0x1e')]('Content-Range',_0x3a2c72+'-'+_0x435b97+'/'+_0x4d4774)[_0xc5dd('0x1f')](_0x32810b);}return null;};}function patchUpdates(_0x4220cd){return function(_0x541fa0){try{jsonpatch['apply'](_0x541fa0,_0x4220cd,!![]);}catch(_0x14035f){return BPromise[_0xc5dd('0x20')](_0x14035f);}return _0x541fa0[_0xc5dd('0x21')]();};}function saveUpdates(_0x3f0d44,_0x3e8035){return function(_0x44fd2a){if(_0x44fd2a){return _0x44fd2a['update'](_0x3f0d44)[_0xc5dd('0x22')](function(_0x446bdb){return _0x446bdb;});}return null;};}function removeEntity(_0x1d50e6,_0x32ec48){return function(_0x3031f5){if(_0x3031f5){return _0x3031f5[_0xc5dd('0x23')]()[_0xc5dd('0x22')](function(){var _0x582972=_0x3031f5[_0xc5dd('0x24')]({'plain':!![]});var _0xa8175c=_0xc5dd('0x25');return db[_0xc5dd('0x26')][_0xc5dd('0x23')]({'where':{'type':_0xa8175c,'resourceId':_0x582972['id']}})[_0xc5dd('0x22')](function(){return _0x3031f5;});})[_0xc5dd('0x22')](function(){_0x1d50e6['status'](0xcc)[_0xc5dd('0x1a')]();});}};}function handleEntityNotFound(_0x266dde,_0x334dce){return function(_0x40432e){if(!_0x40432e){_0x266dde[_0xc5dd('0x19')](0x194);}return _0x40432e;};}function handleError(_0x1844f4,_0x3eabf8){_0x3eabf8=_0x3eabf8||0x1f4;return function(_0x381383){logger[_0xc5dd('0x27')](_0x381383[_0xc5dd('0x28')]);if(_0x381383[_0xc5dd('0x29')]){delete _0x381383[_0xc5dd('0x29')];}_0x1844f4[_0xc5dd('0x1b')](_0x3eabf8)[_0xc5dd('0x2a')](_0x381383);};}exports[_0xc5dd('0x2b')]=function(_0x97278d,_0x3f805d){var _0x108fc0={},_0x47f72a={},_0x5b7f8f={'count':0x0,'rows':[]};var _0x50cb62=db[_0xc5dd('0x2c')][_0xc5dd('0x2d')];_0x47f72a['model']=_[_0xc5dd('0x2e')](_0x50cb62);_0x47f72a[_0xc5dd('0x2f')]=_[_0xc5dd('0x2e')](_0x97278d['query']);_0x47f72a[_0xc5dd('0x30')]=_[_0xc5dd('0x31')](_0x47f72a[_0xc5dd('0x32')],_0x47f72a[_0xc5dd('0x2f')]);_0x108fc0[_0xc5dd('0x33')]=_[_0xc5dd('0x31')](_0x47f72a[_0xc5dd('0x32')],qs[_0xc5dd('0x34')](_0x97278d[_0xc5dd('0x2f')]['fields']));_0x108fc0['attributes']=_0x108fc0['attributes'][_0xc5dd('0x35')]?_0x108fc0['attributes']:_0x47f72a['model'];if(!_0x97278d[_0xc5dd('0x2f')][_0xc5dd('0x36')](_0xc5dd('0x37'))){_0x108fc0[_0xc5dd('0x1d')]=qs[_0xc5dd('0x1d')](_0x97278d[_0xc5dd('0x2f')][_0xc5dd('0x1d')]);_0x108fc0[_0xc5dd('0x1c')]=qs[_0xc5dd('0x1c')](_0x97278d[_0xc5dd('0x2f')][_0xc5dd('0x1c')]);}_0x108fc0['order']=qs[_0xc5dd('0x38')](_0x97278d['query'][_0xc5dd('0x38')]);_0x108fc0[_0xc5dd('0x39')]=qs[_0xc5dd('0x30')](_[_0xc5dd('0x3a')](_0x97278d['query'],_0x47f72a[_0xc5dd('0x30')]));if(_0x97278d[_0xc5dd('0x2f')][_0xc5dd('0x3b')]){_0x108fc0[_0xc5dd('0x39')]=_[_0xc5dd('0x3c')](_0x108fc0[_0xc5dd('0x39')],{'$or':_['map'](_0x50cb62,function(_0x358e06){if(_0x358e06[_0xc5dd('0x3d')][_0xc5dd('0x3e')]!==_0xc5dd('0x3f')){var _0x477a7b={};_0x477a7b[_0x358e06[_0xc5dd('0x40')]]={'$like':'%'+_0x97278d[_0xc5dd('0x2f')][_0xc5dd('0x3b')]+'%'};return _0x477a7b;}})});}_0x108fc0=_[_0xc5dd('0x3c')]({},_0x108fc0,_0x97278d[_0xc5dd('0x41')]);var _0x34e99d={'where':_0x108fc0[_0xc5dd('0x39')]};return db[_0xc5dd('0x2c')]['count'](_0x34e99d)[_0xc5dd('0x22')](function(_0x408125){_0x5b7f8f['count']=_0x408125;if(_0x97278d[_0xc5dd('0x2f')]['includeAll']){_0x108fc0[_0xc5dd('0x42')]=[{'all':!![]}];}return db[_0xc5dd('0x2c')][_0xc5dd('0x43')](_0x108fc0);})[_0xc5dd('0x22')](function(_0x4a2515){_0x5b7f8f[_0xc5dd('0x44')]=_0x4a2515;return _0x5b7f8f;})[_0xc5dd('0x22')](respondWithFilteredResult(_0x3f805d,_0x108fc0))[_0xc5dd('0x45')](handleError(_0x3f805d,null));};exports[_0xc5dd('0x46')]=function(_0x28ab0d,_0x420b70){var _0x42ef9c={'raw':![],'where':{'id':_0x28ab0d[_0xc5dd('0x47')]['id']}},_0x51dc58={};_0x51dc58[_0xc5dd('0x32')]=_[_0xc5dd('0x2e')](db[_0xc5dd('0x2c')][_0xc5dd('0x2d')]);_0x51dc58['query']=_[_0xc5dd('0x2e')](_0x28ab0d[_0xc5dd('0x2f')]);_0x51dc58[_0xc5dd('0x30')]=_[_0xc5dd('0x31')](_0x51dc58[_0xc5dd('0x32')],_0x51dc58[_0xc5dd('0x2f')]);_0x42ef9c[_0xc5dd('0x33')]=_[_0xc5dd('0x31')](_0x51dc58[_0xc5dd('0x32')],qs[_0xc5dd('0x34')](_0x28ab0d[_0xc5dd('0x2f')][_0xc5dd('0x34')]));_0x42ef9c[_0xc5dd('0x33')]=_0x42ef9c[_0xc5dd('0x33')][_0xc5dd('0x35')]?_0x42ef9c[_0xc5dd('0x33')]:_0x51dc58[_0xc5dd('0x32')];if(_0x28ab0d[_0xc5dd('0x2f')][_0xc5dd('0x48')]){_0x42ef9c[_0xc5dd('0x42')]=[{'all':!![]}];}_0x42ef9c=_[_0xc5dd('0x3c')]({},_0x42ef9c,_0x28ab0d['options']);return db[_0xc5dd('0x2c')][_0xc5dd('0x49')](_0x42ef9c)[_0xc5dd('0x22')](handleEntityNotFound(_0x420b70,null))['then'](respondWithResult(_0x420b70,null))[_0xc5dd('0x45')](handleError(_0x420b70,null));};exports[_0xc5dd('0x4a')]=function(_0x203c05,_0x5dd1c0){return db[_0xc5dd('0x2c')][_0xc5dd('0x4a')](_0x203c05[_0xc5dd('0x4b')],{})['then'](function(_0x28d4b9){var _0x537f51=_0x203c05[_0xc5dd('0x4c')][_0xc5dd('0x24')]({'plain':!![]});if(!_0x537f51)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x537f51[_0xc5dd('0x4d')]==='user'){var _0x279d5d=_0x28d4b9[_0xc5dd('0x24')]({'plain':!![]});var _0x109b35=_0xc5dd('0x25');return db[_0xc5dd('0x4e')]['find']({'where':{'name':_0x109b35,'userProfileId':_0x537f51[_0xc5dd('0x4f')]},'raw':!![]})['then'](function(_0x15bcd6){if(_0x15bcd6&&_0x15bcd6[_0xc5dd('0x50')]===0x0){return db['UserProfileResource'][_0xc5dd('0x4a')]({'name':_0x279d5d[_0xc5dd('0x29')],'resourceId':_0x279d5d['id'],'type':_0x15bcd6[_0xc5dd('0x29')],'sectionId':_0x15bcd6['id']},{})[_0xc5dd('0x22')](function(){return _0x28d4b9;});}else{return _0x28d4b9;}})['catch'](function(_0x35b0ff){logger[_0xc5dd('0x27')](_0xc5dd('0x51'),_0x35b0ff);throw _0x35b0ff;});}return _0x28d4b9;})[_0xc5dd('0x22')](respondWithResult(_0x5dd1c0,0xc9))['catch'](handleError(_0x5dd1c0,null));};exports[_0xc5dd('0x52')]=function(_0x13055c,_0xf14c58){if(_0x13055c[_0xc5dd('0x4b')]['id']){delete _0x13055c[_0xc5dd('0x4b')]['id'];}return db[_0xc5dd('0x2c')][_0xc5dd('0x49')]({'where':{'id':_0x13055c[_0xc5dd('0x47')]['id']}})[_0xc5dd('0x22')](handleEntityNotFound(_0xf14c58,null))[_0xc5dd('0x22')](saveUpdates(_0x13055c[_0xc5dd('0x4b')],null))[_0xc5dd('0x22')](respondWithResult(_0xf14c58,null))[_0xc5dd('0x45')](handleError(_0xf14c58,null));};exports[_0xc5dd('0x23')]=function(_0x4ca4a2,_0xcc6c9e){return db[_0xc5dd('0x2c')][_0xc5dd('0x49')]({'where':{'id':_0x4ca4a2[_0xc5dd('0x47')]['id']}})['then'](handleEntityNotFound(_0xcc6c9e,null))[_0xc5dd('0x22')](removeEntity(_0xcc6c9e,null))[_0xc5dd('0x45')](handleError(_0xcc6c9e,null));};
\ No newline at end of file
+var _0x2b92=['querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','stack','name','send','index','VoiceChanSpy','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','key','VIRTUAL','field','options','include','catch','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x23f686,_0x3f99c4){var _0x57377b=function(_0x34f79e){while(--_0x34f79e){_0x23f686['push'](_0x23f686['shift']());}};_0x57377b(++_0x3f99c4);}(_0x2b92,0x9b));var _0x22b9=function(_0xc44c73,_0x56dd2f){_0xc44c73=_0xc44c73-0x0;var _0x18b0ac=_0x2b92[_0xc44c73];return _0x18b0ac;};'use strict';var pdf=require(_0x22b9('0x0'));var emlformat=require(_0x22b9('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x22b9('0x2'));var rp=require(_0x22b9('0x3'));var moment=require(_0x22b9('0x4'));var BPromise=require(_0x22b9('0x5'));var Mustache=require(_0x22b9('0x6'));var util=require(_0x22b9('0x7'));var path=require(_0x22b9('0x8'));var sox=require(_0x22b9('0x9'));var csv=require(_0x22b9('0xa'));var ejs=require(_0x22b9('0xb'));var fs=require('fs');var _=require(_0x22b9('0xc'));var squel=require(_0x22b9('0xd'));var crypto=require(_0x22b9('0xe'));var jsforce=require(_0x22b9('0xf'));var deskjs=require(_0x22b9('0x10'));var toCsv=require('to-csv');var querystring=require(_0x22b9('0x11'));var Papa=require(_0x22b9('0x12'));var authService=require('../../components/auth/service');var hardwareService=require(_0x22b9('0x13'));var Redis=require(_0x22b9('0x14'));var qs=require(_0x22b9('0x15'));var logger=require(_0x22b9('0x16'))(_0x22b9('0x17'));var utils=require(_0x22b9('0x18'));var config=require(_0x22b9('0x19'));var db=require(_0x22b9('0x1a'))['db'];function respondWithStatusCode(_0x2380ca,_0xdfbe5b){_0xdfbe5b=_0xdfbe5b||0xcc;return function(_0x3c670a){if(_0x3c670a){return _0x2380ca[_0x22b9('0x1b')](_0xdfbe5b);}return _0x2380ca[_0x22b9('0x1c')](_0xdfbe5b)[_0x22b9('0x1d')]();};}function respondWithResult(_0x4d8c34,_0x3cab4b){_0x3cab4b=_0x3cab4b||0xc8;return function(_0x2ec1d6){if(_0x2ec1d6){return _0x4d8c34[_0x22b9('0x1c')](_0x3cab4b)[_0x22b9('0x1e')](_0x2ec1d6);}};}function respondWithFilteredResult(_0x58ca5a,_0x488eaa){return function(_0x331653){if(_0x331653){var _0x370227=_0x331653[_0x22b9('0x1f')],_0x423ed7=_0x488eaa[_0x22b9('0x20')],_0x471276=_0x488eaa[_0x22b9('0x20')]+_0x488eaa[_0x22b9('0x21')],_0x58fe0e;if(_0x471276>=_0x370227){_0x471276=_0x370227;_0x58fe0e=0xc8;}else{_0x58fe0e=0xce;}_0x58ca5a['status'](_0x58fe0e);return _0x58ca5a[_0x22b9('0x22')](_0x22b9('0x23'),_0x423ed7+'-'+_0x471276+'/'+_0x370227)[_0x22b9('0x1e')](_0x331653);}return null;};}function patchUpdates(_0x4b9f87){return function(_0xeabd31){try{jsonpatch[_0x22b9('0x24')](_0xeabd31,_0x4b9f87,!![]);}catch(_0x15ba0a){return BPromise[_0x22b9('0x25')](_0x15ba0a);}return _0xeabd31[_0x22b9('0x26')]();};}function saveUpdates(_0x5640ea,_0xaf98a3){return function(_0x3d03e0){if(_0x3d03e0){return _0x3d03e0[_0x22b9('0x27')](_0x5640ea)[_0x22b9('0x28')](function(_0x50cfa8){return _0x50cfa8;});}return null;};}function removeEntity(_0x536bae,_0x10f7cb){return function(_0x48493f){if(_0x48493f){return _0x48493f[_0x22b9('0x29')]()[_0x22b9('0x28')](function(){var _0x369a80=_0x48493f[_0x22b9('0x2a')]({'plain':!![]});var _0x45c71d=_0x22b9('0x2b');return db[_0x22b9('0x2c')][_0x22b9('0x29')]({'where':{'type':_0x45c71d,'resourceId':_0x369a80['id']}})[_0x22b9('0x28')](function(){return _0x48493f;});})[_0x22b9('0x28')](function(){_0x536bae[_0x22b9('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x301d48,_0x387e29){return function(_0x378fcb){if(!_0x378fcb){_0x301d48['sendStatus'](0x194);}return _0x378fcb;};}function handleError(_0x1e20fb,_0x20b217){_0x20b217=_0x20b217||0x1f4;return function(_0x27e57d){logger['error'](_0x27e57d[_0x22b9('0x2d')]);if(_0x27e57d['name']){delete _0x27e57d[_0x22b9('0x2e')];}_0x1e20fb[_0x22b9('0x1c')](_0x20b217)[_0x22b9('0x2f')](_0x27e57d);};}exports[_0x22b9('0x30')]=function(_0x2f508d,_0x3de49e){var _0x2c489e={},_0x6a8bcf={},_0x1b6486={'count':0x0,'rows':[]};var _0x5d8337=db[_0x22b9('0x31')][_0x22b9('0x32')];_0x6a8bcf[_0x22b9('0x33')]=_[_0x22b9('0x34')](_0x5d8337);_0x6a8bcf[_0x22b9('0x35')]=_[_0x22b9('0x34')](_0x2f508d[_0x22b9('0x35')]);_0x6a8bcf[_0x22b9('0x36')]=_[_0x22b9('0x37')](_0x6a8bcf['model'],_0x6a8bcf[_0x22b9('0x35')]);_0x2c489e[_0x22b9('0x38')]=_[_0x22b9('0x37')](_0x6a8bcf[_0x22b9('0x33')],qs[_0x22b9('0x39')](_0x2f508d['query'][_0x22b9('0x39')]));_0x2c489e[_0x22b9('0x38')]=_0x2c489e[_0x22b9('0x38')][_0x22b9('0x3a')]?_0x2c489e['attributes']:_0x6a8bcf[_0x22b9('0x33')];if(!_0x2f508d[_0x22b9('0x35')][_0x22b9('0x3b')](_0x22b9('0x3c'))){_0x2c489e[_0x22b9('0x21')]=qs[_0x22b9('0x21')](_0x2f508d[_0x22b9('0x35')][_0x22b9('0x21')]);_0x2c489e[_0x22b9('0x20')]=qs['offset'](_0x2f508d[_0x22b9('0x35')][_0x22b9('0x20')]);}_0x2c489e[_0x22b9('0x3d')]=qs['sort'](_0x2f508d[_0x22b9('0x35')][_0x22b9('0x3e')]);_0x2c489e[_0x22b9('0x3f')]=qs['filters'](_[_0x22b9('0x40')](_0x2f508d['query'],_0x6a8bcf[_0x22b9('0x36')]));if(_0x2f508d[_0x22b9('0x35')][_0x22b9('0x41')]){_0x2c489e[_0x22b9('0x3f')]=_[_0x22b9('0x42')](_0x2c489e[_0x22b9('0x3f')],{'$or':_[_0x22b9('0x43')](_0x5d8337,function(_0x39ff60){if(_0x39ff60['type'][_0x22b9('0x44')]!==_0x22b9('0x45')){var _0x5c899f={};_0x5c899f[_0x39ff60[_0x22b9('0x46')]]={'$like':'%'+_0x2f508d['query'][_0x22b9('0x41')]+'%'};return _0x5c899f;}})});}_0x2c489e=_[_0x22b9('0x42')]({},_0x2c489e,_0x2f508d[_0x22b9('0x47')]);var _0x298bdb={'where':_0x2c489e['where']};return db[_0x22b9('0x31')]['count'](_0x298bdb)[_0x22b9('0x28')](function(_0x5824d9){_0x1b6486['count']=_0x5824d9;if(_0x2f508d['query']['includeAll']){_0x2c489e[_0x22b9('0x48')]=[{'all':!![]}];}return db[_0x22b9('0x31')]['findAll'](_0x2c489e);})[_0x22b9('0x28')](function(_0x145f07){_0x1b6486['rows']=_0x145f07;return _0x1b6486;})[_0x22b9('0x28')](respondWithFilteredResult(_0x3de49e,_0x2c489e))[_0x22b9('0x49')](handleError(_0x3de49e,null));};exports['show']=function(_0xe406c7,_0x242bd2){var _0x475c62={'raw':![],'where':{'id':_0xe406c7[_0x22b9('0x4a')]['id']}},_0x5ea69b={};_0x5ea69b[_0x22b9('0x33')]=_[_0x22b9('0x34')](db['VoiceChanSpy'][_0x22b9('0x32')]);_0x5ea69b[_0x22b9('0x35')]=_[_0x22b9('0x34')](_0xe406c7[_0x22b9('0x35')]);_0x5ea69b[_0x22b9('0x36')]=_['intersection'](_0x5ea69b[_0x22b9('0x33')],_0x5ea69b['query']);_0x475c62['attributes']=_[_0x22b9('0x37')](_0x5ea69b['model'],qs[_0x22b9('0x39')](_0xe406c7[_0x22b9('0x35')][_0x22b9('0x39')]));_0x475c62[_0x22b9('0x38')]=_0x475c62[_0x22b9('0x38')][_0x22b9('0x3a')]?_0x475c62['attributes']:_0x5ea69b['model'];if(_0xe406c7[_0x22b9('0x35')][_0x22b9('0x4b')]){_0x475c62[_0x22b9('0x48')]=[{'all':!![]}];}_0x475c62=_['merge']({},_0x475c62,_0xe406c7[_0x22b9('0x47')]);return db['VoiceChanSpy'][_0x22b9('0x4c')](_0x475c62)[_0x22b9('0x28')](handleEntityNotFound(_0x242bd2,null))[_0x22b9('0x28')](respondWithResult(_0x242bd2,null))[_0x22b9('0x49')](handleError(_0x242bd2,null));};exports['create']=function(_0x531f2f,_0x1a4614){return db[_0x22b9('0x31')][_0x22b9('0x4d')](_0x531f2f['body'],{})['then'](function(_0x3793e2){var _0x4d46ad=_0x531f2f[_0x22b9('0x4e')][_0x22b9('0x2a')]({'plain':!![]});if(!_0x4d46ad)throw new Error(_0x22b9('0x4f'));if(_0x4d46ad[_0x22b9('0x50')]==='user'){var _0x35e497=_0x3793e2['get']({'plain':!![]});var _0x12ab86=_0x22b9('0x2b');return db[_0x22b9('0x51')][_0x22b9('0x4c')]({'where':{'name':_0x12ab86,'userProfileId':_0x4d46ad[_0x22b9('0x52')]},'raw':!![]})[_0x22b9('0x28')](function(_0x5153e4){if(_0x5153e4&&_0x5153e4['autoAssociation']===0x0){return db[_0x22b9('0x2c')][_0x22b9('0x4d')]({'name':_0x35e497[_0x22b9('0x2e')],'resourceId':_0x35e497['id'],'type':_0x5153e4[_0x22b9('0x2e')],'sectionId':_0x5153e4['id']},{})[_0x22b9('0x28')](function(){return _0x3793e2;});}else{return _0x3793e2;}})[_0x22b9('0x49')](function(_0x300fc6){logger[_0x22b9('0x53')](_0x22b9('0x54'),_0x300fc6);throw _0x300fc6;});}return _0x3793e2;})[_0x22b9('0x28')](respondWithResult(_0x1a4614,0xc9))[_0x22b9('0x49')](handleError(_0x1a4614,null));};exports[_0x22b9('0x27')]=function(_0x238286,_0x33d81f){if(_0x238286[_0x22b9('0x55')]['id']){delete _0x238286['body']['id'];}return db[_0x22b9('0x31')]['find']({'where':{'id':_0x238286[_0x22b9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x33d81f,null))[_0x22b9('0x28')](saveUpdates(_0x238286[_0x22b9('0x55')],null))['then'](respondWithResult(_0x33d81f,null))[_0x22b9('0x49')](handleError(_0x33d81f,null));};exports[_0x22b9('0x29')]=function(_0x24bc4d,_0x47911b){return db[_0x22b9('0x31')][_0x22b9('0x4c')]({'where':{'id':_0x24bc4d[_0x22b9('0x4a')]['id']}})[_0x22b9('0x28')](handleEntityNotFound(_0x47911b,null))['then'](removeEntity(_0x47911b,null))[_0x22b9('0x49')](handleError(_0x47911b,null));};
\ No newline at end of file
index 01f4c20..eef96b8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd6e9=['recordingFormat','auth','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','internal','findAll','agent','then','exports','models','define','VoiceChanSpy','length','VoiceExtension','bulkCreate','catch','destroy','util','bluebird','./voiceChanSpy.attributes','from-sip','system','%s%s','prefix','push','merge','Set','format','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,ab'];(function(_0x419bcd,_0x34ef80){var _0x1f96db=function(_0x1c886f){while(--_0x1c886f){_0x419bcd['push'](_0x419bcd['shift']());}};_0x1f96db(++_0x34ef80);}(_0xd6e9,0x88));var _0x9d6e=function(_0x50bb3c,_0x36e308){_0x50bb3c=_0x50bb3c-0x0;var _0x121de3=_0xd6e9[_0x50bb3c];return _0x121de3;};'use strict';var _=require('lodash');var util=require(_0x9d6e('0x0'));var BPromise=require(_0x9d6e('0x1'));var logger=require('../../config/logger')('api');var attributes=require(_0x9d6e('0x2'));var getUserApplications=function(_0x51c007,_0x524ec2,_0x5b380e){var _0xe754f2=0x1;var _0x1fa0ef=[];var _0x1d9f3c={'context':_0x9d6e('0x3'),'type':_0x9d6e('0x4'),'isApp':![]};var _0x412d84={'exten':util['format'](_0x9d6e('0x5'),_0x51c007[_0x9d6e('0x6')],_0x5b380e),'ChanSpyId':_0x51c007['id'],'UserId':_0x524ec2['id']};_0x1fa0ef[_0x9d6e('0x7')](_[_0x9d6e('0x8')]({'app':_0x9d6e('0x9'),'appdata':util[_0x9d6e('0xa')](_0x9d6e('0xb'),_0x9d6e('0xc')),'priority':_0xe754f2++},_0x1d9f3c,_0x412d84));if(_0x51c007[_0x9d6e('0xd')]){_0x1fa0ef[_0x9d6e('0x7')](_['merge']({'app':_0x9d6e('0xe'),'appdata':util[_0x9d6e('0xa')](_0x9d6e('0xf'),_0x51c007[_0x9d6e('0x10')]),'priority':_0xe754f2++},_0x1d9f3c,_0x412d84));}if(_0x51c007[_0x9d6e('0x11')]){_0x1fa0ef[_0x9d6e('0x7')](_['merge']({'app':'Authenticate','appdata':_0x51c007[_0x9d6e('0x12')],'priority':_0xe754f2++},_0x1d9f3c,_0x412d84));}_0x1fa0ef['push'](_[_0x9d6e('0x8')]({'app':_0x9d6e('0x13'),'appdata':util['format'](_0x9d6e('0x14'),_0x524ec2[_0x9d6e('0x15')],_0x51c007[_0x9d6e('0x16')]?_0x51c007['options'][_0x9d6e('0x17')](''):''),'priority':_0xe754f2++},_0x1d9f3c,_0x412d84));if(_0x51c007[_0x9d6e('0xd')]){_0x1fa0ef[_0x9d6e('0x7')](_[_0x9d6e('0x8')]({'app':_0x9d6e('0x18'),'priority':_0xe754f2++},_0x1d9f3c,_0x412d84));}return _0x1fa0ef;};var getChanSpyApplications=function(_0x1805e5,_0x1c410c){var _0x5bd751=[];for(var _0x4e6b7c=0x0,_0x18c24b=0x1;_0x4e6b7c<_0x1c410c['length'];_0x4e6b7c++,_0x18c24b=0x1){var _0x451aa2=getUserApplications(_0x1805e5,_0x1c410c[_0x4e6b7c],_0x1c410c[_0x4e6b7c][_0x9d6e('0x19')]);var _0x27f777=getUserApplications(_0x1805e5,_0x1c410c[_0x4e6b7c],_0x1c410c[_0x4e6b7c][_0x9d6e('0x15')]);_0x5bd751=_0x5bd751['concat'](_0x451aa2,_0x27f777);}return _0x5bd751;};var getChanSpyPromise=function(_0x489f36,_0x4a494f){return new BPromise(function(_0x58a586,_0x34e837){return _0x489f36['User'][_0x9d6e('0x1a')]({'attributes':['id',_0x9d6e('0x15'),_0x9d6e('0x19')],'where':{'role':_0x9d6e('0x1b'),'chanspy':!![]},'raw':!![]})[_0x9d6e('0x1c')](function(_0x2aa16e){if(_0x2aa16e){return _0x58a586(getChanSpyApplications(_0x4a494f,_0x2aa16e));}return _0x58a586([]);})['catch'](function(_0x5e471f){_0x34e837(_0x5e471f);});});};module[_0x9d6e('0x1d')]=function(_0x527d03,_0x2d7455){var _0x19968b=_0x527d03[_0x9d6e('0x1e')];return _0x527d03[_0x9d6e('0x1f')](_0x9d6e('0x20'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x24bf05,_0x2b999f,_0x3df6c0){return getChanSpyPromise(_0x19968b,_0x24bf05)[_0x9d6e('0x1c')](function(_0x56d0a8){if(_0x56d0a8&&_0x56d0a8[_0x9d6e('0x21')]){return _0x19968b[_0x9d6e('0x22')][_0x9d6e('0x23')](_0x56d0a8);}})[_0x9d6e('0x1c')](function(){_0x3df6c0();})[_0x9d6e('0x24')](function(_0x8abaaa){_0x3df6c0(_0x8abaaa);});},'afterUpdate':function(_0x2cf473,_0x4fe649,_0xb7043d){return _0x19968b['VoiceExtension'][_0x9d6e('0x25')]({'where':{'ChanSpyId':_0x2cf473['id']}})[_0x9d6e('0x1c')](function(){return getChanSpyPromise(_0x19968b,_0x2cf473);})[_0x9d6e('0x1c')](function(_0x3f060f){if(_0x3f060f&&_0x3f060f[_0x9d6e('0x21')]){return _0x19968b[_0x9d6e('0x22')][_0x9d6e('0x23')](_0x3f060f);}})['then'](function(){_0xb7043d();})['catch'](function(_0xd3408a){_0xb7043d(_0xd3408a);});},'afterDestroy':function(_0x3be76a,_0x33ae82,_0x6f15bd){return _0x19968b[_0x9d6e('0x22')][_0x9d6e('0x25')]({'where':{'ChanSpyId':_0x3be76a['id']}})[_0x9d6e('0x1c')](function(){_0x6f15bd();})[_0x9d6e('0x24')](function(_0x498479){_0x6f15bd(_0x498479);});}}});};
\ No newline at end of file
+var _0x6cb3=['join','record','internal','agent','then','catch','exports','models','define','VoiceChanSpy','length','VoiceExtension','bulkCreate','destroy','lodash','bluebird','../../config/logger','api','./voiceChanSpy.attributes','from-sip','format','%s%s','push','merge','Set','CDR(type)=%s','MixMonitor','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','name','options'];(function(_0x4c19cc,_0x54e0e5){var _0x492758=function(_0x4023eb){while(--_0x4023eb){_0x4c19cc['push'](_0x4c19cc['shift']());}};_0x492758(++_0x54e0e5);}(_0x6cb3,0xda));var _0x36cb=function(_0x5265a7,_0x3a7373){_0x5265a7=_0x5265a7-0x0;var _0x24eb9b=_0x6cb3[_0x5265a7];return _0x24eb9b;};'use strict';var _=require(_0x36cb('0x0'));var util=require('util');var BPromise=require(_0x36cb('0x1'));var logger=require(_0x36cb('0x2'))(_0x36cb('0x3'));var attributes=require(_0x36cb('0x4'));var getUserApplications=function(_0x52208f,_0x549a00,_0x2e1d23){var _0x1de83d=0x1;var _0x417f25=[];var _0x1d0685={'context':_0x36cb('0x5'),'type':'system','isApp':![]};var _0x2db8aa={'exten':util[_0x36cb('0x6')](_0x36cb('0x7'),_0x52208f['prefix'],_0x2e1d23),'ChanSpyId':_0x52208f['id'],'UserId':_0x549a00['id']};_0x417f25[_0x36cb('0x8')](_[_0x36cb('0x9')]({'app':_0x36cb('0xa'),'appdata':util[_0x36cb('0x6')](_0x36cb('0xb'),'chanspy'),'priority':_0x1de83d++},_0x1d0685,_0x2db8aa));if(_0x52208f['record']){_0x417f25[_0x36cb('0x8')](_[_0x36cb('0x9')]({'app':_0x36cb('0xc'),'appdata':util['format']('${UNIQUEID}.%s,ab',_0x52208f[_0x36cb('0xd')]),'priority':_0x1de83d++},_0x1d0685,_0x2db8aa));}if(_0x52208f['auth']){_0x417f25[_0x36cb('0x8')](_['merge']({'app':_0x36cb('0xe'),'appdata':_0x52208f[_0x36cb('0xf')],'priority':_0x1de83d++},_0x1d0685,_0x2db8aa));}_0x417f25[_0x36cb('0x8')](_[_0x36cb('0x9')]({'app':_0x36cb('0x10'),'appdata':util[_0x36cb('0x6')](_0x36cb('0x11'),_0x549a00[_0x36cb('0x12')],_0x52208f[_0x36cb('0x13')]?_0x52208f[_0x36cb('0x13')][_0x36cb('0x14')](''):''),'priority':_0x1de83d++},_0x1d0685,_0x2db8aa));if(_0x52208f[_0x36cb('0x15')]){_0x417f25[_0x36cb('0x8')](_[_0x36cb('0x9')]({'app':'StopMixMonitor','priority':_0x1de83d++},_0x1d0685,_0x2db8aa));}return _0x417f25;};var getChanSpyApplications=function(_0x1bb9ab,_0x6a02d6){var _0xdd6b92=[];for(var _0x3bb778=0x0,_0x5e9c1c=0x1;_0x3bb778<_0x6a02d6['length'];_0x3bb778++,_0x5e9c1c=0x1){var _0x1e375e=getUserApplications(_0x1bb9ab,_0x6a02d6[_0x3bb778],_0x6a02d6[_0x3bb778][_0x36cb('0x16')]);var _0x29a32c=getUserApplications(_0x1bb9ab,_0x6a02d6[_0x3bb778],_0x6a02d6[_0x3bb778][_0x36cb('0x12')]);_0xdd6b92=_0xdd6b92['concat'](_0x1e375e,_0x29a32c);}return _0xdd6b92;};var getChanSpyPromise=function(_0x4b0cb1,_0x3c5fcd){return new BPromise(function(_0x5183d7,_0x2d87b9){return _0x4b0cb1['User']['findAll']({'attributes':['id',_0x36cb('0x12'),_0x36cb('0x16')],'where':{'role':_0x36cb('0x17'),'chanspy':!![]},'raw':!![]})[_0x36cb('0x18')](function(_0xc1f722){if(_0xc1f722){return _0x5183d7(getChanSpyApplications(_0x3c5fcd,_0xc1f722));}return _0x5183d7([]);})[_0x36cb('0x19')](function(_0x21c201){_0x2d87b9(_0x21c201);});});};module[_0x36cb('0x1a')]=function(_0x3585a1,_0x89a9dc){var _0x28818a=_0x3585a1[_0x36cb('0x1b')];return _0x3585a1[_0x36cb('0x1c')](_0x36cb('0x1d'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x543ac8,_0x4fbd46,_0xa72485){return getChanSpyPromise(_0x28818a,_0x543ac8)[_0x36cb('0x18')](function(_0x4d7b37){if(_0x4d7b37&&_0x4d7b37[_0x36cb('0x1e')]){return _0x28818a[_0x36cb('0x1f')][_0x36cb('0x20')](_0x4d7b37);}})['then'](function(){_0xa72485();})[_0x36cb('0x19')](function(_0x572efc){_0xa72485(_0x572efc);});},'afterUpdate':function(_0x39329d,_0x59fc66,_0x1c4ce4){return _0x28818a[_0x36cb('0x1f')][_0x36cb('0x21')]({'where':{'ChanSpyId':_0x39329d['id']}})[_0x36cb('0x18')](function(){return getChanSpyPromise(_0x28818a,_0x39329d);})['then'](function(_0x2bed73){if(_0x2bed73&&_0x2bed73[_0x36cb('0x1e')]){return _0x28818a[_0x36cb('0x1f')]['bulkCreate'](_0x2bed73);}})[_0x36cb('0x18')](function(){_0x1c4ce4();})[_0x36cb('0x19')](function(_0xde7973){_0x1c4ce4(_0xde7973);});},'afterDestroy':function(_0x499c84,_0x26f058,_0x4f09c0){return _0x28818a[_0x36cb('0x1f')][_0x36cb('0x21')]({'where':{'ChanSpyId':_0x499c84['id']}})[_0x36cb('0x18')](function(){_0x4f09c0();})[_0x36cb('0x19')](function(_0x5de61f){_0x4f09c0(_0x5de61f);});}}});};
\ No newline at end of file
index 3a6fe41..df5fc7d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe2d4=['request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','VoiceChanSpy,\x20%s,\x20%s','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','request','then'];(function(_0x1b2b02,_0x3e3c49){var _0x173b44=function(_0xc70b8d){while(--_0xc70b8d){_0x1b2b02['push'](_0x1b2b02['shift']());}};_0x173b44(++_0x3e3c49);}(_0xe2d4,0xd9));var _0x4e2d=function(_0x32252e,_0x4e18d2){_0x32252e=_0x32252e-0x0;var _0x1dc521=_0xe2d4[_0x32252e];return _0x1dc521;};'use strict';var _=require(_0x4e2d('0x0'));var util=require(_0x4e2d('0x1'));var moment=require(_0x4e2d('0x2'));var BPromise=require('bluebird');var rs=require(_0x4e2d('0x3'));var fs=require('fs');var Redis=require(_0x4e2d('0x4'));var db=require(_0x4e2d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4e2d('0x6'))('rpc');var config=require(_0x4e2d('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4e2d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x463d66,_0x5ad952,_0x38ec9b){return new BPromise(function(_0xa0ddf0,_0x2f2623){return client[_0x4e2d('0x9')](_0x463d66,_0x38ec9b)[_0x4e2d('0xa')](function(_0x3e5814){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x5ad952,_0x4e2d('0xb'));logger['debug'](_0x4e2d('0xc'),_0x5ad952,'request\x20sent',JSON['stringify'](_0x3e5814));if(_0x3e5814[_0x4e2d('0xd')]){if(_0x3e5814[_0x4e2d('0xd')][_0x4e2d('0xe')]===0x1f4){logger[_0x4e2d('0xd')](_0x4e2d('0xf'),_0x5ad952,_0x3e5814[_0x4e2d('0xd')][_0x4e2d('0x10')]);return _0x2f2623(_0x3e5814[_0x4e2d('0xd')][_0x4e2d('0x10')]);}logger[_0x4e2d('0xd')](_0x4e2d('0xf'),_0x5ad952,_0x3e5814[_0x4e2d('0xd')][_0x4e2d('0x10')]);return _0xa0ddf0(_0x3e5814['error'][_0x4e2d('0x10')]);}else{logger[_0x4e2d('0x11')](_0x4e2d('0xf'),_0x5ad952,_0x4e2d('0xb'));_0xa0ddf0(_0x3e5814['result'][_0x4e2d('0x10')]);}})[_0x4e2d('0x12')](function(_0x162709){logger[_0x4e2d('0xd')](_0x4e2d('0xf'),_0x5ad952,_0x162709);_0x2f2623(_0x162709);});});}
\ No newline at end of file
+var _0xd0e4=['result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0xae04ff,_0x24225e){var _0x53065f=function(_0x1a3a7b){while(--_0x1a3a7b){_0xae04ff['push'](_0xae04ff['shift']());}};_0x53065f(++_0x24225e);}(_0xd0e4,0x1ba));var _0x4d0e=function(_0x406696,_0x39f9b1){_0x406696=_0x406696-0x0;var _0x10e35c=_0xd0e4[_0x406696];return _0x10e35c;};'use strict';var _=require(_0x4d0e('0x0'));var util=require(_0x4d0e('0x1'));var moment=require('moment');var BPromise=require(_0x4d0e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d0e('0x3'));var db=require(_0x4d0e('0x4'))['db'];var utils=require(_0x4d0e('0x5'));var logger=require(_0x4d0e('0x6'))(_0x4d0e('0x7'));var config=require(_0x4d0e('0x8'));var jayson=require(_0x4d0e('0x9'));var client=jayson[_0x4d0e('0xa')][_0x4d0e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22059c,_0x1fedcf,_0x61f045){return new BPromise(function(_0x13d8aa,_0x5431a7){return client[_0x4d0e('0xc')](_0x22059c,_0x61f045)['then'](function(_0x2d8b3c){logger['info'](_0x4d0e('0xd'),_0x1fedcf,_0x4d0e('0xe'));logger[_0x4d0e('0xf')](_0x4d0e('0x10'),_0x1fedcf,'request\x20sent',JSON['stringify'](_0x2d8b3c));if(_0x2d8b3c[_0x4d0e('0x11')]){if(_0x2d8b3c[_0x4d0e('0x11')]['code']===0x1f4){logger[_0x4d0e('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x1fedcf,_0x2d8b3c[_0x4d0e('0x11')][_0x4d0e('0x12')]);return _0x5431a7(_0x2d8b3c[_0x4d0e('0x11')][_0x4d0e('0x12')]);}logger['error'](_0x4d0e('0xd'),_0x1fedcf,_0x2d8b3c[_0x4d0e('0x11')]['message']);return _0x13d8aa(_0x2d8b3c[_0x4d0e('0x11')][_0x4d0e('0x12')]);}else{logger[_0x4d0e('0x13')](_0x4d0e('0xd'),_0x1fedcf,'request\x20sent');_0x13d8aa(_0x2d8b3c[_0x4d0e('0x14')][_0x4d0e('0x12')]);}})['catch'](function(_0x14227){logger[_0x4d0e('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x1fedcf,_0x14227);_0x5431a7(_0x14227);});});}
\ No newline at end of file
index e0d20f2..9df95dc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbd8e=['show','create','put','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index','/:id','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd8e,0x1b5));var _0xebd8=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xbd8e[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xebd8('0x0'));var util=require(_0xebd8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xebd8('0x2'));var router=express['Router']();var auth=require(_0xebd8('0x3'));var interaction=require(_0xebd8('0x4'));var config=require(_0xebd8('0x5'));var controller=require(_0xebd8('0x6'));router[_0xebd8('0x7')]('/',auth['isAuthenticated'](),controller[_0xebd8('0x8')]);router[_0xebd8('0x7')](_0xebd8('0x9'),auth[_0xebd8('0xa')](),controller[_0xebd8('0xb')]);router['post']('/',auth[_0xebd8('0xa')](),controller[_0xebd8('0xc')]);router[_0xebd8('0xd')](_0xebd8('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xebd8('0x9'),auth[_0xebd8('0xa')](),controller[_0xebd8('0xe')]);module[_0xebd8('0xf')]=router;
\ No newline at end of file
+var _0x34bd=['post','create','put','/:id','update','delete','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','show'];(function(_0x5f34a3,_0x4ba871){var _0xeabd05=function(_0x3ececd){while(--_0x3ececd){_0x5f34a3['push'](_0x5f34a3['shift']());}};_0xeabd05(++_0x4ba871);}(_0x34bd,0x1d2));var _0xd34b=function(_0x539bde,_0x14b7db){_0x539bde=_0x539bde-0x0;var _0x1718d4=_0x34bd[_0x539bde];return _0x1718d4;};'use strict';var multer=require(_0xd34b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd34b('0x1'));var express=require(_0xd34b('0x2'));var router=express[_0xd34b('0x3')]();var auth=require(_0xd34b('0x4'));var interaction=require(_0xd34b('0x5'));var config=require(_0xd34b('0x6'));var controller=require(_0xd34b('0x7'));router['get']('/',auth[_0xd34b('0x8')](),controller['index']);router['get']('/:id',auth[_0xd34b('0x8')](),controller[_0xd34b('0x9')]);router[_0xd34b('0xa')]('/',auth[_0xd34b('0x8')](),controller[_0xd34b('0xb')]);router[_0xd34b('0xc')](_0xd34b('0xd'),auth[_0xd34b('0x8')](),controller[_0xd34b('0xe')]);router[_0xd34b('0xf')](_0xd34b('0xd'),auth[_0xd34b('0x8')](),controller['destroy']);module[_0xd34b('0x10')]=router;
\ No newline at end of file
index 1582290..6a524d1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x55af=['STRING','name'];(function(_0x31e682,_0x38fc10){var _0x79641f=function(_0x445810){while(--_0x445810){_0x31e682['push'](_0x31e682['shift']());}};_0x79641f(++_0x38fc10);}(_0x55af,0x10c));var _0xf55a=function(_0x96c6ea,_0x56bfc0){_0x96c6ea=_0x96c6ea-0x0;var _0x1324d5=_0x55af[_0x96c6ea];return _0x1324d5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf55a('0x0')],'unique':_0xf55a('0x1')},'description':{'type':Sequelize[_0xf55a('0x0')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}};
\ No newline at end of file
+var _0xf8fd=['name','BOOLEAN','STRING'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf8fd,0x1df));var _0xdf8f=function(_0x1bf5f5,_0xec42c){_0x1bf5f5=_0x1bf5f5-0x0;var _0x10117c=_0xf8fd[_0x1bf5f5];return _0x10117c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdf8f('0x0')],'unique':_0xdf8f('0x1')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xdf8f('0x2')],'defaultValue':0x0}};
\ No newline at end of file
index 7149ecc..58e78d7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x53f8=['rows','show','params','VoiceContext','length','options','find','create','body','readFileSync','join','root','utf8','writeFileSync','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','server/files/templates/context.ejs','render','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','json','count','offset','limit','set','Content-Range','reject','destroy','get','Contexts','UserProfileResource','status','stack','name','send','rawAttributes','model','keys','query','attributes','intersection','fields','nolimit','sort','where','filters','pick','merge','map','type','key','field','filter','includeAll','include','findAll'];(function(_0x4341cf,_0x171f57){var _0xccbbdf=function(_0x4a1858){while(--_0x4a1858){_0x4341cf['push'](_0x4341cf['shift']());}};_0xccbbdf(++_0x171f57);}(_0x53f8,0x7a));var _0x853f=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x53f8[_0x20c9b2];return _0x2c6030;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x853f('0x0'));var rimraf=require(_0x853f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x853f('0x2'));var rp=require(_0x853f('0x3'));var moment=require('moment');var BPromise=require(_0x853f('0x4'));var Mustache=require(_0x853f('0x5'));var util=require(_0x853f('0x6'));var path=require(_0x853f('0x7'));var sox=require('sox');var csv=require(_0x853f('0x8'));var ejs=require(_0x853f('0x9'));var fs=require('fs');var _=require(_0x853f('0xa'));var squel=require(_0x853f('0xb'));var crypto=require('crypto');var jsforce=require(_0x853f('0xc'));var deskjs=require(_0x853f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x853f('0xe'));var Papa=require(_0x853f('0xf'));var authService=require('../../components/auth/service');var hardwareService=require(_0x853f('0x10'));var Redis=require('ioredis');var qs=require(_0x853f('0x11'));var logger=require(_0x853f('0x12'))(_0x853f('0x13'));var utils=require(_0x853f('0x14'));var config=require(_0x853f('0x15'));var db=require(_0x853f('0x16'))['db'];var jayson=require(_0x853f('0x17'));var client=jayson['client'][_0x853f('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x500c8b,_0x20e3a3,_0x22705a,_0x202741){return new BPromise(function(_0x42a03d,_0x362d59){var _0x3f90c0=_0x202741||client;return _0x3f90c0['request'](_0x500c8b,_0x22705a)[_0x853f('0x19')](function(_0x8e8d9e){logger[_0x853f('0x1a')](_0x853f('0x1b'),_0x20e3a3,_0x853f('0x1c'));logger[_0x853f('0x1d')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x20e3a3,'request\x20sent',JSON[_0x853f('0x1e')](_0x8e8d9e));if(_0x8e8d9e[_0x853f('0x1f')]){if(_0x8e8d9e['error'][_0x853f('0x20')]===0x1f4){logger[_0x853f('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x20e3a3,_0x8e8d9e['error'][_0x853f('0x21')]);return _0x362d59(_0x8e8d9e[_0x853f('0x1f')][_0x853f('0x21')]);}logger[_0x853f('0x1f')](_0x853f('0x1b'),_0x20e3a3,_0x8e8d9e[_0x853f('0x1f')][_0x853f('0x21')]);return _0x42a03d(_0x8e8d9e['error'][_0x853f('0x21')]);}else{logger[_0x853f('0x1a')](_0x853f('0x1b'),_0x20e3a3,_0x853f('0x1c'));_0x42a03d(_0x8e8d9e[_0x853f('0x22')]['message']);}})[_0x853f('0x23')](function(_0x42469f){logger[_0x853f('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x20e3a3,_0x42469f);_0x362d59(_0x42469f);});});}function respondWithStatusCode(_0x46eec6,_0x202308){_0x202308=_0x202308||0xcc;return function(_0x63d0e7){if(_0x63d0e7){return _0x46eec6[_0x853f('0x24')](_0x202308);}return _0x46eec6['status'](_0x202308)[_0x853f('0x25')]();};}function respondWithResult(_0x38c4ba,_0x49a3a4){_0x49a3a4=_0x49a3a4||0xc8;return function(_0x2df4d8){if(_0x2df4d8){return _0x38c4ba['status'](_0x49a3a4)[_0x853f('0x26')](_0x2df4d8);}};}function respondWithFilteredResult(_0x409dab,_0x20ae1f){return function(_0x31a5e5){if(_0x31a5e5){var _0x3b75ae=_0x31a5e5[_0x853f('0x27')],_0x5cdd3b=_0x20ae1f[_0x853f('0x28')],_0x37d047=_0x20ae1f[_0x853f('0x28')]+_0x20ae1f[_0x853f('0x29')],_0x13f796;if(_0x37d047>=_0x3b75ae){_0x37d047=_0x3b75ae;_0x13f796=0xc8;}else{_0x13f796=0xce;}_0x409dab['status'](_0x13f796);return _0x409dab[_0x853f('0x2a')](_0x853f('0x2b'),_0x5cdd3b+'-'+_0x37d047+'/'+_0x3b75ae)[_0x853f('0x26')](_0x31a5e5);}return null;};}function patchUpdates(_0x3b9012){return function(_0x337407){try{jsonpatch['apply'](_0x337407,_0x3b9012,!![]);}catch(_0xdd136f){return BPromise[_0x853f('0x2c')](_0xdd136f);}return _0x337407['save']();};}function saveUpdates(_0x4d6d56,_0x5b74b0){return function(_0x20b27a){if(_0x20b27a){return _0x20b27a['update'](_0x4d6d56)[_0x853f('0x19')](function(_0x4d8c2d){return _0x4d8c2d;});}return null;};}function removeEntity(_0x251217,_0x287858){return function(_0x17b283){if(_0x17b283){return _0x17b283[_0x853f('0x2d')]()[_0x853f('0x19')](function(){var _0x2c1ee2=_0x17b283[_0x853f('0x2e')]({'plain':!![]});var _0x45a034=_0x853f('0x2f');return db[_0x853f('0x30')][_0x853f('0x2d')]({'where':{'type':_0x45a034,'resourceId':_0x2c1ee2['id']}})[_0x853f('0x19')](function(){return _0x17b283;});})['then'](function(){_0x251217[_0x853f('0x31')](0xcc)[_0x853f('0x25')]();});}};}function handleEntityNotFound(_0x27562c,_0x247d8c){return function(_0xd9cb44){if(!_0xd9cb44){_0x27562c['sendStatus'](0x194);}return _0xd9cb44;};}function handleError(_0x29a6cc,_0x3a204a){_0x3a204a=_0x3a204a||0x1f4;return function(_0x1aede8){logger[_0x853f('0x1f')](_0x1aede8[_0x853f('0x32')]);if(_0x1aede8[_0x853f('0x33')]){delete _0x1aede8['name'];}_0x29a6cc[_0x853f('0x31')](_0x3a204a)[_0x853f('0x34')](_0x1aede8);};}exports['index']=function(_0xe756b9,_0x1b0591){var _0x856040={},_0x4dd507={},_0x46924a={'count':0x0,'rows':[]};var _0x340392=db['VoiceContext'][_0x853f('0x35')];_0x4dd507[_0x853f('0x36')]=_['keys'](_0x340392);_0x4dd507['query']=_[_0x853f('0x37')](_0xe756b9['query']);_0x4dd507['filters']=_['intersection'](_0x4dd507['model'],_0x4dd507[_0x853f('0x38')]);_0x856040[_0x853f('0x39')]=_[_0x853f('0x3a')](_0x4dd507['model'],qs[_0x853f('0x3b')](_0xe756b9['query'][_0x853f('0x3b')]));_0x856040['attributes']=_0x856040['attributes']['length']?_0x856040[_0x853f('0x39')]:_0x4dd507[_0x853f('0x36')];if(!_0xe756b9[_0x853f('0x38')]['hasOwnProperty'](_0x853f('0x3c'))){_0x856040['limit']=qs[_0x853f('0x29')](_0xe756b9[_0x853f('0x38')][_0x853f('0x29')]);_0x856040[_0x853f('0x28')]=qs[_0x853f('0x28')](_0xe756b9[_0x853f('0x38')][_0x853f('0x28')]);}_0x856040['order']=qs['sort'](_0xe756b9[_0x853f('0x38')][_0x853f('0x3d')]);_0x856040[_0x853f('0x3e')]=qs[_0x853f('0x3f')](_[_0x853f('0x40')](_0xe756b9[_0x853f('0x38')],_0x4dd507[_0x853f('0x3f')]));if(_0xe756b9['query']['filter']){_0x856040[_0x853f('0x3e')]=_[_0x853f('0x41')](_0x856040['where'],{'$or':_[_0x853f('0x42')](_0x340392,function(_0x2e0090){if(_0x2e0090[_0x853f('0x43')][_0x853f('0x44')]!=='VIRTUAL'){var _0x5c955e={};_0x5c955e[_0x2e0090[_0x853f('0x45')]]={'$like':'%'+_0xe756b9[_0x853f('0x38')][_0x853f('0x46')]+'%'};return _0x5c955e;}})});}_0x856040=_['merge']({},_0x856040,_0xe756b9['options']);var _0x39b65e={'where':_0x856040[_0x853f('0x3e')]};return db['VoiceContext'][_0x853f('0x27')](_0x39b65e)['then'](function(_0x1bc906){_0x46924a[_0x853f('0x27')]=_0x1bc906;if(_0xe756b9['query'][_0x853f('0x47')]){_0x856040[_0x853f('0x48')]=[{'all':!![]}];}return db['VoiceContext'][_0x853f('0x49')](_0x856040);})[_0x853f('0x19')](function(_0x448e75){_0x46924a[_0x853f('0x4a')]=_0x448e75;return _0x46924a;})[_0x853f('0x19')](respondWithFilteredResult(_0x1b0591,_0x856040))['catch'](handleError(_0x1b0591,null));};exports[_0x853f('0x4b')]=function(_0x42f7dc,_0xf895a5){var _0x4bae0e={'raw':![],'where':{'id':_0x42f7dc[_0x853f('0x4c')]['id']}},_0x46fe1f={};_0x46fe1f[_0x853f('0x36')]=_[_0x853f('0x37')](db[_0x853f('0x4d')][_0x853f('0x35')]);_0x46fe1f[_0x853f('0x38')]=_[_0x853f('0x37')](_0x42f7dc[_0x853f('0x38')]);_0x46fe1f[_0x853f('0x3f')]=_[_0x853f('0x3a')](_0x46fe1f['model'],_0x46fe1f['query']);_0x4bae0e[_0x853f('0x39')]=_[_0x853f('0x3a')](_0x46fe1f[_0x853f('0x36')],qs['fields'](_0x42f7dc['query']['fields']));_0x4bae0e[_0x853f('0x39')]=_0x4bae0e[_0x853f('0x39')][_0x853f('0x4e')]?_0x4bae0e[_0x853f('0x39')]:_0x46fe1f[_0x853f('0x36')];if(_0x42f7dc['query']['includeAll']){_0x4bae0e['include']=[{'all':!![]}];}_0x4bae0e=_['merge']({},_0x4bae0e,_0x42f7dc[_0x853f('0x4f')]);return db[_0x853f('0x4d')][_0x853f('0x50')](_0x4bae0e)[_0x853f('0x19')](handleEntityNotFound(_0xf895a5,null))[_0x853f('0x19')](respondWithResult(_0xf895a5,null))['catch'](handleError(_0xf895a5,null));};exports[_0x853f('0x51')]=function(_0x5924d8,_0x18de4a,_0xe32c90){var _0x4836f8;return db[_0x853f('0x4d')][_0x853f('0x51')](_0x5924d8[_0x853f('0x52')],{'raw':!![]})[_0x853f('0x19')](function(_0x5b8449){_0x4836f8=_0x5b8449;return db[_0x853f('0x4d')][_0x853f('0x49')]({'raw':!![]});})['then'](function(_0x51f290){var _0x31f50b=fs[_0x853f('0x53')](path[_0x853f('0x54')](config[_0x853f('0x55')],'server/files/templates/context.ejs'),_0x853f('0x56'));var _0x5d9070=ejs['render'](_0x31f50b,{'contexts':_0x51f290||[]});fs[_0x853f('0x57')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x5d9070);})['then'](function(){return respondWithRpcPromise(_0x853f('0x58'),_0x853f('0x51'),{'module':_0x853f('0x59')});})[_0x853f('0x19')](function(){var _0x39fa07=_0x5924d8['user']['get']({'plain':!![]});if(!_0x39fa07)throw new Error(_0x853f('0x5a'));if(_0x39fa07['role']==='user'){var _0x2435c6=_0x4836f8[_0x853f('0x2e')]({'plain':!![]});return db[_0x853f('0x5b')][_0x853f('0x50')]({'where':{'name':_0x853f('0x2f'),'userProfileId':_0x39fa07[_0x853f('0x5c')]},'raw':!![]})[_0x853f('0x19')](function(_0x13d41f){if(_0x13d41f&&_0x13d41f['autoAssociation']===0x0){return db[_0x853f('0x30')][_0x853f('0x51')]({'name':_0x2435c6[_0x853f('0x33')],'resourceId':_0x2435c6['id'],'type':_0x13d41f[_0x853f('0x33')],'sectionId':_0x13d41f['id']},{})[_0x853f('0x19')](function(){return _0x4836f8;});}else{return _0x4836f8;}})[_0x853f('0x23')](function(_0x3adc46){logger[_0x853f('0x1f')](_0x853f('0x5d'),_0x3adc46);throw _0x3adc46;});}return _0x4836f8;})['then'](respondWithResult(_0x18de4a,0xc9))[_0x853f('0x23')](handleError(_0x18de4a,null));};exports[_0x853f('0x5e')]=function(_0x271279,_0x563361,_0xa02598){var _0x2ef70f;return db['VoiceContext'][_0x853f('0x50')]({'where':{'id':_0x271279[_0x853f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x563361,null))[_0x853f('0x19')](saveUpdates(_0x271279[_0x853f('0x52')],null))[_0x853f('0x19')](function(_0x539a7f){if(_0x539a7f){_0x2ef70f=_0x539a7f;return db[_0x853f('0x4d')][_0x853f('0x49')]({'raw':!![]});}})[_0x853f('0x19')](function(_0x354136){var _0x56d8d4=fs[_0x853f('0x53')](path[_0x853f('0x54')](config['root'],_0x853f('0x5f')),'utf8');var _0x7d2919=ejs[_0x853f('0x60')](_0x56d8d4,{'contexts':_0x354136||[]});fs[_0x853f('0x57')](_0x853f('0x61'),_0x7d2919);})['then'](function(){return respondWithRpcPromise(_0x853f('0x58'),_0x853f('0x5e'),{'module':_0x853f('0x59')});})['then'](function(){return _0x2ef70f;})[_0x853f('0x19')](respondWithResult(_0x563361,null))[_0x853f('0x23')](handleError(_0x563361,null));};exports[_0x853f('0x2d')]=function(_0x114791,_0x43ee3b,_0x38206b){var _0x3358e0;return db[_0x853f('0x4d')][_0x853f('0x50')]({'where':{'id':_0x114791[_0x853f('0x4c')]['id']}})[_0x853f('0x19')](handleEntityNotFound(_0x43ee3b,null))[_0x853f('0x19')](removeEntity(_0x43ee3b,null))['then'](function(){return db[_0x853f('0x4d')][_0x853f('0x49')]({'raw':!![]});})[_0x853f('0x19')](function(_0x12e1d2){var _0x4a21b8=fs[_0x853f('0x53')](path['join'](config[_0x853f('0x55')],_0x853f('0x5f')),'utf8');var _0xdef35f=ejs['render'](_0x4a21b8,{'contexts':_0x12e1d2});fs[_0x853f('0x57')](_0x853f('0x61'),_0xdef35f);return respondWithRpcPromise(_0x853f('0x58'),_0x853f('0x2d'),{'module':_0x853f('0x59')});})[_0x853f('0x23')](handleError(_0x43ee3b,null));};
\ No newline at end of file
+var _0x1055=['readFileSync','join','utf8','render','writeFileSync','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','body','root','chan_sip.so','server/files/templates/context.ejs','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','json','offset','limit','set','Content-Range','apply','reject','update','destroy','get','Contexts','UserProfileResource','stack','name','send','index','VoiceContext','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','type','key','field','count','include','show','params','rawAttributes','includeAll','options','create','findAll'];(function(_0x388bfa,_0x1f518c){var _0x11d6a6=function(_0x40b0b3){while(--_0x40b0b3){_0x388bfa['push'](_0x388bfa['shift']());}};_0x11d6a6(++_0x1f518c);}(_0x1055,0x1a5));var _0x5105=function(_0x1f3c56,_0x598757){_0x1f3c56=_0x1f3c56-0x0;var _0x569524=_0x1055[_0x1f3c56];return _0x569524;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5105('0x0'));var rimraf=require(_0x5105('0x1'));var zipdir=require(_0x5105('0x2'));var jsonpatch=require(_0x5105('0x3'));var rp=require('request-promise');var moment=require(_0x5105('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5105('0x5'));var util=require(_0x5105('0x6'));var path=require(_0x5105('0x7'));var sox=require(_0x5105('0x8'));var csv=require(_0x5105('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5105('0xa'));var squel=require(_0x5105('0xb'));var crypto=require(_0x5105('0xc'));var jsforce=require(_0x5105('0xd'));var deskjs=require(_0x5105('0xe'));var toCsv=require(_0x5105('0x9'));var querystring=require(_0x5105('0xf'));var Papa=require(_0x5105('0x10'));var authService=require(_0x5105('0x11'));var hardwareService=require(_0x5105('0x12'));var Redis=require('ioredis');var qs=require(_0x5105('0x13'));var logger=require(_0x5105('0x14'))(_0x5105('0x15'));var utils=require(_0x5105('0x16'));var config=require('../../config/environment');var db=require(_0x5105('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x5105('0x18')][_0x5105('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x10dc6b,_0x142262,_0x1a63b8,_0x89f55e){return new BPromise(function(_0x228456,_0x109d4a){var _0x6abd2e=_0x89f55e||client;return _0x6abd2e[_0x5105('0x1a')](_0x10dc6b,_0x1a63b8)[_0x5105('0x1b')](function(_0x520fcc){logger[_0x5105('0x1c')](_0x5105('0x1d'),_0x142262,_0x5105('0x1e'));logger[_0x5105('0x1f')](_0x5105('0x20'),_0x142262,_0x5105('0x1e'),JSON['stringify'](_0x520fcc));if(_0x520fcc[_0x5105('0x21')]){if(_0x520fcc[_0x5105('0x21')][_0x5105('0x22')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x142262,_0x520fcc[_0x5105('0x21')][_0x5105('0x23')]);return _0x109d4a(_0x520fcc[_0x5105('0x21')][_0x5105('0x23')]);}logger[_0x5105('0x21')](_0x5105('0x1d'),_0x142262,_0x520fcc[_0x5105('0x21')][_0x5105('0x23')]);return _0x228456(_0x520fcc[_0x5105('0x21')][_0x5105('0x23')]);}else{logger[_0x5105('0x1c')](_0x5105('0x1d'),_0x142262,_0x5105('0x1e'));_0x228456(_0x520fcc[_0x5105('0x24')][_0x5105('0x23')]);}})[_0x5105('0x25')](function(_0x4a9f73){logger[_0x5105('0x21')](_0x5105('0x1d'),_0x142262,_0x4a9f73);_0x109d4a(_0x4a9f73);});});}function respondWithStatusCode(_0x8f49cc,_0x2d8587){_0x2d8587=_0x2d8587||0xcc;return function(_0x12c780){if(_0x12c780){return _0x8f49cc['sendStatus'](_0x2d8587);}return _0x8f49cc[_0x5105('0x26')](_0x2d8587)[_0x5105('0x27')]();};}function respondWithResult(_0x3b3fac,_0xcf7f7b){_0xcf7f7b=_0xcf7f7b||0xc8;return function(_0x5d3944){if(_0x5d3944){return _0x3b3fac[_0x5105('0x26')](_0xcf7f7b)[_0x5105('0x28')](_0x5d3944);}};}function respondWithFilteredResult(_0x262508,_0xe3e1bd){return function(_0x2d1ea3){if(_0x2d1ea3){var _0x2013e7=_0x2d1ea3['count'],_0x16869d=_0xe3e1bd[_0x5105('0x29')],_0x136500=_0xe3e1bd['offset']+_0xe3e1bd[_0x5105('0x2a')],_0x4b504c;if(_0x136500>=_0x2013e7){_0x136500=_0x2013e7;_0x4b504c=0xc8;}else{_0x4b504c=0xce;}_0x262508[_0x5105('0x26')](_0x4b504c);return _0x262508[_0x5105('0x2b')](_0x5105('0x2c'),_0x16869d+'-'+_0x136500+'/'+_0x2013e7)[_0x5105('0x28')](_0x2d1ea3);}return null;};}function patchUpdates(_0x375846){return function(_0x101ef3){try{jsonpatch[_0x5105('0x2d')](_0x101ef3,_0x375846,!![]);}catch(_0x497d26){return BPromise[_0x5105('0x2e')](_0x497d26);}return _0x101ef3['save']();};}function saveUpdates(_0xcc17b9,_0x193abf){return function(_0x3e3fa9){if(_0x3e3fa9){return _0x3e3fa9[_0x5105('0x2f')](_0xcc17b9)['then'](function(_0x2d6f1e){return _0x2d6f1e;});}return null;};}function removeEntity(_0x309032,_0x3c7c2c){return function(_0x7ce8ca){if(_0x7ce8ca){return _0x7ce8ca[_0x5105('0x30')]()['then'](function(){var _0x272211=_0x7ce8ca[_0x5105('0x31')]({'plain':!![]});var _0x5c0ea1=_0x5105('0x32');return db[_0x5105('0x33')][_0x5105('0x30')]({'where':{'type':_0x5c0ea1,'resourceId':_0x272211['id']}})[_0x5105('0x1b')](function(){return _0x7ce8ca;});})[_0x5105('0x1b')](function(){_0x309032[_0x5105('0x26')](0xcc)[_0x5105('0x27')]();});}};}function handleEntityNotFound(_0x595321,_0xe221c9){return function(_0xa053ba){if(!_0xa053ba){_0x595321['sendStatus'](0x194);}return _0xa053ba;};}function handleError(_0x4de500,_0x233a1b){_0x233a1b=_0x233a1b||0x1f4;return function(_0x260078){logger['error'](_0x260078[_0x5105('0x34')]);if(_0x260078['name']){delete _0x260078[_0x5105('0x35')];}_0x4de500[_0x5105('0x26')](_0x233a1b)[_0x5105('0x36')](_0x260078);};}exports[_0x5105('0x37')]=function(_0x52d8e8,_0x53c5a5){var _0x1f20a9={},_0x2ff028={},_0x32b0f5={'count':0x0,'rows':[]};var _0x3ef6cc=db[_0x5105('0x38')]['rawAttributes'];_0x2ff028[_0x5105('0x39')]=_[_0x5105('0x3a')](_0x3ef6cc);_0x2ff028['query']=_[_0x5105('0x3a')](_0x52d8e8[_0x5105('0x3b')]);_0x2ff028[_0x5105('0x3c')]=_[_0x5105('0x3d')](_0x2ff028[_0x5105('0x39')],_0x2ff028[_0x5105('0x3b')]);_0x1f20a9[_0x5105('0x3e')]=_['intersection'](_0x2ff028[_0x5105('0x39')],qs[_0x5105('0x3f')](_0x52d8e8[_0x5105('0x3b')][_0x5105('0x3f')]));_0x1f20a9[_0x5105('0x3e')]=_0x1f20a9[_0x5105('0x3e')][_0x5105('0x40')]?_0x1f20a9[_0x5105('0x3e')]:_0x2ff028[_0x5105('0x39')];if(!_0x52d8e8[_0x5105('0x3b')][_0x5105('0x41')](_0x5105('0x42'))){_0x1f20a9[_0x5105('0x2a')]=qs[_0x5105('0x2a')](_0x52d8e8[_0x5105('0x3b')][_0x5105('0x2a')]);_0x1f20a9[_0x5105('0x29')]=qs[_0x5105('0x29')](_0x52d8e8['query'][_0x5105('0x29')]);}_0x1f20a9['order']=qs[_0x5105('0x43')](_0x52d8e8['query'][_0x5105('0x43')]);_0x1f20a9[_0x5105('0x44')]=qs[_0x5105('0x3c')](_['pick'](_0x52d8e8['query'],_0x2ff028[_0x5105('0x3c')]));if(_0x52d8e8[_0x5105('0x3b')][_0x5105('0x45')]){_0x1f20a9[_0x5105('0x44')]=_[_0x5105('0x46')](_0x1f20a9[_0x5105('0x44')],{'$or':_[_0x5105('0x47')](_0x3ef6cc,function(_0x169b27){if(_0x169b27[_0x5105('0x48')][_0x5105('0x49')]!=='VIRTUAL'){var _0x5f1c60={};_0x5f1c60[_0x169b27[_0x5105('0x4a')]]={'$like':'%'+_0x52d8e8[_0x5105('0x3b')][_0x5105('0x45')]+'%'};return _0x5f1c60;}})});}_0x1f20a9=_[_0x5105('0x46')]({},_0x1f20a9,_0x52d8e8['options']);var _0xec5d94={'where':_0x1f20a9[_0x5105('0x44')]};return db[_0x5105('0x38')]['count'](_0xec5d94)[_0x5105('0x1b')](function(_0x4dc536){_0x32b0f5[_0x5105('0x4b')]=_0x4dc536;if(_0x52d8e8[_0x5105('0x3b')]['includeAll']){_0x1f20a9[_0x5105('0x4c')]=[{'all':!![]}];}return db['VoiceContext']['findAll'](_0x1f20a9);})[_0x5105('0x1b')](function(_0x24be60){_0x32b0f5['rows']=_0x24be60;return _0x32b0f5;})['then'](respondWithFilteredResult(_0x53c5a5,_0x1f20a9))['catch'](handleError(_0x53c5a5,null));};exports[_0x5105('0x4d')]=function(_0x3c38ce,_0x396aa2){var _0x3c1557={'raw':![],'where':{'id':_0x3c38ce[_0x5105('0x4e')]['id']}},_0x277db0={};_0x277db0['model']=_[_0x5105('0x3a')](db[_0x5105('0x38')][_0x5105('0x4f')]);_0x277db0['query']=_['keys'](_0x3c38ce[_0x5105('0x3b')]);_0x277db0[_0x5105('0x3c')]=_['intersection'](_0x277db0[_0x5105('0x39')],_0x277db0[_0x5105('0x3b')]);_0x3c1557[_0x5105('0x3e')]=_[_0x5105('0x3d')](_0x277db0[_0x5105('0x39')],qs[_0x5105('0x3f')](_0x3c38ce[_0x5105('0x3b')][_0x5105('0x3f')]));_0x3c1557[_0x5105('0x3e')]=_0x3c1557[_0x5105('0x3e')]['length']?_0x3c1557[_0x5105('0x3e')]:_0x277db0[_0x5105('0x39')];if(_0x3c38ce[_0x5105('0x3b')][_0x5105('0x50')]){_0x3c1557[_0x5105('0x4c')]=[{'all':!![]}];}_0x3c1557=_[_0x5105('0x46')]({},_0x3c1557,_0x3c38ce[_0x5105('0x51')]);return db[_0x5105('0x38')]['find'](_0x3c1557)[_0x5105('0x1b')](handleEntityNotFound(_0x396aa2,null))[_0x5105('0x1b')](respondWithResult(_0x396aa2,null))[_0x5105('0x25')](handleError(_0x396aa2,null));};exports[_0x5105('0x52')]=function(_0x49277c,_0x3f6756,_0x34a01e){var _0xdb608c;return db[_0x5105('0x38')][_0x5105('0x52')](_0x49277c['body'],{'raw':!![]})['then'](function(_0x379241){_0xdb608c=_0x379241;return db[_0x5105('0x38')][_0x5105('0x53')]({'raw':!![]});})[_0x5105('0x1b')](function(_0x1cc2ce){var _0x1f20b7=fs[_0x5105('0x54')](path[_0x5105('0x55')](config['root'],'server/files/templates/context.ejs'),_0x5105('0x56'));var _0xea89c4=ejs[_0x5105('0x57')](_0x1f20b7,{'contexts':_0x1cc2ce||[]});fs[_0x5105('0x58')]('/etc/asterisk/extensions_xcally_contexts.conf',_0xea89c4);})[_0x5105('0x1b')](function(){return respondWithRpcPromise(_0x5105('0x59'),_0x5105('0x52'),{'module':'chan_sip.so'});})[_0x5105('0x1b')](function(){var _0x1bd557=_0x49277c[_0x5105('0x5a')]['get']({'plain':!![]});if(!_0x1bd557)throw new Error(_0x5105('0x5b'));if(_0x1bd557[_0x5105('0x5c')]===_0x5105('0x5a')){var _0x5089b0=_0xdb608c[_0x5105('0x31')]({'plain':!![]});return db[_0x5105('0x5d')][_0x5105('0x5e')]({'where':{'name':_0x5105('0x32'),'userProfileId':_0x1bd557['userProfileId']},'raw':!![]})[_0x5105('0x1b')](function(_0xa14ba4){if(_0xa14ba4&&_0xa14ba4[_0x5105('0x5f')]===0x0){return db[_0x5105('0x33')][_0x5105('0x52')]({'name':_0x5089b0['name'],'resourceId':_0x5089b0['id'],'type':_0xa14ba4[_0x5105('0x35')],'sectionId':_0xa14ba4['id']},{})[_0x5105('0x1b')](function(){return _0xdb608c;});}else{return _0xdb608c;}})[_0x5105('0x25')](function(_0x5c9d2e){logger[_0x5105('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c9d2e);throw _0x5c9d2e;});}return _0xdb608c;})[_0x5105('0x1b')](respondWithResult(_0x3f6756,0xc9))[_0x5105('0x25')](handleError(_0x3f6756,null));};exports[_0x5105('0x2f')]=function(_0x2b3c05,_0x25848c,_0xd38dc){var _0x4d462f;return db['VoiceContext'][_0x5105('0x5e')]({'where':{'id':_0x2b3c05[_0x5105('0x4e')]['id']}})[_0x5105('0x1b')](handleEntityNotFound(_0x25848c,null))[_0x5105('0x1b')](saveUpdates(_0x2b3c05[_0x5105('0x60')],null))[_0x5105('0x1b')](function(_0x45cba0){if(_0x45cba0){_0x4d462f=_0x45cba0;return db[_0x5105('0x38')]['findAll']({'raw':!![]});}})[_0x5105('0x1b')](function(_0x4f6543){var _0x1f52e6=fs[_0x5105('0x54')](path[_0x5105('0x55')](config[_0x5105('0x61')],'server/files/templates/context.ejs'),_0x5105('0x56'));var _0x338a63=ejs[_0x5105('0x57')](_0x1f52e6,{'contexts':_0x4f6543||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x338a63);})['then'](function(){return respondWithRpcPromise(_0x5105('0x59'),_0x5105('0x2f'),{'module':_0x5105('0x62')});})[_0x5105('0x1b')](function(){return _0x4d462f;})[_0x5105('0x1b')](respondWithResult(_0x25848c,null))[_0x5105('0x25')](handleError(_0x25848c,null));};exports[_0x5105('0x30')]=function(_0x167703,_0x1099aa,_0x4d4715){var _0x56faab;return db[_0x5105('0x38')]['find']({'where':{'id':_0x167703[_0x5105('0x4e')]['id']}})[_0x5105('0x1b')](handleEntityNotFound(_0x1099aa,null))[_0x5105('0x1b')](removeEntity(_0x1099aa,null))[_0x5105('0x1b')](function(){return db[_0x5105('0x38')][_0x5105('0x53')]({'raw':!![]});})[_0x5105('0x1b')](function(_0x1c67b9){var _0x293cc3=fs[_0x5105('0x54')](path['join'](config['root'],_0x5105('0x63')),_0x5105('0x56'));var _0x29c522=ejs['render'](_0x293cc3,{'contexts':_0x1c67b9});fs['writeFileSync'](_0x5105('0x64'),_0x29c522);return respondWithRpcPromise('Reload','destroy',{'module':_0x5105('0x62')});})['catch'](handleError(_0x1099aa,null));};
\ No newline at end of file
index 460b9c9..53fa984 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaa78=['VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','request-promise','exports'];(function(_0x20efe6,_0x2d6285){var _0x2680c2=function(_0x1c969b){while(--_0x1c969b){_0x20efe6['push'](_0x20efe6['shift']());}};_0x2680c2(++_0x2d6285);}(_0xaa78,0x158));var _0x8aa7=function(_0x4cdcdc,_0x34eac7){_0x4cdcdc=_0x4cdcdc-0x0;var _0x4704ce=_0xaa78[_0x4cdcdc];return _0x4704ce;};'use strict';var _=require(_0x8aa7('0x0'));var util=require(_0x8aa7('0x1'));var logger=require(_0x8aa7('0x2'))(_0x8aa7('0x3'));var moment=require(_0x8aa7('0x4'));var BPromise=require('bluebird');var rp=require(_0x8aa7('0x5'));var attributes=require('./voiceContext.attributes');module[_0x8aa7('0x6')]=function(_0x4065ad,_0xe80611){return _0x4065ad['define'](_0x8aa7('0x7'),attributes,{'tableName':_0x8aa7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x0a59=['define','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','./voiceContext.attributes'];(function(_0x3afb5d,_0x191ef6){var _0x3d2c75=function(_0x57256f){while(--_0x57256f){_0x3afb5d['push'](_0x3afb5d['shift']());}};_0x3d2c75(++_0x191ef6);}(_0x0a59,0x12b));var _0x90a5=function(_0x4943dd,_0x47b3ab){_0x4943dd=_0x4943dd-0x0;var _0x24ffd6=_0x0a59[_0x4943dd];return _0x24ffd6;};'use strict';var _=require(_0x90a5('0x0'));var util=require(_0x90a5('0x1'));var logger=require(_0x90a5('0x2'))(_0x90a5('0x3'));var moment=require(_0x90a5('0x4'));var BPromise=require(_0x90a5('0x5'));var rp=require('request-promise');var attributes=require(_0x90a5('0x6'));module['exports']=function(_0x1e9f9b,_0x5343f1){return _0x1e9f9b[_0x90a5('0x7')]('VoiceContext',attributes,{'tableName':_0x90a5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index b9ab076..d33b082 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd133=['http','request','info','VoiceContext,\x20%s,\x20%s','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x50c8e4,_0x5d5a6f){var _0x49911a=function(_0x4f048c){while(--_0x4f048c){_0x50c8e4['push'](_0x50c8e4['shift']());}};_0x49911a(++_0x5d5a6f);}(_0xd133,0x1ef));var _0x3d13=function(_0x239cee,_0xf786c8){_0x239cee=_0x239cee-0x0;var _0x4fe6b6=_0xd133[_0x239cee];return _0x4fe6b6;};'use strict';var _=require(_0x3d13('0x0'));var util=require(_0x3d13('0x1'));var moment=require(_0x3d13('0x2'));var BPromise=require(_0x3d13('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d13('0x4'));var db=require(_0x3d13('0x5'))['db'];var utils=require(_0x3d13('0x6'));var logger=require(_0x3d13('0x7'))(_0x3d13('0x8'));var config=require('../../config/environment');var jayson=require(_0x3d13('0x9'));var client=jayson[_0x3d13('0xa')][_0x3d13('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x330bfc,_0x19f5ec,_0x4b68ab){return new BPromise(function(_0x4e92db,_0x94d8df){return client[_0x3d13('0xc')](_0x330bfc,_0x4b68ab)['then'](function(_0x248a98){logger[_0x3d13('0xd')](_0x3d13('0xe'),_0x19f5ec,'request\x20sent');logger['debug'](_0x3d13('0xf'),_0x19f5ec,_0x3d13('0x10'),JSON[_0x3d13('0x11')](_0x248a98));if(_0x248a98[_0x3d13('0x12')]){if(_0x248a98['error'][_0x3d13('0x13')]===0x1f4){logger['error'](_0x3d13('0xe'),_0x19f5ec,_0x248a98[_0x3d13('0x12')]['message']);return _0x94d8df(_0x248a98[_0x3d13('0x12')][_0x3d13('0x14')]);}logger[_0x3d13('0x12')](_0x3d13('0xe'),_0x19f5ec,_0x248a98['error']['message']);return _0x4e92db(_0x248a98['error'][_0x3d13('0x14')]);}else{logger[_0x3d13('0xd')](_0x3d13('0xe'),_0x19f5ec,_0x3d13('0x10'));_0x4e92db(_0x248a98['result'][_0x3d13('0x14')]);}})[_0x3d13('0x15')](function(_0x2f2ba5){logger['error'](_0x3d13('0xe'),_0x19f5ec,_0x2f2ba5);_0x94d8df(_0x2f2ba5);});});}
\ No newline at end of file
+var _0xee32=['error','code','message','info','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3548fb,_0x30110d){var _0x1e8f6b=function(_0x108637){while(--_0x108637){_0x3548fb['push'](_0x3548fb['shift']());}};_0x1e8f6b(++_0x30110d);}(_0xee32,0x122));var _0x2ee3=function(_0xfe2c50,_0x2f4ac0){_0xfe2c50=_0xfe2c50-0x0;var _0x3a4140=_0xee32[_0xfe2c50];return _0x3a4140;};'use strict';var _=require(_0x2ee3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ee3('0x1'));var db=require(_0x2ee3('0x2'))['db'];var utils=require(_0x2ee3('0x3'));var logger=require(_0x2ee3('0x4'))('rpc');var config=require(_0x2ee3('0x5'));var jayson=require(_0x2ee3('0x6'));var client=jayson['client'][_0x2ee3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1b23b5,_0x4167ec,_0xca9af3){return new BPromise(function(_0x3ec883,_0x7547e9){return client[_0x2ee3('0x8')](_0x1b23b5,_0xca9af3)[_0x2ee3('0x9')](function(_0x3e1a01){logger['info'](_0x2ee3('0xa'),_0x4167ec,'request\x20sent');logger[_0x2ee3('0xb')](_0x2ee3('0xc'),_0x4167ec,'request\x20sent',JSON[_0x2ee3('0xd')](_0x3e1a01));if(_0x3e1a01['error']){if(_0x3e1a01[_0x2ee3('0xe')][_0x2ee3('0xf')]===0x1f4){logger[_0x2ee3('0xe')](_0x2ee3('0xa'),_0x4167ec,_0x3e1a01[_0x2ee3('0xe')][_0x2ee3('0x10')]);return _0x7547e9(_0x3e1a01['error'][_0x2ee3('0x10')]);}logger['error'](_0x2ee3('0xa'),_0x4167ec,_0x3e1a01[_0x2ee3('0xe')][_0x2ee3('0x10')]);return _0x3ec883(_0x3e1a01[_0x2ee3('0xe')][_0x2ee3('0x10')]);}else{logger[_0x2ee3('0x11')](_0x2ee3('0xa'),_0x4167ec,'request\x20sent');_0x3ec883(_0x3e1a01['result'][_0x2ee3('0x10')]);}})[_0x2ee3('0x12')](function(_0x1aefc8){logger[_0x2ee3('0xe')](_0x2ee3('0xa'),_0x4167ec,_0x1aefc8);_0x7547e9(_0x1aefc8);});});}
\ No newline at end of file
index 1c9b9ac..4ec1d7d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa37c=['../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xa37c,0x163));var _0xca37=function(_0x7791d5,_0xdab65f){_0x7791d5=_0x7791d5-0x0;var _0x5ce288=_0xa37c[_0x7791d5];return _0x5ce288;};'use strict';var multer=require(_0xca37('0x0'));var util=require(_0xca37('0x1'));var path=require('path');var timeout=require(_0xca37('0x2'));var express=require('express');var router=express[_0xca37('0x3')]();var auth=require(_0xca37('0x4'));var interaction=require(_0xca37('0x5'));var config=require(_0xca37('0x6'));var controller=require(_0xca37('0x7'));router[_0xca37('0x8')]('/',auth[_0xca37('0x9')](),controller['index']);router[_0xca37('0x8')](_0xca37('0xa'),auth[_0xca37('0x9')](),controller[_0xca37('0xb')]);router['get'](_0xca37('0xc'),auth[_0xca37('0x9')](),controller[_0xca37('0xd')]);router[_0xca37('0xe')]('/',auth['isAuthenticated'](),controller[_0xca37('0xf')]);router[_0xca37('0x10')](_0xca37('0xc'),auth[_0xca37('0x9')](),controller[_0xca37('0x11')]);router[_0xca37('0x12')]('/:id',auth[_0xca37('0x9')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
+var _0xcc4d=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put'];(function(_0x58eec7,_0x2353db){var _0x25c5d3=function(_0x1ae895){while(--_0x1ae895){_0x58eec7['push'](_0x58eec7['shift']());}};_0x25c5d3(++_0x2353db);}(_0xcc4d,0x64));var _0xdcc4=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xcc4d[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0xdcc4('0x0'));var util=require(_0xdcc4('0x1'));var path=require(_0xdcc4('0x2'));var timeout=require(_0xdcc4('0x3'));var express=require(_0xdcc4('0x4'));var router=express[_0xdcc4('0x5')]();var auth=require(_0xdcc4('0x6'));var interaction=require(_0xdcc4('0x7'));var config=require(_0xdcc4('0x8'));var controller=require(_0xdcc4('0x9'));router[_0xdcc4('0xa')]('/',auth['isAuthenticated'](),controller[_0xdcc4('0xb')]);router[_0xdcc4('0xa')](_0xdcc4('0xc'),auth['isAuthenticated'](),controller[_0xdcc4('0xd')]);router[_0xdcc4('0xa')](_0xdcc4('0xe'),auth[_0xdcc4('0xf')](),controller[_0xdcc4('0x10')]);router[_0xdcc4('0x11')]('/',auth[_0xdcc4('0xf')](),controller[_0xdcc4('0x12')]);router[_0xdcc4('0x13')](_0xdcc4('0xe'),auth[_0xdcc4('0xf')](),controller[_0xdcc4('0x14')]);router[_0xdcc4('0x15')](_0xdcc4('0xe'),auth[_0xdcc4('0xf')](),controller[_0xdcc4('0x16')]);module[_0xdcc4('0x17')]=router;
\ No newline at end of file
index 306ca74..3452fbd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x45f7=['INTEGER','DATE','called,connect,complete','exports','STRING'];(function(_0x3792e6,_0x32bd91){var _0x441e44=function(_0x357478){while(--_0x357478){_0x3792e6['push'](_0x3792e6['shift']());}};_0x441e44(++_0x32bd91);}(_0x45f7,0x148));var _0x745f=function(_0x1e172a,_0x52102b){_0x1e172a=_0x1e172a-0x0;var _0x96338b=_0x45f7[_0x1e172a];return _0x96338b;};'use strict';var Sequelize=require('sequelize');module[_0x745f('0x0')]={'privilege':{'type':Sequelize[_0x745f('0x1')]},'channel':{'type':Sequelize[_0x745f('0x1')]},'channelstate':{'type':Sequelize[_0x745f('0x2')]},'channelstatedesc':{'type':Sequelize[_0x745f('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x745f('0x1')]},'language':{'type':Sequelize[_0x745f('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x745f('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x745f('0x2')]},'uniqueid':{'type':Sequelize[_0x745f('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x745f('0x1')]},'destchannelstate':{'type':Sequelize[_0x745f('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x745f('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x745f('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x745f('0x1')]},'destlanguage':{'type':Sequelize[_0x745f('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x745f('0x1')]},'destexten':{'type':Sequelize[_0x745f('0x1')]},'destpriority':{'type':Sequelize[_0x745f('0x2')]},'destuniqueid':{'type':Sequelize[_0x745f('0x1')]},'destlinkedid':{'type':Sequelize[_0x745f('0x1')]},'dialstring':{'type':Sequelize[_0x745f('0x1')]},'dialstatus':{'type':Sequelize[_0x745f('0x1')]},'starttime':{'type':Sequelize[_0x745f('0x3')]},'answertime':{'type':Sequelize[_0x745f('0x3')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x745f('0x1')],'comment':_0x745f('0x4')},'routeId':{'type':Sequelize[_0x745f('0x2')]},'duration':{'type':Sequelize[_0x745f('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}};
\ No newline at end of file
+var _0x8bc3=['INTEGER','DATE','sequelize','STRING'];(function(_0x4421a1,_0x2d8ec2){var _0x176126=function(_0x452e1f){while(--_0x452e1f){_0x4421a1['push'](_0x4421a1['shift']());}};_0x176126(++_0x2d8ec2);}(_0x8bc3,0x82));var _0x38bc=function(_0x13844e,_0x14d041){_0x13844e=_0x13844e-0x0;var _0x5183b0=_0x8bc3[_0x13844e];return _0x5183b0;};'use strict';var Sequelize=require(_0x38bc('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x38bc('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x38bc('0x2')]},'channelstatedesc':{'type':Sequelize[_0x38bc('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x38bc('0x1')]},'connectedlinenum':{'type':Sequelize[_0x38bc('0x1')]},'connectedlinename':{'type':Sequelize[_0x38bc('0x1')]},'language':{'type':Sequelize[_0x38bc('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x38bc('0x1')]},'exten':{'type':Sequelize[_0x38bc('0x1')]},'priority':{'type':Sequelize[_0x38bc('0x2')]},'uniqueid':{'type':Sequelize[_0x38bc('0x1')]},'linkedid':{'type':Sequelize[_0x38bc('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x38bc('0x1')]},'destcalleridnum':{'type':Sequelize[_0x38bc('0x1')]},'destcalleridname':{'type':Sequelize[_0x38bc('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x38bc('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x38bc('0x1')]},'destlanguage':{'type':Sequelize[_0x38bc('0x1')]},'destaccountcode':{'type':Sequelize[_0x38bc('0x1')]},'destcontext':{'type':Sequelize[_0x38bc('0x1')]},'destexten':{'type':Sequelize[_0x38bc('0x1')]},'destpriority':{'type':Sequelize[_0x38bc('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x38bc('0x3')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x38bc('0x2')]},'duration':{'type':Sequelize[_0x38bc('0x2')]},'holdtime':{'type':Sequelize[_0x38bc('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}};
\ No newline at end of file
index 9c36093..9f41e96 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x10e2=['index','VoiceDialReport','rawAttributes','keys','query','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','field','include','rows','catch','show','fields','includeAll','options','find','create','body','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name'];(function(_0x2844d3,_0x5cdcc5){var _0x227364=function(_0x44b7b7){while(--_0x44b7b7){_0x2844d3['push'](_0x2844d3['shift']());}};_0x227364(++_0x5cdcc5);}(_0x10e2,0x100));var _0x210e=function(_0x3df1c2,_0x1d32db){_0x3df1c2=_0x3df1c2-0x0;var _0x70d3e8=_0x10e2[_0x3df1c2];return _0x70d3e8;};'use strict';var pdf=require(_0x210e('0x0'));var emlformat=require(_0x210e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x210e('0x2'));var jsonpatch=require(_0x210e('0x3'));var rp=require(_0x210e('0x4'));var moment=require(_0x210e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x210e('0x6'));var util=require(_0x210e('0x7'));var path=require('path');var sox=require(_0x210e('0x8'));var csv=require('to-csv');var ejs=require(_0x210e('0x9'));var fs=require('fs');var _=require(_0x210e('0xa'));var squel=require(_0x210e('0xb'));var crypto=require(_0x210e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x210e('0xd'));var toCsv=require(_0x210e('0xe'));var querystring=require(_0x210e('0xf'));var Papa=require(_0x210e('0x10'));var authService=require(_0x210e('0x11'));var hardwareService=require(_0x210e('0x12'));var Redis=require('ioredis');var qs=require(_0x210e('0x13'));var logger=require('../../config/logger')(_0x210e('0x14'));var utils=require('../../config/utils');var config=require(_0x210e('0x15'));var db=require(_0x210e('0x16'))['db'];function respondWithStatusCode(_0x5a44ca,_0x506837){_0x506837=_0x506837||0xcc;return function(_0x52f4b3){if(_0x52f4b3){return _0x5a44ca[_0x210e('0x17')](_0x506837);}return _0x5a44ca[_0x210e('0x18')](_0x506837)[_0x210e('0x19')]();};}function respondWithResult(_0x5017db,_0x33aed5){_0x33aed5=_0x33aed5||0xc8;return function(_0x225882){if(_0x225882){return _0x5017db[_0x210e('0x18')](_0x33aed5)[_0x210e('0x1a')](_0x225882);}};}function respondWithFilteredResult(_0x53f8ed,_0x55d9bb){return function(_0x264268){if(_0x264268){var _0x16eec5=_0x264268[_0x210e('0x1b')],_0x66b39c=_0x55d9bb['offset'],_0x53c901=_0x55d9bb[_0x210e('0x1c')]+_0x55d9bb[_0x210e('0x1d')],_0x326a2f;if(_0x53c901>=_0x16eec5){_0x53c901=_0x16eec5;_0x326a2f=0xc8;}else{_0x326a2f=0xce;}_0x53f8ed[_0x210e('0x18')](_0x326a2f);return _0x53f8ed[_0x210e('0x1e')](_0x210e('0x1f'),_0x66b39c+'-'+_0x53c901+'/'+_0x16eec5)[_0x210e('0x1a')](_0x264268);}return null;};}function patchUpdates(_0x1d36b0){return function(_0x475617){try{jsonpatch[_0x210e('0x20')](_0x475617,_0x1d36b0,!![]);}catch(_0x4038c2){return BPromise[_0x210e('0x21')](_0x4038c2);}return _0x475617['save']();};}function saveUpdates(_0x27ea10,_0x56d376){return function(_0x2ef7c0){if(_0x2ef7c0){return _0x2ef7c0[_0x210e('0x22')](_0x27ea10)[_0x210e('0x23')](function(_0x433eef){return _0x433eef;});}return null;};}function removeEntity(_0x104231,_0x502b23){return function(_0x222e20){if(_0x222e20){return _0x222e20[_0x210e('0x24')]()[_0x210e('0x23')](function(){_0x104231['status'](0xcc)[_0x210e('0x19')]();});}};}function handleEntityNotFound(_0x2d3fbc,_0x20de4b){return function(_0x4b0d6d){if(!_0x4b0d6d){_0x2d3fbc[_0x210e('0x17')](0x194);}return _0x4b0d6d;};}function handleError(_0x477579,_0x19ae5c){_0x19ae5c=_0x19ae5c||0x1f4;return function(_0x2f868e){logger[_0x210e('0x25')](_0x2f868e[_0x210e('0x26')]);if(_0x2f868e[_0x210e('0x27')]){delete _0x2f868e[_0x210e('0x27')];}_0x477579[_0x210e('0x18')](_0x19ae5c)['send'](_0x2f868e);};}exports[_0x210e('0x28')]=function(_0xb7d135,_0x5b17e7){var _0x3622b9={},_0x5d6ade={},_0x3952b2={'count':0x0,'rows':[]};var _0x4a708b=db[_0x210e('0x29')][_0x210e('0x2a')];_0x5d6ade['model']=_['keys'](_0x4a708b);_0x5d6ade['query']=_[_0x210e('0x2b')](_0xb7d135[_0x210e('0x2c')]);_0x5d6ade['filters']=_[_0x210e('0x2d')](_0x5d6ade[_0x210e('0x2e')],_0x5d6ade[_0x210e('0x2c')]);_0x3622b9[_0x210e('0x2f')]=_[_0x210e('0x2d')](_0x5d6ade[_0x210e('0x2e')],qs['fields'](_0xb7d135[_0x210e('0x2c')]['fields']));_0x3622b9[_0x210e('0x2f')]=_0x3622b9[_0x210e('0x2f')][_0x210e('0x30')]?_0x3622b9[_0x210e('0x2f')]:_0x5d6ade['model'];if(!_0xb7d135[_0x210e('0x2c')][_0x210e('0x31')](_0x210e('0x32'))){_0x3622b9[_0x210e('0x1d')]=qs[_0x210e('0x1d')](_0xb7d135[_0x210e('0x2c')]['limit']);_0x3622b9['offset']=qs['offset'](_0xb7d135['query'][_0x210e('0x1c')]);}_0x3622b9[_0x210e('0x33')]=qs[_0x210e('0x34')](_0xb7d135[_0x210e('0x2c')]['sort']);_0x3622b9[_0x210e('0x35')]=qs[_0x210e('0x36')](_[_0x210e('0x37')](_0xb7d135['query'],_0x5d6ade[_0x210e('0x36')]));if(_0xb7d135['query'][_0x210e('0x38')]){_0x3622b9[_0x210e('0x35')]=_[_0x210e('0x39')](_0x3622b9[_0x210e('0x35')],{'$or':_[_0x210e('0x3a')](_0x4a708b,function(_0x5c8956){if(_0x5c8956[_0x210e('0x3b')]['key']!==_0x210e('0x3c')){var _0x3aa6df={};_0x3aa6df[_0x5c8956[_0x210e('0x3d')]]={'$like':'%'+_0xb7d135[_0x210e('0x2c')][_0x210e('0x38')]+'%'};return _0x3aa6df;}})});}_0x3622b9=_[_0x210e('0x39')]({},_0x3622b9,_0xb7d135['options']);var _0x1350c8={'where':_0x3622b9[_0x210e('0x35')]};return db['VoiceDialReport'][_0x210e('0x1b')](_0x1350c8)[_0x210e('0x23')](function(_0x1ec636){_0x3952b2[_0x210e('0x1b')]=_0x1ec636;if(_0xb7d135['query']['includeAll']){_0x3622b9[_0x210e('0x3e')]=[{'all':!![]}];}return db[_0x210e('0x29')]['findAll'](_0x3622b9);})[_0x210e('0x23')](function(_0x2c7857){_0x3952b2[_0x210e('0x3f')]=_0x2c7857;return _0x3952b2;})['then'](respondWithFilteredResult(_0x5b17e7,_0x3622b9))[_0x210e('0x40')](handleError(_0x5b17e7,null));};exports[_0x210e('0x41')]=function(_0x54356a,_0x5927ea){var _0x3f30ec={'raw':!![],'where':{'id':_0x54356a['params']['id']}},_0x349f10={};_0x349f10[_0x210e('0x2e')]=_['keys'](db['VoiceDialReport'][_0x210e('0x2a')]);_0x349f10[_0x210e('0x2c')]=_[_0x210e('0x2b')](_0x54356a[_0x210e('0x2c')]);_0x349f10['filters']=_[_0x210e('0x2d')](_0x349f10[_0x210e('0x2e')],_0x349f10[_0x210e('0x2c')]);_0x3f30ec[_0x210e('0x2f')]=_[_0x210e('0x2d')](_0x349f10[_0x210e('0x2e')],qs[_0x210e('0x42')](_0x54356a[_0x210e('0x2c')][_0x210e('0x42')]));_0x3f30ec['attributes']=_0x3f30ec[_0x210e('0x2f')]['length']?_0x3f30ec[_0x210e('0x2f')]:_0x349f10[_0x210e('0x2e')];if(_0x54356a[_0x210e('0x2c')][_0x210e('0x43')]){_0x3f30ec[_0x210e('0x3e')]=[{'all':!![]}];}_0x3f30ec=_[_0x210e('0x39')]({},_0x3f30ec,_0x54356a[_0x210e('0x44')]);return db[_0x210e('0x29')][_0x210e('0x45')](_0x3f30ec)[_0x210e('0x23')](handleEntityNotFound(_0x5927ea,null))['then'](respondWithResult(_0x5927ea,null))['catch'](handleError(_0x5927ea,null));};exports[_0x210e('0x46')]=function(_0x514a97,_0x3eb2d1){return db[_0x210e('0x29')]['create'](_0x514a97['body'],{})[_0x210e('0x23')](respondWithResult(_0x3eb2d1,0xc9))[_0x210e('0x40')](handleError(_0x3eb2d1,null));};exports['update']=function(_0x5d3975,_0x1f7717){if(_0x5d3975[_0x210e('0x47')]['id']){delete _0x5d3975[_0x210e('0x47')]['id'];}return db[_0x210e('0x29')][_0x210e('0x45')]({'where':{'id':_0x5d3975['params']['id']}})['then'](handleEntityNotFound(_0x1f7717,null))[_0x210e('0x23')](saveUpdates(_0x5d3975[_0x210e('0x47')],null))[_0x210e('0x23')](respondWithResult(_0x1f7717,null))['catch'](handleError(_0x1f7717,null));};exports['destroy']=function(_0x330785,_0x4ecf4a){return db[_0x210e('0x29')][_0x210e('0x45')]({'where':{'id':_0x330785[_0x210e('0x48')]['id']}})[_0x210e('0x23')](handleEntityNotFound(_0x4ecf4a,null))[_0x210e('0x23')](removeEntity(_0x4ecf4a,null))[_0x210e('0x40')](handleError(_0x4ecf4a,null));};exports['describe']=function(_0x3411f0,_0x1389c1){return db[_0x210e('0x29')][_0x210e('0x49')]()['then'](respondWithResult(_0x1389c1,null))[_0x210e('0x40')](handleError(_0x1389c1,null));};
\ No newline at end of file
+var _0x4c11=['length','order','sort','where','pick','filter','map','type','VIRTUAL','field','merge','include','VoiceDialReport','findAll','rows','catch','show','params','includeAll','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','name','send','index','rawAttributes','model','query','keys','filters','intersection','attributes','fields'];(function(_0x18e5c0,_0x466791){var _0x91206b=function(_0x1fc2b3){while(--_0x1fc2b3){_0x18e5c0['push'](_0x18e5c0['shift']());}};_0x91206b(++_0x466791);}(_0x4c11,0x1c8));var _0x14c1=function(_0x4c858f,_0xcd21d1){_0x4c858f=_0x4c858f-0x0;var _0x322921=_0x4c11[_0x4c858f];return _0x322921;};'use strict';var pdf=require(_0x14c1('0x0'));var emlformat=require(_0x14c1('0x1'));var rimraf=require(_0x14c1('0x2'));var zipdir=require(_0x14c1('0x3'));var jsonpatch=require(_0x14c1('0x4'));var rp=require(_0x14c1('0x5'));var moment=require(_0x14c1('0x6'));var BPromise=require(_0x14c1('0x7'));var Mustache=require(_0x14c1('0x8'));var util=require(_0x14c1('0x9'));var path=require(_0x14c1('0xa'));var sox=require(_0x14c1('0xb'));var csv=require(_0x14c1('0xc'));var ejs=require(_0x14c1('0xd'));var fs=require('fs');var _=require(_0x14c1('0xe'));var squel=require(_0x14c1('0xf'));var crypto=require('crypto');var jsforce=require(_0x14c1('0x10'));var deskjs=require(_0x14c1('0x11'));var toCsv=require(_0x14c1('0xc'));var querystring=require('querystring');var Papa=require(_0x14c1('0x12'));var authService=require('../../components/auth/service');var hardwareService=require(_0x14c1('0x13'));var Redis=require(_0x14c1('0x14'));var qs=require(_0x14c1('0x15'));var logger=require('../../config/logger')(_0x14c1('0x16'));var utils=require('../../config/utils');var config=require(_0x14c1('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31dcb5,_0x3b4163){_0x3b4163=_0x3b4163||0xcc;return function(_0x1f0888){if(_0x1f0888){return _0x31dcb5[_0x14c1('0x18')](_0x3b4163);}return _0x31dcb5[_0x14c1('0x19')](_0x3b4163)[_0x14c1('0x1a')]();};}function respondWithResult(_0x1df501,_0x150fe8){_0x150fe8=_0x150fe8||0xc8;return function(_0x592b15){if(_0x592b15){return _0x1df501['status'](_0x150fe8)[_0x14c1('0x1b')](_0x592b15);}};}function respondWithFilteredResult(_0x1592db,_0x4603a1){return function(_0x3690e1){if(_0x3690e1){var _0x15224e=_0x3690e1[_0x14c1('0x1c')],_0x2dc9c4=_0x4603a1[_0x14c1('0x1d')],_0x525467=_0x4603a1['offset']+_0x4603a1[_0x14c1('0x1e')],_0x328ee3;if(_0x525467>=_0x15224e){_0x525467=_0x15224e;_0x328ee3=0xc8;}else{_0x328ee3=0xce;}_0x1592db[_0x14c1('0x19')](_0x328ee3);return _0x1592db['set'](_0x14c1('0x1f'),_0x2dc9c4+'-'+_0x525467+'/'+_0x15224e)[_0x14c1('0x1b')](_0x3690e1);}return null;};}function patchUpdates(_0x54ec4a){return function(_0x4907dd){try{jsonpatch[_0x14c1('0x20')](_0x4907dd,_0x54ec4a,!![]);}catch(_0x5094cf){return BPromise[_0x14c1('0x21')](_0x5094cf);}return _0x4907dd[_0x14c1('0x22')]();};}function saveUpdates(_0xd0852a,_0x55424d){return function(_0x2c881f){if(_0x2c881f){return _0x2c881f[_0x14c1('0x23')](_0xd0852a)[_0x14c1('0x24')](function(_0x1643be){return _0x1643be;});}return null;};}function removeEntity(_0x337d21,_0x4d16ef){return function(_0x4a001d){if(_0x4a001d){return _0x4a001d['destroy']()['then'](function(){_0x337d21[_0x14c1('0x19')](0xcc)[_0x14c1('0x1a')]();});}};}function handleEntityNotFound(_0x169a8f,_0x2793b4){return function(_0x173e25){if(!_0x173e25){_0x169a8f[_0x14c1('0x18')](0x194);}return _0x173e25;};}function handleError(_0x581e31,_0x2419a4){_0x2419a4=_0x2419a4||0x1f4;return function(_0x2cad8a){logger['error'](_0x2cad8a['stack']);if(_0x2cad8a[_0x14c1('0x25')]){delete _0x2cad8a[_0x14c1('0x25')];}_0x581e31[_0x14c1('0x19')](_0x2419a4)[_0x14c1('0x26')](_0x2cad8a);};}exports[_0x14c1('0x27')]=function(_0x39efed,_0xa1e085){var _0x11c670={},_0x29bf4e={},_0x50f45b={'count':0x0,'rows':[]};var _0x1b9264=db['VoiceDialReport'][_0x14c1('0x28')];_0x29bf4e[_0x14c1('0x29')]=_['keys'](_0x1b9264);_0x29bf4e[_0x14c1('0x2a')]=_[_0x14c1('0x2b')](_0x39efed['query']);_0x29bf4e[_0x14c1('0x2c')]=_[_0x14c1('0x2d')](_0x29bf4e['model'],_0x29bf4e[_0x14c1('0x2a')]);_0x11c670[_0x14c1('0x2e')]=_[_0x14c1('0x2d')](_0x29bf4e[_0x14c1('0x29')],qs[_0x14c1('0x2f')](_0x39efed[_0x14c1('0x2a')]['fields']));_0x11c670[_0x14c1('0x2e')]=_0x11c670['attributes'][_0x14c1('0x30')]?_0x11c670[_0x14c1('0x2e')]:_0x29bf4e[_0x14c1('0x29')];if(!_0x39efed[_0x14c1('0x2a')]['hasOwnProperty']('nolimit')){_0x11c670['limit']=qs[_0x14c1('0x1e')](_0x39efed['query'][_0x14c1('0x1e')]);_0x11c670[_0x14c1('0x1d')]=qs[_0x14c1('0x1d')](_0x39efed[_0x14c1('0x2a')]['offset']);}_0x11c670[_0x14c1('0x31')]=qs[_0x14c1('0x32')](_0x39efed['query']['sort']);_0x11c670[_0x14c1('0x33')]=qs['filters'](_[_0x14c1('0x34')](_0x39efed['query'],_0x29bf4e[_0x14c1('0x2c')]));if(_0x39efed[_0x14c1('0x2a')][_0x14c1('0x35')]){_0x11c670[_0x14c1('0x33')]=_['merge'](_0x11c670[_0x14c1('0x33')],{'$or':_[_0x14c1('0x36')](_0x1b9264,function(_0x150773){if(_0x150773[_0x14c1('0x37')]['key']!==_0x14c1('0x38')){var _0x5e60aa={};_0x5e60aa[_0x150773[_0x14c1('0x39')]]={'$like':'%'+_0x39efed['query'][_0x14c1('0x35')]+'%'};return _0x5e60aa;}})});}_0x11c670=_[_0x14c1('0x3a')]({},_0x11c670,_0x39efed['options']);var _0x389cf7={'where':_0x11c670[_0x14c1('0x33')]};return db['VoiceDialReport']['count'](_0x389cf7)['then'](function(_0x1c6974){_0x50f45b[_0x14c1('0x1c')]=_0x1c6974;if(_0x39efed[_0x14c1('0x2a')]['includeAll']){_0x11c670[_0x14c1('0x3b')]=[{'all':!![]}];}return db[_0x14c1('0x3c')][_0x14c1('0x3d')](_0x11c670);})['then'](function(_0x320c92){_0x50f45b[_0x14c1('0x3e')]=_0x320c92;return _0x50f45b;})[_0x14c1('0x24')](respondWithFilteredResult(_0xa1e085,_0x11c670))[_0x14c1('0x3f')](handleError(_0xa1e085,null));};exports[_0x14c1('0x40')]=function(_0x15427f,_0x3ca40f){var _0x46b72b={'raw':!![],'where':{'id':_0x15427f[_0x14c1('0x41')]['id']}},_0x15d8b4={};_0x15d8b4[_0x14c1('0x29')]=_[_0x14c1('0x2b')](db['VoiceDialReport'][_0x14c1('0x28')]);_0x15d8b4[_0x14c1('0x2a')]=_[_0x14c1('0x2b')](_0x15427f['query']);_0x15d8b4[_0x14c1('0x2c')]=_[_0x14c1('0x2d')](_0x15d8b4[_0x14c1('0x29')],_0x15d8b4['query']);_0x46b72b[_0x14c1('0x2e')]=_['intersection'](_0x15d8b4[_0x14c1('0x29')],qs['fields'](_0x15427f['query'][_0x14c1('0x2f')]));_0x46b72b[_0x14c1('0x2e')]=_0x46b72b[_0x14c1('0x2e')][_0x14c1('0x30')]?_0x46b72b[_0x14c1('0x2e')]:_0x15d8b4[_0x14c1('0x29')];if(_0x15427f[_0x14c1('0x2a')][_0x14c1('0x42')]){_0x46b72b[_0x14c1('0x3b')]=[{'all':!![]}];}_0x46b72b=_[_0x14c1('0x3a')]({},_0x46b72b,_0x15427f['options']);return db[_0x14c1('0x3c')]['find'](_0x46b72b)[_0x14c1('0x24')](handleEntityNotFound(_0x3ca40f,null))[_0x14c1('0x24')](respondWithResult(_0x3ca40f,null))['catch'](handleError(_0x3ca40f,null));};exports[_0x14c1('0x43')]=function(_0x126033,_0x54226b){return db['VoiceDialReport']['create'](_0x126033['body'],{})[_0x14c1('0x24')](respondWithResult(_0x54226b,0xc9))['catch'](handleError(_0x54226b,null));};exports[_0x14c1('0x23')]=function(_0xd1f4d3,_0x400bdb){if(_0xd1f4d3['body']['id']){delete _0xd1f4d3[_0x14c1('0x44')]['id'];}return db[_0x14c1('0x3c')][_0x14c1('0x45')]({'where':{'id':_0xd1f4d3[_0x14c1('0x41')]['id']}})['then'](handleEntityNotFound(_0x400bdb,null))[_0x14c1('0x24')](saveUpdates(_0xd1f4d3[_0x14c1('0x44')],null))['then'](respondWithResult(_0x400bdb,null))[_0x14c1('0x3f')](handleError(_0x400bdb,null));};exports[_0x14c1('0x46')]=function(_0x35bae5,_0x3c669c){return db['VoiceDialReport']['find']({'where':{'id':_0x35bae5[_0x14c1('0x41')]['id']}})[_0x14c1('0x24')](handleEntityNotFound(_0x3c669c,null))['then'](removeEntity(_0x3c669c,null))['catch'](handleError(_0x3c669c,null));};exports[_0x14c1('0x47')]=function(_0x379cd3,_0x302769){return db[_0x14c1('0x3c')][_0x14c1('0x47')]()[_0x14c1('0x24')](respondWithResult(_0x302769,null))['catch'](handleError(_0x302769,null));};
\ No newline at end of file
index 3af5b8d..c35e648 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6642=['bluebird','request-promise','./voiceDialReport.attributes','define','VoiceDialReport','report_dial','uniqueid','lodash','api'];(function(_0x3f64cc,_0x23eb9f){var _0x25eb35=function(_0x5ef08c){while(--_0x5ef08c){_0x3f64cc['push'](_0x3f64cc['shift']());}};_0x25eb35(++_0x23eb9f);}(_0x6642,0x193));var _0x2664=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6642[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2664('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2664('0x1'));var moment=require('moment');var BPromise=require(_0x2664('0x2'));var rp=require(_0x2664('0x3'));var attributes=require(_0x2664('0x4'));module['exports']=function(_0x594695,_0x1bdab7){return _0x594695[_0x2664('0x5')](_0x2664('0x6'),attributes,{'tableName':_0x2664('0x7'),'paranoid':![],'indexes':[{'fields':[_0x2664('0x8')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x0ce9=['../../config/logger','api','moment','request-promise','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x0ce9,0x9a));var _0x90ce=function(_0x5cf269,_0x132cc9){_0x5cf269=_0x5cf269-0x0;var _0x47a098=_0x0ce9[_0x5cf269];return _0x47a098;};'use strict';var _=require(_0x90ce('0x0'));var util=require(_0x90ce('0x1'));var logger=require(_0x90ce('0x2'))(_0x90ce('0x3'));var moment=require(_0x90ce('0x4'));var BPromise=require('bluebird');var rp=require(_0x90ce('0x5'));var attributes=require(_0x90ce('0x6'));module[_0x90ce('0x7')]=function(_0x595446,_0x19202a){return _0x595446[_0x90ce('0x8')](_0x90ce('0x9'),attributes,{'tableName':_0x90ce('0xa'),'paranoid':![],'indexes':[{'fields':[_0x90ce('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
index d4853aa..66be20e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x59ce=['update','where','attributes','limit','UpdateVoiceDialReport','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceDialReport','create','body','options','raw','VoiceDialReport'];(function(_0xc7ade3,_0x1e46c3){var _0x198d52=function(_0x17085e){while(--_0x17085e){_0xc7ade3['push'](_0xc7ade3['shift']());}};_0x198d52(++_0x1e46c3);}(_0x59ce,0x92));var _0xe59c=function(_0x1f8b8b,_0x51a891){_0x1f8b8b=_0x1f8b8b-0x0;var _0x2aaa1e=_0x59ce[_0x1f8b8b];return _0x2aaa1e;};'use strict';var _=require(_0xe59c('0x0'));var util=require(_0xe59c('0x1'));var moment=require(_0xe59c('0x2'));var BPromise=require('bluebird');var rs=require(_0xe59c('0x3'));var fs=require('fs');var Redis=require(_0xe59c('0x4'));var db=require(_0xe59c('0x5'))['db'];var utils=require(_0xe59c('0x6'));var logger=require(_0xe59c('0x7'))(_0xe59c('0x8'));var config=require(_0xe59c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe59c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x534601,_0x4f07e9,_0x2c1d11){return new BPromise(function(_0x101a79,_0x206753){return client[_0xe59c('0xb')](_0x534601,_0x2c1d11)[_0xe59c('0xc')](function(_0x3981be){logger[_0xe59c('0xd')](_0xe59c('0xe'),_0x4f07e9,_0xe59c('0xf'));logger[_0xe59c('0x10')](_0xe59c('0x11'),_0x4f07e9,_0xe59c('0xf'),JSON[_0xe59c('0x12')](_0x3981be));if(_0x3981be[_0xe59c('0x13')]){if(_0x3981be[_0xe59c('0x13')][_0xe59c('0x14')]===0x1f4){logger[_0xe59c('0x13')](_0xe59c('0xe'),_0x4f07e9,_0x3981be['error'][_0xe59c('0x15')]);return _0x206753(_0x3981be[_0xe59c('0x13')][_0xe59c('0x15')]);}logger[_0xe59c('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x4f07e9,_0x3981be['error'][_0xe59c('0x15')]);return _0x101a79(_0x3981be[_0xe59c('0x13')][_0xe59c('0x15')]);}else{logger[_0xe59c('0xd')](_0xe59c('0xe'),_0x4f07e9,'request\x20sent');_0x101a79(_0x3981be[_0xe59c('0x16')]['message']);}})['catch'](function(_0xee38fc){logger[_0xe59c('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x4f07e9,_0xee38fc);_0x206753(_0xee38fc);});});}exports[_0xe59c('0x17')]=function(_0x38f4b0){var _0x32bfd7=this;return new Promise(function(_0x529c0d,_0xe9f0a1){return db['VoiceDialReport'][_0xe59c('0x18')](_0x38f4b0[_0xe59c('0x19')],{'raw':_0x38f4b0[_0xe59c('0x1a')]?_0x38f4b0['options'][_0xe59c('0x1b')]===undefined?!![]:![]:!![]})[_0xe59c('0xc')](function(_0x28a8da){logger[_0xe59c('0xd')](_0xe59c('0x17'),_0x38f4b0);logger[_0xe59c('0x10')](_0xe59c('0x17'),_0x38f4b0,JSON[_0xe59c('0x12')](_0x28a8da));_0x529c0d(_0x28a8da);})['catch'](function(_0x1c9170){logger[_0xe59c('0x13')](_0xe59c('0x17'),_0x1c9170[_0xe59c('0x15')],_0x38f4b0);_0xe9f0a1(_0x32bfd7[_0xe59c('0x13')](0x1f4,_0x1c9170[_0xe59c('0x15')]));});});};exports['UpdateVoiceDialReport']=function(_0x4d3605){var _0x1f9766=this;return new Promise(function(_0x923e8a,_0x481c52){return db[_0xe59c('0x1c')][_0xe59c('0x1d')](_0x4d3605['body'],{'raw':_0x4d3605['options']?_0x4d3605[_0xe59c('0x1a')][_0xe59c('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d3605[_0xe59c('0x1a')]?_0x4d3605[_0xe59c('0x1a')][_0xe59c('0x1e')]||null:null,'attributes':_0x4d3605[_0xe59c('0x1a')]?_0x4d3605[_0xe59c('0x1a')][_0xe59c('0x1f')]||null:null,'limit':_0x4d3605[_0xe59c('0x1a')]?_0x4d3605[_0xe59c('0x1a')][_0xe59c('0x20')]||null:null})[_0xe59c('0xc')](function(_0x2f844a){logger['info'](_0xe59c('0x21'),_0x4d3605);logger[_0xe59c('0x10')](_0xe59c('0x21'),_0x4d3605,JSON[_0xe59c('0x12')](_0x2f844a));_0x923e8a(_0x2f844a);})[_0xe59c('0x22')](function(_0x480ed9){logger[_0xe59c('0x13')](_0xe59c('0x21'),_0x480ed9[_0xe59c('0x15')],_0x4d3605);_0x481c52(_0x1f9766[_0xe59c('0x13')](0x1f4,_0x480ed9['message']));});});};
\ No newline at end of file
+var _0x0ef0=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceDialReport','create','body','options','raw','CreateVoiceDialReport','debug','UpdateVoiceDialReport','update','where','limit','catch','lodash','util','bluebird','randomstring'];(function(_0x19f5fc,_0x4c658a){var _0x315fa3=function(_0x2198b5){while(--_0x2198b5){_0x19f5fc['push'](_0x19f5fc['shift']());}};_0x315fa3(++_0x4c658a);}(_0x0ef0,0x80));var _0x00ef=function(_0x2f379a,_0x53382d){_0x2f379a=_0x2f379a-0x0;var _0x305249=_0x0ef0[_0x2f379a];return _0x305249;};'use strict';var _=require(_0x00ef('0x0'));var util=require(_0x00ef('0x1'));var moment=require('moment');var BPromise=require(_0x00ef('0x2'));var rs=require(_0x00ef('0x3'));var fs=require('fs');var Redis=require(_0x00ef('0x4'));var db=require(_0x00ef('0x5'))['db'];var utils=require(_0x00ef('0x6'));var logger=require(_0x00ef('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x00ef('0x8'));var client=jayson[_0x00ef('0x9')][_0x00ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19321c,_0x50cbde,_0x303c49){return new BPromise(function(_0x3dd5cd,_0x2ee1a6){return client[_0x00ef('0xb')](_0x19321c,_0x303c49)[_0x00ef('0xc')](function(_0x4984c2){logger[_0x00ef('0xd')](_0x00ef('0xe'),_0x50cbde,_0x00ef('0xf'));logger['debug'](_0x00ef('0x10'),_0x50cbde,'request\x20sent',JSON[_0x00ef('0x11')](_0x4984c2));if(_0x4984c2[_0x00ef('0x12')]){if(_0x4984c2[_0x00ef('0x12')][_0x00ef('0x13')]===0x1f4){logger[_0x00ef('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x50cbde,_0x4984c2[_0x00ef('0x12')]['message']);return _0x2ee1a6(_0x4984c2[_0x00ef('0x12')][_0x00ef('0x14')]);}logger[_0x00ef('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x50cbde,_0x4984c2[_0x00ef('0x12')]['message']);return _0x3dd5cd(_0x4984c2['error'][_0x00ef('0x14')]);}else{logger[_0x00ef('0xd')](_0x00ef('0xe'),_0x50cbde,_0x00ef('0xf'));_0x3dd5cd(_0x4984c2['result'][_0x00ef('0x14')]);}})['catch'](function(_0xbd149a){logger[_0x00ef('0x12')](_0x00ef('0xe'),_0x50cbde,_0xbd149a);_0x2ee1a6(_0xbd149a);});});}exports['CreateVoiceDialReport']=function(_0x415642){var _0x213169=this;return new Promise(function(_0x3956e4,_0x18fe67){return db[_0x00ef('0x15')][_0x00ef('0x16')](_0x415642[_0x00ef('0x17')],{'raw':_0x415642['options']?_0x415642[_0x00ef('0x18')][_0x00ef('0x19')]===undefined?!![]:![]:!![]})[_0x00ef('0xc')](function(_0x25349d){logger[_0x00ef('0xd')](_0x00ef('0x1a'),_0x415642);logger[_0x00ef('0x1b')](_0x00ef('0x1a'),_0x415642,JSON[_0x00ef('0x11')](_0x25349d));_0x3956e4(_0x25349d);})['catch'](function(_0x369db9){logger[_0x00ef('0x12')](_0x00ef('0x1a'),_0x369db9[_0x00ef('0x14')],_0x415642);_0x18fe67(_0x213169[_0x00ef('0x12')](0x1f4,_0x369db9[_0x00ef('0x14')]));});});};exports[_0x00ef('0x1c')]=function(_0x6d76aa){var _0x3e505c=this;return new Promise(function(_0x3da674,_0x39a31f){return db['VoiceDialReport'][_0x00ef('0x1d')](_0x6d76aa[_0x00ef('0x17')],{'raw':_0x6d76aa[_0x00ef('0x18')]?_0x6d76aa[_0x00ef('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6d76aa['options']?_0x6d76aa[_0x00ef('0x18')][_0x00ef('0x1e')]||null:null,'attributes':_0x6d76aa[_0x00ef('0x18')]?_0x6d76aa[_0x00ef('0x18')]['attributes']||null:null,'limit':_0x6d76aa[_0x00ef('0x18')]?_0x6d76aa['options'][_0x00ef('0x1f')]||null:null})[_0x00ef('0xc')](function(_0xe3a215){logger['info'](_0x00ef('0x1c'),_0x6d76aa);logger[_0x00ef('0x1b')](_0x00ef('0x1c'),_0x6d76aa,JSON[_0x00ef('0x11')](_0xe3a215));_0x3da674(_0xe3a215);})[_0x00ef('0x20')](function(_0x286e98){logger['error'](_0x00ef('0x1c'),_0x286e98[_0x00ef('0x14')],_0x6d76aa);_0x39a31f(_0x3e505c[_0x00ef('0x12')](0x1f4,_0x286e98['message']));});});};
\ No newline at end of file
index 3c2f6e3..5b38954 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x317b=['util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','post','/:id/applications','addApplications','put','update','delete','exports','multer'];(function(_0x6bbb11,_0x44e6b5){var _0x4c4dc3=function(_0x1307e8){while(--_0x1307e8){_0x6bbb11['push'](_0x6bbb11['shift']());}};_0x4c4dc3(++_0x44e6b5);}(_0x317b,0x1c7));var _0xb317=function(_0x569bc2,_0x23539e){_0x569bc2=_0x569bc2-0x0;var _0x4013fa=_0x317b[_0x569bc2];return _0x4013fa;};'use strict';var multer=require(_0xb317('0x0'));var util=require(_0xb317('0x1'));var path=require('path');var timeout=require(_0xb317('0x2'));var express=require(_0xb317('0x3'));var router=express['Router']();var auth=require(_0xb317('0x4'));var interaction=require(_0xb317('0x5'));var config=require(_0xb317('0x6'));var controller=require(_0xb317('0x7'));router[_0xb317('0x8')]('/',auth[_0xb317('0x9')](),controller[_0xb317('0xa')]);router[_0xb317('0x8')](_0xb317('0xb'),auth[_0xb317('0x9')](),controller['show']);router[_0xb317('0xc')]('/',auth[_0xb317('0x9')](),controller['create']);router[_0xb317('0xc')](_0xb317('0xd'),auth[_0xb317('0x9')](),controller[_0xb317('0xe')]);router[_0xb317('0xf')](_0xb317('0xb'),auth['isAuthenticated'](),controller[_0xb317('0x10')]);router[_0xb317('0x11')]('/:id',auth[_0xb317('0x9')](),controller['destroy']);module[_0xb317('0x12')]=router;
\ No newline at end of file
+var _0x1472=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','post','create','/:id/applications','put','/:id','update','delete','exports','multer','util','path'];(function(_0x2f2acb,_0x5ed1a2){var _0xeaff55=function(_0x4e7bb1){while(--_0x4e7bb1){_0x2f2acb['push'](_0x2f2acb['shift']());}};_0xeaff55(++_0x5ed1a2);}(_0x1472,0x166));var _0x2147=function(_0x53d0f2,_0x461fff){_0x53d0f2=_0x53d0f2-0x0;var _0x4039fe=_0x1472[_0x53d0f2];return _0x4039fe;};'use strict';var multer=require(_0x2147('0x0'));var util=require(_0x2147('0x1'));var path=require(_0x2147('0x2'));var timeout=require(_0x2147('0x3'));var express=require(_0x2147('0x4'));var router=express[_0x2147('0x5')]();var auth=require(_0x2147('0x6'));var interaction=require(_0x2147('0x7'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router[_0x2147('0x8')]('/',auth[_0x2147('0x9')](),controller[_0x2147('0xa')]);router['get']('/:id',auth[_0x2147('0x9')](),controller['show']);router[_0x2147('0xb')]('/',auth[_0x2147('0x9')](),controller[_0x2147('0xc')]);router['post'](_0x2147('0xd'),auth[_0x2147('0x9')](),controller['addApplications']);router[_0x2147('0xe')](_0x2147('0xf'),auth[_0x2147('0x9')](),controller[_0x2147('0x10')]);router[_0x2147('0x11')]('/:id',auth[_0x2147('0x9')](),controller['destroy']);module[_0x2147('0x12')]=router;
\ No newline at end of file
index 143d3d2..41a7250 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x91a7=['*,*,*,*','BOOLEAN','INTEGER','wav','VIRTUAL','exten','exports','STRING','compositeIndex','NoOp','inbound','internal','inbound-fax','system','any'];(function(_0x3a0919,_0x204aa6){var _0x147278=function(_0x1e7de9){while(--_0x1e7de9){_0x3a0919['push'](_0x3a0919['shift']());}};_0x147278(++_0x204aa6);}(_0x91a7,0xe7));var _0x791a=function(_0x480b88,_0x436bb4){_0x480b88=_0x480b88-0x0;var _0x4e4f60=_0x91a7[_0x480b88];return _0x4e4f60;};'use strict';var Sequelize=require('sequelize');module[_0x791a('0x0')]={'context':{'type':Sequelize[_0x791a('0x1')],'allowNull':![],'unique':_0x791a('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x791a('0x2')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x791a('0x2')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x791a('0x3')},'appdata':{'type':Sequelize[_0x791a('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x791a('0x4'),'outbound',_0x791a('0x5'),_0x791a('0x6'),'outbound-fax',_0x791a('0x7'),_0x791a('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0x791a('0x1')]},'interval':{'type':Sequelize[_0x791a('0x1')],'allowNull':![],'defaultValue':_0x791a('0x9')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x791a('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x791a('0x1')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x791a('0xa')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x791a('0xb')]},'recordingFormat':{'type':Sequelize[_0x791a('0x1')],'defaultValue':_0x791a('0xc')},'answer':{'type':Sequelize[_0x791a('0xa')],'defaultValue':!![]},'name':{'type':Sequelize[_0x791a('0xd')],'get':function(_0x53dc41){return this['getDataValue'](_0x791a('0xe'));}}};
\ No newline at end of file
+var _0xb43b=['VIRTUAL','exten','sequelize','exports','compositeIndex','STRING','NoOp','inbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','BOOLEAN','INTEGER'];(function(_0x540133,_0x41783f){var _0x26b6e9=function(_0x10ebe3){while(--_0x10ebe3){_0x540133['push'](_0x540133['shift']());}};_0x26b6e9(++_0x41783f);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2405fe,_0xbd8bab){_0x2405fe=_0x2405fe-0x0;var _0x593a96=_0xb43b[_0x2405fe];return _0x593a96;};'use strict';var Sequelize=require(_0xbb43('0x0'));module[_0xbb43('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xbb43('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xbb43('0x3')],'allowNull':![],'unique':_0xbb43('0x2')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0xbb43('0x2')},'tag':{'type':Sequelize[_0xbb43('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xbb43('0x3')],'allowNull':![],'defaultValue':_0xbb43('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0xbb43('0x5'),'outbound',_0xbb43('0x6'),_0xbb43('0x7'),_0xbb43('0x8'),_0xbb43('0x9'),_0xbb43('0xa')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xbb43('0x3')],'allowNull':![],'defaultValue':_0xbb43('0xb')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xbb43('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xbb43('0x3')],'defaultValue':null},'callerID':{'type':Sequelize[_0xbb43('0x3')],'allowNull':!![]},'record':{'type':Sequelize[_0xbb43('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xbb43('0xd')]},'recordingFormat':{'type':Sequelize[_0xbb43('0x3')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xbb43('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0xbb43('0xe')],'get':function(_0x50e2c0){return this['getDataValue'](_0xbb43('0xf'));}}};
\ No newline at end of file
index d5a6b5d..33e89f2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9417=['reject','save','update','then','destroy','InboundRoutes','inbound','InternalRoutes','internal','filter','ignore','value','includes','type','find','name','UserProfileResource','error','send','index','VoiceExtension','rawAttributes','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','map','VIRTUAL','field','count','includeAll','include','findAll','rows','catch','show','params','options','body','outbound','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','description','recordingFormat','mandatoryDisposition','context','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','set','apply'];(function(_0x54e229,_0x5cffa3){var _0x2ecee3=function(_0x5774ce){while(--_0x5774ce){_0x54e229['push'](_0x54e229['shift']());}};_0x2ecee3(++_0x5cffa3);}(_0x9417,0xb4));var _0x7941=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x9417[_0x4565bf];return _0x5610ba;};'use strict';var pdf=require(_0x7941('0x0'));var emlformat=require(_0x7941('0x1'));var rimraf=require(_0x7941('0x2'));var zipdir=require(_0x7941('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7941('0x4'));var moment=require(_0x7941('0x5'));var BPromise=require(_0x7941('0x6'));var Mustache=require(_0x7941('0x7'));var util=require(_0x7941('0x8'));var path=require(_0x7941('0x9'));var sox=require(_0x7941('0xa'));var csv=require(_0x7941('0xb'));var ejs=require(_0x7941('0xc'));var fs=require('fs');var _=require(_0x7941('0xd'));var squel=require('squel');var crypto=require(_0x7941('0xe'));var jsforce=require(_0x7941('0xf'));var deskjs=require(_0x7941('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7941('0x11'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0x7941('0x12'));var Redis=require(_0x7941('0x13'));var qs=require(_0x7941('0x14'));var logger=require(_0x7941('0x15'))(_0x7941('0x16'));var utils=require(_0x7941('0x17'));var config=require(_0x7941('0x18'));var db=require(_0x7941('0x19'))['db'];config['redis']=_[_0x7941('0x1a')](config['redis'],{'host':_0x7941('0x1b'),'port':0x18eb});var socket=require(_0x7941('0x1c'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0x7941('0x1d')](socket);function respondWithStatusCode(_0x59f371,_0x18936d){_0x18936d=_0x18936d||0xcc;return function(_0x45c08f){if(_0x45c08f){return _0x59f371[_0x7941('0x1e')](_0x18936d);}return _0x59f371[_0x7941('0x1f')](_0x18936d)[_0x7941('0x20')]();};}function respondWithResult(_0x41b098,_0x55320b){_0x55320b=_0x55320b||0xc8;return function(_0x11623c){if(_0x11623c){return _0x41b098[_0x7941('0x1f')](_0x55320b)[_0x7941('0x21')](_0x11623c);}};}function respondWithFilteredResult(_0x22dc49,_0x37af11){return function(_0x256f45){if(_0x256f45){var _0x4172a7=_0x256f45['count'],_0x573b44=_0x37af11[_0x7941('0x22')],_0x2941e1=_0x37af11['offset']+_0x37af11[_0x7941('0x23')],_0x533559;if(_0x2941e1>=_0x4172a7){_0x2941e1=_0x4172a7;_0x533559=0xc8;}else{_0x533559=0xce;}_0x22dc49[_0x7941('0x1f')](_0x533559);return _0x22dc49[_0x7941('0x24')]('Content-Range',_0x573b44+'-'+_0x2941e1+'/'+_0x4172a7)['json'](_0x256f45);}return null;};}function patchUpdates(_0x645e4c){return function(_0x4d3b28){try{jsonpatch[_0x7941('0x25')](_0x4d3b28,_0x645e4c,!![]);}catch(_0x57809b){return BPromise[_0x7941('0x26')](_0x57809b);}return _0x4d3b28[_0x7941('0x27')]();};}function saveUpdates(_0x42ff1f,_0x45ae78){return function(_0x3c2ae5){if(_0x3c2ae5){return _0x3c2ae5[_0x7941('0x28')](_0x42ff1f)[_0x7941('0x29')](function(_0x5287e0){return _0x5287e0;});}return null;};}function removeEntity(_0x20dd64,_0x531f20){return function(_0x36ff77){if(_0x36ff77){return _0x36ff77[_0x7941('0x2a')]()[_0x7941('0x29')](function(){var _0x1b8a27=_0x36ff77['get']({'plain':!![]});var _0x55f679=[{'name':_0x7941('0x2b'),'value':_0x7941('0x2c'),'ignore':![]},{'name':'OutboundRoutes','value':'outbound','ignore':![]},{'name':_0x7941('0x2d'),'value':_0x7941('0x2e'),'ignore':![]}];var _0x2cf10d=_(_0x55f679)[_0x7941('0x2f')](_0x7941('0x30'))['map'](_0x7941('0x31'))[_0x7941('0x31')]();if(_[_0x7941('0x32')](_0x2cf10d,_0x1b8a27[_0x7941('0x33')])){return;}var _0x23f617=_[_0x7941('0x34')](_0x55f679,[_0x7941('0x31'),_0x1b8a27['type']])[_0x7941('0x35')];return db[_0x7941('0x36')][_0x7941('0x2a')]({'where':{'type':_0x23f617,'resourceId':_0x1b8a27['id']}})['then'](function(){return _0x36ff77;});})[_0x7941('0x29')](function(){_0x20dd64['status'](0xcc)[_0x7941('0x20')]();});}};}function handleEntityNotFound(_0x2856c8,_0x179449){return function(_0x56d577){if(!_0x56d577){_0x2856c8[_0x7941('0x1e')](0x194);}return _0x56d577;};}function handleError(_0x330b0c,_0x5d5c3c){_0x5d5c3c=_0x5d5c3c||0x1f4;return function(_0x372051){logger[_0x7941('0x37')](_0x372051['stack']);if(_0x372051[_0x7941('0x35')]){delete _0x372051[_0x7941('0x35')];}_0x330b0c['status'](_0x5d5c3c)[_0x7941('0x38')](_0x372051);};}exports[_0x7941('0x39')]=function(_0xfbaf95,_0x3592d9){var _0x2a18e2={},_0x442fa2={},_0x42c588={'count':0x0,'rows':[]};var _0x5143ec=db[_0x7941('0x3a')][_0x7941('0x3b')];_0x442fa2['model']=_[_0x7941('0x3c')](_0x5143ec);_0x442fa2[_0x7941('0x3d')]=_[_0x7941('0x3c')](_0xfbaf95[_0x7941('0x3d')]);_0x442fa2[_0x7941('0x3e')]=_[_0x7941('0x3f')](_0x442fa2['model'],_0x442fa2[_0x7941('0x3d')]);_0x2a18e2[_0x7941('0x40')]=_[_0x7941('0x3f')](_0x442fa2[_0x7941('0x41')],qs[_0x7941('0x42')](_0xfbaf95[_0x7941('0x3d')][_0x7941('0x42')]));_0x2a18e2['attributes']=_0x2a18e2[_0x7941('0x40')][_0x7941('0x43')]?_0x2a18e2['attributes']:_0x442fa2['model'];if(!_0xfbaf95[_0x7941('0x3d')][_0x7941('0x44')](_0x7941('0x45'))){_0x2a18e2[_0x7941('0x23')]=qs[_0x7941('0x23')](_0xfbaf95[_0x7941('0x3d')][_0x7941('0x23')]);_0x2a18e2[_0x7941('0x22')]=qs['offset'](_0xfbaf95[_0x7941('0x3d')]['offset']);}_0x2a18e2[_0x7941('0x46')]=qs[_0x7941('0x47')](_0xfbaf95[_0x7941('0x3d')][_0x7941('0x47')]);_0x2a18e2[_0x7941('0x48')]=qs['filters'](_['pick'](_0xfbaf95[_0x7941('0x3d')],_0x442fa2[_0x7941('0x3e')]));if(_0xfbaf95['query']['filter']){_0x2a18e2['where']=_[_0x7941('0x49')](_0x2a18e2['where'],{'$or':_[_0x7941('0x4a')](_0x5143ec,function(_0x1137a5){if(_0x1137a5[_0x7941('0x33')]['key']!==_0x7941('0x4b')){var _0x4c7b04={};_0x4c7b04[_0x1137a5[_0x7941('0x4c')]]={'$like':'%'+_0xfbaf95['query'][_0x7941('0x2f')]+'%'};return _0x4c7b04;}})});}_0x2a18e2=_['merge']({},_0x2a18e2,_0xfbaf95['options']);var _0x42abb7={'where':_0x2a18e2[_0x7941('0x48')]};return db[_0x7941('0x3a')][_0x7941('0x4d')](_0x42abb7)[_0x7941('0x29')](function(_0x1d8b67){_0x42c588[_0x7941('0x4d')]=_0x1d8b67;if(_0xfbaf95[_0x7941('0x3d')][_0x7941('0x4e')]){_0x2a18e2[_0x7941('0x4f')]=[{'all':!![]}];}return db[_0x7941('0x3a')][_0x7941('0x50')](_0x2a18e2);})[_0x7941('0x29')](function(_0x5ec111){_0x42c588[_0x7941('0x51')]=_0x5ec111;return _0x42c588;})[_0x7941('0x29')](respondWithFilteredResult(_0x3592d9,_0x2a18e2))[_0x7941('0x52')](handleError(_0x3592d9,null));};exports[_0x7941('0x53')]=function(_0x2849f7,_0x52d54f){var _0x5eff6a={'raw':![],'where':{'id':_0x2849f7[_0x7941('0x54')]['id']}},_0x53cd59={};_0x53cd59[_0x7941('0x41')]=_['keys'](db[_0x7941('0x3a')][_0x7941('0x3b')]);_0x53cd59[_0x7941('0x3d')]=_['keys'](_0x2849f7[_0x7941('0x3d')]);_0x53cd59[_0x7941('0x3e')]=_[_0x7941('0x3f')](_0x53cd59[_0x7941('0x41')],_0x53cd59[_0x7941('0x3d')]);_0x5eff6a['attributes']=_[_0x7941('0x3f')](_0x53cd59[_0x7941('0x41')],qs['fields'](_0x2849f7['query'][_0x7941('0x42')]));_0x5eff6a[_0x7941('0x40')]=_0x5eff6a['attributes'][_0x7941('0x43')]?_0x5eff6a[_0x7941('0x40')]:_0x53cd59[_0x7941('0x41')];if(_0x2849f7[_0x7941('0x3d')][_0x7941('0x4e')]){_0x5eff6a[_0x7941('0x4f')]=[{'all':!![]}];}_0x5eff6a=_[_0x7941('0x49')]({},_0x5eff6a,_0x2849f7[_0x7941('0x55')]);return db[_0x7941('0x3a')]['find'](_0x5eff6a)[_0x7941('0x29')](handleEntityNotFound(_0x52d54f,null))['then'](respondWithResult(_0x52d54f,null))[_0x7941('0x52')](handleError(_0x52d54f,null));};exports[_0x7941('0x2a')]=function(_0x29df60,_0x18e14b){return db[_0x7941('0x3a')][_0x7941('0x34')]({'where':{'id':_0x29df60['params']['id']}})[_0x7941('0x29')](handleEntityNotFound(_0x18e14b,null))[_0x7941('0x29')](removeEntity(_0x18e14b,null))[_0x7941('0x52')](handleError(_0x18e14b,null));};exports['create']=function(_0x2b9301,_0x66d3b4){if(_0x2b9301[_0x7941('0x56')][_0x7941('0x33')]===_0x7941('0x57')&&!_[_0x7941('0x58')](_0x2b9301[_0x7941('0x56')][_0x7941('0x59')],'_')){_0x2b9301[_0x7941('0x56')][_0x7941('0x59')]='_'[_0x7941('0x5a')](_0x2b9301['body'][_0x7941('0x59')]);}return db['VoiceExtension']['create'](_0x2b9301[_0x7941('0x56')],{'raw':![]})[_0x7941('0x29')](function(_0x529fbf){var _0x241e6d=_0x2b9301[_0x7941('0x5b')]['get']({'plain':!![]});if(!_0x241e6d)throw new Error(_0x7941('0x5c'));if(_0x241e6d['role']==='user'){var _0x388c08=_0x529fbf[_0x7941('0x5d')]({'plain':!![]});var _0x9177c4=[{'name':_0x7941('0x2b'),'value':_0x7941('0x2c')},{'name':'OutboundRoutes','value':_0x7941('0x57')},{'name':'InternalRoutes','value':_0x7941('0x2e')}];var _0xa0d635=_[_0x7941('0x34')](_0x9177c4,[_0x7941('0x31'),_0x388c08[_0x7941('0x33')]])[_0x7941('0x35')];return db[_0x7941('0x5e')][_0x7941('0x34')]({'where':{'name':_0xa0d635,'userProfileId':_0x241e6d[_0x7941('0x5f')]},'raw':!![]})[_0x7941('0x29')](function(_0x84fdc7){if(_0x84fdc7&&_0x84fdc7['autoAssociation']===0x0){return db[_0x7941('0x36')]['create']({'name':_0x388c08[_0x7941('0x35')],'resourceId':_0x388c08['id'],'type':_0x84fdc7[_0x7941('0x35')],'sectionId':_0x84fdc7['id']},{})[_0x7941('0x29')](function(){return _0x529fbf;});}else{return _0x529fbf;}})[_0x7941('0x52')](function(_0x4c3f32){logger[_0x7941('0x37')](_0x7941('0x60'),_0x4c3f32);throw _0x4c3f32;});}return _0x529fbf;})[_0x7941('0x29')](respondWithResult(_0x66d3b4,0xc9))[_0x7941('0x52')](handleError(_0x66d3b4,null));};exports[_0x7941('0x28')]=function(_0x2a3086,_0x118f02){if(_0x2a3086[_0x7941('0x56')]['id']){delete _0x2a3086[_0x7941('0x56')]['id'];}return db[_0x7941('0x3a')][_0x7941('0x34')]({'where':{'id':_0x2a3086[_0x7941('0x54')]['id']}})['then'](handleEntityNotFound(_0x118f02,null))[_0x7941('0x29')](function(_0x1d9444){if(_0x1d9444){return db[_0x7941('0x3a')][_0x7941('0x28')](_[_0x7941('0x61')](_0x2a3086[_0x7941('0x56')],[_0x7941('0x59'),'context',_0x7941('0x62'),_0x7941('0x63'),'cutdigits',_0x7941('0x64')]),{'where':{'context':_0x1d9444[_0x7941('0x65')],'exten':_0x1d9444[_0x7941('0x59')]},'individualHooks':!![]})[_0x7941('0x29')](function(_0x2fd43a){return _0x2fd43a;});}return null;})[_0x7941('0x29')](respondWithStatusCode(_0x118f02,null))['catch'](handleError(_0x118f02,null));};exports['addApplications']=function(_0x63318e,_0x21e31,_0x88523d){return db[_0x7941('0x3a')][_0x7941('0x66')]({'where':{'id':_0x63318e['params']['id']}})[_0x7941('0x29')](handleEntityNotFound(_0x21e31,null))[_0x7941('0x29')](function(_0x34e822){if(_0x34e822){return db[_0x7941('0x67')][_0x7941('0x68')](function(_0x1d6dd3){return db[_0x7941('0x3a')]['destroy']({'where':{'VoiceExtensionId':_0x63318e[_0x7941('0x54')]['id']},'transaction':_0x1d6dd3})[_0x7941('0x29')](function(_0x48705d){var _0x27deaf=_[_0x7941('0x4a')](_0x63318e[_0x7941('0x56')],function(_0x3dfd74){_0x3dfd74[_0x7941('0x69')]=_0x63318e[_0x7941('0x54')]['id'];return _0x3dfd74;});return db[_0x7941('0x3a')][_0x7941('0x6a')](_0x27deaf,{'transaction':_0x1d6dd3});});})[_0x7941('0x29')](function(){return db['VoiceExtension'][_0x7941('0x6b')]({'where':{'isApp':!![],'VoiceExtensionId':_0x63318e[_0x7941('0x54')]['id']},'order':_0x7941('0x6c')});});}})[_0x7941('0x29')](respondWithResult(_0x21e31,null))['catch'](handleError(_0x21e31,null));};
\ No newline at end of file
+var _0x13fe=['bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','../../config/license/hardware','ioredis','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','inbound','OutboundRoutes','internal','filter','ignore','map','value','find','type','name','UserProfileResource','destroy','sendStatus','error','send','VoiceExtension','rawAttributes','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','key','VIRTUAL','field','includeAll','include','findAll','params','length','options','catch','create','body','startsWith','exten','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','outbound','InternalRoutes','UserProfileSection','userProfileId','context','description','recordingFormat','cutdigits','addApplications','findOne','sequelize','transaction'];(function(_0xed4cd,_0x56a29f){var _0x2ac557=function(_0x1419b8){while(--_0x1419b8){_0xed4cd['push'](_0xed4cd['shift']());}};_0x2ac557(++_0x56a29f);}(_0x13fe,0x138));var _0xe13f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x13fe[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0xe13f('0x0'));var emlformat=require(_0xe13f('0x1'));var rimraf=require(_0xe13f('0x2'));var zipdir=require(_0xe13f('0x3'));var jsonpatch=require(_0xe13f('0x4'));var rp=require(_0xe13f('0x5'));var moment=require('moment');var BPromise=require(_0xe13f('0x6'));var Mustache=require(_0xe13f('0x7'));var util=require(_0xe13f('0x8'));var path=require(_0xe13f('0x9'));var sox=require(_0xe13f('0xa'));var csv=require(_0xe13f('0xb'));var ejs=require(_0xe13f('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe13f('0xd'));var jsforce=require(_0xe13f('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe13f('0xf'));var Papa=require(_0xe13f('0x10'));var authService=require('../../components/auth/service');var hardwareService=require(_0xe13f('0x11'));var Redis=require(_0xe13f('0x12'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xe13f('0x13'));var utils=require(_0xe13f('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xe13f('0x15')]=_[_0xe13f('0x16')](config[_0xe13f('0x15')],{'host':_0xe13f('0x17'),'port':0x18eb});var socket=require(_0xe13f('0x18'))(new Redis(config['redis']));require(_0xe13f('0x19'))[_0xe13f('0x1a')](socket);function respondWithStatusCode(_0x571787,_0x69222){_0x69222=_0x69222||0xcc;return function(_0x1bdde1){if(_0x1bdde1){return _0x571787['sendStatus'](_0x69222);}return _0x571787[_0xe13f('0x1b')](_0x69222)[_0xe13f('0x1c')]();};}function respondWithResult(_0x2f1f4f,_0x474730){_0x474730=_0x474730||0xc8;return function(_0x398c2e){if(_0x398c2e){return _0x2f1f4f[_0xe13f('0x1b')](_0x474730)['json'](_0x398c2e);}};}function respondWithFilteredResult(_0x1ae44a,_0x5afd47){return function(_0x11d180){if(_0x11d180){var _0x4b5697=_0x11d180[_0xe13f('0x1d')],_0x28770d=_0x5afd47[_0xe13f('0x1e')],_0x5b01d7=_0x5afd47[_0xe13f('0x1e')]+_0x5afd47[_0xe13f('0x1f')],_0x39852b;if(_0x5b01d7>=_0x4b5697){_0x5b01d7=_0x4b5697;_0x39852b=0xc8;}else{_0x39852b=0xce;}_0x1ae44a[_0xe13f('0x1b')](_0x39852b);return _0x1ae44a[_0xe13f('0x20')](_0xe13f('0x21'),_0x28770d+'-'+_0x5b01d7+'/'+_0x4b5697)['json'](_0x11d180);}return null;};}function patchUpdates(_0x48ea63){return function(_0x1519e4){try{jsonpatch[_0xe13f('0x22')](_0x1519e4,_0x48ea63,!![]);}catch(_0x3ebf70){return BPromise[_0xe13f('0x23')](_0x3ebf70);}return _0x1519e4[_0xe13f('0x24')]();};}function saveUpdates(_0x612555,_0x199590){return function(_0x5c93da){if(_0x5c93da){return _0x5c93da[_0xe13f('0x25')](_0x612555)[_0xe13f('0x26')](function(_0x17ef1b){return _0x17ef1b;});}return null;};}function removeEntity(_0x45f6a2,_0x415adf){return function(_0x2ce943){if(_0x2ce943){return _0x2ce943['destroy']()[_0xe13f('0x26')](function(){var _0x46da38=_0x2ce943[_0xe13f('0x27')]({'plain':!![]});var _0x37eff0=[{'name':'InboundRoutes','value':_0xe13f('0x28'),'ignore':![]},{'name':_0xe13f('0x29'),'value':'outbound','ignore':![]},{'name':'InternalRoutes','value':_0xe13f('0x2a'),'ignore':![]}];var _0x2ae303=_(_0x37eff0)[_0xe13f('0x2b')](_0xe13f('0x2c'))[_0xe13f('0x2d')](_0xe13f('0x2e'))['value']();if(_['includes'](_0x2ae303,_0x46da38['type'])){return;}var _0x1404d0=_[_0xe13f('0x2f')](_0x37eff0,[_0xe13f('0x2e'),_0x46da38[_0xe13f('0x30')]])[_0xe13f('0x31')];return db[_0xe13f('0x32')][_0xe13f('0x33')]({'where':{'type':_0x1404d0,'resourceId':_0x46da38['id']}})[_0xe13f('0x26')](function(){return _0x2ce943;});})[_0xe13f('0x26')](function(){_0x45f6a2[_0xe13f('0x1b')](0xcc)[_0xe13f('0x1c')]();});}};}function handleEntityNotFound(_0x58abe7,_0x3f9cf9){return function(_0x414358){if(!_0x414358){_0x58abe7[_0xe13f('0x34')](0x194);}return _0x414358;};}function handleError(_0x52e8a2,_0x4c4547){_0x4c4547=_0x4c4547||0x1f4;return function(_0xeb4abf){logger[_0xe13f('0x35')](_0xeb4abf['stack']);if(_0xeb4abf['name']){delete _0xeb4abf[_0xe13f('0x31')];}_0x52e8a2[_0xe13f('0x1b')](_0x4c4547)[_0xe13f('0x36')](_0xeb4abf);};}exports['index']=function(_0xa632cf,_0x169e04){var _0x430557={},_0x379c04={},_0x3eb4cc={'count':0x0,'rows':[]};var _0x434dcb=db[_0xe13f('0x37')][_0xe13f('0x38')];_0x379c04['model']=_['keys'](_0x434dcb);_0x379c04[_0xe13f('0x39')]=_[_0xe13f('0x3a')](_0xa632cf['query']);_0x379c04[_0xe13f('0x3b')]=_[_0xe13f('0x3c')](_0x379c04[_0xe13f('0x3d')],_0x379c04[_0xe13f('0x39')]);_0x430557[_0xe13f('0x3e')]=_[_0xe13f('0x3c')](_0x379c04[_0xe13f('0x3d')],qs['fields'](_0xa632cf['query'][_0xe13f('0x3f')]));_0x430557[_0xe13f('0x3e')]=_0x430557['attributes']['length']?_0x430557['attributes']:_0x379c04[_0xe13f('0x3d')];if(!_0xa632cf[_0xe13f('0x39')][_0xe13f('0x40')](_0xe13f('0x41'))){_0x430557[_0xe13f('0x1f')]=qs['limit'](_0xa632cf[_0xe13f('0x39')][_0xe13f('0x1f')]);_0x430557[_0xe13f('0x1e')]=qs[_0xe13f('0x1e')](_0xa632cf[_0xe13f('0x39')]['offset']);}_0x430557[_0xe13f('0x42')]=qs[_0xe13f('0x43')](_0xa632cf[_0xe13f('0x39')][_0xe13f('0x43')]);_0x430557[_0xe13f('0x44')]=qs[_0xe13f('0x3b')](_[_0xe13f('0x45')](_0xa632cf[_0xe13f('0x39')],_0x379c04['filters']));if(_0xa632cf[_0xe13f('0x39')][_0xe13f('0x2b')]){_0x430557[_0xe13f('0x44')]=_[_0xe13f('0x46')](_0x430557[_0xe13f('0x44')],{'$or':_[_0xe13f('0x2d')](_0x434dcb,function(_0x4c3861){if(_0x4c3861[_0xe13f('0x30')][_0xe13f('0x47')]!==_0xe13f('0x48')){var _0x439526={};_0x439526[_0x4c3861[_0xe13f('0x49')]]={'$like':'%'+_0xa632cf[_0xe13f('0x39')][_0xe13f('0x2b')]+'%'};return _0x439526;}})});}_0x430557=_['merge']({},_0x430557,_0xa632cf['options']);var _0x9c90ce={'where':_0x430557[_0xe13f('0x44')]};return db['VoiceExtension']['count'](_0x9c90ce)[_0xe13f('0x26')](function(_0x23bfd0){_0x3eb4cc[_0xe13f('0x1d')]=_0x23bfd0;if(_0xa632cf[_0xe13f('0x39')][_0xe13f('0x4a')]){_0x430557[_0xe13f('0x4b')]=[{'all':!![]}];}return db[_0xe13f('0x37')][_0xe13f('0x4c')](_0x430557);})['then'](function(_0x363539){_0x3eb4cc['rows']=_0x363539;return _0x3eb4cc;})[_0xe13f('0x26')](respondWithFilteredResult(_0x169e04,_0x430557))['catch'](handleError(_0x169e04,null));};exports['show']=function(_0x469907,_0x35545b){var _0x57b5c6={'raw':![],'where':{'id':_0x469907[_0xe13f('0x4d')]['id']}},_0x13b350={};_0x13b350[_0xe13f('0x3d')]=_[_0xe13f('0x3a')](db[_0xe13f('0x37')][_0xe13f('0x38')]);_0x13b350['query']=_['keys'](_0x469907[_0xe13f('0x39')]);_0x13b350['filters']=_[_0xe13f('0x3c')](_0x13b350[_0xe13f('0x3d')],_0x13b350['query']);_0x57b5c6[_0xe13f('0x3e')]=_[_0xe13f('0x3c')](_0x13b350[_0xe13f('0x3d')],qs[_0xe13f('0x3f')](_0x469907[_0xe13f('0x39')][_0xe13f('0x3f')]));_0x57b5c6[_0xe13f('0x3e')]=_0x57b5c6[_0xe13f('0x3e')][_0xe13f('0x4e')]?_0x57b5c6[_0xe13f('0x3e')]:_0x13b350['model'];if(_0x469907[_0xe13f('0x39')]['includeAll']){_0x57b5c6[_0xe13f('0x4b')]=[{'all':!![]}];}_0x57b5c6=_[_0xe13f('0x46')]({},_0x57b5c6,_0x469907[_0xe13f('0x4f')]);return db[_0xe13f('0x37')][_0xe13f('0x2f')](_0x57b5c6)[_0xe13f('0x26')](handleEntityNotFound(_0x35545b,null))['then'](respondWithResult(_0x35545b,null))['catch'](handleError(_0x35545b,null));};exports['destroy']=function(_0x501575,_0x365aff){return db[_0xe13f('0x37')][_0xe13f('0x2f')]({'where':{'id':_0x501575[_0xe13f('0x4d')]['id']}})[_0xe13f('0x26')](handleEntityNotFound(_0x365aff,null))[_0xe13f('0x26')](removeEntity(_0x365aff,null))[_0xe13f('0x50')](handleError(_0x365aff,null));};exports[_0xe13f('0x51')]=function(_0x54f378,_0x42e46c){if(_0x54f378[_0xe13f('0x52')][_0xe13f('0x30')]==='outbound'&&!_[_0xe13f('0x53')](_0x54f378[_0xe13f('0x52')][_0xe13f('0x54')],'_')){_0x54f378['body']['exten']='_'['concat'](_0x54f378['body'][_0xe13f('0x54')]);}return db['VoiceExtension'][_0xe13f('0x51')](_0x54f378[_0xe13f('0x52')],{'raw':![]})['then'](function(_0x3a8adf){var _0x1cc755=_0x54f378['user'][_0xe13f('0x27')]({'plain':!![]});if(!_0x1cc755)throw new Error(_0xe13f('0x55'));if(_0x1cc755[_0xe13f('0x56')]==='user'){var _0x3cc74e=_0x3a8adf[_0xe13f('0x27')]({'plain':!![]});var _0x5387cf=[{'name':_0xe13f('0x57'),'value':_0xe13f('0x28')},{'name':_0xe13f('0x29'),'value':_0xe13f('0x58')},{'name':_0xe13f('0x59'),'value':_0xe13f('0x2a')}];var _0x124aaa=_['find'](_0x5387cf,[_0xe13f('0x2e'),_0x3cc74e[_0xe13f('0x30')]])['name'];return db[_0xe13f('0x5a')][_0xe13f('0x2f')]({'where':{'name':_0x124aaa,'userProfileId':_0x1cc755[_0xe13f('0x5b')]},'raw':!![]})['then'](function(_0x5445b2){if(_0x5445b2&&_0x5445b2['autoAssociation']===0x0){return db[_0xe13f('0x32')][_0xe13f('0x51')]({'name':_0x3cc74e['name'],'resourceId':_0x3cc74e['id'],'type':_0x5445b2[_0xe13f('0x31')],'sectionId':_0x5445b2['id']},{})[_0xe13f('0x26')](function(){return _0x3a8adf;});}else{return _0x3a8adf;}})[_0xe13f('0x50')](function(_0x2125cf){logger[_0xe13f('0x35')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2125cf);throw _0x2125cf;});}return _0x3a8adf;})['then'](respondWithResult(_0x42e46c,0xc9))[_0xe13f('0x50')](handleError(_0x42e46c,null));};exports['update']=function(_0x3bd8bc,_0x1db09b){if(_0x3bd8bc['body']['id']){delete _0x3bd8bc['body']['id'];}return db[_0xe13f('0x37')]['find']({'where':{'id':_0x3bd8bc[_0xe13f('0x4d')]['id']}})[_0xe13f('0x26')](handleEntityNotFound(_0x1db09b,null))[_0xe13f('0x26')](function(_0x52e5cb){if(_0x52e5cb){return db['VoiceExtension'][_0xe13f('0x25')](_[_0xe13f('0x45')](_0x3bd8bc[_0xe13f('0x52')],[_0xe13f('0x54'),_0xe13f('0x5c'),_0xe13f('0x5d'),_0xe13f('0x5e'),_0xe13f('0x5f'),'mandatoryDisposition']),{'where':{'context':_0x52e5cb[_0xe13f('0x5c')],'exten':_0x52e5cb[_0xe13f('0x54')]},'individualHooks':!![]})[_0xe13f('0x26')](function(_0x6e498a){return _0x6e498a;});}return null;})[_0xe13f('0x26')](respondWithStatusCode(_0x1db09b,null))[_0xe13f('0x50')](handleError(_0x1db09b,null));};exports[_0xe13f('0x60')]=function(_0x453015,_0x12e317,_0x5d4d1e){return db[_0xe13f('0x37')][_0xe13f('0x61')]({'where':{'id':_0x453015[_0xe13f('0x4d')]['id']}})[_0xe13f('0x26')](handleEntityNotFound(_0x12e317,null))[_0xe13f('0x26')](function(_0x587c95){if(_0x587c95){return db[_0xe13f('0x62')][_0xe13f('0x63')](function(_0x95c903){return db[_0xe13f('0x37')][_0xe13f('0x33')]({'where':{'VoiceExtensionId':_0x453015[_0xe13f('0x4d')]['id']},'transaction':_0x95c903})[_0xe13f('0x26')](function(_0x562449){var _0x36a1a2=_[_0xe13f('0x2d')](_0x453015[_0xe13f('0x52')],function(_0x29df11){_0x29df11['VoiceExtensionId']=_0x453015['params']['id'];return _0x29df11;});return db[_0xe13f('0x37')][_0xe13f('0x64')](_0x36a1a2,{'transaction':_0x95c903});});})[_0xe13f('0x26')](function(){return db[_0xe13f('0x37')][_0xe13f('0x65')]({'where':{'isApp':!![],'VoiceExtensionId':_0x453015[_0xe13f('0x4d')]['id']},'order':_0xe13f('0x66')});});}})[_0xe13f('0x26')](respondWithResult(_0x12e317,null))[_0xe13f('0x50')](handleError(_0x12e317,null));};
\ No newline at end of file
index e5c3b74..992ae7b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbc12=['../../mysqldb','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x8036e9,_0xb2a199){var _0x34a8eb=function(_0xa35740){while(--_0xa35740){_0x8036e9['push'](_0x8036e9['shift']());}};_0x34a8eb(++_0xb2a199);}(_0xbc12,0xa8));var _0x2bc1=function(_0x1d8b9c,_0xc2cdd3){_0x1d8b9c=_0x1d8b9c-0x0;var _0x459bf4=_0xbc12[_0x1d8b9c];return _0x459bf4;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x2bc1('0x0'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x2bc1('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2bc1('0x2'),'afterDestroy':_0x2bc1('0x3')};function emitEvent(_0x106b7e){return function(_0xce613f,_0x5dde78,_0x4e4820){VoiceExtensionEvents[_0x2bc1('0x4')](_0x106b7e+':'+_0xce613f['id'],_0xce613f);VoiceExtensionEvents['emit'](_0x106b7e,_0xce613f);_0x4e4820(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x2bc1('0x5')](e,emitEvent(event));}}module[_0x2bc1('0x6')]=VoiceExtensionEvents;
\ No newline at end of file
+var _0x6ac4=['VoiceExtension','save','update','remove','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x401879,_0x49ee08){var _0x4b0a31=function(_0x5615ea){while(--_0x5615ea){_0x401879['push'](_0x401879['shift']());}};_0x4b0a31(++_0x49ee08);}(_0x6ac4,0x9f));var _0x46ac=function(_0xca5147,_0x54f447){_0xca5147=_0xca5147-0x0;var _0x27bc3c=_0x6ac4[_0xca5147];return _0x27bc3c;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x46ac('0x0'))['db'][_0x46ac('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x46ac('0x2'),'afterUpdate':_0x46ac('0x3'),'afterDestroy':_0x46ac('0x4')};function emitEvent(_0x47a19e){return function(_0x1eb654,_0x5d909f,_0x5d82ba){VoiceExtensionEvents['emit'](_0x47a19e+':'+_0x1eb654['id'],_0x1eb654);VoiceExtensionEvents[_0x46ac('0x5')](_0x47a19e,_0x1eb654);_0x5d82ba(null);};}for(var e in events){if(events[_0x46ac('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x46ac('0x7')]=VoiceExtensionEvents;
\ No newline at end of file
index a316c7d..cfca4c0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7827=['api','moment','bluebird','request-promise','exports','define','voice_extensions','lodash'];(function(_0x179093,_0x4c46b1){var _0x4d573e=function(_0x1ff960){while(--_0x1ff960){_0x179093['push'](_0x179093['shift']());}};_0x4d573e(++_0x4c46b1);}(_0x7827,0x13f));var _0x7782=function(_0x570496,_0x26a150){_0x570496=_0x570496-0x0;var _0x1d4204=_0x7827[_0x570496];return _0x1d4204;};'use strict';var _=require(_0x7782('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7782('0x1'));var moment=require(_0x7782('0x2'));var BPromise=require(_0x7782('0x3'));var rp=require(_0x7782('0x4'));var attributes=require('./voiceExtension.attributes');module[_0x7782('0x5')]=function(_0x1208f1,_0x42162e){return _0x1208f1[_0x7782('0x6')]('VoiceExtension',attributes,{'tableName':_0x7782('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xeaed=['../../config/logger','api','moment','./voiceExtension.attributes','exports','define','VoiceExtension','voice_extensions','lodash','util'];(function(_0x35cfe6,_0x1c73ed){var _0x29782f=function(_0x29ea5a){while(--_0x29ea5a){_0x35cfe6['push'](_0x35cfe6['shift']());}};_0x29782f(++_0x1c73ed);}(_0xeaed,0x1b6));var _0xdeae=function(_0x360884,_0x2d5632){_0x360884=_0x360884-0x0;var _0x182667=_0xeaed[_0x360884];return _0x182667;};'use strict';var _=require(_0xdeae('0x0'));var util=require(_0xdeae('0x1'));var logger=require(_0xdeae('0x2'))(_0xdeae('0x3'));var moment=require(_0xdeae('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xdeae('0x5'));module[_0xdeae('0x6')]=function(_0x25a3b5,_0x203829){return _0x25a3b5[_0xdeae('0x7')](_0xdeae('0x8'),attributes,{'tableName':_0xdeae('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 0edb8c1..0a95b81 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaa88=['where','limit','include','map','model','attributes','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceExtension,\x20%s,\x20%s','catch','GetVoiceExtension','VoiceExtension','findAll','options'];(function(_0x380f24,_0x4ed3f6){var _0x47c8dd=function(_0x4261fc){while(--_0x4261fc){_0x380f24['push'](_0x380f24['shift']());}};_0x47c8dd(++_0x4ed3f6);}(_0xaa88,0x137));var _0x8aa8=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xaa88[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});config['redis']=_[_0x8aa8('0xb')](config[_0x8aa8('0xc')],{'host':_0x8aa8('0xd'),'port':0x18eb});var socket=require(_0x8aa8('0xe'))(new Redis(config['redis']));require(_0x8aa8('0xf'))[_0x8aa8('0x10')](socket);function respondWithRpcPromise(_0x224f25,_0x5c94d4,_0x4702ab){return new BPromise(function(_0x9f78f5,_0x357e05){return client[_0x8aa8('0x11')](_0x224f25,_0x4702ab)['then'](function(_0x3f8100){logger[_0x8aa8('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x5c94d4,_0x8aa8('0x13'));logger[_0x8aa8('0x14')](_0x8aa8('0x15'),_0x5c94d4,'request\x20sent',JSON[_0x8aa8('0x16')](_0x3f8100));if(_0x3f8100[_0x8aa8('0x17')]){if(_0x3f8100[_0x8aa8('0x17')]['code']===0x1f4){logger[_0x8aa8('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x5c94d4,_0x3f8100['error'][_0x8aa8('0x18')]);return _0x357e05(_0x3f8100[_0x8aa8('0x17')][_0x8aa8('0x18')]);}logger[_0x8aa8('0x17')](_0x8aa8('0x19'),_0x5c94d4,_0x3f8100[_0x8aa8('0x17')][_0x8aa8('0x18')]);return _0x9f78f5(_0x3f8100[_0x8aa8('0x17')][_0x8aa8('0x18')]);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x5c94d4,_0x8aa8('0x13'));_0x9f78f5(_0x3f8100['result']['message']);}})[_0x8aa8('0x1a')](function(_0x5ac0d9){logger[_0x8aa8('0x17')](_0x8aa8('0x19'),_0x5c94d4,_0x5ac0d9);_0x357e05(_0x5ac0d9);});});}exports[_0x8aa8('0x1b')]=function(_0x2d5c1b){var _0x502547=this;return new Promise(function(_0xcc2c19,_0x36c445){return db[_0x8aa8('0x1c')][_0x8aa8('0x1d')]({'raw':_0x2d5c1b[_0x8aa8('0x1e')]?_0x2d5c1b[_0x8aa8('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2d5c1b[_0x8aa8('0x1e')]?_0x2d5c1b['options'][_0x8aa8('0x1f')]||null:null,'attributes':_0x2d5c1b['options']?_0x2d5c1b[_0x8aa8('0x1e')]['attributes']||null:null,'limit':_0x2d5c1b[_0x8aa8('0x1e')]?_0x2d5c1b[_0x8aa8('0x1e')][_0x8aa8('0x20')]||null:null,'include':_0x2d5c1b['options']?_0x2d5c1b[_0x8aa8('0x1e')][_0x8aa8('0x21')]?_[_0x8aa8('0x22')](_0x2d5c1b['options']['include'],function(_0x2d1508){return{'model':db[_0x2d1508[_0x8aa8('0x23')]],'as':_0x2d1508['as'],'attributes':_0x2d1508[_0x8aa8('0x24')],'include':_0x2d1508[_0x8aa8('0x21')]?_[_0x8aa8('0x22')](_0x2d1508['include'],function(_0x2bc34a){return{'model':db[_0x2bc34a['model']],'as':_0x2bc34a['as'],'attributes':_0x2bc34a[_0x8aa8('0x24')],'include':_0x2bc34a[_0x8aa8('0x21')]?_[_0x8aa8('0x22')](_0x2bc34a['include'],function(_0x4c5c5c){return{'model':db[_0x4c5c5c[_0x8aa8('0x23')]],'as':_0x4c5c5c['as'],'attributes':_0x4c5c5c['attributes']};}):[]};}):[]};}):[]:[]})[_0x8aa8('0x25')](function(_0x14be8b){logger[_0x8aa8('0x12')](_0x8aa8('0x1b'),_0x2d5c1b);logger[_0x8aa8('0x14')]('GetVoiceExtension',_0x2d5c1b,JSON[_0x8aa8('0x16')](_0x14be8b));_0xcc2c19(_0x14be8b);})[_0x8aa8('0x1a')](function(_0x4b67f5){logger[_0x8aa8('0x17')](_0x8aa8('0x1b'),_0x4b67f5[_0x8aa8('0x18')],_0x2d5c1b);_0x36c445(_0x502547['error'](0x1f4,_0x4b67f5[_0x8aa8('0x18')]));});});};
\ No newline at end of file
+var _0xb43b=['model','map','GetVoiceExtension','debug','stringify','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','register','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','error','message','info','findAll','options','where','attributes','limit','include'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb43b,0x1b2));var _0xbb43=function(_0xcb47b5,_0x4d0601){_0xcb47b5=_0xcb47b5-0x0;var _0x5bf48f=_0xb43b[_0xcb47b5];return _0x5bf48f;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});config['redis']=_[_0xbb43('0xa')](config[_0xbb43('0xb')],{'host':_0xbb43('0xc'),'port':0x18eb});var socket=require(_0xbb43('0xd'))(new Redis(config[_0xbb43('0xb')]));require('./voiceExtension.socket')[_0xbb43('0xe')](socket);function respondWithRpcPromise(_0xf54ac5,_0x5d5b11,_0x7e0fc2){return new BPromise(function(_0x41908c,_0xd37cdf){return client[_0xbb43('0xf')](_0xf54ac5,_0x7e0fc2)[_0xbb43('0x10')](function(_0x2bef86){logger['info'](_0xbb43('0x11'),_0x5d5b11,_0xbb43('0x12'));logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x5d5b11,_0xbb43('0x12'),JSON['stringify'](_0x2bef86));if(_0x2bef86['error']){if(_0x2bef86[_0xbb43('0x13')]['code']===0x1f4){logger[_0xbb43('0x13')](_0xbb43('0x11'),_0x5d5b11,_0x2bef86['error']['message']);return _0xd37cdf(_0x2bef86['error'][_0xbb43('0x14')]);}logger[_0xbb43('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x5d5b11,_0x2bef86['error'][_0xbb43('0x14')]);return _0x41908c(_0x2bef86['error']['message']);}else{logger[_0xbb43('0x15')](_0xbb43('0x11'),_0x5d5b11,_0xbb43('0x12'));_0x41908c(_0x2bef86['result'][_0xbb43('0x14')]);}})['catch'](function(_0x3bb57d){logger[_0xbb43('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x5d5b11,_0x3bb57d);_0xd37cdf(_0x3bb57d);});});}exports['GetVoiceExtension']=function(_0xf8f3ef){var _0x1b6e69=this;return new Promise(function(_0xdb7f2e,_0x2bf2d4){return db['VoiceExtension'][_0xbb43('0x16')]({'raw':_0xf8f3ef['options']?_0xf8f3ef[_0xbb43('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xf8f3ef[_0xbb43('0x17')]?_0xf8f3ef['options'][_0xbb43('0x18')]||null:null,'attributes':_0xf8f3ef[_0xbb43('0x17')]?_0xf8f3ef['options'][_0xbb43('0x19')]||null:null,'limit':_0xf8f3ef['options']?_0xf8f3ef[_0xbb43('0x17')][_0xbb43('0x1a')]||null:null,'include':_0xf8f3ef[_0xbb43('0x17')]?_0xf8f3ef['options']['include']?_['map'](_0xf8f3ef[_0xbb43('0x17')][_0xbb43('0x1b')],function(_0x5d8310){return{'model':db[_0x5d8310[_0xbb43('0x1c')]],'as':_0x5d8310['as'],'attributes':_0x5d8310[_0xbb43('0x19')],'include':_0x5d8310[_0xbb43('0x1b')]?_[_0xbb43('0x1d')](_0x5d8310['include'],function(_0x4b5342){return{'model':db[_0x4b5342[_0xbb43('0x1c')]],'as':_0x4b5342['as'],'attributes':_0x4b5342[_0xbb43('0x19')],'include':_0x4b5342[_0xbb43('0x1b')]?_[_0xbb43('0x1d')](_0x4b5342[_0xbb43('0x1b')],function(_0x40b04b){return{'model':db[_0x40b04b[_0xbb43('0x1c')]],'as':_0x40b04b['as'],'attributes':_0x40b04b[_0xbb43('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ad6da){logger['info'](_0xbb43('0x1e'),_0xf8f3ef);logger[_0xbb43('0x1f')](_0xbb43('0x1e'),_0xf8f3ef,JSON[_0xbb43('0x20')](_0x2ad6da));_0xdb7f2e(_0x2ad6da);})['catch'](function(_0x157d62){logger['error']('GetVoiceExtension',_0x157d62['message'],_0xf8f3ef);_0x2bf2d4(_0x1b6e69[_0xbb43('0x13')](0x1f4,_0x157d62['message']));});});};
\ No newline at end of file
index 62d7063..8c58374 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1698=['length','voiceExtension:','update','emit','removeListener'];(function(_0x150d5e,_0x5a86fb){var _0x23b9a1=function(_0x3e6cb2){while(--_0x3e6cb2){_0x150d5e['push'](_0x150d5e['shift']());}};_0x23b9a1(++_0x5a86fb);}(_0x1698,0x1c4));var _0x8169=function(_0x4fa291,_0x56e289){_0x4fa291=_0x4fa291-0x0;var _0x506d9b=_0x1698[_0x4fa291];return _0x506d9b;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=['save','remove',_0x8169('0x0')];function createListener(_0x3f509f,_0x5aaed7){return function(_0x58b69e){_0x5aaed7[_0x8169('0x1')](_0x3f509f,_0x58b69e);};}function removeListener(_0x1a6bcc,_0x4aed65){return function(){VoiceExtensionEvents[_0x8169('0x2')](_0x1a6bcc,_0x4aed65);};}exports['register']=function(_0x443782){for(var _0x1efbbc=0x0,_0x1c7e16=events[_0x8169('0x3')];_0x1efbbc<_0x1c7e16;_0x1efbbc++){var _0x42d312=events[_0x1efbbc];var _0x14ef1c=createListener(_0x8169('0x4')+_0x42d312,_0x443782);VoiceExtensionEvents['on'](_0x42d312,_0x14ef1c);}};
\ No newline at end of file
+var _0xfe44=['length','voiceExtension:','./voiceExtension.events','save','update','emit','removeListener'];(function(_0x571139,_0x9b3211){var _0x5a8607=function(_0x546546){while(--_0x546546){_0x571139['push'](_0x571139['shift']());}};_0x5a8607(++_0x9b3211);}(_0xfe44,0xf0));var _0x4fe4=function(_0x4b1dd4,_0x292d3a){_0x4b1dd4=_0x4b1dd4-0x0;var _0x2c87dd=_0xfe44[_0x4b1dd4];return _0x2c87dd;};'use strict';var VoiceExtensionEvents=require(_0x4fe4('0x0'));var events=[_0x4fe4('0x1'),'remove',_0x4fe4('0x2')];function createListener(_0x471879,_0x18497a){return function(_0x5c71aa){_0x18497a[_0x4fe4('0x3')](_0x471879,_0x5c71aa);};}function removeListener(_0x440839,_0x341dc0){return function(){VoiceExtensionEvents[_0x4fe4('0x4')](_0x440839,_0x341dc0);};}exports['register']=function(_0x24ee20){for(var _0x315645=0x0,_0x3ff2ca=events[_0x4fe4('0x5')];_0x315645<_0x3ff2ca;_0x315645++){var _0x48886d=events[_0x315645];var _0x21715c=createListener(_0x4fe4('0x6')+_0x48886d,_0x24ee20);VoiceExtensionEvents['on'](_0x48886d,_0x21715c);}};
\ No newline at end of file
index 211d61e..9e896a7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xae60=['Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','/:id/messages','getMessages','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x2af353,_0x418430){var _0x3f3f4e=function(_0x186bb5){while(--_0x186bb5){_0x2af353['push'](_0x2af353['shift']());}};_0x3f3f4e(++_0x418430);}(_0xae60,0xd4));var _0x0ae6=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xae60[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0ae6('0x0'));var util=require('util');var path=require(_0x0ae6('0x1'));var timeout=require(_0x0ae6('0x2'));var express=require(_0x0ae6('0x3'));var router=express[_0x0ae6('0x4')]();var auth=require(_0x0ae6('0x5'));var interaction=require(_0x0ae6('0x6'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router[_0x0ae6('0x7')]('/',auth[_0x0ae6('0x8')](),controller['index']);router['get'](_0x0ae6('0x9'),auth[_0x0ae6('0x8')](),controller['show']);router['get'](_0x0ae6('0xa'),auth[_0x0ae6('0x8')](),controller[_0x0ae6('0xb')]);router['post']('/',auth[_0x0ae6('0x8')](),controller[_0x0ae6('0xc')]);router[_0x0ae6('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x0ae6('0xe')]);router[_0x0ae6('0xf')](_0x0ae6('0x9'),auth[_0x0ae6('0x8')](),controller[_0x0ae6('0x10')]);module[_0x0ae6('0x11')]=router;
\ No newline at end of file
+var _0xa381=['delete','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/messages','post','create','put','update'];(function(_0x19def1,_0x4ed188){var _0x556ee9=function(_0x36b75e){while(--_0x36b75e){_0x19def1['push'](_0x19def1['shift']());}};_0x556ee9(++_0x4ed188);}(_0xa381,0x6a));var _0x1a38=function(_0xb82d09,_0x1ce659){_0xb82d09=_0xb82d09-0x0;var _0x2a699e=_0xa381[_0xb82d09];return _0x2a699e;};'use strict';var multer=require('multer');var util=require(_0x1a38('0x0'));var path=require(_0x1a38('0x1'));var timeout=require('connect-timeout');var express=require(_0x1a38('0x2'));var router=express['Router']();var auth=require(_0x1a38('0x3'));var interaction=require(_0x1a38('0x4'));var config=require(_0x1a38('0x5'));var controller=require('./voiceMail.controller');router[_0x1a38('0x6')]('/',auth[_0x1a38('0x7')](),controller['index']);router[_0x1a38('0x6')](_0x1a38('0x8'),auth[_0x1a38('0x7')](),controller['show']);router[_0x1a38('0x6')](_0x1a38('0x9'),auth['isAuthenticated'](),controller['getMessages']);router[_0x1a38('0xa')]('/',auth[_0x1a38('0x7')](),controller[_0x1a38('0xb')]);router[_0x1a38('0xc')]('/:id',auth[_0x1a38('0x7')](),controller[_0x1a38('0xd')]);router[_0x1a38('0xe')](_0x1a38('0x8'),auth[_0x1a38('0x7')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
index d56c100..7976ba7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf9ed=['string','trim','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','sequelize','exports','STRING','from-voicemail','setDataValue','email'];(function(_0x54827d,_0x293f1c){var _0x19bf0f=function(_0x1dd837){while(--_0x1dd837){_0x54827d['push'](_0x54827d['shift']());}};_0x19bf0f(++_0x293f1c);}(_0xf9ed,0x10a));var _0xdf9e=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xf9ed[_0x25e7cb];return _0x375d92;};'use strict';var Sequelize=require(_0xdf9e('0x0'));module[_0xdf9e('0x1')]={'customer_id':{'type':Sequelize[_0xdf9e('0x2')]},'context':{'type':Sequelize[_0xdf9e('0x2')],'defaultValue':_0xdf9e('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xdf9e('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xdf9e('0x2')]},'fullname':{'type':Sequelize[_0xdf9e('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x202769){this[_0xdf9e('0x4')](_0xdf9e('0x5'),typeof _0x202769===_0xdf9e('0x6')&&_0x202769[_0xdf9e('0x7')]()?_0x202769['trim']():null);}},'pager':{'type':Sequelize[_0xdf9e('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize[_0xdf9e('0x8')](_0xdf9e('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xdf9e('0x8')](_0xdf9e('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xdf9e('0x2')]},'callback':{'type':Sequelize[_0xdf9e('0x2')]},'review':{'type':Sequelize[_0xdf9e('0x8')](_0xdf9e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xdf9e('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xdf9e('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xdf9e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xdf9e('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xdf9e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xdf9e('0x8')](_0xdf9e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xdf9e('0x8')](_0xdf9e('0x9'),'no'),'defaultValue':_0xdf9e('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0xdf9e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xdf9e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xdf9e('0x8')]('yes','no'),'defaultValue':_0xdf9e('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xdf9e('0x2')]},'emailbody':{'type':Sequelize[_0xdf9e('0x2')]},'maxsecs':{'type':Sequelize[_0xdf9e('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xdf9e('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xdf9e('0xc')],'get':function(){return this['getDataValue'](_0xdf9e('0xd'))+_0xdf9e('0xe')+this[_0xdf9e('0xf')]('mailbox');}}};
\ No newline at end of file
+var _0x1035=['setDataValue','email','string','trim','yes','ENUM','TINYINT(4)','INTEGER','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox'];(function(_0x41200c,_0x3f5504){var _0x26ddfa=function(_0x5460f8){while(--_0x5460f8){_0x41200c['push'](_0x41200c['shift']());}};_0x26ddfa(++_0x3f5504);}(_0x1035,0x171));var _0x5103=function(_0xf4708c,_0x20fbd1){_0xf4708c=_0xf4708c-0x0;var _0x19f3e6=_0x1035[_0xf4708c];return _0x19f3e6;};'use strict';var Sequelize=require(_0x5103('0x0'));module[_0x5103('0x1')]={'customer_id':{'type':Sequelize[_0x5103('0x2')]},'context':{'type':Sequelize[_0x5103('0x2')],'defaultValue':_0x5103('0x3'),'unique':_0x5103('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x5103('0x4')},'password':{'type':Sequelize[_0x5103('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x62dbc5){this[_0x5103('0x5')](_0x5103('0x6'),typeof _0x62dbc5===_0x5103('0x7')&&_0x62dbc5[_0x5103('0x8')]()?_0x62dbc5[_0x5103('0x8')]():null);}},'pager':{'type':Sequelize[_0x5103('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM'](_0x5103('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x5103('0xa')](_0x5103('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x5103('0x2')]},'callback':{'type':Sequelize[_0x5103('0x2')]},'review':{'type':Sequelize[_0x5103('0xa')](_0x5103('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x5103('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x5103('0xa')](_0x5103('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x5103('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x5103('0xa')](_0x5103('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x5103('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x5103('0x9'),'no'),'defaultValue':_0x5103('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x5103('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x5103('0xa')](_0x5103('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x5103('0xa')](_0x5103('0x9'),'no'),'defaultValue':_0x5103('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x5103('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x5103('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x5103('0xd')](_0x5103('0xe'))+_0x5103('0xf')+this[_0x5103('0xd')](_0x5103('0x10'));}}};
\ No newline at end of file
index 5fcf107..ce6292b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdf93=['Content-Range','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','name','send','index','VoiceMail','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','include','findAll','catch','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','VoiceMailMessage','order','mailbox','findAndCountAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set'];(function(_0x192851,_0x598494){var _0x515ac0=function(_0x1aff30){while(--_0x1aff30){_0x192851['push'](_0x192851['shift']());}};_0x515ac0(++_0x598494);}(_0xdf93,0x192));var _0x3df9=function(_0xdc5e5e,_0x124f3c){_0xdc5e5e=_0xdc5e5e-0x0;var _0x20af19=_0xdf93[_0xdc5e5e];return _0x20af19;};'use strict';var pdf=require(_0x3df9('0x0'));var emlformat=require(_0x3df9('0x1'));var rimraf=require(_0x3df9('0x2'));var zipdir=require(_0x3df9('0x3'));var jsonpatch=require(_0x3df9('0x4'));var rp=require(_0x3df9('0x5'));var moment=require(_0x3df9('0x6'));var BPromise=require(_0x3df9('0x7'));var Mustache=require(_0x3df9('0x8'));var util=require(_0x3df9('0x9'));var path=require(_0x3df9('0xa'));var sox=require(_0x3df9('0xb'));var csv=require(_0x3df9('0xc'));var ejs=require(_0x3df9('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3df9('0xe'));var crypto=require(_0x3df9('0xf'));var jsforce=require(_0x3df9('0x10'));var deskjs=require(_0x3df9('0x11'));var toCsv=require(_0x3df9('0xc'));var querystring=require(_0x3df9('0x12'));var Papa=require(_0x3df9('0x13'));var authService=require('../../components/auth/service');var hardwareService=require(_0x3df9('0x14'));var Redis=require(_0x3df9('0x15'));var qs=require(_0x3df9('0x16'));var logger=require('../../config/logger')(_0x3df9('0x17'));var utils=require('../../config/utils');var config=require(_0x3df9('0x18'));var db=require(_0x3df9('0x19'))['db'];function respondWithStatusCode(_0x280d6e,_0x243df1){_0x243df1=_0x243df1||0xcc;return function(_0x39fa80){if(_0x39fa80){return _0x280d6e[_0x3df9('0x1a')](_0x243df1);}return _0x280d6e[_0x3df9('0x1b')](_0x243df1)[_0x3df9('0x1c')]();};}function respondWithResult(_0x59cabb,_0x409326){_0x409326=_0x409326||0xc8;return function(_0xc0ae3a){if(_0xc0ae3a){return _0x59cabb[_0x3df9('0x1b')](_0x409326)['json'](_0xc0ae3a);}};}function respondWithFilteredResult(_0x4d68ba,_0x1efd7f){return function(_0x42cd04){if(_0x42cd04){var _0x16d872=_0x42cd04[_0x3df9('0x1d')],_0x10e30f=_0x1efd7f[_0x3df9('0x1e')],_0x5e99ef=_0x1efd7f['offset']+_0x1efd7f[_0x3df9('0x1f')],_0x40a8d5;if(_0x5e99ef>=_0x16d872){_0x5e99ef=_0x16d872;_0x40a8d5=0xc8;}else{_0x40a8d5=0xce;}_0x4d68ba[_0x3df9('0x1b')](_0x40a8d5);return _0x4d68ba[_0x3df9('0x20')](_0x3df9('0x21'),_0x10e30f+'-'+_0x5e99ef+'/'+_0x16d872)['json'](_0x42cd04);}return null;};}function patchUpdates(_0x362bbe){return function(_0x9360d3){try{jsonpatch[_0x3df9('0x22')](_0x9360d3,_0x362bbe,!![]);}catch(_0x5dc44e){return BPromise[_0x3df9('0x23')](_0x5dc44e);}return _0x9360d3[_0x3df9('0x24')]();};}function saveUpdates(_0x367121,_0x1a02d4){return function(_0x115b56){if(_0x115b56){return _0x115b56[_0x3df9('0x25')](_0x367121)[_0x3df9('0x26')](function(_0x55f7d3){return _0x55f7d3;});}return null;};}function removeEntity(_0x40c835,_0xa8858d){return function(_0x1bc885){if(_0x1bc885){return _0x1bc885[_0x3df9('0x27')]()['then'](function(){var _0x267d96=_0x1bc885[_0x3df9('0x28')]({'plain':!![]});var _0x51b0e0=_0x3df9('0x29');return db[_0x3df9('0x2a')][_0x3df9('0x27')]({'where':{'type':_0x51b0e0,'resourceId':_0x267d96['id']}})['then'](function(){return _0x1bc885;});})[_0x3df9('0x26')](function(){_0x40c835[_0x3df9('0x1b')](0xcc)[_0x3df9('0x1c')]();});}};}function handleEntityNotFound(_0x37d56d,_0x11c7e9){return function(_0x3bc67e){if(!_0x3bc67e){_0x37d56d['sendStatus'](0x194);}return _0x3bc67e;};}function handleError(_0x55ea76,_0x251162){_0x251162=_0x251162||0x1f4;return function(_0x52f988){logger[_0x3df9('0x2b')](_0x52f988['stack']);if(_0x52f988[_0x3df9('0x2c')]){delete _0x52f988[_0x3df9('0x2c')];}_0x55ea76['status'](_0x251162)[_0x3df9('0x2d')](_0x52f988);};}exports[_0x3df9('0x2e')]=function(_0x38d1b6,_0x46de58){var _0x6718e7={},_0x5bef2b={},_0x102290={'count':0x0,'rows':[]};var _0x1d278c=db[_0x3df9('0x2f')][_0x3df9('0x30')];_0x5bef2b[_0x3df9('0x31')]=_['keys'](_0x1d278c);_0x5bef2b[_0x3df9('0x32')]=_[_0x3df9('0x33')](_0x38d1b6[_0x3df9('0x32')]);_0x5bef2b[_0x3df9('0x34')]=_[_0x3df9('0x35')](_0x5bef2b[_0x3df9('0x31')],_0x5bef2b[_0x3df9('0x32')]);_0x6718e7['attributes']=_['intersection'](_0x5bef2b[_0x3df9('0x31')],qs[_0x3df9('0x36')](_0x38d1b6[_0x3df9('0x32')][_0x3df9('0x36')]));_0x6718e7[_0x3df9('0x37')]=_0x6718e7[_0x3df9('0x37')][_0x3df9('0x38')]?_0x6718e7[_0x3df9('0x37')]:_0x5bef2b[_0x3df9('0x31')];if(!_0x38d1b6[_0x3df9('0x32')][_0x3df9('0x39')]('nolimit')){_0x6718e7[_0x3df9('0x1f')]=qs[_0x3df9('0x1f')](_0x38d1b6[_0x3df9('0x32')][_0x3df9('0x1f')]);_0x6718e7['offset']=qs[_0x3df9('0x1e')](_0x38d1b6['query'][_0x3df9('0x1e')]);}_0x6718e7['order']=qs[_0x3df9('0x3a')](_0x38d1b6['query'][_0x3df9('0x3a')]);_0x6718e7[_0x3df9('0x3b')]=qs[_0x3df9('0x34')](_[_0x3df9('0x3c')](_0x38d1b6[_0x3df9('0x32')],_0x5bef2b[_0x3df9('0x34')]));if(_0x38d1b6[_0x3df9('0x32')][_0x3df9('0x3d')]){_0x6718e7['where']=_[_0x3df9('0x3e')](_0x6718e7[_0x3df9('0x3b')],{'$or':_[_0x3df9('0x3f')](_0x1d278c,function(_0x5b9eeb){if(_0x5b9eeb[_0x3df9('0x40')][_0x3df9('0x41')]!==_0x3df9('0x42')){var _0x32e457={};_0x32e457[_0x5b9eeb[_0x3df9('0x43')]]={'$like':'%'+_0x38d1b6[_0x3df9('0x32')][_0x3df9('0x3d')]+'%'};return _0x32e457;}})});}_0x6718e7=_[_0x3df9('0x3e')]({},_0x6718e7,_0x38d1b6[_0x3df9('0x44')]);var _0x52d7fe={'where':_0x6718e7[_0x3df9('0x3b')]};return db[_0x3df9('0x2f')][_0x3df9('0x1d')](_0x52d7fe)[_0x3df9('0x26')](function(_0x5287e0){_0x102290[_0x3df9('0x1d')]=_0x5287e0;if(_0x38d1b6[_0x3df9('0x32')][_0x3df9('0x45')]){_0x6718e7[_0x3df9('0x46')]=[{'all':!![]}];}return db[_0x3df9('0x2f')][_0x3df9('0x47')](_0x6718e7);})[_0x3df9('0x26')](function(_0xf3da8b){_0x102290['rows']=_0xf3da8b;return _0x102290;})[_0x3df9('0x26')](respondWithFilteredResult(_0x46de58,_0x6718e7))[_0x3df9('0x48')](handleError(_0x46de58,null));};exports['show']=function(_0x270cd8,_0x4417ed){var _0x5f0389={'raw':!![],'where':{'id':_0x270cd8[_0x3df9('0x49')]['id']}},_0x13f032={};_0x13f032[_0x3df9('0x31')]=_[_0x3df9('0x33')](db[_0x3df9('0x2f')][_0x3df9('0x30')]);_0x13f032[_0x3df9('0x32')]=_[_0x3df9('0x33')](_0x270cd8[_0x3df9('0x32')]);_0x13f032[_0x3df9('0x34')]=_[_0x3df9('0x35')](_0x13f032['model'],_0x13f032[_0x3df9('0x32')]);_0x5f0389[_0x3df9('0x37')]=_['intersection'](_0x13f032[_0x3df9('0x31')],qs[_0x3df9('0x36')](_0x270cd8[_0x3df9('0x32')]['fields']));_0x5f0389[_0x3df9('0x37')]=_0x5f0389[_0x3df9('0x37')]['length']?_0x5f0389[_0x3df9('0x37')]:_0x13f032[_0x3df9('0x31')];if(_0x270cd8[_0x3df9('0x32')][_0x3df9('0x45')]){_0x5f0389[_0x3df9('0x46')]=[{'all':!![]}];}_0x5f0389=_[_0x3df9('0x3e')]({},_0x5f0389,_0x270cd8[_0x3df9('0x44')]);return db['VoiceMail'][_0x3df9('0x4a')](_0x5f0389)[_0x3df9('0x26')](handleEntityNotFound(_0x4417ed,null))[_0x3df9('0x26')](respondWithResult(_0x4417ed,null))[_0x3df9('0x48')](handleError(_0x4417ed,null));};exports[_0x3df9('0x4b')]=function(_0x7818bd,_0x745ae6){return db['VoiceMail'][_0x3df9('0x4b')](_0x7818bd[_0x3df9('0x4c')],{})[_0x3df9('0x26')](function(_0x53e80a){var _0x485113=_0x7818bd['user'][_0x3df9('0x28')]({'plain':!![]});if(!_0x485113)throw new Error(_0x3df9('0x4d'));if(_0x485113[_0x3df9('0x4e')]===_0x3df9('0x4f')){var _0x2adeb5=_0x53e80a[_0x3df9('0x28')]({'plain':!![]});var _0x5dc0c1=_0x3df9('0x29');return db[_0x3df9('0x50')][_0x3df9('0x4a')]({'where':{'name':_0x5dc0c1,'userProfileId':_0x485113['userProfileId']},'raw':!![]})[_0x3df9('0x26')](function(_0x5a4679){if(_0x5a4679&&_0x5a4679[_0x3df9('0x51')]===0x0){return db[_0x3df9('0x2a')][_0x3df9('0x4b')]({'name':_0x2adeb5[_0x3df9('0x2c')],'resourceId':_0x2adeb5['id'],'type':_0x5a4679['name'],'sectionId':_0x5a4679['id']},{})[_0x3df9('0x26')](function(){return _0x53e80a;});}else{return _0x53e80a;}})['catch'](function(_0x57a919){logger['error'](_0x3df9('0x52'),_0x57a919);throw _0x57a919;});}return _0x53e80a;})[_0x3df9('0x26')](respondWithResult(_0x745ae6,0xc9))[_0x3df9('0x48')](handleError(_0x745ae6,null));};exports[_0x3df9('0x25')]=function(_0x38d0b6,_0x5e1d24){if(_0x38d0b6[_0x3df9('0x4c')]['id']){delete _0x38d0b6['body']['id'];}return db[_0x3df9('0x2f')][_0x3df9('0x4a')]({'where':{'id':_0x38d0b6['params']['id']}})[_0x3df9('0x26')](handleEntityNotFound(_0x5e1d24,null))['then'](saveUpdates(_0x38d0b6[_0x3df9('0x4c')],null))[_0x3df9('0x26')](respondWithResult(_0x5e1d24,null))[_0x3df9('0x48')](handleError(_0x5e1d24,null));};exports[_0x3df9('0x27')]=function(_0x414f4b,_0x5ce22a){return db[_0x3df9('0x2f')]['find']({'where':{'id':_0x414f4b[_0x3df9('0x49')]['id']}})[_0x3df9('0x26')](handleEntityNotFound(_0x5ce22a,null))['then'](removeEntity(_0x5ce22a,null))[_0x3df9('0x48')](handleError(_0x5ce22a,null));};exports['getMessages']=function(_0x7f8783,_0x443bfd,_0x1c796c){return db[_0x3df9('0x2f')]['findOne']({'where':{'id':_0x7f8783['params']['id']}})[_0x3df9('0x26')](handleEntityNotFound(_0x443bfd,null))[_0x3df9('0x26')](function(_0x10d58d){var _0x14e1f1;var _0x3e096f={},_0x2a1d31={};_0x2a1d31[_0x3df9('0x31')]=_[_0x3df9('0x33')](db[_0x3df9('0x53')][_0x3df9('0x30')]);_0x2a1d31[_0x3df9('0x32')]=_[_0x3df9('0x33')](_0x7f8783[_0x3df9('0x32')]);_0x2a1d31[_0x3df9('0x34')]=_[_0x3df9('0x35')](_0x2a1d31['model'],_0x2a1d31[_0x3df9('0x32')]);_0x3e096f[_0x3df9('0x37')]=_[_0x3df9('0x35')](_0x2a1d31['model'],qs[_0x3df9('0x36')](_0x7f8783['query'][_0x3df9('0x36')]));_0x3e096f['attributes']=_0x3e096f[_0x3df9('0x37')]['length']?_0x3e096f['attributes']:_0x2a1d31[_0x3df9('0x31')];if(!_0x7f8783[_0x3df9('0x32')]['hasOwnProperty']('nolimit')){_0x3e096f[_0x3df9('0x1f')]=qs[_0x3df9('0x1f')](_0x7f8783[_0x3df9('0x32')][_0x3df9('0x1f')]);_0x3e096f['offset']=qs['offset'](_0x7f8783['query']['offset']);}_0x3e096f[_0x3df9('0x54')]=qs['sort'](_0x7f8783['query'][_0x3df9('0x3a')]);_0x3e096f['where']=qs[_0x3df9('0x34')](_[_0x3df9('0x3c')](_0x7f8783[_0x3df9('0x32')],_0x2a1d31[_0x3df9('0x34')]));if(_0x7f8783[_0x3df9('0x32')]['filter']){_0x3e096f[_0x3df9('0x3b')]=_['merge'](_0x3e096f[_0x3df9('0x3b')],{'$or':_[_0x3df9('0x3f')](_0x3e096f[_0x3df9('0x37')],function(_0x3f63f1){var _0x3297a8={};_0x3297a8[_0x3f63f1]={'$like':'%'+_0x7f8783[_0x3df9('0x32')][_0x3df9('0x3d')]+'%'};return _0x3297a8;})});}_0x3e096f[_0x3df9('0x3b')]=_[_0x3df9('0x3e')](_0x3e096f['where'],{'mailboxuser':_0x10d58d[_0x3df9('0x55')]});_0x3e096f=_[_0x3df9('0x3e')]({},_0x3e096f,_0x7f8783[_0x3df9('0x44')]);return db[_0x3df9('0x53')][_0x3df9('0x56')](_0x3e096f)[_0x3df9('0x26')](respondWithFilteredResult(_0x443bfd,_0x3e096f));})[_0x3df9('0x48')](handleError(_0x443bfd,null));};
\ No newline at end of file
+var _0xac94=['error','stack','name','send','index','VoiceMail','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','offset','order','sort','pick','filter','merge','where','map','key','VIRTUAL','field','includeAll','include','rows','catch','params','rawAttributes','fields','options','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','getMessages','findOne','VoiceMailMessage','findAndCountAll','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','sendStatus','status','json','count','limit','Content-Range','apply','save','update','then','destroy','get','Voicemails','UserProfileResource'];(function(_0x3de3f8,_0x45f88c){var _0x13b368=function(_0x1a80a1){while(--_0x1a80a1){_0x3de3f8['push'](_0x3de3f8['shift']());}};_0x13b368(++_0x45f88c);}(_0xac94,0x1b3));var _0x4ac9=function(_0x461a2b,_0x1af9a0){_0x461a2b=_0x461a2b-0x0;var _0x29ef69=_0xac94[_0x461a2b];return _0x29ef69;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4ac9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4ac9('0x1'));var rp=require(_0x4ac9('0x2'));var moment=require(_0x4ac9('0x3'));var BPromise=require(_0x4ac9('0x4'));var Mustache=require(_0x4ac9('0x5'));var util=require(_0x4ac9('0x6'));var path=require(_0x4ac9('0x7'));var sox=require(_0x4ac9('0x8'));var csv=require(_0x4ac9('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x4ac9('0xa'));var crypto=require(_0x4ac9('0xb'));var jsforce=require(_0x4ac9('0xc'));var deskjs=require(_0x4ac9('0xd'));var toCsv=require(_0x4ac9('0x9'));var querystring=require(_0x4ac9('0xe'));var Papa=require(_0x4ac9('0xf'));var authService=require(_0x4ac9('0x10'));var hardwareService=require(_0x4ac9('0x11'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x4ac9('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13fcb9,_0x42906a){_0x42906a=_0x42906a||0xcc;return function(_0x53aea0){if(_0x53aea0){return _0x13fcb9[_0x4ac9('0x13')](_0x42906a);}return _0x13fcb9[_0x4ac9('0x14')](_0x42906a)['end']();};}function respondWithResult(_0x91af7e,_0x4453d2){_0x4453d2=_0x4453d2||0xc8;return function(_0x4beac2){if(_0x4beac2){return _0x91af7e['status'](_0x4453d2)[_0x4ac9('0x15')](_0x4beac2);}};}function respondWithFilteredResult(_0x8eca77,_0x2a3ef0){return function(_0x32d2f2){if(_0x32d2f2){var _0x3e8fa0=_0x32d2f2[_0x4ac9('0x16')],_0x3b903e=_0x2a3ef0['offset'],_0x2c83e8=_0x2a3ef0['offset']+_0x2a3ef0[_0x4ac9('0x17')],_0x47a301;if(_0x2c83e8>=_0x3e8fa0){_0x2c83e8=_0x3e8fa0;_0x47a301=0xc8;}else{_0x47a301=0xce;}_0x8eca77[_0x4ac9('0x14')](_0x47a301);return _0x8eca77['set'](_0x4ac9('0x18'),_0x3b903e+'-'+_0x2c83e8+'/'+_0x3e8fa0)['json'](_0x32d2f2);}return null;};}function patchUpdates(_0x47c4f5){return function(_0x26422c){try{jsonpatch[_0x4ac9('0x19')](_0x26422c,_0x47c4f5,!![]);}catch(_0x88454d){return BPromise['reject'](_0x88454d);}return _0x26422c[_0x4ac9('0x1a')]();};}function saveUpdates(_0x52df5f,_0x4a7594){return function(_0x45ac78){if(_0x45ac78){return _0x45ac78[_0x4ac9('0x1b')](_0x52df5f)[_0x4ac9('0x1c')](function(_0x885952){return _0x885952;});}return null;};}function removeEntity(_0x4a5496,_0x5ad9d2){return function(_0x22a932){if(_0x22a932){return _0x22a932[_0x4ac9('0x1d')]()[_0x4ac9('0x1c')](function(){var _0x4343ab=_0x22a932[_0x4ac9('0x1e')]({'plain':!![]});var _0x4e8ec6=_0x4ac9('0x1f');return db[_0x4ac9('0x20')][_0x4ac9('0x1d')]({'where':{'type':_0x4e8ec6,'resourceId':_0x4343ab['id']}})[_0x4ac9('0x1c')](function(){return _0x22a932;});})[_0x4ac9('0x1c')](function(){_0x4a5496[_0x4ac9('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x69b5ac,_0x1746ff){return function(_0x374bf9){if(!_0x374bf9){_0x69b5ac[_0x4ac9('0x13')](0x194);}return _0x374bf9;};}function handleError(_0x5245f3,_0x1aa8b4){_0x1aa8b4=_0x1aa8b4||0x1f4;return function(_0x36d562){logger[_0x4ac9('0x21')](_0x36d562[_0x4ac9('0x22')]);if(_0x36d562[_0x4ac9('0x23')]){delete _0x36d562['name'];}_0x5245f3[_0x4ac9('0x14')](_0x1aa8b4)[_0x4ac9('0x24')](_0x36d562);};}exports[_0x4ac9('0x25')]=function(_0x26aa9b,_0x318867){var _0x93f171={},_0x5991ae={},_0xa71636={'count':0x0,'rows':[]};var _0x42ab35=db[_0x4ac9('0x26')]['rawAttributes'];_0x5991ae[_0x4ac9('0x27')]=_[_0x4ac9('0x28')](_0x42ab35);_0x5991ae['query']=_[_0x4ac9('0x28')](_0x26aa9b[_0x4ac9('0x29')]);_0x5991ae[_0x4ac9('0x2a')]=_[_0x4ac9('0x2b')](_0x5991ae['model'],_0x5991ae['query']);_0x93f171['attributes']=_['intersection'](_0x5991ae[_0x4ac9('0x27')],qs['fields'](_0x26aa9b[_0x4ac9('0x29')]['fields']));_0x93f171[_0x4ac9('0x2c')]=_0x93f171[_0x4ac9('0x2c')][_0x4ac9('0x2d')]?_0x93f171[_0x4ac9('0x2c')]:_0x5991ae[_0x4ac9('0x27')];if(!_0x26aa9b['query'][_0x4ac9('0x2e')]('nolimit')){_0x93f171[_0x4ac9('0x17')]=qs[_0x4ac9('0x17')](_0x26aa9b['query'][_0x4ac9('0x17')]);_0x93f171[_0x4ac9('0x2f')]=qs[_0x4ac9('0x2f')](_0x26aa9b[_0x4ac9('0x29')]['offset']);}_0x93f171[_0x4ac9('0x30')]=qs[_0x4ac9('0x31')](_0x26aa9b[_0x4ac9('0x29')][_0x4ac9('0x31')]);_0x93f171['where']=qs[_0x4ac9('0x2a')](_[_0x4ac9('0x32')](_0x26aa9b[_0x4ac9('0x29')],_0x5991ae[_0x4ac9('0x2a')]));if(_0x26aa9b['query'][_0x4ac9('0x33')]){_0x93f171['where']=_[_0x4ac9('0x34')](_0x93f171[_0x4ac9('0x35')],{'$or':_[_0x4ac9('0x36')](_0x42ab35,function(_0x13a365){if(_0x13a365['type'][_0x4ac9('0x37')]!==_0x4ac9('0x38')){var _0x81531={};_0x81531[_0x13a365[_0x4ac9('0x39')]]={'$like':'%'+_0x26aa9b[_0x4ac9('0x29')][_0x4ac9('0x33')]+'%'};return _0x81531;}})});}_0x93f171=_[_0x4ac9('0x34')]({},_0x93f171,_0x26aa9b['options']);var _0xbeed2c={'where':_0x93f171[_0x4ac9('0x35')]};return db['VoiceMail'][_0x4ac9('0x16')](_0xbeed2c)[_0x4ac9('0x1c')](function(_0x26e735){_0xa71636[_0x4ac9('0x16')]=_0x26e735;if(_0x26aa9b[_0x4ac9('0x29')][_0x4ac9('0x3a')]){_0x93f171[_0x4ac9('0x3b')]=[{'all':!![]}];}return db[_0x4ac9('0x26')]['findAll'](_0x93f171);})['then'](function(_0x16c650){_0xa71636[_0x4ac9('0x3c')]=_0x16c650;return _0xa71636;})[_0x4ac9('0x1c')](respondWithFilteredResult(_0x318867,_0x93f171))[_0x4ac9('0x3d')](handleError(_0x318867,null));};exports['show']=function(_0x2ac61f,_0x10e738){var _0x3547c0={'raw':!![],'where':{'id':_0x2ac61f[_0x4ac9('0x3e')]['id']}},_0x710069={};_0x710069[_0x4ac9('0x27')]=_[_0x4ac9('0x28')](db[_0x4ac9('0x26')][_0x4ac9('0x3f')]);_0x710069[_0x4ac9('0x29')]=_[_0x4ac9('0x28')](_0x2ac61f[_0x4ac9('0x29')]);_0x710069[_0x4ac9('0x2a')]=_[_0x4ac9('0x2b')](_0x710069[_0x4ac9('0x27')],_0x710069[_0x4ac9('0x29')]);_0x3547c0[_0x4ac9('0x2c')]=_[_0x4ac9('0x2b')](_0x710069[_0x4ac9('0x27')],qs[_0x4ac9('0x40')](_0x2ac61f['query']['fields']));_0x3547c0['attributes']=_0x3547c0[_0x4ac9('0x2c')]['length']?_0x3547c0[_0x4ac9('0x2c')]:_0x710069[_0x4ac9('0x27')];if(_0x2ac61f['query'][_0x4ac9('0x3a')]){_0x3547c0[_0x4ac9('0x3b')]=[{'all':!![]}];}_0x3547c0=_[_0x4ac9('0x34')]({},_0x3547c0,_0x2ac61f[_0x4ac9('0x41')]);return db[_0x4ac9('0x26')]['find'](_0x3547c0)[_0x4ac9('0x1c')](handleEntityNotFound(_0x10e738,null))[_0x4ac9('0x1c')](respondWithResult(_0x10e738,null))[_0x4ac9('0x3d')](handleError(_0x10e738,null));};exports[_0x4ac9('0x42')]=function(_0x231d98,_0x2f2707){return db[_0x4ac9('0x26')][_0x4ac9('0x42')](_0x231d98[_0x4ac9('0x43')],{})[_0x4ac9('0x1c')](function(_0x264e10){var _0x33e76c=_0x231d98['user'][_0x4ac9('0x1e')]({'plain':!![]});if(!_0x33e76c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33e76c['role']===_0x4ac9('0x44')){var _0x359c14=_0x264e10[_0x4ac9('0x1e')]({'plain':!![]});var _0xfaef03=_0x4ac9('0x1f');return db[_0x4ac9('0x45')]['find']({'where':{'name':_0xfaef03,'userProfileId':_0x33e76c[_0x4ac9('0x46')]},'raw':!![]})[_0x4ac9('0x1c')](function(_0x31bfbc){if(_0x31bfbc&&_0x31bfbc[_0x4ac9('0x47')]===0x0){return db['UserProfileResource']['create']({'name':_0x359c14[_0x4ac9('0x23')],'resourceId':_0x359c14['id'],'type':_0x31bfbc[_0x4ac9('0x23')],'sectionId':_0x31bfbc['id']},{})[_0x4ac9('0x1c')](function(){return _0x264e10;});}else{return _0x264e10;}})['catch'](function(_0x2716d8){logger[_0x4ac9('0x21')](_0x4ac9('0x48'),_0x2716d8);throw _0x2716d8;});}return _0x264e10;})[_0x4ac9('0x1c')](respondWithResult(_0x2f2707,0xc9))[_0x4ac9('0x3d')](handleError(_0x2f2707,null));};exports[_0x4ac9('0x1b')]=function(_0x4e1ddf,_0x1b4bf2){if(_0x4e1ddf['body']['id']){delete _0x4e1ddf[_0x4ac9('0x43')]['id'];}return db[_0x4ac9('0x26')][_0x4ac9('0x49')]({'where':{'id':_0x4e1ddf[_0x4ac9('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1b4bf2,null))['then'](saveUpdates(_0x4e1ddf[_0x4ac9('0x43')],null))[_0x4ac9('0x1c')](respondWithResult(_0x1b4bf2,null))[_0x4ac9('0x3d')](handleError(_0x1b4bf2,null));};exports[_0x4ac9('0x1d')]=function(_0x401965,_0x45f803){return db[_0x4ac9('0x26')][_0x4ac9('0x49')]({'where':{'id':_0x401965[_0x4ac9('0x3e')]['id']}})['then'](handleEntityNotFound(_0x45f803,null))['then'](removeEntity(_0x45f803,null))[_0x4ac9('0x3d')](handleError(_0x45f803,null));};exports[_0x4ac9('0x4a')]=function(_0x5a5163,_0x3ed90d,_0x28bb7a){return db[_0x4ac9('0x26')][_0x4ac9('0x4b')]({'where':{'id':_0x5a5163['params']['id']}})[_0x4ac9('0x1c')](handleEntityNotFound(_0x3ed90d,null))[_0x4ac9('0x1c')](function(_0x1cef9d){var _0x3a4d23;var _0x262ed8={},_0x384cd1={};_0x384cd1[_0x4ac9('0x27')]=_[_0x4ac9('0x28')](db[_0x4ac9('0x4c')]['rawAttributes']);_0x384cd1[_0x4ac9('0x29')]=_['keys'](_0x5a5163[_0x4ac9('0x29')]);_0x384cd1['filters']=_[_0x4ac9('0x2b')](_0x384cd1['model'],_0x384cd1['query']);_0x262ed8[_0x4ac9('0x2c')]=_[_0x4ac9('0x2b')](_0x384cd1[_0x4ac9('0x27')],qs[_0x4ac9('0x40')](_0x5a5163['query'][_0x4ac9('0x40')]));_0x262ed8['attributes']=_0x262ed8[_0x4ac9('0x2c')][_0x4ac9('0x2d')]?_0x262ed8[_0x4ac9('0x2c')]:_0x384cd1['model'];if(!_0x5a5163[_0x4ac9('0x29')][_0x4ac9('0x2e')]('nolimit')){_0x262ed8[_0x4ac9('0x17')]=qs[_0x4ac9('0x17')](_0x5a5163[_0x4ac9('0x29')][_0x4ac9('0x17')]);_0x262ed8[_0x4ac9('0x2f')]=qs[_0x4ac9('0x2f')](_0x5a5163[_0x4ac9('0x29')][_0x4ac9('0x2f')]);}_0x262ed8[_0x4ac9('0x30')]=qs[_0x4ac9('0x31')](_0x5a5163[_0x4ac9('0x29')][_0x4ac9('0x31')]);_0x262ed8[_0x4ac9('0x35')]=qs[_0x4ac9('0x2a')](_['pick'](_0x5a5163[_0x4ac9('0x29')],_0x384cd1[_0x4ac9('0x2a')]));if(_0x5a5163['query'][_0x4ac9('0x33')]){_0x262ed8['where']=_[_0x4ac9('0x34')](_0x262ed8[_0x4ac9('0x35')],{'$or':_[_0x4ac9('0x36')](_0x262ed8[_0x4ac9('0x2c')],function(_0x174e99){var _0x2235d5={};_0x2235d5[_0x174e99]={'$like':'%'+_0x5a5163[_0x4ac9('0x29')][_0x4ac9('0x33')]+'%'};return _0x2235d5;})});}_0x262ed8[_0x4ac9('0x35')]=_[_0x4ac9('0x34')](_0x262ed8[_0x4ac9('0x35')],{'mailboxuser':_0x1cef9d['mailbox']});_0x262ed8=_[_0x4ac9('0x34')]({},_0x262ed8,_0x5a5163[_0x4ac9('0x41')]);return db[_0x4ac9('0x4c')][_0x4ac9('0x4d')](_0x262ed8)[_0x4ac9('0x1c')](respondWithFilteredResult(_0x3ed90d,_0x262ed8));})[_0x4ac9('0x3d')](handleError(_0x3ed90d,null));};
\ No newline at end of file
index eed9cba..a6b5cbd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0071=['voice_voicemail','mailbox_context','mailbox','context','lodash','../../config/logger','api','moment','bluebird','request-promise','exports','define'];(function(_0x46f6d1,_0x145a9f){var _0x451480=function(_0x41708a){while(--_0x41708a){_0x46f6d1['push'](_0x46f6d1['shift']());}};_0x451480(++_0x145a9f);}(_0x0071,0xac));var _0x1007=function(_0x5d1ac8,_0x977cd9){_0x5d1ac8=_0x5d1ac8-0x0;var _0x9caf80=_0x0071[_0x5d1ac8];return _0x9caf80;};'use strict';var _=require(_0x1007('0x0'));var util=require('util');var logger=require(_0x1007('0x1'))(_0x1007('0x2'));var moment=require(_0x1007('0x3'));var BPromise=require(_0x1007('0x4'));var rp=require(_0x1007('0x5'));var attributes=require('./voiceMail.attributes');module[_0x1007('0x6')]=function(_0x51996a,_0x34301a){return _0x51996a[_0x1007('0x7')]('VoiceMail',attributes,{'tableName':_0x1007('0x8'),'paranoid':![],'indexes':[{'name':_0x1007('0x9'),'fields':[_0x1007('0xa'),_0x1007('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x0d0e=['VoiceMail','voice_voicemail','mailbox_context','mailbox','lodash','../../config/logger','api','moment','bluebird','request-promise','./voiceMail.attributes','define'];(function(_0x2977ec,_0x36a918){var _0x530ef3=function(_0x3f5741){while(--_0x3f5741){_0x2977ec['push'](_0x2977ec['shift']());}};_0x530ef3(++_0x36a918);}(_0x0d0e,0x1a8));var _0xe0d0=function(_0x13ff3a,_0xfbb881){_0x13ff3a=_0x13ff3a-0x0;var _0x24634c=_0x0d0e[_0x13ff3a];return _0x24634c;};'use strict';var _=require(_0xe0d0('0x0'));var util=require('util');var logger=require(_0xe0d0('0x1'))(_0xe0d0('0x2'));var moment=require(_0xe0d0('0x3'));var BPromise=require(_0xe0d0('0x4'));var rp=require(_0xe0d0('0x5'));var attributes=require(_0xe0d0('0x6'));module['exports']=function(_0x3c3a6a,_0x5be95a){return _0x3c3a6a[_0xe0d0('0x7')](_0xe0d0('0x8'),attributes,{'tableName':_0xe0d0('0x9'),'paranoid':![],'indexes':[{'name':_0xe0d0('0xa'),'fields':[_0xe0d0('0xb'),'context']}],'timestamps':!![]});};
\ No newline at end of file
index 5b5fb64..0ce97f2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xce93=['result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x21f9c2,_0x2b3d2a){var _0x3da17f=function(_0x57e2b9){while(--_0x57e2b9){_0x21f9c2['push'](_0x21f9c2['shift']());}};_0x3da17f(++_0x2b3d2a);}(_0xce93,0x1a5));var _0x3ce9=function(_0x1e830c,_0x31776b){_0x1e830c=_0x1e830c-0x0;var _0x3196e9=_0xce93[_0x1e830c];return _0x3196e9;};'use strict';var _=require(_0x3ce9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3ce9('0x1'));var rs=require(_0x3ce9('0x2'));var fs=require('fs');var Redis=require(_0x3ce9('0x3'));var db=require(_0x3ce9('0x4'))['db'];var utils=require(_0x3ce9('0x5'));var logger=require('../../config/logger')(_0x3ce9('0x6'));var config=require(_0x3ce9('0x7'));var jayson=require(_0x3ce9('0x8'));var client=jayson['client'][_0x3ce9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11d2b5,_0x274a05,_0x3c3aa1){return new BPromise(function(_0x442bdc,_0x4366a9){return client[_0x3ce9('0xa')](_0x11d2b5,_0x3c3aa1)[_0x3ce9('0xb')](function(_0x53549b){logger[_0x3ce9('0xc')](_0x3ce9('0xd'),_0x274a05,_0x3ce9('0xe'));logger[_0x3ce9('0xf')](_0x3ce9('0x10'),_0x274a05,'request\x20sent',JSON['stringify'](_0x53549b));if(_0x53549b[_0x3ce9('0x11')]){if(_0x53549b[_0x3ce9('0x11')][_0x3ce9('0x12')]===0x1f4){logger['error'](_0x3ce9('0xd'),_0x274a05,_0x53549b[_0x3ce9('0x11')][_0x3ce9('0x13')]);return _0x4366a9(_0x53549b[_0x3ce9('0x11')][_0x3ce9('0x13')]);}logger[_0x3ce9('0x11')](_0x3ce9('0xd'),_0x274a05,_0x53549b[_0x3ce9('0x11')][_0x3ce9('0x13')]);return _0x442bdc(_0x53549b[_0x3ce9('0x11')][_0x3ce9('0x13')]);}else{logger[_0x3ce9('0xc')](_0x3ce9('0xd'),_0x274a05,_0x3ce9('0xe'));_0x442bdc(_0x53549b[_0x3ce9('0x14')][_0x3ce9('0x13')]);}})['catch'](function(_0xbd1faa){logger[_0x3ce9('0x11')](_0x3ce9('0xd'),_0x274a05,_0xbd1faa);_0x4366a9(_0xbd1faa);});});}
\ No newline at end of file
+var _0x8a5a=['request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/environment','client','http','request','then','info','VoiceMail,\x20%s,\x20%s'];(function(_0x46414b,_0xd5403b){var _0x289703=function(_0x3ddbea){while(--_0x3ddbea){_0x46414b['push'](_0x46414b['shift']());}};_0x289703(++_0xd5403b);}(_0x8a5a,0xa9));var _0xa8a5=function(_0x2f5a0c,_0x2b25bb){_0x2f5a0c=_0x2f5a0c-0x0;var _0x3b93cc=_0x8a5a[_0x2f5a0c];return _0x3b93cc;};'use strict';var _=require(_0xa8a5('0x0'));var util=require('util');var moment=require(_0xa8a5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa8a5('0x2'));var db=require(_0xa8a5('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa8a5('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xa8a5('0x5')][_0xa8a5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1daca5,_0xa401a7,_0x11e8cf){return new BPromise(function(_0x286a4c,_0x48dc54){return client[_0xa8a5('0x7')](_0x1daca5,_0x11e8cf)[_0xa8a5('0x8')](function(_0x59325c){logger[_0xa8a5('0x9')](_0xa8a5('0xa'),_0xa401a7,_0xa8a5('0xb'));logger['debug'](_0xa8a5('0xc'),_0xa401a7,_0xa8a5('0xb'),JSON[_0xa8a5('0xd')](_0x59325c));if(_0x59325c[_0xa8a5('0xe')]){if(_0x59325c[_0xa8a5('0xe')]['code']===0x1f4){logger[_0xa8a5('0xe')]('VoiceMail,\x20%s,\x20%s',_0xa401a7,_0x59325c[_0xa8a5('0xe')]['message']);return _0x48dc54(_0x59325c[_0xa8a5('0xe')][_0xa8a5('0xf')]);}logger[_0xa8a5('0xe')](_0xa8a5('0xa'),_0xa401a7,_0x59325c['error'][_0xa8a5('0xf')]);return _0x286a4c(_0x59325c['error'][_0xa8a5('0xf')]);}else{logger[_0xa8a5('0x9')](_0xa8a5('0xa'),_0xa401a7,_0xa8a5('0xb'));_0x286a4c(_0x59325c[_0xa8a5('0x10')][_0xa8a5('0xf')]);}})[_0xa8a5('0x11')](function(_0x22048b){logger['error'](_0xa8a5('0xa'),_0xa401a7,_0x22048b);_0x48dc54(_0x22048b);});});}
\ No newline at end of file
index cf40aa3..25c67cf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5fc4=['download','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download'];(function(_0x4caf9b,_0x3607ec){var _0x57d8b9=function(_0x1c5332){while(--_0x1c5332){_0x4caf9b['push'](_0x4caf9b['shift']());}};_0x57d8b9(++_0x3607ec);}(_0x5fc4,0x1eb));var _0x45fc=function(_0xecfdc6,_0x10fcf5){_0xecfdc6=_0xecfdc6-0x0;var _0x9eb75b=_0x5fc4[_0xecfdc6];return _0x9eb75b;};'use strict';var multer=require(_0x45fc('0x0'));var util=require(_0x45fc('0x1'));var path=require(_0x45fc('0x2'));var timeout=require(_0x45fc('0x3'));var express=require(_0x45fc('0x4'));var router=express[_0x45fc('0x5')]();var auth=require(_0x45fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x45fc('0x7'));var controller=require(_0x45fc('0x8'));router[_0x45fc('0x9')]('/',auth[_0x45fc('0xa')](),controller[_0x45fc('0xb')]);router['get'](_0x45fc('0xc'),auth[_0x45fc('0xa')](),controller[_0x45fc('0xd')]);router[_0x45fc('0x9')](_0x45fc('0xe'),auth[_0x45fc('0xa')](),controller[_0x45fc('0xf')]);router[_0x45fc('0x10')]('/',auth[_0x45fc('0xa')](),controller[_0x45fc('0x11')]);router[_0x45fc('0x12')](_0x45fc('0xc'),auth[_0x45fc('0xa')](),controller[_0x45fc('0x13')]);router['delete']('/:id',auth[_0x45fc('0xa')](),controller[_0x45fc('0x14')]);module[_0x45fc('0x15')]=router;
\ No newline at end of file
+var _0x8409=['connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','index','get','/:id','isAuthenticated','/:id/download','download','post','create','put','update','delete','exports','multer','path'];(function(_0x570aaa,_0x142289){var _0x20238d=function(_0x5c80a1){while(--_0x5c80a1){_0x570aaa['push'](_0x570aaa['shift']());}};_0x20238d(++_0x142289);}(_0x8409,0x167));var _0x9840=function(_0xadd0d2,_0x3bf5b9){_0xadd0d2=_0xadd0d2-0x0;var _0x2d564c=_0x8409[_0xadd0d2];return _0x2d564c;};'use strict';var multer=require(_0x9840('0x0'));var util=require('util');var path=require(_0x9840('0x1'));var timeout=require(_0x9840('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x9840('0x3'));var interaction=require(_0x9840('0x4'));var config=require(_0x9840('0x5'));var controller=require(_0x9840('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x9840('0x7')]);router[_0x9840('0x8')](_0x9840('0x9'),auth[_0x9840('0xa')](),controller['show']);router[_0x9840('0x8')](_0x9840('0xb'),auth[_0x9840('0xa')](),controller[_0x9840('0xc')]);router[_0x9840('0xd')]('/',auth['isAuthenticated'](),controller[_0x9840('0xe')]);router[_0x9840('0xf')](_0x9840('0x9'),auth['isAuthenticated'](),controller[_0x9840('0x10')]);router[_0x9840('0x11')](_0x9840('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x9840('0x12')]=router;
\ No newline at end of file
index 3e5f982..63fa44d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3470=['sequelize','exports','VIRTUAL','STRING','BLOB','long','TIMESTAMP'];(function(_0x50ccaf,_0x45cbee){var _0xfabc4b=function(_0xb7d41a){while(--_0xb7d41a){_0x50ccaf['push'](_0x50ccaf['shift']());}};_0xfabc4b(++_0x45cbee);}(_0x3470,0xc4));var _0x0347=function(_0x21aae3,_0x5ca332){_0x21aae3=_0x21aae3-0x0;var _0x350f86=_0x3470[_0x21aae3];return _0x350f86;};'use strict';var Sequelize=require(_0x0347('0x0'));module[_0x0347('0x1')]={'name':{'type':Sequelize[_0x0347('0x2')],'get':function(_0x5d2189){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x0347('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x0347('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x0347('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x0347('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x0347('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x0347('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x0347('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x0347('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x0347('0x4')](_0x0347('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x0347('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x0347('0x6'),'allowNull':![]}};
\ No newline at end of file
+var _0xeabe=['long','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB'];(function(_0x58ae33,_0xc4a0db){var _0x4d9961=function(_0x4a6bc){while(--_0x4a6bc){_0x58ae33['push'](_0x58ae33['shift']());}};_0x4d9961(++_0xc4a0db);}(_0xeabe,0x101));var _0xeeab=function(_0x455d88,_0x13e17b){_0x455d88=_0x455d88-0x0;var _0xdcdbee=_0xeabe[_0x455d88];return _0xdcdbee;};'use strict';var Sequelize=require(_0xeeab('0x0'));module[_0xeeab('0x1')]={'name':{'type':Sequelize[_0xeeab('0x2')],'get':function(_0x5243d7){return this[_0xeeab('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xeeab('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xeeab('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xeeab('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xeeab('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xeeab('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xeeab('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xeeab('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xeeab('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xeeab('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xeeab('0x6')](_0xeeab('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0xeeab('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}};
\ No newline at end of file
index a15575c..c9d502b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe2fe=['end','json','offset','limit','apply','save','update','destroy','then','error','stack','name','send','index','VoiceMailMessage','rawAttributes','model','differenceBy','keys','query','filters','intersection','attributes','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','count','show','fields','length','includeAll','include','catch','create','body','find','params','download','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','attachment;\x20filename=\x22','.wav\x22','set','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','querystring','../../components/auth/service','../../config/license/hardware','../../config/utils','sendStatus','status'];(function(_0x51136c,_0x3786b6){var _0x352a65=function(_0x26270a){while(--_0x26270a){_0x51136c['push'](_0x51136c['shift']());}};_0x352a65(++_0x3786b6);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xee2f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xee2f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee2f('0x2'));var moment=require(_0xee2f('0x3'));var BPromise=require(_0xee2f('0x4'));var Mustache=require(_0xee2f('0x5'));var util=require(_0xee2f('0x6'));var path=require('path');var sox=require(_0xee2f('0x7'));var csv=require(_0xee2f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x8'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var authService=require(_0xee2f('0xd'));var hardwareService=require(_0xee2f('0xe'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require(_0xee2f('0xf'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53047d,_0x25ddf7){_0x25ddf7=_0x25ddf7||0xcc;return function(_0x346dbc){if(_0x346dbc){return _0x53047d[_0xee2f('0x10')](_0x25ddf7);}return _0x53047d[_0xee2f('0x11')](_0x25ddf7)[_0xee2f('0x12')]();};}function respondWithResult(_0x3ab91f,_0x4faa8f){_0x4faa8f=_0x4faa8f||0xc8;return function(_0x3861e6){if(_0x3861e6){return _0x3ab91f['status'](_0x4faa8f)[_0xee2f('0x13')](_0x3861e6);}};}function respondWithFilteredResult(_0x271c1d,_0x48b30c){return function(_0x445ba8){if(_0x445ba8){var _0x145241=_0x445ba8['count'],_0x28b614=_0x48b30c[_0xee2f('0x14')],_0x1bbf7d=_0x48b30c['offset']+_0x48b30c[_0xee2f('0x15')],_0x390c2c;if(_0x1bbf7d>=_0x145241){_0x1bbf7d=_0x145241;_0x390c2c=0xc8;}else{_0x390c2c=0xce;}_0x271c1d[_0xee2f('0x11')](_0x390c2c);return _0x271c1d['set']('Content-Range',_0x28b614+'-'+_0x1bbf7d+'/'+_0x145241)[_0xee2f('0x13')](_0x445ba8);}return null;};}function patchUpdates(_0x5a5078){return function(_0x69db88){try{jsonpatch[_0xee2f('0x16')](_0x69db88,_0x5a5078,!![]);}catch(_0x28549d){return BPromise['reject'](_0x28549d);}return _0x69db88[_0xee2f('0x17')]();};}function saveUpdates(_0x1e70aa,_0x4db2cc){return function(_0x21fdf4){if(_0x21fdf4){return _0x21fdf4[_0xee2f('0x18')](_0x1e70aa)['then'](function(_0x5e73ad){return _0x5e73ad;});}return null;};}function removeEntity(_0x40d1fd,_0x3a1852){return function(_0x1ea808){if(_0x1ea808){return _0x1ea808[_0xee2f('0x19')]()[_0xee2f('0x1a')](function(){_0x40d1fd[_0xee2f('0x11')](0xcc)[_0xee2f('0x12')]();});}};}function handleEntityNotFound(_0x4d68d3,_0x250399){return function(_0x2c47c5){if(!_0x2c47c5){_0x4d68d3[_0xee2f('0x10')](0x194);}return _0x2c47c5;};}function handleError(_0x70e308,_0x820101){_0x820101=_0x820101||0x1f4;return function(_0xf77cf5){logger[_0xee2f('0x1b')](_0xf77cf5[_0xee2f('0x1c')]);if(_0xf77cf5[_0xee2f('0x1d')]){delete _0xf77cf5[_0xee2f('0x1d')];}_0x70e308[_0xee2f('0x11')](_0x820101)[_0xee2f('0x1e')](_0xf77cf5);};}exports[_0xee2f('0x1f')]=function(_0x45c4a0,_0x53f6ed){var _0x4ef690={},_0x58ba65={},_0x18bdbb={'count':0x0,'rows':[]};var _0x18ff19=db[_0xee2f('0x20')][_0xee2f('0x21')];_0x58ba65[_0xee2f('0x22')]=_[_0xee2f('0x23')](_['keys'](_0x18ff19),[_0xee2f('0x1d')]);_0x58ba65['query']=_[_0xee2f('0x24')](_0x45c4a0[_0xee2f('0x25')]);_0x58ba65[_0xee2f('0x26')]=_[_0xee2f('0x27')](_0x58ba65[_0xee2f('0x22')],_0x58ba65['query']);_0x4ef690[_0xee2f('0x28')]=_[_0xee2f('0x27')](_0x58ba65['model'],qs['fields'](_0x45c4a0[_0xee2f('0x25')]['fields']));_0x4ef690[_0xee2f('0x28')]=_0x4ef690[_0xee2f('0x28')]['length']?_0x4ef690[_0xee2f('0x28')]:_0x58ba65['model'];if(!_0x45c4a0['query']['hasOwnProperty'](_0xee2f('0x29'))){_0x4ef690[_0xee2f('0x15')]=qs['limit'](_0x45c4a0[_0xee2f('0x25')][_0xee2f('0x15')]);_0x4ef690[_0xee2f('0x14')]=qs[_0xee2f('0x14')](_0x45c4a0[_0xee2f('0x25')]['offset']);}_0x4ef690[_0xee2f('0x2a')]=qs['sort'](_0x45c4a0[_0xee2f('0x25')][_0xee2f('0x2b')]);_0x4ef690[_0xee2f('0x2c')]=qs['filters'](_[_0xee2f('0x2d')](_0x45c4a0['query'],_0x58ba65[_0xee2f('0x26')]));if(_0x45c4a0['query'][_0xee2f('0x2e')]){_0x4ef690[_0xee2f('0x2c')]=_[_0xee2f('0x2f')](_0x4ef690[_0xee2f('0x2c')],{'$or':_[_0xee2f('0x30')](_0x18ff19,function(_0x21b802){if(_0x21b802[_0xee2f('0x31')][_0xee2f('0x32')]!==_0xee2f('0x33')){var _0x252e91={};_0x252e91[_0x21b802[_0xee2f('0x34')]]={'$like':'%'+_0x45c4a0['query'][_0xee2f('0x2e')]+'%'};return _0x252e91;}})});}_0x4ef690=_['merge']({},_0x4ef690,_0x45c4a0[_0xee2f('0x35')]);var _0x3cbc01={'where':_0x4ef690[_0xee2f('0x2c')]};return db[_0xee2f('0x20')][_0xee2f('0x36')](_0x3cbc01)[_0xee2f('0x1a')](function(_0x694950){_0x18bdbb[_0xee2f('0x36')]=_0x694950;if(_0x45c4a0['query']['includeAll']){_0x4ef690['include']=[{'all':!![]}];}return db[_0xee2f('0x20')]['findAll'](_0x4ef690);})[_0xee2f('0x1a')](function(_0x51daf5){_0x18bdbb['rows']=_0x51daf5;return _0x18bdbb;})['then'](respondWithFilteredResult(_0x53f6ed,_0x4ef690))['catch'](handleError(_0x53f6ed,null));};exports[_0xee2f('0x37')]=function(_0x692686,_0x1ab34f){var _0x268775={'raw':!![],'where':{'id':_0x692686['params']['id']}},_0x4823a7={};_0x4823a7[_0xee2f('0x22')]=_['keys'](db['VoiceMailMessage'][_0xee2f('0x21')]);_0x4823a7[_0xee2f('0x25')]=_[_0xee2f('0x24')](_0x692686['query']);_0x4823a7[_0xee2f('0x26')]=_[_0xee2f('0x27')](_0x4823a7[_0xee2f('0x22')],_0x4823a7['query']);_0x268775['attributes']=_[_0xee2f('0x27')](_0x4823a7[_0xee2f('0x22')],qs[_0xee2f('0x38')](_0x692686[_0xee2f('0x25')]['fields']));_0x268775[_0xee2f('0x28')]=_0x268775[_0xee2f('0x28')][_0xee2f('0x39')]?_0x268775[_0xee2f('0x28')]:_0x4823a7[_0xee2f('0x22')];if(_0x692686[_0xee2f('0x25')][_0xee2f('0x3a')]){_0x268775[_0xee2f('0x3b')]=[{'all':!![]}];}_0x268775=_[_0xee2f('0x2f')]({},_0x268775,_0x692686[_0xee2f('0x35')]);return db['VoiceMailMessage']['find'](_0x268775)['then'](handleEntityNotFound(_0x1ab34f,null))['then'](respondWithResult(_0x1ab34f,null))[_0xee2f('0x3c')](handleError(_0x1ab34f,null));};exports[_0xee2f('0x3d')]=function(_0x34ce9c,_0x12aaa0){return db[_0xee2f('0x20')]['create'](_0x34ce9c[_0xee2f('0x3e')],{})[_0xee2f('0x1a')](respondWithResult(_0x12aaa0,0xc9))[_0xee2f('0x3c')](handleError(_0x12aaa0,null));};exports[_0xee2f('0x18')]=function(_0x57f493,_0x5c887b){if(_0x57f493['body']['id']){delete _0x57f493[_0xee2f('0x3e')]['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x57f493['params']['id']}})['then'](handleEntityNotFound(_0x5c887b,null))[_0xee2f('0x1a')](saveUpdates(_0x57f493[_0xee2f('0x3e')],null))[_0xee2f('0x1a')](respondWithResult(_0x5c887b,null))['catch'](handleError(_0x5c887b,null));};exports[_0xee2f('0x19')]=function(_0x57f65d,_0x3d95b8){return db[_0xee2f('0x20')][_0xee2f('0x3f')]({'where':{'id':_0x57f65d[_0xee2f('0x40')]['id']}})[_0xee2f('0x1a')](handleEntityNotFound(_0x3d95b8,null))['then'](removeEntity(_0x3d95b8,null))['catch'](handleError(_0x3d95b8,null));};exports[_0xee2f('0x41')]=function(_0x59bd48,_0x2b6beb,_0x282e89){return db[_0xee2f('0x20')][_0xee2f('0x3f')]({'where':{'id':_0x59bd48['params']['id']},'attributes':['id','recording',_0xee2f('0x42')]})[_0xee2f('0x1a')](handleEntityNotFound(_0x2b6beb,null))[_0xee2f('0x1a')](function(_0x2189ff){if(_0x2189ff){if(!_0x2189ff[_0xee2f('0x43')]){throw new db[(_0xee2f('0x44'))][(_0xee2f('0x45'))](_0xee2f('0x46'));}var _0x3bf2b6={'Content-Type':_0xee2f('0x47'),'Content-Disposition':_0xee2f('0x48')};if(_0x2189ff[_0xee2f('0x42')]){_0x3bf2b6['Content-Disposition']=_0xee2f('0x49')+_0x2189ff[_0xee2f('0x42')]+_0xee2f('0x4a');}_0x2b6beb[_0xee2f('0x4b')](_0x3bf2b6);return _0x2b6beb['send'](new Buffer(_0x2189ff[_0xee2f('0x43')]));}})[_0xee2f('0x3c')](handleError(_0x2b6beb,null));};
\ No newline at end of file
+var _0xa809=['sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','reject','save','then','destroy','error','stack','name','send','VoiceMailMessage','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','type','key','VIRTUAL','options','include','findAll','catch','params','find','create','body','download','recording','msg_id','VoiceMailMessage\x20not\x20found','Content-Disposition','.wav\x22','set','eml-format','fast-json-patch','mustache','util','path'];(function(_0x4e16ba,_0x5ce572){var _0xb1c830=function(_0x3a74c3){while(--_0x3a74c3){_0x4e16ba['push'](_0x4e16ba['shift']());}};_0xb1c830(++_0x5ce572);}(_0xa809,0x1f3));var _0x9a80=function(_0xacb4c1,_0x48e800){_0xacb4c1=_0xacb4c1-0x0;var _0x49ff5b=_0xa809[_0xacb4c1];return _0x49ff5b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9a80('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9a80('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9a80('0x2'));var util=require(_0x9a80('0x3'));var path=require(_0x9a80('0x4'));var sox=require(_0x9a80('0x5'));var csv=require('to-csv');var ejs=require(_0x9a80('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9a80('0x7'));var crypto=require(_0x9a80('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x9a80('0x9'));var toCsv=require(_0x9a80('0xa'));var querystring=require(_0x9a80('0xb'));var Papa=require(_0x9a80('0xc'));var authService=require('../../components/auth/service');var hardwareService=require(_0x9a80('0xd'));var Redis=require(_0x9a80('0xe'));var qs=require(_0x9a80('0xf'));var logger=require(_0x9a80('0x10'))(_0x9a80('0x11'));var utils=require(_0x9a80('0x12'));var config=require(_0x9a80('0x13'));var db=require(_0x9a80('0x14'))['db'];function respondWithStatusCode(_0x5cc5a5,_0x3a7436){_0x3a7436=_0x3a7436||0xcc;return function(_0x4dc0a5){if(_0x4dc0a5){return _0x5cc5a5[_0x9a80('0x15')](_0x3a7436);}return _0x5cc5a5[_0x9a80('0x16')](_0x3a7436)[_0x9a80('0x17')]();};}function respondWithResult(_0x32bb69,_0x25f667){_0x25f667=_0x25f667||0xc8;return function(_0x20a68a){if(_0x20a68a){return _0x32bb69['status'](_0x25f667)[_0x9a80('0x18')](_0x20a68a);}};}function respondWithFilteredResult(_0x5ce1ba,_0x384be7){return function(_0x109066){if(_0x109066){var _0x3625b0=_0x109066[_0x9a80('0x19')],_0x5181b5=_0x384be7[_0x9a80('0x1a')],_0x3f393c=_0x384be7[_0x9a80('0x1a')]+_0x384be7['limit'],_0x10445f;if(_0x3f393c>=_0x3625b0){_0x3f393c=_0x3625b0;_0x10445f=0xc8;}else{_0x10445f=0xce;}_0x5ce1ba[_0x9a80('0x16')](_0x10445f);return _0x5ce1ba['set'](_0x9a80('0x1b'),_0x5181b5+'-'+_0x3f393c+'/'+_0x3625b0)[_0x9a80('0x18')](_0x109066);}return null;};}function patchUpdates(_0x450cac){return function(_0x3c2ae0){try{jsonpatch['apply'](_0x3c2ae0,_0x450cac,!![]);}catch(_0x47cfe4){return BPromise[_0x9a80('0x1c')](_0x47cfe4);}return _0x3c2ae0[_0x9a80('0x1d')]();};}function saveUpdates(_0xb45615,_0x43882e){return function(_0x42e054){if(_0x42e054){return _0x42e054['update'](_0xb45615)[_0x9a80('0x1e')](function(_0x252fd6){return _0x252fd6;});}return null;};}function removeEntity(_0x445c04,_0x52f6cd){return function(_0x55ce38){if(_0x55ce38){return _0x55ce38[_0x9a80('0x1f')]()['then'](function(){_0x445c04[_0x9a80('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x125731,_0x5e164f){return function(_0x2601c7){if(!_0x2601c7){_0x125731[_0x9a80('0x15')](0x194);}return _0x2601c7;};}function handleError(_0x20a4e7,_0x2ae2a2){_0x2ae2a2=_0x2ae2a2||0x1f4;return function(_0x33a169){logger[_0x9a80('0x20')](_0x33a169[_0x9a80('0x21')]);if(_0x33a169[_0x9a80('0x22')]){delete _0x33a169['name'];}_0x20a4e7[_0x9a80('0x16')](_0x2ae2a2)[_0x9a80('0x23')](_0x33a169);};}exports['index']=function(_0x3508d7,_0xce9acf){var _0x55fabc={},_0x3e6a80={},_0x1bed50={'count':0x0,'rows':[]};var _0x28ce35=db[_0x9a80('0x24')][_0x9a80('0x25')];_0x3e6a80[_0x9a80('0x26')]=_['differenceBy'](_[_0x9a80('0x27')](_0x28ce35),[_0x9a80('0x22')]);_0x3e6a80[_0x9a80('0x28')]=_[_0x9a80('0x27')](_0x3508d7[_0x9a80('0x28')]);_0x3e6a80['filters']=_[_0x9a80('0x29')](_0x3e6a80[_0x9a80('0x26')],_0x3e6a80[_0x9a80('0x28')]);_0x55fabc[_0x9a80('0x2a')]=_['intersection'](_0x3e6a80[_0x9a80('0x26')],qs[_0x9a80('0x2b')](_0x3508d7[_0x9a80('0x28')][_0x9a80('0x2b')]));_0x55fabc['attributes']=_0x55fabc[_0x9a80('0x2a')][_0x9a80('0x2c')]?_0x55fabc['attributes']:_0x3e6a80[_0x9a80('0x26')];if(!_0x3508d7[_0x9a80('0x28')][_0x9a80('0x2d')](_0x9a80('0x2e'))){_0x55fabc['limit']=qs[_0x9a80('0x2f')](_0x3508d7[_0x9a80('0x28')][_0x9a80('0x2f')]);_0x55fabc[_0x9a80('0x1a')]=qs[_0x9a80('0x1a')](_0x3508d7[_0x9a80('0x28')][_0x9a80('0x1a')]);}_0x55fabc[_0x9a80('0x30')]=qs[_0x9a80('0x31')](_0x3508d7[_0x9a80('0x28')][_0x9a80('0x31')]);_0x55fabc[_0x9a80('0x32')]=qs[_0x9a80('0x33')](_[_0x9a80('0x34')](_0x3508d7[_0x9a80('0x28')],_0x3e6a80['filters']));if(_0x3508d7['query']['filter']){_0x55fabc[_0x9a80('0x32')]=_[_0x9a80('0x35')](_0x55fabc[_0x9a80('0x32')],{'$or':_['map'](_0x28ce35,function(_0x16b0f0){if(_0x16b0f0[_0x9a80('0x36')][_0x9a80('0x37')]!==_0x9a80('0x38')){var _0x4dee01={};_0x4dee01[_0x16b0f0['field']]={'$like':'%'+_0x3508d7['query']['filter']+'%'};return _0x4dee01;}})});}_0x55fabc=_[_0x9a80('0x35')]({},_0x55fabc,_0x3508d7[_0x9a80('0x39')]);var _0x2a6c5b={'where':_0x55fabc['where']};return db[_0x9a80('0x24')]['count'](_0x2a6c5b)[_0x9a80('0x1e')](function(_0x1ea1f2){_0x1bed50[_0x9a80('0x19')]=_0x1ea1f2;if(_0x3508d7[_0x9a80('0x28')]['includeAll']){_0x55fabc[_0x9a80('0x3a')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x9a80('0x3b')](_0x55fabc);})[_0x9a80('0x1e')](function(_0x5e036b){_0x1bed50['rows']=_0x5e036b;return _0x1bed50;})['then'](respondWithFilteredResult(_0xce9acf,_0x55fabc))[_0x9a80('0x3c')](handleError(_0xce9acf,null));};exports['show']=function(_0x24f9ba,_0x139532){var _0x1b10ed={'raw':!![],'where':{'id':_0x24f9ba[_0x9a80('0x3d')]['id']}},_0x460c7a={};_0x460c7a[_0x9a80('0x26')]=_[_0x9a80('0x27')](db[_0x9a80('0x24')]['rawAttributes']);_0x460c7a[_0x9a80('0x28')]=_[_0x9a80('0x27')](_0x24f9ba[_0x9a80('0x28')]);_0x460c7a[_0x9a80('0x33')]=_[_0x9a80('0x29')](_0x460c7a['model'],_0x460c7a['query']);_0x1b10ed[_0x9a80('0x2a')]=_[_0x9a80('0x29')](_0x460c7a[_0x9a80('0x26')],qs[_0x9a80('0x2b')](_0x24f9ba[_0x9a80('0x28')][_0x9a80('0x2b')]));_0x1b10ed[_0x9a80('0x2a')]=_0x1b10ed[_0x9a80('0x2a')][_0x9a80('0x2c')]?_0x1b10ed[_0x9a80('0x2a')]:_0x460c7a['model'];if(_0x24f9ba[_0x9a80('0x28')]['includeAll']){_0x1b10ed[_0x9a80('0x3a')]=[{'all':!![]}];}_0x1b10ed=_[_0x9a80('0x35')]({},_0x1b10ed,_0x24f9ba['options']);return db[_0x9a80('0x24')][_0x9a80('0x3e')](_0x1b10ed)['then'](handleEntityNotFound(_0x139532,null))['then'](respondWithResult(_0x139532,null))[_0x9a80('0x3c')](handleError(_0x139532,null));};exports[_0x9a80('0x3f')]=function(_0x1137ad,_0x1aeeca){return db['VoiceMailMessage']['create'](_0x1137ad[_0x9a80('0x40')],{})[_0x9a80('0x1e')](respondWithResult(_0x1aeeca,0xc9))[_0x9a80('0x3c')](handleError(_0x1aeeca,null));};exports['update']=function(_0x2d30e7,_0x52f478){if(_0x2d30e7[_0x9a80('0x40')]['id']){delete _0x2d30e7[_0x9a80('0x40')]['id'];}return db['VoiceMailMessage'][_0x9a80('0x3e')]({'where':{'id':_0x2d30e7[_0x9a80('0x3d')]['id']}})[_0x9a80('0x1e')](handleEntityNotFound(_0x52f478,null))[_0x9a80('0x1e')](saveUpdates(_0x2d30e7[_0x9a80('0x40')],null))['then'](respondWithResult(_0x52f478,null))['catch'](handleError(_0x52f478,null));};exports['destroy']=function(_0x55b5f2,_0xfee655){return db[_0x9a80('0x24')][_0x9a80('0x3e')]({'where':{'id':_0x55b5f2[_0x9a80('0x3d')]['id']}})[_0x9a80('0x1e')](handleEntityNotFound(_0xfee655,null))['then'](removeEntity(_0xfee655,null))[_0x9a80('0x3c')](handleError(_0xfee655,null));};exports[_0x9a80('0x41')]=function(_0x39c462,_0x2867df,_0x124e31){return db['VoiceMailMessage']['find']({'where':{'id':_0x39c462[_0x9a80('0x3d')]['id']},'attributes':['id',_0x9a80('0x42'),_0x9a80('0x43')]})[_0x9a80('0x1e')](handleEntityNotFound(_0x2867df,null))[_0x9a80('0x1e')](function(_0x364b38){if(_0x364b38){if(!_0x364b38[_0x9a80('0x42')]){throw new db['Sequelize']['ValidationError'](_0x9a80('0x44'));}var _0x472dc3={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x364b38[_0x9a80('0x43')]){_0x472dc3[_0x9a80('0x45')]='attachment;\x20filename=\x22'+_0x364b38[_0x9a80('0x43')]+_0x9a80('0x46');}_0x2867df[_0x9a80('0x47')](_0x472dc3);return _0x2867df[_0x9a80('0x23')](new Buffer(_0x364b38['recording']));}})['catch'](handleError(_0x2867df,null));};
\ No newline at end of file
index 24b92bc..82208df 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd5fb=['util','../../config/logger','moment','bluebird','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash'];(function(_0x813f30,_0x140254){var _0x4048d9=function(_0x541996){while(--_0x541996){_0x813f30['push'](_0x813f30['shift']());}};_0x4048d9(++_0x140254);}(_0xd5fb,0xb3));var _0xbd5f=function(_0x5454e2,_0x576f66){_0x5454e2=_0x5454e2-0x0;var _0x5b9409=_0xd5fb[_0x5454e2];return _0x5b9409;};'use strict';var _=require(_0xbd5f('0x0'));var util=require(_0xbd5f('0x1'));var logger=require(_0xbd5f('0x2'))('api');var moment=require(_0xbd5f('0x3'));var BPromise=require(_0xbd5f('0x4'));var rp=require('request-promise');var attributes=require('./voiceMailMessage.attributes');module[_0xbd5f('0x5')]=function(_0x44f2f1,_0x48d988){return _0x44f2f1[_0xbd5f('0x6')](_0xbd5f('0x7'),attributes,{'tableName':_0xbd5f('0x8'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0xbd5f('0x9')]}],'timestamps':![]});};
\ No newline at end of file
+var _0x692c=['VoiceMailMessage','dir','lodash','util','../../config/logger','api','moment','bluebird','./voiceMailMessage.attributes','define'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0x692c,0x160));var _0xc692=function(_0x261639,_0xf50862){_0x261639=_0x261639-0x0;var _0x1ce28a=_0x692c[_0x261639];return _0x1ce28a;};'use strict';var _=require(_0xc692('0x0'));var util=require(_0xc692('0x1'));var logger=require(_0xc692('0x2'))(_0xc692('0x3'));var moment=require(_0xc692('0x4'));var BPromise=require(_0xc692('0x5'));var rp=require('request-promise');var attributes=require(_0xc692('0x6'));module['exports']=function(_0xa55d22,_0x1eda46){return _0xa55d22[_0xc692('0x7')](_0xc692('0x8'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','fields':[_0xc692('0x9')]}],'timestamps':![]});};
\ No newline at end of file
index 5d75124..a681f3a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa7c5=['jayson/promise','client','http','request','info','request\x20sent','debug','error','message','VoiceMailMessage,\x20%s,\x20%s','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3fb5c3,_0x5b134d){var _0x2f3dbc=function(_0x49066d){while(--_0x49066d){_0x3fb5c3['push'](_0x3fb5c3['shift']());}};_0x2f3dbc(++_0x5b134d);}(_0xa7c5,0x8a));var _0x5a7c=function(_0xffe87b,_0x3daf3f){_0xffe87b=_0xffe87b-0x0;var _0xfdcc47=_0xa7c5[_0xffe87b];return _0xfdcc47;};'use strict';var _=require(_0x5a7c('0x0'));var util=require(_0x5a7c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5a7c('0x2'));var fs=require('fs');var Redis=require(_0x5a7c('0x3'));var db=require(_0x5a7c('0x4'))['db'];var utils=require(_0x5a7c('0x5'));var logger=require(_0x5a7c('0x6'))(_0x5a7c('0x7'));var config=require(_0x5a7c('0x8'));var jayson=require(_0x5a7c('0x9'));var client=jayson[_0x5a7c('0xa')][_0x5a7c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4573c7,_0x57ec6c,_0x45992b){return new BPromise(function(_0x4d4cd0,_0xc9ab25){return client[_0x5a7c('0xc')](_0x4573c7,_0x45992b)['then'](function(_0x1e89c2){logger[_0x5a7c('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x57ec6c,_0x5a7c('0xe'));logger[_0x5a7c('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x57ec6c,'request\x20sent',JSON['stringify'](_0x1e89c2));if(_0x1e89c2[_0x5a7c('0x10')]){if(_0x1e89c2[_0x5a7c('0x10')]['code']===0x1f4){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x57ec6c,_0x1e89c2[_0x5a7c('0x10')]['message']);return _0xc9ab25(_0x1e89c2[_0x5a7c('0x10')][_0x5a7c('0x11')]);}logger[_0x5a7c('0x10')](_0x5a7c('0x12'),_0x57ec6c,_0x1e89c2[_0x5a7c('0x10')][_0x5a7c('0x11')]);return _0x4d4cd0(_0x1e89c2['error']['message']);}else{logger[_0x5a7c('0xd')](_0x5a7c('0x12'),_0x57ec6c,_0x5a7c('0xe'));_0x4d4cd0(_0x1e89c2[_0x5a7c('0x13')][_0x5a7c('0x11')]);}})[_0x5a7c('0x14')](function(_0x1c96da){logger[_0x5a7c('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x57ec6c,_0x1c96da);_0xc9ab25(_0x1c96da);});});}
\ No newline at end of file
+var _0xb590=['jayson/promise','client','http','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x555488,_0x242026){var _0x3c6772=function(_0x3d0682){while(--_0x3d0682){_0x555488['push'](_0x555488['shift']());}};_0x3c6772(++_0x242026);}(_0xb590,0x10a));var _0x0b59=function(_0x343600,_0xa5f471){_0x343600=_0x343600-0x0;var _0x284589=_0xb590[_0x343600];return _0x284589;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0b59('0x0'));var BPromise=require(_0x0b59('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b59('0x2'));var db=require(_0x0b59('0x3'))['db'];var utils=require(_0x0b59('0x4'));var logger=require(_0x0b59('0x5'))('rpc');var config=require(_0x0b59('0x6'));var jayson=require(_0x0b59('0x7'));var client=jayson[_0x0b59('0x8')][_0x0b59('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d68f9,_0x56ffd2,_0x2e314c){return new BPromise(function(_0x34ab85,_0xf3ef4c){return client[_0x0b59('0xa')](_0x4d68f9,_0x2e314c)[_0x0b59('0xb')](function(_0x59cd27){logger['info'](_0x0b59('0xc'),_0x56ffd2,_0x0b59('0xd'));logger[_0x0b59('0xe')](_0x0b59('0xf'),_0x56ffd2,_0x0b59('0xd'),JSON['stringify'](_0x59cd27));if(_0x59cd27[_0x0b59('0x10')]){if(_0x59cd27[_0x0b59('0x10')]['code']===0x1f4){logger[_0x0b59('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x56ffd2,_0x59cd27['error'][_0x0b59('0x11')]);return _0xf3ef4c(_0x59cd27[_0x0b59('0x10')][_0x0b59('0x11')]);}logger[_0x0b59('0x10')](_0x0b59('0xc'),_0x56ffd2,_0x59cd27[_0x0b59('0x10')]['message']);return _0x34ab85(_0x59cd27[_0x0b59('0x10')]['message']);}else{logger[_0x0b59('0x12')](_0x0b59('0xc'),_0x56ffd2,_0x0b59('0xd'));_0x34ab85(_0x59cd27[_0x0b59('0x13')][_0x0b59('0x11')]);}})[_0x0b59('0x14')](function(_0x45143c){logger[_0x0b59('0x10')](_0x0b59('0xc'),_0x56ffd2,_0x45143c);_0xf3ef4c(_0x45143c);});});}
\ No newline at end of file
index 797971e..b8b61a2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd404=['create','post','/:id/sounds','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show'];(function(_0x149db3,_0x4a0a32){var _0x1b4d54=function(_0x24e355){while(--_0x24e355){_0x149db3['push'](_0x149db3['shift']());}};_0x1b4d54(++_0x4a0a32);}(_0xd404,0x15b));var _0x4d40=function(_0x3df7ed,_0x22ac04){_0x3df7ed=_0x3df7ed-0x0;var _0x2b2819=_0xd404[_0x3df7ed];return _0x2b2819;};'use strict';var multer=require(_0x4d40('0x0'));var util=require(_0x4d40('0x1'));var path=require('path');var timeout=require(_0x4d40('0x2'));var express=require(_0x4d40('0x3'));var router=express['Router']();var auth=require(_0x4d40('0x4'));var interaction=require(_0x4d40('0x5'));var config=require(_0x4d40('0x6'));var controller=require(_0x4d40('0x7'));router[_0x4d40('0x8')]('/',auth[_0x4d40('0x9')](),controller[_0x4d40('0xa')]);router[_0x4d40('0x8')](_0x4d40('0xb'),auth['isAuthenticated'](),controller[_0x4d40('0xc')]);router[_0x4d40('0x8')]('/:id/sounds',auth[_0x4d40('0x9')](),controller['getSounds']);router['post']('/',auth[_0x4d40('0x9')](),controller[_0x4d40('0xd')]);router[_0x4d40('0xe')](_0x4d40('0xf'),auth[_0x4d40('0x9')](),controller[_0x4d40('0x10')]);router[_0x4d40('0x11')](_0x4d40('0xb'),auth[_0x4d40('0x9')](),controller[_0x4d40('0x12')]);router[_0x4d40('0x13')](_0x4d40('0xb'),auth[_0x4d40('0x9')](),controller[_0x4d40('0x14')]);router['delete'](_0x4d40('0x15'),auth[_0x4d40('0x9')](),controller[_0x4d40('0x16')]);module[_0x4d40('0x17')]=router;
\ No newline at end of file
+var _0x153f=['/:id/sounds','getSounds','post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x54d777,_0x4cc39f){var _0x5763eb=function(_0x3b7c54){while(--_0x3b7c54){_0x54d777['push'](_0x54d777['shift']());}};_0x5763eb(++_0x4cc39f);}(_0x153f,0x15b));var _0xf153=function(_0x282604,_0x11f7d1){_0x282604=_0x282604-0x0;var _0x485e54=_0x153f[_0x282604];return _0x485e54;};'use strict';var multer=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var path=require(_0xf153('0x2'));var timeout=require(_0xf153('0x3'));var express=require(_0xf153('0x4'));var router=express[_0xf153('0x5')]();var auth=require(_0xf153('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf153('0x7'));var controller=require('./voiceMusicOnHold.controller');router[_0xf153('0x8')]('/',auth[_0xf153('0x9')](),controller[_0xf153('0xa')]);router[_0xf153('0x8')](_0xf153('0xb'),auth['isAuthenticated'](),controller[_0xf153('0xc')]);router[_0xf153('0x8')](_0xf153('0xd'),auth[_0xf153('0x9')](),controller[_0xf153('0xe')]);router[_0xf153('0xf')]('/',auth[_0xf153('0x9')](),controller[_0xf153('0x10')]);router[_0xf153('0xf')](_0xf153('0xd'),auth['isAuthenticated'](),controller[_0xf153('0x11')]);router[_0xf153('0x12')](_0xf153('0xb'),auth['isAuthenticated'](),controller[_0xf153('0x13')]);router[_0xf153('0x14')](_0xf153('0xb'),auth[_0xf153('0x9')](),controller[_0xf153('0x15')]);router[_0xf153('0x14')](_0xf153('0x16'),auth[_0xf153('0x9')](),controller[_0xf153('0x17')]);module['exports']=router;
\ No newline at end of file
index eac876a..c6d392d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5d71=['alpha','TIMESTAMP','BOOLEAN','sequelize','STRING','name','custom','files','mp3nb','mp3'];(function(_0x2e43d4,_0x188315){var _0x144cf9=function(_0x1ecf14){while(--_0x1ecf14){_0x2e43d4['push'](_0x2e43d4['shift']());}};_0x144cf9(++_0x188315);}(_0x5d71,0x175));var _0x15d7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5d71[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x15d7('0x0'));module['exports']={'name':{'type':Sequelize[_0x15d7('0x1')],'allowNull':![],'unique':_0x15d7('0x2')},'mode':{'type':Sequelize['ENUM'](_0x15d7('0x3'),_0x15d7('0x4'),_0x15d7('0x5'),'quietmp3nb','quietmp3',_0x15d7('0x6')),'allowNull':!![],'defaultValue':_0x15d7('0x4')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x15d7('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x15d7('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x15d7('0x1')],'allowNull':!![],'defaultValue':_0x15d7('0x7')},'format':{'type':Sequelize[_0x15d7('0x1')],'allowNull':!![]},'stamp':{'type':_0x15d7('0x8')},'defaultEntry':{'type':Sequelize[_0x15d7('0x9')],'defaultValue':0x0}};
\ No newline at end of file
+var _0xd099=['quietmp3','mp3','files','alpha','BOOLEAN','sequelize','STRING','name','ENUM','custom','mp3nb'];(function(_0x3484bf,_0x284123){var _0x3de249=function(_0x2fb702){while(--_0x2fb702){_0x3484bf['push'](_0x3484bf['shift']());}};_0x3de249(++_0x284123);}(_0xd099,0xcb));var _0x9d09=function(_0x432af8,_0x477b3d){_0x432af8=_0x432af8-0x0;var _0x228f4f=_0xd099[_0x432af8];return _0x228f4f;};'use strict';var Sequelize=require(_0x9d09('0x0'));module['exports']={'name':{'type':Sequelize[_0x9d09('0x1')],'allowNull':![],'unique':_0x9d09('0x2')},'mode':{'type':Sequelize[_0x9d09('0x3')](_0x9d09('0x4'),'files',_0x9d09('0x5'),'quietmp3nb',_0x9d09('0x6'),_0x9d09('0x7')),'allowNull':!![],'defaultValue':_0x9d09('0x8')},'directory':{'type':Sequelize[_0x9d09('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x9d09('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x9d09('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x9d09('0x1')],'allowNull':!![],'defaultValue':_0x9d09('0x9')},'format':{'type':Sequelize[_0x9d09('0x1')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x9d09('0xa')],'defaultValue':0x0}};
\ No newline at end of file
index 3605918..b123818 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8523=['symlinkSync','Sequelize','ValidationError','removeSound','findOne','getSounds','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','send','index','VoiceMusicOnHold','rawAttributes','model','keys','query','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','map','type','key','field','count','includeAll','include','findAll','rows','catch','params','options','find','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','name','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','unlinkSync','rmdirSync','message','addSound','Sound','save_name','converted_format','createdAt','%s.%s','basename','extname','format'];(function(_0x1cb376,_0xc56ab3){var _0x30bd31=function(_0x4a765c){while(--_0x4a765c){_0x1cb376['push'](_0x1cb376['shift']());}};_0x30bd31(++_0xc56ab3);}(_0x8523,0x160));var _0x3852=function(_0x1217cf,_0x1171dc){_0x1217cf=_0x1217cf-0x0;var _0x280148=_0x8523[_0x1217cf];return _0x280148;};'use strict';var pdf=require(_0x3852('0x0'));var emlformat=require(_0x3852('0x1'));var rimraf=require(_0x3852('0x2'));var zipdir=require(_0x3852('0x3'));var jsonpatch=require(_0x3852('0x4'));var rp=require(_0x3852('0x5'));var moment=require(_0x3852('0x6'));var BPromise=require(_0x3852('0x7'));var Mustache=require(_0x3852('0x8'));var util=require(_0x3852('0x9'));var path=require(_0x3852('0xa'));var sox=require(_0x3852('0xb'));var csv=require(_0x3852('0xc'));var ejs=require(_0x3852('0xd'));var fs=require('fs');var _=require(_0x3852('0xe'));var squel=require('squel');var crypto=require(_0x3852('0xf'));var jsforce=require(_0x3852('0x10'));var deskjs=require(_0x3852('0x11'));var toCsv=require(_0x3852('0xc'));var querystring=require(_0x3852('0x12'));var Papa=require(_0x3852('0x13'));var authService=require(_0x3852('0x14'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x3852('0x15'));var qs=require(_0x3852('0x16'));var logger=require(_0x3852('0x17'))(_0x3852('0x18'));var utils=require(_0x3852('0x19'));var config=require(_0x3852('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5bf94a,_0x23d8e6){_0x23d8e6=_0x23d8e6||0xcc;return function(_0x2ec042){if(_0x2ec042){return _0x5bf94a['sendStatus'](_0x23d8e6);}return _0x5bf94a[_0x3852('0x1b')](_0x23d8e6)[_0x3852('0x1c')]();};}function respondWithResult(_0x173195,_0x46ff20){_0x46ff20=_0x46ff20||0xc8;return function(_0x5b91ac){if(_0x5b91ac){return _0x173195[_0x3852('0x1b')](_0x46ff20)[_0x3852('0x1d')](_0x5b91ac);}};}function respondWithFilteredResult(_0x44224a,_0x362e7b){return function(_0x39933b){if(_0x39933b){var _0x32b319=_0x39933b['count'],_0x126bb9=_0x362e7b[_0x3852('0x1e')],_0x4c7a31=_0x362e7b[_0x3852('0x1e')]+_0x362e7b[_0x3852('0x1f')],_0x239e65;if(_0x4c7a31>=_0x32b319){_0x4c7a31=_0x32b319;_0x239e65=0xc8;}else{_0x239e65=0xce;}_0x44224a['status'](_0x239e65);return _0x44224a[_0x3852('0x20')](_0x3852('0x21'),_0x126bb9+'-'+_0x4c7a31+'/'+_0x32b319)[_0x3852('0x1d')](_0x39933b);}return null;};}function patchUpdates(_0x4fbfd5){return function(_0x168284){try{jsonpatch[_0x3852('0x22')](_0x168284,_0x4fbfd5,!![]);}catch(_0x19406b){return BPromise[_0x3852('0x23')](_0x19406b);}return _0x168284['save']();};}function saveUpdates(_0x149c0e,_0x2310db){return function(_0x372ee7){if(_0x372ee7){return _0x372ee7[_0x3852('0x24')](_0x149c0e)[_0x3852('0x25')](function(_0xc41fe7){return _0xc41fe7;});}return null;};}function removeEntity(_0x2d5240,_0x4e4ebd){return function(_0x4df98e){if(_0x4df98e){return _0x4df98e[_0x3852('0x26')]()[_0x3852('0x25')](function(){var _0x547332=_0x4df98e[_0x3852('0x27')]({'plain':!![]});var _0x27796e='MusicOnHolds';return db[_0x3852('0x28')][_0x3852('0x26')]({'where':{'type':_0x27796e,'resourceId':_0x547332['id']}})[_0x3852('0x25')](function(){return _0x4df98e;});})[_0x3852('0x25')](function(){_0x2d5240[_0x3852('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57e6c1,_0x15a875){return function(_0xf9ff35){if(!_0xf9ff35){_0x57e6c1[_0x3852('0x29')](0x194);}return _0xf9ff35;};}function handleError(_0x1f488e,_0x191c0e){_0x191c0e=_0x191c0e||0x1f4;return function(_0x90c8c){logger[_0x3852('0x2a')](_0x90c8c[_0x3852('0x2b')]);if(_0x90c8c['name']){delete _0x90c8c['name'];}_0x1f488e[_0x3852('0x1b')](_0x191c0e)[_0x3852('0x2c')](_0x90c8c);};}exports[_0x3852('0x2d')]=function(_0x1eb608,_0x2338d0){var _0x5990b2={},_0x48f0c9={},_0x5b5357={'count':0x0,'rows':[]};var _0x531d6e=db[_0x3852('0x2e')][_0x3852('0x2f')];_0x48f0c9[_0x3852('0x30')]=_[_0x3852('0x31')](_0x531d6e);_0x48f0c9[_0x3852('0x32')]=_[_0x3852('0x31')](_0x1eb608[_0x3852('0x32')]);_0x48f0c9['filters']=_['intersection'](_0x48f0c9[_0x3852('0x30')],_0x48f0c9['query']);_0x5990b2[_0x3852('0x33')]=_[_0x3852('0x34')](_0x48f0c9[_0x3852('0x30')],qs[_0x3852('0x35')](_0x1eb608[_0x3852('0x32')][_0x3852('0x35')]));_0x5990b2[_0x3852('0x33')]=_0x5990b2[_0x3852('0x33')][_0x3852('0x36')]?_0x5990b2[_0x3852('0x33')]:_0x48f0c9[_0x3852('0x30')];if(!_0x1eb608[_0x3852('0x32')]['hasOwnProperty'](_0x3852('0x37'))){_0x5990b2['limit']=qs[_0x3852('0x1f')](_0x1eb608['query'][_0x3852('0x1f')]);_0x5990b2[_0x3852('0x1e')]=qs['offset'](_0x1eb608[_0x3852('0x32')]['offset']);}_0x5990b2[_0x3852('0x38')]=qs[_0x3852('0x39')](_0x1eb608[_0x3852('0x32')][_0x3852('0x39')]);_0x5990b2['where']=qs[_0x3852('0x3a')](_[_0x3852('0x3b')](_0x1eb608[_0x3852('0x32')],_0x48f0c9['filters']));if(_0x1eb608['query'][_0x3852('0x3c')]){_0x5990b2[_0x3852('0x3d')]=_[_0x3852('0x3e')](_0x5990b2[_0x3852('0x3d')],{'$or':_[_0x3852('0x3f')](_0x531d6e,function(_0x3b528f){if(_0x3b528f[_0x3852('0x40')][_0x3852('0x41')]!=='VIRTUAL'){var _0x363ffc={};_0x363ffc[_0x3b528f[_0x3852('0x42')]]={'$like':'%'+_0x1eb608[_0x3852('0x32')][_0x3852('0x3c')]+'%'};return _0x363ffc;}})});}_0x5990b2=_[_0x3852('0x3e')]({},_0x5990b2,_0x1eb608['options']);var _0x247cb7={'where':_0x5990b2[_0x3852('0x3d')]};return db[_0x3852('0x2e')]['count'](_0x247cb7)['then'](function(_0x13ce88){_0x5b5357[_0x3852('0x43')]=_0x13ce88;if(_0x1eb608[_0x3852('0x32')][_0x3852('0x44')]){_0x5990b2[_0x3852('0x45')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x3852('0x46')](_0x5990b2);})[_0x3852('0x25')](function(_0x132ad6){_0x5b5357[_0x3852('0x47')]=_0x132ad6;return _0x5b5357;})[_0x3852('0x25')](respondWithFilteredResult(_0x2338d0,_0x5990b2))[_0x3852('0x48')](handleError(_0x2338d0,null));};exports['show']=function(_0xbbca67,_0x3591e0){var _0x493344={'raw':![],'where':{'id':_0xbbca67[_0x3852('0x49')]['id']}},_0x4c457d={};_0x4c457d['model']=_[_0x3852('0x31')](db[_0x3852('0x2e')][_0x3852('0x2f')]);_0x4c457d[_0x3852('0x32')]=_[_0x3852('0x31')](_0xbbca67[_0x3852('0x32')]);_0x4c457d[_0x3852('0x3a')]=_[_0x3852('0x34')](_0x4c457d['model'],_0x4c457d[_0x3852('0x32')]);_0x493344[_0x3852('0x33')]=_['intersection'](_0x4c457d['model'],qs[_0x3852('0x35')](_0xbbca67['query'][_0x3852('0x35')]));_0x493344[_0x3852('0x33')]=_0x493344[_0x3852('0x33')][_0x3852('0x36')]?_0x493344['attributes']:_0x4c457d[_0x3852('0x30')];if(_0xbbca67[_0x3852('0x32')][_0x3852('0x44')]){_0x493344[_0x3852('0x45')]=[{'all':!![]}];}_0x493344=_[_0x3852('0x3e')]({},_0x493344,_0xbbca67[_0x3852('0x4a')]);return db[_0x3852('0x2e')][_0x3852('0x4b')](_0x493344)[_0x3852('0x25')](handleEntityNotFound(_0x3591e0,null))[_0x3852('0x25')](respondWithResult(_0x3591e0,null))['catch'](handleError(_0x3591e0,null));};exports[_0x3852('0x24')]=function(_0x1ead32,_0x2be1b4){if(_0x1ead32[_0x3852('0x4c')]['id']){delete _0x1ead32['body']['id'];}return db['VoiceMusicOnHold'][_0x3852('0x4b')]({'where':{'id':_0x1ead32[_0x3852('0x49')]['id']}})[_0x3852('0x25')](handleEntityNotFound(_0x2be1b4,null))[_0x3852('0x25')](saveUpdates(_0x1ead32[_0x3852('0x4c')],null))[_0x3852('0x25')](respondWithResult(_0x2be1b4,null))[_0x3852('0x48')](handleError(_0x2be1b4,null));};exports[_0x3852('0x4d')]=function(_0xcfb6ef,_0x533d39,_0x33e2c5){return db[_0x3852('0x4e')][_0x3852('0x4f')](function(_0x41eb16){if(_0xcfb6ef[_0x3852('0x4c')][_0x3852('0x50')]===_0x3852('0x51')){_0xcfb6ef[_0x3852('0x4c')][_0x3852('0x52')]=path[_0x3852('0x53')](config[_0x3852('0x54')],_0x3852('0x55'),_0xcfb6ef[_0x3852('0x4c')][_0x3852('0x56')]);}return db['VoiceMusicOnHold'][_0x3852('0x4d')](_0xcfb6ef['body'],{'transaction':_0x41eb16})[_0x3852('0x25')](function(_0x4fa5f3){if(_0xcfb6ef[_0x3852('0x4c')][_0x3852('0x50')]==='files'){fs['mkdirSync'](_0x4fa5f3['directory'],parseInt(_0x3852('0x57'),0x8));}var _0x50c26d=_0xcfb6ef[_0x3852('0x58')][_0x3852('0x27')]({'plain':!![]});if(!_0x50c26d)throw new Error(_0x3852('0x59'));if(_0x50c26d[_0x3852('0x5a')]===_0x3852('0x58')){var _0x59afab=_0x4fa5f3['get']({'plain':!![]});return db[_0x3852('0x5b')][_0x3852('0x4b')]({'where':{'name':'MusicOnHolds','userProfileId':_0x50c26d[_0x3852('0x5c')]},'raw':!![]})[_0x3852('0x25')](function(_0x1a3542){if(_0x1a3542&&_0x1a3542[_0x3852('0x5d')]===0x0){return db[_0x3852('0x28')][_0x3852('0x4d')]({'name':_0x59afab[_0x3852('0x56')],'resourceId':_0x59afab['id'],'type':_0x1a3542[_0x3852('0x56')],'sectionId':_0x1a3542['id']},{})[_0x3852('0x25')](function(){return _0x4fa5f3;});}else{return _0x4fa5f3;}})[_0x3852('0x48')](function(_0x5c8df9){logger[_0x3852('0x2a')](_0x3852('0x5e'),_0x5c8df9);});}return _0x4fa5f3;});})['then'](respondWithResult(_0x533d39,0xc9))['catch'](handleError(_0x533d39,null));};exports[_0x3852('0x26')]=function(_0x5dc471,_0x1098b7,_0x406f2e){var _0x30a57a;return db['VoiceMusicOnHold'][_0x3852('0x4b')]({'where':{'id':_0x5dc471[_0x3852('0x49')]['id']}})[_0x3852('0x25')](function(_0x148c85){if(_0x148c85){return db['sequelize'][_0x3852('0x4f')](function(_0x45ec83){return _0x148c85[_0x3852('0x26')]({'transaction':_0x45ec83,'raw':!![]})[_0x3852('0x25')](function(_0x1b34a4){if(_0x1b34a4[_0x3852('0x52')]){fs['readdirSync'](_0x1b34a4[_0x3852('0x52')])[_0x3852('0x5f')](function(_0x40eb03){fs[_0x3852('0x60')](path[_0x3852('0x53')](_0x1b34a4[_0x3852('0x52')],_0x40eb03));});fs[_0x3852('0x61')](_0x1b34a4['directory']);}return _0x1b34a4;});})['catch'](function(_0x5b0267){throw new db['Sequelize']['ValidationError'](_0x5b0267[_0x3852('0x62')]);});}})[_0x3852('0x25')](handleEntityNotFound(_0x1098b7,null))['then'](removeEntity(_0x1098b7,null))['catch'](handleError(_0x1098b7,null));};exports[_0x3852('0x63')]=function(_0x4959ca,_0x212f0f,_0x2bdc86){return db[_0x3852('0x4e')][_0x3852('0x4f')](function(_0x5e4633){var _0x9affa5;return db[_0x3852('0x2e')][_0x3852('0x4b')]({'where':{'id':_0x4959ca[_0x3852('0x49')]['id']}})[_0x3852('0x25')](function(_0x3b2b4b){if(_0x3b2b4b){_0x9affa5=_0x3b2b4b;return _0x3b2b4b[_0x3852('0x63')](_0x4959ca[_0x3852('0x4c')]['id'],{'transaction':_0x5e4633});}})[_0x3852('0x25')](function(_0x51c17b){if(_0x51c17b){return db[_0x3852('0x64')]['findOne']({'where':{'id':_0x4959ca['body']['id']},'attributes':['id','name',_0x3852('0x65'),_0x3852('0x66'),_0x3852('0x67')],'raw':!![]});}})['then'](function(_0x12d54c){if(_0x12d54c){var _0x2d4e14=path[_0x3852('0x53')](config[_0x3852('0x54')],'server/files/sounds/converted',util['format'](_0x3852('0x68'),path[_0x3852('0x69')](_0x12d54c[_0x3852('0x65')],path[_0x3852('0x6a')](_0x12d54c[_0x3852('0x65')])),_0x12d54c[_0x3852('0x66')]));var _0x25ddb5=path[_0x3852('0x53')](config[_0x3852('0x54')],'server/files/moh',_0x9affa5[_0x3852('0x56')],util[_0x3852('0x6b')](_0x3852('0x68'),_0x12d54c[_0x3852('0x56')],_0x12d54c['converted_format']));fs[_0x3852('0x6c')](_0x2d4e14,_0x25ddb5);return _0x12d54c;}})[_0x3852('0x48')](function(_0x2786a5){throw new db[(_0x3852('0x6d'))][(_0x3852('0x6e'))](_0x2786a5['message']);});})[_0x3852('0x25')](handleEntityNotFound(_0x212f0f,null))['then'](respondWithResult(_0x212f0f,0xc9))[_0x3852('0x48')](handleError(_0x212f0f,null));};exports[_0x3852('0x6f')]=function(_0x182461,_0x38ee2b,_0x24ab78){return db[_0x3852('0x4e')][_0x3852('0x4f')](function(_0x2ae49e){var _0x2341c6;return db['VoiceMusicOnHold'][_0x3852('0x70')]({'where':{'id':_0x182461[_0x3852('0x49')]['id']}})['then'](handleEntityNotFound(_0x38ee2b,null))[_0x3852('0x25')](function(_0xc58875){if(_0xc58875){_0x2341c6=_0xc58875;return _0xc58875['removeSound'](_0x182461['params']['id2']);}})['then'](function(_0x35ef63){if(_0x35ef63){return db[_0x3852('0x64')][_0x3852('0x70')]({'where':{'id':_0x182461[_0x3852('0x49')]['id2']},'attributes':['id',_0x3852('0x56'),_0x3852('0x65'),_0x3852('0x66'),_0x3852('0x67')],'raw':!![]});}})[_0x3852('0x25')](function(_0x27b757){if(_0x27b757){fs['unlinkSync'](path[_0x3852('0x53')](_0x2341c6[_0x3852('0x52')],util[_0x3852('0x6b')](_0x3852('0x68'),_0x27b757['name'],_0x27b757['converted_format'])));return _0x27b757;}})[_0x3852('0x48')](function(_0x35541b){throw new db['Sequelize'][(_0x3852('0x6e'))](_0x35541b[_0x3852('0x62')]);});})[_0x3852('0x25')](handleEntityNotFound(_0x38ee2b,null))[_0x3852('0x25')](respondWithStatusCode(_0x38ee2b,0xcc))[_0x3852('0x48')](handleError(_0x38ee2b,null));};exports[_0x3852('0x71')]=function(_0x9a7ace,_0x2bfe3b,_0x4f3173){var _0x58cac5={};var _0x403ecc={};var _0x21d029;var _0x424e4b;return db[_0x3852('0x2e')]['findOne']({'where':{'id':_0x9a7ace[_0x3852('0x49')]['id']}})[_0x3852('0x25')](handleEntityNotFound(_0x2bfe3b,null))['then'](function(_0x226a74){if(_0x226a74){_0x21d029=_0x226a74;_0x403ecc[_0x3852('0x30')]=_[_0x3852('0x31')](db[_0x3852('0x64')]['rawAttributes']);_0x403ecc[_0x3852('0x32')]=_[_0x3852('0x31')](_0x9a7ace[_0x3852('0x32')]);_0x403ecc[_0x3852('0x3a')]=_[_0x3852('0x34')](_0x403ecc[_0x3852('0x30')],_0x403ecc['query']);_0x58cac5['attributes']=_[_0x3852('0x34')](_0x403ecc[_0x3852('0x30')],qs[_0x3852('0x35')](_0x9a7ace[_0x3852('0x32')]['fields']));_0x58cac5[_0x3852('0x33')]=_0x58cac5[_0x3852('0x33')][_0x3852('0x36')]?_0x58cac5['attributes']:_0x403ecc['model'];_0x58cac5[_0x3852('0x38')]=qs[_0x3852('0x39')](_0x9a7ace[_0x3852('0x32')][_0x3852('0x39')]);_0x58cac5['where']=qs['filters'](_[_0x3852('0x3b')](_0x9a7ace[_0x3852('0x32')],_0x403ecc['filters']));if(_0x9a7ace[_0x3852('0x32')]['filter']){_0x58cac5[_0x3852('0x3d')]=_[_0x3852('0x3e')](_0x58cac5[_0x3852('0x3d')],{'$or':_[_0x3852('0x3f')](_0x58cac5[_0x3852('0x33')],function(_0x55a1f0){var _0x3b0e36={};_0x3b0e36[_0x55a1f0]={'$like':'%'+_0x9a7ace[_0x3852('0x32')][_0x3852('0x3c')]+'%'};return _0x3b0e36;})});}_0x58cac5=_[_0x3852('0x3e')]({},_0x58cac5,_0x9a7ace[_0x3852('0x4a')]);return _0x21d029[_0x3852('0x71')](_0x58cac5);}})[_0x3852('0x25')](function(_0x3f7179){if(_0x3f7179){_0x424e4b=_0x3f7179[_0x3852('0x36')];if(!_0x9a7ace[_0x3852('0x32')][_0x3852('0x72')](_0x3852('0x37'))){_0x58cac5[_0x3852('0x1f')]=qs[_0x3852('0x1f')](_0x9a7ace[_0x3852('0x32')][_0x3852('0x1f')]);_0x58cac5[_0x3852('0x1e')]=qs[_0x3852('0x1e')](_0x9a7ace['query'][_0x3852('0x1e')]);}return _0x21d029[_0x3852('0x71')](_0x58cac5);}})['then'](function(_0x4628be){if(_0x4628be){return _0x4628be?{'count':_0x424e4b,'rows':_0x4628be}:null;}})['then'](respondWithResult(_0x2bfe3b,null))[_0x3852('0x48')](handleError(_0x2bfe3b,null));};
\ No newline at end of file
+var _0x3c6d=['merge','map','type','key','VIRTUAL','field','options','includeAll','include','findAll','catch','show','params','find','body','create','mode','files','directory','join','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','transaction','Sound','save_name','createdAt','root','%s.%s','basename','extname','converted_format','server/files/moh','format','removeSound','findOne','id2','getSounds','length','order','hasOwnProperty','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','destroy','stack','name','send','VoiceMusicOnHold','rawAttributes','model','query','keys','filters','intersection','attributes','fields','sort','pick','filter','where'];(function(_0xe906a5,_0x3bfd31){var _0x4fb701=function(_0x18c9f1){while(--_0x18c9f1){_0xe906a5['push'](_0xe906a5['shift']());}};_0x4fb701(++_0x3bfd31);}(_0x3c6d,0xa1));var _0xd3c6=function(_0x5c23e6,_0x509aca){_0x5c23e6=_0x5c23e6-0x0;var _0x40f1f6=_0x3c6d[_0x5c23e6];return _0x40f1f6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd3c6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd3c6('0x1'));var jsonpatch=require(_0xd3c6('0x2'));var rp=require(_0xd3c6('0x3'));var moment=require(_0xd3c6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd3c6('0x5'));var util=require(_0xd3c6('0x6'));var path=require('path');var sox=require(_0xd3c6('0x7'));var csv=require(_0xd3c6('0x8'));var ejs=require(_0xd3c6('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd3c6('0xa'));var crypto=require('crypto');var jsforce=require(_0xd3c6('0xb'));var deskjs=require(_0xd3c6('0xc'));var toCsv=require(_0xd3c6('0x8'));var querystring=require('querystring');var Papa=require(_0xd3c6('0xd'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0xd3c6('0xe'));var qs=require(_0xd3c6('0xf'));var logger=require(_0xd3c6('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xd3c6('0x11'));var db=require(_0xd3c6('0x12'))['db'];function respondWithStatusCode(_0x1f5fd,_0xb6aa9c){_0xb6aa9c=_0xb6aa9c||0xcc;return function(_0x25040e){if(_0x25040e){return _0x1f5fd[_0xd3c6('0x13')](_0xb6aa9c);}return _0x1f5fd[_0xd3c6('0x14')](_0xb6aa9c)[_0xd3c6('0x15')]();};}function respondWithResult(_0x3d1677,_0x3eb756){_0x3eb756=_0x3eb756||0xc8;return function(_0x426cba){if(_0x426cba){return _0x3d1677['status'](_0x3eb756)[_0xd3c6('0x16')](_0x426cba);}};}function respondWithFilteredResult(_0x14ba6c,_0x314b6a){return function(_0x5ae37a){if(_0x5ae37a){var _0x5e877a=_0x5ae37a[_0xd3c6('0x17')],_0x5d537b=_0x314b6a[_0xd3c6('0x18')],_0x298793=_0x314b6a[_0xd3c6('0x18')]+_0x314b6a[_0xd3c6('0x19')],_0x56b484;if(_0x298793>=_0x5e877a){_0x298793=_0x5e877a;_0x56b484=0xc8;}else{_0x56b484=0xce;}_0x14ba6c[_0xd3c6('0x14')](_0x56b484);return _0x14ba6c[_0xd3c6('0x1a')](_0xd3c6('0x1b'),_0x5d537b+'-'+_0x298793+'/'+_0x5e877a)['json'](_0x5ae37a);}return null;};}function patchUpdates(_0x3407de){return function(_0x2a7045){try{jsonpatch[_0xd3c6('0x1c')](_0x2a7045,_0x3407de,!![]);}catch(_0x2a031e){return BPromise[_0xd3c6('0x1d')](_0x2a031e);}return _0x2a7045[_0xd3c6('0x1e')]();};}function saveUpdates(_0xc6341f,_0x711f13){return function(_0x5b8f79){if(_0x5b8f79){return _0x5b8f79[_0xd3c6('0x1f')](_0xc6341f)[_0xd3c6('0x20')](function(_0x5242e5){return _0x5242e5;});}return null;};}function removeEntity(_0x58de29,_0x34c9dc){return function(_0x30202d){if(_0x30202d){return _0x30202d['destroy']()[_0xd3c6('0x20')](function(){var _0x486b3e=_0x30202d[_0xd3c6('0x21')]({'plain':!![]});var _0x23a01c='MusicOnHolds';return db['UserProfileResource'][_0xd3c6('0x22')]({'where':{'type':_0x23a01c,'resourceId':_0x486b3e['id']}})['then'](function(){return _0x30202d;});})[_0xd3c6('0x20')](function(){_0x58de29['status'](0xcc)[_0xd3c6('0x15')]();});}};}function handleEntityNotFound(_0x36bb51,_0x1fe0c4){return function(_0x329c8c){if(!_0x329c8c){_0x36bb51['sendStatus'](0x194);}return _0x329c8c;};}function handleError(_0x251596,_0xa402ec){_0xa402ec=_0xa402ec||0x1f4;return function(_0x27f1cd){logger['error'](_0x27f1cd[_0xd3c6('0x23')]);if(_0x27f1cd[_0xd3c6('0x24')]){delete _0x27f1cd['name'];}_0x251596[_0xd3c6('0x14')](_0xa402ec)[_0xd3c6('0x25')](_0x27f1cd);};}exports['index']=function(_0x2c0d3b,_0x56271d){var _0x20ea98={},_0x4f2d4f={},_0x4dbdf4={'count':0x0,'rows':[]};var _0x2faad4=db[_0xd3c6('0x26')][_0xd3c6('0x27')];_0x4f2d4f[_0xd3c6('0x28')]=_['keys'](_0x2faad4);_0x4f2d4f[_0xd3c6('0x29')]=_[_0xd3c6('0x2a')](_0x2c0d3b[_0xd3c6('0x29')]);_0x4f2d4f[_0xd3c6('0x2b')]=_[_0xd3c6('0x2c')](_0x4f2d4f[_0xd3c6('0x28')],_0x4f2d4f[_0xd3c6('0x29')]);_0x20ea98[_0xd3c6('0x2d')]=_['intersection'](_0x4f2d4f[_0xd3c6('0x28')],qs[_0xd3c6('0x2e')](_0x2c0d3b[_0xd3c6('0x29')][_0xd3c6('0x2e')]));_0x20ea98[_0xd3c6('0x2d')]=_0x20ea98[_0xd3c6('0x2d')]['length']?_0x20ea98[_0xd3c6('0x2d')]:_0x4f2d4f[_0xd3c6('0x28')];if(!_0x2c0d3b[_0xd3c6('0x29')]['hasOwnProperty']('nolimit')){_0x20ea98['limit']=qs[_0xd3c6('0x19')](_0x2c0d3b[_0xd3c6('0x29')][_0xd3c6('0x19')]);_0x20ea98['offset']=qs['offset'](_0x2c0d3b[_0xd3c6('0x29')][_0xd3c6('0x18')]);}_0x20ea98['order']=qs['sort'](_0x2c0d3b[_0xd3c6('0x29')][_0xd3c6('0x2f')]);_0x20ea98['where']=qs['filters'](_[_0xd3c6('0x30')](_0x2c0d3b[_0xd3c6('0x29')],_0x4f2d4f[_0xd3c6('0x2b')]));if(_0x2c0d3b[_0xd3c6('0x29')][_0xd3c6('0x31')]){_0x20ea98[_0xd3c6('0x32')]=_[_0xd3c6('0x33')](_0x20ea98['where'],{'$or':_[_0xd3c6('0x34')](_0x2faad4,function(_0x8f52ca){if(_0x8f52ca[_0xd3c6('0x35')][_0xd3c6('0x36')]!==_0xd3c6('0x37')){var _0x4a79e1={};_0x4a79e1[_0x8f52ca[_0xd3c6('0x38')]]={'$like':'%'+_0x2c0d3b[_0xd3c6('0x29')][_0xd3c6('0x31')]+'%'};return _0x4a79e1;}})});}_0x20ea98=_[_0xd3c6('0x33')]({},_0x20ea98,_0x2c0d3b[_0xd3c6('0x39')]);var _0x57b7d9={'where':_0x20ea98[_0xd3c6('0x32')]};return db[_0xd3c6('0x26')][_0xd3c6('0x17')](_0x57b7d9)[_0xd3c6('0x20')](function(_0x4c7f02){_0x4dbdf4[_0xd3c6('0x17')]=_0x4c7f02;if(_0x2c0d3b[_0xd3c6('0x29')][_0xd3c6('0x3a')]){_0x20ea98[_0xd3c6('0x3b')]=[{'all':!![]}];}return db[_0xd3c6('0x26')][_0xd3c6('0x3c')](_0x20ea98);})[_0xd3c6('0x20')](function(_0x38a13d){_0x4dbdf4['rows']=_0x38a13d;return _0x4dbdf4;})[_0xd3c6('0x20')](respondWithFilteredResult(_0x56271d,_0x20ea98))[_0xd3c6('0x3d')](handleError(_0x56271d,null));};exports[_0xd3c6('0x3e')]=function(_0x56a6d6,_0x2a2808){var _0x482d8e={'raw':![],'where':{'id':_0x56a6d6[_0xd3c6('0x3f')]['id']}},_0x5a91b4={};_0x5a91b4[_0xd3c6('0x28')]=_[_0xd3c6('0x2a')](db[_0xd3c6('0x26')][_0xd3c6('0x27')]);_0x5a91b4['query']=_[_0xd3c6('0x2a')](_0x56a6d6[_0xd3c6('0x29')]);_0x5a91b4[_0xd3c6('0x2b')]=_[_0xd3c6('0x2c')](_0x5a91b4[_0xd3c6('0x28')],_0x5a91b4[_0xd3c6('0x29')]);_0x482d8e['attributes']=_[_0xd3c6('0x2c')](_0x5a91b4[_0xd3c6('0x28')],qs[_0xd3c6('0x2e')](_0x56a6d6['query'][_0xd3c6('0x2e')]));_0x482d8e['attributes']=_0x482d8e[_0xd3c6('0x2d')]['length']?_0x482d8e[_0xd3c6('0x2d')]:_0x5a91b4[_0xd3c6('0x28')];if(_0x56a6d6[_0xd3c6('0x29')][_0xd3c6('0x3a')]){_0x482d8e['include']=[{'all':!![]}];}_0x482d8e=_[_0xd3c6('0x33')]({},_0x482d8e,_0x56a6d6[_0xd3c6('0x39')]);return db[_0xd3c6('0x26')][_0xd3c6('0x40')](_0x482d8e)[_0xd3c6('0x20')](handleEntityNotFound(_0x2a2808,null))['then'](respondWithResult(_0x2a2808,null))[_0xd3c6('0x3d')](handleError(_0x2a2808,null));};exports[_0xd3c6('0x1f')]=function(_0x2de60c,_0x5abe15){if(_0x2de60c[_0xd3c6('0x41')]['id']){delete _0x2de60c['body']['id'];}return db[_0xd3c6('0x26')][_0xd3c6('0x40')]({'where':{'id':_0x2de60c[_0xd3c6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5abe15,null))[_0xd3c6('0x20')](saveUpdates(_0x2de60c[_0xd3c6('0x41')],null))['then'](respondWithResult(_0x5abe15,null))[_0xd3c6('0x3d')](handleError(_0x5abe15,null));};exports[_0xd3c6('0x42')]=function(_0x4224f8,_0x5c56e8,_0xf681f3){return db['sequelize']['transaction'](function(_0x4db271){if(_0x4224f8[_0xd3c6('0x41')][_0xd3c6('0x43')]===_0xd3c6('0x44')){_0x4224f8['body'][_0xd3c6('0x45')]=path[_0xd3c6('0x46')](config['root'],'server/files/moh',_0x4224f8['body'][_0xd3c6('0x24')]);}return db['VoiceMusicOnHold'][_0xd3c6('0x42')](_0x4224f8[_0xd3c6('0x41')],{'transaction':_0x4db271})[_0xd3c6('0x20')](function(_0x181c11){if(_0x4224f8[_0xd3c6('0x41')]['mode']===_0xd3c6('0x44')){fs[_0xd3c6('0x47')](_0x181c11[_0xd3c6('0x45')],parseInt(_0xd3c6('0x48'),0x8));}var _0x4524b9=_0x4224f8[_0xd3c6('0x49')][_0xd3c6('0x21')]({'plain':!![]});if(!_0x4524b9)throw new Error(_0xd3c6('0x4a'));if(_0x4524b9['role']===_0xd3c6('0x49')){var _0x48e3d0=_0x181c11[_0xd3c6('0x21')]({'plain':!![]});return db[_0xd3c6('0x4b')][_0xd3c6('0x40')]({'where':{'name':'MusicOnHolds','userProfileId':_0x4524b9['userProfileId']},'raw':!![]})[_0xd3c6('0x20')](function(_0x2ca950){if(_0x2ca950&&_0x2ca950['autoAssociation']===0x0){return db[_0xd3c6('0x4c')][_0xd3c6('0x42')]({'name':_0x48e3d0[_0xd3c6('0x24')],'resourceId':_0x48e3d0['id'],'type':_0x2ca950['name'],'sectionId':_0x2ca950['id']},{})[_0xd3c6('0x20')](function(){return _0x181c11;});}else{return _0x181c11;}})['catch'](function(_0x2a1b3c){logger[_0xd3c6('0x4d')](_0xd3c6('0x4e'),_0x2a1b3c);});}return _0x181c11;});})[_0xd3c6('0x20')](respondWithResult(_0x5c56e8,0xc9))[_0xd3c6('0x3d')](handleError(_0x5c56e8,null));};exports[_0xd3c6('0x22')]=function(_0x44005f,_0x49a7b5,_0x3538c4){var _0x31eb7a;return db[_0xd3c6('0x26')]['find']({'where':{'id':_0x44005f[_0xd3c6('0x3f')]['id']}})[_0xd3c6('0x20')](function(_0x1d7ece){if(_0x1d7ece){return db[_0xd3c6('0x4f')]['transaction'](function(_0x22f13e){return _0x1d7ece[_0xd3c6('0x22')]({'transaction':_0x22f13e,'raw':!![]})['then'](function(_0x1402a9){if(_0x1402a9[_0xd3c6('0x45')]){fs[_0xd3c6('0x50')](_0x1402a9[_0xd3c6('0x45')])[_0xd3c6('0x51')](function(_0x1cfbd8){fs[_0xd3c6('0x52')](path[_0xd3c6('0x46')](_0x1402a9[_0xd3c6('0x45')],_0x1cfbd8));});fs[_0xd3c6('0x53')](_0x1402a9[_0xd3c6('0x45')]);}return _0x1402a9;});})['catch'](function(_0x142f70){throw new db[(_0xd3c6('0x54'))][(_0xd3c6('0x55'))](_0x142f70[_0xd3c6('0x56')]);});}})[_0xd3c6('0x20')](handleEntityNotFound(_0x49a7b5,null))['then'](removeEntity(_0x49a7b5,null))[_0xd3c6('0x3d')](handleError(_0x49a7b5,null));};exports[_0xd3c6('0x57')]=function(_0x3f27da,_0x5ed721,_0x533cd8){return db[_0xd3c6('0x4f')][_0xd3c6('0x58')](function(_0x26984d){var _0x47ca75;return db[_0xd3c6('0x26')][_0xd3c6('0x40')]({'where':{'id':_0x3f27da['params']['id']}})[_0xd3c6('0x20')](function(_0x18abb3){if(_0x18abb3){_0x47ca75=_0x18abb3;return _0x18abb3[_0xd3c6('0x57')](_0x3f27da[_0xd3c6('0x41')]['id'],{'transaction':_0x26984d});}})[_0xd3c6('0x20')](function(_0x3bbe0f){if(_0x3bbe0f){return db[_0xd3c6('0x59')]['findOne']({'where':{'id':_0x3f27da[_0xd3c6('0x41')]['id']},'attributes':['id',_0xd3c6('0x24'),_0xd3c6('0x5a'),'converted_format',_0xd3c6('0x5b')],'raw':!![]});}})[_0xd3c6('0x20')](function(_0x119815){if(_0x119815){var _0x4ebf01=path[_0xd3c6('0x46')](config[_0xd3c6('0x5c')],'server/files/sounds/converted',util['format'](_0xd3c6('0x5d'),path[_0xd3c6('0x5e')](_0x119815[_0xd3c6('0x5a')],path[_0xd3c6('0x5f')](_0x119815[_0xd3c6('0x5a')])),_0x119815[_0xd3c6('0x60')]));var _0x3335c5=path[_0xd3c6('0x46')](config['root'],_0xd3c6('0x61'),_0x47ca75[_0xd3c6('0x24')],util[_0xd3c6('0x62')](_0xd3c6('0x5d'),_0x119815[_0xd3c6('0x24')],_0x119815['converted_format']));fs['symlinkSync'](_0x4ebf01,_0x3335c5);return _0x119815;}})[_0xd3c6('0x3d')](function(_0x3891fa){throw new db[(_0xd3c6('0x54'))][(_0xd3c6('0x55'))](_0x3891fa[_0xd3c6('0x56')]);});})['then'](handleEntityNotFound(_0x5ed721,null))[_0xd3c6('0x20')](respondWithResult(_0x5ed721,0xc9))[_0xd3c6('0x3d')](handleError(_0x5ed721,null));};exports[_0xd3c6('0x63')]=function(_0x5b15ab,_0x88db82,_0x2a9365){return db[_0xd3c6('0x4f')][_0xd3c6('0x58')](function(_0x180414){var _0x12abde;return db['VoiceMusicOnHold'][_0xd3c6('0x64')]({'where':{'id':_0x5b15ab[_0xd3c6('0x3f')]['id']}})[_0xd3c6('0x20')](handleEntityNotFound(_0x88db82,null))[_0xd3c6('0x20')](function(_0x261ce1){if(_0x261ce1){_0x12abde=_0x261ce1;return _0x261ce1[_0xd3c6('0x63')](_0x5b15ab[_0xd3c6('0x3f')][_0xd3c6('0x65')]);}})[_0xd3c6('0x20')](function(_0x325f5d){if(_0x325f5d){return db['Sound'][_0xd3c6('0x64')]({'where':{'id':_0x5b15ab[_0xd3c6('0x3f')][_0xd3c6('0x65')]},'attributes':['id',_0xd3c6('0x24'),_0xd3c6('0x5a'),_0xd3c6('0x60'),_0xd3c6('0x5b')],'raw':!![]});}})[_0xd3c6('0x20')](function(_0x3f6348){if(_0x3f6348){fs[_0xd3c6('0x52')](path[_0xd3c6('0x46')](_0x12abde[_0xd3c6('0x45')],util[_0xd3c6('0x62')](_0xd3c6('0x5d'),_0x3f6348[_0xd3c6('0x24')],_0x3f6348['converted_format'])));return _0x3f6348;}})[_0xd3c6('0x3d')](function(_0x520ff3){throw new db['Sequelize'][(_0xd3c6('0x55'))](_0x520ff3[_0xd3c6('0x56')]);});})[_0xd3c6('0x20')](handleEntityNotFound(_0x88db82,null))[_0xd3c6('0x20')](respondWithStatusCode(_0x88db82,0xcc))[_0xd3c6('0x3d')](handleError(_0x88db82,null));};exports[_0xd3c6('0x66')]=function(_0x2846cd,_0x43794b,_0x2ef882){var _0x21d7e3={};var _0xc4823={};var _0x39c908;var _0x1440d9;return db[_0xd3c6('0x26')][_0xd3c6('0x64')]({'where':{'id':_0x2846cd[_0xd3c6('0x3f')]['id']}})[_0xd3c6('0x20')](handleEntityNotFound(_0x43794b,null))[_0xd3c6('0x20')](function(_0x11796c){if(_0x11796c){_0x39c908=_0x11796c;_0xc4823[_0xd3c6('0x28')]=_[_0xd3c6('0x2a')](db[_0xd3c6('0x59')]['rawAttributes']);_0xc4823[_0xd3c6('0x29')]=_[_0xd3c6('0x2a')](_0x2846cd[_0xd3c6('0x29')]);_0xc4823[_0xd3c6('0x2b')]=_[_0xd3c6('0x2c')](_0xc4823['model'],_0xc4823[_0xd3c6('0x29')]);_0x21d7e3[_0xd3c6('0x2d')]=_[_0xd3c6('0x2c')](_0xc4823[_0xd3c6('0x28')],qs[_0xd3c6('0x2e')](_0x2846cd[_0xd3c6('0x29')][_0xd3c6('0x2e')]));_0x21d7e3['attributes']=_0x21d7e3[_0xd3c6('0x2d')][_0xd3c6('0x67')]?_0x21d7e3[_0xd3c6('0x2d')]:_0xc4823[_0xd3c6('0x28')];_0x21d7e3[_0xd3c6('0x68')]=qs[_0xd3c6('0x2f')](_0x2846cd[_0xd3c6('0x29')][_0xd3c6('0x2f')]);_0x21d7e3[_0xd3c6('0x32')]=qs[_0xd3c6('0x2b')](_[_0xd3c6('0x30')](_0x2846cd['query'],_0xc4823[_0xd3c6('0x2b')]));if(_0x2846cd[_0xd3c6('0x29')]['filter']){_0x21d7e3[_0xd3c6('0x32')]=_['merge'](_0x21d7e3[_0xd3c6('0x32')],{'$or':_['map'](_0x21d7e3[_0xd3c6('0x2d')],function(_0x2f8448){var _0x391ae2={};_0x391ae2[_0x2f8448]={'$like':'%'+_0x2846cd['query'][_0xd3c6('0x31')]+'%'};return _0x391ae2;})});}_0x21d7e3=_[_0xd3c6('0x33')]({},_0x21d7e3,_0x2846cd[_0xd3c6('0x39')]);return _0x39c908[_0xd3c6('0x66')](_0x21d7e3);}})[_0xd3c6('0x20')](function(_0xda8833){if(_0xda8833){_0x1440d9=_0xda8833[_0xd3c6('0x67')];if(!_0x2846cd['query'][_0xd3c6('0x69')]('nolimit')){_0x21d7e3[_0xd3c6('0x19')]=qs[_0xd3c6('0x19')](_0x2846cd['query']['limit']);_0x21d7e3[_0xd3c6('0x18')]=qs['offset'](_0x2846cd['query'][_0xd3c6('0x18')]);}return _0x39c908['getSounds'](_0x21d7e3);}})['then'](function(_0x1434c0){if(_0x1434c0){return _0x1434c0?{'count':_0x1440d9,'rows':_0x1434c0}:null;}})[_0xd3c6('0x20')](respondWithResult(_0x43794b,null))['catch'](handleError(_0x43794b,null));};
\ No newline at end of file
index 1715578..27f89c6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x10fa=['moment','bluebird','request-promise','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','api'];(function(_0x48e20e,_0x4a3a73){var _0x4c115d=function(_0x15506a){while(--_0x15506a){_0x48e20e['push'](_0x48e20e['shift']());}};_0x4c115d(++_0x4a3a73);}(_0x10fa,0x105));var _0xa10f=function(_0x23e90a,_0x504041){_0x23e90a=_0x23e90a-0x0;var _0x2f471a=_0x10fa[_0x23e90a];return _0x2f471a;};'use strict';var _=require('lodash');var util=require(_0xa10f('0x0'));var logger=require(_0xa10f('0x1'))(_0xa10f('0x2'));var moment=require(_0xa10f('0x3'));var BPromise=require(_0xa10f('0x4'));var rp=require(_0xa10f('0x5'));var attributes=require(_0xa10f('0x6'));module[_0xa10f('0x7')]=function(_0x4b3345,_0x138080){return _0x4b3345[_0xa10f('0x8')](_0xa10f('0x9'),attributes,{'tableName':_0xa10f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x1841=['bluebird','request-promise','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','util','../../config/logger'];(function(_0x466b4e,_0x10ee3d){var _0x2ea133=function(_0x5ec560){while(--_0x5ec560){_0x466b4e['push'](_0x466b4e['shift']());}};_0x2ea133(++_0x10ee3d);}(_0x1841,0xdf));var _0x1184=function(_0x449287,_0x31e948){_0x449287=_0x449287-0x0;var _0x504d63=_0x1841[_0x449287];return _0x504d63;};'use strict';var _=require('lodash');var util=require(_0x1184('0x0'));var logger=require(_0x1184('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1184('0x2'));var rp=require(_0x1184('0x3'));var attributes=require(_0x1184('0x4'));module[_0x1184('0x5')]=function(_0xc01198,_0x5a1882){return _0xc01198[_0x1184('0x6')](_0x1184('0x7'),attributes,{'tableName':_0x1184('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index a1d2366..9a1ebc9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7ee1=['http','request','then','info','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','VoiceMusicOnHold,\x20%s,\x20%s','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x49d5a6,_0x3a1f12){var _0x56d4fa=function(_0x1faeb8){while(--_0x1faeb8){_0x49d5a6['push'](_0x49d5a6['shift']());}};_0x56d4fa(++_0x3a1f12);}(_0x7ee1,0x1c5));var _0x17ee=function(_0x350c47,_0x549ee3){_0x350c47=_0x350c47-0x0;var _0xfb3fa9=_0x7ee1[_0x350c47];return _0xfb3fa9;};'use strict';var _=require('lodash');var util=require(_0x17ee('0x0'));var moment=require(_0x17ee('0x1'));var BPromise=require(_0x17ee('0x2'));var rs=require(_0x17ee('0x3'));var fs=require('fs');var Redis=require(_0x17ee('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x17ee('0x5'));var logger=require(_0x17ee('0x6'))(_0x17ee('0x7'));var config=require('../../config/environment');var jayson=require(_0x17ee('0x8'));var client=jayson['client'][_0x17ee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b423,_0x2159f5,_0x3981a4){return new BPromise(function(_0x356a22,_0x5baa29){return client[_0x17ee('0xa')](_0x36b423,_0x3981a4)[_0x17ee('0xb')](function(_0x3fcf2b){logger[_0x17ee('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2159f5,_0x17ee('0xd'));logger[_0x17ee('0xe')](_0x17ee('0xf'),_0x2159f5,_0x17ee('0xd'),JSON['stringify'](_0x3fcf2b));if(_0x3fcf2b['error']){if(_0x3fcf2b[_0x17ee('0x10')][_0x17ee('0x11')]===0x1f4){logger[_0x17ee('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2159f5,_0x3fcf2b[_0x17ee('0x10')][_0x17ee('0x12')]);return _0x5baa29(_0x3fcf2b[_0x17ee('0x10')][_0x17ee('0x12')]);}logger[_0x17ee('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2159f5,_0x3fcf2b[_0x17ee('0x10')][_0x17ee('0x12')]);return _0x356a22(_0x3fcf2b[_0x17ee('0x10')]['message']);}else{logger['info'](_0x17ee('0x13'),_0x2159f5,_0x17ee('0xd'));_0x356a22(_0x3fcf2b['result'][_0x17ee('0x12')]);}})[_0x17ee('0x14')](function(_0x15efe9){logger[_0x17ee('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2159f5,_0x15efe9);_0x5baa29(_0x15efe9);});});}
\ No newline at end of file
+var _0x986a=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','info','request\x20sent','debug','error','code','message','VoiceMusicOnHold,\x20%s,\x20%s','result','util','moment'];(function(_0x4f4e3d,_0x47ea46){var _0x3bbf06=function(_0x46b8d6){while(--_0x46b8d6){_0x4f4e3d['push'](_0x4f4e3d['shift']());}};_0x3bbf06(++_0x47ea46);}(_0x986a,0x1d2));var _0xa986=function(_0x100cea,_0x349ccf){_0x100cea=_0x100cea-0x0;var _0x2b9a81=_0x986a[_0x100cea];return _0x2b9a81;};'use strict';var _=require('lodash');var util=require(_0xa986('0x0'));var moment=require(_0xa986('0x1'));var BPromise=require('bluebird');var rs=require(_0xa986('0x2'));var fs=require('fs');var Redis=require(_0xa986('0x3'));var db=require(_0xa986('0x4'))['db'];var utils=require(_0xa986('0x5'));var logger=require('../../config/logger')(_0xa986('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa986('0x7')][_0xa986('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x9bb3d9,_0x5ddabc,_0x45a297){return new BPromise(function(_0x411601,_0x2349bf){return client[_0xa986('0x9')](_0x9bb3d9,_0x45a297)['then'](function(_0x4845d9){logger[_0xa986('0xa')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5ddabc,_0xa986('0xb'));logger[_0xa986('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x5ddabc,_0xa986('0xb'),JSON['stringify'](_0x4845d9));if(_0x4845d9['error']){if(_0x4845d9[_0xa986('0xd')][_0xa986('0xe')]===0x1f4){logger[_0xa986('0xd')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5ddabc,_0x4845d9['error']['message']);return _0x2349bf(_0x4845d9[_0xa986('0xd')][_0xa986('0xf')]);}logger[_0xa986('0xd')](_0xa986('0x10'),_0x5ddabc,_0x4845d9['error'][_0xa986('0xf')]);return _0x411601(_0x4845d9[_0xa986('0xd')]['message']);}else{logger[_0xa986('0xa')](_0xa986('0x10'),_0x5ddabc,_0xa986('0xb'));_0x411601(_0x4845d9[_0xa986('0x11')][_0xa986('0xf')]);}})['catch'](function(_0x1dafec){logger[_0xa986('0xd')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5ddabc,_0x1dafec);_0x2349bf(_0x1dafec);});});}
\ No newline at end of file
index d74be06..7d0e13a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf149=['getAgents','create','post','addAgents','update','delete','destroy','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','/describe','isAuthenticated','describe','/:id','/:id/users'];(function(_0xf95f11,_0x209601){var _0x12b4a7=function(_0x5e6f9a){while(--_0x5e6f9a){_0xf95f11['push'](_0xf95f11['shift']());}};_0x12b4a7(++_0x209601);}(_0xf149,0xe1));var _0x9f14=function(_0x3e9b06,_0x417393){_0x3e9b06=_0x3e9b06-0x0;var _0x442af8=_0xf149[_0x3e9b06];return _0x442af8;};'use strict';var multer=require(_0x9f14('0x0'));var util=require(_0x9f14('0x1'));var path=require(_0x9f14('0x2'));var timeout=require('connect-timeout');var express=require(_0x9f14('0x3'));var router=express[_0x9f14('0x4')]();var auth=require(_0x9f14('0x5'));var interaction=require(_0x9f14('0x6'));var config=require(_0x9f14('0x7'));var controller=require(_0x9f14('0x8'));router[_0x9f14('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9f14('0x9')](_0x9f14('0xa'),auth[_0x9f14('0xb')](),controller[_0x9f14('0xc')]);router[_0x9f14('0x9')](_0x9f14('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x9f14('0xe'),auth[_0x9f14('0xb')](),controller[_0x9f14('0xf')]);router['post']('/',auth[_0x9f14('0xb')](),controller[_0x9f14('0x10')]);router[_0x9f14('0x11')](_0x9f14('0xe'),auth[_0x9f14('0xb')](),controller[_0x9f14('0x12')]);router['put'](_0x9f14('0xd'),auth[_0x9f14('0xb')](),controller[_0x9f14('0x13')]);router[_0x9f14('0x14')](_0x9f14('0xd'),auth[_0x9f14('0xb')](),controller[_0x9f14('0x15')]);router[_0x9f14('0x14')](_0x9f14('0xe'),auth[_0x9f14('0xb')](),controller[_0x9f14('0x16')]);module[_0x9f14('0x17')]=router;
\ No newline at end of file
+var _0x9c3b=['post','isAuthenticated','create','/:id/users','addAgents','put','update','destroy','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','index','get','describe','/:id','show'];(function(_0x57ca9f,_0x372def){var _0x5def77=function(_0x1380f5){while(--_0x1380f5){_0x57ca9f['push'](_0x57ca9f['shift']());}};_0x5def77(++_0x372def);}(_0x9c3b,0x134));var _0xb9c3=function(_0x5bb3a6,_0xc89ee3){_0x5bb3a6=_0x5bb3a6-0x0;var _0x279273=_0x9c3b[_0x5bb3a6];return _0x279273;};'use strict';var multer=require(_0xb9c3('0x0'));var util=require(_0xb9c3('0x1'));var path=require(_0xb9c3('0x2'));var timeout=require('connect-timeout');var express=require(_0xb9c3('0x3'));var router=express[_0xb9c3('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb9c3('0x5'));var config=require(_0xb9c3('0x6'));var controller=require('./voicePrefix.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb9c3('0x7')]);router[_0xb9c3('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xb9c3('0x9')]);router[_0xb9c3('0x8')](_0xb9c3('0xa'),auth['isAuthenticated'](),controller[_0xb9c3('0xb')]);router[_0xb9c3('0x8')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xb9c3('0xc')]('/',auth[_0xb9c3('0xd')](),controller[_0xb9c3('0xe')]);router[_0xb9c3('0xc')](_0xb9c3('0xf'),auth['isAuthenticated'](),controller[_0xb9c3('0x10')]);router[_0xb9c3('0x11')](_0xb9c3('0xa'),auth[_0xb9c3('0xd')](),controller[_0xb9c3('0x12')]);router['delete'](_0xb9c3('0xa'),auth[_0xb9c3('0xd')](),controller[_0xb9c3('0x13')]);router['delete'](_0xb9c3('0xf'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router;
\ No newline at end of file
index 7d61276..ada3564 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbcdf=['getDataValue','INTEGER','sequelize','STRING','name','VIRTUAL','system-'];(function(_0x370906,_0x45a105){var _0x149216=function(_0xe17761){while(--_0xe17761){_0x370906['push'](_0x370906['shift']());}};_0x149216(++_0x45a105);}(_0xbcdf,0x8e));var _0xfbcd=function(_0x5e8eae,_0x4f81e0){_0x5e8eae=_0x5e8eae-0x0;var _0xdd09cd=_0xbcdf[_0x5e8eae];return _0xdd09cd;};'use strict';var Sequelize=require(_0xfbcd('0x0'));module['exports']={'name':{'type':Sequelize[_0xfbcd('0x1')],'allowNull':![],'unique':_0xfbcd('0x2')},'prefix':{'type':Sequelize[_0xfbcd('0x3')],'get':function(_0xbd6cde){return _0xfbcd('0x4')+this[_0xfbcd('0x5')](_0xfbcd('0x2'))+'-';}},'description':{'type':Sequelize[_0xfbcd('0x1')]},'callerIdAll':{'type':Sequelize[_0xfbcd('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0xfbcd('0x6')]}};
\ No newline at end of file
+var _0xfc2f=['exports','STRING','name','getDataValue','INTEGER','sequelize'];(function(_0x216e1b,_0x5643c0){var _0x479e9e=function(_0x4e1a67){while(--_0x4e1a67){_0x216e1b['push'](_0x216e1b['shift']());}};_0x479e9e(++_0x5643c0);}(_0xfc2f,0x9b));var _0xffc2=function(_0x3b7cd,_0x1c8fc8){_0x3b7cd=_0x3b7cd-0x0;var _0x4a5905=_0xfc2f[_0x3b7cd];return _0x4a5905;};'use strict';var Sequelize=require(_0xffc2('0x0'));module[_0xffc2('0x1')]={'name':{'type':Sequelize[_0xffc2('0x2')],'allowNull':![],'unique':_0xffc2('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x29812a){return'system-'+this[_0xffc2('0x4')]('name')+'-';}},'description':{'type':Sequelize[_0xffc2('0x2')]},'callerIdAll':{'type':Sequelize[_0xffc2('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xffc2('0x5')]}};
\ No newline at end of file
index 949ffcb..b7dcd9b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['includeAll','include','rows','catch','show','params','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoicePrefixes','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','charAt','system-','findById','addAgents','omit','ids','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','pick','getAgents','nolimit','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','error','stack','name','index','VoicePrefix','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','map','type','key','VIRTUAL','options'];(function(_0x49cf39,_0x2bd2be){var _0xe9be4c=function(_0x126bf6){while(--_0x126bf6){_0x49cf39['push'](_0x49cf39['shift']());}};_0xe9be4c(++_0x2bd2be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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 authService=require(_0x0a9e('0xe'));var hardwareService=require(_0x0a9e('0xf'));var Redis=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x0a9e('0x13')]=_[_0x0a9e('0x14')](config[_0x0a9e('0x13')],{'host':_0x0a9e('0x15'),'port':0x18eb});var socket=require(_0x0a9e('0x16'))(new Redis(config[_0x0a9e('0x13')]));require('./voicePrefix.socket')[_0x0a9e('0x17')](socket);function respondWithStatusCode(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xcc;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x18')](_0x2b4227);}return _0x239b12[_0x0a9e('0x19')](_0x2b4227)['end']();};}function respondWithResult(_0x22dccb,_0x5d0880){_0x5d0880=_0x5d0880||0xc8;return function(_0x1985b6){if(_0x1985b6){return _0x22dccb['status'](_0x5d0880)[_0x0a9e('0x1a')](_0x1985b6);}};}function respondWithFilteredResult(_0x12066b,_0x48f32d){return function(_0x225616){if(_0x225616){var _0x5a0a06=_0x225616[_0x0a9e('0x1b')],_0x459eb1=_0x48f32d[_0x0a9e('0x1c')],_0x478723=_0x48f32d[_0x0a9e('0x1c')]+_0x48f32d[_0x0a9e('0x1d')],_0x106033;if(_0x478723>=_0x5a0a06){_0x478723=_0x5a0a06;_0x106033=0xc8;}else{_0x106033=0xce;}_0x12066b[_0x0a9e('0x19')](_0x106033);return _0x12066b[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x459eb1+'-'+_0x478723+'/'+_0x5a0a06)[_0x0a9e('0x1a')](_0x225616);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x20')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x21')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x22')](_0x5a09ef)[_0x0a9e('0x23')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x24')]()[_0x0a9e('0x23')](function(){var _0x370d86=_0x2fb0e4[_0x0a9e('0x25')]({'plain':!![]});var _0x16b1ca='VoicePrefixes';return db['UserProfileResource'][_0x0a9e('0x24')]({'where':{'type':_0x16b1ca,'resourceId':_0x370d86['id']}})[_0x0a9e('0x23')](function(){return _0x2fb0e4;});})[_0x0a9e('0x23')](function(){_0x4abc77[_0x0a9e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x384319,_0x479bc4){return function(_0x45a1e7){if(!_0x45a1e7){_0x384319['sendStatus'](0x194);}return _0x45a1e7;};}function handleError(_0x1dc186,_0x34dc65){_0x34dc65=_0x34dc65||0x1f4;return function(_0x25fba9){logger[_0x0a9e('0x26')](_0x25fba9[_0x0a9e('0x27')]);if(_0x25fba9[_0x0a9e('0x28')]){delete _0x25fba9[_0x0a9e('0x28')];}_0x1dc186[_0x0a9e('0x19')](_0x34dc65)['send'](_0x25fba9);};}exports[_0x0a9e('0x29')]=function(_0x468813,_0x2b1f27){var _0x2ec755={},_0x5c877d={},_0x15b200={'count':0x0,'rows':[]};var _0x40e7a3=db[_0x0a9e('0x2a')][_0x0a9e('0x2b')];_0x5c877d[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x40e7a3);_0x5c877d[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x468813[_0x0a9e('0x2e')]);_0x5c877d['filters']=_[_0x0a9e('0x2f')](_0x5c877d['model'],_0x5c877d[_0x0a9e('0x2e')]);_0x2ec755[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x5c877d[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x468813['query'][_0x0a9e('0x31')]));_0x2ec755[_0x0a9e('0x30')]=_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x2ec755[_0x0a9e('0x30')]:_0x5c877d[_0x0a9e('0x2c')];if(!_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x2ec755[_0x0a9e('0x1d')]=qs['limit'](_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x2ec755[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x468813['query'][_0x0a9e('0x1c')]);}_0x2ec755[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x468813[_0x0a9e('0x2e')]['sort']);_0x2ec755['where']=qs[_0x0a9e('0x36')](_['pick'](_0x468813[_0x0a9e('0x2e')],_0x5c877d[_0x0a9e('0x36')]));if(_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]){_0x2ec755['where']=_[_0x0a9e('0x38')](_0x2ec755[_0x0a9e('0x39')],{'$or':_[_0x0a9e('0x3a')](_0x40e7a3,function(_0x533942){if(_0x533942[_0x0a9e('0x3b')][_0x0a9e('0x3c')]!==_0x0a9e('0x3d')){var _0x4c1c0e={};_0x4c1c0e[_0x533942['field']]={'$like':'%'+_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x4c1c0e;}})});}_0x2ec755=_['merge']({},_0x2ec755,_0x468813[_0x0a9e('0x3e')]);var _0x419125={'where':_0x2ec755[_0x0a9e('0x39')]};return db[_0x0a9e('0x2a')]['count'](_0x419125)['then'](function(_0x15e37d){_0x15b200[_0x0a9e('0x1b')]=_0x15e37d;if(_0x468813['query'][_0x0a9e('0x3f')]){_0x2ec755[_0x0a9e('0x40')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')]['findAll'](_0x2ec755);})[_0x0a9e('0x23')](function(_0x2cfea9){_0x15b200[_0x0a9e('0x41')]=_0x2cfea9;return _0x15b200;})[_0x0a9e('0x23')](respondWithFilteredResult(_0x2b1f27,_0x2ec755))[_0x0a9e('0x42')](handleError(_0x2b1f27,null));};exports[_0x0a9e('0x43')]=function(_0x2881b3,_0x45a9b8){var _0x23b089={'raw':![],'where':{'id':_0x2881b3[_0x0a9e('0x44')]['id']}},_0x3da2cd={};_0x3da2cd[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x3da2cd['query']=_['keys'](_0x2881b3[_0x0a9e('0x2e')]);_0x3da2cd[_0x0a9e('0x36')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],_0x3da2cd[_0x0a9e('0x2e')]);_0x23b089[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x23b089[_0x0a9e('0x30')]=_0x23b089['attributes'][_0x0a9e('0x32')]?_0x23b089[_0x0a9e('0x30')]:_0x3da2cd[_0x0a9e('0x2c')];if(_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x3f')]){_0x23b089[_0x0a9e('0x40')]=[{'all':!![]}];}_0x23b089=_[_0x0a9e('0x38')]({},_0x23b089,_0x2881b3[_0x0a9e('0x3e')]);return db['VoicePrefix'][_0x0a9e('0x45')](_0x23b089)['then'](handleEntityNotFound(_0x45a9b8,null))[_0x0a9e('0x23')](respondWithResult(_0x45a9b8,null))[_0x0a9e('0x42')](handleError(_0x45a9b8,null));};exports[_0x0a9e('0x24')]=function(_0x562fb4,_0x14bec2){return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x562fb4[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x14bec2,null))[_0x0a9e('0x23')](removeEntity(_0x14bec2,null))[_0x0a9e('0x42')](handleError(_0x14bec2,null));};exports['describe']=function(_0x13f44d,_0x1bde3c){return db[_0x0a9e('0x2a')][_0x0a9e('0x46')]()[_0x0a9e('0x23')](respondWithResult(_0x1bde3c,null))[_0x0a9e('0x42')](handleError(_0x1bde3c,null));};exports[_0x0a9e('0x47')]=function(_0x19383e,_0x34febd){var _0x58a5c2;return db[_0x0a9e('0x48')][_0x0a9e('0x49')](function(_0x4f7240){return db['VoicePrefix']['create'](_0x19383e[_0x0a9e('0x4a')],{'transaction':_0x4f7240})[_0x0a9e('0x23')](function(_0x37edaa){_0x58a5c2=_0x37edaa[_0x0a9e('0x25')]({'plain':!![]});return db[_0x0a9e('0x4b')][_0x0a9e('0x45')]({'where':{'id':_0x58a5c2[_0x0a9e('0x4c')]},'raw':!![]})[_0x0a9e('0x23')](function(_0x5d38ae){return createVoicePrefixExtensions(_0x58a5c2,_0x5d38ae,_0x4f7240);});});})['then'](function(){var _0x53975a=_0x19383e[_0x0a9e('0x4d')][_0x0a9e('0x25')]({'plain':!![]});if(!_0x53975a)throw new Error(_0x0a9e('0x4e'));if(_0x53975a['role']===_0x0a9e('0x4d')){var _0x161aa7=_0x58a5c2;return db['UserProfileSection']['find']({'where':{'name':_0x0a9e('0x4f'),'userProfileId':_0x53975a['userProfileId']},'raw':!![]})[_0x0a9e('0x23')](function(_0x4c3845){if(_0x4c3845&&_0x4c3845[_0x0a9e('0x50')]===0x0){return db[_0x0a9e('0x51')][_0x0a9e('0x47')]({'name':_0x161aa7['name'],'resourceId':_0x161aa7['id'],'type':_0x4c3845[_0x0a9e('0x28')],'sectionId':_0x4c3845['id']},{})[_0x0a9e('0x23')](function(){return _0x58a5c2;});}else{return _0x58a5c2;}})['catch'](function(_0x50f687){logger[_0x0a9e('0x26')](_0x0a9e('0x52'),_0x50f687);throw _0x50f687;});}return _0x58a5c2;})['then'](respondWithResult(_0x34febd,null))[_0x0a9e('0x42')](handleError(_0x34febd,null));};function Extension(_0x5ce9ac,_0x211ef9,_0x523cd2,_0xe22ccc){this['context']='from-sip';this['exten']=_0x5ce9ac;this[_0x0a9e('0x53')]=_0x523cd2;this['type']=_0x0a9e('0x54');this[_0x0a9e('0x55')]=_0x0a9e('0x56');this[_0x0a9e('0x57')]=_0x211ef9;this[_0x0a9e('0x58')]=_0xe22ccc;}function createVoicePrefixExtensions(_0x272738,_0xd10662,_0x28d814){return new BPromise(function(_0x4e67ab,_0x1c693e){var _0x121cef=new Extension(formatPrefixName(_0x272738[_0x0a9e('0x59')]),0x1,_0x0a9e('0x5a'),_0x0a9e('0x5b'));_0x121cef[_0x0a9e('0x5c')]=_0x272738['id'];return db['VoiceExtension'][_0x0a9e('0x47')](_0x121cef,{'transaction':_0x28d814})[_0x0a9e('0x23')](function(_0x5239ef){var _0x3649cc=_0x5239ef['get']({'plain':!![]});var _0x20c668=_['map'](addVoicePrefixExtensions(_0x272738,_0xd10662),function(_0x4b3c1a){_0x4b3c1a['VoiceExtensionId']=_0x3649cc['id'];_0x4b3c1a[_0x0a9e('0x5c')]=_0x272738['id'];return _0x4b3c1a;});return db['VoiceExtension'][_0x0a9e('0x5d')](_0x20c668,{'transaction':_0x28d814})[_0x0a9e('0x23')](function(_0x261adb){if(!_0x261adb){return _0x1c693e(_0x0a9e('0x5e'));}else{return _0x4e67ab(_0x261adb);}})[_0x0a9e('0x42')](function(_0x26d7db){return _0x1c693e(_0x26d7db);});});;});};function addVoicePrefixExtensions(_0x49eed0,_0x1627a7){var _0x5854cc=[];var _0xca4ade=formatPrefixName(_0x49eed0[_0x0a9e('0x59')]);_0x5854cc[_0x0a9e('0x5f')](new Extension(_0xca4ade,0x2,'Set',_0x0a9e('0x60')+_0x49eed0[_0x0a9e('0x28')]));if(_0x49eed0[_0x0a9e('0x61')]){_0x5854cc[_0x0a9e('0x5f')](new Extension(_0xca4ade,0x3,'Set',_0x0a9e('0x62')+_0x49eed0[_0x0a9e('0x61')]));}else{_0x5854cc['push'](new Extension(_0xca4ade,0x3,_0x0a9e('0x5a'),_0x0a9e('0x63')));}_0x5854cc[_0x0a9e('0x5f')](new Extension(_0xca4ade,0x4,_0x0a9e('0x64'),_0x1627a7[_0x0a9e('0x65')]+','+'${EXTEN:'+(0x8+_0x49eed0[_0x0a9e('0x28')][_0x0a9e('0x32')])+'}'+','+0x1));return _0x5854cc;}function formatPrefixName(_0x281c7d){var _0x47bb43='_';for(var _0x3528b7=0x0;_0x3528b7<_0x281c7d['length'];_0x3528b7++){if(_0x281c7d['charAt'](_0x3528b7)=='-'){_0x47bb43+=_0x281c7d[_0x0a9e('0x66')](_0x3528b7);}else{_0x47bb43+='['+_0x281c7d[_0x0a9e('0x66')](_0x3528b7)+']';}}_0x47bb43+='.';return _0x47bb43;}exports[_0x0a9e('0x22')]=function(_0x19c995,_0x186f39,_0xc8c264){var _0x387489=_0x19c995[_0x0a9e('0x4a')];_0x387489[_0x0a9e('0x59')]=_0x0a9e('0x67')+_0x387489[_0x0a9e('0x28')]+'-';return db[_0x0a9e('0x48')][_0x0a9e('0x49')](function(_0x2b8192){return db[_0x0a9e('0x2a')][_0x0a9e('0x22')](_0x387489,{'where':{'id':_0x387489['id']},'transaction':_0x2b8192})[_0x0a9e('0x23')](function(){return db[_0x0a9e('0x4b')]['destroy']({'where':{'VoicePrefixId':_0x387489['id']},'transaction':_0x2b8192})[_0x0a9e('0x23')](function(){return db[_0x0a9e('0x4b')][_0x0a9e('0x45')]({'where':{'id':_0x387489['VoiceExtensionId']},'raw':!![]})[_0x0a9e('0x23')](function(_0x30944e){return createVoicePrefixExtensions(_0x387489,_0x30944e,_0x2b8192);});});});})['then'](function(){return db[_0x0a9e('0x2a')][_0x0a9e('0x68')](_0x387489['id']);})[_0x0a9e('0x23')](respondWithResult(_0x186f39,null))[_0x0a9e('0x42')](handleError(_0x186f39,null));};exports[_0x0a9e('0x69')]=function(_0x4a43a8,_0x50cdce,_0x4a2438){return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x4a43a8[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x50cdce,null))[_0x0a9e('0x23')](function(_0x380ab3){if(_0x380ab3){return _0x380ab3[_0x0a9e('0x69')](_0x4a43a8[_0x0a9e('0x4a')]['ids'],_[_0x0a9e('0x6a')](_0x4a43a8[_0x0a9e('0x4a')],[_0x0a9e('0x6b'),'id'])||{})['spread'](function(_0x2bdc44){for(var _0x583b2e=0x0;_0x583b2e<_0x4a43a8[_0x0a9e('0x4a')][_0x0a9e('0x6b')]['length'];_0x583b2e+=0x1){socket[_0x0a9e('0x6c')](_0x0a9e('0x6d'),{'UserId':_0x4a43a8[_0x0a9e('0x4a')][_0x0a9e('0x6b')][_0x583b2e],'VoicePrefixId':_0x4a43a8['params']['id']});}return _0x2bdc44;});}})[_0x0a9e('0x23')](respondWithResult(_0x50cdce,null))[_0x0a9e('0x42')](handleError(_0x50cdce,null));};exports[_0x0a9e('0x6e')]=function(_0x278ab4,_0x5b7fc3,_0x109ccb){var _0x3d91db;return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x278ab4['params']['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x5b7fc3,null))[_0x0a9e('0x23')](function(_0x30a4c7){if(_0x30a4c7){return _0x30a4c7[_0x0a9e('0x6e')](_0x278ab4[_0x0a9e('0x2e')][_0x0a9e('0x6b')])[_0x0a9e('0x23')](function(_0x3df0e3){if(_[_0x0a9e('0x6f')](_0x278ab4[_0x0a9e('0x2e')][_0x0a9e('0x6b')])){for(var _0x1f10ef=0x0;_0x1f10ef<_0x278ab4[_0x0a9e('0x2e')][_0x0a9e('0x6b')]['length'];_0x1f10ef+=0x1){socket[_0x0a9e('0x6c')](_0x0a9e('0x70'),{'UserId':_0x278ab4[_0x0a9e('0x2e')]['ids'][_0x1f10ef],'VoicePrefixId':_0x278ab4[_0x0a9e('0x44')]['id']});}}else{socket[_0x0a9e('0x6c')](_0x0a9e('0x70'),{'UserId':_0x278ab4[_0x0a9e('0x2e')]['ids'],'VoicePrefixId':_0x278ab4['params']['id']});}});}})[_0x0a9e('0x23')](respondWithStatusCode(_0x5b7fc3,null))[_0x0a9e('0x42')](handleError(_0x5b7fc3,null));};exports['getAgents']=function(_0x45108c,_0x53a6a1,_0x260f4b){var _0x8ebf02={};var _0x5637a1={};var _0x28a942;var _0x41cf12;return db[_0x0a9e('0x2a')][_0x0a9e('0x71')]({'where':{'id':_0x45108c[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x53a6a1,null))[_0x0a9e('0x23')](function(_0x482ca2){if(_0x482ca2){_0x28a942=_0x482ca2;_0x5637a1[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x72')][_0x0a9e('0x2b')]);_0x5637a1['query']=_[_0x0a9e('0x2d')](_0x45108c[_0x0a9e('0x2e')]);_0x5637a1['filters']=_[_0x0a9e('0x2f')](_0x5637a1['model'],_0x5637a1[_0x0a9e('0x2e')]);_0x8ebf02[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x5637a1[_0x0a9e('0x2c')],qs['fields'](_0x45108c['query'][_0x0a9e('0x31')]));_0x8ebf02[_0x0a9e('0x30')]=_0x8ebf02[_0x0a9e('0x30')]['length']?_0x8ebf02[_0x0a9e('0x30')]:_0x5637a1[_0x0a9e('0x2c')];_0x8ebf02['order']=qs['sort'](_0x45108c[_0x0a9e('0x2e')]['sort']);_0x8ebf02['where']=qs['filters'](_[_0x0a9e('0x73')](_0x45108c[_0x0a9e('0x2e')],_0x5637a1[_0x0a9e('0x36')]));if(_0x45108c[_0x0a9e('0x2e')][_0x0a9e('0x37')]){_0x8ebf02[_0x0a9e('0x39')]=_['merge'](_0x8ebf02[_0x0a9e('0x39')],{'$or':_['map'](_0x8ebf02[_0x0a9e('0x30')],function(_0x2aabab){var _0x18ad56={};_0x18ad56[_0x2aabab]={'$like':'%'+_0x45108c[_0x0a9e('0x2e')]['filter']+'%'};return _0x18ad56;})});}_0x8ebf02=_[_0x0a9e('0x38')]({},_0x8ebf02,_0x45108c[_0x0a9e('0x3e')]);return _0x28a942[_0x0a9e('0x74')](_0x8ebf02);}})['then'](function(_0xb6e411){if(_0xb6e411){_0x41cf12=_0xb6e411[_0x0a9e('0x32')];if(!_0x45108c[_0x0a9e('0x2e')][_0x0a9e('0x33')](_0x0a9e('0x75'))){_0x8ebf02[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x45108c[_0x0a9e('0x2e')]['limit']);_0x8ebf02[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x45108c['query'][_0x0a9e('0x1c')]);}return _0x28a942[_0x0a9e('0x74')](_0x8ebf02);}})[_0x0a9e('0x23')](function(_0x5a26c8){if(_0x5a26c8){return _0x5a26c8?{'count':_0x41cf12,'rows':_0x5a26c8}:null;}})[_0x0a9e('0x23')](respondWithResult(_0x53a6a1,null))['catch'](handleError(_0x53a6a1,null));};
\ No newline at end of file
+var _0xa9e0=['includeAll','include','rows','catch','show','params','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoicePrefixes','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','charAt','system-','findById','addAgents','omit','ids','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','pick','getAgents','nolimit','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','error','stack','name','index','VoicePrefix','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','map','type','key','VIRTUAL','options'];(function(_0x404e4c,_0x5cf081){var _0xdc22ed=function(_0x42ed92){while(--_0x42ed92){_0x404e4c['push'](_0x404e4c['shift']());}};_0xdc22ed(++_0x5cf081);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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 authService=require(_0x0a9e('0xe'));var hardwareService=require(_0x0a9e('0xf'));var Redis=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x0a9e('0x13')]=_[_0x0a9e('0x14')](config[_0x0a9e('0x13')],{'host':_0x0a9e('0x15'),'port':0x18eb});var socket=require(_0x0a9e('0x16'))(new Redis(config[_0x0a9e('0x13')]));require('./voicePrefix.socket')[_0x0a9e('0x17')](socket);function respondWithStatusCode(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xcc;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x18')](_0x2b4227);}return _0x239b12[_0x0a9e('0x19')](_0x2b4227)['end']();};}function respondWithResult(_0x22dccb,_0x5d0880){_0x5d0880=_0x5d0880||0xc8;return function(_0x1985b6){if(_0x1985b6){return _0x22dccb['status'](_0x5d0880)[_0x0a9e('0x1a')](_0x1985b6);}};}function respondWithFilteredResult(_0x12066b,_0x48f32d){return function(_0x225616){if(_0x225616){var _0x5a0a06=_0x225616[_0x0a9e('0x1b')],_0x459eb1=_0x48f32d[_0x0a9e('0x1c')],_0x478723=_0x48f32d[_0x0a9e('0x1c')]+_0x48f32d[_0x0a9e('0x1d')],_0x106033;if(_0x478723>=_0x5a0a06){_0x478723=_0x5a0a06;_0x106033=0xc8;}else{_0x106033=0xce;}_0x12066b[_0x0a9e('0x19')](_0x106033);return _0x12066b[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x459eb1+'-'+_0x478723+'/'+_0x5a0a06)[_0x0a9e('0x1a')](_0x225616);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x20')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x21')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x22')](_0x5a09ef)[_0x0a9e('0x23')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x24')]()[_0x0a9e('0x23')](function(){var _0x370d86=_0x2fb0e4[_0x0a9e('0x25')]({'plain':!![]});var _0x16b1ca='VoicePrefixes';return db['UserProfileResource'][_0x0a9e('0x24')]({'where':{'type':_0x16b1ca,'resourceId':_0x370d86['id']}})[_0x0a9e('0x23')](function(){return _0x2fb0e4;});})[_0x0a9e('0x23')](function(){_0x4abc77[_0x0a9e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x384319,_0x479bc4){return function(_0x45a1e7){if(!_0x45a1e7){_0x384319['sendStatus'](0x194);}return _0x45a1e7;};}function handleError(_0x1dc186,_0x34dc65){_0x34dc65=_0x34dc65||0x1f4;return function(_0x25fba9){logger[_0x0a9e('0x26')](_0x25fba9[_0x0a9e('0x27')]);if(_0x25fba9[_0x0a9e('0x28')]){delete _0x25fba9[_0x0a9e('0x28')];}_0x1dc186[_0x0a9e('0x19')](_0x34dc65)['send'](_0x25fba9);};}exports[_0x0a9e('0x29')]=function(_0x468813,_0x2b1f27){var _0x2ec755={},_0x5c877d={},_0x15b200={'count':0x0,'rows':[]};var _0x40e7a3=db[_0x0a9e('0x2a')][_0x0a9e('0x2b')];_0x5c877d[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x40e7a3);_0x5c877d[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x468813[_0x0a9e('0x2e')]);_0x5c877d['filters']=_[_0x0a9e('0x2f')](_0x5c877d['model'],_0x5c877d[_0x0a9e('0x2e')]);_0x2ec755[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x5c877d[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x468813['query'][_0x0a9e('0x31')]));_0x2ec755[_0x0a9e('0x30')]=_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x2ec755[_0x0a9e('0x30')]:_0x5c877d[_0x0a9e('0x2c')];if(!_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x2ec755[_0x0a9e('0x1d')]=qs['limit'](_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x2ec755[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x468813['query'][_0x0a9e('0x1c')]);}_0x2ec755[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x468813[_0x0a9e('0x2e')]['sort']);_0x2ec755['where']=qs[_0x0a9e('0x36')](_['pick'](_0x468813[_0x0a9e('0x2e')],_0x5c877d[_0x0a9e('0x36')]));if(_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]){_0x2ec755['where']=_[_0x0a9e('0x38')](_0x2ec755[_0x0a9e('0x39')],{'$or':_[_0x0a9e('0x3a')](_0x40e7a3,function(_0x533942){if(_0x533942[_0x0a9e('0x3b')][_0x0a9e('0x3c')]!==_0x0a9e('0x3d')){var _0x4c1c0e={};_0x4c1c0e[_0x533942['field']]={'$like':'%'+_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x4c1c0e;}})});}_0x2ec755=_['merge']({},_0x2ec755,_0x468813[_0x0a9e('0x3e')]);var _0x419125={'where':_0x2ec755[_0x0a9e('0x39')]};return db[_0x0a9e('0x2a')]['count'](_0x419125)['then'](function(_0x15e37d){_0x15b200[_0x0a9e('0x1b')]=_0x15e37d;if(_0x468813['query'][_0x0a9e('0x3f')]){_0x2ec755[_0x0a9e('0x40')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')]['findAll'](_0x2ec755);})[_0x0a9e('0x23')](function(_0x2cfea9){_0x15b200[_0x0a9e('0x41')]=_0x2cfea9;return _0x15b200;})[_0x0a9e('0x23')](respondWithFilteredResult(_0x2b1f27,_0x2ec755))[_0x0a9e('0x42')](handleError(_0x2b1f27,null));};exports[_0x0a9e('0x43')]=function(_0x2881b3,_0x45a9b8){var _0x23b089={'raw':![],'where':{'id':_0x2881b3[_0x0a9e('0x44')]['id']}},_0x3da2cd={};_0x3da2cd[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x3da2cd['query']=_['keys'](_0x2881b3[_0x0a9e('0x2e')]);_0x3da2cd[_0x0a9e('0x36')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],_0x3da2cd[_0x0a9e('0x2e')]);_0x23b089[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x23b089[_0x0a9e('0x30')]=_0x23b089['attributes'][_0x0a9e('0x32')]?_0x23b089[_0x0a9e('0x30')]:_0x3da2cd[_0x0a9e('0x2c')];if(_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x3f')]){_0x23b089[_0x0a9e('0x40')]=[{'all':!![]}];}_0x23b089=_[_0x0a9e('0x38')]({},_0x23b089,_0x2881b3[_0x0a9e('0x3e')]);return db['VoicePrefix'][_0x0a9e('0x45')](_0x23b089)['then'](handleEntityNotFound(_0x45a9b8,null))[_0x0a9e('0x23')](respondWithResult(_0x45a9b8,null))[_0x0a9e('0x42')](handleError(_0x45a9b8,null));};exports[_0x0a9e('0x24')]=function(_0x562fb4,_0x14bec2){return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x562fb4[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x14bec2,null))[_0x0a9e('0x23')](removeEntity(_0x14bec2,null))[_0x0a9e('0x42')](handleError(_0x14bec2,null));};exports['describe']=function(_0x13f44d,_0x1bde3c){return db[_0x0a9e('0x2a')][_0x0a9e('0x46')]()[_0x0a9e('0x23')](respondWithResult(_0x1bde3c,null))[_0x0a9e('0x42')](handleError(_0x1bde3c,null));};exports[_0x0a9e('0x47')]=function(_0x19383e,_0x34febd){var _0x58a5c2;return db[_0x0a9e('0x48')][_0x0a9e('0x49')](function(_0x4f7240){return db['VoicePrefix']['create'](_0x19383e[_0x0a9e('0x4a')],{'transaction':_0x4f7240})[_0x0a9e('0x23')](function(_0x37edaa){_0x58a5c2=_0x37edaa[_0x0a9e('0x25')]({'plain':!![]});return db[_0x0a9e('0x4b')][_0x0a9e('0x45')]({'where':{'id':_0x58a5c2[_0x0a9e('0x4c')]},'raw':!![]})[_0x0a9e('0x23')](function(_0x5d38ae){return createVoicePrefixExtensions(_0x58a5c2,_0x5d38ae,_0x4f7240);});});})['then'](function(){var _0x53975a=_0x19383e[_0x0a9e('0x4d')][_0x0a9e('0x25')]({'plain':!![]});if(!_0x53975a)throw new Error(_0x0a9e('0x4e'));if(_0x53975a['role']===_0x0a9e('0x4d')){var _0x161aa7=_0x58a5c2;return db['UserProfileSection']['find']({'where':{'name':_0x0a9e('0x4f'),'userProfileId':_0x53975a['userProfileId']},'raw':!![]})[_0x0a9e('0x23')](function(_0x4c3845){if(_0x4c3845&&_0x4c3845[_0x0a9e('0x50')]===0x0){return db[_0x0a9e('0x51')][_0x0a9e('0x47')]({'name':_0x161aa7['name'],'resourceId':_0x161aa7['id'],'type':_0x4c3845[_0x0a9e('0x28')],'sectionId':_0x4c3845['id']},{})[_0x0a9e('0x23')](function(){return _0x58a5c2;});}else{return _0x58a5c2;}})['catch'](function(_0x50f687){logger[_0x0a9e('0x26')](_0x0a9e('0x52'),_0x50f687);throw _0x50f687;});}return _0x58a5c2;})['then'](respondWithResult(_0x34febd,null))[_0x0a9e('0x42')](handleError(_0x34febd,null));};function Extension(_0x5ce9ac,_0x211ef9,_0x523cd2,_0xe22ccc){this['context']='from-sip';this['exten']=_0x5ce9ac;this[_0x0a9e('0x53')]=_0x523cd2;this['type']=_0x0a9e('0x54');this[_0x0a9e('0x55')]=_0x0a9e('0x56');this[_0x0a9e('0x57')]=_0x211ef9;this[_0x0a9e('0x58')]=_0xe22ccc;}function createVoicePrefixExtensions(_0x272738,_0xd10662,_0x28d814){return new BPromise(function(_0x4e67ab,_0x1c693e){var _0x121cef=new Extension(formatPrefixName(_0x272738[_0x0a9e('0x59')]),0x1,_0x0a9e('0x5a'),_0x0a9e('0x5b'));_0x121cef[_0x0a9e('0x5c')]=_0x272738['id'];return db['VoiceExtension'][_0x0a9e('0x47')](_0x121cef,{'transaction':_0x28d814})[_0x0a9e('0x23')](function(_0x5239ef){var _0x3649cc=_0x5239ef['get']({'plain':!![]});var _0x20c668=_['map'](addVoicePrefixExtensions(_0x272738,_0xd10662),function(_0x4b3c1a){_0x4b3c1a['VoiceExtensionId']=_0x3649cc['id'];_0x4b3c1a[_0x0a9e('0x5c')]=_0x272738['id'];return _0x4b3c1a;});return db['VoiceExtension'][_0x0a9e('0x5d')](_0x20c668,{'transaction':_0x28d814})[_0x0a9e('0x23')](function(_0x261adb){if(!_0x261adb){return _0x1c693e(_0x0a9e('0x5e'));}else{return _0x4e67ab(_0x261adb);}})[_0x0a9e('0x42')](function(_0x26d7db){return _0x1c693e(_0x26d7db);});});;});};function addVoicePrefixExtensions(_0x49eed0,_0x1627a7){var _0x5854cc=[];var _0xca4ade=formatPrefixName(_0x49eed0[_0x0a9e('0x59')]);_0x5854cc[_0x0a9e('0x5f')](new Extension(_0xca4ade,0x2,'Set',_0x0a9e('0x60')+_0x49eed0[_0x0a9e('0x28')]));if(_0x49eed0[_0x0a9e('0x61')]){_0x5854cc[_0x0a9e('0x5f')](new Extension(_0xca4ade,0x3,'Set',_0x0a9e('0x62')+_0x49eed0[_0x0a9e('0x61')]));}else{_0x5854cc['push'](new Extension(_0xca4ade,0x3,_0x0a9e('0x5a'),_0x0a9e('0x63')));}_0x5854cc[_0x0a9e('0x5f')](new Extension(_0xca4ade,0x4,_0x0a9e('0x64'),_0x1627a7[_0x0a9e('0x65')]+','+'${EXTEN:'+(0x8+_0x49eed0[_0x0a9e('0x28')][_0x0a9e('0x32')])+'}'+','+0x1));return _0x5854cc;}function formatPrefixName(_0x281c7d){var _0x47bb43='_';for(var _0x3528b7=0x0;_0x3528b7<_0x281c7d['length'];_0x3528b7++){if(_0x281c7d['charAt'](_0x3528b7)=='-'){_0x47bb43+=_0x281c7d[_0x0a9e('0x66')](_0x3528b7);}else{_0x47bb43+='['+_0x281c7d[_0x0a9e('0x66')](_0x3528b7)+']';}}_0x47bb43+='.';return _0x47bb43;}exports[_0x0a9e('0x22')]=function(_0x19c995,_0x186f39,_0xc8c264){var _0x387489=_0x19c995[_0x0a9e('0x4a')];_0x387489[_0x0a9e('0x59')]=_0x0a9e('0x67')+_0x387489[_0x0a9e('0x28')]+'-';return db[_0x0a9e('0x48')][_0x0a9e('0x49')](function(_0x2b8192){return db[_0x0a9e('0x2a')][_0x0a9e('0x22')](_0x387489,{'where':{'id':_0x387489['id']},'transaction':_0x2b8192})[_0x0a9e('0x23')](function(){return db[_0x0a9e('0x4b')]['destroy']({'where':{'VoicePrefixId':_0x387489['id']},'transaction':_0x2b8192})[_0x0a9e('0x23')](function(){return db[_0x0a9e('0x4b')][_0x0a9e('0x45')]({'where':{'id':_0x387489['VoiceExtensionId']},'raw':!![]})[_0x0a9e('0x23')](function(_0x30944e){return createVoicePrefixExtensions(_0x387489,_0x30944e,_0x2b8192);});});});})['then'](function(){return db[_0x0a9e('0x2a')][_0x0a9e('0x68')](_0x387489['id']);})[_0x0a9e('0x23')](respondWithResult(_0x186f39,null))[_0x0a9e('0x42')](handleError(_0x186f39,null));};exports[_0x0a9e('0x69')]=function(_0x4a43a8,_0x50cdce,_0x4a2438){return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x4a43a8[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x50cdce,null))[_0x0a9e('0x23')](function(_0x380ab3){if(_0x380ab3){return _0x380ab3[_0x0a9e('0x69')](_0x4a43a8[_0x0a9e('0x4a')]['ids'],_[_0x0a9e('0x6a')](_0x4a43a8[_0x0a9e('0x4a')],[_0x0a9e('0x6b'),'id'])||{})['spread'](function(_0x2bdc44){for(var _0x583b2e=0x0;_0x583b2e<_0x4a43a8[_0x0a9e('0x4a')][_0x0a9e('0x6b')]['length'];_0x583b2e+=0x1){socket[_0x0a9e('0x6c')](_0x0a9e('0x6d'),{'UserId':_0x4a43a8[_0x0a9e('0x4a')][_0x0a9e('0x6b')][_0x583b2e],'VoicePrefixId':_0x4a43a8['params']['id']});}return _0x2bdc44;});}})[_0x0a9e('0x23')](respondWithResult(_0x50cdce,null))[_0x0a9e('0x42')](handleError(_0x50cdce,null));};exports[_0x0a9e('0x6e')]=function(_0x278ab4,_0x5b7fc3,_0x109ccb){var _0x3d91db;return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x278ab4['params']['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x5b7fc3,null))[_0x0a9e('0x23')](function(_0x30a4c7){if(_0x30a4c7){return _0x30a4c7[_0x0a9e('0x6e')](_0x278ab4[_0x0a9e('0x2e')][_0x0a9e('0x6b')])[_0x0a9e('0x23')](function(_0x3df0e3){if(_[_0x0a9e('0x6f')](_0x278ab4[_0x0a9e('0x2e')][_0x0a9e('0x6b')])){for(var _0x1f10ef=0x0;_0x1f10ef<_0x278ab4[_0x0a9e('0x2e')][_0x0a9e('0x6b')]['length'];_0x1f10ef+=0x1){socket[_0x0a9e('0x6c')](_0x0a9e('0x70'),{'UserId':_0x278ab4[_0x0a9e('0x2e')]['ids'][_0x1f10ef],'VoicePrefixId':_0x278ab4[_0x0a9e('0x44')]['id']});}}else{socket[_0x0a9e('0x6c')](_0x0a9e('0x70'),{'UserId':_0x278ab4[_0x0a9e('0x2e')]['ids'],'VoicePrefixId':_0x278ab4['params']['id']});}});}})[_0x0a9e('0x23')](respondWithStatusCode(_0x5b7fc3,null))[_0x0a9e('0x42')](handleError(_0x5b7fc3,null));};exports['getAgents']=function(_0x45108c,_0x53a6a1,_0x260f4b){var _0x8ebf02={};var _0x5637a1={};var _0x28a942;var _0x41cf12;return db[_0x0a9e('0x2a')][_0x0a9e('0x71')]({'where':{'id':_0x45108c[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x53a6a1,null))[_0x0a9e('0x23')](function(_0x482ca2){if(_0x482ca2){_0x28a942=_0x482ca2;_0x5637a1[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x72')][_0x0a9e('0x2b')]);_0x5637a1['query']=_[_0x0a9e('0x2d')](_0x45108c[_0x0a9e('0x2e')]);_0x5637a1['filters']=_[_0x0a9e('0x2f')](_0x5637a1['model'],_0x5637a1[_0x0a9e('0x2e')]);_0x8ebf02[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x5637a1[_0x0a9e('0x2c')],qs['fields'](_0x45108c['query'][_0x0a9e('0x31')]));_0x8ebf02[_0x0a9e('0x30')]=_0x8ebf02[_0x0a9e('0x30')]['length']?_0x8ebf02[_0x0a9e('0x30')]:_0x5637a1[_0x0a9e('0x2c')];_0x8ebf02['order']=qs['sort'](_0x45108c[_0x0a9e('0x2e')]['sort']);_0x8ebf02['where']=qs['filters'](_[_0x0a9e('0x73')](_0x45108c[_0x0a9e('0x2e')],_0x5637a1[_0x0a9e('0x36')]));if(_0x45108c[_0x0a9e('0x2e')][_0x0a9e('0x37')]){_0x8ebf02[_0x0a9e('0x39')]=_['merge'](_0x8ebf02[_0x0a9e('0x39')],{'$or':_['map'](_0x8ebf02[_0x0a9e('0x30')],function(_0x2aabab){var _0x18ad56={};_0x18ad56[_0x2aabab]={'$like':'%'+_0x45108c[_0x0a9e('0x2e')]['filter']+'%'};return _0x18ad56;})});}_0x8ebf02=_[_0x0a9e('0x38')]({},_0x8ebf02,_0x45108c[_0x0a9e('0x3e')]);return _0x28a942[_0x0a9e('0x74')](_0x8ebf02);}})['then'](function(_0xb6e411){if(_0xb6e411){_0x41cf12=_0xb6e411[_0x0a9e('0x32')];if(!_0x45108c[_0x0a9e('0x2e')][_0x0a9e('0x33')](_0x0a9e('0x75'))){_0x8ebf02[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x45108c[_0x0a9e('0x2e')]['limit']);_0x8ebf02[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x45108c['query'][_0x0a9e('0x1c')]);}return _0x28a942[_0x0a9e('0x74')](_0x8ebf02);}})[_0x0a9e('0x23')](function(_0x5a26c8){if(_0x5a26c8){return _0x5a26c8?{'count':_0x41cf12,'rows':_0x5a26c8}:null;}})[_0x0a9e('0x23')](respondWithResult(_0x53a6a1,null))['catch'](handleError(_0x53a6a1,null));};
\ No newline at end of file
index e348a95..e940f35 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0faf=['update','remove','emit','hasOwnProperty','hook','exports','events','VoicePrefix','setMaxListeners','save'];(function(_0x2fa7d8,_0x1f8dd7){var _0x2fbecf=function(_0x1c3171){while(--_0x1c3171){_0x2fa7d8['push'](_0x2fa7d8['shift']());}};_0x2fbecf(++_0x1f8dd7);}(_0x0faf,0x132));var _0xf0fa=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x0faf[_0x75f869];return _0x10af8b;};'use strict';var EventEmitter=require(_0xf0fa('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0xf0fa('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xf0fa('0x2')](0x0);var events={'afterCreate':_0xf0fa('0x3'),'afterUpdate':_0xf0fa('0x4'),'afterDestroy':_0xf0fa('0x5')};function emitEvent(_0xdc9ce3){return function(_0x515b12,_0xc83253,_0x283f04){VoicePrefixEvents['emit'](_0xdc9ce3+':'+_0x515b12['id'],_0x515b12);VoicePrefixEvents[_0xf0fa('0x6')](_0xdc9ce3,_0x515b12);_0x283f04(null);};}for(var e in events){if(events[_0xf0fa('0x7')](e)){var event=events[e];VoicePrefix[_0xf0fa('0x8')](e,emitEvent(event));}}module[_0xf0fa('0x9')]=VoicePrefixEvents;
\ No newline at end of file
+var _0x17ba=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4e904a,_0x1480e1){var _0x234b6f=function(_0x2425aa){while(--_0x2425aa){_0x4e904a['push'](_0x4e904a['shift']());}};_0x234b6f(++_0x1480e1);}(_0x17ba,0xab));var _0xa17b=function(_0x3fbdf3,_0x156f57){_0x3fbdf3=_0x3fbdf3-0x0;var _0x3d435a=_0x17ba[_0x3fbdf3];return _0x3d435a;};'use strict';var EventEmitter=require(_0xa17b('0x0'));var VoicePrefix=require(_0xa17b('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xa17b('0x2')](0x0);var events={'afterCreate':_0xa17b('0x3'),'afterUpdate':_0xa17b('0x4'),'afterDestroy':_0xa17b('0x5')};function emitEvent(_0x106b5b){return function(_0x38c13c,_0x11d7b7,_0x2f64d0){VoicePrefixEvents[_0xa17b('0x6')](_0x106b5b+':'+_0x38c13c['id'],_0x38c13c);VoicePrefixEvents[_0xa17b('0x6')](_0x106b5b,_0x38c13c);_0x2f64d0(null);};}for(var e in events){if(events[_0xa17b('0x7')](e)){var event=events[e];VoicePrefix[_0xa17b('0x8')](e,emitEvent(event));}}module[_0xa17b('0x9')]=VoicePrefixEvents;
\ No newline at end of file
index c6a5d09..321c5fc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaf40=['bluebird','request-promise','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','util','../../config/logger','api','moment'];(function(_0x336181,_0x337221){var _0x1a4f51=function(_0x483e05){while(--_0x483e05){_0x336181['push'](_0x336181['shift']());}};_0x1a4f51(++_0x337221);}(_0xaf40,0x75));var _0x0af4=function(_0x55cd7f,_0x42e92d){_0x55cd7f=_0x55cd7f-0x0;var _0x26a7ce=_0xaf40[_0x55cd7f];return _0x26a7ce;};'use strict';var _=require('lodash');var util=require(_0x0af4('0x0'));var logger=require(_0x0af4('0x1'))(_0x0af4('0x2'));var moment=require(_0x0af4('0x3'));var BPromise=require(_0x0af4('0x4'));var rp=require(_0x0af4('0x5'));var attributes=require(_0x0af4('0x6'));module[_0x0af4('0x7')]=function(_0x18ca82,_0x2b432d){return _0x18ca82[_0x0af4('0x8')](_0x0af4('0x9'),attributes,{'tableName':_0x0af4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x9483=['VoicePrefix','voice_prefixes','lodash','util','api','moment','bluebird','request-promise','exports','define'];(function(_0x53fe97,_0x544271){var _0x5c49a2=function(_0x3fa2b4){while(--_0x3fa2b4){_0x53fe97['push'](_0x53fe97['shift']());}};_0x5c49a2(++_0x544271);}(_0x9483,0x12e));var _0x3948=function(_0x3f47d8,_0x359500){_0x3f47d8=_0x3f47d8-0x0;var _0x401095=_0x9483[_0x3f47d8];return _0x401095;};'use strict';var _=require(_0x3948('0x0'));var util=require(_0x3948('0x1'));var logger=require('../../config/logger')(_0x3948('0x2'));var moment=require(_0x3948('0x3'));var BPromise=require(_0x3948('0x4'));var rp=require(_0x3948('0x5'));var attributes=require('./voicePrefix.attributes');module[_0x3948('0x6')]=function(_0x32faf0,_0x58742e){return _0x32faf0[_0x3948('0x7')](_0x3948('0x8'),attributes,{'tableName':_0x3948('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 3ec7950..e44c5e6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x581a=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x581a,0x79));var _0xa581=function(_0x126e94,_0x41f6f4){_0x126e94=_0x126e94-0x0;var _0x4b8d9e=_0x581a[_0x126e94];return _0x4b8d9e;};'use strict';var _=require(_0xa581('0x0'));var util=require(_0xa581('0x1'));var moment=require(_0xa581('0x2'));var BPromise=require(_0xa581('0x3'));var rs=require(_0xa581('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa581('0x5'))['db'];var utils=require(_0xa581('0x6'));var logger=require(_0xa581('0x7'))(_0xa581('0x8'));var config=require(_0xa581('0x9'));var jayson=require(_0xa581('0xa'));var client=jayson[_0xa581('0xb')][_0xa581('0xc')]({'port':0x232a});config[_0xa581('0xd')]=_[_0xa581('0xe')](config[_0xa581('0xd')],{'host':_0xa581('0xf'),'port':0x18eb});var socket=require(_0xa581('0x10'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0xa581('0x11')](socket);function respondWithRpcPromise(_0x567c9c,_0x1c2023,_0x4fa0fd){return new BPromise(function(_0x7ee7ac,_0x36c381){return client[_0xa581('0x12')](_0x567c9c,_0x4fa0fd)[_0xa581('0x13')](function(_0x193267){logger[_0xa581('0x14')](_0xa581('0x15'),_0x1c2023,_0xa581('0x16'));logger[_0xa581('0x17')](_0xa581('0x18'),_0x1c2023,_0xa581('0x16'),JSON[_0xa581('0x19')](_0x193267));if(_0x193267[_0xa581('0x1a')]){if(_0x193267[_0xa581('0x1a')][_0xa581('0x1b')]===0x1f4){logger['error'](_0xa581('0x15'),_0x1c2023,_0x193267[_0xa581('0x1a')][_0xa581('0x1c')]);return _0x36c381(_0x193267[_0xa581('0x1a')]['message']);}logger[_0xa581('0x1a')](_0xa581('0x15'),_0x1c2023,_0x193267['error'][_0xa581('0x1c')]);return _0x7ee7ac(_0x193267[_0xa581('0x1a')][_0xa581('0x1c')]);}else{logger[_0xa581('0x14')](_0xa581('0x15'),_0x1c2023,_0xa581('0x16'));_0x7ee7ac(_0x193267[_0xa581('0x1d')][_0xa581('0x1c')]);}})[_0xa581('0x1e')](function(_0x3bfb62){logger[_0xa581('0x1a')](_0xa581('0x15'),_0x1c2023,_0x3bfb62);_0x36c381(_0x3bfb62);});});}
\ No newline at end of file
+var _0x2c0a=['request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s'];(function(_0x39a4c5,_0x504a9a){var _0x362340=function(_0x527dcb){while(--_0x527dcb){_0x39a4c5['push'](_0x39a4c5['shift']());}};_0x362340(++_0x504a9a);}(_0x2c0a,0xe0));var _0xa2c0=function(_0x2a7b8e,_0x50ffce){_0x2a7b8e=_0x2a7b8e-0x0;var _0x29b5c8=_0x2c0a[_0x2a7b8e];return _0x29b5c8;};'use strict';var _=require(_0xa2c0('0x0'));var util=require('util');var moment=require(_0xa2c0('0x1'));var BPromise=require(_0xa2c0('0x2'));var rs=require(_0xa2c0('0x3'));var fs=require('fs');var Redis=require(_0xa2c0('0x4'));var db=require(_0xa2c0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa2c0('0x6'))(_0xa2c0('0x7'));var config=require(_0xa2c0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa2c0('0x9')][_0xa2c0('0xa')]({'port':0x232a});config[_0xa2c0('0xb')]=_['defaults'](config[_0xa2c0('0xb')],{'host':_0xa2c0('0xc'),'port':0x18eb});var socket=require(_0xa2c0('0xd'))(new Redis(config[_0xa2c0('0xb')]));require(_0xa2c0('0xe'))[_0xa2c0('0xf')](socket);function respondWithRpcPromise(_0x532bb7,_0x33429a,_0x37b477){return new BPromise(function(_0xe04dce,_0x137c84){return client[_0xa2c0('0x10')](_0x532bb7,_0x37b477)['then'](function(_0x25ae85){logger[_0xa2c0('0x11')](_0xa2c0('0x12'),_0x33429a,_0xa2c0('0x13'));logger[_0xa2c0('0x14')](_0xa2c0('0x15'),_0x33429a,'request\x20sent',JSON[_0xa2c0('0x16')](_0x25ae85));if(_0x25ae85[_0xa2c0('0x17')]){if(_0x25ae85[_0xa2c0('0x17')]['code']===0x1f4){logger[_0xa2c0('0x17')](_0xa2c0('0x12'),_0x33429a,_0x25ae85[_0xa2c0('0x17')][_0xa2c0('0x18')]);return _0x137c84(_0x25ae85[_0xa2c0('0x17')][_0xa2c0('0x18')]);}logger[_0xa2c0('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x33429a,_0x25ae85[_0xa2c0('0x17')]['message']);return _0xe04dce(_0x25ae85[_0xa2c0('0x17')][_0xa2c0('0x18')]);}else{logger[_0xa2c0('0x11')](_0xa2c0('0x12'),_0x33429a,_0xa2c0('0x13'));_0xe04dce(_0x25ae85[_0xa2c0('0x19')][_0xa2c0('0x18')]);}})[_0xa2c0('0x1a')](function(_0x513588){logger[_0xa2c0('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x33429a,_0x513588);_0x137c84(_0x513588);});});}
\ No newline at end of file
index 5a118f1..5cb543c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2f3b=['./voicePrefix.events','remove','update','length'];(function(_0x3a3e30,_0x5996b5){var _0x19f849=function(_0xc6e736){while(--_0xc6e736){_0x3a3e30['push'](_0x3a3e30['shift']());}};_0x19f849(++_0x5996b5);}(_0x2f3b,0x19c));var _0xb2f3=function(_0x1d271a,_0x9e110d){_0x1d271a=_0x1d271a-0x0;var _0x3a8137=_0x2f3b[_0x1d271a];return _0x3a8137;};'use strict';var VoicePrefixEvents=require(_0xb2f3('0x0'));var events=['save',_0xb2f3('0x1'),_0xb2f3('0x2')];function createListener(_0x41c87d,_0xd9d22b){return function(_0x2deb55){_0xd9d22b['emit'](_0x41c87d,_0x2deb55);};}function removeListener(_0x247f3c,_0x2ab70a){return function(){VoicePrefixEvents['removeListener'](_0x247f3c,_0x2ab70a);};}exports['register']=function(_0x51f471){for(var _0x98c204=0x0,_0x41bd6a=events[_0xb2f3('0x3')];_0x98c204<_0x41bd6a;_0x98c204++){var _0x49bb50=events[_0x98c204];var _0x4a5d6d=createListener('voicePrefix:'+_0x49bb50,_0x51f471);VoicePrefixEvents['on'](_0x49bb50,_0x4a5d6d);}};
\ No newline at end of file
+var _0x3a12=['removeListener','register','length','./voicePrefix.events','remove','emit'];(function(_0x5a7e78,_0x400b57){var _0xa8d4a1=function(_0x486659){while(--_0x486659){_0x5a7e78['push'](_0x5a7e78['shift']());}};_0xa8d4a1(++_0x400b57);}(_0x3a12,0x11d));var _0x23a1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3a12[_0x20a584];return _0x4b41a8;};'use strict';var VoicePrefixEvents=require(_0x23a1('0x0'));var events=['save',_0x23a1('0x1'),'update'];function createListener(_0x9876b2,_0x1a84f9){return function(_0x38b720){_0x1a84f9[_0x23a1('0x2')](_0x9876b2,_0x38b720);};}function removeListener(_0x4f0630,_0xb0481){return function(){VoicePrefixEvents[_0x23a1('0x3')](_0x4f0630,_0xb0481);};}exports[_0x23a1('0x4')]=function(_0x8aad47){for(var _0x5364b4=0x0,_0x3554ff=events[_0x23a1('0x5')];_0x5364b4<_0x3554ff;_0x5364b4++){var _0x52eae=events[_0x5364b4];var _0x543642=createListener('voicePrefix:'+_0x52eae,_0x8aad47);VoicePrefixEvents['on'](_0x52eae,_0x543642);}};
\ No newline at end of file
index 909bafe..86ce904 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x303a=['/:id/blacklists','post','create','/:id/clone','clone','addTeams','addAgents','addBlackLists','put','update','delete','destroy','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists'];(function(_0xaf0d91,_0xdc98c8){var _0xa3747e=function(_0x35233c){while(--_0x35233c){_0xaf0d91['push'](_0xaf0d91['shift']());}};_0xa3747e(++_0xdc98c8);}(_0x303a,0x1a0));var _0xa303=function(_0x54fbff,_0x53470e){_0x54fbff=_0x54fbff-0x0;var _0x5cf619=_0x303a[_0x54fbff];return _0x5cf619;};'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 auth=require('../../components/auth/service');var interaction=require(_0xa303('0x5'));var config=require(_0xa303('0x6'));var controller=require(_0xa303('0x7'));router[_0xa303('0x8')]('/',auth[_0xa303('0x9')](),controller[_0xa303('0xa')]);router[_0xa303('0x8')](_0xa303('0xb'),auth[_0xa303('0x9')](),controller['show']);router['get']('/:id/hoppers',auth[_0xa303('0x9')](),controller[_0xa303('0xc')]);router['get'](_0xa303('0xd'),auth['isAuthenticated'](),controller[_0xa303('0xe')]);router['get'](_0xa303('0xf'),auth[_0xa303('0x9')](),controller[_0xa303('0x10')]);router[_0xa303('0x8')]('/:id/hopper_black',auth[_0xa303('0x9')](),controller['getHopperBlacks']);router[_0xa303('0x8')](_0xa303('0x11'),auth[_0xa303('0x9')](),controller['getTeams']);router[_0xa303('0x8')](_0xa303('0x12'),auth[_0xa303('0x9')](),controller[_0xa303('0x13')]);router[_0xa303('0x8')](_0xa303('0x14'),auth[_0xa303('0x9')](),controller[_0xa303('0x15')]);router['get'](_0xa303('0x16'),auth[_0xa303('0x9')](),controller[_0xa303('0x17')]);router[_0xa303('0x8')](_0xa303('0x18'),auth[_0xa303('0x9')](),controller['getBlackLists']);router[_0xa303('0x19')]('/',auth['isAuthenticated'](),controller[_0xa303('0x1a')]);router['post'](_0xa303('0x1b'),auth['isAuthenticated'](),controller[_0xa303('0x1c')]);router[_0xa303('0x19')](_0xa303('0x11'),auth['isAuthenticated'](),controller[_0xa303('0x1d')]);router[_0xa303('0x19')](_0xa303('0x12'),auth['isAuthenticated'](),controller[_0xa303('0x1e')]);router[_0xa303('0x19')](_0xa303('0x16'),auth[_0xa303('0x9')](),controller['addLists']);router[_0xa303('0x19')](_0xa303('0x18'),auth['isAuthenticated'](),controller[_0xa303('0x1f')]);router[_0xa303('0x20')](_0xa303('0xb'),auth[_0xa303('0x9')](),controller[_0xa303('0x21')]);router[_0xa303('0x22')](_0xa303('0xb'),auth[_0xa303('0x9')](),controller[_0xa303('0x23')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0xa303('0x12'),auth[_0xa303('0x9')](),controller[_0xa303('0x24')]);router[_0xa303('0x22')](_0xa303('0x16'),auth['isAuthenticated'](),controller[_0xa303('0x25')]);router[_0xa303('0x22')]('/:id/blacklists',auth[_0xa303('0x9')](),controller[_0xa303('0x26')]);module[_0xa303('0x27')]=router;
\ No newline at end of file
+var _0xf873=['removeBlackLists','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','isAuthenticated','index','get','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','post','create','/:id/clone','clone','addTeams','addBlackLists','put','/:id','update','delete','destroy','removeTeams','removeAgents','removeLists'];(function(_0x20b035,_0x33e530){var _0x26d5ec=function(_0x34fafa){while(--_0x34fafa){_0x20b035['push'](_0x20b035['shift']());}};_0x26d5ec(++_0x33e530);}(_0xf873,0xb2));var _0x3f87=function(_0x575a65,_0x4812f6){_0x575a65=_0x575a65-0x0;var _0x278749=_0xf873[_0x575a65];return _0x278749;};'use strict';var multer=require('multer');var util=require(_0x3f87('0x0'));var path=require(_0x3f87('0x1'));var timeout=require(_0x3f87('0x2'));var express=require(_0x3f87('0x3'));var router=express[_0x3f87('0x4')]();var auth=require(_0x3f87('0x5'));var interaction=require(_0x3f87('0x6'));var config=require(_0x3f87('0x7'));var controller=require(_0x3f87('0x8'));router['get']('/',auth[_0x3f87('0x9')](),controller[_0x3f87('0xa')]);router[_0x3f87('0xb')]('/:id',auth[_0x3f87('0x9')](),controller[_0x3f87('0xc')]);router[_0x3f87('0xb')](_0x3f87('0xd'),auth[_0x3f87('0x9')](),controller[_0x3f87('0xe')]);router['get'](_0x3f87('0xf'),auth[_0x3f87('0x9')](),controller[_0x3f87('0x10')]);router[_0x3f87('0xb')](_0x3f87('0x11'),auth[_0x3f87('0x9')](),controller[_0x3f87('0x12')]);router[_0x3f87('0xb')](_0x3f87('0x13'),auth[_0x3f87('0x9')](),controller[_0x3f87('0x14')]);router[_0x3f87('0xb')](_0x3f87('0x15'),auth[_0x3f87('0x9')](),controller['getTeams']);router[_0x3f87('0xb')](_0x3f87('0x16'),auth['isAuthenticated'](),controller[_0x3f87('0x17')]);router[_0x3f87('0xb')](_0x3f87('0x18'),auth[_0x3f87('0x9')](),controller[_0x3f87('0x19')]);router[_0x3f87('0xb')](_0x3f87('0x1a'),auth[_0x3f87('0x9')](),controller['getLists']);router[_0x3f87('0xb')](_0x3f87('0x1b'),auth[_0x3f87('0x9')](),controller['getBlackLists']);router[_0x3f87('0x1c')]('/',auth['isAuthenticated'](),controller[_0x3f87('0x1d')]);router[_0x3f87('0x1c')](_0x3f87('0x1e'),auth[_0x3f87('0x9')](),controller[_0x3f87('0x1f')]);router['post'](_0x3f87('0x15'),auth[_0x3f87('0x9')](),controller[_0x3f87('0x20')]);router[_0x3f87('0x1c')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x3f87('0x1c')](_0x3f87('0x1a'),auth[_0x3f87('0x9')](),controller['addLists']);router[_0x3f87('0x1c')](_0x3f87('0x1b'),auth[_0x3f87('0x9')](),controller[_0x3f87('0x21')]);router[_0x3f87('0x22')](_0x3f87('0x23'),auth[_0x3f87('0x9')](),controller[_0x3f87('0x24')]);router[_0x3f87('0x25')](_0x3f87('0x23'),auth[_0x3f87('0x9')](),controller[_0x3f87('0x26')]);router['delete'](_0x3f87('0x15'),auth[_0x3f87('0x9')](),controller[_0x3f87('0x27')]);router['delete']('/:id/users',auth[_0x3f87('0x9')](),controller[_0x3f87('0x28')]);router[_0x3f87('0x25')](_0x3f87('0x1a'),auth[_0x3f87('0x9')](),controller[_0x3f87('0x29')]);router[_0x3f87('0x25')](_0x3f87('0x1b'),auth[_0x3f87('0x9')](),controller[_0x3f87('0x2a')]);module[_0x3f87('0x2b')]=router;
\ No newline at end of file
index 8482686..9db161d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd540=['leavewhenempty','join','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','power','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','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\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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','rrmemory','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','booked','progressive','predictive','INTEGER','yes','all','TEXT','periodic_announce','split','joinempty'];(function(_0x32de06,_0x43472a){var _0x4d04fe=function(_0x2e75c8){while(--_0x2e75c8){_0x32de06['push'](_0x32de06['shift']());}};_0x4d04fe(++_0x43472a);}(_0xd540,0x7d));var _0x0d54=function(_0x1c9fc4,_0x1654cb){_0x1c9fc4=_0x1c9fc4-0x0;var _0x5b9763=_0xd540[_0x1c9fc4];return _0x5b9763;};'use strict';var Sequelize=require(_0x0d54('0x0'));module[_0x0d54('0x1')]={'name':{'type':Sequelize[_0x0d54('0x2')],'allowNull':![],'unique':_0x0d54('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x0d54('0x4')](_0x0d54('0x5'),_0x0d54('0x6')),'allowNull':![],'defaultValue':_0x0d54('0x5')},'musiconhold':{'type':Sequelize[_0x0d54('0x2')],'defaultValue':_0x0d54('0x7')},'announce':{'type':Sequelize[_0x0d54('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0d54('0x4')]('rr',_0x0d54('0x8'),_0x0d54('0x9'),_0x0d54('0xa'),'random',_0x0d54('0xb'),'linear',_0x0d54('0xc'),_0x0d54('0xd')),'allowNull':![],'defaultValue':'ringall','set':function(_0x821c30){this[_0x0d54('0xe')](_0x0d54('0xf'),_0x821c30?_0x821c30:_0x0d54('0xb'));},'get':function(){var _0x5f25b3=this[_0x0d54('0x10')](_0x0d54('0x11'));var _0x27fbbf=this['getDataValue'](_0x0d54('0x12'));var _0x28d02e=this[_0x0d54('0x10')](_0x0d54('0xf'));if(_0x5f25b3===_0x0d54('0x5')){return _0x28d02e;}if(_0x27fbbf===_0x0d54('0x13')&&_0x28d02e==='rrmemory'||_0x27fbbf==='booked'&&_0x28d02e==='roundrobin'){return _0x28d02e;}if(_0x27fbbf===_0x0d54('0x14')||_0x27fbbf===_0x0d54('0x15')||_0x27fbbf==='power'){return _0x28d02e;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0d54('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x0d54('0x16')](0xb)},'timeout':{'type':Sequelize[_0x0d54('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x0d54('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0d54('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0d54('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0d54('0x4')](_0x0d54('0x17'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x0d54('0x4')](_0x0d54('0x17'),'no',_0x0d54('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x0d54('0x4')](_0x0d54('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0d54('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0d54('0x4')](_0x0d54('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0d54('0x4')](_0x0d54('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x0d54('0x4')](_0x0d54('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0d54('0x4')](_0x0d54('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x0d54('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x0d54('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0d54('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0d54('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0d54('0x4')](_0x0d54('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x0d54('0x4')](_0x0d54('0x17'),'no'),'defaultValue':_0x0d54('0x17')},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0d54('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x0d54('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x0d54('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0d54('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0d54('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0d54('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0d54('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x0d54('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0d54('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x0d54('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0d54('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x0d54('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0d54('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0d54('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0d54('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0d54('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0d54('0x2')]},'queue_less_than':{'type':Sequelize[_0x0d54('0x2')]},'periodic_announce':{'type':Sequelize[_0x0d54('0x19')],'set':function(_0x98f97d){this[_0x0d54('0xe')]('periodic_announce',_0x98f97d?_0x98f97d['join'](','):[]);},'get':function(){return this['getDataValue']('periodic_announce')?this[_0x0d54('0x10')](_0x0d54('0x1a'))[_0x0d54('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0x0d54('0x2')],'defaultValue':_0x0d54('0x17'),'set':function(_0x3dbf5b){this[_0x0d54('0xe')]('joinempty',_0x3dbf5b?_0x3dbf5b['join'](','):[]);},'get':function(){return this[_0x0d54('0x10')](_0x0d54('0x1c'))?this['getDataValue'](_0x0d54('0x1c'))[_0x0d54('0x1b')](','):[];}},'leavewhenempty':{'type':Sequelize[_0x0d54('0x2')],'defaultValue':'no','set':function(_0x36c28f){this[_0x0d54('0xe')](_0x0d54('0x1d'),_0x36c28f?_0x36c28f[_0x0d54('0x1e')](','):[]);},'get':function(){return this['getDataValue'](_0x0d54('0x1d'))?this[_0x0d54('0x10')](_0x0d54('0x1d'))[_0x0d54('0x1b')](','):[];}},'reportholdtime':{'type':Sequelize[_0x0d54('0x4')](_0x0d54('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x0d54('0x4')](_0x0d54('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x0d54('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0d54('0x4')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0d54('0x2')]},'acw':{'type':Sequelize[_0x0d54('0x1f')],'defaultValue':0x0,'set':function(_0x41fe04){this[_0x0d54('0xe')](_0x0d54('0x20'),_0x41fe04);if(_0x41fe04){if(this[_0x0d54('0x10')](_0x0d54('0x21'))<0x2){this[_0x0d54('0xe')](_0x0d54('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0d54('0x1f')],'defaultValue':0x0,'comment':_0x0d54('0x22')},'dialMethod':{'type':Sequelize[_0x0d54('0x4')](_0x0d54('0x23'),_0x0d54('0x14'),_0x0d54('0x24'),_0x0d54('0x15'),'booked'),'defaultValue':_0x0d54('0x14'),'comment':_0x0d54('0x25')},'dialLimitChannel':{'type':Sequelize[_0x0d54('0x16')](0x4)[_0x0d54('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0d54('0x27')},'dialLimitQueue':{'type':Sequelize[_0x0d54('0x16')](0x4)[_0x0d54('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0d54('0x28')},'dialPowerLevel':{'type':Sequelize[_0x0d54('0x29')](0x2)[_0x0d54('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0d54('0x2a')},'dialPredictiveOptimization':{'type':Sequelize[_0x0d54('0x4')](_0x0d54('0x2b'),_0x0d54('0x2c')),'defaultValue':'dropRate','comment':_0x0d54('0x2d')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0d54('0x29')](0x2)[_0x0d54('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0d54('0x2e')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x0d54('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x0d54('0x2f')},'dialOriginateCallerIdName':{'type':Sequelize[_0x0d54('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0d54('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0d54('0x16')](0x3)[_0x0d54('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d54('0x30')},'dialQueueOptions':{'type':Sequelize[_0x0d54('0x2')],'defaultValue':_0x0d54('0x31'),'comment':_0x0d54('0x32')},'dialQueueTimeout':{'type':Sequelize[_0x0d54('0x16')](0x3)[_0x0d54('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d54('0x33')},'dialQueueProject':{'type':Sequelize[_0x0d54('0x2')],'comment':_0x0d54('0x34')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0d54('0x16')](0x3)[_0x0d54('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x0d54('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0d54('0x35')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d54('0x36')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0d54('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0d54('0x37')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0d54('0x26')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0d54('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0d54('0x38')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0d54('0x16')](0x3)[_0x0d54('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0d54('0x39')},'dialTimezone':{'type':Sequelize[_0x0d54('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0d54('0x2')],'defaultValue':_0x0d54('0x3a')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x0d54('0x4')](_0x0d54('0x3b'),_0x0d54('0x3c'),_0x0d54('0x3d')),'defaultValue':_0x0d54('0x3b')},'dialAMDActive':{'type':Sequelize[_0x0d54('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0d54('0x16')](0x9)[_0x0d54('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0d54('0x3e')},'dialAMDGreeting':{'type':Sequelize[_0x0d54('0x16')](0x9)[_0x0d54('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0d54('0x3f')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0d54('0x16')](0x9)[_0x0d54('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0d54('0x16')](0x9)[_0x0d54('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0d54('0x40')},'dialAMDMinWordLength':{'type':Sequelize[_0x0d54('0x16')](0x9)[_0x0d54('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0d54('0x41')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0d54('0x16')](0x9)[_0x0d54('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0d54('0x42')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x0d54('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0d54('0x43')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0d54('0x16')](0x9)[_0x0d54('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0d54('0x44')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0d54('0x45')},'dialRecallInQueue':{'type':Sequelize[_0x0d54('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x0d54('0x4')](_0x0d54('0x46'),_0x0d54('0x47')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x0d54('0x2')],'comment':_0x0d54('0x34')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0d54('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0d54('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0d54('0x16')](0x3)[_0x0d54('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0d54('0x48')},'dialCutDigit':{'type':Sequelize[_0x0d54('0x16')](0x3)[_0x0d54('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0d54('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0d54('0x16')],'allowNull':!![],'comment':_0x0d54('0x4a')},'mandatoryDisposition':{'type':Sequelize[_0x0d54('0x1f')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x361643){if(!_0x361643)this[_0x0d54('0xe')](_0x0d54('0x4b'),null);this[_0x0d54('0xe')](_0x0d54('0x4c'),_0x361643);}}};
\ No newline at end of file
+var _0xed70=['periodic_announce','setDataValue','joinempty','split','leavewhenempty','join','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','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','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\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','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,<project_name>)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','STRING','name','ENUM','inbound','default','leastrecent','fewestcalls','rrmemory','strategy','getDataValue','booked','roundrobin','progressive','power','INTEGER','yes','all','once','TEXT'];(function(_0x139b7b,_0xcc3dab){var _0x1074ef=function(_0x16cc6c){while(--_0x16cc6c){_0x139b7b['push'](_0x139b7b['shift']());}};_0x1074ef(++_0xcc3dab);}(_0xed70,0x75));var _0x0ed7=function(_0x482bb7,_0x15053f){_0x482bb7=_0x482bb7-0x0;var _0x307ce0=_0xed70[_0x482bb7];return _0x307ce0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0ed7('0x0')],'allowNull':![],'unique':_0x0ed7('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x0ed7('0x2')](_0x0ed7('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0ed7('0x3')},'musiconhold':{'type':Sequelize[_0x0ed7('0x0')],'defaultValue':_0x0ed7('0x4')},'announce':{'type':Sequelize[_0x0ed7('0x0')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0ed7('0x2')]('rr','ringall',_0x0ed7('0x5'),_0x0ed7('0x6'),'random',_0x0ed7('0x7'),'linear','wrandom','rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x474231){this['setDataValue'](_0x0ed7('0x8'),_0x474231?_0x474231:'rrmemory');},'get':function(){var _0x221b31=this['getDataValue']('type');var _0x5ccdb3=this[_0x0ed7('0x9')]('dialMethod');var _0x3b52c5=this[_0x0ed7('0x9')](_0x0ed7('0x8'));if(_0x221b31===_0x0ed7('0x3')){return _0x3b52c5;}if(_0x5ccdb3===_0x0ed7('0xa')&&_0x3b52c5===_0x0ed7('0x7')||_0x5ccdb3===_0x0ed7('0xa')&&_0x3b52c5===_0x0ed7('0xb')){return _0x3b52c5;}if(_0x5ccdb3===_0x0ed7('0xc')||_0x5ccdb3==='predictive'||_0x5ccdb3===_0x0ed7('0xd')){return _0x3b52c5;}return null;}},'servicelevel':{'type':Sequelize[_0x0ed7('0xe')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0ed7('0x0')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x0ed7('0xe')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0ed7('0x0')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0ed7('0xe')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x0ed7('0xf'),'no'),'defaultValue':_0x0ed7('0xf')},'autopause':{'type':Sequelize[_0x0ed7('0x2')]('yes','no',_0x0ed7('0x10')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0ed7('0xe')](0xb)},'autopausebusy':{'type':Sequelize[_0x0ed7('0x2')](_0x0ed7('0xf'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x0ed7('0xf'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0ed7('0xe')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0ed7('0x2')](_0x0ed7('0xf'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0ed7('0x2')](_0x0ed7('0xf'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x0ed7('0x2')](_0x0ed7('0xf'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0ed7('0x2')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0ed7('0x0')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x0ed7('0x0')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x0ed7('0xe')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x0ed7('0xf'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x0ed7('0x2')]('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x0ed7('0x2')]('yes','no',_0x0ed7('0x11')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0ed7('0x0')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0ed7('0x2')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0x0ed7('0xe')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0ed7('0x0')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x0ed7('0x0')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0ed7('0x0')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x0ed7('0x0')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0ed7('0x0')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0ed7('0x0')]},'queue_quantity1':{'type':Sequelize[_0x0ed7('0x0')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x0ed7('0x0')]},'queue_less_than':{'type':Sequelize[_0x0ed7('0x0')]},'periodic_announce':{'type':Sequelize[_0x0ed7('0x12')],'set':function(_0x51b68a){this['setDataValue'](_0x0ed7('0x13'),_0x51b68a?_0x51b68a['join'](','):[]);},'get':function(){return this[_0x0ed7('0x9')](_0x0ed7('0x13'))?this['getDataValue']('periodic_announce')['split'](','):[];}},'joinempty':{'type':Sequelize[_0x0ed7('0x0')],'defaultValue':_0x0ed7('0xf'),'set':function(_0x2698d4){this[_0x0ed7('0x14')](_0x0ed7('0x15'),_0x2698d4?_0x2698d4['join'](','):[]);},'get':function(){return this[_0x0ed7('0x9')](_0x0ed7('0x15'))?this[_0x0ed7('0x9')](_0x0ed7('0x15'))[_0x0ed7('0x16')](','):[];}},'leavewhenempty':{'type':Sequelize[_0x0ed7('0x0')],'defaultValue':'no','set':function(_0x52c264){this[_0x0ed7('0x14')](_0x0ed7('0x17'),_0x52c264?_0x52c264[_0x0ed7('0x18')](','):[]);},'get':function(){return this['getDataValue'](_0x0ed7('0x17'))?this['getDataValue'](_0x0ed7('0x17'))[_0x0ed7('0x16')](','):[];}},'reportholdtime':{'type':Sequelize[_0x0ed7('0x2')](_0x0ed7('0xf'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x0ed7('0x2')](_0x0ed7('0xf'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x0ed7('0xf'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0ed7('0x0')]},'description':{'type':Sequelize[_0x0ed7('0x0')]},'acw':{'type':Sequelize[_0x0ed7('0x19')],'defaultValue':0x0,'set':function(_0x2dd3ea){this[_0x0ed7('0x14')](_0x0ed7('0x1a'),_0x2dd3ea);if(_0x2dd3ea){if(this[_0x0ed7('0x9')]('wrapuptime')<0x2){this[_0x0ed7('0x14')](_0x0ed7('0x1b'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0ed7('0x19')],'defaultValue':0x0,'comment':_0x0ed7('0x1c')},'dialMethod':{'type':Sequelize['ENUM'](_0x0ed7('0x1d'),_0x0ed7('0xc'),'power','predictive',_0x0ed7('0xa')),'defaultValue':_0x0ed7('0xc'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x0ed7('0xe')](0x4)[_0x0ed7('0x1e')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0ed7('0x1f')},'dialLimitQueue':{'type':Sequelize[_0x0ed7('0xe')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0ed7('0x20')},'dialPowerLevel':{'type':Sequelize[_0x0ed7('0x21')](0x2)[_0x0ed7('0x1e')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0ed7('0x22')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x0ed7('0x23'),_0x0ed7('0x24')),'defaultValue':_0x0ed7('0x24'),'comment':_0x0ed7('0x25')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x0ed7('0x1e')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0ed7('0x26')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x0ed7('0x1e')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x0ed7('0x27')},'dialOriginateCallerIdName':{'type':Sequelize[_0x0ed7('0x0')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0ed7('0x0')]},'dialOriginateTimeout':{'type':Sequelize[_0x0ed7('0xe')](0x3)[_0x0ed7('0x1e')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ed7('0x28')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x0ed7('0x29'),'comment':_0x0ed7('0x2a')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x0ed7('0x1e')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x0ed7('0x0')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,<project_name>)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x0ed7('0xe')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x0ed7('0xe')](0x5)[_0x0ed7('0x1e')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ed7('0x2b')},'dialBusyMaxRetry':{'type':Sequelize[_0x0ed7('0xe')](0x3)[_0x0ed7('0x1e')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ed7('0x2c')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0ed7('0xe')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0ed7('0xe')](0x3)[_0x0ed7('0x1e')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0ed7('0xe')](0x5)[_0x0ed7('0x1e')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ed7('0x2d')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0ed7('0xe')](0x3)[_0x0ed7('0x1e')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0ed7('0x2e')},'dialTimezone':{'type':Sequelize[_0x0ed7('0x0')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0ed7('0x0')],'defaultValue':_0x0ed7('0x2f')},'dialPrefix':{'type':Sequelize[_0x0ed7('0x0')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x0ed7('0x2')](_0x0ed7('0x30'),_0x0ed7('0x31'),_0x0ed7('0x32')),'defaultValue':_0x0ed7('0x30')},'dialAMDActive':{'type':Sequelize[_0x0ed7('0x19')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0ed7('0xe')](0x9)[_0x0ed7('0x1e')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x0ed7('0xe')](0x9)[_0x0ed7('0x1e')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0ed7('0x33')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0ed7('0xe')](0x9)[_0x0ed7('0x1e')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0ed7('0x34')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0ed7('0xe')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x0ed7('0x1e')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0ed7('0x35')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0ed7('0xe')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0ed7('0x36')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0ed7('0xe')](0x9)[_0x0ed7('0x1e')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0ed7('0x37')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0ed7('0xe')](0x5)[_0x0ed7('0x1e')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0ed7('0x38')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0ed7('0xe')](0x9)[_0x0ed7('0x1e')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x0ed7('0xe')](0x5)[_0x0ed7('0x1e')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0ed7('0x39')},'dialRecallInQueue':{'type':Sequelize[_0x0ed7('0x19')],'defaultValue':0x0,'comment':_0x0ed7('0x3a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x0ed7('0x2')](_0x0ed7('0x3b'),_0x0ed7('0x3c')),'defaultValue':_0x0ed7('0x3b')},'dialQueueProject2':{'type':Sequelize[_0x0ed7('0x0')],'comment':_0x0ed7('0x3d')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0ed7('0x19')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0ed7('0x19')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0ed7('0xe')](0x3)[_0x0ed7('0x1e')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0ed7('0x3e')},'dialCutDigit':{'type':Sequelize[_0x0ed7('0xe')](0x3)[_0x0ed7('0x1e')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0ed7('0x3f')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0ed7('0xe')],'allowNull':!![],'comment':_0x0ed7('0x40')},'mandatoryDisposition':{'type':Sequelize[_0x0ed7('0x19')],'defaultValue':![],'comment':_0x0ed7('0x41'),'set':function(_0x4faa1a){if(!_0x4faa1a)this[_0x0ed7('0x14')](_0x0ed7('0x42'),null);this[_0x0ed7('0x14')](_0x0ed7('0x43'),_0x4faa1a);}}};
\ No newline at end of file
index a9afd4f..abe847a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8817=['path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','VoiceQueues','QueueCampaigns','filter','map','value','find','type','name','UserProfileResource','error','stack','send','index','rawAttributes','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','filters','pick','merge','key','VIRTUAL','field','VoiceQueue','count','rows','catch','params','length','include','create','user','get','role','inbound','outbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','findOne','CmHopper','VoiceQueueId','options','findAll','getHopperHistories','order','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','User','Agents','union','addAgents','penalty','ids','removeTeams','removeAgents','spread','emit','userVoiceQueue:save','loginInPause','voicePause','interface','push','UserVoiceQueueRt','upsert','isNil','format','all','isArray','userVoiceQueue:remove','realtime','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','cm_hopper','fromQuery','scheduledAt','ListId','createdAt','phone','NOW()','ContactId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','CmListId','phone\x20IS\x20NOT\x20NULL','select','calleridnum','phone\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','into','ListId\x20=\x20?','sequelize','removeLists','getBlackLists','addBlackLists','removeBlackLists','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x4953da,_0x5adaca){var _0x2d3780=function(_0x458f36){while(--_0x458f36){_0x4953da['push'](_0x4953da['shift']());}};_0x2d3780(++_0x5adaca);}(_0x8817,0x1ee));var _0x7881=function(_0x5256bf,_0x4a0864){_0x5256bf=_0x5256bf-0x0;var _0x66410a=_0x8817[_0x5256bf];return _0x66410a;};'use strict';var pdf=require(_0x7881('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7881('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7881('0x2'));var rp=require(_0x7881('0x3'));var moment=require('moment');var BPromise=require(_0x7881('0x4'));var Mustache=require(_0x7881('0x5'));var util=require(_0x7881('0x6'));var path=require(_0x7881('0x7'));var sox=require(_0x7881('0x8'));var csv=require(_0x7881('0x9'));var ejs=require(_0x7881('0xa'));var fs=require('fs');var _=require(_0x7881('0xb'));var squel=require(_0x7881('0xc'));var crypto=require(_0x7881('0xd'));var jsforce=require(_0x7881('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7881('0x9'));var querystring=require(_0x7881('0xf'));var Papa=require(_0x7881('0x10'));var authService=require(_0x7881('0x11'));var hardwareService=require(_0x7881('0x12'));var Redis=require(_0x7881('0x13'));var qs=require(_0x7881('0x14'));var logger=require(_0x7881('0x15'))(_0x7881('0x16'));var utils=require('../../config/utils');var config=require(_0x7881('0x17'));var db=require(_0x7881('0x18'))['db'];config[_0x7881('0x19')]=_[_0x7881('0x1a')](config[_0x7881('0x19')],{'host':_0x7881('0x1b'),'port':0x18eb});var socket=require(_0x7881('0x1c'))(new Redis(config[_0x7881('0x19')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x259d17,_0xfe5668){_0xfe5668=_0xfe5668||0xcc;return function(_0x15a1c4){if(_0x15a1c4){return _0x259d17[_0x7881('0x1d')](_0xfe5668);}return _0x259d17[_0x7881('0x1e')](_0xfe5668)[_0x7881('0x1f')]();};}function respondWithResult(_0x177ccc,_0x1177dc){_0x1177dc=_0x1177dc||0xc8;return function(_0x46d860){if(_0x46d860){return _0x177ccc[_0x7881('0x1e')](_0x1177dc)[_0x7881('0x20')](_0x46d860);}};}function respondWithFilteredResult(_0x680e87,_0x129b8b){return function(_0x36644d){if(_0x36644d){var _0x29ca1b=_0x36644d['count'],_0x16073c=_0x129b8b[_0x7881('0x21')],_0xa276c3=_0x129b8b[_0x7881('0x21')]+_0x129b8b['limit'],_0x44f378;if(_0xa276c3>=_0x29ca1b){_0xa276c3=_0x29ca1b;_0x44f378=0xc8;}else{_0x44f378=0xce;}_0x680e87[_0x7881('0x1e')](_0x44f378);return _0x680e87[_0x7881('0x22')](_0x7881('0x23'),_0x16073c+'-'+_0xa276c3+'/'+_0x29ca1b)['json'](_0x36644d);}return null;};}function patchUpdates(_0x1c25bc){return function(_0x21acf4){try{jsonpatch[_0x7881('0x24')](_0x21acf4,_0x1c25bc,!![]);}catch(_0x42dd1){return BPromise[_0x7881('0x25')](_0x42dd1);}return _0x21acf4[_0x7881('0x26')]();};}function saveUpdates(_0x35fd30,_0x3ef50b){return function(_0xf2594f){if(_0xf2594f){return _0xf2594f[_0x7881('0x27')](_0x35fd30)[_0x7881('0x28')](function(_0x2173e3){return _0x2173e3;});}return null;};}function removeEntity(_0x4765af,_0x1a8d21){return function(_0x47a452){if(_0x47a452){return _0x47a452[_0x7881('0x29')]()['then'](function(){var _0x5e58e2=_0x47a452['get']({'plain':!![]});var _0x1a65b3=[{'name':_0x7881('0x2a'),'value':'inbound','ignore':![]},{'name':_0x7881('0x2b'),'value':'outbound','ignore':![]}];var _0x37289c=_(_0x1a65b3)[_0x7881('0x2c')]('ignore')[_0x7881('0x2d')](_0x7881('0x2e'))[_0x7881('0x2e')]();if(_['includes'](_0x37289c,_0x5e58e2['type'])){return;}var _0x51d59b=_[_0x7881('0x2f')](_0x1a65b3,[_0x7881('0x2e'),_0x5e58e2[_0x7881('0x30')]])[_0x7881('0x31')];return db[_0x7881('0x32')][_0x7881('0x29')]({'where':{'type':_0x51d59b,'resourceId':_0x5e58e2['id']}})[_0x7881('0x28')](function(){return _0x47a452;});})[_0x7881('0x28')](function(){_0x4765af['status'](0xcc)[_0x7881('0x1f')]();});}};}function handleEntityNotFound(_0x29a9e6,_0x732ced){return function(_0x4c2149){if(!_0x4c2149){_0x29a9e6['sendStatus'](0x194);}return _0x4c2149;};}function handleError(_0xb4c2dd,_0x2e74ce){_0x2e74ce=_0x2e74ce||0x1f4;return function(_0x110066){logger[_0x7881('0x33')](_0x110066[_0x7881('0x34')]);if(_0x110066[_0x7881('0x31')]){delete _0x110066[_0x7881('0x31')];}_0xb4c2dd[_0x7881('0x1e')](_0x2e74ce)[_0x7881('0x35')](_0x110066);};}exports[_0x7881('0x36')]=function(_0x5c7294,_0x253fa0){var _0x5f0139={},_0x2a87c1={},_0x2a1b59={'count':0x0,'rows':[]};var _0x3fa19a=db['VoiceQueue'][_0x7881('0x37')];_0x2a87c1[_0x7881('0x38')]=_[_0x7881('0x39')](_0x3fa19a);_0x2a87c1[_0x7881('0x3a')]=_[_0x7881('0x39')](_0x5c7294['query']);_0x2a87c1['filters']=_['intersection'](_0x2a87c1['model'],_0x2a87c1['query']);_0x5f0139['attributes']=_[_0x7881('0x3b')](_0x2a87c1[_0x7881('0x38')],qs['fields'](_0x5c7294[_0x7881('0x3a')][_0x7881('0x3c')]));_0x5f0139[_0x7881('0x3d')]=_0x5f0139['attributes']['length']?_0x5f0139['attributes']:_0x2a87c1[_0x7881('0x38')];if(!_0x5c7294[_0x7881('0x3a')][_0x7881('0x3e')](_0x7881('0x3f'))){_0x5f0139['limit']=qs[_0x7881('0x40')](_0x5c7294[_0x7881('0x3a')][_0x7881('0x40')]);_0x5f0139[_0x7881('0x21')]=qs['offset'](_0x5c7294['query'][_0x7881('0x21')]);}_0x5f0139['order']=qs[_0x7881('0x41')](_0x5c7294[_0x7881('0x3a')]['sort']);_0x5f0139[_0x7881('0x42')]=qs[_0x7881('0x43')](_[_0x7881('0x44')](_0x5c7294[_0x7881('0x3a')],_0x2a87c1['filters']));if(_0x5c7294[_0x7881('0x3a')]['filter']){_0x5f0139[_0x7881('0x42')]=_[_0x7881('0x45')](_0x5f0139[_0x7881('0x42')],{'$or':_['map'](_0x3fa19a,function(_0x3897b2){if(_0x3897b2['type'][_0x7881('0x46')]!==_0x7881('0x47')){var _0x43e190={};_0x43e190[_0x3897b2[_0x7881('0x48')]]={'$like':'%'+_0x5c7294['query'][_0x7881('0x2c')]+'%'};return _0x43e190;}})});}_0x5f0139=_['merge']({},_0x5f0139,_0x5c7294['options']);var _0x4f8f63={'where':_0x5f0139[_0x7881('0x42')]};return db[_0x7881('0x49')][_0x7881('0x4a')](_0x4f8f63)[_0x7881('0x28')](function(_0x344261){_0x2a1b59[_0x7881('0x4a')]=_0x344261;if(_0x5c7294[_0x7881('0x3a')]['includeAll']){_0x5f0139['include']=[{'all':!![]}];}return db[_0x7881('0x49')]['findAll'](_0x5f0139);})[_0x7881('0x28')](function(_0x519169){_0x2a1b59[_0x7881('0x4b')]=_0x519169;return _0x2a1b59;})['then'](respondWithFilteredResult(_0x253fa0,_0x5f0139))[_0x7881('0x4c')](handleError(_0x253fa0,null));};exports['show']=function(_0x3b1cfe,_0x4ce5e9){var _0x27a5d3={'raw':![],'where':{'id':_0x3b1cfe[_0x7881('0x4d')]['id']}},_0x553056={};_0x553056[_0x7881('0x38')]=_[_0x7881('0x39')](db[_0x7881('0x49')][_0x7881('0x37')]);_0x553056[_0x7881('0x3a')]=_['keys'](_0x3b1cfe['query']);_0x553056[_0x7881('0x43')]=_[_0x7881('0x3b')](_0x553056['model'],_0x553056['query']);_0x27a5d3[_0x7881('0x3d')]=_[_0x7881('0x3b')](_0x553056[_0x7881('0x38')],qs[_0x7881('0x3c')](_0x3b1cfe[_0x7881('0x3a')][_0x7881('0x3c')]));_0x27a5d3['attributes']=_0x27a5d3[_0x7881('0x3d')][_0x7881('0x4e')]?_0x27a5d3['attributes']:_0x553056[_0x7881('0x38')];if(_0x3b1cfe[_0x7881('0x3a')]['includeAll']){_0x27a5d3[_0x7881('0x4f')]=[{'all':!![]}];}_0x27a5d3=_[_0x7881('0x45')]({},_0x27a5d3,_0x3b1cfe['options']);return db[_0x7881('0x49')][_0x7881('0x2f')](_0x27a5d3)[_0x7881('0x28')](handleEntityNotFound(_0x4ce5e9,null))[_0x7881('0x28')](respondWithResult(_0x4ce5e9,null))[_0x7881('0x4c')](handleError(_0x4ce5e9,null));};exports[_0x7881('0x50')]=function(_0x4e6f82,_0x5ebd12){return db[_0x7881('0x49')][_0x7881('0x50')](_0x4e6f82['body'],{})[_0x7881('0x28')](function(_0x20ffc7){var _0x21c372=_0x4e6f82[_0x7881('0x51')][_0x7881('0x52')]({'plain':!![]});if(!_0x21c372)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21c372[_0x7881('0x53')]===_0x7881('0x51')){var _0x18b3f0=_0x20ffc7['get']({'plain':!![]});var _0x2a13fb=[{'name':_0x7881('0x2a'),'value':_0x7881('0x54')},{'name':_0x7881('0x2b'),'value':_0x7881('0x55')}];var _0x1dee58=_[_0x7881('0x2f')](_0x2a13fb,[_0x7881('0x2e'),_0x18b3f0[_0x7881('0x30')]])[_0x7881('0x31')];return db[_0x7881('0x56')][_0x7881('0x2f')]({'where':{'name':_0x1dee58,'userProfileId':_0x21c372[_0x7881('0x57')]},'raw':!![]})[_0x7881('0x28')](function(_0x199ef4){if(_0x199ef4&&_0x199ef4[_0x7881('0x58')]===0x0){return db[_0x7881('0x32')][_0x7881('0x50')]({'name':_0x18b3f0[_0x7881('0x31')],'resourceId':_0x18b3f0['id'],'type':_0x199ef4['name'],'sectionId':_0x199ef4['id']},{})[_0x7881('0x28')](function(){return _0x20ffc7;});}else{return _0x20ffc7;}})[_0x7881('0x4c')](function(_0x355268){logger[_0x7881('0x33')](_0x7881('0x59'),_0x355268);throw _0x355268;});}return _0x20ffc7;})[_0x7881('0x28')](respondWithResult(_0x5ebd12,0xc9))['catch'](handleError(_0x5ebd12,null));};exports[_0x7881('0x5a')]=function(_0x247edd,_0x574b61){var _0x26dc94={'raw':![],'where':{'id':_0x247edd[_0x7881('0x4d')]['id']}},_0x519cc3={};_0x519cc3['model']=_[_0x7881('0x39')](db[_0x7881('0x49')][_0x7881('0x37')]);_0x26dc94[_0x7881('0x3d')]=_[_0x7881('0x3b')](_0x519cc3[_0x7881('0x38')],qs[_0x7881('0x3c')](_0x247edd[_0x7881('0x3a')][_0x7881('0x3c')]));_0x26dc94['attributes']=_0x26dc94[_0x7881('0x3d')][_0x7881('0x4e')]?_0x26dc94[_0x7881('0x3d')]:_0x519cc3[_0x7881('0x38')];if(_0x247edd[_0x7881('0x3a')][_0x7881('0x5b')]){_0x26dc94[_0x7881('0x4f')]=[{'all':!![]}];}_0x26dc94=_[_0x7881('0x45')]({},_0x26dc94,_0x247edd['options']);return db[_0x7881('0x49')][_0x7881('0x2f')](_0x26dc94)[_0x7881('0x28')](handleEntityNotFound(_0x574b61,null))[_0x7881('0x28')](function(_0x579a1c){if(_0x579a1c){var _0x1b1017=_0x579a1c['get']({'plain':!![]});_0x1b1017=qs[_0x7881('0x5c')](_0x1b1017,['id','createdAt',_0x7881('0x5d')]);_0x247edd['body']=_[_0x7881('0x5c')](_0x247edd[_0x7881('0x5e')],['id','createdAt','updatedAt']);return db['VoiceQueue'][_0x7881('0x50')](_[_0x7881('0x45')](_0x1b1017,_0x247edd[_0x7881('0x5e')]),{'include':_0x247edd[_0x7881('0x3a')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x4a7565){var _0x105484=_0x247edd[_0x7881('0x51')][_0x7881('0x52')]({'plain':!![]});if(!_0x105484)throw new Error(_0x7881('0x5f'));if(_0x105484[_0x7881('0x53')]==='user'){var _0x3d8db0=_0x4a7565[_0x7881('0x52')]({'plain':!![]});var _0x52db05=[{'name':_0x7881('0x2a'),'value':_0x7881('0x54')},{'name':_0x7881('0x2b'),'value':_0x7881('0x55')}];var _0x5e9024=_[_0x7881('0x2f')](_0x52db05,[_0x7881('0x2e'),_0x3d8db0[_0x7881('0x30')]])[_0x7881('0x31')];return db[_0x7881('0x56')][_0x7881('0x2f')]({'where':{'name':_0x5e9024,'userProfileId':_0x105484[_0x7881('0x57')]},'raw':!![]})[_0x7881('0x28')](function(_0x42badb){if(_0x42badb&&_0x42badb[_0x7881('0x58')]===0x0){return db[_0x7881('0x32')][_0x7881('0x50')]({'name':_0x3d8db0[_0x7881('0x31')],'resourceId':_0x3d8db0['id'],'type':_0x42badb[_0x7881('0x31')],'sectionId':_0x42badb['id']},{})['then'](function(){return _0x4a7565;});}else{return _0x4a7565;}})['catch'](function(_0x1cac3e){logger[_0x7881('0x33')](_0x7881('0x59'),_0x1cac3e);throw _0x1cac3e;});}return _0x4a7565;});}})[_0x7881('0x28')](respondWithResult(_0x574b61,0xc9))[_0x7881('0x4c')](handleError(_0x574b61,null));};exports[_0x7881('0x27')]=function(_0x198dbd,_0x316a3a){if(_0x198dbd[_0x7881('0x5e')]['id']){delete _0x198dbd[_0x7881('0x5e')]['id'];}return db[_0x7881('0x49')][_0x7881('0x2f')]({'where':{'id':_0x198dbd['params']['id']}})[_0x7881('0x28')](handleEntityNotFound(_0x316a3a,null))[_0x7881('0x28')](saveUpdates(_0x198dbd[_0x7881('0x5e')],null))[_0x7881('0x28')](respondWithResult(_0x316a3a,null))['catch'](handleError(_0x316a3a,null));};exports[_0x7881('0x29')]=function(_0x1e99ff,_0x17a0b6){return db[_0x7881('0x49')][_0x7881('0x2f')]({'where':{'id':_0x1e99ff[_0x7881('0x4d')]['id']}})[_0x7881('0x28')](handleEntityNotFound(_0x17a0b6,null))[_0x7881('0x28')](removeEntity(_0x17a0b6,null))[_0x7881('0x4c')](handleError(_0x17a0b6,null));};exports[_0x7881('0x60')]=function(_0x5e7631,_0x2d9535,_0x1f9367){var _0x300a8c={'raw':![],'where':{}};var _0x3b0792={};var _0x4a23cc={'count':0x0,'rows':[]};return db[_0x7881('0x49')][_0x7881('0x61')]({'where':{'id':_0x5e7631[_0x7881('0x4d')]['id']}})[_0x7881('0x28')](handleEntityNotFound(_0x2d9535,null))[_0x7881('0x28')](function(_0x24424e){if(_0x24424e){_0x3b0792[_0x7881('0x38')]=_[_0x7881('0x39')](db[_0x7881('0x62')][_0x7881('0x37')]);_0x3b0792[_0x7881('0x3a')]=_[_0x7881('0x39')](_0x5e7631['query']);_0x3b0792[_0x7881('0x43')]=_['intersection'](_0x3b0792['model'],_0x3b0792[_0x7881('0x3a')]);_0x300a8c[_0x7881('0x3d')]=_['intersection'](_0x3b0792[_0x7881('0x38')],qs['fields'](_0x5e7631[_0x7881('0x3a')][_0x7881('0x3c')]));_0x300a8c['attributes']=_0x300a8c[_0x7881('0x3d')][_0x7881('0x4e')]?_0x300a8c['attributes']:_0x3b0792[_0x7881('0x38')];if(!_0x5e7631[_0x7881('0x3a')][_0x7881('0x3e')](_0x7881('0x3f'))){_0x300a8c[_0x7881('0x40')]=qs[_0x7881('0x40')](_0x5e7631[_0x7881('0x3a')][_0x7881('0x40')]);_0x300a8c[_0x7881('0x21')]=qs[_0x7881('0x21')](_0x5e7631[_0x7881('0x3a')][_0x7881('0x21')]);}_0x300a8c['order']=qs[_0x7881('0x41')](_0x5e7631[_0x7881('0x3a')][_0x7881('0x41')]);_0x300a8c['where']=qs[_0x7881('0x43')](_[_0x7881('0x44')](_0x5e7631[_0x7881('0x3a')],_0x3b0792[_0x7881('0x43')]));_0x300a8c['where'][_0x7881('0x63')]=_0x24424e['id'];if(_0x5e7631[_0x7881('0x3a')][_0x7881('0x2c')]){_0x300a8c[_0x7881('0x42')]=_[_0x7881('0x45')](_0x300a8c[_0x7881('0x42')],{'$or':_['map'](_0x300a8c[_0x7881('0x3d')],function(_0x59324d){var _0x1f0387={};_0x1f0387[_0x59324d]={'$like':'%'+_0x5e7631[_0x7881('0x3a')][_0x7881('0x2c')]+'%'};return _0x1f0387;})});}_0x300a8c=_[_0x7881('0x45')]({},_0x300a8c,_0x5e7631[_0x7881('0x64')]);return db[_0x7881('0x62')][_0x7881('0x4a')]({'where':_0x300a8c[_0x7881('0x42')]})[_0x7881('0x28')](function(_0x46a633){_0x4a23cc['count']=_0x46a633;if(_0x5e7631[_0x7881('0x3a')]['includeAll']){_0x300a8c[_0x7881('0x4f')]=[{'all':!![]}];}return db['CmHopper'][_0x7881('0x65')](_0x300a8c);})[_0x7881('0x28')](function(_0x738776){_0x4a23cc[_0x7881('0x4b')]=_0x738776;return _0x4a23cc;});}})[_0x7881('0x28')](respondWithFilteredResult(_0x2d9535,_0x300a8c))[_0x7881('0x4c')](handleError(_0x2d9535,null));};exports[_0x7881('0x66')]=function(_0x3f95b8,_0x2b6c52,_0xa1a7be){var _0xbb032c={'raw':!![],'where':{}};var _0x40754b={};var _0x1aba82={'count':0x0,'rows':[]};return db[_0x7881('0x49')][_0x7881('0x61')]({'where':{'id':_0x3f95b8[_0x7881('0x4d')]['id']}})[_0x7881('0x28')](handleEntityNotFound(_0x2b6c52,null))['then'](function(_0x335434){if(_0x335434){_0x40754b[_0x7881('0x38')]=_[_0x7881('0x39')](db['CmHopperHistory'][_0x7881('0x37')]);_0x40754b[_0x7881('0x3a')]=_[_0x7881('0x39')](_0x3f95b8[_0x7881('0x3a')]);_0x40754b[_0x7881('0x43')]=_[_0x7881('0x3b')](_0x40754b[_0x7881('0x38')],_0x40754b[_0x7881('0x3a')]);_0xbb032c['attributes']=_[_0x7881('0x3b')](_0x40754b['model'],qs[_0x7881('0x3c')](_0x3f95b8[_0x7881('0x3a')][_0x7881('0x3c')]));_0xbb032c[_0x7881('0x3d')]=_0xbb032c[_0x7881('0x3d')][_0x7881('0x4e')]?_0xbb032c['attributes']:_0x40754b[_0x7881('0x38')];if(!_0x3f95b8[_0x7881('0x3a')][_0x7881('0x3e')](_0x7881('0x3f'))){_0xbb032c[_0x7881('0x40')]=qs['limit'](_0x3f95b8['query'][_0x7881('0x40')]);_0xbb032c['offset']=qs['offset'](_0x3f95b8[_0x7881('0x3a')][_0x7881('0x21')]);}_0xbb032c[_0x7881('0x67')]=qs['sort'](_0x3f95b8[_0x7881('0x3a')][_0x7881('0x41')]);_0xbb032c[_0x7881('0x42')]=qs[_0x7881('0x43')](_[_0x7881('0x44')](_0x3f95b8['query'],_0x40754b['filters']));_0xbb032c[_0x7881('0x42')]['VoiceQueueId']=_0x335434['id'];if(_0x3f95b8[_0x7881('0x3a')][_0x7881('0x2c')]){_0xbb032c[_0x7881('0x42')]=_[_0x7881('0x45')](_0xbb032c['where'],{'$or':_[_0x7881('0x2d')](_0xbb032c[_0x7881('0x3d')],function(_0x11fd9a){var _0x317b20={};_0x317b20[_0x11fd9a]={'$like':'%'+_0x3f95b8[_0x7881('0x3a')]['filter']+'%'};return _0x317b20;})});}_0xbb032c=_[_0x7881('0x45')]({},_0xbb032c,_0x3f95b8[_0x7881('0x64')]);return db[_0x7881('0x68')]['count']({'where':_0xbb032c[_0x7881('0x42')]})[_0x7881('0x28')](function(_0x24b56b){_0x1aba82[_0x7881('0x4a')]=_0x24b56b;if(_0x3f95b8[_0x7881('0x3a')]['includeAll']){_0xbb032c['include']=[{'all':!![]}];}return db[_0x7881('0x68')][_0x7881('0x65')](_0xbb032c);})[_0x7881('0x28')](function(_0x4d426c){_0x1aba82[_0x7881('0x4b')]=_0x4d426c;return _0x1aba82;});}})['then'](respondWithFilteredResult(_0x2b6c52,_0xbb032c))['catch'](handleError(_0x2b6c52,null));};exports[_0x7881('0x69')]=function(_0x5cd78a,_0x12a6c6,_0x568c2a){var _0x14afc5={'raw':!![],'where':{}};var _0x2ed71b={};var _0x564dce={'count':0x0,'rows':[]};return db[_0x7881('0x49')][_0x7881('0x61')]({'where':{'id':_0x5cd78a[_0x7881('0x4d')]['id']}})[_0x7881('0x28')](handleEntityNotFound(_0x12a6c6,null))[_0x7881('0x28')](function(_0x4d85a4){if(_0x4d85a4){_0x2ed71b['model']=_['keys'](db[_0x7881('0x6a')][_0x7881('0x37')]);_0x2ed71b['query']=_['keys'](_0x5cd78a['query']);_0x2ed71b[_0x7881('0x43')]=_[_0x7881('0x3b')](_0x2ed71b[_0x7881('0x38')],_0x2ed71b[_0x7881('0x3a')]);_0x14afc5[_0x7881('0x3d')]=_[_0x7881('0x3b')](_0x2ed71b['model'],qs[_0x7881('0x3c')](_0x5cd78a['query'][_0x7881('0x3c')]));_0x14afc5[_0x7881('0x3d')]=_0x14afc5[_0x7881('0x3d')][_0x7881('0x4e')]?_0x14afc5[_0x7881('0x3d')]:_0x2ed71b[_0x7881('0x38')];if(!_0x5cd78a['query'][_0x7881('0x3e')](_0x7881('0x3f'))){_0x14afc5[_0x7881('0x40')]=qs['limit'](_0x5cd78a[_0x7881('0x3a')][_0x7881('0x40')]);_0x14afc5[_0x7881('0x21')]=qs[_0x7881('0x21')](_0x5cd78a[_0x7881('0x3a')][_0x7881('0x21')]);}_0x14afc5[_0x7881('0x67')]=qs[_0x7881('0x41')](_0x5cd78a[_0x7881('0x3a')][_0x7881('0x41')]);_0x14afc5[_0x7881('0x42')]=qs[_0x7881('0x43')](_[_0x7881('0x44')](_0x5cd78a[_0x7881('0x3a')],_0x2ed71b[_0x7881('0x43')]));_0x14afc5[_0x7881('0x42')]['VoiceQueueId']=_0x4d85a4['id'];if(_0x5cd78a[_0x7881('0x3a')][_0x7881('0x2c')]){_0x14afc5['where']=_[_0x7881('0x45')](_0x14afc5[_0x7881('0x42')],{'$or':_['map'](_0x14afc5[_0x7881('0x3d')],function(_0x25638d){var _0x4ee293={};_0x4ee293[_0x25638d]={'$like':'%'+_0x5cd78a[_0x7881('0x3a')][_0x7881('0x2c')]+'%'};return _0x4ee293;})});}_0x14afc5=_['merge']({},_0x14afc5,_0x5cd78a[_0x7881('0x64')]);return db[_0x7881('0x6a')][_0x7881('0x4a')]({'where':_0x14afc5[_0x7881('0x42')]})[_0x7881('0x28')](function(_0x2c5896){_0x564dce[_0x7881('0x4a')]=_0x2c5896;if(_0x5cd78a[_0x7881('0x3a')][_0x7881('0x5b')]){_0x14afc5[_0x7881('0x4f')]=[{'all':!![]}];}return db[_0x7881('0x6a')][_0x7881('0x65')](_0x14afc5);})[_0x7881('0x28')](function(_0x32baa5){_0x564dce[_0x7881('0x4b')]=_0x32baa5;return _0x564dce;});}})['then'](respondWithFilteredResult(_0x12a6c6,_0x14afc5))[_0x7881('0x4c')](handleError(_0x12a6c6,null));};exports[_0x7881('0x6b')]=function(_0x53b4d5,_0x5efe04,_0x58254f){var _0xdfc050={'raw':!![],'where':{}};var _0x5c0ab5={};var _0x23ecb9={'count':0x0,'rows':[]};return db[_0x7881('0x49')][_0x7881('0x61')]({'where':{'id':_0x53b4d5[_0x7881('0x4d')]['id']}})[_0x7881('0x28')](handleEntityNotFound(_0x5efe04,null))['then'](function(_0x3243ad){if(_0x3243ad){_0x5c0ab5[_0x7881('0x38')]=_['keys'](db['CmHopperBlack']['rawAttributes']);_0x5c0ab5['query']=_['keys'](_0x53b4d5['query']);_0x5c0ab5[_0x7881('0x43')]=_['intersection'](_0x5c0ab5['model'],_0x5c0ab5[_0x7881('0x3a')]);_0xdfc050[_0x7881('0x3d')]=_['intersection'](_0x5c0ab5[_0x7881('0x38')],qs[_0x7881('0x3c')](_0x53b4d5[_0x7881('0x3a')][_0x7881('0x3c')]));_0xdfc050[_0x7881('0x3d')]=_0xdfc050[_0x7881('0x3d')]['length']?_0xdfc050[_0x7881('0x3d')]:_0x5c0ab5[_0x7881('0x38')];if(!_0x53b4d5[_0x7881('0x3a')][_0x7881('0x3e')](_0x7881('0x3f'))){_0xdfc050['limit']=qs['limit'](_0x53b4d5[_0x7881('0x3a')]['limit']);_0xdfc050[_0x7881('0x21')]=qs[_0x7881('0x21')](_0x53b4d5['query'][_0x7881('0x21')]);}_0xdfc050['order']=qs['sort'](_0x53b4d5[_0x7881('0x3a')][_0x7881('0x41')]);_0xdfc050[_0x7881('0x42')]=qs[_0x7881('0x43')](_[_0x7881('0x44')](_0x53b4d5[_0x7881('0x3a')],_0x5c0ab5['filters']));_0xdfc050[_0x7881('0x42')][_0x7881('0x63')]=_0x3243ad['id'];if(_0x53b4d5['query']['filter']){_0xdfc050['where']=_[_0x7881('0x45')](_0xdfc050[_0x7881('0x42')],{'$or':_[_0x7881('0x2d')](_0xdfc050[_0x7881('0x3d')],function(_0x48026e){var _0x13e950={};_0x13e950[_0x48026e]={'$like':'%'+_0x53b4d5['query'][_0x7881('0x2c')]+'%'};return _0x13e950;})});}_0xdfc050=_['merge']({},_0xdfc050,_0x53b4d5[_0x7881('0x64')]);return db[_0x7881('0x6c')][_0x7881('0x4a')]({'where':_0xdfc050[_0x7881('0x42')]})[_0x7881('0x28')](function(_0x220836){_0x23ecb9['count']=_0x220836;if(_0x53b4d5[_0x7881('0x3a')]['includeAll']){_0xdfc050[_0x7881('0x4f')]=[{'all':!![]}];}return db[_0x7881('0x6c')][_0x7881('0x65')](_0xdfc050);})[_0x7881('0x28')](function(_0x47fe0c){_0x23ecb9[_0x7881('0x4b')]=_0x47fe0c;return _0x23ecb9;});}})[_0x7881('0x28')](respondWithFilteredResult(_0x5efe04,_0xdfc050))['catch'](handleError(_0x5efe04,null));};exports['getTeams']=function(_0x1c7074,_0x144a87,_0x241a99){var _0x1fbfb5={};var _0x3eceb8={};var _0x34ca23;var _0xb7ba71;return db[_0x7881('0x49')][_0x7881('0x61')]({'where':{'id':_0x1c7074[_0x7881('0x4d')]['id']}})[_0x7881('0x28')](handleEntityNotFound(_0x144a87,null))[_0x7881('0x28')](function(_0x52ebee){if(_0x52ebee){_0x34ca23=_0x52ebee;_0x3eceb8[_0x7881('0x38')]=_['keys'](db[_0x7881('0x6d')][_0x7881('0x37')]);_0x3eceb8[_0x7881('0x3a')]=_[_0x7881('0x39')](_0x1c7074[_0x7881('0x3a')]);_0x3eceb8[_0x7881('0x43')]=_[_0x7881('0x3b')](_0x3eceb8['model'],_0x3eceb8[_0x7881('0x3a')]);_0x1fbfb5['attributes']=_[_0x7881('0x3b')](_0x3eceb8[_0x7881('0x38')],qs[_0x7881('0x3c')](_0x1c7074[_0x7881('0x3a')]['fields']));_0x1fbfb5[_0x7881('0x3d')]=_0x1fbfb5[_0x7881('0x3d')]['length']?_0x1fbfb5['attributes']:_0x3eceb8[_0x7881('0x38')];_0x1fbfb5[_0x7881('0x67')]=qs[_0x7881('0x41')](_0x1c7074['query']['sort']);_0x1fbfb5[_0x7881('0x42')]=qs[_0x7881('0x43')](_[_0x7881('0x44')](_0x1c7074[_0x7881('0x3a')],_0x3eceb8[_0x7881('0x43')]));if(_0x1c7074[_0x7881('0x3a')][_0x7881('0x2c')]){_0x1fbfb5[_0x7881('0x42')]=_[_0x7881('0x45')](_0x1fbfb5['where'],{'$or':_[_0x7881('0x2d')](_0x1fbfb5['attributes'],function(_0x3ec4bd){var _0x314e6f={};_0x314e6f[_0x3ec4bd]={'$like':'%'+_0x1c7074['query']['filter']+'%'};return _0x314e6f;})});}_0x1fbfb5=_[_0x7881('0x45')]({},_0x1fbfb5,_0x1c7074['options']);return _0x34ca23[_0x7881('0x6e')](_0x1fbfb5);}})[_0x7881('0x28')](function(_0x25a9ec){if(_0x25a9ec){_0xb7ba71=_0x25a9ec[_0x7881('0x4e')];if(!_0x1c7074[_0x7881('0x3a')][_0x7881('0x3e')]('nolimit')){_0x1fbfb5[_0x7881('0x40')]=qs[_0x7881('0x40')](_0x1c7074[_0x7881('0x3a')][_0x7881('0x40')]);_0x1fbfb5[_0x7881('0x21')]=qs['offset'](_0x1c7074[_0x7881('0x3a')]['offset']);}return _0x34ca23[_0x7881('0x6e')](_0x1fbfb5);}})[_0x7881('0x28')](function(_0x431c08){if(_0x431c08){return _0x431c08?{'count':_0xb7ba71,'rows':_0x431c08}:null;}})[_0x7881('0x28')](respondWithResult(_0x144a87,null))[_0x7881('0x4c')](handleError(_0x144a87,null));};exports[_0x7881('0x6f')]=function(_0x5e1227,_0x11203f,_0x924b3b){var _0x5bfea2=[];var _0x4fc8ae;return db[_0x7881('0x6d')][_0x7881('0x65')]({'where':{'id':_0x5e1227[_0x7881('0x5e')]['ids']},'attributes':['id'],'include':[{'model':db[_0x7881('0x70')],'as':_0x7881('0x71'),'attributes':['id'],'raw':!![]}]})[_0x7881('0x28')](function(_0x19a0d0){if(_0x19a0d0){for(var _0x6930e7=0x0;_0x6930e7<_0x19a0d0[_0x7881('0x4e')];_0x6930e7+=0x1){for(var _0x5a7f99=0x0;_0x5a7f99<_0x19a0d0[_0x6930e7][_0x7881('0x71')][_0x7881('0x4e')];_0x5a7f99+=0x1){_0x5bfea2=_[_0x7881('0x72')](_0x5bfea2,[_0x19a0d0[_0x6930e7][_0x7881('0x71')][_0x5a7f99]['id']]);}}return _0x5bfea2;}})[_0x7881('0x28')](function(_0x4ffe8a){if(_0x4ffe8a){return db['VoiceQueue'][_0x7881('0x2f')]({'where':{'id':_0x5e1227[_0x7881('0x4d')]['id']}});}})['then'](function(_0x58a464){if(_0x58a464){_0x4fc8ae=_0x58a464;return _0x4fc8ae[_0x7881('0x73')](_0x5bfea2,{'penalty':_0x5e1227[_0x7881('0x5e')][_0x7881('0x74')]});}})[_0x7881('0x28')](function(_0x4c598b){if(_0x4c598b){return _0x4fc8ae[_0x7881('0x6f')](_0x5e1227[_0x7881('0x5e')][_0x7881('0x75')]);}})[_0x7881('0x28')](handleEntityNotFound(_0x11203f,null))[_0x7881('0x28')](respondWithStatusCode(_0x11203f,null))[_0x7881('0x4c')](handleError(_0x11203f,null));};exports[_0x7881('0x76')]=function(_0x8f25f1,_0x2e22a5,_0x599f57){var _0x417597=[];var _0x182fbd;return db[_0x7881('0x6d')]['findAll']({'where':{'id':_0x8f25f1[_0x7881('0x3a')][_0x7881('0x75')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7881('0x71'),'attributes':['id'],'raw':!![]}]})[_0x7881('0x28')](function(_0x35bb62){if(_0x35bb62){for(var _0x4b23c3=0x0;_0x4b23c3<_0x35bb62[_0x7881('0x4e')];_0x4b23c3+=0x1){for(var _0x559f92=0x0;_0x559f92<_0x35bb62[_0x4b23c3][_0x7881('0x71')][_0x7881('0x4e')];_0x559f92+=0x1){_0x417597=_[_0x7881('0x72')](_0x417597,[_0x35bb62[_0x4b23c3][_0x7881('0x71')][_0x559f92]['id']]);}}return _0x417597;}})['then'](function(_0x734f5a){if(_0x734f5a){return db[_0x7881('0x49')][_0x7881('0x2f')]({'where':{'id':_0x8f25f1['params']['id']}});}})[_0x7881('0x28')](function(_0x521f1a){if(_0x521f1a){_0x182fbd=_0x521f1a;return _0x182fbd[_0x7881('0x77')](_0x417597);}})[_0x7881('0x28')](function(_0x30c20e){if(_0x182fbd){return _0x182fbd[_0x7881('0x76')](_0x8f25f1[_0x7881('0x3a')]['ids']);}})[_0x7881('0x28')](handleEntityNotFound(_0x2e22a5,null))[_0x7881('0x28')](respondWithStatusCode(_0x2e22a5,null))[_0x7881('0x4c')](handleError(_0x2e22a5,null));};exports['addAgents']=function(_0x23260e,_0x44748e,_0x1c9466){var _0x2c6d61,_0x5dc796;return db[_0x7881('0x49')][_0x7881('0x2f')]({'where':{'id':_0x23260e[_0x7881('0x4d')]['id']}})[_0x7881('0x28')](handleEntityNotFound(_0x44748e,null))['then'](function(_0x121956){if(_0x121956){_0x5dc796=_0x121956;return _0x121956[_0x7881('0x73')](_0x23260e[_0x7881('0x5e')][_0x7881('0x75')],_[_0x7881('0x5c')](_0x23260e['body'],[_0x7881('0x75'),'id'])||{})[_0x7881('0x78')](function(_0x4c7e8d){for(var _0x38067f=0x0;_0x38067f<_0x23260e[_0x7881('0x5e')]['ids'][_0x7881('0x4e')];_0x38067f+=0x1){socket[_0x7881('0x79')](_0x7881('0x7a'),{'UserId':_0x23260e['body']['ids'][_0x38067f],'VoiceQueueId':_0x23260e[_0x7881('0x4d')]['id']});}return _0x4c7e8d;});}})[_0x7881('0x28')](function(_0x15377d){_0x2c6d61=_0x15377d||[];if(_0x5dc796){return db['User'][_0x7881('0x65')]({'where':{'id':_0x23260e[_0x7881('0x5e')][_0x7881('0x75')]},'attributes':['id',_0x7881('0x31'),_0x7881('0x7b'),_0x7881('0x7c'),_0x7881('0x7d')],'raw':!![]});}})[_0x7881('0x28')](function(_0x17daeb){if(_0x17daeb&&_0x17daeb['length']){var _0x217f28=[];for(var _0x11f47a=0x0;_0x11f47a<_0x17daeb[_0x7881('0x4e')];_0x11f47a++){_0x217f28[_0x7881('0x7e')](db[_0x7881('0x7f')][_0x7881('0x80')]({'membername':_0x17daeb[_0x11f47a][_0x7881('0x31')],'UserId':_0x17daeb[_0x11f47a]['id'],'queue_name':_0x5dc796[_0x7881('0x31')],'VoiceQueueId':_0x5dc796['id'],'interface':_[_0x7881('0x81')](_0x17daeb[_0x11f47a]['interface'])?util[_0x7881('0x82')]('SIP/%s',_0x17daeb[_0x11f47a]['name']):_0x17daeb[_0x11f47a][_0x7881('0x7d')],'paused':_0x17daeb[_0x11f47a][_0x7881('0x7c')]||![],'penalty':_0x23260e[_0x7881('0x5e')][_0x7881('0x74')]||0x0}));}return BPromise[_0x7881('0x83')](_0x217f28);}})['then'](function(_0x5c02c5){return _0x2c6d61;})[_0x7881('0x28')](respondWithResult(_0x44748e,null))['catch'](handleError(_0x44748e,null));};exports['removeAgents']=function(_0x1911f7,_0x2f9c9f,_0x5dffc6){var _0x3f62c1;return db[_0x7881('0x49')]['find']({'where':{'id':_0x1911f7['params']['id']}})[_0x7881('0x28')](handleEntityNotFound(_0x2f9c9f,null))[_0x7881('0x28')](function(_0x5ed0bd){if(_0x5ed0bd){return _0x5ed0bd[_0x7881('0x77')](_0x1911f7[_0x7881('0x3a')]['ids'])[_0x7881('0x28')](function(_0x3871de){if(_[_0x7881('0x84')](_0x1911f7[_0x7881('0x3a')][_0x7881('0x75')])){for(var _0x4ad6aa=0x0;_0x4ad6aa<_0x1911f7[_0x7881('0x3a')]['ids'][_0x7881('0x4e')];_0x4ad6aa+=0x1){socket[_0x7881('0x79')]('userVoiceQueue:remove',{'UserId':_0x1911f7['query'][_0x7881('0x75')][_0x4ad6aa],'VoiceQueueId':_0x1911f7[_0x7881('0x4d')]['id']});}}else{socket[_0x7881('0x79')](_0x7881('0x85'),{'UserId':_0x1911f7[_0x7881('0x3a')][_0x7881('0x75')],'VoiceQueueId':_0x1911f7[_0x7881('0x4d')]['id']});}});}})[_0x7881('0x28')](function(_0x37e979){if(_0x1911f7[_0x7881('0x3a')][_0x7881('0x86')]){_0x3f62c1=_0x37e979;return db[_0x7881('0x7f')][_0x7881('0x29')]({'where':{'VoiceQueueId':_0x1911f7[_0x7881('0x4d')]['id'],'UserId':_0x1911f7['query']['ids']}})['then'](function(){return _0x3f62c1;});}})[_0x7881('0x28')](respondWithStatusCode(_0x2f9c9f,null))[_0x7881('0x4c')](handleError(_0x2f9c9f,null));};exports['getAgents']=function(_0x2dbaf8,_0x3ed493,_0x3ecca1){var _0x54b03a={};var _0x290f7d={};var _0x25c69e;var _0x4d90b5;return db['VoiceQueue'][_0x7881('0x61')]({'where':{'id':_0x2dbaf8[_0x7881('0x4d')]['id']}})[_0x7881('0x28')](handleEntityNotFound(_0x3ed493,null))['then'](function(_0x2e0e57){if(_0x2e0e57){_0x25c69e=_0x2e0e57;_0x290f7d[_0x7881('0x38')]=_[_0x7881('0x39')](db['User'][_0x7881('0x37')]);_0x290f7d[_0x7881('0x3a')]=_[_0x7881('0x39')](_0x2dbaf8[_0x7881('0x3a')]);_0x290f7d[_0x7881('0x43')]=_['intersection'](_0x290f7d[_0x7881('0x38')],_0x290f7d['query']);_0x54b03a[_0x7881('0x3d')]=_[_0x7881('0x3b')](_0x290f7d['model'],qs[_0x7881('0x3c')](_0x2dbaf8['query'][_0x7881('0x3c')]));_0x54b03a[_0x7881('0x3d')]=_0x54b03a[_0x7881('0x3d')][_0x7881('0x4e')]?_0x54b03a[_0x7881('0x3d')]:_0x290f7d[_0x7881('0x38')];_0x54b03a['order']=qs[_0x7881('0x41')](_0x2dbaf8[_0x7881('0x3a')]['sort']);_0x54b03a[_0x7881('0x42')]=qs[_0x7881('0x43')](_['pick'](_0x2dbaf8[_0x7881('0x3a')],_0x290f7d['filters']));if(_0x2dbaf8[_0x7881('0x3a')]['filter']){_0x54b03a['where']=_[_0x7881('0x45')](_0x54b03a['where'],{'$or':_[_0x7881('0x2d')](_0x54b03a[_0x7881('0x3d')],function(_0x517eac){var _0x2b86b6={};_0x2b86b6[_0x517eac]={'$like':'%'+_0x2dbaf8[_0x7881('0x3a')][_0x7881('0x2c')]+'%'};return _0x2b86b6;})});}_0x54b03a=_[_0x7881('0x45')]({},_0x54b03a,_0x2dbaf8[_0x7881('0x64')]);return _0x25c69e['getAgents'](_0x54b03a);}})[_0x7881('0x28')](function(_0x3a739f){if(_0x3a739f){_0x4d90b5=_0x3a739f[_0x7881('0x4e')];if(!_0x2dbaf8[_0x7881('0x3a')]['hasOwnProperty'](_0x7881('0x3f'))){_0x54b03a[_0x7881('0x40')]=qs[_0x7881('0x40')](_0x2dbaf8['query'][_0x7881('0x40')]);_0x54b03a[_0x7881('0x21')]=qs['offset'](_0x2dbaf8[_0x7881('0x3a')][_0x7881('0x21')]);}return _0x25c69e[_0x7881('0x87')](_0x54b03a);}})['then'](function(_0x529796){if(_0x529796){return _0x529796?{'count':_0x4d90b5,'rows':_0x529796}:null;}})[_0x7881('0x28')](respondWithResult(_0x3ed493,null))[_0x7881('0x4c')](handleError(_0x3ed493,null));};exports[_0x7881('0x88')]=function(_0x189652,_0x297775,_0x16beca){var _0x26d2fb={};var _0x68bf72={};var _0x27c67f;var _0x18067b;return db[_0x7881('0x49')][_0x7881('0x61')]({'where':{'id':_0x189652[_0x7881('0x4d')]['id']}})[_0x7881('0x28')](handleEntityNotFound(_0x297775,null))[_0x7881('0x28')](function(_0x5c5a50){if(_0x5c5a50){_0x27c67f=_0x5c5a50;_0x68bf72[_0x7881('0x38')]=_[_0x7881('0x39')](db[_0x7881('0x7f')][_0x7881('0x37')]);_0x68bf72['query']=_['keys'](_0x189652['query']);_0x68bf72[_0x7881('0x43')]=_[_0x7881('0x3b')](_0x68bf72[_0x7881('0x38')],_0x68bf72[_0x7881('0x3a')]);_0x26d2fb[_0x7881('0x3d')]=_[_0x7881('0x3b')](_0x68bf72[_0x7881('0x38')],qs['fields'](_0x189652[_0x7881('0x3a')][_0x7881('0x3c')]));_0x26d2fb[_0x7881('0x3d')]=_0x26d2fb['attributes'][_0x7881('0x4e')]?_0x26d2fb[_0x7881('0x3d')]:_0x68bf72[_0x7881('0x38')];_0x26d2fb[_0x7881('0x67')]=qs[_0x7881('0x41')](_0x189652[_0x7881('0x3a')][_0x7881('0x41')]);_0x26d2fb['where']=qs[_0x7881('0x43')](_[_0x7881('0x44')](_0x189652[_0x7881('0x3a')],_0x68bf72[_0x7881('0x43')]));if(_0x189652[_0x7881('0x3a')][_0x7881('0x2c')]){_0x26d2fb[_0x7881('0x42')]=_[_0x7881('0x45')](_0x26d2fb[_0x7881('0x42')],{'$or':_[_0x7881('0x2d')](_0x26d2fb[_0x7881('0x3d')],function(_0xb6d857){var _0x54f241={};_0x54f241[_0xb6d857]={'$like':'%'+_0x189652[_0x7881('0x3a')]['filter']+'%'};return _0x54f241;})});}_0x26d2fb=_['merge']({},_0x26d2fb,_0x189652[_0x7881('0x64')]);return _0x27c67f[_0x7881('0x88')](_0x26d2fb);}})['then'](function(_0x93e935){if(_0x93e935){_0x18067b=_0x93e935[_0x7881('0x4e')];if(!_0x189652[_0x7881('0x3a')][_0x7881('0x3e')]('nolimit')){_0x26d2fb['limit']=qs['limit'](_0x189652[_0x7881('0x3a')]['limit']);_0x26d2fb[_0x7881('0x21')]=qs[_0x7881('0x21')](_0x189652[_0x7881('0x3a')][_0x7881('0x21')]);}return _0x27c67f['getMembers'](_0x26d2fb);}})[_0x7881('0x28')](function(_0x5196e9){return _0x5196e9?{'count':_0x18067b,'rows':_0x5196e9}:null;})[_0x7881('0x28')](respondWithResult(_0x297775,null))[_0x7881('0x4c')](handleError(_0x297775,null));};exports[_0x7881('0x89')]=function(_0x3fedee,_0x2b16d0,_0x196841){var _0x1cb804={};var _0x5d6c48={};var _0x24ba6d;var _0x534b08;return db['VoiceQueue']['findOne']({'where':{'id':_0x3fedee[_0x7881('0x4d')]['id']}})[_0x7881('0x28')](handleEntityNotFound(_0x2b16d0,null))[_0x7881('0x28')](function(_0x610f7f){if(_0x610f7f){_0x24ba6d=_0x610f7f;_0x5d6c48[_0x7881('0x38')]=_['keys'](db[_0x7881('0x8a')]['rawAttributes']);_0x5d6c48['query']=_[_0x7881('0x39')](_0x3fedee[_0x7881('0x3a')]);_0x5d6c48['filters']=_['intersection'](_0x5d6c48[_0x7881('0x38')],_0x5d6c48['query']);_0x1cb804[_0x7881('0x3d')]=_[_0x7881('0x3b')](_0x5d6c48['model'],qs['fields'](_0x3fedee['query']['fields']));_0x1cb804['attributes']=_0x1cb804['attributes'][_0x7881('0x4e')]?_0x1cb804[_0x7881('0x3d')]:_0x5d6c48[_0x7881('0x38')];_0x1cb804['order']=qs[_0x7881('0x41')](_0x3fedee[_0x7881('0x3a')][_0x7881('0x41')]);_0x1cb804['where']=qs[_0x7881('0x43')](_[_0x7881('0x44')](_0x3fedee['query'],_0x5d6c48[_0x7881('0x43')]));if(_0x3fedee[_0x7881('0x3a')]['filter']){_0x1cb804[_0x7881('0x42')]=_[_0x7881('0x45')](_0x1cb804['where'],{'$or':_['map'](_0x1cb804[_0x7881('0x3d')],function(_0x268c77){var _0x35eccb={};_0x35eccb[_0x268c77]={'$like':'%'+_0x3fedee['query'][_0x7881('0x2c')]+'%'};return _0x35eccb;})});}_0x1cb804=_['merge']({},_0x1cb804,_0x3fedee[_0x7881('0x64')]);return _0x24ba6d['getLists'](_0x1cb804);}})[_0x7881('0x28')](function(_0x354a81){if(_0x354a81){_0x534b08=_0x354a81[_0x7881('0x4e')];if(!_0x3fedee[_0x7881('0x3a')][_0x7881('0x3e')]('nolimit')){_0x1cb804['limit']=qs['limit'](_0x3fedee['query'][_0x7881('0x40')]);_0x1cb804[_0x7881('0x21')]=qs[_0x7881('0x21')](_0x3fedee[_0x7881('0x3a')][_0x7881('0x21')]);}return _0x24ba6d[_0x7881('0x89')](_0x1cb804);}})['then'](function(_0x163071){if(_0x163071){return _0x163071?{'count':_0x534b08,'rows':_0x163071}:null;}})[_0x7881('0x28')](respondWithResult(_0x2b16d0,null))[_0x7881('0x4c')](handleError(_0x2b16d0,null));};exports[_0x7881('0x8b')]=function(_0x18751e,_0x2f0dd4,_0x3a23e3){var _0x4cf8e5,_0x3b3327;return db['VoiceQueue'][_0x7881('0x2f')]({'where':{'id':_0x18751e[_0x7881('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2f0dd4,null))[_0x7881('0x28')](function(_0x4b1b2f){if(_0x4b1b2f){_0x3b3327=_0x4b1b2f;return _0x4b1b2f[_0x7881('0x8b')](_0x18751e['body'][_0x7881('0x75')],_['omit'](_0x18751e[_0x7881('0x5e')],[_0x7881('0x75'),'id'])||{});}return null;})[_0x7881('0x78')](function(_0x37e594){var _0x3ae366;_0x4cf8e5=_0x37e594||[];var _0x253150=[];if(_0x37e594){for(var _0x4dbade=0x0;_0x4dbade<_0x37e594[_0x7881('0x4e')];_0x4dbade+=0x1){var _0x8917d6=_0x37e594[_0x4dbade][_0x7881('0x52')]({'plain':!![]});_0x3b3327[_0x7881('0x8c')]=_0x18751e[_0x7881('0x5e')][_0x7881('0x8c')]?_0x18751e[_0x7881('0x5e')][_0x7881('0x8c')]:_0x3b3327[_0x7881('0x8c')];switch(_0x3b3327[_0x7881('0x8c')]){case'always':_0x3ae366=squel[_0x7881('0x8d')]()['into'](_0x7881('0x8e'))[_0x7881('0x8f')](['phone',_0x7881('0x90'),'ContactId',_0x7881('0x91'),_0x7881('0x63'),_0x7881('0x92'),_0x7881('0x5d')],squel['select']()['field']('phone',_0x7881('0x93'))[_0x7881('0x48')](_0x7881('0x94'),'scheduledAt')[_0x7881('0x48')]('id',_0x7881('0x95'))[_0x7881('0x48')](_0x8917d6['CmListId']['toString'](),_0x7881('0x91'))[_0x7881('0x48')](_0x18751e['params']['id'][_0x7881('0x96')](),_0x7881('0x63'))['field'](_0x7881('0x94'),_0x7881('0x92'))[_0x7881('0x48')](_0x7881('0x94'),_0x7881('0x5d'))[_0x7881('0x97')](_0x7881('0x98'))[_0x7881('0x42')](_0x7881('0x99'))[_0x7881('0x42')]('ListId\x20=\x20?',_0x8917d6[_0x7881('0x9a')][_0x7881('0x96')]())[_0x7881('0x42')](_0x7881('0x9b'))[_0x7881('0x42')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7881('0x9c')]()[_0x7881('0x48')](_0x7881('0x9d'))[_0x7881('0x97')]('cm_hopper_final')[_0x7881('0x42')]('VoiceQueueId\x20=\x20?',_0x18751e[_0x7881('0x4d')]['id']['toString']()))[_0x7881('0x42')](_0x7881('0x9e'),squel[_0x7881('0x9c')]()[_0x7881('0x48')](_0x7881('0x93'))['from']('cm_hopper')[_0x7881('0x42')](_0x7881('0x9f'),_0x18751e['params']['id']['toString']())))['toString']();break;case'onlyIfOpen':_0x3ae366=squel[_0x7881('0x8d')]()[_0x7881('0xa0')](_0x7881('0x8e'))['fromQuery']([_0x7881('0x93'),_0x7881('0x90'),_0x7881('0x95'),_0x7881('0x91'),_0x7881('0x63'),'createdAt',_0x7881('0x5d')],squel[_0x7881('0x9c')]()['field'](_0x7881('0x93'),'phone')[_0x7881('0x48')](_0x7881('0x94'),_0x7881('0x90'))[_0x7881('0x48')]('id',_0x7881('0x95'))[_0x7881('0x48')](_0x8917d6[_0x7881('0x9a')][_0x7881('0x96')](),_0x7881('0x91'))['field'](_0x18751e[_0x7881('0x4d')]['id'][_0x7881('0x96')](),_0x7881('0x63'))['field'](_0x7881('0x94'),_0x7881('0x92'))['field'](_0x7881('0x94'),_0x7881('0x5d'))['from']('cm_contacts')[_0x7881('0x42')](_0x7881('0x99'))['where'](_0x7881('0xa1'),_0x8917d6[_0x7881('0x9a')][_0x7881('0x96')]())['where'](_0x7881('0x9b'))[_0x7881('0x42')](_0x7881('0x9e'),squel[_0x7881('0x9c')]()[_0x7881('0x48')]('phone')[_0x7881('0x97')](_0x7881('0x8e'))[_0x7881('0x42')](_0x7881('0x9f'),_0x18751e[_0x7881('0x4d')]['id'][_0x7881('0x96')]())))['toString']();break;default:_0x3ae366=squel[_0x7881('0x8d')]()[_0x7881('0xa0')](_0x7881('0x8e'))['fromQuery']([_0x7881('0x93'),_0x7881('0x90'),_0x7881('0x95'),'ListId',_0x7881('0x63'),'createdAt',_0x7881('0x5d')],squel[_0x7881('0x9c')]()[_0x7881('0x48')]('phone',_0x7881('0x93'))[_0x7881('0x48')]('NOW()','scheduledAt')[_0x7881('0x48')]('id',_0x7881('0x95'))[_0x7881('0x48')](_0x8917d6[_0x7881('0x9a')][_0x7881('0x96')](),_0x7881('0x91'))[_0x7881('0x48')](_0x18751e[_0x7881('0x4d')]['id'][_0x7881('0x96')](),_0x7881('0x63'))[_0x7881('0x48')](_0x7881('0x94'),_0x7881('0x92'))[_0x7881('0x48')](_0x7881('0x94'),_0x7881('0x5d'))[_0x7881('0x97')](_0x7881('0x98'))['where'](_0x7881('0x99'))[_0x7881('0x42')](_0x7881('0xa1'),_0x8917d6[_0x7881('0x9a')][_0x7881('0x96')]())['where'](_0x7881('0x9b')))[_0x7881('0x96')]();}_0x253150[_0x7881('0x7e')](db[_0x7881('0xa2')]['query'](_0x3ae366));}return BPromise[_0x7881('0x83')](_0x253150);}})[_0x7881('0x28')](function(){return _0x4cf8e5;})[_0x7881('0x28')](respondWithResult(_0x2f0dd4,null))[_0x7881('0x4c')](handleError(_0x2f0dd4,null));};exports[_0x7881('0xa3')]=function(_0x287a15,_0x3d69ca,_0x5bc17f){var _0x1caa64;return db['VoiceQueue']['find']({'where':{'id':_0x287a15['params']['id']}})['then'](handleEntityNotFound(_0x3d69ca,null))['then'](function(_0x53497f){if(_0x53497f){return _0x53497f['removeLists'](_0x287a15['query'][_0x7881('0x75')]);}})[_0x7881('0x28')](function(_0x139399){if(_0x139399){_0x1caa64=_0x139399;return db['CmHopper'][_0x7881('0x29')]({'where':{'ListId':_0x287a15[_0x7881('0x3a')][_0x7881('0x75')],'VoiceQueueId':_0x287a15[_0x7881('0x4d')]['id']}})[_0x7881('0x28')](function(){return _0x1caa64;});}})[_0x7881('0x28')](respondWithStatusCode(_0x3d69ca,null))[_0x7881('0x4c')](handleError(_0x3d69ca,null));};exports[_0x7881('0xa4')]=function(_0x208891,_0x2012f1,_0x50ea4b){var _0x276d79={};var _0x4f07bf={};var _0x2be14d;var _0x13b77a;return db['VoiceQueue'][_0x7881('0x61')]({'where':{'id':_0x208891['params']['id']}})[_0x7881('0x28')](handleEntityNotFound(_0x2012f1,null))[_0x7881('0x28')](function(_0x56c142){if(_0x56c142){_0x2be14d=_0x56c142;_0x4f07bf[_0x7881('0x38')]=_[_0x7881('0x39')](db[_0x7881('0x8a')]['rawAttributes']);_0x4f07bf[_0x7881('0x3a')]=_[_0x7881('0x39')](_0x208891[_0x7881('0x3a')]);_0x4f07bf[_0x7881('0x43')]=_[_0x7881('0x3b')](_0x4f07bf['model'],_0x4f07bf['query']);_0x276d79[_0x7881('0x3d')]=_[_0x7881('0x3b')](_0x4f07bf[_0x7881('0x38')],qs[_0x7881('0x3c')](_0x208891[_0x7881('0x3a')][_0x7881('0x3c')]));_0x276d79[_0x7881('0x3d')]=_0x276d79[_0x7881('0x3d')][_0x7881('0x4e')]?_0x276d79[_0x7881('0x3d')]:_0x4f07bf[_0x7881('0x38')];_0x276d79['order']=qs['sort'](_0x208891[_0x7881('0x3a')][_0x7881('0x41')]);_0x276d79['where']=qs['filters'](_[_0x7881('0x44')](_0x208891[_0x7881('0x3a')],_0x4f07bf[_0x7881('0x43')]));if(_0x208891['query']['filter']){_0x276d79['where']=_[_0x7881('0x45')](_0x276d79[_0x7881('0x42')],{'$or':_['map'](_0x276d79[_0x7881('0x3d')],function(_0x53cf7d){var _0x1b0594={};_0x1b0594[_0x53cf7d]={'$like':'%'+_0x208891[_0x7881('0x3a')][_0x7881('0x2c')]+'%'};return _0x1b0594;})});}_0x276d79=_[_0x7881('0x45')]({},_0x276d79,_0x208891[_0x7881('0x64')]);return _0x2be14d[_0x7881('0xa4')](_0x276d79);}})['then'](function(_0x56bf0e){if(_0x56bf0e){_0x13b77a=_0x56bf0e[_0x7881('0x4e')];if(!_0x208891[_0x7881('0x3a')][_0x7881('0x3e')](_0x7881('0x3f'))){_0x276d79[_0x7881('0x40')]=qs[_0x7881('0x40')](_0x208891[_0x7881('0x3a')][_0x7881('0x40')]);_0x276d79['offset']=qs[_0x7881('0x21')](_0x208891[_0x7881('0x3a')][_0x7881('0x21')]);}return _0x2be14d['getBlackLists'](_0x276d79);}})[_0x7881('0x28')](function(_0x4ef0b4){if(_0x4ef0b4){return _0x4ef0b4?{'count':_0x13b77a,'rows':_0x4ef0b4}:null;}})['then'](respondWithResult(_0x2012f1,null))[_0x7881('0x4c')](handleError(_0x2012f1,null));};exports[_0x7881('0xa5')]=function(_0x357dd8,_0x37e8e4,_0x34be3e){var _0x51c938,_0x48485f;return db[_0x7881('0x49')][_0x7881('0x2f')]({'where':{'id':_0x357dd8[_0x7881('0x4d')]['id']}})[_0x7881('0x28')](handleEntityNotFound(_0x37e8e4,null))[_0x7881('0x28')](function(_0x57b4cc){if(_0x57b4cc){_0x48485f=_0x57b4cc;return _0x57b4cc[_0x7881('0xa5')](_0x357dd8[_0x7881('0x5e')][_0x7881('0x75')],_[_0x7881('0x5c')](_0x357dd8[_0x7881('0x5e')],[_0x7881('0x75'),'id'])||{});}return null;})[_0x7881('0x78')](function(_0x59c5c8){var _0xb2b6f1;_0x51c938=_0x59c5c8||[];var _0x103773=[];if(_0x59c5c8){for(var _0x15463f=0x0;_0x15463f<_0x59c5c8[_0x7881('0x4e')];_0x15463f+=0x1){var _0x1ca088=_0x59c5c8[_0x15463f][_0x7881('0x52')]({'plain':!![]});_0xb2b6f1=squel[_0x7881('0x8d')]()[_0x7881('0xa0')]('cm_hopper_black')[_0x7881('0x8f')]([_0x7881('0x93'),'ContactId',_0x7881('0x91'),_0x7881('0x63'),_0x7881('0x92'),'updatedAt'],squel[_0x7881('0x9c')]()[_0x7881('0x48')](_0x7881('0x93'),'phone')[_0x7881('0x48')]('id',_0x7881('0x95'))[_0x7881('0x48')](_0x1ca088['CmListId'][_0x7881('0x96')](),'ListId')['field'](_0x357dd8[_0x7881('0x4d')]['id']['toString'](),_0x7881('0x63'))[_0x7881('0x48')](_0x7881('0x94'),_0x7881('0x92'))['field'](_0x7881('0x94'),'updatedAt')[_0x7881('0x97')]('cm_contacts')[_0x7881('0x42')](_0x7881('0x99'))['where'](_0x7881('0xa1'),_0x1ca088[_0x7881('0x9a')]['toString']())[_0x7881('0x42')](_0x7881('0x9b')))[_0x7881('0x96')]();_0x103773[_0x7881('0x7e')](db[_0x7881('0xa2')][_0x7881('0x3a')](_0xb2b6f1));}return BPromise['all'](_0x103773);}})[_0x7881('0x28')](function(){return _0x51c938;})[_0x7881('0x28')](respondWithResult(_0x37e8e4,null))[_0x7881('0x4c')](handleError(_0x37e8e4,null));};exports[_0x7881('0xa6')]=function(_0x20a5e4,_0x316c92,_0x5c5eb8){var _0x445b9f;return db[_0x7881('0x49')][_0x7881('0x2f')]({'where':{'id':_0x20a5e4[_0x7881('0x4d')]['id']}})[_0x7881('0x28')](handleEntityNotFound(_0x316c92,null))[_0x7881('0x28')](function(_0x20f88a){if(_0x20f88a){return _0x20f88a[_0x7881('0xa6')](_0x20a5e4[_0x7881('0x3a')][_0x7881('0x75')]);}})[_0x7881('0x28')](function(_0xe2a521){if(_0xe2a521){_0x445b9f=_0xe2a521;return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x20a5e4[_0x7881('0x3a')][_0x7881('0x75')],'VoiceQueueId':_0x20a5e4['params']['id']}})['then'](function(){return _0x445b9f;});}})['then'](respondWithStatusCode(_0x316c92,null))['catch'](handleError(_0x316c92,null));};
\ No newline at end of file
+var _0x2a1b=['limit','Content-Range','apply','reject','save','update','then','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','value','includes','find','type','name','UserProfileResource','destroy','sendStatus','error','send','index','VoiceQueue','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','options','includeAll','include','rows','catch','params','create','body','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','getHoppers','findOne','CmHopper','VoiceQueueId','findAll','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','ids','User','Agents','union','addAgents','addTeams','removeTeams','removeAgents','spread','emit','userVoiceQueue:save','loginInPause','voicePause','interface','push','upsert','isNil','SIP/%s','penalty','all','isArray','userVoiceQueue:remove','realtime','UserVoiceQueueRt','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','field','ContactId','toString','NOW()','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','calleridnum','cm_hopper_final','VoiceQueueId\x20=\x20?','onlyIfOpen','insert','CmListId','cm_contacts','sequelize','getBlackLists','addBlackLists','removeBlackLists','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','status','end','json','count','offset'];(function(_0x86901c,_0xc0e9a7){var _0x573386=function(_0x4d3a1a){while(--_0x4d3a1a){_0x86901c['push'](_0x86901c['shift']());}};_0x573386(++_0xc0e9a7);}(_0x2a1b,0x1c1));var _0xb2a1=function(_0x1b9f60,_0x5cd7d7){_0x1b9f60=_0x1b9f60-0x0;var _0x23cae1=_0x2a1b[_0x1b9f60];return _0x23cae1;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xb2a1('0x0'));var zipdir=require(_0xb2a1('0x1'));var jsonpatch=require(_0xb2a1('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb2a1('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb2a1('0x4'));var sox=require(_0xb2a1('0x5'));var csv=require(_0xb2a1('0x6'));var ejs=require(_0xb2a1('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb2a1('0x8'));var crypto=require('crypto');var jsforce=require(_0xb2a1('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xb2a1('0x6'));var querystring=require(_0xb2a1('0xa'));var Papa=require(_0xb2a1('0xb'));var authService=require(_0xb2a1('0xc'));var hardwareService=require(_0xb2a1('0xd'));var Redis=require('ioredis');var qs=require(_0xb2a1('0xe'));var logger=require(_0xb2a1('0xf'))('api');var utils=require(_0xb2a1('0x10'));var config=require('../../config/environment');var db=require(_0xb2a1('0x11'))['db'];config['redis']=_['defaults'](config[_0xb2a1('0x12')],{'host':_0xb2a1('0x13'),'port':0x18eb});var socket=require(_0xb2a1('0x14'))(new Redis(config[_0xb2a1('0x12')]));require(_0xb2a1('0x15'))[_0xb2a1('0x16')](socket);function respondWithStatusCode(_0x6db203,_0x6f33c8){_0x6f33c8=_0x6f33c8||0xcc;return function(_0x54efd3){if(_0x54efd3){return _0x6db203['sendStatus'](_0x6f33c8);}return _0x6db203[_0xb2a1('0x17')](_0x6f33c8)[_0xb2a1('0x18')]();};}function respondWithResult(_0x14e022,_0x48b0c6){_0x48b0c6=_0x48b0c6||0xc8;return function(_0x43d72c){if(_0x43d72c){return _0x14e022[_0xb2a1('0x17')](_0x48b0c6)[_0xb2a1('0x19')](_0x43d72c);}};}function respondWithFilteredResult(_0x215fc6,_0x5a2d2c){return function(_0x348bc4){if(_0x348bc4){var _0x33aff1=_0x348bc4[_0xb2a1('0x1a')],_0x3e891d=_0x5a2d2c[_0xb2a1('0x1b')],_0x189618=_0x5a2d2c['offset']+_0x5a2d2c[_0xb2a1('0x1c')],_0x3e0e3f;if(_0x189618>=_0x33aff1){_0x189618=_0x33aff1;_0x3e0e3f=0xc8;}else{_0x3e0e3f=0xce;}_0x215fc6[_0xb2a1('0x17')](_0x3e0e3f);return _0x215fc6['set'](_0xb2a1('0x1d'),_0x3e891d+'-'+_0x189618+'/'+_0x33aff1)[_0xb2a1('0x19')](_0x348bc4);}return null;};}function patchUpdates(_0x13653d){return function(_0x12730e){try{jsonpatch[_0xb2a1('0x1e')](_0x12730e,_0x13653d,!![]);}catch(_0x374178){return BPromise[_0xb2a1('0x1f')](_0x374178);}return _0x12730e[_0xb2a1('0x20')]();};}function saveUpdates(_0x3530be,_0x496a89){return function(_0x1a42e9){if(_0x1a42e9){return _0x1a42e9[_0xb2a1('0x21')](_0x3530be)['then'](function(_0x109d9f){return _0x109d9f;});}return null;};}function removeEntity(_0x238c5f,_0x6f349b){return function(_0xd59832){if(_0xd59832){return _0xd59832['destroy']()[_0xb2a1('0x22')](function(){var _0x322f82=_0xd59832['get']({'plain':!![]});var _0xf602f2=[{'name':_0xb2a1('0x23'),'value':_0xb2a1('0x24'),'ignore':![]},{'name':_0xb2a1('0x25'),'value':_0xb2a1('0x26'),'ignore':![]}];var _0x122bd6=_(_0xf602f2)[_0xb2a1('0x27')](_0xb2a1('0x28'))['map'](_0xb2a1('0x29'))['value']();if(_[_0xb2a1('0x2a')](_0x122bd6,_0x322f82['type'])){return;}var _0x508067=_[_0xb2a1('0x2b')](_0xf602f2,[_0xb2a1('0x29'),_0x322f82[_0xb2a1('0x2c')]])[_0xb2a1('0x2d')];return db[_0xb2a1('0x2e')][_0xb2a1('0x2f')]({'where':{'type':_0x508067,'resourceId':_0x322f82['id']}})[_0xb2a1('0x22')](function(){return _0xd59832;});})[_0xb2a1('0x22')](function(){_0x238c5f['status'](0xcc)[_0xb2a1('0x18')]();});}};}function handleEntityNotFound(_0xd66ddb,_0x16f9d9){return function(_0x591f23){if(!_0x591f23){_0xd66ddb[_0xb2a1('0x30')](0x194);}return _0x591f23;};}function handleError(_0x23ba94,_0x26f246){_0x26f246=_0x26f246||0x1f4;return function(_0x40ae20){logger[_0xb2a1('0x31')](_0x40ae20['stack']);if(_0x40ae20[_0xb2a1('0x2d')]){delete _0x40ae20[_0xb2a1('0x2d')];}_0x23ba94[_0xb2a1('0x17')](_0x26f246)[_0xb2a1('0x32')](_0x40ae20);};}exports[_0xb2a1('0x33')]=function(_0x1129f8,_0xd29184){var _0x4e6689={},_0x2aa35f={},_0x1e0a7c={'count':0x0,'rows':[]};var _0x524e89=db[_0xb2a1('0x34')][_0xb2a1('0x35')];_0x2aa35f[_0xb2a1('0x36')]=_[_0xb2a1('0x37')](_0x524e89);_0x2aa35f[_0xb2a1('0x38')]=_[_0xb2a1('0x37')](_0x1129f8[_0xb2a1('0x38')]);_0x2aa35f[_0xb2a1('0x39')]=_[_0xb2a1('0x3a')](_0x2aa35f['model'],_0x2aa35f[_0xb2a1('0x38')]);_0x4e6689['attributes']=_['intersection'](_0x2aa35f[_0xb2a1('0x36')],qs[_0xb2a1('0x3b')](_0x1129f8[_0xb2a1('0x38')][_0xb2a1('0x3b')]));_0x4e6689[_0xb2a1('0x3c')]=_0x4e6689[_0xb2a1('0x3c')][_0xb2a1('0x3d')]?_0x4e6689['attributes']:_0x2aa35f[_0xb2a1('0x36')];if(!_0x1129f8[_0xb2a1('0x38')][_0xb2a1('0x3e')](_0xb2a1('0x3f'))){_0x4e6689['limit']=qs[_0xb2a1('0x1c')](_0x1129f8[_0xb2a1('0x38')][_0xb2a1('0x1c')]);_0x4e6689['offset']=qs[_0xb2a1('0x1b')](_0x1129f8['query']['offset']);}_0x4e6689[_0xb2a1('0x40')]=qs[_0xb2a1('0x41')](_0x1129f8[_0xb2a1('0x38')]['sort']);_0x4e6689[_0xb2a1('0x42')]=qs[_0xb2a1('0x39')](_[_0xb2a1('0x43')](_0x1129f8['query'],_0x2aa35f[_0xb2a1('0x39')]));if(_0x1129f8[_0xb2a1('0x38')][_0xb2a1('0x27')]){_0x4e6689[_0xb2a1('0x42')]=_[_0xb2a1('0x44')](_0x4e6689[_0xb2a1('0x42')],{'$or':_[_0xb2a1('0x45')](_0x524e89,function(_0x4df5c0){if(_0x4df5c0[_0xb2a1('0x2c')]['key']!==_0xb2a1('0x46')){var _0x4614a6={};_0x4614a6[_0x4df5c0['field']]={'$like':'%'+_0x1129f8[_0xb2a1('0x38')][_0xb2a1('0x27')]+'%'};return _0x4614a6;}})});}_0x4e6689=_[_0xb2a1('0x44')]({},_0x4e6689,_0x1129f8[_0xb2a1('0x47')]);var _0xbb7a9d={'where':_0x4e6689[_0xb2a1('0x42')]};return db[_0xb2a1('0x34')]['count'](_0xbb7a9d)[_0xb2a1('0x22')](function(_0x2ebe28){_0x1e0a7c[_0xb2a1('0x1a')]=_0x2ebe28;if(_0x1129f8[_0xb2a1('0x38')][_0xb2a1('0x48')]){_0x4e6689[_0xb2a1('0x49')]=[{'all':!![]}];}return db[_0xb2a1('0x34')]['findAll'](_0x4e6689);})[_0xb2a1('0x22')](function(_0x241f62){_0x1e0a7c[_0xb2a1('0x4a')]=_0x241f62;return _0x1e0a7c;})['then'](respondWithFilteredResult(_0xd29184,_0x4e6689))[_0xb2a1('0x4b')](handleError(_0xd29184,null));};exports['show']=function(_0x27274c,_0x241fee){var _0x396b80={'raw':![],'where':{'id':_0x27274c[_0xb2a1('0x4c')]['id']}},_0x156677={};_0x156677[_0xb2a1('0x36')]=_[_0xb2a1('0x37')](db[_0xb2a1('0x34')][_0xb2a1('0x35')]);_0x156677['query']=_['keys'](_0x27274c[_0xb2a1('0x38')]);_0x156677['filters']=_[_0xb2a1('0x3a')](_0x156677[_0xb2a1('0x36')],_0x156677[_0xb2a1('0x38')]);_0x396b80['attributes']=_[_0xb2a1('0x3a')](_0x156677[_0xb2a1('0x36')],qs[_0xb2a1('0x3b')](_0x27274c[_0xb2a1('0x38')][_0xb2a1('0x3b')]));_0x396b80[_0xb2a1('0x3c')]=_0x396b80[_0xb2a1('0x3c')][_0xb2a1('0x3d')]?_0x396b80['attributes']:_0x156677[_0xb2a1('0x36')];if(_0x27274c[_0xb2a1('0x38')][_0xb2a1('0x48')]){_0x396b80[_0xb2a1('0x49')]=[{'all':!![]}];}_0x396b80=_[_0xb2a1('0x44')]({},_0x396b80,_0x27274c[_0xb2a1('0x47')]);return db[_0xb2a1('0x34')][_0xb2a1('0x2b')](_0x396b80)['then'](handleEntityNotFound(_0x241fee,null))[_0xb2a1('0x22')](respondWithResult(_0x241fee,null))[_0xb2a1('0x4b')](handleError(_0x241fee,null));};exports[_0xb2a1('0x4d')]=function(_0x16158e,_0x37d903){return db['VoiceQueue']['create'](_0x16158e[_0xb2a1('0x4e')],{})['then'](function(_0x456584){var _0x32d9b7=_0x16158e[_0xb2a1('0x4f')][_0xb2a1('0x50')]({'plain':!![]});if(!_0x32d9b7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x32d9b7['role']===_0xb2a1('0x4f')){var _0x49a128=_0x456584['get']({'plain':!![]});var _0x20b4ff=[{'name':_0xb2a1('0x23'),'value':_0xb2a1('0x24')},{'name':_0xb2a1('0x25'),'value':_0xb2a1('0x26')}];var _0x4d557b=_['find'](_0x20b4ff,[_0xb2a1('0x29'),_0x49a128[_0xb2a1('0x2c')]])[_0xb2a1('0x2d')];return db[_0xb2a1('0x51')]['find']({'where':{'name':_0x4d557b,'userProfileId':_0x32d9b7['userProfileId']},'raw':!![]})[_0xb2a1('0x22')](function(_0x3d5bdf){if(_0x3d5bdf&&_0x3d5bdf[_0xb2a1('0x52')]===0x0){return db[_0xb2a1('0x2e')][_0xb2a1('0x4d')]({'name':_0x49a128[_0xb2a1('0x2d')],'resourceId':_0x49a128['id'],'type':_0x3d5bdf['name'],'sectionId':_0x3d5bdf['id']},{})['then'](function(){return _0x456584;});}else{return _0x456584;}})[_0xb2a1('0x4b')](function(_0x5d083b){logger[_0xb2a1('0x31')](_0xb2a1('0x53'),_0x5d083b);throw _0x5d083b;});}return _0x456584;})[_0xb2a1('0x22')](respondWithResult(_0x37d903,0xc9))[_0xb2a1('0x4b')](handleError(_0x37d903,null));};exports[_0xb2a1('0x54')]=function(_0x424502,_0x3988b2){var _0x1d2d69={'raw':![],'where':{'id':_0x424502['params']['id']}},_0x1b5df7={};_0x1b5df7[_0xb2a1('0x36')]=_['keys'](db['VoiceQueue']['rawAttributes']);_0x1d2d69[_0xb2a1('0x3c')]=_[_0xb2a1('0x3a')](_0x1b5df7[_0xb2a1('0x36')],qs[_0xb2a1('0x3b')](_0x424502[_0xb2a1('0x38')][_0xb2a1('0x3b')]));_0x1d2d69['attributes']=_0x1d2d69[_0xb2a1('0x3c')][_0xb2a1('0x3d')]?_0x1d2d69['attributes']:_0x1b5df7[_0xb2a1('0x36')];if(_0x424502[_0xb2a1('0x38')]['includeAll']){_0x1d2d69['include']=[{'all':!![]}];}_0x1d2d69=_[_0xb2a1('0x44')]({},_0x1d2d69,_0x424502[_0xb2a1('0x47')]);return db[_0xb2a1('0x34')]['find'](_0x1d2d69)['then'](handleEntityNotFound(_0x3988b2,null))[_0xb2a1('0x22')](function(_0x591f72){if(_0x591f72){var _0x16a954=_0x591f72[_0xb2a1('0x50')]({'plain':!![]});_0x16a954=qs[_0xb2a1('0x55')](_0x16a954,['id',_0xb2a1('0x56'),_0xb2a1('0x57')]);_0x424502['body']=_['omit'](_0x424502[_0xb2a1('0x4e')],['id',_0xb2a1('0x56'),'updatedAt']);return db[_0xb2a1('0x34')]['create'](_['merge'](_0x16a954,_0x424502[_0xb2a1('0x4e')]),{'include':_0x424502[_0xb2a1('0x38')][_0xb2a1('0x48')]?[{'all':!![]}]:undefined})['then'](function(_0x4235c6){var _0x3bec70=_0x424502[_0xb2a1('0x4f')][_0xb2a1('0x50')]({'plain':!![]});if(!_0x3bec70)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3bec70['role']===_0xb2a1('0x4f')){var _0x26feff=_0x4235c6['get']({'plain':!![]});var _0x35f7b3=[{'name':_0xb2a1('0x23'),'value':'inbound'},{'name':_0xb2a1('0x25'),'value':'outbound'}];var _0x55c08e=_[_0xb2a1('0x2b')](_0x35f7b3,['value',_0x26feff[_0xb2a1('0x2c')]])[_0xb2a1('0x2d')];return db[_0xb2a1('0x51')][_0xb2a1('0x2b')]({'where':{'name':_0x55c08e,'userProfileId':_0x3bec70[_0xb2a1('0x58')]},'raw':!![]})[_0xb2a1('0x22')](function(_0x1dd11f){if(_0x1dd11f&&_0x1dd11f[_0xb2a1('0x52')]===0x0){return db[_0xb2a1('0x2e')]['create']({'name':_0x26feff['name'],'resourceId':_0x26feff['id'],'type':_0x1dd11f[_0xb2a1('0x2d')],'sectionId':_0x1dd11f['id']},{})[_0xb2a1('0x22')](function(){return _0x4235c6;});}else{return _0x4235c6;}})['catch'](function(_0xee52db){logger[_0xb2a1('0x31')](_0xb2a1('0x53'),_0xee52db);throw _0xee52db;});}return _0x4235c6;});}})[_0xb2a1('0x22')](respondWithResult(_0x3988b2,0xc9))[_0xb2a1('0x4b')](handleError(_0x3988b2,null));};exports['update']=function(_0x195c8e,_0x6a7bab){if(_0x195c8e['body']['id']){delete _0x195c8e[_0xb2a1('0x4e')]['id'];}return db[_0xb2a1('0x34')][_0xb2a1('0x2b')]({'where':{'id':_0x195c8e['params']['id']}})['then'](handleEntityNotFound(_0x6a7bab,null))[_0xb2a1('0x22')](saveUpdates(_0x195c8e['body'],null))['then'](respondWithResult(_0x6a7bab,null))[_0xb2a1('0x4b')](handleError(_0x6a7bab,null));};exports['destroy']=function(_0x18a129,_0x474f23){return db[_0xb2a1('0x34')][_0xb2a1('0x2b')]({'where':{'id':_0x18a129[_0xb2a1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x474f23,null))[_0xb2a1('0x22')](removeEntity(_0x474f23,null))[_0xb2a1('0x4b')](handleError(_0x474f23,null));};exports[_0xb2a1('0x59')]=function(_0x2ce21e,_0x1a9c1c,_0x4cf887){var _0x15f63e={'raw':![],'where':{}};var _0x3c3dc5={};var _0x6c9e75={'count':0x0,'rows':[]};return db[_0xb2a1('0x34')][_0xb2a1('0x5a')]({'where':{'id':_0x2ce21e[_0xb2a1('0x4c')]['id']}})[_0xb2a1('0x22')](handleEntityNotFound(_0x1a9c1c,null))[_0xb2a1('0x22')](function(_0x3ffa35){if(_0x3ffa35){_0x3c3dc5['model']=_[_0xb2a1('0x37')](db[_0xb2a1('0x5b')][_0xb2a1('0x35')]);_0x3c3dc5['query']=_[_0xb2a1('0x37')](_0x2ce21e[_0xb2a1('0x38')]);_0x3c3dc5[_0xb2a1('0x39')]=_['intersection'](_0x3c3dc5[_0xb2a1('0x36')],_0x3c3dc5[_0xb2a1('0x38')]);_0x15f63e[_0xb2a1('0x3c')]=_['intersection'](_0x3c3dc5[_0xb2a1('0x36')],qs[_0xb2a1('0x3b')](_0x2ce21e['query'][_0xb2a1('0x3b')]));_0x15f63e[_0xb2a1('0x3c')]=_0x15f63e['attributes'][_0xb2a1('0x3d')]?_0x15f63e[_0xb2a1('0x3c')]:_0x3c3dc5[_0xb2a1('0x36')];if(!_0x2ce21e['query'][_0xb2a1('0x3e')](_0xb2a1('0x3f'))){_0x15f63e['limit']=qs[_0xb2a1('0x1c')](_0x2ce21e['query'][_0xb2a1('0x1c')]);_0x15f63e[_0xb2a1('0x1b')]=qs[_0xb2a1('0x1b')](_0x2ce21e['query'][_0xb2a1('0x1b')]);}_0x15f63e[_0xb2a1('0x40')]=qs[_0xb2a1('0x41')](_0x2ce21e[_0xb2a1('0x38')][_0xb2a1('0x41')]);_0x15f63e[_0xb2a1('0x42')]=qs[_0xb2a1('0x39')](_[_0xb2a1('0x43')](_0x2ce21e[_0xb2a1('0x38')],_0x3c3dc5[_0xb2a1('0x39')]));_0x15f63e[_0xb2a1('0x42')][_0xb2a1('0x5c')]=_0x3ffa35['id'];if(_0x2ce21e['query']['filter']){_0x15f63e[_0xb2a1('0x42')]=_['merge'](_0x15f63e[_0xb2a1('0x42')],{'$or':_[_0xb2a1('0x45')](_0x15f63e[_0xb2a1('0x3c')],function(_0x131c84){var _0x1e5c5e={};_0x1e5c5e[_0x131c84]={'$like':'%'+_0x2ce21e[_0xb2a1('0x38')][_0xb2a1('0x27')]+'%'};return _0x1e5c5e;})});}_0x15f63e=_['merge']({},_0x15f63e,_0x2ce21e[_0xb2a1('0x47')]);return db['CmHopper'][_0xb2a1('0x1a')]({'where':_0x15f63e[_0xb2a1('0x42')]})[_0xb2a1('0x22')](function(_0x2d2260){_0x6c9e75['count']=_0x2d2260;if(_0x2ce21e[_0xb2a1('0x38')]['includeAll']){_0x15f63e['include']=[{'all':!![]}];}return db[_0xb2a1('0x5b')][_0xb2a1('0x5d')](_0x15f63e);})[_0xb2a1('0x22')](function(_0x29cd8e){_0x6c9e75['rows']=_0x29cd8e;return _0x6c9e75;});}})[_0xb2a1('0x22')](respondWithFilteredResult(_0x1a9c1c,_0x15f63e))[_0xb2a1('0x4b')](handleError(_0x1a9c1c,null));};exports[_0xb2a1('0x5e')]=function(_0x1eed1b,_0xbc823d,_0x290aba){var _0x170cdb={'raw':!![],'where':{}};var _0x2c5a56={};var _0x375c29={'count':0x0,'rows':[]};return db[_0xb2a1('0x34')][_0xb2a1('0x5a')]({'where':{'id':_0x1eed1b[_0xb2a1('0x4c')]['id']}})['then'](handleEntityNotFound(_0xbc823d,null))[_0xb2a1('0x22')](function(_0x28f458){if(_0x28f458){_0x2c5a56[_0xb2a1('0x36')]=_[_0xb2a1('0x37')](db[_0xb2a1('0x5f')]['rawAttributes']);_0x2c5a56[_0xb2a1('0x38')]=_[_0xb2a1('0x37')](_0x1eed1b[_0xb2a1('0x38')]);_0x2c5a56['filters']=_[_0xb2a1('0x3a')](_0x2c5a56[_0xb2a1('0x36')],_0x2c5a56[_0xb2a1('0x38')]);_0x170cdb['attributes']=_[_0xb2a1('0x3a')](_0x2c5a56['model'],qs['fields'](_0x1eed1b[_0xb2a1('0x38')][_0xb2a1('0x3b')]));_0x170cdb[_0xb2a1('0x3c')]=_0x170cdb[_0xb2a1('0x3c')][_0xb2a1('0x3d')]?_0x170cdb[_0xb2a1('0x3c')]:_0x2c5a56['model'];if(!_0x1eed1b[_0xb2a1('0x38')]['hasOwnProperty'](_0xb2a1('0x3f'))){_0x170cdb[_0xb2a1('0x1c')]=qs[_0xb2a1('0x1c')](_0x1eed1b[_0xb2a1('0x38')][_0xb2a1('0x1c')]);_0x170cdb['offset']=qs[_0xb2a1('0x1b')](_0x1eed1b[_0xb2a1('0x38')]['offset']);}_0x170cdb[_0xb2a1('0x40')]=qs[_0xb2a1('0x41')](_0x1eed1b[_0xb2a1('0x38')][_0xb2a1('0x41')]);_0x170cdb[_0xb2a1('0x42')]=qs[_0xb2a1('0x39')](_['pick'](_0x1eed1b['query'],_0x2c5a56[_0xb2a1('0x39')]));_0x170cdb[_0xb2a1('0x42')][_0xb2a1('0x5c')]=_0x28f458['id'];if(_0x1eed1b[_0xb2a1('0x38')][_0xb2a1('0x27')]){_0x170cdb['where']=_['merge'](_0x170cdb[_0xb2a1('0x42')],{'$or':_[_0xb2a1('0x45')](_0x170cdb['attributes'],function(_0x360ca9){var _0x280a64={};_0x280a64[_0x360ca9]={'$like':'%'+_0x1eed1b[_0xb2a1('0x38')][_0xb2a1('0x27')]+'%'};return _0x280a64;})});}_0x170cdb=_[_0xb2a1('0x44')]({},_0x170cdb,_0x1eed1b[_0xb2a1('0x47')]);return db['CmHopperHistory'][_0xb2a1('0x1a')]({'where':_0x170cdb[_0xb2a1('0x42')]})[_0xb2a1('0x22')](function(_0x592c37){_0x375c29[_0xb2a1('0x1a')]=_0x592c37;if(_0x1eed1b[_0xb2a1('0x38')][_0xb2a1('0x48')]){_0x170cdb[_0xb2a1('0x49')]=[{'all':!![]}];}return db[_0xb2a1('0x5f')]['findAll'](_0x170cdb);})[_0xb2a1('0x22')](function(_0x333c5c){_0x375c29[_0xb2a1('0x4a')]=_0x333c5c;return _0x375c29;});}})[_0xb2a1('0x22')](respondWithFilteredResult(_0xbc823d,_0x170cdb))[_0xb2a1('0x4b')](handleError(_0xbc823d,null));};exports['getHopperFinals']=function(_0x40033f,_0xb69bf5,_0x2d2123){var _0x48c768={'raw':!![],'where':{}};var _0x36353d={};var _0x2bc7c3={'count':0x0,'rows':[]};return db[_0xb2a1('0x34')][_0xb2a1('0x5a')]({'where':{'id':_0x40033f['params']['id']}})[_0xb2a1('0x22')](handleEntityNotFound(_0xb69bf5,null))[_0xb2a1('0x22')](function(_0x112a2a){if(_0x112a2a){_0x36353d[_0xb2a1('0x36')]=_[_0xb2a1('0x37')](db[_0xb2a1('0x60')]['rawAttributes']);_0x36353d[_0xb2a1('0x38')]=_[_0xb2a1('0x37')](_0x40033f[_0xb2a1('0x38')]);_0x36353d[_0xb2a1('0x39')]=_[_0xb2a1('0x3a')](_0x36353d[_0xb2a1('0x36')],_0x36353d[_0xb2a1('0x38')]);_0x48c768[_0xb2a1('0x3c')]=_[_0xb2a1('0x3a')](_0x36353d[_0xb2a1('0x36')],qs['fields'](_0x40033f[_0xb2a1('0x38')][_0xb2a1('0x3b')]));_0x48c768['attributes']=_0x48c768['attributes'][_0xb2a1('0x3d')]?_0x48c768['attributes']:_0x36353d[_0xb2a1('0x36')];if(!_0x40033f[_0xb2a1('0x38')]['hasOwnProperty'](_0xb2a1('0x3f'))){_0x48c768['limit']=qs[_0xb2a1('0x1c')](_0x40033f[_0xb2a1('0x38')][_0xb2a1('0x1c')]);_0x48c768[_0xb2a1('0x1b')]=qs[_0xb2a1('0x1b')](_0x40033f[_0xb2a1('0x38')][_0xb2a1('0x1b')]);}_0x48c768[_0xb2a1('0x40')]=qs[_0xb2a1('0x41')](_0x40033f[_0xb2a1('0x38')][_0xb2a1('0x41')]);_0x48c768[_0xb2a1('0x42')]=qs[_0xb2a1('0x39')](_[_0xb2a1('0x43')](_0x40033f[_0xb2a1('0x38')],_0x36353d[_0xb2a1('0x39')]));_0x48c768[_0xb2a1('0x42')][_0xb2a1('0x5c')]=_0x112a2a['id'];if(_0x40033f[_0xb2a1('0x38')][_0xb2a1('0x27')]){_0x48c768[_0xb2a1('0x42')]=_[_0xb2a1('0x44')](_0x48c768[_0xb2a1('0x42')],{'$or':_[_0xb2a1('0x45')](_0x48c768['attributes'],function(_0x289b40){var _0x354e88={};_0x354e88[_0x289b40]={'$like':'%'+_0x40033f[_0xb2a1('0x38')][_0xb2a1('0x27')]+'%'};return _0x354e88;})});}_0x48c768=_['merge']({},_0x48c768,_0x40033f[_0xb2a1('0x47')]);return db[_0xb2a1('0x60')]['count']({'where':_0x48c768[_0xb2a1('0x42')]})[_0xb2a1('0x22')](function(_0x58e244){_0x2bc7c3[_0xb2a1('0x1a')]=_0x58e244;if(_0x40033f['query'][_0xb2a1('0x48')]){_0x48c768['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xb2a1('0x5d')](_0x48c768);})['then'](function(_0x26fee3){_0x2bc7c3[_0xb2a1('0x4a')]=_0x26fee3;return _0x2bc7c3;});}})[_0xb2a1('0x22')](respondWithFilteredResult(_0xb69bf5,_0x48c768))['catch'](handleError(_0xb69bf5,null));};exports[_0xb2a1('0x61')]=function(_0x379f71,_0x39d083,_0x159791){var _0x18f9f3={'raw':!![],'where':{}};var _0x5c742a={};var _0x19606d={'count':0x0,'rows':[]};return db[_0xb2a1('0x34')][_0xb2a1('0x5a')]({'where':{'id':_0x379f71['params']['id']}})[_0xb2a1('0x22')](handleEntityNotFound(_0x39d083,null))[_0xb2a1('0x22')](function(_0x292e88){if(_0x292e88){_0x5c742a[_0xb2a1('0x36')]=_[_0xb2a1('0x37')](db[_0xb2a1('0x62')]['rawAttributes']);_0x5c742a[_0xb2a1('0x38')]=_[_0xb2a1('0x37')](_0x379f71[_0xb2a1('0x38')]);_0x5c742a[_0xb2a1('0x39')]=_[_0xb2a1('0x3a')](_0x5c742a[_0xb2a1('0x36')],_0x5c742a[_0xb2a1('0x38')]);_0x18f9f3[_0xb2a1('0x3c')]=_[_0xb2a1('0x3a')](_0x5c742a['model'],qs[_0xb2a1('0x3b')](_0x379f71['query'][_0xb2a1('0x3b')]));_0x18f9f3[_0xb2a1('0x3c')]=_0x18f9f3[_0xb2a1('0x3c')][_0xb2a1('0x3d')]?_0x18f9f3[_0xb2a1('0x3c')]:_0x5c742a[_0xb2a1('0x36')];if(!_0x379f71[_0xb2a1('0x38')]['hasOwnProperty'](_0xb2a1('0x3f'))){_0x18f9f3['limit']=qs['limit'](_0x379f71['query'][_0xb2a1('0x1c')]);_0x18f9f3[_0xb2a1('0x1b')]=qs['offset'](_0x379f71[_0xb2a1('0x38')][_0xb2a1('0x1b')]);}_0x18f9f3[_0xb2a1('0x40')]=qs[_0xb2a1('0x41')](_0x379f71[_0xb2a1('0x38')][_0xb2a1('0x41')]);_0x18f9f3[_0xb2a1('0x42')]=qs[_0xb2a1('0x39')](_['pick'](_0x379f71['query'],_0x5c742a[_0xb2a1('0x39')]));_0x18f9f3[_0xb2a1('0x42')][_0xb2a1('0x5c')]=_0x292e88['id'];if(_0x379f71[_0xb2a1('0x38')]['filter']){_0x18f9f3['where']=_[_0xb2a1('0x44')](_0x18f9f3['where'],{'$or':_['map'](_0x18f9f3[_0xb2a1('0x3c')],function(_0x35ab0a){var _0x544b68={};_0x544b68[_0x35ab0a]={'$like':'%'+_0x379f71[_0xb2a1('0x38')][_0xb2a1('0x27')]+'%'};return _0x544b68;})});}_0x18f9f3=_[_0xb2a1('0x44')]({},_0x18f9f3,_0x379f71[_0xb2a1('0x47')]);return db['CmHopperBlack'][_0xb2a1('0x1a')]({'where':_0x18f9f3[_0xb2a1('0x42')]})[_0xb2a1('0x22')](function(_0x10b2f0){_0x19606d[_0xb2a1('0x1a')]=_0x10b2f0;if(_0x379f71[_0xb2a1('0x38')][_0xb2a1('0x48')]){_0x18f9f3[_0xb2a1('0x49')]=[{'all':!![]}];}return db[_0xb2a1('0x62')]['findAll'](_0x18f9f3);})['then'](function(_0x4a8e87){_0x19606d[_0xb2a1('0x4a')]=_0x4a8e87;return _0x19606d;});}})[_0xb2a1('0x22')](respondWithFilteredResult(_0x39d083,_0x18f9f3))['catch'](handleError(_0x39d083,null));};exports[_0xb2a1('0x63')]=function(_0x416efb,_0x2f987d,_0x1d9a46){var _0x56796a={};var _0x5abe38={};var _0x27b651;var _0x2bfd2b;return db[_0xb2a1('0x34')]['findOne']({'where':{'id':_0x416efb[_0xb2a1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2f987d,null))[_0xb2a1('0x22')](function(_0x2de9a7){if(_0x2de9a7){_0x27b651=_0x2de9a7;_0x5abe38[_0xb2a1('0x36')]=_['keys'](db[_0xb2a1('0x64')]['rawAttributes']);_0x5abe38[_0xb2a1('0x38')]=_[_0xb2a1('0x37')](_0x416efb[_0xb2a1('0x38')]);_0x5abe38[_0xb2a1('0x39')]=_[_0xb2a1('0x3a')](_0x5abe38[_0xb2a1('0x36')],_0x5abe38[_0xb2a1('0x38')]);_0x56796a[_0xb2a1('0x3c')]=_[_0xb2a1('0x3a')](_0x5abe38['model'],qs['fields'](_0x416efb[_0xb2a1('0x38')][_0xb2a1('0x3b')]));_0x56796a[_0xb2a1('0x3c')]=_0x56796a[_0xb2a1('0x3c')][_0xb2a1('0x3d')]?_0x56796a[_0xb2a1('0x3c')]:_0x5abe38['model'];_0x56796a[_0xb2a1('0x40')]=qs[_0xb2a1('0x41')](_0x416efb['query'][_0xb2a1('0x41')]);_0x56796a['where']=qs[_0xb2a1('0x39')](_[_0xb2a1('0x43')](_0x416efb['query'],_0x5abe38[_0xb2a1('0x39')]));if(_0x416efb[_0xb2a1('0x38')]['filter']){_0x56796a[_0xb2a1('0x42')]=_[_0xb2a1('0x44')](_0x56796a[_0xb2a1('0x42')],{'$or':_[_0xb2a1('0x45')](_0x56796a[_0xb2a1('0x3c')],function(_0x2ed8e3){var _0x3e38d0={};_0x3e38d0[_0x2ed8e3]={'$like':'%'+_0x416efb[_0xb2a1('0x38')]['filter']+'%'};return _0x3e38d0;})});}_0x56796a=_[_0xb2a1('0x44')]({},_0x56796a,_0x416efb[_0xb2a1('0x47')]);return _0x27b651[_0xb2a1('0x63')](_0x56796a);}})['then'](function(_0x3f7531){if(_0x3f7531){_0x2bfd2b=_0x3f7531[_0xb2a1('0x3d')];if(!_0x416efb['query'][_0xb2a1('0x3e')](_0xb2a1('0x3f'))){_0x56796a[_0xb2a1('0x1c')]=qs[_0xb2a1('0x1c')](_0x416efb[_0xb2a1('0x38')][_0xb2a1('0x1c')]);_0x56796a[_0xb2a1('0x1b')]=qs[_0xb2a1('0x1b')](_0x416efb[_0xb2a1('0x38')][_0xb2a1('0x1b')]);}return _0x27b651[_0xb2a1('0x63')](_0x56796a);}})[_0xb2a1('0x22')](function(_0x3ca8dd){if(_0x3ca8dd){return _0x3ca8dd?{'count':_0x2bfd2b,'rows':_0x3ca8dd}:null;}})[_0xb2a1('0x22')](respondWithResult(_0x2f987d,null))['catch'](handleError(_0x2f987d,null));};exports['addTeams']=function(_0xe6b581,_0x33d5cd,_0x7b2102){var _0x2599c3=[];var _0x2148f6;return db[_0xb2a1('0x64')][_0xb2a1('0x5d')]({'where':{'id':_0xe6b581[_0xb2a1('0x4e')][_0xb2a1('0x65')]},'attributes':['id'],'include':[{'model':db[_0xb2a1('0x66')],'as':_0xb2a1('0x67'),'attributes':['id'],'raw':!![]}]})[_0xb2a1('0x22')](function(_0x273016){if(_0x273016){for(var _0x316c2e=0x0;_0x316c2e<_0x273016['length'];_0x316c2e+=0x1){for(var _0x5b98fc=0x0;_0x5b98fc<_0x273016[_0x316c2e][_0xb2a1('0x67')][_0xb2a1('0x3d')];_0x5b98fc+=0x1){_0x2599c3=_[_0xb2a1('0x68')](_0x2599c3,[_0x273016[_0x316c2e][_0xb2a1('0x67')][_0x5b98fc]['id']]);}}return _0x2599c3;}})[_0xb2a1('0x22')](function(_0x56d160){if(_0x56d160){return db[_0xb2a1('0x34')][_0xb2a1('0x2b')]({'where':{'id':_0xe6b581[_0xb2a1('0x4c')]['id']}});}})[_0xb2a1('0x22')](function(_0x3eb302){if(_0x3eb302){_0x2148f6=_0x3eb302;return _0x2148f6[_0xb2a1('0x69')](_0x2599c3,{'penalty':_0xe6b581['body']['penalty']});}})[_0xb2a1('0x22')](function(_0x1349f2){if(_0x1349f2){return _0x2148f6[_0xb2a1('0x6a')](_0xe6b581[_0xb2a1('0x4e')][_0xb2a1('0x65')]);}})[_0xb2a1('0x22')](handleEntityNotFound(_0x33d5cd,null))[_0xb2a1('0x22')](respondWithStatusCode(_0x33d5cd,null))[_0xb2a1('0x4b')](handleError(_0x33d5cd,null));};exports[_0xb2a1('0x6b')]=function(_0x77206c,_0x31b1b7,_0x276898){var _0x16dccb=[];var _0x593f3d;return db[_0xb2a1('0x64')][_0xb2a1('0x5d')]({'where':{'id':_0x77206c['query'][_0xb2a1('0x65')]},'attributes':['id'],'include':[{'model':db[_0xb2a1('0x66')],'as':_0xb2a1('0x67'),'attributes':['id'],'raw':!![]}]})[_0xb2a1('0x22')](function(_0x45b4a3){if(_0x45b4a3){for(var _0x1a477d=0x0;_0x1a477d<_0x45b4a3[_0xb2a1('0x3d')];_0x1a477d+=0x1){for(var _0x4b7d50=0x0;_0x4b7d50<_0x45b4a3[_0x1a477d][_0xb2a1('0x67')][_0xb2a1('0x3d')];_0x4b7d50+=0x1){_0x16dccb=_[_0xb2a1('0x68')](_0x16dccb,[_0x45b4a3[_0x1a477d]['Agents'][_0x4b7d50]['id']]);}}return _0x16dccb;}})[_0xb2a1('0x22')](function(_0x4abb71){if(_0x4abb71){return db[_0xb2a1('0x34')][_0xb2a1('0x2b')]({'where':{'id':_0x77206c[_0xb2a1('0x4c')]['id']}});}})[_0xb2a1('0x22')](function(_0x5a8edb){if(_0x5a8edb){_0x593f3d=_0x5a8edb;return _0x593f3d[_0xb2a1('0x6c')](_0x16dccb);}})[_0xb2a1('0x22')](function(_0x107c95){if(_0x593f3d){return _0x593f3d[_0xb2a1('0x6b')](_0x77206c[_0xb2a1('0x38')][_0xb2a1('0x65')]);}})[_0xb2a1('0x22')](handleEntityNotFound(_0x31b1b7,null))[_0xb2a1('0x22')](respondWithStatusCode(_0x31b1b7,null))[_0xb2a1('0x4b')](handleError(_0x31b1b7,null));};exports[_0xb2a1('0x69')]=function(_0x2458cb,_0x40434c,_0x2d28fe){var _0x3a34ac,_0x59dfd9;return db[_0xb2a1('0x34')][_0xb2a1('0x2b')]({'where':{'id':_0x2458cb[_0xb2a1('0x4c')]['id']}})[_0xb2a1('0x22')](handleEntityNotFound(_0x40434c,null))['then'](function(_0x4d7d79){if(_0x4d7d79){_0x59dfd9=_0x4d7d79;return _0x4d7d79['addAgents'](_0x2458cb['body'][_0xb2a1('0x65')],_[_0xb2a1('0x55')](_0x2458cb[_0xb2a1('0x4e')],[_0xb2a1('0x65'),'id'])||{})[_0xb2a1('0x6d')](function(_0x438f83){for(var _0x280129=0x0;_0x280129<_0x2458cb[_0xb2a1('0x4e')][_0xb2a1('0x65')][_0xb2a1('0x3d')];_0x280129+=0x1){socket[_0xb2a1('0x6e')](_0xb2a1('0x6f'),{'UserId':_0x2458cb[_0xb2a1('0x4e')]['ids'][_0x280129],'VoiceQueueId':_0x2458cb[_0xb2a1('0x4c')]['id']});}return _0x438f83;});}})[_0xb2a1('0x22')](function(_0x297edc){_0x3a34ac=_0x297edc||[];if(_0x59dfd9){return db[_0xb2a1('0x66')][_0xb2a1('0x5d')]({'where':{'id':_0x2458cb[_0xb2a1('0x4e')][_0xb2a1('0x65')]},'attributes':['id','name',_0xb2a1('0x70'),_0xb2a1('0x71'),_0xb2a1('0x72')],'raw':!![]});}})[_0xb2a1('0x22')](function(_0x5935b3){if(_0x5935b3&&_0x5935b3['length']){var _0x1e6d1a=[];for(var _0x5e9b8a=0x0;_0x5e9b8a<_0x5935b3['length'];_0x5e9b8a++){_0x1e6d1a[_0xb2a1('0x73')](db['UserVoiceQueueRt'][_0xb2a1('0x74')]({'membername':_0x5935b3[_0x5e9b8a]['name'],'UserId':_0x5935b3[_0x5e9b8a]['id'],'queue_name':_0x59dfd9['name'],'VoiceQueueId':_0x59dfd9['id'],'interface':_[_0xb2a1('0x75')](_0x5935b3[_0x5e9b8a][_0xb2a1('0x72')])?util['format'](_0xb2a1('0x76'),_0x5935b3[_0x5e9b8a][_0xb2a1('0x2d')]):_0x5935b3[_0x5e9b8a][_0xb2a1('0x72')],'paused':_0x5935b3[_0x5e9b8a][_0xb2a1('0x71')]||![],'penalty':_0x2458cb[_0xb2a1('0x4e')][_0xb2a1('0x77')]||0x0}));}return BPromise[_0xb2a1('0x78')](_0x1e6d1a);}})[_0xb2a1('0x22')](function(_0x26e307){return _0x3a34ac;})[_0xb2a1('0x22')](respondWithResult(_0x40434c,null))[_0xb2a1('0x4b')](handleError(_0x40434c,null));};exports[_0xb2a1('0x6c')]=function(_0x390687,_0x84ba60,_0x78de5e){var _0x2717e5;return db['VoiceQueue'][_0xb2a1('0x2b')]({'where':{'id':_0x390687[_0xb2a1('0x4c')]['id']}})[_0xb2a1('0x22')](handleEntityNotFound(_0x84ba60,null))[_0xb2a1('0x22')](function(_0x1c3857){if(_0x1c3857){return _0x1c3857[_0xb2a1('0x6c')](_0x390687[_0xb2a1('0x38')][_0xb2a1('0x65')])['then'](function(_0x459dbd){if(_[_0xb2a1('0x79')](_0x390687[_0xb2a1('0x38')][_0xb2a1('0x65')])){for(var _0x21439a=0x0;_0x21439a<_0x390687[_0xb2a1('0x38')][_0xb2a1('0x65')]['length'];_0x21439a+=0x1){socket[_0xb2a1('0x6e')](_0xb2a1('0x7a'),{'UserId':_0x390687['query'][_0xb2a1('0x65')][_0x21439a],'VoiceQueueId':_0x390687[_0xb2a1('0x4c')]['id']});}}else{socket[_0xb2a1('0x6e')]('userVoiceQueue:remove',{'UserId':_0x390687[_0xb2a1('0x38')]['ids'],'VoiceQueueId':_0x390687[_0xb2a1('0x4c')]['id']});}});}})[_0xb2a1('0x22')](function(_0x4cda9e){if(_0x390687[_0xb2a1('0x38')][_0xb2a1('0x7b')]){_0x2717e5=_0x4cda9e;return db[_0xb2a1('0x7c')][_0xb2a1('0x2f')]({'where':{'VoiceQueueId':_0x390687['params']['id'],'UserId':_0x390687[_0xb2a1('0x38')][_0xb2a1('0x65')]}})[_0xb2a1('0x22')](function(){return _0x2717e5;});}})[_0xb2a1('0x22')](respondWithStatusCode(_0x84ba60,null))[_0xb2a1('0x4b')](handleError(_0x84ba60,null));};exports[_0xb2a1('0x7d')]=function(_0x3b1981,_0x570f88,_0x3acda1){var _0x21af6e={};var _0x585658={};var _0x189540;var _0x50ebf6;return db['VoiceQueue'][_0xb2a1('0x5a')]({'where':{'id':_0x3b1981[_0xb2a1('0x4c')]['id']}})[_0xb2a1('0x22')](handleEntityNotFound(_0x570f88,null))[_0xb2a1('0x22')](function(_0x45efe2){if(_0x45efe2){_0x189540=_0x45efe2;_0x585658[_0xb2a1('0x36')]=_['keys'](db[_0xb2a1('0x66')]['rawAttributes']);_0x585658[_0xb2a1('0x38')]=_[_0xb2a1('0x37')](_0x3b1981[_0xb2a1('0x38')]);_0x585658[_0xb2a1('0x39')]=_[_0xb2a1('0x3a')](_0x585658[_0xb2a1('0x36')],_0x585658[_0xb2a1('0x38')]);_0x21af6e[_0xb2a1('0x3c')]=_['intersection'](_0x585658[_0xb2a1('0x36')],qs[_0xb2a1('0x3b')](_0x3b1981['query'][_0xb2a1('0x3b')]));_0x21af6e[_0xb2a1('0x3c')]=_0x21af6e[_0xb2a1('0x3c')][_0xb2a1('0x3d')]?_0x21af6e[_0xb2a1('0x3c')]:_0x585658['model'];_0x21af6e[_0xb2a1('0x40')]=qs[_0xb2a1('0x41')](_0x3b1981[_0xb2a1('0x38')][_0xb2a1('0x41')]);_0x21af6e[_0xb2a1('0x42')]=qs[_0xb2a1('0x39')](_[_0xb2a1('0x43')](_0x3b1981[_0xb2a1('0x38')],_0x585658[_0xb2a1('0x39')]));if(_0x3b1981['query'][_0xb2a1('0x27')]){_0x21af6e['where']=_[_0xb2a1('0x44')](_0x21af6e[_0xb2a1('0x42')],{'$or':_[_0xb2a1('0x45')](_0x21af6e[_0xb2a1('0x3c')],function(_0x5e92ea){var _0x32594c={};_0x32594c[_0x5e92ea]={'$like':'%'+_0x3b1981[_0xb2a1('0x38')][_0xb2a1('0x27')]+'%'};return _0x32594c;})});}_0x21af6e=_[_0xb2a1('0x44')]({},_0x21af6e,_0x3b1981[_0xb2a1('0x47')]);return _0x189540[_0xb2a1('0x7d')](_0x21af6e);}})[_0xb2a1('0x22')](function(_0x393ed5){if(_0x393ed5){_0x50ebf6=_0x393ed5[_0xb2a1('0x3d')];if(!_0x3b1981['query'][_0xb2a1('0x3e')](_0xb2a1('0x3f'))){_0x21af6e[_0xb2a1('0x1c')]=qs['limit'](_0x3b1981[_0xb2a1('0x38')]['limit']);_0x21af6e[_0xb2a1('0x1b')]=qs[_0xb2a1('0x1b')](_0x3b1981[_0xb2a1('0x38')][_0xb2a1('0x1b')]);}return _0x189540['getAgents'](_0x21af6e);}})[_0xb2a1('0x22')](function(_0x37fdb0){if(_0x37fdb0){return _0x37fdb0?{'count':_0x50ebf6,'rows':_0x37fdb0}:null;}})[_0xb2a1('0x22')](respondWithResult(_0x570f88,null))['catch'](handleError(_0x570f88,null));};exports[_0xb2a1('0x7e')]=function(_0x5d9069,_0x50ff26,_0x2e16be){var _0x107297={};var _0x42aaf1={};var _0x2bb194;var _0x1da856;return db['VoiceQueue'][_0xb2a1('0x5a')]({'where':{'id':_0x5d9069[_0xb2a1('0x4c')]['id']}})[_0xb2a1('0x22')](handleEntityNotFound(_0x50ff26,null))[_0xb2a1('0x22')](function(_0x40497e){if(_0x40497e){_0x2bb194=_0x40497e;_0x42aaf1[_0xb2a1('0x36')]=_[_0xb2a1('0x37')](db[_0xb2a1('0x7c')][_0xb2a1('0x35')]);_0x42aaf1[_0xb2a1('0x38')]=_[_0xb2a1('0x37')](_0x5d9069[_0xb2a1('0x38')]);_0x42aaf1[_0xb2a1('0x39')]=_['intersection'](_0x42aaf1['model'],_0x42aaf1['query']);_0x107297[_0xb2a1('0x3c')]=_[_0xb2a1('0x3a')](_0x42aaf1[_0xb2a1('0x36')],qs['fields'](_0x5d9069[_0xb2a1('0x38')][_0xb2a1('0x3b')]));_0x107297[_0xb2a1('0x3c')]=_0x107297[_0xb2a1('0x3c')][_0xb2a1('0x3d')]?_0x107297[_0xb2a1('0x3c')]:_0x42aaf1[_0xb2a1('0x36')];_0x107297[_0xb2a1('0x40')]=qs[_0xb2a1('0x41')](_0x5d9069[_0xb2a1('0x38')][_0xb2a1('0x41')]);_0x107297[_0xb2a1('0x42')]=qs['filters'](_[_0xb2a1('0x43')](_0x5d9069['query'],_0x42aaf1[_0xb2a1('0x39')]));if(_0x5d9069[_0xb2a1('0x38')][_0xb2a1('0x27')]){_0x107297[_0xb2a1('0x42')]=_[_0xb2a1('0x44')](_0x107297['where'],{'$or':_[_0xb2a1('0x45')](_0x107297['attributes'],function(_0x5b959d){var _0x6bba07={};_0x6bba07[_0x5b959d]={'$like':'%'+_0x5d9069[_0xb2a1('0x38')][_0xb2a1('0x27')]+'%'};return _0x6bba07;})});}_0x107297=_[_0xb2a1('0x44')]({},_0x107297,_0x5d9069[_0xb2a1('0x47')]);return _0x2bb194['getMembers'](_0x107297);}})['then'](function(_0x50d96a){if(_0x50d96a){_0x1da856=_0x50d96a[_0xb2a1('0x3d')];if(!_0x5d9069[_0xb2a1('0x38')][_0xb2a1('0x3e')](_0xb2a1('0x3f'))){_0x107297[_0xb2a1('0x1c')]=qs[_0xb2a1('0x1c')](_0x5d9069[_0xb2a1('0x38')][_0xb2a1('0x1c')]);_0x107297[_0xb2a1('0x1b')]=qs[_0xb2a1('0x1b')](_0x5d9069[_0xb2a1('0x38')]['offset']);}return _0x2bb194[_0xb2a1('0x7e')](_0x107297);}})[_0xb2a1('0x22')](function(_0x1f0bd3){return _0x1f0bd3?{'count':_0x1da856,'rows':_0x1f0bd3}:null;})[_0xb2a1('0x22')](respondWithResult(_0x50ff26,null))['catch'](handleError(_0x50ff26,null));};exports['getLists']=function(_0x4e4801,_0x265804,_0x25da2a){var _0x392711={};var _0x54689e={};var _0x27f3eb;var _0x39e4f4;return db[_0xb2a1('0x34')][_0xb2a1('0x5a')]({'where':{'id':_0x4e4801[_0xb2a1('0x4c')]['id']}})[_0xb2a1('0x22')](handleEntityNotFound(_0x265804,null))[_0xb2a1('0x22')](function(_0xee4ec2){if(_0xee4ec2){_0x27f3eb=_0xee4ec2;_0x54689e[_0xb2a1('0x36')]=_['keys'](db[_0xb2a1('0x7f')]['rawAttributes']);_0x54689e[_0xb2a1('0x38')]=_[_0xb2a1('0x37')](_0x4e4801[_0xb2a1('0x38')]);_0x54689e[_0xb2a1('0x39')]=_[_0xb2a1('0x3a')](_0x54689e[_0xb2a1('0x36')],_0x54689e[_0xb2a1('0x38')]);_0x392711[_0xb2a1('0x3c')]=_[_0xb2a1('0x3a')](_0x54689e['model'],qs[_0xb2a1('0x3b')](_0x4e4801[_0xb2a1('0x38')][_0xb2a1('0x3b')]));_0x392711[_0xb2a1('0x3c')]=_0x392711[_0xb2a1('0x3c')][_0xb2a1('0x3d')]?_0x392711[_0xb2a1('0x3c')]:_0x54689e['model'];_0x392711['order']=qs[_0xb2a1('0x41')](_0x4e4801[_0xb2a1('0x38')][_0xb2a1('0x41')]);_0x392711['where']=qs[_0xb2a1('0x39')](_['pick'](_0x4e4801[_0xb2a1('0x38')],_0x54689e[_0xb2a1('0x39')]));if(_0x4e4801[_0xb2a1('0x38')][_0xb2a1('0x27')]){_0x392711[_0xb2a1('0x42')]=_[_0xb2a1('0x44')](_0x392711['where'],{'$or':_[_0xb2a1('0x45')](_0x392711[_0xb2a1('0x3c')],function(_0x4583a1){var _0xa1086e={};_0xa1086e[_0x4583a1]={'$like':'%'+_0x4e4801[_0xb2a1('0x38')][_0xb2a1('0x27')]+'%'};return _0xa1086e;})});}_0x392711=_[_0xb2a1('0x44')]({},_0x392711,_0x4e4801[_0xb2a1('0x47')]);return _0x27f3eb[_0xb2a1('0x80')](_0x392711);}})[_0xb2a1('0x22')](function(_0x44bf51){if(_0x44bf51){_0x39e4f4=_0x44bf51['length'];if(!_0x4e4801['query'][_0xb2a1('0x3e')]('nolimit')){_0x392711[_0xb2a1('0x1c')]=qs[_0xb2a1('0x1c')](_0x4e4801[_0xb2a1('0x38')][_0xb2a1('0x1c')]);_0x392711[_0xb2a1('0x1b')]=qs[_0xb2a1('0x1b')](_0x4e4801[_0xb2a1('0x38')][_0xb2a1('0x1b')]);}return _0x27f3eb[_0xb2a1('0x80')](_0x392711);}})['then'](function(_0x5d24f2){if(_0x5d24f2){return _0x5d24f2?{'count':_0x39e4f4,'rows':_0x5d24f2}:null;}})['then'](respondWithResult(_0x265804,null))[_0xb2a1('0x4b')](handleError(_0x265804,null));};exports[_0xb2a1('0x81')]=function(_0x46cc63,_0x2a728b,_0x2e4c43){var _0x53830d,_0x3df45d;return db[_0xb2a1('0x34')]['find']({'where':{'id':_0x46cc63['params']['id']}})[_0xb2a1('0x22')](handleEntityNotFound(_0x2a728b,null))[_0xb2a1('0x22')](function(_0x40c1b9){if(_0x40c1b9){_0x3df45d=_0x40c1b9;return _0x40c1b9[_0xb2a1('0x81')](_0x46cc63[_0xb2a1('0x4e')][_0xb2a1('0x65')],_[_0xb2a1('0x55')](_0x46cc63['body'],[_0xb2a1('0x65'),'id'])||{});}return null;})[_0xb2a1('0x6d')](function(_0x435c62){var _0x57fcc9;_0x53830d=_0x435c62||[];var _0x548ed9=[];if(_0x435c62){for(var _0x266c5f=0x0;_0x266c5f<_0x435c62[_0xb2a1('0x3d')];_0x266c5f+=0x1){var _0x4b2d15=_0x435c62[_0x266c5f][_0xb2a1('0x50')]({'plain':!![]});_0x3df45d['dialCheckDuplicateType']=_0x46cc63[_0xb2a1('0x4e')][_0xb2a1('0x82')]?_0x46cc63[_0xb2a1('0x4e')][_0xb2a1('0x82')]:_0x3df45d[_0xb2a1('0x82')];switch(_0x3df45d[_0xb2a1('0x82')]){case _0xb2a1('0x83'):_0x57fcc9=squel['insert']()[_0xb2a1('0x84')](_0xb2a1('0x85'))[_0xb2a1('0x86')]([_0xb2a1('0x87'),_0xb2a1('0x88'),'ContactId',_0xb2a1('0x89'),_0xb2a1('0x5c'),_0xb2a1('0x56'),'updatedAt'],squel['select']()['field']('phone',_0xb2a1('0x87'))['field']('NOW()',_0xb2a1('0x88'))[_0xb2a1('0x8a')]('id',_0xb2a1('0x8b'))[_0xb2a1('0x8a')](_0x4b2d15['CmListId'][_0xb2a1('0x8c')](),_0xb2a1('0x89'))[_0xb2a1('0x8a')](_0x46cc63[_0xb2a1('0x4c')]['id'][_0xb2a1('0x8c')](),'VoiceQueueId')[_0xb2a1('0x8a')]('NOW()',_0xb2a1('0x56'))['field'](_0xb2a1('0x8d'),_0xb2a1('0x57'))[_0xb2a1('0x8e')]('cm_contacts')[_0xb2a1('0x42')](_0xb2a1('0x8f'))[_0xb2a1('0x42')](_0xb2a1('0x90'),_0x4b2d15['CmListId'][_0xb2a1('0x8c')]())['where'](_0xb2a1('0x91'))[_0xb2a1('0x42')](_0xb2a1('0x92'),squel[_0xb2a1('0x93')]()[_0xb2a1('0x8a')](_0xb2a1('0x94'))[_0xb2a1('0x8e')](_0xb2a1('0x95'))['where'](_0xb2a1('0x96'),_0x46cc63[_0xb2a1('0x4c')]['id']['toString']()))[_0xb2a1('0x42')](_0xb2a1('0x92'),squel[_0xb2a1('0x93')]()[_0xb2a1('0x8a')](_0xb2a1('0x87'))[_0xb2a1('0x8e')](_0xb2a1('0x85'))[_0xb2a1('0x42')](_0xb2a1('0x96'),_0x46cc63[_0xb2a1('0x4c')]['id'][_0xb2a1('0x8c')]())))[_0xb2a1('0x8c')]();break;case _0xb2a1('0x97'):_0x57fcc9=squel[_0xb2a1('0x98')]()['into'](_0xb2a1('0x85'))[_0xb2a1('0x86')](['phone',_0xb2a1('0x88'),_0xb2a1('0x8b'),_0xb2a1('0x89'),_0xb2a1('0x5c'),_0xb2a1('0x56'),_0xb2a1('0x57')],squel[_0xb2a1('0x93')]()[_0xb2a1('0x8a')]('phone',_0xb2a1('0x87'))[_0xb2a1('0x8a')](_0xb2a1('0x8d'),_0xb2a1('0x88'))[_0xb2a1('0x8a')]('id',_0xb2a1('0x8b'))['field'](_0x4b2d15[_0xb2a1('0x99')][_0xb2a1('0x8c')](),_0xb2a1('0x89'))[_0xb2a1('0x8a')](_0x46cc63['params']['id'][_0xb2a1('0x8c')](),_0xb2a1('0x5c'))['field'](_0xb2a1('0x8d'),_0xb2a1('0x56'))[_0xb2a1('0x8a')]('NOW()',_0xb2a1('0x57'))['from'](_0xb2a1('0x9a'))[_0xb2a1('0x42')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x4b2d15[_0xb2a1('0x99')][_0xb2a1('0x8c')]())[_0xb2a1('0x42')](_0xb2a1('0x91'))[_0xb2a1('0x42')](_0xb2a1('0x92'),squel['select']()[_0xb2a1('0x8a')](_0xb2a1('0x87'))[_0xb2a1('0x8e')](_0xb2a1('0x85'))[_0xb2a1('0x42')]('VoiceQueueId\x20=\x20?',_0x46cc63['params']['id'][_0xb2a1('0x8c')]())))[_0xb2a1('0x8c')]();break;default:_0x57fcc9=squel[_0xb2a1('0x98')]()[_0xb2a1('0x84')](_0xb2a1('0x85'))[_0xb2a1('0x86')](['phone',_0xb2a1('0x88'),_0xb2a1('0x8b'),_0xb2a1('0x89'),_0xb2a1('0x5c'),'createdAt',_0xb2a1('0x57')],squel[_0xb2a1('0x93')]()[_0xb2a1('0x8a')](_0xb2a1('0x87'),_0xb2a1('0x87'))[_0xb2a1('0x8a')](_0xb2a1('0x8d'),_0xb2a1('0x88'))['field']('id','ContactId')[_0xb2a1('0x8a')](_0x4b2d15[_0xb2a1('0x99')][_0xb2a1('0x8c')](),_0xb2a1('0x89'))[_0xb2a1('0x8a')](_0x46cc63[_0xb2a1('0x4c')]['id']['toString'](),_0xb2a1('0x5c'))[_0xb2a1('0x8a')](_0xb2a1('0x8d'),_0xb2a1('0x56'))['field'](_0xb2a1('0x8d'),_0xb2a1('0x57'))[_0xb2a1('0x8e')]('cm_contacts')[_0xb2a1('0x42')](_0xb2a1('0x8f'))[_0xb2a1('0x42')]('ListId\x20=\x20?',_0x4b2d15['CmListId'][_0xb2a1('0x8c')]())[_0xb2a1('0x42')](_0xb2a1('0x91')))[_0xb2a1('0x8c')]();}_0x548ed9['push'](db[_0xb2a1('0x9b')][_0xb2a1('0x38')](_0x57fcc9));}return BPromise[_0xb2a1('0x78')](_0x548ed9);}})[_0xb2a1('0x22')](function(){return _0x53830d;})['then'](respondWithResult(_0x2a728b,null))['catch'](handleError(_0x2a728b,null));};exports['removeLists']=function(_0x24d53d,_0x17f987,_0x4711fa){var _0x517e59;return db[_0xb2a1('0x34')]['find']({'where':{'id':_0x24d53d[_0xb2a1('0x4c')]['id']}})[_0xb2a1('0x22')](handleEntityNotFound(_0x17f987,null))[_0xb2a1('0x22')](function(_0x5572b2){if(_0x5572b2){return _0x5572b2['removeLists'](_0x24d53d[_0xb2a1('0x38')][_0xb2a1('0x65')]);}})[_0xb2a1('0x22')](function(_0x4dbc74){if(_0x4dbc74){_0x517e59=_0x4dbc74;return db[_0xb2a1('0x5b')][_0xb2a1('0x2f')]({'where':{'ListId':_0x24d53d[_0xb2a1('0x38')][_0xb2a1('0x65')],'VoiceQueueId':_0x24d53d['params']['id']}})['then'](function(){return _0x517e59;});}})['then'](respondWithStatusCode(_0x17f987,null))['catch'](handleError(_0x17f987,null));};exports[_0xb2a1('0x9c')]=function(_0x2e3373,_0x443ec4,_0x17c581){var _0x47e081={};var _0x4ab804={};var _0x38255d;var _0x19a6d1;return db['VoiceQueue'][_0xb2a1('0x5a')]({'where':{'id':_0x2e3373['params']['id']}})[_0xb2a1('0x22')](handleEntityNotFound(_0x443ec4,null))[_0xb2a1('0x22')](function(_0x1a41d2){if(_0x1a41d2){_0x38255d=_0x1a41d2;_0x4ab804[_0xb2a1('0x36')]=_[_0xb2a1('0x37')](db['CmList'][_0xb2a1('0x35')]);_0x4ab804[_0xb2a1('0x38')]=_[_0xb2a1('0x37')](_0x2e3373[_0xb2a1('0x38')]);_0x4ab804['filters']=_[_0xb2a1('0x3a')](_0x4ab804[_0xb2a1('0x36')],_0x4ab804['query']);_0x47e081[_0xb2a1('0x3c')]=_['intersection'](_0x4ab804[_0xb2a1('0x36')],qs[_0xb2a1('0x3b')](_0x2e3373['query'][_0xb2a1('0x3b')]));_0x47e081[_0xb2a1('0x3c')]=_0x47e081[_0xb2a1('0x3c')]['length']?_0x47e081[_0xb2a1('0x3c')]:_0x4ab804[_0xb2a1('0x36')];_0x47e081[_0xb2a1('0x40')]=qs['sort'](_0x2e3373[_0xb2a1('0x38')][_0xb2a1('0x41')]);_0x47e081[_0xb2a1('0x42')]=qs['filters'](_[_0xb2a1('0x43')](_0x2e3373[_0xb2a1('0x38')],_0x4ab804[_0xb2a1('0x39')]));if(_0x2e3373[_0xb2a1('0x38')][_0xb2a1('0x27')]){_0x47e081['where']=_[_0xb2a1('0x44')](_0x47e081[_0xb2a1('0x42')],{'$or':_[_0xb2a1('0x45')](_0x47e081[_0xb2a1('0x3c')],function(_0x2667b0){var _0x59ba7e={};_0x59ba7e[_0x2667b0]={'$like':'%'+_0x2e3373['query'][_0xb2a1('0x27')]+'%'};return _0x59ba7e;})});}_0x47e081=_[_0xb2a1('0x44')]({},_0x47e081,_0x2e3373['options']);return _0x38255d[_0xb2a1('0x9c')](_0x47e081);}})['then'](function(_0x1a6c44){if(_0x1a6c44){_0x19a6d1=_0x1a6c44['length'];if(!_0x2e3373[_0xb2a1('0x38')][_0xb2a1('0x3e')]('nolimit')){_0x47e081[_0xb2a1('0x1c')]=qs['limit'](_0x2e3373['query'][_0xb2a1('0x1c')]);_0x47e081[_0xb2a1('0x1b')]=qs[_0xb2a1('0x1b')](_0x2e3373[_0xb2a1('0x38')][_0xb2a1('0x1b')]);}return _0x38255d[_0xb2a1('0x9c')](_0x47e081);}})[_0xb2a1('0x22')](function(_0x4cda26){if(_0x4cda26){return _0x4cda26?{'count':_0x19a6d1,'rows':_0x4cda26}:null;}})[_0xb2a1('0x22')](respondWithResult(_0x443ec4,null))[_0xb2a1('0x4b')](handleError(_0x443ec4,null));};exports[_0xb2a1('0x9d')]=function(_0x2d05f4,_0xc24302,_0x3b3bae){var _0x518b0f,_0x3f420b;return db[_0xb2a1('0x34')]['find']({'where':{'id':_0x2d05f4['params']['id']}})[_0xb2a1('0x22')](handleEntityNotFound(_0xc24302,null))[_0xb2a1('0x22')](function(_0x2041e3){if(_0x2041e3){_0x3f420b=_0x2041e3;return _0x2041e3[_0xb2a1('0x9d')](_0x2d05f4[_0xb2a1('0x4e')][_0xb2a1('0x65')],_[_0xb2a1('0x55')](_0x2d05f4['body'],[_0xb2a1('0x65'),'id'])||{});}return null;})[_0xb2a1('0x6d')](function(_0x518491){var _0x274f09;_0x518b0f=_0x518491||[];var _0x41a956=[];if(_0x518491){for(var _0x3c0f63=0x0;_0x3c0f63<_0x518491['length'];_0x3c0f63+=0x1){var _0x988f87=_0x518491[_0x3c0f63][_0xb2a1('0x50')]({'plain':!![]});_0x274f09=squel[_0xb2a1('0x98')]()['into']('cm_hopper_black')['fromQuery']([_0xb2a1('0x87'),'ContactId',_0xb2a1('0x89'),'VoiceQueueId',_0xb2a1('0x56'),'updatedAt'],squel['select']()[_0xb2a1('0x8a')](_0xb2a1('0x87'),_0xb2a1('0x87'))[_0xb2a1('0x8a')]('id',_0xb2a1('0x8b'))[_0xb2a1('0x8a')](_0x988f87[_0xb2a1('0x99')][_0xb2a1('0x8c')](),_0xb2a1('0x89'))[_0xb2a1('0x8a')](_0x2d05f4[_0xb2a1('0x4c')]['id'][_0xb2a1('0x8c')](),'VoiceQueueId')['field'](_0xb2a1('0x8d'),_0xb2a1('0x56'))[_0xb2a1('0x8a')](_0xb2a1('0x8d'),'updatedAt')[_0xb2a1('0x8e')](_0xb2a1('0x9a'))[_0xb2a1('0x42')](_0xb2a1('0x8f'))[_0xb2a1('0x42')](_0xb2a1('0x90'),_0x988f87[_0xb2a1('0x99')][_0xb2a1('0x8c')]())[_0xb2a1('0x42')](_0xb2a1('0x91')))[_0xb2a1('0x8c')]();_0x41a956[_0xb2a1('0x73')](db[_0xb2a1('0x9b')][_0xb2a1('0x38')](_0x274f09));}return BPromise[_0xb2a1('0x78')](_0x41a956);}})[_0xb2a1('0x22')](function(){return _0x518b0f;})[_0xb2a1('0x22')](respondWithResult(_0xc24302,null))[_0xb2a1('0x4b')](handleError(_0xc24302,null));};exports[_0xb2a1('0x9e')]=function(_0x3923cc,_0x203f50,_0x413305){var _0x263936;return db['VoiceQueue'][_0xb2a1('0x2b')]({'where':{'id':_0x3923cc[_0xb2a1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x203f50,null))[_0xb2a1('0x22')](function(_0xe57288){if(_0xe57288){return _0xe57288[_0xb2a1('0x9e')](_0x3923cc[_0xb2a1('0x38')]['ids']);}})[_0xb2a1('0x22')](function(_0x3406aa){if(_0x3406aa){_0x263936=_0x3406aa;return db[_0xb2a1('0x62')][_0xb2a1('0x2f')]({'where':{'ListId':_0x3923cc[_0xb2a1('0x38')][_0xb2a1('0x65')],'VoiceQueueId':_0x3923cc[_0xb2a1('0x4c')]['id']}})[_0xb2a1('0x22')](function(){return _0x263936;});}})['then'](respondWithStatusCode(_0x203f50,null))[_0xb2a1('0x4b')](handleError(_0x203f50,null));};
\ No newline at end of file
index 0317774..39dd07e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6b7b=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoiceQueue'];(function(_0x228641,_0x25d636){var _0x5d5d78=function(_0x4d5c6c){while(--_0x4d5c6c){_0x228641['push'](_0x228641['shift']());}};_0x5d5d78(++_0x25d636);}(_0x6b7b,0xe7));var _0xb6b7=function(_0x32efa2,_0x57e59b){_0x32efa2=_0x32efa2-0x0;var _0x2d603d=_0x6b7b[_0x32efa2];return _0x2d603d;};'use strict';var EventEmitter=require(_0xb6b7('0x0'));var VoiceQueue=require(_0xb6b7('0x1'))['db'][_0xb6b7('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xb6b7('0x3')](0x0);var events={'afterCreate':_0xb6b7('0x4'),'afterUpdate':'update','afterDestroy':_0xb6b7('0x5')};function emitEvent(_0x53d507){return function(_0x35db2d,_0x43a736,_0x12a5cc){VoiceQueueEvents[_0xb6b7('0x6')](_0x53d507+':'+_0x35db2d['id'],_0x35db2d);VoiceQueueEvents[_0xb6b7('0x6')](_0x53d507,_0x35db2d);_0x12a5cc(null);};}for(var e in events){if(events[_0xb6b7('0x7')](e)){var event=events[e];VoiceQueue[_0xb6b7('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents;
\ No newline at end of file
+var _0xaec6=['hook','events','../../mysqldb','VoiceQueue','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x44b3e2,_0x4df17f){var _0x32b21e=function(_0x178bc5){while(--_0x178bc5){_0x44b3e2['push'](_0x44b3e2['shift']());}};_0x32b21e(++_0x4df17f);}(_0xaec6,0x172));var _0x6aec=function(_0x18cc0c,_0x1a0e73){_0x18cc0c=_0x18cc0c-0x0;var _0x5d1dfe=_0xaec6[_0x18cc0c];return _0x5d1dfe;};'use strict';var EventEmitter=require(_0x6aec('0x0'));var VoiceQueue=require(_0x6aec('0x1'))['db'][_0x6aec('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x6aec('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6aec('0x4'),'afterDestroy':_0x6aec('0x5')};function emitEvent(_0x28bf73){return function(_0x46f81d,_0x456fca,_0x32772f){VoiceQueueEvents[_0x6aec('0x6')](_0x28bf73+':'+_0x46f81d['id'],_0x46f81d);VoiceQueueEvents[_0x6aec('0x6')](_0x28bf73,_0x46f81d);_0x32772f(null);};}for(var e in events){if(events[_0x6aec('0x7')](e)){var event=events[e];VoiceQueue[_0x6aec('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents;
\ No newline at end of file
index dc25682..cf118e2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3006=['util','../../config/logger','request-promise','./voiceQueue.attributes','define','VoiceQueue','voice_queues','lodash'];(function(_0x5d37dc,_0x5af6c5){var _0x25dc61=function(_0x268a0b){while(--_0x268a0b){_0x5d37dc['push'](_0x5d37dc['shift']());}};_0x25dc61(++_0x5af6c5);}(_0x3006,0xd7));var _0x6300=function(_0x1a7522,_0x4f3c03){_0x1a7522=_0x1a7522-0x0;var _0x4580dc=_0x3006[_0x1a7522];return _0x4580dc;};'use strict';var _=require(_0x6300('0x0'));var util=require(_0x6300('0x1'));var logger=require(_0x6300('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6300('0x3'));var attributes=require(_0x6300('0x4'));module['exports']=function(_0x37b96d,_0x3e6108){return _0x37b96d[_0x6300('0x5')](_0x6300('0x6'),attributes,{'tableName':_0x6300('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xc872=['api','moment','request-promise','exports','VoiceQueue','voice_queues','lodash','util'];(function(_0x44de89,_0x47ee30){var _0x4821b4=function(_0x1122af){while(--_0x1122af){_0x44de89['push'](_0x44de89['shift']());}};_0x4821b4(++_0x47ee30);}(_0xc872,0x8e));var _0x2c87=function(_0x19efbc,_0x10b7d7){_0x19efbc=_0x19efbc-0x0;var _0x205c5e=_0xc872[_0x19efbc];return _0x205c5e;};'use strict';var _=require(_0x2c87('0x0'));var util=require(_0x2c87('0x1'));var logger=require('../../config/logger')(_0x2c87('0x2'));var moment=require(_0x2c87('0x3'));var BPromise=require('bluebird');var rp=require(_0x2c87('0x4'));var attributes=require('./voiceQueue.attributes');module[_0x2c87('0x5')]=function(_0x318b57,_0xdaf048){return _0x318b57['define'](_0x2c87('0x6'),attributes,{'tableName':_0x2c87('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 44ac5f2..fc7009c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['register','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowVoiceQueue','VoiceQueue','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter'];(function(_0x549987,_0x1f5fe7){var _0x2535f7=function(_0x4fb5c7){while(--_0x4fb5c7){_0x549987['push'](_0x549987['shift']());}};_0x2535f7(++_0x1f5fe7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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});config[_0x0a9e('0xa')]=_[_0x0a9e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xc'))(new Redis(config['redis']));require('./voiceQueue.socket')[_0x0a9e('0xd')](socket);function respondWithRpcPromise(_0xf81284,_0x307b3e,_0x3ab53f){return new BPromise(function(_0xfeb75b,_0xbd1168){return client['request'](_0xf81284,_0x3ab53f)['then'](function(_0x527cdd){logger['info'](_0x0a9e('0xe'),_0x307b3e,_0x0a9e('0xf'));logger[_0x0a9e('0x10')](_0x0a9e('0x11'),_0x307b3e,_0x0a9e('0xf'),JSON[_0x0a9e('0x12')](_0x527cdd));if(_0x527cdd['error']){if(_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x14')]===0x1f4){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x15')]);return _0xbd1168(_0x527cdd['error'][_0x0a9e('0x15')]);}logger['error'](_0x0a9e('0xe'),_0x307b3e,_0x527cdd['error'][_0x0a9e('0x15')]);return _0xfeb75b(_0x527cdd[_0x0a9e('0x13')]['message']);}else{logger[_0x0a9e('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x307b3e,_0x0a9e('0xf'));_0xfeb75b(_0x527cdd[_0x0a9e('0x17')][_0x0a9e('0x15')]);}})[_0x0a9e('0x18')](function(_0x31b1ca){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x31b1ca);_0xbd1168(_0x31b1ca);});});}exports[_0x0a9e('0x19')]=function(_0x1314ae){var _0x112016=this;return new Promise(function(_0x1c696a,_0x105080){return db['VoiceQueue'][_0x0a9e('0x1a')]({'raw':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae['options'][_0x0a9e('0x1c')]===undefined?!![]:![]:!![],'where':_0x1314ae['options']?_0x1314ae['options'][_0x0a9e('0x1d')]||null:null,'attributes':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1e')]||null:null,'limit':_0x1314ae['options']?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1f')]||null:null,'include':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x1314ae[_0x0a9e('0x1b')]['include'],function(_0x59181e){return{'model':db[_0x59181e[_0x0a9e('0x22')]],'as':_0x59181e['as'],'attributes':_0x59181e[_0x0a9e('0x1e')],'include':_0x59181e[_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x59181e['include'],function(_0x384319){return{'model':db[_0x384319['model']],'as':_0x384319['as'],'attributes':_0x384319[_0x0a9e('0x1e')],'include':_0x384319['include']?_[_0x0a9e('0x21')](_0x384319[_0x0a9e('0x20')],function(_0x25fba9){return{'model':db[_0x25fba9[_0x0a9e('0x22')]],'as':_0x25fba9['as'],'attributes':_0x25fba9[_0x0a9e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x11c3b6){logger[_0x0a9e('0x16')]('GetVoiceQueue',_0x1314ae);logger[_0x0a9e('0x10')](_0x0a9e('0x19'),_0x1314ae,JSON[_0x0a9e('0x12')](_0x11c3b6));_0x1c696a(_0x11c3b6);})[_0x0a9e('0x18')](function(_0x5c877d){logger[_0x0a9e('0x13')](_0x0a9e('0x19'),_0x5c877d[_0x0a9e('0x15')],_0x1314ae);_0x105080(_0x112016[_0x0a9e('0x13')](0x1f4,_0x5c877d[_0x0a9e('0x15')]));});});};exports[_0x0a9e('0x24')]=function(_0x296f41){var _0x2e8759=this;return new Promise(function(_0x1dbde2,_0x540530){return db[_0x0a9e('0x25')]['find']({'raw':_0x296f41[_0x0a9e('0x1b')]?_0x296f41[_0x0a9e('0x1b')][_0x0a9e('0x1c')]===undefined?!![]:![]:!![],'where':_0x296f41[_0x0a9e('0x1b')]?_0x296f41[_0x0a9e('0x1b')]['where']||null:null,'attributes':_0x296f41[_0x0a9e('0x1b')]?_0x296f41[_0x0a9e('0x1b')][_0x0a9e('0x1e')]||null:null,'include':_0x296f41[_0x0a9e('0x1b')]?_0x296f41[_0x0a9e('0x1b')][_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x296f41[_0x0a9e('0x1b')]['include'],function(_0x44295a){return{'model':db[_0x44295a['model']],'as':_0x44295a['as'],'attributes':_0x44295a[_0x0a9e('0x1e')],'include':_0x44295a[_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x44295a[_0x0a9e('0x20')],function(_0x567193){return{'model':db[_0x567193[_0x0a9e('0x22')]],'as':_0x567193['as'],'attributes':_0x567193[_0x0a9e('0x1e')],'include':_0x567193[_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x567193['include'],function(_0x54135e){return{'model':db[_0x54135e[_0x0a9e('0x22')]],'as':_0x54135e['as'],'attributes':_0x54135e['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x3d9717){logger[_0x0a9e('0x16')](_0x0a9e('0x24'),_0x296f41);logger['debug'](_0x0a9e('0x24'),_0x296f41,JSON[_0x0a9e('0x12')](_0x3d9717));_0x1dbde2(_0x3d9717);})[_0x0a9e('0x18')](function(_0x533942){logger[_0x0a9e('0x13')](_0x0a9e('0x24'),_0x533942[_0x0a9e('0x15')],_0x296f41);_0x540530(_0x2e8759['error'](0x1f4,_0x533942['message']));});});};
\ No newline at end of file
+var _0x9957=['register','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','options','raw','where','attributes','limit','include','model','map','catch','GetVoiceQueue','ShowVoiceQueue','VoiceQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket'];(function(_0x40359a,_0xcb63b){var _0x5efc0c=function(_0x3517df){while(--_0x3517df){_0x40359a['push'](_0x40359a['shift']());}};_0x5efc0c(++_0xcb63b);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});config[_0x7995('0xc')]=_[_0x7995('0xd')](config['redis'],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require(_0x7995('0xf'))(new Redis(config['redis']));require(_0x7995('0x10'))[_0x7995('0x11')](socket);function respondWithRpcPromise(_0x18c8a3,_0x35b5fe,_0x3c1d19){return new BPromise(function(_0x1e400a,_0x341672){return client['request'](_0x18c8a3,_0x3c1d19)[_0x7995('0x12')](function(_0x41c652){logger['info'](_0x7995('0x13'),_0x35b5fe,_0x7995('0x14'));logger[_0x7995('0x15')](_0x7995('0x16'),_0x35b5fe,_0x7995('0x14'),JSON[_0x7995('0x17')](_0x41c652));if(_0x41c652[_0x7995('0x18')]){if(_0x41c652['error']['code']===0x1f4){logger[_0x7995('0x18')](_0x7995('0x13'),_0x35b5fe,_0x41c652[_0x7995('0x18')][_0x7995('0x19')]);return _0x341672(_0x41c652[_0x7995('0x18')][_0x7995('0x19')]);}logger[_0x7995('0x18')](_0x7995('0x13'),_0x35b5fe,_0x41c652['error'][_0x7995('0x19')]);return _0x1e400a(_0x41c652['error'][_0x7995('0x19')]);}else{logger[_0x7995('0x1a')](_0x7995('0x13'),_0x35b5fe,_0x7995('0x14'));_0x1e400a(_0x41c652[_0x7995('0x1b')][_0x7995('0x19')]);}})['catch'](function(_0x54c9ae){logger[_0x7995('0x18')]('VoiceQueue,\x20%s,\x20%s',_0x35b5fe,_0x54c9ae);_0x341672(_0x54c9ae);});});}exports['GetVoiceQueue']=function(_0x3ec178){var _0x3d463e=this;return new Promise(function(_0x4cbe10,_0x3a9b54){return db['VoiceQueue']['findAll']({'raw':_0x3ec178[_0x7995('0x1c')]?_0x3ec178[_0x7995('0x1c')][_0x7995('0x1d')]===undefined?!![]:![]:!![],'where':_0x3ec178[_0x7995('0x1c')]?_0x3ec178[_0x7995('0x1c')][_0x7995('0x1e')]||null:null,'attributes':_0x3ec178['options']?_0x3ec178[_0x7995('0x1c')][_0x7995('0x1f')]||null:null,'limit':_0x3ec178[_0x7995('0x1c')]?_0x3ec178[_0x7995('0x1c')][_0x7995('0x20')]||null:null,'include':_0x3ec178[_0x7995('0x1c')]?_0x3ec178[_0x7995('0x1c')][_0x7995('0x21')]?_['map'](_0x3ec178[_0x7995('0x1c')][_0x7995('0x21')],function(_0x401dc3){return{'model':db[_0x401dc3[_0x7995('0x22')]],'as':_0x401dc3['as'],'attributes':_0x401dc3[_0x7995('0x1f')],'include':_0x401dc3[_0x7995('0x21')]?_['map'](_0x401dc3[_0x7995('0x21')],function(_0x5911c3){return{'model':db[_0x5911c3[_0x7995('0x22')]],'as':_0x5911c3['as'],'attributes':_0x5911c3[_0x7995('0x1f')],'include':_0x5911c3[_0x7995('0x21')]?_[_0x7995('0x23')](_0x5911c3[_0x7995('0x21')],function(_0x4b6f99){return{'model':db[_0x4b6f99[_0x7995('0x22')]],'as':_0x4b6f99['as'],'attributes':_0x4b6f99['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x3250e0){logger[_0x7995('0x1a')]('GetVoiceQueue',_0x3ec178);logger['debug']('GetVoiceQueue',_0x3ec178,JSON[_0x7995('0x17')](_0x3250e0));_0x4cbe10(_0x3250e0);})[_0x7995('0x24')](function(_0x327a81){logger[_0x7995('0x18')](_0x7995('0x25'),_0x327a81[_0x7995('0x19')],_0x3ec178);_0x3a9b54(_0x3d463e['error'](0x1f4,_0x327a81['message']));});});};exports[_0x7995('0x26')]=function(_0x5524af){var _0x553671=this;return new Promise(function(_0x3eb566,_0x29fac5){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':_0x5524af['options']?_0x5524af[_0x7995('0x1c')][_0x7995('0x1d')]===undefined?!![]:![]:!![],'where':_0x5524af['options']?_0x5524af['options']['where']||null:null,'attributes':_0x5524af[_0x7995('0x1c')]?_0x5524af[_0x7995('0x1c')]['attributes']||null:null,'include':_0x5524af[_0x7995('0x1c')]?_0x5524af['options'][_0x7995('0x21')]?_[_0x7995('0x23')](_0x5524af[_0x7995('0x1c')]['include'],function(_0x52d76d){return{'model':db[_0x52d76d[_0x7995('0x22')]],'as':_0x52d76d['as'],'attributes':_0x52d76d['attributes'],'include':_0x52d76d['include']?_[_0x7995('0x23')](_0x52d76d[_0x7995('0x21')],function(_0x5212ff){return{'model':db[_0x5212ff[_0x7995('0x22')]],'as':_0x5212ff['as'],'attributes':_0x5212ff[_0x7995('0x1f')],'include':_0x5212ff[_0x7995('0x21')]?_[_0x7995('0x23')](_0x5212ff[_0x7995('0x21')],function(_0x53002a){return{'model':db[_0x53002a[_0x7995('0x22')]],'as':_0x53002a['as'],'attributes':_0x53002a[_0x7995('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x1d60b8){logger['info'](_0x7995('0x26'),_0x5524af);logger[_0x7995('0x15')](_0x7995('0x26'),_0x5524af,JSON[_0x7995('0x17')](_0x1d60b8));_0x3eb566(_0x1d60b8);})[_0x7995('0x24')](function(_0x1035dc){logger['error'](_0x7995('0x26'),_0x1035dc[_0x7995('0x19')],_0x5524af);_0x29fac5(_0x553671[_0x7995('0x18')](0x1f4,_0x1035dc[_0x7995('0x19')]));});});};
\ No newline at end of file
index d4ed492..bf2395a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8396=['./voiceQueue.events','save','remove','emit','removeListener','register','voiceQueue:'];(function(_0xbd6e0f,_0x58fb03){var _0x3f5e97=function(_0x1d66dd){while(--_0x1d66dd){_0xbd6e0f['push'](_0xbd6e0f['shift']());}};_0x3f5e97(++_0x58fb03);}(_0x8396,0x134));var _0x6839=function(_0x478973,_0x24f842){_0x478973=_0x478973-0x0;var _0x33d3e5=_0x8396[_0x478973];return _0x33d3e5;};'use strict';var VoiceQueueEvents=require(_0x6839('0x0'));var events=[_0x6839('0x1'),_0x6839('0x2'),'update'];function createListener(_0x4e1988,_0x4bafa0){return function(_0x2378f5){_0x4bafa0[_0x6839('0x3')](_0x4e1988,_0x2378f5);};}function removeListener(_0x146c45,_0x9942f6){return function(){VoiceQueueEvents[_0x6839('0x4')](_0x146c45,_0x9942f6);};}exports[_0x6839('0x5')]=function(_0x2e57ac){for(var _0x5d5c70=0x0,_0x6e784a=events['length'];_0x5d5c70<_0x6e784a;_0x5d5c70++){var _0x212db7=events[_0x5d5c70];var _0x208077=createListener(_0x6839('0x6')+_0x212db7,_0x2e57ac);VoiceQueueEvents['on'](_0x212db7,_0x208077);}};
\ No newline at end of file
+var _0x28c1=['update','emit','register','length','voiceQueue:','./voiceQueue.events','save','remove'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x28c1,0x10d));var _0x128c=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x28c1[_0x31e29a];return _0x32d892;};'use strict';var VoiceQueueEvents=require(_0x128c('0x0'));var events=[_0x128c('0x1'),_0x128c('0x2'),_0x128c('0x3')];function createListener(_0x38c60c,_0x4f19b8){return function(_0x4ace69){_0x4f19b8[_0x128c('0x4')](_0x38c60c,_0x4ace69);};}function removeListener(_0x1bd18a,_0x3fe6bb){return function(){VoiceQueueEvents['removeListener'](_0x1bd18a,_0x3fe6bb);};}exports[_0x128c('0x5')]=function(_0xfeb2d1){for(var _0x7db674=0x0,_0x269d7d=events[_0x128c('0x6')];_0x7db674<_0x269d7d;_0x7db674++){var _0x2ae8c7=events[_0x7db674];var _0x1f264c=createListener(_0x128c('0x7')+_0x2ae8c7,_0xfeb2d1);VoiceQueueEvents['on'](_0x2ae8c7,_0x1f264c);}};
\ No newline at end of file
index cb60ec1..08aaf9c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x516b=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/index','getVoiceQueuesReport','/:id','show','post'];(function(_0x57d00b,_0x547797){var _0x4c6c90=function(_0x4904fe){while(--_0x4904fe){_0x57d00b['push'](_0x57d00b['shift']());}};_0x4c6c90(++_0x547797);}(_0x516b,0x166));var _0xb516=function(_0x487e8e,_0x452414){_0x487e8e=_0x487e8e-0x0;var _0x4678db=_0x516b[_0x487e8e];return _0x4678db;};'use strict';var multer=require(_0xb516('0x0'));var util=require(_0xb516('0x1'));var path=require(_0xb516('0x2'));var timeout=require(_0xb516('0x3'));var express=require('express');var router=express[_0xb516('0x4')]();var auth=require(_0xb516('0x5'));var interaction=require(_0xb516('0x6'));var config=require(_0xb516('0x7'));var controller=require(_0xb516('0x8'));router[_0xb516('0x9')]('/',auth[_0xb516('0xa')](),controller['index']);router[_0xb516('0x9')]('/describe',auth[_0xb516('0xa')](),controller['describe']);router[_0xb516('0x9')](_0xb516('0xb'),auth[_0xb516('0xa')](),controller[_0xb516('0xc')]);router['get'](_0xb516('0xd'),auth[_0xb516('0xa')](),controller[_0xb516('0xe')]);router[_0xb516('0xf')]('/',auth[_0xb516('0xa')](),controller[_0xb516('0x10')]);router[_0xb516('0x11')](_0xb516('0xd'),auth[_0xb516('0xa')](),controller[_0xb516('0x12')]);router[_0xb516('0x13')](_0xb516('0xd'),auth[_0xb516('0xa')](),controller[_0xb516('0x14')]);module[_0xb516('0x15')]=router;
\ No newline at end of file
+var _0x475a=['describe','/index','getVoiceQueuesReport','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0xa28eda,_0x5369b9){var _0x5d2c57=function(_0xd268aa){while(--_0xd268aa){_0xa28eda['push'](_0xa28eda['shift']());}};_0x5d2c57(++_0x5369b9);}(_0x475a,0x164));var _0xa475=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x475a[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xa475('0x0'));var util=require(_0xa475('0x1'));var path=require(_0xa475('0x2'));var timeout=require(_0xa475('0x3'));var express=require(_0xa475('0x4'));var router=express[_0xa475('0x5')]();var auth=require(_0xa475('0x6'));var interaction=require(_0xa475('0x7'));var config=require(_0xa475('0x8'));var controller=require('./voiceQueueReport.controller');router[_0xa475('0x9')]('/',auth[_0xa475('0xa')](),controller[_0xa475('0xb')]);router[_0xa475('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xa475('0xc')]);router['get'](_0xa475('0xd'),auth['isAuthenticated'](),controller[_0xa475('0xe')]);router[_0xa475('0x9')](_0xa475('0xf'),auth['isAuthenticated'](),controller[_0xa475('0x10')]);router['post']('/',auth[_0xa475('0xa')](),controller[_0xa475('0x11')]);router[_0xa475('0x12')](_0xa475('0xf'),auth[_0xa475('0xa')](),controller[_0xa475('0x13')]);router[_0xa475('0x14')]('/:id',auth[_0xa475('0xa')](),controller[_0xa475('0x15')]);module[_0xa475('0x16')]=router;
\ No newline at end of file
index b313d76..c0447e5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfc39=['YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue','queuecallerleaveAt','holdtime','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE','getDataValue'];(function(_0x2a0fc4,_0x2eaf74){var _0x531d00=function(_0xa4388f){while(--_0xa4388f){_0x2a0fc4['push'](_0x2a0fc4['shift']());}};_0x531d00(++_0x2eaf74);}(_0xfc39,0xf3));var _0x9fc3=function(_0x221e15,_0x770f6b){_0x221e15=_0x221e15-0x0;var _0x21a550=_0xfc39[_0x221e15];return _0x21a550;};'use strict';var Sequelize=require(_0x9fc3('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x9fc3('0x1')]},'uniqueid':{'type':Sequelize[_0x9fc3('0x1')]},'calleridnum':{'type':Sequelize[_0x9fc3('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x9fc3('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x9fc3('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x9fc3('0x2')],'set':function(_0x2fef39){var _0x478639=moment(_0x2fef39);var _0xa215ba=moment(this[_0x9fc3('0x3')]('queuecallerjoinAt'))['format'](_0x9fc3('0x4'));var _0x2638be=_0x478639[_0x9fc3('0x5')](_0xa215ba,'seconds');this[_0x9fc3('0x6')](_0x9fc3('0x7'),_0x2fef39);this[_0x9fc3('0x6')](_0x9fc3('0x8'),_0x2638be||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x9fc3('0x9')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x9fc3('0x2')]},'queuecallercomplete':{'type':Sequelize[_0x9fc3('0x9')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x9fc3('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x9fc3('0x1')],'comment':_0x9fc3('0xa')},'originalposition':{'type':Sequelize[_0x9fc3('0xb')]},'channel':{'type':Sequelize[_0x9fc3('0x1')]},'connectedlinenum':{'type':Sequelize[_0x9fc3('0x1')]},'connectedlinename':{'type':Sequelize[_0x9fc3('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x9fc3('0x1')]},'priority':{'type':Sequelize[_0x9fc3('0x1')]},'holdtime':{'type':Sequelize[_0x9fc3('0xb')]},'mohtime':{'type':Sequelize[_0x9fc3('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x9fc3('0x9')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x9fc3('0x1')]},'transfer':{'type':Sequelize[_0x9fc3('0x9')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x9fc3('0x1')],'comment':_0x9fc3('0xc')},'transferexten':{'type':Sequelize[_0x9fc3('0x1')]},'transferuniqueid':{'type':Sequelize[_0x9fc3('0x1')]},'disposition':{'type':Sequelize[_0x9fc3('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x9fc3('0xb')],'defaultValue':0x0}};
\ No newline at end of file
+var _0x3021=['queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','DATE','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','moment','exports','STRING'];(function(_0x207a75,_0x598bc2){var _0x3c2ba0=function(_0x1d0625){while(--_0x1d0625){_0x207a75['push'](_0x207a75['shift']());}};_0x3c2ba0(++_0x598bc2);}(_0x3021,0x1dd));var _0x1302=function(_0x2ddc1d,_0x32ce8d){_0x2ddc1d=_0x2ddc1d-0x0;var _0x29caf3=_0x3021[_0x2ddc1d];return _0x29caf3;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1302('0x0'));module[_0x1302('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x1302('0x2')]},'calleridnum':{'type':Sequelize[_0x1302('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x1302('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x57fb13){var _0x2e8c2e=moment(_0x57fb13);var _0x3cf5d6=moment(this['getDataValue'](_0x1302('0x3')))[_0x1302('0x4')](_0x1302('0x5'));var _0x5e1830=_0x2e8c2e[_0x1302('0x6')](_0x3cf5d6,_0x1302('0x7'));this[_0x1302('0x8')](_0x1302('0x9'),_0x57fb13);this[_0x1302('0x8')](_0x1302('0xa'),_0x5e1830||null);}},'position':{'type':Sequelize[_0x1302('0xb')]},'count':{'type':Sequelize[_0x1302('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x1302('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x1302('0xd')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x1302('0xd')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x1302('0xe')},'originalposition':{'type':Sequelize[_0x1302('0xb')]},'channel':{'type':Sequelize[_0x1302('0x2')]},'connectedlinenum':{'type':Sequelize[_0x1302('0x2')]},'connectedlinename':{'type':Sequelize[_0x1302('0x2')]},'accountcode':{'type':Sequelize[_0x1302('0x2')]},'context':{'type':Sequelize[_0x1302('0x2')]},'exten':{'type':Sequelize[_0x1302('0x2')]},'priority':{'type':Sequelize[_0x1302('0x2')]},'holdtime':{'type':Sequelize[_0x1302('0xb')]},'mohtime':{'type':Sequelize[_0x1302('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1302('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x1302('0x2')]},'transfer':{'type':Sequelize[_0x1302('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x1302('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x1302('0x2')]},'transferuniqueid':{'type':Sequelize[_0x1302('0x2')]},'disposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x1302('0xb')],'defaultValue':0x0}};
\ No newline at end of file
index 0a9b992..60e7631 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfcac=['catch','show','rawAttributes','length','find','body','params','describe','getVoiceQueuesReport','includeAll','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','VoiceQueueReport','model','keys','query','intersection','attributes','fields','hasOwnProperty','order','where','filters','pick','filter','merge','map','type','key','field','options','include','findAll','rows'];(function(_0x245afe,_0x319cde){var _0x4eefde=function(_0x15a1fa){while(--_0x15a1fa){_0x245afe['push'](_0x245afe['shift']());}};_0x4eefde(++_0x319cde);}(_0xfcac,0xfd));var _0xcfca=function(_0x56abc9,_0x4403e7){_0x56abc9=_0x56abc9-0x0;var _0x47956f=_0xfcac[_0x56abc9];return _0x47956f;};'use strict';var pdf=require(_0xcfca('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xcfca('0x1'));var zipdir=require(_0xcfca('0x2'));var jsonpatch=require(_0xcfca('0x3'));var rp=require(_0xcfca('0x4'));var moment=require('moment');var BPromise=require(_0xcfca('0x5'));var Mustache=require(_0xcfca('0x6'));var util=require(_0xcfca('0x7'));var path=require(_0xcfca('0x8'));var sox=require(_0xcfca('0x9'));var csv=require(_0xcfca('0xa'));var ejs=require(_0xcfca('0xb'));var fs=require('fs');var _=require(_0xcfca('0xc'));var squel=require('squel');var crypto=require(_0xcfca('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xcfca('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcfca('0xf'));var authService=require(_0xcfca('0x10'));var hardwareService=require(_0xcfca('0x11'));var Redis=require(_0xcfca('0x12'));var qs=require(_0xcfca('0x13'));var logger=require(_0xcfca('0x14'))(_0xcfca('0x15'));var utils=require(_0xcfca('0x16'));var config=require(_0xcfca('0x17'));var db=require(_0xcfca('0x18'))['db'];config[_0xcfca('0x19')]=_['defaults'](config[_0xcfca('0x19')],{'host':_0xcfca('0x1a'),'port':0x18eb});var socket=require(_0xcfca('0x1b'))(new Redis(config['redis']));require(_0xcfca('0x1c'))[_0xcfca('0x1d')](socket);function respondWithStatusCode(_0x2edb2f,_0x4451cc){_0x4451cc=_0x4451cc||0xcc;return function(_0x1334a9){if(_0x1334a9){return _0x2edb2f['sendStatus'](_0x4451cc);}return _0x2edb2f[_0xcfca('0x1e')](_0x4451cc)[_0xcfca('0x1f')]();};}function respondWithResult(_0x35f647,_0x5811c9){_0x5811c9=_0x5811c9||0xc8;return function(_0x3703f5){if(_0x3703f5){return _0x35f647[_0xcfca('0x1e')](_0x5811c9)[_0xcfca('0x20')](_0x3703f5);}};}function respondWithFilteredResult(_0xb12dd4,_0x12c0f1){return function(_0x440382){if(_0x440382){var _0x6f2bb0=_0x440382[_0xcfca('0x21')],_0x30382e=_0x12c0f1[_0xcfca('0x22')],_0x5f5037=_0x12c0f1[_0xcfca('0x22')]+_0x12c0f1[_0xcfca('0x23')],_0x54d10a;if(_0x5f5037>=_0x6f2bb0){_0x5f5037=_0x6f2bb0;_0x54d10a=0xc8;}else{_0x54d10a=0xce;}_0xb12dd4[_0xcfca('0x1e')](_0x54d10a);return _0xb12dd4[_0xcfca('0x24')](_0xcfca('0x25'),_0x30382e+'-'+_0x5f5037+'/'+_0x6f2bb0)['json'](_0x440382);}return null;};}function patchUpdates(_0x4eae01){return function(_0x288a03){try{jsonpatch[_0xcfca('0x26')](_0x288a03,_0x4eae01,!![]);}catch(_0x168b19){return BPromise[_0xcfca('0x27')](_0x168b19);}return _0x288a03[_0xcfca('0x28')]();};}function saveUpdates(_0x41a020,_0x7425f3){return function(_0x8f650e){if(_0x8f650e){return _0x8f650e['update'](_0x41a020)[_0xcfca('0x29')](function(_0x2592dd){return _0x2592dd;});}return null;};}function removeEntity(_0x53a2f3,_0x227a3e){return function(_0x230e26){if(_0x230e26){return _0x230e26[_0xcfca('0x2a')]()[_0xcfca('0x29')](function(){_0x53a2f3[_0xcfca('0x1e')](0xcc)[_0xcfca('0x1f')]();});}};}function handleEntityNotFound(_0x170a5c,_0x18cd49){return function(_0x28c88d){if(!_0x28c88d){_0x170a5c[_0xcfca('0x2b')](0x194);}return _0x28c88d;};}function handleError(_0xbd275b,_0x547965){_0x547965=_0x547965||0x1f4;return function(_0x14f6ee){logger[_0xcfca('0x2c')](_0x14f6ee[_0xcfca('0x2d')]);if(_0x14f6ee[_0xcfca('0x2e')]){delete _0x14f6ee[_0xcfca('0x2e')];}_0xbd275b[_0xcfca('0x1e')](_0x547965)[_0xcfca('0x2f')](_0x14f6ee);};}exports[_0xcfca('0x30')]=function(_0xc41926,_0x350924){var _0x249ff5={},_0x274aef={},_0x3b86dc={'count':0x0,'rows':[]};var _0x29942a=db[_0xcfca('0x31')]['rawAttributes'];_0x274aef[_0xcfca('0x32')]=_[_0xcfca('0x33')](_0x29942a);_0x274aef[_0xcfca('0x34')]=_[_0xcfca('0x33')](_0xc41926[_0xcfca('0x34')]);_0x274aef['filters']=_[_0xcfca('0x35')](_0x274aef['model'],_0x274aef[_0xcfca('0x34')]);_0x249ff5[_0xcfca('0x36')]=_['intersection'](_0x274aef[_0xcfca('0x32')],qs[_0xcfca('0x37')](_0xc41926[_0xcfca('0x34')][_0xcfca('0x37')]));_0x249ff5['attributes']=_0x249ff5[_0xcfca('0x36')]['length']?_0x249ff5[_0xcfca('0x36')]:_0x274aef[_0xcfca('0x32')];if(!_0xc41926[_0xcfca('0x34')][_0xcfca('0x38')]('nolimit')){_0x249ff5[_0xcfca('0x23')]=qs[_0xcfca('0x23')](_0xc41926[_0xcfca('0x34')]['limit']);_0x249ff5[_0xcfca('0x22')]=qs[_0xcfca('0x22')](_0xc41926[_0xcfca('0x34')][_0xcfca('0x22')]);}_0x249ff5[_0xcfca('0x39')]=qs['sort'](_0xc41926[_0xcfca('0x34')]['sort']);_0x249ff5[_0xcfca('0x3a')]=qs[_0xcfca('0x3b')](_[_0xcfca('0x3c')](_0xc41926['query'],_0x274aef[_0xcfca('0x3b')]));if(_0xc41926[_0xcfca('0x34')][_0xcfca('0x3d')]){_0x249ff5['where']=_[_0xcfca('0x3e')](_0x249ff5[_0xcfca('0x3a')],{'$or':_[_0xcfca('0x3f')](_0x29942a,function(_0xc581fc){if(_0xc581fc[_0xcfca('0x40')][_0xcfca('0x41')]!=='VIRTUAL'){var _0x32409f={};_0x32409f[_0xc581fc[_0xcfca('0x42')]]={'$like':'%'+_0xc41926[_0xcfca('0x34')][_0xcfca('0x3d')]+'%'};return _0x32409f;}})});}_0x249ff5=_['merge']({},_0x249ff5,_0xc41926[_0xcfca('0x43')]);var _0x17ef20={'where':_0x249ff5[_0xcfca('0x3a')]};return db['VoiceQueueReport']['count'](_0x17ef20)[_0xcfca('0x29')](function(_0x2a10c1){_0x3b86dc[_0xcfca('0x21')]=_0x2a10c1;if(_0xc41926[_0xcfca('0x34')]['includeAll']){_0x249ff5[_0xcfca('0x44')]=[{'all':!![]}];}return db[_0xcfca('0x31')][_0xcfca('0x45')](_0x249ff5);})[_0xcfca('0x29')](function(_0x71eb45){_0x3b86dc[_0xcfca('0x46')]=_0x71eb45;return _0x3b86dc;})['then'](respondWithFilteredResult(_0x350924,_0x249ff5))[_0xcfca('0x47')](handleError(_0x350924,null));};exports[_0xcfca('0x48')]=function(_0x91c3c7,_0x1634f7){var _0x47545c={'raw':![],'where':{'id':_0x91c3c7['params']['id']}},_0x293d15={};_0x293d15[_0xcfca('0x32')]=_[_0xcfca('0x33')](db[_0xcfca('0x31')][_0xcfca('0x49')]);_0x293d15[_0xcfca('0x34')]=_[_0xcfca('0x33')](_0x91c3c7[_0xcfca('0x34')]);_0x293d15[_0xcfca('0x3b')]=_['intersection'](_0x293d15[_0xcfca('0x32')],_0x293d15['query']);_0x47545c[_0xcfca('0x36')]=_[_0xcfca('0x35')](_0x293d15['model'],qs[_0xcfca('0x37')](_0x91c3c7[_0xcfca('0x34')][_0xcfca('0x37')]));_0x47545c[_0xcfca('0x36')]=_0x47545c[_0xcfca('0x36')][_0xcfca('0x4a')]?_0x47545c['attributes']:_0x293d15['model'];if(_0x91c3c7[_0xcfca('0x34')]['includeAll']){_0x47545c[_0xcfca('0x44')]=[{'all':!![]}];}_0x47545c=_[_0xcfca('0x3e')]({},_0x47545c,_0x91c3c7[_0xcfca('0x43')]);return db[_0xcfca('0x31')][_0xcfca('0x4b')](_0x47545c)[_0xcfca('0x29')](handleEntityNotFound(_0x1634f7,null))[_0xcfca('0x29')](respondWithResult(_0x1634f7,null))[_0xcfca('0x47')](handleError(_0x1634f7,null));};exports['create']=function(_0x190c37,_0x2f08d0){return db[_0xcfca('0x31')]['create'](_0x190c37[_0xcfca('0x4c')],{})['then'](respondWithResult(_0x2f08d0,0xc9))[_0xcfca('0x47')](handleError(_0x2f08d0,null));};exports['update']=function(_0xa5e889,_0x5182fa){if(_0xa5e889[_0xcfca('0x4c')]['id']){delete _0xa5e889[_0xcfca('0x4c')]['id'];}return db['VoiceQueueReport'][_0xcfca('0x4b')]({'where':{'id':_0xa5e889['params']['id']}})[_0xcfca('0x29')](handleEntityNotFound(_0x5182fa,null))['then'](saveUpdates(_0xa5e889[_0xcfca('0x4c')],null))[_0xcfca('0x29')](respondWithResult(_0x5182fa,null))[_0xcfca('0x47')](handleError(_0x5182fa,null));};exports[_0xcfca('0x2a')]=function(_0x45019b,_0x17d10f){return db[_0xcfca('0x31')]['find']({'where':{'id':_0x45019b[_0xcfca('0x4d')]['id']}})['then'](handleEntityNotFound(_0x17d10f,null))[_0xcfca('0x29')](removeEntity(_0x17d10f,null))[_0xcfca('0x47')](handleError(_0x17d10f,null));};exports['describe']=function(_0x22e89d,_0x14f098){return db[_0xcfca('0x31')][_0xcfca('0x4e')]()[_0xcfca('0x29')](respondWithResult(_0x14f098,null))[_0xcfca('0x47')](handleError(_0x14f098,null));};exports[_0xcfca('0x4f')]=function(_0x161d86,_0x1fd5f6){var _0x2a5847={},_0x15ae8c={},_0xa5d6bb={'count':0x0,'rows':[]};_0x15ae8c[_0xcfca('0x32')]=_[_0xcfca('0x33')](db['VoiceQueueReport'][_0xcfca('0x49')]);_0x15ae8c[_0xcfca('0x34')]=_['keys'](_0x161d86['query']);_0x15ae8c[_0xcfca('0x3b')]=_[_0xcfca('0x35')](_0x15ae8c[_0xcfca('0x32')],_0x15ae8c[_0xcfca('0x34')]);_0x2a5847[_0xcfca('0x36')]=_[_0xcfca('0x35')](_0x15ae8c[_0xcfca('0x32')],qs[_0xcfca('0x37')](_0x161d86['query']['fields']));_0x2a5847[_0xcfca('0x36')]=_0x2a5847[_0xcfca('0x36')][_0xcfca('0x4a')]?_0x2a5847['attributes']:_0x15ae8c[_0xcfca('0x32')];if(!_0x161d86[_0xcfca('0x34')]['hasOwnProperty']('nolimit')){_0x2a5847[_0xcfca('0x23')]=qs['limit'](_0x161d86[_0xcfca('0x34')][_0xcfca('0x23')]);_0x2a5847[_0xcfca('0x22')]=qs['offset'](_0x161d86[_0xcfca('0x34')][_0xcfca('0x22')]);}_0x2a5847['order']=qs['sort'](_0x161d86['query']['sort']);_0x2a5847[_0xcfca('0x3a')]=qs[_0xcfca('0x3b')](_['pick'](_0x161d86[_0xcfca('0x34')],_0x15ae8c[_0xcfca('0x3b')]));if(_0x161d86['query'][_0xcfca('0x3d')]){_0x2a5847['where']=_[_0xcfca('0x3e')](_0x2a5847[_0xcfca('0x3a')],{'$or':_['map'](_0x2a5847[_0xcfca('0x36')],function(_0x3d0cae){var _0x11adf9={};_0x11adf9[_0x3d0cae]={'$like':'%'+_0x161d86[_0xcfca('0x34')][_0xcfca('0x3d')]+'%'};return _0x11adf9;})});}_0x2a5847=_[_0xcfca('0x3e')]({},_0x2a5847,_0x161d86[_0xcfca('0x43')]);var _0x25ef8f={'where':_0x2a5847[_0xcfca('0x3a')]};return db[_0xcfca('0x31')][_0xcfca('0x21')](_0x25ef8f)[_0xcfca('0x29')](function(_0x32a226){_0xa5d6bb[_0xcfca('0x21')]=_0x32a226;if(_0x161d86[_0xcfca('0x34')][_0xcfca('0x50')]){_0x2a5847[_0xcfca('0x44')]=[{'all':!![]}];}return db[_0xcfca('0x31')]['findAll'](_0x2a5847);})[_0xcfca('0x29')](function(_0x22cf96){_0xa5d6bb[_0xcfca('0x46')]=_0x22cf96;return _0xa5d6bb;})[_0xcfca('0x29')](respondWithFilteredResult(_0x1fd5f6,_0x2a5847,_0xcfca('0x4f')))[_0xcfca('0x47')](handleError(_0x1fd5f6,null,_0xcfca('0x4f')));};
\ No newline at end of file
+var _0xd8a3=['name','send','VoiceQueueReport','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','map','type','key','field','options','count','includeAll','findAll','rows','show','params','rawAttributes','catch','create','body','find','describe','include','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0xd8a3,0xc1));var _0x3d8a=function(_0x5e0e28,_0x1568d6){_0x5e0e28=_0x5e0e28-0x0;var _0x347c13=_0xd8a3[_0x5e0e28];return _0x347c13;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3d8a('0x0'));var rimraf=require(_0x3d8a('0x1'));var zipdir=require(_0x3d8a('0x2'));var jsonpatch=require(_0x3d8a('0x3'));var rp=require(_0x3d8a('0x4'));var moment=require(_0x3d8a('0x5'));var BPromise=require(_0x3d8a('0x6'));var Mustache=require(_0x3d8a('0x7'));var util=require(_0x3d8a('0x8'));var path=require(_0x3d8a('0x9'));var sox=require('sox');var csv=require(_0x3d8a('0xa'));var ejs=require(_0x3d8a('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d8a('0xc'));var jsforce=require(_0x3d8a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3d8a('0xa'));var querystring=require(_0x3d8a('0xe'));var Papa=require('papaparse');var authService=require(_0x3d8a('0xf'));var hardwareService=require(_0x3d8a('0x10'));var Redis=require(_0x3d8a('0x11'));var qs=require(_0x3d8a('0x12'));var logger=require(_0x3d8a('0x13'))(_0x3d8a('0x14'));var utils=require(_0x3d8a('0x15'));var config=require('../../config/environment');var db=require(_0x3d8a('0x16'))['db'];config[_0x3d8a('0x17')]=_['defaults'](config[_0x3d8a('0x17')],{'host':_0x3d8a('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3d8a('0x19'))[_0x3d8a('0x1a')](socket);function respondWithStatusCode(_0x336ef5,_0x1fa0b5){_0x1fa0b5=_0x1fa0b5||0xcc;return function(_0x560a45){if(_0x560a45){return _0x336ef5[_0x3d8a('0x1b')](_0x1fa0b5);}return _0x336ef5[_0x3d8a('0x1c')](_0x1fa0b5)[_0x3d8a('0x1d')]();};}function respondWithResult(_0x55ee22,_0x38bede){_0x38bede=_0x38bede||0xc8;return function(_0x1c5496){if(_0x1c5496){return _0x55ee22[_0x3d8a('0x1c')](_0x38bede)[_0x3d8a('0x1e')](_0x1c5496);}};}function respondWithFilteredResult(_0x595c73,_0x264011){return function(_0x56edbe){if(_0x56edbe){var _0x2c5bee=_0x56edbe['count'],_0x4a9b13=_0x264011['offset'],_0x5e7f84=_0x264011[_0x3d8a('0x1f')]+_0x264011[_0x3d8a('0x20')],_0x208ca1;if(_0x5e7f84>=_0x2c5bee){_0x5e7f84=_0x2c5bee;_0x208ca1=0xc8;}else{_0x208ca1=0xce;}_0x595c73[_0x3d8a('0x1c')](_0x208ca1);return _0x595c73[_0x3d8a('0x21')](_0x3d8a('0x22'),_0x4a9b13+'-'+_0x5e7f84+'/'+_0x2c5bee)['json'](_0x56edbe);}return null;};}function patchUpdates(_0x2239ef){return function(_0x1f498a){try{jsonpatch[_0x3d8a('0x23')](_0x1f498a,_0x2239ef,!![]);}catch(_0x52bbf0){return BPromise[_0x3d8a('0x24')](_0x52bbf0);}return _0x1f498a[_0x3d8a('0x25')]();};}function saveUpdates(_0x450981,_0x9c0c6b){return function(_0x242c7f){if(_0x242c7f){return _0x242c7f[_0x3d8a('0x26')](_0x450981)[_0x3d8a('0x27')](function(_0x3bcfbe){return _0x3bcfbe;});}return null;};}function removeEntity(_0xc13b6,_0x27ccff){return function(_0x40b4f9){if(_0x40b4f9){return _0x40b4f9[_0x3d8a('0x28')]()[_0x3d8a('0x27')](function(){_0xc13b6[_0x3d8a('0x1c')](0xcc)[_0x3d8a('0x1d')]();});}};}function handleEntityNotFound(_0x2986e9,_0x1f0c7a){return function(_0xc1509e){if(!_0xc1509e){_0x2986e9[_0x3d8a('0x1b')](0x194);}return _0xc1509e;};}function handleError(_0xd6b3b4,_0x41642c){_0x41642c=_0x41642c||0x1f4;return function(_0x55c6e2){logger['error'](_0x55c6e2['stack']);if(_0x55c6e2[_0x3d8a('0x29')]){delete _0x55c6e2[_0x3d8a('0x29')];}_0xd6b3b4['status'](_0x41642c)[_0x3d8a('0x2a')](_0x55c6e2);};}exports['index']=function(_0x6c2be3,_0x33faa4){var _0x5c39b2={},_0x4eff7a={},_0x49a28b={'count':0x0,'rows':[]};var _0x111cc5=db[_0x3d8a('0x2b')]['rawAttributes'];_0x4eff7a[_0x3d8a('0x2c')]=_[_0x3d8a('0x2d')](_0x111cc5);_0x4eff7a['query']=_[_0x3d8a('0x2d')](_0x6c2be3[_0x3d8a('0x2e')]);_0x4eff7a[_0x3d8a('0x2f')]=_[_0x3d8a('0x30')](_0x4eff7a[_0x3d8a('0x2c')],_0x4eff7a['query']);_0x5c39b2[_0x3d8a('0x31')]=_[_0x3d8a('0x30')](_0x4eff7a['model'],qs['fields'](_0x6c2be3[_0x3d8a('0x2e')][_0x3d8a('0x32')]));_0x5c39b2[_0x3d8a('0x31')]=_0x5c39b2[_0x3d8a('0x31')][_0x3d8a('0x33')]?_0x5c39b2[_0x3d8a('0x31')]:_0x4eff7a[_0x3d8a('0x2c')];if(!_0x6c2be3[_0x3d8a('0x2e')][_0x3d8a('0x34')](_0x3d8a('0x35'))){_0x5c39b2[_0x3d8a('0x20')]=qs[_0x3d8a('0x20')](_0x6c2be3['query'][_0x3d8a('0x20')]);_0x5c39b2[_0x3d8a('0x1f')]=qs[_0x3d8a('0x1f')](_0x6c2be3[_0x3d8a('0x2e')]['offset']);}_0x5c39b2[_0x3d8a('0x36')]=qs[_0x3d8a('0x37')](_0x6c2be3['query'][_0x3d8a('0x37')]);_0x5c39b2['where']=qs['filters'](_['pick'](_0x6c2be3[_0x3d8a('0x2e')],_0x4eff7a['filters']));if(_0x6c2be3[_0x3d8a('0x2e')][_0x3d8a('0x38')]){_0x5c39b2[_0x3d8a('0x39')]=_[_0x3d8a('0x3a')](_0x5c39b2['where'],{'$or':_[_0x3d8a('0x3b')](_0x111cc5,function(_0x562ea6){if(_0x562ea6[_0x3d8a('0x3c')][_0x3d8a('0x3d')]!=='VIRTUAL'){var _0x5c6e5c={};_0x5c6e5c[_0x562ea6[_0x3d8a('0x3e')]]={'$like':'%'+_0x6c2be3[_0x3d8a('0x2e')][_0x3d8a('0x38')]+'%'};return _0x5c6e5c;}})});}_0x5c39b2=_['merge']({},_0x5c39b2,_0x6c2be3[_0x3d8a('0x3f')]);var _0x2e9b9e={'where':_0x5c39b2[_0x3d8a('0x39')]};return db['VoiceQueueReport'][_0x3d8a('0x40')](_0x2e9b9e)[_0x3d8a('0x27')](function(_0x20a9b0){_0x49a28b[_0x3d8a('0x40')]=_0x20a9b0;if(_0x6c2be3['query'][_0x3d8a('0x41')]){_0x5c39b2['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0x3d8a('0x42')](_0x5c39b2);})['then'](function(_0x1cd095){_0x49a28b[_0x3d8a('0x43')]=_0x1cd095;return _0x49a28b;})[_0x3d8a('0x27')](respondWithFilteredResult(_0x33faa4,_0x5c39b2))['catch'](handleError(_0x33faa4,null));};exports[_0x3d8a('0x44')]=function(_0x420eae,_0x355125){var _0x3ab781={'raw':![],'where':{'id':_0x420eae[_0x3d8a('0x45')]['id']}},_0x6acf5b={};_0x6acf5b[_0x3d8a('0x2c')]=_[_0x3d8a('0x2d')](db[_0x3d8a('0x2b')][_0x3d8a('0x46')]);_0x6acf5b[_0x3d8a('0x2e')]=_['keys'](_0x420eae[_0x3d8a('0x2e')]);_0x6acf5b[_0x3d8a('0x2f')]=_[_0x3d8a('0x30')](_0x6acf5b['model'],_0x6acf5b['query']);_0x3ab781[_0x3d8a('0x31')]=_[_0x3d8a('0x30')](_0x6acf5b[_0x3d8a('0x2c')],qs['fields'](_0x420eae[_0x3d8a('0x2e')][_0x3d8a('0x32')]));_0x3ab781[_0x3d8a('0x31')]=_0x3ab781[_0x3d8a('0x31')][_0x3d8a('0x33')]?_0x3ab781[_0x3d8a('0x31')]:_0x6acf5b[_0x3d8a('0x2c')];if(_0x420eae[_0x3d8a('0x2e')][_0x3d8a('0x41')]){_0x3ab781['include']=[{'all':!![]}];}_0x3ab781=_[_0x3d8a('0x3a')]({},_0x3ab781,_0x420eae[_0x3d8a('0x3f')]);return db[_0x3d8a('0x2b')]['find'](_0x3ab781)['then'](handleEntityNotFound(_0x355125,null))[_0x3d8a('0x27')](respondWithResult(_0x355125,null))[_0x3d8a('0x47')](handleError(_0x355125,null));};exports[_0x3d8a('0x48')]=function(_0xae1081,_0x9621ad){return db['VoiceQueueReport']['create'](_0xae1081[_0x3d8a('0x49')],{})['then'](respondWithResult(_0x9621ad,0xc9))['catch'](handleError(_0x9621ad,null));};exports['update']=function(_0x5f3935,_0x4d88a5){if(_0x5f3935[_0x3d8a('0x49')]['id']){delete _0x5f3935[_0x3d8a('0x49')]['id'];}return db[_0x3d8a('0x2b')][_0x3d8a('0x4a')]({'where':{'id':_0x5f3935['params']['id']}})[_0x3d8a('0x27')](handleEntityNotFound(_0x4d88a5,null))['then'](saveUpdates(_0x5f3935[_0x3d8a('0x49')],null))['then'](respondWithResult(_0x4d88a5,null))[_0x3d8a('0x47')](handleError(_0x4d88a5,null));};exports[_0x3d8a('0x28')]=function(_0x2c360b,_0x374979){return db['VoiceQueueReport'][_0x3d8a('0x4a')]({'where':{'id':_0x2c360b[_0x3d8a('0x45')]['id']}})[_0x3d8a('0x27')](handleEntityNotFound(_0x374979,null))[_0x3d8a('0x27')](removeEntity(_0x374979,null))[_0x3d8a('0x47')](handleError(_0x374979,null));};exports[_0x3d8a('0x4b')]=function(_0x2ef128,_0x1beab8){return db[_0x3d8a('0x2b')]['describe']()[_0x3d8a('0x27')](respondWithResult(_0x1beab8,null))[_0x3d8a('0x47')](handleError(_0x1beab8,null));};exports['getVoiceQueuesReport']=function(_0x9c51fc,_0x415506){var _0x4cfafe={},_0xa3e380={},_0x5364f5={'count':0x0,'rows':[]};_0xa3e380['model']=_[_0x3d8a('0x2d')](db[_0x3d8a('0x2b')][_0x3d8a('0x46')]);_0xa3e380[_0x3d8a('0x2e')]=_[_0x3d8a('0x2d')](_0x9c51fc['query']);_0xa3e380['filters']=_[_0x3d8a('0x30')](_0xa3e380['model'],_0xa3e380[_0x3d8a('0x2e')]);_0x4cfafe[_0x3d8a('0x31')]=_[_0x3d8a('0x30')](_0xa3e380[_0x3d8a('0x2c')],qs[_0x3d8a('0x32')](_0x9c51fc['query'][_0x3d8a('0x32')]));_0x4cfafe[_0x3d8a('0x31')]=_0x4cfafe[_0x3d8a('0x31')][_0x3d8a('0x33')]?_0x4cfafe['attributes']:_0xa3e380[_0x3d8a('0x2c')];if(!_0x9c51fc[_0x3d8a('0x2e')][_0x3d8a('0x34')](_0x3d8a('0x35'))){_0x4cfafe[_0x3d8a('0x20')]=qs[_0x3d8a('0x20')](_0x9c51fc['query'][_0x3d8a('0x20')]);_0x4cfafe[_0x3d8a('0x1f')]=qs[_0x3d8a('0x1f')](_0x9c51fc[_0x3d8a('0x2e')][_0x3d8a('0x1f')]);}_0x4cfafe[_0x3d8a('0x36')]=qs[_0x3d8a('0x37')](_0x9c51fc[_0x3d8a('0x2e')][_0x3d8a('0x37')]);_0x4cfafe['where']=qs[_0x3d8a('0x2f')](_['pick'](_0x9c51fc[_0x3d8a('0x2e')],_0xa3e380[_0x3d8a('0x2f')]));if(_0x9c51fc['query'][_0x3d8a('0x38')]){_0x4cfafe[_0x3d8a('0x39')]=_['merge'](_0x4cfafe[_0x3d8a('0x39')],{'$or':_[_0x3d8a('0x3b')](_0x4cfafe[_0x3d8a('0x31')],function(_0x15b82c){var _0x28f29c={};_0x28f29c[_0x15b82c]={'$like':'%'+_0x9c51fc[_0x3d8a('0x2e')]['filter']+'%'};return _0x28f29c;})});}_0x4cfafe=_[_0x3d8a('0x3a')]({},_0x4cfafe,_0x9c51fc['options']);var _0x3c6fe1={'where':_0x4cfafe[_0x3d8a('0x39')]};return db[_0x3d8a('0x2b')]['count'](_0x3c6fe1)[_0x3d8a('0x27')](function(_0x3849fc){_0x5364f5[_0x3d8a('0x40')]=_0x3849fc;if(_0x9c51fc[_0x3d8a('0x2e')][_0x3d8a('0x41')]){_0x4cfafe[_0x3d8a('0x4c')]=[{'all':!![]}];}return db[_0x3d8a('0x2b')][_0x3d8a('0x42')](_0x4cfafe);})['then'](function(_0x993677){_0x5364f5[_0x3d8a('0x43')]=_0x993677;return _0x5364f5;})[_0x3d8a('0x27')](respondWithFilteredResult(_0x415506,_0x4cfafe,'getVoiceQueuesReport'))[_0x3d8a('0x47')](handleError(_0x415506,null,_0x3d8a('0x4d')));};
\ No newline at end of file
index 0162705..b55957f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x85b1=['emit','hasOwnProperty','hook','../../mysqldb','save'];(function(_0x1b87a6,_0x4b11a0){var _0x3f2b76=function(_0xb685ec){while(--_0xb685ec){_0x1b87a6['push'](_0x1b87a6['shift']());}};_0x3f2b76(++_0x4b11a0);}(_0x85b1,0x10c));var _0x185b=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x85b1[_0x1a72f3];return _0x57ef47;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x185b('0x0'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x185b('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x49fc1b){return function(_0x1a8526,_0x155523,_0x560f7f){VoiceQueueReportEvents['emit'](_0x49fc1b+':'+_0x1a8526['id'],_0x1a8526);VoiceQueueReportEvents[_0x185b('0x2')](_0x49fc1b,_0x1a8526);_0x560f7f(null);};}for(var e in events){if(events[_0x185b('0x3')](e)){var event=events[e];VoiceQueueReport[_0x185b('0x4')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents;
\ No newline at end of file
+var _0x336f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','save','update'];(function(_0x4e94e4,_0x257de6){var _0x4f67f5=function(_0x3cc19b){while(--_0x3cc19b){_0x4e94e4['push'](_0x4e94e4['shift']());}};_0x4f67f5(++_0x257de6);}(_0x336f,0x73));var _0xf336=function(_0x552d36,_0x37de12){_0x552d36=_0x552d36-0x0;var _0x482cda=_0x336f[_0x552d36];return _0x482cda;};'use strict';var EventEmitter=require(_0xf336('0x0'));var VoiceQueueReport=require(_0xf336('0x1'))['db'][_0xf336('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf336('0x3'),'afterUpdate':_0xf336('0x4'),'afterDestroy':_0xf336('0x5')};function emitEvent(_0x4b1282){return function(_0x540a08,_0x2ee74a,_0x10b6d2){VoiceQueueReportEvents[_0xf336('0x6')](_0x4b1282+':'+_0x540a08['id'],_0x540a08);VoiceQueueReportEvents[_0xf336('0x6')](_0x4b1282,_0x540a08);_0x10b6d2(null);};}for(var e in events){if(events[_0xf336('0x7')](e)){var event=events[e];VoiceQueueReport[_0xf336('0x8')](e,emitEvent(event));}}module[_0xf336('0x9')]=VoiceQueueReportEvents;
\ No newline at end of file
index 4f76ee0..4ce3e1f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4308=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','./voiceQueueReport.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4308,0x87));var _0x8430=function(_0x4a4b57,_0x337a39){_0x4a4b57=_0x4a4b57-0x0;var _0x565a7c=_0x4308[_0x4a4b57];return _0x565a7c;};'use strict';var _=require(_0x8430('0x0'));var util=require(_0x8430('0x1'));var logger=require(_0x8430('0x2'))(_0x8430('0x3'));var moment=require(_0x8430('0x4'));var BPromise=require(_0x8430('0x5'));var rp=require(_0x8430('0x6'));var attributes=require(_0x8430('0x7'));module[_0x8430('0x8')]=function(_0x18a76a,_0x206041){return _0x18a76a['define']('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':['calleridnum']}],'timestamps':!![]});};
\ No newline at end of file
+var _0xa8b8=['api','moment','bluebird','request-promise','VoiceQueueReport','report_queue','uniqueid','calleridnum','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa8b8,0x1b8));var _0x8a8b=function(_0x154408,_0x28f68b){_0x154408=_0x154408-0x0;var _0x474d7b=_0xa8b8[_0x154408];return _0x474d7b;};'use strict';var _=require('lodash');var util=require(_0x8a8b('0x0'));var logger=require('../../config/logger')(_0x8a8b('0x1'));var moment=require(_0x8a8b('0x2'));var BPromise=require(_0x8a8b('0x3'));var rp=require(_0x8a8b('0x4'));var attributes=require('./voiceQueueReport.attributes');module['exports']=function(_0x38f06a,_0x44eeb7){return _0x38f06a['define'](_0x8a8b('0x5'),attributes,{'tableName':_0x8a8b('0x6'),'paranoid':![],'indexes':[{'fields':[_0x8a8b('0x7')]},{'fields':[_0x8a8b('0x8')]}],'timestamps':!![]});};
\ No newline at end of file
index db97555..4731522 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7307=['VoiceQueueReport','findAll','options','map','include','model','attributes','CreateVoiceQueueReport','create','body','raw','stringify','update','where','limit','UpdateVoiceQueueReport','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','defaults','localhost','register','request','then','info','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','VoiceQueueReport,\x20%s,\x20%s','message','result','catch','GetVoiceQueueReport'];(function(_0x453bc4,_0x1a31a0){var _0x55476c=function(_0x52e2b3){while(--_0x52e2b3){_0x453bc4['push'](_0x453bc4['shift']());}};_0x55476c(++_0x1a31a0);}(_0x7307,0x85));var _0x7730=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x7307[_0x1a36a5];return _0x746243;};'use strict';var _=require(_0x7730('0x0'));var util=require('util');var moment=require(_0x7730('0x1'));var BPromise=require('bluebird');var rs=require(_0x7730('0x2'));var fs=require('fs');var Redis=require(_0x7730('0x3'));var db=require(_0x7730('0x4'))['db'];var utils=require(_0x7730('0x5'));var logger=require(_0x7730('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x7730('0x7')](config['redis'],{'host':_0x7730('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0x7730('0x9')](socket);function respondWithRpcPromise(_0x5cb52f,_0x169962,_0x470298){return new BPromise(function(_0x4b4163,_0x57f41c){return client[_0x7730('0xa')](_0x5cb52f,_0x470298)[_0x7730('0xb')](function(_0x366717){logger[_0x7730('0xc')]('VoiceQueueReport,\x20%s,\x20%s',_0x169962,'request\x20sent');logger[_0x7730('0xd')](_0x7730('0xe'),_0x169962,_0x7730('0xf'),JSON['stringify'](_0x366717));if(_0x366717['error']){if(_0x366717['error'][_0x7730('0x10')]===0x1f4){logger[_0x7730('0x11')](_0x7730('0x12'),_0x169962,_0x366717[_0x7730('0x11')][_0x7730('0x13')]);return _0x57f41c(_0x366717[_0x7730('0x11')][_0x7730('0x13')]);}logger[_0x7730('0x11')](_0x7730('0x12'),_0x169962,_0x366717['error'][_0x7730('0x13')]);return _0x4b4163(_0x366717[_0x7730('0x11')][_0x7730('0x13')]);}else{logger[_0x7730('0xc')]('VoiceQueueReport,\x20%s,\x20%s',_0x169962,_0x7730('0xf'));_0x4b4163(_0x366717[_0x7730('0x14')][_0x7730('0x13')]);}})[_0x7730('0x15')](function(_0x25f3ea){logger[_0x7730('0x11')](_0x7730('0x12'),_0x169962,_0x25f3ea);_0x57f41c(_0x25f3ea);});});}exports[_0x7730('0x16')]=function(_0x308eb2){var _0x17c7f6=this;return new Promise(function(_0x2eb24f,_0x4b5539){return db[_0x7730('0x17')][_0x7730('0x18')]({'raw':_0x308eb2[_0x7730('0x19')]?_0x308eb2['options']['raw']===undefined?!![]:![]:!![],'where':_0x308eb2[_0x7730('0x19')]?_0x308eb2[_0x7730('0x19')]['where']||null:null,'attributes':_0x308eb2[_0x7730('0x19')]?_0x308eb2[_0x7730('0x19')]['attributes']||null:null,'limit':_0x308eb2['options']?_0x308eb2[_0x7730('0x19')]['limit']||null:null,'include':_0x308eb2[_0x7730('0x19')]?_0x308eb2['options']['include']?_[_0x7730('0x1a')](_0x308eb2[_0x7730('0x19')][_0x7730('0x1b')],function(_0x37868c){return{'model':db[_0x37868c[_0x7730('0x1c')]],'as':_0x37868c['as'],'attributes':_0x37868c[_0x7730('0x1d')],'include':_0x37868c[_0x7730('0x1b')]?_[_0x7730('0x1a')](_0x37868c['include'],function(_0x48c954){return{'model':db[_0x48c954[_0x7730('0x1c')]],'as':_0x48c954['as'],'attributes':_0x48c954[_0x7730('0x1d')],'include':_0x48c954[_0x7730('0x1b')]?_['map'](_0x48c954[_0x7730('0x1b')],function(_0x450ee3){return{'model':db[_0x450ee3[_0x7730('0x1c')]],'as':_0x450ee3['as'],'attributes':_0x450ee3[_0x7730('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7730('0xb')](function(_0x33dc65){logger['info'](_0x7730('0x16'),_0x308eb2);logger[_0x7730('0xd')]('GetVoiceQueueReport',_0x308eb2,JSON['stringify'](_0x33dc65));_0x2eb24f(_0x33dc65);})[_0x7730('0x15')](function(_0x10c50d){logger[_0x7730('0x11')]('GetVoiceQueueReport',_0x10c50d['message'],_0x308eb2);_0x4b5539(_0x17c7f6['error'](0x1f4,_0x10c50d[_0x7730('0x13')]));});});};exports[_0x7730('0x1e')]=function(_0x462f5c){var _0x5a9595=this;return new Promise(function(_0x54d58d,_0x3f5d1f){return db[_0x7730('0x17')][_0x7730('0x1f')](_0x462f5c[_0x7730('0x20')],{'raw':_0x462f5c[_0x7730('0x19')]?_0x462f5c[_0x7730('0x19')][_0x7730('0x21')]===undefined?!![]:![]:!![]})[_0x7730('0xb')](function(_0xd485e9){logger[_0x7730('0xc')](_0x7730('0x1e'),_0x462f5c);logger[_0x7730('0xd')](_0x7730('0x1e'),_0x462f5c,JSON[_0x7730('0x22')](_0xd485e9));_0x54d58d(_0xd485e9);})[_0x7730('0x15')](function(_0x30e836){logger[_0x7730('0x11')](_0x7730('0x1e'),_0x30e836['message'],_0x462f5c);_0x3f5d1f(_0x5a9595[_0x7730('0x11')](0x1f4,_0x30e836['message']));});});};exports['UpdateVoiceQueueReport']=function(_0x96f85e){var _0x5ca10d=this;return new Promise(function(_0x530670,_0x49f9dc){return db['VoiceQueueReport'][_0x7730('0x23')](_0x96f85e[_0x7730('0x20')],{'raw':_0x96f85e[_0x7730('0x19')]?_0x96f85e[_0x7730('0x19')][_0x7730('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x96f85e[_0x7730('0x19')]?_0x96f85e[_0x7730('0x19')][_0x7730('0x24')]||null:null,'attributes':_0x96f85e[_0x7730('0x19')]?_0x96f85e[_0x7730('0x19')][_0x7730('0x1d')]||null:null,'limit':_0x96f85e[_0x7730('0x19')]?_0x96f85e[_0x7730('0x19')][_0x7730('0x25')]||null:null})[_0x7730('0xb')](function(_0x32440b){logger[_0x7730('0xc')](_0x7730('0x26'),_0x96f85e);logger[_0x7730('0xd')](_0x7730('0x26'),_0x96f85e,JSON[_0x7730('0x22')](_0x32440b));_0x530670(_0x32440b);})['catch'](function(_0x50807f){logger[_0x7730('0x11')](_0x7730('0x26'),_0x50807f['message'],_0x96f85e);_0x49f9dc(_0x5ca10d['error'](0x1f4,_0x50807f['message']));});});};
\ No newline at end of file
+var _0xc755=['redis','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','limit','include','map','model','attributes','debug','stringify','create','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xc755,0x73));var _0x5c75=function(_0x14fd4a,_0x5aefb4){_0x14fd4a=_0x14fd4a-0x0;var _0x4276cb=_0xc755[_0x14fd4a];return _0x4276cb;};'use strict';var _=require(_0x5c75('0x0'));var util=require('util');var moment=require(_0x5c75('0x1'));var BPromise=require(_0x5c75('0x2'));var rs=require(_0x5c75('0x3'));var fs=require('fs');var Redis=require(_0x5c75('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5c75('0x5'));var logger=require(_0x5c75('0x6'))('rpc');var config=require(_0x5c75('0x7'));var jayson=require(_0x5c75('0x8'));var client=jayson[_0x5c75('0x9')][_0x5c75('0xa')]({'port':0x232a});config['redis']=_[_0x5c75('0xb')](config['redis'],{'host':_0x5c75('0xc'),'port':0x18eb});var socket=require(_0x5c75('0xd'))(new Redis(config[_0x5c75('0xe')]));require(_0x5c75('0xf'))[_0x5c75('0x10')](socket);function respondWithRpcPromise(_0x219161,_0x117287,_0x106ec3){return new BPromise(function(_0x4483fd,_0x48b3c5){return client[_0x5c75('0x11')](_0x219161,_0x106ec3)[_0x5c75('0x12')](function(_0x2d6e45){logger[_0x5c75('0x13')](_0x5c75('0x14'),_0x117287,'request\x20sent');logger['debug'](_0x5c75('0x15'),_0x117287,'request\x20sent',JSON['stringify'](_0x2d6e45));if(_0x2d6e45[_0x5c75('0x16')]){if(_0x2d6e45[_0x5c75('0x16')][_0x5c75('0x17')]===0x1f4){logger[_0x5c75('0x16')](_0x5c75('0x14'),_0x117287,_0x2d6e45[_0x5c75('0x16')]['message']);return _0x48b3c5(_0x2d6e45['error']['message']);}logger[_0x5c75('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x117287,_0x2d6e45[_0x5c75('0x16')][_0x5c75('0x18')]);return _0x4483fd(_0x2d6e45['error'][_0x5c75('0x18')]);}else{logger['info'](_0x5c75('0x14'),_0x117287,_0x5c75('0x19'));_0x4483fd(_0x2d6e45['result'][_0x5c75('0x18')]);}})[_0x5c75('0x1a')](function(_0x4837b6){logger[_0x5c75('0x16')](_0x5c75('0x14'),_0x117287,_0x4837b6);_0x48b3c5(_0x4837b6);});});}exports[_0x5c75('0x1b')]=function(_0x360fa0){var _0x3cb1c2=this;return new Promise(function(_0xca078c,_0x3d5964){return db[_0x5c75('0x1c')]['findAll']({'raw':_0x360fa0[_0x5c75('0x1d')]?_0x360fa0[_0x5c75('0x1d')][_0x5c75('0x1e')]===undefined?!![]:![]:!![],'where':_0x360fa0[_0x5c75('0x1d')]?_0x360fa0[_0x5c75('0x1d')][_0x5c75('0x1f')]||null:null,'attributes':_0x360fa0[_0x5c75('0x1d')]?_0x360fa0[_0x5c75('0x1d')]['attributes']||null:null,'limit':_0x360fa0[_0x5c75('0x1d')]?_0x360fa0[_0x5c75('0x1d')][_0x5c75('0x20')]||null:null,'include':_0x360fa0[_0x5c75('0x1d')]?_0x360fa0['options'][_0x5c75('0x21')]?_[_0x5c75('0x22')](_0x360fa0[_0x5c75('0x1d')]['include'],function(_0x523244){return{'model':db[_0x523244[_0x5c75('0x23')]],'as':_0x523244['as'],'attributes':_0x523244[_0x5c75('0x24')],'include':_0x523244['include']?_[_0x5c75('0x22')](_0x523244[_0x5c75('0x21')],function(_0x3934a0){return{'model':db[_0x3934a0[_0x5c75('0x23')]],'as':_0x3934a0['as'],'attributes':_0x3934a0[_0x5c75('0x24')],'include':_0x3934a0[_0x5c75('0x21')]?_[_0x5c75('0x22')](_0x3934a0[_0x5c75('0x21')],function(_0x2e4bdd){return{'model':db[_0x2e4bdd['model']],'as':_0x2e4bdd['as'],'attributes':_0x2e4bdd['attributes']};}):[]};}):[]};}):[]:[]})[_0x5c75('0x12')](function(_0x443f7c){logger['info'](_0x5c75('0x1b'),_0x360fa0);logger[_0x5c75('0x25')](_0x5c75('0x1b'),_0x360fa0,JSON[_0x5c75('0x26')](_0x443f7c));_0xca078c(_0x443f7c);})[_0x5c75('0x1a')](function(_0x8b9ec3){logger[_0x5c75('0x16')]('GetVoiceQueueReport',_0x8b9ec3[_0x5c75('0x18')],_0x360fa0);_0x3d5964(_0x3cb1c2[_0x5c75('0x16')](0x1f4,_0x8b9ec3[_0x5c75('0x18')]));});});};exports['CreateVoiceQueueReport']=function(_0x299463){var _0x23d8e2=this;return new Promise(function(_0xe006a9,_0x3bf8d5){return db['VoiceQueueReport'][_0x5c75('0x27')](_0x299463['body'],{'raw':_0x299463[_0x5c75('0x1d')]?_0x299463[_0x5c75('0x1d')][_0x5c75('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x17ad0d){logger[_0x5c75('0x13')](_0x5c75('0x28'),_0x299463);logger[_0x5c75('0x25')]('CreateVoiceQueueReport',_0x299463,JSON[_0x5c75('0x26')](_0x17ad0d));_0xe006a9(_0x17ad0d);})[_0x5c75('0x1a')](function(_0x28bed9){logger[_0x5c75('0x16')](_0x5c75('0x28'),_0x28bed9[_0x5c75('0x18')],_0x299463);_0x3bf8d5(_0x23d8e2['error'](0x1f4,_0x28bed9['message']));});});};exports[_0x5c75('0x29')]=function(_0x4c37a5){var _0x5b1d4d=this;return new Promise(function(_0x40a42f,_0x326930){return db[_0x5c75('0x1c')][_0x5c75('0x2a')](_0x4c37a5['body'],{'raw':_0x4c37a5['options']?_0x4c37a5[_0x5c75('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c37a5['options']?_0x4c37a5[_0x5c75('0x1d')][_0x5c75('0x1f')]||null:null,'attributes':_0x4c37a5[_0x5c75('0x1d')]?_0x4c37a5['options'][_0x5c75('0x24')]||null:null,'limit':_0x4c37a5[_0x5c75('0x1d')]?_0x4c37a5[_0x5c75('0x1d')][_0x5c75('0x20')]||null:null})[_0x5c75('0x12')](function(_0x39ee44){logger[_0x5c75('0x13')](_0x5c75('0x29'),_0x4c37a5);logger[_0x5c75('0x25')]('UpdateVoiceQueueReport',_0x4c37a5,JSON[_0x5c75('0x26')](_0x39ee44));_0x40a42f(_0x39ee44);})[_0x5c75('0x1a')](function(_0x1585ea){logger[_0x5c75('0x16')](_0x5c75('0x29'),_0x1585ea[_0x5c75('0x18')],_0x4c37a5);_0x326930(_0x5b1d4d[_0x5c75('0x16')](0x1f4,_0x1585ea[_0x5c75('0x18')]));});});};
\ No newline at end of file
index cd174a1..edc598a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe070=['length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','register'];(function(_0x2f15ef,_0x45e669){var _0x461234=function(_0x40ea87){while(--_0x40ea87){_0x2f15ef['push'](_0x2f15ef['shift']());}};_0x461234(++_0x45e669);}(_0xe070,0x167));var _0x0e07=function(_0x54cef6,_0x146b0e){_0x54cef6=_0x54cef6-0x0;var _0x39aacf=_0xe070[_0x54cef6];return _0x39aacf;};'use strict';var VoiceQueueReportEvents=require(_0x0e07('0x0'));var events=[_0x0e07('0x1'),_0x0e07('0x2'),_0x0e07('0x3')];function createListener(_0x4529ee,_0x3b6b10){return function(_0x20a8cc){_0x3b6b10['emit'](_0x4529ee,_0x20a8cc);};}function removeListener(_0x4a9411,_0x32c778){return function(){VoiceQueueReportEvents['removeListener'](_0x4a9411,_0x32c778);};}exports[_0x0e07('0x4')]=function(_0x25eda2){for(var _0x2426ea=0x0,_0x161dcb=events[_0x0e07('0x5')];_0x2426ea<_0x161dcb;_0x2426ea++){var _0x202584=events[_0x2426ea];var _0x20c35a=createListener(_0x0e07('0x6')+_0x202584,_0x25eda2);VoiceQueueReportEvents['on'](_0x202584,_0x20c35a);}};
\ No newline at end of file
+var _0xb046=['emit','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove'];(function(_0x572cd1,_0x4cdf51){var _0x4ff28e=function(_0x2b60fe){while(--_0x2b60fe){_0x572cd1['push'](_0x572cd1['shift']());}};_0x4ff28e(++_0x4cdf51);}(_0xb046,0x1a1));var _0x6b04=function(_0x3afe18,_0x26922c){_0x3afe18=_0x3afe18-0x0;var _0x19ed1f=_0xb046[_0x3afe18];return _0x19ed1f;};'use strict';var VoiceQueueReportEvents=require(_0x6b04('0x0'));var events=[_0x6b04('0x1'),_0x6b04('0x2'),'update'];function createListener(_0x2c1a53,_0x3a2a7a){return function(_0x45640e){_0x3a2a7a[_0x6b04('0x3')](_0x2c1a53,_0x45640e);};}function removeListener(_0x5885a6,_0x53044b){return function(){VoiceQueueReportEvents['removeListener'](_0x5885a6,_0x53044b);};}exports[_0x6b04('0x4')]=function(_0x4f97cf){for(var _0x389dc0=0x0,_0x23f882=events[_0x6b04('0x5')];_0x389dc0<_0x23f882;_0x389dc0++){var _0x4d6606=events[_0x389dc0];var _0x414a80=createListener(_0x6b04('0x6')+_0x4d6606,_0x4f97cf);VoiceQueueReportEvents['on'](_0x4d6606,_0x414a80);}};
\ No newline at end of file
index 8a2c9c1..247adf1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4d87=['put','/:id','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','./voiceQueuesLog.controller','get','isAuthenticated','index','show','post','create'];(function(_0x527cce,_0x5cfd75){var _0x2800e5=function(_0x2c6f81){while(--_0x2c6f81){_0x527cce['push'](_0x527cce['shift']());}};_0x2800e5(++_0x5cfd75);}(_0x4d87,0xf0));var _0x74d8=function(_0xdaf36c,_0x49e21a){_0xdaf36c=_0xdaf36c-0x0;var _0x4f3572=_0x4d87[_0xdaf36c];return _0x4f3572;};'use strict';var multer=require('multer');var util=require(_0x74d8('0x0'));var path=require(_0x74d8('0x1'));var timeout=require(_0x74d8('0x2'));var express=require('express');var router=express[_0x74d8('0x3')]();var auth=require(_0x74d8('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x74d8('0x5'));router[_0x74d8('0x6')]('/',auth[_0x74d8('0x7')](),controller[_0x74d8('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x74d8('0x9')]);router[_0x74d8('0xa')]('/',auth[_0x74d8('0x7')](),controller[_0x74d8('0xb')]);router[_0x74d8('0xc')](_0x74d8('0xd'),auth['isAuthenticated'](),controller[_0x74d8('0xe')]);router[_0x74d8('0xf')](_0x74d8('0xd'),auth[_0x74d8('0x7')](),controller[_0x74d8('0x10')]);module[_0x74d8('0x11')]=router;
\ No newline at end of file
+var _0x077e=['show','post','create','put','update','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id'];(function(_0xc4dfc3,_0x1a3846){var _0x2173c5=function(_0x32dce9){while(--_0x32dce9){_0xc4dfc3['push'](_0xc4dfc3['shift']());}};_0x2173c5(++_0x1a3846);}(_0x077e,0x14a));var _0xe077=function(_0x2dd91a,_0x652477){_0x2dd91a=_0x2dd91a-0x0;var _0x43ee25=_0x077e[_0x2dd91a];return _0x43ee25;};'use strict';var multer=require(_0xe077('0x0'));var util=require(_0xe077('0x1'));var path=require(_0xe077('0x2'));var timeout=require(_0xe077('0x3'));var express=require('express');var router=express[_0xe077('0x4')]();var auth=require(_0xe077('0x5'));var interaction=require(_0xe077('0x6'));var config=require('../../config/environment');var controller=require(_0xe077('0x7'));router[_0xe077('0x8')]('/',auth[_0xe077('0x9')](),controller[_0xe077('0xa')]);router[_0xe077('0x8')](_0xe077('0xb'),auth[_0xe077('0x9')](),controller[_0xe077('0xc')]);router[_0xe077('0xd')]('/',auth[_0xe077('0x9')](),controller[_0xe077('0xe')]);router[_0xe077('0xf')]('/:id',auth[_0xe077('0x9')](),controller[_0xe077('0x10')]);router['delete'](_0xe077('0xb'),auth['isAuthenticated'](),controller[_0xe077('0x11')]);module['exports']=router;
\ No newline at end of file
index 558ba5f..b0a0cd1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x425d=['sequelize','exports','STRING','DATE','format'];(function(_0x53645c,_0x3f2dde){var _0x5a22ed=function(_0x1754fa){while(--_0x1754fa){_0x53645c['push'](_0x53645c['shift']());}};_0x5a22ed(++_0x3f2dde);}(_0x425d,0x1e0));var _0xd425=function(_0xad921d,_0x4e852b){_0xad921d=_0xad921d-0x0;var _0x50a737=_0x425d[_0xad921d];return _0x50a737;};'use strict';var Sequelize=require(_0xd425('0x0'));var moment=require('moment');module[_0xd425('0x1')]={'time':{'type':Sequelize[_0xd425('0x2')]},'callid':{'type':Sequelize[_0xd425('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xd425('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xd425('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xd425('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xd425('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xd425('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xd425('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xd425('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xd425('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xd425('0x3')],'allowNull':![],'defaultValue':moment()[_0xd425('0x4')]('YYYY-MM-DD\x20HH:mm:ss')}};
\ No newline at end of file
+var _0x9c5a=['moment','STRING','DATE','sequelize'];(function(_0x20294b,_0x2596e7){var _0x3bffde=function(_0x4c37a6){while(--_0x4c37a6){_0x20294b['push'](_0x20294b['shift']());}};_0x3bffde(++_0x2596e7);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x354fed,_0x14a5ee){_0x354fed=_0x354fed-0x0;var _0x3c9576=_0x9c5a[_0x354fed];return _0x3c9576;};'use strict';var Sequelize=require(_0xa9c5('0x0'));var moment=require(_0xa9c5('0x1'));module['exports']={'time':{'type':Sequelize[_0xa9c5('0x2')]},'callid':{'type':Sequelize[_0xa9c5('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xa9c5('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xa9c5('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xa9c5('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xa9c5('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xa9c5('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xa9c5('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa9c5('0x3')],'allowNull':![],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}};
\ No newline at end of file
index 358469c..56fba00 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0e4c=['order','sort','pick','filter','where','merge','map','VIRTUAL','field','options','count','includeAll','findAll','rows','catch','show','length','include','find','create','body','params','html-pdf','rimraf','path','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','status','end','json','offset','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','VoiceQueuesLog','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0e4c,0x147));var _0xc0e4=function(_0x9deaba,_0x3ef688){_0x9deaba=_0x9deaba-0x0;var _0x438d83=_0x0e4c[_0x9deaba];return _0x438d83;};'use strict';var pdf=require(_0xc0e4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc0e4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc0e4('0x2'));var sox=require('sox');var csv=require(_0xc0e4('0x3'));var ejs=require(_0xc0e4('0x4'));var fs=require('fs');var _=require(_0xc0e4('0x5'));var squel=require(_0xc0e4('0x6'));var crypto=require(_0xc0e4('0x7'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc0e4('0x8'));var authService=require(_0xc0e4('0x9'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0xc0e4('0xa'));var logger=require(_0xc0e4('0xb'))('api');var utils=require(_0xc0e4('0xc'));var config=require(_0xc0e4('0xd'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1381e3,_0x111c95){_0x111c95=_0x111c95||0xcc;return function(_0x5be137){if(_0x5be137){return _0x1381e3['sendStatus'](_0x111c95);}return _0x1381e3[_0xc0e4('0xe')](_0x111c95)[_0xc0e4('0xf')]();};}function respondWithResult(_0x56c767,_0x38b0d4){_0x38b0d4=_0x38b0d4||0xc8;return function(_0x3ba550){if(_0x3ba550){return _0x56c767['status'](_0x38b0d4)[_0xc0e4('0x10')](_0x3ba550);}};}function respondWithFilteredResult(_0x281130,_0x46b9de){return function(_0x3e3e84){if(_0x3e3e84){var _0x3dae58=_0x3e3e84['count'],_0x28c151=_0x46b9de[_0xc0e4('0x11')],_0x5099e6=_0x46b9de[_0xc0e4('0x11')]+_0x46b9de['limit'],_0x3a5269;if(_0x5099e6>=_0x3dae58){_0x5099e6=_0x3dae58;_0x3a5269=0xc8;}else{_0x3a5269=0xce;}_0x281130[_0xc0e4('0xe')](_0x3a5269);return _0x281130['set']('Content-Range',_0x28c151+'-'+_0x5099e6+'/'+_0x3dae58)[_0xc0e4('0x10')](_0x3e3e84);}return null;};}function patchUpdates(_0xffa9d8){return function(_0x14c43b){try{jsonpatch[_0xc0e4('0x12')](_0x14c43b,_0xffa9d8,!![]);}catch(_0x1f7cc2){return BPromise[_0xc0e4('0x13')](_0x1f7cc2);}return _0x14c43b['save']();};}function saveUpdates(_0x57a6ff,_0xa40c6a){return function(_0x5eb8e4){if(_0x5eb8e4){return _0x5eb8e4[_0xc0e4('0x14')](_0x57a6ff)[_0xc0e4('0x15')](function(_0x1bdfe0){return _0x1bdfe0;});}return null;};}function removeEntity(_0x3756ab,_0x4d4dd4){return function(_0x57ce14){if(_0x57ce14){return _0x57ce14[_0xc0e4('0x16')]()[_0xc0e4('0x15')](function(){_0x3756ab['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x380b14,_0xa44c6a){return function(_0x191fc6){if(!_0x191fc6){_0x380b14[_0xc0e4('0x17')](0x194);}return _0x191fc6;};}function handleError(_0x1ceff3,_0xf939f3){_0xf939f3=_0xf939f3||0x1f4;return function(_0x43fa11){logger[_0xc0e4('0x18')](_0x43fa11[_0xc0e4('0x19')]);if(_0x43fa11[_0xc0e4('0x1a')]){delete _0x43fa11[_0xc0e4('0x1a')];}_0x1ceff3['status'](_0xf939f3)['send'](_0x43fa11);};}exports[_0xc0e4('0x1b')]=function(_0x4e09b7,_0x32e252){var _0x1a3675={},_0x1310b0={},_0x50de49={'count':0x0,'rows':[]};var _0x185584=db[_0xc0e4('0x1c')]['rawAttributes'];_0x1310b0[_0xc0e4('0x1d')]=_[_0xc0e4('0x1e')](_0x185584);_0x1310b0[_0xc0e4('0x1f')]=_[_0xc0e4('0x1e')](_0x4e09b7[_0xc0e4('0x1f')]);_0x1310b0[_0xc0e4('0x20')]=_[_0xc0e4('0x21')](_0x1310b0[_0xc0e4('0x1d')],_0x1310b0['query']);_0x1a3675[_0xc0e4('0x22')]=_[_0xc0e4('0x21')](_0x1310b0[_0xc0e4('0x1d')],qs[_0xc0e4('0x23')](_0x4e09b7['query']['fields']));_0x1a3675['attributes']=_0x1a3675[_0xc0e4('0x22')]['length']?_0x1a3675[_0xc0e4('0x22')]:_0x1310b0[_0xc0e4('0x1d')];if(!_0x4e09b7['query'][_0xc0e4('0x24')](_0xc0e4('0x25'))){_0x1a3675[_0xc0e4('0x26')]=qs['limit'](_0x4e09b7[_0xc0e4('0x1f')][_0xc0e4('0x26')]);_0x1a3675['offset']=qs[_0xc0e4('0x11')](_0x4e09b7['query'][_0xc0e4('0x11')]);}_0x1a3675[_0xc0e4('0x27')]=qs[_0xc0e4('0x28')](_0x4e09b7[_0xc0e4('0x1f')][_0xc0e4('0x28')]);_0x1a3675['where']=qs[_0xc0e4('0x20')](_[_0xc0e4('0x29')](_0x4e09b7['query'],_0x1310b0['filters']));if(_0x4e09b7[_0xc0e4('0x1f')][_0xc0e4('0x2a')]){_0x1a3675[_0xc0e4('0x2b')]=_[_0xc0e4('0x2c')](_0x1a3675[_0xc0e4('0x2b')],{'$or':_[_0xc0e4('0x2d')](_0x185584,function(_0x25b7e3){if(_0x25b7e3['type']['key']!==_0xc0e4('0x2e')){var _0x5d6d1b={};_0x5d6d1b[_0x25b7e3[_0xc0e4('0x2f')]]={'$like':'%'+_0x4e09b7[_0xc0e4('0x1f')][_0xc0e4('0x2a')]+'%'};return _0x5d6d1b;}})});}_0x1a3675=_['merge']({},_0x1a3675,_0x4e09b7[_0xc0e4('0x30')]);var _0x1b2d7a={'where':_0x1a3675[_0xc0e4('0x2b')]};return db['VoiceQueuesLog'][_0xc0e4('0x31')](_0x1b2d7a)['then'](function(_0x3b6120){_0x50de49[_0xc0e4('0x31')]=_0x3b6120;if(_0x4e09b7[_0xc0e4('0x1f')][_0xc0e4('0x32')]){_0x1a3675['include']=[{'all':!![]}];}return db[_0xc0e4('0x1c')][_0xc0e4('0x33')](_0x1a3675);})['then'](function(_0x5944af){_0x50de49[_0xc0e4('0x34')]=_0x5944af;return _0x50de49;})['then'](respondWithFilteredResult(_0x32e252,_0x1a3675))[_0xc0e4('0x35')](handleError(_0x32e252,null));};exports[_0xc0e4('0x36')]=function(_0x3b0b4b,_0x1bca20){var _0x3cec8a={'raw':!![],'where':{'id':_0x3b0b4b['params']['id']}},_0x1c78f8={};_0x1c78f8[_0xc0e4('0x1d')]=_['keys'](db[_0xc0e4('0x1c')]['rawAttributes']);_0x1c78f8[_0xc0e4('0x1f')]=_[_0xc0e4('0x1e')](_0x3b0b4b[_0xc0e4('0x1f')]);_0x1c78f8[_0xc0e4('0x20')]=_['intersection'](_0x1c78f8[_0xc0e4('0x1d')],_0x1c78f8[_0xc0e4('0x1f')]);_0x3cec8a[_0xc0e4('0x22')]=_[_0xc0e4('0x21')](_0x1c78f8[_0xc0e4('0x1d')],qs[_0xc0e4('0x23')](_0x3b0b4b[_0xc0e4('0x1f')][_0xc0e4('0x23')]));_0x3cec8a[_0xc0e4('0x22')]=_0x3cec8a['attributes'][_0xc0e4('0x37')]?_0x3cec8a['attributes']:_0x1c78f8[_0xc0e4('0x1d')];if(_0x3b0b4b[_0xc0e4('0x1f')][_0xc0e4('0x32')]){_0x3cec8a[_0xc0e4('0x38')]=[{'all':!![]}];}_0x3cec8a=_[_0xc0e4('0x2c')]({},_0x3cec8a,_0x3b0b4b[_0xc0e4('0x30')]);return db['VoiceQueuesLog'][_0xc0e4('0x39')](_0x3cec8a)[_0xc0e4('0x15')](handleEntityNotFound(_0x1bca20,null))[_0xc0e4('0x15')](respondWithResult(_0x1bca20,null))[_0xc0e4('0x35')](handleError(_0x1bca20,null));};exports['create']=function(_0x57e967,_0x86712a){return db[_0xc0e4('0x1c')][_0xc0e4('0x3a')](_0x57e967[_0xc0e4('0x3b')],{})[_0xc0e4('0x15')](respondWithResult(_0x86712a,0xc9))[_0xc0e4('0x35')](handleError(_0x86712a,null));};exports[_0xc0e4('0x14')]=function(_0x42c122,_0x364ba8){if(_0x42c122[_0xc0e4('0x3b')]['id']){delete _0x42c122[_0xc0e4('0x3b')]['id'];}return db[_0xc0e4('0x1c')]['find']({'where':{'id':_0x42c122[_0xc0e4('0x3c')]['id']}})[_0xc0e4('0x15')](handleEntityNotFound(_0x364ba8,null))[_0xc0e4('0x15')](saveUpdates(_0x42c122['body'],null))[_0xc0e4('0x15')](respondWithResult(_0x364ba8,null))['catch'](handleError(_0x364ba8,null));};exports['destroy']=function(_0x3e6150,_0x56860f){return db['VoiceQueuesLog'][_0xc0e4('0x39')]({'where':{'id':_0x3e6150['params']['id']}})['then'](handleEntityNotFound(_0x56860f,null))[_0xc0e4('0x15')](removeEntity(_0x56860f,null))[_0xc0e4('0x35')](handleError(_0x56860f,null));};
\ No newline at end of file
+var _0xb1db=['body','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','limit','set','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','VoiceQueuesLog','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','field','count','includeAll','findAll','rows','show','params','include','options','find','create'];(function(_0x55a10b,_0x5d8cf5){var _0x344472=function(_0x5bfe34){while(--_0x5bfe34){_0x55a10b['push'](_0x55a10b['shift']());}};_0x344472(++_0x5d8cf5);}(_0xb1db,0x1be));var _0xbb1d=function(_0x57a6e5,_0x57d7e9){_0x57a6e5=_0x57a6e5-0x0;var _0x540d07=_0xb1db[_0x57a6e5];return _0x540d07;};'use strict';var pdf=require(_0xbb1d('0x0'));var emlformat=require(_0xbb1d('0x1'));var rimraf=require(_0xbb1d('0x2'));var zipdir=require(_0xbb1d('0x3'));var jsonpatch=require(_0xbb1d('0x4'));var rp=require('request-promise');var moment=require(_0xbb1d('0x5'));var BPromise=require(_0xbb1d('0x6'));var Mustache=require('mustache');var util=require(_0xbb1d('0x7'));var path=require(_0xbb1d('0x8'));var sox=require(_0xbb1d('0x9'));var csv=require(_0xbb1d('0xa'));var ejs=require(_0xbb1d('0xb'));var fs=require('fs');var _=require(_0xbb1d('0xc'));var squel=require(_0xbb1d('0xd'));var crypto=require(_0xbb1d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xbb1d('0xf'));var toCsv=require(_0xbb1d('0xa'));var querystring=require(_0xbb1d('0x10'));var Papa=require(_0xbb1d('0x11'));var authService=require(_0xbb1d('0x12'));var hardwareService=require(_0xbb1d('0x13'));var Redis=require(_0xbb1d('0x14'));var qs=require(_0xbb1d('0x15'));var logger=require(_0xbb1d('0x16'))(_0xbb1d('0x17'));var utils=require('../../config/utils');var config=require(_0xbb1d('0x18'));var db=require(_0xbb1d('0x19'))['db'];function respondWithStatusCode(_0x374109,_0x1f8d8c){_0x1f8d8c=_0x1f8d8c||0xcc;return function(_0x458a47){if(_0x458a47){return _0x374109['sendStatus'](_0x1f8d8c);}return _0x374109[_0xbb1d('0x1a')](_0x1f8d8c)['end']();};}function respondWithResult(_0x584fd0,_0x21ad10){_0x21ad10=_0x21ad10||0xc8;return function(_0x32a9a5){if(_0x32a9a5){return _0x584fd0[_0xbb1d('0x1a')](_0x21ad10)[_0xbb1d('0x1b')](_0x32a9a5);}};}function respondWithFilteredResult(_0x261df4,_0xc1a2a){return function(_0x2e44bb){if(_0x2e44bb){var _0x53e449=_0x2e44bb['count'],_0x5c5f78=_0xc1a2a['offset'],_0x4e01e7=_0xc1a2a[_0xbb1d('0x1c')]+_0xc1a2a[_0xbb1d('0x1d')],_0x5368d9;if(_0x4e01e7>=_0x53e449){_0x4e01e7=_0x53e449;_0x5368d9=0xc8;}else{_0x5368d9=0xce;}_0x261df4[_0xbb1d('0x1a')](_0x5368d9);return _0x261df4[_0xbb1d('0x1e')](_0xbb1d('0x1f'),_0x5c5f78+'-'+_0x4e01e7+'/'+_0x53e449)[_0xbb1d('0x1b')](_0x2e44bb);}return null;};}function patchUpdates(_0x2f7c5d){return function(_0x32df0f){try{jsonpatch[_0xbb1d('0x20')](_0x32df0f,_0x2f7c5d,!![]);}catch(_0x45172b){return BPromise[_0xbb1d('0x21')](_0x45172b);}return _0x32df0f['save']();};}function saveUpdates(_0x2dffbf,_0x30022a){return function(_0x33fde7){if(_0x33fde7){return _0x33fde7[_0xbb1d('0x22')](_0x2dffbf)['then'](function(_0x30faba){return _0x30faba;});}return null;};}function removeEntity(_0x31b4ea,_0x84edbb){return function(_0x4ef1a7){if(_0x4ef1a7){return _0x4ef1a7[_0xbb1d('0x23')]()[_0xbb1d('0x24')](function(){_0x31b4ea[_0xbb1d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55b5b0,_0xd7b612){return function(_0x26c4ec){if(!_0x26c4ec){_0x55b5b0[_0xbb1d('0x25')](0x194);}return _0x26c4ec;};}function handleError(_0x5c8575,_0x57e036){_0x57e036=_0x57e036||0x1f4;return function(_0x48a71b){logger[_0xbb1d('0x26')](_0x48a71b[_0xbb1d('0x27')]);if(_0x48a71b[_0xbb1d('0x28')]){delete _0x48a71b[_0xbb1d('0x28')];}_0x5c8575[_0xbb1d('0x1a')](_0x57e036)[_0xbb1d('0x29')](_0x48a71b);};}exports[_0xbb1d('0x2a')]=function(_0x4e97b0,_0x11d9c4){var _0x458800={},_0x24cd2f={},_0x479a57={'count':0x0,'rows':[]};var _0x9f605e=db[_0xbb1d('0x2b')][_0xbb1d('0x2c')];_0x24cd2f[_0xbb1d('0x2d')]=_[_0xbb1d('0x2e')](_0x9f605e);_0x24cd2f['query']=_[_0xbb1d('0x2e')](_0x4e97b0[_0xbb1d('0x2f')]);_0x24cd2f['filters']=_[_0xbb1d('0x30')](_0x24cd2f[_0xbb1d('0x2d')],_0x24cd2f['query']);_0x458800[_0xbb1d('0x31')]=_[_0xbb1d('0x30')](_0x24cd2f[_0xbb1d('0x2d')],qs['fields'](_0x4e97b0[_0xbb1d('0x2f')][_0xbb1d('0x32')]));_0x458800[_0xbb1d('0x31')]=_0x458800[_0xbb1d('0x31')][_0xbb1d('0x33')]?_0x458800[_0xbb1d('0x31')]:_0x24cd2f[_0xbb1d('0x2d')];if(!_0x4e97b0['query'][_0xbb1d('0x34')](_0xbb1d('0x35'))){_0x458800[_0xbb1d('0x1d')]=qs[_0xbb1d('0x1d')](_0x4e97b0['query'][_0xbb1d('0x1d')]);_0x458800[_0xbb1d('0x1c')]=qs[_0xbb1d('0x1c')](_0x4e97b0[_0xbb1d('0x2f')][_0xbb1d('0x1c')]);}_0x458800['order']=qs[_0xbb1d('0x36')](_0x4e97b0['query'][_0xbb1d('0x36')]);_0x458800[_0xbb1d('0x37')]=qs['filters'](_[_0xbb1d('0x38')](_0x4e97b0['query'],_0x24cd2f[_0xbb1d('0x39')]));if(_0x4e97b0[_0xbb1d('0x2f')][_0xbb1d('0x3a')]){_0x458800[_0xbb1d('0x37')]=_[_0xbb1d('0x3b')](_0x458800[_0xbb1d('0x37')],{'$or':_['map'](_0x9f605e,function(_0x24cd29){if(_0x24cd29[_0xbb1d('0x3c')]['key']!=='VIRTUAL'){var _0x1b2f76={};_0x1b2f76[_0x24cd29[_0xbb1d('0x3d')]]={'$like':'%'+_0x4e97b0[_0xbb1d('0x2f')][_0xbb1d('0x3a')]+'%'};return _0x1b2f76;}})});}_0x458800=_[_0xbb1d('0x3b')]({},_0x458800,_0x4e97b0['options']);var _0x300232={'where':_0x458800['where']};return db[_0xbb1d('0x2b')][_0xbb1d('0x3e')](_0x300232)[_0xbb1d('0x24')](function(_0x219bdc){_0x479a57[_0xbb1d('0x3e')]=_0x219bdc;if(_0x4e97b0[_0xbb1d('0x2f')][_0xbb1d('0x3f')]){_0x458800['include']=[{'all':!![]}];}return db[_0xbb1d('0x2b')][_0xbb1d('0x40')](_0x458800);})[_0xbb1d('0x24')](function(_0x1be102){_0x479a57[_0xbb1d('0x41')]=_0x1be102;return _0x479a57;})[_0xbb1d('0x24')](respondWithFilteredResult(_0x11d9c4,_0x458800))['catch'](handleError(_0x11d9c4,null));};exports[_0xbb1d('0x42')]=function(_0x6ad153,_0x546321){var _0x5d03b1={'raw':!![],'where':{'id':_0x6ad153[_0xbb1d('0x43')]['id']}},_0x2a83b5={};_0x2a83b5[_0xbb1d('0x2d')]=_['keys'](db[_0xbb1d('0x2b')]['rawAttributes']);_0x2a83b5[_0xbb1d('0x2f')]=_['keys'](_0x6ad153[_0xbb1d('0x2f')]);_0x2a83b5[_0xbb1d('0x39')]=_[_0xbb1d('0x30')](_0x2a83b5['model'],_0x2a83b5[_0xbb1d('0x2f')]);_0x5d03b1[_0xbb1d('0x31')]=_[_0xbb1d('0x30')](_0x2a83b5[_0xbb1d('0x2d')],qs[_0xbb1d('0x32')](_0x6ad153[_0xbb1d('0x2f')][_0xbb1d('0x32')]));_0x5d03b1['attributes']=_0x5d03b1[_0xbb1d('0x31')][_0xbb1d('0x33')]?_0x5d03b1[_0xbb1d('0x31')]:_0x2a83b5[_0xbb1d('0x2d')];if(_0x6ad153['query'][_0xbb1d('0x3f')]){_0x5d03b1[_0xbb1d('0x44')]=[{'all':!![]}];}_0x5d03b1=_[_0xbb1d('0x3b')]({},_0x5d03b1,_0x6ad153[_0xbb1d('0x45')]);return db['VoiceQueuesLog'][_0xbb1d('0x46')](_0x5d03b1)[_0xbb1d('0x24')](handleEntityNotFound(_0x546321,null))[_0xbb1d('0x24')](respondWithResult(_0x546321,null))['catch'](handleError(_0x546321,null));};exports['create']=function(_0x415533,_0x39a2c9){return db[_0xbb1d('0x2b')][_0xbb1d('0x47')](_0x415533[_0xbb1d('0x48')],{})[_0xbb1d('0x24')](respondWithResult(_0x39a2c9,0xc9))[_0xbb1d('0x49')](handleError(_0x39a2c9,null));};exports[_0xbb1d('0x22')]=function(_0xe9f644,_0x400be9){if(_0xe9f644[_0xbb1d('0x48')]['id']){delete _0xe9f644[_0xbb1d('0x48')]['id'];}return db[_0xbb1d('0x2b')]['find']({'where':{'id':_0xe9f644[_0xbb1d('0x43')]['id']}})['then'](handleEntityNotFound(_0x400be9,null))[_0xbb1d('0x24')](saveUpdates(_0xe9f644['body'],null))[_0xbb1d('0x24')](respondWithResult(_0x400be9,null))[_0xbb1d('0x49')](handleError(_0x400be9,null));};exports['destroy']=function(_0x3d1946,_0x2751e4){return db['VoiceQueuesLog'][_0xbb1d('0x46')]({'where':{'id':_0x3d1946[_0xbb1d('0x43')]['id']}})['then'](handleEntityNotFound(_0x2751e4,null))[_0xbb1d('0x24')](removeEntity(_0x2751e4,null))[_0xbb1d('0x49')](handleError(_0x2751e4,null));};
\ No newline at end of file
index 3eb0dac..2c46514 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe36e=['VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','../../config/logger','api','moment','bluebird','request-promise','./voiceQueuesLog.attributes','exports'];(function(_0x277107,_0x3420dc){var _0x1da046=function(_0x47122d){while(--_0x47122d){_0x277107['push'](_0x277107['shift']());}};_0x1da046(++_0x3420dc);}(_0xe36e,0xbb));var _0xee36=function(_0x68a5f6,_0x449395){_0x68a5f6=_0x68a5f6-0x0;var _0x37c018=_0xe36e[_0x68a5f6];return _0x37c018;};'use strict';var _=require(_0xee36('0x0'));var util=require('util');var logger=require(_0xee36('0x1'))(_0xee36('0x2'));var moment=require(_0xee36('0x3'));var BPromise=require(_0xee36('0x4'));var rp=require(_0xee36('0x5'));var attributes=require(_0xee36('0x6'));module[_0xee36('0x7')]=function(_0x2320b0,_0x3e269a){return _0x2320b0['define'](_0xee36('0x8'),attributes,{'tableName':_0xee36('0x9'),'paranoid':![],'indexes':[{'name':_0xee36('0xa'),'fields':[_0xee36('0xb'),_0xee36('0xc')]}],'timestamps':![]});};
\ No newline at end of file
+var _0x5e4c=['exports','define','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','bluebird','request-promise','./voiceQueuesLog.attributes'];(function(_0x3efe87,_0x35ad48){var _0x56a4cc=function(_0x47869e){while(--_0x47869e){_0x3efe87['push'](_0x3efe87['shift']());}};_0x56a4cc(++_0x35ad48);}(_0x5e4c,0xd6));var _0xc5e4=function(_0x2c28b8,_0x88eb26){_0x2c28b8=_0x2c28b8-0x0;var _0x9febe7=_0x5e4c[_0x2c28b8];return _0x9febe7;};'use strict';var _=require(_0xc5e4('0x0'));var util=require(_0xc5e4('0x1'));var logger=require(_0xc5e4('0x2'))(_0xc5e4('0x3'));var moment=require('moment');var BPromise=require(_0xc5e4('0x4'));var rp=require(_0xc5e4('0x5'));var attributes=require(_0xc5e4('0x6'));module[_0xc5e4('0x7')]=function(_0x58709d,_0x5e29bd){return _0x58709d[_0xc5e4('0x8')]('VoiceQueuesLog',attributes,{'tableName':_0xc5e4('0x9'),'paranoid':![],'indexes':[{'name':_0xc5e4('0xa'),'fields':[_0xc5e4('0xb'),_0xc5e4('0xc')]}],'timestamps':![]});};
\ No newline at end of file
index d74a5cd..2a6d38c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5eef=['error','message','result','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x5eef,0x9c));var _0xf5ee=function(_0x1f45ed,_0x5b682a){_0x1f45ed=_0x1f45ed-0x0;var _0xf6f0d3=_0x5eef[_0x1f45ed];return _0xf6f0d3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf5ee('0x0'));var BPromise=require('bluebird');var rs=require(_0xf5ee('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf5ee('0x2'))['db'];var utils=require(_0xf5ee('0x3'));var logger=require(_0xf5ee('0x4'))(_0xf5ee('0x5'));var config=require(_0xf5ee('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3ae819,_0x24e3a5,_0x4f0e34){return new BPromise(function(_0x31c9d8,_0x2e4224){return client[_0xf5ee('0x7')](_0x3ae819,_0x4f0e34)[_0xf5ee('0x8')](function(_0x125def){logger[_0xf5ee('0x9')](_0xf5ee('0xa'),_0x24e3a5,_0xf5ee('0xb'));logger[_0xf5ee('0xc')](_0xf5ee('0xd'),_0x24e3a5,'request\x20sent',JSON[_0xf5ee('0xe')](_0x125def));if(_0x125def['error']){if(_0x125def[_0xf5ee('0xf')]['code']===0x1f4){logger[_0xf5ee('0xf')](_0xf5ee('0xa'),_0x24e3a5,_0x125def[_0xf5ee('0xf')][_0xf5ee('0x10')]);return _0x2e4224(_0x125def['error'][_0xf5ee('0x10')]);}logger[_0xf5ee('0xf')](_0xf5ee('0xa'),_0x24e3a5,_0x125def[_0xf5ee('0xf')]['message']);return _0x31c9d8(_0x125def['error'][_0xf5ee('0x10')]);}else{logger[_0xf5ee('0x9')](_0xf5ee('0xa'),_0x24e3a5,_0xf5ee('0xb'));_0x31c9d8(_0x125def[_0xf5ee('0x11')]['message']);}})[_0xf5ee('0x12')](function(_0x21a35c){logger['error'](_0xf5ee('0xa'),_0x24e3a5,_0x21a35c);_0x2e4224(_0x21a35c);});});}
\ No newline at end of file
+var _0xe8cd=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment'];(function(_0x34d90a,_0x59c22a){var _0x281c13=function(_0x2ea0b4){while(--_0x2ea0b4){_0x34d90a['push'](_0x34d90a['shift']());}};_0x281c13(++_0x59c22a);}(_0xe8cd,0x106));var _0xde8c=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xe8cd[_0x3635ce];return _0x97ecd0;};'use strict';var _=require('lodash');var util=require(_0xde8c('0x0'));var moment=require(_0xde8c('0x1'));var BPromise=require(_0xde8c('0x2'));var rs=require(_0xde8c('0x3'));var fs=require('fs');var Redis=require(_0xde8c('0x4'));var db=require(_0xde8c('0x5'))['db'];var utils=require(_0xde8c('0x6'));var logger=require(_0xde8c('0x7'))(_0xde8c('0x8'));var config=require(_0xde8c('0x9'));var jayson=require(_0xde8c('0xa'));var client=jayson[_0xde8c('0xb')][_0xde8c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a51ce,_0x48a1fc,_0x2a5229){return new BPromise(function(_0x43c135,_0x4e3ad3){return client[_0xde8c('0xd')](_0x4a51ce,_0x2a5229)[_0xde8c('0xe')](function(_0x9f31eb){logger[_0xde8c('0xf')](_0xde8c('0x10'),_0x48a1fc,_0xde8c('0x11'));logger[_0xde8c('0x12')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x48a1fc,'request\x20sent',JSON[_0xde8c('0x13')](_0x9f31eb));if(_0x9f31eb['error']){if(_0x9f31eb[_0xde8c('0x14')]['code']===0x1f4){logger[_0xde8c('0x14')](_0xde8c('0x10'),_0x48a1fc,_0x9f31eb['error'][_0xde8c('0x15')]);return _0x4e3ad3(_0x9f31eb[_0xde8c('0x14')][_0xde8c('0x15')]);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x48a1fc,_0x9f31eb[_0xde8c('0x14')][_0xde8c('0x15')]);return _0x43c135(_0x9f31eb[_0xde8c('0x14')][_0xde8c('0x15')]);}else{logger[_0xde8c('0xf')](_0xde8c('0x10'),_0x48a1fc,'request\x20sent');_0x43c135(_0x9f31eb[_0xde8c('0x16')]['message']);}})[_0xde8c('0x17')](function(_0x30b88a){logger[_0xde8c('0x14')](_0xde8c('0x10'),_0x48a1fc,_0x30b88a);_0x4e3ad3(_0x30b88a);});});}
\ No newline at end of file
index b936037..a64ca53 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2750=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/downloads','downloads','post','put','destroy','exports'];(function(_0x40379a,_0x15434b){var _0x480494=function(_0x1ae411){while(--_0x1ae411){_0x40379a['push'](_0x40379a['shift']());}};_0x480494(++_0x15434b);}(_0x2750,0x13b));var _0x0275=function(_0x3ff1a2,_0xeae663){_0x3ff1a2=_0x3ff1a2-0x0;var _0x4ac537=_0x2750[_0x3ff1a2];return _0x4ac537;};'use strict';var multer=require(_0x0275('0x0'));var util=require('util');var path=require(_0x0275('0x1'));var timeout=require(_0x0275('0x2'));var express=require(_0x0275('0x3'));var router=express[_0x0275('0x4')]();var auth=require(_0x0275('0x5'));var interaction=require(_0x0275('0x6'));var config=require(_0x0275('0x7'));var controller=require(_0x0275('0x8'));router[_0x0275('0x9')]('/',auth[_0x0275('0xa')](),controller['index']);router[_0x0275('0x9')](_0x0275('0xb'),auth[_0x0275('0xa')](),controller[_0x0275('0xc')]);router['get'](_0x0275('0xd'),auth[_0x0275('0xa')](),controller[_0x0275('0xe')]);router['get']('/:id/download',auth[_0x0275('0xa')](),controller['download']);router[_0x0275('0x9')](_0x0275('0xf'),controller[_0x0275('0x10')]);router[_0x0275('0x11')]('/',auth[_0x0275('0xa')](),controller['create']);router[_0x0275('0x12')](_0x0275('0xd'),auth[_0x0275('0xa')](),controller['update']);router['delete'](_0x0275('0xd'),auth[_0x0275('0xa')](),controller[_0x0275('0x13')]);module[_0x0275('0x14')]=router;
\ No newline at end of file
+var _0xae79=['../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/downloads','downloads','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1863b6,_0x23bdcf){var _0x10ba03=function(_0x21d076){while(--_0x21d076){_0x1863b6['push'](_0x1863b6['shift']());}};_0x10ba03(++_0x23bdcf);}(_0xae79,0x1d3));var _0x9ae7=function(_0x384cff,_0x117099){_0x384cff=_0x384cff-0x0;var _0x4fbfe8=_0xae79[_0x384cff];return _0x4fbfe8;};'use strict';var multer=require(_0x9ae7('0x0'));var util=require(_0x9ae7('0x1'));var path=require(_0x9ae7('0x2'));var timeout=require(_0x9ae7('0x3'));var express=require(_0x9ae7('0x4'));var router=express[_0x9ae7('0x5')]();var auth=require(_0x9ae7('0x6'));var interaction=require(_0x9ae7('0x7'));var config=require(_0x9ae7('0x8'));var controller=require(_0x9ae7('0x9'));router[_0x9ae7('0xa')]('/',auth[_0x9ae7('0xb')](),controller[_0x9ae7('0xc')]);router[_0x9ae7('0xa')](_0x9ae7('0xd'),auth['isAuthenticated'](),controller[_0x9ae7('0xe')]);router[_0x9ae7('0xa')](_0x9ae7('0xf'),auth[_0x9ae7('0xb')](),controller[_0x9ae7('0x10')]);router[_0x9ae7('0xa')]('/:id/download',auth[_0x9ae7('0xb')](),controller['download']);router[_0x9ae7('0xa')](_0x9ae7('0x11'),controller[_0x9ae7('0x12')]);router[_0x9ae7('0x13')]('/',auth[_0x9ae7('0xb')](),controller[_0x9ae7('0x14')]);router[_0x9ae7('0x15')]('/:id',auth[_0x9ae7('0xb')](),controller[_0x9ae7('0x16')]);router['delete'](_0x9ae7('0xf'),auth[_0x9ae7('0xb')](),controller[_0x9ae7('0x17')]);module[_0x9ae7('0x18')]=router;
\ No newline at end of file
index 139b696..4cee5ff 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe30f=['createdAt','format','MM-DD-YYYY\x20HH:mm','toString','DATE','updatedAt','sequelize','moment','path','exports','VIRTUAL','extname','getDataValue','value','STRING','setDataValue','membername','split','INTEGER'];(function(_0x333707,_0x30b5a1){var _0x1538ea=function(_0x5df00e){while(--_0x5df00e){_0x333707['push'](_0x333707['shift']());}};_0x1538ea(++_0x30b5a1);}(_0xe30f,0x1bb));var _0xfe30=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe30f[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xfe30('0x0'));var moment=require(_0xfe30('0x1'));var path=require(_0xfe30('0x2'));module[_0xfe30('0x3')]={'format':{'type':Sequelize[_0xfe30('0x4')],'get':function(){return this['getDataValue']('value')?path[_0xfe30('0x5')](this[_0xfe30('0x6')](_0xfe30('0x7'))):undefined;}},'uniqueid':{'type':Sequelize[_0xfe30('0x8')]},'channel':{'type':Sequelize[_0xfe30('0x8')],'set':function(_0x5c9257){if(_0x5c9257){this[_0xfe30('0x9')]('channel',_0x5c9257);this[_0xfe30('0x9')](_0xfe30('0xa'),_0x5c9257[_0xfe30('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xfe30('0x8')]},'calleridnum':{'type':Sequelize[_0xfe30('0x8')]},'calleridname':{'type':Sequelize[_0xfe30('0x8')]},'connectedlinenum':{'type':Sequelize[_0xfe30('0x8')]},'connectedlinename':{'type':Sequelize[_0xfe30('0x8')]},'accountcode':{'type':Sequelize[_0xfe30('0x8')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xfe30('0x8')]},'type':{'type':Sequelize[_0xfe30('0x8')]},'rating':{'type':Sequelize[_0xfe30('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xfe30('0x8')]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xfe30('0xd')))[_0xfe30('0xe')](_0xfe30('0xf'))[_0xfe30('0x10')]();}},'updatedAt':{'type':Sequelize[_0xfe30('0x11')],'get':function(){return moment(this[_0xfe30('0x6')](_0xfe30('0x12')))[_0xfe30('0xe')](_0xfe30('0xf'))[_0xfe30('0x10')]();}}};
\ No newline at end of file
+var _0xc4e8=['membername','split','STRING','INTEGER','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','exports','getDataValue','value','setDataValue','channel'];(function(_0xe07dea,_0x2206db){var _0x301eee=function(_0x787968){while(--_0x787968){_0xe07dea['push'](_0xe07dea['shift']());}};_0x301eee(++_0x2206db);}(_0xc4e8,0xd6));var _0x8c4e=function(_0xbc3934,_0x176612){_0xbc3934=_0xbc3934-0x0;var _0x23bd70=_0xc4e8[_0xbc3934];return _0x23bd70;};'use strict';var Sequelize=require(_0x8c4e('0x0'));var moment=require(_0x8c4e('0x1'));var path=require('path');module[_0x8c4e('0x2')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x8c4e('0x3')](_0x8c4e('0x4'))?path['extname'](this['getDataValue'](_0x8c4e('0x4'))):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING'],'set':function(_0x5b8026){if(_0x5b8026){this[_0x8c4e('0x5')](_0x8c4e('0x6'),_0x5b8026);this[_0x8c4e('0x5')](_0x8c4e('0x7'),_0x5b8026[_0x8c4e('0x8')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x8c4e('0x9')]},'calleridnum':{'type':Sequelize[_0x8c4e('0x9')]},'calleridname':{'type':Sequelize[_0x8c4e('0x9')]},'connectedlinenum':{'type':Sequelize[_0x8c4e('0x9')]},'connectedlinename':{'type':Sequelize[_0x8c4e('0x9')]},'accountcode':{'type':Sequelize[_0x8c4e('0x9')]},'context':{'type':Sequelize[_0x8c4e('0x9')]},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8c4e('0x9')]},'rating':{'type':Sequelize[_0x8c4e('0xa')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x8c4e('0x9')]},'userDisposition':{'type':Sequelize[_0x8c4e('0x9')]},'createdAt':{'type':Sequelize[_0x8c4e('0xb')],'get':function(){return moment(this[_0x8c4e('0x3')](_0x8c4e('0xc')))[_0x8c4e('0xd')](_0x8c4e('0xe'))[_0x8c4e('0xf')]();}},'updatedAt':{'type':Sequelize[_0x8c4e('0xb')],'get':function(){return moment(this[_0x8c4e('0x3')](_0x8c4e('0x10')))[_0x8c4e('0xd')](_0x8c4e('0xe'))['toString']();}}};
\ No newline at end of file
index 904577c..afc9a8a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xda01=['decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','downloads','sequelize','col','uniqueid','token','push','$and','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','error','name','send','index','VoiceRecording','rawAttributes','model','differenceBy','keys','format','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','key','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','download','../../components/encryptor','value','%s.cypher'];(function(_0x2af4e5,_0x422895){var _0x1fdbec=function(_0x4cdade){while(--_0x4cdade){_0x2af4e5['push'](_0x2af4e5['shift']());}};_0x1fdbec(++_0x422895);}(_0xda01,0x12e));var _0x1da0=function(_0x2e9afb,_0x405cfb){_0x2e9afb=_0x2e9afb-0x0;var _0x49a943=_0xda01[_0x2e9afb];return _0x49a943;};'use strict';var pdf=require(_0x1da0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1da0('0x1'));var zipdir=require(_0x1da0('0x2'));var jsonpatch=require(_0x1da0('0x3'));var rp=require('request-promise');var moment=require(_0x1da0('0x4'));var BPromise=require(_0x1da0('0x5'));var Mustache=require(_0x1da0('0x6'));var util=require(_0x1da0('0x7'));var path=require(_0x1da0('0x8'));var sox=require('sox');var csv=require(_0x1da0('0x9'));var ejs=require(_0x1da0('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1da0('0xb'));var jsforce=require(_0x1da0('0xc'));var deskjs=require(_0x1da0('0xd'));var toCsv=require(_0x1da0('0x9'));var querystring=require('querystring');var Papa=require(_0x1da0('0xe'));var authService=require(_0x1da0('0xf'));var hardwareService=require(_0x1da0('0x10'));var Redis=require(_0x1da0('0x11'));var qs=require('../../components/parsers/qs');var logger=require(_0x1da0('0x12'))(_0x1da0('0x13'));var utils=require(_0x1da0('0x14'));var config=require('../../config/environment');var db=require(_0x1da0('0x15'))['db'];function respondWithStatusCode(_0x14ca4c,_0xe406a0){_0xe406a0=_0xe406a0||0xcc;return function(_0x3b7f40){if(_0x3b7f40){return _0x14ca4c[_0x1da0('0x16')](_0xe406a0);}return _0x14ca4c[_0x1da0('0x17')](_0xe406a0)[_0x1da0('0x18')]();};}function respondWithResult(_0x3369ce,_0x31fc41){_0x31fc41=_0x31fc41||0xc8;return function(_0x1189e6){if(_0x1189e6){return _0x3369ce[_0x1da0('0x17')](_0x31fc41)[_0x1da0('0x19')](_0x1189e6);}};}function respondWithFilteredResult(_0x420f14,_0x4af859){return function(_0x2f1ea5){if(_0x2f1ea5){var _0x29a3e4=_0x2f1ea5[_0x1da0('0x1a')],_0x4c501b=_0x4af859[_0x1da0('0x1b')],_0x4133fc=_0x4af859[_0x1da0('0x1b')]+_0x4af859[_0x1da0('0x1c')],_0x1b7600;if(_0x4133fc>=_0x29a3e4){_0x4133fc=_0x29a3e4;_0x1b7600=0xc8;}else{_0x1b7600=0xce;}_0x420f14['status'](_0x1b7600);return _0x420f14[_0x1da0('0x1d')](_0x1da0('0x1e'),_0x4c501b+'-'+_0x4133fc+'/'+_0x29a3e4)['json'](_0x2f1ea5);}return null;};}function patchUpdates(_0xba7f0a){return function(_0x25fbe8){try{jsonpatch[_0x1da0('0x1f')](_0x25fbe8,_0xba7f0a,!![]);}catch(_0xa0270){return BPromise[_0x1da0('0x20')](_0xa0270);}return _0x25fbe8['save']();};}function saveUpdates(_0x77aef8,_0x57d2ed){return function(_0x7018f7){if(_0x7018f7){return _0x7018f7[_0x1da0('0x21')](_0x77aef8)[_0x1da0('0x22')](function(_0x3cafd0){return _0x3cafd0;});}return null;};}function removeEntity(_0x5c03e1,_0x3534cf){return function(_0x40ee41){if(_0x40ee41){return _0x40ee41['destroy']()[_0x1da0('0x22')](function(){_0x5c03e1[_0x1da0('0x17')](0xcc)[_0x1da0('0x18')]();});}};}function handleEntityNotFound(_0x43ba58,_0x103f74){return function(_0xd0f0ab){if(!_0xd0f0ab){_0x43ba58[_0x1da0('0x16')](0x194);}return _0xd0f0ab;};}function handleError(_0x485830,_0x17759a){_0x17759a=_0x17759a||0x1f4;return function(_0x57d79d){logger[_0x1da0('0x23')](_0x57d79d['stack']);if(_0x57d79d[_0x1da0('0x24')]){delete _0x57d79d[_0x1da0('0x24')];}_0x485830['status'](_0x17759a)[_0x1da0('0x25')](_0x57d79d);};}exports[_0x1da0('0x26')]=function(_0x2ea60c,_0x2e13bf){var _0x2e561f={},_0x2271f6={},_0x914436={'count':0x0,'rows':[]};var _0x397a0b=db[_0x1da0('0x27')][_0x1da0('0x28')];_0x2271f6[_0x1da0('0x29')]=_[_0x1da0('0x2a')](_[_0x1da0('0x2b')](_0x397a0b),[_0x1da0('0x2c')]);_0x2271f6[_0x1da0('0x2d')]=_[_0x1da0('0x2b')](_0x2ea60c[_0x1da0('0x2d')]);_0x2271f6[_0x1da0('0x2e')]=_[_0x1da0('0x2f')](_0x2271f6[_0x1da0('0x29')],_0x2271f6[_0x1da0('0x2d')]);_0x2e561f[_0x1da0('0x30')]=_[_0x1da0('0x2f')](_0x2271f6[_0x1da0('0x29')],qs[_0x1da0('0x31')](_0x2ea60c['query'][_0x1da0('0x31')]));_0x2e561f['attributes']=_0x2e561f[_0x1da0('0x30')][_0x1da0('0x32')]?_0x2e561f[_0x1da0('0x30')]:_0x2271f6['model'];if(!_0x2ea60c[_0x1da0('0x2d')][_0x1da0('0x33')](_0x1da0('0x34'))){_0x2e561f[_0x1da0('0x1c')]=qs['limit'](_0x2ea60c[_0x1da0('0x2d')][_0x1da0('0x1c')]);_0x2e561f[_0x1da0('0x1b')]=qs['offset'](_0x2ea60c['query'][_0x1da0('0x1b')]);}_0x2e561f[_0x1da0('0x35')]=qs['sort'](_0x2ea60c['query'][_0x1da0('0x36')]);_0x2e561f[_0x1da0('0x37')]=qs[_0x1da0('0x2e')](_[_0x1da0('0x38')](_0x2ea60c[_0x1da0('0x2d')],_0x2271f6[_0x1da0('0x2e')]));if(_0x2ea60c[_0x1da0('0x2d')][_0x1da0('0x39')]){_0x2e561f[_0x1da0('0x37')]=_[_0x1da0('0x3a')](_0x2e561f['where'],{'$or':_[_0x1da0('0x3b')](_0x397a0b,function(_0x41571a){if(_0x41571a['type'][_0x1da0('0x3c')]!==_0x1da0('0x3d')){var _0x43bc04={};_0x43bc04[_0x41571a['field']]={'$like':'%'+_0x2ea60c[_0x1da0('0x2d')][_0x1da0('0x39')]+'%'};return _0x43bc04;}})});}_0x2e561f=_[_0x1da0('0x3a')]({},_0x2e561f,_0x2ea60c[_0x1da0('0x3e')]);var _0x47ebe4={'where':_0x2e561f[_0x1da0('0x37')]};return db[_0x1da0('0x27')][_0x1da0('0x1a')](_0x47ebe4)[_0x1da0('0x22')](function(_0xe9bdd0){_0x914436[_0x1da0('0x1a')]=_0xe9bdd0;if(_0x2ea60c['query'][_0x1da0('0x3f')]){_0x2e561f[_0x1da0('0x40')]=[{'all':!![]}];}return db[_0x1da0('0x27')][_0x1da0('0x41')](_0x2e561f);})[_0x1da0('0x22')](function(_0x2502ca){_0x914436[_0x1da0('0x42')]=_0x2502ca;return _0x914436;})[_0x1da0('0x22')](respondWithFilteredResult(_0x2e13bf,_0x2e561f))[_0x1da0('0x43')](handleError(_0x2e13bf,null));};exports[_0x1da0('0x44')]=function(_0x53938c,_0xd7b9b1){var _0x401a84={'raw':![],'where':{'id':_0x53938c[_0x1da0('0x45')]['id']}},_0x2153f5={};_0x2153f5[_0x1da0('0x29')]=_['keys'](db[_0x1da0('0x27')][_0x1da0('0x28')]);_0x2153f5[_0x1da0('0x2d')]=_[_0x1da0('0x2b')](_0x53938c[_0x1da0('0x2d')]);_0x2153f5[_0x1da0('0x2e')]=_[_0x1da0('0x2f')](_0x2153f5[_0x1da0('0x29')],_0x2153f5[_0x1da0('0x2d')]);_0x401a84[_0x1da0('0x30')]=_[_0x1da0('0x2f')](_0x2153f5[_0x1da0('0x29')],qs[_0x1da0('0x31')](_0x53938c['query'][_0x1da0('0x31')]));_0x401a84[_0x1da0('0x30')]=_0x401a84[_0x1da0('0x30')]['length']?_0x401a84[_0x1da0('0x30')]:_0x2153f5['model'];if(_0x53938c[_0x1da0('0x2d')][_0x1da0('0x3f')]){_0x401a84[_0x1da0('0x40')]=[{'all':!![]}];}_0x401a84=_[_0x1da0('0x3a')]({},_0x401a84,_0x53938c[_0x1da0('0x3e')]);return db[_0x1da0('0x27')]['find'](_0x401a84)[_0x1da0('0x22')](handleEntityNotFound(_0xd7b9b1,null))[_0x1da0('0x22')](respondWithResult(_0xd7b9b1,null))[_0x1da0('0x43')](handleError(_0xd7b9b1,null));};exports[_0x1da0('0x46')]=function(_0x2cf78a,_0x35b4d1){return db['VoiceRecording'][_0x1da0('0x46')](_0x2cf78a[_0x1da0('0x47')],{})[_0x1da0('0x22')](respondWithResult(_0x35b4d1,0xc9))[_0x1da0('0x43')](handleError(_0x35b4d1,null));};exports[_0x1da0('0x21')]=function(_0x1bf1a4,_0x2ea9bb){if(_0x1bf1a4['body']['id']){delete _0x1bf1a4[_0x1da0('0x47')]['id'];}return db[_0x1da0('0x27')]['find']({'where':{'id':_0x1bf1a4[_0x1da0('0x45')]['id']}})['then'](handleEntityNotFound(_0x2ea9bb,null))[_0x1da0('0x22')](saveUpdates(_0x1bf1a4['body'],null))[_0x1da0('0x22')](respondWithResult(_0x2ea9bb,null))[_0x1da0('0x43')](handleError(_0x2ea9bb,null));};exports['destroy']=function(_0x273a6a,_0x10d1ed){return db[_0x1da0('0x27')][_0x1da0('0x48')]({'where':{'id':_0x273a6a['params']['id']}})[_0x1da0('0x22')](handleEntityNotFound(_0x10d1ed,null))[_0x1da0('0x22')](removeEntity(_0x10d1ed,null))[_0x1da0('0x43')](handleError(_0x10d1ed,null));};exports[_0x1da0('0x49')]=function(_0x3e92d1,_0x12167d){return db['VoiceRecording'][_0x1da0('0x49')]()['then'](respondWithResult(_0x12167d,null))[_0x1da0('0x43')](handleError(_0x12167d,null));};exports[_0x1da0('0x4a')]=function(_0x37a91b,_0x48f60f,_0x51564b){var _0xd6ab5c=require(_0x1da0('0x4b'));var _0x507810=![];var _0xc0da3e={};if(_0x37a91b[_0x1da0('0x2d')]['type']&&_0x37a91b[_0x1da0('0x2d')]['type']==='uniqueid'){_0xc0da3e['uniqueid']=_0x37a91b[_0x1da0('0x45')]['id'];}else{_0xc0da3e['id']=_0x37a91b['params']['id'];}return db['VoiceRecording'][_0x1da0('0x48')]({'where':_0xc0da3e,'attributes':['id',_0x1da0('0x4c')],'raw':!![]})[_0x1da0('0x22')](handleEntityNotFound(_0x48f60f,null))[_0x1da0('0x22')](function(_0x3dd53c){if(_0x3dd53c){var _0x2c810b=util['format'](_0x1da0('0x4d'),_0x3dd53c[_0x1da0('0x4c')]);if(fs['existsSync'](_0x2c810b)){_0x507810=!![];return _0xd6ab5c[_0x1da0('0x4e')](_0x2c810b,_0x3dd53c[_0x1da0('0x4c')],config[_0x1da0('0x4f')][_0x1da0('0x50')])[_0x1da0('0x22')](function(){return _0x3dd53c;});}return _0x3dd53c;}})[_0x1da0('0x22')](function(_0xb30555){if(_0xb30555){if(!fs[_0x1da0('0x51')](_0xb30555[_0x1da0('0x4c')])){throw new db[(_0x1da0('0x52'))][(_0x1da0('0x53'))](_0x1da0('0x54'));}if(_0xb30555[_0x1da0('0x55')]){return _0x48f60f[_0x1da0('0x4a')](_0xb30555['value'],_0xb30555[_0x1da0('0x55')]+path[_0x1da0('0x56')](_0xb30555[_0x1da0('0x4c')]),function(){if(_0x507810){fs[_0x1da0('0x57')](_0xb30555[_0x1da0('0x4c')]);}});}else{return _0x48f60f['download'](_0xb30555[_0x1da0('0x4c')],function(_0x5317e2){if(_0x507810){fs[_0x1da0('0x57')](_0xb30555[_0x1da0('0x4c')]);}});}}})[_0x1da0('0x43')](handleError(_0x48f60f,null));};exports[_0x1da0('0x58')]=function(_0x175d00,_0x54d812,_0x2da0de){var _0x2d13de=require(_0x1da0('0x4b'));var _0x5698c7=![];var _0x564332={'$and':[db[_0x1da0('0x59')]['where'](db[_0x1da0('0x59')]['fn']('MD5',db[_0x1da0('0x59')][_0x1da0('0x5a')](_0x1da0('0x5b'))),_0x175d00[_0x1da0('0x2d')][_0x1da0('0x5c')])]};if(_0x175d00[_0x1da0('0x2d')]['type']&&_0x175d00['query']['type']===_0x1da0('0x5b')){_0x564332['$and'][_0x1da0('0x5d')]({'uniqueid':_0x175d00[_0x1da0('0x45')]['id']});}else{_0x564332[_0x1da0('0x5e')]['push']({'id':_0x175d00[_0x1da0('0x45')]['id']});}return db[_0x1da0('0x27')][_0x1da0('0x48')]({'where':_0x564332,'attributes':['id',_0x1da0('0x4c')],'raw':!![]})[_0x1da0('0x22')](handleEntityNotFound(_0x54d812,null))[_0x1da0('0x22')](function(_0x3f28c8){if(_0x3f28c8){var _0xb8c016=util[_0x1da0('0x2c')](_0x1da0('0x4d'),_0x3f28c8['value']);if(fs[_0x1da0('0x51')](_0xb8c016)){_0x5698c7=!![];return _0x2d13de[_0x1da0('0x4e')](_0xb8c016,_0x3f28c8[_0x1da0('0x4c')],config['secrets'][_0x1da0('0x50')])[_0x1da0('0x22')](function(){return _0x3f28c8;});}return _0x3f28c8;}})[_0x1da0('0x22')](function(_0x107ccf){if(_0x107ccf){if(!fs[_0x1da0('0x51')](_0x107ccf[_0x1da0('0x4c')])){throw new db[(_0x1da0('0x52'))][(_0x1da0('0x53'))]('VoiceRecording\x20not\x20found');}if(_0x107ccf[_0x1da0('0x55')]){return _0x54d812[_0x1da0('0x4a')](_0x107ccf['value'],_0x107ccf[_0x1da0('0x55')]+path['extname'](_0x107ccf[_0x1da0('0x4c')]),function(){if(_0x5698c7){fs[_0x1da0('0x57')](_0x107ccf[_0x1da0('0x4c')]);}});}else{return _0x54d812[_0x1da0('0x4a')](_0x107ccf[_0x1da0('0x4c')],function(_0x4efae1){if(_0x5698c7){fs[_0x1da0('0x57')](_0x107ccf['value']);}});}}})['catch'](handleError(_0x54d812,null));};
\ No newline at end of file
+var _0x45c3=['decryptFile','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','download','extname','unlink','downloads','sequelize','MD5','col','token','push','$and','%s.cypher','recording','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','status','end','json','count','offset','apply','save','update','then','sendStatus','error','send','index','VoiceRecording','rawAttributes','model','differenceBy','keys','format','query','attributes','fields','limit','sort','where','filters','pick','map','key','field','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','destroy','describe','../../components/encryptor','type','uniqueid','value','existsSync'];(function(_0x1fad17,_0x23eadf){var _0x2f5156=function(_0x2072e4){while(--_0x2072e4){_0x1fad17['push'](_0x1fad17['shift']());}};_0x2f5156(++_0x23eadf);}(_0x45c3,0x186));var _0x345c=function(_0x140dcd,_0xe99058){_0x140dcd=_0x140dcd-0x0;var _0x346705=_0x45c3[_0x140dcd];return _0x346705;};'use strict';var pdf=require(_0x345c('0x0'));var emlformat=require(_0x345c('0x1'));var rimraf=require(_0x345c('0x2'));var zipdir=require(_0x345c('0x3'));var jsonpatch=require(_0x345c('0x4'));var rp=require(_0x345c('0x5'));var moment=require(_0x345c('0x6'));var BPromise=require(_0x345c('0x7'));var Mustache=require(_0x345c('0x8'));var util=require('util');var path=require(_0x345c('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x345c('0xa'));var fs=require('fs');var _=require(_0x345c('0xb'));var squel=require(_0x345c('0xc'));var crypto=require(_0x345c('0xd'));var jsforce=require(_0x345c('0xe'));var deskjs=require(_0x345c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x345c('0x10'));var Papa=require('papaparse');var authService=require(_0x345c('0x11'));var hardwareService=require(_0x345c('0x12'));var Redis=require(_0x345c('0x13'));var qs=require(_0x345c('0x14'));var logger=require(_0x345c('0x15'))('api');var utils=require(_0x345c('0x16'));var config=require(_0x345c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf4c8fa,_0x6e07c3){_0x6e07c3=_0x6e07c3||0xcc;return function(_0x2ffffb){if(_0x2ffffb){return _0xf4c8fa['sendStatus'](_0x6e07c3);}return _0xf4c8fa[_0x345c('0x18')](_0x6e07c3)[_0x345c('0x19')]();};}function respondWithResult(_0x988988,_0x43c99e){_0x43c99e=_0x43c99e||0xc8;return function(_0x347edb){if(_0x347edb){return _0x988988[_0x345c('0x18')](_0x43c99e)[_0x345c('0x1a')](_0x347edb);}};}function respondWithFilteredResult(_0x2fbdcc,_0x330787){return function(_0x7fdb43){if(_0x7fdb43){var _0x4b06d6=_0x7fdb43[_0x345c('0x1b')],_0x5234c5=_0x330787[_0x345c('0x1c')],_0x598f2c=_0x330787[_0x345c('0x1c')]+_0x330787['limit'],_0xb2df5;if(_0x598f2c>=_0x4b06d6){_0x598f2c=_0x4b06d6;_0xb2df5=0xc8;}else{_0xb2df5=0xce;}_0x2fbdcc['status'](_0xb2df5);return _0x2fbdcc['set']('Content-Range',_0x5234c5+'-'+_0x598f2c+'/'+_0x4b06d6)[_0x345c('0x1a')](_0x7fdb43);}return null;};}function patchUpdates(_0x3ef2eb){return function(_0x34d25b){try{jsonpatch[_0x345c('0x1d')](_0x34d25b,_0x3ef2eb,!![]);}catch(_0x506c68){return BPromise['reject'](_0x506c68);}return _0x34d25b[_0x345c('0x1e')]();};}function saveUpdates(_0xd30314,_0x4698b0){return function(_0x5e6458){if(_0x5e6458){return _0x5e6458[_0x345c('0x1f')](_0xd30314)[_0x345c('0x20')](function(_0x1b815f){return _0x1b815f;});}return null;};}function removeEntity(_0x1c1ba5,_0x4fcebe){return function(_0x2c1284){if(_0x2c1284){return _0x2c1284['destroy']()[_0x345c('0x20')](function(){_0x1c1ba5[_0x345c('0x18')](0xcc)[_0x345c('0x19')]();});}};}function handleEntityNotFound(_0x11e77b,_0x3c5c9b){return function(_0x4632dc){if(!_0x4632dc){_0x11e77b[_0x345c('0x21')](0x194);}return _0x4632dc;};}function handleError(_0xdad84a,_0x48bcb0){_0x48bcb0=_0x48bcb0||0x1f4;return function(_0xaa585){logger[_0x345c('0x22')](_0xaa585['stack']);if(_0xaa585['name']){delete _0xaa585['name'];}_0xdad84a[_0x345c('0x18')](_0x48bcb0)[_0x345c('0x23')](_0xaa585);};}exports[_0x345c('0x24')]=function(_0x20bce2,_0x47b5c4){var _0x4c4413={},_0x2337f4={},_0x580502={'count':0x0,'rows':[]};var _0xe34a23=db[_0x345c('0x25')][_0x345c('0x26')];_0x2337f4[_0x345c('0x27')]=_[_0x345c('0x28')](_[_0x345c('0x29')](_0xe34a23),[_0x345c('0x2a')]);_0x2337f4['query']=_[_0x345c('0x29')](_0x20bce2[_0x345c('0x2b')]);_0x2337f4['filters']=_['intersection'](_0x2337f4[_0x345c('0x27')],_0x2337f4[_0x345c('0x2b')]);_0x4c4413[_0x345c('0x2c')]=_['intersection'](_0x2337f4[_0x345c('0x27')],qs[_0x345c('0x2d')](_0x20bce2[_0x345c('0x2b')][_0x345c('0x2d')]));_0x4c4413['attributes']=_0x4c4413[_0x345c('0x2c')]['length']?_0x4c4413[_0x345c('0x2c')]:_0x2337f4[_0x345c('0x27')];if(!_0x20bce2[_0x345c('0x2b')]['hasOwnProperty']('nolimit')){_0x4c4413[_0x345c('0x2e')]=qs['limit'](_0x20bce2[_0x345c('0x2b')][_0x345c('0x2e')]);_0x4c4413[_0x345c('0x1c')]=qs[_0x345c('0x1c')](_0x20bce2[_0x345c('0x2b')]['offset']);}_0x4c4413['order']=qs['sort'](_0x20bce2[_0x345c('0x2b')][_0x345c('0x2f')]);_0x4c4413[_0x345c('0x30')]=qs[_0x345c('0x31')](_[_0x345c('0x32')](_0x20bce2[_0x345c('0x2b')],_0x2337f4[_0x345c('0x31')]));if(_0x20bce2[_0x345c('0x2b')]['filter']){_0x4c4413[_0x345c('0x30')]=_['merge'](_0x4c4413[_0x345c('0x30')],{'$or':_[_0x345c('0x33')](_0xe34a23,function(_0x53866b){if(_0x53866b['type'][_0x345c('0x34')]!=='VIRTUAL'){var _0x54557e={};_0x54557e[_0x53866b[_0x345c('0x35')]]={'$like':'%'+_0x20bce2[_0x345c('0x2b')][_0x345c('0x36')]+'%'};return _0x54557e;}})});}_0x4c4413=_[_0x345c('0x37')]({},_0x4c4413,_0x20bce2[_0x345c('0x38')]);var _0xbfa2a6={'where':_0x4c4413[_0x345c('0x30')]};return db['VoiceRecording'][_0x345c('0x1b')](_0xbfa2a6)[_0x345c('0x20')](function(_0x2202f2){_0x580502[_0x345c('0x1b')]=_0x2202f2;if(_0x20bce2[_0x345c('0x2b')][_0x345c('0x39')]){_0x4c4413[_0x345c('0x3a')]=[{'all':!![]}];}return db['VoiceRecording'][_0x345c('0x3b')](_0x4c4413);})[_0x345c('0x20')](function(_0x3058e6){_0x580502[_0x345c('0x3c')]=_0x3058e6;return _0x580502;})[_0x345c('0x20')](respondWithFilteredResult(_0x47b5c4,_0x4c4413))[_0x345c('0x3d')](handleError(_0x47b5c4,null));};exports[_0x345c('0x3e')]=function(_0x3bebf6,_0x241d13){var _0x1c4ee5={'raw':![],'where':{'id':_0x3bebf6[_0x345c('0x3f')]['id']}},_0x226e3d={};_0x226e3d[_0x345c('0x27')]=_[_0x345c('0x29')](db['VoiceRecording'][_0x345c('0x26')]);_0x226e3d['query']=_[_0x345c('0x29')](_0x3bebf6['query']);_0x226e3d[_0x345c('0x31')]=_[_0x345c('0x40')](_0x226e3d[_0x345c('0x27')],_0x226e3d['query']);_0x1c4ee5['attributes']=_[_0x345c('0x40')](_0x226e3d['model'],qs[_0x345c('0x2d')](_0x3bebf6[_0x345c('0x2b')][_0x345c('0x2d')]));_0x1c4ee5[_0x345c('0x2c')]=_0x1c4ee5['attributes']['length']?_0x1c4ee5['attributes']:_0x226e3d[_0x345c('0x27')];if(_0x3bebf6['query'][_0x345c('0x39')]){_0x1c4ee5[_0x345c('0x3a')]=[{'all':!![]}];}_0x1c4ee5=_['merge']({},_0x1c4ee5,_0x3bebf6['options']);return db[_0x345c('0x25')][_0x345c('0x41')](_0x1c4ee5)[_0x345c('0x20')](handleEntityNotFound(_0x241d13,null))[_0x345c('0x20')](respondWithResult(_0x241d13,null))['catch'](handleError(_0x241d13,null));};exports[_0x345c('0x42')]=function(_0x43c021,_0x397f0b){return db[_0x345c('0x25')][_0x345c('0x42')](_0x43c021[_0x345c('0x43')],{})['then'](respondWithResult(_0x397f0b,0xc9))[_0x345c('0x3d')](handleError(_0x397f0b,null));};exports[_0x345c('0x1f')]=function(_0x63f5c,_0x4dd8d5){if(_0x63f5c[_0x345c('0x43')]['id']){delete _0x63f5c[_0x345c('0x43')]['id'];}return db[_0x345c('0x25')][_0x345c('0x41')]({'where':{'id':_0x63f5c[_0x345c('0x3f')]['id']}})[_0x345c('0x20')](handleEntityNotFound(_0x4dd8d5,null))[_0x345c('0x20')](saveUpdates(_0x63f5c[_0x345c('0x43')],null))[_0x345c('0x20')](respondWithResult(_0x4dd8d5,null))[_0x345c('0x3d')](handleError(_0x4dd8d5,null));};exports[_0x345c('0x44')]=function(_0x3079ad,_0x505d99){return db['VoiceRecording']['find']({'where':{'id':_0x3079ad['params']['id']}})['then'](handleEntityNotFound(_0x505d99,null))[_0x345c('0x20')](removeEntity(_0x505d99,null))[_0x345c('0x3d')](handleError(_0x505d99,null));};exports[_0x345c('0x45')]=function(_0x5bb861,_0x3b3147){return db[_0x345c('0x25')][_0x345c('0x45')]()[_0x345c('0x20')](respondWithResult(_0x3b3147,null))[_0x345c('0x3d')](handleError(_0x3b3147,null));};exports['download']=function(_0x528bdf,_0x405df6,_0x4a78bf){var _0x39d7bd=require(_0x345c('0x46'));var _0x31b041=![];var _0xf0de42={};if(_0x528bdf[_0x345c('0x2b')][_0x345c('0x47')]&&_0x528bdf[_0x345c('0x2b')][_0x345c('0x47')]===_0x345c('0x48')){_0xf0de42['uniqueid']=_0x528bdf[_0x345c('0x3f')]['id'];}else{_0xf0de42['id']=_0x528bdf[_0x345c('0x3f')]['id'];}return db[_0x345c('0x25')][_0x345c('0x41')]({'where':_0xf0de42,'attributes':['id',_0x345c('0x49')],'raw':!![]})['then'](handleEntityNotFound(_0x405df6,null))['then'](function(_0x352368){if(_0x352368){var _0x31ae26=util[_0x345c('0x2a')]('%s.cypher',_0x352368[_0x345c('0x49')]);if(fs[_0x345c('0x4a')](_0x31ae26)){_0x31b041=!![];return _0x39d7bd[_0x345c('0x4b')](_0x31ae26,_0x352368['value'],config[_0x345c('0x4c')]['recording'])[_0x345c('0x20')](function(){return _0x352368;});}return _0x352368;}})[_0x345c('0x20')](function(_0x103437){if(_0x103437){if(!fs[_0x345c('0x4a')](_0x103437[_0x345c('0x49')])){throw new db[(_0x345c('0x4d'))][(_0x345c('0x4e'))](_0x345c('0x4f'));}if(_0x103437[_0x345c('0x50')]){return _0x405df6[_0x345c('0x51')](_0x103437[_0x345c('0x49')],_0x103437[_0x345c('0x50')]+path[_0x345c('0x52')](_0x103437['value']),function(){if(_0x31b041){fs[_0x345c('0x53')](_0x103437[_0x345c('0x49')]);}});}else{return _0x405df6[_0x345c('0x51')](_0x103437[_0x345c('0x49')],function(_0x1939e1){if(_0x31b041){fs[_0x345c('0x53')](_0x103437[_0x345c('0x49')]);}});}}})['catch'](handleError(_0x405df6,null));};exports[_0x345c('0x54')]=function(_0x5baa5b,_0x13f684,_0x25c9c6){var _0x350c5e=require(_0x345c('0x46'));var _0x55860a=![];var _0x37ad01={'$and':[db[_0x345c('0x55')][_0x345c('0x30')](db['sequelize']['fn'](_0x345c('0x56'),db[_0x345c('0x55')][_0x345c('0x57')](_0x345c('0x48'))),_0x5baa5b['query'][_0x345c('0x58')])]};if(_0x5baa5b['query']['type']&&_0x5baa5b[_0x345c('0x2b')][_0x345c('0x47')]===_0x345c('0x48')){_0x37ad01['$and'][_0x345c('0x59')]({'uniqueid':_0x5baa5b[_0x345c('0x3f')]['id']});}else{_0x37ad01[_0x345c('0x5a')]['push']({'id':_0x5baa5b['params']['id']});}return db[_0x345c('0x25')]['find']({'where':_0x37ad01,'attributes':['id','value'],'raw':!![]})[_0x345c('0x20')](handleEntityNotFound(_0x13f684,null))['then'](function(_0x4c1130){if(_0x4c1130){var _0x143572=util[_0x345c('0x2a')](_0x345c('0x5b'),_0x4c1130['value']);if(fs[_0x345c('0x4a')](_0x143572)){_0x55860a=!![];return _0x350c5e[_0x345c('0x4b')](_0x143572,_0x4c1130[_0x345c('0x49')],config[_0x345c('0x4c')][_0x345c('0x5c')])[_0x345c('0x20')](function(){return _0x4c1130;});}return _0x4c1130;}})['then'](function(_0x11e468){if(_0x11e468){if(!fs['existsSync'](_0x11e468[_0x345c('0x49')])){throw new db[(_0x345c('0x4d'))][(_0x345c('0x4e'))](_0x345c('0x4f'));}if(_0x11e468['filename']){return _0x13f684[_0x345c('0x51')](_0x11e468['value'],_0x11e468[_0x345c('0x50')]+path[_0x345c('0x52')](_0x11e468[_0x345c('0x49')]),function(){if(_0x55860a){fs[_0x345c('0x53')](_0x11e468['value']);}});}else{return _0x13f684[_0x345c('0x51')](_0x11e468[_0x345c('0x49')],function(_0xad15b7){if(_0x55860a){fs[_0x345c('0x53')](_0x11e468['value']);}});}}})[_0x345c('0x3d')](handleError(_0x13f684,null));};
\ No newline at end of file
index cea72df..e794b81 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xccb2=['uniqueid','lodash','api','request-promise','./voiceRecording.attributes','exports','define','voice_recordings'];(function(_0x18fce8,_0x390211){var _0x1da9d7=function(_0x3ef1d0){while(--_0x3ef1d0){_0x18fce8['push'](_0x18fce8['shift']());}};_0x1da9d7(++_0x390211);}(_0xccb2,0x181));var _0x2ccb=function(_0x1670d9,_0x3e0f5c){_0x1670d9=_0x1670d9-0x0;var _0x2647ab=_0xccb2[_0x1670d9];return _0x2647ab;};'use strict';var _=require(_0x2ccb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2ccb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2ccb('0x2'));var attributes=require(_0x2ccb('0x3'));module[_0x2ccb('0x4')]=function(_0x111c15,_0x12a2d0){return _0x111c15[_0x2ccb('0x5')]('VoiceRecording',attributes,{'tableName':_0x2ccb('0x6'),'paranoid':![],'indexes':[{'name':_0x2ccb('0x7'),'fields':[_0x2ccb('0x7')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x6dad=['VoiceRecording','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./voiceRecording.attributes','exports','define'];(function(_0x328063,_0x3b6170){var _0x1e8638=function(_0x5d5c06){while(--_0x5d5c06){_0x328063['push'](_0x328063['shift']());}};_0x1e8638(++_0x3b6170);}(_0x6dad,0x1e5));var _0xd6da=function(_0x53664e,_0x290521){_0x53664e=_0x53664e-0x0;var _0x442358=_0x6dad[_0x53664e];return _0x442358;};'use strict';var _=require(_0xd6da('0x0'));var util=require(_0xd6da('0x1'));var logger=require(_0xd6da('0x2'))(_0xd6da('0x3'));var moment=require(_0xd6da('0x4'));var BPromise=require(_0xd6da('0x5'));var rp=require(_0xd6da('0x6'));var attributes=require(_0xd6da('0x7'));module[_0xd6da('0x8')]=function(_0x560857,_0x3d08f0){return _0x560857[_0xd6da('0x9')](_0xd6da('0xa'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});};
\ No newline at end of file
index cd32f27..1d77657 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe63c=['VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','result','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','catch','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x2543d6,_0x3a5e78){var _0x55213c=function(_0x292768){while(--_0x292768){_0x2543d6['push'](_0x2543d6['shift']());}};_0x55213c(++_0x3a5e78);}(_0xe63c,0x133));var _0xce63=function(_0x4f3b4b,_0x590f08){_0x4f3b4b=_0x4f3b4b-0x0;var _0x1249e0=_0xe63c[_0x4f3b4b];return _0x1249e0;};'use strict';var _=require(_0xce63('0x0'));var util=require(_0xce63('0x1'));var moment=require(_0xce63('0x2'));var BPromise=require('bluebird');var rs=require(_0xce63('0x3'));var fs=require('fs');var Redis=require(_0xce63('0x4'));var db=require(_0xce63('0x5'))['db'];var utils=require(_0xce63('0x6'));var logger=require('../../config/logger')(_0xce63('0x7'));var config=require(_0xce63('0x8'));var jayson=require(_0xce63('0x9'));var client=jayson[_0xce63('0xa')][_0xce63('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x166ef6,_0x221f1a,_0x1cc9ea){return new BPromise(function(_0x5638e7,_0x3aa5de){return client['request'](_0x166ef6,_0x1cc9ea)[_0xce63('0xc')](function(_0x39687e){logger[_0xce63('0xd')]('VoiceRecording,\x20%s,\x20%s',_0x221f1a,_0xce63('0xe'));logger['debug'](_0xce63('0xf'),_0x221f1a,'request\x20sent',JSON[_0xce63('0x10')](_0x39687e));if(_0x39687e['error']){if(_0x39687e[_0xce63('0x11')][_0xce63('0x12')]===0x1f4){logger[_0xce63('0x11')](_0xce63('0x13'),_0x221f1a,_0x39687e[_0xce63('0x11')]['message']);return _0x3aa5de(_0x39687e[_0xce63('0x11')][_0xce63('0x14')]);}logger[_0xce63('0x11')](_0xce63('0x13'),_0x221f1a,_0x39687e[_0xce63('0x11')][_0xce63('0x14')]);return _0x5638e7(_0x39687e['error'][_0xce63('0x14')]);}else{logger[_0xce63('0xd')](_0xce63('0x13'),_0x221f1a,_0xce63('0xe'));_0x5638e7(_0x39687e[_0xce63('0x15')]['message']);}})['catch'](function(_0x21c59a){logger[_0xce63('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x221f1a,_0x21c59a);_0x3aa5de(_0x21c59a);});});}exports[_0xce63('0x16')]=function(_0x4991c2){var _0x4782fd=this;return new Promise(function(_0x41968d,_0x3b9a34){return db[_0xce63('0x17')][_0xce63('0x18')](_0x4991c2[_0xce63('0x19')],{'raw':_0x4991c2['options']?_0x4991c2[_0xce63('0x1a')][_0xce63('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4991c2[_0xce63('0x1a')]?_0x4991c2[_0xce63('0x1a')][_0xce63('0x1c')]||null:null,'attributes':_0x4991c2[_0xce63('0x1a')]?_0x4991c2['options'][_0xce63('0x1d')]||null:null,'limit':_0x4991c2[_0xce63('0x1a')]?_0x4991c2['options'][_0xce63('0x1e')]||null:null})[_0xce63('0xc')](function(_0x383ef8){logger[_0xce63('0xd')]('UpdateVoiceRecording',_0x4991c2);logger['debug']('UpdateVoiceRecording',_0x4991c2,JSON[_0xce63('0x10')](_0x383ef8));_0x41968d(_0x383ef8);})[_0xce63('0x1f')](function(_0x1d1f09){logger[_0xce63('0x11')](_0xce63('0x16'),_0x1d1f09[_0xce63('0x14')],_0x4991c2);_0x3b9a34(_0x4782fd['error'](0x1f4,_0x1d1f09[_0xce63('0x14')]));});});};exports['CreateVoiceRecording']=function(_0x2daaa4){var _0x440e3b=this;return new Promise(function(_0x32a76b,_0x519cc0){var _0x476ec2=require(_0xce63('0x20'));var _0x27f920;return db[_0xce63('0x21')][_0xce63('0x22')]({'attributes':['id',_0xce63('0x23')],'where':{'id':0x1},'raw':!![]})[_0xce63('0xc')](function(_0x202430){_0x27f920=_0x202430;return db[_0xce63('0x17')][_0xce63('0x24')](_0x2daaa4[_0xce63('0x19')]);})['then'](function(_0x51d98f){if(_0x27f920[_0xce63('0x23')]&&fs[_0xce63('0x25')](_0x51d98f[_0xce63('0x26')])){var _0x39bda8=util['format'](_0xce63('0x27'),_0x51d98f[_0xce63('0x26')]);return _0x476ec2[_0xce63('0x28')](_0x51d98f['value'],_0x39bda8,config[_0xce63('0x29')][_0xce63('0x2a')])['then'](function(){fs[_0xce63('0x2b')](_0x51d98f['value']);logger[_0xce63('0xd')](_0xce63('0x2c'));return _0x51d98f;});}return _0x51d98f;})[_0xce63('0xc')](function(_0x16af70){logger['info'](_0xce63('0x2d'),_0x2daaa4);logger['debug'](_0xce63('0x2d'),_0x2daaa4,JSON[_0xce63('0x10')](_0x16af70));_0x32a76b(_0x16af70);})['catch'](function(_0x5cb009){logger[_0xce63('0x11')](_0xce63('0x2d'),_0x5cb009['message'],_0x2daaa4);_0x519cc0(_0x440e3b[_0xce63('0x11')](0x1f4,_0x5cb009[_0xce63('0x14')]));});});};
\ No newline at end of file
+var _0x58b0=['code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','attributes','limit','then','CreateVoiceRecording','../../components/encryptor','Setting','findOne','create','callRecordingEncryption','value','%s.cypher','encryptFile','secrets','unlink','CreateVoiceRecording\x20file\x20encrypted','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x58b0,0x1d1));var _0x058b=function(_0xe56fcb,_0x42f237){_0xe56fcb=_0xe56fcb-0x0;var _0x6037c7=_0x58b0[_0xe56fcb];return _0x6037c7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x058b('0x0'));var BPromise=require('bluebird');var rs=require(_0x058b('0x1'));var fs=require('fs');var Redis=require(_0x058b('0x2'));var db=require(_0x058b('0x3'))['db'];var utils=require(_0x058b('0x4'));var logger=require(_0x058b('0x5'))(_0x058b('0x6'));var config=require(_0x058b('0x7'));var jayson=require(_0x058b('0x8'));var client=jayson[_0x058b('0x9')][_0x058b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d4e75,_0x3eba75,_0x4790a8){return new BPromise(function(_0x21528d,_0x43debb){return client[_0x058b('0xb')](_0x5d4e75,_0x4790a8)['then'](function(_0x43a416){logger[_0x058b('0xc')](_0x058b('0xd'),_0x3eba75,'request\x20sent');logger[_0x058b('0xe')](_0x058b('0xf'),_0x3eba75,_0x058b('0x10'),JSON[_0x058b('0x11')](_0x43a416));if(_0x43a416[_0x058b('0x12')]){if(_0x43a416['error'][_0x058b('0x13')]===0x1f4){logger[_0x058b('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x3eba75,_0x43a416['error'][_0x058b('0x14')]);return _0x43debb(_0x43a416[_0x058b('0x12')][_0x058b('0x14')]);}logger[_0x058b('0x12')](_0x058b('0xd'),_0x3eba75,_0x43a416[_0x058b('0x12')][_0x058b('0x14')]);return _0x21528d(_0x43a416[_0x058b('0x12')][_0x058b('0x14')]);}else{logger[_0x058b('0xc')]('VoiceRecording,\x20%s,\x20%s',_0x3eba75,_0x058b('0x10'));_0x21528d(_0x43a416[_0x058b('0x15')][_0x058b('0x14')]);}})[_0x058b('0x16')](function(_0xc68257){logger['error'](_0x058b('0xd'),_0x3eba75,_0xc68257);_0x43debb(_0xc68257);});});}exports[_0x058b('0x17')]=function(_0x2a4638){var _0x2882ea=this;return new Promise(function(_0x1a4beb,_0x15cea7){return db[_0x058b('0x18')][_0x058b('0x19')](_0x2a4638[_0x058b('0x1a')],{'raw':_0x2a4638[_0x058b('0x1b')]?_0x2a4638['options'][_0x058b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a4638[_0x058b('0x1b')]?_0x2a4638[_0x058b('0x1b')]['where']||null:null,'attributes':_0x2a4638[_0x058b('0x1b')]?_0x2a4638[_0x058b('0x1b')][_0x058b('0x1d')]||null:null,'limit':_0x2a4638['options']?_0x2a4638[_0x058b('0x1b')][_0x058b('0x1e')]||null:null})[_0x058b('0x1f')](function(_0x43d0c6){logger[_0x058b('0xc')](_0x058b('0x17'),_0x2a4638);logger[_0x058b('0xe')](_0x058b('0x17'),_0x2a4638,JSON[_0x058b('0x11')](_0x43d0c6));_0x1a4beb(_0x43d0c6);})[_0x058b('0x16')](function(_0x217e8a){logger[_0x058b('0x12')](_0x058b('0x17'),_0x217e8a[_0x058b('0x14')],_0x2a4638);_0x15cea7(_0x2882ea[_0x058b('0x12')](0x1f4,_0x217e8a[_0x058b('0x14')]));});});};exports[_0x058b('0x20')]=function(_0x420c2f){var _0x26cd16=this;return new Promise(function(_0x3d18ba,_0x40f152){var _0x2b0425=require(_0x058b('0x21'));var _0x5c3c75;return db[_0x058b('0x22')][_0x058b('0x23')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})['then'](function(_0x2db51b){_0x5c3c75=_0x2db51b;return db[_0x058b('0x18')][_0x058b('0x24')](_0x420c2f[_0x058b('0x1a')]);})[_0x058b('0x1f')](function(_0x595f92){if(_0x5c3c75[_0x058b('0x25')]&&fs['existsSync'](_0x595f92[_0x058b('0x26')])){var _0x52d3f1=util['format'](_0x058b('0x27'),_0x595f92[_0x058b('0x26')]);return _0x2b0425[_0x058b('0x28')](_0x595f92['value'],_0x52d3f1,config[_0x058b('0x29')]['recording'])[_0x058b('0x1f')](function(){fs[_0x058b('0x2a')](_0x595f92[_0x058b('0x26')]);logger[_0x058b('0xc')](_0x058b('0x2b'));return _0x595f92;});}return _0x595f92;})[_0x058b('0x1f')](function(_0x25278a){logger[_0x058b('0xc')](_0x058b('0x20'),_0x420c2f);logger[_0x058b('0xe')](_0x058b('0x20'),_0x420c2f,JSON['stringify'](_0x25278a));_0x3d18ba(_0x25278a);})[_0x058b('0x16')](function(_0x7dccbe){logger[_0x058b('0x12')]('CreateVoiceRecording',_0x7dccbe[_0x058b('0x14')],_0x420c2f);_0x40f152(_0x26cd16['error'](0x1f4,_0x7dccbe[_0x058b('0x14')]));});});};
\ No newline at end of file
index b3ff61b..edc42ee 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x37b7=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated','index','/:id','show','post','update','exports','util'];(function(_0x35a04b,_0x331fe4){var _0x2157f9=function(_0x57e5b1){while(--_0x57e5b1){_0x35a04b['push'](_0x35a04b['shift']());}};_0x2157f9(++_0x331fe4);}(_0x37b7,0x12b));var _0x737b=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x37b7[_0xe73080];return _0x12cbc4;};'use strict';var multer=require('multer');var util=require(_0x737b('0x0'));var path=require(_0x737b('0x1'));var timeout=require(_0x737b('0x2'));var express=require('express');var router=express[_0x737b('0x3')]();var auth=require(_0x737b('0x4'));var interaction=require(_0x737b('0x5'));var config=require('../../config/environment');var controller=require(_0x737b('0x6'));router[_0x737b('0x7')]('/',auth[_0x737b('0x8')](),controller[_0x737b('0x9')]);router[_0x737b('0x7')](_0x737b('0xa'),auth[_0x737b('0x8')](),controller[_0x737b('0xb')]);router[_0x737b('0xc')]('/',auth[_0x737b('0x8')](),controller['create']);router['put'](_0x737b('0xa'),auth[_0x737b('0x8')](),controller[_0x737b('0xd')]);router['delete'](_0x737b('0xa'),auth[_0x737b('0x8')](),controller['destroy']);module[_0x737b('0xe')]=router;
\ No newline at end of file
+var _0xaa59=['delete','exports','path','connect-timeout','express','Router','../../components/interaction/service','./voiceTransferReport.controller','isAuthenticated','/:id','show','post','create','update'];(function(_0x5eb98d,_0x56f218){var _0x146655=function(_0x53e628){while(--_0x53e628){_0x5eb98d['push'](_0x5eb98d['shift']());}};_0x146655(++_0x56f218);}(_0xaa59,0x16e));var _0x9aa5=function(_0x430b21,_0x1d4993){_0x430b21=_0x430b21-0x0;var _0x537cd0=_0xaa59[_0x430b21];return _0x537cd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9aa5('0x0'));var timeout=require(_0x9aa5('0x1'));var express=require(_0x9aa5('0x2'));var router=express[_0x9aa5('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x9aa5('0x4'));var config=require('../../config/environment');var controller=require(_0x9aa5('0x5'));router['get']('/',auth[_0x9aa5('0x6')](),controller['index']);router['get'](_0x9aa5('0x7'),auth[_0x9aa5('0x6')](),controller[_0x9aa5('0x8')]);router[_0x9aa5('0x9')]('/',auth['isAuthenticated'](),controller[_0x9aa5('0xa')]);router['put'](_0x9aa5('0x7'),auth[_0x9aa5('0x6')](),controller[_0x9aa5('0xb')]);router[_0x9aa5('0xc')](_0x9aa5('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0x9aa5('0xd')]=router;
\ No newline at end of file
index 3b31c3c..cb78543 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2b7f=['ENUM','STRING','Yes'];(function(_0x331298,_0x12341a){var _0x3824bc=function(_0x19449f){while(--_0x19449f){_0x331298['push'](_0x331298['shift']());}};_0x3824bc(++_0x12341a);}(_0x2b7f,0x120));var _0xf2b7=function(_0x484818,_0x24f768){_0x484818=_0x484818-0x0;var _0x3f3e6b=_0x2b7f[_0x484818];return _0x3f3e6b;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0xf2b7('0x0')]('blind','attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xf2b7('0x1')]},'transferercalleridnum':{'type':Sequelize[_0xf2b7('0x1')]},'transferercalleridname':{'type':Sequelize[_0xf2b7('0x1')]},'transfererconnectedlinenum':{'type':Sequelize[_0xf2b7('0x1')]},'transfererconnectedlinename':{'type':Sequelize[_0xf2b7('0x1')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xf2b7('0x1')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xf2b7('0x1')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xf2b7('0x1')]},'transfereecalleridname':{'type':Sequelize[_0xf2b7('0x1')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xf2b7('0x1')]},'transfereeaccountcode':{'type':Sequelize[_0xf2b7('0x1')]},'transfereecontext':{'type':Sequelize[_0xf2b7('0x1')]},'transfereeexten':{'type':Sequelize[_0xf2b7('0x1')]},'transfereelinkedid':{'type':Sequelize[_0xf2b7('0x1')]},'isexternal':{'type':Sequelize['ENUM'](_0xf2b7('0x2'),'No')},'context':{'type':Sequelize[_0xf2b7('0x1')]},'extension':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0xa5e1=['ENUM','attended','STRING','moment','exports'];(function(_0x30db38,_0x5c2257){var _0x56ce29=function(_0x39153d){while(--_0x39153d){_0x30db38['push'](_0x30db38['shift']());}};_0x56ce29(++_0x5c2257);}(_0xa5e1,0x6c));var _0x1a5e=function(_0x5de8fa,_0x4665af){_0x5de8fa=_0x5de8fa-0x0;var _0x136868=_0xa5e1[_0x5de8fa];return _0x136868;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1a5e('0x0'));module[_0x1a5e('0x1')]={'type':{'type':Sequelize[_0x1a5e('0x2')]('blind',_0x1a5e('0x3'))},'result':{'type':Sequelize[_0x1a5e('0x4')]},'transfererchannel':{'type':Sequelize[_0x1a5e('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x1a5e('0x4')]},'transferercalleridname':{'type':Sequelize[_0x1a5e('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x1a5e('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x1a5e('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x1a5e('0x4')]},'transferercontext':{'type':Sequelize[_0x1a5e('0x4')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x1a5e('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x1a5e('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x1a5e('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x1a5e('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x1a5e('0x4')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x1a5e('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x1a5e('0x4')]},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize[_0x1a5e('0x4')]},'extension':{'type':Sequelize[_0x1a5e('0x4')]}};
\ No newline at end of file
index 1281fce..8d65e9b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeed7=['findAll','rows','catch','show','params','includeAll','create','update','body','find','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','VoiceTransferReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','offset','sort','filter','where','merge','map','type','key','VIRTUAL','field','options','count','include'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeed7,0xdf));var _0x7eed=function(_0x33afc1,_0x5c3d69){_0x33afc1=_0x33afc1-0x0;var _0xeddda6=_0xeed7[_0x33afc1];return _0xeddda6;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7eed('0x0'));var zipdir=require(_0x7eed('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7eed('0x2'));var moment=require(_0x7eed('0x3'));var BPromise=require(_0x7eed('0x4'));var Mustache=require(_0x7eed('0x5'));var util=require('util');var path=require(_0x7eed('0x6'));var sox=require(_0x7eed('0x7'));var csv=require('to-csv');var ejs=require(_0x7eed('0x8'));var fs=require('fs');var _=require(_0x7eed('0x9'));var squel=require(_0x7eed('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7eed('0xb'));var toCsv=require(_0x7eed('0xc'));var querystring=require(_0x7eed('0xd'));var Papa=require('papaparse');var authService=require(_0x7eed('0xe'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0x7eed('0xf'));var logger=require(_0x7eed('0x10'))(_0x7eed('0x11'));var utils=require(_0x7eed('0x12'));var config=require(_0x7eed('0x13'));var db=require(_0x7eed('0x14'))['db'];function respondWithStatusCode(_0xd0d166,_0x23a44c){_0x23a44c=_0x23a44c||0xcc;return function(_0x9e5978){if(_0x9e5978){return _0xd0d166['sendStatus'](_0x23a44c);}return _0xd0d166[_0x7eed('0x15')](_0x23a44c)[_0x7eed('0x16')]();};}function respondWithResult(_0x54ae73,_0x5cd866){_0x5cd866=_0x5cd866||0xc8;return function(_0x5a9490){if(_0x5a9490){return _0x54ae73[_0x7eed('0x15')](_0x5cd866)[_0x7eed('0x17')](_0x5a9490);}};}function respondWithFilteredResult(_0xe64c1,_0xdcfc59){return function(_0x431738){if(_0x431738){var _0x55426b=_0x431738['count'],_0x55db88=_0xdcfc59['offset'],_0x598165=_0xdcfc59['offset']+_0xdcfc59[_0x7eed('0x18')],_0xdcfd1;if(_0x598165>=_0x55426b){_0x598165=_0x55426b;_0xdcfd1=0xc8;}else{_0xdcfd1=0xce;}_0xe64c1[_0x7eed('0x15')](_0xdcfd1);return _0xe64c1[_0x7eed('0x19')](_0x7eed('0x1a'),_0x55db88+'-'+_0x598165+'/'+_0x55426b)[_0x7eed('0x17')](_0x431738);}return null;};}function patchUpdates(_0x13df98){return function(_0x222f33){try{jsonpatch[_0x7eed('0x1b')](_0x222f33,_0x13df98,!![]);}catch(_0x2c9dea){return BPromise[_0x7eed('0x1c')](_0x2c9dea);}return _0x222f33[_0x7eed('0x1d')]();};}function saveUpdates(_0x27b873,_0x458ba9){return function(_0x45357c){if(_0x45357c){return _0x45357c['update'](_0x27b873)[_0x7eed('0x1e')](function(_0x5e9835){return _0x5e9835;});}return null;};}function removeEntity(_0x289d64,_0x50f58c){return function(_0x3252aa){if(_0x3252aa){return _0x3252aa[_0x7eed('0x1f')]()['then'](function(){_0x289d64['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bd3f6,_0x451e71){return function(_0x1a2736){if(!_0x1a2736){_0x2bd3f6[_0x7eed('0x20')](0x194);}return _0x1a2736;};}function handleError(_0xfe3c86,_0x811eeb){_0x811eeb=_0x811eeb||0x1f4;return function(_0x329e5f){logger[_0x7eed('0x21')](_0x329e5f[_0x7eed('0x22')]);if(_0x329e5f[_0x7eed('0x23')]){delete _0x329e5f[_0x7eed('0x23')];}_0xfe3c86[_0x7eed('0x15')](_0x811eeb)[_0x7eed('0x24')](_0x329e5f);};}exports[_0x7eed('0x25')]=function(_0x19c47d,_0x79d72){var _0x10ac28={},_0x34c4ac={},_0x1ee2e5={'count':0x0,'rows':[]};var _0x40d9a0=db[_0x7eed('0x26')][_0x7eed('0x27')];_0x34c4ac[_0x7eed('0x28')]=_[_0x7eed('0x29')](_0x40d9a0);_0x34c4ac[_0x7eed('0x2a')]=_[_0x7eed('0x29')](_0x19c47d[_0x7eed('0x2a')]);_0x34c4ac[_0x7eed('0x2b')]=_[_0x7eed('0x2c')](_0x34c4ac[_0x7eed('0x28')],_0x34c4ac[_0x7eed('0x2a')]);_0x10ac28[_0x7eed('0x2d')]=_[_0x7eed('0x2c')](_0x34c4ac[_0x7eed('0x28')],qs[_0x7eed('0x2e')](_0x19c47d[_0x7eed('0x2a')]['fields']));_0x10ac28[_0x7eed('0x2d')]=_0x10ac28[_0x7eed('0x2d')][_0x7eed('0x2f')]?_0x10ac28[_0x7eed('0x2d')]:_0x34c4ac[_0x7eed('0x28')];if(!_0x19c47d['query']['hasOwnProperty']('nolimit')){_0x10ac28[_0x7eed('0x18')]=qs[_0x7eed('0x18')](_0x19c47d[_0x7eed('0x2a')][_0x7eed('0x18')]);_0x10ac28['offset']=qs[_0x7eed('0x30')](_0x19c47d[_0x7eed('0x2a')]['offset']);}_0x10ac28['order']=qs[_0x7eed('0x31')](_0x19c47d[_0x7eed('0x2a')][_0x7eed('0x31')]);_0x10ac28['where']=qs[_0x7eed('0x2b')](_['pick'](_0x19c47d[_0x7eed('0x2a')],_0x34c4ac[_0x7eed('0x2b')]));if(_0x19c47d[_0x7eed('0x2a')][_0x7eed('0x32')]){_0x10ac28[_0x7eed('0x33')]=_[_0x7eed('0x34')](_0x10ac28[_0x7eed('0x33')],{'$or':_[_0x7eed('0x35')](_0x40d9a0,function(_0x57c89e){if(_0x57c89e[_0x7eed('0x36')][_0x7eed('0x37')]!==_0x7eed('0x38')){var _0x112703={};_0x112703[_0x57c89e[_0x7eed('0x39')]]={'$like':'%'+_0x19c47d[_0x7eed('0x2a')][_0x7eed('0x32')]+'%'};return _0x112703;}})});}_0x10ac28=_[_0x7eed('0x34')]({},_0x10ac28,_0x19c47d[_0x7eed('0x3a')]);var _0x3e25a1={'where':_0x10ac28[_0x7eed('0x33')]};return db['VoiceTransferReport'][_0x7eed('0x3b')](_0x3e25a1)[_0x7eed('0x1e')](function(_0xfd99ab){_0x1ee2e5['count']=_0xfd99ab;if(_0x19c47d[_0x7eed('0x2a')]['includeAll']){_0x10ac28[_0x7eed('0x3c')]=[{'all':!![]}];}return db[_0x7eed('0x26')][_0x7eed('0x3d')](_0x10ac28);})[_0x7eed('0x1e')](function(_0x23d50b){_0x1ee2e5[_0x7eed('0x3e')]=_0x23d50b;return _0x1ee2e5;})[_0x7eed('0x1e')](respondWithFilteredResult(_0x79d72,_0x10ac28))[_0x7eed('0x3f')](handleError(_0x79d72,null));};exports[_0x7eed('0x40')]=function(_0x438dd3,_0x32b400){var _0x5e8c17={'raw':!![],'where':{'id':_0x438dd3[_0x7eed('0x41')]['id']}},_0x1ca060={};_0x1ca060['model']=_[_0x7eed('0x29')](db[_0x7eed('0x26')][_0x7eed('0x27')]);_0x1ca060[_0x7eed('0x2a')]=_[_0x7eed('0x29')](_0x438dd3[_0x7eed('0x2a')]);_0x1ca060[_0x7eed('0x2b')]=_[_0x7eed('0x2c')](_0x1ca060[_0x7eed('0x28')],_0x1ca060[_0x7eed('0x2a')]);_0x5e8c17['attributes']=_[_0x7eed('0x2c')](_0x1ca060[_0x7eed('0x28')],qs[_0x7eed('0x2e')](_0x438dd3[_0x7eed('0x2a')][_0x7eed('0x2e')]));_0x5e8c17[_0x7eed('0x2d')]=_0x5e8c17[_0x7eed('0x2d')][_0x7eed('0x2f')]?_0x5e8c17[_0x7eed('0x2d')]:_0x1ca060[_0x7eed('0x28')];if(_0x438dd3[_0x7eed('0x2a')][_0x7eed('0x42')]){_0x5e8c17[_0x7eed('0x3c')]=[{'all':!![]}];}_0x5e8c17=_[_0x7eed('0x34')]({},_0x5e8c17,_0x438dd3[_0x7eed('0x3a')]);return db['VoiceTransferReport']['find'](_0x5e8c17)[_0x7eed('0x1e')](handleEntityNotFound(_0x32b400,null))[_0x7eed('0x1e')](respondWithResult(_0x32b400,null))[_0x7eed('0x3f')](handleError(_0x32b400,null));};exports['create']=function(_0x5d1cb4,_0x2291c3){return db[_0x7eed('0x26')][_0x7eed('0x43')](_0x5d1cb4['body'],{})[_0x7eed('0x1e')](respondWithResult(_0x2291c3,0xc9))[_0x7eed('0x3f')](handleError(_0x2291c3,null));};exports[_0x7eed('0x44')]=function(_0x306b26,_0x31acad){if(_0x306b26['body']['id']){delete _0x306b26[_0x7eed('0x45')]['id'];}return db[_0x7eed('0x26')]['find']({'where':{'id':_0x306b26['params']['id']}})['then'](handleEntityNotFound(_0x31acad,null))[_0x7eed('0x1e')](saveUpdates(_0x306b26['body'],null))[_0x7eed('0x1e')](respondWithResult(_0x31acad,null))[_0x7eed('0x3f')](handleError(_0x31acad,null));};exports[_0x7eed('0x1f')]=function(_0x2c508c,_0x208da4){return db[_0x7eed('0x26')][_0x7eed('0x46')]({'where':{'id':_0x2c508c[_0x7eed('0x41')]['id']}})[_0x7eed('0x1e')](handleEntityNotFound(_0x208da4,null))[_0x7eed('0x1e')](removeEntity(_0x208da4,null))[_0x7eed('0x3f')](handleError(_0x208da4,null));};
\ No newline at end of file
+var _0x3322=['reject','save','then','destroy','end','sendStatus','error','stack','name','index','VoiceTransferReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','type','key','field','options','includeAll','include','rows','catch','show','params','find','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','status','json','count','offset','limit','set','Content-Range','apply'];(function(_0x29d467,_0x519bb2){var _0x379f36=function(_0x5da058){while(--_0x5da058){_0x29d467['push'](_0x29d467['shift']());}};_0x379f36(++_0x519bb2);}(_0x3322,0x1d9));var _0x2332=function(_0x1b858b,_0x485949){_0x1b858b=_0x1b858b-0x0;var _0x16c004=_0x3322[_0x1b858b];return _0x16c004;};'use strict';var pdf=require(_0x2332('0x0'));var emlformat=require(_0x2332('0x1'));var rimraf=require(_0x2332('0x2'));var zipdir=require(_0x2332('0x3'));var jsonpatch=require(_0x2332('0x4'));var rp=require(_0x2332('0x5'));var moment=require(_0x2332('0x6'));var BPromise=require(_0x2332('0x7'));var Mustache=require('mustache');var util=require(_0x2332('0x8'));var path=require(_0x2332('0x9'));var sox=require(_0x2332('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2332('0xb'));var squel=require(_0x2332('0xc'));var crypto=require(_0x2332('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2332('0xe'));var toCsv=require(_0x2332('0xf'));var querystring=require('querystring');var Papa=require(_0x2332('0x10'));var authService=require(_0x2332('0x11'));var hardwareService=require(_0x2332('0x12'));var Redis=require(_0x2332('0x13'));var qs=require(_0x2332('0x14'));var logger=require(_0x2332('0x15'))('api');var utils=require(_0x2332('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f9ab7,_0x2d61fc){_0x2d61fc=_0x2d61fc||0xcc;return function(_0x1c29f0){if(_0x1c29f0){return _0x2f9ab7['sendStatus'](_0x2d61fc);}return _0x2f9ab7[_0x2332('0x17')](_0x2d61fc)['end']();};}function respondWithResult(_0x17282c,_0x520c0b){_0x520c0b=_0x520c0b||0xc8;return function(_0x387210){if(_0x387210){return _0x17282c[_0x2332('0x17')](_0x520c0b)[_0x2332('0x18')](_0x387210);}};}function respondWithFilteredResult(_0x59f899,_0x49e27b){return function(_0x2d937d){if(_0x2d937d){var _0x9c1bdb=_0x2d937d[_0x2332('0x19')],_0x1d4a02=_0x49e27b[_0x2332('0x1a')],_0x3f0dbf=_0x49e27b[_0x2332('0x1a')]+_0x49e27b[_0x2332('0x1b')],_0x369ea8;if(_0x3f0dbf>=_0x9c1bdb){_0x3f0dbf=_0x9c1bdb;_0x369ea8=0xc8;}else{_0x369ea8=0xce;}_0x59f899[_0x2332('0x17')](_0x369ea8);return _0x59f899[_0x2332('0x1c')](_0x2332('0x1d'),_0x1d4a02+'-'+_0x3f0dbf+'/'+_0x9c1bdb)['json'](_0x2d937d);}return null;};}function patchUpdates(_0x160c63){return function(_0x57722b){try{jsonpatch[_0x2332('0x1e')](_0x57722b,_0x160c63,!![]);}catch(_0x2377a){return BPromise[_0x2332('0x1f')](_0x2377a);}return _0x57722b[_0x2332('0x20')]();};}function saveUpdates(_0xd1c986,_0x24b12e){return function(_0x51c447){if(_0x51c447){return _0x51c447['update'](_0xd1c986)[_0x2332('0x21')](function(_0x297bf6){return _0x297bf6;});}return null;};}function removeEntity(_0x2bb328,_0x25c9e){return function(_0x13a13a){if(_0x13a13a){return _0x13a13a[_0x2332('0x22')]()[_0x2332('0x21')](function(){_0x2bb328[_0x2332('0x17')](0xcc)[_0x2332('0x23')]();});}};}function handleEntityNotFound(_0x52c798,_0x4dd222){return function(_0x5762e3){if(!_0x5762e3){_0x52c798[_0x2332('0x24')](0x194);}return _0x5762e3;};}function handleError(_0x409642,_0x148406){_0x148406=_0x148406||0x1f4;return function(_0x55d784){logger[_0x2332('0x25')](_0x55d784[_0x2332('0x26')]);if(_0x55d784[_0x2332('0x27')]){delete _0x55d784['name'];}_0x409642['status'](_0x148406)['send'](_0x55d784);};}exports[_0x2332('0x28')]=function(_0x2bfc0d,_0x5c5263){var _0x5cdc13={},_0x561caf={},_0x503aa5={'count':0x0,'rows':[]};var _0x241570=db[_0x2332('0x29')][_0x2332('0x2a')];_0x561caf[_0x2332('0x2b')]=_['keys'](_0x241570);_0x561caf['query']=_[_0x2332('0x2c')](_0x2bfc0d[_0x2332('0x2d')]);_0x561caf[_0x2332('0x2e')]=_[_0x2332('0x2f')](_0x561caf['model'],_0x561caf[_0x2332('0x2d')]);_0x5cdc13[_0x2332('0x30')]=_[_0x2332('0x2f')](_0x561caf[_0x2332('0x2b')],qs[_0x2332('0x31')](_0x2bfc0d[_0x2332('0x2d')][_0x2332('0x31')]));_0x5cdc13[_0x2332('0x30')]=_0x5cdc13['attributes'][_0x2332('0x32')]?_0x5cdc13[_0x2332('0x30')]:_0x561caf['model'];if(!_0x2bfc0d['query'][_0x2332('0x33')](_0x2332('0x34'))){_0x5cdc13[_0x2332('0x1b')]=qs[_0x2332('0x1b')](_0x2bfc0d[_0x2332('0x2d')]['limit']);_0x5cdc13[_0x2332('0x1a')]=qs[_0x2332('0x1a')](_0x2bfc0d[_0x2332('0x2d')][_0x2332('0x1a')]);}_0x5cdc13[_0x2332('0x35')]=qs[_0x2332('0x36')](_0x2bfc0d[_0x2332('0x2d')][_0x2332('0x36')]);_0x5cdc13[_0x2332('0x37')]=qs[_0x2332('0x2e')](_['pick'](_0x2bfc0d[_0x2332('0x2d')],_0x561caf[_0x2332('0x2e')]));if(_0x2bfc0d[_0x2332('0x2d')][_0x2332('0x38')]){_0x5cdc13[_0x2332('0x37')]=_[_0x2332('0x39')](_0x5cdc13[_0x2332('0x37')],{'$or':_[_0x2332('0x3a')](_0x241570,function(_0x1c42e4){if(_0x1c42e4[_0x2332('0x3b')][_0x2332('0x3c')]!=='VIRTUAL'){var _0xa4c572={};_0xa4c572[_0x1c42e4[_0x2332('0x3d')]]={'$like':'%'+_0x2bfc0d['query']['filter']+'%'};return _0xa4c572;}})});}_0x5cdc13=_[_0x2332('0x39')]({},_0x5cdc13,_0x2bfc0d[_0x2332('0x3e')]);var _0x54b86f={'where':_0x5cdc13['where']};return db[_0x2332('0x29')]['count'](_0x54b86f)[_0x2332('0x21')](function(_0x1904b0){_0x503aa5[_0x2332('0x19')]=_0x1904b0;if(_0x2bfc0d[_0x2332('0x2d')][_0x2332('0x3f')]){_0x5cdc13[_0x2332('0x40')]=[{'all':!![]}];}return db[_0x2332('0x29')]['findAll'](_0x5cdc13);})[_0x2332('0x21')](function(_0x479420){_0x503aa5[_0x2332('0x41')]=_0x479420;return _0x503aa5;})[_0x2332('0x21')](respondWithFilteredResult(_0x5c5263,_0x5cdc13))[_0x2332('0x42')](handleError(_0x5c5263,null));};exports[_0x2332('0x43')]=function(_0xe38faa,_0x349bb9){var _0x53e375={'raw':!![],'where':{'id':_0xe38faa[_0x2332('0x44')]['id']}},_0x2890c5={};_0x2890c5[_0x2332('0x2b')]=_[_0x2332('0x2c')](db[_0x2332('0x29')][_0x2332('0x2a')]);_0x2890c5[_0x2332('0x2d')]=_[_0x2332('0x2c')](_0xe38faa[_0x2332('0x2d')]);_0x2890c5[_0x2332('0x2e')]=_[_0x2332('0x2f')](_0x2890c5['model'],_0x2890c5[_0x2332('0x2d')]);_0x53e375[_0x2332('0x30')]=_['intersection'](_0x2890c5[_0x2332('0x2b')],qs[_0x2332('0x31')](_0xe38faa[_0x2332('0x2d')]['fields']));_0x53e375[_0x2332('0x30')]=_0x53e375['attributes']['length']?_0x53e375[_0x2332('0x30')]:_0x2890c5[_0x2332('0x2b')];if(_0xe38faa[_0x2332('0x2d')][_0x2332('0x3f')]){_0x53e375[_0x2332('0x40')]=[{'all':!![]}];}_0x53e375=_[_0x2332('0x39')]({},_0x53e375,_0xe38faa['options']);return db['VoiceTransferReport'][_0x2332('0x45')](_0x53e375)[_0x2332('0x21')](handleEntityNotFound(_0x349bb9,null))[_0x2332('0x21')](respondWithResult(_0x349bb9,null))[_0x2332('0x42')](handleError(_0x349bb9,null));};exports['create']=function(_0x3b1fdc,_0x1842b3){return db['VoiceTransferReport']['create'](_0x3b1fdc[_0x2332('0x46')],{})[_0x2332('0x21')](respondWithResult(_0x1842b3,0xc9))[_0x2332('0x42')](handleError(_0x1842b3,null));};exports[_0x2332('0x47')]=function(_0x5f54bb,_0x3c8a87){if(_0x5f54bb[_0x2332('0x46')]['id']){delete _0x5f54bb['body']['id'];}return db['VoiceTransferReport'][_0x2332('0x45')]({'where':{'id':_0x5f54bb[_0x2332('0x44')]['id']}})[_0x2332('0x21')](handleEntityNotFound(_0x3c8a87,null))['then'](saveUpdates(_0x5f54bb[_0x2332('0x46')],null))[_0x2332('0x21')](respondWithResult(_0x3c8a87,null))[_0x2332('0x42')](handleError(_0x3c8a87,null));};exports[_0x2332('0x22')]=function(_0xeb816e,_0x314de1){return db[_0x2332('0x29')]['find']({'where':{'id':_0xeb816e['params']['id']}})[_0x2332('0x21')](handleEntityNotFound(_0x314de1,null))[_0x2332('0x21')](removeEntity(_0x314de1,null))[_0x2332('0x42')](handleError(_0x314de1,null));};
\ No newline at end of file
index 60fc231..fd79d10 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5197=['bluebird','request-promise','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','lodash','util','../../config/logger','api','moment'];(function(_0x9cae6d,_0x2af429){var _0x5341bd=function(_0x3db1f9){while(--_0x3db1f9){_0x9cae6d['push'](_0x9cae6d['shift']());}};_0x5341bd(++_0x2af429);}(_0x5197,0x1b3));var _0x7519=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x5197[_0x58dc25];return _0x21b0a7;};'use strict';var _=require(_0x7519('0x0'));var util=require(_0x7519('0x1'));var logger=require(_0x7519('0x2'))(_0x7519('0x3'));var moment=require(_0x7519('0x4'));var BPromise=require(_0x7519('0x5'));var rp=require(_0x7519('0x6'));var attributes=require(_0x7519('0x7'));module[_0x7519('0x8')]=function(_0x831d27,_0x4aca63){return _0x831d27[_0x7519('0x9')](_0x7519('0xa'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x94e1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer'];(function(_0x45c5dd,_0x32bec6){var _0xa26bc4=function(_0x4d69be){while(--_0x4d69be){_0x45c5dd['push'](_0x45c5dd['shift']());}};_0xa26bc4(++_0x32bec6);}(_0x94e1,0x108));var _0x194e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x94e1[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x194e('0x0'));var util=require(_0x194e('0x1'));var logger=require(_0x194e('0x2'))(_0x194e('0x3'));var moment=require(_0x194e('0x4'));var BPromise=require(_0x194e('0x5'));var rp=require(_0x194e('0x6'));var attributes=require(_0x194e('0x7'));module[_0x194e('0x8')]=function(_0x53bc40,_0x2a9dad){return _0x53bc40[_0x194e('0x9')](_0x194e('0xa'),attributes,{'tableName':_0x194e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index eaa1066..3b761ae 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2e19=['request','info','VoiceTransferReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','CreateVoiceTransferReport','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3e4db1,_0x385cd6){var _0x33ecd5=function(_0x1213ad){while(--_0x1213ad){_0x3e4db1['push'](_0x3e4db1['shift']());}};_0x33ecd5(++_0x385cd6);}(_0x2e19,0xc6));var _0x92e1=function(_0x16abe6,_0x41110e){_0x16abe6=_0x16abe6-0x0;var _0x4233cf=_0x2e19[_0x16abe6];return _0x4233cf;};'use strict';var _=require(_0x92e1('0x0'));var util=require(_0x92e1('0x1'));var moment=require(_0x92e1('0x2'));var BPromise=require(_0x92e1('0x3'));var rs=require(_0x92e1('0x4'));var fs=require('fs');var Redis=require(_0x92e1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x92e1('0x6'));var logger=require(_0x92e1('0x7'))(_0x92e1('0x8'));var config=require('../../config/environment');var jayson=require(_0x92e1('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a1310,_0x46dd4e,_0x9dfe70){return new BPromise(function(_0x1d0019,_0x166421){return client[_0x92e1('0xa')](_0x4a1310,_0x9dfe70)['then'](function(_0x4e2fe0){logger[_0x92e1('0xb')](_0x92e1('0xc'),_0x46dd4e,'request\x20sent');logger[_0x92e1('0xd')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x46dd4e,'request\x20sent',JSON[_0x92e1('0xe')](_0x4e2fe0));if(_0x4e2fe0[_0x92e1('0xf')]){if(_0x4e2fe0[_0x92e1('0xf')][_0x92e1('0x10')]===0x1f4){logger[_0x92e1('0xf')](_0x92e1('0xc'),_0x46dd4e,_0x4e2fe0[_0x92e1('0xf')][_0x92e1('0x11')]);return _0x166421(_0x4e2fe0[_0x92e1('0xf')][_0x92e1('0x11')]);}logger[_0x92e1('0xf')](_0x92e1('0xc'),_0x46dd4e,_0x4e2fe0[_0x92e1('0xf')][_0x92e1('0x11')]);return _0x1d0019(_0x4e2fe0[_0x92e1('0xf')]['message']);}else{logger[_0x92e1('0xb')]('VoiceTransferReport,\x20%s,\x20%s',_0x46dd4e,_0x92e1('0x12'));_0x1d0019(_0x4e2fe0['result'][_0x92e1('0x11')]);}})[_0x92e1('0x13')](function(_0x4245d6){logger[_0x92e1('0xf')](_0x92e1('0xc'),_0x46dd4e,_0x4245d6);_0x166421(_0x4245d6);});});}exports[_0x92e1('0x14')]=function(_0x46ff5f){var _0x21fcb7=this;return new Promise(function(_0x55ee7c,_0x240f37){return db['VoiceTransferReport'][_0x92e1('0x15')](_0x46ff5f[_0x92e1('0x16')],{'raw':_0x46ff5f[_0x92e1('0x17')]?_0x46ff5f[_0x92e1('0x17')][_0x92e1('0x18')]===undefined?!![]:![]:!![]})[_0x92e1('0x19')](function(_0x5d5ee6){logger[_0x92e1('0xb')](_0x92e1('0x14'),_0x46ff5f);logger[_0x92e1('0xd')]('CreateVoiceTransferReport',_0x46ff5f,JSON[_0x92e1('0xe')](_0x5d5ee6));_0x55ee7c(_0x5d5ee6);})['catch'](function(_0x561e38){logger[_0x92e1('0xf')](_0x92e1('0x14'),_0x561e38[_0x92e1('0x11')],_0x46ff5f);_0x240f37(_0x21fcb7[_0x92e1('0xf')](0x1f4,_0x561e38[_0x92e1('0x11')]));});});};
\ No newline at end of file
+var _0x89f6=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','debug','util'];(function(_0x1f5d7d,_0x192ffe){var _0x323486=function(_0x42012f){while(--_0x42012f){_0x1f5d7d['push'](_0x1f5d7d['shift']());}};_0x323486(++_0x192ffe);}(_0x89f6,0x16b));var _0x689f=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x89f6[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require('lodash');var util=require(_0x689f('0x0'));var moment=require(_0x689f('0x1'));var BPromise=require(_0x689f('0x2'));var rs=require(_0x689f('0x3'));var fs=require('fs');var Redis=require(_0x689f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x689f('0x5'));var logger=require(_0x689f('0x6'))(_0x689f('0x7'));var config=require('../../config/environment');var jayson=require(_0x689f('0x8'));var client=jayson[_0x689f('0x9')][_0x689f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c2f90,_0x74e32d,_0x109a18){return new BPromise(function(_0x440590,_0x2c8915){return client[_0x689f('0xb')](_0x5c2f90,_0x109a18)[_0x689f('0xc')](function(_0x2bb5c2){logger[_0x689f('0xd')](_0x689f('0xe'),_0x74e32d,_0x689f('0xf'));logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x74e32d,_0x689f('0xf'),JSON[_0x689f('0x10')](_0x2bb5c2));if(_0x2bb5c2[_0x689f('0x11')]){if(_0x2bb5c2['error'][_0x689f('0x12')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x74e32d,_0x2bb5c2[_0x689f('0x11')][_0x689f('0x13')]);return _0x2c8915(_0x2bb5c2['error'][_0x689f('0x13')]);}logger[_0x689f('0x11')](_0x689f('0xe'),_0x74e32d,_0x2bb5c2[_0x689f('0x11')][_0x689f('0x13')]);return _0x440590(_0x2bb5c2[_0x689f('0x11')][_0x689f('0x13')]);}else{logger[_0x689f('0xd')](_0x689f('0xe'),_0x74e32d,_0x689f('0xf'));_0x440590(_0x2bb5c2['result'][_0x689f('0x13')]);}})[_0x689f('0x14')](function(_0x418212){logger[_0x689f('0x11')](_0x689f('0xe'),_0x74e32d,_0x418212);_0x2c8915(_0x418212);});});}exports[_0x689f('0x15')]=function(_0x3f125d){var _0x30c89e=this;return new Promise(function(_0xb54f7e,_0x122e57){return db[_0x689f('0x16')][_0x689f('0x17')](_0x3f125d[_0x689f('0x18')],{'raw':_0x3f125d['options']?_0x3f125d[_0x689f('0x19')][_0x689f('0x1a')]===undefined?!![]:![]:!![]})[_0x689f('0xc')](function(_0x12ce5e){logger[_0x689f('0xd')](_0x689f('0x15'),_0x3f125d);logger[_0x689f('0x1b')](_0x689f('0x15'),_0x3f125d,JSON[_0x689f('0x10')](_0x12ce5e));_0xb54f7e(_0x12ce5e);})[_0x689f('0x14')](function(_0x3a389c){logger[_0x689f('0x11')](_0x689f('0x15'),_0x3a389c[_0x689f('0x13')],_0x3f125d);_0x122e57(_0x30c89e[_0x689f('0x11')](0x1f4,_0x3a389c[_0x689f('0x13')]));});});};
\ No newline at end of file
index 339f061..f26114f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x00dd=['seedDB','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','sync','then','info','start','filter','online','name','map','status','join','None'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x00dd,0xe9));var _0xd00d=function(_0x11c872,_0x110eb1){_0x11c872=_0x11c872-0x0;var _0x92a55a=_0x00dd[_0x11c872];return _0x92a55a;};'use strict';var _=require(_0xd00d('0x0'));var mysqldb=require(_0xd00d('0x1'));var rpc=require('./rpc');var config=require(_0xd00d('0x2'));var logger=require(_0xd00d('0x3'))(_0xd00d('0x4'));var pm2=require(_0xd00d('0x5'));var pm2Config=require(_0xd00d('0x6'));var schedule=require(_0xd00d('0x7'));var chat=require(_0xd00d('0x8'));function main(){return mysqldb['db']['sequelize'][_0xd00d('0x9')]()[_0xd00d('0xa')](function(){return rpc['listen']();})[_0xd00d('0xa')](function(_0x1febcd){logger[_0xd00d('0xb')](_0x1febcd);return chat[_0xd00d('0xc')]();})['then'](function(){return schedule[_0xd00d('0xc')]();})[_0xd00d('0xa')](function(_0x44952e){logger[_0xd00d('0xb')](_0x44952e);return pm2['start'](pm2Config);})['then'](function(_0x278be7){logger[_0xd00d('0xb')]('Online\x20apps:',_['map'](_[_0xd00d('0xd')](_0x278be7,{'status':_0xd00d('0xe')}),_0xd00d('0xf'))['join']());logger[_0xd00d('0xb')]('Offline\x20apps:',_[_0xd00d('0x10')](_['filter'](_0x278be7,function(_0x4a100b){return _0x4a100b[_0xd00d('0x11')]!==_0xd00d('0xe');}),_0xd00d('0xf'))[_0xd00d('0x12')]()||_0xd00d('0x13'));config[_0xd00d('0x14')]&&require('./config/seedDB')['default']();require('./config/license')['default']();})[_0xd00d('0x15')](function(_0x175a09){logger['error'](_0xd00d('0x16'),_0x175a09);process['exit'](0x1);});}main();
\ No newline at end of file
+var _0x7b78=['filter','online','join','Offline\x20apps:','name','None','./config/seedDB','default','catch','error','exit','lodash','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','sequelize','then','listen','info','start','map'];(function(_0xe1d149,_0x30e778){var _0x220e56=function(_0x12ac80){while(--_0x12ac80){_0xe1d149['push'](_0xe1d149['shift']());}};_0x220e56(++_0x30e778);}(_0x7b78,0xad));var _0x87b7=function(_0x33b4bd,_0x1e618e){_0x33b4bd=_0x33b4bd-0x0;var _0x20020f=_0x7b78[_0x33b4bd];return _0x20020f;};'use strict';var _=require(_0x87b7('0x0'));var mysqldb=require(_0x87b7('0x1'));var rpc=require(_0x87b7('0x2'));var config=require(_0x87b7('0x3'));var logger=require(_0x87b7('0x4'))(_0x87b7('0x5'));var pm2=require(_0x87b7('0x6'));var pm2Config=require(_0x87b7('0x7'));var schedule=require(_0x87b7('0x8'));var chat=require(_0x87b7('0x9'));function main(){return mysqldb['db'][_0x87b7('0xa')]['sync']()[_0x87b7('0xb')](function(){return rpc[_0x87b7('0xc')]();})[_0x87b7('0xb')](function(_0xae70b5){logger[_0x87b7('0xd')](_0xae70b5);return chat['start']();})['then'](function(){return schedule[_0x87b7('0xe')]();})[_0x87b7('0xb')](function(_0x574804){logger['info'](_0x574804);return pm2[_0x87b7('0xe')](pm2Config);})[_0x87b7('0xb')](function(_0x928d6){logger[_0x87b7('0xd')]('Online\x20apps:',_[_0x87b7('0xf')](_[_0x87b7('0x10')](_0x928d6,{'status':_0x87b7('0x11')}),'name')[_0x87b7('0x12')]());logger[_0x87b7('0xd')](_0x87b7('0x13'),_['map'](_[_0x87b7('0x10')](_0x928d6,function(_0x577bbc){return _0x577bbc['status']!==_0x87b7('0x11');}),_0x87b7('0x14'))[_0x87b7('0x12')]()||_0x87b7('0x15'));config['seedDB']&&require(_0x87b7('0x16'))['default']();require('./config/license')[_0x87b7('0x17')]();})[_0x87b7('0x18')](function(_0x2ca329){logger[_0x87b7('0x19')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x2ca329);process[_0x87b7('0x1a')](0x1);});}main();
\ No newline at end of file
index df46685..9dfcbca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x32a6=['redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','randomBytes','hex','floor','now','toString','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','composable-middleware','crypto','ipaddr.js','secrets','session','role','name','internal','userpic','permissions','voicePause','chatPause','mailPause','smsPause','openchannelPause','pauseType','phoneBarRemoteControlPort','interface','userProfileId','isChatInteractionAuthorized','use','ChatInteraction','findOne','closed','disposition','unmanaged','json','Forbidden.','catch','headers','authorization','startsWith','User','find','Wrong\x20credentials.','user','Bearer','status','query','apikey','verify','getUuid','sub','isEqual','nonce','log','Unrecognized\x20API\x20access\x20key','Unknown\x20authorization\x20format','then','User\x20not\x20found.','User\x20object\x20not\x20found.','isAuthenticated','../../config/license/util','getLicense','Forbidden','sign','hasRole','Required\x20role\x20needs\x20to\x20be\x20set','indexOf','userRoles','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.user','stringify','pick'];(function(_0x38436b,_0x2f03ec){var _0x7407d0=function(_0x30b9f2){while(--_0x30b9f2){_0x38436b['push'](_0x38436b['shift']());}};_0x7407d0(++_0x2f03ec);}(_0x32a6,0x162));var _0x632a=function(_0xce2ebf,_0x25fa94){_0xce2ebf=_0xce2ebf-0x0;var _0x12e790=_0x32a6[_0xce2ebf];return _0x12e790;};'use strict';var db=require(_0x632a('0x0'))['db'];var config=require(_0x632a('0x1'));var hardwareConf=require(_0x632a('0x2'));var _=require(_0x632a('0x3'));var jwt=require(_0x632a('0x4'));var expressJwt=require('express-jwt');var compose=require(_0x632a('0x5'));var basicAuth=require('basic-auth');var crypto=require(_0x632a('0x6'));var ipaddr=require(_0x632a('0x7'));var validateJwt=expressJwt({'secret':config[_0x632a('0x8')][_0x632a('0x9')]});var userAttributes=['id',_0x632a('0xa'),'fullname',_0x632a('0xb'),_0x632a('0xc'),'email',_0x632a('0xd'),_0x632a('0xe'),_0x632a('0xf'),_0x632a('0x10'),_0x632a('0x11'),'faxPause',_0x632a('0x12'),_0x632a('0x13'),_0x632a('0x14'),'showWebBar',_0x632a('0x15'),'phoneBarRemoteControl',_0x632a('0x16'),_0x632a('0x17')];exports[_0x632a('0x18')]=function(){return isAuthenticated(!![])[_0x632a('0x19')](function(_0x19bd64,_0x27de80,_0x500036){if(_0x19bd64['user']){_0x500036();}else{return db[_0x632a('0x1a')][_0x632a('0x1b')]({'where':{'id':_0x19bd64['params']['id']},'attributes':['id',_0x632a('0x1c'),_0x632a('0x1d')],'raw':!![]})['then'](function(_0x5d7cd9){if(_0x5d7cd9&&_0x5d7cd9[_0x632a('0x1c')]){return _0x27de80['status'](_0x5d7cd9[_0x632a('0x1d')]===_0x632a('0x1e')?0x195:0x193)[_0x632a('0x1f')]({'message':_0x5d7cd9['disposition']===_0x632a('0x1e')?'Unmanaged.':_0x632a('0x20')});}else{_0x500036();}})[_0x632a('0x21')](function(_0x49d378){_0x500036(_0x49d378);});}});};function isAuthenticated(_0x55aa9e){return compose()[_0x632a('0x19')](function(_0x37c210,_0x3ad007,_0x4f7eb4){if(_0x37c210[_0x632a('0x22')][_0x632a('0x23')]){if(_[_0x632a('0x24')](_0x37c210[_0x632a('0x22')][_0x632a('0x23')],'Basic')){var _0x2a5d3e=basicAuth(_0x37c210);db[_0x632a('0x25')][_0x632a('0x26')]({'where':{'name':_0x2a5d3e[_0x632a('0xb')]}})['then'](function(_0xbe45e2){if(!_0xbe45e2||!_0xbe45e2['authenticate'](_0x2a5d3e['pass'])){return _0x3ad007['status'](0x191)[_0x632a('0x1f')]({'message':_0x632a('0x27')});}_0x37c210[_0x632a('0x28')]={'id':_0xbe45e2['id']};_0x4f7eb4();})[_0x632a('0x21')](function(_0x1ae0f9){_0x4f7eb4(_0x1ae0f9);});}else if(_[_0x632a('0x24')](_0x37c210[_0x632a('0x22')][_0x632a('0x23')],_0x632a('0x29'))){validateJwt(_0x37c210,_0x3ad007,_0x4f7eb4);}else{if(_0x55aa9e){_0x4f7eb4();}else{return _0x3ad007[_0x632a('0x2a')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x37c210[_0x632a('0x2b')][_0x632a('0x2c')]){try{var _0x4e146c=jwt[_0x632a('0x2d')](_0x37c210[_0x632a('0x2b')][_0x632a('0x2c')],config[_0x632a('0x8')][_0x632a('0x9')],{'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x632a('0x2e')]()});db[_0x632a('0x25')]['find']({'where':{'id':_0x4e146c[_0x632a('0x2f')]}})['then'](function(_0x20567f){if(!_0x20567f||!_[_0x632a('0x30')](_0x20567f['apiKeyNonce'],_0x4e146c[_0x632a('0x31')])){return _0x3ad007[_0x632a('0x2a')](0x193)[_0x632a('0x1f')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}_0x37c210[_0x632a('0x28')]={'id':_0x20567f['id']};_0x4f7eb4();})['catch'](function(_0x234a4c){_0x4f7eb4(_0x234a4c);});}catch(_0x1ee145){console[_0x632a('0x32')](_0x1ee145);return _0x3ad007[_0x632a('0x2a')](0x193)[_0x632a('0x1f')]({'message':_0x632a('0x33')});}}else if(_0x55aa9e){_0x4f7eb4();}else{return _0x3ad007[_0x632a('0x2a')](0x193)[_0x632a('0x1f')]({'message':_0x632a('0x34')});}})[_0x632a('0x19')](function(_0x137913,_0x2c0487,_0x176fbe){if(_0x137913[_0x632a('0x28')]){db['User']['find']({'where':{'id':_0x137913[_0x632a('0x28')]['id']},'attributes':userAttributes})[_0x632a('0x35')](function(_0x39a0da){if(!_0x39a0da){return _0x2c0487[_0x632a('0x2a')](0x194)['json']({'message':_0x632a('0x36')});}_0x137913['user']=_0x39a0da;_0x176fbe();})[_0x632a('0x21')](function(_0x3c9b1f){_0x176fbe(_0x3c9b1f);});}else if(_0x55aa9e){_0x176fbe();}else{return _0x2c0487[_0x632a('0x2a')](0x194)[_0x632a('0x1f')]({'message':_0x632a('0x37')});}});}exports[_0x632a('0x38')]=isAuthenticated;function canUpdate(){return compose()[_0x632a('0x19')](function(_0x4c43db,_0x3e1e32,_0x193678){return require(_0x632a('0x39'))[_0x632a('0x3a')]()[_0x632a('0x35')](function(_0xc49565){if(_0xc49565['update']){_0x193678();}else{return _0x3e1e32['status'](0x193)['json']({'message':_0x632a('0x3b')});}})[_0x632a('0x21')](function(_0x4d8a36){_0x193678(_0x4d8a36);});});}exports['canUpdate']=canUpdate;function signToken(_0x41cce4,_0x4fea62){return jwt[_0x632a('0x3c')]({'id':_0x41cce4,'role':_0x4fea62},config[_0x632a('0x8')]['session'],{'expiresIn':0x15180});}exports['signToken']=signToken;exports[_0x632a('0x3d')]=function(_0x297300){if(!_0x297300){throw new Error(_0x632a('0x3e'));}return compose()[_0x632a('0x19')](isAuthenticated())[_0x632a('0x19')](function meetsRequirements(_0x235ab5,_0x4a6dad,_0xdb9ac2){if(config['userRoles'][_0x632a('0x3f')](_0x235ab5[_0x632a('0x28')][_0x632a('0xa')])>=config[_0x632a('0x40')]['indexOf'](_0x297300)){return _0xdb9ac2();}else{return _0x4a6dad[_0x632a('0x2a')](0x193)['json']({'message':_0x632a('0x3b')});}});};exports[_0x632a('0x41')]=function(_0x514bb1,_0x144de2){if(!_0x514bb1[_0x632a('0x28')]){return _0x144de2[_0x632a('0x2a')](0x194)[_0x632a('0x1f')]({'message':_0x632a('0x42')});}var _0x59444a=signToken(_0x514bb1[_0x632a('0x28')]['id'],_0x514bb1['user']['role']);_0x144de2[_0x632a('0x43')]('motion.token',_0x59444a);_0x144de2['cookie'](_0x632a('0x44'),JSON[_0x632a('0x45')](_[_0x632a('0x46')](_0x514bb1[_0x632a('0x28')],userAttributes)));_0x144de2[_0x632a('0x47')](_0x632a('0x48'));};exports[_0x632a('0x49')]=function(_0x4cd717){if(_[_0x632a('0x4a')](_0x4cd717[_0x632a('0x4b')])||_[_0x632a('0x4a')](_0x4cd717[_0x632a('0x4c')]))return null;else return createJwt(_0x4cd717);};exports['generateApiKey']=function(_0x253c76){_0x253c76['apiKeyNonce']=crypto[_0x632a('0x4d')](0x10)['toString'](_0x632a('0x4e'));_0x253c76[_0x632a('0x4c')]=Math[_0x632a('0x4f')](Date[_0x632a('0x50')]()/0x3e8)[_0x632a('0x51')]();return createJwt(_0x253c76);};exports[_0x632a('0x52')]=function(_0x1cb434,_0x463773){if(_0x1cb434[_0x632a('0x2b')][_0x632a('0x2c')]){jwt[_0x632a('0x2d')](_0x1cb434[_0x632a('0x2b')][_0x632a('0x2c')],config[_0x632a('0x8')]['session'],{'nonce':_0x463773['apiKeyNonce'],'iat':_0x463773[_0x632a('0x4c')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x632a('0x2e')]()});return generateApiKey(_0x463773);}else{throw{'message':_0x632a('0x53')};}};function createJwt(_0x289b12){return jwt[_0x632a('0x3c')]({'iat':_0x289b12[_0x632a('0x4c')],'nonce':_0x289b12[_0x632a('0x4b')]},config[_0x632a('0x8')][_0x632a('0x9')],{'algorithm':_0x632a('0x54'),'subject':_0x289b12['id'][_0x632a('0x51')](),'issuer':hardwareConf[_0x632a('0x2e')](),'audience':hardwareConf['getUuid']()});}
\ No newline at end of file
+var _0x1c8f=['randomBytes','toString','hex','floor','now','regenerateApiKey','HS512','../../config/environment','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','ipaddr.js','secrets','session','role','email','userpic','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','phoneBarRemoteControlPort','phoneBarRemoteControl','interface','userProfileId','user','params','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','catch','use','headers','authorization','startsWith','User','find','name','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','apikey','verify','query','getUuid','sub','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','log','Unrecognized\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','../../config/license/util','update','Forbidden','canUpdate','sign','signToken','hasRole','Required\x20role\x20needs\x20to\x20be\x20set','indexOf','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.user','stringify','pick','redirect','/dashboards/general','isNil','apiKeyNonce','apiKeyIat','generateApiKey'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x1c8f,0x109));var _0xf1c8=function(_0x4257ab,_0x442c67){_0x4257ab=_0x4257ab-0x0;var _0x4953e8=_0x1c8f[_0x4257ab];return _0x4953e8;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0xf1c8('0x0'));var hardwareConf=require('../../config/license/hardware');var _=require(_0xf1c8('0x1'));var jwt=require(_0xf1c8('0x2'));var expressJwt=require(_0xf1c8('0x3'));var compose=require(_0xf1c8('0x4'));var basicAuth=require(_0xf1c8('0x5'));var crypto=require('crypto');var ipaddr=require(_0xf1c8('0x6'));var validateJwt=expressJwt({'secret':config[_0xf1c8('0x7')][_0xf1c8('0x8')]});var userAttributes=['id',_0xf1c8('0x9'),'fullname','name','internal',_0xf1c8('0xa'),_0xf1c8('0xb'),'permissions',_0xf1c8('0xc'),_0xf1c8('0xd'),_0xf1c8('0xe'),_0xf1c8('0xf'),_0xf1c8('0x10'),_0xf1c8('0x11'),_0xf1c8('0x12'),_0xf1c8('0x13'),_0xf1c8('0x14'),_0xf1c8('0x15'),_0xf1c8('0x16'),_0xf1c8('0x17')];exports['isChatInteractionAuthorized']=function(){return isAuthenticated(!![])['use'](function(_0x52ddfd,_0x587549,_0x2e94d2){if(_0x52ddfd[_0xf1c8('0x18')]){_0x2e94d2();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x52ddfd[_0xf1c8('0x19')]['id']},'attributes':['id','closed',_0xf1c8('0x1a')],'raw':!![]})[_0xf1c8('0x1b')](function(_0x134a76){if(_0x134a76&&_0x134a76['closed']){return _0x587549[_0xf1c8('0x1c')](_0x134a76['disposition']===_0xf1c8('0x1d')?0x195:0x193)[_0xf1c8('0x1e')]({'message':_0x134a76[_0xf1c8('0x1a')]===_0xf1c8('0x1d')?_0xf1c8('0x1f'):_0xf1c8('0x20')});}else{_0x2e94d2();}})[_0xf1c8('0x21')](function(_0x4b660){_0x2e94d2(_0x4b660);});}});};function isAuthenticated(_0x1c83f2){return compose()[_0xf1c8('0x22')](function(_0x3504ba,_0x35052b,_0x3a5f76){if(_0x3504ba[_0xf1c8('0x23')][_0xf1c8('0x24')]){if(_[_0xf1c8('0x25')](_0x3504ba[_0xf1c8('0x23')]['authorization'],'Basic')){var _0x4a7b70=basicAuth(_0x3504ba);db[_0xf1c8('0x26')][_0xf1c8('0x27')]({'where':{'name':_0x4a7b70[_0xf1c8('0x28')]}})[_0xf1c8('0x1b')](function(_0x1aa0c7){if(!_0x1aa0c7||!_0x1aa0c7[_0xf1c8('0x29')](_0x4a7b70[_0xf1c8('0x2a')])){return _0x35052b[_0xf1c8('0x1c')](0x191)['json']({'message':_0xf1c8('0x2b')});}_0x3504ba['user']={'id':_0x1aa0c7['id']};_0x3a5f76();})[_0xf1c8('0x21')](function(_0x56bd5c){_0x3a5f76(_0x56bd5c);});}else if(_['startsWith'](_0x3504ba[_0xf1c8('0x23')][_0xf1c8('0x24')],_0xf1c8('0x2c'))){validateJwt(_0x3504ba,_0x35052b,_0x3a5f76);}else{if(_0x1c83f2){_0x3a5f76();}else{return _0x35052b[_0xf1c8('0x1c')](0x193)[_0xf1c8('0x1e')]({'message':_0xf1c8('0x2d')});}}}else if(_0x3504ba['query'][_0xf1c8('0x2e')]){try{var _0x16c291=jwt[_0xf1c8('0x2f')](_0x3504ba[_0xf1c8('0x30')][_0xf1c8('0x2e')],config[_0xf1c8('0x7')][_0xf1c8('0x8')],{'audience':hardwareConf[_0xf1c8('0x31')](),'issuer':hardwareConf[_0xf1c8('0x31')]()});db['User'][_0xf1c8('0x27')]({'where':{'id':_0x16c291[_0xf1c8('0x32')]}})['then'](function(_0xab19d0){if(!_0xab19d0||!_[_0xf1c8('0x33')](_0xab19d0['apiKeyNonce'],_0x16c291[_0xf1c8('0x34')])){return _0x35052b[_0xf1c8('0x1c')](0x193)[_0xf1c8('0x1e')]({'message':_0xf1c8('0x35')});}_0x3504ba[_0xf1c8('0x18')]={'id':_0xab19d0['id']};_0x3a5f76();})['catch'](function(_0x289738){_0x3a5f76(_0x289738);});}catch(_0x2856b4){console[_0xf1c8('0x36')](_0x2856b4);return _0x35052b[_0xf1c8('0x1c')](0x193)['json']({'message':_0xf1c8('0x37')});}}else if(_0x1c83f2){_0x3a5f76();}else{return _0x35052b[_0xf1c8('0x1c')](0x193)[_0xf1c8('0x1e')]({'message':_0xf1c8('0x2d')});}})[_0xf1c8('0x22')](function(_0x485cbb,_0x1b6e26,_0x119bb2){if(_0x485cbb[_0xf1c8('0x18')]){db[_0xf1c8('0x26')][_0xf1c8('0x27')]({'where':{'id':_0x485cbb[_0xf1c8('0x18')]['id']},'attributes':userAttributes})[_0xf1c8('0x1b')](function(_0x35d687){if(!_0x35d687){return _0x1b6e26[_0xf1c8('0x1c')](0x194)[_0xf1c8('0x1e')]({'message':_0xf1c8('0x38')});}_0x485cbb['user']=_0x35d687;_0x119bb2();})[_0xf1c8('0x21')](function(_0x1a5c64){_0x119bb2(_0x1a5c64);});}else if(_0x1c83f2){_0x119bb2();}else{return _0x1b6e26['status'](0x194)['json']({'message':_0xf1c8('0x39')});}});}exports['isAuthenticated']=isAuthenticated;function canUpdate(){return compose()['use'](function(_0x43174d,_0x5cccde,_0x3da3bd){return require(_0xf1c8('0x3a'))['getLicense']()[_0xf1c8('0x1b')](function(_0x35a766){if(_0x35a766[_0xf1c8('0x3b')]){_0x3da3bd();}else{return _0x5cccde[_0xf1c8('0x1c')](0x193)['json']({'message':_0xf1c8('0x3c')});}})[_0xf1c8('0x21')](function(_0x297ba2){_0x3da3bd(_0x297ba2);});});}exports[_0xf1c8('0x3d')]=canUpdate;function signToken(_0x1ce6ed,_0x11ca3b){return jwt[_0xf1c8('0x3e')]({'id':_0x1ce6ed,'role':_0x11ca3b},config[_0xf1c8('0x7')][_0xf1c8('0x8')],{'expiresIn':0x15180});}exports[_0xf1c8('0x3f')]=signToken;exports[_0xf1c8('0x40')]=function(_0x2f8877){if(!_0x2f8877){throw new Error(_0xf1c8('0x41'));}return compose()['use'](isAuthenticated())['use'](function meetsRequirements(_0x397bdf,_0x4b4f9f,_0xe3967b){if(config['userRoles'][_0xf1c8('0x42')](_0x397bdf[_0xf1c8('0x18')][_0xf1c8('0x9')])>=config['userRoles'][_0xf1c8('0x42')](_0x2f8877)){return _0xe3967b();}else{return _0x4b4f9f[_0xf1c8('0x1c')](0x193)[_0xf1c8('0x1e')]({'message':_0xf1c8('0x3c')});}});};exports[_0xf1c8('0x43')]=function(_0x8ed62e,_0xdfd425){if(!_0x8ed62e[_0xf1c8('0x18')]){return _0xdfd425['status'](0x194)['json']({'message':_0xf1c8('0x44')});}var _0x3c3186=signToken(_0x8ed62e[_0xf1c8('0x18')]['id'],_0x8ed62e[_0xf1c8('0x18')]['role']);_0xdfd425['cookie']('motion.token',_0x3c3186);_0xdfd425[_0xf1c8('0x45')](_0xf1c8('0x46'),JSON[_0xf1c8('0x47')](_[_0xf1c8('0x48')](_0x8ed62e[_0xf1c8('0x18')],userAttributes)));_0xdfd425[_0xf1c8('0x49')](_0xf1c8('0x4a'));};exports['retrieveApiKey']=function(_0x329c6a){if(_[_0xf1c8('0x4b')](_0x329c6a[_0xf1c8('0x4c')])||_[_0xf1c8('0x4b')](_0x329c6a[_0xf1c8('0x4d')]))return null;else return createJwt(_0x329c6a);};exports[_0xf1c8('0x4e')]=function(_0x3a61ca){_0x3a61ca[_0xf1c8('0x4c')]=crypto[_0xf1c8('0x4f')](0x10)[_0xf1c8('0x50')](_0xf1c8('0x51'));_0x3a61ca[_0xf1c8('0x4d')]=Math[_0xf1c8('0x52')](Date[_0xf1c8('0x53')]()/0x3e8)['toString']();return createJwt(_0x3a61ca);};exports[_0xf1c8('0x54')]=function(_0x8c7598,_0x32d658){if(_0x8c7598[_0xf1c8('0x30')]['apikey']){jwt['verify'](_0x8c7598['query'][_0xf1c8('0x2e')],config[_0xf1c8('0x7')][_0xf1c8('0x8')],{'nonce':_0x32d658[_0xf1c8('0x4c')],'iat':_0x32d658[_0xf1c8('0x4d')],'audience':hardwareConf[_0xf1c8('0x31')](),'issuer':hardwareConf[_0xf1c8('0x31')]()});return generateApiKey(_0x32d658);}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};function createJwt(_0x9b3645){return jwt[_0xf1c8('0x3e')]({'iat':_0x9b3645[_0xf1c8('0x4d')],'nonce':_0x9b3645['apiKeyNonce']},config['secrets'][_0xf1c8('0x8')],{'algorithm':_0xf1c8('0x55'),'subject':_0x9b3645['id'][_0xf1c8('0x50')](),'issuer':hardwareConf[_0xf1c8('0x31')](),'audience':hardwareConf[_0xf1c8('0x31')]()});}
\ No newline at end of file
index 5bc05d6..5e56ea5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x36b8=['close','unlink','hasOwnProperty','createReadStream','createCipher','algorithm','update','write','end','final','binary','data'];(function(_0x5e00ed,_0x13bc91){var _0x3af0cb=function(_0x763885){while(--_0x763885){_0x5e00ed['push'](_0x5e00ed['shift']());}};_0x3af0cb(++_0x13bc91);}(_0x36b8,0x1ca));var _0x836b=function(_0x524d6b,_0x143a0d){_0x524d6b=_0x524d6b-0x0;var _0x5233d3=_0x36b8[_0x524d6b];return _0x5233d3;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var defaultOptions={'algorithm':'aes192'};function combineOptions(_0x294866){var _0x5c5744={};for(var _0x2aa116 in defaultOptions){if(defaultOptions[_0x836b('0x0')](_0x2aa116)){_0x5c5744[_0x2aa116]=defaultOptions[_0x2aa116];}}if(_0x294866){for(var _0x1f630c in _0x294866){if(_0x294866['hasOwnProperty'](_0x1f630c)){_0x5c5744[_0x1f630c]=_0x294866[_0x1f630c];}}}return _0x5c5744;}exports['encryptFile']=function(_0x1906b6,_0x2b9dd1,_0x1f0d95,_0x22c280){return new BPromise(function(_0x2a03db,_0x325466){_0x22c280=combineOptions(_0x22c280);var _0x3c3bef=new Buffer(_0x1f0d95);var _0x8178f4=fs[_0x836b('0x1')](_0x1906b6);var _0x18e65d=fs['createWriteStream'](_0x2b9dd1);var _0xc79eee=crypto[_0x836b('0x2')](_0x22c280[_0x836b('0x3')],_0x3c3bef);_0x8178f4['on']('data',function(_0x15df08){var _0x5474ba=new Buffer(_0xc79eee[_0x836b('0x4')](_0x15df08),'binary');_0x18e65d[_0x836b('0x5')](_0x5474ba);});_0x8178f4['on'](_0x836b('0x6'),function(){try{var _0xff70d8=new Buffer(_0xc79eee[_0x836b('0x7')](_0x836b('0x8')),_0x836b('0x8'));_0x18e65d[_0x836b('0x5')](_0xff70d8);_0x18e65d[_0x836b('0x6')]();_0x18e65d['on']('close',function(){return _0x2a03db(_0x2b9dd1);});}catch(_0x348856){fs['unlink'](_0x2b9dd1);return _0x325466(_0x348856);}});});};exports['decryptFile']=function(_0x11ec5f,_0x42c9ed,_0x1633db,_0x1ba750){return new BPromise(function(_0x2465e2,_0x570899){_0x1ba750=combineOptions(_0x1ba750);var _0x2816b6=new Buffer(_0x1633db);var _0x286c43=fs['createReadStream'](_0x11ec5f);var _0x5e228c=fs['createWriteStream'](_0x42c9ed);var _0x58b924=crypto['createDecipher'](_0x1ba750['algorithm'],_0x2816b6);_0x286c43['on'](_0x836b('0x9'),function(_0x159646){var _0x3091a8=new Buffer(_0x58b924['update'](_0x159646),_0x836b('0x8'));_0x5e228c[_0x836b('0x5')](_0x3091a8);});_0x286c43['on'](_0x836b('0x6'),function(){try{var _0x5c5620=new Buffer(_0x58b924[_0x836b('0x7')]('binary'),_0x836b('0x8'));_0x5e228c[_0x836b('0x5')](_0x5c5620);_0x5e228c[_0x836b('0x6')]();_0x5e228c['on'](_0x836b('0xa'),function(){return _0x2465e2(_0x42c9ed);});}catch(_0x16d9da){fs[_0x836b('0xb')](_0x42c9ed);return _0x570899(_0x16d9da);}});});};
\ No newline at end of file
+var _0xb680=['createWriteStream','algorithm','data','update','write','final','close','decryptFile','binary','end','unlink','crypto','aes192','hasOwnProperty','encryptFile'];(function(_0x241d22,_0x37e10a){var _0x26ad16=function(_0x28a735){while(--_0x28a735){_0x241d22['push'](_0x241d22['shift']());}};_0x26ad16(++_0x37e10a);}(_0xb680,0x1cd));var _0x0b68=function(_0x21fc68,_0x459828){_0x21fc68=_0x21fc68-0x0;var _0x3561e1=_0xb680[_0x21fc68];return _0x3561e1;};'use strict';var crypto=require(_0x0b68('0x0'));var fs=require('fs');var BPromise=require('bluebird');var defaultOptions={'algorithm':_0x0b68('0x1')};function combineOptions(_0x3eb3bc){var _0x443329={};for(var _0x177248 in defaultOptions){if(defaultOptions[_0x0b68('0x2')](_0x177248)){_0x443329[_0x177248]=defaultOptions[_0x177248];}}if(_0x3eb3bc){for(var _0x48ecb9 in _0x3eb3bc){if(_0x3eb3bc['hasOwnProperty'](_0x48ecb9)){_0x443329[_0x48ecb9]=_0x3eb3bc[_0x48ecb9];}}}return _0x443329;}exports[_0x0b68('0x3')]=function(_0xaee1f1,_0x5aec65,_0x29469f,_0x1e0103){return new BPromise(function(_0x59f003,_0x136690){_0x1e0103=combineOptions(_0x1e0103);var _0x53db5c=new Buffer(_0x29469f);var _0x181d85=fs['createReadStream'](_0xaee1f1);var _0x38ab4f=fs[_0x0b68('0x4')](_0x5aec65);var _0x4be04a=crypto['createCipher'](_0x1e0103[_0x0b68('0x5')],_0x53db5c);_0x181d85['on'](_0x0b68('0x6'),function(_0x274fd3){var _0x371a77=new Buffer(_0x4be04a[_0x0b68('0x7')](_0x274fd3),'binary');_0x38ab4f[_0x0b68('0x8')](_0x371a77);});_0x181d85['on']('end',function(){try{var _0x3c19c5=new Buffer(_0x4be04a[_0x0b68('0x9')]('binary'),'binary');_0x38ab4f[_0x0b68('0x8')](_0x3c19c5);_0x38ab4f['end']();_0x38ab4f['on'](_0x0b68('0xa'),function(){return _0x59f003(_0x5aec65);});}catch(_0x299335){fs['unlink'](_0x5aec65);return _0x136690(_0x299335);}});});};exports[_0x0b68('0xb')]=function(_0x55cdba,_0x4f290a,_0x546c05,_0x4109b4){return new BPromise(function(_0x111442,_0x14eb5d){_0x4109b4=combineOptions(_0x4109b4);var _0x19856b=new Buffer(_0x546c05);var _0x45746f=fs['createReadStream'](_0x55cdba);var _0x1ce9e6=fs['createWriteStream'](_0x4f290a);var _0x4872fb=crypto['createDecipher'](_0x4109b4[_0x0b68('0x5')],_0x19856b);_0x45746f['on'](_0x0b68('0x6'),function(_0x102f5e){var _0xc3728c=new Buffer(_0x4872fb[_0x0b68('0x7')](_0x102f5e),_0x0b68('0xc'));_0x1ce9e6[_0x0b68('0x8')](_0xc3728c);});_0x45746f['on']('end',function(){try{var _0x2ab2f6=new Buffer(_0x4872fb['final'](_0x0b68('0xc')),'binary');_0x1ce9e6['write'](_0x2ab2f6);_0x1ce9e6[_0x0b68('0xd')]();_0x1ce9e6['on']('close',function(){return _0x111442(_0x4f290a);});}catch(_0x27eea0){fs[_0x0b68('0xe')](_0x4f290a);return _0x14eb5d(_0x27eea0);}});});};
\ No newline at end of file
index 4eedde4..7f34884 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8737=['num','Empty','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.csv','join','mkdirSync','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','bluebird','rimraf','../../mysqldb','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes'];(function(_0x59312d,_0x52bb25){var _0x13ca66=function(_0x2d4a0c){while(--_0x2d4a0c){_0x59312d['push'](_0x59312d['shift']());}};_0x13ca66(++_0x52bb25);}(_0x8737,0x175));var _0x7873=function(_0x18cd2f,_0x431dc5){_0x18cd2f=_0x18cd2f-0x0;var _0x13a9f4=_0x8737[_0x18cd2f];return _0x13a9f4;};'use strict';var util=require(_0x7873('0x0'));var path=require(_0x7873('0x1'));var _=require(_0x7873('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x7873('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x7873('0x4'));var db=require(_0x7873('0x5'))['db'];var dbH=require(_0x7873('0x5'))['dbH'];var logger=require('../../config/logger')(_0x7873('0x6'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x7873('0x7')][0x3];var PATH=process[_0x7873('0x7')][0x4];function analyticExtractedReport(_0xf6b7a0,_0x3f301c){var _0x3a6241={'status':_0xf6b7a0};var _0x250611={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3f301c){_0x3a6241[_0x7873('0x8')]=_0x3f301c;}return db[_0x7873('0x9')]['update'](_0x3a6241,_0x250611);}function main(){var _0x13b2ac=0x1388;var _0x52abad;logger[_0x7873('0xa')](util[_0x7873('0xb')](_0x7873('0xc'),EXTRACTED_REPORT_ID,_0x7873('0xd')));return db[_0x7873('0xe')][_0x7873('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7873('0x10'),_0x7873('0x11')]})[_0x7873('0x12')](function(_0xb16fc1){if(_0xb16fc1){_0x52abad=_0xb16fc1;_0x13b2ac=_0x52abad['splitSizeCsv']||0x1388;}})[_0x7873('0x12')](function(){return dbH['sequelize'][_0x7873('0x13')](util[_0x7873('0xb')](_0x7873('0x14'),QUERY),{'type':dbH[_0x7873('0x15')][_0x7873('0x16')]['SELECT']});})[_0x7873('0x12')](function(_0x43a2ae){if(!_0x43a2ae[0x0][_0x7873('0x17')]){return analyticExtractedReport(_0x7873('0x18'));}var _0x56d9d5=[];var _0x2e727a=0x0;var _0x2b87c1=!![];if(_0x43a2ae&&_0x43a2ae[_0x7873('0x19')]){var _0x5925a4=_0x43a2ae[0x0][_0x7873('0x17')]%(_0x2e727a+_0x13b2ac);if(_0x52abad[_0x7873('0x10')]){for(;_0x2b87c1;_0x2e727a+=_0x13b2ac,_0x5925a4=_0x43a2ae[0x0][_0x7873('0x17')]%(_0x2e727a+_0x13b2ac)){if(_0x5925a4==0x0||_0x5925a4==_0x43a2ae[0x0][_0x7873('0x17')]){_0x2b87c1=![];}_0x56d9d5[_0x7873('0x1a')](dbH[_0x7873('0x15')][_0x7873('0x13')](util[_0x7873('0xb')](_0x7873('0x1b'),QUERY,_0x13b2ac,_0x2e727a),{'type':dbH[_0x7873('0x15')]['QueryTypes'][_0x7873('0x1c')]}));}}else{_0x56d9d5['push'](dbH['sequelize'][_0x7873('0x13')](QUERY,{'type':dbH[_0x7873('0x15')]['QueryTypes'][_0x7873('0x1c')]}));}}var _0x532313=path[_0x7873('0x1d')](PATH);var _0x494bf0=path[_0x7873('0x1e')](PATH,_0x7873('0x1f'));var _0x313e94=_0x52abad['split']&&_0x56d9d5['length']>0x1;var _0x1c434d=[];if(!fs['existsSync'](path[_0x7873('0x20')](_0x532313,_0x494bf0))&&_0x313e94){fs[_0x7873('0x21')](path['join'](_0x532313,_0x494bf0));}return BPromise['each'](_0x56d9d5,function(_0x3c9b9d){_0x1c434d[_0x7873('0x1a')](_0x3c9b9d);})[_0x7873('0x12')](function(){for(var _0x300ccf=0x0;_0x300ccf<_0x1c434d[_0x7873('0x19')];_0x300ccf+=0x1){var _0x3c2436;var _0x5555bc=_0x1c434d[_0x300ccf];if(_0x313e94){_0x3c2436=path['join'](_0x532313,_0x494bf0,util[_0x7873('0xb')](_0x7873('0x22'),_0x494bf0,_0x300ccf,_0x7873('0x23')));}else{_0x3c2436=path[_0x7873('0x20')](_0x532313,util[_0x7873('0xb')](_0x7873('0x24'),_0x494bf0,'csv'));}fs[_0x7873('0x25')](_0x3c2436,csv(_0x5555bc));}})[_0x7873('0x12')](function(){if(_0x313e94){zipdir(path['join'](_0x532313,_0x494bf0),{'saveTo':path[_0x7873('0x20')](_0x532313,util[_0x7873('0xb')](_0x7873('0x24'),_0x494bf0,_0x7873('0x26')))},function(_0x363a0e,_0x2abd7d){});rimraf(path[_0x7873('0x20')](_0x532313,_0x494bf0),function(){});}})[_0x7873('0x12')](function(){logger[_0x7873('0xa')](util[_0x7873('0xb')](_0x7873('0x27'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x313e94?util[_0x7873('0xb')]('%s.%s',_0x494bf0,_0x313e94?_0x7873('0x26'):_0x7873('0x23')):null);});})[_0x7873('0x28')](function(_0x1d2417){logger[_0x7873('0xa')](util['format'](_0x7873('0x29'),EXTRACTED_REPORT_ID,'CSV'),util[_0x7873('0x2a')](_0x1d2417,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x7873('0x2b'));});}main();
\ No newline at end of file
+var _0x6461=['format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','Empty','num','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','push','dirname','basename','.csv','length','existsSync','join','each','%s%d.%s','%s.%s','csv','writeFileSync','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','to-csv','bluebird','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info'];(function(_0x466e57,_0x21b819){var _0x34df42=function(_0x3e9758){while(--_0x3e9758){_0x466e57['push'](_0x466e57['shift']());}};_0x34df42(++_0x21b819);}(_0x6461,0x77));var _0x1646=function(_0x11ddb3,_0x392821){_0x11ddb3=_0x11ddb3-0x0;var _0x312710=_0x6461[_0x11ddb3];return _0x312710;};'use strict';var util=require(_0x1646('0x0'));var path=require(_0x1646('0x1'));var _=require('lodash');var csv=require(_0x1646('0x2'));var fs=require('fs');var BPromise=require(_0x1646('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x1646('0x4'));var db=require(_0x1646('0x5'))['db'];var dbH=require(_0x1646('0x5'))['dbH'];var logger=require(_0x1646('0x6'))(_0x1646('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x1646('0x8')][0x2]);var QUERY=process[_0x1646('0x8')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x379f7d,_0x329ef4){var _0x3d239b={'status':_0x379f7d};var _0x40f093={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x329ef4){_0x3d239b[_0x1646('0x9')]=_0x329ef4;}return db[_0x1646('0xa')][_0x1646('0xb')](_0x3d239b,_0x40f093);}function main(){var _0x383751=0x1388;var _0x505db6;logger[_0x1646('0xc')](util[_0x1646('0xd')](_0x1646('0xe'),EXTRACTED_REPORT_ID,_0x1646('0xf')));return db['Setting'][_0x1646('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1646('0x11'),_0x1646('0x12')]})[_0x1646('0x13')](function(_0x269b3c){if(_0x269b3c){_0x505db6=_0x269b3c;_0x383751=_0x505db6['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0x1646('0x14')][_0x1646('0x15')](util['format'](_0x1646('0x16'),QUERY),{'type':dbH[_0x1646('0x14')][_0x1646('0x17')]['SELECT']});})['then'](function(_0x27782a){if(!_0x27782a[0x0]['num']){return analyticExtractedReport(_0x1646('0x18'));}var _0x16a659=[];var _0xf698ec=0x0;var _0x12ab01=!![];if(_0x27782a&&_0x27782a['length']){var _0x458ffb=_0x27782a[0x0][_0x1646('0x19')]%(_0xf698ec+_0x383751);if(_0x505db6['split']){for(;_0x12ab01;_0xf698ec+=_0x383751,_0x458ffb=_0x27782a[0x0][_0x1646('0x19')]%(_0xf698ec+_0x383751)){if(_0x458ffb==0x0||_0x458ffb==_0x27782a[0x0][_0x1646('0x19')]){_0x12ab01=![];}_0x16a659['push'](dbH['sequelize'][_0x1646('0x15')](util['format'](_0x1646('0x1a'),QUERY,_0x383751,_0xf698ec),{'type':dbH['sequelize']['QueryTypes'][_0x1646('0x1b')]}));}}else{_0x16a659[_0x1646('0x1c')](dbH['sequelize'][_0x1646('0x15')](QUERY,{'type':dbH[_0x1646('0x14')][_0x1646('0x17')][_0x1646('0x1b')]}));}}var _0x431de6=path[_0x1646('0x1d')](PATH);var _0x4f3611=path[_0x1646('0x1e')](PATH,_0x1646('0x1f'));var _0x4aee64=_0x505db6[_0x1646('0x11')]&&_0x16a659[_0x1646('0x20')]>0x1;var _0x912387=[];if(!fs[_0x1646('0x21')](path['join'](_0x431de6,_0x4f3611))&&_0x4aee64){fs['mkdirSync'](path[_0x1646('0x22')](_0x431de6,_0x4f3611));}return BPromise[_0x1646('0x23')](_0x16a659,function(_0x918ee1){_0x912387[_0x1646('0x1c')](_0x918ee1);})[_0x1646('0x13')](function(){for(var _0x3f854e=0x0;_0x3f854e<_0x912387[_0x1646('0x20')];_0x3f854e+=0x1){var _0x45fad3;var _0x35ce4a=_0x912387[_0x3f854e];if(_0x4aee64){_0x45fad3=path['join'](_0x431de6,_0x4f3611,util[_0x1646('0xd')](_0x1646('0x24'),_0x4f3611,_0x3f854e,'csv'));}else{_0x45fad3=path[_0x1646('0x22')](_0x431de6,util['format'](_0x1646('0x25'),_0x4f3611,_0x1646('0x26')));}fs[_0x1646('0x27')](_0x45fad3,csv(_0x35ce4a));}})[_0x1646('0x13')](function(){if(_0x4aee64){zipdir(path[_0x1646('0x22')](_0x431de6,_0x4f3611),{'saveTo':path['join'](_0x431de6,util['format']('%s.%s',_0x4f3611,_0x1646('0x28')))},function(_0x30d8c2,_0x3e1001){});rimraf(path[_0x1646('0x22')](_0x431de6,_0x4f3611),function(){});}})['then'](function(){logger['info'](util[_0x1646('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x4aee64?util[_0x1646('0xd')](_0x1646('0x25'),_0x4f3611,_0x4aee64?_0x1646('0x28'):_0x1646('0x26')):null);});})[_0x1646('0x29')](function(_0x4e3fde){logger[_0x1646('0xc')](util[_0x1646('0xd')](_0x1646('0x2a'),EXTRACTED_REPORT_ID,_0x1646('0xf')),util['inspect'](_0x4e3fde,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x1646('0x2b'));});}main();
\ No newline at end of file
index 2c73c4c..1735c27 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7b13=['PDF','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','bluebird','util','path','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','num','dirname','.pdf','Setting','find','splitSizePdf','then','length','split','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','existsSync','join','mkdirSync','each','push','format','name','startDate','endDate','landscape','header','black','body','/fonts/Roboto-Regular.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','%s.%s','pipe','finish','end','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x7b13,0xc0));var _0x37b1=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x7b13[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var fs=require('fs');var BPromise=require(_0x37b1('0x0'));var util=require(_0x37b1('0x1'));var path=require(_0x37b1('0x2'));var moment=require('moment');var PdfPrinter=require(_0x37b1('0x3'));var zipdir=require(_0x37b1('0x4'));var rimraf=require(_0x37b1('0x5'));var db=require(_0x37b1('0x6'))['db'];var dbH=require(_0x37b1('0x6'))[_0x37b1('0x7')];var logger=require(_0x37b1('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x37b1('0x9')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x37b1('0xa');var _extractedReport;function analyticExtractedReport(_0x27cb91,_0x59e389){var _0x4fc828={'status':_0x27cb91};var _0x2d3a12={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x59e389){_0x4fc828[_0x37b1('0xb')]=_0x59e389;}return db[_0x37b1('0xc')]['update'](_0x4fc828,_0x2d3a12);}function getHeader(_0x10b344){var _0x3e9b73=[];for(var _0x2b4017 in _0x10b344){if(_0x10b344[_0x37b1('0xd')](_0x2b4017)){_0x3e9b73['push']({'text':_0x2b4017,'style':'tableHeader'});}}return _0x3e9b73;}function extractReport(_0xfdbfaf){var _0x56483f=0x1388;var _0x5e1b0e;if(!_0xfdbfaf[0x0][_0x37b1('0xe')]){return analyticExtractedReport('Empty');}var _0x413c37=[];var _0x45d467=0x0;var _0x5cebb2=!![];var _0x6aef6e=path[_0x37b1('0xf')](PATH);var _0x45b917=path['basename'](PATH,_0x37b1('0x10'));var _0x2a292d=![];var _0x3c06fb=[];return db[_0x37b1('0x11')][_0x37b1('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x37b1('0x13')]})[_0x37b1('0x14')](function(_0x39716f){if(_0x39716f){_0x5e1b0e=_0x39716f;_0x56483f=_0x5e1b0e[_0x37b1('0x13')]||0x3e8;}})[_0x37b1('0x14')](function(){if(_0xfdbfaf&&_0xfdbfaf[_0x37b1('0x15')]){var _0x9ba1b7=_0xfdbfaf[0x0]['num']%(_0x45d467+_0x56483f);if(_0x5e1b0e[_0x37b1('0x16')]){for(;_0x5cebb2;_0x45d467+=_0x56483f,_0x9ba1b7=_0xfdbfaf[0x0][_0x37b1('0xe')]%(_0x45d467+_0x56483f)){if(_0x9ba1b7==0x0||_0x9ba1b7==_0xfdbfaf[0x0][_0x37b1('0xe')]){_0x5cebb2=![];}_0x413c37['push'](dbH[_0x37b1('0x17')][_0x37b1('0x18')](util['format'](_0x37b1('0x19'),QUERY,_0x56483f,_0x45d467),{'type':dbH[_0x37b1('0x17')]['QueryTypes'][_0x37b1('0x1a')]}));}}else{_0x413c37['push'](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x37b1('0x17')][_0x37b1('0x1b')][_0x37b1('0x1a')]}));}}_0x2a292d=_0x5e1b0e[_0x37b1('0x16')]&&_0x413c37['length']>0x1;if(!fs[_0x37b1('0x1c')](path[_0x37b1('0x1d')](_0x6aef6e,_0x45b917))&&_0x2a292d){fs[_0x37b1('0x1e')](path[_0x37b1('0x1d')](_0x6aef6e,_0x45b917));}return BPromise[_0x37b1('0x1f')](_0x413c37,function(_0x501e8f){_0x3c06fb[_0x37b1('0x20')](_0x501e8f);});})[_0x37b1('0x14')](function(){return BPromise[_0x37b1('0x1f')](_0x413c37,function(_0x22db8e,_0x1ae017){var _0x1b3c16;var _0x31146b=util[_0x37b1('0x21')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0x37b1('0x22')],moment(_extractedReport[_0x37b1('0x23')])['format'](FORMAT),moment(_extractedReport[_0x37b1('0x24')])['format'](FORMAT));var _0x4717fa={'pageSize':'A4','pageOrientation':_0x37b1('0x25'),'content':[{'text':_0x31146b,'style':_0x37b1('0x26')}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x37b1('0x27')}}};var _0xf77eb7={'headerRows':0x1,'body':[]};_0xf77eb7[_0x37b1('0x28')][_0x37b1('0x20')](getHeader(_0x22db8e[0x0]));var _0x3cb683;for(var _0x4c24fb=0x0;_0x4c24fb<_0x22db8e['length'];_0x4c24fb+=0x1){_0x3cb683=[];for(var _0x16338c in _0x22db8e[_0x4c24fb]){if(_0x22db8e[_0x4c24fb][_0x37b1('0xd')](_0x16338c)){_0x3cb683['push'](_0x22db8e[_0x4c24fb][_0x16338c]?_['toString'](_0x22db8e[_0x4c24fb][_0x16338c]):'');}}_0xf77eb7['body'][_0x37b1('0x20')](_0x3cb683);}_0x4717fa['content'][_0x37b1('0x20')]({'table':_0xf77eb7});return new BPromise(function(_0x79665d,_0xbb4afd){var _0x497571=new PdfPrinter({'Roboto':{'normal':__dirname+_0x37b1('0x29'),'bold':__dirname+'/fonts/Roboto-Medium.ttf','italics':__dirname+'/fonts/Roboto-Italic.ttf','bolditalics':__dirname+_0x37b1('0x2a')}});var _0x46ddfe=_0x497571[_0x37b1('0x2b')](_0x4717fa);if(_0x2a292d){_0x1b3c16=path['join'](_0x6aef6e,_0x45b917,util[_0x37b1('0x21')](_0x37b1('0x2c'),_0x45b917,_0x1ae017,_0x37b1('0x2d')));}else{_0x1b3c16=path[_0x37b1('0x1d')](_0x6aef6e,util[_0x37b1('0x21')](_0x37b1('0x2e'),_0x45b917,_0x37b1('0x2d')));}var _0x328a86=_0x46ddfe[_0x37b1('0x2f')](fs['createWriteStream'](_0x1b3c16));_0x328a86['on'](_0x37b1('0x30'),function(){_0x79665d();});_0x328a86['on']('error',function(_0x3ad13f){console['log']('err',_0x3ad13f);_0xbb4afd(_0x3ad13f);});_0x46ddfe[_0x37b1('0x31')]();});});})[_0x37b1('0x14')](function(){if(_0x2a292d){return new BPromise(function(_0x3fc013,_0x404f98){zipdir(path[_0x37b1('0x1d')](_0x6aef6e,_0x45b917),{'saveTo':path['join'](_0x6aef6e,util['format'](_0x37b1('0x2e'),_0x45b917,_0x37b1('0x32')))},function(_0x4767fd){if(_0x4767fd){_0x404f98(_0x4767fd);}else{_0x3fc013();}});});}})[_0x37b1('0x14')](function(){if(_0x2a292d){rimraf(path[_0x37b1('0x1d')](_0x6aef6e,_0x45b917),function(){});}})[_0x37b1('0x14')](function(){logger[_0x37b1('0x33')](util[_0x37b1('0x21')](_0x37b1('0x34'),EXTRACTED_REPORT_ID,_0x37b1('0x35')));return analyticExtractedReport(_0x37b1('0x36'),_0x2a292d?util[_0x37b1('0x21')](_0x37b1('0x2e'),_0x45b917,_0x2a292d?_0x37b1('0x32'):_0x37b1('0x2d')):null);});}function main(){logger['info'](util[_0x37b1('0x21')](_0x37b1('0x37'),EXTRACTED_REPORT_ID,_0x37b1('0x38')));return db[_0x37b1('0xc')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x37b1('0x14')](function(_0x23c875){_extractedReport=_0x23c875;return dbH['sequelize'][_0x37b1('0x18')](util[_0x37b1('0x21')](_0x37b1('0x39'),QUERY),{'type':dbH['sequelize'][_0x37b1('0x1b')][_0x37b1('0x1a')]});})[_0x37b1('0x14')](extractReport)[_0x37b1('0x3a')](function(_0x3e3ebd){logger[_0x37b1('0x33')](util[_0x37b1('0x21')](_0x37b1('0x3b'),EXTRACTED_REPORT_ID,'PDF'),util[_0x37b1('0x3c')](_0x3e3ebd,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x37b1('0x3d'));});}main();
\ No newline at end of file
+var _0x7704=['Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','lodash','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','tableHeader','num','Empty','.pdf','split','splitSizePdf','then','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','query','sequelize','existsSync','mkdirSync','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','landscape','body','hasOwnProperty','toString','content','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','join','pdf','%s.%s','createWriteStream','finish','error','log','end','info','CSV'];(function(_0x155773,_0x41ea1d){var _0x1bfc22=function(_0x58eff2){while(--_0x58eff2){_0x155773['push'](_0x155773['shift']());}};_0x1bfc22(++_0x41ea1d);}(_0x7704,0x138));var _0x4770=function(_0x37172a,_0x242596){_0x37172a=_0x37172a-0x0;var _0x353350=_0x7704[_0x37172a];return _0x353350;};'use strict';var _=require(_0x4770('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0x4770('0x1'));var path=require(_0x4770('0x2'));var moment=require(_0x4770('0x3'));var PdfPrinter=require(_0x4770('0x4'));var zipdir=require(_0x4770('0x5'));var rimraf=require(_0x4770('0x6'));var db=require(_0x4770('0x7'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x4770('0x8'))(_0x4770('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x4770('0xa')][0x2]);var QUERY=process[_0x4770('0xa')][0x3];var PATH=process[_0x4770('0xa')][0x4];var NAME=process[_0x4770('0xa')][0x5];var FORMAT=_0x4770('0xb');var _extractedReport;function analyticExtractedReport(_0x33438a,_0x524d8e){var _0x294da0={'status':_0x33438a};var _0x529905={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x524d8e){_0x294da0[_0x4770('0xc')]=_0x524d8e;}return db[_0x4770('0xd')]['update'](_0x294da0,_0x529905);}function getHeader(_0x10bfd6){var _0x4b6a49=[];for(var _0x55fb60 in _0x10bfd6){if(_0x10bfd6['hasOwnProperty'](_0x55fb60)){_0x4b6a49['push']({'text':_0x55fb60,'style':_0x4770('0xe')});}}return _0x4b6a49;}function extractReport(_0x32fbdf){var _0x547e11=0x1388;var _0x332fc2;if(!_0x32fbdf[0x0][_0x4770('0xf')]){return analyticExtractedReport(_0x4770('0x10'));}var _0xa38583=[];var _0x20ef32=0x0;var _0x54e276=!![];var _0x52b747=path['dirname'](PATH);var _0x1096dc=path['basename'](PATH,_0x4770('0x11'));var _0x442ae9=![];var _0x3961e1=[];return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4770('0x12'),_0x4770('0x13')]})[_0x4770('0x14')](function(_0x45cbb2){if(_0x45cbb2){_0x332fc2=_0x45cbb2;_0x547e11=_0x332fc2[_0x4770('0x13')]||0x3e8;}})[_0x4770('0x14')](function(){if(_0x32fbdf&&_0x32fbdf[_0x4770('0x15')]){var _0x4792c5=_0x32fbdf[0x0][_0x4770('0xf')]%(_0x20ef32+_0x547e11);if(_0x332fc2['split']){for(;_0x54e276;_0x20ef32+=_0x547e11,_0x4792c5=_0x32fbdf[0x0][_0x4770('0xf')]%(_0x20ef32+_0x547e11)){if(_0x4792c5==0x0||_0x4792c5==_0x32fbdf[0x0][_0x4770('0xf')]){_0x54e276=![];}_0xa38583[_0x4770('0x16')](dbH['sequelize']['query'](util['format'](_0x4770('0x17'),QUERY,_0x547e11,_0x20ef32),{'type':dbH['sequelize'][_0x4770('0x18')][_0x4770('0x19')]}));}}else{_0xa38583[_0x4770('0x16')](dbH['sequelize'][_0x4770('0x1a')](QUERY,{'type':dbH[_0x4770('0x1b')]['QueryTypes']['SELECT']}));}}_0x442ae9=_0x332fc2[_0x4770('0x12')]&&_0xa38583[_0x4770('0x15')]>0x1;if(!fs[_0x4770('0x1c')](path['join'](_0x52b747,_0x1096dc))&&_0x442ae9){fs[_0x4770('0x1d')](path['join'](_0x52b747,_0x1096dc));}return BPromise['each'](_0xa38583,function(_0x38ccd1){_0x3961e1['push'](_0x38ccd1);});})[_0x4770('0x14')](function(){return BPromise['each'](_0xa38583,function(_0x25ae73,_0x2c060e){var _0x49f787;var _0x3e8a93=util[_0x4770('0x1e')](_0x4770('0x1f'),NAME,_extractedReport[_0x4770('0x20')],moment(_extractedReport[_0x4770('0x21')])[_0x4770('0x1e')](FORMAT),moment(_extractedReport['endDate'])[_0x4770('0x1e')](FORMAT));var _0x5d0bae={'pageSize':'A4','pageOrientation':_0x4770('0x22'),'content':[{'text':_0x3e8a93,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'}}};var _0x20ef86={'headerRows':0x1,'body':[]};_0x20ef86[_0x4770('0x23')][_0x4770('0x16')](getHeader(_0x25ae73[0x0]));var _0x155c3f;for(var _0x4afe3a=0x0;_0x4afe3a<_0x25ae73['length'];_0x4afe3a+=0x1){_0x155c3f=[];for(var _0x2d6223 in _0x25ae73[_0x4afe3a]){if(_0x25ae73[_0x4afe3a][_0x4770('0x24')](_0x2d6223)){_0x155c3f[_0x4770('0x16')](_0x25ae73[_0x4afe3a][_0x2d6223]?_[_0x4770('0x25')](_0x25ae73[_0x4afe3a][_0x2d6223]):'');}}_0x20ef86[_0x4770('0x23')][_0x4770('0x16')](_0x155c3f);}_0x5d0bae[_0x4770('0x26')][_0x4770('0x16')]({'table':_0x20ef86});return new BPromise(function(_0x3eb149,_0x33ea1f){var _0x339239=new PdfPrinter({'Roboto':{'normal':__dirname+_0x4770('0x27'),'bold':__dirname+_0x4770('0x28'),'italics':__dirname+_0x4770('0x29'),'bolditalics':__dirname+_0x4770('0x2a')}});var _0x53d8d2=_0x339239[_0x4770('0x2b')](_0x5d0bae);if(_0x442ae9){_0x49f787=path[_0x4770('0x2c')](_0x52b747,_0x1096dc,util[_0x4770('0x1e')]('%s%d.%s',_0x1096dc,_0x2c060e,_0x4770('0x2d')));}else{_0x49f787=path['join'](_0x52b747,util['format'](_0x4770('0x2e'),_0x1096dc,_0x4770('0x2d')));}var _0x194113=_0x53d8d2['pipe'](fs[_0x4770('0x2f')](_0x49f787));_0x194113['on'](_0x4770('0x30'),function(){_0x3eb149();});_0x194113['on'](_0x4770('0x31'),function(_0x146c63){console[_0x4770('0x32')]('err',_0x146c63);_0x33ea1f(_0x146c63);});_0x53d8d2[_0x4770('0x33')]();});});})[_0x4770('0x14')](function(){if(_0x442ae9){return new BPromise(function(_0x1fd1a7,_0x4ec4a5){zipdir(path[_0x4770('0x2c')](_0x52b747,_0x1096dc),{'saveTo':path[_0x4770('0x2c')](_0x52b747,util['format'](_0x4770('0x2e'),_0x1096dc,'zip'))},function(_0x4e69b1){if(_0x4e69b1){_0x4ec4a5(_0x4e69b1);}else{_0x1fd1a7();}});});}})[_0x4770('0x14')](function(){if(_0x442ae9){rimraf(path[_0x4770('0x2c')](_0x52b747,_0x1096dc),function(){});}})[_0x4770('0x14')](function(){logger[_0x4770('0x34')](util[_0x4770('0x1e')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x4770('0x35')));return analyticExtractedReport(_0x4770('0x36'),_0x442ae9?util[_0x4770('0x1e')](_0x4770('0x2e'),_0x1096dc,_0x442ae9?'zip':_0x4770('0x2d')):null);});}function main(){logger[_0x4770('0x34')](util[_0x4770('0x1e')](_0x4770('0x37'),EXTRACTED_REPORT_ID,_0x4770('0x38')));return db[_0x4770('0xd')][_0x4770('0x39')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x4770('0x14')](function(_0x248f46){_extractedReport=_0x248f46;return dbH[_0x4770('0x1b')][_0x4770('0x1a')](util['format'](_0x4770('0x3a'),QUERY),{'type':dbH[_0x4770('0x1b')]['QueryTypes'][_0x4770('0x19')]});})[_0x4770('0x14')](extractReport)[_0x4770('0x3b')](function(_0x1f3829){logger[_0x4770('0x34')](util[_0x4770('0x1e')](_0x4770('0x3c'),EXTRACTED_REPORT_ID,'PDF'),util['inspect'](_0x1f3829,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main();
\ No newline at end of file
index 8fbd961..39de88f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9652=['%s%d.%s','xlsx','%s.%s','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','util','lodash','bluebird','zip-dir','dbH','../../config/logger','argv','savename','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.xlsx','length','existsSync','join','mkdirSync','each'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x9652,0x198));var _0x2965=function(_0x48783c,_0x1f986b){_0x48783c=_0x48783c-0x0;var _0x2ce586=_0x9652[_0x48783c];return _0x2ce586;};'use strict';var util=require(_0x2965('0x0'));var path=require('path');var _=require(_0x2965('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x2965('0x2'));var zipdir=require(_0x2965('0x3'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x2965('0x4')];var logger=require(_0x2965('0x5'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x2965('0x6')][0x3];var PATH=process[_0x2965('0x6')][0x4];function analyticExtractedReport(_0x5374cf,_0xba36ae){var _0x2f788c={'status':_0x5374cf};var _0x6eec43={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xba36ae){_0x2f788c[_0x2965('0x7')]=_0xba36ae;}return db['AnalyticExtractedReport']['update'](_0x2f788c,_0x6eec43);}function main(){var _0xc964ec=0x1388;var _0x13d5f1;logger[_0x2965('0x8')](util[_0x2965('0x9')](_0x2965('0xa'),EXTRACTED_REPORT_ID,_0x2965('0xb')));return db[_0x2965('0xc')][_0x2965('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2965('0xe'),_0x2965('0xf')]})[_0x2965('0x10')](function(_0x36ea5b){if(_0x36ea5b){_0x13d5f1=_0x36ea5b;_0xc964ec=_0x13d5f1[_0x2965('0xf')]||0x1388;}})[_0x2965('0x10')](function(){return dbH['sequelize']['query'](util[_0x2965('0x9')](_0x2965('0x11'),QUERY),{'type':dbH[_0x2965('0x12')][_0x2965('0x13')][_0x2965('0x14')]});})[_0x2965('0x10')](function(_0x3fea95){if(!_0x3fea95[0x0][_0x2965('0x15')]){return analyticExtractedReport('Empty');}var _0x163eaf=[];var _0x5b213c=0x0;var _0x8e0d10=!![];if(_0x13d5f1[_0x2965('0xe')]){if(_0x3fea95&&_0x3fea95['length']){var _0x3f1a56=_0x3fea95[0x0]['num']%(_0x5b213c+_0xc964ec);for(;_0x8e0d10;_0x5b213c+=_0xc964ec,_0x3f1a56=_0x3fea95[0x0][_0x2965('0x15')]%(_0x5b213c+_0xc964ec)){if(_0x3f1a56==0x0||_0x3f1a56==_0x3fea95[0x0][_0x2965('0x15')]){_0x8e0d10=![];}_0x163eaf['push'](dbH[_0x2965('0x12')]['query'](util[_0x2965('0x9')](_0x2965('0x16'),QUERY,_0xc964ec,_0x5b213c),{'type':dbH[_0x2965('0x12')][_0x2965('0x13')]['SELECT']}));}}}else{_0x163eaf[_0x2965('0x17')](dbH[_0x2965('0x12')]['query'](QUERY,{'type':dbH[_0x2965('0x12')]['QueryTypes'][_0x2965('0x14')]}));}var _0x3aad06=path[_0x2965('0x18')](PATH);var _0x3237e1=path[_0x2965('0x19')](PATH,_0x2965('0x1a'));var _0x43e58b=_0x13d5f1[_0x2965('0xe')]&&_0x163eaf[_0x2965('0x1b')]>0x1;var _0x22bf91=[];if(!fs[_0x2965('0x1c')](path[_0x2965('0x1d')](_0x3aad06,_0x3237e1))&&_0x43e58b){fs[_0x2965('0x1e')](path[_0x2965('0x1d')](_0x3aad06,_0x3237e1));}return BPromise[_0x2965('0x1f')](_0x163eaf,function(_0x1f83d1){_0x22bf91[_0x2965('0x17')](_0x1f83d1);})['then'](function(){for(var _0x9735ba=0x0;_0x9735ba<_0x22bf91[_0x2965('0x1b')];_0x9735ba+=0x1){var _0x223ccc;var _0xe2f5fe=_0x22bf91[_0x9735ba];if(_0x43e58b){_0x223ccc=path['join'](_0x3aad06,_0x3237e1,util[_0x2965('0x9')](_0x2965('0x20'),_0x3237e1,_0x9735ba,_0x2965('0x21')));}else{_0x223ccc=path[_0x2965('0x1d')](_0x3aad06,util['format'](_0x2965('0x22'),_0x3237e1,_0x2965('0x21')));}fs['writeFileSync'](_0x223ccc,json2xls(_0xe2f5fe),'binary');}})[_0x2965('0x10')](function(){if(_0x43e58b){zipdir(path[_0x2965('0x1d')](_0x3aad06,_0x3237e1),{'saveTo':path[_0x2965('0x1d')](_0x3aad06,util[_0x2965('0x9')](_0x2965('0x22'),_0x3237e1,'zip'))},function(_0x164a65,_0x49d8cb){});rimraf(path[_0x2965('0x1d')](_0x3aad06,_0x3237e1),function(){});}})[_0x2965('0x10')](function(){logger[_0x2965('0x8')](util[_0x2965('0x9')](_0x2965('0x23'),EXTRACTED_REPORT_ID,_0x2965('0xb')));return analyticExtractedReport(_0x2965('0x24'),_0x43e58b?util[_0x2965('0x9')](_0x2965('0x22'),_0x3237e1,_0x43e58b?_0x2965('0x25'):_0x2965('0x21')):null);});})[_0x2965('0x26')](function(_0x16853b){logger[_0x2965('0x8')](util[_0x2965('0x9')](_0x2965('0x27'),EXTRACTED_REPORT_ID,_0x2965('0xb')),util['inspect'](_0x16853b,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main();
\ No newline at end of file
+var _0xe5ab=['sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','split','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','existsSync','join','mkdirSync','%s%d.%s','%s.%s','xlsx','binary','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','json2xls','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','XLSX','Setting','then','splitSizeXlsx'];(function(_0x188360,_0x3d93f8){var _0x1fbe6d=function(_0x3d9d32){while(--_0x3d9d32){_0x188360['push'](_0x188360['shift']());}};_0x1fbe6d(++_0x3d93f8);}(_0xe5ab,0xff));var _0xbe5a=function(_0x5eeb45,_0x2c5765){_0x5eeb45=_0x5eeb45-0x0;var _0x3275f6=_0xe5ab[_0x5eeb45];return _0x3275f6;};'use strict';var util=require(_0xbe5a('0x0'));var path=require(_0xbe5a('0x1'));var _=require(_0xbe5a('0x2'));var fs=require('fs');var json2xls=require(_0xbe5a('0x3'));var BPromise=require(_0xbe5a('0x4'));var zipdir=require(_0xbe5a('0x5'));var rimraf=require(_0xbe5a('0x6'));var db=require(_0xbe5a('0x7'))['db'];var dbH=require(_0xbe5a('0x7'))[_0xbe5a('0x8')];var logger=require(_0xbe5a('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbe5a('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xbe5a('0xa')][0x4];function analyticExtractedReport(_0x5e5fa6,_0x3d081b){var _0x50d5f1={'status':_0x5e5fa6};var _0x3a3797={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3d081b){_0x50d5f1[_0xbe5a('0xb')]=_0x3d081b;}return db[_0xbe5a('0xc')][_0xbe5a('0xd')](_0x50d5f1,_0x3a3797);}function main(){var _0x1e09f2=0x1388;var _0xe0675f;logger[_0xbe5a('0xe')](util[_0xbe5a('0xf')](_0xbe5a('0x10'),EXTRACTED_REPORT_ID,_0xbe5a('0x11')));return db[_0xbe5a('0x12')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})[_0xbe5a('0x13')](function(_0x332675){if(_0x332675){_0xe0675f=_0x332675;_0x1e09f2=_0xe0675f[_0xbe5a('0x14')]||0x1388;}})[_0xbe5a('0x13')](function(){return dbH[_0xbe5a('0x15')][_0xbe5a('0x16')](util[_0xbe5a('0xf')](_0xbe5a('0x17'),QUERY),{'type':dbH[_0xbe5a('0x15')][_0xbe5a('0x18')][_0xbe5a('0x19')]});})[_0xbe5a('0x13')](function(_0x31ad6a){if(!_0x31ad6a[0x0][_0xbe5a('0x1a')]){return analyticExtractedReport(_0xbe5a('0x1b'));}var _0x227cc9=[];var _0x2cdc56=0x0;var _0x2833b8=!![];if(_0xe0675f[_0xbe5a('0x1c')]){if(_0x31ad6a&&_0x31ad6a[_0xbe5a('0x1d')]){var _0x534a5f=_0x31ad6a[0x0][_0xbe5a('0x1a')]%(_0x2cdc56+_0x1e09f2);for(;_0x2833b8;_0x2cdc56+=_0x1e09f2,_0x534a5f=_0x31ad6a[0x0]['num']%(_0x2cdc56+_0x1e09f2)){if(_0x534a5f==0x0||_0x534a5f==_0x31ad6a[0x0]['num']){_0x2833b8=![];}_0x227cc9[_0xbe5a('0x1e')](dbH['sequelize'][_0xbe5a('0x16')](util['format'](_0xbe5a('0x1f'),QUERY,_0x1e09f2,_0x2cdc56),{'type':dbH[_0xbe5a('0x15')]['QueryTypes'][_0xbe5a('0x19')]}));}}}else{_0x227cc9['push'](dbH['sequelize']['query'](QUERY,{'type':dbH[_0xbe5a('0x15')][_0xbe5a('0x18')][_0xbe5a('0x19')]}));}var _0x94bf56=path[_0xbe5a('0x20')](PATH);var _0x4a4619=path[_0xbe5a('0x21')](PATH,'.xlsx');var _0xd93f1c=_0xe0675f[_0xbe5a('0x1c')]&&_0x227cc9[_0xbe5a('0x1d')]>0x1;var _0x285456=[];if(!fs[_0xbe5a('0x22')](path[_0xbe5a('0x23')](_0x94bf56,_0x4a4619))&&_0xd93f1c){fs[_0xbe5a('0x24')](path[_0xbe5a('0x23')](_0x94bf56,_0x4a4619));}return BPromise['each'](_0x227cc9,function(_0x2f4d80){_0x285456[_0xbe5a('0x1e')](_0x2f4d80);})[_0xbe5a('0x13')](function(){for(var _0x5ee5f9=0x0;_0x5ee5f9<_0x285456['length'];_0x5ee5f9+=0x1){var _0x1381f3;var _0x376b85=_0x285456[_0x5ee5f9];if(_0xd93f1c){_0x1381f3=path[_0xbe5a('0x23')](_0x94bf56,_0x4a4619,util[_0xbe5a('0xf')](_0xbe5a('0x25'),_0x4a4619,_0x5ee5f9,'xlsx'));}else{_0x1381f3=path[_0xbe5a('0x23')](_0x94bf56,util[_0xbe5a('0xf')](_0xbe5a('0x26'),_0x4a4619,_0xbe5a('0x27')));}fs['writeFileSync'](_0x1381f3,json2xls(_0x376b85),_0xbe5a('0x28'));}})[_0xbe5a('0x13')](function(){if(_0xd93f1c){zipdir(path[_0xbe5a('0x23')](_0x94bf56,_0x4a4619),{'saveTo':path[_0xbe5a('0x23')](_0x94bf56,util['format'](_0xbe5a('0x26'),_0x4a4619,'zip'))},function(_0x4197c1,_0x146c5a){});rimraf(path[_0xbe5a('0x23')](_0x94bf56,_0x4a4619),function(){});}})['then'](function(){logger[_0xbe5a('0xe')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport('Completed',_0xd93f1c?util[_0xbe5a('0xf')](_0xbe5a('0x26'),_0x4a4619,_0xd93f1c?_0xbe5a('0x29'):'xlsx'):null);});})[_0xbe5a('0x2a')](function(_0x410784){logger[_0xbe5a('0xe')](util[_0xbe5a('0xf')](_0xbe5a('0x2b'),EXTRACTED_REPORT_ID,_0xbe5a('0x11')),util[_0xbe5a('0x2c')](_0x410784,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbe5a('0x2d'));});}main();
\ No newline at end of file
index cc5754f..5f73a6f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x85b5=['*,*,*,*','IntervalId','filter','tag','push','CDR(tag)=','callerID','CALLERID(all)=','answer','indexOf','app','appType','Answer','VoiceExtensionId','record','recordingFormat','MixMonitor',',ab','length','GotoIfTime','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','rewrite','lodash','util','models','findAll','then','intervals','VoiceExtension','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','groupBy','exten','playback','hasOwnProperty','progress','extensions','type','context','priority','Set','format','CDR(type)=%s','createdAt','interval'];(function(_0x1375c3,_0x297d00){var _0x1f26d6=function(_0x6555){while(--_0x6555){_0x1375c3['push'](_0x1375c3['shift']());}};_0x1f26d6(++_0x297d00);}(_0x85b5,0x120));var _0x585b=function(_0xe30585,_0x25ba1b){_0xe30585=_0xe30585-0x0;var _0x1c3d86=_0x85b5[_0xe30585];return _0x1c3d86;};'use strict';var _=require(_0x585b('0x0'));var util=require(_0x585b('0x1'));function rewrite(_0x5128fb,_0x153d33){var _0x2d8ad6=this;return _0x5128fb[_0x585b('0x2')]['Interval'][_0x585b('0x3')]({'raw':!![]})[_0x585b('0x4')](function(_0x2b5ec2){_0x2d8ad6[_0x585b('0x5')]=_0x2b5ec2;return _0x5128fb[_0x585b('0x2')][_0x585b('0x6')][_0x585b('0x3')]({'where':{'IntervalId':_0x153d33['IntervalId']},'raw':!![]});})['then'](function(_0x29343a){return _0x5128fb[_0x585b('0x2')][_0x585b('0x6')][_0x585b('0x3')]({'where':{'exten':{'$in':_[_0x585b('0x7')](_[_0x585b('0x8')](_0x29343a,'exten'))},'isApp':!![]},'order':[{'raw':_0x585b('0x9')}],'raw':!![]});})[_0x585b('0x4')](function(_0x5f4a9b){var _0xefa1f5=_[_0x585b('0xa')](_0x5f4a9b,_0x585b('0xb'));var _0x7f8b08=['queue',_0x585b('0xc')];var _0x3e89cc=[];var _0x388f4b=[];for(var _0x3dd5ae in _0xefa1f5){if(_0xefa1f5[_0x585b('0xd')](_0x3dd5ae)){_0x2d8ad6['answer']=![];_0x2d8ad6[_0x585b('0xe')]=![];_0x2d8ad6['priority']=0x2;_0x2d8ad6[_0x585b('0xf')]=[];_0x2d8ad6['extensions']['push']({'type':_0xefa1f5[_0x3dd5ae][0x0][_0x585b('0x10')],'context':_0xefa1f5[_0x3dd5ae][0x0][_0x585b('0x11')],'exten':_0xefa1f5[_0x3dd5ae][0x0][_0x585b('0xb')],'priority':_0x2d8ad6[_0x585b('0x12')]++,'app':_0x585b('0x13'),'appdata':util[_0x585b('0x14')](_0x585b('0x15'),_0xefa1f5[_0x3dd5ae][0x0][_0x585b('0x10')]),'VoiceExtensionId':_0xefa1f5[_0x3dd5ae][0x0]['VoiceExtensionId']});for(var _0x1c7599=0x0,_0x54fabb=0x0;_0x1c7599<_0xefa1f5[_0x3dd5ae]['length'];_0x1c7599+=0x1,_0x54fabb=0x0){var _0x391b22=_0xefa1f5[_0x3dd5ae][_0x1c7599];var _0x506413=[];var _0x36f139=[];delete _0x391b22['id'];delete _0x391b22[_0x585b('0x16')];delete _0x391b22['updatedAt'];var _0x3a779b=_0x391b22[_0x585b('0x17')]!==_0x585b('0x18')?[_0x391b22[_0x585b('0x17')]]:_0x391b22[_0x585b('0x19')]?_['map'](_[_0x585b('0x1a')](_0x2d8ad6[_0x585b('0x5')],{'IntervalId':_0x391b22[_0x585b('0x19')]}),'interval'):[];if(_0x391b22[_0x585b('0xd')](_0x585b('0x1b'))){if(_0x391b22[_0x585b('0x1b')]&&_0x391b22[_0x585b('0x1b')]!=='--'){_0x506413[_0x585b('0x1c')]({'type':_0x391b22[_0x585b('0x10')],'app':_0x585b('0x13'),'appdata':_0x585b('0x1d')+_0x391b22[_0x585b('0x1b')],'context':_0x391b22[_0x585b('0x11')],'exten':_0x391b22['exten'],'priority':_0x3a779b['length']+_0x2d8ad6[_0x585b('0x12')]+_0x54fabb++,'VoiceExtensionId':_0xefa1f5[_0x3dd5ae][0x0]['VoiceExtensionId']});}}if(_0x391b22[_0x585b('0xd')]('callerID')){if(_0x391b22[_0x585b('0x1e')]){_0x506413[_0x585b('0x1c')]({'type':_0x391b22[_0x585b('0x10')],'app':_0x585b('0x13'),'appdata':_0x585b('0x1f')+_0x391b22[_0x585b('0x1e')],'context':_0x391b22[_0x585b('0x11')],'exten':_0x391b22[_0x585b('0xb')],'priority':_0x3a779b['length']+_0x2d8ad6[_0x585b('0x12')]+_0x54fabb++,'VoiceExtensionId':_0xefa1f5[_0x3dd5ae][0x0]['VoiceExtensionId']});}}if(_0x391b22['hasOwnProperty'](_0x585b('0x20'))){if(_0x7f8b08[_0x585b('0x21')](_0x391b22[_0x585b('0x22')]['toLowerCase']())>=0x0&&_0x391b22[_0x585b('0x23')]!=='custom'){if(!_0x2d8ad6['answer']&&_0x391b22[_0x585b('0x20')]){_0x2d8ad6[_0x585b('0x20')]=!![];_0x506413[_0x585b('0x1c')]({'type':_0x391b22[_0x585b('0x10')],'app':_0x585b('0x24'),'context':_0x391b22[_0x585b('0x11')],'exten':_0x391b22['exten'],'priority':_0x3a779b['length']+_0x2d8ad6[_0x585b('0x12')]+_0x54fabb++,'VoiceExtensionId':_0xefa1f5[_0x3dd5ae][0x0][_0x585b('0x25')]});}if(!_0x2d8ad6['answer']&&!_0x2d8ad6[_0x585b('0xe')]&&!_0x391b22[_0x585b('0x20')]){_0x2d8ad6[_0x585b('0xe')]=!![];_0x506413[_0x585b('0x1c')]({'type':_0x391b22[_0x585b('0x10')],'app':'Progress','context':_0x391b22['context'],'exten':_0x391b22[_0x585b('0xb')],'priority':_0x3a779b['length']+_0x2d8ad6['priority']+_0x54fabb++,'VoiceExtensionId':_0xefa1f5[_0x3dd5ae][0x0]['VoiceExtensionId']});}}}if(_0x391b22[_0x585b('0xd')](_0x585b('0x26'))&&_0x391b22[_0x585b('0xd')](_0x585b('0x27'))){if(_0x391b22['record']){_0x506413[_0x585b('0x1c')]({'type':_0x391b22['type'],'app':_0x585b('0x28'),'appdata':'${UNIQUEID}.'+_0x391b22[_0x585b('0x27')]+_0x585b('0x29'),'context':_0x391b22['context'],'exten':_0x391b22[_0x585b('0xb')],'priority':_0x3a779b[_0x585b('0x2a')]+_0x2d8ad6['priority']+_0x54fabb++,'VoiceExtensionId':_0xefa1f5[_0x3dd5ae][0x0][_0x585b('0x25')]});}}if(_0x391b22['hasOwnProperty'](_0x585b('0x26'))&&_0x391b22[_0x585b('0xd')]('recordingFormat')){if(_0x391b22['record']){_0x36f139[_0x585b('0x1c')]({'type':_0x391b22[_0x585b('0x10')],'app':'StopMixMonitor','appdata':null,'context':_0x391b22[_0x585b('0x11')],'exten':_0x391b22['exten'],'priority':_0x3a779b[_0x585b('0x2a')]+_0x2d8ad6[_0x585b('0x12')]+_0x54fabb++ +0x1,'VoiceExtensionId':_0xefa1f5[_0x3dd5ae][0x0][_0x585b('0x25')]});}}for(var _0x2587df=0x0;_0x2587df<_0x3a779b[_0x585b('0x2a')];_0x2587df+=0x1){var _0x317f2e=_0x2d8ad6[_0x585b('0x12')]+_0x3a779b[_0x585b('0x2a')];var _0x3153bc=_0x2587df===_0x3a779b[_0x585b('0x2a')]-0x1?_0x2d8ad6['priority']+_0x506413[_0x585b('0x2a')]+_0x36f139['length']+0x2:_0x2d8ad6[_0x585b('0x12')]+_0x2587df+0x1;_0x506413['splice'](_0x2587df,0x0,{'type':_0x391b22[_0x585b('0x10')],'app':_0x585b('0x2b'),'appdata':_0x3a779b[_0x2587df]+'?'+_0x391b22['context']+',${EXTEN},'+_0x317f2e+':'+_0x391b22[_0x585b('0x11')]+',${EXTEN},'+_0x3153bc,'exten':_0x391b22[_0x585b('0xb')],'context':_0x391b22[_0x585b('0x11')],'priority':_0x2d8ad6['priority']+_0x2587df,'VoiceExtensionId':_0xefa1f5[_0x3dd5ae][0x0][_0x585b('0x25')]});}_0x391b22[_0x585b('0x12')]=_0x506413[_0x585b('0x2a')]?_[_0x585b('0x2c')](_0x506413)[_0x585b('0x12')]+0x1:_0x2d8ad6[_0x585b('0x12')];_0x2d8ad6[_0x585b('0x12')]=(_0x36f139[_0x585b('0x2a')]?_[_0x585b('0x2c')](_0x36f139)[_0x585b('0x12')]:_0x391b22['priority'])+0x1;_0x2d8ad6[_0x585b('0xf')]=_[_0x585b('0x2d')](_0x2d8ad6['extensions'],_0x506413,[_0x391b22],_0x36f139);}_0x2d8ad6[_0x585b('0xf')][_0x585b('0x1c')]({'type':_0xefa1f5[_0x3dd5ae][0x0][_0x585b('0x10')],'app':_0x585b('0x2e'),'exten':_0xefa1f5[_0x3dd5ae][0x0][_0x585b('0xb')],'context':_0xefa1f5[_0x3dd5ae][0x0][_0x585b('0x11')],'priority':_0x2d8ad6[_0x585b('0x12')],'VoiceExtensionId':_0xefa1f5[_0x3dd5ae][0x0][_0x585b('0x25')]});_0x3e89cc[_0x585b('0x1c')](_0xefa1f5[_0x3dd5ae][0x0][_0x585b('0x25')]);_0x388f4b=_[_0x585b('0x2d')](_0x388f4b,_0x2d8ad6[_0x585b('0xf')]);}}return _0x5128fb[_0x585b('0x2f')](function(_0x242435){return _0x5128fb[_0x585b('0x2')][_0x585b('0x6')][_0x585b('0x30')]({'where':{'VoiceExtensionId':{'$in':_0x3e89cc}},'transaction':_0x242435})['then'](function(_0xfbb708){return _0x5128fb[_0x585b('0x2')][_0x585b('0x6')][_0x585b('0x31')](_[_0x585b('0x32')](_0x388f4b,'priority'),{'transaction':_0x242435});});});})['catch'](function(_0x40ada8){console['error'](_0x40ada8);});}exports[_0x585b('0x33')]=rewrite;
\ No newline at end of file
+var _0x45a8=['bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','findAll','intervals','VoiceExtension','IntervalId','then','uniq','map','exten','groupBy','queue','hasOwnProperty','answer','progress','priority','extensions','type','context','Set','format','CDR(type)=%s','length','createdAt','updatedAt','*,*,*,*','tag','push','CDR(tag)=','VoiceExtensionId','callerID','CALLERID(all)=','indexOf','app','toLowerCase','appType','custom','Answer','Progress','record','MixMonitor','${UNIQUEID}.','recordingFormat','GotoIfTime',',${EXTEN},','last','concat','destroy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x45a8,0x1b5));var _0x845a=function(_0x4875a6,_0x1d9248){_0x4875a6=_0x4875a6-0x0;var _0x2bf790=_0x45a8[_0x4875a6];return _0x2bf790;};'use strict';var _=require(_0x845a('0x0'));var util=require(_0x845a('0x1'));function rewrite(_0x93426c,_0x429674){var _0x1172cf=this;return _0x93426c[_0x845a('0x2')]['Interval'][_0x845a('0x3')]({'raw':!![]})['then'](function(_0x2c6bff){_0x1172cf[_0x845a('0x4')]=_0x2c6bff;return _0x93426c[_0x845a('0x2')][_0x845a('0x5')][_0x845a('0x3')]({'where':{'IntervalId':_0x429674[_0x845a('0x6')]},'raw':!![]});})[_0x845a('0x7')](function(_0x249f2b){return _0x93426c[_0x845a('0x2')][_0x845a('0x5')][_0x845a('0x3')]({'where':{'exten':{'$in':_[_0x845a('0x8')](_[_0x845a('0x9')](_0x249f2b,_0x845a('0xa')))},'isApp':!![]},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x845a('0x7')](function(_0x391b50){var _0x1fefbd=_[_0x845a('0xb')](_0x391b50,_0x845a('0xa'));var _0xb0b552=[_0x845a('0xc'),'playback'];var _0x2edf4f=[];var _0x133bcf=[];for(var _0x87535f in _0x1fefbd){if(_0x1fefbd[_0x845a('0xd')](_0x87535f)){_0x1172cf[_0x845a('0xe')]=![];_0x1172cf[_0x845a('0xf')]=![];_0x1172cf[_0x845a('0x10')]=0x2;_0x1172cf[_0x845a('0x11')]=[];_0x1172cf[_0x845a('0x11')]['push']({'type':_0x1fefbd[_0x87535f][0x0][_0x845a('0x12')],'context':_0x1fefbd[_0x87535f][0x0][_0x845a('0x13')],'exten':_0x1fefbd[_0x87535f][0x0][_0x845a('0xa')],'priority':_0x1172cf[_0x845a('0x10')]++,'app':_0x845a('0x14'),'appdata':util[_0x845a('0x15')](_0x845a('0x16'),_0x1fefbd[_0x87535f][0x0][_0x845a('0x12')]),'VoiceExtensionId':_0x1fefbd[_0x87535f][0x0]['VoiceExtensionId']});for(var _0x4701d9=0x0,_0x1c65f0=0x0;_0x4701d9<_0x1fefbd[_0x87535f][_0x845a('0x17')];_0x4701d9+=0x1,_0x1c65f0=0x0){var _0x42f64a=_0x1fefbd[_0x87535f][_0x4701d9];var _0x110a7a=[];var _0x33ea8e=[];delete _0x42f64a['id'];delete _0x42f64a[_0x845a('0x18')];delete _0x42f64a[_0x845a('0x19')];var _0x33287b=_0x42f64a['interval']!==_0x845a('0x1a')?[_0x42f64a['interval']]:_0x42f64a[_0x845a('0x6')]?_[_0x845a('0x9')](_['filter'](_0x1172cf[_0x845a('0x4')],{'IntervalId':_0x42f64a[_0x845a('0x6')]}),'interval'):[];if(_0x42f64a[_0x845a('0xd')](_0x845a('0x1b'))){if(_0x42f64a[_0x845a('0x1b')]&&_0x42f64a[_0x845a('0x1b')]!=='--'){_0x110a7a[_0x845a('0x1c')]({'type':_0x42f64a['type'],'app':_0x845a('0x14'),'appdata':_0x845a('0x1d')+_0x42f64a[_0x845a('0x1b')],'context':_0x42f64a[_0x845a('0x13')],'exten':_0x42f64a[_0x845a('0xa')],'priority':_0x33287b[_0x845a('0x17')]+_0x1172cf[_0x845a('0x10')]+_0x1c65f0++,'VoiceExtensionId':_0x1fefbd[_0x87535f][0x0][_0x845a('0x1e')]});}}if(_0x42f64a[_0x845a('0xd')]('callerID')){if(_0x42f64a[_0x845a('0x1f')]){_0x110a7a[_0x845a('0x1c')]({'type':_0x42f64a['type'],'app':_0x845a('0x14'),'appdata':_0x845a('0x20')+_0x42f64a[_0x845a('0x1f')],'context':_0x42f64a[_0x845a('0x13')],'exten':_0x42f64a[_0x845a('0xa')],'priority':_0x33287b['length']+_0x1172cf[_0x845a('0x10')]+_0x1c65f0++,'VoiceExtensionId':_0x1fefbd[_0x87535f][0x0][_0x845a('0x1e')]});}}if(_0x42f64a[_0x845a('0xd')](_0x845a('0xe'))){if(_0xb0b552[_0x845a('0x21')](_0x42f64a[_0x845a('0x22')][_0x845a('0x23')]())>=0x0&&_0x42f64a[_0x845a('0x24')]!==_0x845a('0x25')){if(!_0x1172cf[_0x845a('0xe')]&&_0x42f64a[_0x845a('0xe')]){_0x1172cf[_0x845a('0xe')]=!![];_0x110a7a[_0x845a('0x1c')]({'type':_0x42f64a['type'],'app':_0x845a('0x26'),'context':_0x42f64a[_0x845a('0x13')],'exten':_0x42f64a['exten'],'priority':_0x33287b['length']+_0x1172cf[_0x845a('0x10')]+_0x1c65f0++,'VoiceExtensionId':_0x1fefbd[_0x87535f][0x0][_0x845a('0x1e')]});}if(!_0x1172cf[_0x845a('0xe')]&&!_0x1172cf[_0x845a('0xf')]&&!_0x42f64a[_0x845a('0xe')]){_0x1172cf['progress']=!![];_0x110a7a[_0x845a('0x1c')]({'type':_0x42f64a[_0x845a('0x12')],'app':_0x845a('0x27'),'context':_0x42f64a[_0x845a('0x13')],'exten':_0x42f64a['exten'],'priority':_0x33287b['length']+_0x1172cf[_0x845a('0x10')]+_0x1c65f0++,'VoiceExtensionId':_0x1fefbd[_0x87535f][0x0][_0x845a('0x1e')]});}}}if(_0x42f64a['hasOwnProperty'](_0x845a('0x28'))&&_0x42f64a[_0x845a('0xd')]('recordingFormat')){if(_0x42f64a[_0x845a('0x28')]){_0x110a7a[_0x845a('0x1c')]({'type':_0x42f64a[_0x845a('0x12')],'app':_0x845a('0x29'),'appdata':_0x845a('0x2a')+_0x42f64a[_0x845a('0x2b')]+',ab','context':_0x42f64a[_0x845a('0x13')],'exten':_0x42f64a[_0x845a('0xa')],'priority':_0x33287b[_0x845a('0x17')]+_0x1172cf[_0x845a('0x10')]+_0x1c65f0++,'VoiceExtensionId':_0x1fefbd[_0x87535f][0x0][_0x845a('0x1e')]});}}if(_0x42f64a[_0x845a('0xd')](_0x845a('0x28'))&&_0x42f64a[_0x845a('0xd')]('recordingFormat')){if(_0x42f64a['record']){_0x33ea8e[_0x845a('0x1c')]({'type':_0x42f64a['type'],'app':'StopMixMonitor','appdata':null,'context':_0x42f64a[_0x845a('0x13')],'exten':_0x42f64a[_0x845a('0xa')],'priority':_0x33287b['length']+_0x1172cf[_0x845a('0x10')]+_0x1c65f0++ +0x1,'VoiceExtensionId':_0x1fefbd[_0x87535f][0x0][_0x845a('0x1e')]});}}for(var _0x385dfb=0x0;_0x385dfb<_0x33287b[_0x845a('0x17')];_0x385dfb+=0x1){var _0x1cc31b=_0x1172cf[_0x845a('0x10')]+_0x33287b[_0x845a('0x17')];var _0x133425=_0x385dfb===_0x33287b['length']-0x1?_0x1172cf[_0x845a('0x10')]+_0x110a7a[_0x845a('0x17')]+_0x33ea8e[_0x845a('0x17')]+0x2:_0x1172cf['priority']+_0x385dfb+0x1;_0x110a7a['splice'](_0x385dfb,0x0,{'type':_0x42f64a[_0x845a('0x12')],'app':_0x845a('0x2c'),'appdata':_0x33287b[_0x385dfb]+'?'+_0x42f64a[_0x845a('0x13')]+_0x845a('0x2d')+_0x1cc31b+':'+_0x42f64a['context']+',${EXTEN},'+_0x133425,'exten':_0x42f64a[_0x845a('0xa')],'context':_0x42f64a[_0x845a('0x13')],'priority':_0x1172cf[_0x845a('0x10')]+_0x385dfb,'VoiceExtensionId':_0x1fefbd[_0x87535f][0x0][_0x845a('0x1e')]});}_0x42f64a['priority']=_0x110a7a[_0x845a('0x17')]?_[_0x845a('0x2e')](_0x110a7a)['priority']+0x1:_0x1172cf[_0x845a('0x10')];_0x1172cf['priority']=(_0x33ea8e['length']?_[_0x845a('0x2e')](_0x33ea8e)[_0x845a('0x10')]:_0x42f64a['priority'])+0x1;_0x1172cf[_0x845a('0x11')]=_['concat'](_0x1172cf[_0x845a('0x11')],_0x110a7a,[_0x42f64a],_0x33ea8e);}_0x1172cf[_0x845a('0x11')]['push']({'type':_0x1fefbd[_0x87535f][0x0][_0x845a('0x12')],'app':'Hangup','exten':_0x1fefbd[_0x87535f][0x0][_0x845a('0xa')],'context':_0x1fefbd[_0x87535f][0x0][_0x845a('0x13')],'priority':_0x1172cf['priority'],'VoiceExtensionId':_0x1fefbd[_0x87535f][0x0][_0x845a('0x1e')]});_0x2edf4f[_0x845a('0x1c')](_0x1fefbd[_0x87535f][0x0][_0x845a('0x1e')]);_0x133bcf=_[_0x845a('0x2f')](_0x133bcf,_0x1172cf[_0x845a('0x11')]);}}return _0x93426c['transaction'](function(_0x2367ea){return _0x93426c[_0x845a('0x2')][_0x845a('0x5')][_0x845a('0x30')]({'where':{'VoiceExtensionId':{'$in':_0x2edf4f}},'transaction':_0x2367ea})[_0x845a('0x7')](function(_0x217f4b){return _0x93426c[_0x845a('0x2')][_0x845a('0x5')][_0x845a('0x31')](_[_0x845a('0x32')](_0x133bcf,'priority'),{'transaction':_0x2367ea});});});})[_0x845a('0x33')](function(_0xbc4cf0){console[_0x845a('0x34')](_0xbc4cf0);});}exports[_0x845a('0x35')]=rewrite;
\ No newline at end of file
index 9b4c959..14c5235 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4a80=['null','Missing\x20filepath\x20parameter!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','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','CompanyId','find','duplicate','Duplicate\x20Contact','create','keys','then','push','pick','stringify','cmContact','inspect','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','id\x20IN\x20?','str','cm_hopper_final','deletedAt\x20IS\x20NULL','cm_hopper_black','findAll','outbound','dialCheckDuplicateType','CmList','get','always','sequelize','query','VoiceQueueId','catch','onlyIfOpen','all','BlackLists','Campaign','Lists','CampaignId','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','ioredis','../../../mysqldb','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined'];(function(_0x5e3e9c,_0x555b44){var _0x1d7fbe=function(_0x5016db){while(--_0x5016db){_0x5e3e9c['push'](_0x5e3e9c['shift']());}};_0x1d7fbe(++_0x555b44);}(_0x4a80,0xd0));var _0x04a8=function(_0x1afdfb,_0x56696d){_0x1afdfb=_0x1afdfb-0x0;var _0x4fe9a5=_0x4a80[_0x1afdfb];return _0x4fe9a5;};'use strict';var BPromise=require(_0x04a8('0x0'));var util=require(_0x04a8('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x04a8('0x2'));var db=require(_0x04a8('0x3'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x04a8('0x4'));config[_0x04a8('0x5')]=_[_0x04a8('0x6')](config['redis'],{'host':_0x04a8('0x7'),'port':0x18eb});var socket=require(_0x04a8('0x8'))(new Redis(config[_0x04a8('0x5')]));require(_0x04a8('0x9'))['register'](socket);try{if(!process[_0x04a8('0xa')][0x2]||process[_0x04a8('0xa')][0x2]===_0x04a8('0xb')||process[_0x04a8('0xa')][0x2]===_0x04a8('0xc')){throw new Error(_0x04a8('0xd'));}var FILEPATH=process['argv'][0x2];if(!process[_0x04a8('0xa')][0x3]||process['argv'][0x3]==='undefined'||process[_0x04a8('0xa')][0x3]==='null'||!process[_0x04a8('0xa')][0x4]||process['argv'][0x4]===_0x04a8('0xb')||process[_0x04a8('0xa')][0x4]===_0x04a8('0xc')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x04a8('0xe')](process['argv'][0x3][_0x04a8('0xf')](','),process[_0x04a8('0xa')][0x4][_0x04a8('0xf')](','));if(!process['argv'][0x5]||process[_0x04a8('0xa')][0x5]===_0x04a8('0xb')||process[_0x04a8('0xa')][0x5]===_0x04a8('0xc')){throw new Error(_0x04a8('0x10'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x04a8('0xa')][0x6]&&process['argv'][0x6]!==_0x04a8('0xb')&&process[_0x04a8('0xa')][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process[_0x04a8('0xa')][0x7]&&process[_0x04a8('0xa')][0x7]!=='undefined'&&process[_0x04a8('0xa')][0x7]!==_0x04a8('0xc')?process['argv'][0x7]:null;if(!process[_0x04a8('0xa')][0x8]||process['argv'][0x8]===_0x04a8('0xb')||process[_0x04a8('0xa')][0x8]===_0x04a8('0xc')){throw new Error(_0x04a8('0x11'));}var SOCKET_TIMESTAMP=process[_0x04a8('0xa')][0x8];}catch(_0x39a822){logger[_0x04a8('0x12')](_0x39a822);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(_0xd4fec2,_0x262336,_0x3c4519,_0x327809){var _0x1d001d={'message':_0x262336};_0x1d001d[_0xd4fec2]=!![];if(_0x3c4519){_0x1d001d[_0x04a8('0x13')]=_0x3c4519;}if(_0x327809){_0x1d001d[_0x04a8('0x14')]=_0x327809;}return _0x1d001d;}function isEmail(_0x99455e){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'](_0x99455e);}function checkRow(_0x46b603,_0x294242,_0x3a09d0){return new BPromise(function(_0x4d700c,_0x578cf6){if(_[_0x04a8('0x15')](_0x46b603)){return _0x578cf6(handleCheckRowError(_0x04a8('0x12'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3a09d0));}if(_0x46b603[_0x04a8('0x16')]&&_0x46b603[_0x04a8('0x16')][_0x04a8('0x17')]){var _0x79b664=_[_0x04a8('0x18')](_0x46b603[_0x04a8('0x16')],_0x04a8('0x19'))[_0x04a8('0x1a')](';');return _0x578cf6(handleCheckRowError('error',_0x79b664,null,_0x3a09d0));}var _0x560d1c={};for(var _0x158798 in FIELDS){if(FIELDS[_0x04a8('0x1b')](_0x158798)&&FIELDS[_0x158798]){_0x560d1c[_0x158798]=_0x46b603[_0x04a8('0x1c')][0x0][FIELDS[_0x158798]]||_0x46b603[_0x04a8('0x1c')][0x0]['\ufeff'+FIELDS[_0x158798]];}}if(!_0x560d1c[_0x04a8('0x1d')]){return _0x578cf6(handleCheckRowError(_0x04a8('0x12'),_0x04a8('0x1e'),null,_0x3a09d0));}if(!_0x560d1c['phone']){return _0x578cf6(handleCheckRowError(_0x04a8('0x12'),_0x04a8('0x1f'),null,_0x3a09d0));}if(_0x560d1c[_0x04a8('0x20')]){var _0x465d77=moment(_0x560d1c['birthDate'],_0x04a8('0x21'));if(!_0x465d77[_0x04a8('0x22')]()){return _0x578cf6(handleCheckRowError(_0x04a8('0x12'),_0x04a8('0x23'),null,_0x3a09d0));}}if(_0x560d1c['email']){if(!isEmail(_0x560d1c[_0x04a8('0x24')])){return _0x578cf6(handleCheckRowError(_0x04a8('0x12'),_0x04a8('0x25'),null,_0x3a09d0));}}_0x560d1c[_0x04a8('0x26')]=LISTID;_0x560d1c[_0x04a8('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x04a8('0x17')]&&_0x294242){var _0x4a138f={};for(var _0x222f26=0x0,_0x32e92e=DUPLICATES[_0x04a8('0x17')];_0x222f26<_0x32e92e;_0x222f26+=0x1){_0x4a138f[DUPLICATES[_0x222f26]]=_0x560d1c[DUPLICATES[_0x222f26]];}var _0x462f02=_[_0x04a8('0x28')](_0x294242,_0x4a138f);if(_0x462f02){return _0x578cf6(handleCheckRowError(_0x04a8('0x29'),_0x04a8('0x2a'),_0x462f02,_0x3a09d0));}}return db['CmContact'][_0x04a8('0x2b')](_0x560d1c,{'raw':!![],'hooks':![],'fields':_[_0x04a8('0x2c')](_0x560d1c)})[_0x04a8('0x2d')](function(_0x1569f9){if(DUPLICATES&&DUPLICATES[_0x04a8('0x17')]&&_0x294242){_0x294242[_0x04a8('0x2e')](_[_0x04a8('0x2f')](_0x560d1c,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x1569f9['id'];return _0x4d700c();})['catch'](function(_0x5118db){return _0x578cf6(handleCheckRowError(_0x04a8('0x12'),'Error\x20while\x20creating\x20contact:\x20'+(_0x5118db['message']||JSON[_0x04a8('0x30')](_0x5118db)),null,_0x3a09d0));});});}function checkHopper(){function _0x53668f(){return function(_0x11bb95){logger['error'](_0x04a8('0x31'),'checkHopper',util[_0x04a8('0x32')](_0x11bb95,{'showHidden':![],'depth':null}));};}var _0x5928c1=function(_0x58c805,_0x25fb1e){var _0x4d5ee5=squel[_0x04a8('0x33')]()[_0x04a8('0x34')](_0x04a8('0x35'))[_0x04a8('0x36')]([_0x04a8('0x37'),_0x04a8('0x38'),_0x04a8('0x39'),_0x04a8('0x26'),_0x25fb1e,_0x04a8('0x3a'),_0x04a8('0x3b')],squel[_0x04a8('0x3c')]()[_0x04a8('0x3d')](_0x04a8('0x37'),'phone')[_0x04a8('0x3d')](_0x04a8('0x3e'),_0x04a8('0x38'))[_0x04a8('0x3d')]('id',_0x04a8('0x39'))[_0x04a8('0x3d')](LISTID[_0x04a8('0x3f')](),'ListId')[_0x04a8('0x3d')](_0x58c805['id'][_0x04a8('0x3f')](),_0x25fb1e)[_0x04a8('0x3d')]('NOW()',_0x04a8('0x3a'))[_0x04a8('0x3d')](_0x04a8('0x3e'),_0x04a8('0x3b'))[_0x04a8('0x40')](_0x04a8('0x41'))[_0x04a8('0x42')]('deletedAt\x20IS\x20NULL')['where'](_0x04a8('0x43'),LISTID[_0x04a8('0x3f')]())[_0x04a8('0x42')](_0x04a8('0x44'))[_0x04a8('0x42')](_0x04a8('0x45'),squel[_0x04a8('0x3c')]()[_0x04a8('0x3d')](_0x04a8('0x37'))[_0x04a8('0x40')](_0x04a8('0x35'))[_0x04a8('0x42')](_0x25fb1e+_0x04a8('0x46'),_0x58c805['id'][_0x04a8('0x3f')]())))['toString']();return _0x4d5ee5;};var _0x2f8bc4=function(_0x1d32c1,_0xd218c3){var _0x2b484a=squel[_0x04a8('0x33')]()[_0x04a8('0x34')](_0x04a8('0x35'))[_0x04a8('0x36')]([_0x04a8('0x37'),'scheduledAt',_0x04a8('0x39'),'ListId',_0xd218c3,'createdAt','updatedAt'],squel[_0x04a8('0x3c')]()[_0x04a8('0x3d')](_0x04a8('0x37'),_0x04a8('0x37'))[_0x04a8('0x3d')](_0x04a8('0x3e'),_0x04a8('0x38'))[_0x04a8('0x3d')]('id','ContactId')[_0x04a8('0x3d')](LISTID['toString'](),_0x04a8('0x26'))[_0x04a8('0x3d')](_0x1d32c1['id']['toString'](),_0xd218c3)[_0x04a8('0x3d')](_0x04a8('0x3e'),_0x04a8('0x3a'))['field'](_0x04a8('0x3e'),_0x04a8('0x3b'))[_0x04a8('0x40')](_0x04a8('0x41'))[_0x04a8('0x42')]('deletedAt\x20IS\x20NULL')['where'](_0x04a8('0x43'),LISTID[_0x04a8('0x3f')]())[_0x04a8('0x42')](_0x04a8('0x47'),squel[_0x04a8('0x48')](hopperContacts))[_0x04a8('0x42')](_0x04a8('0x44'))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x04a8('0x3d')]('calleridnum')[_0x04a8('0x40')](_0x04a8('0x49'))[_0x04a8('0x42')](_0xd218c3+_0x04a8('0x46'),_0x1d32c1['id'][_0x04a8('0x3f')]()))[_0x04a8('0x42')](_0x04a8('0x45'),squel['select']()[_0x04a8('0x3d')](_0x04a8('0x37'))[_0x04a8('0x40')](_0x04a8('0x35'))[_0x04a8('0x42')](_0xd218c3+_0x04a8('0x46'),_0x1d32c1['id'][_0x04a8('0x3f')]())))[_0x04a8('0x3f')]();return _0x2b484a;};function _0x4d6adb(_0x57b788,_0x3d59a0){var _0x474486=squel['insert']()[_0x04a8('0x34')](_0x04a8('0x35'))['fromQuery']([_0x04a8('0x37'),'scheduledAt',_0x04a8('0x39'),'ListId',_0x3d59a0,'createdAt',_0x04a8('0x3b')],squel[_0x04a8('0x3c')]()[_0x04a8('0x3d')]('phone',_0x04a8('0x37'))[_0x04a8('0x3d')](_0x04a8('0x3e'),'scheduledAt')[_0x04a8('0x3d')]('id',_0x04a8('0x39'))[_0x04a8('0x3d')](LISTID[_0x04a8('0x3f')](),_0x04a8('0x26'))[_0x04a8('0x3d')](_0x57b788['id'][_0x04a8('0x3f')](),_0x3d59a0)[_0x04a8('0x3d')]('NOW()',_0x04a8('0x3a'))['field'](_0x04a8('0x3e'),_0x04a8('0x3b'))[_0x04a8('0x40')](_0x04a8('0x41'))[_0x04a8('0x42')](_0x04a8('0x4a'))['where']('ListId\x20=\x20?',LISTID[_0x04a8('0x3f')]())[_0x04a8('0x42')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x04a8('0x42')]('phone\x20IS\x20NOT\x20NULL'))[_0x04a8('0x3f')]();return _0x474486;}function _0x1e6787(_0xafd551,_0x434d75){var _0x5bd722=squel[_0x04a8('0x33')]()[_0x04a8('0x34')](_0x04a8('0x4b'))[_0x04a8('0x36')]([_0x04a8('0x37'),'ContactId',_0x04a8('0x26'),_0x434d75,'createdAt',_0x04a8('0x3b')],squel[_0x04a8('0x3c')]()['field'](_0x04a8('0x37'),_0x04a8('0x37'))[_0x04a8('0x3d')]('id',_0x04a8('0x39'))[_0x04a8('0x3d')](LISTID['toString'](),_0x04a8('0x26'))[_0x04a8('0x3d')](_0xafd551['id'][_0x04a8('0x3f')](),_0x434d75)['field'](_0x04a8('0x3e'),_0x04a8('0x3a'))['field'](_0x04a8('0x3e'),_0x04a8('0x3b'))['from'](_0x04a8('0x41'))['where'](_0x04a8('0x4a'))[_0x04a8('0x42')](_0x04a8('0x43'),LISTID['toString']())[_0x04a8('0x42')](_0x04a8('0x47'),squel['str'](hopperContacts))[_0x04a8('0x42')](_0x04a8('0x44')))[_0x04a8('0x3f')]();return _0x5bd722;}return db['VoiceQueue'][_0x04a8('0x4c')]({'where':{'type':_0x04a8('0x4d')},'attributes':['id',_0x04a8('0x4e')],'include':[{'model':db[_0x04a8('0x4f')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x2d8bb6){var _0x543bd6=[];if(_0x2d8bb6){var _0x28679a;for(var _0x349ecd=0x0,_0x2104b8;_0x349ecd<_0x2d8bb6[_0x04a8('0x17')];_0x349ecd+=0x1){_0x2104b8=_0x2d8bb6[_0x349ecd][_0x04a8('0x50')]({'plain':!![]});switch(_0x2104b8[_0x04a8('0x4e')]){case _0x04a8('0x51'):_0x543bd6['push'](db[_0x04a8('0x52')][_0x04a8('0x53')](_0x2f8bc4(_0x2104b8,_0x04a8('0x54')))['then'](function(){})[_0x04a8('0x55')](_0x53668f()));break;case _0x04a8('0x56'):_0x543bd6['push'](db[_0x04a8('0x52')][_0x04a8('0x53')](_0x5928c1(_0x2104b8,_0x04a8('0x54')))[_0x04a8('0x2d')](function(){})[_0x04a8('0x55')](_0x53668f()));break;default:_0x543bd6[_0x04a8('0x2e')](db[_0x04a8('0x52')][_0x04a8('0x53')](_0x4d6adb(_0x2104b8,_0x04a8('0x54')))['then'](function(){})[_0x04a8('0x55')](_0x53668f()));}}}return _0x543bd6;})[_0x04a8('0x57')]()[_0x04a8('0x2d')](function(){return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x04a8('0x4f')],'as':_0x04a8('0x58'),'where':{'id':LISTID}}]})[_0x04a8('0x2d')](function(_0x58bf1f){var _0x258512=[];if(_0x58bf1f){var _0x1db9b9;for(var _0x5dac71=0x0,_0x35cf0c;_0x5dac71<_0x58bf1f[_0x04a8('0x17')];_0x5dac71+=0x1){_0x35cf0c=_0x58bf1f[_0x5dac71][_0x04a8('0x50')]({'plain':!![]});_0x258512[_0x04a8('0x2e')](db[_0x04a8('0x52')][_0x04a8('0x53')](_0x1e6787(_0x35cf0c,_0x04a8('0x54')))['then'](function(){})[_0x04a8('0x55')](_0x53668f()));}}return _0x258512;})['all']();})[_0x04a8('0x2d')](function(){return db[_0x04a8('0x59')][_0x04a8('0x4c')]({'attributes':['id',_0x04a8('0x4e')],'include':[{'model':db[_0x04a8('0x4f')],'as':_0x04a8('0x5a'),'where':{'id':LISTID}}]})[_0x04a8('0x2d')](function(_0x41b95d){var _0x4802a8=[];if(_0x41b95d){for(var _0x275562=0x0,_0x58cc5e;_0x275562<_0x41b95d[_0x04a8('0x17')];_0x275562+=0x1){_0x58cc5e=_0x41b95d[_0x275562][_0x04a8('0x50')]({'plain':!![]});switch(_0x58cc5e[_0x04a8('0x4e')]){case'always':_0x4802a8[_0x04a8('0x2e')](db[_0x04a8('0x52')][_0x04a8('0x53')](_0x2f8bc4(_0x58cc5e,_0x04a8('0x5b')))[_0x04a8('0x2d')](function(){})['catch'](_0x53668f()));break;case'onlyIfOpen':_0x4802a8['push'](db['sequelize']['query'](_0x5928c1(_0x58cc5e,'CampaignId'))[_0x04a8('0x2d')](function(){})[_0x04a8('0x55')](_0x53668f()));break;default:_0x4802a8['push'](db['sequelize'][_0x04a8('0x53')](_0x4d6adb(_0x58cc5e,'CampaignId'))[_0x04a8('0x2d')](function(){})[_0x04a8('0x55')](_0x53668f()));}}}return _0x4802a8;})[_0x04a8('0x57')]();})['then'](function(){return db[_0x04a8('0x59')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x04a8('0x4f')],'as':_0x04a8('0x58'),'where':{'id':LISTID}}]})[_0x04a8('0x2d')](function(_0x10112a){var _0x212b1d=[];if(_0x10112a){for(var _0x13def2=0x0,_0x3ae342;_0x13def2<_0x10112a[_0x04a8('0x17')];_0x13def2+=0x1){_0x3ae342=_0x10112a[_0x13def2]['get']({'plain':!![]});_0x212b1d[_0x04a8('0x2e')](db[_0x04a8('0x52')][_0x04a8('0x53')](_0x1e6787(_0x3ae342,_0x04a8('0x5b')))[_0x04a8('0x2d')](function(){})['catch'](_0x53668f()));}}return _0x212b1d;})[_0x04a8('0x57')]();})[_0x04a8('0x55')](function(_0x19f538){logger['error']('cmContact,\x20%s,\x20%s',_0x04a8('0x5c'),_0x19f538[_0x04a8('0x19')]);});}var processPromises=function(_0x47de93){return BPromise[_0x04a8('0x57')](promises)[_0x04a8('0x2d')](function(_0x290301){})[_0x04a8('0x55')](function(_0x2a98a0){logger[_0x04a8('0x12')](_0x04a8('0x5d'),JSON[_0x04a8('0x30')](_0x2a98a0));})[_0x04a8('0x5e')](function(){socket[_0x04a8('0x5f')](_0x04a8('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x47de93){return _0x47de93[_0x04a8('0x61')]();}});};var endCsv=function(){return BPromise[_0x04a8('0x62')]()[_0x04a8('0x2d')](function(){if(hopperContacts){return checkHopper();}})[_0x04a8('0x2d')](function(){socket[_0x04a8('0x5f')](_0x04a8('0x60')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x04a8('0x63')](FILEPATH);}catch(_0x557bd8){logger['error'](_0x04a8('0x64'),JSON[_0x04a8('0x30')](_0x557bd8));}finally{process[_0x04a8('0x65')](0x0);}});};process['on']('SIGINT',function(){logger[_0x04a8('0x66')](_0x04a8('0x67'));endCsv();});function main(){return BPromise[_0x04a8('0x62')]()[_0x04a8('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x04a8('0xf')](',');return db[_0x04a8('0x68')][_0x04a8('0x4c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x4993d2){var _0x222c05=fs[_0x04a8('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x04a8('0x6a')](_0x222c05,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3e3db9,_0x4f4ad0){total+=0x1;var _0x3bc12d=total;promises[_0x04a8('0x2e')](checkRow(_0x3e3db9,_0x4993d2,_0x3bc12d)[_0x04a8('0x2d')](function(){success+=0x1;})[_0x04a8('0x55')](function(_0x5052f4){if(_0x5052f4[_0x04a8('0x12')]){errors+=0x1;delete _0x5052f4['error'];}else if(_0x5052f4[_0x04a8('0x29')]){duplicates+=0x1;delete _0x5052f4[_0x04a8('0x29')];}rows['push'](_0x5052f4);}));if(total%0xc8===0x0){_0x4f4ad0[_0x04a8('0x6b')]();return processPromises(_0x4f4ad0);}},'complete':function(){return processPromises()['then'](function(){logger[_0x04a8('0x66')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x4be280,_0x1a3aea){logger[_0x04a8('0x66')](_0x04a8('0x6c'),JSON[_0x04a8('0x30')](_0x4be280));endCsv();}});})[_0x04a8('0x55')](function(_0x43d940){logger[_0x04a8('0x12')](_0x04a8('0x6d'),JSON[_0x04a8('0x30')](_0x43d940));});}main();
\ No newline at end of file
+var _0xde2b=['data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','Duplicate\x20Contact','create','keys','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','ContactId','createdAt','select','field','NOW()','scheduledAt','toString','updatedAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','insert','cm_hopper_black','outbound','dialCheckDuplicateType','CmList','Lists','get','push','sequelize','query','VoiceQueueId','onlyIfOpen','VoiceQueue','all','Campaign','findAll','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','CSV\x20import\x20process\x20stopped!','resolve','CmContact','duplicate','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','argv','Missing\x20filepath\x20parameter!','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','errors','length','map','join','hasOwnProperty'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xde2b,0x12e));var _0xbde2=function(_0x43e966,_0x4fa391){_0x43e966=_0x43e966-0x0;var _0x39c947=_0xde2b[_0x43e966];return _0x39c947;};'use strict';var BPromise=require('bluebird');var util=require(_0xbde2('0x0'));var _=require(_0xbde2('0x1'));var fs=require('fs');var squel=require(_0xbde2('0x2'));var Papa=require(_0xbde2('0x3'));var Redis=require(_0xbde2('0x4'));var db=require(_0xbde2('0x5'))['db'];var config=require(_0xbde2('0x6'));var logger=require(_0xbde2('0x7'))(_0xbde2('0x8'));config[_0xbde2('0x9')]=_[_0xbde2('0xa')](config['redis'],{'host':_0xbde2('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbde2('0x9')]));require(_0xbde2('0xc'))['register'](socket);try{if(!process[_0xbde2('0xd')][0x2]||process[_0xbde2('0xd')][0x2]==='undefined'||process['argv'][0x2]==='null'){throw new Error(_0xbde2('0xe'));}var FILEPATH=process[_0xbde2('0xd')][0x2];if(!process[_0xbde2('0xd')][0x3]||process[_0xbde2('0xd')][0x3]===_0xbde2('0xf')||process['argv'][0x3]===_0xbde2('0x10')||!process[_0xbde2('0xd')][0x4]||process[_0xbde2('0xd')][0x4]===_0xbde2('0xf')||process['argv'][0x4]===_0xbde2('0x10')){throw new Error(_0xbde2('0x11'));}var FIELDS=_[_0xbde2('0x12')](process[_0xbde2('0xd')][0x3]['split'](','),process['argv'][0x4][_0xbde2('0x13')](','));if(!process['argv'][0x5]||process[_0xbde2('0xd')][0x5]==='undefined'||process['argv'][0x5]===_0xbde2('0x10')){throw new Error(_0xbde2('0x14'));}var LISTID=process[_0xbde2('0xd')][0x5];var COMPANYID=process[_0xbde2('0xd')][0x6]&&process['argv'][0x6]!=='undefined'&&process[_0xbde2('0xd')][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0xbde2('0xd')][0x7]!==_0xbde2('0xf')&&process[_0xbde2('0xd')][0x7]!==_0xbde2('0x10')?process[_0xbde2('0xd')][0x7]:null;if(!process[_0xbde2('0xd')][0x8]||process[_0xbde2('0xd')][0x8]===_0xbde2('0xf')||process[_0xbde2('0xd')][0x8]===_0xbde2('0x10')){throw new Error(_0xbde2('0x15'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x801dac){logger[_0xbde2('0x16')](_0x801dac);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(_0x5409bd,_0x7b5251,_0x544217,_0x5c0841){var _0x4cc95e={'message':_0x7b5251};_0x4cc95e[_0x5409bd]=!![];if(_0x544217){_0x4cc95e[_0xbde2('0x17')]=_0x544217;}if(_0x5c0841){_0x4cc95e[_0xbde2('0x18')]=_0x5c0841;}return _0x4cc95e;}function isEmail(_0x42d4fb){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))*$/[_0xbde2('0x19')](_0x42d4fb);}function checkRow(_0x5d860f,_0x2c355e,_0x2a1b30){return new BPromise(function(_0x12f6a8,_0x511e79){if(_['isNil'](_0x5d860f)){return _0x511e79(handleCheckRowError(_0xbde2('0x16'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x2a1b30));}if(_0x5d860f[_0xbde2('0x1a')]&&_0x5d860f[_0xbde2('0x1a')][_0xbde2('0x1b')]){var _0x326db7=_[_0xbde2('0x1c')](_0x5d860f[_0xbde2('0x1a')],'message')[_0xbde2('0x1d')](';');return _0x511e79(handleCheckRowError(_0xbde2('0x16'),_0x326db7,null,_0x2a1b30));}var _0x2f73ea={};for(var _0x818c93 in FIELDS){if(FIELDS[_0xbde2('0x1e')](_0x818c93)&&FIELDS[_0x818c93]){_0x2f73ea[_0x818c93]=_0x5d860f[_0xbde2('0x1f')][0x0][FIELDS[_0x818c93]]||_0x5d860f[_0xbde2('0x1f')][0x0]['\ufeff'+FIELDS[_0x818c93]];}}if(!_0x2f73ea[_0xbde2('0x20')]){return _0x511e79(handleCheckRowError(_0xbde2('0x16'),_0xbde2('0x21'),null,_0x2a1b30));}if(!_0x2f73ea[_0xbde2('0x22')]){return _0x511e79(handleCheckRowError('error',_0xbde2('0x23'),null,_0x2a1b30));}if(_0x2f73ea[_0xbde2('0x24')]){var _0x42b8d2=moment(_0x2f73ea[_0xbde2('0x24')],_0xbde2('0x25'));if(!_0x42b8d2[_0xbde2('0x26')]()){return _0x511e79(handleCheckRowError(_0xbde2('0x16'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x2a1b30));}}if(_0x2f73ea[_0xbde2('0x27')]){if(!isEmail(_0x2f73ea[_0xbde2('0x27')])){return _0x511e79(handleCheckRowError(_0xbde2('0x16'),_0xbde2('0x28'),null,_0x2a1b30));}}_0x2f73ea[_0xbde2('0x29')]=LISTID;_0x2f73ea['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xbde2('0x1b')]&&_0x2c355e){var _0x475b60={};for(var _0x22ee7b=0x0,_0x30487a=DUPLICATES['length'];_0x22ee7b<_0x30487a;_0x22ee7b+=0x1){_0x475b60[DUPLICATES[_0x22ee7b]]=_0x2f73ea[DUPLICATES[_0x22ee7b]];}var _0xf8049a=_['find'](_0x2c355e,_0x475b60);if(_0xf8049a){return _0x511e79(handleCheckRowError('duplicate',_0xbde2('0x2a'),_0xf8049a,_0x2a1b30));}}return db['CmContact'][_0xbde2('0x2b')](_0x2f73ea,{'raw':!![],'hooks':![],'fields':_[_0xbde2('0x2c')](_0x2f73ea)})[_0xbde2('0x2d')](function(_0x38818e){if(DUPLICATES&&DUPLICATES[_0xbde2('0x1b')]&&_0x2c355e){_0x2c355e['push'](_[_0xbde2('0x2e')](_0x2f73ea,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x38818e['id'];return _0x12f6a8();})[_0xbde2('0x2f')](function(_0x5ee5f4){return _0x511e79(handleCheckRowError(_0xbde2('0x16'),_0xbde2('0x30')+(_0x5ee5f4[_0xbde2('0x31')]||JSON[_0xbde2('0x32')](_0x5ee5f4)),null,_0x2a1b30));});});}function checkHopper(){function _0x117422(){return function(_0x1d3c1e){logger[_0xbde2('0x16')](_0xbde2('0x33'),_0xbde2('0x34'),util[_0xbde2('0x35')](_0x1d3c1e,{'showHidden':![],'depth':null}));};}var _0x21ace9=function(_0x374eb8,_0x4b7420){var _0x18f106=squel['insert']()[_0xbde2('0x36')](_0xbde2('0x37'))[_0xbde2('0x38')]([_0xbde2('0x22'),'scheduledAt',_0xbde2('0x39'),_0xbde2('0x29'),_0x4b7420,_0xbde2('0x3a'),'updatedAt'],squel[_0xbde2('0x3b')]()[_0xbde2('0x3c')](_0xbde2('0x22'),_0xbde2('0x22'))[_0xbde2('0x3c')](_0xbde2('0x3d'),_0xbde2('0x3e'))[_0xbde2('0x3c')]('id',_0xbde2('0x39'))[_0xbde2('0x3c')](LISTID[_0xbde2('0x3f')](),_0xbde2('0x29'))[_0xbde2('0x3c')](_0x374eb8['id'][_0xbde2('0x3f')](),_0x4b7420)[_0xbde2('0x3c')](_0xbde2('0x3d'),'createdAt')[_0xbde2('0x3c')](_0xbde2('0x3d'),_0xbde2('0x40'))[_0xbde2('0x41')](_0xbde2('0x42'))[_0xbde2('0x43')](_0xbde2('0x44'))[_0xbde2('0x43')](_0xbde2('0x45'),LISTID[_0xbde2('0x3f')]())[_0xbde2('0x43')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xbde2('0x46'),squel[_0xbde2('0x3b')]()[_0xbde2('0x3c')]('phone')[_0xbde2('0x41')](_0xbde2('0x37'))[_0xbde2('0x43')](_0x4b7420+_0xbde2('0x47'),_0x374eb8['id']['toString']())))[_0xbde2('0x3f')]();return _0x18f106;};var _0x256513=function(_0x419430,_0x1337aa){var _0x2efa8d=squel['insert']()[_0xbde2('0x36')](_0xbde2('0x37'))[_0xbde2('0x38')]([_0xbde2('0x22'),'scheduledAt',_0xbde2('0x39'),_0xbde2('0x29'),_0x1337aa,_0xbde2('0x3a'),_0xbde2('0x40')],squel[_0xbde2('0x3b')]()['field'](_0xbde2('0x22'),'phone')[_0xbde2('0x3c')](_0xbde2('0x3d'),_0xbde2('0x3e'))[_0xbde2('0x3c')]('id',_0xbde2('0x39'))['field'](LISTID[_0xbde2('0x3f')](),_0xbde2('0x29'))[_0xbde2('0x3c')](_0x419430['id']['toString'](),_0x1337aa)[_0xbde2('0x3c')](_0xbde2('0x3d'),_0xbde2('0x3a'))['field']('NOW()',_0xbde2('0x40'))[_0xbde2('0x41')](_0xbde2('0x42'))[_0xbde2('0x43')](_0xbde2('0x44'))[_0xbde2('0x43')]('ListId\x20=\x20?',LISTID['toString']())[_0xbde2('0x43')](_0xbde2('0x48'),squel[_0xbde2('0x49')](hopperContacts))[_0xbde2('0x43')](_0xbde2('0x4a'))[_0xbde2('0x43')](_0xbde2('0x46'),squel[_0xbde2('0x3b')]()[_0xbde2('0x3c')](_0xbde2('0x4b'))['from']('cm_hopper_final')[_0xbde2('0x43')](_0x1337aa+_0xbde2('0x47'),_0x419430['id']['toString']()))[_0xbde2('0x43')](_0xbde2('0x46'),squel[_0xbde2('0x3b')]()['field'](_0xbde2('0x22'))['from'](_0xbde2('0x37'))[_0xbde2('0x43')](_0x1337aa+'\x20=\x20?',_0x419430['id'][_0xbde2('0x3f')]())))[_0xbde2('0x3f')]();return _0x2efa8d;};function _0x20778c(_0x1c2066,_0x36da5f){var _0x2a4308=squel[_0xbde2('0x4c')]()[_0xbde2('0x36')](_0xbde2('0x37'))[_0xbde2('0x38')](['phone',_0xbde2('0x3e'),'ContactId','ListId',_0x36da5f,_0xbde2('0x3a'),_0xbde2('0x40')],squel[_0xbde2('0x3b')]()[_0xbde2('0x3c')]('phone',_0xbde2('0x22'))[_0xbde2('0x3c')](_0xbde2('0x3d'),_0xbde2('0x3e'))['field']('id',_0xbde2('0x39'))[_0xbde2('0x3c')](LISTID[_0xbde2('0x3f')](),_0xbde2('0x29'))[_0xbde2('0x3c')](_0x1c2066['id'][_0xbde2('0x3f')](),_0x36da5f)[_0xbde2('0x3c')]('NOW()',_0xbde2('0x3a'))['field'](_0xbde2('0x3d'),_0xbde2('0x40'))[_0xbde2('0x41')](_0xbde2('0x42'))[_0xbde2('0x43')](_0xbde2('0x44'))[_0xbde2('0x43')]('ListId\x20=\x20?',LISTID[_0xbde2('0x3f')]())[_0xbde2('0x43')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0xbde2('0x43')](_0xbde2('0x4a')))[_0xbde2('0x3f')]();return _0x2a4308;}function _0x192ef8(_0x455e57,_0xc37f4d){var _0x30dfad=squel[_0xbde2('0x4c')]()[_0xbde2('0x36')](_0xbde2('0x4d'))['fromQuery']([_0xbde2('0x22'),_0xbde2('0x39'),'ListId',_0xc37f4d,_0xbde2('0x3a'),_0xbde2('0x40')],squel[_0xbde2('0x3b')]()['field'](_0xbde2('0x22'),'phone')[_0xbde2('0x3c')]('id',_0xbde2('0x39'))[_0xbde2('0x3c')](LISTID[_0xbde2('0x3f')](),'ListId')[_0xbde2('0x3c')](_0x455e57['id'][_0xbde2('0x3f')](),_0xc37f4d)[_0xbde2('0x3c')](_0xbde2('0x3d'),_0xbde2('0x3a'))[_0xbde2('0x3c')](_0xbde2('0x3d'),_0xbde2('0x40'))[_0xbde2('0x41')](_0xbde2('0x42'))[_0xbde2('0x43')]('deletedAt\x20IS\x20NULL')[_0xbde2('0x43')](_0xbde2('0x45'),LISTID['toString']())[_0xbde2('0x43')](_0xbde2('0x48'),squel[_0xbde2('0x49')](hopperContacts))[_0xbde2('0x43')](_0xbde2('0x4a')))['toString']();return _0x30dfad;}return db['VoiceQueue']['findAll']({'where':{'type':_0xbde2('0x4e')},'attributes':['id',_0xbde2('0x4f')],'include':[{'model':db[_0xbde2('0x50')],'as':_0xbde2('0x51'),'where':{'id':LISTID}}]})[_0xbde2('0x2d')](function(_0x3edbef){var _0x2b6dd4=[];if(_0x3edbef){var _0x217c5b;for(var _0x4ad9f9=0x0,_0x207a74;_0x4ad9f9<_0x3edbef[_0xbde2('0x1b')];_0x4ad9f9+=0x1){_0x207a74=_0x3edbef[_0x4ad9f9][_0xbde2('0x52')]({'plain':!![]});switch(_0x207a74['dialCheckDuplicateType']){case'always':_0x2b6dd4[_0xbde2('0x53')](db[_0xbde2('0x54')][_0xbde2('0x55')](_0x256513(_0x207a74,_0xbde2('0x56')))['then'](function(){})[_0xbde2('0x2f')](_0x117422()));break;case _0xbde2('0x57'):_0x2b6dd4[_0xbde2('0x53')](db[_0xbde2('0x54')][_0xbde2('0x55')](_0x21ace9(_0x207a74,'VoiceQueueId'))[_0xbde2('0x2d')](function(){})[_0xbde2('0x2f')](_0x117422()));break;default:_0x2b6dd4[_0xbde2('0x53')](db[_0xbde2('0x54')][_0xbde2('0x55')](_0x20778c(_0x207a74,_0xbde2('0x56')))[_0xbde2('0x2d')](function(){})[_0xbde2('0x2f')](_0x117422()));}}}return _0x2b6dd4;})['all']()[_0xbde2('0x2d')](function(){return db[_0xbde2('0x58')]['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xbde2('0x50')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x47bc8c){var _0x238f14=[];if(_0x47bc8c){var _0xadc5c1;for(var _0x5d1674=0x0,_0x325669;_0x5d1674<_0x47bc8c['length'];_0x5d1674+=0x1){_0x325669=_0x47bc8c[_0x5d1674][_0xbde2('0x52')]({'plain':!![]});_0x238f14['push'](db[_0xbde2('0x54')]['query'](_0x192ef8(_0x325669,_0xbde2('0x56')))[_0xbde2('0x2d')](function(){})[_0xbde2('0x2f')](_0x117422()));}}return _0x238f14;})[_0xbde2('0x59')]();})['then'](function(){return db[_0xbde2('0x5a')][_0xbde2('0x5b')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xbde2('0x50')],'as':_0xbde2('0x51'),'where':{'id':LISTID}}]})[_0xbde2('0x2d')](function(_0x28653f){var _0x2b58cf=[];if(_0x28653f){for(var _0x28eeef=0x0,_0x2dc632;_0x28eeef<_0x28653f[_0xbde2('0x1b')];_0x28eeef+=0x1){_0x2dc632=_0x28653f[_0x28eeef]['get']({'plain':!![]});switch(_0x2dc632[_0xbde2('0x4f')]){case'always':_0x2b58cf['push'](db[_0xbde2('0x54')][_0xbde2('0x55')](_0x256513(_0x2dc632,'CampaignId'))['then'](function(){})[_0xbde2('0x2f')](_0x117422()));break;case _0xbde2('0x57'):_0x2b58cf['push'](db[_0xbde2('0x54')]['query'](_0x21ace9(_0x2dc632,_0xbde2('0x5c')))['then'](function(){})['catch'](_0x117422()));break;default:_0x2b58cf[_0xbde2('0x53')](db[_0xbde2('0x54')][_0xbde2('0x55')](_0x20778c(_0x2dc632,_0xbde2('0x5c')))[_0xbde2('0x2d')](function(){})['catch'](_0x117422()));}}}return _0x2b58cf;})[_0xbde2('0x59')]();})['then'](function(){return db[_0xbde2('0x5a')]['findAll']({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xbde2('0x5d'),'where':{'id':LISTID}}]})[_0xbde2('0x2d')](function(_0x3ad26b){var _0x25554b=[];if(_0x3ad26b){for(var _0x1df082=0x0,_0x542ef6;_0x1df082<_0x3ad26b['length'];_0x1df082+=0x1){_0x542ef6=_0x3ad26b[_0x1df082][_0xbde2('0x52')]({'plain':!![]});_0x25554b[_0xbde2('0x53')](db['sequelize'][_0xbde2('0x55')](_0x192ef8(_0x542ef6,_0xbde2('0x5c')))[_0xbde2('0x2d')](function(){})['catch'](_0x117422()));}}return _0x25554b;})[_0xbde2('0x59')]();})[_0xbde2('0x2f')](function(_0x31faba){logger[_0xbde2('0x16')](_0xbde2('0x5e'),_0xbde2('0x5f'),_0x31faba[_0xbde2('0x31')]);});}var processPromises=function(_0x4f8237){return BPromise[_0xbde2('0x59')](promises)['then'](function(_0x40c5e1){})['catch'](function(_0x5dda89){logger[_0xbde2('0x16')](_0xbde2('0x60'),JSON[_0xbde2('0x32')](_0x5dda89));})[_0xbde2('0x61')](function(){socket['emit'](_0xbde2('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4f8237){return _0x4f8237[_0xbde2('0x63')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xbde2('0x2d')](function(){socket['emit'](_0xbde2('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xbde2('0x64')](FILEPATH);}catch(_0x129790){logger[_0xbde2('0x16')](_0xbde2('0x65'),JSON[_0xbde2('0x32')](_0x129790));}finally{process[_0xbde2('0x66')](0x0);}});};process['on']('SIGINT',function(){logger[_0xbde2('0x67')](_0xbde2('0x68'));endCsv();});function main(){return BPromise[_0xbde2('0x69')]()[_0xbde2('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xbde2('0x6a')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xbde2('0x2d')](function(_0x33881d){var _0x5d0364=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x5d0364,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5b99a8,_0x3ba401){total+=0x1;var _0x3f4aed=total;promises[_0xbde2('0x53')](checkRow(_0x5b99a8,_0x33881d,_0x3f4aed)['then'](function(){success+=0x1;})['catch'](function(_0x2e5bc3){if(_0x2e5bc3['error']){errors+=0x1;delete _0x2e5bc3[_0xbde2('0x16')];}else if(_0x2e5bc3['duplicate']){duplicates+=0x1;delete _0x2e5bc3[_0xbde2('0x6b')];}rows[_0xbde2('0x53')](_0x2e5bc3);}));if(total%0xc8===0x0){_0x3ba401[_0xbde2('0x6c')]();return processPromises(_0x3ba401);}},'complete':function(){return processPromises()['then'](function(){logger['info'](_0xbde2('0x6d'));endCsv();});},'error':function(_0x471e31,_0x53b1b0){logger[_0xbde2('0x67')]('CSV\x20parse\x20error',JSON[_0xbde2('0x32')](_0x471e31));endCsv();}});})[_0xbde2('0x2f')](function(_0x2587a6){logger['error'](_0xbde2('0x6e'),JSON[_0xbde2('0x32')](_0x2587a6));});}main();
\ No newline at end of file
index 3d9563e..1b70275 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x21c4=['../../../mysqldb','../../../config/environment','import','redis','localhost','socket.io-emitter','format','test','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','scheduledat','ContactId','createdAt','updatedAt','priority','recallme','select','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','fromQuery','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','concat','keys','ListId','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','error','message','exit','errors','push','sequelize','query','spread','stringify','send','start','socket_timestamp','root','server/files/tmp','writeFileSync','parse','data','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','UserId','isNumber','includes','agent\x20not\x20exists','email\x20wrong\x20format','YYYY-MM-DD','\x20not\x20specified','length','SystemRow','appendFileSync','rows','emit','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','then','finish','affectedRows','contact:import:','unlink','complete','argv','arguments\x20<filename>\x20<parameters>\x20<agents>','existsSync','file\x20doesn\x27t\x20exists','binding','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','bluebird','squel','ioredis'];(function(_0x27895f,_0x5ce3f6){var _0x5d9a52=function(_0x32b9a0){while(--_0x32b9a0){_0x27895f['push'](_0x27895f['shift']());}};_0x5d9a52(++_0x5ce3f6);}(_0x21c4,0x102));var _0x421c=function(_0x20006a,_0x30e3a9){_0x20006a=_0x20006a-0x0;var _0x5e26ac=_0x21c4[_0x20006a];return _0x5e26ac;};'use strict';var fs=require('fs');var path=require(_0x421c('0x0'));var _=require(_0x421c('0x1'));var Papa=require(_0x421c('0x2'));var util=require('util');var BPromise=require(_0x421c('0x3'));var moment=require('moment');var squel=require(_0x421c('0x4'));var Redis=require(_0x421c('0x5'));var db=require(_0x421c('0x6'))['db'];var config=require(_0x421c('0x7'));var logger=require('../../../config/logger')(_0x421c('0x8'));config[_0x421c('0x9')]=_['defaults'](config[_0x421c('0x9')],{'host':_0x421c('0xa'),'port':0x18eb});var socket=require(_0x421c('0xb'))(new Redis(config[_0x421c('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x421c('0xc')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x4b4bd1){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))*$/[_0x421c('0xd')](_0x4b4bd1);}function selectNotIn(_0x2a1710,_0x256b16,_0x4fb06e,_0x103163,_0x1ae7fb){return squel['select']()[_0x421c('0xe')](_0x421c('0xf'))[_0x421c('0x10')](_0x103163)[_0x421c('0x11')](_0x256b16,null,_0x256b16+_0x421c('0x12')+_0x103163+'.'+_0x4fb06e)['where'](_0x103163+'.'+_0x4fb06e+_0x421c('0x13')+_0x2a1710+'.'+_0x4fb06e)[_0x421c('0x14')](_0x256b16+_0x421c('0x15')+_0x1ae7fb[_0x421c('0x11')]()+')');}function insertCmHopper(_0x5e607f,_0x1cc96e,_0xc5f454,_0xe32106,_0x484d86){var _0x46ccdb=[_0x421c('0x16'),_0x421c('0x17'),'cm_contacts.id','cm_contacts.ListId',_0x1cc96e+'.'+_0xe32106,'cm_contacts.createdAt',_0x421c('0x18'),'cm_contacts.priority',_0x421c('0x19'),'\x22'+_0x484d86+'\x22'];return squel[_0x421c('0x1a')]()[_0x421c('0x1b')](_0x421c('0x1c'))['fromQuery']([_0x421c('0xf'),_0x421c('0x1d'),_0x421c('0x1e'),'ListId',_0xe32106,_0x421c('0x1f'),_0x421c('0x20'),_0x421c('0x21'),'UserId',_0x421c('0x22')],squel[_0x421c('0x23')]()[_0x421c('0x24')](_0x46ccdb)['from'](_0x1cc96e)[_0x421c('0x11')](_0x421c('0x25'),null,'cm_contacts.ListId\x20=\x20'+_0x1cc96e+_0x421c('0x26'))[_0x421c('0x11')](_0xc5f454,null,_0xc5f454+_0x421c('0x12')+_0x1cc96e+'.'+_0xe32106)[_0x421c('0x14')](_0x1cc96e+_0x421c('0x27'),_0x5e607f)['where'](_0x421c('0x28'),NOW)[_0x421c('0x14')](_0x421c('0x29'),selectNotIn(_0x1cc96e,_0xc5f454,_0xe32106,'cm_hopper',[_0x421c('0x2a'),_0x421c('0x2b')]))['where'](_0x421c('0x29'),selectNotIn(_0x1cc96e,_0xc5f454,_0xe32106,'cm_hopper',['\x22always\x22'])))[_0x421c('0x2c')]();}function insertCmHopperBlack(_0x21fe3f,_0x220d37,_0x525536,_0x1337ad){var _0x3b8b02=[_0x421c('0x16'),_0x421c('0x2d'),_0x421c('0x2e'),_0x220d37+'.'+_0x1337ad,_0x421c('0x2f'),_0x421c('0x18')];return squel[_0x421c('0x1a')]()['into']('cm_hopper_black')[_0x421c('0x30')]([_0x421c('0xf'),_0x421c('0x1e'),'ListId',_0x1337ad,_0x421c('0x1f'),_0x421c('0x20')],squel['select']()[_0x421c('0x24')](_0x3b8b02)[_0x421c('0x10')](_0x220d37)[_0x421c('0x11')](_0x421c('0x25'),null,'cm_contacts.ListId\x20=\x20'+_0x220d37+_0x421c('0x26'))[_0x421c('0x11')](_0x525536,null,_0x525536+'.id\x20=\x20'+_0x220d37+'.'+_0x1337ad)[_0x421c('0x14')](_0x220d37+_0x421c('0x27'),_0x21fe3f)[_0x421c('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x421c('0x29'),squel['select']()[_0x421c('0xe')]('phone')[_0x421c('0x10')](_0x421c('0x31'))[_0x421c('0x14')](_0x421c('0x32'),_0x21fe3f)[_0x421c('0x14')](_0x1337ad+_0x421c('0x33'),_0x220d37+'.'+_0x1337ad)))[_0x421c('0x2c')]();}function insertCmContact(_0x594735,_0x1ef437,_0x24597a,_0x23bd98){var _0x4d0ee6=_[_0x421c('0x34')](_[_0x421c('0x35')](_0x23bd98),[_0x421c('0x36'),_0x421c('0x37'),_0x421c('0x1f'),_0x421c('0x20')]);return squel[_0x421c('0x1a')]()['into'](_0x421c('0x25'))[_0x421c('0x30')](_0x4d0ee6,squel[_0x421c('0x23')]()[_0x421c('0x24')](_0x4d0ee6)[_0x421c('0x10')](_0x1ef437)[_0x421c('0x14')]('('+_0x24597a[_0x421c('0x11')](',')+_0x421c('0x38'),squel[_0x421c('0x23')]()['fields'](_0x24597a)['from']('cm_contacts')[_0x421c('0x14')](_0x421c('0x32'),_0x594735))[_0x421c('0x14')](_0x421c('0x39'),squel[_0x421c('0x23')]()[_0x421c('0xe')](_0x421c('0x3a'),'min_id')[_0x421c('0x10')](_0x1ef437)[_0x421c('0x3b')](_0x24597a[_0x421c('0x11')](','))))['toString']();}function handleStop(){logger[_0x421c('0x3c')](_0x421c('0x3d'));stopped=!![];}function handleUncaughtException(_0x5629d7){logger[_0x421c('0x3e')](_0x5629d7[_0x421c('0x3f')]);process[_0x421c('0x40')](0x1);}function handleError(_0x4527ce,_0x102d6b){stats[_0x421c('0x41')][_0x421c('0x42')]({'name':_0x102d6b['code'],'message':_0x102d6b[_0x421c('0x3f')],'row':_0x4527ce});}function handleQuery(_0x16397b){logger[_0x421c('0x3c')](_0x16397b);return db[_0x421c('0x43')][_0x421c('0x44')](_0x16397b)[_0x421c('0x45')](function(_0x43f2d1){results['push'](_0x43f2d1);})['catch'](function(_0x11ca1d){logger[_0x421c('0x3e')](_0x11ca1d[_0x421c('0x3f')]);});}function main(_0x4e3386,_0x78242b,_0x33d069,_0x43c512){logger[_0x421c('0x3c')]('main',_0x4e3386,JSON[_0x421c('0x46')](_0x78242b));process[_0x421c('0x47')](_0x421c('0x48'));var _0x3c9594=_0x78242b['binding'];var _0x37f580=_0x78242b[_0x421c('0x49')];var _0x374d31=path[_0x421c('0x11')](config[_0x421c('0x4a')],_0x421c('0x4b'),_0x37f580+'.csv');var _0x276793=_[_0x421c('0x35')](_0x3c9594)[_0x421c('0x11')]();logger[_0x421c('0x3c')]('header',_0x276793);fs[_0x421c('0x4c')](_0x374d31,_0x276793+'\x0a');Papa[_0x421c('0x4d')](fs['createReadStream'](_0x4e3386),{'header':!![],'skipEmptyLines':!![],'step':function(_0x18910e,_0x4c92d0){try{for(var _0x3ef44d=0x0,_0x4d30ff=[];_0x3ef44d<_0x18910e[_0x421c('0x4e')]['length'];_0x3ef44d++){stats['rows']+=0x1;if(_0x18910e[_0x421c('0x41')][_0x3ef44d]){handleError(_0x18910e[_0x421c('0x4e')][_0x3ef44d],_0x18910e['errors'][_0x3ef44d]);}else{var _0x174348=[];for(var _0x1bb1f8 in _0x3c9594){if(_0x3c9594['hasOwnProperty'](_0x1bb1f8)){if(_0x18910e[_0x421c('0x4e')][_0x3ef44d][_0x3c9594[_0x1bb1f8]]){var _0x357c54=_['trim'](_0x18910e['data'][_0x3ef44d][_0x3c9594[_0x1bb1f8]][_0x421c('0x4f')](/"/g,'\x27'));switch(_0x1bb1f8){case'scheduledat':var _0x5d8c0e=moment(_0x357c54,_0x421c('0x50'),!![]);if(_0x5d8c0e[_0x421c('0x51')]()){_0x4d30ff[_0x421c('0x42')]('\x22'+_0x357c54+'\x22');}else{_0x174348[_0x421c('0x42')](_0x421c('0x52'));}break;case _0x421c('0x21'):var _0x2561b3=parseInt(_0x357c54);_0x357c54=_['isNaN'](_0x2561b3)||_0x2561b3<0x0||_0x2561b3>0x4?_0x43c512?0x3:0x2:_0x2561b3;_0x4d30ff[_0x421c('0x42')]('\x22'+_0x357c54+'\x22');break;case _0x421c('0x53'):var _0x33a13f=parseInt(_0x357c54);if(_[_0x421c('0x54')](_0x33a13f)&&_[_0x421c('0x55')](_0x33d069,_0x33a13f)){_0x4d30ff[_0x421c('0x42')]('\x22'+_0x33a13f+'\x22');}else{_0x174348['push'](_0x421c('0x56'));}break;case'email':if(isEmail(_0x357c54)){_0x4d30ff['push']('\x22'+_0x357c54+'\x22');}else{_0x174348[_0x421c('0x42')](_0x421c('0x57'));}break;case'dateOfBirth':var _0x3a71a8=moment(_0x357c54,_0x421c('0x58'),!![]);if(_0x3a71a8[_0x421c('0x51')]()){_0x4d30ff[_0x421c('0x42')]('\x22'+_0x357c54+'\x22');}else{_0x174348[_0x421c('0x42')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x4d30ff['push']('\x22'+_0x357c54+'\x22');}}else{switch(_0x1bb1f8){case'firstName':case _0x421c('0xf'):_0x174348[_0x421c('0x42')](_0x1bb1f8+_0x421c('0x59'));break;default:_0x4d30ff[_0x421c('0x42')]('\x22\x22');}}}}if(_0x174348[_0x421c('0x5a')]){handleError(_0x18910e[_0x421c('0x4e')][_0x3ef44d],{'code':_0x421c('0x5b'),'message':_0x174348[_0x421c('0x11')]()});}else{fs[_0x421c('0x5c')](_0x374d31,_0x4d30ff[_0x421c('0x11')]()+'\x0a');}_0x4d30ff=[];}if(!(stats[_0x421c('0x5d')]%0xc8)){socket[_0x421c('0x5e')]('contact:import:'+_0x37f580,stats);stats[_0x421c('0x41')]=[];}}if(stopped){logger[_0x421c('0x3c')](_0x421c('0x5f'));_0x4c92d0[_0x421c('0x60')]();}}catch(_0x4df14d){handleError(_0x18910e[_0x421c('0x4e')][_0x3ef44d],{'code':_0x421c('0x61'),'message':_0x4df14d[_0x421c('0x3f')]});logger[_0x421c('0x3e')](_0x421c('0x62'),_0x4df14d['message']);}},'complete':function(){try{var _0x1bd20e=[];var _0x4f61cc='cm_contacts';if(_0x78242b[_0x421c('0x63')]&&_0x78242b['duplicates'][_0x421c('0x5a')]){_0x4f61cc=_0x421c('0x64')+_0x37f580;_0x1bd20e['push'](_0x421c('0x65')+_0x4f61cc+_0x421c('0x66'));}var _0x3c9b32=util[_0x421c('0xc')]('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',_0x374d31,_0x4f61cc,_0x276793,_0x78242b[_0x421c('0x36')],_0x78242b[_0x421c('0x37')]||null,NOW,NOW);if(_['isNil'](_0x3c9594['scheduledat'])){_0x3c9b32+=_0x421c('0x67');}_0x1bd20e['push'](_0x3c9b32);if(_0x78242b[_0x421c('0x63')]&&_0x78242b[_0x421c('0x63')][_0x421c('0x5a')]){_0x1bd20e[_0x421c('0x42')](insertCmContact(_0x78242b[_0x421c('0x36')],_0x4f61cc,_0x78242b[_0x421c('0x63')],_0x3c9594));_0x1bd20e[_0x421c('0x42')](_0x421c('0x68')+_0x4f61cc+';');}_0x1bd20e[_0x421c('0x42')](insertCmHopper(_0x78242b[_0x421c('0x36')],_0x421c('0x69'),_0x421c('0x6a'),_0x421c('0x6b'),_0x43c512));_0x1bd20e['push'](insertCmHopperBlack(_0x78242b[_0x421c('0x36')],_0x421c('0x6c'),'voice_queues',_0x421c('0x6b')));_0x1bd20e[_0x421c('0x42')](insertCmHopper(_0x78242b['ListId'],_0x421c('0x6d'),_0x421c('0x6e'),_0x421c('0x6f'),_0x43c512));_0x1bd20e[_0x421c('0x42')](insertCmHopperBlack(_0x78242b[_0x421c('0x36')],_0x421c('0x70'),'campaigns',_0x421c('0x6f')));BPromise['each'](_0x1bd20e,handleQuery)[_0x421c('0x71')](function(_0x2d0673){stats[_0x421c('0x72')]=!![];stats[_0x421c('0x73')]=_0x78242b[_0x421c('0x63')]&&_0x78242b[_0x421c('0x63')]['length']?results[0x2]['affectedRows']:results[0x0][_0x421c('0x73')];socket[_0x421c('0x5e')](_0x421c('0x74')+_0x37f580,stats);fs[_0x421c('0x75')](_0x4e3386);fs[_0x421c('0x75')](_0x374d31);process[_0x421c('0x40')](0x0);})['catch'](function(_0x438e2a){logger[_0x421c('0x3e')](_0x438e2a[_0x421c('0x3f')]);process[_0x421c('0x40')](0x1);});}catch(_0x1c6936){logger[_0x421c('0x3e')](_0x421c('0x76'),_0x1c6936[_0x421c('0x3f')]);process[_0x421c('0x40')](0x1);}},'error':function(_0x1706a1,_0x570a5e,_0x3e0cd7,_0x5041fc){throw new Error(_0x5041fc);}});}function validate(){if(process['argv']&&process[_0x421c('0x77')][_0x421c('0x5a')]<0x4){throw new Error(_0x421c('0x78'));}var _0x3721a8=path['join'](config[_0x421c('0x4a')],_0x421c('0x4b'),process['argv'][0x2]);if(!fs[_0x421c('0x79')](_0x3721a8)){throw new Error(_0x421c('0x7a'));}var _0x3ba7bd={};try{_0x3ba7bd=JSON[_0x421c('0x4d')](process['argv'][0x3]);if(!_0x3ba7bd[_0x421c('0x7b')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x3ba7bd[_0x421c('0x7b')]['phone']){throw new Error(_0x421c('0x7c'));}if(!_0x3ba7bd[_0x421c('0x7b')][_0x421c('0x7d')]){throw new Error(_0x421c('0x7e'));}var _0x1ae518=0x0;if(_0x3ba7bd[_0x421c('0x7b')][_0x421c('0x53')]){_0x1ae518=0x1;}if(!_0x3ba7bd[_0x421c('0x36')]){throw new Error(_0x421c('0x7f'));}}catch(_0x13d57e){throw new Error(_0x421c('0x80'));}var _0x2a948c=[];try{_0x2a948c=_['map'](JSON[_0x421c('0x4d')](process['argv'][0x4]),'id');}catch(_0x5a7efd){logger['info'](_0x421c('0x81'));}main(_0x3721a8,_0x3ba7bd,_0x2a948c,_0x1ae518);}validate();process['on'](_0x421c('0x82'),handleStop);process['on'](_0x421c('0x83'),handleUncaughtException);
\ No newline at end of file
+var _0xe2df=['CampaignId','each','then','finish','affectedRows','complete','argv','arguments\x20<filename>\x20<parameters>\x20<agents>','root','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','No\x20agent\x20available','lodash','papaparse','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_hopper','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','into','cm_hopper_black','fromQuery','ListId\x20=\x20?','concat','keys','CompanyId','insert',')\x20NOT\x20IN\x20?','MIN(id)','min_id','group','toString','info','error','message','exit','errors','code','sequelize','query','push','catch','start','binding','server/files/tmp','writeFileSync','createReadStream','length','rows','data','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','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','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns_has_cm_blacklists'];(function(_0x475dce,_0x1754ff){var _0x40687a=function(_0xdfa78a){while(--_0xdfa78a){_0x475dce['push'](_0x475dce['shift']());}};_0x40687a(++_0x1754ff);}(_0xe2df,0x17a));var _0xfe2d=function(_0x110e5b,_0x1bba41){_0x110e5b=_0x110e5b-0x0;var _0x409358=_0xe2df[_0x110e5b];return _0x409358;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xfe2d('0x0'));var Papa=require(_0xfe2d('0x1'));var util=require('util');var BPromise=require(_0xfe2d('0x2'));var moment=require('moment');var squel=require(_0xfe2d('0x3'));var Redis=require(_0xfe2d('0x4'));var db=require(_0xfe2d('0x5'))['db'];var config=require(_0xfe2d('0x6'));var logger=require(_0xfe2d('0x7'))(_0xfe2d('0x8'));config['redis']=_['defaults'](config[_0xfe2d('0x9')],{'host':_0xfe2d('0xa'),'port':0x18eb});var socket=require(_0xfe2d('0xb'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xfe2d('0xc')](_0xfe2d('0xd'));function isEmail(_0xbef73f){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'](_0xbef73f);}function selectNotIn(_0x50a9a6,_0x184a7a,_0x561a8f,_0x426b2b,_0x546027){return squel[_0xfe2d('0xe')]()[_0xfe2d('0xf')](_0xfe2d('0x10'))[_0xfe2d('0x11')](_0x426b2b)[_0xfe2d('0x12')](_0x184a7a,null,_0x184a7a+'.id\x20=\x20'+_0x426b2b+'.'+_0x561a8f)[_0xfe2d('0x13')](_0x426b2b+'.'+_0x561a8f+_0xfe2d('0x14')+_0x50a9a6+'.'+_0x561a8f)['where'](_0x184a7a+_0xfe2d('0x15')+_0x546027[_0xfe2d('0x12')]()+')');}function insertCmHopper(_0x1dc789,_0x2416d8,_0x4ee7ad,_0x2779d8,_0x19f7e8){var _0x55eb28=['cm_contacts.phone','cm_contacts.scheduledat',_0xfe2d('0x16'),_0xfe2d('0x17'),_0x2416d8+'.'+_0x2779d8,_0xfe2d('0x18'),_0xfe2d('0x19'),_0xfe2d('0x1a'),'cm_contacts.UserId','\x22'+_0x19f7e8+'\x22'];return squel['insert']()['into'](_0xfe2d('0x1b'))['fromQuery']([_0xfe2d('0x10'),_0xfe2d('0x1c'),_0xfe2d('0x1d'),_0xfe2d('0x1e'),_0x2779d8,_0xfe2d('0x1f'),_0xfe2d('0x20'),_0xfe2d('0x21'),_0xfe2d('0x22'),_0xfe2d('0x23')],squel[_0xfe2d('0xe')]()[_0xfe2d('0x24')](_0x55eb28)[_0xfe2d('0x11')](_0x2416d8)[_0xfe2d('0x12')](_0xfe2d('0x25'),null,_0xfe2d('0x26')+_0x2416d8+_0xfe2d('0x27'))['join'](_0x4ee7ad,null,_0x4ee7ad+_0xfe2d('0x28')+_0x2416d8+'.'+_0x2779d8)[_0xfe2d('0x13')](_0x2416d8+_0xfe2d('0x29'),_0x1dc789)[_0xfe2d('0x13')](_0xfe2d('0x2a'),NOW)[_0xfe2d('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2416d8,_0x4ee7ad,_0x2779d8,'cm_hopper',[_0xfe2d('0x2b'),'\x22onlyIfOpen\x22']))['where'](_0xfe2d('0x2c'),selectNotIn(_0x2416d8,_0x4ee7ad,_0x2779d8,_0xfe2d('0x1b'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x5aac35,_0x17fa20,_0x2b66ce,_0x3dcbf9){var _0x4461ae=['cm_contacts.phone',_0xfe2d('0x16'),'cm_contacts.ListId',_0x17fa20+'.'+_0x3dcbf9,_0xfe2d('0x18'),_0xfe2d('0x19')];return squel['insert']()[_0xfe2d('0x2d')](_0xfe2d('0x2e'))[_0xfe2d('0x2f')]([_0xfe2d('0x10'),_0xfe2d('0x1d'),_0xfe2d('0x1e'),_0x3dcbf9,_0xfe2d('0x1f'),_0xfe2d('0x20')],squel['select']()['fields'](_0x4461ae)['from'](_0x17fa20)[_0xfe2d('0x12')](_0xfe2d('0x25'),null,_0xfe2d('0x26')+_0x17fa20+_0xfe2d('0x27'))[_0xfe2d('0x12')](_0x2b66ce,null,_0x2b66ce+_0xfe2d('0x28')+_0x17fa20+'.'+_0x3dcbf9)[_0xfe2d('0x13')](_0x17fa20+'.CmListId\x20=\x20?',_0x5aac35)[_0xfe2d('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xfe2d('0x13')](_0xfe2d('0x2c'),squel[_0xfe2d('0xe')]()[_0xfe2d('0xf')]('phone')['from'](_0xfe2d('0x2e'))['where'](_0xfe2d('0x30'),_0x5aac35)[_0xfe2d('0x13')](_0x3dcbf9+'\x20=\x20?',_0x17fa20+'.'+_0x3dcbf9)))['toString']();}function insertCmContact(_0x97b97c,_0x576b9b,_0x507cc6,_0x4895a2){var _0x2ba072=_[_0xfe2d('0x31')](_[_0xfe2d('0x32')](_0x4895a2),[_0xfe2d('0x1e'),_0xfe2d('0x33'),_0xfe2d('0x1f'),_0xfe2d('0x20')]);return squel[_0xfe2d('0x34')]()[_0xfe2d('0x2d')](_0xfe2d('0x25'))[_0xfe2d('0x2f')](_0x2ba072,squel[_0xfe2d('0xe')]()[_0xfe2d('0x24')](_0x2ba072)[_0xfe2d('0x11')](_0x576b9b)[_0xfe2d('0x13')]('('+_0x507cc6[_0xfe2d('0x12')](',')+_0xfe2d('0x35'),squel[_0xfe2d('0xe')]()[_0xfe2d('0x24')](_0x507cc6)['from'](_0xfe2d('0x25'))[_0xfe2d('0x13')](_0xfe2d('0x30'),_0x97b97c))[_0xfe2d('0x13')]('id\x20IN\x20?',squel[_0xfe2d('0xe')]()[_0xfe2d('0xf')](_0xfe2d('0x36'),_0xfe2d('0x37'))[_0xfe2d('0x11')](_0x576b9b)[_0xfe2d('0x38')](_0x507cc6[_0xfe2d('0x12')](','))))[_0xfe2d('0x39')]();}function handleStop(){logger[_0xfe2d('0x3a')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x115bce){logger[_0xfe2d('0x3b')](_0x115bce[_0xfe2d('0x3c')]);process[_0xfe2d('0x3d')](0x1);}function handleError(_0x4c24ef,_0x228d88){stats[_0xfe2d('0x3e')]['push']({'name':_0x228d88[_0xfe2d('0x3f')],'message':_0x228d88[_0xfe2d('0x3c')],'row':_0x4c24ef});}function handleQuery(_0x36cbb2){logger[_0xfe2d('0x3a')](_0x36cbb2);return db[_0xfe2d('0x40')][_0xfe2d('0x41')](_0x36cbb2)['spread'](function(_0x4c09cf){results[_0xfe2d('0x42')](_0x4c09cf);})[_0xfe2d('0x43')](function(_0x3b5473){logger[_0xfe2d('0x3b')](_0x3b5473[_0xfe2d('0x3c')]);});}function main(_0x20d23c,_0x23ea12,_0x5f386e,_0x43e322){logger[_0xfe2d('0x3a')]('main',_0x20d23c,JSON['stringify'](_0x23ea12));process['send'](_0xfe2d('0x44'));var _0x4c1325=_0x23ea12[_0xfe2d('0x45')];var _0x274fd9=_0x23ea12['socket_timestamp'];var _0x47638a=path[_0xfe2d('0x12')](config['root'],_0xfe2d('0x46'),_0x274fd9+'.csv');var _0xdb960=_[_0xfe2d('0x32')](_0x4c1325)[_0xfe2d('0x12')]();logger[_0xfe2d('0x3a')]('header',_0xdb960);fs[_0xfe2d('0x47')](_0x47638a,_0xdb960+'\x0a');Papa['parse'](fs[_0xfe2d('0x48')](_0x20d23c),{'header':!![],'skipEmptyLines':!![],'step':function(_0x27df4a,_0x5f4a33){try{for(var _0x118438=0x0,_0x3243bd=[];_0x118438<_0x27df4a['data'][_0xfe2d('0x49')];_0x118438++){stats[_0xfe2d('0x4a')]+=0x1;if(_0x27df4a['errors'][_0x118438]){handleError(_0x27df4a[_0xfe2d('0x4b')][_0x118438],_0x27df4a[_0xfe2d('0x3e')][_0x118438]);}else{var _0x25031a=[];for(var _0x266e73 in _0x4c1325){if(_0x4c1325[_0xfe2d('0x4c')](_0x266e73)){if(_0x27df4a[_0xfe2d('0x4b')][_0x118438][_0x4c1325[_0x266e73]]){var _0x51c8ce=_[_0xfe2d('0x4d')](_0x27df4a[_0xfe2d('0x4b')][_0x118438][_0x4c1325[_0x266e73]][_0xfe2d('0x4e')](/"/g,'\x27'));switch(_0x266e73){case _0xfe2d('0x1c'):var _0x2aa944=moment(_0x51c8ce,_0xfe2d('0xd'),!![]);if(_0x2aa944[_0xfe2d('0x4f')]()){_0x3243bd['push']('\x22'+_0x51c8ce+'\x22');}else{_0x25031a[_0xfe2d('0x42')](_0xfe2d('0x50'));}break;case _0xfe2d('0x21'):var _0x4b185c=parseInt(_0x51c8ce);_0x51c8ce=_[_0xfe2d('0x51')](_0x4b185c)||_0x4b185c<0x0||_0x4b185c>0x4?_0x43e322?0x3:0x2:_0x4b185c;_0x3243bd[_0xfe2d('0x42')]('\x22'+_0x51c8ce+'\x22');break;case _0xfe2d('0x22'):var _0x54c58f=parseInt(_0x51c8ce);if(_[_0xfe2d('0x52')](_0x54c58f)&&_[_0xfe2d('0x53')](_0x5f386e,_0x54c58f)){_0x3243bd[_0xfe2d('0x42')]('\x22'+_0x54c58f+'\x22');}else{_0x25031a['push']('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x51c8ce)){_0x3243bd[_0xfe2d('0x42')]('\x22'+_0x51c8ce+'\x22');}else{_0x25031a[_0xfe2d('0x42')](_0xfe2d('0x54'));}break;case _0xfe2d('0x55'):var _0x2ce657=moment(_0x51c8ce,_0xfe2d('0x56'),!![]);if(_0x2ce657[_0xfe2d('0x4f')]()){_0x3243bd[_0xfe2d('0x42')]('\x22'+_0x51c8ce+'\x22');}else{_0x25031a[_0xfe2d('0x42')](_0xfe2d('0x57'));}break;default:_0x3243bd[_0xfe2d('0x42')]('\x22'+_0x51c8ce+'\x22');}}else{switch(_0x266e73){case _0xfe2d('0x58'):case _0xfe2d('0x10'):_0x25031a['push'](_0x266e73+'\x20not\x20specified');break;default:_0x3243bd[_0xfe2d('0x42')]('\x22\x22');}}}}if(_0x25031a[_0xfe2d('0x49')]){handleError(_0x27df4a[_0xfe2d('0x4b')][_0x118438],{'code':_0xfe2d('0x59'),'message':_0x25031a[_0xfe2d('0x12')]()});}else{fs[_0xfe2d('0x5a')](_0x47638a,_0x3243bd['join']()+'\x0a');}_0x3243bd=[];}if(!(stats[_0xfe2d('0x4a')]%0xc8)){socket[_0xfe2d('0x5b')](_0xfe2d('0x5c')+_0x274fd9,stats);stats[_0xfe2d('0x3e')]=[];}}if(stopped){logger[_0xfe2d('0x3a')](_0xfe2d('0x5d'));_0x5f4a33[_0xfe2d('0x5e')]();}}catch(_0x330232){handleError(_0x27df4a[_0xfe2d('0x4b')][_0x118438],{'code':_0xfe2d('0x5f'),'message':_0x330232[_0xfe2d('0x3c')]});logger[_0xfe2d('0x3b')]('step',_0x330232['message']);}},'complete':function(){try{var _0x781608=[];var _0x5547a8=_0xfe2d('0x25');if(_0x23ea12[_0xfe2d('0x60')]&&_0x23ea12[_0xfe2d('0x60')][_0xfe2d('0x49')]){_0x5547a8='cm_contacts_'+_0x274fd9;_0x781608[_0xfe2d('0x42')](_0xfe2d('0x61')+_0x5547a8+_0xfe2d('0x62'));}var _0x518ce7=util['format'](_0xfe2d('0x63'),_0x47638a,_0x5547a8,_0xdb960,_0x23ea12['ListId'],_0x23ea12[_0xfe2d('0x33')]||null,NOW,NOW);if(_[_0xfe2d('0x64')](_0x4c1325['scheduledat'])){_0x518ce7+=_0xfe2d('0x65');}_0x781608[_0xfe2d('0x42')](_0x518ce7);if(_0x23ea12['duplicates']&&_0x23ea12[_0xfe2d('0x60')][_0xfe2d('0x49')]){_0x781608['push'](insertCmContact(_0x23ea12[_0xfe2d('0x1e')],_0x5547a8,_0x23ea12[_0xfe2d('0x60')],_0x4c1325));_0x781608['push'](_0xfe2d('0x66')+_0x5547a8+';');}_0x781608[_0xfe2d('0x42')](insertCmHopper(_0x23ea12[_0xfe2d('0x1e')],'voice_queues_has_cm_lists','voice_queues','VoiceQueueId',_0x43e322));_0x781608[_0xfe2d('0x42')](insertCmHopperBlack(_0x23ea12[_0xfe2d('0x1e')],_0xfe2d('0x67'),'voice_queues','VoiceQueueId'));_0x781608[_0xfe2d('0x42')](insertCmHopper(_0x23ea12['ListId'],_0xfe2d('0x68'),'campaigns','CampaignId',_0x43e322));_0x781608[_0xfe2d('0x42')](insertCmHopperBlack(_0x23ea12[_0xfe2d('0x1e')],_0xfe2d('0x69'),'campaigns',_0xfe2d('0x6a')));BPromise[_0xfe2d('0x6b')](_0x781608,handleQuery)[_0xfe2d('0x6c')](function(_0x501ae6){stats[_0xfe2d('0x6d')]=!![];stats[_0xfe2d('0x6e')]=_0x23ea12[_0xfe2d('0x60')]&&_0x23ea12[_0xfe2d('0x60')][_0xfe2d('0x49')]?results[0x2][_0xfe2d('0x6e')]:results[0x0][_0xfe2d('0x6e')];socket[_0xfe2d('0x5b')](_0xfe2d('0x5c')+_0x274fd9,stats);fs['unlink'](_0x20d23c);fs['unlink'](_0x47638a);process[_0xfe2d('0x3d')](0x0);})[_0xfe2d('0x43')](function(_0xca85bb){logger[_0xfe2d('0x3b')](_0xca85bb[_0xfe2d('0x3c')]);process[_0xfe2d('0x3d')](0x1);});}catch(_0x2ac8ed){logger[_0xfe2d('0x3b')](_0xfe2d('0x6f'),_0x2ac8ed[_0xfe2d('0x3c')]);process['exit'](0x1);}},'error':function(_0x5524c1,_0x40b317,_0x4602b3,_0x52ef30){throw new Error(_0x52ef30);}});}function validate(){if(process['argv']&&process[_0xfe2d('0x70')][_0xfe2d('0x49')]<0x4){throw new Error(_0xfe2d('0x71'));}var _0x5cd6c=path[_0xfe2d('0x12')](config[_0xfe2d('0x72')],_0xfe2d('0x46'),process[_0xfe2d('0x70')][0x2]);if(!fs[_0xfe2d('0x73')](_0x5cd6c)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x4db894={};try{_0x4db894=JSON['parse'](process['argv'][0x3]);if(!_0x4db894[_0xfe2d('0x45')]){throw new Error(_0xfe2d('0x74'));}if(!_0x4db894[_0xfe2d('0x45')][_0xfe2d('0x10')]){throw new Error(_0xfe2d('0x75'));}if(!_0x4db894[_0xfe2d('0x45')][_0xfe2d('0x58')]){throw new Error(_0xfe2d('0x76'));}var _0x5080dc=0x0;if(_0x4db894['binding']['UserId']){_0x5080dc=0x1;}if(!_0x4db894[_0xfe2d('0x1e')]){throw new Error(_0xfe2d('0x77'));}}catch(_0x3a6dd7){throw new Error('body\x20id\x20mandatory');}var _0x658832=[];try{_0x658832=_['map'](JSON['parse'](process[_0xfe2d('0x70')][0x4]),'id');}catch(_0x4fdb01){logger['info'](_0xfe2d('0x78'));}main(_0x5cd6c,_0x4db894,_0x658832,_0x5080dc);}validate();process['on']('SIGINT',handleStop);process['on']('uncaughtException',handleUncaughtException);
\ No newline at end of file
index 73ed350..65354cd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['toLowerCase','inbound','push','variable','calleridnum','string','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','talktime','outbound','Member\x20Name','membername','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','getSubjects','[xCALLY\x20Ticket]','voice'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';exports[_0x0a9e('0x0')]=function(_0x948b6c,_0x29929c){var _0x5dd881=[{'type':'string','content':_0x0a9e('0x1'),'variableName':null}];switch(_0x948b6c['toLowerCase']()){case _0x0a9e('0x2'):switch(_0x29929c[_0x0a9e('0x3')]()){case _0x0a9e('0x4'):_0x5dd881[_0x0a9e('0x5')]({'type':_0x0a9e('0x6'),'content':'','variableName':'queue'});_0x5dd881[_0x0a9e('0x5')]({'type':_0x0a9e('0x6'),'content':'','variableName':_0x0a9e('0x7')});break;case'outbound':_0x5dd881['push']({'type':_0x0a9e('0x8'),'content':'Outbound\x20Call','variableName':null});_0x5dd881['push']({'type':_0x0a9e('0x6'),'content':'','variableName':_0x0a9e('0x9')});break;}}return _0x5dd881;};exports[_0x0a9e('0xa')]=function(_0x3ab53f,_0xfeb75b){var _0xbd1168=[];switch(_0x3ab53f['toLowerCase']()){case'voice':switch(_0xfeb75b['toLowerCase']()){case'inbound':_0xbd1168=[{'type':_0x0a9e('0x8'),'content':_0x0a9e('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0x0a9e('0xc'),'content':'','key':_0x0a9e('0xd'),'keyType':_0x0a9e('0x6'),'variableName':_0x0a9e('0x7')},{'type':'keyValue','content':'','key':_0x0a9e('0xe'),'keyType':_0x0a9e('0x6'),'variableName':_0x0a9e('0xf')},{'type':_0x0a9e('0xc'),'content':'','key':_0x0a9e('0x10'),'keyType':_0x0a9e('0x6'),'variableName':'destexten'},{'type':_0x0a9e('0xc'),'content':'','key':'Queue','keyType':_0x0a9e('0x6'),'variableName':'queue'},{'type':_0x0a9e('0xc'),'content':'','key':_0x0a9e('0x11'),'keyType':'variable','variableName':_0x0a9e('0x12')},{'type':'keyValue','content':'','key':_0x0a9e('0x13'),'keyType':_0x0a9e('0x6'),'variableName':_0x0a9e('0x14')},{'type':_0x0a9e('0x8'),'content':_0x0a9e('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0x0a9e('0xc'),'content':'','key':_0x0a9e('0x16'),'keyType':_0x0a9e('0x6'),'variableName':_0x0a9e('0x17')},{'type':_0x0a9e('0xc'),'content':'','key':_0x0a9e('0x18'),'keyType':_0x0a9e('0x6'),'variableName':'destcalleridnum'},{'type':_0x0a9e('0x8'),'content':_0x0a9e('0x19'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x0a9e('0x1a'),'keyType':'variable','variableName':'agentcalledAt'},{'type':_0x0a9e('0xc'),'content':'','key':_0x0a9e('0x1b'),'keyType':_0x0a9e('0x6'),'variableName':_0x0a9e('0x1c')},{'type':'keyValue','content':'','key':_0x0a9e('0x1d'),'keyType':_0x0a9e('0x6'),'variableName':_0x0a9e('0x1e')},{'type':_0x0a9e('0xc'),'content':'','key':_0x0a9e('0x1f'),'keyType':_0x0a9e('0x6'),'variableName':_0x0a9e('0x20')},{'type':'keyValue','content':'','key':'Talk\x20Time','keyType':_0x0a9e('0x6'),'variableName':_0x0a9e('0x21')}];break;case _0x0a9e('0x22'):_0xbd1168=[{'type':_0x0a9e('0x8'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x0a9e('0xc'),'content':'','key':'Called\x20Number','keyType':_0x0a9e('0x6'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0x0a9e('0xc'),'content':'','key':_0x0a9e('0x23'),'keyType':_0x0a9e('0x6'),'keyContent':'','variableName':_0x0a9e('0x24')},{'type':_0x0a9e('0xc'),'content':'','key':_0x0a9e('0x11'),'keyType':_0x0a9e('0x6'),'keyContent':'','variableName':_0x0a9e('0x12')},{'type':'keyValue','content':'','key':_0x0a9e('0x13'),'keyType':_0x0a9e('0x6'),'keyContent':'','variableName':_0x0a9e('0x25')},{'type':_0x0a9e('0x8'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x0a9e('0xc'),'content':'','key':_0x0a9e('0x26'),'keyType':_0x0a9e('0x6'),'keyContent':'','variableName':_0x0a9e('0x27')},{'type':_0x0a9e('0xc'),'content':'','key':_0x0a9e('0x28'),'keyType':_0x0a9e('0x6'),'keyContent':'','variableName':_0x0a9e('0x29')}];break;}}return _0xbd1168;};
\ No newline at end of file
+var _0x5636=['Hold\x20Time','holdtime','Talk\x20Time','Member\x20Name','membername','UniqueId','uniqueid','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','getSubjects','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','calleridnum','outbound','string','Outbound\x20Call','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Call\x20To','destexten','Queue','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt','Agent\x20Connect','Agent\x20Complete','agentcompleteAt'];(function(_0x52121d,_0x1d1704){var _0x448627=function(_0x495bf0){while(--_0x495bf0){_0x52121d['push'](_0x52121d['shift']());}};_0x448627(++_0x1d1704);}(_0x5636,0x102));var _0x6563=function(_0x1e4e87,_0x448fb3){_0x1e4e87=_0x1e4e87-0x0;var _0x4bcb72=_0x5636[_0x1e4e87];return _0x4bcb72;};'use strict';exports[_0x6563('0x0')]=function(_0x8c30f6,_0x492943){var _0x4ab349=[{'type':'string','content':_0x6563('0x1'),'variableName':null}];switch(_0x8c30f6[_0x6563('0x2')]()){case _0x6563('0x3'):switch(_0x492943['toLowerCase']()){case _0x6563('0x4'):_0x4ab349[_0x6563('0x5')]({'type':_0x6563('0x6'),'content':'','variableName':_0x6563('0x7')});_0x4ab349[_0x6563('0x5')]({'type':_0x6563('0x6'),'content':'','variableName':_0x6563('0x8')});break;case _0x6563('0x9'):_0x4ab349[_0x6563('0x5')]({'type':_0x6563('0xa'),'content':_0x6563('0xb'),'variableName':null});_0x4ab349[_0x6563('0x5')]({'type':_0x6563('0x6'),'content':'','variableName':'destcalleridnum'});break;}}return _0x4ab349;};exports['getDescriptions']=function(_0x2946f3,_0x129fa3){var _0x490a56=[];switch(_0x2946f3['toLowerCase']()){case'voice':switch(_0x129fa3[_0x6563('0x2')]()){case _0x6563('0x4'):_0x490a56=[{'type':_0x6563('0xa'),'content':_0x6563('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x6563('0xd'),'content':'','key':_0x6563('0xe'),'keyType':_0x6563('0x6'),'variableName':_0x6563('0x8')},{'type':_0x6563('0xd'),'content':'','key':'Caller\x20Name','keyType':_0x6563('0x6'),'variableName':'calleridname'},{'type':_0x6563('0xd'),'content':'','key':_0x6563('0xf'),'keyType':_0x6563('0x6'),'variableName':_0x6563('0x10')},{'type':'keyValue','content':'','key':_0x6563('0x11'),'keyType':_0x6563('0x6'),'variableName':_0x6563('0x7')},{'type':_0x6563('0xd'),'content':'','key':'UniqueId','keyType':_0x6563('0x6'),'variableName':'uniqueid'},{'type':'keyValue','content':'','key':'Date','keyType':_0x6563('0x6'),'variableName':'agentcalledAt'},{'type':'string','content':_0x6563('0x12'),'key':null,'keyType':null,'variableName':null},{'type':_0x6563('0xd'),'content':'','key':_0x6563('0x13'),'keyType':_0x6563('0x6'),'variableName':_0x6563('0x14')},{'type':_0x6563('0xd'),'content':'','key':_0x6563('0x15'),'keyType':_0x6563('0x6'),'variableName':_0x6563('0x16')},{'type':'string','content':_0x6563('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0x6563('0xd'),'content':'','key':_0x6563('0x18'),'keyType':'variable','variableName':_0x6563('0x19')},{'type':'keyValue','content':'','key':_0x6563('0x1a'),'keyType':_0x6563('0x6'),'variableName':'agentconnectAt'},{'type':'keyValue','content':'','key':_0x6563('0x1b'),'keyType':'variable','variableName':_0x6563('0x1c')},{'type':_0x6563('0xd'),'content':'','key':_0x6563('0x1d'),'keyType':'variable','variableName':_0x6563('0x1e')},{'type':'keyValue','content':'','key':_0x6563('0x1f'),'keyType':_0x6563('0x6'),'variableName':'talktime'}];break;case _0x6563('0x9'):_0x490a56=[{'type':_0x6563('0xa'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x6563('0xd'),'content':'','key':'Called\x20Number','keyType':_0x6563('0x6'),'keyContent':'','variableName':'destcalleridnum'},{'type':'keyValue','content':'','key':_0x6563('0x20'),'keyType':_0x6563('0x6'),'keyContent':'','variableName':_0x6563('0x21')},{'type':_0x6563('0xd'),'content':'','key':_0x6563('0x22'),'keyType':'variable','keyContent':'','variableName':_0x6563('0x23')},{'type':'keyValue','content':'','key':'Date','keyType':_0x6563('0x6'),'keyContent':'','variableName':_0x6563('0x24')},{'type':_0x6563('0xa'),'content':_0x6563('0x17')},{'type':_0x6563('0xd'),'content':'','key':_0x6563('0x25'),'keyType':_0x6563('0x6'),'keyContent':'','variableName':_0x6563('0x26')},{'type':_0x6563('0xd'),'content':'','key':_0x6563('0x27'),'keyType':'variable','keyContent':'','variableName':_0x6563('0x28')}];break;}}return _0x490a56;};
\ No newline at end of file
index 70807fe..7028aeb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfd75=['phone','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','upperFirst','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','Interaction','then','info','catch','tracked','user','query','clone','body','omit','html'];(function(_0x28ade9,_0x1596bf){var _0x124832=function(_0x171b9e){while(--_0x171b9e){_0x28ade9['push'](_0x28ade9['shift']());}};_0x124832(++_0x1596bf);}(_0xfd75,0x12b));var _0x5fd7=function(_0x45be7a,_0x150ca7){_0x45be7a=_0x45be7a-0x0;var _0x4a9234=_0xfd75[_0x45be7a];return _0x4a9234;};'use strict';var _=require(_0x5fd7('0x0'));var db=require(_0x5fd7('0x1'))['db'];var loggers={'openchannel':require(_0x5fd7('0x2'))(_0x5fd7('0x3')),'mail':require(_0x5fd7('0x2'))(_0x5fd7('0x4')),'fax':require(_0x5fd7('0x2'))(_0x5fd7('0x5')),'sms':require('../../config/logger')(_0x5fd7('0x6')),'chat':require('../../config/logger')(_0x5fd7('0x7'))};function getInteractionId(_0x192421,_0x2c720b,_0x59912a){if(_0x192421&&_0x192421[_[_0x5fd7('0x8')](_0x59912a)+'InteractionId']){return _0x192421[_['upperFirst'](_0x59912a)+'InteractionId'];}else if(_0x192421&&_0x192421['id']){return _0x192421['id'];}else if(_0x2c720b&&_0x2c720b['id']){return _0x2c720b['id'];}else{return _0x5fd7('0x9');}}function log(_0x2f5916,_0x402c64,_0x1b0317,_0x38343e,_0x15306c,_0x2c2bbc){loggers[_0x15306c[_0x5fd7('0xa')]()][_0x2f5916](_0x5fd7('0xb'),_0x2c2bbc['toUpperCase'](),_0x402c64?_0x402c64['id']:null,_0x402c64?_0x402c64[_0x5fd7('0xc')]:null,_0x402c64?_0x402c64[_0x5fd7('0xd')]:null,getInteractionId(_0x1b0317,_0x38343e,_0x15306c),_0x1b0317?JSON['stringify'](_0x1b0317):'null');}function updateUser(_0x4f4ef9,_0x5da92a,_0x53c193,_0x5297d5,_0x3b5a8d){db[_['upperFirst'](_0x5297d5)+_0x5fd7('0xe')]['findOne']({'where':{'id':getInteractionId(_0x5da92a,_0x53c193,_0x5297d5)}})[_0x5fd7('0xf')](function(_0x4b73fa){if(_0x4b73fa){return _0x4b73fa['update']({'UserId':_0x4f4ef9?_0x4f4ef9['id']:null});}})[_0x5fd7('0xf')](function(_0x3bda7b){if(_0x3bda7b){log(_0x5fd7('0x10'),_0x4f4ef9,_0x5da92a,_0x53c193,_0x5297d5,_0x3b5a8d);}})[_0x5fd7('0x11')](function(){log('error',_0x4f4ef9,_0x5da92a,_0x53c193,_0x5297d5,_0x3b5a8d);});}exports[_0x5fd7('0x12')]=function(_0xca6437,_0x288ef2){return function(_0xcc9c1c,_0x5b2d7c,_0x12fead){var _0x47ce03=_0xcc9c1c[_0x5fd7('0x13')];var _0xe8594={};var _0x4d3f8f=_0xcc9c1c[_0x5fd7('0x14')];if(_0xe8594){_0xe8594=_[_0x5fd7('0x15')](_0xcc9c1c[_0x5fd7('0x16')]);_0xe8594=_[_0x5fd7('0x17')](_0xe8594,[_0x5fd7('0x16'),_0x5fd7('0x18'),_0x5fd7('0x19'),'fax',_0x5fd7('0x1a')]);}updateUser(_0x47ce03,_0xe8594,_0x4d3f8f,_0xca6437,_0x288ef2);_0x12fead(null);};};
\ No newline at end of file
+var _0x93a6=['fax','lodash','../../config/logger','mail-interactions','sms-interactions','chat-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','then','catch','error','tracked','user','clone','body','phone'];(function(_0xc858dc,_0x22d2a8){var _0x26679c=function(_0x28e32e){while(--_0x28e32e){_0xc858dc['push'](_0xc858dc['shift']());}};_0x26679c(++_0x22d2a8);}(_0x93a6,0x65));var _0x693a=function(_0x3f3f40,_0x4e745f){_0x3f3f40=_0x3f3f40-0x0;var _0x32c366=_0x93a6[_0x3f3f40];return _0x32c366;};'use strict';var _=require(_0x693a('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x693a('0x1'))('openchannel-interactions'),'mail':require(_0x693a('0x1'))(_0x693a('0x2')),'fax':require(_0x693a('0x1'))('fax-interactions'),'sms':require('../../config/logger')(_0x693a('0x3')),'chat':require(_0x693a('0x1'))(_0x693a('0x4'))};function getInteractionId(_0x24a06e,_0x475948,_0x20871f){if(_0x24a06e&&_0x24a06e[_[_0x693a('0x5')](_0x20871f)+_0x693a('0x6')]){return _0x24a06e[_[_0x693a('0x5')](_0x20871f)+_0x693a('0x6')];}else if(_0x24a06e&&_0x24a06e['id']){return _0x24a06e['id'];}else if(_0x475948&&_0x475948['id']){return _0x475948['id'];}else{return _0x693a('0x7');}}function log(_0x1e96c8,_0x2d4d78,_0x340b33,_0x2acdfb,_0x3b6379,_0x3342f5){loggers[_0x3b6379[_0x693a('0x8')]()][_0x1e96c8](_0x693a('0x9'),_0x3342f5[_0x693a('0xa')](),_0x2d4d78?_0x2d4d78['id']:null,_0x2d4d78?_0x2d4d78[_0x693a('0xb')]:null,_0x2d4d78?_0x2d4d78[_0x693a('0xc')]:null,getInteractionId(_0x340b33,_0x2acdfb,_0x3b6379),_0x340b33?JSON[_0x693a('0xd')](_0x340b33):_0x693a('0xe'));}function updateUser(_0x3473be,_0x578810,_0xa151a,_0x5b3d66,_0x8e4725){db[_[_0x693a('0x5')](_0x5b3d66)+_0x693a('0xf')]['findOne']({'where':{'id':getInteractionId(_0x578810,_0xa151a,_0x5b3d66)}})[_0x693a('0x10')](function(_0x352132){if(_0x352132){return _0x352132['update']({'UserId':_0x3473be?_0x3473be['id']:null});}})['then'](function(_0x2e0939){if(_0x2e0939){log('info',_0x3473be,_0x578810,_0xa151a,_0x5b3d66,_0x8e4725);}})[_0x693a('0x11')](function(){log(_0x693a('0x12'),_0x3473be,_0x578810,_0xa151a,_0x5b3d66,_0x8e4725);});}exports[_0x693a('0x13')]=function(_0x46f419,_0x2d05c3){return function(_0xb83fcc,_0x25bb86,_0x8c9c99){var _0x45263a=_0xb83fcc[_0x693a('0x14')];var _0x8c32d9={};var _0x2df0b8=_0xb83fcc['query'];if(_0x8c32d9){_0x8c32d9=_[_0x693a('0x15')](_0xb83fcc[_0x693a('0x16')]);_0x8c32d9=_['omit'](_0x8c32d9,[_0x693a('0x16'),'html',_0x693a('0x17'),_0x693a('0x18'),'mobile']);}updateUser(_0x45263a,_0x8c32d9,_0x2df0b8,_0x46f419,_0x2d05c3);_0x8c9c99(null);};};
\ No newline at end of file
index 0b66548..2f0c326 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8ad3=['hasOwnProperty','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse'];(function(_0x454fe2,_0x2a082b){var _0x3d6157=function(_0x1bf6b0){while(--_0x1bf6b0){_0x454fe2['push'](_0x454fe2['shift']());}};_0x3d6157(++_0x2a082b);}(_0x8ad3,0xe8));var _0x38ad=function(_0x1e6599,_0x2bd717){_0x1e6599=_0x1e6599-0x0;var _0x132b01=_0x8ad3[_0x1e6599];return _0x132b01;};'use strict';var crypto=require(_0x38ad('0x0'));var util=require('util');var compose=require(_0x38ad('0x1'));var db=require(_0x38ad('0x2'))['db'];var config=require(_0x38ad('0x3'));function getValueFromLicense(_0x540d8c,_0x4fe1e9){if(_0x540d8c&&_0x4fe1e9){if(_0x4fe1e9['data1']&&_0x4fe1e9['license']){var _0x4ce30a=_0x4fe1e9[_0x38ad('0x4')];var _0x5840f5=_0x4fe1e9[_0x38ad('0x5')];var _0x4c3ac8=_0x4ce30a['split']('-')[0x4];var _0x25d1d1=_0x4ce30a[_0x38ad('0x6')]('-')[0x0];var _0x1fb994=crypto[_0x38ad('0x7')](_0x38ad('0x8'),util[_0x38ad('0x9')](_0x38ad('0xa'),_0x4c3ac8,_0x4ce30a,_0x25d1d1));var _0x201ee5=_0x1fb994[_0x38ad('0xb')](_0x5840f5,_0x38ad('0xc'),_0x38ad('0xd'));_0x201ee5+=_0x1fb994[_0x38ad('0xe')]('utf8');var _0x217eea=JSON[_0x38ad('0xf')](_0x201ee5);return _0x217eea[_0x38ad('0x10')](_0x540d8c)?_0x217eea[_0x540d8c]:null;}}return null;}function isLimit(_0x190bc6,_0x52b74e,_0x18ec09,_0x33e3cb){var _0x566e12=_0x52b74e;return compose()[_0x38ad('0x11')](function(_0x328b5e,_0x26d0f6,_0x214888){return db[_0x38ad('0x12')][_0x38ad('0x13')]({'where':{'id':0x1},'raw':!![]})[_0x38ad('0x14')](function(_0x29c2ae){var _0x138ba4=getValueFromLicense(_0x190bc6,_0x29c2ae);return _0x138ba4?_0x138ba4:_0x566e12;})[_0x38ad('0x14')](function(_0x85cac3){_0x566e12=_0x85cac3;return _0x18ec09[_0x38ad('0x15')](_0x33e3cb);})[_0x38ad('0x14')](function(_0x1436f2){if(_0x1436f2>=_0x566e12){return _0x26d0f6[_0x38ad('0x16')](0x193)[_0x38ad('0x17')]({'message':util['format'](_0x38ad('0x18'),_0x190bc6)});}_0x214888();})[_0x38ad('0x19')](function(_0x373539){_0x214888(_0x373539);});});}function isUserLimit(){return isLimit(_0x38ad('0x1a'),0x1,db[_0x38ad('0x1b')],{'where':{'$or':[{'role':_0x38ad('0x1c')},{'role':_0x38ad('0x1d')}]}});}exports[_0x38ad('0x1e')]=isUserLimit;
\ No newline at end of file
+var _0x4c97=['crypto','util','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','final','parse','hasOwnProperty','use','License','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','user','isUserLimit'];(function(_0x264b79,_0x123658){var _0x4acb21=function(_0x252983){while(--_0x252983){_0x264b79['push'](_0x264b79['shift']());}};_0x4acb21(++_0x123658);}(_0x4c97,0xd0));var _0x74c9=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x4c97[_0xdea41a];return _0x15d0d8;};'use strict';var crypto=require(_0x74c9('0x0'));var util=require(_0x74c9('0x1'));var compose=require('composable-middleware');var db=require(_0x74c9('0x2'))['db'];var config=require(_0x74c9('0x3'));function getValueFromLicense(_0x1cc55f,_0x144da6){if(_0x1cc55f&&_0x144da6){if(_0x144da6[_0x74c9('0x4')]&&_0x144da6[_0x74c9('0x5')]){var _0x30d513=_0x144da6['data1'];var _0x51c54d=_0x144da6['license'];var _0x2b06c5=_0x30d513[_0x74c9('0x6')]('-')[0x4];var _0x4005bd=_0x30d513[_0x74c9('0x6')]('-')[0x0];var _0x485249=crypto[_0x74c9('0x7')](_0x74c9('0x8'),util[_0x74c9('0x9')](_0x74c9('0xa'),_0x2b06c5,_0x30d513,_0x4005bd));var _0x49476e=_0x485249[_0x74c9('0xb')](_0x51c54d,'base64','utf8');_0x49476e+=_0x485249[_0x74c9('0xc')]('utf8');var _0x36dd18=JSON[_0x74c9('0xd')](_0x49476e);return _0x36dd18[_0x74c9('0xe')](_0x1cc55f)?_0x36dd18[_0x1cc55f]:null;}}return null;}function isLimit(_0x1c2a4a,_0x3ca025,_0x2411e1,_0x18c598){var _0x387081=_0x3ca025;return compose()[_0x74c9('0xf')](function(_0x379280,_0x54ca8d,_0x18c796){return db[_0x74c9('0x10')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x4f50f0){var _0xceb0a7=getValueFromLicense(_0x1c2a4a,_0x4f50f0);return _0xceb0a7?_0xceb0a7:_0x387081;})[_0x74c9('0x11')](function(_0x1e92f5){_0x387081=_0x1e92f5;return _0x2411e1[_0x74c9('0x12')](_0x18c598);})['then'](function(_0x32f410){if(_0x32f410>=_0x387081){return _0x54ca8d[_0x74c9('0x13')](0x193)[_0x74c9('0x14')]({'message':util['format'](_0x74c9('0x15'),_0x1c2a4a)});}_0x18c796();})[_0x74c9('0x16')](function(_0xa4aef1){_0x18c796(_0xa4aef1);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x74c9('0x17')],{'where':{'$or':[{'role':'admin'},{'role':_0x74c9('0x18')}]}});}exports[_0x74c9('0x19')]=isUserLimit;
\ No newline at end of file
index 2104632..28baae1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x310f=['unset','hasOwnProperty','split','isEmpty','limit','offset','sort','map','indexOf','cast','substr','col','priority','unsigned','ASC','omit','isArray','isObject','isString','length'];(function(_0x1abca2,_0x444332){var _0x371a55=function(_0x43b34b){while(--_0x43b34b){_0x1abca2['push'](_0x1abca2['shift']());}};_0x371a55(++_0x444332);}(_0x310f,0x17e));var _0xf310=function(_0x2d7a1c,_0x31c057){_0x2d7a1c=_0x2d7a1c-0x0;var _0x1c2e34=_0x310f[_0x2d7a1c];return _0x1c2e34;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var LIMIT_VALUE=0xfa;exports['fields']=function(_0x422182){var _0x43d08a=null;if(_0x422182){_0x43d08a=_0x422182[_0xf310('0x0')](',');}return _0x43d08a;};exports['filters']=function(_0x130018){var _0xae267a={};if(!_[_0xf310('0x1')](_0x130018)){_0xae267a={};_['forOwn'](_0x130018,function(_0x22b9aa,_0x16c2ff){try{_0xae267a[_0x16c2ff]=JSON['parse'](_0x22b9aa);}catch(_0x1e1962){_0xae267a[_0x16c2ff]=_0x22b9aa[_0xf310('0x0')](',');}});}return _0xae267a;};exports[_0xf310('0x2')]=function(_0x2ae2e2){_0x2ae2e2=parseInt(_0x2ae2e2,0xa);if(!_0x2ae2e2||_0x2ae2e2<0x0){_0x2ae2e2=LIMIT_VALUE;}return _0x2ae2e2;};exports[_0xf310('0x3')]=function(_0x181102){_0x181102=parseInt(_0x181102,0xa);if(!_0x181102||_0x181102<0x0){_0x181102=0x0;}return _0x181102;};exports[_0xf310('0x4')]=function(_0xa82ebc){var _0x355987,_0x35699d=null;if(_0xa82ebc){_0x355987=_0xa82ebc[_0xf310('0x0')](',');_0x35699d=_[_0xf310('0x5')](_0x355987,function(_0x482996){if(_0x482996[_0xf310('0x6')]('-')===0x0){return[_0x482996==='priority'?sequelize[_0xf310('0x7')](sequelize['col']('priority'),'unsigned'):_0x482996[_0xf310('0x8')](0x1),'DESC'];}else{return[_0x482996==='priority'?sequelize[_0xf310('0x7')](sequelize[_0xf310('0x9')](_0xf310('0xa')),_0xf310('0xb')):_0x482996,_0xf310('0xc')];}});}return _0x35699d;};exports[_0xf310('0xd')]=function(_0x4d0686,_0x41a4b1){if(_['isEmpty'](_0x4d0686)){return _0x4d0686;}if(_[_0xf310('0xe')](_0x4d0686)){for(var _0x518d72=0x0;_0x518d72<_0x4d0686['length'];_0x518d72+=0x1){_0x4d0686[_0x518d72]=this[_0xf310('0xd')](_0x4d0686[_0x518d72],_0x41a4b1);}return _0x4d0686;}if(!_[_0xf310('0xf')](_0x4d0686)){return _0x4d0686;}if(_[_0xf310('0x10')](_0x41a4b1)){_0x41a4b1=[_0x41a4b1];}if(!_[_0xf310('0xe')](_0x41a4b1)){return _0x4d0686;}for(var _0x30932e=0x0;_0x30932e<_0x41a4b1[_0xf310('0x11')];_0x30932e+=0x1){_[_0xf310('0x12')](_0x4d0686,_0x41a4b1[_0x30932e]);}for(var _0x15b89c in _0x4d0686){if(_0x4d0686[_0xf310('0x13')](_0x15b89c)){_0x4d0686[_0x15b89c]=this[_0xf310('0xd')](_0x4d0686[_0x15b89c],_0x41a4b1);}}return _0x4d0686;};
\ No newline at end of file
+var _0x0e98=['filters','isEmpty','forOwn','parse','offset','sort','map','indexOf','priority','col','unsigned','substr','cast','ASC','omit','isArray','length','isObject','unset','hasOwnProperty','sequelize','fields','split'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x0e98,0xcc));var _0x80e9=function(_0x7c143,_0x5120a4){_0x7c143=_0x7c143-0x0;var _0x1acb69=_0x0e98[_0x7c143];return _0x1acb69;};'use strict';var _=require('lodash');var sequelize=require(_0x80e9('0x0'));var LIMIT_VALUE=0xfa;exports[_0x80e9('0x1')]=function(_0x5be396){var _0x3cc5ef=null;if(_0x5be396){_0x3cc5ef=_0x5be396[_0x80e9('0x2')](',');}return _0x3cc5ef;};exports[_0x80e9('0x3')]=function(_0x1442d5){var _0x2857f6={};if(!_[_0x80e9('0x4')](_0x1442d5)){_0x2857f6={};_[_0x80e9('0x5')](_0x1442d5,function(_0x4865aa,_0x53be0f){try{_0x2857f6[_0x53be0f]=JSON[_0x80e9('0x6')](_0x4865aa);}catch(_0x22aaf6){_0x2857f6[_0x53be0f]=_0x4865aa[_0x80e9('0x2')](',');}});}return _0x2857f6;};exports['limit']=function(_0x15e994){_0x15e994=parseInt(_0x15e994,0xa);if(!_0x15e994||_0x15e994<0x0){_0x15e994=LIMIT_VALUE;}return _0x15e994;};exports[_0x80e9('0x7')]=function(_0x2e0ef4){_0x2e0ef4=parseInt(_0x2e0ef4,0xa);if(!_0x2e0ef4||_0x2e0ef4<0x0){_0x2e0ef4=0x0;}return _0x2e0ef4;};exports[_0x80e9('0x8')]=function(_0x151191){var _0x28f6f0,_0x65ba46=null;if(_0x151191){_0x28f6f0=_0x151191['split'](',');_0x65ba46=_[_0x80e9('0x9')](_0x28f6f0,function(_0x3acb74){if(_0x3acb74[_0x80e9('0xa')]('-')===0x0){return[_0x3acb74===_0x80e9('0xb')?sequelize['cast'](sequelize[_0x80e9('0xc')](_0x80e9('0xb')),_0x80e9('0xd')):_0x3acb74[_0x80e9('0xe')](0x1),'DESC'];}else{return[_0x3acb74==='priority'?sequelize[_0x80e9('0xf')](sequelize['col'](_0x80e9('0xb')),'unsigned'):_0x3acb74,_0x80e9('0x10')];}});}return _0x65ba46;};exports[_0x80e9('0x11')]=function(_0x1c2637,_0x23132e){if(_[_0x80e9('0x4')](_0x1c2637)){return _0x1c2637;}if(_[_0x80e9('0x12')](_0x1c2637)){for(var _0x5d4021=0x0;_0x5d4021<_0x1c2637[_0x80e9('0x13')];_0x5d4021+=0x1){_0x1c2637[_0x5d4021]=this[_0x80e9('0x11')](_0x1c2637[_0x5d4021],_0x23132e);}return _0x1c2637;}if(!_[_0x80e9('0x14')](_0x1c2637)){return _0x1c2637;}if(_['isString'](_0x23132e)){_0x23132e=[_0x23132e];}if(!_[_0x80e9('0x12')](_0x23132e)){return _0x1c2637;}for(var _0x3a7270=0x0;_0x3a7270<_0x23132e[_0x80e9('0x13')];_0x3a7270+=0x1){_[_0x80e9('0x15')](_0x1c2637,_0x23132e[_0x3a7270]);}for(var _0x12875c in _0x1c2637){if(_0x1c2637[_0x80e9('0x16')](_0x12875c)){_0x1c2637[_0x12875c]=this[_0x80e9('0x11')](_0x1c2637[_0x12875c],_0x23132e);}}return _0x1c2637;};
\ No newline at end of file
index d9d4b04..11792ca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9c44=['appPath','development','favicon.ico','set','client','json\x20replacer','split','static','views','html','ejs','renderFile','view\x20engine','urlencoded','50mb','json','body-parser','method-override','cookie-parser','errorhandler','path','passport','./environment','default','get','env','use','join','root','public'];(function(_0x2dc5b7,_0x3837ba){var _0x4edb5b=function(_0x3ed644){while(--_0x3ed644){_0x2dc5b7['push'](_0x2dc5b7['shift']());}};_0x4edb5b(++_0x3837ba);}(_0x9c44,0x178));var _0x49c4=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9c44[_0x13b02f];return _0x12e9a6;};'use strict';var express=require('express');var favicon=require('serve-favicon');var bodyParser=require(_0x49c4('0x0'));var methodOverride=require(_0x49c4('0x1'));var cookieParser=require(_0x49c4('0x2'));var errorHandler=require(_0x49c4('0x3'));var path=require(_0x49c4('0x4'));var passport=require(_0x49c4('0x5'));var cors=require('cors');var moment=require('moment');var config=require(_0x49c4('0x6'));var db=require('../mysqldb')['db'];exports[_0x49c4('0x7')]=function(_0x6030ae){var _0x69bc41=_0x6030ae[_0x49c4('0x8')](_0x49c4('0x9'));if(_0x69bc41==='production'){_0x6030ae[_0x49c4('0xa')](favicon(path[_0x49c4('0xb')](config[_0x49c4('0xc')],_0x49c4('0xd'),'favicon.ico')));_0x6030ae['set'](_0x49c4('0xe'),path[_0x49c4('0xb')](config['root'],_0x49c4('0xd')));}if(_0x69bc41===_0x49c4('0xf')||_0x69bc41==='test'){_0x6030ae['use'](favicon(path[_0x49c4('0xb')](config[_0x49c4('0xc')],'client',_0x49c4('0x10'))));_0x6030ae[_0x49c4('0x11')]('appPath',path[_0x49c4('0xb')](config[_0x49c4('0xc')],_0x49c4('0x12')));_0x6030ae[_0x49c4('0xa')](errorHandler());}_0x6030ae[_0x49c4('0x11')](_0x49c4('0x13'),function(_0x75ea8,_0x3de397){if(this[_0x75ea8]instanceof Date){_0x3de397=this[_0x75ea8]['toISOString']()[_0x49c4('0x14')]('.')[0x0]+'Z';}return _0x3de397;});_0x6030ae[_0x49c4('0xa')](express[_0x49c4('0x15')](_0x6030ae[_0x49c4('0x8')](_0x49c4('0xe'))));_0x6030ae['set'](_0x49c4('0x16'),config[_0x49c4('0xc')]+'/server/views');_0x6030ae['engine'](_0x49c4('0x17'),require(_0x49c4('0x18'))[_0x49c4('0x19')]);_0x6030ae['set'](_0x49c4('0x1a'),'html');_0x6030ae[_0x49c4('0xa')](bodyParser[_0x49c4('0x1b')]({'limit':_0x49c4('0x1c'),'extended':!![]}));_0x6030ae[_0x49c4('0xa')](bodyParser[_0x49c4('0x1d')]({'limit':_0x49c4('0x1c')}));_0x6030ae[_0x49c4('0xa')](cors());_0x6030ae[_0x49c4('0xa')](methodOverride());_0x6030ae[_0x49c4('0xa')](cookieParser());_0x6030ae['use'](passport['initialize']());};
\ No newline at end of file
+var _0x34e8=['passport','cors','moment','./environment','../mysqldb','get','env','production','use','join','root','public','favicon.ico','set','appPath','development','test','client','json\x20replacer','split','/server/views','engine','html','ejs','renderFile','urlencoded','50mb','json','express','serve-favicon','body-parser','method-override','errorhandler','path'];(function(_0x36f47c,_0x38ef4d){var _0x296c55=function(_0x403eec){while(--_0x403eec){_0x36f47c['push'](_0x36f47c['shift']());}};_0x296c55(++_0x38ef4d);}(_0x34e8,0x12c));var _0x834e=function(_0x313818,_0x16faf9){_0x313818=_0x313818-0x0;var _0x1fa8fa=_0x34e8[_0x313818];return _0x1fa8fa;};'use strict';var express=require(_0x834e('0x0'));var favicon=require(_0x834e('0x1'));var bodyParser=require(_0x834e('0x2'));var methodOverride=require(_0x834e('0x3'));var cookieParser=require('cookie-parser');var errorHandler=require(_0x834e('0x4'));var path=require(_0x834e('0x5'));var passport=require(_0x834e('0x6'));var cors=require(_0x834e('0x7'));var moment=require(_0x834e('0x8'));var config=require(_0x834e('0x9'));var db=require(_0x834e('0xa'))['db'];exports['default']=function(_0x858aa1){var _0x52056d=_0x858aa1[_0x834e('0xb')](_0x834e('0xc'));if(_0x52056d===_0x834e('0xd')){_0x858aa1[_0x834e('0xe')](favicon(path[_0x834e('0xf')](config[_0x834e('0x10')],_0x834e('0x11'),_0x834e('0x12'))));_0x858aa1[_0x834e('0x13')](_0x834e('0x14'),path[_0x834e('0xf')](config[_0x834e('0x10')],_0x834e('0x11')));}if(_0x52056d===_0x834e('0x15')||_0x52056d===_0x834e('0x16')){_0x858aa1[_0x834e('0xe')](favicon(path[_0x834e('0xf')](config['root'],_0x834e('0x17'),_0x834e('0x12'))));_0x858aa1['set'](_0x834e('0x14'),path[_0x834e('0xf')](config[_0x834e('0x10')],_0x834e('0x17')));_0x858aa1['use'](errorHandler());}_0x858aa1[_0x834e('0x13')](_0x834e('0x18'),function(_0x57274a,_0x316205){if(this[_0x57274a]instanceof Date){_0x316205=this[_0x57274a]['toISOString']()[_0x834e('0x19')]('.')[0x0]+'Z';}return _0x316205;});_0x858aa1[_0x834e('0xe')](express['static'](_0x858aa1[_0x834e('0xb')](_0x834e('0x14'))));_0x858aa1[_0x834e('0x13')]('views',config[_0x834e('0x10')]+_0x834e('0x1a'));_0x858aa1[_0x834e('0x1b')](_0x834e('0x1c'),require(_0x834e('0x1d'))[_0x834e('0x1e')]);_0x858aa1[_0x834e('0x13')]('view\x20engine',_0x834e('0x1c'));_0x858aa1[_0x834e('0xe')](bodyParser[_0x834e('0x1f')]({'limit':_0x834e('0x20'),'extended':!![]}));_0x858aa1['use'](bodyParser[_0x834e('0x21')]({'limit':_0x834e('0x20')}));_0x858aa1['use'](cors());_0x858aa1[_0x834e('0xe')](methodOverride());_0x858aa1[_0x834e('0xe')](cookieParser());_0x858aa1[_0x834e('0xe')](passport['initialize']());};
\ No newline at end of file
index 32035d5..d135ed6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd694=['digest','getUuid','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','hex','substring','lodash','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','length','filter','IPv4','concat','head','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd694,0x11b));var _0x4d69=function(_0x4ac24c,_0x2791b9){_0x4ac24c=_0x4ac24c-0x0;var _0x3961b0=_0xd694[_0x4ac24c];return _0x3961b0;};'use strict';var _=require(_0x4d69('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x4d69('0x1'));var exec=require(_0x4d69('0x2'))[_0x4d69('0x3')];function getInterfaces(){var _0x25a783=[];var _0x49042c=os[_0x4d69('0x4')]();var _0x49b1d8=_[_0x4d69('0x5')](_[_0x4d69('0x6')](_0x49042c));for(var _0x5ba6c1=0x0;_0x5ba6c1<_0x49b1d8[_0x4d69('0x7')];_0x5ba6c1++){var _0x3e4906=_0x49042c[_0x49b1d8[_0x5ba6c1]][_0x4d69('0x8')](function(_0x27cb5b){return _0x27cb5b['family']===_0x4d69('0x9')&&_0x27cb5b['internal']===![];});_0x25a783=_0x25a783[_0x4d69('0xa')](_0x3e4906);}return _0x25a783;}function getFirstInterface(){var _0xda5704=_[_0x4d69('0xb')](getInterfaces());return{'macAddress':_0xda5704&&_0xda5704['mac']?_0xda5704['mac']:_0x4d69('0xc'),'ipAddress':_0xda5704&&_0xda5704[_0x4d69('0xd')]?_0xda5704[_0x4d69('0xd')]:_0x4d69('0xe')};}exports[_0x4d69('0xf')]=getFirstInterface;function getCPUhash(){var _0x1f22f1=_[_0x4d69('0x5')](os[_0x4d69('0x10')]()[_0x4d69('0x11')](function(_0x5e7321){return _0x5e7321[_0x4d69('0x12')];}))[_0x4d69('0x13')](':');return crypto[_0x4d69('0x14')](_0x4d69('0x15'))[_0x4d69('0x16')](_0x1f22f1)[_0x4d69('0x17')]('hex');}exports[_0x4d69('0x18')]=function(){switch(os['platform']()){case _0x4d69('0x19'):return exec(_0x4d69('0x1a'),{'encoding':_0x4d69('0x1b')})[_0x4d69('0x1c')]('\x0d\x0a','');default:var _0x33ca9b=getFirstInterface();var _0x4bc693=getCPUhash();var _0x190940=_0x4bc693+'|'+os[_0x4d69('0x1d')]()+'|'+_0x33ca9b[_0x4d69('0x1e')]+'|'+_0x33ca9b[_0x4d69('0x1f')];var _0x29bd12=crypto[_0x4d69('0x14')](_0x4d69('0x15'))[_0x4d69('0x16')](_0x190940)[_0x4d69('0x17')](_0x4d69('0x20'));return _0x29bd12[_0x4d69('0x21')](0x0,0x8)+'-'+_0x29bd12['substring'](0x8,0xc)+'-'+_0x29bd12[_0x4d69('0x21')](0xc,0x10)+'-'+_0x29bd12[_0x4d69('0x21')](0x10,0x14)+'-'+_0x29bd12['substring'](0x14);}};
\ No newline at end of file
+var _0x7288=['join','createHash','md5','update','hex','getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','replace','hostname','macAddress','digest','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','length','filter','family','IPv4','concat','head','00:00:00:00:00:00','address','127.0.0.1','orderBy','cpus','model'];(function(_0x46c848,_0x32e87d){var _0x37af01=function(_0x1e4aeb){while(--_0x1e4aeb){_0x46c848['push'](_0x46c848['shift']());}};_0x37af01(++_0x32e87d);}(_0x7288,0x144));var _0x8728=function(_0x34916d,_0x247aa9){_0x34916d=_0x34916d-0x0;var _0x1a7495=_0x7288[_0x34916d];return _0x1a7495;};'use strict';var _=require(_0x8728('0x0'));var os=require('os');var crypto=require(_0x8728('0x1'));var machine=require(_0x8728('0x2'));var exec=require(_0x8728('0x3'))[_0x8728('0x4')];function getInterfaces(){var _0x57ddc3=[];var _0x2eaada=os['networkInterfaces']();var _0x1c0981=_['orderBy'](_['keys'](_0x2eaada));for(var _0x1a338c=0x0;_0x1a338c<_0x1c0981[_0x8728('0x5')];_0x1a338c++){var _0x31914d=_0x2eaada[_0x1c0981[_0x1a338c]][_0x8728('0x6')](function(_0x56146d){return _0x56146d[_0x8728('0x7')]===_0x8728('0x8')&&_0x56146d['internal']===![];});_0x57ddc3=_0x57ddc3[_0x8728('0x9')](_0x31914d);}return _0x57ddc3;}function getFirstInterface(){var _0x31158a=_[_0x8728('0xa')](getInterfaces());return{'macAddress':_0x31158a&&_0x31158a['mac']?_0x31158a['mac']:_0x8728('0xb'),'ipAddress':_0x31158a&&_0x31158a[_0x8728('0xc')]?_0x31158a[_0x8728('0xc')]:_0x8728('0xd')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x290e9c=_[_0x8728('0xe')](os[_0x8728('0xf')]()['map'](function(_0x219cbd){return _0x219cbd[_0x8728('0x10')];}))[_0x8728('0x11')](':');return crypto[_0x8728('0x12')](_0x8728('0x13'))[_0x8728('0x14')](_0x290e9c)['digest'](_0x8728('0x15'));}exports[_0x8728('0x16')]=function(){switch(os[_0x8728('0x17')]()){case _0x8728('0x18'):return exec(_0x8728('0x19'),{'encoding':'utf8'})[_0x8728('0x1a')]('\x0d\x0a','');default:var _0x27b91d=getFirstInterface();var _0x11f9e3=getCPUhash();var _0x50c985=_0x11f9e3+'|'+os[_0x8728('0x1b')]()+'|'+_0x27b91d[_0x8728('0x1c')]+'|'+_0x27b91d['ipAddress'];var _0x486825=crypto[_0x8728('0x12')](_0x8728('0x13'))[_0x8728('0x14')](_0x50c985)[_0x8728('0x1d')](_0x8728('0x15'));return _0x486825[_0x8728('0x1e')](0x0,0x8)+'-'+_0x486825[_0x8728('0x1e')](0x8,0xc)+'-'+_0x486825[_0x8728('0x1e')](0xc,0x10)+'-'+_0x486825[_0x8728('0x1e')](0x10,0x14)+'-'+_0x486825[_0x8728('0x1e')](0x14);}};
\ No newline at end of file
index 3ad7ec5..4660375 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd7c9=['base64','utf8','||FIELD||VALUE||\x0a','User','findOne','admin','fullname','email','then','|reason|','|uuid|','|machineUuid|','|name|','|email|','getFirstInterface','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','active','license','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','days','catch','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','https','crypto','bluebird','pkginfo','version','../environment','./hardware','www.xcallymotion.com','format','/api/servers/%s/check?version=%s','GET','application/json','request','setEncoding','data','end','parse','aes-256-ctr','secrets','session','update'];(function(_0x3e30a8,_0x257732){var _0x5d5d1d=function(_0x2987f1){while(--_0x2987f1){_0x3e30a8['push'](_0x3e30a8['shift']());}};_0x5d5d1d(++_0x257732);}(_0xd7c9,0xf2));var _0x9d7c=function(_0x53807d,_0x4a90a8){_0x53807d=_0x53807d-0x0;var _0x501207=_0xd7c9[_0x53807d];return _0x501207;};'use strict';var util=require(_0x9d7c('0x0'));var https=require(_0x9d7c('0x1'));var crypto=require(_0x9d7c('0x2'));var moment=require('moment');var BPromise=require(_0x9d7c('0x3'));var pkginfo=require(_0x9d7c('0x4'))(module,_0x9d7c('0x5'));var db=require('../../mysqldb')['db'];var config=require(_0x9d7c('0x6'));var hardware=require(_0x9d7c('0x7'));var logger=require('../logger')('license');var jira=require('../../api/jira/jira.controller');var HOST=_0x9d7c('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;function httpRequest(_0x3c26c8){return new BPromise(function(_0x4522e6,_0x559b5e){var _0x5e17e9={'host':HOST,'port':0x1bb,'path':util[_0x9d7c('0x9')](_0x9d7c('0xa'),_0x3c26c8,module['exports'][_0x9d7c('0x5')]),'method':_0x9d7c('0xb'),'timeout':0xea60,'headers':{'Content-Type':_0x9d7c('0xc')}};var _0xab58f7=https[_0x9d7c('0xd')](_0x5e17e9,function(_0xa13687){_0xa13687[_0x9d7c('0xe')]('utf8');var _0x5e5093='';_0xa13687['on'](_0x9d7c('0xf'),function(_0x2d2c35){_0x5e5093+=_0x2d2c35;});_0xa13687['on'](_0x9d7c('0x10'),function(){try{_0x4522e6(JSON[_0x9d7c('0x11')](_0x5e5093));}catch(_0x1f39eb){_0x559b5e(_0x1f39eb);}});});_0xab58f7['on']('error',_0x559b5e);_0xab58f7[_0x9d7c('0x10')]();});}function encryptDate(_0x43f0d4){var _0x3c0aed=crypto['createCipher'](_0x9d7c('0x12'),config[_0x9d7c('0x13')][_0x9d7c('0x14')]);var _0x4a2509=_0x3c0aed[_0x9d7c('0x15')](_0x43f0d4,'utf8',_0x9d7c('0x16'));_0x4a2509+=_0x3c0aed['final']('base64');return _0x4a2509;}function decryptDate(_0x2aad06){var _0x4f9ed2=crypto['createDecipher'](_0x9d7c('0x12'),config[_0x9d7c('0x13')][_0x9d7c('0x14')]);var _0x215b9d=_0x4f9ed2[_0x9d7c('0x15')](_0x2aad06,_0x9d7c('0x16'),_0x9d7c('0x17'));_0x215b9d+=_0x4f9ed2['final'](_0x9d7c('0x17'));return _0x215b9d;}function sendJiraAlert(_0x5643b2,_0x1bb0ad,_0x3826b0){var _0x21d7d8=_0x9d7c('0x18');return db[_0x9d7c('0x19')][_0x9d7c('0x1a')]({'where':{'role':_0x9d7c('0x1b')},'attributes':[_0x9d7c('0x1c'),_0x9d7c('0x1d')],'raw':!![]})[_0x9d7c('0x1e')](function(_0x31be17){ADMIN=_0x31be17;_0x21d7d8+=_0x9d7c('0x1f')+_0x3826b0+'|\x0a';_0x21d7d8+=_0x9d7c('0x20')+_0x5643b2+'|\x0a';_0x21d7d8+=_0x9d7c('0x21')+_0x1bb0ad+'|\x0a';_0x21d7d8+=_0x9d7c('0x22')+ADMIN[_0x9d7c('0x1c')]+'|\x0a';_0x21d7d8+=_0x9d7c('0x23')+ADMIN[_0x9d7c('0x1d')]+'|\x0a';return _0x21d7d8;})[_0x9d7c('0x1e')](function(_0x9d0319){var _0x27c308=hardware[_0x9d7c('0x24')]()[_0x9d7c('0x25')];return jira[_0x9d7c('0x26')]({'key':_0x9d7c('0x27'),'summary':_0x9d7c('0x28'),'description':_0x9d0319,'issuetype':_0x9d7c('0x29'),'oldToken':_0x5643b2,'newToken':_0x1bb0ad,'email':ADMIN[_0x9d7c('0x1d')],'name':ADMIN['fullname'],'reason':GRAY_PERIOD_REASON,'ip':_0x27c308});});}function manageLicense(_0x5572b6,_0x5134f8){var _0x421bf3=_0x5134f8[_0x9d7c('0x2a')]({'plain':!![]});httpRequest(_0x5572b6)['then'](function(_0x316151){if(_0x316151[_0x9d7c('0x2b')]){if(!_0x421bf3[_0x9d7c('0x2c')]&&_0x421bf3['license']!=_0x316151[_0x9d7c('0x2c')]||_0x421bf3[_0x9d7c('0x2c')]&&_0x421bf3[_0x9d7c('0x2d')]){logger['info'](_0x9d7c('0x2e'));}if(_0x421bf3[_0x9d7c('0x2c')]&&!_0x421bf3[_0x9d7c('0x2d')]&&_0x421bf3[_0x9d7c('0x2c')]!=_0x316151[_0x9d7c('0x2c')]){logger[_0x9d7c('0x2f')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x421bf3['license']&&!_0x421bf3[_0x9d7c('0x2d')]&&_0x421bf3[_0x9d7c('0x2c')]==_0x316151[_0x9d7c('0x2c')]){return _0x5134f8;}return _0x5134f8['update']({'data1':_0x5572b6,'data2':null,'license':_0x316151[_0x9d7c('0x2c')]});}else{if(_0x316151[_0x9d7c('0x2c')]||_0x421bf3['license']){if(!_0x421bf3[_0x9d7c('0x2d')]){if(_0x421bf3[_0x9d7c('0x30')]==_0x5572b6){GRAY_PERIOD_REASON=_0x9d7c('0x31');logger['info'](_0x9d7c('0x32'));}else{GRAY_PERIOD_REASON=_0x9d7c('0x33');logger[_0x9d7c('0x2f')](_0x9d7c('0x34'),_0x421bf3[_0x9d7c('0x30')],_0x5572b6);}sendJiraAlert(_0x421bf3[_0x9d7c('0x30')],_0x316151['uuid'],GRAY_PERIOD_REASON);logger['info'](_0x9d7c('0x35'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x9d7c('0x9')](_0x9d7c('0x36')));return _0x5134f8[_0x9d7c('0x15')]({'data2':encryptDate(moment()[_0x9d7c('0x9')](_0x9d7c('0x36')))});}else{if(moment()['diff'](decryptDate(_0x421bf3['data2']),_0x9d7c('0x37'))>DAYS){logger[_0x9d7c('0x2f')]('DEMO\x20START\x20AT\x20%s',moment()[_0x9d7c('0x9')](_0x9d7c('0x36')));return _0x5134f8['update']({'data1':_0x5572b6,'data2':null,'license':null});}}}else{if(_0x421bf3['data1']!=_0x5572b6){logger[_0x9d7c('0x2f')](_0x9d7c('0x34'),_0x421bf3[_0x9d7c('0x30')],_0x5572b6);return _0x5134f8[_0x9d7c('0x15')]({'data1':_0x5572b6,'data2':null,'license':null});}}}return _0x5134f8;})[_0x9d7c('0x1e')](function(_0x30a88e){_0x5134f8=_0x30a88e;})[_0x9d7c('0x38')](function(_0x23035b){logger['error'](_0x23035b[_0x9d7c('0x39')]);})[_0x9d7c('0x3a')](function(){setTimeout(function(){manageLicense(hardware[_0x9d7c('0x3b')](),_0x5134f8);},TIME);});}function defaultLicense(){var _0x4a8aa5=hardware[_0x9d7c('0x3b')]();if(_0x4a8aa5){return db[_0x9d7c('0x3c')][_0x9d7c('0x3d')]({'where':{'id':0x1},'defaults':{'data1':_0x4a8aa5}})[_0x9d7c('0x3e')](function(_0x22e750,_0x5ce32a){logger[_0x9d7c('0x2f')](_0x9d7c('0x3f'),_0x4a8aa5);manageLicense(_0x4a8aa5,_0x22e750);})[_0x9d7c('0x38')](function(_0x36bf52){logger[_0x9d7c('0x40')](_0x36bf52[_0x9d7c('0x39')]);});}}exports[_0x9d7c('0x41')]=defaultLicense;
\ No newline at end of file
+var _0xb58e=['email','then','|reason|','|uuid|','|machineUuid|','|name|','fullname','|email|','getFirstInterface','openIssue','Motion\x20License\x20Alert','Alert','active','data2','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','info','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','catch','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','https','moment','bluebird','pkginfo','version','../environment','./hardware','../logger','license','../../api/jira/jira.controller','www.xcallymotion.com','format','exports','GET','application/json','utf8','data','end','parse','error','createCipher','session','update','base64','final','aes-256-ctr','||FIELD||VALUE||\x0a','findOne','admin'];(function(_0x5bd6ce,_0x5da1c9){var _0x1b64a2=function(_0x517bbb){while(--_0x517bbb){_0x5bd6ce['push'](_0x5bd6ce['shift']());}};_0x1b64a2(++_0x5da1c9);}(_0xb58e,0xa5));var _0xeb58=function(_0x3d53b3,_0x4ba639){_0x3d53b3=_0x3d53b3-0x0;var _0x32f100=_0xb58e[_0x3d53b3];return _0x32f100;};'use strict';var util=require(_0xeb58('0x0'));var https=require(_0xeb58('0x1'));var crypto=require('crypto');var moment=require(_0xeb58('0x2'));var BPromise=require(_0xeb58('0x3'));var pkginfo=require(_0xeb58('0x4'))(module,_0xeb58('0x5'));var db=require('../../mysqldb')['db'];var config=require(_0xeb58('0x6'));var hardware=require(_0xeb58('0x7'));var logger=require(_0xeb58('0x8'))(_0xeb58('0x9'));var jira=require(_0xeb58('0xa'));var HOST=_0xeb58('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;function httpRequest(_0x18990d){return new BPromise(function(_0x543618,_0x1bd143){var _0x30ae16={'host':HOST,'port':0x1bb,'path':util[_0xeb58('0xc')]('/api/servers/%s/check?version=%s',_0x18990d,module[_0xeb58('0xd')][_0xeb58('0x5')]),'method':_0xeb58('0xe'),'timeout':0xea60,'headers':{'Content-Type':_0xeb58('0xf')}};var _0x42ca8c=https['request'](_0x30ae16,function(_0x407159){_0x407159['setEncoding'](_0xeb58('0x10'));var _0x36bec7='';_0x407159['on'](_0xeb58('0x11'),function(_0x4169d5){_0x36bec7+=_0x4169d5;});_0x407159['on'](_0xeb58('0x12'),function(){try{_0x543618(JSON[_0xeb58('0x13')](_0x36bec7));}catch(_0x5a4fbb){_0x1bd143(_0x5a4fbb);}});});_0x42ca8c['on'](_0xeb58('0x14'),_0x1bd143);_0x42ca8c[_0xeb58('0x12')]();});}function encryptDate(_0x33f93c){var _0x4acfa7=crypto[_0xeb58('0x15')]('aes-256-ctr',config['secrets'][_0xeb58('0x16')]);var _0x30e637=_0x4acfa7[_0xeb58('0x17')](_0x33f93c,_0xeb58('0x10'),_0xeb58('0x18'));_0x30e637+=_0x4acfa7[_0xeb58('0x19')]('base64');return _0x30e637;}function decryptDate(_0x3516e0){var _0x1df982=crypto['createDecipher'](_0xeb58('0x1a'),config['secrets']['session']);var _0x5bbb7a=_0x1df982[_0xeb58('0x17')](_0x3516e0,_0xeb58('0x18'),_0xeb58('0x10'));_0x5bbb7a+=_0x1df982[_0xeb58('0x19')](_0xeb58('0x10'));return _0x5bbb7a;}function sendJiraAlert(_0x1a9557,_0x3f35af,_0x539429){var _0x2b3520=_0xeb58('0x1b');return db['User'][_0xeb58('0x1c')]({'where':{'role':_0xeb58('0x1d')},'attributes':['fullname',_0xeb58('0x1e')],'raw':!![]})[_0xeb58('0x1f')](function(_0x21f925){ADMIN=_0x21f925;_0x2b3520+=_0xeb58('0x20')+_0x539429+'|\x0a';_0x2b3520+=_0xeb58('0x21')+_0x1a9557+'|\x0a';_0x2b3520+=_0xeb58('0x22')+_0x3f35af+'|\x0a';_0x2b3520+=_0xeb58('0x23')+ADMIN[_0xeb58('0x24')]+'|\x0a';_0x2b3520+=_0xeb58('0x25')+ADMIN[_0xeb58('0x1e')]+'|\x0a';return _0x2b3520;})['then'](function(_0x5684c0){var _0x16f601=hardware[_0xeb58('0x26')]()['ipAddress'];return jira[_0xeb58('0x27')]({'key':'MOTLICENSE','summary':_0xeb58('0x28'),'description':_0x5684c0,'issuetype':_0xeb58('0x29'),'oldToken':_0x1a9557,'newToken':_0x3f35af,'email':ADMIN[_0xeb58('0x1e')],'name':ADMIN[_0xeb58('0x24')],'reason':GRAY_PERIOD_REASON,'ip':_0x16f601});});}function manageLicense(_0x4c7dc6,_0xfa05e3){var _0x5cea9d=_0xfa05e3['get']({'plain':!![]});httpRequest(_0x4c7dc6)['then'](function(_0xa43762){if(_0xa43762[_0xeb58('0x2a')]){if(!_0x5cea9d['license']&&_0x5cea9d[_0xeb58('0x9')]!=_0xa43762[_0xeb58('0x9')]||_0x5cea9d['license']&&_0x5cea9d[_0xeb58('0x2b')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x5cea9d[_0xeb58('0x9')]&&!_0x5cea9d[_0xeb58('0x2b')]&&_0x5cea9d[_0xeb58('0x9')]!=_0xa43762['license']){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x5cea9d[_0xeb58('0x9')]&&!_0x5cea9d[_0xeb58('0x2b')]&&_0x5cea9d[_0xeb58('0x9')]==_0xa43762[_0xeb58('0x9')]){return _0xfa05e3;}return _0xfa05e3[_0xeb58('0x17')]({'data1':_0x4c7dc6,'data2':null,'license':_0xa43762['license']});}else{if(_0xa43762[_0xeb58('0x9')]||_0x5cea9d['license']){if(!_0x5cea9d['data2']){if(_0x5cea9d[_0xeb58('0x2c')]==_0x4c7dc6){GRAY_PERIOD_REASON=_0xeb58('0x2d');logger['info'](_0xeb58('0x2e'));}else{GRAY_PERIOD_REASON=_0xeb58('0x2f');logger[_0xeb58('0x30')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x5cea9d[_0xeb58('0x2c')],_0x4c7dc6);}sendJiraAlert(_0x5cea9d[_0xeb58('0x2c')],_0xa43762[_0xeb58('0x31')],GRAY_PERIOD_REASON);logger['info'](_0xeb58('0x32'),GRAY_PERIOD_REASON[_0xeb58('0x33')](),moment()[_0xeb58('0xc')](_0xeb58('0x34')));return _0xfa05e3[_0xeb58('0x17')]({'data2':encryptDate(moment()[_0xeb58('0xc')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xeb58('0x35')](decryptDate(_0x5cea9d['data2']),'days')>DAYS){logger[_0xeb58('0x30')](_0xeb58('0x36'),moment()[_0xeb58('0xc')](_0xeb58('0x34')));return _0xfa05e3[_0xeb58('0x17')]({'data1':_0x4c7dc6,'data2':null,'license':null});}}}else{if(_0x5cea9d[_0xeb58('0x2c')]!=_0x4c7dc6){logger['info'](_0xeb58('0x37'),_0x5cea9d['data1'],_0x4c7dc6);return _0xfa05e3[_0xeb58('0x17')]({'data1':_0x4c7dc6,'data2':null,'license':null});}}}return _0xfa05e3;})[_0xeb58('0x1f')](function(_0x3fe4b9){_0xfa05e3=_0x3fe4b9;})[_0xeb58('0x38')](function(_0x5218dd){logger[_0xeb58('0x14')](_0x5218dd[_0xeb58('0x39')]);})[_0xeb58('0x3a')](function(){setTimeout(function(){manageLicense(hardware[_0xeb58('0x3b')](),_0xfa05e3);},TIME);});}function defaultLicense(){var _0x11c8aa=hardware[_0xeb58('0x3b')]();if(_0x11c8aa){return db[_0xeb58('0x3c')][_0xeb58('0x3d')]({'where':{'id':0x1},'defaults':{'data1':_0x11c8aa}})[_0xeb58('0x3e')](function(_0x1200a8,_0x43860f){logger[_0xeb58('0x30')](_0xeb58('0x3f'),_0x11c8aa);manageLicense(_0x11c8aa,_0x1200a8);})[_0xeb58('0x38')](function(_0x30a51a){logger[_0xeb58('0x14')](_0x30a51a[_0xeb58('0x39')]);});}}exports[_0xeb58('0x40')]=defaultLicense;
\ No newline at end of file
index ee5e259..679ce3d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcec5=['license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','utf8','parse','uuid','machineUuid','secrets','base64','gray','add','days','changed','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','message','getUuid','getLicense','License','find','then','checkLicense','crypto','util','lodash','./hardware','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcec5,0xd3));var _0x5cec=function(_0x1fe825,_0x557443){_0x1fe825=_0x1fe825-0x0;var _0x452879=_0xcec5[_0x1fe825];return _0x452879;};'use strict';var crypto=require(_0x5cec('0x0'));var util=require(_0x5cec('0x1'));var _=require(_0x5cec('0x2'));var moment=require('moment');var hardware=require(_0x5cec('0x3'));var config=require('../environment');var db=require(_0x5cec('0x4'))['db'];function checkLicense(_0x43b6e2,_0x386fa5){if(_0x43b6e2){try{var _0x1fb4b4=_0x386fa5||_0x43b6e2[_0x5cec('0x5')];if(_[_0x5cec('0x6')](_0x1fb4b4)){throw new Error(_0x5cec('0x7'));}var _0x284617=_0x43b6e2[_0x5cec('0x8')];var _0x4e0919=_0x43b6e2[_0x5cec('0x9')];var _0x56b32e=_0x284617[_0x5cec('0xa')]('-')[0x4];var _0x568368=_0x284617['split']('-')[0x0];var _0x39bd31=crypto[_0x5cec('0xb')](_0x5cec('0xc'),util[_0x5cec('0xd')](_0x5cec('0xe'),_0x56b32e,_0x284617,_0x568368));var _0x5547ce=_0x39bd31[_0x5cec('0xf')](_0x1fb4b4,'base64',_0x5cec('0x10'));_0x5547ce+=_0x39bd31['final'](_0x5cec('0x10'));var _0x1da5f3=JSON[_0x5cec('0x11')](_0x5547ce);_0x1da5f3['demo']=![];_0x1da5f3[_0x5cec('0x12')]=_0x284617;_0x1da5f3[_0x5cec('0x13')]=hardware['getUuid']();if(_0x4e0919){var _0x207f08=crypto[_0x5cec('0xb')](_0x5cec('0xc'),config[_0x5cec('0x14')]['session']);var _0x4034ea=_0x207f08['update'](_0x4e0919,_0x5cec('0x15'),'utf8');_0x4034ea+=_0x207f08['final'](_0x5cec('0x10'));_0x1da5f3[_0x5cec('0x16')]=_0x4034ea;_0x1da5f3['deadline']=moment(_0x4034ea)[_0x5cec('0x17')](0x7,_0x5cec('0x18'))[_0x5cec('0xd')]();_0x1da5f3['grayReason']=_0x1da5f3['uuid']!=_0x1da5f3['machineUuid']?_0x5cec('0x19'):_0x5cec('0x1a');}return _0x1da5f3;}catch(_0x208260){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5cec('0x1b'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x5cec('0x1c'),'uuid':_0x43b6e2[_0x5cec('0x8')],'machineUuid':hardware['getUuid'](),'message':_0x208260[_0x5cec('0x1d')],'virtual':0x0,'voice':!![],'preferred':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5cec('0x1b'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Demo\x20license','uuid':_0x43b6e2['data1'],'machineUuid':hardware[_0x5cec('0x1e')](),'virtual':0x0,'voice':!![],'preferred':![]};}exports[_0x5cec('0x1f')]=function(_0x58068e){return db[_0x5cec('0x20')][_0x5cec('0x21')](_['defaults'](_0x58068e,{'raw':!![],'where':{'id':0x1}}))[_0x5cec('0x22')](function(_0x1ad335){return checkLicense(_0x1ad335,null);});};exports[_0x5cec('0x23')]=checkLicense;
\ No newline at end of file
+var _0x971e=['add','grayReason','machineUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','getUuid','message','getLicense','License','defaults','then','util','lodash','moment','./hardware','../environment','../../mysqldb','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','demo','uuid','secrets','session','final','gray'];(function(_0x3b0912,_0x39d739){var _0xa8f339=function(_0x6a31ab){while(--_0x6a31ab){_0x3b0912['push'](_0x3b0912['shift']());}};_0xa8f339(++_0x39d739);}(_0x971e,0x77));var _0xe971=function(_0x21497e,_0xe16177){_0x21497e=_0x21497e-0x0;var _0x3778e8=_0x971e[_0x21497e];return _0x3778e8;};'use strict';var crypto=require('crypto');var util=require(_0xe971('0x0'));var _=require(_0xe971('0x1'));var moment=require(_0xe971('0x2'));var hardware=require(_0xe971('0x3'));var config=require(_0xe971('0x4'));var db=require(_0xe971('0x5'))['db'];function checkLicense(_0x41a933,_0x416c48){if(_0x41a933){try{var _0x434625=_0x416c48||_0x41a933[_0xe971('0x6')];if(_[_0xe971('0x7')](_0x434625)){throw new Error(_0xe971('0x8'));}var _0x439cfa=_0x41a933[_0xe971('0x9')];var _0x20e1e6=_0x41a933[_0xe971('0xa')];var _0x2c7ead=_0x439cfa[_0xe971('0xb')]('-')[0x4];var _0xd3c158=_0x439cfa['split']('-')[0x0];var _0x55c9fc=crypto[_0xe971('0xc')](_0xe971('0xd'),util[_0xe971('0xe')](_0xe971('0xf'),_0x2c7ead,_0x439cfa,_0xd3c158));var _0x40a6e9=_0x55c9fc[_0xe971('0x10')](_0x434625,_0xe971('0x11'),_0xe971('0x12'));_0x40a6e9+=_0x55c9fc['final']('utf8');var _0x182528=JSON['parse'](_0x40a6e9);_0x182528[_0xe971('0x13')]=![];_0x182528[_0xe971('0x14')]=_0x439cfa;_0x182528['machineUuid']=hardware['getUuid']();if(_0x20e1e6){var _0x1ca1c4=crypto[_0xe971('0xc')]('aes-256-ctr',config[_0xe971('0x15')][_0xe971('0x16')]);var _0x2fbb61=_0x1ca1c4['update'](_0x20e1e6,_0xe971('0x11'),_0xe971('0x12'));_0x2fbb61+=_0x1ca1c4[_0xe971('0x17')](_0xe971('0x12'));_0x182528[_0xe971('0x18')]=_0x2fbb61;_0x182528['deadline']=moment(_0x2fbb61)[_0xe971('0x19')](0x7,'days')[_0xe971('0xe')]();_0x182528[_0xe971('0x1a')]=_0x182528[_0xe971('0x14')]!=_0x182528[_0xe971('0x1b')]?'changed':'disabled';}return _0x182528;}catch(_0x242ada){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe971('0x1c'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xe971('0x1d'),'uuid':_0x41a933['data1'],'machineUuid':hardware[_0xe971('0x1e')](),'message':_0x242ada[_0xe971('0x1f')],'virtual':0x0,'voice':!![],'preferred':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe971('0x1c'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Demo\x20license','uuid':_0x41a933['data1'],'machineUuid':hardware[_0xe971('0x1e')](),'virtual':0x0,'voice':!![],'preferred':![]};}exports[_0xe971('0x20')]=function(_0x3e384b){return db[_0xe971('0x21')]['find'](_[_0xe971('0x22')](_0x3e384b,{'raw':!![],'where':{'id':0x1}}))[_0xe971('0x23')](function(_0x35640f){return checkLicense(_0x35640f,null);});};exports['checkLicense']=checkLicense;
\ No newline at end of file
index a1202ed..407feff 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x195e=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x3bd9bc,_0x40bc57){var _0x3ad356=function(_0xef3a80){while(--_0xef3a80){_0x3bd9bc['push'](_0x3bd9bc['shift']());}};_0x3ad356(++_0x40bc57);}(_0x195e,0xfb));var _0xe195=function(_0x10b7c8,_0x1a369c){_0x10b7c8=_0x10b7c8-0x0;var _0x3151c4=_0x195e[_0x10b7c8];return _0x3151c4;};'use strict';module[_0xe195('0x0')]={'DOMAIN':_0xe195('0x1'),'SESSION_SECRET':_0xe195('0x2'),'GOOGLE_ID':_0xe195('0x3'),'GOOGLE_SECRET':_0xe195('0x4'),'DEBUG':''};
\ No newline at end of file
+var _0x340c=['app-id','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x3fd4fb,_0x1d5d2a){var _0x2e274b=function(_0x460592){while(--_0x460592){_0x3fd4fb['push'](_0x3fd4fb['shift']());}};_0x2e274b(++_0x1d5d2a);}(_0x340c,0xe5));var _0xc340=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x340c[_0x3dd15e];return _0x231fd0;};'use strict';module[_0xc340('0x0')]={'DOMAIN':_0xc340('0x1'),'SESSION_SECRET':_0xc340('0x2'),'GOOGLE_ID':_0xc340('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''};
\ No newline at end of file
index 594e89e..ccc2c38 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7582=['info','env','debugLevel','moment','winston','join','log','format','%s-%s.log','YYYY-MM-DD\x20HH:mm:ss','message','exports','File','%s-%s','error','transports'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0x7582,0xe3));var _0x2758=function(_0x4b4638,_0xe99cda){_0x4b4638=_0x4b4638-0x0;var _0x59e92b=_0x7582[_0x4b4638];return _0x59e92b;};'use strict';var moment=require(_0x2758('0x0'));var winston=require(_0x2758('0x1'));var util=require('util');var path=require('path');var debugLevel='INFO';function filename(_0x2e7b66,_0x438eb4){return path[_0x2758('0x2')]('/var',_0x2758('0x3'),'xcally',util[_0x2758('0x4')](_0x2758('0x5'),_0x2e7b66,_0x438eb4));}function formatter(_0x3e6945,_0x3a8e2c){return util[_0x2758('0x4')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x2758('0x4')](_0x2758('0x6')),_0x3a8e2c['level']['toUpperCase'](),_0x3e6945,_0x3a8e2c[_0x2758('0x7')]);}module[_0x2758('0x8')]=function(_0x383934){return new winston['Logger']({'transports':[new winston['transports'][(_0x2758('0x9'))]({'name':util[_0x2758('0x4')](_0x2758('0xa'),_0x383934,'error'),'filename':filename(_0x383934,_0x2758('0xb')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x11de0c){return formatter(_0x383934,_0x11de0c);}}),new winston[(_0x2758('0xc'))][(_0x2758('0x9'))]({'name':util[_0x2758('0x4')]('%s-%s',_0x383934,'info'),'filename':filename(_0x383934,_0x2758('0xd')),'level':_0x2758('0xd'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1e81fe){return formatter(_0x383934,_0x1e81fe);}}),new winston['transports']['Console']({'level':process[_0x2758('0xe')][_0x2758('0xf')]||debugLevel,'json':![],'formatter':function(_0x11a75b){return formatter(_0x383934,_0x11a75b);}})]});};
\ No newline at end of file
+var _0x829f=['Logger','transports','File','error','%s-%s','info','Console','env','debugLevel','moment','util','path','INFO','join','/var','log','xcally','%s-%s.log','format','message','exports'];(function(_0x4c022d,_0x115072){var _0x24d735=function(_0xa41e30){while(--_0xa41e30){_0x4c022d['push'](_0x4c022d['shift']());}};_0x24d735(++_0x115072);}(_0x829f,0x1d7));var _0xf829=function(_0x74c31d,_0x2ff936){_0x74c31d=_0x74c31d-0x0;var _0x25ac61=_0x829f[_0x74c31d];return _0x25ac61;};'use strict';var moment=require(_0xf829('0x0'));var winston=require('winston');var util=require(_0xf829('0x1'));var path=require(_0xf829('0x2'));var debugLevel=_0xf829('0x3');function filename(_0x519996,_0x16a66e){return path[_0xf829('0x4')](_0xf829('0x5'),_0xf829('0x6'),_0xf829('0x7'),util['format'](_0xf829('0x8'),_0x519996,_0x16a66e));}function formatter(_0x325ded,_0x327c1f){return util[_0xf829('0x9')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xf829('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),_0x327c1f['level']['toUpperCase'](),_0x325ded,_0x327c1f[_0xf829('0xa')]);}module[_0xf829('0xb')]=function(_0x1fe9ea){return new winston[(_0xf829('0xc'))]({'transports':[new winston[(_0xf829('0xd'))][(_0xf829('0xe'))]({'name':util[_0xf829('0x9')]('%s-%s',_0x1fe9ea,_0xf829('0xf')),'filename':filename(_0x1fe9ea,_0xf829('0xf')),'level':_0xf829('0xf'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4ab57f){return formatter(_0x1fe9ea,_0x4ab57f);}}),new winston[(_0xf829('0xd'))][(_0xf829('0xe'))]({'name':util[_0xf829('0x9')](_0xf829('0x10'),_0x1fe9ea,_0xf829('0x11')),'filename':filename(_0x1fe9ea,_0xf829('0x11')),'level':_0xf829('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x29ee8d){return formatter(_0x1fe9ea,_0x29ee8d);}}),new winston['transports'][(_0xf829('0x12'))]({'level':process[_0xf829('0x13')][_0xf829('0x14')]||debugLevel,'json':![],'formatter':function(_0x4318dd){return formatter(_0x1fe9ea,_0x4318dd);}})]});};
\ No newline at end of file
index 781b12d..9963adc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb0d9=['../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami','agi','../../services/email/index.js','routing'];(function(_0x4cfa2e,_0x5752b5){var _0x279b50=function(_0x3f817b){while(--_0x3f817b){_0x4cfa2e['push'](_0x4cfa2e['shift']());}};_0x279b50(++_0x5752b5);}(_0xb0d9,0x10c));var _0x9b0d=function(_0x55816d,_0x4e1f3d){_0x55816d=_0x55816d-0x0;var _0x1d4255=_0xb0d9[_0x55816d];return _0x1d4255;};'use strict';var path=require(_0x9b0d('0x0'));var os=require('os');var config={'apps':[{'name':_0x9b0d('0x1'),'script':path[_0x9b0d('0x2')](__dirname,_0x9b0d('0x3'))},{'name':_0x9b0d('0x4'),'script':path[_0x9b0d('0x2')](__dirname,'../../services/ami/index.js')},{'name':_0x9b0d('0x5'),'script':path['join'](__dirname,'../../services/agi/index.js')},{'name':'email','script':path[_0x9b0d('0x2')](__dirname,_0x9b0d('0x6'))},{'name':_0x9b0d('0x7'),'script':path[_0x9b0d('0x2')](__dirname,_0x9b0d('0x8'))},{'name':_0x9b0d('0x9'),'script':path[_0x9b0d('0x2')](__dirname,_0x9b0d('0xa'))}]};module[_0x9b0d('0xb')]=config;
\ No newline at end of file
+var _0x8c91=['routing','../../services/xdr/index.js','exports','express','join','../../services/express/index.js','ami','agi','email','../../services/email/index.js'];(function(_0x2751de,_0x1e7c26){var _0x4e26cb=function(_0x572efe){while(--_0x572efe){_0x2751de['push'](_0x2751de['shift']());}};_0x4e26cb(++_0x1e7c26);}(_0x8c91,0xf3));var _0x18c9=function(_0x361adc,_0x4710b8){_0x361adc=_0x361adc-0x0;var _0x3a961d=_0x8c91[_0x361adc];return _0x3a961d;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x18c9('0x0'),'script':path[_0x18c9('0x1')](__dirname,_0x18c9('0x2'))},{'name':_0x18c9('0x3'),'script':path[_0x18c9('0x1')](__dirname,'../../services/ami/index.js')},{'name':_0x18c9('0x4'),'script':path[_0x18c9('0x1')](__dirname,'../../services/agi/index.js')},{'name':_0x18c9('0x5'),'script':path[_0x18c9('0x1')](__dirname,_0x18c9('0x6'))},{'name':_0x18c9('0x7'),'script':path['join'](__dirname,'../../services/routing/index.js')},{'name':'xdr','script':path[_0x18c9('0x1')](__dirname,_0x18c9('0x8'))}]};module[_0x18c9('0x9')]=config;
\ No newline at end of file
index de4a14a..a588680 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x34e8=['stop','restart','list','delete','dump','saved','pm2','bluebird','./config','connect','connected','start','then','disconnect'];(function(_0x16068b,_0x3c2737){var _0x55fa62=function(_0x15bdc5){while(--_0x15bdc5){_0x16068b['push'](_0x16068b['shift']());}};_0x55fa62(++_0x3c2737);}(_0x34e8,0x12c));var _0x834e=function(_0x198791,_0x5b6bea){_0x198791=_0x198791-0x0;var _0x212123=_0x34e8[_0x198791];return _0x212123;};'use strict';var pm2=require(_0x834e('0x0'));var BPromise=require(_0x834e('0x1'));var config=require(_0x834e('0x2'));function connect(){return new BPromise(function(_0x35e6fb,_0x530939){return pm2[_0x834e('0x3')](function(_0x21e2e0){if(_0x21e2e0){return _0x530939(_0x21e2e0);}return _0x35e6fb(_0x834e('0x4'));});});};exports[_0x834e('0x5')]=function(_0x289ef2){return connect()[_0x834e('0x6')](function(){return new BPromise(function(_0x398bee,_0x4a2018){return pm2[_0x834e('0x5')](_0x289ef2,function(_0x52056d,_0x3e16d2){if(_0x52056d){return _0x4a2018(_0x52056d);}pm2[_0x834e('0x7')]();return _0x398bee(_0x3e16d2);});});});};exports[_0x834e('0x8')]=function(_0x2e69e2){return connect()[_0x834e('0x6')](function(){return new BPromise(function(_0x23501c,_0x363786){return pm2[_0x834e('0x8')](_0x2e69e2,function(_0x3bdda9,_0x186b3b){if(_0x3bdda9){return _0x363786(_0x3bdda9);}pm2[_0x834e('0x7')]();return _0x23501c(_0x186b3b);});});});};exports[_0x834e('0x9')]=function(_0x14038b){return connect()[_0x834e('0x6')](function(){return new BPromise(function(_0x293514,_0x1e00de){return pm2[_0x834e('0x9')](_0x14038b,function(_0x538bb3,_0x5e5b6d){if(_0x538bb3){return _0x1e00de(_0x538bb3);}pm2[_0x834e('0x7')]();return _0x293514(_0x5e5b6d);});});});};exports['list']=function(){return connect()[_0x834e('0x6')](function(){return new BPromise(function(_0x2d95f2,_0x28e659){return pm2[_0x834e('0xa')](function(_0x50e860,_0x43156c){if(_0x50e860){return _0x28e659(_0x50e860);}pm2[_0x834e('0x7')]();return _0x2d95f2(_0x43156c);});});});};exports['describe']=function(_0x316205){return connect()['then'](function(){return new BPromise(function(_0x38a8cd,_0x36d443){return pm2['describe'](_0x316205,function(_0x43ac41,_0x22106e){if(_0x43ac41){return _0x36d443(_0x43ac41);}pm2[_0x834e('0x7')]();return _0x38a8cd(_0x22106e);});});});};exports['delete']=function(_0x283e56){return connect()[_0x834e('0x6')](function(){return new BPromise(function(_0x34e41a,_0xb993a1){return pm2[_0x834e('0xb')](_0x283e56,function(_0x254677,_0x1dd214){if(_0x254677){return _0xb993a1(_0x254677);}pm2['disconnect']();return _0x34e41a(_0x1dd214);});});});};exports[_0x834e('0xc')]=function(){return connect()[_0x834e('0x6')](function(){return new BPromise(function(_0x113ff4,_0x325a99){return pm2['dump'](function(_0x45a630){if(_0x45a630){return _0x325a99(_0x45a630);}return _0x113ff4(_0x834e('0xd'));});});});};
\ No newline at end of file
+var _0x008c=['start','then','disconnect','stop','restart','list','describe','delete','pm2','bluebird','./config','connected'];(function(_0x63e4c5,_0x1492e8){var _0x34b542=function(_0x1ca9b8){while(--_0x1ca9b8){_0x63e4c5['push'](_0x63e4c5['shift']());}};_0x34b542(++_0x1492e8);}(_0x008c,0x188));var _0xc008=function(_0x2fef36,_0x2d9657){_0x2fef36=_0x2fef36-0x0;var _0x36cb38=_0x008c[_0x2fef36];return _0x36cb38;};'use strict';var pm2=require(_0xc008('0x0'));var BPromise=require(_0xc008('0x1'));var config=require(_0xc008('0x2'));function connect(){return new BPromise(function(_0xae17af,_0x1d119a){return pm2['connect'](function(_0x3641af){if(_0x3641af){return _0x1d119a(_0x3641af);}return _0xae17af(_0xc008('0x3'));});});};exports[_0xc008('0x4')]=function(_0x163bd9){return connect()[_0xc008('0x5')](function(){return new BPromise(function(_0x1679e0,_0x13aa7){return pm2[_0xc008('0x4')](_0x163bd9,function(_0x9c8cb2,_0x4af530){if(_0x9c8cb2){return _0x13aa7(_0x9c8cb2);}pm2[_0xc008('0x6')]();return _0x1679e0(_0x4af530);});});});};exports['stop']=function(_0x30be38){return connect()['then'](function(){return new BPromise(function(_0x52041f,_0x27830d){return pm2[_0xc008('0x7')](_0x30be38,function(_0x57c46d,_0x51ba7d){if(_0x57c46d){return _0x27830d(_0x57c46d);}pm2['disconnect']();return _0x52041f(_0x51ba7d);});});});};exports[_0xc008('0x8')]=function(_0xc881aa){return connect()['then'](function(){return new BPromise(function(_0xae2dab,_0x332fd4){return pm2[_0xc008('0x8')](_0xc881aa,function(_0x2a5b4e,_0x9ffa93){if(_0x2a5b4e){return _0x332fd4(_0x2a5b4e);}pm2[_0xc008('0x6')]();return _0xae2dab(_0x9ffa93);});});});};exports[_0xc008('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0x560e28,_0x33f44c){return pm2['list'](function(_0x25e13f,_0x4584e1){if(_0x25e13f){return _0x33f44c(_0x25e13f);}pm2[_0xc008('0x6')]();return _0x560e28(_0x4584e1);});});});};exports[_0xc008('0xa')]=function(_0x3f0ecf){return connect()['then'](function(){return new BPromise(function(_0x5e894e,_0x4bd0f4){return pm2[_0xc008('0xa')](_0x3f0ecf,function(_0x15a6ad,_0x3cafe3){if(_0x15a6ad){return _0x4bd0f4(_0x15a6ad);}pm2[_0xc008('0x6')]();return _0x5e894e(_0x3cafe3);});});});};exports['delete']=function(_0x53b06e){return connect()['then'](function(){return new BPromise(function(_0x5c2668,_0x46042b){return pm2[_0xc008('0xb')](_0x53b06e,function(_0x501137,_0x813397){if(_0x501137){return _0x46042b(_0x501137);}pm2['disconnect']();return _0x5c2668(_0x813397);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0x50261c,_0x5754a0){return pm2['dump'](function(_0x5560b1){if(_0x5560b1){return _0x5754a0(_0x5560b1);}return _0x50261c('saved');});});});};
\ No newline at end of file
index b2a4c95..6c00d59 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xee6e=['../../config/environment','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','findAll','lastMsgAt','minutes','ChatInteraction','timeout','format','length','emit','chatInteraction:update','catch','error','start','lodash','ioredis','../../mysqldb'];(function(_0x5a6f41,_0x3f0149){var _0x59b058=function(_0x55b8e9){while(--_0x55b8e9){_0x5a6f41['push'](_0x5a6f41['shift']());}};_0x59b058(++_0x3f0149);}(_0xee6e,0x128));var _0xeee6=function(_0x40fdfb,_0x2f6546){_0x40fdfb=_0x40fdfb-0x0;var _0x429630=_0xee6e[_0x40fdfb];return _0x429630;};'use strict';var _=require(_0xeee6('0x0'));var moment=require('moment');var Redis=require(_0xeee6('0x1'));var db=require(_0xeee6('0x2'))['db'];var config=require(_0xeee6('0x3'));config[_0xeee6('0x4')]=_['defaults'](config[_0xeee6('0x4')],{'host':_0xeee6('0x5'),'port':0x18eb});var io=require(_0xeee6('0x6'))(new Redis(config[_0xeee6('0x4')]));function closeInteractions(){var _0x23ec13=0x0;var _0x484868=[];return db[_0xeee6('0x7')][_0xeee6('0x8')]({'raw':!![],'attributes':['id',_0xeee6('0x9')],'where':{'id':0x1}})[_0xeee6('0xa')](function(_0x2a8227){_0x23ec13=_0x2a8227[_0xeee6('0x9')];if(_0x23ec13){return db['ChatInteraction'][_0xeee6('0xb')]({'raw':!![],'attributes':['id',_0xeee6('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x2a8227[_0xeee6('0x9')],_0xeee6('0xd'))}}});}else{return[];}})[_0xeee6('0xa')](function(_0x62d53e){_0x484868=_0x62d53e;if(_0x23ec13){return db[_0xeee6('0xe')]['update']({'closeReason':'system','disposition':_0xeee6('0xf'),'closed':!![],'closedAt':moment()[_0xeee6('0x10')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_['map'](_0x484868||[],'id')}});}})[_0xeee6('0xa')](function(_0x3fb096){for(var _0x5f4ecc=0x0;_0x5f4ecc<_0x484868[_0xeee6('0x11')];_0x5f4ecc++){io[_0xeee6('0x12')](_0xeee6('0x13'),{'id':_0x484868[_0x5f4ecc]['id'],'closed':!![]});}})[_0xeee6('0x14')](function(_0x2a45b7){console[_0xeee6('0x15')](_0x2a45b7);});}exports[_0xeee6('0x16')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();};
\ No newline at end of file
+var _0x2f72=['defaults','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','system','timeout','YYYY-MM-DD\x20HH:mm:ss','length','emit','chatInteraction:update','catch','error','start','lodash','moment','ioredis','../../mysqldb','../../config/environment','redis'];(function(_0x15feb1,_0x7ffa2){var _0x576db2=function(_0x39e3ce){while(--_0x39e3ce){_0x15feb1['push'](_0x15feb1['shift']());}};_0x576db2(++_0x7ffa2);}(_0x2f72,0x166));var _0x22f7=function(_0x4ab23f,_0x420372){_0x4ab23f=_0x4ab23f-0x0;var _0x5e6ff8=_0x2f72[_0x4ab23f];return _0x5e6ff8;};'use strict';var _=require(_0x22f7('0x0'));var moment=require(_0x22f7('0x1'));var Redis=require(_0x22f7('0x2'));var db=require(_0x22f7('0x3'))['db'];var config=require(_0x22f7('0x4'));config[_0x22f7('0x5')]=_[_0x22f7('0x6')](config[_0x22f7('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x22f7('0x7'))(new Redis(config[_0x22f7('0x5')]));function closeInteractions(){var _0x45c37b=0x0;var _0x216f96=[];return db[_0x22f7('0x8')][_0x22f7('0x9')]({'raw':!![],'attributes':['id',_0x22f7('0xa')],'where':{'id':0x1}})[_0x22f7('0xb')](function(_0x261813){_0x45c37b=_0x261813[_0x22f7('0xa')];if(_0x45c37b){return db[_0x22f7('0xc')][_0x22f7('0xd')]({'raw':!![],'attributes':['id',_0x22f7('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x22f7('0xf')](_0x261813[_0x22f7('0xa')],_0x22f7('0x10'))}}});}else{return[];}})['then'](function(_0x1cef61){_0x216f96=_0x1cef61;if(_0x45c37b){return db[_0x22f7('0xc')]['update']({'closeReason':_0x22f7('0x11'),'disposition':_0x22f7('0x12'),'closed':!![],'closedAt':moment()['format'](_0x22f7('0x13'))},{'where':{'id':_['map'](_0x216f96||[],'id')}});}})[_0x22f7('0xb')](function(_0x2d87bc){for(var _0x5ca4dc=0x0;_0x5ca4dc<_0x216f96[_0x22f7('0x14')];_0x5ca4dc++){io[_0x22f7('0x15')](_0x22f7('0x16'),{'id':_0x216f96[_0x5ca4dc]['id'],'closed':!![]});}})[_0x22f7('0x17')](function(_0x3ddaed){console[_0x22f7('0x18')](_0x3ddaed);});}exports[_0x22f7('0x19')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();};
\ No newline at end of file
index a418e20..f05dbd0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1778=['deleteJob','delete\x20cron','length','my\x20id','resolve','run\x20job','cron','isBetween','startAt','add','active','endAt','update\x20cron','run','start','util','lodash','cron-job-manager','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','\x22%s\x22\x20<%s>','name','email','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','basename','zip','join','existsSync','status','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','request','SendMail','then','error\x20mail','email\x20sent','catch','error','stringify','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','keyBy','difference','intersection','exists','stop'];(function(_0x35387d,_0x1ba72f){var _0x3aba56=function(_0x42cd08){while(--_0x42cd08){_0x35387d['push'](_0x35387d['shift']());}};_0x3aba56(++_0x1ba72f);}(_0x1778,0xc7));var _0x8177=function(_0x1e6773,_0x138124){_0x1e6773=_0x1e6773-0x0;var _0x4c81a0=_0x1778[_0x1e6773];return _0x4c81a0;};'use strict';var fs=require('fs');var util=require(_0x8177('0x0'));var path=require('path');var _=require(_0x8177('0x1'));var moment=require('moment');var CronJobManager=require(_0x8177('0x2'));var jayson=require('jayson/promise');var BPromise=require(_0x8177('0x3'));var logger=require(_0x8177('0x4'))(_0x8177('0x5'));var db=require(_0x8177('0x6'))['db'];var analyticCustomReportController=require(_0x8177('0x7'));var analyticDefaultReportController=require(_0x8177('0x8'));var client=jayson['client'][_0x8177('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x52d555,_0x301383){return function(){logger[_0x8177('0xa')](_0x8177('0xb'),_0x52d555['email']);var _0xfdef7c=!![];var _0x5a9ece={'tls':{'rejectUnauthorized':![]}};if(_0x52d555[_0x8177('0xc')][_0x8177('0xd')][_0x8177('0xe')]){_0x5a9ece[_0x8177('0xe')]=_0x52d555[_0x8177('0xc')][_0x8177('0xd')][_0x8177('0xe')];}else{_0x5a9ece[_0x8177('0xf')]=_0x52d555['MailAccount'][_0x8177('0xd')]['host'];_0x5a9ece[_0x8177('0x10')]=_0x52d555[_0x8177('0xc')][_0x8177('0xd')][_0x8177('0x10')];_0x5a9ece[_0x8177('0x11')]=_0x52d555[_0x8177('0xc')]['Smtp']['secure'];}if(_0x52d555['MailAccount'][_0x8177('0xd')][_0x8177('0x12')]){_0x5a9ece[_0x8177('0x13')]={'user':_0x52d555['MailAccount'][_0x8177('0xd')][_0x8177('0x14')],'pass':_0x52d555[_0x8177('0xc')]['Smtp'][_0x8177('0x15')]};}var _0x1743e3={'account':_0x5a9ece,'message':{'from':util['format'](_0x8177('0x16'),_0x52d555[_0x8177('0xc')][_0x8177('0x17')],_0x52d555[_0x8177('0xc')][_0x8177('0x18')]||_0x52d555['MailAccount'][_0x8177('0xd')][_0x8177('0x14')]),'to':_0x52d555[_0x8177('0x18')],'cc':_0x52d555['cc'],'bcc':_0x52d555['bcc'],'subject':util[_0x8177('0x19')](_0x8177('0x1a'),_0x301383[_0x8177('0x17')],_0x52d555[_0x8177('0x1b')],_0x52d555[_0x8177('0x1c')])}};var _0x56fc09=path['join'](__dirname,_0x8177('0x1d'));var _0x4ff7ac=_0x301383[_0x8177('0x1e')];var _0x44f273=util['format'](_0x8177('0x1f'),path[_0x8177('0x20')](_0x301383[_0x8177('0x1e')],path['extname'](_0x301383['savename'])),_0x8177('0x21'));var _0x3243c6=path['join'](_0x56fc09,_0x4ff7ac);var _0x113193=path[_0x8177('0x22')](_0x56fc09,_0x44f273);if(fs[_0x8177('0x23')](_0x3243c6)){_0x301383[_0x8177('0x24')]='Sent';_0x1743e3[_0x8177('0x25')][_0x8177('0x26')]=[{'filename':_0x4ff7ac,'path':_0x3243c6}];_0x1743e3[_0x8177('0x25')][_0x8177('0x27')]=util[_0x8177('0x19')](_0x8177('0x28'),JSON['stringify'](_0x301383,null,0x2));}else if(fs[_0x8177('0x23')](_0x113193)){_0x301383[_0x8177('0x24')]='Sent';_0x1743e3[_0x8177('0x25')][_0x8177('0x26')]=[{'filename':_0x44f273,'path':_0x113193}];}else{_0x1743e3['message']['text']=_0x8177('0x29');if(!_0x52d555[_0x8177('0x2a')]){_0xfdef7c=![];logger[_0x8177('0xa')](_0x8177('0x2b'));}}if(_0xfdef7c){return client[_0x8177('0x2c')](_0x8177('0x2d'),_0x1743e3)[_0x8177('0x2e')](function(_0x1f3586){if(_0x1f3586['error']){return logger['error'](_0x8177('0x2f'),JSON['stringify'](_0x1f3586));}return logger['info'](_0x8177('0x30'));})[_0x8177('0x31')](function(_0x1a1930){return logger[_0x8177('0x32')](_0x8177('0x2f'),JSON['stringify'](_0x1a1930));});}};}function handleError(){return function(_0xe2746){return logger[_0x8177('0x32')](JSON[_0x8177('0x33')](_0xe2746));};}function handleResult(_0x504f00){return function(_0x38f134){logger[_0x8177('0xa')](_0x8177('0x34'),JSON[_0x8177('0x33')](_0x38f134));if(_0x504f00[_0x8177('0xc')]&&_0x504f00[_0x8177('0xc')][_0x8177('0xd')]&&!_[_0x8177('0x35')](_0x504f00[_0x8177('0x18')])){setTimeout(handleSendEmail(_0x504f00,_0x38f134),0x3c*0x3e8);}};}function handleJob(_0x1fbf61){return function(){try{if(_[_0x8177('0x35')](_0x1fbf61['subtractNumber'])){return logger[_0x8177('0xa')](_0x8177('0x36'));}if(_[_0x8177('0x35')](_0x1fbf61[_0x8177('0x1c')])){return logger[_0x8177('0xa')](_0x8177('0x37'));}var _0xaca1bd={'startDate':moment()[_0x8177('0x38')](_0x1fbf61['subtractNumber'],_0x1fbf61[_0x8177('0x1c')])['format'](_0x8177('0x39')),'endDate':moment()[_0x8177('0x19')](_0x8177('0x39')),'type':'scheduled','output':_0x1fbf61[_0x8177('0x3a')],'name':_0x1fbf61[_0x8177('0x17')]};if(!_[_0x8177('0x35')](_0x1fbf61[_0x8177('0x3b')])){logger['info'](_0x8177('0x3c'),_0x1fbf61[_0x8177('0x3b')]);return analyticDefaultReportController[_0x8177('0x3d')]({'id':_0x1fbf61[_0x8177('0x3b')]},_0xaca1bd)[_0x8177('0x2e')](handleResult(_0x1fbf61))['catch'](handleError());}if(!_['isNil'](_0x1fbf61[_0x8177('0x3e')])){logger['info'](_0x8177('0x3f'),_0x1fbf61[_0x8177('0x3e')]);return analyticCustomReportController[_0x8177('0x3d')]({'id':_0x1fbf61[_0x8177('0x3e')]},_0xaca1bd)[_0x8177('0x2e')](handleResult(_0x1fbf61))[_0x8177('0x31')](handleError());}}catch(_0x4a6381){logger[_0x8177('0x32')](JSON[_0x8177('0x33')](_0x4a6381));}return logger[_0x8177('0xa')](_0x8177('0x40'));};}function getJobs(_0x497c12){var _0x509486={};if(_0x497c12){_0x509486['id']=_0x497c12;}return db[_0x8177('0x41')][_0x8177('0x42')]({'where':_0x509486,'include':[{'model':db[_0x8177('0xc')],'attributes':['id',_0x8177('0x17'),'email'],'include':[{'model':db[_0x8177('0x43')],'as':'Smtp'}]}]})[_0x8177('0x2e')](function(_0x2a1e43){var _0x99a5ad=_[_0x8177('0x44')](manager[_0x8177('0x45')]);var _0x5b2b85=_[_0x8177('0x46')](_0x2a1e43,function(_0x380dc4){return _0x380dc4['id'][_0x8177('0x47')]();});var _0x5e8589=_[_0x8177('0x48')](_0x2a1e43,function(_0x2ae1eb){return _0x2ae1eb['id']['toString']();});var _0x68c0cd=_0x497c12?_0x5b2b85:_[_0x8177('0x49')](_0x5b2b85,_0x99a5ad);var _0x34027e=_[_0x8177('0x4a')](_0x5b2b85,_0x99a5ad);var _0x41c90f=_[_0x8177('0x49')](_0x99a5ad,_0x5b2b85);var _0x258dd0;var _0x584cc9;for(_0x258dd0=0x0;_0x258dd0<_0x41c90f['length']&&!_0x497c12;_0x258dd0+=0x1){_0x584cc9=_0x41c90f[_0x258dd0][_0x8177('0x47')]();if(manager[_0x8177('0x4b')](_0x584cc9)){manager[_0x8177('0x4c')](_0x584cc9);manager[_0x8177('0x4d')](_0x584cc9);logger['info'](_0x8177('0x4e'),_0x584cc9);}}logger[_0x8177('0xa')]('toRun',JSON[_0x8177('0x33')](_0x68c0cd));for(_0x258dd0=0x0;_0x258dd0<_0x68c0cd[_0x8177('0x4f')];_0x258dd0+=0x1){_0x584cc9=_0x68c0cd[_0x258dd0][_0x8177('0x47')]();logger[_0x8177('0xa')]('index',_0x584cc9);if(_0x497c12){logger['info'](_0x8177('0x50'),_0x497c12);logger[_0x8177('0xa')](JSON[_0x8177('0x33')](_0x5e8589[_0x584cc9]));BPromise[_0x8177('0x51')]()[_0x8177('0x2e')](handleJob(_0x5e8589[_0x584cc9]));logger[_0x8177('0xa')](_0x8177('0x52'),_0x5e8589[_0x584cc9]['name'],_0x5e8589[_0x584cc9][_0x8177('0x53')]);}else if(_0x5e8589[_0x584cc9][_0x8177('0x53')]&&_0x5e8589[_0x584cc9]['active']&&moment()[_0x8177('0x54')](_0x5e8589[_0x584cc9][_0x8177('0x55')],_0x5e8589[_0x584cc9]['endAt'])){manager[_0x8177('0x56')](_0x584cc9,_0x5e8589[_0x584cc9][_0x8177('0x53')],handleJob(_0x5e8589[_0x584cc9]));manager['start'](_0x584cc9);logger[_0x8177('0xa')]('add\x20cron',_0x5e8589[_0x584cc9][_0x8177('0x17')],_0x5e8589[_0x584cc9]['cron']);}else if(manager[_0x8177('0x4b')](_0x584cc9)){manager[_0x8177('0x4c')](_0x584cc9);manager[_0x8177('0x4d')](_0x584cc9);logger[_0x8177('0xa')]('stop\x20cron',_0x5e8589[_0x584cc9]['name'],_0x5e8589[_0x584cc9][_0x8177('0x53')]);}}for(_0x258dd0=0x0,_0x584cc9;_0x258dd0<_0x34027e['length']&&!_0x497c12;_0x258dd0+=0x1){_0x584cc9=_0x34027e[_0x258dd0][_0x8177('0x47')]();if(manager[_0x8177('0x4b')](_0x584cc9)){if(_0x5e8589[_0x584cc9][_0x8177('0x53')]&&_0x5e8589[_0x584cc9][_0x8177('0x57')]&&moment()['isBetween'](_0x5e8589[_0x584cc9]['startAt'],_0x5e8589[_0x584cc9][_0x8177('0x58')])){manager['update'](_0x584cc9,_0x5e8589[_0x584cc9][_0x8177('0x53')],handleJob(_0x5e8589[_0x584cc9]));logger[_0x8177('0xa')](_0x8177('0x59'),_0x5e8589[_0x584cc9][_0x8177('0x17')],_0x5e8589[_0x584cc9][_0x8177('0x53')]);}else{manager['stop'](_0x584cc9);manager[_0x8177('0x4d')](_0x584cc9);logger['info']('stop\x20cron',_0x5e8589[_0x584cc9][_0x8177('0x17')],_0x5e8589[_0x584cc9][_0x8177('0x53')]);}}}})[_0x8177('0x31')](function(_0x25a362){logger[_0x8177('0x32')](JSON[_0x8177('0x33')](_0x25a362));});}exports[_0x8177('0x5a')]=function(_0xf452dd){return getJobs(_0xf452dd);};exports[_0x8177('0x5b')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();};
\ No newline at end of file
+var _0x8615=['MailAccount','host','secure','auth','user','pass','format','\x22%s\x22\x20<%s>','name','email','bcc','Report\x20%s\x20last\x20%s\x20%s','join','../../files/reports','savename','%s.%s','zip','status','Sent','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','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','error','error\x20mail','email\x20sent','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','subtractNumber','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','then','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','findAll','MailServerOut','keys','jobs','map','toString','keyBy','difference','intersection','exists','stop','deleteJob','toRun','length','index','my\x20id','resolve','run\x20job','cron','isBetween','startAt','add','start','active','endAt','update','stop\x20cron','run','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','Smtp','service'];(function(_0x5d802d,_0x115f5a){var _0x4ab38e=function(_0x454e8f){while(--_0x454e8f){_0x5d802d['push'](_0x5d802d['shift']());}};_0x4ab38e(++_0x115f5a);}(_0x8615,0x10c));var _0x5861=function(_0x2f6c38,_0x4b067a){_0x2f6c38=_0x2f6c38-0x0;var _0x66279f=_0x8615[_0x2f6c38];return _0x66279f;};'use strict';var fs=require('fs');var util=require(_0x5861('0x0'));var path=require(_0x5861('0x1'));var _=require(_0x5861('0x2'));var moment=require(_0x5861('0x3'));var CronJobManager=require(_0x5861('0x4'));var jayson=require(_0x5861('0x5'));var BPromise=require(_0x5861('0x6'));var logger=require('../logger')(_0x5861('0x7'));var db=require(_0x5861('0x8'))['db'];var analyticCustomReportController=require(_0x5861('0x9'));var analyticDefaultReportController=require(_0x5861('0xa'));var client=jayson[_0x5861('0xb')][_0x5861('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x146e76,_0x331735){return function(){logger[_0x5861('0xd')](_0x5861('0xe'),_0x146e76['email']);var _0x2cb82c=!![];var _0x5c3e44={'tls':{'rejectUnauthorized':![]}};if(_0x146e76['MailAccount'][_0x5861('0xf')]['service']){_0x5c3e44[_0x5861('0x10')]=_0x146e76[_0x5861('0x11')][_0x5861('0xf')][_0x5861('0x10')];}else{_0x5c3e44['host']=_0x146e76[_0x5861('0x11')]['Smtp'][_0x5861('0x12')];_0x5c3e44['port']=_0x146e76[_0x5861('0x11')][_0x5861('0xf')]['port'];_0x5c3e44[_0x5861('0x13')]=_0x146e76[_0x5861('0x11')][_0x5861('0xf')][_0x5861('0x13')];}if(_0x146e76[_0x5861('0x11')][_0x5861('0xf')]['authentication']){_0x5c3e44[_0x5861('0x14')]={'user':_0x146e76[_0x5861('0x11')][_0x5861('0xf')][_0x5861('0x15')],'pass':_0x146e76[_0x5861('0x11')][_0x5861('0xf')][_0x5861('0x16')]};}var _0x588802={'account':_0x5c3e44,'message':{'from':util[_0x5861('0x17')](_0x5861('0x18'),_0x146e76[_0x5861('0x11')][_0x5861('0x19')],_0x146e76[_0x5861('0x11')][_0x5861('0x1a')]||_0x146e76[_0x5861('0x11')][_0x5861('0xf')][_0x5861('0x15')]),'to':_0x146e76[_0x5861('0x1a')],'cc':_0x146e76['cc'],'bcc':_0x146e76[_0x5861('0x1b')],'subject':util[_0x5861('0x17')](_0x5861('0x1c'),_0x331735[_0x5861('0x19')],_0x146e76['subtractNumber'],_0x146e76['subtractUnit'])}};var _0x1fb734=path[_0x5861('0x1d')](__dirname,_0x5861('0x1e'));var _0x478817=_0x331735[_0x5861('0x1f')];var _0x314307=util[_0x5861('0x17')](_0x5861('0x20'),path['basename'](_0x331735[_0x5861('0x1f')],path['extname'](_0x331735[_0x5861('0x1f')])),_0x5861('0x21'));var _0x3965e4=path['join'](_0x1fb734,_0x478817);var _0x110fd1=path[_0x5861('0x1d')](_0x1fb734,_0x314307);if(fs['existsSync'](_0x3965e4)){_0x331735[_0x5861('0x22')]=_0x5861('0x23');_0x588802['message'][_0x5861('0x24')]=[{'filename':_0x478817,'path':_0x3965e4}];_0x588802[_0x5861('0x25')][_0x5861('0x26')]=util['format'](_0x5861('0x27'),JSON[_0x5861('0x28')](_0x331735,null,0x2));}else if(fs[_0x5861('0x29')](_0x110fd1)){_0x331735[_0x5861('0x22')]=_0x5861('0x23');_0x588802[_0x5861('0x25')]['attachments']=[{'filename':_0x314307,'path':_0x110fd1}];}else{_0x588802[_0x5861('0x25')][_0x5861('0x26')]=_0x5861('0x2a');if(!_0x146e76[_0x5861('0x2b')]){_0x2cb82c=![];logger[_0x5861('0xd')](_0x5861('0x2c'));}}if(_0x2cb82c){return client[_0x5861('0x2d')](_0x5861('0x2e'),_0x588802)['then'](function(_0xc0dbb2){if(_0xc0dbb2[_0x5861('0x2f')]){return logger[_0x5861('0x2f')](_0x5861('0x30'),JSON[_0x5861('0x28')](_0xc0dbb2));}return logger[_0x5861('0xd')](_0x5861('0x31'));})['catch'](function(_0x384eb5){return logger['error'](_0x5861('0x30'),JSON[_0x5861('0x28')](_0x384eb5));});}};}function handleError(){return function(_0x487d17){return logger[_0x5861('0x2f')](JSON['stringify'](_0x487d17));};}function handleResult(_0x111e4c){return function(_0x1b3f77){logger[_0x5861('0xd')]('data',JSON[_0x5861('0x28')](_0x1b3f77));if(_0x111e4c['MailAccount']&&_0x111e4c[_0x5861('0x11')][_0x5861('0xf')]&&!_[_0x5861('0x32')](_0x111e4c['email'])){setTimeout(handleSendEmail(_0x111e4c,_0x1b3f77),0x3c*0x3e8);}};}function handleJob(_0x29f863){return function(){try{if(_['isNil'](_0x29f863['subtractNumber'])){return logger[_0x5861('0xd')](_0x5861('0x33'));}if(_[_0x5861('0x32')](_0x29f863[_0x5861('0x34')])){return logger['info'](_0x5861('0x35'));}var _0x181872={'startDate':moment()[_0x5861('0x36')](_0x29f863[_0x5861('0x37')],_0x29f863[_0x5861('0x34')])[_0x5861('0x17')](_0x5861('0x38')),'endDate':moment()[_0x5861('0x17')](_0x5861('0x38')),'type':_0x5861('0x39'),'output':_0x29f863[_0x5861('0x3a')],'name':_0x29f863['name']};if(!_['isNil'](_0x29f863['DefaultReportId'])){logger[_0x5861('0xd')](_0x5861('0x3b'),_0x29f863[_0x5861('0x3c')]);return analyticDefaultReportController[_0x5861('0x3d')]({'id':_0x29f863[_0x5861('0x3c')]},_0x181872)[_0x5861('0x3e')](handleResult(_0x29f863))[_0x5861('0x3f')](handleError());}if(!_[_0x5861('0x32')](_0x29f863[_0x5861('0x40')])){logger['info'](_0x5861('0x41'),_0x29f863[_0x5861('0x40')]);return analyticCustomReportController[_0x5861('0x3d')]({'id':_0x29f863['CustomReportId']},_0x181872)[_0x5861('0x3e')](handleResult(_0x29f863))[_0x5861('0x3f')](handleError());}}catch(_0x1895e7){logger['error'](JSON[_0x5861('0x28')](_0x1895e7));}return logger[_0x5861('0xd')]('no\x20report\x20id');};}function getJobs(_0x1a1921){var _0xa5d4f9={};if(_0x1a1921){_0xa5d4f9['id']=_0x1a1921;}return db[_0x5861('0x42')][_0x5861('0x43')]({'where':_0xa5d4f9,'include':[{'model':db[_0x5861('0x11')],'attributes':['id',_0x5861('0x19'),_0x5861('0x1a')],'include':[{'model':db[_0x5861('0x44')],'as':_0x5861('0xf')}]}]})[_0x5861('0x3e')](function(_0x284884){var _0x508234=_[_0x5861('0x45')](manager[_0x5861('0x46')]);var _0x703cf9=_[_0x5861('0x47')](_0x284884,function(_0x26428a){return _0x26428a['id'][_0x5861('0x48')]();});var _0x4090e3=_[_0x5861('0x49')](_0x284884,function(_0x383352){return _0x383352['id'][_0x5861('0x48')]();});var _0x21439c=_0x1a1921?_0x703cf9:_[_0x5861('0x4a')](_0x703cf9,_0x508234);var _0x3829ac=_[_0x5861('0x4b')](_0x703cf9,_0x508234);var _0x5d85a1=_[_0x5861('0x4a')](_0x508234,_0x703cf9);var _0x2ef6aa;var _0x406d67;for(_0x2ef6aa=0x0;_0x2ef6aa<_0x5d85a1['length']&&!_0x1a1921;_0x2ef6aa+=0x1){_0x406d67=_0x5d85a1[_0x2ef6aa][_0x5861('0x48')]();if(manager[_0x5861('0x4c')](_0x406d67)){manager[_0x5861('0x4d')](_0x406d67);manager[_0x5861('0x4e')](_0x406d67);logger[_0x5861('0xd')]('delete\x20cron',_0x406d67);}}logger['info'](_0x5861('0x4f'),JSON[_0x5861('0x28')](_0x21439c));for(_0x2ef6aa=0x0;_0x2ef6aa<_0x21439c[_0x5861('0x50')];_0x2ef6aa+=0x1){_0x406d67=_0x21439c[_0x2ef6aa][_0x5861('0x48')]();logger[_0x5861('0xd')](_0x5861('0x51'),_0x406d67);if(_0x1a1921){logger[_0x5861('0xd')](_0x5861('0x52'),_0x1a1921);logger[_0x5861('0xd')](JSON[_0x5861('0x28')](_0x4090e3[_0x406d67]));BPromise[_0x5861('0x53')]()['then'](handleJob(_0x4090e3[_0x406d67]));logger[_0x5861('0xd')](_0x5861('0x54'),_0x4090e3[_0x406d67]['name'],_0x4090e3[_0x406d67]['cron']);}else if(_0x4090e3[_0x406d67][_0x5861('0x55')]&&_0x4090e3[_0x406d67]['active']&&moment()[_0x5861('0x56')](_0x4090e3[_0x406d67][_0x5861('0x57')],_0x4090e3[_0x406d67]['endAt'])){manager[_0x5861('0x58')](_0x406d67,_0x4090e3[_0x406d67][_0x5861('0x55')],handleJob(_0x4090e3[_0x406d67]));manager[_0x5861('0x59')](_0x406d67);logger[_0x5861('0xd')]('add\x20cron',_0x4090e3[_0x406d67][_0x5861('0x19')],_0x4090e3[_0x406d67][_0x5861('0x55')]);}else if(manager[_0x5861('0x4c')](_0x406d67)){manager[_0x5861('0x4d')](_0x406d67);manager[_0x5861('0x4e')](_0x406d67);logger[_0x5861('0xd')]('stop\x20cron',_0x4090e3[_0x406d67]['name'],_0x4090e3[_0x406d67][_0x5861('0x55')]);}}for(_0x2ef6aa=0x0,_0x406d67;_0x2ef6aa<_0x3829ac['length']&&!_0x1a1921;_0x2ef6aa+=0x1){_0x406d67=_0x3829ac[_0x2ef6aa][_0x5861('0x48')]();if(manager['exists'](_0x406d67)){if(_0x4090e3[_0x406d67]['cron']&&_0x4090e3[_0x406d67][_0x5861('0x5a')]&&moment()[_0x5861('0x56')](_0x4090e3[_0x406d67][_0x5861('0x57')],_0x4090e3[_0x406d67][_0x5861('0x5b')])){manager[_0x5861('0x5c')](_0x406d67,_0x4090e3[_0x406d67][_0x5861('0x55')],handleJob(_0x4090e3[_0x406d67]));logger['info']('update\x20cron',_0x4090e3[_0x406d67][_0x5861('0x19')],_0x4090e3[_0x406d67]['cron']);}else{manager['stop'](_0x406d67);manager[_0x5861('0x4e')](_0x406d67);logger[_0x5861('0xd')](_0x5861('0x5d'),_0x4090e3[_0x406d67][_0x5861('0x19')],_0x4090e3[_0x406d67][_0x5861('0x55')]);}}}})[_0x5861('0x3f')](function(_0x4ef0e1){logger[_0x5861('0x2f')](JSON['stringify'](_0x4ef0e1));});}exports[_0x5861('0x5e')]=function(_0x2ec382){return getJobs(_0x2ec382);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();};
\ No newline at end of file
index c3c442c..09ef414 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0385=['bulkCreate','contacts2','finished\x20populating','hopper2','catch','util','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','log','contacts1','CmHopper','hopper1'];(function(_0x379373,_0x225e73){var _0x12597d=function(_0x17601b){while(--_0x17601b){_0x379373['push'](_0x379373['shift']());}};_0x12597d(++_0x225e73);}(_0x0385,0x181));var _0x5038=function(_0x4887b7,_0x3f541b){_0x4887b7=_0x4887b7-0x0;var _0x5168dd=_0x0385[_0x4887b7];return _0x5168dd;};'use strict';var util=require(_0x5038('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x5038('0x1')]({'id':i,'firstName':_0x5038('0x2')+i,'lastName':_0x5038('0x3')+i,'phone':0xf879fb460+i,'email':_0x5038('0x4')+i+_0x5038('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x5038('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x5038('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5038('0x6')](),'updatedAt':Date[_0x5038('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x5038('0x3')+i,'phone':0xf879fb460+i,'email':_0x5038('0x4')+i+_0x5038('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x5038('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x5038('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5038('0x6')](),'updatedAt':Date['now']()});}db[_0x5038('0x7')][_0x5038('0x8')]({'where':{}})[_0x5038('0x9')](function(){return db['CmContact']['bulkCreate'](contacts);})['then'](function(){console[_0x5038('0xa')]('finished\x20populating',_0x5038('0xb'));return db[_0x5038('0xc')][_0x5038('0x8')]({'where':{}});})[_0x5038('0x9')](function(){return db['CmHopper']['bulkCreate'](hopper);})[_0x5038('0x9')](function(){console[_0x5038('0xa')]('finished\x20populating',_0x5038('0xd'));return db[_0x5038('0x7')][_0x5038('0xe')](contacts2);})[_0x5038('0x9')](function(){console[_0x5038('0xa')]('finished\x20populating',_0x5038('0xf'));return db[_0x5038('0xc')][_0x5038('0xe')](hopper2);})[_0x5038('0x9')](function(){console[_0x5038('0xa')](_0x5038('0x10'),_0x5038('0x11'));})[_0x5038('0x12')](function(_0x3113b9){console['log'](_0x3113b9);});
\ No newline at end of file
+var _0x8df8=['../mysqldb','push','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','bulkCreate','then','finished\x20populating','CmHopper','log','hopper1','contacts2','catch','util'];(function(_0x3bfe6f,_0x24e2c9){var _0x7d52ed=function(_0x34ee50){while(--_0x34ee50){_0x3bfe6f['push'](_0x3bfe6f['shift']());}};_0x7d52ed(++_0x24e2c9);}(_0x8df8,0xed));var _0x88df=function(_0x28bc21,_0x26bb94){_0x28bc21=_0x28bc21-0x0;var _0x1d8569=_0x8df8[_0x28bc21];return _0x1d8569;};'use strict';var util=require(_0x88df('0x0'));var db=require(_0x88df('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x88df('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x88df('0x3')+i,'phone':0xf879fb460+i,'email':_0x88df('0x4')+i+_0x88df('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x88df('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x88df('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x88df('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x88df('0x3')+i,'phone':0xf879fb460+i,'email':_0x88df('0x4')+i+_0x88df('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x88df('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x88df('0x6')](),'updatedAt':Date[_0x88df('0x6')]()});}db[_0x88df('0x7')][_0x88df('0x8')]({'where':{}})['then'](function(){return db['CmContact'][_0x88df('0x9')](contacts);})[_0x88df('0xa')](function(){console['log'](_0x88df('0xb'),'contacts1');return db[_0x88df('0xc')]['destroy']({'where':{}});})[_0x88df('0xa')](function(){return db[_0x88df('0xc')][_0x88df('0x9')](hopper);})[_0x88df('0xa')](function(){console[_0x88df('0xd')]('finished\x20populating',_0x88df('0xe'));return db[_0x88df('0x7')][_0x88df('0x9')](contacts2);})['then'](function(){console[_0x88df('0xd')](_0x88df('0xb'),_0x88df('0xf'));return db['CmHopper'][_0x88df('0x9')](hopper2);})[_0x88df('0xa')](function(){console['log']('finished\x20populating','hopper2');})[_0x88df('0x10')](function(_0x3a6489){console[_0x88df('0xd')](_0x3a6489);});
\ No newline at end of file
index ec51721..f4de7bf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8ff3=['password','friend','wss','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','add\x20user','catch','log','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x8ff3,0x1b1));var _0x38ff=function(_0x5d9a85,_0x55221e){_0x5d9a85=_0x5d9a85-0x0;var _0x1ef8aa=_0x8ff3[_0x5d9a85];return _0x1ef8aa;};'use strict';var util=require(_0x38ff('0x0'));var db=require(_0x38ff('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x38ff('0x2')]({'name':util[_0x38ff('0x3')](_0x38ff('0x4'),'agent',i),'fullname':util[_0x38ff('0x3')](_0x38ff('0x4'),_0x38ff('0x5'),i),'email':util['format'](_0x38ff('0x6'),'agent',i),'role':_0x38ff('0x5'),'password':_0x38ff('0x7'),'internal':0xfa0+i,'type':_0x38ff('0x8'),'transport':['udp','ws',_0x38ff('0x9')],'disallow':['all'],'allow':[_0x38ff('0xa')],'defaultuser':util[_0x38ff('0x3')](_0x38ff('0x4'),'agent',i),'encryption':'yes','avpf':_0x38ff('0xb'),'force_avp':_0x38ff('0xb'),'icesupport':_0x38ff('0xb'),'dtlsenable':_0x38ff('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x38ff('0xc'),'dtlssetup':_0x38ff('0xd'),'callerid':util[_0x38ff('0x3')](_0x38ff('0xe'),util[_0x38ff('0x3')]('%s%s',_0x38ff('0x5'),i),0xfa0+i)});}db[_0x38ff('0xf')][_0x38ff('0x10')](users)['then'](function(){console['log'](_0x38ff('0x11'));})[_0x38ff('0x12')](function(_0x42727e){console[_0x38ff('0x13')](_0x42727e);});
\ No newline at end of file
+var _0x16bb=['format','%s%s','%s%s@xcally.com','agent','friend','udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','catch','util','../mysqldb'];(function(_0x497e23,_0x57b995){var _0xa94bef=function(_0x25cfdb){while(--_0x25cfdb){_0x497e23['push'](_0x497e23['shift']());}};_0xa94bef(++_0x57b995);}(_0x16bb,0x1ec));var _0xb16b=function(_0xfc53fc,_0x4204d6){_0xfc53fc=_0xfc53fc-0x0;var _0x423828=_0x16bb[_0xfc53fc];return _0x423828;};'use strict';var util=require(_0xb16b('0x0'));var db=require(_0xb16b('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xb16b('0x2')](_0xb16b('0x3'),'agent',i),'fullname':util[_0xb16b('0x2')]('%s%s','agent',i),'email':util[_0xb16b('0x2')](_0xb16b('0x4'),_0xb16b('0x5'),i),'role':_0xb16b('0x5'),'password':'password','internal':0xfa0+i,'type':_0xb16b('0x6'),'transport':[_0xb16b('0x7'),'ws','wss'],'disallow':[_0xb16b('0x8')],'allow':[_0xb16b('0x9')],'defaultuser':util[_0xb16b('0x2')](_0xb16b('0x3'),'agent',i),'encryption':_0xb16b('0xa'),'avpf':_0xb16b('0xa'),'force_avp':_0xb16b('0xa'),'icesupport':_0xb16b('0xa'),'dtlsenable':_0xb16b('0xa'),'dtlsverify':'no','dtlscertfile':_0xb16b('0xb'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0xb16b('0xc'),'callerid':util['format'](_0xb16b('0xd'),util['format'](_0xb16b('0x3'),_0xb16b('0x5'),i),0xfa0+i)});}db[_0xb16b('0xe')][_0xb16b('0xf')](users)[_0xb16b('0x10')](function(){console[_0xb16b('0x11')]('add\x20user');})[_0xb16b('0x12')](function(_0x300fc9){console['log'](_0x300fc9);});
\ No newline at end of file
index 6949168..0937d1c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x661a=['agent','telephone','ivr','UserProfileSection','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','then','map','where','Campaign','type','format','%s:queue:%s','Agents','length','user:%s','query','find','userProfileId','handshake','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','admin','voice:inbound','voice:outbound','include','push','VoiceQueue','ChatQueue','SmsQueue','OpenchannelQueue','Trunk','user','FaxQueues','FaxQueue','MailQueue','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','all','voice','chat','fax','sms','openchannel','trunk:%s','leave','removeChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','catch','log','join','default','setMaxListeners','address','request','connection','remoteAddress','remotePort','connectedAt','nsp','disconnect','bluebird','../mysqldb','./environment','name','User','role'];(function(_0x2e5370,_0x33cb32){var _0x5d21d1=function(_0x451c8e){while(--_0x451c8e){_0x2e5370['push'](_0x2e5370['shift']());}};_0x5d21d1(++_0x33cb32);}(_0x661a,0x10b));var _0xa661=function(_0x3a07c1,_0x34d57f){_0x3a07c1=_0x3a07c1-0x0;var _0x2bbe15=_0x661a[_0x3a07c1];return _0x2bbe15;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0xa661('0x0'));var db=require(_0xa661('0x1'))['db'];var config=require(_0xa661('0x2'));var queryQueues={'attributes':['id',_0xa661('0x3')],'include':[{'as':'Agents','model':db[_0xa661('0x4')],'attributes':['id','name',_0xa661('0x5')],'raw':!![],'where':{'role':_0xa661('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xa661('0x3')],'where':{'role':_0xa661('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xa661('0x3')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xa661('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xa661('0x3'),'type'],'where':{'type':_0xa661('0x8')}};function getAssociatedResources(_0xd6e4f2,_0x2f43cd,_0x1031bb){return db[_0xa661('0x9')]['findOne']({'where':{'name':_0xd6e4f2,'userProfileId':_0x2f43cd},'raw':!![]})['then'](function(_0x426b3c){if(_0x426b3c){if(_0x426b3c[_0xa661('0xa')]){switch(_0xd6e4f2){case _0xa661('0xb'):case _0xa661('0xc'):case'FaxQueues':case _0xa661('0xd'):case _0xa661('0xe'):case _0xa661('0xf'):return db[_0x1031bb][_0xa661('0x10')](queryQueues);case _0xa661('0x11'):return db[_0x1031bb][_0xa661('0x10')](queryTelephones);case _0xa661('0x12'):return db[_0x1031bb][_0xa661('0x10')](queryTrunks);case _0xa661('0x13'):return db[_0x1031bb][_0xa661('0x10')](queryCampaigns);}}else{return db['UserProfileResource']['findAll']({'attributes':[_0xa661('0x14')],'where':{'sectionId':_0x426b3c['id']},'raw':!![]})[_0xa661('0x15')](function(_0x395250){if(_0x395250){var _0x44c1c4={'where':{'id':_[_0xa661('0x16')](_0x395250,'resourceId')},'raw':!![]};switch(_0x1031bb){case _0xa661('0x4'):_0x44c1c4[_0xa661('0x17')][_0xa661('0x5')]=_0xa661('0x7');break;case _0xa661('0x18'):_0x44c1c4[_0xa661('0x17')][_0xa661('0x19')]=_0xa661('0x8');break;}return db[_0x1031bb][_0xa661('0x10')](_0x44c1c4);}else{return[];}});}}else{return[];}})[_0xa661('0x15')](function(_0x4f46ac){return _0x4f46ac;});}function joinOrLeaveQueues(_0x16c327,_0x1ff1b4,_0x2a0c43,_0x4b2870){_0x16c327[_0x1ff1b4](util[_0xa661('0x1a')](_0xa661('0x1b'),_0x2a0c43,_0x4b2870['name']));if(_0x4b2870[_0xa661('0x1c')]){for(var _0x3b9d89=0x0;_0x3b9d89<_0x4b2870[_0xa661('0x1c')][_0xa661('0x1d')];_0x3b9d89+=0x1){_0x16c327[_0x1ff1b4](util['format'](_0xa661('0x1e'),_0x4b2870[_0xa661('0x1c')][_0x3b9d89][_0xa661('0x3')]));}}}function joinOrLeave(_0x4796b9,_0x2d1b9a,_0xd804db){var _0x50be7f;if(_0x4796b9['handshake'][_0xa661('0x1f')]['id']){db[_0xa661('0x4')][_0xa661('0x20')]({'attributes':['id','name',_0xa661('0x5'),_0xa661('0x21')],'where':{'id':_0x4796b9[_0xa661('0x22')][_0xa661('0x1f')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0xa661('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xa661('0x24')],'as':_0xa661('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xa661('0x26')],'as':_0xa661('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xa661('0x28')],'as':_0xa661('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xa661('0x2a')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]}]})[_0xa661('0x15')](function(_0x48cd8d){if(_0x48cd8d){_0x50be7f=_0x48cd8d;_0x4796b9[_0x2d1b9a](util[_0xa661('0x1a')](_0xa661('0x1e'),_0x48cd8d[_0xa661('0x3')]));var _0x1f842f=[];switch(_0x48cd8d['role']){case _0xa661('0x2b'):_0x4796b9[_0x2d1b9a](_0xa661('0x2c'));_0x4796b9[_0x2d1b9a](_0xa661('0x2d'));if(queryQueues['hasOwnProperty'](_0xa661('0x2e'))){delete queryQueues[_0xa661('0x2e')];}_0x1f842f[_0xa661('0x2f')](db[_0xa661('0x30')][_0xa661('0x10')](queryQueues));_0x1f842f[_0xa661('0x2f')](db[_0xa661('0x31')]['findAll'](queryQueues));_0x1f842f['push'](db['FaxQueue'][_0xa661('0x10')](queryQueues));_0x1f842f['push'](db[_0xa661('0x32')][_0xa661('0x10')](queryQueues));_0x1f842f['push'](db['MailQueue'][_0xa661('0x10')](queryQueues));_0x1f842f[_0xa661('0x2f')](db[_0xa661('0x33')][_0xa661('0x10')](queryQueues));_0x1f842f[_0xa661('0x2f')](db[_0xa661('0x4')][_0xa661('0x10')](queryTelephones));_0x1f842f['push'](db[_0xa661('0x34')][_0xa661('0x10')](queryTrunks));_0x1f842f['push'](db[_0xa661('0x18')][_0xa661('0x10')](queryCampaigns));_0x1f842f[_0xa661('0x2f')](db[_0xa661('0x4')][_0xa661('0x10')](queryAgents));break;case _0xa661('0x35'):_0x4796b9[_0x2d1b9a](_0xa661('0x2c'));_0x4796b9[_0x2d1b9a]('voice:outbound');_0x1f842f[_0xa661('0x2f')](getAssociatedResources(_0xa661('0xb'),_0x48cd8d[_0xa661('0x21')],'VoiceQueue'));_0x1f842f[_0xa661('0x2f')](getAssociatedResources('ChatQueues',_0x48cd8d[_0xa661('0x21')],_0xa661('0x31')));_0x1f842f[_0xa661('0x2f')](getAssociatedResources(_0xa661('0x36'),_0x48cd8d[_0xa661('0x21')],_0xa661('0x37')));_0x1f842f[_0xa661('0x2f')](getAssociatedResources(_0xa661('0xd'),_0x48cd8d[_0xa661('0x21')],'SmsQueue'));_0x1f842f[_0xa661('0x2f')](getAssociatedResources(_0xa661('0xe'),_0x48cd8d[_0xa661('0x21')],_0xa661('0x38')));_0x1f842f['push'](getAssociatedResources(_0xa661('0xf'),_0x48cd8d[_0xa661('0x21')],_0xa661('0x33')));_0x1f842f[_0xa661('0x2f')](getAssociatedResources('Telephones',_0x48cd8d['userProfileId'],_0xa661('0x4')));_0x1f842f[_0xa661('0x2f')](getAssociatedResources(_0xa661('0x12'),_0x48cd8d[_0xa661('0x21')],_0xa661('0x34')));_0x1f842f[_0xa661('0x2f')](getAssociatedResources(_0xa661('0x13'),_0x48cd8d[_0xa661('0x21')],_0xa661('0x18')));_0x1f842f[_0xa661('0x2f')](db[_0xa661('0x4')]['findAll'](queryAgents));break;case _0xa661('0x6'):_0x4796b9[_0x2d1b9a](_0xa661('0x2c'));_0x4796b9[_0x2d1b9a]('voice:outbound');_0x1f842f[_0xa661('0x2f')](_0x48cd8d['getVoiceQueues']({'attributes':['id',_0xa661('0x3')]}));_0x1f842f[_0xa661('0x2f')](_0x48cd8d[_0xa661('0x39')]({'attributes':['id',_0xa661('0x3')]}));_0x1f842f[_0xa661('0x2f')](_0x48cd8d[_0xa661('0x3a')]({'attributes':['id',_0xa661('0x3')]}));_0x1f842f[_0xa661('0x2f')](_0x48cd8d['getSmsQueues']({'attributes':['id',_0xa661('0x3')]}));_0x1f842f[_0xa661('0x2f')](_0x48cd8d[_0xa661('0x3b')]({'attributes':['id','name']}));_0x1f842f[_0xa661('0x2f')](_0x48cd8d[_0xa661('0x3c')]({'attributes':['id',_0xa661('0x3')]}));break;}return BPromise[_0xa661('0x3d')](_0x1f842f);}})[_0xa661('0x15')](function(_0x373034){if(_0x373034&&_0x373034[_0xa661('0x1d')]){for(var _0x1c051a=0x0;_0x1c051a<_0x373034['length'];_0x1c051a+=0x1){for(var _0x22ddbb=0x0;_0x22ddbb<_0x373034[_0x1c051a]['length'];_0x22ddbb+=0x1){switch(_0x1c051a){case 0x0:joinOrLeaveQueues(_0x4796b9,_0x2d1b9a,_0xa661('0x3e'),_0x373034[_0x1c051a][_0x22ddbb]);break;case 0x1:joinOrLeaveQueues(_0x4796b9,_0x2d1b9a,_0xa661('0x3f'),_0x373034[_0x1c051a][_0x22ddbb]);break;case 0x2:joinOrLeaveQueues(_0x4796b9,_0x2d1b9a,_0xa661('0x40'),_0x373034[_0x1c051a][_0x22ddbb]);break;case 0x3:joinOrLeaveQueues(_0x4796b9,_0x2d1b9a,_0xa661('0x41'),_0x373034[_0x1c051a][_0x22ddbb]);break;case 0x4:joinOrLeaveQueues(_0x4796b9,_0x2d1b9a,'mail',_0x373034[_0x1c051a][_0x22ddbb]);break;case 0x5:joinOrLeaveQueues(_0x4796b9,_0x2d1b9a,_0xa661('0x42'),_0x373034[_0x1c051a][_0x22ddbb]);break;case 0x6:_0x4796b9[_0x2d1b9a](util[_0xa661('0x1a')]('telephone:%s',_0x373034[_0x1c051a][_0x22ddbb]['name']));break;case 0x7:_0x4796b9[_0x2d1b9a](util['format'](_0xa661('0x43'),_0x373034[_0x1c051a][_0x22ddbb][_0xa661('0x3')]));break;case 0x8:_0x4796b9[_0x2d1b9a](util[_0xa661('0x1a')]('campaign:%s:%s',_0x373034[_0x1c051a][_0x22ddbb][_0xa661('0x19')],_0x373034[_0x1c051a][_0x22ddbb][_0xa661('0x3')]));break;case 0x9:_0x4796b9[_0x2d1b9a](util[_0xa661('0x1a')](_0xa661('0x1e'),_0x373034[_0x1c051a][_0x22ddbb][_0xa661('0x3')]));break;}}}}})[_0xa661('0x15')](function(){if(_0x2d1b9a===_0xa661('0x44')){var _0xb15ed2=_[_0xa661('0x16')](_0x50be7f[_0xa661('0x23')],'id');return _0x50be7f[_0xa661('0x45')](_0xb15ed2)[_0xa661('0x15')](function(){for(var _0x4da5de=0x0;_0x4da5de<_0xb15ed2[_0xa661('0x1d')];_0x4da5de+=0x1){_0xd804db[_0xa661('0x46')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0xb15ed2[_0x4da5de]),'UserId':Number(_0x50be7f['id'])});}});}})['then'](function(){if(_0x2d1b9a===_0xa661('0x44')){var _0x22ea75=_[_0xa661('0x16')](_0x50be7f[_0xa661('0x25')],'id');return _0x50be7f[_0xa661('0x47')](_0x22ea75)[_0xa661('0x15')](function(){for(var _0x1c3106=0x0;_0x1c3106<_0x22ea75[_0xa661('0x1d')];_0x1c3106+=0x1){_0xd804db['emit'](_0xa661('0x48'),{'MailInteractionId':Number(_0x22ea75[_0x1c3106]),'UserId':Number(_0x50be7f['id'])});}});}})[_0xa661('0x15')](function(){if(_0x2d1b9a==='leave'){var _0x1442a5=_['map'](_0x50be7f['FaxInteractions'],'id');return _0x50be7f[_0xa661('0x49')](_0x1442a5)[_0xa661('0x15')](function(){for(var _0xb574b7=0x0;_0xb574b7<_0x1442a5[_0xa661('0x1d')];_0xb574b7+=0x1){_0xd804db[_0xa661('0x46')](_0xa661('0x4a'),{'FaxInteractionId':Number(_0x1442a5[_0xb574b7]),'UserId':Number(_0x50be7f['id'])});}});}})[_0xa661('0x15')](function(){if(_0x2d1b9a===_0xa661('0x44')){var _0x1d8b66=_[_0xa661('0x16')](_0x50be7f['SmsInteractions'],'id');return _0x50be7f['removeSmsInteractions'](_0x1d8b66)[_0xa661('0x15')](function(){for(var _0x5781b3=0x0;_0x5781b3<_0x1d8b66['length'];_0x5781b3+=0x1){_0xd804db['emit'](_0xa661('0x4b'),{'SmsInteractionId':Number(_0x1d8b66[_0x5781b3]),'UserId':Number(_0x50be7f['id'])});}});}})[_0xa661('0x15')](function(){if(_0x2d1b9a===_0xa661('0x44')){var _0x8ec5e8=_['map'](_0x50be7f['OpenchannelInteractions'],'id');return _0x50be7f[_0xa661('0x4c')](_0x8ec5e8)[_0xa661('0x15')](function(){for(var _0x104191=0x0;_0x104191<_0x8ec5e8[_0xa661('0x1d')];_0x104191+=0x1){_0xd804db[_0xa661('0x46')](_0xa661('0x4d'),{'OpenchannelInteractionId':Number(_0x8ec5e8[_0x104191]),'UserId':Number(_0x50be7f['id'])});}});}})[_0xa661('0x4e')](function(_0x173905){_0x4796b9[_0xa661('0x4f')](_0x173905);});}}function onDisconnect(_0x475c2a,_0x20dd4e){joinOrLeave(_0x475c2a,_0xa661('0x44'),_0x20dd4e);}function onConnect(_0x3a926d){joinOrLeave(_0x3a926d,_0xa661('0x50'));}exports[_0xa661('0x51')]=function(_0x996cc){_0x996cc['on']('connection',function(_0x58e4e4){_0x58e4e4[_0xa661('0x52')](0x0);_0x58e4e4[_0xa661('0x53')]=_0x58e4e4[_0xa661('0x54')][_0xa661('0x55')][_0xa661('0x56')]+':'+_0x58e4e4[_0xa661('0x54')]['connection'][_0xa661('0x57')];_0x58e4e4[_0xa661('0x58')]=new Date();_0x58e4e4[_0xa661('0x4f')]=function(_0x8efda9){console[_0xa661('0x4f')]('SocketIO\x20'+_0x58e4e4[_0xa661('0x59')][_0xa661('0x3')]+'['+_0x58e4e4[_0xa661('0x53')]+']',_0x8efda9);};_0x58e4e4['on'](_0xa661('0x5a'),function(){onDisconnect(_0x58e4e4,_0x996cc);_0x58e4e4['log']('DISCONNECTED');});onConnect(_0x58e4e4);_0x58e4e4['log']('CONNECTED');});};
\ No newline at end of file
+var _0xf696=['leave','ChatInteractions','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','catch','log','join','default','connection','setMaxListeners','request','remotePort','connectedAt','address','disconnect','CONNECTED','lodash','util','bluebird','../mysqldb','name','User','agent','telephone','ivr','UserProfileSection','findOne','autoAssociation','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','type','then','Agents','length','format','user:%s','handshake','query','role','userProfileId','ChatInteraction','MailInteraction','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','admin','voice:inbound','voice:outbound','include','push','VoiceQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','user','VoiceQueues','ChatQueue','SmsQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','voice','chat','fax','sms','mail','openchannel','telephone:%s','campaign:%s:%s'];(function(_0x45b1ba,_0x5a6a21){var _0x145ddb=function(_0x650d42){while(--_0x650d42){_0x45b1ba['push'](_0x45b1ba['shift']());}};_0x145ddb(++_0x5a6a21);}(_0xf696,0x1f4));var _0x6f69=function(_0x424564,_0x22ed87){_0x424564=_0x424564-0x0;var _0x3fbc19=_0xf696[_0x424564];return _0x3fbc19;};'use strict';var _=require(_0x6f69('0x0'));var util=require(_0x6f69('0x1'));var BPromise=require(_0x6f69('0x2'));var db=require(_0x6f69('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x6f69('0x4')],'include':[{'as':'Agents','model':db[_0x6f69('0x5')],'attributes':['id',_0x6f69('0x4'),'role'],'raw':!![],'where':{'role':_0x6f69('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x6f69('0x4')],'where':{'role':_0x6f69('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x6f69('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x6f69('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x6f69('0x4'),'type'],'where':{'type':_0x6f69('0x8')}};function getAssociatedResources(_0x328ec2,_0x4211a0,_0xc8e6a6){return db[_0x6f69('0x9')][_0x6f69('0xa')]({'where':{'name':_0x328ec2,'userProfileId':_0x4211a0},'raw':!![]})['then'](function(_0x2b96e9){if(_0x2b96e9){if(_0x2b96e9[_0x6f69('0xb')]){switch(_0x328ec2){case'VoiceQueues':case _0x6f69('0xc'):case _0x6f69('0xd'):case'SmsQueues':case _0x6f69('0xe'):case _0x6f69('0xf'):return db[_0xc8e6a6][_0x6f69('0x10')](queryQueues);case _0x6f69('0x11'):return db[_0xc8e6a6][_0x6f69('0x10')](queryTelephones);case _0x6f69('0x12'):return db[_0xc8e6a6][_0x6f69('0x10')](queryTrunks);case _0x6f69('0x13'):return db[_0xc8e6a6]['findAll'](queryCampaigns);}}else{return db[_0x6f69('0x14')]['findAll']({'attributes':[_0x6f69('0x15')],'where':{'sectionId':_0x2b96e9['id']},'raw':!![]})['then'](function(_0x53cb7a){if(_0x53cb7a){var _0x15bd77={'where':{'id':_[_0x6f69('0x16')](_0x53cb7a,_0x6f69('0x15'))},'raw':!![]};switch(_0xc8e6a6){case'User':_0x15bd77[_0x6f69('0x17')]['role']=_0x6f69('0x7');break;case _0x6f69('0x18'):_0x15bd77[_0x6f69('0x17')][_0x6f69('0x19')]='ivr';break;}return db[_0xc8e6a6][_0x6f69('0x10')](_0x15bd77);}else{return[];}});}}else{return[];}})[_0x6f69('0x1a')](function(_0x3f66ab){return _0x3f66ab;});}function joinOrLeaveQueues(_0x1f4cce,_0x472a2d,_0x2d39e5,_0x6442a5){_0x1f4cce[_0x472a2d](util['format']('%s:queue:%s',_0x2d39e5,_0x6442a5[_0x6f69('0x4')]));if(_0x6442a5[_0x6f69('0x1b')]){for(var _0x151983=0x0;_0x151983<_0x6442a5[_0x6f69('0x1b')][_0x6f69('0x1c')];_0x151983+=0x1){_0x1f4cce[_0x472a2d](util[_0x6f69('0x1d')](_0x6f69('0x1e'),_0x6442a5['Agents'][_0x151983]['name']));}}}function joinOrLeave(_0x2b9814,_0x416180,_0x4daadc){var _0x417bc6;if(_0x2b9814[_0x6f69('0x1f')][_0x6f69('0x20')]['id']){db['User']['find']({'attributes':['id',_0x6f69('0x4'),_0x6f69('0x21'),_0x6f69('0x22')],'where':{'id':_0x2b9814['handshake']['query']['id']},'include':[{'model':db[_0x6f69('0x23')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x6f69('0x24')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x6f69('0x25')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x6f69('0x26')],'as':_0x6f69('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x6f69('0x28')],'as':_0x6f69('0x29'),'attributes':['id'],'raw':!![]}]})[_0x6f69('0x1a')](function(_0x331c3c){if(_0x331c3c){_0x417bc6=_0x331c3c;_0x2b9814[_0x416180](util[_0x6f69('0x1d')]('user:%s',_0x331c3c[_0x6f69('0x4')]));var _0x380c06=[];switch(_0x331c3c[_0x6f69('0x21')]){case _0x6f69('0x2a'):_0x2b9814[_0x416180](_0x6f69('0x2b'));_0x2b9814[_0x416180](_0x6f69('0x2c'));if(queryQueues['hasOwnProperty'](_0x6f69('0x2d'))){delete queryQueues[_0x6f69('0x2d')];}_0x380c06[_0x6f69('0x2e')](db[_0x6f69('0x2f')][_0x6f69('0x10')](queryQueues));_0x380c06[_0x6f69('0x2e')](db['ChatQueue'][_0x6f69('0x10')](queryQueues));_0x380c06[_0x6f69('0x2e')](db[_0x6f69('0x30')]['findAll'](queryQueues));_0x380c06[_0x6f69('0x2e')](db[_0x6f69('0x31')]['findAll'](queryQueues));_0x380c06[_0x6f69('0x2e')](db[_0x6f69('0x32')][_0x6f69('0x10')](queryQueues));_0x380c06[_0x6f69('0x2e')](db[_0x6f69('0x33')][_0x6f69('0x10')](queryQueues));_0x380c06[_0x6f69('0x2e')](db[_0x6f69('0x5')][_0x6f69('0x10')](queryTelephones));_0x380c06[_0x6f69('0x2e')](db['Trunk'][_0x6f69('0x10')](queryTrunks));_0x380c06['push'](db['Campaign']['findAll'](queryCampaigns));_0x380c06[_0x6f69('0x2e')](db[_0x6f69('0x5')]['findAll'](queryAgents));break;case _0x6f69('0x34'):_0x2b9814[_0x416180]('voice:inbound');_0x2b9814[_0x416180](_0x6f69('0x2c'));_0x380c06[_0x6f69('0x2e')](getAssociatedResources(_0x6f69('0x35'),_0x331c3c[_0x6f69('0x22')],'VoiceQueue'));_0x380c06[_0x6f69('0x2e')](getAssociatedResources(_0x6f69('0xc'),_0x331c3c[_0x6f69('0x22')],_0x6f69('0x36')));_0x380c06[_0x6f69('0x2e')](getAssociatedResources(_0x6f69('0xd'),_0x331c3c[_0x6f69('0x22')],_0x6f69('0x30')));_0x380c06['push'](getAssociatedResources(_0x6f69('0x37'),_0x331c3c[_0x6f69('0x22')],_0x6f69('0x31')));_0x380c06[_0x6f69('0x2e')](getAssociatedResources('MailQueues',_0x331c3c['userProfileId'],'MailQueue'));_0x380c06['push'](getAssociatedResources('OpenchannelQueues',_0x331c3c[_0x6f69('0x22')],'OpenchannelQueue'));_0x380c06['push'](getAssociatedResources(_0x6f69('0x11'),_0x331c3c[_0x6f69('0x22')],_0x6f69('0x5')));_0x380c06[_0x6f69('0x2e')](getAssociatedResources('Trunks',_0x331c3c[_0x6f69('0x22')],'Trunk'));_0x380c06[_0x6f69('0x2e')](getAssociatedResources(_0x6f69('0x13'),_0x331c3c['userProfileId'],_0x6f69('0x18')));_0x380c06[_0x6f69('0x2e')](db[_0x6f69('0x5')][_0x6f69('0x10')](queryAgents));break;case _0x6f69('0x6'):_0x2b9814[_0x416180](_0x6f69('0x2b'));_0x2b9814[_0x416180](_0x6f69('0x2c'));_0x380c06['push'](_0x331c3c['getVoiceQueues']({'attributes':['id',_0x6f69('0x4')]}));_0x380c06[_0x6f69('0x2e')](_0x331c3c[_0x6f69('0x38')]({'attributes':['id',_0x6f69('0x4')]}));_0x380c06[_0x6f69('0x2e')](_0x331c3c[_0x6f69('0x39')]({'attributes':['id',_0x6f69('0x4')]}));_0x380c06[_0x6f69('0x2e')](_0x331c3c[_0x6f69('0x3a')]({'attributes':['id',_0x6f69('0x4')]}));_0x380c06[_0x6f69('0x2e')](_0x331c3c[_0x6f69('0x3b')]({'attributes':['id',_0x6f69('0x4')]}));_0x380c06['push'](_0x331c3c[_0x6f69('0x3c')]({'attributes':['id',_0x6f69('0x4')]}));break;}return BPromise[_0x6f69('0x3d')](_0x380c06);}})[_0x6f69('0x1a')](function(_0x5601e7){if(_0x5601e7&&_0x5601e7[_0x6f69('0x1c')]){for(var _0x529bd9=0x0;_0x529bd9<_0x5601e7[_0x6f69('0x1c')];_0x529bd9+=0x1){for(var _0x41ee18=0x0;_0x41ee18<_0x5601e7[_0x529bd9][_0x6f69('0x1c')];_0x41ee18+=0x1){switch(_0x529bd9){case 0x0:joinOrLeaveQueues(_0x2b9814,_0x416180,_0x6f69('0x3e'),_0x5601e7[_0x529bd9][_0x41ee18]);break;case 0x1:joinOrLeaveQueues(_0x2b9814,_0x416180,_0x6f69('0x3f'),_0x5601e7[_0x529bd9][_0x41ee18]);break;case 0x2:joinOrLeaveQueues(_0x2b9814,_0x416180,_0x6f69('0x40'),_0x5601e7[_0x529bd9][_0x41ee18]);break;case 0x3:joinOrLeaveQueues(_0x2b9814,_0x416180,_0x6f69('0x41'),_0x5601e7[_0x529bd9][_0x41ee18]);break;case 0x4:joinOrLeaveQueues(_0x2b9814,_0x416180,_0x6f69('0x42'),_0x5601e7[_0x529bd9][_0x41ee18]);break;case 0x5:joinOrLeaveQueues(_0x2b9814,_0x416180,_0x6f69('0x43'),_0x5601e7[_0x529bd9][_0x41ee18]);break;case 0x6:_0x2b9814[_0x416180](util[_0x6f69('0x1d')](_0x6f69('0x44'),_0x5601e7[_0x529bd9][_0x41ee18]['name']));break;case 0x7:_0x2b9814[_0x416180](util[_0x6f69('0x1d')]('trunk:%s',_0x5601e7[_0x529bd9][_0x41ee18][_0x6f69('0x4')]));break;case 0x8:_0x2b9814[_0x416180](util[_0x6f69('0x1d')](_0x6f69('0x45'),_0x5601e7[_0x529bd9][_0x41ee18][_0x6f69('0x19')],_0x5601e7[_0x529bd9][_0x41ee18]['name']));break;case 0x9:_0x2b9814[_0x416180](util['format'](_0x6f69('0x1e'),_0x5601e7[_0x529bd9][_0x41ee18][_0x6f69('0x4')]));break;}}}}})[_0x6f69('0x1a')](function(){if(_0x416180===_0x6f69('0x46')){var _0x58a0af=_[_0x6f69('0x16')](_0x417bc6[_0x6f69('0x47')],'id');return _0x417bc6['removeChatInteractions'](_0x58a0af)[_0x6f69('0x1a')](function(){for(var _0x206452=0x0;_0x206452<_0x58a0af[_0x6f69('0x1c')];_0x206452+=0x1){_0x4daadc['emit'](_0x6f69('0x48'),{'ChatInteractionId':Number(_0x58a0af[_0x206452]),'UserId':Number(_0x417bc6['id'])});}});}})['then'](function(){if(_0x416180==='leave'){var _0x3d271f=_['map'](_0x417bc6[_0x6f69('0x49')],'id');return _0x417bc6[_0x6f69('0x4a')](_0x3d271f)[_0x6f69('0x1a')](function(){for(var _0x1afaf9=0x0;_0x1afaf9<_0x3d271f['length'];_0x1afaf9+=0x1){_0x4daadc[_0x6f69('0x4b')](_0x6f69('0x4c'),{'MailInteractionId':Number(_0x3d271f[_0x1afaf9]),'UserId':Number(_0x417bc6['id'])});}});}})['then'](function(){if(_0x416180===_0x6f69('0x46')){var _0x2fd4c4=_[_0x6f69('0x16')](_0x417bc6['FaxInteractions'],'id');return _0x417bc6[_0x6f69('0x4d')](_0x2fd4c4)[_0x6f69('0x1a')](function(){for(var _0x50af60=0x0;_0x50af60<_0x2fd4c4[_0x6f69('0x1c')];_0x50af60+=0x1){_0x4daadc[_0x6f69('0x4b')](_0x6f69('0x4e'),{'FaxInteractionId':Number(_0x2fd4c4[_0x50af60]),'UserId':Number(_0x417bc6['id'])});}});}})[_0x6f69('0x1a')](function(){if(_0x416180===_0x6f69('0x46')){var _0x4e7912=_[_0x6f69('0x16')](_0x417bc6[_0x6f69('0x27')],'id');return _0x417bc6[_0x6f69('0x4f')](_0x4e7912)[_0x6f69('0x1a')](function(){for(var _0x1fef26=0x0;_0x1fef26<_0x4e7912[_0x6f69('0x1c')];_0x1fef26+=0x1){_0x4daadc[_0x6f69('0x4b')](_0x6f69('0x50'),{'SmsInteractionId':Number(_0x4e7912[_0x1fef26]),'UserId':Number(_0x417bc6['id'])});}});}})[_0x6f69('0x1a')](function(){if(_0x416180==='leave'){var _0x5473e4=_[_0x6f69('0x16')](_0x417bc6[_0x6f69('0x29')],'id');return _0x417bc6[_0x6f69('0x51')](_0x5473e4)[_0x6f69('0x1a')](function(){for(var _0x45dbd9=0x0;_0x45dbd9<_0x5473e4['length'];_0x45dbd9+=0x1){_0x4daadc[_0x6f69('0x4b')](_0x6f69('0x52'),{'OpenchannelInteractionId':Number(_0x5473e4[_0x45dbd9]),'UserId':Number(_0x417bc6['id'])});}});}})[_0x6f69('0x53')](function(_0x1c2a94){_0x2b9814[_0x6f69('0x54')](_0x1c2a94);});}}function onDisconnect(_0x2ee27a,_0x56730e){joinOrLeave(_0x2ee27a,_0x6f69('0x46'),_0x56730e);}function onConnect(_0x122bf3){joinOrLeave(_0x122bf3,_0x6f69('0x55'));}exports[_0x6f69('0x56')]=function(_0xdd01b4){_0xdd01b4['on'](_0x6f69('0x57'),function(_0x2a02eb){_0x2a02eb[_0x6f69('0x58')](0x0);_0x2a02eb['address']=_0x2a02eb['request']['connection']['remoteAddress']+':'+_0x2a02eb[_0x6f69('0x59')][_0x6f69('0x57')][_0x6f69('0x5a')];_0x2a02eb[_0x6f69('0x5b')]=new Date();_0x2a02eb[_0x6f69('0x54')]=function(_0x7fd04f){console[_0x6f69('0x54')]('SocketIO\x20'+_0x2a02eb['nsp'][_0x6f69('0x4')]+'['+_0x2a02eb[_0x6f69('0x5c')]+']',_0x7fd04f);};_0x2a02eb['on'](_0x6f69('0x5d'),function(){onDisconnect(_0x2a02eb,_0xdd01b4);_0x2a02eb[_0x6f69('0x54')]('DISCONNECTED');});onConnect(_0x2a02eb);_0x2a02eb[_0x6f69('0x54')](_0x6f69('0x5e'));});};
\ No newline at end of file
index e18f0b5..1a490bc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeae3=['jayson/promise','client','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','ChatMessage','newmessage','Sms','closedinteraction','SmsMessage','Fax','FaxInteraction','FaxMessage','Mail','MailMessage','Openchannel','OpenchannelMessage','request','EventManager','then','Trigger,\x20%s','error','catch','get','channel','direction','UserId','find','SIP/%s','name','outgoingmessage','event','opened','changed','closed','User','default','length','hasOwnProperty','model','hook','toLowerCase','condition','util','../../mysqldb'];(function(_0x4884e8,_0xa5e5ae){var _0x3cd564=function(_0x324c06){while(--_0x324c06){_0x4884e8['push'](_0x4884e8['shift']());}};_0x3cd564(++_0xa5e5ae);}(_0xeae3,0x176));var _0x3eae=function(_0xc56c46,_0x3fc792){_0xc56c46=_0xc56c46-0x0;var _0x2055d6=_0xeae3[_0xc56c46];return _0x2055d6;};'use strict';var util=require(_0x3eae('0x0'));var db=require(_0x3eae('0x1'))['db'];var jayson=require(_0x3eae('0x2'));var logger=require('../logger')('triggers');var client=jayson[_0x3eae('0x3')]['http']({'port':0x232a});var triggers=[{'channel':_0x3eae('0x4'),'model':_0x3eae('0x5'),'event':_0x3eae('0x6'),'condition':_0x3eae('0x7'),'callback':afterCreate},{'channel':_0x3eae('0x4'),'model':_0x3eae('0x5'),'event':_0x3eae('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x3eae('0x4'),'model':_0x3eae('0x9'),'event':_0x3eae('0x6'),'condition':_0x3eae('0xa'),'callback':afterCreateMessage},{'channel':_0x3eae('0xb'),'model':'SmsInteraction','event':_0x3eae('0x6'),'condition':_0x3eae('0x7'),'callback':afterCreate},{'channel':'Sms','model':'SmsInteraction','event':_0x3eae('0x8'),'condition':_0x3eae('0xc'),'callback':afterUpdate},{'channel':'Sms','model':_0x3eae('0xd'),'event':_0x3eae('0x6'),'condition':_0x3eae('0xa'),'callback':afterCreateMessage},{'channel':_0x3eae('0xe'),'model':_0x3eae('0xf'),'event':_0x3eae('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':'Fax','model':'FaxInteraction','event':_0x3eae('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x3eae('0xe'),'model':_0x3eae('0x10'),'event':_0x3eae('0x6'),'condition':_0x3eae('0xa'),'callback':afterCreateMessage},{'channel':_0x3eae('0x11'),'model':'MailInteraction','event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Mail','model':'MailInteraction','event':_0x3eae('0x8'),'condition':_0x3eae('0xc'),'callback':afterUpdate},{'channel':_0x3eae('0x11'),'model':_0x3eae('0x12'),'event':_0x3eae('0x6'),'condition':_0x3eae('0xa'),'callback':afterCreateMessage},{'channel':_0x3eae('0x13'),'model':'OpenchannelInteraction','event':_0x3eae('0x6'),'condition':_0x3eae('0x7'),'callback':afterCreate},{'channel':_0x3eae('0x13'),'model':'OpenchannelInteraction','event':_0x3eae('0x8'),'condition':_0x3eae('0xc'),'callback':afterUpdate},{'channel':_0x3eae('0x13'),'model':_0x3eae('0x14'),'event':_0x3eae('0x6'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x355e16){return client[_0x3eae('0x15')](_0x3eae('0x16'),_0x355e16)[_0x3eae('0x17')](function(_0x5b1a6b){logger['info'](_0x3eae('0x18'),_0x3eae('0x16'),_0x5b1a6b);if(_0x5b1a6b[_0x3eae('0x19')]){if(_0x5b1a6b[_0x3eae('0x19')]['code']===0x1f4){logger[_0x3eae('0x19')](_0x3eae('0x18'),_0x3eae('0x16'),_0x5b1a6b[_0x3eae('0x19')]);}}})[_0x3eae('0x1a')](function(_0x4aa234){logger[_0x3eae('0x19')]('Trigger,\x20%s',_0x3eae('0x16'),_0x4aa234);});}function afterCreateMessage(_0x3496e1,_0x2e413c){return function(_0x166aca,_0x40066f){_0x166aca=_0x166aca[_0x3eae('0x1b')]({'plain':!![]});_0x166aca[_0x3eae('0x1c')]=_0x3496e1;_0x166aca['event']=_0x166aca[_0x3eae('0x1d')];if(_0x166aca[_0x3eae('0x1e')]){return db['User'][_0x3eae('0x1f')]({'where':{'id':_0x166aca[_0x3eae('0x1e')]},'attributes':['id','name'],'raw':!![]})['then'](function(_0x399ccc){_0x166aca['interface']=util['format'](_0x3eae('0x20'),_0x399ccc[_0x3eae('0x21')]);_0x166aca[_0x3eae('0x1c')]=_0x3496e1;return request({'event':'incomingmessage','message':_0x166aca});})[_0x3eae('0x1a')](function(_0x37a40b){console[_0x3eae('0x19')](_0x37a40b);});}else{return request({'event':_0x3eae('0x22'),'message':_0x166aca});}};}function afterCreate(_0x3c3230,_0x1a4de8){return function(_0x10376b,_0x4c72fc){_0x10376b=_0x10376b[_0x3eae('0x1b')]({'plain':!![]});_0x10376b[_0x3eae('0x1c')]=_0x3c3230;_0x10376b[_0x3eae('0x23')]=_0x3eae('0x24');return request({'event':_0x1a4de8,'message':_0x10376b});};}function afterUpdate(_0x5cf45e,_0x549968){return function(_0x3f228f,_0x1750ab){if(_0x3f228f[_0x3eae('0x25')](_0x3eae('0x26'))&&_0x3f228f[_0x3eae('0x26')]){_0x3f228f=_0x3f228f[_0x3eae('0x1b')]({'plain':!![]});_0x3f228f[_0x3eae('0x1c')]=_0x5cf45e;_0x3f228f[_0x3eae('0x23')]=_0x3eae('0x26');if(_0x3f228f[_0x3eae('0x1e')]){return db[_0x3eae('0x27')]['find']({'where':{'id':_0x3f228f[_0x3eae('0x1e')]},'attributes':['id',_0x3eae('0x21')],'raw':!![]})['then'](function(_0x1880b9){_0x3f228f['interface']=util['format'](_0x3eae('0x20'),_0x1880b9[_0x3eae('0x21')]);return request({'event':_0x549968,'message':_0x3f228f});})['catch'](function(_0x444695){console['error'](_0x444695);});}else{return request({'event':_0x549968,'message':_0x3f228f});}}};}exports[_0x3eae('0x28')]=function(){for(var _0x187b17=0x0;_0x187b17<triggers[_0x3eae('0x29')];_0x187b17+=0x1){if(db[_0x3eae('0x2a')](triggers[_0x187b17][_0x3eae('0x2b')])){db[triggers[_0x187b17][_0x3eae('0x2b')]][_0x3eae('0x2c')](triggers[_0x187b17][_0x3eae('0x23')],triggers[_0x187b17]['callback'](triggers[_0x187b17][_0x3eae('0x1c')][_0x3eae('0x2d')](),triggers[_0x187b17][_0x3eae('0x2e')]));}}};
\ No newline at end of file
+var _0x015f=['model','hook','toLowerCase','condition','util','triggers','client','http','Chat','afterCreate','newinteraction','ChatInteraction','closedinteraction','ChatMessage','newmessage','SmsInteraction','Sms','SmsMessage','Fax','FaxInteraction','afterUpdate','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','then','info','Trigger,\x20%s','EventManager','error','code','catch','get','direction','UserId','User','find','name','interface','format','SIP/%s','incomingmessage','outgoingmessage','channel','event','opened','changed','closed','default','hasOwnProperty'];(function(_0xfd01b9,_0x7064eb){var _0x14c56c=function(_0x11ad05){while(--_0x11ad05){_0xfd01b9['push'](_0xfd01b9['shift']());}};_0x14c56c(++_0x7064eb);}(_0x015f,0xdc));var _0xf015=function(_0x3b0e74,_0x295ca1){_0x3b0e74=_0x3b0e74-0x0;var _0x2ebdc1=_0x015f[_0x3b0e74];return _0x2ebdc1;};'use strict';var util=require(_0xf015('0x0'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var logger=require('../logger')(_0xf015('0x1'));var client=jayson[_0xf015('0x2')][_0xf015('0x3')]({'port':0x232a});var triggers=[{'channel':_0xf015('0x4'),'model':'ChatInteraction','event':_0xf015('0x5'),'condition':_0xf015('0x6'),'callback':afterCreate},{'channel':_0xf015('0x4'),'model':_0xf015('0x7'),'event':'afterUpdate','condition':_0xf015('0x8'),'callback':afterUpdate},{'channel':_0xf015('0x4'),'model':_0xf015('0x9'),'event':_0xf015('0x5'),'condition':_0xf015('0xa'),'callback':afterCreateMessage},{'channel':'Sms','model':_0xf015('0xb'),'event':_0xf015('0x5'),'condition':_0xf015('0x6'),'callback':afterCreate},{'channel':'Sms','model':_0xf015('0xb'),'event':'afterUpdate','condition':_0xf015('0x8'),'callback':afterUpdate},{'channel':_0xf015('0xc'),'model':_0xf015('0xd'),'event':_0xf015('0x5'),'condition':_0xf015('0xa'),'callback':afterCreateMessage},{'channel':_0xf015('0xe'),'model':_0xf015('0xf'),'event':_0xf015('0x5'),'condition':_0xf015('0x6'),'callback':afterCreate},{'channel':'Fax','model':_0xf015('0xf'),'event':_0xf015('0x10'),'condition':_0xf015('0x8'),'callback':afterUpdate},{'channel':_0xf015('0xe'),'model':_0xf015('0x11'),'event':_0xf015('0x5'),'condition':_0xf015('0xa'),'callback':afterCreateMessage},{'channel':_0xf015('0x12'),'model':_0xf015('0x13'),'event':_0xf015('0x5'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xf015('0x12'),'model':_0xf015('0x13'),'event':_0xf015('0x10'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Mail','model':_0xf015('0x14'),'event':_0xf015('0x5'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xf015('0x15'),'model':_0xf015('0x16'),'event':'afterCreate','condition':_0xf015('0x6'),'callback':afterCreate},{'channel':_0xf015('0x15'),'model':_0xf015('0x16'),'event':_0xf015('0x10'),'condition':_0xf015('0x8'),'callback':afterUpdate},{'channel':'Openchannel','model':_0xf015('0x17'),'event':'afterCreate','condition':_0xf015('0xa'),'callback':afterCreateMessage}];function request(_0x9ad6d3){return client[_0xf015('0x18')]('EventManager',_0x9ad6d3)[_0xf015('0x19')](function(_0x2b08d5){logger[_0xf015('0x1a')](_0xf015('0x1b'),_0xf015('0x1c'),_0x2b08d5);if(_0x2b08d5[_0xf015('0x1d')]){if(_0x2b08d5[_0xf015('0x1d')][_0xf015('0x1e')]===0x1f4){logger[_0xf015('0x1d')](_0xf015('0x1b'),_0xf015('0x1c'),_0x2b08d5[_0xf015('0x1d')]);}}})[_0xf015('0x1f')](function(_0x234c54){logger['error'](_0xf015('0x1b'),'EventManager',_0x234c54);});}function afterCreateMessage(_0x2c1520,_0x46a1be){return function(_0x2798ac,_0x3944b7){_0x2798ac=_0x2798ac[_0xf015('0x20')]({'plain':!![]});_0x2798ac['channel']=_0x2c1520;_0x2798ac['event']=_0x2798ac[_0xf015('0x21')];if(_0x2798ac[_0xf015('0x22')]){return db[_0xf015('0x23')][_0xf015('0x24')]({'where':{'id':_0x2798ac['UserId']},'attributes':['id',_0xf015('0x25')],'raw':!![]})[_0xf015('0x19')](function(_0x14b5c5){_0x2798ac[_0xf015('0x26')]=util[_0xf015('0x27')](_0xf015('0x28'),_0x14b5c5[_0xf015('0x25')]);_0x2798ac['channel']=_0x2c1520;return request({'event':_0xf015('0x29'),'message':_0x2798ac});})[_0xf015('0x1f')](function(_0x3e43f9){console[_0xf015('0x1d')](_0x3e43f9);});}else{return request({'event':_0xf015('0x2a'),'message':_0x2798ac});}};}function afterCreate(_0xc29035,_0x343d77){return function(_0x3e60f6,_0xb9b869){_0x3e60f6=_0x3e60f6[_0xf015('0x20')]({'plain':!![]});_0x3e60f6[_0xf015('0x2b')]=_0xc29035;_0x3e60f6[_0xf015('0x2c')]=_0xf015('0x2d');return request({'event':_0x343d77,'message':_0x3e60f6});};}function afterUpdate(_0x331065,_0x1baa43){return function(_0x5d6bd8,_0x3d2ed6){if(_0x5d6bd8[_0xf015('0x2e')](_0xf015('0x2f'))&&_0x5d6bd8[_0xf015('0x2f')]){_0x5d6bd8=_0x5d6bd8[_0xf015('0x20')]({'plain':!![]});_0x5d6bd8['channel']=_0x331065;_0x5d6bd8[_0xf015('0x2c')]=_0xf015('0x2f');if(_0x5d6bd8[_0xf015('0x22')]){return db['User'][_0xf015('0x24')]({'where':{'id':_0x5d6bd8[_0xf015('0x22')]},'attributes':['id',_0xf015('0x25')],'raw':!![]})[_0xf015('0x19')](function(_0x1518e2){_0x5d6bd8[_0xf015('0x26')]=util[_0xf015('0x27')](_0xf015('0x28'),_0x1518e2[_0xf015('0x25')]);return request({'event':_0x1baa43,'message':_0x5d6bd8});})[_0xf015('0x1f')](function(_0x971c4b){console['error'](_0x971c4b);});}else{return request({'event':_0x1baa43,'message':_0x5d6bd8});}}};}exports[_0xf015('0x30')]=function(){for(var _0x195927=0x0;_0x195927<triggers['length'];_0x195927+=0x1){if(db[_0xf015('0x31')](triggers[_0x195927][_0xf015('0x32')])){db[triggers[_0x195927][_0xf015('0x32')]][_0xf015('0x33')](triggers[_0x195927][_0xf015('0x2c')],triggers[_0x195927]['callback'](triggers[_0x195927]['channel'][_0xf015('0x34')](),triggers[_0x195927][_0xf015('0x35')]));}}};
\ No newline at end of file
index 726f39c..0f395d6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3134=['includes','lodash','mail','fax','sms','openchannel','exports','toLowerCase'];(function(_0x5b59f9,_0x147c83){var _0x2f41c9=function(_0x4bf58a){while(--_0x4bf58a){_0x5b59f9['push'](_0x5b59f9['shift']());}};_0x2f41c9(++_0x147c83);}(_0x3134,0x99));var _0x4313=function(_0x13ff2e,_0x1fadfd){_0x13ff2e=_0x13ff2e-0x0;var _0x1302b8=_0x3134[_0x13ff2e];return _0x1302b8;};'use strict';var _=require(_0x4313('0x0'));var channels=['voice',_0x4313('0x1'),'chat',_0x4313('0x2'),_0x4313('0x3'),_0x4313('0x4')];module[_0x4313('0x5')]={'getChannels':function(){return channels;},'isValidChannel':function(_0x28f52e){_0x28f52e=_0x28f52e[_0x4313('0x6')]();return _[_0x4313('0x7')](channels,_0x28f52e);}};
\ No newline at end of file
+var _0xe370=['voice','chat','fax','sms','openchannel','toLowerCase','includes'];(function(_0x5735d0,_0x423963){var _0x5e1c52=function(_0x55d80a){while(--_0x55d80a){_0x5735d0['push'](_0x5735d0['shift']());}};_0x5e1c52(++_0x423963);}(_0xe370,0x9a));var _0x0e37=function(_0x5bf3c8,_0x5c268b){_0x5bf3c8=_0x5bf3c8-0x0;var _0xf2a998=_0xe370[_0x5bf3c8];return _0xf2a998;};'use strict';var _=require('lodash');var channels=[_0x0e37('0x0'),'mail',_0x0e37('0x1'),_0x0e37('0x2'),_0x0e37('0x3'),_0x0e37('0x4')];module['exports']={'getChannels':function(){return channels;},'isValidChannel':function(_0x2cfa91){_0x2cfa91=_0x2cfa91[_0x0e37('0x5')]();return _[_0x0e37('0x6')](channels,_0x2cfa91);}};
\ No newline at end of file
index cfe1fcf..241ef38 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4a6b=['send','exports','status','render','json'];(function(_0x283975,_0x5c2d34){var _0xb32b09=function(_0x5f553f){while(--_0x5f553f){_0x283975['push'](_0x283975['shift']());}};_0xb32b09(++_0x5c2d34);}(_0x4a6b,0x14b));var _0xb4a6=function(_0x23b529,_0x1d5a72){_0x23b529=_0x23b529-0x0;var _0x234739=_0x4a6b[_0x23b529];return _0x234739;};'use strict';module[_0xb4a6('0x0')][0x194]=function pageNotFound(_0x36cb1f,_0x2dae53){var _0x1de069='404';var _0x3ffcce=0x194;var _0x1e1570={'status':_0x3ffcce};_0x2dae53[_0xb4a6('0x1')](_0x1e1570[_0xb4a6('0x1')]);_0x2dae53[_0xb4a6('0x2')](_0x1de069,{},function(_0x4f00c6,_0x2cb3eb){if(_0x4f00c6){return _0x2dae53[_0xb4a6('0x1')](_0x1e1570[_0xb4a6('0x1')])[_0xb4a6('0x3')](_0x1e1570);}_0x2dae53[_0xb4a6('0x4')](_0x2cb3eb);});};
\ No newline at end of file
+var _0x52dc=['render','json','exports','404','status'];(function(_0x4df1f5,_0x39c6d2){var _0x56585b=function(_0x287b6e){while(--_0x287b6e){_0x4df1f5['push'](_0x4df1f5['shift']());}};_0x56585b(++_0x39c6d2);}(_0x52dc,0x93));var _0xc52d=function(_0x2d5168,_0x1d4c8b){_0x2d5168=_0x2d5168-0x0;var _0x4f6a2f=_0x52dc[_0x2d5168];return _0x4f6a2f;};'use strict';module[_0xc52d('0x0')][0x194]=function pageNotFound(_0x3374e4,_0x3ce6d){var _0x1e5c10=_0xc52d('0x1');var _0x462664=0x194;var _0x528bbc={'status':_0x462664};_0x3ce6d[_0xc52d('0x2')](_0x528bbc['status']);_0x3ce6d[_0xc52d('0x3')](_0x1e5c10,{},function(_0x243829,_0x1d9eab){if(_0x243829){return _0x3ce6d['status'](_0x528bbc[_0xc52d('0x2')])[_0xc52d('0x4')](_0x528bbc);}_0x3ce6d['send'](_0x1d9eab);});};
\ No newline at end of file
diff --git a/server/migrations/2.3.2.js b/server/migrations/2.3.2.js
new file mode 100644 (file)
index 0000000..b08a1fb
--- /dev/null
@@ -0,0 +1,180 @@
+'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);
+
+            // START int_dynamics365_accounts
+            migration.query('ALTER TABLE int_dynamics365_accounts ENCRYPTION=\'Y\';');
+            // END int_dynamics365_accounts
+
+            // START int_servicenow_accounts
+            migration.query('ALTER TABLE int_servicenow_accounts ENCRYPTION=\'Y\';');
+            // END int_servicenow_accounts
+
+            // START SETTINGS
+            migration.addColumn('settings', 'rtlSupport', {
+                type: Sequelize.BOOLEAN,
+                defaultValue: false
+            });
+            // END SETTINGS
+
+            // START FINAL
+            migration.final(resolve);
+            // END FINAL
+        });
+    },
+
+    down: function(queryInterface, Sequelize) {
+        // var migration = new Migration(queryInterface);
+    }
+};
\ No newline at end of file
index fb98e3e..70478ad 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf556=['MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/dashboard/dashboard.model','DashboardItem','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/tag/tag.model','Template','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Attachment','../api/attachment/attachment.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','User','hasOne','UserId','Recordings','hasMany','UserVoiceQueueRt','VoiceQueuesRt','Extensions','cascade','HopperFinals','CmHopperHistory','OpenchannelInteraction','SmsInteractions','FaxInteractions','MailInteractions','belongsTo','userProfileId','Groups','chat_group_has_users','belongsToMany','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','ChatInteractions','user_has_chat_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','VoiceQueues','MailQueues','ChatQueues','FaxQueue','UserSmsQueue','OpenchannelQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccount','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','SmsAccounts','user_has_sms_accounts','SquareProject','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','TrunkBackupId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Team','team_has_voice_queues','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceQueueReport','QueueCalls','VoiceAgentReport','AgentReports','uniqueid','Contact','MailAccount','MailAccountId','Imap','Disposition','Dispositions','Answers','Interactions','ListId','TemplateId','mandatoryDispositionPause','team_has_mail_queues','Teams','MailInteractionId','Account','ContactId','Owner','Tags','Tag','mail_interaction_has_tags','ThroughTags','user_has_mail_interactions','Attachments','Interaction','restrict','IntervalId','TagId','MailQueueReport','FaxAccountId','FaxApplication','Exntensions','List','FaxInteractionId','fax_interaction_has_tags','Users','user_has_fax_interactions','AttachmentId','team_has_fax_queues','SmsAccountId','Applications','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','UserOpenchannelQueue','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Agent','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessage','ChatGroupId','CompanyId','CmHopper','Company','cm_contact_has_tags','Queue','CampaignId','OwnerId','Automation','OneAll','AutomationAllId','Any','AutomationAnyId','Actions','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','AllConditions','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','TriggerId','Fields','MetricId','Configurations','Subjects','Descriptions','DescriptionId','FieldId','SalesforceAccount','AccountId','SubjectId','Description','VariableId','Subject','Field','DeskField','ZohoConfiguration','int_zendesk_configuration_has_tags','int_vtiger_configuration_has_tags','FromId','ToId','SessionId','TrunkId','TrunkBackup','SquareProjectId','campaigns_has_cm_lists','BlackLists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToMailAccountId','ToUserId','ToChatQueueId','ToQueue','ToChatWebsiteId','ToAccount','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','HopperHistory','Queues','UserProfileSection','UserProfileSections','Resources','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','127.0.0.1','mysql','utf8mb4','utf8_general_ci','sequelizeHistory','xC@LL1234','name','utf8','username','database','options','import','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceQueueReport/voiceQueueReport.model'];(function(_0x3c039e,_0x3d932e){var _0x16c529=function(_0x58b53c){while(--_0x58b53c){_0x3c039e['push'](_0x3c039e['shift']());}};_0x16c529(++_0x3d932e);}(_0xf556,0x19c));var _0x6f55=function(_0x16e844,_0x3e3e5d){_0x16e844=_0x16e844-0x0;var _0x2d801e=_0xf556[_0x16e844];return _0x2d801e;};'use strict';var path=require('path');var config=require(_0x6f55('0x0'));var Sequelize=require(_0x6f55('0x1'));var _=require(_0x6f55('0x2'));var jstz=require(_0x6f55('0x3'));var timezone=jstz[_0x6f55('0x4')]();config[_0x6f55('0x1')]=_[_0x6f55('0x5')](config[_0x6f55('0x1')],{'database':_0x6f55('0x6'),'username':_0x6f55('0x7'),'password':'xC@LL1234','options':{'host':_0x6f55('0x8'),'port':0xcea,'dialect':_0x6f55('0x9'),'dialectOptions':{'charset':_0x6f55('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x6f55('0xb')}}});config[_0x6f55('0xc')]=_[_0x6f55('0x5')](config[_0x6f55('0xc')],{'database':_0x6f55('0x6'),'username':_0x6f55('0x7'),'password':_0x6f55('0xd'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x6f55('0x9'),'dialectOptions':{'charset':_0x6f55('0xa')},'logging':![],'timezone':timezone[_0x6f55('0xe')](),'define':{'charset':_0x6f55('0xf'),'collate':_0x6f55('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x6f55('0x1')]['database'],config['sequelize'][_0x6f55('0x10')],config[_0x6f55('0x1')]['password'],config[_0x6f55('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x6f55('0xc')][_0x6f55('0x11')],config[_0x6f55('0xc')][_0x6f55('0x10')],config[_0x6f55('0xc')]['password'],config['sequelizeHistory'][_0x6f55('0x12')])};db['User']=db[_0x6f55('0x1')][_0x6f55('0x13')]('../api/user/user.model');db['VoiceChanSpy']=db[_0x6f55('0x1')][_0x6f55('0x13')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x6f55('0x14')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x15'));db[_0x6f55('0x16')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x17'));db[_0x6f55('0x18')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x19'));db[_0x6f55('0x1a')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x1b'));db[_0x6f55('0x1c')]=db['sequelize'][_0x6f55('0x13')](_0x6f55('0x1d'));db[_0x6f55('0x1e')]=db['sequelize']['import'](_0x6f55('0x1f'));db[_0x6f55('0x20')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x21'));db[_0x6f55('0x22')]=db[_0x6f55('0x1')]['import'](_0x6f55('0x23'));db[_0x6f55('0x24')]=db['sequelize']['import'](_0x6f55('0x25'));db['VoiceAgentReport']=db[_0x6f55('0x1')]['import']('../api/voiceAgentReport/voiceAgentReport.model');db['VoiceQueueReport']=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x26'));db[_0x6f55('0x27')]=db['sequelize'][_0x6f55('0x13')]('../api/memberReport/memberReport.model');db[_0x6f55('0x28')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x29'));db['VoiceTransferReport']=db['sequelize'][_0x6f55('0x13')](_0x6f55('0x2a'));db['UserVoiceQueueRt']=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x2b'));db[_0x6f55('0x2c')]=db['sequelize'][_0x6f55('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x6f55('0x2d')]=db[_0x6f55('0x1')]['import']('../api/userChatQueue/userChatQueue.model');db[_0x6f55('0x2e')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x2f'));db[_0x6f55('0x30')]=db['sequelize']['import'](_0x6f55('0x31'));db['UserSmsQueue']=db[_0x6f55('0x1')]['import'](_0x6f55('0x32'));db['UserOpenchannelQueue']=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x33'));db[_0x6f55('0x34')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x35'));db[_0x6f55('0x36')]=db['sequelize'][_0x6f55('0x13')]('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db[_0x6f55('0x1')]['import'](_0x6f55('0x37'));db[_0x6f55('0x38')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x39'));db[_0x6f55('0x3a')]=db['sequelize'][_0x6f55('0x13')](_0x6f55('0x3b'));db[_0x6f55('0x3c')]=db[_0x6f55('0x1')][_0x6f55('0x13')]('../api/mailInteraction/mailInteraction.model');db[_0x6f55('0x3d')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x3e'));db[_0x6f55('0x3f')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x40'));db['MailQueueReport']=db[_0x6f55('0x1')][_0x6f55('0x13')]('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x41'));db[_0x6f55('0x42')]=db['sequelize'][_0x6f55('0x13')]('../api/dashboardItem/dashboardItem.model');db['FaxAccount']=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x43'));db['FaxApplication']=db['sequelize'][_0x6f55('0x13')](_0x6f55('0x44'));db[_0x6f55('0x45')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x46'));db[_0x6f55('0x47')]=db[_0x6f55('0x1')]['import'](_0x6f55('0x48'));db['FaxQueue']=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x49'));db[_0x6f55('0x4a')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x4b'));db[_0x6f55('0x4c')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x4d'));db[_0x6f55('0x4e')]=db[_0x6f55('0x1')][_0x6f55('0x13')]('../api/smsApplication/smsApplication.model');db[_0x6f55('0x4f')]=db[_0x6f55('0x1')]['import'](_0x6f55('0x50'));db[_0x6f55('0x51')]=db[_0x6f55('0x1')][_0x6f55('0x13')]('../api/smsMessage/smsMessage.model');db[_0x6f55('0x52')]=db[_0x6f55('0x1')]['import'](_0x6f55('0x53'));db['OpenchannelAccount']=db[_0x6f55('0x1')][_0x6f55('0x13')]('../api/openchannelAccount/openchannelAccount.model');db['OpenchannelApplication']=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x54'));db['OpenchannelInteraction']=db['sequelize'][_0x6f55('0x13')](_0x6f55('0x55'));db[_0x6f55('0x56')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x57'));db[_0x6f55('0x58')]=db['sequelize'][_0x6f55('0x13')]('../api/openchannelQueue/openchannelQueue.model');db[_0x6f55('0x59')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x5a'));db[_0x6f55('0x5b')]=db[_0x6f55('0x1')]['import'](_0x6f55('0x5c'));db[_0x6f55('0x5d')]=db['sequelize'][_0x6f55('0x13')](_0x6f55('0x5e'));db[_0x6f55('0x5f')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x60'));db[_0x6f55('0x61')]=db['sequelize'][_0x6f55('0x13')](_0x6f55('0x62'));db['ChatOfflineMessage']=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x63'));db[_0x6f55('0x64')]=db[_0x6f55('0x1')][_0x6f55('0x13')]('../api/chatQueue/chatQueue.model');db[_0x6f55('0x65')]=db['sequelize']['import'](_0x6f55('0x66'));db[_0x6f55('0x67')]=db[_0x6f55('0x1')][_0x6f55('0x13')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x6f55('0x68')]=db[_0x6f55('0x1')][_0x6f55('0x13')]('../api/cmCompany/cmCompany.model');db[_0x6f55('0x69')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x6a'));db['CmHopper']=db['sequelize']['import'](_0x6f55('0x6b'));db[_0x6f55('0x6c')]=db['sequelize'][_0x6f55('0x13')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x6f55('0x6d')]=db[_0x6f55('0x1')][_0x6f55('0x13')]('../api/cmHopperFinal/cmHopperFinal.model');db['CmHopperHistory']=db['sequelize'][_0x6f55('0x13')](_0x6f55('0x6e'));db[_0x6f55('0x6f')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x70'));db['CmCustomField']=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x71'));db[_0x6f55('0x72')]=db[_0x6f55('0x1')]['import'](_0x6f55('0x73'));db['Automation']=db[_0x6f55('0x1')]['import']('../api/automation/automation.model');db[_0x6f55('0x74')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x75'));db['Disposition']=db['sequelize'][_0x6f55('0x13')](_0x6f55('0x76'));db[_0x6f55('0x77')]=db['sequelize'][_0x6f55('0x13')](_0x6f55('0x78'));db[_0x6f55('0x79')]=db[_0x6f55('0x1')]['import'](_0x6f55('0x7a'));db[_0x6f55('0x7b')]=db[_0x6f55('0x1')][_0x6f55('0x13')]('../api/pause/pause.model');db[_0x6f55('0x7c')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x7d'));db[_0x6f55('0x7e')]=db[_0x6f55('0x1')]['import'](_0x6f55('0x7f'));db[_0x6f55('0x80')]=db['sequelize'][_0x6f55('0x13')](_0x6f55('0x81'));db[_0x6f55('0x82')]=db[_0x6f55('0x1')][_0x6f55('0x13')]('../api/sound/sound.model');db['Tag']=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x83'));db[_0x6f55('0x84')]=db['sequelize'][_0x6f55('0x13')]('../api/template/template.model');db[_0x6f55('0x85')]=db[_0x6f55('0x1')]['import'](_0x6f55('0x86'));db[_0x6f55('0x87')]=db['sequelize'][_0x6f55('0x13')](_0x6f55('0x88'));db[_0x6f55('0x89')]=db[_0x6f55('0x1')]['import'](_0x6f55('0x8a'));db[_0x6f55('0x8b')]=db['sequelize'][_0x6f55('0x13')](_0x6f55('0x8c'));db[_0x6f55('0x8d')]=db['sequelize'][_0x6f55('0x13')](_0x6f55('0x8e'));db[_0x6f55('0x8f')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x90'));db['AnalyticExtractedReport']=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x91'));db[_0x6f55('0x92')]=db['sequelize'][_0x6f55('0x13')](_0x6f55('0x93'));db[_0x6f55('0x94')]=db[_0x6f55('0x1')]['import'](_0x6f55('0x95'));db[_0x6f55('0x96')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x97'));db['SalesforceAccount']=db[_0x6f55('0x1')][_0x6f55('0x13')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x6f55('0x98')]=db['sequelize'][_0x6f55('0x13')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x6f55('0x99')]=db['sequelize']['import'](_0x6f55('0x9a'));db[_0x6f55('0x9b')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0x9c'));db[_0x6f55('0x9d')]=db['sequelize']['import'](_0x6f55('0x9e'));db[_0x6f55('0x9f')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0xa0'));db[_0x6f55('0xa1')]=db['sequelize'][_0x6f55('0x13')]('../api/intDeskAccount/intDeskAccount.model');db[_0x6f55('0xa2')]=db[_0x6f55('0x1')]['import']('../api/intDeskConfiguration/intDeskConfiguration.model');db['DeskField']=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0xa3'));db[_0x6f55('0xa4')]=db['sequelize'][_0x6f55('0x13')](_0x6f55('0xa5'));db['ZohoConfiguration']=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0xa6'));db[_0x6f55('0xa7')]=db[_0x6f55('0x1')][_0x6f55('0x13')]('../api/intZohoField/intZohoField.model');db[_0x6f55('0xa8')]=db[_0x6f55('0x1')][_0x6f55('0x13')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x6f55('0xa9')]=db['sequelize'][_0x6f55('0x13')](_0x6f55('0xaa'));db[_0x6f55('0xab')]=db[_0x6f55('0x1')]['import'](_0x6f55('0xac'));db[_0x6f55('0xad')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0xae'));db[_0x6f55('0xaf')]=db[_0x6f55('0x1')][_0x6f55('0x13')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x6f55('0xb0')]=db[_0x6f55('0x1')]['import']('../api/intFreshdeskField/intFreshdeskField.model');db[_0x6f55('0xb1')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0xb2'));db[_0x6f55('0xb3')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0xb4'));db[_0x6f55('0xb5')]=db[_0x6f55('0x1')]['import'](_0x6f55('0xb6'));db[_0x6f55('0xb7')]=db[_0x6f55('0x1')]['import'](_0x6f55('0xb8'));db[_0x6f55('0xb9')]=db[_0x6f55('0x1')]['import']('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x6f55('0xba')]=db['sequelize'][_0x6f55('0x13')](_0x6f55('0xbb'));db[_0x6f55('0xbc')]=db[_0x6f55('0x1')][_0x6f55('0x13')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x6f55('0xbd')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0xbe'));db[_0x6f55('0xbf')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0xc0'));db[_0x6f55('0x89')]=db['sequelize'][_0x6f55('0x13')](_0x6f55('0x8a'));db[_0x6f55('0xc1')]=db[_0x6f55('0x1')][_0x6f55('0x13')]('../api/network/network.model');db[_0x6f55('0xc2')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0xc3'));db[_0x6f55('0xc4')]=db[_0x6f55('0x1')]['import'](_0x6f55('0xc5'));db[_0x6f55('0xc6')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0xc7'));db[_0x6f55('0xc8')]=db[_0x6f55('0x1')][_0x6f55('0x13')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x6f55('0xc9')]=db['sequelize'][_0x6f55('0x13')](_0x6f55('0xca'));db[_0x6f55('0xcb')]=db[_0x6f55('0x1')]['import'](_0x6f55('0xcc'));db[_0x6f55('0xcd')]=db['sequelize'][_0x6f55('0x13')]('../api/squareReport/squareReport.model');db[_0x6f55('0xce')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0xcf'));db[_0x6f55('0xd0')]=db['sequelize'][_0x6f55('0x13')]('../api/jscriptyProject/jscriptyProject.model');db[_0x6f55('0xd1')]=db['sequelize'][_0x6f55('0x13')]('../api/setting/setting.model');db['SquareOdbc']=db[_0x6f55('0x1')][_0x6f55('0x13')]('../api/squareOdbc/squareOdbc.model');db['SquareProject']=db[_0x6f55('0x1')][_0x6f55('0x13')]('../api/squareProject/squareProject.model');db[_0x6f55('0xd2')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0xd3'));db[_0x6f55('0xd4')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0xd5'));db['Team']=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0xd6'));db[_0x6f55('0xd7')]=db['sequelize'][_0x6f55('0x13')](_0x6f55('0xd8'));db[_0x6f55('0xd9')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0xda'));db['Migration']=db[_0x6f55('0x1')][_0x6f55('0x13')]('../api/migration/migration.model');db[_0x6f55('0xdb')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0xdc'));db['Plugin']=db['sequelize'][_0x6f55('0x13')]('../api/plugin/plugin.model');db[_0x6f55('0xdd')]=db['sequelize'][_0x6f55('0x13')](_0x6f55('0xde'));db[_0x6f55('0xdf')]=db[_0x6f55('0x1')][_0x6f55('0x13')]('../api/chatTransferReport/chatTransferReport.model');db[_0x6f55('0xe0')]=db[_0x6f55('0x1')][_0x6f55('0x13')]('../api/faxTransferReport/faxTransferReport.model');db[_0x6f55('0xe1')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0xe2'));db[_0x6f55('0xe3')]=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0xe4'));db[_0x6f55('0xe5')]=db['sequelize'][_0x6f55('0x13')](_0x6f55('0xe6'));db[_0x6f55('0xe7')]=db[_0x6f55('0x1')][_0x6f55('0x13')]('../api/voicePrefix/voicePrefix.model');db[_0x6f55('0xe8')]=db['sequelize'][_0x6f55('0x13')](_0x6f55('0xe9'));db['UserProfileSection']=db[_0x6f55('0x1')][_0x6f55('0x13')](_0x6f55('0xea'));db[_0x6f55('0xeb')]=db[_0x6f55('0x1')][_0x6f55('0x13')]('../api/userProfileResource/userProfileResource.model');db[_0x6f55('0xec')][_0x6f55('0xed')](db[_0x6f55('0x1e')],{'as':_0x6f55('0x1e'),'onDelete':'cascade','foreignKey':_0x6f55('0xee')});db['User']['hasMany'](db['VoiceRecording'],{'as':_0x6f55('0xef'),'foreignKey':_0x6f55('0xee')});db[_0x6f55('0xec')][_0x6f55('0xf0')](db[_0x6f55('0xf1')],{'as':_0x6f55('0xf2'),'foreignKey':_0x6f55('0xee')});db[_0x6f55('0xec')][_0x6f55('0xf0')](db['VoiceExtension'],{'as':_0x6f55('0xf3'),'onDelete':_0x6f55('0xf4'),'hooks':!![]});db['User'][_0x6f55('0xf0')](db[_0x6f55('0x6d')],{'as':_0x6f55('0xf5'),'foreignKey':_0x6f55('0xee')});db['User'][_0x6f55('0xf0')](db[_0x6f55('0xf6')],{'as':'HopperHistory','foreignKey':'UserId'});db['User'][_0x6f55('0xf0')](db['ReportAgentPreview'],{'as':_0x6f55('0x6f'),'foreignKey':_0x6f55('0xee')});db[_0x6f55('0xec')][_0x6f55('0xf0')](db[_0x6f55('0xf7')],{'as':'OpenchannelInteractions','foreignKey':'UserId'});db[_0x6f55('0xec')][_0x6f55('0xf0')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0x6f55('0xee')});db[_0x6f55('0xec')][_0x6f55('0xf0')](db[_0x6f55('0x4f')],{'as':_0x6f55('0xf8'),'foreignKey':_0x6f55('0xee')});db['User']['hasMany'](db[_0x6f55('0x45')],{'as':_0x6f55('0xf9'),'foreignKey':_0x6f55('0xee')});db[_0x6f55('0xec')]['hasMany'](db['MailInteraction'],{'as':_0x6f55('0xfa'),'foreignKey':_0x6f55('0xee')});db['User'][_0x6f55('0xfb')](db[_0x6f55('0xe8')],{'as':'UserProfile','foreignKey':_0x6f55('0xfc')});db[_0x6f55('0xec')]['belongsToMany'](db[_0x6f55('0x65')],{'as':_0x6f55('0xfd'),'through':_0x6f55('0xfe')});db[_0x6f55('0xec')][_0x6f55('0xff')](db[_0x6f55('0x69')],{'as':_0x6f55('0x100'),'through':_0x6f55('0x101')});db[_0x6f55('0xec')][_0x6f55('0xff')](db[_0x6f55('0xe5')],{'as':_0x6f55('0x102'),'through':_0x6f55('0x103')});db[_0x6f55('0xec')][_0x6f55('0xff')](db['Team'],{'through':_0x6f55('0x104')});db[_0x6f55('0xec')][_0x6f55('0xff')](db[_0x6f55('0x3c')],{'as':_0x6f55('0xfa'),'through':'user_has_mail_interactions'});db[_0x6f55('0xec')][_0x6f55('0xff')](db[_0x6f55('0x5f')],{'as':_0x6f55('0x105'),'through':_0x6f55('0x106')});db[_0x6f55('0xec')][_0x6f55('0xff')](db['FaxInteraction'],{'as':_0x6f55('0xf9'),'through':'user_has_fax_interactions'});db[_0x6f55('0xec')]['belongsToMany'](db[_0x6f55('0x4f')],{'as':_0x6f55('0xf8'),'through':_0x6f55('0x107')});db[_0x6f55('0xec')]['belongsToMany'](db[_0x6f55('0xf7')],{'as':_0x6f55('0x108'),'through':_0x6f55('0x109')});db[_0x6f55('0xec')][_0x6f55('0xff')](db['VoiceQueue'],{'as':_0x6f55('0x10a'),'through':_0x6f55('0x2c'),'required':![]});db[_0x6f55('0xec')]['belongsToMany'](db[_0x6f55('0x38')],{'as':_0x6f55('0x10b'),'through':_0x6f55('0x2e'),'required':![]});db[_0x6f55('0xec')][_0x6f55('0xff')](db[_0x6f55('0x64')],{'as':_0x6f55('0x10c'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x6f55('0xec')][_0x6f55('0xff')](db[_0x6f55('0x10d')],{'as':'FaxQueues','through':_0x6f55('0x30'),'required':![]});db[_0x6f55('0xec')][_0x6f55('0xff')](db[_0x6f55('0x52')],{'as':'SmsQueues','through':_0x6f55('0x10e'),'required':![]});db['User'][_0x6f55('0xff')](db[_0x6f55('0x58')],{'as':_0x6f55('0x10f'),'through':'UserOpenchannelQueue','required':![]});db[_0x6f55('0xec')]['belongsToMany'](db[_0x6f55('0xe5')],{'through':_0x6f55('0x103')});db[_0x6f55('0xec')][_0x6f55('0xff')](db[_0x6f55('0xe7')],{'as':_0x6f55('0x110'),'through':_0x6f55('0x111'),'required':![]});db[_0x6f55('0xec')][_0x6f55('0xff')](db[_0x6f55('0x59')],{'as':_0x6f55('0x112'),'through':_0x6f55('0x113')});db['User']['belongsToMany'](db[_0x6f55('0x114')],{'as':'FaxAccounts','through':_0x6f55('0x115')});db[_0x6f55('0xec')][_0x6f55('0xff')](db['MailAccount'],{'as':'MailAccounts','through':_0x6f55('0x116')});db[_0x6f55('0xec')][_0x6f55('0xff')](db[_0x6f55('0x117')],{'as':_0x6f55('0x118'),'through':'user_has_openchannel_accounts'});db[_0x6f55('0xec')]['belongsToMany'](db['SmsAccount'],{'as':_0x6f55('0x119'),'through':_0x6f55('0x11a')});db[_0x6f55('0xec')][_0x6f55('0xff')](db[_0x6f55('0x11b')],{'as':_0x6f55('0x11c'),'through':_0x6f55('0x11d')});db[_0x6f55('0x11e')][_0x6f55('0xf0')](db[_0x6f55('0x16')],{'as':_0x6f55('0x11f'),'onDelete':_0x6f55('0xf4'),'foreignKey':_0x6f55('0x120')});db[_0x6f55('0x14')]['hasMany'](db[_0x6f55('0x16')],{'onDelete':_0x6f55('0xf4')});db['VoiceExtension'][_0x6f55('0xf0')](db[_0x6f55('0x16')],{'as':'Applications','onDelete':_0x6f55('0xf4')});db[_0x6f55('0x18')][_0x6f55('0xff')](db[_0x6f55('0x82')],{'as':_0x6f55('0x121'),'through':_0x6f55('0x122')});db[_0x6f55('0x1a')][_0x6f55('0xf0')](db['UserVoiceQueueRt'],{'as':_0x6f55('0x123'),'foreignKey':_0x6f55('0x124')});db[_0x6f55('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x6f55('0x125'),'foreignKey':_0x6f55('0x124')});db[_0x6f55('0x1a')][_0x6f55('0xf0')](db['CmHopperFinal'],{'as':_0x6f55('0xf5'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0x6f55('0xf6')],{'as':_0x6f55('0x126'),'foreignKey':'VoiceQueueId'});db[_0x6f55('0x1a')]['hasMany'](db['ReportAgentPreview'],{'as':_0x6f55('0x6f'),'foreignKey':_0x6f55('0x124')});db[_0x6f55('0x1a')]['hasMany'](db[_0x6f55('0x6c')],{'as':_0x6f55('0x127'),'foreignKey':_0x6f55('0x124')});db['VoiceQueue'][_0x6f55('0xf0')](db[_0x6f55('0xc9')],{'as':_0x6f55('0x128'),'foreignKey':_0x6f55('0x124')});db[_0x6f55('0x1a')][_0x6f55('0xfb')](db['Trunk'],{'as':_0x6f55('0x28'),'foreignKey':'TrunkId'});db['VoiceQueue']['belongsTo'](db['Trunk'],{'as':'TrunkBackup','foreignKey':_0x6f55('0x129')});db[_0x6f55('0x1a')]['belongsTo'](db[_0x6f55('0x79')],{'as':_0x6f55('0x79'),'foreignKey':'IntervalId'});db[_0x6f55('0x1a')][_0x6f55('0xfb')](db[_0x6f55('0x7b')],{'as':'mandatoryDispositionPause','foreignKey':_0x6f55('0x12a')});db[_0x6f55('0x1a')][_0x6f55('0xff')](db[_0x6f55('0xe5')],{'as':_0x6f55('0x102'),'through':_0x6f55('0x12b')});db[_0x6f55('0x1a')][_0x6f55('0xff')](db[_0x6f55('0xec')],{'as':_0x6f55('0x12c'),'through':_0x6f55('0x2c')});db['VoiceQueue']['belongsToMany'](db[_0x6f55('0x12d')],{'as':'Teams','through':_0x6f55('0x12e')});db['VoiceQueue'][_0x6f55('0xff')](db[_0x6f55('0xe5')],{'as':'BlackLists','through':_0x6f55('0x12f')});db['VoiceRecording'][_0x6f55('0xfb')](db['User'],{'as':'User','foreignKey':_0x6f55('0xee')});db[_0x6f55('0x1e')][_0x6f55('0xf0')](db['VoiceMailMessage'],{'as':_0x6f55('0x130'),'onDelete':'cascade','foreignKey':_0x6f55('0x131'),'sourceKey':_0x6f55('0x132')});db[_0x6f55('0x20')][_0x6f55('0xfb')](db[_0x6f55('0x1e')],{'foreignKey':_0x6f55('0x131'),'targetKey':_0x6f55('0x132')});db[_0x6f55('0x22')][_0x6f55('0xf0')](db[_0x6f55('0x133')],{'as':_0x6f55('0x134'),'foreignKey':'uniqueid','constraints':![]});db[_0x6f55('0x22')][_0x6f55('0xf0')](db[_0x6f55('0x135')],{'as':_0x6f55('0x136'),'foreignKey':_0x6f55('0x137'),'constraints':![]});db[_0x6f55('0x22')][_0x6f55('0xfb')](db['User'],{'as':_0x6f55('0xec'),'foreignKey':_0x6f55('0xee')});db['VoiceCallReport']['belongsTo'](db['CmContact'],{'as':_0x6f55('0x138'),'foreignKey':'ContactId'});db[_0x6f55('0x34')][_0x6f55('0xfb')](db[_0x6f55('0x139')],{'as':_0x6f55('0x139'),'foreignKey':_0x6f55('0x13a')});db[_0x6f55('0x36')][_0x6f55('0xfb')](db[_0x6f55('0x139')],{'as':_0x6f55('0x139'),'foreignKey':'MailAccountId'});db[_0x6f55('0x139')]['hasOne'](db[_0x6f55('0x34')],{'as':_0x6f55('0x13b'),'onDelete':_0x6f55('0xf4')});db['MailAccount'][_0x6f55('0xed')](db['MailServerOut'],{'as':'Smtp','onDelete':'cascade'});db['MailAccount'][_0x6f55('0xf0')](db[_0x6f55('0x13c')],{'as':_0x6f55('0x13d'),'foreignKey':_0x6f55('0x13a')});db['MailAccount'][_0x6f55('0xf0')](db[_0x6f55('0x74')],{'as':_0x6f55('0x13e'),'foreignKey':_0x6f55('0x13a')});db[_0x6f55('0x139')][_0x6f55('0xf0')](db[_0x6f55('0x3d')],{'as':_0x6f55('0x130'),'foreignKey':'MailAccountId'});db[_0x6f55('0x139')]['hasMany'](db[_0x6f55('0x3c')],{'as':_0x6f55('0x13f')});db[_0x6f55('0x139')]['hasMany'](db['MailApplication'],{'as':'Applications'});db[_0x6f55('0x139')]['belongsTo'](db[_0x6f55('0xe5')],{'as':'List','foreignKey':_0x6f55('0x140')});db[_0x6f55('0x139')]['belongsTo'](db['Template'],{'as':'Template','foreignKey':_0x6f55('0x141')});db[_0x6f55('0x139')][_0x6f55('0xfb')](db[_0x6f55('0x7b')],{'as':_0x6f55('0x142'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x6f55('0x139')][_0x6f55('0xff')](db[_0x6f55('0xec')],{'as':'Agents','through':'user_has_mail_accounts'});db[_0x6f55('0x38')]['belongsToMany'](db[_0x6f55('0xec')],{'as':_0x6f55('0x12c'),'through':_0x6f55('0x2e')});db[_0x6f55('0x38')][_0x6f55('0xff')](db[_0x6f55('0x12d')],{'through':_0x6f55('0x143'),'as':_0x6f55('0x144')});db[_0x6f55('0x3c')][_0x6f55('0xf0')](db['MailMessage'],{'as':_0x6f55('0x130'),'onDelete':_0x6f55('0xf4'),'foreignKey':_0x6f55('0x145')});db[_0x6f55('0x3c')][_0x6f55('0xfb')](db[_0x6f55('0x139')],{'as':_0x6f55('0x146'),'foreignKey':_0x6f55('0x13a')});db[_0x6f55('0x3c')][_0x6f55('0xfb')](db[_0x6f55('0x69')],{'as':'Contact','foreignKey':_0x6f55('0x147')});db['MailInteraction'][_0x6f55('0xfb')](db[_0x6f55('0xec')],{'as':_0x6f55('0x148'),'foreignKey':_0x6f55('0xee')});db[_0x6f55('0x3c')][_0x6f55('0xff')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0x6f55('0x149')});db[_0x6f55('0x3c')][_0x6f55('0xff')](db[_0x6f55('0x14a')],{'through':_0x6f55('0x14b'),'as':_0x6f55('0x14c')});db[_0x6f55('0x3c')][_0x6f55('0xff')](db[_0x6f55('0xec')],{'as':'Users','through':_0x6f55('0x14d'),'foreignKey':_0x6f55('0x145')});db['MailMessage'][_0x6f55('0xf0')](db['Attachment'],{'as':_0x6f55('0x14e'),'onDelete':_0x6f55('0xf4')});db['MailMessage'][_0x6f55('0xfb')](db[_0x6f55('0xec')],{'as':'User'});db[_0x6f55('0x3d')]['belongsTo'](db[_0x6f55('0x69')],{'onDelete':'cascade','as':'Contact'});db['MailMessage']['belongsTo'](db[_0x6f55('0x3c')],{'as':_0x6f55('0x14f'),'foreignKey':_0x6f55('0x145')});db[_0x6f55('0x3d')]['belongsTo'](db['MailAccount'],{'as':_0x6f55('0x146'),'foreignKey':_0x6f55('0x13a')});db[_0x6f55('0x3f')][_0x6f55('0xfb')](db[_0x6f55('0xec')],{'onDelete':_0x6f55('0x150')});db[_0x6f55('0x3f')][_0x6f55('0xfb')](db[_0x6f55('0x38')],{'onDelete':_0x6f55('0x150')});db[_0x6f55('0x3f')][_0x6f55('0xfb')](db[_0x6f55('0x139')],{'onDelete':_0x6f55('0x150')});db[_0x6f55('0x3f')]['belongsTo'](db[_0x6f55('0x79')],{'onDelete':_0x6f55('0x150'),'foreignKey':_0x6f55('0x151')});db[_0x6f55('0x3f')]['belongsTo'](db['Tag'],{'onDelete':_0x6f55('0x150'),'foreignKey':_0x6f55('0x152')});db['MailQueueReport']['belongsTo'](db[_0x6f55('0x139')],{});db[_0x6f55('0x153')]['belongsTo'](db[_0x6f55('0xe5')],{'as':'List','foreignKey':_0x6f55('0x140')});db['MailQueueReport'][_0x6f55('0xfb')](db['CmContact'],{'as':_0x6f55('0x138'),'foreignKey':_0x6f55('0x147')});db[_0x6f55('0x153')][_0x6f55('0xfb')](db[_0x6f55('0x3c')],{});db['MailQueueReport'][_0x6f55('0xfb')](db[_0x6f55('0x3d')],{});db['MailQueueReport'][_0x6f55('0xfb')](db[_0x6f55('0xec')],{});db[_0x6f55('0x153')]['belongsTo'](db[_0x6f55('0x38')],{});db['Dashboard'][_0x6f55('0xf0')](db[_0x6f55('0x42')],{'as':'Items','onDelete':_0x6f55('0xf4')});db[_0x6f55('0x114')][_0x6f55('0xf0')](db['Disposition'],{'as':_0x6f55('0x13d'),'foreignKey':_0x6f55('0x154')});db['FaxAccount']['hasMany'](db[_0x6f55('0x74')],{'as':'Answers','foreignKey':'FaxAccountId'});db['FaxAccount'][_0x6f55('0xf0')](db[_0x6f55('0x45')],{'as':_0x6f55('0x13f')});db[_0x6f55('0x114')][_0x6f55('0xf0')](db[_0x6f55('0x155')],{'as':'Applications'});db[_0x6f55('0x114')]['hasMany'](db[_0x6f55('0x16')],{'as':_0x6f55('0x156'),'onDelete':_0x6f55('0xf4')});db[_0x6f55('0x114')][_0x6f55('0xf0')](db[_0x6f55('0x47')],{'as':_0x6f55('0x130')});db[_0x6f55('0x114')][_0x6f55('0xfb')](db[_0x6f55('0x28')],{'as':'Trunk'});db[_0x6f55('0x114')][_0x6f55('0xfb')](db['CmList'],{'as':_0x6f55('0x157'),'foreignKey':_0x6f55('0x140')});db['FaxAccount'][_0x6f55('0xfb')](db[_0x6f55('0x7b')],{'as':'mandatoryDispositionPause','foreignKey':_0x6f55('0x12a')});db['FaxAccount'][_0x6f55('0xff')](db['User'],{'as':_0x6f55('0x12c'),'through':_0x6f55('0x115')});db[_0x6f55('0x155')]['belongsTo'](db[_0x6f55('0xec')],{'onDelete':_0x6f55('0x150')});db[_0x6f55('0x155')][_0x6f55('0xfb')](db[_0x6f55('0x10d')],{'onDelete':_0x6f55('0x150')});db['FaxApplication'][_0x6f55('0xfb')](db[_0x6f55('0x114')],{'onDelete':_0x6f55('0x150')});db['FaxApplication'][_0x6f55('0xfb')](db[_0x6f55('0x14a')],{'onDelete':_0x6f55('0x150'),'foreignKey':_0x6f55('0x152')});db[_0x6f55('0x45')][_0x6f55('0xf0')](db[_0x6f55('0x47')],{'as':_0x6f55('0x130'),'onDelete':_0x6f55('0xf4'),'foreignKey':_0x6f55('0x158')});db[_0x6f55('0x45')][_0x6f55('0xfb')](db[_0x6f55('0x114')],{'as':_0x6f55('0x146'),'foreignKey':_0x6f55('0x154')});db[_0x6f55('0x45')][_0x6f55('0xfb')](db[_0x6f55('0x69')],{'as':_0x6f55('0x138'),'foreignKey':_0x6f55('0x147')});db[_0x6f55('0x45')]['belongsTo'](db['User'],{'as':_0x6f55('0x148'),'foreignKey':_0x6f55('0xee')});db[_0x6f55('0x45')]['belongsToMany'](db[_0x6f55('0x14a')],{'through':_0x6f55('0x159'),'as':_0x6f55('0x149')});db[_0x6f55('0x45')][_0x6f55('0xff')](db[_0x6f55('0x14a')],{'through':_0x6f55('0x159'),'as':'ThroughTags'});db[_0x6f55('0x45')][_0x6f55('0xff')](db['User'],{'as':_0x6f55('0x15a'),'through':_0x6f55('0x15b'),'foreignKey':_0x6f55('0x158')});db[_0x6f55('0x47')][_0x6f55('0xfb')](db[_0x6f55('0xec')],{'onDelete':_0x6f55('0xf4'),'as':_0x6f55('0xec')});db[_0x6f55('0x47')][_0x6f55('0xfb')](db[_0x6f55('0x45')],{'as':'Interaction','foreignKey':_0x6f55('0x158')});db[_0x6f55('0x47')][_0x6f55('0xfb')](db[_0x6f55('0x69')],{'onDelete':_0x6f55('0xf4'),'as':_0x6f55('0x138')});db[_0x6f55('0x47')][_0x6f55('0xfb')](db[_0x6f55('0xdb')],{'as':_0x6f55('0xdb'),'foreignKey':_0x6f55('0x15c')});db[_0x6f55('0x47')]['belongsTo'](db[_0x6f55('0x114')],{'as':_0x6f55('0x146'),'foreignKey':_0x6f55('0x154')});db['FaxQueue']['belongsToMany'](db[_0x6f55('0xec')],{'as':_0x6f55('0x12c'),'through':_0x6f55('0x30')});db['FaxQueue']['belongsToMany'](db['Team'],{'through':_0x6f55('0x15d'),'as':_0x6f55('0x144')});db[_0x6f55('0x4a')][_0x6f55('0xfb')](db[_0x6f55('0x114')],{});db['FaxQueueReport'][_0x6f55('0xfb')](db[_0x6f55('0xe5')],{'as':'List','foreignKey':_0x6f55('0x140')});db['FaxQueueReport'][_0x6f55('0xfb')](db[_0x6f55('0x69')],{'as':_0x6f55('0x138'),'foreignKey':_0x6f55('0x147')});db[_0x6f55('0x4a')]['belongsTo'](db[_0x6f55('0x45')],{});db[_0x6f55('0x4a')][_0x6f55('0xfb')](db['FaxMessage'],{});db[_0x6f55('0x4a')][_0x6f55('0xfb')](db[_0x6f55('0xec')],{});db[_0x6f55('0x4a')]['belongsTo'](db[_0x6f55('0x10d')],{});db[_0x6f55('0x4c')][_0x6f55('0xf0')](db['Disposition'],{'as':_0x6f55('0x13d'),'foreignKey':_0x6f55('0x15e')});db[_0x6f55('0x4c')][_0x6f55('0xf0')](db[_0x6f55('0x74')],{'as':'Answers','foreignKey':_0x6f55('0x15e')});db[_0x6f55('0x4c')][_0x6f55('0xf0')](db[_0x6f55('0x51')],{'as':_0x6f55('0x130'),'foreignKey':_0x6f55('0x15e')});db[_0x6f55('0x4c')][_0x6f55('0xf0')](db[_0x6f55('0x4f')],{'as':'Interactions'});db[_0x6f55('0x4c')][_0x6f55('0xf0')](db[_0x6f55('0x4e')],{'as':_0x6f55('0x15f')});db[_0x6f55('0x4c')]['belongsTo'](db['CmList'],{'as':_0x6f55('0x157'),'foreignKey':'ListId'});db[_0x6f55('0x4c')]['belongsTo'](db[_0x6f55('0x7b')],{'as':_0x6f55('0x142'),'foreignKey':_0x6f55('0x12a')});db[_0x6f55('0x4c')][_0x6f55('0xff')](db[_0x6f55('0xec')],{'as':_0x6f55('0x12c'),'through':_0x6f55('0x11a')});db['SmsApplication']['belongsTo'](db[_0x6f55('0xec')],{'onDelete':_0x6f55('0x150')});db['SmsApplication'][_0x6f55('0xfb')](db[_0x6f55('0x52')],{'onDelete':_0x6f55('0x150')});db['SmsApplication']['belongsTo'](db[_0x6f55('0x4c')],{'onDelete':'restrict'});db[_0x6f55('0x4e')][_0x6f55('0xfb')](db[_0x6f55('0x79')],{'onDelete':_0x6f55('0x150'),'foreignKey':_0x6f55('0x151')});db[_0x6f55('0x4e')][_0x6f55('0xfb')](db['Tag'],{'onDelete':_0x6f55('0x150'),'foreignKey':_0x6f55('0x152')});db[_0x6f55('0x4f')]['hasMany'](db[_0x6f55('0x51')],{'as':_0x6f55('0x130'),'onDelete':_0x6f55('0xf4'),'foreignKey':'SmsInteractionId'});db['SmsInteraction'][_0x6f55('0xfb')](db[_0x6f55('0x4c')],{'as':'Account','foreignKey':_0x6f55('0x15e')});db[_0x6f55('0x4f')][_0x6f55('0xfb')](db['CmContact'],{'as':_0x6f55('0x138'),'foreignKey':_0x6f55('0x147')});db[_0x6f55('0x4f')][_0x6f55('0xfb')](db[_0x6f55('0xec')],{'as':_0x6f55('0x148'),'foreignKey':'UserId'});db[_0x6f55('0x4f')][_0x6f55('0xff')](db[_0x6f55('0x14a')],{'through':_0x6f55('0x160'),'as':_0x6f55('0x149')});db[_0x6f55('0x4f')][_0x6f55('0xff')](db[_0x6f55('0x14a')],{'through':_0x6f55('0x160'),'as':'ThroughTags'});db['SmsInteraction'][_0x6f55('0xff')](db[_0x6f55('0xec')],{'as':_0x6f55('0x15a'),'through':_0x6f55('0x107'),'foreignKey':_0x6f55('0x161')});db['SmsMessage']['belongsTo'](db[_0x6f55('0xec')],{'as':_0x6f55('0xec')});db[_0x6f55('0x51')][_0x6f55('0xfb')](db['CmContact'],{'onDelete':_0x6f55('0xf4'),'as':_0x6f55('0x138')});db['SmsMessage']['belongsTo'](db[_0x6f55('0x4f')],{'onDelete':_0x6f55('0xf4'),'as':_0x6f55('0x14f'),'foreignKey':_0x6f55('0x161')});db[_0x6f55('0x51')][_0x6f55('0xfb')](db['SmsAccount'],{'as':_0x6f55('0x146'),'foreignKey':_0x6f55('0x15e')});db['SmsQueue']['belongsToMany'](db[_0x6f55('0xec')],{'as':_0x6f55('0x12c'),'through':'UserSmsQueue','foreignKey':_0x6f55('0x162')});db[_0x6f55('0x52')][_0x6f55('0xff')](db[_0x6f55('0x12d')],{'through':_0x6f55('0x163'),'as':_0x6f55('0x144')});db['OpenchannelAccount']['hasMany'](db[_0x6f55('0x13c')],{'as':_0x6f55('0x13d'),'foreignKey':_0x6f55('0x164')});db[_0x6f55('0x117')]['hasMany'](db[_0x6f55('0x74')],{'as':_0x6f55('0x13e'),'foreignKey':'OpenchannelAccountId'});db[_0x6f55('0x117')][_0x6f55('0xf0')](db[_0x6f55('0xf7')],{'as':_0x6f55('0x13f'),'foreignKey':_0x6f55('0x164')});db[_0x6f55('0x117')][_0x6f55('0xf0')](db[_0x6f55('0x56')],{'as':_0x6f55('0x130'),'foreignKey':_0x6f55('0x164')});db[_0x6f55('0x117')][_0x6f55('0xf0')](db[_0x6f55('0x165')],{'as':'Applications','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x6f55('0xfb')](db[_0x6f55('0xe5')],{'as':_0x6f55('0x157'),'foreignKey':_0x6f55('0x140')});db[_0x6f55('0x117')][_0x6f55('0xfb')](db[_0x6f55('0x7b')],{'as':_0x6f55('0x142'),'foreignKey':_0x6f55('0x12a')});db[_0x6f55('0x117')][_0x6f55('0xff')](db['User'],{'as':_0x6f55('0x12c'),'through':_0x6f55('0x166')});db[_0x6f55('0x165')][_0x6f55('0xfb')](db[_0x6f55('0xec')],{'onDelete':'restrict'});db[_0x6f55('0x165')][_0x6f55('0xfb')](db['OpenchannelQueue'],{'onDelete':_0x6f55('0x150'),'foreignKey':_0x6f55('0x167')});db[_0x6f55('0x165')][_0x6f55('0xfb')](db['OpenchannelAccount'],{'onDelete':_0x6f55('0x150'),'foreignKey':_0x6f55('0x164')});db[_0x6f55('0x165')]['belongsTo'](db[_0x6f55('0x79')],{'onDelete':'restrict','foreignKey':_0x6f55('0x151')});db['OpenchannelApplication'][_0x6f55('0xfb')](db[_0x6f55('0x14a')],{'onDelete':_0x6f55('0x150'),'foreignKey':_0x6f55('0x152')});db[_0x6f55('0xf7')][_0x6f55('0xf0')](db[_0x6f55('0x56')],{'as':'Messages','onDelete':_0x6f55('0xf4'),'foreignKey':_0x6f55('0x168')});db[_0x6f55('0xf7')]['belongsTo'](db[_0x6f55('0x117')],{'as':_0x6f55('0x146'),'foreignKey':_0x6f55('0x164')});db[_0x6f55('0xf7')][_0x6f55('0xfb')](db['CmContact'],{'as':'Contact','foreignKey':_0x6f55('0x147')});db[_0x6f55('0xf7')]['belongsTo'](db[_0x6f55('0xec')],{'as':_0x6f55('0x148'),'foreignKey':_0x6f55('0xee')});db[_0x6f55('0xf7')][_0x6f55('0xff')](db['Tag'],{'through':_0x6f55('0x169'),'as':_0x6f55('0x149')});db['OpenchannelInteraction'][_0x6f55('0xff')](db['Tag'],{'through':_0x6f55('0x169'),'as':_0x6f55('0x14c')});db[_0x6f55('0xf7')][_0x6f55('0xff')](db[_0x6f55('0xec')],{'as':_0x6f55('0x15a'),'through':_0x6f55('0x109'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0x6f55('0xfb')](db[_0x6f55('0xec')],{'onDelete':_0x6f55('0xf4'),'as':_0x6f55('0xec')});db['OpenchannelMessage'][_0x6f55('0xfb')](db['CmContact'],{'onDelete':'cascade','as':_0x6f55('0x138')});db[_0x6f55('0x56')][_0x6f55('0xfb')](db[_0x6f55('0xf7')],{'onDelete':_0x6f55('0xf4'),'as':'Interaction','foreignKey':_0x6f55('0x168')});db[_0x6f55('0x56')]['belongsTo'](db[_0x6f55('0xdb')],{'as':'Attachment','foreignKey':_0x6f55('0x15c')});db[_0x6f55('0x56')][_0x6f55('0xfb')](db[_0x6f55('0x117')],{'as':_0x6f55('0x146'),'foreignKey':_0x6f55('0x164')});db[_0x6f55('0x58')][_0x6f55('0xff')](db[_0x6f55('0xec')],{'as':'Agents','through':_0x6f55('0x16a'),'foreignKey':_0x6f55('0x167')});db[_0x6f55('0x58')][_0x6f55('0xff')](db[_0x6f55('0x12d')],{'through':_0x6f55('0x16b'),'as':_0x6f55('0x144')});db[_0x6f55('0x59')][_0x6f55('0xf0')](db[_0x6f55('0x13c')],{'as':_0x6f55('0x13d'),'foreignKey':_0x6f55('0x16c')});db['ChatWebsite'][_0x6f55('0xf0')](db['CannedAnswer'],{'as':_0x6f55('0x13e'),'foreignKey':_0x6f55('0x16c')});db[_0x6f55('0x59')][_0x6f55('0xf0')](db[_0x6f55('0x67')],{'as':_0x6f55('0x16d')});db['ChatWebsite']['hasMany'](db['ChatInteraction'],{'as':_0x6f55('0x13f')});db['ChatWebsite'][_0x6f55('0xf0')](db[_0x6f55('0x5d')],{'as':_0x6f55('0x15f')});db[_0x6f55('0x59')][_0x6f55('0xf0')](db[_0x6f55('0x61')],{'as':'Messages'});db[_0x6f55('0x59')][_0x6f55('0xfb')](db[_0x6f55('0xe5')],{'as':'List','foreignKey':_0x6f55('0x140')});db[_0x6f55('0x59')][_0x6f55('0xfb')](db[_0x6f55('0x79')],{'as':_0x6f55('0x79'),'foreignKey':_0x6f55('0x151')});db[_0x6f55('0x59')][_0x6f55('0xfb')](db['Pause'],{'as':_0x6f55('0x142'),'foreignKey':_0x6f55('0x12a')});db['ChatWebsite'][_0x6f55('0xff')](db[_0x6f55('0xec')],{'as':_0x6f55('0x12c'),'through':'user_has_chat_websites'});db[_0x6f55('0x5b')][_0x6f55('0xfb')](db[_0x6f55('0x117')],{});db['OpenchannelQueueReport'][_0x6f55('0xfb')](db[_0x6f55('0xe5')],{'as':'List','foreignKey':_0x6f55('0x140')});db[_0x6f55('0x5b')][_0x6f55('0xfb')](db[_0x6f55('0x69')],{'as':_0x6f55('0x138'),'foreignKey':'ContactId'});db['OpenchannelQueueReport']['belongsTo'](db[_0x6f55('0xf7')],{});db[_0x6f55('0x5b')]['belongsTo'](db[_0x6f55('0x56')],{});db[_0x6f55('0x5b')]['belongsTo'](db[_0x6f55('0xec')],{});db[_0x6f55('0x5b')][_0x6f55('0xfb')](db[_0x6f55('0x58')],{});db[_0x6f55('0x5d')]['belongsTo'](db[_0x6f55('0xec')],{'as':_0x6f55('0x16e'),'foreignKey':_0x6f55('0xee'),'onDelete':_0x6f55('0x150')});db['ChatApplication'][_0x6f55('0xfb')](db[_0x6f55('0x64')],{'as':'Queue','foreignKey':_0x6f55('0x16f'),'onDelete':_0x6f55('0x150')});db['ChatApplication'][_0x6f55('0xfb')](db[_0x6f55('0x59')],{'as':_0x6f55('0x170'),'foreignKey':'ChatWebsiteId','onDelete':'restrict'});db[_0x6f55('0x5d')]['belongsTo'](db[_0x6f55('0x14a')],{'onDelete':_0x6f55('0x150'),'foreignKey':_0x6f55('0x152')});db[_0x6f55('0x5f')][_0x6f55('0xf0')](db[_0x6f55('0x61')],{'as':_0x6f55('0x130'),'onDelete':_0x6f55('0xf4'),'foreignKey':_0x6f55('0x171')});db['ChatInteraction'][_0x6f55('0xfb')](db[_0x6f55('0x59')],{'as':_0x6f55('0x146'),'foreignKey':'ChatWebsiteId'});db[_0x6f55('0x5f')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x6f55('0x147')});db[_0x6f55('0x5f')][_0x6f55('0xfb')](db['User'],{'as':_0x6f55('0x148'),'foreignKey':_0x6f55('0xee')});db[_0x6f55('0x5f')]['belongsToMany'](db['Tag'],{'through':_0x6f55('0x172'),'as':_0x6f55('0x149')});db[_0x6f55('0x5f')][_0x6f55('0xff')](db['Tag'],{'through':'chat_interaction_has_tags','as':'ThroughTags'});db[_0x6f55('0x5f')][_0x6f55('0xff')](db['User'],{'as':_0x6f55('0x15a'),'through':_0x6f55('0x106'),'foreignKey':_0x6f55('0x171')});db[_0x6f55('0x61')][_0x6f55('0xfb')](db[_0x6f55('0xec')],{'onDelete':_0x6f55('0xf4'),'as':'User'});db[_0x6f55('0x61')][_0x6f55('0xfb')](db['CmContact'],{'onDelete':_0x6f55('0xf4'),'as':'Contact','foreignKey':_0x6f55('0x147')});db[_0x6f55('0x61')]['belongsTo'](db[_0x6f55('0x5f')],{'onDelete':_0x6f55('0xf4'),'as':_0x6f55('0x14f'),'foreignKey':'ChatInteractionId'});db[_0x6f55('0x61')]['belongsTo'](db[_0x6f55('0xdb')],{'as':_0x6f55('0xdb'),'foreignKey':_0x6f55('0x15c')});db['ChatMessage']['belongsTo'](db[_0x6f55('0x59')],{'as':'Account','foreignKey':_0x6f55('0x16c')});db[_0x6f55('0x173')][_0x6f55('0xfb')](db[_0x6f55('0x69')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x6f55('0x147')});db[_0x6f55('0x173')]['belongsTo'](db[_0x6f55('0x59')],{'as':_0x6f55('0x146'),'foreignKey':_0x6f55('0x16c')});db['ChatQueue']['belongsToMany'](db[_0x6f55('0xec')],{'as':_0x6f55('0x12c'),'through':_0x6f55('0x2d'),'hooks':!![]});db[_0x6f55('0x64')]['belongsToMany'](db[_0x6f55('0x12d')],{'through':'team_has_chat_queues','as':_0x6f55('0x144')});db['ChatGroup']['hasMany'](db[_0x6f55('0xc4')],{'as':'Messages','foreignKey':_0x6f55('0x174'),'onDelete':'cascade'});db[_0x6f55('0x65')][_0x6f55('0xff')](db['User'],{'as':_0x6f55('0x123'),'through':'chat_group_has_users'});db['ChatProactiveAction'][_0x6f55('0xfb')](db[_0x6f55('0x59')],{'as':_0x6f55('0x170'),'foreignKey':_0x6f55('0x16c')});db['CmCompany'][_0x6f55('0xf0')](db[_0x6f55('0x69')],{'as':'Contacts','foreignKey':_0x6f55('0x175')});db['CmContact'][_0x6f55('0xf0')](db[_0x6f55('0x176')],{'as':_0x6f55('0x125'),'foreignKey':'ContactId'});db[_0x6f55('0x69')][_0x6f55('0xf0')](db[_0x6f55('0x6d')],{'as':_0x6f55('0xf5'),'foreignKey':'ContactId'});db[_0x6f55('0x69')][_0x6f55('0xf0')](db[_0x6f55('0xf6')],{'as':_0x6f55('0x126'),'foreignKey':_0x6f55('0x147')});db[_0x6f55('0x69')][_0x6f55('0xf0')](db['ReportAgentPreview'],{'as':_0x6f55('0x6f'),'foreignKey':'ContactId'});db['CmContact']['hasMany'](db[_0x6f55('0xc9')],{'as':_0x6f55('0x128'),'foreignKey':'ContactId'});db[_0x6f55('0x69')]['hasMany'](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0x6f55('0x147'),'onDelete':'restrict'});db[_0x6f55('0x69')][_0x6f55('0xf0')](db['ChatInteraction'],{'as':_0x6f55('0x105'),'foreignKey':_0x6f55('0x147'),'onDelete':_0x6f55('0x150')});db[_0x6f55('0x69')][_0x6f55('0xf0')](db['SmsInteraction'],{'as':_0x6f55('0xf8'),'foreignKey':_0x6f55('0x147'),'onDelete':_0x6f55('0x150')});db[_0x6f55('0x69')][_0x6f55('0xf0')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':'ContactId','onDelete':'restrict'});db['CmContact'][_0x6f55('0xf0')](db['MailInteraction'],{'as':_0x6f55('0xfa'),'foreignKey':_0x6f55('0x147'),'onDelete':_0x6f55('0x150')});db[_0x6f55('0x69')]['belongsTo'](db[_0x6f55('0x68')],{'as':_0x6f55('0x177'),'foreignKey':'CompanyId'});db[_0x6f55('0x69')][_0x6f55('0xfb')](db[_0x6f55('0xe5')],{'as':'List','foreignKey':_0x6f55('0x140'),'onDelete':_0x6f55('0xf4')});db[_0x6f55('0x69')][_0x6f55('0xff')](db['User'],{'as':_0x6f55('0x15a'),'through':_0x6f55('0x101')});db[_0x6f55('0x69')][_0x6f55('0xff')](db[_0x6f55('0x14a')],{'as':_0x6f55('0x149'),'through':_0x6f55('0x178')});db['CmContact'][_0x6f55('0xff')](db[_0x6f55('0x14a')],{'through':_0x6f55('0x178'),'as':_0x6f55('0x14c')});db[_0x6f55('0x176')][_0x6f55('0xfb')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId','onDelete':_0x6f55('0xf4')});db[_0x6f55('0x176')][_0x6f55('0xfb')](db[_0x6f55('0xe5')],{'as':_0x6f55('0x157'),'foreignKey':_0x6f55('0x140'),'onDelete':_0x6f55('0xf4')});db['CmHopper'][_0x6f55('0xfb')](db[_0x6f55('0xec')],{'as':_0x6f55('0x16e'),'foreignKey':_0x6f55('0xee')});db['CmHopper'][_0x6f55('0xfb')](db[_0x6f55('0x1a')],{'as':_0x6f55('0x179'),'foreignKey':'VoiceQueueId','onDelete':_0x6f55('0xf4')});db[_0x6f55('0x176')][_0x6f55('0xfb')](db[_0x6f55('0xd9')],{'as':_0x6f55('0xd9'),'foreignKey':_0x6f55('0x17a'),'onDelete':'cascade'});db[_0x6f55('0x176')][_0x6f55('0xfb')](db['User'],{'as':_0x6f55('0x148'),'foreignKey':_0x6f55('0x17b')});db[_0x6f55('0x6c')]['belongsTo'](db[_0x6f55('0x69')],{'as':_0x6f55('0x138'),'foreignKey':_0x6f55('0x147'),'onDelete':_0x6f55('0xf4')});db['CmHopperBlack'][_0x6f55('0xfb')](db[_0x6f55('0xe5')],{'as':'List','foreignKey':_0x6f55('0x140'),'onDelete':_0x6f55('0xf4')});db[_0x6f55('0x6c')][_0x6f55('0xfb')](db['VoiceQueue'],{'as':_0x6f55('0x179'),'foreignKey':_0x6f55('0x124'),'onDelete':_0x6f55('0xf4')});db[_0x6f55('0x6c')]['belongsTo'](db['Campaign'],{'as':_0x6f55('0xd9'),'foreignKey':_0x6f55('0x17a'),'onDelete':_0x6f55('0xf4')});db[_0x6f55('0x17c')][_0x6f55('0xf0')](db[_0x6f55('0x77')],{'as':{'plural':'All','singular':_0x6f55('0x17d')},'foreignKey':_0x6f55('0x17e'),'onDelete':_0x6f55('0xf4'),'hooks':!![]});db[_0x6f55('0x17c')][_0x6f55('0xf0')](db[_0x6f55('0x77')],{'as':{'plural':_0x6f55('0x17f'),'singular':'OneAny'},'foreignKey':_0x6f55('0x180'),'onDelete':_0x6f55('0xf4'),'hooks':!![]});db[_0x6f55('0x17c')][_0x6f55('0xf0')](db[_0x6f55('0x72')],{'as':_0x6f55('0x181'),'foreignKey':_0x6f55('0x182'),'onDelete':_0x6f55('0xf4'),'hooks':!![]});db['Interval'][_0x6f55('0xf0')](db[_0x6f55('0x79')],{'as':_0x6f55('0x183'),'foreignKey':'IntervalId','onDelete':_0x6f55('0xf4'),'hooks':!![],'required':![]});db[_0x6f55('0x79')][_0x6f55('0xf0')](db[_0x6f55('0x16')],{'as':_0x6f55('0xf3'),'foreignKey':_0x6f55('0x151'),'onDelete':_0x6f55('0x150')});db['Interval'][_0x6f55('0xf0')](db[_0x6f55('0x3f')],{'as':_0x6f55('0x184'),'foreignKey':_0x6f55('0x151')});db[_0x6f55('0x79')][_0x6f55('0xf0')](db[_0x6f55('0x5d')],{'as':_0x6f55('0x185'),'foreignKey':_0x6f55('0x151')});db[_0x6f55('0x79')][_0x6f55('0xf0')](db[_0x6f55('0x155')],{'as':_0x6f55('0x186'),'foreignKey':_0x6f55('0x151')});db['Interval'][_0x6f55('0xf0')](db[_0x6f55('0x4e')],{'as':_0x6f55('0x187'),'foreignKey':_0x6f55('0x151')});db['Schedule'][_0x6f55('0xfb')](db['MailAccount'],{});db[_0x6f55('0x80')][_0x6f55('0xfb')](db[_0x6f55('0x8f')],{'foreignKey':_0x6f55('0x188')});db['Schedule'][_0x6f55('0xfb')](db[_0x6f55('0x8d')],{'foreignKey':_0x6f55('0x189')});db['Sound'][_0x6f55('0xff')](db['VoiceMusicOnHold'],{'as':_0x6f55('0x18a'),'through':_0x6f55('0x122'),'onDelete':'restrict'});db[_0x6f55('0x14a')][_0x6f55('0xff')](db[_0x6f55('0x69')],{'through':_0x6f55('0x178')});db[_0x6f55('0x14a')]['belongsToMany'](db[_0x6f55('0x5f')],{'through':_0x6f55('0x172')});db[_0x6f55('0x14a')][_0x6f55('0xff')](db[_0x6f55('0x3c')],{'through':_0x6f55('0x14b')});db[_0x6f55('0x14a')][_0x6f55('0xff')](db[_0x6f55('0x4f')],{'through':_0x6f55('0x160')});db[_0x6f55('0x14a')][_0x6f55('0xff')](db[_0x6f55('0x45')],{'through':'fax_interaction_has_tags'});db[_0x6f55('0x14a')][_0x6f55('0xff')](db[_0x6f55('0xf7')],{'through':_0x6f55('0x169')});db[_0x6f55('0x85')][_0x6f55('0xf0')](db[_0x6f55('0x77')],{'as':{'plural':_0x6f55('0x18b'),'singular':_0x6f55('0x18c')},'foreignKey':_0x6f55('0x18d'),'onDelete':_0x6f55('0xf4'),'hooks':!![]});db[_0x6f55('0x85')][_0x6f55('0xf0')](db['Condition'],{'as':{'plural':_0x6f55('0x18e'),'singular':'AnyCondition'},'foreignKey':_0x6f55('0x18f'),'onDelete':'cascade','hooks':!![]});db[_0x6f55('0x85')]['hasMany'](db[_0x6f55('0x72')],{'as':_0x6f55('0x181'),'foreignKey':_0x6f55('0x190'),'onDelete':_0x6f55('0xf4'),'hooks':!![]});db['AnalyticCustomReport'][_0x6f55('0xf0')](db[_0x6f55('0x94')],{'as':_0x6f55('0x191'),'onDelete':_0x6f55('0xf4'),'foreignKey':_0x6f55('0x189'),'hooks':!![]});db[_0x6f55('0x8f')][_0x6f55('0xf0')](db[_0x6f55('0x94')],{'as':_0x6f55('0x191'),'onDelete':_0x6f55('0xf4'),'foreignKey':_0x6f55('0x188')});db[_0x6f55('0x92')][_0x6f55('0xf0')](db[_0x6f55('0x94')],{'as':_0x6f55('0x191'),'onDelete':_0x6f55('0xf4'),'foreignKey':_0x6f55('0x192')});db[_0x6f55('0x94')][_0x6f55('0xfb')](db[_0x6f55('0x92')],{'foreignKey':'MetricId'});db['SalesforceAccount'][_0x6f55('0xf0')](db[_0x6f55('0x98')],{'as':_0x6f55('0x193'),'onDelete':_0x6f55('0xf4'),'foreignKey':'AccountId'});db[_0x6f55('0x98')]['hasMany'](db['SalesforceField'],{'as':_0x6f55('0x194'),'onDelete':_0x6f55('0xf4'),'foreignKey':'SubjectId'});db['SalesforceConfiguration']['hasMany'](db[_0x6f55('0x99')],{'as':_0x6f55('0x195'),'onDelete':'cascade','foreignKey':_0x6f55('0x196')});db[_0x6f55('0x98')][_0x6f55('0xf0')](db[_0x6f55('0x99')],{'as':_0x6f55('0x191'),'onDelete':_0x6f55('0xf4'),'foreignKey':_0x6f55('0x197')});db[_0x6f55('0x98')][_0x6f55('0xfb')](db[_0x6f55('0x198')],{'as':'Account','foreignKey':_0x6f55('0x199')});db['SalesforceField'][_0x6f55('0xf0')](db[_0x6f55('0x99')],{'as':'Subject','foreignKey':_0x6f55('0x19a')});db[_0x6f55('0x99')][_0x6f55('0xf0')](db[_0x6f55('0x99')],{'as':_0x6f55('0x19b'),'foreignKey':_0x6f55('0x196')});db['SalesforceField'][_0x6f55('0xf0')](db[_0x6f55('0x99')],{'as':'Field','foreignKey':_0x6f55('0x197')});db[_0x6f55('0x99')][_0x6f55('0xfb')](db[_0x6f55('0x87')],{'as':_0x6f55('0x87'),'foreignKey':_0x6f55('0x19c')});db[_0x6f55('0x9b')]['hasMany'](db[_0x6f55('0x9d')],{'as':_0x6f55('0x193'),'onDelete':_0x6f55('0xf4'),'foreignKey':'AccountId'});db[_0x6f55('0x9d')][_0x6f55('0xf0')](db[_0x6f55('0x9f')],{'as':_0x6f55('0x194'),'onDelete':_0x6f55('0xf4'),'foreignKey':_0x6f55('0x19a')});db[_0x6f55('0x9d')][_0x6f55('0xf0')](db[_0x6f55('0x9f')],{'as':_0x6f55('0x195'),'onDelete':_0x6f55('0xf4'),'foreignKey':'DescriptionId'});db[_0x6f55('0x9d')][_0x6f55('0xf0')](db['SugarcrmField'],{'as':_0x6f55('0x191'),'onDelete':_0x6f55('0xf4'),'foreignKey':_0x6f55('0x197')});db[_0x6f55('0x9d')][_0x6f55('0xfb')](db[_0x6f55('0x9b')],{'as':_0x6f55('0x146'),'foreignKey':_0x6f55('0x199')});db[_0x6f55('0x9f')][_0x6f55('0xf0')](db[_0x6f55('0x9f')],{'as':_0x6f55('0x19d'),'foreignKey':'SubjectId'});db[_0x6f55('0x9f')][_0x6f55('0xf0')](db[_0x6f55('0x9f')],{'as':_0x6f55('0x19b'),'foreignKey':'DescriptionId'});db['SugarcrmField'][_0x6f55('0xf0')](db[_0x6f55('0x9f')],{'as':_0x6f55('0x19e'),'foreignKey':_0x6f55('0x197')});db[_0x6f55('0x9f')][_0x6f55('0xfb')](db[_0x6f55('0x87')],{'as':_0x6f55('0x87'),'foreignKey':_0x6f55('0x19c')});db[_0x6f55('0xa1')][_0x6f55('0xf0')](db['DeskConfiguration'],{'as':_0x6f55('0x193'),'onDelete':_0x6f55('0xf4'),'foreignKey':'AccountId'});db['DeskConfiguration']['hasMany'](db[_0x6f55('0x19f')],{'as':_0x6f55('0x194'),'onDelete':'cascade','foreignKey':_0x6f55('0x19a')});db[_0x6f55('0xa2')][_0x6f55('0xf0')](db[_0x6f55('0x19f')],{'as':_0x6f55('0x195'),'onDelete':_0x6f55('0xf4'),'foreignKey':_0x6f55('0x196')});db['DeskConfiguration'][_0x6f55('0xf0')](db['DeskField'],{'as':_0x6f55('0x191'),'onDelete':_0x6f55('0xf4'),'foreignKey':_0x6f55('0x197')});db[_0x6f55('0xa2')]['belongsTo'](db['DeskAccount'],{'as':_0x6f55('0x146'),'foreignKey':_0x6f55('0x199')});db[_0x6f55('0xa2')][_0x6f55('0xff')](db[_0x6f55('0x14a')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x6f55('0xf0')](db[_0x6f55('0x19f')],{'as':_0x6f55('0x19d'),'foreignKey':'SubjectId'});db[_0x6f55('0x19f')][_0x6f55('0xf0')](db[_0x6f55('0x19f')],{'as':_0x6f55('0x19b'),'foreignKey':'DescriptionId'});db[_0x6f55('0x19f')][_0x6f55('0xf0')](db[_0x6f55('0x19f')],{'as':_0x6f55('0x19e'),'foreignKey':_0x6f55('0x197')});db[_0x6f55('0x19f')][_0x6f55('0xfb')](db[_0x6f55('0x87')],{'as':_0x6f55('0x87'),'foreignKey':_0x6f55('0x19c')});db[_0x6f55('0xa4')]['hasMany'](db[_0x6f55('0x1a0')],{'as':_0x6f55('0x193'),'onDelete':_0x6f55('0xf4'),'foreignKey':_0x6f55('0x199')});db['ZohoConfiguration']['hasMany'](db['ZohoField'],{'as':_0x6f55('0x194'),'onDelete':_0x6f55('0xf4'),'foreignKey':_0x6f55('0x19a')});db[_0x6f55('0x1a0')]['hasMany'](db['ZohoField'],{'as':_0x6f55('0x195'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x6f55('0x1a0')][_0x6f55('0xf0')](db[_0x6f55('0xa7')],{'as':_0x6f55('0x191'),'onDelete':_0x6f55('0xf4'),'foreignKey':'FieldId'});db['ZohoConfiguration'][_0x6f55('0xfb')](db[_0x6f55('0xa4')],{'as':_0x6f55('0x146'),'foreignKey':_0x6f55('0x199')});db['ZohoField'][_0x6f55('0xf0')](db[_0x6f55('0xa7')],{'as':_0x6f55('0x19d'),'foreignKey':'SubjectId'});db[_0x6f55('0xa7')][_0x6f55('0xf0')](db[_0x6f55('0xa7')],{'as':_0x6f55('0x19b'),'foreignKey':_0x6f55('0x196')});db[_0x6f55('0xa7')][_0x6f55('0xf0')](db[_0x6f55('0xa7')],{'as':'Field','foreignKey':'FieldId'});db[_0x6f55('0xa7')]['belongsTo'](db[_0x6f55('0x87')],{'as':'Variable','foreignKey':_0x6f55('0x19c')});db[_0x6f55('0xa8')][_0x6f55('0xf0')](db[_0x6f55('0xa9')],{'as':_0x6f55('0x193'),'onDelete':_0x6f55('0xf4'),'foreignKey':_0x6f55('0x199')});db[_0x6f55('0xa9')][_0x6f55('0xf0')](db['ZendeskField'],{'as':_0x6f55('0x194'),'foreignKey':_0x6f55('0x19a')});db[_0x6f55('0xa9')][_0x6f55('0xf0')](db[_0x6f55('0xab')],{'as':_0x6f55('0x195'),'foreignKey':_0x6f55('0x196')});db[_0x6f55('0xa9')][_0x6f55('0xf0')](db[_0x6f55('0xab')],{'as':_0x6f55('0x191'),'foreignKey':_0x6f55('0x197')});db[_0x6f55('0xa9')][_0x6f55('0xfb')](db[_0x6f55('0xa8')],{'as':_0x6f55('0x146'),'foreignKey':_0x6f55('0x199')});db[_0x6f55('0xa9')]['belongsToMany'](db[_0x6f55('0x14a')],{'through':_0x6f55('0x1a1')});db[_0x6f55('0xab')][_0x6f55('0xf0')](db[_0x6f55('0xab')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x6f55('0xab')][_0x6f55('0xf0')](db[_0x6f55('0xab')],{'as':_0x6f55('0x19b'),'foreignKey':_0x6f55('0x196')});db['ZendeskField']['hasMany'](db[_0x6f55('0xab')],{'as':_0x6f55('0x19e'),'foreignKey':_0x6f55('0x197')});db[_0x6f55('0xab')][_0x6f55('0xfb')](db[_0x6f55('0x87')],{'as':_0x6f55('0x87'),'foreignKey':_0x6f55('0x19c')});db[_0x6f55('0xad')][_0x6f55('0xf0')](db[_0x6f55('0xaf')],{'as':_0x6f55('0x193'),'onDelete':'cascade','foreignKey':_0x6f55('0x199')});db[_0x6f55('0xaf')][_0x6f55('0xf0')](db[_0x6f55('0xb0')],{'as':'Subjects','onDelete':_0x6f55('0xf4'),'foreignKey':_0x6f55('0x19a')});db['FreshdeskConfiguration']['hasMany'](db['FreshdeskField'],{'as':_0x6f55('0x195'),'onDelete':_0x6f55('0xf4'),'foreignKey':'DescriptionId'});db[_0x6f55('0xaf')][_0x6f55('0xf0')](db['FreshdeskField'],{'as':_0x6f55('0x191'),'onDelete':_0x6f55('0xf4'),'foreignKey':_0x6f55('0x197')});db['FreshdeskConfiguration']['belongsTo'](db[_0x6f55('0xad')],{'as':'Account','foreignKey':_0x6f55('0x199')});db[_0x6f55('0xaf')][_0x6f55('0xff')](db['Tag'],{'through':'int_freshdesk_configuration_has_tags'});db['FreshdeskField']['hasMany'](db[_0x6f55('0xb0')],{'as':_0x6f55('0x19d'),'foreignKey':_0x6f55('0x19a')});db[_0x6f55('0xb0')]['hasMany'](db[_0x6f55('0xb0')],{'as':_0x6f55('0x19b'),'foreignKey':'DescriptionId'});db['FreshdeskField']['hasMany'](db[_0x6f55('0xb0')],{'as':_0x6f55('0x19e'),'foreignKey':_0x6f55('0x197')});db['FreshdeskField'][_0x6f55('0xfb')](db[_0x6f55('0x87')],{'as':_0x6f55('0x87'),'foreignKey':_0x6f55('0x19c')});db[_0x6f55('0xb1')]['hasMany'](db['VtigerConfiguration'],{'as':_0x6f55('0x193'),'onDelete':_0x6f55('0xf4'),'foreignKey':_0x6f55('0x199')});db[_0x6f55('0xb3')][_0x6f55('0xf0')](db[_0x6f55('0xb5')],{'as':_0x6f55('0x194'),'foreignKey':_0x6f55('0x19a')});db['VtigerConfiguration'][_0x6f55('0xf0')](db[_0x6f55('0xb5')],{'as':'Descriptions','foreignKey':_0x6f55('0x196')});db[_0x6f55('0xb3')][_0x6f55('0xf0')](db[_0x6f55('0xb5')],{'as':'Fields','foreignKey':_0x6f55('0x197')});db['VtigerConfiguration'][_0x6f55('0xfb')](db[_0x6f55('0xb1')],{'as':'Account','foreignKey':_0x6f55('0x199')});db[_0x6f55('0xb3')]['belongsToMany'](db['Tag'],{'through':_0x6f55('0x1a2')});db[_0x6f55('0xb5')]['hasMany'](db[_0x6f55('0xb5')],{'as':'Subject','foreignKey':_0x6f55('0x19a')});db[_0x6f55('0xb5')]['hasMany'](db[_0x6f55('0xb5')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x6f55('0xb5')]['hasMany'](db[_0x6f55('0xb5')],{'as':_0x6f55('0x19e'),'foreignKey':'FieldId'});db[_0x6f55('0xb5')][_0x6f55('0xfb')](db[_0x6f55('0x87')],{'as':_0x6f55('0x87'),'foreignKey':'VariableId'});db[_0x6f55('0xb7')][_0x6f55('0xf0')](db[_0x6f55('0xb9')],{'as':_0x6f55('0x193'),'onDelete':_0x6f55('0xf4'),'foreignKey':'AccountId'});db[_0x6f55('0xb9')]['hasMany'](db[_0x6f55('0xba')],{'as':_0x6f55('0x194'),'foreignKey':_0x6f55('0x19a')});db[_0x6f55('0xb9')][_0x6f55('0xf0')](db[_0x6f55('0xba')],{'as':'Descriptions','foreignKey':_0x6f55('0x196')});db[_0x6f55('0xb9')][_0x6f55('0xf0')](db[_0x6f55('0xba')],{'as':_0x6f55('0x191'),'foreignKey':_0x6f55('0x197')});db[_0x6f55('0xb9')][_0x6f55('0xfb')](db['ServicenowAccount'],{'as':_0x6f55('0x146'),'foreignKey':'AccountId'});db[_0x6f55('0xba')][_0x6f55('0xf0')](db[_0x6f55('0xba')],{'as':_0x6f55('0x19d'),'foreignKey':_0x6f55('0x19a')});db[_0x6f55('0xba')]['hasMany'](db[_0x6f55('0xba')],{'as':_0x6f55('0x19b'),'foreignKey':_0x6f55('0x196')});db[_0x6f55('0xba')]['hasMany'](db[_0x6f55('0xba')],{'as':_0x6f55('0x19e'),'foreignKey':_0x6f55('0x197')});db[_0x6f55('0xba')][_0x6f55('0xfb')](db['Variable'],{'as':_0x6f55('0x87'),'foreignKey':'VariableId'});db[_0x6f55('0xbc')][_0x6f55('0xf0')](db[_0x6f55('0xbd')],{'as':'Configurations','onDelete':_0x6f55('0xf4'),'foreignKey':_0x6f55('0x199')});db[_0x6f55('0xbd')][_0x6f55('0xf0')](db[_0x6f55('0xbf')],{'as':_0x6f55('0x194'),'onDelete':_0x6f55('0xf4'),'foreignKey':_0x6f55('0x19a')});db['Dynamics365Configuration'][_0x6f55('0xf0')](db[_0x6f55('0xbf')],{'as':'Descriptions','onDelete':_0x6f55('0xf4'),'foreignKey':'DescriptionId'});db[_0x6f55('0xbd')][_0x6f55('0xf0')](db['Dynamics365Field'],{'as':_0x6f55('0x191'),'onDelete':'cascade','foreignKey':_0x6f55('0x197')});db[_0x6f55('0xbd')]['belongsTo'](db[_0x6f55('0xbc')],{'as':_0x6f55('0x146'),'foreignKey':_0x6f55('0x199')});db['Dynamics365Field'][_0x6f55('0xf0')](db['Dynamics365Field'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x6f55('0xbf')][_0x6f55('0xf0')](db[_0x6f55('0xbf')],{'as':_0x6f55('0x19b'),'foreignKey':_0x6f55('0x196')});db[_0x6f55('0xbf')]['hasMany'](db[_0x6f55('0xbf')],{'as':_0x6f55('0x19e'),'foreignKey':_0x6f55('0x197')});db['Dynamics365Field'][_0x6f55('0xfb')](db[_0x6f55('0x87')],{'as':'Variable','foreignKey':_0x6f55('0x19c')});db[_0x6f55('0xc2')][_0x6f55('0xfb')](db[_0x6f55('0x59')],{});db[_0x6f55('0xc2')][_0x6f55('0xfb')](db['CmList'],{'as':_0x6f55('0x157'),'foreignKey':'ListId'});db[_0x6f55('0xc2')][_0x6f55('0xfb')](db[_0x6f55('0x69')],{'as':_0x6f55('0x138'),'foreignKey':'ContactId'});db[_0x6f55('0xc2')][_0x6f55('0xfb')](db[_0x6f55('0x5f')],{});db[_0x6f55('0xc2')][_0x6f55('0xfb')](db[_0x6f55('0x61')],{});db[_0x6f55('0xc2')][_0x6f55('0xfb')](db['User'],{});db[_0x6f55('0xc2')][_0x6f55('0xfb')](db[_0x6f55('0x64')],{});db[_0x6f55('0xc4')][_0x6f55('0xfb')](db[_0x6f55('0xec')],{'onDelete':_0x6f55('0xf4'),'foreignKey':_0x6f55('0x1a3')});db[_0x6f55('0xc4')][_0x6f55('0xfb')](db[_0x6f55('0xec')],{'onDelete':_0x6f55('0xf4'),'foreignKey':_0x6f55('0x1a4')});db[_0x6f55('0xc9')]['hasMany'](db[_0x6f55('0xc8')],{'foreignKey':_0x6f55('0x1a5'),'onDelete':_0x6f55('0xf4')});db[_0x6f55('0xc9')][_0x6f55('0xf0')](db[_0x6f55('0xc6')],{'foreignKey':'SessionId','onDelete':_0x6f55('0xf4')});db[_0x6f55('0xcb')]['belongsTo'](db['SmsAccount'],{});db[_0x6f55('0xcb')][_0x6f55('0xfb')](db[_0x6f55('0xe5')],{'as':_0x6f55('0x157'),'foreignKey':'ListId'});db[_0x6f55('0xcb')][_0x6f55('0xfb')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x6f55('0xcb')]['belongsTo'](db['SmsInteraction'],{});db['SmsQueueReport'][_0x6f55('0xfb')](db['SmsMessage'],{});db[_0x6f55('0xcb')][_0x6f55('0xfb')](db[_0x6f55('0xec')],{});db[_0x6f55('0xcb')][_0x6f55('0xfb')](db[_0x6f55('0x52')],{});db[_0x6f55('0xd0')][_0x6f55('0xf0')](db[_0x6f55('0xc9')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0x6f55('0xf0')](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db[_0x6f55('0xd0')][_0x6f55('0xf0')](db[_0x6f55('0xc6')],{'foreignKey':'ProjectId'});db[_0x6f55('0x11b')]['belongsToMany'](db[_0x6f55('0xec')],{'as':'Users','through':'user_has_square_projects'});db[_0x6f55('0x12d')][_0x6f55('0xff')](db[_0x6f55('0xec')],{'as':'Agents','through':'user_has_teams'});db['Team'][_0x6f55('0xff')](db[_0x6f55('0x1a')],{'through':_0x6f55('0x12e'),'as':_0x6f55('0x10a')});db[_0x6f55('0x12d')]['belongsToMany'](db[_0x6f55('0x38')],{'through':_0x6f55('0x143'),'as':'MailQueues'});db[_0x6f55('0x12d')][_0x6f55('0xff')](db[_0x6f55('0x64')],{'through':'team_has_chat_queues','as':_0x6f55('0x10c')});db[_0x6f55('0x12d')][_0x6f55('0xff')](db[_0x6f55('0x10d')],{'through':_0x6f55('0x15d'),'as':'FaxQueues'});db['Team']['belongsToMany'](db['SmsQueue'],{'through':_0x6f55('0x163'),'as':'SmsQueues'});db[_0x6f55('0x12d')][_0x6f55('0xff')](db[_0x6f55('0x58')],{'through':_0x6f55('0x16b'),'as':_0x6f55('0x10f')});db['Campaign'][_0x6f55('0xf0')](db[_0x6f55('0x176')],{'as':_0x6f55('0x125'),'foreignKey':'CampaignId'});db[_0x6f55('0xd9')]['hasMany'](db[_0x6f55('0x6d')],{'as':_0x6f55('0xf5'),'foreignKey':_0x6f55('0x17a')});db[_0x6f55('0xd9')][_0x6f55('0xf0')](db[_0x6f55('0xf6')],{'as':_0x6f55('0x126'),'foreignKey':_0x6f55('0x17a')});db[_0x6f55('0xd9')][_0x6f55('0xf0')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0x6f55('0x17a')});db[_0x6f55('0xd9')][_0x6f55('0xfb')](db['Trunk'],{'as':'Trunk','foreignKey':_0x6f55('0x1a6')});db['Campaign']['belongsTo'](db['Trunk'],{'as':_0x6f55('0x1a7'),'foreignKey':_0x6f55('0x129')});db[_0x6f55('0xd9')][_0x6f55('0xfb')](db['Interval'],{'as':_0x6f55('0x79'),'foreignKey':_0x6f55('0x151')});db[_0x6f55('0xd9')]['belongsTo'](db[_0x6f55('0x11b')],{'as':_0x6f55('0x11b'),'foreignKey':_0x6f55('0x1a8')});db[_0x6f55('0xd9')][_0x6f55('0xff')](db[_0x6f55('0xe5')],{'as':_0x6f55('0x102'),'through':_0x6f55('0x1a9')});db['Campaign'][_0x6f55('0xff')](db[_0x6f55('0xe5')],{'as':_0x6f55('0x1aa'),'through':'campaigns_has_cm_blacklists'});db[_0x6f55('0xdd')][_0x6f55('0xfb')](db['MailMessage'],{});db[_0x6f55('0xdd')][_0x6f55('0xfb')](db[_0x6f55('0x3c')],{});db[_0x6f55('0xdd')][_0x6f55('0xfb')](db[_0x6f55('0x139')],{'foreignKey':_0x6f55('0x1ab'),'as':_0x6f55('0x1ac')});db[_0x6f55('0xdd')]['belongsTo'](db['User'],{'foreignKey':_0x6f55('0x1ad'),'as':_0x6f55('0x1ae')});db['MailTransferReport'][_0x6f55('0xfb')](db[_0x6f55('0xec')],{'foreignKey':'ToUserId','as':_0x6f55('0x1af')});db[_0x6f55('0xdd')]['belongsTo'](db['MailQueue'],{'foreignKey':_0x6f55('0x1b0'),'as':'ToQueue'});db['MailTransferReport']['belongsTo'](db[_0x6f55('0x139')],{'foreignKey':_0x6f55('0x1b1'),'as':'ToAccount'});db['ChatTransferReport'][_0x6f55('0xfb')](db[_0x6f55('0x61')],{});db[_0x6f55('0xdf')][_0x6f55('0xfb')](db[_0x6f55('0x5f')],{});db[_0x6f55('0xdf')][_0x6f55('0xfb')](db[_0x6f55('0x59')],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db[_0x6f55('0xdf')][_0x6f55('0xfb')](db[_0x6f55('0xec')],{'foreignKey':'FromUserId','as':'FromAgent'});db['ChatTransferReport']['belongsTo'](db[_0x6f55('0xec')],{'foreignKey':_0x6f55('0x1b2'),'as':_0x6f55('0x1af')});db[_0x6f55('0xdf')][_0x6f55('0xfb')](db[_0x6f55('0x64')],{'foreignKey':_0x6f55('0x1b3'),'as':_0x6f55('0x1b4')});db[_0x6f55('0xdf')]['belongsTo'](db[_0x6f55('0x59')],{'foreignKey':_0x6f55('0x1b5'),'as':_0x6f55('0x1b6')});db[_0x6f55('0xe0')][_0x6f55('0xfb')](db[_0x6f55('0x47')],{});db['FaxTransferReport']['belongsTo'](db[_0x6f55('0x45')],{});db[_0x6f55('0xe0')][_0x6f55('0xfb')](db['FaxAccount'],{'foreignKey':_0x6f55('0x1b7'),'as':'FromAccount'});db[_0x6f55('0xe0')][_0x6f55('0xfb')](db[_0x6f55('0xec')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x6f55('0xe0')][_0x6f55('0xfb')](db[_0x6f55('0xec')],{'foreignKey':_0x6f55('0x1b2'),'as':_0x6f55('0x1af')});db[_0x6f55('0xe0')][_0x6f55('0xfb')](db['FaxQueue'],{'foreignKey':_0x6f55('0x1b8'),'as':_0x6f55('0x1b4')});db[_0x6f55('0xe0')][_0x6f55('0xfb')](db[_0x6f55('0x114')],{'foreignKey':_0x6f55('0x1b9'),'as':_0x6f55('0x1b6')});db[_0x6f55('0xe1')][_0x6f55('0xfb')](db['OpenchannelMessage'],{});db['OpenchannelTransferReport']['belongsTo'](db[_0x6f55('0xf7')],{});db[_0x6f55('0xe1')][_0x6f55('0xfb')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':'FromAccount'});db['OpenchannelTransferReport'][_0x6f55('0xfb')](db[_0x6f55('0xec')],{'foreignKey':_0x6f55('0x1ad'),'as':_0x6f55('0x1ae')});db[_0x6f55('0xe1')][_0x6f55('0xfb')](db['User'],{'foreignKey':'ToUserId','as':_0x6f55('0x1af')});db[_0x6f55('0xe1')][_0x6f55('0xfb')](db[_0x6f55('0x58')],{'foreignKey':'ToOpenchannelQueueId','as':_0x6f55('0x1b4')});db['OpenchannelTransferReport']['belongsTo'](db[_0x6f55('0x117')],{'foreignKey':'ToOpenchannelAccountId','as':_0x6f55('0x1b6')});db[_0x6f55('0xe3')][_0x6f55('0xfb')](db[_0x6f55('0x51')],{});db['SmsTransferReport'][_0x6f55('0xfb')](db[_0x6f55('0x4f')],{});db['SmsTransferReport'][_0x6f55('0xfb')](db[_0x6f55('0x4c')],{'foreignKey':_0x6f55('0x1ba'),'as':_0x6f55('0x1ac')});db[_0x6f55('0xe3')][_0x6f55('0xfb')](db[_0x6f55('0xec')],{'foreignKey':'FromUserId','as':_0x6f55('0x1ae')});db[_0x6f55('0xe3')][_0x6f55('0xfb')](db['User'],{'foreignKey':_0x6f55('0x1b2'),'as':'ToAgent'});db[_0x6f55('0xe3')][_0x6f55('0xfb')](db[_0x6f55('0x52')],{'foreignKey':_0x6f55('0x1bb'),'as':_0x6f55('0x1b4')});db[_0x6f55('0xe3')][_0x6f55('0xfb')](db[_0x6f55('0x4c')],{'foreignKey':_0x6f55('0x1bc'),'as':_0x6f55('0x1b6')});db[_0x6f55('0xe5')]['hasMany'](db[_0x6f55('0x13c')],{'as':_0x6f55('0x13d'),'foreignKey':_0x6f55('0x140')});db[_0x6f55('0xe5')][_0x6f55('0xf0')](db['CmCustomField'],{'as':'CustomFields','foreignKey':_0x6f55('0x140')});db['CmList'][_0x6f55('0xf0')](db[_0x6f55('0x69')],{'as':_0x6f55('0x100'),'onDelete':_0x6f55('0xf4'),'foreignKey':_0x6f55('0x140')});db[_0x6f55('0xe5')][_0x6f55('0xf0')](db['CmHopperFinal'],{'as':_0x6f55('0xf5'),'foreignKey':'ListId'});db[_0x6f55('0xe5')][_0x6f55('0xf0')](db[_0x6f55('0xf6')],{'as':_0x6f55('0x1bd'),'foreignKey':_0x6f55('0x140')});db[_0x6f55('0xe5')]['hasMany'](db['ReportAgentPreview'],{'as':_0x6f55('0x6f'),'foreignKey':_0x6f55('0x140')});db['CmList'][_0x6f55('0xff')](db[_0x6f55('0x1a')],{'as':_0x6f55('0x1be'),'through':_0x6f55('0x12b')});db[_0x6f55('0xe5')][_0x6f55('0xff')](db[_0x6f55('0xec')],{'as':'Agents','through':_0x6f55('0x103')});db['VoicePrefix'][_0x6f55('0xf0')](db[_0x6f55('0x16')],{'as':_0x6f55('0xf3'),'onDelete':_0x6f55('0x150')});db[_0x6f55('0xe7')][_0x6f55('0xff')](db[_0x6f55('0xec')],{'as':'Agents','through':_0x6f55('0x111')});db[_0x6f55('0xe8')]['hasMany'](db['User'],{'as':_0x6f55('0x15a'),'foreignKey':'userProfileId'});db[_0x6f55('0xe8')][_0x6f55('0xf0')](db[_0x6f55('0x1bf')],{'as':_0x6f55('0x1c0'),'foreignKey':_0x6f55('0xfc'),'onDelete':_0x6f55('0xf4')});db['UserProfileSection'][_0x6f55('0xf0')](db[_0x6f55('0xeb')],{'as':_0x6f55('0x1c1'),'foreignKey':'sectionId','onDelete':_0x6f55('0xf4')});module[_0x6f55('0x1c2')]={'db':db,'dbH':dbH};
\ No newline at end of file
+var _0xb620=['VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','License','../api/campaign/campaign.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','hasOne','cascade','UserId','User','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','belongsTo','UserProfile','userProfileId','chat_group_has_users','belongsToMany','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_chat_interactions','user_has_fax_interactions','user_has_openchannel_interactions','VoiceQueues','MailQueues','UserMailQueue','ChatQueues','FaxQueue','FaxQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','user_has_voice_prefixes','ChatWebsites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','SquareProject','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','UserVoiceQueueRt','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessionReport','JscriptySessions','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','mailboxuser','mailbox','QueueCalls','VoiceAgentReport','AgentReports','CmContact','Contact','ContactId','MailAccountId','MailServerOut','Dispositions','Answers','Messages','Interactions','List','ListId','Template','TemplateId','Agents','team_has_mail_queues','Account','Owner','ThroughTags','user_has_mail_interactions','Attachments','Interaction','MailInteractionId','restrict','TagId','Items','FaxAccountId','FaxMessage','FaxInteractionId','fax_interaction_has_tags','SmsAccountId','CannedAnswer','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','Tags','Users','UserSmsQueue','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','ChatApplication','user_has_chat_websites','Agent','ChatQueue','Queue','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','team_has_chat_queues','ChatGroupId','CompanyId','Company','cm_contact_has_tags','Campaign','CampaignId','OwnerId','All','AutomationAllId','OneAny','Actions','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','mail_interaction_has_tags','AllConditions','AllCondition','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','AnalyticMetric','MetricId','SalesforceAccount','SalesforceConfiguration','Configurations','Descriptions','DescriptionId','FieldId','Subject','SubjectId','Description','Field','Variable','VariableId','SugarcrmAccount','SugarcrmConfiguration','AccountId','Subjects','SugarcrmField','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','FreshdeskAccount','VtigerField','int_vtiger_configuration_has_tags','Dynamics365Account','JscriptyQuestionReport','SessionId','ProjectId','TrunkId','TrunkBackup','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToAccount','ChatTransferReport','FromChatWebsiteId','ToChatWebsiteId','ToFaxQueueId','ToQueue','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','UserProfileSections','Resources','sectionId','../config/environment','sequelize','lodash','jstz','defaultsDeep','motion2','xcall','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','xC@LL1234','database','password','options','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','Disposition','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','Tag','../api/tag/tag.model','../api/template/template.model','Trigger','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','DeskAccount','../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','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xb620,0x118));var _0x0b62=function(_0x5c44a6,_0x4c921e){_0x5c44a6=_0x5c44a6-0x0;var _0x27baa2=_0xb620[_0x5c44a6];return _0x27baa2;};'use strict';var path=require('path');var config=require(_0x0b62('0x0'));var Sequelize=require(_0x0b62('0x1'));var _=require(_0x0b62('0x2'));var jstz=require(_0x0b62('0x3'));var timezone=jstz['determine']();config['sequelize']=_[_0x0b62('0x4')](config[_0x0b62('0x1')],{'database':_0x0b62('0x5'),'username':_0x0b62('0x6'),'password':'xC@LL1234','options':{'host':_0x0b62('0x7'),'port':0xcea,'dialect':_0x0b62('0x8'),'dialectOptions':{'charset':_0x0b62('0x9')},'logging':![],'timezone':timezone[_0x0b62('0xa')](),'define':{'charset':_0x0b62('0xb'),'collate':_0x0b62('0xc')}}});config[_0x0b62('0xd')]=_[_0x0b62('0x4')](config['sequelizeHistory'],{'database':_0x0b62('0x5'),'username':_0x0b62('0x6'),'password':_0x0b62('0xe'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x0b62('0x8'),'dialectOptions':{'charset':_0x0b62('0x9')},'logging':![],'timezone':timezone[_0x0b62('0xa')](),'define':{'charset':'utf8','collate':_0x0b62('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x0b62('0x1')][_0x0b62('0xf')],config[_0x0b62('0x1')]['username'],config[_0x0b62('0x1')][_0x0b62('0x10')],config[_0x0b62('0x1')][_0x0b62('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x0b62('0xd')][_0x0b62('0xf')],config[_0x0b62('0xd')]['username'],config[_0x0b62('0xd')][_0x0b62('0x10')],config[_0x0b62('0xd')][_0x0b62('0x11')])};db['User']=db['sequelize'][_0x0b62('0x12')](_0x0b62('0x13'));db[_0x0b62('0x14')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x15'));db[_0x0b62('0x16')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x17'));db[_0x0b62('0x18')]=db[_0x0b62('0x1')]['import']('../api/voiceExtension/voiceExtension.model');db[_0x0b62('0x19')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x1a'));db[_0x0b62('0x1b')]=db['sequelize']['import'](_0x0b62('0x1c'));db['VoiceRecording']=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x1d'));db[_0x0b62('0x1e')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x1f'));db['VoiceMailMessage']=db['sequelize'][_0x0b62('0x12')](_0x0b62('0x20'));db[_0x0b62('0x21')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x22'));db[_0x0b62('0x23')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x24'));db['VoiceAgentReport']=db[_0x0b62('0x1')]['import'](_0x0b62('0x25'));db[_0x0b62('0x26')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x27'));db[_0x0b62('0x28')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x29'));db[_0x0b62('0x2a')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x2b'));db[_0x0b62('0x2c')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x2d'));db['UserVoiceQueueRt']=db[_0x0b62('0x1')]['import'](_0x0b62('0x2e'));db[_0x0b62('0x2f')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x30'));db[_0x0b62('0x31')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x32'));db['UserMailQueue']=db['sequelize']['import'](_0x0b62('0x33'));db[_0x0b62('0x34')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x35'));db['UserSmsQueue']=db[_0x0b62('0x1')]['import']('../api/userSmsQueue/userSmsQueue.model');db[_0x0b62('0x36')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x37'));db[_0x0b62('0x38')]=db[_0x0b62('0x1')][_0x0b62('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db['sequelize'][_0x0b62('0x12')](_0x0b62('0x39'));db[_0x0b62('0x3a')]=db[_0x0b62('0x1')][_0x0b62('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0b62('0x3b')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x3c'));db[_0x0b62('0x3d')]=db[_0x0b62('0x1')]['import'](_0x0b62('0x3e'));db[_0x0b62('0x3f')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x40'));db[_0x0b62('0x41')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x42'));db[_0x0b62('0x43')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x44'));db[_0x0b62('0x45')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x46'));db[_0x0b62('0x47')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x48'));db[_0x0b62('0x49')]=db['sequelize'][_0x0b62('0x12')](_0x0b62('0x4a'));db[_0x0b62('0x4b')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x4c'));db[_0x0b62('0x4d')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x4e'));db[_0x0b62('0x4f')]=db[_0x0b62('0x1')][_0x0b62('0x12')]('../api/faxInteraction/faxInteraction.model');db['FaxMessage']=db[_0x0b62('0x1')]['import'](_0x0b62('0x50'));db['FaxQueue']=db['sequelize'][_0x0b62('0x12')](_0x0b62('0x51'));db[_0x0b62('0x52')]=db[_0x0b62('0x1')]['import'](_0x0b62('0x53'));db[_0x0b62('0x54')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x55'));db[_0x0b62('0x56')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x57'));db[_0x0b62('0x58')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x59'));db[_0x0b62('0x5a')]=db['sequelize'][_0x0b62('0x12')](_0x0b62('0x5b'));db[_0x0b62('0x5c')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x5d'));db['OpenchannelAccount']=db[_0x0b62('0x1')]['import'](_0x0b62('0x5e'));db[_0x0b62('0x5f')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x60'));db[_0x0b62('0x61')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x62'));db[_0x0b62('0x63')]=db['sequelize'][_0x0b62('0x12')](_0x0b62('0x64'));db['OpenchannelQueue']=db['sequelize'][_0x0b62('0x12')](_0x0b62('0x65'));db[_0x0b62('0x66')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x67'));db[_0x0b62('0x68')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x69'));db['ChatApplication']=db['sequelize'][_0x0b62('0x12')](_0x0b62('0x6a'));db['ChatInteraction']=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x6b'));db[_0x0b62('0x6c')]=db['sequelize']['import'](_0x0b62('0x6d'));db[_0x0b62('0x6e')]=db[_0x0b62('0x1')]['import'](_0x0b62('0x6f'));db['ChatQueue']=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x70'));db[_0x0b62('0x71')]=db[_0x0b62('0x1')]['import']('../api/chatGroup/chatGroup.model');db[_0x0b62('0x72')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x73'));db[_0x0b62('0x74')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x75'));db['CmContact']=db[_0x0b62('0x1')][_0x0b62('0x12')]('../api/cmContact/cmContact.model');db[_0x0b62('0x76')]=db['sequelize'][_0x0b62('0x12')](_0x0b62('0x77'));db[_0x0b62('0x78')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x79'));db[_0x0b62('0x7a')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x7b'));db[_0x0b62('0x7c')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x7d'));db[_0x0b62('0x7e')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x7f'));db[_0x0b62('0x80')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x81'));db[_0x0b62('0x82')]=db[_0x0b62('0x1')]['import'](_0x0b62('0x83'));db[_0x0b62('0x84')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x85'));db['CannedAnswer']=db[_0x0b62('0x1')]['import']('../api/cannedAnswer/cannedAnswer.model');db[_0x0b62('0x86')]=db[_0x0b62('0x1')][_0x0b62('0x12')]('../api/disposition/disposition.model');db[_0x0b62('0x87')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x88'));db[_0x0b62('0x89')]=db['sequelize']['import'](_0x0b62('0x8a'));db[_0x0b62('0x8b')]=db[_0x0b62('0x1')]['import'](_0x0b62('0x8c'));db[_0x0b62('0x8d')]=db[_0x0b62('0x1')]['import'](_0x0b62('0x8e'));db[_0x0b62('0x8f')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x90'));db[_0x0b62('0x91')]=db[_0x0b62('0x1')][_0x0b62('0x12')]('../api/schedule/schedule.model');db[_0x0b62('0x92')]=db[_0x0b62('0x1')][_0x0b62('0x12')]('../api/sound/sound.model');db[_0x0b62('0x93')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x94'));db['Template']=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x95'));db[_0x0b62('0x96')]=db['sequelize'][_0x0b62('0x12')]('../api/trigger/trigger.model');db['Variable']=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x97'));db[_0x0b62('0x98')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x99'));db['IntegrationReport']=db['sequelize']['import'](_0x0b62('0x9a'));db[_0x0b62('0x9b')]=db['sequelize']['import'](_0x0b62('0x9c'));db[_0x0b62('0x9d')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x9e'));db[_0x0b62('0x9f')]=db[_0x0b62('0x1')][_0x0b62('0x12')]('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db[_0x0b62('0x1')]['import'](_0x0b62('0xa0'));db[_0x0b62('0xa1')]=db[_0x0b62('0x1')]['import'](_0x0b62('0xa2'));db['AnalyticTreeReport']=db['sequelize']['import'](_0x0b62('0xa3'));db['SalesforceAccount']=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0xa4'));db['SalesforceConfiguration']=db['sequelize']['import']('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x0b62('0xa5')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0xa6'));db['SugarcrmAccount']=db[_0x0b62('0x1')]['import']('../api/intSugarcrmAccount/intSugarcrmAccount.model');db['SugarcrmConfiguration']=db['sequelize'][_0x0b62('0x12')](_0x0b62('0xa7'));db['SugarcrmField']=db[_0x0b62('0x1')]['import']('../api/intSugarcrmField/intSugarcrmField.model');db[_0x0b62('0xa8')]=db['sequelize'][_0x0b62('0x12')](_0x0b62('0xa9'));db[_0x0b62('0xaa')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0xab'));db[_0x0b62('0xac')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0xad'));db[_0x0b62('0xae')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0xaf'));db[_0x0b62('0xb0')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0xb1'));db[_0x0b62('0xb2')]=db['sequelize'][_0x0b62('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0b62('0xb3')]=db[_0x0b62('0x1')][_0x0b62('0x12')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x0b62('0xb4')]=db['sequelize']['import'](_0x0b62('0xb5'));db[_0x0b62('0xb6')]=db['sequelize']['import'](_0x0b62('0xb7'));db['FreshdeskAccount']=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0xb8'));db[_0x0b62('0xb9')]=db['sequelize']['import'](_0x0b62('0xba'));db[_0x0b62('0xbb')]=db[_0x0b62('0x1')][_0x0b62('0x12')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x0b62('0xbc')]=db[_0x0b62('0x1')]['import'](_0x0b62('0xbd'));db[_0x0b62('0xbe')]=db[_0x0b62('0x1')]['import'](_0x0b62('0xbf'));db['VtigerField']=db[_0x0b62('0x1')]['import'](_0x0b62('0xc0'));db[_0x0b62('0xc1')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0xc2'));db[_0x0b62('0xc3')]=db[_0x0b62('0x1')]['import'](_0x0b62('0xc4'));db[_0x0b62('0xc5')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0xc6'));db['Dynamics365Account']=db['sequelize'][_0x0b62('0x12')](_0x0b62('0xc7'));db[_0x0b62('0xc8')]=db[_0x0b62('0x1')]['import'](_0x0b62('0xc9'));db[_0x0b62('0xca')]=db[_0x0b62('0x1')]['import'](_0x0b62('0xcb'));db[_0x0b62('0x98')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0x99'));db[_0x0b62('0xcc')]=db['sequelize'][_0x0b62('0x12')](_0x0b62('0xcd'));db[_0x0b62('0xce')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0xcf'));db[_0x0b62('0xd0')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0xd1'));db[_0x0b62('0xd2')]=db['sequelize'][_0x0b62('0x12')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db['JscriptyQuestionReport']=db['sequelize'][_0x0b62('0x12')](_0x0b62('0xd3'));db['JscriptySessionReport']=db[_0x0b62('0x1')]['import'](_0x0b62('0xd4'));db[_0x0b62('0xd5')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0xd6'));db[_0x0b62('0xd7')]=db[_0x0b62('0x1')]['import'](_0x0b62('0xd8'));db[_0x0b62('0xd9')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0xda'));db[_0x0b62('0xdb')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0xdc'));db[_0x0b62('0xdd')]=db['sequelize'][_0x0b62('0x12')](_0x0b62('0xde'));db['SquareOdbc']=db['sequelize'][_0x0b62('0x12')](_0x0b62('0xdf'));db['SquareProject']=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0xe0'));db[_0x0b62('0xe1')]=db[_0x0b62('0x1')]['import'](_0x0b62('0xe2'));db[_0x0b62('0xe3')]=db['sequelize'][_0x0b62('0x12')]('../api/squareMessage/squareMessage.model');db[_0x0b62('0xe4')]=db[_0x0b62('0x1')][_0x0b62('0x12')]('../api/team/team.model');db[_0x0b62('0xe5')]=db[_0x0b62('0x1')][_0x0b62('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0xe6'));db['Migration']=db[_0x0b62('0x1')][_0x0b62('0x12')]('../api/migration/migration.model');db[_0x0b62('0xe7')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0xe8'));db[_0x0b62('0xe9')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0xea'));db['MailTransferReport']=db[_0x0b62('0x1')]['import']('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0xeb'));db[_0x0b62('0xec')]=db[_0x0b62('0x1')]['import']('../api/faxTransferReport/faxTransferReport.model');db[_0x0b62('0xed')]=db[_0x0b62('0x1')]['import'](_0x0b62('0xee'));db[_0x0b62('0xef')]=db[_0x0b62('0x1')][_0x0b62('0x12')]('../api/smsTransferReport/smsTransferReport.model');db[_0x0b62('0xf0')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0xf1'));db[_0x0b62('0xf2')]=db[_0x0b62('0x1')][_0x0b62('0x12')]('../api/voicePrefix/voicePrefix.model');db['UserProfile']=db[_0x0b62('0x1')][_0x0b62('0x12')]('../api/userProfile/userProfile.model');db[_0x0b62('0xf3')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0xf4'));db[_0x0b62('0xf5')]=db[_0x0b62('0x1')][_0x0b62('0x12')](_0x0b62('0xf6'));db['User'][_0x0b62('0xf7')](db[_0x0b62('0x1e')],{'as':_0x0b62('0x1e'),'onDelete':_0x0b62('0xf8'),'foreignKey':_0x0b62('0xf9')});db[_0x0b62('0xfa')][_0x0b62('0xfb')](db[_0x0b62('0xfc')],{'as':_0x0b62('0xfd'),'foreignKey':'UserId'});db['User'][_0x0b62('0xfb')](db['UserVoiceQueueRt'],{'as':_0x0b62('0xfe'),'foreignKey':_0x0b62('0xf9')});db[_0x0b62('0xfa')][_0x0b62('0xfb')](db[_0x0b62('0x18')],{'as':_0x0b62('0xff'),'onDelete':_0x0b62('0xf8'),'hooks':!![]});db['User']['hasMany'](db[_0x0b62('0x7a')],{'as':_0x0b62('0x100'),'foreignKey':_0x0b62('0xf9')});db['User']['hasMany'](db['CmHopperHistory'],{'as':_0x0b62('0x101'),'foreignKey':_0x0b62('0xf9')});db['User'][_0x0b62('0xfb')](db[_0x0b62('0x7e')],{'as':'ReportAgentPreview','foreignKey':_0x0b62('0xf9')});db[_0x0b62('0xfa')][_0x0b62('0xfb')](db[_0x0b62('0x61')],{'as':_0x0b62('0x102'),'foreignKey':'UserId'});db[_0x0b62('0xfa')][_0x0b62('0xfb')](db[_0x0b62('0x103')],{'as':_0x0b62('0x104'),'foreignKey':_0x0b62('0xf9')});db[_0x0b62('0xfa')][_0x0b62('0xfb')](db['SmsInteraction'],{'as':_0x0b62('0x105'),'foreignKey':_0x0b62('0xf9')});db[_0x0b62('0xfa')]['hasMany'](db[_0x0b62('0x4f')],{'as':_0x0b62('0x106'),'foreignKey':'UserId'});db[_0x0b62('0xfa')][_0x0b62('0xfb')](db[_0x0b62('0x3f')],{'as':_0x0b62('0x107'),'foreignKey':_0x0b62('0xf9')});db[_0x0b62('0xfa')][_0x0b62('0x108')](db['UserProfile'],{'as':_0x0b62('0x109'),'foreignKey':_0x0b62('0x10a')});db['User']['belongsToMany'](db[_0x0b62('0x71')],{'as':'Groups','through':_0x0b62('0x10b')});db[_0x0b62('0xfa')][_0x0b62('0x10c')](db['CmContact'],{'as':_0x0b62('0x10d'),'through':_0x0b62('0x10e')});db['User'][_0x0b62('0x10c')](db['CmList'],{'as':_0x0b62('0x10f'),'through':_0x0b62('0x110')});db['User'][_0x0b62('0x10c')](db['Team'],{'through':_0x0b62('0x111')});db['User'][_0x0b62('0x10c')](db[_0x0b62('0x3f')],{'as':'MailInteractions','through':'user_has_mail_interactions'});db['User'][_0x0b62('0x10c')](db[_0x0b62('0x103')],{'as':_0x0b62('0x104'),'through':_0x0b62('0x112')});db[_0x0b62('0xfa')][_0x0b62('0x10c')](db[_0x0b62('0x4f')],{'as':_0x0b62('0x106'),'through':_0x0b62('0x113')});db[_0x0b62('0xfa')]['belongsToMany'](db['SmsInteraction'],{'as':_0x0b62('0x105'),'through':'user_has_sms_interactions'});db[_0x0b62('0xfa')][_0x0b62('0x10c')](db[_0x0b62('0x61')],{'as':_0x0b62('0x102'),'through':_0x0b62('0x114')});db[_0x0b62('0xfa')][_0x0b62('0x10c')](db[_0x0b62('0x1b')],{'as':_0x0b62('0x115'),'through':'UserVoiceQueue','required':![]});db[_0x0b62('0xfa')]['belongsToMany'](db[_0x0b62('0x3b')],{'as':_0x0b62('0x116'),'through':_0x0b62('0x117'),'required':![]});db['User'][_0x0b62('0x10c')](db['ChatQueue'],{'as':_0x0b62('0x118'),'through':_0x0b62('0x31'),'required':![],'hooks':!![]});db['User'][_0x0b62('0x10c')](db[_0x0b62('0x119')],{'as':_0x0b62('0x11a'),'through':_0x0b62('0x34'),'required':![]});db[_0x0b62('0xfa')][_0x0b62('0x10c')](db[_0x0b62('0x5c')],{'as':_0x0b62('0x11b'),'through':'UserSmsQueue','required':![]});db[_0x0b62('0xfa')][_0x0b62('0x10c')](db[_0x0b62('0x11c')],{'as':_0x0b62('0x11d'),'through':'UserOpenchannelQueue','required':![]});db[_0x0b62('0xfa')]['belongsToMany'](db[_0x0b62('0xf0')],{'through':_0x0b62('0x110')});db['User']['belongsToMany'](db['VoicePrefix'],{'as':'VoicePrefixes','through':_0x0b62('0x11e'),'required':![]});db['User']['belongsToMany'](db[_0x0b62('0x66')],{'as':_0x0b62('0x11f'),'through':'user_has_chat_websites'});db[_0x0b62('0xfa')][_0x0b62('0x10c')](db['FaxAccount'],{'as':_0x0b62('0x120'),'through':_0x0b62('0x121')});db['User'][_0x0b62('0x10c')](db[_0x0b62('0x3a')],{'as':_0x0b62('0x122'),'through':_0x0b62('0x123')});db[_0x0b62('0xfa')]['belongsToMany'](db[_0x0b62('0x124')],{'as':_0x0b62('0x125'),'through':_0x0b62('0x126')});db['User'][_0x0b62('0x10c')](db['SmsAccount'],{'as':_0x0b62('0x127'),'through':'user_has_sms_accounts'});db[_0x0b62('0xfa')][_0x0b62('0x10c')](db[_0x0b62('0x128')],{'as':_0x0b62('0x129'),'through':_0x0b62('0x12a')});db['VoiceChanSpy']['hasMany'](db['VoiceExtension'],{'as':_0x0b62('0x12b'),'onDelete':_0x0b62('0xf8'),'foreignKey':_0x0b62('0x12c')});db[_0x0b62('0x16')]['hasMany'](db[_0x0b62('0x18')],{'onDelete':'cascade'});db['VoiceExtension'][_0x0b62('0xfb')](db['VoiceExtension'],{'as':_0x0b62('0x12d'),'onDelete':_0x0b62('0xf8')});db['VoiceMusicOnHold'][_0x0b62('0x10c')](db[_0x0b62('0x92')],{'as':_0x0b62('0x12e'),'through':_0x0b62('0x12f')});db[_0x0b62('0x1b')][_0x0b62('0xfb')](db[_0x0b62('0x130')],{'as':_0x0b62('0x131'),'foreignKey':_0x0b62('0x132')});db[_0x0b62('0x1b')]['hasMany'](db[_0x0b62('0x76')],{'as':_0x0b62('0x133'),'foreignKey':_0x0b62('0x132')});db['VoiceQueue'][_0x0b62('0xfb')](db[_0x0b62('0x7a')],{'as':_0x0b62('0x100'),'foreignKey':_0x0b62('0x132')});db[_0x0b62('0x1b')]['hasMany'](db[_0x0b62('0x7c')],{'as':_0x0b62('0x134'),'foreignKey':_0x0b62('0x132')});db['VoiceQueue'][_0x0b62('0xfb')](db[_0x0b62('0x7e')],{'as':_0x0b62('0x7e'),'foreignKey':_0x0b62('0x132')});db[_0x0b62('0x1b')][_0x0b62('0xfb')](db[_0x0b62('0x78')],{'as':_0x0b62('0x135'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0b62('0xfb')](db[_0x0b62('0x136')],{'as':_0x0b62('0x137'),'foreignKey':_0x0b62('0x132')});db[_0x0b62('0x1b')][_0x0b62('0x108')](db[_0x0b62('0x2a')],{'as':_0x0b62('0x2a'),'foreignKey':'TrunkId'});db['VoiceQueue'][_0x0b62('0x108')](db[_0x0b62('0x2a')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db['VoiceQueue'][_0x0b62('0x108')](db[_0x0b62('0x89')],{'as':'Interval','foreignKey':_0x0b62('0x138')});db[_0x0b62('0x1b')]['belongsTo'](db[_0x0b62('0x8b')],{'as':_0x0b62('0x139'),'foreignKey':_0x0b62('0x13a')});db[_0x0b62('0x1b')][_0x0b62('0x10c')](db[_0x0b62('0xf0')],{'as':'Lists','through':_0x0b62('0x13b')});db[_0x0b62('0x1b')][_0x0b62('0x10c')](db['User'],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0b62('0x1b')]['belongsToMany'](db[_0x0b62('0xe4')],{'as':_0x0b62('0x13c'),'through':_0x0b62('0x13d')});db[_0x0b62('0x1b')]['belongsToMany'](db[_0x0b62('0xf0')],{'as':_0x0b62('0x13e'),'through':_0x0b62('0x13f')});db[_0x0b62('0xfc')][_0x0b62('0x108')](db[_0x0b62('0xfa')],{'as':_0x0b62('0xfa'),'foreignKey':'UserId'});db[_0x0b62('0x1e')][_0x0b62('0xfb')](db[_0x0b62('0x140')],{'as':'Messages','onDelete':_0x0b62('0xf8'),'foreignKey':_0x0b62('0x141'),'sourceKey':_0x0b62('0x142')});db[_0x0b62('0x140')][_0x0b62('0x108')](db[_0x0b62('0x1e')],{'foreignKey':'mailboxuser','targetKey':_0x0b62('0x142')});db[_0x0b62('0x21')][_0x0b62('0xfb')](db['VoiceQueueReport'],{'as':_0x0b62('0x143'),'foreignKey':'uniqueid','constraints':![]});db[_0x0b62('0x21')]['hasMany'](db[_0x0b62('0x144')],{'as':_0x0b62('0x145'),'foreignKey':'uniqueid','constraints':![]});db[_0x0b62('0x21')][_0x0b62('0x108')](db[_0x0b62('0xfa')],{'as':_0x0b62('0xfa'),'foreignKey':_0x0b62('0xf9')});db[_0x0b62('0x21')][_0x0b62('0x108')](db[_0x0b62('0x146')],{'as':_0x0b62('0x147'),'foreignKey':_0x0b62('0x148')});db['MailServerIn'][_0x0b62('0x108')](db[_0x0b62('0x3a')],{'as':_0x0b62('0x3a'),'foreignKey':_0x0b62('0x149')});db[_0x0b62('0x14a')][_0x0b62('0x108')](db[_0x0b62('0x3a')],{'as':_0x0b62('0x3a'),'foreignKey':_0x0b62('0x149')});db[_0x0b62('0x3a')][_0x0b62('0xf7')](db[_0x0b62('0x38')],{'as':'Imap','onDelete':_0x0b62('0xf8')});db[_0x0b62('0x3a')][_0x0b62('0xf7')](db[_0x0b62('0x14a')],{'as':'Smtp','onDelete':_0x0b62('0xf8')});db['MailAccount']['hasMany'](db[_0x0b62('0x86')],{'as':_0x0b62('0x14b'),'foreignKey':'MailAccountId'});db[_0x0b62('0x3a')]['hasMany'](db['CannedAnswer'],{'as':_0x0b62('0x14c'),'foreignKey':'MailAccountId'});db[_0x0b62('0x3a')][_0x0b62('0xfb')](db[_0x0b62('0x41')],{'as':_0x0b62('0x14d'),'foreignKey':'MailAccountId'});db[_0x0b62('0x3a')]['hasMany'](db['MailInteraction'],{'as':_0x0b62('0x14e')});db[_0x0b62('0x3a')][_0x0b62('0xfb')](db[_0x0b62('0x43')],{'as':'Applications'});db[_0x0b62('0x3a')][_0x0b62('0x108')](db['CmList'],{'as':_0x0b62('0x14f'),'foreignKey':_0x0b62('0x150')});db[_0x0b62('0x3a')][_0x0b62('0x108')](db['Template'],{'as':_0x0b62('0x151'),'foreignKey':_0x0b62('0x152')});db['MailAccount'][_0x0b62('0x108')](db['Pause'],{'as':_0x0b62('0x139'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0b62('0x3a')][_0x0b62('0x10c')](db['User'],{'as':_0x0b62('0x153'),'through':_0x0b62('0x123')});db[_0x0b62('0x3b')][_0x0b62('0x10c')](db['User'],{'as':_0x0b62('0x153'),'through':_0x0b62('0x117')});db['MailQueue']['belongsToMany'](db[_0x0b62('0xe4')],{'through':_0x0b62('0x154'),'as':_0x0b62('0x13c')});db[_0x0b62('0x3f')]['hasMany'](db[_0x0b62('0x41')],{'as':_0x0b62('0x14d'),'onDelete':_0x0b62('0xf8'),'foreignKey':'MailInteractionId'});db[_0x0b62('0x3f')][_0x0b62('0x108')](db[_0x0b62('0x3a')],{'as':_0x0b62('0x155'),'foreignKey':_0x0b62('0x149')});db['MailInteraction'][_0x0b62('0x108')](db[_0x0b62('0x146')],{'as':_0x0b62('0x147'),'foreignKey':_0x0b62('0x148')});db[_0x0b62('0x3f')][_0x0b62('0x108')](db['User'],{'as':_0x0b62('0x156'),'foreignKey':_0x0b62('0xf9')});db[_0x0b62('0x3f')]['belongsToMany'](db['Tag'],{'through':'mail_interaction_has_tags','as':'Tags'});db['MailInteraction'][_0x0b62('0x10c')](db[_0x0b62('0x93')],{'through':'mail_interaction_has_tags','as':_0x0b62('0x157')});db[_0x0b62('0x3f')][_0x0b62('0x10c')](db['User'],{'as':'Users','through':_0x0b62('0x158'),'foreignKey':'MailInteractionId'});db[_0x0b62('0x41')]['hasMany'](db[_0x0b62('0xe7')],{'as':_0x0b62('0x159'),'onDelete':'cascade'});db[_0x0b62('0x41')][_0x0b62('0x108')](db[_0x0b62('0xfa')],{'as':_0x0b62('0xfa')});db[_0x0b62('0x41')]['belongsTo'](db[_0x0b62('0x146')],{'onDelete':_0x0b62('0xf8'),'as':_0x0b62('0x147')});db['MailMessage'][_0x0b62('0x108')](db[_0x0b62('0x3f')],{'as':_0x0b62('0x15a'),'foreignKey':_0x0b62('0x15b')});db[_0x0b62('0x41')]['belongsTo'](db[_0x0b62('0x3a')],{'as':_0x0b62('0x155'),'foreignKey':_0x0b62('0x149')});db['MailApplication']['belongsTo'](db[_0x0b62('0xfa')],{'onDelete':_0x0b62('0x15c')});db[_0x0b62('0x43')][_0x0b62('0x108')](db[_0x0b62('0x3b')],{'onDelete':_0x0b62('0x15c')});db[_0x0b62('0x43')][_0x0b62('0x108')](db[_0x0b62('0x3a')],{'onDelete':_0x0b62('0x15c')});db[_0x0b62('0x43')][_0x0b62('0x108')](db[_0x0b62('0x89')],{'onDelete':_0x0b62('0x15c'),'foreignKey':_0x0b62('0x138')});db[_0x0b62('0x43')]['belongsTo'](db[_0x0b62('0x93')],{'onDelete':'restrict','foreignKey':_0x0b62('0x15d')});db[_0x0b62('0x45')]['belongsTo'](db['MailAccount'],{});db[_0x0b62('0x45')][_0x0b62('0x108')](db[_0x0b62('0xf0')],{'as':_0x0b62('0x14f'),'foreignKey':_0x0b62('0x150')});db[_0x0b62('0x45')][_0x0b62('0x108')](db[_0x0b62('0x146')],{'as':_0x0b62('0x147'),'foreignKey':_0x0b62('0x148')});db[_0x0b62('0x45')][_0x0b62('0x108')](db[_0x0b62('0x3f')],{});db[_0x0b62('0x45')][_0x0b62('0x108')](db[_0x0b62('0x41')],{});db[_0x0b62('0x45')]['belongsTo'](db[_0x0b62('0xfa')],{});db[_0x0b62('0x45')]['belongsTo'](db['MailQueue'],{});db[_0x0b62('0x47')][_0x0b62('0xfb')](db[_0x0b62('0x49')],{'as':_0x0b62('0x15e'),'onDelete':_0x0b62('0xf8')});db[_0x0b62('0x4b')]['hasMany'](db[_0x0b62('0x86')],{'as':_0x0b62('0x14b'),'foreignKey':'FaxAccountId'});db[_0x0b62('0x4b')][_0x0b62('0xfb')](db['CannedAnswer'],{'as':_0x0b62('0x14c'),'foreignKey':_0x0b62('0x15f')});db[_0x0b62('0x4b')][_0x0b62('0xfb')](db['FaxInteraction'],{'as':_0x0b62('0x14e')});db[_0x0b62('0x4b')][_0x0b62('0xfb')](db[_0x0b62('0x4d')],{'as':_0x0b62('0x12d')});db[_0x0b62('0x4b')]['hasMany'](db[_0x0b62('0x18')],{'as':'Exntensions','onDelete':_0x0b62('0xf8')});db[_0x0b62('0x4b')]['hasMany'](db[_0x0b62('0x160')],{'as':_0x0b62('0x14d')});db[_0x0b62('0x4b')]['belongsTo'](db[_0x0b62('0x2a')],{'as':_0x0b62('0x2a')});db[_0x0b62('0x4b')][_0x0b62('0x108')](db[_0x0b62('0xf0')],{'as':'List','foreignKey':_0x0b62('0x150')});db[_0x0b62('0x4b')][_0x0b62('0x108')](db[_0x0b62('0x8b')],{'as':_0x0b62('0x139'),'foreignKey':_0x0b62('0x13a')});db[_0x0b62('0x4b')][_0x0b62('0x10c')](db['User'],{'as':_0x0b62('0x153'),'through':_0x0b62('0x121')});db[_0x0b62('0x4d')][_0x0b62('0x108')](db[_0x0b62('0xfa')],{'onDelete':'restrict'});db[_0x0b62('0x4d')][_0x0b62('0x108')](db[_0x0b62('0x119')],{'onDelete':_0x0b62('0x15c')});db[_0x0b62('0x4d')][_0x0b62('0x108')](db[_0x0b62('0x4b')],{'onDelete':'restrict'});db[_0x0b62('0x4d')][_0x0b62('0x108')](db[_0x0b62('0x93')],{'onDelete':_0x0b62('0x15c'),'foreignKey':_0x0b62('0x15d')});db[_0x0b62('0x4f')][_0x0b62('0xfb')](db[_0x0b62('0x160')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0b62('0x161')});db['FaxInteraction'][_0x0b62('0x108')](db['FaxAccount'],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x0b62('0x4f')][_0x0b62('0x108')](db[_0x0b62('0x146')],{'as':_0x0b62('0x147'),'foreignKey':_0x0b62('0x148')});db['FaxInteraction'][_0x0b62('0x108')](db[_0x0b62('0xfa')],{'as':'Owner','foreignKey':_0x0b62('0xf9')});db[_0x0b62('0x4f')]['belongsToMany'](db['Tag'],{'through':'fax_interaction_has_tags','as':'Tags'});db[_0x0b62('0x4f')][_0x0b62('0x10c')](db[_0x0b62('0x93')],{'through':_0x0b62('0x162'),'as':_0x0b62('0x157')});db['FaxInteraction'][_0x0b62('0x10c')](db['User'],{'as':'Users','through':_0x0b62('0x113'),'foreignKey':_0x0b62('0x161')});db[_0x0b62('0x160')]['belongsTo'](db[_0x0b62('0xfa')],{'onDelete':_0x0b62('0xf8'),'as':_0x0b62('0xfa')});db[_0x0b62('0x160')][_0x0b62('0x108')](db['FaxInteraction'],{'as':_0x0b62('0x15a'),'foreignKey':'FaxInteractionId'});db[_0x0b62('0x160')][_0x0b62('0x108')](db[_0x0b62('0x146')],{'onDelete':_0x0b62('0xf8'),'as':'Contact'});db[_0x0b62('0x160')][_0x0b62('0x108')](db[_0x0b62('0xe7')],{'as':_0x0b62('0xe7'),'foreignKey':'AttachmentId'});db[_0x0b62('0x160')][_0x0b62('0x108')](db['FaxAccount'],{'as':_0x0b62('0x155'),'foreignKey':_0x0b62('0x15f')});db[_0x0b62('0x119')][_0x0b62('0x10c')](db[_0x0b62('0xfa')],{'as':'Agents','through':'UserFaxQueue'});db['FaxQueue'][_0x0b62('0x10c')](db[_0x0b62('0xe4')],{'through':'team_has_fax_queues','as':_0x0b62('0x13c')});db[_0x0b62('0x52')][_0x0b62('0x108')](db[_0x0b62('0x4b')],{});db[_0x0b62('0x52')][_0x0b62('0x108')](db[_0x0b62('0xf0')],{'as':_0x0b62('0x14f'),'foreignKey':_0x0b62('0x150')});db[_0x0b62('0x52')][_0x0b62('0x108')](db['CmContact'],{'as':_0x0b62('0x147'),'foreignKey':_0x0b62('0x148')});db['FaxQueueReport'][_0x0b62('0x108')](db['FaxInteraction'],{});db[_0x0b62('0x52')][_0x0b62('0x108')](db[_0x0b62('0x160')],{});db[_0x0b62('0x52')][_0x0b62('0x108')](db[_0x0b62('0xfa')],{});db[_0x0b62('0x52')]['belongsTo'](db[_0x0b62('0x119')],{});db[_0x0b62('0x54')]['hasMany'](db[_0x0b62('0x86')],{'as':'Dispositions','foreignKey':_0x0b62('0x163')});db['SmsAccount'][_0x0b62('0xfb')](db[_0x0b62('0x164')],{'as':_0x0b62('0x14c'),'foreignKey':_0x0b62('0x163')});db['SmsAccount'][_0x0b62('0xfb')](db[_0x0b62('0x5a')],{'as':'Messages','foreignKey':'SmsAccountId'});db['SmsAccount'][_0x0b62('0xfb')](db[_0x0b62('0x58')],{'as':_0x0b62('0x14e')});db['SmsAccount'][_0x0b62('0xfb')](db[_0x0b62('0x56')],{'as':'Applications'});db[_0x0b62('0x54')][_0x0b62('0x108')](db[_0x0b62('0xf0')],{'as':'List','foreignKey':_0x0b62('0x150')});db[_0x0b62('0x54')][_0x0b62('0x108')](db[_0x0b62('0x8b')],{'as':_0x0b62('0x139'),'foreignKey':_0x0b62('0x13a')});db[_0x0b62('0x54')]['belongsToMany'](db[_0x0b62('0xfa')],{'as':_0x0b62('0x153'),'through':_0x0b62('0x165')});db[_0x0b62('0x56')]['belongsTo'](db[_0x0b62('0xfa')],{'onDelete':_0x0b62('0x15c')});db['SmsApplication'][_0x0b62('0x108')](db[_0x0b62('0x5c')],{'onDelete':'restrict'});db['SmsApplication'][_0x0b62('0x108')](db[_0x0b62('0x54')],{'onDelete':'restrict'});db[_0x0b62('0x56')][_0x0b62('0x108')](db[_0x0b62('0x89')],{'onDelete':_0x0b62('0x15c'),'foreignKey':'IntervalId'});db[_0x0b62('0x56')]['belongsTo'](db['Tag'],{'onDelete':_0x0b62('0x15c'),'foreignKey':_0x0b62('0x15d')});db[_0x0b62('0x58')][_0x0b62('0xfb')](db[_0x0b62('0x5a')],{'as':_0x0b62('0x14d'),'onDelete':_0x0b62('0xf8'),'foreignKey':_0x0b62('0x166')});db[_0x0b62('0x58')][_0x0b62('0x108')](db['SmsAccount'],{'as':'Account','foreignKey':'SmsAccountId'});db[_0x0b62('0x58')][_0x0b62('0x108')](db[_0x0b62('0x146')],{'as':_0x0b62('0x147'),'foreignKey':'ContactId'});db[_0x0b62('0x58')]['belongsTo'](db[_0x0b62('0xfa')],{'as':_0x0b62('0x156'),'foreignKey':_0x0b62('0xf9')});db[_0x0b62('0x58')][_0x0b62('0x10c')](db[_0x0b62('0x93')],{'through':_0x0b62('0x167'),'as':_0x0b62('0x168')});db['SmsInteraction'][_0x0b62('0x10c')](db[_0x0b62('0x93')],{'through':'sms_interaction_has_tags','as':_0x0b62('0x157')});db[_0x0b62('0x58')]['belongsToMany'](db['User'],{'as':_0x0b62('0x169'),'through':'user_has_sms_interactions','foreignKey':_0x0b62('0x166')});db['SmsMessage']['belongsTo'](db[_0x0b62('0xfa')],{'as':_0x0b62('0xfa')});db[_0x0b62('0x5a')][_0x0b62('0x108')](db[_0x0b62('0x146')],{'onDelete':_0x0b62('0xf8'),'as':_0x0b62('0x147')});db['SmsMessage'][_0x0b62('0x108')](db[_0x0b62('0x58')],{'onDelete':_0x0b62('0xf8'),'as':_0x0b62('0x15a'),'foreignKey':_0x0b62('0x166')});db[_0x0b62('0x5a')]['belongsTo'](db[_0x0b62('0x54')],{'as':'Account','foreignKey':'SmsAccountId'});db[_0x0b62('0x5c')][_0x0b62('0x10c')](db[_0x0b62('0xfa')],{'as':_0x0b62('0x153'),'through':_0x0b62('0x16a'),'foreignKey':_0x0b62('0x16b')});db[_0x0b62('0x5c')][_0x0b62('0x10c')](db[_0x0b62('0xe4')],{'through':_0x0b62('0x16c'),'as':_0x0b62('0x13c')});db[_0x0b62('0x124')][_0x0b62('0xfb')](db['Disposition'],{'as':_0x0b62('0x14b'),'foreignKey':_0x0b62('0x16d')});db['OpenchannelAccount']['hasMany'](db[_0x0b62('0x164')],{'as':_0x0b62('0x14c'),'foreignKey':_0x0b62('0x16d')});db[_0x0b62('0x124')][_0x0b62('0xfb')](db[_0x0b62('0x61')],{'as':'Interactions','foreignKey':_0x0b62('0x16d')});db[_0x0b62('0x124')][_0x0b62('0xfb')](db[_0x0b62('0x63')],{'as':_0x0b62('0x14d'),'foreignKey':_0x0b62('0x16d')});db[_0x0b62('0x124')][_0x0b62('0xfb')](db[_0x0b62('0x5f')],{'as':_0x0b62('0x12d'),'foreignKey':_0x0b62('0x16d')});db[_0x0b62('0x124')]['belongsTo'](db[_0x0b62('0xf0')],{'as':_0x0b62('0x14f'),'foreignKey':'ListId'});db[_0x0b62('0x124')]['belongsTo'](db[_0x0b62('0x8b')],{'as':_0x0b62('0x139'),'foreignKey':_0x0b62('0x13a')});db[_0x0b62('0x124')]['belongsToMany'](db[_0x0b62('0xfa')],{'as':_0x0b62('0x153'),'through':_0x0b62('0x126')});db['OpenchannelApplication'][_0x0b62('0x108')](db[_0x0b62('0xfa')],{'onDelete':_0x0b62('0x15c')});db[_0x0b62('0x5f')][_0x0b62('0x108')](db[_0x0b62('0x11c')],{'onDelete':_0x0b62('0x15c'),'foreignKey':_0x0b62('0x16e')});db[_0x0b62('0x5f')][_0x0b62('0x108')](db[_0x0b62('0x124')],{'onDelete':_0x0b62('0x15c'),'foreignKey':'OpenchannelAccountId'});db[_0x0b62('0x5f')][_0x0b62('0x108')](db[_0x0b62('0x89')],{'onDelete':_0x0b62('0x15c'),'foreignKey':_0x0b62('0x138')});db['OpenchannelApplication'][_0x0b62('0x108')](db[_0x0b62('0x93')],{'onDelete':_0x0b62('0x15c'),'foreignKey':_0x0b62('0x15d')});db[_0x0b62('0x61')]['hasMany'](db[_0x0b62('0x63')],{'as':_0x0b62('0x14d'),'onDelete':_0x0b62('0xf8'),'foreignKey':_0x0b62('0x16f')});db[_0x0b62('0x61')]['belongsTo'](db[_0x0b62('0x124')],{'as':_0x0b62('0x155'),'foreignKey':_0x0b62('0x16d')});db[_0x0b62('0x61')][_0x0b62('0x108')](db['CmContact'],{'as':_0x0b62('0x147'),'foreignKey':'ContactId'});db['OpenchannelInteraction'][_0x0b62('0x108')](db['User'],{'as':_0x0b62('0x156'),'foreignKey':_0x0b62('0xf9')});db['OpenchannelInteraction'][_0x0b62('0x10c')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0b62('0x168')});db['OpenchannelInteraction']['belongsToMany'](db['Tag'],{'through':_0x0b62('0x170'),'as':_0x0b62('0x157')});db[_0x0b62('0x61')][_0x0b62('0x10c')](db[_0x0b62('0xfa')],{'as':_0x0b62('0x169'),'through':_0x0b62('0x114'),'foreignKey':_0x0b62('0x16f')});db[_0x0b62('0x63')]['belongsTo'](db['User'],{'onDelete':_0x0b62('0xf8'),'as':_0x0b62('0xfa')});db[_0x0b62('0x63')]['belongsTo'](db[_0x0b62('0x146')],{'onDelete':'cascade','as':_0x0b62('0x147')});db['OpenchannelMessage'][_0x0b62('0x108')](db[_0x0b62('0x61')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0b62('0x16f')});db[_0x0b62('0x63')][_0x0b62('0x108')](db[_0x0b62('0xe7')],{'as':_0x0b62('0xe7'),'foreignKey':_0x0b62('0x171')});db[_0x0b62('0x63')][_0x0b62('0x108')](db[_0x0b62('0x124')],{'as':_0x0b62('0x155'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelQueue'][_0x0b62('0x10c')](db[_0x0b62('0xfa')],{'as':_0x0b62('0x153'),'through':_0x0b62('0x36'),'foreignKey':_0x0b62('0x16e')});db[_0x0b62('0x11c')][_0x0b62('0x10c')](db[_0x0b62('0xe4')],{'through':_0x0b62('0x172'),'as':_0x0b62('0x13c')});db[_0x0b62('0x66')]['hasMany'](db[_0x0b62('0x86')],{'as':_0x0b62('0x14b'),'foreignKey':_0x0b62('0x173')});db['ChatWebsite'][_0x0b62('0xfb')](db[_0x0b62('0x164')],{'as':'Answers','foreignKey':_0x0b62('0x173')});db[_0x0b62('0x66')]['hasMany'](db['ChatProactiveAction'],{'as':_0x0b62('0x174')});db[_0x0b62('0x66')]['hasMany'](db[_0x0b62('0x103')],{'as':_0x0b62('0x14e')});db[_0x0b62('0x66')][_0x0b62('0xfb')](db[_0x0b62('0x175')],{'as':_0x0b62('0x12d')});db[_0x0b62('0x66')]['hasMany'](db[_0x0b62('0x6c')],{'as':_0x0b62('0x14d')});db[_0x0b62('0x66')][_0x0b62('0x108')](db[_0x0b62('0xf0')],{'as':_0x0b62('0x14f'),'foreignKey':_0x0b62('0x150')});db[_0x0b62('0x66')][_0x0b62('0x108')](db['Interval'],{'as':_0x0b62('0x89'),'foreignKey':_0x0b62('0x138')});db[_0x0b62('0x66')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0b62('0x13a')});db[_0x0b62('0x66')][_0x0b62('0x10c')](db[_0x0b62('0xfa')],{'as':_0x0b62('0x153'),'through':_0x0b62('0x176')});db[_0x0b62('0x68')][_0x0b62('0x108')](db[_0x0b62('0x124')],{});db['OpenchannelQueueReport'][_0x0b62('0x108')](db[_0x0b62('0xf0')],{'as':_0x0b62('0x14f'),'foreignKey':_0x0b62('0x150')});db[_0x0b62('0x68')][_0x0b62('0x108')](db[_0x0b62('0x146')],{'as':'Contact','foreignKey':_0x0b62('0x148')});db[_0x0b62('0x68')][_0x0b62('0x108')](db['OpenchannelInteraction'],{});db[_0x0b62('0x68')][_0x0b62('0x108')](db[_0x0b62('0x63')],{});db[_0x0b62('0x68')][_0x0b62('0x108')](db[_0x0b62('0xfa')],{});db['OpenchannelQueueReport'][_0x0b62('0x108')](db[_0x0b62('0x11c')],{});db[_0x0b62('0x175')][_0x0b62('0x108')](db[_0x0b62('0xfa')],{'as':_0x0b62('0x177'),'foreignKey':_0x0b62('0xf9'),'onDelete':_0x0b62('0x15c')});db[_0x0b62('0x175')][_0x0b62('0x108')](db[_0x0b62('0x178')],{'as':_0x0b62('0x179'),'foreignKey':_0x0b62('0x17a'),'onDelete':_0x0b62('0x15c')});db['ChatApplication'][_0x0b62('0x108')](db[_0x0b62('0x66')],{'as':_0x0b62('0x17b'),'foreignKey':_0x0b62('0x173'),'onDelete':_0x0b62('0x15c')});db['ChatApplication']['belongsTo'](db[_0x0b62('0x93')],{'onDelete':_0x0b62('0x15c'),'foreignKey':_0x0b62('0x15d')});db['ChatInteraction']['hasMany'](db[_0x0b62('0x6c')],{'as':_0x0b62('0x14d'),'onDelete':'cascade','foreignKey':'ChatInteractionId'});db['ChatInteraction'][_0x0b62('0x108')](db[_0x0b62('0x66')],{'as':_0x0b62('0x155'),'foreignKey':_0x0b62('0x173')});db[_0x0b62('0x103')]['belongsTo'](db[_0x0b62('0x146')],{'as':_0x0b62('0x147'),'foreignKey':'ContactId'});db[_0x0b62('0x103')][_0x0b62('0x108')](db[_0x0b62('0xfa')],{'as':_0x0b62('0x156'),'foreignKey':_0x0b62('0xf9')});db[_0x0b62('0x103')]['belongsToMany'](db[_0x0b62('0x93')],{'through':_0x0b62('0x17c'),'as':_0x0b62('0x168')});db[_0x0b62('0x103')][_0x0b62('0x10c')](db[_0x0b62('0x93')],{'through':'chat_interaction_has_tags','as':_0x0b62('0x157')});db[_0x0b62('0x103')]['belongsToMany'](db[_0x0b62('0xfa')],{'as':_0x0b62('0x169'),'through':_0x0b62('0x112'),'foreignKey':_0x0b62('0x17d')});db[_0x0b62('0x6c')][_0x0b62('0x108')](db[_0x0b62('0xfa')],{'onDelete':_0x0b62('0xf8'),'as':_0x0b62('0xfa')});db[_0x0b62('0x6c')][_0x0b62('0x108')](db['CmContact'],{'onDelete':_0x0b62('0xf8'),'as':_0x0b62('0x147'),'foreignKey':_0x0b62('0x148')});db[_0x0b62('0x6c')][_0x0b62('0x108')](db[_0x0b62('0x103')],{'onDelete':_0x0b62('0xf8'),'as':_0x0b62('0x15a'),'foreignKey':_0x0b62('0x17d')});db['ChatMessage'][_0x0b62('0x108')](db['Attachment'],{'as':'Attachment','foreignKey':_0x0b62('0x171')});db[_0x0b62('0x6c')][_0x0b62('0x108')](db[_0x0b62('0x66')],{'as':_0x0b62('0x155'),'foreignKey':_0x0b62('0x173')});db[_0x0b62('0x6e')][_0x0b62('0x108')](db[_0x0b62('0x146')],{'onDelete':_0x0b62('0xf8'),'as':_0x0b62('0x147'),'foreignKey':_0x0b62('0x148')});db['ChatOfflineMessage'][_0x0b62('0x108')](db[_0x0b62('0x66')],{'as':'Account','foreignKey':_0x0b62('0x173')});db['ChatQueue'][_0x0b62('0x10c')](db[_0x0b62('0xfa')],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db[_0x0b62('0x178')][_0x0b62('0x10c')](db[_0x0b62('0xe4')],{'through':_0x0b62('0x17e'),'as':_0x0b62('0x13c')});db[_0x0b62('0x71')][_0x0b62('0xfb')](db[_0x0b62('0xd0')],{'as':_0x0b62('0x14d'),'foreignKey':_0x0b62('0x17f'),'onDelete':_0x0b62('0xf8')});db[_0x0b62('0x71')]['belongsToMany'](db[_0x0b62('0xfa')],{'as':_0x0b62('0x131'),'through':_0x0b62('0x10b')});db[_0x0b62('0x72')][_0x0b62('0x108')](db[_0x0b62('0x66')],{'as':_0x0b62('0x17b'),'foreignKey':_0x0b62('0x173')});db[_0x0b62('0x74')][_0x0b62('0xfb')](db[_0x0b62('0x146')],{'as':_0x0b62('0x10d'),'foreignKey':_0x0b62('0x180')});db['CmContact'][_0x0b62('0xfb')](db[_0x0b62('0x76')],{'as':_0x0b62('0x133'),'foreignKey':_0x0b62('0x148')});db[_0x0b62('0x146')][_0x0b62('0xfb')](db[_0x0b62('0x7a')],{'as':_0x0b62('0x100'),'foreignKey':_0x0b62('0x148')});db[_0x0b62('0x146')][_0x0b62('0xfb')](db['CmHopperHistory'],{'as':_0x0b62('0x134'),'foreignKey':'ContactId'});db[_0x0b62('0x146')][_0x0b62('0xfb')](db[_0x0b62('0x7e')],{'as':_0x0b62('0x7e'),'foreignKey':'ContactId'});db[_0x0b62('0x146')]['hasMany'](db[_0x0b62('0x136')],{'as':_0x0b62('0x137'),'foreignKey':_0x0b62('0x148')});db[_0x0b62('0x146')][_0x0b62('0xfb')](db[_0x0b62('0x61')],{'as':_0x0b62('0x102'),'foreignKey':_0x0b62('0x148'),'onDelete':_0x0b62('0x15c')});db[_0x0b62('0x146')]['hasMany'](db[_0x0b62('0x103')],{'as':'ChatInteractions','foreignKey':_0x0b62('0x148'),'onDelete':'restrict'});db[_0x0b62('0x146')][_0x0b62('0xfb')](db[_0x0b62('0x58')],{'as':_0x0b62('0x105'),'foreignKey':_0x0b62('0x148'),'onDelete':'restrict'});db[_0x0b62('0x146')][_0x0b62('0xfb')](db[_0x0b62('0x4f')],{'as':_0x0b62('0x106'),'foreignKey':'ContactId','onDelete':_0x0b62('0x15c')});db[_0x0b62('0x146')][_0x0b62('0xfb')](db[_0x0b62('0x3f')],{'as':_0x0b62('0x107'),'foreignKey':_0x0b62('0x148'),'onDelete':'restrict'});db[_0x0b62('0x146')]['belongsTo'](db[_0x0b62('0x74')],{'as':_0x0b62('0x181'),'foreignKey':_0x0b62('0x180')});db[_0x0b62('0x146')][_0x0b62('0x108')](db[_0x0b62('0xf0')],{'as':_0x0b62('0x14f'),'foreignKey':_0x0b62('0x150'),'onDelete':_0x0b62('0xf8')});db['CmContact']['belongsToMany'](db['User'],{'as':_0x0b62('0x169'),'through':_0x0b62('0x10e')});db[_0x0b62('0x146')][_0x0b62('0x10c')](db[_0x0b62('0x93')],{'as':_0x0b62('0x168'),'through':_0x0b62('0x182')});db['CmContact'][_0x0b62('0x10c')](db['Tag'],{'through':'cm_contact_has_tags','as':'ThroughTags'});db[_0x0b62('0x76')]['belongsTo'](db[_0x0b62('0x146')],{'as':_0x0b62('0x147'),'foreignKey':'ContactId','onDelete':_0x0b62('0xf8')});db[_0x0b62('0x76')]['belongsTo'](db[_0x0b62('0xf0')],{'as':_0x0b62('0x14f'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x0b62('0x76')][_0x0b62('0x108')](db[_0x0b62('0xfa')],{'as':'Agent','foreignKey':_0x0b62('0xf9')});db[_0x0b62('0x76')][_0x0b62('0x108')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x0b62('0x132'),'onDelete':'cascade'});db['CmHopper'][_0x0b62('0x108')](db[_0x0b62('0x183')],{'as':_0x0b62('0x183'),'foreignKey':_0x0b62('0x184'),'onDelete':_0x0b62('0xf8')});db['CmHopper'][_0x0b62('0x108')](db[_0x0b62('0xfa')],{'as':_0x0b62('0x156'),'foreignKey':_0x0b62('0x185')});db[_0x0b62('0x78')][_0x0b62('0x108')](db[_0x0b62('0x146')],{'as':'Contact','foreignKey':_0x0b62('0x148'),'onDelete':'cascade'});db[_0x0b62('0x78')][_0x0b62('0x108')](db[_0x0b62('0xf0')],{'as':_0x0b62('0x14f'),'foreignKey':'ListId','onDelete':_0x0b62('0xf8')});db[_0x0b62('0x78')][_0x0b62('0x108')](db[_0x0b62('0x1b')],{'as':_0x0b62('0x179'),'foreignKey':_0x0b62('0x132'),'onDelete':_0x0b62('0xf8')});db[_0x0b62('0x78')]['belongsTo'](db[_0x0b62('0x183')],{'as':_0x0b62('0x183'),'foreignKey':_0x0b62('0x184'),'onDelete':'cascade'});db[_0x0b62('0x84')][_0x0b62('0xfb')](db[_0x0b62('0x87')],{'as':{'plural':_0x0b62('0x186'),'singular':'OneAll'},'foreignKey':_0x0b62('0x187'),'onDelete':_0x0b62('0xf8'),'hooks':!![]});db['Automation'][_0x0b62('0xfb')](db[_0x0b62('0x87')],{'as':{'plural':'Any','singular':_0x0b62('0x188')},'foreignKey':'AutomationAnyId','onDelete':_0x0b62('0xf8'),'hooks':!![]});db[_0x0b62('0x84')]['hasMany'](db['Action'],{'as':_0x0b62('0x189'),'foreignKey':_0x0b62('0x18a'),'onDelete':'cascade','hooks':!![]});db[_0x0b62('0x89')][_0x0b62('0xfb')](db[_0x0b62('0x89')],{'as':_0x0b62('0x18b'),'foreignKey':_0x0b62('0x138'),'onDelete':_0x0b62('0xf8'),'hooks':!![],'required':![]});db[_0x0b62('0x89')]['hasMany'](db[_0x0b62('0x18')],{'as':'Extensions','foreignKey':_0x0b62('0x138'),'onDelete':_0x0b62('0x15c')});db[_0x0b62('0x89')][_0x0b62('0xfb')](db[_0x0b62('0x43')],{'as':_0x0b62('0x18c'),'foreignKey':_0x0b62('0x138')});db[_0x0b62('0x89')][_0x0b62('0xfb')](db[_0x0b62('0x175')],{'as':_0x0b62('0x18d'),'foreignKey':_0x0b62('0x138')});db['Interval']['hasMany'](db['FaxApplication'],{'as':_0x0b62('0x18e'),'foreignKey':_0x0b62('0x138')});db[_0x0b62('0x89')]['hasMany'](db[_0x0b62('0x56')],{'as':_0x0b62('0x18f'),'foreignKey':_0x0b62('0x138')});db[_0x0b62('0x91')][_0x0b62('0x108')](db[_0x0b62('0x3a')],{});db[_0x0b62('0x91')][_0x0b62('0x108')](db[_0x0b62('0x9d')],{'foreignKey':_0x0b62('0x190')});db[_0x0b62('0x91')][_0x0b62('0x108')](db[_0x0b62('0x9b')],{'foreignKey':_0x0b62('0x191')});db['Sound'][_0x0b62('0x10c')](db[_0x0b62('0x19')],{'as':'Mohs','through':_0x0b62('0x12f'),'onDelete':_0x0b62('0x15c')});db[_0x0b62('0x93')]['belongsToMany'](db[_0x0b62('0x146')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0b62('0x10c')](db['ChatInteraction'],{'through':_0x0b62('0x17c')});db[_0x0b62('0x93')][_0x0b62('0x10c')](db[_0x0b62('0x3f')],{'through':_0x0b62('0x192')});db[_0x0b62('0x93')][_0x0b62('0x10c')](db[_0x0b62('0x58')],{'through':_0x0b62('0x167')});db[_0x0b62('0x93')]['belongsToMany'](db[_0x0b62('0x4f')],{'through':_0x0b62('0x162')});db[_0x0b62('0x93')][_0x0b62('0x10c')](db[_0x0b62('0x61')],{'through':_0x0b62('0x170')});db[_0x0b62('0x96')]['hasMany'](db[_0x0b62('0x87')],{'as':{'plural':_0x0b62('0x193'),'singular':_0x0b62('0x194')},'foreignKey':'TriggerAllId','onDelete':_0x0b62('0xf8'),'hooks':!![]});db[_0x0b62('0x96')]['hasMany'](db[_0x0b62('0x87')],{'as':{'plural':_0x0b62('0x195'),'singular':_0x0b62('0x196')},'foreignKey':_0x0b62('0x197'),'onDelete':_0x0b62('0xf8'),'hooks':!![]});db['Trigger'][_0x0b62('0xfb')](db[_0x0b62('0x82')],{'as':_0x0b62('0x189'),'foreignKey':_0x0b62('0x198'),'onDelete':_0x0b62('0xf8'),'hooks':!![]});db['AnalyticCustomReport'][_0x0b62('0xfb')](db['AnalyticFieldReport'],{'as':_0x0b62('0x199'),'onDelete':_0x0b62('0xf8'),'foreignKey':_0x0b62('0x191'),'hooks':!![]});db[_0x0b62('0x9d')][_0x0b62('0xfb')](db[_0x0b62('0xa1')],{'as':_0x0b62('0x199'),'onDelete':_0x0b62('0xf8'),'foreignKey':_0x0b62('0x190')});db[_0x0b62('0x19a')]['hasMany'](db[_0x0b62('0xa1')],{'as':_0x0b62('0x199'),'onDelete':_0x0b62('0xf8'),'foreignKey':_0x0b62('0x19b')});db['AnalyticFieldReport'][_0x0b62('0x108')](db['AnalyticMetric'],{'foreignKey':_0x0b62('0x19b')});db[_0x0b62('0x19c')][_0x0b62('0xfb')](db[_0x0b62('0x19d')],{'as':_0x0b62('0x19e'),'onDelete':_0x0b62('0xf8'),'foreignKey':'AccountId'});db[_0x0b62('0x19d')]['hasMany'](db[_0x0b62('0xa5')],{'as':'Subjects','onDelete':_0x0b62('0xf8'),'foreignKey':'SubjectId'});db[_0x0b62('0x19d')][_0x0b62('0xfb')](db[_0x0b62('0xa5')],{'as':_0x0b62('0x19f'),'onDelete':'cascade','foreignKey':_0x0b62('0x1a0')});db[_0x0b62('0x19d')][_0x0b62('0xfb')](db[_0x0b62('0xa5')],{'as':_0x0b62('0x199'),'onDelete':_0x0b62('0xf8'),'foreignKey':_0x0b62('0x1a1')});db[_0x0b62('0x19d')][_0x0b62('0x108')](db[_0x0b62('0x19c')],{'as':_0x0b62('0x155'),'foreignKey':'AccountId'});db[_0x0b62('0xa5')][_0x0b62('0xfb')](db[_0x0b62('0xa5')],{'as':_0x0b62('0x1a2'),'foreignKey':_0x0b62('0x1a3')});db[_0x0b62('0xa5')][_0x0b62('0xfb')](db[_0x0b62('0xa5')],{'as':_0x0b62('0x1a4'),'foreignKey':'DescriptionId'});db[_0x0b62('0xa5')][_0x0b62('0xfb')](db[_0x0b62('0xa5')],{'as':_0x0b62('0x1a5'),'foreignKey':_0x0b62('0x1a1')});db[_0x0b62('0xa5')][_0x0b62('0x108')](db[_0x0b62('0x1a6')],{'as':_0x0b62('0x1a6'),'foreignKey':_0x0b62('0x1a7')});db[_0x0b62('0x1a8')]['hasMany'](db[_0x0b62('0x1a9')],{'as':_0x0b62('0x19e'),'onDelete':_0x0b62('0xf8'),'foreignKey':_0x0b62('0x1aa')});db['SugarcrmConfiguration']['hasMany'](db['SugarcrmField'],{'as':_0x0b62('0x1ab'),'onDelete':_0x0b62('0xf8'),'foreignKey':_0x0b62('0x1a3')});db['SugarcrmConfiguration'][_0x0b62('0xfb')](db['SugarcrmField'],{'as':_0x0b62('0x19f'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x0b62('0x1a9')][_0x0b62('0xfb')](db[_0x0b62('0x1ac')],{'as':_0x0b62('0x199'),'onDelete':_0x0b62('0xf8'),'foreignKey':'FieldId'});db[_0x0b62('0x1a9')]['belongsTo'](db['SugarcrmAccount'],{'as':_0x0b62('0x155'),'foreignKey':_0x0b62('0x1aa')});db[_0x0b62('0x1ac')][_0x0b62('0xfb')](db[_0x0b62('0x1ac')],{'as':_0x0b62('0x1a2'),'foreignKey':_0x0b62('0x1a3')});db[_0x0b62('0x1ac')][_0x0b62('0xfb')](db[_0x0b62('0x1ac')],{'as':'Description','foreignKey':_0x0b62('0x1a0')});db[_0x0b62('0x1ac')][_0x0b62('0xfb')](db['SugarcrmField'],{'as':_0x0b62('0x1a5'),'foreignKey':_0x0b62('0x1a1')});db[_0x0b62('0x1ac')]['belongsTo'](db[_0x0b62('0x1a6')],{'as':_0x0b62('0x1a6'),'foreignKey':'VariableId'});db[_0x0b62('0xa8')][_0x0b62('0xfb')](db[_0x0b62('0xaa')],{'as':_0x0b62('0x19e'),'onDelete':_0x0b62('0xf8'),'foreignKey':_0x0b62('0x1aa')});db[_0x0b62('0xaa')][_0x0b62('0xfb')](db['DeskField'],{'as':_0x0b62('0x1ab'),'onDelete':'cascade','foreignKey':_0x0b62('0x1a3')});db[_0x0b62('0xaa')]['hasMany'](db[_0x0b62('0xac')],{'as':_0x0b62('0x19f'),'onDelete':'cascade','foreignKey':_0x0b62('0x1a0')});db[_0x0b62('0xaa')]['hasMany'](db[_0x0b62('0xac')],{'as':_0x0b62('0x199'),'onDelete':_0x0b62('0xf8'),'foreignKey':_0x0b62('0x1a1')});db['DeskConfiguration'][_0x0b62('0x108')](db[_0x0b62('0xa8')],{'as':_0x0b62('0x155'),'foreignKey':_0x0b62('0x1aa')});db['DeskConfiguration']['belongsToMany'](db['Tag'],{'through':_0x0b62('0x1ad')});db[_0x0b62('0xac')][_0x0b62('0xfb')](db[_0x0b62('0xac')],{'as':_0x0b62('0x1a2'),'foreignKey':'SubjectId'});db[_0x0b62('0xac')][_0x0b62('0xfb')](db[_0x0b62('0xac')],{'as':_0x0b62('0x1a4'),'foreignKey':'DescriptionId'});db[_0x0b62('0xac')][_0x0b62('0xfb')](db[_0x0b62('0xac')],{'as':_0x0b62('0x1a5'),'foreignKey':_0x0b62('0x1a1')});db[_0x0b62('0xac')][_0x0b62('0x108')](db['Variable'],{'as':_0x0b62('0x1a6'),'foreignKey':_0x0b62('0x1a7')});db[_0x0b62('0xae')][_0x0b62('0xfb')](db['ZohoConfiguration'],{'as':'Configurations','onDelete':_0x0b62('0xf8'),'foreignKey':_0x0b62('0x1aa')});db[_0x0b62('0xb0')][_0x0b62('0xfb')](db[_0x0b62('0xb2')],{'as':_0x0b62('0x1ab'),'onDelete':_0x0b62('0xf8'),'foreignKey':_0x0b62('0x1a3')});db[_0x0b62('0xb0')][_0x0b62('0xfb')](db['ZohoField'],{'as':_0x0b62('0x19f'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x0b62('0xb0')][_0x0b62('0xfb')](db[_0x0b62('0xb2')],{'as':_0x0b62('0x199'),'onDelete':_0x0b62('0xf8'),'foreignKey':_0x0b62('0x1a1')});db['ZohoConfiguration'][_0x0b62('0x108')](db[_0x0b62('0xae')],{'as':_0x0b62('0x155'),'foreignKey':_0x0b62('0x1aa')});db[_0x0b62('0xb2')][_0x0b62('0xfb')](db[_0x0b62('0xb2')],{'as':_0x0b62('0x1a2'),'foreignKey':'SubjectId'});db[_0x0b62('0xb2')]['hasMany'](db[_0x0b62('0xb2')],{'as':_0x0b62('0x1a4'),'foreignKey':_0x0b62('0x1a0')});db[_0x0b62('0xb2')][_0x0b62('0xfb')](db[_0x0b62('0xb2')],{'as':'Field','foreignKey':_0x0b62('0x1a1')});db['ZohoField'][_0x0b62('0x108')](db[_0x0b62('0x1a6')],{'as':_0x0b62('0x1a6'),'foreignKey':'VariableId'});db[_0x0b62('0xb3')]['hasMany'](db[_0x0b62('0xb4')],{'as':'Configurations','onDelete':_0x0b62('0xf8'),'foreignKey':_0x0b62('0x1aa')});db[_0x0b62('0xb4')][_0x0b62('0xfb')](db[_0x0b62('0xb6')],{'as':'Subjects','foreignKey':_0x0b62('0x1a3')});db['ZendeskConfiguration']['hasMany'](db[_0x0b62('0xb6')],{'as':'Descriptions','foreignKey':_0x0b62('0x1a0')});db[_0x0b62('0xb4')][_0x0b62('0xfb')](db[_0x0b62('0xb6')],{'as':_0x0b62('0x199'),'foreignKey':_0x0b62('0x1a1')});db[_0x0b62('0xb4')][_0x0b62('0x108')](db[_0x0b62('0xb3')],{'as':'Account','foreignKey':_0x0b62('0x1aa')});db['ZendeskConfiguration'][_0x0b62('0x10c')](db[_0x0b62('0x93')],{'through':_0x0b62('0x1ae')});db['ZendeskField'][_0x0b62('0xfb')](db[_0x0b62('0xb6')],{'as':_0x0b62('0x1a2'),'foreignKey':_0x0b62('0x1a3')});db[_0x0b62('0xb6')][_0x0b62('0xfb')](db[_0x0b62('0xb6')],{'as':_0x0b62('0x1a4'),'foreignKey':_0x0b62('0x1a0')});db[_0x0b62('0xb6')][_0x0b62('0xfb')](db[_0x0b62('0xb6')],{'as':_0x0b62('0x1a5'),'foreignKey':_0x0b62('0x1a1')});db[_0x0b62('0xb6')][_0x0b62('0x108')](db[_0x0b62('0x1a6')],{'as':'Variable','foreignKey':_0x0b62('0x1a7')});db[_0x0b62('0x1af')]['hasMany'](db['FreshdeskConfiguration'],{'as':_0x0b62('0x19e'),'onDelete':_0x0b62('0xf8'),'foreignKey':_0x0b62('0x1aa')});db['FreshdeskConfiguration']['hasMany'](db['FreshdeskField'],{'as':_0x0b62('0x1ab'),'onDelete':_0x0b62('0xf8'),'foreignKey':_0x0b62('0x1a3')});db[_0x0b62('0xb9')]['hasMany'](db[_0x0b62('0xbb')],{'as':_0x0b62('0x19f'),'onDelete':_0x0b62('0xf8'),'foreignKey':'DescriptionId'});db[_0x0b62('0xb9')]['hasMany'](db[_0x0b62('0xbb')],{'as':_0x0b62('0x199'),'onDelete':_0x0b62('0xf8'),'foreignKey':_0x0b62('0x1a1')});db[_0x0b62('0xb9')]['belongsTo'](db[_0x0b62('0x1af')],{'as':'Account','foreignKey':_0x0b62('0x1aa')});db['FreshdeskConfiguration']['belongsToMany'](db[_0x0b62('0x93')],{'through':'int_freshdesk_configuration_has_tags'});db['FreshdeskField']['hasMany'](db[_0x0b62('0xbb')],{'as':'Subject','foreignKey':_0x0b62('0x1a3')});db[_0x0b62('0xbb')][_0x0b62('0xfb')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0b62('0xbb')]['hasMany'](db['FreshdeskField'],{'as':_0x0b62('0x1a5'),'foreignKey':_0x0b62('0x1a1')});db['FreshdeskField'][_0x0b62('0x108')](db[_0x0b62('0x1a6')],{'as':_0x0b62('0x1a6'),'foreignKey':_0x0b62('0x1a7')});db['VtigerAccount'][_0x0b62('0xfb')](db['VtigerConfiguration'],{'as':_0x0b62('0x19e'),'onDelete':_0x0b62('0xf8'),'foreignKey':_0x0b62('0x1aa')});db['VtigerConfiguration'][_0x0b62('0xfb')](db[_0x0b62('0x1b0')],{'as':_0x0b62('0x1ab'),'foreignKey':_0x0b62('0x1a3')});db[_0x0b62('0xbe')][_0x0b62('0xfb')](db[_0x0b62('0x1b0')],{'as':_0x0b62('0x19f'),'foreignKey':'DescriptionId'});db[_0x0b62('0xbe')][_0x0b62('0xfb')](db[_0x0b62('0x1b0')],{'as':_0x0b62('0x199'),'foreignKey':_0x0b62('0x1a1')});db[_0x0b62('0xbe')]['belongsTo'](db['VtigerAccount'],{'as':_0x0b62('0x155'),'foreignKey':_0x0b62('0x1aa')});db[_0x0b62('0xbe')][_0x0b62('0x10c')](db['Tag'],{'through':_0x0b62('0x1b1')});db[_0x0b62('0x1b0')]['hasMany'](db[_0x0b62('0x1b0')],{'as':_0x0b62('0x1a2'),'foreignKey':'SubjectId'});db[_0x0b62('0x1b0')][_0x0b62('0xfb')](db['VtigerField'],{'as':_0x0b62('0x1a4'),'foreignKey':'DescriptionId'});db[_0x0b62('0x1b0')][_0x0b62('0xfb')](db[_0x0b62('0x1b0')],{'as':_0x0b62('0x1a5'),'foreignKey':'FieldId'});db['VtigerField']['belongsTo'](db[_0x0b62('0x1a6')],{'as':'Variable','foreignKey':_0x0b62('0x1a7')});db['ServicenowAccount']['hasMany'](db['ServicenowConfiguration'],{'as':_0x0b62('0x19e'),'onDelete':_0x0b62('0xf8'),'foreignKey':'AccountId'});db[_0x0b62('0xc3')][_0x0b62('0xfb')](db['ServicenowField'],{'as':_0x0b62('0x1ab'),'foreignKey':_0x0b62('0x1a3')});db[_0x0b62('0xc3')][_0x0b62('0xfb')](db[_0x0b62('0xc5')],{'as':_0x0b62('0x19f'),'foreignKey':'DescriptionId'});db[_0x0b62('0xc3')][_0x0b62('0xfb')](db[_0x0b62('0xc5')],{'as':_0x0b62('0x199'),'foreignKey':_0x0b62('0x1a1')});db[_0x0b62('0xc3')][_0x0b62('0x108')](db[_0x0b62('0xc1')],{'as':'Account','foreignKey':'AccountId'});db['ServicenowField'][_0x0b62('0xfb')](db[_0x0b62('0xc5')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0b62('0xc5')][_0x0b62('0xfb')](db[_0x0b62('0xc5')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0b62('0xc5')][_0x0b62('0xfb')](db[_0x0b62('0xc5')],{'as':_0x0b62('0x1a5'),'foreignKey':'FieldId'});db[_0x0b62('0xc5')][_0x0b62('0x108')](db[_0x0b62('0x1a6')],{'as':_0x0b62('0x1a6'),'foreignKey':_0x0b62('0x1a7')});db['Dynamics365Account'][_0x0b62('0xfb')](db['Dynamics365Configuration'],{'as':_0x0b62('0x19e'),'onDelete':_0x0b62('0xf8'),'foreignKey':_0x0b62('0x1aa')});db['Dynamics365Configuration'][_0x0b62('0xfb')](db[_0x0b62('0xca')],{'as':_0x0b62('0x1ab'),'onDelete':'cascade','foreignKey':_0x0b62('0x1a3')});db[_0x0b62('0xc8')][_0x0b62('0xfb')](db[_0x0b62('0xca')],{'as':_0x0b62('0x19f'),'onDelete':_0x0b62('0xf8'),'foreignKey':_0x0b62('0x1a0')});db[_0x0b62('0xc8')]['hasMany'](db[_0x0b62('0xca')],{'as':_0x0b62('0x199'),'onDelete':_0x0b62('0xf8'),'foreignKey':_0x0b62('0x1a1')});db['Dynamics365Configuration']['belongsTo'](db[_0x0b62('0x1b2')],{'as':_0x0b62('0x155'),'foreignKey':_0x0b62('0x1aa')});db[_0x0b62('0xca')][_0x0b62('0xfb')](db[_0x0b62('0xca')],{'as':_0x0b62('0x1a2'),'foreignKey':_0x0b62('0x1a3')});db[_0x0b62('0xca')][_0x0b62('0xfb')](db['Dynamics365Field'],{'as':_0x0b62('0x1a4'),'foreignKey':_0x0b62('0x1a0')});db[_0x0b62('0xca')][_0x0b62('0xfb')](db['Dynamics365Field'],{'as':'Field','foreignKey':_0x0b62('0x1a1')});db[_0x0b62('0xca')][_0x0b62('0x108')](db['Variable'],{'as':'Variable','foreignKey':_0x0b62('0x1a7')});db[_0x0b62('0xce')][_0x0b62('0x108')](db[_0x0b62('0x66')],{});db[_0x0b62('0xce')]['belongsTo'](db[_0x0b62('0xf0')],{'as':_0x0b62('0x14f'),'foreignKey':_0x0b62('0x150')});db['ChatQueueReport'][_0x0b62('0x108')](db['CmContact'],{'as':_0x0b62('0x147'),'foreignKey':_0x0b62('0x148')});db[_0x0b62('0xce')]['belongsTo'](db[_0x0b62('0x103')],{});db['ChatQueueReport'][_0x0b62('0x108')](db[_0x0b62('0x6c')],{});db[_0x0b62('0xce')]['belongsTo'](db[_0x0b62('0xfa')],{});db[_0x0b62('0xce')][_0x0b62('0x108')](db[_0x0b62('0x178')],{});db[_0x0b62('0xd0')][_0x0b62('0x108')](db[_0x0b62('0xfa')],{'onDelete':_0x0b62('0xf8'),'foreignKey':'FromId'});db[_0x0b62('0xd0')][_0x0b62('0x108')](db[_0x0b62('0xfa')],{'onDelete':_0x0b62('0xf8'),'foreignKey':'ToId'});db[_0x0b62('0x136')][_0x0b62('0xfb')](db[_0x0b62('0x1b3')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0b62('0x136')][_0x0b62('0xfb')](db[_0x0b62('0xd2')],{'foreignKey':_0x0b62('0x1b4'),'onDelete':_0x0b62('0xf8')});db['SmsQueueReport'][_0x0b62('0x108')](db[_0x0b62('0x54')],{});db[_0x0b62('0xd5')][_0x0b62('0x108')](db[_0x0b62('0xf0')],{'as':_0x0b62('0x14f'),'foreignKey':_0x0b62('0x150')});db['SmsQueueReport'][_0x0b62('0x108')](db[_0x0b62('0x146')],{'as':_0x0b62('0x147'),'foreignKey':_0x0b62('0x148')});db[_0x0b62('0xd5')][_0x0b62('0x108')](db['SmsInteraction'],{});db['SmsQueueReport'][_0x0b62('0x108')](db[_0x0b62('0x5a')],{});db[_0x0b62('0xd5')][_0x0b62('0x108')](db[_0x0b62('0xfa')],{});db[_0x0b62('0xd5')][_0x0b62('0x108')](db[_0x0b62('0x5c')],{});db['JscriptyProject'][_0x0b62('0xfb')](db[_0x0b62('0x136')],{'foreignKey':_0x0b62('0x1b5')});db[_0x0b62('0xdb')][_0x0b62('0xfb')](db['JscriptyQuestionReport'],{'foreignKey':_0x0b62('0x1b5')});db[_0x0b62('0xdb')][_0x0b62('0xfb')](db[_0x0b62('0xd2')],{'foreignKey':_0x0b62('0x1b5')});db[_0x0b62('0x128')][_0x0b62('0x10c')](db['User'],{'as':_0x0b62('0x169'),'through':_0x0b62('0x12a')});db[_0x0b62('0xe4')][_0x0b62('0x10c')](db['User'],{'as':_0x0b62('0x153'),'through':_0x0b62('0x111')});db['Team'][_0x0b62('0x10c')](db[_0x0b62('0x1b')],{'through':'team_has_voice_queues','as':'VoiceQueues'});db[_0x0b62('0xe4')][_0x0b62('0x10c')](db[_0x0b62('0x3b')],{'through':_0x0b62('0x154'),'as':'MailQueues'});db['Team'][_0x0b62('0x10c')](db['ChatQueue'],{'through':'team_has_chat_queues','as':_0x0b62('0x118')});db[_0x0b62('0xe4')]['belongsToMany'](db[_0x0b62('0x119')],{'through':'team_has_fax_queues','as':_0x0b62('0x11a')});db[_0x0b62('0xe4')]['belongsToMany'](db[_0x0b62('0x5c')],{'through':_0x0b62('0x16c'),'as':_0x0b62('0x11b')});db[_0x0b62('0xe4')][_0x0b62('0x10c')](db[_0x0b62('0x11c')],{'through':_0x0b62('0x172'),'as':_0x0b62('0x11d')});db[_0x0b62('0x183')][_0x0b62('0xfb')](db[_0x0b62('0x76')],{'as':_0x0b62('0x133'),'foreignKey':_0x0b62('0x184')});db['Campaign'][_0x0b62('0xfb')](db[_0x0b62('0x7a')],{'as':_0x0b62('0x100'),'foreignKey':_0x0b62('0x184')});db[_0x0b62('0x183')]['hasMany'](db['CmHopperHistory'],{'as':_0x0b62('0x134'),'foreignKey':'CampaignId'});db[_0x0b62('0x183')][_0x0b62('0xfb')](db[_0x0b62('0x78')],{'as':_0x0b62('0x135'),'foreignKey':_0x0b62('0x184')});db[_0x0b62('0x183')][_0x0b62('0x108')](db[_0x0b62('0x2a')],{'as':_0x0b62('0x2a'),'foreignKey':_0x0b62('0x1b6')});db[_0x0b62('0x183')]['belongsTo'](db[_0x0b62('0x2a')],{'as':_0x0b62('0x1b7'),'foreignKey':_0x0b62('0x1b8')});db['Campaign']['belongsTo'](db[_0x0b62('0x89')],{'as':_0x0b62('0x89'),'foreignKey':_0x0b62('0x138')});db[_0x0b62('0x183')]['belongsTo'](db[_0x0b62('0x128')],{'as':_0x0b62('0x128'),'foreignKey':_0x0b62('0x1b9')});db[_0x0b62('0x183')][_0x0b62('0x10c')](db['CmList'],{'as':_0x0b62('0x10f'),'through':_0x0b62('0x1ba')});db['Campaign']['belongsToMany'](db[_0x0b62('0xf0')],{'as':_0x0b62('0x13e'),'through':'campaigns_has_cm_blacklists'});db[_0x0b62('0x1bb')]['belongsTo'](db[_0x0b62('0x41')],{});db['MailTransferReport'][_0x0b62('0x108')](db[_0x0b62('0x3f')],{});db[_0x0b62('0x1bb')][_0x0b62('0x108')](db[_0x0b62('0x3a')],{'foreignKey':_0x0b62('0x1bc'),'as':_0x0b62('0x1bd')});db[_0x0b62('0x1bb')]['belongsTo'](db['User'],{'foreignKey':_0x0b62('0x1be'),'as':_0x0b62('0x1bf')});db[_0x0b62('0x1bb')][_0x0b62('0x108')](db[_0x0b62('0xfa')],{'foreignKey':_0x0b62('0x1c0'),'as':_0x0b62('0x1c1')});db[_0x0b62('0x1bb')][_0x0b62('0x108')](db['MailQueue'],{'foreignKey':_0x0b62('0x1c2'),'as':'ToQueue'});db['MailTransferReport'][_0x0b62('0x108')](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':_0x0b62('0x1c3')});db[_0x0b62('0x1c4')]['belongsTo'](db[_0x0b62('0x6c')],{});db[_0x0b62('0x1c4')][_0x0b62('0x108')](db[_0x0b62('0x103')],{});db[_0x0b62('0x1c4')][_0x0b62('0x108')](db[_0x0b62('0x66')],{'foreignKey':_0x0b62('0x1c5'),'as':_0x0b62('0x1bd')});db[_0x0b62('0x1c4')][_0x0b62('0x108')](db['User'],{'foreignKey':'FromUserId','as':_0x0b62('0x1bf')});db[_0x0b62('0x1c4')]['belongsTo'](db[_0x0b62('0xfa')],{'foreignKey':_0x0b62('0x1c0'),'as':_0x0b62('0x1c1')});db[_0x0b62('0x1c4')][_0x0b62('0x108')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db[_0x0b62('0x1c4')]['belongsTo'](db[_0x0b62('0x66')],{'foreignKey':_0x0b62('0x1c6'),'as':_0x0b62('0x1c3')});db[_0x0b62('0xec')][_0x0b62('0x108')](db['FaxMessage'],{});db['FaxTransferReport'][_0x0b62('0x108')](db[_0x0b62('0x4f')],{});db[_0x0b62('0xec')][_0x0b62('0x108')](db[_0x0b62('0x4b')],{'foreignKey':'FromFaxAccountId','as':_0x0b62('0x1bd')});db[_0x0b62('0xec')][_0x0b62('0x108')](db[_0x0b62('0xfa')],{'foreignKey':'FromUserId','as':_0x0b62('0x1bf')});db[_0x0b62('0xec')][_0x0b62('0x108')](db[_0x0b62('0xfa')],{'foreignKey':'ToUserId','as':_0x0b62('0x1c1')});db[_0x0b62('0xec')][_0x0b62('0x108')](db[_0x0b62('0x119')],{'foreignKey':_0x0b62('0x1c7'),'as':_0x0b62('0x1c8')});db[_0x0b62('0xec')][_0x0b62('0x108')](db['FaxAccount'],{'foreignKey':_0x0b62('0x1c9'),'as':_0x0b62('0x1c3')});db[_0x0b62('0xed')][_0x0b62('0x108')](db['OpenchannelMessage'],{});db[_0x0b62('0xed')][_0x0b62('0x108')](db['OpenchannelInteraction'],{});db[_0x0b62('0xed')][_0x0b62('0x108')](db[_0x0b62('0x124')],{'foreignKey':_0x0b62('0x1ca'),'as':_0x0b62('0x1bd')});db[_0x0b62('0xed')][_0x0b62('0x108')](db[_0x0b62('0xfa')],{'foreignKey':_0x0b62('0x1be'),'as':_0x0b62('0x1bf')});db[_0x0b62('0xed')][_0x0b62('0x108')](db['User'],{'foreignKey':_0x0b62('0x1c0'),'as':_0x0b62('0x1c1')});db['OpenchannelTransferReport'][_0x0b62('0x108')](db[_0x0b62('0x11c')],{'foreignKey':_0x0b62('0x1cb'),'as':'ToQueue'});db[_0x0b62('0xed')]['belongsTo'](db[_0x0b62('0x124')],{'foreignKey':_0x0b62('0x1cc'),'as':_0x0b62('0x1c3')});db[_0x0b62('0xef')][_0x0b62('0x108')](db[_0x0b62('0x5a')],{});db[_0x0b62('0xef')][_0x0b62('0x108')](db[_0x0b62('0x58')],{});db[_0x0b62('0xef')][_0x0b62('0x108')](db['SmsAccount'],{'foreignKey':_0x0b62('0x1cd'),'as':_0x0b62('0x1bd')});db[_0x0b62('0xef')][_0x0b62('0x108')](db[_0x0b62('0xfa')],{'foreignKey':_0x0b62('0x1be'),'as':_0x0b62('0x1bf')});db[_0x0b62('0xef')][_0x0b62('0x108')](db[_0x0b62('0xfa')],{'foreignKey':_0x0b62('0x1c0'),'as':_0x0b62('0x1c1')});db[_0x0b62('0xef')][_0x0b62('0x108')](db['SmsQueue'],{'foreignKey':_0x0b62('0x1ce'),'as':_0x0b62('0x1c8')});db[_0x0b62('0xef')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0x0b62('0x1cf'),'as':_0x0b62('0x1c3')});db[_0x0b62('0xf0')][_0x0b62('0xfb')](db[_0x0b62('0x86')],{'as':_0x0b62('0x14b'),'foreignKey':'ListId'});db[_0x0b62('0xf0')][_0x0b62('0xfb')](db[_0x0b62('0x80')],{'as':'CustomFields','foreignKey':'ListId'});db['CmList'][_0x0b62('0xfb')](db[_0x0b62('0x146')],{'as':'Contacts','onDelete':_0x0b62('0xf8'),'foreignKey':_0x0b62('0x150')});db[_0x0b62('0xf0')]['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x0b62('0x150')});db[_0x0b62('0xf0')][_0x0b62('0xfb')](db[_0x0b62('0x7c')],{'as':_0x0b62('0x101'),'foreignKey':'ListId'});db[_0x0b62('0xf0')][_0x0b62('0xfb')](db[_0x0b62('0x7e')],{'as':_0x0b62('0x7e'),'foreignKey':'ListId'});db['CmList'][_0x0b62('0x10c')](db[_0x0b62('0x1b')],{'as':_0x0b62('0x1d0'),'through':'voice_queues_has_cm_lists'});db[_0x0b62('0xf0')][_0x0b62('0x10c')](db[_0x0b62('0xfa')],{'as':_0x0b62('0x153'),'through':_0x0b62('0x110')});db[_0x0b62('0xf2')]['hasMany'](db['VoiceExtension'],{'as':'Extensions','onDelete':'restrict'});db[_0x0b62('0xf2')][_0x0b62('0x10c')](db[_0x0b62('0xfa')],{'as':_0x0b62('0x153'),'through':_0x0b62('0x11e')});db[_0x0b62('0x109')][_0x0b62('0xfb')](db[_0x0b62('0xfa')],{'as':_0x0b62('0x169'),'foreignKey':_0x0b62('0x10a')});db[_0x0b62('0x109')]['hasMany'](db[_0x0b62('0xf3')],{'as':_0x0b62('0x1d1'),'foreignKey':_0x0b62('0x10a'),'onDelete':_0x0b62('0xf8')});db[_0x0b62('0xf3')]['hasMany'](db['UserProfileResource'],{'as':_0x0b62('0x1d2'),'foreignKey':_0x0b62('0x1d3'),'onDelete':_0x0b62('0xf8')});module['exports']={'db':db,'dbH':dbH};
\ No newline at end of file
index 0994405..bf39e8a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x26d0=['/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/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/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/teams','./api/license','/api/campaigns','/api/migrations','./api/migration','/api/attachments','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/auth/local','./api/authLocal','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/apidoc','static','join','/www','root','/demo','/snippet','snippet','1.0.11','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','/index.html','path','express','api','./config/logger','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','x-forwarded-for','headers','connection','remoteAddress','url','statusCode','responseTime','user','name','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','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)','format','other','agent_name','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/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/mailQueueReport','/api/dashboards','./api/dashboard','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatMessage','/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/cm/contacts','./api/cmContact','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/actions','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/fields'];(function(_0x42f41b,_0x67e11f){var _0x4a4e89=function(_0xe261fa){while(--_0xe261fa){_0x42f41b['push'](_0x42f41b['shift']());}};_0x4a4e89(++_0x67e11f);}(_0x26d0,0x67));var _0x026d=function(_0x1cf68e,_0x2cc3f2){_0x1cf68e=_0x1cf68e-0x0;var _0x3d5f21=_0x26d0[_0x1cf68e];return _0x3d5f21;};'use strict';var path=require(_0x026d('0x0'));var express=require(_0x026d('0x1'));var ewinston=require('express-winston');var util=require('util');var errors=require('./errors');var config=require('./config/environment');var logger=require('./config/logger')(_0x026d('0x2'));var authLogger=require(_0x026d('0x3'))(_0x026d('0x4'));exports[_0x026d('0x5')]=function(_0x5957ac){_0x5957ac[_0x026d('0x6')](ewinston[_0x026d('0x7')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x5906d0,_0x381a3b){return util['format'](_0x026d('0x8'),_0x5906d0[_0x026d('0x9')],_0x5906d0['headers'][_0x026d('0xa')]?_0x5906d0[_0x026d('0xb')]['x-forwarded-for']:_0x5906d0[_0x026d('0xc')][_0x026d('0xd')]||_0x5906d0['ip'],_0x5906d0[_0x026d('0xe')],_0x381a3b[_0x026d('0xf')],_0x381a3b[_0x026d('0x10')],_0x5906d0[_0x026d('0x11')]?_0x5906d0['user']['id']:null,_0x5906d0[_0x026d('0x11')]?_0x5906d0[_0x026d('0x11')][_0x026d('0x12')]:null,_0x5906d0[_0x026d('0x11')]?_0x5906d0[_0x026d('0x11')][_0x026d('0x13')]:null);}}));_0x5957ac['use'](ewinston[_0x026d('0x7')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x4a4989,_0x27c374){var _0xe9cf33=_0x026d('0x14');if(_0x4a4989[_0x026d('0x15')]&&_0x4a4989['body'][_0x026d('0x16')]&&_0x4a4989[_0x026d('0x15')][_0x026d('0x17')]){_0xe9cf33=_0x026d('0x18');}return util[_0x026d('0x19')](_0xe9cf33,_0x4a4989[_0x026d('0x9')],_0x4a4989['headers'][_0x026d('0xa')]?_0x4a4989['headers'][_0x026d('0xa')]:_0x4a4989[_0x026d('0xc')][_0x026d('0xd')]||_0x4a4989['ip'],_0x4a4989['url'],_0x27c374[_0x026d('0xf')],_0x27c374['responseTime'],_0x4a4989[_0x026d('0x11')]?_0x4a4989[_0x026d('0x11')]['id']:null,_0x4a4989[_0x026d('0x11')]?_0x4a4989['user'][_0x026d('0x12')]:null,_0x4a4989[_0x026d('0x11')]?_0x4a4989[_0x026d('0x11')][_0x026d('0x13')]:null,_0x4a4989['body']&&_0x4a4989[_0x026d('0x15')][_0x026d('0x16')]?_0x4a4989[_0x026d('0x15')][_0x026d('0x16')]:_0x026d('0x1a'),_0x4a4989[_0x026d('0x15')]&&_0x4a4989[_0x026d('0x15')][_0x026d('0x17')]?_0x4a4989[_0x026d('0x15')]['agent_id']:'',_0x4a4989[_0x026d('0x15')]&&_0x4a4989[_0x026d('0x15')][_0x026d('0x1b')]?_0x4a4989[_0x026d('0x15')]['agent_name']:'');},'ignoreRoute':function(_0x31aea4){var _0x4dff0a=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4dff0a['test'](_0x31aea4['url']);}}));_0x5957ac[_0x026d('0x6')](_0x026d('0x1c'),require(_0x026d('0x1d')));_0x5957ac[_0x026d('0x6')](_0x026d('0x1e'),require(_0x026d('0x1f')));_0x5957ac[_0x026d('0x6')](_0x026d('0x20'),require(_0x026d('0x21')));_0x5957ac[_0x026d('0x6')]('/api/voice/extensions',require(_0x026d('0x22')));_0x5957ac[_0x026d('0x6')](_0x026d('0x23'),require(_0x026d('0x24')));_0x5957ac[_0x026d('0x6')](_0x026d('0x25'),require('./api/voiceQueue'));_0x5957ac['use'](_0x026d('0x26'),require(_0x026d('0x27')));_0x5957ac['use']('/api/voice/mails',require('./api/voiceMail'));_0x5957ac[_0x026d('0x6')](_0x026d('0x28'),require(_0x026d('0x29')));_0x5957ac[_0x026d('0x6')](_0x026d('0x2a'),require('./api/voiceCallReport'));_0x5957ac[_0x026d('0x6')](_0x026d('0x2b'),require(_0x026d('0x2c')));_0x5957ac['use'](_0x026d('0x2d'),require('./api/voiceAgentReport'));_0x5957ac[_0x026d('0x6')](_0x026d('0x2e'),require('./api/voiceQueueReport'));_0x5957ac[_0x026d('0x6')](_0x026d('0x2f'),require(_0x026d('0x30')));_0x5957ac[_0x026d('0x6')](_0x026d('0x31'),require(_0x026d('0x32')));_0x5957ac[_0x026d('0x6')](_0x026d('0x33'),require(_0x026d('0x34')));_0x5957ac['use'](_0x026d('0x35'),require(_0x026d('0x36')));_0x5957ac[_0x026d('0x6')](_0x026d('0x37'),require('./api/mailAccount'));_0x5957ac[_0x026d('0x6')](_0x026d('0x38'),require(_0x026d('0x39')));_0x5957ac['use'](_0x026d('0x3a'),require(_0x026d('0x3b')));_0x5957ac[_0x026d('0x6')](_0x026d('0x3c'),require(_0x026d('0x3d')));_0x5957ac[_0x026d('0x6')](_0x026d('0x3e'),require(_0x026d('0x3f')));_0x5957ac['use'](_0x026d('0x40'),require(_0x026d('0x41')));_0x5957ac[_0x026d('0x6')](_0x026d('0x42'),require(_0x026d('0x43')));_0x5957ac[_0x026d('0x6')](_0x026d('0x44'),require(_0x026d('0x45')));_0x5957ac[_0x026d('0x6')]('/api/dashboards/items',require('./api/dashboardItem'));_0x5957ac[_0x026d('0x6')]('/api/fax/accounts',require('./api/faxAccount'));_0x5957ac['use']('/api/fax/applications',require('./api/faxApplication'));_0x5957ac[_0x026d('0x6')]('/api/fax/interactions',require('./api/faxInteraction'));_0x5957ac[_0x026d('0x6')]('/api/fax/messages',require(_0x026d('0x46')));_0x5957ac[_0x026d('0x6')](_0x026d('0x47'),require(_0x026d('0x48')));_0x5957ac[_0x026d('0x6')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x5957ac[_0x026d('0x6')]('/api/sms/accounts',require(_0x026d('0x49')));_0x5957ac[_0x026d('0x6')](_0x026d('0x4a'),require(_0x026d('0x4b')));_0x5957ac['use']('/api/sms/interactions',require(_0x026d('0x4c')));_0x5957ac['use'](_0x026d('0x4d'),require(_0x026d('0x4e')));_0x5957ac['use']('/api/sms/queues',require(_0x026d('0x4f')));_0x5957ac[_0x026d('0x6')](_0x026d('0x50'),require(_0x026d('0x51')));_0x5957ac[_0x026d('0x6')](_0x026d('0x52'),require('./api/openchannelApplication'));_0x5957ac['use']('/api/openchannel/interactions',require(_0x026d('0x53')));_0x5957ac['use'](_0x026d('0x54'),require(_0x026d('0x55')));_0x5957ac[_0x026d('0x6')](_0x026d('0x56'),require('./api/openchannelQueue'));_0x5957ac[_0x026d('0x6')](_0x026d('0x57'),require('./api/chatWebsite'));_0x5957ac[_0x026d('0x6')]('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0x5957ac[_0x026d('0x6')](_0x026d('0x58'),require(_0x026d('0x59')));_0x5957ac['use'](_0x026d('0x5a'),require('./api/chatInteraction'));_0x5957ac[_0x026d('0x6')]('/api/chat/messages',require(_0x026d('0x5b')));_0x5957ac[_0x026d('0x6')](_0x026d('0x5c'),require(_0x026d('0x5d')));_0x5957ac[_0x026d('0x6')](_0x026d('0x5e'),require(_0x026d('0x5f')));_0x5957ac[_0x026d('0x6')](_0x026d('0x60'),require(_0x026d('0x61')));_0x5957ac[_0x026d('0x6')](_0x026d('0x62'),require(_0x026d('0x63')));_0x5957ac[_0x026d('0x6')](_0x026d('0x64'),require('./api/cmCompany'));_0x5957ac[_0x026d('0x6')](_0x026d('0x65'),require(_0x026d('0x66')));_0x5957ac[_0x026d('0x6')]('/api/cm/hopper',require('./api/cmHopper'));_0x5957ac[_0x026d('0x6')](_0x026d('0x67'),require(_0x026d('0x68')));_0x5957ac[_0x026d('0x6')]('/api/cm/hopper_final',require(_0x026d('0x69')));_0x5957ac['use'](_0x026d('0x6a'),require(_0x026d('0x6b')));_0x5957ac[_0x026d('0x6')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0x5957ac[_0x026d('0x6')](_0x026d('0x6c'),require('./api/action'));_0x5957ac['use'](_0x026d('0x6d'),require(_0x026d('0x6e')));_0x5957ac[_0x026d('0x6')]('/api/canned_answers',require(_0x026d('0x6f')));_0x5957ac[_0x026d('0x6')](_0x026d('0x70'),require(_0x026d('0x71')));_0x5957ac[_0x026d('0x6')]('/api/conditions',require(_0x026d('0x72')));_0x5957ac['use'](_0x026d('0x73'),require(_0x026d('0x74')));_0x5957ac[_0x026d('0x6')](_0x026d('0x75'),require(_0x026d('0x76')));_0x5957ac[_0x026d('0x6')]('/api/cdr',require('./api/cdr'));_0x5957ac[_0x026d('0x6')]('/api/voiceQueuesLog',require(_0x026d('0x77')));_0x5957ac[_0x026d('0x6')](_0x026d('0x78'),require(_0x026d('0x79')));_0x5957ac[_0x026d('0x6')](_0x026d('0x7a'),require(_0x026d('0x7b')));_0x5957ac[_0x026d('0x6')](_0x026d('0x7c'),require(_0x026d('0x7d')));_0x5957ac[_0x026d('0x6')](_0x026d('0x7e'),require(_0x026d('0x7f')));_0x5957ac['use'](_0x026d('0x80'),require(_0x026d('0x81')));_0x5957ac['use']('/api/variables',require(_0x026d('0x82')));_0x5957ac[_0x026d('0x6')](_0x026d('0x83'),require('./api/integration'));_0x5957ac[_0x026d('0x6')](_0x026d('0x84'),require(_0x026d('0x85')));_0x5957ac['use'](_0x026d('0x86'),require(_0x026d('0x87')));_0x5957ac['use'](_0x026d('0x88'),require('./api/analyticDefaultReport'));_0x5957ac[_0x026d('0x6')](_0x026d('0x89'),require(_0x026d('0x8a')));_0x5957ac[_0x026d('0x6')](_0x026d('0x8b'),require(_0x026d('0x8c')));_0x5957ac[_0x026d('0x6')](_0x026d('0x8d'),require(_0x026d('0x8e')));_0x5957ac['use'](_0x026d('0x8f'),require(_0x026d('0x90')));_0x5957ac[_0x026d('0x6')](_0x026d('0x91'),require(_0x026d('0x92')));_0x5957ac[_0x026d('0x6')](_0x026d('0x93'),require('./api/intSalesforceConfiguration'));_0x5957ac[_0x026d('0x6')](_0x026d('0x94'),require('./api/intSalesforceField'));_0x5957ac[_0x026d('0x6')](_0x026d('0x95'),require('./api/intSugarcrmAccount'));_0x5957ac['use']('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0x5957ac[_0x026d('0x6')](_0x026d('0x96'),require('./api/intSugarcrmField'));_0x5957ac[_0x026d('0x6')](_0x026d('0x97'),require(_0x026d('0x98')));_0x5957ac[_0x026d('0x6')]('/api/integrations/desk/configurations',require(_0x026d('0x99')));_0x5957ac[_0x026d('0x6')](_0x026d('0x9a'),require('./api/intDeskField'));_0x5957ac[_0x026d('0x6')](_0x026d('0x9b'),require(_0x026d('0x9c')));_0x5957ac[_0x026d('0x6')]('/api/integrations/zoho/configurations',require(_0x026d('0x9d')));_0x5957ac[_0x026d('0x6')](_0x026d('0x9e'),require(_0x026d('0x9f')));_0x5957ac[_0x026d('0x6')](_0x026d('0xa0'),require('./api/intZendeskAccount'));_0x5957ac[_0x026d('0x6')](_0x026d('0xa1'),require(_0x026d('0xa2')));_0x5957ac['use']('/api/integrations/zendesk/fields',require(_0x026d('0xa3')));_0x5957ac[_0x026d('0x6')](_0x026d('0xa4'),require('./api/intFreshdeskAccount'));_0x5957ac[_0x026d('0x6')](_0x026d('0xa5'),require(_0x026d('0xa6')));_0x5957ac['use'](_0x026d('0xa7'),require('./api/intFreshdeskField'));_0x5957ac[_0x026d('0x6')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x5957ac[_0x026d('0x6')](_0x026d('0xa8'),require(_0x026d('0xa9')));_0x5957ac[_0x026d('0x6')](_0x026d('0xaa'),require(_0x026d('0xab')));_0x5957ac[_0x026d('0x6')](_0x026d('0xac'),require(_0x026d('0xad')));_0x5957ac[_0x026d('0x6')](_0x026d('0xae'),require(_0x026d('0xaf')));_0x5957ac[_0x026d('0x6')]('/api/integrations/servicenow/fields',require(_0x026d('0xb0')));_0x5957ac[_0x026d('0x6')](_0x026d('0xb1'),require('./api/intDynamics365Account'));_0x5957ac[_0x026d('0x6')](_0x026d('0xb2'),require(_0x026d('0xb3')));_0x5957ac[_0x026d('0x6')]('/api/integrations/dynamics365/fields',require(_0x026d('0xb4')));_0x5957ac['use']('/api/networks',require(_0x026d('0xb5')));_0x5957ac['use'](_0x026d('0xb6'),require(_0x026d('0xb7')));_0x5957ac[_0x026d('0x6')](_0x026d('0xb8'),require(_0x026d('0xb9')));_0x5957ac['use'](_0x026d('0xba'),require('./api/jscriptyAnswerReport'));_0x5957ac[_0x026d('0x6')](_0x026d('0xbb'),require('./api/jscriptyQuestionReport'));_0x5957ac[_0x026d('0x6')]('/api/jscripty/sessions/reports',require(_0x026d('0xbc')));_0x5957ac['use'](_0x026d('0xbd'),require('./api/smsQueueReport'));_0x5957ac[_0x026d('0x6')](_0x026d('0xbe'),require(_0x026d('0xbf')));_0x5957ac[_0x026d('0x6')](_0x026d('0xc0'),require(_0x026d('0xc1')));_0x5957ac[_0x026d('0x6')](_0x026d('0xc2'),require(_0x026d('0xc3')));_0x5957ac['use'](_0x026d('0xc4'),require(_0x026d('0xc5')));_0x5957ac['use']('/api/square/odbc',require(_0x026d('0xc6')));_0x5957ac[_0x026d('0x6')](_0x026d('0xc7'),require(_0x026d('0xc8')));_0x5957ac[_0x026d('0x6')](_0x026d('0xc9'),require('./api/squareRecording'));_0x5957ac[_0x026d('0x6')]('/api/square/messages',require('./api/squareMessage'));_0x5957ac[_0x026d('0x6')](_0x026d('0xca'),require('./api/team'));_0x5957ac['use']('/api/license',require(_0x026d('0xcb')));_0x5957ac['use'](_0x026d('0xcc'),require('./api/campaign'));_0x5957ac['use'](_0x026d('0xcd'),require(_0x026d('0xce')));_0x5957ac[_0x026d('0x6')](_0x026d('0xcf'),require('./api/attachment'));_0x5957ac[_0x026d('0x6')](_0x026d('0xd0'),require(_0x026d('0xd1')));_0x5957ac[_0x026d('0x6')]('/api/mail/reports/transfer',require(_0x026d('0xd2')));_0x5957ac[_0x026d('0x6')](_0x026d('0xd3'),require(_0x026d('0xd4')));_0x5957ac[_0x026d('0x6')](_0x026d('0xd5'),require(_0x026d('0xd6')));_0x5957ac[_0x026d('0x6')](_0x026d('0xd7'),require(_0x026d('0xd8')));_0x5957ac[_0x026d('0x6')](_0x026d('0xd9'),require(_0x026d('0xda')));_0x5957ac[_0x026d('0x6')](_0x026d('0xdb'),require('./api/cmList'));_0x5957ac['use'](_0x026d('0xdc'),require(_0x026d('0xdd')));_0x5957ac[_0x026d('0x6')](_0x026d('0xde'),require(_0x026d('0xdf')));_0x5957ac[_0x026d('0x6')](_0x026d('0xe0'),require(_0x026d('0xe1')));_0x5957ac[_0x026d('0x6')]('/api/userProfile/resources',require(_0x026d('0xe2')));_0x5957ac[_0x026d('0x6')](_0x026d('0xe3'),require(_0x026d('0xe4')));_0x5957ac[_0x026d('0x6')]('/api/auth/google',require('./api/authGoogle'));_0x5957ac[_0x026d('0x6')](_0x026d('0xe5'),require(_0x026d('0xe6')));_0x5957ac[_0x026d('0x6')](_0x026d('0xe7'),require(_0x026d('0xe8')));_0x5957ac[_0x026d('0x6')](_0x026d('0xe9'),require(_0x026d('0xea')));_0x5957ac['use'](_0x026d('0xeb'),require(_0x026d('0xec')));_0x5957ac['use'](_0x026d('0xed'),require(_0x026d('0xee')));_0x5957ac['use'](_0x026d('0xef'),express[_0x026d('0xf0')](path[_0x026d('0xf1')](config['root'],'/apidoc')));_0x5957ac[_0x026d('0x6')](_0x026d('0xf2'),express[_0x026d('0xf0')](path[_0x026d('0xf1')](config[_0x026d('0xf3')],_0x026d('0xf2'))));_0x5957ac[_0x026d('0x6')](_0x026d('0xf4'),express[_0x026d('0xf0')](path[_0x026d('0xf1')](config[_0x026d('0xf3')],_0x026d('0xf4'))));_0x5957ac[_0x026d('0x6')](_0x026d('0xf5'),express[_0x026d('0xf0')](path[_0x026d('0xf1')](config[_0x026d('0xf3')],_0x026d('0xf6'),_0x026d('0xf7'))));_0x5957ac[_0x026d('0x6')]('/plugins',express['static'](path[_0x026d('0xf1')](config[_0x026d('0xf3')],'/server/files/plugins')));_0x5957ac[_0x026d('0xf8')](_0x026d('0xf9'))[_0x026d('0xfa')](errors[0x194]);_0x5957ac[_0x026d('0xf8')]('/*')[_0x026d('0xfa')](function(_0x436445,_0x431e27){_0x431e27[_0x026d('0xfb')](path[_0x026d('0xfc')](_0x5957ac[_0x026d('0xfa')]('appPath')+_0x026d('0xfd')));});};
\ No newline at end of file
+var _0x1472=['./api/voiceQueue','/api/voice/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/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/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','./api/tag','/api/templates','./api/template','/api/triggers','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZendeskAccount','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/chat/reports/queue','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/squareOdbc','/api/square/projects','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/auth/local','./api/authGoogle','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/pm2','/apidoc','static','join','/www','root','/demo','/snippet','snippet','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','route','get','sendFile','appPath','/index.html','path','express','express-winston','./errors','./config/environment','./config/logger','api','auth','default','use','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','/api/voice/mohs'];(function(_0x4fae19,_0x4f2d47){var _0x8d8e92=function(_0x2522e0){while(--_0x2522e0){_0x4fae19['push'](_0x4fae19['shift']());}};_0x8d8e92(++_0x4f2d47);}(_0x1472,0x1e1));var _0x2147=function(_0x419560,_0x16a92c){_0x419560=_0x419560-0x0;var _0x52a0a9=_0x1472[_0x419560];return _0x52a0a9;};'use strict';var path=require(_0x2147('0x0'));var express=require(_0x2147('0x1'));var ewinston=require(_0x2147('0x2'));var util=require('util');var errors=require(_0x2147('0x3'));var config=require(_0x2147('0x4'));var logger=require(_0x2147('0x5'))(_0x2147('0x6'));var authLogger=require(_0x2147('0x5'))(_0x2147('0x7'));exports[_0x2147('0x8')]=function(_0x460aa0){_0x460aa0[_0x2147('0x9')](ewinston[_0x2147('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x43aec1,_0x2edffa){return util[_0x2147('0xb')](_0x2147('0xc'),_0x43aec1[_0x2147('0xd')],_0x43aec1[_0x2147('0xe')][_0x2147('0xf')]?_0x43aec1[_0x2147('0xe')][_0x2147('0xf')]:_0x43aec1[_0x2147('0x10')][_0x2147('0x11')]||_0x43aec1['ip'],_0x43aec1[_0x2147('0x12')],_0x2edffa[_0x2147('0x13')],_0x2edffa[_0x2147('0x14')],_0x43aec1['user']?_0x43aec1[_0x2147('0x15')]['id']:null,_0x43aec1['user']?_0x43aec1[_0x2147('0x15')][_0x2147('0x16')]:null,_0x43aec1['user']?_0x43aec1['user'][_0x2147('0x17')]:null);}}));_0x460aa0[_0x2147('0x9')](ewinston[_0x2147('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x394bb0,_0x3f31cb){var _0x384ffd=_0x2147('0x18');if(_0x394bb0['body']&&_0x394bb0[_0x2147('0x19')][_0x2147('0x1a')]&&_0x394bb0[_0x2147('0x19')]['agent_id']){_0x384ffd=_0x2147('0x1b');}return util[_0x2147('0xb')](_0x384ffd,_0x394bb0['method'],_0x394bb0[_0x2147('0xe')][_0x2147('0xf')]?_0x394bb0['headers'][_0x2147('0xf')]:_0x394bb0[_0x2147('0x10')]['remoteAddress']||_0x394bb0['ip'],_0x394bb0[_0x2147('0x12')],_0x3f31cb['statusCode'],_0x3f31cb[_0x2147('0x14')],_0x394bb0[_0x2147('0x15')]?_0x394bb0[_0x2147('0x15')]['id']:null,_0x394bb0[_0x2147('0x15')]?_0x394bb0[_0x2147('0x15')][_0x2147('0x16')]:null,_0x394bb0[_0x2147('0x15')]?_0x394bb0[_0x2147('0x15')][_0x2147('0x17')]:null,_0x394bb0[_0x2147('0x19')]&&_0x394bb0[_0x2147('0x19')]['device']?_0x394bb0[_0x2147('0x19')][_0x2147('0x1a')]:'other',_0x394bb0[_0x2147('0x19')]&&_0x394bb0['body']['agent_id']?_0x394bb0[_0x2147('0x19')]['agent_id']:'',_0x394bb0[_0x2147('0x19')]&&_0x394bb0[_0x2147('0x19')][_0x2147('0x1c')]?_0x394bb0['body'][_0x2147('0x1c')]:'');},'ignoreRoute':function(_0x151050){var _0x3db051=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3db051[_0x2147('0x1d')](_0x151050[_0x2147('0x12')]);}}));_0x460aa0[_0x2147('0x9')](_0x2147('0x1e'),require(_0x2147('0x1f')));_0x460aa0[_0x2147('0x9')](_0x2147('0x20'),require(_0x2147('0x21')));_0x460aa0[_0x2147('0x9')]('/api/voice/contexts',require(_0x2147('0x22')));_0x460aa0[_0x2147('0x9')](_0x2147('0x23'),require('./api/voiceExtension'));_0x460aa0[_0x2147('0x9')](_0x2147('0x24'),require('./api/voiceMusicOnHold'));_0x460aa0['use']('/api/voice/queues',require(_0x2147('0x25')));_0x460aa0['use'](_0x2147('0x26'),require('./api/voiceRecording'));_0x460aa0[_0x2147('0x9')](_0x2147('0x27'),require(_0x2147('0x28')));_0x460aa0[_0x2147('0x9')](_0x2147('0x29'),require('./api/voiceMailMessage'));_0x460aa0[_0x2147('0x9')](_0x2147('0x2a'),require('./api/voiceCallReport'));_0x460aa0[_0x2147('0x9')](_0x2147('0x2b'),require('./api/voiceDialReport'));_0x460aa0[_0x2147('0x9')](_0x2147('0x2c'),require(_0x2147('0x2d')));_0x460aa0[_0x2147('0x9')](_0x2147('0x2e'),require(_0x2147('0x2f')));_0x460aa0[_0x2147('0x9')](_0x2147('0x30'),require(_0x2147('0x31')));_0x460aa0[_0x2147('0x9')](_0x2147('0x32'),require('./api/trunk'));_0x460aa0[_0x2147('0x9')](_0x2147('0x33'),require(_0x2147('0x34')));_0x460aa0[_0x2147('0x9')](_0x2147('0x35'),require(_0x2147('0x36')));_0x460aa0[_0x2147('0x9')]('/api/mail/accounts',require('./api/mailAccount'));_0x460aa0['use'](_0x2147('0x37'),require(_0x2147('0x38')));_0x460aa0[_0x2147('0x9')](_0x2147('0x39'),require(_0x2147('0x3a')));_0x460aa0[_0x2147('0x9')]('/api/mail/interactions',require(_0x2147('0x3b')));_0x460aa0[_0x2147('0x9')]('/api/mail/messages',require(_0x2147('0x3c')));_0x460aa0[_0x2147('0x9')]('/api/mail/applications',require(_0x2147('0x3d')));_0x460aa0['use'](_0x2147('0x3e'),require(_0x2147('0x3f')));_0x460aa0[_0x2147('0x9')](_0x2147('0x40'),require(_0x2147('0x41')));_0x460aa0['use'](_0x2147('0x42'),require('./api/dashboardItem'));_0x460aa0[_0x2147('0x9')]('/api/fax/accounts',require(_0x2147('0x43')));_0x460aa0['use'](_0x2147('0x44'),require(_0x2147('0x45')));_0x460aa0[_0x2147('0x9')]('/api/fax/interactions',require(_0x2147('0x46')));_0x460aa0[_0x2147('0x9')](_0x2147('0x47'),require('./api/faxMessage'));_0x460aa0[_0x2147('0x9')](_0x2147('0x48'),require(_0x2147('0x49')));_0x460aa0[_0x2147('0x9')](_0x2147('0x4a'),require(_0x2147('0x4b')));_0x460aa0['use']('/api/sms/accounts',require(_0x2147('0x4c')));_0x460aa0[_0x2147('0x9')](_0x2147('0x4d'),require(_0x2147('0x4e')));_0x460aa0[_0x2147('0x9')](_0x2147('0x4f'),require(_0x2147('0x50')));_0x460aa0[_0x2147('0x9')](_0x2147('0x51'),require(_0x2147('0x52')));_0x460aa0[_0x2147('0x9')](_0x2147('0x53'),require(_0x2147('0x54')));_0x460aa0['use'](_0x2147('0x55'),require('./api/openchannelAccount'));_0x460aa0[_0x2147('0x9')](_0x2147('0x56'),require(_0x2147('0x57')));_0x460aa0['use'](_0x2147('0x58'),require(_0x2147('0x59')));_0x460aa0['use'](_0x2147('0x5a'),require('./api/openchannelMessage'));_0x460aa0[_0x2147('0x9')](_0x2147('0x5b'),require(_0x2147('0x5c')));_0x460aa0['use'](_0x2147('0x5d'),require('./api/chatWebsite'));_0x460aa0[_0x2147('0x9')](_0x2147('0x5e'),require(_0x2147('0x5f')));_0x460aa0[_0x2147('0x9')](_0x2147('0x60'),require(_0x2147('0x61')));_0x460aa0[_0x2147('0x9')](_0x2147('0x62'),require(_0x2147('0x63')));_0x460aa0[_0x2147('0x9')](_0x2147('0x64'),require(_0x2147('0x65')));_0x460aa0[_0x2147('0x9')](_0x2147('0x66'),require('./api/chatOfflineMessage'));_0x460aa0[_0x2147('0x9')](_0x2147('0x67'),require(_0x2147('0x68')));_0x460aa0[_0x2147('0x9')](_0x2147('0x69'),require(_0x2147('0x6a')));_0x460aa0[_0x2147('0x9')](_0x2147('0x6b'),require(_0x2147('0x6c')));_0x460aa0[_0x2147('0x9')](_0x2147('0x6d'),require(_0x2147('0x6e')));_0x460aa0['use'](_0x2147('0x6f'),require(_0x2147('0x70')));_0x460aa0['use']('/api/cm/hopper',require(_0x2147('0x71')));_0x460aa0[_0x2147('0x9')](_0x2147('0x72'),require(_0x2147('0x73')));_0x460aa0[_0x2147('0x9')](_0x2147('0x74'),require(_0x2147('0x75')));_0x460aa0[_0x2147('0x9')](_0x2147('0x76'),require(_0x2147('0x77')));_0x460aa0[_0x2147('0x9')](_0x2147('0x78'),require('./api/cmCustomField'));_0x460aa0[_0x2147('0x9')](_0x2147('0x79'),require(_0x2147('0x7a')));_0x460aa0[_0x2147('0x9')](_0x2147('0x7b'),require(_0x2147('0x7c')));_0x460aa0['use'](_0x2147('0x7d'),require(_0x2147('0x7e')));_0x460aa0[_0x2147('0x9')](_0x2147('0x7f'),require(_0x2147('0x80')));_0x460aa0[_0x2147('0x9')](_0x2147('0x81'),require(_0x2147('0x82')));_0x460aa0[_0x2147('0x9')](_0x2147('0x83'),require(_0x2147('0x84')));_0x460aa0[_0x2147('0x9')](_0x2147('0x85'),require(_0x2147('0x86')));_0x460aa0[_0x2147('0x9')]('/api/cdr',require(_0x2147('0x87')));_0x460aa0['use'](_0x2147('0x88'),require(_0x2147('0x89')));_0x460aa0[_0x2147('0x9')](_0x2147('0x8a'),require(_0x2147('0x8b')));_0x460aa0['use'](_0x2147('0x8c'),require(_0x2147('0x8d')));_0x460aa0[_0x2147('0x9')]('/api/tags',require(_0x2147('0x8e')));_0x460aa0['use'](_0x2147('0x8f'),require(_0x2147('0x90')));_0x460aa0[_0x2147('0x9')](_0x2147('0x91'),require('./api/trigger'));_0x460aa0[_0x2147('0x9')](_0x2147('0x92'),require(_0x2147('0x93')));_0x460aa0[_0x2147('0x9')](_0x2147('0x94'),require('./api/integration'));_0x460aa0[_0x2147('0x9')](_0x2147('0x95'),require(_0x2147('0x96')));_0x460aa0['use'](_0x2147('0x97'),require('./api/analyticCustomReport'));_0x460aa0[_0x2147('0x9')](_0x2147('0x98'),require(_0x2147('0x99')));_0x460aa0[_0x2147('0x9')]('/api/analytics/extracted_reports',require(_0x2147('0x9a')));_0x460aa0[_0x2147('0x9')](_0x2147('0x9b'),require('./api/analyticMetric'));_0x460aa0[_0x2147('0x9')](_0x2147('0x9c'),require(_0x2147('0x9d')));_0x460aa0[_0x2147('0x9')](_0x2147('0x9e'),require(_0x2147('0x9f')));_0x460aa0[_0x2147('0x9')](_0x2147('0xa0'),require(_0x2147('0xa1')));_0x460aa0[_0x2147('0x9')](_0x2147('0xa2'),require(_0x2147('0xa3')));_0x460aa0[_0x2147('0x9')]('/api/integrations/salesforce/fields',require(_0x2147('0xa4')));_0x460aa0[_0x2147('0x9')]('/api/integrations/sugarcrm/accounts',require(_0x2147('0xa5')));_0x460aa0[_0x2147('0x9')](_0x2147('0xa6'),require('./api/intSugarcrmConfiguration'));_0x460aa0[_0x2147('0x9')](_0x2147('0xa7'),require('./api/intSugarcrmField'));_0x460aa0[_0x2147('0x9')]('/api/integrations/desk/accounts',require(_0x2147('0xa8')));_0x460aa0[_0x2147('0x9')](_0x2147('0xa9'),require(_0x2147('0xaa')));_0x460aa0[_0x2147('0x9')](_0x2147('0xab'),require('./api/intDeskField'));_0x460aa0[_0x2147('0x9')]('/api/integrations/zoho/accounts',require('./api/intZohoAccount'));_0x460aa0[_0x2147('0x9')]('/api/integrations/zoho/configurations',require(_0x2147('0xac')));_0x460aa0['use'](_0x2147('0xad'),require('./api/intZohoField'));_0x460aa0[_0x2147('0x9')]('/api/integrations/zendesk/accounts',require(_0x2147('0xae')));_0x460aa0[_0x2147('0x9')]('/api/integrations/zendesk/configurations',require('./api/intZendeskConfiguration'));_0x460aa0[_0x2147('0x9')]('/api/integrations/zendesk/fields',require(_0x2147('0xaf')));_0x460aa0[_0x2147('0x9')](_0x2147('0xb0'),require(_0x2147('0xb1')));_0x460aa0[_0x2147('0x9')](_0x2147('0xb2'),require(_0x2147('0xb3')));_0x460aa0[_0x2147('0x9')](_0x2147('0xb4'),require('./api/intFreshdeskField'));_0x460aa0[_0x2147('0x9')](_0x2147('0xb5'),require('./api/intVtigerAccount'));_0x460aa0[_0x2147('0x9')]('/api/integrations/vtiger/configurations',require(_0x2147('0xb6')));_0x460aa0[_0x2147('0x9')](_0x2147('0xb7'),require(_0x2147('0xb8')));_0x460aa0[_0x2147('0x9')]('/api/integrations/servicenow/accounts',require('./api/intServicenowAccount'));_0x460aa0[_0x2147('0x9')]('/api/integrations/servicenow/configurations',require(_0x2147('0xb9')));_0x460aa0['use'](_0x2147('0xba'),require('./api/intServicenowField'));_0x460aa0[_0x2147('0x9')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x460aa0[_0x2147('0x9')](_0x2147('0xbb'),require(_0x2147('0xbc')));_0x460aa0[_0x2147('0x9')]('/api/integrations/dynamics365/fields',require(_0x2147('0xbd')));_0x460aa0[_0x2147('0x9')]('/api/networks',require('./api/network'));_0x460aa0[_0x2147('0x9')](_0x2147('0xbe'),require('./api/chatQueueReport'));_0x460aa0['use']('/api/chat/internal/messages',require('./api/chatInternalMessage'));_0x460aa0['use'](_0x2147('0xbf'),require(_0x2147('0xc0')));_0x460aa0[_0x2147('0x9')](_0x2147('0xc1'),require(_0x2147('0xc2')));_0x460aa0[_0x2147('0x9')]('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x460aa0['use']('/api/sms/reports/queue',require(_0x2147('0xc3')));_0x460aa0[_0x2147('0x9')](_0x2147('0xc4'),require(_0x2147('0xc5')));_0x460aa0[_0x2147('0x9')]('/api/square/details/reports',require(_0x2147('0xc6')));_0x460aa0[_0x2147('0x9')](_0x2147('0xc7'),require(_0x2147('0xc8')));_0x460aa0['use'](_0x2147('0xc9'),require('./api/setting'));_0x460aa0[_0x2147('0x9')]('/api/square/odbc',require(_0x2147('0xca')));_0x460aa0[_0x2147('0x9')](_0x2147('0xcb'),require('./api/squareProject'));_0x460aa0[_0x2147('0x9')](_0x2147('0xcc'),require('./api/squareRecording'));_0x460aa0[_0x2147('0x9')](_0x2147('0xcd'),require(_0x2147('0xce')));_0x460aa0[_0x2147('0x9')](_0x2147('0xcf'),require(_0x2147('0xd0')));_0x460aa0[_0x2147('0x9')](_0x2147('0xd1'),require(_0x2147('0xd2')));_0x460aa0[_0x2147('0x9')](_0x2147('0xd3'),require(_0x2147('0xd4')));_0x460aa0[_0x2147('0x9')](_0x2147('0xd5'),require(_0x2147('0xd6')));_0x460aa0[_0x2147('0x9')](_0x2147('0xd7'),require(_0x2147('0xd8')));_0x460aa0['use'](_0x2147('0xd9'),require('./api/plugin'));_0x460aa0[_0x2147('0x9')](_0x2147('0xda'),require(_0x2147('0xdb')));_0x460aa0[_0x2147('0x9')](_0x2147('0xdc'),require('./api/chatTransferReport'));_0x460aa0['use'](_0x2147('0xdd'),require(_0x2147('0xde')));_0x460aa0[_0x2147('0x9')]('/api/openchannel/reports/transfer',require('./api/openchannelTransferReport'));_0x460aa0[_0x2147('0x9')](_0x2147('0xdf'),require(_0x2147('0xe0')));_0x460aa0[_0x2147('0x9')](_0x2147('0xe1'),require(_0x2147('0xe2')));_0x460aa0[_0x2147('0x9')](_0x2147('0xe3'),require('./api/voicePrefix'));_0x460aa0[_0x2147('0x9')](_0x2147('0xe4'),require('./api/userProfile'));_0x460aa0[_0x2147('0x9')](_0x2147('0xe5'),require(_0x2147('0xe6')));_0x460aa0[_0x2147('0x9')](_0x2147('0xe7'),require(_0x2147('0xe8')));_0x460aa0['use'](_0x2147('0xe9'),require('./api/authLocal'));_0x460aa0[_0x2147('0x9')]('/api/auth/google',require(_0x2147('0xea')));_0x460aa0[_0x2147('0x9')](_0x2147('0xeb'),require('./api/jira'));_0x460aa0[_0x2147('0x9')](_0x2147('0xec'),require(_0x2147('0xed')));_0x460aa0[_0x2147('0x9')](_0x2147('0xee'),require(_0x2147('0xef')));_0x460aa0[_0x2147('0x9')](_0x2147('0xf0'),require('./api/system'));_0x460aa0[_0x2147('0x9')](_0x2147('0xf1'),require(_0x2147('0xf2')));_0x460aa0[_0x2147('0x9')](_0x2147('0xf3'),express[_0x2147('0xf4')](path[_0x2147('0xf5')](config['root'],_0x2147('0xf3'))));_0x460aa0[_0x2147('0x9')](_0x2147('0xf6'),express[_0x2147('0xf4')](path['join'](config[_0x2147('0xf7')],_0x2147('0xf6'))));_0x460aa0[_0x2147('0x9')](_0x2147('0xf8'),express['static'](path[_0x2147('0xf5')](config[_0x2147('0xf7')],_0x2147('0xf8'))));_0x460aa0[_0x2147('0x9')](_0x2147('0xf9'),express[_0x2147('0xf4')](path[_0x2147('0xf5')](config[_0x2147('0xf7')],_0x2147('0xfa'),'1.0.11')));_0x460aa0[_0x2147('0x9')](_0x2147('0xfb'),express[_0x2147('0xf4')](path[_0x2147('0xf5')](config[_0x2147('0xf7')],_0x2147('0xfc'))));_0x460aa0['route'](_0x2147('0xfd'))['get'](errors[0x194]);_0x460aa0[_0x2147('0xfe')]('/*')[_0x2147('0xff')](function(_0x4b6a2f,_0x44ad52){_0x44ad52[_0x2147('0x100')](path['resolve'](_0x460aa0[_0x2147('0xff')](_0x2147('0x101'))+_0x2147('0x102')));});};
\ No newline at end of file
index 183b177..5b36890 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc7e9=['../api/squareMessage/squareMessage.rpc','../api/plugin/plugin.rpc','server','http','port','rpc','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.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/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/intServicenowAccount/intServicenowAccount.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'];(function(_0x4d98ac,_0x393468){var _0x40202e=function(_0x1f9b34){while(--_0x1f9b34){_0x4d98ac['push'](_0x4d98ac['shift']());}};_0x40202e(++_0x393468);}(_0xc7e9,0x1ef));var _0x9c7e=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xc7e9[_0x2c7618];return _0x5ce3f0;};'use strict';var jayson=require(_0x9c7e('0x0'));var BPromise=require(_0x9c7e('0x1'));var _=require('lodash');var config=require(_0x9c7e('0x2'));exports[_0x9c7e('0x3')]=function(){return new BPromise(function(_0x2acedf,_0x49b7e4){var _0x340997={};_0x340997=_[_0x9c7e('0x4')](_0x340997,require('../api/user/user.rpc'));_0x340997=_['merge'](_0x340997,require(_0x9c7e('0x5')));_0x340997=_['merge'](_0x340997,require(_0x9c7e('0x6')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x7')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x8')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x9')));_0x340997=_['merge'](_0x340997,require(_0x9c7e('0xa')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require('../api/memberReport/memberReport.rpc'));_0x340997=_[_0x9c7e('0x4')](_0x340997,require('../api/trunk/trunk.rpc'));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0xb')));_0x340997=_['merge'](_0x340997,require(_0x9c7e('0xc')));_0x340997=_['merge'](_0x340997,require(_0x9c7e('0xd')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0xe')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0xf')));_0x340997=_['merge'](_0x340997,require(_0x9c7e('0x10')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x11')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x12')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x13')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x14')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require('../api/faxInteraction/faxInteraction.rpc'));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x15')));_0x340997=_['merge'](_0x340997,require(_0x9c7e('0x16')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x17')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x18')));_0x340997=_['merge'](_0x340997,require(_0x9c7e('0x19')));_0x340997=_['merge'](_0x340997,require(_0x9c7e('0x1a')));_0x340997=_['merge'](_0x340997,require('../api/smsQueue/smsQueue.rpc'));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x1b')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x1c')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x1d')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x1e')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x1f')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x20')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x21')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x22')));_0x340997=_['merge'](_0x340997,require(_0x9c7e('0x23')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x24')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x25')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x340997=_['merge'](_0x340997,require(_0x9c7e('0x26')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x27')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x28')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x29')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require('../api/template/template.rpc'));_0x340997=_[_0x9c7e('0x4')](_0x340997,require('../api/trigger/trigger.rpc'));_0x340997=_[_0x9c7e('0x4')](_0x340997,require('../api/variable/variable.rpc'));_0x340997=_['merge'](_0x340997,require(_0x9c7e('0x2a')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x2b')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x2c')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x2d')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x2e')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x2f')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x30')));_0x340997=_['merge'](_0x340997,require(_0x9c7e('0x31')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x32')));_0x340997=_['merge'](_0x340997,require(_0x9c7e('0x33')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x34')));_0x340997=_['merge'](_0x340997,require(_0x9c7e('0x35')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x36')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x37')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x38')));_0x340997=_['merge'](_0x340997,require(_0x9c7e('0x39')));_0x340997=_[_0x9c7e('0x4')](_0x340997,require('../api/campaign/campaign.rpc'));_0x340997=_[_0x9c7e('0x4')](_0x340997,require('../api/attachment/attachment.rpc'));_0x340997=_[_0x9c7e('0x4')](_0x340997,require(_0x9c7e('0x3a')));var _0x3a52e9=jayson[_0x9c7e('0x3b')](_0x340997)[_0x9c7e('0x3c')]();var _0x516194=config['rpc'][_0x9c7e('0x3d')]||config[_0x9c7e('0x3d')]+0x1;var _0x420af1=config[_0x9c7e('0x3e')]['ip']||_0x9c7e('0x3f');_0x3a52e9['on']('error',function(_0x4f1517){return _0x49b7e4(_0x4f1517);});_0x3a52e9[_0x9c7e('0x3')](_0x516194,_0x420af1,function(){console[_0x9c7e('0x40')](_0x9c7e('0x41'),_0x420af1,_0x516194);require(_0x9c7e('0x42'))[_0x9c7e('0x43')]();return _0x2acedf(_0x9c7e('0x44')+_0x420af1+':'+_0x516194);});});};
\ No newline at end of file
+var _0xde6c=['../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','server','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.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/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xde6c,0x119));var _0xcde6=function(_0x54abca,_0x105466){_0x54abca=_0x54abca-0x0;var _0x83d195=_0xde6c[_0x54abca];return _0x83d195;};'use strict';var jayson=require(_0xcde6('0x0'));var BPromise=require(_0xcde6('0x1'));var _=require('lodash');var config=require(_0xcde6('0x2'));exports[_0xcde6('0x3')]=function(){return new BPromise(function(_0x22fa0d,_0x31ac8c){var _0x494a32={};_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x5')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require('../api/voiceExtension/voiceExtension.rpc'));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x6')));_0x494a32=_['merge'](_0x494a32,require('../api/voiceRecording/voiceRecording.rpc'));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x7')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x8')));_0x494a32=_['merge'](_0x494a32,require(_0xcde6('0x9')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require('../api/memberReport/memberReport.rpc'));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0xa')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0xb')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0xc')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0xd')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0xe')));_0x494a32=_['merge'](_0x494a32,require(_0xcde6('0xf')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x10')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x11')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x12')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x13')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require('../api/faxAccount/faxAccount.rpc'));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x14')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require('../api/faxInteraction/faxInteraction.rpc'));_0x494a32=_['merge'](_0x494a32,require('../api/faxMessage/faxMessage.rpc'));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require('../api/faxQueue/faxQueue.rpc'));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x15')));_0x494a32=_['merge'](_0x494a32,require(_0xcde6('0x16')));_0x494a32=_['merge'](_0x494a32,require(_0xcde6('0x17')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x18')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x19')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x1a')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x1b')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x1c')));_0x494a32=_['merge'](_0x494a32,require(_0xcde6('0x1d')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x1e')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x1f')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x20')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require('../api/cmHopper/cmHopper.rpc'));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x21')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x494a32=_['merge'](_0x494a32,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x22')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x23')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x24')));_0x494a32=_['merge'](_0x494a32,require('../api/template/template.rpc'));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x25')));_0x494a32=_['merge'](_0x494a32,require(_0xcde6('0x26')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x27')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x28')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x29')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x2a')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x2b')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x2c')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x494a32=_['merge'](_0x494a32,require(_0xcde6('0x2d')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x2e')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x2f')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x30')));_0x494a32=_['merge'](_0x494a32,require(_0xcde6('0x31')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x32')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require('../api/squareOdbc/squareOdbc.rpc'));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x33')));_0x494a32=_['merge'](_0x494a32,require(_0xcde6('0x34')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x35')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x36')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x37')));_0x494a32=_[_0xcde6('0x4')](_0x494a32,require(_0xcde6('0x38')));var _0x4f2273=jayson[_0xcde6('0x39')](_0x494a32)['http']();var _0x38fbfd=config[_0xcde6('0x3a')][_0xcde6('0x3b')]||config['port']+0x1;var _0x537511=config[_0xcde6('0x3a')]['ip']||_0xcde6('0x3c');_0x4f2273['on'](_0xcde6('0x3d'),function(_0x16d4a7){return _0x31ac8c(_0x16d4a7);});_0x4f2273[_0xcde6('0x3')](_0x38fbfd,_0x537511,function(){console[_0xcde6('0x3e')](_0xcde6('0x3f'),_0x537511,_0x38fbfd);require(_0xcde6('0x40'))['default']();return _0x22fa0d(_0xcde6('0x41')+_0x537511+':'+_0x38fbfd);});});};
\ No newline at end of file
index 2d26dcf..fbcc48d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x91f2=['function','prototype','sync','answer','sendRequest','ANSWER','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','isArray','join','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','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','BEEP','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','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','events','./reply','./error','call','setEncoding','utf8','headers','emit','line','toLowerCase','hangup','substring','520-Invalid','search','replace','result=','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command'];(function(_0x23840e,_0x2fb0cb){var _0x277300=function(_0x246e5a){while(--_0x246e5a){_0x23840e['push'](_0x23840e['shift']());}};_0x277300(++_0x2fb0cb);}(_0x91f2,0x73));var _0x291f=function(_0x31ae70,_0x50ab0f){_0x31ae70=_0x31ae70-0x0;var _0x5760dc=_0x91f2[_0x31ae70];return _0x5760dc;};'use strict';var util=require(_0x291f('0x0'));var _=require(_0x291f('0x1'));var EventEmitter=require(_0x291f('0x2'))['EventEmitter'];var AGIReply=require(_0x291f('0x3'));var AGIError=require(_0x291f('0x4'));function AGIChannel(_0x44ba97){var _0x299b0e=this,_0x47eb15=new AGIReply(),_0x3a06fa=![],_0x27fd6e={};EventEmitter[_0x291f('0x5')](_0x299b0e);_0x44ba97[_0x291f('0x6')](_0x291f('0x7'));_0x44ba97['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x47eb15[_0x291f('0x6')](_0x291f('0x7'));_0x47eb15['on'](_0x291f('0x8'),function(_0x2211a3){for(var _0x4f9896 in _0x2211a3){_0x299b0e[_0x4f9896]=_0x2211a3[_0x4f9896];}_0x299b0e[_0x291f('0x9')]('ready');});_0x47eb15['on'](_0x291f('0xa'),function(_0x254df2){if(_0x254df2[_0x291f('0xb')]()==_0x291f('0xc')){_0x299b0e[_0x291f('0x9')]('hangup');return;}if(_0x254df2[_0x291f('0xd')](0x0,0xb)==_0x291f('0xe')){_0x3a06fa=!![];}if(_0x3a06fa){_0x27fd6e['rx']+=_0x254df2+'\x0a';if(_0x254df2[_0x291f('0xf')]('520\x20End\x20of\x20proper')!=-0x1){_0x3a06fa=![];}}else{_0x27fd6e['rx']=_0x254df2;}if(_0x3a06fa){return;}if(typeof _0x27fd6e['cb']=='function'){var _0x2f7438=_0x27fd6e['rx'][_0x291f('0xd')](0x0,0x3),_0x166d29=null,_0x2f0564=null;_0x2f7438=parseInt(_0x2f7438);if(isNaN(_0x2f7438)){_0x27fd6e['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x2f7438!=0xc8){_0x27fd6e['cb'](null,{'code':_0x2f7438,'result':-0x1,'extra':'KO'});return;}_0x166d29=_0x27fd6e['rx']['substring'](0x4)[_0x291f('0x10')](_0x291f('0x11'),'');if(_0x166d29['indexOf']('\x20')!=-0x1){_0x166d29=_0x166d29['substr'](0x0,_0x166d29['indexOf']('\x20'));}if(_[_0x291f('0x12')](_0x166d29,'-1')){_0x166d29=parseInt(_0x166d29);}_0x2f0564=_0x27fd6e['rx']['split']('\x20');if(_0x2f0564[_0x291f('0x13')]==0x3){_0x2f0564=_0x2f0564[0x2][_0x291f('0xd')](0x1,_0x2f0564[0x2][_0x291f('0x13')]-0x1);}else if(_0x2f0564[_0x291f('0x13')]>0x3){var _0x2785bf=/\((.+)\)/;var _0x167356=_0x27fd6e['rx'][_0x291f('0x14')](_0x2785bf);if(_0x167356){_0x2f0564=_0x167356[0x1];}else{_0x2f0564=null;}}else{_0x2f0564=null;}_0x27fd6e['cb'](null,{'code':_0x2f7438,'result':_0x166d29,'extra':_0x2f0564});}});_0x44ba97['on']('error',function(_0x51dfcf){_0x299b0e[_0x291f('0x9')](_0x291f('0x15'),new AGIError(_0x291f('0x16'),_0x51dfcf[_0x291f('0x17')]));});_0x44ba97['on']('close',function(){_0x299b0e[_0x291f('0x9')](_0x291f('0x18'),new AGIError(_0x291f('0x19')));});_0x44ba97['on'](_0x291f('0x1a'),function(){_0x299b0e[_0x291f('0x9')](_0x291f('0x1a'),new AGIError(_0x291f('0x1b')));_0x44ba97[_0x291f('0x1c')]();});_0x44ba97[_0x291f('0x1d')](_0x47eb15);this[_0x291f('0x1e')]=function(_0x407c34,_0x4a5fea){var _0x407c34=_0x407c34||'',_0x4a5fea=typeof _0x4a5fea==_0x291f('0x1f')?_0x4a5fea:new Function();_0x27fd6e={'tx':_0x407c34,'rx':'','cb':_0x4a5fea};_0x44ba97['write'](_0x407c34+'\x0a');},this['close']=function(){_0x44ba97[_0x291f('0x1c')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x291f('0x20')]['sendRequest']=function(_0x2d1f41){return this['command'][_0x291f('0x21')](this,_0x2d1f41);};AGIChannel[_0x291f('0x20')][_0x291f('0x22')]=function(){return this[_0x291f('0x23')](_0x291f('0x24'));};AGIChannel['prototype']['getData']=function(_0x26d793,_0x81d6dd,_0x4a9bf3){_0x26d793=_0x26d793===undefined?'beep':_0x26d793;_0x81d6dd=_0x81d6dd===undefined?'5':_0x81d6dd;_0x4a9bf3=_0x4a9bf3===undefined?'1':_0x4a9bf3;return this[_0x291f('0x23')](util[_0x291f('0x25')](_0x291f('0x26'),_0x26d793,_0x81d6dd*0x3e8,_0x4a9bf3));};AGIChannel[_0x291f('0x20')][_0x291f('0x27')]=function(_0x2064df){_0x2064df=_0x2064df||'NO\x20MESSAGE';return this[_0x291f('0x23')](util[_0x291f('0x25')](_0x291f('0x28'),_0x2064df));};AGIChannel['prototype']['exec']=function(_0x539512,_0x42f00e){if(_[_0x291f('0x29')](_0x42f00e)){return this[_0x291f('0x23')](util['format']('EXEC\x20%s\x20%s',_0x539512,_0x42f00e[_0x291f('0x2a')](',')));}return this[_0x291f('0x23')](util[_0x291f('0x25')](_0x291f('0x2b'),_0x539512,_0x42f00e));};AGIChannel[_0x291f('0x20')]['setContext']=function(_0x395345){return this[_0x291f('0x23')](util[_0x291f('0x25')](_0x291f('0x2c'),_0x395345));};AGIChannel['prototype'][_0x291f('0x2d')]=function(_0x2853f3){return this['sendRequest'](util[_0x291f('0x25')](_0x291f('0x2e'),_0x2853f3));};AGIChannel[_0x291f('0x20')][_0x291f('0x2f')]=function(_0x4bf398){return this['sendRequest'](util[_0x291f('0x25')](_0x291f('0x30'),_0x4bf398));};AGIChannel[_0x291f('0x20')][_0x291f('0xc')]=function(){return this['sendRequest'](_0x291f('0x31'));};AGIChannel[_0x291f('0x20')]['setVariable']=function(_0x1b72f7,_0x299255){return this[_0x291f('0x23')](util[_0x291f('0x25')](_0x291f('0x32'),_0x1b72f7,_0x299255?_0x299255[_0x291f('0x33')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x291f('0x34')]=function(_0x57ea4d,_0x4d376c){return this[_0x291f('0x23')](util[_0x291f('0x25')](_0x291f('0x35'),_0x57ea4d,_0x4d376c));};AGIChannel[_0x291f('0x20')][_0x291f('0x36')]=function(_0x3a4f87,_0x161333){return this[_0x291f('0x23')](util[_0x291f('0x25')](_0x291f('0x37'),_0x3a4f87,_0x161333));};AGIChannel[_0x291f('0x20')][_0x291f('0x38')]=function(_0x19c5c4,_0x16f9ed){return this[_0x291f('0x23')](util[_0x291f('0x25')](_0x291f('0x39'),_0x19c5c4,_0x16f9ed));};AGIChannel[_0x291f('0x20')][_0x291f('0x3a')]=function(_0x2a50aa,_0x493424,_0x52e97e){_0x493424=_0x493424||this[_0x291f('0x3b')];_0x52e97e=_0x52e97e||0x1;this[_0x291f('0x3c')](_0x2a50aa);this[_0x291f('0x2d')](_0x493424);this[_0x291f('0x2f')](_0x52e97e);return this[_0x291f('0x27')](util[_0x291f('0x25')](_0x291f('0x3d'),_0x2a50aa,_0x493424,_0x52e97e));};AGIChannel[_0x291f('0x20')]['getVariable']=function(_0x52c525){return this['sendRequest'](util[_0x291f('0x25')]('GET\x20VARIABLE\x20\x22%s\x22',_0x52c525));};AGIChannel[_0x291f('0x20')]['recordFile']=function(_0x242ad4,_0x16b711,_0x4d372c,_0x22fc17,_0x1a61ea,_0x4a7b08){_0x16b711=_0x16b711||'wav';_0x4d372c=_0x4d372c||'';_0x22fc17=_0x22fc17===undefined?-0x1:_0x22fc17==='-1'?-0x1:_0x22fc17*0x3e8;_0x1a61ea=_0x1a61ea===undefined?'':'s='+_0x1a61ea;_0x4a7b08=_0x4a7b08?_0x291f('0x3e'):'';return this['sendRequest'](util[_0x291f('0x25')](_0x291f('0x3f'),_0x242ad4,_0x16b711,_0x4d372c,_0x22fc17,_0x4a7b08,_0x1a61ea));};AGIChannel['prototype'][_0x291f('0x40')]=function(_0x1bf8f1,_0xbd0010){_0xbd0010=_0xbd0010||'';return this[_0x291f('0x23')](util[_0x291f('0x25')](_0x291f('0x41'),_0x1bf8f1,_0xbd0010));};AGIChannel[_0x291f('0x20')][_0x291f('0x42')]=function(_0x1c061f){return this[_0x291f('0x43')](_0x291f('0x44'),_0x1c061f);};AGIChannel[_0x291f('0x20')][_0x291f('0x45')]=function(_0x4da85d){return this['exec'](_0x291f('0x46'),_0x4da85d);};AGIChannel[_0x291f('0x20')][_0x291f('0x15')]=function(_0xa91fe0,_0x2f9f01){this[_0x291f('0x27')](util[_0x291f('0x25')](_0x291f('0x47'),_0xa91fe0['id'],_0xa91fe0['label'],_0x2f9f01));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x291f('0x48')]=AGIChannel;
\ No newline at end of file
+var _0x13f5=['NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','HANGUP','setVariable','toString','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','agi','AGI','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','EventEmitter','./reply','./error','call','setEncoding','utf8','emit','toLowerCase','hangup','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','substring','replace','result=','indexOf','substr','startsWith','length','error','E_AGI_SOCKET_ERROR','close','timeout','destroy','pipe','write','inherits','prototype','sendRequest','command','sync','answer','ANSWER','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x13f5,0x69));var _0x513f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x13f5[_0x57b54c];return _0x59cc19;};'use strict';var util=require(_0x513f('0x0'));var _=require(_0x513f('0x1'));var EventEmitter=require('events')[_0x513f('0x2')];var AGIReply=require(_0x513f('0x3'));var AGIError=require(_0x513f('0x4'));function AGIChannel(_0x28509a){var _0x3a30b1=this,_0x3f9800=new AGIReply(),_0x483e80=![],_0x8c26e0={};EventEmitter[_0x513f('0x5')](_0x3a30b1);_0x28509a[_0x513f('0x6')]('utf8');_0x28509a['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x3f9800[_0x513f('0x6')](_0x513f('0x7'));_0x3f9800['on']('headers',function(_0x6e2738){for(var _0x4c79c1 in _0x6e2738){_0x3a30b1[_0x4c79c1]=_0x6e2738[_0x4c79c1];}_0x3a30b1[_0x513f('0x8')]('ready');});_0x3f9800['on']('line',function(_0x33d20e){if(_0x33d20e[_0x513f('0x9')]()==_0x513f('0xa')){_0x3a30b1['emit']('hangup');return;}if(_0x33d20e['substring'](0x0,0xb)==_0x513f('0xb')){_0x483e80=!![];}if(_0x483e80){_0x8c26e0['rx']+=_0x33d20e+'\x0a';if(_0x33d20e[_0x513f('0xc')](_0x513f('0xd'))!=-0x1){_0x483e80=![];}}else{_0x8c26e0['rx']=_0x33d20e;}if(_0x483e80){return;}if(typeof _0x8c26e0['cb']==_0x513f('0xe')){var _0x1073f0=_0x8c26e0['rx']['substring'](0x0,0x3),_0x40d278=null,_0x49dcc9=null;_0x1073f0=parseInt(_0x1073f0);if(isNaN(_0x1073f0)){_0x8c26e0['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x513f('0xf')});return;}if(_0x1073f0!=0xc8){_0x8c26e0['cb'](null,{'code':_0x1073f0,'result':-0x1,'extra':'KO'});return;}_0x40d278=_0x8c26e0['rx'][_0x513f('0x10')](0x4)[_0x513f('0x11')](_0x513f('0x12'),'');if(_0x40d278[_0x513f('0x13')]('\x20')!=-0x1){_0x40d278=_0x40d278[_0x513f('0x14')](0x0,_0x40d278[_0x513f('0x13')]('\x20'));}if(_[_0x513f('0x15')](_0x40d278,'-1')){_0x40d278=parseInt(_0x40d278);}_0x49dcc9=_0x8c26e0['rx']['split']('\x20');if(_0x49dcc9['length']==0x3){_0x49dcc9=_0x49dcc9[0x2]['substring'](0x1,_0x49dcc9[0x2][_0x513f('0x16')]-0x1);}else if(_0x49dcc9[_0x513f('0x16')]>0x3){var _0x3c9086=/\((.+)\)/;var _0x6a120e=_0x8c26e0['rx']['match'](_0x3c9086);if(_0x6a120e){_0x49dcc9=_0x6a120e[0x1];}else{_0x49dcc9=null;}}else{_0x49dcc9=null;}_0x8c26e0['cb'](null,{'code':_0x1073f0,'result':_0x40d278,'extra':_0x49dcc9});}});_0x28509a['on'](_0x513f('0x17'),function(_0x6fc73d){_0x3a30b1['emit'](_0x513f('0x17'),new AGIError(_0x513f('0x18'),_0x6fc73d['code']));});_0x28509a['on'](_0x513f('0x19'),function(){_0x3a30b1['emit']('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x28509a['on'](_0x513f('0x1a'),function(){_0x3a30b1[_0x513f('0x8')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x28509a[_0x513f('0x1b')]();});_0x28509a[_0x513f('0x1c')](_0x3f9800);this['command']=function(_0x57331f,_0x575b62){var _0x57331f=_0x57331f||'',_0x575b62=typeof _0x575b62==_0x513f('0xe')?_0x575b62:new Function();_0x8c26e0={'tx':_0x57331f,'rx':'','cb':_0x575b62};_0x28509a[_0x513f('0x1d')](_0x57331f+'\x0a');},this[_0x513f('0x19')]=function(){_0x28509a[_0x513f('0x1b')]();};}util[_0x513f('0x1e')](AGIChannel,EventEmitter);AGIChannel[_0x513f('0x1f')][_0x513f('0x20')]=function(_0x21fb7d){return this[_0x513f('0x21')][_0x513f('0x22')](this,_0x21fb7d);};AGIChannel[_0x513f('0x1f')][_0x513f('0x23')]=function(){return this[_0x513f('0x20')](_0x513f('0x24'));};AGIChannel[_0x513f('0x1f')]['getData']=function(_0x1329a7,_0x1dce08,_0x27a8b9){_0x1329a7=_0x1329a7===undefined?_0x513f('0x25'):_0x1329a7;_0x1dce08=_0x1dce08===undefined?'5':_0x1dce08;_0x27a8b9=_0x27a8b9===undefined?'1':_0x27a8b9;return this[_0x513f('0x20')](util[_0x513f('0x26')](_0x513f('0x27'),_0x1329a7,_0x1dce08*0x3e8,_0x27a8b9));};AGIChannel['prototype'][_0x513f('0x28')]=function(_0x21fb4b){_0x21fb4b=_0x21fb4b||_0x513f('0x29');return this[_0x513f('0x20')](util[_0x513f('0x26')](_0x513f('0x2a'),_0x21fb4b));};AGIChannel[_0x513f('0x1f')][_0x513f('0x2b')]=function(_0x15b67c,_0x3d35ec){if(_[_0x513f('0x2c')](_0x3d35ec)){return this['sendRequest'](util[_0x513f('0x26')](_0x513f('0x2d'),_0x15b67c,_0x3d35ec[_0x513f('0x2e')](',')));}return this['sendRequest'](util[_0x513f('0x26')](_0x513f('0x2d'),_0x15b67c,_0x3d35ec));};AGIChannel[_0x513f('0x1f')][_0x513f('0x2f')]=function(_0x89e5bf){return this[_0x513f('0x20')](util[_0x513f('0x26')](_0x513f('0x30'),_0x89e5bf));};AGIChannel[_0x513f('0x1f')][_0x513f('0x31')]=function(_0x40b6df){return this['sendRequest'](util[_0x513f('0x26')](_0x513f('0x32'),_0x40b6df));};AGIChannel['prototype']['setPriority']=function(_0x4ea51c){return this[_0x513f('0x20')](util[_0x513f('0x26')]('SET\x20PRIORITY\x20%s',_0x4ea51c));};AGIChannel[_0x513f('0x1f')]['hangup']=function(){return this[_0x513f('0x20')](_0x513f('0x33'));};AGIChannel['prototype'][_0x513f('0x34')]=function(_0xb503ca,_0x18a437){return this[_0x513f('0x20')](util[_0x513f('0x26')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0xb503ca,_0x18a437?_0x18a437[_0x513f('0x35')]()[_0x513f('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x3df891,_0x290c18){return this[_0x513f('0x20')](util[_0x513f('0x26')](_0x513f('0x36'),_0x3df891,_0x290c18));};AGIChannel[_0x513f('0x1f')]['sayDigits']=function(_0x24abbc,_0x580e61){return this[_0x513f('0x20')](util['format'](_0x513f('0x37'),_0x24abbc,_0x580e61));};AGIChannel['prototype'][_0x513f('0x38')]=function(_0x37387b,_0x2f169a){return this['sendRequest'](util[_0x513f('0x26')](_0x513f('0x39'),_0x37387b,_0x2f169a));};AGIChannel[_0x513f('0x1f')][_0x513f('0x3a')]=function(_0x24e549,_0x3a025f,_0x529ea9){_0x3a025f=_0x3a025f||this[_0x513f('0x3b')];_0x529ea9=_0x529ea9||0x1;this[_0x513f('0x2f')](_0x24e549);this[_0x513f('0x31')](_0x3a025f);this[_0x513f('0x3c')](_0x529ea9);return this['noop'](util[_0x513f('0x26')](_0x513f('0x3d'),_0x24e549,_0x3a025f,_0x529ea9));};AGIChannel[_0x513f('0x1f')][_0x513f('0x3e')]=function(_0xc3e3bd){return this['sendRequest'](util['format'](_0x513f('0x3f'),_0xc3e3bd));};AGIChannel[_0x513f('0x1f')][_0x513f('0x40')]=function(_0x29d468,_0x10902a,_0x365458,_0x236ee8,_0x449163,_0x418ba3){_0x10902a=_0x10902a||_0x513f('0x41');_0x365458=_0x365458||'';_0x236ee8=_0x236ee8===undefined?-0x1:_0x236ee8==='-1'?-0x1:_0x236ee8*0x3e8;_0x449163=_0x449163===undefined?'':'s='+_0x449163;_0x418ba3=_0x418ba3?_0x513f('0x42'):'';return this[_0x513f('0x20')](util[_0x513f('0x26')](_0x513f('0x43'),_0x29d468,_0x10902a,_0x365458,_0x236ee8,_0x418ba3,_0x449163));};AGIChannel['prototype']['streamFile']=function(_0x576546,_0x3979ad){_0x3979ad=_0x3979ad||'';return this[_0x513f('0x20')](util[_0x513f('0x26')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x576546,_0x3979ad));};AGIChannel[_0x513f('0x1f')][_0x513f('0x44')]=function(_0xcedbbb){return this[_0x513f('0x2b')](_0x513f('0x45'),_0xcedbbb);};AGIChannel[_0x513f('0x1f')]['wait']=function(_0x11ebd1){return this[_0x513f('0x2b')]('WAIT',_0x11ebd1);};AGIChannel[_0x513f('0x1f')][_0x513f('0x17')]=function(_0x48c378,_0x45390e){this[_0x513f('0x28')](util[_0x513f('0x26')](_0x513f('0x46'),_0x48c378['id'],_0x48c378[_0x513f('0x47')],_0x45390e));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x513f('0x48')]=AGIChannel;
\ No newline at end of file
index 79a0785..61975d2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa21f=['Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','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','format','message','name','exports','util','Undefined\x20error.'];(function(_0x228f83,_0x5357f6){var _0x210665=function(_0x103aa6){while(--_0x103aa6){_0x228f83['push'](_0x228f83['shift']());}};_0x210665(++_0x5357f6);}(_0xa21f,0x14e));var _0xfa21=function(_0x1932ea,_0x49ee67){_0x1932ea=_0x1932ea-0x0;var _0x3e37bb=_0xa21f[_0x1932ea];return _0x3e37bb;};'use strict';var util=require(_0xfa21('0x0'));var error={'E_AGI_UNDEFINED':_0xfa21('0x1'),'E_AGI_ARGUMENT_PORT':_0xfa21('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0xfa21('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xfa21('0x4'),'E_AGI_SOCKET_ERROR':_0xfa21('0x5'),'E_AGI_SOCKET_CLOSE':_0xfa21('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xfa21('0x7'),'E_AGI_COMMAND_EMPTY':_0xfa21('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xfa21('0x9'),'E_AGI_IVR_ENTRY':_0xfa21('0xa')};function AGIError(_0x1fdad7){var _0x1fdad7=_0x1fdad7||null,_0x2c18ff=_0x2c18ff||[],_0x216191=0x1,_0x495bc5='';if(!error[_0x1fdad7]){_0x1fdad7=_0xfa21('0xb');}_0x2c18ff['push'](error[_0x1fdad7]);while(arguments[_0x216191]){_0x2c18ff['push'](arguments[_0x216191]);_0x216191++;}_0x495bc5=util[_0xfa21('0xc')]['apply'](util,_0x2c18ff);this[_0xfa21('0xd')]=_0x495bc5;this[_0xfa21('0xe')]=_0x1fdad7;}module[_0xfa21('0xf')]=AGIError;
\ No newline at end of file
+var _0xcb40=['Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','message','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.'];(function(_0xe1f93f,_0x31c60e){var _0x10ede2=function(_0x4257ac){while(--_0x4257ac){_0xe1f93f['push'](_0xe1f93f['shift']());}};_0x10ede2(++_0x31c60e);}(_0xcb40,0x139));var _0x0cb4=function(_0x4721e0,_0x1818ef){_0x4721e0=_0x4721e0-0x0;var _0x29e2e1=_0xcb40[_0x4721e0];return _0x29e2e1;};'use strict';var util=require(_0x0cb4('0x0'));var error={'E_AGI_UNDEFINED':_0x0cb4('0x1'),'E_AGI_ARGUMENT_PORT':_0x0cb4('0x2'),'E_AGI_SERVER_ERROR':_0x0cb4('0x3'),'E_AGI_SERVER_CLOSE':_0x0cb4('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x0cb4('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x0cb4('0x6'),'E_AGI_SOCKET_ERROR':_0x0cb4('0x7'),'E_AGI_SOCKET_CLOSE':_0x0cb4('0x8'),'E_AGI_SOCKET_TIMEOUT':_0x0cb4('0x9'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x0cb4('0xa'),'E_AGI_IVR_ENTRY':_0x0cb4('0xb')};function AGIError(_0x253ddd){var _0x253ddd=_0x253ddd||null,_0x2152db=_0x2152db||[],_0x25efe9=0x1,_0x56fa5c='';if(!error[_0x253ddd]){_0x253ddd='E_AGI_UNDEFINED';}_0x2152db[_0x0cb4('0xc')](error[_0x253ddd]);while(arguments[_0x25efe9]){_0x2152db[_0x0cb4('0xc')](arguments[_0x25efe9]);_0x25efe9++;}_0x56fa5c=util[_0x0cb4('0xd')]['apply'](util,_0x2152db);this[_0x0cb4('0xe')]=_0x56fa5c;this['name']=_0x253ddd;}module[_0x0cb4('0xf')]=AGIError;
\ No newline at end of file
index d2b4613..cab3c9e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x793b=['push','numberOfEdges','size','getVertex','info','no\x20vertex\x20found','stop\x20traverse','no\x20edge/s\x20available','length','condition','split','agicommand','target','default','invalid','traverseBFS','vswitch','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','lodash','../../../config/logger','agi','menu','getdigits','vertices','edges','addVertex','prototype','addEdge'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x793b,0x189));var _0xb793=function(_0x3c7153,_0x4b7f93){_0x3c7153=_0x3c7153-0x0;var _0x308e27=_0x793b[_0x3c7153];return _0x308e27;};'use strict';var _=require(_0xb793('0x0'));var logger=require(_0xb793('0x1'))(_0xb793('0x2'));var verticesWithRetry=[_0xb793('0x3'),_0xb793('0x4'),'getsecretdigits'];var Graph=function(){this[_0xb793('0x5')]={};this[_0xb793('0x6')]={};this['numberOfEdges']=0x0;};Graph['prototype'][_0xb793('0x7')]=function(_0x3cb1c8){this[_0xb793('0x5')][_0x3cb1c8['id']]=_0x3cb1c8;this[_0xb793('0x6')][_0x3cb1c8['id']]=[];};Graph[_0xb793('0x8')][_0xb793('0x9')]=function(_0x134ac4,_0x23a718,_0x149720){this[_0xb793('0x6')][_0x134ac4][_0xb793('0xa')]({'target':_0x23a718,'condition':_0x149720});this[_0xb793('0xb')]+=0x1;};Graph[_0xb793('0x8')][_0xb793('0xc')]=function(){return _['size'](this[_0xb793('0x5')]);};Graph[_0xb793('0x8')]['relations']=function(){return this['numberOfEdges'];};Graph[_0xb793('0x8')][_0xb793('0xd')]=function(_0x56d568){return this[_0xb793('0x5')][_0x56d568];};Graph[_0xb793('0x8')]['traverseBFS']=function(_0x13d536,_0x164088){if(!this[_0xb793('0x5')][_0x13d536]){return logger[_0xb793('0xe')](_0xb793('0xf'));}var _0x1823ff=_0x164088(this[_0xb793('0x5')][_0x13d536]);if(!_0x1823ff){return logger['info'](_0xb793('0x10'));}if(this['edges'][_0x13d536]['length']===0x0){return logger[_0xb793('0xe')](_0xb793('0x11'));}for(var _0x115165=0x0,_0x1ff6cb=[],_0x38d9f2=![];_0x115165<this[_0xb793('0x6')][_0x13d536][_0xb793('0x12')];_0x115165+=0x1){if(this[_0xb793('0x6')][_0x13d536][_0x115165][_0xb793('0x13')]){_0x1ff6cb=this[_0xb793('0x6')][_0x13d536][_0x115165][_0xb793('0x13')][_0xb793('0x14')](',');for(var _0xeb9559=0x0;_0xeb9559<_0x1ff6cb[_0xb793('0x12')];_0xeb9559+=0x1){if(this[_0xb793('0x5')][_0x13d536][_0xb793('0x15')]==='vswitch'&&_0x1ff6cb[_0xeb9559]==='-'){_0x38d9f2=this[_0xb793('0x6')][_0x13d536][_0x115165][_0xb793('0x16')];logger['info'](_0xb793('0x17'),_0x1ff6cb[_0xeb9559],this[_0xb793('0x6')][_0x13d536][_0x115165][_0xb793('0x16')]);}else if(this[_0xb793('0x5')][_0x13d536][_0xb793('0x15')]==='menu'&&_0x1ff6cb[_0xeb9559]==='i'){_0x38d9f2=this['edges'][_0x13d536][_0x115165][_0xb793('0x16')];logger[_0xb793('0xe')](_0xb793('0x18'),_0x1ff6cb[_0xeb9559],this[_0xb793('0x6')][_0x13d536][_0x115165][_0xb793('0x16')]);}if(_0x1ff6cb[_0xeb9559]===_0x1823ff){return this[_0xb793('0x19')](this[_0xb793('0x6')][_0x13d536][_0x115165][_0xb793('0x16')],_0x164088);}}}else{return this['traverseBFS'](this[_0xb793('0x6')][_0x13d536][_0x115165][_0xb793('0x16')],_0x164088);}}if(_0x1ff6cb[_0xb793('0x12')]){if(this[_0xb793('0x5')][_0x13d536][_0xb793('0x15')]===_0xb793('0x1a')){if(_0x38d9f2){return this[_0xb793('0x19')](_0x38d9f2,_0x164088);}return logger['info'](_0xb793('0x1b'));}else if(_[_0xb793('0x1c')](verticesWithRetry,this[_0xb793('0x5')][_0x13d536][_0xb793('0x15')])){if(_0x1823ff==='-'){return logger[_0xb793('0xe')](_0xb793('0x1d'));}if(_0x38d9f2&&_0x1823ff!=='t'){return this['traverseBFS'](_0x38d9f2,_0x164088);}return this[_0xb793('0x19')](_0x13d536,_0x164088);}return logger[_0xb793('0xe')](_0xb793('0x1e'));}};module['exports']=Graph;
\ No newline at end of file
+var _0x55ea=['addEdge','push','prototype','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','length','no\x20edge/s\x20available','condition','split','target','default','agicommand','menu','vswitch','default\x20on\x20switch\x20not\x20found','includes','condition\x20not\x20found','lodash','../../../config/logger','agi','getdigits','getsecretdigits','vertices','edges','numberOfEdges','addVertex'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x55ea,0xc9));var _0xa55e=function(_0x3ba370,_0x1fab8a){_0x3ba370=_0x3ba370-0x0;var _0x298827=_0x55ea[_0x3ba370];return _0x298827;};'use strict';var _=require(_0xa55e('0x0'));var logger=require(_0xa55e('0x1'))(_0xa55e('0x2'));var verticesWithRetry=['menu',_0xa55e('0x3'),_0xa55e('0x4')];var Graph=function(){this[_0xa55e('0x5')]={};this[_0xa55e('0x6')]={};this[_0xa55e('0x7')]=0x0;};Graph['prototype'][_0xa55e('0x8')]=function(_0x56ca45){this['vertices'][_0x56ca45['id']]=_0x56ca45;this['edges'][_0x56ca45['id']]=[];};Graph['prototype'][_0xa55e('0x9')]=function(_0x20f2ac,_0x30b885,_0xca9526){this[_0xa55e('0x6')][_0x20f2ac][_0xa55e('0xa')]({'target':_0x30b885,'condition':_0xca9526});this[_0xa55e('0x7')]+=0x1;};Graph[_0xa55e('0xb')][_0xa55e('0xc')]=function(){return _['size'](this['vertices']);};Graph[_0xa55e('0xb')][_0xa55e('0xd')]=function(){return this[_0xa55e('0x7')];};Graph[_0xa55e('0xb')][_0xa55e('0xe')]=function(_0x5e38dd){return this[_0xa55e('0x5')][_0x5e38dd];};Graph['prototype'][_0xa55e('0xf')]=function(_0x1d45c1,_0x153f71){if(!this[_0xa55e('0x5')][_0x1d45c1]){return logger[_0xa55e('0x10')](_0xa55e('0x11'));}var _0x15a283=_0x153f71(this[_0xa55e('0x5')][_0x1d45c1]);if(!_0x15a283){return logger[_0xa55e('0x10')]('stop\x20traverse');}if(this[_0xa55e('0x6')][_0x1d45c1][_0xa55e('0x12')]===0x0){return logger[_0xa55e('0x10')](_0xa55e('0x13'));}for(var _0x303698=0x0,_0x339f1e=[],_0x585d3a=![];_0x303698<this[_0xa55e('0x6')][_0x1d45c1]['length'];_0x303698+=0x1){if(this['edges'][_0x1d45c1][_0x303698][_0xa55e('0x14')]){_0x339f1e=this[_0xa55e('0x6')][_0x1d45c1][_0x303698][_0xa55e('0x14')][_0xa55e('0x15')](',');for(var _0x3980b4=0x0;_0x3980b4<_0x339f1e['length'];_0x3980b4+=0x1){if(this[_0xa55e('0x5')][_0x1d45c1]['agicommand']==='vswitch'&&_0x339f1e[_0x3980b4]==='-'){_0x585d3a=this[_0xa55e('0x6')][_0x1d45c1][_0x303698][_0xa55e('0x16')];logger[_0xa55e('0x10')](_0xa55e('0x17'),_0x339f1e[_0x3980b4],this[_0xa55e('0x6')][_0x1d45c1][_0x303698][_0xa55e('0x16')]);}else if(this[_0xa55e('0x5')][_0x1d45c1][_0xa55e('0x18')]===_0xa55e('0x19')&&_0x339f1e[_0x3980b4]==='i'){_0x585d3a=this['edges'][_0x1d45c1][_0x303698]['target'];logger[_0xa55e('0x10')]('invalid',_0x339f1e[_0x3980b4],this[_0xa55e('0x6')][_0x1d45c1][_0x303698][_0xa55e('0x16')]);}if(_0x339f1e[_0x3980b4]===_0x15a283){return this[_0xa55e('0xf')](this[_0xa55e('0x6')][_0x1d45c1][_0x303698][_0xa55e('0x16')],_0x153f71);}}}else{return this[_0xa55e('0xf')](this[_0xa55e('0x6')][_0x1d45c1][_0x303698][_0xa55e('0x16')],_0x153f71);}}if(_0x339f1e[_0xa55e('0x12')]){if(this[_0xa55e('0x5')][_0x1d45c1][_0xa55e('0x18')]===_0xa55e('0x1a')){if(_0x585d3a){return this[_0xa55e('0xf')](_0x585d3a,_0x153f71);}return logger[_0xa55e('0x10')](_0xa55e('0x1b'));}else if(_[_0xa55e('0x1c')](verticesWithRetry,this[_0xa55e('0x5')][_0x1d45c1][_0xa55e('0x18')])){if(_0x15a283==='-'){return logger[_0xa55e('0x10')]('max\x20retry\x20reach');}if(_0x585d3a&&_0x15a283!=='t'){return this['traverseBFS'](_0x585d3a,_0x153f71);}return this[_0xa55e('0xf')](_0x1d45c1,_0x153f71);}return logger['info'](_0xa55e('0x1d'));}};module['exports']=Graph;
\ No newline at end of file
index df079c4..3ca181a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x29d4=['[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','evtHangup','toJson','mxGraphModel','root','agicommand','retry','maxRetry','addVertex','mxCell','isArray','length','source','target','addEdge','value','getSquareProject','then','catch','createSquareReport','hasOwnProperty','indexOf','debug','close','timeout','sync','production','start','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','omit','traverseBFS','clear','context','extension','priority','response','code','isUndefined','result','toString','finally','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','Project\x20%s\x20not\x20published','continueAt','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','syncho','util','moment','../../config/environment','../../config/logger','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','agi','defaults','error','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','[%s]\x20%s','message'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x29d4,0x1a1));var _0x429d=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x29d4[_0x2b10c6];return _0x3789d2;};'use strict';var parser=require(_0x429d('0x0'));var _=require('lodash');var syncho=require(_0x429d('0x1'));var util=require(_0x429d('0x2'));var moment=require(_0x429d('0x3'));var config=require(_0x429d('0x4'));var logger=require(_0x429d('0x5'))('agi');var utilLicense=require(_0x429d('0x6'));var rpc=require(_0x429d('0x7'));var mailRpc=require(_0x429d('0x8'));var Graph=require(_0x429d('0x9'));var Vertices=require(_0x429d('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x429d('0xb')]=_[_0x429d('0xc')](config[_0x429d('0xb')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x9fc337){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x9fc337);agiHandler(_0x9fc337);}catch(_0x471129){logger[_0x429d('0xd')](_0x471129[_0x429d('0xe')]);}});});}function listeningHandler(){console['log'](_0x429d('0xf'),config[_0x429d('0xb')]['port']);logger[_0x429d('0x10')](util[_0x429d('0x11')](_0x429d('0x12'),config['agi']['ip'],config[_0x429d('0xb')][_0x429d('0x13')]));}function errorHandler(_0x1d933b){if(_0x1d933b&&_0x1d933b[_0x429d('0x14')]&&_0x1d933b['message']){logger[_0x429d('0xd')](util[_0x429d('0x11')](_0x429d('0x15'),_0x1d933b['name'],_0x1d933b[_0x429d('0x16')]));}else{logger[_0x429d('0xd')](util['format'](_0x429d('0x17'),_0x1d933b[_0x429d('0xe')]));}}function closeHandler(){logger[_0x429d('0x10')](util[_0x429d('0x11')](_0x429d('0x18'),this[_0x429d('0x19')],this['calleridname'],this[_0x429d('0x1a')],this['dnid'],this[_0x429d('0x1b')]));try{createSquareReport(this);}catch(_0x35830e){logger[_0x429d('0xd')](_0x35830e[_0x429d('0xe')]);}}function timeoutHandler(){logger['info'](util[_0x429d('0x11')](_0x429d('0x1c'),this[_0x429d('0x19')],this['calleridname'],this[_0x429d('0x1a')],this[_0x429d('0x1d')],this[_0x429d('0x1b')]));}function hangupHandler(){logger[_0x429d('0x10')](util[_0x429d('0x11')](_0x429d('0x1e'),this['arg_1'],this[_0x429d('0x1f')],this[_0x429d('0x1a')],this[_0x429d('0x1d')],this['uniqueid']));this[_0x429d('0x20')]=!![];}function getRoot(_0x13fc71){return parser[_0x429d('0x21')](_0x13fc71,{'object':!![]})[_0x429d('0x22')][_0x429d('0x23')];}function addVertex(_0x1023e6,_0x4c6d89,_0x28f84e){_0x4c6d89[_0x429d('0x24')]=_0x28f84e;if(_0x4c6d89['hasOwnProperty'](_0x429d('0x25'))){_0x4c6d89[_0x429d('0x26')]=parseInt(_0x4c6d89[_0x429d('0x25')],0xa);}_0x1023e6[_0x429d('0x27')](_['omit'](_0x4c6d89,_0x429d('0x28')));}function initGraph(_0x415b92,_0x387639){var _0x3896ee=new Graph();for(var _0x3e4e73 in _0x415b92){if(_0x415b92['hasOwnProperty'](_0x3e4e73)){if(_[_0x429d('0x29')](_0x415b92[_0x3e4e73])){for(var _0x2209aa=0x0;_0x2209aa<_0x415b92[_0x3e4e73][_0x429d('0x2a')];_0x2209aa+=0x1){addVertex(_0x3896ee,_0x415b92[_0x3e4e73][_0x2209aa],_0x3e4e73);}}else{addVertex(_0x3896ee,_0x415b92[_0x3e4e73],_0x3e4e73);}}}for(var _0x1cba36=0x0;_0x1cba36<_0x387639[_0x429d('0x2a')];_0x1cba36+=0x1){if(_0x387639[_0x1cba36][_0x429d('0x2b')]&&_0x387639[_0x1cba36][_0x429d('0x2c')]){_0x3896ee[_0x429d('0x2d')](_0x387639[_0x1cba36][_0x429d('0x2b')],_0x387639[_0x1cba36]['target'],_0x387639[_0x1cba36][_0x429d('0x2e')]);}}return _0x3896ee;}function getSquareProject(_0x3ca640,_0x5bdb2d){rpc[_0x429d('0x2f')](_0x3ca640)[_0x429d('0x30')](function(_0x2e95b5){_0x5bdb2d(null,_0x2e95b5);})[_0x429d('0x31')](function(_0x3394a8){_0x5bdb2d(null,_0x3394a8);});}function createSquareReport(_0x481122,_0x3b51ae){rpc[_0x429d('0x32')](_0x481122)[_0x429d('0x30')](function(_0x1dae60){if(_0x3b51ae){_0x3b51ae(null,_0x1dae60);}})[_0x429d('0x31')](function(_0x1b98ad){if(_0x3b51ae){_0x3b51ae(null,_0x1b98ad);}});}function setChannelVariables(_0x4dcacd){for(var _0x559bd5 in _0x4dcacd){if(_0x4dcacd[_0x429d('0x33')](_0x559bd5)){if(_0x559bd5[_0x429d('0x34')]('agi_')===0x0){_0x4dcacd[_0x559bd5['substring'](0x4)]=_0x4dcacd[_0x559bd5];delete _0x4dcacd[_0x559bd5];}}}}function getLogFromObject(_0x21dc7e){return util['inspect'](_0x21dc7e,{'showHidden':![],'depth':null});}function agiHandler(_0x1992ca){var _0x3ba3aa,_0x20e11a,_0x1b223e,_0x5484b3,_0x10c023;logger[_0x429d('0x35')]('variables',JSON['stringify'](_0x1992ca,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',_0x1992ca[_0x429d('0x19')],_0x1992ca['calleridname'],_0x1992ca['callerid'],_0x1992ca[_0x429d('0x1d')],_0x1992ca[_0x429d('0x1b')]));_0x1992ca['on'](_0x429d('0xd'),errorHandler);_0x1992ca['on'](_0x429d('0x36'),closeHandler);_0x1992ca['on'](_0x429d('0x37'),timeoutHandler);_0x1992ca[_0x429d('0x20')]=![];_0x1992ca['on']('hangup',hangupHandler);var _0x423dc8=getSquareProject[_0x429d('0x38')](null,_0x1992ca[_0x429d('0x19')]);if(_0x423dc8){if(_0x423dc8[_0x429d('0x39')]){_0x3ba3aa=getRoot(_0x423dc8[_0x429d('0x39')]);if(_0x3ba3aa&&_0x3ba3aa[_0x429d('0x3a')]){logger[_0x429d('0x35')](_0x429d('0x23'),JSON[_0x429d('0x3b')](_0x3ba3aa,null,0x2));_0x1992ca[_0x429d('0x3c')]=moment()[_0x429d('0x11')](_0x429d('0x3d'));_0x20e11a=initGraph(_[_0x429d('0x3e')](_0x3ba3aa,_0x429d('0x28')),_0x3ba3aa[_0x429d('0x28')]);_0x1b223e=new Vertices(_0x1992ca,rpc,mailRpc);logger[_0x429d('0x10')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1992ca[_0x429d('0x19')],_0x1992ca[_0x429d('0x1f')],_0x1992ca['callerid'],_0x1992ca[_0x429d('0x1d')],_0x1992ca[_0x429d('0x1b')]));_0x20e11a[_0x429d('0x3f')](_0x3ba3aa['start']['id'],function(_0x50a907){try{_0x50a907=_0x1b223e[_0x429d('0x40')](_0x50a907);logger[_0x429d('0x35')]('vertex',JSON[_0x429d('0x3b')](_0x50a907,null,0x2));if(_0x50a907[_0x429d('0x24')]==='gotoc'){logger[_0x429d('0x10')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x1992ca[_0x429d('0x41')]=_0x50a907[_0x429d('0x41')]||_0x1992ca[_0x429d('0x41')];_0x1992ca[_0x429d('0x42')]=_0x50a907['extension'];_0x1992ca[_0x429d('0x43')]=_0x50a907[_0x429d('0x43')]?_0x50a907[_0x429d('0x43')]-0x1:0x1;return null;}else if(_0x50a907&&_0x1b223e[_0x50a907['agicommand']]){_0x10c023=_0x1b223e[_0x50a907['agicommand']](_0x50a907);logger[_0x429d('0x10')](_0x429d('0x44'),JSON[_0x429d('0x3b')](_0x10c023,null,0x2));if(_0x10c023&&_0x10c023[_0x429d('0x45')]===AGI_CODE_SUCCESS&&_0x10c023['result']!==AGI_RESULT_ERROR&&!_0x1992ca[_0x429d('0x20')]){logger[_0x429d('0x35')](_0x429d('0x44'),getLogFromObject(_0x10c023));return _[_0x429d('0x46')](_0x10c023[_0x429d('0x47')])?null:_0x10c023[_0x429d('0x47')][_0x429d('0x48')]();}else{logger[_0x429d('0xd')](_0x429d('0x44'),getLogFromObject(_0x10c023));return null;}}else{logger[_0x429d('0xd')]('agicommand\x20not\x20found');return null;}}catch(_0x2de550){logger['error'](_0x2de550['stack']);return null;}});if(_0x3ba3aa['finally']){logger[_0x429d('0x10')](util[_0x429d('0x11')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1992ca[_0x429d('0x19')],_0x1992ca[_0x429d('0x1f')],_0x1992ca['callerid'],_0x1992ca[_0x429d('0x1d')],_0x1992ca[_0x429d('0x1b')]));_0x20e11a[_0x429d('0x3f')](_0x3ba3aa[_0x429d('0x49')]['id'],function(_0x49d5ff){try{_0x49d5ff=_0x1b223e['clear'](_0x49d5ff);logger[_0x429d('0x35')](_0x429d('0x4a'),JSON[_0x429d('0x3b')](_0x49d5ff,null,0x2));if(_0x49d5ff&&_0x1b223e[_0x49d5ff[_0x429d('0x24')]]){_0x10c023=_0x1b223e[_0x49d5ff['agicommand']](_0x49d5ff);if(_0x10c023){logger[_0x429d('0x35')](_0x429d('0x44'),getLogFromObject(_0x10c023));return _[_0x429d('0x46')](_0x10c023['result'])?null:_0x10c023[_0x429d('0x47')]['toString']();}else{logger[_0x429d('0xd')](_0x429d('0x44'),getLogFromObject(_0x10c023));return null;}}else{logger[_0x429d('0xd')]('agicommand\x20not\x20found');return null;}}catch(_0x4aa914){logger[_0x429d('0xd')](_0x4aa914['stack']);return null;}});}logger[_0x429d('0x10')](util[_0x429d('0x11')](_0x429d('0x4b'),_0x1992ca[_0x429d('0x19')],_0x1992ca[_0x429d('0x1f')],_0x1992ca[_0x429d('0x1a')],_0x1992ca[_0x429d('0x1d')],_0x1992ca[_0x429d('0x1b')]));logger['info'](util['format'](_0x429d('0x4c'),_0x1992ca[_0x429d('0x41')],_0x1992ca[_0x429d('0x42')],parseInt(_0x1992ca[_0x429d('0x43')],0xa)+0x1));_0x1992ca['continueAt'](_0x1992ca[_0x429d('0x41')],_0x1992ca[_0x429d('0x42')],parseInt(_0x1992ca[_0x429d('0x43')],0xa)+0x1);_0x1992ca[_0x429d('0x36')]();}}else{logger[_0x429d('0xd')](util[_0x429d('0x11')](_0x429d('0x4d'),_0x1992ca[_0x429d('0x19')]));_0x1992ca[_0x429d('0x4e')](_0x1992ca[_0x429d('0x41')],_0x1992ca['extension'],parseInt(_0x1992ca[_0x429d('0x43')],0xa)+0x1);_0x1992ca[_0x429d('0x36')]();}}else{logger[_0x429d('0xd')](util[_0x429d('0x11')](_0x429d('0x4f'),_0x1992ca[_0x429d('0x19')]));_0x1992ca[_0x429d('0x4e')](_0x1992ca['context'],_0x1992ca[_0x429d('0x42')],parseInt(_0x1992ca[_0x429d('0x43')],0xa)+0x1);_0x1992ca[_0x429d('0x36')]();}}function main(){var _0x473119;return utilLicense['getLicense']()[_0x429d('0x30')](function(_0x4aee2d){if(_0x4aee2d){if(_0x4aee2d[_0x429d('0x50')]){if(_0x4aee2d['callysquare']&&_0x4aee2d['callysquare']>0x0){logger[_0x429d('0x10')](util[_0x429d('0x11')]('[LICENSE]\x20CHANNELS:\x20%s',_0x4aee2d[_0x429d('0x51')]));_0x473119=_0x4aee2d[_0x429d('0x51')];}else{logger['info'](_0x429d('0x52'));}}else{logger[_0x429d('0x10')](_0x429d('0x53'));_0x473119=-0x1;}}})[_0x429d('0x31')](function(_0x57f307){logger[_0x429d('0xd')](_0x429d('0x54'),_0x57f307[_0x429d('0xe')]);})[_0x429d('0x49')](function(){var _0x2a32e3=require(_0x429d('0x55'))(config[_0x429d('0xb')][_0x429d('0x13')],config[_0x429d('0xb')]['ip'],_0x473119);_0x2a32e3['on'](_0x429d('0xd'),errorHandler);_0x2a32e3['on'](_0x429d('0x56'),listeningHandler);_0x2a32e3['on'](_0x429d('0x57'),connectionHandler);_0x2a32e3['on'](_0x429d('0x36'),closeHandler);});}main();
\ No newline at end of file
+var _0x8ece=['catch','createSquareReport','indexOf','agi_','substring','inspect','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','production','start','debug','root','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','toString','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','clear','isUndefined','agicommand\x20not\x20found','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','xml2json','lodash','syncho','util','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./vertices','defaults','127.0.0.1','nextTick','error','log','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[ERROR]\x20%s','stack','arg_1','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','source','target','value','then'];(function(_0x2732aa,_0x103f42){var _0x2d1e29=function(_0x547fc7){while(--_0x547fc7){_0x2732aa['push'](_0x2732aa['shift']());}};_0x2d1e29(++_0x103f42);}(_0x8ece,0x195));var _0xe8ec=function(_0x4a5705,_0x185c73){_0x4a5705=_0x4a5705-0x0;var _0x4d73e1=_0x8ece[_0x4a5705];return _0x4d73e1;};'use strict';var parser=require(_0xe8ec('0x0'));var _=require(_0xe8ec('0x1'));var syncho=require(_0xe8ec('0x2'));var util=require(_0xe8ec('0x3'));var moment=require('moment');var config=require('../../config/environment');var logger=require(_0xe8ec('0x4'))(_0xe8ec('0x5'));var utilLicense=require(_0xe8ec('0x6'));var rpc=require(_0xe8ec('0x7'));var mailRpc=require(_0xe8ec('0x8'));var Graph=require('./graph');var Vertices=require(_0xe8ec('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xe8ec('0x5')]=_[_0xe8ec('0xa')](config[_0xe8ec('0x5')],{'ip':_0xe8ec('0xb'),'port':0x11dd});function connectionHandler(_0x122f36){process[_0xe8ec('0xc')](function(){syncho(function(){try{setChannelVariables(_0x122f36);agiHandler(_0x122f36);}catch(_0x5525f8){logger[_0xe8ec('0xd')](_0x5525f8['stack']);}});});}function listeningHandler(){console[_0xe8ec('0xe')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xe8ec('0x5')][_0xe8ec('0xf')]);logger[_0xe8ec('0x10')](util[_0xe8ec('0x11')](_0xe8ec('0x12'),config[_0xe8ec('0x5')]['ip'],config[_0xe8ec('0x5')][_0xe8ec('0xf')]));}function errorHandler(_0x4f361f){if(_0x4f361f&&_0x4f361f[_0xe8ec('0x13')]&&_0x4f361f[_0xe8ec('0x14')]){logger[_0xe8ec('0xd')](util[_0xe8ec('0x11')]('[%s]\x20%s',_0x4f361f[_0xe8ec('0x13')],_0x4f361f[_0xe8ec('0x14')]));}else{logger[_0xe8ec('0xd')](util[_0xe8ec('0x11')](_0xe8ec('0x15'),_0x4f361f[_0xe8ec('0x16')]));}}function closeHandler(){logger[_0xe8ec('0x10')](util[_0xe8ec('0x11')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xe8ec('0x17')],this[_0xe8ec('0x18')],this[_0xe8ec('0x19')],this['dnid'],this[_0xe8ec('0x1a')]));try{createSquareReport(this);}catch(_0x20e847){logger[_0xe8ec('0xd')](_0x20e847[_0xe8ec('0x16')]);}}function timeoutHandler(){logger[_0xe8ec('0x10')](util[_0xe8ec('0x11')](_0xe8ec('0x1b'),this[_0xe8ec('0x17')],this['calleridname'],this[_0xe8ec('0x19')],this[_0xe8ec('0x1c')],this[_0xe8ec('0x1a')]));}function hangupHandler(){logger[_0xe8ec('0x10')](util[_0xe8ec('0x11')](_0xe8ec('0x1d'),this[_0xe8ec('0x17')],this[_0xe8ec('0x18')],this[_0xe8ec('0x19')],this['dnid'],this[_0xe8ec('0x1a')]));this[_0xe8ec('0x1e')]=!![];}function getRoot(_0x3de125){return parser[_0xe8ec('0x1f')](_0x3de125,{'object':!![]})[_0xe8ec('0x20')]['root'];}function addVertex(_0x2e05d8,_0x78b6f4,_0x431af0){_0x78b6f4[_0xe8ec('0x21')]=_0x431af0;if(_0x78b6f4[_0xe8ec('0x22')](_0xe8ec('0x23'))){_0x78b6f4['maxRetry']=parseInt(_0x78b6f4['retry'],0xa);}_0x2e05d8[_0xe8ec('0x24')](_[_0xe8ec('0x25')](_0x78b6f4,_0xe8ec('0x26')));}function initGraph(_0x2966d7,_0xbec801){var _0x3519a5=new Graph();for(var _0x267356 in _0x2966d7){if(_0x2966d7[_0xe8ec('0x22')](_0x267356)){if(_[_0xe8ec('0x27')](_0x2966d7[_0x267356])){for(var _0x2e2d47=0x0;_0x2e2d47<_0x2966d7[_0x267356][_0xe8ec('0x28')];_0x2e2d47+=0x1){addVertex(_0x3519a5,_0x2966d7[_0x267356][_0x2e2d47],_0x267356);}}else{addVertex(_0x3519a5,_0x2966d7[_0x267356],_0x267356);}}}for(var _0x1b314d=0x0;_0x1b314d<_0xbec801[_0xe8ec('0x28')];_0x1b314d+=0x1){if(_0xbec801[_0x1b314d][_0xe8ec('0x29')]&&_0xbec801[_0x1b314d][_0xe8ec('0x2a')]){_0x3519a5['addEdge'](_0xbec801[_0x1b314d][_0xe8ec('0x29')],_0xbec801[_0x1b314d][_0xe8ec('0x2a')],_0xbec801[_0x1b314d][_0xe8ec('0x2b')]);}}return _0x3519a5;}function getSquareProject(_0x52c0b1,_0x28cd63){rpc['getSquareProject'](_0x52c0b1)[_0xe8ec('0x2c')](function(_0x3b27d3){_0x28cd63(null,_0x3b27d3);})[_0xe8ec('0x2d')](function(_0xb5fcbb){_0x28cd63(null,_0xb5fcbb);});}function createSquareReport(_0x9c83b9,_0x4a89b9){rpc[_0xe8ec('0x2e')](_0x9c83b9)[_0xe8ec('0x2c')](function(_0x357119){if(_0x4a89b9){_0x4a89b9(null,_0x357119);}})['catch'](function(_0x2bc9e4){if(_0x4a89b9){_0x4a89b9(null,_0x2bc9e4);}});}function setChannelVariables(_0x4bfb2a){for(var _0x469f79 in _0x4bfb2a){if(_0x4bfb2a[_0xe8ec('0x22')](_0x469f79)){if(_0x469f79[_0xe8ec('0x2f')](_0xe8ec('0x30'))===0x0){_0x4bfb2a[_0x469f79[_0xe8ec('0x31')](0x4)]=_0x4bfb2a[_0x469f79];delete _0x4bfb2a[_0x469f79];}}}}function getLogFromObject(_0x757785){return util[_0xe8ec('0x32')](_0x757785,{'showHidden':![],'depth':null});}function agiHandler(_0x2277cc){var _0x7a1722,_0x538be3,_0x1191b3,_0x145f3e,_0x18cd13;logger['debug'](_0xe8ec('0x33'),JSON[_0xe8ec('0x34')](_0x2277cc,null,0x2));logger['info'](util[_0xe8ec('0x11')](_0xe8ec('0x35'),_0x2277cc[_0xe8ec('0x17')],_0x2277cc[_0xe8ec('0x18')],_0x2277cc['callerid'],_0x2277cc[_0xe8ec('0x1c')],_0x2277cc[_0xe8ec('0x1a')]));_0x2277cc['on'](_0xe8ec('0xd'),errorHandler);_0x2277cc['on'](_0xe8ec('0x36'),closeHandler);_0x2277cc['on'](_0xe8ec('0x37'),timeoutHandler);_0x2277cc[_0xe8ec('0x1e')]=![];_0x2277cc['on'](_0xe8ec('0x38'),hangupHandler);var _0x29f78a=getSquareProject['sync'](null,_0x2277cc['arg_1']);if(_0x29f78a){if(_0x29f78a[_0xe8ec('0x39')]){_0x7a1722=getRoot(_0x29f78a[_0xe8ec('0x39')]);if(_0x7a1722&&_0x7a1722[_0xe8ec('0x3a')]){logger[_0xe8ec('0x3b')](_0xe8ec('0x3c'),JSON[_0xe8ec('0x34')](_0x7a1722,null,0x2));_0x2277cc[_0xe8ec('0x3d')]=moment()['format'](_0xe8ec('0x3e'));_0x538be3=initGraph(_['omit'](_0x7a1722,_0xe8ec('0x26')),_0x7a1722[_0xe8ec('0x26')]);_0x1191b3=new Vertices(_0x2277cc,rpc,mailRpc);logger['info'](util['format'](_0xe8ec('0x3f'),_0x2277cc[_0xe8ec('0x17')],_0x2277cc[_0xe8ec('0x18')],_0x2277cc['callerid'],_0x2277cc[_0xe8ec('0x1c')],_0x2277cc[_0xe8ec('0x1a')]));_0x538be3[_0xe8ec('0x40')](_0x7a1722[_0xe8ec('0x3a')]['id'],function(_0x3d52c9){try{_0x3d52c9=_0x1191b3['clear'](_0x3d52c9);logger['debug'](_0xe8ec('0x41'),JSON['stringify'](_0x3d52c9,null,0x2));if(_0x3d52c9[_0xe8ec('0x21')]===_0xe8ec('0x42')){logger[_0xe8ec('0x10')](_0xe8ec('0x43'));_0x2277cc[_0xe8ec('0x44')]=_0x3d52c9[_0xe8ec('0x44')]||_0x2277cc[_0xe8ec('0x44')];_0x2277cc['extension']=_0x3d52c9[_0xe8ec('0x45')];_0x2277cc[_0xe8ec('0x46')]=_0x3d52c9[_0xe8ec('0x46')]?_0x3d52c9[_0xe8ec('0x46')]-0x1:0x1;return null;}else if(_0x3d52c9&&_0x1191b3[_0x3d52c9[_0xe8ec('0x21')]]){_0x18cd13=_0x1191b3[_0x3d52c9[_0xe8ec('0x21')]](_0x3d52c9);logger[_0xe8ec('0x10')](_0xe8ec('0x47'),JSON['stringify'](_0x18cd13,null,0x2));if(_0x18cd13&&_0x18cd13[_0xe8ec('0x48')]===AGI_CODE_SUCCESS&&_0x18cd13[_0xe8ec('0x49')]!==AGI_RESULT_ERROR&&!_0x2277cc[_0xe8ec('0x1e')]){logger['debug'](_0xe8ec('0x47'),getLogFromObject(_0x18cd13));return _['isUndefined'](_0x18cd13[_0xe8ec('0x49')])?null:_0x18cd13[_0xe8ec('0x49')][_0xe8ec('0x4a')]();}else{logger['error'](_0xe8ec('0x47'),getLogFromObject(_0x18cd13));return null;}}else{logger[_0xe8ec('0xd')]('agicommand\x20not\x20found');return null;}}catch(_0x1479c3){logger['error'](_0x1479c3[_0xe8ec('0x16')]);return null;}});if(_0x7a1722['finally']){logger[_0xe8ec('0x10')](util[_0xe8ec('0x11')](_0xe8ec('0x4b'),_0x2277cc[_0xe8ec('0x17')],_0x2277cc['calleridname'],_0x2277cc['callerid'],_0x2277cc['dnid'],_0x2277cc[_0xe8ec('0x1a')]));_0x538be3[_0xe8ec('0x40')](_0x7a1722[_0xe8ec('0x4c')]['id'],function(_0x5a900e){try{_0x5a900e=_0x1191b3[_0xe8ec('0x4d')](_0x5a900e);logger[_0xe8ec('0x3b')](_0xe8ec('0x41'),JSON[_0xe8ec('0x34')](_0x5a900e,null,0x2));if(_0x5a900e&&_0x1191b3[_0x5a900e[_0xe8ec('0x21')]]){_0x18cd13=_0x1191b3[_0x5a900e['agicommand']](_0x5a900e);if(_0x18cd13){logger[_0xe8ec('0x3b')](_0xe8ec('0x47'),getLogFromObject(_0x18cd13));return _[_0xe8ec('0x4e')](_0x18cd13[_0xe8ec('0x49')])?null:_0x18cd13[_0xe8ec('0x49')][_0xe8ec('0x4a')]();}else{logger[_0xe8ec('0xd')]('response',getLogFromObject(_0x18cd13));return null;}}else{logger[_0xe8ec('0xd')](_0xe8ec('0x4f'));return null;}}catch(_0x59dc46){logger[_0xe8ec('0xd')](_0x59dc46[_0xe8ec('0x16')]);return null;}});}logger[_0xe8ec('0x10')](util[_0xe8ec('0x11')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2277cc[_0xe8ec('0x17')],_0x2277cc[_0xe8ec('0x18')],_0x2277cc[_0xe8ec('0x19')],_0x2277cc[_0xe8ec('0x1c')],_0x2277cc[_0xe8ec('0x1a')]));logger[_0xe8ec('0x10')](util['format'](_0xe8ec('0x50'),_0x2277cc[_0xe8ec('0x44')],_0x2277cc['extension'],parseInt(_0x2277cc['priority'],0xa)+0x1));_0x2277cc[_0xe8ec('0x51')](_0x2277cc['context'],_0x2277cc['extension'],parseInt(_0x2277cc[_0xe8ec('0x46')],0xa)+0x1);_0x2277cc[_0xe8ec('0x36')]();}}else{logger[_0xe8ec('0xd')](util[_0xe8ec('0x11')](_0xe8ec('0x52'),_0x2277cc[_0xe8ec('0x17')]));_0x2277cc['continueAt'](_0x2277cc['context'],_0x2277cc[_0xe8ec('0x45')],parseInt(_0x2277cc[_0xe8ec('0x46')],0xa)+0x1);_0x2277cc['close']();}}else{logger['error'](util[_0xe8ec('0x11')](_0xe8ec('0x53'),_0x2277cc[_0xe8ec('0x17')]));_0x2277cc['continueAt'](_0x2277cc['context'],_0x2277cc[_0xe8ec('0x45')],parseInt(_0x2277cc[_0xe8ec('0x46')],0xa)+0x1);_0x2277cc[_0xe8ec('0x36')]();}}function main(){var _0x20a431;return utilLicense['getLicense']()['then'](function(_0x17d1e4){if(_0x17d1e4){if(_0x17d1e4['voice']){if(_0x17d1e4[_0xe8ec('0x54')]&&_0x17d1e4[_0xe8ec('0x54')]>0x0){logger['info'](util[_0xe8ec('0x11')]('[LICENSE]\x20CHANNELS:\x20%s',_0x17d1e4[_0xe8ec('0x54')]));_0x20a431=_0x17d1e4['callysquare'];}else{logger[_0xe8ec('0x10')](_0xe8ec('0x55'));}}else{logger[_0xe8ec('0x10')](_0xe8ec('0x56'));_0x20a431=-0x1;}}})[_0xe8ec('0x2d')](function(_0x30a9b0){logger['error'](_0xe8ec('0x57'),_0x30a9b0['stack']);})[_0xe8ec('0x4c')](function(){var _0x1184aa=require(_0xe8ec('0x58'))(config[_0xe8ec('0x5')][_0xe8ec('0xf')],config['agi']['ip'],_0x20a431);_0x1184aa['on'](_0xe8ec('0xd'),errorHandler);_0x1184aa['on'](_0xe8ec('0x59'),listeningHandler);_0x1184aa['on']('connection',connectionHandler);_0x1184aa['on']('close',closeHandler);});}main();
\ No newline at end of file
index 6766b58..66da147 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x215379,_0x580364){var _0x4e880e=function(_0xe0a029){while(--_0xe0a029){_0x215379['push'](_0x215379['shift']());}};_0x4e880e(++_0x580364);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});};
\ No newline at end of file
+var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x2c58c3,_0x4002b5){var _0x9b3d90=function(_0x5562c8){while(--_0x5562c8){_0x2c58c3['push'](_0x2c58c3['shift']());}};_0x9b3d90(++_0x4002b5);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});};
\ No newline at end of file
index 15afa7c..870a4a8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3f6a25,_0x720812){_0x3f6a25=_0x3f6a25-0x0;var _0x5ed674=_0x5f2f[_0x3f6a25];return _0x5ed674;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply;
\ No newline at end of file
+var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x36284b,_0x2b7436){var _0x23c34a=function(_0x14f579){while(--_0x14f579){_0x36284b['push'](_0x36284b['shift']());}};_0x23c34a(++_0x2b7436);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4f4cfd,_0x56d277){_0x4f4cfd=_0x4f4cfd-0x0;var _0x2bb50b=_0x5f2f[_0x4f4cfd];return _0x2bb50b;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply;
\ No newline at end of file
index 212bf82..f3da6ce 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x060a=['phone','CreateCmContact','getPauseById','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','lodash','util','jayson/promise','http','request','then','error','message','ShowSquareProject','production','getMailAccountById','ShowMailAccount','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','ShowTrunk','getSoundById','save_name','getIntervalById','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper'];(function(_0x138836,_0x229129){var _0x322688=function(_0x54b101){while(--_0x54b101){_0x138836['push'](_0x138836['shift']());}};_0x322688(++_0x229129);}(_0x060a,0x192));var _0xa060=function(_0x3afe1e,_0x1436b9){_0x3afe1e=_0x3afe1e-0x0;var _0x191f3e=_0x060a[_0x3afe1e];return _0x191f3e;};'use strict';var BPromise=require('bluebird');var moment=require(_0xa060('0x0'));var _=require(_0xa060('0x1'));var util=require(_0xa060('0x2'));var jayson=require(_0xa060('0x3'));var client=jayson['client'][_0xa060('0x4')]({'port':0x2329});function request(_0x562df1,_0x201517){return new BPromise(function(_0x15897e,_0x5146a7){return client[_0xa060('0x5')](_0x562df1,_0x201517)[_0xa060('0x6')](function(_0x13813c){if(_0x13813c[_0xa060('0x7')]){return _0x5146a7(_0x13813c['error'][_0xa060('0x8')]);}else{return _0x15897e(_0x13813c['result']);}})['catch'](function(_0x29aebf){return _0x5146a7(_0x29aebf);});});}exports['getSquareProject']=function(_0x1a604a){return request(_0xa060('0x9'),{'options':{'raw':![],'where':{'name':_0x1a604a},'attributes':[_0xa060('0xa')]}});};exports[_0xa060('0xb')]=function(_0x4c0b42){return request(_0xa060('0xc'),{'options':{'raw':![],'where':{'id':_0x4c0b42},'include':[{'model':'MailServerOut','as':_0xa060('0xd')}],'attributes':['id',_0xa060('0xe'),_0xa060('0xf')]}});};exports[_0xa060('0x10')]=function(_0x2567a6){return request('ShowSquareProject',{'options':{'where':{'id':_0x2567a6},'attributes':[_0xa060('0xe')]}});};exports[_0xa060('0x11')]=function(_0x4850ae){return request(_0xa060('0x12'),{'options':{'where':{'id':_0x4850ae},'attributes':[_0xa060('0xe')]}});};exports[_0xa060('0x13')]=function(_0x9599b7){return request(_0xa060('0x14'),{'options':{'where':{'id':_0x9599b7},'attributes':[_0xa060('0xe')]}});};exports[_0xa060('0x15')]=function(_0x33d58b){return request(_0xa060('0x16'),{'options':{'where':{'id':_0x33d58b},'attributes':[_0xa060('0x17')]}});};exports[_0xa060('0x18')]=function(_0x246a4a){return request(_0xa060('0x19'),{'options':{'where':{'id':_0x246a4a},'attributes':[_0xa060('0xe')]}});};exports['getTrunkById']=function(_0x5c9f70){return request(_0xa060('0x1a'),{'options':{'where':{'id':_0x5c9f70},'attributes':[_0xa060('0xe')]}});};exports[_0xa060('0x1b')]=function(_0x19465a){return request('ShowSound',{'options':{'where':{'id':_0x19465a},'attributes':[_0xa060('0x1c')]}});};exports[_0xa060('0x1d')]=function(_0x1041da){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x1041da},'include':[{'model':'Interval','as':_0xa060('0x1e')}]}});};exports[_0xa060('0x1f')]=function(_0x4e0b36){return request(_0xa060('0x20'),{'options':{'where':{'id':_0x4e0b36},'attributes':['id','name']}});};exports[_0xa060('0x21')]=function(_0x50bf7b){return request('CreateSmsMessage',{'body':_0x50bf7b});};exports[_0xa060('0x22')]=function(_0x58a2a0){return request('CreateSquareDetailsReport',{'body':_0x58a2a0});};exports[_0xa060('0x23')]=function(_0x23ee86){return request('CreateSquareReport',{'body':_[_0xa060('0x24')](_0x23ee86,{'project_name':_0x23ee86[_0xa060('0x25')],'prev_project_name':_0x23ee86[_0xa060('0x26')]||'','is_subproject':_0x23ee86[_0xa060('0x26')]?!![]:![],'leaveAt':moment()[_0xa060('0x27')](_0xa060('0x28'))})});};exports[_0xa060('0x29')]=function(_0x2b7249){return request(_0xa060('0x2a'),{'body':_0x2b7249});};exports[_0xa060('0x2b')]=function(_0x2ef293){return request('CreateSquareMessage',{'body':_0x2ef293});};exports[_0xa060('0x2c')]=function(_0xc2bdbd){return request(_0xa060('0x2d'),{'options':{'raw':![],'where':{'phone':_0xc2bdbd[_0xa060('0x2e')],'ListId':_0xc2bdbd['ListId']}}})['then'](function(_0x28f14b){if(_0x28f14b){return _0x28f14b;}return request(_0xa060('0x2f'),{'body':_0xc2bdbd});});};exports[_0xa060('0x30')]=function(_0x5a407b){return request('ShowPause',{'options':{'where':{'id':_0x5a407b},'attributes':[_0xa060('0xe')]}});};exports['agentLogin']=function(_0x5519df,_0x5e69cf){return request(_0xa060('0x31'),{'body':{'interface':_0x5e69cf},'options':{'where':_0x5519df}});};exports[_0xa060('0x32')]=function(_0x512407,_0x4a657d,_0x34cc8a){return request(_0xa060('0x33'),{'body':{'type':_0x4a657d,'uniqueid':_0x34cc8a},'options':{'where':_0x512407}});};exports[_0xa060('0x34')]=function(_0xddf18f){return request(_0xa060('0x35'),{'body':{},'options':{'where':_0xddf18f}});};exports[_0xa060('0x36')]=function(_0x4b12b1){return request(_0xa060('0x37'),{'body':{},'options':{'where':_0x4b12b1}});};
\ No newline at end of file
+var _0xb678=['message','result','catch','ShowSquareProject','production','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','CreateSquareRecording','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentUnpause','UnpauseUser','agentLogout','bluebird','moment','jayson/promise','request','then','error'];(function(_0x4e38eb,_0x979ebc){var _0x1159a7=function(_0x168705){while(--_0x168705){_0x4e38eb['push'](_0x4e38eb['shift']());}};_0x1159a7(++_0x979ebc);}(_0xb678,0x6a));var _0x8b67=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0xb678[_0x231e16];return _0x570a7c;};'use strict';var BPromise=require(_0x8b67('0x0'));var moment=require(_0x8b67('0x1'));var _=require('lodash');var util=require('util');var jayson=require(_0x8b67('0x2'));var client=jayson['client']['http']({'port':0x2329});function request(_0x423d98,_0x554755){return new BPromise(function(_0x5292f2,_0x4db8ef){return client[_0x8b67('0x3')](_0x423d98,_0x554755)[_0x8b67('0x4')](function(_0x34ec61){if(_0x34ec61[_0x8b67('0x5')]){return _0x4db8ef(_0x34ec61[_0x8b67('0x5')][_0x8b67('0x6')]);}else{return _0x5292f2(_0x34ec61[_0x8b67('0x7')]);}})[_0x8b67('0x8')](function(_0x18c8da){return _0x4db8ef(_0x18c8da);});});}exports['getSquareProject']=function(_0x3c931f){return request(_0x8b67('0x9'),{'options':{'raw':![],'where':{'name':_0x3c931f},'attributes':[_0x8b67('0xa')]}});};exports['getMailAccountById']=function(_0x10d727){return request(_0x8b67('0xb'),{'options':{'raw':![],'where':{'id':_0x10d727},'include':[{'model':_0x8b67('0xc'),'as':_0x8b67('0xd')}],'attributes':['id',_0x8b67('0xe'),_0x8b67('0xf')]}});};exports[_0x8b67('0x10')]=function(_0x2a094c){return request(_0x8b67('0x9'),{'options':{'where':{'id':_0x2a094c},'attributes':['name']}});};exports[_0x8b67('0x11')]=function(_0x4cdb7d){return request(_0x8b67('0x12'),{'options':{'where':{'id':_0x4cdb7d},'attributes':['name']}});};exports['getVariableById']=function(_0x206539){return request(_0x8b67('0x13'),{'options':{'where':{'id':_0x206539},'attributes':[_0x8b67('0xe')]}});};exports[_0x8b67('0x14')]=function(_0xcaad17){return request(_0x8b67('0x15'),{'options':{'where':{'id':_0xcaad17},'attributes':[_0x8b67('0x16')]}});};exports[_0x8b67('0x17')]=function(_0x41baef){return request(_0x8b67('0x18'),{'options':{'where':{'id':_0x41baef},'attributes':[_0x8b67('0xe')]}});};exports[_0x8b67('0x19')]=function(_0x148f35){return request(_0x8b67('0x1a'),{'options':{'where':{'id':_0x148f35},'attributes':['name']}});};exports[_0x8b67('0x1b')]=function(_0x1c214e){return request(_0x8b67('0x1c'),{'options':{'where':{'id':_0x1c214e},'attributes':[_0x8b67('0x1d')]}});};exports[_0x8b67('0x1e')]=function(_0x245621){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x245621},'include':[{'model':_0x8b67('0x1f'),'as':_0x8b67('0x20')}]}});};exports[_0x8b67('0x21')]=function(_0x5026a1){return request(_0x8b67('0x22'),{'options':{'where':{'id':_0x5026a1},'attributes':['id',_0x8b67('0xe')]}});};exports[_0x8b67('0x23')]=function(_0x380222){return request(_0x8b67('0x24'),{'body':_0x380222});};exports[_0x8b67('0x25')]=function(_0x44a4b3){return request(_0x8b67('0x26'),{'body':_0x44a4b3});};exports[_0x8b67('0x27')]=function(_0x12f42d){return request('CreateSquareReport',{'body':_[_0x8b67('0x28')](_0x12f42d,{'project_name':_0x12f42d[_0x8b67('0x29')],'prev_project_name':_0x12f42d[_0x8b67('0x2a')]||'','is_subproject':_0x12f42d[_0x8b67('0x2a')]?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x344ed8){return request(_0x8b67('0x2b'),{'body':_0x344ed8});};exports['createSquareMessage']=function(_0x12417f){return request('CreateSquareMessage',{'body':_0x12417f});};exports[_0x8b67('0x2c')]=function(_0x1eaa95){return request(_0x8b67('0x2d'),{'options':{'raw':![],'where':{'phone':_0x1eaa95[_0x8b67('0x2e')],'ListId':_0x1eaa95[_0x8b67('0x2f')]}}})['then'](function(_0x591416){if(_0x591416){return _0x591416;}return request(_0x8b67('0x30'),{'body':_0x1eaa95});});};exports[_0x8b67('0x31')]=function(_0x4a8e20){return request(_0x8b67('0x32'),{'options':{'where':{'id':_0x4a8e20},'attributes':[_0x8b67('0xe')]}});};exports[_0x8b67('0x33')]=function(_0x561d53,_0x1af116){return request(_0x8b67('0x34'),{'body':{'interface':_0x1af116},'options':{'where':_0x561d53}});};exports['agentPause']=function(_0x238d26,_0x17b404,_0x5bb40e){return request('PauseUser',{'body':{'type':_0x17b404,'uniqueid':_0x5bb40e},'options':{'where':_0x238d26}});};exports[_0x8b67('0x35')]=function(_0x2891b6){return request(_0x8b67('0x36'),{'body':{},'options':{'where':_0x2891b6}});};exports[_0x8b67('0x37')]=function(_0x43039d){return request('LogoutUser',{'body':{},'options':{'where':_0x43039d}});};
\ No newline at end of file
index d273558..cd5eab0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xff90=['./polly','exports'];(function(_0x4da801,_0x413809){var _0x5c7c67=function(_0x394ac2){while(--_0x394ac2){_0x4da801['push'](_0x4da801['shift']());}};_0x5c7c67(++_0x413809);}(_0xff90,0xde));var _0x0ff9=function(_0x102789,_0x24217f){_0x102789=_0x102789-0x0;var _0x4aeb4f=_0xff90[_0x102789];return _0x4aeb4f;};var polly=require(_0x0ff9('0x0'));var lex=require('./lex');module[_0x0ff9('0x1')]={'polly':polly,'lex':lex};
\ No newline at end of file
+var _0x01a7=['exports'];(function(_0x596f6e,_0x3f8857){var _0x1e0803=function(_0x31f91f){while(--_0x31f91f){_0x596f6e['push'](_0x596f6e['shift']());}};_0x1e0803(++_0x3f8857);}(_0x01a7,0x14c));var _0x701a=function(_0x1ec6b3,_0x4d613c){_0x1ec6b3=_0x1ec6b3-0x0;var _0x7f842c=_0x01a7[_0x1ec6b3];return _0x7f842c;};var polly=require('./polly');var lex=require('./lex');module[_0x701a('0x0')]={'polly':polly,'lex':lex};
\ No newline at end of file
index 34cd753..7f35d74 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x544a=['exports','./lib/api'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x544a,0xbd));var _0xa544=function(_0x5d9f5c,_0x189d90){_0x5d9f5c=_0x5d9f5c-0x0;var _0x171fba=_0x544a[_0x5d9f5c];return _0x171fba;};'use strict';var lex=require(_0xa544('0x0'));module[_0xa544('0x1')]=function(_0x311c86,_0x5d759f,_0x544b38,_0x46d7b6,_0x5026f6,_0x42b8f1){return lex(_0x311c86,_0x5d759f,_0x544b38,_0x46d7b6,_0x5026f6,_0x42b8f1);};
\ No newline at end of file
+var _0x063c=['exports'];(function(_0x465be6,_0x2668de){var _0x45f7b1=function(_0x1b3f37){while(--_0x1b3f37){_0x465be6['push'](_0x465be6['shift']());}};_0x45f7b1(++_0x2668de);}(_0x063c,0xba));var _0xc063=function(_0x10303b,_0x3a15ee){_0x10303b=_0x10303b-0x0;var _0x274dfb=_0x063c[_0x10303b];return _0x274dfb;};'use strict';var lex=require('./lib/api');module[_0xc063('0x0')]=function(_0x3e8b5f,_0x1ca192,_0x25e61c,_0x314f1b,_0x33d075,_0x5aa766){return lex(_0x3e8b5f,_0x1ca192,_0x25e61c,_0x314f1b,_0x33d075,_0x5aa766);};
\ No newline at end of file
index 1b816cd..e828b38 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc1b8=['hasOwnProperty','exports','LexRuntime','$LATEST','bluebird','aws-sdk','postText','slots'];(function(_0x3400ca,_0x27c04d){var _0x26e8d1=function(_0x2284e9){while(--_0x2284e9){_0x3400ca['push'](_0x3400ca['shift']());}};_0x26e8d1(++_0x27c04d);}(_0xc1b8,0x164));var _0x8c1b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xc1b8[_0x501510];return _0x1e6ee5;};'use strict';var BPromise=require(_0x8c1b('0x0'));var AWS=require(_0x8c1b('0x1'));function lexResult(_0x5a4089,_0x348c79){return new BPromise(function(_0x3852c5,_0x464dc0){_0x5a4089[_0x8c1b('0x2')](_0x348c79,function(_0x4dd899,_0x547233){if(_0x4dd899){_0x464dc0(_0x4dd899);}if(_0x547233['slots']){for(const _0x360521 in _0x547233['slots']){if(_0x547233[_0x8c1b('0x3')][_0x8c1b('0x4')](_0x360521)){var _0xa845ca=_0x547233[_0x8c1b('0x3')][_0x360521];_0x547233['slot_'+_0x360521]=_0xa845ca;}}}_0x3852c5(_0x547233);});});}module[_0x8c1b('0x5')]=function(_0x435319,_0x18e209,_0x228c22,_0x545f98,_0x3b5f51,_0x1c846b){var _0x446f40=new AWS[(_0x8c1b('0x6'))]({'accessKeyId':_0x18e209,'secretAccessKey':_0x228c22,'region':_0x545f98});var _0x416449={'botAlias':_0x8c1b('0x7'),'botName':_0x1c846b,'inputText':_0x3b5f51,'userId':_0x435319};return lexResult(_0x446f40,_0x416449);};
\ No newline at end of file
+var _0x44fc=['aws-sdk','slots','hasOwnProperty','slot_','$LATEST','bluebird'];(function(_0x3d183f,_0x114702){var _0x555746=function(_0x5d3ea2){while(--_0x5d3ea2){_0x3d183f['push'](_0x3d183f['shift']());}};_0x555746(++_0x114702);}(_0x44fc,0x179));var _0xc44f=function(_0x19a5d8,_0x347207){_0x19a5d8=_0x19a5d8-0x0;var _0x30104a=_0x44fc[_0x19a5d8];return _0x30104a;};'use strict';var BPromise=require(_0xc44f('0x0'));var AWS=require(_0xc44f('0x1'));function lexResult(_0x5e6861,_0x8cda57){return new BPromise(function(_0x124f4d,_0x1d25dc){_0x5e6861['postText'](_0x8cda57,function(_0x41a203,_0x3b6792){if(_0x41a203){_0x1d25dc(_0x41a203);}if(_0x3b6792[_0xc44f('0x2')]){for(const _0x5c151b in _0x3b6792[_0xc44f('0x2')]){if(_0x3b6792[_0xc44f('0x2')][_0xc44f('0x3')](_0x5c151b)){var _0x3b2bf1=_0x3b6792[_0xc44f('0x2')][_0x5c151b];_0x3b6792[_0xc44f('0x4')+_0x5c151b]=_0x3b2bf1;}}}_0x124f4d(_0x3b6792);});});}module['exports']=function(_0x3f9853,_0x130b12,_0x1ad661,_0x12b57e,_0x51b545,_0x315627){var _0x255de5=new AWS['LexRuntime']({'accessKeyId':_0x130b12,'secretAccessKey':_0x1ad661,'region':_0x12b57e});var _0x184c8c={'botAlias':_0xc44f('0x5'),'botName':_0x315627,'inputText':_0x51b545,'userId':_0x3f9853};return lexResult(_0x255de5,_0x184c8c);};
\ No newline at end of file
index b795884..80720d3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-'use strict';var polly=require('./lib/api');module['exports']=function(_0x51e789,_0x240501,_0x4a208e,_0x749520,_0x58aa53,_0x1cb9c0,_0x4c0d2c){return polly(_0x51e789,_0x240501,_0x4a208e,_0x749520,_0x58aa53,_0x1cb9c0,_0x4c0d2c);};
\ No newline at end of file
+var _0xf9ea=['./lib/api','exports'];(function(_0x3d6b5c,_0x2b011d){var _0x43874f=function(_0x34095b){while(--_0x34095b){_0x3d6b5c['push'](_0x3d6b5c['shift']());}};_0x43874f(++_0x2b011d);}(_0xf9ea,0x1ee));var _0xaf9e=function(_0x3cd4df,_0x756389){_0x3cd4df=_0x3cd4df-0x0;var _0x54a719=_0xf9ea[_0x3cd4df];return _0x54a719;};'use strict';var polly=require(_0xaf9e('0x0'));module[_0xaf9e('0x1')]=function(_0x54d01b,_0x28a43a,_0x57c6b9,_0x31459a,_0x12a16b,_0x3f0840,_0x5a5ea0){return polly(_0x54d01b,_0x28a43a,_0x57c6b9,_0x31459a,_0x12a16b,_0x3f0840,_0x5a5ea0);};
\ No newline at end of file
index 1f71d0e..8e9821c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x274b=['aws-sdk','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','text','path','randomstring'];(function(_0x435c2c,_0x2678ca){var _0x30795f=function(_0x41d522){while(--_0x41d522){_0x435c2c['push'](_0x435c2c['shift']());}};_0x30795f(++_0x2678ca);}(_0x274b,0xde));var _0xb274=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x274b[_0x618414];return _0x21c19a;};'use strict';var fs=require('fs');var path=require(_0xb274('0x0'));var BPromise=require('bluebird');var rs=require(_0xb274('0x1'));var AWS=require(_0xb274('0x2'));function pollyResult(_0x483368,_0x676104,_0x49fb85){return new BPromise(function(_0x48cebf,_0x2f7a38){_0x483368['synthesizeSpeech'](_0x676104,function(_0x6da195,_0x4d2ed1){if(_0x6da195){_0x2f7a38(_0x6da195);}else if(_0x4d2ed1){if(_0x4d2ed1[_0xb274('0x3')]instanceof Buffer){fs[_0xb274('0x4')](_0x49fb85,_0x4d2ed1[_0xb274('0x3')],function(_0x57c718){if(_0x57c718){_0x2f7a38(_0x57c718);}else{_0x48cebf();}});}else{_0x2f7a38(new Error(_0xb274('0x5')));}}else{_0x2f7a38(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x4d13ff,_0x4ca4be,_0x38c4f7,_0xb9a81e,_0xe6511c,_0x4eae87,_0x4bf032){var _0x4b6356=new AWS['Polly']({'accessKeyId':_0x4d13ff,'secretAccessKey':_0x4ca4be,'region':_0x38c4f7});var _0x3035c4={'Text':_0xe6511c,'TextType':_0x4eae87||_0xb274('0x6'),'OutputFormat':'mp3','VoiceId':_0xb9a81e};return pollyResult(_0x4b6356,_0x3035c4,_0x4bf032);};
\ No newline at end of file
+var _0x1692=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','path','bluebird','aws-sdk','AudioStream','writeFile'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0x1692,0x109));var _0x2169=function(_0x50c718,_0x267b32){_0x50c718=_0x50c718-0x0;var _0x2bcabf=_0x1692[_0x50c718];return _0x2bcabf;};'use strict';var fs=require('fs');var path=require(_0x2169('0x0'));var BPromise=require(_0x2169('0x1'));var rs=require('randomstring');var AWS=require(_0x2169('0x2'));function pollyResult(_0x433655,_0x687eec,_0x2bc03b){return new BPromise(function(_0x204ca4,_0x4a250f){_0x433655['synthesizeSpeech'](_0x687eec,function(_0x2a58ff,_0x4363f2){if(_0x2a58ff){_0x4a250f(_0x2a58ff);}else if(_0x4363f2){if(_0x4363f2[_0x2169('0x3')]instanceof Buffer){fs[_0x2169('0x4')](_0x2bc03b,_0x4363f2[_0x2169('0x3')],function(_0x17034e){if(_0x17034e){_0x4a250f(_0x17034e);}else{_0x204ca4();}});}else{_0x4a250f(new Error(_0x2169('0x5')));}}else{_0x4a250f(new Error(_0x2169('0x6')));}});});}module['exports']=function(_0x192e91,_0x49fd1c,_0x49cabf,_0x8848e4,_0xb12ff9,_0x24431b,_0x49dd5d){var _0x41ba5f=new AWS[(_0x2169('0x7'))]({'accessKeyId':_0x192e91,'secretAccessKey':_0x49fd1c,'region':_0x49cabf});var _0xc6dc02={'Text':_0xb12ff9,'TextType':_0x24431b||_0x2169('0x8'),'OutputFormat':_0x2169('0x9'),'VoiceId':_0x8848e4};return pollyResult(_0x41ba5f,_0xc6dc02,_0x49dd5d);};
\ No newline at end of file
index b75b15d..e7b95d6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbfcc=['./lib/api'];(function(_0x1d1e7b,_0xc89492){var _0x3917b5=function(_0x37b0b8){while(--_0x37b0b8){_0x1d1e7b['push'](_0x1d1e7b['shift']());}};_0x3917b5(++_0xc89492);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0xbfcc[_0x5cbf0e];return _0x1c76f8;};'use strict';var asr=require(_0xcbfc('0x0'));module['exports']=function(_0x5c0fe4,_0x1a2fe0,_0x2d1386,_0x72a76d){return asr(_0x5c0fe4,_0x1a2fe0,_0x2d1386);};
\ No newline at end of file
+var _0xb79a=['./lib/api','exports'];(function(_0x183e01,_0x230542){var _0x268046=function(_0x4ddeeb){while(--_0x4ddeeb){_0x183e01['push'](_0x183e01['shift']());}};_0x268046(++_0x230542);}(_0xb79a,0x18e));var _0xab79=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb79a[_0x3dd15e];return _0x231fd0;};'use strict';var asr=require(_0xab79('0x0'));module[_0xab79('0x1')]=function(_0x505c19,_0x39e57b,_0x412745,_0x327347){return asr(_0x505c19,_0x39e57b,_0x412745);};
\ No newline at end of file
index 293db27..807da91 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb642=['lang\x20should\x20be\x20a\x20string','toString','POST','/v1/speech:recognize?key=','LINEAR16','url','bluebird','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined'];(function(_0x569231,_0x2c1e64){var _0x7f1ec6=function(_0x1d0a65){while(--_0x1d0a65){_0x569231['push'](_0x569231['shift']());}};_0x7f1ec6(++_0x2c1e64);}(_0xb642,0xd1));var _0x2b64=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xb642[_0x6c993a];return _0x27f547;};'use strict';var url=require(_0x2b64('0x0'));var BPromise=require(_0x2b64('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x414a95,_0x5df32c,_0x296583){return new BPromise(function(_0x2e2168,_0x248fa6){var _0x13eae3;if(typeof _0x414a95!==_0x2b64('0x2')||_0x414a95[_0x2b64('0x3')]===0x0){return _0x248fa6(_0x2b64('0x4'));}if(typeof _0x5df32c!==_0x2b64('0x2')||_0x5df32c[_0x2b64('0x3')]===0x0){return _0x248fa6(_0x2b64('0x5'));}if(typeof _0x296583!==_0x2b64('0x6')&&(typeof _0x296583!==_0x2b64('0x2')||_0x296583['length']===0x0)){return _0x248fa6(_0x2b64('0x7'));}try{_0x13eae3=fs['readFileSync'](_0x414a95)[_0x2b64('0x8')]('base64');}catch(_0x2ddbc5){return _0x248fa6(_0x2ddbc5);}return _0x2e2168({'method':_0x2b64('0x9'),'uri':host+_0x2b64('0xa')+_0x5df32c,'body':{'config':{'encoding':_0x2b64('0xb'),'sampleRateHertz':'8000','languageCode':_0x296583},'audio':{'content':_0x13eae3}},'json':!![]});});};
\ No newline at end of file
+var _0x8e10=['POST','/v1/speech:recognize?key=','LINEAR16','url','bluebird','https://speech.googleapis.com','exports','string','length','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x8e10,0x155));var _0x08e1=function(_0x2ba853,_0x45be){_0x2ba853=_0x2ba853-0x0;var _0xe21285=_0x8e10[_0x2ba853];return _0xe21285;};'use strict';var url=require(_0x08e1('0x0'));var BPromise=require(_0x08e1('0x1'));var fs=require('fs');var host=_0x08e1('0x2');module[_0x08e1('0x3')]=function(_0x4a0ba0,_0x235c00,_0x1a6356){return new BPromise(function(_0x289427,_0x4d5cea){var _0x1c216d;if(typeof _0x4a0ba0!==_0x08e1('0x4')||_0x4a0ba0[_0x08e1('0x5')]===0x0){return _0x4d5cea('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x235c00!==_0x08e1('0x4')||_0x235c00[_0x08e1('0x5')]===0x0){return _0x4d5cea('key\x20should\x20be\x20a\x20string');}if(typeof _0x1a6356!==_0x08e1('0x6')&&(typeof _0x1a6356!=='string'||_0x1a6356[_0x08e1('0x5')]===0x0)){return _0x4d5cea(_0x08e1('0x7'));}try{_0x1c216d=fs[_0x08e1('0x8')](_0x4a0ba0)['toString'](_0x08e1('0x9'));}catch(_0x22f541){return _0x4d5cea(_0x22f541);}return _0x289427({'method':_0x08e1('0xa'),'uri':host+_0x08e1('0xb')+_0x235c00,'body':{'config':{'encoding':_0x08e1('0xc'),'sampleRateHertz':'8000','languageCode':_0x1a6356},'audio':{'content':_0x1c216d}},'json':!![]});});};
\ No newline at end of file
index 316381c..680e81c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x34e8=['./asr','exports'];(function(_0x28678d,_0x54324f){var _0x1643e9=function(_0x873a6c){while(--_0x873a6c){_0x28678d['push'](_0x28678d['shift']());}};_0x1643e9(++_0x54324f);}(_0x34e8,0x12c));var _0x834e=function(_0x229cd2,_0x416351){_0x229cd2=_0x229cd2-0x0;var _0x3e2f8c=_0x34e8[_0x229cd2];return _0x3e2f8c;};var asr=require(_0x834e('0x0'));module[_0x834e('0x1')]={'asr':asr};
\ No newline at end of file
+var _0x70e0=['exports','./asr'];(function(_0x5180c3,_0x4b35f7){var _0x55c975=function(_0x4746cb){while(--_0x4746cb){_0x5180c3['push'](_0x5180c3['shift']());}};_0x55c975(++_0x4b35f7);}(_0x70e0,0x17b));var _0x070e=function(_0x5a73ca,_0x2f7331){_0x5a73ca=_0x5a73ca-0x0;var _0x431dda=_0x70e0[_0x5a73ca];return _0x431dda;};var asr=require(_0x070e('0x0'));module[_0x070e('0x1')]={'asr':asr};
\ No newline at end of file
index 2e0c782..f8838ba 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['text','channelData','CustomAction','AudioFromTts','Data','dirName','path','http','https','bluebird','sox','request-promise','util','querystring','moment','apiai-promise','md5','./google','./sestek','https://api.ispeech.org/api/rest','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','error','unlink','download\x20error','pipe','end','protocol','https:','data','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','base64','then','chmodSync','777','split','readFileSync','googleTTS','.mp3','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','stringify','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','format','freeform=3','parse','sestekNDA','nda'];(function(_0x2da8ee,_0x511a45){var _0x3a0eef=function(_0x3ac6fa){while(--_0x3ac6fa){_0x2da8ee['push'](_0x2da8ee['shift']());}};_0x3a0eef(++_0x511a45);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var fs=require('fs');var path=require(_0x0a9e('0x0'));var http=require(_0x0a9e('0x1'));var https=require(_0x0a9e('0x2'));var urlParse=require('url')['parse'];var BPromise=require(_0x0a9e('0x3'));var rs=require('randomstring');var sox=require(_0x0a9e('0x4'));var rp=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var querystring=require(_0x0a9e('0x7'));var moment=require(_0x0a9e('0x8'));var tts=require('google-tts-api');var apiai=require(_0x0a9e('0x9'));var md5=require(_0x0a9e('0xa'));var google=require(_0x0a9e('0xb'));var aws=require('./aws');var tilde=require('./tilde');var sestek=require(_0x0a9e('0xc'));var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0x0a9e('0xd');function downloadFile(_0xf81284,_0x307b3e){return new BPromise(function(_0x3ab53f,_0xfeb75b){var _0xbd1168=urlParse(_0xf81284);var _0x4a4c56=_0xbd1168['protocol']==='https:'?https:http;var _0x4cfe67={'host':_0xbd1168[_0x0a9e('0xe')],'path':_0xbd1168[_0x0a9e('0x0')],'headers':{'user-agent':_0x0a9e('0xf')}};_0x4a4c56[_0x0a9e('0x10')](_0x4cfe67,function(_0x32d742){if(_0x32d742[_0x0a9e('0x11')]!==0xc8){logger['error'](_0x0a9e('0x12')+_0xf81284+_0x0a9e('0x13')+_0x32d742[_0x0a9e('0x11')]+'\x20('+_0x32d742[_0x0a9e('0x14')]+')');_0xfeb75b(new Error(_0x0a9e('0x12')+_0xf81284+_0x0a9e('0x13')+_0x32d742['statusCode']+'\x20('+_0x32d742[_0x0a9e('0x14')]+')'));return;}var _0x5d0880=fs[_0x0a9e('0x15')](_0x307b3e);_0x5d0880['on']('finish',function(){logger[_0x0a9e('0x16')](_0x0a9e('0x17'));_0x5d0880['close'](_0x3ab53f);});_0x5d0880['on'](_0x0a9e('0x18'),function(_0x5a0a06){fs[_0x0a9e('0x19')](_0x307b3e);logger[_0x0a9e('0x18')](_0x0a9e('0x1a'),_0x5a0a06);_0xfeb75b(_0x5a0a06);});_0x32d742[_0x0a9e('0x1b')](_0x5d0880);})['on'](_0x0a9e('0x18'),function(_0x2eb11f){logger[_0x0a9e('0x18')](_0x2eb11f);_0xfeb75b(_0x2eb11f);})[_0x0a9e('0x1c')]();});}function uploadFile(_0x1314ae){return new BPromise(function(_0x112016,_0x1c696a){var _0x105080=urlParse(_0x1314ae);var _0x4bb1e3=_0x105080[_0x0a9e('0x1d')]===_0x0a9e('0x1e')?https:http;var _0x53682f={'host':_0x105080[_0x0a9e('0xe')],'path':_0x105080['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x4bb1e3[_0x0a9e('0x10')](_0x53682f,function(_0x432e56){if(_0x432e56[_0x0a9e('0x11')]!==0xc8){_0x1c696a(new Error(_0x0a9e('0x12')+_0x1314ae+'\x20failed,\x20status\x20code\x20=\x20'+_0x432e56[_0x0a9e('0x11')]+'\x20('+_0x432e56[_0x0a9e('0x14')]+')'));return;}var _0x3b45bc='';_0x432e56['on'](_0x0a9e('0x1f'),function(_0x370d86){_0x3b45bc+=_0x370d86;});_0x432e56['on'](_0x0a9e('0x1c'),function(){_0x112016(_0x3b45bc);});})['on'](_0x0a9e('0x18'),function(_0x5ea472){_0x1c696a(_0x5ea472);})['end']();});}function convertFile(_0x197ec0,_0x3a8e58){return new BPromise(function(_0x40c424,_0x33161b){var _0x526cf3=sox[_0x0a9e('0x20')](_0x197ec0,_0x3a8e58,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x526cf3['on'](_0x0a9e('0x18'),function(_0x5bfb33){logger[_0x0a9e('0x18')](_0x0a9e('0x21'),_0x5bfb33);_0x33161b(_0x5bfb33);});_0x526cf3['on'](_0x0a9e('0x1c'),function(){logger[_0x0a9e('0x16')](_0x0a9e('0x22'));_0x40c424();});_0x526cf3[_0x0a9e('0x23')]();});}function base64Decode(_0x11c3b6,_0x14de77){var _0x5a101a=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x27'));fs['writeFileSync'](_0x5a101a,_0x11c3b6,_0x0a9e('0x28'));return convertFile(_0x5a101a,_0x14de77)[_0x0a9e('0x29')](function(){try{fs[_0x0a9e('0x19')](_0x5a101a);fs[_0x0a9e('0x2a')](_0x14de77,_0x0a9e('0x2b'));}catch(_0x563b45){logger[_0x0a9e('0x18')](_0x563b45);}return _0x14de77[_0x0a9e('0x2c')]('.')[0x0];});}function base64Encode(_0x1dbde2){var _0x540530=fs[_0x0a9e('0x2d')](_0x1dbde2);return new Buffer(_0x540530)['toString'](_0x0a9e('0x28'));}exports[_0x0a9e('0x2e')]=function(_0x1122db,_0x33bdb7){var _0x25ce3a,_0x5180f1;return tts(_0x1122db,_0x33bdb7||'en',0x1)[_0x0a9e('0x29')](function(_0x46f0a5){logger[_0x0a9e('0x16')](_0x46f0a5);_0x25ce3a=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x2f'));return downloadFile(_0x46f0a5,_0x25ce3a);})[_0x0a9e('0x29')](function(){_0x5180f1=path['resolve'](__dirname,_0x0a9e('0x25'),rs['generate'](0x4)+_0x0a9e('0x27'));return convertFile(_0x25ce3a,_0x5180f1);})[_0x0a9e('0x29')](function(){try{fs[_0x0a9e('0x19')](_0x25ce3a);fs[_0x0a9e('0x2a')](_0x5180f1,'777');}catch(_0x191e91){logger[_0x0a9e('0x18')](_0x191e91);}logger[_0x0a9e('0x16')](_0x0a9e('0x30'),_0x5180f1['split']('.')[0x0]);return _0x5180f1['split']('.')[0x0];});};exports[_0x0a9e('0x31')]=function(_0x5640eb,_0x24936a,_0x3d9717){return google[_0x0a9e('0x32')](_0x5640eb,_0x24936a,_0x3d9717)[_0x0a9e('0x29')](function(_0x4f41ae){logger[_0x0a9e('0x16')](_0x4f41ae[_0x0a9e('0x33')]);return rp(_0x4f41ae);})[_0x0a9e('0x29')](function(_0x533942){var _0x1dbf74='';var _0x1a180b=0x0;try{fs[_0x0a9e('0x19')](_0x5640eb);}catch(_0x4c1c0e){logger['error'](_0x4c1c0e);}if(_0x533942&&_0x533942[_0x0a9e('0x34')]){_0x1dbf74=_0x533942[_0x0a9e('0x34')]['map'](function(_0x2b814e){return _0x2b814e&&_0x2b814e[_0x0a9e('0x35')][0x0]&&_0x2b814e[_0x0a9e('0x35')][0x0][_0x0a9e('0x36')]?_0x2b814e['alternatives'][0x0]['transcript']:'';})[_0x0a9e('0x37')]('\x0a');_0x1a180b=_0x533942[_0x0a9e('0x34')]['map'](function(_0x183991){return _0x183991&&_0x183991[_0x0a9e('0x35')][0x0]&&_0x183991[_0x0a9e('0x35')][0x0]['confidence']?_0x183991[_0x0a9e('0x35')][0x0][_0x0a9e('0x38')]:0x0;})[_0x0a9e('0x37')]('\x0a');}logger[_0x0a9e('0x16')](_0x0a9e('0x39'),_0x1dbf74);logger[_0x0a9e('0x16')](_0x0a9e('0x3a'),_0x1a180b);return{'transcript':_0x1dbf74,'confidence':_0x1a180b};})[_0x0a9e('0x3b')](function(_0x23b089){logger[_0x0a9e('0x18')](_0x0a9e('0x3c'),_0x23b089[_0x0a9e('0x11')],_0x23b089[_0x0a9e('0x3d')],_0x23b089[_0x0a9e('0x3e')]);});};exports[_0x0a9e('0x3f')]=function(_0x4d04c8,_0x52628e,_0x473fdc,_0xb3795a){var _0x405c8f=apiai(_0x52628e,{'language':_0xb3795a||'en'});return _0x405c8f[_0x0a9e('0x40')](_0x473fdc,{'sessionId':md5(_0x4d04c8)})[_0x0a9e('0x29')](function(_0xc9a702){logger[_0x0a9e('0x16')](JSON[_0x0a9e('0x41')](_0xc9a702));return{'source':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x43')],'resolvedQuery':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x44')],'action':_0xc9a702['result'][_0x0a9e('0x45')],'actionIncomplete':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x46')],'speech':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x47')][_0x0a9e('0x48')],'score':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x49')],'statusCode':_0xc9a702['status'][_0x0a9e('0x4a')],'endConversation':_0xc9a702['result'][_0x0a9e('0x4b')][_0x0a9e('0x4c')]||![],'isFallbackIntent':_0xc9a702[_0x0a9e('0x42')]['metadata'][_0x0a9e('0x4d')]};});};exports[_0x0a9e('0x4e')]=function(_0x4774f4,_0x34aa5a,_0x45c845,_0x37be73){return tilde[_0x0a9e('0x32')](_0x4774f4,_0x34aa5a,_0x45c845,_0x37be73)['then'](function(_0x13f44d){try{fs[_0x0a9e('0x19')](_0x4774f4);}catch(_0x1b5e80){logger[_0x0a9e('0x18')](_0x1b5e80);}logger[_0x0a9e('0x16')](_0x0a9e('0x4f'),_0x13f44d[_0x0a9e('0x36')]);logger[_0x0a9e('0x16')](_0x0a9e('0x50'),_0x13f44d['confidence']);return _0x13f44d;});};exports[_0x0a9e('0x51')]=function(_0x3fe430,_0x4f7240,_0x4ae14b,_0x5ddf84,_0x1adfee,_0x4317e3){var _0x37edaa=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x2f'));var _0x375c18;return aws['polly'](_0x3fe430,_0x4f7240,_0x4ae14b,_0x5ddf84,_0x1adfee,_0x4317e3,_0x37edaa)['then'](function(){_0x375c18=path['resolve'](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x27'));return convertFile(_0x37edaa,_0x375c18);})['then'](function(){try{fs[_0x0a9e('0x19')](_0x37edaa);fs[_0x0a9e('0x2a')](_0x375c18,'777');}catch(_0x5a88da){logger[_0x0a9e('0x18')](_0x5a88da);}return _0x375c18['split']('.')[0x0];});};exports[_0x0a9e('0x52')]=function(_0x4c3845,_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a,_0x2f82da){return aws[_0x0a9e('0x53')](_0x4c3845,_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a,_0x2f82da)['then'](function(_0x50f687){logger[_0x0a9e('0x16')](JSON[_0x0a9e('0x41')](_0x50f687));return _0x50f687;});};exports['ispeechTTS']=function(_0x145931,_0x5ce9ac,_0x211ef9,_0x523cd2){var _0xe22ccc=util['format']('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x145931,encodeURIComponent(_0x5ce9ac),_0x211ef9,_0x523cd2);var _0x5df0ad=path[_0x0a9e('0x24')](__dirname,'tmp',rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x2f'));var _0x3cfd00;return downloadFile(_0xe22ccc,_0x5df0ad)[_0x0a9e('0x29')](function(){_0x3cfd00=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x27'));return convertFile(_0x5df0ad,_0x3cfd00);})['then'](function(){try{fs[_0x0a9e('0x19')](_0x5df0ad);fs[_0x0a9e('0x2a')](_0x3cfd00,_0x0a9e('0x2b'));}catch(_0x30c491){logger[_0x0a9e('0x18')](_0x30c491);}return _0x3cfd00[_0x0a9e('0x2c')]('.')[0x0];});};exports['ispeechASR']=function(_0x956fbe,_0x26bc80,_0x5239ef,_0x3649cc){var _0x5cc8fb=util[_0x0a9e('0x54')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x26bc80,_0x5239ef,base64Encode(_0x956fbe),_0x3649cc?util['format']('model=%s',encodeURIComponent(_0x3649cc)):_0x0a9e('0x55'));return uploadFile(_0x5cc8fb)['then'](function(_0x2244d6){return querystring[_0x0a9e('0x56')](_0x2244d6);});};exports[_0x0a9e('0x57')]=function(_0x7be420,_0x1cca9f){return sestek[_0x0a9e('0x58')](_0x7be420,_0x1cca9f)['then'](function(_0x1627a7){logger['info'](JSON[_0x0a9e('0x41')](_0x1627a7));var _0x1f07cb={'speech':_0x1627a7[_0x0a9e('0x59')],'action':_0x1627a7['channelData']?_0x1627a7[_0x0a9e('0x5a')][_0x0a9e('0x5b')]:undefined,'actiondata':_0x1627a7[_0x0a9e('0x5a')]?_0x1627a7[_0x0a9e('0x5a')]['CustomActionData']:undefined};if(_0x1627a7[_0x0a9e('0x5a')]&&_0x1627a7[_0x0a9e('0x5a')]['AudioFromTts']){return base64Decode(_0x1627a7[_0x0a9e('0x5a')][_0x0a9e('0x5c')][_0x0a9e('0x5d')],path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs['generate'](0x4)+_0x0a9e('0x27')))[_0x0a9e('0x29')](function(_0x281c7d){_0x1f07cb['audiofile']=_0x281c7d;return _0x1f07cb;});}return _0x1f07cb;});};exports[_0x0a9e('0x5e')]=function(){return __dirname;};
\ No newline at end of file
+var _0xa9e0=['text','channelData','CustomAction','AudioFromTts','Data','dirName','path','http','https','bluebird','sox','request-promise','util','querystring','moment','apiai-promise','md5','./google','./sestek','https://api.ispeech.org/api/rest','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','error','unlink','download\x20error','pipe','end','protocol','https:','data','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','base64','then','chmodSync','777','split','readFileSync','googleTTS','.mp3','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','stringify','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','format','freeform=3','parse','sestekNDA','nda'];(function(_0x3ee0df,_0x1737de){var _0x26a02c=function(_0x1954af){while(--_0x1954af){_0x3ee0df['push'](_0x3ee0df['shift']());}};_0x26a02c(++_0x1737de);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var fs=require('fs');var path=require(_0x0a9e('0x0'));var http=require(_0x0a9e('0x1'));var https=require(_0x0a9e('0x2'));var urlParse=require('url')['parse'];var BPromise=require(_0x0a9e('0x3'));var rs=require('randomstring');var sox=require(_0x0a9e('0x4'));var rp=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var querystring=require(_0x0a9e('0x7'));var moment=require(_0x0a9e('0x8'));var tts=require('google-tts-api');var apiai=require(_0x0a9e('0x9'));var md5=require(_0x0a9e('0xa'));var google=require(_0x0a9e('0xb'));var aws=require('./aws');var tilde=require('./tilde');var sestek=require(_0x0a9e('0xc'));var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0x0a9e('0xd');function downloadFile(_0xf81284,_0x307b3e){return new BPromise(function(_0x3ab53f,_0xfeb75b){var _0xbd1168=urlParse(_0xf81284);var _0x4a4c56=_0xbd1168['protocol']==='https:'?https:http;var _0x4cfe67={'host':_0xbd1168[_0x0a9e('0xe')],'path':_0xbd1168[_0x0a9e('0x0')],'headers':{'user-agent':_0x0a9e('0xf')}};_0x4a4c56[_0x0a9e('0x10')](_0x4cfe67,function(_0x32d742){if(_0x32d742[_0x0a9e('0x11')]!==0xc8){logger['error'](_0x0a9e('0x12')+_0xf81284+_0x0a9e('0x13')+_0x32d742[_0x0a9e('0x11')]+'\x20('+_0x32d742[_0x0a9e('0x14')]+')');_0xfeb75b(new Error(_0x0a9e('0x12')+_0xf81284+_0x0a9e('0x13')+_0x32d742['statusCode']+'\x20('+_0x32d742[_0x0a9e('0x14')]+')'));return;}var _0x5d0880=fs[_0x0a9e('0x15')](_0x307b3e);_0x5d0880['on']('finish',function(){logger[_0x0a9e('0x16')](_0x0a9e('0x17'));_0x5d0880['close'](_0x3ab53f);});_0x5d0880['on'](_0x0a9e('0x18'),function(_0x5a0a06){fs[_0x0a9e('0x19')](_0x307b3e);logger[_0x0a9e('0x18')](_0x0a9e('0x1a'),_0x5a0a06);_0xfeb75b(_0x5a0a06);});_0x32d742[_0x0a9e('0x1b')](_0x5d0880);})['on'](_0x0a9e('0x18'),function(_0x2eb11f){logger[_0x0a9e('0x18')](_0x2eb11f);_0xfeb75b(_0x2eb11f);})[_0x0a9e('0x1c')]();});}function uploadFile(_0x1314ae){return new BPromise(function(_0x112016,_0x1c696a){var _0x105080=urlParse(_0x1314ae);var _0x4bb1e3=_0x105080[_0x0a9e('0x1d')]===_0x0a9e('0x1e')?https:http;var _0x53682f={'host':_0x105080[_0x0a9e('0xe')],'path':_0x105080['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x4bb1e3[_0x0a9e('0x10')](_0x53682f,function(_0x432e56){if(_0x432e56[_0x0a9e('0x11')]!==0xc8){_0x1c696a(new Error(_0x0a9e('0x12')+_0x1314ae+'\x20failed,\x20status\x20code\x20=\x20'+_0x432e56[_0x0a9e('0x11')]+'\x20('+_0x432e56[_0x0a9e('0x14')]+')'));return;}var _0x3b45bc='';_0x432e56['on'](_0x0a9e('0x1f'),function(_0x370d86){_0x3b45bc+=_0x370d86;});_0x432e56['on'](_0x0a9e('0x1c'),function(){_0x112016(_0x3b45bc);});})['on'](_0x0a9e('0x18'),function(_0x5ea472){_0x1c696a(_0x5ea472);})['end']();});}function convertFile(_0x197ec0,_0x3a8e58){return new BPromise(function(_0x40c424,_0x33161b){var _0x526cf3=sox[_0x0a9e('0x20')](_0x197ec0,_0x3a8e58,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x526cf3['on'](_0x0a9e('0x18'),function(_0x5bfb33){logger[_0x0a9e('0x18')](_0x0a9e('0x21'),_0x5bfb33);_0x33161b(_0x5bfb33);});_0x526cf3['on'](_0x0a9e('0x1c'),function(){logger[_0x0a9e('0x16')](_0x0a9e('0x22'));_0x40c424();});_0x526cf3[_0x0a9e('0x23')]();});}function base64Decode(_0x11c3b6,_0x14de77){var _0x5a101a=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x27'));fs['writeFileSync'](_0x5a101a,_0x11c3b6,_0x0a9e('0x28'));return convertFile(_0x5a101a,_0x14de77)[_0x0a9e('0x29')](function(){try{fs[_0x0a9e('0x19')](_0x5a101a);fs[_0x0a9e('0x2a')](_0x14de77,_0x0a9e('0x2b'));}catch(_0x563b45){logger[_0x0a9e('0x18')](_0x563b45);}return _0x14de77[_0x0a9e('0x2c')]('.')[0x0];});}function base64Encode(_0x1dbde2){var _0x540530=fs[_0x0a9e('0x2d')](_0x1dbde2);return new Buffer(_0x540530)['toString'](_0x0a9e('0x28'));}exports[_0x0a9e('0x2e')]=function(_0x1122db,_0x33bdb7){var _0x25ce3a,_0x5180f1;return tts(_0x1122db,_0x33bdb7||'en',0x1)[_0x0a9e('0x29')](function(_0x46f0a5){logger[_0x0a9e('0x16')](_0x46f0a5);_0x25ce3a=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x2f'));return downloadFile(_0x46f0a5,_0x25ce3a);})[_0x0a9e('0x29')](function(){_0x5180f1=path['resolve'](__dirname,_0x0a9e('0x25'),rs['generate'](0x4)+_0x0a9e('0x27'));return convertFile(_0x25ce3a,_0x5180f1);})[_0x0a9e('0x29')](function(){try{fs[_0x0a9e('0x19')](_0x25ce3a);fs[_0x0a9e('0x2a')](_0x5180f1,'777');}catch(_0x191e91){logger[_0x0a9e('0x18')](_0x191e91);}logger[_0x0a9e('0x16')](_0x0a9e('0x30'),_0x5180f1['split']('.')[0x0]);return _0x5180f1['split']('.')[0x0];});};exports[_0x0a9e('0x31')]=function(_0x5640eb,_0x24936a,_0x3d9717){return google[_0x0a9e('0x32')](_0x5640eb,_0x24936a,_0x3d9717)[_0x0a9e('0x29')](function(_0x4f41ae){logger[_0x0a9e('0x16')](_0x4f41ae[_0x0a9e('0x33')]);return rp(_0x4f41ae);})[_0x0a9e('0x29')](function(_0x533942){var _0x1dbf74='';var _0x1a180b=0x0;try{fs[_0x0a9e('0x19')](_0x5640eb);}catch(_0x4c1c0e){logger['error'](_0x4c1c0e);}if(_0x533942&&_0x533942[_0x0a9e('0x34')]){_0x1dbf74=_0x533942[_0x0a9e('0x34')]['map'](function(_0x2b814e){return _0x2b814e&&_0x2b814e[_0x0a9e('0x35')][0x0]&&_0x2b814e[_0x0a9e('0x35')][0x0][_0x0a9e('0x36')]?_0x2b814e['alternatives'][0x0]['transcript']:'';})[_0x0a9e('0x37')]('\x0a');_0x1a180b=_0x533942[_0x0a9e('0x34')]['map'](function(_0x183991){return _0x183991&&_0x183991[_0x0a9e('0x35')][0x0]&&_0x183991[_0x0a9e('0x35')][0x0]['confidence']?_0x183991[_0x0a9e('0x35')][0x0][_0x0a9e('0x38')]:0x0;})[_0x0a9e('0x37')]('\x0a');}logger[_0x0a9e('0x16')](_0x0a9e('0x39'),_0x1dbf74);logger[_0x0a9e('0x16')](_0x0a9e('0x3a'),_0x1a180b);return{'transcript':_0x1dbf74,'confidence':_0x1a180b};})[_0x0a9e('0x3b')](function(_0x23b089){logger[_0x0a9e('0x18')](_0x0a9e('0x3c'),_0x23b089[_0x0a9e('0x11')],_0x23b089[_0x0a9e('0x3d')],_0x23b089[_0x0a9e('0x3e')]);});};exports[_0x0a9e('0x3f')]=function(_0x4d04c8,_0x52628e,_0x473fdc,_0xb3795a){var _0x405c8f=apiai(_0x52628e,{'language':_0xb3795a||'en'});return _0x405c8f[_0x0a9e('0x40')](_0x473fdc,{'sessionId':md5(_0x4d04c8)})[_0x0a9e('0x29')](function(_0xc9a702){logger[_0x0a9e('0x16')](JSON[_0x0a9e('0x41')](_0xc9a702));return{'source':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x43')],'resolvedQuery':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x44')],'action':_0xc9a702['result'][_0x0a9e('0x45')],'actionIncomplete':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x46')],'speech':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x47')][_0x0a9e('0x48')],'score':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x49')],'statusCode':_0xc9a702['status'][_0x0a9e('0x4a')],'endConversation':_0xc9a702['result'][_0x0a9e('0x4b')][_0x0a9e('0x4c')]||![],'isFallbackIntent':_0xc9a702[_0x0a9e('0x42')]['metadata'][_0x0a9e('0x4d')]};});};exports[_0x0a9e('0x4e')]=function(_0x4774f4,_0x34aa5a,_0x45c845,_0x37be73){return tilde[_0x0a9e('0x32')](_0x4774f4,_0x34aa5a,_0x45c845,_0x37be73)['then'](function(_0x13f44d){try{fs[_0x0a9e('0x19')](_0x4774f4);}catch(_0x1b5e80){logger[_0x0a9e('0x18')](_0x1b5e80);}logger[_0x0a9e('0x16')](_0x0a9e('0x4f'),_0x13f44d[_0x0a9e('0x36')]);logger[_0x0a9e('0x16')](_0x0a9e('0x50'),_0x13f44d['confidence']);return _0x13f44d;});};exports[_0x0a9e('0x51')]=function(_0x3fe430,_0x4f7240,_0x4ae14b,_0x5ddf84,_0x1adfee,_0x4317e3){var _0x37edaa=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x2f'));var _0x375c18;return aws['polly'](_0x3fe430,_0x4f7240,_0x4ae14b,_0x5ddf84,_0x1adfee,_0x4317e3,_0x37edaa)['then'](function(){_0x375c18=path['resolve'](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x27'));return convertFile(_0x37edaa,_0x375c18);})['then'](function(){try{fs[_0x0a9e('0x19')](_0x37edaa);fs[_0x0a9e('0x2a')](_0x375c18,'777');}catch(_0x5a88da){logger[_0x0a9e('0x18')](_0x5a88da);}return _0x375c18['split']('.')[0x0];});};exports[_0x0a9e('0x52')]=function(_0x4c3845,_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a,_0x2f82da){return aws[_0x0a9e('0x53')](_0x4c3845,_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a,_0x2f82da)['then'](function(_0x50f687){logger[_0x0a9e('0x16')](JSON[_0x0a9e('0x41')](_0x50f687));return _0x50f687;});};exports['ispeechTTS']=function(_0x145931,_0x5ce9ac,_0x211ef9,_0x523cd2){var _0xe22ccc=util['format']('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x145931,encodeURIComponent(_0x5ce9ac),_0x211ef9,_0x523cd2);var _0x5df0ad=path[_0x0a9e('0x24')](__dirname,'tmp',rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x2f'));var _0x3cfd00;return downloadFile(_0xe22ccc,_0x5df0ad)[_0x0a9e('0x29')](function(){_0x3cfd00=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x27'));return convertFile(_0x5df0ad,_0x3cfd00);})['then'](function(){try{fs[_0x0a9e('0x19')](_0x5df0ad);fs[_0x0a9e('0x2a')](_0x3cfd00,_0x0a9e('0x2b'));}catch(_0x30c491){logger[_0x0a9e('0x18')](_0x30c491);}return _0x3cfd00[_0x0a9e('0x2c')]('.')[0x0];});};exports['ispeechASR']=function(_0x956fbe,_0x26bc80,_0x5239ef,_0x3649cc){var _0x5cc8fb=util[_0x0a9e('0x54')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x26bc80,_0x5239ef,base64Encode(_0x956fbe),_0x3649cc?util['format']('model=%s',encodeURIComponent(_0x3649cc)):_0x0a9e('0x55'));return uploadFile(_0x5cc8fb)['then'](function(_0x2244d6){return querystring[_0x0a9e('0x56')](_0x2244d6);});};exports[_0x0a9e('0x57')]=function(_0x7be420,_0x1cca9f){return sestek[_0x0a9e('0x58')](_0x7be420,_0x1cca9f)['then'](function(_0x1627a7){logger['info'](JSON[_0x0a9e('0x41')](_0x1627a7));var _0x1f07cb={'speech':_0x1627a7[_0x0a9e('0x59')],'action':_0x1627a7['channelData']?_0x1627a7[_0x0a9e('0x5a')][_0x0a9e('0x5b')]:undefined,'actiondata':_0x1627a7[_0x0a9e('0x5a')]?_0x1627a7[_0x0a9e('0x5a')]['CustomActionData']:undefined};if(_0x1627a7[_0x0a9e('0x5a')]&&_0x1627a7[_0x0a9e('0x5a')]['AudioFromTts']){return base64Decode(_0x1627a7[_0x0a9e('0x5a')][_0x0a9e('0x5c')][_0x0a9e('0x5d')],path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs['generate'](0x4)+_0x0a9e('0x27')))[_0x0a9e('0x29')](function(_0x281c7d){_0x1f07cb['audiofile']=_0x281c7d;return _0x1f07cb;});}return _0x1f07cb;});};exports[_0x0a9e('0x5e')]=function(){return __dirname;};
\ No newline at end of file
index 4b3cd2a..c9e7334 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9527=['exports'];(function(_0x28c5d9,_0x5a308d){var _0x5396b5=function(_0x1fff0f){while(--_0x1fff0f){_0x28c5d9['push'](_0x28c5d9['shift']());}};_0x5396b5(++_0x5a308d);}(_0x9527,0xa8));var _0x7952=function(_0x5a4add,_0x4c1e89){_0x5a4add=_0x5a4add-0x0;var _0x333382=_0x9527[_0x5a4add];return _0x333382;};var nda=require('./nda');module[_0x7952('0x0')]={'nda':nda};
\ No newline at end of file
+var _0x6598=['./nda'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x6598,0x103));var _0x8659=function(_0x62f95,_0x1212e8){_0x62f95=_0x62f95-0x0;var _0x1774fb=_0x6598[_0x62f95];return _0x1774fb;};var nda=require(_0x8659('0x0'));module['exports']={'nda':nda};
\ No newline at end of file
index 7ba68c8..7a7495b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x997c=['calleridname','dnid','extension','text','access_token','project','body','ProjectName','AudioOutputSettings','audio/wav','custom_action','channelData','CustomAction','custom_action_data','CustomActionData','info','request-promise','url','../../../../../config/logger','agi','exports','resolve','ndauth_url','password','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','callerid'];(function(_0xaae5cc,_0x46d786){var _0x236171=function(_0x14a33c){while(--_0x14a33c){_0xaae5cc['push'](_0xaae5cc['shift']());}};_0x236171(++_0x46d786);}(_0x997c,0x14f));var _0xc997=function(_0x59d1be,_0x2ee674){_0x59d1be=_0x59d1be-0x0;var _0x381ad1=_0x997c[_0x59d1be];return _0x381ad1;};'use strict';var rp=require(_0xc997('0x0'));var url=require(_0xc997('0x1'));var logger=require(_0xc997('0x2'))(_0xc997('0x3'));module[_0xc997('0x4')]=function(_0x26d22c,_0x5f4398){var _0x5b22bf={'method':'POST','uri':url[_0xc997('0x5')](_0x5f4398[_0xc997('0x6')],'/token'),'form':{'grant_type':'password','username':_0x5f4398['username'],'password':_0x5f4398[_0xc997('0x7')]},'json':!![]};return rp(_0x5b22bf)['then'](function(_0x6627d4){var _0x5dbe58={'method':'POST','uri':url[_0xc997('0x5')](_0x5f4398[_0xc997('0x8')],_0xc997('0x9')),'body':{'type':_0x5f4398[_0xc997('0xa')]||_0xc997('0xb'),'channelId':'Nda','conversation':{'id':_0x26d22c['uniqueid']},'from':{'id':_0x26d22c[_0xc997('0xc')],'name':_0x26d22c[_0xc997('0xd')]},'recipient':{'id':_0x26d22c[_0xc997('0xe')],'name':_0x26d22c[_0xc997('0xf')]},'text':_0x5f4398[_0xc997('0x10')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x6627d4[_0xc997('0x11')]},'json':!![]};if(_0x5f4398[_0xc997('0x12')]){_0x5dbe58[_0xc997('0x13')]['channelData'][_0xc997('0x14')]=_0x5f4398['project'];}if(_0x5f4398['ndagenerate_audio']=='1'){_0x5dbe58[_0xc997('0x13')]['channelData'][_0xc997('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xc997('0x16')};}if(_0x5f4398[_0xc997('0x17')]){_0x5dbe58[_0xc997('0x13')][_0xc997('0x18')][_0xc997('0x19')]=_0x5f4398[_0xc997('0x17')];if(_0x5f4398[_0xc997('0x1a')]){_0x5dbe58['body']['channelData'][_0xc997('0x1b')]=_0x5f4398[_0xc997('0x1a')];}}logger[_0xc997('0x1c')](JSON['stringify'](_0x5dbe58));return rp(_0x5dbe58);});};
\ No newline at end of file
+var _0x5ac3=['text','Bearer\x20','access_token','project','body','ProjectName','ndagenerate_audio','channelData','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','stringify','request-promise','url','../../../../../config/logger','exports','POST','resolve','/token','password','username','then','/api/NaturalDialogAssistant/v1/Run','message','Nda','callerid','calleridname','dnid','extension'];(function(_0x25ff01,_0x3b03ca){var _0x462d1a=function(_0x958094){while(--_0x958094){_0x25ff01['push'](_0x25ff01['shift']());}};_0x462d1a(++_0x3b03ca);}(_0x5ac3,0xa9));var _0x35ac=function(_0x484c07,_0x562117){_0x484c07=_0x484c07-0x0;var _0x4ef81c=_0x5ac3[_0x484c07];return _0x4ef81c;};'use strict';var rp=require(_0x35ac('0x0'));var url=require(_0x35ac('0x1'));var logger=require(_0x35ac('0x2'))('agi');module[_0x35ac('0x3')]=function(_0x1b3ced,_0x3b108c){var _0x1697db={'method':_0x35ac('0x4'),'uri':url[_0x35ac('0x5')](_0x3b108c['ndauth_url'],_0x35ac('0x6')),'form':{'grant_type':_0x35ac('0x7'),'username':_0x3b108c[_0x35ac('0x8')],'password':_0x3b108c[_0x35ac('0x7')]},'json':!![]};return rp(_0x1697db)[_0x35ac('0x9')](function(_0x463753){var _0x2d2c80={'method':_0x35ac('0x4'),'uri':url[_0x35ac('0x5')](_0x3b108c['ndassistant_url'],_0x35ac('0xa')),'body':{'type':_0x3b108c['ndaactivity_type']||_0x35ac('0xb'),'channelId':_0x35ac('0xc'),'conversation':{'id':_0x1b3ced['uniqueid']},'from':{'id':_0x1b3ced[_0x35ac('0xd')],'name':_0x1b3ced[_0x35ac('0xe')]},'recipient':{'id':_0x1b3ced[_0x35ac('0xf')],'name':_0x1b3ced[_0x35ac('0x10')]},'text':_0x3b108c[_0x35ac('0x11')],'channelData':{}},'headers':{'Authorization':_0x35ac('0x12')+_0x463753[_0x35ac('0x13')]},'json':!![]};if(_0x3b108c[_0x35ac('0x14')]){_0x2d2c80[_0x35ac('0x15')]['channelData'][_0x35ac('0x16')]=_0x3b108c[_0x35ac('0x14')];}if(_0x3b108c[_0x35ac('0x17')]=='1'){_0x2d2c80[_0x35ac('0x15')][_0x35ac('0x18')][_0x35ac('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x35ac('0x1a')};}if(_0x3b108c[_0x35ac('0x1b')]){_0x2d2c80['body'][_0x35ac('0x18')][_0x35ac('0x1c')]=_0x3b108c[_0x35ac('0x1b')];if(_0x3b108c[_0x35ac('0x1d')]){_0x2d2c80[_0x35ac('0x15')][_0x35ac('0x18')]['CustomActionData']=_0x3b108c[_0x35ac('0x1d')];}}logger['info'](JSON[_0x35ac('0x1e')](_0x2d2c80));return rp(_0x2d2c80);});};
\ No newline at end of file
index c1df9de..e95c826 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x53f0=['exports','./lib/api'];(function(_0x2a94cf,_0x2b970d){var _0x22147f=function(_0xfc71ab){while(--_0xfc71ab){_0x2a94cf['push'](_0x2a94cf['shift']());}};_0x22147f(++_0x2b970d);}(_0x53f0,0x187));var _0x053f=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x53f0[_0x3ab51d];return _0x29a04e;};'use strict';var asr=require(_0x053f('0x0'));module[_0x053f('0x1')]=function(_0xaf0159,_0x1e0516,_0x25b143,_0xf5b4b2){return asr(_0xaf0159,_0x1e0516,_0x25b143,_0xf5b4b2);};
\ No newline at end of file
+var _0xac13=['./lib/api','exports'];(function(_0x590a38,_0x2bc65c){var _0xf36626=function(_0x551cd1){while(--_0x551cd1){_0x590a38['push'](_0x590a38['shift']());}};_0xf36626(++_0x2bc65c);}(_0xac13,0x148));var _0x3ac1=function(_0x29bfda,_0x30ad24){_0x29bfda=_0x29bfda-0x0;var _0x3f3db5=_0xac13[_0x29bfda];return _0x3f3db5;};'use strict';var asr=require(_0x3ac1('0x0'));module[_0x3ac1('0x1')]=function(_0x77d6e0,_0x4b150d,_0x410722,_0x5ee709){return asr(_0x77d6e0,_0x4b150d,_0x410722,_0x5ee709);};
\ No newline at end of file
index d0d5913..7d3239b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc847=['../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','sha1','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','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','bluebird','lodash','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc847,0x19f));var _0x7c84=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc847[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x7c84('0x0'));var _=require(_0x7c84('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x7c84('0x2'));var crypto=require('crypto');var logger=require(_0x7c84('0x3'))(_0x7c84('0x4'));module[_0x7c84('0x5')]=function(_0x220b97,_0x539445,_0x234f5d,_0x3e8c1d){return new BPromise(function(_0x5af30f,_0x515f6e){logger[_0x7c84('0x6')](_0x7c84('0x7'),_0x3e8c1d||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x212a93=new WebSocket(_0x3e8c1d||_0x7c84('0x8'),{'perMessageDeflate':![]});var _0x1edad2='';var _0x37dc41='0';var _0x2f70da='1';var _0x1a0bb5='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x850d19(_0x3c4bfe){var _0x4373e8=crypto['createHash'](_0x7c84('0x9'));_0x4373e8['update'](_0x3c4bfe);return _0x4373e8[_0x7c84('0xa')](_0x7c84('0xb'));}function _0x3ee931(){try{logger[_0x7c84('0x6')](_0x7c84('0xc'));var _0x1c0b5f=moment()[_0x7c84('0xd')]();var _0x3a97f6=_0x850d19(_0x1c0b5f+_0x539445+_0x234f5d);_0x212a93[_0x7c84('0xe')](JSON[_0x7c84('0xf')]({'appID':_0x539445,'timestamp':_0x1c0b5f,'appKey':_0x3a97f6}));var _0x5eb42a=fs['createReadStream'](_0x220b97);_0x5eb42a['on'](_0x7c84('0x10'),function(_0x139e26){_0x212a93[_0x7c84('0xe')](_0x139e26);});_0x5eb42a['on'](_0x7c84('0x11'),function(){_0x212a93['send'](_0x7c84('0x12'));});}catch(_0x13159b){logger[_0x7c84('0x13')](_0x7c84('0x14'),JSON['stringify'](_0x13159b));_0x212a93[_0x7c84('0x15')]();}}function _0x5cb642(_0x3ed6cf){try{if(_0x3ed6cf){var _0x45911b=JSON['parse'](_0x3ed6cf);switch(_0x45911b[_0x7c84('0x16')]){case 0x0:if(_0x45911b[_0x7c84('0x17')]){if(_0x45911b['result'][_0x7c84('0x18')]){logger['info'](_0x7c84('0x19'),JSON[_0x7c84('0xf')](_0x45911b[_0x7c84('0x17')]['hypotheses']));_0x1edad2=_0x45911b[_0x7c84('0x17')][_0x7c84('0x1a')][0x0][_0x7c84('0x1b')];_0x37dc41=_0x45911b[_0x7c84('0x17')][_0x7c84('0x1a')][0x0][_0x7c84('0x1c')];_0x2f70da='0';_0x1a0bb5='Success.';_0x212a93[_0x7c84('0x15')]();}}break;case 0x1:logger[_0x7c84('0x6')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x2f70da='1';_0x1a0bb5='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x7c84('0x6')](_0x7c84('0x1d'));_0x2f70da='2';_0x1a0bb5=_0x7c84('0x1d');break;case 0x9:logger[_0x7c84('0x6')](_0x7c84('0x1e'));_0x2f70da='9';_0x1a0bb5=_0x7c84('0x1e');break;case 0xa:logger[_0x7c84('0x6')](_0x7c84('0x1f'));_0x2f70da='10';_0x1a0bb5=_0x7c84('0x1f');break;case 0xb:logger[_0x7c84('0x6')](_0x7c84('0x20'));_0x2f70da='11';_0x1a0bb5='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x2ec8fe){logger[_0x7c84('0x13')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x7c84('0xf')](_0x2ec8fe));_0x212a93[_0x7c84('0x15')]();}}function _0x21f2ce(){logger[_0x7c84('0x6')]('Close\x20Tilde\x20ASR\x20socket');_0x5af30f({'transcript':_0x1edad2,'confidence':_0x37dc41,'status':_0x2f70da,'status_message':_0x1a0bb5});}function _0x43ed0c(_0x571ff9){logger[_0x7c84('0x13')](_0x7c84('0x21'));if(!_[_0x7c84('0x22')](_0x571ff9)){logger[_0x7c84('0x13')](_[_0x7c84('0x23')](_0x571ff9)?JSON['stringify'](_0x571ff9):_0x571ff9);}}_0x212a93['on'](_0x7c84('0x24'),_0x3ee931);_0x212a93['on'](_0x7c84('0x25'),_0x5cb642);_0x212a93['on'](_0x7c84('0x11'),_0x21f2ce);_0x212a93['on'](_0x7c84('0x13'),_0x43ed0c);});};
\ No newline at end of file
+var _0x9204=['createReadStream','data','close','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','Tilde\x20ASR\x20hypoteses','result','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.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','moment','crypto','../../../../../../config/logger','agi','exports','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify'];(function(_0x1ebe18,_0x20e83a){var _0x202735=function(_0x106807){while(--_0x106807){_0x1ebe18['push'](_0x1ebe18['shift']());}};_0x202735(++_0x20e83a);}(_0x9204,0xed));var _0x4920=function(_0x7fb6bf,_0x268e76){_0x7fb6bf=_0x7fb6bf-0x0;var _0x3cbe4e=_0x9204[_0x7fb6bf];return _0x3cbe4e;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x4920('0x0'));var crypto=require(_0x4920('0x1'));var logger=require(_0x4920('0x2'))(_0x4920('0x3'));module[_0x4920('0x4')]=function(_0x11e272,_0x2f16ae,_0x494491,_0x581388){return new BPromise(function(_0x3be9b9,_0x133147){logger['info']('Tilde\x20URI',_0x581388||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x2e1eef=new WebSocket(_0x581388||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x250404='';var _0x506838='0';var _0x12339='1';var _0x4d8122=_0x4920('0x5');function _0x4a84d2(_0x2b570d){var _0x4240ac=crypto[_0x4920('0x6')]('sha1');_0x4240ac[_0x4920('0x7')](_0x2b570d);return _0x4240ac[_0x4920('0x8')](_0x4920('0x9'));}function _0x264343(){try{logger[_0x4920('0xa')](_0x4920('0xb'));var _0x52fb01=moment()[_0x4920('0xc')]();var _0x38b24a=_0x4a84d2(_0x52fb01+_0x2f16ae+_0x494491);_0x2e1eef[_0x4920('0xd')](JSON[_0x4920('0xe')]({'appID':_0x2f16ae,'timestamp':_0x52fb01,'appKey':_0x38b24a}));var _0x4451bb=fs[_0x4920('0xf')](_0x11e272);_0x4451bb['on'](_0x4920('0x10'),function(_0x5a0b99){_0x2e1eef[_0x4920('0xd')](_0x5a0b99);});_0x4451bb['on'](_0x4920('0x11'),function(){_0x2e1eef[_0x4920('0xd')]('EOS');});}catch(_0x4d952f){logger[_0x4920('0x12')](_0x4920('0x13'),JSON[_0x4920('0xe')](_0x4d952f));_0x2e1eef[_0x4920('0x14')]();}}function _0x177c37(_0x5f38de){try{if(_0x5f38de){var _0xe2a43d=JSON[_0x4920('0x15')](_0x5f38de);switch(_0xe2a43d[_0x4920('0x16')]){case 0x0:if(_0xe2a43d['result']){if(_0xe2a43d['result']['final']){logger[_0x4920('0xa')](_0x4920('0x17'),JSON['stringify'](_0xe2a43d[_0x4920('0x18')][_0x4920('0x19')]));_0x250404=_0xe2a43d['result'][_0x4920('0x19')][0x0]['transcript'];_0x506838=_0xe2a43d['result'][_0x4920('0x19')][0x0]['likelihood'];_0x12339='0';_0x4d8122=_0x4920('0x1a');_0x2e1eef[_0x4920('0x14')]();}}break;case 0x1:logger[_0x4920('0xa')](_0x4920('0x5'));_0x12339='1';_0x4d8122='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x4920('0xa')](_0x4920('0x1b'));_0x12339='2';_0x4d8122=_0x4920('0x1b');break;case 0x9:logger[_0x4920('0xa')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x12339='9';_0x4d8122=_0x4920('0x1c');break;case 0xa:logger[_0x4920('0xa')](_0x4920('0x1d'));_0x12339='10';_0x4d8122=_0x4920('0x1d');break;case 0xb:logger[_0x4920('0xa')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x12339='11';_0x4d8122=_0x4920('0x1e');}}}catch(_0xd4146d){logger[_0x4920('0x12')](_0x4920('0x1f'),JSON[_0x4920('0xe')](_0xd4146d));_0x2e1eef[_0x4920('0x14')]();}}function _0x24ea89(){logger[_0x4920('0xa')]('Close\x20Tilde\x20ASR\x20socket');_0x3be9b9({'transcript':_0x250404,'confidence':_0x506838,'status':_0x12339,'status_message':_0x4d8122});}function _0x245f05(_0x2305ae){logger[_0x4920('0x12')](_0x4920('0x20'));if(!_[_0x4920('0x21')](_0x2305ae)){logger[_0x4920('0x12')](_[_0x4920('0x22')](_0x2305ae)?JSON['stringify'](_0x2305ae):_0x2305ae);}}_0x2e1eef['on'](_0x4920('0x23'),_0x264343);_0x2e1eef['on']('message',_0x177c37);_0x2e1eef['on']('close',_0x24ea89);_0x2e1eef['on']('error',_0x245f05);});};
\ No newline at end of file
index 7219baa..10cb4be 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x70e0=['exports','./asr'];(function(_0x3eb713,_0x437874){var _0x1d7128=function(_0x2b9cea){while(--_0x2b9cea){_0x3eb713['push'](_0x3eb713['shift']());}};_0x1d7128(++_0x437874);}(_0x70e0,0x17b));var _0x070e=function(_0x3dd71c,_0x3d541c){_0x3dd71c=_0x3dd71c-0x0;var _0x235da5=_0x70e0[_0x3dd71c];return _0x235da5;};var asr=require(_0x070e('0x0'));module[_0x070e('0x1')]={'asr':asr};
\ No newline at end of file
+var asr=require('./asr');module['exports']={'asr':asr};
\ No newline at end of file
index 5ecfb9f..e17f3b2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7c93=['call','error','E_AGI_ARGUMENT_PORT','listen','emit','listening','connection','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','net','EventEmitter','./error','127.0.0.1'];(function(_0x509cd4,_0x20a8bb){var _0x3e424f=function(_0x4e05ad){while(--_0x4e05ad){_0x509cd4['push'](_0x509cd4['shift']());}};_0x3e424f(++_0x20a8bb);}(_0x7c93,0xb9));var _0x37c9=function(_0x1cae5d,_0x4cf08d){_0x1cae5d=_0x1cae5d-0x0;var _0x357425=_0x7c93[_0x1cae5d];return _0x357425;};'use strict';var util=require('util');var net=require(_0x37c9('0x0'));var EventEmitter=require('events')[_0x37c9('0x1')];var AGIError=require(_0x37c9('0x2'));var AGIChannel=require('./channel');var AGIServer=function(_0x12ae04,_0x407b54,_0x3bbccf){var _0x884652=this,_0x12ae04=_0x12ae04||0x11dd,_0x407b54=_0x407b54||_0x37c9('0x3'),_0x6b62ea=null,_0x298fd5=0x0;EventEmitter[_0x37c9('0x4')](_0x884652);function _0x518549(){if(!_0x12ae04){_0x884652['emit'](_0x37c9('0x5'),new AGIError(_0x37c9('0x6')));return![];}_0x6b62ea=net['createServer']();_0x6b62ea[_0x37c9('0x7')](_0x12ae04,_0x407b54);_0x6b62ea['on']('listening',function(){_0x884652[_0x37c9('0x8')](_0x37c9('0x9'));});_0x6b62ea['on'](_0x37c9('0xa'),function(_0x1fa240){_0x6b62ea['getConnections'](function(_0x165174,_0x35a3e5){if(_0x165174){_0x884652[_0x37c9('0x8')](_0x37c9('0x5'),new AGIError(_0x37c9('0xb'),_0x165174));}else if(_0x3bbccf&&_0x3bbccf<0x0){_0x884652[_0x37c9('0x8')](_0x37c9('0x5'),new AGIError(_0x37c9('0xc')));_0x1fa240[_0x37c9('0xd')]();}else if(_0x3bbccf&&_0x3bbccf>0x0&&_0x3bbccf<_0x35a3e5){_0x298fd5+=0x1;_0x884652[_0x37c9('0x8')]('error',new AGIError(_0x37c9('0xe'),_0x298fd5));_0x1fa240[_0x37c9('0xd')]();}else{var _0xcc2a56=new AGIChannel(_0x1fa240);_0xcc2a56['on'](_0x37c9('0xf'),function(){_0x884652[_0x37c9('0x8')]('connection',_0xcc2a56);});}});});_0x6b62ea['on'](_0x37c9('0x5'),function(_0x5c5db4){_0x884652[_0x37c9('0x8')](_0x37c9('0x5'),new AGIError(_0x37c9('0xb'),_0x5c5db4['code']));});_0x6b62ea['on'](_0x37c9('0x10'),function(){_0x884652['emit'](_0x37c9('0x10'),new AGIError(_0x37c9('0x11')));});}process[_0x37c9('0x12')](function(){_0x518549();});};util[_0x37c9('0x13')](AGIServer,EventEmitter);module[_0x37c9('0x14')]=function(_0x81ced5,_0x57e0f0,_0xc63a0){return new AGIServer(_0x81ced5,_0x57e0f0,_0xc63a0);};
\ No newline at end of file
+var _0x1a67=['listening','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','ready','connection','code','close','E_AGI_SERVER_CLOSE','nextTick','exports','util','EventEmitter','./error','127.0.0.1','call','emit','error','createServer','listen'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1a67,0x1c5));var _0x71a6=function(_0x53ecc8,_0x5843a7){_0x53ecc8=_0x53ecc8-0x0;var _0x203b38=_0x1a67[_0x53ecc8];return _0x203b38;};'use strict';var util=require(_0x71a6('0x0'));var net=require('net');var EventEmitter=require('events')[_0x71a6('0x1')];var AGIError=require(_0x71a6('0x2'));var AGIChannel=require('./channel');var AGIServer=function(_0x3b118d,_0x3e1641,_0x4ecdba){var _0x556dca=this,_0x3b118d=_0x3b118d||0x11dd,_0x3e1641=_0x3e1641||_0x71a6('0x3'),_0x3a9925=null,_0x26b8f7=0x0;EventEmitter[_0x71a6('0x4')](_0x556dca);function _0x236196(){if(!_0x3b118d){_0x556dca[_0x71a6('0x5')](_0x71a6('0x6'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x3a9925=net[_0x71a6('0x7')]();_0x3a9925[_0x71a6('0x8')](_0x3b118d,_0x3e1641);_0x3a9925['on']('listening',function(){_0x556dca['emit'](_0x71a6('0x9'));});_0x3a9925['on']('connection',function(_0x272bda){_0x3a9925[_0x71a6('0xa')](function(_0x223154,_0x3e867d){if(_0x223154){_0x556dca[_0x71a6('0x5')](_0x71a6('0x6'),new AGIError(_0x71a6('0xb'),_0x223154));}else if(_0x4ecdba&&_0x4ecdba<0x0){_0x556dca[_0x71a6('0x5')](_0x71a6('0x6'),new AGIError(_0x71a6('0xc')));_0x272bda[_0x71a6('0xd')]();}else if(_0x4ecdba&&_0x4ecdba>0x0&&_0x4ecdba<_0x3e867d){_0x26b8f7+=0x1;_0x556dca[_0x71a6('0x5')](_0x71a6('0x6'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x26b8f7));_0x272bda[_0x71a6('0xd')]();}else{var _0x4d2896=new AGIChannel(_0x272bda);_0x4d2896['on'](_0x71a6('0xe'),function(){_0x556dca[_0x71a6('0x5')](_0x71a6('0xf'),_0x4d2896);});}});});_0x3a9925['on'](_0x71a6('0x6'),function(_0x1d3d76){_0x556dca[_0x71a6('0x5')](_0x71a6('0x6'),new AGIError(_0x71a6('0xb'),_0x1d3d76[_0x71a6('0x10')]));});_0x3a9925['on']('close',function(){_0x556dca[_0x71a6('0x5')](_0x71a6('0x11'),new AGIError(_0x71a6('0x12')));});}process[_0x71a6('0x13')](function(){_0x236196();});};util['inherits'](AGIServer,EventEmitter);module[_0x71a6('0x14')]=function(_0x372088,_0x151488,_0x44e7f8){return new AGIServer(_0x372088,_0x151488,_0x44e7f8);};
\ No newline at end of file
index 6a8b27b..abd70ab 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf24d=['ispeech_tts_language','en-US','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','includes','clone','replaceAllVariables','split','length','replaceAll','extra','getAndSetVariable','setVariable','maxRetry','retry','Enter\x20in\x20AGI\x20(%s)\x20block','answer','timeout','wait','result','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','sync','noop','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','options','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','SIP/%s','url','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','hasOwnProperty','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','toUpperCase','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','maxdigit','test','stringify','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','isString','message','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','%s.%s','beep','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','wav','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','true','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','unlink','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','no\x20operation\x20configured','isArray','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','getPause','pause_id','failure','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','gosub','QUEUE','record','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','subject','service','host','port','secure','authentication','auth','user','pass','template_id','Trying\x20SendMail\x20with\x20account\x20%s','sendMailMessage','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','path','util','lodash','odbc','randomstring','moment','mustache','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','menu','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','name','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUserById','getTrunk','getSoundPath','getMailAccount','getMailAccountById','getIntervalById','IntervalId','interval','map','format','%s/sounds/converted/%s','open','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','file','createSquareMessage','createCmContact','isEmpty','random','lastName','isNil','phone','list_id','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','shellCommand','exec','trim','replace','text','google_tts_language','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS'];(function(_0x5a2f2c,_0x5e02a9){var _0xf464d6=function(_0x4f8de4){while(--_0x4f8de4){_0x5a2f2c['push'](_0x5a2f2c['shift']());}};_0xf464d6(++_0x5e02a9);}(_0xf24d,0x13c));var _0xdf24=function(_0x3dd266,_0x4d919f){_0x3dd266=_0x3dd266-0x0;var _0x320665=_0xf24d[_0x3dd266];return _0x320665;};'use strict';var fs=require('fs');var path=require(_0xdf24('0x0'));var util=require(_0xdf24('0x1'));var _=require(_0xdf24('0x2'));var sh=require('shelljs');var odbc=require(_0xdf24('0x3'))();var rs=require(_0xdf24('0x4'));var moment=require(_0xdf24('0x5'));var Mustache=require(_0xdf24('0x6'));var logger=require(_0xdf24('0x7'))(_0xdf24('0x8'));var config=require(_0xdf24('0x9'));var scripts=require('./scripts');var FILES_PATH=_0xdf24('0xa');var verticesWithRetry=[_0xdf24('0xb'),_0xdf24('0xc'),_0xdf24('0xd')];var AGIVertices=function(_0x344784,_0x51b139,_0x13bdae){this['channel']=_0x344784;this[_0xdf24('0xe')]=_0x51b139;this[_0xdf24('0xf')]=_0x13bdae;};AGIVertices[_0xdf24('0x10')][_0xdf24('0x11')]=function(_0x14433a,_0x596478){this['rpc'][_0xdf24('0x12')](_0x14433a)[_0xdf24('0x13')](function(_0x2c8b47){_0x596478(null,_0x2c8b47?_0x2c8b47['name']:![]);})[_0xdf24('0x14')](function(_0x3a0f43){_0x596478(_0x3a0f43);});};AGIVertices[_0xdf24('0x10')][_0xdf24('0x15')]=function(_0x1fc8ae,_0x25a6d6){this[_0xdf24('0xe')][_0xdf24('0x16')](_0x1fc8ae)[_0xdf24('0x13')](function(_0x277c6d){_0x25a6d6(null,_0x277c6d?_0x277c6d[_0xdf24('0x17')]:![]);})['catch'](function(_0x31c087){_0x25a6d6(_0x31c087);});};AGIVertices[_0xdf24('0x10')][_0xdf24('0x18')]=function(_0x432c13,_0x295cfd){this[_0xdf24('0xe')][_0xdf24('0x19')](_0x432c13)[_0xdf24('0x13')](function(_0x4fcefa){_0x295cfd(null,_0x4fcefa?_0x4fcefa[_0xdf24('0x17')]:![]);})[_0xdf24('0x14')](function(_0x536cfc){_0x295cfd(_0x536cfc);});};AGIVertices[_0xdf24('0x10')][_0xdf24('0x1a')]=function(_0x27adff,_0x954473){this[_0xdf24('0xe')]['getSquareOdbcById'](_0x27adff)['then'](function(_0x4221a5){_0x954473(null,_0x4221a5?_0x4221a5[_0xdf24('0x1b')]:![]);})[_0xdf24('0x14')](function(_0x369bf9){_0x954473(_0x369bf9);});};AGIVertices['prototype']['getUser']=function(_0x2d9a6d,_0x15fb2f){this[_0xdf24('0xe')][_0xdf24('0x1c')](_0x2d9a6d)[_0xdf24('0x13')](function(_0x1ec6e7){_0x15fb2f(null,_0x1ec6e7?_0x1ec6e7[_0xdf24('0x17')]:![]);})[_0xdf24('0x14')](function(_0x3fd52b){_0x15fb2f(_0x3fd52b);});};AGIVertices[_0xdf24('0x10')][_0xdf24('0x1d')]=function(_0x2fb03d,_0x1dd4da){this[_0xdf24('0xe')]['getTrunkById'](_0x2fb03d)['then'](function(_0x494830){_0x1dd4da(null,_0x494830?_0x494830['name']:![]);})['catch'](function(_0x3f12a5){_0x1dd4da(_0x3f12a5);});};AGIVertices[_0xdf24('0x10')]['getSound']=function(_0xde8ea8,_0x2a85fb){var _0x2d1ede=this;this['rpc']['getSoundById'](_0xde8ea8)[_0xdf24('0x13')](function(_0x9ca267){_0x2a85fb(null,_0x9ca267?_0x2d1ede[_0xdf24('0x1e')](_0x9ca267['save_name']):![]);})['catch'](function(_0x58977c){_0x2a85fb(_0x58977c);});};AGIVertices[_0xdf24('0x10')][_0xdf24('0x1f')]=function(_0x1cadc8,_0x40ed74){this[_0xdf24('0xe')][_0xdf24('0x20')](_0x1cadc8)[_0xdf24('0x13')](function(_0x20a9bd){_0x40ed74(null,_0x20a9bd?_0x20a9bd:![]);})[_0xdf24('0x14')](function(_0x362340){_0x40ed74(_0x362340);});};AGIVertices[_0xdf24('0x10')]['sendMailMessage']=function(_0x46ebc3,_0x1c31d1,_0x598bfe){this[_0xdf24('0xf')]['sendMailMessage'](_0x46ebc3,_0x1c31d1)[_0xdf24('0x13')](function(){_0x598bfe(null);})[_0xdf24('0x14')](function(_0x5eaa5e){_0x598bfe(_0x5eaa5e);});};AGIVertices['prototype']['getIntervals']=function(_0x57dda9,_0x87e79c){this[_0xdf24('0xe')][_0xdf24('0x21')](_0x57dda9)[_0xdf24('0x13')](function(_0x4dda72){if(_0x4dda72){if(_0x4dda72[_0xdf24('0x22')]){_0x87e79c(null,[_0x4dda72[_0xdf24('0x23')]]);}else{_0x87e79c(null,_[_0xdf24('0x24')](_0x4dda72['Intervals'],'interval'));}}else{_0x87e79c(null,![]);}})[_0xdf24('0x14')](function(_0x32908e){_0x87e79c(_0x32908e);});};AGIVertices['prototype'][_0xdf24('0x1e')]=function(_0x3056a0){return util[_0xdf24('0x25')](_0xdf24('0x26'),FILES_PATH,_0x3056a0);};AGIVertices[_0xdf24('0x10')]['getQueryOdbc']=function(_0x5b2138,_0x3ba764,_0x13f84b){odbc[_0xdf24('0x27')](_0x5b2138,function(_0x39f8b4){if(_0x39f8b4){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x39f8b4);_0x13f84b(_0x39f8b4);}else{logger[_0xdf24('0x28')](_0xdf24('0x29'));odbc[_0xdf24('0x2a')](_0x3ba764,function(_0x169156,_0x110684){if(_0x169156){logger[_0xdf24('0x28')](_0xdf24('0x2b'),_0x3ba764);_0x13f84b(_0x169156);}else{logger[_0xdf24('0x28')](_0xdf24('0x2c'),_0x3ba764);odbc[_0xdf24('0x2d')](function(_0x57bff4){if(_0x57bff4){logger[_0xdf24('0x2e')](_0xdf24('0x2f'),_0x57bff4);}_0x13f84b(null,_0x110684);});}});}});};AGIVertices[_0xdf24('0x10')][_0xdf24('0x30')]=function(_0x282bbc,_0x1fc8f0){this[_0xdf24('0xe')][_0xdf24('0x31')](_0x282bbc)[_0xdf24('0x13')](function(_0x1daf6e){_0x1fc8f0(null,_0x1daf6e?_0x1daf6e:![]);})['catch'](function(_0x4dc712){_0x1fc8f0(_0x4dc712);});};AGIVertices[_0xdf24('0x10')][_0xdf24('0x32')]=function(_0x4a4c8d,_0x216ac1){this[_0xdf24('0xe')][_0xdf24('0x32')](_0x4a4c8d)[_0xdf24('0x13')](function(_0x2dd762){_0x216ac1(null,_0x2dd762);})['catch'](function(_0x48fa70){_0x216ac1(_0x48fa70);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0x29b237,_0x526df3,_0x583414){this['rpc'][_0xdf24('0x33')]({'uniqueid':this[_0xdf24('0x34')][_0xdf24('0x35')],'node':_0x29b237[_0xdf24('0x36')],'application':_0x29b237[_0xdf24('0x37')],'data':_0x526df3||null,'project_name':this[_0xdf24('0x34')][_0xdf24('0x38')],'callerid':this[_0xdf24('0x34')][_0xdf24('0x39')]})[_0xdf24('0x13')](function(_0x11f528){if(_0x583414){_0x583414(null,_0x11f528);}})['catch'](function(_0x32bbda){if(_0x583414){_0x583414(_0x32bbda);}});};AGIVertices[_0xdf24('0x10')][_0xdf24('0x3a')]=function(_0x2c3e01,_0x22a05d,_0x87c363,_0x224ab1){this[_0xdf24('0xe')][_0xdf24('0x3a')]({'uniqueid':this[_0xdf24('0x34')][_0xdf24('0x35')],'callerid':this[_0xdf24('0x34')][_0xdf24('0x39')],'calleridname':this[_0xdf24('0x34')][_0xdf24('0x3b')],'context':this[_0xdf24('0x34')][_0xdf24('0x3c')],'extension':this[_0xdf24('0x34')][_0xdf24('0x3d')],'priority':this[_0xdf24('0x34')][_0xdf24('0x3e')],'accountcode':this[_0xdf24('0x34')]['accountcode'],'dnid':this[_0xdf24('0x34')]['dnid'],'projectName':this['channel'][_0xdf24('0x38')],'saveName':_0x22a05d,'filename':_0x2c3e01[_0xdf24('0x3f')]||_0x22a05d,'savePath':_0x87c363})['then'](function(_0x1ea911){_0x224ab1(null,_0x1ea911);})[_0xdf24('0x14')](function(_0x174e2f){_0x224ab1(_0x174e2f);});};AGIVertices[_0xdf24('0x10')][_0xdf24('0x40')]=function(_0x123b7a,_0x5b6e46,_0x47ec57){this['rpc']['createSquareMessage']({'uniqueid':this[_0xdf24('0x34')]['uniqueid'],'body':_0x123b7a,'direction':_0x5b6e46})[_0xdf24('0x13')](function(_0x4bd77b){if(_0x47ec57){_0x47ec57(null,_0x4bd77b);}})[_0xdf24('0x14')](function(_0x56f871){if(_0x47ec57){_0x47ec57(_0x56f871);}});};AGIVertices[_0xdf24('0x10')][_0xdf24('0x41')]=function(_0x13e21d,_0x1898b0){this[_0xdf24('0xe')][_0xdf24('0x41')]({'firstName':_[_0xdf24('0x42')](_0x13e21d[_0xdf24('0x17')])||_['isNil'](_0x13e21d[_0xdf24('0x17')])?'callback_'+Math[_0xdf24('0x43')]():_0x13e21d[_0xdf24('0x17')],'lastName':_[_0xdf24('0x42')](_0x13e21d[_0xdf24('0x44')])||_[_0xdf24('0x45')](_0x13e21d[_0xdf24('0x44')])?null:_0x13e21d['lastName'],'phone':_0x13e21d[_0xdf24('0x46')],'ListId':_0x13e21d[_0xdf24('0x47')],'scheduledAt':_0x13e21d['scheduledAt'],'callbackUniqueid':this['channel'][_0xdf24('0x35')],'tags':'callback','description':_0xdf24('0x48')+_0x13e21d[_0xdf24('0x49')][_0xdf24('0x4a')](),'priority':_0x13e21d[_0xdf24('0x4b')]})[_0xdf24('0x13')](function(_0x3cee65){_0x1898b0(null,_0x3cee65);})[_0xdf24('0x14')](function(_0x35c5f3){_0x1898b0(_0x35c5f3);});};AGIVertices['prototype']['getPause']=function(_0x312f48,_0x579eb1){this[_0xdf24('0xe')]['getPauseById'](_0x312f48)[_0xdf24('0x13')](function(_0x1fd384){_0x579eb1(null,_0x1fd384?_0x1fd384[_0xdf24('0x17')]:![]);})['catch'](function(_0x2bd49a){_0x579eb1(_0x2bd49a);});};AGIVertices['prototype'][_0xdf24('0x4c')]=function(_0x2c8c82,_0x516ab7,_0x5d3232){var _0x47370e={'role':_0xdf24('0x4d')};_0x47370e[_0x2c8c82]=this[_0xdf24('0x34')][_0xdf24('0x39')];this[_0xdf24('0xe')][_0xdf24('0x4c')](_0x47370e,_0x516ab7,this[_0xdf24('0x34')][_0xdf24('0x35')])[_0xdf24('0x13')](function(_0x21f81f){_0x5d3232(null,_[_0xdf24('0x45')](_0x21f81f)?![]:!![]);})['catch'](function(_0x2b72cb){logger['error'](_0x2b72cb);_0x5d3232(null,![]);});};AGIVertices['prototype'][_0xdf24('0x4e')]=function(_0x598ab3,_0x3aa681){var _0xb274be={'role':_0xdf24('0x4d')};_0xb274be[_0x598ab3]=this['channel']['callerid'];this['rpc'][_0xdf24('0x4e')](_0xb274be)[_0xdf24('0x13')](function(_0x2597c3){_0x3aa681(null,_[_0xdf24('0x45')](_0x2597c3)?![]:!![]);})[_0xdf24('0x14')](function(_0x34c205){logger[_0xdf24('0x2e')](_0x34c205);_0x3aa681(null,![]);});};AGIVertices[_0xdf24('0x10')][_0xdf24('0x4f')]=function(_0x3833bb,_0x5dab28){var _0x32df9a={'role':_0xdf24('0x4d')};_0x32df9a[_0x3833bb]=this['channel'][_0xdf24('0x39')];this[_0xdf24('0xe')]['agentLogout'](_0x32df9a)[_0xdf24('0x13')](function(_0x2f539a){_0x5dab28(null,_[_0xdf24('0x45')](_0x2f539a)?![]:!![]);})['catch'](function(_0x519f60){logger[_0xdf24('0x2e')](_0x519f60);_0x5dab28(null,![]);});};AGIVertices[_0xdf24('0x10')][_0xdf24('0x50')]=function(_0x56fa10,_0x26a4a2){var _0xe3cd8={'role':_0xdf24('0x4d')};_0xe3cd8[_0x56fa10]=this[_0xdf24('0x34')][_0xdf24('0x39')];var _0x495167=_0x56fa10!=_0xdf24('0x51')?util[_0xdf24('0x25')]('%s/%s@from-sip/n','LOCAL',this[_0xdf24('0x34')]['callerid']):undefined;this[_0xdf24('0xe')][_0xdf24('0x50')](_0xe3cd8,_0x495167)['then'](function(_0x3bc0d8){_0x26a4a2(null,_[_0xdf24('0x45')](_0x3bc0d8)?![]:!![]);})[_0xdf24('0x14')](function(_0x19a995){logger[_0xdf24('0x2e')](_0x19a995);_0x26a4a2(null,![]);});};AGIVertices[_0xdf24('0x10')][_0xdf24('0x52')]=function(_0x3fcc7a,_0x548a84){sh[_0xdf24('0x53')](_[_0xdf24('0x54')](_0x3fcc7a),function(_0x354c06,_0x4f8c4a){var _0x128100=_0x4f8c4a[_0xdf24('0x55')](/(\r\n|\n|\r)/gm,'');_0x548a84(null,_0x128100);});};AGIVertices[_0xdf24('0x10')]['googleTTS']=function(_0x346793,_0x4f4f80){scripts['googleTTS'](_0x346793[_0xdf24('0x56')],_0x346793[_0xdf24('0x57')]||'en',0x1)[_0xdf24('0x13')](function(_0xc5baf2){_0x4f4f80(null,_0xc5baf2);})[_0xdf24('0x14')](function(_0x1b83d5){_0x4f4f80(_0x1b83d5);});};AGIVertices['prototype'][_0xdf24('0x58')]=function(_0x1f5e86,_0x1a00bd){scripts['googleDialogflow'](this[_0xdf24('0x34')][_0xdf24('0x35')],_0x1f5e86[_0xdf24('0x59')],_0x1f5e86[_0xdf24('0x56')],_0x1f5e86[_0xdf24('0x5a')]||'en')['then'](function(_0x73e947){_0x1a00bd(null,_0x73e947);})[_0xdf24('0x14')](function(_0x4e1fc1){_0x1a00bd(_0x4e1fc1);});};AGIVertices[_0xdf24('0x10')][_0xdf24('0x5b')]=function(_0x57fd26,_0x57bdd2){scripts['sestekNDA'](this[_0xdf24('0x34')],_0x57fd26)['then'](function(_0x2752a8){_0x57bdd2(null,_0x2752a8);})[_0xdf24('0x14')](function(_0x4d16d3){_0x57bdd2(_0x4d16d3);});};AGIVertices[_0xdf24('0x10')][_0xdf24('0x5c')]=function(_0x584a12,_0x5dcbaa){scripts[_0xdf24('0x5c')](_0x584a12['key'],_0x584a12[_0xdf24('0x56')],_0x584a12[_0xdf24('0x5d')]||_0xdf24('0x5e'),_0x584a12[_0xdf24('0x5f')])['then'](function(_0x374e31){_0x5dcbaa(null,_0x374e31);})[_0xdf24('0x14')](function(_0x32b874){_0x5dcbaa(_0x32b874);});};AGIVertices[_0xdf24('0x10')]['ispeechASR']=function(_0x256cc1,_0x5e035e,_0x38e4ab){scripts[_0xdf24('0x60')](_0x5e035e,_0x256cc1[_0xdf24('0x59')],_0x256cc1['ispeech_asr_language']||_0xdf24('0x5e'),this[_0xdf24('0x61')](_0x256cc1[_0xdf24('0x62')])?_0x256cc1[_0xdf24('0x62')]:undefined)[_0xdf24('0x13')](function(_0x1a27e0){_0x38e4ab(null,_0x1a27e0);})['catch'](function(_0x341140){_0x38e4ab(_0x341140);});};AGIVertices[_0xdf24('0x10')][_0xdf24('0x63')]=function(_0x1a589a,_0x5990e2){scripts[_0xdf24('0x63')](_0x1a589a[_0xdf24('0x64')],_0x1a589a[_0xdf24('0x65')],_0x1a589a['aws_polly_region'],_0x1a589a[_0xdf24('0x66')]||_0xdf24('0x67'),_0x1a589a[_0xdf24('0x56')],_0x1a589a[_0xdf24('0x68')]||_0xdf24('0x56'))[_0xdf24('0x13')](function(_0x2cd586){_0x5990e2(null,_0x2cd586);})['catch'](function(_0x133428){_0x5990e2(_0x133428);});};AGIVertices[_0xdf24('0x10')][_0xdf24('0x69')]=function(_0x56dba9,_0x26008d){scripts[_0xdf24('0x69')](this['channel']['uniqueid'],_0x56dba9[_0xdf24('0x64')],_0x56dba9[_0xdf24('0x65')],_0x56dba9[_0xdf24('0x6a')],_0x56dba9[_0xdf24('0x56')],_0x56dba9['aws_bot_name'])['then'](function(_0x684f7b){_0x26008d(null,_0x684f7b);})['catch'](function(_0xeed2f6){_0x26008d(_0xeed2f6);});};AGIVertices['prototype'][_0xdf24('0x6b')]=function(_0x14520f,_0x115362,_0x23bbcc){scripts[_0xdf24('0x6b')](_0x115362,_0x14520f['key'],_0x14520f[_0xdf24('0x6c')]||_0xdf24('0x5e'))[_0xdf24('0x13')](function(_0x3644ba){_0x23bbcc(null,_0x3644ba);})['catch'](function(_0x5f3111){_0x23bbcc(_0x5f3111);});};AGIVertices[_0xdf24('0x10')][_0xdf24('0x6d')]=function(_0x1bb5b7,_0xd50abb,_0x499c36){scripts[_0xdf24('0x6d')](_0xd50abb,_0x1bb5b7[_0xdf24('0x6e')],_0x1bb5b7[_0xdf24('0x6f')],_0x1bb5b7[_0xdf24('0x70')])[_0xdf24('0x13')](function(_0x135e4d){_0x499c36(null,_0x135e4d);})['catch'](function(_0x2cd5ee){_0x499c36(_0x2cd5ee);});};AGIVertices['prototype']['clear']=function(_0x1eebcf){var _0x41b9b5=_[_0xdf24('0x71')](verticesWithRetry,_0x1eebcf[_0xdf24('0x37')])?_0x1eebcf:_[_0xdf24('0x72')](_0x1eebcf);for(var _0x513a25 in _0x41b9b5){if(_0x41b9b5['hasOwnProperty'](_0x513a25)){if(_0x41b9b5[_0x513a25]&&_['isString'](_0x41b9b5[_0x513a25])){_0x41b9b5[_0x513a25]=this['replaceAllVariables'](_0x41b9b5[_0x513a25]);}}}return _0x41b9b5;};AGIVertices['prototype'][_0xdf24('0x73')]=function(_0x4a04b5){var _0x1bd4b9=_0x4a04b5[_0xdf24('0x74')]('{');for(var _0x5a128f=0x1;_0x5a128f<_0x1bd4b9[_0xdf24('0x75')];_0x5a128f+=0x1){var _0x2868d1=_0x1bd4b9[_0x5a128f][_0xdf24('0x74')]('}');if(_0x2868d1[_0xdf24('0x75')]>0x1){_0x4a04b5=_0x4a04b5[_0xdf24('0x76')]('{'+_0x2868d1[0x0]+'}',this[_0xdf24('0x34')][_0xdf24('0x11')](_0x2868d1[0x0])[_0xdf24('0x77')]||_0x2868d1[0x0]);}}if(_0x1bd4b9[_0xdf24('0x75')]===0x1){return _0x4a04b5['toString']();}return this[_0xdf24('0x73')](_0x4a04b5);};AGIVertices[_0xdf24('0x10')][_0xdf24('0x78')]=function(_0x2c4bad,_0x3852ae){var _0x2e3489=this['channel']['getVariable'](_0x2c4bad);if(_0x2e3489['result']===-0x1){return _0x2e3489;}logger[_0xdf24('0x28')](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x3852ae,_0x2e3489[_0xdf24('0x77')]));return this[_0xdf24('0x34')][_0xdf24('0x79')](_0x3852ae,_0x2e3489[_0xdf24('0x77')]);};AGIVertices[_0xdf24('0x10')][_0xdf24('0x61')]=function(_0xc778e2){return _0xc778e2&&_0xc778e2!=='0'&&_0xc778e2!=='-1'&&_0xc778e2!=='';};AGIVertices[_0xdf24('0x10')][_0xdf24('0x7a')]=function(_0x18b74f){this[_0xdf24('0x33')]['sync'](this,_0x18b74f,'-');_0x18b74f[_0xdf24('0x7b')]=_0x18b74f[_0xdf24('0x7a')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0xdf24('0x8')]=function(_0x494f33){logger[_0xdf24('0x28')](util[_0xdf24('0x25')](_0xdf24('0x7c'),_0x494f33[_0xdf24('0x36')]));return this[_0xdf24('0x34')][_0xdf24('0x8')]([_0x494f33['command'],_0x494f33['args']]);};AGIVertices[_0xdf24('0x10')][_0xdf24('0x7d')]=function(_0x47e051){logger[_0xdf24('0x28')](util[_0xdf24('0x25')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x47e051[_0xdf24('0x36')]));if(this[_0xdf24('0x61')](_0x47e051[_0xdf24('0x7e')])){logger[_0xdf24('0x28')](util['format']('Wait\x20%s\x20seconds\x20before\x20answer',_0x47e051[_0xdf24('0x7e')]));var _0x5cbf6d=this[_0xdf24('0x34')][_0xdf24('0x7f')](_0x47e051['timeout']);if(_0x5cbf6d[_0xdf24('0x80')]===-0x1){return _0x5cbf6d;}}return this[_0xdf24('0x34')]['answer']();};AGIVertices[_0xdf24('0x10')][_0xdf24('0x81')]=function(_0x50ec07){logger[_0xdf24('0x28')](util[_0xdf24('0x25')](_0xdf24('0x82'),_0x50ec07[_0xdf24('0x36')]));if(!this[_0xdf24('0x61')](_0x50ec07[_0xdf24('0x47')])){return this[_0xdf24('0x34')][_0xdf24('0x2e')](_0x50ec07,_0xdf24('0x83'));}_0x50ec07['scheduledAt']=moment();if(this[_0xdf24('0x61')](_0x50ec07[_0xdf24('0x84')])){_0x50ec07[_0xdf24('0x49')]=moment()[_0xdf24('0x85')](_0x50ec07['delay'],'minutes');}if(!this[_0xdf24('0x61')](_0x50ec07[_0xdf24('0x4b')])){_0x50ec07['callback_priority']=0x2;}this['createCmContact'][_0xdf24('0x86')](this,_0x50ec07);return this['channel'][_0xdf24('0x87')](util['format'](_0xdf24('0x88'),_0x50ec07[_0xdf24('0x46')],_0x50ec07[_0xdf24('0x47')],_0x50ec07['scheduledAt']));};AGIVertices[_0xdf24('0x10')][_0xdf24('0x89')]=function(_0x2a9709){logger[_0xdf24('0x28')](util[_0xdf24('0x25')](_0xdf24('0x8a'),_0x2a9709[_0xdf24('0x36')]));var _0x3c88bf=this[_0xdf24('0x34')][_0xdf24('0x53')](_0x2a9709[_0xdf24('0x8b')],_0x2a9709['options']);if(_0x3c88bf[_0xdf24('0x80')]===-0x1){return _0x3c88bf;}return this[_0xdf24('0x34')][_0xdf24('0x87')](util[_0xdf24('0x25')]('Executed\x20command\x20%s\x20%s',_0x2a9709[_0xdf24('0x8b')],_0x2a9709[_0xdf24('0x8c')]));};AGIVertices[_0xdf24('0x10')]['lumenvoxtts']=function(_0x726ead){logger[_0xdf24('0x28')](util['format'](_0xdf24('0x8d'),_0x726ead[_0xdf24('0x36')]));if(!this[_0xdf24('0x61')](_0x726ead[_0xdf24('0x56')])){return this['channel'][_0xdf24('0x87')](_0xdf24('0x8e'));}var _0x4f91df='\x22'+_0x726ead[_0xdf24('0x56')]+'\x22';if(this[_0xdf24('0x61')](_0x726ead[_0xdf24('0x8c')])){_0x4f91df+=','+_0x726ead['options'];}var _0x1f270a=this[_0xdf24('0x34')]['exec'](_0xdf24('0x8f'),_0x4f91df);if(_0x1f270a[_0xdf24('0x80')]===-0x1){return _0x1f270a;}return this[_0xdf24('0x34')][_0xdf24('0x87')](util[_0xdf24('0x25')](_0xdf24('0x90'),_0x4f91df));};AGIVertices[_0xdf24('0x10')][_0xdf24('0x91')]=function(_0xffa4c){logger[_0xdf24('0x28')](util['format'](_0xdf24('0x92'),_0xffa4c[_0xdf24('0x36')]));if(!this[_0xdf24('0x61')](_0xffa4c[_0xdf24('0x56')])){return this['channel'][_0xdf24('0x87')]('no\x20text\x20configured');}var _0x133c0b='\x22'+_0xffa4c[_0xdf24('0x56')]+'\x22';if(this[_0xdf24('0x61')](_0xffa4c[_0xdf24('0x8c')])){_0x133c0b+=','+_0xffa4c[_0xdf24('0x8c')];}var _0x1ac56b=this[_0xdf24('0x34')][_0xdf24('0x53')](_0xdf24('0x8f'),_0x133c0b);if(_0x1ac56b[_0xdf24('0x80')]===-0x1){return _0x1ac56b;}return this[_0xdf24('0x34')][_0xdf24('0x87')](util[_0xdf24('0x25')](_0xdf24('0x90'),_0x133c0b));};AGIVertices[_0xdf24('0x10')][_0xdf24('0x93')]=function(_0x3d0c9a){logger[_0xdf24('0x28')](util[_0xdf24('0x25')](_0xdf24('0x94'),_0x3d0c9a[_0xdf24('0x36')]));if(!this[_0xdf24('0x61')](_0x3d0c9a[_0xdf24('0x95')])){return this[_0xdf24('0x34')][_0xdf24('0x87')](_0xdf24('0x96'));}var _0x252488=_0x3d0c9a['grammar'];if(this[_0xdf24('0x61')](_0x3d0c9a[_0xdf24('0x8c')])){_0x252488+=','+_0x3d0c9a['options'];}var _0x19f5a4=this[_0xdf24('0x34')][_0xdf24('0x53')](_0xdf24('0x97'),_0x252488);if(_0x19f5a4[_0xdf24('0x80')]===-0x1){return _0x19f5a4;}var _0x3d71d8=this[_0xdf24('0x78')](_0xdf24('0x98'),_0xdf24('0x99'));if(_0x3d71d8[_0xdf24('0x80')]===-0x1){return _0x3d71d8;}var _0x4232c1=this[_0xdf24('0x78')](_0xdf24('0x9a'),_0xdf24('0x9b'));if(_0x4232c1[_0xdf24('0x80')]===-0x1){return _0x4232c1;}var _0x12565a=this[_0xdf24('0x78')](_0xdf24('0x9c'),_0xdf24('0x9d'));if(_0x12565a[_0xdf24('0x80')]===-0x1){return _0x12565a;}return this[_0xdf24('0x34')][_0xdf24('0x87')](util[_0xdf24('0x25')]('Executed\x20command\x20MRCPRecog\x20%s',_0x252488));};AGIVertices['prototype']['sestekasr']=function(_0x1b6be6){logger[_0xdf24('0x28')](util[_0xdf24('0x25')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x1b6be6[_0xdf24('0x36')]));if(!this[_0xdf24('0x61')](_0x1b6be6[_0xdf24('0x95')])){return this[_0xdf24('0x34')][_0xdf24('0x87')](_0xdf24('0x96'));}var _0x200868=_0x1b6be6[_0xdf24('0x95')];if(this[_0xdf24('0x61')](_0x1b6be6[_0xdf24('0x8c')])){_0x200868+=','+_0x1b6be6[_0xdf24('0x8c')];}var _0x2bb1a2=this['channel'][_0xdf24('0x53')](_0xdf24('0x97'),_0x200868);if(_0x2bb1a2[_0xdf24('0x80')]===-0x1){return _0x2bb1a2;}var _0x469ad4=this['getAndSetVariable'](_0xdf24('0x98'),_0xdf24('0x9e'));if(_0x469ad4[_0xdf24('0x80')]===-0x1){return _0x469ad4;}var _0x266752=this[_0xdf24('0x78')](_0xdf24('0x9a'),_0xdf24('0x9f'));if(_0x266752[_0xdf24('0x80')]===-0x1){return _0x266752;}var _0x116c73=this[_0xdf24('0x78')]('RECOG_INSTANCE()',_0xdf24('0xa0'));if(_0x116c73[_0xdf24('0x80')]===-0x1){return _0x116c73;}return this[_0xdf24('0x34')][_0xdf24('0x87')](util[_0xdf24('0x25')]('Executed\x20command\x20MRCPRecog\x20%s',_0x200868));};AGIVertices[_0xdf24('0x10')]['database']=function(_0x395cf6){logger[_0xdf24('0x28')](util[_0xdf24('0x25')](_0xdf24('0xa1'),_0x395cf6[_0xdf24('0x36')]));if(!this[_0xdf24('0x61')](_0x395cf6[_0xdf24('0xa2')])){return this[_0xdf24('0x34')][_0xdf24('0x2e')](_0x395cf6,_0xdf24('0xa3'));}var _0x55c429=this[_0xdf24('0x1a')]['sync'](this,_0x395cf6[_0xdf24('0xa2')]);if(!_0x55c429){return this[_0xdf24('0x34')][_0xdf24('0x2e')](_0x395cf6,_0xdf24('0xa4'));}if(!this['isConfigured'](_0x395cf6[_0xdf24('0x2a')])){return this[_0xdf24('0x34')][_0xdf24('0x2e')](_0x395cf6,_0xdf24('0xa5'));}var _0x31ae3c=_0x395cf6[_0xdf24('0x2a')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xdf24('0x87')](util[_0xdf24('0x25')](_0xdf24('0xa6'),_0x31ae3c));var _0x1ca6d5=this[_0xdf24('0xa7')][_0xdf24('0x86')](this,_0x55c429,_0x31ae3c);this['createSquareDetailsReport'][_0xdf24('0x86')](this,_0x395cf6,_0x31ae3c);if(!this['isConfigured'](_0x395cf6[_0xdf24('0xa8')])){return this['channel']['noop'](_0xdf24('0xa9'));}var _0x3ec9f1=this[_0xdf24('0x11')]['sync'](this,_0x395cf6[_0xdf24('0xa8')]);if(!_0x3ec9f1){return this[_0xdf24('0x34')][_0xdf24('0x2e')](_0x395cf6,_0xdf24('0xaa'));}var _0x822a1e=this;_0x1ca6d5[_0xdf24('0xab')](function(_0xb1ac62,_0x550ef8){Object[_0xdf24('0xac')](_0xb1ac62)['forEach'](function(_0x2dd2af){_0x822a1e[_0xdf24('0x34')][_0xdf24('0x79')](util[_0xdf24('0x25')]('%s[%s][%s]',_0x3ec9f1,_0x550ef8,_0x2dd2af),_0xb1ac62[_0x2dd2af]);});});this[_0xdf24('0x34')]['setVariable'](util[_0xdf24('0x25')]('%s_ROWS_COUNT',_0x3ec9f1),_0x1ca6d5[_0xdf24('0x75')]);return this[_0xdf24('0x34')]['noop'](util[_0xdf24('0x25')]('variable\x20%s\x20set',_0x3ec9f1));};AGIVertices['prototype']['dial']=function(_0x35435e){logger[_0xdf24('0xad')](util[_0xdf24('0x25')](_0xdf24('0xae'),_0x35435e[_0xdf24('0x36')]));if(!this[_0xdf24('0x61')](_0x35435e[_0xdf24('0xaf')])){return this[_0xdf24('0x34')]['error'](_0x35435e,_0xdf24('0xb0'));}var _0xfe91aa=this[_0xdf24('0xb1')]['sync'](this,_0x35435e[_0xdf24('0xaf')]);if(!_0xfe91aa){return this['channel'][_0xdf24('0x2e')](_0x35435e,_0xdf24('0xb2'));}var _0x354996=this[_0xdf24('0x34')]['exec'](_0xdf24('0xb3'),[util[_0xdf24('0x25')](_0xdf24('0xb4'),_0xfe91aa),_0x35435e['timeout'],_0x35435e['opts'],_0x35435e[_0xdf24('0xb5')]]);if(_0x354996['result']===-0x1){return _0x354996;}return this[_0xdf24('0x34')][_0xdf24('0x87')](util[_0xdf24('0x25')](_0xdf24('0xb6'),'DIAL'));};AGIVertices[_0xdf24('0x10')][_0xdf24('0xb7')]=function(_0xdb16fa){logger[_0xdf24('0x28')](util['format'](_0xdf24('0xb8'),_0xdb16fa[_0xdf24('0x36')]));if(!this[_0xdf24('0x61')](_0xdb16fa[_0xdf24('0x59')])){return this[_0xdf24('0x34')][_0xdf24('0x87')](_0xdf24('0xb9'));}if(!this[_0xdf24('0x61')](_0xdb16fa[_0xdf24('0x56')])){return this[_0xdf24('0x34')][_0xdf24('0x87')](_0xdf24('0x8e'));}this['channel'][_0xdf24('0xba')]=!![];this[_0xdf24('0x33')](_0xdb16fa);this[_0xdf24('0x40')](_0xdb16fa[_0xdf24('0x56')],'in');this[_0xdf24('0x34')][_0xdf24('0x87')](util[_0xdf24('0x25')]('Trying\x20Dialogflow:\x20%s',_0xdb16fa[_0xdf24('0x56')]));var _0x20519a=this[_0xdf24('0x58')]['sync'](this,_0xdb16fa);if(_0x20519a){for(var _0x6d72ee in _0x20519a){if(_0x20519a[_0xdf24('0xbb')](_0x6d72ee)){this['channel'][_0xdf24('0x79')](util[_0xdf24('0x25')](_0xdf24('0xbc'),_0x6d72ee['toUpperCase']()),_0x20519a[_0x6d72ee]);}}this[_0xdf24('0x40')](_0x20519a[_0xdf24('0xbd')],_0xdf24('0xbe'));return this[_0xdf24('0x34')]['noop'](util[_0xdf24('0x25')](_0xdf24('0xbf'),_0x20519a[_0xdf24('0xbd')]));}return this[_0xdf24('0x34')][_0xdf24('0x2e')](_0xdb16fa,_0xdf24('0xc0'));};AGIVertices[_0xdf24('0x10')][_0xdf24('0xc1')]=function(_0x8a9c22){logger[_0xdf24('0x28')](util[_0xdf24('0x25')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x8a9c22[_0xdf24('0x36')]));if(!this[_0xdf24('0x61')](_0x8a9c22[_0xdf24('0xc2')])){return this[_0xdf24('0x34')][_0xdf24('0x87')](_0xdf24('0xc3'));}if(!this['isConfigured'](_0x8a9c22[_0xdf24('0xc4')])){return this[_0xdf24('0x34')][_0xdf24('0x87')](_0xdf24('0xc5'));}if(!this[_0xdf24('0x61')](_0x8a9c22[_0xdf24('0xc6')])){return this[_0xdf24('0x34')]['noop']('no\x20password\x20configured');}if(!this['isConfigured'](_0x8a9c22[_0xdf24('0xc7')])){return this[_0xdf24('0x34')]['noop'](_0xdf24('0x8e'));}this[_0xdf24('0x34')][_0xdf24('0xba')]=!![];this[_0xdf24('0x33')](_0x8a9c22);this[_0xdf24('0x40')](_0x8a9c22['text'],'in');this[_0xdf24('0x34')][_0xdf24('0x87')](util[_0xdf24('0x25')](_0xdf24('0xc8'),_0x8a9c22[_0xdf24('0x56')]));var _0x15ed2b=this['sestekNDA']['sync'](this,_0x8a9c22);if(_0x15ed2b){for(var _0x46f0a5 in _0x15ed2b){if(_0x15ed2b['hasOwnProperty'](_0x46f0a5)){this[_0xdf24('0x34')][_0xdf24('0x79')](util[_0xdf24('0x25')](_0xdf24('0xc9'),_0x46f0a5[_0xdf24('0xca')]()),_0x15ed2b[_0x46f0a5]);}}this[_0xdf24('0x40')](_0x15ed2b['speech'],_0xdf24('0xbe'));if(_0x15ed2b[_0xdf24('0xcb')]){this[_0xdf24('0x34')][_0xdf24('0x87')](util[_0xdf24('0x25')](_0xdf24('0xcc'),_0x15ed2b[_0xdf24('0xcb')]));var _0x200ad4=this['channel']['streamFile'](_0x15ed2b['audiofile']);try{fs['unlink'](_0x15ed2b[_0xdf24('0xcb')]+_0xdf24('0xcd'));}catch(_0x77c7b4){logger['error'](_0x77c7b4);}return _0x200ad4;}else{return this['channel']['noop'](util[_0xdf24('0x25')](_0xdf24('0xce'),_0x15ed2b[_0xdf24('0xbd')]));}}return this['channel']['error'](_0x8a9c22,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype'][_0xdf24('0xcf')]=function(_0x2a3da6){logger[_0xdf24('0x28')](util[_0xdf24('0x25')](_0xdf24('0xd0'),_0x2a3da6['label']));return this[_0xdf24('0x34')]['noop']('end');};AGIVertices[_0xdf24('0x10')][_0xdf24('0xd1')]=function(_0x7cd7b5){logger['info'](util[_0xdf24('0x25')](_0xdf24('0xd2'),_0x7cd7b5[_0xdf24('0x36')]));var _0x47d63a='';if(_0x7cd7b5[_0xdf24('0xd3')]){if(!this[_0xdf24('0x61')](_0x7cd7b5[_0xdf24('0xd3')])){return this[_0xdf24('0x34')]['error'](_0x7cd7b5,_0xdf24('0xd4'));}else{var _0x52321a=parseInt(_0x7cd7b5[_0xdf24('0xd3')],0xa);if(isNaN(_0x52321a)){_0x47d63a=_0x7cd7b5[_0xdf24('0xd3')];}else{_0x47d63a=this[_0xdf24('0x1d')][_0xdf24('0x86')](this,_0x7cd7b5[_0xdf24('0xd3')]);if(!_0x47d63a){return this[_0xdf24('0x34')][_0xdf24('0x2e')](_0x7cd7b5,_0xdf24('0xd5'));}}}}else if(_0x7cd7b5[_0xdf24('0xd6')]){_0x47d63a=_0x7cd7b5[_0xdf24('0xd6')];}else{return this[_0xdf24('0x34')][_0xdf24('0x2e')](_0x7cd7b5,_0xdf24('0xd4'));}var _0x4bb576=this[_0xdf24('0x34')][_0xdf24('0x53')](_0xdf24('0xb3'),[util[_0xdf24('0x25')]('SIP/%s/%s',_0x47d63a,_0x7cd7b5[_0xdf24('0x46')]),_0x7cd7b5['timeout'],_0x7cd7b5[_0xdf24('0xd7')],_0x7cd7b5[_0xdf24('0xb5')]]);if(_0x4bb576[_0xdf24('0x80')]===-0x1){return _0x4bb576;}return this['channel'][_0xdf24('0x87')](util[_0xdf24('0x25')](_0xdf24('0xb6'),'DIAL'));};AGIVertices[_0xdf24('0x10')][_0xdf24('0xd8')]=function(_0x73bc3a){logger[_0xdf24('0x28')](util[_0xdf24('0x25')](_0xdf24('0xd9'),_0x73bc3a[_0xdf24('0x36')]));return this['channel']['noop'](_0xdf24('0xd8'));};AGIVertices[_0xdf24('0x10')]['getdigits']=function(_0x2ceafc){logger[_0xdf24('0x28')](util[_0xdf24('0x25')](_0xdf24('0xda'),_0x2ceafc[_0xdf24('0x36')]));if(_0x2ceafc[_0xdf24('0x7b')]===0x0){return this[_0xdf24('0x7a')](_0x2ceafc);}_0x2ceafc[_0xdf24('0x7b')]-=0x1;if(!this['isConfigured'](_0x2ceafc[_0xdf24('0xdb')])){return this[_0xdf24('0x34')][_0xdf24('0x2e')](_0x2ceafc,_0xdf24('0xdc'));}var _0x1eed02=this[_0xdf24('0xdd')]['sync'](this,_0x2ceafc[_0xdf24('0xdb')]);if(!_0x1eed02){return this[_0xdf24('0x34')][_0xdf24('0x2e')](_0x2ceafc,_0xdf24('0xde'));}if(!this[_0xdf24('0x61')](_0x2ceafc[_0xdf24('0xa8')])){return this[_0xdf24('0x34')][_0xdf24('0x2e')](_0xdf24('0xa9'));}var _0x41d5bd=this[_0xdf24('0x34')][_0xdf24('0xdf')](_0x1eed02,_0x2ceafc['response'],_0x2ceafc[_0xdf24('0xe0')]);var _0x217431=_0x41d5bd['result']?_0x41d5bd['result']['toString']():'';logger[_0xdf24('0x28')](_0xdf24('0xe1'),JSON[_0xdf24('0xe2')](_0x41d5bd));if(_0x41d5bd[_0xdf24('0x80')]===-0x1){this['createSquareDetailsReport'][_0xdf24('0x86')](this,_0x2ceafc,_0x217431);return _0x41d5bd;}else if(_0x41d5bd[_0xdf24('0x77')]===_0xdf24('0x7e')){_0x41d5bd[_0xdf24('0x80')]=_0x217431['length']>=parseInt(_0x2ceafc[_0xdf24('0xe3')])?'x':'i';}else{_0x41d5bd[_0xdf24('0x80')]=_0x217431[_0xdf24('0x75')]>=parseInt(_0x2ceafc[_0xdf24('0xe3')])&&_0x217431['length']<=parseInt(_0x2ceafc['maxdigit'])?'x':'i';}var _0x3381e5=this['getVariable']['sync'](this,_0x2ceafc[_0xdf24('0xa8')]);if(!_0x3381e5){return this['channel'][_0xdf24('0x2e')](_0x2ceafc,'no\x20variable\x20found');}this[_0xdf24('0x34')][_0xdf24('0x79')](_0x3381e5,_0x217431);if(this[_0xdf24('0x61')](_0x2ceafc[_0xdf24('0xe4')])){var _0xa81760=parseInt(_0x2ceafc['hiddendigitsnum'],0xa);var _0x5b2740=rs[_0xdf24('0xe5')]({'charset':'*','length':_0xa81760});var _0x55260d=_0x217431[_0xdf24('0x75')];if(_0x55260d>0x0){if(_0x55260d>_0xa81760){this['createSquareDetailsReport'][_0xdf24('0x86')](this,_0x2ceafc,_0x2ceafc[_0xdf24('0xe6')]===_0xdf24('0xe7')?_0x5b2740+_0x217431[_0xdf24('0xe8')](_0xa81760):_0x217431['substr'](0x0,_0x55260d-_0xa81760)+_0x5b2740);}else{this[_0xdf24('0x33')][_0xdf24('0x86')](this,_0x2ceafc,rs[_0xdf24('0xe5')]({'charset':'*','length':_0x55260d}));}}else{this['createSquareDetailsReport']['sync'](this,_0x2ceafc,'');}}else{this[_0xdf24('0x33')]['sync'](this,_0x2ceafc,_0x217431);}return _0x41d5bd;};AGIVertices[_0xdf24('0x10')]['getsecretdigits']=function(_0x2dcc6f){logger[_0xdf24('0x28')](util[_0xdf24('0x25')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x2dcc6f[_0xdf24('0x36')]));return this[_0xdf24('0xc')](_0x2dcc6f);};AGIVertices[_0xdf24('0x10')][_0xdf24('0xe9')]=function(_0x2a4bb1){logger[_0xdf24('0x28')](util['format'](_0xdf24('0xea'),_0x2a4bb1[_0xdf24('0x36')]));this[_0xdf24('0x33')][_0xdf24('0x86')](this,_0x2a4bb1,_0x2a4bb1[_0xdf24('0xeb')]);return this[_0xdf24('0x34')][_0xdf24('0x87')](util[_0xdf24('0x25')]('GOAL\x20%s',_0x2a4bb1[_0xdf24('0xeb')]));};AGIVertices[_0xdf24('0x10')][_0xdf24('0xec')]=function(_0x20fd5e){logger[_0xdf24('0x28')](util[_0xdf24('0x25')](_0xdf24('0xed'),_0x20fd5e[_0xdf24('0x36')]));if(!this[_0xdf24('0x61')](_0x20fd5e[_0xdf24('0x64')])||!this[_0xdf24('0x61')](_0x20fd5e['aws_secret_access_key'])){return this['channel'][_0xdf24('0x87')](_0xdf24('0xee'));}if(!this['isConfigured'](_0x20fd5e[_0xdf24('0x56')])){return this['channel'][_0xdf24('0x87')]('no\x20text\x20configured');}this['channel']['noop'](util[_0xdf24('0x25')](_0xdf24('0xef'),_0x20fd5e[_0xdf24('0x56')]));var _0x5a10cb=this[_0xdf24('0x63')]['sync'](this,_0x20fd5e);if(_0x5a10cb){this[_0xdf24('0x34')][_0xdf24('0x87')](util[_0xdf24('0x25')](_0xdf24('0xf0'),_0x5a10cb));var _0x357b4f=this['channel'][_0xdf24('0xf1')](_0x5a10cb);try{fs['unlink'](_0x5a10cb+_0xdf24('0xcd'));}catch(_0x5a7b44){logger[_0xdf24('0x2e')](_0x5a7b44);}return _0x357b4f;}return this[_0xdf24('0x34')][_0xdf24('0x2e')](_0x20fd5e,_0xdf24('0xf2'));};AGIVertices[_0xdf24('0x10')][_0xdf24('0xf3')]=function(_0x1bac75){logger[_0xdf24('0x28')](util[_0xdf24('0x25')](_0xdf24('0xf4'),_0x1bac75[_0xdf24('0x36')]));if(!this[_0xdf24('0x61')](_0x1bac75[_0xdf24('0x64')])||!this[_0xdf24('0x61')](_0x1bac75['aws_secret_access_key'])){return this[_0xdf24('0x34')][_0xdf24('0x87')](_0xdf24('0xee'));}if(!this[_0xdf24('0x61')](_0x1bac75['aws_bot_name'])){return this[_0xdf24('0x34')]['noop'](_0xdf24('0xf5'));}if(!this[_0xdf24('0x61')](_0x1bac75[_0xdf24('0x56')])){return this[_0xdf24('0x34')][_0xdf24('0x87')]('no\x20text\x20configured');}this[_0xdf24('0x34')]['bot']=!![];this['createSquareDetailsReport'](_0x1bac75);this[_0xdf24('0x40')](_0x1bac75[_0xdf24('0x56')],'in');this[_0xdf24('0x34')]['noop'](util[_0xdf24('0x25')]('Trying\x20Amazon\x20Lex:\x20%s',_0x1bac75[_0xdf24('0x56')]));var _0x53ee4d=this[_0xdf24('0x69')][_0xdf24('0x86')](this,_0x1bac75);if(_0x53ee4d){for(var _0x3686fe in _0x53ee4d){if(_0x53ee4d[_0xdf24('0xbb')](_0x3686fe)&&_[_0xdf24('0xf6')](_0x53ee4d[_0x3686fe])){this[_0xdf24('0x34')][_0xdf24('0x79')](util[_0xdf24('0x25')]('AWS_LEX_%s',_0x3686fe['toUpperCase']()),_0x53ee4d[_0x3686fe]);}}if(_[_0xdf24('0x45')](_0x53ee4d['message'])){return this[_0xdf24('0x34')]['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xdf24('0x40')](_0x53ee4d[_0xdf24('0xf7')],_0xdf24('0xbe'));return this['channel']['noop'](util[_0xdf24('0x25')](_0xdf24('0xf8'),_0x53ee4d[_0xdf24('0xf7')]));}}return this[_0xdf24('0x34')][_0xdf24('0x2e')](_0x1bac75,_0xdf24('0xf9'));};AGIVertices[_0xdf24('0x10')][_0xdf24('0xfa')]=function(_0x3ab85e){logger['info'](util[_0xdf24('0x25')](_0xdf24('0xfb'),_0x3ab85e[_0xdf24('0x36')],_0x3ab85e[_0xdf24('0x7e')]));if(!this[_0xdf24('0x61')](_0x3ab85e[_0xdf24('0x59')])){return this[_0xdf24('0x34')][_0xdf24('0x87')](_0xdf24('0xb9'));}var _0xe99fd2='wav';var _0x1dc0e8=util[_0xdf24('0x25')](_0xdf24('0xfc'),FILES_PATH,rs['generate'](0x4));var _0x52b4f4=util[_0xdf24('0x25')](_0xdf24('0xfd'),_0x1dc0e8,_0xe99fd2);var _0x4584fe=!![];if(_0x3ab85e[_0xdf24('0xfe')]===_0xdf24('0xff')){_0x4584fe=![];}var _0x45c4c4=this[_0xdf24('0x34')][_0xdf24('0x100')](_0x1dc0e8,_0xe99fd2,_0x3ab85e[_0xdf24('0x101')],_0x3ab85e['timeout'],undefined,_0x4584fe);if(_0x45c4c4[_0xdf24('0x80')]!==-0x1){this[_0xdf24('0x34')][_0xdf24('0x87')](util[_0xdf24('0x25')]('google\x20%s\x20file\x20created',_0x52b4f4));var _0x37e561=this[_0xdf24('0x6b')][_0xdf24('0x86')](this,_0x3ab85e,_0x52b4f4);if(_0x37e561){for(var _0x34c965 in _0x37e561){if(_0x37e561[_0xdf24('0xbb')](_0x34c965)){this[_0xdf24('0x34')]['setVariable'](util[_0xdf24('0x25')](_0xdf24('0x102'),_0x34c965[_0xdf24('0xca')]()),_0x37e561[_0x34c965]);}}return this[_0xdf24('0x34')][_0xdf24('0x87')](util[_0xdf24('0x25')](_0xdf24('0x103'),JSON['stringify'](_0x37e561)));}}return _0x45c4c4;};AGIVertices[_0xdf24('0x10')][_0xdf24('0x104')]=function(_0xdf77b9){logger['info'](util[_0xdf24('0x25')](_0xdf24('0x105'),_0xdf77b9[_0xdf24('0x36')]));if(!this[_0xdf24('0x61')](_0xdf77b9[_0xdf24('0x6e')])){return this['channel'][_0xdf24('0x87')](_0xdf24('0x106'));}if(!this[_0xdf24('0x61')](_0xdf77b9[_0xdf24('0x6f')])){return this['channel'][_0xdf24('0x87')]('no\x20appsecret\x20configured');}var _0x2a1e23=_0xdf24('0x107');var _0x4752eb=util[_0xdf24('0x25')](_0xdf24('0xfc'),FILES_PATH,rs['generate'](0x4));var _0x1d9281=util[_0xdf24('0x25')](_0xdf24('0xfd'),_0x4752eb,_0x2a1e23);var _0x113c2f=!![];if(_0xdf77b9['beep']===_0xdf24('0xff')){_0x113c2f=![];}var _0x499cf5=this[_0xdf24('0x34')][_0xdf24('0x100')](_0x4752eb,_0x2a1e23,_0xdf77b9[_0xdf24('0x101')],_0xdf77b9[_0xdf24('0x7e')],undefined,_0x113c2f);if(_0x499cf5[_0xdf24('0x80')]!==-0x1){this['channel']['noop'](util['format'](_0xdf24('0x108'),_0x1d9281));var _0x249d9d=this[_0xdf24('0x6d')]['sync'](this,_0xdf77b9,_0x1d9281);if(_0x249d9d){for(var _0x4decc7 in _0x249d9d){if(_0x249d9d[_0xdf24('0xbb')](_0x4decc7)){this[_0xdf24('0x34')][_0xdf24('0x79')](util[_0xdf24('0x25')](_0xdf24('0x109'),_0x4decc7[_0xdf24('0xca')]()),_0x249d9d[_0x4decc7]);}}return this[_0xdf24('0x34')]['noop'](util[_0xdf24('0x25')](_0xdf24('0x10a'),JSON[_0xdf24('0xe2')](_0x249d9d)));}}return _0x499cf5;};AGIVertices[_0xdf24('0x10')][_0xdf24('0x10b')]=function(_0x5476fd){logger['info'](util['format'](_0xdf24('0x10c'),_0x5476fd['label']));return this[_0xdf24('0x34')][_0xdf24('0x10d')](_0x5476fd[_0xdf24('0x3c')],_0x5476fd[_0xdf24('0x3d')],_0x5476fd['priority']);};AGIVertices['prototype']['gotoif']=function(_0x39579b){logger['info'](util['format'](_0xdf24('0x10e'),_0x39579b[_0xdf24('0x36')]));if(!this['isConfigured'](_0x39579b['condition'])){return this[_0xdf24('0x34')][_0xdf24('0x2e')](_0x39579b,'no\x20condition\x20configured');}try{var _0x37e272=eval(_0x39579b[_0xdf24('0x10f')])?'true':'false';this['channel'][_0xdf24('0x87')](util['format'](_0xdf24('0x110'),_0x39579b[_0xdf24('0x10f')],_0x37e272));return{'code':0xc8,'result':_0x37e272};}catch(_0x23f13c){return{'code':0xc8,'result':_0xdf24('0x111')};}};AGIVertices['prototype'][_0xdf24('0x112')]=function(_0xfdefde){logger[_0xdf24('0x28')](util[_0xdf24('0x25')](_0xdf24('0x113'),_0xfdefde['label']));if(!this[_0xdf24('0x61')](_0xfdefde[_0xdf24('0x114')])){return this[_0xdf24('0x34')][_0xdf24('0x2e')](_0xfdefde,_0xdf24('0x115'));}var _0x3bd7b3=this['getIntervals']['sync'](this,_0xfdefde[_0xdf24('0x114')]);if(!_0x3bd7b3){return this[_0xdf24('0x34')][_0xdf24('0x2e')](_0xfdefde,_0xdf24('0x116'));}for(var _0x210bdf=0x0;_0x210bdf<_0x3bd7b3['length'];_0x210bdf+=0x1){var _0xccc58b=this['channel'][_0xdf24('0x11')](util[_0xdf24('0x25')]('IFTIME(%s?true:false)',_0x3bd7b3[_0x210bdf]));if(_0xccc58b[_0xdf24('0x80')]===-0x1){return _0xccc58b;}logger['info'](util['format'](_0xdf24('0x117'),_0x3bd7b3[_0x210bdf],_0xccc58b[_0xdf24('0x77')]));if(_0xccc58b[_0xdf24('0x77')]==='true'){logger[_0xdf24('0x28')](util['format'](_0xdf24('0x117'),_0x3bd7b3[_0x210bdf],'true'));this[_0xdf24('0x34')][_0xdf24('0x87')](util[_0xdf24('0x25')](_0xdf24('0x117'),_0x3bd7b3[_0x210bdf],_0xdf24('0x118')));return{'code':0xc8,'result':_0xdf24('0x118')};}else{logger[_0xdf24('0x28')](util[_0xdf24('0x25')](_0xdf24('0x117'),_0x3bd7b3[_0x210bdf],'false'));this[_0xdf24('0x34')]['noop'](util[_0xdf24('0x25')]('IFTIME\x20%s\x20%s',_0x3bd7b3[_0x210bdf],_0xdf24('0x111')));}}return{'code':0xc8,'result':_0xdf24('0x111')};};AGIVertices['prototype']['hangup']=function(_0x512d56){logger[_0xdf24('0x28')](util[_0xdf24('0x25')](_0xdf24('0x119'),_0x512d56[_0xdf24('0x36')]));return this['channel'][_0xdf24('0x11a')]();};AGIVertices['prototype'][_0xdf24('0x11b')]=function(_0x3a733d){logger[_0xdf24('0x28')](util[_0xdf24('0x25')](_0xdf24('0x11c'),_0x3a733d[_0xdf24('0x36')]));if(!this[_0xdf24('0x61')](_0x3a733d[_0xdf24('0x59')])){return this[_0xdf24('0x34')][_0xdf24('0x87')](_0xdf24('0xb9'));}var _0x52ceb0='wav';var _0xcdce48=util['format'](_0xdf24('0xfc'),FILES_PATH,rs[_0xdf24('0xe5')](0x4));var _0x2da163=util[_0xdf24('0x25')](_0xdf24('0xfd'),_0xcdce48,_0x52ceb0);var _0x414f2f=!![];if(_0x3a733d[_0xdf24('0xfe')]===_0xdf24('0xff')){_0x414f2f=![];}var _0x364d74=this['channel'][_0xdf24('0x100')](_0xcdce48,_0x52ceb0,_0x3a733d[_0xdf24('0x101')],_0x3a733d[_0xdf24('0x7e')],undefined,_0x414f2f);if(_0x364d74[_0xdf24('0x80')]!==-0x1){this[_0xdf24('0x34')][_0xdf24('0x87')](util['format']('ispeech\x20%s\x20file\x20created',_0x2da163));var _0x469c1a=this['ispeechASR'][_0xdf24('0x86')](this,_0x3a733d,_0x2da163);if(_0x469c1a){for(var _0xd142c9 in _0x469c1a){if(_0x469c1a['hasOwnProperty'](_0xd142c9)){this[_0xdf24('0x34')][_0xdf24('0x79')](util[_0xdf24('0x25')](_0xdf24('0x11d'),_0xd142c9[_0xdf24('0xca')]()),_0x469c1a[_0xd142c9]);}}return this['channel'][_0xdf24('0x87')](util[_0xdf24('0x25')](_0xdf24('0x11e'),JSON['stringify'](_0x469c1a)));}}return _0x364d74;};AGIVertices[_0xdf24('0x10')][_0xdf24('0x11f')]=function(_0x5931f9){logger[_0xdf24('0x28')](util[_0xdf24('0x25')](_0xdf24('0x120'),_0x5931f9[_0xdf24('0x36')]));if(!this[_0xdf24('0x61')](_0x5931f9['key'])){return this['channel'][_0xdf24('0x87')](_0xdf24('0xb9'));}if(!this[_0xdf24('0x61')](_0x5931f9[_0xdf24('0x56')])){return this['channel'][_0xdf24('0x87')](_0xdf24('0x8e'));}this['channel'][_0xdf24('0x87')](util['format'](_0xdf24('0x121'),_0x5931f9[_0xdf24('0x56')]));var _0x31217e=this[_0xdf24('0x5c')][_0xdf24('0x86')](this,_0x5931f9);if(_0x31217e){this[_0xdf24('0x34')][_0xdf24('0x87')](util[_0xdf24('0x25')](_0xdf24('0x122'),_0x31217e));var _0x1fe55b=this['channel'][_0xdf24('0xf1')](_0x31217e,_0x5931f9['intKey']);try{fs[_0xdf24('0x123')](_0x31217e+'.wav');}catch(_0x8be3ed){logger[_0xdf24('0x2e')](_0x8be3ed);}return _0x1fe55b;}return this[_0xdf24('0x34')][_0xdf24('0x2e')](_0x5931f9,_0xdf24('0x124'));};AGIVertices['prototype']['login']=function(_0x4902f6){logger['info'](util['format'](_0xdf24('0x125'),_0x4902f6[_0xdf24('0x36')]));if(!this[_0xdf24('0x61')](_0x4902f6[_0xdf24('0x126')])){return this['channel']['error'](_0x4902f6,_0xdf24('0x127'));}logger['info'](util['format'](_0xdf24('0x128'),this[_0xdf24('0x34')][_0xdf24('0x39')],_0x4902f6['findBy']));var _0x49b72a=this[_0xdf24('0x50')][_0xdf24('0x86')](this,_0x4902f6['findBy']);if(_0x49b72a){logger[_0xdf24('0x28')](util[_0xdf24('0x25')](_0xdf24('0x129'),this[_0xdf24('0x34')][_0xdf24('0x39')],_0x4902f6[_0xdf24('0x126')]));this[_0xdf24('0x34')][_0xdf24('0x87')](util[_0xdf24('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xdf24('0x34')][_0xdf24('0x39')],_0x4902f6[_0xdf24('0x126')]));return{'code':0xc8,'result':_0xdf24('0x12a')};}else{logger['info'](util['format'](_0xdf24('0x12b'),this[_0xdf24('0x34')]['callerid'],_0x4902f6['findBy']));this[_0xdf24('0x34')][_0xdf24('0x87')](util[_0xdf24('0x25')](_0xdf24('0x12b'),this['channel']['callerid'],_0x4902f6['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xdf24('0x10')][_0xdf24('0x12c')]=function(_0x5d7f92){logger['info'](util[_0xdf24('0x25')](_0xdf24('0x12d'),_0x5d7f92[_0xdf24('0x36')]));if(!this['isConfigured'](_0x5d7f92['findBy'])){return this[_0xdf24('0x34')]['error'](_0x5d7f92,_0xdf24('0x127'));}logger[_0xdf24('0x28')](util[_0xdf24('0x25')](_0xdf24('0x128'),this[_0xdf24('0x34')][_0xdf24('0x39')],_0x5d7f92[_0xdf24('0x126')]));var _0x376104=this[_0xdf24('0x4f')][_0xdf24('0x86')](this,_0x5d7f92[_0xdf24('0x126')]);if(_0x376104){logger[_0xdf24('0x28')](util[_0xdf24('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xdf24('0x34')][_0xdf24('0x39')],_0x5d7f92[_0xdf24('0x126')]));this[_0xdf24('0x34')][_0xdf24('0x87')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xdf24('0x34')]['callerid'],_0x5d7f92[_0xdf24('0x126')]));return{'code':0xc8,'result':_0xdf24('0x12a')};}else{logger[_0xdf24('0x28')](util['format'](_0xdf24('0x12b'),this['channel'][_0xdf24('0x39')],_0x5d7f92['findBy']));this[_0xdf24('0x34')][_0xdf24('0x87')](util[_0xdf24('0x25')](_0xdf24('0x12b'),this[_0xdf24('0x34')][_0xdf24('0x39')],_0x5d7f92[_0xdf24('0x126')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xdf24('0x10')][_0xdf24('0x12e')]=function(_0x241111){logger[_0xdf24('0x28')](util[_0xdf24('0x25')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x241111[_0xdf24('0x36')]));if(!this[_0xdf24('0x61')](_0x241111['operation'])){return this[_0xdf24('0x34')]['error'](_0x241111,_0xdf24('0x12f'));}this[_0xdf24('0x34')]['noop'](util[_0xdf24('0x25')]('math\x20%s',_0x241111['operation']));var _0x3f38c5=eval(_0x241111['operation']);if(!this[_0xdf24('0x61')](_0x241111[_0xdf24('0xa8')])){return this['channel'][_0xdf24('0x87')](_0xdf24('0xa9'));}var _0x228b42=this[_0xdf24('0x11')]['sync'](this,_0x241111[_0xdf24('0xa8')]);if(!_0x228b42){return this['channel'][_0xdf24('0x2e')](_0x241111,'no\x20variable\x20found');}if(_[_0xdf24('0x130')](_0x3f38c5)){var _0x4b171f=this;_0x3f38c5['forEach'](function(_0xe1c7a7,_0x2473fc){_0x4b171f[_0xdf24('0x34')][_0xdf24('0x79')](util[_0xdf24('0x25')](_0xdf24('0x131'),_0x228b42,_0x2473fc),_0xe1c7a7);});return this[_0xdf24('0x34')]['noop'](util[_0xdf24('0x25')]('variable\x20%s[key]\x20set',_0x228b42));}else{return this[_0xdf24('0x34')][_0xdf24('0x79')](_0x228b42,_0x3f38c5);}};AGIVertices[_0xdf24('0x10')]['menu']=function(_0x3d28ee){logger[_0xdf24('0x28')](util['format'](_0xdf24('0x132'),_0x3d28ee[_0xdf24('0x36')]));if(_0x3d28ee[_0xdf24('0x7b')]===0x0){return this[_0xdf24('0x7a')](_0x3d28ee);}_0x3d28ee[_0xdf24('0x7b')]-=0x1;if(!this['isConfigured'](_0x3d28ee[_0xdf24('0xdb')])){return this['channel'][_0xdf24('0x2e')](_0x3d28ee,'no\x20file\x20audio\x20selected');}var _0x9f49d4=this[_0xdf24('0xdd')][_0xdf24('0x86')](this,_0x3d28ee['file_id']);if(!_0x9f49d4){return this[_0xdf24('0x34')][_0xdf24('0x2e')](_0x3d28ee,_0xdf24('0xde'));}var _0x32d354=this[_0xdf24('0x34')]['getData'](_0x9f49d4,_0x3d28ee[_0xdf24('0x133')],_0x3d28ee[_0xdf24('0x134')]);var _0x1d7d2c=_0x32d354[_0xdf24('0x80')];if(_0x32d354['result']===-0x1){this[_0xdf24('0x33')][_0xdf24('0x86')](this,_0x3d28ee,'-1');return _0x32d354;}else if(_0x32d354[_0xdf24('0x77')]===_0xdf24('0x7e')){_0x32d354[_0xdf24('0x80')]=_0x32d354['result'][_0xdf24('0x75')]>0x0?_0x32d354[_0xdf24('0x80')]:'t';}else if(_[_0xdf24('0x42')](_0x32d354['result'])){_0x32d354[_0xdf24('0x80')]='#';_0x1d7d2c='#';}if(!this[_0xdf24('0x61')](_0x3d28ee['variable_id'])){this[_0xdf24('0x34')][_0xdf24('0x87')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x3f560f=this[_0xdf24('0x11')][_0xdf24('0x86')](this,_0x3d28ee['variable_id']);if(!_0x3f560f){return this[_0xdf24('0x34')][_0xdf24('0x2e')](_0x3d28ee,_0xdf24('0xaa'));}this[_0xdf24('0x34')][_0xdf24('0x79')](_0x3f560f,_0x1d7d2c);}this[_0xdf24('0x33')]['sync'](this,_0x3d28ee,_0x1d7d2c);return _0x32d354;};AGIVertices[_0xdf24('0x10')]['noop']=function(_0x1d5d8b){logger[_0xdf24('0x28')](util[_0xdf24('0x25')](_0xdf24('0x135'),_0x1d5d8b[_0xdf24('0x36')]));return this[_0xdf24('0x34')][_0xdf24('0x87')](_0x1d5d8b[_0xdf24('0x136')]||_0x1d5d8b[_0xdf24('0x36')]);};AGIVertices[_0xdf24('0x10')][_0xdf24('0x137')]=function(_0x305c4){logger[_0xdf24('0x28')](util[_0xdf24('0x25')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x305c4[_0xdf24('0x36')]));if(!this['isConfigured'](_0x305c4[_0xdf24('0x126')])){return this[_0xdf24('0x34')][_0xdf24('0x2e')](_0x305c4,_0xdf24('0x127'));}logger[_0xdf24('0x28')](util[_0xdf24('0x25')](_0xdf24('0x128'),this[_0xdf24('0x34')][_0xdf24('0x39')],_0x305c4['findBy']));var _0x2c8f3e=this[_0xdf24('0x138')][_0xdf24('0x86')](this,_0x305c4[_0xdf24('0x139')]);var _0x16bd98=this[_0xdf24('0x4c')][_0xdf24('0x86')](this,_0x305c4[_0xdf24('0x126')],_0x2c8f3e);if(_0x16bd98){logger[_0xdf24('0x28')](util[_0xdf24('0x25')](_0xdf24('0x129'),this[_0xdf24('0x34')][_0xdf24('0x39')],_0x305c4[_0xdf24('0x126')]));this[_0xdf24('0x34')][_0xdf24('0x87')](util['format'](_0xdf24('0x129'),this[_0xdf24('0x34')][_0xdf24('0x39')],_0x305c4[_0xdf24('0x126')]));return{'code':0xc8,'result':_0xdf24('0x12a')};}else{logger[_0xdf24('0x28')](util[_0xdf24('0x25')](_0xdf24('0x12b'),this[_0xdf24('0x34')][_0xdf24('0x39')],_0x305c4['findBy']));this['channel'][_0xdf24('0x87')](util[_0xdf24('0x25')](_0xdf24('0x129'),this[_0xdf24('0x34')]['callerid'],_0x305c4[_0xdf24('0x126')]));return{'code':0xc8,'result':_0xdf24('0x13a')};}};AGIVertices[_0xdf24('0x10')]['playback']=function(_0x471b08){logger[_0xdf24('0x28')](util[_0xdf24('0x25')](_0xdf24('0x13b'),_0x471b08[_0xdf24('0x36')]));if(!this[_0xdf24('0x61')](_0x471b08[_0xdf24('0xdb')])){return this[_0xdf24('0x34')][_0xdf24('0x2e')](_0x471b08,_0xdf24('0xdc'));}var _0x3dc422=this['getSound'][_0xdf24('0x86')](this,_0x471b08[_0xdf24('0xdb')]);if(!_0x3dc422){return this[_0xdf24('0x34')][_0xdf24('0x2e')](_0x471b08,_0xdf24('0xde'));}var _0x55a463=this[_0xdf24('0x34')]['exec'](_0xdf24('0x13c'),[_0x3dc422,_0x471b08[_0xdf24('0xd7')]]);if(_0x55a463[_0xdf24('0x80')]===-0x1){return _0x55a463;}return this[_0xdf24('0x34')][_0xdf24('0x87')](util['format'](_0xdf24('0x13d'),_0xdf24('0x13c'),_0x3dc422));};AGIVertices['prototype'][_0xdf24('0x13e')]=function(_0xfabebe){logger[_0xdf24('0x28')](util['format'](_0xdf24('0x13f'),_0xfabebe[_0xdf24('0x36')]));if(!this['isConfigured'](_0xfabebe['queue_id'])){return this[_0xdf24('0x34')][_0xdf24('0x2e')](_0xfabebe,_0xdf24('0x140'));}var _0x229c80='';var _0x5af731=parseInt(_0xfabebe['queue_id'],0xa);if(isNaN(_0x5af731)){_0x229c80=_0xfabebe[_0xdf24('0x141')];}else{_0x229c80=this[_0xdf24('0x15')][_0xdf24('0x86')](this,_0xfabebe['queue_id']);if(!_0x229c80){return this['channel'][_0xdf24('0x2e')](_0xfabebe,_0xdf24('0x142'));}}var _0x2b49ec='';if(this[_0xdf24('0x61')](_0xfabebe[_0xdf24('0xdb')])){var _0x2155ed=this[_0xdf24('0xdd')][_0xdf24('0x86')](this,_0xfabebe['file_id']);if(_0x2155ed){_0x2b49ec=_0x2155ed;}}this[_0xdf24('0x33')][_0xdf24('0x86')](this,_0xfabebe,_0x229c80);if(_0xfabebe[_0xdf24('0xd7')][_0xdf24('0x143')]('x')<0x0){_0xfabebe['opts']+='x';}if(_0xfabebe['opts'][_0xdf24('0x143')]('X')<0x0){_0xfabebe[_0xdf24('0xd7')]+='X';}this[_0xdf24('0x34')][_0xdf24('0x79')](_0xdf24('0x144'),_0x229c80?_0x229c80[_0xdf24('0x145')]():'');var _0x32390e=this[_0xdf24('0x34')][_0xdf24('0x53')]('QUEUE',[_0x229c80,_0xfabebe['opts'],_0xfabebe[_0xdf24('0xb5')],_0x2b49ec,_0xfabebe[_0xdf24('0x7e')],_0xfabebe[_0xdf24('0x8')],_0xfabebe['macro'],_0xfabebe[_0xdf24('0x146')],'',_0xfabebe['position']]);if(_0x32390e[_0xdf24('0x80')]===-0x1){return _0x32390e;}return this['channel'][_0xdf24('0x87')](util[_0xdf24('0x25')]('Executed\x20command\x20%s\x20%s',_0xdf24('0x147'),_0x229c80));};AGIVertices[_0xdf24('0x10')][_0xdf24('0x148')]=function(_0x1abce0){logger[_0xdf24('0x28')](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x1abce0[_0xdf24('0x36')]));var _0x95805f=_0x1abce0[_0xdf24('0x149')]||_0xdf24('0x107');var _0xc51926=util[_0xdf24('0x25')](_0xdf24('0x14a'),this[_0xdf24('0x34')][_0xdf24('0x35')],rs[_0xdf24('0xe5')](0x5));var _0x345d33=util[_0xdf24('0x25')](_0xdf24('0x14b'),FILES_PATH,_0xc51926,_0x95805f);var _0x4909cd=util[_0xdf24('0x25')](_0xdf24('0xfc'),FILES_PATH,_0xc51926);this['createSquareRecording'][_0xdf24('0x86')](this,_0x1abce0,_0xc51926,_0x345d33);this[_0xdf24('0x34')][_0xdf24('0x79')]('RECORDING_SAVENAME',_0xc51926);logger[_0xdf24('0x28')](_0xdf24('0x14c'),_0x4909cd,_0x95805f,_0x1abce0[_0xdf24('0x14d')],_0x1abce0[_0xdf24('0x7e')]);return this[_0xdf24('0x34')][_0xdf24('0x100')](_0x4909cd,_0x95805f,_0x1abce0[_0xdf24('0x14d')],_0x1abce0['timeout'],undefined,!![]);};AGIVertices[_0xdf24('0x10')][_0xdf24('0x14e')]=function(_0x14ed4e){logger[_0xdf24('0x28')](util[_0xdf24('0x25')](_0xdf24('0x14f'),_0x14ed4e[_0xdf24('0x36')]));return this[_0xdf24('0x34')][_0xdf24('0x150')](_0x14ed4e[_0xdf24('0x151')][_0xdf24('0x55')](/\s+/g,''),_0x14ed4e[_0xdf24('0x14d')]);};AGIVertices[_0xdf24('0x10')][_0xdf24('0x152')]=function(_0x1f4ad2){logger['info'](util[_0xdf24('0x25')](_0xdf24('0x153'),_0x1f4ad2[_0xdf24('0x36')]));return this[_0xdf24('0x34')][_0xdf24('0x154')](_0x1f4ad2[_0xdf24('0x155')][_0xdf24('0x55')](/\s+/g,''),_0x1f4ad2['escape_digits']);};AGIVertices[_0xdf24('0x10')][_0xdf24('0x156')]=function(_0x4d65f9){logger[_0xdf24('0x28')](util['format'](_0xdf24('0x157'),_0x4d65f9[_0xdf24('0x36')]));return this['channel'][_0xdf24('0x158')](_0x4d65f9[_0xdf24('0x56')],_0x4d65f9['escape_digits']);};AGIVertices['prototype'][_0xdf24('0x159')]=function(_0x22e2ba){logger[_0xdf24('0x28')](util[_0xdf24('0x25')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x22e2ba[_0xdf24('0x36')]));if(!this['isConfigured'](_0x22e2ba[_0xdf24('0x15a')])){return this['channel'][_0xdf24('0x87')](_0xdf24('0x15b'));}var _0x2c8a13=this[_0xdf24('0x1f')]['sync'](this,_0x22e2ba['account_id']);if(!_0x2c8a13||!_0x2c8a13[_0xdf24('0x15c')]){return this[_0xdf24('0x34')]['error'](_0x22e2ba,_0xdf24('0x15d'));}var _0x166fe4={'from':util[_0xdf24('0x25')](_0xdf24('0x15e'),_0x2c8a13['name'],_0x2c8a13[_0xdf24('0x15f')]||_0x2c8a13[_0xdf24('0x15c')]['user']),'to':_0x22e2ba['to']||'','cc':_0x22e2ba['cc']||'','bcc':_0x22e2ba['bcc']||'','subject':_0x22e2ba[_0xdf24('0x160')],'html':_0x22e2ba[_0xdf24('0x56')],'text':_0x22e2ba[_0xdf24('0x56')]};var _0x4d9f1c={'tls':{'rejectUnauthorized':![]}};if(_0x2c8a13['Smtp'][_0xdf24('0x161')]){_0x4d9f1c[_0xdf24('0x161')]=_0x2c8a13[_0xdf24('0x15c')][_0xdf24('0x161')];}else{_0x4d9f1c['host']=_0x2c8a13[_0xdf24('0x15c')][_0xdf24('0x162')];_0x4d9f1c[_0xdf24('0x163')]=_0x2c8a13[_0xdf24('0x15c')]['port'];_0x4d9f1c[_0xdf24('0x164')]=_0x2c8a13[_0xdf24('0x15c')][_0xdf24('0x164')];}if(_0x2c8a13[_0xdf24('0x15c')][_0xdf24('0x165')]){_0x4d9f1c[_0xdf24('0x166')]={'user':_0x2c8a13[_0xdf24('0x15c')][_0xdf24('0x167')],'pass':_0x2c8a13[_0xdf24('0x15c')][_0xdf24('0x168')]};}if(this['isConfigured'](_0x22e2ba[_0xdf24('0x169')])){}logger[_0xdf24('0xad')]('sendMail\x20message',JSON[_0xdf24('0xe2')](_0x166fe4));this[_0xdf24('0x33')][_0xdf24('0x86')](this,_0x22e2ba,_0x22e2ba['account_id']);this[_0xdf24('0x34')][_0xdf24('0x87')](util[_0xdf24('0x25')](_0xdf24('0x16a'),_0x2c8a13[_0xdf24('0x17')]));this[_0xdf24('0x16b')][_0xdf24('0x86')](this,_0x4d9f1c,_0x166fe4);return this[_0xdf24('0x34')][_0xdf24('0x87')](_0xdf24('0x16c'));};AGIVertices[_0xdf24('0x10')][_0xdf24('0x16d')]=function(_0x201f1f){logger[_0xdf24('0x28')](util['format'](_0xdf24('0x16e'),_0x201f1f['label']));return this[_0xdf24('0x34')][_0xdf24('0x87')](_0xdf24('0x16f'));};AGIVertices['prototype'][_0xdf24('0x170')]=function(_0xf342ed){logger['info'](util[_0xdf24('0x25')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0xf342ed[_0xdf24('0x36')]));if(!this[_0xdf24('0x61')](_0xf342ed['sms_account_id'])){return this['channel'][_0xdf24('0x87')]('no\x20sms\x20account\x20configured');}var _0x17215e=this[_0xdf24('0x30')]['sync'](this,_0xf342ed[_0xdf24('0x171')]);if(!_0x17215e){return this[_0xdf24('0x34')][_0xdf24('0x2e')](_0xf342ed,_0xdf24('0x172'));}var _0x388299={'body':_0xf342ed[_0xdf24('0x173')],'phone':_0xf342ed['to']||'','SmsAccountId':_0x17215e['id']};logger[_0xdf24('0xad')](_0xdf24('0x174'),JSON[_0xdf24('0xe2')](_0x388299));this[_0xdf24('0x33')][_0xdf24('0x86')](this,_0xf342ed,_0xf342ed[_0xdf24('0x171')]);this[_0xdf24('0x34')][_0xdf24('0x87')](util[_0xdf24('0x25')](_0xdf24('0x175'),_0x17215e[_0xdf24('0x17')]));this[_0xdf24('0x32')]['sync'](this,_0x388299);return this[_0xdf24('0x34')][_0xdf24('0x87')](_0xdf24('0x176'));};AGIVertices['prototype'][_0xdf24('0x177')]=function(_0x24596f){logger['info'](util[_0xdf24('0x25')](_0xdf24('0x178'),_0x24596f[_0xdf24('0x36')]));if(!this[_0xdf24('0x61')](_0x24596f[_0xdf24('0xa8')])){return this[_0xdf24('0x34')]['error'](_0x24596f,'no\x20variable\x20selected');}var _0x28bf05=this[_0xdf24('0x11')]['sync'](this,_0x24596f[_0xdf24('0xa8')]);if(!_0x28bf05){return this[_0xdf24('0x34')][_0xdf24('0x2e')](_0x24596f,_0xdf24('0xaa'));}return this['channel'][_0xdf24('0x79')](_0x28bf05,_0x24596f['variable_value']);};AGIVertices[_0xdf24('0x10')][_0xdf24('0x179')]=function(_0x45093f){logger['info'](util[_0xdf24('0x25')](_0xdf24('0x17a'),_0x45093f[_0xdf24('0x36')]));this[_0xdf24('0x34')]['noop'](_0xdf24('0x17b'));if(_0x45093f['answer']===_0xdf24('0x17c')){this[_0xdf24('0x34')][_0xdf24('0x87')](_0xdf24('0x17d'));return this[_0xdf24('0x34')][_0xdf24('0x7d')]();}return this[_0xdf24('0x34')][_0xdf24('0x87')](_0xdf24('0x17e'));};AGIVertices['prototype'][_0xdf24('0x17f')]=function(_0x18c906){logger[_0xdf24('0x28')](util[_0xdf24('0x25')](_0xdf24('0x180'),_0x18c906[_0xdf24('0x36')]));if(!this['isConfigured'](_0x18c906['project_id'])){return this[_0xdf24('0x34')][_0xdf24('0x2e')](_0x18c906,'no\x20subproject\x20selected');}var _0x5f53bc=this[_0xdf24('0x18')]['sync'](this,_0x18c906[_0xdf24('0x181')]);if(!this[_0xdf24('0x61')](_0x5f53bc)){return this[_0xdf24('0x34')]['error'](_0x18c906,util['format'](_0xdf24('0x182'),_0x18c906['project_id']));}if(_0x5f53bc===this['channel']['arg_1']){return this[_0xdf24('0x34')][_0xdf24('0x2e')](_0x18c906,_0xdf24('0x183'));}this[_0xdf24('0x33')][_0xdf24('0x86')](this,_0x18c906,_0x5f53bc);var _0x59bae1=this['channel'][_0xdf24('0x53')](_0xdf24('0x184'),util['format'](_0xdf24('0x185'),config[_0xdf24('0x8')][_0xdf24('0x162')]||_0xdf24('0x186'),_0x5f53bc,this[_0xdf24('0x34')][_0xdf24('0x38')]));if(_0x59bae1[_0xdf24('0x80')]===-0x1){return _0x59bae1;}return this[_0xdf24('0x34')]['noop'](util[_0xdf24('0x25')]('Executed\x20command\x20%s\x20%s',_0xdf24('0x184'),_0x5f53bc));};AGIVertices[_0xdf24('0x10')]['system']=function(_0x532b02){logger[_0xdf24('0x28')](util[_0xdf24('0x25')](_0xdf24('0x187'),_0x532b02[_0xdf24('0x36')]));var _0x198c78=this['shellCommand']['sync'](this,_0x532b02[_0xdf24('0x188')]);this[_0xdf24('0x33')][_0xdf24('0x86')](this,_0x532b02,_0x532b02[_0xdf24('0x188')]);if(this[_0xdf24('0x61')](_0x532b02[_0xdf24('0xa8')])){var _0x53913c=this['getVariable'][_0xdf24('0x86')](this,_0x532b02[_0xdf24('0xa8')]);if(_0x53913c){this[_0xdf24('0x34')][_0xdf24('0x79')](_0x53913c,_0x198c78);return this[_0xdf24('0x34')][_0xdf24('0x87')](util['format'](_0xdf24('0x189'),_0x532b02[_0xdf24('0x188')],_0x53913c));}}return this['channel'][_0xdf24('0x87')](util[_0xdf24('0x25')](_0xdf24('0x18a'),_0x532b02[_0xdf24('0x188')]));};AGIVertices[_0xdf24('0x10')]['tts']=function(_0x1de4ce){logger[_0xdf24('0x28')](util[_0xdf24('0x25')](_0xdf24('0x18b'),_0x1de4ce[_0xdf24('0x36')]));if(!this['isConfigured'](_0x1de4ce[_0xdf24('0x56')])){return this[_0xdf24('0x34')]['noop'](_0xdf24('0x8e'));}this[_0xdf24('0x34')][_0xdf24('0x87')](util[_0xdf24('0x25')](_0xdf24('0x18c'),_0x1de4ce['text']));var _0x1a50e3=this['googleTTS'][_0xdf24('0x86')](this,_0x1de4ce);if(_0x1a50e3){this[_0xdf24('0x34')][_0xdf24('0x87')](util[_0xdf24('0x25')](_0xdf24('0x18d'),_0x1a50e3));var _0x49aab1=this[_0xdf24('0x34')][_0xdf24('0xf1')](_0x1a50e3);try{fs[_0xdf24('0x123')](_0x1a50e3+_0xdf24('0xcd'));}catch(_0x449586){logger[_0xdf24('0x2e')](_0x449586);}return _0x49aab1;}return this['channel'][_0xdf24('0x2e')](_0x1de4ce,_0xdf24('0x18e'));};AGIVertices[_0xdf24('0x10')][_0xdf24('0x18f')]=function(_0x295d51){logger[_0xdf24('0x28')](util[_0xdf24('0x25')](_0xdf24('0x190'),_0x295d51[_0xdf24('0x36')]));if(!this['isConfigured'](_0x295d51[_0xdf24('0x126')])){return this[_0xdf24('0x34')][_0xdf24('0x2e')](_0x295d51,_0xdf24('0x127'));}logger[_0xdf24('0x28')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x295d51[_0xdf24('0x126')]));var _0x12e149=this[_0xdf24('0x4e')][_0xdf24('0x86')](this,_0x295d51[_0xdf24('0x126')]);if(_0x12e149){logger[_0xdf24('0x28')](util[_0xdf24('0x25')](_0xdf24('0x129'),this['channel']['callerid'],_0x295d51[_0xdf24('0x126')]));this['channel'][_0xdf24('0x87')](util[_0xdf24('0x25')](_0xdf24('0x129'),this[_0xdf24('0x34')][_0xdf24('0x39')],_0x295d51[_0xdf24('0x126')]));return{'code':0xc8,'result':_0xdf24('0x12a')};}else{logger[_0xdf24('0x28')](util[_0xdf24('0x25')](_0xdf24('0x12b'),this[_0xdf24('0x34')][_0xdf24('0x39')],_0x295d51[_0xdf24('0x126')]));this[_0xdf24('0x34')][_0xdf24('0x87')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xdf24('0x34')][_0xdf24('0x39')],_0x295d51['findBy']));return{'code':0xc8,'result':_0xdf24('0x13a')};}};AGIVertices[_0xdf24('0x10')][_0xdf24('0x191')]=function(_0x5f4260){logger['info'](util[_0xdf24('0x25')](_0xdf24('0x192'),_0x5f4260[_0xdf24('0x36')]));var _0x5cf0f7=this[_0xdf24('0x34')][_0xdf24('0x53')](_0xdf24('0x193'),[_0x5f4260['mailbox'],_0x5f4260[_0xdf24('0x8c')]]);if(_0x5cf0f7[_0xdf24('0x80')]===-0x1){return _0x5cf0f7;}return this['channel'][_0xdf24('0x87')](util[_0xdf24('0x25')](_0xdf24('0x13d'),'VOICEMAIL',_0x5f4260[_0xdf24('0x194')]));};AGIVertices[_0xdf24('0x10')][_0xdf24('0x195')]=function(_0x2e5fca){logger['info'](util[_0xdf24('0x25')](_0xdf24('0x196'),_0x2e5fca['label']));if(!this[_0xdf24('0x61')](_0x2e5fca[_0xdf24('0xa8')])){return this[_0xdf24('0x34')]['error'](_0x2e5fca,_0xdf24('0x197'));}var _0x5c3fdf=this[_0xdf24('0x11')][_0xdf24('0x86')](this,_0x2e5fca[_0xdf24('0xa8')]);if(!_0x5c3fdf){return this[_0xdf24('0x34')]['error'](_0x2e5fca,_0xdf24('0xaa'));}var _0x20a779=this[_0xdf24('0x34')][_0xdf24('0x11')](_0x5c3fdf);return{'code':0xc8,'result':_0x20a779[_0xdf24('0x77')]?_0x20a779[_0xdf24('0x77')]:'-'};};String['prototype'][_0xdf24('0x76')]=function(_0x44272e,_0x18a83a){return this[_0xdf24('0x74')](_0x44272e)[_0xdf24('0x198')](_0x18a83a);};module['exports']=AGIVertices;
\ No newline at end of file
+var _0x30b0=['no\x20appid\x20configured','no\x20appsecret\x20configured','NOBEEP','recordFile','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','priority','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','login','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','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','QUEUE','macro','gosub','position','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','debug','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','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','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','randomstring','moment','mustache','../../config/logger','agi','../../config/environment','./scripts','menu','getdigits','rpc','mailRpc','prototype','then','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','name','getSquareOdbc','dsn','getUser','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','map','Intervals','interval','format','%s/sounds/converted/%s','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','dnid','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','getPause','agentPause','error','agentUnpause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','replace','googleTTS','text','google_tts_language','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','uri','includes','clone','isString','split','length','replaceAll','getVariable','replaceAllVariables','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','isConfigured','maxRetry','sync','retry','Enter\x20in\x20AGI\x20(%s)\x20block','label','command','args','answer','timeout','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','minutes','callback_priority','noop','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','options','result','Executed\x20command\x20%s\x20%s','lumenvoxtts','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20found','forEach','keys','setVariable','%s[%s][%s]','%s_ROWS_COUNT','dial','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','url','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','toUpperCase','speech','out','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','hasOwnProperty','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','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','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','response','maxdigit','test','stringify','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','aws_access_key_id','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20is\x20unreachable','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','%s.%s','beep','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s'];(function(_0x36629c,_0x36689a){var _0x1b0df1=function(_0x20b271){while(--_0x20b271){_0x36629c['push'](_0x36629c['shift']());}};_0x1b0df1(++_0x36689a);}(_0x30b0,0x8d));var _0x030b=function(_0x83bd53,_0x5b13a4){_0x83bd53=_0x83bd53-0x0;var _0x47444e=_0x30b0[_0x83bd53];return _0x47444e;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x030b('0x0'));var _=require(_0x030b('0x1'));var sh=require(_0x030b('0x2'));var odbc=require('odbc')();var rs=require(_0x030b('0x3'));var moment=require(_0x030b('0x4'));var Mustache=require(_0x030b('0x5'));var logger=require(_0x030b('0x6'))(_0x030b('0x7'));var config=require(_0x030b('0x8'));var scripts=require(_0x030b('0x9'));var FILES_PATH='/var/opt/motion2/server/files';var verticesWithRetry=[_0x030b('0xa'),_0x030b('0xb'),'getsecretdigits'];var AGIVertices=function(_0xa588d2,_0x3c18d5,_0x538a90){this['channel']=_0xa588d2;this[_0x030b('0xc')]=_0x3c18d5;this[_0x030b('0xd')]=_0x538a90;};AGIVertices[_0x030b('0xe')]['getVariable']=function(_0x295f63,_0xe9b713){this[_0x030b('0xc')]['getVariableById'](_0x295f63)[_0x030b('0xf')](function(_0x28f695){_0xe9b713(null,_0x28f695?_0x28f695['name']:![]);})[_0x030b('0x10')](function(_0x2a47ef){_0xe9b713(_0x2a47ef);});};AGIVertices[_0x030b('0xe')][_0x030b('0x11')]=function(_0x4f48b8,_0x2619c3){this[_0x030b('0xc')][_0x030b('0x12')](_0x4f48b8)[_0x030b('0xf')](function(_0x18496f){_0x2619c3(null,_0x18496f?_0x18496f['name']:![]);})[_0x030b('0x10')](function(_0x59b451){_0x2619c3(_0x59b451);});};AGIVertices[_0x030b('0xe')][_0x030b('0x13')]=function(_0x557576,_0x2782a1){this[_0x030b('0xc')][_0x030b('0x14')](_0x557576)[_0x030b('0xf')](function(_0x4e069f){_0x2782a1(null,_0x4e069f?_0x4e069f[_0x030b('0x15')]:![]);})['catch'](function(_0x17fd5a){_0x2782a1(_0x17fd5a);});};AGIVertices[_0x030b('0xe')][_0x030b('0x16')]=function(_0x5d2b1e,_0x4e5719){this[_0x030b('0xc')]['getSquareOdbcById'](_0x5d2b1e)[_0x030b('0xf')](function(_0x275a77){_0x4e5719(null,_0x275a77?_0x275a77[_0x030b('0x17')]:![]);})[_0x030b('0x10')](function(_0xf9f4a5){_0x4e5719(_0xf9f4a5);});};AGIVertices[_0x030b('0xe')][_0x030b('0x18')]=function(_0x4865cc,_0x51c79e){this[_0x030b('0xc')]['getUserById'](_0x4865cc)[_0x030b('0xf')](function(_0x33ae6a){_0x51c79e(null,_0x33ae6a?_0x33ae6a[_0x030b('0x15')]:![]);})[_0x030b('0x10')](function(_0x2954d0){_0x51c79e(_0x2954d0);});};AGIVertices[_0x030b('0xe')]['getTrunk']=function(_0x1d1c06,_0x2df6b9){this['rpc'][_0x030b('0x19')](_0x1d1c06)[_0x030b('0xf')](function(_0x39a64e){_0x2df6b9(null,_0x39a64e?_0x39a64e[_0x030b('0x15')]:![]);})[_0x030b('0x10')](function(_0x3d0f9a){_0x2df6b9(_0x3d0f9a);});};AGIVertices[_0x030b('0xe')]['getSound']=function(_0x19e546,_0x3e5964){var _0x4b6150=this;this[_0x030b('0xc')][_0x030b('0x1a')](_0x19e546)['then'](function(_0x2852ad){_0x3e5964(null,_0x2852ad?_0x4b6150[_0x030b('0x1b')](_0x2852ad[_0x030b('0x1c')]):![]);})[_0x030b('0x10')](function(_0x1dd0d1){_0x3e5964(_0x1dd0d1);});};AGIVertices[_0x030b('0xe')][_0x030b('0x1d')]=function(_0x3bfb3a,_0x4ed527){this[_0x030b('0xc')][_0x030b('0x1e')](_0x3bfb3a)[_0x030b('0xf')](function(_0x24fbbd){_0x4ed527(null,_0x24fbbd?_0x24fbbd:![]);})[_0x030b('0x10')](function(_0x358b84){_0x4ed527(_0x358b84);});};AGIVertices[_0x030b('0xe')]['sendMailMessage']=function(_0x37e0c7,_0x2f2c99,_0x4a7627){this[_0x030b('0xd')][_0x030b('0x1f')](_0x37e0c7,_0x2f2c99)[_0x030b('0xf')](function(){_0x4a7627(null);})['catch'](function(_0x2ae6cd){_0x4a7627(_0x2ae6cd);});};AGIVertices[_0x030b('0xe')]['getIntervals']=function(_0x5de935,_0x2443a8){this[_0x030b('0xc')][_0x030b('0x20')](_0x5de935)[_0x030b('0xf')](function(_0x2c9cab){if(_0x2c9cab){if(_0x2c9cab[_0x030b('0x21')]){_0x2443a8(null,[_0x2c9cab['interval']]);}else{_0x2443a8(null,_[_0x030b('0x22')](_0x2c9cab[_0x030b('0x23')],_0x030b('0x24')));}}else{_0x2443a8(null,![]);}})[_0x030b('0x10')](function(_0x323bc8){_0x2443a8(_0x323bc8);});};AGIVertices['prototype'][_0x030b('0x1b')]=function(_0x4aa9fa){return util[_0x030b('0x25')](_0x030b('0x26'),FILES_PATH,_0x4aa9fa);};AGIVertices[_0x030b('0xe')]['getQueryOdbc']=function(_0x1e3b1e,_0x54b299,_0x594be4){odbc[_0x030b('0x27')](_0x1e3b1e,function(_0x86e8c1){if(_0x86e8c1){logger['error'](_0x030b('0x28'),_0x86e8c1);_0x594be4(_0x86e8c1);}else{logger[_0x030b('0x29')]('ODBC\x20connection\x20successfully');odbc[_0x030b('0x2a')](_0x54b299,function(_0x16a131,_0x561136){if(_0x16a131){logger['info']('Error\x20executing\x20query\x20%s',_0x54b299);_0x594be4(_0x16a131);}else{logger['info'](_0x030b('0x2b'),_0x54b299);odbc[_0x030b('0x2c')](function(_0x32adc3){if(_0x32adc3){logger['error'](_0x030b('0x2d'),_0x32adc3);}_0x594be4(null,_0x561136);});}});}});};AGIVertices[_0x030b('0xe')][_0x030b('0x2e')]=function(_0x500f34,_0x1b3cd0){this[_0x030b('0xc')][_0x030b('0x2f')](_0x500f34)[_0x030b('0xf')](function(_0x46c49e){_0x1b3cd0(null,_0x46c49e?_0x46c49e:![]);})['catch'](function(_0x4ce0dd){_0x1b3cd0(_0x4ce0dd);});};AGIVertices['prototype'][_0x030b('0x30')]=function(_0xd8cf1e,_0xaf7e98){this['rpc'][_0x030b('0x30')](_0xd8cf1e)[_0x030b('0xf')](function(_0xa7662e){_0xaf7e98(null,_0xa7662e);})[_0x030b('0x10')](function(_0x4d8507){_0xaf7e98(_0x4d8507);});};AGIVertices[_0x030b('0xe')]['createSquareDetailsReport']=function(_0x17d315,_0x51f5bc,_0x58d364){this[_0x030b('0xc')][_0x030b('0x31')]({'uniqueid':this[_0x030b('0x32')][_0x030b('0x33')],'node':_0x17d315['label'],'application':_0x17d315[_0x030b('0x34')],'data':_0x51f5bc||null,'project_name':this[_0x030b('0x32')][_0x030b('0x35')],'callerid':this[_0x030b('0x32')][_0x030b('0x36')]})['then'](function(_0x4ed4e5){if(_0x58d364){_0x58d364(null,_0x4ed4e5);}})[_0x030b('0x10')](function(_0x1dc0f3){if(_0x58d364){_0x58d364(_0x1dc0f3);}});};AGIVertices['prototype'][_0x030b('0x37')]=function(_0x3c2945,_0x224ce5,_0xbbbff,_0x3b4ee1){this[_0x030b('0xc')][_0x030b('0x37')]({'uniqueid':this[_0x030b('0x32')][_0x030b('0x33')],'callerid':this[_0x030b('0x32')]['callerid'],'calleridname':this[_0x030b('0x32')][_0x030b('0x38')],'context':this[_0x030b('0x32')][_0x030b('0x39')],'extension':this['channel'][_0x030b('0x3a')],'priority':this[_0x030b('0x32')]['priority'],'accountcode':this[_0x030b('0x32')]['accountcode'],'dnid':this['channel'][_0x030b('0x3b')],'projectName':this[_0x030b('0x32')][_0x030b('0x35')],'saveName':_0x224ce5,'filename':_0x3c2945['file']||_0x224ce5,'savePath':_0xbbbff})[_0x030b('0xf')](function(_0x366ecd){_0x3b4ee1(null,_0x366ecd);})[_0x030b('0x10')](function(_0x434014){_0x3b4ee1(_0x434014);});};AGIVertices[_0x030b('0xe')][_0x030b('0x3c')]=function(_0xc71a3b,_0x3ba633,_0x247bc5){this[_0x030b('0xc')]['createSquareMessage']({'uniqueid':this['channel'][_0x030b('0x33')],'body':_0xc71a3b,'direction':_0x3ba633})['then'](function(_0x552a87){if(_0x247bc5){_0x247bc5(null,_0x552a87);}})[_0x030b('0x10')](function(_0x3a1852){if(_0x247bc5){_0x247bc5(_0x3a1852);}});};AGIVertices[_0x030b('0xe')]['createCmContact']=function(_0x1c53fe,_0x3ca069){this[_0x030b('0xc')][_0x030b('0x3d')]({'firstName':_['isEmpty'](_0x1c53fe['name'])||_[_0x030b('0x3e')](_0x1c53fe[_0x030b('0x15')])?_0x030b('0x3f')+Math[_0x030b('0x40')]():_0x1c53fe['name'],'lastName':_[_0x030b('0x41')](_0x1c53fe[_0x030b('0x42')])||_[_0x030b('0x3e')](_0x1c53fe['lastName'])?null:_0x1c53fe[_0x030b('0x42')],'phone':_0x1c53fe[_0x030b('0x43')],'ListId':_0x1c53fe[_0x030b('0x44')],'scheduledAt':_0x1c53fe[_0x030b('0x45')],'callbackUniqueid':this[_0x030b('0x32')]['uniqueid'],'tags':'callback','description':_0x030b('0x46')+_0x1c53fe[_0x030b('0x45')][_0x030b('0x47')](),'priority':_0x1c53fe['callback_priority']})['then'](function(_0x2b418c){_0x3ca069(null,_0x2b418c);})[_0x030b('0x10')](function(_0x1bfb2f){_0x3ca069(_0x1bfb2f);});};AGIVertices['prototype'][_0x030b('0x48')]=function(_0x132c66,_0x226844){this[_0x030b('0xc')]['getPauseById'](_0x132c66)[_0x030b('0xf')](function(_0x32dd98){_0x226844(null,_0x32dd98?_0x32dd98[_0x030b('0x15')]:![]);})['catch'](function(_0x4ee8e6){_0x226844(_0x4ee8e6);});};AGIVertices[_0x030b('0xe')][_0x030b('0x49')]=function(_0x5c6ce1,_0x13f4ae,_0xe73e46){var _0x11dd47={'role':'agent'};_0x11dd47[_0x5c6ce1]=this[_0x030b('0x32')]['callerid'];this[_0x030b('0xc')]['agentPause'](_0x11dd47,_0x13f4ae,this[_0x030b('0x32')]['uniqueid'])[_0x030b('0xf')](function(_0x10d58d){_0xe73e46(null,_['isNil'](_0x10d58d)?![]:!![]);})['catch'](function(_0x51f43e){logger[_0x030b('0x4a')](_0x51f43e);_0xe73e46(null,![]);});};AGIVertices['prototype'][_0x030b('0x4b')]=function(_0x5a1114,_0x48d088){var _0x120852={'role':_0x030b('0x4c')};_0x120852[_0x5a1114]=this[_0x030b('0x32')][_0x030b('0x36')];this['rpc'][_0x030b('0x4b')](_0x120852)['then'](function(_0x234e09){_0x48d088(null,_['isNil'](_0x234e09)?![]:!![]);})[_0x030b('0x10')](function(_0x2eb4b7){logger[_0x030b('0x4a')](_0x2eb4b7);_0x48d088(null,![]);});};AGIVertices[_0x030b('0xe')][_0x030b('0x4d')]=function(_0x2050f7,_0x223fb4){var _0x581cd5={'role':_0x030b('0x4c')};_0x581cd5[_0x2050f7]=this[_0x030b('0x32')]['callerid'];this[_0x030b('0xc')][_0x030b('0x4d')](_0x581cd5)[_0x030b('0xf')](function(_0x192d78){_0x223fb4(null,_['isNil'](_0x192d78)?![]:!![]);})[_0x030b('0x10')](function(_0x34a0a4){logger[_0x030b('0x4a')](_0x34a0a4);_0x223fb4(null,![]);});};AGIVertices['prototype'][_0x030b('0x4e')]=function(_0x54155c,_0x336f1f){var _0x1b4027={'role':_0x030b('0x4c')};_0x1b4027[_0x54155c]=this[_0x030b('0x32')][_0x030b('0x36')];var _0x380de3=_0x54155c!=_0x030b('0x4f')?util['format'](_0x030b('0x50'),_0x030b('0x51'),this[_0x030b('0x32')][_0x030b('0x36')]):undefined;this[_0x030b('0xc')][_0x030b('0x4e')](_0x1b4027,_0x380de3)[_0x030b('0xf')](function(_0x437a0e){_0x336f1f(null,_[_0x030b('0x3e')](_0x437a0e)?![]:!![]);})[_0x030b('0x10')](function(_0x37161a){logger['error'](_0x37161a);_0x336f1f(null,![]);});};AGIVertices[_0x030b('0xe')][_0x030b('0x52')]=function(_0x10412e,_0xc9a0ae){sh[_0x030b('0x53')](_['trim'](_0x10412e),function(_0x5aa6a2,_0x265611){var _0x4dd106=_0x265611[_0x030b('0x54')](/(\r\n|\n|\r)/gm,'');_0xc9a0ae(null,_0x4dd106);});};AGIVertices[_0x030b('0xe')][_0x030b('0x55')]=function(_0x3f943b,_0x17ad67){scripts[_0x030b('0x55')](_0x3f943b[_0x030b('0x56')],_0x3f943b[_0x030b('0x57')]||'en',0x1)[_0x030b('0xf')](function(_0x508c5a){_0x17ad67(null,_0x508c5a);})['catch'](function(_0x134427){_0x17ad67(_0x134427);});};AGIVertices['prototype'][_0x030b('0x58')]=function(_0x17f979,_0x3971d2){scripts['googleDialogflow'](this[_0x030b('0x32')][_0x030b('0x33')],_0x17f979[_0x030b('0x59')],_0x17f979[_0x030b('0x56')],_0x17f979[_0x030b('0x5a')]||'en')[_0x030b('0xf')](function(_0x42c9ee){_0x3971d2(null,_0x42c9ee);})['catch'](function(_0x224a26){_0x3971d2(_0x224a26);});};AGIVertices[_0x030b('0xe')][_0x030b('0x5b')]=function(_0x38572c,_0x490825){scripts['sestekNDA'](this[_0x030b('0x32')],_0x38572c)[_0x030b('0xf')](function(_0x2970ef){_0x490825(null,_0x2970ef);})['catch'](function(_0x55c608){_0x490825(_0x55c608);});};AGIVertices[_0x030b('0xe')][_0x030b('0x5c')]=function(_0x111824,_0x49886e){scripts['ispeechTTS'](_0x111824[_0x030b('0x59')],_0x111824[_0x030b('0x56')],_0x111824[_0x030b('0x5d')]||_0x030b('0x5e'),_0x111824[_0x030b('0x5f')])[_0x030b('0xf')](function(_0x31ba01){_0x49886e(null,_0x31ba01);})[_0x030b('0x10')](function(_0xbd372d){_0x49886e(_0xbd372d);});};AGIVertices[_0x030b('0xe')]['ispeechASR']=function(_0x3a6d5c,_0x4b55e2,_0x352c21){scripts[_0x030b('0x60')](_0x4b55e2,_0x3a6d5c[_0x030b('0x59')],_0x3a6d5c[_0x030b('0x61')]||_0x030b('0x5e'),this['isConfigured'](_0x3a6d5c[_0x030b('0x62')])?_0x3a6d5c[_0x030b('0x62')]:undefined)['then'](function(_0x614965){_0x352c21(null,_0x614965);})[_0x030b('0x10')](function(_0x5586d1){_0x352c21(_0x5586d1);});};AGIVertices[_0x030b('0xe')]['awsPolly']=function(_0x5bb6cc,_0x2815aa){scripts[_0x030b('0x63')](_0x5bb6cc['aws_access_key_id'],_0x5bb6cc[_0x030b('0x64')],_0x5bb6cc[_0x030b('0x65')],_0x5bb6cc[_0x030b('0x66')]||_0x030b('0x67'),_0x5bb6cc[_0x030b('0x56')],_0x5bb6cc[_0x030b('0x68')]||_0x030b('0x56'))['then'](function(_0x38c82d){_0x2815aa(null,_0x38c82d);})[_0x030b('0x10')](function(_0x55b308){_0x2815aa(_0x55b308);});};AGIVertices[_0x030b('0xe')][_0x030b('0x69')]=function(_0x3e634c,_0x59bdbc){scripts[_0x030b('0x69')](this['channel'][_0x030b('0x33')],_0x3e634c['aws_access_key_id'],_0x3e634c['aws_secret_access_key'],_0x3e634c['aws_lex_region'],_0x3e634c[_0x030b('0x56')],_0x3e634c[_0x030b('0x6a')])[_0x030b('0xf')](function(_0x680a7e){_0x59bdbc(null,_0x680a7e);})[_0x030b('0x10')](function(_0x5ed736){_0x59bdbc(_0x5ed736);});};AGIVertices['prototype'][_0x030b('0x6b')]=function(_0x48d3a0,_0x215fc2,_0x1de6d0){scripts[_0x030b('0x6b')](_0x215fc2,_0x48d3a0[_0x030b('0x59')],_0x48d3a0[_0x030b('0x6c')]||'en-US')[_0x030b('0xf')](function(_0x2be747){_0x1de6d0(null,_0x2be747);})[_0x030b('0x10')](function(_0x494167){_0x1de6d0(_0x494167);});};AGIVertices['prototype'][_0x030b('0x6d')]=function(_0x4698f0,_0x5b7ea2,_0x333809){scripts[_0x030b('0x6d')](_0x5b7ea2,_0x4698f0[_0x030b('0x6e')],_0x4698f0['appsecret'],_0x4698f0[_0x030b('0x6f')])['then'](function(_0x2bbfbc){_0x333809(null,_0x2bbfbc);})['catch'](function(_0x290dd9){_0x333809(_0x290dd9);});};AGIVertices[_0x030b('0xe')]['clear']=function(_0x161be3){var _0x6e03af=_[_0x030b('0x70')](verticesWithRetry,_0x161be3['agicommand'])?_0x161be3:_[_0x030b('0x71')](_0x161be3);for(var _0x4517ec in _0x6e03af){if(_0x6e03af['hasOwnProperty'](_0x4517ec)){if(_0x6e03af[_0x4517ec]&&_[_0x030b('0x72')](_0x6e03af[_0x4517ec])){_0x6e03af[_0x4517ec]=this['replaceAllVariables'](_0x6e03af[_0x4517ec]);}}}return _0x6e03af;};AGIVertices[_0x030b('0xe')]['replaceAllVariables']=function(_0x4fc508){var _0x3cf62a=_0x4fc508[_0x030b('0x73')]('{');for(var _0x5430a8=0x1;_0x5430a8<_0x3cf62a[_0x030b('0x74')];_0x5430a8+=0x1){var _0x1d57af=_0x3cf62a[_0x5430a8][_0x030b('0x73')]('}');if(_0x1d57af[_0x030b('0x74')]>0x1){_0x4fc508=_0x4fc508[_0x030b('0x75')]('{'+_0x1d57af[0x0]+'}',this[_0x030b('0x32')][_0x030b('0x76')](_0x1d57af[0x0])['extra']||_0x1d57af[0x0]);}}if(_0x3cf62a[_0x030b('0x74')]===0x1){return _0x4fc508['toString']();}return this[_0x030b('0x77')](_0x4fc508);};AGIVertices[_0x030b('0xe')][_0x030b('0x78')]=function(_0x42a8a8,_0x394d2f){var _0x1f2b91=this[_0x030b('0x32')]['getVariable'](_0x42a8a8);if(_0x1f2b91['result']===-0x1){return _0x1f2b91;}logger[_0x030b('0x29')](util['format'](_0x030b('0x79'),_0x394d2f,_0x1f2b91[_0x030b('0x7a')]));return this['channel']['setVariable'](_0x394d2f,_0x1f2b91[_0x030b('0x7a')]);};AGIVertices[_0x030b('0xe')][_0x030b('0x7b')]=function(_0x499fcf){return _0x499fcf&&_0x499fcf!=='0'&&_0x499fcf!=='-1'&&_0x499fcf!=='';};AGIVertices[_0x030b('0xe')][_0x030b('0x7c')]=function(_0x1dc13a){this['createSquareDetailsReport'][_0x030b('0x7d')](this,_0x1dc13a,'-');_0x1dc13a[_0x030b('0x7e')]=_0x1dc13a['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x030b('0xe')]['agi']=function(_0x12e461){logger[_0x030b('0x29')](util[_0x030b('0x25')](_0x030b('0x7f'),_0x12e461[_0x030b('0x80')]));return this[_0x030b('0x32')]['agi']([_0x12e461[_0x030b('0x81')],_0x12e461[_0x030b('0x82')]]);};AGIVertices[_0x030b('0xe')][_0x030b('0x83')]=function(_0x21d5f8){logger[_0x030b('0x29')](util[_0x030b('0x25')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x21d5f8['label']));if(this['isConfigured'](_0x21d5f8[_0x030b('0x84')])){logger[_0x030b('0x29')](util[_0x030b('0x25')](_0x030b('0x85'),_0x21d5f8[_0x030b('0x84')]));var _0x38f7b8=this[_0x030b('0x32')][_0x030b('0x86')](_0x21d5f8[_0x030b('0x84')]);if(_0x38f7b8['result']===-0x1){return _0x38f7b8;}}return this['channel']['answer']();};AGIVertices['prototype'][_0x030b('0x87')]=function(_0x40fdb0){logger[_0x030b('0x29')](util[_0x030b('0x25')](_0x030b('0x88'),_0x40fdb0[_0x030b('0x80')]));if(!this[_0x030b('0x7b')](_0x40fdb0[_0x030b('0x44')])){return this['channel'][_0x030b('0x4a')](_0x40fdb0,'no\x20list\x20selected');}_0x40fdb0[_0x030b('0x45')]=moment();if(this[_0x030b('0x7b')](_0x40fdb0[_0x030b('0x89')])){_0x40fdb0[_0x030b('0x45')]=moment()[_0x030b('0x8a')](_0x40fdb0[_0x030b('0x89')],_0x030b('0x8b'));}if(!this[_0x030b('0x7b')](_0x40fdb0[_0x030b('0x8c')])){_0x40fdb0[_0x030b('0x8c')]=0x2;}this[_0x030b('0x3d')]['sync'](this,_0x40fdb0);return this['channel'][_0x030b('0x8d')](util[_0x030b('0x25')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x40fdb0['phone'],_0x40fdb0[_0x030b('0x44')],_0x40fdb0[_0x030b('0x45')]));};AGIVertices[_0x030b('0xe')]['custom_app']=function(_0x36633b){logger[_0x030b('0x29')](util[_0x030b('0x25')](_0x030b('0x8e'),_0x36633b[_0x030b('0x80')]));var _0x1a4e71=this['channel'][_0x030b('0x53')](_0x36633b[_0x030b('0x8f')],_0x36633b[_0x030b('0x90')]);if(_0x1a4e71[_0x030b('0x91')]===-0x1){return _0x1a4e71;}return this[_0x030b('0x32')]['noop'](util['format'](_0x030b('0x92'),_0x36633b[_0x030b('0x8f')],_0x36633b[_0x030b('0x90')]));};AGIVertices[_0x030b('0xe')][_0x030b('0x93')]=function(_0x3257a9){logger[_0x030b('0x29')](util[_0x030b('0x25')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x3257a9[_0x030b('0x80')]));if(!this[_0x030b('0x7b')](_0x3257a9[_0x030b('0x56')])){return this[_0x030b('0x32')][_0x030b('0x8d')]('no\x20text\x20configured');}var _0x1caf0f='\x22'+_0x3257a9['text']+'\x22';if(this[_0x030b('0x7b')](_0x3257a9[_0x030b('0x90')])){_0x1caf0f+=','+_0x3257a9['options'];}var _0x40ed52=this[_0x030b('0x32')]['exec']('MRCPSynth',_0x1caf0f);if(_0x40ed52[_0x030b('0x91')]===-0x1){return _0x40ed52;}return this[_0x030b('0x32')][_0x030b('0x8d')](util[_0x030b('0x25')]('Executed\x20command\x20MRCPSynth\x20%s',_0x1caf0f));};AGIVertices[_0x030b('0xe')][_0x030b('0x94')]=function(_0x3793dc){logger[_0x030b('0x29')](util[_0x030b('0x25')](_0x030b('0x95'),_0x3793dc['label']));if(!this[_0x030b('0x7b')](_0x3793dc[_0x030b('0x56')])){return this[_0x030b('0x32')][_0x030b('0x8d')](_0x030b('0x96'));}var _0x2c7019='\x22'+_0x3793dc['text']+'\x22';if(this[_0x030b('0x7b')](_0x3793dc[_0x030b('0x90')])){_0x2c7019+=','+_0x3793dc[_0x030b('0x90')];}var _0x3cc56e=this['channel'][_0x030b('0x53')]('MRCPSynth',_0x2c7019);if(_0x3cc56e[_0x030b('0x91')]===-0x1){return _0x3cc56e;}return this[_0x030b('0x32')][_0x030b('0x8d')](util[_0x030b('0x25')](_0x030b('0x97'),_0x2c7019));};AGIVertices['prototype'][_0x030b('0x98')]=function(_0x523b7b){logger[_0x030b('0x29')](util['format'](_0x030b('0x99'),_0x523b7b[_0x030b('0x80')]));if(!this[_0x030b('0x7b')](_0x523b7b[_0x030b('0x9a')])){return this[_0x030b('0x32')][_0x030b('0x8d')](_0x030b('0x9b'));}var _0x5bee86=_0x523b7b[_0x030b('0x9a')];if(this['isConfigured'](_0x523b7b[_0x030b('0x90')])){_0x5bee86+=','+_0x523b7b[_0x030b('0x90')];}var _0x2deb69=this[_0x030b('0x32')][_0x030b('0x53')](_0x030b('0x9c'),_0x5bee86);if(_0x2deb69[_0x030b('0x91')]===-0x1){return _0x2deb69;}var _0x10a2fe=this[_0x030b('0x78')](_0x030b('0x9d'),_0x030b('0x9e'));if(_0x10a2fe['result']===-0x1){return _0x10a2fe;}var _0x4db598=this['getAndSetVariable'](_0x030b('0x9f'),_0x030b('0xa0'));if(_0x4db598[_0x030b('0x91')]===-0x1){return _0x4db598;}var _0x3fa78d=this[_0x030b('0x78')](_0x030b('0xa1'),'LUMENVOX_ASR_INSTANCE');if(_0x3fa78d[_0x030b('0x91')]===-0x1){return _0x3fa78d;}return this['channel'][_0x030b('0x8d')](util[_0x030b('0x25')](_0x030b('0xa2'),_0x5bee86));};AGIVertices[_0x030b('0xe')][_0x030b('0xa3')]=function(_0x1bb28c){logger[_0x030b('0x29')](util[_0x030b('0x25')](_0x030b('0xa4'),_0x1bb28c['label']));if(!this[_0x030b('0x7b')](_0x1bb28c[_0x030b('0x9a')])){return this[_0x030b('0x32')][_0x030b('0x8d')]('no\x20grammar\x20configured');}var _0x15e509=_0x1bb28c[_0x030b('0x9a')];if(this[_0x030b('0x7b')](_0x1bb28c['options'])){_0x15e509+=','+_0x1bb28c[_0x030b('0x90')];}var _0x233c6c=this['channel'][_0x030b('0x53')](_0x030b('0x9c'),_0x15e509);if(_0x233c6c[_0x030b('0x91')]===-0x1){return _0x233c6c;}var _0x194194=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x030b('0xa5'));if(_0x194194[_0x030b('0x91')]===-0x1){return _0x194194;}var _0x482dd9=this[_0x030b('0x78')](_0x030b('0x9f'),_0x030b('0xa6'));if(_0x482dd9[_0x030b('0x91')]===-0x1){return _0x482dd9;}var _0x3de7c2=this['getAndSetVariable'](_0x030b('0xa1'),'SESTEK_ASR_INSTANCE');if(_0x3de7c2[_0x030b('0x91')]===-0x1){return _0x3de7c2;}return this[_0x030b('0x32')][_0x030b('0x8d')](util[_0x030b('0x25')]('Executed\x20command\x20MRCPRecog\x20%s',_0x15e509));};AGIVertices['prototype'][_0x030b('0xa7')]=function(_0x20a71d){logger[_0x030b('0x29')](util['format'](_0x030b('0xa8'),_0x20a71d[_0x030b('0x80')]));if(!this[_0x030b('0x7b')](_0x20a71d[_0x030b('0xa9')])){return this[_0x030b('0x32')][_0x030b('0x4a')](_0x20a71d,_0x030b('0xaa'));}var _0x5aa4fa=this[_0x030b('0x16')]['sync'](this,_0x20a71d['odbc_id']);if(!_0x5aa4fa){return this[_0x030b('0x32')][_0x030b('0x4a')](_0x20a71d,_0x030b('0xab'));}if(!this[_0x030b('0x7b')](_0x20a71d['query'])){return this[_0x030b('0x32')]['error'](_0x20a71d,_0x030b('0xac'));}var _0x47eed1=_0x20a71d[_0x030b('0x2a')][_0x030b('0x54')](/(\r\n|\n|\r)/gm,'\x20');this[_0x030b('0x32')][_0x030b('0x8d')](util[_0x030b('0x25')](_0x030b('0xad'),_0x47eed1));var _0x2c79c9=this[_0x030b('0xae')]['sync'](this,_0x5aa4fa,_0x47eed1);this[_0x030b('0x31')][_0x030b('0x7d')](this,_0x20a71d,_0x47eed1);if(!this[_0x030b('0x7b')](_0x20a71d[_0x030b('0xaf')])){return this[_0x030b('0x32')][_0x030b('0x8d')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4a332b=this['getVariable'][_0x030b('0x7d')](this,_0x20a71d[_0x030b('0xaf')]);if(!_0x4a332b){return this[_0x030b('0x32')][_0x030b('0x4a')](_0x20a71d,_0x030b('0xb0'));}var _0x44e40b=this;_0x2c79c9[_0x030b('0xb1')](function(_0x261296,_0x43790a){Object[_0x030b('0xb2')](_0x261296)[_0x030b('0xb1')](function(_0x458940){_0x44e40b[_0x030b('0x32')][_0x030b('0xb3')](util[_0x030b('0x25')](_0x030b('0xb4'),_0x4a332b,_0x43790a,_0x458940),_0x261296[_0x458940]);});});this[_0x030b('0x32')]['setVariable'](util[_0x030b('0x25')](_0x030b('0xb5'),_0x4a332b),_0x2c79c9[_0x030b('0x74')]);return this['channel'][_0x030b('0x8d')](util[_0x030b('0x25')]('variable\x20%s\x20set',_0x4a332b));};AGIVertices['prototype'][_0x030b('0xb6')]=function(_0x2fd524){logger['debug'](util[_0x030b('0x25')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x2fd524[_0x030b('0x80')]));if(!this[_0x030b('0x7b')](_0x2fd524[_0x030b('0xb7')])){return this[_0x030b('0x32')][_0x030b('0x4a')](_0x2fd524,_0x030b('0xb8'));}var _0x249f3d=this['getUser'][_0x030b('0x7d')](this,_0x2fd524['sip_id']);if(!_0x249f3d){return this['channel'][_0x030b('0x4a')](_0x2fd524,_0x030b('0xb9'));}var _0xa1e941=this[_0x030b('0x32')][_0x030b('0x53')](_0x030b('0xba'),[util['format'](_0x030b('0xbb'),_0x249f3d),_0x2fd524[_0x030b('0x84')],_0x2fd524['opts'],_0x2fd524[_0x030b('0xbc')]]);if(_0xa1e941[_0x030b('0x91')]===-0x1){return _0xa1e941;}return this[_0x030b('0x32')][_0x030b('0x8d')](util['format'](_0x030b('0xbd'),_0x030b('0xba')));};AGIVertices['prototype'][_0x030b('0xbe')]=function(_0x27e8f9){logger[_0x030b('0x29')](util['format'](_0x030b('0xbf'),_0x27e8f9[_0x030b('0x80')]));if(!this[_0x030b('0x7b')](_0x27e8f9[_0x030b('0x59')])){return this[_0x030b('0x32')][_0x030b('0x8d')](_0x030b('0xc0'));}if(!this[_0x030b('0x7b')](_0x27e8f9[_0x030b('0x56')])){return this[_0x030b('0x32')][_0x030b('0x8d')]('no\x20text\x20configured');}this[_0x030b('0x32')][_0x030b('0xc1')]=!![];this[_0x030b('0x31')](_0x27e8f9);this[_0x030b('0x3c')](_0x27e8f9['text'],'in');this[_0x030b('0x32')][_0x030b('0x8d')](util[_0x030b('0x25')]('Trying\x20Dialogflow:\x20%s',_0x27e8f9[_0x030b('0x56')]));var _0x80333c=this[_0x030b('0x58')]['sync'](this,_0x27e8f9);if(_0x80333c){for(var _0x3bc012 in _0x80333c){if(_0x80333c['hasOwnProperty'](_0x3bc012)){this[_0x030b('0x32')][_0x030b('0xb3')](util[_0x030b('0x25')](_0x030b('0xc2'),_0x3bc012[_0x030b('0xc3')]()),_0x80333c[_0x3bc012]);}}this['createSquareMessage'](_0x80333c[_0x030b('0xc4')],_0x030b('0xc5'));return this[_0x030b('0x32')][_0x030b('0x8d')](util[_0x030b('0x25')]('Dialogflow\x20Result\x20%s',_0x80333c[_0x030b('0xc4')]));}return this[_0x030b('0x32')][_0x030b('0x4a')](_0x27e8f9,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x030b('0xe')][_0x030b('0xc6')]=function(_0x1bd2bb){logger['info'](util[_0x030b('0x25')](_0x030b('0xc7'),_0x1bd2bb['label']));if(!this[_0x030b('0x7b')](_0x1bd2bb[_0x030b('0xc8')])){return this['channel'][_0x030b('0x8d')](_0x030b('0xc9'));}if(!this[_0x030b('0x7b')](_0x1bd2bb[_0x030b('0xca')])){return this[_0x030b('0x32')][_0x030b('0x8d')](_0x030b('0xcb'));}if(!this[_0x030b('0x7b')](_0x1bd2bb[_0x030b('0xcc')])){return this[_0x030b('0x32')]['noop'](_0x030b('0xcd'));}if(!this[_0x030b('0x7b')](_0x1bd2bb[_0x030b('0xce')])){return this[_0x030b('0x32')][_0x030b('0x8d')](_0x030b('0x96'));}this[_0x030b('0x32')][_0x030b('0xc1')]=!![];this['createSquareDetailsReport'](_0x1bd2bb);this[_0x030b('0x3c')](_0x1bd2bb[_0x030b('0x56')],'in');this[_0x030b('0x32')][_0x030b('0x8d')](util[_0x030b('0x25')]('Trying\x20SestekNDA:\x20%s',_0x1bd2bb['text']));var _0x48a39d=this[_0x030b('0x5b')][_0x030b('0x7d')](this,_0x1bd2bb);if(_0x48a39d){for(var _0x4c1ffe in _0x48a39d){if(_0x48a39d[_0x030b('0xcf')](_0x4c1ffe)){this[_0x030b('0x32')][_0x030b('0xb3')](util[_0x030b('0x25')]('SESTEK_NDA_%s',_0x4c1ffe[_0x030b('0xc3')]()),_0x48a39d[_0x4c1ffe]);}}this[_0x030b('0x3c')](_0x48a39d['speech'],'out');if(_0x48a39d['audiofile']){this['channel']['noop'](util['format'](_0x030b('0xd0'),_0x48a39d['audiofile']));var _0xac878a=this['channel'][_0x030b('0xd1')](_0x48a39d[_0x030b('0xd2')]);try{fs[_0x030b('0xd3')](_0x48a39d[_0x030b('0xd2')]+_0x030b('0xd4'));}catch(_0x2f14a0){logger[_0x030b('0x4a')](_0x2f14a0);}return _0xac878a;}else{return this[_0x030b('0x32')][_0x030b('0x8d')](util['format'](_0x030b('0xd5'),_0x48a39d[_0x030b('0xc4')]));}}return this[_0x030b('0x32')][_0x030b('0x4a')](_0x1bd2bb,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x030b('0xe')][_0x030b('0xd6')]=function(_0x50b614){logger[_0x030b('0x29')](util[_0x030b('0x25')](_0x030b('0xd7'),_0x50b614[_0x030b('0x80')]));return this[_0x030b('0x32')][_0x030b('0x8d')](_0x030b('0xd6'));};AGIVertices[_0x030b('0xe')]['ext_dial']=function(_0x2c1a89){logger[_0x030b('0x29')](util[_0x030b('0x25')](_0x030b('0xd8'),_0x2c1a89[_0x030b('0x80')]));var _0x3e8a2c='';if(_0x2c1a89[_0x030b('0xd9')]){if(!this[_0x030b('0x7b')](_0x2c1a89[_0x030b('0xd9')])){return this[_0x030b('0x32')]['error'](_0x2c1a89,_0x030b('0xda'));}else{var _0x42ac76=parseInt(_0x2c1a89[_0x030b('0xd9')],0xa);if(isNaN(_0x42ac76)){_0x3e8a2c=_0x2c1a89[_0x030b('0xd9')];}else{_0x3e8a2c=this['getTrunk'][_0x030b('0x7d')](this,_0x2c1a89[_0x030b('0xd9')]);if(!_0x3e8a2c){return this[_0x030b('0x32')][_0x030b('0x4a')](_0x2c1a89,_0x030b('0xdb'));}}}}else if(_0x2c1a89[_0x030b('0xdc')]){_0x3e8a2c=_0x2c1a89[_0x030b('0xdc')];}else{return this['channel']['error'](_0x2c1a89,'no\x20trunk\x20selected');}var _0x116a19=this[_0x030b('0x32')]['exec'](_0x030b('0xba'),[util[_0x030b('0x25')](_0x030b('0xdd'),_0x3e8a2c,_0x2c1a89[_0x030b('0x43')]),_0x2c1a89['timeout'],_0x2c1a89[_0x030b('0xde')],_0x2c1a89[_0x030b('0xbc')]]);if(_0x116a19['result']===-0x1){return _0x116a19;}return this['channel'][_0x030b('0x8d')](util[_0x030b('0x25')](_0x030b('0xbd'),_0x030b('0xba')));};AGIVertices[_0x030b('0xe')][_0x030b('0xdf')]=function(_0x5450f2){logger[_0x030b('0x29')](util[_0x030b('0x25')](_0x030b('0xe0'),_0x5450f2['label']));return this[_0x030b('0x32')]['noop']('finally');};AGIVertices[_0x030b('0xe')][_0x030b('0xb')]=function(_0x4c8345){logger[_0x030b('0x29')](util[_0x030b('0x25')](_0x030b('0xe1'),_0x4c8345[_0x030b('0x80')]));if(_0x4c8345[_0x030b('0x7e')]===0x0){return this['maxRetry'](_0x4c8345);}_0x4c8345[_0x030b('0x7e')]-=0x1;if(!this[_0x030b('0x7b')](_0x4c8345[_0x030b('0xe2')])){return this['channel'][_0x030b('0x4a')](_0x4c8345,_0x030b('0xe3'));}var _0x37c143=this[_0x030b('0xe4')][_0x030b('0x7d')](this,_0x4c8345[_0x030b('0xe2')]);if(!_0x37c143){return this[_0x030b('0x32')]['error'](_0x4c8345,_0x030b('0xe5'));}if(!this['isConfigured'](_0x4c8345[_0x030b('0xaf')])){return this[_0x030b('0x32')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x240193=this[_0x030b('0x32')]['getData'](_0x37c143,_0x4c8345[_0x030b('0xe6')],_0x4c8345[_0x030b('0xe7')]);var _0xd2a8d5=_0x240193[_0x030b('0x91')]?_0x240193[_0x030b('0x91')]['toString']():'';logger['info'](_0x030b('0xe8'),JSON[_0x030b('0xe9')](_0x240193));if(_0x240193[_0x030b('0x91')]===-0x1){this[_0x030b('0x31')]['sync'](this,_0x4c8345,_0xd2a8d5);return _0x240193;}else if(_0x240193[_0x030b('0x7a')]===_0x030b('0x84')){_0x240193[_0x030b('0x91')]=_0xd2a8d5['length']>=parseInt(_0x4c8345['mindigit'])?'x':'i';}else{_0x240193[_0x030b('0x91')]=_0xd2a8d5[_0x030b('0x74')]>=parseInt(_0x4c8345[_0x030b('0xea')])&&_0xd2a8d5[_0x030b('0x74')]<=parseInt(_0x4c8345[_0x030b('0xe7')])?'x':'i';}var _0x28bfa1=this[_0x030b('0x76')][_0x030b('0x7d')](this,_0x4c8345['variable_id']);if(!_0x28bfa1){return this['channel'][_0x030b('0x4a')](_0x4c8345,_0x030b('0xb0'));}this[_0x030b('0x32')][_0x030b('0xb3')](_0x28bfa1,_0xd2a8d5);if(this[_0x030b('0x7b')](_0x4c8345['hiddendigitsnum'])){var _0x118eee=parseInt(_0x4c8345[_0x030b('0xeb')],0xa);var _0x159c60=rs[_0x030b('0xec')]({'charset':'*','length':_0x118eee});var _0x3327c2=_0xd2a8d5[_0x030b('0x74')];if(_0x3327c2>0x0){if(_0x3327c2>_0x118eee){this['createSquareDetailsReport'][_0x030b('0x7d')](this,_0x4c8345,_0x4c8345[_0x030b('0xed')]==='first'?_0x159c60+_0xd2a8d5['substr'](_0x118eee):_0xd2a8d5[_0x030b('0xee')](0x0,_0x3327c2-_0x118eee)+_0x159c60);}else{this[_0x030b('0x31')]['sync'](this,_0x4c8345,rs[_0x030b('0xec')]({'charset':'*','length':_0x3327c2}));}}else{this[_0x030b('0x31')][_0x030b('0x7d')](this,_0x4c8345,'');}}else{this[_0x030b('0x31')][_0x030b('0x7d')](this,_0x4c8345,_0xd2a8d5);}return _0x240193;};AGIVertices[_0x030b('0xe')][_0x030b('0xef')]=function(_0x1dd0ff){logger[_0x030b('0x29')](util[_0x030b('0x25')](_0x030b('0xf0'),_0x1dd0ff[_0x030b('0x80')]));return this[_0x030b('0xb')](_0x1dd0ff);};AGIVertices[_0x030b('0xe')][_0x030b('0xf1')]=function(_0x145753){logger[_0x030b('0x29')](util[_0x030b('0x25')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x145753[_0x030b('0x80')]));this['createSquareDetailsReport'][_0x030b('0x7d')](this,_0x145753,_0x145753[_0x030b('0xf2')]);return this['channel'][_0x030b('0x8d')](util[_0x030b('0x25')](_0x030b('0xf3'),_0x145753[_0x030b('0xf2')]));};AGIVertices[_0x030b('0xe')]['awspolly']=function(_0x3b6b58){logger[_0x030b('0x29')](util[_0x030b('0x25')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x3b6b58['label']));if(!this[_0x030b('0x7b')](_0x3b6b58[_0x030b('0xf4')])||!this[_0x030b('0x7b')](_0x3b6b58['aws_secret_access_key'])){return this[_0x030b('0x32')][_0x030b('0x8d')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x3b6b58[_0x030b('0x56')])){return this[_0x030b('0x32')][_0x030b('0x8d')]('no\x20text\x20configured');}this[_0x030b('0x32')][_0x030b('0x8d')](util[_0x030b('0x25')](_0x030b('0xf5'),_0x3b6b58[_0x030b('0x56')]));var _0x4703bd=this[_0x030b('0x63')][_0x030b('0x7d')](this,_0x3b6b58);if(_0x4703bd){this[_0x030b('0x32')]['noop'](util[_0x030b('0x25')]('aws\x20Polly\x20%s\x20file\x20created',_0x4703bd));var _0x26827e=this[_0x030b('0x32')][_0x030b('0xd1')](_0x4703bd);try{fs[_0x030b('0xd3')](_0x4703bd+_0x030b('0xd4'));}catch(_0x2ad2f0){logger[_0x030b('0x4a')](_0x2ad2f0);}return _0x26827e;}return this[_0x030b('0x32')]['error'](_0x3b6b58,_0x030b('0xf6'));};AGIVertices['prototype']['awslex']=function(_0x5d5bcf){logger[_0x030b('0x29')](util[_0x030b('0x25')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x5d5bcf[_0x030b('0x80')]));if(!this['isConfigured'](_0x5d5bcf[_0x030b('0xf4')])||!this[_0x030b('0x7b')](_0x5d5bcf[_0x030b('0x64')])){return this[_0x030b('0x32')]['noop'](_0x030b('0xf7'));}if(!this[_0x030b('0x7b')](_0x5d5bcf[_0x030b('0x6a')])){return this['channel'][_0x030b('0x8d')](_0x030b('0xf8'));}if(!this[_0x030b('0x7b')](_0x5d5bcf[_0x030b('0x56')])){return this[_0x030b('0x32')][_0x030b('0x8d')](_0x030b('0x96'));}this[_0x030b('0x32')]['bot']=!![];this[_0x030b('0x31')](_0x5d5bcf);this[_0x030b('0x3c')](_0x5d5bcf[_0x030b('0x56')],'in');this[_0x030b('0x32')][_0x030b('0x8d')](util['format'](_0x030b('0xf9'),_0x5d5bcf[_0x030b('0x56')]));var _0xa6c871=this['awsLex']['sync'](this,_0x5d5bcf);if(_0xa6c871){for(var _0x81c435 in _0xa6c871){if(_0xa6c871[_0x030b('0xcf')](_0x81c435)&&_[_0x030b('0x72')](_0xa6c871[_0x81c435])){this['channel'][_0x030b('0xb3')](util[_0x030b('0x25')](_0x030b('0xfa'),_0x81c435[_0x030b('0xc3')]()),_0xa6c871[_0x81c435]);}}if(_[_0x030b('0x3e')](_0xa6c871[_0x030b('0xfb')])){return this[_0x030b('0x32')]['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0xa6c871[_0x030b('0xfb')],_0x030b('0xc5'));return this[_0x030b('0x32')][_0x030b('0x8d')](util['format']('Amazon\x20Lex\x20Result\x20%s',_0xa6c871['message']));}}return this[_0x030b('0x32')][_0x030b('0x4a')](_0x5d5bcf,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x030b('0xe')][_0x030b('0xfc')]=function(_0x131ffd){logger['info'](util[_0x030b('0x25')](_0x030b('0xfd'),_0x131ffd[_0x030b('0x80')],_0x131ffd['timeout']));if(!this[_0x030b('0x7b')](_0x131ffd[_0x030b('0x59')])){return this[_0x030b('0x32')][_0x030b('0x8d')](_0x030b('0xc0'));}var _0x2f5ea9=_0x030b('0xfe');var _0x206195=util[_0x030b('0x25')](_0x030b('0xff'),FILES_PATH,rs[_0x030b('0xec')](0x4));var _0xc8982f=util[_0x030b('0x25')](_0x030b('0x100'),_0x206195,_0x2f5ea9);var _0x33eef7=!![];if(_0x131ffd[_0x030b('0x101')]==='NOBEEP'){_0x33eef7=![];}var _0x10c3b5=this['channel']['recordFile'](_0x206195,_0x2f5ea9,_0x131ffd['intKey'],_0x131ffd[_0x030b('0x84')],undefined,_0x33eef7);if(_0x10c3b5[_0x030b('0x91')]!==-0x1){this['channel'][_0x030b('0x8d')](util[_0x030b('0x25')](_0x030b('0x102'),_0xc8982f));var _0x2c6384=this['googleASR']['sync'](this,_0x131ffd,_0xc8982f);if(_0x2c6384){for(var _0x10c625 in _0x2c6384){if(_0x2c6384[_0x030b('0xcf')](_0x10c625)){this[_0x030b('0x32')][_0x030b('0xb3')](util[_0x030b('0x25')](_0x030b('0x103'),_0x10c625['toUpperCase']()),_0x2c6384[_0x10c625]);}}return this['channel']['noop'](util['format'](_0x030b('0x104'),JSON['stringify'](_0x2c6384)));}}return _0x10c3b5;};AGIVertices[_0x030b('0xe')]['tildeasr']=function(_0x433b18){logger[_0x030b('0x29')](util['format']('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x433b18[_0x030b('0x80')]));if(!this['isConfigured'](_0x433b18['appid'])){return this[_0x030b('0x32')][_0x030b('0x8d')](_0x030b('0x105'));}if(!this[_0x030b('0x7b')](_0x433b18['appsecret'])){return this[_0x030b('0x32')][_0x030b('0x8d')](_0x030b('0x106'));}var _0xdb9d4=_0x030b('0xfe');var _0x32fdbc=util[_0x030b('0x25')](_0x030b('0xff'),FILES_PATH,rs['generate'](0x4));var _0x3848a4=util['format'](_0x030b('0x100'),_0x32fdbc,_0xdb9d4);var _0x22afb7=!![];if(_0x433b18['beep']===_0x030b('0x107')){_0x22afb7=![];}var _0x11cb04=this['channel'][_0x030b('0x108')](_0x32fdbc,_0xdb9d4,_0x433b18[_0x030b('0x109')],_0x433b18[_0x030b('0x84')],undefined,_0x22afb7);if(_0x11cb04[_0x030b('0x91')]!==-0x1){this[_0x030b('0x32')][_0x030b('0x8d')](util[_0x030b('0x25')](_0x030b('0x10a'),_0x3848a4));var _0x348185=this[_0x030b('0x6d')][_0x030b('0x7d')](this,_0x433b18,_0x3848a4);if(_0x348185){for(var _0x8c7a95 in _0x348185){if(_0x348185['hasOwnProperty'](_0x8c7a95)){this[_0x030b('0x32')][_0x030b('0xb3')](util['format'](_0x030b('0x10b'),_0x8c7a95['toUpperCase']()),_0x348185[_0x8c7a95]);}}return this[_0x030b('0x32')][_0x030b('0x8d')](util[_0x030b('0x25')](_0x030b('0x10c'),JSON[_0x030b('0xe9')](_0x348185)));}}return _0x11cb04;};AGIVertices[_0x030b('0xe')][_0x030b('0x10d')]=function(_0x3d7651){logger[_0x030b('0x29')](util[_0x030b('0x25')](_0x030b('0x10e'),_0x3d7651[_0x030b('0x80')]));return this['channel']['continueAt'](_0x3d7651['context'],_0x3d7651[_0x030b('0x3a')],_0x3d7651[_0x030b('0x10f')]);};AGIVertices[_0x030b('0xe')]['gotoif']=function(_0x4365e5){logger[_0x030b('0x29')](util[_0x030b('0x25')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x4365e5[_0x030b('0x80')]));if(!this[_0x030b('0x7b')](_0x4365e5[_0x030b('0x110')])){return this['channel'][_0x030b('0x4a')](_0x4365e5,'no\x20condition\x20configured');}try{var _0x2106ea=eval(_0x4365e5['condition'])?_0x030b('0x111'):_0x030b('0x112');this[_0x030b('0x32')][_0x030b('0x8d')](util['format'](_0x030b('0x113'),_0x4365e5['condition'],_0x2106ea));return{'code':0xc8,'result':_0x2106ea};}catch(_0x52b5ab){return{'code':0xc8,'result':_0x030b('0x112')};}};AGIVertices[_0x030b('0xe')]['gotoiftime']=function(_0x553b16){logger[_0x030b('0x29')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x553b16['label']));if(!this[_0x030b('0x7b')](_0x553b16[_0x030b('0x114')])){return this[_0x030b('0x32')]['error'](_0x553b16,_0x030b('0x115'));}var _0x859cdf=this['getIntervals'][_0x030b('0x7d')](this,_0x553b16['interval_id']);if(!_0x859cdf){return this[_0x030b('0x32')][_0x030b('0x4a')](_0x553b16,'no\x20intervals\x20found');}for(var _0x3f6f1c=0x0;_0x3f6f1c<_0x859cdf[_0x030b('0x74')];_0x3f6f1c+=0x1){var _0x31e68f=this['channel'][_0x030b('0x76')](util[_0x030b('0x25')](_0x030b('0x116'),_0x859cdf[_0x3f6f1c]));if(_0x31e68f['result']===-0x1){return _0x31e68f;}logger[_0x030b('0x29')](util[_0x030b('0x25')](_0x030b('0x117'),_0x859cdf[_0x3f6f1c],_0x31e68f['extra']));if(_0x31e68f[_0x030b('0x7a')]===_0x030b('0x111')){logger[_0x030b('0x29')](util['format']('IFTIME\x20%s\x20%s',_0x859cdf[_0x3f6f1c],_0x030b('0x111')));this['channel'][_0x030b('0x8d')](util[_0x030b('0x25')]('IFTIME\x20%s\x20%s',_0x859cdf[_0x3f6f1c],_0x030b('0x111')));return{'code':0xc8,'result':_0x030b('0x111')};}else{logger[_0x030b('0x29')](util[_0x030b('0x25')](_0x030b('0x117'),_0x859cdf[_0x3f6f1c],_0x030b('0x112')));this['channel']['noop'](util[_0x030b('0x25')](_0x030b('0x117'),_0x859cdf[_0x3f6f1c],'false'));}}return{'code':0xc8,'result':_0x030b('0x112')};};AGIVertices[_0x030b('0xe')]['hangup']=function(_0x971d19){logger[_0x030b('0x29')](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x971d19[_0x030b('0x80')]));return this['channel'][_0x030b('0x118')]();};AGIVertices[_0x030b('0xe')]['ispeechasr']=function(_0x396ee1){logger[_0x030b('0x29')](util[_0x030b('0x25')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x396ee1[_0x030b('0x80')]));if(!this['isConfigured'](_0x396ee1[_0x030b('0x59')])){return this['channel']['noop'](_0x030b('0xc0'));}var _0x258f8e='wav';var _0xacb259=util[_0x030b('0x25')](_0x030b('0xff'),FILES_PATH,rs['generate'](0x4));var _0x24decc=util[_0x030b('0x25')](_0x030b('0x100'),_0xacb259,_0x258f8e);var _0x122c89=!![];if(_0x396ee1['beep']===_0x030b('0x107')){_0x122c89=![];}var _0x3f891b=this[_0x030b('0x32')][_0x030b('0x108')](_0xacb259,_0x258f8e,_0x396ee1['intKey'],_0x396ee1[_0x030b('0x84')],undefined,_0x122c89);if(_0x3f891b[_0x030b('0x91')]!==-0x1){this[_0x030b('0x32')][_0x030b('0x8d')](util[_0x030b('0x25')]('ispeech\x20%s\x20file\x20created',_0x24decc));var _0x1a5e89=this['ispeechASR']['sync'](this,_0x396ee1,_0x24decc);if(_0x1a5e89){for(var _0x370454 in _0x1a5e89){if(_0x1a5e89[_0x030b('0xcf')](_0x370454)){this['channel']['setVariable'](util[_0x030b('0x25')](_0x030b('0x119'),_0x370454['toUpperCase']()),_0x1a5e89[_0x370454]);}}return this[_0x030b('0x32')][_0x030b('0x8d')](util[_0x030b('0x25')]('IspeechASR\x20Result\x20%s',JSON[_0x030b('0xe9')](_0x1a5e89)));}}return _0x3f891b;};AGIVertices[_0x030b('0xe')][_0x030b('0x11a')]=function(_0x31537b){logger[_0x030b('0x29')](util[_0x030b('0x25')](_0x030b('0x11b'),_0x31537b[_0x030b('0x80')]));if(!this[_0x030b('0x7b')](_0x31537b[_0x030b('0x59')])){return this[_0x030b('0x32')][_0x030b('0x8d')](_0x030b('0xc0'));}if(!this[_0x030b('0x7b')](_0x31537b['text'])){return this['channel'][_0x030b('0x8d')](_0x030b('0x96'));}this[_0x030b('0x32')][_0x030b('0x8d')](util[_0x030b('0x25')](_0x030b('0x11c'),_0x31537b['text']));var _0xdc2a20=this[_0x030b('0x5c')][_0x030b('0x7d')](this,_0x31537b);if(_0xdc2a20){this['channel']['noop'](util['format'](_0x030b('0x11d'),_0xdc2a20));var _0x40aee9=this[_0x030b('0x32')][_0x030b('0xd1')](_0xdc2a20,_0x31537b[_0x030b('0x109')]);try{fs[_0x030b('0xd3')](_0xdc2a20+'.wav');}catch(_0x1c5672){logger[_0x030b('0x4a')](_0x1c5672);}return _0x40aee9;}return this['channel'][_0x030b('0x4a')](_0x31537b,_0x030b('0x11e'));};AGIVertices['prototype'][_0x030b('0x11f')]=function(_0x4a5eac){logger[_0x030b('0x29')](util[_0x030b('0x25')](_0x030b('0x120'),_0x4a5eac[_0x030b('0x80')]));if(!this[_0x030b('0x7b')](_0x4a5eac[_0x030b('0x121')])){return this[_0x030b('0x32')][_0x030b('0x4a')](_0x4a5eac,'no\x20find\x20by\x20configured');}logger[_0x030b('0x29')](util['format'](_0x030b('0x122'),this[_0x030b('0x32')][_0x030b('0x36')],_0x4a5eac[_0x030b('0x121')]));var _0x108130=this[_0x030b('0x4e')][_0x030b('0x7d')](this,_0x4a5eac[_0x030b('0x121')]);if(_0x108130){logger['info'](util[_0x030b('0x25')](_0x030b('0x123'),this[_0x030b('0x32')][_0x030b('0x36')],_0x4a5eac[_0x030b('0x121')]));this['channel']['noop'](util['format'](_0x030b('0x123'),this[_0x030b('0x32')][_0x030b('0x36')],_0x4a5eac[_0x030b('0x121')]));return{'code':0xc8,'result':_0x030b('0x124')};}else{logger[_0x030b('0x29')](util[_0x030b('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x030b('0x32')]['callerid'],_0x4a5eac[_0x030b('0x121')]));this[_0x030b('0x32')][_0x030b('0x8d')](util[_0x030b('0x25')](_0x030b('0x125'),this[_0x030b('0x32')][_0x030b('0x36')],_0x4a5eac[_0x030b('0x121')]));return{'code':0xc8,'result':_0x030b('0x126')};}};AGIVertices[_0x030b('0xe')][_0x030b('0x127')]=function(_0x358627){logger[_0x030b('0x29')](util[_0x030b('0x25')](_0x030b('0x128'),_0x358627['label']));if(!this['isConfigured'](_0x358627[_0x030b('0x121')])){return this[_0x030b('0x32')][_0x030b('0x4a')](_0x358627,_0x030b('0x129'));}logger['info'](util['format'](_0x030b('0x122'),this[_0x030b('0x32')][_0x030b('0x36')],_0x358627[_0x030b('0x121')]));var _0x25c580=this['agentLogout']['sync'](this,_0x358627[_0x030b('0x121')]);if(_0x25c580){logger[_0x030b('0x29')](util[_0x030b('0x25')](_0x030b('0x123'),this['channel'][_0x030b('0x36')],_0x358627[_0x030b('0x121')]));this[_0x030b('0x32')][_0x030b('0x8d')](util[_0x030b('0x25')](_0x030b('0x123'),this[_0x030b('0x32')][_0x030b('0x36')],_0x358627[_0x030b('0x121')]));return{'code':0xc8,'result':_0x030b('0x124')};}else{logger[_0x030b('0x29')](util['format'](_0x030b('0x125'),this[_0x030b('0x32')][_0x030b('0x36')],_0x358627['findBy']));this[_0x030b('0x32')][_0x030b('0x8d')](util[_0x030b('0x25')](_0x030b('0x125'),this['channel'][_0x030b('0x36')],_0x358627[_0x030b('0x121')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x030b('0xe')][_0x030b('0x12a')]=function(_0x3574b5){logger['info'](util[_0x030b('0x25')](_0x030b('0x12b'),_0x3574b5['label']));if(!this[_0x030b('0x7b')](_0x3574b5['operation'])){return this['channel']['error'](_0x3574b5,_0x030b('0x12c'));}this[_0x030b('0x32')]['noop'](util[_0x030b('0x25')](_0x030b('0x12d'),_0x3574b5[_0x030b('0x12e')]));var _0x518403=eval(_0x3574b5[_0x030b('0x12e')]);if(!this[_0x030b('0x7b')](_0x3574b5['variable_id'])){return this[_0x030b('0x32')][_0x030b('0x8d')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2ef513=this[_0x030b('0x76')]['sync'](this,_0x3574b5[_0x030b('0xaf')]);if(!_0x2ef513){return this[_0x030b('0x32')][_0x030b('0x4a')](_0x3574b5,_0x030b('0xb0'));}if(_['isArray'](_0x518403)){var _0x2b741f=this;_0x518403['forEach'](function(_0x475d17,_0x378fe9){_0x2b741f['channel'][_0x030b('0xb3')](util[_0x030b('0x25')](_0x030b('0x12f'),_0x2ef513,_0x378fe9),_0x475d17);});return this['channel'][_0x030b('0x8d')](util[_0x030b('0x25')](_0x030b('0x130'),_0x2ef513));}else{return this['channel'][_0x030b('0xb3')](_0x2ef513,_0x518403);}};AGIVertices[_0x030b('0xe')][_0x030b('0xa')]=function(_0x49e61c){logger[_0x030b('0x29')](util['format']('Enter\x20in\x20MENU\x20(%s)\x20block',_0x49e61c[_0x030b('0x80')]));if(_0x49e61c[_0x030b('0x7e')]===0x0){return this[_0x030b('0x7c')](_0x49e61c);}_0x49e61c['retry']-=0x1;if(!this[_0x030b('0x7b')](_0x49e61c[_0x030b('0xe2')])){return this['channel'][_0x030b('0x4a')](_0x49e61c,_0x030b('0xe3'));}var _0x4875f8=this[_0x030b('0xe4')]['sync'](this,_0x49e61c[_0x030b('0xe2')]);if(!_0x4875f8){return this[_0x030b('0x32')][_0x030b('0x4a')](_0x49e61c,'no\x20file\x20audio\x20found');}var _0xb36b2=this[_0x030b('0x32')]['getData'](_0x4875f8,_0x49e61c[_0x030b('0xe6')],_0x49e61c[_0x030b('0x131')]);var _0x3cc0e5=_0xb36b2[_0x030b('0x91')];if(_0xb36b2[_0x030b('0x91')]===-0x1){this['createSquareDetailsReport'][_0x030b('0x7d')](this,_0x49e61c,'-1');return _0xb36b2;}else if(_0xb36b2[_0x030b('0x7a')]===_0x030b('0x84')){_0xb36b2[_0x030b('0x91')]=_0xb36b2['result']['length']>0x0?_0xb36b2['result']:'t';}else if(_[_0x030b('0x41')](_0xb36b2[_0x030b('0x91')])){_0xb36b2[_0x030b('0x91')]='#';_0x3cc0e5='#';}if(!this[_0x030b('0x7b')](_0x49e61c[_0x030b('0xaf')])){this[_0x030b('0x32')][_0x030b('0x8d')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x541977=this['getVariable'][_0x030b('0x7d')](this,_0x49e61c[_0x030b('0xaf')]);if(!_0x541977){return this[_0x030b('0x32')][_0x030b('0x4a')](_0x49e61c,_0x030b('0xb0'));}this[_0x030b('0x32')][_0x030b('0xb3')](_0x541977,_0x3cc0e5);}this[_0x030b('0x31')][_0x030b('0x7d')](this,_0x49e61c,_0x3cc0e5);return _0xb36b2;};AGIVertices['prototype'][_0x030b('0x8d')]=function(_0x4424b5){logger['info'](util[_0x030b('0x25')](_0x030b('0x132'),_0x4424b5['label']));return this[_0x030b('0x32')][_0x030b('0x8d')](_0x4424b5[_0x030b('0x133')]||_0x4424b5[_0x030b('0x80')]);};AGIVertices[_0x030b('0xe')][_0x030b('0x134')]=function(_0x4868fb){logger[_0x030b('0x29')](util['format'](_0x030b('0x135'),_0x4868fb['label']));if(!this[_0x030b('0x7b')](_0x4868fb[_0x030b('0x121')])){return this[_0x030b('0x32')][_0x030b('0x4a')](_0x4868fb,'no\x20find\x20by\x20configured');}logger['info'](util[_0x030b('0x25')](_0x030b('0x122'),this['channel'][_0x030b('0x36')],_0x4868fb[_0x030b('0x121')]));var _0x4e59eb=this[_0x030b('0x48')][_0x030b('0x7d')](this,_0x4868fb['pause_id']);var _0x4a7854=this[_0x030b('0x49')][_0x030b('0x7d')](this,_0x4868fb[_0x030b('0x121')],_0x4e59eb);if(_0x4a7854){logger[_0x030b('0x29')](util['format'](_0x030b('0x123'),this[_0x030b('0x32')][_0x030b('0x36')],_0x4868fb[_0x030b('0x121')]));this[_0x030b('0x32')]['noop'](util[_0x030b('0x25')](_0x030b('0x123'),this[_0x030b('0x32')][_0x030b('0x36')],_0x4868fb[_0x030b('0x121')]));return{'code':0xc8,'result':'success'};}else{logger[_0x030b('0x29')](util[_0x030b('0x25')](_0x030b('0x125'),this['channel']['callerid'],_0x4868fb['findBy']));this[_0x030b('0x32')][_0x030b('0x8d')](util[_0x030b('0x25')](_0x030b('0x123'),this[_0x030b('0x32')][_0x030b('0x36')],_0x4868fb[_0x030b('0x121')]));return{'code':0xc8,'result':_0x030b('0x126')};}};AGIVertices['prototype'][_0x030b('0x136')]=function(_0x4180fd){logger[_0x030b('0x29')](util[_0x030b('0x25')](_0x030b('0x137'),_0x4180fd['label']));if(!this[_0x030b('0x7b')](_0x4180fd[_0x030b('0xe2')])){return this['channel'][_0x030b('0x4a')](_0x4180fd,'no\x20file\x20audio\x20selected');}var _0x5bcce4=this[_0x030b('0xe4')]['sync'](this,_0x4180fd[_0x030b('0xe2')]);if(!_0x5bcce4){return this[_0x030b('0x32')][_0x030b('0x4a')](_0x4180fd,'no\x20file\x20audio\x20found');}var _0x5cafaa=this[_0x030b('0x32')][_0x030b('0x53')](_0x030b('0x138'),[_0x5bcce4,_0x4180fd[_0x030b('0xde')]]);if(_0x5cafaa[_0x030b('0x91')]===-0x1){return _0x5cafaa;}return this['channel']['noop'](util['format']('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x5bcce4));};AGIVertices[_0x030b('0xe')][_0x030b('0x139')]=function(_0x53e325){logger[_0x030b('0x29')](util['format'](_0x030b('0x13a'),_0x53e325['label']));if(!this[_0x030b('0x7b')](_0x53e325[_0x030b('0x13b')])){return this[_0x030b('0x32')][_0x030b('0x4a')](_0x53e325,'no\x20queue\x20selected');}var _0x3edcb1='';var _0x2e97ca=parseInt(_0x53e325[_0x030b('0x13b')],0xa);if(isNaN(_0x2e97ca)){_0x3edcb1=_0x53e325[_0x030b('0x13b')];}else{_0x3edcb1=this[_0x030b('0x11')]['sync'](this,_0x53e325[_0x030b('0x13b')]);if(!_0x3edcb1){return this[_0x030b('0x32')][_0x030b('0x4a')](_0x53e325,_0x030b('0x13c'));}}var _0x52b595='';if(this[_0x030b('0x7b')](_0x53e325[_0x030b('0xe2')])){var _0x210553=this[_0x030b('0xe4')][_0x030b('0x7d')](this,_0x53e325[_0x030b('0xe2')]);if(_0x210553){_0x52b595=_0x210553;}}this['createSquareDetailsReport']['sync'](this,_0x53e325,_0x3edcb1);if(_0x53e325['opts'][_0x030b('0x13d')]('x')<0x0){_0x53e325[_0x030b('0xde')]+='x';}if(_0x53e325['opts'][_0x030b('0x13d')]('X')<0x0){_0x53e325[_0x030b('0xde')]+='X';}this[_0x030b('0x32')][_0x030b('0xb3')]('XMCS-QUEUE',_0x3edcb1?_0x3edcb1['toLowerCase']():'');var _0x16d5d7=this[_0x030b('0x32')]['exec'](_0x030b('0x13e'),[_0x3edcb1,_0x53e325[_0x030b('0xde')],_0x53e325['url'],_0x52b595,_0x53e325[_0x030b('0x84')],_0x53e325['agi'],_0x53e325[_0x030b('0x13f')],_0x53e325[_0x030b('0x140')],'',_0x53e325[_0x030b('0x141')]]);if(_0x16d5d7['result']===-0x1){return _0x16d5d7;}return this[_0x030b('0x32')][_0x030b('0x8d')](util['format'](_0x030b('0x92'),_0x030b('0x13e'),_0x3edcb1));};AGIVertices[_0x030b('0xe')]['record']=function(_0x571a5e){logger[_0x030b('0x29')](util[_0x030b('0x25')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x571a5e[_0x030b('0x80')]));var _0x37dc5a=_0x571a5e[_0x030b('0x142')]||_0x030b('0xfe');var _0x5799eb=util[_0x030b('0x25')](_0x030b('0x143'),this[_0x030b('0x32')][_0x030b('0x33')],rs[_0x030b('0xec')](0x5));var _0x424fdf=util[_0x030b('0x25')](_0x030b('0x144'),FILES_PATH,_0x5799eb,_0x37dc5a);var _0x78ff7c=util[_0x030b('0x25')](_0x030b('0xff'),FILES_PATH,_0x5799eb);this[_0x030b('0x37')][_0x030b('0x7d')](this,_0x571a5e,_0x5799eb,_0x424fdf);this['channel']['setVariable'](_0x030b('0x145'),_0x5799eb);logger[_0x030b('0x29')](_0x030b('0x146'),_0x78ff7c,_0x37dc5a,_0x571a5e[_0x030b('0x147')],_0x571a5e[_0x030b('0x84')]);return this['channel'][_0x030b('0x108')](_0x78ff7c,_0x37dc5a,_0x571a5e[_0x030b('0x147')],_0x571a5e[_0x030b('0x84')],undefined,!![]);};AGIVertices[_0x030b('0xe')][_0x030b('0x148')]=function(_0x4122f9){logger[_0x030b('0x29')](util[_0x030b('0x25')](_0x030b('0x149'),_0x4122f9[_0x030b('0x80')]));return this['channel'][_0x030b('0x14a')](_0x4122f9[_0x030b('0x14b')][_0x030b('0x54')](/\s+/g,''),_0x4122f9[_0x030b('0x147')]);};AGIVertices[_0x030b('0xe')][_0x030b('0x14c')]=function(_0x1608f7){logger[_0x030b('0x29')](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x1608f7[_0x030b('0x80')]));return this['channel'][_0x030b('0x14d')](_0x1608f7['number'][_0x030b('0x54')](/\s+/g,''),_0x1608f7[_0x030b('0x147')]);};AGIVertices[_0x030b('0xe')][_0x030b('0x14e')]=function(_0x3127ff){logger[_0x030b('0x29')](util[_0x030b('0x25')](_0x030b('0x14f'),_0x3127ff[_0x030b('0x80')]));return this[_0x030b('0x32')][_0x030b('0x150')](_0x3127ff[_0x030b('0x56')],_0x3127ff[_0x030b('0x147')]);};AGIVertices['prototype'][_0x030b('0x151')]=function(_0x9c63cf){logger[_0x030b('0x29')](util['format'](_0x030b('0x152'),_0x9c63cf['label']));if(!this[_0x030b('0x7b')](_0x9c63cf[_0x030b('0x153')])){return this[_0x030b('0x32')][_0x030b('0x8d')](_0x030b('0x154'));}var _0x1290e1=this[_0x030b('0x1d')]['sync'](this,_0x9c63cf[_0x030b('0x153')]);if(!_0x1290e1||!_0x1290e1['Smtp']){return this[_0x030b('0x32')][_0x030b('0x4a')](_0x9c63cf,_0x030b('0x155'));}var _0x1c607f={'from':util[_0x030b('0x25')](_0x030b('0x156'),_0x1290e1[_0x030b('0x15')],_0x1290e1[_0x030b('0x157')]||_0x1290e1[_0x030b('0x158')][_0x030b('0x159')]),'to':_0x9c63cf['to']||'','cc':_0x9c63cf['cc']||'','bcc':_0x9c63cf[_0x030b('0x15a')]||'','subject':_0x9c63cf[_0x030b('0x15b')],'html':_0x9c63cf[_0x030b('0x56')],'text':_0x9c63cf[_0x030b('0x56')]};var _0x164283={'tls':{'rejectUnauthorized':![]}};if(_0x1290e1[_0x030b('0x158')][_0x030b('0x15c')]){_0x164283[_0x030b('0x15c')]=_0x1290e1[_0x030b('0x158')][_0x030b('0x15c')];}else{_0x164283[_0x030b('0x15d')]=_0x1290e1[_0x030b('0x158')][_0x030b('0x15d')];_0x164283[_0x030b('0x15e')]=_0x1290e1[_0x030b('0x158')][_0x030b('0x15e')];_0x164283[_0x030b('0x15f')]=_0x1290e1[_0x030b('0x158')][_0x030b('0x15f')];}if(_0x1290e1[_0x030b('0x158')][_0x030b('0x160')]){_0x164283[_0x030b('0x161')]={'user':_0x1290e1[_0x030b('0x158')][_0x030b('0x159')],'pass':_0x1290e1[_0x030b('0x158')][_0x030b('0x162')]};}if(this['isConfigured'](_0x9c63cf[_0x030b('0x163')])){}logger[_0x030b('0x164')](_0x030b('0x165'),JSON[_0x030b('0xe9')](_0x1c607f));this[_0x030b('0x31')]['sync'](this,_0x9c63cf,_0x9c63cf['account_id']);this[_0x030b('0x32')]['noop'](util[_0x030b('0x25')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x1290e1[_0x030b('0x15')]));this[_0x030b('0x1f')]['sync'](this,_0x164283,_0x1c607f);return this[_0x030b('0x32')]['noop'](_0x030b('0x166'));};AGIVertices[_0x030b('0xe')][_0x030b('0x167')]=function(_0x5e7153){logger[_0x030b('0x29')](util[_0x030b('0x25')](_0x030b('0x168'),_0x5e7153[_0x030b('0x80')]));return this[_0x030b('0x32')]['noop'](_0x030b('0x169'));};AGIVertices[_0x030b('0xe')][_0x030b('0x16a')]=function(_0x5d39f9){logger[_0x030b('0x29')](util[_0x030b('0x25')](_0x030b('0x16b'),_0x5d39f9[_0x030b('0x80')]));if(!this[_0x030b('0x7b')](_0x5d39f9[_0x030b('0x16c')])){return this[_0x030b('0x32')]['noop'](_0x030b('0x16d'));}var _0x4c1099=this[_0x030b('0x2e')]['sync'](this,_0x5d39f9[_0x030b('0x16c')]);if(!_0x4c1099){return this['channel'][_0x030b('0x4a')](_0x5d39f9,_0x030b('0x16e'));}var _0x175968={'body':_0x5d39f9[_0x030b('0x16f')],'phone':_0x5d39f9['to']||'','SmsAccountId':_0x4c1099['id']};logger[_0x030b('0x164')](_0x030b('0x170'),JSON[_0x030b('0xe9')](_0x175968));this[_0x030b('0x31')][_0x030b('0x7d')](this,_0x5d39f9,_0x5d39f9[_0x030b('0x16c')]);this[_0x030b('0x32')]['noop'](util[_0x030b('0x25')](_0x030b('0x171'),_0x4c1099['name']));this[_0x030b('0x30')][_0x030b('0x7d')](this,_0x175968);return this['channel'][_0x030b('0x8d')](_0x030b('0x172'));};AGIVertices[_0x030b('0xe')][_0x030b('0x173')]=function(_0x51bf8c){logger[_0x030b('0x29')](util['format'](_0x030b('0x174'),_0x51bf8c[_0x030b('0x80')]));if(!this[_0x030b('0x7b')](_0x51bf8c['variable_id'])){return this['channel'][_0x030b('0x4a')](_0x51bf8c,_0x030b('0x175'));}var _0x21b840=this[_0x030b('0x76')][_0x030b('0x7d')](this,_0x51bf8c[_0x030b('0xaf')]);if(!_0x21b840){return this[_0x030b('0x32')][_0x030b('0x4a')](_0x51bf8c,_0x030b('0xb0'));}return this[_0x030b('0x32')][_0x030b('0xb3')](_0x21b840,_0x51bf8c[_0x030b('0x176')]);};AGIVertices[_0x030b('0xe')][_0x030b('0x177')]=function(_0xeda96c){logger[_0x030b('0x29')](util[_0x030b('0x25')]('Enter\x20in\x20START\x20(%s)\x20block',_0xeda96c[_0x030b('0x80')]));this[_0x030b('0x32')]['noop'](_0x030b('0x178'));if(_0xeda96c['answer']==='yes'){this[_0x030b('0x32')][_0x030b('0x8d')](_0x030b('0x179'));return this[_0x030b('0x32')][_0x030b('0x83')]();}return this['channel'][_0x030b('0x8d')]('Skipped\x20Answer');};AGIVertices[_0x030b('0xe')][_0x030b('0x17a')]=function(_0x1bf469){logger[_0x030b('0x29')](util[_0x030b('0x25')](_0x030b('0x17b'),_0x1bf469['label']));if(!this['isConfigured'](_0x1bf469[_0x030b('0x17c')])){return this[_0x030b('0x32')]['error'](_0x1bf469,_0x030b('0x17d'));}var _0x4ec70d=this[_0x030b('0x13')][_0x030b('0x7d')](this,_0x1bf469[_0x030b('0x17c')]);if(!this[_0x030b('0x7b')](_0x4ec70d)){return this['channel']['error'](_0x1bf469,util[_0x030b('0x25')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x1bf469['project_id']));}if(_0x4ec70d===this[_0x030b('0x32')]['arg_1']){return this[_0x030b('0x32')][_0x030b('0x4a')](_0x1bf469,_0x030b('0x17e'));}this['createSquareDetailsReport'][_0x030b('0x7d')](this,_0x1bf469,_0x4ec70d);var _0xc5a8ab=this['channel']['exec'](_0x030b('0x17f'),util[_0x030b('0x25')](_0x030b('0x180'),config[_0x030b('0x7')][_0x030b('0x15d')]||_0x030b('0x181'),_0x4ec70d,this[_0x030b('0x32')][_0x030b('0x35')]));if(_0xc5a8ab[_0x030b('0x91')]===-0x1){return _0xc5a8ab;}return this[_0x030b('0x32')][_0x030b('0x8d')](util[_0x030b('0x25')](_0x030b('0x92'),'AGI',_0x4ec70d));};AGIVertices[_0x030b('0xe')]['system']=function(_0x21be03){logger[_0x030b('0x29')](util[_0x030b('0x25')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x21be03[_0x030b('0x80')]));var _0x182ea3=this[_0x030b('0x52')][_0x030b('0x7d')](this,_0x21be03['command']);this[_0x030b('0x31')]['sync'](this,_0x21be03,_0x21be03[_0x030b('0x81')]);if(this[_0x030b('0x7b')](_0x21be03[_0x030b('0xaf')])){var _0x1230a5=this[_0x030b('0x76')][_0x030b('0x7d')](this,_0x21be03[_0x030b('0xaf')]);if(_0x1230a5){this['channel']['setVariable'](_0x1230a5,_0x182ea3);return this[_0x030b('0x32')]['noop'](util[_0x030b('0x25')](_0x030b('0x182'),_0x21be03[_0x030b('0x81')],_0x1230a5));}}return this[_0x030b('0x32')]['noop'](util['format'](_0x030b('0x183'),_0x21be03['command']));};AGIVertices[_0x030b('0xe')][_0x030b('0x184')]=function(_0x2307b2){logger[_0x030b('0x29')](util[_0x030b('0x25')](_0x030b('0x185'),_0x2307b2['label']));if(!this[_0x030b('0x7b')](_0x2307b2['text'])){return this[_0x030b('0x32')][_0x030b('0x8d')](_0x030b('0x96'));}this['channel']['noop'](util[_0x030b('0x25')](_0x030b('0x186'),_0x2307b2[_0x030b('0x56')]));var _0x331c50=this[_0x030b('0x55')][_0x030b('0x7d')](this,_0x2307b2);if(_0x331c50){this[_0x030b('0x32')][_0x030b('0x8d')](util['format'](_0x030b('0x187'),_0x331c50));var _0x59866c=this['channel']['streamFile'](_0x331c50);try{fs['unlink'](_0x331c50+'.wav');}catch(_0x4b6634){logger['error'](_0x4b6634);}return _0x59866c;}return this[_0x030b('0x32')]['error'](_0x2307b2,_0x030b('0x188'));};AGIVertices['prototype'][_0x030b('0x189')]=function(_0x565e26){logger[_0x030b('0x29')](util[_0x030b('0x25')](_0x030b('0x18a'),_0x565e26[_0x030b('0x80')]));if(!this[_0x030b('0x7b')](_0x565e26[_0x030b('0x121')])){return this[_0x030b('0x32')][_0x030b('0x4a')](_0x565e26,_0x030b('0x129'));}logger[_0x030b('0x29')](util[_0x030b('0x25')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x565e26[_0x030b('0x121')]));var _0x2f5577=this['agentUnpause'][_0x030b('0x7d')](this,_0x565e26[_0x030b('0x121')]);if(_0x2f5577){logger[_0x030b('0x29')](util[_0x030b('0x25')](_0x030b('0x123'),this['channel']['callerid'],_0x565e26[_0x030b('0x121')]));this[_0x030b('0x32')][_0x030b('0x8d')](util[_0x030b('0x25')](_0x030b('0x123'),this['channel'][_0x030b('0x36')],_0x565e26[_0x030b('0x121')]));return{'code':0xc8,'result':_0x030b('0x124')};}else{logger[_0x030b('0x29')](util['format'](_0x030b('0x125'),this[_0x030b('0x32')][_0x030b('0x36')],_0x565e26['findBy']));this[_0x030b('0x32')][_0x030b('0x8d')](util['format'](_0x030b('0x125'),this[_0x030b('0x32')][_0x030b('0x36')],_0x565e26[_0x030b('0x121')]));return{'code':0xc8,'result':_0x030b('0x126')};}};AGIVertices['prototype'][_0x030b('0x18b')]=function(_0x17d9b5){logger[_0x030b('0x29')](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x17d9b5[_0x030b('0x80')]));var _0xa98fe9=this[_0x030b('0x32')][_0x030b('0x53')](_0x030b('0x18c'),[_0x17d9b5['mailbox'],_0x17d9b5[_0x030b('0x90')]]);if(_0xa98fe9[_0x030b('0x91')]===-0x1){return _0xa98fe9;}return this['channel'][_0x030b('0x8d')](util[_0x030b('0x25')](_0x030b('0x92'),_0x030b('0x18c'),_0x17d9b5[_0x030b('0x18d')]));};AGIVertices[_0x030b('0xe')][_0x030b('0x18e')]=function(_0x40345d){logger['info'](util[_0x030b('0x25')](_0x030b('0x18f'),_0x40345d[_0x030b('0x80')]));if(!this[_0x030b('0x7b')](_0x40345d[_0x030b('0xaf')])){return this[_0x030b('0x32')][_0x030b('0x4a')](_0x40345d,'no\x20variable\x20selected');}var _0x49199c=this[_0x030b('0x76')][_0x030b('0x7d')](this,_0x40345d[_0x030b('0xaf')]);if(!_0x49199c){return this[_0x030b('0x32')]['error'](_0x40345d,_0x030b('0xb0'));}var _0x1408bf=this[_0x030b('0x32')][_0x030b('0x76')](_0x49199c);return{'code':0xc8,'result':_0x1408bf[_0x030b('0x7a')]?_0x1408bf[_0x030b('0x7a')]:'-'};};String[_0x030b('0xe')][_0x030b('0x75')]=function(_0x464162,_0x43c98a){return this[_0x030b('0x73')](_0x464162)[_0x030b('0x190')](_0x43c98a);};module[_0x030b('0x191')]=AGIVertices;
\ No newline at end of file
index 3c28194..5c58d72 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdefb=['transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','channels','bind','syncHangupRequest','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','lastPauseAt','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','stopAcw','[TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','syncAgentConnect','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','prototype','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','attended','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid'];(function(_0x2c18a8,_0x24eaa5){var _0x1e009a=function(_0x5dea3a){while(--_0x5dea3a){_0x2c18a8['push'](_0x2c18a8['shift']());}};_0x1e009a(++_0x24eaa5);}(_0xdefb,0x154));var _0xbdef=function(_0x48fefe,_0x341c3f){_0x48fefe=_0x48fefe-0x0;var _0x5dd63b=_0xdefb[_0x48fefe];return _0x5dd63b;};'use strict';var util=require(_0xbdef('0x0'));var _=require(_0xbdef('0x1'));var moment=require('moment');var ami=require(_0xbdef('0x2'));var logger=require(_0xbdef('0x3'))(_0xbdef('0x4'));var RpcUser=require(_0xbdef('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x470b39){this[_0xbdef('0x6')]=_0x470b39[_0xbdef('0x6')];this[_0xbdef('0x7')]=_0x470b39[_0xbdef('0x7')];this[_0xbdef('0x8')]=_0x470b39['timers'];this[_0xbdef('0x9')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0xbdef('0xa')](this));ami['on']('hanguprequest',this[_0xbdef('0xb')][_0xbdef('0xa')](this));ami['on'](_0xbdef('0xc'),this[_0xbdef('0xd')][_0xbdef('0xa')](this));ami['on']('agentringnoanswer',this[_0xbdef('0xe')][_0xbdef('0xa')](this));ami['on'](_0xbdef('0xf'),this[_0xbdef('0x10')]['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer']['bind'](this));ami['on']('custom:agentConnectPreview',this[_0xbdef('0x11')][_0xbdef('0xa')](this));}function getDiff(_0x31b264){var _0x35ebf9=moment()['milliseconds'](0x0);var _0x408f37=moment(_0x31b264)[_0xbdef('0x12')](0x0);return _0x35ebf9[_0xbdef('0x13')](_0x408f37,_0xbdef('0x14'));}Acw['prototype'][_0xbdef('0x15')]=function(_0x273b0b){try{var _0x5f4545=this;var _0xb2fb9b=this[_0xbdef('0x9')][_0x273b0b][_0xbdef('0x16')];var _0x1b3e2b=this[_0xbdef('0x9')][_0x273b0b][_0xbdef('0x17')];var _0x4e5536=this[_0xbdef('0x6')][_0x1b3e2b];var _0x468016=![];var _0x57424f=_0xbdef('0x18');if(_0x4e5536[_0xbdef('0x19')]){if(_0x4e5536[_0xbdef('0x1a')][_0xbdef('0x1b')]){_0x468016=!![];_0x57424f=_0x4e5536[_0xbdef('0x1a')][_0xbdef('0x1b')];}}ami['Action']({'action':'QueuePause','interface':_0xb2fb9b,'paused':!![],'reason':_0x57424f})[_0xbdef('0x1c')](function(_0x2a479f){if(_0x5f4545[_0xbdef('0x7')][_0xb2fb9b]){return RpcUser[_0xbdef('0x1d')](_0x5f4545[_0xbdef('0x7')][_0xb2fb9b]['id'])[_0xbdef('0x1c')](function(_0x14aac8){if(_0x14aac8&&!_0x14aac8[_0xbdef('0x1e')]){logger[_0xbdef('0x1f')](_0xbdef('0x20'),_0x273b0b,_0xb2fb9b,_0x1b3e2b);return RpcUser[_0xbdef('0x21')](_0x5f4545[_0xbdef('0x7')][_0xb2fb9b],_0x57424f,_0x273b0b)[_0xbdef('0x1c')](function(_0x4889d5){if(!_0x468016){_0x5f4545[_0xbdef('0x8')][_0xb2fb9b]={};logger['info'](_0xbdef('0x22'),_0x273b0b,_0x5f4545['voiceQueues'][_0x1b3e2b][_0xbdef('0x23')],_0xb2fb9b,_0x1b3e2b);_0x5f4545['timers'][_0xb2fb9b][_0xbdef('0x24')]=setTimeout(_0x5f4545['stopAcw'][_0xbdef('0xa')](_0x5f4545,_0xb2fb9b),_0x5f4545['voiceQueues'][_0x1b3e2b][_0xbdef('0x23')]*0x3e8);_0x5f4545['timers'][_0xb2fb9b][_0xbdef('0x25')]=_0x4889d5[_0xbdef('0x25')];_0x5f4545[_0xbdef('0x8')][_0xb2fb9b][_0xbdef('0x26')]=_0x273b0b;_0x5f4545['timers'][_0xb2fb9b][_0xbdef('0x17')]=_0x1b3e2b;_0x5f4545[_0xbdef('0x8')][_0xb2fb9b][_0xbdef('0x27')]=function(){var _0x474dfc=getDiff(_0x5f4545[_0xbdef('0x8')][_0xb2fb9b][_0xbdef('0x25')]);clearTimeout(_0x5f4545[_0xbdef('0x8')][_0xb2fb9b][_0xbdef('0x24')]);RpcVoiceAgentReport[_0xbdef('0x28')]({'acwtime':_0x474dfc},_0x5f4545[_0xbdef('0x8')][_0xb2fb9b][_0xbdef('0x26')],_0xb2fb9b)['then'](function(_0x751299){logger[_0xbdef('0x1f')](_0xbdef('0x29'),_0x273b0b,_0x474dfc,_0x751299);})[_0xbdef('0x2a')](function(_0x259e15){logger[_0xbdef('0x2b')]('[%s][UPDATE][ERRORS:%s]',_0x273b0b,_0x259e15);});delete _0x5f4545[_0xbdef('0x8')][_0xb2fb9b];};}});}else{logger['info'](_0xbdef('0x2c'),_0x273b0b,_0xb2fb9b,_0x1b3e2b);}});}})[_0xbdef('0x2a')](function(_0x3c61d6){logger[_0xbdef('0x2b')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x273b0b,_0x5f4545[_0xbdef('0x6')][_0x1b3e2b]['acwTimeout'],_0xb2fb9b,_0x1b3e2b);})[_0xbdef('0x2d')](function(){delete _0x5f4545[_0xbdef('0x9')][_0x273b0b];});}catch(_0x4af7ae){logger[_0xbdef('0x2b')](_0xbdef('0x2e'),_0x4af7ae['message']);}};Acw['prototype'][_0xbdef('0x2f')]=function(_0x361752){try{var _0x5ad843=this;if(_0x5ad843[_0xbdef('0x8')][_0x361752]){var _0x1fbc34=_0x5ad843['timers'][_0x361752][_0xbdef('0x26')];var _0x55f1aa=_0x5ad843[_0xbdef('0x8')][_0x361752][_0xbdef('0x17')];var _0x43b0d3=_0x5ad843[_0xbdef('0x6')][_0x55f1aa]['acwTimeout'];logger[_0xbdef('0x1f')](_0xbdef('0x30'),_0x361752);RpcUser[_0xbdef('0x31')](this[_0xbdef('0x7')][_0x361752]);RpcVoiceAgentReport[_0xbdef('0x28')]({'acwtime':_0x43b0d3,'agentacw':!![]},_0x1fbc34,_0x361752)['then'](function(_0x7596b7){logger[_0xbdef('0x1f')]('[%s][UPDATE][ACWTIME:%s]',_0x1fbc34,_0x43b0d3,_0x7596b7);})[_0xbdef('0x2a')](function(_0x187c3a){logger['error'](_0xbdef('0x32'),_0x1fbc34,_0x187c3a);});}else{logger[_0xbdef('0x2b')](_0xbdef('0x33'),_0x361752);if(_0x5ad843[_0xbdef('0x8')]){logger[_0xbdef('0x1f')](_0xbdef('0x34'),JSON[_0xbdef('0x35')](_0x5ad843[_0xbdef('0x8')]));}}}catch(_0x2840a1){logger[_0xbdef('0x2b')](_0xbdef('0x36'),_0x2840a1[_0xbdef('0x37')]);}};Acw['prototype'][_0xbdef('0x38')]=function(_0x20a63e){try{if(this[_0xbdef('0x6')][_0x20a63e['queue']]&&(this[_0xbdef('0x6')][_0x20a63e[_0xbdef('0x17')]]['acw']||this[_0xbdef('0x6')][_0x20a63e[_0xbdef('0x17')]]['mandatoryDisposition'])){if(this[_0xbdef('0x7')][_0x20a63e['interface']]){this[_0xbdef('0x9')][_0x20a63e[_0xbdef('0x26')]]={'queue':_0x20a63e['queue'],'interface':_0x20a63e['interface']};}}}catch(_0x50d2a0){logger['error'](_0xbdef('0x39'),_0x50d2a0[_0xbdef('0x37')]);}};Acw['prototype'][_0xbdef('0x11')]=function(_0x4936db){try{if(this[_0xbdef('0x6')][_0x4936db[_0xbdef('0x17')]]&&(this[_0xbdef('0x6')][_0x4936db[_0xbdef('0x17')]]['acw']||this[_0xbdef('0x6')][_0x4936db[_0xbdef('0x17')]][_0xbdef('0x19')])){if(this['agents'][_0x4936db[_0xbdef('0x16')]]){this['channels'][_0x4936db['uniqueid']]={'queue':_0x4936db['queue'],'interface':_0x4936db['interface']};}}}catch(_0x243720){logger['error'](_0xbdef('0x3a'),_0x243720[_0xbdef('0x37')]);}};Acw[_0xbdef('0x3b')][_0xbdef('0xb')]=function(_0x21d6d2){try{if(this['channels'][_0x21d6d2['uniqueid']]&&_[_0xbdef('0x3c')](this[_0xbdef('0x9')][_0x21d6d2[_0xbdef('0x26')]]['attended'])){logger[_0xbdef('0x1f')](_0xbdef('0x3d'),_0x21d6d2[_0xbdef('0x26')]);this[_0xbdef('0x15')](_0x21d6d2[_0xbdef('0x26')]);}else if(this[_0xbdef('0x9')][_0x21d6d2[_0xbdef('0x3e')]]&&_[_0xbdef('0x3c')](this[_0xbdef('0x9')][_0x21d6d2[_0xbdef('0x3e')]][_0xbdef('0x3f')])){logger[_0xbdef('0x1f')]('[%s][HANGUP:LINKEDID]',_0x21d6d2[_0xbdef('0x3e')]);this[_0xbdef('0x15')](_0x21d6d2[_0xbdef('0x3e')]);}}catch(_0x524a67){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x524a67['message']);}};Acw['prototype'][_0xbdef('0xd')]=function(_0x399474){try{if(this[_0xbdef('0x9')][_0x399474[_0xbdef('0x26')]]&&this[_0xbdef('0x9')][_0x399474[_0xbdef('0x26')]]['attended']){logger['info'](_0xbdef('0x40'),_0x399474[_0xbdef('0x26')]);this[_0xbdef('0x15')](_0x399474[_0xbdef('0x26')]);}else if(this[_0xbdef('0x9')][_0x399474[_0xbdef('0x3e')]]&&this[_0xbdef('0x9')][_0x399474[_0xbdef('0x3e')]][_0xbdef('0x3f')]){logger[_0xbdef('0x1f')](_0xbdef('0x41'),_0x399474[_0xbdef('0x3e')]);this[_0xbdef('0x15')](_0x399474[_0xbdef('0x3e')]);}}catch(_0x250e14){logger[_0xbdef('0x2b')](_0xbdef('0x42'),_0x250e14[_0xbdef('0x37')]);}};Acw[_0xbdef('0x3b')][_0xbdef('0x10')]=function(_0x41fa6c){try{if(!_[_0xbdef('0x43')](this['channels'][_0x41fa6c[_0xbdef('0x44')]])){this[_0xbdef('0x15')](_0x41fa6c['transfereeuniqueid']);if(this[_0xbdef('0x9')][_0x41fa6c[_0xbdef('0x45')]]){this[_0xbdef('0x9')][_0x41fa6c[_0xbdef('0x45')]][_0xbdef('0x3f')]=!![];this[_0xbdef('0x9')][_0x41fa6c['transfertargetuniqueid']]=this[_0xbdef('0x9')][_0x41fa6c[_0xbdef('0x45')]];delete this[_0xbdef('0x9')][_0x41fa6c[_0xbdef('0x45')]];}}else if(!_[_0xbdef('0x43')](this[_0xbdef('0x9')][_0x41fa6c[_0xbdef('0x46')]])){this[_0xbdef('0x15')](_0x41fa6c[_0xbdef('0x46')]);if(this[_0xbdef('0x9')][_0x41fa6c[_0xbdef('0x47')]]){this[_0xbdef('0x9')][_0x41fa6c['origtransfereruniqueid']][_0xbdef('0x3f')]=!![];this[_0xbdef('0x9')][_0x41fa6c['transfereeuniqueid']]=this['channels'][_0x41fa6c[_0xbdef('0x47')]];delete this[_0xbdef('0x9')][_0x41fa6c['origtransfereruniqueid']];}}}catch(_0x5b152f){logger[_0xbdef('0x2b')](_0xbdef('0x48'),_0x5b152f[_0xbdef('0x37')]);}};Acw['prototype']['syncBlindTransfer']=function(_0xe8090c){try{if(this[_0xbdef('0x9')][_0xe8090c['transfereruniqueid']]){logger[_0xbdef('0x1f')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0xe8090c['transfereruniqueid']));this['startAcw'](_0xe8090c['transfereruniqueid']);}else if(this[_0xbdef('0x9')][_0xe8090c[_0xbdef('0x49')]]){logger[_0xbdef('0x1f')](_0xbdef('0x4a'),JSON[_0xbdef('0x35')](_0xe8090c[_0xbdef('0x49')]));this[_0xbdef('0x15')](_0xe8090c[_0xbdef('0x49')]);}}catch(_0x3f0313){logger['error'](_0xbdef('0x4b'),_0x3f0313[_0xbdef('0x37')]);}};Acw[_0xbdef('0x3b')]['syncAgentRingNoAnswer']=function(_0x2622cf){try{if(this['voiceQueues'][_0x2622cf[_0xbdef('0x17')]]&&this[_0xbdef('0x6')][_0x2622cf[_0xbdef('0x17')]][_0xbdef('0x4c')]===_0xbdef('0x4d')){if(this[_0xbdef('0x7')][_0x2622cf['interface']]){logger[_0xbdef('0x1f')](_0xbdef('0x4e'),_0x2622cf[_0xbdef('0x26')],_0x2622cf[_0xbdef('0x16')],_0x2622cf[_0xbdef('0x17')]);return RpcUser[_0xbdef('0x21')](this[_0xbdef('0x7')][_0x2622cf[_0xbdef('0x16')]],_0xbdef('0x4f'),_0x2622cf[_0xbdef('0x26')]);}}}catch(_0x181ce2){logger[_0xbdef('0x2b')](_0xbdef('0x50'),_0x181ce2['message']);}};module[_0xbdef('0x51')]=Acw;
\ No newline at end of file
+var _0x3b3e=['attended','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','secondtransfereruniqueid','transfertargetuniqueid','transfereeuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest','bind','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','channels','interface','queue','ACW','mandatoryDispositionPause','name','Action','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','stopAcw','acwTimeout','lastPauseAt','uniqueid','updateAcw','update','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','mandatoryDisposition','[ACW][syncAgentConnectPreview]\x20%s','isUndefined'];(function(_0x107082,_0x9bb3af){var _0x2961fc=function(_0x35d2d8){while(--_0x35d2d8){_0x107082['push'](_0x107082['shift']());}};_0x2961fc(++_0x9bb3af);}(_0x3b3e,0x1b5));var _0xe3b3=function(_0x207e07,_0x518509){_0x207e07=_0x207e07-0x0;var _0x473a33=_0x3b3e[_0x207e07];return _0x473a33;};'use strict';var util=require(_0xe3b3('0x0'));var _=require(_0xe3b3('0x1'));var moment=require(_0xe3b3('0x2'));var ami=require(_0xe3b3('0x3'));var logger=require(_0xe3b3('0x4'))(_0xe3b3('0x5'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xe3b3('0x6'));function Acw(_0x131580){this[_0xe3b3('0x7')]=_0x131580[_0xe3b3('0x7')];this[_0xe3b3('0x8')]=_0x131580[_0xe3b3('0x8')];this[_0xe3b3('0x9')]=_0x131580['timers'];this['channels']={};ami['on'](_0xe3b3('0xa'),this[_0xe3b3('0xb')]['bind'](this));ami['on'](_0xe3b3('0xc'),this[_0xe3b3('0xd')][_0xe3b3('0xe')](this));ami['on']('hangup',this[_0xe3b3('0xf')]['bind'](this));ami['on'](_0xe3b3('0x10'),this[_0xe3b3('0x11')][_0xe3b3('0xe')](this));ami['on'](_0xe3b3('0x12'),this[_0xe3b3('0x13')][_0xe3b3('0xe')](this));ami['on'](_0xe3b3('0x14'),this['syncBlindTransfer'][_0xe3b3('0xe')](this));ami['on'](_0xe3b3('0x15'),this[_0xe3b3('0x16')][_0xe3b3('0xe')](this));}function getDiff(_0x56d83a){var _0xdef763=moment()[_0xe3b3('0x17')](0x0);var _0x55f6f2=moment(_0x56d83a)['milliseconds'](0x0);return _0xdef763[_0xe3b3('0x18')](_0x55f6f2,_0xe3b3('0x19'));}Acw[_0xe3b3('0x1a')]['startAcw']=function(_0x2b1732){try{var _0x382427=this;var _0x5dd608=this[_0xe3b3('0x1b')][_0x2b1732][_0xe3b3('0x1c')];var _0x5f4a62=this[_0xe3b3('0x1b')][_0x2b1732][_0xe3b3('0x1d')];var _0x12f5b5=this[_0xe3b3('0x7')][_0x5f4a62];var _0x1da054=![];var _0xdef2cc=_0xe3b3('0x1e');if(_0x12f5b5['mandatoryDisposition']){if(_0x12f5b5[_0xe3b3('0x1f')][_0xe3b3('0x20')]){_0x1da054=!![];_0xdef2cc=_0x12f5b5[_0xe3b3('0x1f')][_0xe3b3('0x20')];}}ami[_0xe3b3('0x21')]({'action':_0xe3b3('0x22'),'interface':_0x5dd608,'paused':!![],'reason':_0xdef2cc})['then'](function(_0x49dad7){if(_0x382427[_0xe3b3('0x8')][_0x5dd608]){return RpcUser['getAgent'](_0x382427[_0xe3b3('0x8')][_0x5dd608]['id'])[_0xe3b3('0x23')](function(_0x4b3419){if(_0x4b3419&&!_0x4b3419[_0xe3b3('0x24')]){logger[_0xe3b3('0x25')](_0xe3b3('0x26'),_0x2b1732,_0x5dd608,_0x5f4a62);return RpcUser['savePause'](_0x382427[_0xe3b3('0x8')][_0x5dd608],_0xdef2cc,_0x2b1732)['then'](function(_0x573f6e){if(!_0x1da054){_0x382427[_0xe3b3('0x9')][_0x5dd608]={};logger[_0xe3b3('0x25')](_0xe3b3('0x27'),_0x2b1732,_0x382427['voiceQueues'][_0x5f4a62]['acwTimeout'],_0x5dd608,_0x5f4a62);_0x382427[_0xe3b3('0x9')][_0x5dd608][_0xe3b3('0x28')]=setTimeout(_0x382427[_0xe3b3('0x29')][_0xe3b3('0xe')](_0x382427,_0x5dd608),_0x382427[_0xe3b3('0x7')][_0x5f4a62][_0xe3b3('0x2a')]*0x3e8);_0x382427[_0xe3b3('0x9')][_0x5dd608][_0xe3b3('0x2b')]=_0x573f6e[_0xe3b3('0x2b')];_0x382427[_0xe3b3('0x9')][_0x5dd608][_0xe3b3('0x2c')]=_0x2b1732;_0x382427[_0xe3b3('0x9')][_0x5dd608][_0xe3b3('0x1d')]=_0x5f4a62;_0x382427[_0xe3b3('0x9')][_0x5dd608][_0xe3b3('0x2d')]=function(){var _0x2c33c3=getDiff(_0x382427['timers'][_0x5dd608][_0xe3b3('0x2b')]);clearTimeout(_0x382427['timers'][_0x5dd608][_0xe3b3('0x28')]);RpcVoiceAgentReport[_0xe3b3('0x2e')]({'acwtime':_0x2c33c3},_0x382427[_0xe3b3('0x9')][_0x5dd608]['uniqueid'],_0x5dd608)[_0xe3b3('0x23')](function(_0x479c84){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x2b1732,_0x2c33c3,_0x479c84);})[_0xe3b3('0x2f')](function(_0x34e1a9){logger[_0xe3b3('0x30')](_0xe3b3('0x31'),_0x2b1732,_0x34e1a9);});delete _0x382427[_0xe3b3('0x9')][_0x5dd608];};}});}else{logger[_0xe3b3('0x25')](_0xe3b3('0x32'),_0x2b1732,_0x5dd608,_0x5f4a62);}});}})['catch'](function(_0x44c53d){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2b1732,_0x382427[_0xe3b3('0x7')][_0x5f4a62][_0xe3b3('0x2a')],_0x5dd608,_0x5f4a62);})[_0xe3b3('0x33')](function(){delete _0x382427[_0xe3b3('0x1b')][_0x2b1732];});}catch(_0x3dd149){logger[_0xe3b3('0x30')](_0xe3b3('0x34'),_0x3dd149[_0xe3b3('0x35')]);}};Acw[_0xe3b3('0x1a')][_0xe3b3('0x29')]=function(_0x77f81b){try{var _0x1a6a2a=this;if(_0x1a6a2a[_0xe3b3('0x9')][_0x77f81b]){var _0x3119f9=_0x1a6a2a[_0xe3b3('0x9')][_0x77f81b][_0xe3b3('0x2c')];var _0x2f4e45=_0x1a6a2a[_0xe3b3('0x9')][_0x77f81b][_0xe3b3('0x1d')];var _0x2e1396=_0x1a6a2a[_0xe3b3('0x7')][_0x2f4e45][_0xe3b3('0x2a')];logger[_0xe3b3('0x25')](_0xe3b3('0x36'),_0x77f81b);RpcUser[_0xe3b3('0x37')](this[_0xe3b3('0x8')][_0x77f81b]);RpcVoiceAgentReport[_0xe3b3('0x2e')]({'acwtime':_0x2e1396,'agentacw':!![]},_0x3119f9,_0x77f81b)[_0xe3b3('0x23')](function(_0x44dce3){logger[_0xe3b3('0x25')]('[%s][UPDATE][ACWTIME:%s]',_0x3119f9,_0x2e1396,_0x44dce3);})[_0xe3b3('0x2f')](function(_0x2eac3f){logger[_0xe3b3('0x30')](_0xe3b3('0x31'),_0x3119f9,_0x2eac3f);});}else{logger[_0xe3b3('0x30')](_0xe3b3('0x38'),_0x77f81b);if(_0x1a6a2a[_0xe3b3('0x9')]){logger[_0xe3b3('0x25')]('[ACW][TIMERS]',JSON[_0xe3b3('0x39')](_0x1a6a2a['timers']));}}}catch(_0x4e9cd6){logger[_0xe3b3('0x30')]('[ACW][STOP]\x20%s',_0x4e9cd6[_0xe3b3('0x35')]);}};Acw[_0xe3b3('0x1a')][_0xe3b3('0xb')]=function(_0x39f9bf){try{if(this['voiceQueues'][_0x39f9bf[_0xe3b3('0x1d')]]&&(this[_0xe3b3('0x7')][_0x39f9bf[_0xe3b3('0x1d')]][_0xe3b3('0x5')]||this[_0xe3b3('0x7')][_0x39f9bf[_0xe3b3('0x1d')]][_0xe3b3('0x3a')])){if(this[_0xe3b3('0x8')][_0x39f9bf[_0xe3b3('0x1c')]]){this['channels'][_0x39f9bf['uniqueid']]={'queue':_0x39f9bf[_0xe3b3('0x1d')],'interface':_0x39f9bf['interface']};}}}catch(_0x2173af){logger[_0xe3b3('0x30')]('[ACW][syncAgentConnect]\x20%s',_0x2173af[_0xe3b3('0x35')]);}};Acw['prototype'][_0xe3b3('0x16')]=function(_0x394bea){try{if(this[_0xe3b3('0x7')][_0x394bea[_0xe3b3('0x1d')]]&&(this['voiceQueues'][_0x394bea[_0xe3b3('0x1d')]]['acw']||this[_0xe3b3('0x7')][_0x394bea[_0xe3b3('0x1d')]][_0xe3b3('0x3a')])){if(this[_0xe3b3('0x8')][_0x394bea[_0xe3b3('0x1c')]]){this[_0xe3b3('0x1b')][_0x394bea[_0xe3b3('0x2c')]]={'queue':_0x394bea['queue'],'interface':_0x394bea['interface']};}}}catch(_0x4f7253){logger[_0xe3b3('0x30')](_0xe3b3('0x3b'),_0x4f7253['message']);}};Acw[_0xe3b3('0x1a')]['syncHangupRequest']=function(_0x571828){try{if(this[_0xe3b3('0x1b')][_0x571828[_0xe3b3('0x2c')]]&&_[_0xe3b3('0x3c')](this['channels'][_0x571828['uniqueid']][_0xe3b3('0x3d')])){logger[_0xe3b3('0x25')](_0xe3b3('0x3e'),_0x571828[_0xe3b3('0x2c')]);this[_0xe3b3('0x3f')](_0x571828[_0xe3b3('0x2c')]);}else if(this[_0xe3b3('0x1b')][_0x571828[_0xe3b3('0x40')]]&&_[_0xe3b3('0x3c')](this[_0xe3b3('0x1b')][_0x571828[_0xe3b3('0x40')]][_0xe3b3('0x3d')])){logger[_0xe3b3('0x25')](_0xe3b3('0x41'),_0x571828[_0xe3b3('0x40')]);this[_0xe3b3('0x3f')](_0x571828[_0xe3b3('0x40')]);}}catch(_0x15c240){logger[_0xe3b3('0x30')]('[ACW][syncHangupRequest]\x20%s',_0x15c240[_0xe3b3('0x35')]);}};Acw[_0xe3b3('0x1a')][_0xe3b3('0xf')]=function(_0x37a212){try{if(this[_0xe3b3('0x1b')][_0x37a212[_0xe3b3('0x2c')]]&&this['channels'][_0x37a212['uniqueid']][_0xe3b3('0x3d')]){logger[_0xe3b3('0x25')](_0xe3b3('0x42'),_0x37a212[_0xe3b3('0x2c')]);this[_0xe3b3('0x3f')](_0x37a212['uniqueid']);}else if(this['channels'][_0x37a212['linkedid']]&&this['channels'][_0x37a212[_0xe3b3('0x40')]][_0xe3b3('0x3d')]){logger[_0xe3b3('0x25')](_0xe3b3('0x43'),_0x37a212[_0xe3b3('0x40')]);this[_0xe3b3('0x3f')](_0x37a212['linkedid']);}}catch(_0x17ce8e){logger[_0xe3b3('0x30')]('[ACW][syncHangup]\x20%s',_0x17ce8e['message']);}};Acw[_0xe3b3('0x1a')][_0xe3b3('0x13')]=function(_0x406b76){try{if(!_[_0xe3b3('0x44')](this[_0xe3b3('0x1b')][_0x406b76['transfereeuniqueid']])){this[_0xe3b3('0x3f')](_0x406b76['transfereeuniqueid']);if(this[_0xe3b3('0x1b')][_0x406b76[_0xe3b3('0x45')]]){this[_0xe3b3('0x1b')][_0x406b76[_0xe3b3('0x45')]][_0xe3b3('0x3d')]=!![];this['channels'][_0x406b76[_0xe3b3('0x46')]]=this[_0xe3b3('0x1b')][_0x406b76['secondtransfereruniqueid']];delete this[_0xe3b3('0x1b')][_0x406b76[_0xe3b3('0x45')]];}}else if(!_[_0xe3b3('0x44')](this[_0xe3b3('0x1b')][_0x406b76[_0xe3b3('0x46')]])){this['startAcw'](_0x406b76[_0xe3b3('0x46')]);if(this[_0xe3b3('0x1b')][_0x406b76['origtransfereruniqueid']]){this[_0xe3b3('0x1b')][_0x406b76['origtransfereruniqueid']][_0xe3b3('0x3d')]=!![];this[_0xe3b3('0x1b')][_0x406b76[_0xe3b3('0x47')]]=this[_0xe3b3('0x1b')][_0x406b76['origtransfereruniqueid']];delete this['channels'][_0x406b76[_0xe3b3('0x48')]];}}}catch(_0x5b81cd){logger[_0xe3b3('0x30')](_0xe3b3('0x49'),_0x5b81cd[_0xe3b3('0x35')]);}};Acw[_0xe3b3('0x1a')][_0xe3b3('0x4a')]=function(_0x4f87af){try{if(this[_0xe3b3('0x1b')][_0x4f87af[_0xe3b3('0x4b')]]){logger[_0xe3b3('0x25')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xe3b3('0x39')](_0x4f87af['transfereruniqueid']));this['startAcw'](_0x4f87af['transfereruniqueid']);}else if(this[_0xe3b3('0x1b')][_0x4f87af['transfererlinkedid']]){logger[_0xe3b3('0x25')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xe3b3('0x39')](_0x4f87af[_0xe3b3('0x4c')]));this[_0xe3b3('0x3f')](_0x4f87af[_0xe3b3('0x4c')]);}}catch(_0x32f2c2){logger['error'](_0xe3b3('0x4d'),_0x32f2c2[_0xe3b3('0x35')]);}};Acw[_0xe3b3('0x1a')][_0xe3b3('0x11')]=function(_0x55015f){try{if(this[_0xe3b3('0x7')][_0x55015f[_0xe3b3('0x1d')]]&&this['voiceQueues'][_0x55015f['queue']][_0xe3b3('0x4e')]===_0xe3b3('0x4f')){if(this[_0xe3b3('0x8')][_0x55015f['interface']]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x55015f['uniqueid'],_0x55015f[_0xe3b3('0x1c')],_0x55015f['queue']);return RpcUser['savePause'](this[_0xe3b3('0x8')][_0x55015f[_0xe3b3('0x1c')]],_0xe3b3('0x50'),_0x55015f[_0xe3b3('0x2c')]);}}}catch(_0x9cb39a){logger['error'](_0xe3b3('0x51'),_0x9cb39a[_0xe3b3('0x35')]);}};module[_0xe3b3('0x52')]=Acw;
\ No newline at end of file
index d1adc4b..eab9ed1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2a23=['Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','then','actionDeviceStateList','actionQueueSummary','catch','log','exports','bluebird','moment','util','lodash','ami','../../config/environment','port','asterisk','username','Action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','error'];(function(_0x3c51d8,_0x13d156){var _0x1affa6=function(_0x61f0e0){while(--_0x61f0e0){_0x3c51d8['push'](_0x3c51d8['shift']());}};_0x1affa6(++_0x13d156);}(_0x2a23,0x11c));var _0x32a2=function(_0x4c1f64,_0x5cea53){_0x4c1f64=_0x4c1f64-0x0;var _0x5a5959=_0x2a23[_0x4c1f64];return _0x5a5959;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x32a2('0x0'));var moment=require(_0x32a2('0x1'));var util=require(_0x32a2('0x2'));var _=require(_0x32a2('0x3'));var logger=require('../../config/logger')(_0x32a2('0x4'));var config=require(_0x32a2('0x5'));var ami=new Manager(config['asterisk'][_0x32a2('0x6')],config[_0x32a2('0x7')]['ip'],config['asterisk'][_0x32a2('0x8')],config[_0x32a2('0x7')]['password'],!![]);ami['keepConnected']();ami[_0x32a2('0x9')]=BPromise['promisify'](ami['action']);function error(_0x11c711){logger['error'](util[_0x32a2('0xa')](_0x32a2('0xb'),config[_0x32a2('0x7')][_0x32a2('0x8')],config[_0x32a2('0x7')]['ip'],config[_0x32a2('0x7')]['port'],util['inspect'](_0x11c711,![],null)));}function close(){logger[_0x32a2('0xc')](util['format'](_0x32a2('0xd'),config[_0x32a2('0x7')][_0x32a2('0x8')],config[_0x32a2('0x7')]['ip'],config['asterisk']['port']));}ami[_0x32a2('0xe')]=function(){return function(){return ami[_0x32a2('0x9')]({'action':_0x32a2('0xf')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x32a2('0x9')]({'action':'devicestatelist'});};};ami[_0x32a2('0x10')]=function(){return function(){return ami[_0x32a2('0x9')]({'action':_0x32a2('0x11')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x32a2('0x9')]({'action':_0x32a2('0x12')});};};ami[_0x32a2('0x13')]=function(){return function(){return ami[_0x32a2('0x9')]({'action':_0x32a2('0x14')});};};function connect(_0x45226f){logger[_0x32a2('0x15')](util[_0x32a2('0xa')](_0x32a2('0x16'),config[_0x32a2('0x7')][_0x32a2('0x8')],config['asterisk']['ip'],config[_0x32a2('0x7')][_0x32a2('0x6')]));ami[_0x32a2('0x17')](_0x32a2('0xc'),error);ami[_0x32a2('0x17')]('close',close);}ami['on']('connect',connect);ami['on'](_0x32a2('0x18'),function(_0x3cec66){logger[_0x32a2('0x15')](util[_0x32a2('0xa')](_0x32a2('0x19'),config[_0x32a2('0x7')][_0x32a2('0x8')],config['asterisk']['ip'],config[_0x32a2('0x7')][_0x32a2('0x6')],util['inspect'](_0x3cec66,![],null)));});ami['on'](_0x32a2('0x1a'),function(_0x1bb6cd){logger[_0x32a2('0x15')](util[_0x32a2('0xa')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x32a2('0x7')]['username'],config[_0x32a2('0x7')]['ip'],config[_0x32a2('0x7')][_0x32a2('0x6')]));return BPromise['resolve']()[_0x32a2('0x1b')](ami['actionSipShowRegistry']())[_0x32a2('0x1b')](ami[_0x32a2('0x1c')]())[_0x32a2('0x1b')](ami[_0x32a2('0x10')]())['then'](ami[_0x32a2('0x1d')]())[_0x32a2('0x1b')](ami[_0x32a2('0x13')]())[_0x32a2('0x1e')](function(_0x34fdc6){console[_0x32a2('0x1f')](_0x34fdc6);});});ami['once'](_0x32a2('0xc'),error);ami[_0x32a2('0x17')]('close',close);module[_0x32a2('0x20')]=ami;
\ No newline at end of file
+var _0x61c3=['close','connect','shutdown','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipPeerStatus','actionQueueSummary','log','exports','moment','util','lodash','../../config/logger','ami','asterisk','username','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','actionDeviceStateList','devicestatelist','sippeerstatus','actionCoreShowChannels','info','once'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x61c3,0x1d3));var _0x361c=function(_0x1c696b,_0x3ad73a){_0x1c696b=_0x1c696b-0x0;var _0xd34a6=_0x61c3[_0x1c696b];return _0xd34a6;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var moment=require(_0x361c('0x0'));var util=require(_0x361c('0x1'));var _=require(_0x361c('0x2'));var logger=require(_0x361c('0x3'))(_0x361c('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x361c('0x5')]['port'],config[_0x361c('0x5')]['ip'],config['asterisk'][_0x361c('0x6')],config[_0x361c('0x5')]['password'],!![]);ami[_0x361c('0x7')]();ami[_0x361c('0x8')]=BPromise[_0x361c('0x9')](ami[_0x361c('0xa')]);function error(_0x18ae19){logger[_0x361c('0xb')](util[_0x361c('0xc')](_0x361c('0xd'),config['asterisk'][_0x361c('0x6')],config[_0x361c('0x5')]['ip'],config[_0x361c('0x5')][_0x361c('0xe')],util['inspect'](_0x18ae19,![],null)));}function close(){logger['error'](util['format'](_0x361c('0xf'),config[_0x361c('0x5')]['username'],config[_0x361c('0x5')]['ip'],config[_0x361c('0x5')][_0x361c('0xe')]));}ami['actionSipShowRegistry']=function(){return function(){return ami['Action']({'action':_0x361c('0x10')});};};ami[_0x361c('0x11')]=function(){return function(){return ami[_0x361c('0x8')]({'action':_0x361c('0x12')});};};ami['actionSipPeerStatus']=function(){return function(){return ami['Action']({'action':_0x361c('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':'queuesummary'});};};ami[_0x361c('0x14')]=function(){return function(){return ami[_0x361c('0x8')]({'action':'coreshowchannels'});};};function connect(_0x5cc4a0){logger[_0x361c('0x15')](util[_0x361c('0xc')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk'][_0x361c('0x6')],config[_0x361c('0x5')]['ip'],config[_0x361c('0x5')][_0x361c('0xe')]));ami['once'](_0x361c('0xb'),error);ami[_0x361c('0x16')](_0x361c('0x17'),close);}ami['on'](_0x361c('0x18'),connect);ami['on'](_0x361c('0x19'),function(_0x2b443f){logger[_0x361c('0x15')](util[_0x361c('0xc')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x361c('0x5')][_0x361c('0x6')],config[_0x361c('0x5')]['ip'],config[_0x361c('0x5')]['port'],util[_0x361c('0x1a')](_0x2b443f,![],null)));});ami['on'](_0x361c('0x1b'),function(_0x408852){logger[_0x361c('0x15')](util[_0x361c('0xc')](_0x361c('0x1c'),config['asterisk']['username'],config['asterisk']['ip'],config[_0x361c('0x5')][_0x361c('0xe')]));return BPromise[_0x361c('0x1d')]()[_0x361c('0x1e')](ami['actionSipShowRegistry']())[_0x361c('0x1e')](ami['actionDeviceStateList']())['then'](ami[_0x361c('0x1f')]())[_0x361c('0x1e')](ami[_0x361c('0x20')]())['then'](ami[_0x361c('0x14')]())['catch'](function(_0x1f8dda){console[_0x361c('0x21')](_0x1f8dda);});});ami[_0x361c('0x16')](_0x361c('0xb'),error);ami[_0x361c('0x16')]('close',close);module[_0x361c('0x22')]=ami;
\ No newline at end of file
index 7353015..163025c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6570=['exports','jayson/promise','bluebird','client','http','Request','then','debug','rpc','error','memberReport','message','result','catch'];(function(_0x30381c,_0x17a45a){var _0x24fcc2=function(_0x2af3c1){while(--_0x2af3c1){_0x30381c['push'](_0x30381c['shift']());}};_0x24fcc2(++_0x17a45a);}(_0x6570,0xa9));var _0x0657=function(_0x239422,_0x353de1){_0x239422=_0x239422-0x0;var _0x155cf2=_0x6570[_0x239422];return _0x155cf2;};'use strict';var jayson=require(_0x0657('0x0'));var BPromise=require(_0x0657('0x1'));var logger=require('../../config/logger')('ami');var client=jayson[_0x0657('0x2')][_0x0657('0x3')]({'port':0x2329});client[_0x0657('0x4')]=function(_0xd6c5d2,_0xf3578d){return new BPromise(function(_0x66f8a6,_0x15e6b9){return client['request'](_0xd6c5d2,_0xf3578d)[_0x0657('0x5')](function(_0x2cd924){logger[_0x0657('0x6')](_0x0657('0x7'),'memberReport',_0xd6c5d2,_0xf3578d,_0x2cd924);if(_0x2cd924[_0x0657('0x8')]){logger[_0x0657('0x8')]('rpc',_0x0657('0x9'),_0xd6c5d2,_0x2cd924[_0x0657('0x8')][_0x0657('0xa')],_0xf3578d);return _0x15e6b9(_0x2cd924[_0x0657('0x8')][_0x0657('0xa')]);}else{return _0x66f8a6(_0x2cd924[_0x0657('0xb')]);}})[_0x0657('0xc')](function(_0x5aa8e3){logger['error'](_0x0657('0x7'),_0x0657('0x9'),_0xd6c5d2,_0x5aa8e3,_0xf3578d);return _0x15e6b9(_0x5aa8e3);});});};module[_0x0657('0xd')]=client;
\ No newline at end of file
+var _0x8756=['memberReport','message','result','catch','bluebird','ami','Request','rpc','error'];(function(_0x5956a1,_0x5774b2){var _0x152345=function(_0x1c7e4c){while(--_0x1c7e4c){_0x5956a1['push'](_0x5956a1['shift']());}};_0x152345(++_0x5774b2);}(_0x8756,0xaf));var _0x6875=function(_0x5674cf,_0x5e102d){_0x5674cf=_0x5674cf-0x0;var _0x46f0e1=_0x8756[_0x5674cf];return _0x46f0e1;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x6875('0x0'));var logger=require('../../config/logger')(_0x6875('0x1'));var client=jayson['client']['http']({'port':0x2329});client[_0x6875('0x2')]=function(_0x49cfcf,_0x2b16d2){return new BPromise(function(_0x1a47ac,_0x18aa48){return client['request'](_0x49cfcf,_0x2b16d2)['then'](function(_0x326ff1){logger['debug'](_0x6875('0x3'),'memberReport',_0x49cfcf,_0x2b16d2,_0x326ff1);if(_0x326ff1[_0x6875('0x4')]){logger[_0x6875('0x4')](_0x6875('0x3'),_0x6875('0x5'),_0x49cfcf,_0x326ff1[_0x6875('0x4')][_0x6875('0x6')],_0x2b16d2);return _0x18aa48(_0x326ff1['error'][_0x6875('0x6')]);}else{return _0x1a47ac(_0x326ff1[_0x6875('0x7')]);}})[_0x6875('0x8')](function(_0x3add44){logger[_0x6875('0x4')](_0x6875('0x3'),'memberReport',_0x49cfcf,_0x3add44,_0x2b16d2);return _0x18aa48(_0x3add44);});});};module['exports']=client;
\ No newline at end of file
index 110ca04..beba1ad 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcd3c=['ListId','UserId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','dialCutDigit','substring','getQueue','exports','util','lodash','moment','isNil','voiceQueue','name','Contact','phone','firstName','lastName','number','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x4d5558,_0x42e92f){var _0x2679d5=function(_0x42439b){while(--_0x42439b){_0x4d5558['push'](_0x4d5558['shift']());}};_0x2679d5(++_0x42e92f);}(_0xcd3c,0x1b7));var _0xccd3=function(_0x53c100,_0x3f4d3b){_0x53c100=_0x53c100-0x0;var _0x9b8574=_0xcd3c[_0x53c100];return _0x9b8574;};'use strict';var util=require(_0xccd3('0x0'));var _=require(_0xccd3('0x1'));var moment=require(_0xccd3('0x2'));function checkNameSurname(_0x995168,_0x28731d,_0x35f7f7){var _0x4c7e58='';if(!_[_0xccd3('0x3')](_0x28731d)&&'string'===typeof _0x28731d){_0x4c7e58+=_0x28731d;}if(!_[_0xccd3('0x3')](_0x35f7f7)&&'string'===typeof _0x35f7f7){_0x4c7e58+='\x20'+_0x35f7f7;}if(_0x4c7e58!==''){return _0x4c7e58;}return _0x995168;}function Action(_0x360fbd,_0x2ec924,_0x1f0b8b){this[_0xccd3('0x4')]=_0x360fbd;this['uniqueid']=_0x1f0b8b||undefined;this[_0xccd3('0x5')]=checkNameSurname(_0x2ec924[_0xccd3('0x6')][_0xccd3('0x7')],_0x2ec924[_0xccd3('0x6')][_0xccd3('0x8')],_0x2ec924[_0xccd3('0x6')][_0xccd3('0x9')]);this[_0xccd3('0xa')]=_0x2ec924['Contact']['phone'];this['queue']=_0x360fbd[_0xccd3('0x5')];this[_0xccd3('0xb')]=_0x2ec924[_0xccd3('0xb')]||![];this['type']=_0x360fbd['type'];this['dialQueueTimeout']=_0x360fbd['dialQueueTimeout']||0x3;this[_0xccd3('0xc')]=_0x2ec924[_0xccd3('0xc')];this[_0xccd3('0xd')]=_0x2ec924[_0xccd3('0xd')];this[_0xccd3('0xe')]=_0x2ec924[_0xccd3('0xe')];this[_0xccd3('0xf')]=_0x2ec924[_0xccd3('0xf')];this['ContactId']=_0x2ec924['ContactId'];this[_0xccd3('0x10')]=_0x2ec924[_0xccd3('0x10')];this[_0xccd3('0x11')]=_0x2ec924['UserId'];this['VoiceQueueId']=_0x2ec924['VoiceQueueId'];this[_0xccd3('0x12')]=_0x2ec924[_0xccd3('0x12')];this[_0xccd3('0x13')]=_0x2ec924['id'];this['ContactFirstName']=_0x2ec924[_0xccd3('0x6')][_0xccd3('0x8')]||'';this[_0xccd3('0x14')]=moment()[_0xccd3('0x15')](_0xccd3('0x16'));this[_0xccd3('0x17')]=_0x2ec924['callback'];this[_0xccd3('0x18')]=_0x2ec924['callbackuniqueid'];this[_0xccd3('0x19')]=_0x2ec924[_0xccd3('0x19')];this['recallme']=_0x2ec924[_0xccd3('0x1a')];this[_0xccd3('0x1b')]='';this[_0xccd3('0x1c')]='';}Action[_0xccd3('0x1d')][_0xccd3('0x1e')]=function(){return util[_0xccd3('0x15')]('\x22%s\x22\x20<%s>',this[_0xccd3('0x5')],this[_0xccd3('0x4')][_0xccd3('0x1f')]>0x0?this['number'][_0xccd3('0x20')](this[_0xccd3('0x4')]['dialCutDigit']):this[_0xccd3('0xa')]);};Action[_0xccd3('0x1d')][_0xccd3('0x21')]=function(){return this['queue'];};module[_0xccd3('0x22')]=Action;
\ No newline at end of file
+var _0xabed=['format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','dialCutDigit','number','substring','getQueue','util','lodash','isNil','string','voiceQueue','uniqueid','name','Contact','phone','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','ContactId','ListId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime'];(function(_0x255f18,_0x108651){var _0x487931=function(_0x205fad){while(--_0x205fad){_0x255f18['push'](_0x255f18['shift']());}};_0x487931(++_0x108651);}(_0xabed,0xa4));var _0xdabe=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0xabed[_0x1c34e7];return _0x378cb1;};'use strict';var util=require(_0xdabe('0x0'));var _=require(_0xdabe('0x1'));var moment=require('moment');function checkNameSurname(_0x4b34e1,_0x4729f1,_0x31123d){var _0x2bfd1c='';if(!_[_0xdabe('0x2')](_0x4729f1)&&'string'===typeof _0x4729f1){_0x2bfd1c+=_0x4729f1;}if(!_['isNil'](_0x31123d)&&_0xdabe('0x3')===typeof _0x31123d){_0x2bfd1c+='\x20'+_0x31123d;}if(_0x2bfd1c!==''){return _0x2bfd1c;}return _0x4b34e1;}function Action(_0x21b819,_0x508cae,_0x5a9649){this[_0xdabe('0x4')]=_0x21b819;this[_0xdabe('0x5')]=_0x5a9649||undefined;this[_0xdabe('0x6')]=checkNameSurname(_0x508cae[_0xdabe('0x7')][_0xdabe('0x8')],_0x508cae[_0xdabe('0x7')]['firstName'],_0x508cae[_0xdabe('0x7')][_0xdabe('0x9')]);this['number']=_0x508cae['Contact'][_0xdabe('0x8')];this[_0xdabe('0xa')]=_0x21b819['name'];this[_0xdabe('0xb')]=_0x508cae[_0xdabe('0xb')]||![];this[_0xdabe('0xc')]=_0x21b819['type'];this[_0xdabe('0xd')]=_0x21b819[_0xdabe('0xd')]||0x3;this['scheduledat']=_0x508cae[_0xdabe('0xe')];this[_0xdabe('0xf')]=_0x508cae[_0xdabe('0xf')];this[_0xdabe('0x10')]=_0x508cae['countcongestionretry'];this[_0xdabe('0x11')]=_0x508cae[_0xdabe('0x11')];this[_0xdabe('0x12')]=_0x508cae[_0xdabe('0x12')];this[_0xdabe('0x13')]=_0x508cae[_0xdabe('0x13')];this['UserId']=_0x508cae['UserId'];this[_0xdabe('0x14')]=_0x508cae[_0xdabe('0x14')];this[_0xdabe('0x15')]=_0x508cae[_0xdabe('0x15')];this[_0xdabe('0x16')]=_0x508cae['id'];this[_0xdabe('0x17')]=_0x508cae[_0xdabe('0x7')][_0xdabe('0x18')]||'';this[_0xdabe('0x19')]=moment()[_0xdabe('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xdabe('0x1b')]=_0x508cae[_0xdabe('0x1b')];this[_0xdabe('0x1c')]=_0x508cae[_0xdabe('0x1c')];this[_0xdabe('0x1d')]=_0x508cae[_0xdabe('0x1d')];this['recallme']=_0x508cae[_0xdabe('0x1e')];this[_0xdabe('0x1f')]='';this[_0xdabe('0x20')]='';}Action[_0xdabe('0x21')]['getCaller']=function(){return util[_0xdabe('0x1a')]('\x22%s\x22\x20<%s>',this[_0xdabe('0x6')],this['voiceQueue'][_0xdabe('0x22')]>0x0?this[_0xdabe('0x23')][_0xdabe('0x24')](this[_0xdabe('0x4')][_0xdabe('0x22')]):this[_0xdabe('0x23')]);};Action[_0xdabe('0x21')][_0xdabe('0x25')]=function(){return this[_0xdabe('0xa')];};module['exports']=Action;
\ No newline at end of file
index 9f305fd..d6ac0c8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xed8b=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','talktime','membername','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','diff','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime'];(function(_0x24a7c9,_0x2b6615){var _0x31566d=function(_0xc8bbd1){while(--_0xc8bbd1){_0x24a7c9['push'](_0x24a7c9['shift']());}};_0x31566d(++_0x2b6615);}(_0xed8b,0x11b));var _0xbed8=function(_0x492028,_0x38c95c){_0x492028=_0x492028-0x0;var _0x3fc883=_0xed8b[_0x492028];return _0x3fc883;};'use strict';var util=require('util');var _=require(_0xbed8('0x0'));var moment=require('moment');function getSeconds(_0x2f2681,_0x572b72){var _0x34b9ad=moment(_0x2f2681)[_0xbed8('0x1')](0x0);var _0x12abdb=moment(_0x572b72)['milliseconds'](0x0);return _0x34b9ad[_0xbed8('0x2')](_0x12abdb,'seconds');}function AgentComplete(_0xcf96df,_0x44bed0){this['state']=0x4;this[_0xbed8('0x3')]=_0xbed8('0x4');this['scheduledat']=_0xcf96df[_0xbed8('0x5')];this['type']=_0xcf96df[_0xbed8('0x6')];this[_0xbed8('0x7')]=_0xcf96df['type']===_0xbed8('0x8')?_0xbed8('0x9'):_0xcf96df[_0xbed8('0x6')];this[_0xbed8('0xa')]=_0xcf96df[_0xbed8('0xa')];this['countcongestionretry']=_0xcf96df[_0xbed8('0xb')];this[_0xbed8('0xc')]=_0xcf96df[_0xbed8('0xc')];this[_0xbed8('0xd')]=_0xcf96df[_0xbed8('0xa')]+_0xcf96df['countcongestionretry']+_0xcf96df['countnoanswerretry'];this[_0xbed8('0xe')]=_0x44bed0[_0xbed8('0xe')];this[_0xbed8('0xf')]=_0xcf96df[_0xbed8('0x10')];this[_0xbed8('0x11')]=_0xcf96df['number'];this[_0xbed8('0x12')]=_0xcf96df[_0xbed8('0x12')];this[_0xbed8('0x13')]=_0xcf96df[_0xbed8('0x13')];this['answertime']=_0xcf96df[_0xbed8('0x14')];this[_0xbed8('0x15')]=moment()[_0xbed8('0x16')](_0xbed8('0x17'));this['ringtime']=getSeconds(_0xcf96df[_0xbed8('0x13')],_0xcf96df[_0xbed8('0x12')]);this['holdtime']=getSeconds(_0xcf96df[_0xbed8('0x14')],_0xcf96df[_0xbed8('0x13')]);this[_0xbed8('0x18')]=getSeconds(this['endtime'],_0xcf96df[_0xbed8('0x14')]);this[_0xbed8('0x9')]=_0x44bed0[_0xbed8('0x9')];this[_0xbed8('0x19')]=_0x44bed0[_0xbed8('0x19')];this['reason']=_0x44bed0[_0xbed8('0x1a')];this['callback']=_0xcf96df['callback'];this[_0xbed8('0x1b')]=_0xcf96df[_0xbed8('0x1b')];this[_0xbed8('0x1c')]=_0xcf96df['callbackat'];this['recallme']=_0xcf96df[_0xbed8('0x1d')];this[_0xbed8('0x1e')]=_0xcf96df[_0xbed8('0x1e')];this[_0xbed8('0x1f')]=_0xcf96df[_0xbed8('0x1f')];this['UserId']=_0xcf96df[_0xbed8('0x20')];this[_0xbed8('0x21')]=_0xcf96df[_0xbed8('0x21')];this[_0xbed8('0x22')]=_0xcf96df[_0xbed8('0x22')];this[_0xbed8('0x23')]=_0xcf96df[_0xbed8('0x23')]||'';this[_0xbed8('0x24')]=_0xcf96df[_0xbed8('0x24')]||'';}module[_0xbed8('0x25')]=AgentComplete;
\ No newline at end of file
+var _0xfe43=['ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','format','holdtime','talktime','membername','reason','callback','callbackuniqueid'];(function(_0x4b9f35,_0x287585){var _0x200ea1=function(_0x9bf668){while(--_0x9bf668){_0x4b9f35['push'](_0x4b9f35['shift']());}};_0x200ea1(++_0x287585);}(_0xfe43,0x16f));var _0x3fe4=function(_0xdb987d,_0x3c1c73){_0xdb987d=_0xdb987d-0x0;var _0x2a4d64=_0xfe43[_0xdb987d];return _0x2a4d64;};'use strict';var util=require(_0x3fe4('0x0'));var _=require(_0x3fe4('0x1'));var moment=require(_0x3fe4('0x2'));function getSeconds(_0x14b197,_0x4b1662){var _0x5b232c=moment(_0x14b197)[_0x3fe4('0x3')](0x0);var _0x4e00bd=moment(_0x4b1662)['milliseconds'](0x0);return _0x5b232c[_0x3fe4('0x4')](_0x4e00bd,'seconds');}function AgentComplete(_0x34ef20,_0x580622){this['state']=0x4;this[_0x3fe4('0x5')]=_0x3fe4('0x6');this[_0x3fe4('0x7')]=_0x34ef20[_0x3fe4('0x7')];this[_0x3fe4('0x8')]=_0x34ef20[_0x3fe4('0x8')];this['campaigntype']=_0x34ef20[_0x3fe4('0x8')]===_0x3fe4('0x9')?_0x3fe4('0xa'):_0x34ef20[_0x3fe4('0x8')];this[_0x3fe4('0xb')]=_0x34ef20[_0x3fe4('0xb')];this[_0x3fe4('0xc')]=_0x34ef20[_0x3fe4('0xc')];this['countnoanswerretry']=_0x34ef20['countnoanswerretry'];this['countglobal']=_0x34ef20[_0x3fe4('0xb')]+_0x34ef20[_0x3fe4('0xc')]+_0x34ef20[_0x3fe4('0xd')];this['uniqueid']=_0x580622[_0x3fe4('0xe')];this[_0x3fe4('0xf')]=_0x34ef20[_0x3fe4('0x10')];this[_0x3fe4('0x11')]=_0x34ef20[_0x3fe4('0x12')];this[_0x3fe4('0x13')]=_0x34ef20[_0x3fe4('0x13')];this[_0x3fe4('0x14')]=_0x34ef20[_0x3fe4('0x14')];this[_0x3fe4('0x15')]=_0x34ef20[_0x3fe4('0x15')];this['endtime']=moment()[_0x3fe4('0x16')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=getSeconds(_0x34ef20['responsetime'],_0x34ef20[_0x3fe4('0x13')]);this[_0x3fe4('0x17')]=getSeconds(_0x34ef20['answertime'],_0x34ef20[_0x3fe4('0x14')]);this[_0x3fe4('0x18')]=getSeconds(this['endtime'],_0x34ef20[_0x3fe4('0x15')]);this[_0x3fe4('0xa')]=_0x580622[_0x3fe4('0xa')];this['membername']=_0x580622[_0x3fe4('0x19')];this['reason']=_0x580622[_0x3fe4('0x1a')];this[_0x3fe4('0x1b')]=_0x34ef20[_0x3fe4('0x1b')];this[_0x3fe4('0x1c')]=_0x34ef20['callbackuniqueid'];this['callbackat']=_0x34ef20['callbackat'];this['recallme']=_0x34ef20['recallme'];this[_0x3fe4('0x1d')]=_0x34ef20[_0x3fe4('0x1d')];this['ListId']=_0x34ef20['ListId'];this[_0x3fe4('0x1e')]=_0x34ef20[_0x3fe4('0x1e')];this[_0x3fe4('0x1f')]=_0x34ef20[_0x3fe4('0x1f')];this[_0x3fe4('0x20')]=_0x34ef20[_0x3fe4('0x20')];this['originatecalleridnum']=_0x34ef20[_0x3fe4('0x21')]||'';this[_0x3fe4('0x22')]=_0x34ef20['originatecalleridname']||'';}module[_0x3fe4('0x23')]=AgentComplete;
\ No newline at end of file
index 9839c3d..f8924c5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1115=['uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff'];(function(_0xc52482,_0x57c7f9){var _0xe49f8f=function(_0xb91c6f){while(--_0xb91c6f){_0xc52482['push'](_0xc52482['shift']());}};_0xe49f8f(++_0x57c7f9);}(_0x1115,0x1b6));var _0x5111=function(_0x4faf73,_0x5e6a0a){_0x4faf73=_0x4faf73-0x0;var _0x169a51=_0x1115[_0x4faf73];return _0x169a51;};'use strict';var util=require('util');var _=require(_0x5111('0x0'));var moment=require(_0x5111('0x1'));function getSeconds(_0x352000,_0x20e2ee){var _0x39a422=moment(_0x352000)[_0x5111('0x2')](0x0);var _0x301d43=moment(_0x20e2ee)[_0x5111('0x2')](0x0);return _0x39a422[_0x5111('0x3')](_0x301d43,'seconds');}function Final(_0x5981cb){this[_0x5111('0x4')]=_0x5981cb[_0x5111('0x4')];this['scheduledat']=_0x5981cb[_0x5111('0x5')];this[_0x5111('0x6')]=_0x5981cb['type'];this[_0x5111('0x7')]=_0x5981cb['type']===_0x5111('0x8')?_0x5111('0x9'):_0x5981cb['type'];this['countbusyretry']=_0x5981cb[_0x5111('0xa')];this['countcongestionretry']=_0x5981cb[_0x5111('0xb')];this['countnoanswerretry']=_0x5981cb[_0x5111('0xc')];this[_0x5111('0xd')]=_0x5981cb[_0x5111('0xa')]+_0x5981cb[_0x5111('0xb')]+_0x5981cb[_0x5111('0xc')];this[_0x5111('0x9')]=_0x5981cb[_0x5111('0x9')];this[_0x5111('0xe')]=_0x5981cb[_0x5111('0xe')];this[_0x5111('0xf')]=_0x5981cb[_0x5111('0xf')];this[_0x5111('0x10')]=_0x5981cb[_0x5111('0x10')];this[_0x5111('0x11')]=_0x5981cb[_0x5111('0x11')];this[_0x5111('0x12')]=_0x5981cb[_0x5111('0x11')];this[_0x5111('0x13')]=_0x5981cb['ringtime']||0x0;this[_0x5111('0x14')]=_0x5981cb['holdtime']||0x0;this['talktime']=_0x5981cb[_0x5111('0x15')]||0x0;this[_0x5111('0x16')]=_0x5981cb[_0x5111('0x16')];this['callbackuniqueid']=_0x5981cb[_0x5111('0x17')];this[_0x5111('0x18')]=_0x5981cb['callbackat'];this[_0x5111('0x19')]=_0x5981cb[_0x5111('0x19')];this[_0x5111('0x1a')]=_0x5981cb[_0x5111('0x1a')];this['ListId']=_0x5981cb[_0x5111('0x1b')];this[_0x5111('0x1c')]=_0x5981cb[_0x5111('0x1c')];this[_0x5111('0x1d')]=_0x5981cb[_0x5111('0x1d')];this[_0x5111('0x1e')]=_0x5981cb[_0x5111('0x1e')];this[_0x5111('0x1f')]=_0x5981cb[_0x5111('0x1f')]||'';this[_0x5111('0x20')]=_0x5981cb['originatecalleridname']||'';}module[_0x5111('0x21')]=Final;
\ No newline at end of file
+var _0x66da=['responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','calleridname','calleridnum','starttime'];(function(_0xd1e50c,_0xb5aaea){var _0x32b2d2=function(_0xccf18e){while(--_0xccf18e){_0xd1e50c['push'](_0xd1e50c['shift']());}};_0x32b2d2(++_0xb5aaea);}(_0x66da,0x16f));var _0xa66d=function(_0x4d21ff,_0x19d202){_0x4d21ff=_0x4d21ff-0x0;var _0x22b554=_0x66da[_0x4d21ff];return _0x22b554;};'use strict';var util=require(_0xa66d('0x0'));var _=require(_0xa66d('0x1'));var moment=require(_0xa66d('0x2'));function getSeconds(_0x1f02c5,_0x4ae0b1){var _0x4b63f3=moment(_0x1f02c5)['milliseconds'](0x0);var _0x17b831=moment(_0x4ae0b1)[_0xa66d('0x3')](0x0);return _0x4b63f3[_0xa66d('0x4')](_0x17b831,_0xa66d('0x5'));}function Final(_0x23d44d){this['uniqueid']=_0x23d44d[_0xa66d('0x6')];this[_0xa66d('0x7')]=_0x23d44d[_0xa66d('0x7')];this[_0xa66d('0x8')]=_0x23d44d[_0xa66d('0x8')];this[_0xa66d('0x9')]=_0x23d44d[_0xa66d('0x8')]===_0xa66d('0xa')?_0xa66d('0xb'):_0x23d44d[_0xa66d('0x8')];this[_0xa66d('0xc')]=_0x23d44d[_0xa66d('0xc')];this['countcongestionretry']=_0x23d44d[_0xa66d('0xd')];this[_0xa66d('0xe')]=_0x23d44d['countnoanswerretry'];this['countglobal']=_0x23d44d['countbusyretry']+_0x23d44d[_0xa66d('0xd')]+_0x23d44d['countnoanswerretry'];this[_0xa66d('0xb')]=_0x23d44d['queue'];this[_0xa66d('0xf')]=_0x23d44d[_0xa66d('0xf')];this['calleridnum']=_0x23d44d[_0xa66d('0x10')];this[_0xa66d('0x11')]=_0x23d44d['starttime'];this[_0xa66d('0x12')]=_0x23d44d['responsetime'];this[_0xa66d('0x13')]=_0x23d44d['responsetime'];this[_0xa66d('0x14')]=_0x23d44d[_0xa66d('0x14')]||0x0;this['holdtime']=_0x23d44d[_0xa66d('0x15')]||0x0;this[_0xa66d('0x16')]=_0x23d44d[_0xa66d('0x16')]||0x0;this[_0xa66d('0x17')]=_0x23d44d[_0xa66d('0x17')];this['callbackuniqueid']=_0x23d44d[_0xa66d('0x18')];this['callbackat']=_0x23d44d[_0xa66d('0x19')];this[_0xa66d('0x1a')]=_0x23d44d['recallme'];this[_0xa66d('0x1b')]=_0x23d44d[_0xa66d('0x1b')];this[_0xa66d('0x1c')]=_0x23d44d[_0xa66d('0x1c')];this['UserId']=_0x23d44d[_0xa66d('0x1d')];this[_0xa66d('0x1e')]=_0x23d44d[_0xa66d('0x1e')];this[_0xa66d('0x1f')]=_0x23d44d[_0xa66d('0x1f')];this[_0xa66d('0x20')]=_0x23d44d['originatecalleridnum']||'';this[_0xa66d('0x21')]=_0x23d44d['originatecalleridname']||'';}module[_0xa66d('0x22')]=Final;
\ No newline at end of file
index 9ad1a3b..c0e89d6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['countglobal','countcongestionretry','countnoanswerretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','type','outbound','queue','countbusyretry'];(function(_0x1f71d8,_0x278518){var _0x10b045=function(_0x57aea4){while(--_0x57aea4){_0x1f71d8['push'](_0x1f71d8['shift']());}};_0x10b045(++_0x278518);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function getSeconds(_0x5dd881,_0x550fbc){var _0x18d5c9=moment(_0x5dd881)['milliseconds'](0x0);var _0x333808=moment(_0x550fbc)[_0x0a9e('0x3')](0x0);return _0x18d5c9[_0x0a9e('0x4')](_0x333808,_0x0a9e('0x5'));}function Hangup(_0x981158,_0x57b080){this[_0x0a9e('0x6')]=0x4;this[_0x0a9e('0x7')]=_0x0a9e('0x8');this['scheduledat']=_0x981158['scheduledat'];this[_0x0a9e('0x9')]=_0x981158['type'];this['campaigntype']=_0x981158[_0x0a9e('0x9')]===_0x0a9e('0xa')?_0x0a9e('0xb'):_0x981158[_0x0a9e('0x9')];this[_0x0a9e('0xc')]=_0x981158[_0x0a9e('0xc')];this['countcongestionretry']=_0x981158['countcongestionretry'];this['countnoanswerretry']=_0x981158['countnoanswerretry'];this[_0x0a9e('0xd')]=_0x981158[_0x0a9e('0xc')]+_0x981158[_0x0a9e('0xe')]+_0x981158[_0x0a9e('0xf')];this[_0x0a9e('0x10')]=_0x57b080[_0x0a9e('0x10')];this['calleridname']=_0x981158[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x981158[_0x0a9e('0x13')];this[_0x0a9e('0x14')]=_0x981158[_0x0a9e('0x14')];this[_0x0a9e('0x15')]=_0x981158['responsetime'];this[_0x0a9e('0x16')]=moment()['format'](_0x0a9e('0x17'));this['ringtime']=getSeconds(_0x981158[_0x0a9e('0x15')],_0x981158[_0x0a9e('0x14')]);this['holdtime']=0x0;this[_0x0a9e('0x18')]=getSeconds(this['endtime'],_0x981158[_0x0a9e('0x15')]);this[_0x0a9e('0xb')]=_0x981158[_0x0a9e('0xb')];this[_0x0a9e('0x19')]=_0x0a9e('0x1a');this[_0x0a9e('0x1b')]=_0x57b080[_0x0a9e('0x1c')];this[_0x0a9e('0x1d')]=_0x981158[_0x0a9e('0x1d')];this[_0x0a9e('0x1e')]=_0x981158[_0x0a9e('0x1e')];this[_0x0a9e('0x1f')]=_0x981158['callbackat'];this[_0x0a9e('0x20')]=_0x981158[_0x0a9e('0x20')];this['ContactId']=_0x981158[_0x0a9e('0x21')];this['ListId']=_0x981158['ListId'];this[_0x0a9e('0x22')]=_0x981158[_0x0a9e('0x22')];this[_0x0a9e('0x23')]=_0x981158[_0x0a9e('0x23')];this['CampaignId']=_0x981158[_0x0a9e('0x24')];}module[_0x0a9e('0x25')]=Hangup;
\ No newline at end of file
+var _0x9957=['state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid','calleridname','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','seconds'];(function(_0x53417b,_0x4d3c4e){var _0x27712f=function(_0x49e1cb){while(--_0x49e1cb){_0x53417b['push'](_0x53417b['shift']());}};_0x27712f(++_0x4d3c4e);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var util=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));function getSeconds(_0x10a05d,_0x5b96eb){var _0x86c128=moment(_0x10a05d)[_0x7995('0x3')](0x0);var _0x1902b4=moment(_0x5b96eb)[_0x7995('0x3')](0x0);return _0x86c128['diff'](_0x1902b4,_0x7995('0x4'));}function Hangup(_0x1a36d8,_0x137b6b){this[_0x7995('0x5')]=0x4;this[_0x7995('0x6')]=_0x7995('0x7');this['scheduledat']=_0x1a36d8[_0x7995('0x8')];this[_0x7995('0x9')]=_0x1a36d8['type'];this[_0x7995('0xa')]=_0x1a36d8[_0x7995('0x9')]===_0x7995('0xb')?_0x7995('0xc'):_0x1a36d8[_0x7995('0x9')];this[_0x7995('0xd')]=_0x1a36d8[_0x7995('0xd')];this['countcongestionretry']=_0x1a36d8[_0x7995('0xe')];this[_0x7995('0xf')]=_0x1a36d8['countnoanswerretry'];this[_0x7995('0x10')]=_0x1a36d8[_0x7995('0xd')]+_0x1a36d8[_0x7995('0xe')]+_0x1a36d8[_0x7995('0xf')];this[_0x7995('0x11')]=_0x137b6b[_0x7995('0x11')];this[_0x7995('0x12')]=_0x1a36d8['name'];this['calleridnum']=_0x1a36d8[_0x7995('0x13')];this[_0x7995('0x14')]=_0x1a36d8[_0x7995('0x14')];this[_0x7995('0x15')]=_0x1a36d8[_0x7995('0x15')];this[_0x7995('0x16')]=moment()[_0x7995('0x17')](_0x7995('0x18'));this['ringtime']=getSeconds(_0x1a36d8[_0x7995('0x15')],_0x1a36d8['starttime']);this[_0x7995('0x19')]=0x0;this[_0x7995('0x1a')]=getSeconds(this[_0x7995('0x16')],_0x1a36d8[_0x7995('0x15')]);this[_0x7995('0xc')]=_0x1a36d8[_0x7995('0xc')];this['membername']='IVR';this[_0x7995('0x1b')]=_0x137b6b['cause-txt'];this['callback']=_0x1a36d8[_0x7995('0x1c')];this[_0x7995('0x1d')]=_0x1a36d8['callbackuniqueid'];this[_0x7995('0x1e')]=_0x1a36d8['callbackat'];this['recallme']=_0x1a36d8[_0x7995('0x1f')];this[_0x7995('0x20')]=_0x1a36d8[_0x7995('0x20')];this[_0x7995('0x21')]=_0x1a36d8[_0x7995('0x21')];this[_0x7995('0x22')]=_0x1a36d8['UserId'];this[_0x7995('0x23')]=_0x1a36d8[_0x7995('0x23')];this[_0x7995('0x24')]=_0x1a36d8[_0x7995('0x24')];}module[_0x7995('0x25')]=Hangup;
\ No newline at end of file
index 3a92eec..35de5c8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x919d=['scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','calleridname','name','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','milliseconds','diff','uniqueid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x919d,0xc1));var _0xd919=function(_0x4da772,_0x33bb8e){_0x4da772=_0x4da772-0x0;var _0x24fd35=_0x919d[_0x4da772];return _0x24fd35;};'use strict';var util=require(_0xd919('0x0'));var _=require(_0xd919('0x1'));var moment=require('moment');function getSeconds(_0x36a890,_0x4b26dc){var _0x305525=moment(_0x36a890)[_0xd919('0x2')](0x0);var _0x517725=moment(_0x4b26dc)[_0xd919('0x2')](0x0);return _0x305525[_0xd919('0x3')](_0x517725,'seconds');}function History(_0x46c416){this[_0xd919('0x4')]=_0x46c416['uniqueid'];this[_0xd919('0x5')]=_0x46c416['scheduledat']||undefined;this[_0xd919('0x6')]=_0x46c416[_0xd919('0x6')];this[_0xd919('0x7')]=_0x46c416[_0xd919('0x6')]==='outbound'?_0xd919('0x8'):_0x46c416[_0xd919('0x6')];this[_0xd919('0x9')]=_0x46c416['countbusyretry'];this[_0xd919('0xa')]=_0x46c416[_0xd919('0xa')];this[_0xd919('0xb')]=_0x46c416['countnoanswerretry'];this[_0xd919('0xc')]=_0x46c416['countbusyretry']+_0x46c416[_0xd919('0xa')]+_0x46c416[_0xd919('0xb')];this[_0xd919('0x8')]=_0x46c416[_0xd919('0x8')];this[_0xd919('0xd')]=_0x46c416[_0xd919('0xe')];this[_0xd919('0xf')]=_0x46c416['number'];this['starttime']=_0x46c416[_0xd919('0x10')];this[_0xd919('0x11')]=_0x46c416[_0xd919('0x11')];this[_0xd919('0x12')]=_0x46c416[_0xd919('0x11')];this[_0xd919('0x13')]=getSeconds(_0x46c416[_0xd919('0x11')],_0x46c416[_0xd919('0x10')]);this[_0xd919('0x14')]=0x0;this[_0xd919('0x15')]=0x0;this['callback']=_0x46c416[_0xd919('0x16')];this[_0xd919('0x17')]=_0x46c416[_0xd919('0x17')];this[_0xd919('0x18')]=_0x46c416[_0xd919('0x18')];this[_0xd919('0x19')]=_0x46c416[_0xd919('0x19')];this[_0xd919('0x1a')]=_0x46c416[_0xd919('0x1a')];this[_0xd919('0x1b')]=_0x46c416[_0xd919('0x1b')];this[_0xd919('0x1c')]=_0x46c416[_0xd919('0x1c')];this['VoiceQueueId']=_0x46c416[_0xd919('0x1d')];this['CampaignId']=_0x46c416[_0xd919('0x1e')];this[_0xd919('0x1f')]=_0x46c416[_0xd919('0x1f')]||'';this['originatecalleridname']=_0x46c416[_0xd919('0x20')]||'';}module['exports']=History;
\ No newline at end of file
+var _0x7ea6=['milliseconds','diff','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','calleridname','name','calleridnum','number','starttime','responsetime','endtime','holdtime','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment'];(function(_0xa7e122,_0x5c00a5){var _0xd308e0=function(_0x1aa7d4){while(--_0x1aa7d4){_0xa7e122['push'](_0xa7e122['shift']());}};_0xd308e0(++_0x5c00a5);}(_0x7ea6,0x11d));var _0x67ea=function(_0x31723a,_0x9323d1){_0x31723a=_0x31723a-0x0;var _0x23d5d7=_0x7ea6[_0x31723a];return _0x23d5d7;};'use strict';var util=require(_0x67ea('0x0'));var _=require(_0x67ea('0x1'));var moment=require(_0x67ea('0x2'));function getSeconds(_0x442d05,_0x30ef42){var _0x250b43=moment(_0x442d05)[_0x67ea('0x3')](0x0);var _0x2c6b84=moment(_0x30ef42)[_0x67ea('0x3')](0x0);return _0x250b43[_0x67ea('0x4')](_0x2c6b84,'seconds');}function History(_0x47ccd3){this[_0x67ea('0x5')]=_0x47ccd3[_0x67ea('0x5')];this[_0x67ea('0x6')]=_0x47ccd3[_0x67ea('0x6')]||undefined;this[_0x67ea('0x7')]=_0x47ccd3[_0x67ea('0x7')];this['campaigntype']=_0x47ccd3[_0x67ea('0x7')]===_0x67ea('0x8')?_0x67ea('0x9'):_0x47ccd3['type'];this[_0x67ea('0xa')]=_0x47ccd3[_0x67ea('0xa')];this[_0x67ea('0xb')]=_0x47ccd3[_0x67ea('0xb')];this['countnoanswerretry']=_0x47ccd3[_0x67ea('0xc')];this[_0x67ea('0xd')]=_0x47ccd3[_0x67ea('0xa')]+_0x47ccd3[_0x67ea('0xb')]+_0x47ccd3[_0x67ea('0xc')];this[_0x67ea('0x9')]=_0x47ccd3[_0x67ea('0x9')];this[_0x67ea('0xe')]=_0x47ccd3[_0x67ea('0xf')];this[_0x67ea('0x10')]=_0x47ccd3[_0x67ea('0x11')];this['starttime']=_0x47ccd3[_0x67ea('0x12')];this[_0x67ea('0x13')]=_0x47ccd3[_0x67ea('0x13')];this[_0x67ea('0x14')]=_0x47ccd3[_0x67ea('0x13')];this['ringtime']=getSeconds(_0x47ccd3[_0x67ea('0x13')],_0x47ccd3[_0x67ea('0x12')]);this[_0x67ea('0x15')]=0x0;this['talktime']=0x0;this['callback']=_0x47ccd3['callback'];this[_0x67ea('0x16')]=_0x47ccd3['callbackuniqueid'];this[_0x67ea('0x17')]=_0x47ccd3[_0x67ea('0x17')];this['recallme']=_0x47ccd3['recallme'];this[_0x67ea('0x18')]=_0x47ccd3['ContactId'];this['ListId']=_0x47ccd3[_0x67ea('0x19')];this['UserId']=_0x47ccd3[_0x67ea('0x1a')];this[_0x67ea('0x1b')]=_0x47ccd3[_0x67ea('0x1b')];this[_0x67ea('0x1c')]=_0x47ccd3[_0x67ea('0x1c')];this[_0x67ea('0x1d')]=_0x47ccd3[_0x67ea('0x1d')]||'';this['originatecalleridname']=_0x47ccd3[_0x67ea('0x1e')]||'';}module[_0x67ea('0x1f')]=History;
\ No newline at end of file
index 7c374ab..08a1d17 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1a85=['dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalLowerLimit','predictiveIntervalPauses','originated','Trunk','active','callerid','md5','format','voice:queue:%s','ivr','campaign:ivr:%s','campaign:save','predictiveIntervalTotalCalls','predictiveIntervalAvgTalktime','info','[checkGetDataPredictive][avgTalktime]','[checkGetDataPredictive][avgHoldtime]','[checkGetDataPredictive][totalCalls]','[checkGetDataPredictive][objIsEmpty]','[checkGetDataPredictive][obj]','[ErlangB]','merge','seconds','startProgressive','[freeVariablesPredictive]','handlePredictive','string','\x22%s\x22\x20<%s>','error','inspect','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','endtime','[uniqueid]','clearZombieChannels','hasOwnProperty','enqueue','isNil','Action','status','channel','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','catch','[averageHandleTime]\x20','rescheduleContact','[getContactDialer]\x20','getContactDialerIvr','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','ListId','UserId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','statedesc','HangupInAMD','membername','AMD','outboundAnswerCallsDay','state','Machine','amd','[syncMachine][createHistory]','[syncHangupInAMDIvr]','[syncMachineIvr][createHistory]','[syncMachineIvr]','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','[syncHangupIvr][createHistory]','cause-txt','Unknow','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','answertime','[syncQueueCallerAbandon]\x20[Drop]','droptime','YYYY-MM-DD\x20HH:mm:ss','responsetime','Drop','dropreason','TIMEOUT','queueCallerAbandonCreateState','Abandoned','CALLEREXIT','actionid','locked','paused','stateinterface','queueBooked','pick','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','idHopper','[Catch][Preview][syncQueueStatusComplete]','CampaignId','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock]','ContactId','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','syncCampaigns','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','Failure','timezones','TIMEZONE_UNKNOW','push','command','interval','content','indexOf','true','iftime\x20%s,%s','all','some','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','checkDialMethod','[syncQueueSummary]','checkIfTime','[syncCampaigns]','pow','replace','match','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','dialQueueTimeout','getCaller','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','XMD-','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','substring','dialCutDigit','from-sip','[originateError]:\x20%s','OriginateError','starttime','[originate][error]','getQueue','[callProgressDetecting]\x20','checkRetriveMax','countbusyretry','countcongestionretry','countnoanswerretry','dialNoAnswerMaxRetry','add','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','minutes','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','callProgressDetecting','[callProgressDetecting]','evt\x20is\x20undefine','reason','dialGlobalMaxRetry','stateGlobal','reason\x200\x20no\x20such\x20number....','createStateFinal','NoAnswer','countglobal','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','erlangAbandonmentRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','[startMethodPredictive][StartProgressive][Date]','[startMethodPredictive][StartProgressive][Loop]','erlangCalls','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][LowerLimitInterval]','Agent\x20free','agent\x20max\x20free\x20','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','[startMethodPredictive][StartPredictive][Repeat]','startMethodPredictive','getDataPredictive','getVoiceQueueRtPauses','[CatchErlangB]','dialPredictiveOptimization','outboundQueuePauses','busyFactor','[getDataPredictive]','check\x20failure','floor','erlangCallToSecond','[startMethodPredictive]','[startMethodPredictive][milliseconds]\x20','Failure\x20','checkContactBlack','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','temp','dialOrderByScheduledAt','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','reachable','RUNNING','tryOriginatePredictive','[handlePredictive][limitChannel]','getContactDialer','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','[abandonmentRate]','\x20m\x20=\x20','\x20Ts\x20=\x20','\x20Amax\x20=\x20','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','[busyFactor]','\x20interval\x20=\x20','\x20p\x20=\x20','\x20Umin\x20=\x20','exports','bluebird','uuid','moment','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','rrmemory','roundrobin','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBookedRR','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','name','Interval','INTERVAL_IS_NULL','isEmpty','Intervals','Error','stringify','milliseconds','diff','emit','outbound','strategy','available','loggedIn','pTalking','sumDuration','talking','total','type','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x1a85,0x178));var _0x51a8=function(_0x1f120c,_0x22cd8f){_0x1f120c=_0x1f120c-0x0;var _0x3f43f5=_0x1a85[_0x1f120c];return _0x3f43f5;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x51a8('0x0'));var uuid=require(_0x51a8('0x1'));var moment=require(_0x51a8('0x2'));var rr=require('rr');var md5=require('md5');var Redis=require('ioredis');var config=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var loggerBooked=require('../../../config/logger')(_0x51a8('0x6'));var loggerPredictive=require('../../../config/logger')(_0x51a8('0x7'));var loggerPredictiveCalls=require('../../../config/logger')(_0x51a8('0x8'));var loggerSyncQueueSummary=require(_0x51a8('0x4'))('syncQueueSummary');var ami=require(_0x51a8('0x9'));config['redis']=_['defaults'](config[_0x51a8('0xa')],{'host':_0x51a8('0xb'),'port':0x18eb});var io=require(_0x51a8('0xc'))(new Redis(config[_0x51a8('0xa')]));var cmHopper=require(_0x51a8('0xd'));var cmHopperFinal=require(_0x51a8('0xe'));var cmHopperHistory=require(_0x51a8('0xf'));var cmHopperBlack=require(_0x51a8('0x10'));var voiceQueueRt=require(_0x51a8('0x11'));var Action=require(_0x51a8('0x12'));var History=require(_0x51a8('0x13'));var Final=require(_0x51a8('0x14'));var AgentComplete=require(_0x51a8('0x15'));var QueueCallerAbandon=require(_0x51a8('0x16'));var Hangup=require(_0x51a8('0x17'));var ipAgi=process[_0x51a8('0x18')][_0x51a8('0x19')]||'127.0.0.1';var strategy={'rrmemory':_0x51a8('0x1a'),'roundrobin':_0x51a8('0x1b')};var Sequence=function(){};Sequence[_0x51a8('0x1c')]['enqueue']=function(_0xf4eb6e){this['tail']=this[_0x51a8('0x1d')]?this[_0x51a8('0x1d')][_0x51a8('0x1e')](_0xf4eb6e):_0xf4eb6e();};function Dialer(_0x2b0521,_0x3fbd02){this[_0x51a8('0x1f')]=new Sequence();this[_0x51a8('0x20')]=_0x3fbd02;this['voiceQueues']=_0x2b0521[_0x51a8('0x21')];this[_0x51a8('0x22')]=_0x2b0521[_0x51a8('0x22')];this[_0x51a8('0x23')]=_0x2b0521[_0x51a8('0x23')];this[_0x51a8('0x24')]=_0x2b0521['trunks'];this[_0x51a8('0x25')]=config[_0x51a8('0x25')]||0x2;this[_0x51a8('0x26')]={};this[_0x51a8('0x27')]={};this[_0x51a8('0x28')]={};this[_0x51a8('0x29')]={};this[_0x51a8('0x2a')]={};this[_0x51a8('0x2b')]={};this['startProgressive']={};this[_0x51a8('0x2c')]={};this['queueBooked']={};this[_0x51a8('0x2d')]={};ami['on'](_0x51a8('0x2e'),this[_0x51a8('0x2f')][_0x51a8('0x30')](this));ami['on']('queuecallerabandon',this[_0x51a8('0x31')]['bind'](this));ami['on']('originateresponse',this[_0x51a8('0x32')]['bind'](this));ami['on'](_0x51a8('0x33'),this[_0x51a8('0x34')][_0x51a8('0x30')](this));ami['on'](_0x51a8('0x35'),this[_0x51a8('0x36')][_0x51a8('0x30')](this));ami['on'](_0x51a8('0x37'),this[_0x51a8('0x38')]['bind'](this));ami['on'](_0x51a8('0x39'),this[_0x51a8('0x3a')][_0x51a8('0x30')](this));ami['on'](_0x51a8('0x3b'),this[_0x51a8('0x3c')][_0x51a8('0x30')](this));ami['on'](_0x51a8('0x3d'),this[_0x51a8('0x3e')][_0x51a8('0x30')](this));ami['on'](_0x51a8('0x3f'),this[_0x51a8('0x40')][_0x51a8('0x30')](this));this['loopCampaigns']();this[_0x51a8('0x41')]();}function isNotNull(_0x58cba0){return _0x58cba0!==null&&!_[_0x51a8('0x42')](_0x58cba0);}function checkIsLoggedIn(_0x3bc19a,_0x143f46){return function(){if(_0x143f46<=0x0){_0x3bc19a[_0x51a8('0x43')]=_0x51a8('0x44');throw _0x3bc19a['name']+_0x51a8('0x45');}};}function isActive(_0x4c67ff){return _0x4c67ff;}function checkIsActive(_0x41c4de,_0x24b39a){return function(){if(!isActive(_0x24b39a)){_0x41c4de[_0x51a8('0x43')]='NOT_ACTIVE';throw _0x41c4de[_0x51a8('0x46')]+'\x20NOT\x20Active';}};}function checkInterval(_0x25a858){return function(){if(!isNotNull(_0x25a858[_0x51a8('0x47')])){_0x25a858[_0x51a8('0x43')]=_0x51a8('0x48');throw _0x25a858[_0x51a8('0x46')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x25a858[_0x51a8('0x47')]['Intervals'])){_0x25a858[_0x51a8('0x43')]=_0x51a8('0x48');throw _0x25a858[_0x51a8('0x46')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x51a8('0x49')](_0x25a858[_0x51a8('0x47')][_0x51a8('0x4a')]))){_0x25a858[_0x51a8('0x43')]=_0x51a8('0x48');throw _0x25a858['name']+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x4d3114,_0x21b871,_0x299001){return{'action':_0x4d3114,'response':_0x21b871,'message':_0x299001};}function myreject(_0x4ec1db){return function(_0x35d7a1){return _0x4ec1db(msgResponse('[ifTime][Action]',_0x51a8('0x4b'),JSON[_0x51a8('0x4c')](_0x35d7a1)));};}function getSeconds(_0x433853,_0x1eef9d){var _0x256cda=moment(_0x433853)[_0x51a8('0x4d')](0x0);var _0x4e88cc=moment(_0x1eef9d)['milliseconds'](0x0);return _0x256cda[_0x51a8('0x4e')](_0x4e88cc,'seconds');}function emit(_0x5d7214,_0x5df144,_0x1d775e){io['to'](_0x5d7214)[_0x51a8('0x4f')](_0x5df144,_0x1d775e);}function emitVoiceQueueSummary(_0x3cbf97){if(_0x3cbf97['type']===_0x51a8('0x50')){var _0x25d772={'id':_0x3cbf97['id'],'name':_0x3cbf97[_0x51a8('0x46')],'strategy':_0x3cbf97[_0x51a8('0x51')],'answered':_0x3cbf97['answered'],'available':_0x3cbf97[_0x51a8('0x52')],'loggedIn':_0x3cbf97[_0x51a8('0x53')],'pTalking':_0x3cbf97[_0x51a8('0x54')],'sumBillable':_0x3cbf97['sumBillable'],'sumDuration':_0x3cbf97[_0x51a8('0x55')],'sumHoldTime':_0x3cbf97['sumHoldTime']||0x0,'talking':_0x3cbf97[_0x51a8('0x56')],'total':_0x3cbf97[_0x51a8('0x57')],'type':_0x3cbf97[_0x51a8('0x58')],'unmanaged':_0x3cbf97[_0x51a8('0x59')],'abandoned':_0x3cbf97['abandoned'],'waiting':_0x3cbf97[_0x51a8('0x5a')],'loggedInDb':_0x3cbf97[_0x51a8('0x5b')],'dialActive':_0x3cbf97[_0x51a8('0x5c')],'dialMethod':_0x3cbf97[_0x51a8('0x5d')],'dialOriginateCallerIdName':_0x3cbf97[_0x51a8('0x5e')],'dialOriginateCallerIdNumber':_0x3cbf97[_0x51a8('0x5f')],'dialOriginateTimeout':_0x3cbf97[_0x51a8('0x60')],'dialPrefix':_0x3cbf97[_0x51a8('0x61')],'outboundAnswerAgiCallsDay':_0x3cbf97[_0x51a8('0x62')],'outboundAnswerCallsDay':_0x3cbf97['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x3cbf97[_0x51a8('0x63')],'outboundBusyCallsDay':_0x3cbf97[_0x51a8('0x64')],'outboundCongestionCallsDay':_0x3cbf97['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x3cbf97['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x3cbf97[_0x51a8('0x65')],'outboundDropCallsDayTimeout':_0x3cbf97[_0x51a8('0x66')],'outboundNoAnswerCallsDay':_0x3cbf97[_0x51a8('0x67')],'outboundNoSuchCallsDay':_0x3cbf97[_0x51a8('0x68')],'outboundOriginateFailureCallsDay':_0x3cbf97[_0x51a8('0x69')],'outboundReCallsDay':_0x3cbf97[_0x51a8('0x6a')],'outboundRejectCallsDay':_0x3cbf97[_0x51a8('0x6b')],'outboundUnknownCallsDay':_0x3cbf97[_0x51a8('0x6c')],'predictiveIntervalAnsweredCalls':_0x3cbf97[_0x51a8('0x6d')],'predictiveIntervalAvgHoldtime':_0x3cbf97[_0x51a8('0x6e')],'predictiveIntervalAvgTalktime':_0x3cbf97['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x3cbf97[_0x51a8('0x6f')],'predictiveIntervalDroppedCallsTimeout':_0x3cbf97[_0x51a8('0x70')],'predictiveIntervalErlangCalls':_0x3cbf97[_0x51a8('0x71')],'predictiveIntervalErlangCallsDroppedCalls':_0x3cbf97[_0x51a8('0x72')],'predictiveIntervalHitRate':_0x3cbf97[_0x51a8('0x73')],'predictiveIntervalLowerLimit':_0x3cbf97[_0x51a8('0x74')],'predictiveIntervalMultiplicativeFactor':_0x3cbf97['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x3cbf97[_0x51a8('0x75')],'predictiveIntervalTotalCalls':_0x3cbf97['predictiveIntervalTotalCalls'],'message':_0x3cbf97[_0x51a8('0x43')],'originated':_0x3cbf97[_0x51a8('0x76')]};if(_0x3cbf97[_0x51a8('0x77')]){_0x25d772[_0x51a8('0x77')]={'id':_0x3cbf97[_0x51a8('0x77')]['id'],'name':_0x3cbf97['Trunk']['name'],'active':_0x3cbf97[_0x51a8('0x77')][_0x51a8('0x78')],'callerid':_0x3cbf97[_0x51a8('0x77')][_0x51a8('0x79')]};}if(_0x3cbf97[_0x51a8('0x47')]){_0x25d772['Interval']={'id':_0x3cbf97['Interval']['id'],'name':_0x3cbf97[_0x51a8('0x47')][_0x51a8('0x46')]};}var _0x24b205=md5(JSON[_0x51a8('0x4c')](_0x25d772));if(_0x3cbf97[_0x51a8('0x7a')]!==_0x24b205){_0x3cbf97[_0x51a8('0x7a')]=_0x24b205;emit(util[_0x51a8('0x7b')](_0x51a8('0x7c'),_0x25d772[_0x51a8('0x46')]),'voice_queue:save',_0x25d772);}}}function emitCampaignSummary(_0x5cb2cf){if(_0x5cb2cf['type']===_0x51a8('0x7d')){emit(util[_0x51a8('0x7b')](_0x51a8('0x7e'),_0x5cb2cf['name']),_0x51a8('0x7f'),_0x5cb2cf);}}function checkGetDataPredictive(_0x3d6cd7){if(isNotNull(_0x3d6cd7)){if(!_['isEmpty'](_0x3d6cd7)){if(_0x3d6cd7[_0x51a8('0x80')]>0x0){if(!_['isUndefined'](_0x3d6cd7['predictiveIntervalAvgTalktime'])&&_0x3d6cd7[_0x51a8('0x81')]>0x0){return!![];}else{loggerPredictive[_0x51a8('0x82')](_0x51a8('0x83'),JSON['stringify'](_0x3d6cd7));}if(!_['isUndefined'](_0x3d6cd7[_0x51a8('0x6e')])&&_0x3d6cd7['predictiveIntervalAvgHoldtime']>0x0){return!![];}else{loggerPredictive[_0x51a8('0x82')](_0x51a8('0x84'),JSON[_0x51a8('0x4c')](_0x3d6cd7));}}else{loggerPredictive[_0x51a8('0x82')](_0x51a8('0x85'),JSON[_0x51a8('0x4c')](_0x3d6cd7));}}else{loggerPredictive[_0x51a8('0x82')](_0x51a8('0x86'),JSON[_0x51a8('0x4c')](_0x3d6cd7));}}else{loggerPredictive['info'](_0x51a8('0x87'),JSON[_0x51a8('0x4c')](_0x3d6cd7));}return![];}function mergeDataErlangB(_0x823d14){return function(_0xd3c4){loggerPredictive['info'](_0x51a8('0x88'),JSON['stringify'](_0xd3c4));_[_0x51a8('0x89')](_0x823d14,_0xd3c4);};}function getDiff(_0x252c20){var _0x5c66e8=moment()['milliseconds'](0x0);var _0x2628d4=moment(_0x252c20)[_0x51a8('0x4d')](0x0);return _0x5c66e8[_0x51a8('0x4e')](_0x2628d4,_0x51a8('0x8a'));}function ifInterval(_0x269a01,_0x52f60f){if(_[_0x51a8('0x42')](_0x52f60f)){return![];}if(getDiff(_0x52f60f)<_0x269a01*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0xd1ddd5){if(isNotNull(_0xd1ddd5)){if(!_[_0x51a8('0x42')](_0xd1ddd5[_0x51a8('0x8b')])){_0xd1ddd5[_0x51a8('0x8b')]=undefined;loggerPredictive['info'](_0x51a8('0x8c'),_0x51a8('0x8b'),_0xd1ddd5[_0x51a8('0x46')]);}if(!_[_0x51a8('0x42')](_0xd1ddd5[_0x51a8('0x2b')])){_0xd1ddd5[_0x51a8('0x2b')]=undefined;loggerPredictive['info']('[freeVariablesPredictive]','startPredictive',_0xd1ddd5['name']);}if(!_[_0x51a8('0x42')](_0xd1ddd5[_0x51a8('0x8d')])){clearInterval(_0xd1ddd5['handlePredictive']);_0xd1ddd5[_0x51a8('0x8d')]=undefined;loggerPredictive['info'](_0x51a8('0x8c'),'handlePredictive',_0xd1ddd5[_0x51a8('0x46')]);}}}function erlangb(_0x472fdb,_0x53ed73){if(_0x53ed73===0x0){return 0x0;}var _0x4af9ab=0x1;for(var _0x5eb540=0x1;_0x5eb540<=_0x53ed73;_0x5eb540+=0x1){_0x4af9ab=0x1+_0x4af9ab*_0x5eb540/_0x472fdb;}return 0x1/_0x4af9ab;}function isVoiceQueueOutbound(_0x44d67a){return _0x44d67a===_0x51a8('0x50');}function isNotPreview(_0x283c8f){return _0x283c8f!==_0x51a8('0x20');}function isCampaignIvr(_0x149047){return _0x149047===_0x51a8('0x7d');}function getCallerId(_0x3fd347,_0x259153,_0x494e11){if(!_[_0x51a8('0x42')](_0x494e11)&&_0x51a8('0x8e')===typeof _0x494e11&&!_['isEmpty'](_0x494e11)){if(!_[_0x51a8('0x42')](_0x259153)&&_0x51a8('0x8e')===typeof _0x259153&&!_[_0x51a8('0x49')](_0x259153)){return util[_0x51a8('0x7b')](_0x51a8('0x8f'),_0x259153,_0x494e11);}return util[_0x51a8('0x7b')]('\x22%s\x22\x20<%s>',_0x494e11,_0x494e11);}if(!_['isUndefined'](_0x3fd347)&&_0x51a8('0x8e')===typeof _0x3fd347&&!_['isEmpty'](_0x3fd347)){return _0x3fd347;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x50a6ad,_0x4ec2ee){return function(_0x483a5a){freeVariablesPredictive(_0x4ec2ee);emitVoiceQueueSummary(_0x4ec2ee);emitCampaignSummary(_0x4ec2ee);loggerSyncQueueSummary[_0x51a8('0x90')](_0x50a6ad,util['inspect'](_0x483a5a,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1477af,_0x4772cd){return function(_0x1e7135){loggerPredictive[_0x51a8('0x90')](_0x1477af,JSON[_0x51a8('0x4c')](_0x1e7135));freeVariablesPredictive(_0x4772cd);};}function loggerCatch(_0x2d8b9b){return function(_0x28c539){logger[_0x51a8('0x90')](_0x2d8b9b,util[_0x51a8('0x91')](_0x28c539,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3d558d){return _0x3d558d&&!_['isUndefined'](_0x3d558d)&&_0x3d558d[_0x51a8('0x92')]>0x0;}function decremetOriginate(_0x220886){if(!_[_0x51a8('0x42')](_0x220886)&&_0x220886!==null){if(_0x220886['hasOwnProperty']('originated')){if(_0x220886['originated']>0x0){_0x220886[_0x51a8('0x76')]-=0x1;}else{logger[_0x51a8('0x90')](_0x51a8('0x93'));}}}else{logger[_0x51a8('0x90')](_0x51a8('0x94'));}}function checkContactLowerLimitOriginate(_0x1462b4,_0x351c22,_0x418445){if(_0x351c22>_0x418445){for(var _0x2813eb=0x0;_0x2813eb<_0x351c22-_0x418445;_0x2813eb+=0x1){decremetOriginate(_0x1462b4);}}}function loggerGetContactDialer(_0x462555,_0x45aabc,_0x3ba418){return function(_0x934ea9){checkContactLowerLimitOriginate(_0x45aabc,_0x3ba418,0x0);logger['error'](_0x462555,util[_0x51a8('0x91')](_0x934ea9,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x8b9b1b){return function(_0x52077e){if(isNotNull(_0x52077e)&&isNotNull(_0x52077e[0x0])){if(_0x52077e[0x0][_0x51a8('0x95')]>0x0){_0x8b9b1b['message']='RESCHEDULED_CONTACTS';logger['info'](_0x51a8('0x96')+_0x8b9b1b[_0x51a8('0x46')],_0x52077e[0x0][_0x51a8('0x95')],_0x51a8('0x97'));}else{_0x8b9b1b[_0x51a8('0x43')]=_0x51a8('0x98');logger[_0x51a8('0x82')]('[getContactDialer2][Empty]'+_0x8b9b1b['name']);}}};}function notSendMessagesQueue(_0x51b004){if(_0x51b004[_0x51a8('0x99')]){freeVariablesPredictive(_0x51b004);if(_0x51b004[_0x51a8('0x76')]===0x0&&_0x51b004[_0x51a8('0x56')]===0x0&&_0x51b004[_0x51a8('0x5a')]===0x0&&(_0x51b004[_0x51a8('0x54')]||0x0)===0x0){_0x51b004[_0x51a8('0x99')]=![];_0x51b004['available']=0x0;_0x51b004[_0x51a8('0x43')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x51a8('0x90')](_0x51a8('0x9a'),_0x51b004[_0x51a8('0x46')],_0x51a8('0x9b'));}else{_0x51b004[_0x51a8('0x43')]=_0x51a8('0x9c');loggerSyncQueueSummary[_0x51a8('0x90')](_0x51a8('0x9a'),_0x51b004[_0x51a8('0x46')],_0x51a8('0x9d'));}emitVoiceQueueSummary(_0x51b004);}}function notSendMessagesCampaign(_0x2289d9){if(_0x2289d9['sendMessageOneNotActive']){if(_0x2289d9['originated']===0x0){_0x2289d9[_0x51a8('0x99')]=![];_0x2289d9[_0x51a8('0x43')]=_0x51a8('0x9e');loggerSyncQueueSummary[_0x51a8('0x90')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x2289d9[_0x51a8('0x46')],'is\x20not\x20active');}else{_0x2289d9[_0x51a8('0x43')]=_0x51a8('0x9c');loggerSyncQueueSummary[_0x51a8('0x90')](_0x51a8('0x9f'),_0x2289d9[_0x51a8('0x46')],_0x51a8('0x9d'));}emitCampaignSummary(_0x2289d9);}}function createObjHistory(_0x19e12b,_0x3c623f,_0x379028,_0x53fc80,_0x15f2fc){_0x19e12b[_0x51a8('0x43')]=_0x379028;var _0x3e80db=new Action(_0x19e12b,_0x3c623f);var _0x353e90=new History(_0x3e80db);_0x353e90['state']=_0x53fc80;_0x353e90['statedesc']=_0x15f2fc;_0x353e90[_0x51a8('0xa0')]=_0x3e80db['starttime'];return _0x353e90;}Dialer['prototype']['loopClearZombieChannels']=function(){var _0xeb5d67=this;setInterval(function(){_0xeb5d67['clearZombieChannels'](_0xeb5d67['uniqueId'],_0x51a8('0xa1'));_0xeb5d67[_0x51a8('0xa2')](_0xeb5d67[_0x51a8('0x27')],'[actions]');},0x32c8);};Dialer[_0x51a8('0x1c')][_0x51a8('0xa2')]=function(_0x43f6f0,_0x5f20f7){var _0x3ac9c8=this;for(var _0x2a0fc6 in _0x43f6f0){if(_0x43f6f0[_0x51a8('0xa3')](_0x2a0fc6)){this[_0x51a8('0x1f')][_0x51a8('0xa4')](function(){if(!_[_0x51a8('0xa5')](_0x43f6f0[_0x2a0fc6])){return ami[_0x51a8('0xa6')]({'action':_0x51a8('0xa7'),'channel':_0x43f6f0[_0x2a0fc6][_0x51a8('0xa8')]})['catch'](function(_0x1da2ea){if(_0x1da2ea[_0x51a8('0x43')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x43f6f0[_0x2a0fc6]&&_0x43f6f0[_0x2a0fc6][_0x51a8('0x58')]!==_0x51a8('0x7d')){_0x3ac9c8['updateOriginated'](_0x3ac9c8[_0x51a8('0x21')][_0x43f6f0[_0x2a0fc6][_0x51a8('0xa9')]]);logger[_0x51a8('0x90')](_0x51a8('0xaa'),_0x5f20f7,_0x2a0fc6,_0x43f6f0[_0x2a0fc6][_0x51a8('0xa9')]);delete _0x43f6f0[_0x2a0fc6];}if(_0x43f6f0[_0x2a0fc6]&&_0x43f6f0[_0x2a0fc6]['type']===_0x51a8('0x7d')){_0x3ac9c8[_0x51a8('0xab')](_0x3ac9c8[_0x51a8('0x22')][_0x43f6f0[_0x2a0fc6][_0x51a8('0xa9')]]);logger['error'](_0x51a8('0xac'),_0x5f20f7,_0x2a0fc6,_0x43f6f0[_0x2a0fc6][_0x51a8('0xa9')]);delete _0x43f6f0[_0x2a0fc6];}},0x2328);}});}});}}};Dialer[_0x51a8('0x1c')][_0x51a8('0xad')]=function(_0x6cd464){return BPromise[_0x51a8('0xae')]()[_0x51a8('0xaf')](cmHopper[_0x51a8('0xad')](_0x6cd464))['catch'](loggerCatch(_0x51a8('0xb0')));};Dialer[_0x51a8('0x1c')]['checkIsBlackList']=function(_0x723274){return BPromise[_0x51a8('0xae')]()['then'](cmHopperBlack[_0x51a8('0xb1')](_0x723274))['catch'](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x51a8('0x1c')][_0x51a8('0xb2')]=function(_0x41e0b9){return BPromise['resolve']()['then'](cmHopperBlack[_0x51a8('0xb2')](_0x41e0b9))['catch'](loggerCatch(_0x51a8('0xb3')));};Dialer[_0x51a8('0x1c')][_0x51a8('0xb4')]=function(_0x3b737b){return BPromise[_0x51a8('0xae')]()[_0x51a8('0xaf')](cmHopperHistory[_0x51a8('0xb5')](_0x3b737b))[_0x51a8('0xb6')](loggerCatch(_0x51a8('0xb7')));};Dialer[_0x51a8('0x1c')][_0x51a8('0xb8')]=function(_0x195fa3){return BPromise[_0x51a8('0xae')]()[_0x51a8('0xaf')](cmHopper[_0x51a8('0xb8')](_0x195fa3))['catch'](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x51a8('0x1c')]['getContactDialer']=function(_0x4ea753,_0x59c5ba,_0x3dd98c,_0x4cac59){return BPromise[_0x51a8('0xae')]()[_0x51a8('0xaf')](cmHopper['getContactDialer'](_0x4ea753,_0x59c5ba,_0x3dd98c,_0x4cac59))[_0x51a8('0xb6')](loggerCatch(_0x51a8('0xb9')));};Dialer['prototype'][_0x51a8('0xba')]=function(_0x37a542,_0x50c5cf,_0x5ce141){return BPromise[_0x51a8('0xae')]()[_0x51a8('0xaf')](cmHopper[_0x51a8('0xba')](_0x37a542,_0x50c5cf,_0x5ce141))[_0x51a8('0xb6')](loggerCatch(_0x51a8('0xb9')));};Dialer[_0x51a8('0x1c')]['getVoiceQueueRtPauses']=function(_0x13dab3){return BPromise[_0x51a8('0xae')]()[_0x51a8('0xaf')](voiceQueueRt['getVoiceQueueRtPauses'](_0x13dab3))[_0x51a8('0xb6')](loggerCatch(_0x51a8('0xbb')));};Dialer[_0x51a8('0x1c')]['moveContactManagedDialer']=function(_0x149fa4){return BPromise[_0x51a8('0xae')]()['then'](cmHopper[_0x51a8('0xbc')](_0x149fa4))['catch'](loggerCatch(_0x51a8('0xbd')));};Dialer[_0x51a8('0x1c')][_0x51a8('0xbe')]=function(_0x1ab629){return BPromise[_0x51a8('0xae')]()[_0x51a8('0xaf')](cmHopperHistory[_0x51a8('0xbe')](_0x1ab629))[_0x51a8('0xb6')](loggerCatch('[createHistory]\x20'));};Dialer[_0x51a8('0x1c')][_0x51a8('0xab')]=function(_0x2de6b5){if(!_[_0x51a8('0x42')](_0x2de6b5)&&_0x2de6b5!==null){if(_0x2de6b5[_0x51a8('0xa3')]('originated')){if(_0x2de6b5['originated']>0x0){_0x2de6b5[_0x51a8('0x76')]-=0x1;}else{logger[_0x51a8('0x90')](_0x51a8('0xbf'));}}}else{logger[_0x51a8('0x90')](_0x51a8('0xc0'));}};Dialer['prototype'][_0x51a8('0xc1')]=function(_0x4ac423,_0x292949){var _0x1a0f3f=this;return function(_0x4d03c7){_0x1a0f3f[_0x51a8('0xab')](_0x292949);logger['error'](_0x4ac423,util[_0x51a8('0x91')](_0x4d03c7,{'showHidden':![],'depth':null}));};};Dialer[_0x51a8('0x1c')][_0x51a8('0xc2')]=function(_0x29563a,_0x35b703,_0x5243fd){var _0x145243={'state':0x19,'statedesc':_0x51a8('0xc3')};this['updateOriginated'](_0x35b703);this[_0x51a8('0xc4')](_[_0x51a8('0x89')](_0x145243,_['pick'](_0x5243fd,['ContactId',_0x51a8('0xc5'),_0x51a8('0xc6'),_0x51a8('0xc7'),'CampaignId'])),_0x51a8('0xc8'),_0x51a8('0xc9'));logger[_0x51a8('0x90')](_0x29563a);};Dialer[_0x51a8('0x1c')][_0x51a8('0xca')]=function(_0x21f861){return _0x21f861===_0x51a8('0xcb');};Dialer['prototype'][_0x51a8('0xcc')]=function(_0xa5074c){return!_[_0x51a8('0x42')](_0xa5074c)&&_0xa5074c&&!_[_0x51a8('0x42')](_0xa5074c['name'])&&!_['isUndefined'](_0xa5074c[_0x51a8('0x78')])&&_0xa5074c[_0x51a8('0x78')]&&(this['trunks'][util['format']('SIP/%s',_0xa5074c[_0x51a8('0x46')])]['status']==='reachable'||this['trunks'][util[_0x51a8('0x7b')]('SIP/%s',_0xa5074c[_0x51a8('0x46')])][_0x51a8('0xa7')]==='unmonitored');};Dialer['prototype'][_0x51a8('0xc4')]=function(_0x5ab6b2,_0x1f1171,_0x1ec771){this['createHistory'](_0x5ab6b2)[_0x51a8('0xb6')](loggerCatch(_0x1f1171));this[_0x51a8('0xbc')](_0x5ab6b2)['catch'](loggerCatch(_0x1ec771));};Dialer[_0x51a8('0x1c')][_0x51a8('0x3c')]=function(_0x223bd7){var _0x5d2e4f=this[_0x51a8('0x29')][_0x223bd7[_0x51a8('0xcd')]];var _0x19a773;if(!_['isNil'](_0x223bd7)&&!_['isNil'](_0x223bd7[_0x51a8('0xce')])&&!_[_0x51a8('0xa5')](_0x223bd7[_0x51a8('0xce')][_0x51a8('0xcf')])&&_0x223bd7[_0x51a8('0xd0')]===_0x51a8('0xd1')&&_0x5d2e4f){if(_0x5d2e4f[_0x51a8('0x58')]!==_0x51a8('0x7d')&&this[_0x51a8('0x21')][_0x5d2e4f[_0x51a8('0xa9')]][_0x51a8('0xd2')]&&_0x223bd7[_0x51a8('0xd3')]===_0x51a8('0xd4')){delete this['uniqueId'][_0x223bd7['uniqueid']];this[_0x51a8('0xab')](this[_0x51a8('0x21')][_0x5d2e4f[_0x51a8('0xa9')]]);this[_0x51a8('0x21')][_0x5d2e4f[_0x51a8('0xa9')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x5d2e4f[_0x51a8('0xa9')]][_0x51a8('0x62')]+=0x1;_0x19a773=new Hangup(_0x5d2e4f,_0x223bd7);_0x19a773['state']=0x12;_0x19a773[_0x51a8('0xd5')]=_0x51a8('0xd6');_0x19a773[_0x51a8('0xd7')]=_0x51a8('0xd8');this[_0x51a8('0xc4')](_0x19a773,'[syncHangupInAMD][createHistory]','[syncHangupInAMD]');}if(_0x5d2e4f[_0x51a8('0x58')]!=='ivr'&&this[_0x51a8('0x21')][_0x5d2e4f['queue']][_0x51a8('0xd2')]&&_0x223bd7[_0x51a8('0xd3')]==='MACHINE'){delete this[_0x51a8('0x29')][_0x223bd7[_0x51a8('0xcd')]];this[_0x51a8('0xab')](this[_0x51a8('0x21')][_0x5d2e4f['queue']]);this['voiceQueues'][_0x5d2e4f[_0x51a8('0xa9')]][_0x51a8('0xd9')]+=0x1;this[_0x51a8('0x21')][_0x5d2e4f[_0x51a8('0xa9')]]['outboundAnswerAgiCallsDay']+=0x1;_0x19a773=new Hangup(_0x5d2e4f,_0x223bd7);_0x19a773[_0x51a8('0xda')]=0x13;_0x19a773['statedesc']=_0x51a8('0xdb');_0x19a773['membername']=_0x51a8('0xd8');_0x19a773[_0x51a8('0xdc')]=!![];this[_0x51a8('0xc4')](_0x19a773,_0x51a8('0xdd'),'[syncMachine]');}if(_0x5d2e4f[_0x51a8('0x58')]==='ivr'&&this[_0x51a8('0x22')][_0x5d2e4f[_0x51a8('0xa9')]][_0x51a8('0xd2')]&&_0x223bd7['value']===_0x51a8('0xd4')){delete this[_0x51a8('0x29')][_0x223bd7[_0x51a8('0xcd')]];this['updateOriginated'](this['campaigns'][_0x5d2e4f[_0x51a8('0xa9')]]);_0x19a773=new Hangup(_0x5d2e4f,_0x223bd7);_0x19a773[_0x51a8('0xda')]=0x12;_0x19a773[_0x51a8('0xd5')]=_0x51a8('0xd6');_0x19a773['membername']='AMD';this[_0x51a8('0xc4')](_0x19a773,'[syncHangupInAMDIvr][createHistory]',_0x51a8('0xde'));}if(_0x5d2e4f[_0x51a8('0x58')]===_0x51a8('0x7d')&&this[_0x51a8('0x22')][_0x5d2e4f[_0x51a8('0xa9')]][_0x51a8('0xd2')]&&_0x223bd7[_0x51a8('0xd3')]==='MACHINE'){delete this['uniqueId'][_0x223bd7['uniqueid']];this[_0x51a8('0xab')](this[_0x51a8('0x22')][_0x5d2e4f[_0x51a8('0xa9')]]);_0x19a773=new Hangup(_0x5d2e4f,_0x223bd7);_0x19a773[_0x51a8('0xda')]=0x13;_0x19a773[_0x51a8('0xd5')]='Machine';_0x19a773[_0x51a8('0xd7')]='AMD';_0x19a773[_0x51a8('0xdc')]=!![];this[_0x51a8('0xc4')](_0x19a773,_0x51a8('0xdf'),_0x51a8('0xe0'));}}};Dialer['prototype']['syncHangup']=function(_0x35899e){var _0x542cc4=this[_0x51a8('0x29')][_0x35899e[_0x51a8('0xcd')]];var _0x292f74=this;var _0x3bced1;if(_0x542cc4&&_0x542cc4['type']===_0x51a8('0x7d')){delete this[_0x51a8('0x29')][_0x35899e[_0x51a8('0xcd')]];this[_0x51a8('0xab')](this[_0x51a8('0x22')][_0x542cc4[_0x51a8('0xa9')]]);this[_0x51a8('0x22')][_0x542cc4[_0x51a8('0xa9')]][_0x51a8('0xe1')]+=0x1;_0x3bced1=new Hangup(_0x542cc4,_0x35899e);this[_0x51a8('0xbe')](_0x3bced1)[_0x51a8('0xb6')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x51a8('0xbc')](_0x3bced1)[_0x51a8('0xb6')](loggerCatch(_0x51a8('0xe2')));}if(_0x542cc4&&_0x542cc4[_0x51a8('0x58')]!==_0x51a8('0x7d')&&isNotNull(this['voiceQueues'][_0x542cc4[_0x51a8('0xa9')]][_0x51a8('0xe3')])){delete this[_0x51a8('0x29')][_0x35899e['uniqueid']];this[_0x51a8('0xab')](this[_0x51a8('0x21')][_0x542cc4[_0x51a8('0xa9')]]);this['voiceQueues'][_0x542cc4[_0x51a8('0xa9')]][_0x51a8('0xd9')]+=0x1;this[_0x51a8('0x21')][_0x542cc4[_0x51a8('0xa9')]]['outboundAnswerAgiCallsDay']+=0x1;_0x3bced1=new Hangup(_0x542cc4,_0x35899e);_0x3bced1['state']=0x10;_0x3bced1['statedesc']=_0x51a8('0xe4');_0x3bced1['membername']='AGI';this[_0x51a8('0xbe')](_0x3bced1)[_0x51a8('0xb6')](loggerCatch(_0x51a8('0xe5')));this[_0x51a8('0xbc')](_0x3bced1)[_0x51a8('0xb6')](loggerCatch(_0x51a8('0xe2')));}if(_0x542cc4&&_0x542cc4['type']!==_0x51a8('0x7d')&&!isNotNull(this[_0x51a8('0x21')][_0x542cc4['queue']]['dialQueueProject'])){delete this[_0x51a8('0x29')][_0x35899e[_0x51a8('0xcd')]];this['updateOriginated'](this[_0x51a8('0x21')][_0x542cc4[_0x51a8('0xa9')]]);this[_0x51a8('0x21')][_0x542cc4[_0x51a8('0xa9')]][_0x51a8('0x6c')]+=0x1;_0x3bced1=new Hangup(_0x542cc4,_0x35899e);_0x3bced1[_0x51a8('0xda')]=0xc;_0x3bced1[_0x51a8('0xd5')]=_0x35899e[_0x51a8('0xe6')];_0x3bced1[_0x51a8('0xd7')]=_0x51a8('0xe7');this[_0x51a8('0xbe')](_0x3bced1)[_0x51a8('0xb6')](loggerCatch(_0x51a8('0xe5')));this[_0x51a8('0xbc')](_0x3bced1)[_0x51a8('0xb6')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x51a8('0x1c')][_0x51a8('0x34')]=function(_0x4ede29){var _0xbc8168=this[_0x51a8('0x29')][_0x4ede29['uniqueid']];var _0x2acb6f=this;if(this['voiceQueues'][_0x4ede29['queue']]){if(_0xbc8168&&_0xbc8168[_0x51a8('0x58')]!=='ivr'){delete this[_0x51a8('0x29')][_0x4ede29[_0x51a8('0xcd')]];this[_0x51a8('0x21')][_0x4ede29[_0x51a8('0xa9')]]['outboundAnswerCallsDay']+=0x1;var _0x47b8dd=new AgentComplete(_0xbc8168,_0x4ede29);if(_0x4ede29['reason']==='agent'){_0x47b8dd[_0x51a8('0xe8')]=this[_0x51a8('0x21')][_0x4ede29[_0x51a8('0xa9')]][_0x51a8('0xe9')]&&this[_0x51a8('0x21')][_0x4ede29[_0x51a8('0xa9')]][_0x51a8('0xea')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x51a8('0xbe')](_0x47b8dd)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x51a8('0xbc')](_0x47b8dd)[_0x51a8('0xb6')](loggerCatch(_0x51a8('0xeb')));}}};Dialer[_0x51a8('0x1c')][_0x51a8('0x2f')]=function(_0x3c76e4){if(this[_0x51a8('0x21')][_0x3c76e4[_0x51a8('0xa9')]]){if(this[_0x51a8('0x29')][_0x3c76e4['uniqueid']]&&this['uniqueId'][_0x3c76e4[_0x51a8('0xcd')]][_0x51a8('0x58')]!==_0x51a8('0x7d')){this[_0x51a8('0xab')](this[_0x51a8('0x21')][_0x3c76e4[_0x51a8('0xa9')]]);this[_0x51a8('0x29')][_0x3c76e4[_0x51a8('0xcd')]][_0x51a8('0xec')]=moment()[_0x51a8('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x27e0fe){this[_0x51a8('0xbe')](_0x27e0fe)[_0x51a8('0xb6')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x51a8('0xbc')](_0x27e0fe)[_0x51a8('0xb6')](loggerCatch(_0x51a8('0xed')));};Dialer[_0x51a8('0x1c')]['syncQueueCallerAbandon']=function(_0x3ea407){var _0x226c98=this['uniqueId'][_0x3ea407[_0x51a8('0xcd')]];var _0x538e86=this;if(this[_0x51a8('0x21')][_0x3ea407[_0x51a8('0xa9')]]){if(_0x226c98&&_0x226c98[_0x51a8('0x58')]!==_0x51a8('0x7d')){delete this['uniqueId'][_0x3ea407[_0x51a8('0xcd')]];this['updateOriginated'](this['voiceQueues'][_0x3ea407[_0x51a8('0xa9')]]);_0x226c98[_0x51a8('0xee')]=moment()[_0x51a8('0x7b')](_0x51a8('0xef'));var _0x396c7f=new QueueCallerAbandon(_0x226c98,_0x3ea407);if(getSeconds(_0x226c98[_0x51a8('0xee')],_0x226c98[_0x51a8('0xf0')])>=_0x226c98['dialQueueTimeout']){this[_0x51a8('0x21')][_0x3ea407[_0x51a8('0xa9')]][_0x51a8('0x70')]+=0x1;this[_0x51a8('0x21')][_0x3ea407['queue']][_0x51a8('0x66')]+=0x1;this[_0x51a8('0x21')][_0x3ea407[_0x51a8('0xa9')]][_0x51a8('0x72')]+=0x1;_0x396c7f['state']=0xa;_0x396c7f[_0x51a8('0xd5')]=_0x51a8('0xf1');_0x396c7f[_0x51a8('0xf2')]=_0x51a8('0xf3');_0x396c7f['agiafterat']=this[_0x51a8('0x21')][_0x3ea407[_0x51a8('0xa9')]][_0x51a8('0xe9')]?moment()[_0x51a8('0x7b')](_0x51a8('0xef')):undefined;this[_0x51a8('0xf4')](_0x396c7f);}else{this[_0x51a8('0x21')][_0x3ea407[_0x51a8('0xa9')]][_0x51a8('0x6f')]+=0x1;this[_0x51a8('0x21')][_0x3ea407['queue']]['outboundDropCallsDayCallersExit']+=0x1;_0x396c7f[_0x51a8('0xda')]=0xb;_0x396c7f['statedesc']=_0x51a8('0xf5');_0x396c7f[_0x51a8('0xf2')]=_0x51a8('0xf6');this[_0x51a8('0xf4')](_0x396c7f);}}}};Dialer[_0x51a8('0x1c')][_0x51a8('0x3a')]=function(_0xa6c131){if(this['actions'][_0xa6c131['uniqueid']]){this[_0x51a8('0x27')][_0xa6c131[_0x51a8('0xcd')]][_0x51a8('0xa8')]=_0xa6c131[_0x51a8('0xa8')];}if(this[_0x51a8('0x29')][_0xa6c131[_0x51a8('0xcd')]]){this[_0x51a8('0x29')][_0xa6c131[_0x51a8('0xcd')]][_0x51a8('0xa8')]=_0xa6c131[_0x51a8('0xa8')];}};Dialer[_0x51a8('0x1c')]['syncQueueMember']=function(_0x49b426){if(strategy[this[_0x51a8('0x21')][this[_0x51a8('0x27')][_0x49b426[_0x51a8('0xf7')]][_0x51a8('0xa9')]][_0x51a8('0x51')]]===_0x51a8('0x1b')){if(this['actions'][_0x49b426[_0x51a8('0xf7')]]&&_[_0x51a8('0xa5')](this['actions'][_0x49b426[_0x51a8('0xf7')]][_0x51a8('0xf8')])&&_0x49b426[_0x51a8('0xa7')]==='1'&&_0x49b426[_0x51a8('0xf9')]==='0'){if(this['agents'][_0x49b426[_0x51a8('0xfa')]]){if(!this[_0x51a8('0x23')][_0x49b426['stateinterface']]['locked']){this[_0x51a8('0x23')][_0x49b426[_0x51a8('0xfa')]][_0x51a8('0xf8')]=!![];this[_0x51a8('0x27')][_0x49b426[_0x51a8('0xf7')]][_0x51a8('0xf8')]=!![];this['actions'][_0x49b426[_0x51a8('0xf7')]]['stateinterface']=_0x49b426[_0x51a8('0xfa')];}}}}else if((strategy[this[_0x51a8('0x21')][this[_0x51a8('0x27')][_0x49b426['actionid']][_0x51a8('0xa9')]]['strategy']]||_0x51a8('0x1a'))===_0x51a8('0x1a')){if(this[_0x51a8('0x27')][_0x49b426['actionid']]){if(this[_0x51a8('0x23')][_0x49b426[_0x51a8('0xfa')]]){this[_0x51a8('0x27')][_0x49b426[_0x51a8('0xf7')]][_0x51a8('0xfa')]=_0x49b426[_0x51a8('0xfa')];if(_['isNil'](this['queueBooked'][this[_0x51a8('0x27')][_0x49b426[_0x51a8('0xf7')]][_0x51a8('0xa9')]])){this['queueBooked'][this[_0x51a8('0x27')][_0x49b426[_0x51a8('0xf7')]][_0x51a8('0xa9')]]=[];}this[_0x51a8('0xfb')][this['actions'][_0x49b426['actionid']][_0x51a8('0xa9')]]['push'](_[_0x51a8('0x89')](_[_0x51a8('0xfc')](this[_0x51a8('0x27')][_0x49b426[_0x51a8('0xf7')]],['idHopper',_0x51a8('0xfa')]),{'status':_0x49b426['status'],'paused':_0x49b426[_0x51a8('0xf9')]}));}}}};function unlockQueueStatus(_0x3c517f,_0x127ff5){setTimeout(function(){if(_['isUndefined'](_0x3c517f[_0x51a8('0xfd')])){loggerBooked[_0x51a8('0x90')](_0x51a8('0xfe'),_0x127ff5);}_0x3c517f[_0x51a8('0xfd')]=!![];loggerBooked[_0x51a8('0x82')](_0x51a8('0xff'),_0x127ff5,JSON['stringify'](_[_0x51a8('0xfc')](_0x3c517f,[_0x51a8('0x46'),_0x51a8('0xfd')])));},0x1f3);}Dialer['prototype'][_0x51a8('0x40')]=function(_0x160164){var _0x3b71c0=this;var _0x2b1bc8=_0x3b71c0[_0x51a8('0x21')][_0x3b71c0[_0x51a8('0x27')][_0x160164[_0x51a8('0xf7')]]['queue']];if(strategy[this[_0x51a8('0x21')][this[_0x51a8('0x27')][_0x160164[_0x51a8('0xf7')]][_0x51a8('0xa9')]][_0x51a8('0x51')]]===_0x51a8('0x1b')){if(this[_0x51a8('0x27')][_0x160164[_0x51a8('0xf7')]]&&this[_0x51a8('0x27')][_0x160164['actionid']][_0x51a8('0xfa')]){this['preview']['run'](this[_0x51a8('0x27')][_0x160164['actionid']][_0x51a8('0x100')],this[_0x51a8('0x27')][_0x160164['actionid']]['stateinterface'])[_0x51a8('0xb6')](function(_0x4f3549){logger[_0x51a8('0x90')](_0x51a8('0x101'),util['inspect'](_0x4f3549,{'showHidden':![],'depth':null}));})[_0x51a8('0x1e')](function(){_0x3b71c0['updateOriginated'](_0x3b71c0[_0x51a8('0x21')][_0x3b71c0[_0x51a8('0x27')][_0x160164['actionid']][_0x51a8('0xa9')]]);_0x3b71c0[_0x51a8('0x23')][_0x3b71c0[_0x51a8('0x27')][_0x160164[_0x51a8('0xf7')]][_0x51a8('0xfa')]]['locked']=![];delete _0x3b71c0['actions'][_0x160164[_0x51a8('0xf7')]];unlockQueueStatus(_0x2b1bc8);});}else{this[_0x51a8('0xab')](this['voiceQueues'][this[_0x51a8('0x27')][_0x160164['actionid']][_0x51a8('0xa9')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x51a8('0x27')][_0x160164[_0x51a8('0xf7')]]['ContactId'],'ListId':this['actions'][_0x160164[_0x51a8('0xf7')]]['ListId'],'VoiceQueueId':this[_0x51a8('0x27')][_0x160164[_0x51a8('0xf7')]][_0x51a8('0xc7')]||undefined,'CampaignId':this['actions'][_0x160164[_0x51a8('0xf7')]][_0x51a8('0x102')]||undefined})['catch'](loggerCatch(_0x51a8('0x103')));delete this[_0x51a8('0x27')][_0x160164[_0x51a8('0xf7')]];unlockQueueStatus(_0x2b1bc8);}}else if((strategy[this[_0x51a8('0x21')][this[_0x51a8('0x27')][_0x160164[_0x51a8('0xf7')]]['queue']][_0x51a8('0x51')]]||_0x51a8('0x1a'))==='rrmemory'){var _0x135e8d;if(this[_0x51a8('0x27')][_0x160164[_0x51a8('0xf7')]]&&!_[_0x51a8('0x49')](this[_0x51a8('0xfb')][this[_0x51a8('0x27')][_0x160164['actionid']][_0x51a8('0xa9')]])){if(this[_0x51a8('0x2d')][_0x3b71c0[_0x51a8('0x27')][_0x160164[_0x51a8('0xf7')]]['queue']]){this[_0x51a8('0x2d')][_0x3b71c0[_0x51a8('0x27')][_0x160164[_0x51a8('0xf7')]][_0x51a8('0xa9')]]=this[_0x51a8('0x2d')][this[_0x51a8('0x27')][_0x160164[_0x51a8('0xf7')]][_0x51a8('0xa9')]]?this['queueBookedRR'][this[_0x51a8('0x27')][_0x160164[_0x51a8('0xf7')]][_0x51a8('0xa9')]]:this[_0x51a8('0xfb')][this['actions'][_0x160164['actionid']]['queue']]?this['queueBooked'][this[_0x51a8('0x27')][_0x160164['actionid']][_0x51a8('0xa9')]][_0x51a8('0x104')]||0x0:0x0;}this[_0x51a8('0xfb')][this[_0x51a8('0x27')][_0x160164[_0x51a8('0xf7')]][_0x51a8('0xa9')]][_0x51a8('0x104')]=this[_0x51a8('0x2d')][this[_0x51a8('0x27')][_0x160164[_0x51a8('0xf7')]][_0x51a8('0xa9')]];for(var _0x30dbd3=0x0;_0x30dbd3<this[_0x51a8('0xfb')][this[_0x51a8('0x27')][_0x160164[_0x51a8('0xf7')]][_0x51a8('0xa9')]][_0x51a8('0x92')];_0x30dbd3+=0x1){_0x135e8d=rr(this['queueBooked'][this['actions'][_0x160164[_0x51a8('0xf7')]]['queue']]);this[_0x51a8('0x2d')][_0x3b71c0[_0x51a8('0x27')][_0x160164['actionid']][_0x51a8('0xa9')]]=this[_0x51a8('0xfb')][this[_0x51a8('0x27')][_0x160164[_0x51a8('0xf7')]][_0x51a8('0xa9')]]['_rr'];if(_0x135e8d[_0x51a8('0xa7')]==='1'&&_0x135e8d['paused']==='0'){break;}}if(!_['isNil'](_0x135e8d)){this[_0x51a8('0x23')][_0x135e8d[_0x51a8('0xfa')]][_0x51a8('0x105')]=_[_0x51a8('0x42')](this[_0x51a8('0x23')][_0x135e8d['stateinterface']]['unlockRR'])?!![]:this[_0x51a8('0x23')][_0x135e8d[_0x51a8('0xfa')]][_0x51a8('0x105')];}loggerBooked[_0x51a8('0x82')](_0x51a8('0x106'),_0x160164[_0x51a8('0xf7')],_0x51a8('0x107'),JSON['stringify'](_['pick'](this[_0x51a8('0x23')][_0x135e8d[_0x51a8('0xfa')]],[_0x51a8('0x46'),_0x51a8('0x105')])),_0x51a8('0x108'),JSON[_0x51a8('0x4c')](_0x135e8d['idHopper']));if(!_[_0x51a8('0xa5')](_0x135e8d)&&_0x135e8d[_0x51a8('0xa7')]==='1'&&_0x135e8d[_0x51a8('0xf9')]==='0'&&this[_0x51a8('0x23')][_0x135e8d['stateinterface']][_0x51a8('0x105')]){this[_0x51a8('0x23')][_0x135e8d[_0x51a8('0xfa')]][_0x51a8('0x105')]=![];this[_0x51a8('0xfb')][_0x3b71c0[_0x51a8('0x27')][_0x160164[_0x51a8('0xf7')]]['queue']]=[];this[_0x51a8('0x20')][_0x51a8('0x109')](_0x135e8d['idHopper'],_0x135e8d[_0x51a8('0xfa')])['catch'](function(_0x11f178){logger[_0x51a8('0x90')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x51a8('0x91')](_0x11f178,{'showHidden':![],'depth':null}));})[_0x51a8('0x1e')](function(){_0x3b71c0[_0x51a8('0xab')](_0x3b71c0[_0x51a8('0x21')][_0x3b71c0['actions'][_0x160164[_0x51a8('0xf7')]][_0x51a8('0xa9')]]);setTimeout(function(){_0x3b71c0[_0x51a8('0x23')][_0x135e8d[_0x51a8('0xfa')]]['unlockRR']=!![];loggerBooked['info'](_0x51a8('0x10a'),_0x160164[_0x51a8('0xf7')],_0x51a8('0x107'),JSON[_0x51a8('0x4c')](_[_0x51a8('0xfc')](_0x3b71c0[_0x51a8('0x23')][_0x135e8d[_0x51a8('0xfa')]],[_0x51a8('0x46'),_0x51a8('0x105')])),_0x51a8('0x108'),JSON[_0x51a8('0x4c')](_0x135e8d['idHopper']));},0xc7);delete _0x3b71c0[_0x51a8('0x27')][_0x160164[_0x51a8('0xf7')]];unlockQueueStatus(_0x2b1bc8,_0x160164[_0x51a8('0xf7')]);});}else{loggerBooked[_0x51a8('0x82')](_0x51a8('0x10b'));this[_0x51a8('0xab')](this[_0x51a8('0x21')][this['actions'][_0x160164[_0x51a8('0xf7')]][_0x51a8('0xa9')]]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x160164['actionid']][_0x51a8('0x10c')],'ListId':this[_0x51a8('0x27')][_0x160164[_0x51a8('0xf7')]]['ListId'],'VoiceQueueId':this[_0x51a8('0x27')][_0x160164[_0x51a8('0xf7')]][_0x51a8('0xc7')]||undefined,'CampaignId':this[_0x51a8('0x27')][_0x160164[_0x51a8('0xf7')]]['CampaignId']||undefined})[_0x51a8('0xb6')](loggerCatch(_0x51a8('0x103')));delete this[_0x51a8('0x27')][_0x160164[_0x51a8('0xf7')]];unlockQueueStatus(_0x2b1bc8);}}else{loggerBooked[_0x51a8('0x82')](_0x51a8('0x10d'));this[_0x51a8('0xab')](this[_0x51a8('0x21')][this[_0x51a8('0x27')][_0x160164[_0x51a8('0xf7')]][_0x51a8('0xa9')]]);this[_0x51a8('0xb8')]({'active':![],'ContactId':this[_0x51a8('0x27')][_0x160164['actionid']]['ContactId'],'ListId':this[_0x51a8('0x27')][_0x160164[_0x51a8('0xf7')]][_0x51a8('0xc5')],'VoiceQueueId':this[_0x51a8('0x27')][_0x160164[_0x51a8('0xf7')]][_0x51a8('0xc7')]||undefined,'CampaignId':this[_0x51a8('0x27')][_0x160164['actionid']][_0x51a8('0x102')]||undefined})['catch'](loggerCatch(_0x51a8('0x10e')));delete this[_0x51a8('0x27')][_0x160164[_0x51a8('0xf7')]];unlockQueueStatus(_0x2b1bc8);}}else{loggerBooked['info'](_0x51a8('0x10f'));this[_0x51a8('0xab')](this[_0x51a8('0x21')][this['actions'][_0x160164[_0x51a8('0xf7')]][_0x51a8('0xa9')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x51a8('0x27')][_0x160164['actionid']][_0x51a8('0x10c')],'ListId':this[_0x51a8('0x27')][_0x160164[_0x51a8('0xf7')]]['ListId'],'VoiceQueueId':this['actions'][_0x160164[_0x51a8('0xf7')]][_0x51a8('0xc7')]||undefined,'CampaignId':this['actions'][_0x160164['actionid']][_0x51a8('0x102')]||undefined})[_0x51a8('0xb6')](loggerCatch(_0x51a8('0x110')));delete this[_0x51a8('0x27')][_0x160164[_0x51a8('0xf7')]];unlockQueueStatus(_0x2b1bc8);}};Dialer[_0x51a8('0x1c')][_0x51a8('0x111')]=function(){var _0x45f7e0=this;setInterval(function(){_0x45f7e0[_0x51a8('0x112')]();},0x3e8);};Dialer[_0x51a8('0x1c')][_0x51a8('0x113')]=function(_0x36dc77){var _0x49c794=this;return function(){if(!_0x49c794[_0x51a8('0xcc')](_0x36dc77[_0x51a8('0x77')])){if(!_0x49c794[_0x51a8('0xcc')](_0x36dc77['TrunkBackup'])){_0x36dc77[_0x51a8('0x43')]=_0x51a8('0x114');throw _0x36dc77['name']+_0x51a8('0x115');}}};};Dialer[_0x51a8('0x1c')]['checkIfTime']=function(_0x3fe2f6,_0x4cb3e7,_0x6c884b,_0x3caf0d){var _0x3e890f=this;return function(){var _0x35c5c5=!![];return _0x3e890f[_0x51a8('0x116')](_0x3fe2f6,_0x4cb3e7,_0x6c884b,_0x3caf0d,_0x35c5c5);};};Dialer[_0x51a8('0x1c')]['checkIfTimeIntervals']=function(_0x34e0c5,_0x4838cb,_0x24005f,_0x1d1926){var _0x4b0cdd=this;return function(){var _0xf80e41=![];return _0x4b0cdd[_0x51a8('0x116')](_0x34e0c5[_0x51a8('0x4a')],_0x4838cb,_0x24005f,_0x1d1926,_0xf80e41);};};Dialer[_0x51a8('0x1c')][_0x51a8('0x116')]=function(_0x4b3f63,_0x29a1e0,_0x2a1c16,_0x2342be,_0x20f1b1){var _0x55b6a8=[];return new BPromise(function(_0x454b16,_0x3bb3e3){if(!isNotNull(_0x4b3f63)){_0x2342be['message']=_0x51a8('0x48');return _0x3bb3e3(msgResponse(_0x51a8('0x116'),'Failure',_0x2a1c16+'\x20Intervals\x20is\x20null\x20'));}if(_['isEmpty'](_0x4b3f63)){_0x2342be['message']='INTERVAL_IS_EMPTY';return _0x3bb3e3(msgResponse('ifTime',_0x51a8('0x117'),_0x2a1c16+'\x20Intervals\x20is\x20empty\x20'));}if(_0x29a1e0&&_['isUndefined'](config[_0x51a8('0x118')][_0x29a1e0])){_0x2342be[_0x51a8('0x43')]=_0x51a8('0x119');return _0x3bb3e3(msgResponse(_0x51a8('0x116'),_0x51a8('0x117'),_0x2a1c16+'\x20Timezone\x20unknow\x20'+_0x29a1e0));}if(_['isArray'](_0x4b3f63)){for(var _0x559b82=0x0;_0x559b82<_0x4b3f63[_0x51a8('0x92')];_0x559b82+=0x1){_0x55b6a8[_0x51a8('0x11a')](ami[_0x51a8('0xa6')]({'action':_0x51a8('0x11b'),'command':util['format']('iftime\x20%s,%s',_0x4b3f63[_0x559b82][_0x51a8('0x11c')],!_[_0x51a8('0x42')](config[_0x51a8('0x118')][_0x29a1e0])?_0x29a1e0:'')})[_0x51a8('0xaf')](function(_0x585fa5){return _0x585fa5[_0x51a8('0x11d')][_0x51a8('0x11e')](_0x51a8('0x11f'))>=0x0?!![]:![];})[_0x51a8('0xb6')](myreject(_0x3bb3e3)));}}else{_0x55b6a8[_0x51a8('0x11a')](ami[_0x51a8('0xa6')]({'action':_0x51a8('0x11b'),'command':util[_0x51a8('0x7b')](_0x51a8('0x120'),_0x4b3f63,!_[_0x51a8('0x42')](config[_0x51a8('0x118')][_0x29a1e0])?_0x29a1e0:'')})[_0x51a8('0xaf')](function(_0x5197e5){return _0x5197e5[_0x51a8('0x11d')][_0x51a8('0x11e')](_0x51a8('0x11f'))>=0x0?!![]:![];})[_0x51a8('0xb6')](myreject(_0x3bb3e3)));}BPromise[_0x51a8('0x121')](_0x55b6a8)['then'](function(_0x21a15f){var _0x27a9fc=_[_0x51a8('0x122')](_0x21a15f);if(_0x27a9fc){return _0x454b16(_0x27a9fc);}else{_0x2342be[_0x51a8('0x43')]=_0x20f1b1?'GLOBAL_INTERVAL_IS_OVERTIME':_0x51a8('0x123');return _0x3bb3e3(msgResponse('[ifTime][promiseAll]',_0x51a8('0x117'),_0x51a8('0x124')+_0x20f1b1+'\x20'+_0x2a1c16+_0x51a8('0x125')+util[_0x51a8('0x91')](_0x4b3f63,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x29a1e0));}})[_0x51a8('0xb6')](function(_0xc345f4){return _0x3bb3e3(msgResponse(_0x51a8('0x116'),_0x51a8('0x117'),JSON[_0x51a8('0x4c')](_0xc345f4)));});});};Dialer[_0x51a8('0x1c')]['checkDialMethod']=function(_0x51f159){var _0x4642a6=this;return function(){switch(_0x51f159[_0x51a8('0x5d')]){case _0x51a8('0x126'):freeVariablesPredictive(_0x51f159);_0x4642a6[_0x51a8('0x127')](_0x51f159,0x1);break;case _0x51a8('0x128'):freeVariablesPredictive(_0x51f159);_0x4642a6[_0x51a8('0x127')](_0x51f159,_0x51f159[_0x51a8('0x129')]);break;case _0x51a8('0x7'):_0x4642a6[_0x51a8('0x7')](_0x51f159);break;case _0x51a8('0x6'):freeVariablesPredictive(_0x51f159);_0x4642a6[_0x51a8('0x127')](_0x51f159,0x1);break;default:freeVariablesPredictive(_0x51f159);logger[_0x51a8('0x90')](_0x51a8('0x12a'),_0x51f159[_0x51a8('0x46')],_0x51a8('0x12b'));}};};Dialer[_0x51a8('0x1c')][_0x51a8('0x12c')]=function(_0x2d5590){var _0x8cffcb=this;return function(){_0x8cffcb[_0x51a8('0x12d')](_0x2d5590);};};Dialer[_0x51a8('0x1c')][_0x51a8('0x36')]=function(_0x42b73c){var _0x4a4a59=this;if(isNotPreview(_0x42b73c[_0x51a8('0x5d')])){if(isVoiceQueueOutbound(_0x42b73c[_0x51a8('0x58')])&&isActive(_0x42b73c[_0x51a8('0x5c')])){_0x42b73c[_0x51a8('0x99')]=!![];BPromise[_0x51a8('0xae')]()[_0x51a8('0xaf')](checkIsLoggedIn(_0x42b73c,_0x42b73c[_0x51a8('0x53')]))[_0x51a8('0xaf')](checkIsActive(_0x42b73c,_0x42b73c[_0x51a8('0x5c')]))[_0x51a8('0xaf')](checkInterval(_0x42b73c))[_0x51a8('0xaf')](_0x4a4a59[_0x51a8('0x113')](_0x42b73c))[_0x51a8('0xaf')](_0x4a4a59['checkIfTime'](_0x42b73c[_0x51a8('0x12e')],_0x42b73c[_0x51a8('0x12f')],_0x42b73c[_0x51a8('0x46')],_0x42b73c))[_0x51a8('0xaf')](_0x4a4a59[_0x51a8('0x130')](_0x42b73c['Interval'],_0x42b73c['dialTimezone'],_0x42b73c['name'],_0x42b73c))['then'](_0x4a4a59[_0x51a8('0x131')](_0x42b73c))['catch'](loggerCatchQueueSummary(_0x51a8('0x132'),_0x42b73c));}else{notSendMessagesQueue(_0x42b73c);}}else{freeVariablesPredictive(_0x42b73c);}};Dialer[_0x51a8('0x1c')]['syncCampaigns']=function(){var _0x51a382=this;var _0xc53741;for(var _0x5f01d1 in this[_0x51a8('0x22')]){if(this[_0x51a8('0x22')]['hasOwnProperty'](_0x5f01d1)){_0xc53741=this[_0x51a8('0x22')][_0x5f01d1];if(isCampaignIvr(_0xc53741[_0x51a8('0x58')])&&isActive(_0xc53741[_0x51a8('0x78')])){_0xc53741[_0x51a8('0x99')]=!![];BPromise[_0x51a8('0xae')]()[_0x51a8('0xaf')](checkIsActive(_0xc53741,_0xc53741['active']))[_0x51a8('0xaf')](checkInterval(_0xc53741))[_0x51a8('0xaf')](_0x51a382[_0x51a8('0x113')](_0xc53741))[_0x51a8('0xaf')](_0x51a382[_0x51a8('0x133')](_0xc53741[_0x51a8('0x12e')],_0xc53741['dialTimezone'],_0xc53741[_0x51a8('0x46')],_0xc53741))[_0x51a8('0xaf')](_0x51a382['checkIfTimeIntervals'](_0xc53741[_0x51a8('0x47')],_0xc53741[_0x51a8('0x12f')],_0xc53741[_0x51a8('0x46')],_0xc53741))[_0x51a8('0xaf')](_0x51a382[_0x51a8('0x12c')](_0xc53741))[_0x51a8('0xb6')](loggerCatchQueueSummary(_0x51a8('0x134'),_0xc53741));}else{notSendMessagesCampaign(_0xc53741);}}}};function getCallerIdRandom(_0x34afcb,_0x3b4b56){var _0x1f6205,_0x183678,_0x2aadd5;if(_0x3b4b56<=0x0){_0x3b4b56=0x1;}_0x1f6205=new RegExp('\x5cw{0,'+_0x3b4b56+'}$');_0x183678=Math[_0x51a8('0x135')](0xa,_0x3b4b56-0x1);_0x2aadd5=Math[_0x51a8('0x135')](0xa,_0x3b4b56)-0x1;return util[_0x51a8('0x7b')]('%s',_[_0x51a8('0x136')](_0x34afcb,_0x1f6205,_['random'](_0x183678,_0x2aadd5)));}function extractCalleridName(_0x20c51e){var _0x5c0732=_0x20c51e[_0x51a8('0x137')](/"(.*?)"/);return _0x5c0732?_0x5c0732[0x1]:_0x20c51e;}function extractCalleridNumber(_0x1a6be5){var _0x4edb62=_0x1a6be5[_0x51a8('0x137')](/<(.*?)>/);return _0x4edb62?_0x4edb62[0x1]:_0x1a6be5;}Dialer[_0x51a8('0x1c')]['actionOriginate']=function(_0x26ff21,_0x4fdad0){var _0x3c3ba4=this;var _0x31da6e=uuid['v4']();this[_0x51a8('0x27')][_0x31da6e]=new Action(_0x26ff21,_0x4fdad0,_0x31da6e);return new BPromise(function(_0x5aebc3,_0x4d4451){if(_[_0x51a8('0x42')](_0x26ff21)&&_0x51a8('0x138')!==typeof _0x26ff21){return _0x4d4451(msgResponse(_0x51a8('0x139'),_0x51a8('0x117'),_0x51a8('0x13a')));}if(_[_0x51a8('0x42')](_0x4fdad0[_0x51a8('0x13b')][_0x51a8('0x13c')])||_0x4fdad0['Contact'][_0x51a8('0x13c')]===null){return _0x4d4451(msgResponse(_0x51a8('0x139'),_0x51a8('0x117'),_0x51a8('0x13d')));}var _0x502a92={'XMD-CALLERID':_0x3c3ba4[_0x51a8('0x27')][_0x31da6e]['getCaller'](),'XMD-AGI':_0x26ff21[_0x51a8('0xe3')]?util[_0x51a8('0x7b')](_0x51a8('0x13e'),ipAgi,_0x26ff21['dialQueueProject']):_0x51a8('0x13f'),'XMD-AGIAFTER':_0x26ff21[_0x51a8('0xe9')]?util[_0x51a8('0x7b')]('\x22agi://%s/square,%s\x22',ipAgi,_0x26ff21['dialQueueProject2']):_0x51a8('0x13f'),'XMD-QUEUE':_0x26ff21[_0x51a8('0x58')]===_0x51a8('0x50')?util[_0x51a8('0x7b')]('\x22%s,%s%s,,,%s\x22',_0x26ff21[_0x51a8('0x46')],_0x26ff21[_0x51a8('0x140')]||'',_0x26ff21[_0x51a8('0xea')]?'c':'',_0x26ff21[_0x51a8('0x141')]||0x3):'NONE','XMD-CONTACTID':_0x4fdad0[_0x51a8('0x10c')],'XMD-CDRTYPE':_0x51a8('0x5'),'CALLERID(all)':_0x3c3ba4[_0x51a8('0x27')][_0x31da6e][_0x51a8('0x142')](),'XMD-AMD':_0x26ff21[_0x51a8('0xd2')]?_0x51a8('0x143'):_0x51a8('0x13f'),'XMD-DESTINATION':_0x51a8('0xd1')};if(_0x26ff21[_0x51a8('0xd2')]){_0x502a92[_0x51a8('0x144')]=_0x26ff21[_0x51a8('0x145')]||0x9c4;_0x502a92['XMD-AMDGREETING']=_0x26ff21[_0x51a8('0x146')]||0x5dc;_0x502a92[_0x51a8('0x147')]=_0x26ff21[_0x51a8('0x148')]||0x320;_0x502a92['XMD-AMDTOTALANALYSISTIME']=_0x26ff21[_0x51a8('0x149')]||0x1388;_0x502a92['XMD-AMDMINWORDLENGTH']=_0x26ff21[_0x51a8('0x14a')]||0x64;_0x502a92[_0x51a8('0x14b')]=_0x26ff21[_0x51a8('0x14c')]||0x32;_0x502a92['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x26ff21[_0x51a8('0x14d')]||0x3;_0x502a92[_0x51a8('0x14e')]=_0x26ff21[_0x51a8('0x14f')]||0x100;_0x502a92['XMD-AMDMAXIMUMWORDLENGTH']=_0x26ff21[_0x51a8('0x150')]||0x1388;}if(_0x26ff21[_0x51a8('0x58')]==='outbound'){_0x502a92[_0x51a8('0x151')]=_0x4fdad0['VoiceQueueId'];}else{_0x502a92[_0x51a8('0x152')]=_0x4fdad0[_0x51a8('0x102')];}for(var _0x1b773a in _0x4fdad0[_0x51a8('0x13b')]){if(_0x4fdad0[_0x51a8('0x13b')][_0x51a8('0xa3')](_0x1b773a)){if(isNotNull(_0x4fdad0['Contact'][_0x1b773a])&&_0x1b773a!=='id'&&_0x1b773a!==_0x51a8('0x153')&&_0x1b773a!==_0x51a8('0x154')&&_0x1b773a!==_0x51a8('0x155')){_0x502a92[util[_0x51a8('0x7b')]('%s%s',_0x51a8('0x156'),_['toUpper'](_0x1b773a))]=_0x4fdad0['Contact'][_0x1b773a];}}}var _0x5daff2=_0x3c3ba4[_0x51a8('0xcc')](_0x26ff21['Trunk'])?getCallerId(_0x26ff21[_0x51a8('0x77')][_0x51a8('0x79')],_0x26ff21[_0x51a8('0x5e')],_0x26ff21[_0x51a8('0x157')]>0x0?getCallerIdRandom(_0x26ff21[_0x51a8('0x5f')],_0x26ff21[_0x51a8('0x157')]):_0x26ff21[_0x51a8('0x5f')]):getCallerId(_[_0x51a8('0xa5')](_0x26ff21[_0x51a8('0x158')])?_0x26ff21['Trunk']['callerid']:_0x26ff21[_0x51a8('0x158')][_0x51a8('0x79')],_0x26ff21[_0x51a8('0x5e')],_0x26ff21[_0x51a8('0x157')]>0x0?getCallerIdRandom(_0x26ff21[_0x51a8('0x5f')],_0x26ff21[_0x51a8('0x157')]):_0x26ff21[_0x51a8('0x5f')]);if(_0x5daff2){_0x502a92[_0x51a8('0x159')]=_0x3c3ba4[_0x51a8('0x27')][_0x31da6e]['originatecalleridname']=extractCalleridName(_0x5daff2);_0x502a92[_0x51a8('0x15a')]=_0x3c3ba4[_0x51a8('0x27')][_0x31da6e][_0x51a8('0x15b')]=extractCalleridNumber(_0x5daff2);}return ami['Action']({'actionid':_0x31da6e,'action':_0x51a8('0x139'),'channel':_0x3c3ba4[_0x51a8('0xcc')](_0x26ff21['Trunk'])?util[_0x51a8('0x7b')](_0x51a8('0x15c'),_0x26ff21[_0x51a8('0x77')]['name'],isNotNull(_0x26ff21[_0x51a8('0x61')])?_0x26ff21[_0x51a8('0x61')][_0x51a8('0x15d')]()||'':'',_0x26ff21['dialCutDigit']>0x0?_0x4fdad0[_0x51a8('0x13b')]['phone'][_0x51a8('0x15e')](_0x26ff21[_0x51a8('0x15f')]):_0x4fdad0[_0x51a8('0x13b')][_0x51a8('0x13c')]):util[_0x51a8('0x7b')](_0x51a8('0x15c'),_['isNil'](_0x26ff21[_0x51a8('0x158')])?_0x26ff21['Trunk'][_0x51a8('0x46')]:_0x26ff21[_0x51a8('0x158')]['name'],isNotNull(_0x26ff21[_0x51a8('0x61')])?_0x26ff21[_0x51a8('0x61')]['trim']()||'':'',_0x26ff21[_0x51a8('0x15f')]>0x0?_0x4fdad0[_0x51a8('0x13b')][_0x51a8('0x13c')][_0x51a8('0x15e')](_0x26ff21[_0x51a8('0x15f')]):_0x4fdad0['Contact']['phone']),'callerid':_0x5daff2,'Exten':_0x51a8('0xd1'),'Context':_0x51a8('0x160'),'Priority':'1','variable':_0x502a92,'timeout':(_0x26ff21[_0x51a8('0x60')]||0x1e)*0x3e8,'async':!![],'channelid':_0x31da6e})[_0x51a8('0xaf')](function(_0x15208e){return _0x5aebc3(_0x15208e);})[_0x51a8('0xb6')](function(_0x518d03){_0x26ff21[_0x51a8('0x69')]+=0x1;var _0x49d398=new History(_0x3c3ba4[_0x51a8('0x27')][_0x31da6e]);logger['error'](util['format'](_0x51a8('0x161'),JSON[_0x51a8('0x4c')](_0x518d03)));_0x49d398[_0x51a8('0xda')]=0xe;_0x49d398[_0x51a8('0xd5')]=_0x51a8('0x162');_0x49d398[_0x51a8('0x163')]=moment()[_0x51a8('0x7b')](_0x51a8('0xef'));_0x49d398[_0x51a8('0xa0')]=_0x49d398[_0x51a8('0x163')];_0x3c3ba4[_0x51a8('0xbe')](_0x49d398)['catch'](loggerCatch(_0x51a8('0x164')));_0x3c3ba4['moveContactManagedDialer'](_0x49d398)[_0x51a8('0xb6')](loggerCatch(_0x51a8('0x164')))[_0x51a8('0x1e')](function(){delete _0x3c3ba4[_0x51a8('0x27')][_0x31da6e];return _0x4d4451(msgResponse('originate',_0x51a8('0x4b'),'originate\x20action\x20Error'));});});});};Dialer['prototype']['syncOriginateResponse']=function(_0x264087){var _0x30c558=this['actions'][_0x264087[_0x51a8('0xf7')]];var _0x3ec1d6=this;if(_0x30c558){delete this[_0x51a8('0x27')][_0x264087[_0x51a8('0xf7')]];_0x30c558['responsetime']=moment()['format'](_0x51a8('0xef'));var _0x1f41c3=_0x30c558[_0x51a8('0x58')]==='ivr'?this['campaigns'][_0x30c558[_0x51a8('0xa9')]]:this[_0x51a8('0x21')][_0x30c558[_0x51a8('0x165')]()];if(!this['isSuccess'](_0x264087['response'])){this[_0x51a8('0xab')](_0x1f41c3);return this['callProgressDetecting'](_0x30c558,_0x1f41c3,_0x264087)[_0x51a8('0xaf')](function(_0x4adfad){})[_0x51a8('0xb6')](loggerCatch(_0x51a8('0x166')));}else{this[_0x51a8('0x29')][_0x264087[_0x51a8('0xcd')]]=_0x30c558;}}};Dialer['prototype'][_0x51a8('0x167')]=function(_0xcb2223,_0x150d20,_0xdf73f5){var _0x33f392=new History(_0x150d20);if(_0x33f392[_0x51a8('0x168')]+_0x33f392[_0x51a8('0x169')]+_0x33f392[_0x51a8('0x16a')]>=_0xdf73f5['dialGlobalMaxRetry']-0x1){return!![];}switch(_0xcb2223){case 0x3:if(_0x33f392[_0x51a8('0x16a')]>=_0xdf73f5[_0x51a8('0x16b')]-0x1){return!![];}else{this[_0x51a8('0xb8')]({'active':![],'countnoanswerretry':_0x33f392['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x51a8('0x16c')](_0xdf73f5[_0x51a8('0x16d')],'minutes')[_0x51a8('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x33f392['ContactId'],'ListId':_0x33f392[_0x51a8('0xc5')],'VoiceQueueId':_0x33f392['VoiceQueueId']||undefined,'CampaignId':_0x33f392[_0x51a8('0x102')]||undefined})[_0x51a8('0xb6')](loggerCatch(_0x51a8('0x16e')));}break;case 0x5:if(_0x33f392[_0x51a8('0x168')]>=_0xdf73f5[_0x51a8('0x16f')]-0x1){return!![];}else{this[_0x51a8('0xb8')]({'active':![],'countbusyretry':_0x33f392[_0x51a8('0x168')]+=0x1,'scheduledat':moment()[_0x51a8('0x16c')](_0xdf73f5[_0x51a8('0x170')],_0x51a8('0x171'))[_0x51a8('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x33f392[_0x51a8('0x10c')],'ListId':_0x33f392['ListId'],'VoiceQueueId':_0x33f392[_0x51a8('0xc7')]||undefined,'CampaignId':_0x33f392[_0x51a8('0x102')]||undefined})[_0x51a8('0xb6')](loggerCatch(_0x51a8('0x172')));}break;case 0x8:if(_0x33f392[_0x51a8('0x169')]>=_0xdf73f5[_0x51a8('0x173')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countcongestionretry':_0x33f392[_0x51a8('0x169')]+=0x1,'scheduledat':moment()[_0x51a8('0x16c')](_0xdf73f5[_0x51a8('0x174')],_0x51a8('0x171'))[_0x51a8('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x33f392[_0x51a8('0x10c')],'ListId':_0x33f392[_0x51a8('0xc5')],'VoiceQueueId':_0x33f392[_0x51a8('0xc7')]||undefined,'CampaignId':_0x33f392[_0x51a8('0x102')]||undefined})[_0x51a8('0xb6')](loggerCatch('[rescheduleContact]\x20[Congestion]'));}break;default:return!![];}};Dialer[_0x51a8('0x1c')][_0x51a8('0x175')]=function(_0x5c9aa2,_0x5510cf,_0x7f0d59){var _0x20cf96=this;var _0x5bcedd=new History(_0x5c9aa2);return new BPromise(function(_0x59479a,_0x5f4986){if(_[_0x51a8('0x42')](_0x5510cf)&&_0x51a8('0x138')!==typeof _0x5510cf){return _0x5f4986(msgResponse(_0x51a8('0x176'),_0x51a8('0x117'),'entity\x20is\x20undefine'));}if(_[_0x51a8('0x42')](_0x7f0d59)&&_0x51a8('0x138')!==typeof _0x7f0d59){return _0x5f4986(msgResponse(_0x51a8('0x176'),_0x51a8('0x117'),_0x51a8('0x177')));}switch(_0x7f0d59[_0x51a8('0x178')]){case'0':_0x5510cf['outboundNoSuchCallsDay']+=0x1;_0x5bcedd[_0x51a8('0xda')]=0x0;_0x5bcedd[_0x51a8('0xd5')]='NoSuchNumber';_0x20cf96['createHistory'](_0x5bcedd)[_0x51a8('0xb6')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x20cf96['checkRetriveMax'](0x0,_0x5c9aa2,_0x5510cf)){if(_0x5bcedd['countbusyretry']+_0x5bcedd['countcongestionretry']+_0x5bcedd[_0x51a8('0x16a')]>=_0x5510cf[_0x51a8('0x179')]){_0x20cf96[_0x51a8('0x17a')](_0x5bcedd,_0x59479a,_0x5f4986,_0x51a8('0x17b'));}else{_0x20cf96[_0x51a8('0x17c')](_0x5bcedd,_0x59479a,_0x5f4986,_0x51a8('0x17b'));}}break;case'3':_0x5510cf['outboundNoAnswerCallsDay']+=0x1;_0x5bcedd[_0x51a8('0xda')]=0x3;_0x5bcedd[_0x51a8('0xd5')]=_0x51a8('0x17d');_0x5bcedd[_0x51a8('0x16a')]+=0x1;_0x5bcedd[_0x51a8('0x17e')]+=0x1;_0x20cf96[_0x51a8('0xbe')](_0x5bcedd)['catch'](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x20cf96[_0x51a8('0x167')](0x3,_0x5c9aa2,_0x5510cf)){if(_0x5bcedd[_0x51a8('0x16a')]>=_0x5510cf[_0x51a8('0x16b')]){_0x20cf96[_0x51a8('0x17c')](_0x5bcedd,_0x59479a,_0x5f4986,'reason\x203\x20ringing\x20no\x20answer');}else{_0x20cf96['stateGlobal'](_0x5bcedd,_0x59479a,_0x5f4986,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x5510cf[_0x51a8('0x64')]+=0x1;_0x5bcedd[_0x51a8('0xda')]=0x5;_0x5bcedd[_0x51a8('0xd5')]='Busy';_0x5bcedd['countbusyretry']+=0x1;_0x5bcedd[_0x51a8('0x17e')]+=0x1;_0x20cf96['createHistory'](_0x5bcedd)[_0x51a8('0xb6')](loggerCatch(_0x51a8('0x17f')));if(_0x20cf96[_0x51a8('0x167')](0x5,_0x5c9aa2,_0x5510cf)){if(_0x5bcedd[_0x51a8('0x168')]>=_0x5510cf[_0x51a8('0x16f')]){_0x20cf96['createStateFinal'](_0x5bcedd,_0x59479a,_0x5f4986,_0x51a8('0x180'));}else{_0x20cf96[_0x51a8('0x17a')](_0x5bcedd,_0x59479a,_0x5f4986,_0x51a8('0x180'));}}break;case'8':_0x5510cf[_0x51a8('0x181')]+=0x1;_0x5bcedd[_0x51a8('0xda')]=0x8;_0x5bcedd[_0x51a8('0xd5')]=_0x51a8('0x182');_0x5bcedd[_0x51a8('0x169')]+=0x1;_0x5bcedd[_0x51a8('0x17e')]+=0x1;_0x20cf96[_0x51a8('0xbe')](_0x5bcedd)[_0x51a8('0xb6')](loggerCatch(_0x51a8('0x183')));if(_0x20cf96[_0x51a8('0x167')](0x8,_0x5c9aa2,_0x5510cf)){if(_0x5bcedd[_0x51a8('0x169')]>=_0x5510cf['dialCongestionMaxRetry']){_0x20cf96[_0x51a8('0x17c')](_0x5bcedd,_0x59479a,_0x5f4986,'reason\x208\x20congestion');}else{_0x20cf96[_0x51a8('0x17a')](_0x5bcedd,_0x59479a,_0x5f4986,_0x51a8('0x184'));}}break;default:_0x5510cf[_0x51a8('0x6c')]+=0x1;_0x5bcedd['state']=0xc;_0x5bcedd[_0x51a8('0xd5')]=_0x7f0d59[_0x51a8('0x178')];_0x20cf96['createHistory'](_0x5bcedd)[_0x51a8('0xb6')](loggerCatch(_0x51a8('0x185')));if(_0x20cf96['checkRetriveMax'](_0x7f0d59[_0x51a8('0x178')],_0x5c9aa2,_0x5510cf)){if(_0x5bcedd[_0x51a8('0x168')]+_0x5bcedd[_0x51a8('0x169')]+_0x5bcedd['countnoanswerretry']>=_0x5510cf['dialGlobalMaxRetry']){_0x20cf96[_0x51a8('0x17a')](_0x5bcedd,_0x59479a,_0x5f4986,_0x7f0d59['reason']);}else{_0x20cf96['createStateFinal'](_0x5bcedd,_0x59479a,_0x5f4986,_0x7f0d59['reason']);}}}});};Dialer[_0x51a8('0x1c')][_0x51a8('0x17a')]=function(_0x24fec5,_0x59ee01,_0x2084c2,_0x36ac43){var _0x4897e2=new Final(_0x24fec5);_0x4897e2[_0x51a8('0xda')]=0xf;_0x4897e2['statedesc']=_0x51a8('0x186');this[_0x51a8('0x17c')](_0x4897e2,_0x59ee01,_0x2084c2,_0x36ac43);};Dialer[_0x51a8('0x1c')][_0x51a8('0x17c')]=function(_0x5df59f,_0x26e1a3,_0x1b7133,_0x41c9a2){this['moveContactManagedDialer'](_0x5df59f)[_0x51a8('0xaf')](function(_0x254505){return _0x26e1a3(msgResponse(_0x51a8('0x176'),_0x51a8('0xcb'),_0x41c9a2));})[_0x51a8('0xb6')](function(_0x137947){return _0x1b7133(msgResponse(_0x51a8('0x187'),_0x51a8('0x117'),'contact\x20not\x20moved'));});};Dialer[_0x51a8('0x1c')][_0x51a8('0x7')]=function(_0x163807){var _0x2259b8=this;var _0x25cbea=_0x163807[_0x51a8('0x188')]/0x64;var _0x1bb346=_0x163807['outboundDropCallsDayTimeout']/(_0x163807[_0x51a8('0x66')]+_0x163807[_0x51a8('0xd9')]);var _0x566c0a=_0x163807[_0x51a8('0x53')]-_0x163807['predictiveIntervalPauses']-_0x163807[_0x51a8('0x5a')]-_0x163807['originated']-_0x163807['talking'];var _0x3969ec=(_0x163807[_0x51a8('0x53')]-_0x163807['predictiveIntervalPauses'])*_0x163807[_0x51a8('0x74')];var _0x396c09=Math['floor'](_0x163807['erlangCalls']*_0x163807[_0x51a8('0x189')]*_0x163807['predictiveIntervalHitRate']*_0x163807[_0x51a8('0x18a')]);if(_[_0x51a8('0x42')](_0x163807[_0x51a8('0x8b')])){loggerPredictive[_0x51a8('0x82')]('[startMethodPredictive][StartProgressive][First]');if(!_[_0x51a8('0x42')](_0x163807['startPredictive'])){_0x163807['startPredictive']=undefined;loggerPredictive[_0x51a8('0x90')](_0x51a8('0x18b'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x51a8('0x42')](_0x163807[_0x51a8('0x8d')])){loggerPredictive[_0x51a8('0x90')]('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x163807[_0x51a8('0x8d')]);_0x163807[_0x51a8('0x8d')]=undefined;}_0x163807[_0x51a8('0x8b')]=moment()[_0x51a8('0x7b')](_0x51a8('0xef'));loggerPredictive['info'](_0x51a8('0x18c'),_0x163807[_0x51a8('0x8b')],_0x163807[_0x51a8('0x46')]);this[_0x51a8('0x127')](_0x163807,0x1);}else if(ifInterval(_0x163807['dialPredictiveInterval'],_0x163807[_0x51a8('0x8b')])){this['handlePower'](_0x163807,0x1);loggerPredictiveCalls[_0x51a8('0x82')](_0x51a8('0x18d'),_0x163807['startProgressive'],_0x163807[_0x51a8('0x46')]);_0x163807[_0x51a8('0x18e')]=0x0;_0x163807[_0x51a8('0x72')]=0x0;}else if(_0x25cbea<_0x1bb346&&_0x163807['dialPredictiveOptimization']===_0x51a8('0x18f')){freeVariablesPredictive(_0x163807);loggerPredictive['info'](_0x51a8('0x190'),_0x51a8('0x191'),_0x1bb346,_0x51a8('0x8b'),_0x163807['name']);}else if(_0x566c0a>_0x3969ec){freeVariablesPredictive(_0x163807);loggerPredictive[_0x51a8('0x82')](_0x51a8('0x192'),_0x51a8('0x193'),_0x566c0a,_0x51a8('0x194'),_0x3969ec);}else if(_0x396c09<_0x163807[_0x51a8('0x72')]&&_0x163807['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x163807);loggerPredictive[_0x51a8('0x82')](_0x51a8('0x195'),_0x51a8('0x196'),_0x396c09,_0x51a8('0x197'),_0x163807['predictiveIntervalErlangCallsDroppedCalls'],_0x51a8('0x8b'),_0x163807['name']);}else if(!ifInterval(_0x163807[_0x51a8('0x198')],_0x163807['startProgressive'])&&_[_0x51a8('0x42')](_0x163807['startPredictive'])&&!_[_0x51a8('0x42')](_0x163807[_0x51a8('0x8b')])){_0x163807[_0x51a8('0x2b')]=moment()['format'](_0x51a8('0xef'));loggerPredictive[_0x51a8('0x82')]('[startMethodPredictive][StartPredictive][First]',_0x163807[_0x51a8('0x2b')],_0x163807[_0x51a8('0x46')]);this[_0x51a8('0xb4')](_0x163807['dialPredictiveInterval'])[_0x51a8('0xaf')](this['getDataPredictive'](_0x163807))['then'](mergeDataErlangB(_0x163807))['then'](this['startMethodPredictive'](_0x163807))[_0x51a8('0xb6')](loggerCatchPredictive('[averageHandleTime][ErlangB]\x20',_0x163807));}else if(!ifInterval(_0x163807[_0x51a8('0x198')],_0x163807[_0x51a8('0x2b')])){_0x163807['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x163807[_0x51a8('0x2b')]=moment()['format'](_0x51a8('0xef'));loggerPredictive[_0x51a8('0x82')](_0x51a8('0x199'),_0x163807[_0x51a8('0x2b')],_0x163807['name']);clearInterval(_0x163807[_0x51a8('0x8d')]);_0x163807[_0x51a8('0x8d')]=undefined;this[_0x51a8('0xb4')](_0x163807[_0x51a8('0x198')])[_0x51a8('0xaf')](this['getDataPredictive'](_0x163807))[_0x51a8('0xaf')](mergeDataErlangB(_0x163807))[_0x51a8('0xaf')](this[_0x51a8('0x19a')](_0x163807))['catch'](loggerCatchPredictive('[averageHandleTime][ErlangB]\x20',_0x163807));}};Dialer[_0x51a8('0x1c')][_0x51a8('0x19b')]=function(_0x2e1294){var _0x32d155=this;return function(_0x1255e9){return new BPromise(function(_0x2f40f0,_0x2d91c3){_[_0x51a8('0x89')](_0x2e1294,_0x1255e9[0x0]);if(checkGetDataPredictive(_0x1255e9[0x0])){loggerPredictive[_0x51a8('0x82')](JSON[_0x51a8('0x4c')](_0x1255e9[0x0]));if(_0x2e1294['dialPredictiveOptimization']===_0x51a8('0x18f')){return _0x32d155[_0x51a8('0x19c')](_0x2e1294['id'])[_0x51a8('0xaf')](function(_0x1607cf){var _0xfeb8a0=_0x2e1294[_0x51a8('0x53')]-_0x1607cf[0x0]['outboundQueuePauses'];var _0x230432=_0x2e1294[_0x51a8('0x198')]*0x3c;var _0x332835=_0x1255e9[0x0][_0x51a8('0x81')]+_0x1255e9[0x0][_0x51a8('0x6e')];var _0x586145=(_0x1255e9[0x0]['predictiveIntervalAnsweredCalls']+_0x1255e9[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1255e9[0x0][_0x51a8('0x6f')])/_0x1255e9[0x0][_0x51a8('0x80')];var _0xc03684=_0x2e1294[_0x51a8('0x188')]/0x64;_0x2e1294[_0x51a8('0x75')]=_0x1607cf[0x0]['outboundQueuePauses']||0x0;_0x2e1294['predictiveIntervalHitRate']=_0x586145>0x0?_0x586145:0x1;return _0x32d155['abandonmentRate'](_0xfeb8a0,_0x230432,_0x332835,_0x586145,_0xc03684);})[_0x51a8('0xaf')](function(_0x1ee109){return _0x2f40f0(_0x1ee109);})[_0x51a8('0xb6')](function(_0x4fcb44){return _0x2d91c3(msgResponse(_0x51a8('0x19d'),_0x51a8('0x117'),JSON[_0x51a8('0x4c')](_0x4fcb44)));});}if(_0x2e1294[_0x51a8('0x19e')]==='agentBusyFactor'){return _0x32d155[_0x51a8('0x19c')](_0x2e1294['id'])[_0x51a8('0xaf')](function(_0x17a63f){var _0x2d0fca=_0x2e1294['loggedIn']-_0x17a63f[0x0]['outboundQueuePauses'];var _0x2fa57e=_0x2e1294[_0x51a8('0x198')]*0x3c;var _0x215c18=_0x1255e9[0x0][_0x51a8('0x81')]+_0x1255e9[0x0][_0x51a8('0x6e')];var _0x2ae995=(_0x1255e9[0x0][_0x51a8('0x6d')]+_0x1255e9[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1255e9[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1255e9[0x0][_0x51a8('0x80')];var _0x185e8b=_0x2e1294[_0x51a8('0x188')]/0x64;_0x2e1294[_0x51a8('0x75')]=_0x17a63f[0x0][_0x51a8('0x19f')]||0x0;_0x2e1294['predictiveIntervalHitRate']=_0x2ae995>0x0?_0x2ae995:0x1;return _0x32d155[_0x51a8('0x1a0')](_0x2d0fca,_0x2fa57e,_0x215c18,_0x2ae995,_0x185e8b);})[_0x51a8('0xaf')](function(_0x27d86e){return _0x2f40f0(_0x27d86e);})[_0x51a8('0xb6')](function(_0x3564c1){return _0x2d91c3(msgResponse('[CatchErlangB]',_0x51a8('0x117'),JSON[_0x51a8('0x4c')](_0x3564c1)));});}}else{return _0x2d91c3(msgResponse(_0x51a8('0x1a1'),_0x51a8('0x117'),_0x51a8('0x1a2')));}});};};Dialer[_0x51a8('0x1c')][_0x51a8('0x19a')]=function(_0x420d11){var _0x46c967=this;return function(){var _0x271af0=0x0;var _0x11c3a3=Math[_0x51a8('0x1a3')](_0x420d11[_0x51a8('0x1a4')]*0x3e8);if(_0x11c3a3>0x0){_0x11c3a3=_0x11c3a3<0x64?0x64:_0x11c3a3;loggerPredictive[_0x51a8('0x82')](_0x51a8('0x1a5'),_0x11c3a3);_0x420d11[_0x51a8('0x8d')]=setInterval(function(){_0x46c967[_0x51a8('0x8d')](_0x420d11);loggerPredictiveCalls[_0x51a8('0x82')]('[handlePredictive]',_0x271af0+=0x1);},_0x11c3a3);}else{loggerPredictive[_0x51a8('0x82')](_0x51a8('0x1a6'),_0x51a8('0x1a7'),_0x11c3a3);}};};Dialer[_0x51a8('0x1c')][_0x51a8('0x1a8')]=function(_0x366923,_0x2e5966){var _0x2ecf43=this;return function(_0x347ac9){if(_[_0x51a8('0x49')](_0x347ac9)){if(_['isNil'](_0x2e5966[_0x51a8('0xc6')])||!_0x2e5966['recallme']){if(_0x366923['dialMethod']===_0x51a8('0x6')){_0x366923[_0x51a8('0xfd')]=_['isUndefined'](_0x366923[_0x51a8('0xfd')])?!![]:_0x366923['queueStatusComplete'];var _0x91f1b6=uuid['v4']();_0x2ecf43[_0x51a8('0x27')][_0x91f1b6]=new Action(_0x366923,_0x2e5966,_0x91f1b6);loggerBooked[_0x51a8('0x82')]('[booked][checkContactBlack]',_0x91f1b6,_0x51a8('0x1a9'),JSON['stringify'](_0x366923[_0x51a8('0xfd')]),_0x51a8('0x1aa'),_0x366923[_0x51a8('0x46')]);if(_0x366923[_0x51a8('0xfd')]){_0x366923[_0x51a8('0xfd')]=![];_0x2ecf43['queueBooked'][_0x2ecf43[_0x51a8('0x27')][_0x91f1b6]['queue']]=[];ami[_0x51a8('0xa6')]({'actionid':_0x91f1b6,'action':_0x51a8('0x1ab'),'queue':_0x366923[_0x51a8('0x46')]})[_0x51a8('0xb6')](function(_0x1461a3){_0x2ecf43[_0x51a8('0xab')](_0x366923);_0x2ecf43[_0x51a8('0xb8')]({'active':![],'ContactId':_0x2ecf43[_0x51a8('0x27')][_0x91f1b6]['ContactId'],'ListId':_0x2ecf43[_0x51a8('0x27')][_0x91f1b6][_0x51a8('0xc5')],'VoiceQueueId':_0x2ecf43['actions'][_0x91f1b6]['VoiceQueueId']||undefined,'CampaignId':_0x2ecf43[_0x51a8('0x27')][_0x91f1b6][_0x51a8('0x102')]||undefined})[_0x51a8('0xb6')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x2ecf43[_0x51a8('0x27')][_0x91f1b6];});}else{loggerBooked[_0x51a8('0x82')](_0x51a8('0x1ac'),JSON[_0x51a8('0x4c')](_0x366923['queueStatusComplete']),'Queue:\x20',_0x366923['name']);_0x2ecf43['updateOriginated'](_0x366923);_0x2ecf43[_0x51a8('0xb8')]({'active':![],'ContactId':_0x2ecf43['actions'][_0x91f1b6][_0x51a8('0x10c')],'ListId':_0x2ecf43[_0x51a8('0x27')][_0x91f1b6][_0x51a8('0xc5')],'VoiceQueueId':_0x2ecf43[_0x51a8('0x27')][_0x91f1b6][_0x51a8('0xc7')]||undefined,'CampaignId':_0x2ecf43[_0x51a8('0x27')][_0x91f1b6][_0x51a8('0x102')]||undefined})[_0x51a8('0xb6')](loggerCatch(_0x51a8('0x1ad')));delete _0x2ecf43[_0x51a8('0x27')][_0x91f1b6];}}else{return _0x2ecf43['actionOriginate'](_0x366923,_0x2e5966);}}else{if(getDiff(_0x2e5966[_0x51a8('0x1ae')])<_0x366923[_0x51a8('0x1af')]*0x3c){_0x2ecf43[_0x51a8('0x20')]['run'](_0x2e5966['id'])[_0x51a8('0x1e')](function(){_0x2ecf43[_0x51a8('0xab')](_0x366923);});}else{_0x366923[_0x51a8('0x6a')]+=0x1;_0x2ecf43[_0x51a8('0xab')](_0x366923);if(_0x366923['dialRecallInQueue']){_0x2ecf43[_0x51a8('0xb8')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2e5966[_0x51a8('0x10c')],'ListId':_0x2e5966[_0x51a8('0xc5')],'VoiceQueueId':_0x2e5966['VoiceQueueId']||undefined,'CampaignId':_0x2e5966[_0x51a8('0x102')]||undefined})[_0x51a8('0xb6')](loggerCatch(_0x51a8('0x1b0')));_0x2ecf43[_0x51a8('0xbe')](createObjHistory(_0x366923,_0x2e5966,'RECALLINQUEUE',0x17,_0x51a8('0x1b1')))[_0x51a8('0xb6')](loggerCatch(_0x51a8('0x1b2')));}else{_0x2ecf43[_0x51a8('0xc4')](createObjHistory(_0x366923,_0x2e5966,'RECALLFAILEDTIMEOUT',0x16,'RecallFailedTimeout'),_0x51a8('0x1b3'),_0x51a8('0x1b4'));}}}}else{_0x366923[_0x51a8('0x63')]+=0x1;_0x2ecf43[_0x51a8('0xc4')](createObjHistory(_0x366923,_0x2e5966,_0x51a8('0x1b5'),0xd,_0x51a8('0x1b6')),_0x51a8('0x1b7'),_0x51a8('0x1b8'));throw'inBlackList';}};};Dialer[_0x51a8('0x1c')][_0x51a8('0x12d')]=function(_0x1b98c8){var _0x2cf299=this;var _0x4c75c5=[];var _0x40e771=_0x1b98c8[_0x51a8('0x1b9')]-_0x1b98c8[_0x51a8('0x76')]-_0x1b98c8['temp'];emitCampaignSummary(_0x1b98c8);if(_0x40e771>0x0){if(_0x40e771>this[_0x51a8('0x25')]){_0x40e771=this[_0x51a8('0x25')];}_0x1b98c8[_0x51a8('0x1ba')]+=_0x40e771;this['getContactDialerIvr'](_0x1b98c8['id'],_0x40e771,_0x1b98c8[_0x51a8('0x1bb')])['then'](function(_0x38dd7f){_0x1b98c8[_0x51a8('0x1ba')]-=_0x40e771;_0x1b98c8[_0x51a8('0x1ba')]=_0x1b98c8[_0x51a8('0x1ba')]>0x0?_0x1b98c8[_0x51a8('0x1ba')]:0x0;if(!checkContactEmpty(_0x38dd7f)){_0x1b98c8[_0x51a8('0x43')]=_0x51a8('0x98');logger[_0x51a8('0x82')]('[getContactCampaign2][Empty]'+_0x1b98c8[_0x51a8('0x46')]);}else{_0x1b98c8[_0x51a8('0x76')]+=_0x38dd7f[_0x51a8('0x92')];_0x1b98c8[_0x51a8('0x43')]='RUNNING';for(var _0x14c8ee=0x0;_0x14c8ee<_0x38dd7f['length'];_0x14c8ee+=0x1){_0x1b98c8[_0x51a8('0x1bc')]+=0x1;if(_[_0x51a8('0xa5')](_0x38dd7f[_0x14c8ee])||_[_0x51a8('0xa5')](_0x38dd7f[_0x14c8ee]['Contact'])||_['isNil'](_0x38dd7f[_0x14c8ee]['Contact'][_0x51a8('0x13c')])){_0x2cf299[_0x51a8('0xc2')](_0x51a8('0x1bd'),_0x1b98c8,_0x38dd7f[_0x14c8ee]);}else{_0x2cf299['checkIsBlackListIvr'](_[_0x51a8('0xfc')](_0x38dd7f[_0x14c8ee],['CampaignId',_0x51a8('0x1be')]))[_0x51a8('0xaf')](_0x2cf299[_0x51a8('0x1a8')](_0x1b98c8,_0x38dd7f[_0x14c8ee]))['catch'](_0x2cf299[_0x51a8('0xc1')](_0x51a8('0x1bf'),_0x1b98c8));}}}})['catch'](loggerGetContactDialer(_0x51a8('0x1c0'),_0x1b98c8,_0x40e771));}};Dialer[_0x51a8('0x1c')][_0x51a8('0x127')]=function(_0x26b5a5,_0x37f00e){var _0x9be3cf=this;var _0x19f7f9=[];var _0x1877a5=_0x37f00e>=0x1?_0x37f00e:0x1;var _0x4cdbf4=[];if(_0x26b5a5['dialMethod']===_0x51a8('0x6')){_0x1877a5=0x1;}var _0x10bf5c=Math[_0x51a8('0x1a3')](_0x26b5a5[_0x51a8('0x52')]*_0x1877a5)-_0x26b5a5[_0x51a8('0x76')]-_0x26b5a5[_0x51a8('0x1ba')];emitVoiceQueueSummary(_0x26b5a5);if(_0x26b5a5[_0x51a8('0x1c1')]>0x0){var _0x84877d=_0x26b5a5['dialLimitQueue']-_0x26b5a5[_0x51a8('0x76')]-_0x26b5a5['talking']-_0x26b5a5[_0x51a8('0x1ba')]-_0x26b5a5[_0x51a8('0x54')];if(_0x10bf5c>_0x84877d){_0x10bf5c=_0x84877d;}}if(_0x10bf5c>0x0){if(_0x26b5a5[_0x51a8('0x5d')]==='booked'){_0x10bf5c=0x1;}if(_0x10bf5c>this[_0x51a8('0x25')]){_0x10bf5c=this[_0x51a8('0x25')];}_0x26b5a5['temp']+=_0x10bf5c;for(var _0x250ae8 in this['agents']){if(this[_0x51a8('0x23')][_0x51a8('0xa3')](_0x250ae8)){if(this[_0x51a8('0x23')][_0x250ae8][_0x51a8('0xda')]===_0x51a8('0x1c2')&&this[_0x51a8('0x23')][_0x250ae8][_0x51a8('0xa7')]===_0x51a8('0x1c3')){_0x19f7f9['push'](this['agents'][_0x250ae8]['id']);}}}this['getContactDialer'](_0x26b5a5['id'],_0x19f7f9,_0x10bf5c,_0x26b5a5[_0x51a8('0x1bb')])[_0x51a8('0xaf')](function(_0x2e41b8){_0x26b5a5[_0x51a8('0x1ba')]-=_0x10bf5c;_0x26b5a5[_0x51a8('0x1ba')]=_0x26b5a5['temp']>0x0?_0x26b5a5['temp']:0x0;if(!checkContactEmpty(_0x2e41b8)){_0x9be3cf[_0x51a8('0xad')](_0x26b5a5)[_0x51a8('0xaf')](sendMessageReschedule(_0x26b5a5))[_0x51a8('0xb6')](loggerCatch(_0x51a8('0xb0')));}else{_0x26b5a5['originated']+=_0x2e41b8[_0x51a8('0x92')];_0x26b5a5[_0x51a8('0x43')]=_0x26b5a5[_0x51a8('0x5d')]===_0x51a8('0x6')?_0x51a8('0x143'):_0x51a8('0x1c4');for(var _0x1ab133=0x0;_0x1ab133<_0x2e41b8[_0x51a8('0x92')];_0x1ab133+=0x1){if(_['isNil'](_0x2e41b8[_0x1ab133])||_[_0x51a8('0xa5')](_0x2e41b8[_0x1ab133][_0x51a8('0x13b')])||_[_0x51a8('0xa5')](_0x2e41b8[_0x1ab133][_0x51a8('0x13b')]['phone'])){_0x9be3cf[_0x51a8('0xc2')](_0x51a8('0x1bd'),_0x26b5a5,_0x2e41b8[_0x1ab133]);}else{_0x9be3cf[_0x51a8('0xb1')](_['pick'](_0x2e41b8[_0x1ab133],[_0x51a8('0xc7'),_0x51a8('0x1be')]))[_0x51a8('0xaf')](_0x9be3cf[_0x51a8('0x1a8')](_0x26b5a5,_0x2e41b8[_0x1ab133]))[_0x51a8('0xb6')](_0x9be3cf[_0x51a8('0xc1')](_0x51a8('0x1bd'),_0x26b5a5));}}}})['catch'](loggerGetContactDialer('[getContactDialer2]',_0x26b5a5,_0x10bf5c));}};Dialer[_0x51a8('0x1c')]['handlePredictive']=function(_0x10957b){var _0x5c982a=this;if(_0x10957b[_0x51a8('0x1c1')]>0x0){var _0x37a462=_0x10957b[_0x51a8('0x1c1')]-_0x10957b[_0x51a8('0x76')]-_0x10957b[_0x51a8('0x56')];if(_0x37a462>0x0){this[_0x51a8('0x1c5')](_0x10957b);}else{loggerPredictiveCalls['info'](_0x51a8('0x1c6'));}}else{this[_0x51a8('0x1c5')](_0x10957b);}};Dialer[_0x51a8('0x1c')][_0x51a8('0x1c5')]=function(_0x23dcaa){var _0x52f905=this;var _0x2af168=[];_0x23dcaa[_0x51a8('0x76')]+=0x1;for(var _0x53de38 in this[_0x51a8('0x23')]){if(this[_0x51a8('0x23')]['hasOwnProperty'](_0x53de38)){if(this['agents'][_0x53de38][_0x51a8('0xda')]===_0x51a8('0x1c2')&&this[_0x51a8('0x23')][_0x53de38][_0x51a8('0xa7')]===_0x51a8('0x1c3')){_0x2af168[_0x51a8('0x11a')](this['agents'][_0x53de38]['id']);}}}this[_0x51a8('0x1c7')](_0x23dcaa['id'],_0x2af168,0x1,_0x23dcaa[_0x51a8('0x1bb')])['then'](function(_0x39208a){if(!checkContactEmpty(_0x39208a)){checkContactLowerLimitOriginate(_0x23dcaa,0x1,0x0);_0x52f905[_0x51a8('0xad')](_0x23dcaa)[_0x51a8('0xaf')](sendMessageReschedule(_0x23dcaa))[_0x51a8('0xb6')](loggerCatch('[countReScheduled]\x20'));}else{_0x23dcaa[_0x51a8('0x43')]=_0x51a8('0x1c4');if(_[_0x51a8('0xa5')](_0x39208a[0x0])||_[_0x51a8('0xa5')](_0x39208a[0x0][_0x51a8('0x13b')])||_[_0x51a8('0xa5')](_0x39208a[0x0][_0x51a8('0x13b')][_0x51a8('0x13c')])){_0x52f905[_0x51a8('0xc2')](_0x51a8('0x1bd'),_0x23dcaa,_0x39208a[0x0]);}else{_0x52f905[_0x51a8('0xb1')](_[_0x51a8('0xfc')](_0x39208a[0x0],[_0x51a8('0xc7'),_0x51a8('0x1be')]))[_0x51a8('0xaf')](_0x52f905['checkContactBlack'](_0x23dcaa,_0x39208a[0x0]))['catch'](_0x52f905[_0x51a8('0xc1')](_0x51a8('0x1c8'),_0x23dcaa));}}})['catch'](loggerGetContactDialer(_0x51a8('0x1c9'),_0x23dcaa,0x1));emitVoiceQueueSummary(_0x23dcaa);};Dialer[_0x51a8('0x1c')]['abandonmentRate']=function(_0x3e96a5,_0x2643bb,_0x29167d,_0x12d708,_0x49954a,_0x147e38){loggerPredictive[_0x51a8('0x82')](_0x51a8('0x1ca'),_0x51a8('0x1cb'),_0x3e96a5,'\x20interval\x20=\x20',_0x2643bb,_0x51a8('0x1cc'),_0x29167d,'\x20p\x20=\x20',_0x12d708,_0x51a8('0x1cd'),_0x49954a);return new BPromise(function(_0x5897ea,_0x4ff323){if(_0x3e96a5<=0x0||isNaN(_0x3e96a5)){return _0x4ff323(msgResponse(_0x51a8('0x1ca'),'Error',_0x51a8('0x1ce')+_0x3e96a5));}if(_0x29167d<=0x0||isNaN(_0x29167d)){return _0x4ff323(msgResponse(_0x51a8('0x1ca'),_0x51a8('0x4b'),_0x51a8('0x1cf')+_0x29167d));}if(_0x12d708<=0x0||isNaN(_0x12d708)){return _0x4ff323(msgResponse(_0x51a8('0x1ca'),_0x51a8('0x4b'),_0x51a8('0x1d0')+_0x12d708));}if(_0x2643bb<=0x0||isNaN(_0x2643bb)){return _0x4ff323(msgResponse(_0x51a8('0x1ca'),_0x51a8('0x4b'),_0x51a8('0x1d1')+_0x2643bb));}if(_0x49954a<=0x0||isNaN(_0x49954a)){return _0x4ff323(msgResponse(_0x51a8('0x1ca'),_0x51a8('0x4b'),_0x51a8('0x1d2')+_0x49954a));}_0x147e38=_0x147e38||0x0;var _0x5cb5dc=0x1/_0x29167d;var _0x555cda=0x0;var _0x2faef2=0x0;var _0x52a12b=0x0;var _0x4b5d20=0x0;for(var _0x3102ae=0x0;_0x52a12b<_0x49954a;_0x3102ae+=0x1){_0x2faef2=_0x3102ae/_0x2643bb;_0x555cda=(_0x12d708*_0x2faef2+_0x147e38)/_0x5cb5dc;_0x52a12b=erlangb(_0x555cda,_0x3e96a5);_0x4b5d20=_0x555cda/_0x3e96a5*(0x1-erlangb(_0x555cda,_0x3e96a5));}return _0x5897ea({'erlangCalls':_0x3102ae,'erlangCallToSecond':_0x2643bb/_0x3102ae,'erlangAbandonmentRate':_0x52a12b,'erlangBusyFactor':_0x4b5d20});});};Dialer[_0x51a8('0x1c')][_0x51a8('0x1a0')]=function(_0x1f1216,_0x140c93,_0x33128e,_0x1840e2,_0x167594,_0x9254b){loggerPredictive[_0x51a8('0x82')](_0x51a8('0x1d3'),_0x51a8('0x1cb'),_0x1f1216,_0x51a8('0x1d4'),_0x140c93,_0x51a8('0x1cc'),_0x33128e,_0x51a8('0x1d5'),_0x1840e2,_0x51a8('0x1d6'),_0x167594);return new BPromise(function(_0x2483d8,_0x18fb2a){if(_0x1f1216<=0x0||isNaN(_0x1f1216)){return _0x18fb2a(msgResponse(_0x51a8('0x1ca'),'Error',_0x51a8('0x1ce')+_0x1f1216));}if(_0x33128e<=0x0||isNaN(_0x33128e)){return _0x18fb2a(msgResponse(_0x51a8('0x1ca'),_0x51a8('0x4b'),_0x51a8('0x1cf')+_0x33128e));}if(_0x1840e2<=0x0||isNaN(_0x1840e2)){return _0x18fb2a(msgResponse(_0x51a8('0x1ca'),_0x51a8('0x4b'),'p\x20=\x20'+_0x1840e2));}if(_0x140c93<=0x0||isNaN(_0x140c93)){return _0x18fb2a(msgResponse(_0x51a8('0x1ca'),_0x51a8('0x4b'),_0x51a8('0x1d1')+_0x140c93));}if(_0x167594<=0x0||isNaN(_0x167594)){return _0x18fb2a(msgResponse(_0x51a8('0x1ca'),_0x51a8('0x4b'),_0x51a8('0x1d2')+_0x167594));}_0x9254b=_0x9254b||0x0;var _0x540d8d=0x1/_0x33128e;var _0x300f2c=0x0;var _0x2f680d=0x0;var _0x4928db=0x0;var _0x124030=0x0;for(var _0x224a95=0x0;_0x124030<_0x167594;_0x224a95+=0x1){_0x2f680d=_0x224a95/_0x140c93;_0x300f2c=(_0x1840e2*_0x2f680d+_0x9254b)/_0x540d8d;_0x4928db=erlangb(_0x300f2c,_0x1f1216);_0x124030=_0x300f2c/_0x1f1216*(0x1-erlangb(_0x300f2c,_0x1f1216));}return _0x2483d8({'erlangCalls':_0x224a95,'erlangCallToSecond':_0x140c93/_0x224a95,'erlangAbandonmentRate':_0x4928db,'erlangBusyFactor':_0x124030});});};module[_0x51a8('0x1d7')]=Dialer;
\ No newline at end of file
+var _0xea28=['No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','countReScheduled','resolve','then','catch','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','saveInDb','ContactId','ListId','CampaignId','[emptyContact][createHistory]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','uniqueid','amdstatus','xcally-motion-dialer','dialAMDActive','value','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','membername','AMD','[syncHangupInAMD]','MACHINE','statedesc','amd','[syncMachine][createHistory]','[syncMachine]','HANGUP','HangupInAMD','Machine','[syncMachineIvr][createHistory]','[syncMachineIvr]','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','outboundUnknownCallsDay','cause-txt','Unknow','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','[syncAgentComplete]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','Drop','dropreason','predictiveIntervalDroppedCallsCallersExit','CALLEREXIT','syncNewExten','actionid','locked','paused','stateinterface','rrmemory','queueBooked','push','[booked][unlockQueueStatus]','pick','queueStatusComplete','run','idHopper','VoiceQueueId','_rr','length','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[booked][unlock3]','syncCampaigns','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','Failure','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','interval','content','indexOf','true','command','iftime\x20%s,%s','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','power','handlePower','dialPowerLevel','Queue','launchHandleIvr','checkIfTime','dialGlobalInterval','dialTimezone','[syncQueueSummary]','pow','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','dialQueueTimeout','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','starttime','[originate][error]','Error','originate\x20action\x20Error','response','checkRetriveMax','countbusyretry','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','minutes','dialBusyMaxRetry','add','[rescheduleContact]\x20[Busy]','countcongestionretry','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','dialGlobalMaxRetry','stateGlobal','createStateFinal','reason\x200\x20no\x20such\x20number....','NoAnswer','countglobal','reason\x203\x20ringing\x20no\x20answer','Busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','erlangCalls','erlangAbandonmentRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive][First]','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][LowerLimitInterval]','Agent\x20free','agent\x20max\x20free\x20','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','[startMethodPredictive][StartPredictive][First]','getDataPredictive','[averageHandleTime][ErlangB]\x20','[startMethodPredictive][StartPredictive][Repeat]','startMethodPredictive','outboundQueuePauses','abandonmentRate','[CatchErlangB]','busyFactor','[getDataPredictive]','check\x20failure','floor','[startMethodPredictive]','[handlePredictive]','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','loggerHandler','dialLimitQueue','not_inuse','ACTIVE','[actionOriginate]\x20','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','[abandonmentRate]','\x20m\x20=\x20','\x20interval\x20=\x20','\x20Ts\x20=\x20','\x20p\x20=\x20','\x20Amax\x20=\x20','m\x20=\x20','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','[busyFactor]','\x20Umin\x20=\x20','p\x20=\x20','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment/','dialer','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','contactsId','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','syncHangup','newexten','varset','syncVarSet','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','name','isEmpty','Interval','Intervals','\x20INTERVAL_IS_NULL','[ifTime][Action]','stringify','milliseconds','diff','emit','type','outbound','strategy','available','loggedIn','pTalking','sumBillable','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialPrefix','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalLowerLimit','predictiveIntervalPauses','predictiveIntervalTotalCalls','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','info','[checkGetDataPredictive][avgTalktime]','[checkGetDataPredictive][avgHoldtime]','[checkGetDataPredictive][totalCalls]','[ErlangB]','merge','seconds','[freeVariablesPredictive]','startPredictive','handlePredictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','hasOwnProperty','originated','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','state','endtime','clearZombieChannels','[uniqueid]','actions','[actions]','isNil','Action','status','channel'];(function(_0x300181,_0x166532){var _0xcff66f=function(_0x54cf57){while(--_0x54cf57){_0x300181['push'](_0x300181['shift']());}};_0xcff66f(++_0x166532);}(_0xea28,0x13a));var _0x8ea2=function(_0x349019,_0x5d253e){_0x349019=_0x349019-0x0;var _0x27c640=_0xea28[_0x349019];return _0x27c640;};'use strict';var util=require(_0x8ea2('0x0'));var _=require(_0x8ea2('0x1'));var BPromise=require(_0x8ea2('0x2'));var uuid=require(_0x8ea2('0x3'));var moment=require(_0x8ea2('0x4'));var rr=require('rr');var md5=require(_0x8ea2('0x5'));var Redis=require(_0x8ea2('0x6'));var config=require(_0x8ea2('0x7'));var logger=require('../../../config/logger')(_0x8ea2('0x8'));var loggerBooked=require(_0x8ea2('0x9'))(_0x8ea2('0xa'));var loggerPredictive=require('../../../config/logger')(_0x8ea2('0xb'));var loggerPredictiveCalls=require(_0x8ea2('0x9'))(_0x8ea2('0xc'));var loggerSyncQueueSummary=require(_0x8ea2('0x9'))(_0x8ea2('0xd'));var ami=require(_0x8ea2('0xe'));config[_0x8ea2('0xf')]=_[_0x8ea2('0x10')](config[_0x8ea2('0xf')],{'host':_0x8ea2('0x11'),'port':0x18eb});var io=require(_0x8ea2('0x12'))(new Redis(config[_0x8ea2('0xf')]));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x8ea2('0x13'));var cmHopperBlack=require(_0x8ea2('0x14'));var voiceQueueRt=require(_0x8ea2('0x15'));var Action=require('./action');var History=require(_0x8ea2('0x16'));var Final=require(_0x8ea2('0x17'));var AgentComplete=require(_0x8ea2('0x18'));var QueueCallerAbandon=require(_0x8ea2('0x19'));var Hangup=require(_0x8ea2('0x1a'));var ipAgi=process['env'][_0x8ea2('0x1b')]||'127.0.0.1';var strategy={'rrmemory':'rrmemory','roundrobin':_0x8ea2('0x1c')};var Sequence=function(){};Sequence[_0x8ea2('0x1d')][_0x8ea2('0x1e')]=function(_0x78669a){this[_0x8ea2('0x1f')]=this[_0x8ea2('0x1f')]?this[_0x8ea2('0x1f')][_0x8ea2('0x20')](_0x78669a):_0x78669a();};function Dialer(_0x474873,_0x396aab){this[_0x8ea2('0x21')]=new Sequence();this[_0x8ea2('0x22')]=_0x396aab;this[_0x8ea2('0x23')]=_0x474873[_0x8ea2('0x23')];this[_0x8ea2('0x24')]=_0x474873[_0x8ea2('0x24')];this[_0x8ea2('0x25')]=_0x474873[_0x8ea2('0x25')];this[_0x8ea2('0x26')]=_0x474873[_0x8ea2('0x26')];this[_0x8ea2('0x27')]=config[_0x8ea2('0x27')]||0x2;this['channels']={};this['actions']={};this[_0x8ea2('0x28')]={};this[_0x8ea2('0x29')]={};this[_0x8ea2('0x2a')]={};this['startPredictive']={};this[_0x8ea2('0x2b')]={};this[_0x8ea2('0x2c')]={};this['queueBooked']={};this[_0x8ea2('0x2d')]={};ami['on'](_0x8ea2('0x2e'),this[_0x8ea2('0x2f')][_0x8ea2('0x30')](this));ami['on'](_0x8ea2('0x31'),this[_0x8ea2('0x32')][_0x8ea2('0x30')](this));ami['on'](_0x8ea2('0x33'),this[_0x8ea2('0x34')]['bind'](this));ami['on'](_0x8ea2('0x35'),this['syncAgentComplete'][_0x8ea2('0x30')](this));ami['on'](_0x8ea2('0x36'),this[_0x8ea2('0xd')]['bind'](this));ami['on']('hangup',this[_0x8ea2('0x37')]['bind'](this));ami['on'](_0x8ea2('0x38'),this['syncNewExten'][_0x8ea2('0x30')](this));ami['on'](_0x8ea2('0x39'),this[_0x8ea2('0x3a')][_0x8ea2('0x30')](this));ami['on']('queuemember',this['syncQueueMember'][_0x8ea2('0x30')](this));ami['on']('queuestatuscomplete',this[_0x8ea2('0x3b')][_0x8ea2('0x30')](this));this[_0x8ea2('0x3c')]();this[_0x8ea2('0x3d')]();}function isNotNull(_0x307c74){return _0x307c74!==null&&!_[_0x8ea2('0x3e')](_0x307c74);}function checkIsLoggedIn(_0x32e225,_0x316707){return function(){if(_0x316707<=0x0){_0x32e225[_0x8ea2('0x3f')]=_0x8ea2('0x40');throw _0x32e225['name']+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x3ed03e){return _0x3ed03e;}function checkIsActive(_0x188553,_0x53d71c){return function(){if(!isActive(_0x53d71c)){_0x188553['message']=_0x8ea2('0x41');throw _0x188553['name']+_0x8ea2('0x42');}};}function checkInterval(_0x1b9471){return function(){if(!isNotNull(_0x1b9471['Interval'])){_0x1b9471[_0x8ea2('0x3f')]=_0x8ea2('0x43');throw _0x1b9471[_0x8ea2('0x44')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x1b9471['Interval']['Intervals'])){_0x1b9471[_0x8ea2('0x3f')]=_0x8ea2('0x43');throw _0x1b9471[_0x8ea2('0x44')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x8ea2('0x45')](_0x1b9471[_0x8ea2('0x46')][_0x8ea2('0x47')]))){_0x1b9471[_0x8ea2('0x3f')]=_0x8ea2('0x43');throw _0x1b9471[_0x8ea2('0x44')]+_0x8ea2('0x48');}};}function msgResponse(_0x1fc76a,_0x5e9b1f,_0x955ef3){return{'action':_0x1fc76a,'response':_0x5e9b1f,'message':_0x955ef3};}function myreject(_0x29e3f5){return function(_0x28798c){return _0x29e3f5(msgResponse(_0x8ea2('0x49'),'Error',JSON[_0x8ea2('0x4a')](_0x28798c)));};}function getSeconds(_0x5355aa,_0x1e03f2){var _0x103d5a=moment(_0x5355aa)[_0x8ea2('0x4b')](0x0);var _0x1496ae=moment(_0x1e03f2)['milliseconds'](0x0);return _0x103d5a[_0x8ea2('0x4c')](_0x1496ae,'seconds');}function emit(_0x5adb84,_0x35f21b,_0x5f23a3){io['to'](_0x5adb84)[_0x8ea2('0x4d')](_0x35f21b,_0x5f23a3);}function emitVoiceQueueSummary(_0x2f0779){if(_0x2f0779[_0x8ea2('0x4e')]===_0x8ea2('0x4f')){var _0x134584={'id':_0x2f0779['id'],'name':_0x2f0779['name'],'strategy':_0x2f0779[_0x8ea2('0x50')],'answered':_0x2f0779['answered'],'available':_0x2f0779[_0x8ea2('0x51')],'loggedIn':_0x2f0779[_0x8ea2('0x52')],'pTalking':_0x2f0779[_0x8ea2('0x53')],'sumBillable':_0x2f0779[_0x8ea2('0x54')],'sumDuration':_0x2f0779['sumDuration'],'sumHoldTime':_0x2f0779[_0x8ea2('0x55')]||0x0,'talking':_0x2f0779['talking'],'total':_0x2f0779[_0x8ea2('0x56')],'type':_0x2f0779['type'],'unmanaged':_0x2f0779[_0x8ea2('0x57')],'abandoned':_0x2f0779[_0x8ea2('0x58')],'waiting':_0x2f0779[_0x8ea2('0x59')],'loggedInDb':_0x2f0779[_0x8ea2('0x5a')],'dialActive':_0x2f0779[_0x8ea2('0x5b')],'dialMethod':_0x2f0779[_0x8ea2('0x5c')],'dialOriginateCallerIdName':_0x2f0779[_0x8ea2('0x5d')],'dialOriginateCallerIdNumber':_0x2f0779['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x2f0779['dialOriginateTimeout'],'dialPrefix':_0x2f0779[_0x8ea2('0x5e')],'outboundAnswerAgiCallsDay':_0x2f0779['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x2f0779['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x2f0779['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x2f0779[_0x8ea2('0x5f')],'outboundCongestionCallsDay':_0x2f0779['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x2f0779[_0x8ea2('0x60')],'outboundDropCallsDayCallersExit':_0x2f0779[_0x8ea2('0x61')],'outboundDropCallsDayTimeout':_0x2f0779[_0x8ea2('0x62')],'outboundNoAnswerCallsDay':_0x2f0779[_0x8ea2('0x63')],'outboundNoSuchCallsDay':_0x2f0779[_0x8ea2('0x64')],'outboundOriginateFailureCallsDay':_0x2f0779[_0x8ea2('0x65')],'outboundReCallsDay':_0x2f0779[_0x8ea2('0x66')],'outboundRejectCallsDay':_0x2f0779[_0x8ea2('0x67')],'outboundUnknownCallsDay':_0x2f0779['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x2f0779[_0x8ea2('0x68')],'predictiveIntervalAvgHoldtime':_0x2f0779[_0x8ea2('0x69')],'predictiveIntervalAvgTalktime':_0x2f0779[_0x8ea2('0x6a')],'predictiveIntervalDroppedCallsCallersExit':_0x2f0779['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x2f0779[_0x8ea2('0x6b')],'predictiveIntervalErlangCalls':_0x2f0779[_0x8ea2('0x6c')],'predictiveIntervalErlangCallsDroppedCalls':_0x2f0779[_0x8ea2('0x6d')],'predictiveIntervalHitRate':_0x2f0779[_0x8ea2('0x6e')],'predictiveIntervalLowerLimit':_0x2f0779[_0x8ea2('0x6f')],'predictiveIntervalMultiplicativeFactor':_0x2f0779['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x2f0779[_0x8ea2('0x70')],'predictiveIntervalTotalCalls':_0x2f0779[_0x8ea2('0x71')],'message':_0x2f0779[_0x8ea2('0x3f')],'originated':_0x2f0779['originated']};if(_0x2f0779[_0x8ea2('0x72')]){_0x134584[_0x8ea2('0x72')]={'id':_0x2f0779[_0x8ea2('0x72')]['id'],'name':_0x2f0779[_0x8ea2('0x72')][_0x8ea2('0x44')],'active':_0x2f0779[_0x8ea2('0x72')][_0x8ea2('0x73')],'callerid':_0x2f0779[_0x8ea2('0x72')][_0x8ea2('0x74')]};}if(_0x2f0779[_0x8ea2('0x46')]){_0x134584[_0x8ea2('0x46')]={'id':_0x2f0779[_0x8ea2('0x46')]['id'],'name':_0x2f0779[_0x8ea2('0x46')][_0x8ea2('0x44')]};}var _0x5c1212=md5(JSON[_0x8ea2('0x4a')](_0x134584));if(_0x2f0779[_0x8ea2('0x5')]!==_0x5c1212){_0x2f0779[_0x8ea2('0x5')]=_0x5c1212;emit(util[_0x8ea2('0x75')](_0x8ea2('0x76'),_0x134584[_0x8ea2('0x44')]),_0x8ea2('0x77'),_0x134584);}}}function emitCampaignSummary(_0x215fa5){if(_0x215fa5['type']===_0x8ea2('0x78')){emit(util[_0x8ea2('0x75')](_0x8ea2('0x79'),_0x215fa5['name']),'campaign:save',_0x215fa5);}}function checkGetDataPredictive(_0x7cd361){if(isNotNull(_0x7cd361)){if(!_[_0x8ea2('0x45')](_0x7cd361)){if(_0x7cd361[_0x8ea2('0x71')]>0x0){if(!_['isUndefined'](_0x7cd361[_0x8ea2('0x6a')])&&_0x7cd361[_0x8ea2('0x6a')]>0x0){return!![];}else{loggerPredictive[_0x8ea2('0x7a')](_0x8ea2('0x7b'),JSON[_0x8ea2('0x4a')](_0x7cd361));}if(!_['isUndefined'](_0x7cd361['predictiveIntervalAvgHoldtime'])&&_0x7cd361[_0x8ea2('0x69')]>0x0){return!![];}else{loggerPredictive[_0x8ea2('0x7a')](_0x8ea2('0x7c'),JSON['stringify'](_0x7cd361));}}else{loggerPredictive[_0x8ea2('0x7a')](_0x8ea2('0x7d'),JSON[_0x8ea2('0x4a')](_0x7cd361));}}else{loggerPredictive['info']('[checkGetDataPredictive][objIsEmpty]',JSON['stringify'](_0x7cd361));}}else{loggerPredictive['info']('[checkGetDataPredictive][obj]',JSON[_0x8ea2('0x4a')](_0x7cd361));}return![];}function mergeDataErlangB(_0x3020ad){return function(_0x5f56f8){loggerPredictive['info'](_0x8ea2('0x7e'),JSON[_0x8ea2('0x4a')](_0x5f56f8));_[_0x8ea2('0x7f')](_0x3020ad,_0x5f56f8);};}function getDiff(_0x5eea45){var _0x1caa2e=moment()[_0x8ea2('0x4b')](0x0);var _0x59e3df=moment(_0x5eea45)[_0x8ea2('0x4b')](0x0);return _0x1caa2e[_0x8ea2('0x4c')](_0x59e3df,_0x8ea2('0x80'));}function ifInterval(_0xee93b1,_0x4728b4){if(_['isUndefined'](_0x4728b4)){return![];}if(getDiff(_0x4728b4)<_0xee93b1*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x4a8326){if(isNotNull(_0x4a8326)){if(!_['isUndefined'](_0x4a8326[_0x8ea2('0x2b')])){_0x4a8326[_0x8ea2('0x2b')]=undefined;loggerPredictive[_0x8ea2('0x7a')](_0x8ea2('0x81'),_0x8ea2('0x2b'),_0x4a8326[_0x8ea2('0x44')]);}if(!_[_0x8ea2('0x3e')](_0x4a8326['startPredictive'])){_0x4a8326['startPredictive']=undefined;loggerPredictive['info'](_0x8ea2('0x81'),_0x8ea2('0x82'),_0x4a8326[_0x8ea2('0x44')]);}if(!_[_0x8ea2('0x3e')](_0x4a8326['handlePredictive'])){clearInterval(_0x4a8326[_0x8ea2('0x83')]);_0x4a8326[_0x8ea2('0x83')]=undefined;loggerPredictive['info'](_0x8ea2('0x81'),_0x8ea2('0x83'),_0x4a8326[_0x8ea2('0x44')]);}}}function erlangb(_0xf78d1d,_0x3de1a2){if(_0x3de1a2===0x0){return 0x0;}var _0x48c1de=0x1;for(var _0x479c05=0x1;_0x479c05<=_0x3de1a2;_0x479c05+=0x1){_0x48c1de=0x1+_0x48c1de*_0x479c05/_0xf78d1d;}return 0x1/_0x48c1de;}function isVoiceQueueOutbound(_0x4e87fe){return _0x4e87fe===_0x8ea2('0x4f');}function isNotPreview(_0x1e2066){return _0x1e2066!==_0x8ea2('0x22');}function isCampaignIvr(_0x2d8221){return _0x2d8221===_0x8ea2('0x78');}function getCallerId(_0x491d3d,_0x461d32,_0x3b3eab){if(!_[_0x8ea2('0x3e')](_0x3b3eab)&&_0x8ea2('0x84')===typeof _0x3b3eab&&!_['isEmpty'](_0x3b3eab)){if(!_[_0x8ea2('0x3e')](_0x461d32)&&'string'===typeof _0x461d32&&!_[_0x8ea2('0x45')](_0x461d32)){return util['format'](_0x8ea2('0x85'),_0x461d32,_0x3b3eab);}return util[_0x8ea2('0x75')]('\x22%s\x22\x20<%s>',_0x3b3eab,_0x3b3eab);}if(!_['isUndefined'](_0x491d3d)&&_0x8ea2('0x84')===typeof _0x491d3d&&!_['isEmpty'](_0x491d3d)){return _0x491d3d;}return _0x8ea2('0x86');}function loggerCatchQueueSummary(_0x31a56f,_0x1c5489){return function(_0x23185e){freeVariablesPredictive(_0x1c5489);emitVoiceQueueSummary(_0x1c5489);emitCampaignSummary(_0x1c5489);loggerSyncQueueSummary['error'](_0x31a56f,util[_0x8ea2('0x87')](_0x23185e,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x2eae97,_0x39776d){return function(_0x3f5ee6){loggerPredictive[_0x8ea2('0x88')](_0x2eae97,JSON[_0x8ea2('0x4a')](_0x3f5ee6));freeVariablesPredictive(_0x39776d);};}function loggerCatch(_0x30a4a5){return function(_0x3a78c9){logger[_0x8ea2('0x88')](_0x30a4a5,util[_0x8ea2('0x87')](_0x3a78c9,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x44a198){return _0x44a198&&!_[_0x8ea2('0x3e')](_0x44a198)&&_0x44a198['length']>0x0;}function decremetOriginate(_0x23fce4){if(!_[_0x8ea2('0x3e')](_0x23fce4)&&_0x23fce4!==null){if(_0x23fce4[_0x8ea2('0x89')](_0x8ea2('0x8a'))){if(_0x23fce4[_0x8ea2('0x8a')]>0x0){_0x23fce4[_0x8ea2('0x8a')]-=0x1;}else{logger[_0x8ea2('0x88')](_0x8ea2('0x8b'));}}}else{logger[_0x8ea2('0x88')](_0x8ea2('0x8c'));}}function checkContactLowerLimitOriginate(_0x2500c5,_0x35cfc5,_0x56b905){if(_0x35cfc5>_0x56b905){for(var _0x13ac5f=0x0;_0x13ac5f<_0x35cfc5-_0x56b905;_0x13ac5f+=0x1){decremetOriginate(_0x2500c5);}}}function loggerGetContactDialer(_0x383027,_0xb55bc6,_0x396f5b){return function(_0x1cb87d){checkContactLowerLimitOriginate(_0xb55bc6,_0x396f5b,0x0);logger['error'](_0x383027,util['inspect'](_0x1cb87d,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5d4d9e){return function(_0x17f2f2){if(isNotNull(_0x17f2f2)&&isNotNull(_0x17f2f2[0x0])){if(_0x17f2f2[0x0][_0x8ea2('0x8d')]>0x0){_0x5d4d9e[_0x8ea2('0x3f')]=_0x8ea2('0x8e');logger[_0x8ea2('0x7a')](_0x8ea2('0x8f')+_0x5d4d9e['name'],_0x17f2f2[0x0][_0x8ea2('0x8d')],_0x8ea2('0x90'));}else{_0x5d4d9e['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0x8ea2('0x7a')](_0x8ea2('0x91')+_0x5d4d9e[_0x8ea2('0x44')]);}}};}function notSendMessagesQueue(_0x289e74){if(_0x289e74[_0x8ea2('0x92')]){freeVariablesPredictive(_0x289e74);if(_0x289e74[_0x8ea2('0x8a')]===0x0&&_0x289e74[_0x8ea2('0x93')]===0x0&&_0x289e74['waiting']===0x0&&(_0x289e74[_0x8ea2('0x53')]||0x0)===0x0){_0x289e74[_0x8ea2('0x92')]=![];_0x289e74[_0x8ea2('0x51')]=0x0;_0x289e74[_0x8ea2('0x3f')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x8ea2('0x88')](_0x8ea2('0x94'),_0x289e74[_0x8ea2('0x44')],'is\x20not\x20active');}else{_0x289e74[_0x8ea2('0x3f')]='IS_DISACTIVED';loggerSyncQueueSummary['error'](_0x8ea2('0x94'),_0x289e74[_0x8ea2('0x44')],'is\x20disactive');}emitVoiceQueueSummary(_0x289e74);}}function notSendMessagesCampaign(_0x5a6543){if(_0x5a6543['sendMessageOneNotActive']){if(_0x5a6543[_0x8ea2('0x8a')]===0x0){_0x5a6543['sendMessageOneNotActive']=![];_0x5a6543['message']=_0x8ea2('0x41');loggerSyncQueueSummary[_0x8ea2('0x88')](_0x8ea2('0x95'),_0x5a6543[_0x8ea2('0x44')],_0x8ea2('0x96'));}else{_0x5a6543[_0x8ea2('0x3f')]=_0x8ea2('0x97');loggerSyncQueueSummary[_0x8ea2('0x88')](_0x8ea2('0x95'),_0x5a6543[_0x8ea2('0x44')],_0x8ea2('0x98'));}emitCampaignSummary(_0x5a6543);}}function createObjHistory(_0x15eab7,_0x1961a9,_0xbe3378,_0x5d28ae,_0x8360c8){_0x15eab7[_0x8ea2('0x3f')]=_0xbe3378;var _0x41b3c8=new Action(_0x15eab7,_0x1961a9);var _0x47a6b7=new History(_0x41b3c8);_0x47a6b7[_0x8ea2('0x99')]=_0x5d28ae;_0x47a6b7['statedesc']=_0x8360c8;_0x47a6b7[_0x8ea2('0x9a')]=_0x41b3c8['starttime'];return _0x47a6b7;}Dialer[_0x8ea2('0x1d')]['loopClearZombieChannels']=function(){var _0x321d6f=this;setInterval(function(){_0x321d6f[_0x8ea2('0x9b')](_0x321d6f['uniqueId'],_0x8ea2('0x9c'));_0x321d6f['clearZombieChannels'](_0x321d6f[_0x8ea2('0x9d')],_0x8ea2('0x9e'));},0x32c8);};Dialer[_0x8ea2('0x1d')][_0x8ea2('0x9b')]=function(_0x27ad8d,_0x4fd150){var _0x5c5cda=this;for(var _0x39d0d7 in _0x27ad8d){if(_0x27ad8d['hasOwnProperty'](_0x39d0d7)){this[_0x8ea2('0x21')][_0x8ea2('0x1e')](function(){if(!_[_0x8ea2('0x9f')](_0x27ad8d[_0x39d0d7])){return ami[_0x8ea2('0xa0')]({'action':_0x8ea2('0xa1'),'channel':_0x27ad8d[_0x39d0d7][_0x8ea2('0xa2')]})['catch'](function(_0x4aa32e){if(_0x4aa32e['message']===_0x8ea2('0xa3')){setTimeout(function(){if(_0x27ad8d[_0x39d0d7]&&_0x27ad8d[_0x39d0d7]['type']!==_0x8ea2('0x78')){_0x5c5cda[_0x8ea2('0xa4')](_0x5c5cda[_0x8ea2('0x23')][_0x27ad8d[_0x39d0d7][_0x8ea2('0xa5')]]);logger[_0x8ea2('0x88')](_0x8ea2('0xa6'),_0x4fd150,_0x39d0d7,_0x27ad8d[_0x39d0d7]['queue']);delete _0x27ad8d[_0x39d0d7];}if(_0x27ad8d[_0x39d0d7]&&_0x27ad8d[_0x39d0d7][_0x8ea2('0x4e')]===_0x8ea2('0x78')){_0x5c5cda[_0x8ea2('0xa4')](_0x5c5cda[_0x8ea2('0x24')][_0x27ad8d[_0x39d0d7][_0x8ea2('0xa5')]]);logger['error']('[Dialer][checkChannel][ivr]',_0x4fd150,_0x39d0d7,_0x27ad8d[_0x39d0d7][_0x8ea2('0xa5')]);delete _0x27ad8d[_0x39d0d7];}},0x2328);}});}});}}};Dialer[_0x8ea2('0x1d')][_0x8ea2('0xa7')]=function(_0x2d93b5){return BPromise[_0x8ea2('0xa8')]()[_0x8ea2('0xa9')](cmHopper[_0x8ea2('0xa7')](_0x2d93b5))[_0x8ea2('0xaa')](loggerCatch(_0x8ea2('0xab')));};Dialer[_0x8ea2('0x1d')][_0x8ea2('0xac')]=function(_0x1a5462){return BPromise[_0x8ea2('0xa8')]()[_0x8ea2('0xa9')](cmHopperBlack[_0x8ea2('0xac')](_0x1a5462))[_0x8ea2('0xaa')](loggerCatch(_0x8ea2('0xad')));};Dialer['prototype']['checkIsBlackListIvr']=function(_0x222705){return BPromise['resolve']()[_0x8ea2('0xa9')](cmHopperBlack[_0x8ea2('0xae')](_0x222705))['catch'](loggerCatch(_0x8ea2('0xaf')));};Dialer['prototype'][_0x8ea2('0xb0')]=function(_0x1f4eaf){return BPromise['resolve']()[_0x8ea2('0xa9')](cmHopperHistory[_0x8ea2('0xb1')](_0x1f4eaf))[_0x8ea2('0xaa')](loggerCatch(_0x8ea2('0xb2')));};Dialer[_0x8ea2('0x1d')][_0x8ea2('0xb3')]=function(_0x3c3d18){return BPromise[_0x8ea2('0xa8')]()[_0x8ea2('0xa9')](cmHopper[_0x8ea2('0xb3')](_0x3c3d18))['catch'](loggerCatch(_0x8ea2('0xb4')));};Dialer[_0x8ea2('0x1d')]['getContactDialer']=function(_0x319613,_0x5a69e6,_0x4e3a1b,_0x58cd5d){return BPromise[_0x8ea2('0xa8')]()['then'](cmHopper[_0x8ea2('0xb5')](_0x319613,_0x5a69e6,_0x4e3a1b,_0x58cd5d))[_0x8ea2('0xaa')](loggerCatch(_0x8ea2('0xb6')));};Dialer[_0x8ea2('0x1d')][_0x8ea2('0xb7')]=function(_0x4240d5,_0x5bc986,_0x2f4f45){return BPromise['resolve']()[_0x8ea2('0xa9')](cmHopper[_0x8ea2('0xb7')](_0x4240d5,_0x5bc986,_0x2f4f45))[_0x8ea2('0xaa')](loggerCatch(_0x8ea2('0xb6')));};Dialer[_0x8ea2('0x1d')]['getVoiceQueueRtPauses']=function(_0x1d42a1){return BPromise[_0x8ea2('0xa8')]()[_0x8ea2('0xa9')](voiceQueueRt[_0x8ea2('0xb8')](_0x1d42a1))[_0x8ea2('0xaa')](loggerCatch(_0x8ea2('0xb9')));};Dialer[_0x8ea2('0x1d')][_0x8ea2('0xba')]=function(_0x2e3551){return BPromise[_0x8ea2('0xa8')]()[_0x8ea2('0xa9')](cmHopper[_0x8ea2('0xba')](_0x2e3551))[_0x8ea2('0xaa')](loggerCatch(_0x8ea2('0xbb')));};Dialer[_0x8ea2('0x1d')][_0x8ea2('0xbc')]=function(_0x1bc073){return BPromise['resolve']()[_0x8ea2('0xa9')](cmHopperHistory['createHistory'](_0x1bc073))['catch'](loggerCatch(_0x8ea2('0xbd')));};Dialer[_0x8ea2('0x1d')]['updateOriginated']=function(_0x16c52e){if(!_[_0x8ea2('0x3e')](_0x16c52e)&&_0x16c52e!==null){if(_0x16c52e['hasOwnProperty'](_0x8ea2('0x8a'))){if(_0x16c52e[_0x8ea2('0x8a')]>0x0){_0x16c52e['originated']-=0x1;}else{logger[_0x8ea2('0x88')](_0x8ea2('0xbe'));}}}else{logger[_0x8ea2('0x88')](_0x8ea2('0xbf'));}};Dialer[_0x8ea2('0x1d')]['loggerHandler']=function(_0x27b577,_0x8384bb){var _0x46d2a9=this;return function(_0x357df2){_0x46d2a9[_0x8ea2('0xa4')](_0x8384bb);logger[_0x8ea2('0x88')](_0x27b577,util[_0x8ea2('0x87')](_0x357df2,{'showHidden':![],'depth':null}));};};Dialer[_0x8ea2('0x1d')][_0x8ea2('0xc0')]=function(_0x57f89b,_0x4183cb,_0x51276b){var _0x10cd1e={'state':0x19,'statedesc':_0x8ea2('0xc1')};this[_0x8ea2('0xa4')](_0x4183cb);this[_0x8ea2('0xc2')](_[_0x8ea2('0x7f')](_0x10cd1e,_['pick'](_0x51276b,[_0x8ea2('0xc3'),_0x8ea2('0xc4'),'UserId','VoiceQueueId',_0x8ea2('0xc5')])),_0x8ea2('0xc6'),'[emptyContact]');logger['error'](_0x57f89b);};Dialer[_0x8ea2('0x1d')][_0x8ea2('0xc7')]=function(_0x4e2d65){return _0x4e2d65===_0x8ea2('0xc8');};Dialer[_0x8ea2('0x1d')][_0x8ea2('0xc9')]=function(_0x10cf2d){return!_[_0x8ea2('0x3e')](_0x10cf2d)&&_0x10cf2d&&!_['isUndefined'](_0x10cf2d[_0x8ea2('0x44')])&&!_[_0x8ea2('0x3e')](_0x10cf2d[_0x8ea2('0x73')])&&_0x10cf2d[_0x8ea2('0x73')]&&(this[_0x8ea2('0x26')][util['format'](_0x8ea2('0xca'),_0x10cf2d['name'])]['status']===_0x8ea2('0xcb')||this[_0x8ea2('0x26')][util['format'](_0x8ea2('0xca'),_0x10cf2d[_0x8ea2('0x44')])][_0x8ea2('0xa1')]===_0x8ea2('0xcc'));};Dialer[_0x8ea2('0x1d')][_0x8ea2('0xc2')]=function(_0x5dfec3,_0x525151,_0x4c3838){this[_0x8ea2('0xbc')](_0x5dfec3)['catch'](loggerCatch(_0x525151));this[_0x8ea2('0xba')](_0x5dfec3)[_0x8ea2('0xaa')](loggerCatch(_0x4c3838));};Dialer[_0x8ea2('0x1d')][_0x8ea2('0x3a')]=function(_0x470099){var _0x49d292=this[_0x8ea2('0x29')][_0x470099[_0x8ea2('0xcd')]];var _0x13899a;if(!_[_0x8ea2('0x9f')](_0x470099)&&!_['isNil'](_0x470099['variable'])&&!_[_0x8ea2('0x9f')](_0x470099['variable'][_0x8ea2('0xce')])&&_0x470099['exten']===_0x8ea2('0xcf')&&_0x49d292){if(_0x49d292[_0x8ea2('0x4e')]!==_0x8ea2('0x78')&&this[_0x8ea2('0x23')][_0x49d292[_0x8ea2('0xa5')]][_0x8ea2('0xd0')]&&_0x470099[_0x8ea2('0xd1')]==='HANGUP'){delete this[_0x8ea2('0x29')][_0x470099[_0x8ea2('0xcd')]];this[_0x8ea2('0xa4')](this[_0x8ea2('0x23')][_0x49d292[_0x8ea2('0xa5')]]);this[_0x8ea2('0x23')][_0x49d292['queue']][_0x8ea2('0xd2')]+=0x1;this[_0x8ea2('0x23')][_0x49d292[_0x8ea2('0xa5')]][_0x8ea2('0xd3')]+=0x1;_0x13899a=new Hangup(_0x49d292,_0x470099);_0x13899a['state']=0x12;_0x13899a['statedesc']='HangupInAMD';_0x13899a[_0x8ea2('0xd4')]=_0x8ea2('0xd5');this[_0x8ea2('0xc2')](_0x13899a,'[syncHangupInAMD][createHistory]',_0x8ea2('0xd6'));}if(_0x49d292[_0x8ea2('0x4e')]!==_0x8ea2('0x78')&&this['voiceQueues'][_0x49d292[_0x8ea2('0xa5')]][_0x8ea2('0xd0')]&&_0x470099['value']===_0x8ea2('0xd7')){delete this['uniqueId'][_0x470099['uniqueid']];this[_0x8ea2('0xa4')](this[_0x8ea2('0x23')][_0x49d292[_0x8ea2('0xa5')]]);this['voiceQueues'][_0x49d292[_0x8ea2('0xa5')]][_0x8ea2('0xd2')]+=0x1;this[_0x8ea2('0x23')][_0x49d292[_0x8ea2('0xa5')]][_0x8ea2('0xd3')]+=0x1;_0x13899a=new Hangup(_0x49d292,_0x470099);_0x13899a[_0x8ea2('0x99')]=0x13;_0x13899a[_0x8ea2('0xd8')]='Machine';_0x13899a[_0x8ea2('0xd4')]=_0x8ea2('0xd5');_0x13899a[_0x8ea2('0xd9')]=!![];this[_0x8ea2('0xc2')](_0x13899a,_0x8ea2('0xda'),_0x8ea2('0xdb'));}if(_0x49d292[_0x8ea2('0x4e')]==='ivr'&&this[_0x8ea2('0x24')][_0x49d292[_0x8ea2('0xa5')]][_0x8ea2('0xd0')]&&_0x470099[_0x8ea2('0xd1')]===_0x8ea2('0xdc')){delete this['uniqueId'][_0x470099[_0x8ea2('0xcd')]];this[_0x8ea2('0xa4')](this[_0x8ea2('0x24')][_0x49d292[_0x8ea2('0xa5')]]);_0x13899a=new Hangup(_0x49d292,_0x470099);_0x13899a[_0x8ea2('0x99')]=0x12;_0x13899a[_0x8ea2('0xd8')]=_0x8ea2('0xdd');_0x13899a[_0x8ea2('0xd4')]=_0x8ea2('0xd5');this['saveInDb'](_0x13899a,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x49d292[_0x8ea2('0x4e')]==='ivr'&&this[_0x8ea2('0x24')][_0x49d292[_0x8ea2('0xa5')]][_0x8ea2('0xd0')]&&_0x470099[_0x8ea2('0xd1')]===_0x8ea2('0xd7')){delete this[_0x8ea2('0x29')][_0x470099[_0x8ea2('0xcd')]];this[_0x8ea2('0xa4')](this[_0x8ea2('0x24')][_0x49d292[_0x8ea2('0xa5')]]);_0x13899a=new Hangup(_0x49d292,_0x470099);_0x13899a['state']=0x13;_0x13899a[_0x8ea2('0xd8')]=_0x8ea2('0xde');_0x13899a[_0x8ea2('0xd4')]=_0x8ea2('0xd5');_0x13899a[_0x8ea2('0xd9')]=!![];this[_0x8ea2('0xc2')](_0x13899a,_0x8ea2('0xdf'),_0x8ea2('0xe0'));}}};Dialer[_0x8ea2('0x1d')][_0x8ea2('0x37')]=function(_0x1a64d1){var _0x2776e5=this[_0x8ea2('0x29')][_0x1a64d1[_0x8ea2('0xcd')]];var _0x183546=this;var _0x1dd4f2;if(_0x2776e5&&_0x2776e5[_0x8ea2('0x4e')]==='ivr'){delete this['uniqueId'][_0x1a64d1['uniqueid']];this['updateOriginated'](this[_0x8ea2('0x24')][_0x2776e5[_0x8ea2('0xa5')]]);this['campaigns'][_0x2776e5[_0x8ea2('0xa5')]][_0x8ea2('0xe1')]+=0x1;_0x1dd4f2=new Hangup(_0x2776e5,_0x1a64d1);this[_0x8ea2('0xbc')](_0x1dd4f2)[_0x8ea2('0xaa')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x8ea2('0xba')](_0x1dd4f2)['catch'](loggerCatch(_0x8ea2('0xe2')));}if(_0x2776e5&&_0x2776e5[_0x8ea2('0x4e')]!==_0x8ea2('0x78')&&isNotNull(this[_0x8ea2('0x23')][_0x2776e5[_0x8ea2('0xa5')]][_0x8ea2('0xe3')])){delete this['uniqueId'][_0x1a64d1['uniqueid']];this[_0x8ea2('0xa4')](this[_0x8ea2('0x23')][_0x2776e5['queue']]);this[_0x8ea2('0x23')][_0x2776e5['queue']][_0x8ea2('0xd2')]+=0x1;this[_0x8ea2('0x23')][_0x2776e5[_0x8ea2('0xa5')]][_0x8ea2('0xd3')]+=0x1;_0x1dd4f2=new Hangup(_0x2776e5,_0x1a64d1);_0x1dd4f2[_0x8ea2('0x99')]=0x10;_0x1dd4f2[_0x8ea2('0xd8')]=_0x8ea2('0xe4');_0x1dd4f2['membername']=_0x8ea2('0xe5');this[_0x8ea2('0xbc')](_0x1dd4f2)[_0x8ea2('0xaa')](loggerCatch(_0x8ea2('0xe6')));this[_0x8ea2('0xba')](_0x1dd4f2)[_0x8ea2('0xaa')](loggerCatch(_0x8ea2('0xe2')));}if(_0x2776e5&&_0x2776e5[_0x8ea2('0x4e')]!==_0x8ea2('0x78')&&!isNotNull(this['voiceQueues'][_0x2776e5[_0x8ea2('0xa5')]][_0x8ea2('0xe3')])){delete this[_0x8ea2('0x29')][_0x1a64d1['uniqueid']];this[_0x8ea2('0xa4')](this[_0x8ea2('0x23')][_0x2776e5[_0x8ea2('0xa5')]]);this[_0x8ea2('0x23')][_0x2776e5[_0x8ea2('0xa5')]][_0x8ea2('0xe7')]+=0x1;_0x1dd4f2=new Hangup(_0x2776e5,_0x1a64d1);_0x1dd4f2['state']=0xc;_0x1dd4f2['statedesc']=_0x1a64d1[_0x8ea2('0xe8')];_0x1dd4f2[_0x8ea2('0xd4')]=_0x8ea2('0xe9');this[_0x8ea2('0xbc')](_0x1dd4f2)[_0x8ea2('0xaa')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x8ea2('0xba')](_0x1dd4f2)['catch'](loggerCatch(_0x8ea2('0xe2')));}};Dialer[_0x8ea2('0x1d')]['syncAgentComplete']=function(_0x21ae83){var _0x254b51=this[_0x8ea2('0x29')][_0x21ae83[_0x8ea2('0xcd')]];var _0x28d518=this;if(this[_0x8ea2('0x23')][_0x21ae83[_0x8ea2('0xa5')]]){if(_0x254b51&&_0x254b51[_0x8ea2('0x4e')]!==_0x8ea2('0x78')){delete this[_0x8ea2('0x29')][_0x21ae83['uniqueid']];this[_0x8ea2('0x23')][_0x21ae83[_0x8ea2('0xa5')]][_0x8ea2('0xd2')]+=0x1;var _0x5ba0a2=new AgentComplete(_0x254b51,_0x21ae83);if(_0x21ae83[_0x8ea2('0xea')]==='agent'){_0x5ba0a2[_0x8ea2('0xeb')]=this[_0x8ea2('0x23')][_0x21ae83[_0x8ea2('0xa5')]][_0x8ea2('0xec')]&&this[_0x8ea2('0x23')][_0x21ae83[_0x8ea2('0xa5')]][_0x8ea2('0xed')]?moment()[_0x8ea2('0x75')](_0x8ea2('0xee')):undefined;}this['createHistory'](_0x5ba0a2)[_0x8ea2('0xaa')](loggerCatch(_0x8ea2('0xef')));this[_0x8ea2('0xba')](_0x5ba0a2)[_0x8ea2('0xaa')](loggerCatch(_0x8ea2('0xf0')));}}};Dialer[_0x8ea2('0x1d')][_0x8ea2('0x2f')]=function(_0x3cc0fe){if(this[_0x8ea2('0x23')][_0x3cc0fe['queue']]){if(this[_0x8ea2('0x29')][_0x3cc0fe[_0x8ea2('0xcd')]]&&this[_0x8ea2('0x29')][_0x3cc0fe[_0x8ea2('0xcd')]][_0x8ea2('0x4e')]!==_0x8ea2('0x78')){this[_0x8ea2('0xa4')](this[_0x8ea2('0x23')][_0x3cc0fe[_0x8ea2('0xa5')]]);this[_0x8ea2('0x29')][_0x3cc0fe[_0x8ea2('0xcd')]]['answertime']=moment()[_0x8ea2('0x75')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x8ea2('0x1d')][_0x8ea2('0xf1')]=function(_0x3de1c4){this['createHistory'](_0x3de1c4)[_0x8ea2('0xaa')](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x3de1c4)['catch'](loggerCatch(_0x8ea2('0xf2')));};Dialer['prototype'][_0x8ea2('0x32')]=function(_0x23bed1){var _0x46e467=this[_0x8ea2('0x29')][_0x23bed1[_0x8ea2('0xcd')]];var _0x59590c=this;if(this[_0x8ea2('0x23')][_0x23bed1[_0x8ea2('0xa5')]]){if(_0x46e467&&_0x46e467['type']!=='ivr'){delete this[_0x8ea2('0x29')][_0x23bed1[_0x8ea2('0xcd')]];this[_0x8ea2('0xa4')](this['voiceQueues'][_0x23bed1['queue']]);_0x46e467['droptime']=moment()[_0x8ea2('0x75')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4f6c61=new QueueCallerAbandon(_0x46e467,_0x23bed1);if(getSeconds(_0x46e467[_0x8ea2('0xf3')],_0x46e467[_0x8ea2('0xf4')])>=_0x46e467['dialQueueTimeout']){this['voiceQueues'][_0x23bed1[_0x8ea2('0xa5')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0x23bed1[_0x8ea2('0xa5')]][_0x8ea2('0x62')]+=0x1;this[_0x8ea2('0x23')][_0x23bed1['queue']][_0x8ea2('0x6d')]+=0x1;_0x4f6c61[_0x8ea2('0x99')]=0xa;_0x4f6c61[_0x8ea2('0xd8')]=_0x8ea2('0xf5');_0x4f6c61[_0x8ea2('0xf6')]='TIMEOUT';_0x4f6c61[_0x8ea2('0xeb')]=this['voiceQueues'][_0x23bed1[_0x8ea2('0xa5')]]['dialQueueProject2']?moment()[_0x8ea2('0x75')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;this['queueCallerAbandonCreateState'](_0x4f6c61);}else{this[_0x8ea2('0x23')][_0x23bed1[_0x8ea2('0xa5')]][_0x8ea2('0xf7')]+=0x1;this[_0x8ea2('0x23')][_0x23bed1[_0x8ea2('0xa5')]][_0x8ea2('0x61')]+=0x1;_0x4f6c61[_0x8ea2('0x99')]=0xb;_0x4f6c61[_0x8ea2('0xd8')]='Abandoned';_0x4f6c61[_0x8ea2('0xf6')]=_0x8ea2('0xf8');this[_0x8ea2('0xf1')](_0x4f6c61);}}}};Dialer[_0x8ea2('0x1d')][_0x8ea2('0xf9')]=function(_0x4cb596){if(this[_0x8ea2('0x9d')][_0x4cb596['uniqueid']]){this[_0x8ea2('0x9d')][_0x4cb596['uniqueid']][_0x8ea2('0xa2')]=_0x4cb596[_0x8ea2('0xa2')];}if(this[_0x8ea2('0x29')][_0x4cb596[_0x8ea2('0xcd')]]){this['uniqueId'][_0x4cb596['uniqueid']]['channel']=_0x4cb596[_0x8ea2('0xa2')];}};Dialer[_0x8ea2('0x1d')]['syncQueueMember']=function(_0x31b27d){if(strategy[this[_0x8ea2('0x23')][this[_0x8ea2('0x9d')][_0x31b27d[_0x8ea2('0xfa')]][_0x8ea2('0xa5')]][_0x8ea2('0x50')]]===_0x8ea2('0x1c')){if(this[_0x8ea2('0x9d')][_0x31b27d[_0x8ea2('0xfa')]]&&_[_0x8ea2('0x9f')](this[_0x8ea2('0x9d')][_0x31b27d[_0x8ea2('0xfa')]][_0x8ea2('0xfb')])&&_0x31b27d['status']==='1'&&_0x31b27d[_0x8ea2('0xfc')]==='0'){if(this['agents'][_0x31b27d['stateinterface']]){if(!this[_0x8ea2('0x25')][_0x31b27d['stateinterface']][_0x8ea2('0xfb')]){this[_0x8ea2('0x25')][_0x31b27d[_0x8ea2('0xfd')]][_0x8ea2('0xfb')]=!![];this[_0x8ea2('0x9d')][_0x31b27d['actionid']][_0x8ea2('0xfb')]=!![];this[_0x8ea2('0x9d')][_0x31b27d[_0x8ea2('0xfa')]]['stateinterface']=_0x31b27d['stateinterface'];}}}}else if((strategy[this[_0x8ea2('0x23')][this[_0x8ea2('0x9d')][_0x31b27d['actionid']][_0x8ea2('0xa5')]]['strategy']]||_0x8ea2('0xfe'))===_0x8ea2('0xfe')){if(this[_0x8ea2('0x9d')][_0x31b27d[_0x8ea2('0xfa')]]){if(this[_0x8ea2('0x25')][_0x31b27d[_0x8ea2('0xfd')]]){this[_0x8ea2('0x9d')][_0x31b27d[_0x8ea2('0xfa')]][_0x8ea2('0xfd')]=_0x31b27d['stateinterface'];if(_['isNil'](this[_0x8ea2('0xff')][this['actions'][_0x31b27d[_0x8ea2('0xfa')]][_0x8ea2('0xa5')]])){this[_0x8ea2('0xff')][this[_0x8ea2('0x9d')][_0x31b27d['actionid']][_0x8ea2('0xa5')]]=[];}this[_0x8ea2('0xff')][this['actions'][_0x31b27d[_0x8ea2('0xfa')]][_0x8ea2('0xa5')]][_0x8ea2('0x100')](_['merge'](_['pick'](this['actions'][_0x31b27d[_0x8ea2('0xfa')]],['idHopper',_0x8ea2('0xfd')]),{'status':_0x31b27d['status'],'paused':_0x31b27d[_0x8ea2('0xfc')]}));}}}};function unlockQueueStatus(_0x2bd2e6,_0x2ab3d3){setTimeout(function(){if(_[_0x8ea2('0x3e')](_0x2bd2e6['queueStatusComplete'])){loggerBooked[_0x8ea2('0x88')]('[unlockQueueStatus][undefined]',_0x2ab3d3);}_0x2bd2e6['queueStatusComplete']=!![];loggerBooked['info'](_0x8ea2('0x101'),_0x2ab3d3,JSON[_0x8ea2('0x4a')](_[_0x8ea2('0x102')](_0x2bd2e6,['name',_0x8ea2('0x103')])));},0x1f3);}Dialer[_0x8ea2('0x1d')][_0x8ea2('0x3b')]=function(_0x2f56d5){var _0x1101ba=this;var _0x18e3ca=_0x1101ba[_0x8ea2('0x23')][_0x1101ba[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]][_0x8ea2('0xa5')]];if(strategy[this[_0x8ea2('0x23')][this[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]][_0x8ea2('0xa5')]]['strategy']]==='roundrobin'){if(this[_0x8ea2('0x9d')][_0x2f56d5['actionid']]&&this[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]][_0x8ea2('0xfd')]){this['preview'][_0x8ea2('0x104')](this['actions'][_0x2f56d5['actionid']][_0x8ea2('0x105')],this[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]][_0x8ea2('0xfd')])[_0x8ea2('0xaa')](function(_0x38622a){logger[_0x8ea2('0x88')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x8ea2('0x87')](_0x38622a,{'showHidden':![],'depth':null}));})[_0x8ea2('0x20')](function(){_0x1101ba[_0x8ea2('0xa4')](_0x1101ba['voiceQueues'][_0x1101ba[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]][_0x8ea2('0xa5')]]);_0x1101ba['agents'][_0x1101ba[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]][_0x8ea2('0xfd')]]['locked']=![];delete _0x1101ba['actions'][_0x2f56d5[_0x8ea2('0xfa')]];unlockQueueStatus(_0x18e3ca);});}else{this['updateOriginated'](this[_0x8ea2('0x23')][this['actions'][_0x2f56d5[_0x8ea2('0xfa')]][_0x8ea2('0xa5')]]);this[_0x8ea2('0xb3')]({'active':![],'ContactId':this[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]]['ContactId'],'ListId':this[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]][_0x8ea2('0xc4')],'VoiceQueueId':this[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]][_0x8ea2('0x106')]||undefined,'CampaignId':this['actions'][_0x2f56d5['actionid']][_0x8ea2('0xc5')]||undefined})[_0x8ea2('0xaa')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]];unlockQueueStatus(_0x18e3ca);}}else if((strategy[this[_0x8ea2('0x23')][this[_0x8ea2('0x9d')][_0x2f56d5['actionid']][_0x8ea2('0xa5')]][_0x8ea2('0x50')]]||'rrmemory')===_0x8ea2('0xfe')){var _0x5213fa;if(this[_0x8ea2('0x9d')][_0x2f56d5['actionid']]&&!_['isEmpty'](this[_0x8ea2('0xff')][this[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]][_0x8ea2('0xa5')]])){if(this['queueBookedRR'][_0x1101ba[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]][_0x8ea2('0xa5')]]){this['queueBookedRR'][_0x1101ba[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]][_0x8ea2('0xa5')]]=this[_0x8ea2('0x2d')][this[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]][_0x8ea2('0xa5')]]?this['queueBookedRR'][this[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]][_0x8ea2('0xa5')]]:this[_0x8ea2('0xff')][this[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]][_0x8ea2('0xa5')]]?this[_0x8ea2('0xff')][this[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]][_0x8ea2('0xa5')]][_0x8ea2('0x107')]||0x0:0x0;}this['queueBooked'][this['actions'][_0x2f56d5[_0x8ea2('0xfa')]]['queue']][_0x8ea2('0x107')]=this[_0x8ea2('0x2d')][this[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]][_0x8ea2('0xa5')]];for(var _0x515381=0x0;_0x515381<this[_0x8ea2('0xff')][this[_0x8ea2('0x9d')][_0x2f56d5['actionid']][_0x8ea2('0xa5')]][_0x8ea2('0x108')];_0x515381+=0x1){_0x5213fa=rr(this[_0x8ea2('0xff')][this[_0x8ea2('0x9d')][_0x2f56d5['actionid']][_0x8ea2('0xa5')]]);this[_0x8ea2('0x2d')][_0x1101ba[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]]['queue']]=this[_0x8ea2('0xff')][this[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]]['queue']][_0x8ea2('0x107')];if(_0x5213fa[_0x8ea2('0xa1')]==='1'&&_0x5213fa[_0x8ea2('0xfc')]==='0'){break;}}if(!_['isNil'](_0x5213fa)){this['agents'][_0x5213fa[_0x8ea2('0xfd')]]['unlockRR']=_[_0x8ea2('0x3e')](this[_0x8ea2('0x25')][_0x5213fa[_0x8ea2('0xfd')]][_0x8ea2('0x109')])?!![]:this['agents'][_0x5213fa[_0x8ea2('0xfd')]]['unlockRR'];}loggerBooked['info']('[booked][RR]',_0x2f56d5['actionid'],_0x8ea2('0x10a'),JSON[_0x8ea2('0x4a')](_[_0x8ea2('0x102')](this[_0x8ea2('0x25')][_0x5213fa[_0x8ea2('0xfd')]],['name','unlockRR'])),_0x8ea2('0x10b'),JSON['stringify'](_0x5213fa['idHopper']));if(!_[_0x8ea2('0x9f')](_0x5213fa)&&_0x5213fa[_0x8ea2('0xa1')]==='1'&&_0x5213fa[_0x8ea2('0xfc')]==='0'&&this['agents'][_0x5213fa[_0x8ea2('0xfd')]]['unlockRR']){this[_0x8ea2('0x25')][_0x5213fa[_0x8ea2('0xfd')]]['unlockRR']=![];this[_0x8ea2('0xff')][_0x1101ba[_0x8ea2('0x9d')][_0x2f56d5['actionid']][_0x8ea2('0xa5')]]=[];this[_0x8ea2('0x22')][_0x8ea2('0x104')](_0x5213fa[_0x8ea2('0x105')],_0x5213fa[_0x8ea2('0xfd')])[_0x8ea2('0xaa')](function(_0x412b9e){logger[_0x8ea2('0x88')](_0x8ea2('0x10c'),util['inspect'](_0x412b9e,{'showHidden':![],'depth':null}));})[_0x8ea2('0x20')](function(){_0x1101ba['updateOriginated'](_0x1101ba[_0x8ea2('0x23')][_0x1101ba[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]][_0x8ea2('0xa5')]]);setTimeout(function(){_0x1101ba[_0x8ea2('0x25')][_0x5213fa[_0x8ea2('0xfd')]][_0x8ea2('0x109')]=!![];loggerBooked[_0x8ea2('0x7a')]('[booked][RR][finaly]',_0x2f56d5['actionid'],_0x8ea2('0x10a'),JSON[_0x8ea2('0x4a')](_[_0x8ea2('0x102')](_0x1101ba[_0x8ea2('0x25')][_0x5213fa[_0x8ea2('0xfd')]],['name',_0x8ea2('0x109')])),_0x8ea2('0x10b'),JSON['stringify'](_0x5213fa[_0x8ea2('0x105')]));},0xc7);delete _0x1101ba[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]];unlockQueueStatus(_0x18e3ca,_0x2f56d5['actionid']);});}else{loggerBooked['info'](_0x8ea2('0x10d'));this['updateOriginated'](this[_0x8ea2('0x23')][this[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]][_0x8ea2('0xa5')]]);this[_0x8ea2('0xb3')]({'active':![],'ContactId':this[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]][_0x8ea2('0xc3')],'ListId':this[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]][_0x8ea2('0xc4')],'VoiceQueueId':this[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]][_0x8ea2('0x106')]||undefined,'CampaignId':this[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]][_0x8ea2('0xc5')]||undefined})[_0x8ea2('0xaa')](loggerCatch(_0x8ea2('0x10e')));delete this['actions'][_0x2f56d5['actionid']];unlockQueueStatus(_0x18e3ca);}}else{loggerBooked['info'](_0x8ea2('0x10f'));this[_0x8ea2('0xa4')](this[_0x8ea2('0x23')][this[_0x8ea2('0x9d')][_0x2f56d5['actionid']]['queue']]);this[_0x8ea2('0xb3')]({'active':![],'ContactId':this['actions'][_0x2f56d5[_0x8ea2('0xfa')]][_0x8ea2('0xc3')],'ListId':this[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]][_0x8ea2('0xc4')],'VoiceQueueId':this[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]][_0x8ea2('0xc5')]||undefined})[_0x8ea2('0xaa')](loggerCatch('[unlock2][syncQueueStatusComplete]'));delete this['actions'][_0x2f56d5[_0x8ea2('0xfa')]];unlockQueueStatus(_0x18e3ca);}}else{loggerBooked[_0x8ea2('0x7a')](_0x8ea2('0x110'));this['updateOriginated'](this['voiceQueues'][this[_0x8ea2('0x9d')][_0x2f56d5['actionid']][_0x8ea2('0xa5')]]);this[_0x8ea2('0xb3')]({'active':![],'ContactId':this[_0x8ea2('0x9d')][_0x2f56d5['actionid']][_0x8ea2('0xc3')],'ListId':this[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]][_0x8ea2('0xc4')],'VoiceQueueId':this['actions'][_0x2f56d5['actionid']][_0x8ea2('0x106')]||undefined,'CampaignId':this[_0x8ea2('0x9d')][_0x2f56d5[_0x8ea2('0xfa')]]['CampaignId']||undefined})[_0x8ea2('0xaa')](loggerCatch('[unlock3][syncQueueStatusComplete]'));delete this[_0x8ea2('0x9d')][_0x2f56d5['actionid']];unlockQueueStatus(_0x18e3ca);}};Dialer[_0x8ea2('0x1d')]['loopCampaigns']=function(){var _0x1ea4ff=this;setInterval(function(){_0x1ea4ff[_0x8ea2('0x111')]();},0x3e8);};Dialer[_0x8ea2('0x1d')][_0x8ea2('0x112')]=function(_0x5794ab){var _0xd6254f=this;return function(){if(!_0xd6254f[_0x8ea2('0xc9')](_0x5794ab[_0x8ea2('0x72')])){if(!_0xd6254f[_0x8ea2('0xc9')](_0x5794ab['TrunkBackup'])){_0x5794ab[_0x8ea2('0x3f')]=_0x8ea2('0x113');throw _0x5794ab[_0x8ea2('0x44')]+_0x8ea2('0x114');}}};};Dialer[_0x8ea2('0x1d')]['checkIfTime']=function(_0x3270b5,_0x17746b,_0x306d01,_0x17694e){var _0x5478f4=this;return function(){var _0x33f17c=!![];return _0x5478f4[_0x8ea2('0x115')](_0x3270b5,_0x17746b,_0x306d01,_0x17694e,_0x33f17c);};};Dialer['prototype']['checkIfTimeIntervals']=function(_0x5c5300,_0x4035eb,_0x3eeecc,_0x348ce0){var _0x2a0da0=this;return function(){var _0x3c9013=![];return _0x2a0da0[_0x8ea2('0x115')](_0x5c5300['Intervals'],_0x4035eb,_0x3eeecc,_0x348ce0,_0x3c9013);};};Dialer['prototype'][_0x8ea2('0x115')]=function(_0x20f2ed,_0x3d417e,_0x485936,_0x5dacaf,_0x20513c){var _0x39b4d9=[];return new BPromise(function(_0x572ba7,_0x2dc748){if(!isNotNull(_0x20f2ed)){_0x5dacaf['message']=_0x8ea2('0x43');return _0x2dc748(msgResponse(_0x8ea2('0x115'),_0x8ea2('0x116'),_0x485936+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x8ea2('0x45')](_0x20f2ed)){_0x5dacaf[_0x8ea2('0x3f')]='INTERVAL_IS_EMPTY';return _0x2dc748(msgResponse(_0x8ea2('0x115'),_0x8ea2('0x116'),_0x485936+'\x20Intervals\x20is\x20empty\x20'));}if(_0x3d417e&&_['isUndefined'](config[_0x8ea2('0x117')][_0x3d417e])){_0x5dacaf[_0x8ea2('0x3f')]=_0x8ea2('0x118');return _0x2dc748(msgResponse('ifTime',_0x8ea2('0x116'),_0x485936+_0x8ea2('0x119')+_0x3d417e));}if(_[_0x8ea2('0x11a')](_0x20f2ed)){for(var _0x42b171=0x0;_0x42b171<_0x20f2ed[_0x8ea2('0x108')];_0x42b171+=0x1){_0x39b4d9['push'](ami[_0x8ea2('0xa0')]({'action':'command','command':util[_0x8ea2('0x75')]('iftime\x20%s,%s',_0x20f2ed[_0x42b171][_0x8ea2('0x11b')],!_[_0x8ea2('0x3e')](config[_0x8ea2('0x117')][_0x3d417e])?_0x3d417e:'')})[_0x8ea2('0xa9')](function(_0x53212f){return _0x53212f[_0x8ea2('0x11c')][_0x8ea2('0x11d')](_0x8ea2('0x11e'))>=0x0?!![]:![];})[_0x8ea2('0xaa')](myreject(_0x2dc748)));}}else{_0x39b4d9[_0x8ea2('0x100')](ami[_0x8ea2('0xa0')]({'action':_0x8ea2('0x11f'),'command':util[_0x8ea2('0x75')](_0x8ea2('0x120'),_0x20f2ed,!_[_0x8ea2('0x3e')](config[_0x8ea2('0x117')][_0x3d417e])?_0x3d417e:'')})['then'](function(_0x2ab1da){return _0x2ab1da[_0x8ea2('0x11c')][_0x8ea2('0x11d')]('true')>=0x0?!![]:![];})[_0x8ea2('0xaa')](myreject(_0x2dc748)));}BPromise[_0x8ea2('0x121')](_0x39b4d9)[_0x8ea2('0xa9')](function(_0x14dd7b){var _0x467730=_[_0x8ea2('0x122')](_0x14dd7b);if(_0x467730){return _0x572ba7(_0x467730);}else{_0x5dacaf[_0x8ea2('0x3f')]=_0x20513c?_0x8ea2('0x123'):_0x8ea2('0x124');return _0x2dc748(msgResponse(_0x8ea2('0x125'),'Failure',_0x8ea2('0x126')+_0x20513c+'\x20'+_0x485936+_0x8ea2('0x127')+util[_0x8ea2('0x87')](_0x20f2ed,{'showHidden':![],'depth':null})+_0x8ea2('0x128')+_0x3d417e));}})['catch'](function(_0x3556b9){return _0x2dc748(msgResponse(_0x8ea2('0x115'),_0x8ea2('0x116'),JSON[_0x8ea2('0x4a')](_0x3556b9)));});});};Dialer[_0x8ea2('0x1d')][_0x8ea2('0x129')]=function(_0x109785){var _0x4db2c3=this;return function(){switch(_0x109785[_0x8ea2('0x5c')]){case _0x8ea2('0x12a'):freeVariablesPredictive(_0x109785);_0x4db2c3['handlePower'](_0x109785,0x1);break;case _0x8ea2('0x12b'):freeVariablesPredictive(_0x109785);_0x4db2c3[_0x8ea2('0x12c')](_0x109785,_0x109785[_0x8ea2('0x12d')]);break;case'predictive':_0x4db2c3['predictive'](_0x109785);break;case _0x8ea2('0xa'):freeVariablesPredictive(_0x109785);_0x4db2c3['handlePower'](_0x109785,0x1);break;default:freeVariablesPredictive(_0x109785);logger['error'](_0x8ea2('0x12e'),_0x109785[_0x8ea2('0x44')],'method\x20not\x20recognized');}};};Dialer[_0x8ea2('0x1d')][_0x8ea2('0x12f')]=function(_0x581ebe){var _0x25363b=this;return function(){_0x25363b['handleIvr'](_0x581ebe);};};Dialer[_0x8ea2('0x1d')][_0x8ea2('0xd')]=function(_0x45a633){var _0x276b1f=this;if(isNotPreview(_0x45a633[_0x8ea2('0x5c')])){if(isVoiceQueueOutbound(_0x45a633[_0x8ea2('0x4e')])&&isActive(_0x45a633[_0x8ea2('0x5b')])){_0x45a633[_0x8ea2('0x92')]=!![];BPromise[_0x8ea2('0xa8')]()[_0x8ea2('0xa9')](checkIsLoggedIn(_0x45a633,_0x45a633[_0x8ea2('0x52')]))[_0x8ea2('0xa9')](checkIsActive(_0x45a633,_0x45a633[_0x8ea2('0x5b')]))[_0x8ea2('0xa9')](checkInterval(_0x45a633))[_0x8ea2('0xa9')](_0x276b1f[_0x8ea2('0x112')](_0x45a633))['then'](_0x276b1f[_0x8ea2('0x130')](_0x45a633[_0x8ea2('0x131')],_0x45a633['dialTimezone'],_0x45a633['name'],_0x45a633))[_0x8ea2('0xa9')](_0x276b1f['checkIfTimeIntervals'](_0x45a633['Interval'],_0x45a633[_0x8ea2('0x132')],_0x45a633[_0x8ea2('0x44')],_0x45a633))[_0x8ea2('0xa9')](_0x276b1f['checkDialMethod'](_0x45a633))[_0x8ea2('0xaa')](loggerCatchQueueSummary(_0x8ea2('0x133'),_0x45a633));}else{notSendMessagesQueue(_0x45a633);}}else{freeVariablesPredictive(_0x45a633);}};Dialer[_0x8ea2('0x1d')]['syncCampaigns']=function(){var _0x54aec3=this;var _0x5a4039;for(var _0xa9944b in this['campaigns']){if(this['campaigns'][_0x8ea2('0x89')](_0xa9944b)){_0x5a4039=this[_0x8ea2('0x24')][_0xa9944b];if(isCampaignIvr(_0x5a4039[_0x8ea2('0x4e')])&&isActive(_0x5a4039[_0x8ea2('0x73')])){_0x5a4039[_0x8ea2('0x92')]=!![];BPromise[_0x8ea2('0xa8')]()[_0x8ea2('0xa9')](checkIsActive(_0x5a4039,_0x5a4039[_0x8ea2('0x73')]))[_0x8ea2('0xa9')](checkInterval(_0x5a4039))[_0x8ea2('0xa9')](_0x54aec3[_0x8ea2('0x112')](_0x5a4039))[_0x8ea2('0xa9')](_0x54aec3['checkIfTime'](_0x5a4039['dialGlobalInterval'],_0x5a4039['dialTimezone'],_0x5a4039[_0x8ea2('0x44')],_0x5a4039))[_0x8ea2('0xa9')](_0x54aec3['checkIfTimeIntervals'](_0x5a4039['Interval'],_0x5a4039[_0x8ea2('0x132')],_0x5a4039[_0x8ea2('0x44')],_0x5a4039))[_0x8ea2('0xa9')](_0x54aec3[_0x8ea2('0x12f')](_0x5a4039))[_0x8ea2('0xaa')](loggerCatchQueueSummary('[syncCampaigns]',_0x5a4039));}else{notSendMessagesCampaign(_0x5a4039);}}}};function getCallerIdRandom(_0x294220,_0x5736b9){var _0x3c8cfe,_0x565fd4,_0x3b4ae6;if(_0x5736b9<=0x0){_0x5736b9=0x1;}_0x3c8cfe=new RegExp('\x5cw{0,'+_0x5736b9+'}$');_0x565fd4=Math[_0x8ea2('0x134')](0xa,_0x5736b9-0x1);_0x3b4ae6=Math[_0x8ea2('0x134')](0xa,_0x5736b9)-0x1;return util['format']('%s',_['replace'](_0x294220,_0x3c8cfe,_[_0x8ea2('0x135')](_0x565fd4,_0x3b4ae6)));}function extractCalleridName(_0x431e61){var _0x2b2aa4=_0x431e61[_0x8ea2('0x136')](/"(.*?)"/);return _0x2b2aa4?_0x2b2aa4[0x1]:_0x431e61;}function extractCalleridNumber(_0x1c0f64){var _0x30a29a=_0x1c0f64[_0x8ea2('0x136')](/<(.*?)>/);return _0x30a29a?_0x30a29a[0x1]:_0x1c0f64;}Dialer[_0x8ea2('0x1d')][_0x8ea2('0x137')]=function(_0x4b21a2,_0x13b0e1){var _0x41676d=this;var _0x11ce2d=uuid['v4']();this[_0x8ea2('0x9d')][_0x11ce2d]=new Action(_0x4b21a2,_0x13b0e1,_0x11ce2d);return new BPromise(function(_0x23ee60,_0x484cd7){if(_['isUndefined'](_0x4b21a2)&&_0x8ea2('0x138')!==typeof _0x4b21a2){return _0x484cd7(msgResponse(_0x8ea2('0x139'),_0x8ea2('0x116'),_0x8ea2('0x13a')));}if(_[_0x8ea2('0x3e')](_0x13b0e1[_0x8ea2('0x13b')][_0x8ea2('0x13c')])||_0x13b0e1[_0x8ea2('0x13b')][_0x8ea2('0x13c')]===null){return _0x484cd7(msgResponse('originate',_0x8ea2('0x116'),'contact\x20is\x20undefine'));}var _0x546cb6={'XMD-CALLERID':_0x41676d[_0x8ea2('0x9d')][_0x11ce2d][_0x8ea2('0x13d')](),'XMD-AGI':_0x4b21a2[_0x8ea2('0xe3')]?util[_0x8ea2('0x75')](_0x8ea2('0x13e'),ipAgi,_0x4b21a2[_0x8ea2('0xe3')]):_0x8ea2('0x13f'),'XMD-AGIAFTER':_0x4b21a2[_0x8ea2('0xec')]?util['format'](_0x8ea2('0x13e'),ipAgi,_0x4b21a2[_0x8ea2('0xec')]):_0x8ea2('0x13f'),'XMD-QUEUE':_0x4b21a2[_0x8ea2('0x4e')]===_0x8ea2('0x4f')?util['format']('\x22%s,%s%s,,,%s\x22',_0x4b21a2[_0x8ea2('0x44')],_0x4b21a2[_0x8ea2('0x140')]||'',_0x4b21a2[_0x8ea2('0xed')]?'c':'',_0x4b21a2[_0x8ea2('0x141')]||0x3):_0x8ea2('0x13f'),'XMD-CONTACTID':_0x13b0e1[_0x8ea2('0xc3')],'XMD-CDRTYPE':_0x8ea2('0x8'),'CALLERID(all)':_0x41676d['actions'][_0x11ce2d][_0x8ea2('0x13d')](),'XMD-AMD':_0x4b21a2[_0x8ea2('0xd0')]?'ACTIVE':_0x8ea2('0x13f'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x4b21a2[_0x8ea2('0xd0')]){_0x546cb6[_0x8ea2('0x142')]=_0x4b21a2[_0x8ea2('0x143')]||0x9c4;_0x546cb6[_0x8ea2('0x144')]=_0x4b21a2[_0x8ea2('0x145')]||0x5dc;_0x546cb6['XMD-AMDAFTERGREETINGSILENCE']=_0x4b21a2[_0x8ea2('0x146')]||0x320;_0x546cb6['XMD-AMDTOTALANALYSISTIME']=_0x4b21a2[_0x8ea2('0x147')]||0x1388;_0x546cb6[_0x8ea2('0x148')]=_0x4b21a2[_0x8ea2('0x149')]||0x64;_0x546cb6['XMD-AMDBETWEENWORDSSILENCE']=_0x4b21a2['dialAMDBetweenWordsSilence']||0x32;_0x546cb6[_0x8ea2('0x14a')]=_0x4b21a2[_0x8ea2('0x14b')]||0x3;_0x546cb6[_0x8ea2('0x14c')]=_0x4b21a2[_0x8ea2('0x14d')]||0x100;_0x546cb6[_0x8ea2('0x14e')]=_0x4b21a2[_0x8ea2('0x14f')]||0x1388;}if(_0x4b21a2[_0x8ea2('0x4e')]==='outbound'){_0x546cb6[_0x8ea2('0x150')]=_0x13b0e1[_0x8ea2('0x106')];}else{_0x546cb6[_0x8ea2('0x151')]=_0x13b0e1[_0x8ea2('0xc5')];}for(var _0x813581 in _0x13b0e1[_0x8ea2('0x13b')]){if(_0x13b0e1[_0x8ea2('0x13b')][_0x8ea2('0x89')](_0x813581)){if(isNotNull(_0x13b0e1[_0x8ea2('0x13b')][_0x813581])&&_0x813581!=='id'&&_0x813581!==_0x8ea2('0x152')&&_0x813581!==_0x8ea2('0x153')&&_0x813581!==_0x8ea2('0x154')){_0x546cb6[util[_0x8ea2('0x75')](_0x8ea2('0x155'),_0x8ea2('0x156'),_[_0x8ea2('0x157')](_0x813581))]=_0x13b0e1[_0x8ea2('0x13b')][_0x813581];}}}var _0x4c6ed3=_0x41676d['isTrunkReachable'](_0x4b21a2[_0x8ea2('0x72')])?getCallerId(_0x4b21a2[_0x8ea2('0x72')][_0x8ea2('0x74')],_0x4b21a2[_0x8ea2('0x5d')],_0x4b21a2[_0x8ea2('0x158')]>0x0?getCallerIdRandom(_0x4b21a2[_0x8ea2('0x159')],_0x4b21a2['dialRandomLastDigitCallerIdNumber']):_0x4b21a2[_0x8ea2('0x159')]):getCallerId(_['isNil'](_0x4b21a2[_0x8ea2('0x15a')])?_0x4b21a2[_0x8ea2('0x72')]['callerid']:_0x4b21a2[_0x8ea2('0x15a')][_0x8ea2('0x74')],_0x4b21a2['dialOriginateCallerIdName'],_0x4b21a2[_0x8ea2('0x158')]>0x0?getCallerIdRandom(_0x4b21a2[_0x8ea2('0x159')],_0x4b21a2[_0x8ea2('0x158')]):_0x4b21a2[_0x8ea2('0x159')]);if(_0x4c6ed3){_0x546cb6[_0x8ea2('0x15b')]=_0x41676d['actions'][_0x11ce2d]['originatecalleridname']=extractCalleridName(_0x4c6ed3);_0x546cb6['XMD-ORIGINATECALLERIDNUM']=_0x41676d[_0x8ea2('0x9d')][_0x11ce2d][_0x8ea2('0x15c')]=extractCalleridNumber(_0x4c6ed3);}return ami[_0x8ea2('0xa0')]({'actionid':_0x11ce2d,'action':_0x8ea2('0x139'),'channel':_0x41676d[_0x8ea2('0xc9')](_0x4b21a2[_0x8ea2('0x72')])?util['format'](_0x8ea2('0x15d'),_0x4b21a2[_0x8ea2('0x72')][_0x8ea2('0x44')],isNotNull(_0x4b21a2['dialPrefix'])?_0x4b21a2[_0x8ea2('0x5e')][_0x8ea2('0x15e')]()||'':'',_0x4b21a2[_0x8ea2('0x15f')]>0x0?_0x13b0e1['Contact']['phone']['substring'](_0x4b21a2['dialCutDigit']):_0x13b0e1['Contact'][_0x8ea2('0x13c')]):util[_0x8ea2('0x75')]('SIP/%s/%s%s',_[_0x8ea2('0x9f')](_0x4b21a2['TrunkBackup'])?_0x4b21a2[_0x8ea2('0x72')][_0x8ea2('0x44')]:_0x4b21a2['TrunkBackup'][_0x8ea2('0x44')],isNotNull(_0x4b21a2[_0x8ea2('0x5e')])?_0x4b21a2[_0x8ea2('0x5e')]['trim']()||'':'',_0x4b21a2[_0x8ea2('0x15f')]>0x0?_0x13b0e1[_0x8ea2('0x13b')][_0x8ea2('0x13c')][_0x8ea2('0x160')](_0x4b21a2[_0x8ea2('0x15f')]):_0x13b0e1[_0x8ea2('0x13b')][_0x8ea2('0x13c')]),'callerid':_0x4c6ed3,'Exten':'xcally-motion-dialer','Context':_0x8ea2('0x161'),'Priority':'1','variable':_0x546cb6,'timeout':(_0x4b21a2[_0x8ea2('0x162')]||0x1e)*0x3e8,'async':!![],'channelid':_0x11ce2d})[_0x8ea2('0xa9')](function(_0x506c3f){return _0x23ee60(_0x506c3f);})[_0x8ea2('0xaa')](function(_0xb80be1){_0x4b21a2['outboundOriginateFailureCallsDay']+=0x1;var _0x3c9353=new History(_0x41676d[_0x8ea2('0x9d')][_0x11ce2d]);logger['error'](util[_0x8ea2('0x75')](_0x8ea2('0x163'),JSON['stringify'](_0xb80be1)));_0x3c9353['state']=0xe;_0x3c9353[_0x8ea2('0xd8')]=_0x8ea2('0x164');_0x3c9353[_0x8ea2('0x165')]=moment()[_0x8ea2('0x75')]('YYYY-MM-DD\x20HH:mm:ss');_0x3c9353[_0x8ea2('0x9a')]=_0x3c9353[_0x8ea2('0x165')];_0x41676d[_0x8ea2('0xbc')](_0x3c9353)[_0x8ea2('0xaa')](loggerCatch(_0x8ea2('0x166')));_0x41676d[_0x8ea2('0xba')](_0x3c9353)[_0x8ea2('0xaa')](loggerCatch('[originate][error]'))[_0x8ea2('0x20')](function(){delete _0x41676d[_0x8ea2('0x9d')][_0x11ce2d];return _0x484cd7(msgResponse(_0x8ea2('0x139'),_0x8ea2('0x167'),_0x8ea2('0x168')));});});});};Dialer[_0x8ea2('0x1d')]['syncOriginateResponse']=function(_0x4d9cbf){var _0xed298f=this[_0x8ea2('0x9d')][_0x4d9cbf[_0x8ea2('0xfa')]];var _0x4ccee6=this;if(_0xed298f){delete this[_0x8ea2('0x9d')][_0x4d9cbf[_0x8ea2('0xfa')]];_0xed298f['responsetime']=moment()[_0x8ea2('0x75')](_0x8ea2('0xee'));var _0x25604f=_0xed298f[_0x8ea2('0x4e')]==='ivr'?this[_0x8ea2('0x24')][_0xed298f['queue']]:this[_0x8ea2('0x23')][_0xed298f['getQueue']()];if(!this[_0x8ea2('0xc7')](_0x4d9cbf[_0x8ea2('0x169')])){this[_0x8ea2('0xa4')](_0x25604f);return this['callProgressDetecting'](_0xed298f,_0x25604f,_0x4d9cbf)[_0x8ea2('0xa9')](function(_0x71bb70){})['catch'](loggerCatch('[callProgressDetecting]\x20'));}else{this['uniqueId'][_0x4d9cbf[_0x8ea2('0xcd')]]=_0xed298f;}}};Dialer[_0x8ea2('0x1d')][_0x8ea2('0x16a')]=function(_0x218268,_0x53fea5,_0xe1518f){var _0x324b1a=new History(_0x53fea5);if(_0x324b1a[_0x8ea2('0x16b')]+_0x324b1a['countcongestionretry']+_0x324b1a['countnoanswerretry']>=_0xe1518f['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x218268){case 0x3:if(_0x324b1a[_0x8ea2('0x16c')]>=_0xe1518f[_0x8ea2('0x16d')]-0x1){return!![];}else{this[_0x8ea2('0xb3')]({'active':![],'countnoanswerretry':_0x324b1a[_0x8ea2('0x16c')]+=0x1,'scheduledat':moment()['add'](_0xe1518f[_0x8ea2('0x16e')],_0x8ea2('0x16f'))[_0x8ea2('0x75')](_0x8ea2('0xee')),'ContactId':_0x324b1a['ContactId'],'ListId':_0x324b1a[_0x8ea2('0xc4')],'VoiceQueueId':_0x324b1a[_0x8ea2('0x106')]||undefined,'CampaignId':_0x324b1a[_0x8ea2('0xc5')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));}break;case 0x5:if(_0x324b1a[_0x8ea2('0x16b')]>=_0xe1518f[_0x8ea2('0x170')]-0x1){return!![];}else{this[_0x8ea2('0xb3')]({'active':![],'countbusyretry':_0x324b1a[_0x8ea2('0x16b')]+=0x1,'scheduledat':moment()[_0x8ea2('0x171')](_0xe1518f['dialBusyRetryFrequency'],_0x8ea2('0x16f'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x324b1a[_0x8ea2('0xc3')],'ListId':_0x324b1a[_0x8ea2('0xc4')],'VoiceQueueId':_0x324b1a[_0x8ea2('0x106')]||undefined,'CampaignId':_0x324b1a['CampaignId']||undefined})['catch'](loggerCatch(_0x8ea2('0x172')));}break;case 0x8:if(_0x324b1a[_0x8ea2('0x173')]>=_0xe1518f[_0x8ea2('0x174')]-0x1){return!![];}else{this[_0x8ea2('0xb3')]({'active':![],'countcongestionretry':_0x324b1a[_0x8ea2('0x173')]+=0x1,'scheduledat':moment()[_0x8ea2('0x171')](_0xe1518f[_0x8ea2('0x175')],_0x8ea2('0x16f'))[_0x8ea2('0x75')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x324b1a['ContactId'],'ListId':_0x324b1a[_0x8ea2('0xc4')],'VoiceQueueId':_0x324b1a[_0x8ea2('0x106')]||undefined,'CampaignId':_0x324b1a['CampaignId']||undefined})[_0x8ea2('0xaa')](loggerCatch(_0x8ea2('0x176')));}break;default:return!![];}};Dialer[_0x8ea2('0x1d')]['callProgressDetecting']=function(_0x2e03f6,_0x3455bd,_0x272afd){var _0x5719af=this;var _0x403729=new History(_0x2e03f6);return new BPromise(function(_0x383c99,_0x15be32){if(_[_0x8ea2('0x3e')](_0x3455bd)&&_0x8ea2('0x138')!==typeof _0x3455bd){return _0x15be32(msgResponse(_0x8ea2('0x177'),_0x8ea2('0x116'),_0x8ea2('0x178')));}if(_[_0x8ea2('0x3e')](_0x272afd)&&_0x8ea2('0x138')!==typeof _0x272afd){return _0x15be32(msgResponse(_0x8ea2('0x177'),_0x8ea2('0x116'),'evt\x20is\x20undefine'));}switch(_0x272afd[_0x8ea2('0xea')]){case'0':_0x3455bd[_0x8ea2('0x64')]+=0x1;_0x403729[_0x8ea2('0x99')]=0x0;_0x403729[_0x8ea2('0xd8')]=_0x8ea2('0x179');_0x5719af[_0x8ea2('0xbc')](_0x403729)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x5719af[_0x8ea2('0x16a')](0x0,_0x2e03f6,_0x3455bd)){if(_0x403729[_0x8ea2('0x16b')]+_0x403729[_0x8ea2('0x173')]+_0x403729[_0x8ea2('0x16c')]>=_0x3455bd[_0x8ea2('0x17a')]){_0x5719af[_0x8ea2('0x17b')](_0x403729,_0x383c99,_0x15be32,'reason\x200\x20no\x20such\x20number....');}else{_0x5719af[_0x8ea2('0x17c')](_0x403729,_0x383c99,_0x15be32,_0x8ea2('0x17d'));}}break;case'3':_0x3455bd[_0x8ea2('0x63')]+=0x1;_0x403729['state']=0x3;_0x403729[_0x8ea2('0xd8')]=_0x8ea2('0x17e');_0x403729[_0x8ea2('0x16c')]+=0x1;_0x403729[_0x8ea2('0x17f')]+=0x1;_0x5719af[_0x8ea2('0xbc')](_0x403729)[_0x8ea2('0xaa')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x5719af[_0x8ea2('0x16a')](0x3,_0x2e03f6,_0x3455bd)){if(_0x403729[_0x8ea2('0x16c')]>=_0x3455bd[_0x8ea2('0x16d')]){_0x5719af[_0x8ea2('0x17c')](_0x403729,_0x383c99,_0x15be32,'reason\x203\x20ringing\x20no\x20answer');}else{_0x5719af[_0x8ea2('0x17b')](_0x403729,_0x383c99,_0x15be32,_0x8ea2('0x180'));}}break;case'5':_0x3455bd[_0x8ea2('0x5f')]+=0x1;_0x403729['state']=0x5;_0x403729['statedesc']=_0x8ea2('0x181');_0x403729[_0x8ea2('0x16b')]+=0x1;_0x403729[_0x8ea2('0x17f')]+=0x1;_0x5719af['createHistory'](_0x403729)['catch'](loggerCatch(_0x8ea2('0x182')));if(_0x5719af[_0x8ea2('0x16a')](0x5,_0x2e03f6,_0x3455bd)){if(_0x403729[_0x8ea2('0x16b')]>=_0x3455bd[_0x8ea2('0x170')]){_0x5719af['createStateFinal'](_0x403729,_0x383c99,_0x15be32,'reason\x205\x20busy');}else{_0x5719af[_0x8ea2('0x17b')](_0x403729,_0x383c99,_0x15be32,_0x8ea2('0x183'));}}break;case'8':_0x3455bd['outboundCongestionCallsDay']+=0x1;_0x403729[_0x8ea2('0x99')]=0x8;_0x403729[_0x8ea2('0xd8')]='Congestion';_0x403729['countcongestionretry']+=0x1;_0x403729[_0x8ea2('0x17f')]+=0x1;_0x5719af[_0x8ea2('0xbc')](_0x403729)['catch'](loggerCatch(_0x8ea2('0x184')));if(_0x5719af[_0x8ea2('0x16a')](0x8,_0x2e03f6,_0x3455bd)){if(_0x403729[_0x8ea2('0x173')]>=_0x3455bd[_0x8ea2('0x174')]){_0x5719af[_0x8ea2('0x17c')](_0x403729,_0x383c99,_0x15be32,_0x8ea2('0x185'));}else{_0x5719af[_0x8ea2('0x17b')](_0x403729,_0x383c99,_0x15be32,_0x8ea2('0x185'));}}break;default:_0x3455bd[_0x8ea2('0xe7')]+=0x1;_0x403729[_0x8ea2('0x99')]=0xc;_0x403729[_0x8ea2('0xd8')]=_0x272afd['reason'];_0x5719af['createHistory'](_0x403729)[_0x8ea2('0xaa')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x5719af[_0x8ea2('0x16a')](_0x272afd[_0x8ea2('0xea')],_0x2e03f6,_0x3455bd)){if(_0x403729[_0x8ea2('0x16b')]+_0x403729['countcongestionretry']+_0x403729[_0x8ea2('0x16c')]>=_0x3455bd[_0x8ea2('0x17a')]){_0x5719af[_0x8ea2('0x17b')](_0x403729,_0x383c99,_0x15be32,_0x272afd['reason']);}else{_0x5719af['createStateFinal'](_0x403729,_0x383c99,_0x15be32,_0x272afd['reason']);}}}});};Dialer['prototype'][_0x8ea2('0x17b')]=function(_0x4b11c7,_0x5b10dc,_0x2739b8,_0x13c2a9){var _0x52f752=new Final(_0x4b11c7);_0x52f752[_0x8ea2('0x99')]=0xf;_0x52f752[_0x8ea2('0xd8')]=_0x8ea2('0x186');this[_0x8ea2('0x17c')](_0x52f752,_0x5b10dc,_0x2739b8,_0x13c2a9);};Dialer[_0x8ea2('0x1d')]['createStateFinal']=function(_0x1329c6,_0x4a9450,_0x26cf8a,_0x502d22){this[_0x8ea2('0xba')](_0x1329c6)[_0x8ea2('0xa9')](function(_0x23de8e){return _0x4a9450(msgResponse(_0x8ea2('0x177'),_0x8ea2('0xc8'),_0x502d22));})['catch'](function(_0x1b9e32){return _0x26cf8a(msgResponse(_0x8ea2('0x187'),_0x8ea2('0x116'),_0x8ea2('0x188')));});};Dialer['prototype'][_0x8ea2('0xb')]=function(_0x50518e){var _0x3d2e41=this;var _0x531c86=_0x50518e[_0x8ea2('0x189')]/0x64;var _0x1ecddd=_0x50518e[_0x8ea2('0x62')]/(_0x50518e[_0x8ea2('0x62')]+_0x50518e['outboundAnswerCallsDay']);var _0x2a49ca=_0x50518e['loggedIn']-_0x50518e[_0x8ea2('0x70')]-_0x50518e[_0x8ea2('0x59')]-_0x50518e['originated']-_0x50518e['talking'];var _0x212842=(_0x50518e[_0x8ea2('0x52')]-_0x50518e[_0x8ea2('0x70')])*_0x50518e['predictiveIntervalLowerLimit'];var _0x21605e=Math['floor'](_0x50518e[_0x8ea2('0x18a')]*_0x50518e[_0x8ea2('0x18b')]*_0x50518e[_0x8ea2('0x6e')]*_0x50518e[_0x8ea2('0x18c')]);if(_[_0x8ea2('0x3e')](_0x50518e[_0x8ea2('0x2b')])){loggerPredictive[_0x8ea2('0x7a')](_0x8ea2('0x18d'));if(!_[_0x8ea2('0x3e')](_0x50518e[_0x8ea2('0x82')])){_0x50518e[_0x8ea2('0x82')]=undefined;loggerPredictive[_0x8ea2('0x88')](_0x8ea2('0x18e'),_0x8ea2('0x18f'));}if(!_[_0x8ea2('0x3e')](_0x50518e['handlePredictive'])){loggerPredictive[_0x8ea2('0x88')]('[startMethodPredictive][StartProgressive]',_0x8ea2('0x190'));clearInterval(_0x50518e[_0x8ea2('0x83')]);_0x50518e['handlePredictive']=undefined;}_0x50518e['startProgressive']=moment()[_0x8ea2('0x75')](_0x8ea2('0xee'));loggerPredictive[_0x8ea2('0x7a')]('[startMethodPredictive][StartProgressive][Date]',_0x50518e[_0x8ea2('0x2b')],_0x50518e[_0x8ea2('0x44')]);this[_0x8ea2('0x12c')](_0x50518e,0x1);}else if(ifInterval(_0x50518e[_0x8ea2('0x191')],_0x50518e[_0x8ea2('0x2b')])){this[_0x8ea2('0x12c')](_0x50518e,0x1);loggerPredictiveCalls[_0x8ea2('0x7a')](_0x8ea2('0x192'),_0x50518e[_0x8ea2('0x2b')],_0x50518e[_0x8ea2('0x44')]);_0x50518e['erlangCalls']=0x0;_0x50518e[_0x8ea2('0x6d')]=0x0;}else if(_0x531c86<_0x1ecddd&&_0x50518e[_0x8ea2('0x193')]===_0x8ea2('0x194')){freeVariablesPredictive(_0x50518e);loggerPredictive[_0x8ea2('0x7a')](_0x8ea2('0x195'),_0x8ea2('0x196'),_0x1ecddd,'startProgressive',_0x50518e[_0x8ea2('0x44')]);}else if(_0x2a49ca>_0x212842){freeVariablesPredictive(_0x50518e);loggerPredictive[_0x8ea2('0x7a')](_0x8ea2('0x197'),_0x8ea2('0x198'),_0x2a49ca,_0x8ea2('0x199'),_0x212842);}else if(_0x21605e<_0x50518e[_0x8ea2('0x6d')]&&_0x50518e[_0x8ea2('0x193')]==='dropRate'){freeVariablesPredictive(_0x50518e);loggerPredictive[_0x8ea2('0x7a')](_0x8ea2('0x19a'),_0x8ea2('0x19b'),_0x21605e,_0x8ea2('0x19c'),_0x50518e[_0x8ea2('0x6d')],'startProgressive',_0x50518e['name']);}else if(!ifInterval(_0x50518e[_0x8ea2('0x191')],_0x50518e['startProgressive'])&&_[_0x8ea2('0x3e')](_0x50518e['startPredictive'])&&!_['isUndefined'](_0x50518e[_0x8ea2('0x2b')])){_0x50518e['startPredictive']=moment()[_0x8ea2('0x75')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x8ea2('0x7a')](_0x8ea2('0x19d'),_0x50518e[_0x8ea2('0x82')],_0x50518e['name']);this[_0x8ea2('0xb0')](_0x50518e[_0x8ea2('0x191')])[_0x8ea2('0xa9')](this[_0x8ea2('0x19e')](_0x50518e))[_0x8ea2('0xa9')](mergeDataErlangB(_0x50518e))[_0x8ea2('0xa9')](this['startMethodPredictive'](_0x50518e))[_0x8ea2('0xaa')](loggerCatchPredictive(_0x8ea2('0x19f'),_0x50518e));}else if(!ifInterval(_0x50518e[_0x8ea2('0x191')],_0x50518e[_0x8ea2('0x82')])){_0x50518e[_0x8ea2('0x6d')]=0x0;_0x50518e[_0x8ea2('0x82')]=moment()[_0x8ea2('0x75')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x8ea2('0x7a')](_0x8ea2('0x1a0'),_0x50518e[_0x8ea2('0x82')],_0x50518e[_0x8ea2('0x44')]);clearInterval(_0x50518e[_0x8ea2('0x83')]);_0x50518e['handlePredictive']=undefined;this[_0x8ea2('0xb0')](_0x50518e[_0x8ea2('0x191')])[_0x8ea2('0xa9')](this['getDataPredictive'](_0x50518e))[_0x8ea2('0xa9')](mergeDataErlangB(_0x50518e))[_0x8ea2('0xa9')](this[_0x8ea2('0x1a1')](_0x50518e))[_0x8ea2('0xaa')](loggerCatchPredictive(_0x8ea2('0x19f'),_0x50518e));}};Dialer[_0x8ea2('0x1d')][_0x8ea2('0x19e')]=function(_0x34818b){var _0x266cce=this;return function(_0x3d3c4d){return new BPromise(function(_0x52d523,_0x119ab7){_[_0x8ea2('0x7f')](_0x34818b,_0x3d3c4d[0x0]);if(checkGetDataPredictive(_0x3d3c4d[0x0])){loggerPredictive[_0x8ea2('0x7a')](JSON[_0x8ea2('0x4a')](_0x3d3c4d[0x0]));if(_0x34818b['dialPredictiveOptimization']===_0x8ea2('0x194')){return _0x266cce[_0x8ea2('0xb8')](_0x34818b['id'])[_0x8ea2('0xa9')](function(_0x5db247){var _0xac5c69=_0x34818b['loggedIn']-_0x5db247[0x0][_0x8ea2('0x1a2')];var _0x51b6fb=_0x34818b[_0x8ea2('0x191')]*0x3c;var _0x52b427=_0x3d3c4d[0x0][_0x8ea2('0x6a')]+_0x3d3c4d[0x0][_0x8ea2('0x69')];var _0x4a05d8=(_0x3d3c4d[0x0]['predictiveIntervalAnsweredCalls']+_0x3d3c4d[0x0][_0x8ea2('0x6b')]+_0x3d3c4d[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3d3c4d[0x0][_0x8ea2('0x71')];var _0x1b674e=_0x34818b[_0x8ea2('0x189')]/0x64;_0x34818b[_0x8ea2('0x70')]=_0x5db247[0x0][_0x8ea2('0x1a2')]||0x0;_0x34818b[_0x8ea2('0x6e')]=_0x4a05d8>0x0?_0x4a05d8:0x1;return _0x266cce[_0x8ea2('0x1a3')](_0xac5c69,_0x51b6fb,_0x52b427,_0x4a05d8,_0x1b674e);})[_0x8ea2('0xa9')](function(_0xde8c7){return _0x52d523(_0xde8c7);})[_0x8ea2('0xaa')](function(_0x319f92){return _0x119ab7(msgResponse(_0x8ea2('0x1a4'),_0x8ea2('0x116'),JSON[_0x8ea2('0x4a')](_0x319f92)));});}if(_0x34818b[_0x8ea2('0x193')]==='agentBusyFactor'){return _0x266cce[_0x8ea2('0xb8')](_0x34818b['id'])[_0x8ea2('0xa9')](function(_0x6a9c53){var _0x2feb6f=_0x34818b['loggedIn']-_0x6a9c53[0x0][_0x8ea2('0x1a2')];var _0x32cb9b=_0x34818b['dialPredictiveInterval']*0x3c;var _0xc7ca26=_0x3d3c4d[0x0][_0x8ea2('0x6a')]+_0x3d3c4d[0x0]['predictiveIntervalAvgHoldtime'];var _0x4b787c=(_0x3d3c4d[0x0][_0x8ea2('0x68')]+_0x3d3c4d[0x0][_0x8ea2('0x6b')]+_0x3d3c4d[0x0][_0x8ea2('0xf7')])/_0x3d3c4d[0x0]['predictiveIntervalTotalCalls'];var _0x34e1d3=_0x34818b['dialPredictiveOptimizationPercentage']/0x64;_0x34818b[_0x8ea2('0x70')]=_0x6a9c53[0x0]['outboundQueuePauses']||0x0;_0x34818b[_0x8ea2('0x6e')]=_0x4b787c>0x0?_0x4b787c:0x1;return _0x266cce[_0x8ea2('0x1a5')](_0x2feb6f,_0x32cb9b,_0xc7ca26,_0x4b787c,_0x34e1d3);})['then'](function(_0x1b9013){return _0x52d523(_0x1b9013);})['catch'](function(_0x18c5e6){return _0x119ab7(msgResponse(_0x8ea2('0x1a4'),_0x8ea2('0x116'),JSON[_0x8ea2('0x4a')](_0x18c5e6)));});}}else{return _0x119ab7(msgResponse(_0x8ea2('0x1a6'),'Failure',_0x8ea2('0x1a7')));}});};};Dialer[_0x8ea2('0x1d')][_0x8ea2('0x1a1')]=function(_0x392145){var _0x1d620b=this;return function(){var _0x28c0e8=0x0;var _0x5b1392=Math[_0x8ea2('0x1a8')](_0x392145['erlangCallToSecond']*0x3e8);if(_0x5b1392>0x0){_0x5b1392=_0x5b1392<0x64?0x64:_0x5b1392;loggerPredictive['info'](_0x8ea2('0x1a9'),_0x5b1392);_0x392145[_0x8ea2('0x83')]=setInterval(function(){_0x1d620b[_0x8ea2('0x83')](_0x392145);loggerPredictiveCalls['info'](_0x8ea2('0x1aa'),_0x28c0e8+=0x1);},_0x5b1392);}else{loggerPredictive[_0x8ea2('0x7a')]('[startMethodPredictive][milliseconds]\x20','Failure\x20',_0x5b1392);}};};Dialer['prototype'][_0x8ea2('0x1ab')]=function(_0x27f7a2,_0x99d58e){var _0x46004e=this;return function(_0x432a6c){if(_[_0x8ea2('0x45')](_0x432a6c)){if(_[_0x8ea2('0x9f')](_0x99d58e[_0x8ea2('0x1ac')])||!_0x99d58e[_0x8ea2('0x1ad')]){if(_0x27f7a2[_0x8ea2('0x5c')]==='booked'){_0x27f7a2['queueStatusComplete']=_[_0x8ea2('0x3e')](_0x27f7a2['queueStatusComplete'])?!![]:_0x27f7a2[_0x8ea2('0x103')];var _0x1cbf1f=uuid['v4']();_0x46004e[_0x8ea2('0x9d')][_0x1cbf1f]=new Action(_0x27f7a2,_0x99d58e,_0x1cbf1f);loggerBooked[_0x8ea2('0x7a')](_0x8ea2('0x1ae'),_0x1cbf1f,_0x8ea2('0x1af'),JSON[_0x8ea2('0x4a')](_0x27f7a2[_0x8ea2('0x103')]),'Queue:\x20',_0x27f7a2[_0x8ea2('0x44')]);if(_0x27f7a2['queueStatusComplete']){_0x27f7a2[_0x8ea2('0x103')]=![];_0x46004e[_0x8ea2('0xff')][_0x46004e['actions'][_0x1cbf1f][_0x8ea2('0xa5')]]=[];ami[_0x8ea2('0xa0')]({'actionid':_0x1cbf1f,'action':_0x8ea2('0x1b0'),'queue':_0x27f7a2['name']})[_0x8ea2('0xaa')](function(_0x314b77){_0x46004e[_0x8ea2('0xa4')](_0x27f7a2);_0x46004e[_0x8ea2('0xb3')]({'active':![],'ContactId':_0x46004e[_0x8ea2('0x9d')][_0x1cbf1f][_0x8ea2('0xc3')],'ListId':_0x46004e[_0x8ea2('0x9d')][_0x1cbf1f][_0x8ea2('0xc4')],'VoiceQueueId':_0x46004e['actions'][_0x1cbf1f][_0x8ea2('0x106')]||undefined,'CampaignId':_0x46004e[_0x8ea2('0x9d')][_0x1cbf1f][_0x8ea2('0xc5')]||undefined})[_0x8ea2('0xaa')](loggerCatch(_0x8ea2('0x1b1')));delete _0x46004e[_0x8ea2('0x9d')][_0x1cbf1f];});}else{loggerBooked[_0x8ea2('0x7a')]('[booked][checkContactBlack][else]',JSON[_0x8ea2('0x4a')](_0x27f7a2[_0x8ea2('0x103')]),'Queue:\x20',_0x27f7a2[_0x8ea2('0x44')]);_0x46004e[_0x8ea2('0xa4')](_0x27f7a2);_0x46004e[_0x8ea2('0xb3')]({'active':![],'ContactId':_0x46004e[_0x8ea2('0x9d')][_0x1cbf1f][_0x8ea2('0xc3')],'ListId':_0x46004e['actions'][_0x1cbf1f]['ListId'],'VoiceQueueId':_0x46004e[_0x8ea2('0x9d')][_0x1cbf1f][_0x8ea2('0x106')]||undefined,'CampaignId':_0x46004e[_0x8ea2('0x9d')][_0x1cbf1f]['CampaignId']||undefined})['catch'](loggerCatch(_0x8ea2('0x1b1')));delete _0x46004e[_0x8ea2('0x9d')][_0x1cbf1f];}}else{return _0x46004e[_0x8ea2('0x137')](_0x27f7a2,_0x99d58e);}}else{if(getDiff(_0x99d58e[_0x8ea2('0x1b2')])<_0x27f7a2[_0x8ea2('0x1b3')]*0x3c){_0x46004e['preview'][_0x8ea2('0x104')](_0x99d58e['id'])[_0x8ea2('0x20')](function(){_0x46004e[_0x8ea2('0xa4')](_0x27f7a2);});}else{_0x27f7a2[_0x8ea2('0x66')]+=0x1;_0x46004e[_0x8ea2('0xa4')](_0x27f7a2);if(_0x27f7a2[_0x8ea2('0x1b4')]){_0x46004e[_0x8ea2('0xb3')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x99d58e[_0x8ea2('0xc3')],'ListId':_0x99d58e['ListId'],'VoiceQueueId':_0x99d58e[_0x8ea2('0x106')]||undefined,'CampaignId':_0x99d58e[_0x8ea2('0xc5')]||undefined})[_0x8ea2('0xaa')](loggerCatch(_0x8ea2('0x1b5')));_0x46004e[_0x8ea2('0xbc')](createObjHistory(_0x27f7a2,_0x99d58e,'RECALLINQUEUE',0x17,'RecallInQueue'))[_0x8ea2('0xaa')](loggerCatch(_0x8ea2('0x1b6')));}else{_0x46004e['saveInDb'](createObjHistory(_0x27f7a2,_0x99d58e,'RECALLFAILEDTIMEOUT',0x16,_0x8ea2('0x1b7')),_0x8ea2('0x1b8'),_0x8ea2('0x1b9'));}}}}else{_0x27f7a2[_0x8ea2('0x1ba')]+=0x1;_0x46004e[_0x8ea2('0xc2')](createObjHistory(_0x27f7a2,_0x99d58e,_0x8ea2('0x1bb'),0xd,_0x8ea2('0x1bc')),_0x8ea2('0x1bd'),_0x8ea2('0x1be'));throw'inBlackList';}};};Dialer[_0x8ea2('0x1d')]['handleIvr']=function(_0xbf18da){var _0x4bde60=this;var _0x3248b5=[];var _0x4b51b7=_0xbf18da[_0x8ea2('0x1bf')]-_0xbf18da[_0x8ea2('0x8a')]-_0xbf18da['temp'];emitCampaignSummary(_0xbf18da);if(_0x4b51b7>0x0){if(_0x4b51b7>this[_0x8ea2('0x27')]){_0x4b51b7=this[_0x8ea2('0x27')];}_0xbf18da[_0x8ea2('0x1c0')]+=_0x4b51b7;this['getContactDialerIvr'](_0xbf18da['id'],_0x4b51b7,_0xbf18da[_0x8ea2('0x1c1')])['then'](function(_0xf93ac0){_0xbf18da['temp']-=_0x4b51b7;_0xbf18da[_0x8ea2('0x1c0')]=_0xbf18da[_0x8ea2('0x1c0')]>0x0?_0xbf18da[_0x8ea2('0x1c0')]:0x0;if(!checkContactEmpty(_0xf93ac0)){_0xbf18da[_0x8ea2('0x3f')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x8ea2('0x7a')](_0x8ea2('0x1c2')+_0xbf18da[_0x8ea2('0x44')]);}else{_0xbf18da['originated']+=_0xf93ac0[_0x8ea2('0x108')];_0xbf18da['message']=_0x8ea2('0x1c3');for(var _0x5b1701=0x0;_0x5b1701<_0xf93ac0['length'];_0x5b1701+=0x1){_0xbf18da[_0x8ea2('0x1c4')]+=0x1;if(_[_0x8ea2('0x9f')](_0xf93ac0[_0x5b1701])||_[_0x8ea2('0x9f')](_0xf93ac0[_0x5b1701][_0x8ea2('0x13b')])||_[_0x8ea2('0x9f')](_0xf93ac0[_0x5b1701][_0x8ea2('0x13b')][_0x8ea2('0x13c')])){_0x4bde60[_0x8ea2('0xc0')]('[actionOriginate]\x20',_0xbf18da,_0xf93ac0[_0x5b1701]);}else{_0x4bde60['checkIsBlackListIvr'](_[_0x8ea2('0x102')](_0xf93ac0[_0x5b1701],['CampaignId','Contact.phone']))[_0x8ea2('0xa9')](_0x4bde60[_0x8ea2('0x1ab')](_0xbf18da,_0xf93ac0[_0x5b1701]))['catch'](_0x4bde60[_0x8ea2('0x1c5')]('[actionOriginateIvr]\x20',_0xbf18da));}}}})['catch'](loggerGetContactDialer('[getContactCampaign2]',_0xbf18da,_0x4b51b7));}};Dialer[_0x8ea2('0x1d')]['handlePower']=function(_0x3872c2,_0x40d57a){var _0x322976=this;var _0x429f2d=[];var _0xc2f637=_0x40d57a>=0x1?_0x40d57a:0x1;var _0x39c290=[];if(_0x3872c2[_0x8ea2('0x5c')]===_0x8ea2('0xa')){_0xc2f637=0x1;}var _0x13ffb5=Math[_0x8ea2('0x1a8')](_0x3872c2[_0x8ea2('0x51')]*_0xc2f637)-_0x3872c2[_0x8ea2('0x8a')]-_0x3872c2[_0x8ea2('0x1c0')];emitVoiceQueueSummary(_0x3872c2);if(_0x3872c2[_0x8ea2('0x1c6')]>0x0){var _0x3c1956=_0x3872c2[_0x8ea2('0x1c6')]-_0x3872c2['originated']-_0x3872c2[_0x8ea2('0x93')]-_0x3872c2[_0x8ea2('0x1c0')]-_0x3872c2[_0x8ea2('0x53')];if(_0x13ffb5>_0x3c1956){_0x13ffb5=_0x3c1956;}}if(_0x13ffb5>0x0){if(_0x3872c2[_0x8ea2('0x5c')]===_0x8ea2('0xa')){_0x13ffb5=0x1;}if(_0x13ffb5>this[_0x8ea2('0x27')]){_0x13ffb5=this['maxNumberOriginate'];}_0x3872c2[_0x8ea2('0x1c0')]+=_0x13ffb5;for(var _0x3a5710 in this[_0x8ea2('0x25')]){if(this[_0x8ea2('0x25')][_0x8ea2('0x89')](_0x3a5710)){if(this[_0x8ea2('0x25')][_0x3a5710][_0x8ea2('0x99')]===_0x8ea2('0x1c7')&&this['agents'][_0x3a5710][_0x8ea2('0xa1')]===_0x8ea2('0xcb')){_0x429f2d['push'](this[_0x8ea2('0x25')][_0x3a5710]['id']);}}}this['getContactDialer'](_0x3872c2['id'],_0x429f2d,_0x13ffb5,_0x3872c2[_0x8ea2('0x1c1')])[_0x8ea2('0xa9')](function(_0x1df6b2){_0x3872c2[_0x8ea2('0x1c0')]-=_0x13ffb5;_0x3872c2[_0x8ea2('0x1c0')]=_0x3872c2[_0x8ea2('0x1c0')]>0x0?_0x3872c2[_0x8ea2('0x1c0')]:0x0;if(!checkContactEmpty(_0x1df6b2)){_0x322976['countReScheduled'](_0x3872c2)[_0x8ea2('0xa9')](sendMessageReschedule(_0x3872c2))['catch'](loggerCatch(_0x8ea2('0xab')));}else{_0x3872c2[_0x8ea2('0x8a')]+=_0x1df6b2['length'];_0x3872c2['message']=_0x3872c2[_0x8ea2('0x5c')]===_0x8ea2('0xa')?_0x8ea2('0x1c8'):_0x8ea2('0x1c3');for(var _0x3253fe=0x0;_0x3253fe<_0x1df6b2[_0x8ea2('0x108')];_0x3253fe+=0x1){if(_[_0x8ea2('0x9f')](_0x1df6b2[_0x3253fe])||_[_0x8ea2('0x9f')](_0x1df6b2[_0x3253fe]['Contact'])||_['isNil'](_0x1df6b2[_0x3253fe][_0x8ea2('0x13b')]['phone'])){_0x322976[_0x8ea2('0xc0')](_0x8ea2('0x1c9'),_0x3872c2,_0x1df6b2[_0x3253fe]);}else{_0x322976[_0x8ea2('0xac')](_[_0x8ea2('0x102')](_0x1df6b2[_0x3253fe],[_0x8ea2('0x106'),_0x8ea2('0x1ca')]))[_0x8ea2('0xa9')](_0x322976[_0x8ea2('0x1ab')](_0x3872c2,_0x1df6b2[_0x3253fe]))[_0x8ea2('0xaa')](_0x322976[_0x8ea2('0x1c5')](_0x8ea2('0x1c9'),_0x3872c2));}}}})['catch'](loggerGetContactDialer(_0x8ea2('0x1cb'),_0x3872c2,_0x13ffb5));}};Dialer[_0x8ea2('0x1d')][_0x8ea2('0x83')]=function(_0x47caa6){var _0x487b39=this;if(_0x47caa6[_0x8ea2('0x1c6')]>0x0){var _0x32a9bd=_0x47caa6[_0x8ea2('0x1c6')]-_0x47caa6['originated']-_0x47caa6['talking'];if(_0x32a9bd>0x0){this[_0x8ea2('0x1cc')](_0x47caa6);}else{loggerPredictiveCalls['info'](_0x8ea2('0x1cd'));}}else{this[_0x8ea2('0x1cc')](_0x47caa6);}};Dialer[_0x8ea2('0x1d')][_0x8ea2('0x1cc')]=function(_0x3b6e12){var _0x128e96=this;var _0x1c5fd2=[];_0x3b6e12[_0x8ea2('0x8a')]+=0x1;for(var _0x404e8a in this[_0x8ea2('0x25')]){if(this['agents'][_0x8ea2('0x89')](_0x404e8a)){if(this[_0x8ea2('0x25')][_0x404e8a][_0x8ea2('0x99')]===_0x8ea2('0x1c7')&&this[_0x8ea2('0x25')][_0x404e8a]['status']===_0x8ea2('0xcb')){_0x1c5fd2['push'](this['agents'][_0x404e8a]['id']);}}}this[_0x8ea2('0xb5')](_0x3b6e12['id'],_0x1c5fd2,0x1,_0x3b6e12[_0x8ea2('0x1c1')])[_0x8ea2('0xa9')](function(_0x42fa0f){if(!checkContactEmpty(_0x42fa0f)){checkContactLowerLimitOriginate(_0x3b6e12,0x1,0x0);_0x128e96[_0x8ea2('0xa7')](_0x3b6e12)[_0x8ea2('0xa9')](sendMessageReschedule(_0x3b6e12))[_0x8ea2('0xaa')](loggerCatch(_0x8ea2('0xab')));}else{_0x3b6e12['message']=_0x8ea2('0x1c3');if(_[_0x8ea2('0x9f')](_0x42fa0f[0x0])||_[_0x8ea2('0x9f')](_0x42fa0f[0x0][_0x8ea2('0x13b')])||_['isNil'](_0x42fa0f[0x0][_0x8ea2('0x13b')][_0x8ea2('0x13c')])){_0x128e96[_0x8ea2('0xc0')]('[actionOriginate]\x20',_0x3b6e12,_0x42fa0f[0x0]);}else{_0x128e96['checkIsBlackList'](_['pick'](_0x42fa0f[0x0],[_0x8ea2('0x106'),'Contact.phone']))[_0x8ea2('0xa9')](_0x128e96['checkContactBlack'](_0x3b6e12,_0x42fa0f[0x0]))[_0x8ea2('0xaa')](_0x128e96['loggerHandler'](_0x8ea2('0x1ce'),_0x3b6e12));}}})[_0x8ea2('0xaa')](loggerGetContactDialer(_0x8ea2('0x1cf'),_0x3b6e12,0x1));emitVoiceQueueSummary(_0x3b6e12);};Dialer[_0x8ea2('0x1d')]['abandonmentRate']=function(_0x9153a9,_0x37e741,_0x53dc2b,_0x4c1c33,_0x4b19b1,_0x16a520){loggerPredictive[_0x8ea2('0x7a')](_0x8ea2('0x1d0'),_0x8ea2('0x1d1'),_0x9153a9,_0x8ea2('0x1d2'),_0x37e741,_0x8ea2('0x1d3'),_0x53dc2b,_0x8ea2('0x1d4'),_0x4c1c33,_0x8ea2('0x1d5'),_0x4b19b1);return new BPromise(function(_0x1ec259,_0x2609a9){if(_0x9153a9<=0x0||isNaN(_0x9153a9)){return _0x2609a9(msgResponse('[abandonmentRate]',_0x8ea2('0x167'),_0x8ea2('0x1d6')+_0x9153a9));}if(_0x53dc2b<=0x0||isNaN(_0x53dc2b)){return _0x2609a9(msgResponse('[abandonmentRate]',_0x8ea2('0x167'),_0x8ea2('0x1d7')+_0x53dc2b));}if(_0x4c1c33<=0x0||isNaN(_0x4c1c33)){return _0x2609a9(msgResponse(_0x8ea2('0x1d0'),_0x8ea2('0x167'),'p\x20=\x20'+_0x4c1c33));}if(_0x37e741<=0x0||isNaN(_0x37e741)){return _0x2609a9(msgResponse(_0x8ea2('0x1d0'),'Error',_0x8ea2('0x1d8')+_0x37e741));}if(_0x4b19b1<=0x0||isNaN(_0x4b19b1)){return _0x2609a9(msgResponse(_0x8ea2('0x1d0'),_0x8ea2('0x167'),_0x8ea2('0x1d9')+_0x4b19b1));}_0x16a520=_0x16a520||0x0;var _0x13fb43=0x1/_0x53dc2b;var _0x1bf5ee=0x0;var _0x6e40e4=0x0;var _0x164abd=0x0;var _0x385249=0x0;for(var _0x394ed3=0x0;_0x164abd<_0x4b19b1;_0x394ed3+=0x1){_0x6e40e4=_0x394ed3/_0x37e741;_0x1bf5ee=(_0x4c1c33*_0x6e40e4+_0x16a520)/_0x13fb43;_0x164abd=erlangb(_0x1bf5ee,_0x9153a9);_0x385249=_0x1bf5ee/_0x9153a9*(0x1-erlangb(_0x1bf5ee,_0x9153a9));}return _0x1ec259({'erlangCalls':_0x394ed3,'erlangCallToSecond':_0x37e741/_0x394ed3,'erlangAbandonmentRate':_0x164abd,'erlangBusyFactor':_0x385249});});};Dialer[_0x8ea2('0x1d')][_0x8ea2('0x1a5')]=function(_0x5c29b8,_0x1c5924,_0x2b28a6,_0x4a4f3e,_0x3fc4d3,_0x31e9c1){loggerPredictive[_0x8ea2('0x7a')](_0x8ea2('0x1da'),_0x8ea2('0x1d1'),_0x5c29b8,_0x8ea2('0x1d2'),_0x1c5924,_0x8ea2('0x1d3'),_0x2b28a6,'\x20p\x20=\x20',_0x4a4f3e,_0x8ea2('0x1db'),_0x3fc4d3);return new BPromise(function(_0x4288d0,_0x5dd29b){if(_0x5c29b8<=0x0||isNaN(_0x5c29b8)){return _0x5dd29b(msgResponse(_0x8ea2('0x1d0'),_0x8ea2('0x167'),'m\x20=\x20'+_0x5c29b8));}if(_0x2b28a6<=0x0||isNaN(_0x2b28a6)){return _0x5dd29b(msgResponse(_0x8ea2('0x1d0'),_0x8ea2('0x167'),_0x8ea2('0x1d7')+_0x2b28a6));}if(_0x4a4f3e<=0x0||isNaN(_0x4a4f3e)){return _0x5dd29b(msgResponse('[abandonmentRate]','Error',_0x8ea2('0x1dc')+_0x4a4f3e));}if(_0x1c5924<=0x0||isNaN(_0x1c5924)){return _0x5dd29b(msgResponse('[abandonmentRate]',_0x8ea2('0x167'),_0x8ea2('0x1d8')+_0x1c5924));}if(_0x3fc4d3<=0x0||isNaN(_0x3fc4d3)){return _0x5dd29b(msgResponse(_0x8ea2('0x1d0'),'Error',_0x8ea2('0x1d9')+_0x3fc4d3));}_0x31e9c1=_0x31e9c1||0x0;var _0x33fccf=0x1/_0x2b28a6;var _0x2493a2=0x0;var _0x2dc963=0x0;var _0x12fd70=0x0;var _0x5072a1=0x0;for(var _0x3b749e=0x0;_0x5072a1<_0x3fc4d3;_0x3b749e+=0x1){_0x2dc963=_0x3b749e/_0x1c5924;_0x2493a2=(_0x4a4f3e*_0x2dc963+_0x31e9c1)/_0x33fccf;_0x12fd70=erlangb(_0x2493a2,_0x5c29b8);_0x5072a1=_0x2493a2/_0x5c29b8*(0x1-erlangb(_0x2493a2,_0x5c29b8));}return _0x4288d0({'erlangCalls':_0x3b749e,'erlangCallToSecond':_0x1c5924/_0x3b749e,'erlangAbandonmentRate':_0x12fd70,'erlangBusyFactor':_0x5072a1});});};module['exports']=Dialer;
\ No newline at end of file
index c060806..711debf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7d02=['talktime','connectedlinename','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','uniqueid','name','number','starttime','responsetime','droptime','ringtime','holdtime'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7d02,0xe0));var _0x27d0=function(_0x5318f3,_0x120e1e){_0x5318f3=_0x5318f3-0x0;var _0x298497=_0x7d02[_0x5318f3];return _0x298497;};'use strict';var util=require(_0x27d0('0x0'));var _=require(_0x27d0('0x1'));var moment=require(_0x27d0('0x2'));function getSeconds(_0x27ef24,_0x7a450f){var _0x55c272=moment(_0x27ef24)['milliseconds'](0x0);var _0xc8dd83=moment(_0x7a450f)[_0x27d0('0x3')](0x0);return _0x55c272[_0x27d0('0x4')](_0xc8dd83,_0x27d0('0x5'));}function QueueCallerAbandon(_0x3465bc,_0x4e9cf7){this[_0x27d0('0x6')]=_0x3465bc[_0x27d0('0x6')];this[_0x27d0('0x7')]=_0x3465bc[_0x27d0('0x7')];this['campaigntype']=_0x3465bc[_0x27d0('0x7')]===_0x27d0('0x8')?_0x27d0('0x9'):_0x3465bc[_0x27d0('0x7')];this[_0x27d0('0xa')]=_0x3465bc[_0x27d0('0xa')];this['countcongestionretry']=_0x3465bc[_0x27d0('0xb')];this[_0x27d0('0xc')]=_0x3465bc['countnoanswerretry'];this['countglobal']=_0x3465bc[_0x27d0('0xa')]+_0x3465bc[_0x27d0('0xb')]+_0x3465bc[_0x27d0('0xc')];this[_0x27d0('0xd')]=_0x4e9cf7[_0x27d0('0xd')];this['calleridname']=_0x3465bc[_0x27d0('0xe')];this['calleridnum']=_0x3465bc[_0x27d0('0xf')];this[_0x27d0('0x10')]=_0x3465bc[_0x27d0('0x10')];this[_0x27d0('0x11')]=_0x3465bc[_0x27d0('0x11')];this['droptime']=_0x3465bc['droptime'];this['endtime']=this[_0x27d0('0x12')];this[_0x27d0('0x13')]=getSeconds(_0x3465bc[_0x27d0('0x11')],_0x3465bc[_0x27d0('0x10')]);this[_0x27d0('0x14')]=getSeconds(this[_0x27d0('0x12')],_0x3465bc[_0x27d0('0x11')]);this[_0x27d0('0x15')]=0x0;this['queue']=_0x4e9cf7[_0x27d0('0x9')];this['membername']=_0x4e9cf7[_0x27d0('0x16')];this[_0x27d0('0x17')]=_0x4e9cf7[_0x27d0('0x17')];this['callback']=_0x3465bc[_0x27d0('0x18')];this[_0x27d0('0x19')]=_0x3465bc[_0x27d0('0x19')];this['callbackat']=_0x3465bc['callbackat'];this[_0x27d0('0x1a')]=_0x3465bc[_0x27d0('0x1a')];this[_0x27d0('0x1b')]=_0x3465bc['ContactId'];this[_0x27d0('0x1c')]=_0x3465bc[_0x27d0('0x1c')];this['UserId']=_0x3465bc[_0x27d0('0x1d')];this[_0x27d0('0x1e')]=_0x3465bc[_0x27d0('0x1e')];this[_0x27d0('0x1f')]=_0x3465bc['CampaignId'];this[_0x27d0('0x20')]=_0x3465bc['originatecalleridnum']||'';this['originatecalleridname']=_0x3465bc[_0x27d0('0x21')]||'';}module[_0x27d0('0x22')]=QueueCallerAbandon;
\ No newline at end of file
+var _0x2572=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','diff','seconds','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid','name','calleridnum','starttime','responsetime','droptime','ringtime','talktime','queue','reason','callback','callbackuniqueid'];(function(_0x181b1e,_0x160c56){var _0x1ad7bf=function(_0x59cae9){while(--_0x59cae9){_0x181b1e['push'](_0x181b1e['shift']());}};_0x1ad7bf(++_0x160c56);}(_0x2572,0x154));var _0x2257=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x2572[_0x2bf141];return _0x48277b;};'use strict';var util=require('util');var _=require(_0x2257('0x0'));var moment=require(_0x2257('0x1'));function getSeconds(_0x562a8d,_0x4587b1){var _0x4c951d=moment(_0x562a8d)['milliseconds'](0x0);var _0x18207b=moment(_0x4587b1)['milliseconds'](0x0);return _0x4c951d[_0x2257('0x2')](_0x18207b,_0x2257('0x3'));}function QueueCallerAbandon(_0x5cc243,_0x1d9c43){this[_0x2257('0x4')]=_0x5cc243['scheduledat'];this[_0x2257('0x5')]=_0x5cc243['type'];this['campaigntype']=_0x5cc243['type']===_0x2257('0x6')?'queue':_0x5cc243[_0x2257('0x5')];this[_0x2257('0x7')]=_0x5cc243[_0x2257('0x7')];this[_0x2257('0x8')]=_0x5cc243[_0x2257('0x8')];this[_0x2257('0x9')]=_0x5cc243[_0x2257('0x9')];this[_0x2257('0xa')]=_0x5cc243['countbusyretry']+_0x5cc243[_0x2257('0x8')]+_0x5cc243[_0x2257('0x9')];this[_0x2257('0xb')]=_0x1d9c43['uniqueid'];this['calleridname']=_0x5cc243[_0x2257('0xc')];this[_0x2257('0xd')]=_0x5cc243['number'];this[_0x2257('0xe')]=_0x5cc243[_0x2257('0xe')];this['responsetime']=_0x5cc243[_0x2257('0xf')];this[_0x2257('0x10')]=_0x5cc243[_0x2257('0x10')];this['endtime']=this['droptime'];this[_0x2257('0x11')]=getSeconds(_0x5cc243['responsetime'],_0x5cc243[_0x2257('0xe')]);this['holdtime']=getSeconds(this[_0x2257('0x10')],_0x5cc243[_0x2257('0xf')]);this[_0x2257('0x12')]=0x0;this[_0x2257('0x13')]=_0x1d9c43[_0x2257('0x13')];this['membername']=_0x1d9c43['connectedlinename'];this[_0x2257('0x14')]=_0x1d9c43['reason'];this[_0x2257('0x15')]=_0x5cc243[_0x2257('0x15')];this['callbackuniqueid']=_0x5cc243[_0x2257('0x16')];this[_0x2257('0x17')]=_0x5cc243['callbackat'];this[_0x2257('0x18')]=_0x5cc243[_0x2257('0x18')];this[_0x2257('0x19')]=_0x5cc243[_0x2257('0x19')];this[_0x2257('0x1a')]=_0x5cc243['ListId'];this['UserId']=_0x5cc243[_0x2257('0x1b')];this['VoiceQueueId']=_0x5cc243[_0x2257('0x1c')];this['CampaignId']=_0x5cc243[_0x2257('0x1d')];this[_0x2257('0x1e')]=_0x5cc243[_0x2257('0x1e')]||'';this[_0x2257('0x1f')]=_0x5cc243[_0x2257('0x1f')]||'';}module[_0x2257('0x20')]=QueueCallerAbandon;
\ No newline at end of file
index f7cba62..0f356fb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5c38=['headerinfo','path','AttachmentId','lodash','moment','uniqueid','channel','format','%s/%s/%s','tech','Trunk','name','localstationid'];(function(_0x298853,_0x4c2000){var _0x4fa4ee=function(_0x18ee5f){while(--_0x18ee5f){_0x298853['push'](_0x298853['shift']());}};_0x4fa4ee(++_0x4c2000);}(_0x5c38,0x189));var _0x85c3=function(_0x267b55,_0xcff2dd){_0x267b55=_0x267b55-0x0;var _0x31b90f=_0x5c38[_0x267b55];return _0x31b90f;};'use strict';var util=require('util');var _=require(_0x85c3('0x0'));var moment=require(_0x85c3('0x1'));function Action(_0xcaaa41,_0x1d900c,_0x501c34){this[_0x85c3('0x2')]=_0xcaaa41||undefined;this[_0x85c3('0x3')]=util[_0x85c3('0x4')](_0x85c3('0x5'),_0x1d900c[_0x85c3('0x6')],_0x1d900c[_0x85c3('0x7')][_0x85c3('0x8')],_0x501c34['fax']);this[_0x85c3('0x9')]=_0x1d900c[_0x85c3('0x9')];this[_0x85c3('0xa')]=_0x1d900c['headerinfo'];this[_0x85c3('0xb')]=_0x501c34['path'];this[_0x85c3('0xc')]=_0x501c34[_0x85c3('0xc')];}module['exports']=Action;
\ No newline at end of file
+var _0x88d4=['channel','format','tech','Trunk','fax','localstationid','headerinfo','path','AttachmentId','exports','util','moment','uniqueid'];(function(_0x4ab89f,_0x28383d){var _0x3f3339=function(_0x11d0a8){while(--_0x11d0a8){_0x4ab89f['push'](_0x4ab89f['shift']());}};_0x3f3339(++_0x28383d);}(_0x88d4,0x135));var _0x488d=function(_0x2495b1,_0x545cdf){_0x2495b1=_0x2495b1-0x0;var _0x3575d8=_0x88d4[_0x2495b1];return _0x3575d8;};'use strict';var util=require(_0x488d('0x0'));var _=require('lodash');var moment=require(_0x488d('0x1'));function Action(_0x5bb4e6,_0x26ca14,_0x54a109){this[_0x488d('0x2')]=_0x5bb4e6||undefined;this[_0x488d('0x3')]=util[_0x488d('0x4')]('%s/%s/%s',_0x26ca14[_0x488d('0x5')],_0x26ca14[_0x488d('0x6')]['name'],_0x54a109[_0x488d('0x7')]);this[_0x488d('0x8')]=_0x26ca14[_0x488d('0x8')];this[_0x488d('0x9')]=_0x26ca14[_0x488d('0x9')];this['path']=_0x54a109[_0x488d('0xa')];this[_0x488d('0xb')]=_0x54a109[_0x488d('0xb')];}module[_0x488d('0xc')]=Action;
\ No newline at end of file
index 8121525..81710bb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1b83=['Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','channels','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','parse','.pdf','then','notify','catch','error','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','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','format','%s/%s.tif','dir','XMF-PATH'];(function(_0x39ca61,_0x5dd2fe){var _0x4f04d5=function(_0x580441){while(--_0x580441){_0x39ca61['push'](_0x39ca61['shift']());}};_0x4f04d5(++_0x5dd2fe);}(_0x1b83,0xfb));var _0x31b8=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x1b83[_0x2b4411];return _0x8e41ef;};'use strict';var util=require(_0x31b8('0x0'));var _=require(_0x31b8('0x1'));var BPromise=require(_0x31b8('0x2'));var uuid=require(_0x31b8('0x3'));var moment=require(_0x31b8('0x4'));var path=require(_0x31b8('0x5'));var tiff2pdf=require(_0x31b8('0x6'));var gs=require(_0x31b8('0x7'));var logger=require(_0x31b8('0x8'))(_0x31b8('0x9'));var ami=require(_0x31b8('0xa'));var rpcDb=require(_0x31b8('0xb'));var Channel=require(_0x31b8('0xc'));var ut=require(_0x31b8('0xd'));var Action=require(_0x31b8('0xe'));var faxAccount=require(_0x31b8('0xf'));var attachment=require(_0x31b8('0x10'));var faxMessage=require(_0x31b8('0x11'));function Fax(_0x20faa9){this['channels']={};this[_0x31b8('0x12')]=_0x20faa9[_0x31b8('0x12')];this['trunks']=_0x20faa9[_0x31b8('0x13')];this[_0x31b8('0x14')]={};ami['on']('newchannel',this[_0x31b8('0x15')][_0x31b8('0x16')](this));ami['on'](_0x31b8('0x17'),this[_0x31b8('0x18')][_0x31b8('0x16')](this));ami['on'](_0x31b8('0x19'),this[_0x31b8('0x1a')]['bind'](this));ami['on'](_0x31b8('0x1b'),this['syncNewExten']['bind'](this));ami['on'](_0x31b8('0x1c'),this[_0x31b8('0x1d')][_0x31b8('0x16')](this));ami['on'](_0x31b8('0x1e'),this[_0x31b8('0x1f')]['bind'](this));ami['on'](_0x31b8('0x20'),this[_0x31b8('0x21')][_0x31b8('0x16')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x31b8('0x16')](this));}Fax[_0x31b8('0x22')]['syncNewchannel']=function(_0x47311b){if(_0x47311b[_0x31b8('0x23')]===_0x31b8('0x24')){for(var _0x42595c in this['faxAccounts']){if(this[_0x31b8('0x12')][_0x31b8('0x25')](_0x42595c)){if(_0x47311b[_0x31b8('0x26')]===this[_0x31b8('0x12')][_0x42595c][_0x31b8('0x27')]){this['channels'][_0x47311b[_0x31b8('0x28')]]={};this['channels'][_0x47311b[_0x31b8('0x28')]][_0x31b8('0x29')]=_0x47311b[_0x31b8('0x29')];this[_0x31b8('0x2a')][_0x47311b[_0x31b8('0x28')]]['id']=this[_0x31b8('0x12')][_0x42595c]['id'];this[_0x31b8('0x2a')][_0x47311b[_0x31b8('0x28')]][_0x31b8('0x2b')]=this[_0x31b8('0x12')][_0x42595c][_0x31b8('0x2b')];logger[_0x31b8('0x2c')](_0x47311b[_0x31b8('0x28')],_0x31b8('0x2d'));}}}}if(this[_0x31b8('0x14')][_0x47311b[_0x31b8('0x28')]]){this[_0x31b8('0x2a')][_0x47311b[_0x31b8('0x28')]]={};this[_0x31b8('0x2a')][_0x47311b[_0x31b8('0x28')]][_0x31b8('0x29')]=_0x47311b[_0x31b8('0x29')];logger[_0x31b8('0x2c')](_0x47311b[_0x31b8('0x28')],_0x31b8('0x2d'));}};Fax['prototype'][_0x31b8('0x18')]=function(_0x5c5761){if(this['channels'][_0x5c5761['uniqueid']]){for(var _0x243502 in _0x5c5761[_0x31b8('0x2e')]){if(_0x5c5761[_0x31b8('0x2e')][_0x31b8('0x25')](_0x243502)){this[_0x31b8('0x2a')][_0x5c5761[_0x31b8('0x28')]][_0x243502]=_0x5c5761[_0x31b8('0x2f')];}}}};Fax[_0x31b8('0x22')]['syncNewState']=function(_0x3bd07f){if(this[_0x31b8('0x2a')][_0x3bd07f[_0x31b8('0x28')]]){this[_0x31b8('0x2a')][_0x3bd07f[_0x31b8('0x28')]][_0x31b8('0x30')]=_0x3bd07f[_0x31b8('0x30')];this['channels'][_0x3bd07f[_0x31b8('0x28')]][_0x31b8('0x31')]=_0x3bd07f[_0x31b8('0x31')];}};Fax[_0x31b8('0x22')]['syncNewExten']=function(_0x971267){if(this[_0x31b8('0x2a')][_0x971267[_0x31b8('0x28')]]){for(var _0x23f300 in _0x971267['variable']){if(_0x971267['variable'][_0x31b8('0x25')](_0x23f300)){this[_0x31b8('0x2a')][_0x971267[_0x31b8('0x28')]][_0x23f300]=_0x971267['value'];}}}};Fax[_0x31b8('0x22')][_0x31b8('0x1d')]=function(_0x367701){if(this[_0x31b8('0x2a')][_0x367701[_0x31b8('0x28')]]){this[_0x31b8('0x2a')][_0x367701[_0x31b8('0x28')]][_0x31b8('0x32')]=_0x367701[_0x31b8('0x32')];this['channels'][_0x367701['uniqueid']][_0x31b8('0x33')]=_0x367701[_0x31b8('0x33')];this[_0x31b8('0x2a')][_0x367701[_0x31b8('0x28')]][_0x31b8('0x27')]=_0x367701[_0x31b8('0x27')];this['channels'][_0x367701[_0x31b8('0x28')]][_0x31b8('0x34')]=_0x367701[_0x31b8('0x34')];logger[_0x31b8('0x2c')](_0x367701[_0x31b8('0x28')],_0x31b8('0x35'));}};Fax[_0x31b8('0x22')][_0x31b8('0x1f')]=function(_0x3a5bae){var _0x220858=this;if(this[_0x31b8('0x2a')][_0x3a5bae['uniqueid']]){var _0x140aa8=this[_0x31b8('0x2a')][_0x3a5bae[_0x31b8('0x28')]]['id'];this['channels'][_0x3a5bae[_0x31b8('0x28')]][_0x31b8('0x36')]=_0x3a5bae[_0x31b8('0x36')];this[_0x31b8('0x2a')][_0x3a5bae[_0x31b8('0x28')]][_0x31b8('0x37')]=_0x3a5bae[_0x31b8('0x37')];this[_0x31b8('0x2a')][_0x3a5bae[_0x31b8('0x28')]][_0x31b8('0x27')]=_0x3a5bae[_0x31b8('0x27')];this[_0x31b8('0x2a')][_0x3a5bae[_0x31b8('0x28')]]['resolution']=_0x3a5bae[_0x31b8('0x38')];this[_0x31b8('0x2a')][_0x3a5bae[_0x31b8('0x28')]][_0x31b8('0x39')]=_0x3a5bae[_0x31b8('0x39')];this[_0x31b8('0x2a')][_0x3a5bae['uniqueid']][_0x31b8('0x34')]=_0x3a5bae[_0x31b8('0x34')];this[_0x31b8('0x2a')][_0x3a5bae[_0x31b8('0x28')]]['calleridnum']=_0x3a5bae[_0x31b8('0x3a')];if(this['channels'][_0x3a5bae['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x3a5bae[_0x31b8('0x34')],_0x31b8('0x3b'),function(_0x2fcb16){logger[_0x31b8('0x2c')](_0x3a5bae[_0x31b8('0x28')],'\x20result\x20conversion\x20file\x20',_0x2fcb16['message']);attachment['create']({'name':path[_0x31b8('0x3c')](_0x3a5bae[_0x31b8('0x34')])[_0x31b8('0x2b')],'basename':path[_0x31b8('0x3c')](_0x3a5bae[_0x31b8('0x34')])[_0x31b8('0x2b')]+_0x31b8('0x3d'),'type':'application/pdf'})[_0x31b8('0x3e')](function(_0x462c14){faxAccount[_0x31b8('0x3f')](_0x140aa8,{'from':_0x3a5bae[_0x31b8('0x3a')],'mapKey':_0x31b8('0x9'),'body':path[_0x31b8('0x3c')](_0x3a5bae[_0x31b8('0x34')])[_0x31b8('0x2b')]+_0x31b8('0x3d'),'AttachmentId':_0x462c14['id']})[_0x31b8('0x40')](function(_0x3db779){logger[_0x31b8('0x41')](_0x3a5bae['uniqueid'],'\x20notify\x20',JSON[_0x31b8('0x42')](_0x3db779));});})[_0x31b8('0x40')](function(_0x55a15c){logger[_0x31b8('0x41')](_0x3a5bae[_0x31b8('0x28')],_0x31b8('0x43'),JSON['stringify'](_0x55a15c));});});}logger[_0x31b8('0x2c')](_0x3a5bae[_0x31b8('0x28')],_0x31b8('0x43'));}};Fax[_0x31b8('0x22')]['syncOriginateResponse']=function(_0xa6fc16){if(this['actions'][_0xa6fc16[_0x31b8('0x28')]]){_[_0x31b8('0x44')](this[_0x31b8('0x2a')][_0xa6fc16[_0x31b8('0x28')]],_[_0x31b8('0x45')](_0xa6fc16,[_0x31b8('0x46'),_0x31b8('0x47')]));}};function updateStatus(_0x5a2493){if(_0x5a2493[_0x31b8('0x48')]){faxMessage[_0x31b8('0x49')](_0x5a2493[_0x31b8('0x48')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x31b8('0x3e')](function(_0x50e09e){ut['logger'](_0x31b8('0x4a'),_0x50e09e);})[_0x31b8('0x40')](function(_0x339b62){ut[_0x31b8('0x4b')](_0x31b8('0x4c'),_0x339b62);});}else{ut[_0x31b8('0x4b')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x31b8('0x22')][_0x31b8('0x4d')]=function(_0x5864b2,_0x48b46e,_0x27bd06){var _0x3e28ad=this;var _0x302b4d={};if(_0x48b46e){_0x302b4d={'read':_0x48b46e};}else{_0x302b4d={'failMessage':_0x27bd06};}if(this[_0x31b8('0x14')][_0x5864b2][_0x31b8('0x48')]){faxMessage[_0x31b8('0x49')](this[_0x31b8('0x14')][_0x5864b2][_0x31b8('0x48')],_0x302b4d)['then'](function(_0x27a823){ut[_0x31b8('0x4b')]('[Fax][Message][Updated]',_0x27a823);})[_0x31b8('0x40')](function(_0x2e1751){ut[_0x31b8('0x4b')](_0x31b8('0x4e'),_0x2e1751);})[_0x31b8('0x4f')](function(){delete _0x3e28ad[_0x31b8('0x2a')][_0x5864b2];delete _0x3e28ad[_0x31b8('0x14')][_0x5864b2];});}else{ut[_0x31b8('0x4b')](_0x31b8('0x50'));delete this[_0x31b8('0x2a')][_0x5864b2];delete this['actions'][_0x5864b2];}};Fax[_0x31b8('0x22')][_0x31b8('0x21')]=function(_0x165ebf){var _0x1ecfd0=this;if(this['channels'][_0x165ebf[_0x31b8('0x28')]]){if(this[_0x31b8('0x14')][_0x165ebf['uniqueid']]){this[_0x31b8('0x2a')][_0x165ebf['uniqueid']]['id']=this[_0x31b8('0x14')][_0x165ebf['uniqueid']]['id'];this['channels'][_0x165ebf[_0x31b8('0x28')]]['name']=this[_0x31b8('0x14')][_0x165ebf[_0x31b8('0x28')]][_0x31b8('0x2b')];}logger['info'](_0x165ebf['uniqueid'],this[_0x31b8('0x14')][_0x165ebf[_0x31b8('0x28')]]?'\x20hangup\x20sendFile\x20':_0x31b8('0x51'),JSON['stringify'](this[_0x31b8('0x2a')][_0x165ebf['uniqueid']]));if(this[_0x31b8('0x14')][_0x165ebf[_0x31b8('0x28')]]){if(this['channels'][_0x165ebf['uniqueid']][_0x31b8('0x52')]>0x0&&this[_0x31b8('0x2a')][_0x165ebf['uniqueid']]['faxstatus']===_0x31b8('0x53')){this['updateStatus'](_0x165ebf[_0x31b8('0x28')],!![]);}else{this[_0x31b8('0x4d')](_0x165ebf[_0x31b8('0x28')],![],this[_0x31b8('0x2a')][_0x165ebf[_0x31b8('0x28')]][_0x31b8('0x54')]?'SENDING\x20FAILED:\x20'+this['channels'][_0x165ebf[_0x31b8('0x28')]][_0x31b8('0x54')]:_0x31b8('0x55'));}}}};Fax[_0x31b8('0x22')][_0x31b8('0x56')]=function(_0x35b8d9){var _0x8944f6=this;return new BPromise(function(_0x519007,_0x3d539b){_0x8944f6[_0x31b8('0x57')](_0x35b8d9,_0x8944f6['faxAccounts'][_0x35b8d9[_0x31b8('0x58')]])[_0x31b8('0x3e')](function(_0x3a7bb5){ut[_0x31b8('0x4b')](_0x31b8('0x59'),_0x3a7bb5);_0x519007(ut[_0x31b8('0x5a')]('Fax\x20received'));})[_0x31b8('0x40')](function(_0x3515d2){ut[_0x31b8('0x4b')](_0x31b8('0x5b'),_0x3515d2);updateStatus(_0x35b8d9);_0x3d539b(ut['message'](_0x31b8('0x5c')));});});};Fax[_0x31b8('0x22')][_0x31b8('0x5d')]=function(_0x393b3b){var _0x3140c6=this;return new BPromise(function(_0x483e35,_0x239fb0){var _0x31f6dc=_0x3140c6[_0x31b8('0x5e')](_0x3140c6[_0x31b8('0x12')][_0x393b3b[_0x31b8('0x58')]][_0x31b8('0x5f')],_0x393b3b);if(_0x31f6dc[_0x31b8('0x60')]){_0x483e35(ut['message'](_0x31b8('0x61')));}else{_0x239fb0(ut[_0x31b8('0x5a')](_0x31f6dc['message']));}});};function originate(_0x54dd35,_0x176f25,_0x4300d1){return new BPromise(function(_0x409ebb,_0x506694){if(_0x4300d1){var _0xc35821=util['format'](_0x31b8('0x62'),path['parse'](_0x54dd35[_0x31b8('0x5')])[_0x31b8('0x2b')],_0x54dd35[_0x31b8('0x5')]);gs['execute'](_0xc35821)[_0x31b8('0x3e')](function(){_0x54dd35[_0x31b8('0x5')]=util[_0x31b8('0x63')](_0x31b8('0x64'),path[_0x31b8('0x3c')](_0x54dd35[_0x31b8('0x5')])[_0x31b8('0x65')],path['parse'](_0x54dd35[_0x31b8('0x5')])[_0x31b8('0x2b')]);_0x176f25[_0x31b8('0x66')]=_0x54dd35[_0x31b8('0x5')];ut[_0x31b8('0x4b')](_0x31b8('0x67'),'');ami[_0x31b8('0x68')](ut['variablesAction'](_0x54dd35,_0x176f25))['then'](function(_0x37283d){_0x409ebb(_0x37283d);})[_0x31b8('0x40')](function(_0x206461){_0x506694(_0x206461);});})['catch'](function(_0x1e752b){_0x506694(_0x1e752b);});}else{ami[_0x31b8('0x68')](ut[_0x31b8('0x69')](_0x54dd35,_0x176f25))[_0x31b8('0x3e')](function(_0x5d11e9){_0x409ebb(_0x5d11e9);})['catch'](function(_0x33c2f4){_0x506694(_0x33c2f4);});}});}Fax[_0x31b8('0x22')][_0x31b8('0x57')]=function(_0x110f5a,_0x16a372){var _0x5b1ce6=this;return new BPromise(function(_0x31279,_0x11c936){var _0x1d7132=uuid['v4']();var _0x3f7434=ut[_0x31b8('0x6a')](_0x110f5a,_0x16a372);_0x5b1ce6[_0x31b8('0x14')][_0x1d7132]=new Action(_0x1d7132,_0x16a372,_0x110f5a);var _0x544969=_0x5b1ce6[_0x31b8('0x14')][_0x1d7132];if(path['parse'](_0x110f5a[_0x31b8('0x5')])[_0x31b8('0x6b')]==='.pdf'){originate(_0x544969,_0x3f7434,!![])[_0x31b8('0x3e')](function(_0x43f7c9){_0x31279(_0x43f7c9);})[_0x31b8('0x40')](function(_0x4aa856){_0x11c936(_0x4aa856);});}else{originate(_0x544969,_0x3f7434,![])[_0x31b8('0x3e')](function(_0x956381){_0x31279(_0x956381);})[_0x31b8('0x40')](function(_0x25062e){_0x11c936(_0x25062e);});}});};Fax['prototype'][_0x31b8('0x6c')]=function(_0x48a0b3){return!_[_0x31b8('0x6d')](_0x48a0b3)&&!_[_0x31b8('0x6d')](_0x48a0b3[_0x31b8('0x2b')])&&!_[_0x31b8('0x6d')](_0x48a0b3[_0x31b8('0x6e')])&&_0x48a0b3[_0x31b8('0x6e')]&&!_[_0x31b8('0x6d')](this[_0x31b8('0x13')][util['format'](_0x31b8('0x6f'),_0x48a0b3[_0x31b8('0x2b')])])&&!_[_0x31b8('0x6d')](this[_0x31b8('0x13')][util['format'](_0x31b8('0x6f'),_0x48a0b3[_0x31b8('0x2b')])][_0x31b8('0x33')])&&(this[_0x31b8('0x13')][util['format'](_0x31b8('0x6f'),_0x48a0b3[_0x31b8('0x2b')])]['status']==='reachable'||this[_0x31b8('0x13')][util[_0x31b8('0x63')](_0x31b8('0x6f'),_0x48a0b3[_0x31b8('0x2b')])]['status']===_0x31b8('0x70'));};Fax[_0x31b8('0x22')][_0x31b8('0x5e')]=function(_0xdba18c,_0x4f5cc9){if(!this[_0x31b8('0x6c')](_0xdba18c)){ut['logger'](_0x31b8('0x71'),_[_0x31b8('0x6d')](_0xdba18c)?'':_0xdba18c[_0x31b8('0x2b')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x31b8('0x6d')](_0x4f5cc9[_0x31b8('0x9')])){ut[_0x31b8('0x4b')](_0x31b8('0x72'),JSON[_0x31b8('0x42')](_0x4f5cc9));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x31b8('0x6d')](_0x4f5cc9[_0x31b8('0x5')])){ut[_0x31b8('0x4b')]('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0x4f5cc9));return{'isValid':![],'message':_0x31b8('0x73')};}return{'isValid':!![],'message':_0x31b8('0x74')};};module[_0x31b8('0x75')]=Fax;
\ No newline at end of file
+var _0xeb26=['\x20receiveFax\x20','syncOriginateResponse','merge','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SENDING\x20FAILED:\x20','faxstatusstring','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','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','ext','.pdf','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util','lodash','uuid','path','tiff2pdf','./util/gs','fax','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','syncNewExten','faxstatus','hangup','syncHangup','originateresponse','context','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','prototype','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','notify','catch','error','\x20notify\x20','stringify'];(function(_0x43f7b3,_0x369431){var _0x4060c1=function(_0x45b3dd){while(--_0x45b3dd){_0x43f7b3['push'](_0x43f7b3['shift']());}};_0x4060c1(++_0x369431);}(_0xeb26,0x11f));var _0x6eb2=function(_0x3f875f,_0x828234){_0x3f875f=_0x3f875f-0x0;var _0x254e38=_0xeb26[_0x3f875f];return _0x254e38;};'use strict';var util=require(_0x6eb2('0x0'));var _=require(_0x6eb2('0x1'));var BPromise=require('bluebird');var uuid=require(_0x6eb2('0x2'));var moment=require('moment');var path=require(_0x6eb2('0x3'));var tiff2pdf=require(_0x6eb2('0x4'));var gs=require(_0x6eb2('0x5'));var logger=require('../../../config/logger')(_0x6eb2('0x6'));var ami=require(_0x6eb2('0x7'));var rpcDb=require('./rpcDb');var Channel=require(_0x6eb2('0x8'));var ut=require(_0x6eb2('0x9'));var Action=require(_0x6eb2('0xa'));var faxAccount=require(_0x6eb2('0xb'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x6eb2('0xc'));function Fax(_0x1db1e8){this['channels']={};this[_0x6eb2('0xd')]=_0x1db1e8['faxAccounts'];this['trunks']=_0x1db1e8[_0x6eb2('0xe')];this[_0x6eb2('0xf')]={};ami['on'](_0x6eb2('0x10'),this[_0x6eb2('0x11')][_0x6eb2('0x12')](this));ami['on'](_0x6eb2('0x13'),this[_0x6eb2('0x14')][_0x6eb2('0x12')](this));ami['on'](_0x6eb2('0x15'),this[_0x6eb2('0x16')]['bind'](this));ami['on']('newexten',this[_0x6eb2('0x17')][_0x6eb2('0x12')](this));ami['on'](_0x6eb2('0x18'),this['syncFaxStatus'][_0x6eb2('0x12')](this));ami['on']('receivefax',this['syncReceiveFax'][_0x6eb2('0x12')](this));ami['on'](_0x6eb2('0x19'),this[_0x6eb2('0x1a')][_0x6eb2('0x12')](this));ami['on'](_0x6eb2('0x1b'),this['syncOriginateResponse'][_0x6eb2('0x12')](this));}Fax['prototype']['syncNewchannel']=function(_0x3b31e8){if(_0x3b31e8[_0x6eb2('0x1c')]==='from-voip-provider'){for(var _0x22aff8 in this[_0x6eb2('0xd')]){if(this[_0x6eb2('0xd')][_0x6eb2('0x1d')](_0x22aff8)){if(_0x3b31e8[_0x6eb2('0x1e')]===this[_0x6eb2('0xd')][_0x22aff8][_0x6eb2('0x1f')]){this['channels'][_0x3b31e8['uniqueid']]={};this[_0x6eb2('0x20')][_0x3b31e8[_0x6eb2('0x21')]][_0x6eb2('0x22')]=_0x3b31e8[_0x6eb2('0x22')];this[_0x6eb2('0x20')][_0x3b31e8['uniqueid']]['id']=this[_0x6eb2('0xd')][_0x22aff8]['id'];this[_0x6eb2('0x20')][_0x3b31e8[_0x6eb2('0x21')]]['name']=this[_0x6eb2('0xd')][_0x22aff8][_0x6eb2('0x23')];logger[_0x6eb2('0x24')](_0x3b31e8[_0x6eb2('0x21')],_0x6eb2('0x25'));}}}}if(this[_0x6eb2('0xf')][_0x3b31e8[_0x6eb2('0x21')]]){this[_0x6eb2('0x20')][_0x3b31e8[_0x6eb2('0x21')]]={};this['channels'][_0x3b31e8[_0x6eb2('0x21')]]['channel']=_0x3b31e8[_0x6eb2('0x22')];logger[_0x6eb2('0x24')](_0x3b31e8[_0x6eb2('0x21')],_0x6eb2('0x25'));}};Fax['prototype'][_0x6eb2('0x14')]=function(_0x1a6d33){if(this[_0x6eb2('0x20')][_0x1a6d33[_0x6eb2('0x21')]]){for(var _0x2e2a00 in _0x1a6d33[_0x6eb2('0x26')]){if(_0x1a6d33['variable']['hasOwnProperty'](_0x2e2a00)){this[_0x6eb2('0x20')][_0x1a6d33[_0x6eb2('0x21')]][_0x2e2a00]=_0x1a6d33[_0x6eb2('0x27')];}}}};Fax['prototype']['syncNewState']=function(_0x451a4d){if(this[_0x6eb2('0x20')][_0x451a4d[_0x6eb2('0x21')]]){this[_0x6eb2('0x20')][_0x451a4d['uniqueid']][_0x6eb2('0x28')]=_0x451a4d[_0x6eb2('0x28')];this[_0x6eb2('0x20')][_0x451a4d[_0x6eb2('0x21')]][_0x6eb2('0x29')]=_0x451a4d[_0x6eb2('0x29')];}};Fax[_0x6eb2('0x2a')][_0x6eb2('0x17')]=function(_0x894ee4){if(this[_0x6eb2('0x20')][_0x894ee4[_0x6eb2('0x21')]]){for(var _0x412ddb in _0x894ee4[_0x6eb2('0x26')]){if(_0x894ee4[_0x6eb2('0x26')][_0x6eb2('0x1d')](_0x412ddb)){this[_0x6eb2('0x20')][_0x894ee4[_0x6eb2('0x21')]][_0x412ddb]=_0x894ee4[_0x6eb2('0x27')];}}}};Fax[_0x6eb2('0x2a')][_0x6eb2('0x2b')]=function(_0x1068d0){if(this['channels'][_0x1068d0['uniqueid']]){this[_0x6eb2('0x20')][_0x1068d0[_0x6eb2('0x21')]][_0x6eb2('0x2c')]=_0x1068d0[_0x6eb2('0x2c')];this[_0x6eb2('0x20')][_0x1068d0['uniqueid']]['status']=_0x1068d0[_0x6eb2('0x2d')];this[_0x6eb2('0x20')][_0x1068d0[_0x6eb2('0x21')]][_0x6eb2('0x1f')]=_0x1068d0[_0x6eb2('0x1f')];this[_0x6eb2('0x20')][_0x1068d0['uniqueid']]['filename']=_0x1068d0[_0x6eb2('0x2e')];logger[_0x6eb2('0x24')](_0x1068d0[_0x6eb2('0x21')],_0x6eb2('0x2f'));}};Fax[_0x6eb2('0x2a')][_0x6eb2('0x30')]=function(_0xa4f713){var _0x2c8ece=this;if(this[_0x6eb2('0x20')][_0xa4f713[_0x6eb2('0x21')]]){var _0x5a3284=this[_0x6eb2('0x20')][_0xa4f713[_0x6eb2('0x21')]]['id'];this[_0x6eb2('0x20')][_0xa4f713[_0x6eb2('0x21')]][_0x6eb2('0x31')]=_0xa4f713[_0x6eb2('0x31')];this[_0x6eb2('0x20')][_0xa4f713[_0x6eb2('0x21')]][_0x6eb2('0x32')]=_0xa4f713[_0x6eb2('0x32')];this[_0x6eb2('0x20')][_0xa4f713[_0x6eb2('0x21')]][_0x6eb2('0x1f')]=_0xa4f713['localstationid'];this['channels'][_0xa4f713[_0x6eb2('0x21')]][_0x6eb2('0x33')]=_0xa4f713[_0x6eb2('0x33')];this[_0x6eb2('0x20')][_0xa4f713[_0x6eb2('0x21')]][_0x6eb2('0x34')]=_0xa4f713[_0x6eb2('0x34')];this[_0x6eb2('0x20')][_0xa4f713['uniqueid']][_0x6eb2('0x2e')]=_0xa4f713['filename'];this[_0x6eb2('0x20')][_0xa4f713['uniqueid']][_0x6eb2('0x35')]=_0xa4f713[_0x6eb2('0x35')];if(this[_0x6eb2('0x20')][_0xa4f713[_0x6eb2('0x21')]]['pagestransferred']>0x0){tiff2pdf(_0xa4f713['filename'],'/var/opt/motion2/server/files/attachments/',function(_0x61ee21){logger[_0x6eb2('0x24')](_0xa4f713['uniqueid'],_0x6eb2('0x36'),_0x61ee21[_0x6eb2('0x37')]);attachment[_0x6eb2('0x38')]({'name':path[_0x6eb2('0x39')](_0xa4f713[_0x6eb2('0x2e')])['name'],'basename':path[_0x6eb2('0x39')](_0xa4f713[_0x6eb2('0x2e')])['name']+'.pdf','type':_0x6eb2('0x3a')})['then'](function(_0x38e95f){faxAccount[_0x6eb2('0x3b')](_0x5a3284,{'from':_0xa4f713['calleridnum'],'mapKey':'fax','body':path['parse'](_0xa4f713[_0x6eb2('0x2e')])['name']+'.pdf','AttachmentId':_0x38e95f['id']})[_0x6eb2('0x3c')](function(_0xdd3fc0){logger[_0x6eb2('0x3d')](_0xa4f713[_0x6eb2('0x21')],_0x6eb2('0x3e'),JSON[_0x6eb2('0x3f')](_0xdd3fc0));});})[_0x6eb2('0x3c')](function(_0x4e63b6){logger['error'](_0xa4f713[_0x6eb2('0x21')],'\x20receiveFax\x20',JSON[_0x6eb2('0x3f')](_0x4e63b6));});});}logger[_0x6eb2('0x24')](_0xa4f713[_0x6eb2('0x21')],_0x6eb2('0x40'));}};Fax[_0x6eb2('0x2a')][_0x6eb2('0x41')]=function(_0x460c0c){if(this[_0x6eb2('0xf')][_0x460c0c['uniqueid']]){_[_0x6eb2('0x42')](this[_0x6eb2('0x20')][_0x460c0c['uniqueid']],_['pick'](_0x460c0c,[_0x6eb2('0x43'),_0x6eb2('0x44')]));}};function updateStatus(_0xe4ff2e){if(_0xe4ff2e[_0x6eb2('0x45')]){faxMessage[_0x6eb2('0x46')](_0xe4ff2e[_0x6eb2('0x45')],{'failMessage':_0x6eb2('0x47')})[_0x6eb2('0x48')](function(_0x23711b){ut[_0x6eb2('0x49')](_0x6eb2('0x4a'),_0x23711b);})[_0x6eb2('0x3c')](function(_0x468649){ut['logger'](_0x6eb2('0x4b'),_0x468649);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x6eb2('0x2a')]['updateStatus']=function(_0x419358,_0xe219a5,_0x2f0442){var _0x3ccf8c=this;var _0x4e19dc={};if(_0xe219a5){_0x4e19dc={'read':_0xe219a5};}else{_0x4e19dc={'failMessage':_0x2f0442};}if(this[_0x6eb2('0xf')][_0x419358][_0x6eb2('0x45')]){faxMessage['update'](this['actions'][_0x419358]['AttachmentId'],_0x4e19dc)[_0x6eb2('0x48')](function(_0x58b273){ut['logger'](_0x6eb2('0x4c'),_0x58b273);})[_0x6eb2('0x3c')](function(_0x1718ba){ut['logger']('[Fax][Message][NoUpdate1]',_0x1718ba);})[_0x6eb2('0x4d')](function(){delete _0x3ccf8c['channels'][_0x419358];delete _0x3ccf8c[_0x6eb2('0xf')][_0x419358];});}else{ut[_0x6eb2('0x49')](_0x6eb2('0x4e'));delete this['channels'][_0x419358];delete this['actions'][_0x419358];}};Fax[_0x6eb2('0x2a')][_0x6eb2('0x1a')]=function(_0x1e69b6){var _0x290827=this;if(this[_0x6eb2('0x20')][_0x1e69b6['uniqueid']]){if(this['actions'][_0x1e69b6[_0x6eb2('0x21')]]){this[_0x6eb2('0x20')][_0x1e69b6[_0x6eb2('0x21')]]['id']=this[_0x6eb2('0xf')][_0x1e69b6[_0x6eb2('0x21')]]['id'];this[_0x6eb2('0x20')][_0x1e69b6[_0x6eb2('0x21')]]['name']=this[_0x6eb2('0xf')][_0x1e69b6[_0x6eb2('0x21')]][_0x6eb2('0x23')];}logger[_0x6eb2('0x24')](_0x1e69b6[_0x6eb2('0x21')],this[_0x6eb2('0xf')][_0x1e69b6[_0x6eb2('0x21')]]?_0x6eb2('0x4f'):_0x6eb2('0x50'),JSON[_0x6eb2('0x3f')](this[_0x6eb2('0x20')][_0x1e69b6['uniqueid']]));if(this[_0x6eb2('0xf')][_0x1e69b6[_0x6eb2('0x21')]]){if(this['channels'][_0x1e69b6[_0x6eb2('0x21')]]['faxpages']>0x0&&this[_0x6eb2('0x20')][_0x1e69b6[_0x6eb2('0x21')]][_0x6eb2('0x18')]==='SUCCESS'){this['updateStatus'](_0x1e69b6[_0x6eb2('0x21')],!![]);}else{this['updateStatus'](_0x1e69b6['uniqueid'],![],this[_0x6eb2('0x20')][_0x1e69b6['uniqueid']]['faxstatusstring']?_0x6eb2('0x51')+this['channels'][_0x1e69b6['uniqueid']][_0x6eb2('0x52')]:'SENDING\x20FAILED');}}}};Fax[_0x6eb2('0x2a')][_0x6eb2('0x53')]=function(_0x522bd3){var _0x48e37d=this;return new BPromise(function(_0x39ecd4,_0x361a4f){_0x48e37d[_0x6eb2('0x54')](_0x522bd3,_0x48e37d['faxAccounts'][_0x522bd3[_0x6eb2('0x55')]])[_0x6eb2('0x48')](function(_0x49ae4b){ut[_0x6eb2('0x49')](_0x6eb2('0x56'),_0x49ae4b);_0x39ecd4(ut[_0x6eb2('0x37')]('Fax\x20received'));})['catch'](function(_0xfd152a){ut[_0x6eb2('0x49')](_0x6eb2('0x57'),_0xfd152a);updateStatus(_0x522bd3);_0x361a4f(ut[_0x6eb2('0x37')](_0x6eb2('0x58')));});});};Fax[_0x6eb2('0x2a')][_0x6eb2('0x59')]=function(_0x428dcb){var _0x1e1bba=this;return new BPromise(function(_0x1c8dd3,_0x1c48ad){var _0x31712d=_0x1e1bba[_0x6eb2('0x5a')](_0x1e1bba[_0x6eb2('0xd')][_0x428dcb['FaxAccountId']][_0x6eb2('0x5b')],_0x428dcb);if(_0x31712d[_0x6eb2('0x5c')]){_0x1c8dd3(ut[_0x6eb2('0x37')](_0x6eb2('0x5d')));}else{_0x1c48ad(ut[_0x6eb2('0x37')](_0x31712d[_0x6eb2('0x37')]));}});};function originate(_0x27e367,_0xd2b51b,_0xbd1a34){return new BPromise(function(_0x4b7c57,_0x2a9bde){if(_0xbd1a34){var _0x3d14df=util[_0x6eb2('0x5e')](_0x6eb2('0x5f'),path[_0x6eb2('0x39')](_0x27e367[_0x6eb2('0x3')])[_0x6eb2('0x23')],_0x27e367['path']);gs[_0x6eb2('0x60')](_0x3d14df)[_0x6eb2('0x48')](function(){_0x27e367[_0x6eb2('0x3')]=util['format'](_0x6eb2('0x61'),path[_0x6eb2('0x39')](_0x27e367[_0x6eb2('0x3')])[_0x6eb2('0x62')],path['parse'](_0x27e367[_0x6eb2('0x3')])[_0x6eb2('0x23')]);_0xd2b51b[_0x6eb2('0x63')]=_0x27e367['path'];ut[_0x6eb2('0x49')](_0x6eb2('0x64'),'');ami[_0x6eb2('0x65')](ut[_0x6eb2('0x66')](_0x27e367,_0xd2b51b))['then'](function(_0x42bee9){_0x4b7c57(_0x42bee9);})['catch'](function(_0x5868c6){_0x2a9bde(_0x5868c6);});})[_0x6eb2('0x3c')](function(_0x2520a8){_0x2a9bde(_0x2520a8);});}else{ami[_0x6eb2('0x65')](ut[_0x6eb2('0x66')](_0x27e367,_0xd2b51b))[_0x6eb2('0x48')](function(_0x2729ce){_0x4b7c57(_0x2729ce);})[_0x6eb2('0x3c')](function(_0x141718){_0x2a9bde(_0x141718);});}});}Fax[_0x6eb2('0x2a')][_0x6eb2('0x54')]=function(_0x40ca5e,_0x5ee325){var _0x592e3d=this;return new BPromise(function(_0x50f565,_0x82f8b){var _0x151d79=uuid['v4']();var _0x30b3cd=ut['addVariables'](_0x40ca5e,_0x5ee325);_0x592e3d['actions'][_0x151d79]=new Action(_0x151d79,_0x5ee325,_0x40ca5e);var _0x3e0f66=_0x592e3d['actions'][_0x151d79];if(path['parse'](_0x40ca5e[_0x6eb2('0x3')])[_0x6eb2('0x67')]===_0x6eb2('0x68')){originate(_0x3e0f66,_0x30b3cd,!![])[_0x6eb2('0x48')](function(_0x51239f){_0x50f565(_0x51239f);})[_0x6eb2('0x3c')](function(_0x2b8bb9){_0x82f8b(_0x2b8bb9);});}else{originate(_0x3e0f66,_0x30b3cd,![])[_0x6eb2('0x48')](function(_0x1563c3){_0x50f565(_0x1563c3);})[_0x6eb2('0x3c')](function(_0x3327cc){_0x82f8b(_0x3327cc);});}});};Fax[_0x6eb2('0x2a')]['isTrunkReachable']=function(_0x2710f2){return!_['isNil'](_0x2710f2)&&!_[_0x6eb2('0x69')](_0x2710f2['name'])&&!_[_0x6eb2('0x69')](_0x2710f2['active'])&&_0x2710f2[_0x6eb2('0x6a')]&&!_['isNil'](this['trunks'][util['format'](_0x6eb2('0x6b'),_0x2710f2[_0x6eb2('0x23')])])&&!_[_0x6eb2('0x69')](this['trunks'][util[_0x6eb2('0x5e')](_0x6eb2('0x6b'),_0x2710f2[_0x6eb2('0x23')])][_0x6eb2('0x2d')])&&(this[_0x6eb2('0xe')][util[_0x6eb2('0x5e')](_0x6eb2('0x6b'),_0x2710f2['name'])][_0x6eb2('0x2d')]===_0x6eb2('0x6c')||this[_0x6eb2('0xe')][util[_0x6eb2('0x5e')](_0x6eb2('0x6b'),_0x2710f2[_0x6eb2('0x23')])][_0x6eb2('0x2d')]===_0x6eb2('0x6d'));};Fax['prototype']['checkTrunk']=function(_0x9a10af,_0xe8f9ab){if(!this[_0x6eb2('0x6e')](_0x9a10af)){ut['logger']('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x6eb2('0x69')](_0x9a10af)?'':_0x9a10af[_0x6eb2('0x23')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x6eb2('0x6f')};}if(_[_0x6eb2('0x69')](_0xe8f9ab[_0x6eb2('0x6')])){ut[_0x6eb2('0x49')](_0x6eb2('0x70'),JSON[_0x6eb2('0x3f')](_0xe8f9ab));return{'isValid':![],'message':_0x6eb2('0x71')};}if(_[_0x6eb2('0x69')](_0xe8f9ab[_0x6eb2('0x3')])){ut[_0x6eb2('0x49')](_0x6eb2('0x72'),JSON[_0x6eb2('0x3f')](_0xe8f9ab));return{'isValid':![],'message':_0x6eb2('0x73')};}return{'isValid':!![],'message':_0x6eb2('0x74')};};module['exports']=Fax;
\ No newline at end of file
index 7b08a02..57f2936 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x07fb=['[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x07fb,0x1e1));var _0xb07f=function(_0x3c9010,_0x970251){_0x3c9010=_0x3c9010-0x0;var _0x373e8a=_0x07fb[_0x3c9010];return _0x373e8a;};'use strict';var util=require(_0xb07f('0x0'));var BPromise=require(_0xb07f('0x1'));var logger=require(_0xb07f('0x2'))(_0xb07f('0x3'));var _=require(_0xb07f('0x4'));var faxAccount=require(_0xb07f('0x5'));function loggerCatch(_0x48c969){return function(_0x93339a){logger[_0xb07f('0x6')](_0x48c969,util[_0xb07f('0x7')](_0x93339a,{'showHidden':![],'depth':null}));};}exports[_0xb07f('0x8')]=function(_0x57e98a,_0x3db036){return BPromise[_0xb07f('0x9')]()[_0xb07f('0xa')](faxAccount[_0xb07f('0x8')](_0x57e98a,_0x3db036))['catch'](loggerCatch(_0xb07f('0xb')));};
\ No newline at end of file
+var _0x5f45=['preview','lodash','error','notify','[Notify]\x20','util','bluebird'];(function(_0x6a419d,_0x5de8f4){var _0x3536ef=function(_0x41154f){while(--_0x41154f){_0x6a419d['push'](_0x6a419d['shift']());}};_0x3536ef(++_0x5de8f4);}(_0x5f45,0xe5));var _0x55f4=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x5f45[_0xd09668];return _0x68726;};'use strict';var util=require(_0x55f4('0x0'));var BPromise=require(_0x55f4('0x1'));var logger=require('../../../config/logger')(_0x55f4('0x2'));var _=require(_0x55f4('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x6872db){return function(_0x4cc440){logger[_0x55f4('0x4')](_0x6872db,util['inspect'](_0x4cc440,{'showHidden':![],'depth':null}));};}exports[_0x55f4('0x5')]=function(_0x417a07,_0x3ba71b){return BPromise['resolve']()['then'](faxAccount[_0x55f4('0x5')](_0x417a07,_0x3ba71b))['catch'](loggerCatch(_0x55f4('0x6')));};
\ No newline at end of file
index 519d4f2..1a06821 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfcd3=['fax','exec','execute','info','Exec\x20gs','\x20Error\x20:','../../../../config/logger'];(function(_0x5a06ca,_0x42aab7){var _0x296e90=function(_0x80a0e9){while(--_0x80a0e9){_0x5a06ca['push'](_0x5a06ca['shift']());}};_0x296e90(++_0x42aab7);}(_0xfcd3,0x11e));var _0x3fcd=function(_0x506d83,_0x1899e9){_0x506d83=_0x506d83-0x0;var _0x335e8b=_0xfcd3[_0x506d83];return _0x335e8b;};'use strict';var util=require('util');var logger=require(_0x3fcd('0x0'))(_0x3fcd('0x1'));var BPromise=require('bluebird');var exec=require('child_process')[_0x3fcd('0x2')];exports[_0x3fcd('0x3')]=function(_0x1dd459){return new BPromise(function(_0x526178,_0x4c4d12){exec(_0x1dd459,function(_0x5f0744,_0x460d27,_0x3c8b8e){logger[_0x3fcd('0x4')]('Exec\x20gs',_0x460d27);if(_0x5f0744){logger[_0x3fcd('0x4')](_0x3fcd('0x5'),_0x3fcd('0x6'),util['inspect'](_0x5f0744,{'showHidden':![],'depth':null}),_0x460d27,_0x3c8b8e);_0x4c4d12(_0x5f0744);}_0x526178(_0x460d27);});});};
\ No newline at end of file
+var _0xe3f4=['execute','Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger','fax','bluebird','child_process','exec'];(function(_0x584291,_0x24b5b3){var _0x4e7d08=function(_0x59e0b1){while(--_0x59e0b1){_0x584291['push'](_0x584291['shift']());}};_0x4e7d08(++_0x24b5b3);}(_0xe3f4,0x1cf));var _0x4e3f=function(_0x32695d,_0x3dbe2d){_0x32695d=_0x32695d-0x0;var _0x2b9b60=_0xe3f4[_0x32695d];return _0x2b9b60;};'use strict';var util=require('util');var logger=require(_0x4e3f('0x0'))(_0x4e3f('0x1'));var BPromise=require(_0x4e3f('0x2'));var exec=require(_0x4e3f('0x3'))[_0x4e3f('0x4')];exports[_0x4e3f('0x5')]=function(_0x44b52f){return new BPromise(function(_0x36729a,_0x2bc483){exec(_0x44b52f,function(_0x34ed5e,_0x195ee3,_0x4d9afd){logger['info'](_0x4e3f('0x6'),_0x195ee3);if(_0x34ed5e){logger['info']('Exec\x20gs',_0x4e3f('0x7'),util[_0x4e3f('0x8')](_0x34ed5e,{'showHidden':![],'depth':null}),_0x195ee3,_0x4d9afd);_0x2bc483(_0x34ed5e);}_0x36729a(_0x195ee3);});});};
\ No newline at end of file
index f83e28a..e3989b4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xddd3=['ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','gateway','t38timeout','localstationid','path','variablesAction','uniqueid','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','message','logger','addVariables'];(function(_0x5c7e53,_0x174ce5){var _0x1c9af9=function(_0x38895d){while(--_0x38895d){_0x5c7e53['push'](_0x5c7e53['shift']());}};_0x1c9af9(++_0x174ce5);}(_0xddd3,0x100));var _0x3ddd=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xddd3[_0x4bfac3];return _0x15f0f2;};'use strict';var util=require(_0x3ddd('0x0'));var _=require(_0x3ddd('0x1'));var moment=require(_0x3ddd('0x2'));var logger=require(_0x3ddd('0x3'))(_0x3ddd('0x4'));exports[_0x3ddd('0x5')]=function(_0x49c6c0){return{'message':_0x49c6c0};};exports[_0x3ddd('0x6')]=function(_0x3fba6b,_0x2965e6){logger['info'](_0x3fba6b,util['inspect'](_0x2965e6,{'showHidden':![],'depth':null}));};exports[_0x3ddd('0x7')]=function(_0x3a441a,_0x337ebf){var _0x5ae37b={'XMF-ECM':_0x337ebf[_0x3ddd('0x8')],'XMF-HEADERINFO':_0x337ebf[_0x3ddd('0x9')],'XMF-MINRATE':_0x337ebf[_0x3ddd('0xa')],'XMF-MAXRATE':_0x337ebf[_0x3ddd('0xb')],'XMF-MODEM':util[_0x3ddd('0xc')](_0x3ddd('0xd'),_0x337ebf['modem']),'XMF-GATEWAY':_0x337ebf[_0x3ddd('0xe')],'XMF-FAXDETECT':_0x337ebf['faxdetect'],'XMF-T38TIMEOUT':_0x337ebf[_0x3ddd('0xf')],'XMF-LOCALSTATIONID':_0x337ebf[_0x3ddd('0x10')],'XMF-PATH':_0x3a441a[_0x3ddd('0x11')]};return _0x5ae37b;};exports[_0x3ddd('0x12')]=function(_0x24fd10,_0x32ad9d){return{'actionid':_0x24fd10[_0x3ddd('0x13')],'action':'originate','channel':_0x24fd10['channel'],'Exten':'xcally-motion-fax','Context':_0x3ddd('0x14'),'Priority':'1','callerid':util['format'](_0x3ddd('0x15'),_0x24fd10[_0x3ddd('0x9')]?_0x24fd10[_0x3ddd('0x9')]:'',_0x24fd10['localstationid']),'variable':_0x32ad9d,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x24fd10['uniqueid']};};
\ No newline at end of file
+var _0xd24e=['format','gateway','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','channel','xcally-motion-fax','from-sip','headerinfo','util','lodash','moment','../../../../config/logger','fax','message','info','inspect','addVariables','ecm','minrate','maxrate'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0xd24e,0x17b));var _0xed24=function(_0x2fe6b5,_0x5dc291){_0x2fe6b5=_0x2fe6b5-0x0;var _0x5b024d=_0xd24e[_0x2fe6b5];return _0x5b024d;};'use strict';var util=require(_0xed24('0x0'));var _=require(_0xed24('0x1'));var moment=require(_0xed24('0x2'));var logger=require(_0xed24('0x3'))(_0xed24('0x4'));exports[_0xed24('0x5')]=function(_0xed122d){return{'message':_0xed122d};};exports['logger']=function(_0x2e213b,_0x4351de){logger[_0xed24('0x6')](_0x2e213b,util[_0xed24('0x7')](_0x4351de,{'showHidden':![],'depth':null}));};exports[_0xed24('0x8')]=function(_0x171f67,_0x4e51b8){var _0x50325e={'XMF-ECM':_0x4e51b8[_0xed24('0x9')],'XMF-HEADERINFO':_0x4e51b8['headerinfo'],'XMF-MINRATE':_0x4e51b8[_0xed24('0xa')],'XMF-MAXRATE':_0x4e51b8[_0xed24('0xb')],'XMF-MODEM':util[_0xed24('0xc')]('\x22%s\x22',_0x4e51b8['modem']),'XMF-GATEWAY':_0x4e51b8[_0xed24('0xd')],'XMF-FAXDETECT':_0x4e51b8[_0xed24('0xe')],'XMF-T38TIMEOUT':_0x4e51b8[_0xed24('0xf')],'XMF-LOCALSTATIONID':_0x4e51b8[_0xed24('0x10')],'XMF-PATH':_0x171f67['path']};return _0x50325e;};exports[_0xed24('0x11')]=function(_0x2f57ba,_0x1938db){return{'actionid':_0x2f57ba[_0xed24('0x12')],'action':'originate','channel':_0x2f57ba[_0xed24('0x13')],'Exten':_0xed24('0x14'),'Context':_0xed24('0x15'),'Priority':'1','callerid':util[_0xed24('0xc')]('\x22%s\x22\x20<%s>',_0x2f57ba[_0xed24('0x16')]?_0x2f57ba[_0xed24('0x16')]:'',_0x2f57ba[_0xed24('0x10')]),'variable':_0x1938db,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2f57ba[_0xed24('0x12')]};};
\ No newline at end of file
index f273677..06cae50 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6df1=['get','hour','then','initAgents','getTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','resolve','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','log','listen','bluebird','util','moment','./server','./report','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365'];(function(_0x541a67,_0x50728d){var _0x45da2a=function(_0x158929){while(--_0x158929){_0x541a67['push'](_0x541a67['shift']());}};_0x45da2a(++_0x50728d);}(_0x6df1,0xe0));var _0x16df=function(_0x332684,_0x4c5b5b){_0x332684=_0x332684-0x0;var _0x42c520=_0x6df1[_0x332684];return _0x42c520;};'use strict';var BPromise=require(_0x16df('0x0'));var util=require(_0x16df('0x1'));var moment=require(_0x16df('0x2'));var server=require(_0x16df('0x3'));var Realtime=require('./realtime');var Report=require(_0x16df('0x4'));var Acw=require(_0x16df('0x5'));var Trigger=require(_0x16df('0x6'));var Dialer=require('./dialer');var Preview=require(_0x16df('0x7'));var Fax=require(_0x16df('0x8'));var user=require(_0x16df('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x16df('0xa'));var voiceCallReport=require(_0x16df('0xb'));var trunk=require(_0x16df('0xc'));var trigger=require(_0x16df('0xd'));var template=require(_0x16df('0xe'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x16df('0xf'));var voiceExtension=require(_0x16df('0x10'));var faxAccount=require(_0x16df('0x11'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x16df('0x12'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x16df('0x13'));var zoho=require(_0x16df('0x14'));var vtiger=require(_0x16df('0x15'));var servicenow=require(_0x16df('0x16'));var dynamics365=require(_0x16df('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 isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x16df('0x18')](_0x16df('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x16df('0x18')](_0x16df('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x16df('0x1a')](user['getAgents']())[_0x16df('0x1a')](realtime[_0x16df('0x1b')]())['then'](user[_0x16df('0x1c')]())[_0x16df('0x1a')](realtime['initTelephones']())[_0x16df('0x1a')](trunk[_0x16df('0x1d')]())[_0x16df('0x1a')](realtime[_0x16df('0x1e')]())[_0x16df('0x1a')](voiceQueue[_0x16df('0x1f')]())[_0x16df('0x1a')](realtime[_0x16df('0x20')]())[_0x16df('0x1a')](trigger[_0x16df('0x21')]())[_0x16df('0x1a')](realtime['initTriggers']())['then'](template[_0x16df('0x22')]())['then'](realtime[_0x16df('0x23')]())[_0x16df('0x1a')](zendesk[_0x16df('0x24')]())[_0x16df('0x1a')](realtime['initZendeskAccounts']())['then'](salesforce[_0x16df('0x25')]())[_0x16df('0x1a')](realtime[_0x16df('0x26')]())[_0x16df('0x1a')](sugarcrm['getSugarcrmAccounts']())['then'](realtime[_0x16df('0x27')]())[_0x16df('0x1a')](freshdesk[_0x16df('0x28')]())['then'](realtime[_0x16df('0x29')]())['then'](desk['getDeskAccounts']())[_0x16df('0x1a')](realtime[_0x16df('0x2a')]())[_0x16df('0x1a')](zoho[_0x16df('0x2b')]())[_0x16df('0x1a')](realtime['initZohoAccounts']())[_0x16df('0x1a')](vtiger[_0x16df('0x2c')]())[_0x16df('0x1a')](realtime[_0x16df('0x2d')]())[_0x16df('0x1a')](servicenow[_0x16df('0x2e')]())[_0x16df('0x1a')](realtime[_0x16df('0x2f')]())[_0x16df('0x1a')](dynamics365[_0x16df('0x30')]())[_0x16df('0x1a')](realtime[_0x16df('0x31')]())[_0x16df('0x1a')](campaign[_0x16df('0x32')]())[_0x16df('0x1a')](realtime[_0x16df('0x33')]())['then'](voiceExtension[_0x16df('0x34')]())['then'](realtime['initVoiceExtensions']())[_0x16df('0x1a')](faxAccount['getFaxAccounts']())[_0x16df('0x1a')](realtime['initFaxAccounts']())[_0x16df('0x1a')](function(){return realtime;});}function initParams(){return BPromise[_0x16df('0x35')]()[_0x16df('0x1a')](voiceQueueReport[_0x16df('0x36')]())[_0x16df('0x1a')](realtime[_0x16df('0x37')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime[_0x16df('0x38')]())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0x16df('0x1a')](realtime[_0x16df('0x39')]())[_0x16df('0x1a')](voiceCallReport['getVoiceCallReports']())[_0x16df('0x1a')](realtime[_0x16df('0x3a')]())[_0x16df('0x1a')](function(_0x3570e6){})[_0x16df('0x3b')](function(_0x7695a2){console[_0x16df('0x3c')](_0x7695a2);});}function main(){return server[_0x16df('0x3d')](realtime,preview,fax)['then'](function(_0x31b003){return initRealtime();})[_0x16df('0x1a')](function(){return initParams();})[_0x16df('0x1a')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x16df('0x3b')](function(_0x3eafbf){console['log'](_0x3eafbf);});}main();
\ No newline at end of file
+var _0x392f=['initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','log','sync','bluebird','util','./server','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/dynamics365','get','hour','resolve','getAgents','then','initAgents','initTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts'];(function(_0x4ca9e5,_0x1fdbc1){var _0x497594=function(_0xb259d3){while(--_0xb259d3){_0x4ca9e5['push'](_0x4ca9e5['shift']());}};_0x497594(++_0x1fdbc1);}(_0x392f,0x100));var _0xf392=function(_0x2980de,_0x1426a4){_0x2980de=_0x2980de-0x0;var _0x81a4ca=_0x392f[_0x2980de];return _0x81a4ca;};'use strict';var BPromise=require(_0xf392('0x0'));var util=require(_0xf392('0x1'));var moment=require('moment');var server=require(_0xf392('0x2'));var Realtime=require('./realtime');var Report=require(_0xf392('0x3'));var Acw=require(_0xf392('0x4'));var Trigger=require(_0xf392('0x5'));var Dialer=require(_0xf392('0x6'));var Preview=require(_0xf392('0x7'));var Fax=require(_0xf392('0x8'));var user=require(_0xf392('0x9'));var voiceQueue=require(_0xf392('0xa'));var voiceQueueReport=require(_0xf392('0xb'));var voiceCallReport=require(_0xf392('0xc'));var trunk=require(_0xf392('0xd'));var trigger=require(_0xf392('0xe'));var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xf392('0xf'));var voiceExtension=require(_0xf392('0x10'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xf392('0x11'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xf392('0x12'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xf392('0x13'));var zoho=require(_0xf392('0x14'));var vtiger=require(_0xf392('0x15'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0xf392('0x16'));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 isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xf392('0x17')](_0xf392('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xf392('0x17')](_0xf392('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xf392('0x19')]()['then'](user[_0xf392('0x1a')]())[_0xf392('0x1b')](realtime[_0xf392('0x1c')]())[_0xf392('0x1b')](user['getTelephones']())[_0xf392('0x1b')](realtime['initTelephones']())[_0xf392('0x1b')](trunk['getTrunks']())[_0xf392('0x1b')](realtime[_0xf392('0x1d')]())[_0xf392('0x1b')](voiceQueue['getVoiceQueues']())[_0xf392('0x1b')](realtime[_0xf392('0x1e')]())[_0xf392('0x1b')](trigger[_0xf392('0x1f')]())[_0xf392('0x1b')](realtime[_0xf392('0x20')]())[_0xf392('0x1b')](template[_0xf392('0x21')]())['then'](realtime[_0xf392('0x22')]())[_0xf392('0x1b')](zendesk['getZendeskAccounts']())[_0xf392('0x1b')](realtime['initZendeskAccounts']())[_0xf392('0x1b')](salesforce[_0xf392('0x23')]())[_0xf392('0x1b')](realtime[_0xf392('0x24')]())[_0xf392('0x1b')](sugarcrm[_0xf392('0x25')]())[_0xf392('0x1b')](realtime[_0xf392('0x26')]())[_0xf392('0x1b')](freshdesk['getFreshdeskAccounts']())[_0xf392('0x1b')](realtime[_0xf392('0x27')]())[_0xf392('0x1b')](desk[_0xf392('0x28')]())[_0xf392('0x1b')](realtime[_0xf392('0x29')]())['then'](zoho['getZohoAccounts']())[_0xf392('0x1b')](realtime[_0xf392('0x2a')]())[_0xf392('0x1b')](vtiger[_0xf392('0x2b')]())[_0xf392('0x1b')](realtime['initVtigerAccounts']())[_0xf392('0x1b')](servicenow['getServicenowAccounts']())[_0xf392('0x1b')](realtime[_0xf392('0x2c')]())['then'](dynamics365['getDynamics365Accounts']())[_0xf392('0x1b')](realtime[_0xf392('0x2d')]())[_0xf392('0x1b')](campaign['getCampaigns']())[_0xf392('0x1b')](realtime[_0xf392('0x2e')]())['then'](voiceExtension[_0xf392('0x2f')]())[_0xf392('0x1b')](realtime[_0xf392('0x30')]())[_0xf392('0x1b')](faxAccount[_0xf392('0x31')]())['then'](realtime[_0xf392('0x32')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0xf392('0x19')]()['then'](voiceQueueReport['getVoiceQueueReports']())[_0xf392('0x1b')](realtime[_0xf392('0x33')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xf392('0x1b')](realtime[_0xf392('0x34')]())['then'](cmHopperHistory[_0xf392('0x35')]())['then'](realtime[_0xf392('0x36')]())[_0xf392('0x1b')](voiceCallReport[_0xf392('0x37')]())['then'](realtime['initVoiceCallReports']())[_0xf392('0x1b')](function(_0x2bad6d){})[_0xf392('0x38')](function(_0x38381c){console[_0xf392('0x39')](_0x38381c);});}function main(){return server['listen'](realtime,preview,fax)[_0xf392('0x1b')](function(_0x5c69b3){return initRealtime();})['then'](function(){return initParams();})[_0xf392('0x1b')](function(){report[_0xf392('0x3a')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x4d46d8){console[_0xf392('0x39')](_0x4d46d8);});}main();
\ No newline at end of file
index c9a69d0..0d8f28d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x526d=['exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','address','phone','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','voiceStatus','statePause','toNumber','format','status','onhold','stringify','user:%s','emit','user:save'];(function(_0xc315de,_0x5dc877){var _0x11a627=function(_0x4039d6){while(--_0x4039d6){_0xc315de['push'](_0xc315de['shift']());}};_0x11a627(++_0x5dc877);}(_0x526d,0xce));var _0xd526=function(_0x4b491b,_0x51c152){_0x4b491b=_0x4b491b-0x0;var _0x2cc3fb=_0x526d[_0x4b491b];return _0x2cc3fb;};'use strict';var _=require(_0xd526('0x0'));var util=require('util');var moment=require('moment');var md5=require(_0xd526('0x1'));var Redis=require(_0xd526('0x2'));var config=require(_0xd526('0x3'));config[_0xd526('0x4')]=_[_0xd526('0x5')](config['redis'],{'host':_0xd526('0x6'),'port':0x18eb});var io=require(_0xd526('0x7'))(new Redis(config[_0xd526('0x4')]));function Agent(_0x303460){this['id']=_0x303460['id']||0x0;this[_0xd526('0x8')]=_0x303460[_0xd526('0x8')]||'';this[_0xd526('0x9')]=_0x303460[_0xd526('0x9')]||'';this[_0xd526('0xa')]=_0x303460['accountcode']||'';this[_0xd526('0xb')]=_0x303460[_0xd526('0xb')]||'';this[_0xd526('0xc')]=_0xd526('0xd');this[_0xd526('0xe')]=0x0;this['status']='unknown';this[_0xd526('0xf')]='';this[_0xd526('0x10')]='';this['mobile']='';this[_0xd526('0x11')]='';this[_0xd526('0x12')]=_0x303460['online']||![];this['voiceStatus']=_0xd526('0xd');this[_0xd526('0x13')]=0x0;this[_0xd526('0x14')]='';this[_0xd526('0x15')]='';this['onhold']=![];this[_0xd526('0x16')]=![];this[_0xd526('0x1')]='';}Agent[_0xd526('0x17')][_0xd526('0x18')]=function(_0x3f92a8){var _0x42f200;if(_0x3f92a8&&_0x3f92a8[_0xd526('0xc')]){_0x42f200=_0x3f92a8['state'][_0xd526('0x19')]();switch(_0x42f200){case _0xd526('0x1a'):_0x42f200=_0xd526('0x1b');break;case _0xd526('0x1c'):_0x42f200=_0xd526('0x1d');break;}}if(_0x42f200&&this[_0xd526('0x1e')]!==_0x42f200||_0x3f92a8[_0xd526('0x1f')]){this[_0xd526('0x13')]=_[_0xd526('0x20')](moment()[_0xd526('0x21')]('x'));}if(_0x42f200){this[_0xd526('0x1e')]=_0x42f200;}var _0x1c1284={'id':this['id'],'name':this[_0xd526('0x8')],'email':this['email'],'accountcode':this[_0xd526('0xa')],'fullname':this[_0xd526('0xb')],'state':this[_0xd526('0xc')],'stateTime':this[_0xd526('0xe')],'status':this[_0xd526('0x22')],'address':this[_0xd526('0xf')],'online':this['online'],'voiceStatus':this[_0xd526('0x1e')],'voiceStatusTime':this[_0xd526('0x13')],'voiceStatusCallerIdNumber':this[_0xd526('0x14')],'voiceStatusQueue':this[_0xd526('0x15')],'interface':this[_0xd526('0x11')],'onhold':this[_0xd526('0x23')]};var _0x5c9a58=md5(JSON[_0xd526('0x24')](_0x1c1284));if(this[_0xd526('0x1')]!==_0x5c9a58){this[_0xd526('0x1')]=_0x5c9a58;io['to'](util[_0xd526('0x21')](_0xd526('0x25'),_0x1c1284['name']))[_0xd526('0x26')](_0xd526('0x27'),_0x1c1284);}};module[_0xd526('0x28')]=Agent;
\ No newline at end of file
+var _0x898a=['prototype','updateStatusRealtime','toLowerCase','inuse','talking','format','voiceStatus','status','address','stringify','user:%s','emit','user:save','exports','lodash','util','moment','ioredis','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','phone','mobile','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','md5'];(function(_0x1288d5,_0x37e407){var _0xf9a949=function(_0x40a710){while(--_0x40a710){_0x1288d5['push'](_0x1288d5['shift']());}};_0xf9a949(++_0x37e407);}(_0x898a,0x1b0));var _0xa898=function(_0x4d6bc1,_0x16f13a){_0x4d6bc1=_0x4d6bc1-0x0;var _0x458816=_0x898a[_0x4d6bc1];return _0x458816;};'use strict';var _=require(_0xa898('0x0'));var util=require(_0xa898('0x1'));var moment=require(_0xa898('0x2'));var md5=require('md5');var Redis=require(_0xa898('0x3'));var config=require('../../../config/environment');config[_0xa898('0x4')]=_[_0xa898('0x5')](config[_0xa898('0x4')],{'host':_0xa898('0x6'),'port':0x18eb});var io=require(_0xa898('0x7'))(new Redis(config[_0xa898('0x4')]));function Agent(_0x5b4206){this['id']=_0x5b4206['id']||0x0;this[_0xa898('0x8')]=_0x5b4206['name']||'';this['email']=_0x5b4206[_0xa898('0x9')]||'';this['accountcode']=_0x5b4206[_0xa898('0xa')]||'';this['fullname']=_0x5b4206[_0xa898('0xb')]||'';this[_0xa898('0xc')]=_0xa898('0xd');this[_0xa898('0xe')]=0x0;this['status']='unknown';this['address']='';this[_0xa898('0xf')]='';this[_0xa898('0x10')]='';this[_0xa898('0x11')]='';this[_0xa898('0x12')]=_0x5b4206[_0xa898('0x12')]||![];this['voiceStatus']=_0xa898('0xd');this[_0xa898('0x13')]=0x0;this[_0xa898('0x14')]='';this['voiceStatusQueue']='';this[_0xa898('0x15')]=![];this[_0xa898('0x16')]=![];this[_0xa898('0x17')]='';}Agent[_0xa898('0x18')][_0xa898('0x19')]=function(_0x39bcf4){var _0x85cc92;if(_0x39bcf4&&_0x39bcf4[_0xa898('0xc')]){_0x85cc92=_0x39bcf4['state'][_0xa898('0x1a')]();switch(_0x85cc92){case'not_inuse':_0x85cc92='idle';break;case _0xa898('0x1b'):_0x85cc92=_0xa898('0x1c');break;}}if(_0x85cc92&&this['voiceStatus']!==_0x85cc92||_0x39bcf4['statePause']){this[_0xa898('0x13')]=_['toNumber'](moment()[_0xa898('0x1d')]('x'));}if(_0x85cc92){this[_0xa898('0x1e')]=_0x85cc92;}var _0x6b64b4={'id':this['id'],'name':this[_0xa898('0x8')],'email':this[_0xa898('0x9')],'accountcode':this[_0xa898('0xa')],'fullname':this[_0xa898('0xb')],'state':this['state'],'stateTime':this[_0xa898('0xe')],'status':this[_0xa898('0x1f')],'address':this[_0xa898('0x20')],'online':this['online'],'voiceStatus':this[_0xa898('0x1e')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0xa898('0x11')],'onhold':this['onhold']};var _0x399158=md5(JSON[_0xa898('0x21')](_0x6b64b4));if(this[_0xa898('0x17')]!==_0x399158){this[_0xa898('0x17')]=_0x399158;io['to'](util[_0xa898('0x1d')](_0xa898('0x22'),_0x6b64b4['name']))[_0xa898('0x23')](_0xa898('0x24'),_0x6b64b4);}};module[_0xa898('0x25')]=Agent;
\ No newline at end of file
index 78b643f..74037b1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9c02=['dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','temp','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x9c02,0x196));var _0x29c0=function(_0x548be4,_0x2342f8){_0x548be4=_0x548be4-0x0;var _0x59b6ed=_0x9c02[_0x548be4];return _0x59b6ed;};'use strict';function Campaign(_0x5c50f0){this['id']=_0x5c50f0['id']||0x0;this[_0x29c0('0x0')]=_0x5c50f0[_0x29c0('0x0')]||'';this['type']=_0x5c50f0['type']||'campaign';this['originated']=0x0;this[_0x29c0('0x1')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x29c0('0x2')]=0x0;this['message']='';this[_0x29c0('0x3')]=!![];this['active']=_0x5c50f0[_0x29c0('0x4')];this[_0x29c0('0x5')]=_0x5c50f0[_0x29c0('0x5')];this['dialTimezone']=_0x5c50f0['dialTimezone']||null;this[_0x29c0('0x6')]=_0x5c50f0[_0x29c0('0x6')]?_0x5c50f0[_0x29c0('0x6')]:null;this[_0x29c0('0x7')]=_0x5c50f0[_0x29c0('0x7')];this['dialOriginateCallerIdNumber']=_0x5c50f0['dialOriginateCallerIdNumber'];this[_0x29c0('0x8')]=_0x5c50f0['dialOriginateTimeout']||0x1e;this[_0x29c0('0x9')]=_0x5c50f0[_0x29c0('0x9')];this[_0x29c0('0xa')]=_0x5c50f0[_0x29c0('0xa')];this[_0x29c0('0xb')]=_0x5c50f0[_0x29c0('0xb')];this['dialBusyRetryFrequency']=_0x5c50f0[_0x29c0('0xc')];this[_0x29c0('0xd')]=_0x5c50f0[_0x29c0('0xd')];this[_0x29c0('0xe')]=_0x5c50f0[_0x29c0('0xe')];this[_0x29c0('0xf')]=_0x5c50f0[_0x29c0('0xf')];this[_0x29c0('0x10')]=_0x5c50f0[_0x29c0('0x10')]||_0x29c0('0x11');this[_0x29c0('0x12')]=_0x5c50f0[_0x29c0('0x12')]||undefined;this[_0x29c0('0x13')]=_0x5c50f0[_0x29c0('0x13')]||undefined;this[_0x29c0('0x14')]=_0x5c50f0[_0x29c0('0x14')]||undefined;this[_0x29c0('0x15')]=_0x5c50f0[_0x29c0('0x15')]?_0x5c50f0[_0x29c0('0x15')]:undefined;this[_0x29c0('0x16')]=_0x5c50f0[_0x29c0('0x16')]?_0x5c50f0[_0x29c0('0x16')]:undefined;this[_0x29c0('0x17')]=_0x5c50f0[_0x29c0('0x17')]?_0x5c50f0[_0x29c0('0x17')]:undefined;this[_0x29c0('0x18')]=_0x5c50f0[_0x29c0('0x18')]?_0x5c50f0['SquareProject']:undefined;this[_0x29c0('0x19')]=_0x5c50f0[_0x29c0('0x18')]?_0x5c50f0[_0x29c0('0x18')][_0x29c0('0x0')]:undefined;this[_0x29c0('0x1a')]=_0x5c50f0[_0x29c0('0x1a')]||![];this['dialAMDInitialSilence']=_0x5c50f0[_0x29c0('0x1b')];this[_0x29c0('0x1c')]=_0x5c50f0[_0x29c0('0x1c')];this[_0x29c0('0x1d')]=_0x5c50f0[_0x29c0('0x1d')];this['dialAMDTotalAnalysisTime']=_0x5c50f0[_0x29c0('0x1e')];this[_0x29c0('0x1f')]=_0x5c50f0['dialAMDMinWordLength'];this[_0x29c0('0x20')]=_0x5c50f0[_0x29c0('0x20')];this[_0x29c0('0x21')]=_0x5c50f0['dialAMDMaximumNumberOfWords'];this[_0x29c0('0x22')]=_0x5c50f0['dialAMDSilenceThreshold'];this[_0x29c0('0x23')]=_0x5c50f0[_0x29c0('0x23')];}module['exports']=Campaign;
\ No newline at end of file
+var _0x74f0=['dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','exports','name','type','campaign','originated','temp','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence'];(function(_0x25f56d,_0xf544b9){var _0x261e97=function(_0x33fe3d){while(--_0x33fe3d){_0x25f56d['push'](_0x25f56d['shift']());}};_0x261e97(++_0xf544b9);}(_0x74f0,0xf3));var _0x074f=function(_0x2d7a4b,_0xa36b04){_0x2d7a4b=_0x2d7a4b-0x0;var _0x603707=_0x74f0[_0x2d7a4b];return _0x603707;};'use strict';function Campaign(_0x86dcc6){this['id']=_0x86dcc6['id']||0x0;this[_0x074f('0x0')]=_0x86dcc6['name']||'';this['type']=_0x86dcc6[_0x074f('0x1')]||_0x074f('0x2');this[_0x074f('0x3')]=0x0;this[_0x074f('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this[_0x074f('0x5')]='';this[_0x074f('0x6')]=!![];this[_0x074f('0x7')]=_0x86dcc6[_0x074f('0x7')];this[_0x074f('0x8')]=_0x86dcc6[_0x074f('0x8')];this[_0x074f('0x9')]=_0x86dcc6['dialTimezone']||null;this[_0x074f('0xa')]=_0x86dcc6[_0x074f('0xa')]?_0x86dcc6['dialGlobalInterval']:null;this[_0x074f('0xb')]=_0x86dcc6[_0x074f('0xb')];this[_0x074f('0xc')]=_0x86dcc6[_0x074f('0xc')];this[_0x074f('0xd')]=_0x86dcc6['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x86dcc6[_0x074f('0xe')];this[_0x074f('0xf')]=_0x86dcc6[_0x074f('0xf')];this[_0x074f('0x10')]=_0x86dcc6[_0x074f('0x10')];this[_0x074f('0x11')]=_0x86dcc6[_0x074f('0x11')];this[_0x074f('0x12')]=_0x86dcc6[_0x074f('0x12')];this['dialNoAnswerRetryFrequency']=_0x86dcc6[_0x074f('0x13')];this['dialGlobalMaxRetry']=_0x86dcc6[_0x074f('0x14')];this[_0x074f('0x15')]=_0x86dcc6[_0x074f('0x15')]||_0x074f('0x16');this[_0x074f('0x17')]=_0x86dcc6[_0x074f('0x17')]||undefined;this[_0x074f('0x18')]=_0x86dcc6[_0x074f('0x18')]||undefined;this[_0x074f('0x19')]=_0x86dcc6[_0x074f('0x19')]||undefined;this[_0x074f('0x1a')]=_0x86dcc6['TrunkBackup']?_0x86dcc6[_0x074f('0x1a')]:undefined;this[_0x074f('0x1b')]=_0x86dcc6[_0x074f('0x1b')]?_0x86dcc6[_0x074f('0x1b')]:undefined;this[_0x074f('0x1c')]=_0x86dcc6[_0x074f('0x1c')]?_0x86dcc6['Interval']:undefined;this['SquareProject']=_0x86dcc6[_0x074f('0x1d')]?_0x86dcc6['SquareProject']:undefined;this['dialQueueProject']=_0x86dcc6[_0x074f('0x1d')]?_0x86dcc6[_0x074f('0x1d')][_0x074f('0x0')]:undefined;this[_0x074f('0x1e')]=_0x86dcc6[_0x074f('0x1e')]||![];this[_0x074f('0x1f')]=_0x86dcc6[_0x074f('0x1f')];this[_0x074f('0x20')]=_0x86dcc6[_0x074f('0x20')];this[_0x074f('0x21')]=_0x86dcc6[_0x074f('0x21')];this[_0x074f('0x22')]=_0x86dcc6[_0x074f('0x22')];this[_0x074f('0x23')]=_0x86dcc6[_0x074f('0x23')];this[_0x074f('0x24')]=_0x86dcc6[_0x074f('0x24')];this[_0x074f('0x25')]=_0x86dcc6[_0x074f('0x25')];this[_0x074f('0x26')]=_0x86dcc6['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x86dcc6['dialAMDMaximumWordLength'];}module[_0x074f('0x27')]=Campaign;
\ No newline at end of file
index 1d553ca..c5d2f96 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf61e=['connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answertime','endtime','abandoned','lastapplication','lastdata','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname'];(function(_0x199401,_0x3e0898){var _0x3f272a=function(_0x29ec35){while(--_0x29ec35){_0x199401['push'](_0x199401['shift']());}};_0x3f272a(++_0x3e0898);}(_0xf61e,0x191));var _0xef61=function(_0x18d2d0,_0x2c70cf){_0x18d2d0=_0x18d2d0-0x0;var _0x4361a4=_0xf61e[_0x18d2d0];return _0x4361a4;};'use strict';function Channel(){this[_0xef61('0x0')]=null;this[_0xef61('0x1')]='';this[_0xef61('0x2')]='';this[_0xef61('0x3')]=0x0;this[_0xef61('0x4')]='';this[_0xef61('0x5')]=undefined;this[_0xef61('0x6')]=undefined;this[_0xef61('0x7')]=0x0;this[_0xef61('0x8')]='';this[_0xef61('0x9')]=0x0;this[_0xef61('0xa')]=0x0;this[_0xef61('0xb')]=0x0;this['answered']=![];this[_0xef61('0xc')]=null;this[_0xef61('0xd')]=null;this['unmanaged']=![];this[_0xef61('0xe')]=![];this[_0xef61('0xf')]='';this[_0xef61('0x10')]='';this['duration']=0x0;this['billableseconds']=0x0;this[_0xef61('0x11')]=0x0;this[_0xef61('0x12')]=null;this[_0xef61('0x13')]=null;this[_0xef61('0x14')]=null;this[_0xef61('0x15')]=![];this[_0xef61('0x16')]=null;this[_0xef61('0x17')]=null;this[_0xef61('0x18')]=[];this[_0xef61('0x19')]=undefined;this[_0xef61('0x1a')]=undefined;this[_0xef61('0x1b')]=0x0;}module[_0xef61('0x1c')]=Channel;
\ No newline at end of file
+var _0xab9f=['tag','disposition','monitor','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','destinationchannel','calleridnum','calleridname','connectedlinename','accountcode','uniqueid','exten','answertime','endtime','unmanaged','abandoned','lastdata','duration','type'];(function(_0x15c172,_0xbb8fd8){var _0x2a0582=function(_0x5725fd){while(--_0x5725fd){_0x15c172['push'](_0x15c172['shift']());}};_0x2a0582(++_0xbb8fd8);}(_0xab9f,0x1bd));var _0xfab9=function(_0x3af4e5,_0x3009b0){_0x3af4e5=_0x3af4e5-0x0;var _0x31d2be=_0xab9f[_0x3af4e5];return _0x31d2be;};'use strict';function Channel(){this[_0xfab9('0x0')]=null;this['channel']='';this[_0xfab9('0x1')]='';this[_0xfab9('0x2')]=0x0;this[_0xfab9('0x3')]='';this['connectedlinenum']=undefined;this[_0xfab9('0x4')]=undefined;this[_0xfab9('0x5')]=0x0;this['context']='';this[_0xfab9('0x6')]=0x0;this['linkedid']=0x0;this[_0xfab9('0x7')]=0x0;this['answered']=![];this[_0xfab9('0x8')]=null;this[_0xfab9('0x9')]=null;this[_0xfab9('0xa')]=![];this[_0xfab9('0xb')]=![];this['lastapplication']='';this[_0xfab9('0xc')]='';this[_0xfab9('0xd')]=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this[_0xfab9('0xe')]=null;this[_0xfab9('0xf')]=null;this[_0xfab9('0x10')]=null;this[_0xfab9('0x11')]=![];this['monitorFilename']=null;this['queue']=null;this[_0xfab9('0x12')]=[];this[_0xfab9('0x13')]=undefined;this[_0xfab9('0x14')]=undefined;this[_0xfab9('0x15')]=0x0;}module[_0xfab9('0x16')]=Channel;
\ No newline at end of file
index 98adb3e..91d3730 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x13ff=['type','serverUrl','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token'];(function(_0x24094c,_0x3d87c8){var _0x43ac2f=function(_0x552335){while(--_0x552335){_0x24094c['push'](_0x24094c['shift']());}};_0x43ac2f(++_0x3d87c8);}(_0x13ff,0x16e));var _0xf13f=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x13ff[_0x4ae625];return _0x31accf;};'use strict';function DeskAccount(_0x10227c){this['id']=_0x10227c['id']||0x0;this[_0xf13f('0x0')]=_0x10227c[_0xf13f('0x0')]||'';this[_0xf13f('0x1')]=_0x10227c[_0xf13f('0x1')]||'';this[_0xf13f('0x2')]=_0x10227c[_0xf13f('0x2')]||'';this[_0xf13f('0x3')]=_0x10227c[_0xf13f('0x3')]||'';this[_0xf13f('0x4')]=_0x10227c[_0xf13f('0x4')]||'';this[_0xf13f('0x5')]=_0x10227c['consumerKey']||'';this[_0xf13f('0x6')]=_0x10227c[_0xf13f('0x6')]||'';this[_0xf13f('0x7')]=_0x10227c[_0xf13f('0x7')]||'';this['tokenSecret']=_0x10227c['tokenSecret']||'';this[_0xf13f('0x8')]=_0x10227c[_0xf13f('0x8')]||'';this[_0xf13f('0x9')]=_0x10227c[_0xf13f('0x9')]||'';this['Configurations']=_0x10227c['Configurations']||{};}module[_0xf13f('0xa')]=DeskAccount;
\ No newline at end of file
+var _0xc091=['token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc091,0x1b3));var _0x1c09=function(_0x4c2401,_0x1badf7){_0x4c2401=_0x4c2401-0x0;var _0x3272b8=_0xc091[_0x4c2401];return _0x3272b8;};'use strict';function DeskAccount(_0x4e2f6b){this['id']=_0x4e2f6b['id']||0x0;this[_0x1c09('0x0')]=_0x4e2f6b[_0x1c09('0x0')]||'';this[_0x1c09('0x1')]=_0x4e2f6b[_0x1c09('0x1')]||'';this[_0x1c09('0x2')]=_0x4e2f6b[_0x1c09('0x2')]||'';this[_0x1c09('0x3')]=_0x4e2f6b[_0x1c09('0x3')]||'';this[_0x1c09('0x4')]=_0x4e2f6b[_0x1c09('0x4')]||'';this[_0x1c09('0x5')]=_0x4e2f6b[_0x1c09('0x5')]||'';this[_0x1c09('0x6')]=_0x4e2f6b[_0x1c09('0x6')]||'';this[_0x1c09('0x7')]=_0x4e2f6b[_0x1c09('0x7')]||'';this[_0x1c09('0x8')]=_0x4e2f6b[_0x1c09('0x8')]||'';this[_0x1c09('0x9')]=_0x4e2f6b[_0x1c09('0x9')]||'';this[_0x1c09('0xa')]=_0x4e2f6b[_0x1c09('0xa')]||'';this[_0x1c09('0xb')]=_0x4e2f6b[_0x1c09('0xb')]||{};}module[_0x1c09('0xc')]=DeskAccount;
\ No newline at end of file
index 5f8fa2b..8609f72 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8e34=['tenantId','clientId','clientSecret','serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x37f98a,_0x5d0caa){var _0x2b2389=function(_0x2bfd60){while(--_0x2bfd60){_0x37f98a['push'](_0x37f98a['shift']());}};_0x2b2389(++_0x5d0caa);}(_0x8e34,0x1f4));var _0x48e3=function(_0x3135e1,_0x49be2e){_0x3135e1=_0x3135e1-0x0;var _0x32984a=_0x8e34[_0x3135e1];return _0x32984a;};'use strict';function Dynamics365Account(_0x5d10ea){this['id']=_0x5d10ea['id']||0x0;this[_0x48e3('0x0')]=_0x5d10ea[_0x48e3('0x0')]||'';this[_0x48e3('0x1')]=_0x5d10ea['username']||'';this[_0x48e3('0x2')]=_0x5d10ea[_0x48e3('0x2')]||'';this[_0x48e3('0x3')]=_0x5d10ea['remoteUri']||'';this[_0x48e3('0x4')]=_0x5d10ea[_0x48e3('0x4')]||'';this[_0x48e3('0x5')]=_0x5d10ea['clientId']||'';this[_0x48e3('0x6')]=_0x5d10ea[_0x48e3('0x6')]||{};this[_0x48e3('0x7')]=_0x5d10ea[_0x48e3('0x7')]||'';this[_0x48e3('0x8')]=_0x5d10ea[_0x48e3('0x8')]||{};}module['exports']=Dynamics365Account;
\ No newline at end of file
+var _0x22c4=['tenantId','clientSecret','serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x5c65de,_0x578f1f){var _0x1ad728=function(_0x3318fb){while(--_0x3318fb){_0x5c65de['push'](_0x5c65de['shift']());}};_0x1ad728(++_0x578f1f);}(_0x22c4,0xdc));var _0x422c=function(_0x4fc702,_0x590060){_0x4fc702=_0x4fc702-0x0;var _0x1357d3=_0x22c4[_0x4fc702];return _0x1357d3;};'use strict';function Dynamics365Account(_0x5d84ca){this['id']=_0x5d84ca['id']||0x0;this[_0x422c('0x0')]=_0x5d84ca[_0x422c('0x0')]||'';this[_0x422c('0x1')]=_0x5d84ca[_0x422c('0x1')]||'';this[_0x422c('0x2')]=_0x5d84ca[_0x422c('0x2')]||'';this[_0x422c('0x3')]=_0x5d84ca['remoteUri']||'';this[_0x422c('0x4')]=_0x5d84ca[_0x422c('0x4')]||'';this['clientId']=_0x5d84ca['clientId']||'';this[_0x422c('0x5')]=_0x5d84ca[_0x422c('0x5')]||{};this[_0x422c('0x6')]=_0x5d84ca[_0x422c('0x6')]||'';this[_0x422c('0x7')]=_0x5d84ca[_0x422c('0x7')]||{};}module['exports']=Dynamics365Account;
\ No newline at end of file
index 8943791..81d6445 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd64b=['ecm','headerinfo','maxrate','modem','v17,v27,v29','gateway','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xd64b,0xc1));var _0xbd64=function(_0x4745d9,_0x411b00){_0x4745d9=_0x4745d9-0x0;var _0x38f2ac=_0xd64b[_0x4745d9];return _0x38f2ac;};'use strict';function FaxAccount(_0x272488){this['id']=_0x272488['id']||0x0;this['name']=_0x272488[_0xbd64('0x0')]||'';this['description']=_0x272488[_0xbd64('0x1')];this[_0xbd64('0x2')]=_0x272488[_0xbd64('0x2')];this[_0xbd64('0x3')]=_0x272488[_0xbd64('0x3')];this['localstationid']=_0x272488['localstationid'];this['minrate']=_0x272488['minrate']||0x960;this[_0xbd64('0x4')]=_0x272488[_0xbd64('0x4')]||0x3840;this[_0xbd64('0x5')]=_0x272488[_0xbd64('0x5')]||_0xbd64('0x6');this[_0xbd64('0x7')]=_0x272488[_0xbd64('0x7')]||'no';this['faxdetect']=_0x272488['faxdetect']||'no';this[_0xbd64('0x8')]=_0x272488[_0xbd64('0x8')]||0x1388;this[_0xbd64('0x9')]=_0x272488['tech']||_0xbd64('0xa');this[_0xbd64('0xb')]=_0x272488[_0xbd64('0xb')]?_0x272488[_0xbd64('0xb')]:undefined;this['ListId']=_0x272488[_0xbd64('0xc')];this['key']=_0x272488[_0xbd64('0xd')];}module[_0xbd64('0xe')]=FaxAccount;
\ No newline at end of file
+var _0x6f0d=['t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','faxdetect'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x170bff,_0x31c89b){_0x170bff=_0x170bff-0x0;var _0xbe234e=_0x6f0d[_0x170bff];return _0xbe234e;};'use strict';function FaxAccount(_0x3bce3a){this['id']=_0x3bce3a['id']||0x0;this[_0xd6f0('0x0')]=_0x3bce3a[_0xd6f0('0x0')]||'';this[_0xd6f0('0x1')]=_0x3bce3a[_0xd6f0('0x1')];this['ecm']=_0x3bce3a[_0xd6f0('0x2')];this[_0xd6f0('0x3')]=_0x3bce3a[_0xd6f0('0x3')];this[_0xd6f0('0x4')]=_0x3bce3a[_0xd6f0('0x4')];this['minrate']=_0x3bce3a[_0xd6f0('0x5')]||0x960;this['maxrate']=_0x3bce3a[_0xd6f0('0x6')]||0x3840;this[_0xd6f0('0x7')]=_0x3bce3a[_0xd6f0('0x7')]||_0xd6f0('0x8');this['gateway']=_0x3bce3a['gateway']||'no';this[_0xd6f0('0x9')]=_0x3bce3a[_0xd6f0('0x9')]||'no';this[_0xd6f0('0xa')]=_0x3bce3a[_0xd6f0('0xa')]||0x1388;this[_0xd6f0('0xb')]=_0x3bce3a['tech']||_0xd6f0('0xc');this[_0xd6f0('0xd')]=_0x3bce3a[_0xd6f0('0xd')]?_0x3bce3a[_0xd6f0('0xd')]:undefined;this['ListId']=_0x3bce3a[_0xd6f0('0xe')];this[_0xd6f0('0xf')]=_0x3bce3a[_0xd6f0('0xf')];}module[_0xd6f0('0x10')]=FaxAccount;
\ No newline at end of file
index 65567ee..c61ed98 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1671=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0xc95ad4,_0x15279a){var _0x3f42ba=function(_0x3883f2){while(--_0x3883f2){_0xc95ad4['push'](_0xc95ad4['shift']());}};_0x3f42ba(++_0x15279a);}(_0x1671,0xeb));var _0x1167=function(_0x1db21b,_0x698792){_0x1db21b=_0x1db21b-0x0;var _0x3595f4=_0x1671[_0x1db21b];return _0x3595f4;};'use strict';function FreshdeskAccount(_0x5f1090){this['id']=_0x5f1090['id']||0x0;this['name']=_0x5f1090[_0x1167('0x0')]||'';this['username']=_0x5f1090[_0x1167('0x1')]||'';this[_0x1167('0x2')]=_0x5f1090[_0x1167('0x3')]||'';this['remoteUri']=_0x5f1090[_0x1167('0x4')]||'';this[_0x1167('0x5')]=_0x5f1090[_0x1167('0x5')]||'';this['Configurations']=_0x5f1090[_0x1167('0x6')]||{};}module[_0x1167('0x7')]=FreshdeskAccount;
\ No newline at end of file
+var _0x2203=['name','username','token','remoteUri','Configurations'];(function(_0x3b2bc4,_0x354091){var _0xa53b85=function(_0x148cfc){while(--_0x148cfc){_0x3b2bc4['push'](_0x3b2bc4['shift']());}};_0xa53b85(++_0x354091);}(_0x2203,0xbe));var _0x3220=function(_0x6c6d75,_0xef7deb){_0x6c6d75=_0x6c6d75-0x0;var _0x48a161=_0x2203[_0x6c6d75];return _0x48a161;};'use strict';function FreshdeskAccount(_0x6e53a4){this['id']=_0x6e53a4['id']||0x0;this[_0x3220('0x0')]=_0x6e53a4['name']||'';this['username']=_0x6e53a4[_0x3220('0x1')]||'';this['apiKey']=_0x6e53a4[_0x3220('0x2')]||'';this[_0x3220('0x3')]=_0x6e53a4['remoteUri']||'';this['serverUrl']=_0x6e53a4['serverUrl']||'';this[_0x3220('0x4')]=_0x6e53a4[_0x3220('0x4')]||{};}module['exports']=FreshdeskAccount;
\ No newline at end of file
index e307eaf..bf82394 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcaf0=['accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','variables','exports','type','queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandon','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinename'];(function(_0x32307a,_0x420223){var _0x24a278=function(_0xea9128){while(--_0xea9128){_0x32307a['push'](_0x32307a['shift']());}};_0x24a278(++_0x420223);}(_0xcaf0,0xf9));var _0x0caf=function(_0x50a70c,_0x52491f){_0x50a70c=_0x50a70c-0x0;var _0x5a5813=_0xcaf0[_0x50a70c];return _0x5a5813;};'use strict';function QueueReport(){this[_0x0caf('0x0')]='inbound';this['uniqueid']='';this['calleridnum']='';this['calleridname']='';this[_0x0caf('0x1')]='';this[_0x0caf('0x2')]=null;this[_0x0caf('0x3')]=null;this['position']=0x1;this[_0x0caf('0x4')]=0x1;this[_0x0caf('0x5')]=![];this['queuecallerabandonAt']=null;this['queuecallercomplete']=![];this[_0x0caf('0x6')]=null;this[_0x0caf('0x7')]=![];this[_0x0caf('0x8')]=null;this['originalposition']=0x1;this[_0x0caf('0x9')]='';this['connectedlinenum']='';this[_0x0caf('0xa')]='';this[_0x0caf('0xb')]='';this[_0x0caf('0xc')]='';this[_0x0caf('0xd')]='';this[_0x0caf('0xe')]='';this[_0x0caf('0xf')]=0x0;this[_0x0caf('0x10')]=![];this[_0x0caf('0x11')]='';this['mohtime']=0x0;this[_0x0caf('0x12')]={};}module[_0x0caf('0x13')]=QueueReport;
\ No newline at end of file
+var _0xfbe4=['exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','position','count','queuecallercomplete','queuecallercompleteAt','connectedlinenum','accountcode','exten','priority','holdtime','assigned','lastAssignedTo','mohtime'];(function(_0x3e77ee,_0x39ec64){var _0x105461=function(_0x3ca03b){while(--_0x3ca03b){_0x3e77ee['push'](_0x3e77ee['shift']());}};_0x105461(++_0x39ec64);}(_0xfbe4,0xdd));var _0x4fbe=function(_0x5af6e4,_0x3a4acf){_0x5af6e4=_0x5af6e4-0x0;var _0x4d025b=_0xfbe4[_0x5af6e4];return _0x4d025b;};'use strict';function QueueReport(){this[_0x4fbe('0x0')]=_0x4fbe('0x1');this[_0x4fbe('0x2')]='';this[_0x4fbe('0x3')]='';this[_0x4fbe('0x4')]='';this[_0x4fbe('0x5')]='';this[_0x4fbe('0x6')]=null;this['queuecallerleaveAt']=null;this[_0x4fbe('0x7')]=0x1;this[_0x4fbe('0x8')]=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this[_0x4fbe('0x9')]=![];this[_0x4fbe('0xa')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this['channel']='';this[_0x4fbe('0xb')]='';this['connectedlinename']='';this[_0x4fbe('0xc')]='';this['context']='';this[_0x4fbe('0xd')]='';this[_0x4fbe('0xe')]='';this[_0x4fbe('0xf')]=0x0;this[_0x4fbe('0x10')]=![];this[_0x4fbe('0x11')]='';this[_0x4fbe('0x12')]=0x0;this['variables']={};}module[_0x4fbe('0x13')]=QueueReport;
\ No newline at end of file
index eb6be0d..3a3b606 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x169a=['integrationTab','Configurations','name','username','password','clientId','clientSecret','securityToken','type'];(function(_0x11d71d,_0x2e22b4){var _0x1a0f88=function(_0x3357ab){while(--_0x3357ab){_0x11d71d['push'](_0x11d71d['shift']());}};_0x1a0f88(++_0x2e22b4);}(_0x169a,0x185));var _0xa169=function(_0x2dc097,_0x4e98aa){_0x2dc097=_0x2dc097-0x0;var _0x5bf945=_0x169a[_0x2dc097];return _0x5bf945;};'use strict';function SalesforceAccount(_0x40b47a){this['id']=_0x40b47a['id']||0x0;this['name']=_0x40b47a[_0xa169('0x0')]||'';this['username']=_0x40b47a[_0xa169('0x1')]||'';this['remoteUri']=_0x40b47a['remoteUri']||'';this[_0xa169('0x2')]=_0x40b47a[_0xa169('0x2')]||'';this[_0xa169('0x3')]=_0x40b47a[_0xa169('0x3')]||'';this[_0xa169('0x4')]=_0x40b47a['clientSecret']||'';this[_0xa169('0x5')]=_0x40b47a[_0xa169('0x5')]||'';this[_0xa169('0x6')]=_0x40b47a['type']||_0xa169('0x7');this['serverUrl']=_0x40b47a['serverUrl']||'';this[_0xa169('0x8')]=_0x40b47a[_0xa169('0x8')]||{};}module['exports']=SalesforceAccount;
\ No newline at end of file
+var _0x495a=['remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username'];(function(_0x5f2c63,_0x21b45e){var _0x564222=function(_0x27c557){while(--_0x27c557){_0x5f2c63['push'](_0x5f2c63['shift']());}};_0x564222(++_0x21b45e);}(_0x495a,0x11e));var _0xa495=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x495a[_0x1573ea];return _0x51c0e2;};'use strict';function SalesforceAccount(_0x42acf0){this['id']=_0x42acf0['id']||0x0;this[_0xa495('0x0')]=_0x42acf0['name']||'';this[_0xa495('0x1')]=_0x42acf0['username']||'';this['remoteUri']=_0x42acf0[_0xa495('0x2')]||'';this[_0xa495('0x3')]=_0x42acf0[_0xa495('0x3')]||'';this[_0xa495('0x4')]=_0x42acf0[_0xa495('0x4')]||'';this[_0xa495('0x5')]=_0x42acf0[_0xa495('0x5')]||'';this[_0xa495('0x6')]=_0x42acf0[_0xa495('0x6')]||'';this[_0xa495('0x7')]=_0x42acf0[_0xa495('0x7')]||_0xa495('0x8');this[_0xa495('0x9')]=_0x42acf0[_0xa495('0x9')]||'';this[_0xa495('0xa')]=_0x42acf0[_0xa495('0xa')]||{};}module[_0xa495('0xb')]=SalesforceAccount;
\ No newline at end of file
index d1feb20..4b50d2f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0997=['serverUrl','Configurations','exports','username','password','remoteUri'];(function(_0xeb76f,_0x149d04){var _0x1ed2f2=function(_0x181fdf){while(--_0x181fdf){_0xeb76f['push'](_0xeb76f['shift']());}};_0x1ed2f2(++_0x149d04);}(_0x0997,0x6f));var _0x7099=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0997[_0x20a584];return _0x4b41a8;};'use strict';function ServicenowAccount(_0x15f53b){this['id']=_0x15f53b['id']||0x0;this['name']=_0x15f53b['name']||'';this[_0x7099('0x0')]=_0x15f53b[_0x7099('0x0')]||'';this[_0x7099('0x1')]=_0x15f53b[_0x7099('0x1')]||'';this[_0x7099('0x2')]=_0x15f53b[_0x7099('0x2')]||'';this[_0x7099('0x3')]=_0x15f53b['serverUrl']||'';this[_0x7099('0x4')]=_0x15f53b[_0x7099('0x4')]||{};}module[_0x7099('0x5')]=ServicenowAccount;
\ No newline at end of file
+var _0x2f9d=['name','username','remoteUri','serverUrl','Configurations'];(function(_0x14e589,_0x5d5c97){var _0x4ceb8c=function(_0x55f065){while(--_0x55f065){_0x14e589['push'](_0x14e589['shift']());}};_0x4ceb8c(++_0x5d5c97);}(_0x2f9d,0x140));var _0xd2f9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2f9d[_0xa464c9];return _0x3d73c4;};'use strict';function ServicenowAccount(_0x5f7232){this['id']=_0x5f7232['id']||0x0;this['name']=_0x5f7232[_0xd2f9('0x0')]||'';this[_0xd2f9('0x1')]=_0x5f7232[_0xd2f9('0x1')]||'';this['password']=_0x5f7232['password']||'';this[_0xd2f9('0x2')]=_0x5f7232[_0xd2f9('0x2')]||'';this[_0xd2f9('0x3')]=_0x5f7232[_0xd2f9('0x3')]||'';this[_0xd2f9('0x4')]=_0x5f7232['Configurations']||{};}module['exports']=ServicenowAccount;
\ No newline at end of file
index d84e4b2..a7e95f1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe204=['username','password','remoteUri','serverUrl','Configurations','name'];(function(_0x5c69cb,_0x148d28){var _0x9c8579=function(_0x575234){while(--_0x575234){_0x5c69cb['push'](_0x5c69cb['shift']());}};_0x9c8579(++_0x148d28);}(_0xe204,0x167));var _0x4e20=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe204[_0x59ee6f];return _0x4c0979;};'use strict';function SugarcrmAccount(_0x36a613){this['id']=_0x36a613['id']||0x0;this[_0x4e20('0x0')]=_0x36a613[_0x4e20('0x0')]||'';this[_0x4e20('0x1')]=_0x36a613[_0x4e20('0x1')]||'';this[_0x4e20('0x2')]=_0x36a613[_0x4e20('0x2')]||'';this[_0x4e20('0x3')]=_0x36a613['remoteUri']||'';this[_0x4e20('0x4')]=_0x36a613[_0x4e20('0x4')]||'';this[_0x4e20('0x5')]=_0x36a613[_0x4e20('0x5')]||{};}module['exports']=SugarcrmAccount;
\ No newline at end of file
+var _0xffb2=['password','remoteUri','serverUrl','exports','name','username'];(function(_0x49aab7,_0x1d6397){var _0x587b6f=function(_0x2346ac){while(--_0x2346ac){_0x49aab7['push'](_0x49aab7['shift']());}};_0x587b6f(++_0x1d6397);}(_0xffb2,0x1a8));var _0x2ffb=function(_0x2afbb0,_0x44f16d){_0x2afbb0=_0x2afbb0-0x0;var _0x411ff2=_0xffb2[_0x2afbb0];return _0x411ff2;};'use strict';function SugarcrmAccount(_0x51dc7e){this['id']=_0x51dc7e['id']||0x0;this['name']=_0x51dc7e[_0x2ffb('0x0')]||'';this[_0x2ffb('0x1')]=_0x51dc7e['username']||'';this[_0x2ffb('0x2')]=_0x51dc7e[_0x2ffb('0x2')]||'';this[_0x2ffb('0x3')]=_0x51dc7e[_0x2ffb('0x3')]||'';this['serverUrl']=_0x51dc7e[_0x2ffb('0x4')]||'';this['Configurations']=_0x51dc7e['Configurations']||{};}module[_0x2ffb('0x5')]=SugarcrmAccount;
\ No newline at end of file
index 01088bb..952fd53 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x27fb=['address','exports','name','accountcode','unknown','stateTime'];(function(_0x112147,_0x4e692e){var _0x3ba744=function(_0x191b87){while(--_0x191b87){_0x112147['push'](_0x112147['shift']());}};_0x3ba744(++_0x4e692e);}(_0x27fb,0x1c4));var _0xb27f=function(_0x52878a,_0x58a737){_0x52878a=_0x52878a-0x0;var _0x33ff68=_0x27fb[_0x52878a];return _0x33ff68;};'use strict';function Telephone(_0x37c042){this['id']=_0x37c042['id']||0x0;this[_0xb27f('0x0')]=_0x37c042[_0xb27f('0x0')]||'';this[_0xb27f('0x1')]=_0x37c042[_0xb27f('0x1')]||'';this['state']=_0xb27f('0x2');this[_0xb27f('0x3')]=0x0;this['status']=_0xb27f('0x2');this[_0xb27f('0x4')]='';}module[_0xb27f('0x5')]=Telephone;
\ No newline at end of file
+var _0x6372=['address','name','state','stateTime','status','unknown'];(function(_0x4fafc5,_0xfcc12f){var _0x4e44c5=function(_0x57ee59){while(--_0x57ee59){_0x4fafc5['push'](_0x4fafc5['shift']());}};_0x4e44c5(++_0xfcc12f);}(_0x6372,0xfd));var _0x2637=function(_0xf3488b,_0x7ad151){_0xf3488b=_0xf3488b-0x0;var _0x44d6e2=_0x6372[_0xf3488b];return _0x44d6e2;};'use strict';function Telephone(_0x3ceefa){this['id']=_0x3ceefa['id']||0x0;this[_0x2637('0x0')]=_0x3ceefa[_0x2637('0x0')]||'';this['accountcode']=_0x3ceefa['accountcode']||'';this[_0x2637('0x1')]='unknown';this[_0x2637('0x2')]=0x0;this[_0x2637('0x3')]=_0x2637('0x4');this[_0x2637('0x5')]='';}module['exports']=Telephone;
\ No newline at end of file
index 0f96496..8c06be5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4522=['name','html'];(function(_0x3963e3,_0x2efad8){var _0x53e070=function(_0x4c5008){while(--_0x4c5008){_0x3963e3['push'](_0x3963e3['shift']());}};_0x53e070(++_0x2efad8);}(_0x4522,0x1a0));var _0x2452=function(_0x9336f8,_0x286899){_0x9336f8=_0x9336f8-0x0;var _0x32adbb=_0x4522[_0x9336f8];return _0x32adbb;};'use strict';function template(_0x2606f1){this['id']=_0x2606f1['id']||0x0;this['name']=_0x2606f1[_0x2452('0x0')]||'';this[_0x2452('0x1')]=_0x2606f1[_0x2452('0x1')]||'';}module['exports']=template;
\ No newline at end of file
+var _0xcea2=['exports','name','html'];(function(_0x2d6c76,_0x577695){var _0xdd3656=function(_0x368ef5){while(--_0x368ef5){_0x2d6c76['push'](_0x2d6c76['shift']());}};_0xdd3656(++_0x577695);}(_0xcea2,0x15a));var _0x2cea=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xcea2[_0x2ec461];return _0x28603d;};'use strict';function template(_0x205edd){this['id']=_0x205edd['id']||0x0;this['name']=_0x205edd[_0x2cea('0x0')]||'';this['html']=_0x205edd[_0x2cea('0x1')]||'';}module[_0x2cea('0x2')]=template;
\ No newline at end of file
index ec81a71..2cf1b0a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x72ae=['name','channel','voice','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x46c164,_0x1a1b01){var _0xed7462=function(_0x63c6b0){while(--_0x63c6b0){_0x46c164['push'](_0x46c164['shift']());}};_0xed7462(++_0x1a1b01);}(_0x72ae,0x130));var _0xe72a=function(_0x2d6942,_0x2b87dc){_0x2d6942=_0x2d6942-0x0;var _0x1a97b4=_0x72ae[_0x2d6942];return _0x1a97b4;};'use strict';function Trigger(_0x1d3dee){this['id']=_0x1d3dee['id']||0x0;this[_0xe72a('0x0')]=_0x1d3dee[_0xe72a('0x0')]||'';this[_0xe72a('0x1')]=_0x1d3dee[_0xe72a('0x1')]||_0xe72a('0x2');this[_0xe72a('0x3')]=_0x1d3dee[_0xe72a('0x3')]||![];this[_0xe72a('0x4')]=_0x1d3dee[_0xe72a('0x4')]||[];this[_0xe72a('0x5')]=_0x1d3dee[_0xe72a('0x5')]||[];this[_0xe72a('0x6')]=_0x1d3dee[_0xe72a('0x6')]||[];}module[_0xe72a('0x7')]=Trigger;
\ No newline at end of file
+var _0x4a84=['name','channel','voice','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x4bf4c3,_0x10f8e8){var _0x123292=function(_0x5df782){while(--_0x5df782){_0x4bf4c3['push'](_0x4bf4c3['shift']());}};_0x123292(++_0x10f8e8);}(_0x4a84,0x1a8));var _0x44a8=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4a84[_0x17d9e3];return _0x14192d;};'use strict';function Trigger(_0x1b634b){this['id']=_0x1b634b['id']||0x0;this['name']=_0x1b634b[_0x44a8('0x0')]||'';this['channel']=_0x1b634b[_0x44a8('0x1')]||_0x44a8('0x2');this[_0x44a8('0x3')]=_0x1b634b[_0x44a8('0x3')]||![];this[_0x44a8('0x4')]=_0x1b634b[_0x44a8('0x4')]||[];this[_0x44a8('0x5')]=_0x1b634b['AnyConditions']||[];this[_0x44a8('0x6')]=_0x1b634b[_0x44a8('0x6')]||[];}module[_0x44a8('0x7')]=Trigger;
\ No newline at end of file
index e6ed49d..f62fb4f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xefd1=['name','unknown','stateTime','status','registry','split','host','domainport','registrationtime','address','active'];(function(_0xc753c8,_0x5627ff){var _0xd02f5c=function(_0xfb552e){while(--_0xfb552e){_0xc753c8['push'](_0xc753c8['shift']());}};_0xd02f5c(++_0x5627ff);}(_0xefd1,0x1a1));var _0x1efd=function(_0x32854c,_0x1ceeea){_0x32854c=_0x32854c-0x0;var _0x1b3012=_0xefd1[_0x32854c];return _0x1b3012;};'use strict';function Trunk(_0x11cfc5){this['id']=_0x11cfc5['id']||0x0;this[_0x1efd('0x0')]=_0x11cfc5['active']||![];this[_0x1efd('0x1')]=_0x11cfc5['name']||'';this['state']=_0x1efd('0x2');this[_0x1efd('0x3')]=0x0;this[_0x1efd('0x4')]='unknown';this[_0x1efd('0x5')]=_0x11cfc5[_0x1efd('0x5')]&&_0x11cfc5[_0x1efd('0x5')]['indexOf'](':')?_0x11cfc5[_0x1efd('0x5')][_0x1efd('0x6')](':')[0x0]:'';this[_0x1efd('0x7')]='';this['port']='';this['domain']='';this[_0x1efd('0x8')]='';this['refresh']='';this['stateRegistry']='unknown';this[_0x1efd('0x9')]='';this[_0x1efd('0xa')]='';}module['exports']=Trunk;
\ No newline at end of file
+var _0x2cd9=['host','port','domain','domainport','refresh','registrationtime','address','exports','active','name','state','unknown','stateTime','registry','split'];(function(_0x3e9f54,_0x3ec08d){var _0x2333bb=function(_0x4942f5){while(--_0x4942f5){_0x3e9f54['push'](_0x3e9f54['shift']());}};_0x2333bb(++_0x3ec08d);}(_0x2cd9,0x1e8));var _0x92cd=function(_0x385d7f,_0x110515){_0x385d7f=_0x385d7f-0x0;var _0x2d9ee9=_0x2cd9[_0x385d7f];return _0x2d9ee9;};'use strict';function Trunk(_0x12b970){this['id']=_0x12b970['id']||0x0;this[_0x92cd('0x0')]=_0x12b970[_0x92cd('0x0')]||![];this[_0x92cd('0x1')]=_0x12b970['name']||'';this[_0x92cd('0x2')]=_0x92cd('0x3');this[_0x92cd('0x4')]=0x0;this['status']=_0x92cd('0x3');this[_0x92cd('0x5')]=_0x12b970[_0x92cd('0x5')]&&_0x12b970['registry']['indexOf'](':')?_0x12b970['registry'][_0x92cd('0x6')](':')[0x0]:'';this[_0x92cd('0x7')]='';this[_0x92cd('0x8')]='';this[_0x92cd('0x9')]='';this[_0x92cd('0xa')]='';this[_0x92cd('0xb')]='';this['stateRegistry']=_0x92cd('0x3');this[_0x92cd('0xc')]='';this[_0x92cd('0xd')]='';}module[_0x92cd('0xe')]=Trunk;
\ No newline at end of file
index 3a75651..b60409a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3566=['recordingFormat','mandatoryDisposition','exten'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x3566,0x197));var _0x6356=function(_0x34d389,_0x4b9dd3){_0x34d389=_0x34d389-0x0;var _0x476045=_0x3566[_0x34d389];return _0x476045;};'use strict';function voiceExtension(_0x179e68){this['id']=_0x179e68['id']||0x0;this[_0x6356('0x0')]=_0x179e68[_0x6356('0x0')]||'';this[_0x6356('0x1')]=_0x179e68[_0x6356('0x1')]||'none';this[_0x6356('0x2')]=_0x179e68['mandatoryDisposition']||![];}module['exports']=voiceExtension;
\ No newline at end of file
+var _0x9097=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x3d1878,_0x56de81){var _0x3b11be=function(_0x352a65){while(--_0x352a65){_0x3d1878['push'](_0x3d1878['shift']());}};_0x3b11be(++_0x56de81);}(_0x9097,0x1d5));var _0x7909=function(_0x23980a,_0x4b2f7b){_0x23980a=_0x23980a-0x0;var _0x33d2f8=_0x9097[_0x23980a];return _0x33d2f8;};'use strict';function voiceExtension(_0x54dcc4){this['id']=_0x54dcc4['id']||0x0;this[_0x7909('0x0')]=_0x54dcc4[_0x7909('0x0')]||'';this[_0x7909('0x1')]=_0x54dcc4['recordingFormat']||_0x7909('0x2');this['mandatoryDisposition']=_0x54dcc4[_0x7909('0x3')]||![];}module[_0x7909('0x4')]=voiceExtension;
\ No newline at end of file
index b49ec4f..04d2316 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x822e=['abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','predictiveIntervalLowerLimit','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','talking','total','answered','sumDuration','sumBillable'];(function(_0x58fe28,_0x49f38b){var _0x15cd2f=function(_0x563388){while(--_0x563388){_0x58fe28['push'](_0x58fe28['shift']());}};_0x15cd2f(++_0x49f38b);}(_0x822e,0x192));var _0xe822=function(_0x3d5cbb,_0x449a65){_0x3d5cbb=_0x3d5cbb-0x0;var _0x4d306c=_0x822e[_0x3d5cbb];return _0x4d306c;};'use strict';var statusDesc=['unknown',_0xe822('0x0'),_0xe822('0x1'),_0xe822('0x2'),_0xe822('0x3'),_0xe822('0x4'),_0xe822('0x5'),_0xe822('0x6'),_0xe822('0x7')];var monitorFormat={'wav':_0xe822('0x8'),'wav49':_0xe822('0x9'),'gsm':_0xe822('0xa')};var strategy={'rrmemory':_0xe822('0xb'),'roundrobin':_0xe822('0xc')};function VoiceQueue(_0x1486d0){this['id']=_0x1486d0['id']||0x0;this[_0xe822('0xd')]=_0x1486d0[_0xe822('0xd')]||'';this[_0xe822('0xe')]=_0x1486d0[_0xe822('0xe')]||'';this[_0xe822('0xf')]=_0x1486d0[_0xe822('0xf')]||_0xe822('0x10');this['waiting']=0x0;this[_0xe822('0x11')]=0x0;this[_0xe822('0x12')]=0x0;this[_0xe822('0x13')]=0x0;this[_0xe822('0x14')]=0x0;this['sumHoldTime']=0x0;this[_0xe822('0x15')]=0x0;this['unmanaged']=0x0;this[_0xe822('0x16')]=0x0;this[_0xe822('0x17')]=0x0;this[_0xe822('0x18')]=0x0;this[_0xe822('0x19')]=_0x1486d0[_0xe822('0x19')]||![];this[_0xe822('0x1a')]=_0x1486d0['acwTimeout']||0xa;this[_0xe822('0x1b')]=_0x1486d0[_0xe822('0x1b')]||'no';this[_0xe822('0x1c')]=!![];this[_0xe822('0x1d')]='';this['originated']=0x0;this['temp']=0x0;this[_0xe822('0x1e')]=_0x1486d0[_0xe822('0x1e')]||null;this[_0xe822('0x1f')]=_0x1486d0[_0xe822('0x1f')]?_0x1486d0[_0xe822('0x1f')]:null;this[_0xe822('0x20')]=_0x1486d0[_0xe822('0x20')];this[_0xe822('0x21')]=_0x1486d0[_0xe822('0x21')]||_0xe822('0x22');this['dialLimitChannel']=_0x1486d0[_0xe822('0x23')]||0x0;this[_0xe822('0x24')]=_0x1486d0[_0xe822('0x24')]||0x0;this[_0xe822('0x25')]=_0x1486d0[_0xe822('0x25')]||0x1;this[_0xe822('0x26')]=_0x1486d0[_0xe822('0x26')]||_0xe822('0x27');this['dialPredictiveOptimizationPercentage']=_0x1486d0['dialPredictiveOptimizationPercentage']||0.03;this[_0xe822('0x28')]=_0x1486d0['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x1486d0['dialOriginateCallerIdName']||'anonymous';this['dialOriginateCallerIdNumber']=_0x1486d0[_0xe822('0x29')]||'anonymous';this[_0xe822('0x2a')]=_0x1486d0[_0xe822('0x2a')]||0x1e;this[_0xe822('0x2b')]=_0x1486d0[_0xe822('0x2b')]||_0xe822('0x2c');this[_0xe822('0x2d')]=_0x1486d0[_0xe822('0x2d')]||0x3;this[_0xe822('0x2e')]=_0x1486d0['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x1486d0[_0xe822('0x2f')]||0x3;this[_0xe822('0x30')]=_0x1486d0['dialCongestionRetryFrequency']||0x96;this['dialBusyMaxRetry']=_0x1486d0[_0xe822('0x31')]||0x3;this[_0xe822('0x32')]=_0x1486d0[_0xe822('0x32')]||0x96;this[_0xe822('0x33')]=_0x1486d0[_0xe822('0x33')]||0x3;this['dialNoAnswerRetryFrequency']=_0x1486d0[_0xe822('0x34')]||0x96;this['dialGlobalMaxRetry']=_0x1486d0[_0xe822('0x35')]||0x4;this[_0xe822('0x36')]=_0x1486d0[_0xe822('0x36')]?_0x1486d0[_0xe822('0x36')]:undefined;this[_0xe822('0x37')]=_0x1486d0[_0xe822('0x37')]?_0x1486d0[_0xe822('0x37')]:undefined;this[_0xe822('0x38')]=_0x1486d0['dialPrefix']||undefined;this[_0xe822('0x39')]=_0x1486d0[_0xe822('0x39')]?_0x1486d0[_0xe822('0x39')]:undefined;this[_0xe822('0x3a')]=_0x1486d0['dialOrderByScheduledAt']||_0xe822('0x3b');this['dialRandomLastDigitCallerIdNumber']=_0x1486d0[_0xe822('0x3c')]||undefined;this['dialCutDigit']=_0x1486d0[_0xe822('0x3d')]||undefined;this['strategy']=strategy[_0x1486d0['strategy']]||_0xe822('0xb');this[_0xe822('0x3e')]=!![];this[_0xe822('0x3f')]=_0x1486d0[_0xe822('0x3f')]||![];this['dialAMDInitialSilence']=_0x1486d0[_0xe822('0x40')];this[_0xe822('0x41')]=_0x1486d0['dialAMDGreeting'];this[_0xe822('0x42')]=_0x1486d0[_0xe822('0x42')];this['dialAMDTotalAnalysisTime']=_0x1486d0[_0xe822('0x43')];this[_0xe822('0x44')]=_0x1486d0[_0xe822('0x44')];this[_0xe822('0x45')]=_0x1486d0[_0xe822('0x45')];this[_0xe822('0x46')]=_0x1486d0[_0xe822('0x46')];this[_0xe822('0x47')]=_0x1486d0['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x1486d0[_0xe822('0x48')];this[_0xe822('0x49')]=0x0;this[_0xe822('0x4a')]=0x0;this[_0xe822('0x4b')]=_0x1486d0[_0xe822('0x4b')];this['outboundAnswerCallsDay']=0x0;this[_0xe822('0x4c')]=0x0;this[_0xe822('0x4d')]=0x0;this[_0xe822('0x4e')]=0x0;this[_0xe822('0x4f')]=0x0;this[_0xe822('0x50')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xe822('0x51')]=0x0;this[_0xe822('0x52')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xe822('0x53')]=0x0;this[_0xe822('0x54')]=0x0;this[_0xe822('0x55')]=0x0;this['startProgressive']=undefined;this['startPredictive']=undefined;this[_0xe822('0x56')]=undefined;this[_0xe822('0x57')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xe822('0x58')]=0x0;this[_0xe822('0x59')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xe822('0x5a')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xe822('0x5b')]=0.4;this['predictiveIntervalErlangCalls']=0x0;this[_0xe822('0x5c')]=0x0;this[_0xe822('0x5d')]=0x1;this[_0xe822('0x5e')]=0x0;this[_0xe822('0x5f')]=0x0;this[_0xe822('0x60')]=0x0;this[_0xe822('0x61')]=0x0;this[_0xe822('0x62')]=_0x1486d0[_0xe822('0x62')]||0x1e;this[_0xe822('0x63')]=_0x1486d0[_0xe822('0x63')]||![];this[_0xe822('0x64')]=_0x1486d0[_0xe822('0x64')]||undefined;this[_0xe822('0x65')]=_0x1486d0['dialAgiAfterHangupClient']||![];this[_0xe822('0x66')]=_0x1486d0[_0xe822('0x66')]||![];this[_0xe822('0xe')]=monitorFormat[_0x1486d0['monitor_format']]?monitorFormat[_0x1486d0[_0xe822('0xe')]]:undefined;this[_0xe822('0x67')]=_0x1486d0[_0xe822('0x67')]||![];this[_0xe822('0x68')]=_0x1486d0[_0xe822('0x68')]?_0x1486d0[_0xe822('0x68')]:undefined;}module[_0xe822('0x69')]=VoiceQueue;
\ No newline at end of file
+var _0x0424=['sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialCutDigit','strategy','rrmemory','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalLowerLimit','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','busy','invalid','ringing','ringinuse','onhold','wav','wav49','gsm','roundrobin','name','monitor_format','type','inbound','waiting','total','answered','sumDuration'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0424,0x128));var _0x4042=function(_0x24bf11,_0x320ad8){_0x24bf11=_0x24bf11-0x0;var _0x20f05b=_0x0424[_0x24bf11];return _0x20f05b;};'use strict';var statusDesc=[_0x4042('0x0'),_0x4042('0x1'),'inuse',_0x4042('0x2'),_0x4042('0x3'),'unavailable',_0x4042('0x4'),_0x4042('0x5'),_0x4042('0x6')];var monitorFormat={'wav':_0x4042('0x7'),'wav49':_0x4042('0x8'),'gsm':_0x4042('0x9')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x4042('0xa')};function VoiceQueue(_0x3d6325){this['id']=_0x3d6325['id']||0x0;this[_0x4042('0xb')]=_0x3d6325[_0x4042('0xb')]||'';this[_0x4042('0xc')]=_0x3d6325[_0x4042('0xc')]||'';this['type']=_0x3d6325[_0x4042('0xd')]||_0x4042('0xe');this[_0x4042('0xf')]=0x0;this['talking']=0x0;this[_0x4042('0x10')]=0x0;this[_0x4042('0x11')]=0x0;this[_0x4042('0x12')]=0x0;this[_0x4042('0x13')]=0x0;this[_0x4042('0x14')]=0x0;this[_0x4042('0x15')]=0x0;this[_0x4042('0x16')]=0x0;this[_0x4042('0x17')]=0x0;this[_0x4042('0x18')]=0x0;this[_0x4042('0x19')]=_0x3d6325[_0x4042('0x19')]||![];this[_0x4042('0x1a')]=_0x3d6325['acwTimeout']||0xa;this['autopause']=_0x3d6325[_0x4042('0x1b')]||'no';this[_0x4042('0x1c')]=!![];this['message']='';this[_0x4042('0x1d')]=0x0;this[_0x4042('0x1e')]=0x0;this['dialTimezone']=_0x3d6325['dialTimezone']||null;this[_0x4042('0x1f')]=_0x3d6325[_0x4042('0x1f')]?_0x3d6325[_0x4042('0x1f')]:null;this[_0x4042('0x20')]=_0x3d6325[_0x4042('0x20')];this[_0x4042('0x21')]=_0x3d6325['dialMethod']||'progressive';this[_0x4042('0x22')]=_0x3d6325[_0x4042('0x22')]||0x0;this['dialLimitQueue']=_0x3d6325[_0x4042('0x23')]||0x0;this['dialPowerLevel']=_0x3d6325['dialPowerLevel']||0x1;this[_0x4042('0x24')]=_0x3d6325['dialPredictiveOptimization']||_0x4042('0x25');this[_0x4042('0x26')]=_0x3d6325[_0x4042('0x26')]||0.03;this[_0x4042('0x27')]=_0x3d6325[_0x4042('0x27')]||0x258;this[_0x4042('0x28')]=_0x3d6325[_0x4042('0x28')]||_0x4042('0x29');this[_0x4042('0x2a')]=_0x3d6325[_0x4042('0x2a')]||_0x4042('0x29');this[_0x4042('0x2b')]=_0x3d6325['dialOriginateTimeout']||0x1e;this[_0x4042('0x2c')]=_0x3d6325[_0x4042('0x2c')]||_0x4042('0x2d');this[_0x4042('0x2e')]=_0x3d6325[_0x4042('0x2e')]||0x3;this[_0x4042('0x2f')]=_0x3d6325[_0x4042('0x2f')]||undefined;this[_0x4042('0x30')]=_0x3d6325[_0x4042('0x30')]||0x3;this['dialCongestionRetryFrequency']=_0x3d6325[_0x4042('0x31')]||0x96;this[_0x4042('0x32')]=_0x3d6325['dialBusyMaxRetry']||0x3;this[_0x4042('0x33')]=_0x3d6325[_0x4042('0x33')]||0x96;this[_0x4042('0x34')]=_0x3d6325['dialNoAnswerMaxRetry']||0x3;this[_0x4042('0x35')]=_0x3d6325['dialNoAnswerRetryFrequency']||0x96;this[_0x4042('0x36')]=_0x3d6325[_0x4042('0x36')]||0x4;this['Trunk']=_0x3d6325[_0x4042('0x37')]?_0x3d6325[_0x4042('0x37')]:undefined;this['TrunkBackup']=_0x3d6325[_0x4042('0x38')]?_0x3d6325[_0x4042('0x38')]:undefined;this[_0x4042('0x39')]=_0x3d6325[_0x4042('0x39')]||undefined;this[_0x4042('0x3a')]=_0x3d6325[_0x4042('0x3a')]?_0x3d6325[_0x4042('0x3a')]:undefined;this[_0x4042('0x3b')]=_0x3d6325[_0x4042('0x3b')]||_0x4042('0x3c');this['dialRandomLastDigitCallerIdNumber']=_0x3d6325['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x4042('0x3d')]=_0x3d6325['dialCutDigit']||undefined;this[_0x4042('0x3e')]=strategy[_0x3d6325[_0x4042('0x3e')]]||_0x4042('0x3f');this['queueStatusComplete']=!![];this['dialAMDActive']=_0x3d6325[_0x4042('0x40')]||![];this[_0x4042('0x41')]=_0x3d6325[_0x4042('0x41')];this['dialAMDGreeting']=_0x3d6325[_0x4042('0x42')];this['dialAMDAfterGreetingSilence']=_0x3d6325[_0x4042('0x43')];this[_0x4042('0x44')]=_0x3d6325['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x3d6325[_0x4042('0x45')];this[_0x4042('0x46')]=_0x3d6325[_0x4042('0x46')];this[_0x4042('0x47')]=_0x3d6325[_0x4042('0x47')];this[_0x4042('0x48')]=_0x3d6325[_0x4042('0x48')];this[_0x4042('0x49')]=_0x3d6325[_0x4042('0x49')];this[_0x4042('0x4a')]=0x0;this[_0x4042('0x4b')]=0x0;this[_0x4042('0x4c')]=_0x3d6325['timeout'];this['outboundAnswerCallsDay']=0x0;this[_0x4042('0x4d')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x4042('0x4e')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x4042('0x4f')]=0x0;this[_0x4042('0x50')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x4042('0x51')]=0x0;this[_0x4042('0x52')]=0x0;this[_0x4042('0x53')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x4042('0x54')]=0x0;this[_0x4042('0x55')]=undefined;this['startPredictive']=undefined;this[_0x4042('0x56')]=undefined;this[_0x4042('0x57')]=1.05;this[_0x4042('0x58')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x4042('0x59')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x4042('0x5a')]=0x0;this[_0x4042('0x5b')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x4042('0x5c')]=0.4;this['predictiveIntervalErlangCalls']=0x0;this[_0x4042('0x5d')]=0x0;this[_0x4042('0x5e')]=0x1;this['erlangCalls']=0x0;this['erlangCallToSecond']=0x0;this[_0x4042('0x5f')]=0x0;this[_0x4042('0x60')]=0x0;this[_0x4042('0x61')]=_0x3d6325[_0x4042('0x61')]||0x1e;this[_0x4042('0x62')]=_0x3d6325[_0x4042('0x62')]||![];this[_0x4042('0x63')]=_0x3d6325['dialQueueProject2']||undefined;this[_0x4042('0x64')]=_0x3d6325[_0x4042('0x64')]||![];this[_0x4042('0x65')]=_0x3d6325['dialAgiAfterHangupAgent']||![];this['monitor_format']=monitorFormat[_0x3d6325[_0x4042('0xc')]]?monitorFormat[_0x3d6325[_0x4042('0xc')]]:undefined;this[_0x4042('0x66')]=_0x3d6325[_0x4042('0x66')]||![];this['mandatoryDispositionPause']=_0x3d6325['mandatoryDispositionPause']?_0x3d6325[_0x4042('0x67')]:undefined;}module[_0x4042('0x68')]=VoiceQueue;
\ No newline at end of file
index cc66e23..1be8a91 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe1a0=['remoteUri','exports','name','username','accessKey'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe1a0,0x110));var _0x0e1a=function(_0x2a5b3b,_0x4ebe31){_0x2a5b3b=_0x2a5b3b-0x0;var _0xae665a=_0xe1a0[_0x2a5b3b];return _0xae665a;};'use strict';function VtigerAccount(_0x19b54c){this['id']=_0x19b54c['id']||0x0;this[_0x0e1a('0x0')]=_0x19b54c['name']||'';this[_0x0e1a('0x1')]=_0x19b54c[_0x0e1a('0x1')]||'';this[_0x0e1a('0x2')]=_0x19b54c[_0x0e1a('0x2')]||'';this[_0x0e1a('0x3')]=_0x19b54c[_0x0e1a('0x3')]||'';this['serverUrl']=_0x19b54c['serverUrl']||'';this['Configurations']=_0x19b54c['Configurations']||{};}module[_0x0e1a('0x4')]=VtigerAccount;
\ No newline at end of file
+var _0xe497=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x1348f5,_0x348e2e){var _0x2acccb=function(_0x381686){while(--_0x381686){_0x1348f5['push'](_0x1348f5['shift']());}};_0x2acccb(++_0x348e2e);}(_0xe497,0xb3));var _0x7e49=function(_0x281136,_0x43c14d){_0x281136=_0x281136-0x0;var _0x5dedc5=_0xe497[_0x281136];return _0x5dedc5;};'use strict';function VtigerAccount(_0x48c1ad){this['id']=_0x48c1ad['id']||0x0;this[_0x7e49('0x0')]=_0x48c1ad[_0x7e49('0x0')]||'';this[_0x7e49('0x1')]=_0x48c1ad[_0x7e49('0x1')]||'';this['accessKey']=_0x48c1ad[_0x7e49('0x2')]||'';this[_0x7e49('0x3')]=_0x48c1ad[_0x7e49('0x3')]||'';this[_0x7e49('0x4')]=_0x48c1ad[_0x7e49('0x4')]||'';this[_0x7e49('0x5')]=_0x48c1ad[_0x7e49('0x5')]||{};}module[_0x7e49('0x6')]=VtigerAccount;
\ No newline at end of file
index bc4c95b..65cf2ca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc023=['type','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType'];(function(_0x35afeb,_0x36a9c6){var _0x579723=function(_0x564861){while(--_0x564861){_0x35afeb['push'](_0x35afeb['shift']());}};_0x579723(++_0x36a9c6);}(_0xc023,0x162));var _0x3c02=function(_0x39b007,_0x45f4a8){_0x39b007=_0x39b007-0x0;var _0x26f00d=_0xc023[_0x39b007];return _0x26f00d;};'use strict';function ZendeskAccount(_0x4d919f){this['id']=_0x4d919f['id']||0x0;this['name']=_0x4d919f[_0x3c02('0x0')]||'';this[_0x3c02('0x1')]=_0x4d919f['username']||'';this['password']=_0x4d919f[_0x3c02('0x2')]||'';this[_0x3c02('0x3')]=_0x4d919f[_0x3c02('0x3')]||'';this[_0x3c02('0x4')]=_0x4d919f['remoteUri']||'';this['authType']=_0x4d919f[_0x3c02('0x5')]||'';this[_0x3c02('0x6')]=_0x4d919f[_0x3c02('0x6')]||'integrationTab';this['serverUrl']=_0x4d919f[_0x3c02('0x7')]||'';this[_0x3c02('0x8')]=_0x4d919f['Configurations']||{};}module[_0x3c02('0x9')]=ZendeskAccount;
\ No newline at end of file
+var _0x9fb5=['type','integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType'];(function(_0x200d0a,_0x281f23){var _0x2af788=function(_0x2f6b80){while(--_0x2f6b80){_0x200d0a['push'](_0x200d0a['shift']());}};_0x2af788(++_0x281f23);}(_0x9fb5,0x123));var _0x59fb=function(_0x556737,_0x4680bf){_0x556737=_0x556737-0x0;var _0x485934=_0x9fb5[_0x556737];return _0x485934;};'use strict';function ZendeskAccount(_0x25db2e){this['id']=_0x25db2e['id']||0x0;this[_0x59fb('0x0')]=_0x25db2e[_0x59fb('0x0')]||'';this[_0x59fb('0x1')]=_0x25db2e[_0x59fb('0x1')]||'';this[_0x59fb('0x2')]=_0x25db2e[_0x59fb('0x2')]||'';this[_0x59fb('0x3')]=_0x25db2e[_0x59fb('0x3')]||'';this[_0x59fb('0x4')]=_0x25db2e[_0x59fb('0x4')]||'';this[_0x59fb('0x5')]=_0x25db2e[_0x59fb('0x5')]||'';this[_0x59fb('0x6')]=_0x25db2e[_0x59fb('0x6')]||_0x59fb('0x7');this['serverUrl']=_0x25db2e[_0x59fb('0x8')]||'';this[_0x59fb('0x9')]=_0x25db2e[_0x59fb('0x9')]||{};}module[_0x59fb('0xa')]=ZendeskAccount;
\ No newline at end of file
index 47e7462..5aea3d5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x814b=['host','Configurations','serverUrl','exports','name','authToken'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x814b,0x1a2));var _0xb814=function(_0x1667df,_0x266940){_0x1667df=_0x1667df-0x0;var _0x341abf=_0x814b[_0x1667df];return _0x341abf;};'use strict';function ZohoAccount(_0x451d2a){this['id']=_0x451d2a['id']||0x0;this[_0xb814('0x0')]=_0x451d2a[_0xb814('0x0')]||'';this[_0xb814('0x1')]=_0x451d2a[_0xb814('0x1')]||'';this[_0xb814('0x2')]=_0x451d2a['host']||'';this[_0xb814('0x3')]=_0x451d2a[_0xb814('0x3')]||{};this[_0xb814('0x4')]=_0x451d2a[_0xb814('0x4')]||'';}module[_0xb814('0x5')]=ZohoAccount;
\ No newline at end of file
+var _0xda19=['Configurations','serverUrl','exports','name','authToken','host'];(function(_0x3eb56e,_0x4c2721){var _0x39e1a9=function(_0x1575d0){while(--_0x1575d0){_0x3eb56e['push'](_0x3eb56e['shift']());}};_0x39e1a9(++_0x4c2721);}(_0xda19,0xd5));var _0x9da1=function(_0x53c3db,_0x1d41e8){_0x53c3db=_0x53c3db-0x0;var _0x44f12f=_0xda19[_0x53c3db];return _0x44f12f;};'use strict';function ZohoAccount(_0x26be9c){this['id']=_0x26be9c['id']||0x0;this[_0x9da1('0x0')]=_0x26be9c[_0x9da1('0x0')]||'';this['authToken']=_0x26be9c[_0x9da1('0x1')]||'';this['host']=_0x26be9c[_0x9da1('0x2')]||'';this['Configurations']=_0x26be9c[_0x9da1('0x3')]||{};this[_0x9da1('0x4')]=_0x26be9c[_0x9da1('0x4')]||'';}module[_0x9da1('0x5')]=ZohoAccount;
\ No newline at end of file
index e88aa59..b12ae7f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x33e3=['name','type','campaigntype','queue','membername','Agent','format','calleridname','Contact','firstName','lastName','active','calleridnum','phone','countbusyretry','countnoanswerretry','countcongestionretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string'];(function(_0x5d25f8,_0x45ceaf){var _0x5d887c=function(_0x31ac76){while(--_0x31ac76){_0x5d25f8['push'](_0x5d25f8['shift']());}};_0x5d887c(++_0x45ceaf);}(_0x33e3,0x1e5));var _0x333e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x33e3[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x333e('0x0'));var _=require(_0x333e('0x1'));var moment=require(_0x333e('0x2'));function checkNameSurname(_0x52d1c3,_0x598568,_0x578426){var _0x2c793d='';if(!_['isNil'](_0x598568)&&'string'===typeof _0x598568){_0x2c793d+=_0x598568;}if(!_[_0x333e('0x3')](_0x578426)&&_0x333e('0x4')===typeof _0x578426){_0x2c793d+='\x20'+_0x578426;}if(_0x2c793d!==''){return _0x2c793d;}return _0x52d1c3;}function Action(_0x46afab,_0x460d75,_0x47cde8,_0x2c3f1d,_0x4078c8){this['uniqueid']=_0x47cde8||undefined;this['idContact']=_0x46afab['id'];this['queue']=_0x460d75[_0x333e('0x5')];this[_0x333e('0x6')]=_0x460d75[_0x333e('0x6')];this[_0x333e('0x7')]=_0x333e('0x8');this['dialAnswer']=![];this[_0x333e('0x9')]=_[_0x333e('0x3')](_0x46afab[_0x333e('0xa')])?undefined:_0x46afab['Agent'][_0x333e('0x5')];this['channelAgent']=this[_0x333e('0x9')]?util[_0x333e('0xb')]('SIP/%s',this[_0x333e('0x9')]):_0x2c3f1d||undefined;this[_0x333e('0xc')]=checkNameSurname(_0x46afab[_0x333e('0xd')]['phone'],_0x46afab['Contact'][_0x333e('0xe')],_0x46afab[_0x333e('0xd')][_0x333e('0xf')]);this[_0x333e('0x10')]=_0x46afab[_0x333e('0x10')]||![];this[_0x333e('0x11')]=_0x46afab['Contact'][_0x333e('0x12')];this['scheduledat']=_0x46afab['scheduledat'];this['countbusyretry']=_0x46afab[_0x333e('0x13')]||0x0;this['countcongestionretry']=_0x46afab['countcongestionretry']||0x0;this['countnoanswerretry']=_0x46afab[_0x333e('0x14')]||0x0;this['countglobal']=(_0x46afab[_0x333e('0x13')]||0x0)+(_0x46afab[_0x333e('0x15')]||0x0)+(_0x46afab['countnoanswerretry']||0x0);this[_0x333e('0x16')]=_0x46afab[_0x333e('0x16')];this['callbackuniqueid']=_0x46afab[_0x333e('0x17')];this[_0x333e('0x18')]=_0x46afab[_0x333e('0x18')];this[_0x333e('0x19')]=_0x46afab[_0x333e('0x19')];this[_0x333e('0x1a')]=_0x46afab[_0x333e('0x1a')];this[_0x333e('0x1b')]=_0x46afab['ListId'];this[_0x333e('0x1c')]=_[_0x333e('0x3')](_0x46afab['Agent'])?_0x46afab[_0x333e('0x1c')]:_0x46afab[_0x333e('0xa')]['id'];this[_0x333e('0x1d')]=_0x46afab[_0x333e('0x1d')];this['originatecalleridnum']='';this[_0x333e('0x1e')]='';}Action['prototype'][_0x333e('0x1f')]=function(){return util['format'](_0x333e('0x20'),this[_0x333e('0xc')],this[_0x333e('0x21')]);};module[_0x333e('0x22')]=Action;
\ No newline at end of file
+var _0x4e65=['originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','isNil','string','idContact','queue','name','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','phone','firstName','Contact','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0xd24895,_0x1d9036){var _0x4811a7=function(_0x59d90c){while(--_0x59d90c){_0xd24895['push'](_0xd24895['shift']());}};_0x4811a7(++_0x1d9036);}(_0x4e65,0xf0));var _0x54e6=function(_0x2daa0a,_0x3887a8){_0x2daa0a=_0x2daa0a-0x0;var _0x55491e=_0x4e65[_0x2daa0a];return _0x55491e;};'use strict';var util=require(_0x54e6('0x0'));var _=require(_0x54e6('0x1'));var moment=require('moment');function checkNameSurname(_0x595973,_0x31d948,_0x3a7de3){var _0x579e63='';if(!_[_0x54e6('0x2')](_0x31d948)&&'string'===typeof _0x31d948){_0x579e63+=_0x31d948;}if(!_[_0x54e6('0x2')](_0x3a7de3)&&_0x54e6('0x3')===typeof _0x3a7de3){_0x579e63+='\x20'+_0x3a7de3;}if(_0x579e63!==''){return _0x579e63;}return _0x595973;}function Action(_0x206843,_0x17a7be,_0x3932c4,_0x484cac,_0x42d0b3){this['uniqueid']=_0x3932c4||undefined;this[_0x54e6('0x4')]=_0x206843['id'];this[_0x54e6('0x5')]=_0x17a7be[_0x54e6('0x6')];this['type']=_0x17a7be['type'];this[_0x54e6('0x7')]=_0x54e6('0x5');this[_0x54e6('0x8')]=![];this[_0x54e6('0x9')]=_['isNil'](_0x206843[_0x54e6('0xa')])?undefined:_0x206843[_0x54e6('0xa')]['name'];this[_0x54e6('0xb')]=this[_0x54e6('0x9')]?util[_0x54e6('0xc')](_0x54e6('0xd'),this[_0x54e6('0x9')]):_0x484cac||undefined;this[_0x54e6('0xe')]=checkNameSurname(_0x206843['Contact'][_0x54e6('0xf')],_0x206843['Contact'][_0x54e6('0x10')],_0x206843[_0x54e6('0x11')][_0x54e6('0x12')]);this[_0x54e6('0x13')]=_0x206843[_0x54e6('0x13')]||![];this['calleridnum']=_0x206843[_0x54e6('0x11')]['phone'];this[_0x54e6('0x14')]=_0x206843[_0x54e6('0x14')];this['countbusyretry']=_0x206843[_0x54e6('0x15')]||0x0;this[_0x54e6('0x16')]=_0x206843[_0x54e6('0x16')]||0x0;this[_0x54e6('0x17')]=_0x206843[_0x54e6('0x17')]||0x0;this[_0x54e6('0x18')]=(_0x206843[_0x54e6('0x15')]||0x0)+(_0x206843['countcongestionretry']||0x0)+(_0x206843[_0x54e6('0x17')]||0x0);this[_0x54e6('0x19')]=_0x206843['callback'];this[_0x54e6('0x1a')]=_0x206843[_0x54e6('0x1a')];this[_0x54e6('0x1b')]=_0x206843['callbackat'];this[_0x54e6('0x1c')]=_0x206843['recallme'];this[_0x54e6('0x1d')]=_0x206843[_0x54e6('0x1d')];this['ListId']=_0x206843[_0x54e6('0x1e')];this[_0x54e6('0x1f')]=_['isNil'](_0x206843[_0x54e6('0xa')])?_0x206843['UserId']:_0x206843[_0x54e6('0xa')]['id'];this[_0x54e6('0x20')]=_0x206843[_0x54e6('0x20')];this['originatecalleridnum']='';this[_0x54e6('0x21')]='';}Action[_0x54e6('0x22')][_0x54e6('0x23')]=function(){return util['format'](_0x54e6('0x24'),this[_0x54e6('0xe')],this[_0x54e6('0x25')]);};module[_0x54e6('0x26')]=Action;
\ No newline at end of file
index 9bd44cf..72e1719 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1ca8=['scheduledAt','dialBusyRetryFrequency','unlockAgent','activeContact','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','AgentReject','unlockContact','idContact','disableContact','[default]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','linkedid','callProgressDetectingAgent','object','reason','logAgent','NoSuchNumber','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','checkInBlack','Contact','phone','lookAgent','isEmpty','execCall','then','[Preview][execCall][success]','\x20IdHopper:\x20','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','unmonitored','execRun','pick','unlock','recallme','[Preview][checkIsBlackList]','Call\x20unsuccessful','validateContact','Agent','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','trim','dialCutDigit','getCallerId','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','channel','actionid','responsetime','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','isUndefined','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','bluebird','moment','../../../config/environment','../../../config/logger','preview','actionPreview','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','tail','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','blindtransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','available','loggedIn','sumBillable','sumHoldTime','total','unmanaged','abandoned','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','Trunk','active','callerid','Interval','stringify','md5','format','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','pTalking','paused','NOT_ACTIVE','logger','\x20is\x20not\x20active','IS_DISACTIVED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','booked','clearZombieChannels','hasOwnProperty','setMessage','clearZombieChannel','isNil','actions','info','Queue','queue','originated:\x20','UserId','VoiceQueueId','ListId','Action','status','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','[action]','size','recallMe','getContactRecallMe','length','scheduledat','run','logger2','catch','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryRecallClose]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','totalGlobal','logCustomer','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','createCustomerFinal','answertime','uniqueid','pTalking:\x20','custom:agentconnect','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','\x20Queue','Busy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','rescheduleContact'];(function(_0x19130d,_0x1bc97f){var _0x8e0c2b=function(_0x14708c){while(--_0x14708c){_0x19130d['push'](_0x19130d['shift']());}};_0x8e0c2b(++_0x1bc97f);}(_0x1ca8,0x7c));var _0x81ca=function(_0x35f211,_0x42aeb2){_0x35f211=_0x35f211-0x0;var _0xee876e=_0x1ca8[_0x35f211];return _0xee876e;};'use strict';var util=require(_0x81ca('0x0'));var _=require(_0x81ca('0x1'));var BPromise=require(_0x81ca('0x2'));var uuid=require('uuid');var moment=require(_0x81ca('0x3'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x81ca('0x4'));var logger=require(_0x81ca('0x5'))(_0x81ca('0x6'));var loggerAction=require(_0x81ca('0x5'))(_0x81ca('0x7'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Action=require('./action');var ut=require(_0x81ca('0x8'));config[_0x81ca('0x9')]=_[_0x81ca('0xa')](config[_0x81ca('0x9')],{'host':_0x81ca('0xb'),'port':0x18eb});var io=require(_0x81ca('0xc'))(new Redis(config[_0x81ca('0x9')]));var Sequence=function(){};Sequence[_0x81ca('0xd')]['enqueue']=function(_0x36a6fa){this[_0x81ca('0xe')]=this['tail']?this[_0x81ca('0xe')]['finally'](_0x36a6fa):_0x36a6fa();};function Preview(_0xdc8bfa){this[_0x81ca('0xf')]=new Sequence();this[_0x81ca('0x10')]=_0xdc8bfa[_0x81ca('0x11')];this['trunks']=_0xdc8bfa[_0x81ca('0x12')];this['actions']={};this[_0x81ca('0x13')]=_0xdc8bfa[_0x81ca('0x13')];this[_0x81ca('0x14')]=0x0;ami['on'](_0x81ca('0x15'),this['syncOriginateResponse'][_0x81ca('0x16')](this));ami['on'](_0x81ca('0x17'),this[_0x81ca('0x18')][_0x81ca('0x16')](this));ami['on'](_0x81ca('0x19'),this[_0x81ca('0x1a')][_0x81ca('0x16')](this));ami['on']('dialend',this[_0x81ca('0x1b')]['bind'](this));ami['on'](_0x81ca('0x1c'),this[_0x81ca('0x1d')]['bind'](this));ami['on'](_0x81ca('0x1e'),this[_0x81ca('0x1f')][_0x81ca('0x16')](this));ami['on'](_0x81ca('0x20'),this['syncAttendedTransfer'][_0x81ca('0x16')](this));ami['on'](_0x81ca('0x21'),this['syncBlindTransfer'][_0x81ca('0x16')](this));this[_0x81ca('0x22')](this['campaignsPreview']);}function emit(_0x3cc877,_0x19ab00,_0x28a7a9){io['to'](_0x3cc877)[_0x81ca('0x23')](_0x19ab00,_0x28a7a9);}function emitCampaignPreview(_0x341b2f){if(_0x341b2f[_0x81ca('0x24')]===_0x81ca('0x25')){var _0x546776={'id':_0x341b2f['id'],'name':_0x341b2f[_0x81ca('0x26')],'strategy':_0x341b2f[_0x81ca('0x27')],'answered':_0x341b2f[_0x81ca('0x28')],'available':_0x341b2f[_0x81ca('0x29')],'loggedIn':_0x341b2f[_0x81ca('0x2a')],'pTalking':_0x341b2f['pTalking'],'sumBillable':_0x341b2f[_0x81ca('0x2b')],'sumDuration':_0x341b2f['sumDuration'],'sumHoldTime':_0x341b2f[_0x81ca('0x2c')]||0x0,'talking':_0x341b2f['talking'],'total':_0x341b2f[_0x81ca('0x2d')],'type':_0x341b2f[_0x81ca('0x24')],'unmanaged':_0x341b2f[_0x81ca('0x2e')],'abandoned':_0x341b2f[_0x81ca('0x2f')],'waiting':_0x341b2f['waiting'],'loggedInDb':_0x341b2f['loggedInDb'],'dialActive':_0x341b2f[_0x81ca('0x30')],'dialMethod':_0x341b2f[_0x81ca('0x31')],'dialOriginateCallerIdName':_0x341b2f[_0x81ca('0x32')],'dialOriginateCallerIdNumber':_0x341b2f[_0x81ca('0x33')],'dialOriginateTimeout':_0x341b2f['dialOriginateTimeout'],'dialPrefix':_0x341b2f[_0x81ca('0x34')],'outboundAnswerAgiCallsDay':_0x341b2f[_0x81ca('0x35')],'outboundAnswerCallsDay':_0x341b2f['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x341b2f[_0x81ca('0x36')],'outboundBusyCallsDay':_0x341b2f[_0x81ca('0x37')],'outboundCongestionCallsDay':_0x341b2f[_0x81ca('0x38')],'outboundDropCallsDayACS':_0x341b2f[_0x81ca('0x39')],'outboundDropCallsDayCallersExit':_0x341b2f[_0x81ca('0x3a')],'outboundDropCallsDayTimeout':_0x341b2f[_0x81ca('0x3b')],'outboundNoAnswerCallsDay':_0x341b2f['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x341b2f['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x341b2f['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x341b2f[_0x81ca('0x3c')],'outboundRejectCallsDay':_0x341b2f[_0x81ca('0x3d')],'outboundUnknownCallsDay':_0x341b2f[_0x81ca('0x3e')],'predictiveIntervalAnsweredCalls':_0x341b2f['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x341b2f[_0x81ca('0x3f')],'predictiveIntervalAvgTalktime':_0x341b2f['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x341b2f[_0x81ca('0x40')],'predictiveIntervalDroppedCallsTimeout':_0x341b2f[_0x81ca('0x41')],'predictiveIntervalErlangCalls':_0x341b2f[_0x81ca('0x42')],'predictiveIntervalErlangCallsDroppedCalls':_0x341b2f[_0x81ca('0x43')],'predictiveIntervalHitRate':_0x341b2f['predictiveIntervalHitRate'],'predictiveIntervalLowerLimit':_0x341b2f['predictiveIntervalLowerLimit'],'predictiveIntervalMultiplicativeFactor':_0x341b2f[_0x81ca('0x44')],'predictiveIntervalPauses':_0x341b2f[_0x81ca('0x45')],'predictiveIntervalTotalCalls':_0x341b2f[_0x81ca('0x46')],'message':_0x341b2f[_0x81ca('0x47')],'originated':_0x341b2f[_0x81ca('0x48')]};if(_0x341b2f[_0x81ca('0x49')]){_0x546776[_0x81ca('0x49')]={'id':_0x341b2f[_0x81ca('0x49')]['id'],'name':_0x341b2f['Trunk'][_0x81ca('0x26')],'active':_0x341b2f['Trunk'][_0x81ca('0x4a')],'callerid':_0x341b2f['Trunk'][_0x81ca('0x4b')]};}if(_0x341b2f[_0x81ca('0x4c')]){_0x546776[_0x81ca('0x4c')]={'id':_0x341b2f[_0x81ca('0x4c')]['id'],'name':_0x341b2f[_0x81ca('0x4c')][_0x81ca('0x26')]};}var _0x34b4a4=md5(JSON[_0x81ca('0x4d')](_0x546776));if(_0x341b2f[_0x81ca('0x4e')]!==_0x34b4a4){_0x341b2f[_0x81ca('0x4e')]=_0x34b4a4;emit(util[_0x81ca('0x4f')](_0x81ca('0x50'),_0x546776[_0x81ca('0x26')]),'voice_queue:save',_0x546776);}}}function emitVoiceQueueChannelRemove(_0x264427){emit(util[_0x81ca('0x4f')]('voice:queue:%s',_0x264427[_0x81ca('0x26')]),_0x81ca('0x51'),_0x264427);}function notSendMessagesQueue(_0x12bd17){if(_0x12bd17[_0x81ca('0x52')]){if(_0x12bd17[_0x81ca('0x48')]===0x0&&_0x12bd17[_0x81ca('0x53')]===0x0){_0x12bd17['sendMessageOneNotActive']=![];_0x12bd17[_0x81ca('0x29')]=0x0;_0x12bd17[_0x81ca('0x54')]=0x0;_0x12bd17['message']=_0x81ca('0x55');ut[_0x81ca('0x56')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x12bd17[_0x81ca('0x26')]+_0x81ca('0x57'));}else{_0x12bd17[_0x81ca('0x47')]=_0x81ca('0x58');ut[_0x81ca('0x56')](_0x81ca('0x59'),_0x12bd17[_0x81ca('0x26')]+_0x81ca('0x5a'));}emitCampaignPreview(_0x12bd17);}}Preview[_0x81ca('0xd')][_0x81ca('0x22')]=function(){var _0x1b3a44=this;setInterval(function(){_0x1b3a44['syncCampaigns']();},0x7cf);};Preview[_0x81ca('0xd')]['syncCampaigns']=function(){var _0x168940=this[_0x81ca('0x10')];this[_0x81ca('0x14')]+=0x1;for(var _0x4282bb in _0x168940){if(_0x168940['hasOwnProperty'](_0x4282bb)&&(_0x168940[_0x4282bb][_0x81ca('0x31')]==='preview'||_0x168940[_0x4282bb]['dialMethod']===_0x81ca('0x5b'))&&_0x168940[_0x4282bb][_0x81ca('0x24')]===_0x81ca('0x25')){if(this[_0x81ca('0x14')]>0x7){this[_0x81ca('0x14')]=0x0;this[_0x81ca('0x5c')]();}}if(_0x168940[_0x81ca('0x5d')](_0x4282bb)&&_0x168940[_0x4282bb][_0x81ca('0x31')]===_0x81ca('0x6')&&_0x168940[_0x4282bb][_0x81ca('0x24')]===_0x81ca('0x25')){if(_0x168940[_0x4282bb]['dialActive']){this[_0x81ca('0x5e')](_0x168940[_0x4282bb]);this['recallMe'](_0x168940[_0x4282bb]);}else{notSendMessagesQueue(_0x168940[_0x4282bb]);}}}};Preview[_0x81ca('0xd')][_0x81ca('0x5f')]=function(_0x385ef2){var _0x4df872=this;this[_0x81ca('0xf')]['enqueue'](function(){if(!_[_0x81ca('0x60')](_0x4df872[_0x81ca('0x61')][_0x385ef2])){loggerAction[_0x81ca('0x62')]('[clearZombieChannels][talking]',_0x385ef2,_0x81ca('0x63'),_0x4df872['actions'][_0x385ef2][_0x81ca('0x64')],_0x81ca('0x65'),JSON['stringify'](_0x4df872[_0x81ca('0x10')][_0x4df872[_0x81ca('0x61')][_0x385ef2][_0x81ca('0x64')]]['originated']),'pTalking:\x20',JSON['stringify'](_0x4df872[_0x81ca('0x10')][_0x4df872[_0x81ca('0x61')][_0x385ef2][_0x81ca('0x64')]][_0x81ca('0x53')]),JSON[_0x81ca('0x4d')](_0x4df872[_0x81ca('0x61')][_0x385ef2]['dialAnswer']),JSON[_0x81ca('0x4d')](_['pick'](_0x4df872[_0x81ca('0x61')][_0x385ef2],['contactId',_0x81ca('0x66'),_0x81ca('0x67'),_0x81ca('0x68')])));return ami[_0x81ca('0x69')]({'action':_0x81ca('0x6a'),'channel':_0x4df872[_0x81ca('0x61')][_0x385ef2]['channel']})['catch'](function(_0x4d3129){if(_0x4d3129[_0x81ca('0x47')]===_0x81ca('0x6b')){setTimeout(function(){if(_0x4df872[_0x81ca('0x61')][_0x385ef2]){ut[_0x81ca('0x6c')](_0x4df872['campaignsPreview'][_0x4df872[_0x81ca('0x61')][_0x385ef2]['queue']],_0x81ca('0x6d'));if(_0x4df872[_0x81ca('0x61')][_0x385ef2][_0x81ca('0x6e')]===!![]){ut[_0x81ca('0x6f')](_0x4df872[_0x81ca('0x10')][_0x4df872['actions'][_0x385ef2][_0x81ca('0x64')]],_0x81ca('0x6d'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x385ef2,_0x4df872[_0x81ca('0x61')][_0x385ef2][_0x81ca('0x64')]);}ut[_0x81ca('0x70')](_0x81ca('0x71')+_0x385ef2,_0x4df872[_0x81ca('0x61')][_0x385ef2][_0x81ca('0x64')]);delete _0x4df872[_0x81ca('0x61')][_0x385ef2];}},0x2328);}});}});};Preview[_0x81ca('0xd')][_0x81ca('0x5c')]=function(){var _0x426123=this;loggerAction[_0x81ca('0x62')](_0x81ca('0x72'),_[_0x81ca('0x73')](this[_0x81ca('0x61')]));for(var _0x6c6737 in this[_0x81ca('0x61')]){if(_0x426123['actions'][_0x81ca('0x5d')](_0x6c6737)){_0x426123['clearZombieChannel'](_0x6c6737);}}};Preview[_0x81ca('0xd')][_0x81ca('0x74')]=function(_0xce4460){var _0x47d496=this;rpcDb[_0x81ca('0x75')](_0xce4460['id'],ut['agentReadyId'](this['agents']))['then'](function(_0x4082a0){if(!_['isNil'](_0x4082a0)){for(var _0x5de99b=0x0;_0x5de99b<_0x4082a0[_0x81ca('0x76')];_0x5de99b+=0x1){if(ut['getDiff'](_0x4082a0[_0x5de99b][_0x81ca('0x77')])<_0xce4460['dialRecallMeTimeout']*0x3c){_0x47d496[_0x81ca('0x78')](_0x4082a0[_0x5de99b]['id'])['then'](ut[_0x81ca('0x79')]('[RecallMe]'))[_0x81ca('0x7a')](ut[_0x81ca('0x79')](_0x81ca('0x7b')));}else{var _0x3e3975=new Action(_0x4082a0[_0x5de99b],_0xce4460);_0x3e3975[_0x81ca('0x7c')]=moment()[_0x81ca('0x4f')](_0x81ca('0x7d'));_0xce4460[_0x81ca('0x3c')]+=0x1;ut['logCustomer'](_0x3e3975,0x17,_0x81ca('0x7e'));if(_0xce4460[_0x81ca('0x7f')]){rpcDb[_0x81ca('0x80')](ut[_0x81ca('0x81')](_0x4082a0[_0x5de99b]));rpcDb[_0x81ca('0x82')](_0x3e3975,'[HistoryDialRecallInQueue][historyCatch]');}else{ut['logCustomer'](_0x3e3975,0x16,'RecallFailedTimeout');rpcDb[_0x81ca('0x82')](_0x3e3975,_0x81ca('0x83'));rpcDb['createCustomerFinal'](_0x3e3975,_0x81ca('0x83'));}}}}})[_0x81ca('0x7a')](ut['logger2']('[getContactRecallMe]'));};Preview[_0x81ca('0xd')][_0x81ca('0x5e')]=function(_0x1f12b5){_0x1f12b5[_0x81ca('0x52')]=!![];if(ut[_0x81ca('0x84')](_0x1f12b5['loggedIn'])){_0x1f12b5[_0x81ca('0x47')]=_0x81ca('0x85');}else if(!ut[_0x81ca('0x86')](_0x1f12b5[_0x81ca('0x30')])){_0x1f12b5[_0x81ca('0x47')]=_0x81ca('0x55');}else if(!this[_0x81ca('0x87')](_0x1f12b5[_0x81ca('0x49')])){if(!this['isTrunkReachable'](_0x1f12b5[_0x81ca('0x88')])){_0x1f12b5[_0x81ca('0x47')]=_0x81ca('0x89');}else{_0x1f12b5[_0x81ca('0x47')]='ACTIVE';}}else{_0x1f12b5[_0x81ca('0x47')]=_0x81ca('0x8a');}emitCampaignPreview(_0x1f12b5);};Preview['prototype'][_0x81ca('0x8b')]=function(_0x24dc44,_0x12a803,_0x26d63a){var _0x1f4223=this;var _0x51d396=this[_0x81ca('0x61')][_0x12a803];var _0x165467=this[_0x81ca('0x10')][_0x51d396[_0x81ca('0x64')]];var _0x2a732f;if(_0x165467){switch(_0x26d63a){case'1':_0x165467['outboundNoSuchCallsDay']+=0x1;_0x51d396['countglobal']=ut[_0x81ca('0x8c')](_0x51d396);ut[_0x81ca('0x8d')](_0x51d396,0x0,'NoSuchNumber');rpcDb[_0x81ca('0x82')](_0x51d396,'[callProgressDetectingCustomer][logNoSuch]');if(ut['totalGlobal'](_0x51d396)>=_0x165467[_0x81ca('0x8e')]){_0x2a732f=ut['cloneAction'](_0x51d396,0xf,_0x81ca('0x8f'));rpcDb['createCustomerFinal'](_0x2a732f,_0x81ca('0x90'));}else{rpcDb[_0x81ca('0x91')](_0x51d396,'[callProgressDetectingCustomer][logNoSuchGlobal]');}delete this[_0x81ca('0x61')][_0x24dc44['linkedid']];break;case'ANSWER':var _0xace10b=moment()[_0x81ca('0x4f')](_0x81ca('0x7d'));_0x51d396['responsetime']=_0xace10b;_0x51d396[_0x81ca('0x92')]=_0xace10b;_0x51d396[_0x81ca('0x6e')]=!![];_0x165467[_0x81ca('0x53')]+=0x1;logger[_0x81ca('0x62')]('[syncHangup][talking][increment]',_0x51d396[_0x81ca('0x93')],'\x20Queue',_0x165467[_0x81ca('0x26')],_0x81ca('0x94'),_0x165467[_0x81ca('0x53')]);ami[_0x81ca('0x23')](_0x81ca('0x95'),ut[_0x81ca('0x96')](_0x51d396,_0x81ca('0x97')));if(_0x165467[_0x81ca('0x98')]){ami[_0x81ca('0x23')](_0x81ca('0x99'),ut[_0x81ca('0x9a')](_0x51d396));}break;case'16':ami['emit'](_0x81ca('0x9b'),ut[_0x81ca('0x96')](_0x51d396,'complete'));emitVoiceQueueChannelRemove(ut[_0x81ca('0x96')](_0x51d396,_0x81ca('0x9c')));_0x165467[_0x81ca('0x9d')]+=0x1;_0x165467[_0x81ca('0x2d')]+=0x1;_0x165467[_0x81ca('0x28')]+=0x1;ut[_0x81ca('0x6f')](_0x165467,'[16]');_0x51d396[_0x81ca('0x9e')]=ut[_0x81ca('0x8c')](_0x51d396);ut[_0x81ca('0x8d')](_0x51d396,0x4,_0x81ca('0x9f'));rpcDb[_0x81ca('0x82')](_0x51d396,_0x81ca('0xa0'));rpcDb['createCustomerFinal'](_0x51d396,_0x81ca('0xa1'));rpcDb[_0x81ca('0xa2')](_0x51d396);_0x165467[_0x81ca('0xa3')]+=_0x51d396[_0x81ca('0xa4')];_0x165467[_0x81ca('0x2b')]+=_0x51d396[_0x81ca('0xa4')];logger[_0x81ca('0x62')](_0x81ca('0xa5'),_0x51d396[_0x81ca('0x93')],_0x81ca('0xa6'),_0x165467['name'],_0x81ca('0x94'),_0x165467[_0x81ca('0x53')]);delete this['actions'][_0x24dc44['linkedid']];break;case'BUSY':_0x165467['outboundBusyCallsDay']+=0x1;_0x51d396['countbusyretry']+=0x1;_0x51d396[_0x81ca('0x9e')]=ut[_0x81ca('0x8c')](_0x51d396);ut[_0x81ca('0x8d')](_0x51d396,0x5,_0x81ca('0xa7'));rpcDb[_0x81ca('0x82')](_0x51d396,_0x81ca('0xa8'));if(ut[_0x81ca('0x8c')](_0x51d396)>=_0x165467['dialGlobalMaxRetry']){_0x2a732f=ut[_0x81ca('0xa9')](_0x51d396,0xf,_0x81ca('0x8f'));rpcDb['createCustomerFinal'](_0x2a732f,_0x81ca('0xaa'));}else{if(_0x51d396[_0x81ca('0xab')]>=_0x165467[_0x81ca('0xac')]){rpcDb[_0x81ca('0x91')](_0x51d396,_0x81ca('0xa8'));}else{rpcDb[_0x81ca('0xad')](ut[_0x81ca('0xae')](_0x51d396,_0x81ca('0xab'),_0x165467[_0x81ca('0xaf')]),_0x51d396[_0x81ca('0xb0')],_0x51d396[_0x81ca('0xb1')]);}}break;case _0x81ca('0xb2'):_0x165467[_0x81ca('0xb3')]+=0x1;_0x51d396[_0x81ca('0xb4')]+=0x1;_0x51d396['countglobal']=ut[_0x81ca('0x8c')](_0x51d396);ut['logCustomer'](_0x51d396,0x3,'NoAnswer');rpcDb[_0x81ca('0x82')](_0x51d396,_0x81ca('0xb5'));if(ut[_0x81ca('0x8c')](_0x51d396)>=_0x165467['dialGlobalMaxRetry']){_0x2a732f=ut[_0x81ca('0xa9')](_0x51d396,0xf,_0x81ca('0x8f'));rpcDb[_0x81ca('0x91')](_0x2a732f,_0x81ca('0xb6'));}else{if(_0x51d396[_0x81ca('0xb4')]>=_0x165467['dialNoAnswerMaxRetry']){rpcDb[_0x81ca('0x91')](_0x51d396,_0x81ca('0xb5'));}else{rpcDb[_0x81ca('0xad')](ut[_0x81ca('0xae')](_0x51d396,_0x81ca('0xb4'),_0x165467[_0x81ca('0xb7')]),_0x51d396[_0x81ca('0xb0')],_0x51d396[_0x81ca('0xb1')]);}}break;case _0x81ca('0xb8'):_0x165467[_0x81ca('0x38')]+=0x1;_0x51d396[_0x81ca('0xb9')]+=0x1;_0x51d396[_0x81ca('0x9e')]=ut['totalGlobal'](_0x51d396);ut[_0x81ca('0x8d')](_0x51d396,0x8,_0x81ca('0xba'));rpcDb['createCustomerHistory'](_0x51d396,_0x81ca('0xbb'));if(ut[_0x81ca('0x8c')](_0x51d396)>=_0x165467[_0x81ca('0x8e')]){_0x2a732f=ut[_0x81ca('0xa9')](_0x51d396,0xf,_0x81ca('0x8f'));rpcDb[_0x81ca('0x91')](_0x2a732f,_0x81ca('0xbc'));}else{if(_0x51d396[_0x81ca('0xb9')]>=_0x165467[_0x81ca('0xbd')]){rpcDb[_0x81ca('0x91')](_0x51d396,_0x81ca('0xbb'));}else{rpcDb[_0x81ca('0xad')](ut[_0x81ca('0xae')](_0x51d396,_0x81ca('0xb9'),_0x165467['dialBusyRetryFrequency']),_0x51d396[_0x81ca('0xb0')],_0x51d396['activeContact']);}}break;case _0x81ca('0xbe'):_0x165467['outboundRejectCallsDay']+=0x1;_0x51d396['countglobal']=ut[_0x81ca('0x8c')](_0x51d396);ut[_0x81ca('0x8d')](_0x51d396,0x14,_0x81ca('0xbf'));rpcDb[_0x81ca('0x82')](_0x51d396,'[syncHangupRequest][logAgentReject]');if(_0x51d396[_0x81ca('0xb0')]){rpcDb[_0x81ca('0xc0')](_0x51d396[_0x81ca('0xc1')]);}if(_0x51d396[_0x81ca('0xb1')]){rpcDb[_0x81ca('0xc2')](_0x51d396[_0x81ca('0xc1')]);}break;default:if(_0x51d396['dialAnswer']){ut[_0x81ca('0x6f')](_0x165467,_0x81ca('0xc3'));ut[_0x81ca('0x70')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x165467[_0x81ca('0x26')],_0x24dc44);}_0x165467[_0x81ca('0x3e')]+=0x1;_0x51d396['countglobal']=ut[_0x81ca('0x8c')](_0x51d396);ut[_0x81ca('0x8d')](_0x51d396,0xc,_0x24dc44[_0x81ca('0xc4')]||_0x24dc44[_0x81ca('0xc5')]);rpcDb['createCustomerHistory'](_0x51d396,_0x81ca('0xc6'));if(ut[_0x81ca('0x8c')](_0x51d396)>=_0x165467[_0x81ca('0x8e')]){_0x2a732f=ut[_0x81ca('0xa9')](_0x51d396,0xf,_0x81ca('0x8f'));rpcDb[_0x81ca('0x91')](_0x2a732f,_0x81ca('0xc7'));}else{rpcDb[_0x81ca('0x91')](_0x51d396,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x81ca('0x61')][_0x24dc44['linkedid']];}if(!(_0x51d396[_0x81ca('0x6e')]&&_0x26d63a==='16')){ut[_0x81ca('0x6c')](_0x165467,_0x81ca('0xc8'));logger[_0x81ca('0x62')](_0x81ca('0xc9'),_0x51d396['uniqueid'],'\x20Queue',_0x165467['name'],_0x81ca('0x65'),_0x165467['originated']);}if(_0x26d63a!==_0x81ca('0xca')){delete this['actions'][_0x24dc44[_0x81ca('0xcb')]];delete this[_0x81ca('0x61')][_0x24dc44['destlinkedid']];}}};Preview[_0x81ca('0xd')][_0x81ca('0xcc')]=function(_0x291de7,_0x40650d,_0xdd04ba){if(_['isUndefined'](_0x40650d)&&_0x81ca('0xcd')!==typeof _0x40650d){return;}if(_['isUndefined'](_0xdd04ba)&&_0x81ca('0xcd')!==typeof _0xdd04ba){return;}switch(_0xdd04ba[_0x81ca('0xce')]){case'0':ut[_0x81ca('0xcf')](_0x291de7,0x0,_0x81ca('0xd0'));rpcDb['createAgentHistory'](_0x291de7,_0x81ca('0xd1'));break;case'3':ut['logAgent'](_0x291de7,0x3,_0x81ca('0xd2'));rpcDb[_0x81ca('0xd3')](_0x291de7,_0x81ca('0xd4'));break;case'5':ut[_0x81ca('0xcf')](_0x291de7,0x5,_0x81ca('0xa7'));rpcDb[_0x81ca('0xd3')](_0x291de7,_0x81ca('0xd5'));break;case'8':ut['logAgent'](_0x291de7,0x8,_0x81ca('0xba'));rpcDb[_0x81ca('0xd3')](_0x291de7,_0x81ca('0xd6'));break;case'22':ut[_0x81ca('0xcf')](_0x291de7,0x16,_0x81ca('0xd7'));rpcDb[_0x81ca('0xd3')](_0x291de7,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0x291de7,0xc,_0xdd04ba[_0x81ca('0xce')]);rpcDb[_0x81ca('0xd3')](_0x291de7,'[callProgressDetectingAgent][logCongestion]');}ut[_0x81ca('0x6c')](_0x40650d,'[callProgressDetectingAgent]');logger[_0x81ca('0x62')]('[originated][decrement][callProgressDetectingAgent]',_0x291de7[_0x81ca('0x93')],_0x81ca('0xa6'),_0x40650d['name'],_0x81ca('0x65'),_0x40650d['originated']);delete this[_0x81ca('0x61')][_0x291de7[_0x81ca('0x93')]];};Preview[_0x81ca('0xd')][_0x81ca('0xd8')]=function(_0x2a507e,_0x294eb0,_0x5f03ab,_0x310d8e,_0x3a4aa6){var _0x15952b=this;return new BPromise(function(_0x370d4c,_0x465c30){if(_[_0x81ca('0x60')](_0x294eb0)||_[_0x81ca('0x60')](_0x294eb0['Contact'])||_['isNil'](_0x294eb0[_0x81ca('0xd9')][_0x81ca('0xda')])||_['isNil'](_0x294eb0['VoiceQueueId'])){_0x465c30(ut['message']('Contact\x20is\x20undefined',_0x310d8e,_0x3a4aa6));return;}var _0x31440c=uuid['v4']();var _0x3baefc=_0x15952b[_0x81ca('0x10')][_0x294eb0[_0x81ca('0x63')][_0x81ca('0x26')]];var _0x59be30=_0x5f03ab?_0x15952b[_0x81ca('0x13')][_0x5f03ab]['id']:undefined;_0x15952b[_0x81ca('0x61')][_0x31440c]=new Action(_0x294eb0,_0x3baefc,_0x31440c,_0x5f03ab,_0x59be30);var _0x3cd88f=_0x15952b['actions'][_0x31440c];_0x3cd88f[_0x81ca('0xb0')]=_0x310d8e;_0x3cd88f[_0x81ca('0xb1')]=_0x3a4aa6;_0x3cd88f[_0x81ca('0xdb')]=_0x5f03ab;if(_[_0x81ca('0xdc')](_0x2a507e)){_0x15952b[_0x81ca('0xdd')](_0x3cd88f,_0x3baefc,_0x294eb0,_0x5f03ab)[_0x81ca('0xde')](function(_0x2d5bb4){logger['info'](_0x81ca('0xdf'),'Queue:\x20'+_0x3cd88f[_0x81ca('0x64')]+_0x81ca('0xe0')+_0x3cd88f[_0x81ca('0xc1')],JSON[_0x81ca('0x4d')](_0x2d5bb4));ami[_0x81ca('0x23')]('custom:agentcalled',ut['buildObj'](_0x3cd88f,'called'));_0x370d4c(ut[_0x81ca('0x47')](_0x81ca('0xe1')));})['catch'](function(_0x2d029e){ut[_0x81ca('0x56')](_0x81ca('0xe2'),_0x2d029e);_0x465c30(ut[_0x81ca('0x47')](_0x81ca('0xe3'),_0x310d8e,_0x3a4aa6));});}else{_0x3baefc['outboundBlacklistCallsDay']+=0x1;ut[_0x81ca('0xe4')](_0x3cd88f);rpcDb[_0x81ca('0xe5')](_0x3cd88f,_0x81ca('0xe6'));delete _0x15952b[_0x81ca('0x61')][_0x31440c];_0x465c30(ut[_0x81ca('0x47')](_0x81ca('0xe7'),_0x310d8e,_0x3a4aa6));}});};Preview['prototype'][_0x81ca('0x87')]=function(_0x37c2e9){return!_['isNil'](_0x37c2e9)&&!_[_0x81ca('0x60')](_0x37c2e9[_0x81ca('0x26')])&&!_['isNil'](_0x37c2e9['active'])&&_0x37c2e9[_0x81ca('0x4a')]&&!_[_0x81ca('0x60')](this[_0x81ca('0x12')][util[_0x81ca('0x4f')](_0x81ca('0xe8'),_0x37c2e9[_0x81ca('0x26')])])&&!_[_0x81ca('0x60')](this['trunks'][util[_0x81ca('0x4f')](_0x81ca('0xe8'),_0x37c2e9[_0x81ca('0x26')])][_0x81ca('0x6a')])&&(this['trunks'][util['format'](_0x81ca('0xe8'),_0x37c2e9[_0x81ca('0x26')])][_0x81ca('0x6a')]==='reachable'||this[_0x81ca('0x12')][util['format'](_0x81ca('0xe8'),_0x37c2e9['name'])]['status']===_0x81ca('0xe9'));};Preview['prototype'][_0x81ca('0x78')]=function(_0x3bb19e,_0x34790a){var _0x41f00c=this;return new BPromise(function(_0x292d50,_0x122d48){_0x41f00c[_0x81ca('0xea')](_0x3bb19e,_0x34790a)[_0x81ca('0xde')](function(_0x15d042){_0x292d50(_[_0x81ca('0xeb')](_0x15d042,['message']));})[_0x81ca('0x7a')](function(_0x3c1906){if(_0x3c1906[_0x81ca('0xec')]){rpcDb[_0x81ca('0xc0')](_0x3bb19e);}if(_0x3c1906[_0x81ca('0x4a')]){rpcDb[_0x81ca('0xc2')](_0x3bb19e);}_0x122d48(_[_0x81ca('0xeb')](_0x3c1906,[_0x81ca('0x47')]));});});};Preview[_0x81ca('0xd')][_0x81ca('0xea')]=function(_0x5681d2,_0x323a1d){var _0x3caaab=this;return new BPromise(function(_0x5c7c32,_0x548410){var _0x7a3f6e,_0x1df2b1;rpcDb['getContactPreview'](_0x5681d2)[_0x81ca('0xde')](function(_0x216547){if(!_[_0x81ca('0x60')](_0x216547[0x0])){_0x1df2b1=_0x216547[0x0]['recallme']?![]:!![];_0x7a3f6e=_0x216547[0x0][_0x81ca('0xed')]?!![]:![];_0x7a3f6e=_0x323a1d?!![]:_0x7a3f6e;}var _0x2e0edf=_0x3caaab['validateContact'](_0x216547);if(_0x2e0edf['isValid']){rpcDb['checkIsBlackList'](_[_0x81ca('0xeb')](_0x216547[0x0],[_0x81ca('0x67'),'Contact.phone']))['then'](function(_0x1b6507){_0x3caaab[_0x81ca('0xd8')](_0x1b6507,_0x216547[0x0],_0x323a1d,_0x1df2b1,_0x7a3f6e)[_0x81ca('0xde')](function(_0xc78f82){_0x5c7c32(_0xc78f82);})[_0x81ca('0x7a')](function(_0x2403e6){_0x548410(_0x2403e6);});})[_0x81ca('0x7a')](function(_0x44978c){ut['logger'](_0x81ca('0xee'),_0x44978c);_0x548410(ut['message']('Call\x20unsuccessful',_0x1df2b1,_0x7a3f6e));});}else{_0x548410(ut[_0x81ca('0x47')](_0x2e0edf[_0x81ca('0x47')],_0x1df2b1,_0x7a3f6e));}})[_0x81ca('0x7a')](function(_0x47cb1a){ut[_0x81ca('0x56')]('[Preview][getContactPreview]',_0x47cb1a);_0x548410(ut['message'](_0x81ca('0xef'),![],!![]));});});};Preview[_0x81ca('0xd')][_0x81ca('0xf0')]=function(_0x53e9d3){if(_[_0x81ca('0x60')](_0x53e9d3)||_['isEmpty'](_0x53e9d3)||!_['isNil'](_0x53e9d3[0x0]['Agent'])&&_[_0x81ca('0x60')](_0x53e9d3[0x0][_0x81ca('0xf1')][_0x81ca('0x26')])){ut[_0x81ca('0x56')]('[Preview][validateContact][Empty\x20Contact]',_0x53e9d3);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x69d396=this[_0x81ca('0x10')][_0x53e9d3[0x0][_0x81ca('0x63')]['name']];_0x69d396[_0x81ca('0x47')]='ACTIVE';if(_[_0x81ca('0x60')](_0x69d396)){ut[_0x81ca('0x56')]('[Preview][validateContact][Empty\x20Campaign]',_0x69d396);return{'isValid':![],'message':_0x81ca('0xf2')};}if(!this['isTrunkReachable'](_0x69d396[_0x81ca('0x49')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0x81ca('0xf3')+_0x69d396['name']+_0x81ca('0xf4'));if(!this[_0x81ca('0x87')](_0x69d396[_0x81ca('0x88')])){ut['logger'](_0x81ca('0xf5'),_0x69d396[_0x81ca('0x26')]+_0x81ca('0xf6'));return{'isValid':![],'message':_0x81ca('0xf7')};}}if(!ut[_0x81ca('0x86')](_0x69d396[_0x81ca('0x30')])){ut[_0x81ca('0x56')](_0x81ca('0xf8'),_0x69d396[_0x81ca('0x26')]+_0x81ca('0xf9'));return{'isValid':![],'message':_0x81ca('0xf3')+_0x69d396[_0x81ca('0x26')]+_0x81ca('0xf9')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x81ca('0xd')]['execCall']=function(_0x54a78f,_0x33672b,_0x9d5921,_0x152c5e){var _0x1faa90=this;return new BPromise(function(_0x12745e,_0x1dac60){var _0x15100f=_0x54a78f['uniqueid'];var _0xa9aedd=_0x1faa90[_0x81ca('0x87')](_0x33672b[_0x81ca('0x49')])?util['format']('SIP/%s/%s%s',_0x33672b[_0x81ca('0x49')][_0x81ca('0x26')],_[_0x81ca('0x60')](_0x33672b['dialPrefix'])?'':_0x33672b[_0x81ca('0x34')][_0x81ca('0xfa')]()||'',_0x33672b['dialCutDigit']>0x0?_0x9d5921[_0x81ca('0xd9')]['phone']['substring'](_0x33672b['dialCutDigit']):_0x9d5921[_0x81ca('0xd9')][_0x81ca('0xda')]):util[_0x81ca('0x4f')]('SIP/%s/%s%s',_[_0x81ca('0x60')](_0x33672b[_0x81ca('0x88')])?_0x33672b['Trunk'][_0x81ca('0x26')]:_0x33672b[_0x81ca('0x88')][_0x81ca('0x26')],_[_0x81ca('0x60')](_0x33672b[_0x81ca('0x34')])?'':_0x33672b[_0x81ca('0x34')][_0x81ca('0xfa')]()||'',_0x33672b[_0x81ca('0xfb')]>0x0?_0x9d5921[_0x81ca('0xd9')][_0x81ca('0xda')]['substring'](_0x33672b[_0x81ca('0xfb')]):_0x9d5921[_0x81ca('0xd9')][_0x81ca('0xda')]);var _0x1ec5ed=_0x1faa90['isTrunkReachable'](_0x33672b[_0x81ca('0x49')])?ut[_0x81ca('0xfc')](_0x33672b[_0x81ca('0x49')][_0x81ca('0x4b')],_0x33672b['dialOriginateCallerIdName'],_0x33672b['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x33672b[_0x81ca('0x33')],_0x33672b['dialRandomLastDigitCallerIdNumber']):_0x33672b[_0x81ca('0x33')]):ut[_0x81ca('0xfc')](_[_0x81ca('0x60')](_0x33672b[_0x81ca('0x88')])?_0x33672b[_0x81ca('0x49')][_0x81ca('0x4b')]:_0x33672b[_0x81ca('0x88')][_0x81ca('0x4b')],_0x33672b[_0x81ca('0x32')],_0x33672b['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x33672b[_0x81ca('0x33')],_0x33672b[_0x81ca('0xfd')]):_0x33672b['dialOriginateCallerIdNumber']);if(_0x1ec5ed){_0x54a78f[_0x81ca('0xfe')]=ut[_0x81ca('0xff')](_0x1ec5ed);_0x54a78f[_0x81ca('0x100')]=ut[_0x81ca('0x101')](_0x1ec5ed);}var _0x427448=ut[_0x81ca('0x102')](_0x33672b,_0x9d5921,_0xa9aedd,_0x1ec5ed,_0x15100f,_0x54a78f);_[_0x81ca('0x103')](_0x54a78f,ut[_0x81ca('0x104')](_0x427448));_0x54a78f[_0x81ca('0x7c')]=moment()[_0x81ca('0x4f')](_0x81ca('0x7d'));ami[_0x81ca('0x69')](ut[_0x81ca('0x105')](_0x54a78f,_0x33672b,_0x427448,_0x54a78f[_0x81ca('0xb1')],_0x152c5e))[_0x81ca('0xde')](function(_0xf27786){_0x33672b[_0x81ca('0x48')]+=0x1;logger[_0x81ca('0x62')](_0x81ca('0x106'),_0x15100f,_0x81ca('0xa6'),_0x33672b[_0x81ca('0x26')],'originated:\x20',_0x33672b[_0x81ca('0x48')]);_0x12745e(_0xf27786);})['catch'](function(_0x3d11d8){ut['logAgent'](_0x54a78f,0xe,_0x81ca('0x107'));rpcDb[_0x81ca('0xd3')](_0x54a78f,_0x81ca('0x108'));_0x1dac60(_0x3d11d8);});});};Preview[_0x81ca('0xd')][_0x81ca('0x1d')]=function(_0x47d111){if(this[_0x81ca('0x61')][_0x47d111[_0x81ca('0xcb')]]){this[_0x81ca('0x61')][_0x47d111[_0x81ca('0xcb')]][_0x81ca('0x109')]=_0x47d111[_0x81ca('0x109')];}};Preview[_0x81ca('0xd')]['syncOriginateResponse']=function(_0x531c99){var _0x27ad42=this;var _0x52f2ea=this[_0x81ca('0x61')][_0x531c99[_0x81ca('0x10a')]];if(_0x52f2ea){if(_0x52f2ea[_0x81ca('0xdb')]&&this['agents'][_0x52f2ea[_0x81ca('0xdb')]]){ut['logLookAgent'](_0x52f2ea,this[_0x81ca('0x13')][_0x52f2ea[_0x81ca('0xdb')]]['name'],this[_0x81ca('0x13')][_0x52f2ea[_0x81ca('0xdb')]]['id']);}var _0xfe136d=_['clone'](_0x52f2ea);_0xfe136d[_0x81ca('0x10b')]=moment()[_0x81ca('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');var _0x34bf5d=_0x27ad42[_0x81ca('0x10')][_0x52f2ea[_0x81ca('0x64')]];if(ut[_0x81ca('0x10c')](_0x531c99[_0x81ca('0x10d')])){if(_0x52f2ea[_0x81ca('0xb0')]){rpcDb['unlockContact'](_0x52f2ea[_0x81ca('0xc1')]);}if(_0x52f2ea[_0x81ca('0xb1')]){rpcDb[_0x81ca('0xc2')](_0x52f2ea[_0x81ca('0xc1')]);}ami[_0x81ca('0x23')](_0x81ca('0x10e'),ut[_0x81ca('0x96')](_0x52f2ea,_0x81ca('0x10f')));this['callProgressDetectingAgent'](_0xfe136d,_0x34bf5d,_0x531c99);}else{_0x52f2ea[_0x81ca('0x7c')]=moment()[_0x81ca('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x81ca('0xcf')](_0xfe136d,0x4,'Answer');rpcDb[_0x81ca('0xd3')](_0xfe136d,_0x81ca('0x110'));}}};Preview[_0x81ca('0xd')]['syncHangup']=function(_0x1453a8){var _0x55ce97=this;var _0x47c73d=this['actions'][_0x1453a8[_0x81ca('0xcb')]];var _0x316efd;if(_0x47c73d){_0x316efd=this[_0x81ca('0x10')][_0x47c73d['queue']];logger[_0x81ca('0x62')](_0x81ca('0x111'),_0x1453a8[_0x81ca('0xcb')],_0x81ca('0xa6'),_0x316efd[_0x81ca('0x26')],_0x81ca('0x94'),_0x316efd[_0x81ca('0x53')]);}if(this['actions'][_0x1453a8[_0x81ca('0xcb')]]&&_0x1453a8[_0x81ca('0xcb')]!==_0x1453a8['uniqueid']){if(_0x1453a8[_0x81ca('0x112')]==='16'&&this['actions'][_0x1453a8[_0x81ca('0xcb')]][_0x81ca('0x6e')]){this[_0x81ca('0x8b')](_0x1453a8,_0x1453a8[_0x81ca('0xcb')],_0x1453a8[_0x81ca('0x112')]);}else if(this[_0x81ca('0x61')][_0x1453a8[_0x81ca('0xcb')]][_0x81ca('0x6e')]){logger[_0x81ca('0x62')](_0x81ca('0x113'),_0x1453a8['linkedid'],_0x1453a8['cause'],_0x81ca('0xa6'),_0x316efd['name'],_0x81ca('0x94'),_0x316efd['pTalking']);this['callProgressDetectingCustomer'](_0x1453a8,_0x1453a8['linkedid'],_0x1453a8[_0x81ca('0x112')]);}}else if(_0x47c73d&&_[_0x81ca('0x60')](_0x47c73d[_0x81ca('0x114')])&&_0x316efd[_0x81ca('0x115')]&&_0x1453a8[_0x81ca('0xcb')]===_0x1453a8[_0x81ca('0x93')]&&_['isNil'](_0x1453a8[_0x81ca('0xce')])&&_0x1453a8[_0x81ca('0x112')]==='16'&&_0x1453a8[_0x81ca('0x116')]==='6'&&_[_0x81ca('0x117')](_0x47c73d[_0x81ca('0x118')])){if(_0x47c73d[_0x81ca('0xb0')]){rpcDb['unlockContact'](_0x47c73d[_0x81ca('0xc1')]);}if(_0x47c73d[_0x81ca('0xb1')]){rpcDb[_0x81ca('0xc2')](_0x47c73d[_0x81ca('0xc1')]);}_0x1453a8['reason']='22';this['callProgressDetectingAgent'](_0x47c73d,_0x316efd,_0x1453a8);}else if(_0x47c73d&&_0x47c73d[_0x81ca('0x118')]){if(_0x1453a8[_0x81ca('0x112')]==='16'&&this[_0x81ca('0x61')][_0x1453a8['linkedid']][_0x81ca('0x6e')]){logger['info'](_0x81ca('0x119'),_0x1453a8[_0x81ca('0xcb')],_0x1453a8['cause'],_0x81ca('0xa6'),_0x316efd[_0x81ca('0x26')],'pTalking:\x20',_0x316efd[_0x81ca('0x53')]);this[_0x81ca('0x8b')](_0x1453a8,_0x1453a8[_0x81ca('0xcb')],_0x1453a8[_0x81ca('0x112')]);}else if(this[_0x81ca('0x61')][_0x1453a8['linkedid']][_0x81ca('0x6e')]){logger[_0x81ca('0x62')]('[syncHangup][talking][cause]',_0x1453a8[_0x81ca('0xcb')],_0x1453a8['cause'],_0x81ca('0xa6'),_0x316efd[_0x81ca('0x26')],_0x81ca('0x94'),_0x316efd[_0x81ca('0x53')]);this['callProgressDetectingCustomer'](_0x1453a8,_0x1453a8[_0x81ca('0xcb')],_0x1453a8[_0x81ca('0x112')]);}}};Preview[_0x81ca('0xd')][_0x81ca('0x1b')]=function(_0x42ffea){if(this['actions'][_0x42ffea['destlinkedid']]&&_0x42ffea[_0x81ca('0x11a')]!==_0x42ffea[_0x81ca('0x11b')]){this[_0x81ca('0x8b')](_0x42ffea,_0x42ffea['destlinkedid'],_0x42ffea[_0x81ca('0xc5')]);}};Preview[_0x81ca('0xd')]['syncHangupRequest']=function(_0xf3f7b0){if(this[_0x81ca('0x61')][_0xf3f7b0['linkedid']]&&_0xf3f7b0['linkedid']!==_0xf3f7b0[_0x81ca('0x93')]&&!this[_0x81ca('0x61')][_0xf3f7b0[_0x81ca('0xcb')]]['dialAnswer']){if(_0xf3f7b0[_0x81ca('0x112')]==='1'){this['callProgressDetectingCustomer'](_0xf3f7b0,_0xf3f7b0[_0x81ca('0xcb')],_0xf3f7b0[_0x81ca('0x112')]);}}};Preview['prototype'][_0x81ca('0x11c')]=function(_0x1716bb,_0x3010b4,_0x4dd58e){if(this[_0x81ca('0x61')][_0x1716bb]){if(_['isNil'](this[_0x81ca('0x61')][_0x1716bb][_0x81ca('0x11d')])){this[_0x81ca('0x61')][_0x1716bb][_0x81ca('0x11d')]={};}this[_0x81ca('0x61')][_0x1716bb]['variables'][_0x3010b4]=_0x4dd58e;}};Preview[_0x81ca('0xd')]['syncVarSet']=function(_0x389e02){try{if(!_[_0x81ca('0x60')](_0x389e02)){if(ut[_0x81ca('0x11e')](_[_0x81ca('0x11f')](_0x389e02[_0x81ca('0x120')])[0x0])){this[_0x81ca('0x11c')](_0x389e02[_0x81ca('0x93')],_[_0x81ca('0x11f')](_0x389e02['variable'])[0x0],_0x389e02[_0x81ca('0x121')]);}}}catch(_0x557747){logger[_0x81ca('0x122')](_0x81ca('0x123'),util[_0x81ca('0x124')](_0x557747,{'showHidden':![],'depth':null}));}};Preview[_0x81ca('0xd')][_0x81ca('0x125')]=function(_0x2f7848){if(_0x2f7848){if(this[_0x81ca('0x61')][_0x2f7848[_0x81ca('0x126')]]){this[_0x81ca('0x61')][_0x2f7848[_0x81ca('0x126')]]['transfer']=!![];}}};Preview['prototype'][_0x81ca('0x127')]=function(_0x5aa141){if(_0x5aa141){if(this['actions'][_0x5aa141[_0x81ca('0x128')]]){this[_0x81ca('0x61')][_0x5aa141['transfererlinkedid']]['transfer']=!![];}}};module[_0x81ca('0x129')]=Preview;
\ No newline at end of file
+var _0x9a2b=['scheduledat','logger2','[RecallMe]','catch','starttime','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','linkedid','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','cloneAction','Global','dialBusyMaxRetry','rescheduleContact','scheduledAt','dialBusyRetryFrequency','unlockAgent','NOANSWER','countnoanswerretry','NoAnswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','activeContact','AgentReject','[syncHangupRequest][logAgentReject]','unlockContact','idContact','[default]','cause-txt','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','uniqueid','ANSWER','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','Contact','Contact\x20is\x20undefined','execCall','Queue:\x20','custom:agentcalled','called','Calling','logBlacklist','createHistory','active','SIP/%s','reachable','unmonitored','execRun','disableContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','Agent','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','Is\x20Valid','trim','dialCutDigit','phone','SIP/%s/%s%s','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','extractCalleridName','originatecalleridnum','extractCalleridNumber','toLowerVariables','YYYY-MM-DD\x20HH:mm:ss','OriginateError','[originateFailure][logOriginateFailure]','lookAgent','logLookAgent','response','custom:agentringnoanswer','rejected','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','dialstatus','variables','filterKey','keys','variable','[syncVarSet][Preview]','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','./rpcDb','./action','./util/util','redis','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','syncHangup','hanguprequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','name','answered','available','sumBillable','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','message','originated','Trunk','Interval','format','voice:queue:%s','voice_queue:save','voice_queue_channel:remove','sendMessageOneNotActive','pTalking','paused','logger','\x20is\x20not\x20active','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','syncCampaigns','clearZombieChannels','hasOwnProperty','dialActive','recallMe','clearZombieChannel','info','Queue','queue','originated:\x20','stringify','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][Preview]','[action]','agentReadyId','agents','then','isNil','length','getDiff'];(function(_0x307be0,_0x3a998b){var _0x73d507=function(_0x53cac5){while(--_0x53cac5){_0x307be0['push'](_0x307be0['shift']());}};_0x73d507(++_0x3a998b);}(_0x9a2b,0xac));var _0xb9a2=function(_0x5b6988,_0x67e002){_0x5b6988=_0x5b6988-0x0;var _0x4e2cc9=_0x9a2b[_0x5b6988];return _0x4e2cc9;};'use strict';var util=require(_0xb9a2('0x0'));var _=require(_0xb9a2('0x1'));var BPromise=require('bluebird');var uuid=require(_0xb9a2('0x2'));var moment=require('moment');var md5=require('md5');var Redis=require('ioredis');var config=require(_0xb9a2('0x3'));var logger=require('../../../config/logger')(_0xb9a2('0x4'));var loggerAction=require(_0xb9a2('0x5'))(_0xb9a2('0x6'));var ami=require('../ami');var rpcDb=require(_0xb9a2('0x7'));var Action=require(_0xb9a2('0x8'));var ut=require(_0xb9a2('0x9'));config[_0xb9a2('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xb9a2('0xb'))(new Redis(config[_0xb9a2('0xa')]));var Sequence=function(){};Sequence[_0xb9a2('0xc')][_0xb9a2('0xd')]=function(_0x4abdfd){this[_0xb9a2('0xe')]=this[_0xb9a2('0xe')]?this['tail'][_0xb9a2('0xf')](_0x4abdfd):_0x4abdfd();};function Preview(_0x119d54){this[_0xb9a2('0x10')]=new Sequence();this[_0xb9a2('0x11')]=_0x119d54[_0xb9a2('0x12')];this[_0xb9a2('0x13')]=_0x119d54['trunks'];this[_0xb9a2('0x14')]={};this['agents']=_0x119d54['agents'];this[_0xb9a2('0x15')]=0x0;ami['on'](_0xb9a2('0x16'),this[_0xb9a2('0x17')][_0xb9a2('0x18')](this));ami['on']('hangup',this[_0xb9a2('0x19')][_0xb9a2('0x18')](this));ami['on'](_0xb9a2('0x1a'),this['syncHangupRequest'][_0xb9a2('0x18')](this));ami['on'](_0xb9a2('0x1b'),this[_0xb9a2('0x1c')][_0xb9a2('0x18')](this));ami['on'](_0xb9a2('0x1d'),this[_0xb9a2('0x1e')][_0xb9a2('0x18')](this));ami['on'](_0xb9a2('0x1f'),this[_0xb9a2('0x20')][_0xb9a2('0x18')](this));ami['on'](_0xb9a2('0x21'),this[_0xb9a2('0x22')][_0xb9a2('0x18')](this));ami['on']('blindtransfer',this[_0xb9a2('0x23')][_0xb9a2('0x18')](this));this[_0xb9a2('0x24')](this[_0xb9a2('0x11')]);}function emit(_0x52e202,_0x2cbc30,_0x56b27c){io['to'](_0x52e202)[_0xb9a2('0x25')](_0x2cbc30,_0x56b27c);}function emitCampaignPreview(_0x1cef07){if(_0x1cef07['type']==='outbound'){var _0x3d6c92={'id':_0x1cef07['id'],'name':_0x1cef07[_0xb9a2('0x26')],'strategy':_0x1cef07['strategy'],'answered':_0x1cef07[_0xb9a2('0x27')],'available':_0x1cef07[_0xb9a2('0x28')],'loggedIn':_0x1cef07['loggedIn'],'pTalking':_0x1cef07['pTalking'],'sumBillable':_0x1cef07[_0xb9a2('0x29')],'sumDuration':_0x1cef07[_0xb9a2('0x2a')],'sumHoldTime':_0x1cef07[_0xb9a2('0x2b')]||0x0,'talking':_0x1cef07['talking'],'total':_0x1cef07[_0xb9a2('0x2c')],'type':_0x1cef07[_0xb9a2('0x2d')],'unmanaged':_0x1cef07[_0xb9a2('0x2e')],'abandoned':_0x1cef07[_0xb9a2('0x2f')],'waiting':_0x1cef07[_0xb9a2('0x30')],'loggedInDb':_0x1cef07[_0xb9a2('0x31')],'dialActive':_0x1cef07['dialActive'],'dialMethod':_0x1cef07[_0xb9a2('0x32')],'dialOriginateCallerIdName':_0x1cef07[_0xb9a2('0x33')],'dialOriginateCallerIdNumber':_0x1cef07[_0xb9a2('0x34')],'dialOriginateTimeout':_0x1cef07[_0xb9a2('0x35')],'dialPrefix':_0x1cef07[_0xb9a2('0x36')],'outboundAnswerAgiCallsDay':_0x1cef07['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x1cef07[_0xb9a2('0x37')],'outboundBlacklistCallsDay':_0x1cef07[_0xb9a2('0x38')],'outboundBusyCallsDay':_0x1cef07[_0xb9a2('0x39')],'outboundCongestionCallsDay':_0x1cef07[_0xb9a2('0x3a')],'outboundDropCallsDayACS':_0x1cef07[_0xb9a2('0x3b')],'outboundDropCallsDayCallersExit':_0x1cef07[_0xb9a2('0x3c')],'outboundDropCallsDayTimeout':_0x1cef07[_0xb9a2('0x3d')],'outboundNoAnswerCallsDay':_0x1cef07[_0xb9a2('0x3e')],'outboundNoSuchCallsDay':_0x1cef07['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x1cef07[_0xb9a2('0x3f')],'outboundReCallsDay':_0x1cef07['outboundReCallsDay'],'outboundRejectCallsDay':_0x1cef07[_0xb9a2('0x40')],'outboundUnknownCallsDay':_0x1cef07[_0xb9a2('0x41')],'predictiveIntervalAnsweredCalls':_0x1cef07[_0xb9a2('0x42')],'predictiveIntervalAvgHoldtime':_0x1cef07['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x1cef07['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x1cef07[_0xb9a2('0x43')],'predictiveIntervalDroppedCallsTimeout':_0x1cef07['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x1cef07[_0xb9a2('0x44')],'predictiveIntervalErlangCallsDroppedCalls':_0x1cef07[_0xb9a2('0x45')],'predictiveIntervalHitRate':_0x1cef07[_0xb9a2('0x46')],'predictiveIntervalLowerLimit':_0x1cef07['predictiveIntervalLowerLimit'],'predictiveIntervalMultiplicativeFactor':_0x1cef07[_0xb9a2('0x47')],'predictiveIntervalPauses':_0x1cef07[_0xb9a2('0x48')],'predictiveIntervalTotalCalls':_0x1cef07['predictiveIntervalTotalCalls'],'message':_0x1cef07[_0xb9a2('0x49')],'originated':_0x1cef07[_0xb9a2('0x4a')]};if(_0x1cef07[_0xb9a2('0x4b')]){_0x3d6c92[_0xb9a2('0x4b')]={'id':_0x1cef07[_0xb9a2('0x4b')]['id'],'name':_0x1cef07[_0xb9a2('0x4b')][_0xb9a2('0x26')],'active':_0x1cef07[_0xb9a2('0x4b')]['active'],'callerid':_0x1cef07[_0xb9a2('0x4b')]['callerid']};}if(_0x1cef07[_0xb9a2('0x4c')]){_0x3d6c92['Interval']={'id':_0x1cef07['Interval']['id'],'name':_0x1cef07[_0xb9a2('0x4c')][_0xb9a2('0x26')]};}var _0x3c12de=md5(JSON['stringify'](_0x3d6c92));if(_0x1cef07['md5']!==_0x3c12de){_0x1cef07['md5']=_0x3c12de;emit(util[_0xb9a2('0x4d')](_0xb9a2('0x4e'),_0x3d6c92[_0xb9a2('0x26')]),_0xb9a2('0x4f'),_0x3d6c92);}}}function emitVoiceQueueChannelRemove(_0x4afa7d){emit(util[_0xb9a2('0x4d')](_0xb9a2('0x4e'),_0x4afa7d[_0xb9a2('0x26')]),_0xb9a2('0x50'),_0x4afa7d);}function notSendMessagesQueue(_0x36c284){if(_0x36c284[_0xb9a2('0x51')]){if(_0x36c284[_0xb9a2('0x4a')]===0x0&&_0x36c284[_0xb9a2('0x52')]===0x0){_0x36c284[_0xb9a2('0x51')]=![];_0x36c284['available']=0x0;_0x36c284[_0xb9a2('0x53')]=0x0;_0x36c284[_0xb9a2('0x49')]='NOT_ACTIVE';ut[_0xb9a2('0x54')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x36c284['name']+_0xb9a2('0x55'));}else{_0x36c284[_0xb9a2('0x49')]='IS_DISACTIVED';ut[_0xb9a2('0x54')](_0xb9a2('0x56'),_0x36c284[_0xb9a2('0x26')]+_0xb9a2('0x57'));}emitCampaignPreview(_0x36c284);}}Preview[_0xb9a2('0xc')][_0xb9a2('0x24')]=function(){var _0x4fd690=this;setInterval(function(){_0x4fd690[_0xb9a2('0x58')]();},0x7cf);};Preview[_0xb9a2('0xc')][_0xb9a2('0x58')]=function(){var _0x56202a=this[_0xb9a2('0x11')];this[_0xb9a2('0x15')]+=0x1;for(var _0x4e2e69 in _0x56202a){if(_0x56202a['hasOwnProperty'](_0x4e2e69)&&(_0x56202a[_0x4e2e69][_0xb9a2('0x32')]===_0xb9a2('0x4')||_0x56202a[_0x4e2e69][_0xb9a2('0x32')]==='booked')&&_0x56202a[_0x4e2e69]['type']==='outbound'){if(this[_0xb9a2('0x15')]>0x7){this[_0xb9a2('0x15')]=0x0;this[_0xb9a2('0x59')]();}}if(_0x56202a[_0xb9a2('0x5a')](_0x4e2e69)&&_0x56202a[_0x4e2e69][_0xb9a2('0x32')]===_0xb9a2('0x4')&&_0x56202a[_0x4e2e69][_0xb9a2('0x2d')]==='outbound'){if(_0x56202a[_0x4e2e69][_0xb9a2('0x5b')]){this['setMessage'](_0x56202a[_0x4e2e69]);this[_0xb9a2('0x5c')](_0x56202a[_0x4e2e69]);}else{notSendMessagesQueue(_0x56202a[_0x4e2e69]);}}}};Preview[_0xb9a2('0xc')][_0xb9a2('0x5d')]=function(_0x190768){var _0x40817f=this;this[_0xb9a2('0x10')][_0xb9a2('0xd')](function(){if(!_['isNil'](_0x40817f[_0xb9a2('0x14')][_0x190768])){loggerAction[_0xb9a2('0x5e')]('[clearZombieChannels][talking]',_0x190768,_0xb9a2('0x5f'),_0x40817f['actions'][_0x190768][_0xb9a2('0x60')],_0xb9a2('0x61'),JSON[_0xb9a2('0x62')](_0x40817f['campaignsPreview'][_0x40817f[_0xb9a2('0x14')][_0x190768][_0xb9a2('0x60')]][_0xb9a2('0x4a')]),_0xb9a2('0x63'),JSON['stringify'](_0x40817f[_0xb9a2('0x11')][_0x40817f[_0xb9a2('0x14')][_0x190768][_0xb9a2('0x60')]][_0xb9a2('0x52')]),JSON[_0xb9a2('0x62')](_0x40817f[_0xb9a2('0x14')][_0x190768][_0xb9a2('0x64')]),JSON[_0xb9a2('0x62')](_[_0xb9a2('0x65')](_0x40817f[_0xb9a2('0x14')][_0x190768],[_0xb9a2('0x66'),_0xb9a2('0x67'),_0xb9a2('0x68'),_0xb9a2('0x69')])));return ami[_0xb9a2('0x6a')]({'action':_0xb9a2('0x6b'),'channel':_0x40817f[_0xb9a2('0x14')][_0x190768][_0xb9a2('0x6c')]})['catch'](function(_0x149b37){if(_0x149b37['message']===_0xb9a2('0x6d')){setTimeout(function(){if(_0x40817f[_0xb9a2('0x14')][_0x190768]){ut[_0xb9a2('0x6e')](_0x40817f[_0xb9a2('0x11')][_0x40817f['actions'][_0x190768][_0xb9a2('0x60')]],_0xb9a2('0x6f'));if(_0x40817f[_0xb9a2('0x14')][_0x190768][_0xb9a2('0x64')]===!![]){ut['decrementTalkink'](_0x40817f[_0xb9a2('0x11')][_0x40817f['actions'][_0x190768][_0xb9a2('0x60')]],_0xb9a2('0x6f'));ut[_0xb9a2('0x70')]('[Dialer][checkChannel][pTalking][Preview]'+_0x190768,_0x40817f['actions'][_0x190768][_0xb9a2('0x60')]);}ut[_0xb9a2('0x70')](_0xb9a2('0x71')+_0x190768,_0x40817f[_0xb9a2('0x14')][_0x190768][_0xb9a2('0x60')]);delete _0x40817f[_0xb9a2('0x14')][_0x190768];}},0x2328);}});}});};Preview[_0xb9a2('0xc')][_0xb9a2('0x59')]=function(){var _0x5526ed=this;loggerAction[_0xb9a2('0x5e')](_0xb9a2('0x72'),_['size'](this[_0xb9a2('0x14')]));for(var _0x53eeaf in this[_0xb9a2('0x14')]){if(_0x5526ed['actions'][_0xb9a2('0x5a')](_0x53eeaf)){_0x5526ed[_0xb9a2('0x5d')](_0x53eeaf);}}};Preview[_0xb9a2('0xc')]['recallMe']=function(_0x553623){var _0x321fdc=this;rpcDb['getContactRecallMe'](_0x553623['id'],ut[_0xb9a2('0x73')](this[_0xb9a2('0x74')]))[_0xb9a2('0x75')](function(_0x2fef2c){if(!_[_0xb9a2('0x76')](_0x2fef2c)){for(var _0x29ac9a=0x0;_0x29ac9a<_0x2fef2c[_0xb9a2('0x77')];_0x29ac9a+=0x1){if(ut[_0xb9a2('0x78')](_0x2fef2c[_0x29ac9a][_0xb9a2('0x79')])<_0x553623['dialRecallMeTimeout']*0x3c){_0x321fdc['run'](_0x2fef2c[_0x29ac9a]['id'])[_0xb9a2('0x75')](ut[_0xb9a2('0x7a')](_0xb9a2('0x7b')))[_0xb9a2('0x7c')](ut[_0xb9a2('0x7a')]('[RecallMe]'));}else{var _0x2b348d=new Action(_0x2fef2c[_0x29ac9a],_0x553623);_0x2b348d[_0xb9a2('0x7d')]=moment()[_0xb9a2('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x553623[_0xb9a2('0x7e')]+=0x1;ut[_0xb9a2('0x7f')](_0x2b348d,0x17,_0xb9a2('0x80'));if(_0x553623[_0xb9a2('0x81')]){rpcDb[_0xb9a2('0x82')](ut[_0xb9a2('0x83')](_0x2fef2c[_0x29ac9a]));rpcDb['createCustomerHistory'](_0x2b348d,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xb9a2('0x7f')](_0x2b348d,0x16,_0xb9a2('0x84'));rpcDb[_0xb9a2('0x85')](_0x2b348d,_0xb9a2('0x86'));rpcDb[_0xb9a2('0x87')](_0x2b348d,_0xb9a2('0x86'));}}}}})[_0xb9a2('0x7c')](ut[_0xb9a2('0x7a')](_0xb9a2('0x88')));};Preview[_0xb9a2('0xc')][_0xb9a2('0x89')]=function(_0x114837){_0x114837[_0xb9a2('0x51')]=!![];if(ut[_0xb9a2('0x8a')](_0x114837[_0xb9a2('0x8b')])){_0x114837[_0xb9a2('0x49')]=_0xb9a2('0x8c');}else if(!ut[_0xb9a2('0x8d')](_0x114837[_0xb9a2('0x5b')])){_0x114837[_0xb9a2('0x49')]=_0xb9a2('0x8e');}else if(!this['isTrunkReachable'](_0x114837[_0xb9a2('0x4b')])){if(!this[_0xb9a2('0x8f')](_0x114837[_0xb9a2('0x90')])){_0x114837[_0xb9a2('0x49')]=_0xb9a2('0x91');}else{_0x114837[_0xb9a2('0x49')]=_0xb9a2('0x92');}}else{_0x114837[_0xb9a2('0x49')]=_0xb9a2('0x92');}emitCampaignPreview(_0x114837);};Preview[_0xb9a2('0xc')][_0xb9a2('0x93')]=function(_0x3f76c7,_0x19c7b3,_0x68bb1b){var _0x27eb7c=this;var _0x446bfc=this[_0xb9a2('0x14')][_0x19c7b3];var _0x5c9d8d=this[_0xb9a2('0x11')][_0x446bfc[_0xb9a2('0x60')]];var _0x1198b1;if(_0x5c9d8d){switch(_0x68bb1b){case'1':_0x5c9d8d['outboundNoSuchCallsDay']+=0x1;_0x446bfc[_0xb9a2('0x94')]=ut[_0xb9a2('0x95')](_0x446bfc);ut[_0xb9a2('0x7f')](_0x446bfc,0x0,'NoSuchNumber');rpcDb['createCustomerHistory'](_0x446bfc,_0xb9a2('0x96'));if(ut['totalGlobal'](_0x446bfc)>=_0x5c9d8d[_0xb9a2('0x97')]){_0x1198b1=ut['cloneAction'](_0x446bfc,0xf,'Global');rpcDb['createCustomerFinal'](_0x1198b1,_0xb9a2('0x98'));}else{rpcDb[_0xb9a2('0x87')](_0x446bfc,_0xb9a2('0x98'));}delete this[_0xb9a2('0x14')][_0x3f76c7[_0xb9a2('0x99')]];break;case'ANSWER':var _0x348f75=moment()[_0xb9a2('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x446bfc[_0xb9a2('0x9a')]=_0x348f75;_0x446bfc[_0xb9a2('0x9b')]=_0x348f75;_0x446bfc['dialAnswer']=!![];_0x5c9d8d[_0xb9a2('0x52')]+=0x1;logger[_0xb9a2('0x5e')](_0xb9a2('0x9c'),_0x446bfc['uniqueid'],_0xb9a2('0x9d'),_0x5c9d8d['name'],_0xb9a2('0x63'),_0x5c9d8d[_0xb9a2('0x52')]);ami[_0xb9a2('0x25')](_0xb9a2('0x9e'),ut[_0xb9a2('0x9f')](_0x446bfc,_0xb9a2('0xa0')));if(_0x5c9d8d[_0xb9a2('0xa1')]){ami[_0xb9a2('0x25')](_0xb9a2('0xa2'),ut[_0xb9a2('0xa3')](_0x446bfc));}break;case'16':ami[_0xb9a2('0x25')](_0xb9a2('0xa4'),ut[_0xb9a2('0x9f')](_0x446bfc,_0xb9a2('0xa5')));emitVoiceQueueChannelRemove(ut['buildObj'](_0x446bfc,_0xb9a2('0xa5')));_0x5c9d8d[_0xb9a2('0x37')]+=0x1;_0x5c9d8d['total']+=0x1;_0x5c9d8d['answered']+=0x1;ut[_0xb9a2('0xa6')](_0x5c9d8d,_0xb9a2('0xa7'));_0x446bfc['countglobal']=ut[_0xb9a2('0x95')](_0x446bfc);ut[_0xb9a2('0x7f')](_0x446bfc,0x4,_0xb9a2('0xa8'));rpcDb[_0xb9a2('0x85')](_0x446bfc,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xb9a2('0x87')](_0x446bfc,_0xb9a2('0xa9'));rpcDb['crateCustomerReportQueue'](_0x446bfc);_0x5c9d8d[_0xb9a2('0x2a')]+=_0x446bfc[_0xb9a2('0xaa')];_0x5c9d8d[_0xb9a2('0x29')]+=_0x446bfc['talktime'];logger['info'](_0xb9a2('0xab'),_0x446bfc['uniqueid'],'\x20Queue',_0x5c9d8d[_0xb9a2('0x26')],_0xb9a2('0x63'),_0x5c9d8d['pTalking']);delete this[_0xb9a2('0x14')][_0x3f76c7['linkedid']];break;case _0xb9a2('0xac'):_0x5c9d8d['outboundBusyCallsDay']+=0x1;_0x446bfc[_0xb9a2('0xad')]+=0x1;_0x446bfc[_0xb9a2('0x94')]=ut['totalGlobal'](_0x446bfc);ut[_0xb9a2('0x7f')](_0x446bfc,0x5,_0xb9a2('0xae'));rpcDb[_0xb9a2('0x85')](_0x446bfc,'[callProgressDetectingCustomer][logBusy]');if(ut[_0xb9a2('0x95')](_0x446bfc)>=_0x5c9d8d[_0xb9a2('0x97')]){_0x1198b1=ut[_0xb9a2('0xaf')](_0x446bfc,0xf,_0xb9a2('0xb0'));rpcDb['createCustomerFinal'](_0x1198b1,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x446bfc[_0xb9a2('0xad')]>=_0x5c9d8d[_0xb9a2('0xb1')]){rpcDb[_0xb9a2('0x87')](_0x446bfc,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xb9a2('0xb2')](ut[_0xb9a2('0xb3')](_0x446bfc,'countbusyretry',_0x5c9d8d[_0xb9a2('0xb4')]),_0x446bfc[_0xb9a2('0xb5')],_0x446bfc['activeContact']);}}break;case _0xb9a2('0xb6'):_0x5c9d8d['outboundNoAnswerCallsDay']+=0x1;_0x446bfc[_0xb9a2('0xb7')]+=0x1;_0x446bfc['countglobal']=ut[_0xb9a2('0x95')](_0x446bfc);ut['logCustomer'](_0x446bfc,0x3,_0xb9a2('0xb8'));rpcDb[_0xb9a2('0x85')](_0x446bfc,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0xb9a2('0x95')](_0x446bfc)>=_0x5c9d8d[_0xb9a2('0x97')]){_0x1198b1=ut[_0xb9a2('0xaf')](_0x446bfc,0xf,_0xb9a2('0xb0'));rpcDb[_0xb9a2('0x87')](_0x1198b1,_0xb9a2('0xb9'));}else{if(_0x446bfc[_0xb9a2('0xb7')]>=_0x5c9d8d['dialNoAnswerMaxRetry']){rpcDb[_0xb9a2('0x87')](_0x446bfc,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xb9a2('0xb2')](ut[_0xb9a2('0xb3')](_0x446bfc,_0xb9a2('0xb7'),_0x5c9d8d[_0xb9a2('0xba')]),_0x446bfc[_0xb9a2('0xb5')],_0x446bfc['activeContact']);}}break;case _0xb9a2('0xbb'):_0x5c9d8d[_0xb9a2('0x3a')]+=0x1;_0x446bfc[_0xb9a2('0xbc')]+=0x1;_0x446bfc['countglobal']=ut[_0xb9a2('0x95')](_0x446bfc);ut[_0xb9a2('0x7f')](_0x446bfc,0x8,_0xb9a2('0xbd'));rpcDb[_0xb9a2('0x85')](_0x446bfc,_0xb9a2('0xbe'));if(ut['totalGlobal'](_0x446bfc)>=_0x5c9d8d[_0xb9a2('0x97')]){_0x1198b1=ut[_0xb9a2('0xaf')](_0x446bfc,0xf,_0xb9a2('0xb0'));rpcDb[_0xb9a2('0x87')](_0x1198b1,_0xb9a2('0xbf'));}else{if(_0x446bfc['countcongestionretry']>=_0x5c9d8d['dialCongestionMaxRetry']){rpcDb[_0xb9a2('0x87')](_0x446bfc,_0xb9a2('0xbe'));}else{rpcDb[_0xb9a2('0xb2')](ut[_0xb9a2('0xb3')](_0x446bfc,_0xb9a2('0xbc'),_0x5c9d8d[_0xb9a2('0xb4')]),_0x446bfc[_0xb9a2('0xb5')],_0x446bfc[_0xb9a2('0xc0')]);}}break;case'CANCEL':_0x5c9d8d['outboundRejectCallsDay']+=0x1;_0x446bfc[_0xb9a2('0x94')]=ut[_0xb9a2('0x95')](_0x446bfc);ut[_0xb9a2('0x7f')](_0x446bfc,0x14,_0xb9a2('0xc1'));rpcDb[_0xb9a2('0x85')](_0x446bfc,_0xb9a2('0xc2'));if(_0x446bfc['unlockAgent']){rpcDb[_0xb9a2('0xc3')](_0x446bfc['idContact']);}if(_0x446bfc['activeContact']){rpcDb['disableContact'](_0x446bfc[_0xb9a2('0xc4')]);}break;default:if(_0x446bfc['dialAnswer']){ut['decrementTalkink'](_0x5c9d8d,_0xb9a2('0xc5'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x5c9d8d['name'],_0x3f76c7);}_0x5c9d8d[_0xb9a2('0x41')]+=0x1;_0x446bfc[_0xb9a2('0x94')]=ut['totalGlobal'](_0x446bfc);ut[_0xb9a2('0x7f')](_0x446bfc,0xc,_0x3f76c7[_0xb9a2('0xc6')]||_0x3f76c7['dialstatus']);rpcDb[_0xb9a2('0x85')](_0x446bfc,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0xb9a2('0x95')](_0x446bfc)>=_0x5c9d8d[_0xb9a2('0x97')]){_0x1198b1=ut[_0xb9a2('0xaf')](_0x446bfc,0xf,_0xb9a2('0xb0'));rpcDb[_0xb9a2('0x87')](_0x1198b1,_0xb9a2('0xc7'));}else{rpcDb[_0xb9a2('0x87')](_0x446bfc,_0xb9a2('0xc7'));}delete this[_0xb9a2('0x14')][_0x3f76c7['linkedid']];}if(!(_0x446bfc[_0xb9a2('0x64')]&&_0x68bb1b==='16')){ut['updateOriginated'](_0x5c9d8d,_0xb9a2('0xc8'));logger[_0xb9a2('0x5e')](_0xb9a2('0xc9'),_0x446bfc[_0xb9a2('0xca')],_0xb9a2('0x9d'),_0x5c9d8d[_0xb9a2('0x26')],_0xb9a2('0x61'),_0x5c9d8d[_0xb9a2('0x4a')]);}if(_0x68bb1b!==_0xb9a2('0xcb')){delete this['actions'][_0x3f76c7[_0xb9a2('0x99')]];delete this[_0xb9a2('0x14')][_0x3f76c7[_0xb9a2('0xcc')]];}}};Preview['prototype'][_0xb9a2('0xcd')]=function(_0x3da052,_0x2fef12,_0x50b757){if(_[_0xb9a2('0xce')](_0x2fef12)&&_0xb9a2('0xcf')!==typeof _0x2fef12){return;}if(_['isUndefined'](_0x50b757)&&'object'!==typeof _0x50b757){return;}switch(_0x50b757[_0xb9a2('0xd0')]){case'0':ut['logAgent'](_0x3da052,0x0,_0xb9a2('0xd1'));rpcDb[_0xb9a2('0xd2')](_0x3da052,_0xb9a2('0xd3'));break;case'3':ut[_0xb9a2('0xd4')](_0x3da052,0x3,'NoAnswer');rpcDb[_0xb9a2('0xd2')](_0x3da052,_0xb9a2('0xd5'));break;case'5':ut['logAgent'](_0x3da052,0x5,_0xb9a2('0xae'));rpcDb['createAgentHistory'](_0x3da052,_0xb9a2('0xd6'));break;case'8':ut[_0xb9a2('0xd4')](_0x3da052,0x8,_0xb9a2('0xbd'));rpcDb[_0xb9a2('0xd2')](_0x3da052,_0xb9a2('0xd7'));break;case'22':ut[_0xb9a2('0xd4')](_0x3da052,0x16,_0xb9a2('0xd8'));rpcDb['createAgentHistory'](_0x3da052,_0xb9a2('0xd9'));break;default:ut[_0xb9a2('0xd4')](_0x3da052,0xc,_0x50b757[_0xb9a2('0xd0')]);rpcDb[_0xb9a2('0xd2')](_0x3da052,_0xb9a2('0xd7'));}ut[_0xb9a2('0x6e')](_0x2fef12,_0xb9a2('0xda'));logger[_0xb9a2('0x5e')](_0xb9a2('0xdb'),_0x3da052[_0xb9a2('0xca')],_0xb9a2('0x9d'),_0x2fef12[_0xb9a2('0x26')],'originated:\x20',_0x2fef12['originated']);delete this[_0xb9a2('0x14')][_0x3da052[_0xb9a2('0xca')]];};Preview[_0xb9a2('0xc')]['checkInBlack']=function(_0x4f1e79,_0x4ae911,_0x3a1105,_0xbb3ba1,_0x53072d){var _0x3c7f71=this;return new BPromise(function(_0x513933,_0x2926f9){if(_['isNil'](_0x4ae911)||_['isNil'](_0x4ae911[_0xb9a2('0xdc')])||_['isNil'](_0x4ae911[_0xb9a2('0xdc')]['phone'])||_[_0xb9a2('0x76')](_0x4ae911[_0xb9a2('0x68')])){_0x2926f9(ut['message'](_0xb9a2('0xdd'),_0xbb3ba1,_0x53072d));return;}var _0x4f5a96=uuid['v4']();var _0x22dd63=_0x3c7f71[_0xb9a2('0x11')][_0x4ae911[_0xb9a2('0x5f')][_0xb9a2('0x26')]];var _0x15a000=_0x3a1105?_0x3c7f71['agents'][_0x3a1105]['id']:undefined;_0x3c7f71[_0xb9a2('0x14')][_0x4f5a96]=new Action(_0x4ae911,_0x22dd63,_0x4f5a96,_0x3a1105,_0x15a000);var _0xe4601=_0x3c7f71[_0xb9a2('0x14')][_0x4f5a96];_0xe4601['unlockAgent']=_0xbb3ba1;_0xe4601['activeContact']=_0x53072d;_0xe4601['lookAgent']=_0x3a1105;if(_['isEmpty'](_0x4f1e79)){_0x3c7f71[_0xb9a2('0xde')](_0xe4601,_0x22dd63,_0x4ae911,_0x3a1105)[_0xb9a2('0x75')](function(_0x25bdb5){logger['info']('[Preview][execCall][success]',_0xb9a2('0xdf')+_0xe4601[_0xb9a2('0x60')]+'\x20IdHopper:\x20'+_0xe4601[_0xb9a2('0xc4')],JSON[_0xb9a2('0x62')](_0x25bdb5));ami['emit'](_0xb9a2('0xe0'),ut[_0xb9a2('0x9f')](_0xe4601,_0xb9a2('0xe1')));_0x513933(ut[_0xb9a2('0x49')](_0xb9a2('0xe2')));})[_0xb9a2('0x7c')](function(_0x2b8126){ut['logger']('[Preview][execCall][failure]',_0x2b8126);_0x2926f9(ut[_0xb9a2('0x49')]('Call\x20failed',_0xbb3ba1,_0x53072d));});}else{_0x22dd63['outboundBlacklistCallsDay']+=0x1;ut[_0xb9a2('0xe3')](_0xe4601);rpcDb[_0xb9a2('0xe4')](_0xe4601,'[Blacklist][error]');delete _0x3c7f71['actions'][_0x4f5a96];_0x2926f9(ut['message']('Contact\x20in\x20black\x20List',_0xbb3ba1,_0x53072d));}});};Preview[_0xb9a2('0xc')][_0xb9a2('0x8f')]=function(_0x23a4a1){return!_[_0xb9a2('0x76')](_0x23a4a1)&&!_[_0xb9a2('0x76')](_0x23a4a1[_0xb9a2('0x26')])&&!_[_0xb9a2('0x76')](_0x23a4a1[_0xb9a2('0xe5')])&&_0x23a4a1[_0xb9a2('0xe5')]&&!_[_0xb9a2('0x76')](this['trunks'][util[_0xb9a2('0x4d')](_0xb9a2('0xe6'),_0x23a4a1[_0xb9a2('0x26')])])&&!_[_0xb9a2('0x76')](this[_0xb9a2('0x13')][util[_0xb9a2('0x4d')](_0xb9a2('0xe6'),_0x23a4a1[_0xb9a2('0x26')])]['status'])&&(this[_0xb9a2('0x13')][util[_0xb9a2('0x4d')]('SIP/%s',_0x23a4a1[_0xb9a2('0x26')])][_0xb9a2('0x6b')]===_0xb9a2('0xe7')||this['trunks'][util['format'](_0xb9a2('0xe6'),_0x23a4a1[_0xb9a2('0x26')])]['status']===_0xb9a2('0xe8'));};Preview[_0xb9a2('0xc')]['run']=function(_0x5e70c6,_0x7c83f1){var _0x1af837=this;return new BPromise(function(_0x2ff94c,_0x4f60ec){_0x1af837[_0xb9a2('0xe9')](_0x5e70c6,_0x7c83f1)[_0xb9a2('0x75')](function(_0x128828){_0x2ff94c(_['pick'](_0x128828,['message']));})[_0xb9a2('0x7c')](function(_0x5bd201){if(_0x5bd201['unlock']){rpcDb['unlockContact'](_0x5e70c6);}if(_0x5bd201[_0xb9a2('0xe5')]){rpcDb[_0xb9a2('0xea')](_0x5e70c6);}_0x4f60ec(_[_0xb9a2('0x65')](_0x5bd201,[_0xb9a2('0x49')]));});});};Preview[_0xb9a2('0xc')][_0xb9a2('0xe9')]=function(_0x559fef,_0x559aef){var _0x3a34e8=this;return new BPromise(function(_0x4fecc0,_0x37b1e2){var _0x32e33d,_0x2d9b8d;rpcDb[_0xb9a2('0xeb')](_0x559fef)[_0xb9a2('0x75')](function(_0x35ebdc){if(!_[_0xb9a2('0x76')](_0x35ebdc[0x0])){_0x2d9b8d=_0x35ebdc[0x0][_0xb9a2('0xec')]?![]:!![];_0x32e33d=_0x35ebdc[0x0][_0xb9a2('0xec')]?!![]:![];_0x32e33d=_0x559aef?!![]:_0x32e33d;}var _0x28043=_0x3a34e8[_0xb9a2('0xed')](_0x35ebdc);if(_0x28043[_0xb9a2('0xee')]){rpcDb[_0xb9a2('0xef')](_[_0xb9a2('0x65')](_0x35ebdc[0x0],[_0xb9a2('0x68'),_0xb9a2('0xf0')]))['then'](function(_0x4a549f){_0x3a34e8['checkInBlack'](_0x4a549f,_0x35ebdc[0x0],_0x559aef,_0x2d9b8d,_0x32e33d)[_0xb9a2('0x75')](function(_0x4b25c0){_0x4fecc0(_0x4b25c0);})[_0xb9a2('0x7c')](function(_0x227d5e){_0x37b1e2(_0x227d5e);});})[_0xb9a2('0x7c')](function(_0x29e4a1){ut[_0xb9a2('0x54')](_0xb9a2('0xf1'),_0x29e4a1);_0x37b1e2(ut[_0xb9a2('0x49')](_0xb9a2('0xf2'),_0x2d9b8d,_0x32e33d));});}else{_0x37b1e2(ut[_0xb9a2('0x49')](_0x28043[_0xb9a2('0x49')],_0x2d9b8d,_0x32e33d));}})['catch'](function(_0x99e770){ut[_0xb9a2('0x54')](_0xb9a2('0xf3'),_0x99e770);_0x37b1e2(ut['message'](_0xb9a2('0xf2'),![],!![]));});});};Preview[_0xb9a2('0xc')]['validateContact']=function(_0x5e11b0){if(_[_0xb9a2('0x76')](_0x5e11b0)||_['isEmpty'](_0x5e11b0)||!_[_0xb9a2('0x76')](_0x5e11b0[0x0]['Agent'])&&_[_0xb9a2('0x76')](_0x5e11b0[0x0][_0xb9a2('0xf4')]['name'])){ut[_0xb9a2('0x54')](_0xb9a2('0xf5'),_0x5e11b0);return{'isValid':![],'message':_0xb9a2('0xf6')};}var _0x9e244f=this[_0xb9a2('0x11')][_0x5e11b0[0x0][_0xb9a2('0x5f')][_0xb9a2('0x26')]];_0x9e244f[_0xb9a2('0x49')]='ACTIVE';if(_[_0xb9a2('0x76')](_0x9e244f)){ut[_0xb9a2('0x54')](_0xb9a2('0xf7'),_0x9e244f);return{'isValid':![],'message':_0xb9a2('0xf8')};}if(!this[_0xb9a2('0x8f')](_0x9e244f['Trunk'])){ut[_0xb9a2('0x54')](_0xb9a2('0xf9'),_0xb9a2('0xfa')+_0x9e244f[_0xb9a2('0x26')]+_0xb9a2('0xfb'));if(!this[_0xb9a2('0x8f')](_0x9e244f['TrunkBackup'])){ut['logger'](_0xb9a2('0xf9'),_0x9e244f[_0xb9a2('0x26')]+_0xb9a2('0xfc'));return{'isValid':![],'message':_0xb9a2('0xfd')};}}if(!ut[_0xb9a2('0x8d')](_0x9e244f[_0xb9a2('0x5b')])){ut[_0xb9a2('0x54')]('[Preview][validateContact][Campaign\x20Active]',_0x9e244f['name']+_0xb9a2('0xfe'));return{'isValid':![],'message':_0xb9a2('0xfa')+_0x9e244f[_0xb9a2('0x26')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xb9a2('0xff')};};Preview[_0xb9a2('0xc')][_0xb9a2('0xde')]=function(_0x1bdf2f,_0x1870c6,_0x59aace,_0x141bfd){var _0x40b640=this;return new BPromise(function(_0x2c603e,_0x1fb956){var _0x413d01=_0x1bdf2f[_0xb9a2('0xca')];var _0x8ad02e=_0x40b640['isTrunkReachable'](_0x1870c6[_0xb9a2('0x4b')])?util[_0xb9a2('0x4d')]('SIP/%s/%s%s',_0x1870c6[_0xb9a2('0x4b')][_0xb9a2('0x26')],_[_0xb9a2('0x76')](_0x1870c6[_0xb9a2('0x36')])?'':_0x1870c6[_0xb9a2('0x36')][_0xb9a2('0x100')]()||'',_0x1870c6[_0xb9a2('0x101')]>0x0?_0x59aace[_0xb9a2('0xdc')][_0xb9a2('0x102')]['substring'](_0x1870c6[_0xb9a2('0x101')]):_0x59aace[_0xb9a2('0xdc')][_0xb9a2('0x102')]):util[_0xb9a2('0x4d')](_0xb9a2('0x103'),_['isNil'](_0x1870c6[_0xb9a2('0x90')])?_0x1870c6[_0xb9a2('0x4b')][_0xb9a2('0x26')]:_0x1870c6[_0xb9a2('0x90')]['name'],_[_0xb9a2('0x76')](_0x1870c6[_0xb9a2('0x36')])?'':_0x1870c6[_0xb9a2('0x36')][_0xb9a2('0x100')]()||'',_0x1870c6['dialCutDigit']>0x0?_0x59aace[_0xb9a2('0xdc')]['phone'][_0xb9a2('0x104')](_0x1870c6[_0xb9a2('0x101')]):_0x59aace[_0xb9a2('0xdc')][_0xb9a2('0x102')]);var _0x24f5f7=_0x40b640[_0xb9a2('0x8f')](_0x1870c6[_0xb9a2('0x4b')])?ut[_0xb9a2('0x105')](_0x1870c6[_0xb9a2('0x4b')][_0xb9a2('0x106')],_0x1870c6[_0xb9a2('0x33')],_0x1870c6[_0xb9a2('0x107')]>0x0?ut[_0xb9a2('0x108')](_0x1870c6[_0xb9a2('0x34')],_0x1870c6[_0xb9a2('0x107')]):_0x1870c6[_0xb9a2('0x34')]):ut[_0xb9a2('0x105')](_[_0xb9a2('0x76')](_0x1870c6[_0xb9a2('0x90')])?_0x1870c6['Trunk']['callerid']:_0x1870c6[_0xb9a2('0x90')]['callerid'],_0x1870c6[_0xb9a2('0x33')],_0x1870c6[_0xb9a2('0x107')]>0x0?ut[_0xb9a2('0x108')](_0x1870c6['dialOriginateCallerIdNumber'],_0x1870c6['dialRandomLastDigitCallerIdNumber']):_0x1870c6['dialOriginateCallerIdNumber']);if(_0x24f5f7){_0x1bdf2f['originatecalleridname']=ut[_0xb9a2('0x109')](_0x24f5f7);_0x1bdf2f[_0xb9a2('0x10a')]=ut[_0xb9a2('0x10b')](_0x24f5f7);}var _0x174885=ut['addVariables'](_0x1870c6,_0x59aace,_0x8ad02e,_0x24f5f7,_0x413d01,_0x1bdf2f);_['merge'](_0x1bdf2f,ut[_0xb9a2('0x10c')](_0x174885));_0x1bdf2f[_0xb9a2('0x7d')]=moment()[_0xb9a2('0x4d')](_0xb9a2('0x10d'));ami[_0xb9a2('0x6a')](ut['variablesAction'](_0x1bdf2f,_0x1870c6,_0x174885,_0x1bdf2f[_0xb9a2('0xc0')],_0x141bfd))[_0xb9a2('0x75')](function(_0x582872){_0x1870c6[_0xb9a2('0x4a')]+=0x1;logger[_0xb9a2('0x5e')]('[originated][increment]',_0x413d01,_0xb9a2('0x9d'),_0x1870c6[_0xb9a2('0x26')],'originated:\x20',_0x1870c6['originated']);_0x2c603e(_0x582872);})['catch'](function(_0x51436f){ut[_0xb9a2('0xd4')](_0x1bdf2f,0xe,_0xb9a2('0x10e'));rpcDb['createAgentHistory'](_0x1bdf2f,_0xb9a2('0x10f'));_0x1fb956(_0x51436f);});});};Preview[_0xb9a2('0xc')][_0xb9a2('0x1e')]=function(_0x3b7046){if(this['actions'][_0x3b7046[_0xb9a2('0x99')]]){this[_0xb9a2('0x14')][_0x3b7046[_0xb9a2('0x99')]][_0xb9a2('0x6c')]=_0x3b7046[_0xb9a2('0x6c')];}};Preview[_0xb9a2('0xc')][_0xb9a2('0x17')]=function(_0x2520e7){var _0x4de885=this;var _0x3de6bd=this[_0xb9a2('0x14')][_0x2520e7['actionid']];if(_0x3de6bd){if(_0x3de6bd[_0xb9a2('0x110')]&&this[_0xb9a2('0x74')][_0x3de6bd[_0xb9a2('0x110')]]){ut[_0xb9a2('0x111')](_0x3de6bd,this[_0xb9a2('0x74')][_0x3de6bd[_0xb9a2('0x110')]][_0xb9a2('0x26')],this[_0xb9a2('0x74')][_0x3de6bd[_0xb9a2('0x110')]]['id']);}var _0x2101fd=_['clone'](_0x3de6bd);_0x2101fd[_0xb9a2('0x9a')]=moment()['format'](_0xb9a2('0x10d'));var _0x1521ff=_0x4de885[_0xb9a2('0x11')][_0x3de6bd[_0xb9a2('0x60')]];if(ut['isFailure'](_0x2520e7[_0xb9a2('0x112')])){if(_0x3de6bd['unlockAgent']){rpcDb[_0xb9a2('0xc3')](_0x3de6bd[_0xb9a2('0xc4')]);}if(_0x3de6bd[_0xb9a2('0xc0')]){rpcDb[_0xb9a2('0xea')](_0x3de6bd['idContact']);}ami[_0xb9a2('0x25')](_0xb9a2('0x113'),ut[_0xb9a2('0x9f')](_0x3de6bd,_0xb9a2('0x114')));this[_0xb9a2('0xcd')](_0x2101fd,_0x1521ff,_0x2520e7);}else{_0x3de6bd['starttime']=moment()[_0xb9a2('0x4d')](_0xb9a2('0x10d'));ut['logAgent'](_0x2101fd,0x4,_0xb9a2('0xa8'));rpcDb[_0xb9a2('0xd2')](_0x2101fd,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0xb9a2('0xc')][_0xb9a2('0x19')]=function(_0x59cb25){var _0xdedfe5=this;var _0x43b30e=this[_0xb9a2('0x14')][_0x59cb25['linkedid']];var _0x257b44;if(_0x43b30e){_0x257b44=this['campaignsPreview'][_0x43b30e[_0xb9a2('0x60')]];logger['info']('[syncHangup][talking]',_0x59cb25['linkedid'],_0xb9a2('0x9d'),_0x257b44[_0xb9a2('0x26')],_0xb9a2('0x63'),_0x257b44[_0xb9a2('0x52')]);}if(this[_0xb9a2('0x14')][_0x59cb25[_0xb9a2('0x99')]]&&_0x59cb25['linkedid']!==_0x59cb25['uniqueid']){if(_0x59cb25[_0xb9a2('0x115')]==='16'&&this[_0xb9a2('0x14')][_0x59cb25[_0xb9a2('0x99')]][_0xb9a2('0x64')]){this[_0xb9a2('0x93')](_0x59cb25,_0x59cb25[_0xb9a2('0x99')],_0x59cb25[_0xb9a2('0x115')]);}else if(this[_0xb9a2('0x14')][_0x59cb25[_0xb9a2('0x99')]]['dialAnswer']){logger[_0xb9a2('0x5e')](_0xb9a2('0x116'),_0x59cb25[_0xb9a2('0x99')],_0x59cb25[_0xb9a2('0x115')],_0xb9a2('0x9d'),_0x257b44['name'],_0xb9a2('0x63'),_0x257b44[_0xb9a2('0x52')]);this['callProgressDetectingCustomer'](_0x59cb25,_0x59cb25[_0xb9a2('0x99')],_0x59cb25[_0xb9a2('0x115')]);}}else if(_0x43b30e&&_[_0xb9a2('0x76')](_0x43b30e[_0xb9a2('0x117')])&&_0x257b44[_0xb9a2('0x118')]&&_0x59cb25[_0xb9a2('0x99')]===_0x59cb25[_0xb9a2('0xca')]&&_['isNil'](_0x59cb25[_0xb9a2('0xd0')])&&_0x59cb25['cause']==='16'&&_0x59cb25[_0xb9a2('0x119')]==='6'&&_[_0xb9a2('0xce')](_0x43b30e[_0xb9a2('0x11a')])){if(_0x43b30e['unlockAgent']){rpcDb['unlockContact'](_0x43b30e['idContact']);}if(_0x43b30e[_0xb9a2('0xc0')]){rpcDb['disableContact'](_0x43b30e[_0xb9a2('0xc4')]);}_0x59cb25['reason']='22';this[_0xb9a2('0xcd')](_0x43b30e,_0x257b44,_0x59cb25);}else if(_0x43b30e&&_0x43b30e[_0xb9a2('0x11a')]){if(_0x59cb25[_0xb9a2('0x115')]==='16'&&this[_0xb9a2('0x14')][_0x59cb25[_0xb9a2('0x99')]]['dialAnswer']){logger[_0xb9a2('0x5e')](_0xb9a2('0x11b'),_0x59cb25['linkedid'],_0x59cb25[_0xb9a2('0x115')],_0xb9a2('0x9d'),_0x257b44[_0xb9a2('0x26')],_0xb9a2('0x63'),_0x257b44['pTalking']);this[_0xb9a2('0x93')](_0x59cb25,_0x59cb25['linkedid'],_0x59cb25[_0xb9a2('0x115')]);}else if(this[_0xb9a2('0x14')][_0x59cb25[_0xb9a2('0x99')]][_0xb9a2('0x64')]){logger['info'](_0xb9a2('0x116'),_0x59cb25[_0xb9a2('0x99')],_0x59cb25[_0xb9a2('0x115')],_0xb9a2('0x9d'),_0x257b44[_0xb9a2('0x26')],_0xb9a2('0x63'),_0x257b44['pTalking']);this[_0xb9a2('0x93')](_0x59cb25,_0x59cb25['linkedid'],_0x59cb25[_0xb9a2('0x115')]);}}};Preview[_0xb9a2('0xc')][_0xb9a2('0x1c')]=function(_0x2812f6){if(this[_0xb9a2('0x14')][_0x2812f6[_0xb9a2('0xcc')]]&&_0x2812f6['destlinkedid']!==_0x2812f6[_0xb9a2('0x11c')]){this['callProgressDetectingCustomer'](_0x2812f6,_0x2812f6[_0xb9a2('0xcc')],_0x2812f6[_0xb9a2('0x11d')]);}};Preview[_0xb9a2('0xc')]['syncHangupRequest']=function(_0x2aa789){if(this[_0xb9a2('0x14')][_0x2aa789[_0xb9a2('0x99')]]&&_0x2aa789[_0xb9a2('0x99')]!==_0x2aa789['uniqueid']&&!this[_0xb9a2('0x14')][_0x2aa789['linkedid']][_0xb9a2('0x64')]){if(_0x2aa789[_0xb9a2('0x115')]==='1'){this[_0xb9a2('0x93')](_0x2aa789,_0x2aa789['linkedid'],_0x2aa789['cause']);}}};Preview[_0xb9a2('0xc')]['addVariable']=function(_0x2e0974,_0x264cdf,_0x370e09){if(this[_0xb9a2('0x14')][_0x2e0974]){if(_[_0xb9a2('0x76')](this['actions'][_0x2e0974]['variables'])){this['actions'][_0x2e0974]['variables']={};}this[_0xb9a2('0x14')][_0x2e0974][_0xb9a2('0x11e')][_0x264cdf]=_0x370e09;}};Preview[_0xb9a2('0xc')][_0xb9a2('0x20')]=function(_0x44e274){try{if(!_[_0xb9a2('0x76')](_0x44e274)){if(ut[_0xb9a2('0x11f')](_[_0xb9a2('0x120')](_0x44e274['variable'])[0x0])){this['addVariable'](_0x44e274[_0xb9a2('0xca')],_[_0xb9a2('0x120')](_0x44e274[_0xb9a2('0x121')])[0x0],_0x44e274['value']);}}}catch(_0x28a13d){logger['error'](_0xb9a2('0x122'),util['inspect'](_0x28a13d,{'showHidden':![],'depth':null}));}};Preview[_0xb9a2('0xc')][_0xb9a2('0x22')]=function(_0x1929e1){if(_0x1929e1){if(this[_0xb9a2('0x14')][_0x1929e1['transfertargetlinkedid']]){this['actions'][_0x1929e1['transfertargetlinkedid']][_0xb9a2('0x11a')]=!![];}}};Preview[_0xb9a2('0xc')][_0xb9a2('0x23')]=function(_0x319838){if(_0x319838){if(this[_0xb9a2('0x14')][_0x319838[_0xb9a2('0x123')]]){this[_0xb9a2('0x14')][_0x319838[_0xb9a2('0x123')]][_0xb9a2('0x11a')]=!![];}}};module[_0xb9a2('0x124')]=Preview;
\ No newline at end of file
index 191e200..6956e06 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xce73=['exten','assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','preview','lodash','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','inspect','then','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip'];(function(_0x3c22e0,_0x1dc6ea){var _0x215811=function(_0x1b453c){while(--_0x1b453c){_0x3c22e0['push'](_0x3c22e0['shift']());}};_0x215811(++_0x1dc6ea);}(_0xce73,0x102));var _0x3ce7=function(_0x30875e,_0x231a39){_0x30875e=_0x30875e-0x0;var _0x4638f9=_0xce73[_0x30875e];return _0x4638f9;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x3ce7('0x0'));var _=require(_0x3ce7('0x1'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x3ce7('0x2'));var cmHopperBlack=require(_0x3ce7('0x3'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x3ce7('0x4'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x4d8577){return function(_0x3c0719){logger[_0x3ce7('0x5')](_0x4d8577,util[_0x3ce7('0x6')](_0x3c0719,{'showHidden':![],'depth':null}));};}function create(_0x5dbc0f){return BPromise['resolve']()[_0x3ce7('0x7')](cmHopperHistory[_0x3ce7('0x8')](_0x5dbc0f))[_0x3ce7('0x9')](loggerCatch(_0x3ce7('0xa')));}function createAgent(_0x5586c9){return BPromise[_0x3ce7('0xb')]()[_0x3ce7('0x7')](agentReportPreview[_0x3ce7('0x8')](_0x5586c9))[_0x3ce7('0x9')](loggerCatch(_0x3ce7('0xa')));}function moveContact(_0x52e541){return BPromise['resolve']()[_0x3ce7('0x7')](cmHopper[_0x3ce7('0xc')](_0x52e541,!![]))[_0x3ce7('0x9')](loggerCatch(_0x3ce7('0xd')));}exports['checkIsBlackList']=function(_0x5648a6){return BPromise[_0x3ce7('0xb')]()[_0x3ce7('0x7')](cmHopperBlack[_0x3ce7('0xe')](_0x5648a6))[_0x3ce7('0x9')](loggerCatch(_0x3ce7('0xf')));};exports[_0x3ce7('0x10')]=function(_0x43cb23){return BPromise[_0x3ce7('0xb')]()['then'](cmHopper[_0x3ce7('0x10')](_0x43cb23))[_0x3ce7('0x9')](loggerCatch('[getContactPreview]\x20'));};exports[_0x3ce7('0x8')]=function(_0x4b726c,_0x51f781){create(_0x4b726c)[_0x3ce7('0x9')](loggerCatch(_0x51f781));moveContact(_0x4b726c)[_0x3ce7('0x9')](loggerCatch(_0x51f781));};exports[_0x3ce7('0x11')]=function(_0xb0026f,_0xc8e806){createAgent(_0xb0026f)['catch'](loggerCatch(_0xc8e806));};exports[_0x3ce7('0x12')]=function(_0x4b2a8f,_0x232628){create(_0x4b2a8f)[_0x3ce7('0x9')](loggerCatch(_0x232628));};exports['createCustomerFinal']=function(_0x4cf8ea,_0x9b52d6){moveContact(_0x4cf8ea)[_0x3ce7('0x9')](loggerCatch(_0x9b52d6));};exports[_0x3ce7('0x13')]=function(_0x5220cb,_0x2fc0dc,_0x3756ca){if(_0x2fc0dc){_0x5220cb[_0x3ce7('0x14')]=null;}if(_0x3756ca){_0x5220cb[_0x3ce7('0x15')]=![];}return BPromise[_0x3ce7('0xb')]()[_0x3ce7('0x7')](cmHopper[_0x3ce7('0x13')](_0x5220cb))['catch'](loggerCatch(_0x3ce7('0x16')));};exports['countReScheduled']=function(_0x4dd9ec){return BPromise[_0x3ce7('0xb')]()[_0x3ce7('0x7')](cmHopper['countReScheduled'](_0x4dd9ec))[_0x3ce7('0x9')](loggerCatch(_0x3ce7('0x17')));};exports['unlockContact']=function(_0x3b4456){return BPromise[_0x3ce7('0xb')]()[_0x3ce7('0x7')](cmHopper[_0x3ce7('0x18')]({'UserId':null},_0x3b4456,0x1))['catch'](loggerCatch(_0x3ce7('0x19')));};exports[_0x3ce7('0x1a')]=function(_0x3f2ae2){return BPromise[_0x3ce7('0xb')]()[_0x3ce7('0x7')](cmHopper['unlockContact']({'active':![]},_0x3f2ae2,0x1))['catch'](loggerCatch(_0x3ce7('0x1b')));};exports['crateCustomerReportQueue']=function(_0x1fa453){var _0x51bbba={};_0x51bbba[_0x3ce7('0x1c')]=_0x1fa453[_0x3ce7('0x1c')];_0x51bbba[_0x3ce7('0x1d')]=_0x1fa453[_0x3ce7('0x1d')];_0x51bbba['calleridnum']=_0x1fa453[_0x3ce7('0x1e')];_0x51bbba[_0x3ce7('0x1f')]=_0x1fa453[_0x3ce7('0x1f')];_0x51bbba[_0x3ce7('0x20')]=_0x1fa453[_0x3ce7('0x20')];_0x51bbba['queuecallerjoinAt']=_0x1fa453[_0x3ce7('0x21')];_0x51bbba[_0x3ce7('0x22')]=_0x1fa453[_0x3ce7('0x21')];_0x51bbba[_0x3ce7('0x23')]=0x1;_0x51bbba[_0x3ce7('0x24')]=_0x1fa453[_0x3ce7('0x25')];_0x51bbba[_0x3ce7('0x26')]=_0x1fa453[_0x3ce7('0x27')];_0x51bbba[_0x3ce7('0x28')]=_0x3ce7('0x29');_0x51bbba[_0x3ce7('0x2a')]='xcally-motion-preview';_0x51bbba['holdtime']=0x0;_0x51bbba[_0x3ce7('0x2b')]=0x1;_0x51bbba[_0x3ce7('0x2c')]=_0x1fa453[_0x3ce7('0x27')];_0x51bbba[_0x3ce7('0x2d')]='COMPLETED';return BPromise[_0x3ce7('0xb')]()[_0x3ce7('0x7')](voiceQueueReport[_0x3ce7('0x2e')](_0x51bbba))[_0x3ce7('0x9')](loggerCatch(_0x3ce7('0x2f')));};exports['getContactRecallMe']=function(_0x218c5a,_0x3f1b3e){return BPromise['resolve']()[_0x3ce7('0x7')](cmHopper['getContactRecallMe'](_0x218c5a,_0x3f1b3e))[_0x3ce7('0x9')](loggerCatch(_0x3ce7('0x30')));};exports['rescheduleContactInQueue']=function(_0x13bd57){return BPromise[_0x3ce7('0xb')]()[_0x3ce7('0x7')](cmHopper[_0x3ce7('0x13')](_0x13bd57,!![],!![]))[_0x3ce7('0x9')](loggerCatch(_0x3ce7('0x31')));};
\ No newline at end of file
+var _0xd3b3=['[unlockContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','holdtime','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','resolve','then','catch','createHistory','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','rescheduleContact','active','countReScheduled','unlockContact'];(function(_0x30cb96,_0x31b9e1){var _0xeff506=function(_0x5ad5f7){while(--_0x5ad5f7){_0x30cb96['push'](_0x30cb96['shift']());}};_0xeff506(++_0x31b9e1);}(_0xd3b3,0x81));var _0x3d3b=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0xd3b3[_0x164af1];return _0x5d81a2;};'use strict';var util=require('util');var BPromise=require(_0x3d3b('0x0'));var logger=require(_0x3d3b('0x1'))(_0x3d3b('0x2'));var _=require('lodash');var cmHopper=require(_0x3d3b('0x3'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x3d3b('0x4'));var cmHopperBlack=require(_0x3d3b('0x5'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x3d3b('0x6'));var voiceQueueReport=require(_0x3d3b('0x7'));function loggerCatch(_0x5a3d28){return function(_0x416961){logger['error'](_0x5a3d28,util[_0x3d3b('0x8')](_0x416961,{'showHidden':![],'depth':null}));};}function create(_0xaddb87){return BPromise[_0x3d3b('0x9')]()[_0x3d3b('0xa')](cmHopperHistory['createHistory'](_0xaddb87))[_0x3d3b('0xb')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x1ffac7){return BPromise['resolve']()[_0x3d3b('0xa')](agentReportPreview[_0x3d3b('0xc')](_0x1ffac7))[_0x3d3b('0xb')](loggerCatch(_0x3d3b('0xd')));}function moveContact(_0x2abd74){return BPromise[_0x3d3b('0x9')]()['then'](cmHopper[_0x3d3b('0xe')](_0x2abd74,!![]))[_0x3d3b('0xb')](loggerCatch(_0x3d3b('0xf')));}exports[_0x3d3b('0x10')]=function(_0xb12870){return BPromise['resolve']()[_0x3d3b('0xa')](cmHopperBlack[_0x3d3b('0x10')](_0xb12870))[_0x3d3b('0xb')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x3d3b('0x11')]=function(_0x236291){return BPromise['resolve']()[_0x3d3b('0xa')](cmHopper[_0x3d3b('0x11')](_0x236291))[_0x3d3b('0xb')](loggerCatch(_0x3d3b('0x12')));};exports['createHistory']=function(_0x25c9f3,_0x554e42){create(_0x25c9f3)[_0x3d3b('0xb')](loggerCatch(_0x554e42));moveContact(_0x25c9f3)[_0x3d3b('0xb')](loggerCatch(_0x554e42));};exports[_0x3d3b('0x13')]=function(_0x3e33db,_0x18376b){createAgent(_0x3e33db)[_0x3d3b('0xb')](loggerCatch(_0x18376b));};exports['createCustomerHistory']=function(_0x5784d2,_0x1d515a){create(_0x5784d2)['catch'](loggerCatch(_0x1d515a));};exports['createCustomerFinal']=function(_0x5f2a3c,_0x99c2d6){moveContact(_0x5f2a3c)[_0x3d3b('0xb')](loggerCatch(_0x99c2d6));};exports[_0x3d3b('0x14')]=function(_0x25cdd8,_0x11d614,_0x2c72cb){if(_0x11d614){_0x25cdd8['UserId']=null;}if(_0x2c72cb){_0x25cdd8[_0x3d3b('0x15')]=![];}return BPromise[_0x3d3b('0x9')]()['then'](cmHopper[_0x3d3b('0x14')](_0x25cdd8))['catch'](loggerCatch('[rescheduleContact]\x20'));};exports[_0x3d3b('0x16')]=function(_0x1a7f84){return BPromise[_0x3d3b('0x9')]()[_0x3d3b('0xa')](cmHopper['countReScheduled'](_0x1a7f84))['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0x3d3b('0x17')]=function(_0x3d882f){return BPromise[_0x3d3b('0x9')]()['then'](cmHopper['unlockContact']({'UserId':null},_0x3d882f,0x1))[_0x3d3b('0xb')](loggerCatch(_0x3d3b('0x18')));};exports['disableContact']=function(_0x2ca5d3){return BPromise[_0x3d3b('0x9')]()['then'](cmHopper['unlockContact']({'active':![]},_0x2ca5d3,0x1))['catch'](loggerCatch('[activeContact]\x20'));};exports[_0x3d3b('0x19')]=function(_0x162f88){var _0x1cd5b8={};_0x1cd5b8[_0x3d3b('0x1a')]=_0x162f88['type'];_0x1cd5b8[_0x3d3b('0x1b')]=_0x162f88[_0x3d3b('0x1b')];_0x1cd5b8[_0x3d3b('0x1c')]=_0x162f88[_0x3d3b('0x1c')];_0x1cd5b8[_0x3d3b('0x1d')]=_0x162f88[_0x3d3b('0x1d')];_0x1cd5b8[_0x3d3b('0x1e')]=_0x162f88[_0x3d3b('0x1e')];_0x1cd5b8[_0x3d3b('0x1f')]=_0x162f88['answertime'];_0x1cd5b8[_0x3d3b('0x20')]=_0x162f88[_0x3d3b('0x21')];_0x1cd5b8[_0x3d3b('0x22')]=0x1;_0x1cd5b8[_0x3d3b('0x23')]=_0x162f88[_0x3d3b('0x24')];_0x1cd5b8[_0x3d3b('0x25')]=_0x162f88[_0x3d3b('0x26')];_0x1cd5b8[_0x3d3b('0x27')]=_0x3d3b('0x28');_0x1cd5b8[_0x3d3b('0x29')]='xcally-motion-preview';_0x1cd5b8[_0x3d3b('0x2a')]=0x0;_0x1cd5b8['assigned']=0x1;_0x1cd5b8[_0x3d3b('0x2b')]=_0x162f88[_0x3d3b('0x26')];_0x1cd5b8[_0x3d3b('0x2c')]='COMPLETED';return BPromise[_0x3d3b('0x9')]()[_0x3d3b('0xa')](voiceQueueReport[_0x3d3b('0x2d')](_0x1cd5b8))['catch'](loggerCatch(_0x3d3b('0x2e')));};exports[_0x3d3b('0x2f')]=function(_0x12f458,_0x3ef49d){return BPromise[_0x3d3b('0x9')]()[_0x3d3b('0xa')](cmHopper[_0x3d3b('0x2f')](_0x12f458,_0x3ef49d))['catch'](loggerCatch(_0x3d3b('0x30')));};exports[_0x3d3b('0x31')]=function(_0x782af){return BPromise[_0x3d3b('0x9')]()['then'](cmHopper[_0x3d3b('0x14')](_0x782af,!![],!![]))[_0x3d3b('0xb')](loggerCatch(_0x3d3b('0x32')));};
\ No newline at end of file
index 6d7f326..f1e4adb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1ef0=['preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','loggerCatch','logger','info','inspect','error','logger2','message','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','dialQueueProject2','NONE','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','Contact','tags','createdAt','updatedAt','XMD-','toLowerVariables','hasOwnProperty','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','ringtime','logLookAgent','membername','UserId','talktime','answertime','isFailure','Failure','variablesAction','RECALL','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','cloneAction','clone','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','agentReadyId','not_inuse','status','reachable','push','getDiff','createBody','CampaignId','idContact','type','campaigntype','dialAnswer','calleridname','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1ef0,0x116));var _0x01ef=function(_0x26e312,_0x4c0fed){_0x26e312=_0x26e312-0x0;var _0x3d73ce=_0x1ef0[_0x26e312];return _0x3d73ce;};'use strict';var util=require(_0x01ef('0x0'));var _=require(_0x01ef('0x1'));var moment=require(_0x01ef('0x2'));var logger=require(_0x01ef('0x3'))(_0x01ef('0x4'));var ipAgi=process[_0x01ef('0x5')][_0x01ef('0x6')]||_0x01ef('0x7');function getSeconds(_0x3a79fd,_0x2333ff){var _0xfa38a0=moment(_0x3a79fd)[_0x01ef('0x8')](0x0);var _0x1224ef=moment(_0x2333ff)[_0x01ef('0x8')](0x0);return _0xfa38a0['diff'](_0x1224ef,_0x01ef('0x9'));}exports[_0x01ef('0xa')]=function(_0x35ee8d){return function(_0x3ecb22){logger['error'](_0x35ee8d,util['inspect'](_0x3ecb22,{'showHidden':![],'depth':null}));};};exports[_0x01ef('0xb')]=function(_0x1815f5,_0x40ad0e){logger[_0x01ef('0xc')](_0x1815f5,util[_0x01ef('0xd')](_0x40ad0e,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x1520b7,_0x4d10a6){logger[_0x01ef('0xe')](_0x1520b7,util['inspect'](_0x4d10a6,{'showHidden':![],'depth':null}));};exports[_0x01ef('0xf')]=function(_0x19d3b1){return function(_0x144410){logger['info'](_0x19d3b1,util[_0x01ef('0xd')](_0x144410,{'showHidden':![],'depth':null}));};};exports[_0x01ef('0x10')]=function(_0x19b0cc,_0x23a035,_0x2a7d75){return{'message':_0x19b0cc,'unlock':_0x23a035,'active':_0x2a7d75};};exports['getCallerId']=function(_0x127154,_0x1b68b3,_0x50b691){if(!_['isUndefined'](_0x50b691)&&_0x01ef('0x11')===typeof _0x50b691&&!_[_0x01ef('0x12')](_0x50b691)){if(!_[_0x01ef('0x13')](_0x1b68b3)&&_0x01ef('0x11')===typeof _0x1b68b3&&!_[_0x01ef('0x12')](_0x1b68b3)){return util[_0x01ef('0x14')](_0x01ef('0x15'),_0x1b68b3,_0x50b691);}return util['format'](_0x01ef('0x15'),_0x50b691,_0x50b691);}if(!_[_0x01ef('0x13')](_0x127154)&&_0x01ef('0x11')===typeof _0x127154&&!_['isEmpty'](_0x127154)){return _0x127154;}return _0x01ef('0x16');};exports[_0x01ef('0x17')]=function(_0xafd565){if(_[_0x01ef('0x18')](_0xafd565)){return![];}return _0xafd565;};exports[_0x01ef('0x19')]=function(_0x5044df,_0x4147c9,_0x48702f,_0x5989a2,_0x2d976f,_0x1f6e81){var _0x5dfa48={'XMD-QUEUE':_0x4147c9[_0x01ef('0x1a')]?_0x4147c9['Queue'][_0x01ef('0x1b')]:'','XMD-CALLERID':_0x5989a2,'XMD-CALLERID-PREVIEW':_0x1f6e81?util[_0x01ef('0x14')](_0x01ef('0x15'),_0x1f6e81['calleridname'],_0x1f6e81[_0x01ef('0x1c')]):_0x5989a2,'XMD-DIALID':_0x2d976f,'XMD-CONTACTID':_0x4147c9[_0x01ef('0x1d')],'XMD-CDRTYPE':_0x01ef('0x1e'),'CALLERID(all)':_0x5989a2,'XMD-VOICEQUEUEID':_0x4147c9[_0x01ef('0x1f')],'XMD-DIALCHANNEL':_0x48702f,'XMD-DIALTIMEOUT':_0x5044df['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format'](_0x01ef('0x20'),_0x5044df['dialQueueProject2']?'g':'',_[_0x01ef('0x12')](_0x5044df[_0x01ef('0x21')])?'':_0x01ef('0x22')),'XMD-DIALURL':_0x5044df[_0x01ef('0x23')]||'','XMD-AGI':_0x5044df[_0x01ef('0x24')]?util['format'](_0x01ef('0x25'),ipAgi,_0x5044df['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x5044df[_0x01ef('0x26')]?util[_0x01ef('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5044df[_0x01ef('0x26')]):_0x01ef('0x27'),'XMD-ORIGINATECALLERIDNUM':_0x1f6e81?_0x1f6e81['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x1f6e81?_0x1f6e81[_0x01ef('0x28')]:'','XMD-DESTINATION':_0x01ef('0x29')};if(!_[_0x01ef('0x12')](_0x5044df[_0x01ef('0x21')])){_0x5dfa48[util[_0x01ef('0x14')]('%s',_0x01ef('0x2a'))]=_0x5044df[_0x01ef('0x21')];_0x5dfa48[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x2d976f;}if(_0x4147c9&&_0x4147c9['Contact']){for(var _0x1fd232 in _0x4147c9['Contact']){if(_0x4147c9[_0x01ef('0x2b')]['hasOwnProperty'](_0x1fd232)){if(!_['isNil'](_0x4147c9[_0x01ef('0x2b')][_0x1fd232])&&_0x1fd232!=='id'&&_0x1fd232!==_0x01ef('0x2c')&&_0x1fd232!==_0x01ef('0x2d')&&_0x1fd232!==_0x01ef('0x2e')){_0x5dfa48[util[_0x01ef('0x14')]('%s%s',_0x01ef('0x2f'),_['toUpper'](_0x1fd232))]=_0x4147c9[_0x01ef('0x2b')][_0x1fd232];}}}}return _0x5dfa48;};exports[_0x01ef('0x30')]=function(_0x15fc74){var _0x9b6a8d={};for(var _0x362b4c in _0x15fc74){if(_0x15fc74[_0x01ef('0x31')](_0x362b4c)){_0x9b6a8d[util[_0x01ef('0x14')]('%s',_['toLower'](_0x362b4c))]=_0x15fc74[_0x362b4c];}}return{'variables':_0x9b6a8d};};exports[_0x01ef('0x32')]=function(_0x532e59,_0x3e68ce){if(!_[_0x01ef('0x18')](_0x532e59)){if(_0x532e59[_0x01ef('0x31')](_0x01ef('0x33'))){if(_0x532e59[_0x01ef('0x33')]>0x0){_0x532e59['originated']-=0x1;}else{logger[_0x01ef('0xe')](_0x01ef('0x34'),_0x3e68ce);}}}else{logger[_0x01ef('0xe')](_0x01ef('0x35'),_0x3e68ce);}};exports[_0x01ef('0x36')]=function(_0x3693d){var _0x7ed809=moment()[_0x01ef('0x14')](_0x01ef('0x37'));_0x3693d[_0x01ef('0x38')]=0xd;_0x3693d[_0x01ef('0x39')]=_0x01ef('0x3a');_0x3693d[_0x01ef('0x3b')]=_0x7ed809;_0x3693d['responsetime']=_0x7ed809;_0x3693d['endtime']=_0x7ed809;};exports['logAgent']=function(_0x32e6c5,_0x1f8d8b,_0x374939){var _0x15a3a0=moment()[_0x01ef('0x14')](_0x01ef('0x37'));_0x32e6c5['state']=_0x1f8d8b;_0x32e6c5[_0x01ef('0x39')]=_0x374939;_0x32e6c5[_0x01ef('0x3c')]=_0x15a3a0;_0x32e6c5[_0x01ef('0x3d')]=getSeconds(_0x32e6c5[_0x01ef('0x3c')],_0x32e6c5[_0x01ef('0x3b')]);};exports[_0x01ef('0x3e')]=function(_0x2763cf,_0x3a3428,_0x4a7e08){_0x2763cf[_0x01ef('0x3f')]=_0x3a3428;_0x2763cf[_0x01ef('0x40')]=_0x4a7e08;};exports['logCustomer']=function(_0x21bfab,_0x2d11e2,_0x528662){var _0x489b79=moment()[_0x01ef('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x21bfab[_0x01ef('0x38')]=_0x2d11e2;_0x21bfab[_0x01ef('0x39')]=_0x528662;_0x21bfab[_0x01ef('0x3c')]=_0x21bfab[_0x01ef('0x3c')]?_0x21bfab[_0x01ef('0x3c')]:_0x489b79;_0x21bfab['endtime']=_0x21bfab['endtime']?_0x21bfab['endtime']:_0x489b79;_0x21bfab[_0x01ef('0x3d')]=getSeconds(_0x21bfab['responsetime']||0x0,_0x21bfab[_0x01ef('0x3b')]||0x0);_0x21bfab[_0x01ef('0x41')]=_0x21bfab[_0x01ef('0x42')]?getSeconds(_0x21bfab['endtime'],_0x21bfab[_0x01ef('0x42')]):0x0;};exports[_0x01ef('0x43')]=function(_0x1d61c8){return _0x1d61c8===_0x01ef('0x44');};exports[_0x01ef('0x45')]=function(_0x443c65,_0x502067,_0x4c0e15,_0xbe1d6b,_0x40e0a1){var _0x4657e9=_0xbe1d6b?_0x01ef('0x46'):_0x443c65['calleridname'];_0x4657e9=_0x40e0a1?'BOOKED':_0x4657e9;return{'actionid':_0x443c65[_0x01ef('0x47')],'action':_0x01ef('0x48'),'channel':_0x443c65[_0x01ef('0x49')],'callerid':util[_0x01ef('0x14')](_0x01ef('0x15'),_0x4657e9,_0x443c65['calleridnum']),'Exten':_0x01ef('0x29'),'Context':_0x01ef('0x4a'),'Priority':'1','variable':_0x4c0e15,'timeout':(_0x502067[_0x01ef('0x4b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x443c65[_0x01ef('0x47')]};};exports[_0x01ef('0x4c')]=function(_0x426f02){return _0x426f02[_0x01ef('0x4d')]+_0x426f02[_0x01ef('0x4e')]+_0x426f02['countnoanswerretry'];};exports[_0x01ef('0x4f')]=function(_0x2853aa){var _0x37840f=_[_0x01ef('0x50')](_0x2853aa);_0x37840f[_0x01ef('0x38')]=0xf;_0x37840f[_0x01ef('0x39')]='Global';return _0x37840f;};exports[_0x01ef('0x51')]=function(_0x11ff47,_0x4be55c,_0x25fb74){var _0x59579e={};_0x59579e[_0x4be55c]=_0x11ff47[_0x4be55c];_0x59579e[_0x01ef('0x52')]=![];_0x59579e[_0x01ef('0x53')]=moment()[_0x01ef('0x54')](_0x25fb74,_0x01ef('0x55'))[_0x01ef('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x59579e[_0x01ef('0x1d')]=_0x11ff47[_0x01ef('0x1d')];_0x59579e[_0x01ef('0x56')]=_0x11ff47[_0x01ef('0x56')];_0x59579e[_0x01ef('0x1f')]=_0x11ff47[_0x01ef('0x1f')]||undefined;return _0x59579e;};exports[_0x01ef('0x57')]=function(_0x3a366d,_0x1e8611){if(!_[_0x01ef('0x18')](_0x3a366d)){if(_0x3a366d[_0x01ef('0x58')]>0x0){_0x3a366d['pTalking']-=0x1;}else{logger['error'](_0x1e8611,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x01ef('0xe')](_0x1e8611,_0x01ef('0x59'));}};exports[_0x01ef('0x5a')]=function(_0x4bfafc){if(_0x4bfafc<=0x0){return!![];}return![];};exports['buildObj']=function(_0x252911,_0x289322){_0x252911[_0x01ef('0x5b')]=_0x289322;_0x252911['name']=_0x252911[_0x01ef('0x5c')];_0x252911[_0x01ef('0x5d')]=_0x252911[_0x01ef('0x49')];return _0x252911;};exports['buildAcw']=function(_0x449c31){var _0xd8927d={};_0xd8927d[_0x01ef('0x5c')]=_0x449c31[_0x01ef('0x5c')];_0xd8927d[_0x01ef('0x5d')]=_0x449c31['channelAgent'];_0xd8927d[_0x01ef('0x47')]=_0x449c31[_0x01ef('0x47')];return _0xd8927d;};exports[_0x01ef('0x5e')]=function(_0x4ab284){var _0x1ce6fd=[];for(var _0x3903f1 in _0x4ab284){if(_0x4ab284[_0x01ef('0x31')](_0x3903f1)){if(!_[_0x01ef('0x18')](_0x4ab284[_0x3903f1])&&_0x4ab284[_0x3903f1][_0x01ef('0x38')]===_0x01ef('0x5f')&&_0x4ab284[_0x3903f1][_0x01ef('0x60')]===_0x01ef('0x61')){_0x1ce6fd[_0x01ef('0x62')](_0x4ab284[_0x3903f1]['id']);}}}return _0x1ce6fd;};exports[_0x01ef('0x63')]=function(_0x175c02){var _0xad2691=moment()[_0x01ef('0x8')](0x0);var _0x32eb14=moment(_0x175c02)[_0x01ef('0x8')](0x0);return _0xad2691['diff'](_0x32eb14,_0x01ef('0x9'));};exports[_0x01ef('0x64')]=function(_0x50830f){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x50830f[_0x01ef('0x1d')],'ListId':_0x50830f['ListId'],'VoiceQueueId':_0x50830f[_0x01ef('0x1f')]||undefined,'CampaignId':_0x50830f[_0x01ef('0x65')]||undefined};};exports['filterKey']=function(_0x17f9a0){if(_0x17f9a0===_0x01ef('0x47')||_0x17f9a0===_0x01ef('0x66')||_0x17f9a0===_0x01ef('0x5c')||_0x17f9a0===_0x01ef('0x67')||_0x17f9a0===_0x01ef('0x68')||_0x17f9a0===_0x01ef('0x69')||_0x17f9a0==='membername'||_0x17f9a0==='channelAgent'||_0x17f9a0===_0x01ef('0x6a')||_0x17f9a0===_0x01ef('0x52')||_0x17f9a0==='calleridnum'||_0x17f9a0==='scheduledat'||_0x17f9a0===_0x01ef('0x4d')||_0x17f9a0===_0x01ef('0x4e')||_0x17f9a0===_0x01ef('0x6b')||_0x17f9a0===_0x01ef('0x6c')||_0x17f9a0===_0x01ef('0x6d')||_0x17f9a0===_0x01ef('0x6e')||_0x17f9a0===_0x01ef('0x6f')||_0x17f9a0===_0x01ef('0x70')||_0x17f9a0===_0x01ef('0x1d')||_0x17f9a0===_0x01ef('0x56')||_0x17f9a0==='UserId'||_0x17f9a0===_0x01ef('0x1f')||_0x17f9a0===_0x01ef('0x71')||_0x17f9a0===_0x01ef('0x72')||_0x17f9a0===_0x01ef('0x73')||_0x17f9a0===_0x01ef('0x74')||_0x17f9a0===_0x01ef('0x75')||_0x17f9a0===_0x01ef('0x76')||_0x17f9a0===_0x01ef('0x77')||_0x17f9a0===_0x01ef('0x78')||_0x17f9a0===_0x01ef('0x79')||_0x17f9a0===_0x01ef('0x7a')||_0x17f9a0==='xmd-contactid'||_0x17f9a0==='xmd-cdrtype'||_0x17f9a0==='xmd-callerid'||_0x17f9a0===_0x01ef('0x7b')||_0x17f9a0===_0x01ef('0x7c')||_0x17f9a0===_0x01ef('0x7d')||_0x17f9a0===_0x01ef('0x7e')||_0x17f9a0==='rtpaudioqosjitter'||_0x17f9a0===_0x01ef('0x7f')||_0x17f9a0==='rtpaudioqosloss'||_0x17f9a0===_0x01ef('0x80')||_0x17f9a0==='rtpaudioqosrtt'||_0x17f9a0==='rtpaudioqosrttbridged'||_0x17f9a0===_0x01ef('0x7d')||_0x17f9a0==='rtpaudioqosbridged'||_0x17f9a0===_0x01ef('0x81')||_0x17f9a0===_0x01ef('0x7f')||_0x17f9a0===_0x01ef('0x82')||_0x17f9a0==='rtpaudioqoslossbridged'||_0x17f9a0===_0x01ef('0x83')||_0x17f9a0===_0x01ef('0x84')||_0x17f9a0==='bridgepeer'||_0x17f9a0==='bridgepvtcallid'||_0x17f9a0===_0x01ef('0x38')||_0x17f9a0===_0x01ef('0x39')){return![];}return!![];};exports[_0x01ef('0x85')]=function(_0x379c13,_0x139027){var _0x269802,_0xe0d0cd,_0x479089;if(_0x139027<=0x0){_0x139027=0x1;}_0x269802=new RegExp(_0x01ef('0x86')+_0x139027+'}$');_0xe0d0cd=Math[_0x01ef('0x87')](0xa,_0x139027-0x1);_0x479089=Math[_0x01ef('0x87')](0xa,_0x139027)-0x1;return util[_0x01ef('0x14')]('%s',_[_0x01ef('0x88')](_0x379c13,_0x269802,_[_0x01ef('0x89')](_0xe0d0cd,_0x479089)));};exports[_0x01ef('0x8a')]=function(_0x563e2d){var _0x4bc6d3=_0x563e2d[_0x01ef('0x8b')](/"(.*?)"/);return _0x4bc6d3?_0x4bc6d3[0x1]:_0x563e2d;};exports[_0x01ef('0x8c')]=function(_0x4bc3d3){var _0x579dfd=_0x4bc3d3[_0x01ef('0x8b')](/<(.*?)>/);return _0x579dfd?_0x579dfd[0x1]:_0x4bc3d3;};
\ No newline at end of file
+var _0xd07a=['state','ringtime','logLookAgent','membername','UserId','logCustomer','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','calleridnum','from-sip','timeout','totalGlobal','cloneAction','Global','scheduledAt','active','scheduledat','add','minutes','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','name','queue','interface','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','createBody','CampaignId','filterKey','idContact','type','dialAnswer','countnoanswerretry','countglobal','callbackuniqueid','recallme','sipcallid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','lodash','moment','env','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','loggerError','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','starttime','responsetime','endtime','logAgent'];(function(_0x365b75,_0x4f8260){var _0x3be6bb=function(_0xc81fca){while(--_0xc81fca){_0x365b75['push'](_0x365b75['shift']());}};_0x3be6bb(++_0x4f8260);}(_0xd07a,0xda));var _0xad07=function(_0x1fd9e7,_0x24cdbe){_0x1fd9e7=_0x1fd9e7-0x0;var _0x1781f2=_0xd07a[_0x1fd9e7];return _0x1781f2;};'use strict';var util=require('util');var _=require(_0xad07('0x0'));var moment=require(_0xad07('0x1'));var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0xad07('0x2')]['XCALLY_IP_AGI']||_0xad07('0x3');function getSeconds(_0x39a3ca,_0x2b9f77){var _0x7965f6=moment(_0x39a3ca)[_0xad07('0x4')](0x0);var _0x212e43=moment(_0x2b9f77)[_0xad07('0x4')](0x0);return _0x7965f6[_0xad07('0x5')](_0x212e43,_0xad07('0x6'));}exports[_0xad07('0x7')]=function(_0x34a850){return function(_0x3feb44){logger[_0xad07('0x8')](_0x34a850,util[_0xad07('0x9')](_0x3feb44,{'showHidden':![],'depth':null}));};};exports[_0xad07('0xa')]=function(_0x1e3623,_0x4a3db2){logger[_0xad07('0xb')](_0x1e3623,util[_0xad07('0x9')](_0x4a3db2,{'showHidden':![],'depth':null}));};exports[_0xad07('0xc')]=function(_0x160af9,_0x4a266f){logger['error'](_0x160af9,util[_0xad07('0x9')](_0x4a266f,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x3cba0a){return function(_0x166495){logger[_0xad07('0xb')](_0x3cba0a,util['inspect'](_0x166495,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x545c5e,_0x1318ea,_0x11b1cc){return{'message':_0x545c5e,'unlock':_0x1318ea,'active':_0x11b1cc};};exports[_0xad07('0xd')]=function(_0x3b9d65,_0x21fefa,_0x4aeb9f){if(!_[_0xad07('0xe')](_0x4aeb9f)&&_0xad07('0xf')===typeof _0x4aeb9f&&!_[_0xad07('0x10')](_0x4aeb9f)){if(!_[_0xad07('0xe')](_0x21fefa)&&_0xad07('0xf')===typeof _0x21fefa&&!_[_0xad07('0x10')](_0x21fefa)){return util[_0xad07('0x11')](_0xad07('0x12'),_0x21fefa,_0x4aeb9f);}return util['format'](_0xad07('0x12'),_0x4aeb9f,_0x4aeb9f);}if(!_[_0xad07('0xe')](_0x3b9d65)&&_0xad07('0xf')===typeof _0x3b9d65&&!_[_0xad07('0x10')](_0x3b9d65)){return _0x3b9d65;}return'\x22\x22\x20<>';};exports[_0xad07('0x13')]=function(_0x2d789e){if(_[_0xad07('0x14')](_0x2d789e)){return![];}return _0x2d789e;};exports[_0xad07('0x15')]=function(_0x342a6b,_0x5580d9,_0x20bacc,_0x4d27f7,_0x37b3ab,_0x5392f2){var _0x21dfb0={'XMD-QUEUE':_0x5580d9[_0xad07('0x16')]?_0x5580d9[_0xad07('0x16')]['name']:'','XMD-CALLERID':_0x4d27f7,'XMD-CALLERID-PREVIEW':_0x5392f2?util[_0xad07('0x11')](_0xad07('0x12'),_0x5392f2[_0xad07('0x17')],_0x5392f2['calleridnum']):_0x4d27f7,'XMD-DIALID':_0x37b3ab,'XMD-CONTACTID':_0x5580d9[_0xad07('0x18')],'XMD-CDRTYPE':_0xad07('0x19'),'CALLERID(all)':_0x4d27f7,'XMD-VOICEQUEUEID':_0x5580d9[_0xad07('0x1a')],'XMD-DIALCHANNEL':_0x20bacc,'XMD-DIALTIMEOUT':_0x342a6b[_0xad07('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0xad07('0x11')]('\x22rtTxX%s%s\x22',_0x342a6b[_0xad07('0x1c')]?'g':'',_[_0xad07('0x10')](_0x342a6b['monitor_format'])?'':_0xad07('0x1d')),'XMD-DIALURL':_0x342a6b[_0xad07('0x1e')]||'','XMD-AGI':_0x342a6b[_0xad07('0x1f')]?util[_0xad07('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x342a6b['dialQueueProject']):_0xad07('0x20'),'XMD-AGIAFTER':_0x342a6b[_0xad07('0x1c')]?util[_0xad07('0x11')](_0xad07('0x21'),ipAgi,_0x342a6b[_0xad07('0x1c')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x5392f2?_0x5392f2[_0xad07('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x5392f2?_0x5392f2['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0xad07('0x10')](_0x342a6b['monitor_format'])){_0x21dfb0[util[_0xad07('0x11')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x342a6b['monitor_format'];_0x21dfb0[util[_0xad07('0x11')]('%s',_0xad07('0x23'))]=_0x37b3ab;}if(_0x5580d9&&_0x5580d9[_0xad07('0x24')]){for(var _0x1300f4 in _0x5580d9['Contact']){if(_0x5580d9['Contact'][_0xad07('0x25')](_0x1300f4)){if(!_[_0xad07('0x14')](_0x5580d9[_0xad07('0x24')][_0x1300f4])&&_0x1300f4!=='id'&&_0x1300f4!==_0xad07('0x26')&&_0x1300f4!==_0xad07('0x27')&&_0x1300f4!==_0xad07('0x28')){_0x21dfb0[util['format'](_0xad07('0x29'),_0xad07('0x2a'),_[_0xad07('0x2b')](_0x1300f4))]=_0x5580d9['Contact'][_0x1300f4];}}}}return _0x21dfb0;};exports[_0xad07('0x2c')]=function(_0x9f84f2){var _0x4956b0={};for(var _0x4e4798 in _0x9f84f2){if(_0x9f84f2[_0xad07('0x25')](_0x4e4798)){_0x4956b0[util[_0xad07('0x11')]('%s',_[_0xad07('0x2d')](_0x4e4798))]=_0x9f84f2[_0x4e4798];}}return{'variables':_0x4956b0};};exports[_0xad07('0x2e')]=function(_0x39e9c6,_0x3a68df){if(!_[_0xad07('0x14')](_0x39e9c6)){if(_0x39e9c6[_0xad07('0x25')](_0xad07('0x2f'))){if(_0x39e9c6[_0xad07('0x2f')]>0x0){_0x39e9c6[_0xad07('0x2f')]-=0x1;}else{logger[_0xad07('0x8')](_0xad07('0x30'),_0x3a68df);}}}else{logger[_0xad07('0x8')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x3a68df);}};exports[_0xad07('0x31')]=function(_0xfb898d){var _0x4f33dc=moment()[_0xad07('0x11')](_0xad07('0x32'));_0xfb898d['state']=0xd;_0xfb898d[_0xad07('0x33')]='Blacklist';_0xfb898d[_0xad07('0x34')]=_0x4f33dc;_0xfb898d[_0xad07('0x35')]=_0x4f33dc;_0xfb898d[_0xad07('0x36')]=_0x4f33dc;};exports[_0xad07('0x37')]=function(_0xf4d879,_0x22da5b,_0x47bc3f){var _0x5b9fb8=moment()[_0xad07('0x11')](_0xad07('0x32'));_0xf4d879[_0xad07('0x38')]=_0x22da5b;_0xf4d879['statedesc']=_0x47bc3f;_0xf4d879[_0xad07('0x35')]=_0x5b9fb8;_0xf4d879[_0xad07('0x39')]=getSeconds(_0xf4d879[_0xad07('0x35')],_0xf4d879['starttime']);};exports[_0xad07('0x3a')]=function(_0x348f52,_0x564ddf,_0x8730e2){_0x348f52[_0xad07('0x3b')]=_0x564ddf;_0x348f52[_0xad07('0x3c')]=_0x8730e2;};exports[_0xad07('0x3d')]=function(_0x5b69e6,_0x1dfec3,_0x19e887){var _0x3ed8a0=moment()[_0xad07('0x11')](_0xad07('0x32'));_0x5b69e6[_0xad07('0x38')]=_0x1dfec3;_0x5b69e6[_0xad07('0x33')]=_0x19e887;_0x5b69e6[_0xad07('0x35')]=_0x5b69e6['responsetime']?_0x5b69e6[_0xad07('0x35')]:_0x3ed8a0;_0x5b69e6[_0xad07('0x36')]=_0x5b69e6[_0xad07('0x36')]?_0x5b69e6[_0xad07('0x36')]:_0x3ed8a0;_0x5b69e6[_0xad07('0x39')]=getSeconds(_0x5b69e6[_0xad07('0x35')]||0x0,_0x5b69e6[_0xad07('0x34')]||0x0);_0x5b69e6['talktime']=_0x5b69e6[_0xad07('0x3e')]?getSeconds(_0x5b69e6[_0xad07('0x36')],_0x5b69e6['answertime']):0x0;};exports[_0xad07('0x3f')]=function(_0x4be6d0){return _0x4be6d0===_0xad07('0x40');};exports[_0xad07('0x41')]=function(_0x7cba8,_0x174602,_0x583662,_0xdec7de,_0x4d7ba5){var _0x2ff113=_0xdec7de?_0xad07('0x42'):_0x7cba8[_0xad07('0x17')];_0x2ff113=_0x4d7ba5?_0xad07('0x43'):_0x2ff113;return{'actionid':_0x7cba8[_0xad07('0x44')],'action':_0xad07('0x45'),'channel':_0x7cba8[_0xad07('0x46')],'callerid':util[_0xad07('0x11')](_0xad07('0x12'),_0x2ff113,_0x7cba8[_0xad07('0x47')]),'Exten':'xcally-motion-preview','Context':_0xad07('0x48'),'Priority':'1','variable':_0x583662,'timeout':(_0x174602[_0xad07('0x49')]||0x1e)*0x3e8,'async':!![],'channelid':_0x7cba8[_0xad07('0x44')]};};exports[_0xad07('0x4a')]=function(_0x11b38b){return _0x11b38b['countbusyretry']+_0x11b38b['countcongestionretry']+_0x11b38b['countnoanswerretry'];};exports[_0xad07('0x4b')]=function(_0x439dd8){var _0x5771d6=_['clone'](_0x439dd8);_0x5771d6['state']=0xf;_0x5771d6[_0xad07('0x33')]=_0xad07('0x4c');return _0x5771d6;};exports[_0xad07('0x4d')]=function(_0x5e9fd8,_0x52fba8,_0x3b8fad){var _0x3db6bd={};_0x3db6bd[_0x52fba8]=_0x5e9fd8[_0x52fba8];_0x3db6bd[_0xad07('0x4e')]=![];_0x3db6bd[_0xad07('0x4f')]=moment()[_0xad07('0x50')](_0x3b8fad,_0xad07('0x51'))[_0xad07('0x11')](_0xad07('0x32'));_0x3db6bd[_0xad07('0x18')]=_0x5e9fd8['ContactId'];_0x3db6bd[_0xad07('0x52')]=_0x5e9fd8[_0xad07('0x52')];_0x3db6bd[_0xad07('0x1a')]=_0x5e9fd8[_0xad07('0x1a')]||undefined;return _0x3db6bd;};exports['decrementTalkink']=function(_0x146f8c,_0x2faa31){if(!_[_0xad07('0x14')](_0x146f8c)){if(_0x146f8c[_0xad07('0x53')]>0x0){_0x146f8c[_0xad07('0x53')]-=0x1;}else{logger[_0xad07('0x8')](_0x2faa31,_0xad07('0x54'));}}else{logger[_0xad07('0x8')](_0x2faa31,_0xad07('0x55'));}};exports[_0xad07('0x56')]=function(_0x2bf72f){if(_0x2bf72f<=0x0){return!![];}return![];};exports[_0xad07('0x57')]=function(_0x4e87f4,_0x3ca7a7){_0x4e87f4[_0xad07('0x58')]=_0x3ca7a7;_0x4e87f4[_0xad07('0x59')]=_0x4e87f4[_0xad07('0x5a')];_0x4e87f4[_0xad07('0x5b')]=_0x4e87f4[_0xad07('0x46')];return _0x4e87f4;};exports[_0xad07('0x5c')]=function(_0x5c370b){var _0x4180e6={};_0x4180e6[_0xad07('0x5a')]=_0x5c370b[_0xad07('0x5a')];_0x4180e6[_0xad07('0x5b')]=_0x5c370b['channelAgent'];_0x4180e6[_0xad07('0x44')]=_0x5c370b[_0xad07('0x44')];return _0x4180e6;};exports[_0xad07('0x5d')]=function(_0x2d6277){var _0x4dd97d=[];for(var _0x38ab70 in _0x2d6277){if(_0x2d6277[_0xad07('0x25')](_0x38ab70)){if(!_['isNil'](_0x2d6277[_0x38ab70])&&_0x2d6277[_0x38ab70]['state']===_0xad07('0x5e')&&_0x2d6277[_0x38ab70][_0xad07('0x5f')]===_0xad07('0x60')){_0x4dd97d[_0xad07('0x61')](_0x2d6277[_0x38ab70]['id']);}}}return _0x4dd97d;};exports[_0xad07('0x62')]=function(_0xdfd4d0){var _0x4e5e1c=moment()[_0xad07('0x4')](0x0);var _0x294e43=moment(_0xdfd4d0)[_0xad07('0x4')](0x0);return _0x4e5e1c[_0xad07('0x5')](_0x294e43,_0xad07('0x6'));};exports[_0xad07('0x63')]=function(_0x191831){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x191831['ContactId'],'ListId':_0x191831[_0xad07('0x52')],'VoiceQueueId':_0x191831[_0xad07('0x1a')]||undefined,'CampaignId':_0x191831[_0xad07('0x64')]||undefined};};exports[_0xad07('0x65')]=function(_0x1d75ff){if(_0x1d75ff==='uniqueid'||_0x1d75ff===_0xad07('0x66')||_0x1d75ff===_0xad07('0x5a')||_0x1d75ff===_0xad07('0x67')||_0x1d75ff==='campaigntype'||_0x1d75ff===_0xad07('0x68')||_0x1d75ff==='membername'||_0x1d75ff===_0xad07('0x46')||_0x1d75ff==='calleridname'||_0x1d75ff==='active'||_0x1d75ff===_0xad07('0x47')||_0x1d75ff===_0xad07('0x4f')||_0x1d75ff==='countbusyretry'||_0x1d75ff==='countcongestionretry'||_0x1d75ff===_0xad07('0x69')||_0x1d75ff===_0xad07('0x6a')||_0x1d75ff==='callback'||_0x1d75ff===_0xad07('0x6b')||_0x1d75ff==='callbackat'||_0x1d75ff===_0xad07('0x6c')||_0x1d75ff===_0xad07('0x18')||_0x1d75ff==='ListId'||_0x1d75ff===_0xad07('0x3c')||_0x1d75ff===_0xad07('0x1a')||_0x1d75ff===_0xad07('0x6d')||_0x1d75ff==='xmd-voicequeueid'||_0x1d75ff==='xmd-queue'||_0x1d75ff===_0xad07('0x6e')||_0x1d75ff===_0xad07('0x6f')||_0x1d75ff===_0xad07('0x70')||_0x1d75ff===_0xad07('0x71')||_0x1d75ff===_0xad07('0x72')||_0x1d75ff===_0xad07('0x73')||_0x1d75ff==='xmd-dialchannel'||_0x1d75ff===_0xad07('0x74')||_0x1d75ff===_0xad07('0x75')||_0x1d75ff==='xmd-callerid'||_0x1d75ff==='xmd-agiafter'||_0x1d75ff===_0xad07('0x76')||_0x1d75ff===_0xad07('0x77')||_0x1d75ff===_0xad07('0x78')||_0x1d75ff===_0xad07('0x79')||_0x1d75ff==='rtpaudioqosjitterbridged'||_0x1d75ff===_0xad07('0x7a')||_0x1d75ff===_0xad07('0x7b')||_0x1d75ff===_0xad07('0x7c')||_0x1d75ff===_0xad07('0x7d')||_0x1d75ff===_0xad07('0x77')||_0x1d75ff===_0xad07('0x78')||_0x1d75ff==='rtpaudioqosjitter'||_0x1d75ff===_0xad07('0x7e')||_0x1d75ff==='rtpaudioqosloss'||_0x1d75ff===_0xad07('0x7b')||_0x1d75ff===_0xad07('0x7c')||_0x1d75ff==='rtpaudioqosrttbridged'||_0x1d75ff===_0xad07('0x7f')||_0x1d75ff===_0xad07('0x80')||_0x1d75ff===_0xad07('0x38')||_0x1d75ff===_0xad07('0x33')){return![];}return!![];};exports[_0xad07('0x81')]=function(_0x2292a4,_0x3c0185){var _0xe1f72c,_0x4ddb67,_0x3e5df3;if(_0x3c0185<=0x0){_0x3c0185=0x1;}_0xe1f72c=new RegExp(_0xad07('0x82')+_0x3c0185+'}$');_0x4ddb67=Math[_0xad07('0x83')](0xa,_0x3c0185-0x1);_0x3e5df3=Math[_0xad07('0x83')](0xa,_0x3c0185)-0x1;return util['format']('%s',_[_0xad07('0x84')](_0x2292a4,_0xe1f72c,_[_0xad07('0x85')](_0x4ddb67,_0x3e5df3)));};exports[_0xad07('0x86')]=function(_0x493979){var _0x3c6dd8=_0x493979[_0xad07('0x87')](/"(.*?)"/);return _0x3c6dd8?_0x3c6dd8[0x1]:_0x493979;};exports[_0xad07('0x88')]=function(_0x19f55e){var _0x113d72=_0x19f55e[_0xad07('0x87')](/<(.*?)>/);return _0x113d72?_0x113d72[0x1]:_0x19f55e;};
\ No newline at end of file
index 03a8bbf..1425a81 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc569=['voicequeuechannelredirect','queueadd','string','number','boolean','queuepause','reload','voicechannel'];(function(_0x59d74e,_0x5df42c){var _0x168bc9=function(_0x5f2dc3){while(--_0x5f2dc3){_0x59d74e['push'](_0x59d74e['shift']());}};_0x168bc9(++_0x5df42c);}(_0xc569,0x159));var _0x9c56=function(_0x2a22b0,_0x4c6c79){_0x2a22b0=_0x2a22b0-0x0;var _0x51b2cf=_0xc569[_0x2a22b0];return _0x51b2cf;};'use strict';exports[_0x9c56('0x0')]={'queue':{'type':_0x9c56('0x1'),'required':!![]},'interface':{'type':_0x9c56('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x9c56('0x2'),'required':![]},'paused':{'type':_0x9c56('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x9c56('0x1'),'required':!![]},'interface':{'type':_0x9c56('0x1'),'required':!![]}};exports[_0x9c56('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0x9c56('0x3')},'reason':{'type':_0x9c56('0x1'),'required':![]}};exports[_0x9c56('0x5')]={'module':{'type':_0x9c56('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x9c56('0x1'),'required':!![]}};exports[_0x9c56('0x6')]={'uniqueid':{'type':_0x9c56('0x1'),'required':!![]},'filename':{'type':_0x9c56('0x1')},'format':{'type':_0x9c56('0x1')},'mixmonitorid':{'type':'string'}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports[_0x9c56('0x7')]={'uniqueid':{'type':_0x9c56('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x9c56('0x1')}};
\ No newline at end of file
+var _0x8a9c=['voicequeuechannelredirect','queueadd','string','number','queueremove','queuepause','boolean','reload','voicequeuechannel','voicechannel'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8a9c,0x12d));var _0xc8a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a9c[_0x3dd15e];return _0x231fd0;};'use strict';exports[_0xc8a9('0x0')]={'queue':{'type':_0xc8a9('0x1'),'required':!![]},'interface':{'type':_0xc8a9('0x1'),'required':!![]},'membername':{'type':_0xc8a9('0x1'),'required':!![]},'penalty':{'type':_0xc8a9('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xc8a9('0x3')]={'queue':{'type':_0xc8a9('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xc8a9('0x4')]={'interface':{'type':_0xc8a9('0x1'),'required':!![]},'paused':{'type':_0xc8a9('0x5')},'reason':{'type':'string','required':![]}};exports[_0xc8a9('0x6')]={'module':{'type':_0xc8a9('0x1'),'required':![]}};exports[_0xc8a9('0x7')]={'uniqueid':{'type':_0xc8a9('0x1'),'required':!![]}};exports[_0xc8a9('0x8')]={'uniqueid':{'type':_0xc8a9('0x1'),'required':!![]},'filename':{'type':_0xc8a9('0x1')},'format':{'type':_0xc8a9('0x1')},'mixmonitorid':{'type':_0xc8a9('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports[_0xc8a9('0x9')]={'uniqueid':{'type':_0xc8a9('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0xc8a9('0x1')}};
\ No newline at end of file
index 8823c36..12a0237 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3822=['billableseconds','initVoiceExtensions','initCampaignHopperHistory','faxAccounts','bluebird','util','lodash','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/faxAccount','voiceQueues','triggers','campaigns','outbound','voiceExtensions','queueChannels','outboundChannels','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','answered','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumHoldTime','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','initTelephones','telephones','trunks','isUndefined','initVoiceQueues','initTriggers','initTemplates','templates','initZendeskAccounts','initSalesforceAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initVoiceQueueHopperHistory','initVoiceQueueReports','uniqueid','queuecallerexit','abandoned','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED'];(function(_0x4c1f1f,_0x3aa18d){var _0x4f9e3c=function(_0x1a94cb){while(--_0x1a94cb){_0x4c1f1f['push'](_0x4c1f1f['shift']());}};_0x4f9e3c(++_0x3aa18d);}(_0x3822,0x65));var _0x2382=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x3822[_0x5627e1];return _0x2f013f;};'use strict';var BPromise=require(_0x2382('0x0'));var util=require(_0x2382('0x1'));var _=require(_0x2382('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require(_0x2382('0x3'));var VoiceQueue=require(_0x2382('0x4'));var Trigger=require(_0x2382('0x5'));var Template=require(_0x2382('0x6'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0x2382('0x7'));var ZendeskAccount=require(_0x2382('0x8'));var SalesforceAccount=require(_0x2382('0x9'));var FreshdeskAccount=require(_0x2382('0xa'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x2382('0xb'));var ServicenowAccount=require(_0x2382('0xc'));var Dynamics365Account=require('../model/dynamics365Account');var FaxAccount=require(_0x2382('0xd'));var Realtime=function(){this['agents']={};this['telephones']={};this['trunks']={};this[_0x2382('0xe')]={};this[_0x2382('0xf')]={};this[_0x2382('0x10')]={};this['templates']={};this[_0x2382('0x11')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x2382('0x12')]={};this['channels']={};this[_0x2382('0x13')]={};this[_0x2382('0x14')]={};this['timers']={};this[_0x2382('0x15')]={};this[_0x2382('0x16')]={};this[_0x2382('0x17')]={};this[_0x2382('0x18')]={};this['zohoAccounts']={};this[_0x2382('0x19')]={};this[_0x2382('0x1a')]={};this[_0x2382('0x1b')]={};this['dynamics365Accounts']={};this['faxAccounts']={};};function freeIsNotKey(_0x2a3bcc,_0x247845,_0x884891){var _0x525fa2=_[_0x2382('0x1c')](_0x2a3bcc,function(_0x1a54fb,_0x4575ae){return _0x1a54fb[_0x884891];});for(var _0x16ee2d in _0x247845){if(_0x247845[_0x2382('0x1d')](_0x16ee2d)){if(!_0x525fa2[_0x16ee2d]){delete _0x247845[_0x16ee2d];}}}}function freeIsNotKeySip(_0x14b793,_0xcc3f25){var _0x2542df=_[_0x2382('0x1c')](_0x14b793,function(_0x555aed,_0x1be93e){return util[_0x2382('0x1e')](_0x2382('0x1f'),_0x555aed[_0x2382('0x20')]);});for(var _0x3ab955 in _0xcc3f25){if(_0xcc3f25['hasOwnProperty'](_0x3ab955)){if(!_0x2542df[_0x3ab955]){delete _0xcc3f25[_0x3ab955];}}}}function freeIsNotKeyAgent(_0x58b7af,_0x1be473){var _0x5af510=_['mapKeys'](_0x58b7af,function(_0x3e5fc1,_0x81feb6){var _0x459616=_[_0x2382('0x21')](_0x3e5fc1[_0x2382('0x22')])?util[_0x2382('0x1e')](_0x2382('0x1f'),_0x3e5fc1[_0x2382('0x20')]):_0x3e5fc1[_0x2382('0x22')];return _0x459616;});for(var _0x5c20a0 in _0x1be473){if(_0x1be473[_0x2382('0x1d')](_0x5c20a0)){if(!_0x5af510[_0x5c20a0]){delete _0x1be473[_0x5c20a0];}}}}function clearVoiceCallReports(_0x580a91){_0x580a91[_0x2382('0x23')]=0x0;_0x580a91[_0x2382('0x24')]=0x0;_0x580a91['sumHoldTime']=0x0;_0x580a91[_0x2382('0x25')]=0x0;_0x580a91[_0x2382('0x26')]=0x0;}function clearCampaigns(_0x4cd540){if(!_[_0x2382('0x27')](_0x4cd540)){for(var _0x178694 in _0x4cd540){if(_0x4cd540['hasOwnProperty'](_0x178694)){_0x4cd540[_0x178694][_0x2382('0x28')]=0x0;_0x4cd540[_0x178694][_0x2382('0x29')]=0x0;}}}}function clearVoiceQueues(_0x5bcd9b){if(!_[_0x2382('0x27')](_0x5bcd9b)){for(var _0x419407 in _0x5bcd9b){if(_0x5bcd9b[_0x2382('0x1d')](_0x419407)){_0x5bcd9b[_0x419407][_0x2382('0x23')]=0x0;_0x5bcd9b[_0x419407][_0x2382('0x24')]=0x0;_0x5bcd9b[_0x419407][_0x2382('0x2a')]=0x0;_0x5bcd9b[_0x419407]['abandoned']=0x0;_0x5bcd9b[_0x419407][_0x2382('0x2b')]=0x0;_0x5bcd9b[_0x419407][_0x2382('0x25')]=0x0;_0x5bcd9b[_0x419407]['sumBillable']=0x0;_0x5bcd9b[_0x419407]['outboundAnswerAgiCallsDay']=0x0;_0x5bcd9b[_0x419407][_0x2382('0x2c')]=0x0;_0x5bcd9b[_0x419407][_0x2382('0x2d')]=0x0;_0x5bcd9b[_0x419407]['outboundCongestionCallsDay']=0x0;_0x5bcd9b[_0x419407]['outboundNoSuchCallsDay']=0x0;_0x5bcd9b[_0x419407][_0x2382('0x2e')]=0x0;_0x5bcd9b[_0x419407][_0x2382('0x2f')]=0x0;_0x5bcd9b[_0x419407]['outboundDropCallsDayCallersExit']=0x0;_0x5bcd9b[_0x419407][_0x2382('0x30')]=0x0;_0x5bcd9b[_0x419407][_0x2382('0x31')]=0x0;_0x5bcd9b[_0x419407]['outboundRejectCallsDay']=0x0;_0x5bcd9b[_0x419407]['outboundReCallsDay']=0x0;_0x5bcd9b[_0x419407][_0x2382('0x32')]=0x0;_0x5bcd9b[_0x419407][_0x2382('0x33')]=0x0;_0x5bcd9b[_0x419407][_0x2382('0x34')]=!![];}}}}Realtime[_0x2382('0x35')][_0x2382('0x36')]=function(_0x51b0eb,_0x4e871e){for(var _0x1d1152 in _0x4e871e){if(_0x51b0eb[_0x2382('0x1d')](_0x1d1152)){_0x51b0eb[_0x1d1152]=_0x4e871e[_0x1d1152];}}};Realtime['prototype'][_0x2382('0x37')]=function(){var _0x304e8b=this;return function(_0x58ffe7){if(_0x58ffe7){freeIsNotKeyAgent(_0x58ffe7,_0x304e8b[_0x2382('0x38')]);for(var _0x5a3997=0x0,_0x1408a6={},_0x14c290={};_0x5a3997<_0x58ffe7[_0x2382('0x39')];_0x5a3997+=0x1){_0x1408a6=_0x58ffe7[_0x5a3997];var _0x53d944=_[_0x2382('0x21')](_0x1408a6[_0x2382('0x22')])?util[_0x2382('0x1e')](_0x2382('0x1f'),_0x1408a6['name']):_0x1408a6['interface'];if(_['isUndefined'](_0x304e8b[_0x2382('0x38')][_0x53d944])){_0x304e8b[_0x2382('0x38')][_0x53d944]=new Agent(_0x1408a6);}else{_0x304e8b[_0x2382('0x36')](_0x304e8b[_0x2382('0x38')][_0x53d944],_0x1408a6);}}}return _0x304e8b[_0x2382('0x38')];};};Realtime[_0x2382('0x35')][_0x2382('0x3a')]=function(){var _0x146389=this;return function(_0x1c4b44){if(_0x1c4b44){freeIsNotKeySip(_0x1c4b44,_0x146389['telephones']);for(var _0x22ac4b=0x0,_0xd83d63={},_0x1ef911={};_0x22ac4b<_0x1c4b44['length'];_0x22ac4b+=0x1){_0xd83d63=_0x1c4b44[_0x22ac4b];if(_['isUndefined'](_0x146389[_0x2382('0x3b')][util[_0x2382('0x1e')](_0x2382('0x1f'),_0xd83d63[_0x2382('0x20')])])){_0x146389['telephones'][util['format'](_0x2382('0x1f'),_0xd83d63['name'])]=new Telephone(_0xd83d63);}else{_0x146389[_0x2382('0x36')](_0x146389[_0x2382('0x3b')][util[_0x2382('0x1e')]('SIP/%s',_0xd83d63['name'])],_0xd83d63);}}}return _0x146389['telephones'];};};Realtime[_0x2382('0x35')]['initTrunks']=function(){var _0x8fe89=this;return function(_0x1b9bbb){if(_0x1b9bbb){freeIsNotKeySip(_0x1b9bbb,_0x8fe89[_0x2382('0x3c')]);for(var _0x593e31=0x0,_0x5ab8e1={},_0x30f79b={};_0x593e31<_0x1b9bbb[_0x2382('0x39')];_0x593e31+=0x1){_0x5ab8e1=_0x1b9bbb[_0x593e31];if(_[_0x2382('0x3d')](_0x8fe89[_0x2382('0x3c')][util['format']('SIP/%s',_0x5ab8e1[_0x2382('0x20')])])){_0x8fe89[_0x2382('0x3c')][util[_0x2382('0x1e')]('SIP/%s',_0x5ab8e1['name'])]=new Trunk(_0x5ab8e1);}else{_0x8fe89[_0x2382('0x36')](_0x8fe89['trunks'][util[_0x2382('0x1e')](_0x2382('0x1f'),_0x5ab8e1['name'])],_0x5ab8e1);}}}return _0x8fe89[_0x2382('0x3c')];};};Realtime[_0x2382('0x35')][_0x2382('0x3e')]=function(){var _0x3e0664=this;return function(_0x1105f6){if(_0x1105f6){freeIsNotKey(_0x1105f6,_0x3e0664[_0x2382('0xe')],_0x2382('0x20'));for(var _0x1b82c2=0x0,_0x308d77={},_0x42d520={};_0x1b82c2<_0x1105f6[_0x2382('0x39')];_0x1b82c2+=0x1){_0x308d77=_0x1105f6[_0x1b82c2];if(_[_0x2382('0x3d')](_0x3e0664[_0x2382('0xe')][_0x308d77[_0x2382('0x20')]])){_0x3e0664['voiceQueues'][_0x308d77[_0x2382('0x20')]]=new VoiceQueue(_0x308d77);}else{_0x3e0664[_0x2382('0x36')](_0x3e0664[_0x2382('0xe')][_0x308d77[_0x2382('0x20')]],_0x308d77);}}}return _0x3e0664[_0x2382('0xe')];};};Realtime[_0x2382('0x35')][_0x2382('0x3f')]=function(){var _0x1e3a87=this;return function(_0x466c13){if(_0x466c13){freeIsNotKey(_0x466c13,_0x1e3a87[_0x2382('0xf')],'id');for(var _0x1195cd=0x0,_0x307854={},_0x19c944={};_0x1195cd<_0x466c13[_0x2382('0x39')];_0x1195cd+=0x1){_0x307854=_0x466c13[_0x1195cd];if(_[_0x2382('0x3d')](_0x1e3a87[_0x2382('0xf')][_0x307854['id']])){_0x1e3a87[_0x2382('0xf')][_0x307854['id']]=new Trigger(_0x307854);}else{_0x1e3a87[_0x2382('0x36')](_0x1e3a87[_0x2382('0xf')][_0x307854['id']],_0x307854);}}}return _0x1e3a87['triggers'];};};Realtime['prototype'][_0x2382('0x40')]=function(){var _0x420bf8=this;return function(_0x3d7015){if(_0x3d7015){freeIsNotKey(_0x3d7015,_0x420bf8[_0x2382('0x41')],'id');for(var _0x586b8f=0x0,_0x4efa60={},_0x2c9f3a={};_0x586b8f<_0x3d7015['length'];_0x586b8f+=0x1){_0x4efa60=_0x3d7015[_0x586b8f];if(_[_0x2382('0x3d')](_0x420bf8[_0x2382('0x41')][_0x4efa60['id']])){_0x420bf8[_0x2382('0x41')][_0x4efa60['id']]=new Template(_0x4efa60);}else{_0x420bf8[_0x2382('0x36')](_0x420bf8[_0x2382('0x41')][_0x4efa60['id']],_0x4efa60);}}}return _0x420bf8[_0x2382('0x41')];};};Realtime[_0x2382('0x35')][_0x2382('0x42')]=function(){var _0x131788=this;return function(_0x17d025){if(_0x17d025){freeIsNotKey(_0x17d025,_0x131788[_0x2382('0x15')],'id');for(var _0x535810=0x0,_0x1ccdf9={},_0x2b2164={};_0x535810<_0x17d025[_0x2382('0x39')];_0x535810+=0x1){_0x1ccdf9=_0x17d025[_0x535810];if(_[_0x2382('0x3d')](_0x131788[_0x2382('0x15')][_0x1ccdf9['id']])){_0x131788['zendeskAccounts'][_0x1ccdf9['id']]=new ZendeskAccount(_0x1ccdf9);}else{_0x131788['mergeFromDatabase'](_0x131788[_0x2382('0x15')][_0x1ccdf9['id']],_0x1ccdf9);}}}return _0x131788[_0x2382('0x15')];};};Realtime[_0x2382('0x35')][_0x2382('0x43')]=function(){var _0x498b6e=this;return function(_0x509d9e){if(_0x509d9e){freeIsNotKey(_0x509d9e,_0x498b6e[_0x2382('0x16')],'id');for(var _0x165ef5=0x0,_0x1f95ff={},_0x52787e={};_0x165ef5<_0x509d9e[_0x2382('0x39')];_0x165ef5+=0x1){_0x1f95ff=_0x509d9e[_0x165ef5];if(_['isUndefined'](_0x498b6e[_0x2382('0x16')][_0x1f95ff['id']])){_0x498b6e['salesforceAccounts'][_0x1f95ff['id']]=new SalesforceAccount(_0x1f95ff);}else{_0x498b6e[_0x2382('0x36')](_0x498b6e[_0x2382('0x16')][_0x1f95ff['id']],_0x1f95ff);}}}return _0x498b6e[_0x2382('0x16')];};};Realtime[_0x2382('0x35')]['initFreshdeskAccounts']=function(){var _0x10d5b1=this;return function(_0x3f9696){if(_0x3f9696){freeIsNotKey(_0x3f9696,_0x10d5b1[_0x2382('0x18')],'id');for(var _0x259941=0x0,_0x2af419={},_0x2d494e={};_0x259941<_0x3f9696[_0x2382('0x39')];_0x259941+=0x1){_0x2af419=_0x3f9696[_0x259941];if(_['isUndefined'](_0x10d5b1[_0x2382('0x18')][_0x2af419['id']])){_0x10d5b1['freshdeskAccounts'][_0x2af419['id']]=new FreshdeskAccount(_0x2af419);}else{_0x10d5b1[_0x2382('0x36')](_0x10d5b1['freshdeskAccounts'][_0x2af419['id']],_0x2af419);}}}return _0x10d5b1[_0x2382('0x18')];};};Realtime[_0x2382('0x35')][_0x2382('0x44')]=function(){var _0x5021a0=this;return function(_0x4fc6c0){if(_0x4fc6c0){freeIsNotKey(_0x4fc6c0,_0x5021a0['zohoAccounts'],'id');for(var _0x5c5a32=0x0,_0x1f04f9={},_0x11a31c={};_0x5c5a32<_0x4fc6c0[_0x2382('0x39')];_0x5c5a32+=0x1){_0x1f04f9=_0x4fc6c0[_0x5c5a32];if(_['isUndefined'](_0x5021a0[_0x2382('0x45')][_0x1f04f9['id']])){_0x5021a0['zohoAccounts'][_0x1f04f9['id']]=new ZohoAccount(_0x1f04f9);}else{_0x5021a0[_0x2382('0x36')](_0x5021a0['zohoAccounts'][_0x1f04f9['id']],_0x1f04f9);}}}return _0x5021a0[_0x2382('0x45')];};};Realtime[_0x2382('0x35')][_0x2382('0x46')]=function(){var _0x1eaf31=this;return function(_0x4dd686){if(_0x4dd686){freeIsNotKey(_0x4dd686,_0x1eaf31[_0x2382('0x19')],'id');for(var _0x1cdf86=0x0,_0x26c881={},_0x1f3aff={};_0x1cdf86<_0x4dd686[_0x2382('0x39')];_0x1cdf86+=0x1){_0x26c881=_0x4dd686[_0x1cdf86];if(_['isUndefined'](_0x1eaf31[_0x2382('0x19')][_0x26c881['id']])){_0x1eaf31[_0x2382('0x19')][_0x26c881['id']]=new DeskAccount(_0x26c881);}else{_0x1eaf31[_0x2382('0x36')](_0x1eaf31[_0x2382('0x19')][_0x26c881['id']],_0x26c881);}}}return _0x1eaf31[_0x2382('0x19')];};};Realtime[_0x2382('0x35')][_0x2382('0x47')]=function(){var _0x379a4f=this;return function(_0x3d6010){if(_0x3d6010){freeIsNotKey(_0x3d6010,_0x379a4f[_0x2382('0x17')],'id');for(var _0x1d21be=0x0,_0x55d454={},_0x1b20db={};_0x1d21be<_0x3d6010[_0x2382('0x39')];_0x1d21be+=0x1){_0x55d454=_0x3d6010[_0x1d21be];if(_[_0x2382('0x3d')](_0x379a4f['sugarcrmAccounts'][_0x55d454['id']])){_0x379a4f[_0x2382('0x17')][_0x55d454['id']]=new SugarcrmAccount(_0x55d454);}else{_0x379a4f[_0x2382('0x36')](_0x379a4f['sugarcrmAccounts'][_0x55d454['id']],_0x55d454);}}}return _0x379a4f['sugarcrmAccounts'];};};Realtime['prototype'][_0x2382('0x48')]=function(){var _0x39740f=this;return function(_0x4b476f){if(_0x4b476f){freeIsNotKey(_0x4b476f,_0x39740f['vtigerAccounts'],'id');for(var _0x4d9845=0x0,_0x451085={},_0x4d45c1={};_0x4d9845<_0x4b476f[_0x2382('0x39')];_0x4d9845+=0x1){_0x451085=_0x4b476f[_0x4d9845];if(_[_0x2382('0x3d')](_0x39740f[_0x2382('0x1a')][_0x451085['id']])){_0x39740f['vtigerAccounts'][_0x451085['id']]=new VtigerAccount(_0x451085);}else{_0x39740f['mergeFromDatabase'](_0x39740f[_0x2382('0x1a')][_0x451085['id']],_0x451085);}}}return _0x39740f['vtigerAccounts'];};};Realtime['prototype'][_0x2382('0x49')]=function(){var _0x35594d=this;return function(_0x451f4f){if(_0x451f4f){freeIsNotKey(_0x451f4f,_0x35594d['servicenowAccounts'],'id');for(var _0x3219c9=0x0,_0x4ecd6c={},_0x965126={};_0x3219c9<_0x451f4f['length'];_0x3219c9+=0x1){_0x4ecd6c=_0x451f4f[_0x3219c9];if(_[_0x2382('0x3d')](_0x35594d['servicenowAccounts'][_0x4ecd6c['id']])){_0x35594d[_0x2382('0x1b')][_0x4ecd6c['id']]=new ServicenowAccount(_0x4ecd6c);}else{_0x35594d[_0x2382('0x36')](_0x35594d[_0x2382('0x1b')][_0x4ecd6c['id']],_0x4ecd6c);}}}return _0x35594d[_0x2382('0x1b')];};};Realtime[_0x2382('0x35')][_0x2382('0x4a')]=function(){var _0x22c823=this;return function(_0x5f13ad){if(_0x5f13ad){freeIsNotKey(_0x5f13ad,_0x22c823[_0x2382('0x4b')],'id');for(var _0x5c8873=0x0,_0x5360e4={},_0x37b68e={};_0x5c8873<_0x5f13ad[_0x2382('0x39')];_0x5c8873+=0x1){_0x5360e4=_0x5f13ad[_0x5c8873];if(_[_0x2382('0x3d')](_0x22c823[_0x2382('0x4b')][_0x5360e4['id']])){_0x22c823[_0x2382('0x4b')][_0x5360e4['id']]=new Dynamics365Account(_0x5360e4);}else{_0x22c823[_0x2382('0x36')](_0x22c823['dynamics365Accounts'][_0x5360e4['id']],_0x5360e4);}}}return _0x22c823[_0x2382('0x4b')];};};Realtime[_0x2382('0x35')][_0x2382('0x4c')]=function(){var _0x574270=this;return function(_0x4e6173){for(var _0xfc4cdf=0x0;_0xfc4cdf<_0x4e6173[_0x2382('0x39')];_0xfc4cdf+=0x1){_['merge'](_0x574270[_0x2382('0xe')][_0x4e6173[_0xfc4cdf][_0x2382('0x20')]],_0x4e6173[_0xfc4cdf]);}return _0x574270[_0x2382('0xe')];};};Realtime[_0x2382('0x35')][_0x2382('0x4d')]=function(){var _0x191ade=this;return function(_0xcd3b65){clearVoiceQueues(_0x191ade[_0x2382('0xe')]);if(_0xcd3b65){_0xcd3b65=_['groupBy'](_0xcd3b65,_0x2382('0x4e'));for(var _0x1c8905 in _0xcd3b65){if(_0xcd3b65[_0x2382('0x1d')](_0x1c8905)){var _0x5764f7={};for(var _0x2cbb44=0x0;_0x2cbb44<_0xcd3b65[_0x1c8905]['length'];_0x2cbb44+=0x1){var _0x1327e4=_0xcd3b65[_0x1c8905][_0x2cbb44]['queue'];if(_0x191ade['voiceQueues'][_0x1327e4]){if(_0xcd3b65[_0x1c8905][_0x2cbb44][_0x2382('0x4f')]){_0x191ade[_0x2382('0xe')][_0x1327e4]['unmanaged']+=0x1;}if(_0xcd3b65[_0x1c8905][_0x2cbb44]['queuecallerabandon']){_0x191ade['voiceQueues'][_0x1327e4][_0x2382('0x50')]+=0x1;}_0x191ade['voiceQueues'][_0x1327e4][_0x2382('0x2b')]+=moment(_0xcd3b65[_0x1c8905][_0x2cbb44][_0x2382('0x51')])[_0x2382('0x52')](moment(_0xcd3b65[_0x1c8905][_0x2cbb44][_0x2382('0x53')]),_0x2382('0x54'))||0x0;if(_0x2cbb44===_0xcd3b65[_0x1c8905]['length']-0x1){_0x191ade['voiceQueues'][_0x1327e4][_0x2382('0x25')]+=moment(_0xcd3b65[_0x1c8905][_0x2cbb44][_0x2382('0x55')]||_0xcd3b65[_0x1c8905][_0x2cbb44][_0x2382('0x56')]||_0xcd3b65[_0x1c8905][_0x2cbb44][_0x2382('0x57')])[_0x2382('0x52')](moment(_0xcd3b65[_0x1c8905][_0x2cbb44][_0x2382('0x53')]),_0x2382('0x54'))||0x0;_0x191ade[_0x2382('0xe')][_0x1327e4][_0x2382('0x23')]+=0x1;if(_0xcd3b65[_0x1c8905][_0x2cbb44][_0x2382('0x58')]){_0x191ade[_0x2382('0xe')][_0x1327e4][_0x2382('0x24')]+=0x1;_0x191ade['voiceQueues'][_0x1327e4][_0x2382('0x26')]+=moment(_0xcd3b65[_0x1c8905][_0x2cbb44][_0x2382('0x55')])['diff'](moment(_0xcd3b65[_0x1c8905][_0x2cbb44][_0x2382('0x51')]),_0x2382('0x54'))||0x0;}}else{_0x191ade[_0x2382('0xe')][_0x1327e4][_0x2382('0x25')]+=_0x191ade['voiceQueues'][_0x1327e4][_0x2382('0x2b')]||0x0;}}}}}}return _0x191ade[_0x2382('0xe')];};};Realtime[_0x2382('0x35')][_0x2382('0x59')]=function(){var _0xdf7bde=this;return function(_0x24fc24){clearVoiceCallReports(_0xdf7bde['outbound']);if(_0x24fc24){for(var _0xb7e5be=0x0;_0xb7e5be<_0x24fc24[_0x2382('0x39')];_0xb7e5be+=0x1){_0xdf7bde[_0x2382('0x11')][_0x2382('0x23')]+=0x1;_0xdf7bde[_0x2382('0x11')]['sumDuration']+=_0x24fc24[_0xb7e5be][_0x2382('0x5a')];if(_0x24fc24[_0xb7e5be][_0x2382('0x5b')]===_0x2382('0x5c')){_0xdf7bde[_0x2382('0x11')][_0x2382('0x24')]+=0x1;_0xdf7bde[_0x2382('0x11')][_0x2382('0x2b')]+=_0x24fc24[_0xb7e5be][_0x2382('0x5a')]-_0x24fc24[_0xb7e5be][_0x2382('0x5d')]||0x0;_0xdf7bde[_0x2382('0x11')][_0x2382('0x26')]+=_0x24fc24[_0xb7e5be][_0x2382('0x5d')];}}}return _0xdf7bde[_0x2382('0x11')];};};Realtime[_0x2382('0x35')]['initCampaigns']=function(){var _0x26a053=this;return function(_0x4f0add){if(_0x4f0add){freeIsNotKey(_0x4f0add,_0x26a053[_0x2382('0x10')],_0x2382('0x20'));for(var _0x10ec4d=0x0,_0x1022fe={};_0x10ec4d<_0x4f0add['length'];_0x10ec4d+=0x1){_0x1022fe=_0x4f0add[_0x10ec4d];if(_[_0x2382('0x3d')](_0x26a053[_0x2382('0x10')][_0x1022fe[_0x2382('0x20')]])){_0x26a053[_0x2382('0x10')][_0x1022fe[_0x2382('0x20')]]=new Campaign(_0x1022fe);}else{_0x26a053[_0x2382('0x36')](_0x26a053[_0x2382('0x10')][_0x1022fe[_0x2382('0x20')]],_0x1022fe);}}}return _0x26a053[_0x2382('0x10')];};};Realtime['prototype'][_0x2382('0x5e')]=function(){var _0x301e81=this;return function(_0x2419db){if(_0x2419db){freeIsNotKey(_0x2419db,_0x301e81[_0x2382('0x12')],'id');for(var _0x5ac4de=0x0,_0x2328fb={};_0x5ac4de<_0x2419db[_0x2382('0x39')];_0x5ac4de+=0x1){_0x2328fb=_0x2419db[_0x5ac4de];if(_[_0x2382('0x3d')](_0x301e81['voiceExtensions'][_0x2328fb['id']])){_0x301e81[_0x2382('0x12')][_0x2328fb['id']]=new VoiceExtension(_0x2328fb);}else{_0x301e81['mergeFromDatabase'](_0x301e81[_0x2382('0x12')][_0x2328fb['id']],_0x2328fb);}}}return _0x301e81['voiceExtensions'];};};Realtime[_0x2382('0x35')][_0x2382('0x5f')]=function(){var _0x514eb9=this;return function(_0x3f6171){clearCampaigns(_0x514eb9[_0x2382('0x10')]);for(var _0x300039=0x0;_0x300039<_0x3f6171[_0x2382('0x39')];_0x300039+=0x1){_['merge'](_0x514eb9[_0x2382('0x10')][_0x3f6171[_0x300039][_0x2382('0x20')]],_0x3f6171[_0x300039]);}return _0x514eb9[_0x2382('0x10')];};};Realtime[_0x2382('0x35')]['initFaxAccounts']=function(){var _0x29b4c0=this;return function(_0x31d3b0){if(_0x31d3b0){freeIsNotKey(_0x31d3b0,_0x29b4c0[_0x2382('0x60')],'id');for(var _0x127b46=0x0,_0xc67fc={},_0x18e57e={};_0x127b46<_0x31d3b0[_0x2382('0x39')];_0x127b46+=0x1){_0xc67fc=_0x31d3b0[_0x127b46];if(_[_0x2382('0x3d')](_0x29b4c0['faxAccounts'][_0xc67fc['id']])){_0x29b4c0[_0x2382('0x60')][_0xc67fc['id']]=new FaxAccount(_0xc67fc);}else{_0x29b4c0[_0x2382('0x36')](_0x29b4c0['faxAccounts'][_0xc67fc['id']],_0xc67fc);}}}return _0x29b4c0[_0x2382('0x60')];};};module['exports']=Realtime;
\ No newline at end of file
+var _0x77b4=['../model/dynamics365Account','agents','telephones','trunks','voiceQueues','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','timers','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','isNil','interface','sumDuration','sumBillable','isEmpty','answered','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','name','isUndefined','initVoiceQueues','initTriggers','triggers','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','merge','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','total','queuecallercomplete','initVoiceCallReports','duration','billableseconds','initCampaigns','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount'];(function(_0x14b773,_0x3296ae){var _0x235c49=function(_0x24b354){while(--_0x24b354){_0x14b773['push'](_0x14b773['shift']());}};_0x235c49(++_0x3296ae);}(_0x77b4,0x11d));var _0x477b=function(_0x5ca9b4,_0x2bfd14){_0x5ca9b4=_0x5ca9b4-0x0;var _0x42731a=_0x77b4[_0x5ca9b4];return _0x42731a;};'use strict';var BPromise=require('bluebird');var util=require(_0x477b('0x0'));var _=require(_0x477b('0x1'));var moment=require(_0x477b('0x2'));var Agent=require(_0x477b('0x3'));var Telephone=require(_0x477b('0x4'));var Trunk=require(_0x477b('0x5'));var VoiceQueue=require(_0x477b('0x6'));var Trigger=require('../model/trigger');var Template=require(_0x477b('0x7'));var Campaign=require(_0x477b('0x8'));var VoiceExtension=require(_0x477b('0x9'));var ZendeskAccount=require(_0x477b('0xa'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x477b('0xb'));var SugarcrmAccount=require(_0x477b('0xc'));var ZohoAccount=require(_0x477b('0xd'));var DeskAccount=require(_0x477b('0xe'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x477b('0xf'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x477b('0x10')]={};this[_0x477b('0x11')]={};this[_0x477b('0x12')]={};this[_0x477b('0x13')]={};this['triggers']={};this[_0x477b('0x14')]={};this[_0x477b('0x15')]={};this[_0x477b('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x477b('0x17')]={};this[_0x477b('0x18')]={};this[_0x477b('0x19')]={};this['outboundChannels']={};this[_0x477b('0x1a')]={};this['zendeskAccounts']={};this[_0x477b('0x1b')]={};this['sugarcrmAccounts']={};this[_0x477b('0x1c')]={};this[_0x477b('0x1d')]={};this[_0x477b('0x1e')]={};this[_0x477b('0x1f')]={};this[_0x477b('0x20')]={};this[_0x477b('0x21')]={};this[_0x477b('0x22')]={};};function freeIsNotKey(_0x5787cd,_0x409b54,_0xa67638){var _0x142b08=_[_0x477b('0x23')](_0x5787cd,function(_0x4b151e,_0x474129){return _0x4b151e[_0xa67638];});for(var _0x5261ba in _0x409b54){if(_0x409b54[_0x477b('0x24')](_0x5261ba)){if(!_0x142b08[_0x5261ba]){delete _0x409b54[_0x5261ba];}}}}function freeIsNotKeySip(_0x223e77,_0x31a16f){var _0x5fdc78=_[_0x477b('0x23')](_0x223e77,function(_0x5aadb6,_0x312697){return util[_0x477b('0x25')](_0x477b('0x26'),_0x5aadb6['name']);});for(var _0x257084 in _0x31a16f){if(_0x31a16f['hasOwnProperty'](_0x257084)){if(!_0x5fdc78[_0x257084]){delete _0x31a16f[_0x257084];}}}}function freeIsNotKeyAgent(_0x2ff34f,_0x57be6b){var _0x26a6ff=_[_0x477b('0x23')](_0x2ff34f,function(_0xb028b,_0x400140){var _0x133bc7=_[_0x477b('0x27')](_0xb028b[_0x477b('0x28')])?util[_0x477b('0x25')](_0x477b('0x26'),_0xb028b['name']):_0xb028b[_0x477b('0x28')];return _0x133bc7;});for(var _0x4e0a3f in _0x57be6b){if(_0x57be6b[_0x477b('0x24')](_0x4e0a3f)){if(!_0x26a6ff[_0x4e0a3f]){delete _0x57be6b[_0x4e0a3f];}}}}function clearVoiceCallReports(_0x466d96){_0x466d96['total']=0x0;_0x466d96['answered']=0x0;_0x466d96['sumHoldTime']=0x0;_0x466d96[_0x477b('0x29')]=0x0;_0x466d96[_0x477b('0x2a')]=0x0;}function clearCampaigns(_0x36e13a){if(!_[_0x477b('0x2b')](_0x36e13a)){for(var _0x4a3142 in _0x36e13a){if(_0x36e13a[_0x477b('0x24')](_0x4a3142)){_0x36e13a[_0x4a3142]['ivrTotalCallsDays']=0x0;_0x36e13a[_0x4a3142]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x24077a){if(!_['isEmpty'](_0x24077a)){for(var _0x1b92b9 in _0x24077a){if(_0x24077a['hasOwnProperty'](_0x1b92b9)){_0x24077a[_0x1b92b9]['total']=0x0;_0x24077a[_0x1b92b9][_0x477b('0x2c')]=0x0;_0x24077a[_0x1b92b9][_0x477b('0x2d')]=0x0;_0x24077a[_0x1b92b9][_0x477b('0x2e')]=0x0;_0x24077a[_0x1b92b9][_0x477b('0x2f')]=0x0;_0x24077a[_0x1b92b9][_0x477b('0x29')]=0x0;_0x24077a[_0x1b92b9][_0x477b('0x2a')]=0x0;_0x24077a[_0x1b92b9][_0x477b('0x30')]=0x0;_0x24077a[_0x1b92b9][_0x477b('0x31')]=0x0;_0x24077a[_0x1b92b9][_0x477b('0x32')]=0x0;_0x24077a[_0x1b92b9][_0x477b('0x33')]=0x0;_0x24077a[_0x1b92b9][_0x477b('0x34')]=0x0;_0x24077a[_0x1b92b9]['outboundUnknownCallsDay']=0x0;_0x24077a[_0x1b92b9]['outboundDropCallsDayTimeout']=0x0;_0x24077a[_0x1b92b9][_0x477b('0x35')]=0x0;_0x24077a[_0x1b92b9][_0x477b('0x36')]=0x0;_0x24077a[_0x1b92b9][_0x477b('0x37')]=0x0;_0x24077a[_0x1b92b9][_0x477b('0x38')]=0x0;_0x24077a[_0x1b92b9][_0x477b('0x39')]=0x0;_0x24077a[_0x1b92b9][_0x477b('0x30')]=0x0;_0x24077a[_0x1b92b9][_0x477b('0x3a')]=0x0;_0x24077a[_0x1b92b9][_0x477b('0x3b')]=!![];}}}}Realtime[_0x477b('0x3c')][_0x477b('0x3d')]=function(_0x1b6eb7,_0xf29ce7){for(var _0x2602c9 in _0xf29ce7){if(_0x1b6eb7[_0x477b('0x24')](_0x2602c9)){_0x1b6eb7[_0x2602c9]=_0xf29ce7[_0x2602c9];}}};Realtime[_0x477b('0x3c')][_0x477b('0x3e')]=function(){var _0x5e8cf8=this;return function(_0x22837a){if(_0x22837a){freeIsNotKeyAgent(_0x22837a,_0x5e8cf8['agents']);for(var _0x48dac7=0x0,_0x1f2699={},_0x336ebd={};_0x48dac7<_0x22837a[_0x477b('0x3f')];_0x48dac7+=0x1){_0x1f2699=_0x22837a[_0x48dac7];var _0x19b448=_[_0x477b('0x27')](_0x1f2699[_0x477b('0x28')])?util['format'](_0x477b('0x26'),_0x1f2699[_0x477b('0x40')]):_0x1f2699[_0x477b('0x28')];if(_[_0x477b('0x41')](_0x5e8cf8[_0x477b('0x10')][_0x19b448])){_0x5e8cf8[_0x477b('0x10')][_0x19b448]=new Agent(_0x1f2699);}else{_0x5e8cf8[_0x477b('0x3d')](_0x5e8cf8[_0x477b('0x10')][_0x19b448],_0x1f2699);}}}return _0x5e8cf8[_0x477b('0x10')];};};Realtime[_0x477b('0x3c')]['initTelephones']=function(){var _0x5b96b8=this;return function(_0x17ee31){if(_0x17ee31){freeIsNotKeySip(_0x17ee31,_0x5b96b8[_0x477b('0x11')]);for(var _0x24fab9=0x0,_0x27ab46={},_0xf7d12d={};_0x24fab9<_0x17ee31[_0x477b('0x3f')];_0x24fab9+=0x1){_0x27ab46=_0x17ee31[_0x24fab9];if(_[_0x477b('0x41')](_0x5b96b8[_0x477b('0x11')][util[_0x477b('0x25')]('SIP/%s',_0x27ab46[_0x477b('0x40')])])){_0x5b96b8[_0x477b('0x11')][util[_0x477b('0x25')](_0x477b('0x26'),_0x27ab46[_0x477b('0x40')])]=new Telephone(_0x27ab46);}else{_0x5b96b8[_0x477b('0x3d')](_0x5b96b8['telephones'][util['format'](_0x477b('0x26'),_0x27ab46[_0x477b('0x40')])],_0x27ab46);}}}return _0x5b96b8[_0x477b('0x11')];};};Realtime[_0x477b('0x3c')]['initTrunks']=function(){var _0x1bf228=this;return function(_0x3b95e0){if(_0x3b95e0){freeIsNotKeySip(_0x3b95e0,_0x1bf228['trunks']);for(var _0x1df535=0x0,_0x146043={},_0x1c6144={};_0x1df535<_0x3b95e0['length'];_0x1df535+=0x1){_0x146043=_0x3b95e0[_0x1df535];if(_[_0x477b('0x41')](_0x1bf228[_0x477b('0x12')][util[_0x477b('0x25')](_0x477b('0x26'),_0x146043[_0x477b('0x40')])])){_0x1bf228[_0x477b('0x12')][util[_0x477b('0x25')]('SIP/%s',_0x146043[_0x477b('0x40')])]=new Trunk(_0x146043);}else{_0x1bf228[_0x477b('0x3d')](_0x1bf228[_0x477b('0x12')][util[_0x477b('0x25')]('SIP/%s',_0x146043[_0x477b('0x40')])],_0x146043);}}}return _0x1bf228[_0x477b('0x12')];};};Realtime[_0x477b('0x3c')][_0x477b('0x42')]=function(){var _0x34fd39=this;return function(_0x42cab5){if(_0x42cab5){freeIsNotKey(_0x42cab5,_0x34fd39['voiceQueues'],_0x477b('0x40'));for(var _0x19b4e8=0x0,_0x107d2e={},_0x26c117={};_0x19b4e8<_0x42cab5[_0x477b('0x3f')];_0x19b4e8+=0x1){_0x107d2e=_0x42cab5[_0x19b4e8];if(_[_0x477b('0x41')](_0x34fd39[_0x477b('0x13')][_0x107d2e[_0x477b('0x40')]])){_0x34fd39[_0x477b('0x13')][_0x107d2e[_0x477b('0x40')]]=new VoiceQueue(_0x107d2e);}else{_0x34fd39[_0x477b('0x3d')](_0x34fd39[_0x477b('0x13')][_0x107d2e[_0x477b('0x40')]],_0x107d2e);}}}return _0x34fd39['voiceQueues'];};};Realtime[_0x477b('0x3c')][_0x477b('0x43')]=function(){var _0x221b61=this;return function(_0x1a1be1){if(_0x1a1be1){freeIsNotKey(_0x1a1be1,_0x221b61[_0x477b('0x44')],'id');for(var _0x30e892=0x0,_0x395ae4={},_0x44f358={};_0x30e892<_0x1a1be1[_0x477b('0x3f')];_0x30e892+=0x1){_0x395ae4=_0x1a1be1[_0x30e892];if(_[_0x477b('0x41')](_0x221b61[_0x477b('0x44')][_0x395ae4['id']])){_0x221b61[_0x477b('0x44')][_0x395ae4['id']]=new Trigger(_0x395ae4);}else{_0x221b61['mergeFromDatabase'](_0x221b61[_0x477b('0x44')][_0x395ae4['id']],_0x395ae4);}}}return _0x221b61[_0x477b('0x44')];};};Realtime['prototype']['initTemplates']=function(){var _0x21476a=this;return function(_0x9eb00f){if(_0x9eb00f){freeIsNotKey(_0x9eb00f,_0x21476a[_0x477b('0x15')],'id');for(var _0x2fb5ea=0x0,_0x4be114={},_0x14a571={};_0x2fb5ea<_0x9eb00f['length'];_0x2fb5ea+=0x1){_0x4be114=_0x9eb00f[_0x2fb5ea];if(_['isUndefined'](_0x21476a[_0x477b('0x15')][_0x4be114['id']])){_0x21476a[_0x477b('0x15')][_0x4be114['id']]=new Template(_0x4be114);}else{_0x21476a['mergeFromDatabase'](_0x21476a[_0x477b('0x15')][_0x4be114['id']],_0x4be114);}}}return _0x21476a[_0x477b('0x15')];};};Realtime[_0x477b('0x3c')]['initZendeskAccounts']=function(){var _0x46e4e5=this;return function(_0x355b57){if(_0x355b57){freeIsNotKey(_0x355b57,_0x46e4e5[_0x477b('0x45')],'id');for(var _0x2e5d8b=0x0,_0x353821={},_0x19d8dd={};_0x2e5d8b<_0x355b57['length'];_0x2e5d8b+=0x1){_0x353821=_0x355b57[_0x2e5d8b];if(_['isUndefined'](_0x46e4e5[_0x477b('0x45')][_0x353821['id']])){_0x46e4e5[_0x477b('0x45')][_0x353821['id']]=new ZendeskAccount(_0x353821);}else{_0x46e4e5[_0x477b('0x3d')](_0x46e4e5['zendeskAccounts'][_0x353821['id']],_0x353821);}}}return _0x46e4e5[_0x477b('0x45')];};};Realtime['prototype'][_0x477b('0x46')]=function(){var _0x1992eb=this;return function(_0x5e29ca){if(_0x5e29ca){freeIsNotKey(_0x5e29ca,_0x1992eb[_0x477b('0x1b')],'id');for(var _0x4bdc71=0x0,_0xc75b4b={},_0x41cfdf={};_0x4bdc71<_0x5e29ca[_0x477b('0x3f')];_0x4bdc71+=0x1){_0xc75b4b=_0x5e29ca[_0x4bdc71];if(_['isUndefined'](_0x1992eb['salesforceAccounts'][_0xc75b4b['id']])){_0x1992eb[_0x477b('0x1b')][_0xc75b4b['id']]=new SalesforceAccount(_0xc75b4b);}else{_0x1992eb[_0x477b('0x3d')](_0x1992eb[_0x477b('0x1b')][_0xc75b4b['id']],_0xc75b4b);}}}return _0x1992eb['salesforceAccounts'];};};Realtime[_0x477b('0x3c')][_0x477b('0x47')]=function(){var _0x1d79c5=this;return function(_0x445c5e){if(_0x445c5e){freeIsNotKey(_0x445c5e,_0x1d79c5[_0x477b('0x1c')],'id');for(var _0x20f865=0x0,_0x425519={},_0x352f5e={};_0x20f865<_0x445c5e[_0x477b('0x3f')];_0x20f865+=0x1){_0x425519=_0x445c5e[_0x20f865];if(_[_0x477b('0x41')](_0x1d79c5['freshdeskAccounts'][_0x425519['id']])){_0x1d79c5[_0x477b('0x1c')][_0x425519['id']]=new FreshdeskAccount(_0x425519);}else{_0x1d79c5[_0x477b('0x3d')](_0x1d79c5[_0x477b('0x1c')][_0x425519['id']],_0x425519);}}}return _0x1d79c5['freshdeskAccounts'];};};Realtime[_0x477b('0x3c')]['initZohoAccounts']=function(){var _0x51d115=this;return function(_0x58b1ee){if(_0x58b1ee){freeIsNotKey(_0x58b1ee,_0x51d115[_0x477b('0x1d')],'id');for(var _0x216643=0x0,_0x16ccca={},_0x5b3e39={};_0x216643<_0x58b1ee[_0x477b('0x3f')];_0x216643+=0x1){_0x16ccca=_0x58b1ee[_0x216643];if(_['isUndefined'](_0x51d115[_0x477b('0x1d')][_0x16ccca['id']])){_0x51d115[_0x477b('0x1d')][_0x16ccca['id']]=new ZohoAccount(_0x16ccca);}else{_0x51d115[_0x477b('0x3d')](_0x51d115[_0x477b('0x1d')][_0x16ccca['id']],_0x16ccca);}}}return _0x51d115['zohoAccounts'];};};Realtime[_0x477b('0x3c')][_0x477b('0x48')]=function(){var _0x116131=this;return function(_0x2c0c60){if(_0x2c0c60){freeIsNotKey(_0x2c0c60,_0x116131[_0x477b('0x1e')],'id');for(var _0x2ac512=0x0,_0x1df20c={},_0x4254e7={};_0x2ac512<_0x2c0c60[_0x477b('0x3f')];_0x2ac512+=0x1){_0x1df20c=_0x2c0c60[_0x2ac512];if(_['isUndefined'](_0x116131['deskAccounts'][_0x1df20c['id']])){_0x116131[_0x477b('0x1e')][_0x1df20c['id']]=new DeskAccount(_0x1df20c);}else{_0x116131[_0x477b('0x3d')](_0x116131[_0x477b('0x1e')][_0x1df20c['id']],_0x1df20c);}}}return _0x116131[_0x477b('0x1e')];};};Realtime['prototype'][_0x477b('0x49')]=function(){var _0x91f078=this;return function(_0x2ba028){if(_0x2ba028){freeIsNotKey(_0x2ba028,_0x91f078[_0x477b('0x4a')],'id');for(var _0x508a3b=0x0,_0x572537={},_0x4c383a={};_0x508a3b<_0x2ba028[_0x477b('0x3f')];_0x508a3b+=0x1){_0x572537=_0x2ba028[_0x508a3b];if(_[_0x477b('0x41')](_0x91f078['sugarcrmAccounts'][_0x572537['id']])){_0x91f078[_0x477b('0x4a')][_0x572537['id']]=new SugarcrmAccount(_0x572537);}else{_0x91f078[_0x477b('0x3d')](_0x91f078[_0x477b('0x4a')][_0x572537['id']],_0x572537);}}}return _0x91f078[_0x477b('0x4a')];};};Realtime[_0x477b('0x3c')][_0x477b('0x4b')]=function(){var _0xbb4db1=this;return function(_0x30b08a){if(_0x30b08a){freeIsNotKey(_0x30b08a,_0xbb4db1[_0x477b('0x1f')],'id');for(var _0x5bcc6a=0x0,_0x4cf3a0={},_0xbe5ad0={};_0x5bcc6a<_0x30b08a['length'];_0x5bcc6a+=0x1){_0x4cf3a0=_0x30b08a[_0x5bcc6a];if(_['isUndefined'](_0xbb4db1[_0x477b('0x1f')][_0x4cf3a0['id']])){_0xbb4db1[_0x477b('0x1f')][_0x4cf3a0['id']]=new VtigerAccount(_0x4cf3a0);}else{_0xbb4db1[_0x477b('0x3d')](_0xbb4db1[_0x477b('0x1f')][_0x4cf3a0['id']],_0x4cf3a0);}}}return _0xbb4db1['vtigerAccounts'];};};Realtime[_0x477b('0x3c')][_0x477b('0x4c')]=function(){var _0x2b7b75=this;return function(_0x440377){if(_0x440377){freeIsNotKey(_0x440377,_0x2b7b75[_0x477b('0x20')],'id');for(var _0x37b270=0x0,_0xf2b77d={},_0x16b05e={};_0x37b270<_0x440377[_0x477b('0x3f')];_0x37b270+=0x1){_0xf2b77d=_0x440377[_0x37b270];if(_['isUndefined'](_0x2b7b75[_0x477b('0x20')][_0xf2b77d['id']])){_0x2b7b75['servicenowAccounts'][_0xf2b77d['id']]=new ServicenowAccount(_0xf2b77d);}else{_0x2b7b75[_0x477b('0x3d')](_0x2b7b75[_0x477b('0x20')][_0xf2b77d['id']],_0xf2b77d);}}}return _0x2b7b75[_0x477b('0x20')];};};Realtime[_0x477b('0x3c')][_0x477b('0x4d')]=function(){var _0x157e8d=this;return function(_0xdd14dc){if(_0xdd14dc){freeIsNotKey(_0xdd14dc,_0x157e8d[_0x477b('0x21')],'id');for(var _0x3e7f17=0x0,_0x292356={},_0x5b072e={};_0x3e7f17<_0xdd14dc[_0x477b('0x3f')];_0x3e7f17+=0x1){_0x292356=_0xdd14dc[_0x3e7f17];if(_[_0x477b('0x41')](_0x157e8d[_0x477b('0x21')][_0x292356['id']])){_0x157e8d[_0x477b('0x21')][_0x292356['id']]=new Dynamics365Account(_0x292356);}else{_0x157e8d[_0x477b('0x3d')](_0x157e8d[_0x477b('0x21')][_0x292356['id']],_0x292356);}}}return _0x157e8d[_0x477b('0x21')];};};Realtime['prototype'][_0x477b('0x4e')]=function(){var _0x29a968=this;return function(_0x66c372){for(var _0xa63bae=0x0;_0xa63bae<_0x66c372[_0x477b('0x3f')];_0xa63bae+=0x1){_[_0x477b('0x4f')](_0x29a968[_0x477b('0x13')][_0x66c372[_0xa63bae]['name']],_0x66c372[_0xa63bae]);}return _0x29a968[_0x477b('0x13')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x15e0c8=this;return function(_0x9d6c60){clearVoiceQueues(_0x15e0c8[_0x477b('0x13')]);if(_0x9d6c60){_0x9d6c60=_['groupBy'](_0x9d6c60,'uniqueid');for(var _0x5c7a7b in _0x9d6c60){if(_0x9d6c60['hasOwnProperty'](_0x5c7a7b)){var _0x8346d8={};for(var _0xbea53f=0x0;_0xbea53f<_0x9d6c60[_0x5c7a7b][_0x477b('0x3f')];_0xbea53f+=0x1){var _0x14b779=_0x9d6c60[_0x5c7a7b][_0xbea53f][_0x477b('0x50')];if(_0x15e0c8[_0x477b('0x13')][_0x14b779]){if(_0x9d6c60[_0x5c7a7b][_0xbea53f][_0x477b('0x51')]){_0x15e0c8[_0x477b('0x13')][_0x14b779][_0x477b('0x2d')]+=0x1;}if(_0x9d6c60[_0x5c7a7b][_0xbea53f][_0x477b('0x52')]){_0x15e0c8['voiceQueues'][_0x14b779][_0x477b('0x2e')]+=0x1;}_0x15e0c8['voiceQueues'][_0x14b779][_0x477b('0x2f')]+=moment(_0x9d6c60[_0x5c7a7b][_0xbea53f][_0x477b('0x53')])['diff'](moment(_0x9d6c60[_0x5c7a7b][_0xbea53f][_0x477b('0x54')]),_0x477b('0x55'))||0x0;if(_0xbea53f===_0x9d6c60[_0x5c7a7b][_0x477b('0x3f')]-0x1){_0x15e0c8[_0x477b('0x13')][_0x14b779]['sumDuration']+=moment(_0x9d6c60[_0x5c7a7b][_0xbea53f][_0x477b('0x56')]||_0x9d6c60[_0x5c7a7b][_0xbea53f][_0x477b('0x57')]||_0x9d6c60[_0x5c7a7b][_0xbea53f][_0x477b('0x58')])[_0x477b('0x59')](moment(_0x9d6c60[_0x5c7a7b][_0xbea53f][_0x477b('0x54')]),_0x477b('0x55'))||0x0;_0x15e0c8[_0x477b('0x13')][_0x14b779][_0x477b('0x5a')]+=0x1;if(_0x9d6c60[_0x5c7a7b][_0xbea53f][_0x477b('0x5b')]){_0x15e0c8[_0x477b('0x13')][_0x14b779][_0x477b('0x2c')]+=0x1;_0x15e0c8[_0x477b('0x13')][_0x14b779]['sumBillable']+=moment(_0x9d6c60[_0x5c7a7b][_0xbea53f][_0x477b('0x56')])['diff'](moment(_0x9d6c60[_0x5c7a7b][_0xbea53f]['queuecallerleaveAt']),_0x477b('0x55'))||0x0;}}else{_0x15e0c8[_0x477b('0x13')][_0x14b779][_0x477b('0x29')]+=_0x15e0c8[_0x477b('0x13')][_0x14b779]['sumHoldTime']||0x0;}}}}}}return _0x15e0c8[_0x477b('0x13')];};};Realtime[_0x477b('0x3c')][_0x477b('0x5c')]=function(){var _0x48bacb=this;return function(_0xc4ac71){clearVoiceCallReports(_0x48bacb[_0x477b('0x16')]);if(_0xc4ac71){for(var _0x2495c6=0x0;_0x2495c6<_0xc4ac71[_0x477b('0x3f')];_0x2495c6+=0x1){_0x48bacb[_0x477b('0x16')][_0x477b('0x5a')]+=0x1;_0x48bacb[_0x477b('0x16')]['sumDuration']+=_0xc4ac71[_0x2495c6][_0x477b('0x5d')];if(_0xc4ac71[_0x2495c6]['disposition']==='ANSWERED'){_0x48bacb[_0x477b('0x16')][_0x477b('0x2c')]+=0x1;_0x48bacb[_0x477b('0x16')][_0x477b('0x2f')]+=_0xc4ac71[_0x2495c6][_0x477b('0x5d')]-_0xc4ac71[_0x2495c6][_0x477b('0x5e')]||0x0;_0x48bacb[_0x477b('0x16')][_0x477b('0x2a')]+=_0xc4ac71[_0x2495c6][_0x477b('0x5e')];}}}return _0x48bacb[_0x477b('0x16')];};};Realtime['prototype'][_0x477b('0x5f')]=function(){var _0x53b811=this;return function(_0xb7d73){if(_0xb7d73){freeIsNotKey(_0xb7d73,_0x53b811[_0x477b('0x14')],_0x477b('0x40'));for(var _0x2d5b29=0x0,_0x5ca3b9={};_0x2d5b29<_0xb7d73['length'];_0x2d5b29+=0x1){_0x5ca3b9=_0xb7d73[_0x2d5b29];if(_['isUndefined'](_0x53b811[_0x477b('0x14')][_0x5ca3b9[_0x477b('0x40')]])){_0x53b811['campaigns'][_0x5ca3b9[_0x477b('0x40')]]=new Campaign(_0x5ca3b9);}else{_0x53b811[_0x477b('0x3d')](_0x53b811[_0x477b('0x14')][_0x5ca3b9[_0x477b('0x40')]],_0x5ca3b9);}}}return _0x53b811[_0x477b('0x14')];};};Realtime[_0x477b('0x3c')][_0x477b('0x60')]=function(){var _0x11f711=this;return function(_0x525b78){if(_0x525b78){freeIsNotKey(_0x525b78,_0x11f711[_0x477b('0x17')],'id');for(var _0x5abb05=0x0,_0x55c507={};_0x5abb05<_0x525b78[_0x477b('0x3f')];_0x5abb05+=0x1){_0x55c507=_0x525b78[_0x5abb05];if(_[_0x477b('0x41')](_0x11f711[_0x477b('0x17')][_0x55c507['id']])){_0x11f711[_0x477b('0x17')][_0x55c507['id']]=new VoiceExtension(_0x55c507);}else{_0x11f711[_0x477b('0x3d')](_0x11f711[_0x477b('0x17')][_0x55c507['id']],_0x55c507);}}}return _0x11f711[_0x477b('0x17')];};};Realtime['prototype'][_0x477b('0x61')]=function(){var _0x3138f2=this;return function(_0x1cd798){clearCampaigns(_0x3138f2[_0x477b('0x14')]);for(var _0x525530=0x0;_0x525530<_0x1cd798[_0x477b('0x3f')];_0x525530+=0x1){_[_0x477b('0x4f')](_0x3138f2['campaigns'][_0x1cd798[_0x525530][_0x477b('0x40')]],_0x1cd798[_0x525530]);}return _0x3138f2['campaigns'];};};Realtime[_0x477b('0x3c')][_0x477b('0x62')]=function(){var _0x2266f3=this;return function(_0x1b1c0d){if(_0x1b1c0d){freeIsNotKey(_0x1b1c0d,_0x2266f3['faxAccounts'],'id');for(var _0x4d1835=0x0,_0x37b260={},_0x198ef9={};_0x4d1835<_0x1b1c0d['length'];_0x4d1835+=0x1){_0x37b260=_0x1b1c0d[_0x4d1835];if(_[_0x477b('0x41')](_0x2266f3[_0x477b('0x22')][_0x37b260['id']])){_0x2266f3[_0x477b('0x22')][_0x37b260['id']]=new FaxAccount(_0x37b260);}else{_0x2266f3[_0x477b('0x3d')](_0x2266f3[_0x477b('0x22')][_0x37b260['id']],_0x37b260);}}}return _0x2266f3['faxAccounts'];};};module[_0x477b('0x63')]=Realtime;
\ No newline at end of file
index e47014d..f18d4d9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5a9f=['bluebird','moment','util','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./userReport','realtime','agents','telephones','prototype','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','voiceQueueReport','assigned','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','destination','type','dialer','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','disposition','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','monitor','monitors','createdAt','exten','connectedlinename','membername','xcally-motion-dialer','voiceAgentReport','channel','Local','substring','indexOf','lastIndexOf','voiceDialReport','blindTransfer','attendedTransfer','exports'];(function(_0x4e02f2,_0x16f365){var _0x950618=function(_0x545c4a){while(--_0x545c4a){_0x4e02f2['push'](_0x4e02f2['shift']());}};_0x950618(++_0x16f365);}(_0x5a9f,0x14f));var _0xf5a9=function(_0x6499cf,_0x29ee68){_0x6499cf=_0x6499cf-0x0;var _0x4fab82=_0x5a9f[_0x6499cf];return _0x4fab82;};'use strict';var BPromise=require(_0xf5a9('0x0'));var _=require('lodash');var moment=require(_0xf5a9('0x1'));var util=require(_0xf5a9('0x2'));var logger=require('../../../config/logger')('ami');var ami=require(_0xf5a9('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0xf5a9('0x4'));var RpcVoiceDialReport=require(_0xf5a9('0x5'));var RpcMemberReport=require(_0xf5a9('0x6'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xf5a9('0x7'));var RpcVoiceTransferReport=require(_0xf5a9('0x8'));var VoiceQueueReport=require(_0xf5a9('0x9'));var VoiceCallReport=require(_0xf5a9('0xa'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xf5a9('0xb'));function Report(_0x39a730){this[_0xf5a9('0xc')]=_0x39a730;this[_0xf5a9('0xd')]=_0x39a730[_0xf5a9('0xd')];this[_0xf5a9('0xe')]=_0x39a730[_0xf5a9('0xe')];}Report['prototype']['sync']=function(_0x460783){var _0x2e6497=new VoiceQueueReport(this['realtime']);var _0x391c41=new VoiceAgentReport(this[_0xf5a9('0xc')]);var _0xb80292=new VoiceDialReport(this[_0xf5a9('0xc')]);var _0x3f2e0e=new VoiceCallReport(this[_0xf5a9('0xc')]);var _0x16b5e0=new UserReport(this[_0xf5a9('0xc')]);};Report[_0xf5a9('0xf')][_0xf5a9('0x10')]=function(_0x2eb3ac){var _0x36155d=undefined;_0x36155d=_[_0xf5a9('0x11')](this['agents'],function(_0xe47697){return _0xe47697[_0xf5a9('0x12')]==_0x2eb3ac||_0xe47697[_0xf5a9('0x13')]==_0x2eb3ac;});if(_[_0xf5a9('0x14')](_0x36155d)){var _0x953661=_['find'](this['telephones'],function(_0x5a8364){return _0x5a8364[_0xf5a9('0x12')]==_0x2eb3ac||_0x5a8364['name']==_0x2eb3ac;});if(_0x953661){_0x36155d=_[_0xf5a9('0x11')](this['agents'],function(_0x161649){return _0x161649[_0xf5a9('0x15')]==util[_0xf5a9('0x16')](_0xf5a9('0x17'),_0x953661[_0xf5a9('0x13')]);});}}return _0x36155d;};Report[_0xf5a9('0xf')][_0xf5a9('0x18')]=function(_0x1d36dc){for(var _0x173cf0=0x0;_0x173cf0<_0x1d36dc['length'];_0x173cf0+=0x1){var _0x19a3ea=this[_0xf5a9('0x10')](_0x1d36dc[_0x173cf0]['connectedlinenum']);if(_0x19a3ea){_0x1d36dc[_0x173cf0]['accountcode']=_0x19a3ea[_0xf5a9('0x12')];_0x1d36dc[_0x173cf0][_0xf5a9('0x19')]=!![];_0x1d36dc[_0x173cf0]['lastAssignedTo']=_0x19a3ea[_0xf5a9('0x13')];_0x1d36dc[_0x173cf0][_0xf5a9('0x15')]=_['isNil'](_0x19a3ea[_0xf5a9('0x15')])?util[_0xf5a9('0x16')](_0xf5a9('0x17'),_0x19a3ea[_0xf5a9('0x13')]):_0x19a3ea[_0xf5a9('0x15')];if(_0x1d36dc[_0x173cf0][_0xf5a9('0x1a')]){_0x1d36dc[_0x173cf0][_0xf5a9('0x1b')]=moment()[_0xf5a9('0x16')](_0xf5a9('0x1c'));}if(_0x1d36dc[_0x173cf0][_0xf5a9('0x1d')]){_0x1d36dc[_0x173cf0][_0xf5a9('0x1e')]=moment()['format'](_0xf5a9('0x1c'));}RpcMemberReport[_0xf5a9('0x18')](_0x1d36dc[_0x173cf0]);}RpcVoiceQueueReport[_0xf5a9('0x1f')](_0x1d36dc[_0x173cf0]);}};function extractCalleridNumber(_0x5ddbca){var _0x1cf83c=_0x5ddbca['match'](/<(.*?)>/);return _0x1cf83c?_0x1cf83c[0x1]:_0x5ddbca;}Report[_0xf5a9('0xf')]['voiceCallReport']=function(_0x28088b){_0x28088b[_0xf5a9('0x20')]=_0x28088b['destination']||_0x28088b['exten'];if(_0x28088b[_0xf5a9('0x21')]==_0xf5a9('0x22')){_0x28088b['lastapplication']=_0xf5a9('0x23');_0x28088b[_0xf5a9('0x24')]=_0x28088b['queue'];if(_0x28088b[_0xf5a9('0x25')]==_0xf5a9('0x26')){_0x28088b[_0xf5a9('0x12')]='';_0x28088b[_0xf5a9('0x20')]=extractCalleridNumber(_0x28088b[_0xf5a9('0x27')]);}else if(_0x28088b[_0xf5a9('0x25')]==_0xf5a9('0x28')){if(_0x28088b[_0xf5a9('0x20')]==_0xf5a9('0x29')){_0x28088b[_0xf5a9('0x20')]=extractCalleridNumber(_0x28088b[_0xf5a9('0x2a')]);_0x28088b[_0xf5a9('0x2b')]=_0x28088b[_0xf5a9('0x2c')];_0x28088b[_0xf5a9('0x2d')]=[_0x28088b['channel'],_0x28088b['channel']=_0x28088b[_0xf5a9('0x2d')]][0x0];_0x28088b[_0xf5a9('0x27')]=_0x28088b[_0xf5a9('0x2a')];}else{_0x28088b[_0xf5a9('0x20')]=_0x28088b[_0xf5a9('0x2b')];_0x28088b['calleridnum']=_0x28088b['originatecalleridnum'];if(_0x28088b[_0xf5a9('0x2e')]=='ANSWERED'){_0x28088b[_0xf5a9('0x12')]=_0x28088b[_0xf5a9('0x2f')];}else{_0x28088b[_0xf5a9('0x12')]='';}}}}else{_0x28088b[_0xf5a9('0x27')]=util[_0xf5a9('0x16')](_0xf5a9('0x30'),_0x28088b[_0xf5a9('0x31')],_0x28088b[_0xf5a9('0x2b')]);}RpcVoiceCallReport['create'](_0x28088b);if(_0x28088b[_0xf5a9('0x32')]){for(var _0x383af3=0x0;_0x383af3<_0x28088b[_0xf5a9('0x33')]['length'];_0x383af3+=0x1){_0x28088b['monitorFilename']=_0x28088b[_0xf5a9('0x33')][_0x383af3]['filename'];_0x28088b[_0xf5a9('0x34')]=_0x28088b[_0xf5a9('0x33')][_0x383af3]['createdAt'];if(_0x28088b[_0xf5a9('0x35')]==_0xf5a9('0x29')){_0x28088b[_0xf5a9('0x2b')]=_0x28088b[_0xf5a9('0x2f')];_0x28088b[_0xf5a9('0x31')]=_0x28088b[_0xf5a9('0x36')];_0x28088b[_0xf5a9('0x2f')]=_0x28088b[_0xf5a9('0x12')];_0x28088b[_0xf5a9('0x36')]=_0x28088b[_0xf5a9('0x37')];_0x28088b[_0xf5a9('0x35')]=_0x28088b[_0xf5a9('0x2c')];}else if(_0x28088b[_0xf5a9('0x35')]==_0xf5a9('0x38')){_0x28088b[_0xf5a9('0x2b')]=_0x28088b[_0xf5a9('0x20')];_0x28088b[_0xf5a9('0x35')]=_0x28088b['originatecalleridnum'];}RpcVoiceRecording[_0xf5a9('0x1f')](_0x28088b);}}};Report[_0xf5a9('0xf')][_0xf5a9('0x39')]=function(_0x1335fd){RpcVoiceAgentReport[_0xf5a9('0x1f')](_0x1335fd);};Report[_0xf5a9('0xf')]['voiceDialReport']=function(_0x2e68c4){RpcVoiceDialReport[_0xf5a9('0x1f')](_0x2e68c4);var _0x1c19c7=undefined;var _0x372fca=_0x2e68c4[_0xf5a9('0x3a')];if(_['startsWith'](_0x372fca,_0xf5a9('0x3b'))){var _0x84e207=_0x372fca[_0xf5a9('0x3c')](_0x372fca[_0xf5a9('0x3d')]('/')+0x1,_0x372fca['indexOf']('@'));_0x1c19c7=_[_0xf5a9('0x11')](this[_0xf5a9('0xd')],function(_0x31bda0){return _0x31bda0['mobile']==_0x84e207||_0x31bda0['phone']==_0x84e207||_0x31bda0[_0xf5a9('0x12')]==_0x84e207;});}else{var _0x84e207=_0x372fca['substring'](_0x372fca[_0xf5a9('0x3d')]('/')+0x1,_0x372fca[_0xf5a9('0x3e')]('-'));_0x1c19c7=this[_0xf5a9('0x10')](_0x84e207);}if(_0x1c19c7){_0x2e68c4['interface']=_[_0xf5a9('0x14')](_0x1c19c7[_0xf5a9('0x15')])?util[_0xf5a9('0x16')](_0xf5a9('0x17'),_0x1c19c7['name']):_0x1c19c7[_0xf5a9('0x15')];_0x2e68c4[_0xf5a9('0x37')]=_0x1c19c7[_0xf5a9('0x13')];_0x2e68c4[_0xf5a9('0x12')]=_0x1c19c7['accountcode'];RpcMemberReport[_0xf5a9('0x3f')](_0x2e68c4);}};Report[_0xf5a9('0xf')]['blindTransfer']=function(_0x1a2e17){RpcVoiceTransferReport[_0xf5a9('0x40')](_0x1a2e17);};Report['prototype'][_0xf5a9('0x41')]=function(_0x22adf6){RpcVoiceTransferReport[_0xf5a9('0x41')](_0x22adf6);};module[_0xf5a9('0x42')]=Report;
\ No newline at end of file
+var _0xde46=['ami','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','sync','findAgent','isNil','find','accountcode','name','interface','SIP/%s','prototype','voiceQueueReport','length','connectedlinenum','lastAssignedTo','format','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','voiceCallReport','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-sip','xcally-motion-preview','calleridpreview','calleridnum','destinationchannel','channel','ANSWERED','callerid','calleridname','monitor','monitors','monitorFilename','filename','createdAt','membername','originatecalleridnum','xcally-motion-dialer','startsWith','substring','indexOf','mobile','phone','voiceDialReport','blindTransfer','attendedTransfer','exports','bluebird','moment','../../../config/logger'];(function(_0x38e695,_0x5a69a2){var _0x3369ac=function(_0x6f4800){while(--_0x6f4800){_0x38e695['push'](_0x38e695['shift']());}};_0x3369ac(++_0x5a69a2);}(_0xde46,0x174));var _0x6de4=function(_0x285bd5,_0x3294a3){_0x285bd5=_0x285bd5-0x0;var _0x38ebe6=_0xde46[_0x285bd5];return _0x38ebe6;};'use strict';var BPromise=require(_0x6de4('0x0'));var _=require('lodash');var moment=require(_0x6de4('0x1'));var util=require('util');var logger=require(_0x6de4('0x2'))(_0x6de4('0x3'));var ami=require(_0x6de4('0x4'));var RpcVoiceAgentReport=require(_0x6de4('0x5'));var RpcVoiceCallReport=require(_0x6de4('0x6'));var RpcVoiceDialReport=require(_0x6de4('0x7'));var RpcMemberReport=require(_0x6de4('0x8'));var RpcVoiceQueueReport=require(_0x6de4('0x9'));var RpcVoiceRecording=require(_0x6de4('0xa'));var RpcVoiceTransferReport=require(_0x6de4('0xb'));var VoiceQueueReport=require(_0x6de4('0xc'));var VoiceCallReport=require(_0x6de4('0xd'));var VoiceAgentReport=require(_0x6de4('0xe'));var VoiceDialReport=require(_0x6de4('0xf'));var UserReport=require(_0x6de4('0x10'));function Report(_0x133af2){this[_0x6de4('0x11')]=_0x133af2;this['agents']=_0x133af2[_0x6de4('0x12')];this[_0x6de4('0x13')]=_0x133af2['telephones'];}Report['prototype'][_0x6de4('0x14')]=function(_0x3034eb){var _0x4df187=new VoiceQueueReport(this['realtime']);var _0x3dca98=new VoiceAgentReport(this[_0x6de4('0x11')]);var _0x2b4ba8=new VoiceDialReport(this[_0x6de4('0x11')]);var _0x56d72f=new VoiceCallReport(this['realtime']);var _0x194280=new UserReport(this[_0x6de4('0x11')]);};Report['prototype'][_0x6de4('0x15')]=function(_0x179ce6){var _0x2ca06f=undefined;_0x2ca06f=_['find'](this[_0x6de4('0x12')],function(_0xe6b2e5){return _0xe6b2e5['accountcode']==_0x179ce6||_0xe6b2e5['name']==_0x179ce6;});if(_[_0x6de4('0x16')](_0x2ca06f)){var _0x1c734b=_[_0x6de4('0x17')](this[_0x6de4('0x13')],function(_0x183c5f){return _0x183c5f[_0x6de4('0x18')]==_0x179ce6||_0x183c5f[_0x6de4('0x19')]==_0x179ce6;});if(_0x1c734b){_0x2ca06f=_[_0x6de4('0x17')](this[_0x6de4('0x12')],function(_0xd237fd){return _0xd237fd[_0x6de4('0x1a')]==util['format'](_0x6de4('0x1b'),_0x1c734b[_0x6de4('0x19')]);});}}return _0x2ca06f;};Report[_0x6de4('0x1c')][_0x6de4('0x1d')]=function(_0x1fe9b1){for(var _0x281fe1=0x0;_0x281fe1<_0x1fe9b1[_0x6de4('0x1e')];_0x281fe1+=0x1){var _0x106f89=this[_0x6de4('0x15')](_0x1fe9b1[_0x281fe1][_0x6de4('0x1f')]);if(_0x106f89){_0x1fe9b1[_0x281fe1][_0x6de4('0x18')]=_0x106f89[_0x6de4('0x18')];_0x1fe9b1[_0x281fe1]['assigned']=!![];_0x1fe9b1[_0x281fe1][_0x6de4('0x20')]=_0x106f89[_0x6de4('0x19')];_0x1fe9b1[_0x281fe1][_0x6de4('0x1a')]=_[_0x6de4('0x16')](_0x106f89[_0x6de4('0x1a')])?util[_0x6de4('0x21')](_0x6de4('0x1b'),_0x106f89[_0x6de4('0x19')]):_0x106f89[_0x6de4('0x1a')];if(_0x1fe9b1[_0x281fe1]['queuecallercomplete']){_0x1fe9b1[_0x281fe1][_0x6de4('0x22')]=moment()['format'](_0x6de4('0x23'));}if(_0x1fe9b1[_0x281fe1][_0x6de4('0x24')]){_0x1fe9b1[_0x281fe1][_0x6de4('0x25')]=moment()[_0x6de4('0x21')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport['voiceQueueReport'](_0x1fe9b1[_0x281fe1]);}RpcVoiceQueueReport[_0x6de4('0x26')](_0x1fe9b1[_0x281fe1]);}};function extractCalleridNumber(_0x8cf29c){var _0x5c0ad8=_0x8cf29c[_0x6de4('0x27')](/<(.*?)>/);return _0x5c0ad8?_0x5c0ad8[0x1]:_0x8cf29c;}Report[_0x6de4('0x1c')][_0x6de4('0x28')]=function(_0x267e29){_0x267e29[_0x6de4('0x29')]=_0x267e29['destination']||_0x267e29[_0x6de4('0x2a')];if(_0x267e29[_0x6de4('0x2b')]==_0x6de4('0x2c')){_0x267e29[_0x6de4('0x2d')]=_0x6de4('0x2e');_0x267e29[_0x6de4('0x2f')]=_0x267e29[_0x6de4('0x2e')];if(_0x267e29[_0x6de4('0x30')]=='from-voip-provider'){_0x267e29[_0x6de4('0x18')]='';_0x267e29['destination']=extractCalleridNumber(_0x267e29['callerid']);}else if(_0x267e29[_0x6de4('0x30')]==_0x6de4('0x31')){if(_0x267e29[_0x6de4('0x29')]==_0x6de4('0x32')){_0x267e29[_0x6de4('0x29')]=extractCalleridNumber(_0x267e29[_0x6de4('0x33')]);_0x267e29[_0x6de4('0x34')]=_0x267e29['originatecalleridnum'];_0x267e29[_0x6de4('0x35')]=[_0x267e29['channel'],_0x267e29[_0x6de4('0x36')]=_0x267e29[_0x6de4('0x35')]][0x0];_0x267e29['callerid']=_0x267e29[_0x6de4('0x33')];}else{_0x267e29['destination']=_0x267e29['calleridnum'];_0x267e29[_0x6de4('0x34')]=_0x267e29['originatecalleridnum'];if(_0x267e29['disposition']==_0x6de4('0x37')){_0x267e29['accountcode']=_0x267e29['connectedlinenum'];}else{_0x267e29[_0x6de4('0x18')]='';}}}}else{_0x267e29[_0x6de4('0x38')]=util[_0x6de4('0x21')]('\x22%s\x22\x20<%s>',_0x267e29[_0x6de4('0x39')],_0x267e29[_0x6de4('0x34')]);}RpcVoiceCallReport['create'](_0x267e29);if(_0x267e29[_0x6de4('0x3a')]){for(var _0x195a0f=0x0;_0x195a0f<_0x267e29[_0x6de4('0x3b')]['length'];_0x195a0f+=0x1){_0x267e29[_0x6de4('0x3c')]=_0x267e29[_0x6de4('0x3b')][_0x195a0f][_0x6de4('0x3d')];_0x267e29['createdAt']=_0x267e29['monitors'][_0x195a0f][_0x6de4('0x3e')];if(_0x267e29[_0x6de4('0x2a')]==_0x6de4('0x32')){_0x267e29[_0x6de4('0x34')]=_0x267e29[_0x6de4('0x1f')];_0x267e29[_0x6de4('0x39')]=_0x267e29['connectedlinename'];_0x267e29[_0x6de4('0x1f')]=_0x267e29[_0x6de4('0x18')];_0x267e29['connectedlinename']=_0x267e29[_0x6de4('0x3f')];_0x267e29[_0x6de4('0x2a')]=_0x267e29[_0x6de4('0x40')];}else if(_0x267e29['exten']==_0x6de4('0x41')){_0x267e29['calleridnum']=_0x267e29['destination'];_0x267e29[_0x6de4('0x2a')]=_0x267e29[_0x6de4('0x40')];}RpcVoiceRecording[_0x6de4('0x26')](_0x267e29);}}};Report['prototype']['voiceAgentReport']=function(_0x25ef43){RpcVoiceAgentReport[_0x6de4('0x26')](_0x25ef43);};Report[_0x6de4('0x1c')]['voiceDialReport']=function(_0x41a185){RpcVoiceDialReport['create'](_0x41a185);var _0x161f4d=undefined;var _0x3a35ae=_0x41a185[_0x6de4('0x36')];if(_[_0x6de4('0x42')](_0x3a35ae,'Local')){var _0x463c48=_0x3a35ae[_0x6de4('0x43')](_0x3a35ae[_0x6de4('0x44')]('/')+0x1,_0x3a35ae['indexOf']('@'));_0x161f4d=_[_0x6de4('0x17')](this[_0x6de4('0x12')],function(_0x24ba1c){return _0x24ba1c[_0x6de4('0x45')]==_0x463c48||_0x24ba1c[_0x6de4('0x46')]==_0x463c48||_0x24ba1c[_0x6de4('0x18')]==_0x463c48;});}else{var _0x463c48=_0x3a35ae[_0x6de4('0x43')](_0x3a35ae[_0x6de4('0x44')]('/')+0x1,_0x3a35ae['lastIndexOf']('-'));_0x161f4d=this['findAgent'](_0x463c48);}if(_0x161f4d){_0x41a185[_0x6de4('0x1a')]=_[_0x6de4('0x16')](_0x161f4d[_0x6de4('0x1a')])?util['format'](_0x6de4('0x1b'),_0x161f4d[_0x6de4('0x19')]):_0x161f4d[_0x6de4('0x1a')];_0x41a185[_0x6de4('0x3f')]=_0x161f4d[_0x6de4('0x19')];_0x41a185[_0x6de4('0x18')]=_0x161f4d[_0x6de4('0x18')];RpcMemberReport[_0x6de4('0x47')](_0x41a185);}};Report['prototype'][_0x6de4('0x48')]=function(_0x5b58b5){RpcVoiceTransferReport[_0x6de4('0x48')](_0x5b58b5);};Report[_0x6de4('0x1c')][_0x6de4('0x49')]=function(_0x5e3c1e){RpcVoiceTransferReport[_0x6de4('0x49')](_0x5e3c1e);};module[_0x6de4('0x4a')]=Report;
\ No newline at end of file
index daede2b..60deb3e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7599=['telephone:save','startsWith','Queue','Local','substring','indexOf','mobile','phone','[syncDeviceState][UserReport]','peer','registered','status','address','exports','bluebird','util','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','loopSyncRealTimeShow','resolve','then','actionDeviceStateList','actionSipPeerStatus','catch','[loopSyncRealTimeShow]','error','actionSipShowRegistry','isNotNull','emit','find','username','stateRegistry','state','merge','omit','format','trunk:%s','name','trunk:save','[syncRegistry][UserReport]','inspect','prototype','device','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','telephone:%s'];(function(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0x7599,0xd1));var _0x9759=function(_0x4b2030,_0x447460){_0x4b2030=_0x4b2030-0x0;var _0x46b080=_0x7599[_0x4b2030];return _0x46b080;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0x9759('0x0'));var util=require(_0x9759('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x9759('0x2'));var ami=require(_0x9759('0x3'));config[_0x9759('0x4')]=_[_0x9759('0x5')](config[_0x9759('0x4')],{'host':_0x9759('0x6'),'port':0x18eb});var io=require(_0x9759('0x7'))(new Redis(config[_0x9759('0x4')]));function UserReport(_0x2e8314){this[_0x9759('0x8')]=_0x2e8314[_0x9759('0x8')];this[_0x9759('0x9')]=_0x2e8314['agents'];this[_0x9759('0xa')]=_0x2e8314[_0x9759('0xa')];ami['on'](_0x9759('0xb'),this[_0x9759('0xc')][_0x9759('0xd')](this));ami['on'](_0x9759('0xe'),this['syncRegistry'][_0x9759('0xd')](this));ami['on'](_0x9759('0xf'),this[_0x9759('0x10')][_0x9759('0xd')](this));ami['on'](_0x9759('0x11'),this[_0x9759('0x12')][_0x9759('0xd')](this));this[_0x9759('0x13')]();return BPromise[_0x9759('0x14')]()[_0x9759('0x15')](ami['actionSipShowRegistry']())[_0x9759('0x15')](ami[_0x9759('0x16')]())[_0x9759('0x15')](ami[_0x9759('0x17')]())[_0x9759('0x18')](loggerCatch(_0x9759('0x19')));}function loggerCatch(_0x5e49d2){return function(_0x50b71b){logger[_0x9759('0x1a')](_0x5e49d2,util['inspect'](_0x50b71b,{'showHidden':![],'depth':null}));};}UserReport['prototype'][_0x9759('0x13')]=function(){setInterval(function(){BPromise['resolve']()[_0x9759('0x15')](ami[_0x9759('0x1b')]())[_0x9759('0x15')](ami[_0x9759('0x16')]())['then'](ami[_0x9759('0x17')]())[_0x9759('0x18')](loggerCatch(_0x9759('0x19')));},0x32c8);};UserReport['prototype'][_0x9759('0x1c')]=function(_0xf67db){return _0xf67db!==null&&!_['isUndefined'](_0xf67db);};UserReport['prototype'][_0x9759('0x1d')]=function(_0x3def2c,_0x56b6e0,_0x50429d){io['to'](_0x3def2c)['emit'](_0x56b6e0,_0x50429d);};UserReport['prototype'][_0x9759('0xc')]=function(_0x4a0f3d){try{if(this[_0x9759('0x1c')](_0x4a0f3d)){var _0x564be5=_[_0x9759('0x1e')](this['trunks'],{'registry':_0x4a0f3d[_0x9759('0x1f')]});if(_0x564be5){_0x4a0f3d[_0x9759('0x20')]=_0x4a0f3d[_0x9759('0x21')];_[_0x9759('0x22')](_0x564be5,_[_0x9759('0x23')](_0x4a0f3d,['event','actionid',_0x9759('0x1f'),_0x9759('0x21')]));this['emit'](util[_0x9759('0x24')](_0x9759('0x25'),_0x564be5[_0x9759('0x26')]),_0x9759('0x27'),_0x564be5);}}}catch(_0x466580){logger['error'](_0x9759('0x28'),util[_0x9759('0x29')](_0x466580,{'showHidden':![],'depth':null}));}};UserReport[_0x9759('0x2a')][_0x9759('0x10')]=function(_0x36df14){try{if(this['isNotNull'](_0x36df14)){if(this[_0x9759('0x9')][_0x36df14['device']]){if(!this[_0x9759('0x9')][_0x36df14[_0x9759('0x2b')]][_0x9759('0x2c')]||_0x36df14[_0x9759('0x21')][_0x9759('0x2d')]()==_0x9759('0x2e')){this['agents'][_0x36df14['device']][_0x9759('0x2c')]=![];if(this['agents'][_0x36df14[_0x9759('0x2b')]][_0x9759('0x21')]!==_0x36df14[_0x9759('0x21')][_0x9759('0x2d')]()){this[_0x9759('0x9')][_0x36df14['device']][_0x9759('0x2f')]=_[_0x9759('0x30')](moment()['format']('x'));}this[_0x9759('0x9')][_0x36df14[_0x9759('0x2b')]][_0x9759('0x21')]=_0x36df14['state'][_0x9759('0x2d')]();this[_0x9759('0x9')][_0x36df14['device']][_0x9759('0x31')](_0x36df14);}}else if(this[_0x9759('0xa')][_0x36df14[_0x9759('0x2b')]]){if(this['telephones'][_0x36df14[_0x9759('0x2b')]][_0x9759('0x21')]!==_0x36df14[_0x9759('0x21')][_0x9759('0x2d')]()){this[_0x9759('0xa')][_0x36df14['device']][_0x9759('0x2f')]=_[_0x9759('0x30')](moment()['format']('x'));}this[_0x9759('0xa')][_0x36df14['device']][_0x9759('0x21')]=_0x36df14['state'][_0x9759('0x2d')]();this[_0x9759('0x1d')](util[_0x9759('0x24')](_0x9759('0x32'),this[_0x9759('0xa')][_0x36df14[_0x9759('0x2b')]][_0x9759('0x26')]),_0x9759('0x33'),this[_0x9759('0xa')][_0x36df14[_0x9759('0x2b')]]);}else if(this[_0x9759('0x8')][_0x36df14[_0x9759('0x2b')]]){if(this['trunks'][_0x36df14['device']]['state']!==_0x36df14[_0x9759('0x21')]['toLowerCase']()){this[_0x9759('0x8')][_0x36df14[_0x9759('0x2b')]][_0x9759('0x2f')]=_['toNumber'](moment()[_0x9759('0x24')]('x'));}this[_0x9759('0x8')][_0x36df14[_0x9759('0x2b')]]['state']=_0x36df14[_0x9759('0x21')]['toLowerCase']();this[_0x9759('0x1d')](util[_0x9759('0x24')](_0x9759('0x25'),this[_0x9759('0x8')][_0x36df14['device']][_0x9759('0x26')]),_0x9759('0x27'),this[_0x9759('0x8')][_0x36df14[_0x9759('0x2b')]]);}else if(_[_0x9759('0x34')](_0x36df14[_0x9759('0x2b')],_0x9759('0x35'))){}else if(_[_0x9759('0x34')](_0x36df14[_0x9759('0x2b')],_0x9759('0x36'))){var _0x5e5d3e=_0x36df14[_0x9759('0x2b')];var _0x19a0f4=_0x5e5d3e[_0x9759('0x37')](_0x5e5d3e[_0x9759('0x38')]('/')+0x1,_0x5e5d3e[_0x9759('0x38')]('@'));var _0x185a98=_[_0x9759('0x1e')](this[_0x9759('0x9')],function(_0x3653e6){return _0x3653e6[_0x9759('0x39')]==_0x19a0f4||_0x3653e6[_0x9759('0x3a')]==_0x19a0f4||_0x3653e6['accountcode']==_0x19a0f4;});if(_0x185a98){if(_0x185a98[_0x9759('0x21')]!==_0x36df14[_0x9759('0x21')][_0x9759('0x2d')]()){_0x185a98[_0x9759('0x2f')]=_[_0x9759('0x30')](moment()['format']('x'));}_0x185a98[_0x9759('0x21')]=_0x36df14[_0x9759('0x21')][_0x9759('0x2d')]();_0x185a98[_0x9759('0x2c')]=!![];_0x185a98[_0x9759('0x31')](_0x36df14);}}else{}}}catch(_0x1c6fae){logger[_0x9759('0x1a')](_0x9759('0x3b'),util['inspect'](_0x1c6fae,{'showHidden':![],'depth':null}));}};UserReport[_0x9759('0x2a')][_0x9759('0x12')]=function(_0x25c459){try{if(this[_0x9759('0x1c')](_0x25c459)&&this[_0x9759('0x1c')](_0x25c459[_0x9759('0x11')])){if(this[_0x9759('0x9')][_0x25c459[_0x9759('0x3c')]]){if(!this[_0x9759('0x9')][_0x25c459[_0x9759('0x3c')]][_0x9759('0x2c')]||_0x25c459[_0x9759('0x11')]['toLowerCase']()==_0x9759('0x3d')){this[_0x9759('0x9')][_0x25c459[_0x9759('0x3c')]][_0x9759('0x2c')]=![];this[_0x9759('0x9')][_0x25c459[_0x9759('0x3c')]][_0x9759('0x3e')]=_0x25c459['peerstatus'][_0x9759('0x2d')]();this['agents'][_0x25c459[_0x9759('0x3c')]][_0x9759('0x3f')]=_0x25c459[_0x9759('0x3f')];this[_0x9759('0x9')][_0x25c459[_0x9759('0x3c')]][_0x9759('0x31')](_0x25c459);}}else if(this[_0x9759('0xa')][_0x25c459[_0x9759('0x3c')]]){this[_0x9759('0xa')][_0x25c459[_0x9759('0x3c')]][_0x9759('0x3e')]=_0x25c459[_0x9759('0x11')][_0x9759('0x2d')]();this[_0x9759('0xa')][_0x25c459[_0x9759('0x3c')]]['address']=_0x25c459[_0x9759('0x3f')];this[_0x9759('0x1d')](util[_0x9759('0x24')]('telephone:%s',this[_0x9759('0xa')][_0x25c459[_0x9759('0x3c')]][_0x9759('0x26')]),_0x9759('0x33'),this[_0x9759('0xa')][_0x25c459[_0x9759('0x3c')]]);}else if(this[_0x9759('0x8')][_0x25c459['peer']]){this['trunks'][_0x25c459[_0x9759('0x3c')]][_0x9759('0x3e')]=_0x25c459[_0x9759('0x11')][_0x9759('0x2d')]();this[_0x9759('0x8')][_0x25c459[_0x9759('0x3c')]]['address']=_0x25c459[_0x9759('0x3f')];this[_0x9759('0x1d')](util[_0x9759('0x24')](_0x9759('0x25'),this['trunks'][_0x25c459['peer']][_0x9759('0x26')]),_0x9759('0x27'),this[_0x9759('0x8')][_0x25c459[_0x9759('0x3c')]]);}else{}}}catch(_0x23aedc){logger['error']('[syncPeerStatus][UserReport]',util[_0x9759('0x29')](_0x23aedc,{'showHidden':![],'depth':null}));}};module[_0x9759('0x40')]=UserReport;
\ No newline at end of file
+var _0x6f0b=['telephone:%s','telephone:save','startsWith','Queue','Local','substring','indexOf','find','mobile','phone','accountcode','toNumber','local','error','[syncDeviceState][UserReport]','peerstatus','peer','registered','status','address','[syncPeerStatus][UserReport]','lodash','bluebird','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','syncPeerStatus','loopSyncRealTimeShow','resolve','then','actionSipShowRegistry','[loopSyncRealTimeShow]','prototype','actionDeviceStateList','actionSipPeerStatus','catch','isUndefined','emit','isNotNull','stateRegistry','state','omit','event','actionid','username','format','trunk:%s','name','trunk:save','inspect','syncDeviceState','device','toLowerCase','inuse','stateTime','updateStatusRealtime'];(function(_0x5a12a6,_0x2c3d17){var _0x111b0c=function(_0x2c981e){while(--_0x2c981e){_0x5a12a6['push'](_0x5a12a6['shift']());}};_0x111b0c(++_0x2c3d17);}(_0x6f0b,0x9b));var _0xb6f0=function(_0x4c8ed6,_0x582dde){_0x4c8ed6=_0x4c8ed6-0x0;var _0x40d330=_0x6f0b[_0x4c8ed6];return _0x40d330;};'use strict';var _=require(_0xb6f0('0x0'));var moment=require('moment');var BPromise=require(_0xb6f0('0x1'));var util=require(_0xb6f0('0x2'));var Redis=require(_0xb6f0('0x3'));var config=require(_0xb6f0('0x4'));var logger=require(_0xb6f0('0x5'))('ami');var ami=require(_0xb6f0('0x6'));config[_0xb6f0('0x7')]=_['defaults'](config[_0xb6f0('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xb6f0('0x8'))(new Redis(config[_0xb6f0('0x7')]));function UserReport(_0x38e319){this[_0xb6f0('0x9')]=_0x38e319['trunks'];this[_0xb6f0('0xa')]=_0x38e319['agents'];this['telephones']=_0x38e319[_0xb6f0('0xb')];ami['on'](_0xb6f0('0xc'),this[_0xb6f0('0xd')][_0xb6f0('0xe')](this));ami['on'](_0xb6f0('0xf'),this[_0xb6f0('0xd')][_0xb6f0('0xe')](this));ami['on']('devicestatechange',this['syncDeviceState'][_0xb6f0('0xe')](this));ami['on']('peerstatus',this[_0xb6f0('0x10')][_0xb6f0('0xe')](this));this[_0xb6f0('0x11')]();return BPromise[_0xb6f0('0x12')]()[_0xb6f0('0x13')](ami[_0xb6f0('0x14')]())[_0xb6f0('0x13')](ami['actionDeviceStateList']())[_0xb6f0('0x13')](ami['actionSipPeerStatus']())['catch'](loggerCatch(_0xb6f0('0x15')));}function loggerCatch(_0x3c7a95){return function(_0x5037aa){logger['error'](_0x3c7a95,util['inspect'](_0x5037aa,{'showHidden':![],'depth':null}));};}UserReport[_0xb6f0('0x16')]['loopSyncRealTimeShow']=function(){setInterval(function(){BPromise[_0xb6f0('0x12')]()[_0xb6f0('0x13')](ami[_0xb6f0('0x14')]())[_0xb6f0('0x13')](ami[_0xb6f0('0x17')]())['then'](ami[_0xb6f0('0x18')]())[_0xb6f0('0x19')](loggerCatch(_0xb6f0('0x15')));},0x32c8);};UserReport[_0xb6f0('0x16')]['isNotNull']=function(_0x176cb1){return _0x176cb1!==null&&!_[_0xb6f0('0x1a')](_0x176cb1);};UserReport[_0xb6f0('0x16')][_0xb6f0('0x1b')]=function(_0x1e56ff,_0x3ef3fd,_0xdfde5a){io['to'](_0x1e56ff)[_0xb6f0('0x1b')](_0x3ef3fd,_0xdfde5a);};UserReport[_0xb6f0('0x16')]['syncRegistry']=function(_0x497b9e){try{if(this[_0xb6f0('0x1c')](_0x497b9e)){var _0x364a35=_['find'](this[_0xb6f0('0x9')],{'registry':_0x497b9e['username']});if(_0x364a35){_0x497b9e[_0xb6f0('0x1d')]=_0x497b9e[_0xb6f0('0x1e')];_['merge'](_0x364a35,_[_0xb6f0('0x1f')](_0x497b9e,[_0xb6f0('0x20'),_0xb6f0('0x21'),_0xb6f0('0x22'),_0xb6f0('0x1e')]));this[_0xb6f0('0x1b')](util[_0xb6f0('0x23')](_0xb6f0('0x24'),_0x364a35[_0xb6f0('0x25')]),_0xb6f0('0x26'),_0x364a35);}}}catch(_0x41a903){logger['error']('[syncRegistry][UserReport]',util[_0xb6f0('0x27')](_0x41a903,{'showHidden':![],'depth':null}));}};UserReport[_0xb6f0('0x16')][_0xb6f0('0x28')]=function(_0x1f30ef){try{if(this[_0xb6f0('0x1c')](_0x1f30ef)){if(this['agents'][_0x1f30ef[_0xb6f0('0x29')]]){if(!this['agents'][_0x1f30ef[_0xb6f0('0x29')]]['local']||_0x1f30ef[_0xb6f0('0x1e')][_0xb6f0('0x2a')]()==_0xb6f0('0x2b')){this[_0xb6f0('0xa')][_0x1f30ef[_0xb6f0('0x29')]]['local']=![];if(this['agents'][_0x1f30ef[_0xb6f0('0x29')]][_0xb6f0('0x1e')]!==_0x1f30ef[_0xb6f0('0x1e')][_0xb6f0('0x2a')]()){this[_0xb6f0('0xa')][_0x1f30ef['device']][_0xb6f0('0x2c')]=_['toNumber'](moment()[_0xb6f0('0x23')]('x'));}this[_0xb6f0('0xa')][_0x1f30ef[_0xb6f0('0x29')]][_0xb6f0('0x1e')]=_0x1f30ef[_0xb6f0('0x1e')][_0xb6f0('0x2a')]();this[_0xb6f0('0xa')][_0x1f30ef[_0xb6f0('0x29')]][_0xb6f0('0x2d')](_0x1f30ef);}}else if(this[_0xb6f0('0xb')][_0x1f30ef[_0xb6f0('0x29')]]){if(this['telephones'][_0x1f30ef[_0xb6f0('0x29')]][_0xb6f0('0x1e')]!==_0x1f30ef[_0xb6f0('0x1e')][_0xb6f0('0x2a')]()){this[_0xb6f0('0xb')][_0x1f30ef[_0xb6f0('0x29')]][_0xb6f0('0x2c')]=_['toNumber'](moment()[_0xb6f0('0x23')]('x'));}this[_0xb6f0('0xb')][_0x1f30ef['device']][_0xb6f0('0x1e')]=_0x1f30ef[_0xb6f0('0x1e')][_0xb6f0('0x2a')]();this[_0xb6f0('0x1b')](util[_0xb6f0('0x23')](_0xb6f0('0x2e'),this[_0xb6f0('0xb')][_0x1f30ef[_0xb6f0('0x29')]]['name']),_0xb6f0('0x2f'),this[_0xb6f0('0xb')][_0x1f30ef[_0xb6f0('0x29')]]);}else if(this[_0xb6f0('0x9')][_0x1f30ef[_0xb6f0('0x29')]]){if(this[_0xb6f0('0x9')][_0x1f30ef['device']]['state']!==_0x1f30ef[_0xb6f0('0x1e')][_0xb6f0('0x2a')]()){this[_0xb6f0('0x9')][_0x1f30ef[_0xb6f0('0x29')]]['stateTime']=_['toNumber'](moment()['format']('x'));}this['trunks'][_0x1f30ef['device']][_0xb6f0('0x1e')]=_0x1f30ef[_0xb6f0('0x1e')][_0xb6f0('0x2a')]();this[_0xb6f0('0x1b')](util[_0xb6f0('0x23')](_0xb6f0('0x24'),this[_0xb6f0('0x9')][_0x1f30ef[_0xb6f0('0x29')]][_0xb6f0('0x25')]),_0xb6f0('0x26'),this[_0xb6f0('0x9')][_0x1f30ef[_0xb6f0('0x29')]]);}else if(_[_0xb6f0('0x30')](_0x1f30ef[_0xb6f0('0x29')],_0xb6f0('0x31'))){}else if(_[_0xb6f0('0x30')](_0x1f30ef['device'],_0xb6f0('0x32'))){var _0x5b2ef3=_0x1f30ef[_0xb6f0('0x29')];var _0x17fd5d=_0x5b2ef3[_0xb6f0('0x33')](_0x5b2ef3[_0xb6f0('0x34')]('/')+0x1,_0x5b2ef3['indexOf']('@'));var _0x2901ca=_[_0xb6f0('0x35')](this[_0xb6f0('0xa')],function(_0xf406a2){return _0xf406a2[_0xb6f0('0x36')]==_0x17fd5d||_0xf406a2[_0xb6f0('0x37')]==_0x17fd5d||_0xf406a2[_0xb6f0('0x38')]==_0x17fd5d;});if(_0x2901ca){if(_0x2901ca[_0xb6f0('0x1e')]!==_0x1f30ef['state'][_0xb6f0('0x2a')]()){_0x2901ca['stateTime']=_[_0xb6f0('0x39')](moment()['format']('x'));}_0x2901ca[_0xb6f0('0x1e')]=_0x1f30ef[_0xb6f0('0x1e')]['toLowerCase']();_0x2901ca[_0xb6f0('0x3a')]=!![];_0x2901ca[_0xb6f0('0x2d')](_0x1f30ef);}}else{}}}catch(_0x10959e){logger[_0xb6f0('0x3b')](_0xb6f0('0x3c'),util['inspect'](_0x10959e,{'showHidden':![],'depth':null}));}};UserReport[_0xb6f0('0x16')]['syncPeerStatus']=function(_0x431731){try{if(this[_0xb6f0('0x1c')](_0x431731)&&this['isNotNull'](_0x431731[_0xb6f0('0x3d')])){if(this[_0xb6f0('0xa')][_0x431731[_0xb6f0('0x3e')]]){if(!this['agents'][_0x431731['peer']][_0xb6f0('0x3a')]||_0x431731[_0xb6f0('0x3d')][_0xb6f0('0x2a')]()==_0xb6f0('0x3f')){this[_0xb6f0('0xa')][_0x431731[_0xb6f0('0x3e')]][_0xb6f0('0x3a')]=![];this[_0xb6f0('0xa')][_0x431731[_0xb6f0('0x3e')]][_0xb6f0('0x40')]=_0x431731['peerstatus'][_0xb6f0('0x2a')]();this['agents'][_0x431731[_0xb6f0('0x3e')]][_0xb6f0('0x41')]=_0x431731[_0xb6f0('0x41')];this[_0xb6f0('0xa')][_0x431731[_0xb6f0('0x3e')]][_0xb6f0('0x2d')](_0x431731);}}else if(this['telephones'][_0x431731[_0xb6f0('0x3e')]]){this['telephones'][_0x431731[_0xb6f0('0x3e')]][_0xb6f0('0x40')]=_0x431731[_0xb6f0('0x3d')]['toLowerCase']();this[_0xb6f0('0xb')][_0x431731['peer']][_0xb6f0('0x41')]=_0x431731['address'];this[_0xb6f0('0x1b')](util[_0xb6f0('0x23')](_0xb6f0('0x2e'),this[_0xb6f0('0xb')][_0x431731[_0xb6f0('0x3e')]][_0xb6f0('0x25')]),_0xb6f0('0x2f'),this[_0xb6f0('0xb')][_0x431731[_0xb6f0('0x3e')]]);}else if(this[_0xb6f0('0x9')][_0x431731[_0xb6f0('0x3e')]]){this[_0xb6f0('0x9')][_0x431731[_0xb6f0('0x3e')]][_0xb6f0('0x40')]=_0x431731['peerstatus']['toLowerCase']();this[_0xb6f0('0x9')][_0x431731[_0xb6f0('0x3e')]][_0xb6f0('0x41')]=_0x431731[_0xb6f0('0x41')];this[_0xb6f0('0x1b')](util[_0xb6f0('0x23')](_0xb6f0('0x24'),this['trunks'][_0x431731['peer']][_0xb6f0('0x25')]),_0xb6f0('0x26'),this['trunks'][_0x431731[_0xb6f0('0x3e')]]);}else{}}}catch(_0x447b60){logger[_0xb6f0('0x3b')](_0xb6f0('0x42'),util[_0xb6f0('0x27')](_0x447b60,{'showHidden':![],'depth':null}));}};module['exports']=UserReport;
\ No newline at end of file
index d56179b..c924970 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x531a=['connect','agentconnectAt','agentcalledAt','custom:agentconnect','user:agentconnect','CONNECT','onhold','updateStatusRealtime','find','rejected','agentringnoanswerAt','custom:agentringnoanswer','RINGNOANSWER','syncQueueCallerAbandon','holdtime','position','abandoned','CALLERABANDON','reason','transfer','complete','acw','acwTimeout','agentcompleteAt','talktime','COMPLETE','answered_elsewhere','destuniqueid','custom:agentansweredelsewhere','agentcomplete','custom:agentcomplete','HANGUP','syncHangup','cause','cause-txt','recalculate','clear','origtransfererchannel','ATTENDED','secondtransfererexten','secondtransferercontext','transfertargetchannel','transfererchannel','BLIND','transfereeuniqueid','context','extension','syncVarSet','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberrealtime','keys','variable','variables','lodash','moment','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','voiceQueues','agents','channels','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncAgentComplete','varset','hangup','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart','syncMusicOnHoldStop','prototype','log','info','format','%s|%s','uniqueid','membername','calleridnum','addTime','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','seconds','interface','isNil','assign','queue','emit','user:save','destchannel','calleridname','destcalleridnum','accountcode','channel','exten','priority','type','inbound','mandatoryDisposition','agent','custom:agentcalled','user:%s','CALLED','error','stack','ringtime'];(function(_0x363682,_0x216471){var _0x1abbcc=function(_0x576bf2){while(--_0x576bf2){_0x363682['push'](_0x363682['shift']());}};_0x1abbcc(++_0x216471);}(_0x531a,0x147));var _0xa531=function(_0x5adfa9,_0x4b835d){_0x5adfa9=_0x5adfa9-0x0;var _0x458f41=_0x531a[_0x5adfa9];return _0x458f41;};'use strict';var _=require(_0xa531('0x0'));var moment=require(_0xa531('0x1'));var util=require('util');var Redis=require(_0xa531('0x2'));var config=require(_0xa531('0x3'));var logger=require(_0xa531('0x4'))('ami');var ami=require(_0xa531('0x5'));config[_0xa531('0x6')]=_[_0xa531('0x7')](config['redis'],{'host':_0xa531('0x8'),'port':0x18eb});var io=require(_0xa531('0x9'))(new Redis(config[_0xa531('0x6')]));function VoiceAgentReport(_0x52b44e){this[_0xa531('0xa')]=_0x52b44e[_0xa531('0xa')];this[_0xa531('0xb')]=_0x52b44e['agents'];this[_0xa531('0xc')]={};this['variables']={};ami['on'](_0xa531('0xd'),this[_0xa531('0xe')][_0xa531('0xf')](this));ami['on'](_0xa531('0x10'),this[_0xa531('0x11')][_0xa531('0xf')](this));ami['on'](_0xa531('0x12'),this[_0xa531('0x13')][_0xa531('0xf')](this));ami['on'](_0xa531('0x14'),this['syncQueueCallerAbandon'][_0xa531('0xf')](this));ami['on']('agentcomplete',this[_0xa531('0x15')][_0xa531('0xf')](this));ami['on'](_0xa531('0x16'),this['syncVarSet']['bind'](this));ami['on'](_0xa531('0x17'),this['syncHangup'][_0xa531('0xf')](this));ami['on'](_0xa531('0x18'),this[_0xa531('0x19')]['bind'](this));ami['on'](_0xa531('0x1a'),this[_0xa531('0x1b')][_0xa531('0xf')](this));ami['on']('musiconholdstart',this[_0xa531('0x1c')][_0xa531('0xf')](this));ami['on']('musiconholdstop',this[_0xa531('0x1d')][_0xa531('0xf')](this));}VoiceAgentReport[_0xa531('0x1e')][_0xa531('0x1f')]=function(_0x5a0f86,_0x3720f6){logger[_0xa531('0x20')](util[_0xa531('0x21')](_0xa531('0x22'),_0x5a0f86,[_0x3720f6[_0xa531('0x23')],_0x3720f6[_0xa531('0x24')],_0x3720f6['queue'],_0x3720f6['exten'],_0x3720f6[_0xa531('0x25')]]['join']('|')));};VoiceAgentReport['prototype'][_0xa531('0x26')]=function(_0x54ebf4,_0x41ed00){return moment(_0x54ebf4)['add'](_0x41ed00,'seconds')[_0xa531('0x21')](_0xa531('0x27'));};VoiceAgentReport['prototype'][_0xa531('0x28')]=function(_0x1e1a6a,_0x29cd25){return moment(_0x1e1a6a)[_0xa531('0x29')](moment(_0x29cd25),_0xa531('0x2a'));};VoiceAgentReport[_0xa531('0x1e')][_0xa531('0xe')]=function(_0x42da62){try{var _0x5a894b=this[_0xa531('0xb')][_0x42da62[_0xa531('0x2b')]];if(!_[_0xa531('0x2c')](_0x5a894b)){_0x5a894b=_[_0xa531('0x2d')](_0x5a894b,{'queue':_0x42da62[_0xa531('0x2e')],'destconnectedlinenum':_0x42da62[_0xa531('0x25')]});io[_0xa531('0x2f')](_0xa531('0x30'),_0x5a894b);}var _0x3ffd7a=this[_0xa531('0xc')][_0x42da62[_0xa531('0x31')]]={'agentcalledAt':moment()['format'](_0xa531('0x27')),'calleridnum':_0x42da62[_0xa531('0x25')],'calleridname':_0x42da62[_0xa531('0x32')],'connectedlinenum':_0x42da62[_0xa531('0x33')],'connectedlinename':_0x42da62['destcalleridname'],'accountcode':_0x42da62[_0xa531('0x34')],'destaccountcode':_0x42da62['destaccountcode'],'channel':_0x42da62[_0xa531('0x35')],'destchannel':_0x42da62[_0xa531('0x31')],'uniqueid':_0x42da62[_0xa531('0x23')],'destuniqueid':_0x42da62['destuniqueid'],'context':_0x42da62['context'],'exten':_0x42da62[_0xa531('0x36')],'priority':_0x42da62[_0xa531('0x37')],'queue':_0x42da62[_0xa531('0x2e')],'type':this[_0xa531('0xa')][_0x42da62['queue']]?this[_0xa531('0xa')][_0x42da62[_0xa531('0x2e')]][_0xa531('0x38')]||_0xa531('0x39'):_0xa531('0x39'),'interface':_0x42da62[_0xa531('0x2b')],'mandatoryDisposition':this[_0xa531('0xa')][_0x42da62[_0xa531('0x2e')]][_0xa531('0x3a')]||0x0,'membername':_0x42da62[_0xa531('0x24')],'agentconnect':![],'agentconnectAt':null,'holdtime':0x0,'ringtime':0x0,'agentcomplete':![],'agentcompleteAt':null,'talktime':0x0,'agentringnoanswer':![],'agentringnoanswerAt':null,'reason':_0xa531('0x3b'),'transfer':![],'transferAt':null,'transfertype':null,'transferuniqueid':null,'transfercontext':null,'transferextension':null,'position':null,'originalposition':null,'cause':'','cause-txt':'','UserId':this['agents'][_0x42da62['interface']]?this[_0xa531('0xb')][_0x42da62['interface']]['id']:null,'lastevent':'called','agentacw':![],'acwtime':0x0,'variables':this['variables'][_0x42da62[_0xa531('0x35')]]?this['variables'][_0x42da62[_0xa531('0x35')]]:{}};ami[_0xa531('0x2f')](_0xa531('0x3c'),_0x3ffd7a);io['to'](util[_0xa531('0x21')](_0xa531('0x3d'),_0x3ffd7a['membername']))[_0xa531('0x2f')]('user:called',_0x3ffd7a);this[_0xa531('0x1f')](_0xa531('0x3e'),this[_0xa531('0xc')][_0x42da62[_0xa531('0x31')]]);}catch(_0x4f952e){logger[_0xa531('0x3f')](_0x4f952e[_0xa531('0x40')]);}};VoiceAgentReport[_0xa531('0x1e')][_0xa531('0x11')]=function(_0x5c5b58){try{var _0x123d4d=this[_0xa531('0xc')][_0x5c5b58[_0xa531('0x31')]];if(!_[_0xa531('0x2c')](_0x123d4d)){_0x123d4d=_['assign'](_0x123d4d,{'holdtime':parseInt(_0x5c5b58['holdtime'],0xa),'ringtime':parseInt(_0x5c5b58[_0xa531('0x41')],0xa),'agentconnect':!![],'lastevent':_0xa531('0x42')});_0x123d4d[_0xa531('0x43')]=this['addTime'](_0x123d4d[_0xa531('0x44')],_0x123d4d[_0xa531('0x41')]);ami['emit'](_0xa531('0x45'),_0x123d4d);io['to'](util[_0xa531('0x21')](_0xa531('0x3d'),_0x123d4d[_0xa531('0x24')]))['emit'](_0xa531('0x46'),_0x123d4d);this[_0xa531('0x1f')](_0xa531('0x47'),_0x123d4d);}}catch(_0x20fe14){logger[_0xa531('0x3f')](_0x20fe14[_0xa531('0x40')]);}};VoiceAgentReport[_0xa531('0x1e')][_0xa531('0x1c')]=function(_0x4d5c8c){try{var _0x4c829f=_['find'](this[_0xa531('0xc')],{'channel':_0x4d5c8c[_0xa531('0x35')],'agentconnect':!![]});if(!_['isNil'](_0x4c829f)){if(!_[_0xa531('0x2c')](this[_0xa531('0xb')][_0x4c829f[_0xa531('0x2b')]])){this[_0xa531('0xb')][_0x4c829f[_0xa531('0x2b')]][_0xa531('0x48')]=!![];this['agents'][_0x4c829f['interface']][_0xa531('0x49')]();}}}catch(_0x3692d3){logger['error'](_0x3692d3[_0xa531('0x40')]);}};VoiceAgentReport[_0xa531('0x1e')][_0xa531('0x1d')]=function(_0x52ed5c){try{var _0x1de754=_[_0xa531('0x4a')](this[_0xa531('0xc')],{'channel':_0x52ed5c['channel'],'agentconnect':!![]});if(!_['isNil'](_0x1de754)){if(!_[_0xa531('0x2c')](this[_0xa531('0xb')][_0x1de754[_0xa531('0x2b')]])){this[_0xa531('0xb')][_0x1de754[_0xa531('0x2b')]]['onhold']=![];this[_0xa531('0xb')][_0x1de754[_0xa531('0x2b')]][_0xa531('0x49')]();}}}catch(_0x42e5a1){logger[_0xa531('0x3f')](_0x42e5a1[_0xa531('0x40')]);}};VoiceAgentReport[_0xa531('0x1e')]['syncAgentRingNoAnswer']=function(_0x4f3539){try{var _0x5ac55b=this[_0xa531('0xc')][_0x4f3539['destchannel']];if(!_[_0xa531('0x2c')](_0x5ac55b)){_0x5ac55b=_['assign'](_0x5ac55b,{'ringtime':parseInt(_0x4f3539[_0xa531('0x41')],0xa)/0x3e8,'agentringnoanswer':!![],'reason':'rejected','lastevent':_0xa531('0x4b')});_0x5ac55b[_0xa531('0x4c')]=this[_0xa531('0x26')](_0x5ac55b[_0xa531('0x44')],_0x5ac55b[_0xa531('0x41')]);ami[_0xa531('0x2f')](_0xa531('0x4d'),_0x5ac55b);this[_0xa531('0x1f')](_0xa531('0x4e'),_0x5ac55b);}}catch(_0x445228){logger['error'](_0x445228[_0xa531('0x40')]);}};VoiceAgentReport[_0xa531('0x1e')][_0xa531('0x4f')]=function(_0x123ba7){try{for(var _0x58579e in this[_0xa531('0xc')]){var _0x2f296c=this[_0xa531('0xc')][_0x58579e];if(!_[_0xa531('0x2c')](_0x2f296c)&&_0x2f296c[_0xa531('0x35')]==_0x123ba7[_0xa531('0x35')]){_0x2f296c=_['assign'](_0x2f296c,{'holdtime':parseInt(_0x123ba7[_0xa531('0x50')],0xa),'position':parseInt(_0x123ba7[_0xa531('0x51')],0xa),'originalposition':parseInt(_0x123ba7['originalposition'],0xa),'agentringnoanswer':!![],'agentringnoanswerAt':moment()[_0xa531('0x21')](_0xa531('0x27')),'reason':_0xa531('0x52'),'lastevent':_0xa531('0x52')});ami[_0xa531('0x2f')]('custom:agentqueuecallerabandon',_0x2f296c);this[_0xa531('0x1f')](_0xa531('0x53'),_0x2f296c);}}}catch(_0xdb2d9a){logger[_0xa531('0x3f')](_0xdb2d9a[_0xa531('0x40')]);}};VoiceAgentReport[_0xa531('0x1e')]['syncAgentComplete']=function(_0x5ea36a){try{var _0x4fbd33=this[_0xa531('0xc')][_0x5ea36a['destchannel']];if(!_[_0xa531('0x2c')](_0x4fbd33)){_0x4fbd33=_[_0xa531('0x2d')](_0x4fbd33,{'talktime':parseInt(_0x5ea36a['talktime'],0xa),'reason':_0x5ea36a[_0xa531('0x54')]==_0xa531('0x55')?_0xa531('0x3b'):_0x5ea36a[_0xa531('0x54')],'agentcomplete':!![],'lastevent':_0xa531('0x56'),'agentacw':this[_0xa531('0xa')][_0x4fbd33[_0xa531('0x2e')]]&&this[_0xa531('0xa')][_0x4fbd33[_0xa531('0x2e')]][_0xa531('0x57')]?!![]:![],'acwtime':this[_0xa531('0xa')][_0x4fbd33['queue']]&&this[_0xa531('0xa')][_0x4fbd33[_0xa531('0x2e')]][_0xa531('0x57')]?this[_0xa531('0xa')][_0x4fbd33[_0xa531('0x2e')]][_0xa531('0x58')]:0x0});_0x4fbd33[_0xa531('0x59')]=this[_0xa531('0x26')](_0x4fbd33['agentconnectAt'],_0x4fbd33[_0xa531('0x5a')]);this['log'](_0xa531('0x5b'),_0x4fbd33);}}catch(_0x4b68af){logger[_0xa531('0x3f')](_0x4b68af[_0xa531('0x40')]);}};VoiceAgentReport[_0xa531('0x1e')]['clear']=function(_0x32ebc5){try{switch(_0x32ebc5['cause']){case 0x1a:_0x32ebc5=_[_0xa531('0x2d')](_0x32ebc5,{'agentringnoanswer':!![],'reason':_0xa531('0x5c'),'lastevent':_0xa531('0x5c')});var _0x288399=_['find'](this['channels'],{'channel':_0x32ebc5['channel'],'agentconnect':!![]});if(!_[_0xa531('0x2c')](_0x288399)){_0x32ebc5=_[_0xa531('0x2d')](_0x32ebc5,{'agentringnoanswerAt':_0x288399[_0xa531('0x43')],'answeredelsewheremembername':_0x288399[_0xa531('0x24')],'answeredelsewheredestinationuniqueid':_0x288399[_0xa531('0x5d')]});}ami['emit'](_0xa531('0x5e'),_0x32ebc5);break;}if(_0x32ebc5[_0xa531('0x5f')]){ami[_0xa531('0x2f')](_0xa531('0x60'),_0x32ebc5);io['to'](util[_0xa531('0x21')](_0xa531('0x3d'),_0x32ebc5[_0xa531('0x24')]))[_0xa531('0x2f')]('user:agentcomplete',_0x32ebc5);}this['log'](_0xa531('0x61'),_0x32ebc5);ami['emit']('custom:voiceAgentReport',_0x32ebc5);if(this[_0xa531('0xc')][_0x32ebc5['destchannel']]){delete this[_0xa531('0xc')][_0x32ebc5['destchannel']];}}catch(_0xacb06d){logger['error'](_0xacb06d);}};VoiceAgentReport[_0xa531('0x1e')][_0xa531('0x62')]=function(_0x7a2845){try{var _0x2ad8c3=this['channels'][_0x7a2845['channel']];if(!_['isNil'](_0x2ad8c3)){_0x2ad8c3=_[_0xa531('0x2d')](_0x2ad8c3,{'cause':parseInt(_0x7a2845[_0xa531('0x63')],0xa),'cause-txt':_0x7a2845[_0xa531('0x64')]});if(_0x2ad8c3[_0xa531('0x65')]){_0x2ad8c3=_['assign'](_0x2ad8c3,{'agentcomplete':!![],'agentcompleteAt':moment()[_0xa531('0x21')](_0xa531('0x27')),'lastevent':_0xa531('0x56'),'agentacw':this[_0xa531('0xa')][_0x2ad8c3[_0xa531('0x2e')]]&&this[_0xa531('0xa')][_0x2ad8c3['queue']][_0xa531('0x57')]?!![]:![],'acwtime':this[_0xa531('0xa')][_0x2ad8c3[_0xa531('0x2e')]]&&this[_0xa531('0xa')][_0x2ad8c3['queue']][_0xa531('0x57')]?this['voiceQueues'][_0x2ad8c3[_0xa531('0x2e')]][_0xa531('0x58')]:0x0});_0x2ad8c3['talktime']=this[_0xa531('0x28')](_0x2ad8c3[_0xa531('0x59')],_0x2ad8c3[_0xa531('0x43')]);}var _0x302de2=this['agents'][_0x2ad8c3[_0xa531('0x2b')]];if(!_[_0xa531('0x2c')](_0x302de2)){_0x302de2=_[_0xa531('0x2d')](_0x302de2,{'queue':null,'destconnectedlinenum':null});io[_0xa531('0x2f')](_0xa531('0x30'),_0x302de2);}setTimeout(this[_0xa531('0x66')][_0xa531('0xf')](this,_0x2ad8c3),0x3e8);}if(this['variables'][_0x7a2845['channel']]){delete this['variables'][_0x7a2845[_0xa531('0x35')]];}}catch(_0x35aec1){logger[_0xa531('0x3f')](_0x35aec1[_0xa531('0x40')]);}};VoiceAgentReport[_0xa531('0x1e')][_0xa531('0x19')]=function(_0xfdaa79){try{var _0x4a3f5d=this[_0xa531('0xc')][_0xfdaa79[_0xa531('0x67')]];if(!_[_0xa531('0x2c')](_0x4a3f5d)){_0x4a3f5d=_[_0xa531('0x2d')](_0x4a3f5d,{'transfer':!![],'transferAt':moment()[_0xa531('0x21')](_0xa531('0x27')),'transfertype':_0xa531('0x68'),'agentcomplete':!![],'agentcompleteAt':moment()['format'](_0xa531('0x27')),'transferuniqueid':_0xfdaa79['secondtransfereruniqueid'],'transfercontext':_0xfdaa79[_0xa531('0x69')],'transferextension':_0xfdaa79[_0xa531('0x6a')],'reason':_0xa531('0x55'),'lastevent':_0xa531('0x56'),'agentacw':this[_0xa531('0xa')][_0x4a3f5d[_0xa531('0x2e')]]&&this[_0xa531('0xa')][_0x4a3f5d[_0xa531('0x2e')]]['acw']?!![]:![],'acwtime':this[_0xa531('0xa')][_0x4a3f5d[_0xa531('0x2e')]]&&this[_0xa531('0xa')][_0x4a3f5d[_0xa531('0x2e')]]['acw']?this[_0xa531('0xa')][_0x4a3f5d[_0xa531('0x2e')]][_0xa531('0x58')]:0x0});_0x4a3f5d[_0xa531('0x5a')]=this[_0xa531('0x28')](_0x4a3f5d[_0xa531('0x59')],_0x4a3f5d[_0xa531('0x43')]);this[_0xa531('0x1f')](_0xa531('0x68'),_0x4a3f5d);}if(!_[_0xa531('0x2c')](this[_0xa531('0xc')][_0xfdaa79[_0xa531('0x6b')]])){this[_0xa531('0xc')][_0xfdaa79['transfertargetchannel']]['recalculate']=!![];}}catch(_0x426d5e){logger['error'](_0x426d5e[_0xa531('0x40')]);}};VoiceAgentReport['prototype'][_0xa531('0x1b')]=function(_0x74911d){try{var _0x1a0b85=this[_0xa531('0xc')][_0x74911d[_0xa531('0x6c')]];if(!_['isNil'](_0x1a0b85)){_0x1a0b85=_[_0xa531('0x2d')](_0x1a0b85,{'transfer':!![],'transferAt':moment()[_0xa531('0x21')]('YYYY-MM-DD\x20HH:mm:ss'),'transfertype':_0xa531('0x6d'),'transferuniqueid':_0x74911d[_0xa531('0x6e')],'transfercontext':_0x74911d[_0xa531('0x6f')],'transferextension':_0x74911d[_0xa531('0x70')],'agentcomplete':!![],'agentcompleteAt':moment()[_0xa531('0x21')](_0xa531('0x27')),'reason':_0xa531('0x55'),'lastevent':_0xa531('0x56'),'agentacw':this[_0xa531('0xa')][_0x1a0b85[_0xa531('0x2e')]]&&this[_0xa531('0xa')][_0x1a0b85[_0xa531('0x2e')]][_0xa531('0x57')]?!![]:![],'acwtime':this[_0xa531('0xa')][_0x1a0b85['queue']]&&this[_0xa531('0xa')][_0x1a0b85[_0xa531('0x2e')]]['acw']?this[_0xa531('0xa')][_0x1a0b85[_0xa531('0x2e')]]['acwTimeout']:0x0});_0x1a0b85[_0xa531('0x65')]=!![];this[_0xa531('0x1f')]('BLIND',_0x1a0b85);}}catch(_0x649804){logger[_0xa531('0x3f')](_0x649804[_0xa531('0x40')]);}};VoiceAgentReport[_0xa531('0x1e')][_0xa531('0x71')]=function(_0x5f1208){var _0x55c488=[_0xa531('0x72'),_0xa531('0x73'),_0xa531('0x74'),_0xa531('0x75'),_0xa531('0x76'),'rtpaudioqoslossbridged',_0xa531('0x77'),_0xa531('0x78'),_0xa531('0x79'),_0xa531('0x7a'),_0xa531('0x7b'),'bridgepvtcallid',_0xa531('0x7c'),_0xa531('0x7d'),_0xa531('0x7e'),'memberlastcall',_0xa531('0x24'),'memberpenalty',_0xa531('0x7f')];try{var _0x58f481=_[_0xa531('0x80')](_0x5f1208[_0xa531('0x81')])[0x0];if(!_[_0xa531('0x2c')](_0x58f481)&&!_['includes'](_0x55c488,_0x58f481)){if(!this[_0xa531('0x82')][_0x5f1208[_0xa531('0x35')]]){this[_0xa531('0x82')][_0x5f1208['channel']]={};}this[_0xa531('0x82')][_0x5f1208[_0xa531('0x35')]][_0x58f481]=_0x5f1208['value'];}}catch(_0xd9c782){logger['error'](_0xd9c782[_0xa531('0x40')]);}};module['exports']=VoiceAgentReport;
\ No newline at end of file
+var _0x308e=['extension','BLIND','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','value','exports','moment','ioredis','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','voiceQueues','agents','variables','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','syncHangup','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','log','format','%s|%s','uniqueid','exten','calleridnum','join','addTime','add','seconds','prototype','diffTime','isNil','assign','queue','user:save','channels','destchannel','calleridname','destcalleridnum','accountcode','destaccountcode','channel','destuniqueid','context','priority','type','inbound','interface','mandatoryDisposition','called','emit','user:%s','membername','user:called','error','holdtime','ringtime','agentcalledAt','custom:agentconnect','user:agentconnect','CONNECT','stack','syncMusicOnHoldStart','find','updateStatusRealtime','syncMusicOnHoldStop','rejected','agentringnoanswerAt','custom:agentringnoanswer','RINGNOANSWER','abandoned','custom:agentqueuecallerabandon','CALLERABANDON','talktime','reason','transfer','agent','acw','acwTimeout','agentcompleteAt','COMPLETE','clear','answered_elsewhere','custom:agentansweredelsewhere','custom:agentcomplete','user:agentcomplete','HANGUP','custom:voiceAgentReport','cause','cause-txt','YYYY-MM-DD\x20HH:mm:ss','complete','agentconnectAt','origtransfererchannel','secondtransfereruniqueid','ATTENDED','transfertargetchannel','recalculate','transfererchannel'];(function(_0x5101ae,_0x149868){var _0x3da848=function(_0x57bfe1){while(--_0x57bfe1){_0x5101ae['push'](_0x5101ae['shift']());}};_0x3da848(++_0x149868);}(_0x308e,0x115));var _0xe308=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x308e[_0x279d37];return _0x530173;};'use strict';var _=require('lodash');var moment=require(_0xe308('0x0'));var util=require('util');var Redis=require(_0xe308('0x1'));var config=require('../../../config/environment');var logger=require(_0xe308('0x2'))('ami');var ami=require(_0xe308('0x3'));config[_0xe308('0x4')]=_[_0xe308('0x5')](config['redis'],{'host':_0xe308('0x6'),'port':0x18eb});var io=require(_0xe308('0x7'))(new Redis(config['redis']));function VoiceAgentReport(_0x34cdea){this[_0xe308('0x8')]=_0x34cdea[_0xe308('0x8')];this[_0xe308('0x9')]=_0x34cdea['agents'];this['channels']={};this[_0xe308('0xa')]={};ami['on']('agentcalled',this[_0xe308('0xb')][_0xe308('0xc')](this));ami['on'](_0xe308('0xd'),this[_0xe308('0xe')][_0xe308('0xc')](this));ami['on'](_0xe308('0xf'),this[_0xe308('0x10')]['bind'](this));ami['on']('queuecallerabandon',this[_0xe308('0x11')][_0xe308('0xc')](this));ami['on'](_0xe308('0x12'),this[_0xe308('0x13')][_0xe308('0xc')](this));ami['on'](_0xe308('0x14'),this[_0xe308('0x15')][_0xe308('0xc')](this));ami['on']('hangup',this[_0xe308('0x16')][_0xe308('0xc')](this));ami['on']('attendedtransfer',this[_0xe308('0x17')]['bind'](this));ami['on']('blindtransfer',this[_0xe308('0x18')][_0xe308('0xc')](this));ami['on'](_0xe308('0x19'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0xe308('0x1a'),this['syncMusicOnHoldStop'][_0xe308('0xc')](this));}VoiceAgentReport['prototype'][_0xe308('0x1b')]=function(_0x2a681d,_0x3de895){logger['info'](util[_0xe308('0x1c')](_0xe308('0x1d'),_0x2a681d,[_0x3de895[_0xe308('0x1e')],_0x3de895['membername'],_0x3de895['queue'],_0x3de895[_0xe308('0x1f')],_0x3de895[_0xe308('0x20')]][_0xe308('0x21')]('|')));};VoiceAgentReport['prototype'][_0xe308('0x22')]=function(_0x4717dd,_0x58bdf4){return moment(_0x4717dd)[_0xe308('0x23')](_0x58bdf4,_0xe308('0x24'))[_0xe308('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');};VoiceAgentReport[_0xe308('0x25')][_0xe308('0x26')]=function(_0x3b0475,_0x4e2d9b){return moment(_0x3b0475)['diff'](moment(_0x4e2d9b),_0xe308('0x24'));};VoiceAgentReport[_0xe308('0x25')][_0xe308('0xb')]=function(_0x18e848){try{var _0x315643=this['agents'][_0x18e848['interface']];if(!_[_0xe308('0x27')](_0x315643)){_0x315643=_[_0xe308('0x28')](_0x315643,{'queue':_0x18e848[_0xe308('0x29')],'destconnectedlinenum':_0x18e848[_0xe308('0x20')]});io['emit'](_0xe308('0x2a'),_0x315643);}var _0x15adf9=this[_0xe308('0x2b')][_0x18e848[_0xe308('0x2c')]]={'agentcalledAt':moment()[_0xe308('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'calleridnum':_0x18e848[_0xe308('0x20')],'calleridname':_0x18e848[_0xe308('0x2d')],'connectedlinenum':_0x18e848[_0xe308('0x2e')],'connectedlinename':_0x18e848['destcalleridname'],'accountcode':_0x18e848[_0xe308('0x2f')],'destaccountcode':_0x18e848[_0xe308('0x30')],'channel':_0x18e848[_0xe308('0x31')],'destchannel':_0x18e848[_0xe308('0x2c')],'uniqueid':_0x18e848[_0xe308('0x1e')],'destuniqueid':_0x18e848[_0xe308('0x32')],'context':_0x18e848[_0xe308('0x33')],'exten':_0x18e848['exten'],'priority':_0x18e848[_0xe308('0x34')],'queue':_0x18e848[_0xe308('0x29')],'type':this[_0xe308('0x8')][_0x18e848['queue']]?this[_0xe308('0x8')][_0x18e848[_0xe308('0x29')]][_0xe308('0x35')]||_0xe308('0x36'):_0xe308('0x36'),'interface':_0x18e848[_0xe308('0x37')],'mandatoryDisposition':this['voiceQueues'][_0x18e848[_0xe308('0x29')]][_0xe308('0x38')]||0x0,'membername':_0x18e848['membername'],'agentconnect':![],'agentconnectAt':null,'holdtime':0x0,'ringtime':0x0,'agentcomplete':![],'agentcompleteAt':null,'talktime':0x0,'agentringnoanswer':![],'agentringnoanswerAt':null,'reason':'agent','transfer':![],'transferAt':null,'transfertype':null,'transferuniqueid':null,'transfercontext':null,'transferextension':null,'position':null,'originalposition':null,'cause':'','cause-txt':'','UserId':this[_0xe308('0x9')][_0x18e848['interface']]?this[_0xe308('0x9')][_0x18e848[_0xe308('0x37')]]['id']:null,'lastevent':_0xe308('0x39'),'agentacw':![],'acwtime':0x0,'variables':this[_0xe308('0xa')][_0x18e848[_0xe308('0x31')]]?this[_0xe308('0xa')][_0x18e848[_0xe308('0x31')]]:{}};ami[_0xe308('0x3a')]('custom:agentcalled',_0x15adf9);io['to'](util['format'](_0xe308('0x3b'),_0x15adf9[_0xe308('0x3c')]))[_0xe308('0x3a')](_0xe308('0x3d'),_0x15adf9);this['log']('CALLED',this[_0xe308('0x2b')][_0x18e848[_0xe308('0x2c')]]);}catch(_0x244ecb){logger[_0xe308('0x3e')](_0x244ecb['stack']);}};VoiceAgentReport['prototype'][_0xe308('0xe')]=function(_0x552463){try{var _0x1332af=this[_0xe308('0x2b')][_0x552463[_0xe308('0x2c')]];if(!_[_0xe308('0x27')](_0x1332af)){_0x1332af=_[_0xe308('0x28')](_0x1332af,{'holdtime':parseInt(_0x552463[_0xe308('0x3f')],0xa),'ringtime':parseInt(_0x552463[_0xe308('0x40')],0xa),'agentconnect':!![],'lastevent':'connect'});_0x1332af['agentconnectAt']=this[_0xe308('0x22')](_0x1332af[_0xe308('0x41')],_0x1332af[_0xe308('0x40')]);ami[_0xe308('0x3a')](_0xe308('0x42'),_0x1332af);io['to'](util['format'](_0xe308('0x3b'),_0x1332af['membername']))[_0xe308('0x3a')](_0xe308('0x43'),_0x1332af);this[_0xe308('0x1b')](_0xe308('0x44'),_0x1332af);}}catch(_0x56be7c){logger[_0xe308('0x3e')](_0x56be7c[_0xe308('0x45')]);}};VoiceAgentReport['prototype'][_0xe308('0x46')]=function(_0x32f01a){try{var _0x4671cc=_[_0xe308('0x47')](this['channels'],{'channel':_0x32f01a[_0xe308('0x31')],'agentconnect':!![]});if(!_[_0xe308('0x27')](_0x4671cc)){if(!_[_0xe308('0x27')](this[_0xe308('0x9')][_0x4671cc['interface']])){this[_0xe308('0x9')][_0x4671cc[_0xe308('0x37')]]['onhold']=!![];this['agents'][_0x4671cc[_0xe308('0x37')]][_0xe308('0x48')]();}}}catch(_0x408260){logger[_0xe308('0x3e')](_0x408260[_0xe308('0x45')]);}};VoiceAgentReport['prototype'][_0xe308('0x49')]=function(_0x58ef9d){try{var _0x19904b=_['find'](this[_0xe308('0x2b')],{'channel':_0x58ef9d[_0xe308('0x31')],'agentconnect':!![]});if(!_[_0xe308('0x27')](_0x19904b)){if(!_['isNil'](this[_0xe308('0x9')][_0x19904b[_0xe308('0x37')]])){this[_0xe308('0x9')][_0x19904b['interface']]['onhold']=![];this[_0xe308('0x9')][_0x19904b[_0xe308('0x37')]][_0xe308('0x48')]();}}}catch(_0xdb49f7){logger[_0xe308('0x3e')](_0xdb49f7[_0xe308('0x45')]);}};VoiceAgentReport[_0xe308('0x25')]['syncAgentRingNoAnswer']=function(_0x1c2318){try{var _0x1a5021=this['channels'][_0x1c2318[_0xe308('0x2c')]];if(!_[_0xe308('0x27')](_0x1a5021)){_0x1a5021=_[_0xe308('0x28')](_0x1a5021,{'ringtime':parseInt(_0x1c2318[_0xe308('0x40')],0xa)/0x3e8,'agentringnoanswer':!![],'reason':'rejected','lastevent':_0xe308('0x4a')});_0x1a5021[_0xe308('0x4b')]=this[_0xe308('0x22')](_0x1a5021[_0xe308('0x41')],_0x1a5021[_0xe308('0x40')]);ami['emit'](_0xe308('0x4c'),_0x1a5021);this[_0xe308('0x1b')](_0xe308('0x4d'),_0x1a5021);}}catch(_0x195bfe){logger[_0xe308('0x3e')](_0x195bfe[_0xe308('0x45')]);}};VoiceAgentReport[_0xe308('0x25')][_0xe308('0x11')]=function(_0x16f2fc){try{for(var _0x284cbe in this['channels']){var _0x344b8b=this[_0xe308('0x2b')][_0x284cbe];if(!_['isNil'](_0x344b8b)&&_0x344b8b[_0xe308('0x31')]==_0x16f2fc[_0xe308('0x31')]){_0x344b8b=_[_0xe308('0x28')](_0x344b8b,{'holdtime':parseInt(_0x16f2fc[_0xe308('0x3f')],0xa),'position':parseInt(_0x16f2fc['position'],0xa),'originalposition':parseInt(_0x16f2fc['originalposition'],0xa),'agentringnoanswer':!![],'agentringnoanswerAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xe308('0x4e'),'lastevent':_0xe308('0x4e')});ami['emit'](_0xe308('0x4f'),_0x344b8b);this['log'](_0xe308('0x50'),_0x344b8b);}}}catch(_0x58555f){logger[_0xe308('0x3e')](_0x58555f[_0xe308('0x45')]);}};VoiceAgentReport[_0xe308('0x25')]['syncAgentComplete']=function(_0x58735d){try{var _0x3e7883=this['channels'][_0x58735d[_0xe308('0x2c')]];if(!_[_0xe308('0x27')](_0x3e7883)){_0x3e7883=_[_0xe308('0x28')](_0x3e7883,{'talktime':parseInt(_0x58735d[_0xe308('0x51')],0xa),'reason':_0x58735d[_0xe308('0x52')]==_0xe308('0x53')?_0xe308('0x54'):_0x58735d[_0xe308('0x52')],'agentcomplete':!![],'lastevent':'complete','agentacw':this[_0xe308('0x8')][_0x3e7883['queue']]&&this[_0xe308('0x8')][_0x3e7883[_0xe308('0x29')]]['acw']?!![]:![],'acwtime':this[_0xe308('0x8')][_0x3e7883['queue']]&&this['voiceQueues'][_0x3e7883['queue']][_0xe308('0x55')]?this[_0xe308('0x8')][_0x3e7883[_0xe308('0x29')]][_0xe308('0x56')]:0x0});_0x3e7883[_0xe308('0x57')]=this['addTime'](_0x3e7883['agentconnectAt'],_0x3e7883[_0xe308('0x51')]);this[_0xe308('0x1b')](_0xe308('0x58'),_0x3e7883);}}catch(_0x4a06ab){logger['error'](_0x4a06ab['stack']);}};VoiceAgentReport[_0xe308('0x25')][_0xe308('0x59')]=function(_0x2aa0d1){try{switch(_0x2aa0d1['cause']){case 0x1a:_0x2aa0d1=_[_0xe308('0x28')](_0x2aa0d1,{'agentringnoanswer':!![],'reason':_0xe308('0x5a'),'lastevent':_0xe308('0x5a')});var _0x2da37e=_[_0xe308('0x47')](this[_0xe308('0x2b')],{'channel':_0x2aa0d1[_0xe308('0x31')],'agentconnect':!![]});if(!_[_0xe308('0x27')](_0x2da37e)){_0x2aa0d1=_['assign'](_0x2aa0d1,{'agentringnoanswerAt':_0x2da37e['agentconnectAt'],'answeredelsewheremembername':_0x2da37e[_0xe308('0x3c')],'answeredelsewheredestinationuniqueid':_0x2da37e[_0xe308('0x32')]});}ami[_0xe308('0x3a')](_0xe308('0x5b'),_0x2aa0d1);break;}if(_0x2aa0d1['agentcomplete']){ami[_0xe308('0x3a')](_0xe308('0x5c'),_0x2aa0d1);io['to'](util['format']('user:%s',_0x2aa0d1[_0xe308('0x3c')]))[_0xe308('0x3a')](_0xe308('0x5d'),_0x2aa0d1);}this['log'](_0xe308('0x5e'),_0x2aa0d1);ami[_0xe308('0x3a')](_0xe308('0x5f'),_0x2aa0d1);if(this[_0xe308('0x2b')][_0x2aa0d1[_0xe308('0x2c')]]){delete this[_0xe308('0x2b')][_0x2aa0d1[_0xe308('0x2c')]];}}catch(_0x3b7925){logger[_0xe308('0x3e')](_0x3b7925);}};VoiceAgentReport[_0xe308('0x25')]['syncHangup']=function(_0x22b54b){try{var _0x24cc0c=this[_0xe308('0x2b')][_0x22b54b[_0xe308('0x31')]];if(!_[_0xe308('0x27')](_0x24cc0c)){_0x24cc0c=_[_0xe308('0x28')](_0x24cc0c,{'cause':parseInt(_0x22b54b[_0xe308('0x60')],0xa),'cause-txt':_0x22b54b[_0xe308('0x61')]});if(_0x24cc0c['recalculate']){_0x24cc0c=_[_0xe308('0x28')](_0x24cc0c,{'agentcomplete':!![],'agentcompleteAt':moment()[_0xe308('0x1c')](_0xe308('0x62')),'lastevent':_0xe308('0x63'),'agentacw':this['voiceQueues'][_0x24cc0c[_0xe308('0x29')]]&&this[_0xe308('0x8')][_0x24cc0c[_0xe308('0x29')]][_0xe308('0x55')]?!![]:![],'acwtime':this[_0xe308('0x8')][_0x24cc0c['queue']]&&this[_0xe308('0x8')][_0x24cc0c[_0xe308('0x29')]][_0xe308('0x55')]?this[_0xe308('0x8')][_0x24cc0c['queue']][_0xe308('0x56')]:0x0});_0x24cc0c['talktime']=this[_0xe308('0x26')](_0x24cc0c[_0xe308('0x57')],_0x24cc0c[_0xe308('0x64')]);}var _0x2f3ed6=this[_0xe308('0x9')][_0x24cc0c[_0xe308('0x37')]];if(!_['isNil'](_0x2f3ed6)){_0x2f3ed6=_[_0xe308('0x28')](_0x2f3ed6,{'queue':null,'destconnectedlinenum':null});io[_0xe308('0x3a')](_0xe308('0x2a'),_0x2f3ed6);}setTimeout(this[_0xe308('0x59')][_0xe308('0xc')](this,_0x24cc0c),0x3e8);}if(this['variables'][_0x22b54b['channel']]){delete this[_0xe308('0xa')][_0x22b54b['channel']];}}catch(_0x462e5d){logger['error'](_0x462e5d[_0xe308('0x45')]);}};VoiceAgentReport['prototype'][_0xe308('0x17')]=function(_0x100c07){try{var _0x4da3fd=this[_0xe308('0x2b')][_0x100c07[_0xe308('0x65')]];if(!_[_0xe308('0x27')](_0x4da3fd)){_0x4da3fd=_[_0xe308('0x28')](_0x4da3fd,{'transfer':!![],'transferAt':moment()[_0xe308('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'transfertype':'ATTENDED','agentcomplete':!![],'agentcompleteAt':moment()[_0xe308('0x1c')](_0xe308('0x62')),'transferuniqueid':_0x100c07[_0xe308('0x66')],'transfercontext':_0x100c07['secondtransfererexten'],'transferextension':_0x100c07['secondtransferercontext'],'reason':_0xe308('0x53'),'lastevent':_0xe308('0x63'),'agentacw':this[_0xe308('0x8')][_0x4da3fd[_0xe308('0x29')]]&&this[_0xe308('0x8')][_0x4da3fd[_0xe308('0x29')]][_0xe308('0x55')]?!![]:![],'acwtime':this[_0xe308('0x8')][_0x4da3fd[_0xe308('0x29')]]&&this[_0xe308('0x8')][_0x4da3fd[_0xe308('0x29')]][_0xe308('0x55')]?this['voiceQueues'][_0x4da3fd[_0xe308('0x29')]][_0xe308('0x56')]:0x0});_0x4da3fd[_0xe308('0x51')]=this[_0xe308('0x26')](_0x4da3fd['agentcompleteAt'],_0x4da3fd[_0xe308('0x64')]);this[_0xe308('0x1b')](_0xe308('0x67'),_0x4da3fd);}if(!_['isNil'](this[_0xe308('0x2b')][_0x100c07[_0xe308('0x68')]])){this['channels'][_0x100c07[_0xe308('0x68')]][_0xe308('0x69')]=!![];}}catch(_0x447387){logger[_0xe308('0x3e')](_0x447387[_0xe308('0x45')]);}};VoiceAgentReport[_0xe308('0x25')][_0xe308('0x18')]=function(_0x145d9f){try{var _0x3de4af=this[_0xe308('0x2b')][_0x145d9f[_0xe308('0x6a')]];if(!_[_0xe308('0x27')](_0x3de4af)){_0x3de4af=_[_0xe308('0x28')](_0x3de4af,{'transfer':!![],'transferAt':moment()[_0xe308('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'transfertype':'BLIND','transferuniqueid':_0x145d9f['transfereeuniqueid'],'transfercontext':_0x145d9f[_0xe308('0x33')],'transferextension':_0x145d9f[_0xe308('0x6b')],'agentcomplete':!![],'agentcompleteAt':moment()[_0xe308('0x1c')](_0xe308('0x62')),'reason':_0xe308('0x53'),'lastevent':_0xe308('0x63'),'agentacw':this['voiceQueues'][_0x3de4af[_0xe308('0x29')]]&&this[_0xe308('0x8')][_0x3de4af[_0xe308('0x29')]]['acw']?!![]:![],'acwtime':this[_0xe308('0x8')][_0x3de4af[_0xe308('0x29')]]&&this['voiceQueues'][_0x3de4af['queue']][_0xe308('0x55')]?this['voiceQueues'][_0x3de4af[_0xe308('0x29')]][_0xe308('0x56')]:0x0});_0x3de4af[_0xe308('0x69')]=!![];this['log'](_0xe308('0x6c'),_0x3de4af);}}catch(_0x4eded4){logger[_0xe308('0x3e')](_0x4eded4[_0xe308('0x45')]);}};VoiceAgentReport[_0xe308('0x25')]['syncVarSet']=function(_0x176f77){var _0x1f4c2c=[_0xe308('0x6d'),_0xe308('0x6e'),_0xe308('0x6f'),'rtpaudioqosjitterbridged',_0xe308('0x70'),_0xe308('0x71'),'rtpaudioqosrtt',_0xe308('0x72'),_0xe308('0x73'),_0xe308('0x74'),_0xe308('0x75'),_0xe308('0x76'),_0xe308('0x77'),_0xe308('0x78'),_0xe308('0x79'),_0xe308('0x7a'),_0xe308('0x3c'),_0xe308('0x7b'),_0xe308('0x7c')];try{var _0xe6a94a=_['keys'](_0x176f77['variable'])[0x0];if(!_[_0xe308('0x27')](_0xe6a94a)&&!_[_0xe308('0x7d')](_0x1f4c2c,_0xe6a94a)){if(!this[_0xe308('0xa')][_0x176f77[_0xe308('0x31')]]){this[_0xe308('0xa')][_0x176f77[_0xe308('0x31')]]={};}this['variables'][_0x176f77['channel']][_0xe6a94a]=_0x176f77[_0xe308('0x7e')];}}catch(_0x45a6cb){logger[_0xe308('0x3e')](_0x45a6cb['stack']);}};module[_0xe308('0x7f')]=VoiceAgentReport;
\ No newline at end of file
index a644569..9e96a31 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8213=['transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','syncBlindTransfer','transfereecalleridnum','extension','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','isNil','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','bluebird','lodash','../../../config/environment','../../../config/logger','../ami','unknown','not_inuse','inuse','busy','invalid','ringing','ringinuse','set','agi','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','defaults','redis','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','newcallerid','syncNewCallerId','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','resolve','then','actionCoreShowChannels','catch','log','isNotNull','prototype','emit','linkedid','isUndefined','uniqueid','merge','pick','keys','error','channel','OutgoingSpoolFailed','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','context','from-sip','split','destconnectedlinenum','exten','name','inspect','application','appdata','applicationdata','toLowerCase','starttime','duration','seconds','includes','lastapplication','lastdata','startsWith','cdr(','match','queue','[syncNewExten][VoiceCallReport]','answertime','holdtime','diff','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','calleridname','destinationchannel','UserId','membername','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','endsWith','replace','.wav49','monitorFilename','find','monitors','push','rec','variable','mixmonitor_filename','xmd-callerid','callerid','value','xmd-cdrtype','type','xmd-queue','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','parse','sipcallid','sipcalllinkedid','[syncVarSet][VoiceCallReport]','syncHangup','billableseconds','omit','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum'];(function(_0x5efc87,_0x5a7b35){var _0x107581=function(_0x1d3d40){while(--_0x1d3d40){_0x5efc87['push'](_0x5efc87['shift']());}};_0x107581(++_0x5a7b35);}(_0x8213,0x1d9));var _0x3821=function(_0x27f5cd,_0xc1c22){_0x27f5cd=_0x27f5cd-0x0;var _0x271e5f=_0x8213[_0x27f5cd];return _0x271e5f;};'use strict';var BPromise=require(_0x3821('0x0'));var _=require(_0x3821('0x1'));var moment=require('moment');var util=require('util');var path=require('path');var Redis=require('ioredis');var config=require(_0x3821('0x2'));var logger=require(_0x3821('0x3'))('ami');var ami=require(_0x3821('0x4'));var Channel=require('../model/channel');var statusDesc=[_0x3821('0x5'),_0x3821('0x6'),_0x3821('0x7'),_0x3821('0x8'),_0x3821('0x9'),'unavailable',_0x3821('0xa'),_0x3821('0xb'),'onhold'];var applications=[_0x3821('0xc'),'queue',_0x3821('0xd'),'dial',_0x3821('0xe'),_0x3821('0xf')];var dispositions=[_0x3821('0x10'),_0x3821('0x11'),_0x3821('0x11'),'NO\x20ANSWER','NO\x20ANSWER','NO\x20ANSWER',_0x3821('0x12'),_0x3821('0x13'),'FAILED',_0x3821('0x11'),_0x3821('0x11')];var actions={};config['redis']=_[_0x3821('0x14')](config[_0x3821('0x15')],{'host':_0x3821('0x16'),'port':0x18eb});var io=require(_0x3821('0x17'))(new Redis(config['redis']));function VoiceCallReport(_0x2eac6d){this[_0x3821('0x18')]=_0x2eac6d['channels'];this[_0x3821('0x19')]=_0x2eac6d['agents'];ami['on'](_0x3821('0x1a'),this[_0x3821('0x1b')][_0x3821('0x1c')](this));ami['on'](_0x3821('0x1d'),this[_0x3821('0x1b')][_0x3821('0x1c')](this));ami['on'](_0x3821('0x1e'),this[_0x3821('0x1f')][_0x3821('0x1c')](this));ami['on'](_0x3821('0x20'),this[_0x3821('0x21')][_0x3821('0x1c')](this));ami['on'](_0x3821('0x22'),this[_0x3821('0x23')][_0x3821('0x1c')](this));ami['on'](_0x3821('0x24'),this['syncHangup'][_0x3821('0x1c')](this));ami['on'](_0x3821('0x25'),this[_0x3821('0x26')]['bind'](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x3821('0x1c')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x3821('0x1c')](this));ami['on']('musiconholdstart',this[_0x3821('0x27')][_0x3821('0x1c')](this));ami['on'](_0x3821('0x28'),this[_0x3821('0x29')]['bind'](this));return BPromise[_0x3821('0x2a')]()[_0x3821('0x2b')](ami[_0x3821('0x2c')]())[_0x3821('0x2d')](function(_0x42787f){console[_0x3821('0x2e')](_0x42787f);});}VoiceCallReport['prototype'][_0x3821('0x2f')]=function(_0x4aef84){return _0x4aef84!==null&&!_['isUndefined'](_0x4aef84);};VoiceCallReport[_0x3821('0x30')][_0x3821('0x31')]=function(_0x4fa8be,_0x4e3855,_0x8e4cf7){io['to'](_0x4fa8be)[_0x3821('0x31')](_0x4e3855,_0x8e4cf7);};VoiceCallReport['prototype'][_0x3821('0x26')]=function(_0x5b4e12){try{if(this[_0x3821('0x2f')](_0x5b4e12)){if(_0x5b4e12['uniqueid']===_0x5b4e12[_0x3821('0x32')]){if(!_[_0x3821('0x33')](this[_0x3821('0x18')][_0x5b4e12[_0x3821('0x34')]])){_[_0x3821('0x35')](this['channels'][_0x5b4e12[_0x3821('0x34')]],_[_0x3821('0x36')](_0x5b4e12,_[_0x3821('0x37')](this['channels'][_0x5b4e12[_0x3821('0x34')]])));}}}}catch(_0x47fea6){logger[_0x3821('0x38')]('[syncNewCallerId][VoiceCallReport]',util['inspect'](_0x47fea6,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x3821('0x1f')]=function(_0x269463){try{if(this[_0x3821('0x2f')](_0x269463)){if(_0x269463[_0x3821('0x34')]===_0x269463[_0x3821('0x32')]&&_0x269463[_0x3821('0x39')]!=_0x3821('0x3a')){if(_[_0x3821('0x33')](this[_0x3821('0x18')][_0x269463[_0x3821('0x34')]])){this[_0x3821('0x18')][_0x269463[_0x3821('0x34')]]=new Channel();this[_0x3821('0x18')][_0x269463[_0x3821('0x34')]]['starttime']=moment()[_0x3821('0x3b')](_0x3821('0x3c'));this[_0x3821('0x18')][_0x269463[_0x3821('0x34')]][_0x3821('0x3d')]=dispositions[_[_0x3821('0x3e')](_0x269463[_0x3821('0x3f')])];_['merge'](this[_0x3821('0x18')][_0x269463[_0x3821('0x34')]],_[_0x3821('0x36')](_0x269463,_[_0x3821('0x37')](this['channels'][_0x269463[_0x3821('0x34')]])));if(_0x269463[_0x3821('0x40')]===_0x3821('0x41')){if(this[_0x3821('0x19')][_0x269463[_0x3821('0x39')][_0x3821('0x42')]('-')[0x0]]){this['agents'][_0x269463[_0x3821('0x39')][_0x3821('0x42')]('-')[0x0]][_0x3821('0x43')]=_0x269463[_0x3821('0x44')];this['emit'](util['format']('user:%s',this[_0x3821('0x19')][_0x269463[_0x3821('0x39')][_0x3821('0x42')]('-')[0x0]][_0x3821('0x45')]),'user:agentconnect',{'destaccountcode':this[_0x3821('0x19')][_0x269463[_0x3821('0x39')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x269463[_0x3821('0x44')]});}}}}}}catch(_0x57783f){logger['error']('[syncNewChannel][VoiceCallReport]',util[_0x3821('0x46')](_0x57783f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x3821('0x1b')]=function(_0x4ab431){try{if(this[_0x3821('0x2f')](_0x4ab431)){if(_0x4ab431['uniqueid']===_0x4ab431['linkedid']&&_0x4ab431[_0x3821('0x44')]!='h'&&_0x4ab431[_0x3821('0x39')]!=_0x3821('0x3a')){_0x4ab431[_0x3821('0x47')]=_0x4ab431['application']['toLowerCase']();_0x4ab431['applicationdata']=(_0x4ab431[_0x3821('0x48')]||_0x4ab431[_0x3821('0x49')])[_0x3821('0x4a')]();if(_[_0x3821('0x33')](this[_0x3821('0x18')][_0x4ab431[_0x3821('0x34')]])){this[_0x3821('0x18')][_0x4ab431['uniqueid']]=new Channel();this['channels'][_0x4ab431[_0x3821('0x34')]][_0x3821('0x4b')]=_0x4ab431['duration']?moment()['subtract'](moment['duration'](_0x4ab431[_0x3821('0x4c')])[_0x3821('0x4d')](),_0x3821('0x4d'))[_0x3821('0x3b')](_0x3821('0x3c')):moment()[_0x3821('0x3b')](_0x3821('0x3c'));this['channels'][_0x4ab431[_0x3821('0x34')]][_0x3821('0x3d')]=_0x3821('0x10');}_[_0x3821('0x35')](this[_0x3821('0x18')][_0x4ab431[_0x3821('0x34')]],_[_0x3821('0x36')](_0x4ab431,_[_0x3821('0x37')](this['channels'][_0x4ab431['uniqueid']])));if(_[_0x3821('0x4e')](applications,_0x4ab431[_0x3821('0x47')])){this['channels'][_0x4ab431['uniqueid']][_0x3821('0x4f')]=_0x4ab431['application'];this[_0x3821('0x18')][_0x4ab431[_0x3821('0x34')]][_0x3821('0x50')]=_0x4ab431[_0x3821('0x49')];if(_0x4ab431[_0x3821('0x47')]===_0x3821('0xc')&&_[_0x3821('0x51')](_0x4ab431[_0x3821('0x49')],_0x3821('0x52'))){var _0x564ab9=_0x4ab431[_0x3821('0x49')][_0x3821('0x42')]('=');var _0x495036=_0x564ab9[0x0][_0x3821('0x53')](/cdr\((.*)\)/);if(_0x495036){this[_0x3821('0x18')][_0x4ab431[_0x3821('0x34')]][_0x495036[0x1]]=_0x564ab9[0x1];}}else if(_0x4ab431['application']===_0x3821('0x54')){this[_0x3821('0x18')][_0x4ab431[_0x3821('0x34')]][_0x3821('0x54')]=_0x4ab431[_0x3821('0x49')]['split'](',')[0x0];}}}}}catch(_0x4bb900){logger[_0x3821('0x38')](_0x3821('0x55'),util['inspect'](_0x4bb900,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x3821('0x21')]=function(_0x4c2675){try{if(this[_0x3821('0x2f')](_0x4c2675)){if(_0x4c2675[_0x3821('0x34')]!==_0x4c2675[_0x3821('0x32')]){if(this[_0x3821('0x18')][_0x4c2675[_0x3821('0x32')]]){if(_0x4c2675[_0x3821('0x3f')]==='6'){if(!this[_0x3821('0x18')][_0x4c2675[_0x3821('0x32')]]['answered']){var _0x582394=moment();this[_0x3821('0x18')][_0x4c2675[_0x3821('0x32')]]['answered']=!![];this['channels'][_0x4c2675[_0x3821('0x32')]][_0x3821('0x56')]=_0x582394[_0x3821('0x3b')](_0x3821('0x3c'));if(this[_0x3821('0x18')][_0x4c2675[_0x3821('0x32')]][_0x3821('0x4b')]){this[_0x3821('0x18')][_0x4c2675[_0x3821('0x32')]][_0x3821('0x57')]=_0x582394[_0x3821('0x58')](this['channels'][_0x4c2675['linkedid']]['starttime'],_0x3821('0x4d'));}}this['channels'][_0x4c2675[_0x3821('0x32')]][_0x3821('0x32')]=_0x4c2675[_0x3821('0x34')];if(_0x4c2675[_0x3821('0x59')]!==_0x3821('0x5a')){this[_0x3821('0x18')][_0x4c2675[_0x3821('0x32')]][_0x3821('0x5b')]=_0x4c2675[_0x3821('0x59')];}this[_0x3821('0x18')][_0x4c2675['linkedid']][_0x3821('0x5c')]=_0x4c2675[_0x3821('0x5d')];this[_0x3821('0x18')][_0x4c2675[_0x3821('0x32')]][_0x3821('0x5e')]=_0x4c2675['channel'];this[_0x3821('0x18')][_0x4c2675[_0x3821('0x32')]]['disposition']=dispositions[_[_0x3821('0x3e')](_0x4c2675[_0x3821('0x3f')])];if(this[_0x3821('0x19')][_0x4c2675[_0x3821('0x39')][_0x3821('0x42')]('-')[0x0]]){this['channels'][_0x4c2675[_0x3821('0x32')]][_0x3821('0x5f')]=this['agents'][_0x4c2675['channel'][_0x3821('0x42')]('-')[0x0]]['id'];this[_0x3821('0x18')][_0x4c2675[_0x3821('0x32')]]['membername']=this[_0x3821('0x19')][_0x4c2675[_0x3821('0x39')][_0x3821('0x42')]('-')[0x0]]['name'];}}}}else{if(this['channels'][_0x4c2675[_0x3821('0x34')]]){if(_0x4c2675[_0x3821('0x3f')]==='6'){if(this[_0x3821('0x19')][_0x4c2675[_0x3821('0x39')][_0x3821('0x42')]('-')[0x0]]){this[_0x3821('0x18')][_0x4c2675[_0x3821('0x34')]][_0x3821('0x5f')]=this[_0x3821('0x19')][_0x4c2675[_0x3821('0x39')][_0x3821('0x42')]('-')[0x0]]['id'];this['channels'][_0x4c2675[_0x3821('0x34')]][_0x3821('0x60')]=this['agents'][_0x4c2675['channel'][_0x3821('0x42')]('-')[0x0]][_0x3821('0x45')];}}}}}}catch(_0x532be7){logger['error'](_0x3821('0x61'),util['inspect'](_0x532be7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3821('0x30')][_0x3821('0x62')]=function(_0x23bef2,_0x197807){if(this[_0x3821('0x18')][_0x23bef2]){this['channels'][_0x23bef2]['monitor']=!![];if(_[_0x3821('0x63')](_0x197807,'.wav49')){_0x197807=_0x197807[_0x3821('0x64')](_0x3821('0x65'),'.WAV');}this[_0x3821('0x18')][_0x23bef2][_0x3821('0x66')]=_0x197807;var _0x2a95d4=_[_0x3821('0x67')](this[_0x3821('0x18')][_0x23bef2][_0x3821('0x68')],{'filename':_0x197807});if(_['isNil'](_0x2a95d4)){this[_0x3821('0x18')][_0x23bef2][_0x3821('0x68')][_0x3821('0x69')]({'filename':_0x197807,'createdAt':moment()[_0x3821('0x3b')](_0x3821('0x3c')),'mixmonitorid':'','status':_0x3821('0x6a')});}}};VoiceCallReport['prototype'][_0x3821('0x23')]=function(_0x538856){try{if(this[_0x3821('0x2f')](_0x538856)){if(this[_0x3821('0x18')][_0x538856[_0x3821('0x34')]]&&_0x538856['channel']!=_0x3821('0x3a')){if(this[_0x3821('0x2f')](_0x538856[_0x3821('0x6b')])){if(this[_0x3821('0x2f')](_0x538856[_0x3821('0x6b')][_0x3821('0x6c')])){this[_0x3821('0x62')](_0x538856[_0x3821('0x34')],_0x538856['value']);}else if(this['isNotNull'](_0x538856[_0x3821('0x6b')]['xmd-phone'])){this[_0x3821('0x18')][_0x538856[_0x3821('0x34')]][_0x3821('0x59')]=_0x538856['value'];}else if(this[_0x3821('0x2f')](_0x538856[_0x3821('0x6b')][_0x3821('0x6d')])){this['channels'][_0x538856[_0x3821('0x34')]][_0x3821('0x6e')]=_0x538856[_0x3821('0x6f')];}else if(this[_0x3821('0x2f')](_0x538856[_0x3821('0x6b')][_0x3821('0x70')])){this[_0x3821('0x18')][_0x538856[_0x3821('0x34')]][_0x3821('0x71')]=_0x538856[_0x3821('0x6f')];}else if(this[_0x3821('0x2f')](_0x538856[_0x3821('0x6b')][_0x3821('0x72')])){this[_0x3821('0x18')][_0x538856[_0x3821('0x34')]][_0x3821('0x54')]=_0x538856[_0x3821('0x6f')][_0x3821('0x42')](',')[0x0];}else if(this[_0x3821('0x2f')](_0x538856[_0x3821('0x6b')]['xmd-originatecalleridnum'])){this[_0x3821('0x18')][_0x538856[_0x3821('0x34')]][_0x3821('0x73')]=_0x538856['value'];}else if(this[_0x3821('0x2f')](_0x538856[_0x3821('0x6b')][_0x3821('0x74')])){this['channels'][_0x538856[_0x3821('0x34')]][_0x3821('0x75')]=_0x538856[_0x3821('0x6f')];}else if(this['isNotNull'](_0x538856[_0x3821('0x6b')][_0x3821('0x76')])){this[_0x3821('0x18')][_0x538856[_0x3821('0x34')]][_0x3821('0x77')]=_0x538856[_0x3821('0x6f')];}else if(this[_0x3821('0x2f')](_0x538856['variable'][_0x3821('0x78')])){this[_0x3821('0x18')][_0x538856[_0x3821('0x34')]][_0x3821('0x54')]=_0x538856[_0x3821('0x6f')];}else if(this['isNotNull'](_0x538856['variable']['sipcallid'])){this['channels'][_0x538856[_0x3821('0x34')]]['sipcalluniqueid']=_0x538856['value'];}}}else if(this['isNotNull'](_0x538856[_0x3821('0x6b')][_0x3821('0x6c')])){if(_0x538856['value']){var _0x119c7a=path[_0x3821('0x79')](_0x538856['value'])[_0x3821('0x45')];this[_0x3821('0x62')](_0x119c7a,_0x538856[_0x3821('0x6f')]);}}else if(this[_0x3821('0x18')][_0x538856['linkedid']]){if(this['isNotNull'](_0x538856[_0x3821('0x6b')])){if(this[_0x3821('0x2f')](_0x538856['variable'][_0x3821('0x7a')])){this[_0x3821('0x18')][_0x538856[_0x3821('0x32')]][_0x3821('0x7b')]=_0x538856['value'];}}}}}catch(_0x3e29a0){logger['error'](_0x3821('0x7c'),util[_0x3821('0x46')](_0x3e29a0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3821('0x30')][_0x3821('0x7d')]=function(_0x2ff182){try{if(this[_0x3821('0x2f')](_0x2ff182)){if(this[_0x3821('0x18')][_0x2ff182[_0x3821('0x34')]]){var _0x4fae31=moment();this[_0x3821('0x18')][_0x2ff182[_0x3821('0x34')]]['endtime']=_0x4fae31[_0x3821('0x3b')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x2ff182[_0x3821('0x34')]][_0x3821('0x4c')]=_0x4fae31['diff'](this[_0x3821('0x18')][_0x2ff182[_0x3821('0x34')]][_0x3821('0x4b')],_0x3821('0x4d'));if(this[_0x3821('0x18')][_0x2ff182[_0x3821('0x34')]]['answered']){this[_0x3821('0x18')][_0x2ff182[_0x3821('0x34')]][_0x3821('0x7e')]=_0x4fae31[_0x3821('0x58')](this['channels'][_0x2ff182[_0x3821('0x34')]][_0x3821('0x56')],'seconds');this[_0x3821('0x18')][_0x2ff182[_0x3821('0x34')]][_0x3821('0x57')]=this['channels'][_0x2ff182[_0x3821('0x34')]]['duration']-this[_0x3821('0x18')][_0x2ff182[_0x3821('0x34')]][_0x3821('0x7e')];}if(_0x2ff182[_0x3821('0x40')]==='from-sip'){if(this[_0x3821('0x19')][_0x2ff182[_0x3821('0x39')][_0x3821('0x42')]('-')[0x0]]){this[_0x3821('0x19')][_0x2ff182[_0x3821('0x39')][_0x3821('0x42')]('-')[0x0]]=_[_0x3821('0x7f')](this[_0x3821('0x19')][_0x2ff182[_0x3821('0x39')]['split']('-')[0x0]],[_0x3821('0x43')]);this['emit'](util[_0x3821('0x3b')]('user:%s',this[_0x3821('0x19')][_0x2ff182[_0x3821('0x39')][_0x3821('0x42')]('-')[0x0]][_0x3821('0x45')]),_0x3821('0x80'),{'destaccountcode':this[_0x3821('0x19')][_0x2ff182[_0x3821('0x39')][_0x3821('0x42')]('-')[0x0]]['accountcode']});}}ami[_0x3821('0x31')](_0x3821('0x81'),this[_0x3821('0x18')][_0x2ff182[_0x3821('0x34')]]);delete this['channels'][_0x2ff182[_0x3821('0x34')]];}}}catch(_0x2ecbf3){logger[_0x3821('0x38')](_0x3821('0x82'),util[_0x3821('0x46')](_0x2ecbf3,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncAttendedTransfer']=function(_0x2239aa){try{if(this['isNotNull'](_0x2239aa)){if(this[_0x3821('0x18')][_0x2239aa[_0x3821('0x83')]]){this[_0x3821('0x18')][_0x2239aa[_0x3821('0x83')]][_0x3821('0x84')]=_0x2239aa[_0x3821('0x85')];this['channels'][_0x2239aa[_0x3821('0x83')]][_0x3821('0x86')]=_0x2239aa[_0x3821('0x87')];if(this[_0x3821('0x18')][_0x2239aa[_0x3821('0x88')]]){var _0x5a08d7=this[_0x3821('0x18')][_0x2239aa[_0x3821('0x88')]];this[_0x3821('0x18')][_0x2239aa['secondtransfereruniqueid']]=this['channels'][_0x2239aa[_0x3821('0x83')]];this[_0x3821('0x18')][_0x2239aa[_0x3821('0x83')]]=_0x5a08d7;}}else if(this[_0x3821('0x18')][_0x2239aa['transfertargetuniqueid']]){this['channels'][_0x2239aa[_0x3821('0x89')]][_0x3821('0x84')]=_0x2239aa[_0x3821('0x85')];this[_0x3821('0x18')][_0x2239aa[_0x3821('0x89')]][_0x3821('0x86')]=_0x2239aa['transfertargetcalleridnum'];if(this['channels'][_0x2239aa['origtransfereruniqueid']]){var _0x5a08d7=this[_0x3821('0x18')][_0x2239aa['origtransfereruniqueid']];this[_0x3821('0x18')][_0x2239aa[_0x3821('0x8a')]]=this['channels'][_0x2239aa[_0x3821('0x89')]];this['channels'][_0x2239aa[_0x3821('0x89')]]=_0x5a08d7;}}}}catch(_0x5c7058){logger[_0x3821('0x38')](_0x3821('0x8b'),util[_0x3821('0x46')](_0x5c7058,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3821('0x30')][_0x3821('0x8c')]=function(_0x2e6709){try{if(this['isNotNull'](_0x2e6709)){if(this[_0x3821('0x18')][_0x2e6709[_0x3821('0x83')]]){this['channels'][_0x2e6709[_0x3821('0x83')]][_0x3821('0x84')]=_0x2e6709[_0x3821('0x8d')];this[_0x3821('0x18')][_0x2e6709[_0x3821('0x83')]][_0x3821('0x86')]=_0x2e6709[_0x3821('0x8e')];this[_0x3821('0x7d')]({'event':_0x3821('0x8f'),'uniqueid':_0x2e6709['transfereeuniqueid'],'context':_0x2e6709[_0x3821('0x40')],'channel':_0x2e6709[_0x3821('0x90')]});}}}catch(_0x30095d){logger[_0x3821('0x38')](_0x3821('0x91'),util[_0x3821('0x46')](_0x30095d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3821('0x30')][_0x3821('0x27')]=function(_0x59a661){try{if(this['isNotNull'](_0x59a661)){if(this['channels'][_0x59a661[_0x3821('0x34')]]){if(!_[_0x3821('0x92')](this[_0x3821('0x18')][_0x59a661[_0x3821('0x34')]][_0x3821('0x56')])){this[_0x3821('0x18')][_0x59a661['uniqueid']][_0x3821('0x93')]=moment()[_0x3821('0x3b')](_0x3821('0x3c'));}}}}catch(_0x50a766){logger['error'](_0x3821('0x94'),util[_0x3821('0x46')](_0x50a766,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3821('0x30')][_0x3821('0x29')]=function(_0x69acae){try{if(this[_0x3821('0x2f')](_0x69acae)){if(this['channels'][_0x69acae[_0x3821('0x34')]]){if(!_[_0x3821('0x92')](this['channels'][_0x69acae[_0x3821('0x34')]][_0x3821('0x93')])){this['channels'][_0x69acae[_0x3821('0x34')]][_0x3821('0x95')]+=moment()[_0x3821('0x96')](0x0)[_0x3821('0x58')](this[_0x3821('0x18')][_0x69acae['uniqueid']][_0x3821('0x93')],_0x3821('0x4d'));delete this['channels'][_0x69acae['uniqueid']]['mohstarttime'];}}}}catch(_0x588761){logger[_0x3821('0x38')](_0x3821('0x97'),util[_0x3821('0x46')](_0x588761,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport;
\ No newline at end of file
+var _0x882c=['transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','transfereecalleridnum','extension','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','isNil','[syncMusicOnHoldStart][VoiceCallReport]','mohstarttime','mohtime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','exports','moment','../../../config/environment','ami','../ami','../model/channel','unknown','not_inuse','busy','invalid','unavailable','onhold','set','queue','dial','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','channels','agents','coreshowchannel','bind','newexten','syncNewExten','syncNewChannel','newstate','syncNewState','syncVarSet','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','resolve','then','catch','log','prototype','isNotNull','isUndefined','emit','syncNewCallerId','uniqueid','linkedid','merge','pick','keys','error','starttime','format','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','channel','split','destconnectedlinenum','user:%s','name','user:agentconnect','accountcode','[syncNewChannel][VoiceCallReport]','inspect','exten','toLowerCase','appdata','applicationdata','duration','subtract','seconds','includes','application','lastapplication','lastdata','startsWith','cdr(','match','[syncNewExten][VoiceCallReport]','answered','answertime','holdtime','diff','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','calleridname','destinationchannel','UserId','membername','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','endsWith','replace','.wav49','.WAV','monitorFilename','monitors','OutgoingSpoolFailed','variable','xmd-phone','xmd-callerid','value','type','xmd-originatecalleridnum','xmd-destination','xmd-callerid-preview','calleridpreview','sipcallid','mixmonitor_filename','[syncVarSet][VoiceCallReport]','endtime','billableseconds','context','from-sip','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transfertargetcalleridnum','secondtransfereruniqueid'];(function(_0x41030b,_0x55052c){var _0x20e5e9=function(_0x111587){while(--_0x111587){_0x41030b['push'](_0x41030b['shift']());}};_0x20e5e9(++_0x55052c);}(_0x882c,0xa0));var _0xc882=function(_0xd55444,_0x18220b){_0xd55444=_0xd55444-0x0;var _0x29dc54=_0x882c[_0xd55444];return _0x29dc54;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var moment=require(_0xc882('0x0'));var util=require('util');var path=require('path');var Redis=require('ioredis');var config=require(_0xc882('0x1'));var logger=require('../../../config/logger')(_0xc882('0x2'));var ami=require(_0xc882('0x3'));var Channel=require(_0xc882('0x4'));var statusDesc=[_0xc882('0x5'),_0xc882('0x6'),'inuse',_0xc882('0x7'),_0xc882('0x8'),_0xc882('0x9'),'ringing','ringinuse',_0xc882('0xa')];var applications=[_0xc882('0xb'),_0xc882('0xc'),'agi',_0xc882('0xd'),'playback','voicemail'];var dispositions=[_0xc882('0xe'),'FAILED',_0xc882('0xf'),_0xc882('0xe'),'NO\x20ANSWER',_0xc882('0xe'),_0xc882('0x10'),_0xc882('0x11'),'FAILED',_0xc882('0xf'),_0xc882('0xf')];var actions={};config[_0xc882('0x12')]=_[_0xc882('0x13')](config[_0xc882('0x12')],{'host':_0xc882('0x14'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc882('0x12')]));function VoiceCallReport(_0x2965c6){this[_0xc882('0x15')]=_0x2965c6['channels'];this[_0xc882('0x16')]=_0x2965c6[_0xc882('0x16')];ami['on'](_0xc882('0x17'),this['syncNewExten'][_0xc882('0x18')](this));ami['on'](_0xc882('0x19'),this[_0xc882('0x1a')][_0xc882('0x18')](this));ami['on']('newchannel',this[_0xc882('0x1b')]['bind'](this));ami['on'](_0xc882('0x1c'),this[_0xc882('0x1d')]['bind'](this));ami['on']('varset',this[_0xc882('0x1e')][_0xc882('0x18')](this));ami['on']('hangup',this[_0xc882('0x1f')]['bind'](this));ami['on'](_0xc882('0x20'),this['syncNewCallerId'][_0xc882('0x18')](this));ami['on'](_0xc882('0x21'),this[_0xc882('0x22')][_0xc882('0x18')](this));ami['on'](_0xc882('0x23'),this[_0xc882('0x24')]['bind'](this));ami['on'](_0xc882('0x25'),this[_0xc882('0x26')][_0xc882('0x18')](this));ami['on'](_0xc882('0x27'),this[_0xc882('0x28')][_0xc882('0x18')](this));return BPromise[_0xc882('0x29')]()[_0xc882('0x2a')](ami['actionCoreShowChannels']())[_0xc882('0x2b')](function(_0x2bf23b){console[_0xc882('0x2c')](_0x2bf23b);});}VoiceCallReport[_0xc882('0x2d')][_0xc882('0x2e')]=function(_0x2febbf){return _0x2febbf!==null&&!_[_0xc882('0x2f')](_0x2febbf);};VoiceCallReport[_0xc882('0x2d')][_0xc882('0x30')]=function(_0x5523a2,_0x34fbeb,_0x16dac8){io['to'](_0x5523a2)[_0xc882('0x30')](_0x34fbeb,_0x16dac8);};VoiceCallReport[_0xc882('0x2d')][_0xc882('0x31')]=function(_0x40a125){try{if(this[_0xc882('0x2e')](_0x40a125)){if(_0x40a125[_0xc882('0x32')]===_0x40a125[_0xc882('0x33')]){if(!_[_0xc882('0x2f')](this[_0xc882('0x15')][_0x40a125[_0xc882('0x32')]])){_[_0xc882('0x34')](this[_0xc882('0x15')][_0x40a125[_0xc882('0x32')]],_[_0xc882('0x35')](_0x40a125,_[_0xc882('0x36')](this[_0xc882('0x15')][_0x40a125[_0xc882('0x32')]])));}}}}catch(_0x864367){logger[_0xc882('0x37')]('[syncNewCallerId][VoiceCallReport]',util['inspect'](_0x864367,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewChannel']=function(_0x262714){try{if(this[_0xc882('0x2e')](_0x262714)){if(_0x262714['uniqueid']===_0x262714[_0xc882('0x33')]&&_0x262714['channel']!='OutgoingSpoolFailed'){if(_['isUndefined'](this[_0xc882('0x15')][_0x262714['uniqueid']])){this[_0xc882('0x15')][_0x262714[_0xc882('0x32')]]=new Channel();this[_0xc882('0x15')][_0x262714[_0xc882('0x32')]][_0xc882('0x38')]=moment()[_0xc882('0x39')](_0xc882('0x3a'));this[_0xc882('0x15')][_0x262714[_0xc882('0x32')]]['disposition']=dispositions[_[_0xc882('0x3b')](_0x262714[_0xc882('0x3c')])];_['merge'](this[_0xc882('0x15')][_0x262714['uniqueid']],_[_0xc882('0x35')](_0x262714,_[_0xc882('0x36')](this[_0xc882('0x15')][_0x262714[_0xc882('0x32')]])));if(_0x262714['context']==='from-sip'){if(this[_0xc882('0x16')][_0x262714[_0xc882('0x3d')][_0xc882('0x3e')]('-')[0x0]]){this['agents'][_0x262714[_0xc882('0x3d')][_0xc882('0x3e')]('-')[0x0]][_0xc882('0x3f')]=_0x262714['exten'];this['emit'](util[_0xc882('0x39')](_0xc882('0x40'),this[_0xc882('0x16')][_0x262714[_0xc882('0x3d')][_0xc882('0x3e')]('-')[0x0]][_0xc882('0x41')]),_0xc882('0x42'),{'destaccountcode':this[_0xc882('0x16')][_0x262714[_0xc882('0x3d')][_0xc882('0x3e')]('-')[0x0]][_0xc882('0x43')],'destconnectedlinenum':_0x262714['exten']});}}}}}}catch(_0x4e7635){logger[_0xc882('0x37')](_0xc882('0x44'),util[_0xc882('0x45')](_0x4e7635,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc882('0x2d')][_0xc882('0x1a')]=function(_0x313171){try{if(this[_0xc882('0x2e')](_0x313171)){if(_0x313171[_0xc882('0x32')]===_0x313171[_0xc882('0x33')]&&_0x313171[_0xc882('0x46')]!='h'&&_0x313171[_0xc882('0x3d')]!='OutgoingSpoolFailed'){_0x313171['application']=_0x313171['application'][_0xc882('0x47')]();_0x313171['applicationdata']=(_0x313171[_0xc882('0x48')]||_0x313171[_0xc882('0x49')])[_0xc882('0x47')]();if(_[_0xc882('0x2f')](this[_0xc882('0x15')][_0x313171[_0xc882('0x32')]])){this[_0xc882('0x15')][_0x313171['uniqueid']]=new Channel();this[_0xc882('0x15')][_0x313171[_0xc882('0x32')]][_0xc882('0x38')]=_0x313171[_0xc882('0x4a')]?moment()[_0xc882('0x4b')](moment['duration'](_0x313171[_0xc882('0x4a')])['seconds'](),_0xc882('0x4c'))[_0xc882('0x39')](_0xc882('0x3a')):moment()[_0xc882('0x39')](_0xc882('0x3a'));this[_0xc882('0x15')][_0x313171[_0xc882('0x32')]]['disposition']=_0xc882('0xe');}_[_0xc882('0x34')](this[_0xc882('0x15')][_0x313171['uniqueid']],_[_0xc882('0x35')](_0x313171,_['keys'](this[_0xc882('0x15')][_0x313171[_0xc882('0x32')]])));if(_[_0xc882('0x4d')](applications,_0x313171[_0xc882('0x4e')])){this[_0xc882('0x15')][_0x313171[_0xc882('0x32')]][_0xc882('0x4f')]=_0x313171['application'];this[_0xc882('0x15')][_0x313171[_0xc882('0x32')]][_0xc882('0x50')]=_0x313171[_0xc882('0x49')];if(_0x313171[_0xc882('0x4e')]===_0xc882('0xb')&&_[_0xc882('0x51')](_0x313171[_0xc882('0x49')],_0xc882('0x52'))){var _0x3802fa=_0x313171[_0xc882('0x49')]['split']('=');var _0x2a63bb=_0x3802fa[0x0][_0xc882('0x53')](/cdr\((.*)\)/);if(_0x2a63bb){this[_0xc882('0x15')][_0x313171[_0xc882('0x32')]][_0x2a63bb[0x1]]=_0x3802fa[0x1];}}else if(_0x313171['application']===_0xc882('0xc')){this['channels'][_0x313171['uniqueid']][_0xc882('0xc')]=_0x313171[_0xc882('0x49')]['split'](',')[0x0];}}}}}catch(_0x4bb75a){logger['error'](_0xc882('0x54'),util[_0xc882('0x45')](_0x4bb75a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc882('0x2d')][_0xc882('0x1d')]=function(_0x48a3c0){try{if(this[_0xc882('0x2e')](_0x48a3c0)){if(_0x48a3c0[_0xc882('0x32')]!==_0x48a3c0[_0xc882('0x33')]){if(this[_0xc882('0x15')][_0x48a3c0[_0xc882('0x33')]]){if(_0x48a3c0[_0xc882('0x3c')]==='6'){if(!this[_0xc882('0x15')][_0x48a3c0[_0xc882('0x33')]][_0xc882('0x55')]){var _0x1f8460=moment();this[_0xc882('0x15')][_0x48a3c0['linkedid']][_0xc882('0x55')]=!![];this[_0xc882('0x15')][_0x48a3c0[_0xc882('0x33')]][_0xc882('0x56')]=_0x1f8460[_0xc882('0x39')](_0xc882('0x3a'));if(this['channels'][_0x48a3c0[_0xc882('0x33')]][_0xc882('0x38')]){this[_0xc882('0x15')][_0x48a3c0['linkedid']][_0xc882('0x57')]=_0x1f8460[_0xc882('0x58')](this[_0xc882('0x15')][_0x48a3c0[_0xc882('0x33')]][_0xc882('0x38')],_0xc882('0x4c'));}}this['channels'][_0x48a3c0[_0xc882('0x33')]]['linkedid']=_0x48a3c0[_0xc882('0x32')];if(_0x48a3c0[_0xc882('0x59')]!==_0xc882('0x5a')){this[_0xc882('0x15')][_0x48a3c0[_0xc882('0x33')]][_0xc882('0x5b')]=_0x48a3c0[_0xc882('0x59')];}this[_0xc882('0x15')][_0x48a3c0[_0xc882('0x33')]][_0xc882('0x5c')]=_0x48a3c0[_0xc882('0x5d')];this['channels'][_0x48a3c0[_0xc882('0x33')]][_0xc882('0x5e')]=_0x48a3c0['channel'];this[_0xc882('0x15')][_0x48a3c0[_0xc882('0x33')]]['disposition']=dispositions[_['toNumber'](_0x48a3c0[_0xc882('0x3c')])];if(this[_0xc882('0x16')][_0x48a3c0[_0xc882('0x3d')][_0xc882('0x3e')]('-')[0x0]]){this[_0xc882('0x15')][_0x48a3c0[_0xc882('0x33')]][_0xc882('0x5f')]=this[_0xc882('0x16')][_0x48a3c0['channel']['split']('-')[0x0]]['id'];this['channels'][_0x48a3c0['linkedid']][_0xc882('0x60')]=this[_0xc882('0x16')][_0x48a3c0[_0xc882('0x3d')][_0xc882('0x3e')]('-')[0x0]][_0xc882('0x41')];}}}}else{if(this[_0xc882('0x15')][_0x48a3c0[_0xc882('0x32')]]){if(_0x48a3c0['channelstate']==='6'){if(this['agents'][_0x48a3c0[_0xc882('0x3d')]['split']('-')[0x0]]){this[_0xc882('0x15')][_0x48a3c0['uniqueid']][_0xc882('0x5f')]=this[_0xc882('0x16')][_0x48a3c0[_0xc882('0x3d')][_0xc882('0x3e')]('-')[0x0]]['id'];this['channels'][_0x48a3c0[_0xc882('0x32')]]['membername']=this[_0xc882('0x16')][_0x48a3c0[_0xc882('0x3d')]['split']('-')[0x0]][_0xc882('0x41')];}}}}}}catch(_0x18a1d7){logger['error'](_0xc882('0x61'),util[_0xc882('0x45')](_0x18a1d7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc882('0x2d')][_0xc882('0x62')]=function(_0x3692c2,_0x1c2a12){if(this[_0xc882('0x15')][_0x3692c2]){this['channels'][_0x3692c2][_0xc882('0x63')]=!![];if(_[_0xc882('0x64')](_0x1c2a12,'.wav49')){_0x1c2a12=_0x1c2a12[_0xc882('0x65')](_0xc882('0x66'),_0xc882('0x67'));}this['channels'][_0x3692c2][_0xc882('0x68')]=_0x1c2a12;var _0x57c337=_['find'](this[_0xc882('0x15')][_0x3692c2]['monitors'],{'filename':_0x1c2a12});if(_['isNil'](_0x57c337)){this[_0xc882('0x15')][_0x3692c2][_0xc882('0x69')]['push']({'filename':_0x1c2a12,'createdAt':moment()[_0xc882('0x39')](_0xc882('0x3a')),'mixmonitorid':'','status':'rec'});}}};VoiceCallReport[_0xc882('0x2d')][_0xc882('0x1e')]=function(_0xc6d31a){try{if(this[_0xc882('0x2e')](_0xc6d31a)){if(this[_0xc882('0x15')][_0xc6d31a[_0xc882('0x32')]]&&_0xc6d31a[_0xc882('0x3d')]!=_0xc882('0x6a')){if(this[_0xc882('0x2e')](_0xc6d31a[_0xc882('0x6b')])){if(this[_0xc882('0x2e')](_0xc6d31a['variable']['mixmonitor_filename'])){this[_0xc882('0x62')](_0xc6d31a['uniqueid'],_0xc6d31a['value']);}else if(this['isNotNull'](_0xc6d31a[_0xc882('0x6b')][_0xc882('0x6c')])){this['channels'][_0xc6d31a['uniqueid']]['calleridnum']=_0xc6d31a['value'];}else if(this[_0xc882('0x2e')](_0xc6d31a[_0xc882('0x6b')][_0xc882('0x6d')])){this['channels'][_0xc6d31a[_0xc882('0x32')]]['callerid']=_0xc6d31a[_0xc882('0x6e')];}else if(this[_0xc882('0x2e')](_0xc6d31a['variable']['xmd-cdrtype'])){this[_0xc882('0x15')][_0xc6d31a[_0xc882('0x32')]][_0xc882('0x6f')]=_0xc6d31a[_0xc882('0x6e')];}else if(this[_0xc882('0x2e')](_0xc6d31a[_0xc882('0x6b')]['xmd-queue'])){this[_0xc882('0x15')][_0xc6d31a[_0xc882('0x32')]][_0xc882('0xc')]=_0xc6d31a['value']['split'](',')[0x0];}else if(this[_0xc882('0x2e')](_0xc6d31a[_0xc882('0x6b')][_0xc882('0x70')])){this[_0xc882('0x15')][_0xc6d31a[_0xc882('0x32')]]['originatecalleridnum']=_0xc6d31a[_0xc882('0x6e')];}else if(this[_0xc882('0x2e')](_0xc6d31a[_0xc882('0x6b')][_0xc882('0x71')])){this['channels'][_0xc6d31a[_0xc882('0x32')]]['destination']=_0xc6d31a[_0xc882('0x6e')];}else if(this[_0xc882('0x2e')](_0xc6d31a['variable'][_0xc882('0x72')])){this[_0xc882('0x15')][_0xc6d31a[_0xc882('0x32')]][_0xc882('0x73')]=_0xc6d31a[_0xc882('0x6e')];}else if(this[_0xc882('0x2e')](_0xc6d31a[_0xc882('0x6b')]['xmcs-queue'])){this[_0xc882('0x15')][_0xc6d31a['uniqueid']][_0xc882('0xc')]=_0xc6d31a[_0xc882('0x6e')];}else if(this[_0xc882('0x2e')](_0xc6d31a[_0xc882('0x6b')][_0xc882('0x74')])){this[_0xc882('0x15')][_0xc6d31a[_0xc882('0x32')]]['sipcalluniqueid']=_0xc6d31a[_0xc882('0x6e')];}}}else if(this[_0xc882('0x2e')](_0xc6d31a[_0xc882('0x6b')][_0xc882('0x75')])){if(_0xc6d31a[_0xc882('0x6e')]){var _0x1df28c=path['parse'](_0xc6d31a[_0xc882('0x6e')])[_0xc882('0x41')];this[_0xc882('0x62')](_0x1df28c,_0xc6d31a['value']);}}else if(this[_0xc882('0x15')][_0xc6d31a[_0xc882('0x33')]]){if(this['isNotNull'](_0xc6d31a[_0xc882('0x6b')])){if(this[_0xc882('0x2e')](_0xc6d31a[_0xc882('0x6b')][_0xc882('0x74')])){this[_0xc882('0x15')][_0xc6d31a[_0xc882('0x33')]]['sipcalllinkedid']=_0xc6d31a[_0xc882('0x6e')];}}}}}catch(_0x1b8df0){logger[_0xc882('0x37')](_0xc882('0x76'),util[_0xc882('0x45')](_0x1b8df0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc882('0x2d')][_0xc882('0x1f')]=function(_0x253e9d){try{if(this['isNotNull'](_0x253e9d)){if(this[_0xc882('0x15')][_0x253e9d[_0xc882('0x32')]]){var _0xac6389=moment();this[_0xc882('0x15')][_0x253e9d[_0xc882('0x32')]][_0xc882('0x77')]=_0xac6389[_0xc882('0x39')](_0xc882('0x3a'));this['channels'][_0x253e9d['uniqueid']][_0xc882('0x4a')]=_0xac6389[_0xc882('0x58')](this[_0xc882('0x15')][_0x253e9d[_0xc882('0x32')]]['starttime'],_0xc882('0x4c'));if(this['channels'][_0x253e9d[_0xc882('0x32')]][_0xc882('0x55')]){this['channels'][_0x253e9d[_0xc882('0x32')]][_0xc882('0x78')]=_0xac6389[_0xc882('0x58')](this[_0xc882('0x15')][_0x253e9d[_0xc882('0x32')]]['answertime'],_0xc882('0x4c'));this[_0xc882('0x15')][_0x253e9d[_0xc882('0x32')]]['holdtime']=this[_0xc882('0x15')][_0x253e9d[_0xc882('0x32')]][_0xc882('0x4a')]-this['channels'][_0x253e9d[_0xc882('0x32')]][_0xc882('0x78')];}if(_0x253e9d[_0xc882('0x79')]===_0xc882('0x7a')){if(this[_0xc882('0x16')][_0x253e9d[_0xc882('0x3d')][_0xc882('0x3e')]('-')[0x0]]){this['agents'][_0x253e9d[_0xc882('0x3d')][_0xc882('0x3e')]('-')[0x0]]=_['omit'](this['agents'][_0x253e9d[_0xc882('0x3d')]['split']('-')[0x0]],[_0xc882('0x3f')]);this[_0xc882('0x30')](util[_0xc882('0x39')](_0xc882('0x40'),this['agents'][_0x253e9d[_0xc882('0x3d')][_0xc882('0x3e')]('-')[0x0]]['name']),'user:agentcomplete',{'destaccountcode':this[_0xc882('0x16')][_0x253e9d[_0xc882('0x3d')]['split']('-')[0x0]][_0xc882('0x43')]});}}ami['emit'](_0xc882('0x7b'),this['channels'][_0x253e9d[_0xc882('0x32')]]);delete this[_0xc882('0x15')][_0x253e9d['uniqueid']];}}}catch(_0x259420){logger[_0xc882('0x37')](_0xc882('0x7c'),util[_0xc882('0x45')](_0x259420,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc882('0x2d')]['syncAttendedTransfer']=function(_0x39142b){try{if(this[_0xc882('0x2e')](_0x39142b)){if(this[_0xc882('0x15')][_0x39142b['transfereeuniqueid']]){this[_0xc882('0x15')][_0x39142b[_0xc882('0x7d')]][_0xc882('0x7e')]=_0x39142b[_0xc882('0x7f')];this[_0xc882('0x15')][_0x39142b[_0xc882('0x7d')]]['transferconnectedlinenum']=_0x39142b[_0xc882('0x80')];if(this[_0xc882('0x15')][_0x39142b[_0xc882('0x81')]]){var _0x22ddfc=this[_0xc882('0x15')][_0x39142b[_0xc882('0x81')]];this['channels'][_0x39142b['secondtransfereruniqueid']]=this[_0xc882('0x15')][_0x39142b[_0xc882('0x7d')]];this[_0xc882('0x15')][_0x39142b['transfereeuniqueid']]=_0x22ddfc;}}else if(this[_0xc882('0x15')][_0x39142b[_0xc882('0x82')]]){this[_0xc882('0x15')][_0x39142b[_0xc882('0x82')]]['transfercalleridnum']=_0x39142b['origtransferercalleridnum'];this[_0xc882('0x15')][_0x39142b[_0xc882('0x82')]][_0xc882('0x83')]=_0x39142b[_0xc882('0x80')];if(this[_0xc882('0x15')][_0x39142b[_0xc882('0x84')]]){var _0x22ddfc=this[_0xc882('0x15')][_0x39142b['origtransfereruniqueid']];this['channels'][_0x39142b[_0xc882('0x84')]]=this[_0xc882('0x15')][_0x39142b[_0xc882('0x82')]];this[_0xc882('0x15')][_0x39142b[_0xc882('0x82')]]=_0x22ddfc;}}}}catch(_0x4b35a9){logger['error']('[syncAttendedTransfer][VoiceCallReport]',util[_0xc882('0x45')](_0x4b35a9,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncBlindTransfer']=function(_0x37ca7f){try{if(this[_0xc882('0x2e')](_0x37ca7f)){if(this[_0xc882('0x15')][_0x37ca7f['transfereeuniqueid']]){this['channels'][_0x37ca7f[_0xc882('0x7d')]][_0xc882('0x7e')]=_0x37ca7f[_0xc882('0x85')];this[_0xc882('0x15')][_0x37ca7f[_0xc882('0x7d')]][_0xc882('0x83')]=_0x37ca7f[_0xc882('0x86')];this[_0xc882('0x1f')]({'event':_0xc882('0x87'),'uniqueid':_0x37ca7f[_0xc882('0x7d')],'context':_0x37ca7f[_0xc882('0x79')],'channel':_0x37ca7f[_0xc882('0x88')]});}}}catch(_0x11b490){logger['error'](_0xc882('0x89'),util[_0xc882('0x45')](_0x11b490,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc882('0x2d')]['syncMusicOnHoldStart']=function(_0x214b09){try{if(this[_0xc882('0x2e')](_0x214b09)){if(this['channels'][_0x214b09[_0xc882('0x32')]]){if(!_[_0xc882('0x8a')](this[_0xc882('0x15')][_0x214b09[_0xc882('0x32')]]['answertime'])){this[_0xc882('0x15')][_0x214b09[_0xc882('0x32')]]['mohstarttime']=moment()[_0xc882('0x39')](_0xc882('0x3a'));}}}}catch(_0x51a2d3){logger['error'](_0xc882('0x8b'),util['inspect'](_0x51a2d3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc882('0x2d')]['syncMusicOnHoldStop']=function(_0x5af49c){try{if(this[_0xc882('0x2e')](_0x5af49c)){if(this[_0xc882('0x15')][_0x5af49c[_0xc882('0x32')]]){if(!_[_0xc882('0x8a')](this[_0xc882('0x15')][_0x5af49c[_0xc882('0x32')]][_0xc882('0x8c')])){this[_0xc882('0x15')][_0x5af49c[_0xc882('0x32')]][_0xc882('0x8d')]+=moment()[_0xc882('0x8e')](0x0)[_0xc882('0x58')](this[_0xc882('0x15')][_0x5af49c[_0xc882('0x32')]][_0xc882('0x8c')],'seconds');delete this['channels'][_0x5af49c['uniqueid']][_0xc882('0x8c')];}}}}catch(_0x4b9227){logger['error'](_0xc882('0x8f'),util[_0xc882('0x45')](_0x4b9227,{'showHidden':![],'depth':null}));}};module[_0xc882('0x90')]=VoiceCallReport;
\ No newline at end of file
index 27497d0..a1e14f0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd2ef=['connectedlinenum','connectedlinename','answertime','lastevent','connect','custom:dialconnect','[syncDialEnd][VoiceDialReport]','addVariable','keys','value','variable','outboundrouteid','inspect','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','endtime','diff','starttime','seconds','complete','total','billableseconds','sumHoldTime','holdtime','sumBillable','sumDuration','duration','custom:dialend','exports','lodash','moment','ioredis','../../../config/logger','ami','defaults','redis','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','syncDialBegin','bind','dialend','varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','substring','channel','lastIndexOf','omit','event','privilege','voice:outbound','voice_outbound_channel:save','uniqueid','error','[syncDialBegin][VoiceDialReport]','syncDialEnd','dialstatus','ANSWER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd2ef,0xdb));var _0xfd2e=function(_0x31583d,_0x171ff6){_0x31583d=_0x31583d-0x0;var _0x1a0223=_0xd2ef[_0x31583d];return _0x1a0223;};'use strict';var _=require(_0xfd2e('0x0'));var moment=require(_0xfd2e('0x1'));var util=require('util');var Redis=require(_0xfd2e('0x2'));var config=require('../../../config/environment');var logger=require(_0xfd2e('0x3'))(_0xfd2e('0x4'));var ami=require('../ami');config['redis']=_[_0xfd2e('0x5')](config[_0xfd2e('0x6')],{'host':_0xfd2e('0x7'),'port':0x18eb});var io=require(_0xfd2e('0x8'))(new Redis(config[_0xfd2e('0x6')]));function VoiceDialReport(_0x364dee){this[_0xfd2e('0x9')]=_0x364dee[_0xfd2e('0xa')];this[_0xfd2e('0xb')]=_0x364dee[_0xfd2e('0xb')];this[_0xfd2e('0xc')]={};ami['on']('dialbegin',this[_0xfd2e('0xd')][_0xfd2e('0xe')](this));ami['on'](_0xfd2e('0xf'),this['syncDialEnd'][_0xfd2e('0xe')](this));ami['on'](_0xfd2e('0x10'),this[_0xfd2e('0x11')][_0xfd2e('0xe')](this));ami['on'](_0xfd2e('0x12'),this[_0xfd2e('0x13')][_0xfd2e('0xe')](this));}VoiceDialReport[_0xfd2e('0x14')][_0xfd2e('0x15')]=function(_0x1a3570){return _0x1a3570!==null&&!_[_0xfd2e('0x16')](_0x1a3570);};VoiceDialReport['prototype']['emit']=function(_0x2f03f4,_0x1edc25,_0x13841d){io['to'](_0x2f03f4)[_0xfd2e('0x17')](_0x1edc25,_0x13841d);};VoiceDialReport['prototype'][_0xfd2e('0xd')]=function(_0x2251ab){try{if(this['isNotNull'](_0x2251ab)){if(this[_0xfd2e('0x9')][_0x2251ab['uniqueid']]){_[_0xfd2e('0x18')](this[_0xfd2e('0x9')][_0x2251ab['uniqueid']],{'starttime':moment()[_0xfd2e('0x19')](_0xfd2e('0x1a')),'lastevent':_0xfd2e('0x1b'),'interface':_0x2251ab['channel'][_0xfd2e('0x1c')](0x0,_0x2251ab[_0xfd2e('0x1d')]['lastIndexOf']('-')),'membername':_0x2251ab['channel'][_0xfd2e('0x1c')](_0x2251ab[_0xfd2e('0x1d')][_0xfd2e('0x1e')]('/')+0x1,_0x2251ab[_0xfd2e('0x1d')]['lastIndexOf']('-'))},_[_0xfd2e('0x1f')](_0x2251ab,[_0xfd2e('0x20'),_0xfd2e('0x21')]));this[_0xfd2e('0x17')](_0xfd2e('0x22'),_0xfd2e('0x23'),this[_0xfd2e('0x9')][_0x2251ab[_0xfd2e('0x24')]]);ami[_0xfd2e('0x17')]('custom:dialbegin',this[_0xfd2e('0x9')][_0x2251ab[_0xfd2e('0x24')]]);}}}catch(_0x16552){logger[_0xfd2e('0x25')](_0xfd2e('0x26'),util['inspect'](_0x16552,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xfd2e('0x14')][_0xfd2e('0x27')]=function(_0xabf762){try{if(this['isNotNull'](_0xabf762)){if(this[_0xfd2e('0x9')][_0xabf762['uniqueid']]){this[_0xfd2e('0x9')][_0xabf762['uniqueid']][_0xfd2e('0x28')]=_0xabf762[_0xfd2e('0x28')];if(_0xabf762['dialstatus']===_0xfd2e('0x29')){this[_0xfd2e('0x9')][_0xabf762[_0xfd2e('0x24')]][_0xfd2e('0x2a')]=_0xabf762['connectedlinenum'];this[_0xfd2e('0x9')][_0xabf762['uniqueid']][_0xfd2e('0x2b')]=_0xabf762['connectedlinename'];this[_0xfd2e('0x9')][_0xabf762[_0xfd2e('0x24')]][_0xfd2e('0x2c')]=moment()[_0xfd2e('0x19')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xfd2e('0x9')][_0xabf762[_0xfd2e('0x24')]][_0xfd2e('0x2d')]=_0xfd2e('0x2e');ami[_0xfd2e('0x17')](_0xfd2e('0x2f'),this[_0xfd2e('0x9')][_0xabf762[_0xfd2e('0x24')]]);}this['emit'](_0xfd2e('0x22'),_0xfd2e('0x23'),this[_0xfd2e('0x9')][_0xabf762[_0xfd2e('0x24')]]);}}}catch(_0x288bfb){logger[_0xfd2e('0x25')](_0xfd2e('0x30'),util['inspect'](_0x288bfb,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xfd2e('0x14')]['syncVarSet']=function(_0x5ec48c){try{if(this[_0xfd2e('0x15')](_0x5ec48c)){this[_0xfd2e('0x31')](_0x5ec48c['uniqueid'],_[_0xfd2e('0x32')](_0x5ec48c['variable'])[0x0],_0x5ec48c[_0xfd2e('0x33')]);if(this[_0xfd2e('0x15')](_0x5ec48c['variable'])&&this[_0xfd2e('0x15')](_0x5ec48c[_0xfd2e('0x34')][_0xfd2e('0x35')])){if(_[_0xfd2e('0x16')](this[_0xfd2e('0x9')][_0x5ec48c[_0xfd2e('0x24')]])){this['channels'][_0x5ec48c['uniqueid']]={'routeId':_0x5ec48c[_0xfd2e('0x33')],'variables':this[_0xfd2e('0xc')][_0x5ec48c[_0xfd2e('0x24')]]};this['emit'](_0xfd2e('0x22'),'voice_outbound_channel:save',this[_0xfd2e('0x9')][_0x5ec48c[_0xfd2e('0x24')]]);}}}}catch(_0xd0eda9){logger[_0xfd2e('0x25')]('[syncVarSet][VoiceDialReport]',util[_0xfd2e('0x36')](_0xd0eda9,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xfd2e('0x14')][_0xfd2e('0x31')]=function(_0x4b6fc0,_0x274182,_0x230407){var _0x135008=[_0xfd2e('0x37'),_0xfd2e('0x38'),_0xfd2e('0x39'),_0xfd2e('0x3a'),_0xfd2e('0x3b'),_0xfd2e('0x3c'),_0xfd2e('0x3d'),'rtpaudioqosrttbridged',_0xfd2e('0x3e'),_0xfd2e('0x3f'),'bridgepeer',_0xfd2e('0x40'),_0xfd2e('0x41'),_0xfd2e('0x42'),_0xfd2e('0x43'),_0xfd2e('0x44'),'membername',_0xfd2e('0x45'),_0xfd2e('0x46')];if(!_[_0xfd2e('0x47')](_0x274182)&&!_[_0xfd2e('0x48')](_0x135008,_0x274182)){if(_[_0xfd2e('0x16')](this[_0xfd2e('0xc')][_0x4b6fc0])){this[_0xfd2e('0xc')][_0x4b6fc0]={};}this[_0xfd2e('0xc')][_0x4b6fc0][_0x274182]=_0x230407;}};VoiceDialReport['prototype'][_0xfd2e('0x13')]=function(_0x2e27a4){try{if(this['isNotNull'](_0x2e27a4)){if(this['channels'][_0x2e27a4[_0xfd2e('0x24')]]){this['channels'][_0x2e27a4['uniqueid']][_0xfd2e('0x49')]=moment()['format'](_0xfd2e('0x1a'));this['channels'][_0x2e27a4[_0xfd2e('0x24')]]['duration']=moment(this[_0xfd2e('0x9')][_0x2e27a4['uniqueid']][_0xfd2e('0x49')])[_0xfd2e('0x4a')](this['channels'][_0x2e27a4[_0xfd2e('0x24')]][_0xfd2e('0x4b')],_0xfd2e('0x4c'));this[_0xfd2e('0x9')][_0x2e27a4['uniqueid']][_0xfd2e('0x2d')]=_0xfd2e('0x4d');this[_0xfd2e('0xb')][_0xfd2e('0x4e')]+=0x1;if(this['channels'][_0x2e27a4[_0xfd2e('0x24')]][_0xfd2e('0x2c')]){this['outbound']['answered']+=0x1;this[_0xfd2e('0x9')][_0x2e27a4[_0xfd2e('0x24')]]['holdtime']=moment(this['channels'][_0x2e27a4[_0xfd2e('0x24')]][_0xfd2e('0x2c')])[_0xfd2e('0x4a')](this[_0xfd2e('0x9')][_0x2e27a4[_0xfd2e('0x24')]][_0xfd2e('0x4b')],_0xfd2e('0x4c'));this['channels'][_0x2e27a4[_0xfd2e('0x24')]][_0xfd2e('0x4f')]=moment(this[_0xfd2e('0x9')][_0x2e27a4[_0xfd2e('0x24')]]['endtime'])[_0xfd2e('0x4a')](this[_0xfd2e('0x9')][_0x2e27a4[_0xfd2e('0x24')]]['answertime'],_0xfd2e('0x4c'));this[_0xfd2e('0xb')][_0xfd2e('0x50')]+=this[_0xfd2e('0x9')][_0x2e27a4['uniqueid']][_0xfd2e('0x51')]||0x0;this[_0xfd2e('0xb')][_0xfd2e('0x52')]+=this['channels'][_0x2e27a4['uniqueid']][_0xfd2e('0x4f')];}this[_0xfd2e('0xb')][_0xfd2e('0x53')]+=this[_0xfd2e('0x9')][_0x2e27a4[_0xfd2e('0x24')]][_0xfd2e('0x54')];ami[_0xfd2e('0x17')]('custom:voiceDialReport',this['channels'][_0x2e27a4[_0xfd2e('0x24')]]);ami[_0xfd2e('0x17')](_0xfd2e('0x55'),this[_0xfd2e('0x9')][_0x2e27a4['uniqueid']]);this[_0xfd2e('0x17')](_0xfd2e('0x22'),'voice_outbound:save',this[_0xfd2e('0xb')]);this[_0xfd2e('0x17')](_0xfd2e('0x22'),'voice_outbound_channel:remove',this['channels'][_0x2e27a4[_0xfd2e('0x24')]]);delete this[_0xfd2e('0x9')][_0x2e27a4['uniqueid']];}if(this[_0xfd2e('0xc')][_0x2e27a4['uniqueid']]){delete this[_0xfd2e('0xc')][_0x2e27a4[_0xfd2e('0x24')]];}}}catch(_0x1646f7){logger[_0xfd2e('0x25')]('[syncHangup][VoiceDialReport]',util['inspect'](_0x1646f7,{'showHidden':![],'depth':null}));}};module[_0xfd2e('0x56')]=VoiceDialReport;
\ No newline at end of file
+var _0xb077=['connectedlinename','answertime','lastevent','connect','error','[syncDialEnd][VoiceDialReport]','variable','value','isUndefined','[syncVarSet][VoiceDialReport]','addVariable','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','membername','memberrealtime','isNil','includes','endtime','duration','diff','seconds','total','answered','holdtime','starttime','sumHoldTime','sumBillable','billableseconds','custom:voiceDialReport','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','syncVarSet','hangup','syncHangup','prototype','isNotNull','emit','merge','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','privilege','voice:outbound','voice_outbound_channel:save','custom:dialbegin','inspect','dialstatus','ANSWER','connectedlinenum'];(function(_0xdad237,_0x361a1d){var _0x15c575=function(_0x8db2f6){while(--_0x8db2f6){_0xdad237['push'](_0xdad237['shift']());}};_0x15c575(++_0x361a1d);}(_0xb077,0x170));var _0x7b07=function(_0x5bebac,_0x4eae8e){_0x5bebac=_0x5bebac-0x0;var _0x4175f2=_0xb077[_0x5bebac];return _0x4175f2;};'use strict';var _=require('lodash');var moment=require(_0x7b07('0x0'));var util=require(_0x7b07('0x1'));var Redis=require(_0x7b07('0x2'));var config=require(_0x7b07('0x3'));var logger=require(_0x7b07('0x4'))(_0x7b07('0x5'));var ami=require(_0x7b07('0x6'));config[_0x7b07('0x7')]=_[_0x7b07('0x8')](config[_0x7b07('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x7b07('0x9'))(new Redis(config['redis']));function VoiceDialReport(_0x40705e){this[_0x7b07('0xa')]=_0x40705e[_0x7b07('0xb')];this['outbound']=_0x40705e[_0x7b07('0xc')];this[_0x7b07('0xd')]={};ami['on'](_0x7b07('0xe'),this[_0x7b07('0xf')][_0x7b07('0x10')](this));ami['on'](_0x7b07('0x11'),this[_0x7b07('0x12')]['bind'](this));ami['on']('varset',this[_0x7b07('0x13')]['bind'](this));ami['on'](_0x7b07('0x14'),this[_0x7b07('0x15')][_0x7b07('0x10')](this));}VoiceDialReport[_0x7b07('0x16')][_0x7b07('0x17')]=function(_0x4012f7){return _0x4012f7!==null&&!_['isUndefined'](_0x4012f7);};VoiceDialReport[_0x7b07('0x16')]['emit']=function(_0x3dd31a,_0x2e7e61,_0x3b5d80){io['to'](_0x3dd31a)[_0x7b07('0x18')](_0x2e7e61,_0x3b5d80);};VoiceDialReport[_0x7b07('0x16')][_0x7b07('0xf')]=function(_0x552a0a){try{if(this[_0x7b07('0x17')](_0x552a0a)){if(this[_0x7b07('0xa')][_0x552a0a['uniqueid']]){_[_0x7b07('0x19')](this[_0x7b07('0xa')][_0x552a0a[_0x7b07('0x1a')]],{'starttime':moment()[_0x7b07('0x1b')](_0x7b07('0x1c')),'lastevent':_0x7b07('0x1d'),'interface':_0x552a0a[_0x7b07('0x1e')][_0x7b07('0x1f')](0x0,_0x552a0a[_0x7b07('0x1e')][_0x7b07('0x20')]('-')),'membername':_0x552a0a[_0x7b07('0x1e')][_0x7b07('0x1f')](_0x552a0a[_0x7b07('0x1e')][_0x7b07('0x20')]('/')+0x1,_0x552a0a[_0x7b07('0x1e')][_0x7b07('0x20')]('-'))},_[_0x7b07('0x21')](_0x552a0a,['event',_0x7b07('0x22')]));this[_0x7b07('0x18')](_0x7b07('0x23'),_0x7b07('0x24'),this[_0x7b07('0xa')][_0x552a0a[_0x7b07('0x1a')]]);ami[_0x7b07('0x18')](_0x7b07('0x25'),this['channels'][_0x552a0a['uniqueid']]);}}}catch(_0x3f320d){logger['error']('[syncDialBegin][VoiceDialReport]',util[_0x7b07('0x26')](_0x3f320d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7b07('0x16')][_0x7b07('0x12')]=function(_0x9d6f24){try{if(this[_0x7b07('0x17')](_0x9d6f24)){if(this[_0x7b07('0xa')][_0x9d6f24[_0x7b07('0x1a')]]){this['channels'][_0x9d6f24[_0x7b07('0x1a')]][_0x7b07('0x27')]=_0x9d6f24[_0x7b07('0x27')];if(_0x9d6f24['dialstatus']===_0x7b07('0x28')){this['channels'][_0x9d6f24[_0x7b07('0x1a')]][_0x7b07('0x29')]=_0x9d6f24[_0x7b07('0x29')];this[_0x7b07('0xa')][_0x9d6f24[_0x7b07('0x1a')]]['connectedlinename']=_0x9d6f24[_0x7b07('0x2a')];this[_0x7b07('0xa')][_0x9d6f24[_0x7b07('0x1a')]][_0x7b07('0x2b')]=moment()[_0x7b07('0x1b')](_0x7b07('0x1c'));this['channels'][_0x9d6f24[_0x7b07('0x1a')]][_0x7b07('0x2c')]=_0x7b07('0x2d');ami[_0x7b07('0x18')]('custom:dialconnect',this[_0x7b07('0xa')][_0x9d6f24[_0x7b07('0x1a')]]);}this[_0x7b07('0x18')](_0x7b07('0x23'),_0x7b07('0x24'),this[_0x7b07('0xa')][_0x9d6f24[_0x7b07('0x1a')]]);}}}catch(_0x237077){logger[_0x7b07('0x2e')](_0x7b07('0x2f'),util['inspect'](_0x237077,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7b07('0x16')]['syncVarSet']=function(_0x7005c8){try{if(this[_0x7b07('0x17')](_0x7005c8)){this['addVariable'](_0x7005c8[_0x7b07('0x1a')],_['keys'](_0x7005c8[_0x7b07('0x30')])[0x0],_0x7005c8[_0x7b07('0x31')]);if(this[_0x7b07('0x17')](_0x7005c8['variable'])&&this['isNotNull'](_0x7005c8[_0x7b07('0x30')]['outboundrouteid'])){if(_[_0x7b07('0x32')](this['channels'][_0x7005c8[_0x7b07('0x1a')]])){this[_0x7b07('0xa')][_0x7005c8['uniqueid']]={'routeId':_0x7005c8[_0x7b07('0x31')],'variables':this[_0x7b07('0xd')][_0x7005c8['uniqueid']]};this[_0x7b07('0x18')]('voice:outbound',_0x7b07('0x24'),this['channels'][_0x7005c8[_0x7b07('0x1a')]]);}}}}catch(_0x2fd3c){logger[_0x7b07('0x2e')](_0x7b07('0x33'),util[_0x7b07('0x26')](_0x2fd3c,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7b07('0x16')][_0x7b07('0x34')]=function(_0x4604e3,_0x49fe6b,_0x3c447d){var _0x865fb9=['rtpaudioqos',_0x7b07('0x35'),'rtpaudioqosjitter',_0x7b07('0x36'),_0x7b07('0x37'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0x7b07('0x38'),_0x7b07('0x39'),_0x7b07('0x3a'),_0x7b07('0x3b'),_0x7b07('0x3c'),_0x7b07('0x3d'),'memberdynamic',_0x7b07('0x3e'),'memberlastcall',_0x7b07('0x3f'),'memberpenalty',_0x7b07('0x40')];if(!_[_0x7b07('0x41')](_0x49fe6b)&&!_[_0x7b07('0x42')](_0x865fb9,_0x49fe6b)){if(_[_0x7b07('0x32')](this[_0x7b07('0xd')][_0x4604e3])){this['variables'][_0x4604e3]={};}this[_0x7b07('0xd')][_0x4604e3][_0x49fe6b]=_0x3c447d;}};VoiceDialReport[_0x7b07('0x16')][_0x7b07('0x15')]=function(_0x219233){try{if(this[_0x7b07('0x17')](_0x219233)){if(this[_0x7b07('0xa')][_0x219233['uniqueid']]){this[_0x7b07('0xa')][_0x219233['uniqueid']][_0x7b07('0x43')]=moment()[_0x7b07('0x1b')](_0x7b07('0x1c'));this[_0x7b07('0xa')][_0x219233[_0x7b07('0x1a')]][_0x7b07('0x44')]=moment(this['channels'][_0x219233[_0x7b07('0x1a')]]['endtime'])[_0x7b07('0x45')](this[_0x7b07('0xa')][_0x219233[_0x7b07('0x1a')]]['starttime'],_0x7b07('0x46'));this['channels'][_0x219233[_0x7b07('0x1a')]][_0x7b07('0x2c')]='complete';this[_0x7b07('0xc')][_0x7b07('0x47')]+=0x1;if(this['channels'][_0x219233['uniqueid']][_0x7b07('0x2b')]){this[_0x7b07('0xc')][_0x7b07('0x48')]+=0x1;this[_0x7b07('0xa')][_0x219233['uniqueid']][_0x7b07('0x49')]=moment(this[_0x7b07('0xa')][_0x219233[_0x7b07('0x1a')]]['answertime'])[_0x7b07('0x45')](this['channels'][_0x219233[_0x7b07('0x1a')]][_0x7b07('0x4a')],_0x7b07('0x46'));this[_0x7b07('0xa')][_0x219233['uniqueid']]['billableseconds']=moment(this['channels'][_0x219233[_0x7b07('0x1a')]][_0x7b07('0x43')])[_0x7b07('0x45')](this['channels'][_0x219233[_0x7b07('0x1a')]]['answertime'],_0x7b07('0x46'));this[_0x7b07('0xc')][_0x7b07('0x4b')]+=this[_0x7b07('0xa')][_0x219233['uniqueid']][_0x7b07('0x49')]||0x0;this[_0x7b07('0xc')][_0x7b07('0x4c')]+=this[_0x7b07('0xa')][_0x219233[_0x7b07('0x1a')]][_0x7b07('0x4d')];}this[_0x7b07('0xc')]['sumDuration']+=this[_0x7b07('0xa')][_0x219233['uniqueid']][_0x7b07('0x44')];ami[_0x7b07('0x18')](_0x7b07('0x4e'),this[_0x7b07('0xa')][_0x219233[_0x7b07('0x1a')]]);ami[_0x7b07('0x18')]('custom:dialend',this[_0x7b07('0xa')][_0x219233[_0x7b07('0x1a')]]);this[_0x7b07('0x18')](_0x7b07('0x23'),'voice_outbound:save',this[_0x7b07('0xc')]);this[_0x7b07('0x18')](_0x7b07('0x23'),_0x7b07('0x4f'),this[_0x7b07('0xa')][_0x219233[_0x7b07('0x1a')]]);delete this[_0x7b07('0xa')][_0x219233['uniqueid']];}if(this[_0x7b07('0xd')][_0x219233[_0x7b07('0x1a')]]){delete this[_0x7b07('0xd')][_0x219233[_0x7b07('0x1a')]];}}}catch(_0x2874c2){logger['error'](_0x7b07('0x50'),util[_0x7b07('0x26')](_0x2874c2,{'showHidden':![],'depth':null}));}};module[_0x7b07('0x51')]=VoiceDialReport;
\ No newline at end of file
index 5913051..ac401c6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdcc4=['mohtime','[syncMusicOnHoldStop][VoiceQueueReport]','exports','lodash','moment','bluebird','util','ioredis','../../../config/environment','../ami','../model/queueReport','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','sequence','queueReports','agents','queueChannels','voiceQueues','flagQueueSummary','variables','queuesummary','syncQueueSummary','bind','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueShow','isUndefined','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','unlockRR','prototype','channels','switch','isNil','Action','status','message','No\x20such\x20channel','error','[voiceQueueReport][checkQueueReport]','[voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','campaigns','inspect','emit','emitVoiceQueueChannelSave','name','voice_queue_channel:save','emitVoiceQueueChannelRemove','format','voice:queue:%s','voice_queue_channel:remove','strategy','available','loggedIn','sumBillable','sumHoldTime','total','unmanaged','abandoned','Trunk','active','callerid','Interval','stringify','md5','queues','catch','[queues]','loopQueueSummary','then','[queuesummary]','isNotNull','countBy','queue','callers','toNumber','loggedin','emitVoiceQueueSummary','custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','syncNewExten','uniqueid','type','inbound','queuecallerjoinAt','count','merge','pick','keys','push','[syncQueueCallerJoin][VoiceQueueReport]','syncQueueCallerAbandon','last','queuecallercomplete','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','ABANDONED','lastAssignedTo','queuecallerleaveAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinenum','connectedlinename','[syncAgentConnect][VoiceQueueReport]','assigned','membername','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','startsWith','toLowerCase','local/','linkedid','add','seconds','FORWARDTRANSFER','transfertype','transferexten','destexten','transferuniqueid','COMPLETEDBY','toUpperCase','[syncAgentComplete][VoiceQueueReport]','syncVarSet','addVariable','variable','value','queuestatus','CONTINUE','EXITWITHKEY','[syncVarSet][VoiceQueueReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','length','diff','sumDuration','milliseconds','answered','queuecallercompleteAt','lastevent','custom:queuecallerunmanaged','custom:queuecallerabandon','custom:voiceQueueReport','[syncHangup][VoiceQueueReport]','transfereeuniqueid','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','ATTENDEDTRANSFER','[syncAttendedTransfer][VoiceQueueReport]','BLINDTRANSFER','extension','context','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','[syncMusicOnHoldStart][VoiceQueueReport]','mohstarttime'];(function(_0x1eb585,_0x202476){var _0x497ee2=function(_0x36dffa){while(--_0x36dffa){_0x1eb585['push'](_0x1eb585['shift']());}};_0x497ee2(++_0x202476);}(_0xdcc4,0x1a3));var _0x4dcc=function(_0x2019ac,_0x32933c){_0x2019ac=_0x2019ac-0x0;var _0x3def0a=_0xdcc4[_0x2019ac];return _0x3def0a;};'use strict';var _=require(_0x4dcc('0x0'));var moment=require(_0x4dcc('0x1'));var BPromise=require(_0x4dcc('0x2'));var util=require(_0x4dcc('0x3'));var md5=require('md5');var Redis=require(_0x4dcc('0x4'));var config=require(_0x4dcc('0x5'));var logger=require('../../../config/logger')('ami');var ami=require(_0x4dcc('0x6'));var QueueReport=require(_0x4dcc('0x7'));config[_0x4dcc('0x8')]=_[_0x4dcc('0x9')](config[_0x4dcc('0x8')],{'host':_0x4dcc('0xa'),'port':0x18eb});var io=require(_0x4dcc('0xb'))(new Redis(config[_0x4dcc('0x8')]));var Sequence=function(){};Sequence['prototype'][_0x4dcc('0xc')]=function(_0x473887){this['tail']=this[_0x4dcc('0xd')]?this['tail'][_0x4dcc('0xe')](_0x473887):_0x473887();};function VoiceQueueReport(_0x379b7a){this[_0x4dcc('0xf')]=new Sequence();this[_0x4dcc('0x10')]={};this[_0x4dcc('0x11')]=_0x379b7a[_0x4dcc('0x11')];this['channels']=_0x379b7a[_0x4dcc('0x12')];this[_0x4dcc('0x13')]=_0x379b7a[_0x4dcc('0x13')];this[_0x4dcc('0x14')]=!![];this['campaigns']=_0x379b7a['campaigns'];this[_0x4dcc('0x15')]={};ami['on'](_0x4dcc('0x16'),this[_0x4dcc('0x17')][_0x4dcc('0x18')](this));ami['on']('queuesummarycomplete',this[_0x4dcc('0x19')]['bind'](this));ami['on'](_0x4dcc('0x1a'),this[_0x4dcc('0x1b')]['bind'](this));ami['on'](_0x4dcc('0x1c'),this['syncQueueCallerAbandon'][_0x4dcc('0x18')](this));ami['on']('queuecallerleave',this[_0x4dcc('0x1d')][_0x4dcc('0x18')](this));ami['on'](_0x4dcc('0x1e'),this[_0x4dcc('0x1f')][_0x4dcc('0x18')](this));ami['on'](_0x4dcc('0x20'),this[_0x4dcc('0x21')][_0x4dcc('0x18')](this));ami['on'](_0x4dcc('0x22'),this['syncVarSet']['bind'](this));ami['on'](_0x4dcc('0x23'),this[_0x4dcc('0x24')][_0x4dcc('0x18')](this));ami['on'](_0x4dcc('0x25'),this[_0x4dcc('0x26')][_0x4dcc('0x18')](this));ami['on'](_0x4dcc('0x27'),this[_0x4dcc('0x28')][_0x4dcc('0x18')](this));ami['on'](_0x4dcc('0x29'),this[_0x4dcc('0x2a')]['bind'](this));ami['on'](_0x4dcc('0x2b'),this[_0x4dcc('0x2c')]['bind'](this));ami['on'](_0x4dcc('0x2d'),this[_0x4dcc('0x2e')]['bind'](this));this['loopQueueSummary']();this[_0x4dcc('0x2f')]();}function isNotNull(_0x50f5fd){return _0x50f5fd!==null&&!_[_0x4dcc('0x30')](_0x50f5fd);}function clearChannels(_0x3f8f41){if(!_[_0x4dcc('0x31')](_0x3f8f41)){for(var _0x3da160 in _0x3f8f41){if(_0x3f8f41[_0x4dcc('0x32')](_0x3da160)){delete _0x3f8f41[_0x3da160];}}}}function clearCampaigns(_0x14c3f0){if(!_[_0x4dcc('0x31')](_0x14c3f0)){for(var _0x47a717 in _0x14c3f0){if(_0x14c3f0['hasOwnProperty'](_0x47a717)){_0x14c3f0[_0x47a717][_0x4dcc('0x33')]=0x0;}}}}function clearVoiceQueues(_0x523d7a){if(!_['isEmpty'](_0x523d7a)){for(var _0x2a0cc4 in _0x523d7a){if(_0x523d7a[_0x4dcc('0x32')](_0x2a0cc4)){_0x523d7a[_0x2a0cc4][_0x4dcc('0x33')]=0x0;_0x523d7a[_0x2a0cc4][_0x4dcc('0x34')]=0x0;_0x523d7a[_0x2a0cc4][_0x4dcc('0x35')]=0x0;_0x523d7a[_0x2a0cc4][_0x4dcc('0x36')]=0x0;_0x523d7a[_0x2a0cc4]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x34f6f5){if(!_[_0x4dcc('0x31')](_0x34f6f5)){for(var _0x202956 in _0x34f6f5){if(_0x34f6f5['hasOwnProperty'](_0x202956)){_0x34f6f5[_0x202956][_0x4dcc('0x37')]=!![];}}}}VoiceQueueReport[_0x4dcc('0x38')]['clearZombieChannels']=function(){var _0x45a451=this;for(var _0x28e83a in this[_0x4dcc('0x39')]){if(this[_0x4dcc('0x39')][_0x4dcc('0x32')](_0x28e83a)&&!this['channels'][_0x28e83a][_0x4dcc('0x3a')]){this[_0x4dcc('0xf')][_0x4dcc('0xc')](function(){if(!_[_0x4dcc('0x3b')](_0x45a451[_0x4dcc('0x39')][_0x28e83a])){return ami[_0x4dcc('0x3c')]({'action':_0x4dcc('0x3d'),'channel':_0x45a451[_0x4dcc('0x39')][_0x28e83a]['channel']})['catch'](function(_0x6caecd){if(_0x6caecd[_0x4dcc('0x3e')]===_0x4dcc('0x3f')){setTimeout(function(){if(_0x45a451['channels'][_0x28e83a]){delete _0x45a451[_0x4dcc('0x39')][_0x28e83a];logger[_0x4dcc('0x40')]('[voiceQueueReport][checkChannel]',_0x28e83a);}if(_0x45a451['queueReports'][_0x28e83a]){delete _0x45a451['queueReports'][_0x28e83a];logger['error'](_0x4dcc('0x41'),_0x28e83a);}if(_0x45a451['variables'][_0x28e83a]){delete _0x45a451[_0x4dcc('0x15')][_0x28e83a];logger[_0x4dcc('0x40')](_0x4dcc('0x42'),_0x28e83a);}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0x4dcc('0x26')]=function(){logger['error'](_0x4dcc('0x43'));clearChannels(this[_0x4dcc('0x39')]);this[_0x4dcc('0x44')](this['queueReports']);clearAgentBooked(this[_0x4dcc('0x11')]);clearVoiceQueues(this[_0x4dcc('0x13')]);clearCampaigns(this[_0x4dcc('0x45')]);};VoiceQueueReport['prototype'][_0x4dcc('0x44')]=function(_0x539640){var _0x31b911=this;if(!_[_0x4dcc('0x31')](_0x539640)){for(var _0x272c53 in _0x539640){if(_0x539640[_0x4dcc('0x32')](_0x272c53)){_0x31b911['emitVoiceQueueChannelRemove'](_0x539640[_0x272c53]);delete _0x539640[_0x272c53];}}}};function loggerCatch(_0x595d53){return function(_0x1abfeb){logger[_0x4dcc('0x40')](_0x595d53,util[_0x4dcc('0x46')](_0x1abfeb,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0x4dcc('0x38')][_0x4dcc('0x47')]=function(_0x3bd458,_0xf3e99b,_0x134f76){io['to'](_0x3bd458)[_0x4dcc('0x47')](_0xf3e99b,_0x134f76);};VoiceQueueReport[_0x4dcc('0x38')][_0x4dcc('0x48')]=function(_0x24db97){this[_0x4dcc('0x47')](util['format']('voice:queue:%s',_0x24db97[_0x4dcc('0x49')]),_0x4dcc('0x4a'),_0x24db97);};VoiceQueueReport[_0x4dcc('0x38')][_0x4dcc('0x4b')]=function(_0x106e9d){this['emit'](util[_0x4dcc('0x4c')](_0x4dcc('0x4d'),_0x106e9d[_0x4dcc('0x49')]),_0x4dcc('0x4e'),_0x106e9d);};VoiceQueueReport['prototype']['emitVoiceQueueSummary']=function(_0x1a40aa){if(_0x1a40aa['type']==='inbound'){var _0x1dc889={'id':_0x1a40aa['id'],'name':_0x1a40aa[_0x4dcc('0x49')],'strategy':_0x1a40aa[_0x4dcc('0x4f')],'answered':_0x1a40aa['answered'],'available':_0x1a40aa[_0x4dcc('0x50')],'loggedIn':_0x1a40aa[_0x4dcc('0x51')],'pTalking':_0x1a40aa[_0x4dcc('0x35')],'sumBillable':_0x1a40aa[_0x4dcc('0x52')],'sumDuration':_0x1a40aa['sumDuration'],'sumHoldTime':_0x1a40aa[_0x4dcc('0x53')]||0x0,'talking':_0x1a40aa[_0x4dcc('0x34')],'total':_0x1a40aa[_0x4dcc('0x54')],'type':_0x1a40aa['type'],'unmanaged':_0x1a40aa[_0x4dcc('0x55')],'abandoned':_0x1a40aa[_0x4dcc('0x56')],'waiting':_0x1a40aa[_0x4dcc('0x36')]};if(_0x1a40aa[_0x4dcc('0x57')]){_0x1dc889[_0x4dcc('0x57')]={'id':_0x1a40aa[_0x4dcc('0x57')]['id'],'name':_0x1a40aa[_0x4dcc('0x57')][_0x4dcc('0x49')],'active':_0x1a40aa[_0x4dcc('0x57')][_0x4dcc('0x58')],'callerid':_0x1a40aa['Trunk'][_0x4dcc('0x59')]};}if(_0x1a40aa[_0x4dcc('0x5a')]){_0x1dc889['Interval']={'id':_0x1a40aa['Interval']['id'],'name':_0x1a40aa[_0x4dcc('0x5a')][_0x4dcc('0x49')]};}var _0x50ba12=md5(JSON[_0x4dcc('0x5b')](_0x1dc889));if(_0x1a40aa[_0x4dcc('0x5c')]!==_0x50ba12){_0x1a40aa[_0x4dcc('0x5c')]=_0x50ba12;this[_0x4dcc('0x47')](util[_0x4dcc('0x4c')](_0x4dcc('0x4d'),_0x1dc889[_0x4dcc('0x49')]),'voice_queue:save',_0x1dc889);}}};VoiceQueueReport['prototype']['isNotNull']=function(_0x9c1f78){return _0x9c1f78!==null&&!_[_0x4dcc('0x30')](_0x9c1f78);};VoiceQueueReport[_0x4dcc('0x38')][_0x4dcc('0x2f')]=function(){var _0x4c33cc=this;setInterval(function(){_0x4c33cc['clearZombieChannels']();ami[_0x4dcc('0x3c')]({'action':_0x4dcc('0x5d')})[_0x4dcc('0x5e')](loggerCatch(_0x4dcc('0x5f')));},0x2710);};VoiceQueueReport[_0x4dcc('0x38')][_0x4dcc('0x60')]=function(){var _0x14a9ad=this;setInterval(function(){if(_0x14a9ad[_0x4dcc('0x14')]){return ami[_0x4dcc('0x3c')]({'action':'queuesummary'})[_0x4dcc('0x61')](function(_0x4451b7){_0x14a9ad['flagQueueSummary']=![];})[_0x4dcc('0x5e')](loggerCatch(_0x4dcc('0x62')));}},0x3e8);};VoiceQueueReport['prototype'][_0x4dcc('0x17')]=function(_0x526a38){try{if(this[_0x4dcc('0x63')](_0x526a38)&&this[_0x4dcc('0x63')](_0x526a38['queue'])){if(this[_0x4dcc('0x13')][_0x526a38['queue']]){var _0x56e0c8=_[_0x4dcc('0x64')](this[_0x4dcc('0x39')],'queue')[_0x526a38[_0x4dcc('0x65')]]||0x0;var _0x4a4309=_0x56e0c8-_0x526a38[_0x4dcc('0x66')];if(this[_0x4dcc('0x13')][_0x526a38[_0x4dcc('0x65')]][_0x4dcc('0x36')]!==_['toNumber'](_0x526a38[_0x4dcc('0x66')])||this[_0x4dcc('0x13')][_0x526a38[_0x4dcc('0x65')]][_0x4dcc('0x51')]!==_[_0x4dcc('0x67')](_0x526a38[_0x4dcc('0x68')])||this[_0x4dcc('0x13')][_0x526a38['queue']][_0x4dcc('0x50')]!==_[_0x4dcc('0x67')](_0x526a38[_0x4dcc('0x50')])||this[_0x4dcc('0x13')][_0x526a38[_0x4dcc('0x65')]][_0x4dcc('0x34')]!==_0x4a4309){this[_0x4dcc('0x13')][_0x526a38['queue']][_0x4dcc('0x36')]=_['toNumber'](_0x526a38[_0x4dcc('0x66')]);this[_0x4dcc('0x13')][_0x526a38['queue']]['loggedIn']=_[_0x4dcc('0x67')](_0x526a38['loggedin']);this[_0x4dcc('0x13')][_0x526a38[_0x4dcc('0x65')]][_0x4dcc('0x50')]=_[_0x4dcc('0x67')](_0x526a38[_0x4dcc('0x50')]);this['voiceQueues'][_0x526a38[_0x4dcc('0x65')]][_0x4dcc('0x34')]=_0x4a4309>0x0?_0x4a4309:0x0;this[_0x4dcc('0x13')][_0x526a38['queue']][_0x4dcc('0x34')]=this[_0x4dcc('0x13')][_0x526a38[_0x4dcc('0x65')]][_0x4dcc('0x34')]>_['toNumber'](_0x526a38[_0x4dcc('0x68')])?_[_0x4dcc('0x67')](_0x526a38['loggedin']):this['voiceQueues'][_0x526a38['queue']][_0x4dcc('0x34')];this[_0x4dcc('0x69')](this[_0x4dcc('0x13')][_0x526a38['queue']]);}ami[_0x4dcc('0x47')](_0x4dcc('0x6a'),this[_0x4dcc('0x13')][_0x526a38[_0x4dcc('0x65')]]);}}}catch(_0x2835ed){logger[_0x4dcc('0x40')](_0x4dcc('0x6b'),util[_0x4dcc('0x46')](_0x2835ed,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4dcc('0x38')]['syncQueueSummaryComplete']=function(_0xb00246){this[_0x4dcc('0x14')]=!![];};VoiceQueueReport[_0x4dcc('0x38')][_0x4dcc('0x6c')]=function(_0x4a0d65){};VoiceQueueReport[_0x4dcc('0x38')][_0x4dcc('0x1b')]=function(_0x4cf163){try{if(this[_0x4dcc('0x63')](_0x4cf163)){if(_[_0x4dcc('0x30')](this['queueReports'][_0x4cf163[_0x4dcc('0x6d')]])){this[_0x4dcc('0x10')][_0x4cf163[_0x4dcc('0x6d')]]=[];this[_0x4dcc('0x39')][_0x4cf163[_0x4dcc('0x6d')]]={};}var _0x581460=new QueueReport();_0x581460['name']=_0x4cf163['queue'];_0x581460[_0x4dcc('0x6e')]=this[_0x4dcc('0x13')][_0x581460[_0x4dcc('0x49')]]&&this[_0x4dcc('0x13')][_0x581460['name']][_0x4dcc('0x6e')]?this[_0x4dcc('0x13')][_0x581460[_0x4dcc('0x49')]]['type']||_0x4dcc('0x6f'):_0x4dcc('0x6f');_0x581460[_0x4dcc('0x65')]=_0x4cf163[_0x4dcc('0x65')];_0x581460[_0x4dcc('0x70')]=moment()[_0x4dcc('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x581460['position']=_0x4cf163['position'];_0x581460[_0x4dcc('0x71')]=_0x4cf163[_0x4dcc('0x71')];_[_0x4dcc('0x72')](_0x581460,_[_0x4dcc('0x73')](_0x4cf163,_[_0x4dcc('0x74')](_0x581460)));this[_0x4dcc('0x10')][_0x4cf163[_0x4dcc('0x6d')]][_0x4dcc('0x75')](_0x581460);this[_0x4dcc('0x39')][_0x4cf163[_0x4dcc('0x6d')]]=_0x581460;this['emitVoiceQueueChannelSave'](_0x581460);}}catch(_0x167abe){logger[_0x4dcc('0x40')](_0x4dcc('0x76'),util['inspect'](_0x167abe,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4dcc('0x38')][_0x4dcc('0x77')]=function(_0x511b29){try{if(this['isNotNull'](_0x511b29)){if(this['queueReports'][_0x511b29['uniqueid']]){var _0xab5ddd=_[_0x4dcc('0x78')](this['queueReports'][_0x511b29[_0x4dcc('0x6d')]]);_0xab5ddd[_0x4dcc('0x79')]=![];_0xab5ddd['queuecallercompleteAt']=null;_0xab5ddd[_0x4dcc('0x7a')]=_0x511b29[_0x4dcc('0x7a')];_0xab5ddd['originalposition']=_0x511b29[_0x4dcc('0x7b')];_0xab5ddd[_0x4dcc('0x1c')]=!![];_0xab5ddd[_0x4dcc('0x7c')]=moment()[_0x4dcc('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0xab5ddd[_0x4dcc('0x7d')]=_0x4dcc('0x7e');_0xab5ddd[_0x4dcc('0x7f')]=null;this[_0x4dcc('0x39')][_0x511b29['uniqueid']]=_0xab5ddd;this[_0x4dcc('0x4b')](_0xab5ddd);}}}catch(_0x2cf1bb){logger[_0x4dcc('0x40')]('[syncQueueCallerAbandon][VoiceQueueReport]',util[_0x4dcc('0x46')](_0x2cf1bb,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x4dcc('0x1d')]=function(_0x58358e){try{if(this[_0x4dcc('0x63')](_0x58358e)){if(this[_0x4dcc('0x10')][_0x58358e['uniqueid']]){var _0x5c7dc1=_[_0x4dcc('0x78')](this[_0x4dcc('0x10')][_0x58358e[_0x4dcc('0x6d')]]);_0x5c7dc1[_0x4dcc('0x80')]=moment()[_0x4dcc('0x4c')](_0x4dcc('0x81'));_0x5c7dc1[_0x4dcc('0x82')]=_0x58358e['connectedlinenum'];_0x5c7dc1[_0x4dcc('0x83')]=_0x58358e[_0x4dcc('0x83')];this['channels'][_0x58358e[_0x4dcc('0x6d')]]=_0x5c7dc1;this['emitVoiceQueueChannelSave'](_0x5c7dc1);}}}catch(_0x305582){logger[_0x4dcc('0x40')]('[syncQueueCallerLeave][VoiceQueueReport]',util[_0x4dcc('0x46')](_0x305582,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4dcc('0x38')][_0x4dcc('0x21')]=function(_0x30e805){try{if(this['isNotNull'](_0x30e805)){if(this[_0x4dcc('0x10')][_0x30e805['uniqueid']]){var _0x3350e8=_[_0x4dcc('0x78')](this[_0x4dcc('0x10')][_0x30e805[_0x4dcc('0x6d')]]);_0x3350e8[_0x4dcc('0x79')]=!![];_0x3350e8[_0x4dcc('0x7d')]='COMPLETEDBYAGENT';}}}catch(_0x3747fc){logger['error'](_0x4dcc('0x84'),util[_0x4dcc('0x46')](_0x3747fc,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x4dcc('0x1f')]=function(_0x51c55e){try{if(this[_0x4dcc('0x63')](_0x51c55e)){if(this[_0x4dcc('0x10')][_0x51c55e[_0x4dcc('0x6d')]]){var _0x19bc15=_['last'](this[_0x4dcc('0x10')][_0x51c55e[_0x4dcc('0x6d')]]);_0x19bc15[_0x4dcc('0x1c')]=![];_0x19bc15['queuecallerabandonAt']=null;_0x19bc15[_0x4dcc('0x85')]=!![];_0x19bc15[_0x4dcc('0x7f')]=_0x51c55e[_0x4dcc('0x86')];_0x19bc15['holdtime']=_0x51c55e['holdtime'];_0x19bc15[_0x4dcc('0x79')]=!![];_0x19bc15[_0x4dcc('0x87')]=![];_0x19bc15[_0x4dcc('0x88')]=null;if(!_0x19bc15[_0x4dcc('0x89')]){if(_0x51c55e[_0x4dcc('0x8a')]==_0x4dcc('0x89')){_0x19bc15['queuecallerexitreason']=_0x4dcc('0x8b');}else{if(_[_0x4dcc('0x8c')](_0x51c55e['channel'][_0x4dcc('0x8d')](),_0x4dcc('0x8e'))){if(this['queueReports'][_0x51c55e[_0x4dcc('0x8f')]]){var _0x5767e7=_[_0x4dcc('0x78')](this[_0x4dcc('0x10')][_0x51c55e['linkedid']]);_0x5767e7[_0x4dcc('0x79')]=![];_0x5767e7['queuecallerexit']=!![];_0x5767e7[_0x4dcc('0x88')]=moment(_0x19bc15[_0x4dcc('0x70')])[_0x4dcc('0x90')](_0x51c55e[_0x4dcc('0x7a')],_0x4dcc('0x91'))[_0x4dcc('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x5767e7['queuecallerexitreason']=_0x4dcc('0x92');_0x5767e7[_0x4dcc('0x89')]=!![];_0x5767e7[_0x4dcc('0x93')]='FORWARD';_0x5767e7[_0x4dcc('0x94')]=_0x51c55e[_0x4dcc('0x95')];_0x5767e7[_0x4dcc('0x96')]=_0x51c55e[_0x4dcc('0x6d')];var _0x4f8401=this[_0x4dcc('0x10')][_0x51c55e['linkedid']];this[_0x4dcc('0x10')][_0x51c55e[_0x4dcc('0x8f')]]=this[_0x4dcc('0x10')][_0x51c55e[_0x4dcc('0x6d')]];this[_0x4dcc('0x10')][_0x51c55e['uniqueid']]=_0x4f8401;}}else{_0x19bc15[_0x4dcc('0x7d')]=_0x4dcc('0x97')+_0x51c55e[_0x4dcc('0x8a')][_0x4dcc('0x98')]();}}}this[_0x4dcc('0x39')][_0x51c55e[_0x4dcc('0x6d')]]=_0x19bc15;this[_0x4dcc('0x4b')](_0x19bc15);}}}catch(_0x17d540){logger[_0x4dcc('0x40')](_0x4dcc('0x99'),util[_0x4dcc('0x46')](_0x17d540,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4dcc('0x38')][_0x4dcc('0x9a')]=function(_0x3c580d){try{if(this[_0x4dcc('0x63')](_0x3c580d)){this[_0x4dcc('0x9b')](_0x3c580d[_0x4dcc('0x6d')],_[_0x4dcc('0x74')](_0x3c580d[_0x4dcc('0x9c')])[0x0],_0x3c580d[_0x4dcc('0x9d')]);if(this[_0x4dcc('0x10')][_0x3c580d['uniqueid']]){var _0x522d9f=_[_0x4dcc('0x78')](this[_0x4dcc('0x10')][_0x3c580d[_0x4dcc('0x6d')]]);if(_0x522d9f){if(this[_0x4dcc('0x63')](_0x3c580d['variable'])&&this[_0x4dcc('0x63')](_0x3c580d[_0x4dcc('0x9c')][_0x4dcc('0x9e')])){switch(_0x3c580d[_0x4dcc('0x9d')]){case _0x4dcc('0x9f'):_0x522d9f['queuecallerexit']=![];_0x522d9f[_0x4dcc('0x88')]=null;break;default:_0x522d9f['queuecallerexit']=!![];_0x522d9f[_0x4dcc('0x88')]=moment()['format'](_0x4dcc('0x81'));_0x522d9f[_0x4dcc('0x80')]=moment()[_0x4dcc('0x4c')](_0x4dcc('0x81'));}_0x522d9f[_0x4dcc('0x1c')]=![];_0x522d9f[_0x4dcc('0x7c')]=null;_0x522d9f[_0x4dcc('0x7d')]=_0x3c580d['value'];this[_0x4dcc('0x39')][_0x3c580d[_0x4dcc('0x6d')]]=_0x522d9f;this[_0x4dcc('0x4b')](_0x522d9f);}else if(this[_0x4dcc('0x63')](_0x3c580d['variable'])&&this['isNotNull'](_0x3c580d['variable']['queueposition'])){if(!_0x522d9f['queuecallerabandon']){_0x522d9f[_0x4dcc('0x87')]=!![];_0x522d9f[_0x4dcc('0x88')]=moment()['format'](_0x4dcc('0x81'));_0x522d9f[_0x4dcc('0x7d')]=_0x4dcc('0xa0');_0x522d9f[_0x4dcc('0x80')]=moment()[_0x4dcc('0x4c')](_0x4dcc('0x81'));this[_0x4dcc('0x39')][_0x3c580d[_0x4dcc('0x6d')]]=_0x522d9f;}}_0x522d9f[_0x4dcc('0x15')]=this[_0x4dcc('0x15')][_0x3c580d[_0x4dcc('0x6d')]];}}}}catch(_0x182060){logger[_0x4dcc('0x40')](_0x4dcc('0xa1'),util['inspect'](_0x182060,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4dcc('0x38')][_0x4dcc('0x9b')]=function(_0x2dd2b8,_0x3c7a8a,_0x362f4d){var _0x4a23a8=[_0x4dcc('0xa2'),_0x4dcc('0xa3'),_0x4dcc('0xa4'),_0x4dcc('0xa5'),_0x4dcc('0xa6'),_0x4dcc('0xa7'),_0x4dcc('0xa8'),_0x4dcc('0xa9'),_0x4dcc('0xaa'),_0x4dcc('0xab'),_0x4dcc('0xac'),_0x4dcc('0xad'),_0x4dcc('0xae'),'memberdynamic',_0x4dcc('0xaf'),_0x4dcc('0xb0'),_0x4dcc('0x86'),_0x4dcc('0xb1'),_0x4dcc('0xb2')];if(!_[_0x4dcc('0x3b')](_0x3c7a8a)&&!_[_0x4dcc('0xb3')](_0x4a23a8,_0x3c7a8a)){if(_[_0x4dcc('0x30')](this['variables'][_0x2dd2b8])){this[_0x4dcc('0x15')][_0x2dd2b8]={};}this[_0x4dcc('0x15')][_0x2dd2b8][_0x3c7a8a]=_0x362f4d;}};VoiceQueueReport['prototype'][_0x4dcc('0x24')]=function(_0x25af2d){try{if(this['isNotNull'](_0x25af2d)){if(this[_0x4dcc('0x10')][_0x25af2d[_0x4dcc('0x6d')]]){for(var _0xe20283=0x0,_0x4d4341={};_0xe20283<this[_0x4dcc('0x10')][_0x25af2d['uniqueid']][_0x4dcc('0xb4')];_0xe20283+=0x1){_0x4d4341=this[_0x4dcc('0x10')][_0x25af2d[_0x4dcc('0x6d')]][_0xe20283];if(this['voiceQueues'][_0x4d4341[_0x4dcc('0x65')]]){if(_0x4d4341[_0x4dcc('0x87')]){this[_0x4dcc('0x13')][_0x4d4341[_0x4dcc('0x65')]][_0x4dcc('0x55')]+=0x1;}if(_0x4d4341[_0x4dcc('0x1c')]){this['voiceQueues'][_0x4d4341['queue']][_0x4dcc('0x56')]+=0x1;}this['voiceQueues'][_0x4d4341[_0x4dcc('0x65')]][_0x4dcc('0x53')]+=moment(_0x4d4341[_0x4dcc('0x80')])[_0x4dcc('0xb5')](_0x4d4341[_0x4dcc('0x70')],'seconds')||0x0;if(_0xe20283===this[_0x4dcc('0x10')][_0x25af2d[_0x4dcc('0x6d')]][_0x4dcc('0xb4')]-0x1){this[_0x4dcc('0x13')][_0x4d4341[_0x4dcc('0x65')]][_0x4dcc('0xb6')]+=moment()[_0x4dcc('0xb7')](0x0)[_0x4dcc('0xb5')](_0x4d4341[_0x4dcc('0x70')],_0x4dcc('0x91'));this[_0x4dcc('0x13')][_0x4d4341[_0x4dcc('0x65')]][_0x4dcc('0x54')]+=0x1;if(_0x4d4341[_0x4dcc('0x79')]){this[_0x4dcc('0x13')][_0x4d4341[_0x4dcc('0x65')]][_0x4dcc('0xb8')]+=0x1;this['voiceQueues'][_0x4d4341[_0x4dcc('0x65')]][_0x4dcc('0x52')]+=moment()['milliseconds'](0x0)[_0x4dcc('0xb5')](_0x4d4341['queuecallerleaveAt'],_0x4dcc('0x91'));_0x4d4341[_0x4dcc('0xb9')]=moment()[_0x4dcc('0x4c')](_0x4dcc('0x81'));_0x4d4341['queuecallerexit']=![];_0x4d4341['queuecallerexitAt']=null;}if(_0x4d4341[_0x4dcc('0x87')]){_0x4d4341[_0x4dcc('0xba')]='unmanaged';ami['emit'](_0x4dcc('0xbb'),_0x4d4341);}if(_0x4d4341['queuecallerabandon']){_0x4d4341[_0x4dcc('0xba')]=_0x4dcc('0x56');ami[_0x4dcc('0x47')](_0x4dcc('0xbc'),_0x4d4341);}}else{this[_0x4dcc('0x13')][_0x4d4341[_0x4dcc('0x65')]][_0x4dcc('0xb6')]+=this[_0x4dcc('0x13')][_0x4d4341[_0x4dcc('0x65')]]['sumHoldTime'];}this[_0x4dcc('0x39')][_0x25af2d[_0x4dcc('0x6d')]]=_0x4d4341;this['emitVoiceQueueChannelRemove'](_0x4d4341);this[_0x4dcc('0x69')](this[_0x4dcc('0x13')][_0x4d4341[_0x4dcc('0x65')]]);}}ami[_0x4dcc('0x47')](_0x4dcc('0xbd'),this['queueReports'][_0x25af2d[_0x4dcc('0x6d')]]);delete this['queueReports'][_0x25af2d[_0x4dcc('0x6d')]];delete this[_0x4dcc('0x39')][_0x25af2d[_0x4dcc('0x6d')]];}if(this[_0x4dcc('0x15')][_0x25af2d['uniqueid']]){delete this[_0x4dcc('0x15')][_0x25af2d['uniqueid']];}}}catch(_0x3eaf71){logger[_0x4dcc('0x40')](_0x4dcc('0xbe'),util[_0x4dcc('0x46')](_0x3eaf71,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4dcc('0x38')][_0x4dcc('0x2c')]=function(_0x1ac0fe){try{if(this['isNotNull'](_0x1ac0fe)){var _0x222eb8;if(this[_0x4dcc('0x10')][_0x1ac0fe[_0x4dcc('0xbf')]]){_0x222eb8=_[_0x4dcc('0x78')](this['queueReports'][_0x1ac0fe[_0x4dcc('0xbf')]]);_0x222eb8[_0x4dcc('0x94')]=_0x1ac0fe['secondtransfererexten'];_0x222eb8['transferuniqueid']=_0x1ac0fe[_0x4dcc('0xc0')];_0x222eb8[_0x4dcc('0x7d')]='ATTENDEDTRANSFER';_0x222eb8['transfer']=!![];_0x222eb8[_0x4dcc('0x93')]=_0x4dcc('0xc1');if(this['queueReports'][_0x1ac0fe['secondtransfereruniqueid']]){var _0x364dc2=this[_0x4dcc('0x10')][_0x1ac0fe[_0x4dcc('0xc0')]];this[_0x4dcc('0x10')][_0x1ac0fe[_0x4dcc('0xc0')]]=this[_0x4dcc('0x10')][_0x1ac0fe[_0x4dcc('0xbf')]];this[_0x4dcc('0x10')][_0x1ac0fe[_0x4dcc('0xbf')]]=_0x364dc2;var _0x2d0c97=_[_0x4dcc('0x78')](this[_0x4dcc('0x10')][_0x1ac0fe[_0x4dcc('0xbf')]]);_0x2d0c97['switch']=!![];}}else if(this[_0x4dcc('0x10')][_0x1ac0fe[_0x4dcc('0xc2')]]){_0x222eb8=_[_0x4dcc('0x78')](this[_0x4dcc('0x10')][_0x1ac0fe[_0x4dcc('0xc2')]]);_0x222eb8[_0x4dcc('0x94')]=_0x1ac0fe['origtransfererexten'];_0x222eb8[_0x4dcc('0x96')]=_0x1ac0fe[_0x4dcc('0xc3')];_0x222eb8[_0x4dcc('0x7d')]=_0x4dcc('0xc4');_0x222eb8[_0x4dcc('0x89')]=!![];_0x222eb8[_0x4dcc('0x93')]=_0x4dcc('0xc1');if(this['queueReports'][_0x1ac0fe[_0x4dcc('0xc3')]]){var _0x364dc2=this['queueReports'][_0x1ac0fe[_0x4dcc('0xc3')]];this[_0x4dcc('0x10')][_0x1ac0fe[_0x4dcc('0xc3')]]=this[_0x4dcc('0x10')][_0x1ac0fe['transfertargetuniqueid']];this[_0x4dcc('0x10')][_0x1ac0fe[_0x4dcc('0xc2')]]=_0x364dc2;var _0x2d0c97=_[_0x4dcc('0x78')](this[_0x4dcc('0x10')][_0x1ac0fe['transfertargetuniqueid']]);_0x2d0c97[_0x4dcc('0x3a')]=!![];}}}}catch(_0x243dfa){logger['error'](_0x4dcc('0xc5'),util[_0x4dcc('0x46')](_0x243dfa,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4dcc('0x38')][_0x4dcc('0x2e')]=function(_0x1b622c){try{if(this[_0x4dcc('0x63')](_0x1b622c)){if(this[_0x4dcc('0x10')][_0x1b622c[_0x4dcc('0xbf')]]){var _0x20dfd1=_[_0x4dcc('0x78')](this[_0x4dcc('0x10')][_0x1b622c[_0x4dcc('0xbf')]]);_0x20dfd1[_0x4dcc('0x7d')]=_0x4dcc('0xc6');_0x20dfd1['transfer']=!![];_0x20dfd1[_0x4dcc('0x93')]='BLIND';_0x20dfd1['transferexten']=_0x1b622c[_0x4dcc('0xc7')];_0x20dfd1[_0x4dcc('0x96')]=_0x1b622c[_0x4dcc('0xbf')];this[_0x4dcc('0x24')]({'event':'BlindTransfer','uniqueid':_0x1b622c[_0x4dcc('0xbf')],'context':_0x1b622c[_0x4dcc('0xc8')],'channel':_0x1b622c[_0x4dcc('0xc9')]});}}}catch(_0x4a6f49){logger[_0x4dcc('0x40')](_0x4dcc('0xca'),util[_0x4dcc('0x46')](_0x4a6f49,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4dcc('0x38')][_0x4dcc('0x28')]=function(_0x493311){try{if(this[_0x4dcc('0x63')](_0x493311)){if(this[_0x4dcc('0x10')][_0x493311['uniqueid']]){var _0x65e64f=_[_0x4dcc('0x78')](this['queueReports'][_0x493311[_0x4dcc('0x6d')]]);if(!_[_0x4dcc('0x3b')](_0x65e64f['queuecallerleaveAt'])){_0x65e64f['mohstarttime']=moment()[_0x4dcc('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');}}}}catch(_0x255702){logger[_0x4dcc('0x40')](_0x4dcc('0xcb'),util[_0x4dcc('0x46')](_0x255702,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x4dcc('0x2a')]=function(_0x3ba9d8){try{if(this[_0x4dcc('0x63')](_0x3ba9d8)){if(this[_0x4dcc('0x10')][_0x3ba9d8[_0x4dcc('0x6d')]]){var _0x37e55b=_[_0x4dcc('0x78')](this[_0x4dcc('0x10')][_0x3ba9d8[_0x4dcc('0x6d')]]);if(!_[_0x4dcc('0x3b')](_0x37e55b[_0x4dcc('0xcc')])){_0x37e55b[_0x4dcc('0xcd')]+=moment()[_0x4dcc('0xb7')](0x0)[_0x4dcc('0xb5')](_0x37e55b[_0x4dcc('0xcc')],_0x4dcc('0x91'));delete _0x37e55b['mohstarttime'];}}}}catch(_0x54d5e3){logger[_0x4dcc('0x40')](_0x4dcc('0xce'),util[_0x4dcc('0x46')](_0x54d5e3,{'showHidden':![],'depth':null}));}};module[_0x4dcc('0xcf')]=VoiceQueueReport;
\ No newline at end of file
+var _0x97f7=['syncQueueCallerAbandon','queuecallerleave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isUndefined','isEmpty','hasOwnProperty','pTalking','unlockRR','clearZombieChannels','channels','switch','Action','channel','catch','message','error','[voiceQueueReport][checkChannel]','queueReports','[voiceQueueReport][checkQueueReport]','[voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','emitVoiceQueueChannelRemove','inspect','emit','emitVoiceQueueChannelSave','format','voice:queue:%s','name','voice_queue_channel:remove','emitVoiceQueueSummary','type','inbound','strategy','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','waiting','Trunk','active','Interval','voice_queue:save','queues','[queues]','then','isNotNull','queue','callers','toNumber','loggedin','custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','uniqueid','position','count','merge','pick','keys','push','[syncQueueCallerJoin][VoiceQueueReport]','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandon','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitreason','ABANDONED','[syncQueueCallerAbandon][VoiceQueueReport]','queuecallerleaveAt','connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','COMPLETEDBYAGENT','assigned','lastAssignedTo','membername','queuecallerexit','queuecallerexitAt','transfer','COMPLETED','startsWith','toLowerCase','local/','queuecallerjoinAt','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','transferuniqueid','linkedid','reason','[syncAgentComplete][VoiceQueueReport]','addVariable','variable','queuestatus','CONTINUE','value','queueposition','[syncVarSet][VoiceQueueReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','isNil','includes','abandoned','diff','seconds','length','total','answered','milliseconds','custom:queuecallerunmanaged','custom:queuecallerabandon','[syncHangup][VoiceQueueReport]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','transfertargetuniqueid','origtransfererexten','ATTENDED','origtransfereruniqueid','BLINDTRANSFER','extension','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','mohstarttime','exports','lodash','moment','bluebird','util','md5','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','prototype','enqueue','tail','finally','sequence','agents','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin'];(function(_0x76c9d0,_0x133c1e){var _0x755691=function(_0x5652bf){while(--_0x5652bf){_0x76c9d0['push'](_0x76c9d0['shift']());}};_0x755691(++_0x133c1e);}(_0x97f7,0x160));var _0x797f=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x97f7[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0x797f('0x0'));var moment=require(_0x797f('0x1'));var BPromise=require(_0x797f('0x2'));var util=require(_0x797f('0x3'));var md5=require(_0x797f('0x4'));var Redis=require('ioredis');var config=require(_0x797f('0x5'));var logger=require(_0x797f('0x6'))(_0x797f('0x7'));var ami=require(_0x797f('0x8'));var QueueReport=require('../model/queueReport');config['redis']=_['defaults'](config[_0x797f('0x9')],{'host':_0x797f('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x797f('0x9')]));var Sequence=function(){};Sequence[_0x797f('0xb')][_0x797f('0xc')]=function(_0x542397){this[_0x797f('0xd')]=this['tail']?this[_0x797f('0xd')][_0x797f('0xe')](_0x542397):_0x542397();};function VoiceQueueReport(_0x5bc1fc){this[_0x797f('0xf')]=new Sequence();this['queueReports']={};this['agents']=_0x5bc1fc[_0x797f('0x10')];this['channels']=_0x5bc1fc['queueChannels'];this['voiceQueues']=_0x5bc1fc[_0x797f('0x11')];this[_0x797f('0x12')]=!![];this[_0x797f('0x13')]=_0x5bc1fc[_0x797f('0x13')];this[_0x797f('0x14')]={};ami['on'](_0x797f('0x15'),this[_0x797f('0x16')][_0x797f('0x17')](this));ami['on'](_0x797f('0x18'),this[_0x797f('0x19')][_0x797f('0x17')](this));ami['on'](_0x797f('0x1a'),this[_0x797f('0x1b')]['bind'](this));ami['on']('queuecallerabandon',this[_0x797f('0x1c')][_0x797f('0x17')](this));ami['on'](_0x797f('0x1d'),this['syncQueueCallerLeave'][_0x797f('0x17')](this));ami['on'](_0x797f('0x1e'),this[_0x797f('0x1f')][_0x797f('0x17')](this));ami['on'](_0x797f('0x20'),this[_0x797f('0x21')]['bind'](this));ami['on'](_0x797f('0x22'),this[_0x797f('0x23')][_0x797f('0x17')](this));ami['on'](_0x797f('0x24'),this[_0x797f('0x25')][_0x797f('0x17')](this));ami['on'](_0x797f('0x26'),this['syncFullyBooted']['bind'](this));ami['on'](_0x797f('0x27'),this[_0x797f('0x28')]['bind'](this));ami['on'](_0x797f('0x29'),this[_0x797f('0x2a')][_0x797f('0x17')](this));ami['on'](_0x797f('0x2b'),this[_0x797f('0x2c')][_0x797f('0x17')](this));ami['on'](_0x797f('0x2d'),this[_0x797f('0x2e')][_0x797f('0x17')](this));this[_0x797f('0x2f')]();this[_0x797f('0x30')]();}function isNotNull(_0x5de9dc){return _0x5de9dc!==null&&!_[_0x797f('0x31')](_0x5de9dc);}function clearChannels(_0x3f1d02){if(!_[_0x797f('0x32')](_0x3f1d02)){for(var _0x1719ee in _0x3f1d02){if(_0x3f1d02[_0x797f('0x33')](_0x1719ee)){delete _0x3f1d02[_0x1719ee];}}}}function clearCampaigns(_0xa7a75e){if(!_[_0x797f('0x32')](_0xa7a75e)){for(var _0x369754 in _0xa7a75e){if(_0xa7a75e[_0x797f('0x33')](_0x369754)){_0xa7a75e[_0x369754]['originated']=0x0;}}}}function clearVoiceQueues(_0x18bdec){if(!_[_0x797f('0x32')](_0x18bdec)){for(var _0x290117 in _0x18bdec){if(_0x18bdec['hasOwnProperty'](_0x290117)){_0x18bdec[_0x290117]['originated']=0x0;_0x18bdec[_0x290117]['talking']=0x0;_0x18bdec[_0x290117][_0x797f('0x34')]=0x0;_0x18bdec[_0x290117]['waiting']=0x0;_0x18bdec[_0x290117]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x1c2b1e){if(!_[_0x797f('0x32')](_0x1c2b1e)){for(var _0x2b9165 in _0x1c2b1e){if(_0x1c2b1e[_0x797f('0x33')](_0x2b9165)){_0x1c2b1e[_0x2b9165][_0x797f('0x35')]=!![];}}}}VoiceQueueReport[_0x797f('0xb')][_0x797f('0x36')]=function(){var _0x853add=this;for(var _0x5274fc in this[_0x797f('0x37')]){if(this[_0x797f('0x37')][_0x797f('0x33')](_0x5274fc)&&!this[_0x797f('0x37')][_0x5274fc][_0x797f('0x38')]){this[_0x797f('0xf')][_0x797f('0xc')](function(){if(!_['isNil'](_0x853add[_0x797f('0x37')][_0x5274fc])){return ami[_0x797f('0x39')]({'action':'status','channel':_0x853add[_0x797f('0x37')][_0x5274fc][_0x797f('0x3a')]})[_0x797f('0x3b')](function(_0x4454d6){if(_0x4454d6[_0x797f('0x3c')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x853add[_0x797f('0x37')][_0x5274fc]){delete _0x853add[_0x797f('0x37')][_0x5274fc];logger[_0x797f('0x3d')](_0x797f('0x3e'),_0x5274fc);}if(_0x853add[_0x797f('0x3f')][_0x5274fc]){delete _0x853add['queueReports'][_0x5274fc];logger[_0x797f('0x3d')](_0x797f('0x40'),_0x5274fc);}if(_0x853add[_0x797f('0x14')][_0x5274fc]){delete _0x853add['variables'][_0x5274fc];logger['error'](_0x797f('0x41'),_0x5274fc);}},0x1f40);}});}});}}};VoiceQueueReport[_0x797f('0xb')]['syncFullyBooted']=function(){logger[_0x797f('0x3d')](_0x797f('0x42'));clearChannels(this[_0x797f('0x37')]);this['clearQueueReport'](this['queueReports']);clearAgentBooked(this[_0x797f('0x10')]);clearVoiceQueues(this[_0x797f('0x11')]);clearCampaigns(this['campaigns']);};VoiceQueueReport[_0x797f('0xb')]['clearQueueReport']=function(_0x3bdcf2){var _0xf929ab=this;if(!_[_0x797f('0x32')](_0x3bdcf2)){for(var _0x57ef19 in _0x3bdcf2){if(_0x3bdcf2[_0x797f('0x33')](_0x57ef19)){_0xf929ab[_0x797f('0x43')](_0x3bdcf2[_0x57ef19]);delete _0x3bdcf2[_0x57ef19];}}}};function loggerCatch(_0x117769){return function(_0x5dcaf6){logger[_0x797f('0x3d')](_0x117769,util[_0x797f('0x44')](_0x5dcaf6,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0x797f('0xb')][_0x797f('0x45')]=function(_0x2d0831,_0x153d84,_0x509807){io['to'](_0x2d0831)[_0x797f('0x45')](_0x153d84,_0x509807);};VoiceQueueReport[_0x797f('0xb')][_0x797f('0x46')]=function(_0x494dda){this[_0x797f('0x45')](util[_0x797f('0x47')](_0x797f('0x48'),_0x494dda['name']),'voice_queue_channel:save',_0x494dda);};VoiceQueueReport[_0x797f('0xb')]['emitVoiceQueueChannelRemove']=function(_0x54c584){this[_0x797f('0x45')](util['format'](_0x797f('0x48'),_0x54c584[_0x797f('0x49')]),_0x797f('0x4a'),_0x54c584);};VoiceQueueReport[_0x797f('0xb')][_0x797f('0x4b')]=function(_0x316d4d){if(_0x316d4d[_0x797f('0x4c')]===_0x797f('0x4d')){var _0x3ab713={'id':_0x316d4d['id'],'name':_0x316d4d['name'],'strategy':_0x316d4d[_0x797f('0x4e')],'answered':_0x316d4d['answered'],'available':_0x316d4d[_0x797f('0x4f')],'loggedIn':_0x316d4d[_0x797f('0x50')],'pTalking':_0x316d4d[_0x797f('0x34')],'sumBillable':_0x316d4d[_0x797f('0x51')],'sumDuration':_0x316d4d[_0x797f('0x52')],'sumHoldTime':_0x316d4d[_0x797f('0x53')]||0x0,'talking':_0x316d4d[_0x797f('0x54')],'total':_0x316d4d['total'],'type':_0x316d4d[_0x797f('0x4c')],'unmanaged':_0x316d4d[_0x797f('0x55')],'abandoned':_0x316d4d['abandoned'],'waiting':_0x316d4d[_0x797f('0x56')]};if(_0x316d4d[_0x797f('0x57')]){_0x3ab713[_0x797f('0x57')]={'id':_0x316d4d[_0x797f('0x57')]['id'],'name':_0x316d4d[_0x797f('0x57')][_0x797f('0x49')],'active':_0x316d4d['Trunk'][_0x797f('0x58')],'callerid':_0x316d4d[_0x797f('0x57')]['callerid']};}if(_0x316d4d[_0x797f('0x59')]){_0x3ab713['Interval']={'id':_0x316d4d[_0x797f('0x59')]['id'],'name':_0x316d4d[_0x797f('0x59')][_0x797f('0x49')]};}var _0x17bf35=md5(JSON['stringify'](_0x3ab713));if(_0x316d4d[_0x797f('0x4')]!==_0x17bf35){_0x316d4d[_0x797f('0x4')]=_0x17bf35;this[_0x797f('0x45')](util[_0x797f('0x47')](_0x797f('0x48'),_0x3ab713[_0x797f('0x49')]),_0x797f('0x5a'),_0x3ab713);}}};VoiceQueueReport['prototype']['isNotNull']=function(_0x2147f6){return _0x2147f6!==null&&!_[_0x797f('0x31')](_0x2147f6);};VoiceQueueReport[_0x797f('0xb')][_0x797f('0x30')]=function(){var _0x4ba1c5=this;setInterval(function(){_0x4ba1c5[_0x797f('0x36')]();ami[_0x797f('0x39')]({'action':_0x797f('0x5b')})[_0x797f('0x3b')](loggerCatch(_0x797f('0x5c')));},0x2710);};VoiceQueueReport[_0x797f('0xb')]['loopQueueSummary']=function(){var _0x533f44=this;setInterval(function(){if(_0x533f44[_0x797f('0x12')]){return ami[_0x797f('0x39')]({'action':'queuesummary'})[_0x797f('0x5d')](function(_0x10ac9b){_0x533f44[_0x797f('0x12')]=![];})[_0x797f('0x3b')](loggerCatch('[queuesummary]'));}},0x3e8);};VoiceQueueReport[_0x797f('0xb')][_0x797f('0x16')]=function(_0x55ca0d){try{if(this['isNotNull'](_0x55ca0d)&&this[_0x797f('0x5e')](_0x55ca0d[_0x797f('0x5f')])){if(this[_0x797f('0x11')][_0x55ca0d['queue']]){var _0x272a16=_['countBy'](this[_0x797f('0x37')],'queue')[_0x55ca0d[_0x797f('0x5f')]]||0x0;var _0x4671fe=_0x272a16-_0x55ca0d[_0x797f('0x60')];if(this[_0x797f('0x11')][_0x55ca0d[_0x797f('0x5f')]][_0x797f('0x56')]!==_[_0x797f('0x61')](_0x55ca0d[_0x797f('0x60')])||this[_0x797f('0x11')][_0x55ca0d[_0x797f('0x5f')]][_0x797f('0x50')]!==_[_0x797f('0x61')](_0x55ca0d[_0x797f('0x62')])||this[_0x797f('0x11')][_0x55ca0d[_0x797f('0x5f')]][_0x797f('0x4f')]!==_['toNumber'](_0x55ca0d['available'])||this[_0x797f('0x11')][_0x55ca0d[_0x797f('0x5f')]][_0x797f('0x54')]!==_0x4671fe){this[_0x797f('0x11')][_0x55ca0d[_0x797f('0x5f')]][_0x797f('0x56')]=_[_0x797f('0x61')](_0x55ca0d[_0x797f('0x60')]);this[_0x797f('0x11')][_0x55ca0d['queue']]['loggedIn']=_['toNumber'](_0x55ca0d[_0x797f('0x62')]);this[_0x797f('0x11')][_0x55ca0d[_0x797f('0x5f')]][_0x797f('0x4f')]=_[_0x797f('0x61')](_0x55ca0d[_0x797f('0x4f')]);this[_0x797f('0x11')][_0x55ca0d[_0x797f('0x5f')]][_0x797f('0x54')]=_0x4671fe>0x0?_0x4671fe:0x0;this[_0x797f('0x11')][_0x55ca0d['queue']]['talking']=this[_0x797f('0x11')][_0x55ca0d[_0x797f('0x5f')]][_0x797f('0x54')]>_[_0x797f('0x61')](_0x55ca0d[_0x797f('0x62')])?_['toNumber'](_0x55ca0d[_0x797f('0x62')]):this[_0x797f('0x11')][_0x55ca0d[_0x797f('0x5f')]][_0x797f('0x54')];this[_0x797f('0x4b')](this['voiceQueues'][_0x55ca0d['queue']]);}ami[_0x797f('0x45')](_0x797f('0x63'),this[_0x797f('0x11')][_0x55ca0d['queue']]);}}}catch(_0x549b8c){logger[_0x797f('0x3d')](_0x797f('0x64'),util[_0x797f('0x44')](_0x549b8c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x797f('0xb')][_0x797f('0x19')]=function(_0x3c8d18){this['flagQueueSummary']=!![];};VoiceQueueReport[_0x797f('0xb')]['syncNewExten']=function(_0x243a71){};VoiceQueueReport[_0x797f('0xb')][_0x797f('0x1b')]=function(_0x3aa7af){try{if(this['isNotNull'](_0x3aa7af)){if(_[_0x797f('0x31')](this[_0x797f('0x3f')][_0x3aa7af['uniqueid']])){this[_0x797f('0x3f')][_0x3aa7af[_0x797f('0x65')]]=[];this['channels'][_0x3aa7af['uniqueid']]={};}var _0x211335=new QueueReport();_0x211335[_0x797f('0x49')]=_0x3aa7af[_0x797f('0x5f')];_0x211335[_0x797f('0x4c')]=this[_0x797f('0x11')][_0x211335[_0x797f('0x49')]]&&this[_0x797f('0x11')][_0x211335['name']][_0x797f('0x4c')]?this[_0x797f('0x11')][_0x211335['name']][_0x797f('0x4c')]||'inbound':_0x797f('0x4d');_0x211335[_0x797f('0x5f')]=_0x3aa7af[_0x797f('0x5f')];_0x211335['queuecallerjoinAt']=moment()[_0x797f('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x211335['position']=_0x3aa7af[_0x797f('0x66')];_0x211335['count']=_0x3aa7af[_0x797f('0x67')];_[_0x797f('0x68')](_0x211335,_[_0x797f('0x69')](_0x3aa7af,_[_0x797f('0x6a')](_0x211335)));this[_0x797f('0x3f')][_0x3aa7af[_0x797f('0x65')]][_0x797f('0x6b')](_0x211335);this[_0x797f('0x37')][_0x3aa7af[_0x797f('0x65')]]=_0x211335;this[_0x797f('0x46')](_0x211335);}}catch(_0x9189a1){logger[_0x797f('0x3d')](_0x797f('0x6c'),util[_0x797f('0x44')](_0x9189a1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x797f('0xb')]['syncQueueCallerAbandon']=function(_0x414a0d){try{if(this[_0x797f('0x5e')](_0x414a0d)){if(this[_0x797f('0x3f')][_0x414a0d[_0x797f('0x65')]]){var _0x11410b=_[_0x797f('0x6d')](this['queueReports'][_0x414a0d[_0x797f('0x65')]]);_0x11410b[_0x797f('0x6e')]=![];_0x11410b[_0x797f('0x6f')]=null;_0x11410b[_0x797f('0x70')]=_0x414a0d[_0x797f('0x70')];_0x11410b[_0x797f('0x71')]=_0x414a0d[_0x797f('0x71')];_0x11410b[_0x797f('0x72')]=!![];_0x11410b[_0x797f('0x73')]=moment()['format'](_0x797f('0x74'));_0x11410b[_0x797f('0x75')]=_0x797f('0x76');_0x11410b['lastAssignedTo']=null;this[_0x797f('0x37')][_0x414a0d[_0x797f('0x65')]]=_0x11410b;this[_0x797f('0x43')](_0x11410b);}}}catch(_0x3ba0bb){logger[_0x797f('0x3d')](_0x797f('0x77'),util[_0x797f('0x44')](_0x3ba0bb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x797f('0xb')]['syncQueueCallerLeave']=function(_0x1e365d){try{if(this[_0x797f('0x5e')](_0x1e365d)){if(this[_0x797f('0x3f')][_0x1e365d[_0x797f('0x65')]]){var _0x937209=_[_0x797f('0x6d')](this['queueReports'][_0x1e365d[_0x797f('0x65')]]);_0x937209[_0x797f('0x78')]=moment()[_0x797f('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x937209[_0x797f('0x79')]=_0x1e365d[_0x797f('0x79')];_0x937209['connectedlinename']=_0x1e365d[_0x797f('0x7a')];this[_0x797f('0x37')][_0x1e365d[_0x797f('0x65')]]=_0x937209;this[_0x797f('0x46')](_0x937209);}}}catch(_0x1c7518){logger[_0x797f('0x3d')](_0x797f('0x7b'),util[_0x797f('0x44')](_0x1c7518,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x797f('0xb')][_0x797f('0x21')]=function(_0x14d784){try{if(this[_0x797f('0x5e')](_0x14d784)){if(this['queueReports'][_0x14d784[_0x797f('0x65')]]){var _0x3696dd=_[_0x797f('0x6d')](this[_0x797f('0x3f')][_0x14d784['uniqueid']]);_0x3696dd[_0x797f('0x6e')]=!![];_0x3696dd['queuecallerexitreason']=_0x797f('0x7c');}}}catch(_0x5ca239){logger['error']('[syncAgentConnect][VoiceQueueReport]',util[_0x797f('0x44')](_0x5ca239,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x797f('0xb')]['syncAgentComplete']=function(_0x1af343){try{if(this[_0x797f('0x5e')](_0x1af343)){if(this[_0x797f('0x3f')][_0x1af343[_0x797f('0x65')]]){var _0x160a21=_[_0x797f('0x6d')](this['queueReports'][_0x1af343[_0x797f('0x65')]]);_0x160a21[_0x797f('0x72')]=![];_0x160a21['queuecallerabandonAt']=null;_0x160a21[_0x797f('0x7d')]=!![];_0x160a21[_0x797f('0x7e')]=_0x1af343[_0x797f('0x7f')];_0x160a21[_0x797f('0x70')]=_0x1af343[_0x797f('0x70')];_0x160a21['queuecallercomplete']=!![];_0x160a21[_0x797f('0x80')]=![];_0x160a21[_0x797f('0x81')]=null;if(!_0x160a21[_0x797f('0x82')]){if(_0x1af343['reason']==_0x797f('0x82')){_0x160a21[_0x797f('0x75')]=_0x797f('0x83');}else{if(_[_0x797f('0x84')](_0x1af343[_0x797f('0x3a')][_0x797f('0x85')](),_0x797f('0x86'))){if(this[_0x797f('0x3f')][_0x1af343['linkedid']]){var _0x7308b2=_[_0x797f('0x6d')](this[_0x797f('0x3f')][_0x1af343['linkedid']]);_0x7308b2['queuecallercomplete']=![];_0x7308b2[_0x797f('0x80')]=!![];_0x7308b2['queuecallerexitAt']=moment(_0x160a21[_0x797f('0x87')])['add'](_0x1af343[_0x797f('0x70')],'seconds')[_0x797f('0x47')](_0x797f('0x74'));_0x7308b2['queuecallerexitreason']=_0x797f('0x88');_0x7308b2[_0x797f('0x82')]=!![];_0x7308b2[_0x797f('0x89')]=_0x797f('0x8a');_0x7308b2[_0x797f('0x8b')]=_0x1af343[_0x797f('0x8c')];_0x7308b2[_0x797f('0x8d')]=_0x1af343[_0x797f('0x65')];var _0x38e0f3=this[_0x797f('0x3f')][_0x1af343[_0x797f('0x8e')]];this[_0x797f('0x3f')][_0x1af343[_0x797f('0x8e')]]=this[_0x797f('0x3f')][_0x1af343[_0x797f('0x65')]];this[_0x797f('0x3f')][_0x1af343[_0x797f('0x65')]]=_0x38e0f3;}}else{_0x160a21[_0x797f('0x75')]='COMPLETEDBY'+_0x1af343[_0x797f('0x8f')]['toUpperCase']();}}}this[_0x797f('0x37')][_0x1af343['uniqueid']]=_0x160a21;this[_0x797f('0x43')](_0x160a21);}}}catch(_0x102eaf){logger['error'](_0x797f('0x90'),util[_0x797f('0x44')](_0x102eaf,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncVarSet']=function(_0x1dca9f){try{if(this['isNotNull'](_0x1dca9f)){this[_0x797f('0x91')](_0x1dca9f[_0x797f('0x65')],_[_0x797f('0x6a')](_0x1dca9f['variable'])[0x0],_0x1dca9f['value']);if(this[_0x797f('0x3f')][_0x1dca9f[_0x797f('0x65')]]){var _0x21f59e=_[_0x797f('0x6d')](this[_0x797f('0x3f')][_0x1dca9f[_0x797f('0x65')]]);if(_0x21f59e){if(this[_0x797f('0x5e')](_0x1dca9f['variable'])&&this['isNotNull'](_0x1dca9f[_0x797f('0x92')][_0x797f('0x93')])){switch(_0x1dca9f['value']){case _0x797f('0x94'):_0x21f59e[_0x797f('0x80')]=![];_0x21f59e[_0x797f('0x81')]=null;break;default:_0x21f59e[_0x797f('0x80')]=!![];_0x21f59e[_0x797f('0x81')]=moment()[_0x797f('0x47')](_0x797f('0x74'));_0x21f59e[_0x797f('0x78')]=moment()[_0x797f('0x47')](_0x797f('0x74'));}_0x21f59e[_0x797f('0x72')]=![];_0x21f59e[_0x797f('0x73')]=null;_0x21f59e['queuecallerexitreason']=_0x1dca9f[_0x797f('0x95')];this[_0x797f('0x37')][_0x1dca9f['uniqueid']]=_0x21f59e;this[_0x797f('0x43')](_0x21f59e);}else if(this[_0x797f('0x5e')](_0x1dca9f[_0x797f('0x92')])&&this[_0x797f('0x5e')](_0x1dca9f[_0x797f('0x92')][_0x797f('0x96')])){if(!_0x21f59e['queuecallerabandon']){_0x21f59e[_0x797f('0x80')]=!![];_0x21f59e['queuecallerexitAt']=moment()[_0x797f('0x47')](_0x797f('0x74'));_0x21f59e['queuecallerexitreason']='EXITWITHKEY';_0x21f59e[_0x797f('0x78')]=moment()[_0x797f('0x47')](_0x797f('0x74'));this['channels'][_0x1dca9f[_0x797f('0x65')]]=_0x21f59e;}}_0x21f59e[_0x797f('0x14')]=this[_0x797f('0x14')][_0x1dca9f['uniqueid']];}}}}catch(_0x2e58b0){logger[_0x797f('0x3d')](_0x797f('0x97'),util['inspect'](_0x2e58b0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x797f('0xb')][_0x797f('0x91')]=function(_0x151151,_0x5c5170,_0x2e2388){var _0x17816d=[_0x797f('0x98'),_0x797f('0x99'),'rtpaudioqosjitter',_0x797f('0x9a'),'rtpaudioqosloss',_0x797f('0x9b'),_0x797f('0x9c'),_0x797f('0x9d'),'sipcallid','sipuri','bridgepeer',_0x797f('0x9e'),_0x797f('0x9f'),'memberdynamic',_0x797f('0xa0'),_0x797f('0xa1'),_0x797f('0x7f'),_0x797f('0xa2'),'memberrealtime'];if(!_[_0x797f('0xa3')](_0x5c5170)&&!_[_0x797f('0xa4')](_0x17816d,_0x5c5170)){if(_['isUndefined'](this['variables'][_0x151151])){this['variables'][_0x151151]={};}this[_0x797f('0x14')][_0x151151][_0x5c5170]=_0x2e2388;}};VoiceQueueReport[_0x797f('0xb')][_0x797f('0x25')]=function(_0x538454){try{if(this[_0x797f('0x5e')](_0x538454)){if(this[_0x797f('0x3f')][_0x538454[_0x797f('0x65')]]){for(var _0x4f0450=0x0,_0x36b102={};_0x4f0450<this['queueReports'][_0x538454[_0x797f('0x65')]]['length'];_0x4f0450+=0x1){_0x36b102=this[_0x797f('0x3f')][_0x538454['uniqueid']][_0x4f0450];if(this['voiceQueues'][_0x36b102[_0x797f('0x5f')]]){if(_0x36b102[_0x797f('0x80')]){this[_0x797f('0x11')][_0x36b102[_0x797f('0x5f')]][_0x797f('0x55')]+=0x1;}if(_0x36b102[_0x797f('0x72')]){this[_0x797f('0x11')][_0x36b102[_0x797f('0x5f')]][_0x797f('0xa5')]+=0x1;}this[_0x797f('0x11')][_0x36b102[_0x797f('0x5f')]][_0x797f('0x53')]+=moment(_0x36b102[_0x797f('0x78')])[_0x797f('0xa6')](_0x36b102[_0x797f('0x87')],_0x797f('0xa7'))||0x0;if(_0x4f0450===this[_0x797f('0x3f')][_0x538454[_0x797f('0x65')]][_0x797f('0xa8')]-0x1){this[_0x797f('0x11')][_0x36b102[_0x797f('0x5f')]][_0x797f('0x52')]+=moment()['milliseconds'](0x0)['diff'](_0x36b102['queuecallerjoinAt'],_0x797f('0xa7'));this['voiceQueues'][_0x36b102[_0x797f('0x5f')]][_0x797f('0xa9')]+=0x1;if(_0x36b102[_0x797f('0x6e')]){this[_0x797f('0x11')][_0x36b102[_0x797f('0x5f')]][_0x797f('0xaa')]+=0x1;this[_0x797f('0x11')][_0x36b102[_0x797f('0x5f')]]['sumBillable']+=moment()[_0x797f('0xab')](0x0)[_0x797f('0xa6')](_0x36b102[_0x797f('0x78')],_0x797f('0xa7'));_0x36b102[_0x797f('0x6f')]=moment()[_0x797f('0x47')](_0x797f('0x74'));_0x36b102[_0x797f('0x80')]=![];_0x36b102[_0x797f('0x81')]=null;}if(_0x36b102[_0x797f('0x80')]){_0x36b102['lastevent']='unmanaged';ami[_0x797f('0x45')](_0x797f('0xac'),_0x36b102);}if(_0x36b102['queuecallerabandon']){_0x36b102['lastevent']=_0x797f('0xa5');ami[_0x797f('0x45')](_0x797f('0xad'),_0x36b102);}}else{this[_0x797f('0x11')][_0x36b102[_0x797f('0x5f')]][_0x797f('0x52')]+=this[_0x797f('0x11')][_0x36b102[_0x797f('0x5f')]][_0x797f('0x53')];}this[_0x797f('0x37')][_0x538454['uniqueid']]=_0x36b102;this[_0x797f('0x43')](_0x36b102);this[_0x797f('0x4b')](this[_0x797f('0x11')][_0x36b102[_0x797f('0x5f')]]);}}ami[_0x797f('0x45')]('custom:voiceQueueReport',this[_0x797f('0x3f')][_0x538454[_0x797f('0x65')]]);delete this[_0x797f('0x3f')][_0x538454['uniqueid']];delete this[_0x797f('0x37')][_0x538454[_0x797f('0x65')]];}if(this[_0x797f('0x14')][_0x538454[_0x797f('0x65')]]){delete this[_0x797f('0x14')][_0x538454[_0x797f('0x65')]];}}}catch(_0x1b7f1c){logger[_0x797f('0x3d')](_0x797f('0xae'),util['inspect'](_0x1b7f1c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x797f('0xb')][_0x797f('0x2c')]=function(_0x145415){try{if(this['isNotNull'](_0x145415)){var _0x22adcd;if(this[_0x797f('0x3f')][_0x145415['transfereeuniqueid']]){_0x22adcd=_[_0x797f('0x6d')](this[_0x797f('0x3f')][_0x145415[_0x797f('0xaf')]]);_0x22adcd['transferexten']=_0x145415[_0x797f('0xb0')];_0x22adcd[_0x797f('0x8d')]=_0x145415[_0x797f('0xb1')];_0x22adcd[_0x797f('0x75')]=_0x797f('0xb2');_0x22adcd[_0x797f('0x82')]=!![];_0x22adcd[_0x797f('0x89')]='ATTENDED';if(this[_0x797f('0x3f')][_0x145415[_0x797f('0xb1')]]){var _0x38a348=this[_0x797f('0x3f')][_0x145415[_0x797f('0xb1')]];this[_0x797f('0x3f')][_0x145415[_0x797f('0xb1')]]=this[_0x797f('0x3f')][_0x145415['transfereeuniqueid']];this[_0x797f('0x3f')][_0x145415[_0x797f('0xaf')]]=_0x38a348;var _0x4f89de=_['last'](this[_0x797f('0x3f')][_0x145415['transfereeuniqueid']]);_0x4f89de[_0x797f('0x38')]=!![];}}else if(this['queueReports'][_0x145415[_0x797f('0xb3')]]){_0x22adcd=_[_0x797f('0x6d')](this[_0x797f('0x3f')][_0x145415['transfertargetuniqueid']]);_0x22adcd['transferexten']=_0x145415[_0x797f('0xb4')];_0x22adcd[_0x797f('0x8d')]=_0x145415['origtransfereruniqueid'];_0x22adcd['queuecallerexitreason']=_0x797f('0xb2');_0x22adcd[_0x797f('0x82')]=!![];_0x22adcd[_0x797f('0x89')]=_0x797f('0xb5');if(this['queueReports'][_0x145415[_0x797f('0xb6')]]){var _0x38a348=this[_0x797f('0x3f')][_0x145415[_0x797f('0xb6')]];this['queueReports'][_0x145415[_0x797f('0xb6')]]=this[_0x797f('0x3f')][_0x145415['transfertargetuniqueid']];this[_0x797f('0x3f')][_0x145415['transfertargetuniqueid']]=_0x38a348;var _0x4f89de=_[_0x797f('0x6d')](this[_0x797f('0x3f')][_0x145415['transfertargetuniqueid']]);_0x4f89de[_0x797f('0x38')]=!![];}}}}catch(_0x2f09f8){logger[_0x797f('0x3d')]('[syncAttendedTransfer][VoiceQueueReport]',util['inspect'](_0x2f09f8,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x797f('0x2e')]=function(_0x4b55b3){try{if(this['isNotNull'](_0x4b55b3)){if(this['queueReports'][_0x4b55b3[_0x797f('0xaf')]]){var _0x17d255=_[_0x797f('0x6d')](this['queueReports'][_0x4b55b3[_0x797f('0xaf')]]);_0x17d255[_0x797f('0x75')]=_0x797f('0xb7');_0x17d255[_0x797f('0x82')]=!![];_0x17d255[_0x797f('0x89')]='BLIND';_0x17d255[_0x797f('0x8b')]=_0x4b55b3[_0x797f('0xb8')];_0x17d255[_0x797f('0x8d')]=_0x4b55b3[_0x797f('0xaf')];this['syncHangup']({'event':_0x797f('0xb9'),'uniqueid':_0x4b55b3['transfereeuniqueid'],'context':_0x4b55b3['context'],'channel':_0x4b55b3[_0x797f('0xba')]});}}}catch(_0x523a69){logger['error'](_0x797f('0xbb'),util[_0x797f('0x44')](_0x523a69,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x797f('0xb')][_0x797f('0x28')]=function(_0x20a46b){try{if(this[_0x797f('0x5e')](_0x20a46b)){if(this['queueReports'][_0x20a46b[_0x797f('0x65')]]){var _0x46c0f4=_['last'](this['queueReports'][_0x20a46b[_0x797f('0x65')]]);if(!_[_0x797f('0xa3')](_0x46c0f4[_0x797f('0x78')])){_0x46c0f4[_0x797f('0xbc')]=moment()[_0x797f('0x47')](_0x797f('0x74'));}}}}catch(_0x17b9f0){logger[_0x797f('0x3d')]('[syncMusicOnHoldStart][VoiceQueueReport]',util[_0x797f('0x44')](_0x17b9f0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x797f('0xb')]['syncMusicOnHoldStop']=function(_0xbdeaea){try{if(this[_0x797f('0x5e')](_0xbdeaea)){if(this[_0x797f('0x3f')][_0xbdeaea['uniqueid']]){var _0x2e262a=_['last'](this[_0x797f('0x3f')][_0xbdeaea['uniqueid']]);if(!_[_0x797f('0xa3')](_0x2e262a[_0x797f('0xbc')])){_0x2e262a['mohtime']+=moment()[_0x797f('0xab')](0x0)['diff'](_0x2e262a[_0x797f('0xbc')],_0x797f('0xa7'));delete _0x2e262a[_0x797f('0xbc')];}}}}catch(_0x5ded37){logger[_0x797f('0x3d')]('[syncMusicOnHoldStop][VoiceQueueReport]',util[_0x797f('0x44')](_0x5ded37,{'showHidden':![],'depth':null}));}};module[_0x797f('0xbd')]=VoiceQueueReport;
\ No newline at end of file
index cb7222b..7563cce 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe14d=['createHistory','campaign','Request','CreateReportAgentPreview','../client'];(function(_0xc840e8,_0x4d57fc){var _0x91bbb7=function(_0x493f40){while(--_0x493f40){_0xc840e8['push'](_0xc840e8['shift']());}};_0x91bbb7(++_0x4d57fc);}(_0xe14d,0x1ee));var _0xde14=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xe14d[_0x25bea7];return _0x175952;};'use strict';var client=require(_0xde14('0x0'));exports[_0xde14('0x1')]=function(_0x1b5d3b){return function(){_0x1b5d3b[_0xde14('0x2')]=_0x1b5d3b['queue'];return client[_0xde14('0x3')](_0xde14('0x4'),{'body':_0x1b5d3b,'log':'CreateReportAgentPreview'});};};
\ No newline at end of file
+var _0x7bae=['campaign','Request','CreateReportAgentPreview'];(function(_0x212bf5,_0x165cbd){var _0xfcad21=function(_0x4a4e6e){while(--_0x4a4e6e){_0x212bf5['push'](_0x212bf5['shift']());}};_0xfcad21(++_0x165cbd);}(_0x7bae,0x13b));var _0xe7ba=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x7bae[_0x22f8ab];return _0x2a70e5;};'use strict';var client=require('../client');exports['createHistory']=function(_0x80f588){return function(){_0x80f588[_0xe7ba('0x0')]=_0x80f588['queue'];return client[_0xe7ba('0x1')]('CreateReportAgentPreview',{'body':_0x80f588,'log':_0xe7ba('0x2')});};};
\ No newline at end of file
index 52775fd..ec0c3e9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x06ff=['CreateAttachment','../client'];(function(_0x440163,_0x4d9114){var _0x30c4c4=function(_0x1946cd){while(--_0x1946cd){_0x440163['push'](_0x440163['shift']());}};_0x30c4c4(++_0x4d9114);}(_0x06ff,0x1bf));var _0xf06f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x06ff[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xf06f('0x0'));exports['create']=function(_0x2b3c52){return client['Request'](_0xf06f('0x1'),{'body':_0x2b3c52,'log':'CreateAttachment'});};
\ No newline at end of file
+var _0xab1a=['Request','CreateAttachment','create'];(function(_0x402887,_0x1543e6){var _0x44754f=function(_0x3cfdd4){while(--_0x3cfdd4){_0x402887['push'](_0x402887['shift']());}};_0x44754f(++_0x1543e6);}(_0xab1a,0xc8));var _0xaab1=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0xab1a[_0x377a6e];return _0x37f751;};'use strict';var client=require('../client');exports[_0xaab1('0x0')]=function(_0x482e29){return client[_0xaab1('0x1')](_0xaab1('0x2'),{'body':_0x482e29,'log':_0xaab1('0x2')});};
\ No newline at end of file
index 72ad079..7354c13 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3d26=['dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','name','callerid','TrunkBackup','Interval','interval','SquareProject','getCampaign','../client','getCampaigns','GetCampaign','type','active','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength'];(function(_0x442f1a,_0x6ba7b1){var _0x187022=function(_0x48869b){while(--_0x48869b){_0x442f1a['push'](_0x442f1a['shift']());}};_0x187022(++_0x6ba7b1);}(_0x3d26,0x11c));var _0x63d2=function(_0x486562,_0x13eb52){_0x486562=_0x486562-0x0;var _0x35eeb9=_0x3d26[_0x486562];return _0x35eeb9;};'use strict';var client=require(_0x63d2('0x0'));exports[_0x63d2('0x1')]=function(){return function(){return client['Request'](_0x63d2('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x63d2('0x3'),_0x63d2('0x4'),'limitCalls','dialOriginateCallerIdName',_0x63d2('0x5'),_0x63d2('0x6'),'dialCongestionMaxRetry',_0x63d2('0x7'),_0x63d2('0x8'),'dialBusyRetryFrequency',_0x63d2('0x9'),_0x63d2('0xa'),_0x63d2('0xb'),_0x63d2('0xc'),_0x63d2('0xd'),'dialAMDActive',_0x63d2('0xe'),_0x63d2('0xf'),_0x63d2('0x10'),_0x63d2('0x11'),'dialAMDMinWordLength',_0x63d2('0x12'),_0x63d2('0x13'),_0x63d2('0x14'),_0x63d2('0x15'),_0x63d2('0x16'),_0x63d2('0x17'),_0x63d2('0x18'),_0x63d2('0x19')],'include':[{'model':_0x63d2('0x1a'),'as':_0x63d2('0x1a'),'attributes':['id',_0x63d2('0x1b'),_0x63d2('0x1c'),_0x63d2('0x4')]},{'model':_0x63d2('0x1a'),'as':_0x63d2('0x1d'),'attributes':['id',_0x63d2('0x1b'),_0x63d2('0x1c'),_0x63d2('0x4')]},{'model':_0x63d2('0x1e'),'as':_0x63d2('0x1e'),'attributes':['id','name'],'include':[{'model':_0x63d2('0x1e'),'as':'Intervals','attributes':['id',_0x63d2('0x1b'),_0x63d2('0x1f')]}]},{'model':'SquareProject','as':_0x63d2('0x20'),'attributes':['id',_0x63d2('0x1b')]}]},'log':_0x63d2('0x21')});};};
\ No newline at end of file
+var _0x806d=['GetCampaign','name','type','active','limitCalls','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialAMDActive','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','Trunk','Interval','Intervals','interval','SquareProject','getCampaign','Request'];(function(_0x2deb2b,_0x35f4e5){var _0x5836a0=function(_0x10d89b){while(--_0x10d89b){_0x2deb2b['push'](_0x2deb2b['shift']());}};_0x5836a0(++_0x35f4e5);}(_0x806d,0x15b));var _0xd806=function(_0x1b0548,_0x2acb0f){_0x1b0548=_0x1b0548-0x0;var _0x13bd27=_0x806d[_0x1b0548];return _0x13bd27;};'use strict';var client=require('../client');exports['getCampaigns']=function(){return function(){return client[_0xd806('0x0')](_0xd806('0x1'),{'options':{'raw':![],'attributes':['id',_0xd806('0x2'),_0xd806('0x3'),_0xd806('0x4'),_0xd806('0x5'),'dialOriginateCallerIdName',_0xd806('0x6'),'dialOriginateTimeout',_0xd806('0x7'),'dialCongestionRetryFrequency',_0xd806('0x8'),_0xd806('0x9'),_0xd806('0xa'),_0xd806('0xb'),'dialGlobalMaxRetry',_0xd806('0xc'),'dialGlobalInterval',_0xd806('0xd'),'dialAMDInitialSilence','dialAMDGreeting',_0xd806('0xe'),_0xd806('0xf'),_0xd806('0x10'),'dialAMDBetweenWordsSilence',_0xd806('0x11'),_0xd806('0x12'),_0xd806('0x13'),_0xd806('0x14'),_0xd806('0x15'),_0xd806('0x16'),'dialCutDigit'],'include':[{'model':_0xd806('0x17'),'as':'Trunk','attributes':['id',_0xd806('0x2'),'callerid',_0xd806('0x4')]},{'model':'Trunk','as':'TrunkBackup','attributes':['id',_0xd806('0x2'),'callerid',_0xd806('0x4')]},{'model':_0xd806('0x18'),'as':'Interval','attributes':['id',_0xd806('0x2')],'include':[{'model':_0xd806('0x18'),'as':_0xd806('0x19'),'attributes':['id',_0xd806('0x2'),_0xd806('0x1a')]}]},{'model':_0xd806('0x1b'),'as':_0xd806('0x1b'),'attributes':['id',_0xd806('0x2')]}]},'log':_0xd806('0x1c')});};};
\ No newline at end of file
index 8adcd3e..1b99c18 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2c99=['CreateCmContact','ShowCmContact','../client','createContact','Request'];(function(_0x138ced,_0xc591d){var _0xa25d9a=function(_0x1b1d21){while(--_0x1b1d21){_0x138ced['push'](_0x138ced['shift']());}};_0xa25d9a(++_0xc591d);}(_0x2c99,0x165));var _0x92c9=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x2c99[_0x5f1391];return _0x50ebe3;};'use strict';var client=require(_0x92c9('0x0'));exports[_0x92c9('0x1')]=function(_0x41c177){return function(){return client[_0x92c9('0x2')]('CreateCmContact',{'body':_0x41c177,'log':_0x92c9('0x3')});};};exports['showContact']=function(_0x40f44b){return function(){return client['Request']('ShowCmContact',{'options':_0x40f44b,'log':_0x92c9('0x4')});};};
\ No newline at end of file
+var _0x353b=['createContact','Request','showContact','ShowCmContact'];(function(_0x3a19d4,_0x3f19a4){var _0x5b858b=function(_0x4ddce5){while(--_0x4ddce5){_0x3a19d4['push'](_0x3a19d4['shift']());}};_0x5b858b(++_0x3f19a4);}(_0x353b,0x84));var _0xb353=function(_0x3faa8d,_0x1a6460){_0x3faa8d=_0x3faa8d-0x0;var _0x12e06d=_0x353b[_0x3faa8d];return _0x12e06d;};'use strict';var client=require('../client');exports[_0xb353('0x0')]=function(_0x312144){return function(){return client[_0xb353('0x1')]('CreateCmContact',{'body':_0x312144,'log':'CreateCmContact'});};};exports[_0xb353('0x2')]=function(_0x56a58e){return function(){return client[_0xb353('0x1')](_0xb353('0x3'),{'options':_0x56a58e,'log':_0xb353('0x3')});};};
\ No newline at end of file
index 768952b..05bfefe 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc4aa=['getContactDialerIvr','priority','GetContactDialerIvr','moveContactManagedDialer','queue','VoiceQueueId','countReScheduled','CountReScheduled','getContactPreview','GetCmHopper','User','Agent','name','VoiceQueue','Queue','unlockContact','getContactRecallMe','GetContactRecallMe','db.CmHopper.UserId','../client','moment','lodash','getContacts','Contact','getCmHopper','updateContacts','Request','UpdateCmHopper','rescheduleContact','ContactId','ListId','CampaignId','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','format','YYYY-MM-DD\x20HH:mm:ss','CmContact','DESC','scheduledat','ASC'];(function(_0x333798,_0x9f6561){var _0x389f4e=function(_0x193b28){while(--_0x193b28){_0x333798['push'](_0x333798['shift']());}};_0x389f4e(++_0x9f6561);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xc4aa[_0x2064e5];return _0x21a233;};'use strict';var client=require(_0xac4a('0x0'));var moment=require(_0xac4a('0x1'));var _=require(_0xac4a('0x2'));exports[_0xac4a('0x3')]=function(_0x275161,_0x22469d){return function(){return client['Request']('GetCmHopper',{'options':{'where':{'VoiceQueueId':_0x275161},'include':[{'model':'CmContact','as':_0xac4a('0x4')}],'limit':_0x22469d,'raw':![]},'log':_0xac4a('0x5')});};};exports[_0xac4a('0x6')]=function(_0x215f39,_0x96be2b,_0x15cd34){return function(){return client[_0xac4a('0x7')](_0xac4a('0x8'),{'body':_0x215f39,'options':{'where':{'VoiceQueueId':_0x96be2b,'scheduledat':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x15cd34},'log':_0xac4a('0x8')});};};exports[_0xac4a('0x9')]=function(_0x26ec84){return function(){return client['Request'](_0xac4a('0x8'),{'body':_0x26ec84,'options':{'where':{'ContactId':_0x26ec84[_0xac4a('0xa')],'ListId':_0x26ec84[_0xac4a('0xb')],'VoiceQueueId':_0x26ec84['VoiceQueueId'],'CampaignId':_0x26ec84[_0xac4a('0xc')]}},'log':'rescheduleContact'});};};exports[_0xac4a('0xd')]=function(_0x4855b6,_0x333ca5,_0x2a0776){return function(){return client[_0xac4a('0x7')]('DestroyCmHopper',{'options':{'where':{'VoiceQueueId':_0x4855b6,'ListId':_0x333ca5,'ContactId':_0x2a0776}},'log':_0xac4a('0xe')});};};exports[_0xac4a('0xf')]=function(_0x247b78,_0x6e00d4,_0x1b4313,_0x3b71c0){return function(){return client[_0xac4a('0x7')](_0xac4a('0x10'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x247b78,'active':![],'scheduledat':{'$lte':moment()[_0xac4a('0x11')](_0xac4a('0x12'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x6e00d4}}]},'include':[{'model':_0xac4a('0x13'),'as':_0xac4a('0x4')}],'order':[['priority',_0xac4a('0x14')],[_0xac4a('0x15'),_0x3b71c0],['id',_0xac4a('0x16')]],'raw':!![],'limit':_0x1b4313},'log':_0xac4a('0x10')});};};exports[_0xac4a('0x17')]=function(_0x387a54,_0x28e304,_0x44ec59){return function(){return client['Request']('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x387a54,'active':![],'scheduledat':{'$lte':moment()[_0xac4a('0x11')](_0xac4a('0x12'))}},'include':[{'model':_0xac4a('0x13'),'as':'Contact'}],'order':[[_0xac4a('0x18'),_0xac4a('0x14')],[_0xac4a('0x15'),_0x44ec59],['id',_0xac4a('0x16')]],'raw':!![],'limit':_0x28e304},'log':_0xac4a('0x19')});};};exports[_0xac4a('0x1a')]=function(_0xe38996,_0x3ca790){return function(){_0xe38996['campaign']=_0xe38996[_0xac4a('0x1b')];return client[_0xac4a('0x7')]('MoveContactManagedDialer',{'body':_0xe38996,'options':{'where':{'ContactId':_0xe38996[_0xac4a('0xa')],'ListId':_0xe38996[_0xac4a('0xb')],'VoiceQueueId':_0xe38996[_0xac4a('0x1c')],'CampaignId':_0xe38996[_0xac4a('0xc')],'active':_0x3ca790?undefined:!![]}},'log':'MoveContactManagedDialer'});};};exports[_0xac4a('0x1d')]=function(_0x2503d8){return function(){return client[_0xac4a('0x7')](_0xac4a('0x1e'),{'options':{'where':{'VoiceQueueId':_0x2503d8['id']?_0x2503d8['id']||null:null}},'log':_0xac4a('0x1d')});};};exports[_0xac4a('0x1f')]=function(_0x222507){return function(){return client[_0xac4a('0x7')](_0xac4a('0x20'),{'options':{'where':{'id':_0x222507},'include':[{'model':_0xac4a('0x13'),'as':_0xac4a('0x4')},{'model':_0xac4a('0x21'),'as':_0xac4a('0x22'),'attributes':['id',_0xac4a('0x23')]},{'model':_0xac4a('0x24'),'as':_0xac4a('0x25'),'attributes':['id','name']}],'raw':!![]},'log':_0xac4a('0x5')});};};exports[_0xac4a('0x26')]=function(_0x42a33c,_0x2772fe,_0x116700){return function(){return client['Request']('UpdateCmHopper',{'body':_0x42a33c,'options':{'where':{'id':_0x2772fe},'limit':_0x116700},'log':_0xac4a('0x8')});};};exports[_0xac4a('0x27')]=function(_0x1f12d5,_0x546b65){return function(){return client['Request'](_0xac4a('0x28'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x1f12d5,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0xac4a('0x11')](_0xac4a('0x12'))},'UserId':{'$in':_0x546b65}},'order':[[_0xac4a('0x18'),_0xac4a('0x14')],['scheduledat',_0xac4a('0x14')],['id','ASC']],'include':[{'model':_0xac4a('0x13'),'as':'Contact'}],'group':_0xac4a('0x29'),'raw':!![]},'log':_0xac4a('0x10')});};};
\ No newline at end of file
+var _0x2675=['queue','MoveContactManagedDialer','countReScheduled','CountReScheduled','getContactPreview','User','Agent','VoiceQueue','unlockContact','getContactRecallMe','GetContactRecallMe','db.CmHopper.UserId','../client','GetCmHopper','CmContact','getCmHopper','updateContacts','Request','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','UpdateCmHopper','ContactId','VoiceQueueId','DestroyCmHopper','getContactDialer','GetContactDialer','Contact','priority','DESC','scheduledat','ASC','getContactDialerIvr','GetContactDialerIvr','moveContactManagedDialer'];(function(_0x4bd753,_0x58d520){var _0x2336a0=function(_0x5b1fe9){while(--_0x5b1fe9){_0x4bd753['push'](_0x4bd753['shift']());}};_0x2336a0(++_0x58d520);}(_0x2675,0x75));var _0x5267=function(_0x27ab52,_0x5cc45c){_0x27ab52=_0x27ab52-0x0;var _0x410699=_0x2675[_0x27ab52];return _0x410699;};'use strict';var client=require(_0x5267('0x0'));var moment=require('moment');var _=require('lodash');exports['getContacts']=function(_0x1da342,_0x2ae442){return function(){return client['Request'](_0x5267('0x1'),{'options':{'where':{'VoiceQueueId':_0x1da342},'include':[{'model':_0x5267('0x2'),'as':'Contact'}],'limit':_0x2ae442,'raw':![]},'log':_0x5267('0x3')});};};exports[_0x5267('0x4')]=function(_0x4bd042,_0x10f92c,_0x20f065){return function(){return client[_0x5267('0x5')]('UpdateCmHopper',{'body':_0x4bd042,'options':{'where':{'VoiceQueueId':_0x10f92c,'scheduledat':{'$lte':moment()[_0x5267('0x6')](_0x5267('0x7'))}},'limit':_0x20f065},'log':'UpdateCmHopper'});};};exports[_0x5267('0x8')]=function(_0x5d6645){return function(){return client[_0x5267('0x5')](_0x5267('0x9'),{'body':_0x5d6645,'options':{'where':{'ContactId':_0x5d6645[_0x5267('0xa')],'ListId':_0x5d6645['ListId'],'VoiceQueueId':_0x5d6645[_0x5267('0xb')],'CampaignId':_0x5d6645['CampaignId']}},'log':_0x5267('0x8')});};};exports['destroyContact']=function(_0x31ea34,_0x23d71b,_0x268a8a){return function(){return client[_0x5267('0x5')](_0x5267('0xc'),{'options':{'where':{'VoiceQueueId':_0x31ea34,'ListId':_0x23d71b,'ContactId':_0x268a8a}},'log':_0x5267('0xc')});};};exports[_0x5267('0xd')]=function(_0x36dc17,_0x3e19e4,_0x1e2d3b,_0x16e5a7){return function(){return client[_0x5267('0x5')](_0x5267('0xe'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x36dc17,'active':![],'scheduledat':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'$or':[{'UserId':null},{'UserId':{'$in':_0x3e19e4}}]},'include':[{'model':_0x5267('0x2'),'as':_0x5267('0xf')}],'order':[[_0x5267('0x10'),_0x5267('0x11')],[_0x5267('0x12'),_0x16e5a7],['id',_0x5267('0x13')]],'raw':!![],'limit':_0x1e2d3b},'log':_0x5267('0xe')});};};exports[_0x5267('0x14')]=function(_0x15d81e,_0xb1c97a,_0x376387){return function(){return client[_0x5267('0x5')]('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x15d81e,'active':![],'scheduledat':{'$lte':moment()[_0x5267('0x6')](_0x5267('0x7'))}},'include':[{'model':'CmContact','as':_0x5267('0xf')}],'order':[['priority',_0x5267('0x11')],[_0x5267('0x12'),_0x376387],['id',_0x5267('0x13')]],'raw':!![],'limit':_0xb1c97a},'log':_0x5267('0x15')});};};exports[_0x5267('0x16')]=function(_0x4dd637,_0x100fcd){return function(){_0x4dd637['campaign']=_0x4dd637[_0x5267('0x17')];return client[_0x5267('0x5')](_0x5267('0x18'),{'body':_0x4dd637,'options':{'where':{'ContactId':_0x4dd637['ContactId'],'ListId':_0x4dd637['ListId'],'VoiceQueueId':_0x4dd637['VoiceQueueId'],'CampaignId':_0x4dd637['CampaignId'],'active':_0x100fcd?undefined:!![]}},'log':'MoveContactManagedDialer'});};};exports[_0x5267('0x19')]=function(_0x399e64){return function(){return client[_0x5267('0x5')](_0x5267('0x1a'),{'options':{'where':{'VoiceQueueId':_0x399e64['id']?_0x399e64['id']||null:null}},'log':_0x5267('0x19')});};};exports[_0x5267('0x1b')]=function(_0x126a97){return function(){return client[_0x5267('0x5')](_0x5267('0x1'),{'options':{'where':{'id':_0x126a97},'include':[{'model':'CmContact','as':'Contact'},{'model':_0x5267('0x1c'),'as':_0x5267('0x1d'),'attributes':['id','name']},{'model':_0x5267('0x1e'),'as':'Queue','attributes':['id','name']}],'raw':!![]},'log':_0x5267('0x3')});};};exports[_0x5267('0x1f')]=function(_0x1f33b7,_0x2d2ace,_0x33c431){return function(){return client['Request']('UpdateCmHopper',{'body':_0x1f33b7,'options':{'where':{'id':_0x2d2ace},'limit':_0x33c431},'log':_0x5267('0x9')});};};exports[_0x5267('0x20')]=function(_0x24496d,_0x549a66){return function(){return client['Request'](_0x5267('0x21'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x24496d,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x5267('0x6')](_0x5267('0x7'))},'UserId':{'$in':_0x549a66}},'order':[['priority','DESC'],[_0x5267('0x12'),_0x5267('0x11')],['id',_0x5267('0x13')]],'include':[{'model':_0x5267('0x2'),'as':'Contact'}],'group':_0x5267('0x22'),'raw':!![]},'log':_0x5267('0xe')});};};
\ No newline at end of file
index 2b6927b..efa862b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8ee5=['checkIsBlackListIvr','phone','../client','checkIsBlackList','Request','GetCmHopperBlack','VoiceQueueId','Contact'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x8ee5,0x1ea));var _0x58ee=function(_0x1b1d0f,_0x3d3aee){_0x1b1d0f=_0x1b1d0f-0x0;var _0x2b32f2=_0x8ee5[_0x1b1d0f];return _0x2b32f2;};'use strict';var client=require(_0x58ee('0x0'));exports[_0x58ee('0x1')]=function(_0x37db95){return function(){return client[_0x58ee('0x2')](_0x58ee('0x3'),{'options':{'where':{'VoiceQueueId':_0x37db95[_0x58ee('0x4')],'phone':_0x37db95[_0x58ee('0x5')]['phone']},'raw':![]},'log':'GetCmHopperBlack'});};};exports[_0x58ee('0x6')]=function(_0x5c22a3){return function(){return client[_0x58ee('0x2')]('GetCmHopperBlack',{'options':{'where':{'CampaignId':_0x5c22a3['CampaignId'],'phone':_0x5c22a3[_0x58ee('0x5')][_0x58ee('0x7')]},'raw':![]},'log':'GetCmHopperBlackIvr'});};};
\ No newline at end of file
+var _0xd552=['Request','GetCmHopperBlack','VoiceQueueId','Contact','phone','checkIsBlackListIvr','CampaignId','GetCmHopperBlackIvr','../client','checkIsBlackList'];(function(_0x5e8295,_0x4fcee0){var _0x2b08aa=function(_0x331b32){while(--_0x331b32){_0x5e8295['push'](_0x5e8295['shift']());}};_0x2b08aa(++_0x4fcee0);}(_0xd552,0x1de));var _0x2d55=function(_0x2141c2,_0x15c6bd){_0x2141c2=_0x2141c2-0x0;var _0x1c0c29=_0xd552[_0x2141c2];return _0x1c0c29;};'use strict';var client=require(_0x2d55('0x0'));exports[_0x2d55('0x1')]=function(_0x356c2c){return function(){return client[_0x2d55('0x2')](_0x2d55('0x3'),{'options':{'where':{'VoiceQueueId':_0x356c2c[_0x2d55('0x4')],'phone':_0x356c2c[_0x2d55('0x5')][_0x2d55('0x6')]},'raw':![]},'log':_0x2d55('0x3')});};};exports[_0x2d55('0x7')]=function(_0x501f1c){return function(){return client['Request']('GetCmHopperBlack',{'options':{'where':{'CampaignId':_0x501f1c[_0x2d55('0x8')],'phone':_0x501f1c[_0x2d55('0x5')][_0x2d55('0x6')]},'raw':![]},'log':_0x2d55('0x9')});};};
\ No newline at end of file
index cc21b95..d6ba071 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x17ec=['CreateCmHopperFinal','../client','createContact'];(function(_0x57545a,_0x5e2016){var _0x4a0b4d=function(_0x389b19){while(--_0x389b19){_0x57545a['push'](_0x57545a['shift']());}};_0x4a0b4d(++_0x5e2016);}(_0x17ec,0x12d));var _0xc17e=function(_0x54f2c3,_0x45b08e){_0x54f2c3=_0x54f2c3-0x0;var _0x144fdd=_0x17ec[_0x54f2c3];return _0x144fdd;};'use strict';var client=require(_0xc17e('0x0'));exports[_0xc17e('0x1')]=function(_0x2ae9b8){return function(){_0x2ae9b8['campaign']=_0x2ae9b8['queue'];return client['Request']('CreateCmHopperFinal',{'body':_0x2ae9b8,'log':_0xc17e('0x2')});};};
\ No newline at end of file
+var _0x36fe=['../client','createContact','queue','Request','CreateCmHopperFinal'];(function(_0x58e42f,_0x1139ae){var _0x500c46=function(_0x5af161){while(--_0x5af161){_0x58e42f['push'](_0x58e42f['shift']());}};_0x500c46(++_0x1139ae);}(_0x36fe,0x87));var _0xe36f=function(_0x1cb0b4,_0x1fd48d){_0x1cb0b4=_0x1cb0b4-0x0;var _0x525b60=_0x36fe[_0x1cb0b4];return _0x525b60;};'use strict';var client=require(_0xe36f('0x0'));exports[_0xe36f('0x1')]=function(_0x25f710){return function(){_0x25f710['campaign']=_0x25f710[_0xe36f('0x2')];return client[_0xe36f('0x3')](_0xe36f('0x4'),{'body':_0x25f710,'log':_0xe36f('0x4')});};};
\ No newline at end of file
index 08d8c8f..ed032be 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3f2e=['day','endOf','getCampaignHopperHistory','GetCampaignHopperHistory','ivr','../client','createHistory','campaign','queue','Request','CreateCmHopperHistory','AvgHandleTime','subtract','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','startOf'];(function(_0x19ddfd,_0x2bd2d9){var _0x523a04=function(_0x11dee9){while(--_0x11dee9){_0x19ddfd['push'](_0x19ddfd['shift']());}};_0x523a04(++_0x2bd2d9);}(_0x3f2e,0x9d));var _0xe3f2=function(_0x4a88ef,_0x47b00b){_0x4a88ef=_0x4a88ef-0x0;var _0x223767=_0x3f2e[_0x4a88ef];return _0x223767;};'use strict';var client=require(_0xe3f2('0x0'));var moment=require('moment');exports[_0xe3f2('0x1')]=function(_0x409f2d){return function(){_0x409f2d[_0xe3f2('0x2')]=_0x409f2d[_0xe3f2('0x3')];return client[_0xe3f2('0x4')](_0xe3f2('0x5'),{'body':_0x409f2d,'log':_0xe3f2('0x5')});};};exports['avgHandleTime']=function(_0x1decd6){return function(){return client['Request'](_0xe3f2('0x6'),{'options':{'where':{'endtime':{'$between':[moment()[_0xe3f2('0x7')](_0x1decd6,'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xe3f2('0x8')](_0xe3f2('0x9'))]}},'raw':![]},'log':_0xe3f2('0xa')});};};exports[_0xe3f2('0xb')]=function(_0x577609){return function(){return client['Request'](_0xe3f2('0xc'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xe3f2('0xd')](_0xe3f2('0xe'))[_0xe3f2('0x8')](_0xe3f2('0x9')),moment()[_0xe3f2('0xf')](_0xe3f2('0xe'))[_0xe3f2('0x8')](_0xe3f2('0x9'))]},'campaigntype':_0xe3f2('0x3')},'raw':![]},'log':_0xe3f2('0xc')});};};exports[_0xe3f2('0x10')]=function(_0x17e274){return function(){return client['Request'](_0xe3f2('0x11'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xe3f2('0xd')](_0xe3f2('0xe'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0xe3f2('0xe'))['format'](_0xe3f2('0x9'))]},'campaigntype':_0xe3f2('0x12')},'raw':![]},'log':_0xe3f2('0x11')});};};
\ No newline at end of file
+var _0xf417=['getVoiceQueueHopperHistory','Request','GetVoiceQueueHopperHistory','day','getCampaignHopperHistory','startOf','endOf','GetCampaignHopperHistory','moment','createHistory','queue','CreateCmHopperHistory','subtract','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x114554,_0x5239c2){var _0x317677=function(_0xed26e7){while(--_0xed26e7){_0x114554['push'](_0x114554['shift']());}};_0x317677(++_0x5239c2);}(_0xf417,0x8f));var _0x7f41=function(_0x5ad294,_0x1477c7){_0x5ad294=_0x5ad294-0x0;var _0x20a450=_0xf417[_0x5ad294];return _0x20a450;};'use strict';var client=require('../client');var moment=require(_0x7f41('0x0'));exports[_0x7f41('0x1')]=function(_0x35e5dc){return function(){_0x35e5dc['campaign']=_0x35e5dc[_0x7f41('0x2')];return client['Request']('CreateCmHopperHistory',{'body':_0x35e5dc,'log':_0x7f41('0x3')});};};exports['avgHandleTime']=function(_0x51b0cb){return function(){return client['Request']('AvgHandleTime',{'options':{'where':{'endtime':{'$between':[moment()[_0x7f41('0x4')](_0x51b0cb,'minutes')[_0x7f41('0x5')](_0x7f41('0x6')),moment()['format'](_0x7f41('0x6'))]}},'raw':![]},'log':'GetCmHopperHistory'});};};exports[_0x7f41('0x7')]=function(_0x5f3a44){return function(){return client[_0x7f41('0x8')](_0x7f41('0x9'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf']('day')[_0x7f41('0x5')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0x7f41('0xa'))[_0x7f41('0x5')](_0x7f41('0x6'))]},'campaigntype':_0x7f41('0x2')},'raw':![]},'log':_0x7f41('0x9')});};};exports[_0x7f41('0xb')]=function(_0xf2f383){return function(){return client['Request']('GetCampaignHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()[_0x7f41('0xc')]('day')['format'](_0x7f41('0x6')),moment()[_0x7f41('0xd')](_0x7f41('0xa'))['format'](_0x7f41('0x6'))]},'campaigntype':'ivr'},'raw':![]},'log':_0x7f41('0xe')});};};
\ No newline at end of file
index ad529f1..fb8c25a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x326f=['t38timeout','tech','TrunkId','ListId','callerid','active','getFaxAccount','notify','NotifyFaxAccount','../client','GetFaxAccount','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x326f,0xd1));var _0xf326=function(_0xe589eb,_0x513f4a){_0xe589eb=_0xe589eb-0x0;var _0x98012=_0x326f[_0xe589eb];return _0x98012;};'use strict';var client=require(_0xf326('0x0'));exports['getFaxAccounts']=function(){return function(){return client['Request'](_0xf326('0x1'),{'options':{'raw':![],'attributes':['id',_0xf326('0x2'),_0xf326('0x3'),_0xf326('0x4'),_0xf326('0x5'),_0xf326('0x6'),_0xf326('0x7'),_0xf326('0x8'),_0xf326('0x9'),_0xf326('0xa'),'faxdetect',_0xf326('0xb'),_0xf326('0xc'),_0xf326('0xd'),_0xf326('0xe'),'key'],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0xf326('0x2'),_0xf326('0xf'),_0xf326('0x10')]}]},'log':_0xf326('0x11')});};};exports[_0xf326('0x12')]=function(_0x5db9d7,_0x136e2d){return client['Request'](_0xf326('0x13'),{'account':{'id':_0x5db9d7},'body':_0x136e2d,'log':'NotifyFaxAccount'});};
\ No newline at end of file
+var _0x326f=['t38timeout','tech','TrunkId','ListId','callerid','active','getFaxAccount','notify','NotifyFaxAccount','../client','GetFaxAccount','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x326f,0xd1));var _0xf326=function(_0x3251ac,_0x4e7fd8){_0x3251ac=_0x3251ac-0x0;var _0x8d2162=_0x326f[_0x3251ac];return _0x8d2162;};'use strict';var client=require(_0xf326('0x0'));exports['getFaxAccounts']=function(){return function(){return client['Request'](_0xf326('0x1'),{'options':{'raw':![],'attributes':['id',_0xf326('0x2'),_0xf326('0x3'),_0xf326('0x4'),_0xf326('0x5'),_0xf326('0x6'),_0xf326('0x7'),_0xf326('0x8'),_0xf326('0x9'),_0xf326('0xa'),'faxdetect',_0xf326('0xb'),_0xf326('0xc'),_0xf326('0xd'),_0xf326('0xe'),'key'],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0xf326('0x2'),_0xf326('0xf'),_0xf326('0x10')]}]},'log':_0xf326('0x11')});};};exports[_0xf326('0x12')]=function(_0x5db9d7,_0x136e2d){return client['Request'](_0xf326('0x13'),{'account':{'id':_0x5db9d7},'body':_0x136e2d,'log':'NotifyFaxAccount'});};
\ No newline at end of file
index 9bb1bfb..af81c43 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4819=['UpdateFaxMessage','update','Request'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x4819,0xcd));var _0x9481=function(_0xb9580,_0x441821){_0xb9580=_0xb9580-0x0;var _0x532515=_0x4819[_0xb9580];return _0x532515;};'use strict';var client=require('../client');exports[_0x9481('0x0')]=function(_0x3307b0,_0xa9557a){return client[_0x9481('0x1')](_0x9481('0x2'),{'body':_0xa9557a,'options':{'where':{'AttachmentId':_0x3307b0}},'log':_0x9481('0x2')});};
\ No newline at end of file
+var _0x9a5a=['../client','update','Request','UpdateFaxMessage'];(function(_0x397f34,_0x3ac328){var _0x272cda=function(_0x2c9756){while(--_0x2c9756){_0x397f34['push'](_0x397f34['shift']());}};_0x272cda(++_0x3ac328);}(_0x9a5a,0x194));var _0xa9a5=function(_0x431b15,_0x324b22){_0x431b15=_0x431b15-0x0;var _0x21bd6c=_0x9a5a[_0x431b15];return _0x21bd6c;};'use strict';var client=require(_0xa9a5('0x0'));exports[_0xa9a5('0x1')]=function(_0x24b651,_0x15c2b6){return client[_0xa9a5('0x2')]('UpdateFaxMessage',{'body':_0x15c2b6,'options':{'where':{'AttachmentId':_0x24b651}},'log':_0xa9a5('0x3')});};
\ No newline at end of file
index 547bf9c..8b9e748 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x25aa=['DeskField','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','content','idField','nameField','Tag','../../client','Request','GetDeskAccount','name','description','username','password','remoteUri','authType','type','serverUrl','DeskConfiguration','Configurations'];(function(_0x5d9ceb,_0x1a49f5){var _0x33ce82=function(_0x583915){while(--_0x583915){_0x5d9ceb['push'](_0x5d9ceb['shift']());}};_0x33ce82(++_0x1a49f5);}(_0x25aa,0x151));var _0xa25a=function(_0x289e64,_0x5adb3c){_0x289e64=_0x289e64-0x0;var _0x30246c=_0x25aa[_0x289e64];return _0x30246c;};'use strict';var client=require(_0xa25a('0x0'));exports['getDeskAccounts']=function(){return function(_0x53186c){return client[_0xa25a('0x1')](_0xa25a('0x2'),{'options':{'raw':![],'attributes':['id',_0xa25a('0x3'),_0xa25a('0x4'),_0xa25a('0x5'),_0xa25a('0x6'),_0xa25a('0x7'),_0xa25a('0x8'),_0xa25a('0x9'),_0xa25a('0xa')],'include':[{'model':_0xa25a('0xb'),'as':_0xa25a('0xc'),'attributes':['id',_0xa25a('0x3')],'include':[{'model':_0xa25a('0xd'),'as':'Subjects','attributes':['id','type','content',_0xa25a('0xe')],'include':[{'model':_0xa25a('0xf'),'as':_0xa25a('0xf'),'attributes':['id','name']}]},{'model':'DeskField','as':_0xa25a('0x10'),'attributes':['id',_0xa25a('0x9'),'content',_0xa25a('0x11'),_0xa25a('0x12'),_0xa25a('0x13'),_0xa25a('0xe')],'include':[{'model':_0xa25a('0xf'),'as':_0xa25a('0xf'),'attributes':['id',_0xa25a('0x3')]}]},{'model':'DeskField','as':_0xa25a('0x14'),'attributes':['id',_0xa25a('0x9'),_0xa25a('0x15'),_0xa25a('0x16'),_0xa25a('0x17'),'customField',_0xa25a('0xe')],'include':[{'model':_0xa25a('0xf'),'as':_0xa25a('0xf'),'attributes':['id','name']}]},{'model':_0xa25a('0x18'),'as':'Tags','attributes':['id',_0xa25a('0x3')]}]}]},'log':_0xa25a('0x2')});};};
\ No newline at end of file
+var _0xd4f4=['key','keyType','keyContent','variableName','Fields','idField','nameField','customField','Tags','../../client','Request','GetDeskAccount','name','description','username','remoteUri','authType','type','serverUrl','DeskConfiguration','Configurations','DeskField','Variable','Descriptions','content'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xd4f4,0x6d));var _0x4d4f=function(_0x2f9046,_0x52d4ef){_0x2f9046=_0x2f9046-0x0;var _0x4e9e58=_0xd4f4[_0x2f9046];return _0x4e9e58;};'use strict';var client=require(_0x4d4f('0x0'));exports['getDeskAccounts']=function(){return function(_0x140bd2){return client[_0x4d4f('0x1')](_0x4d4f('0x2'),{'options':{'raw':![],'attributes':['id',_0x4d4f('0x3'),_0x4d4f('0x4'),_0x4d4f('0x5'),'password',_0x4d4f('0x6'),_0x4d4f('0x7'),_0x4d4f('0x8'),_0x4d4f('0x9')],'include':[{'model':_0x4d4f('0xa'),'as':_0x4d4f('0xb'),'attributes':['id','name'],'include':[{'model':_0x4d4f('0xc'),'as':'Subjects','attributes':['id',_0x4d4f('0x8'),'content','variableName'],'include':[{'model':_0x4d4f('0xd'),'as':_0x4d4f('0xd'),'attributes':['id','name']}]},{'model':_0x4d4f('0xc'),'as':_0x4d4f('0xe'),'attributes':['id','type',_0x4d4f('0xf'),_0x4d4f('0x10'),_0x4d4f('0x11'),_0x4d4f('0x12'),_0x4d4f('0x13')],'include':[{'model':'Variable','as':_0x4d4f('0xd'),'attributes':['id',_0x4d4f('0x3')]}]},{'model':_0x4d4f('0xc'),'as':_0x4d4f('0x14'),'attributes':['id',_0x4d4f('0x8'),_0x4d4f('0xf'),_0x4d4f('0x15'),_0x4d4f('0x16'),_0x4d4f('0x17'),_0x4d4f('0x13')],'include':[{'model':_0x4d4f('0xd'),'as':_0x4d4f('0xd'),'attributes':['id','name']}]},{'model':'Tag','as':_0x4d4f('0x18'),'attributes':['id',_0x4d4f('0x3')]}]}]},'log':_0x4d4f('0x2')});};};
\ No newline at end of file
index f2a4d10..96bfde5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfe57=['clientSecret','serverUrl','Dynamics365Configuration','Configurations','ticketType','Subjects','type','content','variableName','Variable','Dynamics365Field','key','keyContent','Fields','nameField','customField','../../client','getDynamics365Accounts','Request','GetDynamics365Account','name','username','password','remoteUri','tenantId','clientId'];(function(_0x460103,_0x580b99){var _0x3e7245=function(_0x134768){while(--_0x134768){_0x460103['push'](_0x460103['shift']());}};_0x3e7245(++_0x580b99);}(_0xfe57,0x162));var _0x7fe5=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0xfe57[_0x3e6d5d];return _0x238923;};'use strict';var client=require(_0x7fe5('0x0'));exports[_0x7fe5('0x1')]=function(){return function(_0x44f9b7){return client[_0x7fe5('0x2')](_0x7fe5('0x3'),{'options':{'raw':![],'attributes':['id',_0x7fe5('0x4'),_0x7fe5('0x5'),_0x7fe5('0x6'),_0x7fe5('0x7'),_0x7fe5('0x8'),_0x7fe5('0x9'),_0x7fe5('0xa'),_0x7fe5('0xb'),'description'],'include':[{'model':_0x7fe5('0xc'),'as':_0x7fe5('0xd'),'attributes':['id','name',_0x7fe5('0xe')],'include':[{'model':'Dynamics365Field','as':_0x7fe5('0xf'),'attributes':['id',_0x7fe5('0x10'),_0x7fe5('0x11'),_0x7fe5('0x12')],'include':[{'model':'Variable','as':_0x7fe5('0x13'),'attributes':['id',_0x7fe5('0x4')]}]},{'model':_0x7fe5('0x14'),'as':'Descriptions','attributes':['id',_0x7fe5('0x10'),'content',_0x7fe5('0x15'),'keyType',_0x7fe5('0x16'),'variableName'],'include':[{'model':_0x7fe5('0x13'),'as':_0x7fe5('0x13'),'attributes':['id',_0x7fe5('0x4')]}]},{'model':_0x7fe5('0x14'),'as':_0x7fe5('0x17'),'attributes':['id',_0x7fe5('0x10'),'content','idField',_0x7fe5('0x18'),_0x7fe5('0x19'),_0x7fe5('0x12')],'include':[{'model':_0x7fe5('0x13'),'as':_0x7fe5('0x13'),'attributes':['id',_0x7fe5('0x4')]}]}]}]},'log':_0x7fe5('0x3')});};};
\ No newline at end of file
+var _0xeb41=['nameField','customField','../../client','getDynamics365Accounts','Request','GetDynamics365Account','name','username','remoteUri','tenantId','serverUrl','Dynamics365Configuration','Dynamics365Field','Subjects','type','content','Variable','Descriptions','key','keyType','keyContent','variableName','Fields','idField'];(function(_0x3464e0,_0x1b8e8a){var _0x266ab2=function(_0x563d1c){while(--_0x563d1c){_0x3464e0['push'](_0x3464e0['shift']());}};_0x266ab2(++_0x1b8e8a);}(_0xeb41,0x1ca));var _0x1eb4=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xeb41[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0x1eb4('0x0'));exports[_0x1eb4('0x1')]=function(){return function(_0x560c82){return client[_0x1eb4('0x2')](_0x1eb4('0x3'),{'options':{'raw':![],'attributes':['id',_0x1eb4('0x4'),_0x1eb4('0x5'),'password',_0x1eb4('0x6'),_0x1eb4('0x7'),'clientId','clientSecret',_0x1eb4('0x8'),'description'],'include':[{'model':_0x1eb4('0x9'),'as':'Configurations','attributes':['id',_0x1eb4('0x4'),'ticketType'],'include':[{'model':_0x1eb4('0xa'),'as':_0x1eb4('0xb'),'attributes':['id',_0x1eb4('0xc'),_0x1eb4('0xd'),'variableName'],'include':[{'model':'Variable','as':_0x1eb4('0xe'),'attributes':['id','name']}]},{'model':_0x1eb4('0xa'),'as':_0x1eb4('0xf'),'attributes':['id',_0x1eb4('0xc'),'content',_0x1eb4('0x10'),_0x1eb4('0x11'),_0x1eb4('0x12'),_0x1eb4('0x13')],'include':[{'model':_0x1eb4('0xe'),'as':_0x1eb4('0xe'),'attributes':['id','name']}]},{'model':_0x1eb4('0xa'),'as':_0x1eb4('0x14'),'attributes':['id','type',_0x1eb4('0xd'),_0x1eb4('0x15'),_0x1eb4('0x16'),_0x1eb4('0x17'),_0x1eb4('0x13')],'include':[{'model':_0x1eb4('0xe'),'as':'Variable','attributes':['id',_0x1eb4('0x4')]}]}]}]},'log':_0x1eb4('0x3')});};};
\ No newline at end of file
index 4f54a9e..2d5a051 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x34e8=['nameField','../../client','getFreshdeskAccounts','Request','name','username','apiKey','remoteUri','serverUrl','FreshdeskConfiguration','Configurations','Tag','FreshdeskField','Subjects','type','content','variableName','Variable','Descriptions','key','keyType','keyContent','idField'];(function(_0x859777,_0x42f994){var _0x3c01d5=function(_0x401d75){while(--_0x401d75){_0x859777['push'](_0x859777['shift']());}};_0x3c01d5(++_0x42f994);}(_0x34e8,0x12c));var _0x834e=function(_0x3dab67,_0x18ded6){_0x3dab67=_0x3dab67-0x0;var _0x1e63fe=_0x34e8[_0x3dab67];return _0x1e63fe;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(){return function(_0x8b339){return client[_0x834e('0x2')]('GetFreshdeskAccount',{'options':{'raw':![],'attributes':['id',_0x834e('0x3'),_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6'),_0x834e('0x7')],'include':[{'model':_0x834e('0x8'),'as':_0x834e('0x9'),'attributes':['id','name'],'include':[{'model':_0x834e('0xa'),'attributes':['id','name']},{'model':_0x834e('0xb'),'as':_0x834e('0xc'),'attributes':['id',_0x834e('0xd'),_0x834e('0xe'),_0x834e('0xf')],'include':[{'model':_0x834e('0x10'),'as':_0x834e('0x10'),'attributes':['id',_0x834e('0x3')]}]},{'model':_0x834e('0xb'),'as':_0x834e('0x11'),'attributes':['id',_0x834e('0xd'),_0x834e('0xe'),_0x834e('0x12'),_0x834e('0x13'),_0x834e('0x14'),_0x834e('0xf')],'include':[{'model':_0x834e('0x10'),'as':'Variable','attributes':['id',_0x834e('0x3')]}]},{'model':_0x834e('0xb'),'as':'Fields','attributes':['id',_0x834e('0xd'),_0x834e('0xe'),_0x834e('0x15'),_0x834e('0x16'),'customField',_0x834e('0xf')],'include':[{'model':_0x834e('0x10'),'as':'Variable','attributes':['id',_0x834e('0x3')]}]}]}]},'log':'GetFreshdeskAccount'});};};
\ No newline at end of file
+var _0xfd28=['Variable','FreshdeskField','key','keyContent','Fields','idField','nameField','customField','getFreshdeskAccounts','GetFreshdeskAccount','username','apiKey','remoteUri','FreshdeskConfiguration','Configurations','name','Tag','type','content','variableName'];(function(_0x5ab721,_0x3dc0eb){var _0x2124cb=function(_0x5e6efd){while(--_0x5e6efd){_0x5ab721['push'](_0x5ab721['shift']());}};_0x2124cb(++_0x3dc0eb);}(_0xfd28,0x148));var _0x8fd2=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0xfd28[_0x51c819];return _0x15c5d2;};'use strict';var client=require('../../client');exports[_0x8fd2('0x0')]=function(){return function(_0x117219){return client['Request'](_0x8fd2('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x8fd2('0x2'),_0x8fd2('0x3'),_0x8fd2('0x4'),'serverUrl'],'include':[{'model':_0x8fd2('0x5'),'as':_0x8fd2('0x6'),'attributes':['id',_0x8fd2('0x7')],'include':[{'model':_0x8fd2('0x8'),'attributes':['id',_0x8fd2('0x7')]},{'model':'FreshdeskField','as':'Subjects','attributes':['id',_0x8fd2('0x9'),_0x8fd2('0xa'),_0x8fd2('0xb')],'include':[{'model':'Variable','as':_0x8fd2('0xc'),'attributes':['id','name']}]},{'model':_0x8fd2('0xd'),'as':'Descriptions','attributes':['id',_0x8fd2('0x9'),'content',_0x8fd2('0xe'),'keyType',_0x8fd2('0xf'),'variableName'],'include':[{'model':_0x8fd2('0xc'),'as':_0x8fd2('0xc'),'attributes':['id',_0x8fd2('0x7')]}]},{'model':_0x8fd2('0xd'),'as':_0x8fd2('0x10'),'attributes':['id',_0x8fd2('0x9'),_0x8fd2('0xa'),_0x8fd2('0x11'),_0x8fd2('0x12'),_0x8fd2('0x13'),_0x8fd2('0xb')],'include':[{'model':_0x8fd2('0xc'),'as':_0x8fd2('0xc'),'attributes':['id',_0x8fd2('0x7')]}]}]}]},'log':_0x8fd2('0x1')});};};
\ No newline at end of file
index ccc12d1..e5b0e2f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0f76=['getSalesforceAccounts','GetSalesforceAccount','username','clientSecret','securityToken','serverUrl','type','name','moduleCreate','SalesforceField','Variable','Descriptions','Fields','../../client'];(function(_0x5bd20a,_0x88b686){var _0x4afa08=function(_0x21e4ab){while(--_0x21e4ab){_0x5bd20a['push'](_0x5bd20a['shift']());}};_0x4afa08(++_0x88b686);}(_0x0f76,0x1b1));var _0x60f7=function(_0x36d703,_0x55b354){_0x36d703=_0x36d703-0x0;var _0x12c909=_0x0f76[_0x36d703];return _0x12c909;};'use strict';var client=require(_0x60f7('0x0'));exports[_0x60f7('0x1')]=function(){return function(_0x27ca84){return client['Request'](_0x60f7('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x60f7('0x3'),'password','remoteUri','clientId',_0x60f7('0x4'),_0x60f7('0x5'),_0x60f7('0x6'),_0x60f7('0x7')],'include':[{'model':'SalesforceConfiguration','as':'Configurations','attributes':['id',_0x60f7('0x8'),'moduleSearch',_0x60f7('0x9')],'include':[{'model':_0x60f7('0xa'),'as':'Subjects','include':[{'model':_0x60f7('0xb'),'as':_0x60f7('0xb'),'attributes':['id','name']}]},{'model':_0x60f7('0xa'),'as':_0x60f7('0xc'),'include':[{'model':_0x60f7('0xb'),'as':_0x60f7('0xb'),'attributes':['id',_0x60f7('0x8')]}]},{'model':'SalesforceField','as':_0x60f7('0xd'),'include':[{'model':_0x60f7('0xb'),'as':'Variable','attributes':['id',_0x60f7('0x8')]}]}]}]},'log':_0x60f7('0x2')});};};
\ No newline at end of file
+var _0xe6f6=['GetSalesforceAccount','name','password','remoteUri','clientId','clientSecret','securityToken','serverUrl','type','SalesforceConfiguration','Configurations','moduleSearch','moduleCreate','SalesforceField','Subjects','Variable','Fields','../../client','getSalesforceAccounts','Request'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0xe6f6,0x75));var _0x6e6f=function(_0x49e067,_0x34327d){_0x49e067=_0x49e067-0x0;var _0x52d8e1=_0xe6f6[_0x49e067];return _0x52d8e1;};'use strict';var client=require(_0x6e6f('0x0'));exports[_0x6e6f('0x1')]=function(){return function(_0x49675f){return client[_0x6e6f('0x2')](_0x6e6f('0x3'),{'options':{'raw':![],'attributes':['id',_0x6e6f('0x4'),'username',_0x6e6f('0x5'),_0x6e6f('0x6'),_0x6e6f('0x7'),_0x6e6f('0x8'),_0x6e6f('0x9'),_0x6e6f('0xa'),_0x6e6f('0xb')],'include':[{'model':_0x6e6f('0xc'),'as':_0x6e6f('0xd'),'attributes':['id',_0x6e6f('0x4'),_0x6e6f('0xe'),_0x6e6f('0xf')],'include':[{'model':_0x6e6f('0x10'),'as':_0x6e6f('0x11'),'include':[{'model':_0x6e6f('0x12'),'as':'Variable','attributes':['id',_0x6e6f('0x4')]}]},{'model':_0x6e6f('0x10'),'as':'Descriptions','include':[{'model':_0x6e6f('0x12'),'as':_0x6e6f('0x12'),'attributes':['id',_0x6e6f('0x4')]}]},{'model':_0x6e6f('0x10'),'as':_0x6e6f('0x13'),'include':[{'model':_0x6e6f('0x12'),'as':_0x6e6f('0x12'),'attributes':['id','name']}]}]}]},'log':_0x6e6f('0x3')});};};
\ No newline at end of file
index bf86707..5a642a9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x78d0=['Descriptions','key','keyType','keyContent','Fields','idField','nameField','customField','GetServicenowkAccount','../../client','getServicenowAccounts','Request','name','username','password','email','remoteUri','ServicenowConfiguration','Configurations','ServicenowField','Subjects','type','content','variableName','Variable'];(function(_0x2c5f87,_0x2c33ff){var _0x34cdb3=function(_0x40f199){while(--_0x40f199){_0x2c5f87['push'](_0x2c5f87['shift']());}};_0x34cdb3(++_0x2c33ff);}(_0x78d0,0x1cb));var _0x078d=function(_0x36bbb0,_0x12f856){_0x36bbb0=_0x36bbb0-0x0;var _0x58226e=_0x78d0[_0x36bbb0];return _0x58226e;};'use strict';var client=require(_0x078d('0x0'));exports[_0x078d('0x1')]=function(){return function(_0xffad4f){return client[_0x078d('0x2')]('GetServicenowAccount',{'options':{'raw':![],'attributes':['id',_0x078d('0x3'),'description',_0x078d('0x4'),_0x078d('0x5'),_0x078d('0x6'),_0x078d('0x7'),'serverUrl'],'include':[{'model':_0x078d('0x8'),'as':_0x078d('0x9'),'attributes':['id','name'],'include':[{'model':_0x078d('0xa'),'as':_0x078d('0xb'),'attributes':['id',_0x078d('0xc'),_0x078d('0xd'),_0x078d('0xe')],'include':[{'model':_0x078d('0xf'),'as':_0x078d('0xf'),'attributes':['id','name']}]},{'model':'ServicenowField','as':_0x078d('0x10'),'attributes':['id',_0x078d('0xc'),_0x078d('0xd'),_0x078d('0x11'),_0x078d('0x12'),_0x078d('0x13'),_0x078d('0xe')],'include':[{'model':_0x078d('0xf'),'as':'Variable','attributes':['id',_0x078d('0x3')]}]},{'model':'ServicenowField','as':_0x078d('0x14'),'attributes':['id',_0x078d('0xc'),_0x078d('0xd'),_0x078d('0x15'),_0x078d('0x16'),_0x078d('0x17'),_0x078d('0xe')],'include':[{'model':'Variable','as':_0x078d('0xf'),'attributes':['id',_0x078d('0x3')]}]}]}]},'log':_0x078d('0x18')});};};
\ No newline at end of file
+var _0x7edb=['Configurations','ServicenowField','Subjects','type','content','variableName','Variable','Descriptions','key','keyContent','idField','nameField','customField','GetServicenowkAccount','getServicenowAccounts','Request','GetServicenowAccount','name','username','remoteUri','serverUrl','ServicenowConfiguration'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x7edb,0x158));var _0xb7ed=function(_0x244e5f,_0x35e49e){_0x244e5f=_0x244e5f-0x0;var _0x1b8f98=_0x7edb[_0x244e5f];return _0x1b8f98;};'use strict';var client=require('../../client');exports[_0xb7ed('0x0')]=function(){return function(_0xde95e8){return client[_0xb7ed('0x1')](_0xb7ed('0x2'),{'options':{'raw':![],'attributes':['id',_0xb7ed('0x3'),'description',_0xb7ed('0x4'),'password','email',_0xb7ed('0x5'),_0xb7ed('0x6')],'include':[{'model':_0xb7ed('0x7'),'as':_0xb7ed('0x8'),'attributes':['id',_0xb7ed('0x3')],'include':[{'model':_0xb7ed('0x9'),'as':_0xb7ed('0xa'),'attributes':['id',_0xb7ed('0xb'),_0xb7ed('0xc'),_0xb7ed('0xd')],'include':[{'model':'Variable','as':_0xb7ed('0xe'),'attributes':['id',_0xb7ed('0x3')]}]},{'model':_0xb7ed('0x9'),'as':_0xb7ed('0xf'),'attributes':['id',_0xb7ed('0xb'),_0xb7ed('0xc'),_0xb7ed('0x10'),'keyType',_0xb7ed('0x11'),_0xb7ed('0xd')],'include':[{'model':_0xb7ed('0xe'),'as':_0xb7ed('0xe'),'attributes':['id',_0xb7ed('0x3')]}]},{'model':'ServicenowField','as':'Fields','attributes':['id',_0xb7ed('0xb'),'content',_0xb7ed('0x12'),_0xb7ed('0x13'),_0xb7ed('0x14'),_0xb7ed('0xd')],'include':[{'model':_0xb7ed('0xe'),'as':_0xb7ed('0xe'),'attributes':['id',_0xb7ed('0x3')]}]}]}]},'log':_0xb7ed('0x15')});};};
\ No newline at end of file
index 5f4db40..9ee8851 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2fa3=['name','Descriptions','key','keyType','keyContent','Fields','idField','nameField','customField','GetSugarcrmAccount','Request','username','password','remoteUri','serverUrl','SugarcrmConfiguration','Configurations','SugarcrmField','Subjects','type','content','variableName','Variable'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2fa3,0x135));var _0x32fa=function(_0x413704,_0x3cd840){_0x413704=_0x413704-0x0;var _0x19695a=_0x2fa3[_0x413704];return _0x19695a;};'use strict';var client=require('../../client');exports['getSugarcrmAccounts']=function(){return function(_0x1e697f){return client[_0x32fa('0x0')]('GetSugarcrmAccount',{'options':{'raw':![],'attributes':['id','name',_0x32fa('0x1'),_0x32fa('0x2'),_0x32fa('0x3'),_0x32fa('0x4')],'include':[{'model':_0x32fa('0x5'),'as':_0x32fa('0x6'),'attributes':['id','name'],'include':[{'model':_0x32fa('0x7'),'as':_0x32fa('0x8'),'attributes':['id',_0x32fa('0x9'),_0x32fa('0xa'),_0x32fa('0xb')],'include':[{'model':'Variable','as':_0x32fa('0xc'),'attributes':['id',_0x32fa('0xd')]}]},{'model':'SugarcrmField','as':_0x32fa('0xe'),'attributes':['id','type',_0x32fa('0xa'),_0x32fa('0xf'),_0x32fa('0x10'),_0x32fa('0x11'),_0x32fa('0xb')],'include':[{'model':_0x32fa('0xc'),'as':_0x32fa('0xc'),'attributes':['id',_0x32fa('0xd')]}]},{'model':_0x32fa('0x7'),'as':_0x32fa('0x12'),'attributes':['id',_0x32fa('0x9'),_0x32fa('0xa'),_0x32fa('0x13'),_0x32fa('0x14'),_0x32fa('0x15'),_0x32fa('0xb')],'include':[{'model':_0x32fa('0xc'),'as':'Variable','attributes':['id','name']}]}]}]},'log':_0x32fa('0x16')});};};
\ No newline at end of file
+var _0xd317=['Configurations','SugarcrmField','Subjects','type','content','variableName','Descriptions','keyType','Variable','Fields','idField','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','username','password','SugarcrmConfiguration'];(function(_0x1c3685,_0x12d8bc){var _0x253820=function(_0x142d7e){while(--_0x142d7e){_0x1c3685['push'](_0x1c3685['shift']());}};_0x253820(++_0x12d8bc);}(_0xd317,0x1df));var _0x7d31=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xd317[_0x209941];return _0x1e8729;};'use strict';var client=require('../../client');exports[_0x7d31('0x0')]=function(){return function(_0x21c68e){return client[_0x7d31('0x1')](_0x7d31('0x2'),{'options':{'raw':![],'attributes':['id',_0x7d31('0x3'),_0x7d31('0x4'),_0x7d31('0x5'),'remoteUri','serverUrl'],'include':[{'model':_0x7d31('0x6'),'as':_0x7d31('0x7'),'attributes':['id',_0x7d31('0x3')],'include':[{'model':_0x7d31('0x8'),'as':_0x7d31('0x9'),'attributes':['id',_0x7d31('0xa'),_0x7d31('0xb'),_0x7d31('0xc')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x7d31('0x3')]}]},{'model':_0x7d31('0x8'),'as':_0x7d31('0xd'),'attributes':['id',_0x7d31('0xa'),'content','key',_0x7d31('0xe'),'keyContent',_0x7d31('0xc')],'include':[{'model':_0x7d31('0xf'),'as':_0x7d31('0xf'),'attributes':['id',_0x7d31('0x3')]}]},{'model':_0x7d31('0x8'),'as':_0x7d31('0x10'),'attributes':['id',_0x7d31('0xa'),_0x7d31('0xb'),_0x7d31('0x11'),'nameField','customField','variableName'],'include':[{'model':_0x7d31('0xf'),'as':_0x7d31('0xf'),'attributes':['id','name']}]}]}]},'log':_0x7d31('0x2')});};};
\ No newline at end of file
index ace57a0..e7d1874 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe4c1=['Descriptions','keyType','keyContent','Fields','nameField','customField','../../client','getVtigerAccounts','GetVtigerAccount','name','description','accessKey','remoteUri','serverUrl','VtigerConfiguration','Configurations','VtigerField','Subjects','type','content','variableName','Variable'];(function(_0x23ee99,_0x5a5cdf){var _0x202e63=function(_0x1dda56){while(--_0x1dda56){_0x23ee99['push'](_0x23ee99['shift']());}};_0x202e63(++_0x5a5cdf);}(_0xe4c1,0x150));var _0x1e4c=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0xe4c1[_0x32b542];return _0x554d54;};'use strict';var client=require(_0x1e4c('0x0'));exports[_0x1e4c('0x1')]=function(){return function(_0x34a853){return client['Request'](_0x1e4c('0x2'),{'options':{'raw':![],'attributes':['id',_0x1e4c('0x3'),_0x1e4c('0x4'),'username',_0x1e4c('0x5'),_0x1e4c('0x6'),_0x1e4c('0x7')],'include':[{'model':_0x1e4c('0x8'),'as':_0x1e4c('0x9'),'attributes':['id',_0x1e4c('0x3')],'include':[{'model':_0x1e4c('0xa'),'as':_0x1e4c('0xb'),'attributes':['id',_0x1e4c('0xc'),_0x1e4c('0xd'),_0x1e4c('0xe')],'include':[{'model':_0x1e4c('0xf'),'as':_0x1e4c('0xf'),'attributes':['id','name']}]},{'model':_0x1e4c('0xa'),'as':_0x1e4c('0x10'),'attributes':['id','type',_0x1e4c('0xd'),'key',_0x1e4c('0x11'),_0x1e4c('0x12'),_0x1e4c('0xe')],'include':[{'model':_0x1e4c('0xf'),'as':_0x1e4c('0xf'),'attributes':['id',_0x1e4c('0x3')]}]},{'model':_0x1e4c('0xa'),'as':_0x1e4c('0x13'),'attributes':['id','type',_0x1e4c('0xd'),'idField',_0x1e4c('0x14'),_0x1e4c('0x15'),_0x1e4c('0xe')],'include':[{'model':_0x1e4c('0xf'),'as':_0x1e4c('0xf'),'attributes':['id',_0x1e4c('0x3')]}]}]}]},'log':'GetVtigerAccount'});};};
\ No newline at end of file
+var _0xd191=['nameField','customField','../../client','getVtigerAccounts','Request','GetVtigerAccount','name','description','username','accessKey','remoteUri','VtigerConfiguration','Configurations','VtigerField','Subjects','variableName','Variable','Descriptions','type','content'];(function(_0x1b903c,_0x3e369c){var _0x41b5ed=function(_0x12ee24){while(--_0x12ee24){_0x1b903c['push'](_0x1b903c['shift']());}};_0x41b5ed(++_0x3e369c);}(_0xd191,0x66));var _0x1d19=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd191[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x1d19('0x0'));exports[_0x1d19('0x1')]=function(){return function(_0x9dcd16){return client[_0x1d19('0x2')](_0x1d19('0x3'),{'options':{'raw':![],'attributes':['id',_0x1d19('0x4'),_0x1d19('0x5'),_0x1d19('0x6'),_0x1d19('0x7'),_0x1d19('0x8'),'serverUrl'],'include':[{'model':_0x1d19('0x9'),'as':_0x1d19('0xa'),'attributes':['id',_0x1d19('0x4')],'include':[{'model':_0x1d19('0xb'),'as':_0x1d19('0xc'),'attributes':['id','type','content',_0x1d19('0xd')],'include':[{'model':'Variable','as':_0x1d19('0xe'),'attributes':['id',_0x1d19('0x4')]}]},{'model':_0x1d19('0xb'),'as':_0x1d19('0xf'),'attributes':['id',_0x1d19('0x10'),_0x1d19('0x11'),'key','keyType','keyContent',_0x1d19('0xd')],'include':[{'model':_0x1d19('0xe'),'as':_0x1d19('0xe'),'attributes':['id','name']}]},{'model':_0x1d19('0xb'),'as':'Fields','attributes':['id',_0x1d19('0x10'),'content','idField',_0x1d19('0x12'),_0x1d19('0x13'),_0x1d19('0xd')],'include':[{'model':_0x1d19('0xe'),'as':_0x1d19('0xe'),'attributes':['id','name']}]}]}]},'log':'GetVtigerAccount'});};};
\ No newline at end of file
index db75632..ac46196 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc6f9=['password','token','serverUrl','ZendeskConfiguration','Configurations','ZendeskField','Subjects','content','variableName','Variable','Descriptions','type','key','keyType','keyContent','Fields','idField','nameField','../../client','getZendeskAccounts','Request','GetZendeskAccount','name'];(function(_0x5c39bc,_0x2f176c){var _0x4a7d0e=function(_0x20983e){while(--_0x20983e){_0x5c39bc['push'](_0x5c39bc['shift']());}};_0x4a7d0e(++_0x2f176c);}(_0xc6f9,0x85));var _0x9c6f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc6f9[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x9c6f('0x0'));exports[_0x9c6f('0x1')]=function(){return function(_0x5bb333){return client[_0x9c6f('0x2')](_0x9c6f('0x3'),{'options':{'raw':![],'attributes':['id',_0x9c6f('0x4'),'username',_0x9c6f('0x5'),_0x9c6f('0x6'),'remoteUri','authType',_0x9c6f('0x7'),'type'],'include':[{'model':_0x9c6f('0x8'),'as':_0x9c6f('0x9'),'attributes':['id',_0x9c6f('0x4')],'include':[{'model':'Tag','attributes':['id','name']},{'model':_0x9c6f('0xa'),'as':_0x9c6f('0xb'),'attributes':['id','type',_0x9c6f('0xc'),_0x9c6f('0xd')],'include':[{'model':_0x9c6f('0xe'),'as':'Variable','attributes':['id',_0x9c6f('0x4')]}]},{'model':_0x9c6f('0xa'),'as':_0x9c6f('0xf'),'attributes':['id',_0x9c6f('0x10'),'content',_0x9c6f('0x11'),_0x9c6f('0x12'),_0x9c6f('0x13'),_0x9c6f('0xd')],'include':[{'model':_0x9c6f('0xe'),'as':_0x9c6f('0xe'),'attributes':['id',_0x9c6f('0x4')]}]},{'model':_0x9c6f('0xa'),'as':_0x9c6f('0x14'),'attributes':['id',_0x9c6f('0x10'),'content',_0x9c6f('0x15'),_0x9c6f('0x16'),'customField',_0x9c6f('0xd')],'include':[{'model':_0x9c6f('0xe'),'as':'Variable','attributes':['id','name']}]}]}]},'log':_0x9c6f('0x3')});};};
\ No newline at end of file
+var _0x7817=['authType','serverUrl','name','Tag','Subjects','type','content','variableName','ZendeskField','Descriptions','key','keyType','keyContent','Variable','Fields','nameField','customField','../../client','getZendeskAccounts','Request','GetZendeskAccount','username','password','token','remoteUri'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7817,0xa7));var _0x7781=function(_0x18998f,_0x37010c){_0x18998f=_0x18998f-0x0;var _0x96aad9=_0x7817[_0x18998f];return _0x96aad9;};'use strict';var client=require(_0x7781('0x0'));exports[_0x7781('0x1')]=function(){return function(_0x5dcc94){return client[_0x7781('0x2')](_0x7781('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x7781('0x4'),_0x7781('0x5'),_0x7781('0x6'),_0x7781('0x7'),_0x7781('0x8'),_0x7781('0x9'),'type'],'include':[{'model':'ZendeskConfiguration','as':'Configurations','attributes':['id',_0x7781('0xa')],'include':[{'model':_0x7781('0xb'),'attributes':['id',_0x7781('0xa')]},{'model':'ZendeskField','as':_0x7781('0xc'),'attributes':['id',_0x7781('0xd'),_0x7781('0xe'),_0x7781('0xf')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x7781('0xa')]}]},{'model':_0x7781('0x10'),'as':_0x7781('0x11'),'attributes':['id','type','content',_0x7781('0x12'),_0x7781('0x13'),_0x7781('0x14'),_0x7781('0xf')],'include':[{'model':'Variable','as':_0x7781('0x15'),'attributes':['id',_0x7781('0xa')]}]},{'model':_0x7781('0x10'),'as':_0x7781('0x16'),'attributes':['id',_0x7781('0xd'),_0x7781('0xe'),'idField',_0x7781('0x17'),_0x7781('0x18'),'variableName'],'include':[{'model':'Variable','as':_0x7781('0x15'),'attributes':['id',_0x7781('0xa')]}]}]}]},'log':'GetZendeskAccount'});};};
\ No newline at end of file
index 2c1983c..fcae1f3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x69fd=['GetZohoAccount','name','authToken','host','serverUrl','ZohoConfiguration','Configurations','ZohoField','Subjects','type','content','variableName','Variable','Descriptions','key','keyType','keyContent','idField','nameField','../../client','getZohoAccounts'];(function(_0x4f84c3,_0x6d094d){var _0x460f9f=function(_0x5af5bd){while(--_0x5af5bd){_0x4f84c3['push'](_0x4f84c3['shift']());}};_0x460f9f(++_0x6d094d);}(_0x69fd,0xbb));var _0xd69f=function(_0x2c559f,_0x33d686){_0x2c559f=_0x2c559f-0x0;var _0x2448ea=_0x69fd[_0x2c559f];return _0x2448ea;};'use strict';var client=require(_0xd69f('0x0'));exports[_0xd69f('0x1')]=function(){return function(_0x172169){return client['Request'](_0xd69f('0x2'),{'options':{'raw':![],'attributes':['id',_0xd69f('0x3'),'description',_0xd69f('0x4'),_0xd69f('0x5'),_0xd69f('0x6')],'include':[{'model':_0xd69f('0x7'),'as':_0xd69f('0x8'),'attributes':['id',_0xd69f('0x3')],'include':[{'model':_0xd69f('0x9'),'as':_0xd69f('0xa'),'attributes':['id',_0xd69f('0xb'),_0xd69f('0xc'),_0xd69f('0xd')],'include':[{'model':_0xd69f('0xe'),'as':'Variable','attributes':['id','name']}]},{'model':_0xd69f('0x9'),'as':_0xd69f('0xf'),'attributes':['id',_0xd69f('0xb'),_0xd69f('0xc'),_0xd69f('0x10'),_0xd69f('0x11'),_0xd69f('0x12'),_0xd69f('0xd')],'include':[{'model':_0xd69f('0xe'),'as':_0xd69f('0xe'),'attributes':['id',_0xd69f('0x3')]}]},{'model':_0xd69f('0x9'),'as':'Fields','attributes':['id','type',_0xd69f('0xc'),_0xd69f('0x13'),_0xd69f('0x14'),'customField','variableName'],'include':[{'model':_0xd69f('0xe'),'as':_0xd69f('0xe'),'attributes':['id',_0xd69f('0x3')]}]}]}]},'log':_0xd69f('0x2')});};};
\ No newline at end of file
+var _0xd9eb=['Configurations','name','ZohoField','Subjects','type','content','variableName','Variable','Descriptions','keyContent','idField','nameField','customField','GetZohoAccount','authToken','serverUrl','ZohoConfiguration'];(function(_0xa26906,_0x3e8a36){var _0x3d209a=function(_0x1d5f3a){while(--_0x1d5f3a){_0xa26906['push'](_0xa26906['shift']());}};_0x3d209a(++_0x3e8a36);}(_0xd9eb,0x183));var _0xbd9e=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0xd9eb[_0x4b174a];return _0x3cd7bf;};'use strict';var client=require('../../client');exports['getZohoAccounts']=function(){return function(_0x4e4c0d){return client['Request'](_0xbd9e('0x0'),{'options':{'raw':![],'attributes':['id','name','description',_0xbd9e('0x1'),'host',_0xbd9e('0x2')],'include':[{'model':_0xbd9e('0x3'),'as':_0xbd9e('0x4'),'attributes':['id',_0xbd9e('0x5')],'include':[{'model':_0xbd9e('0x6'),'as':_0xbd9e('0x7'),'attributes':['id',_0xbd9e('0x8'),_0xbd9e('0x9'),_0xbd9e('0xa')],'include':[{'model':_0xbd9e('0xb'),'as':_0xbd9e('0xb'),'attributes':['id',_0xbd9e('0x5')]}]},{'model':_0xbd9e('0x6'),'as':_0xbd9e('0xc'),'attributes':['id','type',_0xbd9e('0x9'),'key','keyType',_0xbd9e('0xd'),'variableName'],'include':[{'model':_0xbd9e('0xb'),'as':_0xbd9e('0xb'),'attributes':['id',_0xbd9e('0x5')]}]},{'model':_0xbd9e('0x6'),'as':'Fields','attributes':['id','type',_0xbd9e('0x9'),_0xbd9e('0xe'),_0xbd9e('0xf'),_0xbd9e('0x10'),_0xbd9e('0xa')],'include':[{'model':_0xbd9e('0xb'),'as':_0xbd9e('0xb'),'attributes':['id',_0xbd9e('0x5')]}]}]}]},'log':_0xbd9e('0x0')});};};
\ No newline at end of file
index f587e7d..0d074fd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe1d6=['lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','agent','accountcode','voiceDialReport','membername','endtime','starttime','outbound','dialstring','uniqueid','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice'];(function(_0x4dedc5,_0x771d24){var _0x1c36a9=function(_0x24b9eb){while(--_0x24b9eb){_0x4dedc5['push'](_0x4dedc5['shift']());}};_0x1c36a9(++_0x771d24);}(_0xe1d6,0x1a9));var _0x6e1d=function(_0x304d85,_0x3bd383){_0x304d85=_0x304d85-0x0;var _0x570077=_0xe1d6[_0x304d85];return _0x570077;};'use strict';var moment=require('moment');var _=require(_0x6e1d('0x0'));var util=require(_0x6e1d('0x1'));var client=require(_0x6e1d('0x2'));exports[_0x6e1d('0x3')]=function(_0x2bea68){var _0x19e9df=_0x2bea68[_0x6e1d('0x4')]||_0x2bea68[_0x6e1d('0x5')];return client[_0x6e1d('0x6')](_0x6e1d('0x7'),{'body':{'channel':_0x6e1d('0x8'),'membername':_0x2bea68[_0x6e1d('0x9')],'interface':_[_0x6e1d('0xa')](_0x2bea68[_0x6e1d('0xb')])?util[_0x6e1d('0xc')](_0x6e1d('0xd'),_0x2bea68['lastAssignedTo']):_0x2bea68['interface'],'type':_0x6e1d('0xe'),'enterAt':_0x2bea68[_0x6e1d('0xf')],'exitAt':_0x19e9df,'duration':moment(_0x19e9df)[_0x6e1d('0x10')](_0x2bea68[_0x6e1d('0xf')],_0x6e1d('0x11')),'data1':_0x6e1d('0x12'),'data2':_0x2bea68[_0x6e1d('0x13')],'data3':_0x2bea68[_0x6e1d('0x14')],'data4':null,'data5':_0x2bea68[_0x6e1d('0x15')],'role':_0x6e1d('0x16'),'internal':_0x2bea68[_0x6e1d('0x17')]?_['toNumber'](_0x2bea68[_0x6e1d('0x17')]):undefined,'uniqueid':_0x2bea68['uniqueid']},'log':_0x6e1d('0x7')});};exports[_0x6e1d('0x18')]=function(_0x3b0f05){return client[_0x6e1d('0x6')]('CreateMemberReport',{'body':{'channel':'voice','membername':_0x3b0f05[_0x6e1d('0x19')],'interface':_0x3b0f05['interface'],'type':_0x6e1d('0xe'),'enterAt':_0x3b0f05['starttime'],'exitAt':_0x3b0f05['endtime'],'duration':moment(_0x3b0f05[_0x6e1d('0x1a')])['diff'](_0x3b0f05[_0x6e1d('0x1b')],_0x6e1d('0x11'))>=0x0?moment(_0x3b0f05[_0x6e1d('0x1a')])[_0x6e1d('0x10')](_0x3b0f05[_0x6e1d('0x1b')],'seconds'):null,'data1':_0x6e1d('0x1c'),'data2':_0x3b0f05['accountcode'],'data3':_0x3b0f05[_0x6e1d('0x14')],'data4':_0x3b0f05[_0x6e1d('0x1d')]||null,'role':_0x6e1d('0x16'),'internal':_0x3b0f05[_0x6e1d('0x17')]?_['toNumber'](_0x3b0f05[_0x6e1d('0x17')]):undefined,'uniqueid':_0x3b0f05[_0x6e1d('0x1e')]},'log':_0x6e1d('0x7')});};
\ No newline at end of file
+var _0x6583=['queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','toNumber','accountcode','uniqueid','voiceDialReport','membername','starttime','endtime','outbound','agent','moment','util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','interface','format','TALKING'];(function(_0x3c4e61,_0x395968){var _0x2154c2=function(_0xffb106){while(--_0xffb106){_0x3c4e61['push'](_0x3c4e61['shift']());}};_0x2154c2(++_0x395968);}(_0x6583,0x1bf));var _0x3658=function(_0x104853,_0x2fa75a){_0x104853=_0x104853-0x0;var _0x200369=_0x6583[_0x104853];return _0x200369;};'use strict';var moment=require(_0x3658('0x0'));var _=require('lodash');var util=require(_0x3658('0x1'));var client=require('../client');exports[_0x3658('0x2')]=function(_0x2fcba2){var _0x2ea689=_0x2fcba2[_0x3658('0x3')]||_0x2fcba2[_0x3658('0x4')];return client[_0x3658('0x5')](_0x3658('0x6'),{'body':{'channel':_0x3658('0x7'),'membername':_0x2fcba2[_0x3658('0x8')],'interface':_['isNil'](_0x2fcba2[_0x3658('0x9')])?util[_0x3658('0xa')]('SIP/%s',_0x2fcba2[_0x3658('0x8')]):_0x2fcba2['interface'],'type':_0x3658('0xb'),'enterAt':_0x2fcba2[_0x3658('0xc')],'exitAt':_0x2ea689,'duration':moment(_0x2ea689)[_0x3658('0xd')](_0x2fcba2[_0x3658('0xc')],_0x3658('0xe')),'data1':_0x3658('0xf'),'data2':_0x2fcba2[_0x3658('0x10')],'data3':_0x2fcba2[_0x3658('0x11')],'data4':null,'data5':_0x2fcba2['queue'],'role':'agent','internal':_0x2fcba2['accountcode']?_[_0x3658('0x12')](_0x2fcba2[_0x3658('0x13')]):undefined,'uniqueid':_0x2fcba2[_0x3658('0x14')]},'log':_0x3658('0x6')});};exports[_0x3658('0x15')]=function(_0x11b10b){return client[_0x3658('0x5')](_0x3658('0x6'),{'body':{'channel':_0x3658('0x7'),'membername':_0x11b10b[_0x3658('0x16')],'interface':_0x11b10b[_0x3658('0x9')],'type':_0x3658('0xb'),'enterAt':_0x11b10b[_0x3658('0x17')],'exitAt':_0x11b10b[_0x3658('0x18')],'duration':moment(_0x11b10b[_0x3658('0x18')])[_0x3658('0xd')](_0x11b10b[_0x3658('0x17')],_0x3658('0xe'))>=0x0?moment(_0x11b10b[_0x3658('0x18')])['diff'](_0x11b10b['starttime'],_0x3658('0xe')):null,'data1':_0x3658('0x19'),'data2':_0x11b10b[_0x3658('0x13')],'data3':_0x11b10b[_0x3658('0x11')],'data4':_0x11b10b['dialstring']||null,'role':_0x3658('0x1a'),'internal':_0x11b10b[_0x3658('0x13')]?_['toNumber'](_0x11b10b[_0x3658('0x13')]):undefined,'uniqueid':_0x11b10b['uniqueid']},'log':_0x3658('0x6')});};
\ No newline at end of file
index fba72ca..39b66c6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbeec=['GetTemplate','name','html','getTemplates','Request'];(function(_0x3aa30f,_0x1a3e24){var _0x37d9a5=function(_0x101697){while(--_0x101697){_0x3aa30f['push'](_0x3aa30f['shift']());}};_0x37d9a5(++_0x1a3e24);}(_0xbeec,0x1b1));var _0xcbee=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbeec[_0x2dafbe];return _0x58a45a;};'use strict';var client=require('../client');exports[_0xcbee('0x0')]=function(_0x1bf565){return function(_0x10e643){return client[_0xcbee('0x1')](_0xcbee('0x2'),{'options':{'raw':!![],'attributes':['id',_0xcbee('0x3'),_0xcbee('0x4')]},'log':_0xcbee('0x2')});};};
\ No newline at end of file
+var _0xed8c=['getTemplates','GetTemplate','name','../client'];(function(_0x4a6560,_0x1037e5){var _0x261d98=function(_0x326e6b){while(--_0x326e6b){_0x4a6560['push'](_0x4a6560['shift']());}};_0x261d98(++_0x1037e5);}(_0xed8c,0x15f));var _0xced8=function(_0x25f1e8,_0x3b306f){_0x25f1e8=_0x25f1e8-0x0;var _0x820923=_0xed8c[_0x25f1e8];return _0x820923;};'use strict';var client=require(_0xced8('0x0'));exports[_0xced8('0x1')]=function(_0x5e96e6){return function(_0x262feb){return client['Request'](_0xced8('0x2'),{'options':{'raw':!![],'attributes':['id',_0xced8('0x3'),'html']},'log':_0xced8('0x2')});};};
\ No newline at end of file
index 90e9c76..3456ba3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['data3','data4','data5','../client','getTriggers','GetTrigger','channel','status','Condition','AllConditions','field','value','AnyConditions','action','data1','data2'];(function(_0x47228e,_0x823ada){var _0x58c5e2=function(_0x3d2392){while(--_0x3d2392){_0x47228e['push'](_0x47228e['shift']());}};_0x58c5e2(++_0x823ada);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(_0x29929c){return function(_0x5dd881){return client['Request'](_0x0a9e('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),_0x0a9e('0x4')],'include':[{'model':_0x0a9e('0x5'),'as':_0x0a9e('0x6'),'attributes':['id',_0x0a9e('0x7'),'operator',_0x0a9e('0x8')]},{'model':_0x0a9e('0x5'),'as':_0x0a9e('0x9'),'attributes':['id','field','operator',_0x0a9e('0x8')]},{'model':'Action','as':'Actions','attributes':['id',_0x0a9e('0xa'),_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),'data6','data7']}]},'log':'GetTrigger'});};};
\ No newline at end of file
+var _0xa9e0=['data3','data4','data5','../client','getTriggers','GetTrigger','channel','status','Condition','AllConditions','field','value','AnyConditions','action','data1','data2'];(function(_0x329384,_0x5eec18){var _0x301586=function(_0x59063e){while(--_0x59063e){_0x329384['push'](_0x329384['shift']());}};_0x301586(++_0x5eec18);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(_0x29929c){return function(_0x5dd881){return client['Request'](_0x0a9e('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),_0x0a9e('0x4')],'include':[{'model':_0x0a9e('0x5'),'as':_0x0a9e('0x6'),'attributes':['id',_0x0a9e('0x7'),'operator',_0x0a9e('0x8')]},{'model':_0x0a9e('0x5'),'as':_0x0a9e('0x9'),'attributes':['id','field','operator',_0x0a9e('0x8')]},{'model':'Action','as':'Actions','attributes':['id',_0x0a9e('0xa'),_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),'data6','data7']}]},'log':'GetTrigger'});};};
\ No newline at end of file
index 61eb481..7e0bb7f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcdce=['registry','../client','getTrunks','Request','GetTrunk','name'];(function(_0x3d39cc,_0x28ad43){var _0x4bb0b6=function(_0x97c134){while(--_0x97c134){_0x3d39cc['push'](_0x3d39cc['shift']());}};_0x4bb0b6(++_0x28ad43);}(_0xcdce,0xb5));var _0xecdc=function(_0x3b7577,_0x5c92ed){_0x3b7577=_0x3b7577-0x0;var _0x69491b=_0xcdce[_0x3b7577];return _0x69491b;};'use strict';var client=require(_0xecdc('0x0'));exports[_0xecdc('0x1')]=function(_0x2df04b){return function(_0x46fa30){return client[_0xecdc('0x2')](_0xecdc('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xecdc('0x4'),_0xecdc('0x5')]},'log':_0xecdc('0x3')});};};
\ No newline at end of file
+var _0x227e=['../client','getTrunks','GetTrunk','name','registry'];(function(_0x2300fa,_0x41c382){var _0x11fef0=function(_0x597ffb){while(--_0x597ffb){_0x2300fa['push'](_0x2300fa['shift']());}};_0x11fef0(++_0x41c382);}(_0x227e,0xaf));var _0xe227=function(_0x2c4346,_0xb0c6fa){_0x2c4346=_0x2c4346-0x0;var _0x1b59dd=_0x227e[_0x2c4346];return _0x1b59dd;};'use strict';var client=require(_0xe227('0x0'));exports[_0xe227('0x1')]=function(_0x344b1c){return function(_0x5856fc){return client['Request'](_0xe227('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xe227('0x3'),_0xe227('0x4')]},'log':_0xe227('0x2')});};};
\ No newline at end of file
index 23d0875..3bcf34c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcbb9=['UnpauseUser','ShowUser','agent','pauseType','lastPauseAt','getAgent','../client','getAgents','name','accountcode','fullname','online','lastLoginAt','phone','mobile','interface','getTelephones','Request','GetUser','telephone','internal','PauseUser','savePause'];(function(_0x3c6ae2,_0x5c52d8){var _0x4edda=function(_0x5593eb){while(--_0x5593eb){_0x3c6ae2['push'](_0x3c6ae2['shift']());}};_0x4edda(++_0x5c52d8);}(_0xcbb9,0xa7));var _0x9cbb=function(_0x1b1cd4,_0x59e578){_0x1b1cd4=_0x1b1cd4-0x0;var _0x218641=_0xcbb9[_0x1b1cd4];return _0x218641;};'use strict';var client=require(_0x9cbb('0x0'));exports[_0x9cbb('0x1')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x9cbb('0x2'),'email',_0x9cbb('0x3'),_0x9cbb('0x4'),_0x9cbb('0x5'),_0x9cbb('0x6'),'pauseType','lastPauseAt','voicePause',_0x9cbb('0x7'),_0x9cbb('0x8'),_0x9cbb('0x9')]},'log':_0x9cbb('0x1')});};};exports[_0x9cbb('0xa')]=function(){return function(){return client[_0x9cbb('0xb')](_0x9cbb('0xc'),{'options':{'raw':!![],'where':{'role':_0x9cbb('0xd')},'attributes':['id',_0x9cbb('0x2'),'accountcode',_0x9cbb('0xe')]},'log':_0x9cbb('0xa')});};};exports['savePause']=function(_0x31ea3b,_0x34d0c8,_0x4eaa8b){return client[_0x9cbb('0xb')](_0x9cbb('0xf'),{'body':{'type':_0x34d0c8,'uniqueid':_0x4eaa8b},'options':{'where':{'id':_0x31ea3b['id']}},'log':_0x9cbb('0x10')});};exports['saveUnpause']=function(_0x37e249){return client[_0x9cbb('0xb')](_0x9cbb('0x11'),{'body':{},'options':{'where':{'id':_0x37e249['id']}},'log':_0x9cbb('0x10')});};exports['getAgent']=function(_0x49f685){return client[_0x9cbb('0xb')](_0x9cbb('0x12'),{'options':{'raw':![],'where':{'role':_0x9cbb('0x13'),'id':_0x49f685},'attributes':['id',_0x9cbb('0x2'),'email',_0x9cbb('0x3'),'fullname',_0x9cbb('0x5'),_0x9cbb('0x6'),_0x9cbb('0x14'),_0x9cbb('0x15'),'voicePause',_0x9cbb('0x9')]},'log':_0x9cbb('0x16')});};
\ No newline at end of file
+var _0x0775=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','lastPauseAt','../client','getAgents','Request','GetUser','agent','email','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','interface','getTelephones','telephone','name'];(function(_0x3374db,_0x3b178c){var _0x4d8156=function(_0xb06700){while(--_0xb06700){_0x3374db['push'](_0x3374db['shift']());}};_0x4d8156(++_0x3b178c);}(_0x0775,0x126));var _0x5077=function(_0x4da079,_0x13666b){_0x4da079=_0x4da079-0x0;var _0x1cb152=_0x0775[_0x4da079];return _0x1cb152;};'use strict';var client=require(_0x5077('0x0'));exports[_0x5077('0x1')]=function(){return function(){return client[_0x5077('0x2')](_0x5077('0x3'),{'options':{'raw':![],'where':{'role':_0x5077('0x4')},'attributes':['id','name',_0x5077('0x5'),_0x5077('0x6'),_0x5077('0x7'),_0x5077('0x8'),_0x5077('0x9'),_0x5077('0xa'),'lastPauseAt',_0x5077('0xb'),_0x5077('0xc'),_0x5077('0xd'),_0x5077('0xe')]},'log':'getAgents'});};};exports[_0x5077('0xf')]=function(){return function(){return client['Request'](_0x5077('0x3'),{'options':{'raw':!![],'where':{'role':_0x5077('0x10')},'attributes':['id',_0x5077('0x11'),_0x5077('0x6'),_0x5077('0x12')]},'log':_0x5077('0xf')});};};exports[_0x5077('0x13')]=function(_0xdbe4cf,_0x2b99c2,_0xdc6acd){return client[_0x5077('0x2')](_0x5077('0x14'),{'body':{'type':_0x2b99c2,'uniqueid':_0xdc6acd},'options':{'where':{'id':_0xdbe4cf['id']}},'log':'savePause'});};exports[_0x5077('0x15')]=function(_0x5d51df){return client[_0x5077('0x2')](_0x5077('0x16'),{'body':{},'options':{'where':{'id':_0x5d51df['id']}},'log':_0x5077('0x13')});};exports[_0x5077('0x17')]=function(_0x31bfc8){return client['Request'](_0x5077('0x18'),{'options':{'raw':![],'where':{'role':_0x5077('0x4'),'id':_0x31bfc8},'attributes':['id',_0x5077('0x11'),'email',_0x5077('0x6'),_0x5077('0x7'),_0x5077('0x8'),_0x5077('0x9'),_0x5077('0xa'),_0x5077('0x19'),_0x5077('0xb'),_0x5077('0xe')]},'log':'getAgent'});};
\ No newline at end of file
index 86c19bc..ebcc7d1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x85e5=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create'];(function(_0x3bdb10,_0x5a57b2){var _0x3bcf27=function(_0x1e7e7c){while(--_0x1e7e7c){_0x3bdb10['push'](_0x3bdb10['shift']());}};_0x3bcf27(++_0x5a57b2);}(_0x85e5,0xfa));var _0x585e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x85e5[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x585e('0x0'));exports[_0x585e('0x1')]=function(_0x123eb6){return client[_0x585e('0x2')](_0x585e('0x3'),{'body':_0x123eb6,'log':_0x585e('0x3')});};exports[_0x585e('0x4')]=function(_0xf3b6a9,_0x266ac8,_0x3557e8){return client[_0x585e('0x2')](_0x585e('0x5'),{'body':_0xf3b6a9,'options':{'where':{'uniqueid':_0x266ac8,'interface':_0x3557e8}},'log':_0x585e('0x5')});};
\ No newline at end of file
+var _0x8f9f=['../client','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x17b382,_0x4ff4ef){var _0x50f5cf=function(_0x14517d){while(--_0x14517d){_0x17b382['push'](_0x17b382['shift']());}};_0x50f5cf(++_0x4ff4ef);}(_0x8f9f,0xf5));var _0xf8f9=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x8f9f[_0x599f41];return _0x2e4d58;};'use strict';var client=require(_0xf8f9('0x0'));exports['create']=function(_0x7af31f){return client[_0xf8f9('0x1')](_0xf8f9('0x2'),{'body':_0x7af31f,'log':_0xf8f9('0x2')});};exports[_0xf8f9('0x3')]=function(_0x5e25b3,_0x36963d,_0x4a8713){return client[_0xf8f9('0x1')](_0xf8f9('0x4'),{'body':_0x5e25b3,'options':{'where':{'uniqueid':_0x36963d,'interface':_0x4a8713}},'log':'UpdateVoiceAgentReport'});};
\ No newline at end of file
index 3c48895..7cc20fb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xae6e=['outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','disposition','duration','billableseconds','GetVoiceCallReports','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport'];(function(_0x441563,_0x1d4a28){var _0x2369ec=function(_0x1f97ba){while(--_0x1f97ba){_0x441563['push'](_0x441563['shift']());}};_0x2369ec(++_0x1d4a28);}(_0xae6e,0x191));var _0xeae6=function(_0x1c9c4b,_0x403c99){_0x1c9c4b=_0x1c9c4b-0x0;var _0x338adf=_0xae6e[_0x1c9c4b];return _0x338adf;};'use strict';var moment=require('moment');var util=require(_0xeae6('0x0'));var _=require(_0xeae6('0x1'));var client=require(_0xeae6('0x2'));exports[_0xeae6('0x3')]=function(_0x5c6c49){return client[_0xeae6('0x4')](_0xeae6('0x5'),{'body':_[_0xeae6('0x6')](_0x5c6c49,{'source':_0x5c6c49[_0xeae6('0x7')],'destinationcontext':_0x5c6c49[_0xeae6('0x8')],'callerid':_0x5c6c49[_0xeae6('0x9')],'amaflags':_0xeae6('0xa')}),'log':_0xeae6('0x5')});};exports[_0xeae6('0xb')]=function(){return function(){return client[_0xeae6('0x4')](_0xeae6('0xc'),{'options':{'where':{'type':[_0xeae6('0xd')],'createdAt':{'$between':[moment()[_0xeae6('0xe')](_0xeae6('0xf'))['format'](_0xeae6('0x10')),moment()[_0xeae6('0x11')](_0xeae6('0xf'))[_0xeae6('0x12')](_0xeae6('0x10'))]}},'attributes':['type',_0xeae6('0x13'),_0xeae6('0x14'),_0xeae6('0x15')]},'log':_0xeae6('0x16')});};};
\ No newline at end of file
+var _0x6d64=['util','lodash','../client','create','Request','merge','calleridnum','context','DOCUMENTATION','CreateVoiceCallReport','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports'];(function(_0x13884c,_0x3dab89){var _0x325d15=function(_0x3e0451){while(--_0x3e0451){_0x13884c['push'](_0x13884c['shift']());}};_0x325d15(++_0x3dab89);}(_0x6d64,0x1a4));var _0x46d6=function(_0x23d88f,_0x40e44d){_0x23d88f=_0x23d88f-0x0;var _0x5a4d8d=_0x6d64[_0x23d88f];return _0x5a4d8d;};'use strict';var moment=require('moment');var util=require(_0x46d6('0x0'));var _=require(_0x46d6('0x1'));var client=require(_0x46d6('0x2'));exports[_0x46d6('0x3')]=function(_0x59d916){return client[_0x46d6('0x4')]('CreateVoiceCallReport',{'body':_[_0x46d6('0x5')](_0x59d916,{'source':_0x59d916[_0x46d6('0x6')],'destinationcontext':_0x59d916[_0x46d6('0x7')],'callerid':_0x59d916['callerid'],'amaflags':_0x46d6('0x8')}),'log':_0x46d6('0x9')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x46d6('0x4')](_0x46d6('0xa'),{'options':{'where':{'type':[_0x46d6('0xb')],'createdAt':{'$between':[moment()[_0x46d6('0xc')](_0x46d6('0xd'))[_0x46d6('0xe')](_0x46d6('0xf')),moment()['endOf'](_0x46d6('0xd'))[_0x46d6('0xe')](_0x46d6('0xf'))]}},'attributes':[_0x46d6('0x10'),_0x46d6('0x11'),_0x46d6('0x12'),_0x46d6('0x13')]},'log':_0x46d6('0x14')});};};
\ No newline at end of file
index 62c3cdd..c8a28c8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x39a1=['create','Request','CreateVoiceDialReport','../client'];(function(_0x44d02e,_0x12c830){var _0x633355=function(_0x376b7b){while(--_0x376b7b){_0x44d02e['push'](_0x44d02e['shift']());}};_0x633355(++_0x12c830);}(_0x39a1,0x6f));var _0x139a=function(_0x45491e,_0xf33c7b){_0x45491e=_0x45491e-0x0;var _0x3f45f2=_0x39a1[_0x45491e];return _0x3f45f2;};'use strict';var client=require(_0x139a('0x0'));exports[_0x139a('0x1')]=function(_0x21f21c){return client[_0x139a('0x2')](_0x139a('0x3'),{'body':_0x21f21c,'log':'CreateVoiceDialReport'});};
\ No newline at end of file
+var _0xeae7=['Request','CreateVoiceDialReport'];(function(_0x14d175,_0x230bf7){var _0x2946e9=function(_0x417219){while(--_0x417219){_0x14d175['push'](_0x14d175['shift']());}};_0x2946e9(++_0x230bf7);}(_0xeae7,0x1ee));var _0x7eae=function(_0x3a9635,_0x1ab817){_0x3a9635=_0x3a9635-0x0;var _0x10d08c=_0xeae7[_0x3a9635];return _0x10d08c;};'use strict';var client=require('../client');exports['create']=function(_0x3cd2f){return client[_0x7eae('0x0')](_0x7eae('0x1'),{'body':_0x3cd2f,'log':_0x7eae('0x1')});};
\ No newline at end of file
index 66948c7..49eacc1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe815=['getVoiceExtensions','../client','GetVoiceExtension','exten'];(function(_0x3ed7c5,_0x24aff3){var _0x572938=function(_0x5c3bb3){while(--_0x5c3bb3){_0x3ed7c5['push'](_0x3ed7c5['shift']());}};_0x572938(++_0x24aff3);}(_0xe815,0x159));var _0x5e81=function(_0x4a325e,_0x18a3de){_0x4a325e=_0x4a325e-0x0;var _0x271c91=_0xe815[_0x4a325e];return _0x271c91;};'use strict';var client=require(_0x5e81('0x0'));exports['getVoiceExtensions']=function(){return function(){return client['Request'](_0x5e81('0x1'),{'options':{'raw':!![],'attributes':['id',_0x5e81('0x2'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x5e81('0x3')});};};
\ No newline at end of file
+var _0xd7ce=['../client','getVoiceExtensions','recordingFormat'];(function(_0x261522,_0x1adc1f){var _0x98a25a=function(_0x1b0f9c){while(--_0x1b0f9c){_0x261522['push'](_0x261522['shift']());}};_0x98a25a(++_0x1adc1f);}(_0xd7ce,0xf3));var _0xed7c=function(_0x39ffd1,_0x299703){_0x39ffd1=_0x39ffd1-0x0;var _0x31267e=_0xd7ce[_0x39ffd1];return _0x31267e;};'use strict';var client=require(_0xed7c('0x0'));exports[_0xed7c('0x1')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten',_0xed7c('0x2')],'where':{'VoiceExtensionId':null}},'log':_0xed7c('0x1')});};};
\ No newline at end of file
index 341510d..4e56c6a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9c2c=['acw','autopause','monitor_format','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','name','active','Pause','callerid','Interval','Intervals','interval','../client','getVoiceQueues'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xc9c2('0x0'));exports[_0xc9c2('0x1')]=function(){return function(){return client['Request']('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name',_0xc9c2('0x2'),'acwTimeout',_0xc9c2('0x3'),_0xc9c2('0x4'),'type','dialActive',_0xc9c2('0x5'),'dialLimitChannel',_0xc9c2('0x6'),_0xc9c2('0x7'),_0xc9c2('0x8'),_0xc9c2('0x9'),_0xc9c2('0xa'),_0xc9c2('0xb'),_0xc9c2('0xc'),_0xc9c2('0xd'),_0xc9c2('0xe'),'dialQueueTimeout',_0xc9c2('0xf'),'dialCongestionMaxRetry',_0xc9c2('0x10'),_0xc9c2('0x11'),_0xc9c2('0x12'),_0xc9c2('0x13'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0xc9c2('0x14'),_0xc9c2('0x15'),'dialPrefix',_0xc9c2('0x16'),_0xc9c2('0x17'),_0xc9c2('0x18'),_0xc9c2('0x19'),_0xc9c2('0x1a'),_0xc9c2('0x1b'),_0xc9c2('0x1c'),_0xc9c2('0x1d'),_0xc9c2('0x1e'),_0xc9c2('0x1f'),_0xc9c2('0x20'),_0xc9c2('0x21'),'dialRecallMeTimeout',_0xc9c2('0x22'),_0xc9c2('0x23'),_0xc9c2('0x24'),_0xc9c2('0x25'),_0xc9c2('0x26'),'monitor_format',_0xc9c2('0x27'),_0xc9c2('0x28'),_0xc9c2('0x29'),'mandatoryDisposition'],'include':[{'model':_0xc9c2('0x2a'),'as':_0xc9c2('0x2a'),'attributes':['id',_0xc9c2('0x2b'),'callerid',_0xc9c2('0x2c')]},{'model':_0xc9c2('0x2d'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0xc9c2('0x2a'),'as':'TrunkBackup','attributes':['id',_0xc9c2('0x2b'),_0xc9c2('0x2e'),_0xc9c2('0x2c')]},{'model':_0xc9c2('0x2f'),'as':_0xc9c2('0x2f'),'attributes':['id','name'],'include':[{'model':_0xc9c2('0x2f'),'as':_0xc9c2('0x30'),'attributes':['id',_0xc9c2('0x2b'),_0xc9c2('0x31')]}]}]},'log':_0xc9c2('0x1')});};};
\ No newline at end of file
+var _0x5668=['interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialOriginateCallerIdName','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','callerid','Pause','TrunkBackup','active','Interval','Intervals'];(function(_0x6ceedb,_0x2ea13d){var _0x36df5d=function(_0x1c179c){while(--_0x1c179c){_0x6ceedb['push'](_0x6ceedb['shift']());}};_0x36df5d(++_0x2ea13d);}(_0x5668,0x8b));var _0x8566=function(_0x176d01,_0x4098d3){_0x176d01=_0x176d01-0x0;var _0x233c8e=_0x5668[_0x176d01];return _0x233c8e;};'use strict';var client=require(_0x8566('0x0'));exports[_0x8566('0x1')]=function(){return function(){return client[_0x8566('0x2')](_0x8566('0x3'),{'options':{'raw':![],'attributes':['id',_0x8566('0x4'),_0x8566('0x5'),_0x8566('0x6'),_0x8566('0x7'),_0x8566('0x8'),_0x8566('0x9'),_0x8566('0xa'),_0x8566('0xb'),_0x8566('0xc'),'dialLimitQueue',_0x8566('0xd'),_0x8566('0xe'),'dialPredictiveOptimizationPercentage','dialPredictiveInterval',_0x8566('0xf'),'dialOriginateCallerIdNumber','dialOriginateTimeout',_0x8566('0x10'),'dialQueueTimeout',_0x8566('0x11'),_0x8566('0x12'),_0x8566('0x13'),'dialBusyMaxRetry',_0x8566('0x14'),_0x8566('0x15'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval',_0x8566('0x16'),_0x8566('0x17'),_0x8566('0x18'),_0x8566('0x19'),_0x8566('0x1a'),'dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords',_0x8566('0x1b'),_0x8566('0x1c'),_0x8566('0x1d'),_0x8566('0x1e'),_0x8566('0x1f'),'dialOrderByScheduledAt',_0x8566('0x20'),_0x8566('0x21'),_0x8566('0x22'),'monitor_format',_0x8566('0x23'),_0x8566('0x24'),_0x8566('0x25'),'mandatoryDisposition'],'include':[{'model':_0x8566('0x26'),'as':'Trunk','attributes':['id','name',_0x8566('0x27'),'active']},{'model':_0x8566('0x28'),'as':'mandatoryDispositionPause','attributes':['id',_0x8566('0x4')]},{'model':_0x8566('0x26'),'as':_0x8566('0x29'),'attributes':['id',_0x8566('0x4'),_0x8566('0x27'),_0x8566('0x2a')]},{'model':_0x8566('0x2b'),'as':'Interval','attributes':['id','name'],'include':[{'model':_0x8566('0x2b'),'as':_0x8566('0x2c'),'attributes':['id',_0x8566('0x4'),_0x8566('0x2d')]}]}]},'log':'getVoiceQueues'});};};
\ No newline at end of file
index 2977053..c89a168 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8fb2=['Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','endOf','day','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queuecallerjoinAt','queuecallerleaveAt','queuecallercompleteAt','queuecallerexit','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client'];(function(_0x35b870,_0x11ad5f){var _0x143d6e=function(_0x3c2c89){while(--_0x3c2c89){_0x35b870['push'](_0x35b870['shift']());}};_0x143d6e(++_0x11ad5f);}(_0x8fb2,0x129));var _0x28fb=function(_0x2b581e,_0x1384e2){_0x2b581e=_0x2b581e-0x0;var _0x2c37e2=_0x8fb2[_0x2b581e];return _0x2c37e2;};'use strict';var moment=require(_0x28fb('0x0'));var _=require(_0x28fb('0x1'));var client=require(_0x28fb('0x2'));exports['create']=function(_0x1252b){return client[_0x28fb('0x3')](_0x28fb('0x4'),{'body':_0x1252b,'log':_0x28fb('0x4')});};exports[_0x28fb('0x5')]=function(){return function(){return client['Request'](_0x28fb('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x28fb('0x7')]('day')[_0x28fb('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x28fb('0x9')](_0x28fb('0xa'))[_0x28fb('0x8')](_0x28fb('0xb'))]}},'attributes':[_0x28fb('0xc'),'queue',_0x28fb('0xd'),_0x28fb('0xe'),'queuecallercomplete',_0x28fb('0xf'),_0x28fb('0x10'),'queuecallerexitAt',_0x28fb('0x11'),_0x28fb('0x12')]},'log':_0x28fb('0x13')});};};
\ No newline at end of file
+var _0xa1e2=['create','CreateVoiceQueueReport','Request','GetVoiceQueueReport','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','queuecallerabandon','GetVoiceQueueReports','moment','../client'];(function(_0x53dcac,_0x351c81){var _0x372c8e=function(_0x3d9eca){while(--_0x3d9eca){_0x53dcac['push'](_0x53dcac['shift']());}};_0x372c8e(++_0x351c81);}(_0xa1e2,0xcf));var _0x2a1e=function(_0x23a1d4,_0x43a39e){_0x23a1d4=_0x23a1d4-0x0;var _0x754563=_0xa1e2[_0x23a1d4];return _0x754563;};'use strict';var moment=require(_0x2a1e('0x0'));var _=require('lodash');var client=require(_0x2a1e('0x1'));exports[_0x2a1e('0x2')]=function(_0x227f2d){return client['Request'](_0x2a1e('0x3'),{'body':_0x227f2d,'log':_0x2a1e('0x3')});};exports['getVoiceQueueReports']=function(){return function(){return client[_0x2a1e('0x4')](_0x2a1e('0x5'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x2a1e('0x6'))[_0x2a1e('0x7')](_0x2a1e('0x8')),moment()[_0x2a1e('0x9')](_0x2a1e('0x6'))[_0x2a1e('0x7')](_0x2a1e('0x8'))]}},'attributes':[_0x2a1e('0xa'),_0x2a1e('0xb'),_0x2a1e('0xc'),_0x2a1e('0xd'),_0x2a1e('0xe'),'queuecallercompleteAt',_0x2a1e('0xf'),_0x2a1e('0x10'),_0x2a1e('0x11'),'queuecallerabandonAt']},'log':_0x2a1e('0x12')});};};
\ No newline at end of file
index 4de079e..d4e43f1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x10b4=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x5c7c9d,_0x38f9c4){var _0x5e8212=function(_0x472d78){while(--_0x472d78){_0x5c7c9d['push'](_0x5c7c9d['shift']());}};_0x5e8212(++_0x38f9c4);}(_0x10b4,0x1b5));var _0x410b=function(_0x43d16c,_0x2b5447){_0x43d16c=_0x43d16c-0x0;var _0x208cce=_0x10b4[_0x43d16c];return _0x208cce;};'use strict';var client=require(_0x410b('0x0'));exports[_0x410b('0x1')]=function(_0xb27f8d){return function(){return client[_0x410b('0x2')](_0x410b('0x3'),{'options':{'where':{'VoiceQueueId':_0xb27f8d,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};};
\ No newline at end of file
+var _0xf0d3=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x5a4fe4,_0x13daca){var _0x42aa6e=function(_0x42703c){while(--_0x42703c){_0x5a4fe4['push'](_0x5a4fe4['shift']());}};_0x42aa6e(++_0x13daca);}(_0xf0d3,0x10c));var _0x3f0d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf0d3[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x3f0d('0x0'));exports[_0x3f0d('0x1')]=function(_0x545bbd){return function(){return client['Request'](_0x3f0d('0x2'),{'options':{'where':{'VoiceQueueId':_0x545bbd,'paused':!![]},'raw':!![]},'log':_0x3f0d('0x1')});};};
\ No newline at end of file
index 567fdc6..b249000 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xefaf=['lodash','create','Request','CreateVoiceRecording','merge','monitorFilename'];(function(_0x4d6503,_0x4c078d){var _0x40210a=function(_0x478479){while(--_0x478479){_0x4d6503['push'](_0x4d6503['shift']());}};_0x40210a(++_0x4c078d);}(_0xefaf,0x17a));var _0xfefa=function(_0x2b91c5,_0x3b6db5){_0x2b91c5=_0x2b91c5-0x0;var _0xbd5531=_0xefaf[_0x2b91c5];return _0xbd5531;};'use strict';var _=require(_0xfefa('0x0'));var client=require('../client');exports[_0xfefa('0x1')]=function(_0x18c6f3){return client[_0xfefa('0x2')](_0xfefa('0x3'),{'body':_[_0xfefa('0x4')](_0x18c6f3,{'value':_0x18c6f3[_0xfefa('0x5')]}),'log':'CreateVoiceRecording'});};
\ No newline at end of file
+var _0xb647=['CreateVoiceRecording','merge','monitorFilename','../client','create','Request'];(function(_0x4b2fb4,_0x33008f){var _0x53ae51=function(_0x37d78d){while(--_0x37d78d){_0x4b2fb4['push'](_0x4b2fb4['shift']());}};_0x53ae51(++_0x33008f);}(_0xb647,0x1b9));var _0x7b64=function(_0x1eed29,_0x389c41){_0x1eed29=_0x1eed29-0x0;var _0x52efda=_0xb647[_0x1eed29];return _0x52efda;};'use strict';var _=require('lodash');var client=require(_0x7b64('0x0'));exports[_0x7b64('0x1')]=function(_0x34df59){return client[_0x7b64('0x2')](_0x7b64('0x3'),{'body':_[_0x7b64('0x4')](_0x34df59,{'value':_0x34df59[_0x7b64('0x5')]}),'log':_0x7b64('0x3')});};
\ No newline at end of file
index a601c69..96de408 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6a29=['../client','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','blind','attendedTransfer','Request','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','origtransferercontext','origtransfererexten'];(function(_0x10165c,_0x5ad2b4){var _0x454073=function(_0x3ca33c){while(--_0x3ca33c){_0x10165c['push'](_0x10165c['shift']());}};_0x454073(++_0x5ad2b4);}(_0x6a29,0x9c));var _0x96a2=function(_0x20f5bb,_0x4538ed){_0x20f5bb=_0x20f5bb-0x0;var _0x22c379=_0x6a29[_0x20f5bb];return _0x22c379;};'use strict';var client=require(_0x96a2('0x0'));exports['blindTransfer']=function(_0x256733){return client['Request'](_0x96a2('0x1'),{'body':{'result':_0x256733[_0x96a2('0x2')],'transfererchannel':_0x256733[_0x96a2('0x3')],'transferercalleridnum':_0x256733[_0x96a2('0x4')],'transferercalleridname':_0x256733['transferercalleridname'],'transfererconnectedlinenum':_0x256733[_0x96a2('0x5')],'transfererconnectedlinename':_0x256733[_0x96a2('0x6')],'transfereraccountcode':_0x256733[_0x96a2('0x7')],'transferercontext':_0x256733[_0x96a2('0x8')],'transfererexten':_0x256733[_0x96a2('0x9')],'transfererlinkedid':_0x256733[_0x96a2('0xa')],'transfereechannel':_0x256733[_0x96a2('0xb')],'transfereecalleridnum':_0x256733[_0x96a2('0xc')],'transfereecalleridname':_0x256733[_0x96a2('0xd')],'transfereeconnectedlinenum':_0x256733['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x256733[_0x96a2('0xe')],'transfereeaccountcode':_0x256733[_0x96a2('0xf')],'transfereecontext':_0x256733[_0x96a2('0x10')],'transfereeexten':_0x256733[_0x96a2('0x11')],'transfereelinkedid':_0x256733[_0x96a2('0x12')],'isexternal':_0x256733[_0x96a2('0x13')],'context':_0x256733[_0x96a2('0x14')],'extension':_0x256733['extension'],'type':_0x96a2('0x15')},'log':'CreateVoiceTransferReport'});};exports[_0x96a2('0x16')]=function(_0xb7a01e){return client[_0x96a2('0x17')](_0x96a2('0x1'),{'body':{'result':_0xb7a01e[_0x96a2('0x2')],'transfererchannel':_0xb7a01e[_0x96a2('0x18')],'transferercalleridnum':_0xb7a01e[_0x96a2('0x19')],'transferercalleridname':_0xb7a01e[_0x96a2('0x1a')],'transfererconnectedlinenum':_0xb7a01e['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0xb7a01e[_0x96a2('0x1b')],'transfereraccountcode':_0xb7a01e[_0x96a2('0x1c')],'transferercontext':_0xb7a01e[_0x96a2('0x1d')],'transfererexten':_0xb7a01e[_0x96a2('0x1e')],'transfererlinkedid':_0xb7a01e[_0x96a2('0x1f')],'transfereechannel':_0xb7a01e[_0x96a2('0x20')],'transfereecalleridnum':_0xb7a01e[_0x96a2('0x21')],'transfereecalleridname':_0xb7a01e[_0x96a2('0x22')],'transfereeconnectedlinenum':_0xb7a01e[_0x96a2('0x23')],'transfereeconnectedlinename':_0xb7a01e['transfertargetconnectedlinename'],'transfereeaccountcode':_0xb7a01e[_0x96a2('0x24')],'transfereecontext':_0xb7a01e['transfertargetcontext'],'transfereeexten':_0xb7a01e['transfertargetexten'],'transfereelinkedid':_0xb7a01e['transfertargetlinkedid'],'isexternal':_0xb7a01e[_0x96a2('0x13')],'context':_0xb7a01e[_0x96a2('0x25')],'extension':_0xb7a01e[_0x96a2('0x26')],'type':'attended'},'log':'CreateVoiceTransferReport'});};
\ No newline at end of file
+var _0xb198=['origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','blind','attendedTransfer','origtransferercalleridnum'];(function(_0x1bdca2,_0x173eff){var _0x45a947=function(_0x5a790d){while(--_0x5a790d){_0x1bdca2['push'](_0x1bdca2['shift']());}};_0x45a947(++_0x173eff);}(_0xb198,0x161));var _0x8b19=function(_0x53cc66,_0x5162fc){_0x53cc66=_0x53cc66-0x0;var _0x6effae=_0xb198[_0x53cc66];return _0x6effae;};'use strict';var client=require(_0x8b19('0x0'));exports[_0x8b19('0x1')]=function(_0x240503){return client[_0x8b19('0x2')](_0x8b19('0x3'),{'body':{'result':_0x240503[_0x8b19('0x4')],'transfererchannel':_0x240503['transfererchannel'],'transferercalleridnum':_0x240503[_0x8b19('0x5')],'transferercalleridname':_0x240503[_0x8b19('0x6')],'transfererconnectedlinenum':_0x240503[_0x8b19('0x7')],'transfererconnectedlinename':_0x240503[_0x8b19('0x8')],'transfereraccountcode':_0x240503['transfereraccountcode'],'transferercontext':_0x240503[_0x8b19('0x9')],'transfererexten':_0x240503[_0x8b19('0xa')],'transfererlinkedid':_0x240503[_0x8b19('0xb')],'transfereechannel':_0x240503[_0x8b19('0xc')],'transfereecalleridnum':_0x240503[_0x8b19('0xd')],'transfereecalleridname':_0x240503[_0x8b19('0xe')],'transfereeconnectedlinenum':_0x240503[_0x8b19('0xf')],'transfereeconnectedlinename':_0x240503['transfereeconnectedlinename'],'transfereeaccountcode':_0x240503[_0x8b19('0x10')],'transfereecontext':_0x240503[_0x8b19('0x11')],'transfereeexten':_0x240503[_0x8b19('0x12')],'transfereelinkedid':_0x240503[_0x8b19('0x13')],'isexternal':_0x240503[_0x8b19('0x14')],'context':_0x240503[_0x8b19('0x15')],'extension':_0x240503['extension'],'type':_0x8b19('0x16')},'log':_0x8b19('0x3')});};exports[_0x8b19('0x17')]=function(_0x1c6a24){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x1c6a24[_0x8b19('0x4')],'transfererchannel':_0x1c6a24['origtransfererchannel'],'transferercalleridnum':_0x1c6a24[_0x8b19('0x18')],'transferercalleridname':_0x1c6a24[_0x8b19('0x19')],'transfererconnectedlinenum':_0x1c6a24[_0x8b19('0x1a')],'transfererconnectedlinename':_0x1c6a24[_0x8b19('0x1b')],'transfereraccountcode':_0x1c6a24[_0x8b19('0x1c')],'transferercontext':_0x1c6a24[_0x8b19('0x1d')],'transfererexten':_0x1c6a24['secondtransfererexten'],'transfererlinkedid':_0x1c6a24[_0x8b19('0x1e')],'transfereechannel':_0x1c6a24[_0x8b19('0x1f')],'transfereecalleridnum':_0x1c6a24[_0x8b19('0x20')],'transfereecalleridname':_0x1c6a24[_0x8b19('0x21')],'transfereeconnectedlinenum':_0x1c6a24[_0x8b19('0x22')],'transfereeconnectedlinename':_0x1c6a24[_0x8b19('0x23')],'transfereeaccountcode':_0x1c6a24[_0x8b19('0x24')],'transfereecontext':_0x1c6a24['transfertargetcontext'],'transfereeexten':_0x1c6a24[_0x8b19('0x25')],'transfereelinkedid':_0x1c6a24[_0x8b19('0x26')],'isexternal':_0x1c6a24[_0x8b19('0x14')],'context':_0x1c6a24[_0x8b19('0x27')],'extension':_0x1c6a24[_0x8b19('0x28')],'type':_0x8b19('0x29')},'log':'CreateVoiceTransferReport'});};
\ No newline at end of file
index b2b8033..c668263 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4b2d=['resolve','StopMixMonitor','destinationchannel','stop','wav','StopMixMonitor\x20Success','queueChannels','username','voicequeuechannelredirect','exten','context','telephones','outbound','campaigns','run','event','emit','send','checkAfterSend','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','util','jayson/promise','validate','bluebird','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','error','asterisk','join','pick','module','action','Reload','then','catch','message','isConnected','ami\x20disconnected','Command','voiceQueues','hasOwnProperty','strategy','loggedIn','pTalking','sumDuration','talking','total','type','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','Trunk','name','active','callerid','Interval','push','values','channels','voicechannel','length','map','channel','%s.%s','filename','uniqueid','Action','MixMonitor','ai(mixmonitorid)','find','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','mixmonitorid','status','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist'];(function(_0x4cffbd,_0xa37adc){var _0x36a7fc=function(_0x2f600a){while(--_0x2f600a){_0x4cffbd['push'](_0x4cffbd['shift']());}};_0x36a7fc(++_0xa37adc);}(_0x4b2d,0x96));var _0xd4b2=function(_0x58e8eb,_0x2ac0c7){_0x58e8eb=_0x58e8eb-0x0;var _0x168540=_0x4b2d[_0x58e8eb];return _0x168540;};'use strict';var _=require('lodash');var util=require(_0xd4b2('0x0'));var jayson=require(_0xd4b2('0x1'));var schema=require(_0xd4b2('0x2'));var BPromise=require(_0xd4b2('0x3'));var moment=require('moment');var config=require(_0xd4b2('0x4'));var properties=require(_0xd4b2('0x5'));var ami=require(_0xd4b2('0x6'));exports[_0xd4b2('0x7')]=function(_0x4536c3,_0x7e60c3,_0x3b7afb){return new BPromise(function(_0x24cd0c,_0x10434c){var _0x1bfc2e={'QueuePause':function(_0x11d9d2){return new Promise(function(_0x5b17c9,_0x2b821d){var _0x1b1317=util[_0xd4b2('0x8')](_0xd4b2('0x9'),_0xd4b2('0xa'),_0x11d9d2['name']);if(_0x4536c3[_0xd4b2('0xb')]&&_0x4536c3['timers'][_0x1b1317]&&_0x4536c3[_0xd4b2('0xb')][_0x1b1317][_0xd4b2('0xc')]){_0x4536c3['timers'][_0x1b1317][_0xd4b2('0xd')]();}if(_0x4536c3[_0xd4b2('0xe')][_0x1b1317]){_0x4536c3[_0xd4b2('0xe')][_0x1b1317][_0xd4b2('0xf')]({'statePause':_0x11d9d2[_0xd4b2('0x10')]?!![]:![]});}_0x5b17c9({'code':0xc8,'message':_0xd4b2('0x11')});});},'Reload':function(_0x3728b6){var _0x1627f7=this;return new Promise(function(_0x24d5dc,_0x3b0667){if(ami['isConnected']()==![]){return _0x3b0667(_0x1627f7[_0xd4b2('0x12')](0x1f4,[config['asterisk']['ip'],config[_0xd4b2('0x13')]['username'],'ami\x20disconnected'][_0xd4b2('0x14')]('\x20')));}_0x3728b6=_[_0xd4b2('0x15')](_0x3728b6,_['keys'](properties[_0xd4b2('0x16')]));_0x3728b6[_0xd4b2('0x17')]=_0xd4b2('0x18');return ami['Action'](_0x3728b6)[_0xd4b2('0x19')](function(_0x2bf3d8){_0x24d5dc({'code':0xc8,'message':_0x2bf3d8['message']});})[_0xd4b2('0x1a')](function(_0x4fc390){_0x3b0667(_0x1627f7[_0xd4b2('0x12')](0x1f5,_0x4fc390[_0xd4b2('0x1b')]));});});},'Command':function(_0x43b2c8){var _0x6532e6=this;return new Promise(function(_0x2ae001,_0x39efb1){if(ami[_0xd4b2('0x1c')]()==![]){return _0x39efb1(_0x6532e6[_0xd4b2('0x12')](0x1f4,[config[_0xd4b2('0x13')]['ip'],config[_0xd4b2('0x13')]['username'],_0xd4b2('0x1d')][_0xd4b2('0x14')]('\x20')));}_0x43b2c8=_[_0xd4b2('0x15')](_0x43b2c8,'command');_0x43b2c8[_0xd4b2('0x17')]=_0xd4b2('0x1e');return ami['Action'](_0x43b2c8)['then'](function(_0x3f6bc3){_0x2ae001({'code':0xc8,'message':_0x3f6bc3['content']});})[_0xd4b2('0x1a')](function(_0x3d2301){_0x39efb1(_0x6532e6['error'](0x1f5,_0x3d2301['message']));});});},'VoiceQueues':function(_0x4bcada){return new Promise(function(_0x3e4878,_0x481c01){var _0x8a55be=[];for(var _0x543b41 in _0x4536c3['voiceQueues']){if(_0x4536c3[_0xd4b2('0x1f')][_0xd4b2('0x20')](_0x543b41)){var _0x5568a3=_0x4536c3[_0xd4b2('0x1f')][_0x543b41];var _0x5db1e1={'id':_0x5568a3['id'],'name':_0x5568a3['name'],'strategy':_0x5568a3[_0xd4b2('0x21')],'answered':_0x5568a3['answered'],'available':_0x5568a3['available'],'loggedIn':_0x5568a3[_0xd4b2('0x22')],'pTalking':_0x5568a3[_0xd4b2('0x23')],'sumBillable':_0x5568a3['sumBillable'],'sumDuration':_0x5568a3[_0xd4b2('0x24')],'sumHoldTime':_0x5568a3['sumHoldTime']||0x0,'talking':_0x5568a3[_0xd4b2('0x25')],'total':_0x5568a3[_0xd4b2('0x26')],'type':_0x5568a3[_0xd4b2('0x27')],'unmanaged':_0x5568a3[_0xd4b2('0x28')],'abandoned':_0x5568a3[_0xd4b2('0x29')],'waiting':_0x5568a3[_0xd4b2('0x2a')],'loggedInDb':_0x5568a3['loggedInDb']};if(_0x5568a3['type']==='outbound'){_0x5db1e1[_0xd4b2('0x2b')]=_0x5568a3[_0xd4b2('0x2b')];_0x5db1e1[_0xd4b2('0x2c')]=_0x5568a3[_0xd4b2('0x2c')];_0x5db1e1[_0xd4b2('0x2d')]=_0x5568a3[_0xd4b2('0x2d')];_0x5db1e1['dialOriginateCallerIdNumber']=_0x5568a3[_0xd4b2('0x2e')];_0x5db1e1[_0xd4b2('0x2f')]=_0x5568a3[_0xd4b2('0x2f')];_0x5db1e1[_0xd4b2('0x30')]=_0x5568a3['dialPrefix'];_0x5db1e1[_0xd4b2('0x31')]=_0x5568a3[_0xd4b2('0x31')];_0x5db1e1['outboundAnswerCallsDay']=_0x5568a3[_0xd4b2('0x32')];_0x5db1e1[_0xd4b2('0x33')]=_0x5568a3[_0xd4b2('0x33')];_0x5db1e1[_0xd4b2('0x34')]=_0x5568a3[_0xd4b2('0x34')];_0x5db1e1[_0xd4b2('0x35')]=_0x5568a3['outboundCongestionCallsDay'];_0x5db1e1[_0xd4b2('0x36')]=_0x5568a3[_0xd4b2('0x36')];_0x5db1e1[_0xd4b2('0x37')]=_0x5568a3['outboundDropCallsDayCallersExit'];_0x5db1e1['outboundDropCallsDayTimeout']=_0x5568a3[_0xd4b2('0x38')];_0x5db1e1[_0xd4b2('0x39')]=_0x5568a3['outboundNoAnswerCallsDay'];_0x5db1e1['outboundNoSuchCallsDay']=_0x5568a3['outboundNoSuchCallsDay'];_0x5db1e1['outboundOriginateFailureCallsDay']=_0x5568a3[_0xd4b2('0x3a')];_0x5db1e1[_0xd4b2('0x3b')]=_0x5568a3['outboundReCallsDay'];_0x5db1e1['outboundRejectCallsDay']=_0x5568a3[_0xd4b2('0x3c')];_0x5db1e1[_0xd4b2('0x3d')]=_0x5568a3[_0xd4b2('0x3d')];_0x5db1e1[_0xd4b2('0x3e')]=_0x5568a3[_0xd4b2('0x3e')];_0x5db1e1[_0xd4b2('0x3f')]=_0x5568a3['predictiveIntervalAvgHoldtime'];_0x5db1e1[_0xd4b2('0x40')]=_0x5568a3[_0xd4b2('0x40')];_0x5db1e1['predictiveIntervalDroppedCallsCallersExit']=_0x5568a3['predictiveIntervalDroppedCallsCallersExit'];_0x5db1e1[_0xd4b2('0x41')]=_0x5568a3[_0xd4b2('0x41')];_0x5db1e1[_0xd4b2('0x42')]=_0x5568a3['predictiveIntervalErlangCalls'];_0x5db1e1[_0xd4b2('0x43')]=_0x5568a3['predictiveIntervalErlangCallsDroppedCalls'];_0x5db1e1['predictiveIntervalHitRate']=_0x5568a3[_0xd4b2('0x44')];_0x5db1e1[_0xd4b2('0x45')]=_0x5568a3['predictiveIntervalLowerLimit'];_0x5db1e1[_0xd4b2('0x46')]=_0x5568a3['predictiveIntervalMultiplicativeFactor'];_0x5db1e1[_0xd4b2('0x47')]=_0x5568a3[_0xd4b2('0x47')];_0x5db1e1[_0xd4b2('0x48')]=_0x5568a3[_0xd4b2('0x48')];_0x5db1e1[_0xd4b2('0x1b')]=_0x5568a3['message'];_0x5db1e1[_0xd4b2('0x49')]=_0x5568a3[_0xd4b2('0x49')];}if(_0x5568a3[_0xd4b2('0x4a')]){_0x5db1e1[_0xd4b2('0x4a')]={'id':_0x5568a3[_0xd4b2('0x4a')]['id'],'name':_0x5568a3[_0xd4b2('0x4a')][_0xd4b2('0x4b')],'active':_0x5568a3[_0xd4b2('0x4a')][_0xd4b2('0x4c')],'callerid':_0x5568a3[_0xd4b2('0x4a')][_0xd4b2('0x4d')]};}if(_0x5568a3[_0xd4b2('0x4e')]){_0x5db1e1[_0xd4b2('0x4e')]={'id':_0x5568a3[_0xd4b2('0x4e')]['id'],'name':_0x5568a3['Interval'][_0xd4b2('0x4b')]};}_0x8a55be[_0xd4b2('0x4f')](_0x5db1e1);}}_0x3e4878({'count':_0x8a55be['length'],'rows':_0x8a55be});});},'VoiceChannels':function(_0x2032c1){return new Promise(function(_0x25fa2f,_0x69311f){var _0x2fee55=_[_0xd4b2('0x50')](_0x4536c3[_0xd4b2('0x51')]);_0x25fa2f({'count':_0x2fee55['length'],'rows':_0x2fee55});});},'VoiceChannelMixMonitor':function(_0x56ef4e){var _0x49243f=this;return new Promise(function(_0x498ad1,_0x49b602){if(ami[_0xd4b2('0x1c')]()==![]){return _0x49b602(_0x49243f[_0xd4b2('0x12')](0x1f4,[config[_0xd4b2('0x13')]['ip'],config[_0xd4b2('0x13')]['username'],'ami\x20disconnected'][_0xd4b2('0x14')]('\x20')));}var _0x158bbb=schema(properties[_0xd4b2('0x52')])[_0xd4b2('0x2')](_0x56ef4e);if(_0x158bbb[_0xd4b2('0x53')]>0x0){return _0x49b602(_0x49243f['error'](0x1f4,_[_0xd4b2('0x54')](_0x158bbb,_0xd4b2('0x1b'))[_0xd4b2('0x14')](',\x20')));}var _0xcae153=_['find'](_0x4536c3[_0xd4b2('0x51')],{'uniqueid':_0x56ef4e['uniqueid']});if(_0xcae153&&_0xcae153[_0xd4b2('0x55')]){var _0x2243e3=util[_0xd4b2('0x8')](_0xd4b2('0x56'),_0x56ef4e[_0xd4b2('0x57')]||_0x56ef4e[_0xd4b2('0x58')],_0x56ef4e[_0xd4b2('0x8')]||'wav');return ami[_0xd4b2('0x59')]({'action':_0xd4b2('0x5a'),'channel':_0xcae153[_0xd4b2('0x55')],'file':_0x2243e3,'options':_0xd4b2('0x5b')})[_0xd4b2('0x19')](function(_0xb2f7d2){var _0x45ab0c=_[_0xd4b2('0x5c')](_0xcae153[_0xd4b2('0x5d')],{'filename':_0xd4b2('0x5e')+_0x2243e3[_0xd4b2('0x5f')]()});if(_[_0xd4b2('0x60')](_0x45ab0c)){_0xcae153[_0xd4b2('0x5d')][_0xd4b2('0x4f')]({'filename':'/var/spool/asterisk/monitor/'+_0x2243e3[_0xd4b2('0x5f')](),'createdAt':moment()[_0xd4b2('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0xb2f7d2['mixmonitorid'],'status':'rec'});}else{_0x45ab0c[_0xd4b2('0x61')]=_0xb2f7d2[_0xd4b2('0x61')];_0x45ab0c[_0xd4b2('0x62')]=_0xd4b2('0x63');}_0x498ad1({'code':0xc8,'message':[_0x56ef4e[_0xd4b2('0x58')],_0xd4b2('0x64'),_0xb2f7d2[_0xd4b2('0x61')]][_0xd4b2('0x14')]('\x20'),'mixmonitorid':_0xb2f7d2[_0xd4b2('0x61')]});})[_0xd4b2('0x1a')](function(_0x1be0e9){_0x49b602(_0x49243f['error'](0x1f5,[_0x56ef4e[_0xd4b2('0x58')],_0x1be0e9[_0xd4b2('0x1b')][_0xd4b2('0x5f')]()][_0xd4b2('0x14')]('\x20')));});}else{return _0x49b602(_0x49243f[_0xd4b2('0x12')](0x1f5,_0xd4b2('0x65')));}});},'VoiceChannelStopMixMonitor':function(_0x43b6a2){var _0x3362cf=this;return new Promise(function(_0x4e076e,_0x7b3fb1){if(ami[_0xd4b2('0x1c')]()==![]){return _0x7b3fb1(_0x3362cf[_0xd4b2('0x12')](0x1f4,[config[_0xd4b2('0x13')]['ip'],config[_0xd4b2('0x13')]['username'],'ami\x20disconnected'][_0xd4b2('0x14')]('\x20')));}var _0x3df37=schema(properties[_0xd4b2('0x52')])[_0xd4b2('0x2')](_0x43b6a2);if(_0x3df37[_0xd4b2('0x53')]>0x0){return _0x7b3fb1(_0x3362cf[_0xd4b2('0x12')](0x1f4,_[_0xd4b2('0x54')](_0x3df37,_0xd4b2('0x1b'))[_0xd4b2('0x14')](',\x20')));}var _0x548b12=_[_0xd4b2('0x5c')](_0x4536c3[_0xd4b2('0x51')],{'uniqueid':_0x43b6a2[_0xd4b2('0x58')]});if(_0x548b12){return BPromise[_0xd4b2('0x66')]()[_0xd4b2('0x19')](function(){if(_0x548b12[_0xd4b2('0x55')]){return ami[_0xd4b2('0x59')]({'action':_0xd4b2('0x67'),'channel':_0x548b12[_0xd4b2('0x55')],'mixmonitorid':_0x43b6a2[_0xd4b2('0x61')]})[_0xd4b2('0x1a')](function(_0x1be079){});}})[_0xd4b2('0x19')](function(){if(_0x548b12[_0xd4b2('0x68')]){return ami[_0xd4b2('0x59')]({'action':'StopMixMonitor','channel':_0x548b12['destinationchannel'],'mixmonitorid':_0x43b6a2[_0xd4b2('0x61')]})[_0xd4b2('0x1a')](function(_0x1937c6){});}})[_0xd4b2('0x19')](function(_0x418574){var _0x346f20=_[_0xd4b2('0x5c')](_0x548b12[_0xd4b2('0x5d')],{'mixmonitorid':_0x43b6a2[_0xd4b2('0x61')]});if(_0x346f20){_0x346f20[_0xd4b2('0x62')]=_0xd4b2('0x69');}})[_0xd4b2('0x19')](function(){var _0x541ead=util[_0xd4b2('0x8')](_0xd4b2('0x56'),_0x43b6a2[_0xd4b2('0x57')]||_0x43b6a2[_0xd4b2('0x58')],_0x43b6a2[_0xd4b2('0x8')]||_0xd4b2('0x6a'));var _0x47c139=_[_0xd4b2('0x5c')](_0x548b12['monitors'],{'filename':_0xd4b2('0x5e')+_0x541ead[_0xd4b2('0x5f')]()});if(_0x47c139){_0x47c139['status']=_0xd4b2('0x69');}})['then'](function(){_0x4e076e({'code':0xc8,'message':[_0x43b6a2[_0xd4b2('0x58')],_0xd4b2('0x6b')][_0xd4b2('0x14')]('\x20')});})[_0xd4b2('0x1a')](function(_0x25a511){_0x7b3fb1(_0x3362cf[_0xd4b2('0x12')](0x1f5,[_0x43b6a2[_0xd4b2('0x58')],_0x25a511[_0xd4b2('0x1b')][_0xd4b2('0x5f')]()][_0xd4b2('0x14')]('\x20')));});}else{return _0x7b3fb1(_0x3362cf[_0xd4b2('0x12')](0x1f5,_0xd4b2('0x65')));}});},'VoiceQueuesChannels':function(_0x3d81f7){return new Promise(function(_0x3d62f3,_0x33a601){var _0x2dd681=_[_0xd4b2('0x50')](_0x4536c3[_0xd4b2('0x6c')]);_0x3d62f3({'count':_0x2dd681[_0xd4b2('0x53')],'rows':_0x2dd681});});},'VoiceQueuesChannel':function(_0x41c634){var _0x5dfcdc=this;return new Promise(function(_0x3c8dfa,_0x259940){var _0x1abe4e=schema(properties['voicequeuechannel'])[_0xd4b2('0x2')](_0x41c634);if(_0x1abe4e['length']>0x0){return _0x259940(_0x5dfcdc[_0xd4b2('0x12')](0x1f4,_['map'](_0x1abe4e,'message')[_0xd4b2('0x14')](',\x20')));}var _0x14bdd3=_[_0xd4b2('0x5c')](_0x4536c3[_0xd4b2('0x6c')],{'uniqueid':_0x41c634['uniqueid']});if(_0x14bdd3){_0x3c8dfa(_0x14bdd3);}else{return _0x259940(_0x5dfcdc[_0xd4b2('0x12')](0x1f5,_0xd4b2('0x65')));}});},'VoiceQueuesChannelHangup':function(_0x516524){var _0x222f7f=this;return new Promise(function(_0x2b7119,_0x3ed4f6){if(ami[_0xd4b2('0x1c')]()==![]){return _0x3ed4f6(_0x222f7f[_0xd4b2('0x12')](0x1f4,[config[_0xd4b2('0x13')]['ip'],config[_0xd4b2('0x13')][_0xd4b2('0x6d')],'ami\x20disconnected'][_0xd4b2('0x14')]('\x20')));}var _0x36f8a2=schema(properties['voicequeuechannelhangup'])['validate'](_0x516524);if(_0x36f8a2[_0xd4b2('0x53')]>0x0){return _0x3ed4f6(_0x222f7f[_0xd4b2('0x12')](0x1f4,_[_0xd4b2('0x54')](_0x36f8a2,_0xd4b2('0x1b'))[_0xd4b2('0x14')](',\x20')));}var _0x5d2938=_[_0xd4b2('0x5c')](_0x4536c3[_0xd4b2('0x6c')],{'uniqueid':_0x516524[_0xd4b2('0x58')]});if(_0x5d2938&&_0x5d2938[_0xd4b2('0x55')]){return ami[_0xd4b2('0x59')]({'action':'Hangup','channel':_0x5d2938[_0xd4b2('0x55')]})['then'](function(_0x3d21da){_0x2b7119({'code':0xc8,'message':[_0x516524[_0xd4b2('0x58')],_0x3d21da[_0xd4b2('0x1b')]['toLowerCase']()]['join']('\x20')});})[_0xd4b2('0x1a')](function(_0x3c17eb){_0x3ed4f6(_0x222f7f[_0xd4b2('0x12')](0x1f5,[_0x516524[_0xd4b2('0x58')],_0x3c17eb['message'][_0xd4b2('0x5f')]()][_0xd4b2('0x14')]('\x20')));});}else{return _0x3ed4f6(_0x222f7f[_0xd4b2('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x544788){var _0x5b2f2d=this;return new Promise(function(_0xd09f60,_0x2c50b6){if(ami[_0xd4b2('0x1c')]()==![]){return _0x2c50b6(_0x5b2f2d['error'](0x1f4,[config[_0xd4b2('0x13')]['ip'],config[_0xd4b2('0x13')][_0xd4b2('0x6d')],_0xd4b2('0x1d')][_0xd4b2('0x14')]('\x20')));}var _0x2d8f54=schema(properties[_0xd4b2('0x6e')])[_0xd4b2('0x2')](_0x544788);if(_0x2d8f54[_0xd4b2('0x53')]>0x0){return _0x2c50b6(_0x5b2f2d[_0xd4b2('0x12')](0x1f4,_[_0xd4b2('0x54')](_0x2d8f54,_0xd4b2('0x1b'))[_0xd4b2('0x14')](',\x20')));}var _0x1e87b0=_[_0xd4b2('0x5c')](_0x4536c3[_0xd4b2('0x6c')],{'uniqueid':_0x544788[_0xd4b2('0x58')]});if(_0x1e87b0&&_0x1e87b0['channel']){return ami[_0xd4b2('0x59')]({'action':'Redirect','channel':_0x1e87b0[_0xd4b2('0x55')],'exten':_0x544788[_0xd4b2('0x6f')],'context':_0x544788[_0xd4b2('0x70')]||_0x1e87b0[_0xd4b2('0x70')],'priority':0x1})[_0xd4b2('0x19')](function(_0x4b21ff){_0xd09f60({'code':0xc8,'message':[_0x544788[_0xd4b2('0x58')],_0x4b21ff[_0xd4b2('0x1b')][_0xd4b2('0x5f')]()]['join']('\x20')});})[_0xd4b2('0x1a')](function(_0x23cf43){_0x2c50b6(_0x5b2f2d['error'](0x1f5,[_0x544788[_0xd4b2('0x58')],_0x23cf43[_0xd4b2('0x1b')][_0xd4b2('0x5f')]()]['join']('\x20')));});}else{return _0x2c50b6(_0x5b2f2d[_0xd4b2('0x12')](0x1f5,_0xd4b2('0x65')));}});},'Agents':function(_0x105b37){return new Promise(function(_0x17118a,_0x5349e8){var _0x385865=_[_0xd4b2('0x50')](_0x4536c3['agents']);_0x17118a({'count':_0x385865['length'],'rows':_0x385865});});},'Telephones':function(_0x1f9b3f){return new Promise(function(_0x14e021,_0x1e2ed4){var _0x1516fb=_[_0xd4b2('0x50')](_0x4536c3[_0xd4b2('0x71')]);_0x14e021({'count':_0x1516fb[_0xd4b2('0x53')],'rows':_0x1516fb});});},'Trunks':function(_0xf39864){return new Promise(function(_0x17ef99,_0x3f06d7){var _0x241a3a=_['values'](_0x4536c3['trunks']);_0x17ef99({'count':_0x241a3a[_0xd4b2('0x53')],'rows':_0x241a3a});});},'OutboundChannels':function(_0x30a6d5){return new Promise(function(_0x44a150,_0x5362ac){var _0x3a900b=_[_0xd4b2('0x50')](_0x4536c3['outboundChannels']);_0x44a150({'count':_0x3a900b[_0xd4b2('0x53')],'rows':_0x3a900b});});},'Outbound':function(_0x42647f){return new Promise(function(_0x39b2ab,_0x22c32c){_0x39b2ab(_0x4536c3[_0xd4b2('0x72')]);});},'Campaigns':function(_0x100046){return new Promise(function(_0x1e4286,_0xb183ba){var _0x348d40=_['values'](_0x4536c3[_0xd4b2('0x73')]);_0x1e4286({'count':_0x348d40[_0xd4b2('0x53')],'rows':_0x348d40});});},'VoiceQueuesPreview':function(_0x474090){var _0x512637=this;return new Promise(function(_0x2f1ac2,_0x1cec9b){_0x7e60c3[_0xd4b2('0x74')](_0x474090['id'])[_0xd4b2('0x19')](function(_0x5df4b2){_0x2f1ac2({'code':0xc8,'message':_0x5df4b2[_0xd4b2('0x1b')]});})['catch'](function(_0x1e61a4){_0x1cec9b(_0x512637[_0xd4b2('0x12')](0x1f4,_0x1e61a4['message']));});});},'EventManager':function(_0x3f957e){var _0x491370=this;return new Promise(function(_0x14d64f,_0x5f4479){if(!_0x3f957e[_0xd4b2('0x75')]){return _0x5f4479(_0x491370[_0xd4b2('0x12')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xd4b2('0x76')]('custom:'+_0x3f957e[_0xd4b2('0x75')],_0x3f957e[_0xd4b2('0x1b')]);_0x14d64f({'code':0xc8,'message':_0x3f957e});});},'FaxAccounts':function(_0x1e9396){return new Promise(function(_0x440bc2,_0x781040){var _0x537b33=_[_0xd4b2('0x50')](_0x4536c3['faxAccounts']);_0x440bc2({'count':_0x537b33['length'],'rows':_0x537b33});});},'SendFax':function(_0x311280){var _0x56d072=this;return new Promise(function(_0x29cf05,_0x22056a){_0x3b7afb[_0xd4b2('0x77')](_0x311280)[_0xd4b2('0x19')](function(_0x4cbf40){_0x29cf05({'code':0xc8,'message':_0x4cbf40[_0xd4b2('0x1b')]});})['catch'](function(_0x4c4417){_0x22056a(_0x56d072['error'](0x1f4,_0x4c4417[_0xd4b2('0x1b')]));});});},'CheckAfterSend':function(_0x1a28be){var _0x130ef0=this;return new Promise(function(_0x4f0b1b,_0x3f321e){_0x3b7afb[_0xd4b2('0x78')](_0x1a28be)['then'](function(_0x45ef2d){_0x4f0b1b({'code':0xc8,'message':_0x45ef2d[_0xd4b2('0x1b')]});})[_0xd4b2('0x1a')](function(_0x379382){_0x3f321e(_0x130ef0[_0xd4b2('0x12')](0x1f4,_0x379382['message']));});});}};var _0x4f1bbb=jayson[_0xd4b2('0x79')](_0x1bfc2e)[_0xd4b2('0x7a')]();_0x4f1bbb['on'](_0xd4b2('0x12'),function(_0x29da1b){return _0x10434c(_0x29da1b);});_0x4f1bbb[_0xd4b2('0x7')](0x232a,_0xd4b2('0x7b'),function(){console[_0xd4b2('0x7c')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x24cd0c(_0xd4b2('0x7d')+0x232a);});});};
\ No newline at end of file
+var _0x56ab=['telephones','trunks','outboundChannels','run','event','Event\x20name\x20mandatory','custom:','faxAccounts','send','checkAfterSend','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','bluebird','moment','../../../config/environment','../properties','../ami','listen','%s/%s','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','join','pick','module','Reload','Action','then','message','catch','error','username','action','Command','content','voiceQueues','strategy','available','pTalking','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','originated','Trunk','active','Interval','push','values','channels','length','voicechannel','validate','map','find','uniqueid','channel','format','%s.%s','filename','wav','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','ami\x20disconnected','resolve','destinationchannel','stop','toLowerCase','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x56ab,0x8d));var _0xb56a=function(_0x113c84,_0x5104af){_0x113c84=_0x113c84-0x0;var _0x9d573=_0x56ab[_0x113c84];return _0x9d573;};'use strict';var _=require(_0xb56a('0x0'));var util=require(_0xb56a('0x1'));var jayson=require('jayson/promise');var schema=require('validate');var BPromise=require(_0xb56a('0x2'));var moment=require(_0xb56a('0x3'));var config=require(_0xb56a('0x4'));var properties=require(_0xb56a('0x5'));var ami=require(_0xb56a('0x6'));exports[_0xb56a('0x7')]=function(_0x2fee52,_0x30aca2,_0x3b829c){return new BPromise(function(_0x5ba1d8,_0x47519a){var _0x1c2493={'QueuePause':function(_0x423e48){return new Promise(function(_0x5db426,_0x1478d0){var _0x4b26e4=util['format'](_0xb56a('0x8'),'SIP',_0x423e48[_0xb56a('0x9')]);if(_0x2fee52[_0xb56a('0xa')]&&_0x2fee52[_0xb56a('0xa')][_0x4b26e4]&&_0x2fee52[_0xb56a('0xa')][_0x4b26e4][_0xb56a('0xb')]){_0x2fee52[_0xb56a('0xa')][_0x4b26e4][_0xb56a('0xc')]();}if(_0x2fee52[_0xb56a('0xd')][_0x4b26e4]){_0x2fee52[_0xb56a('0xd')][_0x4b26e4][_0xb56a('0xe')]({'statePause':_0x423e48[_0xb56a('0xf')]?!![]:![]});}_0x5db426({'code':0xc8,'message':_0xb56a('0x10')});});},'Reload':function(_0x412a18){var _0x410f7f=this;return new Promise(function(_0x28b15e,_0x5c7fea){if(ami[_0xb56a('0x11')]()==![]){return _0x5c7fea(_0x410f7f['error'](0x1f4,[config[_0xb56a('0x12')]['ip'],config[_0xb56a('0x12')]['username'],'ami\x20disconnected'][_0xb56a('0x13')]('\x20')));}_0x412a18=_[_0xb56a('0x14')](_0x412a18,_['keys'](properties[_0xb56a('0x15')]));_0x412a18['action']=_0xb56a('0x16');return ami[_0xb56a('0x17')](_0x412a18)[_0xb56a('0x18')](function(_0x42f89d){_0x28b15e({'code':0xc8,'message':_0x42f89d[_0xb56a('0x19')]});})[_0xb56a('0x1a')](function(_0xa64739){_0x5c7fea(_0x410f7f[_0xb56a('0x1b')](0x1f5,_0xa64739[_0xb56a('0x19')]));});});},'Command':function(_0x2635d0){var _0x498e24=this;return new Promise(function(_0x20c848,_0x34a69b){if(ami[_0xb56a('0x11')]()==![]){return _0x34a69b(_0x498e24['error'](0x1f4,[config[_0xb56a('0x12')]['ip'],config[_0xb56a('0x12')][_0xb56a('0x1c')],'ami\x20disconnected'][_0xb56a('0x13')]('\x20')));}_0x2635d0=_[_0xb56a('0x14')](_0x2635d0,'command');_0x2635d0[_0xb56a('0x1d')]=_0xb56a('0x1e');return ami[_0xb56a('0x17')](_0x2635d0)[_0xb56a('0x18')](function(_0x1682df){_0x20c848({'code':0xc8,'message':_0x1682df[_0xb56a('0x1f')]});})['catch'](function(_0x48971d){_0x34a69b(_0x498e24[_0xb56a('0x1b')](0x1f5,_0x48971d['message']));});});},'VoiceQueues':function(_0x2b445e){return new Promise(function(_0x2601ea,_0x1950c5){var _0x3e5a82=[];for(var _0x1412e5 in _0x2fee52[_0xb56a('0x20')]){if(_0x2fee52[_0xb56a('0x20')]['hasOwnProperty'](_0x1412e5)){var _0x33173d=_0x2fee52['voiceQueues'][_0x1412e5];var _0x36cf88={'id':_0x33173d['id'],'name':_0x33173d[_0xb56a('0x9')],'strategy':_0x33173d[_0xb56a('0x21')],'answered':_0x33173d['answered'],'available':_0x33173d[_0xb56a('0x22')],'loggedIn':_0x33173d['loggedIn'],'pTalking':_0x33173d[_0xb56a('0x23')],'sumBillable':_0x33173d['sumBillable'],'sumDuration':_0x33173d[_0xb56a('0x24')],'sumHoldTime':_0x33173d[_0xb56a('0x25')]||0x0,'talking':_0x33173d[_0xb56a('0x26')],'total':_0x33173d[_0xb56a('0x27')],'type':_0x33173d[_0xb56a('0x28')],'unmanaged':_0x33173d[_0xb56a('0x29')],'abandoned':_0x33173d[_0xb56a('0x2a')],'waiting':_0x33173d[_0xb56a('0x2b')],'loggedInDb':_0x33173d[_0xb56a('0x2c')]};if(_0x33173d[_0xb56a('0x28')]===_0xb56a('0x2d')){_0x36cf88[_0xb56a('0x2e')]=_0x33173d['dialActive'];_0x36cf88[_0xb56a('0x2f')]=_0x33173d[_0xb56a('0x2f')];_0x36cf88[_0xb56a('0x30')]=_0x33173d['dialOriginateCallerIdName'];_0x36cf88[_0xb56a('0x31')]=_0x33173d[_0xb56a('0x31')];_0x36cf88['dialOriginateTimeout']=_0x33173d[_0xb56a('0x32')];_0x36cf88['dialPrefix']=_0x33173d['dialPrefix'];_0x36cf88[_0xb56a('0x33')]=_0x33173d[_0xb56a('0x33')];_0x36cf88[_0xb56a('0x34')]=_0x33173d['outboundAnswerCallsDay'];_0x36cf88['outboundBlacklistCallsDay']=_0x33173d[_0xb56a('0x35')];_0x36cf88['outboundBusyCallsDay']=_0x33173d['outboundBusyCallsDay'];_0x36cf88[_0xb56a('0x36')]=_0x33173d[_0xb56a('0x36')];_0x36cf88[_0xb56a('0x37')]=_0x33173d[_0xb56a('0x37')];_0x36cf88[_0xb56a('0x38')]=_0x33173d[_0xb56a('0x38')];_0x36cf88[_0xb56a('0x39')]=_0x33173d['outboundDropCallsDayTimeout'];_0x36cf88[_0xb56a('0x3a')]=_0x33173d[_0xb56a('0x3a')];_0x36cf88['outboundNoSuchCallsDay']=_0x33173d[_0xb56a('0x3b')];_0x36cf88[_0xb56a('0x3c')]=_0x33173d[_0xb56a('0x3c')];_0x36cf88[_0xb56a('0x3d')]=_0x33173d[_0xb56a('0x3d')];_0x36cf88[_0xb56a('0x3e')]=_0x33173d[_0xb56a('0x3e')];_0x36cf88['outboundUnknownCallsDay']=_0x33173d['outboundUnknownCallsDay'];_0x36cf88[_0xb56a('0x3f')]=_0x33173d[_0xb56a('0x3f')];_0x36cf88['predictiveIntervalAvgHoldtime']=_0x33173d['predictiveIntervalAvgHoldtime'];_0x36cf88[_0xb56a('0x40')]=_0x33173d[_0xb56a('0x40')];_0x36cf88[_0xb56a('0x41')]=_0x33173d[_0xb56a('0x41')];_0x36cf88[_0xb56a('0x42')]=_0x33173d['predictiveIntervalDroppedCallsTimeout'];_0x36cf88[_0xb56a('0x43')]=_0x33173d[_0xb56a('0x43')];_0x36cf88[_0xb56a('0x44')]=_0x33173d[_0xb56a('0x44')];_0x36cf88[_0xb56a('0x45')]=_0x33173d[_0xb56a('0x45')];_0x36cf88[_0xb56a('0x46')]=_0x33173d['predictiveIntervalLowerLimit'];_0x36cf88[_0xb56a('0x47')]=_0x33173d[_0xb56a('0x47')];_0x36cf88[_0xb56a('0x48')]=_0x33173d[_0xb56a('0x48')];_0x36cf88['predictiveIntervalTotalCalls']=_0x33173d['predictiveIntervalTotalCalls'];_0x36cf88[_0xb56a('0x19')]=_0x33173d[_0xb56a('0x19')];_0x36cf88[_0xb56a('0x49')]=_0x33173d[_0xb56a('0x49')];}if(_0x33173d['Trunk']){_0x36cf88[_0xb56a('0x4a')]={'id':_0x33173d[_0xb56a('0x4a')]['id'],'name':_0x33173d[_0xb56a('0x4a')]['name'],'active':_0x33173d[_0xb56a('0x4a')][_0xb56a('0x4b')],'callerid':_0x33173d['Trunk']['callerid']};}if(_0x33173d['Interval']){_0x36cf88[_0xb56a('0x4c')]={'id':_0x33173d[_0xb56a('0x4c')]['id'],'name':_0x33173d['Interval'][_0xb56a('0x9')]};}_0x3e5a82[_0xb56a('0x4d')](_0x36cf88);}}_0x2601ea({'count':_0x3e5a82['length'],'rows':_0x3e5a82});});},'VoiceChannels':function(_0x18d992){return new Promise(function(_0x45772c,_0xba0768){var _0x199336=_[_0xb56a('0x4e')](_0x2fee52[_0xb56a('0x4f')]);_0x45772c({'count':_0x199336[_0xb56a('0x50')],'rows':_0x199336});});},'VoiceChannelMixMonitor':function(_0x2d0116){var _0x5d135a=this;return new Promise(function(_0x5a235c,_0x20ffc6){if(ami[_0xb56a('0x11')]()==![]){return _0x20ffc6(_0x5d135a[_0xb56a('0x1b')](0x1f4,[config[_0xb56a('0x12')]['ip'],config['asterisk'][_0xb56a('0x1c')],'ami\x20disconnected']['join']('\x20')));}var _0x333edb=schema(properties[_0xb56a('0x51')])[_0xb56a('0x52')](_0x2d0116);if(_0x333edb[_0xb56a('0x50')]>0x0){return _0x20ffc6(_0x5d135a[_0xb56a('0x1b')](0x1f4,_[_0xb56a('0x53')](_0x333edb,_0xb56a('0x19'))[_0xb56a('0x13')](',\x20')));}var _0x5344cd=_[_0xb56a('0x54')](_0x2fee52[_0xb56a('0x4f')],{'uniqueid':_0x2d0116[_0xb56a('0x55')]});if(_0x5344cd&&_0x5344cd[_0xb56a('0x56')]){var _0x4a043c=util[_0xb56a('0x57')](_0xb56a('0x58'),_0x2d0116[_0xb56a('0x59')]||_0x2d0116[_0xb56a('0x55')],_0x2d0116['format']||_0xb56a('0x5a'));return ami[_0xb56a('0x17')]({'action':'MixMonitor','channel':_0x5344cd[_0xb56a('0x56')],'file':_0x4a043c,'options':_0xb56a('0x5b')})[_0xb56a('0x18')](function(_0x1d0731){var _0x2a1109=_['find'](_0x5344cd[_0xb56a('0x5c')],{'filename':_0xb56a('0x5d')+_0x4a043c['toLowerCase']()});if(_[_0xb56a('0x5e')](_0x2a1109)){_0x5344cd[_0xb56a('0x5c')][_0xb56a('0x4d')]({'filename':_0xb56a('0x5d')+_0x4a043c['toLowerCase'](),'createdAt':moment()['format'](_0xb56a('0x5f')),'mixmonitorid':_0x1d0731[_0xb56a('0x60')],'status':_0xb56a('0x61')});}else{_0x2a1109['mixmonitorid']=_0x1d0731[_0xb56a('0x60')];_0x2a1109[_0xb56a('0x62')]=_0xb56a('0x61');}_0x5a235c({'code':0xc8,'message':[_0x2d0116['uniqueid'],_0xb56a('0x63'),_0x1d0731[_0xb56a('0x60')]][_0xb56a('0x13')]('\x20'),'mixmonitorid':_0x1d0731['mixmonitorid']});})[_0xb56a('0x1a')](function(_0x999bdd){_0x20ffc6(_0x5d135a[_0xb56a('0x1b')](0x1f5,[_0x2d0116['uniqueid'],_0x999bdd[_0xb56a('0x19')]['toLowerCase']()][_0xb56a('0x13')]('\x20')));});}else{return _0x20ffc6(_0x5d135a[_0xb56a('0x1b')](0x1f5,_0xb56a('0x64')));}});},'VoiceChannelStopMixMonitor':function(_0x33aa8e){var _0x522265=this;return new Promise(function(_0x23cbf1,_0x45db2b){if(ami[_0xb56a('0x11')]()==![]){return _0x45db2b(_0x522265[_0xb56a('0x1b')](0x1f4,[config['asterisk']['ip'],config[_0xb56a('0x12')][_0xb56a('0x1c')],_0xb56a('0x65')][_0xb56a('0x13')]('\x20')));}var _0x4c5356=schema(properties[_0xb56a('0x51')])[_0xb56a('0x52')](_0x33aa8e);if(_0x4c5356[_0xb56a('0x50')]>0x0){return _0x45db2b(_0x522265[_0xb56a('0x1b')](0x1f4,_['map'](_0x4c5356,_0xb56a('0x19'))[_0xb56a('0x13')](',\x20')));}var _0x551a0d=_[_0xb56a('0x54')](_0x2fee52[_0xb56a('0x4f')],{'uniqueid':_0x33aa8e[_0xb56a('0x55')]});if(_0x551a0d){return BPromise[_0xb56a('0x66')]()[_0xb56a('0x18')](function(){if(_0x551a0d['channel']){return ami['Action']({'action':'StopMixMonitor','channel':_0x551a0d['channel'],'mixmonitorid':_0x33aa8e[_0xb56a('0x60')]})['catch'](function(_0x684c47){});}})[_0xb56a('0x18')](function(){if(_0x551a0d['destinationchannel']){return ami[_0xb56a('0x17')]({'action':'StopMixMonitor','channel':_0x551a0d[_0xb56a('0x67')],'mixmonitorid':_0x33aa8e[_0xb56a('0x60')]})[_0xb56a('0x1a')](function(_0x5116b4){});}})[_0xb56a('0x18')](function(_0x127e02){var _0x2f7e7c=_[_0xb56a('0x54')](_0x551a0d[_0xb56a('0x5c')],{'mixmonitorid':_0x33aa8e[_0xb56a('0x60')]});if(_0x2f7e7c){_0x2f7e7c['status']=_0xb56a('0x68');}})[_0xb56a('0x18')](function(){var _0x43e846=util['format'](_0xb56a('0x58'),_0x33aa8e[_0xb56a('0x59')]||_0x33aa8e[_0xb56a('0x55')],_0x33aa8e[_0xb56a('0x57')]||_0xb56a('0x5a'));var _0x7f0dc4=_[_0xb56a('0x54')](_0x551a0d['monitors'],{'filename':_0xb56a('0x5d')+_0x43e846[_0xb56a('0x69')]()});if(_0x7f0dc4){_0x7f0dc4['status']='stop';}})['then'](function(){_0x23cbf1({'code':0xc8,'message':[_0x33aa8e[_0xb56a('0x55')],_0xb56a('0x6a')]['join']('\x20')});})[_0xb56a('0x1a')](function(_0x18d6b4){_0x45db2b(_0x522265[_0xb56a('0x1b')](0x1f5,[_0x33aa8e[_0xb56a('0x55')],_0x18d6b4[_0xb56a('0x19')]['toLowerCase']()][_0xb56a('0x13')]('\x20')));});}else{return _0x45db2b(_0x522265[_0xb56a('0x1b')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x1f3f0c){return new Promise(function(_0x59d9e3,_0x34178d){var _0x2f4a54=_[_0xb56a('0x4e')](_0x2fee52[_0xb56a('0x6b')]);_0x59d9e3({'count':_0x2f4a54[_0xb56a('0x50')],'rows':_0x2f4a54});});},'VoiceQueuesChannel':function(_0x1a1077){var _0x5ac941=this;return new Promise(function(_0x301db2,_0x1c5556){var _0x16c1b3=schema(properties[_0xb56a('0x6c')])[_0xb56a('0x52')](_0x1a1077);if(_0x16c1b3[_0xb56a('0x50')]>0x0){return _0x1c5556(_0x5ac941[_0xb56a('0x1b')](0x1f4,_[_0xb56a('0x53')](_0x16c1b3,'message')[_0xb56a('0x13')](',\x20')));}var _0x2f3cd7=_[_0xb56a('0x54')](_0x2fee52[_0xb56a('0x6b')],{'uniqueid':_0x1a1077[_0xb56a('0x55')]});if(_0x2f3cd7){_0x301db2(_0x2f3cd7);}else{return _0x1c5556(_0x5ac941[_0xb56a('0x1b')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x43e6de){var _0x1cfed9=this;return new Promise(function(_0x13169f,_0x596ce2){if(ami[_0xb56a('0x11')]()==![]){return _0x596ce2(_0x1cfed9[_0xb56a('0x1b')](0x1f4,[config['asterisk']['ip'],config[_0xb56a('0x12')][_0xb56a('0x1c')],_0xb56a('0x65')][_0xb56a('0x13')]('\x20')));}var _0x4aaba7=schema(properties[_0xb56a('0x6d')])[_0xb56a('0x52')](_0x43e6de);if(_0x4aaba7[_0xb56a('0x50')]>0x0){return _0x596ce2(_0x1cfed9[_0xb56a('0x1b')](0x1f4,_['map'](_0x4aaba7,_0xb56a('0x19'))[_0xb56a('0x13')](',\x20')));}var _0x3f0ee1=_[_0xb56a('0x54')](_0x2fee52[_0xb56a('0x6b')],{'uniqueid':_0x43e6de['uniqueid']});if(_0x3f0ee1&&_0x3f0ee1[_0xb56a('0x56')]){return ami[_0xb56a('0x17')]({'action':_0xb56a('0x6e'),'channel':_0x3f0ee1[_0xb56a('0x56')]})[_0xb56a('0x18')](function(_0x423bc1){_0x13169f({'code':0xc8,'message':[_0x43e6de[_0xb56a('0x55')],_0x423bc1[_0xb56a('0x19')][_0xb56a('0x69')]()]['join']('\x20')});})[_0xb56a('0x1a')](function(_0x5824eb){_0x596ce2(_0x1cfed9[_0xb56a('0x1b')](0x1f5,[_0x43e6de[_0xb56a('0x55')],_0x5824eb[_0xb56a('0x19')][_0xb56a('0x69')]()][_0xb56a('0x13')]('\x20')));});}else{return _0x596ce2(_0x1cfed9[_0xb56a('0x1b')](0x1f5,_0xb56a('0x64')));}});},'VoiceQueuesChannelRedirect':function(_0x17c2f5){var _0x3d881e=this;return new Promise(function(_0xc5ba71,_0x2341fa){if(ami[_0xb56a('0x11')]()==![]){return _0x2341fa(_0x3d881e[_0xb56a('0x1b')](0x1f4,[config[_0xb56a('0x12')]['ip'],config[_0xb56a('0x12')][_0xb56a('0x1c')],'ami\x20disconnected'][_0xb56a('0x13')]('\x20')));}var _0x5a137d=schema(properties[_0xb56a('0x6f')])['validate'](_0x17c2f5);if(_0x5a137d['length']>0x0){return _0x2341fa(_0x3d881e[_0xb56a('0x1b')](0x1f4,_[_0xb56a('0x53')](_0x5a137d,'message')[_0xb56a('0x13')](',\x20')));}var _0x106bf3=_['find'](_0x2fee52[_0xb56a('0x6b')],{'uniqueid':_0x17c2f5['uniqueid']});if(_0x106bf3&&_0x106bf3['channel']){return ami[_0xb56a('0x17')]({'action':_0xb56a('0x70'),'channel':_0x106bf3[_0xb56a('0x56')],'exten':_0x17c2f5['exten'],'context':_0x17c2f5['context']||_0x106bf3['context'],'priority':0x1})[_0xb56a('0x18')](function(_0x4af53d){_0xc5ba71({'code':0xc8,'message':[_0x17c2f5[_0xb56a('0x55')],_0x4af53d[_0xb56a('0x19')][_0xb56a('0x69')]()]['join']('\x20')});})['catch'](function(_0x2e5756){_0x2341fa(_0x3d881e[_0xb56a('0x1b')](0x1f5,[_0x17c2f5[_0xb56a('0x55')],_0x2e5756[_0xb56a('0x19')][_0xb56a('0x69')]()][_0xb56a('0x13')]('\x20')));});}else{return _0x2341fa(_0x3d881e[_0xb56a('0x1b')](0x1f5,_0xb56a('0x64')));}});},'Agents':function(_0x50100d){return new Promise(function(_0x1fbde9,_0x280471){var _0x47da8a=_[_0xb56a('0x4e')](_0x2fee52[_0xb56a('0xd')]);_0x1fbde9({'count':_0x47da8a['length'],'rows':_0x47da8a});});},'Telephones':function(_0x1d0f2e){return new Promise(function(_0x13d9b5,_0x37ae14){var _0x3bc354=_[_0xb56a('0x4e')](_0x2fee52[_0xb56a('0x71')]);_0x13d9b5({'count':_0x3bc354[_0xb56a('0x50')],'rows':_0x3bc354});});},'Trunks':function(_0x1d31cf){return new Promise(function(_0x4e5e37,_0x56a925){var _0xea37be=_[_0xb56a('0x4e')](_0x2fee52[_0xb56a('0x72')]);_0x4e5e37({'count':_0xea37be[_0xb56a('0x50')],'rows':_0xea37be});});},'OutboundChannels':function(_0x335e74){return new Promise(function(_0x57d158,_0x2a74ba){var _0x506509=_[_0xb56a('0x4e')](_0x2fee52[_0xb56a('0x73')]);_0x57d158({'count':_0x506509[_0xb56a('0x50')],'rows':_0x506509});});},'Outbound':function(_0x5678e3){return new Promise(function(_0x4acc71,_0x18d57b){_0x4acc71(_0x2fee52['outbound']);});},'Campaigns':function(_0x1f799d){return new Promise(function(_0x250f3d,_0x3c6b5e){var _0x19d158=_[_0xb56a('0x4e')](_0x2fee52['campaigns']);_0x250f3d({'count':_0x19d158[_0xb56a('0x50')],'rows':_0x19d158});});},'VoiceQueuesPreview':function(_0x219b97){var _0x5b2c53=this;return new Promise(function(_0x1b26a2,_0xe7117c){_0x30aca2[_0xb56a('0x74')](_0x219b97['id'])[_0xb56a('0x18')](function(_0xac4be1){_0x1b26a2({'code':0xc8,'message':_0xac4be1['message']});})[_0xb56a('0x1a')](function(_0x2b9099){_0xe7117c(_0x5b2c53['error'](0x1f4,_0x2b9099[_0xb56a('0x19')]));});});},'EventManager':function(_0x55b4ef){var _0x3ee48=this;return new Promise(function(_0x55df0c,_0xc1b36f){if(!_0x55b4ef[_0xb56a('0x75')]){return _0xc1b36f(_0x3ee48[_0xb56a('0x1b')](0x1f4,_0xb56a('0x76')));}ami['emit'](_0xb56a('0x77')+_0x55b4ef['event'],_0x55b4ef[_0xb56a('0x19')]);_0x55df0c({'code':0xc8,'message':_0x55b4ef});});},'FaxAccounts':function(_0x58a4d9){return new Promise(function(_0x4c1c5d,_0x314019){var _0x293e53=_[_0xb56a('0x4e')](_0x2fee52[_0xb56a('0x78')]);_0x4c1c5d({'count':_0x293e53[_0xb56a('0x50')],'rows':_0x293e53});});},'SendFax':function(_0x3ff4aa){var _0x199f1e=this;return new Promise(function(_0x3b5eda,_0x28065a){_0x3b829c[_0xb56a('0x79')](_0x3ff4aa)[_0xb56a('0x18')](function(_0x432487){_0x3b5eda({'code':0xc8,'message':_0x432487['message']});})[_0xb56a('0x1a')](function(_0x34ba91){_0x28065a(_0x199f1e[_0xb56a('0x1b')](0x1f4,_0x34ba91[_0xb56a('0x19')]));});});},'CheckAfterSend':function(_0x531832){var _0x449fc9=this;return new Promise(function(_0x312fbd,_0x541b6f){_0x3b829c[_0xb56a('0x7a')](_0x531832)[_0xb56a('0x18')](function(_0x294152){_0x312fbd({'code':0xc8,'message':_0x294152[_0xb56a('0x19')]});})[_0xb56a('0x1a')](function(_0x46e307){_0x541b6f(_0x449fc9['error'](0x1f4,_0x46e307[_0xb56a('0x19')]));});});}};var _0x331d3a=jayson['server'](_0x1c2493)[_0xb56a('0x7b')]();_0x331d3a['on'](_0xb56a('0x1b'),function(_0x354ca3){return _0x47519a(_0x354ca3);});_0x331d3a[_0xb56a('0x7')](0x232a,_0xb56a('0x7c'),function(){console[_0xb56a('0x7d')](_0xb56a('0x7e'),0x232a);return _0x5ba1d8('RPC\x20listening\x20on\x20port:'+0x232a);});});};
\ No newline at end of file
index 22eb201..3e8d188 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x455e=['name','format','trigger:%s','toLowerCase','merge','xmd-contactid2','action','Error\x20creating\x20contact','bluebird','util','ioredis','trigger','../../rpc/cmContact','defaults','localhost','socket.io-emitter','redis','stringify','emit','exec','autoCreate','data2','data1','calleridnum','isNil','routeId','firstName','calleridname','<unknown>','uniqueid','destcalleridname','destcalleridnum','phone','resolve','then','omit','user:%s'];(function(_0x2703a6,_0x2c1593){var _0x442cd3=function(_0x1e1944){while(--_0x1e1944){_0x2703a6['push'](_0x2703a6['shift']());}};_0x442cd3(++_0x2c1593);}(_0x455e,0x19f));var _0xe455=function(_0x42400d,_0x4049a7){_0x42400d=_0x42400d-0x0;var _0x29eeda=_0x455e[_0x42400d];return _0x29eeda;};'use strict';var BPromise=require(_0xe455('0x0'));var util=require(_0xe455('0x1'));var _=require('lodash');var Redis=require(_0xe455('0x2'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xe455('0x3'));var cmContactRpc=require(_0xe455('0x4'));config['redis']=_[_0xe455('0x5')](config['redis'],{'host':_0xe455('0x6'),'port':0x18eb});var io=require(_0xe455('0x7'))(new Redis(config[_0xe455('0x8')]));function emit(_0x5d1a30,_0x1333d5,_0x4b89b6){logger['info'](_0x5d1a30,_0x1333d5,JSON[_0xe455('0x9')](_0x4b89b6));io['to'](_0x5d1a30)[_0xe455('0xa')](_0x1333d5,_0x4b89b6);}exports[_0xe455('0xb')]=function(_0xd1ecd2,_0x288642,_0x25d8f2){_0x25d8f2[_0xe455('0xc')]=0x0;if(_0x288642['data2']&&parseInt(_0x288642[_0xe455('0xd')],0xa)){var _0x439a8f={'ListId':parseInt(_0x288642[_0xe455('0xe')],0xa),'phone':_0x25d8f2[_0xe455('0xf')]};if(_[_0xe455('0x10')](_0x25d8f2[_0xe455('0x11')])){_0x439a8f[_0xe455('0x12')]=_0x25d8f2['calleridname']&&_0x25d8f2[_0xe455('0x13')]!==_0xe455('0x14')?_0x25d8f2['calleridname']:_0x25d8f2[_0xe455('0xf')]||_0x25d8f2[_0xe455('0x15')];}else{_0x439a8f['firstName']=_0x25d8f2[_0xe455('0x16')]&&_0x25d8f2['destcalleridname']!==_0xe455('0x14')?_0x25d8f2['destcalleridname']:_0x25d8f2[_0xe455('0x17')]||_0x25d8f2[_0xe455('0x15')];_0x439a8f[_0xe455('0x18')]=_0x25d8f2[_0xe455('0x16')]&&_0x25d8f2[_0xe455('0x16')]!==_0xe455('0x14')?_0x25d8f2[_0xe455('0x16')]:_0x25d8f2[_0xe455('0x17')]||_0x25d8f2[_0xe455('0x15')];}BPromise[_0xe455('0x19')]()[_0xe455('0x1a')](cmContactRpc['showContact']({'where':_[_0xe455('0x1b')](_0x439a8f,[_0xe455('0x12')])}))[_0xe455('0x1a')](function(_0x1f2beb){if(_0x1f2beb){_0x25d8f2['xmd-contactid2']=_0x1f2beb['id'];emit(util['format'](_0xe455('0x1c'),_0xd1ecd2[_0xe455('0x1d')]),util[_0xe455('0x1e')](_0xe455('0x1f'),_0x288642['action'][_0xe455('0x20')]()),_[_0xe455('0x21')](_0x25d8f2,{'ListId':parseInt(_0x288642[_0xe455('0xe')],0xa)}));return;}else{return BPromise[_0xe455('0x19')]()['then'](cmContactRpc['createContact'](_0x439a8f));}})[_0xe455('0x1a')](function(_0x3f0418){if(_0x3f0418){_0x25d8f2[_0xe455('0x22')]=_0x3f0418['id'];emit(util[_0xe455('0x1e')]('user:%s',_0xd1ecd2['name']),util['format']('trigger:%s',_0x288642[_0xe455('0x23')][_0xe455('0x20')]()),_[_0xe455('0x21')](_0x25d8f2,{'ListId':parseInt(_0x288642[_0xe455('0xe')],0xa)}));}})['catch'](function(_0x218916){logger['error'](_0xe455('0x24'),JSON[_0xe455('0x9')](_0x218916));});}else{if(_0xd1ecd2){emit(util[_0xe455('0x1e')]('user:%s',_0xd1ecd2[_0xe455('0x1d')]),util[_0xe455('0x1e')](_0xe455('0x1f'),_0x288642[_0xe455('0x23')][_0xe455('0x20')]()),_[_0xe455('0x21')]({'ListId':parseInt(_0x288642[_0xe455('0xe')],0xa)},_0x25d8f2));}}};
\ No newline at end of file
+var _0x8b6e=['bluebird','util','lodash','../../../../config/environment','../../rpc/cmContact','redis','info','stringify','emit','exec','autoCreate','data1','calleridnum','isNil','routeId','firstName','calleridname','<unknown>','uniqueid','destcalleridname','destcalleridnum','resolve','then','showContact','xmd-contactid2','format','user:%s','name','trigger:%s','action','toLowerCase','merge','catch','error'];(function(_0x27e734,_0x1f1ee1){var _0x2dca76=function(_0x2e2830){while(--_0x2e2830){_0x27e734['push'](_0x27e734['shift']());}};_0x2dca76(++_0x1f1ee1);}(_0x8b6e,0xee));var _0xe8b6=function(_0x5c4b64,_0x690ec4){_0x5c4b64=_0x5c4b64-0x0;var _0xee2cd3=_0x8b6e[_0x5c4b64];return _0xee2cd3;};'use strict';var BPromise=require(_0xe8b6('0x0'));var util=require(_0xe8b6('0x1'));var _=require(_0xe8b6('0x2'));var Redis=require('ioredis');var config=require(_0xe8b6('0x3'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0xe8b6('0x4'));config[_0xe8b6('0x5')]=_['defaults'](config[_0xe8b6('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x175ba1,_0x4f37a6,_0x2372be){logger[_0xe8b6('0x6')](_0x175ba1,_0x4f37a6,JSON[_0xe8b6('0x7')](_0x2372be));io['to'](_0x175ba1)[_0xe8b6('0x8')](_0x4f37a6,_0x2372be);}exports[_0xe8b6('0x9')]=function(_0x51c3dd,_0x51d434,_0xa66224){_0xa66224[_0xe8b6('0xa')]=0x0;if(_0x51d434['data2']&&parseInt(_0x51d434['data2'],0xa)){var _0x4b1071={'ListId':parseInt(_0x51d434[_0xe8b6('0xb')],0xa),'phone':_0xa66224[_0xe8b6('0xc')]};if(_[_0xe8b6('0xd')](_0xa66224[_0xe8b6('0xe')])){_0x4b1071[_0xe8b6('0xf')]=_0xa66224[_0xe8b6('0x10')]&&_0xa66224[_0xe8b6('0x10')]!==_0xe8b6('0x11')?_0xa66224[_0xe8b6('0x10')]:_0xa66224[_0xe8b6('0xc')]||_0xa66224[_0xe8b6('0x12')];}else{_0x4b1071['firstName']=_0xa66224[_0xe8b6('0x13')]&&_0xa66224[_0xe8b6('0x13')]!==_0xe8b6('0x11')?_0xa66224['destcalleridname']:_0xa66224[_0xe8b6('0x14')]||_0xa66224[_0xe8b6('0x12')];_0x4b1071['phone']=_0xa66224['destcalleridname']&&_0xa66224[_0xe8b6('0x13')]!==_0xe8b6('0x11')?_0xa66224['destcalleridname']:_0xa66224['destcalleridnum']||_0xa66224[_0xe8b6('0x12')];}BPromise[_0xe8b6('0x15')]()[_0xe8b6('0x16')](cmContactRpc[_0xe8b6('0x17')]({'where':_['omit'](_0x4b1071,[_0xe8b6('0xf')])}))[_0xe8b6('0x16')](function(_0x41ea73){if(_0x41ea73){_0xa66224[_0xe8b6('0x18')]=_0x41ea73['id'];emit(util[_0xe8b6('0x19')](_0xe8b6('0x1a'),_0x51c3dd[_0xe8b6('0x1b')]),util[_0xe8b6('0x19')](_0xe8b6('0x1c'),_0x51d434[_0xe8b6('0x1d')]['toLowerCase']()),_['merge'](_0xa66224,{'ListId':parseInt(_0x51d434[_0xe8b6('0xb')],0xa)}));return;}else{return BPromise[_0xe8b6('0x15')]()[_0xe8b6('0x16')](cmContactRpc['createContact'](_0x4b1071));}})[_0xe8b6('0x16')](function(_0x284685){if(_0x284685){_0xa66224[_0xe8b6('0x18')]=_0x284685['id'];emit(util[_0xe8b6('0x19')](_0xe8b6('0x1a'),_0x51c3dd[_0xe8b6('0x1b')]),util[_0xe8b6('0x19')](_0xe8b6('0x1c'),_0x51d434['action'][_0xe8b6('0x1e')]()),_[_0xe8b6('0x1f')](_0xa66224,{'ListId':parseInt(_0x51d434[_0xe8b6('0xb')],0xa)}));}})[_0xe8b6('0x20')](function(_0x5248fc){logger[_0xe8b6('0x21')]('Error\x20creating\x20contact',JSON[_0xe8b6('0x7')](_0x5248fc));});}else{if(_0x51c3dd){emit(util[_0xe8b6('0x19')]('user:%s',_0x51c3dd[_0xe8b6('0x1b')]),util['format'](_0xe8b6('0x1c'),_0x51d434[_0xe8b6('0x1d')][_0xe8b6('0x1e')]()),_['merge']({'ListId':parseInt(_0x51d434['data1'],0xa)},_0xa66224));}}};
\ No newline at end of file
index 7c579f8..00bdab6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xac4a=['url','mustache','ioredis','./urlforward','../rpc/cmContact','../../../config/environment','../../../config/logger','../ami','defaults','localhost','socket.io-emitter','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','accounts','custom:agentcalled','bind','syncCustomEvent','custom:agentringnoanswer','custom:agentcomplete','custom:queuecallerabandon','custom:dialbegin','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','info','clone','checkTriggers','hasOwnProperty','status','merge','variables','Actions','length','interface','action','toLowerCase','motionbar','data1','popup','TemplateId','data2','render','html','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','800','windowHeight','600','data6','winApplication','winArguments','emit','format','name','trigger:%s:%s','jscripty','trigger:%s','user:%s','contactmanager','exec','queue','routeId','urlforward','query','search','checkTrigger','AllConditions','every','checkConditions','AnyConditions','some','channel','field','operator','value','upperFirst','AccountId','message','event','lastevent','exports','util','lodash'];(function(_0x545f7f,_0x43a5ca){var _0x24a7c7=function(_0x56a128){while(--_0x56a128){_0x545f7f['push'](_0x545f7f['shift']());}};_0x24a7c7(++_0x43a5ca);}(_0xac4a,0x13f));var _0xaac4=function(_0x386d1e,_0x883ae){_0x386d1e=_0x386d1e-0x0;var _0x58cf99=_0xac4a[_0x386d1e];return _0x58cf99;};'use strict';var util=require(_0xaac4('0x0'));var _=require(_0xaac4('0x1'));var url=require(_0xaac4('0x2'));var Mustache=require(_0xaac4('0x3'));var Redis=require(_0xaac4('0x4'));var urlforward=require(_0xaac4('0x5'));var integration=require('./integration');var cmContact=require('./cmContact');var cmContactRpc=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var logger=require(_0xaac4('0x8'))('trigger');var ami=require(_0xaac4('0x9'));config['redis']=_[_0xaac4('0xa')](config['redis'],{'host':_0xaac4('0xb'),'port':0x18eb});var io=require(_0xaac4('0xc'))(new Redis(config['redis']));var operators={'equals':function(_0x5cfc1b,_0x349671){return _0x5cfc1b==_0x349671;},'not_equals':function(_0x50d114,_0x452573){return _0x50d114!=_0x452573;}};var barAndWebActions=['popup','url',_0xaac4('0xd')];function Trigger(_0x22cea4){this[_0xaac4('0xe')]=_0x22cea4[_0xaac4('0xe')];this[_0xaac4('0xf')]=_0x22cea4['agents'];this['voiceQueues']=_0x22cea4[_0xaac4('0x10')];this[_0xaac4('0x11')]=_0x22cea4[_0xaac4('0x11')];this['voiceExtensions']=_0x22cea4[_0xaac4('0x12')];this[_0xaac4('0x13')]=_0x22cea4['zendeskAccounts'];this[_0xaac4('0x14')]=_0x22cea4[_0xaac4('0x14')];this[_0xaac4('0x15')]=_0x22cea4[_0xaac4('0x15')];this[_0xaac4('0x16')]=_0x22cea4[_0xaac4('0x16')];this[_0xaac4('0x17')]=_0x22cea4[_0xaac4('0x17')];this[_0xaac4('0x18')]=_0x22cea4[_0xaac4('0x18')];this[_0xaac4('0x19')]=_0x22cea4[_0xaac4('0x19')];this[_0xaac4('0x1a')]=_0x22cea4['servicenowAccounts'];this[_0xaac4('0x1b')]=_0x22cea4['dynamics365Accounts'];this[_0xaac4('0x1c')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0xaac4('0x15')],'freshdesk':this[_0xaac4('0x14')],'sugarcrm':this[_0xaac4('0x16')],'zoho':this[_0xaac4('0x17')],'desk':this[_0xaac4('0x18')],'vtiger':this[_0xaac4('0x19')],'servicenow':this[_0xaac4('0x1a')],'dynamics365':this[_0xaac4('0x1b')]};ami['on'](_0xaac4('0x1d'),this['syncCustomEvent'][_0xaac4('0x1e')](this));ami['on']('custom:agentconnect',this[_0xaac4('0x1f')][_0xaac4('0x1e')](this));ami['on'](_0xaac4('0x20'),this[_0xaac4('0x1f')][_0xaac4('0x1e')](this));ami['on'](_0xaac4('0x21'),this['syncCustomEvent'][_0xaac4('0x1e')](this));ami['on'](_0xaac4('0x22'),this[_0xaac4('0x1f')][_0xaac4('0x1e')](this));ami['on'](_0xaac4('0x23'),this[_0xaac4('0x1f')][_0xaac4('0x1e')](this));ami['on']('custom:dialconnect',this[_0xaac4('0x1f')]['bind'](this));ami['on']('custom:dialend',this['syncCustomEvent']['bind'](this));ami['on'](_0xaac4('0x24'),this[_0xaac4('0x1f')][_0xaac4('0x1e')](this));ami['on'](_0xaac4('0x25'),this[_0xaac4('0x1f')][_0xaac4('0x1e')](this));ami['on'](_0xaac4('0x26'),this[_0xaac4('0x1f')][_0xaac4('0x1e')](this));ami['on'](_0xaac4('0x27'),this['syncCustomEvent'][_0xaac4('0x1e')](this));ami['on'](_0xaac4('0x28'),this[_0xaac4('0x1f')][_0xaac4('0x1e')](this));ami['on'](_0xaac4('0x29'),this[_0xaac4('0x1f')]['bind'](this));}Trigger[_0xaac4('0x2a')]['emit']=function(_0x2df7e3,_0xab5d04,_0x182343){logger[_0xaac4('0x2b')](_0x2df7e3,_0xab5d04,JSON['stringify'](_0x182343));io['to'](_0x2df7e3)['emit'](_0xab5d04,_0x182343);};Trigger['prototype'][_0xaac4('0x1f')]=function(_0xee6aa9){var _0x2df196=_[_0xaac4('0x2c')](_0xee6aa9);this[_0xaac4('0x2d')](_0x2df196);};Trigger[_0xaac4('0x2a')][_0xaac4('0x2d')]=function(_0x379cbd){var _0x2481a9;for(var _0x3b2091 in this[_0xaac4('0xe')]){if(this[_0xaac4('0xe')][_0xaac4('0x2e')](_0x3b2091)){if(this[_0xaac4('0xe')][_0x3b2091][_0xaac4('0x2f')]){_0x2481a9=this['checkTrigger'](this['triggers'][_0x3b2091],_0x379cbd);if(_0x2481a9){_[_0xaac4('0x30')](_0x379cbd,_0x379cbd[_0xaac4('0x31')]);for(var _0xa07d0=0x0,_0x5e6080,_0x191d0f,_0x16fae8;_0xa07d0<this[_0xaac4('0xe')][_0x3b2091][_0xaac4('0x32')][_0xaac4('0x33')];_0xa07d0+=0x1){_0x5e6080=this[_0xaac4('0xe')][_0x3b2091][_0xaac4('0x32')][_0xa07d0];if(this['agents'][_0x379cbd[_0xaac4('0x34')]]){switch(_0x5e6080[_0xaac4('0x35')][_0xaac4('0x36')]()){case'contactmanager':break;case _0xaac4('0x37'):case'browser':var _0x577b5b={};switch(barAndWebActions[_0x5e6080[_0xaac4('0x38')]]){case _0xaac4('0x39'):_0x577b5b[_0xaac4('0x3a')]=_0x5e6080['data2'];_0x577b5b['html']=this[_0xaac4('0x11')][_0x5e6080[_0xaac4('0x3b')]]?Mustache[_0xaac4('0x3c')](this[_0xaac4('0x11')][_0x5e6080[_0xaac4('0x3b')]][_0xaac4('0x3d')],_0x379cbd):'template\x20not\x20found';break;case'url':_0x577b5b[_0xaac4('0x3e')]=this[_0xaac4('0x3f')](_0x5e6080['data2'],_0x379cbd,_[_0xaac4('0x40')](_0x5e6080[_0xaac4('0x41')])?!![]:parseInt(_0x5e6080[_0xaac4('0x41')],0xa));if(_['isNil'](_0x5e6080[_0xaac4('0x42')])){_0x577b5b[_0xaac4('0x43')]='0';}else{_0x577b5b[_0xaac4('0x44')]=_0x5e6080['data4'];_0x577b5b[_0xaac4('0x45')]=_[_0xaac4('0x40')](_0x5e6080[_0xaac4('0x46')])?_0xaac4('0x47'):_0x5e6080['data5'];_0x577b5b[_0xaac4('0x48')]=_['isNil'](_0x5e6080['data6'])?_0xaac4('0x49'):_0x5e6080[_0xaac4('0x4a')];}break;case _0xaac4('0xd'):_0x577b5b[_0xaac4('0x4b')]=_0x5e6080[_0xaac4('0x3b')]?Mustache[_0xaac4('0x3c')](_0x5e6080[_0xaac4('0x3b')],_0x379cbd):'';_0x577b5b[_0xaac4('0x4c')]=_0x5e6080['data3']?Mustache[_0xaac4('0x3c')](_0x5e6080[_0xaac4('0x41')],_0x379cbd):'';break;}this[_0xaac4('0x4d')](util[_0xaac4('0x4e')]('user:%s',this[_0xaac4('0xf')][_0x379cbd[_0xaac4('0x34')]][_0xaac4('0x4f')]),util['format'](_0xaac4('0x50'),_0x5e6080[_0xaac4('0x35')][_0xaac4('0x36')](),barAndWebActions[_0x5e6080[_0xaac4('0x38')]]),_['merge'](_0x577b5b,_0x379cbd));break;case _0xaac4('0x51'):this[_0xaac4('0x4d')](util[_0xaac4('0x4e')]('user:%s',this[_0xaac4('0xf')][_0x379cbd[_0xaac4('0x34')]][_0xaac4('0x4f')]),util[_0xaac4('0x4e')](_0xaac4('0x52'),_0x5e6080[_0xaac4('0x35')][_0xaac4('0x36')]()),_[_0xaac4('0x30')]({'ProjectId':parseInt(_0x5e6080[_0xaac4('0x38')],0xa)},_0x379cbd));break;default:this['emit'](util[_0xaac4('0x4e')](_0xaac4('0x53'),this[_0xaac4('0xf')][_0x379cbd[_0xaac4('0x34')]][_0xaac4('0x4f')]),util['format']('trigger:%s',_0x5e6080[_0xaac4('0x35')][_0xaac4('0x36')]()),_[_0xaac4('0x30')]({},_0x5e6080,_0x379cbd));}}switch(_0x5e6080[_0xaac4('0x35')]['toLowerCase']()){case _0xaac4('0x54'):cmContact['exec'](this[_0xaac4('0xf')][_0x379cbd[_0xaac4('0x34')]],_0x5e6080,_0x379cbd,cmContactRpc);break;case'integration':integration[_0xaac4('0x55')](_0x5e6080,_0x379cbd,this[_0xaac4('0x1c')],this[_0xaac4('0xf')][_0x379cbd['interface']],this['voiceQueues'][_0x379cbd[_0xaac4('0x56')]],this[_0xaac4('0x12')][_0x379cbd[_0xaac4('0x57')]]);break;case _0xaac4('0x58'):urlforward[_0xaac4('0x55')](_0x5e6080,_0x379cbd);break;}}}}}}};Trigger[_0xaac4('0x2a')]['buildUri']=function(_0x3c11b9,_0x370315,_0x1c9979){var _0x38f9af=url['parse'](Mustache[_0xaac4('0x3c')](_0x3c11b9,_0x370315),!![]);if(_0x1c9979){_['merge'](_0x38f9af[_0xaac4('0x59')],_0x370315);}delete _0x38f9af[_0xaac4('0x5a')];return url[_0xaac4('0x4e')](_0x38f9af);};Trigger[_0xaac4('0x2a')][_0xaac4('0x5b')]=function(_0x35b200,_0x3d7720){var _0x3aa764=!![],_0x28aed5=!![];if(_0x35b200[_0xaac4('0x5c')][_0xaac4('0x33')]){_0x3aa764=_[_0xaac4('0x5d')](_0x35b200[_0xaac4('0x5c')],this[_0xaac4('0x5e')](_0x3d7720,_0x35b200['channel']));}if(_0x35b200[_0xaac4('0x5f')][_0xaac4('0x33')]){_0x28aed5=_[_0xaac4('0x60')](_0x35b200[_0xaac4('0x5f')],this[_0xaac4('0x5e')](_0x3d7720,_0x35b200[_0xaac4('0x61')]));}return _0x3aa764&&_0x28aed5;};Trigger[_0xaac4('0x2a')][_0xaac4('0x5e')]=function(_0x5e8928,_0x3d7ccc){return function(_0x501664){switch(_0x501664[_0xaac4('0x62')]){case'account':if(_0x5e8928[_0xaac4('0x61')]===_0x3d7ccc){if(_0x3d7ccc==='chat'){return _0x5e8928['ChatWebsiteId']?operators[_0x501664[_0xaac4('0x63')]](Number(_0x501664[_0xaac4('0x64')]),_0x5e8928['ChatWebsiteId']):![];}else{return _0x5e8928[_[_0xaac4('0x65')](_0x3d7ccc)+_0xaac4('0x66')]?operators[_0x501664[_0xaac4('0x63')]](Number(_0x501664[_0xaac4('0x64')]),_0x5e8928[_[_0xaac4('0x65')](_0x3d7ccc)+_0xaac4('0x66')]):![];}}break;case'interaction':case _0xaac4('0x67'):if(_0x5e8928['channel']===_0x3d7ccc){return _0x5e8928[_0xaac4('0x68')]?operators[_0x501664['operator']](_0x501664['value'],_0x5e8928['event']):![];}break;case _0xaac4('0x56'):return _0x5e8928[_0xaac4('0x56')]?operators[_0x501664[_0xaac4('0x63')]](_0x501664[_0xaac4('0x64')],_0x5e8928['queue']):![];case _0xaac4('0x69'):return _0x5e8928[_0xaac4('0x69')]?operators[_0x501664[_0xaac4('0x63')]](_0x501664['value'],_0x5e8928[_0xaac4('0x69')]):![];case _0xaac4('0x57'):return _0x5e8928[_0xaac4('0x57')]?operators[_0x501664[_0xaac4('0x63')]](_0x501664[_0xaac4('0x64')],_0x5e8928[_0xaac4('0x57')]):![];}return![];};};module[_0xaac4('0x6a')]=Trigger;
\ No newline at end of file
+var _0x536f=['event','queue','lastevent','exports','util','./urlforward','./integration','./cmContact','../rpc/cmContact','../../../config/logger','../ami','redis','defaults','socket.io-emitter','popup','url','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:queuecallerabandon','custom:dialbegin','custom:dialconnect','custom:newinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','stringify','clone','checkTriggers','hasOwnProperty','status','checkTrigger','variables','Actions','length','action','toLowerCase','browser','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','uriLocation','windowWidth','800','data5','windowHeight','data6','winapp','winApplication','winArguments','format','user:%s','interface','trigger:%s:%s','merge','jscripty','name','trigger:%s','contactmanager','exec','integration','routeId','urlforward','query','AllConditions','every','some','AnyConditions','channel','checkConditions','field','chat','ChatWebsiteId','value','upperFirst','AccountId','operator','interaction','message'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x536f,0x70));var _0xf536=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x536f[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xf536('0x0'));var _=require('lodash');var url=require('url');var Mustache=require('mustache');var Redis=require('ioredis');var urlforward=require(_0xf536('0x1'));var integration=require(_0xf536('0x2'));var cmContact=require(_0xf536('0x3'));var cmContactRpc=require(_0xf536('0x4'));var config=require('../../../config/environment');var logger=require(_0xf536('0x5'))('trigger');var ami=require(_0xf536('0x6'));config[_0xf536('0x7')]=_[_0xf536('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf536('0x9'))(new Redis(config[_0xf536('0x7')]));var operators={'equals':function(_0x2f5b45,_0x12673f){return _0x2f5b45==_0x12673f;},'not_equals':function(_0x4f2eaf,_0x4e7088){return _0x4f2eaf!=_0x4e7088;}};var barAndWebActions=[_0xf536('0xa'),_0xf536('0xb'),'winapp'];function Trigger(_0x4868bd){this[_0xf536('0xc')]=_0x4868bd[_0xf536('0xc')];this[_0xf536('0xd')]=_0x4868bd[_0xf536('0xd')];this[_0xf536('0xe')]=_0x4868bd['voiceQueues'];this[_0xf536('0xf')]=_0x4868bd['templates'];this[_0xf536('0x10')]=_0x4868bd[_0xf536('0x10')];this[_0xf536('0x11')]=_0x4868bd[_0xf536('0x11')];this[_0xf536('0x12')]=_0x4868bd[_0xf536('0x12')];this[_0xf536('0x13')]=_0x4868bd[_0xf536('0x13')];this[_0xf536('0x14')]=_0x4868bd[_0xf536('0x14')];this[_0xf536('0x15')]=_0x4868bd[_0xf536('0x15')];this['deskAccounts']=_0x4868bd[_0xf536('0x16')];this['vtigerAccounts']=_0x4868bd[_0xf536('0x17')];this['servicenowAccounts']=_0x4868bd[_0xf536('0x18')];this[_0xf536('0x19')]=_0x4868bd[_0xf536('0x19')];this[_0xf536('0x1a')]={'zendesk':this[_0xf536('0x11')],'salesforce':this[_0xf536('0x13')],'freshdesk':this[_0xf536('0x12')],'sugarcrm':this[_0xf536('0x14')],'zoho':this['zohoAccounts'],'desk':this[_0xf536('0x16')],'vtiger':this[_0xf536('0x17')],'servicenow':this['servicenowAccounts'],'dynamics365':this['dynamics365Accounts']};ami['on'](_0xf536('0x1b'),this[_0xf536('0x1c')][_0xf536('0x1d')](this));ami['on'](_0xf536('0x1e'),this[_0xf536('0x1c')][_0xf536('0x1d')](this));ami['on'](_0xf536('0x1f'),this[_0xf536('0x1c')][_0xf536('0x1d')](this));ami['on'](_0xf536('0x20'),this['syncCustomEvent'][_0xf536('0x1d')](this));ami['on'](_0xf536('0x21'),this['syncCustomEvent'][_0xf536('0x1d')](this));ami['on'](_0xf536('0x22'),this[_0xf536('0x1c')][_0xf536('0x1d')](this));ami['on'](_0xf536('0x23'),this[_0xf536('0x1c')][_0xf536('0x1d')](this));ami['on']('custom:dialend',this[_0xf536('0x1c')][_0xf536('0x1d')](this));ami['on'](_0xf536('0x24'),this[_0xf536('0x1c')][_0xf536('0x1d')](this));ami['on']('custom:closedinteraction',this[_0xf536('0x1c')][_0xf536('0x1d')](this));ami['on'](_0xf536('0x25'),this[_0xf536('0x1c')]['bind'](this));ami['on'](_0xf536('0x26'),this['syncCustomEvent'][_0xf536('0x1d')](this));ami['on'](_0xf536('0x27'),this[_0xf536('0x1c')][_0xf536('0x1d')](this));ami['on'](_0xf536('0x28'),this[_0xf536('0x1c')][_0xf536('0x1d')](this));}Trigger[_0xf536('0x29')][_0xf536('0x2a')]=function(_0x17b698,_0x24a8c7,_0x2961a1){logger['info'](_0x17b698,_0x24a8c7,JSON[_0xf536('0x2b')](_0x2961a1));io['to'](_0x17b698)[_0xf536('0x2a')](_0x24a8c7,_0x2961a1);};Trigger['prototype'][_0xf536('0x1c')]=function(_0x291b18){var _0x5d006f=_[_0xf536('0x2c')](_0x291b18);this[_0xf536('0x2d')](_0x5d006f);};Trigger[_0xf536('0x29')][_0xf536('0x2d')]=function(_0x4a2fb8){var _0x91f249;for(var _0x86fd56 in this[_0xf536('0xc')]){if(this['triggers'][_0xf536('0x2e')](_0x86fd56)){if(this[_0xf536('0xc')][_0x86fd56][_0xf536('0x2f')]){_0x91f249=this[_0xf536('0x30')](this[_0xf536('0xc')][_0x86fd56],_0x4a2fb8);if(_0x91f249){_['merge'](_0x4a2fb8,_0x4a2fb8[_0xf536('0x31')]);for(var _0x507dec=0x0,_0xc45380,_0x310387,_0x118910;_0x507dec<this[_0xf536('0xc')][_0x86fd56][_0xf536('0x32')][_0xf536('0x33')];_0x507dec+=0x1){_0xc45380=this['triggers'][_0x86fd56]['Actions'][_0x507dec];if(this[_0xf536('0xd')][_0x4a2fb8['interface']]){switch(_0xc45380[_0xf536('0x34')][_0xf536('0x35')]()){case'contactmanager':break;case'motionbar':case _0xf536('0x36'):var _0x13d3eb={};switch(barAndWebActions[_0xc45380[_0xf536('0x37')]]){case'popup':_0x13d3eb[_0xf536('0x38')]=_0xc45380[_0xf536('0x39')];_0x13d3eb[_0xf536('0x3a')]=this[_0xf536('0xf')][_0xc45380[_0xf536('0x39')]]?Mustache[_0xf536('0x3b')](this[_0xf536('0xf')][_0xc45380[_0xf536('0x39')]][_0xf536('0x3a')],_0x4a2fb8):_0xf536('0x3c');break;case _0xf536('0xb'):_0x13d3eb[_0xf536('0x3d')]=this[_0xf536('0x3e')](_0xc45380[_0xf536('0x39')],_0x4a2fb8,_[_0xf536('0x3f')](_0xc45380['data3'])?!![]:parseInt(_0xc45380[_0xf536('0x40')],0xa));if(_[_0xf536('0x3f')](_0xc45380[_0xf536('0x41')])){_0x13d3eb['location']='0';}else{_0x13d3eb[_0xf536('0x42')]=_0xc45380[_0xf536('0x41')];_0x13d3eb[_0xf536('0x43')]=_[_0xf536('0x3f')](_0xc45380['data5'])?_0xf536('0x44'):_0xc45380[_0xf536('0x45')];_0x13d3eb[_0xf536('0x46')]=_[_0xf536('0x3f')](_0xc45380[_0xf536('0x47')])?'600':_0xc45380[_0xf536('0x47')];}break;case _0xf536('0x48'):_0x13d3eb[_0xf536('0x49')]=_0xc45380['data2']?Mustache[_0xf536('0x3b')](_0xc45380[_0xf536('0x39')],_0x4a2fb8):'';_0x13d3eb[_0xf536('0x4a')]=_0xc45380[_0xf536('0x40')]?Mustache['render'](_0xc45380[_0xf536('0x40')],_0x4a2fb8):'';break;}this[_0xf536('0x2a')](util[_0xf536('0x4b')](_0xf536('0x4c'),this['agents'][_0x4a2fb8[_0xf536('0x4d')]]['name']),util['format'](_0xf536('0x4e'),_0xc45380[_0xf536('0x34')][_0xf536('0x35')](),barAndWebActions[_0xc45380['data1']]),_[_0xf536('0x4f')](_0x13d3eb,_0x4a2fb8));break;case _0xf536('0x50'):this[_0xf536('0x2a')](util[_0xf536('0x4b')]('user:%s',this[_0xf536('0xd')][_0x4a2fb8[_0xf536('0x4d')]][_0xf536('0x51')]),util[_0xf536('0x4b')](_0xf536('0x52'),_0xc45380['action']['toLowerCase']()),_['merge']({'ProjectId':parseInt(_0xc45380[_0xf536('0x37')],0xa)},_0x4a2fb8));break;default:this[_0xf536('0x2a')](util['format'](_0xf536('0x4c'),this[_0xf536('0xd')][_0x4a2fb8[_0xf536('0x4d')]][_0xf536('0x51')]),util['format']('trigger:%s',_0xc45380[_0xf536('0x34')]['toLowerCase']()),_[_0xf536('0x4f')]({},_0xc45380,_0x4a2fb8));}}switch(_0xc45380['action'][_0xf536('0x35')]()){case _0xf536('0x53'):cmContact[_0xf536('0x54')](this[_0xf536('0xd')][_0x4a2fb8['interface']],_0xc45380,_0x4a2fb8,cmContactRpc);break;case _0xf536('0x55'):integration[_0xf536('0x54')](_0xc45380,_0x4a2fb8,this[_0xf536('0x1a')],this[_0xf536('0xd')][_0x4a2fb8['interface']],this[_0xf536('0xe')][_0x4a2fb8['queue']],this['voiceExtensions'][_0x4a2fb8[_0xf536('0x56')]]);break;case _0xf536('0x57'):urlforward[_0xf536('0x54')](_0xc45380,_0x4a2fb8);break;}}}}}}};Trigger['prototype'][_0xf536('0x3e')]=function(_0x42b62d,_0x33b678,_0xac0945){var _0x4b5cc7=url['parse'](Mustache[_0xf536('0x3b')](_0x42b62d,_0x33b678),!![]);if(_0xac0945){_[_0xf536('0x4f')](_0x4b5cc7[_0xf536('0x58')],_0x33b678);}delete _0x4b5cc7['search'];return url['format'](_0x4b5cc7);};Trigger[_0xf536('0x29')][_0xf536('0x30')]=function(_0x405dd5,_0x68842){var _0x4728ac=!![],_0x4ca1da=!![];if(_0x405dd5[_0xf536('0x59')]['length']){_0x4728ac=_[_0xf536('0x5a')](_0x405dd5['AllConditions'],this['checkConditions'](_0x68842,_0x405dd5['channel']));}if(_0x405dd5['AnyConditions'][_0xf536('0x33')]){_0x4ca1da=_[_0xf536('0x5b')](_0x405dd5[_0xf536('0x5c')],this['checkConditions'](_0x68842,_0x405dd5[_0xf536('0x5d')]));}return _0x4728ac&&_0x4ca1da;};Trigger[_0xf536('0x29')][_0xf536('0x5e')]=function(_0x5f173d,_0x2d6ed2){return function(_0x52da65){switch(_0x52da65[_0xf536('0x5f')]){case'account':if(_0x5f173d['channel']===_0x2d6ed2){if(_0x2d6ed2===_0xf536('0x60')){return _0x5f173d[_0xf536('0x61')]?operators[_0x52da65['operator']](Number(_0x52da65[_0xf536('0x62')]),_0x5f173d[_0xf536('0x61')]):![];}else{return _0x5f173d[_[_0xf536('0x63')](_0x2d6ed2)+_0xf536('0x64')]?operators[_0x52da65[_0xf536('0x65')]](Number(_0x52da65[_0xf536('0x62')]),_0x5f173d[_['upperFirst'](_0x2d6ed2)+'AccountId']):![];}}break;case _0xf536('0x66'):case _0xf536('0x67'):if(_0x5f173d[_0xf536('0x5d')]===_0x2d6ed2){return _0x5f173d[_0xf536('0x68')]?operators[_0x52da65[_0xf536('0x65')]](_0x52da65[_0xf536('0x62')],_0x5f173d['event']):![];}break;case _0xf536('0x69'):return _0x5f173d[_0xf536('0x69')]?operators[_0x52da65[_0xf536('0x65')]](_0x52da65['value'],_0x5f173d[_0xf536('0x69')]):![];case _0xf536('0x6a'):return _0x5f173d[_0xf536('0x6a')]?operators[_0x52da65[_0xf536('0x65')]](_0x52da65[_0xf536('0x62')],_0x5f173d[_0xf536('0x6a')]):![];case'routeId':return _0x5f173d[_0xf536('0x56')]?operators[_0x52da65[_0xf536('0x65')]](_0x52da65[_0xf536('0x62')],_0x5f173d['routeId']):![];}return![];};};module[_0xf536('0x6b')]=Trigger;
\ No newline at end of file
index 2c933ac..450b09d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2ced=['localhost','emit','application/json','info','Getting\x20agent\x20with\x20email','format','total_entries','entries','then','Agent\x20found!','%s/users/me','remoteUri','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','debug','stringify','GET','authType','%s:%s','password','token','%s/token:%s','username','Basic\x20%s','toString','base64','%s/customers/search','Enduser\x20found!','_embedded','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','length','map','forEach','nameField','customField','toLowerCase','content','type','string','custom_fields','variable','variableName','idField','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','merge','Subjects','phone','xCALLY','Motion','CTI','concat','/api/v2/users/%d','getString','Descriptions','Fields','%s/customers/%d/cases','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','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','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','catch','outbound','none','[OUTBOUND]','destcalleridname','newTab','%s/agent/tickets/%s','abandoned','[ABANDONED]','lodash','request-promise','md5','util','ioredis','../../../../config/logger','redis','defaults'];(function(_0x46bb73,_0x44f394){var _0x44f271=function(_0x2a96bc){while(--_0x2a96bc){_0x46bb73['push'](_0x46bb73['shift']());}};_0x44f271(++_0x44f394);}(_0x2ced,0x133));var _0xd2ce=function(_0x4bb794,_0x1e6e9d){_0x4bb794=_0x4bb794-0x0;var _0xc03b38=_0x2ced[_0x4bb794];return _0xc03b38;};'use strict';var _=require(_0xd2ce('0x0'));var rp=require(_0xd2ce('0x1'));var md5=require(_0xd2ce('0x2'));var util=require(_0xd2ce('0x3'));var Redis=require(_0xd2ce('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xd2ce('0x5'))('desk');config[_0xd2ce('0x6')]=_[_0xd2ce('0x7')](config[_0xd2ce('0x6')],{'host':_0xd2ce('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x191103,_0x257d51,_0x2cf45e){io['to'](_0x191103)[_0xd2ce('0x9')](_0x257d51,_0x2cf45e);}var headers={'Content-Type':_0xd2ce('0xa'),'Accept':_0xd2ce('0xa')};function getUser(_0x478a60,_0x427b92){if(intUtil['validateEmail'](_0x427b92)===!![]){logger[_0xd2ce('0xb')](_0xd2ce('0xc'),_0x427b92);return request({'uri':util[_0xd2ce('0xd')]('%s/users',_0x478a60['remoteUri'])})['then'](function(_0x2bc5c7){if(_0x2bc5c7[_0xd2ce('0xe')]){return _['find'](_0x2bc5c7['_embedded'][_0xd2ce('0xf')],{'email':_0x427b92});}})[_0xd2ce('0x10')](function(_0x901bca){if(_0x901bca){logger[_0xd2ce('0xb')](_0xd2ce('0x11'));return _0x901bca;}else{logger[_0xd2ce('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xd2ce('0x12'),_0x478a60[_0xd2ce('0x13')])});}});}else{logger[_0xd2ce('0xb')](_0xd2ce('0x14'));return request({'uri':util['format'](_0xd2ce('0x12'),_0x478a60[_0xd2ce('0x13')])});}}function request(_0x2bb43b){logger[_0xd2ce('0x15')]('[HTTP]',JSON[_0xd2ce('0x16')](_0x2bb43b));return rp(_['defaults'](_0x2bb43b,{'method':_0xd2ce('0x17'),'headers':headers,'json':!![]}));}function getAuth(_0x1afb85){var _0x43dbb8;if(_0x1afb85[_0xd2ce('0x18')]==='basic'){_0x43dbb8=util[_0xd2ce('0xd')](_0xd2ce('0x19'),_0x1afb85['username'],_0x1afb85[_0xd2ce('0x1a')]);}else if(_0x1afb85['authType']===_0xd2ce('0x1b')){_0x43dbb8=util[_0xd2ce('0xd')](_0xd2ce('0x1c'),_0x1afb85[_0xd2ce('0x1d')],_0x1afb85[_0xd2ce('0x1b')]);}return util['format'](_0xd2ce('0x1e'),new Buffer(_0x43dbb8)[_0xd2ce('0x1f')](_0xd2ce('0x20')));}function getEndUser(_0x194e3a,_0x5f4fdc,_0x2a3f8a){logger['info']('Searching\x20enduser\x20with\x20phone',_0x2a3f8a);return request({'uri':util[_0xd2ce('0xd')](_0xd2ce('0x21'),_0x194e3a['remoteUri']),'qs':{'phone':_0x2a3f8a}})[_0xd2ce('0x10')](function(_0x377fb2){if(_0x377fb2[_0xd2ce('0xe')]){logger[_0xd2ce('0xb')](_0xd2ce('0x22'));return _0x377fb2[_0xd2ce('0x23')][_0xd2ce('0xf')][0x0];}else{logger[_0xd2ce('0xb')](_0xd2ce('0x24'));return request({'uri':util['format'](_0xd2ce('0x25'),_0x194e3a[_0xd2ce('0x13')]),'method':_0xd2ce('0x26'),'body':{'first_name':_0x5f4fdc,'title':_0x5f4fdc,'phone_numbers':[{'type':_0xd2ce('0x27'),'value':_0x2a3f8a}]}});}});}function getTags(_0x170462,_0x51382b){var _0x36a515=[];if(_0x170462&&_0x170462[_0xd2ce('0x28')]>0x0){_0x36a515=_[_0xd2ce('0x29')](_0x170462,_0x51382b);}return _0x36a515;}function getCustomFields(_0x48b05e,_0x4afaff){var _0x25fde4=[];var _0x38a9b8={'custom_fields':{}};if(_0x48b05e[_0xd2ce('0x28')]>0x0){_[_0xd2ce('0x2a')](_0x48b05e,function(_0x1a5077){if(_0x1a5077['type']==='string'&&_0x1a5077[_0xd2ce('0x2b')]&&!_0x1a5077[_0xd2ce('0x2c')]){_0x38a9b8[_0x1a5077[_0xd2ce('0x2b')][_0xd2ce('0x2d')]()]=_0x1a5077[_0xd2ce('0x2e')][_0xd2ce('0x1f')]();}else if(_0x1a5077[_0xd2ce('0x2f')]===_0xd2ce('0x30')&&_0x1a5077['idField']&&_0x1a5077[_0xd2ce('0x2c')]){_0x38a9b8[_0xd2ce('0x31')][_0x1a5077['idField']]=_0x1a5077[_0xd2ce('0x2e')]['toString']();}else if(_0x1a5077['type']===_0xd2ce('0x32')&&_0x1a5077[_0xd2ce('0x33')]&&_0x1a5077[_0xd2ce('0x34')]&&_0x1a5077[_0xd2ce('0x2c')]){_0x4afaff[_0x1a5077[_0xd2ce('0x33')]]&&(_0x38a9b8[_0xd2ce('0x31')][_0x1a5077[_0xd2ce('0x34')]]=_0x4afaff[_0x1a5077[_0xd2ce('0x33')]][_0xd2ce('0x1f')]());}else if(_0x1a5077[_0xd2ce('0x2f')]===_0xd2ce('0x35')&&_0x1a5077[_0xd2ce('0x36')]&&_0x1a5077[_0xd2ce('0x36')][_0xd2ce('0x37')]&&_0x1a5077['idField']&&_0x1a5077['customField']){_0x4afaff[_0x1a5077[_0xd2ce('0x36')][_0xd2ce('0x37')][_0xd2ce('0x2d')]()]&&(_0x38a9b8[_0xd2ce('0x31')][_0x1a5077[_0xd2ce('0x34')]]=_0x4afaff[_0x1a5077['Variable'][_0xd2ce('0x37')][_0xd2ce('0x2d')]()]['toString']());}});}if(_0x38a9b8[_0xd2ce('0x38')]){_0x38a9b8[_0xd2ce('0x38')]=Number(_0x38a9b8[_0xd2ce('0x38')]);}return _0x38a9b8;}function getTicket(_0xa879fe,_0x1747d2,_0x3ce7f7,_0x4b1552,_0x3b7e7a){logger['info'](_0xd2ce('0x39'));var _0x4d007f=_[_0xd2ce('0x3a')]({'subject':intUtil['getString'](_0x4b1552[_0xd2ce('0x3b')],_0x3b7e7a,'\x20'),'type':_0xd2ce('0x3c'),'status':'new','labels':[_0xd2ce('0x3d'),_0xd2ce('0x3e'),_0xd2ce('0x3f')][_0xd2ce('0x40')](getTags(_0x4b1552['Tags'],_0xd2ce('0x37'))),'description':intUtil['getString'](_0x4b1552['Descriptions'],_0x3b7e7a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xd2ce('0xd')](_0xd2ce('0x41'),_0x1747d2['id']),'class':'user'}},'message':{'direction':'in','body':intUtil[_0xd2ce('0x42')](_0x4b1552[_0xd2ce('0x43')],_0x3b7e7a,'\x0a')}},getCustomFields(_0x4b1552[_0xd2ce('0x44')],_0x3b7e7a));return request({'uri':util[_0xd2ce('0xd')](_0xd2ce('0x45'),_0xa879fe[_0xd2ce('0x13')],_0x3ce7f7['id']),'method':_0xd2ce('0x26'),'body':_0x4d007f});}exports[_0xd2ce('0x46')]=function(_0x395d77,_0x427315,_0x50078c,_0x170b3e,_0x543070,_0x4aa289){var _0x2997ac,_0x479a83;_0x4aa289[_0xd2ce('0x13')]=intUtil[_0xd2ce('0x47')](_0x4aa289[_0xd2ce('0x13')]);_0x4aa289[_0xd2ce('0x48')]=intUtil['stripTrailingSlash'](_0x4aa289[_0xd2ce('0x48')]);if(_0x543070&&_0x543070[_0xd2ce('0x49')]){logger[_0xd2ce('0xb')](_0xd2ce('0x4a'),_0xd2ce('0x4b'));_0x427315[_0xd2ce('0x4c')]=util[_0xd2ce('0xd')](_0xd2ce('0x4d'),_0x4aa289[_0xd2ce('0x48')],_0x427315['uniqueid'],md5(_0x427315[_0xd2ce('0x4e')]));}else{_0x427315[_0xd2ce('0x4c')]='';}headers[_0xd2ce('0x4f')]=getAuth(_0x4aa289);return getUser(_0x4aa289,_0x170b3e[_0xd2ce('0x50')])['then'](function(_0x18afff){_0x2997ac=_0x18afff;logger[_0xd2ce('0xb')](_0xd2ce('0x51'),_0x2997ac['id']);return getEndUser(_0x4aa289,_0x427315[_0xd2ce('0x52')],_0x427315[_0xd2ce('0x53')]);})[_0xd2ce('0x10')](function(_0x21a32b){_0x479a83=_0x21a32b;logger[_0xd2ce('0xb')](_0xd2ce('0x54'),_0x479a83['id']);return getTicket(_0x4aa289,_0x2997ac,_0x479a83,_0x50078c,_0x427315);})[_0xd2ce('0x10')](function(_0x5d70f5){if(_0x5d70f5){logger[_0xd2ce('0xb')](_0xd2ce('0x55'));logger['info'](_0xd2ce('0x56'),_0x5d70f5['id']);switch(_0x4aa289[_0xd2ce('0x2f')]){case _0xd2ce('0x57'):logger['info'](_0xd2ce('0x4a'),_0xd2ce('0x58'));emit(util[_0xd2ce('0xd')](_0xd2ce('0x59'),_0x170b3e[_0xd2ce('0x37')]),_0xd2ce('0x5a'),{'recordId':_0x5d70f5['id']});break;case'newTab':logger[_0xd2ce('0xb')](_0xd2ce('0x4a'),_0xd2ce('0x5b'));emit(util[_0xd2ce('0xd')](_0xd2ce('0x59'),_0x170b3e['name']),_0xd2ce('0x5c'),{'uri':util['format'](_0xd2ce('0x5d'),_0x5d70f5['id'])});break;default:logger[_0xd2ce('0x5e')]('[QUEUE]',_0xd2ce('0x5f'));}}})[_0xd2ce('0x60')](function(_0x4b0510){console[_0xd2ce('0x5e')](_0x4b0510);logger[_0xd2ce('0x5e')](_0xd2ce('0x4a'),JSON['stringify'](_0x4b0510));});};exports[_0xd2ce('0x61')]=function(_0x8efb29,_0x446c72,_0x3d6b36,_0x45179e,_0x4c822a,_0x4de6a6,_0x13bcad){var _0x5eeea1,_0x582800;_0x4de6a6[_0xd2ce('0x13')]=intUtil[_0xd2ce('0x47')](_0x4de6a6['remoteUri']);_0x4de6a6['serverUrl']=intUtil[_0xd2ce('0x47')](_0x4de6a6[_0xd2ce('0x48')]);if(_0x13bcad&&_0x13bcad['recordingFormat']&&_0x13bcad['recordingFormat']!==_0xd2ce('0x62')){logger[_0xd2ce('0xb')](_0xd2ce('0x63'),_0xd2ce('0x4b'));_0x446c72[_0xd2ce('0x4c')]=util['format'](_0xd2ce('0x4d'),_0x4de6a6[_0xd2ce('0x48')],_0x446c72[_0xd2ce('0x4e')],md5(_0x446c72[_0xd2ce('0x4e')]));}headers[_0xd2ce('0x4f')]=getAuth(_0x4de6a6);return getUser(_0x4de6a6,_0x45179e[_0xd2ce('0x50')])['then'](function(_0x283ba7){_0x5eeea1=_0x283ba7;logger[_0xd2ce('0xb')](_0xd2ce('0x51'),_0x5eeea1['id']);return getEndUser(_0x4de6a6,_0x446c72[_0xd2ce('0x64')],_0x446c72['destcalleridnum']);})['then'](function(_0x511644){_0x582800=_0x511644;logger['info'](_0xd2ce('0x54'),_0x582800['id']);return getTicket(_0x4de6a6,_0x5eeea1,_0x582800,_0x3d6b36,_0x446c72);})[_0xd2ce('0x10')](function(_0x1adb6c){if(_0x1adb6c){logger[_0xd2ce('0xb')]('Ticket\x20created!');logger['info'](_0xd2ce('0x56'),_0x1adb6c['id']);switch(_0x4de6a6['type']){case _0xd2ce('0x57'):logger[_0xd2ce('0xb')](_0xd2ce('0x4a'),_0xd2ce('0x58'));emit(util[_0xd2ce('0xd')](_0xd2ce('0x59'),_0x45179e[_0xd2ce('0x37')]),_0xd2ce('0x5a'),{'recordId':_0x1adb6c['id']});break;case _0xd2ce('0x65'):logger[_0xd2ce('0xb')](_0xd2ce('0x4a'),_0xd2ce('0x5b'));emit(util[_0xd2ce('0xd')]('user:%s',_0x45179e['name']),_0xd2ce('0x5c'),{'uri':util[_0xd2ce('0xd')](_0xd2ce('0x66'),_0x4de6a6[_0xd2ce('0x13')],_0x1adb6c['id'])});break;default:logger[_0xd2ce('0x5e')](_0xd2ce('0x63'),_0xd2ce('0x5f'));}}})[_0xd2ce('0x60')](function(_0x563c3d){logger['error'](_0xd2ce('0x63'),JSON[_0xd2ce('0x16')](_0x563c3d));});};exports[_0xd2ce('0x67')]=function(_0x25b9aa,_0x4935e7,_0x21fc66,_0x34ff5a,_0x16fb90,_0x2a143d){var _0x5d20cf,_0x2544c2;_0x2a143d[_0xd2ce('0x13')]=intUtil[_0xd2ce('0x47')](_0x2a143d[_0xd2ce('0x13')]);_0x2a143d[_0xd2ce('0x48')]=intUtil[_0xd2ce('0x47')](_0x2a143d['serverUrl']);if(_0x16fb90&&_0x16fb90['monitor_format']){logger['info']('[ABANDONED]',_0xd2ce('0x4b'));_0x4935e7[_0xd2ce('0x4c')]=util[_0xd2ce('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2a143d[_0xd2ce('0x48')],_0x4935e7['uniqueid'],md5(_0x4935e7['uniqueid']));}else{_0x4935e7[_0xd2ce('0x4c')]='';}headers[_0xd2ce('0x4f')]=getAuth(_0x2a143d);return getUser(_0x2a143d)[_0xd2ce('0x10')](function(_0x7645c0){_0x5d20cf=_0x7645c0;logger[_0xd2ce('0xb')](_0xd2ce('0x51'),_0x5d20cf['id']);return getEndUser(_0x2a143d,_0x4935e7[_0xd2ce('0x52')],_0x4935e7[_0xd2ce('0x53')]);})[_0xd2ce('0x10')](function(_0x3d2bf9){_0x2544c2=_0x3d2bf9;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2544c2['id']);return getTicket(_0x2a143d,_0x5d20cf,_0x2544c2,_0x21fc66,_0x4935e7);})[_0xd2ce('0x10')](function(_0x2789fb){if(_0x2789fb){logger[_0xd2ce('0xb')]('Ticket\x20created!');logger[_0xd2ce('0xb')](_0xd2ce('0x56'),_0x2789fb['id']);}})[_0xd2ce('0x60')](function(_0x55ef21){logger[_0xd2ce('0x5e')](_0xd2ce('0x68'),JSON['stringify'](_0x55ef21));});};
\ No newline at end of file
+var _0x93c0=['nameField','customField','toLowerCase','content','idField','custom_fields','variableName','Variable','name','priority','getString','Subjects','phone','xCALLY','CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','newTab','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','catch','outbound','recordingFormat','none','[OUTBOUND]','Authorization','email','The\x20User\x20ID\x20is:','destcalleridname','Displaying\x20ticket\x20to\x20agent...','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','Desk\x20account\x20type\x20not\x20recognized','abandoned','monitor_format','[ABANDONED]','lodash','request-promise','md5','util','ioredis','../../../../config/logger','desk','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','info','format','then','total_entries','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','[HTTP]','stringify','authType','basic','%s:%s','password','token','%s/token:%s','username','toString','base64','%s/customers/search','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','map','forEach','type','string'];(function(_0x967f6b,_0x33be7c){var _0x2ce40=function(_0x4f8a4b){while(--_0x4f8a4b){_0x967f6b['push'](_0x967f6b['shift']());}};_0x2ce40(++_0x33be7c);}(_0x93c0,0x9f));var _0x093c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x93c0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x093c('0x0'));var rp=require(_0x093c('0x1'));var md5=require(_0x093c('0x2'));var util=require(_0x093c('0x3'));var Redis=require(_0x093c('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x093c('0x5'))(_0x093c('0x6'));config[_0x093c('0x7')]=_[_0x093c('0x8')](config[_0x093c('0x7')],{'host':_0x093c('0x9'),'port':0x18eb});var io=require(_0x093c('0xa'))(new Redis(config[_0x093c('0x7')]));function emit(_0x2486e3,_0xb2d0ca,_0x2b4c4a){io['to'](_0x2486e3)[_0x093c('0xb')](_0xb2d0ca,_0x2b4c4a);}var headers={'Content-Type':_0x093c('0xc'),'Accept':'application/json'};function getUser(_0x2b1852,_0x2f8ef5){if(intUtil[_0x093c('0xd')](_0x2f8ef5)===!![]){logger[_0x093c('0xe')]('Getting\x20agent\x20with\x20email',_0x2f8ef5);return request({'uri':util[_0x093c('0xf')]('%s/users',_0x2b1852['remoteUri'])})[_0x093c('0x10')](function(_0x83ba7b){if(_0x83ba7b[_0x093c('0x11')]){return _['find'](_0x83ba7b[_0x093c('0x12')][_0x093c('0x13')],{'email':_0x2f8ef5});}})[_0x093c('0x10')](function(_0x4ccd8e){if(_0x4ccd8e){logger[_0x093c('0xe')](_0x093c('0x14'));return _0x4ccd8e;}else{logger[_0x093c('0xe')](_0x093c('0x15'));return request({'uri':util[_0x093c('0xf')](_0x093c('0x16'),_0x2b1852[_0x093c('0x17')])});}});}else{logger[_0x093c('0xe')](_0x093c('0x18'));return request({'uri':util[_0x093c('0xf')](_0x093c('0x16'),_0x2b1852[_0x093c('0x17')])});}}function request(_0x2ce8d8){logger[_0x093c('0x19')](_0x093c('0x1a'),JSON[_0x093c('0x1b')](_0x2ce8d8));return rp(_[_0x093c('0x8')](_0x2ce8d8,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x35540d){var _0x4f943d;if(_0x35540d[_0x093c('0x1c')]===_0x093c('0x1d')){_0x4f943d=util['format'](_0x093c('0x1e'),_0x35540d['username'],_0x35540d[_0x093c('0x1f')]);}else if(_0x35540d[_0x093c('0x1c')]===_0x093c('0x20')){_0x4f943d=util['format'](_0x093c('0x21'),_0x35540d[_0x093c('0x22')],_0x35540d[_0x093c('0x20')]);}return util[_0x093c('0xf')]('Basic\x20%s',new Buffer(_0x4f943d)[_0x093c('0x23')](_0x093c('0x24')));}function getEndUser(_0x5d2616,_0x12418d,_0x4f99e1){logger['info']('Searching\x20enduser\x20with\x20phone',_0x4f99e1);return request({'uri':util[_0x093c('0xf')](_0x093c('0x25'),_0x5d2616[_0x093c('0x17')]),'qs':{'phone':_0x4f99e1}})[_0x093c('0x10')](function(_0x306ec2){if(_0x306ec2['total_entries']){logger[_0x093c('0xe')]('Enduser\x20found!');return _0x306ec2[_0x093c('0x12')][_0x093c('0x13')][0x0];}else{logger[_0x093c('0xe')](_0x093c('0x26'));return request({'uri':util['format'](_0x093c('0x27'),_0x5d2616[_0x093c('0x17')]),'method':_0x093c('0x28'),'body':{'first_name':_0x12418d,'title':_0x12418d,'phone_numbers':[{'type':'work','value':_0x4f99e1}]}});}});}function getTags(_0x175f7e,_0x54edbd){var _0x14ddf1=[];if(_0x175f7e&&_0x175f7e['length']>0x0){_0x14ddf1=_[_0x093c('0x29')](_0x175f7e,_0x54edbd);}return _0x14ddf1;}function getCustomFields(_0x579e1b,_0x1dc4a0){var _0xc9071e=[];var _0x5352c={'custom_fields':{}};if(_0x579e1b['length']>0x0){_[_0x093c('0x2a')](_0x579e1b,function(_0x19abb5){if(_0x19abb5[_0x093c('0x2b')]===_0x093c('0x2c')&&_0x19abb5[_0x093c('0x2d')]&&!_0x19abb5[_0x093c('0x2e')]){_0x5352c[_0x19abb5['nameField'][_0x093c('0x2f')]()]=_0x19abb5[_0x093c('0x30')][_0x093c('0x23')]();}else if(_0x19abb5[_0x093c('0x2b')]===_0x093c('0x2c')&&_0x19abb5[_0x093c('0x31')]&&_0x19abb5[_0x093c('0x2e')]){_0x5352c[_0x093c('0x32')][_0x19abb5[_0x093c('0x31')]]=_0x19abb5[_0x093c('0x30')]['toString']();}else if(_0x19abb5[_0x093c('0x2b')]==='variable'&&_0x19abb5[_0x093c('0x33')]&&_0x19abb5[_0x093c('0x31')]&&_0x19abb5[_0x093c('0x2e')]){_0x1dc4a0[_0x19abb5[_0x093c('0x33')]]&&(_0x5352c['custom_fields'][_0x19abb5[_0x093c('0x31')]]=_0x1dc4a0[_0x19abb5[_0x093c('0x33')]][_0x093c('0x23')]());}else if(_0x19abb5[_0x093c('0x2b')]==='customVariable'&&_0x19abb5[_0x093c('0x34')]&&_0x19abb5['Variable'][_0x093c('0x35')]&&_0x19abb5[_0x093c('0x31')]&&_0x19abb5['customField']){_0x1dc4a0[_0x19abb5[_0x093c('0x34')]['name'][_0x093c('0x2f')]()]&&(_0x5352c[_0x093c('0x32')][_0x19abb5[_0x093c('0x31')]]=_0x1dc4a0[_0x19abb5[_0x093c('0x34')][_0x093c('0x35')][_0x093c('0x2f')]()][_0x093c('0x23')]());}});}if(_0x5352c[_0x093c('0x36')]){_0x5352c['priority']=Number(_0x5352c[_0x093c('0x36')]);}return _0x5352c;}function getTicket(_0x3dfefb,_0x160564,_0x221de5,_0x4f8697,_0x258a7c){logger['info']('Creating\x20new\x20ticket...');var _0x18374e=_['merge']({'subject':intUtil[_0x093c('0x37')](_0x4f8697[_0x093c('0x38')],_0x258a7c,'\x20'),'type':_0x093c('0x39'),'status':'new','labels':[_0x093c('0x3a'),'Motion',_0x093c('0x3b')][_0x093c('0x3c')](getTags(_0x4f8697[_0x093c('0x3d')],_0x093c('0x35'))),'description':intUtil['getString'](_0x4f8697[_0x093c('0x3e')],_0x258a7c,'\x0a'),'_links':{'assigned_user':{'href':util[_0x093c('0xf')](_0x093c('0x3f'),_0x160564['id']),'class':_0x093c('0x40')}},'message':{'direction':'in','body':intUtil[_0x093c('0x37')](_0x4f8697['Descriptions'],_0x258a7c,'\x0a')}},getCustomFields(_0x4f8697[_0x093c('0x41')],_0x258a7c));return request({'uri':util[_0x093c('0xf')](_0x093c('0x42'),_0x3dfefb[_0x093c('0x17')],_0x221de5['id']),'method':'POST','body':_0x18374e});}exports[_0x093c('0x43')]=function(_0x982886,_0x319b87,_0x23eee8,_0x5f3cec,_0x4cb4b6,_0x5c8418){var _0x35298e,_0xc0c2bc;_0x5c8418['remoteUri']=intUtil[_0x093c('0x44')](_0x5c8418['remoteUri']);_0x5c8418[_0x093c('0x45')]=intUtil[_0x093c('0x44')](_0x5c8418[_0x093c('0x45')]);if(_0x4cb4b6&&_0x4cb4b6['monitor_format']){logger[_0x093c('0xe')](_0x093c('0x46'),_0x093c('0x47'));_0x319b87[_0x093c('0x48')]=util[_0x093c('0xf')](_0x093c('0x49'),_0x5c8418[_0x093c('0x45')],_0x319b87['uniqueid'],md5(_0x319b87[_0x093c('0x4a')]));}else{_0x319b87[_0x093c('0x48')]='';}headers['Authorization']=getAuth(_0x5c8418);return getUser(_0x5c8418,_0x5f3cec['email'])['then'](function(_0x25e770){_0x35298e=_0x25e770;logger['info']('The\x20User\x20ID\x20is:',_0x35298e['id']);return getEndUser(_0x5c8418,_0x319b87[_0x093c('0x4b')],_0x319b87[_0x093c('0x4c')]);})[_0x093c('0x10')](function(_0xeccc0f){_0xc0c2bc=_0xeccc0f;logger['info'](_0x093c('0x4d'),_0xc0c2bc['id']);return getTicket(_0x5c8418,_0x35298e,_0xc0c2bc,_0x23eee8,_0x319b87);})[_0x093c('0x10')](function(_0x422472){if(_0x422472){logger['info'](_0x093c('0x4e'));logger[_0x093c('0xe')](_0x093c('0x4f'),_0x422472['id']);switch(_0x5c8418[_0x093c('0x2b')]){case _0x093c('0x50'):logger[_0x093c('0xe')](_0x093c('0x46'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x093c('0xf')](_0x093c('0x51'),_0x5f3cec[_0x093c('0x35')]),'trigger:desk:display',{'recordId':_0x422472['id']});break;case _0x093c('0x52'):logger[_0x093c('0xe')](_0x093c('0x46'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x093c('0xf')](_0x093c('0x51'),_0x5f3cec['name']),_0x093c('0x53'),{'uri':util[_0x093c('0xf')](_0x093c('0x54'),_0x422472['id'])});break;default:logger[_0x093c('0x55')](_0x093c('0x46'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x093c('0x56')](function(_0x27531a){console[_0x093c('0x55')](_0x27531a);logger[_0x093c('0x55')](_0x093c('0x46'),JSON[_0x093c('0x1b')](_0x27531a));});};exports[_0x093c('0x57')]=function(_0x22ad72,_0x587f7a,_0x4fef1e,_0x4876df,_0x206c48,_0x4d04d1,_0x272372){var _0xbce604,_0x50d757;_0x4d04d1[_0x093c('0x17')]=intUtil[_0x093c('0x44')](_0x4d04d1[_0x093c('0x17')]);_0x4d04d1[_0x093c('0x45')]=intUtil[_0x093c('0x44')](_0x4d04d1[_0x093c('0x45')]);if(_0x272372&&_0x272372[_0x093c('0x58')]&&_0x272372[_0x093c('0x58')]!==_0x093c('0x59')){logger['info'](_0x093c('0x5a'),'Recording\x20is\x20enabled!');_0x587f7a[_0x093c('0x48')]=util['format'](_0x093c('0x49'),_0x4d04d1[_0x093c('0x45')],_0x587f7a['uniqueid'],md5(_0x587f7a[_0x093c('0x4a')]));}headers[_0x093c('0x5b')]=getAuth(_0x4d04d1);return getUser(_0x4d04d1,_0x4876df[_0x093c('0x5c')])[_0x093c('0x10')](function(_0x2b6473){_0xbce604=_0x2b6473;logger['info'](_0x093c('0x5d'),_0xbce604['id']);return getEndUser(_0x4d04d1,_0x587f7a[_0x093c('0x5e')],_0x587f7a['destcalleridnum']);})['then'](function(_0xa53768){_0x50d757=_0xa53768;logger[_0x093c('0xe')](_0x093c('0x4d'),_0x50d757['id']);return getTicket(_0x4d04d1,_0xbce604,_0x50d757,_0x4fef1e,_0x587f7a);})[_0x093c('0x10')](function(_0x2d7e98){if(_0x2d7e98){logger[_0x093c('0xe')]('Ticket\x20created!');logger[_0x093c('0xe')](_0x093c('0x4f'),_0x2d7e98['id']);switch(_0x4d04d1[_0x093c('0x2b')]){case _0x093c('0x50'):logger[_0x093c('0xe')](_0x093c('0x46'),_0x093c('0x5f'));emit(util['format']('user:%s',_0x4876df[_0x093c('0x35')]),_0x093c('0x60'),{'recordId':_0x2d7e98['id']});break;case _0x093c('0x52'):logger[_0x093c('0xe')]('[QUEUE]',_0x093c('0x61'));emit(util['format'](_0x093c('0x51'),_0x4876df['name']),_0x093c('0x53'),{'uri':util[_0x093c('0xf')]('%s/agent/tickets/%s',_0x4d04d1['remoteUri'],_0x2d7e98['id'])});break;default:logger[_0x093c('0x55')](_0x093c('0x5a'),_0x093c('0x62'));}}})[_0x093c('0x56')](function(_0x4f1d37){logger['error']('[OUTBOUND]',JSON[_0x093c('0x1b')](_0x4f1d37));});};exports[_0x093c('0x63')]=function(_0x4b2ec4,_0x215eff,_0x403485,_0x335cc8,_0x5bbc92,_0x9e0bf8){var _0x3a5f47,_0x7462d5;_0x9e0bf8[_0x093c('0x17')]=intUtil['stripTrailingSlash'](_0x9e0bf8[_0x093c('0x17')]);_0x9e0bf8['serverUrl']=intUtil[_0x093c('0x44')](_0x9e0bf8[_0x093c('0x45')]);if(_0x5bbc92&&_0x5bbc92[_0x093c('0x64')]){logger[_0x093c('0xe')](_0x093c('0x65'),'Recording\x20is\x20enabled!');_0x215eff['recordingURL']=util[_0x093c('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x9e0bf8[_0x093c('0x45')],_0x215eff[_0x093c('0x4a')],md5(_0x215eff['uniqueid']));}else{_0x215eff['recordingURL']='';}headers['Authorization']=getAuth(_0x9e0bf8);return getUser(_0x9e0bf8)[_0x093c('0x10')](function(_0x5214cd){_0x3a5f47=_0x5214cd;logger[_0x093c('0xe')](_0x093c('0x5d'),_0x3a5f47['id']);return getEndUser(_0x9e0bf8,_0x215eff['calleridname'],_0x215eff[_0x093c('0x4c')]);})[_0x093c('0x10')](function(_0x66fcad){_0x7462d5=_0x66fcad;logger[_0x093c('0xe')]('The\x20Enduser\x20ID\x20is:',_0x7462d5['id']);return getTicket(_0x9e0bf8,_0x3a5f47,_0x7462d5,_0x403485,_0x215eff);})[_0x093c('0x10')](function(_0x4464b0){if(_0x4464b0){logger[_0x093c('0xe')]('Ticket\x20created!');logger[_0x093c('0xe')](_0x093c('0x4f'),_0x4464b0['id']);}})[_0x093c('0x56')](function(_0x594f12){logger[_0x093c('0x55')](_0x093c('0x65'),JSON[_0x093c('0x1b')](_0x594f12));});};
\ No newline at end of file
index 711f65c..86a311e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x62b9=['user:%s','emit','serverUrl','stripTrailingSlash','abandoned','%s/api/data/v9.0/','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','info','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Enduser\x20phone\x20is:','The\x20%s\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','bluebird','request-promise','util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','systemusers?$select=internalemailaddress','4.0','email','userEmail','internalemailaddress','userId','length','systemuserid','catch','toLowerCase','outbound','destcalleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','message','GET','contacts?$select=telephone1','Bearer\x20','value','calleridnum','contactid','forEach','type','string','nameField','customField','idField','indexOf','content','ticketType','incident','assign','getString','Subjects','Descriptions','Fields','phonecall','phonecalls','/contacts(','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s'];(function(_0x2becba,_0x4ea656){var _0x90b5dd=function(_0x26ae2b){while(--_0x26ae2b){_0x2becba['push'](_0x2becba['shift']());}};_0x90b5dd(++_0x4ea656);}(_0x62b9,0x130));var _0x962b=function(_0x458441,_0x3c6516){_0x458441=_0x458441-0x0;var _0x42886e=_0x62b9[_0x458441];return _0x42886e;};'use strict';var _=require(_0x962b('0x0'));var BPromise=require(_0x962b('0x1'));var rp=require(_0x962b('0x2'));var util=require(_0x962b('0x3'));var intUtil=require('./util');var md5=require('md5');var Redis=require(_0x962b('0x4'));var logger=require(_0x962b('0x5'))(_0x962b('0x6'));var config=require(_0x962b('0x7'));config[_0x962b('0x8')]=_['defaults'](config[_0x962b('0x8')],{'host':_0x962b('0x9'),'port':0x18eb});var io=require(_0x962b('0xa'))(new Redis(config[_0x962b('0x8')]));function getAuthToken(_0x44fe4e,_0x19241c){var _0x3a3e2a={'method':_0x962b('0xb'),'uri':_0x19241c,'form':{'client_id':_0x44fe4e[_0x962b('0xc')],'resource':_0x44fe4e[_0x962b('0xd')],'username':_0x44fe4e[_0x962b('0xe')],'password':_0x44fe4e[_0x962b('0xf')],'grant_type':'password','client_secret':_0x44fe4e[_0x962b('0x10')]},'json':!![]};return rp(_0x3a3e2a)[_0x962b('0x11')](function(_0x2e2f1e){return _0x2e2f1e[_0x962b('0x12')];});}function getUser(_0x2f0029,_0x23d02b,_0x4802f6,_0x59a12a,_0x46d8ca){return new BPromise(function(_0x49276d,_0x1347de){return getAuthToken(_0x23d02b,_0x59a12a)[_0x962b('0x11')](function(_0x4bcdfa){var _0x5c8352={'method':'GET','uri':_0x46d8ca+_0x962b('0x13'),'headers':{'Authorization':'Bearer\x20'+_0x4bcdfa,'OData-Version':_0x962b('0x14')},'json':!![]};return rp(_0x5c8352);})[_0x962b('0x11')](function(_0x5d6f2f){var _0x398676=_0x5d6f2f['value'];var _0x299ea0=![];var _0x221ae7=null;if(_0x4802f6&&_0x4802f6[_0x962b('0x15')]){_0x2f0029[_0x962b('0x16')]=_0x4802f6['email'];for(_0x221ae7=0x0;_0x221ae7<_0x398676['length'];_0x221ae7++){if(_0x398676[_0x221ae7][_0x962b('0x17')]===_0x4802f6['email']){_0x299ea0=!![];_0x2f0029[_0x962b('0x18')]=_0x398676[_0x221ae7]['systemuserid'];}}}if(!_0x299ea0){_0x2f0029[_0x962b('0x16')]=_0x23d02b['username'];for(_0x221ae7=0x0;_0x221ae7<_0x398676[_0x962b('0x19')];_0x221ae7++){if(_0x398676[_0x221ae7][_0x962b('0x17')]===_0x23d02b[_0x962b('0xe')]){_0x2f0029['userId']=_0x398676[_0x221ae7][_0x962b('0x1a')];}}}_0x49276d(_0x2f0029);})[_0x962b('0x1b')](function(_0x1ee149){_0x1347de(_0x1ee149['message']);});});}function createEndUser(_0x47778d,_0x3df2f0,_0x4c9986,_0x165df0,_0x274baa,_0x3e7d8c){return new BPromise(function(_0x4d9dc8,_0x190519){return getAuthToken(_0x3df2f0,_0x4c9986)[_0x962b('0x11')](function(_0x36bb1e){var _0x26b3af=_0x3e7d8c[_0x962b('0x1c')]()===_0x962b('0x1d')?_0x274baa[_0x962b('0x1e')]:_0x274baa['calleridnum'];var _0x496404={'method':_0x962b('0xb'),'uri':_0x165df0+_0x962b('0x1f'),'body':{'telephone1':_0x26b3af,'fullname':_0x26b3af,'firstname':_0x26b3af,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x962b('0x20')+_0x47778d[_0x962b('0x18')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x36bb1e,'OData-Version':_0x962b('0x14')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x496404);})[_0x962b('0x11')](function(_0xdbbed5){var _0xc9ab1d=_0xdbbed5[_0x962b('0x21')][_0x962b('0x22')];var _0x33b184=_0xc9ab1d[_0x962b('0x23')](_0xc9ab1d[_0x962b('0x24')]('(')+0x1,_0xc9ab1d[_0x962b('0x24')](')'));_0x47778d[_0x962b('0x25')]=_0x33b184;_0x4d9dc8(_0x47778d);})[_0x962b('0x1b')](function(_0x4106e5){_0x190519(_0x4106e5[_0x962b('0x26')]);});});}function getEndUser(_0xae76c6,_0x414427,_0x5a823e,_0x2aeb81,_0x2c23f1,_0x2a5da5){return new BPromise(function(_0x1f2743,_0x42c805){return getAuthToken(_0x414427,_0x5a823e)[_0x962b('0x11')](function(_0x4a0de4){var _0x44c24f={'method':_0x962b('0x27'),'uri':_0x2aeb81+_0x962b('0x28'),'headers':{'Authorization':_0x962b('0x29')+_0x4a0de4,'If-None-Match':null,'OData-Version':_0x962b('0x14')},'json':!![]};return rp(_0x44c24f);})['then'](function(_0x54b2eb){var _0x53756d=null;if(_0x54b2eb){var _0x2b04af=_0x54b2eb[_0x962b('0x2a')];var _0x4faea8=![];for(_0x53756d=0x0;_0x53756d<_0x2b04af[_0x962b('0x19')];_0x53756d++){var _0x3cdccf=_0x2a5da5[_0x962b('0x1c')]()===_0x962b('0x1d')?_0x2c23f1[_0x962b('0x1e')]:_0x2c23f1[_0x962b('0x2b')];if(_0x2b04af[_0x53756d]['telephone1']===_0x3cdccf){_0x4faea8=!![];_0xae76c6[_0x962b('0x25')]=_0x2b04af[_0x53756d][_0x962b('0x2c')];}}if(_0x4faea8){_0x1f2743(_0xae76c6);}else{return createEndUser(_0xae76c6,_0x414427,_0x5a823e,_0x2aeb81,_0x2c23f1,_0x2a5da5)[_0x962b('0x11')](function(_0x5ed3fb){_0x1f2743(_0x5ed3fb);});}}else{return createEndUser(_0xae76c6,_0x414427,_0x5a823e,_0x2aeb81,_0x2c23f1,_0x2a5da5)[_0x962b('0x11')](function(_0x527310){_0x1f2743(_0x527310);});}});});}function getCustomFields(_0x92b99a,_0x1f8aa1,_0x11b69a){var _0x478fd8={};if(_0x92b99a[_0x962b('0x19')]>0x0){_[_0x962b('0x2d')](_0x92b99a,function(_0x4dd3d0){if(_0x4dd3d0[_0x962b('0x2e')]===_0x962b('0x2f')&&_0x4dd3d0[_0x962b('0x30')]&&!_0x4dd3d0[_0x962b('0x31')]){var _0x316c04=_0x4dd3d0[_0x962b('0x32')][_0x962b('0x1c')]();var _0x222342=_0x316c04[_0x962b('0x23')](0x0,_0x316c04[_0x962b('0x33')]('_'));var _0x3dc902=_0x316c04[_0x962b('0x23')](_0x316c04[_0x962b('0x33')]('_')+0x1);if(_0x222342===_0x11b69a){_0x478fd8[_0x3dc902]=_0x4dd3d0[_0x962b('0x34')];}}});}return _0x478fd8;}function getTicket(_0xae8cbf,_0x32425e,_0x5dfe26,_0x6a3cb5,_0x325abd,_0x24af2d){return new BPromise(function(_0xd0d9d7,_0x16ab94){var _0x3f24ef;return getAuthToken(_0x32425e,_0x5dfe26)[_0x962b('0x11')](function(_0x1e9d8e){if(_0x24af2d[_0x962b('0x35')]===_0x962b('0x36')){_0x3f24ef={'method':_0x962b('0xb'),'uri':_0x6a3cb5+'incidents','body':Object[_0x962b('0x37')]({},{'title':intUtil[_0x962b('0x38')](_0x24af2d[_0x962b('0x39')],_0x325abd,'\x20'),'description':intUtil[_0x962b('0x38')](_0x24af2d[_0x962b('0x3a')],_0x325abd,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0xae8cbf[_0x962b('0x25')]+')','ownerid@odata.bind':_0x962b('0x20')+_0xae8cbf[_0x962b('0x18')]+')','caseorigincode':'1'},getCustomFields(_0x24af2d[_0x962b('0x3b')],_0x325abd,_0x24af2d[_0x962b('0x35')])),'headers':{'Authorization':_0x962b('0x29')+_0x1e9d8e,'OData-Version':_0x962b('0x14')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x24af2d[_0x962b('0x35')]===_0x962b('0x3c')){_0x3f24ef={'method':_0x962b('0xb'),'uri':_0x6a3cb5+_0x962b('0x3d'),'body':Object[_0x962b('0x37')]({},{'subject':intUtil[_0x962b('0x38')](_0x24af2d[_0x962b('0x39')],_0x325abd,'\x20'),'phonenumber':String(_0x325abd[_0x962b('0x2b')]),'description':intUtil[_0x962b('0x38')](_0x24af2d['Descriptions'],_0x325abd,'\x0a'),'regardingobjectid_contact@odata.bind':_0x962b('0x3e')+_0xae8cbf[_0x962b('0x25')]+')','ownerid@odata.bind':_0x962b('0x20')+_0xae8cbf[_0x962b('0x18')]+')','directioncode':_0xae8cbf['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x962b('0x20')+_0xae8cbf['userId']+')','participationtypemask':_0xae8cbf['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x962b('0x3e')+_0xae8cbf[_0x962b('0x25')]+')','participationtypemask':_0xae8cbf[_0x962b('0x3f')]===_0x962b('0x40')?0x1:0x2}]},getCustomFields(_0x24af2d[_0x962b('0x3b')],_0x325abd,_0x24af2d[_0x962b('0x35')])),'headers':{'Authorization':'Bearer\x20'+_0x1e9d8e,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3f24ef);})['then'](function(_0x51fa63){var _0x429a2a=_0x51fa63[_0x962b('0x21')][_0x962b('0x22')];var _0x3904bb=_0x429a2a[_0x962b('0x23')](_0x429a2a[_0x962b('0x24')]('(')+0x1,_0x429a2a[_0x962b('0x24')](')'));_0xae8cbf[_0x962b('0x41')]=_0x3904bb;_0xd0d9d7(_0xae8cbf);})[_0x962b('0x1b')](function(_0x3d9b73){_0x16ab94(_0x3d9b73[_0x962b('0x26')]);});});}function emit(_0x532a73,_0x1f5c7c,_0x150b78,_0xadde27){var _0x39bee5={'uri':util[_0x962b('0x42')](_0x962b('0x43'),_0x532a73,_0x150b78,_0xadde27)};io['to'](util['format'](_0x962b('0x44'),_0x1f5c7c))[_0x962b('0x45')]('trigger:browser:url',_0x39bee5);}exports['cs']=function(_0x303ba6,_0x31e522,_0x303e0c,_0x27f0f3,_0x5b24e8,_0x29acfe,_0x22910e,_0xcae6be){var _0x92b488={};_0x29acfe[_0x962b('0xd')]=intUtil['stripTrailingSlash'](_0x29acfe['remoteUri']);_0x29acfe[_0x962b('0x46')]=intUtil[_0x962b('0x47')](_0x29acfe[_0x962b('0x46')]);_0x92b488[_0x962b('0x3f')]=_0xcae6be===_0x962b('0x40')||_0xcae6be===_0x962b('0x48')?_0x962b('0x40'):_0x962b('0x1d');var _0x1120e0=util[_0x962b('0x42')](_0x962b('0x49'),_0x29acfe['remoteUri']);var _0x466a77=util[_0x962b('0x42')]('https://login.microsoftonline.com/%s/oauth2/token',_0x29acfe[_0x962b('0x4a')]);var _0x15adf6=util['format'](_0x962b('0x4b'),_0x29acfe[_0x962b('0x46')],_0x31e522[_0x962b('0x4c')],md5(_0x31e522[_0x962b('0x4c')]));if(_0x5b24e8&&_0x5b24e8[_0x962b('0x4d')]){logger[_0x962b('0x4e')](_0x962b('0x4f'),'Recording\x20is\x20enabled!');_0x31e522[_0x962b('0x50')]=_0x15adf6;}else if(_0x22910e&&_0x22910e['recordingFormat']&&_0x22910e[_0x962b('0x51')]!==_0x962b('0x52')){logger['info'](_0x962b('0x53'),_0x962b('0x54'));_0x31e522['recordingURL']=_0x15adf6;}else{_0x31e522['recordingURL']='';}return getUser(_0x92b488,_0x29acfe,_0x27f0f3,_0x466a77,_0x1120e0)['then'](function(_0x43f2a1){logger['info'](_0x962b('0x55'),_0x43f2a1[_0x962b('0x18')]);logger[_0x962b('0x4e')]('The\x20User\x20email\x20is:',_0x43f2a1[_0x962b('0x16')]);return getEndUser(_0x43f2a1,_0x29acfe,_0x466a77,_0x1120e0,_0x31e522,_0xcae6be);})[_0x962b('0x11')](function(_0x1d9c2e){logger['info'](_0x962b('0x56'),_0x1d9c2e[_0x962b('0x25')]);logger[_0x962b('0x4e')](_0x962b('0x57'),_0x31e522['calleridnum']);return getTicket(_0x1d9c2e,_0x29acfe,_0x466a77,_0x1120e0,_0x31e522,_0x303e0c);})[_0x962b('0x11')](function(_0x2407d1){logger[_0x962b('0x4e')](util['format'](_0x962b('0x58'),_0x303e0c[_0x962b('0x35')],_0x2407d1[_0x962b('0x41')]));logger[_0x962b('0x4e')](util[_0x962b('0x42')]('call\x20direction:\x20%s',_0xcae6be));if(_0xcae6be!==_0x962b('0x48')){logger[_0x962b('0x4e')]('['+_0xcae6be['toUpperCase']()+']',_0x962b('0x59'));emit(_0x29acfe[_0x962b('0xd')],_0x27f0f3[_0x962b('0x5a')],_0x303e0c['ticketType'],_0x2407d1['ticketId']);}})[_0x962b('0x1b')](function(_0x4b07b9){logger[_0x962b('0x5b')]('['+_0xcae6be['toUpperCase']()+_0x962b('0x5c'),util['inspect'](_0x4b07b9,{'showHidden':!![],'depth':null}));});};
\ No newline at end of file
+var _0xb07d=['userEmail','email','length','internalemailaddress','userId','systemuserid','info','username','toLowerCase','outbound','calleridnum','headers','odata-entityid','lastIndexOf','enduserId','destcalleridnum','telephone1','forEach','type','string','nameField','idField','substring','indexOf','content','ticketType','incident','assign','getString','Subjects','/contacts(','/systemusers(','phonecall','phonecalls','Descriptions','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','abandoned','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20User\x20ID\x20is:','The\x20User\x20email\x20is:','The\x20Enduser\x20ID\x20is:','The\x20%s\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','inspect','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','socket.io-emitter','POST','clientId','remoteUri','password','clientSecret','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','then','GET','Bearer\x20','4.0','value'];(function(_0x5da997,_0x324101){var _0xa4a9fa=function(_0x17ecf3){while(--_0x17ecf3){_0x5da997['push'](_0x5da997['shift']());}};_0xa4a9fa(++_0x324101);}(_0xb07d,0x1b0));var _0xdb07=function(_0x26b6d8,_0x159577){_0x26b6d8=_0x26b6d8-0x0;var _0x1f6f61=_0xb07d[_0x26b6d8];return _0x1f6f61;};'use strict';var _=require(_0xdb07('0x0'));var BPromise=require('bluebird');var rp=require(_0xdb07('0x1'));var util=require(_0xdb07('0x2'));var intUtil=require(_0xdb07('0x3'));var md5=require(_0xdb07('0x4'));var Redis=require(_0xdb07('0x5'));var logger=require(_0xdb07('0x6'))(_0xdb07('0x7'));var config=require(_0xdb07('0x8'));config[_0xdb07('0x9')]=_[_0xdb07('0xa')](config[_0xdb07('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xdb07('0xb'))(new Redis(config['redis']));function getAuthToken(_0x2247f4,_0x3a83d4,_0x11c36b){var _0x1a6dff={'method':_0xdb07('0xc'),'uri':_0x3a83d4,'form':{'client_id':_0x2247f4[_0xdb07('0xd')],'resource':_0x2247f4[_0xdb07('0xe')],'username':_0x2247f4['username'],'password':_0x2247f4[_0xdb07('0xf')],'grant_type':_0xdb07('0xf'),'client_secret':_0x2247f4[_0xdb07('0x10')]},'json':!![]};return rp(_0x1a6dff)['then'](function(_0x16425d){return _0x16425d[_0xdb07('0x11')];})[_0xdb07('0x12')](function(_0x119db9){logger[_0xdb07('0x13')]('['+[_0x11c36b[_0xdb07('0x14')]()]+_0xdb07('0x15'));return _0x119db9[_0xdb07('0x16')];});}function getUser(_0x500bbd,_0x31103c,_0x405cc5,_0x3afd5a,_0x486501,_0x400376){return new BPromise(function(_0x452c6c,_0x13c5f4){return getAuthToken(_0x31103c,_0x3afd5a,_0x400376)[_0xdb07('0x17')](function(_0x55bb39){var _0x54ac83={'method':_0xdb07('0x18'),'uri':_0x486501+'systemusers?$select=internalemailaddress','headers':{'Authorization':_0xdb07('0x19')+_0x55bb39,'OData-Version':_0xdb07('0x1a')},'json':!![]};return rp(_0x54ac83);})[_0xdb07('0x17')](function(_0x54de9c){var _0x4c0f6e=_0x54de9c[_0xdb07('0x1b')];var _0x1554b5=![];var _0x5e0290=null;if(_0x405cc5&&intUtil['validateEmail'](_0x405cc5['email'])){_0x500bbd[_0xdb07('0x1c')]=_0x405cc5[_0xdb07('0x1d')];for(_0x5e0290=0x0;_0x5e0290<_0x4c0f6e[_0xdb07('0x1e')];_0x5e0290++){if(_0x4c0f6e[_0x5e0290][_0xdb07('0x1f')]===_0x405cc5[_0xdb07('0x1d')]){_0x1554b5=!![];_0x500bbd[_0xdb07('0x20')]=_0x4c0f6e[_0x5e0290][_0xdb07('0x21')];}}}if(!_0x1554b5){logger[_0xdb07('0x22')]('['+[_0x400376['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x500bbd[_0xdb07('0x1c')]=_0x31103c[_0xdb07('0x23')];for(_0x5e0290=0x0;_0x5e0290<_0x4c0f6e[_0xdb07('0x1e')];_0x5e0290++){if(_0x4c0f6e[_0x5e0290][_0xdb07('0x1f')]===_0x31103c['username']){_0x500bbd[_0xdb07('0x20')]=_0x4c0f6e[_0x5e0290][_0xdb07('0x21')];}}}_0x452c6c(_0x500bbd);})['catch'](function(_0x39d72d){_0x13c5f4(_0x39d72d[_0xdb07('0x16')]);});});}function createEndUser(_0x2a6b88,_0x24ec4e,_0x397f50,_0x54e49e,_0x484a91,_0x6493a1){return new BPromise(function(_0x43dd62,_0x2ff190){return getAuthToken(_0x24ec4e,_0x397f50,_0x6493a1)[_0xdb07('0x17')](function(_0x5f1a01){var _0x37378a=_0x6493a1[_0xdb07('0x24')]()===_0xdb07('0x25')?_0x484a91['destcalleridnum']:_0x484a91[_0xdb07('0x26')];var _0x2890ed={'method':_0xdb07('0xc'),'uri':_0x54e49e+'contacts','body':{'telephone1':_0x37378a,'fullname':_0x37378a,'firstname':_0x37378a,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x2a6b88[_0xdb07('0x20')]+')'},'headers':{'Authorization':_0xdb07('0x19')+_0x5f1a01,'OData-Version':_0xdb07('0x1a')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x2890ed);})[_0xdb07('0x17')](function(_0x41d3a0){var _0x303637=_0x41d3a0[_0xdb07('0x27')][_0xdb07('0x28')];var _0x4e2df9=_0x303637['substring'](_0x303637['lastIndexOf']('(')+0x1,_0x303637[_0xdb07('0x29')](')'));_0x2a6b88[_0xdb07('0x2a')]=_0x4e2df9;_0x43dd62(_0x2a6b88);})['catch'](function(_0x3241a2){_0x2ff190(_0x3241a2[_0xdb07('0x16')]);});});}function getEndUser(_0x523221,_0x111f35,_0x458bf6,_0x45a31e,_0x5960b5,_0x4551f9){return new BPromise(function(_0x4fa1b1,_0x41d457){return getAuthToken(_0x111f35,_0x458bf6,_0x4551f9)['then'](function(_0x2f0a37){var _0x2564ff={'method':_0xdb07('0x18'),'uri':_0x45a31e+'contacts?$select=telephone1','headers':{'Authorization':'Bearer\x20'+_0x2f0a37,'If-None-Match':null,'OData-Version':_0xdb07('0x1a')},'json':!![]};return rp(_0x2564ff);})[_0xdb07('0x17')](function(_0x9267f2){var _0x469b07=null;if(_0x9267f2){var _0x1a077b=_0x9267f2['value'];var _0x5d7ad3=![];for(_0x469b07=0x0;_0x469b07<_0x1a077b[_0xdb07('0x1e')];_0x469b07++){var _0x569c78=_0x4551f9[_0xdb07('0x24')]()===_0xdb07('0x25')?_0x5960b5[_0xdb07('0x2b')]:_0x5960b5[_0xdb07('0x26')];if(_0x1a077b[_0x469b07][_0xdb07('0x2c')]===_0x569c78){_0x5d7ad3=!![];_0x523221[_0xdb07('0x2a')]=_0x1a077b[_0x469b07]['contactid'];}}if(_0x5d7ad3){_0x4fa1b1(_0x523221);}else{return createEndUser(_0x523221,_0x111f35,_0x458bf6,_0x45a31e,_0x5960b5,_0x4551f9)[_0xdb07('0x17')](function(_0x4b4cac){_0x4fa1b1(_0x4b4cac);});}}else{return createEndUser(_0x523221,_0x111f35,_0x458bf6,_0x45a31e,_0x5960b5,_0x4551f9)[_0xdb07('0x17')](function(_0x454f4c){_0x4fa1b1(_0x454f4c);});}});});}function getCustomFields(_0x582a45,_0x2ccbc5,_0xb36c4a){var _0x25304e={};if(_0x582a45[_0xdb07('0x1e')]>0x0){_[_0xdb07('0x2d')](_0x582a45,function(_0x4e29a7){if(_0x4e29a7[_0xdb07('0x2e')]===_0xdb07('0x2f')&&_0x4e29a7[_0xdb07('0x30')]&&!_0x4e29a7['customField']){var _0x26871b=_0x4e29a7[_0xdb07('0x31')]['toLowerCase']();var _0x11f1a1=_0x26871b[_0xdb07('0x32')](0x0,_0x26871b[_0xdb07('0x33')]('_'));var _0x4a79eb=_0x26871b[_0xdb07('0x32')](_0x26871b['indexOf']('_')+0x1);if(_0x11f1a1===_0xb36c4a){_0x25304e[_0x4a79eb]=_0x4e29a7[_0xdb07('0x34')];}}});}return _0x25304e;}function getTicket(_0x4c65e6,_0x3562b5,_0x593330,_0xc06ce7,_0xadd511,_0x2cfee8,_0x42252d){return new BPromise(function(_0x5bb5c8,_0x54dd){var _0x8577be;return getAuthToken(_0x3562b5,_0x593330,_0x42252d)[_0xdb07('0x17')](function(_0x3fa9f9){if(_0x2cfee8[_0xdb07('0x35')]===_0xdb07('0x36')){_0x8577be={'method':_0xdb07('0xc'),'uri':_0xc06ce7+'incidents','body':Object[_0xdb07('0x37')]({},{'title':intUtil[_0xdb07('0x38')](_0x2cfee8[_0xdb07('0x39')],_0xadd511,'\x20'),'description':intUtil[_0xdb07('0x38')](_0x2cfee8['Descriptions'],_0xadd511,'\x0a'),'customerid_contact@odata.bind':_0xdb07('0x3a')+_0x4c65e6[_0xdb07('0x2a')]+')','ownerid@odata.bind':_0xdb07('0x3b')+_0x4c65e6[_0xdb07('0x20')]+')','caseorigincode':'1'},getCustomFields(_0x2cfee8['Fields'],_0xadd511,_0x2cfee8[_0xdb07('0x35')])),'headers':{'Authorization':_0xdb07('0x19')+_0x3fa9f9,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2cfee8['ticketType']===_0xdb07('0x3c')){_0x8577be={'method':_0xdb07('0xc'),'uri':_0xc06ce7+_0xdb07('0x3d'),'body':Object['assign']({},{'subject':intUtil[_0xdb07('0x38')](_0x2cfee8[_0xdb07('0x39')],_0xadd511,'\x20'),'phonenumber':String(_0xadd511['calleridnum']),'description':intUtil['getString'](_0x2cfee8[_0xdb07('0x3e')],_0xadd511,'\x0a'),'regardingobjectid_contact@odata.bind':_0xdb07('0x3a')+_0x4c65e6['enduserId']+')','ownerid@odata.bind':_0xdb07('0x3b')+_0x4c65e6[_0xdb07('0x20')]+')','directioncode':_0x4c65e6[_0xdb07('0x3f')]===_0xdb07('0x40')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xdb07('0x3b')+_0x4c65e6['userId']+')','participationtypemask':_0x4c65e6[_0xdb07('0x3f')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xdb07('0x3a')+_0x4c65e6[_0xdb07('0x2a')]+')','participationtypemask':_0x4c65e6[_0xdb07('0x3f')]===_0xdb07('0x40')?0x1:0x2}]},getCustomFields(_0x2cfee8['Fields'],_0xadd511,_0x2cfee8[_0xdb07('0x35')])),'headers':{'Authorization':_0xdb07('0x19')+_0x3fa9f9,'OData-Version':_0xdb07('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x8577be);})['then'](function(_0x53b3b1){var _0x2890bf=_0x53b3b1[_0xdb07('0x27')][_0xdb07('0x28')];var _0x3dceb4=_0x2890bf[_0xdb07('0x32')](_0x2890bf[_0xdb07('0x29')]('(')+0x1,_0x2890bf[_0xdb07('0x29')](')'));_0x4c65e6[_0xdb07('0x41')]=_0x3dceb4;_0x5bb5c8(_0x4c65e6);})[_0xdb07('0x12')](function(_0x2f1ae8){_0x54dd(_0x2f1ae8[_0xdb07('0x16')]);});});}function emit(_0x33e6af,_0x2b259c,_0x37d837,_0x4c2817){var _0x3ec8da={'uri':util[_0xdb07('0x42')](_0xdb07('0x43'),_0x33e6af,_0x37d837,_0x4c2817)};io['to'](util[_0xdb07('0x42')](_0xdb07('0x44'),_0x2b259c))['emit'](_0xdb07('0x45'),_0x3ec8da);}exports['cs']=function(_0x48d885,_0x3d7e3a,_0x2db8b8,_0x184c7d,_0x2592e6,_0x237690,_0x45a751,_0x5ed494){var _0x5b76dd={};_0x237690[_0xdb07('0xe')]=intUtil[_0xdb07('0x46')](_0x237690['remoteUri']);_0x237690['serverUrl']=intUtil[_0xdb07('0x46')](_0x237690[_0xdb07('0x47')]);_0x5b76dd[_0xdb07('0x3f')]=_0x5ed494==='queue'||_0x5ed494===_0xdb07('0x48')?_0xdb07('0x40'):_0xdb07('0x25');var _0x158d26=util['format'](_0xdb07('0x49'),_0x237690['remoteUri']);var _0x1770a0=util['format'](_0xdb07('0x4a'),_0x237690[_0xdb07('0x4b')]);var _0x32cdcf=util[_0xdb07('0x42')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x237690[_0xdb07('0x47')],_0x3d7e3a[_0xdb07('0x4c')],md5(_0x3d7e3a[_0xdb07('0x4c')]));if(_0x2592e6&&_0x2592e6[_0xdb07('0x4d')]){logger[_0xdb07('0x22')](_0xdb07('0x4e'),_0xdb07('0x4f'));_0x3d7e3a['recordingURL']=_0x32cdcf;}else if(_0x45a751&&_0x45a751['recordingFormat']&&_0x45a751[_0xdb07('0x50')]!==_0xdb07('0x51')){logger[_0xdb07('0x22')](_0xdb07('0x52'),'Recording\x20is\x20enabled!');_0x3d7e3a[_0xdb07('0x53')]=_0x32cdcf;}else{_0x3d7e3a[_0xdb07('0x53')]='';}return getUser(_0x5b76dd,_0x237690,_0x184c7d,_0x1770a0,_0x158d26,_0x5ed494)[_0xdb07('0x17')](function(_0x24ab53){logger[_0xdb07('0x22')](_0xdb07('0x54'),_0x24ab53['userId']);logger[_0xdb07('0x22')](_0xdb07('0x55'),_0x24ab53[_0xdb07('0x1c')]);return getEndUser(_0x24ab53,_0x237690,_0x1770a0,_0x158d26,_0x3d7e3a,_0x5ed494);})['then'](function(_0x491880){logger['info'](_0xdb07('0x56'),_0x491880[_0xdb07('0x2a')]);logger[_0xdb07('0x22')]('The\x20Enduser\x20phone\x20is:',_0x3d7e3a[_0xdb07('0x26')]);return getTicket(_0x491880,_0x237690,_0x1770a0,_0x158d26,_0x3d7e3a,_0x2db8b8,_0x5ed494);})[_0xdb07('0x17')](function(_0x232cb4){logger[_0xdb07('0x22')](util[_0xdb07('0x42')](_0xdb07('0x57'),_0x2db8b8['ticketType'],_0x232cb4[_0xdb07('0x41')]));logger[_0xdb07('0x22')](util[_0xdb07('0x42')](_0xdb07('0x58'),_0x5ed494));if(_0x5ed494!==_0xdb07('0x48')){logger[_0xdb07('0x22')]('['+_0x5ed494[_0xdb07('0x14')]()+']',_0xdb07('0x59'));emit(_0x237690[_0xdb07('0xe')],_0x184c7d[_0xdb07('0x5a')],_0x2db8b8[_0xdb07('0x35')],_0x232cb4['ticketId']);}})['catch'](function(_0x1e46ec){logger[_0xdb07('0x13')]('['+_0x5ed494['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0xdb07('0x5b')](_0x1e46ec,{'showHidden':!![],'depth':null}));});};
\ No newline at end of file
index cebe6af..8ef40cc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd6e0=['apiKey','toString','base64','debug','[HTTP]','stringify','GET','forEach','type','string','nameField','customField','toLowerCase','content','idField','push','variable','variableName','Variable','stripTrailingSlash','serverUrl','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','[QUEUE]','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','abandoned','[ABANDONED]','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','application/json','emit','info','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','<br>','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s'];(function(_0x4a5c02,_0x5dc14a){var _0x39a30f=function(_0x3fd756){while(--_0x3fd756){_0x4a5c02['push'](_0x4a5c02['shift']());}};_0x39a30f(++_0x5dc14a);}(_0xd6e0,0x193));var _0x0d6e=function(_0x3cf5a3,_0x5a4492){_0x3cf5a3=_0x3cf5a3-0x0;var _0x39ba2d=_0xd6e0[_0x3cf5a3];return _0x39ba2d;};'use strict';var _=require(_0x0d6e('0x0'));var rp=require(_0x0d6e('0x1'));var md5=require(_0x0d6e('0x2'));var util=require(_0x0d6e('0x3'));var Redis=require(_0x0d6e('0x4'));var intUtil=require('./util');var config=require(_0x0d6e('0x5'));var logger=require(_0x0d6e('0x6'))(_0x0d6e('0x7'));config[_0x0d6e('0x8')]=_[_0x0d6e('0x9')](config[_0x0d6e('0x8')],{'host':_0x0d6e('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0x0d6e('0xb'),'Accept':_0x0d6e('0xb')};function emit(_0x474f59,_0x4b10c5,_0xac651d){io['to'](_0x474f59)[_0x0d6e('0xc')](_0x4b10c5,_0xac651d);}function getTicket(_0x1ddf8e,_0x302401,_0x3674d7,_0x429831,_0x3e6bf4){logger[_0x0d6e('0xd')]('Creating\x20new\x20ticket...');var _0x35db49=_[_0x0d6e('0xe')]({'responder_id':_0x302401['id'],'requester_id':_0x3674d7['id'],'name':util[_0x0d6e('0xf')](_0x0d6e('0x10'),_0x3e6bf4[_0x0d6e('0x11')]),'phone':_0x3e6bf4[_0x0d6e('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x0d6e('0x13')](_0x429831[_0x0d6e('0x14')],_0x3e6bf4,'\x20'),'description':intUtil[_0x0d6e('0x13')](_0x429831[_0x0d6e('0x15')],_0x3e6bf4,_0x0d6e('0x16')),'tags':getTags(_0x429831[_0x0d6e('0x17')],_0x0d6e('0x18'))},getCustomFields(_0x429831[_0x0d6e('0x19')],_0x3e6bf4));_0x35db49[_0x0d6e('0x1a')]=_[_0x0d6e('0x1b')](_[_0x0d6e('0x1c')](_0x35db49['custom_fields'],'id'),_0x0d6e('0x1d'));return request({'uri':util[_0x0d6e('0xf')](_0x0d6e('0x1e'),_0x1ddf8e[_0x0d6e('0x1f')]),'method':'POST','body':_0x35db49})[_0x0d6e('0x20')](function(_0x28f8bd){logger[_0x0d6e('0xd')](_0x0d6e('0x21'));return _0x28f8bd;});}function getUser(_0x74ef7c,_0x4300a7){if(intUtil[_0x0d6e('0x22')](_0x4300a7)===!![]){return request({'uri':util[_0x0d6e('0xf')]('%s/api/v2/agents',_0x74ef7c[_0x0d6e('0x1f')]),'qs':{'email':_0x4300a7}})['then'](function(_0x5c11e1){if(_0x5c11e1[_0x0d6e('0x23')]){logger[_0x0d6e('0xd')](_0x0d6e('0x24'));return _[_0x0d6e('0x25')](_0x5c11e1,function(_0x144c8f){return _0x144c8f[_0x0d6e('0x26')][_0x0d6e('0x27')]===_0x4300a7;});}else{logger['info'](_0x0d6e('0x28'));return request({'uri':util[_0x0d6e('0xf')](_0x0d6e('0x29'),_0x74ef7c['remoteUri'])})[_0x0d6e('0x20')](function(_0x1ee4b4){logger[_0x0d6e('0xd')](_0x0d6e('0x2a'));return _0x1ee4b4;});}});}else{return request({'uri':util[_0x0d6e('0xf')](_0x0d6e('0x29'),_0x74ef7c[_0x0d6e('0x1f')])})['then'](function(_0x36f06b){logger[_0x0d6e('0xd')](_0x0d6e('0x2a'));return _0x36f06b;});}}function getEndUser(_0x123295,_0x4c3350,_0x550c17){logger[_0x0d6e('0xd')](_0x0d6e('0x2b'),_0x550c17);return request({'uri':util[_0x0d6e('0xf')]('%s/api/v2/contacts',_0x123295[_0x0d6e('0x1f')]),'qs':{'phone':_0x550c17}})[_0x0d6e('0x20')](function(_0x14c8e6){if(_0x14c8e6['length']){logger['info']('Enduser\x20found!');return _['find'](_0x14c8e6,{'phone':_0x550c17});}else{logger[_0x0d6e('0xd')](_0x0d6e('0x2c'));return request({'uri':util[_0x0d6e('0xf')]('%s/api/v2/contacts',_0x123295['remoteUri']),'method':'POST','body':{'name':_0x4c3350,'phone':_0x550c17}})[_0x0d6e('0x20')](function(_0x28d83b){logger[_0x0d6e('0xd')](_0x0d6e('0x2d'));return _0x28d83b;});}});}function getAuth(_0x45aad1){return util[_0x0d6e('0xf')](_0x0d6e('0x2e'),new Buffer(_0x45aad1[_0x0d6e('0x2f')]+':X')[_0x0d6e('0x30')](_0x0d6e('0x31')));}function request(_0x3e4205){logger[_0x0d6e('0x32')](_0x0d6e('0x33'),JSON[_0x0d6e('0x34')](_0x3e4205));return rp(_[_0x0d6e('0x9')](_0x3e4205,{'method':_0x0d6e('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x3d1a0e,_0x27d032){var _0x1a3db9=[];if(_0x3d1a0e&&_0x3d1a0e['length']>0x0){_0x1a3db9=_['map'](_0x3d1a0e,_0x27d032);}return _0x1a3db9;}function getCustomFields(_0x2897a7,_0x3e9cd0){var _0x30f254=[];var _0x33722f={'custom_fields':[]};if(_0x2897a7['length']>0x0){_[_0x0d6e('0x36')](_0x2897a7,function(_0x295263){if(_0x295263[_0x0d6e('0x37')]===_0x0d6e('0x38')&&_0x295263[_0x0d6e('0x39')]&&!_0x295263[_0x0d6e('0x3a')]){_0x33722f[_0x295263[_0x0d6e('0x39')][_0x0d6e('0x3b')]()]=_0x295263[_0x0d6e('0x3c')][_0x0d6e('0x30')]();}else if(_0x295263[_0x0d6e('0x37')]===_0x0d6e('0x38')&&_0x295263[_0x0d6e('0x3d')]&&_0x295263['customField']){_0x33722f['custom_fields'][_0x0d6e('0x3e')]({'id':_0x295263[_0x0d6e('0x3d')],'value':_0x295263[_0x0d6e('0x3c')][_0x0d6e('0x30')]()});}else if(_0x295263[_0x0d6e('0x37')]===_0x0d6e('0x3f')&&_0x295263[_0x0d6e('0x40')]&&_0x295263['idField']&&_0x295263[_0x0d6e('0x3a')]){_0x3e9cd0[_0x295263[_0x0d6e('0x40')]]&&_0x33722f[_0x0d6e('0x1a')][_0x0d6e('0x3e')]({'id':_0x295263[_0x0d6e('0x3d')],'value':_0x3e9cd0[_0x295263[_0x0d6e('0x40')]][_0x0d6e('0x30')]()});}else if(_0x295263[_0x0d6e('0x37')]==='customVariable'&&_0x295263[_0x0d6e('0x41')]&&_0x295263[_0x0d6e('0x41')][_0x0d6e('0x18')]&&_0x295263[_0x0d6e('0x3d')]&&_0x295263['customField']){_0x3e9cd0[_0x295263[_0x0d6e('0x41')][_0x0d6e('0x18')][_0x0d6e('0x3b')]()]&&_0x33722f[_0x0d6e('0x1a')][_0x0d6e('0x3e')]({'id':_0x295263[_0x0d6e('0x3d')],'value':_0x3e9cd0[_0x295263['Variable'][_0x0d6e('0x18')][_0x0d6e('0x3b')]()]['toString']()});}});}return _0x33722f;}exports['queue']=function(_0x585c30,_0x3cefa9,_0x2da188,_0x356235,_0x165a99,_0xf25592){var _0x4d6e9b,_0x441b41;_0xf25592[_0x0d6e('0x1f')]=intUtil[_0x0d6e('0x42')](_0xf25592[_0x0d6e('0x1f')]);_0xf25592['serverUrl']=intUtil[_0x0d6e('0x42')](_0xf25592[_0x0d6e('0x43')]);if(_0x165a99&&_0x165a99[_0x0d6e('0x44')]){logger[_0x0d6e('0xd')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3cefa9[_0x0d6e('0x45')]=util['format'](_0x0d6e('0x46'),_0xf25592[_0x0d6e('0x43')],_0x3cefa9[_0x0d6e('0x47')],md5(_0x3cefa9[_0x0d6e('0x47')]));}else{_0x3cefa9['recordingURL']='';}headers[_0x0d6e('0x48')]=getAuth(_0xf25592);return getUser(_0xf25592,_0x356235[_0x0d6e('0x27')])[_0x0d6e('0x20')](function(_0x4abeeb){_0x4d6e9b=_0x4abeeb;logger['info'](_0x0d6e('0x49'),_0x4d6e9b['id']);return getEndUser(_0xf25592,_0x3cefa9[_0x0d6e('0x11')],_0x3cefa9[_0x0d6e('0x12')]);})['then'](function(_0x380cdd){_0x441b41=_0x380cdd;logger[_0x0d6e('0xd')](_0x0d6e('0x4a'),_0x441b41['id']);return getTicket(_0xf25592,_0x4d6e9b,_0x441b41,_0x2da188,_0x3cefa9);})[_0x0d6e('0x20')](function(_0x269eb3){if(_0x269eb3&&_0x269eb3['id']){logger[_0x0d6e('0xd')](_0x0d6e('0x21'));logger[_0x0d6e('0xd')]('The\x20Ticket\x20ID\x20is:',_0x269eb3['id']);logger[_0x0d6e('0xd')](_0x0d6e('0x4b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x0d6e('0xf')]('user:%s',_0x356235[_0x0d6e('0x18')]),_0x0d6e('0x4c'),{'uri':util[_0x0d6e('0xf')](_0x0d6e('0x4d'),_0xf25592[_0x0d6e('0x1f')],_0x269eb3['id'])});}})[_0x0d6e('0x4e')](function(_0x51f49a){logger[_0x0d6e('0x4f')](_0x0d6e('0x4b'),JSON['stringify'](_0x51f49a));});};exports[_0x0d6e('0x50')]=function(_0x27ea4a,_0x3914ba,_0x5ea404,_0xf4975d,_0x5cd4d7,_0x116265,_0x1517d1){var _0x3f4acd,_0x23a038;_0x116265[_0x0d6e('0x1f')]=intUtil[_0x0d6e('0x42')](_0x116265['remoteUri']);_0x116265[_0x0d6e('0x43')]=intUtil['stripTrailingSlash'](_0x116265[_0x0d6e('0x43')]);if(_0x1517d1&&_0x1517d1[_0x0d6e('0x51')]&&_0x1517d1[_0x0d6e('0x51')]!=='none'){logger[_0x0d6e('0xd')](_0x0d6e('0x52'),_0x0d6e('0x53'));_0x3914ba[_0x0d6e('0x45')]=util[_0x0d6e('0xf')](_0x0d6e('0x46'),_0x116265['serverUrl'],_0x3914ba[_0x0d6e('0x47')],md5(_0x3914ba[_0x0d6e('0x47')]));}headers[_0x0d6e('0x48')]=getAuth(_0x116265);return getUser(_0x116265,_0xf4975d[_0x0d6e('0x27')])[_0x0d6e('0x20')](function(_0x41f260){_0x3f4acd=_0x41f260;logger['info'](_0x0d6e('0x49'),_0x3f4acd['id']);return getEndUser(_0x116265,_0x3914ba['destcalleridname'],_0x3914ba[_0x0d6e('0x54')]);})[_0x0d6e('0x20')](function(_0x24fe28){_0x23a038=_0x24fe28;logger['info']('The\x20Enduser\x20ID\x20is:',_0x23a038['id']);return getTicket(_0x116265,_0x3f4acd,_0x23a038,_0x5ea404,_0x3914ba);})['then'](function(_0x5b5718){if(_0x5b5718&&_0x5b5718['id']){logger[_0x0d6e('0xd')](_0x0d6e('0x21'));logger[_0x0d6e('0xd')](_0x0d6e('0x55'),_0x5b5718['id']);logger[_0x0d6e('0xd')]('[OUTBOUND]',_0x0d6e('0x56'));emit(util[_0x0d6e('0xf')](_0x0d6e('0x57'),_0xf4975d[_0x0d6e('0x18')]),_0x0d6e('0x4c'),{'uri':util[_0x0d6e('0xf')]('%s/helpdesk/tickets/%d',_0x116265['remoteUri'],_0x5b5718['id'])});}})[_0x0d6e('0x4e')](function(_0x3a5833){logger['error'](_0x0d6e('0x52'),JSON[_0x0d6e('0x34')](_0x3a5833));});};exports[_0x0d6e('0x58')]=function(_0x35a79f,_0x338bd3,_0x483006,_0x280327,_0x58fa48,_0x71e7d5){var _0x8bf753,_0x50e539;_0x71e7d5[_0x0d6e('0x1f')]=intUtil[_0x0d6e('0x42')](_0x71e7d5['remoteUri']);_0x71e7d5[_0x0d6e('0x43')]=intUtil[_0x0d6e('0x42')](_0x71e7d5[_0x0d6e('0x43')]);if(_0x58fa48&&_0x58fa48[_0x0d6e('0x44')]){logger[_0x0d6e('0xd')](_0x0d6e('0x59'),'Recording\x20is\x20enabled!');_0x338bd3['recordingURL']=util['format'](_0x0d6e('0x46'),_0x71e7d5[_0x0d6e('0x43')],_0x338bd3[_0x0d6e('0x47')],md5(_0x338bd3[_0x0d6e('0x47')]));}else{_0x338bd3[_0x0d6e('0x45')]='';}headers['Authorization']=getAuth(_0x71e7d5);return getUser(_0x71e7d5,'')[_0x0d6e('0x20')](function(_0x205ce7){_0x8bf753=_0x205ce7;logger[_0x0d6e('0xd')](_0x0d6e('0x49'),_0x8bf753['id']);return getEndUser(_0x71e7d5,_0x338bd3[_0x0d6e('0x11')],_0x338bd3[_0x0d6e('0x12')]);})['then'](function(_0x1b3643){_0x50e539=_0x1b3643;logger['info'](_0x0d6e('0x4a'),_0x50e539['id']);return getTicket(_0x71e7d5,_0x8bf753,_0x50e539,_0x483006,_0x338bd3);})[_0x0d6e('0x20')](function(_0x34edcf){if(_0x34edcf){logger[_0x0d6e('0xd')](_0x0d6e('0x21'));logger[_0x0d6e('0xd')](_0x0d6e('0x55'),_0x34edcf['id']);}})[_0x0d6e('0x4e')](function(_0x3266c2){logger[_0x0d6e('0x4f')](_0x0d6e('0x59'),JSON[_0x0d6e('0x34')](_0x3266c2));});};
\ No newline at end of file
+var _0x732f=['Agent\x20found!','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','length','map','forEach','type','string','nameField','customField','idField','content','variable','variableName','push','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','[OUTBOUND]','destcalleridname','destcalleridnum','[ABANDONED]','calleridname','lodash','request-promise','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','defaults','redis','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','getString','Descriptions','<br>','Tags','name','custom_fields','keyBy','%s/api/v2/tickets','remoteUri','Ticket\x20created!','%s/api/v2/agents','then'];(function(_0x4b6cc8,_0x355e5b){var _0x5c4743=function(_0x68d0f6){while(--_0x68d0f6){_0x4b6cc8['push'](_0x4b6cc8['shift']());}};_0x5c4743(++_0x355e5b);}(_0x732f,0x18d));var _0xf732=function(_0x7488c6,_0x1b2889){_0x7488c6=_0x7488c6-0x0;var _0x50fafa=_0x732f[_0x7488c6];return _0x50fafa;};'use strict';var _=require(_0xf732('0x0'));var rp=require(_0xf732('0x1'));var md5=require('md5');var util=require(_0xf732('0x2'));var Redis=require('ioredis');var intUtil=require(_0xf732('0x3'));var config=require(_0xf732('0x4'));var logger=require(_0xf732('0x5'))(_0xf732('0x6'));config['redis']=_[_0xf732('0x7')](config[_0xf732('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xf732('0x9'))(new Redis(config[_0xf732('0x8')]));var headers={'Content-Type':_0xf732('0xa'),'Accept':_0xf732('0xa')};function emit(_0x5e6b08,_0xca2765,_0x2d3849){io['to'](_0x5e6b08)['emit'](_0xca2765,_0x2d3849);}function getTicket(_0x2236e6,_0x1822b9,_0xa741d2,_0x31b2d3,_0x4d1c33){logger[_0xf732('0xb')](_0xf732('0xc'));var _0x2e6a3a=_[_0xf732('0xd')]({'responder_id':_0x1822b9['id'],'requester_id':_0xa741d2['id'],'name':util[_0xf732('0xe')](_0xf732('0xf'),_0x4d1c33['calleridname']),'phone':_0x4d1c33['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x31b2d3['Subjects'],_0x4d1c33,'\x20'),'description':intUtil[_0xf732('0x10')](_0x31b2d3[_0xf732('0x11')],_0x4d1c33,_0xf732('0x12')),'tags':getTags(_0x31b2d3[_0xf732('0x13')],_0xf732('0x14'))},getCustomFields(_0x31b2d3['Fields'],_0x4d1c33));_0x2e6a3a[_0xf732('0x15')]=_['mapValues'](_[_0xf732('0x16')](_0x2e6a3a[_0xf732('0x15')],'id'),'value');return request({'uri':util[_0xf732('0xe')](_0xf732('0x17'),_0x2236e6[_0xf732('0x18')]),'method':'POST','body':_0x2e6a3a})['then'](function(_0x1ebe45){logger[_0xf732('0xb')](_0xf732('0x19'));return _0x1ebe45;});}function getUser(_0x1e5de7,_0x1bbd61){if(intUtil['validateEmail'](_0x1bbd61)){return request({'uri':util[_0xf732('0xe')](_0xf732('0x1a'),_0x1e5de7[_0xf732('0x18')]),'qs':{'email':_0x1bbd61}})[_0xf732('0x1b')](function(_0x5a6159){if(_0x5a6159['length']){logger[_0xf732('0xb')](_0xf732('0x1c'));return _[_0xf732('0x1d')](_0x5a6159,function(_0x10fb01){return _0x10fb01[_0xf732('0x1e')][_0xf732('0x1f')]===_0x1bbd61;});}else{logger[_0xf732('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf732('0xe')](_0xf732('0x20'),_0x1e5de7[_0xf732('0x18')])})[_0xf732('0x1b')](function(_0x20711d){logger['info'](_0xf732('0x21'));return _0x20711d;});}});}else{logger[_0xf732('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf732('0xe')]('%s/api/v2/agents/me',_0x1e5de7[_0xf732('0x18')])})[_0xf732('0x1b')](function(_0x524247){logger['info'](_0xf732('0x21'));return _0x524247;});}}function getEndUser(_0x22bf76,_0x1f52a4,_0xa8568a){logger[_0xf732('0xb')](_0xf732('0x22'),_0xa8568a);return request({'uri':util[_0xf732('0xe')](_0xf732('0x23'),_0x22bf76[_0xf732('0x18')]),'qs':{'phone':_0xa8568a}})[_0xf732('0x1b')](function(_0x16afeb){if(_0x16afeb['length']){logger[_0xf732('0xb')](_0xf732('0x24'));return _['find'](_0x16afeb,{'phone':_0xa8568a});}else{logger[_0xf732('0xb')](_0xf732('0x25'));return request({'uri':util[_0xf732('0xe')](_0xf732('0x23'),_0x22bf76[_0xf732('0x18')]),'method':'POST','body':{'name':_0x1f52a4,'phone':_0xa8568a}})[_0xf732('0x1b')](function(_0xd7a99){logger[_0xf732('0xb')]('Enduser\x20created.');return _0xd7a99;});}});}function getAuth(_0x18e295){return util['format'](_0xf732('0x26'),new Buffer(_0x18e295[_0xf732('0x27')]+':X')[_0xf732('0x28')](_0xf732('0x29')));}function request(_0x408683){logger[_0xf732('0x2a')](_0xf732('0x2b'),JSON[_0xf732('0x2c')](_0x408683));return rp(_[_0xf732('0x7')](_0x408683,{'method':_0xf732('0x2d'),'headers':headers,'json':!![]}));}function getTags(_0x411a48,_0x1f0ec7){var _0x29354a=[];if(_0x411a48&&_0x411a48[_0xf732('0x2e')]>0x0){_0x29354a=_[_0xf732('0x2f')](_0x411a48,_0x1f0ec7);}return _0x29354a;}function getCustomFields(_0x27ce3f,_0x5221f4){var _0x3dd7a2=[];var _0x397e3d={'custom_fields':[]};if(_0x27ce3f[_0xf732('0x2e')]>0x0){_[_0xf732('0x30')](_0x27ce3f,function(_0x1d007a){if(_0x1d007a[_0xf732('0x31')]===_0xf732('0x32')&&_0x1d007a[_0xf732('0x33')]&&!_0x1d007a[_0xf732('0x34')]){_0x397e3d[_0x1d007a[_0xf732('0x33')]['toLowerCase']()]=_0x1d007a['content']['toString']();}else if(_0x1d007a[_0xf732('0x31')]==='string'&&_0x1d007a[_0xf732('0x35')]&&_0x1d007a[_0xf732('0x34')]){_0x397e3d[_0xf732('0x15')]['push']({'id':_0x1d007a[_0xf732('0x35')],'value':_0x1d007a[_0xf732('0x36')][_0xf732('0x28')]()});}else if(_0x1d007a[_0xf732('0x31')]===_0xf732('0x37')&&_0x1d007a[_0xf732('0x38')]&&_0x1d007a['idField']&&_0x1d007a[_0xf732('0x34')]){_0x5221f4[_0x1d007a['variableName']]&&_0x397e3d[_0xf732('0x15')][_0xf732('0x39')]({'id':_0x1d007a[_0xf732('0x35')],'value':_0x5221f4[_0x1d007a[_0xf732('0x38')]][_0xf732('0x28')]()});}else if(_0x1d007a[_0xf732('0x31')]===_0xf732('0x3a')&&_0x1d007a[_0xf732('0x3b')]&&_0x1d007a[_0xf732('0x3b')][_0xf732('0x14')]&&_0x1d007a['idField']&&_0x1d007a['customField']){_0x5221f4[_0x1d007a[_0xf732('0x3b')][_0xf732('0x14')][_0xf732('0x3c')]()]&&_0x397e3d[_0xf732('0x15')][_0xf732('0x39')]({'id':_0x1d007a[_0xf732('0x35')],'value':_0x5221f4[_0x1d007a['Variable'][_0xf732('0x14')][_0xf732('0x3c')]()][_0xf732('0x28')]()});}});}return _0x397e3d;}exports[_0xf732('0x3d')]=function(_0x134081,_0x230ba3,_0x3292d8,_0x34d9dc,_0x364f02,_0x486e35){var _0x5bfb65,_0x5d7c05;_0x486e35[_0xf732('0x18')]=intUtil[_0xf732('0x3e')](_0x486e35[_0xf732('0x18')]);_0x486e35[_0xf732('0x3f')]=intUtil[_0xf732('0x3e')](_0x486e35['serverUrl']);if(_0x364f02&&_0x364f02[_0xf732('0x40')]){logger[_0xf732('0xb')](_0xf732('0x41'),_0xf732('0x42'));_0x230ba3[_0xf732('0x43')]=util[_0xf732('0xe')](_0xf732('0x44'),_0x486e35[_0xf732('0x3f')],_0x230ba3[_0xf732('0x45')],md5(_0x230ba3[_0xf732('0x45')]));}else{_0x230ba3[_0xf732('0x43')]='';}headers[_0xf732('0x46')]=getAuth(_0x486e35);return getUser(_0x486e35,_0x34d9dc['email'])[_0xf732('0x1b')](function(_0x23f148){_0x5bfb65=_0x23f148;logger[_0xf732('0xb')](_0xf732('0x47'),_0x5bfb65['id']);return getEndUser(_0x486e35,_0x230ba3['calleridname'],_0x230ba3[_0xf732('0x48')]);})[_0xf732('0x1b')](function(_0x3b8d99){_0x5d7c05=_0x3b8d99;logger['info'](_0xf732('0x49'),_0x5d7c05['id']);return getTicket(_0x486e35,_0x5bfb65,_0x5d7c05,_0x3292d8,_0x230ba3);})[_0xf732('0x1b')](function(_0x239f83){if(_0x239f83&&_0x239f83['id']){logger[_0xf732('0xb')](_0xf732('0x19'));logger[_0xf732('0xb')](_0xf732('0x4a'),_0x239f83['id']);logger[_0xf732('0xb')](_0xf732('0x41'),_0xf732('0x4b'));emit(util[_0xf732('0xe')](_0xf732('0x4c'),_0x34d9dc[_0xf732('0x14')]),'trigger:browser:url',{'uri':util[_0xf732('0xe')]('%s/helpdesk/tickets/%d',_0x486e35[_0xf732('0x18')],_0x239f83['id'])});}})[_0xf732('0x4d')](function(_0x758290){logger[_0xf732('0x4e')](_0xf732('0x41'),JSON[_0xf732('0x2c')](_0x758290));});};exports[_0xf732('0x4f')]=function(_0x3d6c1e,_0x37cbac,_0x3cdceb,_0x539d2c,_0x3f5363,_0x325e80,_0xa6e5e6){var _0x1f7e63,_0x52f8dd;_0x325e80[_0xf732('0x18')]=intUtil[_0xf732('0x3e')](_0x325e80[_0xf732('0x18')]);_0x325e80[_0xf732('0x3f')]=intUtil['stripTrailingSlash'](_0x325e80['serverUrl']);if(_0xa6e5e6&&_0xa6e5e6['recordingFormat']&&_0xa6e5e6['recordingFormat']!=='none'){logger[_0xf732('0xb')](_0xf732('0x50'),_0xf732('0x42'));_0x37cbac[_0xf732('0x43')]=util['format'](_0xf732('0x44'),_0x325e80['serverUrl'],_0x37cbac[_0xf732('0x45')],md5(_0x37cbac[_0xf732('0x45')]));}headers[_0xf732('0x46')]=getAuth(_0x325e80);return getUser(_0x325e80,_0x539d2c[_0xf732('0x1f')])[_0xf732('0x1b')](function(_0x2e9ded){_0x1f7e63=_0x2e9ded;logger[_0xf732('0xb')](_0xf732('0x47'),_0x1f7e63['id']);return getEndUser(_0x325e80,_0x37cbac[_0xf732('0x51')],_0x37cbac[_0xf732('0x52')]);})[_0xf732('0x1b')](function(_0xdc92f4){_0x52f8dd=_0xdc92f4;logger['info']('The\x20Enduser\x20ID\x20is:',_0x52f8dd['id']);return getTicket(_0x325e80,_0x1f7e63,_0x52f8dd,_0x3cdceb,_0x37cbac);})[_0xf732('0x1b')](function(_0x3ae31a){if(_0x3ae31a&&_0x3ae31a['id']){logger[_0xf732('0xb')](_0xf732('0x19'));logger[_0xf732('0xb')](_0xf732('0x4a'),_0x3ae31a['id']);logger[_0xf732('0xb')](_0xf732('0x50'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf732('0xe')](_0xf732('0x4c'),_0x539d2c[_0xf732('0x14')]),'trigger:browser:url',{'uri':util['format']('%s/helpdesk/tickets/%d',_0x325e80[_0xf732('0x18')],_0x3ae31a['id'])});}})[_0xf732('0x4d')](function(_0x111751){logger['error']('[OUTBOUND]',JSON[_0xf732('0x2c')](_0x111751));});};exports['abandoned']=function(_0x140d40,_0x11e338,_0x16ba40,_0x551078,_0x39ad49,_0x44be2a){var _0x4b06f3,_0x488074;_0x44be2a[_0xf732('0x18')]=intUtil[_0xf732('0x3e')](_0x44be2a[_0xf732('0x18')]);_0x44be2a[_0xf732('0x3f')]=intUtil['stripTrailingSlash'](_0x44be2a[_0xf732('0x3f')]);if(_0x39ad49&&_0x39ad49[_0xf732('0x40')]){logger[_0xf732('0xb')](_0xf732('0x53'),_0xf732('0x42'));_0x11e338[_0xf732('0x43')]=util[_0xf732('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x44be2a[_0xf732('0x3f')],_0x11e338['uniqueid'],md5(_0x11e338['uniqueid']));}else{_0x11e338[_0xf732('0x43')]='';}headers['Authorization']=getAuth(_0x44be2a);return getUser(_0x44be2a,'')[_0xf732('0x1b')](function(_0x194d04){_0x4b06f3=_0x194d04;logger['info'](_0xf732('0x47'),_0x4b06f3['id']);return getEndUser(_0x44be2a,_0x11e338[_0xf732('0x54')],_0x11e338[_0xf732('0x48')]);})['then'](function(_0x3273d3){_0x488074=_0x3273d3;logger[_0xf732('0xb')](_0xf732('0x49'),_0x488074['id']);return getTicket(_0x44be2a,_0x4b06f3,_0x488074,_0x16ba40,_0x11e338);})[_0xf732('0x1b')](function(_0x33a7d0){if(_0x33a7d0){logger['info'](_0xf732('0x19'));logger[_0xf732('0xb')]('The\x20Ticket\x20ID\x20is:',_0x33a7d0['id']);}})['catch'](function(_0x3223fe){logger[_0xf732('0x4e')](_0xf732('0x53'),JSON[_0xf732('0x2c')](_0x3223fe));});};
\ No newline at end of file
index 7088f56..92ef883 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x390a=['includes','toLowerCase','data1','data2','Configurations','routeId','log','EVENT\x20UNKNOWN','desk','vtiger','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','lodash','util','./zendesk','./salesforce','./freshdesk','./zoho','./desk','./vtiger','./dynamics365','zendesk','salesforce','freshdesk','zoho','servicenow','dynamics365','exec'];(function(_0x537561,_0x3e7d5f){var _0x1a48bc=function(_0x52cffd){while(--_0x52cffd){_0x537561['push'](_0x537561['shift']());}};_0x1a48bc(++_0x3e7d5f);}(_0x390a,0xc9));var _0xa390=function(_0x2fbe32,_0x83addf){_0x2fbe32=_0x2fbe32-0x0;var _0x20fa21=_0x390a[_0x2fbe32];return _0x20fa21;};'use strict';var _=require(_0xa390('0x0'));var util=require(_0xa390('0x1'));var zendesk=require(_0xa390('0x2'));var salesforce=require(_0xa390('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xa390('0x4'));var zoho=require(_0xa390('0x5'));var desk=require(_0xa390('0x6'));var vtiger=require(_0xa390('0x7'));var servicenow=require('./servicenow');var dynamics365=require(_0xa390('0x8'));var integrations=[_0xa390('0x9'),_0xa390('0xa'),'sugarcrm',_0xa390('0xb'),_0xa390('0xc'),'desk','vtiger',_0xa390('0xd'),_0xa390('0xe')];exports[_0xa390('0xf')]=function(_0x226003,_0xc80e9d,_0x5106eb,_0x51ead2,_0x735319,_0x34f0fe){if(_0x5106eb){if(_[_0xa390('0x10')](integrations,_0x226003['data1'][_0xa390('0x11')]())){try{var _0x172371=null;var _0x49c3a0='';var _0x8580d5=_0x5106eb[_0x226003[_0xa390('0x12')]['toLowerCase']()];if(_0x8580d5){var _0x5cd158=_0x8580d5[_0x226003[_0xa390('0x13')]];if(_0x5cd158){var _0x19ba77=_['find'](_0x5cd158[_0xa390('0x14')],{'id':parseInt(_0x226003['data3'],0xa)});if(_0x19ba77){if(_0x51ead2){if(_0x735319&&_0xc80e9d['queue']){_0x49c3a0='queue';}else if(_0xc80e9d[_0xa390('0x15')]){_0x49c3a0='outbound';}else{console[_0xa390('0x16')](_0xa390('0x17'),_0xc80e9d);}}else{_0x49c3a0='abandoned';}switch(_0x226003[_0xa390('0x12')][_0xa390('0x11')]()){case'zendesk':zendesk[_0x49c3a0](_0x226003,_0xc80e9d,_0x19ba77,_0x51ead2,_0x735319,_0x5cd158,_0x34f0fe);break;case _0xa390('0xa'):salesforce[_0x49c3a0](_0x226003,_0xc80e9d,_0x19ba77,_0x51ead2,_0x735319,_0x5cd158,_0x34f0fe);break;case'sugarcrm':sugarcrm[_0x49c3a0](_0x226003,_0xc80e9d,_0x19ba77,_0x51ead2,_0x735319,_0x5cd158,_0x34f0fe);break;case _0xa390('0xb'):freshdesk[_0x49c3a0](_0x226003,_0xc80e9d,_0x19ba77,_0x51ead2,_0x735319,_0x5cd158,_0x34f0fe);break;case _0xa390('0xc'):zoho[_0x49c3a0](_0x226003,_0xc80e9d,_0x19ba77,_0x51ead2,_0x735319,_0x5cd158,_0x34f0fe);break;case _0xa390('0x18'):desk[_0x49c3a0](_0x226003,_0xc80e9d,_0x19ba77,_0x51ead2,_0x735319,_0x5cd158,_0x34f0fe);break;case _0xa390('0x19'):vtiger[_0x49c3a0](_0x226003,_0xc80e9d,_0x19ba77,_0x51ead2,_0x735319,_0x5cd158,_0x34f0fe);break;case'servicenow':servicenow['cs'](_0x226003,_0xc80e9d,_0x19ba77,_0x51ead2,_0x735319,_0x5cd158,_0x34f0fe,_0x49c3a0);case _0xa390('0xe'):dynamics365['cs'](_0x226003,_0xc80e9d,_0x19ba77,_0x51ead2,_0x735319,_0x5cd158,_0x34f0fe,_0x49c3a0);break;default:console['log']('unknown\x20integration');}}else{_0x172371=require(_0xa390('0x1a'))(_0x226003[_0xa390('0x12')]['toLowerCase']());_0x172371[_0xa390('0x1b')](_0xa390('0x1c'),util['format'](_0xa390('0x1d'),_0x226003[_0xa390('0x12')]['toLowerCase'](),_0x226003['data3']));}}else{_0x172371=require(_0xa390('0x1a'))(_0x226003[_0xa390('0x12')][_0xa390('0x11')]());_0x172371['error']('[EXEC]',util[_0xa390('0x1e')]('%s\x20account\x20#%s\x20not\x20found',_0x226003[_0xa390('0x12')][_0xa390('0x11')](),_0x226003[_0xa390('0x13')]));}}else{}}catch(_0x5ea2de){console[_0xa390('0x1b')](_0x5ea2de);}}}};
\ No newline at end of file
+var _0xbca8=['lodash','util','./zendesk','./salesforce','./sugarcrm','./zoho','./desk','./vtiger','zendesk','salesforce','sugarcrm','freshdesk','desk','vtiger','servicenow','dynamics365','exec','toLowerCase','data2','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','abandoned','unknown\x20integration','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data1','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found'];(function(_0x3da457,_0x31b85c){var _0x20c736=function(_0x11c17d){while(--_0x11c17d){_0x3da457['push'](_0x3da457['shift']());}};_0x20c736(++_0x31b85c);}(_0xbca8,0xcc));var _0x8bca=function(_0x4953d7,_0x2ad1e8){_0x4953d7=_0x4953d7-0x0;var _0x9907d0=_0xbca8[_0x4953d7];return _0x9907d0;};'use strict';var _=require(_0x8bca('0x0'));var util=require(_0x8bca('0x1'));var zendesk=require(_0x8bca('0x2'));var salesforce=require(_0x8bca('0x3'));var sugarcrm=require(_0x8bca('0x4'));var freshdesk=require('./freshdesk');var zoho=require(_0x8bca('0x5'));var desk=require(_0x8bca('0x6'));var vtiger=require(_0x8bca('0x7'));var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var integrations=[_0x8bca('0x8'),_0x8bca('0x9'),_0x8bca('0xa'),_0x8bca('0xb'),'zoho',_0x8bca('0xc'),_0x8bca('0xd'),_0x8bca('0xe'),_0x8bca('0xf')];exports[_0x8bca('0x10')]=function(_0xe266ca,_0x229cc4,_0x4ee4a0,_0x4ff0b1,_0x18c1ca,_0x38c607){if(_0x4ee4a0){if(_['includes'](integrations,_0xe266ca['data1'][_0x8bca('0x11')]())){try{var _0x59321f=null;var _0x10da2e='';var _0x376d41=_0x4ee4a0[_0xe266ca['data1'][_0x8bca('0x11')]()];if(_0x376d41){var _0x1fe1b5=_0x376d41[_0xe266ca[_0x8bca('0x12')]];if(_0x1fe1b5){var _0x1e92bb=_['find'](_0x1fe1b5['Configurations'],{'id':parseInt(_0xe266ca[_0x8bca('0x13')],0xa)});if(_0x1e92bb){if(_0x4ff0b1){if(_0x18c1ca&&_0x229cc4['queue']){_0x10da2e=_0x8bca('0x14');}else if(_0x229cc4[_0x8bca('0x15')]){_0x10da2e=_0x8bca('0x16');}else{console[_0x8bca('0x17')](_0x8bca('0x18'),_0x229cc4);}}else{_0x10da2e=_0x8bca('0x19');}switch(_0xe266ca['data1']['toLowerCase']()){case _0x8bca('0x8'):zendesk[_0x10da2e](_0xe266ca,_0x229cc4,_0x1e92bb,_0x4ff0b1,_0x18c1ca,_0x1fe1b5,_0x38c607);break;case'salesforce':salesforce[_0x10da2e](_0xe266ca,_0x229cc4,_0x1e92bb,_0x4ff0b1,_0x18c1ca,_0x1fe1b5,_0x38c607);break;case _0x8bca('0xa'):sugarcrm[_0x10da2e](_0xe266ca,_0x229cc4,_0x1e92bb,_0x4ff0b1,_0x18c1ca,_0x1fe1b5,_0x38c607);break;case _0x8bca('0xb'):freshdesk[_0x10da2e](_0xe266ca,_0x229cc4,_0x1e92bb,_0x4ff0b1,_0x18c1ca,_0x1fe1b5,_0x38c607);break;case'zoho':zoho[_0x10da2e](_0xe266ca,_0x229cc4,_0x1e92bb,_0x4ff0b1,_0x18c1ca,_0x1fe1b5,_0x38c607);break;case'desk':desk[_0x10da2e](_0xe266ca,_0x229cc4,_0x1e92bb,_0x4ff0b1,_0x18c1ca,_0x1fe1b5,_0x38c607);break;case'vtiger':vtiger[_0x10da2e](_0xe266ca,_0x229cc4,_0x1e92bb,_0x4ff0b1,_0x18c1ca,_0x1fe1b5,_0x38c607);break;case _0x8bca('0xe'):servicenow['cs'](_0xe266ca,_0x229cc4,_0x1e92bb,_0x4ff0b1,_0x18c1ca,_0x1fe1b5,_0x38c607,_0x10da2e);case _0x8bca('0xf'):dynamics365['cs'](_0xe266ca,_0x229cc4,_0x1e92bb,_0x4ff0b1,_0x18c1ca,_0x1fe1b5,_0x38c607,_0x10da2e);break;default:console['log'](_0x8bca('0x1a'));}}else{_0x59321f=require('../../../../config/logger')(_0xe266ca['data1']['toLowerCase']());_0x59321f[_0x8bca('0x1b')](_0x8bca('0x1c'),util[_0x8bca('0x1d')](_0x8bca('0x1e'),_0xe266ca[_0x8bca('0x1f')][_0x8bca('0x11')](),_0xe266ca['data3']));}}else{_0x59321f=require(_0x8bca('0x20'))(_0xe266ca[_0x8bca('0x1f')][_0x8bca('0x11')]());_0x59321f['error'](_0x8bca('0x1c'),util['format'](_0x8bca('0x21'),_0xe266ca['data1'][_0x8bca('0x11')](),_0xe266ca[_0x8bca('0x12')]));}}else{}}catch(_0x4bdb75){console[_0x8bca('0x1b')](_0x4bdb75);}}}};
\ No newline at end of file
index 8d9563d..61bb55e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc157=['moduleSearch','contact_lead','Contact','find','contact','lead','Lead','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','<unknown>','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','create','forEach','type','string','idField','content','variableName','customVariable','Variable','name','toLowerCase','concat','Connection','remoteUri','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','[QUEUE]','stringify','outbound','recordingFormat','[OUTBOUND]','destcalleridnum','Fields','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','%s/%s/e','catch','abandoned','calleridnum','[ABANDONED]\x20Ticket\x20%s\x20created.','[ABANDONED]\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','merge','utc','Subjects','getString','Descriptions','WhoId','sobject','Task','validateEmail','User','execute','then','length','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.'];(function(_0x113fe7,_0x3516e2){var _0x391c69=function(_0x44faa6){while(--_0x44faa6){_0x113fe7['push'](_0x113fe7['shift']());}};_0x391c69(++_0x3516e2);}(_0xc157,0x1e3));var _0x7c15=function(_0xde1185,_0x1205eb){_0xde1185=_0xde1185-0x0;var _0x218904=_0xc157[_0xde1185];return _0x218904;};'use strict';var _=require('lodash');var rp=require(_0x7c15('0x0'));var moment=require(_0x7c15('0x1'));var BPromise=require(_0x7c15('0x2'));var md5=require(_0x7c15('0x3'));var jsforce=require(_0x7c15('0x4'));var util=require(_0x7c15('0x5'));var Redis=require(_0x7c15('0x6'));var intUtil=require(_0x7c15('0x7'));var config=require('../../../../config/environment');var logger=require(_0x7c15('0x8'))(_0x7c15('0x9'));config[_0x7c15('0xa')]=_['defaults'](config['redis'],{'host':_0x7c15('0xb'),'port':0x18eb});var io=require(_0x7c15('0xc'))(new Redis(config[_0x7c15('0xa')]));function emit(_0x2045a6,_0x58649d,_0x4c28ee){io['to'](_0x2045a6)[_0x7c15('0xd')](_0x58649d,_0x4c28ee);}function getTicket(_0x3f7ec6,_0x32f429,_0x13d123,_0x2a2d97,_0x313bad,_0x7da48f,_0x1b8265){var _0x5e480c=_[_0x7c15('0xe')]({'OwnerId':_0x32f429['id'],'ActivityDate':moment[_0x7c15('0xf')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x2a2d97[_0x7c15('0x10')],_0x313bad,'\x20'),'Description':intUtil[_0x7c15('0x11')](_0x2a2d97[_0x7c15('0x12')],_0x313bad,'\x0a')},getCustomFields(_0x7da48f,_0x313bad));if(_0x13d123){_0x5e480c[_0x7c15('0x13')]=_0x13d123['id'];}return _0x1b8265[_0x7c15('0x14')](_0x7c15('0x15'))['create'](_0x5e480c);}function getUser(_0x9480c7,_0x5db4d7,_0x39899d){if(intUtil[_0x7c15('0x16')](_0x5db4d7)===!![]){var _0x9df006={'Email':_0x5db4d7};var _0x3c4862={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x39899d[_0x7c15('0x14')](_0x7c15('0x17'))['find'](_0x9df006,_0x3c4862)[_0x7c15('0x18')]()[_0x7c15('0x19')](function(_0x2fd126){if(_0x2fd126[_0x7c15('0x1a')]){var _0x35d284=_['find'](_0x2fd126,function(_0x20cda7){return _0x20cda7[_0x7c15('0x1b')]===_0x5db4d7;});if(_0x35d284){logger[_0x7c15('0x1c')](_0x7c15('0x1d'),_0x5db4d7);return BPromise[_0x7c15('0x1e')]({'id':_0x35d284['Id'],'name':_0x35d284[_0x7c15('0x1f')]});}}else{logger[_0x7c15('0x1c')](_0x7c15('0x20'),_0x5db4d7);return _0x39899d[_0x7c15('0x21')]()['then'](function(_0x487167){return BPromise['resolve']({'id':_0x487167[_0x7c15('0x22')],'name':_0x487167['display_name']});});}});}else{logger[_0x7c15('0x1c')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x5db4d7);return _0x39899d[_0x7c15('0x21')]()[_0x7c15('0x19')](function(_0x4f346b){return BPromise[_0x7c15('0x1e')]({'id':_0x4f346b[_0x7c15('0x22')],'name':_0x4f346b[_0x7c15('0x23')]});});}}function getEndUser(_0x91b2af,_0x20959c,_0x32bd4b,_0x2987a1,_0x3a98f6){var _0x2385c7={'Phone':_0x2987a1};var _0x40401c={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x7c15('0x19')](function(){logger[_0x7c15('0x1c')](_0x7c15('0x24'),_0x2987a1,_0x20959c[_0x7c15('0x25')]);switch(_0x20959c['moduleSearch']){case _0x7c15('0x26'):return _0x3a98f6[_0x7c15('0x14')](_0x7c15('0x27'))[_0x7c15('0x28')](_0x2385c7,_0x40401c)[_0x7c15('0x18')]()[_0x7c15('0x19')](function(_0x4dcb3d){if(_0x4dcb3d&&_0x4dcb3d['length']){return _0x4dcb3d;}else{return _0x3a98f6[_0x7c15('0x14')]('Lead')[_0x7c15('0x28')](_0x2385c7,_0x40401c);}});case _0x7c15('0x29'):return _0x3a98f6['sobject']('Contact')[_0x7c15('0x28')](_0x2385c7,_0x40401c)[_0x7c15('0x18')]();case _0x7c15('0x2a'):return _0x3a98f6['sobject'](_0x7c15('0x2b'))['find'](_0x2385c7,_0x40401c);default:return null;}})['then'](function(_0x1b4b20){if(_0x1b4b20&&_0x1b4b20[_0x7c15('0x1a')]){var _0x40f099=_['find'](_0x1b4b20,function(_0x18390d){return _0x18390d[_0x7c15('0x2c')]===_0x2987a1;});if(_0x40f099){return BPromise[_0x7c15('0x1e')]({'id':_0x40f099['Id'],'name':_0x40f099['Name'],'phone':_0x40f099[_0x7c15('0x2c')]});}}})['then'](function(_0x39ea19){if(_0x39ea19){logger[_0x7c15('0x1c')](_0x7c15('0x2d'),_0x2987a1);return BPromise[_0x7c15('0x1e')](_0x39ea19);}else{logger['info'](_0x7c15('0x2e'),_0x2987a1);var _0x26597d={'LastName':_0x32bd4b!==_0x7c15('0x2f')?_0x32bd4b:util[_0x7c15('0x30')](_0x7c15('0x31'),_0x2987a1),'Phone':_0x2987a1};if(_0x20959c[_0x7c15('0x32')]){switch(_0x20959c['moduleCreate']){case'contact':logger['info'](_0x7c15('0x33'),_0x2987a1,_0x20959c['moduleCreate']);break;case _0x7c15('0x2a'):logger[_0x7c15('0x1c')](_0x7c15('0x33'),_0x2987a1,_0x20959c[_0x7c15('0x32')]);_0x26597d[_0x7c15('0x34')]=_0x7c15('0x35');break;default:return null;}}return _0x3a98f6['sobject'](_[_0x7c15('0x36')](_0x20959c[_0x7c15('0x32')]))[_0x7c15('0x37')](_0x26597d);}});}function getCustomFields(_0x2c40d5,_0x3f3d61){var _0x5100cf={};if(_0x2c40d5[_0x7c15('0x1a')]>0x0){_[_0x7c15('0x38')](_0x2c40d5,function(_0x57caec){if(_0x57caec[_0x7c15('0x39')]===_0x7c15('0x3a')&&_0x57caec['idField']){_0x5100cf[_0x57caec[_0x7c15('0x3b')]]=_0x57caec[_0x7c15('0x3c')]['toString']();}else if(_0x57caec[_0x7c15('0x39')]==='variable'&&_0x57caec[_0x7c15('0x3d')]&&_0x57caec['idField']){_0x3f3d61[_0x57caec[_0x7c15('0x3d')]]&&(_0x5100cf[_0x57caec['idField']]=_0x3f3d61[_0x57caec[_0x7c15('0x3d')]]['toString']());}else if(_0x57caec[_0x7c15('0x39')]===_0x7c15('0x3e')&&_0x57caec['Variable']&&_0x57caec[_0x7c15('0x3f')][_0x7c15('0x40')]&&_0x57caec[_0x7c15('0x3b')]){_0x3f3d61[_0x57caec[_0x7c15('0x3f')]['name'][_0x7c15('0x41')]()]&&(_0x5100cf[_0x57caec[_0x7c15('0x3b')]]=_0x3f3d61[_0x57caec[_0x7c15('0x3f')][_0x7c15('0x40')][_0x7c15('0x41')]()]['toString']());}});}return _0x5100cf;}function getConnection(_0x8ddb2e){var _0x382131=_0x8ddb2e['password'][_0x7c15('0x42')](_0x8ddb2e['securityToken']);var _0x2bd731=new jsforce[(_0x7c15('0x43'))]({'oauth2':{'loginUrl':_0x8ddb2e[_0x7c15('0x44')]||'https://login.salesforce.com','clientId':_0x8ddb2e['clientId'],'clientSecret':_0x8ddb2e['clientSecret']}});return _0x2bd731['login'](_0x8ddb2e[_0x7c15('0x45')],_0x382131)[_0x7c15('0x19')](function(){logger[_0x7c15('0x1c')](_0x7c15('0x46'));return _0x2bd731;});}exports[_0x7c15('0x47')]=function(_0x13ba80,_0x8ae3b1,_0x5366d8,_0x3ad0b5,_0x4e8e45,_0x45feeb){var _0x24d9ee,_0x3f4d96,_0x438532,_0x1c1245;_0x45feeb[_0x7c15('0x48')]=intUtil[_0x7c15('0x49')](_0x45feeb[_0x7c15('0x48')]);if(_0x4e8e45&&_0x4e8e45[_0x7c15('0x4a')]){logger[_0x7c15('0x1c')]('[QUEUE]',_0x7c15('0x4b'));_0x8ae3b1[_0x7c15('0x4c')]=util['format'](_0x7c15('0x4d'),_0x45feeb['serverUrl'],_0x8ae3b1['uniqueid'],md5(_0x8ae3b1[_0x7c15('0x4e')]));}else{_0x8ae3b1[_0x7c15('0x4c')]='';}return getConnection(_0x45feeb)['then'](function(_0x21c680){_0x1c1245=_0x21c680;return getUser(_0x45feeb,_0x3ad0b5[_0x7c15('0x4f')],_0x1c1245);})['then'](function(_0x305ce8){_0x24d9ee=_0x305ce8;return getEndUser(_0x45feeb,_0x5366d8,_0x8ae3b1[_0x7c15('0x50')],_0x8ae3b1['calleridnum'],_0x1c1245);})[_0x7c15('0x19')](function(_0x5bb654){_0x3f4d96=_0x5bb654;return getTicket(_0x45feeb,_0x24d9ee,_0x3f4d96,_0x5366d8,_0x8ae3b1,_0x5366d8['Fields'],_0x1c1245);})['then'](function(_0x13764d){_0x438532=_0x13764d;logger[_0x7c15('0x1c')](_0x7c15('0x51'),_0x438532['id']);logger[_0x7c15('0x1c')](_0x7c15('0x52'),_0x438532['id'],_0x3ad0b5[_0x7c15('0x40')],_0x45feeb[_0x7c15('0x39')]);switch(_0x45feeb[_0x7c15('0x39')]){case'integrationTab':emit(util['format'](_0x7c15('0x53'),_0x3ad0b5['name']),_0x7c15('0x54'),{'recordId':_0x438532['id']});break;case _0x7c15('0x55'):emit(util[_0x7c15('0x30')](_0x7c15('0x53'),_0x3ad0b5[_0x7c15('0x40')]),'trigger:browser:url',{'uri':util['format']('%s/%s/e',_0x1c1245[_0x7c15('0x56')],_0x438532['id'])});break;default:logger[_0x7c15('0x57')](_0x7c15('0x58'));}})['catch'](function(_0x491528){logger[_0x7c15('0x57')](_0x7c15('0x59'),JSON[_0x7c15('0x5a')](_0x491528));});};exports[_0x7c15('0x5b')]=function(_0x3e725f,_0x38d287,_0x1dad03,_0x16e819,_0x4074c4,_0xbbd48c,_0x442f5b){var _0x4509f6,_0x94c180,_0x536547,_0x3c90d6;_0xbbd48c['serverUrl']=intUtil[_0x7c15('0x49')](_0xbbd48c[_0x7c15('0x48')]);if(_0x442f5b&&_0x442f5b[_0x7c15('0x5c')]&&_0x442f5b['recordingFormat']!=='none'){logger[_0x7c15('0x1c')](_0x7c15('0x5d'),_0x7c15('0x4b'));_0x38d287[_0x7c15('0x4c')]=util[_0x7c15('0x30')](_0x7c15('0x4d'),_0xbbd48c['serverUrl'],_0x38d287['uniqueid'],md5(_0x38d287[_0x7c15('0x4e')]));}return getConnection(_0xbbd48c)[_0x7c15('0x19')](function(_0x3b0712){_0x3c90d6=_0x3b0712;return getUser(_0xbbd48c,_0x16e819[_0x7c15('0x4f')],_0x3c90d6);})[_0x7c15('0x19')](function(_0x4121e6){_0x4509f6=_0x4121e6;return getEndUser(_0xbbd48c,_0x1dad03,_0x38d287['destcalleridname'],_0x38d287[_0x7c15('0x5e')],_0x3c90d6);})[_0x7c15('0x19')](function(_0x8f1a74){_0x94c180=_0x8f1a74;return getTicket(_0xbbd48c,_0x4509f6,_0x94c180,_0x1dad03,_0x38d287,_0x1dad03[_0x7c15('0x5f')],_0x3c90d6);})['then'](function(_0x41bccb){_0x536547=_0x41bccb;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x536547['id']);logger['info'](_0x7c15('0x60'),_0x536547['id'],_0x16e819[_0x7c15('0x40')],_0xbbd48c[_0x7c15('0x39')]);switch(_0xbbd48c['type']){case _0x7c15('0x61'):emit(util['format']('user:%s',_0x16e819['name']),_0x7c15('0x54'),{'recordId':_0x536547['id']});break;case _0x7c15('0x55'):emit(util[_0x7c15('0x30')]('user:%s',_0x16e819['name']),'trigger:browser:url',{'uri':util[_0x7c15('0x30')](_0x7c15('0x62'),_0x3c90d6[_0x7c15('0x56')],_0x536547['id'])});break;default:logger[_0x7c15('0x57')](_0x7c15('0x5d'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x7c15('0x63')](function(_0x2342b8){logger[_0x7c15('0x57')](_0x7c15('0x5d'),JSON[_0x7c15('0x5a')](_0x2342b8));});};exports[_0x7c15('0x64')]=function(_0x21509b,_0x1d131a,_0x447335,_0x42f314,_0x4de852,_0x447ec5){var _0x3c8f74,_0xe6bd22,_0x2d0afe,_0x3abd16;_0x447ec5['serverUrl']=intUtil[_0x7c15('0x49')](_0x447ec5[_0x7c15('0x48')]);if(_0x4de852&&_0x4de852[_0x7c15('0x4a')]){logger[_0x7c15('0x1c')]('[ABANDONED]','Recording\x20is\x20enabled!');_0x1d131a[_0x7c15('0x4c')]=util[_0x7c15('0x30')](_0x7c15('0x4d'),_0x447ec5[_0x7c15('0x48')],_0x1d131a['uniqueid'],md5(_0x1d131a['uniqueid']));}else{_0x1d131a[_0x7c15('0x4c')]='';}return getConnection(_0x447ec5)['then'](function(_0x1cc8f6){_0x3abd16=_0x1cc8f6;return getUser(_0x447ec5,_0x42f314[_0x7c15('0x4f')],_0x3abd16);})[_0x7c15('0x19')](function(_0x534b17){_0x3c8f74=_0x534b17;return getEndUser(_0x447ec5,_0x447335,_0x1d131a[_0x7c15('0x50')],_0x1d131a[_0x7c15('0x65')],_0x3abd16);})[_0x7c15('0x19')](function(_0x2ecb1f){_0xe6bd22=_0x2ecb1f;return getTicket(_0x447ec5,_0x3c8f74,_0xe6bd22,_0x447335,_0x1d131a,_0x447335[_0x7c15('0x5f')],_0x3abd16);})[_0x7c15('0x19')](function(_0x1e4829){_0x2d0afe=_0x1e4829;logger[_0x7c15('0x1c')](_0x7c15('0x66'),_0x2d0afe['id']);logger[_0x7c15('0x1c')](_0x7c15('0x67'),_0x447ec5['type']);})['catch'](function(_0x37ed32){logger[_0x7c15('0x57')]('[ABANDONED]',JSON[_0x7c15('0x5a')](_0x37ed32));});};
\ No newline at end of file
+var _0x4e3c=['%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','abandoned','monitor_format','[ABANDONED]','Fields','[ABANDONED]\x20Ticket\x20%s\x20created.','[ABANDONED]\x20Integration\x20account\x20type\x20%s.','request-promise','moment','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','socket.io-emitter','emit','merge','utc','getString','Subjects','Descriptions','WhoId','Task','create','validateEmail','sobject','User','execute','then','length','find','Email','Agent\x20%s\x20found.','resolve','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','Lead','lead','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','<unknown>','format','Caller\x20-\x20%s','moduleCreate','contact','Company','No\x20Company','forEach','type','string','idField','content','toString','variable','variableName','Variable','name','toLowerCase','concat','securityToken','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stringify','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.'];(function(_0x3f8de7,_0x3d4cc3){var _0x656bde=function(_0x53dd38){while(--_0x53dd38){_0x3f8de7['push'](_0x3f8de7['shift']());}};_0x656bde(++_0x3d4cc3);}(_0x4e3c,0x1b4));var _0xc4e3=function(_0x590b61,_0x4c4335){_0x590b61=_0x590b61-0x0;var _0x1a14dc=_0x4e3c[_0x590b61];return _0x1a14dc;};'use strict';var _=require('lodash');var rp=require(_0xc4e3('0x0'));var moment=require(_0xc4e3('0x1'));var BPromise=require('bluebird');var md5=require(_0xc4e3('0x2'));var jsforce=require(_0xc4e3('0x3'));var util=require(_0xc4e3('0x4'));var Redis=require(_0xc4e3('0x5'));var intUtil=require(_0xc4e3('0x6'));var config=require(_0xc4e3('0x7'));var logger=require(_0xc4e3('0x8'))(_0xc4e3('0x9'));config[_0xc4e3('0xa')]=_['defaults'](config[_0xc4e3('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xc4e3('0xb'))(new Redis(config['redis']));function emit(_0x195625,_0x5bf803,_0x4e96f9){io['to'](_0x195625)[_0xc4e3('0xc')](_0x5bf803,_0x4e96f9);}function getTicket(_0x5a6376,_0x109520,_0x342124,_0x1d6903,_0x2919cf,_0x24a3c2,_0x163dc6){var _0x49a502=_[_0xc4e3('0xd')]({'OwnerId':_0x109520['id'],'ActivityDate':moment[_0xc4e3('0xe')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xc4e3('0xf')](_0x1d6903[_0xc4e3('0x10')],_0x2919cf,'\x20'),'Description':intUtil['getString'](_0x1d6903[_0xc4e3('0x11')],_0x2919cf,'\x0a')},getCustomFields(_0x24a3c2,_0x2919cf));if(_0x342124){_0x49a502[_0xc4e3('0x12')]=_0x342124['id'];}return _0x163dc6['sobject'](_0xc4e3('0x13'))[_0xc4e3('0x14')](_0x49a502);}function getUser(_0x1e1cca,_0x241605,_0x3a4dd4){if(intUtil[_0xc4e3('0x15')](_0x241605)){var _0x3f4a79={'Email':_0x241605};var _0x27b6c0={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3a4dd4[_0xc4e3('0x16')](_0xc4e3('0x17'))['find'](_0x3f4a79,_0x27b6c0)[_0xc4e3('0x18')]()[_0xc4e3('0x19')](function(_0x19b10a){if(_0x19b10a[_0xc4e3('0x1a')]){var _0x9af721=_[_0xc4e3('0x1b')](_0x19b10a,function(_0x2e7f2c){return _0x2e7f2c[_0xc4e3('0x1c')]===_0x241605;});if(_0x9af721){logger['info'](_0xc4e3('0x1d'),_0x241605);return BPromise[_0xc4e3('0x1e')]({'id':_0x9af721['Id'],'name':_0x9af721[_0xc4e3('0x1f')]});}}else{logger[_0xc4e3('0x20')](_0xc4e3('0x21'),_0x241605);return _0x3a4dd4['identity']()[_0xc4e3('0x19')](function(_0x2b3633){return BPromise[_0xc4e3('0x1e')]({'id':_0x2b3633[_0xc4e3('0x22')],'name':_0x2b3633[_0xc4e3('0x23')]});});}});}else{logger[_0xc4e3('0x20')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x241605);return _0x3a4dd4[_0xc4e3('0x24')]()[_0xc4e3('0x19')](function(_0x31c338){return BPromise[_0xc4e3('0x1e')]({'id':_0x31c338[_0xc4e3('0x22')],'name':_0x31c338[_0xc4e3('0x23')]});});}}function getEndUser(_0x49e1ef,_0x454e91,_0x462092,_0x239f0a,_0xec3c40){var _0x5ad5a5={'Phone':_0x239f0a};var _0x4c7e72={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xc4e3('0x1e')]()['then'](function(){logger['info'](_0xc4e3('0x25'),_0x239f0a,_0x454e91[_0xc4e3('0x26')]);switch(_0x454e91[_0xc4e3('0x26')]){case _0xc4e3('0x27'):return _0xec3c40['sobject'](_0xc4e3('0x28'))[_0xc4e3('0x1b')](_0x5ad5a5,_0x4c7e72)[_0xc4e3('0x18')]()['then'](function(_0x21b7f7){if(_0x21b7f7&&_0x21b7f7[_0xc4e3('0x1a')]){return _0x21b7f7;}else{return _0xec3c40[_0xc4e3('0x16')](_0xc4e3('0x29'))[_0xc4e3('0x1b')](_0x5ad5a5,_0x4c7e72);}});case'contact':return _0xec3c40['sobject'](_0xc4e3('0x28'))[_0xc4e3('0x1b')](_0x5ad5a5,_0x4c7e72)['execute']();case _0xc4e3('0x2a'):return _0xec3c40[_0xc4e3('0x16')](_0xc4e3('0x29'))[_0xc4e3('0x1b')](_0x5ad5a5,_0x4c7e72);default:return null;}})[_0xc4e3('0x19')](function(_0x28e935){if(_0x28e935&&_0x28e935['length']){var _0x50a305=_[_0xc4e3('0x1b')](_0x28e935,function(_0x3cdb95){return _0x3cdb95[_0xc4e3('0x2b')]===_0x239f0a;});if(_0x50a305){return BPromise['resolve']({'id':_0x50a305['Id'],'name':_0x50a305[_0xc4e3('0x1f')],'phone':_0x50a305[_0xc4e3('0x2b')]});}}})[_0xc4e3('0x19')](function(_0x265312){if(_0x265312){logger['info'](_0xc4e3('0x2c'),_0x239f0a);return BPromise[_0xc4e3('0x1e')](_0x265312);}else{logger[_0xc4e3('0x20')](_0xc4e3('0x2d'),_0x239f0a);var _0x1449ed={'LastName':_0x462092!==_0xc4e3('0x2e')?_0x462092:util[_0xc4e3('0x2f')](_0xc4e3('0x30'),_0x239f0a),'Phone':_0x239f0a};if(_0x454e91[_0xc4e3('0x31')]){switch(_0x454e91[_0xc4e3('0x31')]){case _0xc4e3('0x32'):logger[_0xc4e3('0x20')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x239f0a,_0x454e91['moduleCreate']);break;case _0xc4e3('0x2a'):logger[_0xc4e3('0x20')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x239f0a,_0x454e91[_0xc4e3('0x31')]);_0x1449ed[_0xc4e3('0x33')]=_0xc4e3('0x34');break;default:return null;}}return _0xec3c40['sobject'](_['upperFirst'](_0x454e91[_0xc4e3('0x31')]))[_0xc4e3('0x14')](_0x1449ed);}});}function getCustomFields(_0x117a06,_0x3d1453){var _0x4da1b3={};if(_0x117a06[_0xc4e3('0x1a')]>0x0){_[_0xc4e3('0x35')](_0x117a06,function(_0x413841){if(_0x413841[_0xc4e3('0x36')]===_0xc4e3('0x37')&&_0x413841['idField']){_0x4da1b3[_0x413841[_0xc4e3('0x38')]]=_0x413841[_0xc4e3('0x39')][_0xc4e3('0x3a')]();}else if(_0x413841[_0xc4e3('0x36')]===_0xc4e3('0x3b')&&_0x413841[_0xc4e3('0x3c')]&&_0x413841['idField']){_0x3d1453[_0x413841[_0xc4e3('0x3c')]]&&(_0x4da1b3[_0x413841['idField']]=_0x3d1453[_0x413841[_0xc4e3('0x3c')]][_0xc4e3('0x3a')]());}else if(_0x413841[_0xc4e3('0x36')]==='customVariable'&&_0x413841[_0xc4e3('0x3d')]&&_0x413841[_0xc4e3('0x3d')][_0xc4e3('0x3e')]&&_0x413841[_0xc4e3('0x38')]){_0x3d1453[_0x413841[_0xc4e3('0x3d')][_0xc4e3('0x3e')][_0xc4e3('0x3f')]()]&&(_0x4da1b3[_0x413841[_0xc4e3('0x38')]]=_0x3d1453[_0x413841[_0xc4e3('0x3d')][_0xc4e3('0x3e')][_0xc4e3('0x3f')]()][_0xc4e3('0x3a')]());}});}return _0x4da1b3;}function getConnection(_0x340601){var _0x153a9f=_0x340601['password'][_0xc4e3('0x40')](_0x340601[_0xc4e3('0x41')]);var _0x174518=new jsforce['Connection']({'oauth2':{'loginUrl':_0x340601['remoteUri']||_0xc4e3('0x42'),'clientId':_0x340601[_0xc4e3('0x43')],'clientSecret':_0x340601[_0xc4e3('0x44')]}});return _0x174518['login'](_0x340601[_0xc4e3('0x45')],_0x153a9f)['then'](function(){logger['info'](_0xc4e3('0x46'));return _0x174518;});}exports[_0xc4e3('0x47')]=function(_0x45922b,_0x410d9d,_0x3dc1b3,_0xd5544e,_0x3f6c37,_0x3639a1){var _0x1d2480,_0xc28e96,_0x1d7aee,_0x11cadc;_0x3639a1[_0xc4e3('0x48')]=intUtil[_0xc4e3('0x49')](_0x3639a1[_0xc4e3('0x48')]);_0x3639a1[_0xc4e3('0x4a')]=intUtil['stripTrailingSlash'](_0x3639a1['remoteUri']);if(_0x3f6c37&&_0x3f6c37['monitor_format']){logger[_0xc4e3('0x20')](_0xc4e3('0x4b'),'Recording\x20is\x20enabled!');_0x410d9d[_0xc4e3('0x4c')]=util['format'](_0xc4e3('0x4d'),_0x3639a1[_0xc4e3('0x48')],_0x410d9d[_0xc4e3('0x4e')],md5(_0x410d9d[_0xc4e3('0x4e')]));}else{_0x410d9d[_0xc4e3('0x4c')]='';}return getConnection(_0x3639a1)['then'](function(_0x442bc1){_0x11cadc=_0x442bc1;return getUser(_0x3639a1,_0xd5544e[_0xc4e3('0x4f')],_0x11cadc);})[_0xc4e3('0x19')](function(_0x3c7a17){_0x1d2480=_0x3c7a17;return getEndUser(_0x3639a1,_0x3dc1b3,_0x410d9d[_0xc4e3('0x50')],_0x410d9d[_0xc4e3('0x51')],_0x11cadc);})[_0xc4e3('0x19')](function(_0x4f2d5f){_0xc28e96=_0x4f2d5f;return getTicket(_0x3639a1,_0x1d2480,_0xc28e96,_0x3dc1b3,_0x410d9d,_0x3dc1b3['Fields'],_0x11cadc);})[_0xc4e3('0x19')](function(_0x5c8ca5){_0x1d7aee=_0x5c8ca5;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x1d7aee['id']);logger[_0xc4e3('0x20')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x1d7aee['id'],_0xd5544e['name'],_0x3639a1['type']);switch(_0x3639a1[_0xc4e3('0x36')]){case _0xc4e3('0x52'):emit(util[_0xc4e3('0x2f')](_0xc4e3('0x53'),_0xd5544e[_0xc4e3('0x3e')]),_0xc4e3('0x54'),{'recordId':_0x1d7aee['id']});break;case _0xc4e3('0x55'):emit(util['format'](_0xc4e3('0x53'),_0xd5544e[_0xc4e3('0x3e')]),_0xc4e3('0x56'),{'uri':util['format']('%s/%s/e',_0x11cadc[_0xc4e3('0x57')],_0x1d7aee['id'])});break;default:logger[_0xc4e3('0x58')](_0xc4e3('0x59'));}})[_0xc4e3('0x5a')](function(_0x3dc9e9){logger[_0xc4e3('0x58')](_0xc4e3('0x4b'),JSON[_0xc4e3('0x5b')](_0x3dc9e9));});};exports['outbound']=function(_0x49dd78,_0x97fdd9,_0x418ae1,_0x286435,_0x5d038c,_0x277d25,_0x182d9b){var _0x55cb04,_0x552fae,_0x5c315b,_0x160abf;_0x277d25[_0xc4e3('0x48')]=intUtil['stripTrailingSlash'](_0x277d25[_0xc4e3('0x48')]);_0x277d25[_0xc4e3('0x4a')]=intUtil[_0xc4e3('0x49')](_0x277d25[_0xc4e3('0x4a')]);if(_0x182d9b&&_0x182d9b[_0xc4e3('0x5c')]&&_0x182d9b[_0xc4e3('0x5c')]!==_0xc4e3('0x5d')){logger['info'](_0xc4e3('0x5e'),_0xc4e3('0x5f'));_0x97fdd9[_0xc4e3('0x4c')]=util[_0xc4e3('0x2f')](_0xc4e3('0x4d'),_0x277d25[_0xc4e3('0x48')],_0x97fdd9[_0xc4e3('0x4e')],md5(_0x97fdd9['uniqueid']));}return getConnection(_0x277d25)[_0xc4e3('0x19')](function(_0x45ea24){_0x160abf=_0x45ea24;return getUser(_0x277d25,_0x286435['email'],_0x160abf);})[_0xc4e3('0x19')](function(_0x225854){_0x55cb04=_0x225854;return getEndUser(_0x277d25,_0x418ae1,_0x97fdd9[_0xc4e3('0x60')],_0x97fdd9['destcalleridnum'],_0x160abf);})[_0xc4e3('0x19')](function(_0x305a0a){_0x552fae=_0x305a0a;return getTicket(_0x277d25,_0x55cb04,_0x552fae,_0x418ae1,_0x97fdd9,_0x418ae1['Fields'],_0x160abf);})[_0xc4e3('0x19')](function(_0x11d75b){_0x5c315b=_0x11d75b;logger['info'](_0xc4e3('0x61'),_0x5c315b['id']);logger['info'](_0xc4e3('0x62'),_0x5c315b['id'],_0x286435[_0xc4e3('0x3e')],_0x277d25[_0xc4e3('0x36')]);switch(_0x277d25[_0xc4e3('0x36')]){case _0xc4e3('0x52'):emit(util[_0xc4e3('0x2f')](_0xc4e3('0x53'),_0x286435[_0xc4e3('0x3e')]),_0xc4e3('0x54'),{'recordId':_0x5c315b['id']});break;case _0xc4e3('0x55'):emit(util[_0xc4e3('0x2f')](_0xc4e3('0x53'),_0x286435[_0xc4e3('0x3e')]),_0xc4e3('0x56'),{'uri':util[_0xc4e3('0x2f')](_0xc4e3('0x63'),_0x160abf[_0xc4e3('0x57')],_0x5c315b['id'])});break;default:logger[_0xc4e3('0x58')]('[OUTBOUND]',_0xc4e3('0x64'));}})[_0xc4e3('0x5a')](function(_0x138f9e){logger['error']('[OUTBOUND]',JSON[_0xc4e3('0x5b')](_0x138f9e));});};exports[_0xc4e3('0x65')]=function(_0x590b46,_0x519970,_0x3319d9,_0x383403,_0x4aec4d,_0x15b5da){var _0x34950a,_0x4787c8,_0x3305a6,_0x2aac8b;_0x15b5da[_0xc4e3('0x48')]=intUtil[_0xc4e3('0x49')](_0x15b5da[_0xc4e3('0x48')]);_0x15b5da['remoteUri']=intUtil[_0xc4e3('0x49')](_0x15b5da[_0xc4e3('0x4a')]);if(_0x4aec4d&&_0x4aec4d[_0xc4e3('0x66')]){logger[_0xc4e3('0x20')](_0xc4e3('0x67'),_0xc4e3('0x5f'));_0x519970[_0xc4e3('0x4c')]=util[_0xc4e3('0x2f')](_0xc4e3('0x4d'),_0x15b5da[_0xc4e3('0x48')],_0x519970['uniqueid'],md5(_0x519970[_0xc4e3('0x4e')]));}else{_0x519970[_0xc4e3('0x4c')]='';}return getConnection(_0x15b5da)[_0xc4e3('0x19')](function(_0xd1f990){_0x2aac8b=_0xd1f990;return getUser(_0x15b5da,_0x383403[_0xc4e3('0x4f')],_0x2aac8b);})[_0xc4e3('0x19')](function(_0xd7d5ba){_0x34950a=_0xd7d5ba;return getEndUser(_0x15b5da,_0x3319d9,_0x519970[_0xc4e3('0x50')],_0x519970[_0xc4e3('0x51')],_0x2aac8b);})['then'](function(_0x290598){_0x4787c8=_0x290598;return getTicket(_0x15b5da,_0x34950a,_0x4787c8,_0x3319d9,_0x519970,_0x3319d9[_0xc4e3('0x68')],_0x2aac8b);})[_0xc4e3('0x19')](function(_0x144308){_0x3305a6=_0x144308;logger[_0xc4e3('0x20')](_0xc4e3('0x69'),_0x3305a6['id']);logger[_0xc4e3('0x20')](_0xc4e3('0x6a'),_0x15b5da[_0xc4e3('0x36')]);})[_0xc4e3('0x5a')](function(_0x1e4629){logger[_0xc4e3('0x58')]('[ABANDONED]',JSON[_0xc4e3('0x5b')](_0x1e4629));});};
\ No newline at end of file
index 96b8ce5..01d2924 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x69b6=['adminEmail','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','string','nameField','customField','idField','toLowerCase','toString','type','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number','?sysparm_query=name%3D','label_entry','incident','Incident','Incident\x20-\x20','ticketNumber','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','callDirection','queue','abandoned','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','util','./util','md5','../../../../config/logger','servicenow','socket.io-emitter','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','userId','result','sys_id'];(function(_0x1890d5,_0x227b75){var _0x2eba05=function(_0x58b8fb){while(--_0x58b8fb){_0x1890d5['push'](_0x1890d5['shift']());}};_0x2eba05(++_0x227b75);}(_0x69b6,0xa9));var _0x669b=function(_0x44b585,_0x120e48){_0x44b585=_0x44b585-0x0;var _0x38dd43=_0x69b6[_0x44b585];return _0x38dd43;};'use strict';var _=require('lodash');var Promise=require(_0x669b('0x0'));var rp=require('request-promise');var util=require(_0x669b('0x1'));var intUtil=require(_0x669b('0x2'));var md5=require(_0x669b('0x3'));var logger=require(_0x669b('0x4'))(_0x669b('0x5'));var io=require(_0x669b('0x6'))({'host':_0x669b('0x7'),'port':0x18eb});function getAdminUser(_0x2c2486,_0x48c7a9,_0x166291,_0x177626,_0x203e6c,_0x5b753b){return new Promise(function(_0x24b911,_0x18a756){var _0xc5c3ba={'method':_0x669b('0x8'),'uri':_0x177626+_0x669b('0x9')+'&'+_0x203e6c+'&'+_0x5b753b,'auth':_0x48c7a9,'json':!![]};return rp(_0xc5c3ba)[_0x669b('0xa')](function(_0xb84d58){if(_0xb84d58['result']['length']>0x0){_0x166291[_0x669b('0xb')]=_0xb84d58['result'][0x0]['sys_id'];}logger[_0x669b('0xc')]('['+[_0x2c2486[_0x669b('0xd')]()]+_0x669b('0xe'),_0x166291);_0x24b911(_0x166291);})[_0x669b('0xf')](function(_0x350759){logger[_0x669b('0x10')]('['+[_0x2c2486[_0x669b('0xd')]()]+']',_0x350759[_0x669b('0x11')]);_0x18a756(_0x350759[_0x669b('0x11')]);});});}function getUser(_0x2faa8c,_0x2d2c6e,_0x1025d4,_0x40efcc,_0x543250){return function(_0x5458b8){logger[_0x669b('0xc')]('['+[_0x2faa8c[_0x669b('0xd')]()]+_0x669b('0x12'),_0x5458b8);return new Promise(function(_0x3aabdb,_0x5ec48d){var _0x17a2f0={'method':_0x669b('0x8'),'uri':_0x1025d4+_0x669b('0x13')+_0x5458b8[_0x669b('0x14')]+'&'+_0x40efcc+'&'+_0x543250,'auth':_0x2d2c6e,'json':!![]};logger[_0x669b('0xc')]('['+[_0x2faa8c[_0x669b('0xd')]()]+_0x669b('0x15'),_0x17a2f0);return rp(_0x17a2f0)[_0x669b('0xa')](function(_0x2f0c36){logger['info']('['+[_0x2faa8c[_0x669b('0xd')]()]+_0x669b('0x16'),_0x2f0c36);if(_0x2f0c36['result'][_0x669b('0x17')]>0x0){_0x5458b8[_0x669b('0x18')]=_0x2f0c36[_0x669b('0x19')][0x0][_0x669b('0x1a')];}else{_0x5458b8['userId']=_0x5458b8[_0x669b('0xb')];_0x5458b8[_0x669b('0x14')]=_0x5458b8[_0x669b('0x1b')];}logger['info']('['+[_0x2faa8c[_0x669b('0xd')]()]+'],\x20getUser\x20crm',_0x5458b8);_0x3aabdb(_0x5458b8);})[_0x669b('0xf')](function(_0x3a1535){logger[_0x669b('0x10')]('['+[_0x2faa8c[_0x669b('0xd')]()]+']',_0x3a1535['message']);_0x5ec48d(_0x3a1535['message']);});});};}function createEndUser(_0x23aa30,_0x2575ca,_0x2200b0,_0x1ffa62,_0x994abf){logger[_0x669b('0xc')]('['+[_0x23aa30[_0x669b('0xd')]()]+_0x669b('0x1c'),_0x2200b0);return new Promise(function(_0x466a36,_0x2f8fe9){var _0x542a87={'method':_0x669b('0x1d'),'uri':_0x1ffa62+'sys_user?'+_0x994abf,'body':{'user_name':_0x2200b0[_0x669b('0x1e')],'roles':_0x669b('0x1f'),'first_name':_0x2200b0[_0x669b('0x1e')],'last_name':'','title':'','active':_0x669b('0x20'),'email':'','preferred_language':'','time_zone':'','date_format':_0x669b('0x21'),'phone':_0x2200b0[_0x669b('0x1e')]},'auth':_0x2575ca,'json':!![]};return rp(_0x542a87)['then'](function(_0x4cab15){logger['info']('['+[_0x23aa30['toUpperCase']()]+_0x669b('0x22'),_0x4cab15[_0x669b('0x19')]);_0x2200b0[_0x669b('0x23')]=_0x4cab15['result']['sys_id'];_0x466a36(_0x2200b0);})[_0x669b('0xf')](function(_0x34c592){logger[_0x669b('0x10')]('['+[_0x23aa30['toUpperCase']()]+']',_0x34c592['message']);_0x2f8fe9(_0x34c592[_0x669b('0x11')]);});});}function getEndUser(_0x4ad0a3,_0x53d506,_0x5783f9,_0x31598c,_0x216885){return function(_0x33a33e){logger[_0x669b('0xc')]('['+[_0x4ad0a3['toUpperCase']()]+_0x669b('0x24'),_0x33a33e);return new Promise(function(_0x5893b8,_0x25c5e0){var _0x14ba2f={'method':_0x669b('0x8'),'uri':_0x5783f9+_0x669b('0x25')+_0x33a33e[_0x669b('0x1e')]+'&'+_0x31598c+'&'+_0x216885,'auth':_0x53d506,'json':!![]};return rp(_0x14ba2f)[_0x669b('0xa')](function(_0x3450e9){if(_0x3450e9['result']['length']>0x0){_0x33a33e[_0x669b('0x23')]=_0x3450e9[_0x669b('0x19')][0x0][_0x669b('0x1a')];logger[_0x669b('0xc')]('['+[_0x4ad0a3['toUpperCase']()]+_0x669b('0x26'),_0x33a33e);_0x5893b8(_0x33a33e);}else{return createEndUser(_0x4ad0a3,_0x53d506,_0x33a33e,_0x5783f9,_0x31598c)[_0x669b('0xa')](function(_0x388180){logger[_0x669b('0xc')]('['+[_0x4ad0a3[_0x669b('0xd')]()]+'],\x20createEndUser\x20crm',_0x388180);_0x5893b8(_0x388180);});}})['catch'](function(_0x536d91){logger['error']('['+[_0x4ad0a3['toUpperCase']()]+']',_0x536d91[_0x669b('0x11')]);_0x25c5e0(_0x536d91[_0x669b('0x11')]);});});};}function getCustomFields(_0x47daf3,_0x3aa212){var _0x3ad361={};if(_0x47daf3[_0x669b('0x17')]>0x0){_['forEach'](_0x47daf3,function(_0x8ffba4){if(_0x8ffba4['type']===_0x669b('0x27')&&_0x8ffba4[_0x669b('0x28')]&&!_0x8ffba4[_0x669b('0x29')]){_0x3ad361[_0x8ffba4[_0x669b('0x2a')][_0x669b('0x2b')]()]=_0x8ffba4['content'][_0x669b('0x2c')]();}else if(_0x8ffba4[_0x669b('0x2d')]===_0x669b('0x27')&&_0x8ffba4[_0x669b('0x2a')]&&_0x8ffba4[_0x669b('0x29')]){_0x3ad361[_0x8ffba4[_0x669b('0x2a')][_0x669b('0x2b')]()]=_0x8ffba4['content'][_0x669b('0x2c')]();}else if(_0x8ffba4[_0x669b('0x2d')]===_0x669b('0x2e')&&_0x8ffba4[_0x669b('0x2f')]&&_0x8ffba4[_0x669b('0x2a')]&&_0x8ffba4['customField']){_0x3ad361[_0x8ffba4[_0x669b('0x2a')][_0x669b('0x2b')]()]=_0x3aa212[_0x8ffba4[_0x669b('0x2f')]][_0x669b('0x2c')]();}else if(_0x8ffba4[_0x669b('0x2d')]===_0x669b('0x30')&&_0x8ffba4[_0x669b('0x31')]&&_0x8ffba4[_0x669b('0x31')][_0x669b('0x32')]&&_0x8ffba4[_0x669b('0x2a')]&&_0x8ffba4[_0x669b('0x29')]){_0x3ad361[_0x8ffba4[_0x669b('0x2a')][_0x669b('0x2b')]()]=_0x3aa212[_0x8ffba4[_0x669b('0x31')][_0x669b('0x32')]['toLowerCase']()][_0x669b('0x2c')]();}});}return _0x3ad361;}function getTicket(_0xbbb321,_0x70a797,_0x3d7adf,_0x25f6c7,_0x1ac9f7,_0xe4900e){return function(_0x4d994c){logger['info']('['+[_0xbbb321['toUpperCase']()]+_0x669b('0x33'),_0x4d994c);return new Promise(function(_0x1b48b1,_0x37eb72){var _0x167f5d=_0xbbb321['toLowerCase']()===_0x669b('0x34')?_0x4d994c[_0x669b('0x18')]:_0x4d994c[_0x669b('0x23')];var _0x45e278={'method':'POST','uri':_0x3d7adf+'incident'+'?'+_0xe4900e,'body':Object['assign']({},{'active':_0x669b('0x20'),'caller_id':_0x167f5d,'short_description':intUtil[_0x669b('0x35')](_0x25f6c7[_0x669b('0x36')],_0x1ac9f7,'\x20'),'description':intUtil['getString'](_0x25f6c7[_0x669b('0x37')],_0x1ac9f7,'\x0a')},getCustomFields(_0x25f6c7[_0x669b('0x38')],_0x1ac9f7)),'auth':_0x70a797,'json':!![]};return rp(_0x45e278)[_0x669b('0xa')](function(_0x1641f0){logger[_0x669b('0xc')]('['+[_0xbbb321[_0x669b('0xd')]()]+_0x669b('0x39'),_0x1641f0[_0x669b('0x19')]);_0x4d994c[_0x669b('0x3a')]=_0x1641f0[_0x669b('0x19')][_0x669b('0x1a')];_0x4d994c['ticketNumber']=_0x1641f0[_0x669b('0x19')][_0x669b('0x3b')];logger[_0x669b('0xc')]('['+[_0xbbb321[_0x669b('0xd')]()]+']\x20getTicket\x20crm',_0x4d994c);_0x1b48b1(_0x4d994c);})['catch'](function(_0x2a6f18){logger['error']('['+[_0xbbb321[_0x669b('0xd')]()]+']',_0x2a6f18[_0x669b('0x11')]);_0x37eb72(_0x2a6f18[_0x669b('0x11')]);});});};}function createRemoteTag(_0x39c951,_0x5ceae6,_0x33ffb3,_0x4675bd){return new Promise(function(_0x54bc98,_0x550dd0){var _0x126640={'method':_0x669b('0x1d'),'uri':_0x33ffb3+'label'+'?'+_0x4675bd,'body':{'short_description':_0x39c951,'global':!![],'active':!![],'name':_0x39c951},'auth':_0x5ceae6,'json':!![]};return rp(_0x126640)[_0x669b('0xa')](function(_0x16bde3){var _0x155a58=_0x16bde3['result'][_0x669b('0x1a')];_0x54bc98(_0x155a58);});});}function getRemoteTag(_0x59a541,_0x9c463f,_0x16eda9,_0x5961a7,_0x31d67c){return new Promise(function(_0x360790,_0xeee4aa){var _0x21b3d4={'method':_0x669b('0x8'),'uri':_0x16eda9+'label'+_0x669b('0x3c')+_0x59a541+'&'+_0x5961a7,'auth':_0x9c463f,'json':!![]};return rp(_0x21b3d4)[_0x669b('0xa')](function(_0x10ad1a){if(_0x10ad1a['result'][_0x669b('0x17')]>0x0){var _0x1c7265=_0x10ad1a[_0x669b('0x19')][0x0][_0x669b('0x1a')];_0x360790(_0x1c7265);}else{return createRemoteTag(_0x59a541,_0x9c463f,_0x16eda9,_0x5961a7)[_0x669b('0xa')](function(_0x21e96e){_0x360790(_0x21e96e);});}});});}function assignTagToIncident(_0x4aec8c,_0x59e529,_0x4330d8,_0x39f8d3,_0x464300){return new Promise(function(_0x354688,_0x77f018){var _0x1b96b2={'method':_0x669b('0x1d'),'uri':_0x4330d8+_0x669b('0x3d')+'?'+_0x464300,'body':{'label':_0x4aec8c,'table':_0x669b('0x3e'),'id_type':_0x669b('0x3f'),'table_key':_0x39f8d3[_0x669b('0x3a')],'title':_0x669b('0x40')+_0x39f8d3[_0x669b('0x41')],'id_display':_0x39f8d3[_0x669b('0x41')]},'auth':_0x59e529,'json':!![]};return rp(_0x1b96b2)['then'](function(_0xf08a8b){_0x354688();})[_0x669b('0xf')](function(){_0x354688();});});}function manageTags(_0x2a5980,_0x2da889,_0x298d13,_0x44f3b5,_0xc406b3,_0x29fdc0,_0x29df46){return new Promise(function(_0x47001a,_0x3962b4){var _0x5a66b7=[];_0x2da889[_0x669b('0x42')](function(_0xb38c4c){_0x5a66b7[_0x669b('0x43')](getRemoteTag(_0xb38c4c,_0x298d13,_0x44f3b5,_0x29fdc0,_0x29df46));});return Promise[_0x669b('0x44')](_0x5a66b7)['then'](function(_0x5685a5){if(_0x5685a5['length']){logger[_0x669b('0xc')]('['+[_0x2a5980[_0x669b('0xd')]()]+_0x669b('0x45'),_0x5685a5);var _0x5c0431=[];_0x5685a5['forEach'](function(_0xbac8ce){_0x5c0431[_0x669b('0x43')](assignTagToIncident(_0xbac8ce,_0x298d13,_0x44f3b5,_0xc406b3,_0x29fdc0));});return Promise[_0x669b('0x44')](_0x5c0431)['then'](function(){_0x47001a();})[_0x669b('0xf')](function(){_0x47001a();});}else{_0x47001a();}});});}function getTags(_0x339634,_0xed5d5d,_0x31ce4d,_0x2f4954,_0xf1a69d,_0x4525c5){return function(_0x34ccac){return new Promise(function(_0x595792,_0x29c924){var _0x42f25a=[];var _0x36428f=_0x2f4954['Tags'];if(_0x36428f&&_0x36428f[_0x669b('0x17')]>0x0){_0x42f25a=_['map'](_0x36428f,'name');}if(_0x42f25a[_0x669b('0x17')]>0x0){return manageTags(_0x339634,_0x42f25a,_0xed5d5d,_0x31ce4d,_0x34ccac,_0xf1a69d,_0x4525c5)['then'](function(){_0x595792(_0x34ccac);});}else{_0x595792(_0x34ccac);}});};}function emit(_0x552fcf,_0x9bd7d5,_0x538265){var _0x3c380a=_0x669b('0x46')+_0x669b('0x47')+_0x669b('0x48')+_0x669b('0x49');var _0x57ef88={'uri':_0x552fcf+_0x669b('0x4a')+_0x538265+_0x3c380a};io['to'](util[_0x669b('0x4b')]('user:%s',_0x9bd7d5))[_0x669b('0x4c')](_0x669b('0x4d'),_0x57ef88);}exports['cs']=function(_0x328391,_0x567240,_0x2b7e1c,_0x111162,_0xbaf216,_0x38445e,_0x50bcdd,_0x2efaf8){var _0xf26d23={};var _0x2b50d8={'user':_0x38445e['username'],'pass':_0x38445e[_0x669b('0x4e')]};var _0x13eafe='sysparm_limit=1';var _0x9322e5=_0x669b('0x4f');_0x38445e[_0x669b('0x50')]=intUtil[_0x669b('0x51')](_0x38445e[_0x669b('0x50')]);_0x38445e[_0x669b('0x52')]=intUtil[_0x669b('0x51')](_0x38445e[_0x669b('0x52')]);var _0x10f76b=util[_0x669b('0x4b')](_0x669b('0x53'),_0x38445e[_0x669b('0x50')]);_0xf26d23[_0x669b('0x14')]=_0x111162['email'];_0xf26d23[_0x669b('0x1b')]=_0x38445e['email'];_0xf26d23['endUserNumber']=_0x2efaf8['toLowerCase']()==='outbound'?_0x567240['destcalleridnum']:_0x567240['calleridnum'];_0xf26d23[_0x669b('0x54')]=_0x2efaf8===_0x669b('0x55')||_0x2efaf8===_0x669b('0x56')?_0x669b('0x55'):_0x669b('0x34');var _0x505b60=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x38445e[_0x669b('0x52')],_0x567240[_0x669b('0x57')],md5(_0x567240[_0x669b('0x57')]));if(_0xbaf216&&_0xbaf216[_0x669b('0x58')]){logger[_0x669b('0xc')](_0x669b('0x59'),_0x669b('0x5a'));_0x567240[_0x669b('0x5b')]=_0x505b60;}else if(_0x50bcdd&&_0x50bcdd[_0x669b('0x5c')]&&_0x50bcdd[_0x669b('0x5c')]!==_0x669b('0x5d')){logger[_0x669b('0xc')](_0x669b('0x5e'),'Recording\x20is\x20enabled!');_0x567240[_0x669b('0x5b')]=_0x505b60;}else{_0x567240[_0x669b('0x5b')]='';}return getAdminUser(_0x2efaf8,_0x2b50d8,_0xf26d23,_0x10f76b,_0x9322e5,_0x13eafe)['then'](getUser(_0x2efaf8,_0x2b50d8,_0x10f76b,_0x9322e5,_0x13eafe))['then'](getEndUser(_0x2efaf8,_0x2b50d8,_0x10f76b,_0x9322e5,_0x13eafe))['then'](getTicket(_0x2efaf8,_0x2b50d8,_0x10f76b,_0x2b7e1c,_0x567240,_0x9322e5))[_0x669b('0xa')](function(_0x429ad5){logger['info'](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x429ad5[_0x669b('0x3a')]));logger[_0x669b('0xc')](util['format']('call\x20direction:\x20%s',_0x2efaf8));if(_0x2efaf8!==_0x669b('0x56')){logger[_0x669b('0xc')]('['+[_0x2efaf8[_0x669b('0xd')]()]+']',_0x669b('0x5f'));emit(_0x38445e['remoteUri'],_0x111162[_0x669b('0x32')],_0x429ad5['ticketId']);}})[_0x669b('0xf')](function(_0x22af31){logger[_0x669b('0x10')]('['+[_0x2efaf8['toUpperCase']()]+_0x669b('0x60'),util[_0x669b('0x61')](_0x22af31,{'showHidden':!![],'depth':null}));});};
\ No newline at end of file
+var _0x29cb=['sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','adminEmail','destcalleridnum','calleridnum','abandoned','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','sys_id','info','],\x20getAdminUser\x20crm','catch','error','message','toUpperCase','],\x20getUser\x20input\x20crm','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20rp\x20obj','validateEmail','userId','adminId','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','string','nameField','customField','content','toString','idField','toLowerCase','variable','variableName','customVariable','Variable','name','incident','assign','true','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','ticketId','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','username','sysparm_limit=1'];(function(_0x5d895b,_0x3678a0){var _0x1e52c6=function(_0x42a50b){while(--_0x42a50b){_0x5d895b['push'](_0x5d895b['shift']());}};_0x1e52c6(++_0x3678a0);}(_0x29cb,0xe6));var _0xb29c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x29cb[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var Promise=require(_0xb29c('0x0'));var rp=require('request-promise');var util=require('util');var md5=require(_0xb29c('0x1'));var Redis=require(_0xb29c('0x2'));var intUtil=require(_0xb29c('0x3'));var config=require(_0xb29c('0x4'));var logger=require(_0xb29c('0x5'))(_0xb29c('0x6'));config[_0xb29c('0x7')]=_[_0xb29c('0x8')](config[_0xb29c('0x7')],{'host':_0xb29c('0x9'),'port':0x18eb});var io=require(_0xb29c('0xa'))(new Redis(config[_0xb29c('0x7')]));function getAdminUser(_0x173891,_0x1ad7da,_0x1a0861,_0x378ef8,_0xb2214,_0x35f75f){return new Promise(function(_0x4739a0,_0x39e6df){var _0x27dae3={'method':_0xb29c('0xb'),'uri':_0x378ef8+_0xb29c('0xc')+'&'+_0xb2214+'&'+_0x35f75f,'auth':_0x1ad7da,'json':!![]};return rp(_0x27dae3)[_0xb29c('0xd')](function(_0xf19c75){if(_0xf19c75[_0xb29c('0xe')][_0xb29c('0xf')]>0x0){_0x1a0861['adminId']=_0xf19c75[_0xb29c('0xe')][0x0][_0xb29c('0x10')];}logger[_0xb29c('0x11')]('['+[_0x173891['toUpperCase']()]+_0xb29c('0x12'),_0x1a0861);_0x4739a0(_0x1a0861);})[_0xb29c('0x13')](function(_0x394f81){logger[_0xb29c('0x14')]('['+[_0x173891['toUpperCase']()]+']',_0x394f81[_0xb29c('0x15')]);_0x39e6df(_0x394f81[_0xb29c('0x15')]);});});}function getUser(_0x53120d,_0x585106,_0x1438b1,_0x3f05b3,_0xc292b2){return function(_0x2325d4){logger[_0xb29c('0x11')]('['+[_0x53120d[_0xb29c('0x16')]()]+_0xb29c('0x17'),_0x2325d4);return new Promise(function(_0x9998d,_0x4b42e4){var _0x748e1a={'method':_0xb29c('0xb'),'uri':_0x1438b1+_0xb29c('0x18')+_0x2325d4[_0xb29c('0x19')]+'&'+_0x3f05b3+'&'+_0xc292b2,'auth':_0x585106,'json':!![]};logger[_0xb29c('0x11')]('['+[_0x53120d[_0xb29c('0x16')]()]+_0xb29c('0x1a'),_0x748e1a);return rp(_0x748e1a)[_0xb29c('0xd')](function(_0x425767){logger['info']('['+[_0x53120d[_0xb29c('0x16')]()]+'],\x20getUser\x20entity',_0x425767);if(_0x425767[_0xb29c('0xe')]['length']>0x0&&intUtil[_0xb29c('0x1b')](_0x2325d4['userEmail'])){_0x2325d4[_0xb29c('0x1c')]=_0x425767[_0xb29c('0xe')][0x0][_0xb29c('0x10')];}else{_0x2325d4['userId']=_0x2325d4[_0xb29c('0x1d')];_0x2325d4[_0xb29c('0x19')]=_0x2325d4['adminEmail'];}logger[_0xb29c('0x11')]('['+[_0x53120d[_0xb29c('0x16')]()]+_0xb29c('0x1e'),_0x2325d4);_0x9998d(_0x2325d4);})[_0xb29c('0x13')](function(_0x63c921){logger[_0xb29c('0x14')]('['+[_0x53120d['toUpperCase']()]+']',_0x63c921[_0xb29c('0x15')]);_0x4b42e4(_0x63c921['message']);});});};}function createEndUser(_0x4d1e76,_0x75c228,_0x2cebd3,_0x342bf2,_0x5f064f){logger[_0xb29c('0x11')]('['+[_0x4d1e76[_0xb29c('0x16')]()]+_0xb29c('0x1f'),_0x2cebd3);return new Promise(function(_0x5b8fec,_0x4531c6){var _0x24e640={'method':_0xb29c('0x20'),'uri':_0x342bf2+_0xb29c('0x21')+_0x5f064f,'body':{'user_name':_0x2cebd3[_0xb29c('0x22')],'roles':'user','first_name':_0x2cebd3['endUserNumber'],'active':'true','date_format':_0xb29c('0x23'),'phone':_0x2cebd3[_0xb29c('0x22')]},'auth':_0x75c228,'json':!![]};return rp(_0x24e640)[_0xb29c('0xd')](function(_0x3543ad){logger[_0xb29c('0x11')]('['+[_0x4d1e76[_0xb29c('0x16')]()]+_0xb29c('0x24'),_0x3543ad[_0xb29c('0xe')]);_0x2cebd3[_0xb29c('0x25')]=_0x3543ad[_0xb29c('0xe')][_0xb29c('0x10')];_0x5b8fec(_0x2cebd3);})[_0xb29c('0x13')](function(_0x4ab658){logger[_0xb29c('0x14')]('['+[_0x4d1e76[_0xb29c('0x16')]()]+']',_0x4ab658[_0xb29c('0x15')]);_0x4531c6(_0x4ab658['message']);});});}function getEndUser(_0x5bb38b,_0x2fb728,_0x22d76e,_0x16d75f,_0x678f17){return function(_0x5e2fb6){logger[_0xb29c('0x11')]('['+[_0x5bb38b[_0xb29c('0x16')]()]+_0xb29c('0x26'),_0x5e2fb6);return new Promise(function(_0x241f02,_0x2254fe){var _0x3e2e8d={'method':_0xb29c('0xb'),'uri':_0x22d76e+'sys_user?sysparm_query=phone%3D'+_0x5e2fb6[_0xb29c('0x22')]+'&'+_0x16d75f+'&'+_0x678f17,'auth':_0x2fb728,'json':!![]};return rp(_0x3e2e8d)[_0xb29c('0xd')](function(_0x510b75){if(_0x510b75[_0xb29c('0xe')][_0xb29c('0xf')]>0x0){_0x5e2fb6[_0xb29c('0x25')]=_0x510b75[_0xb29c('0xe')][0x0][_0xb29c('0x10')];logger['info']('['+[_0x5bb38b[_0xb29c('0x16')]()]+_0xb29c('0x27'),_0x5e2fb6);_0x241f02(_0x5e2fb6);}else{return createEndUser(_0x5bb38b,_0x2fb728,_0x5e2fb6,_0x22d76e,_0x16d75f)[_0xb29c('0xd')](function(_0x13f352){logger[_0xb29c('0x11')]('['+[_0x5bb38b[_0xb29c('0x16')]()]+_0xb29c('0x28'),_0x13f352);_0x241f02(_0x13f352);});}})[_0xb29c('0x13')](function(_0x341caa){logger['error']('['+[_0x5bb38b[_0xb29c('0x16')]()]+']',_0x341caa[_0xb29c('0x15')]);_0x2254fe(_0x341caa[_0xb29c('0x15')]);});});};}function getCustomFields(_0x36df34,_0x494bed){var _0x215228={};if(_0x36df34[_0xb29c('0xf')]>0x0){_[_0xb29c('0x29')](_0x36df34,function(_0x57bda1){if(_0x57bda1[_0xb29c('0x2a')]===_0xb29c('0x2b')&&_0x57bda1[_0xb29c('0x2c')]&&!_0x57bda1[_0xb29c('0x2d')]){_0x215228[_0x57bda1['idField']['toLowerCase']()]=_0x57bda1[_0xb29c('0x2e')][_0xb29c('0x2f')]();}else if(_0x57bda1[_0xb29c('0x2a')]==='string'&&_0x57bda1[_0xb29c('0x30')]&&_0x57bda1['customField']){_0x215228[_0x57bda1[_0xb29c('0x30')][_0xb29c('0x31')]()]=_0x57bda1[_0xb29c('0x2e')][_0xb29c('0x2f')]();}else if(_0x57bda1[_0xb29c('0x2a')]===_0xb29c('0x32')&&_0x57bda1['variableName']&&_0x57bda1[_0xb29c('0x30')]&&_0x57bda1[_0xb29c('0x2d')]){_0x215228[_0x57bda1[_0xb29c('0x30')][_0xb29c('0x31')]()]=_0x494bed[_0x57bda1[_0xb29c('0x33')]][_0xb29c('0x2f')]();}else if(_0x57bda1[_0xb29c('0x2a')]===_0xb29c('0x34')&&_0x57bda1[_0xb29c('0x35')]&&_0x57bda1[_0xb29c('0x35')][_0xb29c('0x36')]&&_0x57bda1[_0xb29c('0x30')]&&_0x57bda1['customField']){_0x215228[_0x57bda1[_0xb29c('0x30')][_0xb29c('0x31')]()]=_0x494bed[_0x57bda1['Variable'][_0xb29c('0x36')][_0xb29c('0x31')]()]['toString']();}});}return _0x215228;}function getTicket(_0x39ddfb,_0x1b4f85,_0x3dad5c,_0x17fbd0,_0x5e4a42,_0xa2b20d){return function(_0x1e2c93){logger[_0xb29c('0x11')]('['+[_0x39ddfb[_0xb29c('0x16')]()]+']\x20getTicket\x20input\x20crm',_0x1e2c93);return new Promise(function(_0x1bb4e4,_0x100ca8){var _0x28ae9d=_0x39ddfb[_0xb29c('0x31')]()==='outbound'?_0x1e2c93[_0xb29c('0x1c')]:_0x1e2c93[_0xb29c('0x25')];var _0x50d0ea={'method':'POST','uri':_0x3dad5c+_0xb29c('0x37')+'?'+_0xa2b20d,'body':Object[_0xb29c('0x38')]({},{'active':_0xb29c('0x39'),'caller_id':_0x28ae9d,'short_description':intUtil[_0xb29c('0x3a')](_0x17fbd0[_0xb29c('0x3b')],_0x5e4a42,'\x20'),'description':intUtil[_0xb29c('0x3a')](_0x17fbd0[_0xb29c('0x3c')],_0x5e4a42,'\x0a')},getCustomFields(_0x17fbd0[_0xb29c('0x3d')],_0x5e4a42)),'auth':_0x1b4f85,'json':!![]};return rp(_0x50d0ea)['then'](function(_0x2f45fe){logger[_0xb29c('0x11')]('['+[_0x39ddfb[_0xb29c('0x16')]()]+_0xb29c('0x3e'),_0x2f45fe[_0xb29c('0xe')]);_0x1e2c93['ticketId']=_0x2f45fe[_0xb29c('0xe')][_0xb29c('0x10')];_0x1e2c93['ticketNumber']=_0x2f45fe['result'][_0xb29c('0x3f')];logger[_0xb29c('0x11')]('['+[_0x39ddfb[_0xb29c('0x16')]()]+_0xb29c('0x40'),_0x1e2c93);_0x1bb4e4(_0x1e2c93);})[_0xb29c('0x13')](function(_0x29cee2){logger[_0xb29c('0x14')]('['+[_0x39ddfb[_0xb29c('0x16')]()]+']',_0x29cee2['message']);_0x100ca8(_0x29cee2[_0xb29c('0x15')]);});});};}function createRemoteTag(_0x3294ab,_0x1439f5,_0xd31c66,_0x3fd683){return new Promise(function(_0x1a907c,_0x78de70){var _0x1fd6e0={'method':_0xb29c('0x20'),'uri':_0xd31c66+_0xb29c('0x41')+'?'+_0x3fd683,'body':{'short_description':_0x3294ab,'global':!![],'active':!![],'name':_0x3294ab},'auth':_0x1439f5,'json':!![]};return rp(_0x1fd6e0)[_0xb29c('0xd')](function(_0x548ab1){var _0x6f98a2=_0x548ab1[_0xb29c('0xe')]['sys_id'];_0x1a907c(_0x6f98a2);});});}function getRemoteTag(_0x4ad2b2,_0xeacd0e,_0x1e1e07,_0x47b110,_0x2cad84){return new Promise(function(_0x58c652,_0x21c26b){var _0x5ec469={'method':_0xb29c('0xb'),'uri':_0x1e1e07+_0xb29c('0x41')+_0xb29c('0x42')+_0x4ad2b2+'&'+_0x47b110,'auth':_0xeacd0e,'json':!![]};return rp(_0x5ec469)[_0xb29c('0xd')](function(_0x443ebc){if(_0x443ebc[_0xb29c('0xe')][_0xb29c('0xf')]>0x0){var _0x18e830=_0x443ebc[_0xb29c('0xe')][0x0][_0xb29c('0x10')];_0x58c652(_0x18e830);}else{return createRemoteTag(_0x4ad2b2,_0xeacd0e,_0x1e1e07,_0x47b110)['then'](function(_0xcf42a9){_0x58c652(_0xcf42a9);});}});});}function assignTagToIncident(_0x8c74d2,_0x176c9a,_0x271a41,_0x2515ff,_0x362f3e){return new Promise(function(_0xd4d34f,_0x5791c5){var _0x348621={'method':'POST','uri':_0x271a41+_0xb29c('0x43')+'?'+_0x362f3e,'body':{'label':_0x8c74d2,'table':_0xb29c('0x37'),'id_type':_0xb29c('0x44'),'table_key':_0x2515ff[_0xb29c('0x45')],'title':_0xb29c('0x46')+_0x2515ff['ticketNumber'],'id_display':_0x2515ff['ticketNumber']},'auth':_0x176c9a,'json':!![]};return rp(_0x348621)[_0xb29c('0xd')](function(_0x8ecf5f){_0xd4d34f();})['catch'](function(){_0xd4d34f();});});}function manageTags(_0x293d7b,_0x33b495,_0x578612,_0xadfb98,_0x55afa9,_0x5b5891,_0x107f6a){return new Promise(function(_0x13541b,_0x45afcb){var _0x1ca2e3=[];_0x33b495['forEach'](function(_0x38d337){_0x1ca2e3[_0xb29c('0x47')](getRemoteTag(_0x38d337,_0x578612,_0xadfb98,_0x5b5891,_0x107f6a));});return Promise[_0xb29c('0x48')](_0x1ca2e3)[_0xb29c('0xd')](function(_0xcae6f2){if(_0xcae6f2[_0xb29c('0xf')]){logger[_0xb29c('0x11')]('['+[_0x293d7b[_0xb29c('0x16')]()]+_0xb29c('0x49'),_0xcae6f2);var _0x51344b=[];_0xcae6f2[_0xb29c('0x29')](function(_0x442455){_0x51344b['push'](assignTagToIncident(_0x442455,_0x578612,_0xadfb98,_0x55afa9,_0x5b5891));});return Promise[_0xb29c('0x48')](_0x51344b)[_0xb29c('0xd')](function(){_0x13541b();})[_0xb29c('0x13')](function(){_0x13541b();});}else{_0x13541b();}});});}function getTags(_0x122abb,_0xae90ae,_0x33fea3,_0x3dd174,_0xd9ba9f,_0x477918){return function(_0x193405){return new Promise(function(_0x3909e4,_0x866858){var _0x53f251=[];var _0x10087f=_0x3dd174[_0xb29c('0x4a')];if(_0x10087f&&_0x10087f[_0xb29c('0xf')]>0x0){_0x53f251=_['map'](_0x10087f,_0xb29c('0x36'));}if(_0x53f251['length']>0x0){return manageTags(_0x122abb,_0x53f251,_0xae90ae,_0x33fea3,_0x193405,_0xd9ba9f,_0x477918)[_0xb29c('0xd')](function(){_0x3909e4(_0x193405);});}else{_0x3909e4(_0x193405);}});};}function emit(_0x4c8d96,_0x205d90,_0x175de7){var _0x3f92cd=_0xb29c('0x4b')+_0xb29c('0x4c')+_0xb29c('0x4d')+_0xb29c('0x4e');var _0x1d1713={'uri':_0x4c8d96+_0xb29c('0x4f')+_0x175de7+_0x3f92cd};io['to'](util[_0xb29c('0x50')](_0xb29c('0x51'),_0x205d90))[_0xb29c('0x52')]('trigger:browser:url',_0x1d1713);}exports['cs']=function(_0x9c59e5,_0x104e9e,_0x5073bb,_0x96907c,_0x3bf028,_0x4f9bdf,_0x3aff00,_0x1206f3){var _0x132697={};var _0x4d685e={'user':_0x4f9bdf[_0xb29c('0x53')],'pass':_0x4f9bdf['password']};var _0x555cdf=_0xb29c('0x54');var _0x3f5668=_0xb29c('0x55');_0x4f9bdf[_0xb29c('0x56')]=intUtil[_0xb29c('0x57')](_0x4f9bdf[_0xb29c('0x56')]);_0x4f9bdf[_0xb29c('0x58')]=intUtil[_0xb29c('0x57')](_0x4f9bdf[_0xb29c('0x58')]);var _0xf566f9=util[_0xb29c('0x50')](_0xb29c('0x59'),_0x4f9bdf[_0xb29c('0x56')]);_0x132697[_0xb29c('0x19')]=_0x96907c['email'];_0x132697[_0xb29c('0x5a')]=_0x4f9bdf['email'];_0x132697[_0xb29c('0x22')]=_0x1206f3[_0xb29c('0x31')]()==='outbound'?_0x104e9e[_0xb29c('0x5b')]:_0x104e9e[_0xb29c('0x5c')];_0x132697['callDirection']=_0x1206f3==='queue'||_0x1206f3===_0xb29c('0x5d')?'queue':'outbound';var _0x4d2bf7=util[_0xb29c('0x50')](_0xb29c('0x5e'),_0x4f9bdf[_0xb29c('0x58')],_0x104e9e['uniqueid'],md5(_0x104e9e[_0xb29c('0x5f')]));if(_0x3bf028&&_0x3bf028['monitor_format']){logger[_0xb29c('0x11')]('[QUEUE]','Recording\x20is\x20enabled!');_0x104e9e[_0xb29c('0x60')]=_0x4d2bf7;}else if(_0x3aff00&&_0x3aff00[_0xb29c('0x61')]&&_0x3aff00['recordingFormat']!==_0xb29c('0x62')){logger[_0xb29c('0x11')](_0xb29c('0x63'),_0xb29c('0x64'));_0x104e9e[_0xb29c('0x60')]=_0x4d2bf7;}else{_0x104e9e['recordingURL']='';}return getAdminUser(_0x1206f3,_0x4d685e,_0x132697,_0xf566f9,_0x3f5668,_0x555cdf)[_0xb29c('0xd')](getUser(_0x1206f3,_0x4d685e,_0xf566f9,_0x3f5668,_0x555cdf))['then'](getEndUser(_0x1206f3,_0x4d685e,_0xf566f9,_0x3f5668,_0x555cdf))[_0xb29c('0xd')](getTicket(_0x1206f3,_0x4d685e,_0xf566f9,_0x5073bb,_0x104e9e,_0x3f5668))[_0xb29c('0xd')](function(_0x150932){logger[_0xb29c('0x11')](util['format'](_0xb29c('0x65'),_0x150932['ticketId']));logger[_0xb29c('0x11')](util[_0xb29c('0x50')](_0xb29c('0x66'),_0x1206f3));if(_0x1206f3!==_0xb29c('0x5d')){logger['info']('['+[_0x1206f3['toUpperCase']()]+']',_0xb29c('0x67'));emit(_0x4f9bdf[_0xb29c('0x56')],_0x96907c[_0xb29c('0x36')],_0x150932[_0xb29c('0x45')]);}})['catch'](function(_0xbcd4b9){logger[_0xb29c('0x14')]('['+[_0x1206f3[_0xb29c('0x16')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0xb29c('0x68')](_0xbcd4b9,{'showHidden':!![],'depth':null}));});};
\ No newline at end of file
index 1fb7f08..32de539 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3840=['base64','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','entry_list','length','find','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','user_name','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','<unknown>','Caller\x20-\x20%s','first_name','debug','[HTTP]','merge','type','string','nameField','customField','toLowerCase','content','variable','custom_fields','push','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','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','user:%s','catch','error','recordingFormat','none','destcalleridname','destcalleridnum','Outbound','users','version','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','abandoned','[ABANDONED]','calleridnum','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','POST','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_minutes','parent_type','parent_name','name','direction','forEach','variableName','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString'];(function(_0x27d975,_0x33829f){var _0x2b9e21=function(_0x30bc0c){while(--_0x30bc0c){_0x27d975['push'](_0x27d975['shift']());}};_0x2b9e21(++_0x33829f);}(_0x3840,0xce));var _0x0384=function(_0xbfa8e5,_0x1b14be){_0xbfa8e5=_0xbfa8e5-0x0;var _0x140b6d=_0x3840[_0xbfa8e5];return _0x140b6d;};'use strict';var _=require(_0x0384('0x0'));var rp=require(_0x0384('0x1'));var BPromise=require(_0x0384('0x2'));var md5=require(_0x0384('0x3'));var util=require(_0x0384('0x4'));var Redis=require(_0x0384('0x5'));var intUtil=require(_0x0384('0x6'));var config=require(_0x0384('0x7'));var logger=require(_0x0384('0x8'))(_0x0384('0x9'));config[_0x0384('0xa')]=_[_0x0384('0xb')](config['redis'],{'host':_0x0384('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0384('0xa')]));var def={'method':_0x0384('0xd'),'json':!![]};function emit(_0x49632f,_0x530947,_0x24700f){io['to'](_0x49632f)['emit'](_0x530947,_0x24700f);}function getTicket(_0x3daa8e,_0x3a7224,_0x4604a6,_0x113173,_0x4ded6f,_0x4d0b58,_0x4c9acf,_0x4dd9f9){logger[_0x0384('0xe')](_0x0384('0xf'));var _0x5b080a=new Date();var _0x19e728=[{'name':'name','value':intUtil[_0x0384('0x10')](_0x113173[_0x0384('0x11')],_0x4ded6f,'\x20')},{'name':_0x0384('0x12'),'value':_0x3a7224['id']},{'name':_0x0384('0x13'),'value':_0x3a7224['id']},{'name':_0x0384('0x14'),'value':intUtil[_0x0384('0x10')](_0x113173[_0x0384('0x15')],_0x4ded6f,'\x0a')},{'name':_0x0384('0x16'),'value':_0x5b080a[_0x0384('0x17')]()[_0x0384('0x18')](0x0,0x13)[_0x0384('0x19')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x0384('0x1a'),'value':'15'},{'name':'parent_id','value':_0x4604a6['id']},{'name':_0x0384('0x1b'),'value':'Contacts'},{'name':_0x0384('0x1c'),'value':_0x4604a6[_0x0384('0x1d')]},{'name':_0x0384('0x1e'),'value':_0x4dd9f9}];if(_0x4d0b58['length']){_[_0x0384('0x1f')](_0x4d0b58,function(_0x467f70){if(_0x4ded6f[_0x467f70[_0x0384('0x20')]]){_0x19e728['push']({'name':_0x467f70[_0x0384('0x21')],'value':_0x4ded6f[_0x467f70[_0x0384('0x20')]]});}});}return request({'form':{'method':_0x0384('0x22'),'input_type':_0x0384('0x23'),'response_type':_0x0384('0x23'),'rest_data':JSON[_0x0384('0x24')]({'session':_0x4c9acf['id'],'module_name':_0x0384('0x25'),'name_value_list':_0x19e728})}});}function getAuth(_0xa40bba){return util[_0x0384('0x26')](_0x0384('0x27'),new Buffer(_0xa40bba[_0x0384('0x28')]+':X')[_0x0384('0x29')](_0x0384('0x2a')));}function getServerInfo(_0x187b3e){return request({'form':{'method':'get_server_info','input_type':_0x0384('0x23'),'response_type':_0x0384('0x23'),'rest_data':JSON['stringify']({'session':_0x187b3e['id']})}});}function getUser(_0xaa179,_0x239ef6,_0x17cfe5){logger[_0x0384('0xe')]('Getting\x20agent\x20with\x20name',_0x239ef6);return request({'form':{'method':_0x0384('0x2b'),'input_type':'JSON','response_type':_0x0384('0x23'),'rest_data':JSON['stringify']({'session':_0x17cfe5['id'],'module_name':'Employees','query':util[_0x0384('0x26')](_0x0384('0x2c'),_0x239ef6),'order_by':'','offset':'0','select_fields':['id',_0x0384('0x1d'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x1b013d){if(_0x1b013d[_0x0384('0x2d')][_0x0384('0x2e')]){var _0x23152d=_[_0x0384('0x2f')](_0x1b013d[_0x0384('0x2d')],function(_0x344996){return _0x344996[_0x0384('0x30')]['user_name'][_0x0384('0x31')]===_0x239ef6;});if(_0x23152d){logger[_0x0384('0xe')]('Agent\x20found!');return BPromise[_0x0384('0x32')]({'id':_0x23152d[_0x0384('0x30')]['id']['value'],'name':_0x23152d['name_value_list'][_0x0384('0x1d')][_0x0384('0x31')]});}}else{logger[_0x0384('0xe')](_0x0384('0x33'));return BPromise[_0x0384('0x32')]({'id':_0x17cfe5[_0x0384('0x30')][_0x0384('0x34')][_0x0384('0x31')],'name':_0x17cfe5[_0x0384('0x30')][_0x0384('0x35')][_0x0384('0x31')]});}});}function getEndUser(_0x3e364a,_0x47c25b,_0xedacdf,_0x320ed7){logger['info'](_0x0384('0x36'),_0xedacdf);return request({'form':{'method':_0x0384('0x2b'),'input_type':'JSON','response_type':_0x0384('0x23'),'rest_data':JSON[_0x0384('0x24')]({'session':_0x320ed7['id'],'module_name':_0x0384('0x37'),'query':util[_0x0384('0x26')](_0x0384('0x38'),_0xedacdf),'order_by':'','offset':'0','select_fields':['id',_0x0384('0x1d'),_0x0384('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0384('0x3a')](function(_0x54a6c2){if(_0x54a6c2[_0x0384('0x2d')][_0x0384('0x2e')]){var _0x48c446=_['find'](_0x54a6c2[_0x0384('0x2d')],function(_0x3a8d45){return _0x3a8d45[_0x0384('0x30')][_0x0384('0x39')][_0x0384('0x31')]===_0xedacdf;});if(_0x48c446){logger[_0x0384('0xe')](_0x0384('0x3b'));return BPromise[_0x0384('0x32')]({'id':_0x48c446[_0x0384('0x30')]['id']['value'],'name':_0x48c446[_0x0384('0x30')]['name'][_0x0384('0x31')],'phone':_0x48c446[_0x0384('0x30')][_0x0384('0x39')][_0x0384('0x31')]});}}else{logger[_0x0384('0xe')](_0x0384('0x3c'));return request({'form':{'method':_0x0384('0x22'),'input_type':'JSON','response_type':_0x0384('0x23'),'rest_data':JSON['stringify']({'session':_0x320ed7['id'],'module_name':'Contacts','name_value_list':[{'name':'first_name','value':_0x47c25b!==_0x0384('0x3d')?_0x47c25b:util[_0x0384('0x26')](_0x0384('0x3e'),_0xedacdf)},{'name':_0x0384('0x39'),'value':_0xedacdf}]})}})[_0x0384('0x3a')](function(_0x2a1854){logger[_0x0384('0xe')]('Enduser\x20created.');return BPromise[_0x0384('0x32')]({'id':_0x2a1854['id'],'name':_0x2a1854[_0x0384('0x2d')][_0x0384('0x3f')][_0x0384('0x31')],'phone':_0x2a1854['entry_list']['phone_home'][_0x0384('0x31')]});});}});}function request(_0x1d20cf){logger[_0x0384('0x40')](_0x0384('0x41'),JSON['stringify'](_0x1d20cf));return rp(_[_0x0384('0x42')](def,_0x1d20cf));}function getTags(_0x712edc,_0x14eb60){var _0x1f02b9=[];if(_0x712edc&&_0x712edc['length']>0x0){_0x1f02b9=_['map'](_0x712edc,_0x14eb60);}return _0x1f02b9;}function getCustomFields(_0x3fa743,_0x542584){var _0x5e1e97=[];var _0x335d66={'custom_fields':[]};if(_0x3fa743[_0x0384('0x2e')]>0x0){_['forEach'](_0x3fa743,function(_0x102528){if(_0x102528[_0x0384('0x43')]===_0x0384('0x44')&&_0x102528[_0x0384('0x45')]&&!_0x102528[_0x0384('0x46')]){_0x335d66[_0x102528[_0x0384('0x45')][_0x0384('0x47')]()]=_0x102528[_0x0384('0x48')][_0x0384('0x29')]();}else if(_0x102528[_0x0384('0x43')]===_0x0384('0x44')&&_0x102528['idField']&&_0x102528[_0x0384('0x46')]){_0x335d66['custom_fields']['push']({'id':_0x102528[_0x0384('0x21')],'value':_0x102528[_0x0384('0x48')]['toString']()});}else if(_0x102528[_0x0384('0x43')]===_0x0384('0x49')&&_0x102528['variableName']&&_0x102528[_0x0384('0x21')]&&_0x102528['customField']){_0x542584[_0x102528[_0x0384('0x20')]]&&_0x335d66[_0x0384('0x4a')][_0x0384('0x4b')]({'id':_0x102528[_0x0384('0x21')],'value':_0x542584[_0x102528[_0x0384('0x20')]][_0x0384('0x29')]()});}else if(_0x102528['type']===_0x0384('0x4c')&&_0x102528[_0x0384('0x4d')]&&_0x102528[_0x0384('0x4d')]['name']&&_0x102528['idField']&&_0x102528['customField']){_0x542584[_0x102528['Variable'][_0x0384('0x1d')][_0x0384('0x47')]()]&&_0x335d66['custom_fields'][_0x0384('0x4b')]({'id':_0x102528[_0x0384('0x21')],'value':_0x542584[_0x102528[_0x0384('0x4d')][_0x0384('0x1d')][_0x0384('0x47')]()][_0x0384('0x29')]()});}});}return _0x335d66;}function getConnection(_0x3ce0c8){return request({'method':_0x0384('0xd'),'form':{'method':_0x0384('0x4e'),'input_type':'JSON','response_type':_0x0384('0x23'),'rest_data':JSON[_0x0384('0x24')]({'user_auth':{'user_name':_0x3ce0c8[_0x0384('0x4f')],'password':_0x3ce0c8[_0x0384('0x50')],'encryption':_0x0384('0x51')},'application':_0x0384('0x52')})}})[_0x0384('0x3a')](function(_0x3cd987){var _0x5af57e=_0x3cd987;if(_0x5af57e['id']){def[_0x0384('0x53')]=_0x5af57e['id'];return BPromise[_0x0384('0x32')](_0x5af57e);}else{throw new Error(util[_0x0384('0x26')](_0x0384('0x54'),_0x3ce0c8['id']));}});}function setRelationship(_0x3cd543,_0x225640,_0x197fcb,_0x2c5ce8){return request({'form':{'method':'set_relationship','input_type':_0x0384('0x23'),'response_type':_0x0384('0x23'),'rest_data':JSON[_0x0384('0x24')]({'session':_0x3cd543['id'],'module_name':_0x0384('0x25'),'module_id':_0x197fcb['id'],'link_field_name':_0x2c5ce8,'related_ids':[_0x225640['id']]})}});}exports[_0x0384('0x55')]=function(_0x5586b5,_0x3d6502,_0x22931e,_0x26fabf,_0x121ac4,_0x23bb72){var _0x3e0fae,_0x3a6310,_0x505270,_0x327c2c;_0x23bb72['remoteUri']=intUtil[_0x0384('0x56')](_0x23bb72[_0x0384('0x57')]);_0x23bb72['serverUrl']=intUtil[_0x0384('0x56')](_0x23bb72[_0x0384('0x58')]);def[_0x0384('0x59')]=util[_0x0384('0x26')](_0x0384('0x5a'),_0x23bb72[_0x0384('0x57')]);if(_0x121ac4&&_0x121ac4[_0x0384('0x5b')]){logger['info'](_0x0384('0x5c'),_0x0384('0x5d'));_0x3d6502[_0x0384('0x5e')]=util['format'](_0x0384('0x5f'),_0x23bb72[_0x0384('0x58')],_0x3d6502[_0x0384('0x60')],md5(_0x3d6502['uniqueid']));}else{_0x3d6502[_0x0384('0x5e')]='';}return getConnection(_0x23bb72)[_0x0384('0x3a')](function(_0x1c6d7f){_0x327c2c=_0x1c6d7f;return getUser(_0x23bb72,_0x26fabf[_0x0384('0x1d')],_0x327c2c);})[_0x0384('0x3a')](function(_0x505f88){_0x3e0fae=_0x505f88;logger[_0x0384('0xe')](_0x0384('0x61'),_0x3e0fae['id']);return getEndUser(_0x23bb72,_0x3d6502[_0x0384('0x62')],_0x3d6502['calleridnum'],_0x327c2c);})[_0x0384('0x3a')](function(_0x2ccb9d){_0x3a6310=_0x2ccb9d;logger[_0x0384('0xe')](_0x0384('0x63'),_0x3a6310['id']);return getTicket(_0x23bb72,_0x3e0fae,_0x3a6310,_0x22931e,_0x3d6502,_0x22931e[_0x0384('0x64')],_0x327c2c,_0x0384('0x65'));})['then'](function(_0xd22bd){_0x505270=_0xd22bd;logger['info'](_0x0384('0x66'));logger[_0x0384('0xe')](_0x0384('0x67'),_0x505270['id']);return setRelationship(_0x327c2c,_0x3e0fae,_0x505270,'users');})[_0x0384('0x3a')](function(){return setRelationship(_0x327c2c,_0x3a6310,_0x505270,_0x0384('0x68'));})[_0x0384('0x3a')](function(){return getServerInfo(_0x327c2c);})[_0x0384('0x3a')](function(_0x3d555){var _0x324a38=parseInt(_0x3d555['version'][_0x0384('0x69')](0x0));var _0xab48e8=util[_0x0384('0x26')](_0x0384('0x6a'),_0x23bb72[_0x0384('0x57')],_0x505270['id']);if(_0x324a38>0x6){_0xab48e8=util[_0x0384('0x26')](_0x0384('0x6b'),_0x23bb72[_0x0384('0x57')],_0x505270['id']);}logger[_0x0384('0xe')](_0x0384('0x5c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x0384('0x26')](_0x0384('0x6c'),_0x26fabf[_0x0384('0x1d')]),'trigger:browser:url',{'uri':_0xab48e8});})[_0x0384('0x6d')](function(_0x35e690){logger[_0x0384('0x6e')](_0x0384('0x5c'),JSON[_0x0384('0x24')](_0x35e690));});};exports['outbound']=function(_0x73d69b,_0x4d0385,_0x40ebd6,_0x50011c,_0x39c483,_0x115629,_0x1a3ce4){var _0x15a747,_0x14dae,_0xdac8d,_0x54931e;_0x115629['remoteUri']=intUtil[_0x0384('0x56')](_0x115629[_0x0384('0x57')]);_0x115629['serverUrl']=intUtil['stripTrailingSlash'](_0x115629[_0x0384('0x58')]);def['uri']=util[_0x0384('0x26')](_0x0384('0x5a'),_0x115629[_0x0384('0x57')]);if(_0x1a3ce4&&_0x1a3ce4['recordingFormat']&&_0x1a3ce4[_0x0384('0x6f')]!==_0x0384('0x70')){logger[_0x0384('0xe')]('[OUTBOUND]',_0x0384('0x5d'));_0x4d0385['recordingURL']=util[_0x0384('0x26')](_0x0384('0x5f'),_0x115629[_0x0384('0x58')],_0x4d0385['uniqueid'],md5(_0x4d0385[_0x0384('0x60')]));}return getConnection(_0x115629)[_0x0384('0x3a')](function(_0xb543ad){_0x54931e=_0xb543ad;return getUser(_0x115629,_0x50011c['name'],_0x54931e);})['then'](function(_0x552612){_0x15a747=_0x552612;logger['info'](_0x0384('0x61'),_0x15a747['id']);return getEndUser(_0x115629,_0x4d0385[_0x0384('0x71')],_0x4d0385[_0x0384('0x72')],_0x54931e);})[_0x0384('0x3a')](function(_0x47cd92){_0x14dae=_0x47cd92;logger['info'](_0x0384('0x63'),_0x14dae['id']);return getTicket(_0x115629,_0x15a747,_0x14dae,_0x40ebd6,_0x4d0385,_0x40ebd6[_0x0384('0x64')],_0x54931e,_0x0384('0x73'));})['then'](function(_0x1cc8c7){_0xdac8d=_0x1cc8c7;logger[_0x0384('0xe')]('Ticket\x20created!');logger[_0x0384('0xe')](_0x0384('0x67'),_0xdac8d['id']);return setRelationship(_0x54931e,_0x15a747,_0xdac8d,_0x0384('0x74'));})[_0x0384('0x3a')](function(){return setRelationship(_0x54931e,_0x14dae,_0xdac8d,_0x0384('0x68'));})['then'](function(){return getServerInfo(_0x54931e);})['then'](function(_0x2bc3a4){var _0x2bf3b0=parseInt(_0x2bc3a4[_0x0384('0x75')][_0x0384('0x69')](0x0));var _0xdb1f28=util[_0x0384('0x26')](_0x0384('0x6a'),_0x115629[_0x0384('0x57')],_0xdac8d['id']);if(_0x2bf3b0>0x6){_0xdb1f28=util[_0x0384('0x26')](_0x0384('0x6b'),_0x115629['remoteUri'],_0xdac8d['id']);}logger[_0x0384('0xe')](_0x0384('0x76'),_0x0384('0x77'));emit(util['format'](_0x0384('0x6c'),_0x50011c['name']),_0x0384('0x78'),{'uri':_0xdb1f28});})['catch'](function(_0x4ced05){logger[_0x0384('0x6e')]('[OUTBOUND]',JSON['stringify'](_0x4ced05));});};exports[_0x0384('0x79')]=function(_0x237a7d,_0x28d25e,_0x228d52,_0x527f60,_0x1bf62b,_0x436d4e){var _0x153979,_0xab8570,_0x1e3d2c,_0x290652;_0x436d4e['remoteUri']=intUtil[_0x0384('0x56')](_0x436d4e[_0x0384('0x57')]);_0x436d4e['serverUrl']=intUtil[_0x0384('0x56')](_0x436d4e[_0x0384('0x58')]);def[_0x0384('0x59')]=util[_0x0384('0x26')](_0x0384('0x5a'),_0x436d4e['remoteUri']);if(_0x1bf62b&&_0x1bf62b[_0x0384('0x5b')]){logger[_0x0384('0xe')](_0x0384('0x7a'),_0x0384('0x5d'));_0x28d25e[_0x0384('0x5e')]=util[_0x0384('0x26')](_0x0384('0x5f'),_0x436d4e[_0x0384('0x58')],_0x28d25e['uniqueid'],md5(_0x28d25e[_0x0384('0x60')]));}else{_0x28d25e[_0x0384('0x5e')]='';}return getConnection(_0x436d4e)['then'](function(_0x1cb5b9){_0x290652=_0x1cb5b9;return getUser(_0x436d4e,_0x527f60[_0x0384('0x1d')],_0x290652);})[_0x0384('0x3a')](function(_0x3c0e71){_0x153979=_0x3c0e71;logger[_0x0384('0xe')]('The\x20User\x20ID\x20is:',_0x153979['id']);return getEndUser(_0x436d4e,_0x28d25e[_0x0384('0x62')],_0x28d25e[_0x0384('0x7b')],_0x290652);})[_0x0384('0x3a')](function(_0x508525){_0xab8570=_0x508525;logger['info'](_0x0384('0x63'),_0xab8570['id']);return getTicket(_0x436d4e,_0x153979,_0xab8570,_0x228d52,_0x28d25e,_0x228d52['Fields'],_0x290652,'Inbound');})['then'](function(_0x4276f2){_0x1e3d2c=_0x4276f2;logger[_0x0384('0xe')]('Ticket\x20created!');logger[_0x0384('0xe')](_0x0384('0x67'),_0x1e3d2c['id']);return setRelationship(_0x290652,_0x153979,_0x1e3d2c,'users');})[_0x0384('0x3a')](function(){return setRelationship(_0x290652,_0xab8570,_0x1e3d2c,_0x0384('0x68'));})['then'](function(){return getServerInfo(_0x290652);})[_0x0384('0x6d')](function(_0x3c43ce){logger[_0x0384('0x6e')](_0x0384('0x7a'),JSON['stringify'](_0x3c43ce));});};
\ No newline at end of file
+var _0xd23a=['remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','error','outbound','stripTrailingSlash','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Outbound','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[OUTBOUND]','trigger:browser:url','catch','abandoned','[ABANDONED]','lodash','request-promise','bluebird','md5','util','./util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','POST','name','getString','Subjects','created_by','toISOString','slice','parent_id','Contacts','parent_name','direction','length','forEach','variableName','push','idField','JSON','stringify','Calls','format','apiKey','toString','base64','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','resolve','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','<unknown>','Caller\x20-\x20%s','debug','[HTTP]','map','type','string','nameField','customField','toLowerCase','content','variable','custom_fields','Variable','login','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue'];(function(_0x594e11,_0x28f652){var _0x5418ad=function(_0x5dcfa7){while(--_0x5dcfa7){_0x594e11['push'](_0x594e11['shift']());}};_0x5418ad(++_0x28f652);}(_0xd23a,0x106));var _0xad23=function(_0x558800,_0x44e818){_0x558800=_0x558800-0x0;var _0x1685ac=_0xd23a[_0x558800];return _0x1685ac;};'use strict';var _=require(_0xad23('0x0'));var rp=require(_0xad23('0x1'));var BPromise=require(_0xad23('0x2'));var md5=require(_0xad23('0x3'));var util=require(_0xad23('0x4'));var Redis=require('ioredis');var intUtil=require(_0xad23('0x5'));var config=require('../../../../config/environment');var logger=require(_0xad23('0x6'))('sugarcrm');config[_0xad23('0x7')]=_[_0xad23('0x8')](config[_0xad23('0x7')],{'host':_0xad23('0x9'),'port':0x18eb});var io=require(_0xad23('0xa'))(new Redis(config[_0xad23('0x7')]));var def={'method':_0xad23('0xb'),'json':!![]};function emit(_0x118b80,_0xe22e8,_0x3d958c){io['to'](_0x118b80)['emit'](_0xe22e8,_0x3d958c);}function getTicket(_0x5db05d,_0x453252,_0x2b4782,_0xfdbe67,_0x40c666,_0x130e35,_0x34b704,_0x23f86b){logger['info']('Creating\x20new\x20ticket...');var _0xdd36e6=new Date();var _0x565d9c=[{'name':_0xad23('0xc'),'value':intUtil[_0xad23('0xd')](_0xfdbe67[_0xad23('0xe')],_0x40c666,'\x20')},{'name':'assigned_user_id','value':_0x453252['id']},{'name':_0xad23('0xf'),'value':_0x453252['id']},{'name':'description','value':intUtil[_0xad23('0xd')](_0xfdbe67['Descriptions'],_0x40c666,'\x0a')},{'name':'date_start','value':_0xdd36e6[_0xad23('0x10')]()[_0xad23('0x11')](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xad23('0x12'),'value':_0x2b4782['id']},{'name':'parent_type','value':_0xad23('0x13')},{'name':_0xad23('0x14'),'value':_0x2b4782[_0xad23('0xc')]},{'name':_0xad23('0x15'),'value':_0x23f86b}];if(_0x130e35[_0xad23('0x16')]){_[_0xad23('0x17')](_0x130e35,function(_0x164f79){if(_0x40c666[_0x164f79[_0xad23('0x18')]]){_0x565d9c[_0xad23('0x19')]({'name':_0x164f79[_0xad23('0x1a')],'value':_0x40c666[_0x164f79[_0xad23('0x18')]]});}});}return request({'form':{'method':'set_entry','input_type':_0xad23('0x1b'),'response_type':_0xad23('0x1b'),'rest_data':JSON[_0xad23('0x1c')]({'session':_0x34b704['id'],'module_name':_0xad23('0x1d'),'name_value_list':_0x565d9c})}});}function getAuth(_0x4289ff){return util[_0xad23('0x1e')]('Basic\x20%s',new Buffer(_0x4289ff[_0xad23('0x1f')]+':X')[_0xad23('0x20')](_0xad23('0x21')));}function getServerInfo(_0xcc74e9){return request({'form':{'method':'get_server_info','input_type':_0xad23('0x1b'),'response_type':_0xad23('0x1b'),'rest_data':JSON[_0xad23('0x1c')]({'session':_0xcc74e9['id']})}});}function getUser(_0x569ed5,_0x4b018a,_0x58c4b6){if(_0x4b018a){logger[_0xad23('0x22')](_0xad23('0x23'),_0x4b018a);return request({'form':{'method':_0xad23('0x24'),'input_type':'JSON','response_type':_0xad23('0x1b'),'rest_data':JSON[_0xad23('0x1c')]({'session':_0x58c4b6['id'],'module_name':_0xad23('0x25'),'query':util[_0xad23('0x1e')](_0xad23('0x26'),_0x4b018a),'order_by':'','offset':'0','select_fields':['id',_0xad23('0xc'),_0xad23('0x27')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xad23('0x28')](function(_0x47c24f){if(_0x47c24f[_0xad23('0x29')][_0xad23('0x16')]){var _0x3c6a04=_[_0xad23('0x2a')](_0x47c24f[_0xad23('0x29')],function(_0x4cc3d5){return _0x4cc3d5[_0xad23('0x2b')][_0xad23('0x27')][_0xad23('0x2c')]===_0x4b018a;});if(_0x3c6a04){logger[_0xad23('0x22')]('Agent\x20found!');return BPromise[_0xad23('0x2d')]({'id':_0x3c6a04[_0xad23('0x2b')]['id'][_0xad23('0x2c')],'name':_0x3c6a04[_0xad23('0x2b')][_0xad23('0xc')][_0xad23('0x2c')]});}}logger[_0xad23('0x22')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xad23('0x2d')]({'id':_0x58c4b6[_0xad23('0x2b')][_0xad23('0x2e')][_0xad23('0x2c')],'name':_0x58c4b6['name_value_list']['user_name'][_0xad23('0x2c')]});});}else{logger[_0xad23('0x22')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xad23('0x2d')]({'id':_0x58c4b6[_0xad23('0x2b')][_0xad23('0x2e')]['value'],'name':_0x58c4b6['name_value_list'][_0xad23('0x27')][_0xad23('0x2c')]});}}function getEndUser(_0x5b99dc,_0x31b18a,_0x461e7f,_0x1220fb){logger['info'](_0xad23('0x2f'),_0x461e7f);return request({'form':{'method':_0xad23('0x24'),'input_type':_0xad23('0x1b'),'response_type':'JSON','rest_data':JSON[_0xad23('0x1c')]({'session':_0x1220fb['id'],'module_name':'Contacts','query':util[_0xad23('0x1e')](_0xad23('0x30'),_0x461e7f),'order_by':'','offset':'0','select_fields':['id','name',_0xad23('0x31')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xad23('0x28')](function(_0x215736){if(_0x215736[_0xad23('0x29')][_0xad23('0x16')]){var _0x27cc3f=_[_0xad23('0x2a')](_0x215736[_0xad23('0x29')],function(_0xe1998f){return _0xe1998f[_0xad23('0x2b')][_0xad23('0x31')][_0xad23('0x2c')]===_0x461e7f;});if(_0x27cc3f){logger['info'](_0xad23('0x32'));return BPromise[_0xad23('0x2d')]({'id':_0x27cc3f[_0xad23('0x2b')]['id'][_0xad23('0x2c')],'name':_0x27cc3f[_0xad23('0x2b')][_0xad23('0xc')]['value'],'phone':_0x27cc3f[_0xad23('0x2b')][_0xad23('0x31')][_0xad23('0x2c')]});}}else{logger[_0xad23('0x22')](_0xad23('0x33'));return request({'form':{'method':'set_entry','input_type':_0xad23('0x1b'),'response_type':_0xad23('0x1b'),'rest_data':JSON[_0xad23('0x1c')]({'session':_0x1220fb['id'],'module_name':'Contacts','name_value_list':[{'name':_0xad23('0x34'),'value':_0x31b18a!==_0xad23('0x35')?_0x31b18a:util[_0xad23('0x1e')](_0xad23('0x36'),_0x461e7f)},{'name':_0xad23('0x31'),'value':_0x461e7f}]})}})[_0xad23('0x28')](function(_0x244409){logger[_0xad23('0x22')]('Enduser\x20created.');return BPromise[_0xad23('0x2d')]({'id':_0x244409['id'],'name':_0x244409['entry_list'][_0xad23('0x34')][_0xad23('0x2c')],'phone':_0x244409[_0xad23('0x29')][_0xad23('0x31')][_0xad23('0x2c')]});});}});}function request(_0x26c5c1){logger[_0xad23('0x37')](_0xad23('0x38'),JSON[_0xad23('0x1c')](_0x26c5c1));return rp(_['merge'](def,_0x26c5c1));}function getTags(_0x100593,_0x4e3368){var _0x275a5d=[];if(_0x100593&&_0x100593[_0xad23('0x16')]>0x0){_0x275a5d=_[_0xad23('0x39')](_0x100593,_0x4e3368);}return _0x275a5d;}function getCustomFields(_0x264f73,_0x516af4){var _0x29b529=[];var _0x33bd92={'custom_fields':[]};if(_0x264f73[_0xad23('0x16')]>0x0){_[_0xad23('0x17')](_0x264f73,function(_0x375dba){if(_0x375dba[_0xad23('0x3a')]===_0xad23('0x3b')&&_0x375dba[_0xad23('0x3c')]&&!_0x375dba[_0xad23('0x3d')]){_0x33bd92[_0x375dba[_0xad23('0x3c')][_0xad23('0x3e')]()]=_0x375dba[_0xad23('0x3f')][_0xad23('0x20')]();}else if(_0x375dba[_0xad23('0x3a')]===_0xad23('0x3b')&&_0x375dba[_0xad23('0x1a')]&&_0x375dba['customField']){_0x33bd92['custom_fields']['push']({'id':_0x375dba['idField'],'value':_0x375dba['content'][_0xad23('0x20')]()});}else if(_0x375dba['type']===_0xad23('0x40')&&_0x375dba[_0xad23('0x18')]&&_0x375dba[_0xad23('0x1a')]&&_0x375dba[_0xad23('0x3d')]){_0x516af4[_0x375dba['variableName']]&&_0x33bd92[_0xad23('0x41')][_0xad23('0x19')]({'id':_0x375dba[_0xad23('0x1a')],'value':_0x516af4[_0x375dba[_0xad23('0x18')]][_0xad23('0x20')]()});}else if(_0x375dba[_0xad23('0x3a')]==='customVariable'&&_0x375dba['Variable']&&_0x375dba[_0xad23('0x42')][_0xad23('0xc')]&&_0x375dba[_0xad23('0x1a')]&&_0x375dba[_0xad23('0x3d')]){_0x516af4[_0x375dba[_0xad23('0x42')][_0xad23('0xc')][_0xad23('0x3e')]()]&&_0x33bd92[_0xad23('0x41')][_0xad23('0x19')]({'id':_0x375dba[_0xad23('0x1a')],'value':_0x516af4[_0x375dba[_0xad23('0x42')][_0xad23('0xc')]['toLowerCase']()][_0xad23('0x20')]()});}});}return _0x33bd92;}function getConnection(_0x3fe969){return request({'method':'POST','form':{'method':_0xad23('0x43'),'input_type':_0xad23('0x1b'),'response_type':_0xad23('0x1b'),'rest_data':JSON[_0xad23('0x1c')]({'user_auth':{'user_name':_0x3fe969[_0xad23('0x44')],'password':_0x3fe969[_0xad23('0x45')],'encryption':'PLAIN'},'application':_0xad23('0x46')})}})[_0xad23('0x28')](function(_0x338384){var _0x164a5b=_0x338384;if(_0x164a5b['id']){def[_0xad23('0x47')]=_0x164a5b['id'];return BPromise[_0xad23('0x2d')](_0x164a5b);}else{throw new Error(util[_0xad23('0x1e')](_0xad23('0x48'),_0x3fe969['id']));}});}function setRelationship(_0x12f5b2,_0x1586e9,_0x2f2fd2,_0xcba292){return request({'form':{'method':'set_relationship','input_type':_0xad23('0x1b'),'response_type':'JSON','rest_data':JSON[_0xad23('0x1c')]({'session':_0x12f5b2['id'],'module_name':'Calls','module_id':_0x2f2fd2['id'],'link_field_name':_0xcba292,'related_ids':[_0x1586e9['id']]})}});}exports[_0xad23('0x49')]=function(_0x5914c3,_0xb8238a,_0x5ebb9b,_0x1935ff,_0xa8ad19,_0xb1fd03){var _0x538e67,_0x318104,_0x35110c,_0x455d6d;_0xb1fd03[_0xad23('0x4a')]=intUtil['stripTrailingSlash'](_0xb1fd03[_0xad23('0x4a')]);_0xb1fd03[_0xad23('0x4b')]=intUtil['stripTrailingSlash'](_0xb1fd03[_0xad23('0x4b')]);def[_0xad23('0x4c')]=util['format'](_0xad23('0x4d'),_0xb1fd03['remoteUri']);if(_0xa8ad19&&_0xa8ad19[_0xad23('0x4e')]){logger[_0xad23('0x22')](_0xad23('0x4f'),_0xad23('0x50'));_0xb8238a[_0xad23('0x51')]=util[_0xad23('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xb1fd03[_0xad23('0x4b')],_0xb8238a[_0xad23('0x52')],md5(_0xb8238a['uniqueid']));}else{_0xb8238a[_0xad23('0x51')]='';}return getConnection(_0xb1fd03)[_0xad23('0x28')](function(_0x3c1703){_0x455d6d=_0x3c1703;return getUser(_0xb1fd03,_0x1935ff[_0xad23('0xc')],_0x455d6d);})[_0xad23('0x28')](function(_0x25d90f){_0x538e67=_0x25d90f;logger[_0xad23('0x22')](_0xad23('0x53'),_0x538e67['id']);return getEndUser(_0xb1fd03,_0xb8238a[_0xad23('0x54')],_0xb8238a[_0xad23('0x55')],_0x455d6d);})[_0xad23('0x28')](function(_0x30e363){_0x318104=_0x30e363;logger[_0xad23('0x22')](_0xad23('0x56'),_0x318104['id']);return getTicket(_0xb1fd03,_0x538e67,_0x318104,_0x5ebb9b,_0xb8238a,_0x5ebb9b[_0xad23('0x57')],_0x455d6d,_0xad23('0x58'));})['then'](function(_0x31f665){_0x35110c=_0x31f665;logger[_0xad23('0x22')](_0xad23('0x59'));logger[_0xad23('0x22')](_0xad23('0x5a'),_0x35110c['id']);return setRelationship(_0x455d6d,_0x538e67,_0x35110c,_0xad23('0x5b'));})['then'](function(){return setRelationship(_0x455d6d,_0x318104,_0x35110c,_0xad23('0x5c'));})[_0xad23('0x28')](function(){return getServerInfo(_0x455d6d);})[_0xad23('0x28')](function(_0x50002f){var _0x73fc4=parseInt(_0x50002f['version'][_0xad23('0x5d')](0x0));var _0xa6bfe=util['format'](_0xad23('0x5e'),_0xb1fd03['remoteUri'],_0x35110c['id']);if(_0x73fc4>0x6){_0xa6bfe=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0xb1fd03[_0xad23('0x4a')],_0x35110c['id']);}logger['info'](_0xad23('0x4f'),_0xad23('0x5f'));emit(util[_0xad23('0x1e')](_0xad23('0x60'),_0x1935ff[_0xad23('0xc')]),'trigger:browser:url',{'uri':_0xa6bfe});})['catch'](function(_0x1c5aaf){logger[_0xad23('0x61')]('[QUEUE]',JSON[_0xad23('0x1c')](_0x1c5aaf));});};exports[_0xad23('0x62')]=function(_0x159ee2,_0x294022,_0x52d7b6,_0x3541b6,_0x47bd1b,_0x3f1623,_0x20bd34){var _0x2e0d96,_0x1ab2c2,_0x61983b,_0x3edb6e;_0x3f1623['remoteUri']=intUtil[_0xad23('0x63')](_0x3f1623['remoteUri']);_0x3f1623[_0xad23('0x4b')]=intUtil[_0xad23('0x63')](_0x3f1623['serverUrl']);def[_0xad23('0x4c')]=util[_0xad23('0x1e')]('%s/service/v4_1/rest.php',_0x3f1623[_0xad23('0x4a')]);if(_0x20bd34&&_0x20bd34['recordingFormat']&&_0x20bd34[_0xad23('0x64')]!==_0xad23('0x65')){logger[_0xad23('0x22')]('[OUTBOUND]',_0xad23('0x50'));_0x294022['recordingURL']=util[_0xad23('0x1e')](_0xad23('0x66'),_0x3f1623[_0xad23('0x4b')],_0x294022[_0xad23('0x52')],md5(_0x294022[_0xad23('0x52')]));}return getConnection(_0x3f1623)['then'](function(_0x4bf247){_0x3edb6e=_0x4bf247;return getUser(_0x3f1623,_0x3541b6[_0xad23('0xc')],_0x3edb6e);})[_0xad23('0x28')](function(_0x38c39c){_0x2e0d96=_0x38c39c;logger[_0xad23('0x22')](_0xad23('0x53'),_0x2e0d96['id']);return getEndUser(_0x3f1623,_0x294022[_0xad23('0x67')],_0x294022[_0xad23('0x68')],_0x3edb6e);})['then'](function(_0x280261){_0x1ab2c2=_0x280261;logger[_0xad23('0x22')](_0xad23('0x56'),_0x1ab2c2['id']);return getTicket(_0x3f1623,_0x2e0d96,_0x1ab2c2,_0x52d7b6,_0x294022,_0x52d7b6[_0xad23('0x57')],_0x3edb6e,_0xad23('0x69'));})[_0xad23('0x28')](function(_0x31c452){_0x61983b=_0x31c452;logger['info'](_0xad23('0x59'));logger['info'](_0xad23('0x5a'),_0x61983b['id']);return setRelationship(_0x3edb6e,_0x2e0d96,_0x61983b,'users');})[_0xad23('0x28')](function(){return setRelationship(_0x3edb6e,_0x1ab2c2,_0x61983b,_0xad23('0x5c'));})['then'](function(){return getServerInfo(_0x3edb6e);})[_0xad23('0x28')](function(_0xccf803){var _0x1f60c9=parseInt(_0xccf803['version'][_0xad23('0x5d')](0x0));var _0x3597ea=util[_0xad23('0x1e')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x3f1623[_0xad23('0x4a')],_0x61983b['id']);if(_0x1f60c9>0x6){_0x3597ea=util['format'](_0xad23('0x6a'),_0x3f1623[_0xad23('0x4a')],_0x61983b['id']);}logger['info'](_0xad23('0x6b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xad23('0x1e')](_0xad23('0x60'),_0x3541b6[_0xad23('0xc')]),_0xad23('0x6c'),{'uri':_0x3597ea});})[_0xad23('0x6d')](function(_0x20a8b0){logger[_0xad23('0x61')](_0xad23('0x6b'),JSON[_0xad23('0x1c')](_0x20a8b0));});};exports[_0xad23('0x6e')]=function(_0x2a4c9a,_0x41f9eb,_0xed9110,_0x258643,_0x11d0be,_0x36ef2b){var _0xe559e1,_0x72b543,_0x441700,_0x1af0cb;_0x36ef2b['remoteUri']=intUtil[_0xad23('0x63')](_0x36ef2b[_0xad23('0x4a')]);_0x36ef2b['serverUrl']=intUtil['stripTrailingSlash'](_0x36ef2b[_0xad23('0x4b')]);def[_0xad23('0x4c')]=util['format']('%s/service/v4_1/rest.php',_0x36ef2b[_0xad23('0x4a')]);if(_0x11d0be&&_0x11d0be[_0xad23('0x4e')]){logger['info'](_0xad23('0x6f'),_0xad23('0x50'));_0x41f9eb[_0xad23('0x51')]=util[_0xad23('0x1e')](_0xad23('0x66'),_0x36ef2b[_0xad23('0x4b')],_0x41f9eb[_0xad23('0x52')],md5(_0x41f9eb[_0xad23('0x52')]));}else{_0x41f9eb[_0xad23('0x51')]='';}return getConnection(_0x36ef2b)['then'](function(_0x1a3f0d){_0x1af0cb=_0x1a3f0d;return getUser(_0x36ef2b,_0x258643[_0xad23('0xc')],_0x1af0cb);})['then'](function(_0x22027e){_0xe559e1=_0x22027e;logger[_0xad23('0x22')](_0xad23('0x53'),_0xe559e1['id']);return getEndUser(_0x36ef2b,_0x41f9eb[_0xad23('0x54')],_0x41f9eb[_0xad23('0x55')],_0x1af0cb);})['then'](function(_0x5d172f){_0x72b543=_0x5d172f;logger['info'](_0xad23('0x56'),_0x72b543['id']);return getTicket(_0x36ef2b,_0xe559e1,_0x72b543,_0xed9110,_0x41f9eb,_0xed9110[_0xad23('0x57')],_0x1af0cb,_0xad23('0x58'));})['then'](function(_0x46cda0){_0x441700=_0x46cda0;logger[_0xad23('0x22')]('Ticket\x20created!');logger[_0xad23('0x22')](_0xad23('0x5a'),_0x441700['id']);return setRelationship(_0x1af0cb,_0xe559e1,_0x441700,'users');})[_0xad23('0x28')](function(){return setRelationship(_0x1af0cb,_0x72b543,_0x441700,_0xad23('0x5c'));})[_0xad23('0x28')](function(){return getServerInfo(_0x1af0cb);})['catch'](function(_0x11182c){logger[_0xad23('0x61')](_0xad23('0x6f'),JSON['stringify'](_0x11182c));});};
\ No newline at end of file
index a314e1c..49cd0f0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x47b4=['toString','customVariable','Variable','name','toLowerCase','key','format','%s:\x20%s','keyType','join','stripTrailingSlash','substr','validateEmail','test','lodash','length','sortBy','string','push','content','type','variable','variableName'];(function(_0x4ec3de,_0x1c67c4){var _0x37478a=function(_0x5afbd3){while(--_0x5afbd3){_0x4ec3de['push'](_0x4ec3de['shift']());}};_0x37478a(++_0x1c67c4);}(_0x47b4,0x1c3));var _0x447b=function(_0xf5e3ca,_0x46d54a){_0xf5e3ca=_0xf5e3ca-0x0;var _0xcb667=_0x47b4[_0xf5e3ca];return _0xcb667;};'use strict';var _=require(_0x447b('0x0'));var util=require('util');exports['getString']=function(_0x23bce5,_0x2e4d97,_0x52cbe8){var _0x26939b=[];if(_0x23bce5[_0x447b('0x1')]>0x0){var _0x3a20c5=_[_0x447b('0x2')](_0x23bce5,['id']);for(var _0x1c3783=0x0;_0x1c3783<_0x3a20c5[_0x447b('0x1')];_0x1c3783++){var _0x30ca4c=_0x3a20c5[_0x1c3783];if(_0x30ca4c['type']===_0x447b('0x3')){_0x26939b[_0x447b('0x4')](_0x30ca4c[_0x447b('0x5')]);}else if(_0x30ca4c[_0x447b('0x6')]===_0x447b('0x7')&&_0x30ca4c[_0x447b('0x8')]){_0x2e4d97[_0x30ca4c[_0x447b('0x8')]]&&_0x26939b['push'](_0x2e4d97[_0x30ca4c[_0x447b('0x8')]][_0x447b('0x9')]());}else if(_0x30ca4c[_0x447b('0x6')]===_0x447b('0xa')&&_0x30ca4c['Variable']&&_0x30ca4c[_0x447b('0xb')][_0x447b('0xc')]){_0x2e4d97[_0x30ca4c['Variable'][_0x447b('0xc')][_0x447b('0xd')]()]&&_0x26939b[_0x447b('0x4')](_0x2e4d97[_0x30ca4c['Variable']['name'][_0x447b('0xd')]()][_0x447b('0x9')]());}else if(_0x30ca4c[_0x447b('0x6')]==='keyValue'){if(_0x30ca4c['keyType']===_0x447b('0x3')&&_0x30ca4c[_0x447b('0xe')]){_0x26939b['push'](util[_0x447b('0xf')](_0x447b('0x10'),_0x30ca4c['key'],_0x30ca4c['keyContent']));}else if(_0x30ca4c[_0x447b('0x11')]===_0x447b('0x7')&&_0x30ca4c['variableName']&&_0x30ca4c[_0x447b('0xe')]){_0x2e4d97[_0x30ca4c['variableName']]&&_0x26939b[_0x447b('0x4')](util['format'](_0x447b('0x10'),_0x30ca4c[_0x447b('0xe')],_0x2e4d97[_0x30ca4c[_0x447b('0x8')]]));}else if(_0x30ca4c['keyType']===_0x447b('0xa')&&_0x30ca4c[_0x447b('0xb')]&&_0x30ca4c['Variable'][_0x447b('0xc')]&&_0x30ca4c[_0x447b('0xe')]){_0x2e4d97[_0x30ca4c[_0x447b('0xb')]['name'][_0x447b('0xd')]()]&&_0x26939b[_0x447b('0x4')](util['format'](_0x447b('0x10'),_0x30ca4c[_0x447b('0xe')],_0x2e4d97[_0x30ca4c['Variable'][_0x447b('0xc')][_0x447b('0xd')]()]));}}}}return _0x26939b[_0x447b('0x12')](_0x52cbe8);};exports[_0x447b('0x13')]=function(_0x4b3db9){if(_0x4b3db9&&_0x4b3db9['substr'](-0x1)==='/'){return _0x4b3db9[_0x447b('0x14')](0x0,_0x4b3db9[_0x447b('0x1')]-0x1);}return _0x4b3db9;};exports[_0x447b('0x15')]=function(_0x1cd064){if(_0x1cd064&&_0x1cd064!==''){var _0x40f1f0=/^(([^<>()\[\]\\.,;:\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 _0x40f1f0[_0x447b('0x16')](String(_0x1cd064)[_0x447b('0xd')]());}else{return![];}};
\ No newline at end of file
+var _0x491d=['sortBy','string','content','type','variable','variableName','push','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','keyContent','format','%s:\x20%s','join','stripTrailingSlash','substr','validateEmail','test','lodash','getString','length'];(function(_0x2e28f7,_0x2a5536){var _0x425268=function(_0x37bc6a){while(--_0x37bc6a){_0x2e28f7['push'](_0x2e28f7['shift']());}};_0x425268(++_0x2a5536);}(_0x491d,0x19d));var _0xd491=function(_0x35c819,_0x13ec30){_0x35c819=_0x35c819-0x0;var _0x209b3d=_0x491d[_0x35c819];return _0x209b3d;};'use strict';var _=require(_0xd491('0x0'));var util=require('util');exports[_0xd491('0x1')]=function(_0x5a06a2,_0x4465d9,_0x1aff91){var _0x1a976c=[];if(_0x5a06a2[_0xd491('0x2')]>0x0){var _0xc82f9f=_[_0xd491('0x3')](_0x5a06a2,['id']);for(var _0xd440dc=0x0;_0xd440dc<_0xc82f9f[_0xd491('0x2')];_0xd440dc++){var _0x21a55c=_0xc82f9f[_0xd440dc];if(_0x21a55c['type']===_0xd491('0x4')){_0x1a976c['push'](_0x21a55c[_0xd491('0x5')]);}else if(_0x21a55c[_0xd491('0x6')]===_0xd491('0x7')&&_0x21a55c[_0xd491('0x8')]){_0x4465d9[_0x21a55c[_0xd491('0x8')]]&&_0x1a976c[_0xd491('0x9')](_0x4465d9[_0x21a55c[_0xd491('0x8')]][_0xd491('0xa')]());}else if(_0x21a55c[_0xd491('0x6')]===_0xd491('0xb')&&_0x21a55c[_0xd491('0xc')]&&_0x21a55c[_0xd491('0xc')][_0xd491('0xd')]){_0x4465d9[_0x21a55c[_0xd491('0xc')][_0xd491('0xd')][_0xd491('0xe')]()]&&_0x1a976c[_0xd491('0x9')](_0x4465d9[_0x21a55c[_0xd491('0xc')]['name'][_0xd491('0xe')]()][_0xd491('0xa')]());}else if(_0x21a55c[_0xd491('0x6')]===_0xd491('0xf')){if(_0x21a55c[_0xd491('0x10')]===_0xd491('0x4')&&_0x21a55c[_0xd491('0x11')]){_0x1a976c[_0xd491('0x9')](util['format']('%s:\x20%s',_0x21a55c[_0xd491('0x11')],_0x21a55c[_0xd491('0x12')]));}else if(_0x21a55c[_0xd491('0x10')]===_0xd491('0x7')&&_0x21a55c[_0xd491('0x8')]&&_0x21a55c[_0xd491('0x11')]){_0x4465d9[_0x21a55c[_0xd491('0x8')]]&&_0x1a976c[_0xd491('0x9')](util[_0xd491('0x13')](_0xd491('0x14'),_0x21a55c['key'],_0x4465d9[_0x21a55c[_0xd491('0x8')]]));}else if(_0x21a55c['keyType']===_0xd491('0xb')&&_0x21a55c[_0xd491('0xc')]&&_0x21a55c[_0xd491('0xc')][_0xd491('0xd')]&&_0x21a55c[_0xd491('0x11')]){_0x4465d9[_0x21a55c[_0xd491('0xc')][_0xd491('0xd')]['toLowerCase']()]&&_0x1a976c[_0xd491('0x9')](util[_0xd491('0x13')](_0xd491('0x14'),_0x21a55c[_0xd491('0x11')],_0x4465d9[_0x21a55c[_0xd491('0xc')]['name'][_0xd491('0xe')]()]));}}}}return _0x1a976c[_0xd491('0x15')](_0x1aff91);};exports[_0xd491('0x16')]=function(_0x2e8911){if(_0x2e8911&&_0x2e8911['substr'](-0x1)==='/'){return _0x2e8911[_0xd491('0x17')](0x0,_0x2e8911['length']-0x1);}return _0x2e8911;};exports[_0xd491('0x18')]=function(_0x68b286){if(_0x68b286&&_0x68b286!==''){var _0x58299c=/^(([^<>()\[\]\\.,;:\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 _0x58299c[_0xd491('0x19')](String(_0x68b286)['toLowerCase']());}else{return![];}};
\ No newline at end of file
index 6d3ae33..065e5bd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['forEach','type','toString','variable','variableName','idField','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','Descriptions','format','%s/webservice.php','remoteUri','create','sessionName','HelpDesk','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','createTicket','validateEmail','Getting\x20agent\x20with\x20email','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','username','admin','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','getUser','Searching\x20end\x20user\x20with\x20phone','GET','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;','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Contacts','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','monitor_format','Recording\x20is\x20enabled!','serverUrl','uniqueid','calleridname','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','The\x20User\x20ID\x20is:','destcalleridnum','The\x20Enduser\x20ID\x20is:','Fields','abandoned','[ABANDONED]','recordingURL','calleridnum','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length'];(function(_0x138f9e,_0x15c649){var _0x253d4c=function(_0x1c69e8){while(--_0x1c69e8){_0x138f9e['push'](_0x138f9e['shift']());}};_0x253d4c(++_0x15c649);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_0xfeb75b[_0x0a9e('0xd')]==='string'&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b['idField']]=_0xfeb75b['content'][_0x0a9e('0xe')]();}else if(_0xfeb75b[_0x0a9e('0xd')]===_0x0a9e('0xf')&&_0xfeb75b[_0x0a9e('0x10')]&&_0xfeb75b[_0x0a9e('0x11')]&&_0x39753a[_0xfeb75b[_0x0a9e('0x10')]]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x10')]][_0x0a9e('0xe')]();}else if(_0xfeb75b[_0x0a9e('0xd')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b[_0x0a9e('0x13')]['name']&&_0xfeb75b[_0x0a9e('0x11')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x14')]['toLowerCase']()]){_0xf81284[_0xfeb75b[_0x0a9e('0x11')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]['name'][_0x0a9e('0x15')]()]['toString']();}});}return _0xf81284;}function createTicket(_0x459eb1,_0x478723,_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7){logger[_0x0a9e('0x16')](_0x0a9e('0x17'));var _0x112016=_[_0x0a9e('0x18')]({'parent_id':'','assigned_user_id':_0x478723['id'],'ticketpriorities':_0x0a9e('0x19'),'ticketstatus':'Open','ticket_title':intUtil[_0x0a9e('0x1a')](_0x205fd6[_0x0a9e('0x1b')],_0x31b1ca,'\x20'),'description':intUtil['getString'](_0x205fd6[_0x0a9e('0x1c')],_0x31b1ca,'\x0a'),'contact_id':_0x106033['id']},getCustomFields(_0x2eb11f,_0x31b1ca));var _0x5a09ef={'method':'POST','uri':util[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1[_0x0a9e('0x1f')]),'form':{'operation':_0x0a9e('0x20'),'username':'admin','sessionName':_0x530eb7[_0x0a9e('0x21')],'elementType':_0x0a9e('0x22'),'element':JSON[_0x0a9e('0x23')](_0x112016)},'json':!![]};return request(_0x5a09ef)[_0x0a9e('0x24')](function(_0x370d86){if(_0x370d86[_0x0a9e('0x25')]){return BPromise[_0x0a9e('0x26')]({'id':_0x370d86['result']['id']});}else{throw new Error(util['format'](_0x0a9e('0x27'),JSON[_0x0a9e('0x23')](_0x370d86[_0x0a9e('0x28')])));}})[_0x0a9e('0x29')](function(_0x526cf3){var _0x384319=_0x526cf3['statusCode']||0x1f4;logger[_0x0a9e('0x28')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x2a'),_0x384319,JSON[_0x0a9e('0x23')](_0x526cf3));});}function getUser(_0x25fba9,_0x14433c,_0x140511){if(intUtil[_0x0a9e('0x2b')](_0x14433c)===!![]){logger[_0x0a9e('0x16')](_0x0a9e('0x2c'),_0x14433c);return request({'method':'GET','uri':util[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x25fba9[_0x0a9e('0x1f')]),'qs':{'operation':_0x0a9e('0x2d'),'username':'admin','sessionName':_0x140511[_0x0a9e('0x21')],'query':util[_0x0a9e('0x1d')](_0x0a9e('0x2e'),_0x14433c)},'json':!![]})[_0x0a9e('0x24')](function(_0x58b06f){if(_0x58b06f[_0x0a9e('0x25')]&&_0x58b06f[_0x0a9e('0x2f')][_0x0a9e('0xb')]){logger[_0x0a9e('0x16')]('Agent\x20found!');return BPromise[_0x0a9e('0x26')]({'id':_0x58b06f['result'][0x0]['id'],'email':_0x58b06f[_0x0a9e('0x2f')][0x0][_0x0a9e('0x30')],'name':_0x58b06f[_0x0a9e('0x2f')][0x0][_0x0a9e('0x31')]+'\x20'+_0x58b06f[_0x0a9e('0x2f')]['last_name']});}else{logger[_0x0a9e('0x16')](_0x0a9e('0x32'));return BPromise[_0x0a9e('0x26')]({'id':_0x140511[_0x0a9e('0x33')],'email':_0x25fba9[_0x0a9e('0x34')],'name':_0x0a9e('0x35')});}})[_0x0a9e('0x29')](function(_0x39e565){var _0x5583a4=_0x39e565[_0x0a9e('0x36')]||0x1f4;logger['error'](_0x0a9e('0x37'),_0x0a9e('0x38'),_0x5583a4,JSON[_0x0a9e('0x23')](_0x39e565));});}else{logger[_0x0a9e('0x16')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x0a9e('0x26')]({'id':_0x140511[_0x0a9e('0x33')],'email':_0x25fba9[_0x0a9e('0x34')],'name':_0x0a9e('0x35')})['catch'](function(_0x54135e){var _0x1e8694=_0x54135e['statusCode']||0x1f4;logger[_0x0a9e('0x28')](_0x0a9e('0x37'),_0x0a9e('0x38'),_0x1e8694,JSON[_0x0a9e('0x23')](_0x54135e));});}}function getEndUser(_0x4f41ae,_0x31916f,_0x3bfce8,_0x3cae){logger['info'](_0x0a9e('0x39'),_0x3bfce8);return request({'method':_0x0a9e('0x3a'),'uri':util[_0x0a9e('0x1d')]('%s/webservice.php',_0x4f41ae['remoteUri']),'qs':{'operation':_0x0a9e('0x2d'),'username':_0x0a9e('0x35'),'sessionName':_0x3cae['sessionName'],'query':util[_0x0a9e('0x1d')](_0x0a9e('0x3b'),_0x3bfce8,_0x3bfce8,_0x3bfce8,_0x3bfce8,_0x3bfce8)},'json':!![]})[_0x0a9e('0x24')](function(_0x148f55){if(_0x148f55['success']&&_0x148f55['result'][_0x0a9e('0xb')]){logger[_0x0a9e('0x16')]('Enduser\x20found!');return BPromise[_0x0a9e('0x26')]({'id':_0x148f55[_0x0a9e('0x2f')][0x0]['id'],'name':_0x148f55[_0x0a9e('0x2f')][0x0]['firstname']+'\x20'+_0x148f55[_0x0a9e('0x2f')][0x0][_0x0a9e('0x3c')],'phone':_0x3bfce8});}else{logger[_0x0a9e('0x16')](_0x0a9e('0x3d'));return request({'method':_0x0a9e('0x3e'),'uri':util[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x4f41ae[_0x0a9e('0x1f')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x3cae[_0x0a9e('0x21')],'elementType':_0x0a9e('0x3f'),'element':JSON[_0x0a9e('0x23')]({'lastname':_0x31916f,'phone':_0x3bfce8,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x24')](function(_0x11ca30){logger[_0x0a9e('0x16')]('Enduser\x20created.');return BPromise['resolve']({'id':_0x11ca30[_0x0a9e('0x2f')]['id'],'name':_0x11ca30[_0x0a9e('0x2f')][_0x0a9e('0x3c')],'phone':_0x11ca30[_0x0a9e('0x2f')][_0x0a9e('0x40')]});})[_0x0a9e('0x29')](function(_0x10b040){var _0x445e25=_0x10b040[_0x0a9e('0x36')]||0x1f4;logger[_0x0a9e('0x28')](_0x0a9e('0x37'),_0x0a9e('0x41'),_0x445e25,JSON['stringify'](_0x10b040));});}});}function getConnection(_0x117c99){var _0x138b8b=_0x117c99[_0x0a9e('0x34')];var _0xfbd5ad=_0x117c99[_0x0a9e('0x42')];return request({'method':_0x0a9e('0x3a'),'uri':util[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x117c99['remoteUri']),'qs':{'operation':_0x0a9e('0x43'),'username':_0x138b8b},'json':!![]})['then'](function(_0x473dc8){if(_0x473dc8[_0x0a9e('0x25')]){return request({'method':_0x0a9e('0x3e'),'uri':util['format'](_0x0a9e('0x1e'),_0x117c99[_0x0a9e('0x1f')]),'form':{'operation':_0x0a9e('0x44'),'username':_0x0a9e('0x35'),'accessKey':md5(_0x473dc8[_0x0a9e('0x2f')][_0x0a9e('0x45')]+_0xfbd5ad)},'json':!![]});}})[_0x0a9e('0x24')](function(_0x5bbcde){if(_0x5bbcde[_0x0a9e('0x25')]){return BPromise[_0x0a9e('0x26')](_0x5bbcde[_0x0a9e('0x2f')]);}else{throw new Error(util[_0x0a9e('0x1d')](_0x0a9e('0x46'),_0x117c99['id']));}})[_0x0a9e('0x29')](function(_0x6054ee){var _0x19383e=_0x6054ee[_0x0a9e('0x36')]||0x1f4;logger['error'](_0x0a9e('0x37'),_0x0a9e('0x47'),_0x19383e,JSON['stringify'](_0x6054ee));});}function request(_0x4ae14b){logger['info'](_0x0a9e('0x48'),JSON[_0x0a9e('0x23')](_0x4ae14b));return rp(_0x4ae14b);}exports[_0x0a9e('0x49')]=function(_0x11545a,_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae){var _0x4b1b9f,_0x53975a,_0x39d77d,_0x204173;_0x5d38ae[_0x0a9e('0x1f')]=intUtil['stripTrailingSlash'](_0x5d38ae[_0x0a9e('0x1f')]);if(_0x375c18&&_0x375c18[_0x0a9e('0x4a')]){logger['info']('[QUEUE]',_0x0a9e('0x4b'));_0x61bb17['recordingURL']=util[_0x0a9e('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5d38ae[_0x0a9e('0x4c')],_0x61bb17[_0x0a9e('0x4d')],md5(_0x61bb17[_0x0a9e('0x4d')]));}else{_0x61bb17['recordingURL']='';}return getConnection(_0x5d38ae)[_0x0a9e('0x24')](function(_0x1bf38a){_0x204173=_0x1bf38a;return getUser(_0x5d38ae,_0x2e5165?_0x2e5165['email']:'',_0x204173);})['then'](function(_0x128aa6){_0x4b1b9f=_0x128aa6;logger[_0x0a9e('0x16')]('The\x20User\x20ID\x20is:',_0x4b1b9f['id']);return getEndUser(_0x5d38ae,_0x61bb17[_0x0a9e('0x4e')],_0x61bb17['calleridnum'],_0x204173);})[_0x0a9e('0x24')](function(_0x523cd2){_0x53975a=_0x523cd2;logger[_0x0a9e('0x16')]('The\x20Enduser\x20ID\x20is:',_0x53975a['id']);return createTicket(_0x5d38ae,_0x4b1b9f,_0x53975a,_0x30decb,_0x61bb17,_0x30decb['Fields'],_0x204173);})['then'](function(_0x2da03c){_0x39d77d=_0x2da03c;logger['info'](_0x0a9e('0x4f'));logger[_0x0a9e('0x16')](_0x0a9e('0x50'),_0x39d77d['id']);var _0x19b4df=util[_0x0a9e('0x1d')](_0x0a9e('0x51'),_0x5d38ae[_0x0a9e('0x1f')],_[_0x0a9e('0x52')](_0x39d77d['id'],'x')[0x1]);logger['info'](_0x0a9e('0x53'),_0x0a9e('0x54'));emit(util[_0x0a9e('0x1d')](_0x0a9e('0x55'),_0x2e5165[_0x0a9e('0x14')]),_0x0a9e('0x56'),{'uri':_0x19b4df});})['catch'](function(_0x956fbe){logger[_0x0a9e('0x28')]('[QUEUE]',JSON[_0x0a9e('0x23')](_0x956fbe));});};exports['outbound']=function(_0x20c668,_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6){var _0x1fc70e,_0x261adb,_0x7be420,_0x1cca9f;_0x49d231[_0x0a9e('0x1f')]=intUtil['stripTrailingSlash'](_0x49d231[_0x0a9e('0x1f')]);_0x49d231['serverUrl']=intUtil[_0x0a9e('0x57')](_0x49d231[_0x0a9e('0x4c')]);if(_0x2244d6&&_0x2244d6[_0x0a9e('0x58')]&&_0x2244d6['recordingFormat']!==_0x0a9e('0x59')){logger[_0x0a9e('0x16')](_0x0a9e('0x5a'),_0x0a9e('0x4b'));_0x5ba1f9['recordingURL']=util[_0x0a9e('0x1d')](_0x0a9e('0x5b'),_0x49d231['serverUrl'],_0x5ba1f9[_0x0a9e('0x4d')],md5(_0x5ba1f9[_0x0a9e('0x4d')]));}return getConnection(_0x49d231)[_0x0a9e('0x24')](function(_0x409b29){_0x1cca9f=_0x409b29;return getUser(_0x49d231,_0x5674ee?_0x5674ee[_0x0a9e('0x5c')]:'',_0x1cca9f);})['then'](function(_0x176840){_0x1fc70e=_0x176840;logger[_0x0a9e('0x16')](_0x0a9e('0x5d'),_0x1fc70e['id']);return getEndUser(_0x49d231,_0x5ba1f9['destcalleridname'],_0x5ba1f9[_0x0a9e('0x5e')],_0x1cca9f);})['then'](function(_0x5211e3){_0x261adb=_0x5211e3;logger[_0x0a9e('0x16')](_0x0a9e('0x5f'),_0x261adb['id']);return createTicket(_0x49d231,_0x1fc70e,_0x261adb,_0x4b3c1a,_0x5ba1f9,_0x4b3c1a[_0x0a9e('0x60')],_0x1cca9f);})[_0x0a9e('0x24')](function(_0x186f39){_0x7be420=_0x186f39;logger[_0x0a9e('0x16')](_0x0a9e('0x4f'));logger[_0x0a9e('0x16')](_0x0a9e('0x50'),_0x7be420['id']);var _0x1cc4f3=util[_0x0a9e('0x1d')](_0x0a9e('0x51'),_0x49d231[_0x0a9e('0x1f')],_[_0x0a9e('0x52')](_0x7be420['id'],'x')[0x1]);logger[_0x0a9e('0x16')](_0x0a9e('0x5a'),_0x0a9e('0x54'));emit(util[_0x0a9e('0x1d')]('user:%s',_0x5674ee[_0x0a9e('0x14')]),_0x0a9e('0x56'),{'uri':_0x1cc4f3});})[_0x0a9e('0x29')](function(_0x4edbb0){logger[_0x0a9e('0x28')](_0x0a9e('0x5a'),JSON['stringify'](_0x4edbb0));});};exports[_0x0a9e('0x61')]=function(_0x56e31e,_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce){var _0x4a2438,_0x40fb85,_0x18bf5d,_0x1104ad;_0x50cdce[_0x0a9e('0x1f')]=intUtil[_0x0a9e('0x57')](_0x50cdce[_0x0a9e('0x1f')]);_0x50cdce[_0x0a9e('0x4c')]=intUtil[_0x0a9e('0x57')](_0x50cdce['serverUrl']);if(_0x4a43a8&&_0x4a43a8[_0x0a9e('0x4a')]){logger[_0x0a9e('0x16')](_0x0a9e('0x62'),'Recording\x20is\x20enabled!');_0x3ef315[_0x0a9e('0x63')]=util['format'](_0x0a9e('0x5b'),_0x50cdce[_0x0a9e('0x4c')],_0x3ef315['uniqueid'],md5(_0x3ef315[_0x0a9e('0x4d')]));}else{_0x3ef315[_0x0a9e('0x63')]='';}return getConnection(_0x50cdce)[_0x0a9e('0x24')](function(_0x317c0c){_0x1104ad=_0x317c0c;return getUser(_0x50cdce,_0x13b5c0?_0x13b5c0['email']:'',_0x1104ad);})[_0x0a9e('0x24')](function(_0x2e9552){_0x4a2438=_0x2e9552;logger[_0x0a9e('0x16')](_0x0a9e('0x5d'),_0x4a2438['id']);return getEndUser(_0x50cdce,_0x3ef315['calleridname'],_0x3ef315[_0x0a9e('0x64')],_0x1104ad);})[_0x0a9e('0x24')](function(_0x2d5506){_0x40fb85=_0x2d5506;logger[_0x0a9e('0x16')]('The\x20Enduser\x20ID\x20is:',_0x40fb85['id']);return createTicket(_0x50cdce,_0x4a2438,_0x40fb85,_0x427946,_0x3ef315,_0x427946[_0x0a9e('0x60')],_0x1104ad);})[_0x0a9e('0x24')](function(_0x30a4c7){_0x18bf5d=_0x30a4c7;logger[_0x0a9e('0x16')](_0x0a9e('0x4f'));logger[_0x0a9e('0x16')](_0x0a9e('0x50'),_0x18bf5d['id']);})[_0x0a9e('0x29')](function(_0x1a7b03){logger[_0x0a9e('0x28')](_0x0a9e('0x62'),JSON[_0x0a9e('0x23')](_0x1a7b03));});};
\ No newline at end of file
+var _0xe130=['variable','variableName','type','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Subjects','getString','POST','format','%s/webservice.php','create','admin','sessionName','HelpDesk','stringify','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','remoteUri','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','email1','last_name','username','statusCode','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','Searching\x20end\x20user\x20with\x20phone','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!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','lastname','phone','getEndUser','accessKey','getchallenge','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','serverUrl','uniqueid','recordingURL','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','abandoned','[ABANDONED]','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','vTiger','redis','defaults','socket.io-emitter','emit','length','forEach','idField','content','toString'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe130,0x127));var _0x0e13=function(_0x2a6e59,_0x34320f){_0x2a6e59=_0x2a6e59-0x0;var _0x2fd466=_0xe130[_0x2a6e59];return _0x2fd466;};'use strict';var _=require(_0x0e13('0x0'));var rp=require(_0x0e13('0x1'));var BPromise=require('bluebird');var md5=require(_0x0e13('0x2'));var util=require(_0x0e13('0x3'));var Redis=require(_0x0e13('0x4'));var intUtil=require(_0x0e13('0x5'));var config=require(_0x0e13('0x6'));var logger=require('../../../../config/logger')(_0x0e13('0x7'));config[_0x0e13('0x8')]=_[_0x0e13('0x9')](config[_0x0e13('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x0e13('0xa'))(new Redis(config['redis']));function emit(_0x567031,_0x5aaa22,_0x2faf49){io['to'](_0x567031)[_0x0e13('0xb')](_0x5aaa22,_0x2faf49);}function getCustomFields(_0x5189a7,_0x5d066a){var _0x2906e9={};if(_0x5189a7[_0x0e13('0xc')]>0x0){_[_0x0e13('0xd')](_0x5189a7,function(_0x2e385d){if(_0x2e385d['type']==='string'&&_0x2e385d[_0x0e13('0xe')]){_0x2906e9[_0x2e385d[_0x0e13('0xe')]]=_0x2e385d[_0x0e13('0xf')][_0x0e13('0x10')]();}else if(_0x2e385d['type']===_0x0e13('0x11')&&_0x2e385d['variableName']&&_0x2e385d[_0x0e13('0xe')]&&_0x5d066a[_0x2e385d[_0x0e13('0x12')]]){_0x2906e9[_0x2e385d[_0x0e13('0xe')]]=_0x5d066a[_0x2e385d[_0x0e13('0x12')]][_0x0e13('0x10')]();}else if(_0x2e385d[_0x0e13('0x13')]===_0x0e13('0x14')&&_0x2e385d[_0x0e13('0x15')]&&_0x2e385d[_0x0e13('0x15')]['name']&&_0x2e385d[_0x0e13('0xe')]&&_0x5d066a[_0x2e385d[_0x0e13('0x15')][_0x0e13('0x16')][_0x0e13('0x17')]()]){_0x2906e9[_0x2e385d[_0x0e13('0xe')]]=_0x5d066a[_0x2e385d[_0x0e13('0x15')]['name'][_0x0e13('0x17')]()][_0x0e13('0x10')]();}});}return _0x2906e9;}function createTicket(_0x510a2b,_0x487e2c,_0x3b85fd,_0x5001aa,_0x2063ca,_0x4e1ffa,_0x294aea){logger[_0x0e13('0x18')](_0x0e13('0x19'));var _0x408216=_[_0x0e13('0x1a')]({'parent_id':'','assigned_user_id':_0x487e2c['id'],'ticketpriorities':'Normal','ticketstatus':'Open','ticket_title':intUtil['getString'](_0x5001aa[_0x0e13('0x1b')],_0x2063ca,'\x20'),'description':intUtil[_0x0e13('0x1c')](_0x5001aa['Descriptions'],_0x2063ca,'\x0a'),'contact_id':_0x3b85fd['id']},getCustomFields(_0x4e1ffa,_0x2063ca));var _0x515222={'method':_0x0e13('0x1d'),'uri':util[_0x0e13('0x1e')](_0x0e13('0x1f'),_0x510a2b['remoteUri']),'form':{'operation':_0x0e13('0x20'),'username':_0x0e13('0x21'),'sessionName':_0x294aea[_0x0e13('0x22')],'elementType':_0x0e13('0x23'),'element':JSON[_0x0e13('0x24')](_0x408216)},'json':!![]};return request(_0x515222)[_0x0e13('0x25')](function(_0x4240e7){if(_0x4240e7[_0x0e13('0x26')]){return BPromise[_0x0e13('0x27')]({'id':_0x4240e7[_0x0e13('0x28')]['id']});}else{throw new Error(util[_0x0e13('0x1e')](_0x0e13('0x29'),JSON[_0x0e13('0x24')](_0x4240e7[_0x0e13('0x2a')])));}})[_0x0e13('0x2b')](function(_0x22daca){var _0x1edc48=_0x22daca['statusCode']||0x1f4;logger[_0x0e13('0x2a')](_0x0e13('0x2c'),_0x0e13('0x2d'),_0x1edc48,JSON['stringify'](_0x22daca));});}function getUser(_0x2182ae,_0x1deb3b,_0xa38940){if(intUtil[_0x0e13('0x2e')](_0x1deb3b)){logger['info'](_0x0e13('0x2f'),_0x1deb3b);return request({'method':_0x0e13('0x30'),'uri':util[_0x0e13('0x1e')](_0x0e13('0x1f'),_0x2182ae[_0x0e13('0x31')]),'qs':{'operation':_0x0e13('0x32'),'username':_0x0e13('0x21'),'sessionName':_0xa38940[_0x0e13('0x22')],'query':util['format'](_0x0e13('0x33'),_0x1deb3b)},'json':!![]})[_0x0e13('0x25')](function(_0x325003){if(_0x325003['success']&&_0x325003[_0x0e13('0x28')][_0x0e13('0xc')]){logger[_0x0e13('0x18')](_0x0e13('0x34'));return BPromise[_0x0e13('0x27')]({'id':_0x325003[_0x0e13('0x28')][0x0]['id'],'email':_0x325003[_0x0e13('0x28')][0x0][_0x0e13('0x35')],'name':_0x325003[_0x0e13('0x28')][0x0]['first_name']+'\x20'+_0x325003[_0x0e13('0x28')][_0x0e13('0x36')]});}else{logger[_0x0e13('0x18')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x0e13('0x27')]({'id':_0xa38940['userId'],'email':_0x2182ae[_0x0e13('0x37')],'name':_0x0e13('0x21')});}})[_0x0e13('0x2b')](function(_0x1084d9){var _0x2e313a=_0x1084d9[_0x0e13('0x38')]||0x1f4;logger[_0x0e13('0x2a')]('[vTiger],\x20%s,\x20%s,\x20%s','getUser',_0x2e313a,JSON[_0x0e13('0x24')](_0x1084d9));});}else{logger[_0x0e13('0x18')](_0x0e13('0x39'));return BPromise[_0x0e13('0x27')]({'id':_0xa38940[_0x0e13('0x3a')],'email':_0x2182ae[_0x0e13('0x37')],'name':_0x0e13('0x21')})['catch'](function(_0x304cde){var _0x445abf=_0x304cde[_0x0e13('0x38')]||0x1f4;logger[_0x0e13('0x2a')](_0x0e13('0x2c'),'getUser',_0x445abf,JSON[_0x0e13('0x24')](_0x304cde));});}}function getEndUser(_0x2dd946,_0x17f7e7,_0x4b17f2,_0x409b5a){logger['info'](_0x0e13('0x3b'),_0x4b17f2);return request({'method':'GET','uri':util[_0x0e13('0x1e')]('%s/webservice.php',_0x2dd946[_0x0e13('0x31')]),'qs':{'operation':_0x0e13('0x32'),'username':_0x0e13('0x21'),'sessionName':_0x409b5a[_0x0e13('0x22')],'query':util[_0x0e13('0x1e')](_0x0e13('0x3c'),_0x4b17f2,_0x4b17f2,_0x4b17f2,_0x4b17f2,_0x4b17f2)},'json':!![]})['then'](function(_0x445949){if(_0x445949[_0x0e13('0x26')]&&_0x445949[_0x0e13('0x28')][_0x0e13('0xc')]){logger[_0x0e13('0x18')](_0x0e13('0x3d'));return BPromise[_0x0e13('0x27')]({'id':_0x445949['result'][0x0]['id'],'name':_0x445949[_0x0e13('0x28')][0x0]['firstname']+'\x20'+_0x445949['result'][0x0]['lastname'],'phone':_0x4b17f2});}else{logger[_0x0e13('0x18')](_0x0e13('0x3e'));return request({'method':_0x0e13('0x1d'),'uri':util[_0x0e13('0x1e')](_0x0e13('0x1f'),_0x2dd946[_0x0e13('0x31')]),'form':{'operation':_0x0e13('0x20'),'sessionName':_0x409b5a['sessionName'],'elementType':_0x0e13('0x3f'),'element':JSON['stringify']({'lastname':_0x17f7e7,'phone':_0x4b17f2,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x45e8be){logger[_0x0e13('0x18')](_0x0e13('0x40'));return BPromise[_0x0e13('0x27')]({'id':_0x45e8be['result']['id'],'name':_0x45e8be[_0x0e13('0x28')][_0x0e13('0x41')],'phone':_0x45e8be['result'][_0x0e13('0x42')]});})[_0x0e13('0x2b')](function(_0x1c63e5){var _0x1b2478=_0x1c63e5[_0x0e13('0x38')]||0x1f4;logger[_0x0e13('0x2a')](_0x0e13('0x2c'),_0x0e13('0x43'),_0x1b2478,JSON[_0x0e13('0x24')](_0x1c63e5));});}});}function getConnection(_0x321254){var _0x4b2a3b=_0x321254['username'];var _0x36ad95=_0x321254[_0x0e13('0x44')];return request({'method':_0x0e13('0x30'),'uri':util[_0x0e13('0x1e')](_0x0e13('0x1f'),_0x321254['remoteUri']),'qs':{'operation':_0x0e13('0x45'),'username':_0x4b2a3b},'json':!![]})[_0x0e13('0x25')](function(_0x30b637){if(_0x30b637['success']){return request({'method':_0x0e13('0x1d'),'uri':util['format'](_0x0e13('0x1f'),_0x321254[_0x0e13('0x31')]),'form':{'operation':_0x0e13('0x46'),'username':_0x0e13('0x21'),'accessKey':md5(_0x30b637[_0x0e13('0x28')]['token']+_0x36ad95)},'json':!![]});}})[_0x0e13('0x25')](function(_0x4c6cba){if(_0x4c6cba[_0x0e13('0x26')]){return BPromise[_0x0e13('0x27')](_0x4c6cba['result']);}else{throw new Error(util[_0x0e13('0x1e')](_0x0e13('0x47'),_0x321254['id']));}})[_0x0e13('0x2b')](function(_0x2052b4){var _0x4f6c1a=_0x2052b4[_0x0e13('0x38')]||0x1f4;logger[_0x0e13('0x2a')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0e13('0x48'),_0x4f6c1a,JSON['stringify'](_0x2052b4));});}function request(_0x5010e5){logger['info'](_0x0e13('0x49'),JSON['stringify'](_0x5010e5));return rp(_0x5010e5);}exports[_0x0e13('0x4a')]=function(_0x284a31,_0xd2670c,_0x417a31,_0x3b9178,_0x51f889,_0x39cdc8){var _0x471c8d,_0x383fde,_0x2c0c44,_0x4539f6;_0x39cdc8[_0x0e13('0x31')]=intUtil[_0x0e13('0x4b')](_0x39cdc8[_0x0e13('0x31')]);if(_0x51f889&&_0x51f889[_0x0e13('0x4c')]){logger[_0x0e13('0x18')](_0x0e13('0x4d'),_0x0e13('0x4e'));_0xd2670c['recordingURL']=util[_0x0e13('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39cdc8[_0x0e13('0x4f')],_0xd2670c[_0x0e13('0x50')],md5(_0xd2670c['uniqueid']));}else{_0xd2670c[_0x0e13('0x51')]='';}return getConnection(_0x39cdc8)[_0x0e13('0x25')](function(_0x499888){_0x4539f6=_0x499888;return getUser(_0x39cdc8,_0x3b9178[_0x0e13('0x52')],_0x4539f6);})[_0x0e13('0x25')](function(_0x319261){_0x471c8d=_0x319261;logger[_0x0e13('0x18')]('The\x20User\x20ID\x20is:',_0x471c8d['id']);return getEndUser(_0x39cdc8,_0xd2670c[_0x0e13('0x53')],_0xd2670c[_0x0e13('0x54')],_0x4539f6);})[_0x0e13('0x25')](function(_0x23e683){_0x383fde=_0x23e683;logger[_0x0e13('0x18')](_0x0e13('0x55'),_0x383fde['id']);return createTicket(_0x39cdc8,_0x471c8d,_0x383fde,_0x417a31,_0xd2670c,_0x417a31[_0x0e13('0x56')],_0x4539f6);})[_0x0e13('0x25')](function(_0x297d55){_0x2c0c44=_0x297d55;logger['info'](_0x0e13('0x57'));logger[_0x0e13('0x18')](_0x0e13('0x58'),_0x2c0c44['id']);var _0x1d670f=util[_0x0e13('0x1e')](_0x0e13('0x59'),_0x39cdc8[_0x0e13('0x31')],_[_0x0e13('0x5a')](_0x2c0c44['id'],'x')[0x1]);logger[_0x0e13('0x18')](_0x0e13('0x4d'),_0x0e13('0x5b'));emit(util['format'](_0x0e13('0x5c'),_0x3b9178[_0x0e13('0x16')]),_0x0e13('0x5d'),{'uri':_0x1d670f});})[_0x0e13('0x2b')](function(_0x218744){logger[_0x0e13('0x2a')](_0x0e13('0x4d'),JSON['stringify'](_0x218744));});};exports[_0x0e13('0x5e')]=function(_0xebc24e,_0x28ef74,_0xb12597,_0x36b553,_0x29f794,_0x6e124b,_0x5cfea9){var _0x49774c,_0x460fcf,_0x18e2c3,_0x25d56e;_0x6e124b[_0x0e13('0x31')]=intUtil[_0x0e13('0x4b')](_0x6e124b[_0x0e13('0x31')]);_0x6e124b[_0x0e13('0x4f')]=intUtil[_0x0e13('0x4b')](_0x6e124b[_0x0e13('0x4f')]);if(_0x5cfea9&&_0x5cfea9[_0x0e13('0x5f')]&&_0x5cfea9[_0x0e13('0x5f')]!==_0x0e13('0x60')){logger['info'](_0x0e13('0x61'),_0x0e13('0x4e'));_0x28ef74['recordingURL']=util['format'](_0x0e13('0x62'),_0x6e124b['serverUrl'],_0x28ef74[_0x0e13('0x50')],md5(_0x28ef74[_0x0e13('0x50')]));}return getConnection(_0x6e124b)['then'](function(_0x34ad7a){_0x25d56e=_0x34ad7a;return getUser(_0x6e124b,_0x36b553[_0x0e13('0x52')],_0x25d56e);})['then'](function(_0x42a18c){_0x49774c=_0x42a18c;logger[_0x0e13('0x18')](_0x0e13('0x63'),_0x49774c['id']);return getEndUser(_0x6e124b,_0x28ef74[_0x0e13('0x64')],_0x28ef74[_0x0e13('0x65')],_0x25d56e);})['then'](function(_0x3778f0){_0x460fcf=_0x3778f0;logger[_0x0e13('0x18')](_0x0e13('0x55'),_0x460fcf['id']);return createTicket(_0x6e124b,_0x49774c,_0x460fcf,_0xb12597,_0x28ef74,_0xb12597[_0x0e13('0x56')],_0x25d56e);})[_0x0e13('0x25')](function(_0xb70de3){_0x18e2c3=_0xb70de3;logger[_0x0e13('0x18')]('Ticket\x20created!');logger[_0x0e13('0x18')](_0x0e13('0x58'),_0x18e2c3['id']);var _0x2f8f49=util[_0x0e13('0x1e')](_0x0e13('0x59'),_0x6e124b[_0x0e13('0x31')],_[_0x0e13('0x5a')](_0x18e2c3['id'],'x')[0x1]);logger[_0x0e13('0x18')](_0x0e13('0x61'),_0x0e13('0x5b'));emit(util[_0x0e13('0x1e')](_0x0e13('0x5c'),_0x36b553[_0x0e13('0x16')]),'trigger:browser:url',{'uri':_0x2f8f49});})[_0x0e13('0x2b')](function(_0x196245){logger[_0x0e13('0x2a')](_0x0e13('0x61'),JSON[_0x0e13('0x24')](_0x196245));});};exports[_0x0e13('0x66')]=function(_0xbcba7e,_0x25dd56,_0x536baa,_0x32696a,_0x5df3a8,_0x4a954e){var _0x3be783,_0x254db6,_0x2acf23,_0x111dec;_0x4a954e['remoteUri']=intUtil[_0x0e13('0x4b')](_0x4a954e['remoteUri']);_0x4a954e['serverUrl']=intUtil['stripTrailingSlash'](_0x4a954e[_0x0e13('0x4f')]);if(_0x5df3a8&&_0x5df3a8[_0x0e13('0x4c')]){logger[_0x0e13('0x18')]('[ABANDONED]',_0x0e13('0x4e'));_0x25dd56['recordingURL']=util['format'](_0x0e13('0x62'),_0x4a954e[_0x0e13('0x4f')],_0x25dd56[_0x0e13('0x50')],md5(_0x25dd56[_0x0e13('0x50')]));}else{_0x25dd56['recordingURL']='';}return getConnection(_0x4a954e)[_0x0e13('0x25')](function(_0x16d327){_0x111dec=_0x16d327;return getUser(_0x4a954e,'',_0x111dec);})[_0x0e13('0x25')](function(_0x1ea4c4){_0x3be783=_0x1ea4c4;logger[_0x0e13('0x18')](_0x0e13('0x63'),_0x3be783['id']);return getEndUser(_0x4a954e,_0x25dd56['calleridname'],_0x25dd56[_0x0e13('0x54')],_0x111dec);})[_0x0e13('0x25')](function(_0x18cb9b){_0x254db6=_0x18cb9b;logger[_0x0e13('0x18')](_0x0e13('0x55'),_0x254db6['id']);return createTicket(_0x4a954e,_0x3be783,_0x254db6,_0x536baa,_0x25dd56,_0x536baa[_0x0e13('0x56')],_0x111dec);})[_0x0e13('0x25')](function(_0xeee8d){_0x2acf23=_0xeee8d;logger[_0x0e13('0x18')](_0x0e13('0x57'));logger['info'](_0x0e13('0x58'),_0x2acf23['id']);})[_0x0e13('0x2b')](function(_0x1f3d45){logger[_0x0e13('0x2a')](_0x0e13('0x67'),JSON[_0x0e13('0x24')](_0x1f3d45));});};
\ No newline at end of file
index 04ec756..9f19bf1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe387=['[ABANDONED]\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','format','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','token','debug','[HTTP]','stringify','GET','map','forEach','type','string','customField','nameField','content','idField','custom_fields','push','toString','variableName','customVariable','toLowerCase','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','[OUTBOUND]','Authorization','email','destcalleridname','destcalleridnum','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','abandoned','calleridname'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe387,0x145));var _0x7e38=function(_0x1cc3e6,_0x618907){_0x1cc3e6=_0x1cc3e6-0x0;var _0x369176=_0xe387[_0x1cc3e6];return _0x369176;};'use strict';var _=require('lodash');var rp=require(_0x7e38('0x0'));var md5=require(_0x7e38('0x1'));var util=require(_0x7e38('0x2'));var Redis=require(_0x7e38('0x3'));var intUtil=require('./util');var config=require(_0x7e38('0x4'));var logger=require(_0x7e38('0x5'))('zendesk');config[_0x7e38('0x6')]=_[_0x7e38('0x7')](config['redis'],{'host':_0x7e38('0x8'),'port':0x18eb});var io=require(_0x7e38('0x9'))(new Redis(config[_0x7e38('0x6')]));function emit(_0x462366,_0x57a50e,_0x5480fd){io['to'](_0x462366)[_0x7e38('0xa')](_0x57a50e,_0x5480fd);}var headers={'Content-Type':_0x7e38('0xb'),'Accept':_0x7e38('0xb')};function getTicket(_0x332b2f,_0x8e253a,_0x17367a,_0x43696b,_0x6d9651){logger[_0x7e38('0xc')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x7e38('0xd')]('%s/tickets.json',_0x332b2f['remoteUri']),'method':_0x7e38('0xe'),'body':{'ticket':_[_0x7e38('0xf')]({'requester_id':_0x17367a['id'],'submitter_id':_0x8e253a?_0x8e253a['id']:undefined,'assignee_id':_0x8e253a?_0x8e253a['id']:undefined,'tags':getTags(_0x43696b[_0x7e38('0x10')],_0x7e38('0x11')),'subject':intUtil[_0x7e38('0x12')](_0x43696b[_0x7e38('0x13')],_0x6d9651,'\x20'),'description':intUtil['getString'](_0x43696b['Descriptions'],_0x6d9651,'\x0a'),'comment':{'public':![],'body':intUtil[_0x7e38('0x12')](_0x43696b[_0x7e38('0x14')],_0x6d9651,'\x0a')}},getCustomFields(_0x43696b[_0x7e38('0x15')],_0x6d9651))}})[_0x7e38('0x16')](function(_0x52438f){logger[_0x7e38('0xc')](_0x7e38('0x17'));return _0x52438f[_0x7e38('0x18')];});}function getUser(_0x2a757d,_0x2d0eff){if(intUtil[_0x7e38('0x19')](name)===!![]){logger[_0x7e38('0xc')](_0x7e38('0x1a'),_0x2d0eff);return request({'uri':util[_0x7e38('0xd')](_0x7e38('0x1b'),_0x2a757d[_0x7e38('0x1c')]),'qs':{'query':util[_0x7e38('0xd')](_0x7e38('0x1d'),_0x2d0eff)}})[_0x7e38('0x16')](function(_0x214947){if(_0x214947[_0x7e38('0x1e')]){logger[_0x7e38('0xc')](_0x7e38('0x1f'));return _[_0x7e38('0x20')](_0x214947[_0x7e38('0x21')],{'email':_0x2d0eff,'role':'agent'});}else{logger['info'](_0x7e38('0x22'));return request({'uri':util[_0x7e38('0xd')](_0x7e38('0x23'),_0x2a757d[_0x7e38('0x1c')])})[_0x7e38('0x16')](function(_0x1b02bf){logger[_0x7e38('0xc')](_0x7e38('0x24'));return _0x1b02bf[_0x7e38('0x25')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x7e38('0xd')](_0x7e38('0x23'),_0x2a757d[_0x7e38('0x1c')])})['then'](function(_0x37214e){logger[_0x7e38('0xc')](_0x7e38('0x24'));return _0x37214e[_0x7e38('0x25')];});}}function getEndUser(_0x117feb,_0x422ea9,_0x39509a){logger[_0x7e38('0xc')](_0x7e38('0x26'),_0x39509a);return request({'uri':util[_0x7e38('0xd')](_0x7e38('0x1b'),_0x117feb['remoteUri']),'qs':{'query':util[_0x7e38('0xd')](_0x7e38('0x27'),_0x39509a)}})['then'](function(_0x4354b1){var _0x5cbff4;if(_0x4354b1['results'][_0x7e38('0x28')]){_0x4354b1[_0x7e38('0x21')]=_[_0x7e38('0x29')](_0x4354b1[_0x7e38('0x21')],{'suspended':![],'role':_0x7e38('0x2a')});if(_0x4354b1[_0x7e38('0x21')][_0x7e38('0x28')]){_0x5cbff4=_[_0x7e38('0x2b')](_0x4354b1['results']);}}if(_0x5cbff4){logger[_0x7e38('0xc')](_0x7e38('0x2c'));return _0x5cbff4;}else{logger[_0x7e38('0xc')](_0x7e38('0x2d'));return request({'uri':util['format'](_0x7e38('0x2e'),_0x117feb[_0x7e38('0x1c')]),'method':'POST','body':{'user':{'role':'end-user','name':util[_0x7e38('0xd')](_0x7e38('0x2f'),_0x422ea9||_0x39509a),'phone':_0x39509a}}})[_0x7e38('0x16')](function(_0x55bf10){logger[_0x7e38('0xc')](_0x7e38('0x30'));return _0x55bf10[_0x7e38('0x25')];});}});}function getAuth(_0x325148){var _0x528c33;if(_0x325148[_0x7e38('0x31')]===_0x7e38('0x32')){_0x528c33=util[_0x7e38('0xd')]('%s:%s',_0x325148[_0x7e38('0x33')],_0x325148[_0x7e38('0x32')]);}else if(_0x325148[_0x7e38('0x31')]==='token'){_0x528c33=util['format']('%s/token:%s',_0x325148[_0x7e38('0x33')],_0x325148[_0x7e38('0x34')]);}return util['format']('Basic\x20%s',new Buffer(_0x528c33)['toString']('base64'));}function request(_0x31a4b8){logger[_0x7e38('0x35')](_0x7e38('0x36'),JSON[_0x7e38('0x37')](_0x31a4b8));return rp(_['defaults'](_0x31a4b8,{'method':_0x7e38('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x1a7875,_0x378578){var _0x4f3411=[];if(_0x1a7875&&_0x1a7875[_0x7e38('0x28')]>0x0){_0x4f3411=_[_0x7e38('0x39')](_0x1a7875,_0x378578);}return _0x4f3411;}function getCustomFields(_0x584c4f,_0x12a435){var _0x63fa0=[];var _0x1c76b5={'custom_fields':[]};if(_0x584c4f[_0x7e38('0x28')]>0x0){_[_0x7e38('0x3a')](_0x584c4f,function(_0x300771){if(_0x300771[_0x7e38('0x3b')]===_0x7e38('0x3c')&&_0x300771['nameField']&&!_0x300771[_0x7e38('0x3d')]){_0x1c76b5[_0x300771[_0x7e38('0x3e')]['toLowerCase']()]=_0x300771[_0x7e38('0x3f')]['toString']();}else if(_0x300771[_0x7e38('0x3b')]===_0x7e38('0x3c')&&_0x300771[_0x7e38('0x40')]&&_0x300771[_0x7e38('0x3d')]){_0x1c76b5[_0x7e38('0x41')][_0x7e38('0x42')]({'id':_0x300771[_0x7e38('0x40')],'value':_0x300771['content'][_0x7e38('0x43')]()});}else if(_0x300771[_0x7e38('0x3b')]==='variable'&&_0x300771[_0x7e38('0x44')]&&_0x300771[_0x7e38('0x40')]&&_0x300771[_0x7e38('0x3d')]){_0x12a435[_0x300771[_0x7e38('0x44')]]&&_0x1c76b5[_0x7e38('0x41')][_0x7e38('0x42')]({'id':_0x300771['idField'],'value':_0x12a435[_0x300771['variableName']]['toString']()});}else if(_0x300771[_0x7e38('0x3b')]===_0x7e38('0x45')&&_0x300771['Variable']&&_0x300771['Variable'][_0x7e38('0x11')]&&_0x300771[_0x7e38('0x40')]&&_0x300771[_0x7e38('0x3d')]){_0x12a435[_0x300771['Variable']['name'][_0x7e38('0x46')]()]&&_0x1c76b5[_0x7e38('0x41')][_0x7e38('0x42')]({'id':_0x300771[_0x7e38('0x40')],'value':_0x12a435[_0x300771[_0x7e38('0x47')][_0x7e38('0x11')]['toLowerCase']()][_0x7e38('0x43')]()});}});}return _0x1c76b5;}exports[_0x7e38('0x48')]=function(_0xf766b0,_0x3d1cfb,_0x31efea,_0x38ab0f,_0x27b571,_0x40a546){var _0x4cbe75,_0x35c369;_0x40a546[_0x7e38('0x1c')]=intUtil[_0x7e38('0x49')](_0x40a546[_0x7e38('0x1c')]);_0x40a546[_0x7e38('0x4a')]=intUtil[_0x7e38('0x49')](_0x40a546[_0x7e38('0x4a')]);if(_0x27b571&&_0x27b571[_0x7e38('0x4b')]){logger[_0x7e38('0xc')](_0x7e38('0x4c'),_0x7e38('0x4d'));_0x3d1cfb[_0x7e38('0x4e')]=util[_0x7e38('0xd')](_0x7e38('0x4f'),_0x40a546[_0x7e38('0x4a')],_0x3d1cfb[_0x7e38('0x50')],md5(_0x3d1cfb['uniqueid']));}else{_0x3d1cfb[_0x7e38('0x4e')]='';}headers['Authorization']=getAuth(_0x40a546);return getUser(_0x40a546,_0x38ab0f['email'])[_0x7e38('0x16')](function(_0x3ad737){_0x4cbe75=_0x3ad737;logger[_0x7e38('0xc')](_0x7e38('0x51'),_0x4cbe75['id']);return getEndUser(_0x40a546,_0x3d1cfb['calleridname'],_0x3d1cfb[_0x7e38('0x52')]);})[_0x7e38('0x16')](function(_0x382d0a){_0x35c369=_0x382d0a;logger[_0x7e38('0xc')](_0x7e38('0x53'),_0x35c369['id']);return getTicket(_0x40a546,_0x4cbe75,_0x35c369,_0x31efea,_0x3d1cfb);})[_0x7e38('0x16')](function(_0xf39193){if(_0xf39193){logger['info'](_0x7e38('0x54'),_0xf39193['id']);switch(_0x40a546[_0x7e38('0x3b')]){case'integrationTab':logger[_0x7e38('0xc')](_0x7e38('0x4c'),_0x7e38('0x55'));return request({'uri':util[_0x7e38('0xd')](_0x7e38('0x56'),_0x40a546[_0x7e38('0x1c')],_0x4cbe75['id'],_0xf39193['id']),'method':_0x7e38('0xe')});case _0x7e38('0x57'):logger[_0x7e38('0xc')](_0x7e38('0x4c'),_0x7e38('0x58'));emit(util[_0x7e38('0xd')](_0x7e38('0x59'),_0x38ab0f['name']),_0x7e38('0x5a'),{'uri':util[_0x7e38('0xd')](_0x7e38('0x5b'),_0x40a546['remoteUri'],_0xf39193['id'])});break;default:logger[_0x7e38('0x5c')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x7e38('0x5d')](function(_0x3f0192){logger[_0x7e38('0x5c')](_0x7e38('0x5e'),util['inspect'](_0x3f0192,{'showHidden':!![],'depth':null}));});};exports[_0x7e38('0x5f')]=function(_0x1b2f3a,_0x3d57ac,_0x10a0e8,_0xabe101,_0x498b6d,_0x107ad1,_0x35f0ea){var _0x435b48,_0x1d4a5d;_0x107ad1['remoteUri']=intUtil[_0x7e38('0x49')](_0x107ad1[_0x7e38('0x1c')]);_0x107ad1['serverUrl']=intUtil['stripTrailingSlash'](_0x107ad1[_0x7e38('0x4a')]);if(_0x35f0ea&&_0x35f0ea[_0x7e38('0x60')]&&_0x35f0ea[_0x7e38('0x60')]!=='none'){logger[_0x7e38('0xc')](_0x7e38('0x61'),_0x7e38('0x4d'));_0x3d57ac[_0x7e38('0x4e')]=util[_0x7e38('0xd')](_0x7e38('0x4f'),_0x107ad1[_0x7e38('0x4a')],_0x3d57ac[_0x7e38('0x50')],md5(_0x3d57ac['uniqueid']));}headers[_0x7e38('0x62')]=getAuth(_0x107ad1);return getUser(_0x107ad1,_0xabe101[_0x7e38('0x63')])['then'](function(_0x1823be){_0x435b48=_0x1823be;logger[_0x7e38('0xc')](_0x7e38('0x51'),_0x435b48['id']);return getEndUser(_0x107ad1,_0x3d57ac[_0x7e38('0x64')],_0x3d57ac[_0x7e38('0x65')]);})['then'](function(_0x4c7642){_0x1d4a5d=_0x4c7642;logger['info'](_0x7e38('0x53'),_0x1d4a5d['id']);return getTicket(_0x107ad1,_0x435b48,_0x1d4a5d,_0x10a0e8,_0x3d57ac);})[_0x7e38('0x16')](function(_0x18927a){if(_0x18927a){logger[_0x7e38('0xc')](_0x7e38('0x54'),_0x18927a['id']);switch(_0x107ad1['type']){case'integrationTab':logger[_0x7e38('0xc')](_0x7e38('0x61'),_0x7e38('0x55'));return request({'uri':util[_0x7e38('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x107ad1[_0x7e38('0x1c')],_0x435b48['id'],_0x18927a['id']),'method':_0x7e38('0xe')});case'newTab':logger[_0x7e38('0xc')](_0x7e38('0x61'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7e38('0xd')](_0x7e38('0x59'),_0xabe101[_0x7e38('0x11')]),_0x7e38('0x5a'),{'uri':util[_0x7e38('0xd')](_0x7e38('0x5b'),_0x107ad1[_0x7e38('0x1c')],_0x18927a['id'])});break;default:logger[_0x7e38('0x5c')](_0x7e38('0x61'),_0x7e38('0x66'));}}})[_0x7e38('0x5d')](function(_0x2b91a4){logger['error'](_0x7e38('0x67'),util[_0x7e38('0x68')](_0x2b91a4,{'showHidden':!![],'depth':null}));});};exports[_0x7e38('0x69')]=function(_0x5cb8ee,_0x2d72a6,_0x4fecb1,_0x28a282,_0x1a0521,_0x7ceecd){var _0x355289,_0xb99e0;_0x7ceecd['remoteUri']=intUtil[_0x7e38('0x49')](_0x7ceecd[_0x7e38('0x1c')]);_0x7ceecd[_0x7e38('0x4a')]=intUtil['stripTrailingSlash'](_0x7ceecd['serverUrl']);if(_0x1a0521&&_0x1a0521[_0x7e38('0x4b')]){logger[_0x7e38('0xc')]('[ABANDONED]',_0x7e38('0x4d'));_0x2d72a6[_0x7e38('0x4e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x7ceecd['serverUrl'],_0x2d72a6[_0x7e38('0x50')],md5(_0x2d72a6['uniqueid']));}else{_0x2d72a6[_0x7e38('0x4e')]='';}headers[_0x7e38('0x62')]=getAuth(_0x7ceecd);return getUser(_0x7ceecd)['then'](function(_0x36b11e){_0x355289=_0x36b11e;logger[_0x7e38('0xc')](_0x7e38('0x51'),_0x355289['id']);return getEndUser(_0x7ceecd,_0x2d72a6[_0x7e38('0x6a')],_0x2d72a6[_0x7e38('0x52')]);})[_0x7e38('0x16')](function(_0x11a7c7){_0xb99e0=_0x11a7c7;logger[_0x7e38('0xc')](_0x7e38('0x53'),_0xb99e0['id']);return getTicket(_0x7ceecd,_0x355289,_0xb99e0,_0x4fecb1,_0x2d72a6);})[_0x7e38('0x16')](function(_0x5c0576){if(_0x5c0576){logger['info'](_0x7e38('0x54'),_0x5c0576['id']);}})[_0x7e38('0x5d')](function(_0x2bb23e){logger[_0x7e38('0x5c')](_0x7e38('0x6b'),util[_0x7e38('0x68')](_0x2bb23e,{'showHidden':!![],'depth':null}));});};
\ No newline at end of file
+var _0x8cfc=['[ABANDONED]','[ABANDONED]\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','Tags','name','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','length','filter','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','[HTTP]','stringify','defaults','map','forEach','type','string','customField','nameField','toLowerCase','content','idField','custom_fields','variable','variableName','customVariable','Variable','push','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','recordingFormat','none','uniqueid','Authorization','destcalleridnum','integrationTab','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','trigger:browser:url','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','abandoned'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8cfc,0x1ae));var _0xc8cf=function(_0x55c059,_0x11a222){_0x55c059=_0x55c059-0x0;var _0x1de874=_0x8cfc[_0x55c059];return _0x1de874;};'use strict';var _=require(_0xc8cf('0x0'));var rp=require(_0xc8cf('0x1'));var md5=require('md5');var util=require(_0xc8cf('0x2'));var Redis=require('ioredis');var intUtil=require(_0xc8cf('0x3'));var config=require(_0xc8cf('0x4'));var logger=require('../../../../config/logger')('zendesk');config[_0xc8cf('0x5')]=_['defaults'](config[_0xc8cf('0x5')],{'host':_0xc8cf('0x6'),'port':0x18eb});var io=require(_0xc8cf('0x7'))(new Redis(config['redis']));function emit(_0x414787,_0x18dc0a,_0x59d22f){io['to'](_0x414787)[_0xc8cf('0x8')](_0x18dc0a,_0x59d22f);}var headers={'Content-Type':_0xc8cf('0x9'),'Accept':_0xc8cf('0x9')};function getTicket(_0x18bc2a,_0x183f1b,_0x23163f,_0x5f2711,_0x567f52){logger[_0xc8cf('0xa')](_0xc8cf('0xb'));return request({'uri':util[_0xc8cf('0xc')](_0xc8cf('0xd'),_0x18bc2a['remoteUri']),'method':_0xc8cf('0xe'),'body':{'ticket':_['merge']({'requester_id':_0x23163f['id'],'submitter_id':_0x183f1b?_0x183f1b['id']:undefined,'assignee_id':_0x183f1b?_0x183f1b['id']:undefined,'tags':getTags(_0x5f2711[_0xc8cf('0xf')],_0xc8cf('0x10')),'subject':intUtil[_0xc8cf('0x11')](_0x5f2711['Subjects'],_0x567f52,'\x20'),'description':intUtil[_0xc8cf('0x11')](_0x5f2711[_0xc8cf('0x12')],_0x567f52,'\x0a'),'comment':{'public':![],'body':intUtil[_0xc8cf('0x11')](_0x5f2711['Descriptions'],_0x567f52,'\x0a')}},getCustomFields(_0x5f2711[_0xc8cf('0x13')],_0x567f52))}})[_0xc8cf('0x14')](function(_0x4b3651){logger['info'](_0xc8cf('0x15'));return _0x4b3651[_0xc8cf('0x16')];});}function getUser(_0x5b4898,_0x2b4b34){if(intUtil['validateEmail'](_0x2b4b34)){logger['info'](_0xc8cf('0x17'),_0x2b4b34);return request({'uri':util['format'](_0xc8cf('0x18'),_0x5b4898[_0xc8cf('0x19')]),'qs':{'query':util[_0xc8cf('0xc')](_0xc8cf('0x1a'),_0x2b4b34)}})[_0xc8cf('0x14')](function(_0x55af9c){if(_0x55af9c[_0xc8cf('0x1b')]){logger[_0xc8cf('0xa')](_0xc8cf('0x1c'));return _[_0xc8cf('0x1d')](_0x55af9c[_0xc8cf('0x1e')],{'email':_0x2b4b34,'role':_0xc8cf('0x1f')});}else{logger[_0xc8cf('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xc8cf('0xc')](_0xc8cf('0x20'),_0x5b4898['remoteUri'])})[_0xc8cf('0x14')](function(_0x3cd0a5){logger[_0xc8cf('0xa')](_0xc8cf('0x21'));return _0x3cd0a5[_0xc8cf('0x22')];});}});}else{logger[_0xc8cf('0xa')](_0xc8cf('0x23'));return request({'uri':util['format'](_0xc8cf('0x20'),_0x5b4898[_0xc8cf('0x19')])})[_0xc8cf('0x14')](function(_0xad3785){logger[_0xc8cf('0xa')]('Admin\x20account\x20selected.');return _0xad3785[_0xc8cf('0x22')];});}}function getEndUser(_0x150b34,_0x40aadb,_0x146b0a){logger[_0xc8cf('0xa')](_0xc8cf('0x24'),_0x146b0a);return request({'uri':util[_0xc8cf('0xc')](_0xc8cf('0x18'),_0x150b34['remoteUri']),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x146b0a)}})[_0xc8cf('0x14')](function(_0x4190df){var _0x36496d;if(_0x4190df[_0xc8cf('0x1e')][_0xc8cf('0x25')]){_0x4190df[_0xc8cf('0x1e')]=_[_0xc8cf('0x26')](_0x4190df[_0xc8cf('0x1e')],{'suspended':![],'role':'end-user'});if(_0x4190df[_0xc8cf('0x1e')][_0xc8cf('0x25')]){_0x36496d=_['first'](_0x4190df[_0xc8cf('0x1e')]);}}if(_0x36496d){logger[_0xc8cf('0xa')](_0xc8cf('0x27'));return _0x36496d;}else{logger[_0xc8cf('0xa')](_0xc8cf('0x28'));return request({'uri':util[_0xc8cf('0xc')](_0xc8cf('0x29'),_0x150b34[_0xc8cf('0x19')]),'method':_0xc8cf('0xe'),'body':{'user':{'role':_0xc8cf('0x2a'),'name':util['format'](_0xc8cf('0x2b'),_0x40aadb||_0x146b0a),'phone':_0x146b0a}}})[_0xc8cf('0x14')](function(_0x5d4e2a){logger[_0xc8cf('0xa')](_0xc8cf('0x2c'));return _0x5d4e2a[_0xc8cf('0x22')];});}});}function getAuth(_0x7f24d3){var _0x4944a5;if(_0x7f24d3[_0xc8cf('0x2d')]===_0xc8cf('0x2e')){_0x4944a5=util[_0xc8cf('0xc')](_0xc8cf('0x2f'),_0x7f24d3[_0xc8cf('0x30')],_0x7f24d3[_0xc8cf('0x2e')]);}else if(_0x7f24d3[_0xc8cf('0x2d')]===_0xc8cf('0x31')){_0x4944a5=util[_0xc8cf('0xc')](_0xc8cf('0x32'),_0x7f24d3[_0xc8cf('0x30')],_0x7f24d3[_0xc8cf('0x31')]);}return util[_0xc8cf('0xc')](_0xc8cf('0x33'),new Buffer(_0x4944a5)[_0xc8cf('0x34')](_0xc8cf('0x35')));}function request(_0x3301f4){logger['debug'](_0xc8cf('0x36'),JSON[_0xc8cf('0x37')](_0x3301f4));return rp(_[_0xc8cf('0x38')](_0x3301f4,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x416519,_0x4baeff){var _0x1224c7=[];if(_0x416519&&_0x416519[_0xc8cf('0x25')]>0x0){_0x1224c7=_[_0xc8cf('0x39')](_0x416519,_0x4baeff);}return _0x1224c7;}function getCustomFields(_0x4fe376,_0x21a4f8){var _0x205cad=[];var _0x3a0590={'custom_fields':[]};if(_0x4fe376[_0xc8cf('0x25')]>0x0){_[_0xc8cf('0x3a')](_0x4fe376,function(_0x215d78){if(_0x215d78[_0xc8cf('0x3b')]===_0xc8cf('0x3c')&&_0x215d78['nameField']&&!_0x215d78[_0xc8cf('0x3d')]){_0x3a0590[_0x215d78[_0xc8cf('0x3e')][_0xc8cf('0x3f')]()]=_0x215d78[_0xc8cf('0x40')][_0xc8cf('0x34')]();}else if(_0x215d78[_0xc8cf('0x3b')]===_0xc8cf('0x3c')&&_0x215d78[_0xc8cf('0x41')]&&_0x215d78[_0xc8cf('0x3d')]){_0x3a0590[_0xc8cf('0x42')]['push']({'id':_0x215d78['idField'],'value':_0x215d78[_0xc8cf('0x40')][_0xc8cf('0x34')]()});}else if(_0x215d78[_0xc8cf('0x3b')]===_0xc8cf('0x43')&&_0x215d78[_0xc8cf('0x44')]&&_0x215d78[_0xc8cf('0x41')]&&_0x215d78['customField']){_0x21a4f8[_0x215d78[_0xc8cf('0x44')]]&&_0x3a0590[_0xc8cf('0x42')]['push']({'id':_0x215d78[_0xc8cf('0x41')],'value':_0x21a4f8[_0x215d78[_0xc8cf('0x44')]][_0xc8cf('0x34')]()});}else if(_0x215d78[_0xc8cf('0x3b')]===_0xc8cf('0x45')&&_0x215d78['Variable']&&_0x215d78[_0xc8cf('0x46')][_0xc8cf('0x10')]&&_0x215d78[_0xc8cf('0x41')]&&_0x215d78['customField']){_0x21a4f8[_0x215d78[_0xc8cf('0x46')][_0xc8cf('0x10')][_0xc8cf('0x3f')]()]&&_0x3a0590[_0xc8cf('0x42')][_0xc8cf('0x47')]({'id':_0x215d78['idField'],'value':_0x21a4f8[_0x215d78[_0xc8cf('0x46')][_0xc8cf('0x10')]['toLowerCase']()][_0xc8cf('0x34')]()});}});}return _0x3a0590;}exports[_0xc8cf('0x48')]=function(_0x263ac8,_0x198b7b,_0x35c6a3,_0x959819,_0x404052,_0xd5182a){var _0x1463cc,_0x7b30cb;_0xd5182a['remoteUri']=intUtil[_0xc8cf('0x49')](_0xd5182a['remoteUri']);_0xd5182a['serverUrl']=intUtil[_0xc8cf('0x49')](_0xd5182a[_0xc8cf('0x4a')]);if(_0x404052&&_0x404052['monitor_format']){logger['info'](_0xc8cf('0x4b'),_0xc8cf('0x4c'));_0x198b7b[_0xc8cf('0x4d')]=util[_0xc8cf('0xc')](_0xc8cf('0x4e'),_0xd5182a[_0xc8cf('0x4a')],_0x198b7b['uniqueid'],md5(_0x198b7b['uniqueid']));}else{_0x198b7b[_0xc8cf('0x4d')]='';}headers['Authorization']=getAuth(_0xd5182a);return getUser(_0xd5182a,_0x959819[_0xc8cf('0x4f')])[_0xc8cf('0x14')](function(_0x3cf2b4){_0x1463cc=_0x3cf2b4;logger[_0xc8cf('0xa')](_0xc8cf('0x50'),_0x1463cc['id']);return getEndUser(_0xd5182a,_0x198b7b[_0xc8cf('0x51')],_0x198b7b[_0xc8cf('0x52')]);})[_0xc8cf('0x14')](function(_0x1aea24){_0x7b30cb=_0x1aea24;logger[_0xc8cf('0xa')](_0xc8cf('0x53'),_0x7b30cb['id']);return getTicket(_0xd5182a,_0x1463cc,_0x7b30cb,_0x35c6a3,_0x198b7b);})[_0xc8cf('0x14')](function(_0x296d7a){if(_0x296d7a){logger[_0xc8cf('0xa')](_0xc8cf('0x54'),_0x296d7a['id']);switch(_0xd5182a[_0xc8cf('0x3b')]){case'integrationTab':logger[_0xc8cf('0xa')](_0xc8cf('0x4b'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xc8cf('0xc')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0xd5182a[_0xc8cf('0x19')],_0x1463cc['id'],_0x296d7a['id']),'method':_0xc8cf('0xe')});case _0xc8cf('0x55'):logger[_0xc8cf('0xa')](_0xc8cf('0x4b'),_0xc8cf('0x56'));emit(util[_0xc8cf('0xc')](_0xc8cf('0x57'),_0x959819[_0xc8cf('0x10')]),'trigger:browser:url',{'uri':util[_0xc8cf('0xc')](_0xc8cf('0x58'),_0xd5182a[_0xc8cf('0x19')],_0x296d7a['id'])});break;default:logger[_0xc8cf('0x59')](_0xc8cf('0x4b'),_0xc8cf('0x5a'));}}})[_0xc8cf('0x5b')](function(_0x43cc2d){logger['error'](_0xc8cf('0x5c'),util['inspect'](_0x43cc2d,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x585c98,_0x406328,_0x28ef3c,_0x224109,_0x162312,_0x15d1c8,_0x53b76f){var _0x4f77bf,_0x4726d9;_0x15d1c8[_0xc8cf('0x19')]=intUtil[_0xc8cf('0x49')](_0x15d1c8[_0xc8cf('0x19')]);_0x15d1c8['serverUrl']=intUtil[_0xc8cf('0x49')](_0x15d1c8[_0xc8cf('0x4a')]);if(_0x53b76f&&_0x53b76f[_0xc8cf('0x5d')]&&_0x53b76f[_0xc8cf('0x5d')]!==_0xc8cf('0x5e')){logger[_0xc8cf('0xa')]('[OUTBOUND]',_0xc8cf('0x4c'));_0x406328[_0xc8cf('0x4d')]=util[_0xc8cf('0xc')](_0xc8cf('0x4e'),_0x15d1c8[_0xc8cf('0x4a')],_0x406328[_0xc8cf('0x5f')],md5(_0x406328[_0xc8cf('0x5f')]));}headers[_0xc8cf('0x60')]=getAuth(_0x15d1c8);return getUser(_0x15d1c8,_0x224109[_0xc8cf('0x4f')])[_0xc8cf('0x14')](function(_0x55ca6e){_0x4f77bf=_0x55ca6e;logger[_0xc8cf('0xa')](_0xc8cf('0x50'),_0x4f77bf['id']);return getEndUser(_0x15d1c8,_0x406328['destcalleridname'],_0x406328[_0xc8cf('0x61')]);})['then'](function(_0x20a80c){_0x4726d9=_0x20a80c;logger[_0xc8cf('0xa')](_0xc8cf('0x53'),_0x4726d9['id']);return getTicket(_0x15d1c8,_0x4f77bf,_0x4726d9,_0x28ef3c,_0x406328);})[_0xc8cf('0x14')](function(_0x5f3e5c){if(_0x5f3e5c){logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f3e5c['id']);switch(_0x15d1c8[_0xc8cf('0x3b')]){case _0xc8cf('0x62'):logger[_0xc8cf('0xa')](_0xc8cf('0x63'),_0xc8cf('0x64'));return request({'uri':util[_0xc8cf('0xc')](_0xc8cf('0x65'),_0x15d1c8[_0xc8cf('0x19')],_0x4f77bf['id'],_0x5f3e5c['id']),'method':_0xc8cf('0xe')});case _0xc8cf('0x55'):logger[_0xc8cf('0xa')](_0xc8cf('0x63'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc8cf('0xc')](_0xc8cf('0x57'),_0x224109['name']),_0xc8cf('0x66'),{'uri':util[_0xc8cf('0xc')](_0xc8cf('0x58'),_0x15d1c8[_0xc8cf('0x19')],_0x5f3e5c['id'])});break;default:logger[_0xc8cf('0x59')]('[OUTBOUND]',_0xc8cf('0x5a'));}}})[_0xc8cf('0x5b')](function(_0x4c0e4f){logger[_0xc8cf('0x59')](_0xc8cf('0x67'),util['inspect'](_0x4c0e4f,{'showHidden':!![],'depth':null}));});};exports[_0xc8cf('0x68')]=function(_0x489ceb,_0x14bedd,_0x178e00,_0x2a3f44,_0x595a1f,_0x536d40){var _0x804682,_0x11404d;_0x536d40['remoteUri']=intUtil['stripTrailingSlash'](_0x536d40[_0xc8cf('0x19')]);_0x536d40[_0xc8cf('0x4a')]=intUtil['stripTrailingSlash'](_0x536d40[_0xc8cf('0x4a')]);if(_0x595a1f&&_0x595a1f['monitor_format']){logger[_0xc8cf('0xa')](_0xc8cf('0x69'),_0xc8cf('0x4c'));_0x14bedd[_0xc8cf('0x4d')]=util[_0xc8cf('0xc')](_0xc8cf('0x4e'),_0x536d40[_0xc8cf('0x4a')],_0x14bedd[_0xc8cf('0x5f')],md5(_0x14bedd[_0xc8cf('0x5f')]));}else{_0x14bedd[_0xc8cf('0x4d')]='';}headers[_0xc8cf('0x60')]=getAuth(_0x536d40);return getUser(_0x536d40)['then'](function(_0x4de89d){_0x804682=_0x4de89d;logger[_0xc8cf('0xa')](_0xc8cf('0x50'),_0x804682['id']);return getEndUser(_0x536d40,_0x14bedd[_0xc8cf('0x51')],_0x14bedd[_0xc8cf('0x52')]);})['then'](function(_0x16c59e){_0x11404d=_0x16c59e;logger[_0xc8cf('0xa')](_0xc8cf('0x53'),_0x11404d['id']);return getTicket(_0x536d40,_0x804682,_0x11404d,_0x178e00,_0x14bedd);})[_0xc8cf('0x14')](function(_0x2dc6b8){if(_0x2dc6b8){logger[_0xc8cf('0xa')](_0xc8cf('0x54'),_0x2dc6b8['id']);}})[_0xc8cf('0x5b')](function(_0x3ae3f3){logger['error'](_0xc8cf('0x6a'),util['inspect'](_0x3ae3f3,{'showHidden':!![],'depth':null}));});};
\ No newline at end of file
index 24848c3..6b428cf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2023=['lodash','md5','util','./util','entities','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20call...','inbound','outbound','starttime','agentcalledAt','format','YYYY-MM-DD\x20HH:mm:ss','getString','Subjects','Descriptions','Fields','lastevent','called','Called','complete','Call\x20Result','Rejected','Abandoned','Call\x20Duration','utc','talktime','mm:ss','answertime','endtime','diff','CONTACTID','LEADID','SEMODULE','Leads','<Calls><row\x20no=\x221\x22>','hasOwnProperty','<FL\x20val=\x22%s\x22>%s</FL>','encodeXML','</row></Calls>','POST','https://crm.%s/crm/private/xml/Calls/insertRecords','host','crmapi','then','parse','toJson','response','result','recorddetail','info','Call\x20created!','Error\x20on\x20call\x20creation:\x20','stringify','GET','https://crm.%s/crm/private/json/Users/getUsers','authToken','users','user','Standard','Agent\x20found!','Using\x20the\x20admin\x20account!','find','Administrator','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','((Phone:%s))','Enduser\x20found\x20in\x20Contacts!','Contacts','row','val','https://crm.%s/crm/private/json/Leads/searchRecords','Enduser\x20found\x20in\x20Leads!','content','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','<Leads><row\x20no=\x221\x22><FL\x20val=\x22First\x20Name\x22>%s</FL><FL\x20val=\x22Last\x20Name\x22>%s</FL><FL\x20val=\x22Phone\x22>%s</FL></row></Leads>','https://crm.%s/crm/private/json/Leads/getRecordById','Error\x20on\x20Lead\x20creation:\x20','length','Error\x20on\x20Lead\x20retrieve:\x20','debug','[HTTP]','type','idField','toString','variable','variableName','customVariable','Variable','name','indexOf','split','queue','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','abandoned','serverUrl'];(function(_0x34b87f,_0x28aef2){var _0x449805=function(_0x3735b7){while(--_0x3735b7){_0x34b87f['push'](_0x34b87f['shift']());}};_0x449805(++_0x28aef2);}(_0x2023,0x17d));var _0x3202=function(_0x2349c1,_0x47eeca){_0x2349c1=_0x2349c1-0x0;var _0x4be62f=_0x2023[_0x2349c1];return _0x4be62f;};'use strict';var _=require(_0x3202('0x0'));var rp=require('request-promise');var md5=require(_0x3202('0x1'));var util=require(_0x3202('0x2'));var intUtil=require(_0x3202('0x3'));var parser=require('xml2json');var entities=require(_0x3202('0x4'));var moment=require('moment');var Redis=require(_0x3202('0x5'));var config=require(_0x3202('0x6'));var logger=require(_0x3202('0x7'))(_0x3202('0x8'));config[_0x3202('0x9')]=_['defaults'](config[_0x3202('0x9')],{'host':_0x3202('0xa'),'port':0x18eb});var io=require(_0x3202('0xb'))(new Redis(config[_0x3202('0x9')]));function emit(_0x2954ba,_0x258118,_0x5a6629){io['to'](_0x2954ba)[_0x3202('0xc')](_0x258118,_0x5a6629);}var headers={'Content-Type':_0x3202('0xd'),'Accept':_0x3202('0xd')};function getCall(_0x22a3c4,_0x18969c,_0x1bc187,_0x1e66a6,_0x4f840a,_0x523601){logger['info'](_0x3202('0xe'));var _0x1e65d8=_['merge']({'SMOWNERID':_0x18969c['id'],'Call Type':_0x523601||_0x3202('0xf'),'Call Start Time':(_0x523601===_0x3202('0x10')?_0x4f840a[_0x3202('0x11')]:_0x4f840a[_0x3202('0x12')])||moment()[_0x3202('0x13')](_0x3202('0x14')),'Subject':intUtil[_0x3202('0x15')](_0x1e66a6[_0x3202('0x16')],_0x4f840a,'\x20'),'Description':intUtil[_0x3202('0x15')](_0x1e66a6[_0x3202('0x17')],_0x4f840a,'\x0a')},getCustomFields(_0x1e66a6[_0x3202('0x18')],_0x4f840a));switch(_0x4f840a[_0x3202('0x19')]){case _0x3202('0x1a'):_0x1e65d8['Call\x20Result']=_0x3202('0x1b');break;case _0x3202('0x1c'):case'connect':_0x1e65d8[_0x3202('0x1d')]='Answered';break;case'rejected':_0x1e65d8[_0x3202('0x1d')]=_0x3202('0x1e');break;case'abandoned':_0x1e65d8[_0x3202('0x1d')]=_0x3202('0x1f');break;default:}if(_0x4f840a['talktime']){_0x1e65d8[_0x3202('0x20')]=moment[_0x3202('0x21')](parseInt(_0x4f840a[_0x3202('0x22')])*0x3e8)[_0x3202('0x13')](_0x3202('0x23'));}else if(_0x4f840a[_0x3202('0x24')]&&_0x4f840a['endtime']){_0x1e65d8['Call\x20Duration']=moment[_0x3202('0x21')](moment(_0x4f840a[_0x3202('0x25')],_0x3202('0x14'))[_0x3202('0x26')](moment(_0x4f840a['starttime'],'YYYY-MM-DD\x20HH:mm:ss')))[_0x3202('0x13')](_0x3202('0x23'));}if(_0x1bc187[_0x3202('0x27')]){_0x1e65d8[_0x3202('0x27')]=_0x1bc187[_0x3202('0x27')];}else if(_0x1bc187[_0x3202('0x28')]){_0x1e65d8[_0x3202('0x29')]=_0x3202('0x2a');_0x1e65d8['SEID']=_0x1bc187[_0x3202('0x28')];}var _0x1400bd=_0x3202('0x2b');for(var _0xa92505 in _0x1e65d8){if(_0x1e65d8[_0x3202('0x2c')](_0xa92505)){_0x1400bd+=util[_0x3202('0x13')](_0x3202('0x2d'),entities[_0x3202('0x2e')](_0xa92505),entities[_0x3202('0x2e')](_0x1e65d8[_0xa92505]));}}_0x1400bd+=_0x3202('0x2f');return request({'method':_0x3202('0x30'),'uri':util['format'](_0x3202('0x31'),_0x22a3c4[_0x3202('0x32')]),'qs':{'authtoken':_0x22a3c4['authToken'],'scope':_0x3202('0x33'),'xmlData':_0x1400bd},'json':!![]})[_0x3202('0x34')](function(_0x251972){_0x251972=JSON[_0x3202('0x35')](parser[_0x3202('0x36')](_0x251972));if(_0x251972[_0x3202('0x37')]){if(_0x251972[_0x3202('0x37')][_0x3202('0x38')]&&_0x251972[_0x3202('0x37')][_0x3202('0x38')][_0x3202('0x39')]){logger[_0x3202('0x3a')](_0x3202('0x3b'));return{'id':_0x251972['response'][_0x3202('0x38')][_0x3202('0x39')]['FL'][0x0]['$t']};}}throw new Error(_0x3202('0x3c')+JSON[_0x3202('0x3d')](_0x251972));});}function getUser(_0x15baf3,_0x325b2d){return request({'method':_0x3202('0x3e'),'uri':util[_0x3202('0x13')](_0x3202('0x3f'),_0x15baf3['host']),'qs':{'type':'AllUsers','authtoken':_0x15baf3[_0x3202('0x40')],'scope':_0x3202('0x33')},'json':!![]})[_0x3202('0x34')](function(_0x58fab6){if(_0x58fab6['users']&&_0x58fab6[_0x3202('0x41')]['user']){var _0x297ad7;if(_0x325b2d){_0x297ad7=_['find'](_0x58fab6[_0x3202('0x41')][_0x3202('0x42')],{'email':_0x325b2d,'profile':_0x3202('0x43')});}if(_0x297ad7){logger[_0x3202('0x3a')](_0x3202('0x44'));}else{logger[_0x3202('0x3a')](_0x3202('0x45'));_0x297ad7=_[_0x3202('0x46')](_0x58fab6[_0x3202('0x41')][_0x3202('0x42')],{'profile':_0x3202('0x47')});}return _0x297ad7;}else{logger[_0x3202('0x48')](_0x3202('0x49'),JSON['stringify'](_0x58fab6));throw new Error(_0x3202('0x4a')+JSON['stringify'](_0x58fab6));}});}function getEndUser(_0x502454,_0x377c85,_0xcbd4d9){logger['info']('Searching\x20enduser\x20with\x20phone',_0xcbd4d9);return request({'method':_0x3202('0x3e'),'uri':util['format']('https://crm.%s/crm/private/json/Contacts/searchRecords',_0x502454[_0x3202('0x32')]),'qs':{'authtoken':_0x502454[_0x3202('0x40')],'scope':'crmapi','criteria':util[_0x3202('0x13')](_0x3202('0x4b'),_0xcbd4d9)},'json':!![]})[_0x3202('0x34')](function(_0x5078ee){if(_0x5078ee['response']&&_0x5078ee[_0x3202('0x37')][_0x3202('0x38')]){logger[_0x3202('0x3a')](_0x3202('0x4c'));var _0x51ad60={};var _0x12e575=_0x5078ee[_0x3202('0x37')][_0x3202('0x38')][_0x3202('0x4d')][_0x3202('0x4e')]['no']?_0x5078ee[_0x3202('0x37')][_0x3202('0x38')][_0x3202('0x4d')]['row']['FL']:_0x5078ee['response']['result'][_0x3202('0x4d')][_0x3202('0x4e')][0x0]['FL'];for(var _0x2b0a93=0x0,_0x3cd2bf=_0x12e575['length'];_0x2b0a93<_0x3cd2bf;_0x2b0a93++){_0x51ad60[_0x12e575[_0x2b0a93][_0x3202('0x4f')]]=_0x12e575[_0x2b0a93]['content'];}return _0x51ad60;}else{return request({'method':_0x3202('0x3e'),'uri':util[_0x3202('0x13')](_0x3202('0x50'),_0x502454['host']),'qs':{'authtoken':_0x502454[_0x3202('0x40')],'scope':'crmapi','criteria':util[_0x3202('0x13')](_0x3202('0x4b'),_0xcbd4d9)},'json':!![]})[_0x3202('0x34')](function(_0x5348b5){if(_0x5348b5[_0x3202('0x37')]&&_0x5348b5[_0x3202('0x37')][_0x3202('0x38')]){logger[_0x3202('0x3a')](_0x3202('0x51'));var _0x1bc535={};var _0x139884=_0x5348b5[_0x3202('0x37')][_0x3202('0x38')]['Leads'][_0x3202('0x4e')]['no']?_0x5348b5[_0x3202('0x37')][_0x3202('0x38')][_0x3202('0x2a')][_0x3202('0x4e')]['FL']:_0x5348b5[_0x3202('0x37')][_0x3202('0x38')][_0x3202('0x2a')][_0x3202('0x4e')][0x0]['FL'];for(var _0x26f8f0=0x0,_0x29d85c=_0x139884['length'];_0x26f8f0<_0x29d85c;_0x26f8f0++){_0x1bc535[_0x139884[_0x26f8f0][_0x3202('0x4f')]]=_0x139884[_0x26f8f0][_0x3202('0x52')];}return _0x1bc535;}else{logger[_0x3202('0x3a')](_0x3202('0x53'));_0x377c85=getName(_0x377c85);return request({'method':'POST','uri':util[_0x3202('0x13')]('https://crm.%s/crm/private/xml/Leads/insertRecords',_0x502454[_0x3202('0x32')]),'qs':{'authtoken':_0x502454[_0x3202('0x40')],'scope':'crmapi','xmlData':util[_0x3202('0x13')](_0x3202('0x54'),entities[_0x3202('0x2e')](_0x377c85[0x0]),entities[_0x3202('0x2e')](_0x377c85[0x1]),_0xcbd4d9)},'json':!![]})[_0x3202('0x34')](function(_0x5f1599){_0x5f1599=JSON[_0x3202('0x35')](parser['toJson'](_0x5f1599));if(_0x5f1599[_0x3202('0x37')]){if(_0x5f1599[_0x3202('0x37')][_0x3202('0x38')]&&_0x5f1599[_0x3202('0x37')][_0x3202('0x38')][_0x3202('0x39')]){logger['info']('Enduser\x20created.');return request({'method':_0x3202('0x3e'),'uri':util[_0x3202('0x13')](_0x3202('0x55'),_0x502454['host']),'qs':{'authtoken':_0x502454['authToken'],'scope':'crmapi','id':_0x5f1599[_0x3202('0x37')][_0x3202('0x38')][_0x3202('0x39')]['FL'][0x0]['$t']},'json':!![]});}}throw new Error(_0x3202('0x56')+JSON['stringify'](_0x5f1599));})[_0x3202('0x34')](function(_0x2d8060){if(_0x2d8060[_0x3202('0x37')]){if(_0x2d8060[_0x3202('0x37')][_0x3202('0x38')]){var _0x38e3dd={};for(var _0x2da164=0x0,_0x4bf53b=_0x2d8060[_0x3202('0x37')][_0x3202('0x38')][_0x3202('0x2a')][_0x3202('0x4e')]['FL'][_0x3202('0x57')];_0x2da164<_0x4bf53b;_0x2da164++){_0x38e3dd[_0x2d8060[_0x3202('0x37')][_0x3202('0x38')][_0x3202('0x2a')][_0x3202('0x4e')]['FL'][_0x2da164][_0x3202('0x4f')]]=_0x2d8060['response'][_0x3202('0x38')][_0x3202('0x2a')]['row']['FL'][_0x2da164][_0x3202('0x52')];}return _0x38e3dd;}}throw new Error(_0x3202('0x58')+JSON[_0x3202('0x3d')](_0x2d8060));});}});}});}function request(_0x5923c7){logger[_0x3202('0x59')](_0x3202('0x5a'),JSON[_0x3202('0x3d')](_0x5923c7));return rp(_0x5923c7);}function getCustomFields(_0x5f06c2,_0x3c62eb){var _0x3fdf2e={};if(_0x5f06c2[_0x3202('0x57')]>0x0){_['forEach'](_0x5f06c2,function(_0xff0953){if(_0xff0953[_0x3202('0x5b')]==='string'&&_0xff0953[_0x3202('0x5c')]){_0x3fdf2e[_0xff0953[_0x3202('0x5c')]]=_0xff0953[_0x3202('0x52')][_0x3202('0x5d')]();}else if(_0xff0953[_0x3202('0x5b')]===_0x3202('0x5e')&&_0xff0953[_0x3202('0x5f')]&&_0xff0953[_0x3202('0x5c')]&&_0x3c62eb[_0xff0953[_0x3202('0x5f')]]){_0x3fdf2e[_0xff0953[_0x3202('0x5c')]]=_0x3c62eb[_0xff0953[_0x3202('0x5f')]][_0x3202('0x5d')]();}else if(_0xff0953[_0x3202('0x5b')]===_0x3202('0x60')&&_0xff0953['Variable']&&_0xff0953[_0x3202('0x61')][_0x3202('0x62')]&&_0xff0953['idField']&&_0x3c62eb[_0xff0953['Variable'][_0x3202('0x62')]['toLowerCase']()]){_0x3fdf2e[_0xff0953[_0x3202('0x5c')]]=_0x3c62eb[_0xff0953[_0x3202('0x61')][_0x3202('0x62')]['toLowerCase']()][_0x3202('0x5d')]();}});}return _0x3fdf2e;}function getName(_0x179aa2){if(_0x179aa2[_0x3202('0x63')]('\x20')>0x0){var _0x598b0e=_0x179aa2[_0x3202('0x64')](/ (.+)/);if(_0x598b0e[0x1]){return _0x598b0e;}}return[_0x179aa2,_0x179aa2];}exports[_0x3202('0x65')]=function(_0x28a05e,_0xfd278a,_0x5af265,_0x5ca9ed,_0x2602fb,_0x48d77d){var _0x483a54,_0x5c50fe;if(_0x2602fb&&_0x2602fb[_0x3202('0x66')]){logger['info'](_0x3202('0x67'),_0x3202('0x68'));_0xfd278a['recordingURL']=util['format'](_0x3202('0x69'),_0x48d77d['serverUrl'],_0xfd278a[_0x3202('0x6a')],md5(_0xfd278a[_0x3202('0x6a')]));}else{_0xfd278a[_0x3202('0x6b')]='';}return getUser(_0x48d77d,_0x5ca9ed[_0x3202('0x6c')])['then'](function(_0x1bec90){_0x483a54=_0x1bec90;logger[_0x3202('0x3a')]('The\x20User\x20ID\x20is:',_0x483a54['id']);return getEndUser(_0x48d77d,_0xfd278a[_0x3202('0x6d')],_0xfd278a[_0x3202('0x6e')]);})[_0x3202('0x34')](function(_0x1e2301){_0x5c50fe=_0x1e2301;logger['info'](_0x3202('0x6f'),_0x5c50fe[_0x3202('0x27')]||_0x5c50fe[_0x3202('0x28')]);return getCall(_0x48d77d,_0x483a54,_0x5c50fe,_0x5af265,_0xfd278a,_0x3202('0x70'));})[_0x3202('0x34')](function(_0x4d31d9){if(_0x4d31d9){logger[_0x3202('0x3a')](_0x3202('0x71'),_0x4d31d9['id']);logger[_0x3202('0x3a')](_0x3202('0x67'),_0x3202('0x72'));emit(util['format'](_0x3202('0x73'),_0x5ca9ed[_0x3202('0x62')]),_0x3202('0x74'),{'uri':util['format']('https://crm.%s/crm/EntityInfo.do?module=Calls&id=%s',_0x48d77d[_0x3202('0x32')],_0x4d31d9['id'])});}})[_0x3202('0x75')](function(_0xd2db4d){logger[_0x3202('0x48')](_0x3202('0x67'),JSON['stringify'](_0xd2db4d));});};exports[_0x3202('0x10')]=function(_0x523f2d,_0x174376,_0x1c07cc,_0x1db47b,_0x24e3da,_0x1d400b,_0x521903){var _0x12f2c0,_0x4fa721;if(_0x521903&&_0x521903[_0x3202('0x76')]&&_0x521903['recordingFormat']!==_0x3202('0x77')){logger[_0x3202('0x3a')](_0x3202('0x78'),'Recording\x20is\x20enabled!');_0x174376[_0x3202('0x6b')]=util[_0x3202('0x13')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1d400b['serverUrl'],_0x174376[_0x3202('0x6a')],md5(_0x174376[_0x3202('0x6a')]));}return getUser(_0x1d400b,_0x1db47b[_0x3202('0x6c')])[_0x3202('0x34')](function(_0x3456bc){_0x12f2c0=_0x3456bc;logger[_0x3202('0x3a')](_0x3202('0x79'),_0x12f2c0['id']);return getEndUser(_0x1d400b,_0x174376[_0x3202('0x7a')],_0x174376[_0x3202('0x7b')]);})[_0x3202('0x34')](function(_0x329d77){_0x4fa721=_0x329d77;logger[_0x3202('0x3a')](_0x3202('0x6f'),_0x4fa721['CONTACTID']||_0x4fa721[_0x3202('0x28')]);return getCall(_0x1d400b,_0x12f2c0,_0x4fa721,_0x1c07cc,_0x174376,_0x3202('0x7c'));})[_0x3202('0x34')](function(_0x1ee12f){if(_0x1ee12f){logger[_0x3202('0x3a')](_0x3202('0x71'),_0x1ee12f['id']);logger[_0x3202('0x3a')](_0x3202('0x78'),_0x3202('0x72'));emit(util[_0x3202('0x13')](_0x3202('0x73'),_0x1db47b[_0x3202('0x62')]),_0x3202('0x74'),{'uri':util[_0x3202('0x13')]('https://crm.%s/crm/EntityInfo.do?module=Calls&id=%s',_0x1d400b[_0x3202('0x32')],_0x1ee12f['id'])});}})[_0x3202('0x75')](function(_0x270a08){logger['error'](_0x3202('0x78'),JSON[_0x3202('0x3d')](_0x270a08));});};exports[_0x3202('0x7d')]=function(_0x4e730d,_0xeffc66,_0x421729,_0x21b054,_0x5accfa,_0x564f30){var _0x2007e5,_0x379b73;if(_0x5accfa&&_0x5accfa['monitor_format']){logger[_0x3202('0x3a')]('[ABANDONED]',_0x3202('0x68'));_0xeffc66[_0x3202('0x6b')]=util[_0x3202('0x13')](_0x3202('0x69'),_0x564f30[_0x3202('0x7e')],_0xeffc66[_0x3202('0x6a')],md5(_0xeffc66[_0x3202('0x6a')]));}else{_0xeffc66[_0x3202('0x6b')]='';}return getUser(_0x564f30)[_0x3202('0x34')](function(_0x2608f2){_0x2007e5=_0x2608f2;logger[_0x3202('0x3a')](_0x3202('0x79'),_0x2007e5['id']);return getEndUser(_0x564f30,_0xeffc66['calleridname'],_0xeffc66[_0x3202('0x6e')]);})[_0x3202('0x34')](function(_0x242cf5){_0x379b73=_0x242cf5;logger['info'](_0x3202('0x6f'),_0x379b73['CONTACTID']||_0x379b73[_0x3202('0x28')]);return getCall(_0x564f30,_0x2007e5,_0x379b73,_0x421729,_0xeffc66,_0x3202('0x70'));})[_0x3202('0x34')](function(_0x3c3b60){if(_0x3c3b60){logger[_0x3202('0x3a')](_0x3202('0x71'),_0x3c3b60['id']);}})[_0x3202('0x75')](function(_0x1acc0a){logger[_0x3202('0x48')]('[ABANDONED]',JSON['stringify'](_0x1acc0a));});};
\ No newline at end of file
+var _0x8ef6=['abandoned','[ABANDONED]','calleridname','The\x20Enduser\x20ID\x20is:','lodash','request-promise','md5','util','./util','xml2json','entities','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20call...','merge','inbound','outbound','starttime','format','YYYY-MM-DD\x20HH:mm:ss','getString','Descriptions','Fields','called','Call\x20Result','Called','complete','Rejected','Abandoned','talktime','Call\x20Duration','mm:ss','endtime','diff','CONTACTID','LEADID','SEMODULE','Leads','SEID','encodeXML','</row></Calls>','POST','host','authToken','crmapi','then','parse','toJson','response','result','info','stringify','GET','https://crm.%s/crm/private/json/Users/getUsers','users','user','find','Agent\x20found!','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','Searching\x20enduser\x20with\x20phone','https://crm.%s/crm/private/json/Contacts/searchRecords','((Phone:%s))','Enduser\x20found\x20in\x20Contacts!','Contacts','row','length','val','content','https://crm.%s/crm/private/json/Leads/searchRecords','Enduser\x20found\x20in\x20Leads!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','https://crm.%s/crm/private/xml/Leads/insertRecords','<Leads><row\x20no=\x221\x22><FL\x20val=\x22First\x20Name\x22>%s</FL><FL\x20val=\x22Last\x20Name\x22>%s</FL><FL\x20val=\x22Phone\x22>%s</FL></row></Leads>','recorddetail','https://crm.%s/crm/private/json/Leads/getRecordById','[HTTP]','type','string','idField','variable','variableName','toString','Variable','name','indexOf','split','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Inbound','The\x20Call\x20ID\x20is:','trigger:browser:url','https://crm.%s/crm/EntityInfo.do?module=Calls&id=%s','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','destcalleridname','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch'];(function(_0x28057f,_0x1d9741){var _0x61eeae=function(_0xd2fbc){while(--_0xd2fbc){_0x28057f['push'](_0x28057f['shift']());}};_0x61eeae(++_0x1d9741);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2dd1c1,_0x5dd52f){_0x2dd1c1=_0x2dd1c1-0x0;var _0x5927d9=_0x8ef6[_0x2dd1c1];return _0x5927d9;};'use strict';var _=require(_0x68ef('0x0'));var rp=require(_0x68ef('0x1'));var md5=require(_0x68ef('0x2'));var util=require(_0x68ef('0x3'));var intUtil=require(_0x68ef('0x4'));var parser=require(_0x68ef('0x5'));var entities=require(_0x68ef('0x6'));var moment=require('moment');var Redis=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var logger=require(_0x68ef('0x9'))(_0x68ef('0xa'));config['redis']=_['defaults'](config[_0x68ef('0xb')],{'host':_0x68ef('0xc'),'port':0x18eb});var io=require(_0x68ef('0xd'))(new Redis(config['redis']));function emit(_0x228967,_0x31007e,_0x1bee73){io['to'](_0x228967)[_0x68ef('0xe')](_0x31007e,_0x1bee73);}var headers={'Content-Type':_0x68ef('0xf'),'Accept':_0x68ef('0xf')};function getCall(_0x304a60,_0x23da00,_0x1f6747,_0x255c85,_0x3afc1d,_0xfa6763){logger['info'](_0x68ef('0x10'));var _0x46356f=_[_0x68ef('0x11')]({'SMOWNERID':_0x23da00['id'],'Call Type':_0xfa6763||_0x68ef('0x12'),'Call Start Time':(_0xfa6763===_0x68ef('0x13')?_0x3afc1d[_0x68ef('0x14')]:_0x3afc1d['agentcalledAt'])||moment()[_0x68ef('0x15')](_0x68ef('0x16')),'Subject':intUtil[_0x68ef('0x17')](_0x255c85['Subjects'],_0x3afc1d,'\x20'),'Description':intUtil[_0x68ef('0x17')](_0x255c85[_0x68ef('0x18')],_0x3afc1d,'\x0a')},getCustomFields(_0x255c85[_0x68ef('0x19')],_0x3afc1d));switch(_0x3afc1d['lastevent']){case _0x68ef('0x1a'):_0x46356f[_0x68ef('0x1b')]=_0x68ef('0x1c');break;case _0x68ef('0x1d'):case'connect':_0x46356f[_0x68ef('0x1b')]='Answered';break;case'rejected':_0x46356f[_0x68ef('0x1b')]=_0x68ef('0x1e');break;case'abandoned':_0x46356f['Call\x20Result']=_0x68ef('0x1f');break;default:}if(_0x3afc1d[_0x68ef('0x20')]){_0x46356f[_0x68ef('0x21')]=moment['utc'](parseInt(_0x3afc1d[_0x68ef('0x20')])*0x3e8)[_0x68ef('0x15')](_0x68ef('0x22'));}else if(_0x3afc1d['answertime']&&_0x3afc1d[_0x68ef('0x23')]){_0x46356f[_0x68ef('0x21')]=moment['utc'](moment(_0x3afc1d[_0x68ef('0x23')],_0x68ef('0x16'))[_0x68ef('0x24')](moment(_0x3afc1d['starttime'],'YYYY-MM-DD\x20HH:mm:ss')))['format'](_0x68ef('0x22'));}if(_0x1f6747[_0x68ef('0x25')]){_0x46356f[_0x68ef('0x25')]=_0x1f6747[_0x68ef('0x25')];}else if(_0x1f6747[_0x68ef('0x26')]){_0x46356f[_0x68ef('0x27')]=_0x68ef('0x28');_0x46356f[_0x68ef('0x29')]=_0x1f6747[_0x68ef('0x26')];}var _0x13280b='<Calls><row\x20no=\x221\x22>';for(var _0x178460 in _0x46356f){if(_0x46356f['hasOwnProperty'](_0x178460)){_0x13280b+=util['format']('<FL\x20val=\x22%s\x22>%s</FL>',entities[_0x68ef('0x2a')](_0x178460),entities[_0x68ef('0x2a')](_0x46356f[_0x178460]));}}_0x13280b+=_0x68ef('0x2b');return request({'method':_0x68ef('0x2c'),'uri':util['format']('https://crm.%s/crm/private/xml/Calls/insertRecords',_0x304a60[_0x68ef('0x2d')]),'qs':{'authtoken':_0x304a60[_0x68ef('0x2e')],'scope':_0x68ef('0x2f'),'xmlData':_0x13280b},'json':!![]})[_0x68ef('0x30')](function(_0x22ef25){_0x22ef25=JSON[_0x68ef('0x31')](parser[_0x68ef('0x32')](_0x22ef25));if(_0x22ef25[_0x68ef('0x33')]){if(_0x22ef25['response'][_0x68ef('0x34')]&&_0x22ef25[_0x68ef('0x33')][_0x68ef('0x34')]['recorddetail']){logger[_0x68ef('0x35')]('Call\x20created!');return{'id':_0x22ef25[_0x68ef('0x33')][_0x68ef('0x34')]['recorddetail']['FL'][0x0]['$t']};}}throw new Error('Error\x20on\x20call\x20creation:\x20'+JSON[_0x68ef('0x36')](_0x22ef25));});}function getUser(_0x5fa72a,_0x4b8fc8){return request({'method':_0x68ef('0x37'),'uri':util[_0x68ef('0x15')](_0x68ef('0x38'),_0x5fa72a[_0x68ef('0x2d')]),'qs':{'type':'AllUsers','authtoken':_0x5fa72a[_0x68ef('0x2e')],'scope':_0x68ef('0x2f')},'json':!![]})['then'](function(_0x2f8de2){if(_0x2f8de2['users']&&_0x2f8de2[_0x68ef('0x39')][_0x68ef('0x3a')]){var _0x4973c2;if(_0x4b8fc8){_0x4973c2=_[_0x68ef('0x3b')](_0x2f8de2['users'][_0x68ef('0x3a')],{'email':_0x4b8fc8,'profile':'Standard'});}if(_0x4973c2){logger[_0x68ef('0x35')](_0x68ef('0x3c'));}else{logger[_0x68ef('0x35')]('Using\x20the\x20admin\x20account!');_0x4973c2=_[_0x68ef('0x3b')](_0x2f8de2['users'][_0x68ef('0x3a')],{'profile':'Administrator'});}return _0x4973c2;}else{logger[_0x68ef('0x3d')](_0x68ef('0x3e'),JSON[_0x68ef('0x36')](_0x2f8de2));throw new Error(_0x68ef('0x3f')+JSON[_0x68ef('0x36')](_0x2f8de2));}});}function getEndUser(_0xefd1d,_0x51ba3d,_0x294fba){logger[_0x68ef('0x35')](_0x68ef('0x40'),_0x294fba);return request({'method':'GET','uri':util[_0x68ef('0x15')](_0x68ef('0x41'),_0xefd1d[_0x68ef('0x2d')]),'qs':{'authtoken':_0xefd1d['authToken'],'scope':'crmapi','criteria':util[_0x68ef('0x15')](_0x68ef('0x42'),_0x294fba)},'json':!![]})[_0x68ef('0x30')](function(_0x42fc8c){if(_0x42fc8c[_0x68ef('0x33')]&&_0x42fc8c[_0x68ef('0x33')][_0x68ef('0x34')]){logger['info'](_0x68ef('0x43'));var _0xd7f9ca={};var _0x2f6ee0=_0x42fc8c[_0x68ef('0x33')]['result'][_0x68ef('0x44')][_0x68ef('0x45')]['no']?_0x42fc8c[_0x68ef('0x33')][_0x68ef('0x34')][_0x68ef('0x44')][_0x68ef('0x45')]['FL']:_0x42fc8c['response'][_0x68ef('0x34')][_0x68ef('0x44')][_0x68ef('0x45')][0x0]['FL'];for(var _0x43796b=0x0,_0x449f3c=_0x2f6ee0[_0x68ef('0x46')];_0x43796b<_0x449f3c;_0x43796b++){_0xd7f9ca[_0x2f6ee0[_0x43796b][_0x68ef('0x47')]]=_0x2f6ee0[_0x43796b][_0x68ef('0x48')];}return _0xd7f9ca;}else{return request({'method':_0x68ef('0x37'),'uri':util['format'](_0x68ef('0x49'),_0xefd1d[_0x68ef('0x2d')]),'qs':{'authtoken':_0xefd1d[_0x68ef('0x2e')],'scope':_0x68ef('0x2f'),'criteria':util[_0x68ef('0x15')](_0x68ef('0x42'),_0x294fba)},'json':!![]})[_0x68ef('0x30')](function(_0x576767){if(_0x576767[_0x68ef('0x33')]&&_0x576767['response'][_0x68ef('0x34')]){logger[_0x68ef('0x35')](_0x68ef('0x4a'));var _0xfc08d5={};var _0x5a1330=_0x576767[_0x68ef('0x33')]['result'][_0x68ef('0x28')]['row']['no']?_0x576767[_0x68ef('0x33')][_0x68ef('0x34')][_0x68ef('0x28')]['row']['FL']:_0x576767['response'][_0x68ef('0x34')][_0x68ef('0x28')]['row'][0x0]['FL'];for(var _0x589688=0x0,_0x4b4d6b=_0x5a1330[_0x68ef('0x46')];_0x589688<_0x4b4d6b;_0x589688++){_0xfc08d5[_0x5a1330[_0x589688][_0x68ef('0x47')]]=_0x5a1330[_0x589688][_0x68ef('0x48')];}return _0xfc08d5;}else{logger[_0x68ef('0x35')](_0x68ef('0x4b'));_0x51ba3d=getName(_0x51ba3d);return request({'method':'POST','uri':util['format'](_0x68ef('0x4c'),_0xefd1d[_0x68ef('0x2d')]),'qs':{'authtoken':_0xefd1d[_0x68ef('0x2e')],'scope':_0x68ef('0x2f'),'xmlData':util['format'](_0x68ef('0x4d'),entities[_0x68ef('0x2a')](_0x51ba3d[0x0]),entities[_0x68ef('0x2a')](_0x51ba3d[0x1]),_0x294fba)},'json':!![]})[_0x68ef('0x30')](function(_0x53880c){_0x53880c=JSON['parse'](parser[_0x68ef('0x32')](_0x53880c));if(_0x53880c[_0x68ef('0x33')]){if(_0x53880c['response'][_0x68ef('0x34')]&&_0x53880c[_0x68ef('0x33')][_0x68ef('0x34')][_0x68ef('0x4e')]){logger[_0x68ef('0x35')]('Enduser\x20created.');return request({'method':_0x68ef('0x37'),'uri':util[_0x68ef('0x15')](_0x68ef('0x4f'),_0xefd1d['host']),'qs':{'authtoken':_0xefd1d[_0x68ef('0x2e')],'scope':_0x68ef('0x2f'),'id':_0x53880c[_0x68ef('0x33')]['result'][_0x68ef('0x4e')]['FL'][0x0]['$t']},'json':!![]});}}throw new Error('Error\x20on\x20Lead\x20creation:\x20'+JSON['stringify'](_0x53880c));})[_0x68ef('0x30')](function(_0x588072){if(_0x588072[_0x68ef('0x33')]){if(_0x588072[_0x68ef('0x33')][_0x68ef('0x34')]){var _0x1e651f={};for(var _0x2a0be0=0x0,_0x45ae42=_0x588072[_0x68ef('0x33')][_0x68ef('0x34')][_0x68ef('0x28')][_0x68ef('0x45')]['FL']['length'];_0x2a0be0<_0x45ae42;_0x2a0be0++){_0x1e651f[_0x588072['response'][_0x68ef('0x34')][_0x68ef('0x28')][_0x68ef('0x45')]['FL'][_0x2a0be0][_0x68ef('0x47')]]=_0x588072[_0x68ef('0x33')][_0x68ef('0x34')][_0x68ef('0x28')][_0x68ef('0x45')]['FL'][_0x2a0be0][_0x68ef('0x48')];}return _0x1e651f;}}throw new Error('Error\x20on\x20Lead\x20retrieve:\x20'+JSON['stringify'](_0x588072));});}});}});}function request(_0x42a4b2){logger['debug'](_0x68ef('0x50'),JSON['stringify'](_0x42a4b2));return rp(_0x42a4b2);}function getCustomFields(_0x1b2436,_0x413df4){var _0x552736={};if(_0x1b2436[_0x68ef('0x46')]>0x0){_['forEach'](_0x1b2436,function(_0x407c6d){if(_0x407c6d[_0x68ef('0x51')]===_0x68ef('0x52')&&_0x407c6d[_0x68ef('0x53')]){_0x552736[_0x407c6d[_0x68ef('0x53')]]=_0x407c6d[_0x68ef('0x48')]['toString']();}else if(_0x407c6d[_0x68ef('0x51')]===_0x68ef('0x54')&&_0x407c6d[_0x68ef('0x55')]&&_0x407c6d[_0x68ef('0x53')]&&_0x413df4[_0x407c6d[_0x68ef('0x55')]]){_0x552736[_0x407c6d[_0x68ef('0x53')]]=_0x413df4[_0x407c6d['variableName']][_0x68ef('0x56')]();}else if(_0x407c6d[_0x68ef('0x51')]==='customVariable'&&_0x407c6d[_0x68ef('0x57')]&&_0x407c6d[_0x68ef('0x57')][_0x68ef('0x58')]&&_0x407c6d['idField']&&_0x413df4[_0x407c6d[_0x68ef('0x57')]['name']['toLowerCase']()]){_0x552736[_0x407c6d[_0x68ef('0x53')]]=_0x413df4[_0x407c6d['Variable'][_0x68ef('0x58')]['toLowerCase']()][_0x68ef('0x56')]();}});}return _0x552736;}function getName(_0x9e8554){if(_0x9e8554[_0x68ef('0x59')]('\x20')>0x0){var _0x3fbd39=_0x9e8554[_0x68ef('0x5a')](/ (.+)/);if(_0x3fbd39[0x1]){return _0x3fbd39;}}return[_0x9e8554,_0x9e8554];}exports[_0x68ef('0x5b')]=function(_0x4dc271,_0xfc27a8,_0x4ed1eb,_0x2cbd99,_0x4b0c3e,_0x2f97c5){var _0x17700a,_0x212ec4;_0x2f97c5[_0x68ef('0x2d')]=intUtil[_0x68ef('0x5c')](_0x2f97c5[_0x68ef('0x2d')]);_0x2f97c5[_0x68ef('0x5d')]=intUtil['stripTrailingSlash'](_0x2f97c5[_0x68ef('0x5d')]);if(_0x4b0c3e&&_0x4b0c3e[_0x68ef('0x5e')]){logger[_0x68ef('0x35')](_0x68ef('0x5f'),_0x68ef('0x60'));_0xfc27a8['recordingURL']=util[_0x68ef('0x15')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2f97c5[_0x68ef('0x5d')],_0xfc27a8['uniqueid'],md5(_0xfc27a8['uniqueid']));}else{_0xfc27a8[_0x68ef('0x61')]='';}return getUser(_0x2f97c5,_0x2cbd99[_0x68ef('0x62')])[_0x68ef('0x30')](function(_0x21b2ce){_0x17700a=_0x21b2ce;logger['info'](_0x68ef('0x63'),_0x17700a['id']);return getEndUser(_0x2f97c5,_0xfc27a8['calleridname'],_0xfc27a8[_0x68ef('0x64')]);})[_0x68ef('0x30')](function(_0x25a126){_0x212ec4=_0x25a126;logger['info']('The\x20Enduser\x20ID\x20is:',_0x212ec4[_0x68ef('0x25')]||_0x212ec4[_0x68ef('0x26')]);return getCall(_0x2f97c5,_0x17700a,_0x212ec4,_0x4ed1eb,_0xfc27a8,_0x68ef('0x65'));})[_0x68ef('0x30')](function(_0x5b41e1){if(_0x5b41e1){logger[_0x68ef('0x35')](_0x68ef('0x66'),_0x5b41e1['id']);logger[_0x68ef('0x35')](_0x68ef('0x5f'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x68ef('0x15')]('user:%s',_0x2cbd99[_0x68ef('0x58')]),_0x68ef('0x67'),{'uri':util[_0x68ef('0x15')](_0x68ef('0x68'),_0x2f97c5[_0x68ef('0x2d')],_0x5b41e1['id'])});}})['catch'](function(_0x24285){logger[_0x68ef('0x3d')](_0x68ef('0x5f'),JSON['stringify'](_0x24285));});};exports[_0x68ef('0x13')]=function(_0x4de108,_0x69b1c,_0x535f65,_0x4c70c0,_0x100345,_0x1a3117,_0x38c117){var _0x405971,_0x501004;_0x1a3117[_0x68ef('0x2d')]=intUtil[_0x68ef('0x5c')](_0x1a3117[_0x68ef('0x2d')]);_0x1a3117['serverUrl']=intUtil[_0x68ef('0x5c')](_0x1a3117[_0x68ef('0x5d')]);if(_0x38c117&&_0x38c117[_0x68ef('0x69')]&&_0x38c117[_0x68ef('0x69')]!==_0x68ef('0x6a')){logger[_0x68ef('0x35')](_0x68ef('0x6b'),_0x68ef('0x60'));_0x69b1c[_0x68ef('0x61')]=util[_0x68ef('0x15')](_0x68ef('0x6c'),_0x1a3117[_0x68ef('0x5d')],_0x69b1c['uniqueid'],md5(_0x69b1c[_0x68ef('0x6d')]));}return getUser(_0x1a3117,_0x4c70c0[_0x68ef('0x62')])['then'](function(_0x513c69){_0x405971=_0x513c69;logger[_0x68ef('0x35')]('The\x20User\x20ID\x20is:',_0x405971['id']);return getEndUser(_0x1a3117,_0x69b1c[_0x68ef('0x6e')],_0x69b1c[_0x68ef('0x6f')]);})['then'](function(_0x4e0874){_0x501004=_0x4e0874;logger[_0x68ef('0x35')]('The\x20Enduser\x20ID\x20is:',_0x501004[_0x68ef('0x25')]||_0x501004['LEADID']);return getCall(_0x1a3117,_0x405971,_0x501004,_0x535f65,_0x69b1c,_0x68ef('0x70'));})['then'](function(_0x21ab5d){if(_0x21ab5d){logger[_0x68ef('0x35')]('The\x20Call\x20ID\x20is:',_0x21ab5d['id']);logger[_0x68ef('0x35')](_0x68ef('0x6b'),_0x68ef('0x71'));emit(util[_0x68ef('0x15')]('user:%s',_0x4c70c0[_0x68ef('0x58')]),_0x68ef('0x67'),{'uri':util['format'](_0x68ef('0x68'),_0x1a3117[_0x68ef('0x2d')],_0x21ab5d['id'])});}})[_0x68ef('0x72')](function(_0x4de1d1){logger[_0x68ef('0x3d')]('[OUTBOUND]',JSON[_0x68ef('0x36')](_0x4de1d1));});};exports[_0x68ef('0x73')]=function(_0x4f1a65,_0x4b0fb4,_0x51101a,_0x564ef7,_0x4370b1,_0x28ad22){var _0x1217f9,_0x41a657;_0x28ad22[_0x68ef('0x2d')]=intUtil[_0x68ef('0x5c')](_0x28ad22[_0x68ef('0x2d')]);_0x28ad22[_0x68ef('0x5d')]=intUtil[_0x68ef('0x5c')](_0x28ad22[_0x68ef('0x5d')]);if(_0x4370b1&&_0x4370b1[_0x68ef('0x5e')]){logger[_0x68ef('0x35')](_0x68ef('0x74'),'Recording\x20is\x20enabled!');_0x4b0fb4[_0x68ef('0x61')]=util['format'](_0x68ef('0x6c'),_0x28ad22['serverUrl'],_0x4b0fb4['uniqueid'],md5(_0x4b0fb4[_0x68ef('0x6d')]));}else{_0x4b0fb4[_0x68ef('0x61')]='';}return getUser(_0x28ad22)[_0x68ef('0x30')](function(_0x2a0247){_0x1217f9=_0x2a0247;logger['info']('The\x20User\x20ID\x20is:',_0x1217f9['id']);return getEndUser(_0x28ad22,_0x4b0fb4[_0x68ef('0x75')],_0x4b0fb4[_0x68ef('0x64')]);})[_0x68ef('0x30')](function(_0x4823fa){_0x41a657=_0x4823fa;logger[_0x68ef('0x35')](_0x68ef('0x76'),_0x41a657[_0x68ef('0x25')]||_0x41a657[_0x68ef('0x26')]);return getCall(_0x28ad22,_0x1217f9,_0x41a657,_0x51101a,_0x4b0fb4,'Inbound');})[_0x68ef('0x30')](function(_0x1d158f){if(_0x1d158f){logger[_0x68ef('0x35')](_0x68ef('0x66'),_0x1d158f['id']);}})[_0x68ef('0x72')](function(_0x346049){logger['error'](_0x68ef('0x74'),JSON['stringify'](_0x346049));});};
\ No newline at end of file
index e30c0c8..6ed3f4f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1ff5=['statusCode','name','message','request-promise','util','../../../../config/logger','exec','data1','render','toUpperCase','GET','data7','info','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20body:\x20%s','body','data2'];(function(_0x1c875b,_0x1d6fb5){var _0x41ddc7=function(_0xe61e59){while(--_0xe61e59){_0x1c875b['push'](_0x1c875b['shift']());}};_0x41ddc7(++_0x1d6fb5);}(_0x1ff5,0x179));var _0x51ff=function(_0x158dc2,_0x2bf7b5){_0x158dc2=_0x158dc2-0x0;var _0x209fdf=_0x1ff5[_0x158dc2];return _0x209fdf;};'use strict';var rp=require(_0x51ff('0x0'));var util=require(_0x51ff('0x1'));var Mustache=require('mustache');var logger=require(_0x51ff('0x2'))('trigger');exports[_0x51ff('0x3')]=function(_0x226b78,_0xae6c76){var _0x3ac836={'method':_0x226b78[_0x51ff('0x4')]['toUpperCase'](),'uri':encodeURI(Mustache[_0x51ff('0x5')](_0x226b78['data2'],_0xae6c76)),'json':!![],'resolveWithFullResponse':!![]};switch(_0x226b78[_0x51ff('0x4')][_0x51ff('0x6')]()){case _0x51ff('0x7'):_0x3ac836['qs']=_0xae6c76;break;case'POST':_0x3ac836['body']=_0x226b78[_0x51ff('0x8')]?Mustache[_0x51ff('0x5')](_0x226b78['data7'],_0xae6c76):_0xae6c76;break;}rp(_0x3ac836)['then'](function(_0x499dd4){logger[_0x51ff('0x9')](util[_0x51ff('0xa')](_0x51ff('0xb'),_0x226b78['data1'],_0x226b78['data2'],_0x499dd4['statusCode'],_0x499dd4[_0x51ff('0xc')]));})['catch'](function(_0x2b7790){logger['error'](util[_0x51ff('0xa')]('%s\x20%s\x20%s\x20[%s]:%s',_0x226b78[_0x51ff('0x4')],_0x226b78[_0x51ff('0xd')],_0x2b7790[_0x51ff('0xe')],_0x2b7790[_0x51ff('0xf')],_0x2b7790[_0x51ff('0x10')]));});};
\ No newline at end of file
+var _0xbd25=['data2','POST','body','data7','render','then','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20body:\x20%s','statusCode','catch','error','format','%s\x20%s\x20%s\x20[%s]:%s','name','request-promise','util','../../../../config/logger','trigger','data1','toUpperCase'];(function(_0x435ac7,_0x21908e){var _0x2d4802=function(_0xb71326){while(--_0xb71326){_0x435ac7['push'](_0x435ac7['shift']());}};_0x2d4802(++_0x21908e);}(_0xbd25,0xea));var _0x5bd2=function(_0x5240b7,_0x9b32db){_0x5240b7=_0x5240b7-0x0;var _0x54bc2a=_0xbd25[_0x5240b7];return _0x54bc2a;};'use strict';var rp=require(_0x5bd2('0x0'));var util=require(_0x5bd2('0x1'));var Mustache=require('mustache');var logger=require(_0x5bd2('0x2'))(_0x5bd2('0x3'));exports['exec']=function(_0x236a18,_0x2e89da){var _0x55a4fb={'method':_0x236a18[_0x5bd2('0x4')][_0x5bd2('0x5')](),'uri':encodeURI(Mustache['render'](_0x236a18[_0x5bd2('0x6')],_0x2e89da)),'json':!![],'resolveWithFullResponse':!![]};switch(_0x236a18['data1']['toUpperCase']()){case'GET':_0x55a4fb['qs']=_0x2e89da;break;case _0x5bd2('0x7'):_0x55a4fb[_0x5bd2('0x8')]=_0x236a18[_0x5bd2('0x9')]?Mustache[_0x5bd2('0xa')](_0x236a18['data7'],_0x2e89da):_0x2e89da;break;}rp(_0x55a4fb)[_0x5bd2('0xb')](function(_0x5c91ff){logger[_0x5bd2('0xc')](util['format'](_0x5bd2('0xd'),_0x236a18[_0x5bd2('0x4')],_0x236a18[_0x5bd2('0x6')],_0x5c91ff[_0x5bd2('0xe')],_0x5c91ff[_0x5bd2('0x8')]));})[_0x5bd2('0xf')](function(_0x562c35){logger[_0x5bd2('0x10')](util[_0x5bd2('0x11')](_0x5bd2('0x12'),_0x236a18['data1'],_0x236a18[_0x5bd2('0x6')],_0x562c35[_0x5bd2('0xe')],_0x562c35[_0x5bd2('0x13')],_0x562c35['message']));});};
\ No newline at end of file
index 873e75f..b865b5d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4fef=['routing','http','Request','request','then','debug','rpc','error','message','catch','exports','jayson/promise','bluebird'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x4fef,0x10f));var _0xf4fe=function(_0x1fc4ef,_0x5f084f){_0x1fc4ef=_0x1fc4ef-0x0;var _0x2e36f3=_0x4fef[_0x1fc4ef];return _0x2e36f3;};'use strict';var jayson=require(_0xf4fe('0x0'));var BPromise=require(_0xf4fe('0x1'));var logger=require('../../config/logger')(_0xf4fe('0x2'));var client=jayson['client'][_0xf4fe('0x3')]({'port':0x2329});client[_0xf4fe('0x4')]=function(_0x3c78db,_0x1e5ec2){return new BPromise(function(_0x5c5dbb,_0x7bf3fe){return client[_0xf4fe('0x5')](_0x3c78db,_0x1e5ec2)[_0xf4fe('0x6')](function(_0x522427){logger[_0xf4fe('0x7')](_0xf4fe('0x8'),'routing',_0x3c78db,_0x1e5ec2,_0x522427);if(_0x522427[_0xf4fe('0x9')]){logger[_0xf4fe('0x9')](_0xf4fe('0x8'),_0xf4fe('0x2'),_0x3c78db,_0x522427[_0xf4fe('0x9')][_0xf4fe('0xa')],_0x1e5ec2);return _0x7bf3fe(_0x522427[_0xf4fe('0x9')][_0xf4fe('0xa')]);}else{return _0x5c5dbb(_0x522427['result']);}})[_0xf4fe('0xb')](function(_0x49d480){logger[_0xf4fe('0x9')](_0xf4fe('0x8'),_0xf4fe('0x2'),_0x3c78db,_0x49d480,_0x1e5ec2);return _0x7bf3fe(_0x49d480);});});};module[_0xf4fe('0xc')]=client;
\ No newline at end of file
+var _0x826a=['debug','rpc','error','message','result','exports','bluebird','routing','http','Request','request','then'];(function(_0x528fd5,_0x116c22){var _0x43f1f8=function(_0x4e2af8){while(--_0x4e2af8){_0x528fd5['push'](_0x528fd5['shift']());}};_0x43f1f8(++_0x116c22);}(_0x826a,0x1aa));var _0xa826=function(_0x727e9a,_0xa84e3d){_0x727e9a=_0x727e9a-0x0;var _0x4a1baf=_0x826a[_0x727e9a];return _0x4a1baf;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xa826('0x0'));var logger=require('../../config/logger')(_0xa826('0x1'));var client=jayson['client'][_0xa826('0x2')]({'port':0x2329});client[_0xa826('0x3')]=function(_0x2212a4,_0x34e1ad){return new BPromise(function(_0x5372ab,_0x30875f){return client[_0xa826('0x4')](_0x2212a4,_0x34e1ad)[_0xa826('0x5')](function(_0x34327b){logger[_0xa826('0x6')](_0xa826('0x7'),_0xa826('0x1'),_0x2212a4,_0x34e1ad,_0x34327b);if(_0x34327b[_0xa826('0x8')]){logger[_0xa826('0x8')](_0xa826('0x7'),_0xa826('0x1'),_0x2212a4,_0x34327b[_0xa826('0x8')][_0xa826('0x9')],_0x34e1ad);return _0x30875f(_0x34327b[_0xa826('0x8')][_0xa826('0x9')]);}else{return _0x5372ab(_0x34327b[_0xa826('0xa')]);}})['catch'](function(_0xbd22fc){logger['error'](_0xa826('0x7'),_0xa826('0x1'),_0x2212a4,_0xbd22fc,_0x34e1ad);return _0x30875f(_0xbd22fc);});});};module[_0xa826('0xb')]=client;
\ No newline at end of file
index 875593b..a78eb98 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8e97=['resolve','getMailAccounts','then','initMailAccounts','refresh','mailAccounts','listen','catch','log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount'];(function(_0x4bfb94,_0x57e844){var _0x55bde6=function(_0x2ea3c1){while(--_0x2ea3c1){_0x4bfb94['push'](_0x4bfb94['shift']());}};_0x55bde6(++_0x57e844);}(_0x8e97,0x6b));var _0x78e9=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8e97[_0x4565bf];return _0x5610ba;};'use strict';var BPromise=require(_0x78e9('0x0'));var server=require(_0x78e9('0x1'));var Realtime=require(_0x78e9('0x2'));var EmailChannel=require(_0x78e9('0x3'));var mailAccount=require(_0x78e9('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x78e9('0x5')]()['then'](mailAccount[_0x78e9('0x6')]())[_0x78e9('0x7')](realtime[_0x78e9('0x8')]())['then'](function(){email[_0x78e9('0x9')](realtime[_0x78e9('0xa')]);return realtime;});}function main(){return server[_0x78e9('0xb')](realtime,email)[_0x78e9('0x7')](function(_0x5d024f){return initRealtime();})[_0x78e9('0x7')](function(_0x95c714){return setInterval(initRealtime,0x2710);})[_0x78e9('0xc')](function(_0x220a2a){console[_0x78e9('0xd')](_0x220a2a);});}main();
\ No newline at end of file
+var _0xa5a6=['./lib/email','./rpc/mailAccount','resolve','then','initMailAccounts','refresh','listen','catch','log','bluebird','./server','./realtime'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa5a6,0x1b9));var _0x6a5a=function(_0x45e647,_0x2c482c){_0x45e647=_0x45e647-0x0;var _0x2deace=_0xa5a6[_0x45e647];return _0x2deace;};'use strict';var BPromise=require(_0x6a5a('0x0'));var server=require(_0x6a5a('0x1'));var Realtime=require(_0x6a5a('0x2'));var EmailChannel=require(_0x6a5a('0x3'));var mailAccount=require(_0x6a5a('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x6a5a('0x5')]()['then'](mailAccount['getMailAccounts']())[_0x6a5a('0x6')](realtime[_0x6a5a('0x7')]())[_0x6a5a('0x6')](function(){email[_0x6a5a('0x8')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x6a5a('0x9')](realtime,email)[_0x6a5a('0x6')](function(_0x176050){return initRealtime();})['then'](function(_0x305606){return setInterval(initRealtime,0x2710);})[_0x6a5a('0xa')](function(_0x1ee39d){console[_0x6a5a('0xb')](_0x1ee39d);});}main();
\ No newline at end of file
index 17c722a..b5c9ea5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbd10=['email','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','isNil','disabled','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','then','verified','verify','exports','lodash','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','total','stringify','md5','refresh','hasOwnProperty'];(function(_0x28c91d,_0x3e761e){var _0x1d31aa=function(_0x5ea2c0){while(--_0x5ea2c0){_0x28c91d['push'](_0x28c91d['shift']());}};_0x1d31aa(++_0x3e761e);}(_0xbd10,0x85));var _0x0bd1=function(_0x404364,_0x40ca63){_0x404364=_0x404364-0x0;var _0x146fe3=_0xbd10[_0x404364];return _0x146fe3;};'use strict';var _=require(_0x0bd1('0x0'));var moment=require(_0x0bd1('0x1'));var BPromise=require(_0x0bd1('0x2'));var md5=require('md5');var Redis=require(_0x0bd1('0x3'));var config=require(_0x0bd1('0x4'));var logger=require(_0x0bd1('0x5'))('email');config[_0x0bd1('0x6')]=_[_0x0bd1('0x7')](config[_0x0bd1('0x6')],{'host':_0x0bd1('0x8'),'port':0x18eb});var io=require(_0x0bd1('0x9'))(new Redis(config[_0x0bd1('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x0bd1('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x639350){logger[_0x0bd1('0xb')](_0x0bd1('0xc'));this[_0x0bd1('0xd')]=_0x639350['mailAccounts'];this[_0x0bd1('0xe')]={};this[_0x0bd1('0xf')]=new EmailSmtp();}EmailChannel[_0x0bd1('0x10')][_0x0bd1('0x11')]=function(_0x154b4f){var _0x216523=this['mailAccounts'][_0x154b4f];var _0x159b15={'id':_0x216523['id'],'name':_0x216523[_0x0bd1('0x12')],'key':_0x216523[_0x0bd1('0x13')],'active':_0x216523[_0x0bd1('0x14')],'Imap':{'status':_0x216523[_0x0bd1('0x15')][_0x0bd1('0x16')],'messageStatus':_0x216523['Imap'][_0x0bd1('0x17')],'total':_0x216523[_0x0bd1('0x15')][_0x0bd1('0x18')]}};if(_['isNil'](md5Accounts[_0x154b4f])){md5Accounts[_0x154b4f]={};}var _0x51f988=md5(JSON[_0x0bd1('0x19')](_0x159b15));if(md5Accounts[_0x154b4f][_0x0bd1('0x1a')]!==_0x51f988){md5Accounts[_0x154b4f][_0x0bd1('0x1a')]=_0x51f988;io['emit']('mailAccount:update',_0x159b15);}};EmailChannel[_0x0bd1('0x10')][_0x0bd1('0x1b')]=function(_0xc96c4d){for(var _0x5ab359 in _0xc96c4d){if(_0xc96c4d[_0x0bd1('0x1c')](_0x5ab359)){if(_0xc96c4d[_0x5ab359][_0x0bd1('0x15')]&&_0xc96c4d[_0x5ab359][_0x0bd1('0x14')]){var _0x3042c6=_0xc96c4d[_0x5ab359]['Imap'];if(!this[_0x0bd1('0xe')][_0x0bd1('0x1c')](_0x3042c6['id'])){this['imapAccounts'][_0x3042c6['id']]=new EmailImap(_0x3042c6,_0xc96c4d[_0x5ab359][_0x0bd1('0x1d')]);this[_0x0bd1('0xe')][_0x3042c6['id']]['on']('box',this['handleImapBox'][_0x0bd1('0x1e')](this,_0x5ab359));this[_0x0bd1('0xe')][_0x3042c6['id']]['on'](_0x0bd1('0x1d'),this[_0x0bd1('0x1f')][_0x0bd1('0x1e')](this,_0x5ab359));this[_0x0bd1('0xe')][_0x3042c6['id']]['on'](_0x0bd1('0x20'),this[_0x0bd1('0x21')]['bind'](this,_0x5ab359));this[_0x0bd1('0xe')][_0x3042c6['id']]['on'](_0x0bd1('0x22'),this[_0x0bd1('0x23')][_0x0bd1('0x1e')](this,_0x5ab359));}}else{if(_[_0x0bd1('0x24')](this['mailAccounts'][_0x5ab359][_0x0bd1('0x15')])){this['mailAccounts'][_0x5ab359]['Imap']={};}this[_0x0bd1('0xd')][_0x5ab359][_0x0bd1('0x15')][_0x0bd1('0x16')]=_0x0bd1('0x25');this[_0x0bd1('0xd')][_0x5ab359][_0x0bd1('0x15')][_0x0bd1('0x17')]='';this[_0x0bd1('0x11')](_0x5ab359);}}}};EmailChannel[_0x0bd1('0x10')]['handleImapBox']=function(_0x5cb236,_0x3250f6){if(this['mailAccounts'][_0x5cb236]){this[_0x0bd1('0xd')][_0x5cb236][_0x0bd1('0x15')]['status']='connected';this['mailAccounts'][_0x5cb236]['Imap']['messageStatus']=_0x3250f6[_0x0bd1('0x12')];if(_0x3250f6[_0x0bd1('0x26')]){this[_0x0bd1('0xd')][_0x5cb236]['Imap'][_0x0bd1('0x18')]=_0x3250f6[_0x0bd1('0x26')]['total'];}return this['emit'](_0x5cb236);}};EmailChannel[_0x0bd1('0x10')]['handleImapEmail']=function(_0x5366c4,_0x47980f){logger[_0x0bd1('0xb')](_0x0bd1('0x27'),_0x47980f[_0x0bd1('0x28')],_0x47980f['lastName'],_0x47980f[_0x0bd1('0x29')],_0x5366c4);if(this[_0x0bd1('0xd')][_0x5366c4]){return mailAccount['notify'](_0x5366c4,_0x47980f)['then'](function(_0x28877b){if(_0x28877b){logger['info'](_0x0bd1('0x2a'));}})[_0x0bd1('0x2b')](function(_0x5dbab4){logger[_0x0bd1('0x22')](_0x0bd1('0x2c'),JSON[_0x0bd1('0x19')](_0x5dbab4));});}};EmailChannel['prototype'][_0x0bd1('0x21')]=function(_0x4e79f4){if(this[_0x0bd1('0xd')][_0x4e79f4]&&this[_0x0bd1('0xd')][_0x4e79f4][_0x0bd1('0x15')]){if(this[_0x0bd1('0xe')][this['mailAccounts'][_0x4e79f4][_0x0bd1('0x15')]['id']]){delete this[_0x0bd1('0xe')][this[_0x0bd1('0xd')][_0x4e79f4][_0x0bd1('0x15')]['id']];}this[_0x0bd1('0xd')][_0x4e79f4][_0x0bd1('0x15')][_0x0bd1('0x2d')]=moment();this['emit'](_0x4e79f4);}};EmailChannel[_0x0bd1('0x10')][_0x0bd1('0x23')]=function(_0x488310,_0x224159){if(this[_0x0bd1('0xd')][_0x488310]){this[_0x0bd1('0xd')][_0x488310][_0x0bd1('0x15')][_0x0bd1('0x16')]=_0x0bd1('0x22');this[_0x0bd1('0xd')][_0x488310][_0x0bd1('0x15')][_0x0bd1('0x17')]=_0x224159;return this[_0x0bd1('0x11')](_0x488310);}};EmailChannel[_0x0bd1('0x10')][_0x0bd1('0x2e')]=function(_0x41ee78,_0x217c77){return this[_0x0bd1('0xf')][_0x0bd1('0x2f')](_0x41ee78,_0x217c77);};EmailChannel[_0x0bd1('0x10')][_0x0bd1('0x30')]=function(_0x54e3aa){var _0x5246fd=this;if(this[_0x0bd1('0xd')][_0x54e3aa['id']]){if(_[_0x0bd1('0x24')](this[_0x0bd1('0xd')][_0x54e3aa['id']][_0x0bd1('0x31')])){this[_0x0bd1('0xd')][_0x54e3aa['id']][_0x0bd1('0x31')]={};}this['mailAccounts'][_0x54e3aa['id']]['Smtp'][_0x0bd1('0x2d')]=moment();return new BPromise(function(_0x469905,_0x22c0b2){return _0x5246fd[_0x0bd1('0xf')]['verify'](_0x54e3aa)[_0x0bd1('0x32')](function(_0x5581da){_0x5246fd[_0x0bd1('0xd')][_0x54e3aa['id']]['Smtp'][_0x0bd1('0x16')]=_0x0bd1('0x33');_0x5246fd[_0x0bd1('0xd')][_0x54e3aa['id']][_0x0bd1('0x31')]['messageStatus']='';_0x5246fd[_0x0bd1('0x11')](_0x54e3aa['id']);_0x469905(_0x5581da);})[_0x0bd1('0x2b')](function(_0x3ac038){_0x5246fd['mailAccounts'][_0x54e3aa['id']][_0x0bd1('0x31')][_0x0bd1('0x16')]=_0x0bd1('0x22');_0x5246fd[_0x0bd1('0xd')][_0x54e3aa['id']][_0x0bd1('0x31')][_0x0bd1('0x17')]=_0x3ac038;_0x5246fd[_0x0bd1('0x11')](_0x54e3aa['id']);_0x22c0b2(_0x3ac038);});});}return this[_0x0bd1('0xf')][_0x0bd1('0x34')](_0x54e3aa);};module[_0x0bd1('0x35')]=EmailChannel;
\ No newline at end of file
+var _0x27a0=['bluebird','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','./imap','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','emit','name','key','active','Imap','status','total','isNil','stringify','prototype','email','handleImapBox','end','handleImapEnd','bind','handleImapError','disabled','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','messageStatus','verifySmtp','Smtp','verify','verified','exports','moment'];(function(_0x14bf66,_0x3e1066){var _0xaf4bf7=function(_0x3d9c3f){while(--_0x3d9c3f){_0x14bf66['push'](_0x14bf66['shift']());}};_0xaf4bf7(++_0x3e1066);}(_0x27a0,0xbf));var _0x027a=function(_0x5f5bae,_0x167fb6){_0x5f5bae=_0x5f5bae-0x0;var _0x3422e8=_0x27a0[_0x5f5bae];return _0x3422e8;};'use strict';var _=require('lodash');var moment=require(_0x027a('0x0'));var BPromise=require(_0x027a('0x1'));var md5=require(_0x027a('0x2'));var Redis=require(_0x027a('0x3'));var config=require(_0x027a('0x4'));var logger=require('../../../config/logger')('email');config['redis']=_['defaults'](config[_0x027a('0x5')],{'host':_0x027a('0x6'),'port':0x18eb});var io=require(_0x027a('0x7'))(new Redis(config[_0x027a('0x5')]));var EmailImap=require(_0x027a('0x8'));var EmailSmtp=require(_0x027a('0x9'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x3d1429){logger[_0x027a('0xa')](_0x027a('0xb'));this['mailAccounts']=_0x3d1429[_0x027a('0xc')];this[_0x027a('0xd')]={};this[_0x027a('0xe')]=new EmailSmtp();}EmailChannel['prototype'][_0x027a('0xf')]=function(_0xe5df59){var _0x7daf8a=this[_0x027a('0xc')][_0xe5df59];var _0x172eb4={'id':_0x7daf8a['id'],'name':_0x7daf8a[_0x027a('0x10')],'key':_0x7daf8a[_0x027a('0x11')],'active':_0x7daf8a[_0x027a('0x12')],'Imap':{'status':_0x7daf8a[_0x027a('0x13')][_0x027a('0x14')],'messageStatus':_0x7daf8a[_0x027a('0x13')]['messageStatus'],'total':_0x7daf8a[_0x027a('0x13')][_0x027a('0x15')]}};if(_[_0x027a('0x16')](md5Accounts[_0xe5df59])){md5Accounts[_0xe5df59]={};}var _0x21da53=md5(JSON[_0x027a('0x17')](_0x172eb4));if(md5Accounts[_0xe5df59]['md5']!==_0x21da53){md5Accounts[_0xe5df59]['md5']=_0x21da53;io[_0x027a('0xf')]('mailAccount:update',_0x172eb4);}};EmailChannel[_0x027a('0x18')]['refresh']=function(_0x432007){for(var _0x5a1224 in _0x432007){if(_0x432007['hasOwnProperty'](_0x5a1224)){if(_0x432007[_0x5a1224]['Imap']&&_0x432007[_0x5a1224][_0x027a('0x12')]){var _0x2f04e9=_0x432007[_0x5a1224][_0x027a('0x13')];if(!this[_0x027a('0xd')]['hasOwnProperty'](_0x2f04e9['id'])){this[_0x027a('0xd')][_0x2f04e9['id']]=new EmailImap(_0x2f04e9,_0x432007[_0x5a1224][_0x027a('0x19')]);this['imapAccounts'][_0x2f04e9['id']]['on']('box',this[_0x027a('0x1a')]['bind'](this,_0x5a1224));this[_0x027a('0xd')][_0x2f04e9['id']]['on']('email',this['handleImapEmail']['bind'](this,_0x5a1224));this['imapAccounts'][_0x2f04e9['id']]['on'](_0x027a('0x1b'),this[_0x027a('0x1c')][_0x027a('0x1d')](this,_0x5a1224));this[_0x027a('0xd')][_0x2f04e9['id']]['on']('error',this[_0x027a('0x1e')][_0x027a('0x1d')](this,_0x5a1224));}}else{if(_[_0x027a('0x16')](this[_0x027a('0xc')][_0x5a1224][_0x027a('0x13')])){this[_0x027a('0xc')][_0x5a1224]['Imap']={};}this[_0x027a('0xc')][_0x5a1224]['Imap'][_0x027a('0x14')]=_0x027a('0x1f');this[_0x027a('0xc')][_0x5a1224][_0x027a('0x13')]['messageStatus']='';this['emit'](_0x5a1224);}}}};EmailChannel[_0x027a('0x18')][_0x027a('0x1a')]=function(_0x338141,_0x129d5f){if(this['mailAccounts'][_0x338141]){this[_0x027a('0xc')][_0x338141]['Imap'][_0x027a('0x14')]='connected';this[_0x027a('0xc')][_0x338141]['Imap']['messageStatus']=_0x129d5f[_0x027a('0x10')];if(_0x129d5f['messages']){this['mailAccounts'][_0x338141][_0x027a('0x13')]['total']=_0x129d5f[_0x027a('0x20')]['total'];}return this[_0x027a('0xf')](_0x338141);}};EmailChannel[_0x027a('0x18')]['handleImapEmail']=function(_0xe4ea7d,_0x4b4ac4){logger[_0x027a('0xa')](_0x027a('0x21'),_0x4b4ac4[_0x027a('0x22')],_0x4b4ac4[_0x027a('0x23')],_0x4b4ac4[_0x027a('0x24')],_0xe4ea7d);if(this[_0x027a('0xc')][_0xe4ea7d]){return mailAccount['notify'](_0xe4ea7d,_0x4b4ac4)[_0x027a('0x25')](function(_0x592350){if(_0x592350){logger[_0x027a('0xa')]('Mail\x20accepted\x20from\x20routing');}})[_0x027a('0x26')](function(_0x40c4fe){logger[_0x027a('0x27')](_0x027a('0x28'),JSON[_0x027a('0x17')](_0x40c4fe));});}};EmailChannel['prototype'][_0x027a('0x1c')]=function(_0x26e716){if(this[_0x027a('0xc')][_0x26e716]&&this[_0x027a('0xc')][_0x26e716][_0x027a('0x13')]){if(this[_0x027a('0xd')][this[_0x027a('0xc')][_0x26e716][_0x027a('0x13')]['id']]){delete this[_0x027a('0xd')][this[_0x027a('0xc')][_0x26e716][_0x027a('0x13')]['id']];}this['mailAccounts'][_0x26e716][_0x027a('0x13')][_0x027a('0x29')]=moment();this[_0x027a('0xf')](_0x26e716);}};EmailChannel[_0x027a('0x18')][_0x027a('0x1e')]=function(_0x163dce,_0x2378b9){if(this['mailAccounts'][_0x163dce]){this[_0x027a('0xc')][_0x163dce][_0x027a('0x13')][_0x027a('0x14')]='error';this[_0x027a('0xc')][_0x163dce]['Imap'][_0x027a('0x2a')]=_0x2378b9;return this[_0x027a('0xf')](_0x163dce);}};EmailChannel[_0x027a('0x18')]['sendMail']=function(_0x4f5140,_0x32a44e){return this[_0x027a('0xe')]['send'](_0x4f5140,_0x32a44e);};EmailChannel[_0x027a('0x18')][_0x027a('0x2b')]=function(_0x3094f8){var _0x1b173e=this;if(this[_0x027a('0xc')][_0x3094f8['id']]){if(_[_0x027a('0x16')](this[_0x027a('0xc')][_0x3094f8['id']][_0x027a('0x2c')])){this[_0x027a('0xc')][_0x3094f8['id']][_0x027a('0x2c')]={};}this[_0x027a('0xc')][_0x3094f8['id']][_0x027a('0x2c')][_0x027a('0x29')]=moment();return new BPromise(function(_0x163783,_0x466c80){return _0x1b173e[_0x027a('0xe')][_0x027a('0x2d')](_0x3094f8)['then'](function(_0x275692){_0x1b173e[_0x027a('0xc')][_0x3094f8['id']][_0x027a('0x2c')][_0x027a('0x14')]=_0x027a('0x2e');_0x1b173e[_0x027a('0xc')][_0x3094f8['id']]['Smtp'][_0x027a('0x2a')]='';_0x1b173e[_0x027a('0xf')](_0x3094f8['id']);_0x163783(_0x275692);})['catch'](function(_0x45eedc){_0x1b173e['mailAccounts'][_0x3094f8['id']]['Smtp'][_0x027a('0x14')]='error';_0x1b173e[_0x027a('0xc')][_0x3094f8['id']][_0x027a('0x2c')][_0x027a('0x2a')]=_0x45eedc;_0x1b173e[_0x027a('0xf')](_0x3094f8['id']);_0x466c80(_0x45eedc);});});}return this[_0x027a('0xe')]['verify'](_0x3094f8);};module[_0x027a('0x2f')]=EmailChannel;
\ No newline at end of file
index fdee9b9..8f69fda 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeebf=['imap','lodash','randomstring','mailparser','events','EventEmitter','../../../config/logger','email','mailbox','account','getAccount','once','ready','end','handleError','bind','connect','prototype','connTimeout','authTimeout','isNil','authentication','user','password','host','port','tls','autotls','getHost','service','anonymous@xcally.com','handleReady','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','fetch','message','error','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','body','handleMessageAttributes','handleMessageEnd','handleSimpleParser','emit','handleEnd','stringify','textCode','upperFirst','util'];(function(_0x19c349,_0x4f19c6){var _0x508a7f=function(_0x2ac6b7){while(--_0x2ac6b7){_0x19c349['push'](_0x19c349['shift']());}};_0x508a7f(++_0x4f19c6);}(_0xeebf,0x112));var _0xfeeb=function(_0x4fdc01,_0x4101ea){_0x4fdc01=_0x4fdc01-0x0;var _0x5bb876=_0xeebf[_0x4fdc01];return _0x5bb876;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xfeeb('0x0'));var Imap=require(_0xfeeb('0x1'));var _=require(_0xfeeb('0x2'));var rs=require(_0xfeeb('0x3'));var simpleParser=require(_0xfeeb('0x4'))['simpleParser'];var EventEmitter=require(_0xfeeb('0x5'))[_0xfeeb('0x6')];var utils=require('./utils');var logger=require(_0xfeeb('0x7'))(_0xfeeb('0x8'));function EmailImap(_0x1857e9,_0x5b8e60){this[_0xfeeb('0x9')]='INBOX';this[_0xfeeb('0xa')]=this[_0xfeeb('0xb')](_0x1857e9,_0x5b8e60);this[_0xfeeb('0x1')]=new Imap(this[_0xfeeb('0xa')]);this['imap'][_0xfeeb('0xc')](_0xfeeb('0xd'),this['handleReady']['bind'](this));this['imap'][_0xfeeb('0xc')](_0xfeeb('0xe'),this['handleEnd']['bind'](this));this['imap']['on']('error',this[_0xfeeb('0xf')][_0xfeeb('0x10')](this));this[_0xfeeb('0x1')][_0xfeeb('0x11')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xfeeb('0x12')][_0xfeeb('0xb')]=function(_0x14ea4f,_0x332228){var _0x4dd851={'connTimeout':_0x14ea4f[_0xfeeb('0x13')]?_0x14ea4f[_0xfeeb('0x13')]*0x3e8:0x2710,'authTimeout':_0x14ea4f[_0xfeeb('0x14')]?_0x14ea4f[_0xfeeb('0x14')]*0x3e8:0x1388};if(_[_0xfeeb('0x15')](_0x14ea4f['service'])){if(_0x14ea4f[_0xfeeb('0x16')]){_0x4dd851['user']=_0x14ea4f[_0xfeeb('0x17')];_0x4dd851[_0xfeeb('0x18')]=_0x14ea4f[_0xfeeb('0x18')];}_0x4dd851[_0xfeeb('0x19')]=_0x14ea4f[_0xfeeb('0x19')];_0x4dd851[_0xfeeb('0x1a')]=_0x14ea4f[_0xfeeb('0x1a')]||0x3e1;if(_0x14ea4f[_0xfeeb('0x1b')]){_0x4dd851[_0xfeeb('0x1b')]=!![];}else{_0x4dd851[_0xfeeb('0x1b')]=![];_0x4dd851[_0xfeeb('0x1c')]='required';}}else{_0x4dd851[_0xfeeb('0x17')]=_0x14ea4f[_0xfeeb('0x17')];_0x4dd851[_0xfeeb('0x18')]=_0x14ea4f[_0xfeeb('0x18')];_0x4dd851[_0xfeeb('0x19')]=utils[_0xfeeb('0x1d')](_0x14ea4f[_0xfeeb('0x1e')]);_0x4dd851[_0xfeeb('0x1a')]=0x3e1;_0x4dd851['tls']=!![];}_0x4dd851[_0xfeeb('0x8')]=_0x332228||_0x14ea4f[_0xfeeb('0x17')]||_0xfeeb('0x1f');return _0x4dd851;};EmailImap[_0xfeeb('0x12')][_0xfeeb('0x20')]=function(){this[_0xfeeb('0x1')]['openBox'](this[_0xfeeb('0x9')],![],this['handleOpenBox'][_0xfeeb('0x10')](this));};EmailImap[_0xfeeb('0x12')]['handleOpenBox']=function(_0x3e216e,_0x2b74b5){if(_0x3e216e){this['handleError'](_0x3e216e,!![]);}else{this['emit'](_0xfeeb('0x21'),_0x2b74b5);this[_0xfeeb('0x22')]();}};EmailImap[_0xfeeb('0x12')][_0xfeeb('0x23')]=function(_0x4a2773){if(_0x4a2773){this[_0xfeeb('0xf')](_0x4a2773,!![]);}else{this[_0xfeeb('0x1')][_0xfeeb('0xe')]();}};EmailImap[_0xfeeb('0x12')][_0xfeeb('0x22')]=function(){this[_0xfeeb('0x1')][_0xfeeb('0x24')]([_0xfeeb('0x25')],this[_0xfeeb('0x26')][_0xfeeb('0x10')](this));};EmailImap[_0xfeeb('0x12')]['handleReadUnseen']=function(_0x21cec3,_0x4f1c3f){if(_0x21cec3){this[_0xfeeb('0xf')](_0x21cec3,!![]);}else{if(_0x4f1c3f['length']){try{var _0x14e3a7=this['imap'][_0xfeeb('0x27')](_0x4f1c3f,{'bodies':'','markSeen':!![]});_0x14e3a7['on'](_0xfeeb('0x28'),this['handleFetchMessage'][_0xfeeb('0x10')](this));_0x14e3a7[_0xfeeb('0xc')](_0xfeeb('0x29'),this[_0xfeeb('0x2a')][_0xfeeb('0x10')](this));_0x14e3a7[_0xfeeb('0xc')](_0xfeeb('0xe'),this[_0xfeeb('0x2b')][_0xfeeb('0x10')](this));}catch(_0x4c698f){logger['error'](_0x4c698f);}}else{this[_0xfeeb('0x1')][_0xfeeb('0x2c')](!![],this[_0xfeeb('0x23')][_0xfeeb('0x10')](this));}}};EmailImap[_0xfeeb('0x12')][_0xfeeb('0x2d')]=function(_0x4163da,_0x31d2d6){_0x4163da['on'](_0xfeeb('0x2e'),this['handleMessageBody'][_0xfeeb('0x10')](this));_0x4163da[_0xfeeb('0xc')]('attributes',this[_0xfeeb('0x2f')][_0xfeeb('0x10')](this));_0x4163da[_0xfeeb('0xc')](_0xfeeb('0xe'),this[_0xfeeb('0x30')]['bind'](this));};EmailImap[_0xfeeb('0x12')]['handleMessageBody']=function(_0x470029,_0x4bd42d){simpleParser(_0x470029,this['handleSimpleParser']['bind'](this));};EmailImap[_0xfeeb('0x12')]['handleMessageAttributes']=function(_0x2659ec){};EmailImap[_0xfeeb('0x12')]['handleMessageEnd']=function(){};EmailImap[_0xfeeb('0x12')][_0xfeeb('0x31')]=function(_0x1b9b60,_0x5d5180){if(_0x1b9b60){logger[_0xfeeb('0x29')](_0x1b9b60);}else{var _0x42abc2=this;utils['parser'](this['account'],_0x5d5180,function(_0xbbe0){_0x42abc2[_0xfeeb('0x32')](_0xfeeb('0x8'),_0xbbe0);});}};EmailImap['prototype'][_0xfeeb('0x2b')]=function(){this[_0xfeeb('0x1')]['closeBox'](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0xfeeb('0x12')][_0xfeeb('0x2a')]=function(_0x592e62){this[_0xfeeb('0xf')](_0x592e62);this['imap'][_0xfeeb('0x2c')](!![],this[_0xfeeb('0x23')][_0xfeeb('0x10')](this));};EmailImap[_0xfeeb('0x12')][_0xfeeb('0x33')]=function(){this[_0xfeeb('0x32')](_0xfeeb('0xe'));};EmailImap[_0xfeeb('0x12')][_0xfeeb('0xf')]=function(_0x41efb0,_0x3458a2){logger[_0xfeeb('0x29')](_0xfeeb('0xf'),this[_0xfeeb('0xa')]['email'],JSON[_0xfeeb('0x34')](_0x41efb0));var _0x38fd89='';if(_0x41efb0){if(_0x41efb0[_0xfeeb('0x35')]){_0x38fd89=_0x41efb0[_0xfeeb('0x35')];}else{for(var _0x40f594 in _0x41efb0){if(_0x41efb0['hasOwnProperty'](_0x40f594)){_0x38fd89+=_[_0xfeeb('0x36')](_0x40f594)+':\x20'+_0x41efb0[_0x40f594]+'\x0a';}}}}if(_0x3458a2){this[_0xfeeb('0x1')]['end']();}else{this[_0xfeeb('0x32')](_0xfeeb('0x29'),_0x38fd89);this[_0xfeeb('0x32')]('end');}};module['exports']=EmailImap;
\ No newline at end of file
+var _0x5eae=['handleOpenBox','box','readUnseen','handleCloseBox','UNSEEN','handleReadUnseen','length','fetch','handleFetchError','handleFetchEnd','handleMessageBody','attributes','handleMessageEnd','handleMessageAttributes','handleSimpleParser','parser','emit','closeBox','textCode','hasOwnProperty','upperFirst','exports','path','imap','lodash','randomstring','mailparser','simpleParser','EventEmitter','../../../config/logger','mailbox','INBOX','account','ready','handleReady','once','end','handleEnd','bind','error','handleError','connect','inherits','getAccount','connTimeout','authTimeout','service','authentication','user','password','host','port','tls','required','getHost','email','anonymous@xcally.com','prototype','openBox'];(function(_0x3d2e4b,_0x1f6653){var _0x509e78=function(_0x307037){while(--_0x307037){_0x3d2e4b['push'](_0x3d2e4b['shift']());}};_0x509e78(++_0x1f6653);}(_0x5eae,0x8c));var _0xe5ea=function(_0x47c432,_0x2cde7e){_0x47c432=_0x47c432-0x0;var _0x3ced40=_0x5eae[_0x47c432];return _0x3ced40;};'use strict';var fs=require('fs');var path=require(_0xe5ea('0x0'));var util=require('util');var Imap=require(_0xe5ea('0x1'));var _=require(_0xe5ea('0x2'));var rs=require(_0xe5ea('0x3'));var simpleParser=require(_0xe5ea('0x4'))[_0xe5ea('0x5')];var EventEmitter=require('events')[_0xe5ea('0x6')];var utils=require('./utils');var logger=require(_0xe5ea('0x7'))('email');function EmailImap(_0x25d3e7,_0x2e1a4b){this[_0xe5ea('0x8')]=_0xe5ea('0x9');this[_0xe5ea('0xa')]=this['getAccount'](_0x25d3e7,_0x2e1a4b);this[_0xe5ea('0x1')]=new Imap(this['account']);this[_0xe5ea('0x1')]['once'](_0xe5ea('0xb'),this[_0xe5ea('0xc')]['bind'](this));this['imap'][_0xe5ea('0xd')](_0xe5ea('0xe'),this[_0xe5ea('0xf')][_0xe5ea('0x10')](this));this[_0xe5ea('0x1')]['on'](_0xe5ea('0x11'),this[_0xe5ea('0x12')][_0xe5ea('0x10')](this));this[_0xe5ea('0x1')][_0xe5ea('0x13')]();}util[_0xe5ea('0x14')](EmailImap,EventEmitter);EmailImap['prototype'][_0xe5ea('0x15')]=function(_0x3ca2ea,_0x3cc1ee){var _0x4f1608={'connTimeout':_0x3ca2ea[_0xe5ea('0x16')]?_0x3ca2ea[_0xe5ea('0x16')]*0x3e8:0x2710,'authTimeout':_0x3ca2ea[_0xe5ea('0x17')]?_0x3ca2ea['authTimeout']*0x3e8:0x1388};if(_['isNil'](_0x3ca2ea[_0xe5ea('0x18')])){if(_0x3ca2ea[_0xe5ea('0x19')]){_0x4f1608[_0xe5ea('0x1a')]=_0x3ca2ea[_0xe5ea('0x1a')];_0x4f1608[_0xe5ea('0x1b')]=_0x3ca2ea['password'];}_0x4f1608['host']=_0x3ca2ea[_0xe5ea('0x1c')];_0x4f1608[_0xe5ea('0x1d')]=_0x3ca2ea[_0xe5ea('0x1d')]||0x3e1;if(_0x3ca2ea[_0xe5ea('0x1e')]){_0x4f1608[_0xe5ea('0x1e')]=!![];}else{_0x4f1608['tls']=![];_0x4f1608['autotls']=_0xe5ea('0x1f');}}else{_0x4f1608[_0xe5ea('0x1a')]=_0x3ca2ea[_0xe5ea('0x1a')];_0x4f1608['password']=_0x3ca2ea[_0xe5ea('0x1b')];_0x4f1608['host']=utils[_0xe5ea('0x20')](_0x3ca2ea[_0xe5ea('0x18')]);_0x4f1608[_0xe5ea('0x1d')]=0x3e1;_0x4f1608[_0xe5ea('0x1e')]=!![];}_0x4f1608[_0xe5ea('0x21')]=_0x3cc1ee||_0x3ca2ea[_0xe5ea('0x1a')]||_0xe5ea('0x22');return _0x4f1608;};EmailImap[_0xe5ea('0x23')][_0xe5ea('0xc')]=function(){this['imap'][_0xe5ea('0x24')](this[_0xe5ea('0x8')],![],this[_0xe5ea('0x25')][_0xe5ea('0x10')](this));};EmailImap[_0xe5ea('0x23')]['handleOpenBox']=function(_0x4025d5,_0x43242f){if(_0x4025d5){this[_0xe5ea('0x12')](_0x4025d5,!![]);}else{this['emit'](_0xe5ea('0x26'),_0x43242f);this[_0xe5ea('0x27')]();}};EmailImap[_0xe5ea('0x23')][_0xe5ea('0x28')]=function(_0x4d9457){if(_0x4d9457){this['handleError'](_0x4d9457,!![]);}else{this[_0xe5ea('0x1')][_0xe5ea('0xe')]();}};EmailImap['prototype']['readUnseen']=function(){this[_0xe5ea('0x1')]['search']([_0xe5ea('0x29')],this[_0xe5ea('0x2a')]['bind'](this));};EmailImap[_0xe5ea('0x23')][_0xe5ea('0x2a')]=function(_0x3ebc10,_0x3cd796){if(_0x3ebc10){this[_0xe5ea('0x12')](_0x3ebc10,!![]);}else{if(_0x3cd796[_0xe5ea('0x2b')]){try{var _0x2b9ab6=this[_0xe5ea('0x1')][_0xe5ea('0x2c')](_0x3cd796,{'bodies':'','markSeen':!![]});_0x2b9ab6['on']('message',this['handleFetchMessage'][_0xe5ea('0x10')](this));_0x2b9ab6[_0xe5ea('0xd')](_0xe5ea('0x11'),this[_0xe5ea('0x2d')][_0xe5ea('0x10')](this));_0x2b9ab6['once'](_0xe5ea('0xe'),this[_0xe5ea('0x2e')][_0xe5ea('0x10')](this));}catch(_0xa0bf79){logger[_0xe5ea('0x11')](_0xa0bf79);}}else{this[_0xe5ea('0x1')]['closeBox'](!![],this[_0xe5ea('0x28')]['bind'](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x71f469,_0x55ae58){_0x71f469['on']('body',this[_0xe5ea('0x2f')][_0xe5ea('0x10')](this));_0x71f469[_0xe5ea('0xd')](_0xe5ea('0x30'),this['handleMessageAttributes'][_0xe5ea('0x10')](this));_0x71f469[_0xe5ea('0xd')](_0xe5ea('0xe'),this[_0xe5ea('0x31')][_0xe5ea('0x10')](this));};EmailImap[_0xe5ea('0x23')][_0xe5ea('0x2f')]=function(_0x5a5eda,_0x5d78e8){simpleParser(_0x5a5eda,this['handleSimpleParser'][_0xe5ea('0x10')](this));};EmailImap[_0xe5ea('0x23')][_0xe5ea('0x32')]=function(_0x1cad34){};EmailImap[_0xe5ea('0x23')][_0xe5ea('0x31')]=function(){};EmailImap[_0xe5ea('0x23')][_0xe5ea('0x33')]=function(_0x588820,_0x516c7f){if(_0x588820){logger['error'](_0x588820);}else{var _0x1d7401=this;utils[_0xe5ea('0x34')](this[_0xe5ea('0xa')],_0x516c7f,function(_0x1864bd){_0x1d7401[_0xe5ea('0x35')](_0xe5ea('0x21'),_0x1864bd);});}};EmailImap[_0xe5ea('0x23')][_0xe5ea('0x2e')]=function(){this[_0xe5ea('0x1')]['closeBox'](!![],this[_0xe5ea('0x28')]['bind'](this));};EmailImap[_0xe5ea('0x23')]['handleFetchError']=function(_0x216f35){this['handleError'](_0x216f35);this['imap'][_0xe5ea('0x36')](!![],this[_0xe5ea('0x28')][_0xe5ea('0x10')](this));};EmailImap[_0xe5ea('0x23')][_0xe5ea('0xf')]=function(){this[_0xe5ea('0x35')](_0xe5ea('0xe'));};EmailImap[_0xe5ea('0x23')][_0xe5ea('0x12')]=function(_0x1b5a01,_0xdfbb27){logger[_0xe5ea('0x11')](_0xe5ea('0x12'),this['account'][_0xe5ea('0x21')],JSON['stringify'](_0x1b5a01));var _0x26c509='';if(_0x1b5a01){if(_0x1b5a01[_0xe5ea('0x37')]){_0x26c509=_0x1b5a01['textCode'];}else{for(var _0x3cd1ee in _0x1b5a01){if(_0x1b5a01[_0xe5ea('0x38')](_0x3cd1ee)){_0x26c509+=_[_0xe5ea('0x39')](_0x3cd1ee)+':\x20'+_0x1b5a01[_0x3cd1ee]+'\x0a';}}}}if(_0xdfbb27){this[_0xe5ea('0x1')]['end']();}else{this[_0xe5ea('0x35')](_0xe5ea('0x11'),_0x26c509);this[_0xe5ea('0x35')]('end');}};module[_0xe5ea('0x3a')]=EmailImap;
\ No newline at end of file
index 40473d0..0dbfa84 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x52af=['use','compile','sendMail','toString','verify','Not\x20verifired','exports','bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport'];(function(_0x1486ce,_0x233c7f){var _0x10a7b2=function(_0xd96f47){while(--_0xd96f47){_0x1486ce['push'](_0x1486ce['shift']());}};_0x10a7b2(++_0x233c7f);}(_0x52af,0x97));var _0xf52a=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x52af[_0x220f3f];return _0x1f170e;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0xf52a('0x0'));var inlineBase64=require(_0xf52a('0x1'));function EmailSmtp(){}EmailSmtp[_0xf52a('0x2')][_0xf52a('0x3')]=function(_0x37c3d9,_0x180810){return new BPromise(function(_0x3324d6,_0x1d806c){var _0x57c8df=nodemailer[_0xf52a('0x4')](_0x37c3d9);_0x57c8df[_0xf52a('0x5')](_0xf52a('0x6'),inlineBase64());_0x57c8df[_0xf52a('0x7')](_0x180810,function(_0xd436f1,_0x8dbdd0){if(_0xd436f1){_0x1d806c(_0xd436f1[_0xf52a('0x8')]());}else{_0x3324d6(_0x8dbdd0);}});});};EmailSmtp['prototype'][_0xf52a('0x9')]=function(_0x90c5a7){return new BPromise(function(_0x27d690,_0x327efb){var _0x3a8bff=nodemailer[_0xf52a('0x4')](_0x90c5a7);_0x3a8bff[_0xf52a('0x9')](function(_0x4d2d8e,_0x2b7b36){if(_0x4d2d8e){_0x327efb(_0x4d2d8e[_0xf52a('0x8')]());}else{if(_0x2b7b36){_0x27d690(_0x2b7b36);}else{_0x327efb(_0xf52a('0xa'));}}});});};module[_0xf52a('0xb')]=EmailSmtp;
\ No newline at end of file
+var _0xf99b=['toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','createTransport','use','sendMail'];(function(_0x1150e1,_0x1c9f3e){var _0x90c0b3=function(_0x1c5120){while(--_0x1c5120){_0x1150e1['push'](_0x1150e1['shift']());}};_0x90c0b3(++_0x1c9f3e);}(_0xf99b,0x1bc));var _0xbf99=function(_0x3f33c0,_0x484b7b){_0x3f33c0=_0x3f33c0-0x0;var _0x170912=_0xf99b[_0x3f33c0];return _0x170912;};'use strict';var nodemailer=require(_0xbf99('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0xbf99('0x1'));function EmailSmtp(){}EmailSmtp[_0xbf99('0x2')]['send']=function(_0x325979,_0x524e8b){return new BPromise(function(_0x533080,_0x20c2d7){var _0x3fa218=nodemailer[_0xbf99('0x3')](_0x325979);_0x3fa218[_0xbf99('0x4')]('compile',inlineBase64());_0x3fa218[_0xbf99('0x5')](_0x524e8b,function(_0x37d9cd,_0x50db1f){if(_0x37d9cd){_0x20c2d7(_0x37d9cd[_0xbf99('0x6')]());}else{_0x533080(_0x50db1f);}});});};EmailSmtp[_0xbf99('0x2')][_0xbf99('0x7')]=function(_0x2596d8){return new BPromise(function(_0x58cdd7,_0x1e6439){var _0x17a50f=nodemailer[_0xbf99('0x3')](_0x2596d8);_0x17a50f[_0xbf99('0x7')](function(_0x50b125,_0x59a528){if(_0x50b125){_0x1e6439(_0x50b125['toString']());}else{if(_0x59a528){_0x58cdd7(_0x59a528);}else{_0x1e6439(_0xbf99('0x8'));}}});});};module[_0xbf99('0x9')]=EmailSmtp;
\ No newline at end of file
index a6fa1b9..e3d164f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe062=['info','first','BodyHTML','<p>Empty\x20message</p>','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap-mail.outlook.com','127.0.0.1','lodash','moment','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','@xcally.com','name','split','length','slice','join','Anonymous','address','anonymous','html','test','body','<a\x20target=\x22_blank\x22\x20','message','originTo','isEmpty','originCc','includes','bcc','attachments','type','attachment','format','%s-%s','now','root','writeFileSync','content','push','parser','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter','application/ms-tnef'];(function(_0x16bfc5,_0x4f9dc3){var _0x43b820=function(_0x363ced){while(--_0x363ced){_0x16bfc5['push'](_0x16bfc5['shift']());}};_0x43b820(++_0x4f9dc3);}(_0xe062,0x1b8));var _0x2e06=function(_0x5549f1,_0x56cf72){_0x5549f1=_0x5549f1-0x0;var _0x610f44=_0xe062[_0x5549f1];return _0x610f44;};'use strict';var _=require(_0x2e06('0x0'));var moment=require(_0x2e06('0x1'));var random=require('randomstring');var fs=require('fs');var path=require('path');var util=require(_0x2e06('0x2'));var tnef=require(_0x2e06('0x3'));var logger=require(_0x2e06('0x4'))(_0x2e06('0x5'));var config=require(_0x2e06('0x6'));function getAddress(_0x28e970){var _0x22aacc=_[_0x2e06('0x7')](_0x28e970[_0x2e06('0x8')]);return _0x22aacc&&_0x22aacc['address']?_0x22aacc['address']:'anonymous'+random['generate'](0x6)+_0x2e06('0x9');}function getFirstName(_0x2180bd){var _0x5103c6=_['head'](_0x2180bd[_0x2e06('0x8')]);if(_0x5103c6&&_0x5103c6[_0x2e06('0xa')]){var _0x6be39d=_0x5103c6[_0x2e06('0xa')][_0x2e06('0xb')](/\s+/);return _0x6be39d[_0x2e06('0xc')]?_0x6be39d[_0x2e06('0xd')](0x0,-0x1)[_0x2e06('0xe')]('\x20'):_0x5103c6[_0x2e06('0xa')];}return _0x2e06('0xf');}function getLastName(_0x4bdb70){var _0x2ee63d=_['head'](_0x4bdb70[_0x2e06('0x8')]);if(_0x2ee63d&&_0x2ee63d[_0x2e06('0xa')]){var _0x4c140e=_0x2ee63d['name'][_0x2e06('0xb')](/\s+/);return _0x4c140e[_0x2e06('0xc')]>0x1?_0x4c140e['pop']():'';}return'';}function getMails(_0x48d757,_0x289134){var _0x483084='';for(var _0x4935b3=0x0;_0x4935b3<_0x289134[_0x2e06('0x8')][_0x2e06('0xc')];_0x4935b3+=0x1){if(_0x289134['value'][_0x4935b3][_0x2e06('0x10')]!==_0x48d757){if(!_['isEmpty'](_0x483084)){_0x483084+=',';}_0x483084+=_0x289134[_0x2e06('0x8')][_0x4935b3]['name']||_0x289134[_0x2e06('0x8')][_0x4935b3][_0x2e06('0x10')]||'';_0x483084+='\x20<';_0x483084+=_0x289134[_0x2e06('0x8')][_0x4935b3][_0x2e06('0x10')]?_0x289134[_0x2e06('0x8')][_0x4935b3][_0x2e06('0x10')]:_0x2e06('0x11')+random['generate'](0x6)+_0x2e06('0x9');_0x483084+='>';}}return _0x483084;}function parseEmail(_0xf5317,_0x393603,_0x4091ce){if(_0x393603[_0x2e06('0x12')]){var _0x43a978=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi;while(_0x43a978[_0x2e06('0x13')](_0x393603[_0x2e06('0x12')])){_0x393603[_0x2e06('0x12')]=_0x393603['html']['replace'](_0x43a978,'');}_0x4091ce['body']=_0x393603['html'];}else{_0x4091ce[_0x2e06('0x14')]=_0x393603['textAsHtml'];}if(_0x4091ce[_0x2e06('0x14')]){_0x4091ce[_0x2e06('0x14')]=_0x4091ce['body']['replace'](/<a\s+/gi,_0x2e06('0x15'));}if(_0x393603['to']){_0x4091ce[_0x2e06('0x16')][_0x2e06('0x17')]=getMails(null,_0x393603['to']);var _0x171cc1=getMails(_0xf5317[_0x2e06('0x5')],_0x393603['to']);if(!_[_0x2e06('0x18')](_0x171cc1)){_0x4091ce['message']['cc']+=_0x171cc1;}}if(_0x393603['cc']){_0x4091ce['message'][_0x2e06('0x19')]=getMails(null,_0x393603['cc']);var _0x51e780=getMails(_0xf5317[_0x2e06('0x5')],_0x393603['cc']);if(!_['isEmpty'](_0x51e780)){if(!_[_0x2e06('0x18')](_0x4091ce['message']['cc'])){_0x4091ce[_0x2e06('0x16')]['cc']+=',';}_0x4091ce[_0x2e06('0x16')]['cc']+=_0x51e780;}}if(!_['includes'](_0x4091ce['message'][_0x2e06('0x17')],_0xf5317[_0x2e06('0x5')])&&!_[_0x2e06('0x1a')](_0x4091ce['message']['originCc'],_0xf5317[_0x2e06('0x5')])){_0x4091ce[_0x2e06('0x16')][_0x2e06('0x1b')]=_0xf5317['email'];}if(_0x393603[_0x2e06('0x1c')]&&_0x393603[_0x2e06('0x1c')]['length']){_0x4091ce['message']['attach']=_0x393603[_0x2e06('0x1c')][_0x2e06('0xc')];for(var _0x42e7d6=0x0,_0x2d45f4,_0x51ce30,_0x25668a;_0x42e7d6<_0x393603[_0x2e06('0x1c')][_0x2e06('0xc')];_0x42e7d6+=0x1){if(_0x393603['attachments'][_0x42e7d6][_0x2e06('0x1d')]===_0x2e06('0x1e')){_0x25668a=_0x393603[_0x2e06('0x1c')][_0x42e7d6]['filename']||'attachment-'+_0x42e7d6;_0x2d45f4=util[_0x2e06('0x1f')](_0x2e06('0x20'),Date[_0x2e06('0x21')](),_0x25668a);_0x51ce30=path[_0x2e06('0xe')](config[_0x2e06('0x22')],'server/files/attachments/',_0x2d45f4);fs[_0x2e06('0x23')](_0x51ce30,_0x393603['attachments'][_0x42e7d6][_0x2e06('0x24')]);_0x4091ce[_0x2e06('0x16')][_0x2e06('0x1c')][_0x2e06('0x25')]({'name':_0x25668a,'basename':_0x2d45f4,'type':_0x393603[_0x2e06('0x1c')][_0x42e7d6]['contentType'],'filepath':_0x51ce30});}}}return _0x4091ce;}exports[_0x2e06('0x26')]=function(_0x4e8b41,_0x593f6f,_0x319bb8){var _0x45c92e={'from':getAddress(_0x593f6f[_0x2e06('0x27')]),'firstName':getFirstName(_0x593f6f[_0x2e06('0x27')]),'lastName':getLastName(_0x593f6f[_0x2e06('0x27')]),'mapKey':_0x2e06('0x5'),'message':{'from':getMails(_0x4e8b41[_0x2e06('0x5')],_0x593f6f[_0x2e06('0x27')]),'to':_0x4e8b41['email'],'cc':'','subject':_0x593f6f[_0x2e06('0x28')]||'','messageId':_0x593f6f[_0x2e06('0x29')],'inReplyTo':_0x593f6f[_0x2e06('0x2a')],'sentAt':moment(_0x593f6f[_0x2e06('0x2b')])[_0x2e06('0x1f')](_0x2e06('0x2c')),'attach':![],'attachments':[]}};if(!_0x593f6f[_0x2e06('0x12')]&&!_0x593f6f[_0x2e06('0x2d')]){var _0x5973b0=_[_0x2e06('0x2e')](_0x593f6f[_0x2e06('0x1c')],{'contentType':_0x2e06('0x2f')});if(_0x5973b0[_0x2e06('0xc')]){logger[_0x2e06('0x30')](util['format']('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x593f6f['messageId']));tnef['parseBuffer'](_[_0x2e06('0x31')](_0x5973b0)[_0x2e06('0x24')],function(_0x1fc389,_0x2cd56b){if(_0x2cd56b){_0x593f6f['html']=_0x2cd56b[_0x2e06('0x32')]||_0x2e06('0x33');if(_0x2cd56b[_0x2e06('0x34')]){for(var _0x186c16=0x0;_0x186c16<_0x2cd56b[_0x2e06('0x34')]['length'];_0x186c16++){var _0x2630b3=_0x2cd56b[_0x2e06('0x34')][_0x186c16];_0x45c92e['message'][_0x2e06('0x1c')][_0x2e06('0x25')]({'filename':_0x2630b3[_0x2e06('0x35')],'content':new Buffer(_0x2630b3[_0x2e06('0x36')])});}}}_0x319bb8(parseEmail(_0x4e8b41,_0x593f6f,_0x45c92e));});}else{_0x593f6f[_0x2e06('0x12')]=_0x2e06('0x33');_0x319bb8(parseEmail(_0x4e8b41,_0x593f6f,_0x45c92e));}}else{_0x319bb8(parseEmail(_0x4e8b41,_0x593f6f,_0x45c92e));}};exports[_0x2e06('0x37')]=function(_0x43f676){switch(_0x43f676){case _0x2e06('0x38'):return _0x2e06('0x39');case _0x2e06('0x3a'):return'imap.mail.yahoo.com';case'hotmail':return _0x2e06('0x3b');case'outlook365':return'outlook.office365.com';}return _0x2e06('0x3c');};
\ No newline at end of file
+var _0xf2f2=['attachments','attach','type','filename','attachment-','format','%s-%s','now','root','server/files/attachments/','writeFileSync','content','push','contentType','parser','from','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','parseBuffer','first','BodyHTML','<p>Empty\x20message</p>','Attachments','Title','Data','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','127.0.0.1','lodash','randomstring','path','util','../../../config/logger','email','head','value','address','anonymous','generate','@xcally.com','name','split','length','join','Anonymous','pop','isEmpty','html','test','replace','body','textAsHtml','<a\x20target=\x22_blank\x22\x20','originTo','message','originCc','includes','bcc'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf2f2,0x168));var _0x2f2f=function(_0x16938f,_0x35e57f){_0x16938f=_0x16938f-0x0;var _0x5c66e9=_0xf2f2[_0x16938f];return _0x5c66e9;};'use strict';var _=require(_0x2f2f('0x0'));var moment=require('moment');var random=require(_0x2f2f('0x1'));var fs=require('fs');var path=require(_0x2f2f('0x2'));var util=require(_0x2f2f('0x3'));var tnef=require('node-tnef');var logger=require(_0x2f2f('0x4'))(_0x2f2f('0x5'));var config=require('../../../config/environment');function getAddress(_0xdf548d){var _0x3920af=_[_0x2f2f('0x6')](_0xdf548d[_0x2f2f('0x7')]);return _0x3920af&&_0x3920af[_0x2f2f('0x8')]?_0x3920af['address']:_0x2f2f('0x9')+random[_0x2f2f('0xa')](0x6)+_0x2f2f('0xb');}function getFirstName(_0x32f2d5){var _0x3e6c49=_[_0x2f2f('0x6')](_0x32f2d5['value']);if(_0x3e6c49&&_0x3e6c49[_0x2f2f('0xc')]){var _0x568b91=_0x3e6c49['name'][_0x2f2f('0xd')](/\s+/);return _0x568b91[_0x2f2f('0xe')]?_0x568b91['slice'](0x0,-0x1)[_0x2f2f('0xf')]('\x20'):_0x3e6c49[_0x2f2f('0xc')];}return _0x2f2f('0x10');}function getLastName(_0x5d8937){var _0x1e3c3a=_[_0x2f2f('0x6')](_0x5d8937['value']);if(_0x1e3c3a&&_0x1e3c3a[_0x2f2f('0xc')]){var _0x2c74ac=_0x1e3c3a[_0x2f2f('0xc')][_0x2f2f('0xd')](/\s+/);return _0x2c74ac[_0x2f2f('0xe')]>0x1?_0x2c74ac[_0x2f2f('0x11')]():'';}return'';}function getMails(_0x26e633,_0x35c9b){var _0xf49cf8='';for(var _0x142bfa=0x0;_0x142bfa<_0x35c9b[_0x2f2f('0x7')][_0x2f2f('0xe')];_0x142bfa+=0x1){if(_0x35c9b[_0x2f2f('0x7')][_0x142bfa]['address']!==_0x26e633){if(!_[_0x2f2f('0x12')](_0xf49cf8)){_0xf49cf8+=',';}_0xf49cf8+=_0x35c9b[_0x2f2f('0x7')][_0x142bfa][_0x2f2f('0xc')]||_0x35c9b[_0x2f2f('0x7')][_0x142bfa][_0x2f2f('0x8')]||'';_0xf49cf8+='\x20<';_0xf49cf8+=_0x35c9b[_0x2f2f('0x7')][_0x142bfa]['address']?_0x35c9b[_0x2f2f('0x7')][_0x142bfa]['address']:'anonymous'+random['generate'](0x6)+_0x2f2f('0xb');_0xf49cf8+='>';}}return _0xf49cf8;}function parseEmail(_0x89b80b,_0x377f68,_0x24146a){if(_0x377f68[_0x2f2f('0x13')]){var _0x151d21=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi;while(_0x151d21[_0x2f2f('0x14')](_0x377f68[_0x2f2f('0x13')])){_0x377f68[_0x2f2f('0x13')]=_0x377f68[_0x2f2f('0x13')][_0x2f2f('0x15')](_0x151d21,'');}_0x24146a[_0x2f2f('0x16')]=_0x377f68['html'];}else{_0x24146a[_0x2f2f('0x16')]=_0x377f68[_0x2f2f('0x17')];}if(_0x24146a[_0x2f2f('0x16')]){_0x24146a[_0x2f2f('0x16')]=_0x24146a[_0x2f2f('0x16')][_0x2f2f('0x15')](/<a\s+/gi,_0x2f2f('0x18'));}if(_0x377f68['to']){_0x24146a['message'][_0x2f2f('0x19')]=getMails(null,_0x377f68['to']);var _0x74228d=getMails(_0x89b80b[_0x2f2f('0x5')],_0x377f68['to']);if(!_[_0x2f2f('0x12')](_0x74228d)){_0x24146a['message']['cc']+=_0x74228d;}}if(_0x377f68['cc']){_0x24146a[_0x2f2f('0x1a')][_0x2f2f('0x1b')]=getMails(null,_0x377f68['cc']);var _0x206608=getMails(_0x89b80b['email'],_0x377f68['cc']);if(!_['isEmpty'](_0x206608)){if(!_['isEmpty'](_0x24146a[_0x2f2f('0x1a')]['cc'])){_0x24146a[_0x2f2f('0x1a')]['cc']+=',';}_0x24146a[_0x2f2f('0x1a')]['cc']+=_0x206608;}}if(!_[_0x2f2f('0x1c')](_0x24146a[_0x2f2f('0x1a')][_0x2f2f('0x19')],_0x89b80b[_0x2f2f('0x5')])&&!_[_0x2f2f('0x1c')](_0x24146a[_0x2f2f('0x1a')]['originCc'],_0x89b80b[_0x2f2f('0x5')])){_0x24146a[_0x2f2f('0x1a')][_0x2f2f('0x1d')]=_0x89b80b[_0x2f2f('0x5')];}if(_0x377f68[_0x2f2f('0x1e')]&&_0x377f68[_0x2f2f('0x1e')]['length']){_0x24146a['message'][_0x2f2f('0x1f')]=_0x377f68[_0x2f2f('0x1e')]['length'];for(var _0x7b06f2=0x0,_0x2cc467,_0xf3e869,_0x49472c;_0x7b06f2<_0x377f68['attachments'][_0x2f2f('0xe')];_0x7b06f2+=0x1){if(_0x377f68[_0x2f2f('0x1e')][_0x7b06f2][_0x2f2f('0x20')]==='attachment'){_0x49472c=_0x377f68[_0x2f2f('0x1e')][_0x7b06f2][_0x2f2f('0x21')]||_0x2f2f('0x22')+_0x7b06f2;_0x2cc467=util[_0x2f2f('0x23')](_0x2f2f('0x24'),Date[_0x2f2f('0x25')](),_0x49472c);_0xf3e869=path[_0x2f2f('0xf')](config[_0x2f2f('0x26')],_0x2f2f('0x27'),_0x2cc467);fs[_0x2f2f('0x28')](_0xf3e869,_0x377f68[_0x2f2f('0x1e')][_0x7b06f2][_0x2f2f('0x29')]);_0x24146a['message'][_0x2f2f('0x1e')][_0x2f2f('0x2a')]({'name':_0x49472c,'basename':_0x2cc467,'type':_0x377f68[_0x2f2f('0x1e')][_0x7b06f2][_0x2f2f('0x2b')],'filepath':_0xf3e869});}}}return _0x24146a;}exports[_0x2f2f('0x2c')]=function(_0x30ea1d,_0x555122,_0x4bd3b7){var _0x59ab45={'from':getAddress(_0x555122[_0x2f2f('0x2d')]),'firstName':getFirstName(_0x555122[_0x2f2f('0x2d')]),'lastName':getLastName(_0x555122[_0x2f2f('0x2d')]),'mapKey':_0x2f2f('0x5'),'message':{'from':getMails(_0x30ea1d[_0x2f2f('0x5')],_0x555122[_0x2f2f('0x2d')]),'to':_0x30ea1d['email'],'cc':'','subject':_0x555122['subject']||'','messageId':_0x555122[_0x2f2f('0x2e')],'inReplyTo':_0x555122[_0x2f2f('0x2f')],'sentAt':moment(_0x555122[_0x2f2f('0x30')])[_0x2f2f('0x23')](_0x2f2f('0x31')),'attach':![],'attachments':[]}};if(!_0x555122[_0x2f2f('0x13')]&&!_0x555122['textAsHtml']){var _0x1ff43c=_[_0x2f2f('0x32')](_0x555122[_0x2f2f('0x1e')],{'contentType':'application/ms-tnef'});if(_0x1ff43c[_0x2f2f('0xe')]){logger['info'](util['format']('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x555122['messageId']));tnef[_0x2f2f('0x33')](_[_0x2f2f('0x34')](_0x1ff43c)['content'],function(_0x5c23a5,_0x984abf){if(_0x984abf){_0x555122[_0x2f2f('0x13')]=_0x984abf[_0x2f2f('0x35')]||_0x2f2f('0x36');if(_0x984abf['Attachments']){for(var _0x3b589d=0x0;_0x3b589d<_0x984abf[_0x2f2f('0x37')][_0x2f2f('0xe')];_0x3b589d++){var _0x2a400e=_0x984abf[_0x2f2f('0x37')][_0x3b589d];_0x59ab45['message'][_0x2f2f('0x1e')]['push']({'filename':_0x2a400e[_0x2f2f('0x38')],'content':new Buffer(_0x2a400e[_0x2f2f('0x39')])});}}}_0x4bd3b7(parseEmail(_0x30ea1d,_0x555122,_0x59ab45));});}else{_0x555122[_0x2f2f('0x13')]=_0x2f2f('0x36');_0x4bd3b7(parseEmail(_0x30ea1d,_0x555122,_0x59ab45));}}else{_0x4bd3b7(parseEmail(_0x30ea1d,_0x555122,_0x59ab45));}};exports['getHost']=function(_0x3fdb2a){switch(_0x3fdb2a){case _0x2f2f('0x3a'):return _0x2f2f('0x3b');case'yahoo':return _0x2f2f('0x3c');case _0x2f2f('0x3d'):return _0x2f2f('0x3e');case _0x2f2f('0x3f'):return'outlook.office365.com';}return _0x2f2f('0x40');};
\ No newline at end of file
index ac01085..befe4a0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf95c=['SERV','active','Smtp','exports','lodash','name','key'];(function(_0x399a9d,_0x1853fc){var _0x21692f=function(_0x29809a){while(--_0x29809a){_0x399a9d['push'](_0x399a9d['shift']());}};_0x21692f(++_0x1853fc);}(_0xf95c,0x193));var _0xcf95=function(_0x50f847,_0xd8d09c){_0x50f847=_0x50f847-0x0;var _0x17e52e=_0xf95c[_0x50f847];return _0x17e52e;};'use strict';var _=require(_0xcf95('0x0'));function MailAccount(_0x1800da){this['id']=_0x1800da['id']||0x0;this[_0xcf95('0x1')]=_0x1800da[_0xcf95('0x1')]||'Service';this[_0xcf95('0x2')]=_0x1800da['key']||_0xcf95('0x3');this[_0xcf95('0x4')]=_0x1800da['active']||![];this['Imap']=_0x1800da['Imap']||[];this[_0xcf95('0x5')]=_0x1800da[_0xcf95('0x5')]||[];}module[_0xcf95('0x6')]=MailAccount;
\ No newline at end of file
+var _0xb5b8=['name','Service','key','active','Imap','Smtp'];(function(_0x7a3247,_0x15cb12){var _0x1bfde5=function(_0x62bbef){while(--_0x62bbef){_0x7a3247['push'](_0x7a3247['shift']());}};_0x1bfde5(++_0x15cb12);}(_0xb5b8,0xf0));var _0x8b5b=function(_0xd0c220,_0x4a09dd){_0xd0c220=_0xd0c220-0x0;var _0x14b9c0=_0xb5b8[_0xd0c220];return _0x14b9c0;};'use strict';var _=require('lodash');function MailAccount(_0x41f250){this['id']=_0x41f250['id']||0x0;this[_0x8b5b('0x0')]=_0x41f250[_0x8b5b('0x0')]||_0x8b5b('0x1');this['key']=_0x41f250[_0x8b5b('0x2')]||'SERV';this[_0x8b5b('0x3')]=_0x41f250[_0x8b5b('0x3')]||![];this[_0x8b5b('0x4')]=_0x41f250['Imap']||[];this[_0x8b5b('0x5')]=_0x41f250[_0x8b5b('0x5')]||[];}module['exports']=MailAccount;
\ No newline at end of file
index 75b1fac..7095a8c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0120=['initMailAccounts','length','merge','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype'];(function(_0x11cda0,_0x94236e){var _0x2398c7=function(_0x512ef5){while(--_0x512ef5){_0x11cda0['push'](_0x11cda0['shift']());}};_0x2398c7(++_0x94236e);}(_0x0120,0x6f));var _0x0012=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x0120[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x0012('0x0'));var MailAccount=require(_0x0012('0x1'));var Realtime=function(){this[_0x0012('0x2')]={};};function freeIsNotKey(_0xb8d57c,_0x46fb2b,_0x23b9ae){var _0x214372=_[_0x0012('0x3')](_0xb8d57c,function(_0x357f77,_0x302029){return _0x357f77[_0x23b9ae];});for(var _0x3505ab in _0x46fb2b){if(_0x46fb2b[_0x0012('0x4')](_0x3505ab)){if(!_0x214372[_0x3505ab]){delete _0x46fb2b[_0x3505ab];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x59980a,_0x95d441){for(var _0x436af8 in _0x95d441){if(_0x59980a[_0x0012('0x4')](_0x436af8)){_0x59980a[_0x436af8]=_0x95d441[_0x436af8];}}};Realtime[_0x0012('0x5')][_0x0012('0x6')]=function(){var _0x507cdb=this;return function(_0x14991f){if(_0x14991f){freeIsNotKey(_0x14991f,_0x507cdb[_0x0012('0x2')],'id');for(var _0x1dc1b2=0x0,_0x323282={},_0x520171={};_0x1dc1b2<_0x14991f[_0x0012('0x7')];_0x1dc1b2+=0x1){_0x323282=_0x14991f[_0x1dc1b2];if(_['isUndefined'](_0x507cdb[_0x0012('0x2')][_0x323282['id']])){_0x507cdb[_0x0012('0x2')][_0x323282['id']]=new MailAccount(_0x323282);}else{_[_0x0012('0x8')](_0x507cdb[_0x0012('0x2')][_0x323282['id']],_0x323282);}}}return _0x507cdb[_0x0012('0x2')];};};module['exports']=Realtime;
\ No newline at end of file
+var _0x5fdc=['prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x5fdc,0x127));var _0xc5fd=function(_0x211c0c,_0x325373){_0x211c0c=_0x211c0c-0x0;var _0x96ed9d=_0x5fdc[_0x211c0c];return _0x96ed9d;};'use strict';var _=require(_0xc5fd('0x0'));var MailAccount=require(_0xc5fd('0x1'));var Realtime=function(){this[_0xc5fd('0x2')]={};};function freeIsNotKey(_0x1d01cf,_0x36e895,_0x341db9){var _0x3be451=_[_0xc5fd('0x3')](_0x1d01cf,function(_0xfdf928,_0x1b6205){return _0xfdf928[_0x341db9];});for(var _0xca27a0 in _0x36e895){if(_0x36e895[_0xc5fd('0x4')](_0xca27a0)){if(!_0x3be451[_0xca27a0]){delete _0x36e895[_0xca27a0];}}}}Realtime[_0xc5fd('0x5')][_0xc5fd('0x6')]=function(_0x15ffe7,_0x5a2eb4){for(var _0x5d86e5 in _0x5a2eb4){if(_0x15ffe7['hasOwnProperty'](_0x5d86e5)){_0x15ffe7[_0x5d86e5]=_0x5a2eb4[_0x5d86e5];}}};Realtime[_0xc5fd('0x5')][_0xc5fd('0x7')]=function(){var _0x158e58=this;return function(_0x45c91f){if(_0x45c91f){freeIsNotKey(_0x45c91f,_0x158e58['mailAccounts'],'id');for(var _0x4e1e94=0x0,_0x3442dd={},_0x1edeec={};_0x4e1e94<_0x45c91f[_0xc5fd('0x8')];_0x4e1e94+=0x1){_0x3442dd=_0x45c91f[_0x4e1e94];if(_[_0xc5fd('0x9')](_0x158e58[_0xc5fd('0x2')][_0x3442dd['id']])){_0x158e58[_0xc5fd('0x2')][_0x3442dd['id']]=new MailAccount(_0x3442dd);}else{_['merge'](_0x158e58[_0xc5fd('0x2')][_0x3442dd['id']],_0x3442dd);}}}return _0x158e58['mailAccounts'];};};module['exports']=Realtime;
\ No newline at end of file
index ed5c088..e4d5df2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6ef9=['Request','GetMailAccount','name','email','active','key','ListId','TemplateId','Imap','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts'];(function(_0x181289,_0x3e46a5){var _0xe87b47=function(_0x2e9f0b){while(--_0x2e9f0b){_0x181289['push'](_0x181289['shift']());}};_0xe87b47(++_0x3e46a5);}(_0x6ef9,0x148));var _0x96ef=function(_0x2d8434,_0x43d781){_0x2d8434=_0x2d8434-0x0;var _0x26b9e4=_0x6ef9[_0x2d8434];return _0x26b9e4;};'use strict';var client=require(_0x96ef('0x0'));exports[_0x96ef('0x1')]=function(){return function(){return client[_0x96ef('0x2')](_0x96ef('0x3'),{'options':{'attributes':['id',_0x96ef('0x4'),'service',_0x96ef('0x5'),_0x96ef('0x6'),_0x96ef('0x7'),_0x96ef('0x8'),_0x96ef('0x9')],'raw':![],'include':[{'model':'MailServerIn','as':_0x96ef('0xa')},{'model':'MailServerOut','as':_0x96ef('0xb')}]},'log':_0x96ef('0xc')});};};exports[_0x96ef('0xd')]=function(_0x56ef3a,_0x5224d2){return client[_0x96ef('0x2')](_0x96ef('0xe'),{'account':{'id':_0x56ef3a},'body':_0x5224d2,'log':'NotifyMailAccount'});};
\ No newline at end of file
+var _0x36cf=['NotifyMailAccount','../client','getMailAccounts','name','email','key','ListId','Imap','Smtp','getMailAccount','Request'];(function(_0xe7506b,_0x1285d6){var _0x376483=function(_0x315d92){while(--_0x315d92){_0xe7506b['push'](_0xe7506b['shift']());}};_0x376483(++_0x1285d6);}(_0x36cf,0xbc));var _0xf36c=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x36cf[_0x4243a3];return _0x1b2a33;};'use strict';var client=require(_0xf36c('0x0'));exports[_0xf36c('0x1')]=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id',_0xf36c('0x2'),'service',_0xf36c('0x3'),'active',_0xf36c('0x4'),_0xf36c('0x5'),'TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':_0xf36c('0x6')},{'model':'MailServerOut','as':_0xf36c('0x7')}]},'log':_0xf36c('0x8')});};};exports['notify']=function(_0x710db2,_0x45ca8e){return client[_0xf36c('0x9')]('NotifyMailAccount',{'account':{'id':_0x710db2},'body':_0x45ca8e,'log':_0xf36c('0xa')});};
\ No newline at end of file
index c10ba10..7348dfb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3014=['length','Imap','password','Smtp','pass','http','stringify','listen','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','../../../config/logger','email','sendMail','account','message','catch','Verified','error','values','mailAccounts'];(function(_0x266393,_0x257c24){var _0x1928d0=function(_0x4dd0b4){while(--_0x4dd0b4){_0x266393['push'](_0x266393['shift']());}};_0x1928d0(++_0x257c24);}(_0x3014,0x1d7));var _0x4301=function(_0x3d990e,_0x64e3f4){_0x3d990e=_0x3d990e-0x0;var _0xfb7f74=_0x3014[_0x3d990e];return _0xfb7f74;};'use strict';var jayson=require(_0x4301('0x0'));var BPromise=require(_0x4301('0x1'));var _=require('lodash');var logger=require(_0x4301('0x2'))(_0x4301('0x3'));exports['listen']=function(_0x4e8e79,_0x40c7b5){return new BPromise(function(_0x30c6f9,_0xa74423){var _0xbe6c71={'SendMail':function(_0x3579b0){var _0x42ced6=this;return new Promise(function(_0x42ac4b,_0x3a6e61){_0x40c7b5[_0x4301('0x4')](_0x3579b0[_0x4301('0x5')],_0x3579b0[_0x4301('0x6')])['then'](function(_0x489c97){_0x42ac4b({'code':0xc8,'message':_0x489c97});})[_0x4301('0x7')](function(_0x2d6581){_0x3a6e61(_0x42ced6['error'](0x1f4,_0x2d6581));});});},'VerifySmtp':function(_0x248770){var _0x19d750=this;return new Promise(function(_0x2c9224,_0x2b716e){_0x40c7b5['verifySmtp'](_0x248770[_0x4301('0x5')])['then'](function(_0x1748bf){_0x2c9224({'code':0xc8,'message':_0x4301('0x8')});})[_0x4301('0x7')](function(_0x103b6a){_0x2b716e(_0x19d750[_0x4301('0x9')](0x1f4,_0x103b6a));});});},'MailAccounts':function(_0x312028){return new Promise(function(_0x2c1af4,_0x310916){var _0x46d4e8=_[_0x4301('0xa')](_0x4e8e79[_0x4301('0xb')]);for(var _0x2a97ce=0x0;_0x2a97ce<_0x46d4e8[_0x4301('0xc')];_0x2a97ce+=0x1){if(_0x46d4e8[_0x2a97ce]['Imap']&&_0x46d4e8[_0x2a97ce]['Imap']['password']){delete _0x46d4e8[_0x2a97ce][_0x4301('0xd')][_0x4301('0xe')];}if(_0x46d4e8[_0x2a97ce][_0x4301('0xf')]&&_0x46d4e8[_0x2a97ce][_0x4301('0xf')]['pass']){delete _0x46d4e8[_0x2a97ce]['Smtp'][_0x4301('0x10')];}}_0x2c1af4({'count':_0x46d4e8[_0x4301('0xc')],'rows':_0x46d4e8});});}};var _0x13b229=jayson['server'](_0xbe6c71)[_0x4301('0x11')]();_0x13b229['on'](_0x4301('0x9'),function(_0x110a6e){logger[_0x4301('0x9')](JSON[_0x4301('0x12')](_0x110a6e));return _0xa74423(_0x110a6e);});_0x13b229[_0x4301('0x13')](0x232b,'127.0.0.1',function(){console[_0x4301('0x14')](_0x4301('0x15'),0x232b);return _0x30c6f9(_0x4301('0x16')+0x232b);});});};
\ No newline at end of file
+var _0x3014=['length','Imap','password','Smtp','pass','http','stringify','listen','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','../../../config/logger','email','sendMail','account','message','catch','Verified','error','values','mailAccounts'];(function(_0x58b27a,_0x52f611){var _0x5f2516=function(_0x2a1f1a){while(--_0x2a1f1a){_0x58b27a['push'](_0x58b27a['shift']());}};_0x5f2516(++_0x52f611);}(_0x3014,0x1d7));var _0x4301=function(_0x1f76e5,_0x682177){_0x1f76e5=_0x1f76e5-0x0;var _0x52a6f3=_0x3014[_0x1f76e5];return _0x52a6f3;};'use strict';var jayson=require(_0x4301('0x0'));var BPromise=require(_0x4301('0x1'));var _=require('lodash');var logger=require(_0x4301('0x2'))(_0x4301('0x3'));exports['listen']=function(_0x4e8e79,_0x40c7b5){return new BPromise(function(_0x30c6f9,_0xa74423){var _0xbe6c71={'SendMail':function(_0x3579b0){var _0x42ced6=this;return new Promise(function(_0x42ac4b,_0x3a6e61){_0x40c7b5[_0x4301('0x4')](_0x3579b0[_0x4301('0x5')],_0x3579b0[_0x4301('0x6')])['then'](function(_0x489c97){_0x42ac4b({'code':0xc8,'message':_0x489c97});})[_0x4301('0x7')](function(_0x2d6581){_0x3a6e61(_0x42ced6['error'](0x1f4,_0x2d6581));});});},'VerifySmtp':function(_0x248770){var _0x19d750=this;return new Promise(function(_0x2c9224,_0x2b716e){_0x40c7b5['verifySmtp'](_0x248770[_0x4301('0x5')])['then'](function(_0x1748bf){_0x2c9224({'code':0xc8,'message':_0x4301('0x8')});})[_0x4301('0x7')](function(_0x103b6a){_0x2b716e(_0x19d750[_0x4301('0x9')](0x1f4,_0x103b6a));});});},'MailAccounts':function(_0x312028){return new Promise(function(_0x2c1af4,_0x310916){var _0x46d4e8=_[_0x4301('0xa')](_0x4e8e79[_0x4301('0xb')]);for(var _0x2a97ce=0x0;_0x2a97ce<_0x46d4e8[_0x4301('0xc')];_0x2a97ce+=0x1){if(_0x46d4e8[_0x2a97ce]['Imap']&&_0x46d4e8[_0x2a97ce]['Imap']['password']){delete _0x46d4e8[_0x2a97ce][_0x4301('0xd')][_0x4301('0xe')];}if(_0x46d4e8[_0x2a97ce][_0x4301('0xf')]&&_0x46d4e8[_0x2a97ce][_0x4301('0xf')]['pass']){delete _0x46d4e8[_0x2a97ce]['Smtp'][_0x4301('0x10')];}}_0x2c1af4({'count':_0x46d4e8[_0x4301('0xc')],'rows':_0x46d4e8});});}};var _0x13b229=jayson['server'](_0xbe6c71)[_0x4301('0x11')]();_0x13b229['on'](_0x4301('0x9'),function(_0x110a6e){logger[_0x4301('0x9')](JSON[_0x4301('0x12')](_0x110a6e));return _0xa74423(_0x110a6e);});_0x13b229[_0x4301('0x13')](0x232b,'127.0.0.1',function(){console[_0x4301('0x14')](_0x4301('0x15'),0x232b);return _0x30c6f9(_0x4301('0x16')+0x232b);});});};
\ No newline at end of file
index 211830f..76e18b7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x702d=['../../config/triggers','default','../../config/socketio','../../config/express','../../routes','log','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','http','express','sticky-session','ioredis','createServer','timeout','listen','port','websocket','redis','defaults','adapter'];(function(_0xa052d4,_0x88006f){var _0x3f56b9=function(_0x5554d7){while(--_0x5554d7){_0xa052d4['push'](_0xa052d4['shift']());}};_0x3f56b9(++_0x88006f);}(_0x702d,0x147));var _0xd702=function(_0x5880a,_0x30497b){_0x5880a=_0x5880a-0x0;var _0x48e826=_0x702d[_0x5880a];return _0x48e826;};'use strict';var _=require(_0xd702('0x0'));var http=require(_0xd702('0x1'));var express=require(_0xd702('0x2'));var sticky=require(_0xd702('0x3'));var Redis=require(_0xd702('0x4'));var config=require('../../config/environment');var app=express();var server=http[_0xd702('0x5')](app);server[_0xd702('0x6')]=0xdbba0;if(sticky[_0xd702('0x7')](server,config[_0xd702('0x8')])){var socketio=require('socket.io')(server,{'transports':[_0xd702('0x9'),'polling']});config[_0xd702('0xa')]=_[_0xd702('0xb')](config[_0xd702('0xa')],{'host':'localhost','port':0x18eb});socketio[_0xd702('0xc')](require('socket.io-redis')({'pubClient':new Redis(config[_0xd702('0xa')]),'subClient':new Redis(config[_0xd702('0xa')])}));require(_0xd702('0xd'))[_0xd702('0xe')]();require(_0xd702('0xf'))[_0xd702('0xe')](socketio);require(_0xd702('0x10'))[_0xd702('0xe')](app);require(_0xd702('0x11'))[_0xd702('0xe')](app);}else{server['once']('listening',function(){console[_0xd702('0x12')](_0xd702('0x13'),config[_0xd702('0x8')]);});}exports=module['exports']=app;
\ No newline at end of file
+var _0x008c=['../../config/triggers','default','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','createServer','timeout','listen','port','socket.io','websocket','polling','redis','defaults','localhost','socket.io-redis'];(function(_0x58fc2f,_0x111399){var _0x3a1312=function(_0x3d2ff2){while(--_0x3d2ff2){_0x58fc2f['push'](_0x58fc2f['shift']());}};_0x3a1312(++_0x111399);}(_0x008c,0x188));var _0xc008=function(_0xe5e3fb,_0x2fa636){_0xe5e3fb=_0xe5e3fb-0x0;var _0xdc5834=_0x008c[_0xe5e3fb];return _0xdc5834;};'use strict';var _=require(_0xc008('0x0'));var http=require(_0xc008('0x1'));var express=require(_0xc008('0x2'));var sticky=require(_0xc008('0x3'));var Redis=require(_0xc008('0x4'));var config=require('../../config/environment');var app=express();var server=http[_0xc008('0x5')](app);server[_0xc008('0x6')]=0xdbba0;if(sticky[_0xc008('0x7')](server,config[_0xc008('0x8')])){var socketio=require(_0xc008('0x9'))(server,{'transports':[_0xc008('0xa'),_0xc008('0xb')]});config[_0xc008('0xc')]=_[_0xc008('0xd')](config['redis'],{'host':_0xc008('0xe'),'port':0x18eb});socketio['adapter'](require(_0xc008('0xf'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require(_0xc008('0x10'))[_0xc008('0x11')]();require('../../config/socketio')['default'](socketio);require('../../config/express')[_0xc008('0x11')](app);require(_0xc008('0x12'))['default'](app);}else{server[_0xc008('0x13')](_0xc008('0x14'),function(){console[_0xc008('0x15')](_0xc008('0x16'),config[_0xc008('0x8')]);});}exports=module[_0xc008('0x17')]=app;
\ No newline at end of file
index 07740ec..e1bc08e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb458=['bluebird','../../config/logger','http','Request','debug','rpc','routing','error','message','result','catch','exports','jayson/promise'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0xb458,0x103));var _0x8b45=function(_0x5a3af7,_0x3efd5b){_0x5a3af7=_0x5a3af7-0x0;var _0x37b773=_0xb458[_0x5a3af7];return _0x37b773;};'use strict';var jayson=require(_0x8b45('0x0'));var BPromise=require(_0x8b45('0x1'));var logger=require(_0x8b45('0x2'))('routing');var client=jayson['client'][_0x8b45('0x3')]({'port':0x2329});client[_0x8b45('0x4')]=function(_0x141a44,_0x13a8c6){return new BPromise(function(_0x5d51e4,_0x333bc7){return client['request'](_0x141a44,_0x13a8c6)['then'](function(_0xe8d774){logger[_0x8b45('0x5')](_0x8b45('0x6'),_0x8b45('0x7'),_0x141a44,_0x13a8c6,_0xe8d774);if(_0xe8d774[_0x8b45('0x8')]){logger['error'](_0x8b45('0x6'),_0x8b45('0x7'),_0x141a44,_0xe8d774[_0x8b45('0x8')][_0x8b45('0x9')],_0x13a8c6);return _0x333bc7(_0xe8d774[_0x8b45('0x8')]['message']);}else{return _0x5d51e4(_0xe8d774[_0x8b45('0xa')]);}})[_0x8b45('0xb')](function(_0x57faf9){logger['error']('rpc','routing',_0x141a44,_0x57faf9,_0x13a8c6);return _0x333bc7(_0x57faf9);});});};module[_0x8b45('0xc')]=client;
\ No newline at end of file
+var _0x4aa3=['jayson/promise','bluebird','routing','client','Request','request','debug','error','rpc','message','result','catch'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x4aa3,0x174));var _0x34aa=function(_0x324c5f,_0x40ff31){_0x324c5f=_0x324c5f-0x0;var _0x53c12b=_0x4aa3[_0x324c5f];return _0x53c12b;};'use strict';var jayson=require(_0x34aa('0x0'));var BPromise=require(_0x34aa('0x1'));var logger=require('../../config/logger')(_0x34aa('0x2'));var client=jayson[_0x34aa('0x3')]['http']({'port':0x2329});client[_0x34aa('0x4')]=function(_0x3c70d9,_0x4a81e7){return new BPromise(function(_0x3f367e,_0x384e96){return client[_0x34aa('0x5')](_0x3c70d9,_0x4a81e7)['then'](function(_0x201f69){logger[_0x34aa('0x6')]('rpc',_0x34aa('0x2'),_0x3c70d9,_0x4a81e7,_0x201f69);if(_0x201f69[_0x34aa('0x7')]){logger['error'](_0x34aa('0x8'),'routing',_0x3c70d9,_0x201f69['error'][_0x34aa('0x9')],_0x4a81e7);return _0x384e96(_0x201f69[_0x34aa('0x7')][_0x34aa('0x9')]);}else{return _0x3f367e(_0x201f69[_0x34aa('0xa')]);}})[_0x34aa('0xb')](function(_0x1d8cf5){logger['error'](_0x34aa('0x8'),'routing',_0x3c70d9,_0x1d8cf5,_0x4a81e7);return _0x384e96(_0x1d8cf5);});});};module['exports']=client;
\ No newline at end of file
index dba3873..25b5d7f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd081=['getIntervals','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getFaxQueues','listen','log','./server','./realtime','./rpc/user','./rpc/chatQueue','./rpc/faxQueue','then'];(function(_0x3e4285,_0x83a4f0){var _0xce09e7=function(_0x2f13ee){while(--_0x2f13ee){_0x3e4285['push'](_0x3e4285['shift']());}};_0xce09e7(++_0x83a4f0);}(_0xd081,0x15a));var _0x1d08=function(_0x431b51,_0x755764){_0x431b51=_0x431b51-0x0;var _0x384a51=_0xd081[_0x431b51];return _0x384a51;};'use strict';var BPromise=require('bluebird');var server=require(_0x1d08('0x0'));var Realtime=require(_0x1d08('0x1'));var user=require(_0x1d08('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x1d08('0x3'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x1d08('0x4'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x1d08('0x5')](user['getAgents']())[_0x1d08('0x5')](realtime['initAgents']())['then'](interval[_0x1d08('0x6')]())[_0x1d08('0x5')](realtime[_0x1d08('0x7')]())[_0x1d08('0x5')](openchannelQueue[_0x1d08('0x8')]())[_0x1d08('0x5')](realtime['initOpenchannelQueues']())[_0x1d08('0x5')](chatQueue[_0x1d08('0x9')]())['then'](realtime[_0x1d08('0xa')]())['then'](smsQueue[_0x1d08('0xb')]())[_0x1d08('0x5')](realtime[_0x1d08('0xc')]())[_0x1d08('0x5')](mailQueue['getMailQueues']())['then'](realtime['initMailQueues']())['then'](faxQueue[_0x1d08('0xd')]())['then'](realtime['initFaxQueues']())[_0x1d08('0x5')](function(){return realtime;});}function main(){return server[_0x1d08('0xe')](realtime)[_0x1d08('0x5')](function(_0x24fa87){return initRealtime();})[_0x1d08('0x5')](function(_0x1ee86b){return setInterval(initRealtime,0x1388);})['catch'](function(_0x173439){console[_0x1d08('0xf')](_0x173439);});}main();
\ No newline at end of file
+var _0x0450=['getSmsQueues','initSmsQueues','initMailQueues','initFaxQueues','listen','catch','log','bluebird','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then','getAgents','initAgents','getIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues'];(function(_0x168127,_0x59cea1){var _0x4c99ad=function(_0x4ab3f2){while(--_0x4ab3f2){_0x168127['push'](_0x168127['shift']());}};_0x4c99ad(++_0x59cea1);}(_0x0450,0x149));var _0x0045=function(_0x47dd84,_0x187727){_0x47dd84=_0x47dd84-0x0;var _0x305c9d=_0x0450[_0x47dd84];return _0x305c9d;};'use strict';var BPromise=require(_0x0045('0x0'));var server=require('./server');var Realtime=require('./realtime');var user=require(_0x0045('0x1'));var interval=require(_0x0045('0x2'));var openchannelQueue=require(_0x0045('0x3'));var chatQueue=require(_0x0045('0x4'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x0045('0x5'));var faxQueue=require(_0x0045('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x0045('0x7')]()[_0x0045('0x8')](user[_0x0045('0x9')]())[_0x0045('0x8')](realtime[_0x0045('0xa')]())['then'](interval[_0x0045('0xb')]())['then'](realtime['initIntervals']())[_0x0045('0x8')](openchannelQueue[_0x0045('0xc')]())[_0x0045('0x8')](realtime[_0x0045('0xd')]())[_0x0045('0x8')](chatQueue[_0x0045('0xe')]())['then'](realtime[_0x0045('0xf')]())[_0x0045('0x8')](smsQueue[_0x0045('0x10')]())[_0x0045('0x8')](realtime[_0x0045('0x11')]())[_0x0045('0x8')](mailQueue['getMailQueues']())[_0x0045('0x8')](realtime[_0x0045('0x12')]())[_0x0045('0x8')](faxQueue['getFaxQueues']())['then'](realtime[_0x0045('0x13')]())[_0x0045('0x8')](function(){return realtime;});}function main(){return server[_0x0045('0x14')](realtime)['then'](function(_0x3581a3){return initRealtime();})[_0x0045('0x8')](function(_0xaebfd5){return setInterval(initRealtime,0x1388);})[_0x0045('0x15')](function(_0x5a98e0){console[_0x0045('0x16')](_0x5a98e0);});}main();
\ No newline at end of file
index faf0f2e..c7ca8cd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb5a9=['isNil','register','ignoreFactChanges','inherits','rules','activeRules','prototype','isArray','sync','filter','asc','execute','result','clone','consequence','ruleRef','index_','nextTick','push','call','next','isEqual','length','condition','matchPath','findRules','matches','turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','lodash','util','events','EventEmitter','init'];(function(_0x52c907,_0x5bb5cb){var _0x568c5a=function(_0x58580e){while(--_0x58580e){_0x52c907['push'](_0x52c907['shift']());}};_0x568c5a(++_0x5bb5cb);}(_0xb5a9,0x143));var _0x9b5a=function(_0x510902,_0x5be906){_0x510902=_0x510902-0x0;var _0x169e5a=_0xb5a9[_0x510902];return _0x169e5a;};'use strict';var _=require(_0x9b5a('0x0'));var util=require(_0x9b5a('0x1'));var EventEmitter=require(_0x9b5a('0x2'))[_0x9b5a('0x3')];function RuleEngine(_0x263887,_0x3060f9){this[_0x9b5a('0x4')]();if(!_[_0x9b5a('0x5')](_0x263887)){this[_0x9b5a('0x6')](_0x263887);}if(_0x3060f9){this[_0x9b5a('0x7')]=_0x3060f9['ignoreFactChanges'];}return this;}util[_0x9b5a('0x8')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x9b5a('0x4')]=function(_0x262bcd){this[_0x9b5a('0x9')]=[];this[_0x9b5a('0xa')]=[];};RuleEngine[_0x9b5a('0xb')][_0x9b5a('0x6')]=function(_0x2f4584){if(Array[_0x9b5a('0xc')](_0x2f4584)){this[_0x9b5a('0x9')]=this[_0x9b5a('0x9')]['concat'](_0x2f4584);}else if(_0x2f4584!==null&&_['isObject'](_0x2f4584)){this['rules']['push'](_0x2f4584);}this[_0x9b5a('0xd')]();};RuleEngine[_0x9b5a('0xb')][_0x9b5a('0xd')]=function(){this[_0x9b5a('0xa')]=this[_0x9b5a('0x9')][_0x9b5a('0xe')](function(_0x66050d){if(_[_0x9b5a('0x5')](_0x66050d['on'])){_0x66050d['on']=!![];}if(_0x66050d['on']===!![]){return _0x66050d;}});this[_0x9b5a('0xa')]=_['orderBy'](this[_0x9b5a('0xa')],['p'],[_0x9b5a('0xf')]);};RuleEngine[_0x9b5a('0xb')][_0x9b5a('0x10')]=function(_0x390ece,_0x5c3a34){var _0x4aabee=![];_0x390ece[_0x9b5a('0x11')]=!![];var _0x319fdf=_[_0x9b5a('0x12')](_0x390ece);var _0x2b8987=_['clone'](_0x390ece);var _0x4f0c3f=this[_0x9b5a('0xa')];var _0xdfbd35=[];var _0xe3fdb8=this[_0x9b5a('0x7')];(function FnRuleLoop(_0x1f48fe){var _0x21d461={'rules':function(){return _0x4f0c3f;},'rule':function(){return _0x4f0c3f[_0x1f48fe];},'when':function(_0x3ed180){if(_0x3ed180){var _0x33d75a=_0x4f0c3f[_0x1f48fe][_0x9b5a('0x13')];_0x33d75a[_0x9b5a('0x14')]=_0x4f0c3f[_0x1f48fe]['id']||_0x4f0c3f[_0x1f48fe]['name']||_0x9b5a('0x15')+_0x1f48fe;process[_0x9b5a('0x16')](function(){_0xdfbd35[_0x9b5a('0x17')](_0x33d75a[_0x9b5a('0x14')]);_0x33d75a[_0x9b5a('0x18')](_0x319fdf,_0x21d461);});}else{process['nextTick'](function(){_0x21d461[_0x9b5a('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x4aabee=!![];return FnRuleLoop(0x0);},'next':function(_0x259f4c){if(!_0xe3fdb8&&!_[_0x9b5a('0x1a')](_0x2b8987,_0x319fdf)){_0x2b8987=_[_0x9b5a('0x12')](_0x319fdf);process[_0x9b5a('0x16')](function(){_0x21d461['restart']();});}else{process[_0x9b5a('0x16')](function(){if(_['isNil'](_0x259f4c)){return FnRuleLoop(_0x1f48fe+0x1);}else{return FnRuleLoop(_0x259f4c);}});}}};if(_0x1f48fe<_0x4f0c3f[_0x9b5a('0x1b')]&&_0x4aabee===![]){var _0x5dbef6=_0x4f0c3f[_0x1f48fe][_0x9b5a('0x1c')];_0x5dbef6[_0x9b5a('0x18')](_0x319fdf,_0x21d461);}else{process[_0x9b5a('0x16')](function(){_0x319fdf[_0x9b5a('0x1d')]=_0xdfbd35;return _0x5c3a34?_0x5c3a34(_0x319fdf):_['noop']();});}}(0x0));};RuleEngine[_0x9b5a('0xb')][_0x9b5a('0x1e')]=function(_0x2a9931){if(_[_0x9b5a('0x5')](_0x2a9931)){return this[_0x9b5a('0x9')];}else{var _0x537f02=_[_0x9b5a('0x1f')](_0x2a9931);return _[_0x9b5a('0xe')](this[_0x9b5a('0x9')],_0x537f02);}};RuleEngine[_0x9b5a('0xb')][_0x9b5a('0x20')]=function(_0x174d2d,_0x90e409){var _0x174d2d=_0x174d2d==='on'||_0x174d2d==='ON'?!![]:![];var _0x34fe19=this[_0x9b5a('0x1e')](_0x90e409);for(var _0x263e69=0x0,_0x4ca627=_0x34fe19[_0x9b5a('0x1b')];_0x263e69<_0x4ca627;_0x263e69+=0x1){_0x34fe19[_0x263e69]['on']=_0x174d2d;}this['sync']();};RuleEngine[_0x9b5a('0xb')][_0x9b5a('0x21')]=function(_0x3ff000,_0x198e05){_0x3ff000=parseInt(_0x3ff000,0xa);var _0x3bb5eb=this[_0x9b5a('0x1e')](_0x198e05);for(var _0x105f1f=0x0,_0x53ef9b=_0x3bb5eb[_0x9b5a('0x1b')];_0x105f1f<_0x53ef9b;_0x105f1f+=0x1){_0x3bb5eb[_0x105f1f][_0x9b5a('0x22')]=_0x3ff000;}this[_0x9b5a('0xd')]();};RuleEngine[_0x9b5a('0xb')][_0x9b5a('0x23')]=function(){var _0x554edc=this['rules'];if(_0x554edc instanceof Array){_0x554edc=_0x554edc[_0x9b5a('0x24')](function(_0x54f114){_0x54f114[_0x9b5a('0x1c')]=_0x54f114[_0x9b5a('0x1c')][_0x9b5a('0x25')]();_0x54f114[_0x9b5a('0x13')]=_0x54f114[_0x9b5a('0x13')][_0x9b5a('0x25')]();return _0x54f114;});}else if(!_[_0x9b5a('0x5')](_0x554edc)){_0x554edc[_0x9b5a('0x1c')]=_0x554edc['condition'][_0x9b5a('0x25')]();_0x554edc[_0x9b5a('0x13')]=_0x554edc[_0x9b5a('0x13')][_0x9b5a('0x25')]();}return _0x554edc;};RuleEngine['prototype'][_0x9b5a('0x26')]=function(_0x50ed8f){this['init']();if(_[_0x9b5a('0x27')](_0x50ed8f)){_0x50ed8f=JSON['parse'](_0x50ed8f);}if(_0x50ed8f instanceof Array){_0x50ed8f=_0x50ed8f[_0x9b5a('0x24')](function(_0x1835b4){_0x1835b4['condition']=eval('('+_0x1835b4[_0x9b5a('0x1c')]+')');_0x1835b4['consequence']=eval('('+_0x1835b4['consequence']+')');return _0x1835b4;});}else if(_0x50ed8f!==null&&typeof _0x50ed8f==_0x9b5a('0x28')){_0x50ed8f[_0x9b5a('0x1c')]=eval('('+_0x50ed8f[_0x9b5a('0x1c')]+')');_0x50ed8f[_0x9b5a('0x13')]=eval('('+_0x50ed8f['consequence']+')');}this['register'](_0x50ed8f);};module['exports']=RuleEngine;
\ No newline at end of file
+var _0xab58=['call','next','isEqual','restart','matchPath','noop','matches','turn','findRules','length','prioritize','priority','toJSON','condition','toString','consequence','fromJSON','isString','parse','map','exports','util','events','init','isNil','ignoreFactChanges','inherits','prototype','rules','register','isArray','concat','isObject','push','sync','activeRules','filter','asc','execute','result','clone','ruleRef','index_','nextTick'];(function(_0x1d69aa,_0x5d9500){var _0x4b0741=function(_0x3acba4){while(--_0x3acba4){_0x1d69aa['push'](_0x1d69aa['shift']());}};_0x4b0741(++_0x5d9500);}(_0xab58,0xf1));var _0x8ab5=function(_0x553b1e,_0x44f170){_0x553b1e=_0x553b1e-0x0;var _0x387ae6=_0xab58[_0x553b1e];return _0x387ae6;};'use strict';var _=require('lodash');var util=require(_0x8ab5('0x0'));var EventEmitter=require(_0x8ab5('0x1'))['EventEmitter'];function RuleEngine(_0x18d625,_0x3f195c){this[_0x8ab5('0x2')]();if(!_[_0x8ab5('0x3')](_0x18d625)){this['register'](_0x18d625);}if(_0x3f195c){this['ignoreFactChanges']=_0x3f195c[_0x8ab5('0x4')];}return this;}util[_0x8ab5('0x5')](RuleEngine,EventEmitter);RuleEngine[_0x8ab5('0x6')][_0x8ab5('0x2')]=function(_0x400fb9){this[_0x8ab5('0x7')]=[];this['activeRules']=[];};RuleEngine[_0x8ab5('0x6')][_0x8ab5('0x8')]=function(_0x3f7fb7){if(Array[_0x8ab5('0x9')](_0x3f7fb7)){this[_0x8ab5('0x7')]=this[_0x8ab5('0x7')][_0x8ab5('0xa')](_0x3f7fb7);}else if(_0x3f7fb7!==null&&_[_0x8ab5('0xb')](_0x3f7fb7)){this[_0x8ab5('0x7')][_0x8ab5('0xc')](_0x3f7fb7);}this[_0x8ab5('0xd')]();};RuleEngine[_0x8ab5('0x6')][_0x8ab5('0xd')]=function(){this[_0x8ab5('0xe')]=this[_0x8ab5('0x7')][_0x8ab5('0xf')](function(_0x497621){if(_[_0x8ab5('0x3')](_0x497621['on'])){_0x497621['on']=!![];}if(_0x497621['on']===!![]){return _0x497621;}});this[_0x8ab5('0xe')]=_['orderBy'](this['activeRules'],['p'],[_0x8ab5('0x10')]);};RuleEngine['prototype'][_0x8ab5('0x11')]=function(_0x11ca21,_0x4baccf){var _0xddd60=![];_0x11ca21[_0x8ab5('0x12')]=!![];var _0x821642=_['clone'](_0x11ca21);var _0x333db7=_[_0x8ab5('0x13')](_0x11ca21);var _0x1e75bd=this[_0x8ab5('0xe')];var _0x4b8b70=[];var _0xb9503b=this[_0x8ab5('0x4')];(function FnRuleLoop(_0x44fe3e){var _0x97aae4={'rules':function(){return _0x1e75bd;},'rule':function(){return _0x1e75bd[_0x44fe3e];},'when':function(_0x12335c){if(_0x12335c){var _0x5200d2=_0x1e75bd[_0x44fe3e]['consequence'];_0x5200d2[_0x8ab5('0x14')]=_0x1e75bd[_0x44fe3e]['id']||_0x1e75bd[_0x44fe3e]['name']||_0x8ab5('0x15')+_0x44fe3e;process[_0x8ab5('0x16')](function(){_0x4b8b70['push'](_0x5200d2[_0x8ab5('0x14')]);_0x5200d2[_0x8ab5('0x17')](_0x821642,_0x97aae4);});}else{process[_0x8ab5('0x16')](function(){_0x97aae4[_0x8ab5('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0xddd60=!![];return FnRuleLoop(0x0);},'next':function(_0x4e52cb){if(!_0xb9503b&&!_[_0x8ab5('0x19')](_0x333db7,_0x821642)){_0x333db7=_[_0x8ab5('0x13')](_0x821642);process[_0x8ab5('0x16')](function(){_0x97aae4[_0x8ab5('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x8ab5('0x3')](_0x4e52cb)){return FnRuleLoop(_0x44fe3e+0x1);}else{return FnRuleLoop(_0x4e52cb);}});}}};if(_0x44fe3e<_0x1e75bd['length']&&_0xddd60===![]){var _0x52f1a1=_0x1e75bd[_0x44fe3e]['condition'];_0x52f1a1[_0x8ab5('0x17')](_0x821642,_0x97aae4);}else{process[_0x8ab5('0x16')](function(){_0x821642[_0x8ab5('0x1b')]=_0x4b8b70;return _0x4baccf?_0x4baccf(_0x821642):_[_0x8ab5('0x1c')]();});}}(0x0));};RuleEngine[_0x8ab5('0x6')]['findRules']=function(_0x4aeff0){if(_[_0x8ab5('0x3')](_0x4aeff0)){return this['rules'];}else{var _0x3c8154=_[_0x8ab5('0x1d')](_0x4aeff0);return _['filter'](this['rules'],_0x3c8154);}};RuleEngine['prototype'][_0x8ab5('0x1e')]=function(_0x1a7b69,_0x390489){var _0x1a7b69=_0x1a7b69==='on'||_0x1a7b69==='ON'?!![]:![];var _0xb1dff6=this[_0x8ab5('0x1f')](_0x390489);for(var _0x336a07=0x0,_0x3c55d6=_0xb1dff6[_0x8ab5('0x20')];_0x336a07<_0x3c55d6;_0x336a07+=0x1){_0xb1dff6[_0x336a07]['on']=_0x1a7b69;}this[_0x8ab5('0xd')]();};RuleEngine[_0x8ab5('0x6')][_0x8ab5('0x21')]=function(_0x5a2855,_0x1ca299){_0x5a2855=parseInt(_0x5a2855,0xa);var _0x4b4638=this[_0x8ab5('0x1f')](_0x1ca299);for(var _0x1d3e96=0x0,_0x397cb3=_0x4b4638[_0x8ab5('0x20')];_0x1d3e96<_0x397cb3;_0x1d3e96+=0x1){_0x4b4638[_0x1d3e96][_0x8ab5('0x22')]=_0x5a2855;}this[_0x8ab5('0xd')]();};RuleEngine[_0x8ab5('0x6')][_0x8ab5('0x23')]=function(){var _0x30eabe=this['rules'];if(_0x30eabe instanceof Array){_0x30eabe=_0x30eabe['map'](function(_0x2cc475){_0x2cc475[_0x8ab5('0x24')]=_0x2cc475['condition'][_0x8ab5('0x25')]();_0x2cc475[_0x8ab5('0x26')]=_0x2cc475['consequence']['toString']();return _0x2cc475;});}else if(!_['isNil'](_0x30eabe)){_0x30eabe['condition']=_0x30eabe['condition']['toString']();_0x30eabe[_0x8ab5('0x26')]=_0x30eabe[_0x8ab5('0x26')]['toString']();}return _0x30eabe;};RuleEngine[_0x8ab5('0x6')][_0x8ab5('0x27')]=function(_0x4f4f49){this[_0x8ab5('0x2')]();if(_[_0x8ab5('0x28')](_0x4f4f49)){_0x4f4f49=JSON[_0x8ab5('0x29')](_0x4f4f49);}if(_0x4f4f49 instanceof Array){_0x4f4f49=_0x4f4f49[_0x8ab5('0x2a')](function(_0x4323b0){_0x4323b0[_0x8ab5('0x24')]=eval('('+_0x4323b0[_0x8ab5('0x24')]+')');_0x4323b0['consequence']=eval('('+_0x4323b0[_0x8ab5('0x26')]+')');return _0x4323b0;});}else if(_0x4f4f49!==null&&typeof _0x4f4f49=='object'){_0x4f4f49[_0x8ab5('0x24')]=eval('('+_0x4f4f49[_0x8ab5('0x24')]+')');_0x4f4f49['consequence']=eval('('+_0x4f4f49[_0x8ab5('0x26')]+')');}this[_0x8ab5('0x8')](_0x4f4f49);};module[_0x8ab5('0x2b')]=RuleEngine;
\ No newline at end of file
index 23bba99..e1db236 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x379d08,_0x47210a){var _0x3fceb7=function(_0x287419){while(--_0x287419){_0x379d08['push'](_0x379d08['shift']());}};_0x3fceb7(++_0x47210a);}(_0x34e8,0x12c));var _0x834e=function(_0x1e2863,_0x5ad3f9){_0x1e2863=_0x1e2863-0x0;var _0x1cb5f8=_0x34e8[_0x1e2863];return _0x1cb5f8;};'use strict';var BPromise=require(_0x834e('0x0'));var jayson=require(_0x834e('0x1'));var client=jayson[_0x834e('0x2')][_0x834e('0x3')]({'port':0x232b});function request(_0x530939,_0x832422){return new BPromise(function(_0x21e2e0,_0x472111){return client[_0x834e('0x4')](_0x530939,_0x832422)[_0x834e('0x5')](function(_0x19a3e0){if(_0x19a3e0[_0x834e('0x6')]){return _0x472111(_0x19a3e0['error'][_0x834e('0x7')]);}else{return _0x21e2e0(_0x19a3e0['result']);}})[_0x834e('0x8')](function(_0x3cc2e3){return _0x472111(_0x3cc2e3);});});}exports[_0x834e('0x9')]=function(_0x2e69e2,_0x33ea05){return request(_0x834e('0xa'),{'account':_0x2e69e2,'message':_0x33ea05});};
\ No newline at end of file
+var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x1e9336,_0x27bc62){var _0x61a3f7=function(_0x940835){while(--_0x940835){_0x1e9336['push'](_0x1e9336['shift']());}};_0x61a3f7(++_0x27bc62);}(_0x814b,0x1a2));var _0xb814=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0x814b[_0x2e8418];return _0x548fe6;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});};
\ No newline at end of file
index 5627284..ae0549c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9679=['getChannelStatus','Capacity','CurrentCapacity','maxcapacity','idle','mail','chat','openchannel','fax','sms','StatusTime','toNumber','format','Status','faxStatusTime','faxCurrentCapacity','smsStatusTime','smsCurrentCapacity','openchannelCurrentCapacity','busy','stringify','emit','exports','lodash','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','smsStatus','smsCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busyQueue','md5','updateRealtime','prototype'];(function(_0x407f2e,_0x209e8c){var _0x48a967=function(_0x1bb3b8){while(--_0x1bb3b8){_0x407f2e['push'](_0x407f2e['shift']());}};_0x48a967(++_0x209e8c);}(_0x9679,0x16d));var _0x9967=function(_0x449e08,_0x40982f){_0x449e08=_0x449e08-0x0;var _0x164fdf=_0x9679[_0x449e08];return _0x164fdf;};'use strict';var _=require(_0x9967('0x0'));var moment=require(_0x9967('0x1'));var md5=require('md5');var Redis=require(_0x9967('0x2'));var config=require(_0x9967('0x3'));config[_0x9967('0x4')]=_[_0x9967('0x5')](config['redis'],{'host':_0x9967('0x6'),'port':0x18eb});var io=require(_0x9967('0x7'))(new Redis(config[_0x9967('0x4')]));function Agent(_0xa6fe24){this['id']=_0xa6fe24['id']||0x0;this[_0x9967('0x8')]=_0xa6fe24[_0x9967('0x8')]||'';this[_0x9967('0x9')]=_0xa6fe24[_0x9967('0x9')]||!![];this[_0x9967('0xa')]=_0xa6fe24['voicePause']||![];this[_0x9967('0xb')]=_0xa6fe24[_0x9967('0xb')]||![];this['mailPause']=_0xa6fe24[_0x9967('0xc')]||![];this[_0x9967('0xd')]=_0xa6fe24[_0x9967('0xd')]||![];this[_0x9967('0xe')]=_0xa6fe24[_0x9967('0xe')]||![];this['openchannelPause']=_0xa6fe24[_0x9967('0xf')]||![];this['chatStatus']=_0x9967('0x10');this[_0x9967('0x11')]=0x0;this['chatCapacity']=_0xa6fe24['chatCapacity']||0x0;this[_0x9967('0x12')]=0x0;this[_0x9967('0x13')]=_0x9967('0x10');this[_0x9967('0x14')]=0x0;this[_0x9967('0x15')]=_0xa6fe24[_0x9967('0x15')]||0x0;this[_0x9967('0x16')]=0x0;this[_0x9967('0x17')]=_0x9967('0x10');this['faxStatusTime']=0x0;this[_0x9967('0x18')]=_0xa6fe24[_0x9967('0x18')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x9967('0x19')]=_0x9967('0x10');this['smsStatusTime']=0x0;this[_0x9967('0x1a')]=_0xa6fe24[_0x9967('0x1a')]||0x0;this['smsCurrentCapacity']=0x0;this[_0x9967('0x1b')]=_0x9967('0x10');this[_0x9967('0x1c')]=0x0;this[_0x9967('0x1d')]=_0xa6fe24[_0x9967('0x1d')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this[_0x9967('0x1e')]=undefined;this[_0x9967('0x1f')]='';this[_0x9967('0x20')]();}Agent[_0x9967('0x21')][_0x9967('0x22')]=function(_0x33ac0c){if(this[_0x33ac0c+'CurrentCapacity']>0x0){if(this[_0x33ac0c+_0x9967('0x23')]>0x0&&this[_0x33ac0c+_0x9967('0x24')]>=this[_0x33ac0c+_0x9967('0x23')]){return _0x9967('0x25');}else{return'working';}}else{return _0x9967('0x26');}};Agent[_0x9967('0x21')][_0x9967('0x20')]=function(){var _0x3e3022=[_0x9967('0x27'),_0x9967('0x28'),_0x9967('0x29'),_0x9967('0x2a'),_0x9967('0x2b')];for(var _0x1c7f16=0x0;_0x1c7f16<_0x3e3022['length'];_0x1c7f16+=0x1){var _0x1ec56d=this[_0x9967('0x22')](_0x3e3022[_0x1c7f16]);if(this[_0x3e3022[_0x1c7f16]+'Status']!==_0x1ec56d){this[_0x3e3022[_0x1c7f16]+_0x9967('0x2c')]=_[_0x9967('0x2d')](moment()[_0x9967('0x2e')]('x'));}this[_0x3e3022[_0x1c7f16]+_0x9967('0x2f')]=_0x1ec56d;}var _0x66c74a={'id':this['id'],'name':this[_0x9967('0x8')],'online':this[_0x9967('0x9')],'voicePause':this[_0x9967('0xa')],'chatPause':this[_0x9967('0xb')],'mailPause':this[_0x9967('0xc')],'smsPause':this['smsPause'],'faxPause':this[_0x9967('0xd')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x9967('0x11')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x9967('0x12')],'mailStatus':this[_0x9967('0x13')],'mailStatusTime':this[_0x9967('0x14')],'mailCapacity':this[_0x9967('0x15')],'mailCurrentCapacity':this[_0x9967('0x16')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x9967('0x30')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x9967('0x31')],'smsStatus':this[_0x9967('0x19')],'smsStatusTime':this[_0x9967('0x32')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x9967('0x33')],'openchannelStatus':this[_0x9967('0x1b')],'openchannelStatusTime':this[_0x9967('0x1c')],'openchannelCapacity':this[_0x9967('0x1d')],'openchannelCurrentCapacity':this[_0x9967('0x34')],'busy':this[_0x9967('0x35')],'busyQueue':this[_0x9967('0x1e')]};var _0x4f662e=md5(JSON[_0x9967('0x36')](_0x66c74a));if(this[_0x9967('0x1f')]!==_0x4f662e){this['md5']=_0x4f662e;io[_0x9967('0x37')]('user:save',_0x66c74a);}};module[_0x9967('0x38')]=Agent;
\ No newline at end of file
+var _0x9db5=['mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','updateRealtime','mail','chat','fax','sms','length','Status','StatusTime','toNumber','format','faxPause','chatCurrentCapacity','openchannelStatusTime','emit','user:save','exports','moment','ioredis','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity'];(function(_0xc22cf4,_0x1aa535){var _0x543c7e=function(_0x3f7a84){while(--_0x3f7a84){_0xc22cf4['push'](_0xc22cf4['shift']());}};_0x543c7e(++_0x1aa535);}(_0x9db5,0x103));var _0x59db=function(_0x4ef812,_0x195027){_0x4ef812=_0x4ef812-0x0;var _0x5bac81=_0x9db5[_0x4ef812];return _0x5bac81;};'use strict';var _=require('lodash');var moment=require(_0x59db('0x0'));var md5=require('md5');var Redis=require(_0x59db('0x1'));var config=require('../../../config/environment');config[_0x59db('0x2')]=_[_0x59db('0x3')](config[_0x59db('0x2')],{'host':_0x59db('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x59db('0x2')]));function Agent(_0x53d038){this['id']=_0x53d038['id']||0x0;this[_0x59db('0x5')]=_0x53d038[_0x59db('0x5')]||'';this['online']=_0x53d038[_0x59db('0x6')]||!![];this[_0x59db('0x7')]=_0x53d038['voicePause']||![];this[_0x59db('0x8')]=_0x53d038[_0x59db('0x8')]||![];this['mailPause']=_0x53d038[_0x59db('0x9')]||![];this['faxPause']=_0x53d038['faxPause']||![];this[_0x59db('0xa')]=_0x53d038[_0x59db('0xa')]||![];this[_0x59db('0xb')]=_0x53d038[_0x59db('0xb')]||![];this[_0x59db('0xc')]=_0x59db('0xd');this[_0x59db('0xe')]=0x0;this[_0x59db('0xf')]=_0x53d038[_0x59db('0xf')]||0x0;this['chatCurrentCapacity']=0x0;this[_0x59db('0x10')]=_0x59db('0xd');this[_0x59db('0x11')]=0x0;this[_0x59db('0x12')]=_0x53d038['mailCapacity']||0x0;this[_0x59db('0x13')]=0x0;this['faxStatus']=_0x59db('0xd');this[_0x59db('0x14')]=0x0;this['faxCapacity']=_0x53d038[_0x59db('0x15')]||0x0;this[_0x59db('0x16')]=0x0;this['smsStatus']='unknown';this[_0x59db('0x17')]=0x0;this['smsCapacity']=_0x53d038[_0x59db('0x18')]||0x0;this[_0x59db('0x19')]=0x0;this[_0x59db('0x1a')]=_0x59db('0xd');this['openchannelStatusTime']=0x0;this[_0x59db('0x1b')]=_0x53d038[_0x59db('0x1b')]||0x0;this[_0x59db('0x1c')]=0x0;this[_0x59db('0x1d')]=![];this[_0x59db('0x1e')]=undefined;this[_0x59db('0x1f')]='';this['updateRealtime']();}Agent[_0x59db('0x20')][_0x59db('0x21')]=function(_0x237394){if(this[_0x237394+_0x59db('0x22')]>0x0){if(this[_0x237394+_0x59db('0x23')]>0x0&&this[_0x237394+_0x59db('0x22')]>=this[_0x237394+_0x59db('0x23')]){return _0x59db('0x24');}else{return _0x59db('0x25');}}else{return _0x59db('0x26');}};Agent['prototype'][_0x59db('0x27')]=function(){var _0x22f9ff=[_0x59db('0x28'),_0x59db('0x29'),'openchannel',_0x59db('0x2a'),_0x59db('0x2b')];for(var _0x273aca=0x0;_0x273aca<_0x22f9ff[_0x59db('0x2c')];_0x273aca+=0x1){var _0x54f3ca=this[_0x59db('0x21')](_0x22f9ff[_0x273aca]);if(this[_0x22f9ff[_0x273aca]+_0x59db('0x2d')]!==_0x54f3ca){this[_0x22f9ff[_0x273aca]+_0x59db('0x2e')]=_[_0x59db('0x2f')](moment()[_0x59db('0x30')]('x'));}this[_0x22f9ff[_0x273aca]+'Status']=_0x54f3ca;}var _0xd55101={'id':this['id'],'name':this[_0x59db('0x5')],'online':this['online'],'voicePause':this[_0x59db('0x7')],'chatPause':this[_0x59db('0x8')],'mailPause':this[_0x59db('0x9')],'smsPause':this['smsPause'],'faxPause':this[_0x59db('0x31')],'openchannelPause':this[_0x59db('0xb')],'chatStatus':this[_0x59db('0xc')],'chatStatusTime':this[_0x59db('0xe')],'chatCapacity':this[_0x59db('0xf')],'chatCurrentCapacity':this[_0x59db('0x32')],'mailStatus':this[_0x59db('0x10')],'mailStatusTime':this[_0x59db('0x11')],'mailCapacity':this[_0x59db('0x12')],'mailCurrentCapacity':this[_0x59db('0x13')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x59db('0x15')],'faxCurrentCapacity':this[_0x59db('0x16')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x59db('0x17')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'openchannelStatus':this[_0x59db('0x1a')],'openchannelStatusTime':this[_0x59db('0x33')],'openchannelCapacity':this[_0x59db('0x1b')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x59db('0x1d')],'busyQueue':this[_0x59db('0x1e')]};var _0x18b8ab=md5(JSON['stringify'](_0xd55101));if(this[_0x59db('0x1f')]!==_0x18b8ab){this['md5']=_0x18b8ab;io[_0x59db('0x34')](_0x59db('0x35'),_0xd55101);}};module[_0x59db('0x36')]=Agent;
\ No newline at end of file
index b987001..6e5d836 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8ee9=['updateRouting','updateRealtime','_rr','prototype','loggedIn','length','online','paused','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x353acd,_0x41840a){var _0xf04d94=function(_0x5477f5){while(--_0x5477f5){_0x353acd['push'](_0x353acd['shift']());}};_0xf04d94(++_0x41840a);}(_0x8ee9,0x1c2));var _0x98ee=function(_0x100a4c,_0x5b88dc){_0x100a4c=_0x100a4c-0x0;var _0x201757=_0x8ee9[_0x100a4c];return _0x201757;};'use strict';var _=require(_0x98ee('0x0'));var md5=require(_0x98ee('0x1'));var util=require(_0x98ee('0x2'));var Redis=require(_0x98ee('0x3'));var config=require(_0x98ee('0x4'));config['redis']=_[_0x98ee('0x5')](config[_0x98ee('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x98ee('0x6')]));function ChatQueue(_0x1a397d){this['id']=_0x1a397d['id']||0x0;this[_0x98ee('0x7')]=_0x1a397d['name']||'';this['timeout']=_0x1a397d[_0x98ee('0x8')]||0xa;this[_0x98ee('0x9')]=_0x1a397d[_0x98ee('0x9')]||_0x98ee('0xa');this[_0x98ee('0xb')]=_0x1a397d[_0x98ee('0xb')];this[_0x98ee('0xc')]={};this[_0x98ee('0xd')]=0x0;this['md5']='';this[_0x98ee('0xe')]();this[_0x98ee('0xf')]();}ChatQueue['prototype']['updateRouting']=function(){var _0x40c6a4=this[_0x98ee('0xc')][_0x98ee('0x10')];this[_0x98ee('0xc')]=_['map'](this[_0x98ee('0xb')],'id');this[_0x98ee('0xc')]['_rr']=_0x40c6a4;};ChatQueue[_0x98ee('0x11')][_0x98ee('0xf')]=function(){this[_0x98ee('0x12')]=0x0;this['paused']=0x0;for(var _0x5f055d=0x0;_0x5f055d<this[_0x98ee('0xb')][_0x98ee('0x13')];_0x5f055d+=0x1){if(this[_0x98ee('0xb')][_0x5f055d][_0x98ee('0x14')]){this[_0x98ee('0x12')]+=0x1;}if(this[_0x98ee('0xb')][_0x5f055d]['chatPause']){this[_0x98ee('0x15')]+=0x1;}}this[_0x98ee('0x16')]=this['loggedIn']-this[_0x98ee('0x15')];this['available']=this['available']>=0x0?this[_0x98ee('0x16')]:0x0;var _0x16f46a={'id':this['id'],'available':this[_0x98ee('0x16')],'loggedIn':this[_0x98ee('0x12')],'name':this[_0x98ee('0x7')],'paused':this['paused'],'waiting':this[_0x98ee('0xd')]};var _0x2e1a07=md5(JSON[_0x98ee('0x17')](_0x16f46a));if(this[_0x98ee('0x1')]!==_0x2e1a07){this['md5']=_0x2e1a07;io['to'](util[_0x98ee('0x18')](_0x98ee('0x19'),_0x16f46a[_0x98ee('0x7')]))[_0x98ee('0x1a')](_0x98ee('0x1b'),_0x16f46a);}};module[_0x98ee('0x1c')]=ChatQueue;
\ No newline at end of file
+var _0x3c72=['online','chatPause','available','stringify','format','chat:queue:%s','chat_queue:save','exports','lodash','md5','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','prototype','updateRouting','_rr','mapAgentsId','map','updateRealtime','loggedIn','paused','length'];(function(_0xbcc669,_0x1b7137){var _0x1f45c5=function(_0x5415d5){while(--_0x5415d5){_0xbcc669['push'](_0xbcc669['shift']());}};_0x1f45c5(++_0x1b7137);}(_0x3c72,0xbc));var _0x23c7=function(_0x2e8915,_0x453aee){_0x2e8915=_0x2e8915-0x0;var _0x221f15=_0x3c72[_0x2e8915];return _0x221f15;};'use strict';var _=require(_0x23c7('0x0'));var md5=require(_0x23c7('0x1'));var util=require(_0x23c7('0x2'));var Redis=require(_0x23c7('0x3'));var config=require('../../../config/environment');config[_0x23c7('0x4')]=_['defaults'](config[_0x23c7('0x4')],{'host':_0x23c7('0x5'),'port':0x18eb});var io=require(_0x23c7('0x6'))(new Redis(config['redis']));function ChatQueue(_0x566a61){this['id']=_0x566a61['id']||0x0;this['name']=_0x566a61[_0x23c7('0x7')]||'';this[_0x23c7('0x8')]=_0x566a61['timeout']||0xa;this[_0x23c7('0x9')]=_0x566a61[_0x23c7('0x9')]||_0x23c7('0xa');this[_0x23c7('0xb')]=_0x566a61['Agents'];this['mapAgentsId']={};this[_0x23c7('0xc')]=0x0;this[_0x23c7('0x1')]='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0x23c7('0xd')][_0x23c7('0xe')]=function(){var _0x31addc=this['mapAgentsId'][_0x23c7('0xf')];this[_0x23c7('0x10')]=_[_0x23c7('0x11')](this[_0x23c7('0xb')],'id');this['mapAgentsId'][_0x23c7('0xf')]=_0x31addc;};ChatQueue[_0x23c7('0xd')][_0x23c7('0x12')]=function(){this[_0x23c7('0x13')]=0x0;this[_0x23c7('0x14')]=0x0;for(var _0x5b4637=0x0;_0x5b4637<this[_0x23c7('0xb')][_0x23c7('0x15')];_0x5b4637+=0x1){if(this['Agents'][_0x5b4637][_0x23c7('0x16')]){this['loggedIn']+=0x1;}if(this[_0x23c7('0xb')][_0x5b4637][_0x23c7('0x17')]){this['paused']+=0x1;}}this[_0x23c7('0x18')]=this[_0x23c7('0x13')]-this[_0x23c7('0x14')];this[_0x23c7('0x18')]=this[_0x23c7('0x18')]>=0x0?this[_0x23c7('0x18')]:0x0;var _0x2837ca={'id':this['id'],'available':this[_0x23c7('0x18')],'loggedIn':this[_0x23c7('0x13')],'name':this[_0x23c7('0x7')],'paused':this[_0x23c7('0x14')],'waiting':this['waiting']};var _0xccff47=md5(JSON[_0x23c7('0x19')](_0x2837ca));if(this[_0x23c7('0x1')]!==_0xccff47){this[_0x23c7('0x1')]=_0xccff47;io['to'](util[_0x23c7('0x1a')](_0x23c7('0x1b'),_0x2837ca[_0x23c7('0x7')]))['emit'](_0x23c7('0x1c'),_0x2837ca);}};module[_0x23c7('0x1d')]=ChatQueue;
\ No newline at end of file
index fb37884..8df36dd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe7e0=['lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','map','_rr','prototype','loggedIn','paused','length','online','available','format','fax:queue:%s','exports'];(function(_0x35cc29,_0x41c298){var _0x11b2b0=function(_0x1a19a4){while(--_0x1a19a4){_0x35cc29['push'](_0x35cc29['shift']());}};_0x11b2b0(++_0x41c298);}(_0xe7e0,0x1d4));var _0x0e7e=function(_0x2bcb27,_0x5c3bc2){_0x2bcb27=_0x2bcb27-0x0;var _0x3b9499=_0xe7e0[_0x2bcb27];return _0x3b9499;};'use strict';var _=require(_0x0e7e('0x0'));var md5=require(_0x0e7e('0x1'));var util=require('util');var Redis=require(_0x0e7e('0x2'));var config=require(_0x0e7e('0x3'));config[_0x0e7e('0x4')]=_[_0x0e7e('0x5')](config['redis'],{'host':_0x0e7e('0x6'),'port':0x18eb});var io=require(_0x0e7e('0x7'))(new Redis(config[_0x0e7e('0x4')]));function FaxQueue(_0x5c7a3a){this['id']=_0x5c7a3a['id']||0x0;this[_0x0e7e('0x8')]=_0x5c7a3a[_0x0e7e('0x8')]||'';this[_0x0e7e('0x9')]=_0x5c7a3a[_0x0e7e('0x9')]||0xa;this[_0x0e7e('0xa')]=_0x5c7a3a[_0x0e7e('0xa')]||'beepall';this[_0x0e7e('0xb')]=_0x5c7a3a['Agents'];this[_0x0e7e('0xc')]={};this[_0x0e7e('0xd')]=0x0;this[_0x0e7e('0x1')]='';this[_0x0e7e('0xe')]();this['updateRealtime']();}FaxQueue['prototype']['updateRouting']=function(){var _0x5b9306=this[_0x0e7e('0xc')]['_rr'];this[_0x0e7e('0xc')]=_[_0x0e7e('0xf')](this[_0x0e7e('0xb')],'id');this['mapAgentsId'][_0x0e7e('0x10')]=_0x5b9306;};FaxQueue[_0x0e7e('0x11')]['updateRealtime']=function(){this[_0x0e7e('0x12')]=0x0;this[_0x0e7e('0x13')]=0x0;for(var _0x54b127=0x0;_0x54b127<this[_0x0e7e('0xb')][_0x0e7e('0x14')];_0x54b127+=0x1){if(this['Agents'][_0x54b127][_0x0e7e('0x15')]){this['loggedIn']+=0x1;}if(this[_0x0e7e('0xb')][_0x54b127]['faxPause']){this[_0x0e7e('0x13')]+=0x1;}}this[_0x0e7e('0x16')]=this['loggedIn']-this[_0x0e7e('0x13')];this['available']=this[_0x0e7e('0x16')]>=0x0?this[_0x0e7e('0x16')]:0x0;var _0x2df3c7={'id':this['id'],'available':this['available'],'loggedIn':this[_0x0e7e('0x12')],'name':this[_0x0e7e('0x8')],'paused':this['paused'],'waiting':this[_0x0e7e('0xd')]};var _0x38d8f2=md5(JSON['stringify'](_0x2df3c7));if(this['md5']!==_0x38d8f2){this[_0x0e7e('0x1')]=_0x38d8f2;io['to'](util[_0x0e7e('0x17')](_0x0e7e('0x18'),_0x2df3c7[_0x0e7e('0x8')]))['emit']('fax_queue:save',_0x2df3c7);}};module[_0x0e7e('0x19')]=FaxQueue;
\ No newline at end of file
+var _0x517c=['updateRealtime','prototype','map','_rr','loggedIn','paused','length','online','faxPause','available','waiting','stringify','md5','fax:queue:%s','fax_queue:save','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting'];(function(_0x3487e1,_0x5e9ee1){var _0x1f16c7=function(_0x3d6c2a){while(--_0x3d6c2a){_0x3487e1['push'](_0x3487e1['shift']());}};_0x1f16c7(++_0x5e9ee1);}(_0x517c,0x17b));var _0xc517=function(_0x39d6a8,_0xc9c91a){_0x39d6a8=_0x39d6a8-0x0;var _0x93f3db=_0x517c[_0x39d6a8];return _0x93f3db;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xc517('0x0'));var Redis=require(_0xc517('0x1'));var config=require('../../../config/environment');config[_0xc517('0x2')]=_[_0xc517('0x3')](config[_0xc517('0x2')],{'host':_0xc517('0x4'),'port':0x18eb});var io=require(_0xc517('0x5'))(new Redis(config[_0xc517('0x2')]));function FaxQueue(_0x5ef968){this['id']=_0x5ef968['id']||0x0;this[_0xc517('0x6')]=_0x5ef968[_0xc517('0x6')]||'';this[_0xc517('0x7')]=_0x5ef968[_0xc517('0x7')]||0xa;this[_0xc517('0x8')]=_0x5ef968[_0xc517('0x8')]||_0xc517('0x9');this['Agents']=_0x5ef968[_0xc517('0xa')];this[_0xc517('0xb')]={};this['waiting']=0x0;this['md5']='';this[_0xc517('0xc')]();this[_0xc517('0xd')]();}FaxQueue[_0xc517('0xe')][_0xc517('0xc')]=function(){var _0x386fa1=this['mapAgentsId']['_rr'];this[_0xc517('0xb')]=_[_0xc517('0xf')](this['Agents'],'id');this[_0xc517('0xb')][_0xc517('0x10')]=_0x386fa1;};FaxQueue['prototype']['updateRealtime']=function(){this[_0xc517('0x11')]=0x0;this[_0xc517('0x12')]=0x0;for(var _0x7d5655=0x0;_0x7d5655<this[_0xc517('0xa')][_0xc517('0x13')];_0x7d5655+=0x1){if(this[_0xc517('0xa')][_0x7d5655][_0xc517('0x14')]){this[_0xc517('0x11')]+=0x1;}if(this['Agents'][_0x7d5655][_0xc517('0x15')]){this[_0xc517('0x12')]+=0x1;}}this['available']=this['loggedIn']-this[_0xc517('0x12')];this[_0xc517('0x16')]=this[_0xc517('0x16')]>=0x0?this[_0xc517('0x16')]:0x0;var _0x100bc4={'id':this['id'],'available':this[_0xc517('0x16')],'loggedIn':this[_0xc517('0x11')],'name':this[_0xc517('0x6')],'paused':this[_0xc517('0x12')],'waiting':this[_0xc517('0x17')]};var _0x453881=md5(JSON[_0xc517('0x18')](_0x100bc4));if(this[_0xc517('0x19')]!==_0x453881){this['md5']=_0x453881;io['to'](util['format'](_0xc517('0x1a'),_0x100bc4[_0xc517('0x6')]))['emit'](_0xc517('0x1b'),_0x100bc4);}};module['exports']=FaxQueue;
\ No newline at end of file
index b1f78d1..95e4016 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9d31=['Intervals','name'];(function(_0x301c69,_0x54a617){var _0x5826f3=function(_0x2ca700){while(--_0x2ca700){_0x301c69['push'](_0x301c69['shift']());}};_0x5826f3(++_0x54a617);}(_0x9d31,0x175));var _0x19d3=function(_0x1fbb19,_0x4ef431){_0x1fbb19=_0x1fbb19-0x0;var _0x44eab2=_0x9d31[_0x1fbb19];return _0x44eab2;};'use strict';function Interval(_0x88935b){this['id']=_0x88935b['id']||0x0;this[_0x19d3('0x0')]=_0x88935b[_0x19d3('0x0')]||'';this[_0x19d3('0x1')]=_0x88935b['Intervals']||{};}module['exports']=Interval;
\ No newline at end of file
+var _0x4eee=['exports','name','Intervals'];(function(_0xcf3aa9,_0x2faa71){var _0xd3eb4e=function(_0x1b1a93){while(--_0x1b1a93){_0xcf3aa9['push'](_0xcf3aa9['shift']());}};_0xd3eb4e(++_0x2faa71);}(_0x4eee,0xca));var _0xe4ee=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x4eee[_0x5317b5];return _0x3b7ce2;};'use strict';function Interval(_0x31dbd6){this['id']=_0x31dbd6['id']||0x0;this[_0xe4ee('0x0')]=_0x31dbd6[_0xe4ee('0x0')]||'';this[_0xe4ee('0x1')]=_0x31dbd6['Intervals']||{};}module[_0xe4ee('0x2')]=Interval;
\ No newline at end of file
index 53792f8..79e36d8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7804=['util','ioredis','../../../config/environment','defaults','redis','name','timeout','strategy','beepall','mapAgentsId','waiting','md5','updateRouting','map','Agents','_rr','prototype','paused','length','online','available','loggedIn','format','mail:queue:%s','emit','mail_queue:save','exports','lodash'];(function(_0x3efbb7,_0x25ad5e){var _0x1dc543=function(_0x5aca8d){while(--_0x5aca8d){_0x3efbb7['push'](_0x3efbb7['shift']());}};_0x1dc543(++_0x25ad5e);}(_0x7804,0xc3));var _0x4780=function(_0x12812b,_0x2da778){_0x12812b=_0x12812b-0x0;var _0x3e64b5=_0x7804[_0x12812b];return _0x3e64b5;};'use strict';var _=require(_0x4780('0x0'));var md5=require('md5');var util=require(_0x4780('0x1'));var Redis=require(_0x4780('0x2'));var config=require(_0x4780('0x3'));config['redis']=_[_0x4780('0x4')](config[_0x4780('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4780('0x5')]));function MailQueue(_0x4f3cd5){this['id']=_0x4f3cd5['id']||0x0;this['name']=_0x4f3cd5[_0x4780('0x6')]||'';this[_0x4780('0x7')]=_0x4f3cd5[_0x4780('0x7')]||0xa;this[_0x4780('0x8')]=_0x4f3cd5['strategy']||_0x4780('0x9');this['Agents']=_0x4f3cd5['Agents'];this[_0x4780('0xa')]={};this[_0x4780('0xb')]=0x0;this[_0x4780('0xc')]='';this[_0x4780('0xd')]();this['updateRealtime']();}MailQueue['prototype'][_0x4780('0xd')]=function(){var _0x1d7907=this[_0x4780('0xa')]['_rr'];this['mapAgentsId']=_[_0x4780('0xe')](this[_0x4780('0xf')],'id');this[_0x4780('0xa')][_0x4780('0x10')]=_0x1d7907;};MailQueue[_0x4780('0x11')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x4780('0x12')]=0x0;for(var _0x562fcc=0x0;_0x562fcc<this[_0x4780('0xf')][_0x4780('0x13')];_0x562fcc+=0x1){if(this[_0x4780('0xf')][_0x562fcc][_0x4780('0x14')]){this['loggedIn']+=0x1;}if(this[_0x4780('0xf')][_0x562fcc]['mailPause']){this[_0x4780('0x12')]+=0x1;}}this[_0x4780('0x15')]=this[_0x4780('0x16')]-this[_0x4780('0x12')];this['available']=this[_0x4780('0x15')]>=0x0?this['available']:0x0;var _0x143588={'id':this['id'],'available':this[_0x4780('0x15')],'loggedIn':this[_0x4780('0x16')],'name':this[_0x4780('0x6')],'paused':this['paused'],'waiting':this[_0x4780('0xb')]};var _0xc1f0a8=md5(JSON['stringify'](_0x143588));if(this[_0x4780('0xc')]!==_0xc1f0a8){this[_0x4780('0xc')]=_0xc1f0a8;io['to'](util[_0x4780('0x17')](_0x4780('0x18'),_0x143588[_0x4780('0x6')]))[_0x4780('0x19')](_0x4780('0x1a'),_0x143588);}};module[_0x4780('0x1b')]=MailQueue;
\ No newline at end of file
+var _0x07d7=['prototype','_rr','loggedIn','online','mailPause','paused','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x185fe9,_0x1ef20b){var _0x2eb1c3=function(_0x6e4669){while(--_0x6e4669){_0x185fe9['push'](_0x185fe9['shift']());}};_0x2eb1c3(++_0x1ef20b);}(_0x07d7,0x85));var _0x707d=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x07d7[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0x707d('0x0'));var md5=require(_0x707d('0x1'));var util=require(_0x707d('0x2'));var Redis=require(_0x707d('0x3'));var config=require(_0x707d('0x4'));config[_0x707d('0x5')]=_[_0x707d('0x6')](config[_0x707d('0x5')],{'host':_0x707d('0x7'),'port':0x18eb});var io=require(_0x707d('0x8'))(new Redis(config[_0x707d('0x5')]));function MailQueue(_0x16cc4a){this['id']=_0x16cc4a['id']||0x0;this[_0x707d('0x9')]=_0x16cc4a[_0x707d('0x9')]||'';this[_0x707d('0xa')]=_0x16cc4a[_0x707d('0xa')]||0xa;this['strategy']=_0x16cc4a['strategy']||_0x707d('0xb');this[_0x707d('0xc')]=_0x16cc4a[_0x707d('0xc')];this[_0x707d('0xd')]={};this[_0x707d('0xe')]=0x0;this['md5']='';this[_0x707d('0xf')]();this[_0x707d('0x10')]();}MailQueue[_0x707d('0x11')]['updateRouting']=function(){var _0x2103dc=this[_0x707d('0xd')][_0x707d('0x12')];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0x707d('0xd')][_0x707d('0x12')]=_0x2103dc;};MailQueue[_0x707d('0x11')]['updateRealtime']=function(){this[_0x707d('0x13')]=0x0;this['paused']=0x0;for(var _0x1c18a6=0x0;_0x1c18a6<this[_0x707d('0xc')]['length'];_0x1c18a6+=0x1){if(this['Agents'][_0x1c18a6][_0x707d('0x14')]){this['loggedIn']+=0x1;}if(this[_0x707d('0xc')][_0x1c18a6][_0x707d('0x15')]){this[_0x707d('0x16')]+=0x1;}}this[_0x707d('0x17')]=this[_0x707d('0x13')]-this[_0x707d('0x16')];this[_0x707d('0x17')]=this['available']>=0x0?this[_0x707d('0x17')]:0x0;var _0x275a7b={'id':this['id'],'available':this[_0x707d('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x707d('0x9')],'paused':this[_0x707d('0x16')],'waiting':this[_0x707d('0xe')]};var _0x8e524c=md5(JSON[_0x707d('0x18')](_0x275a7b));if(this[_0x707d('0x1')]!==_0x8e524c){this[_0x707d('0x1')]=_0x8e524c;io['to'](util[_0x707d('0x19')](_0x707d('0x1a'),_0x275a7b[_0x707d('0x9')]))[_0x707d('0x1b')](_0x707d('0x1c'),_0x275a7b);}};module[_0x707d('0x1d')]=MailQueue;
\ No newline at end of file
index 9425294..e9f7820 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9f3e=['paused','length','online','loggedIn','openchannelPause','available','format','openchannel:queue:%s','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','map','prototype','updateRealtime'];(function(_0x2920c3,_0x141aed){var _0x1464a5=function(_0x4d749f){while(--_0x4d749f){_0x2920c3['push'](_0x2920c3['shift']());}};_0x1464a5(++_0x141aed);}(_0x9f3e,0x12d));var _0xe9f3=function(_0x4cd3aa,_0x1cff67){_0x4cd3aa=_0x4cd3aa-0x0;var _0x2b6126=_0x9f3e[_0x4cd3aa];return _0x2b6126;};'use strict';var _=require(_0xe9f3('0x0'));var md5=require(_0xe9f3('0x1'));var util=require('util');var Redis=require(_0xe9f3('0x2'));var config=require(_0xe9f3('0x3'));config['redis']=_['defaults'](config[_0xe9f3('0x4')],{'host':_0xe9f3('0x5'),'port':0x18eb});var io=require(_0xe9f3('0x6'))(new Redis(config[_0xe9f3('0x4')]));function OpenchannelQueue(_0x23fe71){this['id']=_0x23fe71['id']||0x0;this[_0xe9f3('0x7')]=_0x23fe71[_0xe9f3('0x7')]||'';this[_0xe9f3('0x8')]=_0x23fe71[_0xe9f3('0x8')]||0xa;this[_0xe9f3('0x9')]=_0x23fe71[_0xe9f3('0x9')]||_0xe9f3('0xa');this[_0xe9f3('0xb')]=_0x23fe71[_0xe9f3('0xb')];this[_0xe9f3('0xc')]={};this[_0xe9f3('0xd')]=0x0;this[_0xe9f3('0x1')]='';this[_0xe9f3('0xe')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0xe9f3('0xe')]=function(){var _0xa1def6=this[_0xe9f3('0xc')]['_rr'];this[_0xe9f3('0xc')]=_[_0xe9f3('0xf')](this[_0xe9f3('0xb')],'id');this[_0xe9f3('0xc')]['_rr']=_0xa1def6;};OpenchannelQueue[_0xe9f3('0x10')][_0xe9f3('0x11')]=function(){this['loggedIn']=0x0;this[_0xe9f3('0x12')]=0x0;for(var _0x41fc67=0x0;_0x41fc67<this[_0xe9f3('0xb')][_0xe9f3('0x13')];_0x41fc67+=0x1){if(this['Agents'][_0x41fc67][_0xe9f3('0x14')]){this[_0xe9f3('0x15')]+=0x1;}if(this[_0xe9f3('0xb')][_0x41fc67][_0xe9f3('0x16')]){this[_0xe9f3('0x12')]+=0x1;}}this[_0xe9f3('0x17')]=this[_0xe9f3('0x15')]-this['paused'];this[_0xe9f3('0x17')]=this[_0xe9f3('0x17')]>=0x0?this['available']:0x0;var _0x14f10e={'id':this['id'],'available':this[_0xe9f3('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xe9f3('0x12')],'waiting':this['waiting']};var _0x372485=md5(JSON['stringify'](_0x14f10e));if(this[_0xe9f3('0x1')]!==_0x372485){this[_0xe9f3('0x1')]=_0x372485;io['to'](util[_0xe9f3('0x18')](_0xe9f3('0x19'),_0x14f10e[_0xe9f3('0x7')]))[_0xe9f3('0x1a')](_0xe9f3('0x1b'),_0x14f10e);}};module[_0xe9f3('0x1c')]=OpenchannelQueue;
\ No newline at end of file
+var _0x8bb2=['openchannelPause','paused','available','waiting','stringify','emit','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','md5','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','loggedIn','online'];(function(_0x12f22d,_0x39dfb7){var _0x1b9f9f=function(_0x1d4629){while(--_0x1d4629){_0x12f22d['push'](_0x12f22d['shift']());}};_0x1b9f9f(++_0x39dfb7);}(_0x8bb2,0x13b));var _0x28bb=function(_0x1ccbcc,_0x5c948b){_0x1ccbcc=_0x1ccbcc-0x0;var _0x1e873f=_0x8bb2[_0x1ccbcc];return _0x1e873f;};'use strict';var _=require(_0x28bb('0x0'));var md5=require('md5');var util=require(_0x28bb('0x1'));var Redis=require(_0x28bb('0x2'));var config=require(_0x28bb('0x3'));config[_0x28bb('0x4')]=_[_0x28bb('0x5')](config[_0x28bb('0x4')],{'host':_0x28bb('0x6'),'port':0x18eb});var io=require(_0x28bb('0x7'))(new Redis(config[_0x28bb('0x4')]));function OpenchannelQueue(_0x2b58f7){this['id']=_0x2b58f7['id']||0x0;this[_0x28bb('0x8')]=_0x2b58f7[_0x28bb('0x8')]||'';this['timeout']=_0x2b58f7[_0x28bb('0x9')]||0xa;this[_0x28bb('0xa')]=_0x2b58f7[_0x28bb('0xa')]||'beepall';this[_0x28bb('0xb')]=_0x2b58f7[_0x28bb('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x28bb('0xc')]='';this[_0x28bb('0xd')]();this[_0x28bb('0xe')]();}OpenchannelQueue[_0x28bb('0xf')][_0x28bb('0xd')]=function(){var _0x5292bc=this['mapAgentsId'][_0x28bb('0x10')];this[_0x28bb('0x11')]=_[_0x28bb('0x12')](this[_0x28bb('0xb')],'id');this['mapAgentsId']['_rr']=_0x5292bc;};OpenchannelQueue[_0x28bb('0xf')][_0x28bb('0xe')]=function(){this[_0x28bb('0x13')]=0x0;this['paused']=0x0;for(var _0x1a9b02=0x0;_0x1a9b02<this['Agents']['length'];_0x1a9b02+=0x1){if(this[_0x28bb('0xb')][_0x1a9b02][_0x28bb('0x14')]){this[_0x28bb('0x13')]+=0x1;}if(this[_0x28bb('0xb')][_0x1a9b02][_0x28bb('0x15')]){this[_0x28bb('0x16')]+=0x1;}}this['available']=this[_0x28bb('0x13')]-this[_0x28bb('0x16')];this[_0x28bb('0x17')]=this[_0x28bb('0x17')]>=0x0?this[_0x28bb('0x17')]:0x0;var _0x307d2c={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x28bb('0x8')],'paused':this['paused'],'waiting':this[_0x28bb('0x18')]};var _0x46ec88=md5(JSON[_0x28bb('0x19')](_0x307d2c));if(this[_0x28bb('0xc')]!==_0x46ec88){this[_0x28bb('0xc')]=_0x46ec88;io['to'](util['format']('openchannel:queue:%s',_0x307d2c[_0x28bb('0x8')]))[_0x28bb('0x1a')]('openchannel_queue:save',_0x307d2c);}};module[_0x28bb('0x1b')]=OpenchannelQueue;
\ No newline at end of file
index 84dd7c7..3f52c80 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x181c=['Agents','prototype','loggedIn','paused','length','online','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map'];(function(_0x35f4f6,_0x29131d){var _0x516d9f=function(_0x281f97){while(--_0x281f97){_0x35f4f6['push'](_0x35f4f6['shift']());}};_0x516d9f(++_0x29131d);}(_0x181c,0xa9));var _0xc181=function(_0x4bc428,_0xf56dd9){_0x4bc428=_0x4bc428-0x0;var _0x3ca37f=_0x181c[_0x4bc428];return _0x3ca37f;};'use strict';var _=require(_0xc181('0x0'));var md5=require(_0xc181('0x1'));var util=require(_0xc181('0x2'));var Redis=require('ioredis');var config=require(_0xc181('0x3'));config[_0xc181('0x4')]=_[_0xc181('0x5')](config[_0xc181('0x4')],{'host':_0xc181('0x6'),'port':0x18eb});var io=require(_0xc181('0x7'))(new Redis(config[_0xc181('0x4')]));function SmsQueue(_0x3c0295){this['id']=_0x3c0295['id']||0x0;this[_0xc181('0x8')]=_0x3c0295[_0xc181('0x8')]||'';this[_0xc181('0x9')]=_0x3c0295['timeout']||0xa;this['strategy']=_0x3c0295[_0xc181('0xa')]||'beepall';this['Agents']=_0x3c0295['Agents'];this[_0xc181('0xb')]={};this[_0xc181('0xc')]=0x0;this[_0xc181('0x1')]='';this[_0xc181('0xd')]();this[_0xc181('0xe')]();}SmsQueue['prototype']['updateRouting']=function(){var _0x127727=this[_0xc181('0xb')][_0xc181('0xf')];this[_0xc181('0xb')]=_[_0xc181('0x10')](this[_0xc181('0x11')],'id');this[_0xc181('0xb')][_0xc181('0xf')]=_0x127727;};SmsQueue[_0xc181('0x12')][_0xc181('0xe')]=function(){this[_0xc181('0x13')]=0x0;this[_0xc181('0x14')]=0x0;for(var _0x3dd131=0x0;_0x3dd131<this[_0xc181('0x11')][_0xc181('0x15')];_0x3dd131+=0x1){if(this[_0xc181('0x11')][_0x3dd131][_0xc181('0x16')]){this['loggedIn']+=0x1;}if(this[_0xc181('0x11')][_0x3dd131][_0xc181('0x17')]){this[_0xc181('0x14')]+=0x1;}}this[_0xc181('0x18')]=this[_0xc181('0x13')]-this[_0xc181('0x14')];this['available']=this[_0xc181('0x18')]>=0x0?this[_0xc181('0x18')]:0x0;var _0x43edaf={'id':this['id'],'available':this[_0xc181('0x18')],'loggedIn':this['loggedIn'],'name':this[_0xc181('0x8')],'paused':this[_0xc181('0x14')],'waiting':this['waiting']};var _0x3a6fe7=md5(JSON[_0xc181('0x19')](_0x43edaf));if(this[_0xc181('0x1')]!==_0x3a6fe7){this[_0xc181('0x1')]=_0x3a6fe7;io['to'](util[_0xc181('0x1a')](_0xc181('0x1b'),_0x43edaf['name']))[_0xc181('0x1c')](_0xc181('0x1d'),_0x43edaf);}};module[_0xc181('0x1e')]=SmsQueue;
\ No newline at end of file
+var _0xb8a4=['waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','length','online','paused','available','sms:queue:%s','sms_queue:save','exports','lodash','md5','util','ioredis','redis','localhost','name','timeout','strategy','Agents','mapAgentsId'];(function(_0xf0ab7c,_0x23bbc2){var _0x198144=function(_0x1c3a40){while(--_0x1c3a40){_0xf0ab7c['push'](_0xf0ab7c['shift']());}};_0x198144(++_0x23bbc2);}(_0xb8a4,0xbd));var _0x4b8a=function(_0x160e96,_0x24fd39){_0x160e96=_0x160e96-0x0;var _0x19ed54=_0xb8a4[_0x160e96];return _0x19ed54;};'use strict';var _=require(_0x4b8a('0x0'));var md5=require(_0x4b8a('0x1'));var util=require(_0x4b8a('0x2'));var Redis=require(_0x4b8a('0x3'));var config=require('../../../config/environment');config[_0x4b8a('0x4')]=_['defaults'](config[_0x4b8a('0x4')],{'host':_0x4b8a('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4b8a('0x4')]));function SmsQueue(_0x587f3f){this['id']=_0x587f3f['id']||0x0;this[_0x4b8a('0x6')]=_0x587f3f[_0x4b8a('0x6')]||'';this[_0x4b8a('0x7')]=_0x587f3f[_0x4b8a('0x7')]||0xa;this[_0x4b8a('0x8')]=_0x587f3f[_0x4b8a('0x8')]||'beepall';this['Agents']=_0x587f3f[_0x4b8a('0x9')];this[_0x4b8a('0xa')]={};this[_0x4b8a('0xb')]=0x0;this[_0x4b8a('0x1')]='';this[_0x4b8a('0xc')]();this['updateRealtime']();}SmsQueue[_0x4b8a('0xd')][_0x4b8a('0xc')]=function(){var _0xfa0d03=this[_0x4b8a('0xa')][_0x4b8a('0xe')];this[_0x4b8a('0xa')]=_[_0x4b8a('0xf')](this[_0x4b8a('0x9')],'id');this[_0x4b8a('0xa')][_0x4b8a('0xe')]=_0xfa0d03;};SmsQueue['prototype'][_0x4b8a('0x10')]=function(){this[_0x4b8a('0x11')]=0x0;this['paused']=0x0;for(var _0x2cad6f=0x0;_0x2cad6f<this[_0x4b8a('0x9')][_0x4b8a('0x12')];_0x2cad6f+=0x1){if(this[_0x4b8a('0x9')][_0x2cad6f][_0x4b8a('0x13')]){this[_0x4b8a('0x11')]+=0x1;}if(this[_0x4b8a('0x9')][_0x2cad6f]['smsPause']){this[_0x4b8a('0x14')]+=0x1;}}this[_0x4b8a('0x15')]=this[_0x4b8a('0x11')]-this[_0x4b8a('0x14')];this[_0x4b8a('0x15')]=this[_0x4b8a('0x15')]>=0x0?this[_0x4b8a('0x15')]:0x0;var _0x4b315d={'id':this['id'],'available':this[_0x4b8a('0x15')],'loggedIn':this[_0x4b8a('0x11')],'name':this[_0x4b8a('0x6')],'paused':this[_0x4b8a('0x14')],'waiting':this[_0x4b8a('0xb')]};var _0x49fd9d=md5(JSON['stringify'](_0x4b315d));if(this[_0x4b8a('0x1')]!==_0x49fd9d){this[_0x4b8a('0x1')]=_0x49fd9d;io['to'](util['format'](_0x4b8a('0x16'),_0x4b315d[_0x4b8a('0x6')]))['emit'](_0x4b8a('0x17'),_0x4b315d);}};module[_0x4b8a('0x18')]=SmsQueue;
\ No newline at end of file
index 98a7be8..38d1c6d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0bad=['chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','length','isUndefined','initOpenchannelQueues','updateRealtime','initChatQueues','updateRouting','initMailQueues','mailQueues','initFaxQueues','faxQueues','exports','bluebird','util','lodash','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/faxQueue','agents','intervals','openchannelQueues','chatQueues','smsQueues'];(function(_0x2db667,_0x193cf5){var _0x83ff9=function(_0x5da022){while(--_0x5da022){_0x2db667['push'](_0x2db667['shift']());}};_0x83ff9(++_0x193cf5);}(_0x0bad,0x133));var _0xd0ba=function(_0x3f448b,_0x1c4055){_0x3f448b=_0x3f448b-0x0;var _0x104efd=_0x0bad[_0x3f448b];return _0x104efd;};'use strict';var BPromise=require(_0xd0ba('0x0'));var util=require(_0xd0ba('0x1'));var _=require(_0xd0ba('0x2'));var moment=require('moment');var Agent=require(_0xd0ba('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xd0ba('0x4'));var ChatQueue=require(_0xd0ba('0x5'));var SmsQueue=require(_0xd0ba('0x6'));var MailQueue=require('../model/mailQueue');var FaxQueue=require(_0xd0ba('0x7'));var Realtime=function(){this[_0xd0ba('0x8')]={};this[_0xd0ba('0x9')]={};this[_0xd0ba('0xa')]={};this[_0xd0ba('0xb')]={};this[_0xd0ba('0xc')]={};this['mailQueues']={};this['faxQueues']={};this[_0xd0ba('0xd')]={};this[_0xd0ba('0xe')]={};this['openchannelQueuesWaitingInteractions']={};this[_0xd0ba('0xf')]={};this[_0xd0ba('0x10')]={};};function freeIsNotKey(_0xb7ae02,_0x2045b3,_0x4ac1fa){var _0x53497d=_['mapKeys'](_0xb7ae02,function(_0x49ffbe,_0xbfc039){return _0x49ffbe[_0x4ac1fa];});for(var _0x521c83 in _0x2045b3){if(_0x2045b3[_0xd0ba('0x11')](_0x521c83)){if(!_0x53497d[_0x521c83]){delete _0x2045b3[_0x521c83];}}}}Realtime[_0xd0ba('0x12')][_0xd0ba('0x13')]=function(_0x4c16ce,_0x13c761){for(var _0x37bf68 in _0x13c761){if(_0x4c16ce['hasOwnProperty'](_0x37bf68)){_0x4c16ce[_0x37bf68]=_0x13c761[_0x37bf68];}}};Realtime[_0xd0ba('0x12')][_0xd0ba('0x14')]=function(){var _0x5681a3=this;return function(_0x525fa2){if(_0x525fa2){freeIsNotKey(_0x525fa2,_0x5681a3['agents'],'id');for(var _0x3208b2=0x0,_0x11bb78={},_0x2f11ff={};_0x3208b2<_0x525fa2[_0xd0ba('0x15')];_0x3208b2+=0x1){_0x11bb78=_0x525fa2[_0x3208b2];if(_[_0xd0ba('0x16')](_0x5681a3[_0xd0ba('0x8')][_0x11bb78['id']])){_0x5681a3[_0xd0ba('0x8')][_0x11bb78['id']]=new Agent(_0x11bb78);}else{_0x5681a3[_0xd0ba('0x13')](_0x5681a3[_0xd0ba('0x8')][_0x11bb78['id']],_0x11bb78);}}}return _0x5681a3[_0xd0ba('0x8')];};};Realtime['prototype']['initIntervals']=function(){var _0x3b87f6=this;return function(_0x42a71f){if(_0x42a71f){freeIsNotKey(_0x42a71f,_0x3b87f6[_0xd0ba('0x9')],'id');for(var _0x1fa938=0x0,_0x23e694={},_0x3fb6c4={};_0x1fa938<_0x42a71f[_0xd0ba('0x15')];_0x1fa938+=0x1){_0x23e694=_0x42a71f[_0x1fa938];if(_[_0xd0ba('0x16')](_0x3b87f6['intervals'][_0x23e694['id']])){_0x3b87f6['intervals'][_0x23e694['id']]=new Interval(_0x23e694);}else{_0x3b87f6[_0xd0ba('0x13')](_0x3b87f6[_0xd0ba('0x9')][_0x23e694['id']],_0x23e694);}}}return _0x3b87f6[_0xd0ba('0x9')];};};Realtime[_0xd0ba('0x12')][_0xd0ba('0x17')]=function(){var _0x287827=this;return function(_0x4c4ea8){if(_0x4c4ea8){freeIsNotKey(_0x4c4ea8,_0x287827['openchannelQueues'],'id');for(var _0x2a9602=0x0,_0x458883={},_0x409d4b={};_0x2a9602<_0x4c4ea8[_0xd0ba('0x15')];_0x2a9602+=0x1){_0x458883=_0x4c4ea8[_0x2a9602];if(_[_0xd0ba('0x16')](_0x287827[_0xd0ba('0xa')][_0x458883['id']])){_0x287827[_0xd0ba('0xa')][_0x458883['id']]=new OpenchannelQueue(_0x458883);}else{_0x287827[_0xd0ba('0x13')](_0x287827[_0xd0ba('0xa')][_0x458883['id']],_0x458883);}_0x287827[_0xd0ba('0xa')][_0x458883['id']]['updateRouting']();_0x287827['openchannelQueues'][_0x458883['id']][_0xd0ba('0x18')]();}}return _0x287827[_0xd0ba('0xa')];};};Realtime['prototype'][_0xd0ba('0x19')]=function(){var _0x319714=this;return function(_0x785c59){if(_0x785c59){freeIsNotKey(_0x785c59,_0x319714['chatQueues'],'id');for(var _0x4fffd4=0x0,_0x5d0afb={},_0x5230b4={};_0x4fffd4<_0x785c59[_0xd0ba('0x15')];_0x4fffd4+=0x1){_0x5d0afb=_0x785c59[_0x4fffd4];if(_['isUndefined'](_0x319714[_0xd0ba('0xb')][_0x5d0afb['id']])){_0x319714[_0xd0ba('0xb')][_0x5d0afb['id']]=new ChatQueue(_0x5d0afb);}else{_0x319714[_0xd0ba('0x13')](_0x319714[_0xd0ba('0xb')][_0x5d0afb['id']],_0x5d0afb);}_0x319714[_0xd0ba('0xb')][_0x5d0afb['id']]['updateRouting']();_0x319714['chatQueues'][_0x5d0afb['id']][_0xd0ba('0x18')]();}}return _0x319714[_0xd0ba('0xb')];};};Realtime[_0xd0ba('0x12')]['initSmsQueues']=function(){var _0x43103c=this;return function(_0x269d62){if(_0x269d62){freeIsNotKey(_0x269d62,_0x43103c[_0xd0ba('0xc')],'id');for(var _0x650fad=0x0,_0xe620fd={},_0x490df1={};_0x650fad<_0x269d62[_0xd0ba('0x15')];_0x650fad+=0x1){_0xe620fd=_0x269d62[_0x650fad];if(_[_0xd0ba('0x16')](_0x43103c[_0xd0ba('0xc')][_0xe620fd['id']])){_0x43103c[_0xd0ba('0xc')][_0xe620fd['id']]=new SmsQueue(_0xe620fd);}else{_0x43103c[_0xd0ba('0x13')](_0x43103c[_0xd0ba('0xc')][_0xe620fd['id']],_0xe620fd);}_0x43103c[_0xd0ba('0xc')][_0xe620fd['id']][_0xd0ba('0x1a')]();_0x43103c[_0xd0ba('0xc')][_0xe620fd['id']][_0xd0ba('0x18')]();}}return _0x43103c[_0xd0ba('0xc')];};};Realtime[_0xd0ba('0x12')][_0xd0ba('0x1b')]=function(){var _0x3d4d32=this;return function(_0x20b3e6){if(_0x20b3e6){freeIsNotKey(_0x20b3e6,_0x3d4d32['mailQueues'],'id');for(var _0x31b3a7=0x0,_0x550e0f={},_0x23bc40={};_0x31b3a7<_0x20b3e6[_0xd0ba('0x15')];_0x31b3a7+=0x1){_0x550e0f=_0x20b3e6[_0x31b3a7];if(_[_0xd0ba('0x16')](_0x3d4d32['mailQueues'][_0x550e0f['id']])){_0x3d4d32[_0xd0ba('0x1c')][_0x550e0f['id']]=new MailQueue(_0x550e0f);}else{_0x3d4d32[_0xd0ba('0x13')](_0x3d4d32['mailQueues'][_0x550e0f['id']],_0x550e0f);}_0x3d4d32[_0xd0ba('0x1c')][_0x550e0f['id']][_0xd0ba('0x1a')]();_0x3d4d32[_0xd0ba('0x1c')][_0x550e0f['id']][_0xd0ba('0x18')]();}}return _0x3d4d32[_0xd0ba('0x1c')];};};Realtime[_0xd0ba('0x12')][_0xd0ba('0x1d')]=function(){var _0x221409=this;return function(_0x2cf05b){if(_0x2cf05b){freeIsNotKey(_0x2cf05b,_0x221409['faxQueues'],'id');for(var _0x442b65=0x0,_0x40c105={},_0x4f04f7={};_0x442b65<_0x2cf05b[_0xd0ba('0x15')];_0x442b65+=0x1){_0x40c105=_0x2cf05b[_0x442b65];if(_[_0xd0ba('0x16')](_0x221409['faxQueues'][_0x40c105['id']])){_0x221409[_0xd0ba('0x1e')][_0x40c105['id']]=new FaxQueue(_0x40c105);}else{_0x221409[_0xd0ba('0x13')](_0x221409[_0xd0ba('0x1e')][_0x40c105['id']],_0x40c105);}_0x221409[_0xd0ba('0x1e')][_0x40c105['id']][_0xd0ba('0x1a')]();_0x221409['faxQueues'][_0x40c105['id']][_0xd0ba('0x18')]();}}return _0x221409['faxQueues'];};};module[_0xd0ba('0x1f')]=Realtime;
\ No newline at end of file
+var _0xde41=['moment','../model/agent','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/mailQueue','../model/faxQueue','agents','intervals','openchannelQueues','chatQueues','smsQueues','mailQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','mergeFromDatabase','isUndefined','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','initMailQueues','initFaxQueues','exports','util','lodash'];(function(_0x3a873b,_0x1cf5f9){var _0x21ab60=function(_0x61e887){while(--_0x61e887){_0x3a873b['push'](_0x3a873b['shift']());}};_0x21ab60(++_0x1cf5f9);}(_0xde41,0xca));var _0x1de4=function(_0x48e082,_0x21ae70){_0x48e082=_0x48e082-0x0;var _0x4d2f1a=_0xde41[_0x48e082];return _0x4d2f1a;};'use strict';var BPromise=require('bluebird');var util=require(_0x1de4('0x0'));var _=require(_0x1de4('0x1'));var moment=require(_0x1de4('0x2'));var Agent=require(_0x1de4('0x3'));var Interval=require(_0x1de4('0x4'));var OpenchannelQueue=require(_0x1de4('0x5'));var ChatQueue=require(_0x1de4('0x6'));var SmsQueue=require('../model/smsQueue');var MailQueue=require(_0x1de4('0x7'));var FaxQueue=require(_0x1de4('0x8'));var Realtime=function(){this[_0x1de4('0x9')]={};this[_0x1de4('0xa')]={};this[_0x1de4('0xb')]={};this[_0x1de4('0xc')]={};this[_0x1de4('0xd')]={};this[_0x1de4('0xe')]={};this[_0x1de4('0xf')]={};this['chatQueuesWaitingInteractions']={};this[_0x1de4('0x10')]={};this[_0x1de4('0x11')]={};this['smsQueuesWaitingInteractions']={};this[_0x1de4('0x12')]={};};function freeIsNotKey(_0x568c90,_0x513a12,_0x8fee0f){var _0x1ec746=_[_0x1de4('0x13')](_0x568c90,function(_0xa077f1,_0x25b400){return _0xa077f1[_0x8fee0f];});for(var _0x5e5b93 in _0x513a12){if(_0x513a12[_0x1de4('0x14')](_0x5e5b93)){if(!_0x1ec746[_0x5e5b93]){delete _0x513a12[_0x5e5b93];}}}}Realtime[_0x1de4('0x15')]['mergeFromDatabase']=function(_0x8aaa49,_0x3abb87){for(var _0x554389 in _0x3abb87){if(_0x8aaa49[_0x1de4('0x14')](_0x554389)){_0x8aaa49[_0x554389]=_0x3abb87[_0x554389];}}};Realtime[_0x1de4('0x15')][_0x1de4('0x16')]=function(){var _0x382d82=this;return function(_0x4c4362){if(_0x4c4362){freeIsNotKey(_0x4c4362,_0x382d82[_0x1de4('0x9')],'id');for(var _0x2d6bc1=0x0,_0x545f49={},_0x410542={};_0x2d6bc1<_0x4c4362[_0x1de4('0x17')];_0x2d6bc1+=0x1){_0x545f49=_0x4c4362[_0x2d6bc1];if(_['isUndefined'](_0x382d82[_0x1de4('0x9')][_0x545f49['id']])){_0x382d82[_0x1de4('0x9')][_0x545f49['id']]=new Agent(_0x545f49);}else{_0x382d82[_0x1de4('0x18')](_0x382d82['agents'][_0x545f49['id']],_0x545f49);}}}return _0x382d82['agents'];};};Realtime['prototype']['initIntervals']=function(){var _0x35d708=this;return function(_0x5b89ea){if(_0x5b89ea){freeIsNotKey(_0x5b89ea,_0x35d708['intervals'],'id');for(var _0x632856=0x0,_0x55fd7c={},_0x2af93c={};_0x632856<_0x5b89ea['length'];_0x632856+=0x1){_0x55fd7c=_0x5b89ea[_0x632856];if(_[_0x1de4('0x19')](_0x35d708[_0x1de4('0xa')][_0x55fd7c['id']])){_0x35d708[_0x1de4('0xa')][_0x55fd7c['id']]=new Interval(_0x55fd7c);}else{_0x35d708['mergeFromDatabase'](_0x35d708['intervals'][_0x55fd7c['id']],_0x55fd7c);}}}return _0x35d708[_0x1de4('0xa')];};};Realtime[_0x1de4('0x15')][_0x1de4('0x1a')]=function(){var _0xfa7cda=this;return function(_0xfc6c9a){if(_0xfc6c9a){freeIsNotKey(_0xfc6c9a,_0xfa7cda[_0x1de4('0xb')],'id');for(var _0x55f6e6=0x0,_0x43e9b4={},_0x2933d7={};_0x55f6e6<_0xfc6c9a[_0x1de4('0x17')];_0x55f6e6+=0x1){_0x43e9b4=_0xfc6c9a[_0x55f6e6];if(_[_0x1de4('0x19')](_0xfa7cda[_0x1de4('0xb')][_0x43e9b4['id']])){_0xfa7cda[_0x1de4('0xb')][_0x43e9b4['id']]=new OpenchannelQueue(_0x43e9b4);}else{_0xfa7cda[_0x1de4('0x18')](_0xfa7cda[_0x1de4('0xb')][_0x43e9b4['id']],_0x43e9b4);}_0xfa7cda[_0x1de4('0xb')][_0x43e9b4['id']][_0x1de4('0x1b')]();_0xfa7cda[_0x1de4('0xb')][_0x43e9b4['id']][_0x1de4('0x1c')]();}}return _0xfa7cda[_0x1de4('0xb')];};};Realtime[_0x1de4('0x15')][_0x1de4('0x1d')]=function(){var _0x12761d=this;return function(_0x31c9f3){if(_0x31c9f3){freeIsNotKey(_0x31c9f3,_0x12761d[_0x1de4('0xc')],'id');for(var _0x521391=0x0,_0x2330a={},_0x158586={};_0x521391<_0x31c9f3[_0x1de4('0x17')];_0x521391+=0x1){_0x2330a=_0x31c9f3[_0x521391];if(_[_0x1de4('0x19')](_0x12761d[_0x1de4('0xc')][_0x2330a['id']])){_0x12761d[_0x1de4('0xc')][_0x2330a['id']]=new ChatQueue(_0x2330a);}else{_0x12761d[_0x1de4('0x18')](_0x12761d[_0x1de4('0xc')][_0x2330a['id']],_0x2330a);}_0x12761d[_0x1de4('0xc')][_0x2330a['id']]['updateRouting']();_0x12761d['chatQueues'][_0x2330a['id']][_0x1de4('0x1c')]();}}return _0x12761d[_0x1de4('0xc')];};};Realtime[_0x1de4('0x15')][_0x1de4('0x1e')]=function(){var _0xc51e9d=this;return function(_0x5e500f){if(_0x5e500f){freeIsNotKey(_0x5e500f,_0xc51e9d[_0x1de4('0xd')],'id');for(var _0x59ee23=0x0,_0x56e138={},_0x540596={};_0x59ee23<_0x5e500f[_0x1de4('0x17')];_0x59ee23+=0x1){_0x56e138=_0x5e500f[_0x59ee23];if(_[_0x1de4('0x19')](_0xc51e9d[_0x1de4('0xd')][_0x56e138['id']])){_0xc51e9d['smsQueues'][_0x56e138['id']]=new SmsQueue(_0x56e138);}else{_0xc51e9d[_0x1de4('0x18')](_0xc51e9d['smsQueues'][_0x56e138['id']],_0x56e138);}_0xc51e9d[_0x1de4('0xd')][_0x56e138['id']][_0x1de4('0x1b')]();_0xc51e9d[_0x1de4('0xd')][_0x56e138['id']]['updateRealtime']();}}return _0xc51e9d[_0x1de4('0xd')];};};Realtime['prototype'][_0x1de4('0x1f')]=function(){var _0x204ed2=this;return function(_0x7760cf){if(_0x7760cf){freeIsNotKey(_0x7760cf,_0x204ed2['mailQueues'],'id');for(var _0x390e52=0x0,_0x62853a={},_0x29dd7b={};_0x390e52<_0x7760cf[_0x1de4('0x17')];_0x390e52+=0x1){_0x62853a=_0x7760cf[_0x390e52];if(_[_0x1de4('0x19')](_0x204ed2['mailQueues'][_0x62853a['id']])){_0x204ed2[_0x1de4('0xe')][_0x62853a['id']]=new MailQueue(_0x62853a);}else{_0x204ed2['mergeFromDatabase'](_0x204ed2[_0x1de4('0xe')][_0x62853a['id']],_0x62853a);}_0x204ed2[_0x1de4('0xe')][_0x62853a['id']][_0x1de4('0x1b')]();_0x204ed2['mailQueues'][_0x62853a['id']][_0x1de4('0x1c')]();}}return _0x204ed2[_0x1de4('0xe')];};};Realtime['prototype'][_0x1de4('0x20')]=function(){var _0x1d5b5b=this;return function(_0x3e85c2){if(_0x3e85c2){freeIsNotKey(_0x3e85c2,_0x1d5b5b['faxQueues'],'id');for(var _0x2edd1c=0x0,_0x12789a={},_0x3e379c={};_0x2edd1c<_0x3e85c2[_0x1de4('0x17')];_0x2edd1c+=0x1){_0x12789a=_0x3e85c2[_0x2edd1c];if(_[_0x1de4('0x19')](_0x1d5b5b['faxQueues'][_0x12789a['id']])){_0x1d5b5b[_0x1de4('0xf')][_0x12789a['id']]=new FaxQueue(_0x12789a);}else{_0x1d5b5b[_0x1de4('0x18')](_0x1d5b5b['faxQueues'][_0x12789a['id']],_0x12789a);}_0x1d5b5b['faxQueues'][_0x12789a['id']][_0x1de4('0x1b')]();_0x1d5b5b[_0x1de4('0xf')][_0x12789a['id']][_0x1de4('0x1c')]();}}return _0x1d5b5b[_0x1de4('0xf')];};};module[_0x1de4('0x21')]=Realtime;
\ No newline at end of file
index 3bccbc8..a3d5c7f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4e0b=['addTags','AddTagsToChatInteraction','update','Request','UpdateChatInteraction'];(function(_0x2c1114,_0x2a5c50){var _0x2b877c=function(_0x4f356d){while(--_0x4f356d){_0x2c1114['push'](_0x2c1114['shift']());}};_0x2b877c(++_0x2a5c50);}(_0x4e0b,0xd4));var _0xb4e0=function(_0xefb9b4,_0x5a6dbb){_0xefb9b4=_0xefb9b4-0x0;var _0x4bc217=_0x4e0b[_0xefb9b4];return _0x4bc217;};'use strict';var client=require('../client');exports[_0xb4e0('0x0')]=function(_0x59bfe3,_0xf50617){return client[_0xb4e0('0x1')](_0xb4e0('0x2'),{'body':_0xf50617,'options':{'where':{'id':_0x59bfe3}},'log':'updateChatInteraction'});};exports[_0xb4e0('0x3')]=function(_0x3164fe,_0x3c66f4){return client[_0xb4e0('0x1')](_0xb4e0('0x4'),{'body':_0x3c66f4,'options':{'where':{'id':_0x3164fe}},'log':'addTagsToChatInteraction'});};
\ No newline at end of file
+var _0x125c=['Request','AddTagsToChatInteraction','addTagsToChatInteraction','update','UpdateChatInteraction'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x125c,0xda));var _0xc125=function(_0x13c6b0,_0x17b7da){_0x13c6b0=_0x13c6b0-0x0;var _0x9981fb=_0x125c[_0x13c6b0];return _0x9981fb;};'use strict';var client=require('../client');exports[_0xc125('0x0')]=function(_0x111c1d,_0x37f72d){return client['Request'](_0xc125('0x1'),{'body':_0x37f72d,'options':{'where':{'id':_0x111c1d}},'log':'updateChatInteraction'});};exports['addTags']=function(_0x1d620f,_0xc76d07){return client[_0xc125('0x2')](_0xc125('0x3'),{'body':_0xc76d07,'options':{'where':{'id':_0x1d620f}},'log':_0xc125('0x4')});};
\ No newline at end of file
index 5e00906..53a1212 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x459c=['../client','CreateChatMessage','createChatMessage'];(function(_0x243217,_0x522951){var _0x478029=function(_0x18d053){while(--_0x18d053){_0x243217['push'](_0x243217['shift']());}};_0x478029(++_0x522951);}(_0x459c,0x1bf));var _0xc459=function(_0x23ebb5,_0x497f04){_0x23ebb5=_0x23ebb5-0x0;var _0x477879=_0x459c[_0x23ebb5];return _0x477879;};'use strict';var client=require(_0xc459('0x0'));exports['create']=function(_0x120151){return client['Request'](_0xc459('0x1'),{'body':_0x120151,'log':_0xc459('0x2')});};
\ No newline at end of file
+var _0x0cff=['create','Request','CreateChatMessage','createChatMessage','../client'];(function(_0xd0ec72,_0x98cd86){var _0x2451c7=function(_0x237796){while(--_0x237796){_0xd0ec72['push'](_0xd0ec72['shift']());}};_0x2451c7(++_0x98cd86);}(_0x0cff,0x194));var _0xf0cf=function(_0x38eb23,_0x196e8b){_0x38eb23=_0x38eb23-0x0;var _0x48506a=_0x0cff[_0x38eb23];return _0x48506a;};'use strict';var client=require(_0xf0cf('0x0'));exports[_0xf0cf('0x1')]=function(_0x504e2d){return client[_0xf0cf('0x2')](_0xf0cf('0x3'),{'body':_0x504e2d,'log':_0xf0cf('0x4')});};
\ No newline at end of file
index 5e6f802..0adee7e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x45c0=['../client','getChatQueues','Request','name','timeout','User','Agents','online'];(function(_0x5ab600,_0x55d1ea){var _0x3f3b8b=function(_0x3fb185){while(--_0x3fb185){_0x5ab600['push'](_0x5ab600['shift']());}};_0x3f3b8b(++_0x55d1ea);}(_0x45c0,0x110));var _0x045c=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x45c0[_0x23e7c1];return _0x1add43;};'use strict';var client=require(_0x045c('0x0'));exports[_0x045c('0x1')]=function(){return function(){return client[_0x045c('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x045c('0x3'),_0x045c('0x4'),'strategy'],'include':[{'model':_0x045c('0x5'),'as':_0x045c('0x6'),'attributes':['id','name',_0x045c('0x7'),'chatPause']}]},'log':'getChatQueues'});};};
\ No newline at end of file
+var _0x5bce=['Request','GetChatQueue','name','strategy','Agents','chatPause','../client','getChatQueues'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5bce,0xb6));var _0xe5bc=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0x5bce[_0x23b655];return _0x364b32;};'use strict';var client=require(_0xe5bc('0x0'));exports[_0xe5bc('0x1')]=function(){return function(){return client[_0xe5bc('0x2')](_0xe5bc('0x3'),{'options':{'raw':![],'attributes':['id',_0xe5bc('0x4'),'timeout',_0xe5bc('0x5')],'include':[{'model':'User','as':_0xe5bc('0x6'),'attributes':['id',_0xe5bc('0x4'),'online',_0xe5bc('0x7')]}]},'log':_0xe5bc('0x1')});};};
\ No newline at end of file
index 4501ffe..e7e8c56 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe43c=['../client','create','Request','CreateChatQueueReport','UpdateChatQueueReport','DESC'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0xe43c,0x180));var _0xce43=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xe43c[_0x2070da];return _0x4f9fe1;};'use strict';var client=require(_0xce43('0x0'));exports[_0xce43('0x1')]=function(_0x159823){return client[_0xce43('0x2')](_0xce43('0x3'),{'body':_0x159823,'log':_0xce43('0x3')});};exports['update']=function(_0x415941,_0x4eed68){return client[_0xce43('0x2')](_0xce43('0x4'),{'body':_0x4eed68,'options':{'where':{'uniqueid':_0x415941},'order':[['id',_0xce43('0x5')]],'limit':0x1},'log':_0xce43('0x4')});};
\ No newline at end of file
+var _0xea89=['create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client'];(function(_0x33c1be,_0x4c0591){var _0x69df49=function(_0x31a4e4){while(--_0x31a4e4){_0x33c1be['push'](_0x33c1be['shift']());}};_0x69df49(++_0x4c0591);}(_0xea89,0x1e2));var _0x9ea8=function(_0x5859d1,_0x1640aa){_0x5859d1=_0x5859d1-0x0;var _0x4f78b6=_0xea89[_0x5859d1];return _0x4f78b6;};'use strict';var client=require(_0x9ea8('0x0'));exports[_0x9ea8('0x1')]=function(_0x1e85a2){return client[_0x9ea8('0x2')](_0x9ea8('0x3'),{'body':_0x1e85a2,'log':'CreateChatQueueReport'});};exports[_0x9ea8('0x4')]=function(_0x520915,_0x226d05){return client['Request'](_0x9ea8('0x5'),{'body':_0x226d05,'options':{'where':{'uniqueid':_0x520915},'order':[['id',_0x9ea8('0x6')]],'limit':0x1},'log':_0x9ea8('0x5')});};
\ No newline at end of file
index 0198ac1..1a47115 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1884=['update','updateFaxInteraction','addTags','Request','addTagsToFaxInteraction','../client'];(function(_0x3a9f82,_0x236d49){var _0x25d804=function(_0x4d17f8){while(--_0x4d17f8){_0x3a9f82['push'](_0x3a9f82['shift']());}};_0x25d804(++_0x236d49);}(_0x1884,0xdd));var _0x4188=function(_0x44915f,_0x9a31b8){_0x44915f=_0x44915f-0x0;var _0x23cd3d=_0x1884[_0x44915f];return _0x23cd3d;};'use strict';var client=require(_0x4188('0x0'));exports[_0x4188('0x1')]=function(_0x1fe175,_0x349d0b){return client['Request']('UpdateFaxInteraction',{'body':_0x349d0b,'options':{'where':{'id':_0x1fe175}},'log':_0x4188('0x2')});};exports[_0x4188('0x3')]=function(_0x55ad23,_0x28367f){return client[_0x4188('0x4')]('AddTagsToFaxInteraction',{'body':_0x28367f,'options':{'where':{'id':_0x55ad23}},'log':_0x4188('0x5')});};
\ No newline at end of file
+var _0xfc02=['addTagsToFaxInteraction','../client','Request','UpdateFaxInteraction','updateFaxInteraction'];(function(_0xe17cea,_0x3eac1e){var _0x48bb15=function(_0x3bef11){while(--_0x3bef11){_0xe17cea['push'](_0xe17cea['shift']());}};_0x48bb15(++_0x3eac1e);}(_0xfc02,0x164));var _0x2fc0=function(_0x259b25,_0x37fe57){_0x259b25=_0x259b25-0x0;var _0x531cad=_0xfc02[_0x259b25];return _0x531cad;};'use strict';var client=require(_0x2fc0('0x0'));exports['update']=function(_0x3eb018,_0x305eca){return client[_0x2fc0('0x1')](_0x2fc0('0x2'),{'body':_0x305eca,'options':{'where':{'id':_0x3eb018}},'log':_0x2fc0('0x3')});};exports['addTags']=function(_0x11887f,_0x3193bc){return client[_0x2fc0('0x1')]('AddTagsToFaxInteraction',{'body':_0x3193bc,'options':{'where':{'id':_0x11887f}},'log':_0x2fc0('0x4')});};
\ No newline at end of file
index 4cf5618..241dbc9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc146=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0x5c4ff2,_0x1f8bce){var _0x50382e=function(_0x11bc5f){while(--_0x11bc5f){_0x5c4ff2['push'](_0x5c4ff2['shift']());}};_0x50382e(++_0x1f8bce);}(_0xc146,0xba));var _0x6c14=function(_0x2bb603,_0x4011c6){_0x2bb603=_0x2bb603-0x0;var _0x5d45e3=_0xc146[_0x2bb603];return _0x5d45e3;};'use strict';var client=require(_0x6c14('0x0'));exports[_0x6c14('0x1')]=function(_0x122f29){return client[_0x6c14('0x2')](_0x6c14('0x3'),{'body':_0x122f29,'log':_0x6c14('0x4')});};
\ No newline at end of file
+var _0x05ab=['createFaxMessage','../client','create','CreateFaxMessage'];(function(_0x35f58d,_0x56c821){var _0xbca79b=function(_0x3d09d4){while(--_0x3d09d4){_0x35f58d['push'](_0x35f58d['shift']());}};_0xbca79b(++_0x56c821);}(_0x05ab,0x195));var _0xb05a=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x05ab[_0x8c43de];return _0xa6591b;};'use strict';var client=require(_0xb05a('0x0'));exports[_0xb05a('0x1')]=function(_0x4ebb74){return client['Request'](_0xb05a('0x2'),{'body':_0x4ebb74,'log':_0xb05a('0x3')});};
\ No newline at end of file
index 23968d8..9b0367b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3cc3=['name','strategy','User','Agents','online','faxPause','../client','GetFaxQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3cc3,0x11e));var _0x33cc=function(_0x1d6856,_0x1b0e54){_0x1d6856=_0x1d6856-0x0;var _0x4b2754=_0x3cc3[_0x1d6856];return _0x4b2754;};'use strict';var client=require(_0x33cc('0x0'));exports['getFaxQueues']=function(){return function(){return client['Request'](_0x33cc('0x1'),{'options':{'raw':![],'attributes':['id',_0x33cc('0x2'),'timeout',_0x33cc('0x3')],'include':[{'model':_0x33cc('0x4'),'as':_0x33cc('0x5'),'attributes':['id',_0x33cc('0x2'),_0x33cc('0x6'),_0x33cc('0x7')]}]},'log':'getFaxQueues'});};};
\ No newline at end of file
+var _0x96bd=['timeout','strategy','Agents','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name'];(function(_0x571135,_0x6fac69){var _0x57ef63=function(_0x45ca71){while(--_0x45ca71){_0x571135['push'](_0x571135['shift']());}};_0x57ef63(++_0x6fac69);}(_0x96bd,0x1e5));var _0xd96b=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x96bd[_0x2c91e9];return _0x13f0ff;};'use strict';var client=require(_0xd96b('0x0'));exports[_0xd96b('0x1')]=function(){return function(){return client[_0xd96b('0x2')](_0xd96b('0x3'),{'options':{'raw':![],'attributes':['id',_0xd96b('0x4'),_0xd96b('0x5'),_0xd96b('0x6')],'include':[{'model':'User','as':_0xd96b('0x7'),'attributes':['id','name',_0xd96b('0x8'),_0xd96b('0x9')]}]},'log':_0xd96b('0x1')});};};
\ No newline at end of file
index 450ab33..ca7162f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x67d1=['create','Request','CreateFaxQueueReport','update','DESC','UpdateFaxQueueReport','../client'];(function(_0x25ba7d,_0x43b79f){var _0x9ee442=function(_0xd0ad8){while(--_0xd0ad8){_0x25ba7d['push'](_0x25ba7d['shift']());}};_0x9ee442(++_0x43b79f);}(_0x67d1,0xdf));var _0x167d=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x67d1[_0x263a74];return _0x2aa86c;};'use strict';var client=require(_0x167d('0x0'));exports[_0x167d('0x1')]=function(_0x443ee0){return client[_0x167d('0x2')]('CreateFaxQueueReport',{'body':_0x443ee0,'log':_0x167d('0x3')});};exports[_0x167d('0x4')]=function(_0x26ce3c,_0x54ae83){return client['Request']('UpdateFaxQueueReport',{'body':_0x54ae83,'options':{'where':{'uniqueid':_0x26ce3c},'order':[['id',_0x167d('0x5')]],'limit':0x1},'log':_0x167d('0x6')});};
\ No newline at end of file
+var _0xf767=['CreateFaxQueueReport','UpdateFaxQueueReport','DESC','../client','create','Request'];(function(_0x22af8e,_0x154c11){var _0x4adda5=function(_0x3df573){while(--_0x3df573){_0x22af8e['push'](_0x22af8e['shift']());}};_0x4adda5(++_0x154c11);}(_0xf767,0xd5));var _0x7f76=function(_0x5b6cf1,_0x32fdcd){_0x5b6cf1=_0x5b6cf1-0x0;var _0x46278c=_0xf767[_0x5b6cf1];return _0x46278c;};'use strict';var client=require(_0x7f76('0x0'));exports[_0x7f76('0x1')]=function(_0x4dbcff){return client[_0x7f76('0x2')](_0x7f76('0x3'),{'body':_0x4dbcff,'log':_0x7f76('0x3')});};exports['update']=function(_0x4ca46e,_0x4ea902){return client[_0x7f76('0x2')](_0x7f76('0x4'),{'body':_0x4ea902,'options':{'where':{'uniqueid':_0x4ca46e},'order':[['id',_0x7f76('0x5')]],'limit':0x1},'log':_0x7f76('0x4')});};
\ No newline at end of file
index facfce7..629fede 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1c7c=['getIntervals','Request','GetInterval','Interval','name','interval','../client'];(function(_0x3dfdb2,_0x3a14b4){var _0x463138=function(_0x25902f){while(--_0x25902f){_0x3dfdb2['push'](_0x3dfdb2['shift']());}};_0x463138(++_0x3a14b4);}(_0x1c7c,0x164));var _0xc1c7=function(_0x4eabbf,_0xe59327){_0x4eabbf=_0x4eabbf-0x0;var _0x27618b=_0x1c7c[_0x4eabbf];return _0x27618b;};'use strict';var client=require(_0xc1c7('0x0'));exports[_0xc1c7('0x1')]=function(){return function(){return client[_0xc1c7('0x2')](_0xc1c7('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xc1c7('0x4'),'as':'Intervals','attributes':['id',_0xc1c7('0x5'),_0xc1c7('0x6')]}]},'log':_0xc1c7('0x1')});};};
\ No newline at end of file
+var _0xd8b0=['getIntervals','Interval','Intervals','name','interval','../client'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x0d8b('0x2'),'as':_0x0d8b('0x3'),'attributes':['id',_0x0d8b('0x4'),_0x0d8b('0x5')]}]},'log':_0x0d8b('0x1')});};};
\ No newline at end of file
index a5006af..ba717e3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdcd0=['Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update'];(function(_0x2b51d9,_0x3db22c){var _0x3591de=function(_0x4e6245){while(--_0x4e6245){_0x2b51d9['push'](_0x2b51d9['shift']());}};_0x3591de(++_0x3db22c);}(_0xdcd0,0xfe));var _0x0dcd=function(_0x42ea31,_0x3036ee){_0x42ea31=_0x42ea31-0x0;var _0x39f0c3=_0xdcd0[_0x42ea31];return _0x39f0c3;};'use strict';var client=require(_0x0dcd('0x0'));exports[_0x0dcd('0x1')]=function(_0x39ef35,_0x480309){return client[_0x0dcd('0x2')](_0x0dcd('0x3'),{'body':_0x480309,'options':{'where':{'id':_0x39ef35}},'log':_0x0dcd('0x4')});};exports[_0x0dcd('0x5')]=function(_0x5cbd46,_0x3b3f09){return client[_0x0dcd('0x2')](_0x0dcd('0x6'),{'body':_0x3b3f09,'options':{'where':{'id':_0x5cbd46}},'log':_0x0dcd('0x7')});};
\ No newline at end of file
+var _0x7ba1=['../client','update','UpdateMailInteraction','addTags','Request','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x4eeab6,_0x2272f2){var _0x25ee02=function(_0x25fb9b){while(--_0x25fb9b){_0x4eeab6['push'](_0x4eeab6['shift']());}};_0x25ee02(++_0x2272f2);}(_0x7ba1,0x1ce));var _0x17ba=function(_0x4390dc,_0x35fbae){_0x4390dc=_0x4390dc-0x0;var _0x115339=_0x7ba1[_0x4390dc];return _0x115339;};'use strict';var client=require(_0x17ba('0x0'));exports[_0x17ba('0x1')]=function(_0x5f4538,_0xbb5973){return client['Request'](_0x17ba('0x2'),{'body':_0xbb5973,'options':{'where':{'id':_0x5f4538}},'log':'updateMailInteraction'});};exports[_0x17ba('0x3')]=function(_0x487f71,_0x20089e){return client[_0x17ba('0x4')](_0x17ba('0x5'),{'body':_0x20089e,'options':{'where':{'id':_0x487f71}},'log':_0x17ba('0x6')});};
\ No newline at end of file
index f1e55b1..ab5d24d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x456c=['createMailMessage','../client','create','CreateMailMessage'];(function(_0x31287b,_0x56cc4d){var _0x520189=function(_0x3b0e24){while(--_0x3b0e24){_0x31287b['push'](_0x31287b['shift']());}};_0x520189(++_0x56cc4d);}(_0x456c,0x151));var _0xc456=function(_0x8ce506,_0x517f30){_0x8ce506=_0x8ce506-0x0;var _0x23c8e5=_0x456c[_0x8ce506];return _0x23c8e5;};'use strict';var client=require(_0xc456('0x0'));exports[_0xc456('0x1')]=function(_0x3a7832){return client['Request'](_0xc456('0x2'),{'body':_0x3a7832,'log':_0xc456('0x3')});};
\ No newline at end of file
+var _0x8446=['../client','Request','CreateMailMessage'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x8446,0x189));var _0x6844=function(_0x1a61a8,_0x2d263f){_0x1a61a8=_0x1a61a8-0x0;var _0x2387b6=_0x8446[_0x1a61a8];return _0x2387b6;};'use strict';var client=require(_0x6844('0x0'));exports['create']=function(_0x1356c2){return client[_0x6844('0x1')](_0x6844('0x2'),{'body':_0x1356c2,'log':'createMailMessage'});};
\ No newline at end of file
index 08bf513..31eb8f5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5a2a=['strategy','User','Agents','mailPause','getMailQueues','Request','GetMailQueue','name','timeout'];(function(_0x7818c1,_0x27ca7e){var _0x3ba860=function(_0x433c9e){while(--_0x433c9e){_0x7818c1['push'](_0x7818c1['shift']());}};_0x3ba860(++_0x27ca7e);}(_0x5a2a,0x136));var _0xa5a2=function(_0x244da1,_0x24545a){_0x244da1=_0x244da1-0x0;var _0x20100e=_0x5a2a[_0x244da1];return _0x20100e;};'use strict';var client=require('../client');exports[_0xa5a2('0x0')]=function(){return function(){return client[_0xa5a2('0x1')](_0xa5a2('0x2'),{'options':{'raw':![],'attributes':['id',_0xa5a2('0x3'),_0xa5a2('0x4'),_0xa5a2('0x5')],'include':[{'model':_0xa5a2('0x6'),'as':_0xa5a2('0x7'),'attributes':['id',_0xa5a2('0x3'),'online',_0xa5a2('0x8')]}]},'log':_0xa5a2('0x0')});};};
\ No newline at end of file
+var _0xc80c=['strategy','Agents','online','Request','name','timeout'];(function(_0x2286d4,_0x4fc14c){var _0x474eb7=function(_0x4956a9){while(--_0x4956a9){_0x2286d4['push'](_0x2286d4['shift']());}};_0x474eb7(++_0x4fc14c);}(_0xc80c,0x117));var _0xcc80=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0xc80c[_0x1573ea];return _0x51c0e2;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client[_0xcc80('0x0')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xcc80('0x1'),_0xcc80('0x2'),_0xcc80('0x3')],'include':[{'model':'User','as':_0xcc80('0x4'),'attributes':['id',_0xcc80('0x1'),_0xcc80('0x5'),'mailPause']}]},'log':'getMailQueues'});};};
\ No newline at end of file
index 20ef815..80fd210 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xadce=['../client','create','CreateMailQueueReport','update','Request','UpdateMailQueueReport','DESC'];(function(_0xf474d6,_0x9c3f94){var _0x291d79=function(_0x1b31e1){while(--_0x1b31e1){_0xf474d6['push'](_0xf474d6['shift']());}};_0x291d79(++_0x9c3f94);}(_0xadce,0x85));var _0xeadc=function(_0x5e4563,_0x3ff918){_0x5e4563=_0x5e4563-0x0;var _0x8d1bf5=_0xadce[_0x5e4563];return _0x8d1bf5;};'use strict';var client=require(_0xeadc('0x0'));exports[_0xeadc('0x1')]=function(_0x479176){return client['Request'](_0xeadc('0x2'),{'body':_0x479176,'log':_0xeadc('0x2')});};exports[_0xeadc('0x3')]=function(_0x53a9fb,_0x49416e){return client[_0xeadc('0x4')](_0xeadc('0x5'),{'body':_0x49416e,'options':{'where':{'uniqueid':_0x53a9fb},'order':[['id',_0xeadc('0x6')]],'limit':0x1},'log':_0xeadc('0x5')});};
\ No newline at end of file
+var _0x7ce3=['UpdateMailQueueReport','../client','CreateMailQueueReport'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7ce3,0x169));var _0x37ce=function(_0x2104f8,_0x4c6ead){_0x2104f8=_0x2104f8-0x0;var _0x36ed48=_0x7ce3[_0x2104f8];return _0x36ed48;};'use strict';var client=require(_0x37ce('0x0'));exports['create']=function(_0x4a4f3d){return client['Request'](_0x37ce('0x1'),{'body':_0x4a4f3d,'log':_0x37ce('0x1')});};exports['update']=function(_0x54e553,_0x2d223a){return client['Request'](_0x37ce('0x2'),{'body':_0x2d223a,'options':{'where':{'uniqueid':_0x54e553},'order':[['id','DESC']],'limit':0x1},'log':_0x37ce('0x2')});};
\ No newline at end of file
index b10870b..72e8f04 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc958=['AddTagsToOpenchannelInteraction','../client','addTags','Request'];(function(_0x5eefac,_0x1f3278){var _0x333d38=function(_0x1b42be){while(--_0x1b42be){_0x5eefac['push'](_0x5eefac['shift']());}};_0x333d38(++_0x1f3278);}(_0xc958,0xb9));var _0x8c95=function(_0x5538c9,_0x4b33e1){_0x5538c9=_0x5538c9-0x0;var _0x44b41c=_0xc958[_0x5538c9];return _0x44b41c;};'use strict';var client=require(_0x8c95('0x0'));exports['update']=function(_0x32cc5e,_0x3f6d7a){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x3f6d7a,'options':{'where':{'id':_0x32cc5e}},'log':'updateOpenchannelInteraction'});};exports[_0x8c95('0x1')]=function(_0x301ae1,_0x180dbd){return client[_0x8c95('0x2')](_0x8c95('0x3'),{'body':_0x180dbd,'options':{'where':{'id':_0x301ae1}},'log':'addTagsToChatInteraction'});};
\ No newline at end of file
+var _0x6f89=['Request','AddTagsToOpenchannelInteraction','../client'];(function(_0x112cb5,_0x4bcd){var _0x2e2135=function(_0x216002){while(--_0x216002){_0x112cb5['push'](_0x112cb5['shift']());}};_0x2e2135(++_0x4bcd);}(_0x6f89,0x13a));var _0x96f8=function(_0x2faeef,_0x1a2bed){_0x2faeef=_0x2faeef-0x0;var _0x49e244=_0x6f89[_0x2faeef];return _0x49e244;};'use strict';var client=require(_0x96f8('0x0'));exports['update']=function(_0x3c7ff9,_0x3760cc){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x3760cc,'options':{'where':{'id':_0x3c7ff9}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x1a3463,_0x2f893a){return client[_0x96f8('0x1')](_0x96f8('0x2'),{'body':_0x2f893a,'options':{'where':{'id':_0x1a3463}},'log':'addTagsToChatInteraction'});};
\ No newline at end of file
index db2afa6..cf3d2f0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf3cd=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x27fda1,_0x59a188){var _0x5e65ab=function(_0x43d6a6){while(--_0x43d6a6){_0x27fda1['push'](_0x27fda1['shift']());}};_0x5e65ab(++_0x59a188);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x9c1f48,_0x25da55){_0x9c1f48=_0x9c1f48-0x0;var _0x52ecd4=_0xf3cd[_0x9c1f48];return _0x52ecd4;};'use strict';var client=require(_0xdf3c('0x0'));exports[_0xdf3c('0x1')]=function(_0x31e5a5){return client[_0xdf3c('0x2')](_0xdf3c('0x3'),{'body':_0x31e5a5,'log':_0xdf3c('0x4')});};
\ No newline at end of file
+var _0x750a=['CreateOpenchannelMessage','createOpenchannelMessage','create'];(function(_0x5ca0b3,_0x33f5ef){var _0x6ba806=function(_0x58b844){while(--_0x58b844){_0x5ca0b3['push'](_0x5ca0b3['shift']());}};_0x6ba806(++_0x33f5ef);}(_0x750a,0x140));var _0xa750=function(_0x1d635a,_0x5c8e07){_0x1d635a=_0x1d635a-0x0;var _0x273a9a=_0x750a[_0x1d635a];return _0x273a9a;};'use strict';var client=require('../client');exports[_0xa750('0x0')]=function(_0x5368b2){return client['Request'](_0xa750('0x1'),{'body':_0x5368b2,'log':_0xa750('0x2')});};
\ No newline at end of file
index 929e8a8..05517bf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xacd7=['Request','name','timeout','strategy','User','Agents','online','openchannelPause','getOpenchannelQueues'];(function(_0x43c763,_0x36a5d1){var _0x5d5e4e=function(_0x5d39c3){while(--_0x5d39c3){_0x43c763['push'](_0x43c763['shift']());}};_0x5d5e4e(++_0x36a5d1);}(_0xacd7,0x1dc));var _0x7acd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xacd7[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x7acd('0x0')]=function(){return function(){return client[_0x7acd('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x7acd('0x2'),_0x7acd('0x3'),_0x7acd('0x4')],'include':[{'model':_0x7acd('0x5'),'as':_0x7acd('0x6'),'attributes':['id',_0x7acd('0x2'),_0x7acd('0x7'),_0x7acd('0x8')]}]},'log':_0x7acd('0x0')});};};
\ No newline at end of file
+var _0x3cb7=['name','timeout','strategy','User','Agents','online','openchannelPause','getOpenchannelQueues','../client','Request','GetOpenchannelQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3cb7,0x97));var _0x73cb=function(_0x3e690a,_0x31aa0f){_0x3e690a=_0x3e690a-0x0;var _0x435ca0=_0x3cb7[_0x3e690a];return _0x435ca0;};'use strict';var client=require(_0x73cb('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x73cb('0x1')](_0x73cb('0x2'),{'options':{'raw':![],'attributes':['id',_0x73cb('0x3'),_0x73cb('0x4'),_0x73cb('0x5')],'include':[{'model':_0x73cb('0x6'),'as':_0x73cb('0x7'),'attributes':['id','name',_0x73cb('0x8'),_0x73cb('0x9')]}]},'log':_0x73cb('0xa')});};};
\ No newline at end of file
index fd0344d..4b2a1af 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x31f7=['DESC','UpdateOpenchannelQueueReport','Request','CreateOpenchannelQueueReport','update'];(function(_0x41f901,_0x10b999){var _0x47c1f3=function(_0x3cc3e3){while(--_0x3cc3e3){_0x41f901['push'](_0x41f901['shift']());}};_0x47c1f3(++_0x10b999);}(_0x31f7,0x174));var _0x731f=function(_0x1291e6,_0x5a8934){_0x1291e6=_0x1291e6-0x0;var _0x21f8bf=_0x31f7[_0x1291e6];return _0x21f8bf;};'use strict';var client=require('../client');exports['create']=function(_0x35929e){return client[_0x731f('0x0')](_0x731f('0x1'),{'body':_0x35929e,'log':_0x731f('0x1')});};exports[_0x731f('0x2')]=function(_0x97a9a0,_0x399f4e){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x399f4e,'options':{'where':{'uniqueid':_0x97a9a0},'order':[['id',_0x731f('0x3')]],'limit':0x1},'log':_0x731f('0x4')});};
\ No newline at end of file
+var _0x9421=['create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x3e844f,_0x2ef770){var _0x35c2d9=function(_0x72b27){while(--_0x72b27){_0x3e844f['push'](_0x3e844f['shift']());}};_0x35c2d9(++_0x2ef770);}(_0x9421,0xfb));var _0x1942=function(_0x573808,_0x44d1ca){_0x573808=_0x573808-0x0;var _0x295fd1=_0x9421[_0x573808];return _0x295fd1;};'use strict';var client=require(_0x1942('0x0'));exports[_0x1942('0x1')]=function(_0x3f07b1){return client[_0x1942('0x2')](_0x1942('0x3'),{'body':_0x3f07b1,'log':_0x1942('0x3')});};exports[_0x1942('0x4')]=function(_0x524a68,_0x2c01f0){return client['Request'](_0x1942('0x5'),{'body':_0x2c01f0,'options':{'where':{'uniqueid':_0x524a68},'order':[['id',_0x1942('0x6')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});};
\ No newline at end of file
index ba9bb74..64fbbeb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x25ab=['UpdateSmsInteraction','updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x25ab,0x148));var _0xb25a=function(_0x41e780,_0x18dca5){_0x41e780=_0x41e780-0x0;var _0x2e290d=_0x25ab[_0x41e780];return _0x2e290d;};'use strict';var client=require(_0xb25a('0x0'));exports[_0xb25a('0x1')]=function(_0x4f8dab,_0x44dc10){return client['Request'](_0xb25a('0x2'),{'body':_0x44dc10,'options':{'where':{'id':_0x4f8dab}},'log':_0xb25a('0x3')});};exports['addTags']=function(_0x350101,_0x37cae7){return client['Request'](_0xb25a('0x4'),{'body':_0x37cae7,'options':{'where':{'id':_0x350101}},'log':_0xb25a('0x5')});};
\ No newline at end of file
+var _0x1415=['addTags','Request','AddTagsToSmsInteraction','../client','update','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x1415,0x1ca));var _0x5141=function(_0x3af805,_0x519702){_0x3af805=_0x3af805-0x0;var _0xbf727b=_0x1415[_0x3af805];return _0xbf727b;};'use strict';var client=require(_0x5141('0x0'));exports[_0x5141('0x1')]=function(_0x407d44,_0x3520ac){return client['Request'](_0x5141('0x2'),{'body':_0x3520ac,'options':{'where':{'id':_0x407d44}},'log':_0x5141('0x3')});};exports[_0x5141('0x4')]=function(_0xd221ba,_0x2d55a7){return client[_0x5141('0x5')](_0x5141('0x6'),{'body':_0x2d55a7,'options':{'where':{'id':_0xd221ba}},'log':'addTagsToSmsInteraction'});};
\ No newline at end of file
index 94ad6c5..e3a6b96 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x74fc=['../client','create','CreateSmsMessage','createSmsMessage'];(function(_0x3fc1f7,_0x2cc343){var _0x589bdb=function(_0x3c3e18){while(--_0x3c3e18){_0x3fc1f7['push'](_0x3fc1f7['shift']());}};_0x589bdb(++_0x2cc343);}(_0x74fc,0x88));var _0xc74f=function(_0x1dc81c,_0x490e4e){_0x1dc81c=_0x1dc81c-0x0;var _0x36ebb7=_0x74fc[_0x1dc81c];return _0x36ebb7;};'use strict';var client=require(_0xc74f('0x0'));exports[_0xc74f('0x1')]=function(_0x51f778){return client['Request'](_0xc74f('0x2'),{'body':_0x51f778,'log':_0xc74f('0x3')});};
\ No newline at end of file
+var _0x1463=['../client','Request','CreateSmsMessage','createSmsMessage'];(function(_0x38a355,_0x2fe08f){var _0x1e01a5=function(_0x38401e){while(--_0x38401e){_0x38a355['push'](_0x38a355['shift']());}};_0x1e01a5(++_0x2fe08f);}(_0x1463,0x1ec));var _0x3146=function(_0xcd44f1,_0x3b91c7){_0xcd44f1=_0xcd44f1-0x0;var _0x576f10=_0x1463[_0xcd44f1];return _0x576f10;};'use strict';var client=require(_0x3146('0x0'));exports['create']=function(_0x4a7158){return client[_0x3146('0x1')](_0x3146('0x2'),{'body':_0x4a7158,'log':_0x3146('0x3')});};
\ No newline at end of file
index 3199539..b118fe4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd202=['Agents','online','../client','getSmsQueues','Request','GetSmsQueue','name','timeout'];(function(_0x41db97,_0x56ed5c){var _0x446326=function(_0x3b8218){while(--_0x3b8218){_0x41db97['push'](_0x41db97['shift']());}};_0x446326(++_0x56ed5c);}(_0xd202,0x15a));var _0x2d20=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xd202[_0x13d07a];return _0x5ee0ee;};'use strict';var client=require(_0x2d20('0x0'));exports[_0x2d20('0x1')]=function(){return function(){return client[_0x2d20('0x2')](_0x2d20('0x3'),{'options':{'raw':![],'attributes':['id',_0x2d20('0x4'),_0x2d20('0x5'),'strategy'],'include':[{'model':'User','as':_0x2d20('0x6'),'attributes':['id',_0x2d20('0x4'),_0x2d20('0x7'),'smsPause']}]},'log':_0x2d20('0x1')});};};
\ No newline at end of file
+var _0x7711=['User','Agents','online','smsPause','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x58fcae,_0xeeb7f6){var _0x4ccad3=function(_0x1688f4){while(--_0x1688f4){_0x58fcae['push'](_0x58fcae['shift']());}};_0x4ccad3(++_0xeeb7f6);}(_0x7711,0xf7));var _0x1771=function(_0x55b116,_0x12ca28){_0x55b116=_0x55b116-0x0;var _0x49c785=_0x7711[_0x55b116];return _0x49c785;};'use strict';var client=require(_0x1771('0x0'));exports[_0x1771('0x1')]=function(){return function(){return client[_0x1771('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x1771('0x3'),_0x1771('0x4')],'include':[{'model':_0x1771('0x5'),'as':_0x1771('0x6'),'attributes':['id','name',_0x1771('0x7'),_0x1771('0x8')]}]},'log':'getSmsQueues'});};};
\ No newline at end of file
index fbbd830..bc2e948 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcd3b=['CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xcd3b,0x19c));var _0xbcd3=function(_0x2e07ba,_0xb3369e){_0x2e07ba=_0x2e07ba-0x0;var _0x5abba7=_0xcd3b[_0x2e07ba];return _0x5abba7;};'use strict';var client=require(_0xbcd3('0x0'));exports['create']=function(_0x30db39){return client[_0xbcd3('0x1')](_0xbcd3('0x2'),{'body':_0x30db39,'log':_0xbcd3('0x2')});};exports[_0xbcd3('0x3')]=function(_0x4ab5fb,_0x263b28){return client[_0xbcd3('0x1')](_0xbcd3('0x4'),{'body':_0x263b28,'options':{'where':{'uniqueid':_0x4ab5fb},'order':[['id',_0xbcd3('0x5')]],'limit':0x1},'log':_0xbcd3('0x4')});};
\ No newline at end of file
+var _0xff8d=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x57b3d0,_0x305c7e){var _0x594379=function(_0x34eb88){while(--_0x34eb88){_0x57b3d0['push'](_0x57b3d0['shift']());}};_0x594379(++_0x305c7e);}(_0xff8d,0x7d));var _0xdff8=function(_0x1b67c4,_0x4a17ab){_0x1b67c4=_0x1b67c4-0x0;var _0x30525f=_0xff8d[_0x1b67c4];return _0x30525f;};'use strict';var client=require('../client');exports[_0xdff8('0x0')]=function(_0x34bd80){return client['Request']('CreateSmsQueueReport',{'body':_0x34bd80,'log':_0xdff8('0x1')});};exports[_0xdff8('0x2')]=function(_0x2eafe8,_0x37ad59){return client['Request'](_0xdff8('0x3'),{'body':_0x37ad59,'options':{'where':{'uniqueid':_0x2eafe8},'order':[['id',_0xdff8('0x4')]],'limit':0x1},'log':_0xdff8('0x3')});};
\ No newline at end of file
index a912f36..5b8537b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0e00=['lastPauseAt','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatCapacity','faxCapacity','openchannelCapacity','../client','getAgents','Request','agent','name','online','pauseType'];(function(_0x17474a,_0xd1a49c){var _0x3a5495=function(_0x10e1b4){while(--_0x10e1b4){_0x17474a['push'](_0x17474a['shift']());}};_0x3a5495(++_0xd1a49c);}(_0x0e00,0x92));var _0x00e0=function(_0x1a9dd3,_0x97421b){_0x1a9dd3=_0x1a9dd3-0x0;var _0x436785=_0x0e00[_0x1a9dd3];return _0x436785;};'use strict';var client=require(_0x00e0('0x0'));exports[_0x00e0('0x1')]=function(){return function(){return client[_0x00e0('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':_0x00e0('0x3')},'attributes':['id',_0x00e0('0x4'),_0x00e0('0x5'),_0x00e0('0x6'),_0x00e0('0x7'),_0x00e0('0x8'),_0x00e0('0x9'),_0x00e0('0xa'),_0x00e0('0xb'),_0x00e0('0xc'),_0x00e0('0xd'),_0x00e0('0xe'),'mailCapacity',_0x00e0('0xf'),'smsCapacity',_0x00e0('0x10')]},'log':_0x00e0('0x1')});};};
\ No newline at end of file
+var _0xb4ac=['mailCapacity','smsCapacity','openchannelCapacity','../client','getAgents','Request','GetUser','agent','name','pauseType','lastPauseAt','voicePause','chatPause','faxPause','smsPause','openchannelPause','chatCapacity'];(function(_0x38022e,_0x50c9be){var _0x13d394=function(_0x26cfab){while(--_0x26cfab){_0x38022e['push'](_0x38022e['shift']());}};_0x13d394(++_0x50c9be);}(_0xb4ac,0x179));var _0xcb4a=function(_0x4e6149,_0x24aff6){_0x4e6149=_0x4e6149-0x0;var _0x34ada7=_0xb4ac[_0x4e6149];return _0x34ada7;};'use strict';var client=require(_0xcb4a('0x0'));exports[_0xcb4a('0x1')]=function(){return function(){return client[_0xcb4a('0x2')](_0xcb4a('0x3'),{'options':{'raw':!![],'where':{'role':_0xcb4a('0x4')},'attributes':['id',_0xcb4a('0x5'),'online',_0xcb4a('0x6'),_0xcb4a('0x7'),_0xcb4a('0x8'),_0xcb4a('0x9'),'mailPause',_0xcb4a('0xa'),_0xcb4a('0xb'),_0xcb4a('0xc'),_0xcb4a('0xd'),_0xcb4a('0xe'),'faxCapacity',_0xcb4a('0xf'),_0xcb4a('0x10')]},'log':_0xcb4a('0x1')});};};
\ No newline at end of file
index ae79dbf..1c82270 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbd13=['rules','close','info','[%s][AGENT]\x20ROUTING\x20STOPPED','stop','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','lodash','util','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','error','[%s][AGENT]\x20%s','map','find','agents','timeout','createQueue','atimeout','channel'];(function(_0x416673,_0x327fdc){var _0x43c3e7=function(_0x17da31){while(--_0x17da31){_0x416673['push'](_0x416673['shift']());}};_0x43c3e7(++_0x327fdc);}(_0xbd13,0x116));var _0x3bd1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbd13[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x3bd1('0x0'));var _=require(_0x3bd1('0x1'));var util=require(_0x3bd1('0x2'));var seqqueue=require('seq-queue');var logger=require(_0x3bd1('0x3'))('routing');var strategy=require(_0x3bd1('0x4'));var queue=schema({'name':{'type':_0x3bd1('0x5'),'required':!![],'message':_0x3bd1('0x6')},'timeout':{'type':'number','message':_0x3bd1('0x7')}});function writeLog(_0x4b189e,_0x3e05d4,_0x35c5f9){return logger['info'](util[_0x3bd1('0x8')](_0x3bd1('0x9'),_0x4b189e,_0x3e05d4['name'],_0x35c5f9));}function handleFindAgent(_0x51d810){return function(_0xfb4966){return _0xfb4966[_0x3bd1('0xa')][_0x3bd1('0xb')]()===_0x51d810[_0x3bd1('0xb')]();};}exports['consequence']=function(_0x520051,_0x4c0d99,_0x259821,_0x508891){return function(_0x4bf7a8){try{var _0x5792ff={'name':_0x4c0d99[0x0],'timeout':_0x4c0d99[0x1]};var _0x11229f=queue[_0x3bd1('0x0')](_0x5792ff,{'typecast':!![]});if(_0x11229f[_0x3bd1('0xc')]){logger[_0x3bd1('0xd')](_0x3bd1('0xe'),_0x520051,_[_0x3bd1('0xf')](_0x11229f,'message')['join'](',\x20'));_0x4bf7a8['stop']();}else{var _0x457d53=_[_0x3bd1('0x10')](_0x259821[_0x3bd1('0x11')],handleFindAgent(_0x5792ff[_0x3bd1('0xa')]));if(_0x457d53){var _0x3ea172=(_0x5792ff[_0x3bd1('0x12')]||0xa)*0x3e8;var _0x5927f2,_0x6e71a0;var _0x239d72=seqqueue[_0x3bd1('0x13')](_0x3ea172);_0x239d72['id']=_0x520051;_0x239d72[_0x3bd1('0x14')]=_0x3ea172;_0x239d72[_0x3bd1('0x15')]=_0x508891[_0x3bd1('0x15')];writeLog(_0x520051,_0x457d53,util[_0x3bd1('0x8')]('START:%s',_0x3ea172));_0x259821[_0x3bd1('0x16')][_0x520051]['on']('end',function(){_0x239d72[_0x3bd1('0x17')]();clearTimeout(_0x6e71a0);_0x6e71a0=undefined;if(_0x259821[_0x3bd1('0x16')][_0x520051]){delete _0x259821[_0x3bd1('0x16')][_0x520051];}logger[_0x3bd1('0x18')](_0x3bd1('0x19'),_0x520051);_0x4bf7a8[_0x3bd1('0x1a')]();});_0x6e71a0=setTimeout(function(){clearTimeout(_0x6e71a0);_0x239d72[_0x3bd1('0x17')]();logger[_0x3bd1('0x18')]('[%s][AGENT]\x20ROUTING\x20END',_0x520051);_0x4bf7a8['next']();},_0x3ea172);strategy['agent'](_0x239d72,_0x457d53,_0x259821,_0x508891);}else{logger[_0x3bd1('0xd')](_0x3bd1('0x1b'),_0x520051,_0x5792ff[_0x3bd1('0xa')]);_0x4bf7a8['stop']();}}}catch(_0x18f7be){console['log'](_0x18f7be);logger[_0x3bd1('0xd')](_0x3bd1('0x1c'),_0x520051,_0x18f7be[_0x3bd1('0x1d')]);_0x4bf7a8['stop']();}};};
\ No newline at end of file
+var _0xe97f=['close','rules','info','stop','[%s][AGENT]\x20ROUTING\x20END','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','./strategy','string','number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','map','message','join','find','agents','timeout','createQueue','atimeout','channel','START:%s','end'];(function(_0x71b765,_0x3053f8){var _0x34cb24=function(_0x2dd237){while(--_0x2dd237){_0x71b765['push'](_0x71b765['shift']());}};_0x34cb24(++_0x3053f8);}(_0xe97f,0x146));var _0xfe97=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xe97f[_0x173441];return _0x2423a8;};'use strict';var schema=require(_0xfe97('0x0'));var _=require(_0xfe97('0x1'));var util=require(_0xfe97('0x2'));var seqqueue=require(_0xfe97('0x3'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0xfe97('0x4'));var queue=schema({'name':{'type':_0xfe97('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xfe97('0x6'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x381242,_0x2d5f41,_0x5db4a1){return logger['info'](util[_0xfe97('0x7')](_0xfe97('0x8'),_0x381242,_0x2d5f41['name'],_0x5db4a1));}function handleFindAgent(_0x547a54){return function(_0x5a0475){return _0x5a0475[_0xfe97('0x9')][_0xfe97('0xa')]()===_0x547a54[_0xfe97('0xa')]();};}exports[_0xfe97('0xb')]=function(_0x1be442,_0x220880,_0x2dcc62,_0x319f77){return function(_0x2ce606){try{var _0x5cbd18={'name':_0x220880[0x0],'timeout':_0x220880[0x1]};var _0x179cbf=queue['validate'](_0x5cbd18,{'typecast':!![]});if(_0x179cbf[_0xfe97('0xc')]){logger['error']('[%s][AGENT]\x20%s',_0x1be442,_[_0xfe97('0xd')](_0x179cbf,_0xfe97('0xe'))[_0xfe97('0xf')](',\x20'));_0x2ce606['stop']();}else{var _0x5e34dd=_[_0xfe97('0x10')](_0x2dcc62[_0xfe97('0x11')],handleFindAgent(_0x5cbd18['name']));if(_0x5e34dd){var _0x49bc53=(_0x5cbd18[_0xfe97('0x12')]||0xa)*0x3e8;var _0x6c02d4,_0x1f3df6;var _0x36306f=seqqueue[_0xfe97('0x13')](_0x49bc53);_0x36306f['id']=_0x1be442;_0x36306f[_0xfe97('0x14')]=_0x49bc53;_0x36306f[_0xfe97('0x15')]=_0x319f77[_0xfe97('0x15')];writeLog(_0x1be442,_0x5e34dd,util['format'](_0xfe97('0x16'),_0x49bc53));_0x2dcc62['rules'][_0x1be442]['on'](_0xfe97('0x17'),function(){_0x36306f[_0xfe97('0x18')]();clearTimeout(_0x1f3df6);_0x1f3df6=undefined;if(_0x2dcc62[_0xfe97('0x19')][_0x1be442]){delete _0x2dcc62[_0xfe97('0x19')][_0x1be442];}logger[_0xfe97('0x1a')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x1be442);_0x2ce606[_0xfe97('0x1b')]();});_0x1f3df6=setTimeout(function(){clearTimeout(_0x1f3df6);_0x36306f[_0xfe97('0x18')]();logger[_0xfe97('0x1a')](_0xfe97('0x1c'),_0x1be442);_0x2ce606['next']();},_0x49bc53);strategy[_0xfe97('0x1d')](_0x36306f,_0x5e34dd,_0x2dcc62,_0x319f77);}else{logger[_0xfe97('0x1e')](_0xfe97('0x1f'),_0x1be442,_0x5cbd18[_0xfe97('0x9')]);_0x2ce606[_0xfe97('0x1b')]();}}}catch(_0x23987d){console[_0xfe97('0x20')](_0x23987d);logger[_0xfe97('0x1e')](_0xfe97('0x21'),_0x1be442,_0x23987d[_0xfe97('0x22')]);_0x2ce606['stop']();}};};
\ No newline at end of file
index c4cf67b..b2d77ad 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4969=['stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','toString','postText','amazonlex','create','then','Failed','catch','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','created','isEmpty','body','Message','error','stringify','finally'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4969,0x15b));var _0x9496=function(_0xaf29da,_0x117f5a){_0xaf29da=_0xaf29da-0x0;var _0x295c51=_0x4969[_0xaf29da];return _0x295c51;};'use strict';var _=require(_0x9496('0x0'));var moment=require(_0x9496('0x1'));var AWS=require('aws-sdk');var utils=require(_0x9496('0x2'));var logger=require(_0x9496('0x3'))(_0x9496('0x4'));var rpc={'chatMessage':require(_0x9496('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x9496('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x9496('0x7'))};exports[_0x9496('0x8')]=function(_0x1c3006,_0x32e91c){return function(_0x20bedf){try{if(!_['isNil'](this['interaction'][_0x9496('0x9')])){logger[_0x9496('0xa')](_0x9496('0xb'),_0x1c3006,_0x9496('0xc'));return _0x20bedf[_0x9496('0xd')]();}var _0x4b7ded={'ContactId':this[_0x9496('0xe')]['id'],'sentAt':moment()[_0x9496('0xf')](_0x9496('0x10')),'direction':'out'};var _0x1bf52e=this[_0x9496('0x11')];if(_0x1bf52e==='chat'){_0x4b7ded[_0x9496('0x12')]=this[_0x9496('0x13')]['id'];}else{_0x4b7ded[_[_0x9496('0x14')](_0x1bf52e)+_0x9496('0x15')]=this[_0x9496('0x13')]['id'];}_0x4b7ded[_[_0x9496('0x14')](_0x1bf52e)+_0x9496('0x16')]=this[_0x9496('0x17')]['id'];if(this['interaction'][_0x9496('0x18')]){var _0x1e79a9=_0x32e91c[0x4];if(!_[_0x9496('0x19')](_0x1e79a9)){_0x4b7ded[_0x9496('0x1a')]=utils['getMustacheRender'](_0x1e79a9,this);return rpc[_0x1bf52e+_0x9496('0x1b')]['create'](_0x4b7ded)['then'](function(_0x308c6d){logger['info']('[%s][AMAZONLEX]\x20%s',_0x1c3006,_0x4b7ded[_0x9496('0x1a')]);})['catch'](function(_0x10d833){logger[_0x9496('0x1c')]('[%s][AMAZONLEX]\x20%s',_0x1c3006,JSON[_0x9496('0x1d')](_0x10d833));})[_0x9496('0x1e')](function(){logger[_0x9496('0xa')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1c3006);_0x20bedf[_0x9496('0x1f')]();});}else{logger[_0x9496('0xa')](_0x9496('0x20'),_0x1c3006);_0x20bedf[_0x9496('0x1f')]();}}else{var _0x3822a2=this;var _0x13b9e3=new AWS['LexRuntime']({'accessKeyId':_0x32e91c[0x0],'secretAccessKey':_0x32e91c[0x1],'region':_0x32e91c[0x2]});var _0x389e0f={'botAlias':_0x9496('0x21'),'botName':_0x32e91c[0x3],'inputText':this[_0x9496('0x22')]['body'],'userId':this[_0x9496('0x17')]['id'][_0x9496('0x23')]()};_0x13b9e3[_0x9496('0x24')](_0x389e0f,function(_0x218340,_0x479072){if(_0x218340){logger['error']('[%s][AMAZONLEX]\x20%s',_0x1c3006,_0x218340[_0x9496('0x22')]);_0x20bedf[_0x9496('0xd')]();}else if(_0x479072&&_0x479072[_0x9496('0x22')]){_0x3822a2[_0x9496('0x1a')][_0x9496('0x25')]=_0x479072;_0x4b7ded['body']=_0x479072[_0x9496('0x22')];return rpc[_0x1bf52e+'Message'][_0x9496('0x26')](_0x4b7ded)[_0x9496('0x27')](function(_0x20b2d1){logger['info']('[%s][AMAZONLEX]\x20%s',_0x1c3006,_0x4b7ded[_0x9496('0x1a')]);if(_0x479072['dialogState']==_0x9496('0x28')){_0x20bedf[_0x9496('0xd')]();}else{_0x20bedf['stop']();}})[_0x9496('0x29')](function(_0x5e3be2){logger[_0x9496('0x1c')](_0x9496('0xb'),_0x1c3006,JSON[_0x9496('0x1d')](_0x5e3be2));_0x20bedf[_0x9496('0xd')]();});}else{_0x20bedf[_0x9496('0xd')]();}});}}catch(_0x4c26b4){logger['error'](_0x9496('0xb'),_0x1c3006,JSON[_0x9496('0x1d')](_0x4c26b4));_0x20bedf['stop']();}};};
\ No newline at end of file
+var _0xe2df=['isEmpty','body','getMustacheRender','create','then','[%s][AMAZONLEX]\x20%s','catch','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','toString','postText','error','message','Message','dialogState','Failed','stringify','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','created'];(function(_0x423358,_0x1f7d08){var _0xb4c8da=function(_0x1d3360){while(--_0x1d3360){_0x423358['push'](_0x423358['shift']());}};_0xb4c8da(++_0x1f7d08);}(_0xe2df,0x1a1));var _0xfe2d=function(_0x5bf1ff,_0x1e4e35){_0x5bf1ff=_0x5bf1ff-0x0;var _0x2bb04b=_0xe2df[_0x5bf1ff];return _0x2bb04b;};'use strict';var _=require(_0xfe2d('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0xfe2d('0x1'))(_0xfe2d('0x2'));var rpc={'chatMessage':require(_0xfe2d('0x3')),'openchannelMessage':require(_0xfe2d('0x4')),'mailMessage':require(_0xfe2d('0x5')),'smsMessage':require(_0xfe2d('0x6')),'faxMessage':require(_0xfe2d('0x7'))};exports['consequence']=function(_0x292ba8,_0x58fd11){return function(_0x3129ed){try{if(!_[_0xfe2d('0x8')](this[_0xfe2d('0x9')][_0xfe2d('0xa')])){logger[_0xfe2d('0xb')]('[%s][AMAZONLEX]\x20%s',_0x292ba8,_0xfe2d('0xc'));return _0x3129ed[_0xfe2d('0xd')]();}var _0x140be1={'ContactId':this[_0xfe2d('0xe')]['id'],'sentAt':moment()[_0xfe2d('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xfe2d('0x10')};var _0x569aed=this['channel'];if(_0x569aed==='chat'){_0x140be1[_0xfe2d('0x11')]=this[_0xfe2d('0x12')]['id'];}else{_0x140be1[_['upperFirst'](_0x569aed)+_0xfe2d('0x13')]=this['account']['id'];}_0x140be1[_[_0xfe2d('0x14')](_0x569aed)+_0xfe2d('0x15')]=this[_0xfe2d('0x9')]['id'];if(this[_0xfe2d('0x9')][_0xfe2d('0x16')]){var _0x41071d=_0x58fd11[0x4];if(!_[_0xfe2d('0x17')](_0x41071d)){_0x140be1[_0xfe2d('0x18')]=utils[_0xfe2d('0x19')](_0x41071d,this);return rpc[_0x569aed+'Message'][_0xfe2d('0x1a')](_0x140be1)[_0xfe2d('0x1b')](function(_0x4e4ccb){logger[_0xfe2d('0xb')](_0xfe2d('0x1c'),_0x292ba8,_0x140be1[_0xfe2d('0x18')]);})[_0xfe2d('0x1d')](function(_0x3e8486){logger['error'](_0xfe2d('0x1c'),_0x292ba8,JSON['stringify'](_0x3e8486));})[_0xfe2d('0x1e')](function(){logger['info'](_0xfe2d('0x1f'),_0x292ba8);_0x3129ed[_0xfe2d('0x20')]();});}else{logger[_0xfe2d('0xb')](_0xfe2d('0x21'),_0x292ba8);_0x3129ed['stop']();}}else{var _0x4b2a3f=this;var _0x19f24f=new AWS[(_0xfe2d('0x22'))]({'accessKeyId':_0x58fd11[0x0],'secretAccessKey':_0x58fd11[0x1],'region':_0x58fd11[0x2]});var _0x4e2648={'botAlias':_0xfe2d('0x23'),'botName':_0x58fd11[0x3],'inputText':this['message'][_0xfe2d('0x18')],'userId':this[_0xfe2d('0x9')]['id'][_0xfe2d('0x24')]()};_0x19f24f[_0xfe2d('0x25')](_0x4e2648,function(_0x4010dd,_0x3d10d8){if(_0x4010dd){logger[_0xfe2d('0x26')](_0xfe2d('0x1c'),_0x292ba8,_0x4010dd[_0xfe2d('0x27')]);_0x3129ed[_0xfe2d('0xd')]();}else if(_0x3d10d8&&_0x3d10d8['message']){_0x4b2a3f['body']['amazonlex']=_0x3d10d8;_0x140be1[_0xfe2d('0x18')]=_0x3d10d8['message'];return rpc[_0x569aed+_0xfe2d('0x28')][_0xfe2d('0x1a')](_0x140be1)[_0xfe2d('0x1b')](function(_0x1f325f){logger[_0xfe2d('0xb')](_0xfe2d('0x1c'),_0x292ba8,_0x140be1[_0xfe2d('0x18')]);if(_0x3d10d8[_0xfe2d('0x29')]==_0xfe2d('0x2a')){_0x3129ed['next']();}else{_0x3129ed['stop']();}})[_0xfe2d('0x1d')](function(_0x1a50f9){logger[_0xfe2d('0x26')](_0xfe2d('0x1c'),_0x292ba8,JSON[_0xfe2d('0x2b')](_0x1a50f9));_0x3129ed['next']();});}else{_0x3129ed['next']();}});}}catch(_0x47e9bc){logger['error'](_0xfe2d('0x1c'),_0x292ba8,JSON['stringify'](_0x47e9bc));_0x3129ed[_0xfe2d('0x20')]();}};};
\ No newline at end of file
index 6f0f8aa..63655a9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcb91=['consequence','interaction','created','Autoreply\x20already\x20sent','next','channel','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','read','subject','Re:','Re:\x20','account','upperFirst','AccountId','mail','Smtp','service','port','secure','authentication','auth','user','pass','inReplyTo','messageId','<div\x20id=\x22xm-mail-content\x22>','body','<div\x20id=\x22xm-mail-content\x22','<div','</div>','then','info','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','[%s][AUTOREPLY]\x20%s','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','Message','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../mailRpc'];(function(_0x43ac7e,_0x69d02){var _0x404460=function(_0x19a005){while(--_0x19a005){_0x43ac7e['push'](_0x43ac7e['shift']());}};_0x404460(++_0x69d02);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3da612,_0x332456){_0x3da612=_0x3da612-0x0;var _0x1a9d1d=_0xcb91[_0x3da612];return _0x1a9d1d;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require(_0x1cb9('0x0'));var logger=require(_0x1cb9('0x1'))(_0x1cb9('0x2'));var rpc={'chatMessage':require(_0x1cb9('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x1cb9('0x4')),'smsMessage':require(_0x1cb9('0x5')),'faxMessage':require('../../rpc/faxMessage')};var mailRpc=require(_0x1cb9('0x6'));exports[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return function(_0x3f7deb){try{if(_0x226b69[0x0]==='1'&&(_['isNil'](this[_0x1cb9('0x8')][_0x1cb9('0x9')])||!this['interaction'][_0x1cb9('0x9')])){logger['info']('[%s][AUTOREPLY]\x20%s',_0x53ffbd,_0x1cb9('0xa'));return _0x3f7deb[_0x1cb9('0xb')]();}var _0x74ce19=this[_0x1cb9('0xc')];var _0x2fc627={'body':utils['getMustacheRender'](_0x226b69[0x1],this),'ContactId':this[_0x1cb9('0xd')]['id'],'sentAt':moment()[_0x1cb9('0xe')](_0x1cb9('0xf')),'direction':_0x1cb9('0x10')};if(this[_0x1cb9('0x11')]){_0x2fc627['to']=this['message']['from']||'';_0x2fc627['cc']=this['message']['cc']||'';_0x2fc627[_0x1cb9('0x12')]=this[_0x1cb9('0x11')]['to']||'';_0x2fc627[_0x1cb9('0x13')]=this[_0x1cb9('0x11')]['phone']||'';_0x2fc627[_0x1cb9('0x14')]=!![];if(this[_0x1cb9('0x11')][_0x1cb9('0x15')]){_0x2fc627[_0x1cb9('0x15')]='';_0x2fc627[_0x1cb9('0x15')]+=_['startsWith'](this['message'][_0x1cb9('0x15')],_0x1cb9('0x16'))?'':_0x1cb9('0x17');_0x2fc627[_0x1cb9('0x15')]+=this[_0x1cb9('0x11')][_0x1cb9('0x15')];}}if(this[_0x1cb9('0xc')]==='chat'){_0x2fc627['ChatWebsiteId']=this[_0x1cb9('0x18')]['id'];}else{_0x2fc627[_[_0x1cb9('0x19')](this[_0x1cb9('0xc')])+_0x1cb9('0x1a')]=this[_0x1cb9('0x18')]['id'];}_0x2fc627[_[_0x1cb9('0x19')](this[_0x1cb9('0xc')])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0x1cb9('0xc')]+'Message']){if(this[_0x1cb9('0xc')]===_0x1cb9('0x1b')){var _0x523b26={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0x1cb9('0x1c')][_0x1cb9('0x1d')]){_0x523b26[_0x1cb9('0x1d')]=this[_0x1cb9('0x18')][_0x1cb9('0x1c')][_0x1cb9('0x1d')];}else{_0x523b26['host']=this['account'][_0x1cb9('0x1c')]['host'];_0x523b26[_0x1cb9('0x1e')]=this[_0x1cb9('0x18')][_0x1cb9('0x1c')][_0x1cb9('0x1e')];_0x523b26[_0x1cb9('0x1f')]=this['account'][_0x1cb9('0x1c')][_0x1cb9('0x1f')];}if(this['account'][_0x1cb9('0x1c')][_0x1cb9('0x20')]){_0x523b26[_0x1cb9('0x21')]={'user':this[_0x1cb9('0x18')][_0x1cb9('0x1c')][_0x1cb9('0x22')],'pass':this[_0x1cb9('0x18')][_0x1cb9('0x1c')][_0x1cb9('0x23')]};}_0x2fc627[_0x1cb9('0x24')]=this['message'][_0x1cb9('0x25')];_0x2fc627['html']=_0x1cb9('0x26')+_['replace'](_0x2fc627[_0x1cb9('0x27')],_0x1cb9('0x28'),_0x1cb9('0x29'))+_0x1cb9('0x2a');return mailRpc['sendMailMessage'](_0x523b26,_0x2fc627)[_0x1cb9('0x2b')](function(_0x4eba82){logger[_0x1cb9('0x2c')](_0x1cb9('0x2d'),_0x53ffbd);_0x2fc627[_0x1cb9('0x25')]=_0x4eba82['message'][_0x1cb9('0x25')];return rpc[_0x74ce19+'Message'][_0x1cb9('0x2e')](_0x2fc627);})['then'](function(_0x2164e3){logger[_0x1cb9('0x2c')](_0x1cb9('0x2f'),_0x53ffbd,JSON[_0x1cb9('0x30')](_0x2164e3));})['catch'](function(_0x2114a4){logger[_0x1cb9('0x31')](_0x1cb9('0x32'),_0x53ffbd,JSON[_0x1cb9('0x30')](_0x2114a4));})[_0x1cb9('0x33')](function(){_0x3f7deb[_0x1cb9('0xb')]();});}else{return rpc[this[_0x1cb9('0xc')]+_0x1cb9('0x34')][_0x1cb9('0x2e')](_0x2fc627)[_0x1cb9('0x2b')](function(_0x294eec){logger[_0x1cb9('0x2c')](_0x1cb9('0x2f'),_0x53ffbd,_0x2fc627['body']);})['catch'](function(_0x299ff8){logger[_0x1cb9('0x31')](_0x1cb9('0x2f'),_0x53ffbd,JSON[_0x1cb9('0x30')](_0x299ff8));})[_0x1cb9('0x33')](function(){_0x3f7deb[_0x1cb9('0xb')]();});}}}catch(_0x35f5e8){logger[_0x1cb9('0x31')]('[%s][AUTOREPLY]\x20%s',_0x53ffbd,JSON[_0x1cb9('0x30')](_0x35f5e8));_0x3f7deb[_0x1cb9('0x35')]();}};};
\ No newline at end of file
+var _0xa9e0=['messageId','html','replace','body','<div\x20id=\x22xm-mail-content\x22','<div','sendMailMessage','then','info','[%s][AUTOREPLY]\x20SMTP\x20SENT','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','create','error','lodash','moment','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../mailRpc','consequence','isNil','interaction','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','channel','out','message','from','phone','read','subject','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','service','Smtp','host','port','secure','authentication','user','pass','inReplyTo'];(function(_0x290da4,_0x664036){var _0x1b5a84=function(_0xbeaa50){while(--_0xbeaa50){_0x290da4['push'](_0x290da4['shift']());}};_0x1b5a84(++_0x664036);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var utils=require(_0x0a9e('0x2'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x0a9e('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x0a9e('0x4')),'smsMessage':require(_0x0a9e('0x5')),'faxMessage':require(_0x0a9e('0x6'))};var mailRpc=require(_0x0a9e('0x7'));exports[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return function(_0x441e3a){try{if(_0x219af0[0x0]==='1'&&(_[_0x0a9e('0x9')](this['interaction']['created'])||!this[_0x0a9e('0xa')]['created'])){logger['info'](_0x0a9e('0xb'),_0x57b080,_0x0a9e('0xc'));return _0x441e3a[_0x0a9e('0xd')]();}var _0x3ab53f=this[_0x0a9e('0xe')];var _0xbd1168={'body':utils['getMustacheRender'](_0x219af0[0x1],this),'ContactId':this['contact']['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x0a9e('0xf')};if(this[_0x0a9e('0x10')]){_0xbd1168['to']=this[_0x0a9e('0x10')][_0x0a9e('0x11')]||'';_0xbd1168['cc']=this[_0x0a9e('0x10')]['cc']||'';_0xbd1168[_0x0a9e('0x11')]=this['message']['to']||'';_0xbd1168[_0x0a9e('0x12')]=this[_0x0a9e('0x10')][_0x0a9e('0x12')]||'';_0xbd1168[_0x0a9e('0x13')]=!![];if(this[_0x0a9e('0x10')][_0x0a9e('0x14')]){_0xbd1168['subject']='';_0xbd1168[_0x0a9e('0x14')]+=_['startsWith'](this[_0x0a9e('0x10')]['subject'],_0x0a9e('0x15'))?'':_0x0a9e('0x16');_0xbd1168['subject']+=this[_0x0a9e('0x10')]['subject'];}}if(this[_0x0a9e('0xe')]===_0x0a9e('0x17')){_0xbd1168[_0x0a9e('0x18')]=this[_0x0a9e('0x19')]['id'];}else{_0xbd1168[_[_0x0a9e('0x1a')](this[_0x0a9e('0xe')])+_0x0a9e('0x1b')]=this[_0x0a9e('0x19')]['id'];}_0xbd1168[_[_0x0a9e('0x1a')](this[_0x0a9e('0xe')])+_0x0a9e('0x1c')]=this[_0x0a9e('0xa')]['id'];if(rpc[this['channel']+_0x0a9e('0x1d')]){if(this[_0x0a9e('0xe')]==='mail'){var _0x20f109={'tls':{'rejectUnauthorized':![]}};if(this['account']['Smtp'][_0x0a9e('0x1e')]){_0x20f109[_0x0a9e('0x1e')]=this[_0x0a9e('0x19')][_0x0a9e('0x1f')]['service'];}else{_0x20f109[_0x0a9e('0x20')]=this[_0x0a9e('0x19')][_0x0a9e('0x1f')][_0x0a9e('0x20')];_0x20f109[_0x0a9e('0x21')]=this[_0x0a9e('0x19')][_0x0a9e('0x1f')]['port'];_0x20f109['secure']=this[_0x0a9e('0x19')][_0x0a9e('0x1f')][_0x0a9e('0x22')];}if(this[_0x0a9e('0x19')]['Smtp'][_0x0a9e('0x23')]){_0x20f109['auth']={'user':this[_0x0a9e('0x19')]['Smtp'][_0x0a9e('0x24')],'pass':this[_0x0a9e('0x19')][_0x0a9e('0x1f')][_0x0a9e('0x25')]};}_0xbd1168[_0x0a9e('0x26')]=this[_0x0a9e('0x10')][_0x0a9e('0x27')];_0xbd1168[_0x0a9e('0x28')]='<div\x20id=\x22xm-mail-content\x22>'+_[_0x0a9e('0x29')](_0xbd1168[_0x0a9e('0x2a')],_0x0a9e('0x2b'),_0x0a9e('0x2c'))+'</div>';return mailRpc[_0x0a9e('0x2d')](_0x20f109,_0xbd1168)[_0x0a9e('0x2e')](function(_0x1843b2){logger[_0x0a9e('0x2f')](_0x0a9e('0x30'),_0x57b080);_0xbd1168[_0x0a9e('0x27')]=_0x1843b2[_0x0a9e('0x10')][_0x0a9e('0x27')];return rpc[_0x3ab53f+_0x0a9e('0x1d')]['create'](_0xbd1168);})[_0x0a9e('0x2e')](function(_0x5d1e0e){logger[_0x0a9e('0x2f')](_0x0a9e('0xb'),_0x57b080,JSON[_0x0a9e('0x31')](_0x5d1e0e));})[_0x0a9e('0x32')](function(_0x25ce3a){logger['error'](_0x0a9e('0x33'),_0x57b080,JSON[_0x0a9e('0x31')](_0x25ce3a));})[_0x0a9e('0x34')](function(){_0x441e3a[_0x0a9e('0xd')]();});}else{return rpc[this[_0x0a9e('0xe')]+_0x0a9e('0x1d')][_0x0a9e('0x35')](_0xbd1168)[_0x0a9e('0x2e')](function(_0x5583a4){logger[_0x0a9e('0x2f')]('[%s][AUTOREPLY]\x20%s',_0x57b080,_0xbd1168[_0x0a9e('0x2a')]);})[_0x0a9e('0x32')](function(_0x2b7e7f){logger[_0x0a9e('0x36')]('[%s][AUTOREPLY]\x20%s',_0x57b080,JSON[_0x0a9e('0x31')](_0x2b7e7f));})[_0x0a9e('0x34')](function(){_0x441e3a[_0x0a9e('0xd')]();});}}}catch(_0x15de0e){logger['error']('[%s][AUTOREPLY]\x20%s',_0x57b080,JSON[_0x0a9e('0x31')](_0x15de0e));_0x441e3a['stop']();}};};
\ No newline at end of file
index 55c7e9d..7cd7713 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1707=['[%s][CLOSE]\x20%s','finally','stop','stringify','moment','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error'];(function(_0x34c26b,_0x5e279b){var _0x2f9f58=function(_0x273abe){while(--_0x273abe){_0x34c26b['push'](_0x34c26b['shift']());}};_0x2f9f58(++_0x5e279b);}(_0x1707,0x1df));var _0x7170=function(_0x466957,_0x400c67){_0x466957=_0x466957-0x0;var _0x245b90=_0x1707[_0x466957];return _0x245b90;};'use strict';var moment=require(_0x7170('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x7170('0x1')),'smsInteraction':require(_0x7170('0x2')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x7170('0x3'))};exports[_0x7170('0x4')]=function(_0xe5a03c,_0x3829bb,_0xcc6e16,_0x19d043){return function(_0x215acb){try{logger[_0x7170('0x5')](_0x7170('0x6'),_0xe5a03c,_0x3829bb[0x0]);var _0x1f574e={'closed':0x1,'closedAt':moment()[_0x7170('0x7')](_0x7170('0x8')),'closeReason':_0x7170('0x9'),'disposition':_0x3829bb[0x0]};if(rpc[_0x19d043[_0x7170('0xa')]+_0x7170('0xb')]){rpc[_0x19d043[_0x7170('0xa')]+_0x7170('0xb')]['update'](_0x19d043[_0x7170('0xc')]['id'],_0x1f574e)['then'](function(_0x37e76a){logger[_0x7170('0x5')](_0x7170('0xd'),_0xe5a03c,_0x19d043['interaction']['id']);})['catch'](function(_0x4fc693){logger[_0x7170('0xe')](_0x7170('0xf'),_0xe5a03c,JSON['stringify'](_0x4fc693));})[_0x7170('0x10')](function(){_0x215acb[_0x7170('0x11')]();});}}catch(_0x4521e9){logger[_0x7170('0xe')](_0x7170('0xf'),_0xe5a03c,JSON[_0x7170('0x12')](_0x4521e9));_0x215acb['stop']();}};};
\ No newline at end of file
+var _0xcf66=['format','YYYY-MM-DD\x20HH:mm:ss','system','channel','update','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','consequence','[%s][CLOSE]\x20reason\x20%s'];(function(_0x48e63a,_0x57a895){var _0x3f031a=function(_0x13c912){while(--_0x13c912){_0x48e63a['push'](_0x48e63a['shift']());}};_0x3f031a(++_0x57a895);}(_0xcf66,0x71));var _0x6cf6=function(_0x4745a0,_0x35ca6e){_0x4745a0=_0x4745a0-0x0;var _0x4fa406=_0xcf66[_0x4745a0];return _0x4fa406;};'use strict';var moment=require(_0x6cf6('0x0'));var logger=require(_0x6cf6('0x1'))(_0x6cf6('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x6cf6('0x3')),'smsInteraction':require(_0x6cf6('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction')};exports[_0x6cf6('0x5')]=function(_0x45d0d8,_0x57f22f,_0x39f1d6,_0x1fbedd){return function(_0x2a573e){try{logger['info'](_0x6cf6('0x6'),_0x45d0d8,_0x57f22f[0x0]);var _0x308d0d={'closed':0x1,'closedAt':moment()[_0x6cf6('0x7')](_0x6cf6('0x8')),'closeReason':_0x6cf6('0x9'),'disposition':_0x57f22f[0x0]};if(rpc[_0x1fbedd[_0x6cf6('0xa')]+'Interaction']){rpc[_0x1fbedd['channel']+'Interaction'][_0x6cf6('0xb')](_0x1fbedd['interaction']['id'],_0x308d0d)[_0x6cf6('0xc')](function(_0x36d3f1){logger[_0x6cf6('0xd')](_0x6cf6('0xe'),_0x45d0d8,_0x1fbedd['interaction']['id']);})['catch'](function(_0x5801a9){logger[_0x6cf6('0xf')](_0x6cf6('0x10'),_0x45d0d8,JSON[_0x6cf6('0x11')](_0x5801a9));})[_0x6cf6('0x12')](function(){_0x2a573e[_0x6cf6('0x13')]();});}}catch(_0x114c2c){logger['error'](_0x6cf6('0x10'),_0x45d0d8,JSON['stringify'](_0x114c2c));_0x2a573e[_0x6cf6('0x13')]();}};};
\ No newline at end of file
index 0636973..797876b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9392=['[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','dialogflow','result','speech','create','metadata','endConversation','lodash','apiai-promise','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','UserId','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','out','channel','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','interaction','created','isEmpty','body','getMustacheRender','Message','then','info','catch','error','stringify','finally'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x9392,0x17a));var _0x2939=function(_0xe02ad0,_0x52353b){_0xe02ad0=_0xe02ad0-0x0;var _0x54e767=_0x9392[_0xe02ad0];return _0x54e767;};'use strict';var _=require(_0x2939('0x0'));var moment=require('moment');var apiai=require(_0x2939('0x1'));var md5=require(_0x2939('0x2'));var utils=require('./utils');var logger=require(_0x2939('0x3'))(_0x2939('0x4'));var rpc={'chatMessage':require(_0x2939('0x5')),'openchannelMessage':require(_0x2939('0x6')),'mailMessage':require(_0x2939('0x7')),'smsMessage':require(_0x2939('0x8')),'faxMessage':require(_0x2939('0x9'))};exports[_0x2939('0xa')]=function(_0x32f11b,_0x40da07){return function(_0x32d3d0){try{if(!_[_0x2939('0xb')](this['interaction'][_0x2939('0xc')])){logger['info'](_0x2939('0xd'),_0x32f11b,_0x2939('0xe'));return _0x32d3d0[_0x2939('0xf')]();}var _0x156107={'ContactId':this[_0x2939('0x10')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x2939('0x11')};var _0x51d8f6=this[_0x2939('0x12')];if(_0x51d8f6==='chat'){_0x156107[_0x2939('0x13')]=this['account']['id'];}else{_0x156107[_[_0x2939('0x14')](_0x51d8f6)+_0x2939('0x15')]=this[_0x2939('0x16')]['id'];}_0x156107[_[_0x2939('0x14')](_0x51d8f6)+_0x2939('0x17')]=this[_0x2939('0x18')]['id'];if(this[_0x2939('0x18')][_0x2939('0x19')]){var _0xbbde67=_0x40da07[0x2];if(!_[_0x2939('0x1a')](_0xbbde67)){_0x156107[_0x2939('0x1b')]=utils[_0x2939('0x1c')](_0xbbde67,this);return rpc[_0x51d8f6+_0x2939('0x1d')]['create'](_0x156107)[_0x2939('0x1e')](function(_0x1b3aaa){logger[_0x2939('0x1f')](_0x2939('0xd'),_0x32f11b,_0x156107['body']);})[_0x2939('0x20')](function(_0x52ffe9){logger[_0x2939('0x21')]('[%s][DIALOGFLOW]\x20%s',_0x32f11b,JSON[_0x2939('0x22')](_0x52ffe9));})[_0x2939('0x23')](function(){logger[_0x2939('0x1f')](_0x2939('0x24'),_0x32f11b);_0x32d3d0[_0x2939('0x25')]();});}else{logger[_0x2939('0x1f')](_0x2939('0x26'),_0x32f11b);_0x32d3d0['stop']();}}else{var _0x16a70d=this;var _0x359c77=apiai(_0x40da07[0x0],{'language':_0x40da07[0x1]||'en'});return _0x359c77['textRequest'](this[_0x2939('0x27')][_0x2939('0x1b')],{'sessionId':md5(this[_0x2939('0x18')]['id'])})[_0x2939('0x1e')](function(_0x501fb7){_0x16a70d[_0x2939('0x1b')][_0x2939('0x28')]=_0x501fb7;_0x156107[_0x2939('0x1b')]=_0x501fb7[_0x2939('0x29')]['fulfillment'][_0x2939('0x2a')];return rpc[_0x51d8f6+'Message'][_0x2939('0x2b')](_0x156107)['then'](function(_0x2b1ddb){logger[_0x2939('0x1f')](_0x2939('0xd'),_0x32f11b,_0x156107['body']);if(_0x501fb7[_0x2939('0x29')][_0x2939('0x2c')][_0x2939('0x2d')]){_0x32d3d0[_0x2939('0xf')]();}else{_0x32d3d0[_0x2939('0x25')]();}})[_0x2939('0x20')](function(_0x392135){logger['error'](_0x2939('0xd'),_0x32f11b,JSON[_0x2939('0x22')](_0x392135));_0x32d3d0[_0x2939('0xf')]();});})[_0x2939('0x20')](function(_0x29ea8c){logger['error'](_0x2939('0xd'),_0x32f11b,_0x29ea8c['message']);_0x32d3d0[_0x2939('0xf')]();});}}catch(_0x32283e){logger[_0x2939('0x21')](_0x2939('0xd'),_0x32f11b,JSON['stringify'](_0x32283e));_0x32d3d0['stop']();}};};
\ No newline at end of file
+var _0x3fe3=['catch','stringify','message','lodash','moment','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','ChatWebsiteId','upperFirst','AccountId','created','isEmpty','body','Message','create','then','[%s][DIALOGFLOW]\x20%s','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','result','fulfillment','speech','metadata','endConversation'];(function(_0x32cb89,_0x4caf5f){var _0x587ef4=function(_0x2b5718){while(--_0x2b5718){_0x32cb89['push'](_0x32cb89['shift']());}};_0x587ef4(++_0x4caf5f);}(_0x3fe3,0x1bb));var _0x33fe=function(_0xe1a6d8,_0x190085){_0xe1a6d8=_0xe1a6d8-0x0;var _0x2197f2=_0x3fe3[_0xe1a6d8];return _0x2197f2;};'use strict';var _=require(_0x33fe('0x0'));var moment=require(_0x33fe('0x1'));var apiai=require('apiai-promise');var md5=require(_0x33fe('0x2'));var utils=require('./utils');var logger=require(_0x33fe('0x3'))(_0x33fe('0x4'));var rpc={'chatMessage':require(_0x33fe('0x5')),'openchannelMessage':require(_0x33fe('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x33fe('0x7')),'faxMessage':require(_0x33fe('0x8'))};exports[_0x33fe('0x9')]=function(_0xe560bd,_0x5570cd){return function(_0x3c692b){try{if(!_[_0x33fe('0xa')](this[_0x33fe('0xb')]['UserId'])){logger[_0x33fe('0xc')]('[%s][DIALOGFLOW]\x20%s',_0xe560bd,_0x33fe('0xd'));return _0x3c692b[_0x33fe('0xe')]();}var _0x1a9f5d={'ContactId':this[_0x33fe('0xf')]['id'],'sentAt':moment()['format'](_0x33fe('0x10')),'direction':_0x33fe('0x11')};var _0x1f753d=this[_0x33fe('0x12')];if(_0x1f753d===_0x33fe('0x13')){_0x1a9f5d[_0x33fe('0x14')]=this['account']['id'];}else{_0x1a9f5d[_[_0x33fe('0x15')](_0x1f753d)+_0x33fe('0x16')]=this['account']['id'];}_0x1a9f5d[_[_0x33fe('0x15')](_0x1f753d)+'InteractionId']=this[_0x33fe('0xb')]['id'];if(this[_0x33fe('0xb')][_0x33fe('0x17')]){var _0x5957a1=_0x5570cd[0x2];if(!_[_0x33fe('0x18')](_0x5957a1)){_0x1a9f5d[_0x33fe('0x19')]=utils['getMustacheRender'](_0x5957a1,this);return rpc[_0x1f753d+_0x33fe('0x1a')][_0x33fe('0x1b')](_0x1a9f5d)[_0x33fe('0x1c')](function(_0x202c9a){logger[_0x33fe('0xc')](_0x33fe('0x1d'),_0xe560bd,_0x1a9f5d[_0x33fe('0x19')]);})['catch'](function(_0x2c476d){logger[_0x33fe('0x1e')](_0x33fe('0x1d'),_0xe560bd,JSON['stringify'](_0x2c476d));})[_0x33fe('0x1f')](function(){logger[_0x33fe('0xc')](_0x33fe('0x20'),_0xe560bd);_0x3c692b[_0x33fe('0x21')]();});}else{logger['info'](_0x33fe('0x22'),_0xe560bd);_0x3c692b[_0x33fe('0x21')]();}}else{var _0x62994a=this;var _0x4fc24a=apiai(_0x5570cd[0x0],{'language':_0x5570cd[0x1]||'en'});return _0x4fc24a[_0x33fe('0x23')](this['message'][_0x33fe('0x19')],{'sessionId':md5(this[_0x33fe('0xb')]['id'])})[_0x33fe('0x1c')](function(_0x288dc0){_0x62994a[_0x33fe('0x19')]['dialogflow']=_0x288dc0;_0x1a9f5d[_0x33fe('0x19')]=_0x288dc0[_0x33fe('0x24')][_0x33fe('0x25')][_0x33fe('0x26')];return rpc[_0x1f753d+'Message']['create'](_0x1a9f5d)[_0x33fe('0x1c')](function(_0x5c802a){logger['info'](_0x33fe('0x1d'),_0xe560bd,_0x1a9f5d[_0x33fe('0x19')]);if(_0x288dc0['result'][_0x33fe('0x27')][_0x33fe('0x28')]){_0x3c692b[_0x33fe('0xe')]();}else{_0x3c692b['stop']();}})[_0x33fe('0x29')](function(_0x418230){logger[_0x33fe('0x1e')]('[%s][DIALOGFLOW]\x20%s',_0xe560bd,JSON[_0x33fe('0x2a')](_0x418230));_0x3c692b[_0x33fe('0xe')]();});})[_0x33fe('0x29')](function(_0x326a53){logger[_0x33fe('0x1e')](_0x33fe('0x1d'),_0xe560bd,_0x326a53[_0x33fe('0x2b')]);_0x3c692b[_0x33fe('0xe')]();});}}catch(_0x217e19){logger['error']('[%s][DIALOGFLOW]\x20%s',_0xe560bd,JSON[_0x33fe('0x2a')](_0x217e19));_0x3c692b['stop']();}};};
\ No newline at end of file
index 6838fd1..5cdda2f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a12=['validate','lodash','html-to-text','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','fromString','getMustacheRender','length','[%s][GOTOIF]\x20%s','map','message','condition','priorityTrue','priorityFalse','info','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','stop','stringify'];(function(_0x5aa9d6,_0x56eb8b){var _0x48f997=function(_0x2f53a0){while(--_0x2f53a0){_0x5aa9d6['push'](_0x5aa9d6['shift']());}};_0x48f997(++_0x56eb8b);}(_0x7a12,0x1c0));var _0x27a1=function(_0x272daf,_0x4619ff){_0x272daf=_0x272daf-0x0;var _0x523fee=_0x7a12[_0x272daf];return _0x523fee;};'use strict';var schema=require(_0x27a1('0x0'));var _=require(_0x27a1('0x1'));var htmlToText=require(_0x27a1('0x2'));var utils=require(_0x27a1('0x3'));var logger=require('../../../../config/logger')(_0x27a1('0x4'));var gotoif=schema({'condition':{'type':_0x27a1('0x5'),'required':!![],'message':_0x27a1('0x6')},'priorityTrue':{'type':_0x27a1('0x7'),'message':_0x27a1('0x8')},'priorityFalse':{'type':_0x27a1('0x7'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x27a1('0x9')]=function(_0x64ccaf,_0x3784dd){return function(_0x1a341c){try{var _0x360a40={'condition':htmlToText[_0x27a1('0xa')](utils[_0x27a1('0xb')](_0x3784dd[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3784dd[0x1],'priorityFalse':_0x3784dd[0x2]};var _0x4cd767=gotoif[_0x27a1('0x0')](_0x360a40,{'typecast':!![]});if(_0x4cd767[_0x27a1('0xc')]){logger['error'](_0x27a1('0xd'),_0x64ccaf,_[_0x27a1('0xe')](_0x4cd767,_0x27a1('0xf'))['join'](',\x20'));_0x1a341c['stop']();}else{try{var _0x191249=eval('('+_0x360a40[_0x27a1('0x10')]+')');var _0xf8ed51=_0x191249?_0x360a40[_0x27a1('0x11')]:_0x360a40[_0x27a1('0x12')];logger[_0x27a1('0x13')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x64ccaf,_0x360a40['condition'],_0x191249,_0xf8ed51||_0x27a1('0x14'));if(_0xf8ed51){var _0x17df6a=_[_0x27a1('0x15')](_0x1a341c[_0x27a1('0x16')](),{'p':_0xf8ed51});if(_0x17df6a>=0x0){logger['info'](_0x27a1('0x17'),_0x64ccaf,_0xf8ed51||_0x27a1('0x14'),_0x17df6a);_0x1a341c[_0x27a1('0x14')](_0x17df6a);}else{logger[_0x27a1('0x13')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x64ccaf,_0xf8ed51||'next');_0x1a341c['stop']();}}else{_0x1a341c[_0x27a1('0x14')]();}}catch(_0x1ac7ec){logger[_0x27a1('0x18')](_0x27a1('0x19'),_0x64ccaf,_0x1ac7ec[_0x27a1('0xf')]);_0x1a341c[_0x27a1('0x1a')]();}}}catch(_0x3d7e89){logger['error'](_0x27a1('0xd'),_0x64ccaf,JSON[_0x27a1('0x1b')](_0x3d7e89));_0x1a341c[_0x27a1('0x1a')]();}};};
\ No newline at end of file
+var _0xa185=['validate','lodash','html-to-text','./utils','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','map','message','join','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','error','stop','stringify'];(function(_0x5b4c5d,_0x10026d){var _0x194ef4=function(_0x10fbdd){while(--_0x10fbdd){_0x5b4c5d['push'](_0x5b4c5d['shift']());}};_0x194ef4(++_0x10026d);}(_0xa185,0x1d1));var _0x5a18=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa185[_0x19950b];return _0x3c6b41;};'use strict';var schema=require(_0x5a18('0x0'));var _=require(_0x5a18('0x1'));var htmlToText=require(_0x5a18('0x2'));var utils=require(_0x5a18('0x3'));var logger=require(_0x5a18('0x4'))('routing');var gotoif=schema({'condition':{'type':_0x5a18('0x5'),'required':!![],'message':_0x5a18('0x6')},'priorityTrue':{'type':_0x5a18('0x7'),'message':_0x5a18('0x8')},'priorityFalse':{'type':_0x5a18('0x7'),'message':_0x5a18('0x9')}});exports[_0x5a18('0xa')]=function(_0x426b03,_0x44859b){return function(_0xffcb59){try{var _0x4c6b0f={'condition':htmlToText[_0x5a18('0xb')](utils[_0x5a18('0xc')](_0x44859b[0x0],this),{'wordwrap':![]})[_0x5a18('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x44859b[0x1],'priorityFalse':_0x44859b[0x2]};var _0x5d60ea=gotoif['validate'](_0x4c6b0f,{'typecast':!![]});if(_0x5d60ea[_0x5a18('0xe')]){logger['error'](_0x5a18('0xf'),_0x426b03,_[_0x5a18('0x10')](_0x5d60ea,_0x5a18('0x11'))[_0x5a18('0x12')](',\x20'));_0xffcb59['stop']();}else{try{var _0x5202b2=eval('('+_0x4c6b0f[_0x5a18('0x13')]+')');var _0x1efd33=_0x5202b2?_0x4c6b0f[_0x5a18('0x14')]:_0x4c6b0f[_0x5a18('0x15')];logger[_0x5a18('0x16')](_0x5a18('0x17'),_0x426b03,_0x4c6b0f['condition'],_0x5202b2,_0x1efd33||_0x5a18('0x18'));if(_0x1efd33){var _0x44b971=_[_0x5a18('0x19')](_0xffcb59[_0x5a18('0x1a')](),{'p':_0x1efd33});if(_0x44b971>=0x0){logger[_0x5a18('0x16')](_0x5a18('0x1b'),_0x426b03,_0x1efd33||_0x5a18('0x18'),_0x44b971);_0xffcb59[_0x5a18('0x18')](_0x44b971);}else{logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x426b03,_0x1efd33||_0x5a18('0x18'));_0xffcb59['stop']();}}else{_0xffcb59[_0x5a18('0x18')]();}}catch(_0x251b79){logger[_0x5a18('0x1c')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x426b03,_0x251b79[_0x5a18('0x11')]);_0xffcb59[_0x5a18('0x1d')]();}}}catch(_0x55ae57){logger[_0x5a18('0x1c')]('[%s][GOTOIF]\x20%s',_0x426b03,JSON[_0x5a18('0x1e')](_0x55ae57));_0xffcb59[_0x5a18('0x1d')]();}};};
\ No newline at end of file
index 73640e9..f12c891 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8280=['map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','error','stringify','validate','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','[%s][GOTOP]\x20%s'];(function(_0x37d958,_0x312f4a){var _0x1c9292=function(_0x25bdca){while(--_0x25bdca){_0x37d958['push'](_0x37d958['shift']());}};_0x1c9292(++_0x312f4a);}(_0x8280,0xd5));var _0x0828=function(_0x3fb780,_0x540d09){_0x3fb780=_0x3fb780-0x0;var _0x49bcf4=_0x8280[_0x3fb780];return _0x49bcf4;};'use strict';var schema=require(_0x0828('0x0'));var _=require('lodash');var logger=require(_0x0828('0x1'))('routing');var gotop=schema({'priority':{'type':_0x0828('0x2'),'required':!![],'message':_0x0828('0x3')}});exports[_0x0828('0x4')]=function(_0x1ff658,_0x3f4fce){return function(_0x1e637f){try{var _0x54d96b={'priority':_0x3f4fce[0x0]};var _0x11d775=gotop[_0x0828('0x0')](_0x54d96b,{'typecast':!![]});if(_0x11d775[_0x0828('0x5')]){logger['error'](_0x0828('0x6'),_0x1ff658,_[_0x0828('0x7')](_0x11d775,_0x0828('0x8'))[_0x0828('0x9')](',\x20'));_0x1e637f[_0x0828('0xa')]();}else{logger[_0x0828('0xb')](_0x0828('0xc'),_0x1ff658,_0x54d96b[_0x0828('0xd')]);if(_0x54d96b[_0x0828('0xd')]){var _0xd6eda9=_[_0x0828('0xe')](_0x1e637f[_0x0828('0xf')](),{'p':_0x54d96b[_0x0828('0xd')]});if(_0xd6eda9>=0x0){logger['info'](_0x0828('0x10'),_0x1ff658,_0x54d96b[_0x0828('0xd')]||_0x0828('0x11'),_0xd6eda9);_0x1e637f[_0x0828('0x11')](_0xd6eda9);}else{logger[_0x0828('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x1ff658,_0x54d96b[_0x0828('0xd')]||_0x0828('0x11'));_0x1e637f[_0x0828('0xa')]();}}else{_0x1e637f['next']();}}}catch(_0x4a13e7){logger[_0x0828('0x12')](_0x0828('0x6'),_0x1ff658,JSON[_0x0828('0x13')](_0x4a13e7));_0x1e637f['stop']();}};};
\ No newline at end of file
+var _0x62ef=['join','stop','priority','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','lodash','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','error','map','message'];(function(_0xe65286,_0x25fdc9){var _0x106741=function(_0x17e652){while(--_0x17e652){_0xe65286['push'](_0xe65286['shift']());}};_0x106741(++_0x25fdc9);}(_0x62ef,0x129));var _0xf62e=function(_0x413426,_0x4f7814){_0x413426=_0x413426-0x0;var _0x5576e2=_0x62ef[_0x413426];return _0x5576e2;};'use strict';var schema=require('validate');var _=require(_0xf62e('0x0'));var logger=require(_0xf62e('0x1'))(_0xf62e('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xf62e('0x3')}});exports[_0xf62e('0x4')]=function(_0x358db4,_0xc34401){return function(_0x188b8c){try{var _0x4505cd={'priority':_0xc34401[0x0]};var _0xf37c46=gotop[_0xf62e('0x5')](_0x4505cd,{'typecast':!![]});if(_0xf37c46['length']){logger[_0xf62e('0x6')]('[%s][GOTOP]\x20%s',_0x358db4,_[_0xf62e('0x7')](_0xf37c46,_0xf62e('0x8'))[_0xf62e('0x9')](',\x20'));_0x188b8c[_0xf62e('0xa')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x358db4,_0x4505cd[_0xf62e('0xb')]);if(_0x4505cd['priority']){var _0x51d323=_['findIndex'](_0x188b8c['rules'](),{'p':_0x4505cd[_0xf62e('0xb')]});if(_0x51d323>=0x0){logger[_0xf62e('0xc')](_0xf62e('0xd'),_0x358db4,_0x4505cd[_0xf62e('0xb')]||_0xf62e('0xe'),_0x51d323);_0x188b8c[_0xf62e('0xe')](_0x51d323);}else{logger['info'](_0xf62e('0xf'),_0x358db4,_0x4505cd[_0xf62e('0xb')]||_0xf62e('0xe'));_0x188b8c[_0xf62e('0xa')]();}}else{_0x188b8c[_0xf62e('0xe')]();}}}catch(_0x2995fc){logger['error'](_0xf62e('0x10'),_0x358db4,JSON['stringify'](_0x2995fc));_0x188b8c[_0xf62e('0xa')]();}};};
\ No newline at end of file
index 77fb987..6149cc8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2d62=['./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','getMustacheRender','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash'];(function(_0x5eedd4,_0x55ca1e){var _0x18ca2a=function(_0x58a83f){while(--_0x58a83f){_0x5eedd4['push'](_0x5eedd4['shift']());}};_0x18ca2a(++_0x55ca1e);}(_0x2d62,0x67));var _0x22d6=function(_0x5932ec,_0x494e31){_0x5932ec=_0x5932ec-0x0;var _0x16e7c4=_0x2d62[_0x5932ec];return _0x16e7c4;};'use strict';var _=require(_0x22d6('0x0'));var utils=require(_0x22d6('0x1'));var logger=require(_0x22d6('0x2'))(_0x22d6('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x22d6('0x4')),'mailMessage':require(_0x22d6('0x5')),'smsMessage':require(_0x22d6('0x6')),'faxMessage':require(_0x22d6('0x7'))};exports['consequence']=function(_0x10f82b,_0x5d4ca9){return function(_0x2406d7){try{var _0x4899f5={'body':utils[_0x22d6('0x8')](_0x5d4ca9[0x0],this),'ContactId':this['contact']['id']};if(this[_0x22d6('0x9')]==='chat'){_0x4899f5[_0x22d6('0xa')]=this[_0x22d6('0xb')]['id'];}else{_0x4899f5[_[_0x22d6('0xc')](this['channel'])+_0x22d6('0xd')]=this[_0x22d6('0xb')]['id'];}_0x4899f5[_['upperFirst'](this[_0x22d6('0x9')])+_0x22d6('0xe')]=this['interaction']['id'];if(rpc[this[_0x22d6('0x9')]+'Message']){return rpc[this[_0x22d6('0x9')]+_0x22d6('0xf')][_0x22d6('0x10')](_0x4899f5)[_0x22d6('0x11')](function(_0x6b31f7){logger[_0x22d6('0x12')](_0x22d6('0x13'),_0x10f82b,_0x4899f5[_0x22d6('0x14')]);_0x2406d7[_0x22d6('0x15')]();})[_0x22d6('0x16')](function(_0x24111c){logger[_0x22d6('0x17')](_0x22d6('0x13'),_0x10f82b,JSON[_0x22d6('0x18')](_0x24111c));_0x2406d7[_0x22d6('0x19')]();});}}catch(_0x4e2a5e){logger[_0x22d6('0x17')]('[%s][MESSAGE]\x20%s',_0x10f82b,JSON[_0x22d6('0x18')](_0x4e2a5e));_0x2406d7[_0x22d6('0x19')]();}};};
\ No newline at end of file
+var _0xdc82=['../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','getMustacheRender','contact','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','info','body','next','catch','error','[%s][MESSAGE]\x20%s','stringify'];(function(_0x153e8d,_0x5aab1c){var _0x185c20=function(_0xa94c80){while(--_0xa94c80){_0x153e8d['push'](_0x153e8d['shift']());}};_0x185c20(++_0x5aab1c);}(_0xdc82,0x1ba));var _0x2dc8=function(_0x56610b,_0x45243e){_0x56610b=_0x56610b-0x0;var _0xa2eb4=_0xdc82[_0x56610b];return _0xa2eb4;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0x2dc8('0x0'))(_0x2dc8('0x1'));var rpc={'chatMessage':require(_0x2dc8('0x2')),'openchannelMessage':require(_0x2dc8('0x3')),'mailMessage':require(_0x2dc8('0x4')),'smsMessage':require(_0x2dc8('0x5')),'faxMessage':require('../../rpc/faxMessage')};exports[_0x2dc8('0x6')]=function(_0x561adb,_0x58a73c){return function(_0x53bea5){try{var _0x4056ec={'body':utils[_0x2dc8('0x7')](_0x58a73c[0x0],this),'ContactId':this[_0x2dc8('0x8')]['id']};if(this[_0x2dc8('0x9')]==='chat'){_0x4056ec[_0x2dc8('0xa')]=this[_0x2dc8('0xb')]['id'];}else{_0x4056ec[_[_0x2dc8('0xc')](this[_0x2dc8('0x9')])+_0x2dc8('0xd')]=this[_0x2dc8('0xb')]['id'];}_0x4056ec[_[_0x2dc8('0xc')](this[_0x2dc8('0x9')])+_0x2dc8('0xe')]=this[_0x2dc8('0xf')]['id'];if(rpc[this[_0x2dc8('0x9')]+_0x2dc8('0x10')]){return rpc[this[_0x2dc8('0x9')]+_0x2dc8('0x10')][_0x2dc8('0x11')](_0x4056ec)[_0x2dc8('0x12')](function(_0x1626fc){logger[_0x2dc8('0x13')]('[%s][MESSAGE]\x20%s',_0x561adb,_0x4056ec[_0x2dc8('0x14')]);_0x53bea5[_0x2dc8('0x15')]();})[_0x2dc8('0x16')](function(_0x3af8dc){logger[_0x2dc8('0x17')](_0x2dc8('0x18'),_0x561adb,JSON['stringify'](_0x3af8dc));_0x53bea5['stop']();});}}catch(_0x4c69a7){logger[_0x2dc8('0x17')](_0x2dc8('0x18'),_0x561adb,JSON[_0x2dc8('0x19')](_0x4c69a7));_0x53bea5['stop']();}};};
\ No newline at end of file
index 990579d..75e630f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbba0=['stringify','stop','./utils','../../../../config/logger','info','[%s][NOOP]\x20%s','error'];(function(_0x3f2cff,_0x161414){var _0x384ed7=function(_0x39547d){while(--_0x39547d){_0x3f2cff['push'](_0x3f2cff['shift']());}};_0x384ed7(++_0x161414);}(_0xbba0,0x1c2));var _0x0bba=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xbba0[_0x45783c];return _0x1161da;};'use strict';var utils=require(_0x0bba('0x0'));var logger=require(_0x0bba('0x1'))('routing');exports['consequence']=function(_0x191ae6,_0x46a242){return function(_0x25e331){try{logger[_0x0bba('0x2')](_0x0bba('0x3'),_0x191ae6,utils['getMustacheRender'](_0x46a242[0x0],this));_0x25e331['next']();}catch(_0x3c4050){logger[_0x0bba('0x4')](_0x0bba('0x3'),_0x191ae6,JSON[_0x0bba('0x5')](_0x3c4050));_0x25e331[_0x0bba('0x6')]();}};};
\ No newline at end of file
+var _0x9988=['stop','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9988,0x1da));var _0x8998=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0x9988[_0x4ed4d2];return _0x15ae2e;};'use strict';var utils=require(_0x8998('0x0'));var logger=require(_0x8998('0x1'))(_0x8998('0x2'));exports[_0x8998('0x3')]=function(_0x40282d,_0x60009e){return function(_0x367b73){try{logger[_0x8998('0x4')](_0x8998('0x5'),_0x40282d,utils[_0x8998('0x6')](_0x60009e[0x0],this));_0x367b73[_0x8998('0x7')]();}catch(_0x199169){logger[_0x8998('0x8')](_0x8998('0x5'),_0x40282d,JSON[_0x8998('0x9')](_0x199169));_0x367b73[_0x8998('0xa')]();}};};
\ No newline at end of file
index f1de2f0..0251a4e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x613f=['[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','util','seq-queue','ioredis','../../../../config/environment','./strategy','redis','defaults','socket.io-emitter','queue_id','from','emit','queue','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','account','QueueReport','create','error','create\x20queue\x20report','accepted','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','catch','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','join','find','Queues','createQueue','atimeout','qtimeout','end','close','rules','stop','[%s][QUEUE]\x20ROUTING\x20END','next','strategy','rrmemory','beepall'];(function(_0x15cd3a,_0x575854){var _0x3c67a8=function(_0x361e5b){while(--_0x361e5b){_0x15cd3a['push'](_0x15cd3a['shift']());}};_0x3c67a8(++_0x575854);}(_0x613f,0xea));var _0xf613=function(_0x4ca1c2,_0xca5eb3){_0x4ca1c2=_0x4ca1c2-0x0;var _0x5628ff=_0x613f[_0x4ca1c2];return _0x5628ff;};'use strict';var schema=require(_0xf613('0x0'));var _=require('lodash');var util=require(_0xf613('0x1'));var seqqueue=require(_0xf613('0x2'));var moment=require('moment');var Redis=require(_0xf613('0x3'));var config=require(_0xf613('0x4'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0xf613('0x5'));config[_0xf613('0x6')]=_[_0xf613('0x7')](config[_0xf613('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xf613('0x8'))(new Redis(config[_0xf613('0x6')]));var attributes=['id',_0xf613('0x9'),'account','queue',_0xf613('0xa'),'joinAt'];function emit(_0x416b89,_0xfb796e,_0x1c25c7){io['to'](_0x416b89)[_0xf613('0xb')](_0xfb796e,_0x1c25c7);}function emitChannelQueueInteraction(_0x42b34d,_0x27013e,_0x209ecb,_0x417df4,_0x4860d5,_0x205449,_0xadee56,_0x2b2d4c){_0x209ecb['queue_id']=_0x2b2d4c;_0x209ecb[_0xf613('0xc')]=_0x27013e;_0x209ecb['account']=_0x417df4;_0x209ecb['id']=_0x4860d5;if(_0x205449){_0xadee56[util[_0xf613('0xd')](_0xf613('0xe'),_0x42b34d)][_0x4860d5]=_[_0xf613('0xf')](_0x209ecb,attributes);}else{delete _0xadee56[util[_0xf613('0xd')](_0xf613('0xe'),_0x42b34d)][_0x4860d5];}emit(util['format'](_0xf613('0x10'),_0x42b34d,_0x27013e),util[_0xf613('0xd')](_0xf613('0x11'),_0x42b34d,_0x205449?_0xf613('0x12'):_0xf613('0x13')),_[_0xf613('0xf')](_0x209ecb,attributes));}var rpc={'openchannelQueueReport':require(_0xf613('0x14')),'mailQueueReport':require(_0xf613('0x15')),'chatQueueReport':require(_0xf613('0x16')),'smsQueueReport':require(_0xf613('0x17')),'faxQueueReport':require(_0xf613('0x18'))};var queue=schema({'name':{'type':_0xf613('0x19'),'required':!![],'message':_0xf613('0x1a')},'timeout':{'type':'number','message':_0xf613('0x1b')}});function startRouting(_0x28aa6b,_0x127ccd,_0x3c5754,_0x27e273){if(_0x28aa6b&&_0x127ccd&&_0x3c5754){_0x127ccd[_0xf613('0x1c')]+=0x1;var _0x57d19e={'uniqueid':_0x28aa6b,'from':_0x3c5754[_0xf613('0x1d')]?_0x3c5754[_0xf613('0x1d')][_0xf613('0xa')]:'','joinAt':moment()[_0xf613('0xd')](_0xf613('0x1e')),'ContactId':_0x3c5754[_0xf613('0x1f')]?_0x3c5754[_0xf613('0x1f')]['id']:null,'ListId':_0x3c5754[_0xf613('0x20')]?_0x3c5754[_0xf613('0x20')]['id']:null};_0x57d19e[_[_0xf613('0x21')](_0x3c5754['channel'])+'QueueId']=_0x127ccd['id']||null;_0x57d19e[_[_0xf613('0x21')](_0x3c5754[_0xf613('0x22')])+'InteractionId']=_0x3c5754[_0xf613('0x23')]?_0x3c5754[_0xf613('0x23')]['id']:null;_0x57d19e[_['upperFirst'](_0x3c5754['channel'])+_0xf613('0x24')]=_0x3c5754[_0xf613('0x25')]?_0x3c5754[_0xf613('0x25')]['id']:null;_0x57d19e[_[_0xf613('0x21')](_0x3c5754[_0xf613('0x22')])+(_0x3c5754['channel']!==_0xf613('0x26')?_0xf613('0x27'):_0xf613('0x28'))]=_0x3c5754['account']?_0x3c5754['account']['id']:null;logger[_0xf613('0x29')](util['format'](_0xf613('0x2a'),_0x28aa6b,_0x127ccd[_0xf613('0x2b')]));emitChannelQueueInteraction(_0x3c5754['channel'],_0x127ccd[_0xf613('0x2b')],_0x57d19e,_0x3c5754[_0xf613('0x2c')][_0xf613('0x2b')],_0x3c5754[_0xf613('0x25')]['id'],!![],_0x27e273,_0x127ccd['id']);if(rpc[_0x3c5754[_0xf613('0x22')]+_0xf613('0x2d')]){return rpc[_0x3c5754[_0xf613('0x22')]+_0xf613('0x2d')][_0xf613('0x2e')](_0x57d19e)['catch'](function(_0x41260b){logger[_0xf613('0x2f')](_0xf613('0x30'));});}}}function stopRouting(_0x2aca76,_0xf4eb25,_0x43e772,_0x4d9cf1){if(_0x2aca76&&_0xf4eb25){_0xf4eb25[_0xf613('0x1c')]-=0x1;var _0x42d0f5={'leaveAt':moment()[_0xf613('0xd')](_0xf613('0x1e')),'acceptAt':moment()['format'](_0xf613('0x1e')),'reason':_0xf613('0x31')};logger[_0xf613('0x29')](util[_0xf613('0xd')]('[%s][STOP:QUEUE][NAME:%s]',_0x2aca76,_0xf4eb25[_0xf613('0x2b')]));emitChannelQueueInteraction(_0x43e772['channel'],_0xf4eb25[_0xf613('0x2b')],_0x43e772[_0xf613('0x1d')],_0x43e772['account'][_0xf613('0x2b')],_0x43e772[_0xf613('0x25')]['id'],![],_0x4d9cf1,_0xf4eb25['id']);if(rpc[_0x43e772[_0xf613('0x22')]+'QueueReport']){return rpc[_0x43e772[_0xf613('0x22')]+'QueueReport'][_0xf613('0x32')](_0x2aca76,_0x42d0f5)['catch'](function(_0x3661b2){logger[_0xf613('0x2f')](_0xf613('0x33'));});}}}function endRouting(_0x2ff434,_0x231a3d,_0x33859c,_0x38afcf){if(_0x2ff434&&_0x231a3d){_0x231a3d[_0xf613('0x1c')]-=0x1;var _0x5741d2={'leaveAt':moment()[_0xf613('0xd')](_0xf613('0x1e')),'exitAt':moment()[_0xf613('0xd')](_0xf613('0x1e')),'reason':_0xf613('0x34')};logger[_0xf613('0x29')](util[_0xf613('0xd')](_0xf613('0x35'),_0x2ff434,_0x231a3d[_0xf613('0x2b')]));emitChannelQueueInteraction(_0x33859c['channel'],_0x231a3d['name'],_0x33859c[_0xf613('0x1d')],_0x33859c['account'][_0xf613('0x2b')],_0x33859c[_0xf613('0x25')]['id'],![],_0x38afcf);if(rpc[_0x33859c[_0xf613('0x22')]+_0xf613('0x2d')]){return rpc[_0x33859c[_0xf613('0x22')]+_0xf613('0x2d')][_0xf613('0x32')](_0x2ff434,_0x5741d2)[_0xf613('0x36')](function(_0x34b521){logger[_0xf613('0x2f')](_0xf613('0x33'));});}}}function handleFindQueue(_0x348434){return function(_0x2dfe16){return _0x2dfe16[_0xf613('0x2b')][_0xf613('0x37')]()===_0x348434[_0xf613('0x37')]();};}exports[_0xf613('0x38')]=function(_0x155053,_0x2292f0,_0x3c151b,_0x1d06cb){return function(_0x162fe6){try{var _0x1f442c={'name':_0x2292f0[0x0],'timeout':_0x2292f0[0x1]};var _0x12f25a=queue[_0xf613('0x0')](_0x1f442c,{'typecast':!![]});if(_0x12f25a['length']){logger[_0xf613('0x2f')](_0xf613('0x39'),_0x155053,_[_0xf613('0x3a')](_0x12f25a,'message')[_0xf613('0x3b')](',\x20'));_0x162fe6['stop']();}else{var _0x5324ad=_[_0xf613('0x3c')](_0x3c151b[_0x1d06cb[_0xf613('0x22')]+_0xf613('0x3d')],handleFindQueue(_0x1f442c[_0xf613('0x2b')]));if(_0x5324ad){startRouting(_0x155053,_0x5324ad,_0x1d06cb,_0x3c151b);var _0x2e639f=(_0x5324ad[_0xf613('0x34')]||0xa)*0x3e8;var _0x30e6a8=(_0x1f442c[_0xf613('0x34')]||0x14)*0x3e8;var _0x38d5ef,_0xa1d661;if(_0x2e639f>_0x30e6a8){_0x30e6a8=_0x2e639f;}var _0x5e12a9=seqqueue[_0xf613('0x3e')](_0x2e639f);_0x5e12a9['id']=_0x155053;_0x5e12a9[_0xf613('0x3f')]=_0x2e639f;_0x5e12a9[_0xf613('0x40')]=_0x30e6a8;_0x5e12a9[_0xf613('0x22')]=_0x1d06cb['channel'];_0x3c151b['rules'][_0x155053]['on'](_0xf613('0x41'),function(){stopRouting(_0x155053,_0x5324ad,_0x1d06cb,_0x3c151b);_0x5e12a9[_0xf613('0x42')](!![]);clearTimeout(_0x38d5ef);_0x38d5ef=undefined;if(_0x3c151b[_0xf613('0x43')][_0x155053]){delete _0x3c151b[_0xf613('0x43')][_0x155053];}logger[_0xf613('0x29')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x155053);_0x162fe6[_0xf613('0x44')]();});_0x38d5ef=setTimeout(function(){endRouting(_0x155053,_0x5324ad,_0x1d06cb,_0x3c151b);clearTimeout(_0x38d5ef);_0x5e12a9[_0xf613('0x42')](!![]);logger[_0xf613('0x29')](_0xf613('0x45'),_0x155053);_0x162fe6[_0xf613('0x46')]();},_0x30e6a8);switch(_0x5324ad[_0xf613('0x47')]){case _0xf613('0x48'):strategy[_0xf613('0x48')](_0x5e12a9,_0x5324ad,_0x3c151b,_0x1d06cb);break;default:strategy[_0xf613('0x49')](_0x5e12a9,_0x5324ad,_0x3c151b,_0x1d06cb);}}else{logger[_0xf613('0x2f')](_0xf613('0x4a'),_0x155053,_0x1f442c[_0xf613('0x2b')]);_0x162fe6[_0xf613('0x44')]();}}}catch(_0x1820c9){console[_0xf613('0x4b')](_0x1820c9);logger[_0xf613('0x2f')]('[%s][QUEUE]\x20%s',_0x155053,_0x1820c9[_0xf613('0x4c')]);_0x162fe6[_0xf613('0x44')]();}};};
\ No newline at end of file
+var _0x1552=['length','[%s][QUEUE]\x20%s','map','stop','find','Queues','timeout','createQueue','atimeout','qtimeout','rules','end','close','[%s][QUEUE]\x20ROUTING\x20STOPPED','[%s][QUEUE]\x20ROUTING\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','account','queue','from','joinAt','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','message','chat','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence'];(function(_0x4b0e8c,_0xefd087){var _0x413e93=function(_0x490be1){while(--_0x490be1){_0x4b0e8c['push'](_0x4b0e8c['shift']());}};_0x413e93(++_0xefd087);}(_0x1552,0x1e4));var _0x2155=function(_0xce4604,_0x5e98ad){_0xce4604=_0xce4604-0x0;var _0x474352=_0x1552[_0xce4604];return _0x474352;};'use strict';var schema=require(_0x2155('0x0'));var _=require('lodash');var util=require(_0x2155('0x1'));var seqqueue=require(_0x2155('0x2'));var moment=require(_0x2155('0x3'));var Redis=require(_0x2155('0x4'));var config=require(_0x2155('0x5'));var logger=require(_0x2155('0x6'))(_0x2155('0x7'));var strategy=require(_0x2155('0x8'));config[_0x2155('0x9')]=_[_0x2155('0xa')](config[_0x2155('0x9')],{'host':_0x2155('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2155('0x9')]));var attributes=['id',_0x2155('0xc'),_0x2155('0xd'),_0x2155('0xe'),_0x2155('0xf'),_0x2155('0x10')];function emit(_0x46682b,_0x1a3162,_0x273aec){io['to'](_0x46682b)['emit'](_0x1a3162,_0x273aec);}function emitChannelQueueInteraction(_0x131b5c,_0x47dba3,_0x40af0c,_0x55f5df,_0x33862a,_0x3f76f5,_0x434724,_0x5450d0){_0x40af0c[_0x2155('0xc')]=_0x5450d0;_0x40af0c[_0x2155('0xe')]=_0x47dba3;_0x40af0c[_0x2155('0xd')]=_0x55f5df;_0x40af0c['id']=_0x33862a;if(_0x3f76f5){_0x434724[util['format'](_0x2155('0x11'),_0x131b5c)][_0x33862a]=_[_0x2155('0x12')](_0x40af0c,attributes);}else{delete _0x434724[util[_0x2155('0x13')](_0x2155('0x11'),_0x131b5c)][_0x33862a];}emit(util[_0x2155('0x13')](_0x2155('0x14'),_0x131b5c,_0x47dba3),util[_0x2155('0x13')](_0x2155('0x15'),_0x131b5c,_0x3f76f5?'save':'remove'),_['pick'](_0x40af0c,attributes));}var rpc={'openchannelQueueReport':require(_0x2155('0x16')),'mailQueueReport':require(_0x2155('0x17')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x2155('0x18')),'faxQueueReport':require(_0x2155('0x19'))};var queue=schema({'name':{'type':_0x2155('0x1a'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x2155('0x1b'),'message':_0x2155('0x1c')}});function startRouting(_0x15efef,_0x2690c7,_0x278c64,_0x2d326b){if(_0x15efef&&_0x2690c7&&_0x278c64){_0x2690c7[_0x2155('0x1d')]+=0x1;var _0x1f1387={'uniqueid':_0x15efef,'from':_0x278c64[_0x2155('0x1e')]?_0x278c64['body'][_0x2155('0xf')]:'','joinAt':moment()[_0x2155('0x13')](_0x2155('0x1f')),'ContactId':_0x278c64['contact']?_0x278c64[_0x2155('0x20')]['id']:null,'ListId':_0x278c64['list']?_0x278c64[_0x2155('0x21')]['id']:null};_0x1f1387[_[_0x2155('0x22')](_0x278c64[_0x2155('0x23')])+_0x2155('0x24')]=_0x2690c7['id']||null;_0x1f1387[_[_0x2155('0x22')](_0x278c64[_0x2155('0x23')])+_0x2155('0x25')]=_0x278c64[_0x2155('0x26')]?_0x278c64[_0x2155('0x26')]['id']:null;_0x1f1387[_[_0x2155('0x22')](_0x278c64[_0x2155('0x23')])+'MessageId']=_0x278c64[_0x2155('0x27')]?_0x278c64[_0x2155('0x27')]['id']:null;_0x1f1387[_[_0x2155('0x22')](_0x278c64['channel'])+(_0x278c64[_0x2155('0x23')]!==_0x2155('0x28')?'AccountId':'WebsiteId')]=_0x278c64[_0x2155('0xd')]?_0x278c64[_0x2155('0xd')]['id']:null;logger[_0x2155('0x29')](util[_0x2155('0x13')](_0x2155('0x2a'),_0x15efef,_0x2690c7[_0x2155('0x2b')]));emitChannelQueueInteraction(_0x278c64[_0x2155('0x23')],_0x2690c7['name'],_0x1f1387,_0x278c64[_0x2155('0xd')]['name'],_0x278c64[_0x2155('0x27')]['id'],!![],_0x2d326b,_0x2690c7['id']);if(rpc[_0x278c64[_0x2155('0x23')]+_0x2155('0x2c')]){return rpc[_0x278c64[_0x2155('0x23')]+'QueueReport']['create'](_0x1f1387)[_0x2155('0x2d')](function(_0x2ca504){logger[_0x2155('0x2e')](_0x2155('0x2f'));});}}}function stopRouting(_0x22522e,_0x3a1248,_0x41fe92,_0x48ac99){if(_0x22522e&&_0x3a1248){_0x3a1248['waiting']-=0x1;var _0x1038a7={'leaveAt':moment()[_0x2155('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()['format'](_0x2155('0x1f')),'reason':_0x2155('0x30')};logger[_0x2155('0x29')](util[_0x2155('0x13')](_0x2155('0x31'),_0x22522e,_0x3a1248[_0x2155('0x2b')]));emitChannelQueueInteraction(_0x41fe92[_0x2155('0x23')],_0x3a1248[_0x2155('0x2b')],_0x41fe92['body'],_0x41fe92['account'][_0x2155('0x2b')],_0x41fe92['message']['id'],![],_0x48ac99,_0x3a1248['id']);if(rpc[_0x41fe92[_0x2155('0x23')]+_0x2155('0x2c')]){return rpc[_0x41fe92[_0x2155('0x23')]+'QueueReport'][_0x2155('0x32')](_0x22522e,_0x1038a7)['catch'](function(_0x5c1ffd){logger['error'](_0x2155('0x33'));});}}}function endRouting(_0x4d7046,_0x137134,_0xeae2c4,_0xa698a8){if(_0x4d7046&&_0x137134){_0x137134[_0x2155('0x1d')]-=0x1;var _0x2d15d9={'leaveAt':moment()[_0x2155('0x13')](_0x2155('0x1f')),'exitAt':moment()[_0x2155('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger[_0x2155('0x29')](util[_0x2155('0x13')](_0x2155('0x34'),_0x4d7046,_0x137134[_0x2155('0x2b')]));emitChannelQueueInteraction(_0xeae2c4[_0x2155('0x23')],_0x137134[_0x2155('0x2b')],_0xeae2c4[_0x2155('0x1e')],_0xeae2c4[_0x2155('0xd')]['name'],_0xeae2c4[_0x2155('0x27')]['id'],![],_0xa698a8);if(rpc[_0xeae2c4[_0x2155('0x23')]+_0x2155('0x2c')]){return rpc[_0xeae2c4[_0x2155('0x23')]+_0x2155('0x2c')][_0x2155('0x32')](_0x4d7046,_0x2d15d9)[_0x2155('0x2d')](function(_0x3ae568){logger[_0x2155('0x2e')](_0x2155('0x33'));});}}}function handleFindQueue(_0x4fc57a){return function(_0x990b9){return _0x990b9[_0x2155('0x2b')][_0x2155('0x35')]()===_0x4fc57a[_0x2155('0x35')]();};}exports[_0x2155('0x36')]=function(_0x1b9a08,_0x191ff4,_0x2b9f29,_0x4891af){return function(_0x6d8de2){try{var _0x10c6a3={'name':_0x191ff4[0x0],'timeout':_0x191ff4[0x1]};var _0x10b7cf=queue[_0x2155('0x0')](_0x10c6a3,{'typecast':!![]});if(_0x10b7cf[_0x2155('0x37')]){logger['error'](_0x2155('0x38'),_0x1b9a08,_[_0x2155('0x39')](_0x10b7cf,_0x2155('0x27'))['join'](',\x20'));_0x6d8de2[_0x2155('0x3a')]();}else{var _0x1ea9c3=_[_0x2155('0x3b')](_0x2b9f29[_0x4891af[_0x2155('0x23')]+_0x2155('0x3c')],handleFindQueue(_0x10c6a3['name']));if(_0x1ea9c3){startRouting(_0x1b9a08,_0x1ea9c3,_0x4891af,_0x2b9f29);var _0x519782=(_0x1ea9c3[_0x2155('0x3d')]||0xa)*0x3e8;var _0x506410=(_0x10c6a3['timeout']||0x14)*0x3e8;var _0x3c0acc,_0x417ce0;if(_0x519782>_0x506410){_0x506410=_0x519782;}var _0x3ed729=seqqueue[_0x2155('0x3e')](_0x519782);_0x3ed729['id']=_0x1b9a08;_0x3ed729[_0x2155('0x3f')]=_0x519782;_0x3ed729[_0x2155('0x40')]=_0x506410;_0x3ed729[_0x2155('0x23')]=_0x4891af[_0x2155('0x23')];_0x2b9f29[_0x2155('0x41')][_0x1b9a08]['on'](_0x2155('0x42'),function(){stopRouting(_0x1b9a08,_0x1ea9c3,_0x4891af,_0x2b9f29);_0x3ed729[_0x2155('0x43')](!![]);clearTimeout(_0x3c0acc);_0x3c0acc=undefined;if(_0x2b9f29[_0x2155('0x41')][_0x1b9a08]){delete _0x2b9f29[_0x2155('0x41')][_0x1b9a08];}logger['info'](_0x2155('0x44'),_0x1b9a08);_0x6d8de2[_0x2155('0x3a')]();});_0x3c0acc=setTimeout(function(){endRouting(_0x1b9a08,_0x1ea9c3,_0x4891af,_0x2b9f29);clearTimeout(_0x3c0acc);_0x3ed729[_0x2155('0x43')](!![]);logger[_0x2155('0x29')](_0x2155('0x45'),_0x1b9a08);_0x6d8de2[_0x2155('0x46')]();},_0x506410);switch(_0x1ea9c3[_0x2155('0x47')]){case _0x2155('0x48'):strategy[_0x2155('0x48')](_0x3ed729,_0x1ea9c3,_0x2b9f29,_0x4891af);break;default:strategy[_0x2155('0x49')](_0x3ed729,_0x1ea9c3,_0x2b9f29,_0x4891af);}}else{logger[_0x2155('0x2e')](_0x2155('0x4a'),_0x1b9a08,_0x10c6a3[_0x2155('0x2b')]);_0x6d8de2['stop']();}}}catch(_0x150f88){console[_0x2155('0x4b')](_0x150f88);logger[_0x2155('0x2e')](_0x2155('0x38'),_0x1b9a08,_0x150f88[_0x2155('0x4c')]);_0x6d8de2[_0x2155('0x3a')]();}};};
\ No newline at end of file
index 7de8cf1..ff428fb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdce7=['agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','busy','busyQueue','showNotification','notificationId','writeLog','RINGING',':FORCED','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','routing','squeue','agent','realtime','handleRun','bind','timeout','handleTimeout','handleDrained','push','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil'];(function(_0x2341c6,_0x3af092){var _0x54c34d=function(_0x3091f9){while(--_0x3091f9){_0x2341c6['push'](_0x2341c6['shift']());}};_0x54c34d(++_0x3af092);}(_0xdce7,0x1ef));var _0x7dce=function(_0x18fec8,_0x31d0cd){_0x18fec8=_0x18fec8-0x0;var _0x5e400c=_0xdce7[_0x18fec8];return _0x5e400c;};'use strict';var _=require(_0x7dce('0x0'));var uuid=require(_0x7dce('0x1'));var util=require(_0x7dce('0x2'));var logger=require('../../../../../config/logger')(_0x7dce('0x3'));var Agent=function(_0x494a84,_0x1a2be1,_0x28f47f,_0x27d439){this['notificationId']=uuid['v4']();this[_0x7dce('0x4')]=_0x494a84;this[_0x7dce('0x5')]=_0x1a2be1;this[_0x7dce('0x6')]=_0x28f47f;this['routing']=_0x27d439;this[_0x7dce('0x4')]['push'](this[_0x7dce('0x7')][_0x7dce('0x8')](this),this['handleTimeout'][_0x7dce('0x8')](this));this['squeue']['on'](_0x7dce('0x9'),this[_0x7dce('0xa')]['bind'](this));this[_0x7dce('0x4')]['on']('drained',this[_0x7dce('0xb')]['bind'](this));};Agent['prototype']['push']=function(){this[_0x7dce('0x4')][_0x7dce('0xc')](this[_0x7dce('0x7')]['bind'](this),this[_0x7dce('0xa')][_0x7dce('0x8')](this));};Agent[_0x7dce('0xd')]['handleDrained']=function(){this[_0x7dce('0xa')](!![]);};Agent['prototype'][_0x7dce('0x7')]=function(_0x235666){logger[_0x7dce('0xe')](_0x7dce('0xf'),this['squeue']['id'],this[_0x7dce('0x5')]['id']);if(_[_0x7dce('0x10')](this[_0x7dce('0x6')][_0x7dce('0x11')][this['agent']['id']])){logger[_0x7dce('0xe')](_0x7dce('0x12'),this[_0x7dce('0x4')]['id'],this['agent']['id']);setTimeout(this[_0x7dce('0xc')]['bind'](this),0x3e8);}else{if(this['routing'][_0x7dce('0x13')]||util[_0x7dce('0x14')](this[_0x7dce('0x4')]['id'],this['realtime']['agents'][this['agent']['id']],this[_0x7dce('0x4')]['channel'],![])){this[_0x7dce('0x6')]['agents'][this[_0x7dce('0x5')]['id']][_0x7dce('0x15')]=!![];this['realtime'][_0x7dce('0x11')][this['agent']['id']][_0x7dce('0x16')]=undefined;util[_0x7dce('0x17')](this[_0x7dce('0x18')],this[_0x7dce('0x4')]['id'],this['realtime']['agents'][this[_0x7dce('0x5')]['id']],null,this['routing']);util[_0x7dce('0x19')](this[_0x7dce('0x4')]['id'],this['realtime'][_0x7dce('0x11')][this[_0x7dce('0x5')]['id']],_0x7dce('0x1a')+(this['routing'][_0x7dce('0x13')]?_0x7dce('0x1b'):''));}else{logger[_0x7dce('0xe')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this['agent']['id']);setTimeout(this['push'][_0x7dce('0x8')](this),0x3e8);}}};Agent[_0x7dce('0xd')][_0x7dce('0xa')]=function(_0x3dbc07){if(_[_0x7dce('0x10')](this['realtime'][_0x7dce('0x11')][this[_0x7dce('0x5')]['id']])){return logger[_0x7dce('0xe')](_0x7dce('0x12'),this[_0x7dce('0x4')]['id'],this[_0x7dce('0x5')]['id']);}else{logger[_0x7dce('0xe')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x7dce('0x4')]['id'],this['agent']['id']);util[_0x7dce('0x1c')](this[_0x7dce('0x18')],this[_0x7dce('0x4')]['id'],this[_0x7dce('0x6')]['agents'][this[_0x7dce('0x5')]['id']],null,this[_0x7dce('0x3')]);this['realtime'][_0x7dce('0x11')][this[_0x7dce('0x5')]['id']][_0x7dce('0x15')]=![];this[_0x7dce('0x6')][_0x7dce('0x11')][this[_0x7dce('0x5')]['id']][_0x7dce('0x16')]=undefined;util[_0x7dce('0x19')](this[_0x7dce('0x4')]['id'],this[_0x7dce('0x6')][_0x7dce('0x11')][this[_0x7dce('0x5')]['id']],_0x3dbc07?_0x7dce('0x1d'):_0x7dce('0x1e'));}if(!_0x3dbc07){setTimeout(this['push'][_0x7dce('0x8')](this),0x3e8);}};function agent(_0x37c3f8,_0x5ea55e,_0x4700a7,_0x49c506){return new Agent(_0x37c3f8,_0x5ea55e,_0x4700a7,_0x49c506);}module[_0x7dce('0x1f')]=agent;
\ No newline at end of file
+var _0x2784=['[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','busyQueue','TIMEOUT','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available'];(function(_0x8a7ce1,_0x547b6e){var _0x157778=function(_0x3b3bbf){while(--_0x3b3bbf){_0x8a7ce1['push'](_0x8a7ce1['shift']());}};_0x157778(++_0x547b6e);}(_0x2784,0xde));var _0x4278=function(_0x35b803,_0x42b7bf){_0x35b803=_0x35b803-0x0;var _0x11378d=_0x2784[_0x35b803];return _0x11378d;};'use strict';var _=require(_0x4278('0x0'));var uuid=require('uuid');var util=require(_0x4278('0x1'));var logger=require(_0x4278('0x2'))(_0x4278('0x3'));var Agent=function(_0x24878d,_0x3f78bf,_0x5ac40b,_0x3adc4d){this[_0x4278('0x4')]=uuid['v4']();this[_0x4278('0x5')]=_0x24878d;this[_0x4278('0x6')]=_0x3f78bf;this[_0x4278('0x7')]=_0x5ac40b;this['routing']=_0x3adc4d;this[_0x4278('0x5')][_0x4278('0x8')](this[_0x4278('0x9')][_0x4278('0xa')](this),this[_0x4278('0xb')][_0x4278('0xa')](this));this[_0x4278('0x5')]['on']('timeout',this[_0x4278('0xb')][_0x4278('0xa')](this));this[_0x4278('0x5')]['on']('drained',this[_0x4278('0xc')][_0x4278('0xa')](this));};Agent[_0x4278('0xd')][_0x4278('0x8')]=function(){this[_0x4278('0x5')]['push'](this[_0x4278('0x9')][_0x4278('0xa')](this),this[_0x4278('0xb')][_0x4278('0xa')](this));};Agent[_0x4278('0xd')][_0x4278('0xc')]=function(){this['handleTimeout'](!![]);};Agent[_0x4278('0xd')]['handleRun']=function(_0x453d60){logger[_0x4278('0xe')](_0x4278('0xf'),this['squeue']['id'],this['agent']['id']);if(_[_0x4278('0x10')](this[_0x4278('0x7')][_0x4278('0x11')][this[_0x4278('0x6')]['id']])){logger[_0x4278('0xe')](_0x4278('0x12'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x4278('0x8')][_0x4278('0xa')](this),0x3e8);}else{if(this[_0x4278('0x3')][_0x4278('0x13')]||util[_0x4278('0x14')](this[_0x4278('0x5')]['id'],this[_0x4278('0x7')][_0x4278('0x11')][this[_0x4278('0x6')]['id']],this[_0x4278('0x5')][_0x4278('0x15')],![])){this[_0x4278('0x7')][_0x4278('0x11')][this[_0x4278('0x6')]['id']]['busy']=!![];this[_0x4278('0x7')]['agents'][this[_0x4278('0x6')]['id']]['busyQueue']=undefined;util['showNotification'](this[_0x4278('0x4')],this[_0x4278('0x5')]['id'],this[_0x4278('0x7')][_0x4278('0x11')][this[_0x4278('0x6')]['id']],null,this[_0x4278('0x3')]);util[_0x4278('0x16')](this[_0x4278('0x5')]['id'],this[_0x4278('0x7')][_0x4278('0x11')][this['agent']['id']],_0x4278('0x17')+(this[_0x4278('0x3')][_0x4278('0x13')]?_0x4278('0x18'):''));}else{logger['info'](_0x4278('0x19'),this['squeue']['id'],this[_0x4278('0x6')]['id']);setTimeout(this['push'][_0x4278('0xa')](this),0x3e8);}}};Agent[_0x4278('0xd')]['handleTimeout']=function(_0x3dceb2){if(_[_0x4278('0x10')](this[_0x4278('0x7')][_0x4278('0x11')][this['agent']['id']])){return logger[_0x4278('0xe')](_0x4278('0x12'),this[_0x4278('0x5')]['id'],this[_0x4278('0x6')]['id']);}else{logger[_0x4278('0xe')](_0x4278('0x1a'),this[_0x4278('0x5')]['id'],this[_0x4278('0x6')]['id']);util[_0x4278('0x1b')](this[_0x4278('0x4')],this[_0x4278('0x5')]['id'],this[_0x4278('0x7')][_0x4278('0x11')][this[_0x4278('0x6')]['id']],null,this[_0x4278('0x3')]);this[_0x4278('0x7')]['agents'][this['agent']['id']][_0x4278('0x1c')]=![];this[_0x4278('0x7')][_0x4278('0x11')][this[_0x4278('0x6')]['id']][_0x4278('0x1d')]=undefined;util[_0x4278('0x16')](this[_0x4278('0x5')]['id'],this[_0x4278('0x7')]['agents'][this[_0x4278('0x6')]['id']],_0x3dceb2?'STOP':_0x4278('0x1e'));}if(!_0x3dceb2){setTimeout(this[_0x4278('0x8')]['bind'](this),0x3e8);}};function agent(_0x507572,_0x30bc37,_0x1f7000,_0x4811aa){return new Agent(_0x507572,_0x30bc37,_0x1f7000,_0x4811aa);}module['exports']=agent;
\ No newline at end of file
index 37201da..d5077cb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4b4c=['notificationId','squeue','queue','realtime','routing','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','isNil','Agents','length','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents','channel','writeLog','RINGING','busy','busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','exports','lodash','../../../../../config/logger'];(function(_0x186520,_0x1d0ced){var _0x56c3c2=function(_0xd46452){while(--_0xd46452){_0x186520['push'](_0x186520['shift']());}};_0x56c3c2(++_0x1d0ced);}(_0x4b4c,0x1c0));var _0xc4b4=function(_0x4cc630,_0x46f9ef){_0x4cc630=_0x4cc630-0x0;var _0x1a26e9=_0x4b4c[_0x4cc630];return _0x1a26e9;};'use strict';var _=require(_0xc4b4('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require(_0xc4b4('0x1'))('routing');var Beepall=function(_0x2cd69a,_0x3676ca,_0x20334b,_0xc78377){this[_0xc4b4('0x2')]=uuid['v4']();this[_0xc4b4('0x3')]=_0x2cd69a;this[_0xc4b4('0x4')]=_0x3676ca;this[_0xc4b4('0x5')]=_0x20334b;this[_0xc4b4('0x6')]=_0xc78377;this[_0xc4b4('0x3')][_0xc4b4('0x7')](this[_0xc4b4('0x8')][_0xc4b4('0x9')](this),this[_0xc4b4('0xa')][_0xc4b4('0x9')](this));this['squeue']['on']('timeout',this[_0xc4b4('0xa')]['bind'](this));this[_0xc4b4('0x3')]['on'](_0xc4b4('0xb'),this[_0xc4b4('0xc')][_0xc4b4('0x9')](this));};Beepall[_0xc4b4('0xd')][_0xc4b4('0x7')]=function(){this['squeue'][_0xc4b4('0x7')](this['handleRun'][_0xc4b4('0x9')](this),this[_0xc4b4('0xa')][_0xc4b4('0x9')](this));};Beepall['prototype'][_0xc4b4('0xc')]=function(_0x4fbeea){this[_0xc4b4('0xa')](!![]);};Beepall[_0xc4b4('0xd')][_0xc4b4('0x8')]=function(_0x5f376d){var _0x13ae3a=!![];if(!_[_0xc4b4('0xe')](this[_0xc4b4('0x4')])&&!_[_0xc4b4('0xe')](this[_0xc4b4('0x4')]['Agents'])&&this['queue'][_0xc4b4('0xf')][_0xc4b4('0x10')]>0x0){for(var _0x1bcddc=0x0,_0x49729d;_0x1bcddc<this[_0xc4b4('0x4')]['Agents'][_0xc4b4('0x10')];_0x1bcddc+=0x1){_0x49729d=this[_0xc4b4('0x4')]['Agents'][_0x1bcddc]['id'];if(_[_0xc4b4('0xe')](this[_0xc4b4('0x5')]['agents'][_0x49729d])){logger[_0xc4b4('0x11')](_0xc4b4('0x12'),this[_0xc4b4('0x3')]['id'],_0x49729d);}else{if(util[_0xc4b4('0x13')](this['squeue']['id'],this[_0xc4b4('0x5')][_0xc4b4('0x14')][_0x49729d],this[_0xc4b4('0x3')][_0xc4b4('0x15')],!![])){_0x13ae3a=![];util[_0xc4b4('0x16')](this[_0xc4b4('0x3')]['id'],this[_0xc4b4('0x5')][_0xc4b4('0x14')][_0x49729d],_0xc4b4('0x17'));this[_0xc4b4('0x5')]['agents'][_0x49729d][_0xc4b4('0x18')]=!![];this['realtime']['agents'][_0x49729d][_0xc4b4('0x19')]=this[_0xc4b4('0x4')][_0xc4b4('0x1a')];util[_0xc4b4('0x1b')](this[_0xc4b4('0x2')],this[_0xc4b4('0x3')]['id'],this[_0xc4b4('0x5')]['agents'][_0x49729d],this[_0xc4b4('0x4')],this[_0xc4b4('0x6')]);}}}if(_0x13ae3a){logger[_0xc4b4('0x11')](_0xc4b4('0x1c'),this[_0xc4b4('0x3')]['id']);setTimeout(this[_0xc4b4('0x7')][_0xc4b4('0x9')](this),0x3e8);}}else{logger[_0xc4b4('0x11')]('[%s][QUEUE]\x20EMPTY',this[_0xc4b4('0x3')]['id']);setTimeout(this[_0xc4b4('0x7')][_0xc4b4('0x9')](this),0x3e8);}};Beepall[_0xc4b4('0xd')][_0xc4b4('0xa')]=function(_0x2f38a0){if(!_[_0xc4b4('0xe')](this[_0xc4b4('0x4')])&&!_[_0xc4b4('0xe')](this[_0xc4b4('0x4')][_0xc4b4('0xf')])){for(var _0xc5dbdc=0x0,_0x254760;_0xc5dbdc<this[_0xc4b4('0x4')][_0xc4b4('0xf')][_0xc4b4('0x10')];_0xc5dbdc+=0x1){_0x254760=this[_0xc4b4('0x4')][_0xc4b4('0xf')][_0xc5dbdc]['id'];if(_[_0xc4b4('0xe')](this[_0xc4b4('0x5')]['agents'][_0x254760])){logger[_0xc4b4('0x11')](_0xc4b4('0x12'),this[_0xc4b4('0x3')]['id'],_0x254760);}else{util['hideNotification'](this[_0xc4b4('0x2')],this['squeue']['id'],this[_0xc4b4('0x5')][_0xc4b4('0x14')][_0x254760],this[_0xc4b4('0x4')],this[_0xc4b4('0x6')]);util[_0xc4b4('0x16')](this['squeue']['id'],this[_0xc4b4('0x5')][_0xc4b4('0x14')][_0x254760],_0x2f38a0?'STOP':'TIMEOUT');this[_0xc4b4('0x5')][_0xc4b4('0x14')][_0x254760][_0xc4b4('0x18')]=![];this['realtime']['agents'][_0x254760][_0xc4b4('0x19')]=undefined;}}}if(!_0x2f38a0){setTimeout(this[_0xc4b4('0x7')][_0xc4b4('0x9')](this),0x3e8);}};function beepall(_0x3f2a08,_0x2ef9cb,_0x2f0cc9,_0x2a817d){return new Beepall(_0x3f2a08,_0x2ef9cb,_0x2f0cc9,_0x2a817d);}module[_0xc4b4('0x1d')]=beepall;
\ No newline at end of file
+var _0x5506=['bind','handleTimeout','drained','handleDrained','isNil','queue','Agents','length','realtime','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents','channel','RINGING','busy','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','hideNotification','writeLog','exports','./util','routing','notificationId','squeue','push','handleRun'];(function(_0x5c0ff6,_0x22cdd2){var _0x1135cd=function(_0x55d5b0){while(--_0x55d5b0){_0x5c0ff6['push'](_0x5c0ff6['shift']());}};_0x1135cd(++_0x22cdd2);}(_0x5506,0xda));var _0x6550=function(_0x77b4c6,_0x1d3258){_0x77b4c6=_0x77b4c6-0x0;var _0x41e5ff=_0x5506[_0x77b4c6];return _0x41e5ff;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0x6550('0x0'));var logger=require('../../../../../config/logger')(_0x6550('0x1'));var Beepall=function(_0x1e397f,_0x580d83,_0x48d6ec,_0x595761){this[_0x6550('0x2')]=uuid['v4']();this[_0x6550('0x3')]=_0x1e397f;this['queue']=_0x580d83;this['realtime']=_0x48d6ec;this[_0x6550('0x1')]=_0x595761;this['squeue'][_0x6550('0x4')](this[_0x6550('0x5')][_0x6550('0x6')](this),this['handleTimeout'][_0x6550('0x6')](this));this[_0x6550('0x3')]['on']('timeout',this[_0x6550('0x7')]['bind'](this));this['squeue']['on'](_0x6550('0x8'),this[_0x6550('0x9')][_0x6550('0x6')](this));};Beepall['prototype'][_0x6550('0x4')]=function(){this['squeue']['push'](this[_0x6550('0x5')][_0x6550('0x6')](this),this[_0x6550('0x7')][_0x6550('0x6')](this));};Beepall['prototype'][_0x6550('0x9')]=function(_0x2f2743){this[_0x6550('0x7')](!![]);};Beepall['prototype'][_0x6550('0x5')]=function(_0xb3ca7e){var _0x292fb9=!![];if(!_[_0x6550('0xa')](this[_0x6550('0xb')])&&!_[_0x6550('0xa')](this[_0x6550('0xb')][_0x6550('0xc')])&&this[_0x6550('0xb')][_0x6550('0xc')][_0x6550('0xd')]>0x0){for(var _0x4322c2=0x0,_0x280484;_0x4322c2<this['queue'][_0x6550('0xc')][_0x6550('0xd')];_0x4322c2+=0x1){_0x280484=this[_0x6550('0xb')]['Agents'][_0x4322c2]['id'];if(_[_0x6550('0xa')](this[_0x6550('0xe')]['agents'][_0x280484])){logger[_0x6550('0xf')](_0x6550('0x10'),this['squeue']['id'],_0x280484);}else{if(util[_0x6550('0x11')](this[_0x6550('0x3')]['id'],this[_0x6550('0xe')][_0x6550('0x12')][_0x280484],this[_0x6550('0x3')][_0x6550('0x13')],!![])){_0x292fb9=![];util['writeLog'](this[_0x6550('0x3')]['id'],this['realtime'][_0x6550('0x12')][_0x280484],_0x6550('0x14'));this[_0x6550('0xe')][_0x6550('0x12')][_0x280484][_0x6550('0x15')]=!![];this['realtime']['agents'][_0x280484]['busyQueue']=this[_0x6550('0xb')][_0x6550('0x16')];util[_0x6550('0x17')](this[_0x6550('0x2')],this[_0x6550('0x3')]['id'],this[_0x6550('0xe')]['agents'][_0x280484],this[_0x6550('0xb')],this[_0x6550('0x1')]);}}}if(_0x292fb9){logger[_0x6550('0xf')](_0x6550('0x18'),this['squeue']['id']);setTimeout(this[_0x6550('0x4')][_0x6550('0x6')](this),0x3e8);}}else{logger[_0x6550('0xf')]('[%s][QUEUE]\x20EMPTY',this[_0x6550('0x3')]['id']);setTimeout(this[_0x6550('0x4')][_0x6550('0x6')](this),0x3e8);}};Beepall['prototype']['handleTimeout']=function(_0x450c15){if(!_['isNil'](this[_0x6550('0xb')])&&!_['isNil'](this[_0x6550('0xb')][_0x6550('0xc')])){for(var _0x441391=0x0,_0x1518bc;_0x441391<this[_0x6550('0xb')][_0x6550('0xc')][_0x6550('0xd')];_0x441391+=0x1){_0x1518bc=this['queue'][_0x6550('0xc')][_0x441391]['id'];if(_[_0x6550('0xa')](this[_0x6550('0xe')][_0x6550('0x12')][_0x1518bc])){logger[_0x6550('0xf')](_0x6550('0x10'),this[_0x6550('0x3')]['id'],_0x1518bc);}else{util[_0x6550('0x19')](this[_0x6550('0x2')],this['squeue']['id'],this['realtime'][_0x6550('0x12')][_0x1518bc],this[_0x6550('0xb')],this[_0x6550('0x1')]);util[_0x6550('0x1a')](this['squeue']['id'],this['realtime'][_0x6550('0x12')][_0x1518bc],_0x450c15?'STOP':'TIMEOUT');this['realtime'][_0x6550('0x12')][_0x1518bc][_0x6550('0x15')]=![];this[_0x6550('0xe')][_0x6550('0x12')][_0x1518bc]['busyQueue']=undefined;}}}if(!_0x450c15){setTimeout(this[_0x6550('0x4')][_0x6550('0x6')](this),0x3e8);}};function beepall(_0xa24949,_0x25416e,_0x16b901,_0x1a7df0){return new Beepall(_0xa24949,_0x25416e,_0x16b901,_0x1a7df0);}module[_0x6550('0x1b')]=beepall;
\ No newline at end of file
index 9037cb4..214e954 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0272=['./agent','exports','./rrmemory'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x0272,0x15a));var _0x2027=function(_0x2ab1ef,_0x4209e4){_0x2ab1ef=_0x2ab1ef-0x0;var _0x2a9bfb=_0x0272[_0x2ab1ef];return _0x2a9bfb;};'use strict';module[_0x2027('0x0')]={'rrmemory':require(_0x2027('0x1')),'beepall':require('./beepall'),'agent':require(_0x2027('0x2'))};
\ No newline at end of file
+var _0x746f=['exports','./rrmemory','./beepall','./agent'];(function(_0xdcbf75,_0x10e60d){var _0x483fac=function(_0x22bcf1){while(--_0x22bcf1){_0xdcbf75['push'](_0xdcbf75['shift']());}};_0x483fac(++_0x10e60d);}(_0x746f,0x9c));var _0xf746=function(_0x184efe,_0x22eeda){_0x184efe=_0x184efe-0x0;var _0x2ce594=_0x746f[_0x184efe];return _0x2ce594;};'use strict';module[_0xf746('0x0')]={'rrmemory':require(_0xf746('0x1')),'beepall':require(_0xf746('0x2')),'agent':require(_0xf746('0x3'))};
\ No newline at end of file
index a370da4..900fe4f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe26b=['[%s][QUEUE]\x20timeout\x20with\x20%s','isNil','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','queue','realtime','intervals','squeue','push','handleRun','handleTimeout','bind','module','drained','handleDrained','prototype','handleCheckReject','isAgentAvailable','agents','agentId','info','[%s][QUEUE]\x20available\x20again\x20%s','done','mapAgentsId','[%s][QUEUE]\x20try\x20with\x20%s','channel','busyQueue','showNotification','writeLog','RINGING'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xe26b,0x1b4));var _0xbe26=function(_0x441abc,_0x4287bc){_0x441abc=_0x441abc-0x0;var _0x52bf3a=_0xe26b[_0x441abc];return _0x52bf3a;};'use strict';var rr=require('rr');var _=require(_0xbe26('0x0'));var uuid=require(_0xbe26('0x1'));var util=require(_0xbe26('0x2'));var logger=require(_0xbe26('0x3'))(_0xbe26('0x4'));var RRMemory=function(_0x6378ed,_0x3fd3ca,_0xe65544,_0x4b57dc){this[_0xbe26('0x5')]=uuid['v4']();this['squeue']=_0x6378ed;this[_0xbe26('0x6')]=_0x3fd3ca;this[_0xbe26('0x7')]=_0xe65544;this[_0xbe26('0x4')]=_0x4b57dc;this[_0xbe26('0x8')]={};this[_0xbe26('0x9')][_0xbe26('0xa')](this[_0xbe26('0xb')]['bind'](this),this[_0xbe26('0xc')][_0xbe26('0xd')](this),this[_0xbe26('0xe')]);this[_0xbe26('0x9')]['on']('timeout',this[_0xbe26('0xc')][_0xbe26('0xd')](this));this['squeue']['on'](_0xbe26('0xf'),this[_0xbe26('0x10')][_0xbe26('0xd')](this));};RRMemory[_0xbe26('0x11')][_0xbe26('0xa')]=function(){this['squeue'][_0xbe26('0xa')](this[_0xbe26('0xb')][_0xbe26('0xd')](this),this['handleTimeout'][_0xbe26('0xd')](this));};RRMemory[_0xbe26('0x11')][_0xbe26('0x10')]=function(_0x15d8bd){this[_0xbe26('0xc')](!![]);};RRMemory[_0xbe26('0x11')][_0xbe26('0x12')]=function(_0x52a629){if(util[_0xbe26('0x13')](this[_0xbe26('0x9')]['id'],this[_0xbe26('0x7')][_0xbe26('0x14')][this[_0xbe26('0x15')]],this['squeue']['channel'],!![])){logger[_0xbe26('0x16')](_0xbe26('0x17'),this['squeue']['id'],this[_0xbe26('0x15')]);clearInterval(this[_0xbe26('0x8')][this[_0xbe26('0x15')]]);_0x52a629[_0xbe26('0x18')]();setTimeout(this[_0xbe26('0xa')][_0xbe26('0xd')](this),0x3e8);}};RRMemory[_0xbe26('0x11')][_0xbe26('0xb')]=function(_0x13b627){this[_0xbe26('0x15')]=rr(this['queue'][_0xbe26('0x19')]);logger[_0xbe26('0x16')](_0xbe26('0x1a'),this[_0xbe26('0x9')]['id'],this[_0xbe26('0x15')]);if(_['isNil'](this[_0xbe26('0x7')][_0xbe26('0x14')][this['agentId']])){logger[_0xbe26('0x16')]('[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xbe26('0x9')]['id'],this[_0xbe26('0x15')]);_0x13b627[_0xbe26('0x18')]();setTimeout(this[_0xbe26('0xa')][_0xbe26('0xd')](this),0x3e8);}else{if(util[_0xbe26('0x13')](this['squeue']['id'],this[_0xbe26('0x7')][_0xbe26('0x14')][this[_0xbe26('0x15')]],this[_0xbe26('0x9')][_0xbe26('0x1b')],!![])){this[_0xbe26('0x7')]['agents'][this['agentId']]['busy']=!![];this[_0xbe26('0x7')][_0xbe26('0x14')][this[_0xbe26('0x15')]][_0xbe26('0x1c')]=this['queue']['name'];util[_0xbe26('0x1d')](this[_0xbe26('0x5')],this['squeue']['id'],this['realtime'][_0xbe26('0x14')][this[_0xbe26('0x15')]],this[_0xbe26('0x6')],this[_0xbe26('0x4')]);util[_0xbe26('0x1e')](this[_0xbe26('0x9')]['id'],this[_0xbe26('0x7')][_0xbe26('0x14')][this[_0xbe26('0x15')]],_0xbe26('0x1f'));this[_0xbe26('0x8')][this[_0xbe26('0x15')]]=setInterval(this[_0xbe26('0x12')][_0xbe26('0xd')](this,_0x13b627),0x3e8);}else{logger[_0xbe26('0x16')]('[%s][QUEUE]\x20agent\x20skipped,\x20not\x20available\x20id\x20%s',this[_0xbe26('0x9')]['id'],this['agentId']);_0x13b627[_0xbe26('0x18')]();setTimeout(this[_0xbe26('0xa')][_0xbe26('0xd')](this),0x3e8);}}};RRMemory[_0xbe26('0x11')][_0xbe26('0xc')]=function(_0x15358d){logger[_0xbe26('0x16')](_0xbe26('0x20'),this[_0xbe26('0x9')]['id'],this[_0xbe26('0x15')]);if(_[_0xbe26('0x21')](this[_0xbe26('0x7')][_0xbe26('0x14')][this[_0xbe26('0x15')]])){logger[_0xbe26('0x16')](_0xbe26('0x22'),this[_0xbe26('0x9')]['id'],this['agentId']);}else{clearInterval(this[_0xbe26('0x8')][this[_0xbe26('0x15')]]);util[_0xbe26('0x23')](this[_0xbe26('0x5')],this[_0xbe26('0x9')]['id'],this[_0xbe26('0x7')][_0xbe26('0x14')][this[_0xbe26('0x15')]],this[_0xbe26('0x6')],this[_0xbe26('0x4')]);util[_0xbe26('0x1e')](this[_0xbe26('0x9')]['id'],this['realtime']['agents'][this['agentId']],'TIMEOUT');this[_0xbe26('0x7')][_0xbe26('0x14')][this[_0xbe26('0x15')]]['busy']=![];this[_0xbe26('0x7')]['agents'][this[_0xbe26('0x15')]][_0xbe26('0x1c')]=undefined;}if(!_0x15358d){setTimeout(this[_0xbe26('0xa')][_0xbe26('0xd')](this),0x3e8);}};function rrmemory(_0x4167f6,_0x574038,_0x1fd566,_0xe726e5){return new RRMemory(_0x4167f6,_0x574038,_0x1fd566,_0xe726e5);}module['exports']=rrmemory;
\ No newline at end of file
+var _0x42f2=['queue','mapAgentsId','info','[%s][QUEUE]\x20try\x20with\x20%s','done','busyQueue','name','showNotification','[%s][QUEUE]\x20agent\x20skipped,\x20not\x20available\x20id\x20%s','[%s][QUEUE]\x20timeout\x20with\x20%s','isNil','hideNotification','TIMEOUT','busy','exports','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','bind','handleTimeout','module','drained','handleDrained','prototype','handleRun','handleCheckReject','isAgentAvailable','agents','agentId','channel','[%s][QUEUE]\x20available\x20again\x20%s','intervals'];(function(_0x33e9ed,_0x5287bc){var _0xb86b84=function(_0x3b46e6){while(--_0x3b46e6){_0x33e9ed['push'](_0x33e9ed['shift']());}};_0xb86b84(++_0x5287bc);}(_0x42f2,0xa3));var _0x242f=function(_0x1b4c04,_0x8d961d){_0x1b4c04=_0x1b4c04-0x0;var _0x374f5d=_0x42f2[_0x1b4c04];return _0x374f5d;};'use strict';var rr=require('rr');var _=require('lodash');var uuid=require(_0x242f('0x0'));var util=require(_0x242f('0x1'));var logger=require(_0x242f('0x2'))(_0x242f('0x3'));var RRMemory=function(_0x45d19a,_0x5d85c1,_0x1317c9,_0x1e94ad){this[_0x242f('0x4')]=uuid['v4']();this[_0x242f('0x5')]=_0x45d19a;this['queue']=_0x5d85c1;this[_0x242f('0x6')]=_0x1317c9;this[_0x242f('0x3')]=_0x1e94ad;this['intervals']={};this[_0x242f('0x5')][_0x242f('0x7')](this['handleRun'][_0x242f('0x8')](this),this[_0x242f('0x9')][_0x242f('0x8')](this),this[_0x242f('0xa')]);this[_0x242f('0x5')]['on']('timeout',this[_0x242f('0x9')][_0x242f('0x8')](this));this[_0x242f('0x5')]['on'](_0x242f('0xb'),this[_0x242f('0xc')][_0x242f('0x8')](this));};RRMemory[_0x242f('0xd')][_0x242f('0x7')]=function(){this[_0x242f('0x5')]['push'](this[_0x242f('0xe')]['bind'](this),this[_0x242f('0x9')][_0x242f('0x8')](this));};RRMemory[_0x242f('0xd')][_0x242f('0xc')]=function(_0xb352ab){this['handleTimeout'](!![]);};RRMemory[_0x242f('0xd')][_0x242f('0xf')]=function(_0x397bf6){if(util[_0x242f('0x10')](this['squeue']['id'],this[_0x242f('0x6')][_0x242f('0x11')][this[_0x242f('0x12')]],this[_0x242f('0x5')][_0x242f('0x13')],!![])){logger['info'](_0x242f('0x14'),this[_0x242f('0x5')]['id'],this['agentId']);clearInterval(this[_0x242f('0x15')][this['agentId']]);_0x397bf6['done']();setTimeout(this[_0x242f('0x7')]['bind'](this),0x3e8);}};RRMemory[_0x242f('0xd')][_0x242f('0xe')]=function(_0x1b67a9){this['agentId']=rr(this[_0x242f('0x16')][_0x242f('0x17')]);logger[_0x242f('0x18')](_0x242f('0x19'),this[_0x242f('0x5')]['id'],this['agentId']);if(_['isNil'](this['realtime'][_0x242f('0x11')][this['agentId']])){logger['info']('[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x242f('0x5')]['id'],this[_0x242f('0x12')]);_0x1b67a9[_0x242f('0x1a')]();setTimeout(this['push'][_0x242f('0x8')](this),0x3e8);}else{if(util['isAgentAvailable'](this[_0x242f('0x5')]['id'],this['realtime'][_0x242f('0x11')][this['agentId']],this[_0x242f('0x5')][_0x242f('0x13')],!![])){this['realtime'][_0x242f('0x11')][this['agentId']]['busy']=!![];this['realtime'][_0x242f('0x11')][this[_0x242f('0x12')]][_0x242f('0x1b')]=this[_0x242f('0x16')][_0x242f('0x1c')];util[_0x242f('0x1d')](this[_0x242f('0x4')],this['squeue']['id'],this['realtime'][_0x242f('0x11')][this[_0x242f('0x12')]],this[_0x242f('0x16')],this[_0x242f('0x3')]);util['writeLog'](this[_0x242f('0x5')]['id'],this[_0x242f('0x6')]['agents'][this[_0x242f('0x12')]],'RINGING');this[_0x242f('0x15')][this[_0x242f('0x12')]]=setInterval(this[_0x242f('0xf')][_0x242f('0x8')](this,_0x1b67a9),0x3e8);}else{logger[_0x242f('0x18')](_0x242f('0x1e'),this[_0x242f('0x5')]['id'],this['agentId']);_0x1b67a9['done']();setTimeout(this[_0x242f('0x7')][_0x242f('0x8')](this),0x3e8);}}};RRMemory[_0x242f('0xd')][_0x242f('0x9')]=function(_0x32b4aa){logger[_0x242f('0x18')](_0x242f('0x1f'),this['squeue']['id'],this['agentId']);if(_[_0x242f('0x20')](this['realtime']['agents'][this['agentId']])){logger['info']('[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x242f('0x5')]['id'],this['agentId']);}else{clearInterval(this[_0x242f('0x15')][this['agentId']]);util[_0x242f('0x21')](this[_0x242f('0x4')],this['squeue']['id'],this[_0x242f('0x6')][_0x242f('0x11')][this[_0x242f('0x12')]],this[_0x242f('0x16')],this['routing']);util['writeLog'](this[_0x242f('0x5')]['id'],this[_0x242f('0x6')][_0x242f('0x11')][this[_0x242f('0x12')]],_0x242f('0x22'));this[_0x242f('0x6')][_0x242f('0x11')][this[_0x242f('0x12')]][_0x242f('0x23')]=![];this[_0x242f('0x6')][_0x242f('0x11')][this[_0x242f('0x12')]][_0x242f('0x1b')]=undefined;}if(!_0x32b4aa){setTimeout(this[_0x242f('0x7')]['bind'](this),0x3e8);}};function rrmemory(_0x2f345f,_0x1a01d6,_0x5da606,_0x4ebf3e){return new RRMemory(_0x2f345f,_0x1a01d6,_0x5da606,_0x4ebf3e);}module[_0x242f('0x24')]=rrmemory;
\ No newline at end of file
index 91943a1..a9cb12d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0290=['isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','Capacity','CurrentCapacity','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','format','user:%s','split','name','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','emit','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]'];(function(_0x4645de,_0x2d39bc){var _0xfe8082=function(_0x1366a0){while(--_0x1366a0){_0x4645de['push'](_0x4645de['shift']());}};_0xfe8082(++_0x2d39bc);}(_0x0290,0xb4));var _0x0029=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x0290[_0x15bc81];return _0x59440e;};'use strict';var _=require('lodash');var util=require('util');var utils=require('../utils');var Mustache=require('mustache');var Redis=require(_0x0029('0x0'));var config=require(_0x0029('0x1'));var logger=require(_0x0029('0x2'))(_0x0029('0x3'));config[_0x0029('0x4')]=_[_0x0029('0x5')](config['redis'],{'host':_0x0029('0x6'),'port':0x18eb});var io=require(_0x0029('0x7'))(new Redis(config[_0x0029('0x4')]));function emit(_0x4db0db,_0x39f09c,_0x1fc2a9){io['to'](_0x4db0db)['emit'](_0x39f09c,_0x1fc2a9);}function sendNotification(_0x538313,_0x52f9c4,_0x4ff345,_0x5c172d,_0x32c32a,_0x3e2660){io['to'](util[_0x0029('0x8')](_0x0029('0x9'),_0x5c172d['name']))['emit']('user:save',_0x5c172d);var _0x3302c4=_0x3e2660||{};var _0x11502b=_0x4ff345[_0x0029('0xa')]('.');var _0x54b15b={'uniqueid':_0x52f9c4,'channel':_0x11502b[0x0],'id':_0x11502b[0x1],'title':_0x11502b[0x0]+'\x20interaction','interactionId':_0x11502b[0x2],'queue':_0x32c32a?_0x32c32a[_0x0029('0xb')]:null,'sound':_0x3302c4[_0x0029('0xc')][_0x0029('0xd')],'shake':_0x3302c4[_0x0029('0xc')][_0x0029('0xe')]};try{if(!_0x3302c4[_0x0029('0xf')]){_0x3302c4['body']={};}if(_0x32c32a){_0x3302c4['body'][_0x0029('0x10')]=_0x32c32a;}else if(_0x3302c4['body']['queue']){delete _0x3302c4[_0x0029('0xf')]['queue'];}_0x54b15b[_0x0029('0x11')]=utils[_0x0029('0x12')](_0x3302c4[_0x0029('0xc')][_0x0029('0x13')],_0x3302c4);}catch(_0x5ae16a){_0x54b15b[_0x0029('0x11')]=_0x0029('0x14');logger[_0x0029('0x15')](util[_0x0029('0x8')](_0x0029('0x16'),_0x52f9c4,_0x5ae16a[_0x0029('0x17')]));}io['to'](util[_0x0029('0x8')](_0x0029('0x9'),_0x5c172d[_0x0029('0xb')]))[_0x0029('0x18')](util['format'](_0x0029('0x19'),_0x538313?_0x0029('0x1a'):_0x0029('0x1b')),_0x54b15b);}function writeLog(_0x18a4b6,_0x34ed2a,_0x1e2ef7){return logger[_0x0029('0x1c')](util['format'](_0x0029('0x1d'),_0x18a4b6,_0x34ed2a[_0x0029('0xb')],_0x1e2ef7));}exports[_0x0029('0x1e')]=function(_0x1a93e0,_0x1e86e9,_0x101b06,_0x24d9d){if(_0x1e86e9[_0x0029('0x1f')]){writeLog(_0x1a93e0,_0x1e86e9,_0x0029('0x20'));return![];}if(!_0x1e86e9[_0x0029('0x21')]){writeLog(_0x1a93e0,_0x1e86e9,_0x0029('0x22'));return![];}if(_0x1e86e9[_0x101b06+_0x0029('0x23')]){writeLog(_0x1a93e0,_0x1e86e9,'PAUSE');return![];}if(_0x24d9d&&_0x1e86e9['hasOwnProperty'](_0x101b06+_0x0029('0x24'))&&_0x1e86e9['hasOwnProperty'](_0x101b06+_0x0029('0x25'))){if(_0x1e86e9[_0x101b06+_0x0029('0x24')]>0x0&&_0x1e86e9[_0x101b06+_0x0029('0x25')]>=_0x1e86e9[_0x101b06+_0x0029('0x24')]){writeLog(_0x1a93e0,_0x1e86e9,_0x101b06['toUpperCase']()+_0x0029('0x26'));return![];}}return!![];};exports[_0x0029('0x27')]=function(_0x23f19b,_0x1a214d,_0x42afa4,_0x5e896e,_0x44563d){return sendNotification(!![],_0x23f19b,_0x1a214d,_0x42afa4,_0x5e896e,_0x44563d);};exports[_0x0029('0x28')]=function(_0x42f460,_0x3d4b44,_0x2243cb,_0x3a9316,_0x26089a){return sendNotification(![],_0x42f460,_0x3d4b44,_0x2243cb,_0x3a9316,_0x26089a);};exports[_0x0029('0x29')]=writeLog;
\ No newline at end of file
+var _0xc6ab=['notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','notification:%s','remove','info','isAgentAvailable','BUSY','online','OFFLINE','Capacity','hasOwnProperty','CurrentCapacity','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','lodash','util','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','defaults','redis','localhost','socket.io-emitter','format','user:%s','name','user:save','\x20interaction','account'];(function(_0x5a0e9c,_0x126703){var _0x1749dd=function(_0x3a4003){while(--_0x3a4003){_0x5a0e9c['push'](_0x5a0e9c['shift']());}};_0x1749dd(++_0x126703);}(_0xc6ab,0x11b));var _0xbc6a=function(_0x56d8cd,_0x787cfd){_0x56d8cd=_0x56d8cd-0x0;var _0x597bf5=_0xc6ab[_0x56d8cd];return _0x597bf5;};'use strict';var _=require(_0xbc6a('0x0'));var util=require(_0xbc6a('0x1'));var utils=require(_0xbc6a('0x2'));var Mustache=require(_0xbc6a('0x3'));var Redis=require(_0xbc6a('0x4'));var config=require(_0xbc6a('0x5'));var logger=require(_0xbc6a('0x6'))(_0xbc6a('0x7'));config['redis']=_[_0xbc6a('0x8')](config[_0xbc6a('0x9')],{'host':_0xbc6a('0xa'),'port':0x18eb});var io=require(_0xbc6a('0xb'))(new Redis(config[_0xbc6a('0x9')]));function emit(_0x3aecf1,_0x358ecf,_0x58ebb7){io['to'](_0x3aecf1)['emit'](_0x358ecf,_0x58ebb7);}function sendNotification(_0x204dd5,_0x3cad55,_0x447ff2,_0x2c15d5,_0x414268,_0x7b25bc){io['to'](util[_0xbc6a('0xc')](_0xbc6a('0xd'),_0x2c15d5[_0xbc6a('0xe')]))['emit'](_0xbc6a('0xf'),_0x2c15d5);var _0x5e993a=_0x7b25bc||{};var _0x181ceb=_0x447ff2['split']('.');var _0x236d60={'uniqueid':_0x3cad55,'channel':_0x181ceb[0x0],'id':_0x181ceb[0x1],'title':_0x181ceb[0x0]+_0xbc6a('0x10'),'interactionId':_0x181ceb[0x2],'queue':_0x414268?_0x414268[_0xbc6a('0xe')]:null,'sound':_0x5e993a[_0xbc6a('0x11')][_0xbc6a('0x12')],'shake':_0x5e993a[_0xbc6a('0x11')][_0xbc6a('0x13')]};try{if(!_0x5e993a[_0xbc6a('0x14')]){_0x5e993a['body']={};}if(_0x414268){_0x5e993a['body']['queue']=_0x414268;}else if(_0x5e993a['body'][_0xbc6a('0x15')]){delete _0x5e993a['body'][_0xbc6a('0x15')];}_0x236d60[_0xbc6a('0x16')]=utils[_0xbc6a('0x17')](_0x5e993a[_0xbc6a('0x11')][_0xbc6a('0x18')],_0x5e993a);}catch(_0x161a28){_0x236d60[_0xbc6a('0x16')]=_0xbc6a('0x19');logger[_0xbc6a('0x1a')](util[_0xbc6a('0xc')](_0xbc6a('0x1b'),_0x3cad55,_0x161a28[_0xbc6a('0x1c')]));}io['to'](util[_0xbc6a('0xc')](_0xbc6a('0xd'),_0x2c15d5[_0xbc6a('0xe')]))['emit'](util[_0xbc6a('0xc')](_0xbc6a('0x1d'),_0x204dd5?'save':_0xbc6a('0x1e')),_0x236d60);}function writeLog(_0x381bd3,_0x549d19,_0x91a6fa){return logger[_0xbc6a('0x1f')](util[_0xbc6a('0xc')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x381bd3,_0x549d19[_0xbc6a('0xe')],_0x91a6fa));}exports[_0xbc6a('0x20')]=function(_0x154b0d,_0x1e9732,_0x1cd4aa,_0x8e92b8){if(_0x1e9732['busy']){writeLog(_0x154b0d,_0x1e9732,_0xbc6a('0x21'));return![];}if(!_0x1e9732[_0xbc6a('0x22')]){writeLog(_0x154b0d,_0x1e9732,_0xbc6a('0x23'));return![];}if(_0x1e9732[_0x1cd4aa+'Pause']){writeLog(_0x154b0d,_0x1e9732,'PAUSE');return![];}if(_0x8e92b8&&_0x1e9732['hasOwnProperty'](_0x1cd4aa+_0xbc6a('0x24'))&&_0x1e9732[_0xbc6a('0x25')](_0x1cd4aa+'CurrentCapacity')){if(_0x1e9732[_0x1cd4aa+_0xbc6a('0x24')]>0x0&&_0x1e9732[_0x1cd4aa+_0xbc6a('0x26')]>=_0x1e9732[_0x1cd4aa+'Capacity']){writeLog(_0x154b0d,_0x1e9732,_0x1cd4aa['toUpperCase']()+_0xbc6a('0x27'));return![];}}return!![];};exports[_0xbc6a('0x28')]=function(_0x6421a1,_0x19d5f1,_0x51bf38,_0x3b20f8,_0x352c78){return sendNotification(!![],_0x6421a1,_0x19d5f1,_0x51bf38,_0x3b20f8,_0x352c78);};exports[_0xbc6a('0x29')]=function(_0x5a8706,_0x4471dd,_0x2b43e0,_0x109f43,_0x1bbd8){return sendNotification(![],_0x5a8706,_0x4471dd,_0x2b43e0,_0x109f43,_0x1bbd8);};exports[_0xbc6a('0x2a')]=writeLog;
\ No newline at end of file
index dcacacf..8c216b1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe88b=['join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','stringify','validate','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','[%s][SYSTEM]\x20%s','map'];(function(_0x3f37c8,_0x2de1ad){var _0x1c3bc2=function(_0x45caf0){while(--_0x45caf0){_0x3f37c8['push'](_0x3f37c8['shift']());}};_0x1c3bc2(++_0x2de1ad);}(_0xe88b,0x7e));var _0xbe88=function(_0x36940e,_0x11f338){_0x36940e=_0x36940e-0x0;var _0x3283f2=_0xe88b[_0x36940e];return _0x3283f2;};'use strict';var schema=require(_0xbe88('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require(_0xbe88('0x1'));var logger=require(_0xbe88('0x2'))(_0xbe88('0x3'));var system=schema({'command':{'type':_0xbe88('0x4'),'required':!![],'message':_0xbe88('0x5')}});exports['consequence']=function(_0x2b53e5,_0xb05d48){return function(_0x902c94){try{var _0x1a05b2={'command':_0xb05d48[0x0]};var _0x331a5a=system['validate'](_0x1a05b2,{'typecast':!![]});if(_0x331a5a[_0xbe88('0x6')]){logger['error'](_0xbe88('0x7'),_0x2b53e5,_[_0xbe88('0x8')](_0x331a5a,'message')[_0xbe88('0x9')](',\x20'));logger[_0xbe88('0xa')](_0xbe88('0xb'),_0x2b53e5);_0x902c94[_0xbe88('0xc')]();}else{var _0x1ca851=this;var _0x1616a7=utils[_0xbe88('0xd')](_0xb05d48[0x0],this);logger['info'](_0xbe88('0xe'),_0x2b53e5,_0x1616a7);sh[_0xbe88('0xf')](_[_0xbe88('0x10')](_0x1616a7),function(_0x16dd5e,_0x3d8525){logger[_0xbe88('0xa')](_0xbe88('0x11'),_0x2b53e5,_0x16dd5e);if(_0x16dd5e==0x0){var _0x54ede8=_0x3d8525[_0xbe88('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0xbe88('0x13')](_0xb05d48[0x1])||_[_0xbe88('0x14')](_0xb05d48[0x1])){logger['info'](_0xbe88('0x15'),_0x2b53e5);_0x1ca851[_0xbe88('0x16')][_0xb05d48[0x1]]=_0x54ede8;}else{logger[_0xbe88('0xa')](_0xbe88('0x17'),_0x2b53e5,_0xb05d48[0x1],_0x54ede8);_0x1ca851[_0xbe88('0x16')][_0xb05d48[0x1]]=_0x54ede8;}}_0x902c94[_0xbe88('0xc')]();});}}catch(_0x44faa8){logger[_0xbe88('0x18')](_0xbe88('0x7'),_0x2b53e5,_[_0xbe88('0x19')](_0x44faa8)?JSON[_0xbe88('0x1a')](_0x44faa8):_0x44faa8);logger['info'](_0xbe88('0xb'),_0x2b53e5);_0x902c94[_0xbe88('0xc')]();}};};
\ No newline at end of file
+var _0x6e7b=['[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','[%s][SYSTEM]\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','map','message','next','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x6e7b,0x16d));var _0xb6e7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6e7b[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0xb6e7('0x0'));var sh=require(_0xb6e7('0x1'));var _=require(_0xb6e7('0x2'));var utils=require(_0xb6e7('0x3'));var logger=require('../../../../config/logger')('routing');var system=schema({'command':{'type':_0xb6e7('0x4'),'required':!![],'message':_0xb6e7('0x5')}});exports[_0xb6e7('0x6')]=function(_0x51e1ad,_0x4edbd9){return function(_0x2dec63){try{var _0x506d10={'command':_0x4edbd9[0x0]};var _0x369526=system[_0xb6e7('0x0')](_0x506d10,{'typecast':!![]});if(_0x369526['length']){logger['error']('[%s][SYSTEM]\x20%s',_0x51e1ad,_[_0xb6e7('0x7')](_0x369526,_0xb6e7('0x8'))['join'](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x51e1ad);_0x2dec63[_0xb6e7('0x9')]();}else{var _0x4663a7=this;var _0x4ae5b8=utils['getMustacheRender'](_0x4edbd9[0x0],this);logger[_0xb6e7('0xa')](_0xb6e7('0xb'),_0x51e1ad,_0x4ae5b8);sh[_0xb6e7('0xc')](_[_0xb6e7('0xd')](_0x4ae5b8),function(_0x3c459e,_0x45d718){logger[_0xb6e7('0xa')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x51e1ad,_0x3c459e);if(_0x3c459e==0x0){var _0x3ec28a=_0x45d718[_0xb6e7('0xe')](/(\r\n|\n|\r)/gm,'');if(_[_0xb6e7('0xf')](_0x4edbd9[0x1])||_[_0xb6e7('0x10')](_0x4edbd9[0x1])){logger[_0xb6e7('0xa')](_0xb6e7('0x11'),_0x51e1ad);_0x4663a7[_0xb6e7('0x12')][_0x4edbd9[0x1]]=_0x3ec28a;}else{logger[_0xb6e7('0xa')](_0xb6e7('0x13'),_0x51e1ad,_0x4edbd9[0x1],_0x3ec28a);_0x4663a7[_0xb6e7('0x12')][_0x4edbd9[0x1]]=_0x3ec28a;}}_0x2dec63[_0xb6e7('0x9')]();});}}catch(_0x3d42c7){logger[_0xb6e7('0x14')](_0xb6e7('0x15'),_0x51e1ad,_[_0xb6e7('0x16')](_0x3d42c7)?JSON[_0xb6e7('0x17')](_0x3d42c7):_0x3d42c7);logger[_0xb6e7('0xa')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x51e1ad);_0x2dec63[_0xb6e7('0x9')]();}};};
\ No newline at end of file
index e7330a5..1f32450 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['finally','error','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][TAG]\x20%s','map','join','next','channel','Interaction','addTags','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x2c3698,_0x5dbaff){var _0x10776d=function(_0x31993d){while(--_0x31993d){_0x2c3698['push'](_0x2c3698['shift']());}};_0x10776d(++_0x5dbaff);}(_0x7a54,0x106));var _0x47a5=function(_0x403d1b,_0x42609){_0x403d1b=_0x403d1b-0x0;var _0xef0975=_0x7a54[_0x403d1b];return _0xef0975;};'use strict';var schema=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var rpc={'chatInteraction':require(_0x47a5('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x47a5('0x3')),'mailInteraction':require(_0x47a5('0x4')),'faxInteraction':require('../../rpc/faxInteraction')};var logger=require(_0x47a5('0x5'))(_0x47a5('0x6'));var tag=schema({'tag':{'type':_0x47a5('0x7'),'required':!![],'message':_0x47a5('0x8')}});exports[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629,_0x59199c,_0x343372){return function(_0x30e405){try{var _0x506eda={'tag':_0x3d5629[0x0]};var _0x194fb0=tag['validate'](_0x506eda,{'typecast':!![]});if(_0x194fb0['length']){logger['error'](_0x47a5('0xa'),_0x545a97,_[_0x47a5('0xb')](_0x194fb0,'message')[_0x47a5('0xc')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x545a97);_0x30e405[_0x47a5('0xd')]();}else{var _0x69e4d4={'ids':[_0x3d5629[0x0]]};if(rpc[_0x343372[_0x47a5('0xe')]+_0x47a5('0xf')]){rpc[_0x343372[_0x47a5('0xe')]+_0x47a5('0xf')][_0x47a5('0x10')](_0x343372['interaction']['id'],_0x69e4d4)[_0x47a5('0x11')](function(_0x221b54){logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x545a97,_0x3d5629[0x1],_0x343372[_0x47a5('0xe')],_0x343372[_0x47a5('0x14')]['id']);})[_0x47a5('0x15')](function(_0x190faa){logger['error'](_0x47a5('0xa'),_0x545a97,JSON[_0x47a5('0x16')](_0x190faa));logger[_0x47a5('0x12')](_0x47a5('0x17'),_0x545a97);})[_0x47a5('0x18')](function(){_0x30e405['next']();});}}}catch(_0x549de3){logger[_0x47a5('0x19')]('[%s][TAG]\x20%s',_0x545a97,_['isObject'](_0x549de3)?JSON[_0x47a5('0x16')](_0x549de3):_0x549de3);logger[_0x47a5('0x12')](_0x47a5('0x17'),_0x545a97);_0x30e405[_0x47a5('0xd')]();}};};
\ No newline at end of file
+var _0x9957=['join','info','next','Interaction','channel','addTags','interaction','then','catch','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message'];(function(_0x33dde6,_0x2c422a){var _0x5610d0=function(_0x315cee){while(--_0x315cee){_0x33dde6['push'](_0x33dde6['shift']());}};_0x5610d0(++_0x2c422a);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var schema=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var rpc={'chatInteraction':require(_0x7995('0x2')),'openchannelInteraction':require(_0x7995('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x7995('0x4')),'faxInteraction':require(_0x7995('0x5'))};var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x7995('0x8')}});exports[_0x7995('0x9')]=function(_0x137b6b,_0x219534,_0xbda126,_0x326741){return function(_0x4996ca){try{var _0x465276={'tag':_0x219534[0x0]};var _0x1cad37=tag['validate'](_0x465276,{'typecast':!![]});if(_0x1cad37[_0x7995('0xa')]){logger[_0x7995('0xb')](_0x7995('0xc'),_0x137b6b,_[_0x7995('0xd')](_0x1cad37,_0x7995('0xe'))[_0x7995('0xf')](',\x20'));logger[_0x7995('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x137b6b);_0x4996ca[_0x7995('0x11')]();}else{var _0x41c652={'ids':[_0x219534[0x0]]};if(rpc[_0x326741['channel']+_0x7995('0x12')]){rpc[_0x326741[_0x7995('0x13')]+_0x7995('0x12')][_0x7995('0x14')](_0x326741[_0x7995('0x15')]['id'],_0x41c652)[_0x7995('0x16')](function(_0x2bbe7a){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x137b6b,_0x219534[0x1],_0x326741[_0x7995('0x13')],_0x326741[_0x7995('0x15')]['id']);})[_0x7995('0x17')](function(_0x321ae8){logger[_0x7995('0xb')](_0x7995('0xc'),_0x137b6b,JSON[_0x7995('0x18')](_0x321ae8));logger[_0x7995('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x137b6b);})[_0x7995('0x19')](function(){_0x4996ca['next']();});}}}catch(_0x2f832e){logger[_0x7995('0xb')](_0x7995('0xc'),_0x137b6b,_[_0x7995('0x1a')](_0x2f832e)?JSON[_0x7995('0x18')](_0x2f832e):_0x2f832e);logger[_0x7995('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x137b6b);_0x4996ca['next']();}};};
\ No newline at end of file
index 6c17ed3..3bb330e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6c4b=['contact','message','list','mustache','lodash','exports','render','merge','body'];(function(_0x56f301,_0x41ac80){var _0x197b70=function(_0x208bb9){while(--_0x208bb9){_0x56f301['push'](_0x56f301['shift']());}};_0x197b70(++_0x41ac80);}(_0x6c4b,0x93));var _0xb6c4=function(_0x3ae203,_0x2d0236){_0x3ae203=_0x3ae203-0x0;var _0x4215dc=_0x6c4b[_0x3ae203];return _0x4215dc;};'use strict';var Mustache=require(_0xb6c4('0x0'));var _=require(_0xb6c4('0x1'));module[_0xb6c4('0x2')]={'getMustacheRender':function(_0x5de185,_0x1f07f4){return Mustache[_0xb6c4('0x3')](_0x5de185,_[_0xb6c4('0x4')](_0x1f07f4[_0xb6c4('0x5')],{'contact':_0x1f07f4[_0xb6c4('0x6')],'message':_0x1f07f4[_0xb6c4('0x7')],'account':_0x1f07f4['account'],'interaction':_0x1f07f4['interaction'],'list':_0x1f07f4[_0xb6c4('0x8')]}))||'';}};
\ No newline at end of file
+var _0xaf5a=['contact','message','account','list','lodash','render','merge','body'];(function(_0x4852d0,_0x4354ad){var _0x47200d=function(_0x30b9e2){while(--_0x30b9e2){_0x4852d0['push'](_0x4852d0['shift']());}};_0x47200d(++_0x4354ad);}(_0xaf5a,0x144));var _0xaaf5=function(_0x43f47b,_0x311636){_0x43f47b=_0x43f47b-0x0;var _0x4af9a6=_0xaf5a[_0x43f47b];return _0x4af9a6;};'use strict';var Mustache=require('mustache');var _=require(_0xaaf5('0x0'));module['exports']={'getMustacheRender':function(_0x6e13c,_0x39130a){return Mustache[_0xaaf5('0x1')](_0x6e13c,_[_0xaaf5('0x2')](_0x39130a[_0xaaf5('0x3')],{'contact':_0x39130a[_0xaaf5('0x4')],'message':_0x39130a[_0xaaf5('0x5')],'account':_0x39130a[_0xaaf5('0x6')],'interaction':_0x39130a['interaction'],'list':_0x39130a[_0xaaf5('0x7')]}))||'';}};
\ No newline at end of file
index c511964..b0a356f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x443a=['routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/faxQueueReport','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','rules','message','interaction','applications','existsSync','join','app','.js','toLowerCase','autoreply','push','slice','length','dialogflow','appdata','amazonlex','tag','TagId','split','%s:%s:%s','./interval','condition','intervals','./applications/','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','info','Applications\x20executed','stringify','matchPath','emit','end','routing\x20is\x20empty','channel','QueueReport','update','UserId','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','agents','busy','agent','busyQueue','hasOwnProperty','capacity','CurrentCapacity','values','chatQueues','available','paused','waiting','mailQueues','loggedIn','name','openchannelQueues','smsQueues','faxQueues','faxQueuesWaitingInteractions','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/logger'];(function(_0x5d70e0,_0xb2fa39){var _0x11d97b=function(_0x23f8be){while(--_0x23f8be){_0x5d70e0['push'](_0x5d70e0['shift']());}};_0x11d97b(++_0xb2fa39);}(_0x443a,0xf8));var _0xa443=function(_0x25e5fc,_0x32b839){_0x25e5fc=_0x25e5fc-0x0;var _0x2fafb0=_0x443a[_0x25e5fc];return _0x2fafb0;};'use strict';var _=require(_0xa443('0x0'));var util=require(_0xa443('0x1'));var path=require(_0xa443('0x2'));var fs=require('fs');var jayson=require(_0xa443('0x3'));var BPromise=require(_0xa443('0x4'));var uuid=require(_0xa443('0x5'));var config=require('../../../config/environment');var logger=require(_0xa443('0x6'))(_0xa443('0x7'));var rpc={'openchannelQueueReport':require(_0xa443('0x8'))};var rpc={'openchannelQueueReport':require(_0xa443('0x8')),'mailQueueReport':require(_0xa443('0x9')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xa443('0xa'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x134462,_0x2e4f3b,_0x5cfdf3){return util[_0xa443('0xb')](_0xa443('0xc'),_0x134462,_0x2e4f3b||0x0,_0x5cfdf3||0x0);}function getIntervals(_0xf667d9,_0xcaf62a){var _0x36e9bf=[];if(!_['isNil'](_0xcaf62a[_0xa443('0xd')])&&!_['isNil'](_0xf667d9[_0xcaf62a['IntervalId']])&&!_[_0xa443('0xe')](_0xf667d9[_0xcaf62a[_0xa443('0xd')]][_0xa443('0xf')])){_0x36e9bf=_[_0xa443('0x10')](_0xf667d9[_0xcaf62a[_0xa443('0xd')]][_0xa443('0xf')],_0xa443('0x11'));}else if(!_[_0xa443('0xe')](_0xcaf62a[_0xa443('0x11')])){_0x36e9bf=[_0xcaf62a[_0xa443('0x11')]];}return _0x36e9bf;}exports[_0xa443('0x12')]=function(_0x451d03){_0x451d03[_0xa443('0x13')]={};return new BPromise(function(_0x15d3f1,_0x5340c2){var _0x48ce3d={'Start':function(_0x557323){var _0x25ea20=this;return new Promise(function(_0x54e49f,_0x524a71){if(_0x557323){try{var _0x4ae271=[];var _0x2193d7=getId(_0x557323['channel'],_0x557323[_0xa443('0x14')]?_0x557323[_0xa443('0x14')]['id']:0x0,_0x557323[_0xa443('0x15')]?_0x557323[_0xa443('0x15')]['id']:0x0);if(_0x557323[_0xa443('0x16')]&&_['isArray'](_0x557323['applications'])&&_0x557323[_0xa443('0x16')]['length']){for(var _0x31534a=0x0;_0x31534a<_0x557323['applications']['length'];_0x31534a+=0x1){var _0xdfc92b=_0x557323['applications'][_0x31534a];if(fs[_0xa443('0x17')](path[_0xa443('0x18')](__dirname,_0xa443('0x16'),_0xdfc92b[_0xa443('0x19')]+_0xa443('0x1a')))){var _0x20a786=[];switch(_0xdfc92b[_0xa443('0x19')][_0xa443('0x1b')]()){case _0xa443('0x1c'):var _0x1a2a14=_0xdfc92b['appdata']['split'](',');_0x20a786[_0xa443('0x1d')](_0x1a2a14[0x0]);_0x20a786['push'](_0x1a2a14[_0xa443('0x1e')](0x1,_0x1a2a14[_0xa443('0x1f')])[_0xa443('0x18')](','));break;case _0xa443('0x20'):var _0x1a2a14=_0xdfc92b[_0xa443('0x21')]['split'](',');_0x20a786['push'](_0x1a2a14[0x0]);_0x20a786[_0xa443('0x1d')](_0x1a2a14[0x1]);_0x20a786['push'](_0x1a2a14[_0xa443('0x1e')](0x2,_0x1a2a14['length'])[_0xa443('0x18')](','));break;case _0xa443('0x22'):var _0x1a2a14=_0xdfc92b['appdata']['split'](',');_0x20a786[_0xa443('0x1d')](_0x1a2a14[0x0]);_0x20a786[_0xa443('0x1d')](_0x1a2a14[0x1]);_0x20a786[_0xa443('0x1d')](_0x1a2a14[0x2]);_0x20a786[_0xa443('0x1d')](_0x1a2a14[0x3]);_0x20a786[_0xa443('0x1d')](_0x1a2a14[_0xa443('0x1e')](0x4,_0x1a2a14[_0xa443('0x1f')])['join'](','));break;case _0xa443('0x14'):_0x20a786['push'](_0xdfc92b[_0xa443('0x21')]);break;case _0xa443('0x23'):_0x20a786[_0xa443('0x1d')](_0xdfc92b[_0xa443('0x24')]);_0x20a786[_0xa443('0x1d')](_0xdfc92b[_0xa443('0x21')]);break;default:_0x20a786=_[_0xa443('0xe')](_0xdfc92b[_0xa443('0x21')])?[]:_0xdfc92b[_0xa443('0x21')][_0xa443('0x25')](',');}var _0x350119={'id':util[_0xa443('0xb')](_0xa443('0x26'),_0x2193d7,_0xdfc92b['id'],_0xdfc92b[_0xa443('0x19')]),'condition':require(_0xa443('0x27'))[_0xa443('0x28')](_0x2193d7,getIntervals(_0x451d03[_0xa443('0x29')],_0xdfc92b),_0x451d03),'consequence':require(_0xa443('0x2a')+_0xdfc92b[_0xa443('0x19')])['consequence'](_0x2193d7,_0x20a786,_0x451d03,_0x557323),'p':_0xdfc92b['priority']||0x0};logger['info'](_0xa443('0x2b'),_0x350119['id'],_0xa443('0x2c'),getIntervals(_0x451d03[_0xa443('0x29')],_0xdfc92b)[_0xa443('0x18')](_0xa443('0x2d')));_0x4ae271[_0xa443('0x1d')](_0x350119);}else{logger[_0xa443('0x2e')](_0xa443('0x2f'),path[_0xa443('0x18')](__dirname,_0xa443('0x16'),_0xdfc92b[_0xa443('0x19')]+_0xa443('0x1a')));}}_0x451d03['rules'][_0x2193d7]=new RuleEngine(_0x4ae271);_0x451d03['rules'][_0x2193d7][_0xa443('0x30')](_0x557323,function(_0x478bea){logger[_0xa443('0x31')](_0xa443('0x32'),JSON[_0xa443('0x33')](_0x478bea[_0xa443('0x34')]));if(_0x451d03[_0xa443('0x13')][_0x2193d7]){_0x451d03[_0xa443('0x13')][_0x2193d7][_0xa443('0x35')](_0xa443('0x36'));}});return _0x54e49f({'code':0xc8,'message':_0x557323});}else{logger[_0xa443('0x31')]('No\x20applications\x20to\x20execute');return _0x54e49f({'code':0xc8,'message':_0x557323});}}catch(_0x14a437){logger[_0xa443('0x2e')](_0x14a437['stack']);return _0x524a71(_0x25ea20[_0xa443('0x2e')](0x1f4,_0x14a437));}}return _0x524a71(_0xa443('0x37'));});},'AcceptMessage':function(_0x9af72e){var _0x27abb4=this;return new Promise(function(_0x50c068,_0x8df722){if(_0x9af72e[_0xa443('0x14')]&&_0x9af72e[_0xa443('0x14')]['id']){try{var _0x1cf23c=getId(_0x9af72e[_0xa443('0x38')],_0x9af72e[_0xa443('0x14')]?_0x9af72e[_0xa443('0x14')]['id']:0x0,_0x9af72e['interaction']?_0x9af72e[_0xa443('0x15')]['id']:0x0);if(_0x451d03[_0xa443('0x13')][_0x1cf23c]){_0x451d03[_0xa443('0x13')][_0x1cf23c][_0xa443('0x35')]('end');if(rpc[_0x9af72e[_0xa443('0x38')]+_0xa443('0x39')]){rpc[_0x9af72e['channel']+_0xa443('0x39')][_0xa443('0x3a')](_0x1cf23c,{'UserId':_0x9af72e[_0xa443('0x14')][_0xa443('0x3b')]})['catch'](function(_0x18d7f5){logger['error'](_0xa443('0x3c'));});}}return _0x50c068({'code':0xc8,'message':_0x9af72e});}catch(_0x2e6d7c){logger[_0xa443('0x2e')](_0x2e6d7c[_0xa443('0x3d')]);return _0x8df722(_0x27abb4[_0xa443('0x2e')](0x1f4,_0x2e6d7c));}}logger[_0xa443('0x2e')](_0xa443('0x3e'));return _0x8df722(_0x27abb4[_0xa443('0x2e')](0x1f4,_0xa443('0x3e')));});},'RejectMessage':function(_0x4353bb){var _0x2c7048=this;return new Promise(function(_0x2f49cd,_0x5014a6){if(_0x4353bb['agent']&&_0x4353bb['agent']['id']){try{if(_0x451d03[_0xa443('0x3f')][_0x4353bb['agent']['id']]){_0x451d03[_0xa443('0x3f')][_0x4353bb['agent']['id']][_0xa443('0x40')]=![];_0x451d03[_0xa443('0x3f')][_0x4353bb[_0xa443('0x41')]['id']][_0xa443('0x42')]=undefined;}return _0x2f49cd({'code':0xc8,'message':_0x4353bb});}catch(_0x1a96d0){logger[_0xa443('0x2e')](_0x1a96d0[_0xa443('0x3d')]);return _0x5014a6(_0x2c7048[_0xa443('0x2e')](0x1f4,_0x1a96d0));}}logger[_0xa443('0x2e')](_0xa443('0x3e'));return _0x5014a6(_0x2c7048[_0xa443('0x2e')](0x1f4,_0xa443('0x3e')));});},'AbandonInteraction':function(_0x3d3baa){var _0x1298a2=this;return new Promise(function(_0x49226e,_0x2bca97){if(_0x3d3baa['channel']&&_0x3d3baa[_0xa443('0x15')]&&_0x3d3baa[_0xa443('0x15')]['id']){try{var _0x4bf36a=getId(_0x3d3baa[_0xa443('0x38')],_0x3d3baa[_0xa443('0x14')]?_0x3d3baa['message']['id']:0x0,_0x3d3baa[_0xa443('0x15')]?_0x3d3baa[_0xa443('0x15')]['id']:0x0);if(_0x451d03['rules'][_0x4bf36a]){_0x451d03[_0xa443('0x13')][_0x4bf36a][_0xa443('0x35')](_0xa443('0x36'));}return _0x49226e({'code':0xc8,'message':_0x3d3baa});}catch(_0x21a69a){logger['error'](_0x21a69a[_0xa443('0x3d')]);return _0x2bca97(_0x1298a2[_0xa443('0x2e')](0x1f4,_0x21a69a));}}logger[_0xa443('0x2e')](_0xa443('0x3e'));return _0x2bca97(_0x1298a2[_0xa443('0x2e')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x3a3e4e){var _0x1b9dad=this;return new Promise(function(_0x312033,_0x63e95a){if(_0x451d03[_0xa443('0x3f')][_0xa443('0x43')](_0x3a3e4e['id'])){for(var _0x22eb4f in _0x3a3e4e[_0xa443('0x44')]){if(_0x3a3e4e[_0xa443('0x44')][_0xa443('0x43')](_0x22eb4f)){if(_0x451d03[_0xa443('0x3f')][_0x3a3e4e['id']][_0xa443('0x43')](_0x22eb4f+_0xa443('0x45'))){_0x451d03[_0xa443('0x3f')][_0x3a3e4e['id']][_0x22eb4f+_0xa443('0x45')]=parseInt(_0x3a3e4e[_0xa443('0x44')][_0x22eb4f],0xa);}}}_0x451d03['agents'][_0x3a3e4e['id']]['updateRealtime']();return _0x312033({'code':0xc8,'message':_0x451d03[_0xa443('0x3f')][_0x3a3e4e['id']]});}else{return _0x63e95a(_0x1b9dad['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x163e6f){return new Promise(function(_0xa00478,_0x365418){var _0x30ee45=_[_0xa443('0x46')](_0x451d03[_0xa443('0x3f')]);_0xa00478({'count':_0x30ee45[_0xa443('0x1f')],'rows':_0x30ee45});});},'ChatQueues':function(_0x5c8c15){return new Promise(function(_0x36298d,_0x3fe80e){var _0x4c0d1d=[];for(var _0x29d9b9 in _0x451d03['chatQueues']){if(_0x451d03[_0xa443('0x47')]['hasOwnProperty'](_0x29d9b9)){var _0x4c1ccf=_0x451d03[_0xa443('0x47')][_0x29d9b9];var _0x5c551a={'id':_0x4c1ccf['id'],'available':_0x4c1ccf[_0xa443('0x48')],'loggedIn':_0x4c1ccf['loggedIn'],'name':_0x4c1ccf['name'],'paused':_0x4c1ccf[_0xa443('0x49')],'waiting':_0x4c1ccf[_0xa443('0x4a')]};_0x4c0d1d[_0xa443('0x1d')](_0x5c551a);}}_0x36298d({'count':_0x4c0d1d[_0xa443('0x1f')],'rows':_0x4c0d1d});});},'MailQueues':function(_0x25860c){return new Promise(function(_0x387a6e,_0x3f21c2){var _0x32b4e0=[];for(var _0x33969f in _0x451d03[_0xa443('0x4b')]){if(_0x451d03[_0xa443('0x4b')][_0xa443('0x43')](_0x33969f)){var _0x392c53=_0x451d03['mailQueues'][_0x33969f];var _0x5c5af0={'id':_0x392c53['id'],'available':_0x392c53[_0xa443('0x48')],'loggedIn':_0x392c53[_0xa443('0x4c')],'name':_0x392c53[_0xa443('0x4d')],'paused':_0x392c53[_0xa443('0x49')],'waiting':_0x392c53[_0xa443('0x4a')]};_0x32b4e0['push'](_0x5c5af0);}}_0x387a6e({'count':_0x32b4e0['length'],'rows':_0x32b4e0});});},'OpenchannelQueues':function(_0x230d6c){return new Promise(function(_0x119cd6,_0x45538a){var _0xedf90d=[];for(var _0x594135 in _0x451d03[_0xa443('0x4e')]){if(_0x451d03['openchannelQueues'][_0xa443('0x43')](_0x594135)){var _0x2b2fea=_0x451d03[_0xa443('0x4e')][_0x594135];var _0x55665a={'id':_0x2b2fea['id'],'available':_0x2b2fea[_0xa443('0x48')],'loggedIn':_0x2b2fea[_0xa443('0x4c')],'name':_0x2b2fea[_0xa443('0x4d')],'paused':_0x2b2fea['paused'],'waiting':_0x2b2fea[_0xa443('0x4a')]};_0xedf90d['push'](_0x55665a);}}_0x119cd6({'count':_0xedf90d[_0xa443('0x1f')],'rows':_0xedf90d});});},'SmsQueues':function(_0x31af73){return new Promise(function(_0x275ac4,_0x5bc2af){var _0x487398=[];for(var _0x19a7ac in _0x451d03[_0xa443('0x4f')]){if(_0x451d03[_0xa443('0x4f')][_0xa443('0x43')](_0x19a7ac)){var _0x391ca5=_0x451d03['smsQueues'][_0x19a7ac];var _0x3b59cf={'id':_0x391ca5['id'],'available':_0x391ca5[_0xa443('0x48')],'loggedIn':_0x391ca5['loggedIn'],'name':_0x391ca5['name'],'paused':_0x391ca5[_0xa443('0x49')],'waiting':_0x391ca5[_0xa443('0x4a')]};_0x487398[_0xa443('0x1d')](_0x3b59cf);}}_0x275ac4({'count':_0x487398[_0xa443('0x1f')],'rows':_0x487398});});},'FaxQueues':function(_0x500507){return new Promise(function(_0x3d3260,_0x33449a){var _0x3eee6e=[];for(var _0x1334e5 in _0x451d03[_0xa443('0x50')]){if(_0x451d03[_0xa443('0x50')][_0xa443('0x43')](_0x1334e5)){var _0x209223=_0x451d03['faxQueues'][_0x1334e5];var _0x59d7f3={'id':_0x209223['id'],'available':_0x209223[_0xa443('0x48')],'loggedIn':_0x209223['loggedIn'],'name':_0x209223[_0xa443('0x4d')],'paused':_0x209223[_0xa443('0x49')],'waiting':_0x209223[_0xa443('0x4a')]};_0x3eee6e[_0xa443('0x1d')](_0x59d7f3);}}_0x3d3260({'count':_0x3eee6e[_0xa443('0x1f')],'rows':_0x3eee6e});});},'ChatQueuesWaitingInteractions':function(_0x2b4366){return new Promise(function(_0x487d55,_0x5e6fd0){var _0x535877=_['values'](_0x451d03['chatQueuesWaitingInteractions']);_0x487d55({'count':_0x535877['length'],'rows':_0x535877});});},'MailQueuesWaitingInteractions':function(_0x22bdb7){return new Promise(function(_0x43a6ab,_0x1881b6){var _0xc79616=_[_0xa443('0x46')](_0x451d03['mailQueuesWaitingInteractions']);_0x43a6ab({'count':_0xc79616['length'],'rows':_0xc79616});});},'OpenchannelQueuesWaitingInteractions':function(_0x141ec3){return new Promise(function(_0x4060ec,_0x4acd05){var _0x3312d3=_[_0xa443('0x46')](_0x451d03['openchannelQueuesWaitingInteractions']);_0x4060ec({'count':_0x3312d3[_0xa443('0x1f')],'rows':_0x3312d3});});},'SmsQueuesWaitingInteractions':function(_0x19d695){return new Promise(function(_0x514fa8,_0x22a7d8){var _0x439b1c=_[_0xa443('0x46')](_0x451d03['smsQueuesWaitingInteractions']);_0x514fa8({'count':_0x439b1c[_0xa443('0x1f')],'rows':_0x439b1c});});},'FaxQueuesWaitingInteractions':function(_0x59ae88){return new Promise(function(_0x34b2fd,_0x16b00d){var _0x3e5ddc=_[_0xa443('0x46')](_0x451d03[_0xa443('0x51')]);_0x34b2fd({'count':_0x3e5ddc[_0xa443('0x1f')],'rows':_0x3e5ddc});});}};var _0x2fefdd=jayson['server'](_0x48ce3d)['http']();_0x2fefdd['on']('error',function(_0x1ee4db){logger[_0xa443('0x2e')](JSON[_0xa443('0x33')](_0x1ee4db));return _0x5340c2(_0x1ee4db);});_0x2fefdd['listen'](0x232c,'127.0.0.1',function(){console[_0xa443('0x52')](_0xa443('0x53'),0x232c);return _0x15d3f1(_0xa443('0x54')+0x232c);});});};
\ No newline at end of file
+var _0x5908=['bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','message','interaction','applications','length','app','.js','appdata','split','push','join','slice','amazonlex','tag','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','emit','end','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','channel','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','values','chatQueues','available','loggedIn','name','mailQueues','paused','waiting','openchannelQueues','smsQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','http','stringify','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise'];(function(_0x4064b2,_0x34b3d2){var _0xa8eec0=function(_0x4c7759){while(--_0x4c7759){_0x4064b2['push'](_0x4064b2['shift']());}};_0xa8eec0(++_0x34b3d2);}(_0x5908,0x107));var _0x8590=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x5908[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x8590('0x0'));var util=require(_0x8590('0x1'));var path=require(_0x8590('0x2'));var fs=require('fs');var jayson=require(_0x8590('0x3'));var BPromise=require(_0x8590('0x4'));var uuid=require(_0x8590('0x5'));var config=require(_0x8590('0x6'));var logger=require(_0x8590('0x7'))(_0x8590('0x8'));var rpc={'openchannelQueueReport':require(_0x8590('0x9'))};var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x8590('0xa')),'chatQueueReport':require(_0x8590('0xb')),'smsQueueReport':require(_0x8590('0xc')),'faxQueueReport':require('../rpc/faxQueueReport')};var RuleEngine=require(_0x8590('0xd'));function getId(_0x3d1921,_0x87612c,_0x481b07){return util[_0x8590('0xe')](_0x8590('0xf'),_0x3d1921,_0x87612c||0x0,_0x481b07||0x0);}function getIntervals(_0x5d65ab,_0x5afdb9){var _0x17822e=[];if(!_[_0x8590('0x10')](_0x5afdb9[_0x8590('0x11')])&&!_['isNil'](_0x5d65ab[_0x5afdb9['IntervalId']])&&!_['isNil'](_0x5d65ab[_0x5afdb9[_0x8590('0x11')]][_0x8590('0x12')])){_0x17822e=_[_0x8590('0x13')](_0x5d65ab[_0x5afdb9[_0x8590('0x11')]]['Intervals'],'interval');}else if(!_['isNil'](_0x5afdb9[_0x8590('0x14')])){_0x17822e=[_0x5afdb9[_0x8590('0x14')]];}return _0x17822e;}exports[_0x8590('0x15')]=function(_0x5d6a25){_0x5d6a25[_0x8590('0x16')]={};return new BPromise(function(_0x2f5cdc,_0x2fbd45){var _0x4871ce={'Start':function(_0x186755){var _0x3fd6c8=this;return new Promise(function(_0x6a161b,_0x1ecfce){if(_0x186755){try{var _0x47e124=[];var _0x171524=getId(_0x186755['channel'],_0x186755[_0x8590('0x17')]?_0x186755[_0x8590('0x17')]['id']:0x0,_0x186755[_0x8590('0x18')]?_0x186755['interaction']['id']:0x0);if(_0x186755[_0x8590('0x19')]&&_['isArray'](_0x186755['applications'])&&_0x186755[_0x8590('0x19')][_0x8590('0x1a')]){for(var _0x253d79=0x0;_0x253d79<_0x186755[_0x8590('0x19')]['length'];_0x253d79+=0x1){var _0x5250b8=_0x186755[_0x8590('0x19')][_0x253d79];if(fs['existsSync'](path['join'](__dirname,_0x8590('0x19'),_0x5250b8[_0x8590('0x1b')]+_0x8590('0x1c')))){var _0x387d98=[];switch(_0x5250b8[_0x8590('0x1b')]['toLowerCase']()){case'autoreply':var _0x1a14cf=_0x5250b8[_0x8590('0x1d')][_0x8590('0x1e')](',');_0x387d98[_0x8590('0x1f')](_0x1a14cf[0x0]);_0x387d98[_0x8590('0x1f')](_0x1a14cf['slice'](0x1,_0x1a14cf[_0x8590('0x1a')])[_0x8590('0x20')](','));break;case'dialogflow':var _0x1a14cf=_0x5250b8[_0x8590('0x1d')][_0x8590('0x1e')](',');_0x387d98[_0x8590('0x1f')](_0x1a14cf[0x0]);_0x387d98[_0x8590('0x1f')](_0x1a14cf[0x1]);_0x387d98['push'](_0x1a14cf[_0x8590('0x21')](0x2,_0x1a14cf['length'])[_0x8590('0x20')](','));break;case _0x8590('0x22'):var _0x1a14cf=_0x5250b8[_0x8590('0x1d')]['split'](',');_0x387d98[_0x8590('0x1f')](_0x1a14cf[0x0]);_0x387d98[_0x8590('0x1f')](_0x1a14cf[0x1]);_0x387d98[_0x8590('0x1f')](_0x1a14cf[0x2]);_0x387d98[_0x8590('0x1f')](_0x1a14cf[0x3]);_0x387d98['push'](_0x1a14cf[_0x8590('0x21')](0x4,_0x1a14cf['length'])['join'](','));break;case _0x8590('0x17'):_0x387d98['push'](_0x5250b8['appdata']);break;case _0x8590('0x23'):_0x387d98[_0x8590('0x1f')](_0x5250b8['TagId']);_0x387d98[_0x8590('0x1f')](_0x5250b8[_0x8590('0x1d')]);break;default:_0x387d98=_[_0x8590('0x10')](_0x5250b8[_0x8590('0x1d')])?[]:_0x5250b8[_0x8590('0x1d')][_0x8590('0x1e')](',');}var _0x379401={'id':util[_0x8590('0xe')](_0x8590('0x24'),_0x171524,_0x5250b8['id'],_0x5250b8[_0x8590('0x1b')]),'condition':require(_0x8590('0x25'))[_0x8590('0x26')](_0x171524,getIntervals(_0x5d6a25[_0x8590('0x27')],_0x5250b8),_0x5d6a25),'consequence':require(_0x8590('0x28')+_0x5250b8['app'])[_0x8590('0x29')](_0x171524,_0x387d98,_0x5d6a25,_0x186755),'p':_0x5250b8[_0x8590('0x2a')]||0x0};logger[_0x8590('0x2b')](_0x8590('0x2c'),_0x379401['id'],_0x8590('0x2d'),getIntervals(_0x5d6a25['intervals'],_0x5250b8)[_0x8590('0x20')]('\x20|\x20'));_0x47e124[_0x8590('0x1f')](_0x379401);}else{logger[_0x8590('0x2e')](_0x8590('0x2f'),path[_0x8590('0x20')](__dirname,_0x8590('0x19'),_0x5250b8[_0x8590('0x1b')]+_0x8590('0x1c')));}}_0x5d6a25[_0x8590('0x16')][_0x171524]=new RuleEngine(_0x47e124);_0x5d6a25[_0x8590('0x16')][_0x171524][_0x8590('0x30')](_0x186755,function(_0x496e36){logger[_0x8590('0x2b')](_0x8590('0x31'),JSON['stringify'](_0x496e36['matchPath']));if(_0x5d6a25[_0x8590('0x16')][_0x171524]){_0x5d6a25[_0x8590('0x16')][_0x171524][_0x8590('0x32')](_0x8590('0x33'));}});return _0x6a161b({'code':0xc8,'message':_0x186755});}else{logger[_0x8590('0x2b')](_0x8590('0x34'));return _0x6a161b({'code':0xc8,'message':_0x186755});}}catch(_0x424b4a){logger[_0x8590('0x2e')](_0x424b4a[_0x8590('0x35')]);return _0x1ecfce(_0x3fd6c8[_0x8590('0x2e')](0x1f4,_0x424b4a));}}return _0x1ecfce(_0x8590('0x36'));});},'AcceptMessage':function(_0x9898ba){var _0xd3242a=this;return new Promise(function(_0x1b8f6e,_0x2afbed){if(_0x9898ba[_0x8590('0x17')]&&_0x9898ba[_0x8590('0x17')]['id']){try{var _0x4f714c=getId(_0x9898ba['channel'],_0x9898ba[_0x8590('0x17')]?_0x9898ba['message']['id']:0x0,_0x9898ba[_0x8590('0x18')]?_0x9898ba['interaction']['id']:0x0);if(_0x5d6a25[_0x8590('0x16')][_0x4f714c]){_0x5d6a25[_0x8590('0x16')][_0x4f714c][_0x8590('0x32')](_0x8590('0x33'));if(rpc[_0x9898ba[_0x8590('0x37')]+_0x8590('0x38')]){rpc[_0x9898ba['channel']+_0x8590('0x38')][_0x8590('0x39')](_0x4f714c,{'UserId':_0x9898ba[_0x8590('0x17')][_0x8590('0x3a')]})[_0x8590('0x3b')](function(_0x59a4a9){logger[_0x8590('0x2e')](_0x8590('0x3c'));});}}return _0x1b8f6e({'code':0xc8,'message':_0x9898ba});}catch(_0x4ed161){logger[_0x8590('0x2e')](_0x4ed161[_0x8590('0x35')]);return _0x2afbed(_0xd3242a[_0x8590('0x2e')](0x1f4,_0x4ed161));}}logger[_0x8590('0x2e')](_0x8590('0x3d'));return _0x2afbed(_0xd3242a[_0x8590('0x2e')](0x1f4,_0x8590('0x3d')));});},'RejectMessage':function(_0x57576c){var _0x4cb846=this;return new Promise(function(_0xa6c830,_0x2b57ba){if(_0x57576c[_0x8590('0x3e')]&&_0x57576c[_0x8590('0x3e')]['id']){try{if(_0x5d6a25['agents'][_0x57576c[_0x8590('0x3e')]['id']]){_0x5d6a25[_0x8590('0x3f')][_0x57576c['agent']['id']][_0x8590('0x40')]=![];_0x5d6a25[_0x8590('0x3f')][_0x57576c['agent']['id']][_0x8590('0x41')]=undefined;}return _0xa6c830({'code':0xc8,'message':_0x57576c});}catch(_0x13e116){logger[_0x8590('0x2e')](_0x13e116[_0x8590('0x35')]);return _0x2b57ba(_0x4cb846[_0x8590('0x2e')](0x1f4,_0x13e116));}}logger[_0x8590('0x2e')]('message\x20is\x20empty');return _0x2b57ba(_0x4cb846[_0x8590('0x2e')](0x1f4,_0x8590('0x3d')));});},'AbandonInteraction':function(_0x2a90ec){var _0x1f7992=this;return new Promise(function(_0x3a90d2,_0x2d1600){if(_0x2a90ec[_0x8590('0x37')]&&_0x2a90ec['interaction']&&_0x2a90ec[_0x8590('0x18')]['id']){try{var _0x9c4bf7=getId(_0x2a90ec['channel'],_0x2a90ec[_0x8590('0x17')]?_0x2a90ec[_0x8590('0x17')]['id']:0x0,_0x2a90ec['interaction']?_0x2a90ec[_0x8590('0x18')]['id']:0x0);if(_0x5d6a25['rules'][_0x9c4bf7]){_0x5d6a25['rules'][_0x9c4bf7][_0x8590('0x32')](_0x8590('0x33'));}return _0x3a90d2({'code':0xc8,'message':_0x2a90ec});}catch(_0x139476){logger[_0x8590('0x2e')](_0x139476[_0x8590('0x35')]);return _0x2d1600(_0x1f7992[_0x8590('0x2e')](0x1f4,_0x139476));}}logger[_0x8590('0x2e')](_0x8590('0x3d'));return _0x2d1600(_0x1f7992[_0x8590('0x2e')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x47cd94){var _0x380e54=this;return new Promise(function(_0x8c6f91,_0x41cc85){if(_0x5d6a25[_0x8590('0x3f')][_0x8590('0x42')](_0x47cd94['id'])){for(var _0x5e88c9 in _0x47cd94[_0x8590('0x43')]){if(_0x47cd94[_0x8590('0x43')][_0x8590('0x42')](_0x5e88c9)){if(_0x5d6a25['agents'][_0x47cd94['id']][_0x8590('0x42')](_0x5e88c9+'CurrentCapacity')){_0x5d6a25[_0x8590('0x3f')][_0x47cd94['id']][_0x5e88c9+'CurrentCapacity']=parseInt(_0x47cd94['capacity'][_0x5e88c9],0xa);}}}_0x5d6a25[_0x8590('0x3f')][_0x47cd94['id']]['updateRealtime']();return _0x8c6f91({'code':0xc8,'message':_0x5d6a25['agents'][_0x47cd94['id']]});}else{return _0x41cc85(_0x380e54[_0x8590('0x2e')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x450519){return new Promise(function(_0x5d6b9b,_0x1f63ab){var _0x2ccc19=_[_0x8590('0x44')](_0x5d6a25[_0x8590('0x3f')]);_0x5d6b9b({'count':_0x2ccc19['length'],'rows':_0x2ccc19});});},'ChatQueues':function(_0x349ab7){return new Promise(function(_0x42f96c,_0x28edb3){var _0x4395d4=[];for(var _0x42af8b in _0x5d6a25['chatQueues']){if(_0x5d6a25[_0x8590('0x45')][_0x8590('0x42')](_0x42af8b)){var _0x23815a=_0x5d6a25[_0x8590('0x45')][_0x42af8b];var _0xe62b64={'id':_0x23815a['id'],'available':_0x23815a[_0x8590('0x46')],'loggedIn':_0x23815a[_0x8590('0x47')],'name':_0x23815a[_0x8590('0x48')],'paused':_0x23815a['paused'],'waiting':_0x23815a['waiting']};_0x4395d4['push'](_0xe62b64);}}_0x42f96c({'count':_0x4395d4[_0x8590('0x1a')],'rows':_0x4395d4});});},'MailQueues':function(_0x4d0267){return new Promise(function(_0x59ff8d,_0x5c04ad){var _0x54ea0a=[];for(var _0x4d9a64 in _0x5d6a25[_0x8590('0x49')]){if(_0x5d6a25['mailQueues'][_0x8590('0x42')](_0x4d9a64)){var _0x2c7380=_0x5d6a25[_0x8590('0x49')][_0x4d9a64];var _0x2ba00b={'id':_0x2c7380['id'],'available':_0x2c7380['available'],'loggedIn':_0x2c7380[_0x8590('0x47')],'name':_0x2c7380['name'],'paused':_0x2c7380[_0x8590('0x4a')],'waiting':_0x2c7380[_0x8590('0x4b')]};_0x54ea0a[_0x8590('0x1f')](_0x2ba00b);}}_0x59ff8d({'count':_0x54ea0a[_0x8590('0x1a')],'rows':_0x54ea0a});});},'OpenchannelQueues':function(_0x4612b9){return new Promise(function(_0x7e2e89,_0x20ea5e){var _0x32a688=[];for(var _0xff6ec in _0x5d6a25[_0x8590('0x4c')]){if(_0x5d6a25[_0x8590('0x4c')][_0x8590('0x42')](_0xff6ec)){var _0x3323c9=_0x5d6a25[_0x8590('0x4c')][_0xff6ec];var _0x52719e={'id':_0x3323c9['id'],'available':_0x3323c9[_0x8590('0x46')],'loggedIn':_0x3323c9[_0x8590('0x47')],'name':_0x3323c9[_0x8590('0x48')],'paused':_0x3323c9[_0x8590('0x4a')],'waiting':_0x3323c9[_0x8590('0x4b')]};_0x32a688[_0x8590('0x1f')](_0x52719e);}}_0x7e2e89({'count':_0x32a688['length'],'rows':_0x32a688});});},'SmsQueues':function(_0x538026){return new Promise(function(_0x3035d3,_0x134734){var _0x45ba3f=[];for(var _0x195078 in _0x5d6a25[_0x8590('0x4d')]){if(_0x5d6a25[_0x8590('0x4d')][_0x8590('0x42')](_0x195078)){var _0x4e754e=_0x5d6a25['smsQueues'][_0x195078];var _0x545717={'id':_0x4e754e['id'],'available':_0x4e754e[_0x8590('0x46')],'loggedIn':_0x4e754e['loggedIn'],'name':_0x4e754e['name'],'paused':_0x4e754e['paused'],'waiting':_0x4e754e[_0x8590('0x4b')]};_0x45ba3f['push'](_0x545717);}}_0x3035d3({'count':_0x45ba3f[_0x8590('0x1a')],'rows':_0x45ba3f});});},'FaxQueues':function(_0x2eb7d2){return new Promise(function(_0x5039e5,_0x1554cc){var _0x45629d=[];for(var _0x514fa9 in _0x5d6a25[_0x8590('0x4e')]){if(_0x5d6a25[_0x8590('0x4e')][_0x8590('0x42')](_0x514fa9)){var _0x335662=_0x5d6a25[_0x8590('0x4e')][_0x514fa9];var _0x445b33={'id':_0x335662['id'],'available':_0x335662[_0x8590('0x46')],'loggedIn':_0x335662[_0x8590('0x47')],'name':_0x335662[_0x8590('0x48')],'paused':_0x335662[_0x8590('0x4a')],'waiting':_0x335662[_0x8590('0x4b')]};_0x45629d['push'](_0x445b33);}}_0x5039e5({'count':_0x45629d['length'],'rows':_0x45629d});});},'ChatQueuesWaitingInteractions':function(_0x4c4e9e){return new Promise(function(_0x563f63,_0x391f40){var _0x5e7171=_[_0x8590('0x44')](_0x5d6a25[_0x8590('0x4f')]);_0x563f63({'count':_0x5e7171['length'],'rows':_0x5e7171});});},'MailQueuesWaitingInteractions':function(_0x41651c){return new Promise(function(_0x4db117,_0x5ec98e){var _0x1e3c17=_[_0x8590('0x44')](_0x5d6a25[_0x8590('0x50')]);_0x4db117({'count':_0x1e3c17[_0x8590('0x1a')],'rows':_0x1e3c17});});},'OpenchannelQueuesWaitingInteractions':function(_0x1e66d2){return new Promise(function(_0x3caf3b,_0x1a91e5){var _0x2090df=_[_0x8590('0x44')](_0x5d6a25[_0x8590('0x51')]);_0x3caf3b({'count':_0x2090df[_0x8590('0x1a')],'rows':_0x2090df});});},'SmsQueuesWaitingInteractions':function(_0x5e007b){return new Promise(function(_0x2f3b92,_0x5ca993){var _0x316e29=_[_0x8590('0x44')](_0x5d6a25[_0x8590('0x52')]);_0x2f3b92({'count':_0x316e29[_0x8590('0x1a')],'rows':_0x316e29});});},'FaxQueuesWaitingInteractions':function(_0x249b83){return new Promise(function(_0x139657,_0x4372c6){var _0x592331=_[_0x8590('0x44')](_0x5d6a25[_0x8590('0x53')]);_0x139657({'count':_0x592331[_0x8590('0x1a')],'rows':_0x592331});});}};var _0x21c92f=jayson['server'](_0x4871ce)[_0x8590('0x54')]();_0x21c92f['on'](_0x8590('0x2e'),function(_0x13d8ae){logger[_0x8590('0x2e')](JSON[_0x8590('0x55')](_0x13d8ae));return _0x2fbd45(_0x13d8ae);});_0x21c92f[_0x8590('0x15')](0x232c,_0x8590('0x56'),function(){console['log'](_0x8590('0x57'),0x232c);return _0x2f5cdc(_0x8590('0x58')+0x232c);});});};
\ No newline at end of file
index bd21a26..e16859f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x29cd=['jayson/promise','lodash','../../../config/logger','routing','client','request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','some','\x20|\x20','[%s][INTERVAL]\x20%s\x20%s','join','stack','util'];(function(_0x356bb5,_0x17a055){var _0x4d4efb=function(_0x582b50){while(--_0x582b50){_0x356bb5['push'](_0x356bb5['shift']());}};_0x4d4efb(++_0x17a055);}(_0x29cd,0x167));var _0xd29c=function(_0x11e4c9,_0x5a6bbc){_0x11e4c9=_0x11e4c9-0x0;var _0x186952=_0x29cd[_0x11e4c9];return _0x186952;};'use strict';var util=require(_0xd29c('0x0'));var BPromise=require('bluebird');var jayson=require(_0xd29c('0x1'));var _=require(_0xd29c('0x2'));var logger=require(_0xd29c('0x3'))(_0xd29c('0x4'));var client=jayson[_0xd29c('0x5')]['http']({'port':0x232a});function request(_0x3dc0c7,_0x2ca520){return new BPromise(function(_0x4b2c23,_0x28a632){return client[_0xd29c('0x6')](_0x3dc0c7,_0x2ca520)[_0xd29c('0x7')](function(_0x4863b5){if(_0x4863b5[_0xd29c('0x8')]){return _0x28a632(_0x4863b5['error'][_0xd29c('0x9')]);}else{return _0x4b2c23(_0x4863b5[_0xd29c('0xa')]);}})[_0xd29c('0xb')](function(_0x460f4f){return _0x28a632(_0x460f4f);});});}exports[_0xd29c('0xc')]=function(_0x3ac259,_0xecbc0f,_0x439769){return function(_0x5df3b1){if(_0x439769['rules']&&!_0x439769[_0xd29c('0xd')][_0x3ac259]){logger[_0xd29c('0xe')](_0xd29c('0xf'),_0x3ac259);return _0x5df3b1[_0xd29c('0x10')]();}var _0x5d38c7=[];for(var _0x20904f=0x0;_0x20904f<_0xecbc0f[_0xd29c('0x11')];_0x20904f+=0x1){_0x5d38c7[_0xd29c('0x12')](request(_0xd29c('0x13'),{'command':util[_0xd29c('0x14')](_0xd29c('0x15'),_0xecbc0f[_0x20904f])})[_0xd29c('0x7')](function(_0x28e0fa){return _0x28e0fa&&_0x28e0fa[_0xd29c('0x9')]&&_0x28e0fa[_0xd29c('0x9')][_0xd29c('0x16')](_0xd29c('0x17'))>=0x0?!![]:![];})[_0xd29c('0xb')](function(_0x32b382){logger[_0xd29c('0x8')](_0xd29c('0x18'),_0x3ac259,_0xecbc0f[_0x20904f]);}));}BPromise['all'](_0x5d38c7)[_0xd29c('0x7')](function(_0x488186){var _0x42d892=_[_0xd29c('0x19')](_0x488186);logger[_0xd29c('0xe')]('[%s][INTERVAL]\x20%s\x20%s',_0x3ac259,_0xecbc0f['join'](_0xd29c('0x1a')),_0x42d892);_0x5df3b1['when'](_0x42d892);})[_0xd29c('0xb')](function(_0x257465){console['log'](_0x257465);logger[_0xd29c('0x8')](_0xd29c('0x1b'),_0x3ac259,_0xecbc0f[_0xd29c('0x1c')](_0xd29c('0x1a')),_0x257465[_0xd29c('0x1d')]);_0x5df3b1[_0xd29c('0x10')]();});};};
\ No newline at end of file
+var _0xc93a=['stack','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message','result','catch','condition','rules','info','stop','push','Command','format','iftime\x20%s','indexOf','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log'];(function(_0x305a59,_0x34c37c){var _0x4cfdaa=function(_0x461d48){while(--_0x461d48){_0x305a59['push'](_0x305a59['shift']());}};_0x4cfdaa(++_0x34c37c);}(_0xc93a,0xd3));var _0xac93=function(_0x559c59,_0x260497){_0x559c59=_0x559c59-0x0;var _0x5b1583=_0xc93a[_0x559c59];return _0x5b1583;};'use strict';var util=require('util');var BPromise=require(_0xac93('0x0'));var jayson=require(_0xac93('0x1'));var _=require(_0xac93('0x2'));var logger=require(_0xac93('0x3'))(_0xac93('0x4'));var client=jayson[_0xac93('0x5')][_0xac93('0x6')]({'port':0x232a});function request(_0x4f0b3e,_0x1aba15){return new BPromise(function(_0x40b9f2,_0x1ef168){return client[_0xac93('0x7')](_0x4f0b3e,_0x1aba15)[_0xac93('0x8')](function(_0x106483){if(_0x106483['error']){return _0x1ef168(_0x106483[_0xac93('0x9')][_0xac93('0xa')]);}else{return _0x40b9f2(_0x106483[_0xac93('0xb')]);}})[_0xac93('0xc')](function(_0x1ee88f){return _0x1ef168(_0x1ee88f);});});}exports[_0xac93('0xd')]=function(_0x12abb8,_0x1828e9,_0x33f0fd){return function(_0x2d47fa){if(_0x33f0fd[_0xac93('0xe')]&&!_0x33f0fd[_0xac93('0xe')][_0x12abb8]){logger[_0xac93('0xf')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x12abb8);return _0x2d47fa[_0xac93('0x10')]();}var _0x986f27=[];for(var _0x121fb0=0x0;_0x121fb0<_0x1828e9['length'];_0x121fb0+=0x1){_0x986f27[_0xac93('0x11')](request(_0xac93('0x12'),{'command':util[_0xac93('0x13')](_0xac93('0x14'),_0x1828e9[_0x121fb0])})[_0xac93('0x8')](function(_0x38531d){return _0x38531d&&_0x38531d[_0xac93('0xa')]&&_0x38531d['message'][_0xac93('0x15')]('true')>=0x0?!![]:![];})[_0xac93('0xc')](function(_0x4c8ea1){logger[_0xac93('0x9')]('[%s][INTERVAL]\x20%s',_0x12abb8,_0x1828e9[_0x121fb0]);}));}BPromise[_0xac93('0x16')](_0x986f27)[_0xac93('0x8')](function(_0xe95511){var _0x5095b4=_[_0xac93('0x17')](_0xe95511);logger['info'](_0xac93('0x18'),_0x12abb8,_0x1828e9[_0xac93('0x19')](_0xac93('0x1a')),_0x5095b4);_0x2d47fa[_0xac93('0x1b')](_0x5095b4);})[_0xac93('0xc')](function(_0x4c2e0a){console[_0xac93('0x1c')](_0x4c2e0a);logger['error'](_0xac93('0x18'),_0x12abb8,_0x1828e9[_0xac93('0x19')](_0xac93('0x1a')),_0x4c2e0a[_0xac93('0x1d')]);_0x2d47fa['stop']();});};};
\ No newline at end of file
index 9af92f3..a7d5316 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x529e=['membername','interface','calleridnum','connectedlinenum','lastevent','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwTimeout','request','CreateVoiceAgentReport','agentcalled','destchannel','assign','now','agentringnoanswer','isNil','queuecallerabandon','forIn','abandon','agentconnect','connect','answered_elsewhere','destuniqueid','cdr','transfererchannel','origtransfererchannel','clone','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','secondtransfererchannel','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','destinationchannel','agentconnectAt','endtime','agentcalledAt','diffTime','complete','answertime','starttime','unknown','lodash','info','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel'];(function(_0x29a8c8,_0x1150f1){var _0x5ed8ce=function(_0x203b7d){while(--_0x203b7d){_0x29a8c8['push'](_0x29a8c8['shift']());}};_0x5ed8ce(++_0x1150f1);}(_0x529e,0x139));var _0xe529=function(_0x1a308a,_0x46b3e9){_0x1a308a=_0x1a308a-0x0;var _0xe17c1e=_0x529e[_0x1a308a];return _0xe17c1e;};'use strict';var _=require(_0xe529('0x0'));var util=require('util');var utils=require('./utils');var agents={};var transfers={};function writeDB(_0x4cba89){utils[_0xe529('0x1')](util['format'](_0xe529('0x2'),_0x4cba89[_0xe529('0x3')],_0x4cba89[_0xe529('0x4')],_0x4cba89['queue'],_0x4cba89[_0xe529('0x5')],_0x4cba89[_0xe529('0x6')],_0x4cba89[_0xe529('0x7')],_0x4cba89[_0xe529('0x8')],_0x4cba89[_0xe529('0x9')]));if(_0x4cba89[_0xe529('0xa')]){utils[_0xe529('0xb')](_0x4cba89['queue'])[_0xe529('0xc')](function(_0x5496d4){if(_0x5496d4){_0x4cba89[_0xe529('0xd')]=_0x5496d4[_0xe529('0xd')];_0x4cba89[_0xe529('0xe')]=_0x4cba89[_0xe529('0xf')]?_0x5496d4[_0xe529('0x10')]:![];_0x4cba89['acwtime']=_0x4cba89[_0xe529('0xe')]?_0x5496d4[_0xe529('0x11')]:null;}utils[_0xe529('0x12')](_0xe529('0x13'),_0x4cba89);});}else{utils[_0xe529('0x12')](_0xe529('0x13'),_0x4cba89);}delete agents[_0x4cba89['destchannel']];}function isClosed(_0x351fd0){return _0x351fd0['agentringnoanswer']||_0x351fd0['agentconnect']||_0x351fd0['agentcomplete'];}exports[_0xe529('0x14')]=function(_0x4af927){agents[_0x4af927[_0xe529('0x15')]]=_[_0xe529('0x16')](_0x4af927,{'agentcalled':!![],'agentcalledAt':utils[_0xe529('0x17')](),'lastevent':'called'});};exports[_0xe529('0x18')]=function(_0x2bed06){if(!_[_0xe529('0x19')](agents[_0x2bed06[_0xe529('0x15')]])){agents[_0x2bed06[_0xe529('0x15')]]=_[_0xe529('0x16')](agents[_0x2bed06[_0xe529('0x15')]],_0x2bed06,{'agentringnoanswer':!![],'agentringnoanswerAt':utils['now'](),'lastevent':'rejected','reason':'rejected'});}};exports[_0xe529('0x1a')]=function(_0x5c266d){_[_0xe529('0x1b')](agents,function(_0x30cc0e,_0x2c74b4){if(_0x30cc0e[_0xe529('0x4')]==_0x5c266d[_0xe529('0x4')]){if(!isClosed(_0x30cc0e)){_0x30cc0e=_[_0xe529('0x16')](_0x30cc0e,{'agentringnoanswer':!![],'agentringnoanswerAt':utils[_0xe529('0x17')](),'lastevent':_0xe529('0x1c'),'reason':_0xe529('0x1c')});}}});};exports[_0xe529('0x1d')]=function(_0x2e7b81){if(!_[_0xe529('0x19')](agents[_0x2e7b81[_0xe529('0x15')]])){agents[_0x2e7b81[_0xe529('0x15')]]=_[_0xe529('0x16')](agents[_0x2e7b81[_0xe529('0x15')]],_0x2e7b81,{'agentconnect':!![],'agentconnectAt':utils['now'](),'lastevent':_0xe529('0x1e')});_[_0xe529('0x1b')](agents,function(_0x4c02f6,_0x5f21c2){if(_0x4c02f6[_0xe529('0x4')]==_0x2e7b81[_0xe529('0x4')]){if(!isClosed(_0x4c02f6)){_0x4c02f6=_[_0xe529('0x16')](_0x4c02f6,{'agentringnoanswer':!![],'agentringnoanswerAt':utils[_0xe529('0x17')](),'lastevent':_0xe529('0x1f'),'reason':'answered_elsewhere','answeredelsewheredestinationuniqueid':_0x2e7b81[_0xe529('0x20')],'answeredelsewheremembername':_0x2e7b81[_0xe529('0x5')]});}}});}};exports[_0xe529('0xf')]=function(_0x11719d){if(!_['isNil'](agents[_0x11719d[_0xe529('0x15')]])){agents[_0x11719d[_0xe529('0x15')]]=_[_0xe529('0x16')](agents[_0x11719d['destchannel']],_0x11719d,{'agentcomplete':!![],'agentcompleteAt':utils[_0xe529('0x17')](),'lastevent':'complete'});}};exports['blindtransfer']=function(_0x2ab795){if(!_[_0xe529('0x19')](agents[_0x2ab795['transfererchannel']])){this[_0xe529('0x21')]({'destinationchannel':_0x2ab795[_0xe529('0x22')]});}};exports['attendedtransfer']=function(_0x39c689){_[_0xe529('0x1b')](agents,function(_0x4d544c){if(_0x4d544c[_0xe529('0x4')]==_0x39c689[_0xe529('0x23')]){transfers[_0x4d544c[_0xe529('0x15')]]=_[_0xe529('0x24')](_0x4d544c);transfers[_0x4d544c[_0xe529('0x15')]]=_['assign'](transfers[_0x4d544c[_0xe529('0x15')]],{'channel':_0x39c689[_0xe529('0x25')],'calleridname':_0x39c689[_0xe529('0x26')],'calleridnum':_0x39c689[_0xe529('0x27')]});}else if(_0x4d544c[_0xe529('0x4')]==_0x39c689[_0xe529('0x28')]){transfers[_0x4d544c[_0xe529('0x15')]]=_[_0xe529('0x24')](_0x4d544c);transfers[_0x4d544c[_0xe529('0x15')]]=_[_0xe529('0x16')](transfers[_0x4d544c[_0xe529('0x15')]],{'channel':_0x39c689[_0xe529('0x29')],'calleridname':_0x39c689[_0xe529('0x2a')],'calleridnum':_0x39c689[_0xe529('0x2b')]});}});};exports[_0xe529('0x21')]=function(_0x21cea0){if(!_[_0xe529('0x19')](agents[_0x21cea0['destinationchannel']])){if(!_[_0xe529('0x19')](agents[_0x21cea0[_0xe529('0x2c')]][_0xe529('0x2d')])){agents[_0x21cea0[_0xe529('0x2c')]]=_[_0xe529('0x16')](agents[_0x21cea0[_0xe529('0x2c')]],{'agentcomplete':!![],'agentcompleteAt':_0x21cea0[_0xe529('0x2e')],'holdtime':utils['diffTime'](agents[_0x21cea0[_0xe529('0x2c')]][_0xe529('0x2d')],agents[_0x21cea0[_0xe529('0x2c')]][_0xe529('0x2f')]),'talktime':utils[_0xe529('0x30')](_0x21cea0['endtime'],agents[_0x21cea0['destinationchannel']][_0xe529('0x2d')]),'lastevent':_0xe529('0x31')});}else if(_['isNil'](agents[_0x21cea0[_0xe529('0x2c')]]['agentringnoanswerAt'])){agents[_0x21cea0[_0xe529('0x2c')]]=_[_0xe529('0x16')](agents[_0x21cea0[_0xe529('0x2c')]],{'agentringnoanswer':!![],'agentringnoanswerAt':_0x21cea0[_0xe529('0x32')]||_0x21cea0[_0xe529('0x33')],'reason':_0xe529('0x34')});}writeDB(agents[_0x21cea0['destinationchannel']]);if(!_[_0xe529('0x19')](transfers[_0x21cea0[_0xe529('0x2c')]])){agents[_0x21cea0[_0xe529('0x2c')]]=_[_0xe529('0x16')](transfers[_0x21cea0['destinationchannel']],{'agentcalledAt':utils['now'](),'agentconnectAt':transfers[_0x21cea0[_0xe529('0x2c')]][_0xe529('0x1d')]?utils[_0xe529('0x17')]():null,'lastevent':_0xe529('0x1e'),'reason':'transfer'});delete transfers[_0x21cea0[_0xe529('0x2c')]];}}};
\ No newline at end of file
+var _0xc0bc=['transfereecalleridname','cdr','destinationchannel','endtime','diffTime','agentconnectAt','agentringnoanswerAt','answertime','unknown','lodash','./utils','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','membername','interface','calleridnum','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwTimeout','request','CreateVoiceAgentReport','destchannel','agentconnect','agentcalled','called','agentringnoanswer','isNil','now','rejected','forIn','abandon','connect','assign','answered_elsewhere','destuniqueid','complete','transfererchannel','attendedtransfer','origtransfererchannel','clone','transfertargetchannel','transfertargetcalleridname','secondtransfererchannel','transfereechannel'];(function(_0x166bc3,_0x1a7fe9){var _0x48a9a0=function(_0x59a1d4){while(--_0x59a1d4){_0x166bc3['push'](_0x166bc3['shift']());}};_0x48a9a0(++_0x1a7fe9);}(_0xc0bc,0xd1));var _0xcc0b=function(_0x1786a3,_0x3cec76){_0x1786a3=_0x1786a3-0x0;var _0x3b95f5=_0xc0bc[_0x1786a3];return _0x3b95f5;};'use strict';var _=require(_0xcc0b('0x0'));var util=require('util');var utils=require(_0xcc0b('0x1'));var agents={};var transfers={};function writeDB(_0x2d9902){utils['info'](util['format'](_0xcc0b('0x2'),_0x2d9902[_0xcc0b('0x3')],_0x2d9902[_0xcc0b('0x4')],_0x2d9902[_0xcc0b('0x5')],_0x2d9902[_0xcc0b('0x6')],_0x2d9902[_0xcc0b('0x7')],_0x2d9902[_0xcc0b('0x8')],_0x2d9902['connectedlinenum'],_0x2d9902['lastevent']));if(_0x2d9902[_0xcc0b('0x5')]){utils[_0xcc0b('0x9')](_0x2d9902[_0xcc0b('0x5')])[_0xcc0b('0xa')](function(_0x48ca6f){if(_0x48ca6f){_0x2d9902['type']=_0x48ca6f[_0xcc0b('0xb')];_0x2d9902[_0xcc0b('0xc')]=_0x2d9902[_0xcc0b('0xd')]?_0x48ca6f[_0xcc0b('0xe')]:![];_0x2d9902['acwtime']=_0x2d9902[_0xcc0b('0xc')]?_0x48ca6f[_0xcc0b('0xf')]:null;}utils[_0xcc0b('0x10')](_0xcc0b('0x11'),_0x2d9902);});}else{utils[_0xcc0b('0x10')]('CreateVoiceAgentReport',_0x2d9902);}delete agents[_0x2d9902[_0xcc0b('0x12')]];}function isClosed(_0x29a40a){return _0x29a40a['agentringnoanswer']||_0x29a40a[_0xcc0b('0x13')]||_0x29a40a['agentcomplete'];}exports[_0xcc0b('0x14')]=function(_0x78cef9){agents[_0x78cef9[_0xcc0b('0x12')]]=_['assign'](_0x78cef9,{'agentcalled':!![],'agentcalledAt':utils['now'](),'lastevent':_0xcc0b('0x15')});};exports[_0xcc0b('0x16')]=function(_0x479773){if(!_[_0xcc0b('0x17')](agents[_0x479773[_0xcc0b('0x12')]])){agents[_0x479773[_0xcc0b('0x12')]]=_['assign'](agents[_0x479773[_0xcc0b('0x12')]],_0x479773,{'agentringnoanswer':!![],'agentringnoanswerAt':utils[_0xcc0b('0x18')](),'lastevent':_0xcc0b('0x19'),'reason':_0xcc0b('0x19')});}};exports['queuecallerabandon']=function(_0x447875){_[_0xcc0b('0x1a')](agents,function(_0x24ffb5,_0x2afbfa){if(_0x24ffb5['channel']==_0x447875['channel']){if(!isClosed(_0x24ffb5)){_0x24ffb5=_['assign'](_0x24ffb5,{'agentringnoanswer':!![],'agentringnoanswerAt':utils[_0xcc0b('0x18')](),'lastevent':_0xcc0b('0x1b'),'reason':_0xcc0b('0x1b')});}}});};exports['agentconnect']=function(_0x1158f7){if(!_['isNil'](agents[_0x1158f7[_0xcc0b('0x12')]])){agents[_0x1158f7[_0xcc0b('0x12')]]=_['assign'](agents[_0x1158f7[_0xcc0b('0x12')]],_0x1158f7,{'agentconnect':!![],'agentconnectAt':utils[_0xcc0b('0x18')](),'lastevent':_0xcc0b('0x1c')});_[_0xcc0b('0x1a')](agents,function(_0x29dc1c,_0x52636c){if(_0x29dc1c[_0xcc0b('0x4')]==_0x1158f7[_0xcc0b('0x4')]){if(!isClosed(_0x29dc1c)){_0x29dc1c=_[_0xcc0b('0x1d')](_0x29dc1c,{'agentringnoanswer':!![],'agentringnoanswerAt':utils[_0xcc0b('0x18')](),'lastevent':_0xcc0b('0x1e'),'reason':_0xcc0b('0x1e'),'answeredelsewheredestinationuniqueid':_0x1158f7[_0xcc0b('0x1f')],'answeredelsewheremembername':_0x1158f7['membername']});}}});}};exports['agentcomplete']=function(_0x2d4ea2){if(!_[_0xcc0b('0x17')](agents[_0x2d4ea2[_0xcc0b('0x12')]])){agents[_0x2d4ea2[_0xcc0b('0x12')]]=_[_0xcc0b('0x1d')](agents[_0x2d4ea2[_0xcc0b('0x12')]],_0x2d4ea2,{'agentcomplete':!![],'agentcompleteAt':utils['now'](),'lastevent':_0xcc0b('0x20')});}};exports['blindtransfer']=function(_0x1238cf){if(!_['isNil'](agents[_0x1238cf['transfererchannel']])){this['cdr']({'destinationchannel':_0x1238cf[_0xcc0b('0x21')]});}};exports[_0xcc0b('0x22')]=function(_0x21e482){_[_0xcc0b('0x1a')](agents,function(_0x535338){if(_0x535338[_0xcc0b('0x4')]==_0x21e482[_0xcc0b('0x23')]){transfers[_0x535338['destchannel']]=_[_0xcc0b('0x24')](_0x535338);transfers[_0x535338[_0xcc0b('0x12')]]=_[_0xcc0b('0x1d')](transfers[_0x535338[_0xcc0b('0x12')]],{'channel':_0x21e482[_0xcc0b('0x25')],'calleridname':_0x21e482[_0xcc0b('0x26')],'calleridnum':_0x21e482['transfertargetconnectedlinenum']});}else if(_0x535338['channel']==_0x21e482[_0xcc0b('0x27')]){transfers[_0x535338['destchannel']]=_[_0xcc0b('0x24')](_0x535338);transfers[_0x535338[_0xcc0b('0x12')]]=_['assign'](transfers[_0x535338['destchannel']],{'channel':_0x21e482[_0xcc0b('0x28')],'calleridname':_0x21e482[_0xcc0b('0x29')],'calleridnum':_0x21e482['transfereeconnectedlinenum']});}});};exports[_0xcc0b('0x2a')]=function(_0x2ff760){if(!_[_0xcc0b('0x17')](agents[_0x2ff760['destinationchannel']])){if(!_['isNil'](agents[_0x2ff760[_0xcc0b('0x2b')]]['agentconnectAt'])){agents[_0x2ff760['destinationchannel']]=_['assign'](agents[_0x2ff760[_0xcc0b('0x2b')]],{'agentcomplete':!![],'agentcompleteAt':_0x2ff760[_0xcc0b('0x2c')],'holdtime':utils[_0xcc0b('0x2d')](agents[_0x2ff760[_0xcc0b('0x2b')]]['agentconnectAt'],agents[_0x2ff760[_0xcc0b('0x2b')]]['agentcalledAt']),'talktime':utils[_0xcc0b('0x2d')](_0x2ff760[_0xcc0b('0x2c')],agents[_0x2ff760[_0xcc0b('0x2b')]][_0xcc0b('0x2e')]),'lastevent':_0xcc0b('0x20')});}else if(_[_0xcc0b('0x17')](agents[_0x2ff760[_0xcc0b('0x2b')]][_0xcc0b('0x2f')])){agents[_0x2ff760[_0xcc0b('0x2b')]]=_[_0xcc0b('0x1d')](agents[_0x2ff760['destinationchannel']],{'agentringnoanswer':!![],'agentringnoanswerAt':_0x2ff760[_0xcc0b('0x30')]||_0x2ff760['starttime'],'reason':_0xcc0b('0x31')});}writeDB(agents[_0x2ff760[_0xcc0b('0x2b')]]);if(!_['isNil'](transfers[_0x2ff760[_0xcc0b('0x2b')]])){agents[_0x2ff760[_0xcc0b('0x2b')]]=_[_0xcc0b('0x1d')](transfers[_0x2ff760['destinationchannel']],{'agentcalledAt':utils['now'](),'agentconnectAt':transfers[_0x2ff760[_0xcc0b('0x2b')]][_0xcc0b('0x13')]?utils[_0xcc0b('0x18')]():null,'lastevent':_0xcc0b('0x1c'),'reason':'transfer'});delete transfers[_0x2ff760[_0xcc0b('0x2b')]];}}};
\ No newline at end of file
index 9b80aa1..479af9f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc7e5=['set','appdata','cdr','split','substring','lastIndexOf','destaccountcode','assign','isBefore','starttime','isAfter','endtime','Local/_attended@transfer','destinationchannel','duration','billableseconds','lastdata','lodash','util','./utils','answertime','uniqueid','channel','type','accountcode','callerid','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','isNil','linkedid','musiconholdstart','musiconholdstartAt','now','musiconholdstop','mohtime','diffTime','variable','xmd-originatecalleridnum','value','xmd-phone','xmd-callerid-preview','xmd-queue','lastapplication','queue','xmd-contactid','ContactId','routeid','newexten','application','toLowerCase'];(function(_0x1fba72,_0x3ab42f){var _0x419e98=function(_0x10ddf3){while(--_0x10ddf3){_0x1fba72['push'](_0x1fba72['shift']());}};_0x419e98(++_0x3ab42f);}(_0xc7e5,0x1c1));var _0x5c7e=function(_0x3a82b6,_0x525f8d){_0x3a82b6=_0x3a82b6-0x0;var _0x4ba1ee=_0xc7e5[_0x3a82b6];return _0x4ba1ee;};'use strict';var _=require(_0x5c7e('0x0'));var util=require(_0x5c7e('0x1'));var utils=require(_0x5c7e('0x2'));var channels={};var timeouts={};function writeDB(_0x4e1a21){return function(){_0x4e1a21[_0x5c7e('0x3')]=_0x4e1a21[_0x5c7e('0x3')]||null;utils['info'](util['format']('CALL|%s|%s|%s|%s|%s|%s|%s|%s',_0x4e1a21[_0x5c7e('0x4')],_0x4e1a21[_0x5c7e('0x5')],_0x4e1a21[_0x5c7e('0x6')],_0x4e1a21[_0x5c7e('0x7')],_0x4e1a21['source'],_0x4e1a21['destination'],_0x4e1a21[_0x5c7e('0x8')],_0x4e1a21['disposition']));if(_0x4e1a21['accountcode']){utils[_0x5c7e('0x9')](_0x4e1a21[_0x5c7e('0x7')])[_0x5c7e('0xa')](function(_0x36d18b){if(_0x36d18b){_0x4e1a21[_0x5c7e('0xb')]=_0x36d18b['id'];}utils[_0x5c7e('0xc')](_0x5c7e('0xd'),_0x4e1a21);});}else{utils[_0x5c7e('0xc')]('CreateVoiceCallReport',_0x4e1a21);}if(channels[_0x4e1a21[_0x5c7e('0x5')]]){delete channels[_0x4e1a21['channel']];}if(timeouts[_0x4e1a21[_0x5c7e('0x5')]]){delete timeouts[_0x4e1a21[_0x5c7e('0x5')]];}};}exports[_0x5c7e('0xe')]=function(_0x51e86c){if(_[_0x5c7e('0xf')](channels[_0x51e86c[_0x5c7e('0x5')]])&&_0x51e86c[_0x5c7e('0x4')]==_0x51e86c[_0x5c7e('0x10')]){channels[_0x51e86c[_0x5c7e('0x5')]]={'mohtime':0x0};if(_0x51e86c[_0x5c7e('0x7')]){channels[_0x51e86c['channel']][_0x5c7e('0x7')]=_0x51e86c[_0x5c7e('0x7')];}}};exports[_0x5c7e('0x11')]=function(_0x21e0ee){if(!_[_0x5c7e('0xf')](channels[_0x21e0ee[_0x5c7e('0x5')]])){channels[_0x21e0ee[_0x5c7e('0x5')]][_0x5c7e('0x12')]=utils[_0x5c7e('0x13')]();}};exports[_0x5c7e('0x14')]=function(_0x157fe7){if(!_[_0x5c7e('0xf')](channels[_0x157fe7['channel']])){if(!_[_0x5c7e('0xf')](channels[_0x157fe7[_0x5c7e('0x5')]]['musiconholdstartAt'])){channels[_0x157fe7[_0x5c7e('0x5')]][_0x5c7e('0x15')]+=utils[_0x5c7e('0x16')](utils[_0x5c7e('0x13')](),channels[_0x157fe7['channel']][_0x5c7e('0x12')]);delete channels[_0x157fe7[_0x5c7e('0x5')]][_0x5c7e('0x12')];}}};exports['varset']=function(_0x2f82e7){if(!_[_0x5c7e('0xf')](channels[_0x2f82e7['channel']])){if(!_['isNil'](_0x2f82e7[_0x5c7e('0x17')][_0x5c7e('0x18')])){channels[_0x2f82e7['channel']]['source']=_0x2f82e7[_0x5c7e('0x19')];}if(!_[_0x5c7e('0xf')](_0x2f82e7['variable'][_0x5c7e('0x1a')])){channels[_0x2f82e7[_0x5c7e('0x5')]]['destination']=_0x2f82e7[_0x5c7e('0x19')];}if(!_[_0x5c7e('0xf')](_0x2f82e7[_0x5c7e('0x17')][_0x5c7e('0x1b')])||!_[_0x5c7e('0xf')](_0x2f82e7[_0x5c7e('0x17')]['xmd-callerid'])){channels[_0x2f82e7[_0x5c7e('0x5')]][_0x5c7e('0x8')]=_0x2f82e7[_0x5c7e('0x19')];}if(!_[_0x5c7e('0xf')](_0x2f82e7[_0x5c7e('0x17')][_0x5c7e('0x1c')])){channels[_0x2f82e7[_0x5c7e('0x5')]][_0x5c7e('0x1d')]='Queue';channels[_0x2f82e7[_0x5c7e('0x5')]]['lastdata']=_0x2f82e7[_0x5c7e('0x19')];channels[_0x2f82e7[_0x5c7e('0x5')]][_0x5c7e('0x1e')]=!![];}if(!_[_0x5c7e('0xf')](_0x2f82e7[_0x5c7e('0x17')][_0x5c7e('0x1f')])){channels[_0x2f82e7[_0x5c7e('0x5')]][_0x5c7e('0x20')]=_0x2f82e7['value'];}if(!_[_0x5c7e('0xf')](_0x2f82e7['variable']['outboundrouteid'])){channels[_0x2f82e7[_0x5c7e('0x5')]][_0x5c7e('0x21')]=_0x2f82e7[_0x5c7e('0x19')];}}};exports[_0x5c7e('0x22')]=function(_0x3de54e){if(!_['isNil'](channels[_0x3de54e[_0x5c7e('0x5')]])){if(_0x3de54e[_0x5c7e('0x23')][_0x5c7e('0x24')]()==_0x5c7e('0x25')&&_['startsWith'](_0x3de54e[_0x5c7e('0x26')][_0x5c7e('0x24')](),_0x5c7e('0x27'))){var _0x32c90a=_0x3de54e['appdata'][_0x5c7e('0x28')]('=');var _0x3776d6=_0x32c90a[0x0][_0x5c7e('0x29')](_0x32c90a[0x0][_0x5c7e('0x2a')]('(')+0x1,_0x32c90a[0x0][_0x5c7e('0x2a')](')'));var _0x4f380d=_0x32c90a[0x1];channels[_0x3de54e['channel']][_0x3776d6]=_0x4f380d;}}};exports['agentcomplete']=function(_0x2f548a){if(!_[_0x5c7e('0xf')](channels[_0x2f548a['channel']])){channels[_0x2f548a['channel']][_0x5c7e('0x7')]=_0x2f548a[_0x5c7e('0x2b')];}};function handleCDR(_0x57f91e){if(_[_0x5c7e('0xf')](timeouts[_0x57f91e['channel']])){channels[_0x57f91e['channel']]=_[_0x5c7e('0x2c')](_0x57f91e,channels[_0x57f91e['channel']]);}else{clearTimeout(timeouts[_0x57f91e['channel']]);channels[_0x57f91e[_0x5c7e('0x5')]]=_['assign'](channels[_0x57f91e[_0x5c7e('0x5')]],{'starttime':utils[_0x5c7e('0x2d')](_0x57f91e[_0x5c7e('0x2e')],channels[_0x57f91e[_0x5c7e('0x5')]]['starttime'])?_0x57f91e[_0x5c7e('0x2e')]:channels[_0x57f91e[_0x5c7e('0x5')]][_0x5c7e('0x2e')],'answertime':utils[_0x5c7e('0x2d')](_0x57f91e['answertime'],channels[_0x57f91e[_0x5c7e('0x5')]][_0x5c7e('0x3')])?_0x57f91e[_0x5c7e('0x3')]:channels[_0x57f91e[_0x5c7e('0x5')]]['answertime']});if(utils[_0x5c7e('0x2f')](_0x57f91e['endtime'],channels[_0x57f91e[_0x5c7e('0x5')]][_0x5c7e('0x30')])){channels[_0x57f91e[_0x5c7e('0x5')]]=_[_0x5c7e('0x2c')](channels[_0x57f91e[_0x5c7e('0x5')]],{'endtime':_0x57f91e[_0x5c7e('0x30')],'destinationchannel':_['startsWith'](_0x57f91e['destinationchannel'],_0x5c7e('0x31'))?channels[_0x57f91e[_0x5c7e('0x5')]][_0x5c7e('0x32')]:_0x57f91e[_0x5c7e('0x32')]});}channels[_0x57f91e[_0x5c7e('0x5')]][_0x5c7e('0x33')]=utils[_0x5c7e('0x16')](channels[_0x57f91e['channel']][_0x5c7e('0x30')],channels[_0x57f91e[_0x5c7e('0x5')]][_0x5c7e('0x2e')]);channels[_0x57f91e[_0x5c7e('0x5')]][_0x5c7e('0x34')]=utils[_0x5c7e('0x16')](channels[_0x57f91e['channel']][_0x5c7e('0x30')],channels[_0x57f91e[_0x5c7e('0x5')]]['answertime']);if(_0x57f91e['lastapplication'][_0x5c7e('0x24')]()!='hangup'){channels[_0x57f91e[_0x5c7e('0x5')]][_0x5c7e('0x35')]=_0x57f91e['lastdata'];channels[_0x57f91e[_0x5c7e('0x5')]][_0x5c7e('0x1d')]=_0x57f91e[_0x5c7e('0x1d')];}}timeouts[_0x57f91e['channel']]=setTimeout(writeDB(channels[_0x57f91e['channel']]),0x3e8);}exports[_0x5c7e('0x27')]=function(_0x5a642f){if(!_['isNil'](channels[_0x5a642f[_0x5c7e('0x5')]])){handleCDR(_0x5a642f);}else if(!_[_0x5c7e('0xf')](channels[_0x5a642f[_0x5c7e('0x32')]])){_0x5a642f['channel']=_0x5a642f['destinationchannel'];handleCDR(_0x5a642f);}};
\ No newline at end of file
+var _0xe337=['linkedid','isNil','musiconholdstartAt','now','musiconholdstop','mohtime','diffTime','varset','variable','xmd-originatecalleridnum','value','xmd-callerid-preview','xmd-queue','lastapplication','lastdata','queue','xmd-contactid','outboundrouteid','routeid','newexten','application','toLowerCase','set','appdata','lastIndexOf','agentcomplete','assign','isBefore','starttime','isAfter','endtime','startsWith','destinationchannel','hangup','cdr','answertime','info','format','uniqueid','type','accountcode','source','destination','callerid','disposition','then','UserId','request','CreateVoiceCallReport','channel'];(function(_0x34d346,_0x4c6502){var _0x122d76=function(_0x22a5fd){while(--_0x22a5fd){_0x34d346['push'](_0x34d346['shift']());}};_0x122d76(++_0x4c6502);}(_0xe337,0x181));var _0x7e33=function(_0x1f69bc,_0xaffd71){_0x1f69bc=_0x1f69bc-0x0;var _0x1ac3c5=_0xe337[_0x1f69bc];return _0x1ac3c5;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var channels={};var timeouts={};function writeDB(_0x452b59){return function(){_0x452b59[_0x7e33('0x0')]=_0x452b59[_0x7e33('0x0')]||null;utils[_0x7e33('0x1')](util[_0x7e33('0x2')]('CALL|%s|%s|%s|%s|%s|%s|%s|%s',_0x452b59[_0x7e33('0x3')],_0x452b59['channel'],_0x452b59[_0x7e33('0x4')],_0x452b59[_0x7e33('0x5')],_0x452b59[_0x7e33('0x6')],_0x452b59[_0x7e33('0x7')],_0x452b59[_0x7e33('0x8')],_0x452b59[_0x7e33('0x9')]));if(_0x452b59['accountcode']){utils['getUserByInternal'](_0x452b59[_0x7e33('0x5')])[_0x7e33('0xa')](function(_0xa57e60){if(_0xa57e60){_0x452b59[_0x7e33('0xb')]=_0xa57e60['id'];}utils[_0x7e33('0xc')](_0x7e33('0xd'),_0x452b59);});}else{utils[_0x7e33('0xc')](_0x7e33('0xd'),_0x452b59);}if(channels[_0x452b59[_0x7e33('0xe')]]){delete channels[_0x452b59[_0x7e33('0xe')]];}if(timeouts[_0x452b59[_0x7e33('0xe')]]){delete timeouts[_0x452b59['channel']];}};}exports['newchannel']=function(_0x374e8f){if(_['isNil'](channels[_0x374e8f[_0x7e33('0xe')]])&&_0x374e8f[_0x7e33('0x3')]==_0x374e8f[_0x7e33('0xf')]){channels[_0x374e8f[_0x7e33('0xe')]]={'mohtime':0x0};if(_0x374e8f[_0x7e33('0x5')]){channels[_0x374e8f[_0x7e33('0xe')]][_0x7e33('0x5')]=_0x374e8f[_0x7e33('0x5')];}}};exports['musiconholdstart']=function(_0x4f8947){if(!_[_0x7e33('0x10')](channels[_0x4f8947[_0x7e33('0xe')]])){channels[_0x4f8947[_0x7e33('0xe')]][_0x7e33('0x11')]=utils[_0x7e33('0x12')]();}};exports[_0x7e33('0x13')]=function(_0x2adb9c){if(!_[_0x7e33('0x10')](channels[_0x2adb9c[_0x7e33('0xe')]])){if(!_['isNil'](channels[_0x2adb9c['channel']][_0x7e33('0x11')])){channels[_0x2adb9c[_0x7e33('0xe')]][_0x7e33('0x14')]+=utils[_0x7e33('0x15')](utils[_0x7e33('0x12')](),channels[_0x2adb9c['channel']][_0x7e33('0x11')]);delete channels[_0x2adb9c[_0x7e33('0xe')]][_0x7e33('0x11')];}}};exports[_0x7e33('0x16')]=function(_0x20a6e6){if(!_[_0x7e33('0x10')](channels[_0x20a6e6[_0x7e33('0xe')]])){if(!_[_0x7e33('0x10')](_0x20a6e6[_0x7e33('0x17')][_0x7e33('0x18')])){channels[_0x20a6e6[_0x7e33('0xe')]]['source']=_0x20a6e6[_0x7e33('0x19')];}if(!_[_0x7e33('0x10')](_0x20a6e6[_0x7e33('0x17')]['xmd-phone'])){channels[_0x20a6e6[_0x7e33('0xe')]][_0x7e33('0x7')]=_0x20a6e6[_0x7e33('0x19')];}if(!_['isNil'](_0x20a6e6[_0x7e33('0x17')][_0x7e33('0x1a')])||!_['isNil'](_0x20a6e6['variable']['xmd-callerid'])){channels[_0x20a6e6[_0x7e33('0xe')]]['callerid']=_0x20a6e6[_0x7e33('0x19')];}if(!_['isNil'](_0x20a6e6[_0x7e33('0x17')][_0x7e33('0x1b')])){channels[_0x20a6e6[_0x7e33('0xe')]][_0x7e33('0x1c')]='Queue';channels[_0x20a6e6[_0x7e33('0xe')]][_0x7e33('0x1d')]=_0x20a6e6[_0x7e33('0x19')];channels[_0x20a6e6['channel']][_0x7e33('0x1e')]=!![];}if(!_[_0x7e33('0x10')](_0x20a6e6[_0x7e33('0x17')][_0x7e33('0x1f')])){channels[_0x20a6e6[_0x7e33('0xe')]]['ContactId']=_0x20a6e6[_0x7e33('0x19')];}if(!_[_0x7e33('0x10')](_0x20a6e6[_0x7e33('0x17')][_0x7e33('0x20')])){channels[_0x20a6e6[_0x7e33('0xe')]][_0x7e33('0x21')]=_0x20a6e6[_0x7e33('0x19')];}}};exports[_0x7e33('0x22')]=function(_0x5a8dd5){if(!_['isNil'](channels[_0x5a8dd5[_0x7e33('0xe')]])){if(_0x5a8dd5[_0x7e33('0x23')][_0x7e33('0x24')]()==_0x7e33('0x25')&&_['startsWith'](_0x5a8dd5[_0x7e33('0x26')][_0x7e33('0x24')](),'cdr')){var _0x881189=_0x5a8dd5[_0x7e33('0x26')]['split']('=');var _0x58ca8e=_0x881189[0x0]['substring'](_0x881189[0x0][_0x7e33('0x27')]('(')+0x1,_0x881189[0x0][_0x7e33('0x27')](')'));var _0x51e97b=_0x881189[0x1];channels[_0x5a8dd5[_0x7e33('0xe')]][_0x58ca8e]=_0x51e97b;}}};exports[_0x7e33('0x28')]=function(_0x18c747){if(!_[_0x7e33('0x10')](channels[_0x18c747['channel']])){channels[_0x18c747[_0x7e33('0xe')]][_0x7e33('0x5')]=_0x18c747['destaccountcode'];}};function handleCDR(_0x41090b){if(_['isNil'](timeouts[_0x41090b[_0x7e33('0xe')]])){channels[_0x41090b[_0x7e33('0xe')]]=_[_0x7e33('0x29')](_0x41090b,channels[_0x41090b[_0x7e33('0xe')]]);}else{clearTimeout(timeouts[_0x41090b[_0x7e33('0xe')]]);channels[_0x41090b[_0x7e33('0xe')]]=_[_0x7e33('0x29')](channels[_0x41090b[_0x7e33('0xe')]],{'starttime':utils[_0x7e33('0x2a')](_0x41090b[_0x7e33('0x2b')],channels[_0x41090b[_0x7e33('0xe')]][_0x7e33('0x2b')])?_0x41090b[_0x7e33('0x2b')]:channels[_0x41090b[_0x7e33('0xe')]][_0x7e33('0x2b')],'answertime':utils[_0x7e33('0x2a')](_0x41090b[_0x7e33('0x0')],channels[_0x41090b[_0x7e33('0xe')]][_0x7e33('0x0')])?_0x41090b[_0x7e33('0x0')]:channels[_0x41090b[_0x7e33('0xe')]]['answertime']});if(utils[_0x7e33('0x2c')](_0x41090b[_0x7e33('0x2d')],channels[_0x41090b[_0x7e33('0xe')]][_0x7e33('0x2d')])){channels[_0x41090b[_0x7e33('0xe')]]=_[_0x7e33('0x29')](channels[_0x41090b[_0x7e33('0xe')]],{'endtime':_0x41090b[_0x7e33('0x2d')],'destinationchannel':_[_0x7e33('0x2e')](_0x41090b[_0x7e33('0x2f')],'Local/_attended@transfer')?channels[_0x41090b[_0x7e33('0xe')]][_0x7e33('0x2f')]:_0x41090b['destinationchannel']});}channels[_0x41090b[_0x7e33('0xe')]]['duration']=utils[_0x7e33('0x15')](channels[_0x41090b[_0x7e33('0xe')]][_0x7e33('0x2d')],channels[_0x41090b[_0x7e33('0xe')]][_0x7e33('0x2b')]);channels[_0x41090b['channel']]['billableseconds']=utils[_0x7e33('0x15')](channels[_0x41090b[_0x7e33('0xe')]][_0x7e33('0x2d')],channels[_0x41090b['channel']][_0x7e33('0x0')]);if(_0x41090b[_0x7e33('0x1c')][_0x7e33('0x24')]()!=_0x7e33('0x30')){channels[_0x41090b[_0x7e33('0xe')]][_0x7e33('0x1d')]=_0x41090b[_0x7e33('0x1d')];channels[_0x41090b[_0x7e33('0xe')]][_0x7e33('0x1c')]=_0x41090b[_0x7e33('0x1c')];}}timeouts[_0x41090b['channel']]=setTimeout(writeDB(channels[_0x41090b[_0x7e33('0xe')]]),0x3e8);}exports[_0x7e33('0x31')]=function(_0x46882d){if(!_[_0x7e33('0x10')](channels[_0x46882d['channel']])){handleCDR(_0x46882d);}else if(!_['isNil'](channels[_0x46882d['destinationchannel']])){_0x46882d[_0x7e33('0xe')]=_0x46882d[_0x7e33('0x2f')];handleCDR(_0x46882d);}};
\ No newline at end of file
index 38913e8..375a6db 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x62a9=['FULLYBOOTED','error','close','CLOSE','managerevent','CONNECTED','shutdown','info','SHUTDOWN','fullybooted'];(function(_0x43776a,_0x4eb74c){var _0x18eb8f=function(_0x319afb){while(--_0x319afb){_0x43776a['push'](_0x43776a['shift']());}};_0x18eb8f(++_0x4eb74c);}(_0x62a9,0x1a9));var _0x962a=function(_0x58389d,_0x3137df){_0x58389d=_0x58389d-0x0;var _0x2be20a=_0x62a9[_0x58389d];return _0x2be20a;};'use strict';var utils=require('./utils');exports['connect']=function(){utils['info'](_0x962a('0x0'));};exports[_0x962a('0x1')]=function(){utils[_0x962a('0x2')](_0x962a('0x3'));};exports[_0x962a('0x4')]=function(){utils['info'](_0x962a('0x5'));};exports[_0x962a('0x6')]=function(_0x4c3179){utils[_0x962a('0x6')](_0x4c3179);};exports[_0x962a('0x7')]=function(){utils['info'](_0x962a('0x8'));};exports[_0x962a('0x9')]=function(_0x349378){};
\ No newline at end of file
+var _0x7c92=['CLOSE','managerevent','connect','info','CONNECTED','shutdown','SHUTDOWN','fullybooted','error','close'];(function(_0x5ad190,_0xd39c9e){var _0x518ed3=function(_0x57f03a){while(--_0x57f03a){_0x5ad190['push'](_0x5ad190['shift']());}};_0x518ed3(++_0xd39c9e);}(_0x7c92,0x110));var _0x27c9=function(_0x56c22c,_0x10d082){_0x56c22c=_0x56c22c-0x0;var _0xf3bdb1=_0x7c92[_0x56c22c];return _0xf3bdb1;};'use strict';var utils=require('./utils');exports[_0x27c9('0x0')]=function(){utils[_0x27c9('0x1')](_0x27c9('0x2'));};exports[_0x27c9('0x3')]=function(){utils[_0x27c9('0x1')](_0x27c9('0x4'));};exports[_0x27c9('0x5')]=function(){utils[_0x27c9('0x1')]('FULLYBOOTED');};exports[_0x27c9('0x6')]=function(_0x4543a6){utils['error'](_0x4543a6);};exports[_0x27c9('0x7')]=function(){utils['info'](_0x27c9('0x8'));};exports[_0x27c9('0x9')]=function(_0x9cc79d){};
\ No newline at end of file
index 79bfd83..c066986 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['application','toLowerCase','cdr(routeid)','appdata','split','routeid','variable','outboundrouteid','dialbegin','destcontext','from-voip-provider','assign','called','dialend','dialstatus','ANSWER','now','connect','complete','duration','diffTime','starttime','holdtime','billableseconds','answertime','lodash','util','./utils','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','isNil','newexten'];(function(_0x555ebb,_0x4b1b68){var _0x3c0a4a=function(_0x312e2f){while(--_0x312e2f){_0x555ebb['push'](_0x555ebb['shift']());}};_0x3c0a4a(++_0x4b1b68);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var utils=require(_0x0a9e('0x2'));var dials={};var channels={};function writeDB(_0x5dd881){utils['info'](util[_0x0a9e('0x3')]('DIAL|%s|%s|%s|%s|%s|%s',_0x5dd881[_0x0a9e('0x4')],_0x5dd881[_0x0a9e('0x5')],_0x5dd881[_0x0a9e('0x6')],_0x5dd881[_0x0a9e('0x7')],_0x5dd881[_0x0a9e('0x8')],_0x5dd881['dialstatus']));utils[_0x0a9e('0x9')](_0x0a9e('0xa'),_0x5dd881);delete dials[_0x5dd881[_0x0a9e('0x5')]];}exports['newchannel']=function(_0x503809){if(_[_0x0a9e('0xb')](channels[_0x503809['channel']])){channels[_0x503809['channel']]={'routeid':null};}};exports[_0x0a9e('0xc')]=function(_0xf81284){if(!_[_0x0a9e('0xb')](channels[_0xf81284[_0x0a9e('0x5')]])){if(_0xf81284[_0x0a9e('0xd')][_0x0a9e('0xe')]()=='set'&&_['startsWith'](_0xf81284['appdata']['toLowerCase'](),_0x0a9e('0xf'))){var _0x36471c=_0xf81284[_0x0a9e('0x10')][_0x0a9e('0x11')]('=');channels[_0xf81284[_0x0a9e('0x5')]][_0x0a9e('0x12')]=_0x36471c[0x1];}}};exports['varset']=function(_0x4283ce){if(!_[_0x0a9e('0xb')](channels[_0x4283ce[_0x0a9e('0x5')]])){if(!_[_0x0a9e('0xb')](_0x4283ce[_0x0a9e('0x13')][_0x0a9e('0x14')])){channels[_0x4283ce['channel']][_0x0a9e('0x12')]=_0x4283ce['value'];}}};exports[_0x0a9e('0x15')]=function(_0x519dfd){if(_0x519dfd[_0x0a9e('0x16')]==_0x0a9e('0x17')){dials[_0x519dfd['channel']]=_[_0x0a9e('0x18')](_0x519dfd,{'starttime':utils['now'](),'lastevent':_0x0a9e('0x19')});}};exports[_0x0a9e('0x1a')]=function(_0x106033){if(!_[_0x0a9e('0xb')](dials[_0x106033[_0x0a9e('0x5')]])){dials[_0x106033[_0x0a9e('0x5')]]=_[_0x0a9e('0x18')](dials[_0x106033[_0x0a9e('0x5')]],_0x106033,{'answertime':_0x106033[_0x0a9e('0x1b')]==_0x0a9e('0x1c')?utils[_0x0a9e('0x1d')]():null,'lastevent':_0x106033[_0x0a9e('0x1b')]=='ANSWER'?_0x0a9e('0x1e'):_0x0a9e('0x19')});}};exports['cdr']=function(_0x20f109){if(!_['isNil'](channels[_0x20f109['channel']])){if(!_[_0x0a9e('0xb')](dials[_0x20f109[_0x0a9e('0x5')]])){dials[_0x20f109[_0x0a9e('0x5')]]=_[_0x0a9e('0x18')](dials[_0x20f109['channel']],{'endtime':utils[_0x0a9e('0x1d')](),'routeId':channels[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x12')],'lastevent':_0x0a9e('0x1f')});dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x20')]=utils[_0x0a9e('0x21')](dials[_0x20f109['channel']]['endtime'],dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x22')]);dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x23')]=utils['diffTime'](dials[_0x20f109[_0x0a9e('0x5')]]['answertime']||dials[_0x20f109[_0x0a9e('0x5')]]['endtime'],dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x22')]);dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x24')]=dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x25')]?utils[_0x0a9e('0x21')](dials[_0x20f109[_0x0a9e('0x5')]]['endtime'],dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x25')]):0x0;writeDB(dials[_0x20f109[_0x0a9e('0x5')]]);}delete channels[_0x20f109[_0x0a9e('0x5')]];}};
\ No newline at end of file
+var _0xa9e0=['application','toLowerCase','cdr(routeid)','appdata','split','routeid','variable','outboundrouteid','dialbegin','destcontext','from-voip-provider','assign','called','dialend','dialstatus','ANSWER','now','connect','complete','duration','diffTime','starttime','holdtime','billableseconds','answertime','lodash','util','./utils','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','isNil','newexten'];(function(_0x1559a0,_0x9b8fd7){var _0x37e36f=function(_0x1bf6ad){while(--_0x1bf6ad){_0x1559a0['push'](_0x1559a0['shift']());}};_0x37e36f(++_0x9b8fd7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var utils=require(_0x0a9e('0x2'));var dials={};var channels={};function writeDB(_0x5dd881){utils['info'](util[_0x0a9e('0x3')]('DIAL|%s|%s|%s|%s|%s|%s',_0x5dd881[_0x0a9e('0x4')],_0x5dd881[_0x0a9e('0x5')],_0x5dd881[_0x0a9e('0x6')],_0x5dd881[_0x0a9e('0x7')],_0x5dd881[_0x0a9e('0x8')],_0x5dd881['dialstatus']));utils[_0x0a9e('0x9')](_0x0a9e('0xa'),_0x5dd881);delete dials[_0x5dd881[_0x0a9e('0x5')]];}exports['newchannel']=function(_0x503809){if(_[_0x0a9e('0xb')](channels[_0x503809['channel']])){channels[_0x503809['channel']]={'routeid':null};}};exports[_0x0a9e('0xc')]=function(_0xf81284){if(!_[_0x0a9e('0xb')](channels[_0xf81284[_0x0a9e('0x5')]])){if(_0xf81284[_0x0a9e('0xd')][_0x0a9e('0xe')]()=='set'&&_['startsWith'](_0xf81284['appdata']['toLowerCase'](),_0x0a9e('0xf'))){var _0x36471c=_0xf81284[_0x0a9e('0x10')][_0x0a9e('0x11')]('=');channels[_0xf81284[_0x0a9e('0x5')]][_0x0a9e('0x12')]=_0x36471c[0x1];}}};exports['varset']=function(_0x4283ce){if(!_[_0x0a9e('0xb')](channels[_0x4283ce[_0x0a9e('0x5')]])){if(!_[_0x0a9e('0xb')](_0x4283ce[_0x0a9e('0x13')][_0x0a9e('0x14')])){channels[_0x4283ce['channel']][_0x0a9e('0x12')]=_0x4283ce['value'];}}};exports[_0x0a9e('0x15')]=function(_0x519dfd){if(_0x519dfd[_0x0a9e('0x16')]==_0x0a9e('0x17')){dials[_0x519dfd['channel']]=_[_0x0a9e('0x18')](_0x519dfd,{'starttime':utils['now'](),'lastevent':_0x0a9e('0x19')});}};exports[_0x0a9e('0x1a')]=function(_0x106033){if(!_[_0x0a9e('0xb')](dials[_0x106033[_0x0a9e('0x5')]])){dials[_0x106033[_0x0a9e('0x5')]]=_[_0x0a9e('0x18')](dials[_0x106033[_0x0a9e('0x5')]],_0x106033,{'answertime':_0x106033[_0x0a9e('0x1b')]==_0x0a9e('0x1c')?utils[_0x0a9e('0x1d')]():null,'lastevent':_0x106033[_0x0a9e('0x1b')]=='ANSWER'?_0x0a9e('0x1e'):_0x0a9e('0x19')});}};exports['cdr']=function(_0x20f109){if(!_['isNil'](channels[_0x20f109['channel']])){if(!_[_0x0a9e('0xb')](dials[_0x20f109[_0x0a9e('0x5')]])){dials[_0x20f109[_0x0a9e('0x5')]]=_[_0x0a9e('0x18')](dials[_0x20f109['channel']],{'endtime':utils[_0x0a9e('0x1d')](),'routeId':channels[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x12')],'lastevent':_0x0a9e('0x1f')});dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x20')]=utils[_0x0a9e('0x21')](dials[_0x20f109['channel']]['endtime'],dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x22')]);dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x23')]=utils['diffTime'](dials[_0x20f109[_0x0a9e('0x5')]]['answertime']||dials[_0x20f109[_0x0a9e('0x5')]]['endtime'],dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x22')]);dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x24')]=dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x25')]?utils[_0x0a9e('0x21')](dials[_0x20f109[_0x0a9e('0x5')]]['endtime'],dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x25')]):0x0;writeDB(dials[_0x20f109[_0x0a9e('0x5')]]);}delete channels[_0x20f109[_0x0a9e('0x5')]];}};
\ No newline at end of file
index 48e3b49..31a202a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe3c5=['dialend','asterisk-manager','../../config/environment','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','./utils','asterisk','port','username','password','keepConnected','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin'];(function(_0x2493f7,_0x49c670){var _0x594ab2=function(_0x344ec2){while(--_0x344ec2){_0x2493f7['push'](_0x2493f7['shift']());}};_0x594ab2(++_0x49c670);}(_0xe3c5,0x17d));var _0x5e3c=function(_0x5c7525,_0x39490f){_0x5c7525=_0x5c7525-0x0;var _0x2e2ec8=_0xe3c5[_0x5c7525];return _0x2e2ec8;};var AsteriskManager=require(_0x5e3c('0x0'));var config=require(_0x5e3c('0x1'));var agents=require(_0x5e3c('0x2'));var calls=require(_0x5e3c('0x3'));var queues=require(_0x5e3c('0x4'));var recordings=require(_0x5e3c('0x5'));var members=require('./members.controller');var dials=require(_0x5e3c('0x6'));var transfers=require(_0x5e3c('0x7'));var core=require(_0x5e3c('0x8'));var utils=require(_0x5e3c('0x9'));var ami=new AsteriskManager(config[_0x5e3c('0xa')][_0x5e3c('0xb')],config[_0x5e3c('0xa')]['ip'],config[_0x5e3c('0xa')][_0x5e3c('0xc')],config[_0x5e3c('0xa')][_0x5e3c('0xd')],!![]);ami[_0x5e3c('0xe')]();ami['on']('connect',core['connect']);ami['on'](_0x5e3c('0xf'),core[_0x5e3c('0xf')]);ami['on'](_0x5e3c('0x10'),core[_0x5e3c('0x10')]);ami['on'](_0x5e3c('0x11'),core['error']);ami['on'](_0x5e3c('0x12'),core[_0x5e3c('0x12')]);ami['on']('managerevent',core[_0x5e3c('0x13')]);ami['on']('devicestatechange',function(_0x546d1f){try{members[_0x5e3c('0x14')](_0x546d1f);}catch(_0x415d96){utils[_0x5e3c('0x11')](_0x415d96);}});ami['on'](_0x5e3c('0x15'),function(_0x32efb7){try{agents[_0x5e3c('0x15')](_0x32efb7);}catch(_0x324a36){utils[_0x5e3c('0x11')](_0x324a36);}});ami['on']('agentringnoanswer',function(_0x54937f){try{agents[_0x5e3c('0x16')](_0x54937f);}catch(_0x2183ba){utils[_0x5e3c('0x11')](_0x2183ba);}});ami['on']('agentconnect',function(_0x4f7318){try{agents[_0x5e3c('0x17')](_0x4f7318);recordings[_0x5e3c('0x17')](_0x4f7318);queues[_0x5e3c('0x17')](_0x4f7318);}catch(_0x2c7c83){utils['error'](_0x2c7c83);}});ami['on']('agentcomplete',function(_0xc3635a){try{agents['agentcomplete'](_0xc3635a);queues['agentcomplete'](_0xc3635a);members[_0x5e3c('0x18')](_0xc3635a);calls['agentcomplete'](_0xc3635a);}catch(_0x5baa56){utils['error'](_0x5baa56);}});ami['on'](_0x5e3c('0x19'),function(_0x189480){try{agents['queuecallerabandon'](_0x189480);queues[_0x5e3c('0x19')](_0x189480);}catch(_0x55a5e8){utils[_0x5e3c('0x11')](_0x55a5e8);}});ami['on'](_0x5e3c('0x1a'),function(_0x1a4c88){try{queues[_0x5e3c('0x1a')](_0x1a4c88);}catch(_0x2ee7c4){utils[_0x5e3c('0x11')](_0x2ee7c4);}});ami['on'](_0x5e3c('0x1b'),function(_0x5ddd09){try{queues['queuecallerleave'](_0x5ddd09);}catch(_0x5d5ca3){utils['error'](_0x5d5ca3);}});ami['on'](_0x5e3c('0x1c'),function(_0x4754f4){try{queues[_0x5e3c('0x1c')](_0x4754f4);calls[_0x5e3c('0x1c')](_0x4754f4);}catch(_0x1a74ab){utils[_0x5e3c('0x11')](_0x1a74ab);}});ami['on']('musiconholdstop',function(_0x33b1dc){try{queues[_0x5e3c('0x1d')](_0x33b1dc);calls[_0x5e3c('0x1d')](_0x33b1dc);}catch(_0x26e86e){utils['error'](_0x26e86e);}});ami['on']('cdr',function(_0x1ae7a9){try{calls[_0x5e3c('0x1e')](_0x1ae7a9);agents['cdr'](_0x1ae7a9);queues[_0x5e3c('0x1e')](_0x1ae7a9);recordings[_0x5e3c('0x1e')](_0x1ae7a9);dials[_0x5e3c('0x1e')](_0x1ae7a9);members[_0x5e3c('0x1e')](_0x1ae7a9);}catch(_0x2163c1){utils['error'](_0x2163c1);}});ami['on'](_0x5e3c('0x1f'),function(_0x59acbb){try{queues['blindtransfer'](_0x59acbb);agents[_0x5e3c('0x1f')](_0x59acbb);transfers[_0x5e3c('0x1f')](_0x59acbb);}catch(_0xe61c3){utils[_0x5e3c('0x11')](_0xe61c3);}});ami['on']('attendedtransfer',function(_0x20d813){try{queues[_0x5e3c('0x20')](_0x20d813);transfers[_0x5e3c('0x20')](_0x20d813);agents[_0x5e3c('0x20')](_0x20d813);}catch(_0x5cd5d7){utils['error'](_0x5cd5d7);}});ami['on'](_0x5e3c('0x21'),function(_0x1ba87b){try{queues[_0x5e3c('0x21')](_0x1ba87b);recordings[_0x5e3c('0x21')](_0x1ba87b);calls['varset'](_0x1ba87b);dials[_0x5e3c('0x21')](_0x1ba87b);}catch(_0x2acef1){utils[_0x5e3c('0x11')](_0x2acef1);}});ami['on']('newexten',function(_0x3ee2d0){try{calls['newexten'](_0x3ee2d0);dials[_0x5e3c('0x22')](_0x3ee2d0);}catch(_0x3cbed8){utils[_0x5e3c('0x11')](_0x3cbed8);}});ami['on']('newchannel',function(_0x969b1e){try{calls['newchannel'](_0x969b1e);dials[_0x5e3c('0x23')](_0x969b1e);}catch(_0x3f2779){utils[_0x5e3c('0x11')](_0x3f2779);}});ami['on'](_0x5e3c('0x24'),function(_0x510c4e){try{dials[_0x5e3c('0x24')](_0x510c4e);}catch(_0x231e02){utils[_0x5e3c('0x11')](_0x231e02);}});ami['on'](_0x5e3c('0x25'),function(_0x30991b){try{dials[_0x5e3c('0x25')](_0x30991b);}catch(_0x3e18c5){utils[_0x5e3c('0x11')](_0x3e18c5);}});
\ No newline at end of file
+var _0x6b19=['fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment','./calls.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','./utils','port','asterisk','password','connect','shutdown'];(function(_0x1e0803,_0x35a203){var _0x2e7b72=function(_0x32371c){while(--_0x32371c){_0x1e0803['push'](_0x1e0803['shift']());}};_0x2e7b72(++_0x35a203);}(_0x6b19,0xe8));var _0x96b1=function(_0x12b582,_0x12b297){_0x12b582=_0x12b582-0x0;var _0x546086=_0x6b19[_0x12b582];return _0x546086;};var AsteriskManager=require(_0x96b1('0x0'));var config=require(_0x96b1('0x1'));var agents=require('./agents.controller');var calls=require(_0x96b1('0x2'));var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require(_0x96b1('0x3'));var dials=require(_0x96b1('0x4'));var transfers=require(_0x96b1('0x5'));var core=require(_0x96b1('0x6'));var utils=require(_0x96b1('0x7'));var ami=new AsteriskManager(config['asterisk'][_0x96b1('0x8')],config['asterisk']['ip'],config[_0x96b1('0x9')]['username'],config['asterisk'][_0x96b1('0xa')],!![]);ami['keepConnected']();ami['on'](_0x96b1('0xb'),core['connect']);ami['on'](_0x96b1('0xc'),core[_0x96b1('0xc')]);ami['on'](_0x96b1('0xd'),core[_0x96b1('0xd')]);ami['on'](_0x96b1('0xe'),core[_0x96b1('0xe')]);ami['on'](_0x96b1('0xf'),core['close']);ami['on']('managerevent',core[_0x96b1('0x10')]);ami['on']('devicestatechange',function(_0x5078b9){try{members[_0x96b1('0x11')](_0x5078b9);}catch(_0x18c9a0){utils[_0x96b1('0xe')](_0x18c9a0);}});ami['on']('agentcalled',function(_0x1372fd){try{agents[_0x96b1('0x12')](_0x1372fd);}catch(_0x25b1f4){utils[_0x96b1('0xe')](_0x25b1f4);}});ami['on'](_0x96b1('0x13'),function(_0x4f4150){try{agents[_0x96b1('0x13')](_0x4f4150);}catch(_0x375781){utils[_0x96b1('0xe')](_0x375781);}});ami['on'](_0x96b1('0x14'),function(_0x2cd1f5){try{agents[_0x96b1('0x14')](_0x2cd1f5);recordings[_0x96b1('0x14')](_0x2cd1f5);queues[_0x96b1('0x14')](_0x2cd1f5);}catch(_0x46c551){utils[_0x96b1('0xe')](_0x46c551);}});ami['on'](_0x96b1('0x15'),function(_0x38478c){try{agents[_0x96b1('0x15')](_0x38478c);queues[_0x96b1('0x15')](_0x38478c);members[_0x96b1('0x15')](_0x38478c);calls['agentcomplete'](_0x38478c);}catch(_0x13e891){utils['error'](_0x13e891);}});ami['on'](_0x96b1('0x16'),function(_0x2f98a2){try{agents[_0x96b1('0x16')](_0x2f98a2);queues['queuecallerabandon'](_0x2f98a2);}catch(_0xc5dc95){utils[_0x96b1('0xe')](_0xc5dc95);}});ami['on'](_0x96b1('0x17'),function(_0x4b3894){try{queues[_0x96b1('0x17')](_0x4b3894);}catch(_0x3595b7){utils[_0x96b1('0xe')](_0x3595b7);}});ami['on'](_0x96b1('0x18'),function(_0x555185){try{queues[_0x96b1('0x18')](_0x555185);}catch(_0x3b4c35){utils[_0x96b1('0xe')](_0x3b4c35);}});ami['on']('musiconholdstart',function(_0x2b4f8e){try{queues[_0x96b1('0x19')](_0x2b4f8e);calls[_0x96b1('0x19')](_0x2b4f8e);}catch(_0x20a85f){utils['error'](_0x20a85f);}});ami['on'](_0x96b1('0x1a'),function(_0x548bae){try{queues[_0x96b1('0x1a')](_0x548bae);calls['musiconholdstop'](_0x548bae);}catch(_0x6509d2){utils[_0x96b1('0xe')](_0x6509d2);}});ami['on']('cdr',function(_0x50dcbc){try{calls['cdr'](_0x50dcbc);agents[_0x96b1('0x1b')](_0x50dcbc);queues[_0x96b1('0x1b')](_0x50dcbc);recordings[_0x96b1('0x1b')](_0x50dcbc);dials[_0x96b1('0x1b')](_0x50dcbc);members[_0x96b1('0x1b')](_0x50dcbc);}catch(_0x58272c){utils[_0x96b1('0xe')](_0x58272c);}});ami['on'](_0x96b1('0x1c'),function(_0x3cadbb){try{queues[_0x96b1('0x1c')](_0x3cadbb);agents['blindtransfer'](_0x3cadbb);transfers[_0x96b1('0x1c')](_0x3cadbb);}catch(_0x33f96b){utils['error'](_0x33f96b);}});ami['on']('attendedtransfer',function(_0x3666f8){try{queues['attendedtransfer'](_0x3666f8);transfers[_0x96b1('0x1d')](_0x3666f8);agents[_0x96b1('0x1d')](_0x3666f8);}catch(_0x5cc56d){utils[_0x96b1('0xe')](_0x5cc56d);}});ami['on'](_0x96b1('0x1e'),function(_0x5cb283){try{queues[_0x96b1('0x1e')](_0x5cb283);recordings[_0x96b1('0x1e')](_0x5cb283);calls[_0x96b1('0x1e')](_0x5cb283);dials['varset'](_0x5cb283);}catch(_0x2ac0bf){utils[_0x96b1('0xe')](_0x2ac0bf);}});ami['on'](_0x96b1('0x1f'),function(_0x408158){try{calls[_0x96b1('0x1f')](_0x408158);dials[_0x96b1('0x1f')](_0x408158);}catch(_0x55c5ec){utils[_0x96b1('0xe')](_0x55c5ec);}});ami['on'](_0x96b1('0x20'),function(_0x50edd9){try{calls['newchannel'](_0x50edd9);dials[_0x96b1('0x20')](_0x50edd9);}catch(_0x1b1497){utils[_0x96b1('0xe')](_0x1b1497);}});ami['on']('dialbegin',function(_0x4ba6eb){try{dials[_0x96b1('0x21')](_0x4ba6eb);}catch(_0x3a2512){utils[_0x96b1('0xe')](_0x3a2512);}});ami['on'](_0x96b1('0x22'),function(_0x48dc7b){try{dials[_0x96b1('0x22')](_0x48dc7b);}catch(_0x4f3639){utils[_0x96b1('0xe')](_0x4f3639);}});
\ No newline at end of file
index 2610a69..eef56fa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3566=['internal','request','CreateMemberReport','then','catch','startsWith','devicestatechange','device','voice','TALKING','now','agent','NOT_INUSE','exitAt','duration','enterAt','agentcomplete','isNil','assign','queue','cdr','split','data1','source','data3','destination','lodash','./utils','info','format','uniqueid','interface','channel','data2','type','getUserByInterface','membername','name'];(function(_0x5cb27c,_0x2752ff){var _0x5938fa=function(_0x2684de){while(--_0x2684de){_0x5cb27c['push'](_0x5cb27c['shift']());}};_0x5938fa(++_0x2752ff);}(_0x3566,0x14a));var _0x6356=function(_0x38a5d8,_0x120421){_0x38a5d8=_0x38a5d8-0x0;var _0x29a5e1=_0x3566[_0x38a5d8];return _0x29a5e1;};'use strict';var _=require(_0x6356('0x0'));var util=require('util');var utils=require(_0x6356('0x1'));var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x1ef14e){utils[_0x6356('0x2')](util[_0x6356('0x3')]('MEMBER|%s|%s|%s|%s|%s|%s',_0x1ef14e[_0x6356('0x4')],_0x1ef14e[_0x6356('0x5')],_0x1ef14e[_0x6356('0x6')],_0x1ef14e[_0x6356('0x7')],_0x1ef14e['membername'],_0x1ef14e[_0x6356('0x8')]));if(_0x1ef14e['interface']){utils[_0x6356('0x9')](_0x1ef14e[_0x6356('0x5')])['then'](function(_0x4ef895){if(_0x4ef895){_0x1ef14e[_0x6356('0xa')]=_0x4ef895[_0x6356('0xb')];_0x1ef14e['internal']=_0x4ef895[_0x6356('0xc')];utils[_0x6356('0xd')](_0x6356('0xe'),_0x1ef14e);}else{utils['getUserByName'](_0x1ef14e[_0x6356('0x5')]['split']('/')[0x1])[_0x6356('0xf')](function(_0x32cf87){if(_0x32cf87){_0x1ef14e[_0x6356('0xa')]=_0x32cf87[_0x6356('0xb')];_0x1ef14e[_0x6356('0xc')]=_0x32cf87[_0x6356('0xc')];utils[_0x6356('0xd')](_0x6356('0xe'),_0x1ef14e);}});}})[_0x6356('0x10')](function(_0x2bad80){utils['error'](_0x2bad80);});}delete members[_0x1ef14e[_0x6356('0x5')]];}function startsWith(_0x103af2,_0x3317ec){return _['some'](_0x103af2,function(_0x4628f9){return _[_0x6356('0x11')](_0x3317ec,_0x4628f9);});}exports[_0x6356('0x12')]=function(_0x3efdeb){switch(_0x3efdeb['state']){case'INUSE':case'BUSY':if(!startsWith(exclude,_0x3efdeb[_0x6356('0x13')])){members[_0x3efdeb[_0x6356('0x13')]]={'channel':_0x6356('0x14'),'interface':_0x3efdeb[_0x6356('0x13')],'type':_0x6356('0x15'),'enterAt':utils[_0x6356('0x16')](),'role':_0x6356('0x17')};}break;case _0x6356('0x18'):if(!_['isNil'](members[_0x3efdeb[_0x6356('0x13')]])){members[_0x3efdeb[_0x6356('0x13')]][_0x6356('0x19')]=utils[_0x6356('0x16')]();members[_0x3efdeb['device']][_0x6356('0x1a')]=utils['diffTime'](members[_0x3efdeb[_0x6356('0x13')]]['exitAt'],members[_0x3efdeb[_0x6356('0x13')]][_0x6356('0x1b')]);if(members[_0x3efdeb[_0x6356('0x13')]][_0x6356('0x4')]){writeDB(members[_0x3efdeb['device']]);}}default:break;}};exports[_0x6356('0x1c')]=function(_0x2c71b4){if(!_[_0x6356('0x1d')](members[_0x2c71b4[_0x6356('0x5')]])){members[_0x2c71b4[_0x6356('0x5')]]=_[_0x6356('0x1e')](members[_0x2c71b4[_0x6356('0x5')]],{'data4':_0x2c71b4[_0x6356('0x1f')]});}};exports[_0x6356('0x20')]=function(_0x23d8c4){if(_0x23d8c4[_0x6356('0x6')]){var _0x5e084b=_0x23d8c4[_0x6356('0x6')][_0x6356('0x21')]('-')[0x0];if(!_[_0x6356('0x1d')](members[_0x5e084b])){members[_0x5e084b]=_[_0x6356('0x1e')](members[_0x5e084b],{'data1':members[_0x5e084b][_0x6356('0x22')]||_0x23d8c4[_0x6356('0x8')],'data2':members[_0x5e084b]['data2']||_0x23d8c4[_0x6356('0x23')],'data3':members[_0x5e084b][_0x6356('0x24')]||_0x23d8c4[_0x6356('0x25')],'uniqueid':members[_0x5e084b][_0x6356('0x4')]||_0x23d8c4[_0x6356('0x4')]});if(members[_0x5e084b][_0x6356('0x19')]){writeDB(members[_0x5e084b]);}}}if(_0x23d8c4['destinationchannel']){var _0x316cdc=_0x23d8c4['destinationchannel'][_0x6356('0x21')]('-')[0x0];if(!_[_0x6356('0x1d')](members[_0x316cdc])){members[_0x316cdc]=_[_0x6356('0x1e')](members[_0x316cdc],{'data1':members[_0x316cdc][_0x6356('0x22')]||_0x23d8c4['type'],'data2':members[_0x316cdc][_0x6356('0x7')]||_0x23d8c4[_0x6356('0x23')],'data3':members[_0x316cdc]['data3']||_0x23d8c4[_0x6356('0x25')],'uniqueid':members[_0x316cdc][_0x6356('0x4')]||_0x23d8c4['uniqueid']});if(members[_0x316cdc][_0x6356('0x19')]){writeDB(members[_0x316cdc]);}}}};
\ No newline at end of file
+var _0x44e0=['now','agent','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','assign','queue','channel','data2','source','data3','destination','destinationchannel','lodash','util','./utils','Queue:','info','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','membername','type','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','split','name','catch','error','some','devicestatechange','INUSE','BUSY','device','TALKING'];(function(_0x316bdb,_0x2fcfa1){var _0x2262cb=function(_0x503d16){while(--_0x503d16){_0x316bdb['push'](_0x316bdb['shift']());}};_0x2262cb(++_0x2fcfa1);}(_0x44e0,0x18a));var _0x044e=function(_0x33041f,_0x7edb27){_0x33041f=_0x33041f-0x0;var _0x1f8f80=_0x44e0[_0x33041f];return _0x1f8f80;};'use strict';var _=require(_0x044e('0x0'));var util=require(_0x044e('0x1'));var utils=require(_0x044e('0x2'));var members={};var exclude=['Local/_attended@transfer',_0x044e('0x3')];function writeDB(_0x2063e7){utils[_0x044e('0x4')](util['format'](_0x044e('0x5'),_0x2063e7[_0x044e('0x6')],_0x2063e7[_0x044e('0x7')],_0x2063e7['channel'],_0x2063e7['data2'],_0x2063e7[_0x044e('0x8')],_0x2063e7[_0x044e('0x9')]));if(_0x2063e7['interface']){utils[_0x044e('0xa')](_0x2063e7[_0x044e('0x7')])[_0x044e('0xb')](function(_0x115674){if(_0x115674){_0x2063e7[_0x044e('0x8')]=_0x115674['name'];_0x2063e7[_0x044e('0xc')]=_0x115674['internal'];utils[_0x044e('0xd')](_0x044e('0xe'),_0x2063e7);}else{utils[_0x044e('0xf')](_0x2063e7['interface'][_0x044e('0x10')]('/')[0x1])[_0x044e('0xb')](function(_0x905123){if(_0x905123){_0x2063e7['membername']=_0x905123[_0x044e('0x11')];_0x2063e7[_0x044e('0xc')]=_0x905123['internal'];utils['request'](_0x044e('0xe'),_0x2063e7);}});}})[_0x044e('0x12')](function(_0x5a9838){utils[_0x044e('0x13')](_0x5a9838);});}delete members[_0x2063e7['interface']];}function startsWith(_0x116758,_0x4a6229){return _[_0x044e('0x14')](_0x116758,function(_0x66a0df){return _['startsWith'](_0x4a6229,_0x66a0df);});}exports[_0x044e('0x15')]=function(_0x2ece39){switch(_0x2ece39['state']){case _0x044e('0x16'):case _0x044e('0x17'):if(!startsWith(exclude,_0x2ece39['device'])){members[_0x2ece39[_0x044e('0x18')]]={'channel':'voice','interface':_0x2ece39[_0x044e('0x18')],'type':_0x044e('0x19'),'enterAt':utils[_0x044e('0x1a')](),'role':_0x044e('0x1b')};}break;case'NOT_INUSE':if(!_[_0x044e('0x1c')](members[_0x2ece39[_0x044e('0x18')]])){members[_0x2ece39['device']][_0x044e('0x1d')]=utils[_0x044e('0x1a')]();members[_0x2ece39['device']][_0x044e('0x1e')]=utils[_0x044e('0x1f')](members[_0x2ece39['device']][_0x044e('0x1d')],members[_0x2ece39[_0x044e('0x18')]][_0x044e('0x20')]);if(members[_0x2ece39[_0x044e('0x18')]]['uniqueid']){writeDB(members[_0x2ece39[_0x044e('0x18')]]);}}default:break;}};exports[_0x044e('0x21')]=function(_0x57e6d5){if(!_[_0x044e('0x1c')](members[_0x57e6d5['interface']])){members[_0x57e6d5[_0x044e('0x7')]]=_[_0x044e('0x22')](members[_0x57e6d5['interface']],{'data4':_0x57e6d5[_0x044e('0x23')]});}};exports['cdr']=function(_0x38efe0){if(_0x38efe0[_0x044e('0x24')]){var _0x96eedd=_0x38efe0['channel'][_0x044e('0x10')]('-')[0x0];if(!_['isNil'](members[_0x96eedd])){members[_0x96eedd]=_[_0x044e('0x22')](members[_0x96eedd],{'data1':members[_0x96eedd]['data1']||_0x38efe0[_0x044e('0x9')],'data2':members[_0x96eedd][_0x044e('0x25')]||_0x38efe0[_0x044e('0x26')],'data3':members[_0x96eedd][_0x044e('0x27')]||_0x38efe0[_0x044e('0x28')],'uniqueid':members[_0x96eedd][_0x044e('0x6')]||_0x38efe0[_0x044e('0x6')]});if(members[_0x96eedd][_0x044e('0x1d')]){writeDB(members[_0x96eedd]);}}}if(_0x38efe0[_0x044e('0x29')]){var _0x103a31=_0x38efe0['destinationchannel'][_0x044e('0x10')]('-')[0x0];if(!_[_0x044e('0x1c')](members[_0x103a31])){members[_0x103a31]=_['assign'](members[_0x103a31],{'data1':members[_0x103a31]['data1']||_0x38efe0[_0x044e('0x9')],'data2':members[_0x103a31][_0x044e('0x25')]||_0x38efe0[_0x044e('0x26')],'data3':members[_0x103a31][_0x044e('0x27')]||_0x38efe0['destination'],'uniqueid':members[_0x103a31][_0x044e('0x6')]||_0x38efe0[_0x044e('0x6')]});if(members[_0x103a31][_0x044e('0x1d')]){writeDB(members[_0x103a31]);}}}};
\ No newline at end of file
index 03f5dca..7cf7954 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4681=['uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','then','type','request','CreateVoiceQueueReport','queuecallerjoin','isNil','clone','assign','position','now','queuestatus','value','toUpperCase','queuecallerabandon','ABANDONED','queuecallerleave','diffTime','queuecallerjoinAt','agentconnect','connectedlinenum','connectedlinename','agentcomplete','transfer','blindtransfer','transfereechannel','BLIND','extension','transfereeuniqueid','BLINDTRANSFER','forIn','origtransfererchannel','transfertargetchannel','transfertargetcalleridname','ATTENDED','ATTENDEDTRANSFER','origtransfererexten','origtransfereruniqueid','secondtransfererchannel','transfereecalleridname','transfereecalleridnum','secondtransfererexten','secondtransfereruniqueid','musiconholdstartAt','mohtime','cdr','assigned','util','./utils','info'];(function(_0x33ba78,_0xbcaa2d){var _0x24a8a8=function(_0x2c25f5){while(--_0x2c25f5){_0x33ba78['push'](_0x33ba78['shift']());}};_0x24a8a8(++_0xbcaa2d);}(_0x4681,0x185));var _0x1468=function(_0x412dfe,_0x5228de){_0x412dfe=_0x412dfe-0x0;var _0x43c8de=_0x4681[_0x412dfe];return _0x43c8de;};'use strict';var _=require('lodash');var util=require(_0x1468('0x0'));var utils=require(_0x1468('0x1'));var queues={};var transfers={};function writeDB(_0x5ef737,_0x667ed3){utils[_0x1468('0x2')](util['format']('QUEUE|%s|%s|%s|%s|%s|%s|%s',_0x5ef737[_0x1468('0x3')],_0x5ef737[_0x1468('0x4')],_0x5ef737[_0x1468('0x5')],_0x5ef737[_0x1468('0x6')],_0x5ef737[_0x1468('0x7')],_0x5ef737[_0x1468('0x8')],_0x5ef737[_0x1468('0x9')]));if(_0x5ef737['queue']){utils['getVoiceQueueByName'](_0x5ef737[_0x1468('0x5')])[_0x1468('0xa')](function(_0x20d414){if(_0x20d414){_0x5ef737[_0x1468('0xb')]=_0x20d414[_0x1468('0xb')];}utils[_0x1468('0xc')](_0x1468('0xd'),_0x5ef737);});}else{utils[_0x1468('0xc')](_0x1468('0xd'),_0x5ef737);}if(_0x667ed3){delete queues[_0x5ef737[_0x1468('0x4')]];}}exports[_0x1468('0xe')]=function(_0x19314d){if(!_[_0x1468('0xf')](queues[_0x19314d[_0x1468('0x4')]])){writeDB(_[_0x1468('0x10')](queues[_0x19314d[_0x1468('0x4')]]),![]);}queues[_0x19314d['channel']]=_[_0x1468('0x11')](_0x19314d,{'originalposition':_0x19314d[_0x1468('0x12')],'queuecallerjoinAt':utils[_0x1468('0x13')](),'mohtime':0x0});};exports['varset']=function(_0x2c7b92){if(!_[_0x1468('0xf')](queues[_0x2c7b92['channel']])){if(!_[_0x1468('0xf')](_0x2c7b92['variable'][_0x1468('0x14')])){if(_0x2c7b92[_0x1468('0x15')]!='CONTINUE'){queues[_0x2c7b92[_0x1468('0x4')]]=_[_0x1468('0x11')](queues[_0x2c7b92['channel']],{'queuecallerabandon':![],'queuecallerabandonAt':null,'queuecallerexit':!![],'queuecallerexitAt':utils[_0x1468('0x13')](),'queuecallerexitreason':_0x2c7b92[_0x1468('0x15')][_0x1468('0x16')]()});}}}};exports[_0x1468('0x17')]=function(_0x3e8c0e){var _0x5b06b1={'queuecallerabandon':!![],'queuecallerabandonAt':utils['now'](),'queuecallerexitreason':_0x1468('0x18')};if(!_[_0x1468('0xf')](queues[_0x3e8c0e[_0x1468('0x4')]])){queues[_0x3e8c0e[_0x1468('0x4')]]=_[_0x1468('0x11')](queues[_0x3e8c0e[_0x1468('0x4')]],_0x5b06b1);}if(!_[_0x1468('0xf')](transfers[_0x3e8c0e[_0x1468('0x4')]])){transfers[_0x3e8c0e['channel']]=_['assign'](transfers[_0x3e8c0e[_0x1468('0x4')]],_0x5b06b1);}};exports[_0x1468('0x19')]=function(_0x25d2f0){if(!_['isNil'](queues[_0x25d2f0[_0x1468('0x4')]])){queues[_0x25d2f0['channel']]=_[_0x1468('0x11')](queues[_0x25d2f0['channel']],{'queuecallerleave':!![],'queuecallerleaveAt':utils[_0x1468('0x13')](),'holdtime':utils[_0x1468('0x1a')](utils[_0x1468('0x13')](),queues[_0x25d2f0[_0x1468('0x4')]][_0x1468('0x1b')])});}if(!_['isNil'](transfers[_0x25d2f0[_0x1468('0x4')]])){transfers[_0x25d2f0['channel']]=_[_0x1468('0x11')](transfers[_0x25d2f0[_0x1468('0x4')]],{'queuecallerleave':!![],'queuecallerleaveAt':utils[_0x1468('0x13')](),'holdtime':utils['diffTime'](utils[_0x1468('0x13')](),transfers[_0x25d2f0[_0x1468('0x4')]][_0x1468('0x1b')])});}};exports[_0x1468('0x1c')]=function(_0x3f8775){var _0x16a5d2={'connectedlinenum':_0x3f8775[_0x1468('0x1d')],'connectedlinename':_0x3f8775[_0x1468('0x1e')],'assigned':!![],'lastAssignedTo':_0x3f8775['membername']};if(!_[_0x1468('0xf')](queues[_0x3f8775[_0x1468('0x4')]])){queues[_0x3f8775[_0x1468('0x4')]]=_[_0x1468('0x11')](queues[_0x3f8775[_0x1468('0x4')]],_0x16a5d2);}if(!_['isNil'](transfers[_0x3f8775[_0x1468('0x4')]])){transfers[_0x3f8775[_0x1468('0x4')]]=_['assign'](transfers[_0x3f8775[_0x1468('0x4')]],_0x16a5d2);}};exports[_0x1468('0x1f')]=function(_0x26bae1){var _0xa05980={'queuecallercomplete':!![],'queuecallercompleteAt':utils['now']()};if(_0x26bae1['reason']!=_0x1468('0x20')){_0xa05980[_0x1468('0x9')]='COMPLETEDBY'+_0x26bae1['reason'][_0x1468('0x16')]();}if(!_['isNil'](queues[_0x26bae1[_0x1468('0x4')]])){queues[_0x26bae1[_0x1468('0x4')]]=_['assign'](queues[_0x26bae1['channel']],_0xa05980);writeDB(queues[_0x26bae1['channel']],!![]);}};exports[_0x1468('0x21')]=function(_0x488e9f){if(!_[_0x1468('0xf')](queues[_0x488e9f[_0x1468('0x22')]])){queues[_0x488e9f[_0x1468('0x22')]]=_[_0x1468('0x11')](queues[_0x488e9f['transfereechannel']],{'transfer':!![],'transfertype':_0x1468('0x23'),'transferexten':_0x488e9f[_0x1468('0x24')],'transferuniqueid':_0x488e9f[_0x1468('0x25')],'queuecallerexitreason':_0x1468('0x26')});}};exports['attendedtransfer']=function(_0x79ef38){_[_0x1468('0x27')](queues,function(_0x3770ab){if(_0x3770ab[_0x1468('0x4')]==_0x79ef38[_0x1468('0x28')]){transfers[_0x79ef38[_0x1468('0x29')]]=_[_0x1468('0x10')](_0x3770ab);transfers[_0x79ef38[_0x1468('0x29')]]=_['assign'](transfers[_0x79ef38[_0x1468('0x29')]],{'queuecallerjoinAt':utils[_0x1468('0x13')](),'queuecallerleaveAt':utils[_0x1468('0x13')](),'channel':_0x79ef38[_0x1468('0x29')],'calleridname':_0x79ef38[_0x1468('0x2a')],'calleridnum':_0x79ef38['transfertargetcalleridnum'],'queuecallerenterreason':0x2});queues[_0x79ef38[_0x1468('0x29')]]=_[_0x1468('0x11')](queues[_0x79ef38[_0x1468('0x29')]],{'transfer':!![],'transfertype':_0x1468('0x2b'),'queuecallerexitreason':_0x1468('0x2c'),'transferexten':_0x79ef38[_0x1468('0x2d')],'transferuniqueid':_0x79ef38[_0x1468('0x2e')]});queues[_0x79ef38[_0x1468('0x28')]]=_['assign'](queues[_0x79ef38[_0x1468('0x28')]],{'queuecallerexitreason':_0x1468('0x2b'),'queuecallerenterreason':0x1});}else if(_0x3770ab['channel']==_0x79ef38[_0x1468('0x2f')]){transfers[_0x79ef38[_0x1468('0x22')]]=_['clone'](_0x3770ab);transfers[_0x79ef38[_0x1468('0x22')]]=_[_0x1468('0x11')](transfers[_0x79ef38[_0x1468('0x22')]],{'queuecallerjoinAt':utils['now'](),'queuecallerleaveAt':utils['now'](),'channel':_0x79ef38[_0x1468('0x22')],'calleridname':_0x79ef38[_0x1468('0x30')],'calleridnum':_0x79ef38[_0x1468('0x31')],'queuecallerenterreason':0x2});queues[_0x79ef38['transfereechannel']]=_[_0x1468('0x11')](queues[_0x79ef38[_0x1468('0x22')]],{'transfer':!![],'transfertype':_0x1468('0x2b'),'queuecallerexitreason':_0x1468('0x2c'),'transferexten':_0x79ef38[_0x1468('0x32')],'transferuniqueid':_0x79ef38[_0x1468('0x33')]});queues[_0x79ef38[_0x1468('0x2f')]]=_[_0x1468('0x11')](queues[_0x79ef38[_0x1468('0x2f')]],{'queuecallerexitreason':_0x1468('0x2b'),'queuecallerenterreason':0x1});}});};exports['musiconholdstart']=function(_0x3a0d40){if(!_[_0x1468('0xf')](queues[_0x3a0d40[_0x1468('0x4')]])){queues[_0x3a0d40['channel']][_0x1468('0x34')]=utils[_0x1468('0x13')]();}};exports['musiconholdstop']=function(_0x1313e4){if(!_[_0x1468('0xf')](queues[_0x1313e4['channel']])){if(!_['isNil'](queues[_0x1313e4['channel']][_0x1468('0x34')])){queues[_0x1313e4[_0x1468('0x4')]][_0x1468('0x35')]+=utils['diffTime'](utils[_0x1468('0x13')](),queues[_0x1313e4[_0x1468('0x4')]][_0x1468('0x34')]);delete queues[_0x1313e4['channel']][_0x1468('0x34')];}}};exports[_0x1468('0x36')]=function(_0x1ea6d5){if(!_[_0x1468('0xf')](queues[_0x1ea6d5['channel']])){writeDB(queues[_0x1ea6d5[_0x1468('0x4')]],!![]);}if(!_[_0x1468('0xf')](transfers[_0x1ea6d5[_0x1468('0x4')]])){if(transfers[_0x1ea6d5['channel']][_0x1468('0x37')]){transfers[_0x1ea6d5['channel']]=_[_0x1468('0x11')](transfers[_0x1ea6d5[_0x1468('0x4')]],{'queuecallercomplete':!![],'queuecallercompleteAt':utils['now'](),'queuecallerexitreason':'COMPLETED'});}writeDB(transfers[_0x1ea6d5[_0x1468('0x4')]],![]);delete transfers[_0x1ea6d5[_0x1468('0x4')]];}};
\ No newline at end of file
+var _0xb744=['secondtransfererexten','secondtransfereruniqueid','musiconholdstartAt','musiconholdstop','cdr','COMPLETED','lodash','util','./utils','info','format','uniqueid','channel','queue','lastAssignedTo','calleridnum','getVoiceQueueByName','type','CreateVoiceQueueReport','queuecallerjoin','isNil','clone','assign','now','varset','queuestatus','value','ABANDONED','queuecallerleave','diffTime','queuecallerjoinAt','membername','reason','transfer','COMPLETEDBY','transfereechannel','BLIND','transfereeuniqueid','BLINDTRANSFER','attendedtransfer','origtransfererchannel','transfertargetchannel','transfertargetcalleridname','transfertargetcalleridnum','ATTENDED','ATTENDEDTRANSFER','secondtransfererchannel'];(function(_0xd9f102,_0x5a0d28){var _0x2652e4=function(_0x5021a1){while(--_0x5021a1){_0xd9f102['push'](_0xd9f102['shift']());}};_0x2652e4(++_0x5a0d28);}(_0xb744,0x120));var _0x4b74=function(_0xf3ec3a,_0xec0811){_0xf3ec3a=_0xf3ec3a-0x0;var _0x1cfd8e=_0xb744[_0xf3ec3a];return _0x1cfd8e;};'use strict';var _=require(_0x4b74('0x0'));var util=require(_0x4b74('0x1'));var utils=require(_0x4b74('0x2'));var queues={};var transfers={};function writeDB(_0x4dc6c0,_0x4c53f9){utils[_0x4b74('0x3')](util[_0x4b74('0x4')]('QUEUE|%s|%s|%s|%s|%s|%s|%s',_0x4dc6c0[_0x4b74('0x5')],_0x4dc6c0[_0x4b74('0x6')],_0x4dc6c0[_0x4b74('0x7')],_0x4dc6c0[_0x4b74('0x8')],_0x4dc6c0[_0x4b74('0x9')],_0x4dc6c0['accountcode'],_0x4dc6c0['queuecallerexitreason']));if(_0x4dc6c0['queue']){utils[_0x4b74('0xa')](_0x4dc6c0[_0x4b74('0x7')])['then'](function(_0x23453e){if(_0x23453e){_0x4dc6c0[_0x4b74('0xb')]=_0x23453e[_0x4b74('0xb')];}utils['request'](_0x4b74('0xc'),_0x4dc6c0);});}else{utils['request'](_0x4b74('0xc'),_0x4dc6c0);}if(_0x4c53f9){delete queues[_0x4dc6c0[_0x4b74('0x6')]];}}exports[_0x4b74('0xd')]=function(_0xa06bcc){if(!_[_0x4b74('0xe')](queues[_0xa06bcc['channel']])){writeDB(_[_0x4b74('0xf')](queues[_0xa06bcc[_0x4b74('0x6')]]),![]);}queues[_0xa06bcc[_0x4b74('0x6')]]=_[_0x4b74('0x10')](_0xa06bcc,{'originalposition':_0xa06bcc['position'],'queuecallerjoinAt':utils[_0x4b74('0x11')](),'mohtime':0x0});};exports[_0x4b74('0x12')]=function(_0xd99ab6){if(!_[_0x4b74('0xe')](queues[_0xd99ab6[_0x4b74('0x6')]])){if(!_['isNil'](_0xd99ab6['variable'][_0x4b74('0x13')])){if(_0xd99ab6[_0x4b74('0x14')]!='CONTINUE'){queues[_0xd99ab6[_0x4b74('0x6')]]=_[_0x4b74('0x10')](queues[_0xd99ab6[_0x4b74('0x6')]],{'queuecallerabandon':![],'queuecallerabandonAt':null,'queuecallerexit':!![],'queuecallerexitAt':utils['now'](),'queuecallerexitreason':_0xd99ab6[_0x4b74('0x14')]['toUpperCase']()});}}}};exports['queuecallerabandon']=function(_0x151ade){var _0x2f10b8={'queuecallerabandon':!![],'queuecallerabandonAt':utils[_0x4b74('0x11')](),'queuecallerexitreason':_0x4b74('0x15')};if(!_[_0x4b74('0xe')](queues[_0x151ade[_0x4b74('0x6')]])){queues[_0x151ade[_0x4b74('0x6')]]=_[_0x4b74('0x10')](queues[_0x151ade[_0x4b74('0x6')]],_0x2f10b8);}if(!_[_0x4b74('0xe')](transfers[_0x151ade[_0x4b74('0x6')]])){transfers[_0x151ade['channel']]=_[_0x4b74('0x10')](transfers[_0x151ade[_0x4b74('0x6')]],_0x2f10b8);}};exports[_0x4b74('0x16')]=function(_0x44f5a8){if(!_[_0x4b74('0xe')](queues[_0x44f5a8[_0x4b74('0x6')]])){queues[_0x44f5a8[_0x4b74('0x6')]]=_['assign'](queues[_0x44f5a8[_0x4b74('0x6')]],{'queuecallerleave':!![],'queuecallerleaveAt':utils[_0x4b74('0x11')](),'holdtime':utils[_0x4b74('0x17')](utils[_0x4b74('0x11')](),queues[_0x44f5a8[_0x4b74('0x6')]][_0x4b74('0x18')])});}if(!_[_0x4b74('0xe')](transfers[_0x44f5a8['channel']])){transfers[_0x44f5a8['channel']]=_[_0x4b74('0x10')](transfers[_0x44f5a8[_0x4b74('0x6')]],{'queuecallerleave':!![],'queuecallerleaveAt':utils[_0x4b74('0x11')](),'holdtime':utils['diffTime'](utils[_0x4b74('0x11')](),transfers[_0x44f5a8[_0x4b74('0x6')]][_0x4b74('0x18')])});}};exports['agentconnect']=function(_0x5a2e0c){var _0x5a3680={'connectedlinenum':_0x5a2e0c['connectedlinenum'],'connectedlinename':_0x5a2e0c['connectedlinename'],'assigned':!![],'lastAssignedTo':_0x5a2e0c[_0x4b74('0x19')]};if(!_[_0x4b74('0xe')](queues[_0x5a2e0c[_0x4b74('0x6')]])){queues[_0x5a2e0c[_0x4b74('0x6')]]=_[_0x4b74('0x10')](queues[_0x5a2e0c[_0x4b74('0x6')]],_0x5a3680);}if(!_['isNil'](transfers[_0x5a2e0c[_0x4b74('0x6')]])){transfers[_0x5a2e0c[_0x4b74('0x6')]]=_[_0x4b74('0x10')](transfers[_0x5a2e0c[_0x4b74('0x6')]],_0x5a3680);}};exports['agentcomplete']=function(_0x45591d){var _0x4e5765={'queuecallercomplete':!![],'queuecallercompleteAt':utils[_0x4b74('0x11')]()};if(_0x45591d[_0x4b74('0x1a')]!=_0x4b74('0x1b')){_0x4e5765['queuecallerexitreason']=_0x4b74('0x1c')+_0x45591d[_0x4b74('0x1a')]['toUpperCase']();}if(!_[_0x4b74('0xe')](queues[_0x45591d[_0x4b74('0x6')]])){queues[_0x45591d[_0x4b74('0x6')]]=_['assign'](queues[_0x45591d[_0x4b74('0x6')]],_0x4e5765);writeDB(queues[_0x45591d[_0x4b74('0x6')]],!![]);}};exports['blindtransfer']=function(_0x4289c7){if(!_['isNil'](queues[_0x4289c7[_0x4b74('0x1d')]])){queues[_0x4289c7[_0x4b74('0x1d')]]=_[_0x4b74('0x10')](queues[_0x4289c7[_0x4b74('0x1d')]],{'transfer':!![],'transfertype':_0x4b74('0x1e'),'transferexten':_0x4289c7['extension'],'transferuniqueid':_0x4289c7[_0x4b74('0x1f')],'queuecallerexitreason':_0x4b74('0x20')});}};exports[_0x4b74('0x21')]=function(_0x3c15a9){_['forIn'](queues,function(_0x1c3fe3){if(_0x1c3fe3[_0x4b74('0x6')]==_0x3c15a9[_0x4b74('0x22')]){transfers[_0x3c15a9['transfertargetchannel']]=_['clone'](_0x1c3fe3);transfers[_0x3c15a9['transfertargetchannel']]=_[_0x4b74('0x10')](transfers[_0x3c15a9['transfertargetchannel']],{'queuecallerjoinAt':utils[_0x4b74('0x11')](),'queuecallerleaveAt':utils[_0x4b74('0x11')](),'channel':_0x3c15a9[_0x4b74('0x23')],'calleridname':_0x3c15a9[_0x4b74('0x24')],'calleridnum':_0x3c15a9[_0x4b74('0x25')],'queuecallerenterreason':0x2});queues[_0x3c15a9[_0x4b74('0x23')]]=_[_0x4b74('0x10')](queues[_0x3c15a9[_0x4b74('0x23')]],{'transfer':!![],'transfertype':_0x4b74('0x26'),'queuecallerexitreason':_0x4b74('0x27'),'transferexten':_0x3c15a9['origtransfererexten'],'transferuniqueid':_0x3c15a9['origtransfereruniqueid']});queues[_0x3c15a9[_0x4b74('0x22')]]=_['assign'](queues[_0x3c15a9[_0x4b74('0x22')]],{'queuecallerexitreason':_0x4b74('0x26'),'queuecallerenterreason':0x1});}else if(_0x1c3fe3['channel']==_0x3c15a9[_0x4b74('0x28')]){transfers[_0x3c15a9[_0x4b74('0x1d')]]=_[_0x4b74('0xf')](_0x1c3fe3);transfers[_0x3c15a9['transfereechannel']]=_[_0x4b74('0x10')](transfers[_0x3c15a9[_0x4b74('0x1d')]],{'queuecallerjoinAt':utils[_0x4b74('0x11')](),'queuecallerleaveAt':utils[_0x4b74('0x11')](),'channel':_0x3c15a9[_0x4b74('0x1d')],'calleridname':_0x3c15a9['transfereecalleridname'],'calleridnum':_0x3c15a9['transfereecalleridnum'],'queuecallerenterreason':0x2});queues[_0x3c15a9[_0x4b74('0x1d')]]=_[_0x4b74('0x10')](queues[_0x3c15a9[_0x4b74('0x1d')]],{'transfer':!![],'transfertype':_0x4b74('0x26'),'queuecallerexitreason':'ATTENDEDTRANSFER','transferexten':_0x3c15a9[_0x4b74('0x29')],'transferuniqueid':_0x3c15a9[_0x4b74('0x2a')]});queues[_0x3c15a9[_0x4b74('0x28')]]=_[_0x4b74('0x10')](queues[_0x3c15a9[_0x4b74('0x28')]],{'queuecallerexitreason':_0x4b74('0x26'),'queuecallerenterreason':0x1});}});};exports['musiconholdstart']=function(_0x317798){if(!_[_0x4b74('0xe')](queues[_0x317798[_0x4b74('0x6')]])){queues[_0x317798[_0x4b74('0x6')]][_0x4b74('0x2b')]=utils['now']();}};exports[_0x4b74('0x2c')]=function(_0x508ea4){if(!_['isNil'](queues[_0x508ea4[_0x4b74('0x6')]])){if(!_['isNil'](queues[_0x508ea4[_0x4b74('0x6')]][_0x4b74('0x2b')])){queues[_0x508ea4[_0x4b74('0x6')]]['mohtime']+=utils[_0x4b74('0x17')](utils[_0x4b74('0x11')](),queues[_0x508ea4[_0x4b74('0x6')]][_0x4b74('0x2b')]);delete queues[_0x508ea4[_0x4b74('0x6')]][_0x4b74('0x2b')];}}};exports[_0x4b74('0x2d')]=function(_0x20bff2){if(!_['isNil'](queues[_0x20bff2[_0x4b74('0x6')]])){writeDB(queues[_0x20bff2[_0x4b74('0x6')]],!![]);}if(!_[_0x4b74('0xe')](transfers[_0x20bff2[_0x4b74('0x6')]])){if(transfers[_0x20bff2['channel']]['assigned']){transfers[_0x20bff2[_0x4b74('0x6')]]=_['assign'](transfers[_0x20bff2[_0x4b74('0x6')]],{'queuecallercomplete':!![],'queuecallercompleteAt':utils['now'](),'queuecallerexitreason':_0x4b74('0x2e')});}writeDB(transfers[_0x20bff2[_0x4b74('0x6')]],![]);delete transfers[_0x20bff2[_0x4b74('0x6')]];}};
\ No newline at end of file
index 787de67..7e6280b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8f37=['value','.WAV','assign','agentconnect','queue','connectedlinenum','cdr','type','destinationchannel','dialer','destinationcontext','lastdata','destination','calleridnum','connectedlinename','calleridname','lodash','./utils','getUserByInternal','accountcode','then','membername','UserId','CreateVoiceRecording','request','channel','varset','variable','isNil','mixmonitor_filename','endsWith','.wav49'];(function(_0x28e1a0,_0x463ab4){var _0x4a759f=function(_0x26e7e8){while(--_0x26e7e8){_0x28e1a0['push'](_0x28e1a0['shift']());}};_0x4a759f(++_0x463ab4);}(_0x8f37,0x190));var _0x78f3=function(_0x1a8f78,_0x53f7d5){_0x1a8f78=_0x1a8f78-0x0;var _0x12a821=_0x8f37[_0x1a8f78];return _0x12a821;};'use strict';var _=require(_0x78f3('0x0'));var utils=require(_0x78f3('0x1'));var recordings={};function writeDB(_0x351c4f){utils['debug'](_0x351c4f);if(_0x351c4f['accountcode']){utils[_0x78f3('0x2')](_0x351c4f[_0x78f3('0x3')])[_0x78f3('0x4')](function(_0x539794){if(_0x539794){_0x351c4f[_0x78f3('0x5')]=_0x539794['name'];_0x351c4f[_0x78f3('0x6')]=_0x539794['id'];}utils['request'](_0x78f3('0x7'),_0x351c4f);});}else{utils[_0x78f3('0x8')]('CreateVoiceRecording',_0x351c4f);}if(recordings[_0x351c4f[_0x78f3('0x9')]]){delete recordings[_0x351c4f['channel']];}}exports[_0x78f3('0xa')]=function(_0x423223){if(!_['isNil'](_0x423223[_0x78f3('0xb')])&&!_[_0x78f3('0xc')](_0x423223[_0x78f3('0xb')][_0x78f3('0xd')])){if(!_[_0x78f3('0xc')](recordings[_0x423223['channel']])){writeDB(recordings[_0x423223[_0x78f3('0x9')]]);}if(_[_0x78f3('0xe')](_0x423223['value'],_0x78f3('0xf'))){_0x423223[_0x78f3('0x10')]=_0x423223[_0x78f3('0x10')]['replace'](_0x78f3('0xf'),_0x78f3('0x11'));}recordings[_0x423223[_0x78f3('0x9')]]=_[_0x78f3('0x12')](_0x423223,{});}};exports[_0x78f3('0x13')]=function(_0x1858f1){if(!_[_0x78f3('0xc')](recordings[_0x1858f1[_0x78f3('0x9')]])){recordings[_0x1858f1[_0x78f3('0x9')]]=_[_0x78f3('0x12')](recordings[_0x1858f1[_0x78f3('0x9')]],{'membername':_0x1858f1[_0x78f3('0x5')],'queue':_0x1858f1[_0x78f3('0x14')],'accountcode':_0x1858f1[_0x78f3('0x15')]});}};exports[_0x78f3('0x16')]=function(_0x422855){if(!_[_0x78f3('0xc')](recordings[_0x422855[_0x78f3('0x9')]])){recordings[_0x422855[_0x78f3('0x9')]]=_[_0x78f3('0x12')](recordings[_0x422855[_0x78f3('0x9')]],{'type':_0x422855[_0x78f3('0x17')]});writeDB(recordings[_0x422855[_0x78f3('0x9')]]);}else if(!_['isNil'](recordings[_0x422855[_0x78f3('0x18')]])){recordings[_0x422855[_0x78f3('0x9')]]=recordings[_0x422855['destinationchannel']];delete recordings[_0x422855['destinationchannel']];if(_0x422855['type']==_0x78f3('0x19')){recordings[_0x422855[_0x78f3('0x9')]]=_[_0x78f3('0x12')](recordings[_0x422855[_0x78f3('0x9')]],{'type':_0x422855[_0x78f3('0x17')],'uniqueid':_0x422855['uniqueid'],'context':_0x422855[_0x78f3('0x1a')],'queue':_0x422855[_0x78f3('0x1b')],'connectedlinenum':_0x422855[_0x78f3('0x3')],'connectedlinename':'','calleridnum':_0x422855[_0x78f3('0x1c')],'exten':recordings[_0x422855[_0x78f3('0x9')]][_0x78f3('0x1d')]});}else{recordings[_0x422855[_0x78f3('0x9')]]=_[_0x78f3('0x12')](recordings[_0x422855[_0x78f3('0x9')]],{'type':_0x422855[_0x78f3('0x17')],'channel':_0x422855['channel'],'exten':_0x422855[_0x78f3('0x1c')],'context':_0x422855[_0x78f3('0x1a')],'uniqueid':_0x422855['uniqueid'],'calleridnum':recordings[_0x422855[_0x78f3('0x9')]][_0x78f3('0x15')],'calleridname':recordings[_0x422855[_0x78f3('0x9')]][_0x78f3('0x1e')],'connectedlinenum':recordings[_0x422855[_0x78f3('0x9')]]['calleridnum'],'connectedlinename':recordings[_0x422855[_0x78f3('0x9')]][_0x78f3('0x1f')]});}writeDB(recordings[_0x422855[_0x78f3('0x9')]]);}};
\ No newline at end of file
+var _0x19ea=['varset','isNil','variable','mixmonitor_filename','endsWith','value','replace','.wav49','.WAV','assign','agentconnect','membername','queue','connectedlinenum','type','dialer','uniqueid','lastdata','destination','calleridnum','destinationcontext','connectedlinename','calleridname','lodash','debug','getUserByInternal','accountcode','then','name','UserId','request','CreateVoiceRecording','channel'];(function(_0x306ca4,_0x238ec2){var _0xe3f589=function(_0x2df96d){while(--_0x2df96d){_0x306ca4['push'](_0x306ca4['shift']());}};_0xe3f589(++_0x238ec2);}(_0x19ea,0xfe));var _0xa19e=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x19ea[_0x424a9a];return _0xa7831c;};'use strict';var _=require(_0xa19e('0x0'));var utils=require('./utils');var recordings={};function writeDB(_0x49bcb5){utils[_0xa19e('0x1')](_0x49bcb5);if(_0x49bcb5['accountcode']){utils[_0xa19e('0x2')](_0x49bcb5[_0xa19e('0x3')])[_0xa19e('0x4')](function(_0x4d323a){if(_0x4d323a){_0x49bcb5['membername']=_0x4d323a[_0xa19e('0x5')];_0x49bcb5[_0xa19e('0x6')]=_0x4d323a['id'];}utils[_0xa19e('0x7')](_0xa19e('0x8'),_0x49bcb5);});}else{utils[_0xa19e('0x7')](_0xa19e('0x8'),_0x49bcb5);}if(recordings[_0x49bcb5[_0xa19e('0x9')]]){delete recordings[_0x49bcb5[_0xa19e('0x9')]];}}exports[_0xa19e('0xa')]=function(_0x33253e){if(!_[_0xa19e('0xb')](_0x33253e['variable'])&&!_[_0xa19e('0xb')](_0x33253e[_0xa19e('0xc')][_0xa19e('0xd')])){if(!_[_0xa19e('0xb')](recordings[_0x33253e['channel']])){writeDB(recordings[_0x33253e[_0xa19e('0x9')]]);}if(_[_0xa19e('0xe')](_0x33253e[_0xa19e('0xf')],'.wav49')){_0x33253e[_0xa19e('0xf')]=_0x33253e[_0xa19e('0xf')][_0xa19e('0x10')](_0xa19e('0x11'),_0xa19e('0x12'));}recordings[_0x33253e['channel']]=_[_0xa19e('0x13')](_0x33253e,{});}};exports[_0xa19e('0x14')]=function(_0xa7e0c4){if(!_[_0xa19e('0xb')](recordings[_0xa7e0c4[_0xa19e('0x9')]])){recordings[_0xa7e0c4[_0xa19e('0x9')]]=_[_0xa19e('0x13')](recordings[_0xa7e0c4[_0xa19e('0x9')]],{'membername':_0xa7e0c4[_0xa19e('0x15')],'queue':_0xa7e0c4[_0xa19e('0x16')],'accountcode':_0xa7e0c4[_0xa19e('0x17')]});}};exports['cdr']=function(_0x28fd37){if(!_[_0xa19e('0xb')](recordings[_0x28fd37[_0xa19e('0x9')]])){recordings[_0x28fd37[_0xa19e('0x9')]]=_[_0xa19e('0x13')](recordings[_0x28fd37[_0xa19e('0x9')]],{'type':_0x28fd37[_0xa19e('0x18')]});writeDB(recordings[_0x28fd37['channel']]);}else if(!_[_0xa19e('0xb')](recordings[_0x28fd37['destinationchannel']])){recordings[_0x28fd37[_0xa19e('0x9')]]=recordings[_0x28fd37['destinationchannel']];delete recordings[_0x28fd37['destinationchannel']];if(_0x28fd37[_0xa19e('0x18')]==_0xa19e('0x19')){recordings[_0x28fd37['channel']]=_[_0xa19e('0x13')](recordings[_0x28fd37[_0xa19e('0x9')]],{'type':_0x28fd37[_0xa19e('0x18')],'uniqueid':_0x28fd37[_0xa19e('0x1a')],'context':_0x28fd37['destinationcontext'],'queue':_0x28fd37[_0xa19e('0x1b')],'connectedlinenum':_0x28fd37[_0xa19e('0x3')],'connectedlinename':'','calleridnum':_0x28fd37[_0xa19e('0x1c')],'exten':recordings[_0x28fd37[_0xa19e('0x9')]][_0xa19e('0x1d')]});}else{recordings[_0x28fd37[_0xa19e('0x9')]]=_[_0xa19e('0x13')](recordings[_0x28fd37[_0xa19e('0x9')]],{'type':_0x28fd37[_0xa19e('0x18')],'channel':_0x28fd37['channel'],'exten':_0x28fd37[_0xa19e('0x1c')],'context':_0x28fd37[_0xa19e('0x1e')],'uniqueid':_0x28fd37['uniqueid'],'calleridnum':recordings[_0x28fd37[_0xa19e('0x9')]][_0xa19e('0x17')],'calleridname':recordings[_0x28fd37['channel']][_0xa19e('0x1f')],'connectedlinenum':recordings[_0x28fd37[_0xa19e('0x9')]]['calleridnum'],'connectedlinename':recordings[_0x28fd37[_0xa19e('0x9')]][_0xa19e('0x20')]});}writeDB(recordings[_0x28fd37[_0xa19e('0x9')]]);}};
\ No newline at end of file
index 810ef06..8b7cef8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbc08=['secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','format','type','request','CreateVoiceTransferReport','blindtransfer','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname'];(function(_0x84d353,_0xc911f9){var _0x31d5a1=function(_0x10e80f){while(--_0x10e80f){_0x84d353['push'](_0x84d353['shift']());}};_0x31d5a1(++_0xc911f9);}(_0xbc08,0x1bf));var _0x8bc0=function(_0x3b248a,_0x2eed41){_0x3b248a=_0x3b248a-0x0;var _0x29e371=_0xbc08[_0x3b248a];return _0x29e371;};'use strict';var _=require(_0x8bc0('0x0'));var util=require(_0x8bc0('0x1'));var utils=require(_0x8bc0('0x2'));function writeDB(_0x11f374){utils['info'](util[_0x8bc0('0x3')]('TRANSFER|%s',_0x11f374[_0x8bc0('0x4')]));utils[_0x8bc0('0x5')](_0x8bc0('0x6'),_0x11f374);}exports[_0x8bc0('0x7')]=function(_0x51ff7a){_0x51ff7a[_0x8bc0('0x4')]='blind';writeDB(_0x51ff7a);};exports['attendedtransfer']=function(_0x3c953e){_0x3c953e=_[_0x8bc0('0x8')](_0x3c953e,{'transfererchannel':_0x3c953e[_0x8bc0('0x9')],'transferercalleridnum':_0x3c953e[_0x8bc0('0xa')],'transferercalleridname':_0x3c953e[_0x8bc0('0xb')],'transfererconnectedlinenum':_0x3c953e[_0x8bc0('0xc')],'transfererconnectedlinename':_0x3c953e[_0x8bc0('0xd')],'transfereraccountcode':_0x3c953e['origtransfereraccountcode'],'transferercontext':_0x3c953e['secondtransferercontext'],'transfererexten':_0x3c953e[_0x8bc0('0xe')],'transfererlinkedid':_0x3c953e[_0x8bc0('0xf')],'context':_0x3c953e[_0x8bc0('0x10')],'extension':_0x3c953e[_0x8bc0('0x11')],'type':_0x8bc0('0x12')});if(_[_0x8bc0('0x13')](_0x3c953e[_0x8bc0('0x14')])){_0x3c953e=_[_0x8bc0('0x8')](_0x3c953e,{'transfereechannel':_0x3c953e[_0x8bc0('0x15')],'transfereecalleridnum':_0x3c953e['transfertargetcalleridnum'],'transfereecalleridname':_0x3c953e['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x3c953e[_0x8bc0('0x16')],'transfereeconnectedlinename':_0x3c953e[_0x8bc0('0x17')],'transfereeaccountcode':_0x3c953e['transfertargetaccountcode'],'transfereecontext':_0x3c953e[_0x8bc0('0x18')],'transfereeexten':_0x3c953e[_0x8bc0('0x19')],'transfereelinkedid':_0x3c953e[_0x8bc0('0x1a')]});}writeDB(_0x3c953e);};
\ No newline at end of file
+var _0x2abf=['TRANSFER|%s','type','request','CreateVoiceTransferReport','blindtransfer','blind','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererexten','isNil','transfereechannel','assign','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','lodash','./utils','format'];(function(_0x3afe60,_0x20f4a0){var _0x3e7a72=function(_0xdd9cd){while(--_0xdd9cd){_0x3afe60['push'](_0x3afe60['shift']());}};_0x3e7a72(++_0x20f4a0);}(_0x2abf,0xf7));var _0xf2ab=function(_0x4ceb40,_0x1214a0){_0x4ceb40=_0x4ceb40-0x0;var _0x3372ce=_0x2abf[_0x4ceb40];return _0x3372ce;};'use strict';var _=require(_0xf2ab('0x0'));var util=require('util');var utils=require(_0xf2ab('0x1'));function writeDB(_0x501f4e){utils['info'](util[_0xf2ab('0x2')](_0xf2ab('0x3'),_0x501f4e[_0xf2ab('0x4')]));utils[_0xf2ab('0x5')](_0xf2ab('0x6'),_0x501f4e);}exports[_0xf2ab('0x7')]=function(_0x57b502){_0x57b502[_0xf2ab('0x4')]=_0xf2ab('0x8');writeDB(_0x57b502);};exports['attendedtransfer']=function(_0x5c9785){_0x5c9785=_['assign'](_0x5c9785,{'transfererchannel':_0x5c9785['origtransfererchannel'],'transferercalleridnum':_0x5c9785[_0xf2ab('0x9')],'transferercalleridname':_0x5c9785[_0xf2ab('0xa')],'transfererconnectedlinenum':_0x5c9785['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x5c9785[_0xf2ab('0xb')],'transfereraccountcode':_0x5c9785[_0xf2ab('0xc')],'transferercontext':_0x5c9785[_0xf2ab('0xd')],'transfererexten':_0x5c9785['secondtransfererexten'],'transfererlinkedid':_0x5c9785['origtransfererlinkedid'],'context':_0x5c9785['origtransferercontext'],'extension':_0x5c9785[_0xf2ab('0xe')],'type':'attended'});if(_[_0xf2ab('0xf')](_0x5c9785[_0xf2ab('0x10')])){_0x5c9785=_[_0xf2ab('0x11')](_0x5c9785,{'transfereechannel':_0x5c9785[_0xf2ab('0x12')],'transfereecalleridnum':_0x5c9785[_0xf2ab('0x13')],'transfereecalleridname':_0x5c9785[_0xf2ab('0x14')],'transfereeconnectedlinenum':_0x5c9785['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x5c9785[_0xf2ab('0x15')],'transfereeaccountcode':_0x5c9785[_0xf2ab('0x16')],'transfereecontext':_0x5c9785[_0xf2ab('0x17')],'transfereeexten':_0x5c9785['transfertargetexten'],'transfereelinkedid':_0x5c9785[_0xf2ab('0x18')]});}writeDB(_0x5c9785);};
\ No newline at end of file
index 774f108..1a7b84f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe202=['isAfter','jayson/promise','client','http','../../config/logger','xdr','info','debug','stringify','error','stack','request','then','catch','GetUser','name','interface','result','length','getUserByInterface','GetVoiceQueue','type','acwTimeout','GETVOICEQUEUEBYNAME|','FOUND','NOTFOUND','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','now'];(function(_0x4616d9,_0x9f3414){var _0x26fe00=function(_0x57af1c){while(--_0x57af1c){_0x4616d9['push'](_0x4616d9['shift']());}};_0x26fe00(++_0x9f3414);}(_0xe202,0x1bd));var _0x2e20=function(_0x2d19ff,_0x5633dd){_0x2d19ff=_0x2d19ff-0x0;var _0x2d06d7=_0xe202[_0x2d19ff];return _0x2d06d7;};'use strict';var jayson=require(_0x2e20('0x0'));var moment=require('moment');var BPromise=require('bluebird');var client=jayson[_0x2e20('0x1')][_0x2e20('0x2')]({'port':0x2329});var logger=require(_0x2e20('0x3'))(_0x2e20('0x4'));exports[_0x2e20('0x5')]=function(_0x2cd546){logger['info'](_0x2cd546);};exports['debug']=function(_0x3fedf0){logger[_0x2e20('0x6')](JSON[_0x2e20('0x7')](_0x3fedf0));};exports[_0x2e20('0x8')]=function(_0x418c7b){logger['error'](_0x418c7b[_0x2e20('0x9')]);};exports[_0x2e20('0xa')]=function(_0x3c4d4c,_0x55df58){return client[_0x2e20('0xa')](_0x3c4d4c,{'body':_0x55df58})[_0x2e20('0xb')](function(_0xd3e8b4){logger[_0x2e20('0x6')](JSON[_0x2e20('0x7')](_0xd3e8b4));})[_0x2e20('0xc')](function(_0x2b07e8){logger[_0x2e20('0x8')](_0x2b07e8[_0x2e20('0x9')]);});};function getUser(_0x538eb5){return client[_0x2e20('0xa')](_0x2e20('0xd'),{'options':{'raw':!![],'attributes':['id','internal',_0x2e20('0xe'),_0x2e20('0xf')],'where':_0x538eb5,'limit':0x1}})[_0x2e20('0xb')](function(_0x1c7776){logger[_0x2e20('0x5')]('GETUSER|'+JSON[_0x2e20('0x7')](_0x538eb5)+'|'+(_0x1c7776[_0x2e20('0x10')][_0x2e20('0x11')]?'FOUND':'NOTFOUND'));return _0x1c7776['result'][_0x2e20('0x11')]?_0x1c7776[_0x2e20('0x10')][0x0]:null;});}exports['getUserByInternal']=function(_0x21737f){return new BPromise(function(_0x5e3d70,_0x103c8c){if(_0x21737f){return getUser({'internal':_0x21737f})[_0x2e20('0xb')](function(_0x1bfe87){return _0x5e3d70(_0x1bfe87);})[_0x2e20('0xc')](function(_0x4228dd){logger[_0x2e20('0x8')](_0x4228dd[_0x2e20('0x9')]);return _0x5e3d70(null);});}else{return _0x5e3d70(null);}});};exports[_0x2e20('0x12')]=function(_0x47f4a3){return new BPromise(function(_0x4f24a2,_0x52e7ee){if(_0x47f4a3){return getUser({'interface':_0x47f4a3})[_0x2e20('0xb')](function(_0x276e08){return _0x4f24a2(_0x276e08);})[_0x2e20('0xc')](function(_0x9ffc5d){logger[_0x2e20('0x8')](_0x9ffc5d[_0x2e20('0x9')]);return _0x4f24a2(null);});}else{return _0x4f24a2(null);}});};exports['getUserByName']=function(_0x2281c7){return new BPromise(function(_0x40e94c,_0x54af63){if(_0x2281c7){return getUser({'name':_0x2281c7})[_0x2e20('0xb')](function(_0x83bfba){return _0x40e94c(_0x83bfba);})[_0x2e20('0xc')](function(_0x56c509){logger['error'](_0x56c509[_0x2e20('0x9')]);return _0x40e94c(null);});}else{return _0x40e94c(null);}});};exports['getVoiceQueueByName']=function(_0x9581b0){return new BPromise(function(_0x17704d,_0x7429e0){if(_0x9581b0){return client[_0x2e20('0xa')](_0x2e20('0x13'),{'options':{'raw':!![],'attributes':['id',_0x2e20('0xe'),_0x2e20('0x14'),'acw',_0x2e20('0x15')],'where':{'name':_0x9581b0},'limit':0x1}})[_0x2e20('0xb')](function(_0x450bf2){logger[_0x2e20('0x5')](_0x2e20('0x16')+_0x9581b0+'|'+(_0x450bf2[_0x2e20('0x10')][_0x2e20('0x11')]?_0x2e20('0x17'):_0x2e20('0x18')));return _0x17704d(_0x450bf2[_0x2e20('0x10')]['length']?_0x450bf2['result'][0x0]:null);})[_0x2e20('0xc')](function(_0x30ca24){logger[_0x2e20('0x8')](_0x30ca24[_0x2e20('0x9')]);return _0x17704d(null);});}else{return _0x17704d(null);}});};exports[_0x2e20('0x19')]=function(_0x4706df,_0x3d23cd){return moment(_0x4706df)[_0x2e20('0x1a')](_0x3d23cd,_0x2e20('0x1b'))[_0x2e20('0x1c')](_0x2e20('0x1d'));};exports[_0x2e20('0x1e')]=function(_0x110f9c,_0x197eba){return moment(_0x110f9c)[_0x2e20('0x1f')](_0x197eba,_0x2e20('0x1b'))[_0x2e20('0x1c')](_0x2e20('0x1d'));};exports[_0x2e20('0x20')]=function(_0x14a849,_0x4c7988){return moment(_0x14a849)[_0x2e20('0x21')](moment(_0x4c7988),_0x2e20('0x1b'));};exports[_0x2e20('0x22')]=function(_0x3f7809,_0x4a0e1c){return parseInt(_0x3f7809,0xa)+parseInt(_0x4a0e1c,0xa);};exports[_0x2e20('0x23')]=function(){return moment()['format'](_0x2e20('0x1d'));};exports['isAfter']=function(_0x650e78,_0x53e4d2){if(_0x53e4d2){return moment(_0x650e78)[_0x2e20('0x24')](_0x53e4d2);}else{return!![];}};exports['isBefore']=function(_0x173890,_0x47092c){if(_0x47092c){return moment(_0x173890)['isBefore'](_0x47092c);}else if(_0x173890){return!![];}else{return![];}};
\ No newline at end of file
+var _0xf911=['add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','diffTime','diff','sumTime','now','isAfter','isBefore','jayson/promise','moment','../../config/logger','xdr','info','debug','stringify','error','request','catch','stack','GetUser','internal','then','length','result','getUserByInterface','getUserByName','getVoiceQueueByName','name','type','acw','acwTimeout','GETVOICEQUEUEBYNAME|','FOUND','NOTFOUND'];(function(_0x22153b,_0x4528ec){var _0x217dae=function(_0x14520e){while(--_0x14520e){_0x22153b['push'](_0x22153b['shift']());}};_0x217dae(++_0x4528ec);}(_0xf911,0x158));var _0x1f91=function(_0x51042f,_0x2377bb){_0x51042f=_0x51042f-0x0;var _0x39308a=_0xf911[_0x51042f];return _0x39308a;};'use strict';var jayson=require(_0x1f91('0x0'));var moment=require(_0x1f91('0x1'));var BPromise=require('bluebird');var client=jayson['client']['http']({'port':0x2329});var logger=require(_0x1f91('0x2'))(_0x1f91('0x3'));exports['info']=function(_0x5ebf98){logger[_0x1f91('0x4')](_0x5ebf98);};exports[_0x1f91('0x5')]=function(_0x5e52ab){logger['debug'](JSON[_0x1f91('0x6')](_0x5e52ab));};exports[_0x1f91('0x7')]=function(_0xeb20d3){logger[_0x1f91('0x7')](_0xeb20d3['stack']);};exports[_0x1f91('0x8')]=function(_0x3a791f,_0xb85ecb){return client[_0x1f91('0x8')](_0x3a791f,{'body':_0xb85ecb})['then'](function(_0x5d6070){logger[_0x1f91('0x5')](JSON['stringify'](_0x5d6070));})[_0x1f91('0x9')](function(_0x494781){logger['error'](_0x494781[_0x1f91('0xa')]);});};function getUser(_0x5d0ebb){return client[_0x1f91('0x8')](_0x1f91('0xb'),{'options':{'raw':!![],'attributes':['id',_0x1f91('0xc'),'name','interface'],'where':_0x5d0ebb,'limit':0x1}})[_0x1f91('0xd')](function(_0x36465c){logger[_0x1f91('0x4')]('GETUSER|'+JSON[_0x1f91('0x6')](_0x5d0ebb)+'|'+(_0x36465c['result'][_0x1f91('0xe')]?'FOUND':'NOTFOUND'));return _0x36465c[_0x1f91('0xf')][_0x1f91('0xe')]?_0x36465c[_0x1f91('0xf')][0x0]:null;});}exports['getUserByInternal']=function(_0x3afd29){return new BPromise(function(_0x32d845,_0x27c464){if(_0x3afd29){return getUser({'internal':_0x3afd29})['then'](function(_0x12bb54){return _0x32d845(_0x12bb54);})[_0x1f91('0x9')](function(_0xfabcc3){logger['error'](_0xfabcc3[_0x1f91('0xa')]);return _0x32d845(null);});}else{return _0x32d845(null);}});};exports[_0x1f91('0x10')]=function(_0x19e5c7){return new BPromise(function(_0x24a4ee,_0x1102ad){if(_0x19e5c7){return getUser({'interface':_0x19e5c7})[_0x1f91('0xd')](function(_0x38769d){return _0x24a4ee(_0x38769d);})['catch'](function(_0x3297aa){logger['error'](_0x3297aa['stack']);return _0x24a4ee(null);});}else{return _0x24a4ee(null);}});};exports[_0x1f91('0x11')]=function(_0x224f44){return new BPromise(function(_0x19e45b,_0x3a1ce4){if(_0x224f44){return getUser({'name':_0x224f44})['then'](function(_0x6a69ad){return _0x19e45b(_0x6a69ad);})[_0x1f91('0x9')](function(_0x4176b1){logger['error'](_0x4176b1[_0x1f91('0xa')]);return _0x19e45b(null);});}else{return _0x19e45b(null);}});};exports[_0x1f91('0x12')]=function(_0x1c7e08){return new BPromise(function(_0x20dd84,_0x26e064){if(_0x1c7e08){return client[_0x1f91('0x8')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x1f91('0x13'),_0x1f91('0x14'),_0x1f91('0x15'),_0x1f91('0x16')],'where':{'name':_0x1c7e08},'limit':0x1}})[_0x1f91('0xd')](function(_0x15c108){logger[_0x1f91('0x4')](_0x1f91('0x17')+_0x1c7e08+'|'+(_0x15c108[_0x1f91('0xf')][_0x1f91('0xe')]?_0x1f91('0x18'):_0x1f91('0x19')));return _0x20dd84(_0x15c108[_0x1f91('0xf')][_0x1f91('0xe')]?_0x15c108[_0x1f91('0xf')][0x0]:null);})[_0x1f91('0x9')](function(_0x468c89){logger[_0x1f91('0x7')](_0x468c89[_0x1f91('0xa')]);return _0x20dd84(null);});}else{return _0x20dd84(null);}});};exports['addTime']=function(_0xa8f643,_0x59cf42){return moment(_0xa8f643)[_0x1f91('0x1a')](_0x59cf42,_0x1f91('0x1b'))[_0x1f91('0x1c')](_0x1f91('0x1d'));};exports[_0x1f91('0x1e')]=function(_0x508a79,_0x125188){return moment(_0x508a79)['subtract'](_0x125188,_0x1f91('0x1b'))[_0x1f91('0x1c')](_0x1f91('0x1d'));};exports[_0x1f91('0x1f')]=function(_0x42b719,_0x485042){return moment(_0x42b719)[_0x1f91('0x20')](moment(_0x485042),_0x1f91('0x1b'));};exports[_0x1f91('0x21')]=function(_0x2d5db2,_0x591678){return parseInt(_0x2d5db2,0xa)+parseInt(_0x591678,0xa);};exports[_0x1f91('0x22')]=function(){return moment()['format'](_0x1f91('0x1d'));};exports[_0x1f91('0x23')]=function(_0x101a30,_0x5828bc){if(_0x5828bc){return moment(_0x101a30)['isAfter'](_0x5828bc);}else{return!![];}};exports[_0x1f91('0x24')]=function(_0xfeab7a,_0x2db7b8){if(_0x2db7b8){return moment(_0xfeab7a)[_0x1f91('0x24')](_0x2db7b8);}else if(_0xfeab7a){return!![];}else{return![];}};
\ No newline at end of file